@seatlayer/core 0.89.2 → 0.90.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-A4GTB3SG.js → chunk-52CBK5HX.js} +1 -1
- package/dist/{chunk-R7TV7RYQ.js → chunk-77QFA3F4.js} +1 -1
- package/dist/{chunk-FVTW2IBN.js → chunk-EH47GKSO.js} +1 -1
- package/dist/{chunk-PMBS3VZM.js → chunk-FMPQZEXD.js} +1 -1
- package/dist/{chunk-66Q5LOBH.js → chunk-GISLORLL.js} +1 -1
- package/dist/{chunk-BCMCXHLH.js → chunk-K4TZQOTG.js} +1 -1
- package/dist/{chunk-WAGKI44J.js → chunk-OYKT5CCU.js} +1 -1
- package/dist/chunk-W4RS6OW7.js +1 -0
- package/dist/{chunk-PI3UH2EN.js → chunk-YAWJTFYK.js} +1 -1
- package/dist/core/chart-ops/index.cjs +1 -1
- package/dist/core/chart-ops/index.js +1 -1
- package/dist/core/inventory/index.cjs +1 -1
- package/dist/core/inventory/index.d.cts +2 -2
- package/dist/core/inventory/index.d.ts +2 -2
- package/dist/core/inventory/index.js +1 -1
- package/dist/core/layout/index.cjs +1 -1
- package/dist/core/layout/index.d.cts +2 -2
- package/dist/core/layout/index.d.ts +2 -2
- package/dist/core/layout/index.js +1 -1
- package/dist/core/quality/index.d.cts +2 -2
- package/dist/core/quality/index.d.ts +2 -2
- package/dist/core/sections/index.cjs +1 -1
- package/dist/core/sections/index.d.cts +1 -1
- package/dist/core/sections/index.d.ts +1 -1
- package/dist/core/sections/index.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +18 -8
- package/dist/index.d.ts +18 -8
- package/dist/index.js +1 -1
- package/dist/{renderedQuality-CrlBXHzi.d.ts → renderedQuality-CHm4mIjB.d.ts} +1 -1
- package/dist/{renderedQuality-CeSE6pEM.d.cts → renderedQuality-x1_lUJYV.d.cts} +1 -1
- package/dist/{renderer-B1mEhbA7.d.cts → renderer-DLTYfHV2.d.cts} +6 -2
- package/dist/{renderer-BwZhXv8G.d.ts → renderer-DN1yCX7-.d.ts} +6 -2
- package/dist/{tableSizing-wnW3HNga.d.cts → tableSizing-f-hh6kCg.d.cts} +2 -2
- package/dist/{tableSizing-DyS3UAha.d.ts → tableSizing-oDI0D8c2.d.ts} +2 -2
- package/dist/{ticketRestrictions-DuYWl2uy.d.ts → ticketRestrictions-BXtFOUqJ.d.ts} +1 -1
- package/dist/{ticketRestrictions-BTTN-LzH.d.cts → ticketRestrictions-Bc08-Hip.d.cts} +1 -1
- package/dist/view3d/index.cjs +12 -12
- package/dist/view3d/index.d.cts +1 -1
- package/dist/view3d/index.d.ts +1 -1
- package/dist/view3d/index.js +1 -1
- package/dist/view3d/scene/scene.worker.cjs +1 -1
- package/dist/view3d/scene/scene.worker.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-E7TOTX6I.js +0 -1
package/dist/view3d/index.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var Ts=Object.create;var $t=Object.defineProperty;var _s=Object.getOwnPropertyDescriptor;var Ls=Object.getOwnPropertyNames;var ks=Object.getPrototypeOf,Fs=Object.prototype.hasOwnProperty;var Rt=(e,t,n)=>()=>{if(n)throw n[0];try{return e&&(t=e(e=0)),t}catch(r){throw n=[r],r}};var zo=(e,t)=>{for(var n in t)$t(e,n,{get:t[n],enumerable:!0})},Uo=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Ls(t))!Fs.call(e,o)&&o!==n&&$t(e,o,{get:()=>t[o],enumerable:!(r=_s(t,o))||r.enumerable});return e};var mt=(e,t,n)=>(n=e!=null?Ts(ks(e)):{},Uo(t||!e||!e.__esModule?$t(n,"default",{value:e,enumerable:!0}):n,e)),Ds=e=>Uo($t({},"__esModule",{value:!0}),e);function Jm(e,t){return!Number.isFinite(e)||!Number.isFinite(t)||e<=0||t<=0?0:Math.ceil(e*t*4*(4/3))}function ed(e){return(e!==void 0&&e<=2?32:e!==void 0&&e>=8?192:96)*1024*1024}function In(e){let t=typeof navigator>"u"?void 0:navigator;return{saveData:t?.connection?.saveData===!0,maxTextureSize:e,maxDecodedBytes:ed(t?.deviceMemory)}}function Tn(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,m)=>c.width*c.height-m.width*m.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||Jm(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 $a(){return new DOMException("Panorama image load aborted","AbortError")}function Yt(e,t){return new Promise((n,r)=>{if(t?.aborted){r($a());return}let o=new Image;o.crossOrigin="anonymous";let i=!1,a=()=>{o.onload=null,o.onerror=null,t?.removeEventListener("abort",c)},s=m=>{i||(i=!0,a(),m?r(m):n(o))},c=()=>{o.src="",s($a())};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 _n(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 ko=Rt(()=>{"use strict"});function Za(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(td,Math.min(nd,e))}function od(e,t,n){let r=(.5+e/360)*n;return t/2-r}function rd(e,t=kn){return e*(180/t)}function Qa(e,t,n){return(e-t)/2+Ln(n,t)}function Ln(e,t){let n=Le/180*t;return Math.max(-n,Math.min(n,e))}function id(){if(typeof window>"u")return!1;try{if(typeof window.matchMedia=="function"&&window.matchMedia("(pointer: coarse)").matches)return!0}catch{}return"ontouchstart"in window}function Do(e){return e||(id()?"Drag to look \xB7 pinch to zoom \xB7 tap \u2715 to close":"Drag to look \xB7 pinch or scroll to zoom \xB7 Esc to close")}function Ja(e,t,n={}){let r=n.fadeMs??400,o=t.initialBearingDeg??0,i=Tn(t,In()),a=new AbortController,s=()=>a.abort();n.signal?.addEventListener("abort",s,{once:!0});let c=document.createElement("div"),m=document.activeElement instanceof HTMLElement?document.activeElement:null;c.setAttribute("role","dialog"),c.setAttribute("aria-modal","true"),c.setAttribute("aria-label",n.seatLabel?`View from ${n.seatLabel}`:"View from seat"),c.tabIndex=-1,Object.assign(c.style,{position:"absolute",inset:"0",zIndex:"10",opacity:"0",transition:`opacity ${r}ms ease`,background:"#05070c",overflow:"hidden",touchAction:"none"});let u=document.createElement("div");Object.assign(u.style,{position:"absolute",inset:"0",backgroundImage:`url("${i.initialUrl}")`,backgroundRepeat:"repeat-x",cursor:"grab"}),c.appendChild(u);let p=document.createElement("button");if(p.type="button",p.setAttribute("aria-label","Close"),p.textContent="\u2715",Object.assign(p.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(p),n.disclosure){let N=document.createElement("div");N.textContent=`${n.disclosurePrefix??"360\xB0 panorama"} \xB7 ${n.disclosure}`,Object.assign(N.style,{position:"absolute",top:"calc(12px + var(--sl-3d-top-inset, 0px))",left:"12px",zIndex:"2",maxWidth:"calc(100% - 88px)",padding:"8px 11px",borderRadius:"999px",overflow:"hidden",color:"#dce6f8",background:"rgba(8,12,18,0.68)",font:"600 11px/1.2 ui-sans-serif, system-ui, sans-serif",textOverflow:"ellipsis",whiteSpace:"nowrap",pointerEvents:"none",backdropFilter:"blur(6px)"}),c.appendChild(N)}let d=document.createElement("div");d.textContent=Do(n.lookAroundHint),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),p.focus({preventScroll:!0});let l=0,f=0,b=0,h=0,y=kn,x=()=>{let N=c.clientHeight||1,D=c.clientWidth||1,W=R.naturalWidth||D*2,X=R.naturalHeight||N,Q=l>0?(D/2-b)/l:0,q=f>0?h/f:0;f=rd(N,y),l=f*(W/X),u.style.backgroundSize=`${l}px ${f}px`,g?b=D/2-Q*l:(b=od(o,D,l),h=Ln((t.initialPitchDeg??0)/180*f,f),g=!0),h=Ln(q*f,f),u.style.backgroundPosition=`${b}px ${Qa(N,f,h)}px`},g=!1,v=()=>{let N=c.clientHeight||1;h=Ln(h,f),u.style.backgroundPosition=`${b}px ${Qa(N,f,h)}px`},R=new Image;R.onload=x,R.src=i.initialUrl;let P=()=>{};i.upgradeUrl&&(P=_n(()=>{(t.resolveUrl?t.resolveUrl(i.upgradeUrl):Promise.resolve(i.upgradeUrl)).then(D=>!D||a.signal.aborted?null:Yt(D,a.signal).then(W=>({full:W,url:D}))).then(D=>{D&&(w||a.signal.aborted||(R=D.full,u.style.backgroundImage=`url("${D.url}")`,x()))}).catch(()=>{})})),requestAnimationFrame(x);let M=!1,A=0,k=0,z=0,V=new Map,L=()=>{let[N,D]=[...V.values()];return N&&D?Math.hypot(N.x-D.x,N.y-D.y):0},C=N=>{let D=Fo(N);D!==y&&(y=D,x())},_=N=>{V.set(N.pointerId,{x:N.clientX,y:N.clientY}),M=V.size===1,A=N.clientX,k=N.clientY,V.size===2&&(z=L()),u.style.cursor="grabbing";try{u.setPointerCapture?.(N.pointerId)}catch{}},B=N=>{if(V.has(N.pointerId)){if(V.set(N.pointerId,{x:N.clientX,y:N.clientY}),V.size>=2){let D=L();z>0&&D>0&&C(y*(z/D)),z=D,M=!1;return}M&&(b+=N.clientX-A,h+=N.clientY-k,A=N.clientX,k=N.clientY,v())}},S=N=>{V.delete(N.pointerId),z=V.size===2?L():0;let D=V.values().next().value;M=V.size===1,D?(A=D.x,k=D.y):u.style.cursor="grab";try{u.releasePointerCapture?.(N.pointerId)}catch{}},E=N=>{N.preventDefault(),C(y+N.deltaY*.04)};u.addEventListener("pointerdown",_),u.addEventListener("pointermove",B),u.addEventListener("pointerup",S),u.addEventListener("pointercancel",S),u.addEventListener("wheel",E,{passive:!1});let T=!1,w=!1,F=0,I=()=>{u.removeEventListener("pointerdown",_),u.removeEventListener("pointermove",B),u.removeEventListener("pointerup",S),u.removeEventListener("pointercancel",S),u.removeEventListener("wheel",E),window.removeEventListener("keydown",H)},O=()=>{P(),a.abort(),n.signal?.removeEventListener("abort",s),F&&(window.clearTimeout(F),F=0),I(),c.parentNode&&c.parentNode.removeChild(c),m?.isConnected&&m.focus({preventScroll:!0})},j=()=>{if(T)return;T=!0,c.style.opacity="0";let N=()=>{F=0,!w&&(O(),n.onClose?.())};F=window.setTimeout(N,r)},H=N=>{if(N.key==="Tab"){N.preventDefault(),p.focus({preventScroll:!0});return}if(N.key==="Escape"){N.stopPropagation(),j();return}if(N.key==="ArrowLeft"||N.key==="ArrowRight")b+=N.key==="ArrowLeft"?-32:32;else if(N.key==="ArrowUp"||N.key==="ArrowDown")h+=(N.key==="ArrowUp"?4:-4)*(f/180);else if(N.key==="+"||N.key==="="){C(y-5),N.preventDefault();return}else if(N.key==="-"){C(y+5),N.preventDefault();return}else return;N.preventDefault(),v()};return window.addEventListener("keydown",H),p.addEventListener("click",j),requestAnimationFrame(()=>{c.style.opacity="1"}),{close:j,dispose(){T=!0,w=!0,O()}}}var kn,td,nd,Le,Fn=Rt(()=>{"use strict";ko();kn=70,td=35,nd=90;Le=35});function ld(e=ad,t=sd,n=cd){let r=e+1,o=t+1,i=r*o,a=new Float32Array(i*3),s=new Float32Array(i*2);for(let u=0;u<o;u++){let p=u/t,d=p*Math.PI,l=Math.sin(d),f=Math.cos(d);for(let b=0;b<r;b++){let h=b/e,y=(h-.5)*Math.PI*2,x=u*r+b;a[x*3]=n*l*Math.sin(y),a[x*3+1]=n*f,a[x*3+2]=-n*l*Math.cos(y),s[x*2]=h,s[x*2+1]=p}}let c=new Uint16Array(e*t*6),m=0;for(let u=0;u<t;u++)for(let p=0;p<e;p++){let d=u*r+p,l=d+r;c[m++]=d,c[m++]=l,c[m++]=d+1,c[m++]=d+1,c[m++]=l,c[m++]=l+1}return{position:a,uv:s,index:c}}function es(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 ts(e,t){let{position:n,uv:r,index:o}=ld(),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:ud,fragment:md,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(m){s.uniforms.uOpacity.value=Math.max(0,Math.min(1,m))},setImage(m){a.image=m,a.needsUpdate=!0},dispose(){c.setParent(null),i.remove(),a.texture&&e.deleteTexture(a.texture),s.remove()}}}var Ke,ad,sd,cd,ud,md,ns=Rt(()=>{"use strict";Ke=require("ogl"),ad=64,sd=32,cd=500;ud=`#version 300 es
|
|
1
|
+
"use strict";var _s=Object.create;var $t=Object.defineProperty;var Ls=Object.getOwnPropertyDescriptor;var ks=Object.getOwnPropertyNames;var Fs=Object.getPrototypeOf,Ds=Object.prototype.hasOwnProperty;var Rt=(e,t,n)=>()=>{if(n)throw n[0];try{return e&&(t=e(e=0)),t}catch(r){throw n=[r],r}};var zo=(e,t)=>{for(var n in t)$t(e,n,{get:t[n],enumerable:!0})},Uo=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of ks(t))!Ds.call(e,o)&&o!==n&&$t(e,o,{get:()=>t[o],enumerable:!(r=Ls(t,o))||r.enumerable});return e};var mt=(e,t,n)=>(n=e!=null?_s(Fs(e)):{},Uo(t||!e||!e.__esModule?$t(n,"default",{value:e,enumerable:!0}):n,e)),Os=e=>Uo($t({},"__esModule",{value:!0}),e);function Jm(e,t){return!Number.isFinite(e)||!Number.isFinite(t)||e<=0||t<=0?0:Math.ceil(e*t*4*(4/3))}function ed(e){return(e!==void 0&&e<=2?32:e!==void 0&&e>=8?192:96)*1024*1024}function Tn(e){let t=typeof navigator>"u"?void 0:navigator;return{saveData:t?.connection?.saveData===!0,maxTextureSize:e,maxDecodedBytes:ed(t?.deviceMemory)}}function _n(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,u)=>c.width*c.height-u.width*u.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||Jm(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 Qa(){return new DOMException("Panorama image load aborted","AbortError")}function Yt(e,t){return new Promise((n,r)=>{if(t?.aborted){r(Qa());return}let o=new Image;o.crossOrigin="anonymous";let i=!1,a=()=>{o.onload=null,o.onerror=null,t?.removeEventListener("abort",c)},s=u=>{i||(i=!0,a(),u?r(u):n(o))},c=()=>{o.src="",s(Qa())};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 Ln(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 ko=Rt(()=>{"use strict"});function Ja(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(td,Math.min(nd,e))}function od(e,t,n){let r=(.5+e/360)*n;return t/2-r}function rd(e,t=Fn){return e*(180/t)}function Za(e,t,n){return(e-t)/2+kn(n,t)}function kn(e,t){let n=Le/180*t;return Math.max(-n,Math.min(n,e))}function id(){if(typeof window>"u")return!1;try{if(typeof window.matchMedia=="function"&&window.matchMedia("(pointer: coarse)").matches)return!0}catch{}return"ontouchstart"in window}function Do(e){return e||(id()?"Drag to look \xB7 pinch to zoom \xB7 tap \u2715 to close":"Drag to look \xB7 pinch or scroll to zoom \xB7 Esc to close")}function es(e,t,n={}){let r=n.fadeMs??400,o=t.initialBearingDeg??0,i=_n(t,Tn()),a=new AbortController,s=()=>a.abort();n.signal?.addEventListener("abort",s,{once:!0});let c=document.createElement("div"),u=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 d=document.createElement("div");Object.assign(d.style,{position:"absolute",inset:"0",backgroundImage:`url("${i.initialUrl}")`,backgroundRepeat:"repeat-x",cursor:"grab"}),c.appendChild(d);let f=document.createElement("button");if(f.type="button",f.setAttribute("aria-label","Close"),f.textContent="\u2715",Object.assign(f.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(f),n.disclosure){let N=document.createElement("div");N.textContent=`${n.disclosurePrefix??"360\xB0 panorama"} \xB7 ${n.disclosure}`,Object.assign(N.style,{position:"absolute",top:"calc(12px + var(--sl-3d-top-inset, 0px))",left:"12px",zIndex:"2",maxWidth:"calc(100% - 88px)",padding:"8px 11px",borderRadius:"999px",overflow:"hidden",color:"#dce6f8",background:"rgba(8,12,18,0.68)",font:"600 11px/1.2 ui-sans-serif, system-ui, sans-serif",textOverflow:"ellipsis",whiteSpace:"nowrap",pointerEvents:"none",backdropFilter:"blur(6px)"}),c.appendChild(N)}let m=document.createElement("div");m.textContent=Do(n.lookAroundHint),Object.assign(m.style,{position:"absolute",bottom:"12px",left:"0",right:"0",textAlign:"center",color:"rgba(230,237,243,0.7)",font:"12px ui-sans-serif, system-ui, sans-serif",pointerEvents:"none"}),c.appendChild(m),e.appendChild(c),f.focus({preventScroll:!0});let l=0,p=0,b=0,h=0,y=Fn,x=()=>{let N=c.clientHeight||1,D=c.clientWidth||1,W=C.naturalWidth||D*2,X=C.naturalHeight||N,Q=l>0?(D/2-b)/l:0,q=p>0?h/p:0;p=rd(N,y),l=p*(W/X),d.style.backgroundSize=`${l}px ${p}px`,g?b=D/2-Q*l:(b=od(o,D,l),h=kn((t.initialPitchDeg??0)/180*p,p),g=!0),h=kn(q*p,p),d.style.backgroundPosition=`${b}px ${Za(N,p,h)}px`},g=!1,v=()=>{let N=c.clientHeight||1;h=kn(h,p),d.style.backgroundPosition=`${b}px ${Za(N,p,h)}px`},C=new Image;C.onload=x,C.src=i.initialUrl;let P=()=>{};i.upgradeUrl&&(P=Ln(()=>{(t.resolveUrl?t.resolveUrl(i.upgradeUrl):Promise.resolve(i.upgradeUrl)).then(D=>!D||a.signal.aborted?null:Yt(D,a.signal).then(W=>({full:W,url:D}))).then(D=>{D&&(w||a.signal.aborted||(C=D.full,d.style.backgroundImage=`url("${D.url}")`,x()))}).catch(()=>{})})),requestAnimationFrame(x);let M=!1,R=0,k=0,z=0,V=new Map,L=()=>{let[N,D]=[...V.values()];return N&&D?Math.hypot(N.x-D.x,N.y-D.y):0},A=N=>{let D=Fo(N);D!==y&&(y=D,x())},_=N=>{V.set(N.pointerId,{x:N.clientX,y:N.clientY}),M=V.size===1,R=N.clientX,k=N.clientY,V.size===2&&(z=L()),d.style.cursor="grabbing";try{d.setPointerCapture?.(N.pointerId)}catch{}},B=N=>{if(V.has(N.pointerId)){if(V.set(N.pointerId,{x:N.clientX,y:N.clientY}),V.size>=2){let D=L();z>0&&D>0&&A(y*(z/D)),z=D,M=!1;return}M&&(b+=N.clientX-R,h+=N.clientY-k,R=N.clientX,k=N.clientY,v())}},S=N=>{V.delete(N.pointerId),z=V.size===2?L():0;let D=V.values().next().value;M=V.size===1,D?(R=D.x,k=D.y):d.style.cursor="grab";try{d.releasePointerCapture?.(N.pointerId)}catch{}},E=N=>{N.preventDefault(),A(y+N.deltaY*.04)};d.addEventListener("pointerdown",_),d.addEventListener("pointermove",B),d.addEventListener("pointerup",S),d.addEventListener("pointercancel",S),d.addEventListener("wheel",E,{passive:!1});let T=!1,w=!1,F=0,I=()=>{d.removeEventListener("pointerdown",_),d.removeEventListener("pointermove",B),d.removeEventListener("pointerup",S),d.removeEventListener("pointercancel",S),d.removeEventListener("wheel",E),window.removeEventListener("keydown",H)},O=()=>{P(),a.abort(),n.signal?.removeEventListener("abort",s),F&&(window.clearTimeout(F),F=0),I(),c.parentNode&&c.parentNode.removeChild(c),u?.isConnected&&u.focus({preventScroll:!0})},j=()=>{if(T)return;T=!0,c.style.opacity="0";let N=()=>{F=0,!w&&(O(),n.onClose?.())};F=window.setTimeout(N,r)},H=N=>{if(N.key==="Tab"){N.preventDefault(),f.focus({preventScroll:!0});return}if(N.key==="Escape"){N.stopPropagation(),j();return}if(N.key==="ArrowLeft"||N.key==="ArrowRight")b+=N.key==="ArrowLeft"?-32:32;else if(N.key==="ArrowUp"||N.key==="ArrowDown")h+=(N.key==="ArrowUp"?4:-4)*(p/180);else if(N.key==="+"||N.key==="="){A(y-5),N.preventDefault();return}else if(N.key==="-"){A(y+5),N.preventDefault();return}else return;N.preventDefault(),v()};return window.addEventListener("keydown",H),f.addEventListener("click",j),requestAnimationFrame(()=>{c.style.opacity="1"}),{close:j,dispose(){T=!0,w=!0,O()}}}var Fn,td,nd,Le,Dn=Rt(()=>{"use strict";ko();Fn=70,td=35,nd=90;Le=35});function ld(e=ad,t=sd,n=cd){let r=e+1,o=t+1,i=r*o,a=new Float32Array(i*3),s=new Float32Array(i*2);for(let d=0;d<o;d++){let f=d/t,m=f*Math.PI,l=Math.sin(m),p=Math.cos(m);for(let b=0;b<r;b++){let h=b/e,y=(h-.5)*Math.PI*2,x=d*r+b;a[x*3]=n*l*Math.sin(y),a[x*3+1]=n*p,a[x*3+2]=-n*l*Math.cos(y),s[x*2]=h,s[x*2+1]=f}}let c=new Uint16Array(e*t*6),u=0;for(let d=0;d<t;d++)for(let f=0;f<e;f++){let m=d*r+f,l=m+r;c[u++]=m,c[u++]=l,c[u++]=m+1,c[u++]=m+1,c[u++]=l,c[u++]=l+1}return{position:a,uv:s,index:c}}function ts(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 ns(e,t){let{position:n,uv:r,index:o}=ld(),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:ud,fragment:md,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(u){s.uniforms.uOpacity.value=Math.max(0,Math.min(1,u))},setImage(u){a.image=u,a.needsUpdate=!0},dispose(){c.setParent(null),i.remove(),a.texture&&e.deleteTexture(a.texture),s.remove()}}}var Ke,ad,sd,cd,ud,md,os=Rt(()=>{"use strict";Ke=require("ogl"),ad=64,sd=32,cd=500;ud=`#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 rs(e,t,n,r={}){let o=r.fadeMs??400,i=t?.initialBearingDeg??0,a=Math.max(-Le,Math.min(Le,t?.initialPitchDeg??0)),s=kn,c=!1,m=new AbortController,u=()=>m.abort();r.signal?.addEventListener("abort",u,{once:!0});let p=()=>{},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 I=n.camera.position,O=n.focalWorld[0]-I.x,j=n.focalWorld[1]-I.y,H=n.focalWorld[2]-I.z,N=Math.hypot(O,H);N>.001&&(i=Math.atan2(O,-H)*180/Math.PI,a=Math.max(-Le,Math.min(Le,Math.atan2(j,N)*180/Math.PI)))}let l=null;if(t){let I=n.gl.getParameter(n.gl.MAX_TEXTURE_SIZE),O=Tn(t,In(I)),j;try{let H=t.resolveUrl?await t.resolveUrl(O.initialUrl):O.initialUrl;if(!H)throw new Error("panorama_asset_unavailable");j=await Yt(H,m.signal)}catch{return r.signal?.removeEventListener("abort",u),null}try{l=ts(n.gl,j)}catch{return m.abort(),r.signal?.removeEventListener("abort",u),null}l.mesh.renderOrder=999,l.mesh.setParent(n.scene),O.upgradeUrl&&(p=_n(()=>{(t.resolveUrl?t.resolveUrl(O.upgradeUrl):Promise.resolve(O.upgradeUrl)).then(N=>!N||m.signal.aborted?null:Yt(N,m.signal)).then(N=>{N&&(c||m.signal.aborted||(l?.setImage(N),n.requestRender()))}).catch(()=>{})}))}let f=n.camera.fov;n.camera.perspective({fov:s,aspect:n.camera.aspect});let b=n.camera.quaternion.slice(),h=()=>{let I=n.camera.position;l?.mesh.position.set(I.x,I.y,I.z);let[O,j,H]=es(i,a);n.camera.lookAt([I.x+O,I.y+j,I.z+H]),n.requestRender()};h();let y=document.createElement("div"),x=document.activeElement instanceof HTMLElement?document.activeElement:null;y.setAttribute("role","dialog"),y.setAttribute("aria-modal","true"),y.setAttribute("aria-label",r.seatLabel?`View from ${r.seatLabel}`:"View from seat"),y.tabIndex=-1,Object.assign(y.style,{position:"absolute",inset:"0",zIndex:"10",cursor:"grab",touchAction:"none"});let g=document.createElement("button");if(g.type="button",g.setAttribute("aria-label","Close"),g.textContent="\u2715",Object.assign(g.style,{position:"absolute",top:"12px",right:"12px",zIndex:"2",width:"44px",height:"44px",borderRadius:"999px",cursor:"pointer",border:"1px solid rgba(255,255,255,0.25)",background:"rgba(8,12,18,0.6)",color:"#e6edf3",fontSize:"15px",lineHeight:"1"}),y.appendChild(g),r.disclosure){let I=document.createElement("div");I.textContent=`${r.disclosurePrefix??"360\xB0 panorama"} \xB7 ${r.disclosure}`,Object.assign(I.style,{position:"absolute",top:"calc(12px + var(--sl-3d-top-inset, 0px))",left:"12px",zIndex:"2",maxWidth:"calc(100% - 88px)",padding:"8px 11px",borderRadius:"999px",overflow:"hidden",color:"#dce6f8",background:"rgba(8,12,18,0.68)",font:"600 11px/1.2 ui-sans-serif, system-ui, sans-serif",textOverflow:"ellipsis",whiteSpace:"nowrap",pointerEvents:"none",backdropFilter:"blur(6px)"}),y.appendChild(I)}let v=document.createElement("div");v.textContent=Do(r.lookAroundHint),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"}),y.appendChild(v),e.appendChild(y),g.focus({preventScroll:!0});let R=!1,P=0,M=0,A=0,k=new Map,z=()=>{let[I,O]=[...k.values()];return I&&O?Math.hypot(I.x-O.x,I.y-O.y):0},V=I=>{let O=Fo(I);O!==s&&(s=O,n.camera.perspective({fov:s,aspect:n.camera.aspect}),h())},L=I=>{I.target!==g&&(k.set(I.pointerId,{x:I.clientX,y:I.clientY}),R=k.size===1,P=I.clientX,M=I.clientY,k.size===2&&(A=z()),y.setPointerCapture?.(I.pointerId),y.style.cursor="grabbing")},C=I=>{if(k.has(I.pointerId)){if(k.set(I.pointerId,{x:I.clientX,y:I.clientY}),k.size>=2){let O=z();A>0&&O>0&&V(s*(A/O)),A=O,R=!1;return}R&&(i+=(I.clientX-P)*os,a=Math.max(-Le,Math.min(Le,a+(I.clientY-M)*os)),P=I.clientX,M=I.clientY,h())}},_=I=>{k.delete(I.pointerId),A=k.size===2?z():0;let O=k.values().next().value;R=k.size===1,O?(P=O.x,M=O.y):y.style.cursor="grab";try{y.releasePointerCapture?.(I.pointerId)}catch{}},B=I=>{I.preventDefault(),V(s+I.deltaY*.04)};y.addEventListener("pointerdown",L),y.addEventListener("pointermove",C),y.addEventListener("pointerup",_),y.addEventListener("pointercancel",_),y.addEventListener("wheel",B,{passive:!1});let S=I=>{if(!c){if(I.key==="Tab"){I.preventDefault(),g.focus({preventScroll:!0});return}if(I.key==="Escape"){I.stopPropagation(),F.close();return}if(I.key==="ArrowLeft"||I.key==="ArrowRight")i+=I.key==="ArrowLeft"?-4:4;else if(I.key==="ArrowUp"||I.key==="ArrowDown")a=Math.max(-Le,Math.min(Le,a+(I.key==="ArrowUp"?4:-4)));else if(I.key==="+"||I.key==="="){V(s-5),I.preventDefault();return}else if(I.key==="-"){V(s+5),I.preventDefault();return}else return;I.preventDefault(),h()}};window.addEventListener("keydown",S);let E=0,T=(I,O)=>{if(!l){O?.();return}let j=I===1?0:1,H=performance.now(),N=()=>{if(c)return;let D=o<=0?1:Math.min(1,(performance.now()-H)/o);l?.setOpacity(j+(I-j)*D),n.requestRender(),D<1?E=requestAnimationFrame(N):O?.()};E=requestAnimationFrame(N)};T(1);let w=()=>{c||(c=!0,p(),m.abort(),r.signal?.removeEventListener("abort",u),cancelAnimationFrame(E),y.removeEventListener("pointerdown",L),y.removeEventListener("pointermove",C),y.removeEventListener("pointerup",_),y.removeEventListener("pointercancel",_),y.removeEventListener("wheel",B),window.removeEventListener("keydown",S),y.remove(),x?.isConnected&&x.focus({preventScroll:!0}),l?.dispose(),n.camera.position.set(d[0],d[1],d[2]),n.camera.perspective({fov:f,aspect:n.camera.aspect}),n.camera.quaternion.set(b[0],b[1],b[2],b[3]),n.requestRender())},F={close(){if(c)return;let I=()=>{w(),r.onClose?.()};cancelAnimationFrame(E),T(0,I)},dispose:w};return g.addEventListener("click",()=>F.close()),F}var os,is=Rt(()=>{"use strict";ns();Fn();Fn();ko();os=.15});var as={};zo(as,{createOpenPanorama:()=>dd});function dd(e){let{container:t,model:n,opts:r,analytics:o,orbit:i,loop:a,seatsById:s,ensureSeatView:c,resolvedSeatViewPose:m,gpu:u,gl:p,isContextLost:d,isDisposed:l,flightGen:f,setPanorama:b,getLoadAbort:h,setLoadAbort:y,setPanoramaSphereVisible:x,setFrozen:g,raisePanoramaLayer:v,restorePanoramaLayer:R,getOverviewChip:P,labelOverlay:M,reducedMotion:A,removeArriveChip:k,showArriveChip:z}=e;return async(V,L,C)=>{h()?.abort();let _=new AbortController;y(_);let B=n.seats.idToIndex.get(V);if(B===void 0){i.syncFromCamera();return}let S=s.get(V)?.label??V,E=m(V,B),T=c(V);if(!T){_.abort(),h()===_&&y(null),i.syncFromCamera();return}g(!0),a.stop();let w;try{w=await T}catch{if(h()===_&&y(null),o.panoramaFailed(V,"source"),!l()&&C===f()){g(!1),i.resumeAfterFlight(E.focal),a.requestRender();let W=z(V,C,!0);requestAnimationFrame(()=>W?.querySelector("[data-panorama-trigger]")?.focus())}return}if(l()||C!==f()){_.abort(),h()===_&&y(null);return}k();let F=P(),I=()=>{_.abort(),h()===_&&y(null),b(null),x(!1),R(),F.style.display="",M.setVisible(!r.arriveAtSeatEye),g(!1),o.panoramaClosed(),i.resumeAfterFlight(E.focal),a.requestRender();let W=z(V,f());requestAnimationFrame(()=>W?.querySelector("[data-panorama-trigger]")?.focus())},O=w.generated===!0,j=Za(w);v(),x(!O),F.style.display="none";let H=A()?0:L,N=u(),D=N&&!d()?await rs(t,O?null:w,{gl:p,scene:N.main,camera:i.camera,requestRender:()=>a.requestRender(),cameraOriginWorld:O?E.eye:void 0,focalWorld:E.focal},{fadeMs:H,seatLabel:S,disclosure:j,disclosurePrefix:O?"Live seat-eye view":"360\xB0 panorama",lookAroundHint:r.lookAroundHint,onClose:I,signal:_.signal}):null;if(l()||C!==f()){_.abort(),x(!1),h()===_&&y(null),D?.dispose(),F.style.display="",R();return}if(D)i.syncFromCamera(),M.setVisible(!1),g(!1),a.requestRender(),b(D);else if(O){R(),F.style.display="",g(!1),i.resumeAfterFlight(E.focal),a.requestRender(),b(null),x(!1),o.panoramaFailed(V,"mount");let W=z(V,f(),!0);requestAnimationFrame(()=>W?.querySelector("[data-panorama-trigger]")?.focus()),h()===_&&y(null);return}else x(!1),o.panoramaFallback(V),b(Ja(t,w,{fadeMs:H,seatLabel:S,disclosure:j,onClose:I,signal:_.signal,lookAroundHint:r.lookAroundHint}));o.panoramaOpened()}}var ss=Rt(()=>{"use strict";Fn();is()});var Md={};zo(Md,{VENUE3D_QUALITY_REPORT_VERSION:()=>ra,buildSceneModel:()=>St,inspectVenue3DQualityEvidence:()=>Mn,mountVenue3D:()=>Sd,prepareVenue3D:()=>vs,prepareVenue3DFromChart:()=>Ss});module.exports=Ds(Md);var Xo=require("ogl");var Os=/^#?([\da-f]{3}|[\da-f]{6})$/i;function Vs(e){let t=Os.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 ne(e){let t=Vs(e);return t?[t[0]/255,t[1]/255,t[2]/255]:null}function Un(e){let t=e/255;return t<=.04045?t/12.92:((t+.055)/1.055)**2.4}function Bs(e){return .2126*Un(e[0])+.7152*Un(e[1])+.0722*Un(e[2])}function Ho(e){return Bs([e[0]*255,e[1]*255,e[2]*255])}function Ns(e){return .2126*e[0]+.7152*e[1]+.0722*e[2]}function ge(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 Et(e,t){let n=Ns(e);return ge(e,[n,n,n],t)}var pe=["available","held","sold","selected","dimmed"];function It(e){let t=pe.indexOf(e);return t<0?0:t}var jo={available:[.24,.82,.52],held:[.95,.66,.22],sold:[.34,.39,.45],selected:[.24,.74,1],dimmed:[.28,.32,.37]};function Yo(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 Hn={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]},Je={top:[.05,.06,.08],bottom:[.1,.12,.15]};function Pe(e,t){return[Math.min(1,e[0]*t),Math.min(1,e[1]*t),Math.min(1,e[2]*t)]}function Gs(){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 Qt=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 Xo.Renderer({canvas:this.canvas,dpr:Gs(),alpha:!1,antialias:!1,depth:!0,stencil:!1,powerPreference:"high-performance",webgl:2}),this.gl=this.renderer.gl,this.clearRgb=[Je.top[0],Je.top[1],Je.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 ft=require("ogl"),he=Math.PI/180,jn=15*he,Yn=80*he,dt=.12,Wo=35,Ko=1.25,qo=.006,zs=4,pt=.82,Tt=1/pt,Us=.12,Hs=2;function js(e,t){return{azimuth:e*qo,polar:-t*qo}}function Ys(e,t,n){let r=Math.max(Hs,Math.max(1,t)*Us),o=n*zs;return{minDist:e?Math.min(e.minDist,r):r,maxDist:e?Math.max(e.maxDist,o):o}}var Zt=class{constructor(t,n,r,o){this.fovY=Wo;this.target=new ft.Vec3;this.azimuth=-30*he;this.polar=55*he;this.distance=10;this.azT=-30*he;this.polT=55*he;this.distT=10;this.minDist=1;this.maxDist=100;this.envelope=null;this.gestureFired=!1;this.interactionEnabled=!0;this.dragging=!1;this.panning=!1;this.lastX=0;this.lastY=0;this.activePointers=new Map;this.pinchDist=0;this.pinchCx=0;this.pinchCy=0;this.targetT=new ft.Vec3;this.panAnchor=new ft.Vec3;this.panLimit=0;this.primaryDragMode="orbit";this.camera=new ft.Camera(t,{fov:Wo,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 m=this.currentPinchDistance();this.pinchDist>0&&(this.dollyBy(Math.exp((this.pinchDist-m)*.005)),this.fireGesture()),this.pinchDist=m;let u=this.pinchCentroid();this.panBy(u.x-this.pinchCx,u.y-this.pinchCy),this.pinchCx=u.x,this.pinchCy=u.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}if(!this.dragging)return;this.lastX=i.clientX,this.lastY=i.clientY,(a!==0||s!==0)&&this.fireGesture();let c=js(a,s);this.azT+=c.azimuth,this.polT=Math.max(jn,Math.min(Yn,this.polT+c.polar)),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*he;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(jn,Math.min(Yn,this.polT+(i.key==="ArrowUp"?-a:a)));else if(i.key==="+"||i.key==="=")this.dollyBy(pt);else if(i.key==="-"||i.key==="_")this.dollyBy(Tt);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*he/2)/r,i=Math.sin(this.azimuth),a=Math.cos(this.azimuth),s=a,c=-i,m=Math.cos(this.polar),u=Math.sin(this.polar),p=-i*m,d=-a*m;this.targetT.x+=(-t*s+n*p)*o,this.targetT.z+=(-t*c+n*d)*o,this.targetT.y+=n*u*o,this.clampPan(),this.requestRender()}clampPan(){if(this.panLimit<=0)return;let t=this.panLimit,n=this.panAnchor.x,r=this.panAnchor.y,o=this.panAnchor.z;this.targetT.x=Math.max(n-t,Math.min(n+t,this.targetT.x)),this.targetT.z=Math.max(o-t,Math.min(o+t,this.targetT.z)),this.targetT.y=Math.max(r-t*.5,Math.min(r+t,this.targetT.y))}fireGesture(){this.gestureFired||(this.gestureFired=!0,this.onGesture?.())}currentPinchDistance(){let t=[...this.activePointers.values()];return t.length<2?0:Math.hypot(t[0].x-t[1].x,t[0].y-t[1].y)}dollyBy(t){this.distT=Math.max(this.minDist,Math.min(this.maxDist,this.distT*t)),this.requestRender()}zoomBy(t){this.interactionEnabled&&(this.dollyBy(t),this.fireGesture())}dollyLimitState(){return{atMin:this.distT<=this.minDist+1e-6,atMax:this.distT>=this.maxDist-1e-6}}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*he/2,c=o?Math.max(.82,this.camera.aspect||1):this.camera.aspect||1,m=Math.atan(Math.tan(s)*c);this.azT=r??-30*he,this.polT=Math.max(15,Math.min(80,i?.polarDeg??55))*he;let u=this.fitDistance(t,s,m,this.azT,this.polT);this.distT=u*Math.max(1.05,Math.min(2,i?.margin??Ko)),this.envelope=Ys(this.envelope,a,u),this.minDist=this.envelope.minDist,this.maxDist=this.envelope.maxDist,n?(this.azimuth=this.azT,this.polar=12*he,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*he/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))*he;let c=this.fitDistance(t,i,s,this.azT,this.polT);this.distT=c*Math.max(1.05,Math.min(2,o?.margin??Ko))}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 m=Math.sin(i),u=-m*Math.sin(o),p=-Math.cos(i),d=-m*Math.cos(o);if(Math.abs(p)>.999)return s;let l=-d,f=u,b=Math.hypot(l,f);l/=b,f/=b;let h=-f*p,y=f*u-l*d,x=l*p,g=Math.tan(r),v=Math.tan(n),R=1;for(let P=0;P<8;P++){let M=(P&1?c.max[0]:c.min[0])-t.center[0],A=(P&2?c.max[1]:c.min[1])-t.center[1],k=(P&4?c.max[2]:c.min[2])-t.center[2],z=M*u+A*p+k*d,V=Math.abs(M*l+k*f),L=Math.abs(M*h+A*y+k*x);R=Math.max(R,V/g-z,L/v-z)}return Math.min(s,Math.max(R,a*.35))}updateClipping(t){let n=this.camera.position.x-t.center[0],r=this.camera.position.y-t.center[1],o=this.camera.position.z-t.center[2],i=Math.hypot(n,r,o),a=Math.max(1,t.radius)*1.18,s=Math.max(.05,i-a),c=Math.max(s+10,i+a);this.camera.perspective({near:s,far:c,aspect:this.camera.aspect})}update(){let t=this.azT-this.azimuth,n=this.polT-this.polar,r=this.distT-this.distance,o=this.targetT.x-this.target.x,i=this.targetT.y-this.target.y,a=this.targetT.z-this.target.z,s=Math.max(1e-4,this.distance*1e-4),c=Math.abs(t)>1e-4||Math.abs(n)>1e-4||Math.abs(r)>1e-4||Math.abs(o)>s||Math.abs(i)>s||Math.abs(a)>s;return this.azimuth+=t*dt,this.polar+=n*dt,this.distance+=r*dt,this.target.x+=o*dt,this.target.y+=i*dt,this.target.z+=a*dt,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(jn,Math.min(Yn,Math.acos(Math.max(-1,Math.min(1,n/o)))));this.distance=this.distT=o,this.polar=this.polT=i,this.azimuth=this.azT=Math.atan2(t,r)}setTarget(t){this.target.set(t[0],t[1],t[2]),this.targetT.copy(this.target)}resumeAfterFlight(t){this.camera.perspective({fov:this.fovY,aspect:this.camera.aspect}),t&&this.target.set(t[0],t[1],t[2]),this.targetT.copy(this.target),this.syncFromCamera()}applyPosition(){let t=Math.sin(this.polar),n=this.target.x+this.distance*t*Math.sin(this.azimuth),r=this.target.y+this.distance*Math.cos(this.polar),o=this.target.z+this.distance*t*Math.cos(this.azimuth);this.camera.position.set(n,r,o),this.camera.lookAt(this.target)}dispose(){this.canvas.removeEventListener("pointerdown",this.onPointerDown),this.canvas.removeEventListener("pointermove",this.onPointerMove),this.canvas.removeEventListener("pointerup",this.onPointerUp),this.canvas.removeEventListener("pointercancel",this.onPointerUp),this.canvas.removeEventListener("wheel",this.onWheel),this.canvas.removeEventListener("keydown",this.onKeyDown),this.canvas.removeEventListener("contextmenu",this.onContextMenu),this.activePointers.clear()}};var Jt=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}};function $o(e,t,n){return Math.max(t,Math.min(n,e))}var ht=2.5,Xs=1.15,_t=6,bt=10,Qo=6,Zo=9.5,Jo=.9,er=2.2,Xn=30,Wn=4,en=8192;var Ld=bt+Wn;function tr(e,t){let n=t*1.4,r=t*3.2;if(e<=n)return{scale:1,fade:0,minPixels:ht};let o=Math.min(1,(e-n)/Math.max(.001,r-n));return{scale:1-o*.4,fade:o*.55,minPixels:ht+o*(Xs-ht)}}function nr(e,t,n){return!(e>0)||!(t>0)||!(n>0)?!1:t*n/e>=64}function or(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 Ws=[{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"}],Fd=new Map(Ws.map(e=>[e.key,e]));var Ks={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 rr(e){let t=e?.[0];return t&&Ks[t]||"#3b82f6"}var qs=[{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"}],Dd=new Map(qs.map(e=>[e.key,e]));var $s=["reference-focal","bar","entrance","exit","restroom","screen","sound","concession","coat","wall","rail","suite","obstruction"],Od=new Set($s);var ar=[{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}}],sr=ar.map(e=>e.key),Qs=new Map(ar.map(e=>[e.key,e]));function ir(e){return typeof e=="string"&&Qs.has(e)}function cr(e,t){return ir(e)?e:ir(t?.seatGlyph)?t.seatGlyph:"circle"}var be=.02291666666666667,He=1/be,Zs=58,Js=Zs*be;var ec=3,lr=0,Kn=120,tc=0,nc=45,oc=7,Ie=1.2;function qn(e,t,n,r){return Number.isFinite(e)?Math.max(t,Math.min(n,e)):r}function rc(e){return!Number.isFinite(e)||!Number.isInteger(e)||e<0?0:e<=oc?e:ec}function tn(e,t={}){let n=qn(t.floorBaseHeightM,lr,Kn,0),r=Math.min(Kn,n+rc(e.elevation)*Js),o=e.height===void 0?r:qn(e.height,lr,Kn,r),i=qn(e.rake,tc,nc,0);return{height:o,rake:i}}var mr=mt(require("earcut"),1),dr=mt(require("polygon-clipping"),1);var Ud=Math.PI/180;function $n(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 Lt(e){return e.length?$n(e):null}function et(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 kt(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 G=be,ic=.002;function ac(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<ic}var tt=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)}},rn=class{constructor(){this.pos=new tt;this.nor=new tt;this.col=new tt;this.flr=new tt;this.mat=new tt;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){ac(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,m=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(m[0],m[1],m[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 sc(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],m=o*c-i*s,u=i*a-r*c,p=r*s-o*a,d=Math.hypot(m,u,p)||1;return m/=d,u/=d,p/=d,[m,u,p]}function cc(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,mr.default)(r,o.length?o:void 0,2);return{pts:n,tris:i}}function Qn(e){return et(e)<0?[...e].reverse():e}var lc=3;function uc(e,t,n,r){let o=r(e),i=r(t),a=r(n),s=(l,f,b,h)=>Math.abs(r({x:(l.x+f.x)/2,y:(l.y+f.y)/2})-(b+h)/2),c=(e.x+t.x+n.x)/3,m=(e.y+t.y+n.y)/3,u=(o+i+a)/3,p=Math.max(s(e,t,o,i),s(t,n,i,a),s(n,e,a,o),Math.abs(r({x:c,y:m})-u)),d=(l,f,b)=>{let h=Math.abs(r({x:(l+c)/2,y:(f+m)/2})-(b+u)/2);h>p&&(p=h)};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),p}function Ft(e,t,n,r,o){if(o<=0)return uc(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(Ft(e,i,s,r,o-1),Ft(i,t,a,r,o-1),Ft(s,a,n,r,o-1),Ft(i,a,s,r,o-1))}function Dt(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},l={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};Dt(e,t,d,f,o,i,a-1,s),Dt(e,d,n,l,o,i,a-1,s),Dt(e,f,l,r,o,i,a-1,s),Dt(e,d,l,f,o,i,a-1,s);return}let c=[t.x*G,o(t),t.y*G],m=[n.x*G,o(n),n.y*G],u=[r.x*G,o(r),r.y*G];if(s){e.triN(c,m,u,s(t),s(n),s(r),i);return}let p=sc(c,m,u);p[1]<0&&(p=[-p[0],-p[1],-p[2]]),e.tri(c,m,u,p,i)}var mc=8;function ur(e,t,n){if(!Number.isFinite(n))return e;let r=[],o=(i,a,s,c,m)=>{if(m>0){let u={x:(i.x+a.x)/2,y:(i.y+a.y)/2},p=t(u);if(Math.abs(p-(s+c)/2)>n){o(i,u,s,p,m-1),o(u,a,p,c,m-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),mc)}return r}function nn(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,m=s.y-i.y,u=Math.hypot(c,m);u>t&&Math.abs((a.x-i.x)*m-(a.y-i.y)*c)/u<t||r.push(a)}return r.length>=3?r:n}var on=.001*He*.1;function ue(e,t,n,r,o,i,a,s,c=1/0,m){if(!t||t.length<3||(c===void 0&&(c=1/0),Math.abs(et(t))<1e-4))return;let u=nn(ur(nn(Qn(t),on),r,c),on),p=n?.map(P=>nn(ur(nn(Qn(P),on),r,c),on)).filter(P=>P.length>=3&&Math.abs(et(P))>=1e-4),{pts:d,tris:l}=cc(u,p),f=[i[0]*s.top,i[1]*s.top,i[2]*s.top],b=[i[0]*s.bottomCap,i[1]*s.bottomCap,i[2]*s.bottomCap],h=[a[0]*s.top,a[1]*s.top,a[2]*s.top],y=[a[0]*s.wallBottom,a[1]*s.wallBottom,a[2]*s.wallBottom],x=0;if(Number.isFinite(c))for(;x<lc;x++){let P=0;for(let M=0;M<l.length;M+=3){let A=Ft(d[l[M]],d[l[M+1]],d[l[M+2]],r,x);A>P&&(P=A)}if(P<=c)break}for(let P=0;P<l.length;P+=3){let M=d[l[P]],A=d[l[P+1]],k=d[l[P+2]];Dt(e,M,A,k,r,f,x,m);let z=[M.x*G,o,M.y*G],V=[A.x*G,o,A.y*G],L=[k.x*G,o,k.y*G];e.tri(z,L,V,[0,-1,0],b)}let g=P=>{if(x<=0)return P;let M=1<<x,A=[];for(let k=0;k<P.length;k++){let z=P[k],V=P[(k+1)%P.length];for(let L=0;L<M;L++){let C=L/M;A.push({x:z.x+(V.x-z.x)*C,y:z.y+(V.y-z.y)*C})}}return A},v=$n(u),R=[{ring:g(u),flip:!1}];if(p)for(let P of p)P.length>=3&&R.push({ring:g(P),flip:!0});for(let{ring:P,flip:M}of R)for(let A=0;A<P.length;A++){let k=P[A],z=P[(A+1)%P.length],V=(z.x-k.x)*G,C=(z.y-k.y)*G,_=-V,B=Math.hypot(C,_)||1;C/=B,_/=B;let S=(k.x+z.x)/2-v.x,E=(k.y+z.y)/2-v.y,T=C*S+_*E;M&&(T=-T),T<0&&(C=-C,_=-_);let w=[C,0,_],F=[k.x*G,r(k),k.y*G],I=[z.x*G,r(z),z.y*G],O=[k.x*G,o,k.y*G],j=[z.x*G,o,z.y*G];e.tri(F,I,j,w,h,h,y),e.tri(F,j,O,w,h,y,y)}}function fr(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 an(e,t,n=2.5){if(t<=0||e.length<3)return e;let r=Qn(e),o=r.length,i=[];for(let s=0;s<o;s++){let c=r[s],m=r[(s+1)%o],u=m.x-c.x,p=m.y-c.y,d=Math.hypot(u,p)||1;i.push({x:p/d,y:-u/d})}let a=[];for(let s=0;s<o;s++){let c=r[s],m=i[(s-1+o)%o],u=i[s],p=m.x+u.x,d=m.y+u.y,l=Math.hypot(p,d),f=()=>{a.push([c.x+m.x*t,c.y+m.y*t]),a.push([c.x+u.x*t,c.y+u.y*t])};if(l<1e-9){f();continue}p/=l,d/=l;let b=p*m.x+d*m.y,h=1/Math.max(b,1e-6);if(!Number.isFinite(h)||h>n){f();continue}a.push([c.x+p*t*h,c.y+d*t*h])}if(a.length<3)return e;try{let s=dr.default.union([[...a,a[0]]]),c=null,m=-1/0;for(let p of s){let d=Math.abs(et(p[0].map(([l,f])=>({x:l,y:f}))));d>m&&(m=d,c=p[0])}if(!c)return e;let u=c.map(([p,d])=>({x:p,y:d}));if(u.length>1){let p=u[0],d=u[u.length-1];Math.abs(p.x-d.x)<1e-9&&Math.abs(p.y-d.y)<1e-9&&u.pop()}return u.length>=3?u:e}catch{return e}}function sn(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 Ot(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 ae={pedestal:0,pad:1,back:2,arm:3,footrest:4,leg:5,body:10,head:11},dc=.44,fc=.15,pr=.3,pc=.24;function hr(e){return e===void 0||!Number.isFinite(e)||e<=0?pc:Math.min(pr,Math.max(fc,e*dc))}var Zn=.21,hc=.05,Jn=.45,cn=Jn+hc,br=.92,eo=1.205,yr=-.23,gr=.38,bc=[{part:ae.pedestal,min:[-.3,0,-.3],max:[.3,.36,.3]},{part:ae.pad,min:[-1,.36,-.95],max:[1,Jn,1]},{part:ae.back,min:[-1,cn,-1],max:[1,br,-.72]},{part:ae.arm,min:[-1,.44,-.82],max:[-.78,.65,.78]},{part:ae.arm,min:[.78,.44,-.82],max:[1,.65,.78]},{part:ae.footrest,min:[-.9,.18,.78],max:[.9,.31,1.34]},{part:ae.leg,min:[-.82,0,-.7],max:[-.62,.37,-.48]},{part:ae.leg,min:[.62,0,-.7],max:[.82,.37,-.48]},{part:ae.leg,min:[-.82,0,.48],max:[-.62,.37,.7]},{part:ae.leg,min:[.62,0,.48],max:[.82,.37,.7]}],yc=[{part:ae.body,min:[-.52,.39,-.08],max:[-.08,.55,.82]},{part:ae.body,min:[.08,.39,-.08],max:[.52,.55,.82]},{part:ae.body,min:[-.47,.05,.58],max:[-.13,.43,.82]},{part:ae.body,min:[.13,.05,.58],max:[.47,.43,.82]},{part:ae.head,min:[-.16,1.04,-.33],max:[.16,1.1,-.13]}],gc=[{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 xr(){let e=[],t=[],n=[],r=[],o=(B,S,E)=>{let T=n.length,[w,F,I]=B,O=[F[0]-w[0],F[1]-w[1],F[2]-w[2]],j=[I[0]-w[0],I[1]-w[1],I[2]-w[2]],H=O[1]*j[2]-O[2]*j[1],N=O[2]*j[0]-O[0]*j[2],D=O[0]*j[1]-O[1]*j[0],W=Math.hypot(H,N,D);W>1e-9?(H/=W,N/=W,D/=W):[H,N,D]=S,H*S[0]+N*S[1]+D*S[2]<0&&(H=-H,N=-N,D=-D);for(let X of B)e.push(...X),t.push(H,N,D),n.push(E);r.push(T,T+1,T+2,T,T+2,T+3)},i=B=>{for(let S of gc){let E=S.c.map(T=>T.map((w,F)=>w?B.max[F]:B.min[F]));o(E,S.n,B.part)}};for(let B of bc)i(B);for(let B of yc)i(B);let a=Jn,s=1.08,c=.47,m=.69,u=-.55,p=.08,d=-.48,l=.01,f=[-c,a,u],b=[c,a,u],h=[-c,a,p],y=[c,a,p],x=[-m,s,d],g=[m,s,d],v=[-m,s,l],R=[m,s,l];o([b,g,R,y],[1,0,0],ae.body),o([h,v,x,f],[-1,0,0],ae.body),o([v,R,g,x],[0,1,0],ae.body),o([f,b,y,h],[0,-1,0],ae.body),o([y,R,v,h],[0,0,1],ae.body),o([f,x,g,b],[0,0,-1],ae.body);let P=10,M=8,A=[0,eo,yr],k=[.42,.115,gr],z=n.length;for(let B=0;B<=M;B++){let S=Math.PI*B/M,E=Math.cos(S),T=Math.sin(S);for(let w=0;w<=P;w++){let F=Math.PI*2*w/P,I=T*Math.cos(F),O=T*Math.sin(F);e.push(A[0]+k[0]*I,A[1]+k[1]*E,A[2]+k[2]*O);let j=I/k[0],H=E/k[1],N=O/k[2],D=Math.hypot(j,H,N)||1;j/=D,H/=D,N/=D,t.push(j,H,N),n.push(ae.head)}}for(let B=0;B<M;B++)for(let S=0;S<P;S++){let E=z+B*(P+1)+S,T=E+P+1;r.push(E,T,E+1,E+1,T,T+1)}let V=new Float32Array(e),L=new Float32Array(t),C=new Float32Array(n),_=new Uint16Array(r);return{position:V,normal:L,part:C,index:_,vertexCount:n.length,indexCount:r.length}}function vr(e,t,n,r){let o=new Float32Array(t),i=m=>e[m*3],a=m=>e[m*3+2],s=0,c=(m,u)=>{let p=u-m;for(let d=m;d<u;d++){let[l,f]=r(d),b=l-i(d),h=f-a(d);if(p>=2){let y=Math.max(m,d-1),x=Math.min(u-1,d+1),g=i(x)-i(y),v=a(x)-a(y),R=Math.hypot(g,v);if(R>1e-6){let P=-v/R,M=g/R;P*b+M*h<0&&(P=-P,M=-M),b=P,h=M}}o[d]=b===0&&h===0?0:Math.atan2(b,h)}};for(let m=1;m<=t;m++)(m===t||n(m)!==n(s))&&(c(s,m),s=m);return o}var De=.22;function Sr(e,t){let n=pe[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 xc=.42;function vc(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),m=Math.max(Math.sqrt(s*c/t),1e-6),u=Math.max(1,Math.ceil(s/m)+1),p=Math.max(1,Math.ceil(c/m)+1),d=new Map,l=(f,b)=>{let h=Math.min(u-1,Math.max(0,Math.floor((f-r)/m)));return Math.min(p-1,Math.max(0,Math.floor((b-o)/m)))*u+h};for(let f=0;f<t;f++){let b=l(e[f].x,e[f].y),h=d.get(b);h?h.push(f):d.set(b,[f])}for(let f=0;f<t;f++){let b=e[f],h=Math.min(u-1,Math.max(0,Math.floor((b.x-r)/m))),y=Math.min(p-1,Math.max(0,Math.floor((b.y-o)/m))),x=1/0;for(let g=1;g<=4;g++){for(let v=y-g;v<=y+g;v++)if(!(v<0||v>=p))for(let R=h-g;R<=h+g;R++){if(R<0||R>=u||g>1&&Math.abs(v-y)<g&&Math.abs(R-h)<g)continue;let P=d.get(v*u+R);if(P)for(let M of P){if(M===f)continue;let A=Math.hypot(e[M].x-b.x,e[M].y-b.y);A<x&&(x=A)}}if(Number.isFinite(x)&&x<=g*m)break}n[f]=x}return n}function Sc(e){let t=e.eyeHeightM;return Number.isFinite(t)?Math.max(0,t-Ie):0}function Mr(e,t,n,r,o,i){let a=e.length,s=new Float32Array(a*3),c=new Float32Array(a),m=new Float32Array(a*3),u=new Float32Array(a),p=new Float32Array(a),d=new Float32Array(a),l=new Float32Array(a),f=new Float32Array(a*3),b=new Map,h=vc(e);for(let y=0;y<a;y++){let x=e[y],v=(n?.seatPitchU(y)??h[y])*G;u[y]=Number.isFinite(v)?Math.max(.06,Math.min(De,v*xc)):De,p[y]=hr(Number.isFinite(v)?v:void 0);let R=cr(x.glyph,{seatGlyph:i?.get(x.categoryKey)});d[y]=sr.indexOf(R),l[y]=x.wheelchairSpaceType==="no-seat"?0:1,s[y*3]=x.x*G,s[y*3+1]=n?n.seatDeckY(y):Sc(x),s[y*3+2]=x.y*G,c[y]=It(t?t(x):"available");let P=ne(o?.get(x.categoryKey)??"#6e7bff")??[.43,.48,1];if(m[y*3]=P[0],m[y*3+1]=P[1],m[y*3+2]=P[2],x.accessibility?.length){let M=ne(rr(x.accessibility));M&&(f[y*3]=M[0],f[y*3+1]=M[1],f[y*3+2]=M[2])}b.set(x.id,y)}return{count:a,iPosition:s,iState:c,iCategory:m,iMaxRadius:u,iRing:f,idToIndex:b,iChairWidth:p,iGlyph:d,iPhysicalSeat:l,iFloor:r??new Float32Array(a),iYaw:new Float32Array(a)}}var Mc=64;function to(e,t){let n=[];for(let a of t){let s=e.idToIndex.get(a.seatId);if(s===void 0)continue;let c=It(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+Mc){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 wc=.15,Pc=1.6;function wr(e){return $o(e??1,wc,Pc)}var Cc=.15,Ac=.9,Rc=1.76;function Ec(){return{background:{top:[...Je.top],bottom:[...Je.bottom]},structure:Hn,seatStates:{...jo},seatScale:1,materials:{seat:null,shell:null,roughness:.78}}}function Pr(e){let t=Ec();if(!e)return t;let n=ne(e.background);if(n){t.background={top:Pe(n,Ac),bottom:Pe(n,Rc)};let a={};for(let[s,c]of Object.entries(Hn))a[s]=ge(c,n,Cc);t.structure=a}let r=ne(e.selectionColor)??ne(e.accent);r&&(t.seatStates={...t.seatStates,selected:r});let o=e.seatScale;typeof o=="number"&&Number.isFinite(o)&&(t.seatScale=wr(o));let i=e.venue3d;if(i){let a=ne(i.deck),s=ne(i.fascia);a&&(t.structure={...t.structure,tierTop:a,gaTop:a}),s&&(t.structure={...t.structure,tierWall:s,gaWall:s}),t.materials.seat=ne(i.seat),t.materials.shell=ne(i.shell),typeof i.roughness=="number"&&Number.isFinite(i.roughness)&&(t.materials.roughness=Math.min(1,Math.max(0,i.roughness)))}return t}function Cr(e,t){let n=[];for(let r of t)n.push(...e.seatStates[r]);return n}function Ar(e,t){let n=1-t,r=n*n*n,o=3*n*n*t,i=3*n*t*t,a=t*t*t;return{x:r*e.start.x+o*e.control1.x+i*e.control2.x+a*e.end.x,y:r*e.start.y+o*e.control1.y+i*e.control2.y+a*e.end.y}}function Rr(e,t,n=192){if(!Number.isInteger(t)||t<1)throw new Error("Path point count must be a positive integer");if(t===1)return[Ar(e,.5)];let r=Array.from({length:n+1},(c,m)=>Ar(e,m/n)),o=new Float64Array(r.length);for(let c=1;c<r.length;c+=1){let m=r[c].x-r[c-1].x,u=r[c].y-r[c-1].y;o[c]=o[c-1]+Math.hypot(m,u)}let i=o[o.length-1];if(i<=1e-9)return Array.from({length:t},()=>({...e.start}));let a=[],s=1;for(let c=0;c<t;c+=1){let m=i*c/(t-1);for(;s<o.length-1&&o[s]<m;)s+=1;let u=o[s-1],p=o[s],d=p===u?0:(m-u)/(p-u);a.push({x:r[s-1].x+(r[s].x-r[s-1].x)*d,y:r[s-1].y+(r[s].y-r[s-1].y)*d})}return a}function Er(e){let t=new Map,n=new Map;for(let r of e){if(r.type!=="row"||!r.segmentedRow)continue;let o=n.get(r.segmentedRow.groupId)??[];o.push(r),n.set(r.segmentedRow.groupId,o)}for(let[r,o]of n){let i=o.slice().sort((d,l)=>d.segmentedRow.componentIndex-l.segmentedRow.componentIndex),a=i[0]?.segmentedRow?.componentCount??0,s=i[0]?.segmentedRow;if(!s||!(a>=2&&i.length===a&&s?.boundaryBefore==="start"&&i.every((d,l)=>d.segmentedRow?.kind==="segmented-row-v1"&&d.segmentedRow.groupId===r&&d.segmentedRow.componentCount===a&&d.segmentedRow.componentIndex===l&&d.segmentedRow.repeatLabelOnComponents===s.repeatLabelOnComponents&&(l===0?d.segmentedRow.boundaryBefore==="start":d.segmentedRow.boundaryBefore!=="start")&&d.segmentedRow.displayLabel===s.displayLabel)))continue;let m=i.reduce((d,l)=>d+l.seatCount,0),u=0,p=0;for(let d of i)d.segmentedRow.boundaryBefore==="break"&&(u+=1),t.set(d.id,{groupId:r,adjacencyOffset:u,displayOffset:p,displayLabel:s.displayLabel,totalSeats:m,canonical:i[0],viewFromSeatUrl:s.viewFromSeatUrl,viewFromSeatMeta:s.viewFromSeatMeta,confidenceEvidence:s.confidenceEvidence}),u+=d.seatCount,p+=d.seatCount}return t}var Ic="ABCDEFGHIJKLMNOPQRSTUVWXYZ";var Tc="abcdefghijklmnopqrstuvwxyz";function _c(e,t){let n=t.length,r=e+1,o="";for(;r>0;){r-=1;let i=r%n;o=t[i]+o,r=Math.floor(r/n)}return o}function no(e,t=!1){let n=t?Tc:Ic;return _c(Math.max(0,Math.floor(e)-1),n)}var Lc=[[1e3,"M"],[900,"CM"],[500,"D"],[400,"CD"],[100,"C"],[90,"XC"],[50,"L"],[40,"XL"],[10,"X"],[9,"IX"],[5,"V"],[4,"IV"],[1,"I"]];function Ir(e){if(!Number.isFinite(e)||e<=0)return String(e);let t=Math.floor(e),n="";for(let[r,o]of Lc)for(;t>=r;)n+=o,t-=r;return n}function kc(e){let t=new Array(e);return Array.from({length:e},(n,r)=>r).sort((n,r)=>Math.abs(2*n-(e-1))-Math.abs(2*r-(e-1))||n-r).forEach((n,r)=>t[n]=r),t}function ln(e,t){let n=e.seatLabelStart??1,r=e.seatNumbering?.direction??"ltr",o=e.seatNumbering?.step??1,i=e.seatNumbering?.scheme??"decimal",a=e.seatNumbering?.prefix??"",s=e.seatNumbering?.endAt,c=e.seatCount;if(i==="updown"||i==="updown-descending"){let l=Math.ceil(c/2),f=i==="updown"?t<l?n+2*t:n-1+2*(c-t):t<l?n+2*(l-1-t):n+1+2*(t-l);return`${a}${f}`}let m=i==="odd"||i==="even"?2:o,u=s!=null&&Number.isFinite(s)?s-(c-1)*m:n,p=r==="center"?kc(c)[t]:r==="rtl"?c-1-t:t,d;switch(i){case"odd":{let l=u%2===1?u:u+1;d=String(l+p*2);break}case"even":{let l=u%2===0?u:u+1;d=String(l+p*2);break}case"roman":d=Ir(u+p*o);break;case"letters-upper":d=no(u+p*o,!1);break;case"letters-lower":d=no(u+p*o,!0);break;default:d=String(u+p*o);break}return`${a}${d}`}function Fc(e){return{...e.canonical,seatCount:e.totalSeats,label:e.displayLabel,displayLabel:e.displayLabel}}function Tr(e,t,n){return n?.label??`${e.seatLabelBase??e.label}-${ln(e,t)}`}function oo(e,t,n,r){if(r?.displayLabel)return r.displayLabel;if(e.seatDisplayLabelMode==="number")return ln(e,t);if(!n)return`${e.displayLabel||e.label}-${ln(e,t)}`;let o=Fc(n),i=n.displayOffset+t;return`${n.displayLabel}-${ln(o,i)}`}function _r(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 yt(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,m=s*s+c*c,u=m>1e-12?((t-i.x)*s+(n-i.y)*c)/m:0;u<0?u=0:u>1&&(u=1);let p=Math.hypot(t-(i.x+u*s),n-(i.y+u*c));p<r&&(r=p)}return r}function Dc(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 Lr(e,t){return Math.hypot(e.cx-t.cx,e.cy-t.cy)-e.r-t.r}function ro(e,t){let n=1/0;for(let r of _r(e)){let o=yt(t,r.x,r.y);o<n&&(n=o)}for(let r of _r(t)){let o=yt(e,r.x,r.y);o<n&&(n=o)}return n}function Oc(e,t){if(e.length<3)return{pts:e,seatIndices:t};let n=0,r=0;for(let u of e)n+=u.x,r+=u.y;n/=e.length,r/=e.length;let o=-1,i=e[0];for(let u of e){let p=Math.hypot(u.x-n,u.y-r);p>o&&(o=p,i=u)}let a=i.x-n,s=i.y-r,c=Math.hypot(a,s);c>1e-9?(a/=c,s/=c):(a=1,s=0);let m=e.map((u,p)=>({p:u,i:p,t:(u.x-n)*a+(u.y-r)*s})).sort((u,p)=>u.t-p.t);return{pts:m.map(u=>u.p),seatIndices:m.map(u=>t[u.i])}}function io(e){let t=e.length;if(t<3)return null;let n=0,r=0;for(let x of e)n+=x.x,r+=x.y;n/=t,r/=t;let o=0,i=0,a=0,s=0,c=0,m=0,u=0;for(let x of e){let g=x.x-n,v=x.y-r;o+=g*g,a+=v*v,i+=g*v,s+=g*g*g,c+=v*v*v,m+=g*v*v,u+=v*g*g}let p=o*a-i*i;if(Math.abs(p)<1e-9)return null;let d=(s+m)/2,l=(c+u)/2,f=(d*a-l*i)/p,b=(l*o-d*i)/p,h=f+n,y=b+r;return!Number.isFinite(h)||!Number.isFinite(y)?null:{cx:h,cy:y}}var Vc=.15;function Bc(e){if(e.length<2)return null;let t=e.map(x=>{let g=0,v=0;for(let R of x.pts)g+=R.x,v+=R.y;return{x:g/x.pts.length,y:v/x.pts.length}}),n=0,r=0;for(let x of t)n+=x.x,r+=x.y;n/=t.length,r/=t.length;let o=0,i=0,a=0;for(let x of t){let g=x.x-n,v=x.y-r;o+=g*g,i+=g*v,a+=v*v}let s=o+a,c=o*a-i*i,m=s/2+Math.sqrt(Math.max(0,s*s/4-c)),u,p;Math.abs(i)>1e-12?(u=m-a,p=i):o>=a?(u=1,p=0):(u=0,p=1);let d=Math.hypot(u,p);if(!(d>1e-12))return null;u/=d,p/=d;let l=1/0,f=-1/0,b=[];for(let x of e){let g=1/0,v=-1/0;for(let R of x.pts){let P=R.x*u+R.y*p;P<g&&(g=P),P>v&&(v=P),P<l&&(l=P),P>f&&(f=P)}b.push(v-g)}let h=f-l;return h>1e-9?(b.sort((x,g)=>x-g),b[Math.min(b.length-1,Math.floor(b.length*.9))]/h<=Nc?{x:u,y:p}:null):null}var Nc=.35;function un(e,t,n,r){let o=new Map;for(let h of n){let y=t[h],x=y.rowId||`__seat-${h}`,g=o.get(x);g||(g={pts:[],idx:[]},o.set(x,g)),g.pts.push({x:y.x,y:y.y}),g.idx.push(h)}if(!o.size)return{sectionId:e,rows:[],blockCount:0};let i=[];for(let[h,y]of o){let x=Oc(y.pts,y.idx),g=0;for(let v of x.pts)g+=Math.hypot(v.x-r.x,v.y-r.y);i.push({id:h,pts:x.pts,seatIndices:x.seatIndices,blockId:-1,ordinal:0,blockDepth:0,focalDistance:g/x.pts.length})}let a=i.map(h=>Dc(h.pts)),s=[];for(let h=0;h<i.length;h++){let y=1/0;for(let x=0;x<i.length;x++){if(h===x||Lr(a[h],a[x])>=y)continue;let g=ro(i[h].pts,i[x].pts);g<y&&(y=g)}Number.isFinite(y)&&s.push(y)}s.sort((h,y)=>h-y);let c=s.length?s[Math.floor(s.length/2)]:1,m=Math.max(c*1.8,1e-6),u=i.map(()=>[]);for(let h=0;h<i.length;h++)for(let y=h+1;y<i.length;y++)Lr(a[h],a[y])>m||ro(i[h].pts,i[y].pts)<=m&&(u[h].push(y),u[y].push(h));let p=0;for(let h=0;h<i.length;h++){if(i[h].blockId!==-1)continue;let y=p++,x=[h];for(i[h].blockId=y;x.length;){let g=x.pop();for(let v of u[g])i[v].blockId===-1&&(i[v].blockId=y,x.push(v))}}let d=new Map;for(let h of i){let y=d.get(h.blockId)??[];y.push(h),d.set(h.blockId,y)}let l=[];for(let h of i){if(h.pts.length<4)continue;let y=io(h.pts);y&&(!Number.isFinite(y.cx)||!Number.isFinite(y.cy)||l.push({x:y.cx,y:y.cy}))}let f=l.length>=2?(()=>{let h=l.map(g=>g.x).sort((g,v)=>g-v),y=l.map(g=>g.y).sort((g,v)=>g-v),x=Math.floor(l.length/2);return{cx:h[x],cy:y[x]}})():null;if(f){let h=P=>Math.hypot(P.x-f.cx,P.y-f.cy),y=1/0,x=-1/0,g=[];for(let P of i){let M=1/0,A=-1/0;for(let k of P.pts){let z=h(k);z<M&&(M=z),z>A&&(A=z)}g.push(A-M),M<y&&(y=M),A>x&&(x=A)}let v=x-y;g.sort((P,M)=>P-M);let R=g[Math.min(g.length-1,Math.floor(g.length*.9))];if(v>1e-9&&R/v<=Vc){let P=i.map(S=>{let E=0;for(let T of S.pts)E+=h(T);return{row:S,radius:E/S.pts.length}}),M=0,A=0;for(let S of P)M+=S.radius,A+=S.row.focalDistance;M/=P.length,A/=P.length;let k=0;for(let S of P)k+=(S.radius-M)*(S.row.focalDistance-A);if(k<0)for(let S of P)S.radius=-S.radius;let V=1/0;for(let S of P)S.radius<V&&(V=S.radius);P.sort((S,E)=>S.radius-E.radius);let L=-1,C=-1/0,_=v/Math.max(1,P.length)*.5,B=[];for(let S of P)S.radius-C>_&&(L++,C=S.radius),S.row.ordinal=L,S.row.blockDepth=S.radius-V,B.push(S.row);return{sectionId:e,rows:B,blockCount:p}}}let b=[];for(let[,h]of d){let y=Bc(h);if(y){let x=v=>{let R=0;for(let P of v.pts)R+=P.x*y.x+P.y*y.y;return R/v.pts.length};h.sort((v,R)=>x(v)-x(R)),h.length>=2&&h[0].focalDistance>h[h.length-1].focalDistance&&h.reverse();let g=0;for(let v=0;v<h.length;v++)v>0&&(g+=ro(h[v-1].pts,h[v].pts)),h[v].ordinal=v,h[v].blockDepth=g,b.push(h[v])}else{let x=1/0;for(let g of h)g.focalDistance<x&&(x=g.focalDistance);h.sort((g,v)=>g.focalDistance-v.focalDistance);for(let g=0;g<h.length;g++)h[g].ordinal=g,h[g].blockDepth=Math.max(0,h[g].focalDistance-x),b.push(h[g])}}return{sectionId:e,rows:b,blockCount:p}}var Gc=/^\d{4}-\d{2}-\d{2}$/;function zc(e){let t=Date.parse(e);return Number.isFinite(t)?Gc.test(e)?t+864e5:t:null}function Uc(e,t=Date.now()){if(e.validUntil===void 0){if(e.status!=="approved")return!0;let r=e.assessedAt?Date.parse(e.assessedAt):Number.NaN;return Number.isFinite(r)&&(t instanceof Date?t.getTime():t)<=r+366*864e5}let n=zc(e.validUntil);return n===null?!1:(t instanceof Date?t.getTime():t)<n}function Hc(e,t,n){return!(e.eventConfigurationId&&e.eventConfigurationId!==t||e.eventConfigurationVersion!==void 0&&e.eventConfigurationVersion!==n)}function jc(e){return e.status!=="draft"&&e.status!=="retracted"}function Yc(e,t){return e.status===void 0?t===void 0:e.status!=="approved"?!0:typeof t=="string"&&typeof e.basisSha256=="string"&&e.basisSha256===t}function kr(e,t={}){return!!e&&jc(e)&&Hc(e,t.activeConfigurationId,t.activeConfigurationVersion)&&Yc(e,t.activeBasisSha256)&&Uc(e,t.now)}var yf=Math.PI*2;function mn(e){return e==="pitch-football"||e==="rink-hockey"||e==="track-athletics"||e==="oval-cricket"}var Xc=/^data:image\/(?:png|jpe?g|webp|gif|avif);base64,[a-z0-9+/]+={0,2}$/i,Wc=/[\s"'<>`\\]/;function Kc(e){if(typeof e!="string"||!e||e.length>2e6||e!==e.trim())return!1;if(e.startsWith("data:"))return Xc.test(e);if(Wc.test(e))return!1;try{let t=new URL(e);return t.protocol==="https:"&&!t.username&&!t.password}catch{return!1}}function Fr(e){let t=e.trim();return Kc(t)?t:null}var ao="seatlayer.event-configuration/1";var gt=100,qc=120,$c=1e5,Qc=1e4,Zc=/^[a-f0-9]{64}$/,Jc=new Set(["stage","screen","barrier","camera_platform","sound_desk","rigging_truss"]);function Vt(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function nt(e,t){return typeof e=="string"&&e.length>=1&&e.length<=t&&e.normalize("NFKC").trim()===e}function el(e){return typeof e=="number"&&Number.isInteger(e)&&e>0}function Dr(e){return!Array.isArray(e)||e.length>$c||!e.every(t=>nt(t,gt))?null:[...new Set(e)].sort()}function tl(e){return!Vt(e)||!nt(e.chartId,gt)||!nt(e.version,gt)||e.sha256!==void 0&&(typeof e.sha256!="string"||!Zc.test(e.sha256))?null:{chartId:e.chartId,version:e.version,...typeof e.sha256=="string"?{sha256:e.sha256}:{}}}function so(e,t,n){return typeof e=="number"&&Number.isFinite(e)&&e>=t&&e<=n}function nl(e){return Vt(e)?e.mode==="none"||e.mode==="opaque"?e.opacity===void 0?{mode:e.mode}:null:e.mode==="partial"&&so(e.opacity,.01,.99)?{mode:"partial",opacity:e.opacity}:null:null}function ol(e,t){if(e===void 0)return;if(!Array.isArray(e)||e.length>Qc)return null;let n=new Set(t),r=new Set,o=new Set,i=0,a=[];for(let s of e){if(!Vt(s)||!nt(s.id,gt)||!nt(s.objectId,gt)||!n.has(s.objectId)||!Jc.has(String(s.kind))||!so(s.heightM,.05,50)||s.baseElevationM!==void 0&&!so(s.baseElevationM,-10,100))return null;let c=nl(s.occlusion);if(!c||r.has(s.id)||o.has(s.objectId))return null;let m=s.contentImageUrl===void 0?void 0:typeof s.contentImageUrl=="string"?Fr(s.contentImageUrl):null;if(s.contentImageUrl!==void 0&&(!m||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,...m?{contentImageUrl:m}:{}})}return a.sort((s,c)=>s.id.localeCompare(c.id))}function rl(e){let t=[];if(!Vt(e))return{issues:[{code:"invalid_export",path:"configuration",message:"Configuration must be an object"}]};e.schema!==ao&&t.push({code:"unsupported_schema",path:"configuration.schema",message:`Configuration schema must be ${ao}`}),nt(e.id,gt)||t.push({code:"invalid_id",path:"configuration.id",message:"Configuration id must contain 1 to 100 normalized characters"}),nt(e.label,qc)||t.push({code:"invalid_label",path:"configuration.label",message:"Configuration label must contain 1 to 120 normalized characters"}),el(e.version)||t.push({code:"invalid_version",path:"configuration.version",message:"Configuration version must be a positive integer"});let n=tl(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=Vt(e.overlay)?e.overlay:null,o=Dr(r?.objectIds),i=Dr(r?.productionKillSeatIds),a=o?ol(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:ao,id:e.id,label:e.label,version:e.version,baseVenue:n,overlay:{objectIds:o,productionKillSeatIds:i,...a!==void 0?{productionElements:a}:{}}}}}function Or(e){let t=rl(e);return t.value?{ok:!0,value:t.value}:{ok:!1,issues:t.issues}}function il(e){if((e.kind==="polygon"||e.kind==="polyline"||e.kind==="line")&&e.points&&e.points.length>=2)return e.points;if(e.x==null||e.y==null||e.width==null||e.height==null)return null;let t=e.x,n=e.y,r=e.width,o=e.height;return[{x:t,y:n},{x:t+r,y:n},{x:t+r,y:n+o},{x:t,y:n+o}]}function al(e,t,n){let r=n*Math.PI/180,o=Math.cos(r),i=Math.sin(r),a=e.x-t.x,s=e.y-t.y;return{x:t.x+a*o-s*i,y:t.y+a*i+s*o}}function Vr(e){let t=il(e);if(!t||t.length<2)return null;let n=e.rotation??0,r=Math.abs(n)<1e-6?t:t.map(c=>al(c,{x:t.reduce((m,u)=>m+u.x,0)/t.length,y:t.reduce((m,u)=>m+u.y,0)/t.length},n)),o=1/0,i=1/0,a=-1/0,s=-1/0;for(let c of r)o=Math.min(o,c.x),i=Math.min(i,c.y),a=Math.max(a,c.x),s=Math.max(s,c.y);return!Number.isFinite(o)||a-o<1e-6||s-i<1e-6?null:{minX:o,minY:i,maxX:a,maxY:s}}var sl=5,cl=3,ll=.92,ul=1.9,ml=2,dl=.6,fl=1,pl=.06;function hl(e){return e.heightM!==void 0?e.heightM:mn(e.stageKind)?pl:fl}function Br(e){let t=1/0,n=1/0,r=-1/0,o=-1/0,i=-1/0;for(let a of zr(e)){let s=a.baseHeightM??0;for(let c of a.objects){if(c.type!=="shape"||c.role!=="stage")continue;let m=Vr(c);m&&(t=Math.min(t,m.minX),n=Math.min(n,m.minY),r=Math.max(r,m.maxX),o=Math.max(o,m.maxY),i=Math.max(i,s+hl(c)))}}return!Number.isFinite(t)||!Number.isFinite(i)?null:{minX:t,minY:n,maxX:r,maxY:o,deckTopM:i}}function bl(e,t,n,r){let o=1/0,i=1/0,a=-1/0,s=-1/0;for(let l of e)Number.isFinite(l.eyeHeightM)&&(o=Math.min(o,l.x),a=Math.max(a,l.x),i=Math.min(i,l.y),s=Math.max(s,l.y));if(!Number.isFinite(o))return null;let c=o*t,m=i*t,u=Math.max(1,Math.ceil((a-o)*t/n)+1),p=Math.max(1,Math.ceil((s-i)*t/n)+1),d=new Float64Array(u*p).fill(-1/0);for(let l of e){if(!Number.isFinite(l.eyeHeightM))continue;let f=l.eyeHeightM-Ie,b=Math.min(u-1,Math.max(0,Math.floor((l.x*t-c)/n))),y=Math.min(p-1,Math.max(0,Math.floor((l.y*t-m)/n)))*u+b,x=f+r;x>d[y]&&(d[y]=x)}return{cellM:n,minX:c,minY:m,cols:u,rows:p,top:d}}function yl(e,t,n){let r=Math.floor((t-e.minX)/e.cellM),o=Math.floor((n-e.minY)/e.cellM);return r<0||o<0||r>=e.cols||o>=e.rows?-1/0:e.top[o*e.cols+r]}function Nr(e,t,n={}){let r=new Map;if(!t||!e.length)return r;let o=n.metresPerChartUnit??be,i=n.cellM??dl,a=n.chairBackM??ll,s=n.selfRowSkipM??ml,c=n.clearThreshold??.9,m=n.partialThreshold??.25,u=Math.max(1,n.columns??sl),p=Math.max(1,n.rows??cl),d=bl(e,o,i,a);if(!d)return r;let l=(t.maxX-t.minX)*o,f=(t.maxY-t.minY)*o,b=l>=f,h=(t.minX+t.maxX)/2*o,y=(t.minY+t.maxY)/2*o,x=[];for(let v=0;v<u;v++){let R=(v+.5)/u-.5,P=b?h+R*l:h,M=b?y:y+R*f;for(let A=0;A<p;A++){let k=t.deckTopM+(p===1?0:A/(p-1)*ul);x.push({x:P,y:M,z:k})}}let g=i/2;for(let v of e){if(!Number.isFinite(v.eyeHeightM))continue;let R=v.x*o,P=v.y*o,M=v.eyeHeightM,A=0,k=1/0;for(let V of x){let L=V.x-R,C=V.y-P,_=Math.hypot(L,C);if(!(_>s)){A++;continue}let B=L/_,S=C/_,E=0;for(let T=s;T<_;T+=g){let w=yl(d,R+B*T,P+S*T);if(!(!Number.isFinite(w)||w>=M)&&w>M+(V.z-M)*T/_){E=T;break}}E?k=Math.min(k,E):A++}let z=A/x.length;z>=c||r.set(v.id,{seatId:v.id,mark:z<m?"obstructedView":"restrictedView",visibleFraction:z,totalRays:x.length,atDistanceM:Number.isFinite(k)?k:0})}return r}function Gr(e,t){if(!t.size)return 0;let n=0;for(let r of e){let o=t.get(r.id);if(!o)continue;let i=r.commercial;i?.restrictedView!==void 0||i?.obstructedView!==void 0||(r.commercial={...i,[o.mark]:!0},n++)}return n}function co(e){return e?e.accessibility?.length?e.wheelchairSpaceType&&!e.accessibility.includes("wheelchair")?["wheelchair",...e.accessibility]:e.accessibility:e.wheelchairSpaceType?["wheelchair"]:e.accessible?["wheelchair"]:[]:[]}var dn=Math.PI/180;var Bt=16;function uo(e,t,n,r){let o=n*dn,i=Math.cos(o),a=Math.sin(o);return{x:r.x+e*i-t*a,y:r.y+e*a+t*i}}function gl(e){let{seatCount:t,seatSpacing:n,curve:r,rotation:o,origin:i}=e,a=[];if(e.path)return Rr(e.path,t);if(t<=1)return t===1&&a.push({x:i.x,y:i.y}),a;if(r===0){for(let m=0;m<t;m++)a.push(uo(m*n,0,o,i));return a}let s=r/(t-1)*dn,c=n/(2*Math.sin(Math.abs(s)/2));for(let m=0;m<t;m++){let u=m*s,p=c*Math.sin(u),d=-c+c*Math.cos(u);a.push(uo(p,d,o,i))}return a}function xl(e){let t=new Map;if(e.overrides)for(let n of e.overrides)t.set(n.index,n);return t}function vl(e,t){let n=xl(e);return gl(e).map((r,o)=>{let i=n.get(o),a=co(i),s=Tr(e,o,i),c={...e.commercial,...i?.commercial};return{index:o,x:r.x+(i?.dx??0),y:r.y+(i?.dy??0),label:s,displayLabel:oo(e,o,t,i),categoryKey:i?.categoryKey??e.categoryKey,skipped:!!i?.skip,accessible:a.length>0,accessibility:a,wheelchairSpaceType:i?.wheelchairSpaceType,commercial:Object.values(c).some(m=>m!==void 0&&m!==!1&&m!=="")?c:void 0,glyph:i?.glyph,viewUrl:i?.viewFromSeatUrl??e.viewFromSeatUrl,viewMeta:i?.viewFromSeatUrl?i.viewFromSeatMeta:e.viewFromSeatMeta,labelStyle:i?.labelStyle??e.seatLabelStyle}})}function Xr(e){let t=[];for(let n of vl(e))n.skipped||t.push({id:`${e.id}:${n.index}`,label:n.label,displayLabel:n.displayLabel===n.label?void 0:n.displayLabel,x:n.x,y:n.y,rowId:e.id,categoryKey:n.categoryKey,accessible:n.accessible||void 0,accessibility:n.accessibility.length?n.accessibility:void 0,wheelchairSpaceType:n.wheelchairSpaceType,commercial:n.commercial,glyph:n.glyph,viewUrl:n.viewUrl,viewMeta:n.viewMeta,labelStyle:n.labelStyle});return t}function Sl(e){if(e.seatCountsBySide)return{...e.seatCountsBySide};let t=e.sides&&e.sides.length?e.sides:["top","bottom"],n=["top","bottom","left","right"].filter(i=>t.includes(i)),r={top:0,bottom:0,left:0,right:0};if(!n.length)return r;let o=Math.max(0,Math.round(e.seatCount));for(let i=0;i<o;i++)r[n[i%n.length]]+=1;return r}function Ml(e){let t=[],n=Math.max(0,Math.round(e.seatCount));if(n===0)return t;let r=new Map((e.overrides??[]).map(u=>[u.index,u])),o=(u,p,d,l)=>{let f=r.get(u),b=co(f),h=f?.label??`${e.label}-${u+1}`,y=e.displayLabel??e.label;return{index:u,label:h,displayLabel:f?.displayLabel??`${y}-${u+1}`,x:p+(f?.dx??0),y:d+(f?.dy??0),categoryKey:f?.categoryKey??e.categoryKey,skipped:!!f?.skip,accessible:b.length>0,accessibility:b,wheelchairSpaceType:f?.wheelchairSpaceType,commercial:f?.commercial,glyph:f?.glyph,viewUrl:f?.viewFromSeatUrl,viewMeta:f?.viewFromSeatUrl?f.viewFromSeatMeta:void 0,labelStyle:f?.labelStyle,...l?{side:l}:{}}};if(e.shape==="round"){let u=(e.radius??40)+Bt,p=e.rotation*dn,d=Math.max(0,Math.min(360,e.seatArc??360));if(d>=360||n===1){for(let h=0;h<n;h++){let y=p+h/n*2*Math.PI;t.push(o(h,e.center.x+u*Math.cos(y),e.center.y+u*Math.sin(y)))}return t}let l=d*dn,f=(2*Math.PI-l)/2,b=p+f;for(let h=0;h<n;h++){let y=b+h/(n-1)*l;t.push(o(h,e.center.x+u*Math.cos(y),e.center.y+u*Math.sin(y)))}return t}let i=e.width??80,a=e.height??50,s=Sl(e),c=["top","bottom","left","right"],m=0;for(let u of c){let p=s[u];for(let d=0;d<p;d++){let l,f;u==="top"?(l=-i/2+(d+.5)*i/p,f=-a/2-Bt):u==="bottom"?(l=-i/2+(d+.5)*i/p,f=a/2+Bt):u==="left"?(l=-i/2-Bt,f=-a/2+(d+.5)*a/p):(l=i/2+Bt,f=-a/2+(d+.5)*a/p);let b=uo(l,f,e.rotation,e.center);t.push(o(m++,b.x,b.y,u))}}return t}function wl(e){return Ml(e).filter(t=>!t.skipped).map(t=>({id:`${e.id}:${t.index}`,label:t.label,...t.displayLabel!==t.label?{displayLabel:t.displayLabel}:{},x:t.x,y:t.y,rowId:e.id,categoryKey:t.categoryKey,...t.accessible?{accessible:!0}:{},...t.accessibility.length?{accessibility:t.accessibility}:{},...t.wheelchairSpaceType?{wheelchairSpaceType:t.wheelchairSpaceType}:{},...t.commercial?{commercial:t.commercial}:{},...t.glyph?{glyph:t.glyph}:{},...t.viewUrl?{viewUrl:t.viewUrl}:{},...t.viewUrl&&t.viewMeta?{viewMeta:t.viewMeta}:{},...t.labelStyle?{labelStyle:t.labelStyle}:{}}))}function Pl(e){return[{id:`${e.id}:0`,label:e.label,...e.displayLabel&&e.displayLabel!==e.label?{displayLabel:e.displayLabel}:{},x:e.center.x,y:e.center.y,rowId:e.id,categoryKey:e.categoryKey,kind:"booth"}]}function Ur(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 Cl(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 ot(e,t,n){return Ur(e,t)&&!(n??[]).some(r=>Ur(e,r)||Cl(e,r))}function lo(e){if(!e.length)return{x:0,y:0};let t=0,n=0;for(let r of e)t+=r.x,n+=r.y;return{x:t/e.length,y:n/e.length}}function Al(e){switch(e.type){case"row":{let t=Xr(e);if(!t.length)return{x:e.origin.x,y:e.origin.y};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}}case"table":case"booth":return{x:e.center.x,y:e.center.y};case"gaArea":return lo(e.points);case"section":return lo(e.outline);case"text":return{x:e.position.x,y:e.position.y};case"shape":return e.points&&e.points.length?lo(e.points):e.x!=null&&e.y!=null&&e.width!=null&&e.height!=null?{x:e.x+e.width/2,y:e.y+e.height/2}:{x:e.x??0,y:e.y??0};case"decorImage":return{x:e.x+e.width/2,y:e.y+e.height/2}}}function Hr(e,t){return e.length===t.length&&e.every((n,r)=>n.x===t[r].x&&n.y===t[r].y)}function Rl(e,t){if(e.type!=="gaArea"||!Hr(e.points,t.outline))return!1;let n=e.holes??[],r=t.holes??[];return n.length===r.length&&n.every((o,i)=>Hr(o,r[i]))}function El(e,t){let n=e.filter(a=>a.type==="section"),r="referenceInventorySource"in t?t.referenceInventorySource?.logicalSectionId:void 0,o=Al(t);return(r?n.find(a=>(a.logicalSectionId??a.id)===r&&(Rl(t,a)||ot(o,a.outline,a.holes))):void 0)??n.find(a=>ot(o,a.outline,a.holes))}function zr(e){return e.floors&&e.floors.length?e.floors:[{id:"floor-0",name:"Main",objects:e.objects,focalPoint:e.focalPoint,referenceImage:e.referenceImage,backgroundImage:e.backgroundImage}]}function jr(e,t,n,r,o,i,a,s,c){let m=[],u=Er(e),p=f=>!f?.eventConfigurationId||f.eventConfigurationId===r&&(f.eventConfigurationVersion===void 0||f.eventConfigurationVersion===c),d=f=>kr(f,{activeConfigurationId:r,activeConfigurationVersion:c,activeBasisSha256:o,now:s}),l=(f,b)=>d(f)?{...f,coverage:b}:void 0;for(let f of e){let b=[];if(f.type==="row"?b=Xr(f):f.type==="table"?b=wl(f):f.type==="booth"&&(b=Pl(f)),!b.length)continue;for(let v of b)v.viewUrl&&!p(v.viewMeta)&&(v.viewUrl=void 0,v.viewMeta=void 0);if(f.type==="row"){let v=u.get(f.id);if(v){let R=new Map((f.overrides??[]).map(P=>[P.index,P]));for(let P of b){let M=Number(P.id.slice(P.id.lastIndexOf(":")+1));if(!Number.isInteger(M))continue;P.logicalRowId=v.groupId,P.logicalSeatIndex=v.adjacencyOffset+M,R.get(M)?.displayLabel||(P.displayLabel=oo(f,M,v)),!P.viewUrl&&v.viewFromSeatUrl&&p(v.viewFromSeatMeta)&&(P.viewUrl=v.viewFromSeatUrl,P.viewMeta=v.viewFromSeatMeta);let A=R.get(M)?.confidenceEvidence;P.confidenceEvidence=l(A,"exact-seat")??l(f.confidenceEvidence,"row-representative")??l(v.confidenceEvidence,"row-representative")}}}let h=El(e,f),y=h?.viewFromSeatUrl,g=(h?.zone?t?.find(v=>v.id===h.zone):void 0)?.focalPoint??n;for(let v of b){if(!v.confidenceEvidence){let R=Number(v.id.slice(v.id.lastIndexOf(":")+1)),P=(f.type==="row"||f.type==="table")&&Number.isInteger(R)?f.overrides?.find(M=>M.index===R)?.confidenceEvidence:void 0;v.confidenceEvidence=l(P,"exact-seat")??(f.type==="row"?l(f.confidenceEvidence,"row-representative"):void 0)}v.confidenceEvidence??=l(h?.confidenceEvidence,"section-representative")??(a?l(a.evidence,a.coverage):void 0),!v.viewUrl&&y&&p(h?.viewFromSeatMeta)&&(v.viewUrl=y,v.viewMeta=h?.viewFromSeatMeta),!v.viewUrl&&i&&p(i.meta)&&(v.viewUrl=i.url,v.viewMeta=i.meta),h&&(v.sectionId=h.logicalSectionId??h.id),h?.zone&&(v.zoneId=h.zone),g&&(v.focalPoint={...g})}m.push(...b)}return m}function Wr(e,t={}){if(e.floors?.length){let r=[];for(let o of e.floors){let i=o.focalPoint??e.focalPoint,a=o.viewFromSeatUrl?{url:o.viewFromSeatUrl,meta:o.viewFromSeatMeta}:e.viewFromSeatUrl?{url:e.viewFromSeatUrl,meta:e.viewFromSeatMeta}:void 0,s=o.confidenceEvidence?{evidence:o.confidenceEvidence,coverage:"floor-representative"}:e.confidenceEvidence?{evidence:e.confidenceEvidence,coverage:"venue-representative"}:void 0,c=jr(o.objects,e.zones,i,e.eventConfigurationId,e.confidenceBasisSha256,a,s,t.now,t.eventConfigurationVersion??e.eventConfigurationVersion);t.resolveEyeHeights!==!1&&Yr(o.objects,o.focalPoint??e.focalPoint,o.baseHeightM??0,c);for(let m of c)m.floorId=o.id;r.push(...c)}return r}let n=jr(e.objects,e.zones,e.focalPoint,e.eventConfigurationId,e.confidenceBasisSha256,e.viewFromSeatUrl?{url:e.viewFromSeatUrl,meta:e.viewFromSeatMeta}:void 0,e.confidenceEvidence?{evidence:e.confidenceEvidence,coverage:"venue-representative"}:void 0,t.now,t.eventConfigurationVersion??e.eventConfigurationVersion);return t.resolveEyeHeights!==!1&&Yr(e.objects,e.focalPoint,t.floorBaseHeightM??0,n),Il(e,n,t)}function Il(e,t,n){return!n.deriveRestrictedView||e.derivedRestrictedView===!1||n.resolveEyeHeights===!1||Gr(t,Nr(t,Br(e))),t}function Yr(e,t,n,r){let o=e.filter(u=>u.type==="section"),i=n>0||o.some(u=>u.height!==void 0||u.rake!==void 0||(u.elevation??0)>0);if(!o.length||!i||!t){for(let u of r)u.eyeHeightM=n+Ie;return}let a=new Array(r.length),s=new Map,c=new Map;for(let u=0;u<r.length;u++){let p=r[u],l=(p.sectionId?o.find(b=>b.id===p.sectionId)??o.find(b=>b.logicalSectionId===p.sectionId&&ot({x:p.x,y:p.y},b.outline,b.holes)):void 0)??o.find(b=>ot({x:p.x,y:p.y},b.outline,b.holes))??null;if(a[u]=l,!l)continue;s.has(l.id)||s.set(l.id,tn(l,{floorBaseHeightM:n}));let f=c.get(l.id);f?f.push(u):c.set(l.id,[u])}let m=new Array(r.length).fill(void 0);for(let[u,p]of c){let d=s.get(u);if(!d)continue;let l=d.rake>0?Math.tan(d.rake*Math.PI/180):0,f=un(u,r,p,t);for(let b of f.rows){let h=b.blockDepth*be*l,y=d.height+h;for(let x of b.seatIndices)m[x]=y}}for(let u=0;u<r.length;u++){let p=r[u],d=a[u];if(!d){p.eyeHeightM=n+Ie;continue}let l=s.get(d.id);p.eyeHeightM=(m[u]??l.height)+Ie}}function Tl(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 _l(e,t){if(!e.length)return null;let n=0,r=0,o=0;for(let l of e)n+=l.x,r+=l.y,o+=Math.hypot(l.x-t.x,l.y-t.y);let i=e.length;n/=i,r/=i,o/=i;let a=e[0],s=-1;for(let l of e){let f=Math.hypot(l.x-n,l.y-r);f>s&&(s=f,a=l)}let c=a.x-n,m=a.y-r,u=Math.hypot(c,m);u>1e-9?(c/=u,m/=u):(c=1,m=0);let p=[...e].sort((l,f)=>(l.x-n)*c+(l.y-r)*m-((f.x-n)*c+(f.y-r)*m)),d=0;for(let l of p){let f=Math.hypot(l.x-n,l.y-r);f>d&&(d=f)}return{pts:p,cx:n,cy:r,radius:d,depth:o}}function Kr(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,m=s.y-a.y,u=c*c+m*m,p=u>1e-12?((t-a.x)*c+(n-a.y)*m)/u:0;p<0?p=0:p>1&&(p=1);let d=Math.hypot(t-(a.x+p*c),n-(a.y+p*m));d<o&&(o=d)}return o}var fn=8;function Ll(e,t,n){let r=new Array(fn).fill(1/0),o=new Array(fn).fill(-1);for(let u=0;u<e.length;u++){let p=e[u],d=Math.hypot(t-p.cx,n-p.cy)-p.radius;for(let l=0;l<fn;l++)if(d<r[l]){for(let f=fn-1;f>l;f--)r[f]=r[f-1],o[f]=o[f-1];r[l]=d,o[l]=u;break}}let i=new Array(3).fill(1/0),a=new Array(3).fill(-1);for(let u of o){if(u<0)continue;let p=Kr(e[u],t,n);for(let d=0;d<3;d++)if(p<i[d]){for(let l=2;l>d;l--)i[l]=i[l-1],a[l]=a[l-1];i[d]=p,a[d]=u;break}}if(a[0]<0)return 0;if(i[0]<1e-6)return e[a[0]].depth;let s=i[0]*2.2,c=0,m=0;for(let u=0;u<3;u++){let p=a[u];if(p<0||i[u]>s)continue;let d=1/(i[u]*i[u]);c+=d*e[p].depth,m+=d}return m>0?c/m:e[a[0]].depth}function kl(e){let t=(r,o)=>Ll(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 m=Kr(c,r,o);m<i&&(i=m,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 qr(e,t){let n=[];for(let r of e){let o=_l(r.points,t);o&&n.push(o)}return n.length<2?Tl(t):(n.sort((r,o)=>r.depth-o.depth),kl(n))}var po=mt(require("polygon-clipping"),1);var Jr=mt(require("earcut"),1);var Fl=.58,$r=.01,Ce=De*1.5*He,Dl=.5,Ol=.6;function Vl(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)],m=c.x-s.x,u=c.y-s.y,p=Math.hypot(m,u);if(p<1e-9){r.push([0,0]);continue}m/=p,u/=p,r.push([-u,m])}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 Bl(e,t){if(e.length<2||t<=0)return[...e];let n=[...e],r=(a,s)=>{let c=s.x-a.x,m=s.y-a.y,u=Math.hypot(c,m)||1;return{x:c/u,y:m/u}},o=r(n[1],n[0]),i=r(n[n.length-2],n[n.length-1]);return n.unshift({x:n[0].x+o.x*t,y:n[0].y+o.y*t}),n.push({x:n[n.length-1].x+i.x*t,y:n[n.length-1].y+i.y*t}),n}var Qr=Math.PI/12;function Nl(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 ei(e,t){if(!e.length||!(t>0))return[];let n=Nl(e),r=(s,c,m,u)=>{let p=m-c;for(;p<0;)p+=Math.PI*2;for(;p>Math.PI*2;)p-=Math.PI*2;let d=Math.max(1,Math.ceil(p/Qr)),l=t/Math.cos(p/d/2);for(let f=0;f<=d;f++){let b=c+p*f/d;u.push({x:s.x+Math.cos(b)*l,y:s.y+Math.sin(b)*l})}};if(n.length<3){let s=0,c=0;for(let l of n)s+=l.x,c+=l.y;s/=n.length||1,c/=n.length||1;let m=0;for(let l of n)m=Math.max(m,Math.hypot(l.x-s,l.y-c));let u=[],p=Math.max(3,Math.ceil(Math.PI*2/Qr)),d=(m+t)/Math.cos(Math.PI/p);for(let l=0;l<p;l++){let f=l/p*Math.PI*2;u.push({x:s+Math.cos(f)*d,y:c+Math.sin(f)*d})}return u}let o=n.length,i=[];for(let s=0;s<o;s++){let c=n[s],m=n[(s+1)%o];i.push(Math.atan2(-(m.x-c.x),m.y-c.y))}let a=[];for(let s=0;s<o;s++)r(n[s],i[(s+o-1)%o],i[s],a);return ii(a)}function Gl(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,m=s*s+c*c,u=m>1e-12?((t-i.x)*s+(n-i.y)*c)/m:0;u<0?u=0:u>1&&(u=1);let p=Math.hypot(t-(i.x+u*s),n-(i.y+u*c));p<r&&(r=p)}return r}function pn(e){let t=e.map(o=>{let i=0,a=0;for(let m of o.pts)i+=m.x,a+=m.y;let s=o.pts.length||1;i/=s,a/=s;let c=0;for(let m of o.pts){let u=Math.hypot(m.x-i,m.y-a);u>c&&(c=u)}return{cx:i,cy:a,rad:c}}),n=o=>{let i=o.length;return i<=2?[...o]:[o[Math.floor(i*.25)],o[Math.floor(i*.5)],o[Math.floor(i*.75)]]},r=[];for(let o=0;o<e.length;o++){let i=n(e[o].pts),a=[],s=1/0,c=null;for(let u of i){let p=1/0;for(let d=0;d<e.length;d++){if(d===o||Math.abs(e[d].y-e[o].y)<.001)continue;let l=t[d],f=Math.hypot(u.x-l.cx,u.y-l.cy)-l.rad;if(f>=p&&f>=s)continue;let b=Gl(e[d].pts,u.x,u.y);b<p&&(p=b),e[d].depth<e[o].depth&&b<s&&(s=b,c=e[d].y)}Number.isFinite(p)&&p>0&&a.push(p)}a.sort((u,p)=>u-p);let m=a.length?a[Math.floor(a.length/2)]:1;r.push({pitch:m,belowY:c})}return r}function ti(e,t,n,r){let o=e[t],i=o.pts.length>=2?[...o.pts]:o.pts.length===1?(()=>{let u=o.pts[0],p=u.x-r.x,d=u.y-r.y,l=Math.hypot(p,d)||1;p/=l,d/=l;let f=Math.max(n[t].pitch,.001)*.5;return[{x:u.x+d*f,y:u.y-p*f},{x:u.x-d*f,y:u.y+p*f}]})():[];if(i.length<2)return null;let a=0,s=0;for(let u=1;u<i.length;u++){let p=Math.hypot(i[u].x-i[u-1].x,i[u].y-i[u-1].y);p>1e-6&&(a+=p,s++)}let c=s>0?a/s:0,m=Bl(i,Math.max(c*Ol,Ce));return{pts:m,nrm:Vl(m,r),front:Math.max(n[t].pitch*Fl,Ce),back:Math.max(n[t].pitch*Dl,Ce)}}var xt=1.5,ni=.3;function mo(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 p=1;p<e.length-1;p++){let d=e[p],l=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);l>s&&(s=l,c=p)}if(s<=t||c<0)return[n,r];let m=mo(e.slice(0,c+1),t),u=mo(e.slice(c),t);return[...m.slice(0,-1),...u]}function oi(e,t){if(e.length<4)return e;let n=mo([...e,e[0]],t);return n.pop(),n.length>=3?n:e}function ri(e,t,n){if(e.length<2)return[];let r=n??pn(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 x of a){let g=e[x].patch;g&&g.length>=3?i.push({outline:[...g],holes:[],topY:e[x].y}):s.push(x)}if(!s.length)continue;s.sort((x,g)=>e[x].depth-e[g].depth);let m=s.map(x=>ti(e,x,r,t)).filter(x=>x!==null);if(!m.length)continue;let u=(x,g)=>({x:x.pts[g].x-x.nrm[g][0]*(x.front+xt),y:x.pts[g].y-x.nrm[g][1]*(x.front+xt)}),p=(x,g)=>({x:x.pts[g].x+x.nrm[g][0]*(x.back+xt),y:x.pts[g].y+x.nrm[g][1]*(x.back+xt)}),d=m[0],l=m[m.length-1],f=[];for(let x=0;x<d.pts.length;x++)f.push(u(d,x));for(let x of m)f.push(p(x,x.pts.length-1));for(let x=l.pts.length-1;x>=0;x--)f.push(p(l,x));for(let x=m.length-1;x>=0;x--)f.push(u(m[x],0));let b=ii(f),h=1/0;for(let x of s)e[x].y<h&&(h=e[x].y);if(!Number.isFinite(h))continue;if(b.length>=3&&Math.abs(et(b))>1e-6&&m.every(x=>{let g=x.pts[Math.floor(x.pts.length/2)];return kt(b,g.x,g.y)})){i.push({outline:oi(b,ni),holes:[],topY:h});continue}for(let x of zl(m))i.push({outline:x,holes:[],topY:h})}return i}function zl(e){let t=[];for(let n of e){let r=[],o=[],i=n.front+xt,a=n.back+xt;for(let c=0;c<n.pts.length;c++){let m=n.pts[c],u=n.nrm[c];r.push([m.x-u[0]*i,m.y-u[1]*i]),o.push([m.x+u[0]*a,m.y+u[1]*a])}let s=[...r,...o.reverse()];s.length<3||(s.push(s[0]),t.push([s]))}if(!t.length)return[];try{let n=po.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,m])=>({x:c,y:m})),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(oi(i,ni))}return r}catch{return[]}}function ii(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 fo=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(!kt(n,o.x,o.y)){r=!1;break}if(r)return!0}return!1}};function Zr(e,t,n,r,o,i){if(r.length<3)return;if(n.containsAll(r)){let m=[0,1,0],u=r[0];for(let p=1;p+1<r.length;p++){let d=r[p],l=r[p+1];e.tri([u.x*G,o,u.y*G],[d.x*G,o,d.y*G],[l.x*G,o,l.y*G],m,i)}return}let a=r.map(m=>[m.x,m.y]);a.push(a[0]);let s;try{s=po.default.intersection([a],t)}catch{return}let c=[0,1,0];for(let m of s){if(!m.length||m[0].length<4)continue;let u=m[0],p=[],d=[];for(let f=0;f<u.length-1;f++)p.push(u[f][0],u[f][1]),d.push([u[f][0],u[f][1]]);if(d.length<3)continue;let l=(0,Jr.default)(p,void 0,2);for(let f=0;f<l.length;f+=3){let b=d[l[f]],h=d[l[f+1]],y=d[l[f+2]];e.tri([b[0]*G,o,b[1]*G],[h[0]*G,o,h[1]*G],[y[0]*G,o,y[1]*G],c,i)}}}function ai(e,t,n,r,o,i,a){if(t.length<2)return;let s=a??pn(t),c=[0,1,0],m=i&&i.length>=3?[[...i.map(l=>[l.x,l.y]),[i[0].x,i[0].y]]]:null,u=i&&i.length>=3?new fo([[...i]]):null,p=l=>{e.setMaterial(2),l(),e.setMaterial(0)},d=l=>{e.setMaterial(3),l(),e.setMaterial(0)};for(let l=0;l<t.length;l++){let f=t[l];if(f.patch&&f.patch.length>=3){let R=[...f.patch],P=s[l].belowY??r;if(d(()=>{if(m&&u)Zr(e,m,u,R,f.y,o.tread);else{let M=R[0];for(let A=1;A+1<R.length;A++){let k=R[A],z=R[A+1];e.tri([M.x*G,f.y,M.y*G],[k.x*G,f.y,k.y*G],[z.x*G,f.y,z.y*G],c,o.tread)}}}),f.y>P+$r){let M=0,A=0;for(let k of R)M+=k.x,A+=k.y;M/=R.length,A/=R.length,p(()=>{for(let k=0;k<R.length;k++){let z=R[k],V=R[(k+1)%R.length],L=V.x-z.x,C=V.y-z.y,_=Math.hypot(L,C);if(_<1e-6)continue;let B=C/_,S=-L/_;(z.x-M)*B+(z.y-A)*S<0&&(B=-B,S=-S);let E=[B,0,S],T=[z.x*G,f.y,z.y*G],w=[V.x*G,f.y,V.y*G],F=[z.x*G,P,z.y*G],I=[V.x*G,P,V.y*G];e.tri(T,w,I,E,o.riser),e.tri(T,I,F,E,o.riser)}})}continue}let b=ti(t,l,s,n);if(!b)continue;let{pts:h,nrm:y,front:x,back:g}=b,v=s[l].belowY??r;for(let R=0;R+1<h.length;R++){let P=h[R],M=h[R+1],A=y[R],k=y[R+1];if(Math.hypot(M.x-P.x,M.y-P.y)<1e-6||A[0]===0&&A[1]===0||k[0]===0&&k[1]===0)continue;let z=[(P.x-A[0]*x)*G,f.y,(P.y-A[1]*x)*G],V=[(M.x-k[0]*x)*G,f.y,(M.y-k[1]*x)*G],L=[(P.x+A[0]*g)*G,f.y,(P.y+A[1]*g)*G],C=[(M.x+k[0]*g)*G,f.y,(M.y+k[1]*g)*G];if(d(()=>{m&&u?Zr(e,m,u,[{x:P.x-A[0]*x,y:P.y-A[1]*x},{x:M.x-k[0]*x,y:M.y-k[1]*x},{x:M.x+k[0]*g,y:M.y+k[1]*g},{x:P.x+A[0]*g,y:P.y+A[1]*g}],f.y,o.tread):(e.tri(z,V,C,c,o.tread),e.tri(z,C,L,c,o.tread))}),f.y>v+$r){let _=[z[0],v,z[2]],B=[V[0],v,V[2]],S=[-A[0],0,-A[1]];p(()=>{e.tri(z,V,B,S,o.riser),e.tri(z,B,_,S,o.riser)})}}}}function si(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 hn(e,t){return e.minX<=t.maxX&&t.minX<=e.maxX&&e.minY<=t.maxY&&t.minY<=e.maxY}var ho=mt(require("polygon-clipping"),1);function Ul(e,t){let n=e.eventConfigurationIds;return!n?.length||!!t&&n.includes(t)}function ci(e,t){return e.filter(n=>n.type!=="shape"||Ul(n,t))}function li(e,t){let n=e.focalPoint??{x:0,y:0};return e.floors?.length?e.floors.map((r,o)=>({objects:ci(r.objects,t),focal:{x:(r.focalPoint??n).x,y:(r.focalPoint??n).y},baseHeightM:r.baseHeightM??0,index:o})):[{objects:ci(e.objects,t),focal:n,baseHeightM:0,index:0}]}var Hl={minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};function vt(e){return si(e)??Hl}function ui(e,t){let n=an(e.outline,Ce),r=vt(n),o=t.filter(a=>a!==e&&a.outline&&a.outline.length>=3&&hn(r,vt(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=ho.default.difference([i(n)],...o.map(c=>[i(c.outline)])),s=[];for(let c of a){if(!c.length)continue;let m=c[0].map(([u,p])=>({x:u,y:p}));if(m.length>1){let u=m[0],p=m[m.length-1];Math.abs(u.x-p.x)<1e-9&&Math.abs(u.y-p.y)<1e-9&&m.pop()}m.length>=3&&s.push(m)}return s.length?s:[n]}catch{return[n]}}function mi(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=ho.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(([m,u])=>({x:m,y:u}));if(c.length>1){let m=c[0],u=c[c.length-1];Math.abs(m.x-u.x)<1e-9&&Math.abs(m.y-u.y)<1e-9&&c.pop()}c.length>=3&&o.push({outline:c,holes:[],topY:i.topY})}}return o.length?o:e}var jl=.05,di=.05,Yl=.15,bo=25;function fi(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,m=[],u=new Set;for(let d=0;d<e.length;d+=1){let l=e[d];for(let f of l.objects){if(f.type==="table"&&u.add(f.id),f.type!=="section"||!f.outline||f.outline.length<3)continue;let b=an(f.outline,Ce);c.set(f.id,{section:f,unit:l,frontU:1/0,hasSeats:!1,rows:new Map,seatIndices:[]}),m.push({id:f.id,floorIndex:d,box:vt(b),section:f,unit:l,outline:b})}}let p=new Map;for(let d of m){let l=p.get(d.floorIndex);l?l.push(d):p.set(d.floorIndex,[d])}for(let d=0;d<t.length;d++){let l=t[d],f=n?p.get(n[d])??[]:m,b=l.sectionId?f.find(y=>y.id===l.sectionId)??f.find(y=>y.section.logicalSectionId===l.sectionId&&ot({x:l.x,y:l.y},y.outline,y.section.holes)):void 0,h=b?[b]:f;for(let y of h){if(n&&y.floorIndex!==n[d]||!b&&(l.x<y.box.minX||l.x>y.box.maxX||l.y<y.box.minY||l.y>y.box.maxY||!ot({x:l.x,y:l.y},y.outline,y.section.holes)))continue;o[d]=y.id;let x=c.get(y.id);x.hasSeats=!0;let g=l.focalPoint??y.unit.focal,v=Math.hypot(l.x-g.x,l.y-g.y);v<x.frontU&&(x.frontU=v),x.seatIndices.push(d);let R=l.rowId||`__seat-${d}`,P=x.rows.get(R);P?P.push({x:l.x,y:l.y}):x.rows.set(R,[{x:l.x,y:l.y}]);break}}for(let[d,l]of c){let f=tn(l.section,{floorBaseHeightM:l.unit.baseHeightM}),b=l.unit.baseHeightM,h=f.rake>0?Math.tan(f.rake*Math.PI/180):0,y=f.rake<=.01&&f.height<=b+.001,x=l.section.surfaceKind,g=x==="flat"?!0:x==="rakedRows"&&f.rake>.01?!1:y,v=l.hasSeats?un(d,t,l.seatIndices,l.unit.focal):{sectionId:d,rows:[],blockCount:0},P=v.rows.length<2?qr([...l.rows.values()].map(T=>({points:T})),l.unit.focal):null,M=1/0;if(P){if(l.hasSeats)for(let T of l.rows.values())for(let w of T){let F=P.depthAt(w.x,w.y);F<M&&(M=F)}if(!l.hasSeats||!Number.isFinite(M)){M=1/0;for(let T of l.section.outline){let w=P.depthAt(T.x,T.y);w<M&&(M=w)}}}let A=b+jl,k=Math.max(A,f.height),z=T=>{let w=Math.max(0,T-M)*be,F=Math.min(w*h,bo);return Math.max(A,f.height+F)},V=T=>{let w=Math.max(0,T)*be,F=Math.min(w*h,bo);return Math.max(A,f.height+F)},L=g?[]:v.rows.map(T=>({pts:T.pts,y:V(T.blockDepth),depth:T.blockDepth,blockId:T.blockId,...u.has(T.id)?{patch:ei(T.pts,Ce)}:{}})),C=L.length?L[0].y:k,_=L.map(T=>{let w=T.patch&&T.patch.length>=3?T.patch:T.pts,F=0,I=0;for(let H of w)F+=H.x,I+=H.y;let O=w.length||1;F/=O,I/=O;let j=0;for(let H of w){let N=Math.hypot(H.x-F,H.y-I);N>j&&(j=N)}return{cx:F,cy:I,rad:j}}),B=g?()=>k:L.length>=2?(T,w)=>{let F=1/0,I=C;for(let O=0;O<L.length;O++){let j=_[O];if(Math.hypot(T-j.cx,w-j.cy)-j.rad>=F)continue;let H=L[O].patch,N=H&&H.length>=3?kt(H,T,w)?0:yt(H,T,w):yt(L[O].pts,T,w);N<F&&(F=N,I=L[O].y)}return I}:(T,w)=>P?z(P.depthAt(T,w)):k,S=[0,1,0],E=L.length>=2||g?()=>S:(T,w)=>{if(!P)return S;let F=P.depthAt(T,w);if(F<=M)return S;let I=(F-M)*be;if(I*h>=bo||f.height+I*h<=A)return S;let[O,j]=P.gradientAt(T,w);if(O===0&&j===0)return S;let H=1/Math.hypot(h,1);return[-O*h*H,H,-j*h*H]};if(!g)for(let T of v.rows){let w=V(T.blockDepth);for(let F of T.seatIndices)a[F]=w}for(let T of v.rows){let w=[];for(let H=1;H<T.pts.length;H++){let N=Math.hypot(T.pts[H].x-T.pts[H-1].x,T.pts[H].y-T.pts[H-1].y);N>1e-6&&w.push(N)}w.sort((H,N)=>H-N);let F=w.length?w[Math.floor(w.length/2)]:1/0,I=1/0,O=T.pts[Math.floor(T.pts.length/2)];if(O)for(let H of v.rows){if(H===T||H.blockId!==T.blockId)continue;let N=yt(H.pts,O.x,O.y);N>1e-6&&N<I&&(I=N)}let j=Math.min(F,Math.max(I,F*.5));if(Number.isFinite(j)&&j>0)for(let H of T.seatIndices)s[H]=j}r.set(d,{sectionId:d,deckAt:B,normalAt:E,flat:g,bottomY:b,rowLevels:L,landingY:C})}for(let d=0;d<t.length;d++){let l=o[d],f=t[d];if(l){let h=a[d];i[d]=(h??r.get(l).deckAt(f.x,f.y))+Yl;continue}let b=f.eyeHeightM;i[d]=Number.isFinite(b)?Math.max(0,b-Ie):0}return{bySection:r,seatOwner:o,seatDeckY:d=>i[d],seatPitchU:d=>s[d]}}var le={top:1,wallBottom:.5,bottomCap:.4};function Oe(e,t){if(!e)return t;let n=Pe(Et(e,.4),.62);return ge(t,n,.72)}function pi(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,m=0,u=0;for(let[p,d]of a){let l=ne(n.get(p));l&&(s+=l[0]*d,c+=l[1]*d,m+=l[2]*d,u+=d)}u>0&&o.set(i,[s/u,c/u,m/u])}return o}function hi(e,t){return ne(e.color)??t.get(e.logicalSectionId??e.id)??null}var bi=mt(require("polygon-clipping"),1);function Xl(e,t){return e===void 0||t===void 0?!0:Math.abs(e-t)<.001}var bn=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=vt(t),i=this.rings.filter((c,m)=>hn(o,this.boxes[m])&&Xl(n,this.levels[m])),a=[[r]];if(i.length)try{a=bi.default.difference([r],...i).map(m=>m.map(u=>u.map(([p,d])=>[p,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 m=c[0].map(([u,p])=>({x:u,y:p}));if(m.length>1){let u=m[0],p=m[m.length-1];Math.abs(u.x-p.x)<1e-9&&Math.abs(u.y-p.y)<1e-9&&m.pop()}m.length>=3&&s.push(m)}return s}};function Wl(e,t){if(!t)return e;let n=1/0,r=-1/0,o=1/0,i=-1/0;for(let p of e)n=Math.min(n,p.x),r=Math.max(r,p.x),o=Math.min(o,p.y),i=Math.max(i,p.y);let a=(n+r)/2,s=(o+i)/2,c=t*Math.PI/180,m=Math.cos(c),u=Math.sin(c);return e.map(p=>{let d=p.x-a,l=p.y-s;return{x:a+d*m-l*u,y:s+d*u+l*m}})}function rt(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=Ot(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=sn(n,r,e.width/2,e.height/2)}return t?Wl(t,e.rotation):null}function Nt(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"&&mn(e.stageKind)?{kind:"stage",heightM:.06}:n[t]??{kind:"plate",heightM:.25};return{...r,heightM:e.heightM??r.heightM}}var Kl=.08;function yi(e,t){let n=rt(e),r=Nt(e),o=r.heightM;if(!n||r.kind!=="plate"&&r.kind!=="stage")return o;let i=1/0,a=1/0,s=-1/0,c=-1/0;for(let u of n)i=Math.min(i,u.x),a=Math.min(a,u.y),s=Math.max(s,u.x),c=Math.max(c,u.y);let m=o;for(let u of t)s>u.minX&&i<u.maxX&&c>u.minY&&a<u.maxY&&m<=u.topOffsetM+1e-6&&(m=u.topOffsetM+Kl);return t.push({minX:i,minY:a,maxX:s,maxY:c,topOffsetM:m}),m}function je(e,t,n){return{x:e.x+(t.x-e.x)*n,y:e.y+(t.y-e.y)*n}}function gi(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 Gt(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 xi(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 Ve(e,t,n,r,o,i){ue(e,t,void 0,()=>n,r,o,i,le)}var yo=2.4,ql=.75,$l=.15;function zt(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,m=r/2;return[[-c,-m],[c,-m],[c,m],[-c,m]].map(([u,p])=>({x:t.x+u*a-p*s,y:t.y+u*s+p*a}))}function vi(e,t,n,r,o){let i=zt(t);i&&ue(e,i,void 0,()=>n+yo,n,Oe(r,o.boothTop),o.boothWall,le)}function go(e){if(e.shape==="round"){let u=e.radius;return u?sn(e.center.x,e.center.y,u,u,24):null}let{width:t,height:n,rotation:r,center:o}=e;if(!t||!n)return null;let i=(r??0)*Math.PI/180,a=Math.cos(i),s=Math.sin(i),c=t/2,m=n/2;return[[-c,-m],[c,-m],[c,m],[-c,m]].map(([u,p])=>({x:o.x+u*a-p*s,y:o.y+u*s+p*a}))}function Si(e,t,n,r,o){let i=go(t);i&&ue(e,i,void 0,()=>n+ql,n,Oe(r,o.tableTop),o.tableWall,le)}function Mi(e,t,n,r,o,i,a,s){let c=rt(t);if(!c)return;let m=s?s.kind==="stage":t.role==="stage",u=s?s.kind==="screen":t.role==="screen",p=s?{kind:m?"stage":"solid",heightM:s.topY-s.baseY}:Nt(t),d=s?.baseY??n,l=s?.topY??n+r;if(m&&a){let x=1/0,g=-1/0,v=1/0,R=-1/0;for(let P of c)P.x<x&&(x=P.x),P.x>g&&(g=P.x),P.y<v&&(v=P.y),P.y>R&&(R=P.y);a.push({cx:(x+g)/2*G,cz:(v+R)/2*G,y:l,halfX:Math.max((g-x)/2*G,.5),halfZ:Math.max((R-v)/2*G,.5)})}let f=ne(t.fill),b=m&&f?ge(o.stageTop,Pe(Et(f,.18),.9),.9):Oe(f,m?o.stageTop:o.decorTop),h=u?f:null,y=m?f?ge(o.stageWall,Pe(f,.58),.82):o.stageWall:u?h?ge(Pe(h,1.42),[.24,.46,.82],.08):[.24,.46,.82]:Oe(ne(t.fill),o.decorWall);if(p.kind==="portal"&&c.length===4){let x=gi(c);Ve(e,Gt(x,0,.16),l,d,b,y),Ve(e,Gt(x,.84,1),l,d,b,y),Ve(e,x,l,Math.max(d,l-.35),b,y);return}if(p.kind==="suite"&&c.length===4){let x=c.map((R,P)=>{let M=c[(P+1)%4],A=(R.x+M.x)/2,k=(R.y+M.y)/2;return Math.hypot(A-i.x,k-i.y)}),g=x.indexOf(Math.min(...x)),v=[0,1,2,3].map(R=>c[(g+R)%4]);Ve(e,Gt(v,0,.08),l,d,b,y),Ve(e,Gt(v,.92,1),l,d,b,y),Ve(e,xi(v,.88,1),l,d,b,y),Ve(e,v,l,Math.max(d,l-.18),b,y);return}Ve(e,c,l,d,b,y)}function xo(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),m=Math.sin(s),u=r/2,p=o/2;return[[-u,-p],[u,-p],[u,p],[-u,p]].map(([d,l])=>({x:i+d*c-l*m,y:a+d*m+l*c}))}function Ql(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 ne(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=ne(s[1].trim());c&&a.push(c)}return a.length?a.reduce((s,c,m)=>ge(s,c,1/(m+1)),a[0]):null}function wi(e,t,n,r){if(t.layer==="foreground")return;let o=xo(t);if(!o)return;let i=n+$l,a=Oe(Ql(t.href),r.decorTop),s=Math.max(0,Math.min(1,t.opacity??1));s<1&&(a=ge(r.ground,a,s)),ue(e,o,void 0,()=>i,n,a,ge(a,r.decorWall,.5),le)}function Pi(e,t,n,r,o){if(!t.points||t.points.length<3)return;let i=Oe(r,o.gaTop);ue(e,t.points,t.holes,()=>n+.15,n,i,o.gaWall,le)}var Zl=Math.PI/180,oe=96,Jl=6,eu=60,tu=150,Ci=.2,nu=.35;function ou(e,t){let n=Math.atan2(t.x-e.x,t.y-e.y)/Zl;return n<0?n+360:n}function yn(e){if(!e.length)return NaN;let t=[...e].sort((n,r)=>n-r);return t[Math.floor(t.length/2)]}function gn(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 m=i+c;if(t)m=(m%r+r)%r;else if(m<0||m>=r)continue;a+=e[m],s++}o[i]=a/s}return o}function Ai(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 l of d.rows){for(let f of l.pts)o+=f.x,i+=f.y,a++;if(l.pts.length>=4){let f=io(l.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=yn(r.map(y=>y.x)),l=yn(r.map(y=>y.y)),f=0;for(let y of n)for(let x of y.rows)for(let g of x.pts){let v=Math.hypot(g.x-s.x,g.y-s.y);v>f&&(f=v)}let b=0,h=f*.2;for(let y of n)for(let x of y.rows)for(let g of x.pts)Math.hypot(g.x-d,g.y-l)<h&&b++;Math.hypot(d-s.x,l-s.y)<=f&&b/a<.01&&(c={x:d,y:l})}let m=[];for(let d of n){let l={sectionId:d.sectionId,rMin:1/0,rMax:-1/0,samples:[]};for(let f of d.rows)for(let b of f.pts){let h=Math.hypot(b.x-c.x,b.y-c.y),y=Math.min(oe-1,Math.floor(ou(c,b)/(360/oe)));l.samples.push({r:h,bin:y,levelM:f.levelM}),h<l.rMin&&(l.rMin=h),h>l.rMax&&(l.rMax=h)}l.samples.length&&m.push(l)}if(!m.length)return null;m.sort((d,l)=>d.rMin+d.rMax-(l.rMin+l.rMax));let u=[];for(let d of m){let l=!1;for(let f of u){let b=Math.min(d.rMax,f.rMax)-Math.max(d.rMin,f.rMin),h=Math.min(d.rMax-d.rMin,f.rMax-f.rMin);if(h>1e-9&&b>=nu*h){f.members.push(d),f.rMin=Math.min(f.rMin,d.rMin),f.rMax=Math.max(f.rMax,d.rMax),l=!0;break}}l||u.push({members:[d],rMin:d.rMin,rMax:d.rMax})}let p=[];for(let d of u){let l=new Array(oe).fill(null);for(let C of d.members)for(let _ of C.samples){let B=l[_.bin];B||(B={samples:[]},l[_.bin]=B),B.samples.push({r:_.r,levelM:_.levelM})}let f=l.map(C=>!!C);if(!f.filter(Boolean).length)continue;let h=[],y=[];for(let C of l){if(!C)continue;let _=1/0,B=-1/0;for(let S of C.samples)S.r<_&&(_=S.r),S.r>B&&(B=S.r);h.push(_),y.push(B)}let x=yn(h),g=yn(y);if(!(x>=Ci*g)||!(g>0))continue;let v=[...h].sort((C,_)=>C-_);if(!(v[Math.floor(v.length*.1)]>=Ci*g))continue;let P=l.map(C=>{if(!C)return null;let _=[...C.samples].sort((O,j)=>O.r-j.r),B=_[0].r,S=_[_.length-1].r,E=_[0].levelM,T=-1/0;for(let O of _)O.levelM>T&&(T=O.levelM);let w=[];for(let O of _){let j={r:O.r,l:O.levelM};for(;w.length&&Math.abs(w[w.length-1].r-j.r)<1e-9;){if(w[w.length-1].l<=j.l){j.skip=!0;break}w.pop()}if(!j.skip){for(;w.length>=2;){let H=w[w.length-2],N=w[w.length-1];if((N.r-H.r)*(j.l-H.l)-(N.l-H.l)*(j.r-H.r)<=0)w.pop();else break}w.push(j)}}let F=w.map(O=>O.r),I=w.map(O=>O.l);return{inner:B,outer:S,front:E,top:T,profile:{rs:F,ls:I}}}),M=f.slice();for(let C=0;C<oe;C++){if(M[C])continue;let _=-1,B=-1,S=0;for(let D=1;D<=oe;D++){let W=(C-D+oe*2)%oe;if(M[W]){_=W;break}}for(let D=1;D<=oe;D++){let W=(C+D)%oe;if(M[W]){B=W,S=D;break}}if(_<0||B<0)continue;let E=0;for(let D=1;D<=oe;D++){let W=(C-D+oe*2)%oe;if(f[W]){E=D;break}}if(E-1+S>Jl)continue;let w=P[_],F=P[B],I=E/(E+S),O=w.inner+(F.inner-w.inner)*I,j=w.outer+(F.outer-w.outer)*I,H=w.front+(F.front-w.front)*I,N=w.top+(F.top-w.top)*I;P[C]={inner:O,outer:j,front:H,top:N,profile:{rs:[O,j],ls:[H,N]}}}for(let C=0;C<oe;C++)P[C]&&(M[C]=!0);let A=360/oe,k=[],z=M.filter(Boolean).length,V=[];if(z===oe)V.push({start:0,len:oe});else{let C=0;for(;M[C];)C=(C+1)%oe;let _=-1;for(let B=0;B<=oe;B++){let S=(C+B)%oe,E=B<oe&&M[S];if(E&&_<0)_=S;else if(!E&&_>=0){let T=(S-_+oe)%oe||oe;V.push({start:_,len:T}),_=-1}}}for(let C of V){if(C.len*A<eu&&C.len<oe)continue;let _=C.len===oe,B=new Float64Array(C.len),S=new Float64Array(C.len),E=new Float64Array(C.len),T=new Float64Array(C.len),w=[];for(let D=0;D<C.len;D++){let W=P[(C.start+D)%oe];B[D]=W.inner,S[D]=W.outer,E[D]=W.front,T[D]=W.top,w.push(W.profile??{rs:[W.inner,W.outer],ls:[W.front,W.top]})}let F=gn(B,_),I=gn(S,_),O=gn(E,_),j=gn(T,_);for(let D=0;D<C.len;D++)F[D]>B[D]&&(F[D]=B[D]),I[D]<S[D]&&(I[D]=S[D]),F[D]>I[D]-1e-6&&(F[D]=Math.max(0,I[D]-1e-6)),j[D]<O[D]&&(j[D]=O[D]);let H={startBin:C.start,binCount:C.len,closed:_,innerR:F,outerR:I,frontLevelM:O,topLevelM:j,profiles:w},N=(D,W,X)=>{let Q=w[D],q=Q.rs,K=Q.ls;if(W<=q[0]){K[0]>X&&(K[0]=X);return}if(W>=q[q.length-1]){K[K.length-1]>X&&(K[K.length-1]=X);return}for(let Z=0;Z+1<q.length;Z++)if(W<=q[Z+1]){K[Z]>X&&(K[Z]=X),K[Z+1]>X&&(K[Z+1]=X);return}};for(let D=0;D<C.len;D++){let W=l[(C.start+D)%oe];if(W)for(let X of W.samples){N(D,X.r,X.levelM);let Q=_?(D-1+C.len)%C.len:D-1,q=_?(D+1)%C.len:D+1;Q>=0&&N(Q,X.r,X.levelM),q<C.len&&N(q,X.r,X.levelM)}}k.push(H)}k.reduce((C,_)=>C+_.binCount*A,0)<tu||p.push({arcs:k,sectionIds:d.members.map(C=>C.sectionId),innerRMedian:x,outerRMedian:g})}if(!p.length)return null;if(p.sort((d,l)=>d.innerRMedian-l.innerRMedian),t){let d=p[p.length-1].outerRMedian;if(Math.hypot(t.x-c.x,t.y-c.y)>.9*d)return null}return{centre:c,binCount:oe,binStepDeg:360/oe,rings:p}}function Ri(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,m=u=>{let p=t.profiles[u],d=p.rs,l=p.ls;if(r<=d[0])return l[0];if(r>=d[d.length-1])return l[l.length-1];for(let f=0;f+1<d.length;f++)if(r<=d[f+1]){let b=d[f+1]-d[f],h=b>1e-9?(r-d[f])/b:0;return l[f]+(l[f+1]-l[f])*h}return l[l.length-1]};return m(a)*(1-c)+m(s)*c}var ru=.25,iu=1.2,au=.6,su=.45,cu=2.3,lu=Math.PI/180;function it(e,t,n){let r=n*lu;return{x:e.x+t*Math.sin(r),y:e.y+t*Math.cos(r)}}function uu(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 mu=24;function du(e,t,n,r,o,i,a,s){let c=n.binCount,m=mu,u=be,p=i+.02,d=[];for(let L=0;L<c;L++){let C=(n.startBin+L+.5)*t.binStepDeg,_=new Float64Array(m+1);for(let B=0;B<=m;B++){let S=r[L]+(o[L]-r[L])*B/m;_[B]=Math.max(p,Ri(t,n,C,S)-ru)}d.push(_)}let l=[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],b=[a.bandWall[0]*s.top,a.bandWall[1]*s.top,a.bandWall[2]*s.top],h=[a.bandWall[0]*s.wallBottom,a.bandWall[1]*s.wallBottom,a.bandWall[2]*s.wallBottom],y=(L,C)=>{let _=(n.startBin+L+.5)*t.binStepDeg,B=r[L]+(o[L]-r[L])*C/m,S=it(t.centre,B,_);return[S.x*u,d[L][C],S.y*u]};{let L=Math.tan(12*Math.PI/180);for(let C=0;C<6;C++){let _=!1;for(let S=0;S<c;S++)for(let E=m-1;E>=0;E--)d[S][E]>d[S][E+1]&&(d[S][E]=d[S][E+1],_=!0);let B=n.closed?c:c-1;for(let S=0;S<B;S++){let E=(S+1)%c;for(let T=0;T<=m;T++){let w=d[E][T]-d[S][T];if(Math.abs(w)>1)continue;let F=r[S]+(o[S]-r[S])*T/m,I=r[E]+(o[E]-r[E])*T/m,O=it(t.centre,F,(n.startBin+S+.5)*t.binStepDeg),j=it(t.centre,I,(n.startBin+E+.5)*t.binStepDeg),H=L*Math.hypot(j.x-O.x,j.y-O.y)*u;w>H?(d[E][T]=d[S][T]+H,_=!0):-w>H&&(d[S][T]=d[E][T]+H,_=!0)}}if(!_)break}}let x=1,g=(L,C)=>{for(let _=0;_<=m;_+=4)if(Math.abs(d[L][_]-d[C][_])>x)return!0;return Math.abs(d[L][m]-d[C][m])>x},v=Math.tan(38*Math.PI/180),R=L=>(o[L]-r[L])/m*u,P=(L,C)=>d[L][C+1]-d[L][C]>v*Math.max(1e-6,R(L)),M=(L,C)=>{let _=n.closed?(L-1+c)%c:Math.max(0,L-1),B=n.closed?(L+1)%c:Math.min(c-1,L+1);Math.abs(d[_][C]-d[L][C])>x&&(_=L),Math.abs(d[B][C]-d[L][C])>x&&(B=L);let S=Math.max(0,C-1),E=Math.min(m,C+1);S<C&&P(L,S)&&(S=C),E>C&&P(L,C)&&(E=C);let T=y(_,C),w=y(B,C),F=y(L,S),I=y(L,E),O=w[0]-T[0],j=w[1]-T[1],H=w[2]-T[2],N=I[0]-F[0],D=I[1]-F[1],W=I[2]-F[2],X=j*W-H*D,Q=H*N-O*W,q=O*D-j*N,K=Math.hypot(X,Q,q);return K>1e-12?(X/=K,Q/=K,q/=K,Q<0&&(X=-X,Q=-Q,q=-q),[X,Q,q]):[0,1,0]},A=(L,C)=>{let _=[L[0],i,L[2]],B=[C[0],i,C[2]],S=C[0]-L[0],E=C[2]-L[2],T=Math.hypot(S,E);if(!(T>1e-12))return;let w=[E/T,0,-S/T];e.tri(L,C,B,w,b,b,h),e.tri(L,B,_,w,b,h,h)},k=.05*He,z=L=>o[L]-r[L]<k,V=n.closed?c:c-1;for(let L=0;L<V;L++){let C=(L+1)%c;if(z(L)||z(C))continue;if(g(L,C)){let w=(n.startBin+L+1)*t.binStepDeg,F=(D,W)=>{let X=(r[L]+r[C])/2,Q=(o[L]+o[C])/2,q=X+(Q-X)*W/m,K=it(t.centre,q,w);return[K.x*u,d[D][W],K.y*u]};for(let D=0;D<m;D++){let W=y(L,D),X=y(L,D+1),Q=F(L,D),q=F(L,D+1),K=M(L,D),Z=M(L,D+1);e.triN(W,Q,q,K,K,Z,l),e.triN(W,q,X,K,Z,Z,l);let te=y(C,D),Me=y(C,D+1),Ae=F(C,D),Be=F(C,D+1),ke=M(C,D),Ne=M(C,D+1);e.triN(Ae,te,Me,ke,ke,Ne,l),e.triN(Ae,Me,Be,ke,Ne,Ne,l);let we=F(L,D),de=F(L,D+1),Ge=F(C,D+1),ct=F(C,D),lt=de[0]-we[0],Fe=de[2]-we[2],qe=Math.hypot(lt,Fe);if(qe>1e-12){let ut=[Fe/qe,0,-lt/qe];e.tri(we,de,Ge,ut,b),e.tri(we,Ge,ct,ut,b)}}let I=y(L,0),O=y(C,0),j=y(C,m),H=y(L,m),N=D=>[D[0],i,D[2]];e.tri(N(I),N(j),N(O),[0,-1,0],f),e.tri(N(I),N(H),N(j),[0,-1,0],f),A(I,O),A(H,j);continue}for(let w=0;w<m;w++){let F=M(L,w),I=M(C,w),O=M(C,w+1),j=M(L,w+1);if(P(L,w)||P(C,w)){let X=(de,Ge)=>{let ct=(n.startBin+de+.5)*t.binStepDeg,lt=r[de]+(o[de]-r[de])*(w+.5)/m,Fe=it(t.centre,lt,ct);return[Fe.x*u,Ge,Fe.y*u]},Q=y(L,w),q=y(C,w),K=X(L,d[L][w]),Z=X(C,d[C][w]);e.triN(Q,q,Z,F,I,I,l),e.triN(Q,Z,K,F,I,F,l);let te=y(C,w+1),Me=y(L,w+1),Ae=X(L,d[L][w+1]),Be=X(C,d[C][w+1]);e.triN(Ae,Be,te,j,O,O,l),e.triN(Ae,te,Me,j,O,j,l);let ke=Z[0]-K[0],Ne=Z[2]-K[2],we=Math.hypot(ke,Ne);if(we>1e-12){let de=[-Ne/we,0,ke/we];e.tri(K,Z,Be,de,b),e.tri(K,Be,Ae,de,b)}continue}let H=y(L,w),N=y(C,w),D=y(C,w+1),W=y(L,w+1);e.triN(H,N,D,F,I,O,l),e.triN(H,D,W,F,O,j,l)}let _=y(L,0),B=y(C,0),S=y(C,m),E=y(L,m),T=w=>[w[0],i,w[2]];e.tri(T(_),T(S),T(B),[0,-1,0],f),e.tri(T(_),T(E),T(S),[0,-1,0],f),A(_,B),A(E,S)}if(!n.closed)for(let L of[0,c-1])for(let C=0;C<m;C++)A(y(L,C),y(L,C+1))}function Ei(e,t,n){let{bottomY:r,colors:o,ao:i}=n,a=new Float64Array(t.binCount).fill(-1/0);for(let u of t.rings)for(let p of u.arcs){let d=new Float64Array(p.binCount),l=new Float64Array(p.binCount);for(let b=0;b<p.binCount;b++){let h=(p.startBin+b)%t.binCount,y=Math.max(0,p.innerR[b]-Ce);d[b]=Math.max(y,a[h]+.001),l[b]=Math.max(d[b]+.001,p.outerR[b]+Ce)}let f=0;for(let b=0;b<p.binCount;b++){let h=p.topLevelM[b]-r;h>f&&(f=h)}f>=iu&&du(e,t,p,d,l,r,o,i);for(let b=0;b<p.binCount;b++){let h=(p.startBin+b)%t.binCount;l[b]>a[h]&&(a[h]=l[b])}}if(n.deriveShell===!1||uu(n.shapes,t))return;let s=t.rings[t.rings.length-1],c=au*He,m=su*He;for(let u of s.arcs){let p=[],d=[];for(let b=0;b<u.binCount;b++){let h=(u.startBin+b+.5)*t.binStepDeg,y=u.outerR[b]+Ce+c;p.push(it(t.centre,y,h)),d.push(it(t.centre,y+m,h))}let l=-1/0;for(let b=0;b<u.binCount;b++)u.topLevelM[b]>l&&(l=u.topLevelM[b]);let f=()=>l+cu;u.closed?ue(e,d,[p.slice().reverse()],f,r,o.shellTop,o.shellWall,i):ue(e,[...d,...p.slice().reverse()],void 0,f,r,o.shellTop,o.shellWall,i)}}function Ii(e,t,n,r,o,i,a,s){if(!t.outline||t.outline.length<3)return;let c=n.baseHeightM,m=Oe(r,s.tierTop);if(!o)return;let u=h=>o.deckAt(h.x,h.y),p=ui(t,a),d=p[0]??t.outline;if(o.rowLevels.length>=2){let h=pn(o.rowLevels),y=mi(ri(o.rowLevels,n.focal,h),p),x=()=>[0,1,0];for(let v of y){let R=Math.max(c,v.topY-.02);for(let P of i.subtract(v.outline,R))ue(e,P,v.holes,()=>R,c,m,s.tierWall,le,void 0,x)}y.length||ue(e,d,t.holes,()=>o.landingY,c,m,s.tierWall,le);let g={tread:[m[0]*le.top,m[1]*le.top,m[2]*le.top],riser:[m[0]*.72,m[1]*.72,m[2]*.72]};for(let v of p.length?p:[d])ai(e,o.rowLevels,n.focal,o.landingY,g,v,h);return}let l=o.flat?1/0:di,f=h=>o.normalAt(h.x,h.y),b=o.flat?o.landingY:void 0;for(let h of i.subtract(d,b))ue(e,h,t.holes,u,c,m,s.tierWall,le,l,f)}function fu(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 m=t[a],u=o.get(s);u||(u=new Map,o.set(s,u));let p=m.rowId||`__seat-${a}`,d=u.get(p);d||(d={pts:[],levelM:0,n:0},u.set(p,d)),d.pts.push({x:m.x,y:m.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 m=s.rowLevels.filter(u=>!u.patch).map(u=>({pts:u.pts,levelM:u.y}));m.length>=2&&i.push({sectionId:a.id,rows:m});continue}let c=o.get(a.id);c&&i.push({sectionId:a.id,rows:[...c.values()].map(m=>({pts:m.pts,levelM:m.levelM/m.n}))})}return i}function Ti(e,t,n,r,o,i,a=!0){let s=fu(t,n,r);if(!s.length)return;let c=Ai(s,t.focal);c&&(e.setMaterial(0),Ei(e,c,{bottomY:t.baseHeightM,colors:{bandTop:Pe(o.tierTop,.8),bandWall:o.tierWall,shellTop:i??Pe(o.tierWall,1.15),shellWall:i??o.tierWall},ao:le,shapes:t.objects.filter(m=>m.type==="shape"),deriveShell:a}))}var _i=/^[\p{L}\p{N}]{1,4}$/u,pu=/^([\p{L}\p{N}]{2,})[\s\-\u2013\u2014\u00b7_./]+(.+)$/u;function Li(e,t){let n=t?.trim();if(!n)return e;let r=e.toLocaleLowerCase("en-US"),o=n.toLocaleLowerCase("en-US");if(r.startsWith(`${o} `)){let a=e.slice(n.length).trim();if(_i.test(a))return a}let i=pu.exec(e);if(i){let a=i[1].toLocaleLowerCase("en-US"),s=i[2].trim();if((o.startsWith(a)||a.startsWith(o))&&_i.test(s))return s}return e}function ki(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 Fi(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 hu=1.15,bu=2.75,yu=4.5,gu=.85,xu=.5,vu=.26;function Di(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>=hu&&a.add("zone"),o<=(i?bu:yu)&&(a.add("section"),a.add("ga")),o<=gu&&(a.add("annotation"),a.add("booth")),o<=xu&&a.add("row"),o<=vu&&a.add("seat"),a}function Oi(e,t,n,r,o,i=6){let a=i+t,s=r-i-t,c=i+n,m=o-i-n;return{...e,x:a>s?r/2:Math.max(a,Math.min(s,e.x)),y:c>m?o/2:Math.max(c,Math.min(m,e.y))}}function Ye(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],m=o[1]*i+o[5]*a+o[9]*s+o[13],u=o[2]*i+o[6]*a+o[10]*s+o[14],p=o[3]*i+o[7]*a+o[11]*s+o[15];if(!(p>1e-6))return{x:0,y:0,depth:1/0,visible:!1};let d=c/p,l=m/p,f=u/p,b=d>=-1.05&&d<=1.05&&l>=-1.05&&l<=1.05&&f<=1;return{x:(d*.5+.5)*n,y:(1-(l*.5+.5))*r,depth:f,visible:b}}function Vi(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(vo(i,s,t,n)){a=!0;break}a||r.push(i)}return r}var Su=6;function vo(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+Su):n;return o<a&&i<r}function Bi(e,t,n){return e.length*t*.58+(n?14:0)}var Mu={row:8,seat:14};function Ni(e){return e<480?{row:5,seat:8}:e<768?{row:6,seat:10}:Mu}function Gi(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 So(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 m of o)if(vo(s,m,t,n)){c=!0;break}if(!c){for(let m of a)if(vo(s,m,t,n)){c=!0;break}}c||a.push(s)}return a}var wu=6,Pu=2.2,zi=.1,Cu=.3,Au=1.8,Ru=.9,Eu=.55,Iu=6e3;function Ui(e){let{doc:t,units:n,seats:r,surfaces:o,focal:i}=e,a=t.zones??[],s=[];if(a.length){let c=new Map;for(let u of n)for(let p of u.objects)p.type==="section"&&p.zone&&c.set(p.id,p.zone);let m=new Map;for(let u=0;u<r.length;u++){let p=r[u],d=o.seatOwner[u],l=p.zoneId??(d?c.get(d):void 0);if(!l)continue;let f=m.get(l);f||(f={n:0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0,sumY:0},m.set(l,f)),f.n++,p.x<f.minX&&(f.minX=p.x),p.y<f.minY&&(f.minY=p.y),p.x>f.maxX&&(f.maxX=p.x),p.y>f.maxY&&(f.maxY=p.y),f.sumY+=o.seatDeckY(u)}for(let u of a){let p=m.get(u.id),d=[];for(let[l,f]of c)f===u.id&&d.push(l);if(!p||p.n===0){s.push({id:u.id,label:u.label,color:ne(u.color),sectionIds:d,seatCount:0,center:[0,0,0],radius:0,focalWorld:[(u.focalPoint??i).x*G,1.5,(u.focalPoint??i).y*G]});continue}s.push({id:u.id,label:u.label,color:ne(u.color),sectionIds:d,seatCount:p.n,center:[(p.minX+p.maxX)/2*G,p.sumY/p.n,(p.minY+p.maxY)/2*G],radius:.5*Math.hypot((p.maxX-p.minX)*G,(p.maxY-p.minY)*G)||1,focalWorld:[(u.focalPoint??i).x*G,1.5,(u.focalPoint??i).y*G]})}}return s}function Hi(e){let{doc:t,units:n,seats:r,surfaces:o,seatData:i,hintedSeatFloor:a,zones:s,focal:c}=e,m=[],u=[],p=[];for(let d of s)d.seatCount!==0&&m.push({id:`zone:${d.id}`,kind:"zone",text:d.label,anchor:[d.center[0],d.center[1]+wu,d.center[2]],color:t.zones?.find(l=>l.id===d.id)?.color});{let d=new Map,l=new Map;for(let f=0;f<r.length;f++){let b=o.seatOwner[f];if(!b)continue;let h=d.get(b);h||(h={n:0,x:0,y:0,deck:0},d.set(b,h)),h.n++,h.x+=r[f].x,h.y+=r[f].y,h.deck+=o.seatDeckY(f);let y=l.get(b);y||(y={minX:1/0,maxX:-1/0,minY:1/0,maxY:-1/0},l.set(b,y)),r[f].x<y.minX&&(y.minX=r[f].x),r[f].x>y.maxX&&(y.maxX=r[f].x),r[f].y<y.minY&&(y.minY=r[f].y),r[f].y>y.maxY&&(y.maxY=r[f].y)}for(let f of n)for(let b of f.objects){if(b.type!=="section")continue;let h=d.get(b.id);if(!h||h.n===0)continue;let y=l.get(b.id),x=[h.x/h.n*G,h.deck/h.n,h.y/h.n*G],g=b.displayLabel||b.label||b.id;u.push({id:b.id,floorIndex:f.index,label:g,seatCount:h.n,center:x,radius:Math.max(1,Math.hypot(y.maxX-y.minX,y.maxY-y.minY)*.5*G),focalWorld:[f.focal.x*G,f.baseHeightM+1.5,f.focal.y*G]});let v=t.floors?.[f.index]?.name?.trim().toLocaleLowerCase();n.length>1&&v===g.trim().toLocaleLowerCase()||m.push({id:`section:${b.id}`,kind:"section",text:g,anchor:[x[0],x[1]+Pu,x[2]],floorIndex:f.index})}}{for(let b of n)for(let h of b.objects){if(h.type!=="gaArea")continue;let y=Lt(h.points);if(!y)continue;let x=h.displayLabel||h.label||h.id;m.push({id:`ga:${h.id}`,kind:"ga",text:h.capacity>0?`${x} \xB7 ${h.capacity.toLocaleString()}`:x,anchor:[y.x*G,b.baseHeightM+Au,y.y*G],floorIndex:b.index})}let d=new Map;for(let b of n)for(let h of b.objects)h.type==="section"&&d.set(h.id,h.displayLabel||h.label||h.id);let l=new Map;for(let b=0;b<r.length;b++){let h=r[b],y=Math.hypot(h.x-c.x,h.y-c.y),x=l.get(h.rowId);(!x||y>x.far)&&l.set(h.rowId,{seat:h,index:b,far:y})}for(let[b,h]of l){let y=Tu(h.seat.label,b,d.get(h.seat.sectionId??""));y&&m.push({id:`row:${b}`,kind:"row",text:y,anchor:[h.seat.x*G,o.seatDeckY(h.index)+Ru,h.seat.y*G],floorIndex:a[h.index]})}let f=new Map;for(let b=0;b<r.length;b++){let h=r[b],y=h.label?h.label.lastIndexOf("-"):-1,x=f.get(h.rowId);x||(x={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},f.set(h.rowId,x));let g=b*3,v=i.iPosition[g],R=i.iPosition[g+1],P=i.iPosition[g+2];x.n++,x.x+=v,x.y+=R,x.z+=P,x.minX=Math.min(x.minX,v),x.maxX=Math.max(x.maxX,v),x.minZ=Math.min(x.minZ,P),x.maxZ=Math.max(x.maxZ,P)}for(let[b,h]of f)p.push({id:b,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<=Iu)for(let b=0;b<r.length;b++){let h=r[b],y=Mo(h.displayLabel||h.label);y&&m.push({id:`seat:${h.id}`,kind:"seat",text:y,anchor:[h.x*G,o.seatDeckY(b)+Eu,h.y*G],floorIndex:a[b]})}}for(let d of n)for(let l of d.objects)if(l.type==="shape"&&l.role&&["entrance","exit","screen","suite","obstruction"].includes(l.role)){let f=rt(l),b=f?Lt(f):null;if(!b||!l.label)continue;m.push({id:`architecture:${l.id}`,kind:"annotation",text:l.label,anchor:[b.x*G,d.baseHeightM+Nt(l).heightM+zi,b.y*G],color:l.fill,floorIndex:d.index})}else if(l.type==="text"){if(!l.text)continue;m.push({id:`text:${l.id}`,kind:"annotation",text:l.text,anchor:[l.position.x*G,d.baseHeightM+zi,l.position.y*G],color:l.color,rotation:l.rotation,floorIndex:d.index})}else if(l.type==="booth"){let f=zt(l);if(!f)continue;let b=Lt(f);if(!b)continue;m.push({id:`booth:${l.id}`,kind:"booth",text:l.displayLabel||l.label||l.id,anchor:[b.x*G,d.baseHeightM+yo+Cu,b.y*G],floorIndex:d.index})}return{labels:m,sections:u,rows:p}}function ji(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 Mo(e){let t=e.lastIndexOf("-");return t>=0&&t<e.length-1?e.slice(t+1):e}function Tu(e,t,n){let r=e?e.lastIndexOf("-"):-1,o=r>0?e.slice(0,r):t;return o&&Li(o,n)}function Yi(e){let{doc:t,units:n,seats:r,surfaces:o,solids:i,hintedSeatFloor:a,seatFloor:s}=e,c=[];{let m=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 l=Math.max(0,Math.min(n.length-1,Math.round(i.floor[d]))),f=d*3,b=m[l];b.minX=Math.min(b.minX,i.position[f]),b.minY=Math.min(b.minY,i.position[f+1]),b.minZ=Math.min(b.minZ,i.position[f+2]),b.maxX=Math.max(b.maxX,i.position[f]),b.maxY=Math.max(b.maxY,i.position[f+1]),b.maxZ=Math.max(b.maxZ,i.position[f+2])}let u=new Map;for(let d=0;d<n.length;d++)for(let l of n[d].objects)l.type==="section"&&u.set(l.id,d);let p=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 l=o.seatOwner[d],f=(l!==null?u.get(l):void 0)??a[d];if(f===void 0)continue;let b=p[f],h=r[d];b.n++,h.x<b.minX&&(b.minX=h.x),h.y<b.minY&&(b.minY=h.y),h.x>b.maxX&&(b.maxX=h.x),h.y>b.maxY&&(b.maxY=h.y);let y=o.seatDeckY(d);b.sumX+=h.x*G,b.sumDeck+=y,b.sumZ+=h.y*G,b.minDeck=Math.min(b.minDeck,y),b.maxDeck=Math.max(b.maxDeck,y+1.6),s[d]=f}for(let d=0;d<n.length;d++){let l=p[d],f=t.floors?.[d],b=m[d],h=Math.min(l.n?l.minX*G:n[d].focal.x*G-1,Number.isFinite(b.minX)?b.minX:1/0),y=Math.max(l.n?l.maxX*G:n[d].focal.x*G+1,Number.isFinite(b.maxX)?b.maxX:-1/0),x=Math.min(l.n?l.minY*G:n[d].focal.y*G-1,Number.isFinite(b.minZ)?b.minZ:1/0),g=Math.max(l.n?l.maxY*G:n[d].focal.y*G+1,Number.isFinite(b.maxZ)?b.maxZ:-1/0),v=Math.min(l.n?Math.min(n[d].baseHeightM,l.minDeck):n[d].baseHeightM,Number.isFinite(b.minY)?b.minY:1/0),R=Math.max(l.n?Math.max(l.maxDeck,v+.5):v+.5,Number.isFinite(b.maxY)?b.maxY:-1/0),P=[l.n?l.sumX/l.n:(h+y)/2,l.n?l.sumDeck/l.n:(v+R)/2,l.n?l.sumZ/l.n:(x+g)/2],M=Math.max(1,.5*Math.hypot(y-h,R-v,g-x));c.push({index:d,id:f?.id??`floor-${d}`,label:f?.name??(n.length>1?`Floor ${d+1}`:"Venue"),seatCount:l.n,center:P,radius:M,box:{min:[h,v,x],max:[y,R,g]},focalWorld:[n[d].focal.x*G,n[d].baseHeightM+1.5,n[d].focal.y*G]})}}return c}function wo(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 m of c.outline)a(m.x,m.y);else if(c.type==="shape"&&c.points)for(let m of c.points)a(m.x,m.y);else if(c.type==="gaArea")for(let m of c.points)a(m.x,m.y);else if(c.type==="booth"){let m=zt(c);if(m)for(let u of m)a(u.x,u.y)}else if(c.type==="table"){let m=go(c);if(m)for(let u of m)a(u.x,u.y)}else if(c.type==="decorImage"){let m=xo(c);if(m)for(let u of m)a(u.x,u.y)}return Number.isFinite(n)||(n=-100,r=-100,o=100,i=100),{minX:n,minY:r,maxX:o,maxY:i}}function Xi(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=Ot(o.minX-a,o.minY-a,o.maxX-o.minX+a*2,o.maxY-o.minY+a*2);ue(e,s,void 0,()=>0,-.4,i.ground,i.ground,le)}else{let a=t.reduce((l,f)=>f.baseHeightM<l.baseHeightM?f:l);e.setFloor(a.index);let s=n.filter((l,f)=>r[f]===a.index),c=wo([a],s),m=Math.hypot(c.maxX-c.minX,c.maxY-c.minY),u=Math.max(28,Math.min(80,m*.04)),p=Ot(c.minX-u,c.minY-u,c.maxX-c.minX+u*2,c.maxY-c.minY+u*2),d=a.baseHeightM-.03;ue(e,p,void 0,()=>d,d-.22,i.ground,i.ground,le)}}function Wi(e,t,n){let{cx:r,cz:o,radius:i}=n,a=1/0,s=1/0,c=1/0,m=-1/0,u=-1/0,p=-1/0,d=(b,h,y)=>{a=Math.min(a,b),m=Math.max(m,b),s=Math.min(s,h),u=Math.max(u,h),c=Math.min(c,y),p=Math.max(p,y)};for(let b=0;b<e.position.length;b+=3)d(e.position[b],e.position[b+1],e.position[b+2]);for(let b=0;b<t.count;b++){let h=b*3,y=t.iPosition[h],x=t.iPosition[h+1],g=t.iPosition[h+2],v=Math.max(.35,t.iMaxRadius[b]??.35);d(y-v,x,g-v),d(y+v,x+1.6,g+v)}Number.isFinite(a)||(a=r-i,m=r+i,s=0,u=i*.16,c=o-i,p=o+i);let l=[(a+m)/2,(s+u)/2,(c+p)/2],f=Math.max(1,.5*Math.hypot(m-a,u-s,p-c));return{center:l,radius:f,minY:s,maxY:u}}function Ki(e,t,n,r,o,i){let a=1/0,s=1/0,c=-1/0,m=-1/0;for(let v=0;v<e.count;v++){let R=v*3,P=e.iPosition[R],M=e.iPosition[R+2];P<a&&(a=P),P>c&&(c=P),M<s&&(s=M),M>m&&(m=M)}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),m=Math.max(m,v.cz+v.halfZ);let u=n.minX*G,p=n.maxX*G,d=n.minY*G,l=n.maxY*G,f=u,b=p,h=d,y=l;if(Number.isFinite(a)){let v=Math.max(2,.06*Math.hypot(c-a,m-s));f=Math.max(u,a-v),b=Math.min(p,c+v),h=Math.max(d,s-v),y=Math.min(l,m+v)}let x=Math.min(0,r),g=Math.max(o,i*.05);return{min:[f,x,h],max:[b,g,y]}}function qi(e,t,n){let r=()=>({byObjectId:new Map,elements:[]});if(!t||!e)return r();let o=Or(t);if(!o.ok||o.value.id!==e)return r();let i=new Map;for(let p of n)for(let d of p.objects)d.type==="shape"&&i.set(d.id,{shape:d,unit:p});let a=new Set,s=new Set,c=new Map((t.overlay.productionElements??[]).map(p=>{let d=p.runtimeContentImageUrl;return[p.id,typeof d=="string"&&/^(?:blob:|data:image\/|https:\/\/)/.test(d)?d:void 0]})),m=[];for(let p of o.value.overlay.productionElements??[]){let d=i.get(p.objectId),l=d?rt(d.shape):null,f=p.baseElevationM??0;if(!d||!l||l.length<3||!p.id||a.has(p.id)||s.has(p.objectId)||!Number.isFinite(p.heightM)||p.heightM<.05||p.heightM>50||!Number.isFinite(f)||f<-10||f>100)return r();a.add(p.id),s.add(p.objectId);let b=l.map(A=>A.x*G),h=l.map(A=>A.y*G),y=d.unit.baseHeightM+f,x=Math.min(...b),g=Math.max(...b),v=Math.min(...h),R=Math.max(...h),P,M=c.get(p.id)??p.contentImageUrl;if(p.kind==="screen"&&M)if(g-x>=R-v){let A=Math.abs(v-d.unit.focal.y*G)<=Math.abs(R-d.unit.focal.y*G)?v-.006:R+.006;P=[[x,y,A],[g,y,A],[x,y+p.heightM,A],[g,y+p.heightM,A]]}else{let A=Math.abs(x-d.unit.focal.x*G)<=Math.abs(g-d.unit.focal.x*G)?x-.006:g+.006;P=[[A,y,v],[A,y,R],[A,y+p.heightM,v],[A,y+p.heightM,R]]}m.push({id:p.id,objectId:p.objectId,kind:p.kind,floorIndex:d.unit.index,baseY:y,topY:y+p.heightM,bounds:{min:[x,y,v],max:[g,y+p.heightM,R]},occlusion:p.occlusion,...M?{contentImageUrl:M}:{},...P?{contentPlane:P}:{}})}let u=m.sort((p,d)=>p.id.localeCompare(d.id));return{byObjectId:new Map(u.map(p=>[p.objectId,p])),elements:u}}function ve(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function xe(e){return Array.isArray(e)?e:[]}function _u(e){let t=[e];for(;t.length;){let n=t.pop();if(Array.isArray(n)){t.push(...n);continue}if(!ve(n))continue;let r=ve(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 xn(e,t){return!Array.isArray(e)||e.length!==t||!e.every(n=>typeof n=="number"&&Number.isFinite(n))?null:e}function Lu(){return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}function ku(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 Fu(e){let t=xn(e.matrix,16);if(t)return t;if(e.matrix!==void 0)return null;let n=e.translation===void 0?[0,0,0]:xn(e.translation,3),r=e.rotation===void 0?[0,0,0,1]:xn(e.rotation,4),o=e.scale===void 0?[1,1,1]:xn(e.scale,3);if(!n||!r||!o)return null;let[i,a,s,c]=r,m=Math.hypot(i,a,s,c);if(!(m>1e-8))return null;let u=i/m,p=a/m,d=s/m,l=c/m,f=u+u,b=p+p,h=d+d,y=u*f,x=u*b,g=u*h,v=p*b,R=p*h,P=d*h,M=l*f,A=l*b,k=l*h;return[(1-(v+P))*o[0],(x+k)*o[0],(g-A)*o[0],0,(x-k)*o[1],(1-(y+P))*o[1],(R+M)*o[1],0,(g+A)*o[2],(R-M)*o[2],(1-(y+v))*o[2],0,n[0],n[1],n[2],1]}function Du(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 Ou(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],m=e[10],u=i*m-a*c,p=a*s-o*m,d=o*c-i*s,l=t*u+n*p+r*d;if(Math.abs(l)<1e-12)return null;let f=1/l;return[u*f,p*f,d*f,(r*c-n*m)*f,(t*m-r*s)*f,(n*s-t*c)*f,(n*a-r*i)*f,(r*o-t*a)*f,(t*i-n*o)*f]}function $i(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 Vu(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(!ve(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 Bu(e){return e===5120||e===5121?1:e===5122||e===5123?2:e===5125||e===5126?4:0}function Nu(e){return e==="SCALAR"?1:e==="VEC2"?2:e==="VEC3"?3:e==="VEC4"?4:0}function Gu(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 zu(e){let t=e instanceof Uint8Array?e:new Uint8Array(e),n=Vu(t);if(!n)return{ok:!1,issue:"invalid_glb"};let{json:r,bin:o}=n;if(!ve(r.asset)||r.asset.version!=="2.0")return{ok:!1,issue:"unsupported_glb"};let i=xe(r.extensionsUsed).filter(v=>typeof v=="string");if(i.includes("KHR_draco_mesh_compression")||_u(r))return{ok:!1,issue:"draco_not_allowed"};if(i.length||xe(r.extensionsRequired).length)return{ok:!1,issue:"unsupported_glb"};if(xe(r.images).length||xe(r.textures).length)return{ok:!1,issue:"external_resource"};let a=xe(r.buffers);if(a.length!==1||!ve(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=xe(r.accessors),c=xe(r.bufferViews),m=xe(r.meshes),u=xe(r.nodes),p=xe(r.scenes),d=typeof r.scene=="number"?r.scene:0;if(!ve(p[d]))return{ok:!1,issue:"unsupported_glb"};let l=new DataView(o.buffer,o.byteOffset,o.byteLength),f=(v,R,P)=>{if(typeof v!="number"||!Number.isInteger(v)||!ve(s[v]))return null;let M=s[v];if(M.type!==R||M.sparse!==void 0||M.normalized===!0||typeof M.count!="number"||!Number.isInteger(M.count)||M.count<1||typeof M.componentType!="number"||!P.includes(M.componentType)||typeof M.bufferView!="number")return null;let A=c[M.bufferView];if(!ve(A)||A.buffer!==0||typeof A.byteLength!="number"||!Number.isInteger(A.byteLength)||A.byteLength<0)return null;let k=Nu(M.type),z=Bu(M.componentType),V=typeof A.byteStride=="number"?A.byteStride:k*z,L=typeof A.byteOffset=="number"?A.byteOffset:0,C=typeof M.byteOffset=="number"?M.byteOffset:0,_=L+C,B=C+(M.count-1)*V+k*z;if(!Number.isInteger(V)||!Number.isInteger(L)||!Number.isInteger(C)||V<k*z||L<0||C<0||L+A.byteLength>o.byteLength||B>A.byteLength)return null;let S=[];for(let E=0;E<M.count;E++){let T=[];for(let w=0;w<k;w++){let F=Gu(l,_+E*V+w*z,M.componentType);if(!Number.isFinite(F))return null;T.push(F)}S.push(T)}return S},b=[],h=[],y=0,x=new Set,g=(v,R)=>{if(typeof v!="number"||!Number.isInteger(v)||!ve(u[v])||x.has(v))return!1;x.add(v);let P=u[v],M=Fu(P);if(!M)return!1;let A=ku(R,M),k=Ou(A);if(!k)return!1;if(P.mesh!==void 0){if(typeof P.mesh!="number")return!1;let z=m[P.mesh];if(!ve(z))return!1;for(let V of xe(z.primitives)){if(!ve(V)||V.mode!==void 0&&V.mode!==4||!ve(V.attributes))return!1;let L=f(V.attributes.POSITION,"VEC3",[5126]),C=V.attributes.NORMAL===void 0?null:f(V.attributes.NORMAL,"VEC3",[5126]);if(!L||V.attributes.NORMAL!==void 0&&!C)return!1;let _=L.length;if(V.indices!==void 0){let S=typeof V.indices=="number"?s[V.indices]:null;_=ve(S)?S.count:void 0}if(typeof _!="number"||!Number.isInteger(_)||_%3!==0||(y+=_/3,y>1e5))return!1;let B=V.indices===void 0?L.map((S,E)=>[E]):f(V.indices,"SCALAR",[5121,5123,5125]);if(!B||B.length%3!==0||B.length!==_)return!1;for(let S=0;S<B.length;S+=3){let E=[B[S][0],B[S+1][0],B[S+2][0]];if(E.some(F=>!Number.isInteger(F)||F<0||F>=L.length))return!1;let T=E.map(F=>Du(A,...L[F])),w=null;if(!C){let F=T[1][0]-T[0][0],I=T[1][1]-T[0][1],O=T[1][2]-T[0][2],j=T[2][0]-T[0][0],H=T[2][1]-T[0][1],N=T[2][2]-T[0][2];w=$i([1,0,0,0,1,0,0,0,1],I*N-O*H,O*j-F*N,F*H-I*j)}for(let F=0;F<3;F++)b.push(...T[F]),h.push(...C?$i(k,...C[E[F]]):w)}}}for(let z of xe(P.children))if(!g(z,A))return!1;return x.delete(v),!0};for(let v of xe(p[d].nodes))if(!g(v,Lu()))return{ok:!1,issue:y>1e5?"triangle_limit":"unsupported_glb"};return!y||b.length!==y*9||h.length!==b.length?{ok:!1,issue:"unsupported_glb"}:{ok:!0,triangleCount:y,position:new Float32Array(b),normal:new Float32Array(h)}}function Qi(e){try{return zu(e)}catch{return{ok:!1,issue:"invalid_glb"}}}function St(e){let{doc:t}=e,n=Pr(t.theme),r=n.structure,o=li(t,e.eventConfigurationId??t.eventConfigurationId),i=qi(e.eventConfigurationId,e.eventConfiguration,o),a=e.seats,s=new rn,c=null;if(e.registeredShellGlb){let S=Qi(e.registeredShellGlb);if(S.ok){let E=S.position.length/3,T=new Float32Array(S.position.length),w=n.materials.shell??r.tierWall;for(let F=0;F<E;F++){let I=S.normal[F*3+1],O=I<-.25?.4:.62+.38*Math.max(0,I);T[F*3]=w[0]*O,T[F*3+1]=w[1]*O,T[F*3+2]=w[2]*O}c={position:S.position,normal:S.normal,color:T,floor:new Float32Array(E).fill(-2),material:new Float32Array(E),count:E}}}let m=new Map;for(let S of o)for(let E of S.objects)m.set(E.id,S.index),E.type==="section"&&m.set(E.logicalSectionId??E.id,S.index);let u=a.map(S=>m.get(S.sectionId??"")??m.get(S.rowId??"")??0),p=wo(o,a);Xi(s,o,a,u,p,r);let d=pi(t,a),l=new Map,f=new Map;for(let S of t.categories??[])l.set(S.key,S.color),S.seatGlyph&&f.set(S.key,S.seatGlyph);let b=[],h=fi(o,a,u),y=new Float32Array(a.length),x=[];for(let S=0;S<o.length;S++){let E=o[S];s.setFloor(S);let T=new bn,w=[],F=E.objects.filter(I=>I.type==="section"&&!!I.outline&&I.outline.length>=3);for(let I of E.objects)if(I.type==="section"){let O=s.vertexCount;Ii(s,I,E,hi(I,d),h.bySection.get(I.id),T,F,r);let j=s.vertexCount-O;j>0&&x.push({sectionId:I.id,start:O,count:j})}else if(I.type==="shape"){let O=i.byObjectId.get(I.id);s.setMaterial((O?.kind??I.role)==="screen"?1:0),Mi(s,I,E.baseHeightM,yi(I,w),r,E.focal,b,O),s.setMaterial(0)}else I.type==="gaArea"?Pi(s,I,E.baseHeightM,ne(l.get(I.categoryKey)),r):I.type==="booth"?vi(s,I,E.baseHeightM,ne(l.get(I.categoryKey)),r):I.type==="table"?Si(s,I,E.baseHeightM,ne(I.fill??t.theme?.decorFill??"#232c40"),r):I.type==="decorImage"&&wi(s,I,E.baseHeightM,r);Ti(s,E,a,h,r,n.materials.shell,!c)}let g=o.length>1?{x:o.reduce((S,E)=>S+E.focal.x,0)/o.length,y:o.reduce((S,E)=>S+E.focal.y,0)/o.length}:t.focalPoint??{x:(p.minX+p.maxX)/2,y:(p.minY+p.maxY)/2},v=fr(c?[s.build(),c]:[s.build()]),R=Mr(a,e.initialState,h,y,l,f),P=Ui({doc:t,units:o,seats:a,surfaces:h,focal:g}),{labels:M,sections:A,rows:k}=Hi({doc:t,units:o,seats:a,surfaces:h,seatData:R,hintedSeatFloor:u,zones:P,focal:g}),z=Yi({doc:t,units:o,seats:a,surfaces:h,solids:v,hintedSeatFloor:u,seatFloor:y});ji(M,z),R.iYaw=vr(R.iPosition,a.length,S=>a[S].rowId,S=>{let E=o[y[S]]?.focal??g;return[E.x*G,E.y*G]});let V=(p.minX+p.maxX)/2*G,L=(p.minY+p.maxY)/2*G,C=.5*Math.hypot((p.maxX-p.minX)*G,(p.maxY-p.minY)*G)||10,_=Wi(v,R,{cx:V,cz:L,radius:C}),B=Ki(R,b,p,_.minY,_.maxY,C);return{solids:v,sectionSolidRanges:x,seats:R,bounds:{center:[(B.min[0]+B.max[0])/2,(B.min[1]+B.max[1])/2,(B.min[2]+B.max[2])/2],radius:C,groundY:0,box:B},renderBounds:{center:_.center,radius:_.radius},stateColorLUT:Cr(n,pe),theme:n,seatCount:a.length,focalWorld:[g.x*G,1.5,g.y*G],zones:P,stages:b,productionElements:i.elements,sections:A,rows:k,labels:M,floors:z}}var Uu=88,Hu=20,Zi={floor:{size:14,weight:"700",opacity:.98},zone:{size:15,weight:"600",opacity:.95},section:{size:12,weight:"500",opacity:.88},ga:{size:12,weight:"500",opacity:.88},booth:{size:11,weight:"500",opacity:.85},annotation:{size:11,weight:"400",opacity:.75},row:{size:11.5,weight:"700",opacity:.94},seat:{size:12.5,weight:"800",opacity:1}},ju=640,Yu=.8,Xu=11,Wu="3px 7px",Ku="2px 5px",Ji="rgba(10,14,22,.62)",qu="#f4f7fb",ea=5,ta=2,$u=6,Ut=new Set(["row","seat"]),na={floor:5,zone:4,section:3,ga:3,booth:2,annotation:1},vn={row:{x:66,y:20},seat:{x:52,y:22}},Co=ne,Po=e=>Ho(e);function Ao(e,t){let n=Po(e),r=Po(t);return(Math.max(n,r)+.05)/(Math.min(n,r)+.05)}function Ro(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 Qu(e,t=[.04,.06,.1],n=!0){let r=Po(t)<.42,o=r?"#f4f7fb":"#0b1220",i=r?"rgba(8,12,22,.78)":"rgba(255,255,255,.84)",a=n?Ro(i,t):t,s=Co(e),c=n?7:4.5,m=s&&Ao(s,a)>=c?e:o;return r?{ink:m,backing:i,border:"rgba(210,222,245,.24)"}:{ink:m,backing:i,border:"rgba(11,18,32,.22)"}}function Zu(e,t=[.04,.06,.1]){let n=Ro(Ji,t),r=Co(e);return{ink:r&&Ao(r,n)>=4.5?e:qu,backing:Ji}}var Ju='ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif',Sn=class{constructor(t,n={}){this.nodes=new Map;this.labels=[];this.forcedDense=!1;this.selectedSeatLabelIds=new Set;this.narrowStage=!1;this.opts=n,this.root=document.createElement("div"),this.root.setAttribute("data-view3d-labels","");let r=this.root.style;r.position="absolute",r.inset="0",r.pointerEvents="none",r.overflow="hidden",r.fontFamily=n.fontFamily||Ju,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}`))}sizeFor(t){let n=Zi[t].size;return!this.narrowStage||Ut.has(t)?n:Math.max(Xu,n*Yu)}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;this.narrowStage=n>0&&n<ju;let s=Di(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 v=Ye(t,g.anchor,n,r);if(!v.visible)continue;let R=Ut.has(g.kind),P=this.sizeFor(g.kind),M=Bi(g.text,P,!R)+(R?ea*2:0),A=Oi(v,M/2,P/2+(R?ta:4),n,r),k=a?Math.hypot(g.anchor[0]-a[0],g.anchor[1]-a[1],g.anchor[2]-a[2]):1;c.push({label:g,screen:A,focus:Gi(A,k,n,r),halfWidth:M/2,...this.selectedSeatLabelIds.has(g.id)?{priority:1}:{}})}let m=Fi(c.filter(g=>g.label.kind==="floor"),n),u=[...c.filter(g=>!Ut.has(g.label.kind)&&g.label.kind!=="floor"),...m],p=Vi(u,Uu,Hu),d=Ni(n),l=So(c.filter(g=>g.label.kind==="row"),vn.row.x,vn.row.y,d.row,p),f=So(c.filter(g=>g.label.kind==="seat"),vn.seat.x,vn.seat.y,d.seat,[...p,...l]),b=[...p,...l,...f],h=new Set(b.map(g=>g.label.id));for(let{label:g,screen:v}of b){let P=this.nodeFor(g).style;P.display="",P.transform=`translate(-50%, -50%) translate(${v.x.toFixed(1)}px, ${v.y.toFixed(1)}px)`}let y=b.filter(({label:g})=>!Ut.has(g.kind)).sort((g,v)=>na[v.label.kind]-na[g.label.kind]||g.screen.depth-v.screen.depth||g.focus-v.focus),x=[];for(let{label:g}of y){let v=this.nodes.get(g.id);if(!v||v.style.display==="none")continue;let R=v.getBoundingClientRect();x.some(M=>R.left<M.right+3&&R.right+3>M.left&&R.top<M.bottom+3&&R.bottom+3>M.top)?v.style.display="none":x.push(R)}for(let[g,v]of this.nodes)h.has(g)||(v.style.display="none")}nodeFor(t){let n=this.nodes.get(t.id);if(!n){n=document.createElement("div");let f=n.style;f.position="absolute",f.left="0",f.top="0",f.whiteSpace="nowrap",f.textShadow="0 1px 3px rgba(0,0,0,0.85), 0 0 8px rgba(0,0,0,0.55)",f.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=Zi[t.kind],i=n.style;i.fontSize=`${this.sizeFor(t.kind)}px`,i.fontWeight=r?"800":o.weight,i.opacity=r?"1":String(o.opacity);let a=Ut.has(t.kind),s=!a,c=Qu(t.color??this.opts.ink,this.opts.backgroundRgb,!0),m=a?Zu(t.color??this.opts.ink,this.opts.backgroundRgb):c;i.color=r?"#ecf8ff":m.ink,i.background=r?"rgba(10,28,45,.9)":m.backing,i.border=r?"1px solid rgba(89,199,255,.92)":s?`1px solid ${c.border}`:"",i.borderRadius=r||s?"999px":`${$u}px`;let u=this.narrowStage?Ku:Wu;i.padding=r||s?u:`${ta}px ${ea}px`,i.lineHeight=a?"1.1":"",i.boxShadow=r?"0 0 0 2px rgba(41,176,255,.18), 0 5px 14px rgba(0,0,0,.35)":s?"0 3px 10px rgba(0,0,0,.24)":"0 1px 4px rgba(0,0,0,.28)",i.letterSpacing=t.kind==="zone"||t.kind==="floor"?"0.08em":"0.02em";let p=this.opts.backgroundRgb??[.04,.06,.1],d=Co(r?"#ecf8ff":m.ink)??[1,1,1],l=Ro(r?"rgba(10,28,45,.9)":m.backing,p);return n.dataset.qualityContrast=Ao(d,l).toFixed(3),(t.kind==="zone"||t.kind==="floor")&&(i.textTransform="uppercase"),n}dispose(){this.root.remove(),this.nodes.clear()}};var ra=1;var em=new Set(["floor","zone","section","ga","booth","annotation"]);function tm(e){return e.every(t=>Number.isFinite(t))}function nm(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 oa(e){return e.length?Math.round(Math.min(...e)*100)/100:null}function at(e){return Math.round(e*1e4)/1e4}function om(e){if(e)return{box:{x:at(e.box.x),y:at(e.box.y),width:at(e.box.width),height:at(e.box.height)},horizontalFillRatio:at(e.horizontalFillRatio),verticalFillRatio:at(e.verticalFillRatio),visibleAreaRatio:at(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 Mn(e){let t=e.labels.filter(s=>s.visible&&s.screenBox),n=t.filter(s=>em.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)nm(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",tm(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:m})=>({id:s,kind:c,text:m})).sort((s,c)=>s.kind.localeCompare(c.kind)||s.id.localeCompare(c.id)),framing:om(e.framing)},metrics:{minimumHierarchyFontPx:oa(n.map(s=>s.renderedFontPx)),minimumHierarchyContrast:oa(n.map(s=>s.contrast)),projectedReliefPx:Math.round(e.scene.projectedReliefPx*100)/100},findings:a}}var ce=require("ogl");var Xe=require("ogl");var wn=`
|
|
20
|
+
}`});async function is(e,t,n,r={}){let o=r.fadeMs??400,i=t?.initialBearingDeg??0,a=Math.max(-Le,Math.min(Le,t?.initialPitchDeg??0)),s=Fn,c=!1,u=new AbortController,d=()=>u.abort();r.signal?.addEventListener("abort",d,{once:!0});let f=()=>{},m=[n.camera.position.x,n.camera.position.y,n.camera.position.z];if(!t&&n.cameraOriginWorld&&n.camera.position.set(n.cameraOriginWorld[0],n.cameraOriginWorld[1],n.cameraOriginWorld[2]),!t&&n.focalWorld){let I=n.camera.position,O=n.focalWorld[0]-I.x,j=n.focalWorld[1]-I.y,H=n.focalWorld[2]-I.z,N=Math.hypot(O,H);N>.001&&(i=Math.atan2(O,-H)*180/Math.PI,a=Math.max(-Le,Math.min(Le,Math.atan2(j,N)*180/Math.PI)))}let l=null;if(t){let I=n.gl.getParameter(n.gl.MAX_TEXTURE_SIZE),O=_n(t,Tn(I)),j;try{let H=t.resolveUrl?await t.resolveUrl(O.initialUrl):O.initialUrl;if(!H)throw new Error("panorama_asset_unavailable");j=await Yt(H,u.signal)}catch{return r.signal?.removeEventListener("abort",d),null}try{l=ns(n.gl,j)}catch{return u.abort(),r.signal?.removeEventListener("abort",d),null}l.mesh.renderOrder=999,l.mesh.setParent(n.scene),O.upgradeUrl&&(f=Ln(()=>{(t.resolveUrl?t.resolveUrl(O.upgradeUrl):Promise.resolve(O.upgradeUrl)).then(N=>!N||u.signal.aborted?null:Yt(N,u.signal)).then(N=>{N&&(c||u.signal.aborted||(l?.setImage(N),n.requestRender()))}).catch(()=>{})}))}let p=n.camera.fov;n.camera.perspective({fov:s,aspect:n.camera.aspect});let b=n.camera.quaternion.slice(),h=()=>{let I=n.camera.position;l?.mesh.position.set(I.x,I.y,I.z);let[O,j,H]=ts(i,a);n.camera.lookAt([I.x+O,I.y+j,I.z+H]),n.requestRender()};h();let y=document.createElement("div"),x=document.activeElement instanceof HTMLElement?document.activeElement:null;y.setAttribute("role","dialog"),y.setAttribute("aria-modal","true"),y.setAttribute("aria-label",r.seatLabel?`View from ${r.seatLabel}`:"View from seat"),y.tabIndex=-1,Object.assign(y.style,{position:"absolute",inset:"0",zIndex:"10",cursor:"grab",touchAction:"none"});let g=document.createElement("button");if(g.type="button",g.setAttribute("aria-label","Close"),g.textContent="\u2715",Object.assign(g.style,{position:"absolute",top:"12px",right:"12px",zIndex:"2",width:"44px",height:"44px",borderRadius:"999px",cursor:"pointer",border:"1px solid rgba(255,255,255,0.25)",background:"rgba(8,12,18,0.6)",color:"#e6edf3",fontSize:"15px",lineHeight:"1"}),y.appendChild(g),r.disclosure){let I=document.createElement("div");I.textContent=`${r.disclosurePrefix??"360\xB0 panorama"} \xB7 ${r.disclosure}`,Object.assign(I.style,{position:"absolute",top:"calc(12px + var(--sl-3d-top-inset, 0px))",left:"12px",zIndex:"2",maxWidth:"calc(100% - 88px)",padding:"8px 11px",borderRadius:"999px",overflow:"hidden",color:"#dce6f8",background:"rgba(8,12,18,0.68)",font:"600 11px/1.2 ui-sans-serif, system-ui, sans-serif",textOverflow:"ellipsis",whiteSpace:"nowrap",pointerEvents:"none",backdropFilter:"blur(6px)"}),y.appendChild(I)}let v=document.createElement("div");v.textContent=Do(r.lookAroundHint),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"}),y.appendChild(v),e.appendChild(y),g.focus({preventScroll:!0});let C=!1,P=0,M=0,R=0,k=new Map,z=()=>{let[I,O]=[...k.values()];return I&&O?Math.hypot(I.x-O.x,I.y-O.y):0},V=I=>{let O=Fo(I);O!==s&&(s=O,n.camera.perspective({fov:s,aspect:n.camera.aspect}),h())},L=I=>{I.target!==g&&(k.set(I.pointerId,{x:I.clientX,y:I.clientY}),C=k.size===1,P=I.clientX,M=I.clientY,k.size===2&&(R=z()),y.setPointerCapture?.(I.pointerId),y.style.cursor="grabbing")},A=I=>{if(k.has(I.pointerId)){if(k.set(I.pointerId,{x:I.clientX,y:I.clientY}),k.size>=2){let O=z();R>0&&O>0&&V(s*(R/O)),R=O,C=!1;return}C&&(i+=(I.clientX-P)*rs,a=Math.max(-Le,Math.min(Le,a+(I.clientY-M)*rs)),P=I.clientX,M=I.clientY,h())}},_=I=>{k.delete(I.pointerId),R=k.size===2?z():0;let O=k.values().next().value;C=k.size===1,O?(P=O.x,M=O.y):y.style.cursor="grab";try{y.releasePointerCapture?.(I.pointerId)}catch{}},B=I=>{I.preventDefault(),V(s+I.deltaY*.04)};y.addEventListener("pointerdown",L),y.addEventListener("pointermove",A),y.addEventListener("pointerup",_),y.addEventListener("pointercancel",_),y.addEventListener("wheel",B,{passive:!1});let S=I=>{if(!c){if(I.key==="Tab"){I.preventDefault(),g.focus({preventScroll:!0});return}if(I.key==="Escape"){I.stopPropagation(),F.close();return}if(I.key==="ArrowLeft"||I.key==="ArrowRight")i+=I.key==="ArrowLeft"?-4:4;else if(I.key==="ArrowUp"||I.key==="ArrowDown")a=Math.max(-Le,Math.min(Le,a+(I.key==="ArrowUp"?4:-4)));else if(I.key==="+"||I.key==="="){V(s-5),I.preventDefault();return}else if(I.key==="-"){V(s+5),I.preventDefault();return}else return;I.preventDefault(),h()}};window.addEventListener("keydown",S);let E=0,T=(I,O)=>{if(!l){O?.();return}let j=I===1?0:1,H=performance.now(),N=()=>{if(c)return;let D=o<=0?1:Math.min(1,(performance.now()-H)/o);l?.setOpacity(j+(I-j)*D),n.requestRender(),D<1?E=requestAnimationFrame(N):O?.()};E=requestAnimationFrame(N)};T(1);let w=()=>{c||(c=!0,f(),u.abort(),r.signal?.removeEventListener("abort",d),cancelAnimationFrame(E),y.removeEventListener("pointerdown",L),y.removeEventListener("pointermove",A),y.removeEventListener("pointerup",_),y.removeEventListener("pointercancel",_),y.removeEventListener("wheel",B),window.removeEventListener("keydown",S),y.remove(),x?.isConnected&&x.focus({preventScroll:!0}),l?.dispose(),n.camera.position.set(m[0],m[1],m[2]),n.camera.perspective({fov:p,aspect:n.camera.aspect}),n.camera.quaternion.set(b[0],b[1],b[2],b[3]),n.requestRender())},F={close(){if(c)return;let I=()=>{w(),r.onClose?.()};cancelAnimationFrame(E),T(0,I)},dispose:w};return g.addEventListener("click",()=>F.close()),F}var rs,as=Rt(()=>{"use strict";os();Dn();Dn();ko();rs=.15});var ss={};zo(ss,{createOpenPanorama:()=>dd});function dd(e){let{container:t,model:n,opts:r,analytics:o,orbit:i,loop:a,seatsById:s,ensureSeatView:c,resolvedSeatViewPose:u,gpu:d,gl:f,isContextLost:m,isDisposed:l,flightGen:p,setPanorama:b,getLoadAbort:h,setLoadAbort:y,setPanoramaSphereVisible:x,setFrozen:g,raisePanoramaLayer:v,restorePanoramaLayer:C,getOverviewChip:P,labelOverlay:M,reducedMotion:R,removeArriveChip:k,showArriveChip:z}=e;return async(V,L,A)=>{h()?.abort();let _=new AbortController;y(_);let B=n.seats.idToIndex.get(V);if(B===void 0){i.syncFromCamera();return}let S=s.get(V)?.label??V,E=u(V,B),T=c(V);if(!T){_.abort(),h()===_&&y(null),i.syncFromCamera();return}g(!0),a.stop();let w;try{w=await T}catch{if(h()===_&&y(null),o.panoramaFailed(V,"source"),!l()&&A===p()){g(!1),i.resumeAfterFlight(E.focal),a.requestRender();let W=z(V,A,!0);requestAnimationFrame(()=>W?.querySelector("[data-panorama-trigger]")?.focus())}return}if(l()||A!==p()){_.abort(),h()===_&&y(null);return}k();let F=P(),I=()=>{_.abort(),h()===_&&y(null),b(null),x(!1),C(),F.style.display="",M.setVisible(!r.arriveAtSeatEye),g(!1),o.panoramaClosed(),i.resumeAfterFlight(E.focal),a.requestRender();let W=z(V,p());requestAnimationFrame(()=>W?.querySelector("[data-panorama-trigger]")?.focus())},O=w.generated===!0,j=Ja(w);v(),x(!O),F.style.display="none";let H=R()?0:L,N=d(),D=N&&!m()?await is(t,O?null:w,{gl:f,scene:N.main,camera:i.camera,requestRender:()=>a.requestRender(),cameraOriginWorld:O?E.eye:void 0,focalWorld:E.focal},{fadeMs:H,seatLabel:S,disclosure:j,disclosurePrefix:O?"Live seat-eye view":"360\xB0 panorama",lookAroundHint:r.lookAroundHint,onClose:I,signal:_.signal}):null;if(l()||A!==p()){_.abort(),x(!1),h()===_&&y(null),D?.dispose(),F.style.display="",C();return}if(D)i.syncFromCamera(),M.setVisible(!1),g(!1),a.requestRender(),b(D);else if(O){C(),F.style.display="",g(!1),i.resumeAfterFlight(E.focal),a.requestRender(),b(null),x(!1),o.panoramaFailed(V,"mount");let W=z(V,p(),!0);requestAnimationFrame(()=>W?.querySelector("[data-panorama-trigger]")?.focus()),h()===_&&y(null);return}else x(!1),o.panoramaFallback(V),b(es(t,w,{fadeMs:H,seatLabel:S,disclosure:j,onClose:I,signal:_.signal,lookAroundHint:r.lookAroundHint}));o.panoramaOpened()}}var cs=Rt(()=>{"use strict";Dn();as()});var Md={};zo(Md,{VENUE3D_QUALITY_REPORT_VERSION:()=>ia,buildSceneModel:()=>St,inspectVenue3DQualityEvidence:()=>wn,mountVenue3D:()=>Sd,prepareVenue3D:()=>Ss,prepareVenue3DFromChart:()=>Ms});module.exports=Os(Md);var Xo=require("ogl");var Vs=/^#?([\da-f]{3}|[\da-f]{6})$/i;function Bs(e){let t=Vs.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 ne(e){let t=Bs(e);return t?[t[0]/255,t[1]/255,t[2]/255]:null}function Hn(e){let t=e/255;return t<=.04045?t/12.92:((t+.055)/1.055)**2.4}function Ns(e){return .2126*Hn(e[0])+.7152*Hn(e[1])+.0722*Hn(e[2])}function Ho(e){return Ns([e[0]*255,e[1]*255,e[2]*255])}function Gs(e){return .2126*e[0]+.7152*e[1]+.0722*e[2]}function ge(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 Et(e,t){let n=Gs(e);return ge(e,[n,n,n],t)}var pe=["available","held","sold","selected","dimmed"];function It(e){let t=pe.indexOf(e);return t<0?0:t}var jo={available:[.24,.82,.52],held:[.95,.66,.22],sold:[.34,.39,.45],selected:[.24,.74,1],dimmed:[.28,.32,.37]};function Yo(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 jn={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]},Je={top:[.05,.06,.08],bottom:[.1,.12,.15]};function Pe(e,t){return[Math.min(1,e[0]*t),Math.min(1,e[1]*t),Math.min(1,e[2]*t)]}function zs(){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 Qt=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 Xo.Renderer({canvas:this.canvas,dpr:zs(),alpha:!1,antialias:!1,depth:!0,stencil:!1,powerPreference:"high-performance",webgl:2}),this.gl=this.renderer.gl,this.clearRgb=[Je.top[0],Je.top[1],Je.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 ft=require("ogl"),he=Math.PI/180,Yn=15*he,Xn=80*he,dt=.12,Wo=35,Ko=1.25,qo=.006,Us=4,pt=.82,Tt=1/pt,Hs=.12,js=2;function Ys(e,t){return{azimuth:e*qo,polar:-t*qo}}function Xs(e,t,n){let r=Math.max(js,Math.max(1,t)*Hs),o=n*Us;return{minDist:e?Math.min(e.minDist,r):r,maxDist:e?Math.max(e.maxDist,o):o}}var Zt=class{constructor(t,n,r,o){this.fovY=Wo;this.target=new ft.Vec3;this.azimuth=-30*he;this.polar=55*he;this.distance=10;this.azT=-30*he;this.polT=55*he;this.distT=10;this.minDist=1;this.maxDist=100;this.envelope=null;this.gestureFired=!1;this.interactionEnabled=!0;this.dragging=!1;this.panning=!1;this.lastX=0;this.lastY=0;this.activePointers=new Map;this.pinchDist=0;this.pinchCx=0;this.pinchCy=0;this.targetT=new ft.Vec3;this.panAnchor=new ft.Vec3;this.panLimit=0;this.primaryDragMode="orbit";this.camera=new ft.Camera(t,{fov:Wo,near:.1,far:5e3,aspect:1}),this.canvas=n,this.requestRender=r,this.onGesture=o,this.onPointerDown=i=>{if(this.interactionEnabled){try{this.canvas.setPointerCapture?.(i.pointerId)}catch{}if(this.activePointers.set(i.pointerId,{x:i.clientX,y:i.clientY}),this.activePointers.size===1){let a=i.button===2||i.button===1,s=i.button===0&&(i.shiftKey?this.primaryDragMode==="orbit":this.primaryDragMode==="pan");this.panning=a||s,this.dragging=!this.panning,this.lastX=i.clientX,this.lastY=i.clientY}else if(this.activePointers.size===2){this.dragging=!1,this.panning=!1,this.pinchDist=this.currentPinchDistance();let a=this.pinchCentroid();this.pinchCx=a.x,this.pinchCy=a.y}}},this.onPointerMove=i=>{if(!this.interactionEnabled||!this.activePointers.has(i.pointerId))return;if(this.activePointers.set(i.pointerId,{x:i.clientX,y:i.clientY}),this.activePointers.size>=2){let u=this.currentPinchDistance();this.pinchDist>0&&(this.dollyBy(Math.exp((this.pinchDist-u)*.005)),this.fireGesture()),this.pinchDist=u;let d=this.pinchCentroid();this.panBy(d.x-this.pinchCx,d.y-this.pinchCy),this.pinchCx=d.x,this.pinchCy=d.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}if(!this.dragging)return;this.lastX=i.clientX,this.lastY=i.clientY,(a!==0||s!==0)&&this.fireGesture();let c=Ys(a,s);this.azT+=c.azimuth,this.polT=Math.max(Yn,Math.min(Xn,this.polT+c.polar)),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*he;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(Yn,Math.min(Xn,this.polT+(i.key==="ArrowUp"?-a:a)));else if(i.key==="+"||i.key==="=")this.dollyBy(pt);else if(i.key==="-"||i.key==="_")this.dollyBy(Tt);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*he/2)/r,i=Math.sin(this.azimuth),a=Math.cos(this.azimuth),s=a,c=-i,u=Math.cos(this.polar),d=Math.sin(this.polar),f=-i*u,m=-a*u;this.targetT.x+=(-t*s+n*f)*o,this.targetT.z+=(-t*c+n*m)*o,this.targetT.y+=n*d*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())}dollyLimitState(){return{atMin:this.distT<=this.minDist+1e-6,atMax:this.distT>=this.maxDist-1e-6}}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*he/2,c=o?Math.max(.82,this.camera.aspect||1):this.camera.aspect||1,u=Math.atan(Math.tan(s)*c);this.azT=r??-30*he,this.polT=Math.max(15,Math.min(80,i?.polarDeg??55))*he;let d=this.fitDistance(t,s,u,this.azT,this.polT);this.distT=d*Math.max(1.05,Math.min(2,i?.margin??Ko)),this.envelope=Xs(this.envelope,a,d),this.minDist=this.envelope.minDist,this.maxDist=this.envelope.maxDist,n?(this.azimuth=this.azT,this.polar=12*he,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*he/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))*he;let c=this.fitDistance(t,i,s,this.azT,this.polT);this.distT=c*Math.max(1.05,Math.min(2,o?.margin??Ko))}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 u=Math.sin(i),d=-u*Math.sin(o),f=-Math.cos(i),m=-u*Math.cos(o);if(Math.abs(f)>.999)return s;let l=-m,p=d,b=Math.hypot(l,p);l/=b,p/=b;let h=-p*f,y=p*d-l*m,x=l*f,g=Math.tan(r),v=Math.tan(n),C=1;for(let P=0;P<8;P++){let M=(P&1?c.max[0]:c.min[0])-t.center[0],R=(P&2?c.max[1]:c.min[1])-t.center[1],k=(P&4?c.max[2]:c.min[2])-t.center[2],z=M*d+R*f+k*m,V=Math.abs(M*l+k*p),L=Math.abs(M*h+R*y+k*x);C=Math.max(C,V/g-z,L/v-z)}return Math.min(s,Math.max(C,a*.35))}updateClipping(t){let n=this.camera.position.x-t.center[0],r=this.camera.position.y-t.center[1],o=this.camera.position.z-t.center[2],i=Math.hypot(n,r,o),a=Math.max(1,t.radius)*1.18,s=Math.max(.05,i-a),c=Math.max(s+10,i+a);this.camera.perspective({near:s,far:c,aspect:this.camera.aspect})}update(){let t=this.azT-this.azimuth,n=this.polT-this.polar,r=this.distT-this.distance,o=this.targetT.x-this.target.x,i=this.targetT.y-this.target.y,a=this.targetT.z-this.target.z,s=Math.max(1e-4,this.distance*1e-4),c=Math.abs(t)>1e-4||Math.abs(n)>1e-4||Math.abs(r)>1e-4||Math.abs(o)>s||Math.abs(i)>s||Math.abs(a)>s;return this.azimuth+=t*dt,this.polar+=n*dt,this.distance+=r*dt,this.target.x+=o*dt,this.target.y+=i*dt,this.target.z+=a*dt,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(Yn,Math.min(Xn,Math.acos(Math.max(-1,Math.min(1,n/o)))));this.distance=this.distT=o,this.polar=this.polT=i,this.azimuth=this.azT=Math.atan2(t,r)}setTarget(t){this.target.set(t[0],t[1],t[2]),this.targetT.copy(this.target)}resumeAfterFlight(t){this.camera.perspective({fov:this.fovY,aspect:this.camera.aspect}),t&&this.target.set(t[0],t[1],t[2]),this.targetT.copy(this.target),this.syncFromCamera()}applyPosition(){let t=Math.sin(this.polar),n=this.target.x+this.distance*t*Math.sin(this.azimuth),r=this.target.y+this.distance*Math.cos(this.polar),o=this.target.z+this.distance*t*Math.cos(this.azimuth);this.camera.position.set(n,r,o),this.camera.lookAt(this.target)}dispose(){this.canvas.removeEventListener("pointerdown",this.onPointerDown),this.canvas.removeEventListener("pointermove",this.onPointerMove),this.canvas.removeEventListener("pointerup",this.onPointerUp),this.canvas.removeEventListener("pointercancel",this.onPointerUp),this.canvas.removeEventListener("wheel",this.onWheel),this.canvas.removeEventListener("keydown",this.onKeyDown),this.canvas.removeEventListener("contextmenu",this.onContextMenu),this.activePointers.clear()}};var Jt=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}};function $o(e,t,n){return Math.max(t,Math.min(n,e))}var ht=2.5,Ws=1.15,_t=6,bt=10,Qo=6,Zo=9.5,Jo=.9,er=2.2,Wn=30,Kn=4,en=8192;var Ld=bt+Kn;function tr(e,t){let n=t*1.4,r=t*3.2;if(e<=n)return{scale:1,fade:0,minPixels:ht};let o=Math.min(1,(e-n)/Math.max(.001,r-n));return{scale:1-o*.4,fade:o*.55,minPixels:ht+o*(Ws-ht)}}function nr(e,t,n){return!(e>0)||!(t>0)||!(n>0)?!1:t*n/e>=64}function or(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 Ks=[{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"}],Fd=new Map(Ks.map(e=>[e.key,e]));var qs={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 rr(e){let t=e?.[0];return t&&qs[t]||"#3b82f6"}var $s=[{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"}],Dd=new Map($s.map(e=>[e.key,e]));var Qs=["reference-focal","bar","entrance","exit","restroom","screen","sound","concession","coat","wall","rail","suite","obstruction"],Od=new Set(Qs);var ar=[{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}}],sr=ar.map(e=>e.key),Zs=new Map(ar.map(e=>[e.key,e]));function ir(e){return typeof e=="string"&&Zs.has(e)}function cr(e,t){return ir(e)?e:ir(t?.seatGlyph)?t.seatGlyph:"circle"}var be=.02291666666666667,He=1/be,Js=58,ec=Js*be;var tc=3,lr=0,qn=120,nc=0,oc=45,rc=7,Ie=1.2;function $n(e,t,n,r){return Number.isFinite(e)?Math.max(t,Math.min(n,e)):r}function ic(e){return!Number.isFinite(e)||!Number.isInteger(e)||e<0?0:e<=rc?e:tc}function tn(e,t={}){let n=$n(t.floorBaseHeightM,lr,qn,0),r=Math.min(qn,n+ic(e.elevation)*ec),o=e.height===void 0?r:$n(e.height,lr,qn,r),i=$n(e.rake,nc,oc,0);return{height:o,rake:i}}var mr=mt(require("earcut"),1),dr=mt(require("polygon-clipping"),1);var Ud=Math.PI/180;function Qn(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 Lt(e){return e.length?Qn(e):null}function et(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 kt(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 G=be,ac=.002;function sc(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<ac}var tt=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)}},rn=class{constructor(){this.pos=new tt;this.nor=new tt;this.col=new tt;this.flr=new tt;this.mat=new tt;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){sc(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,u=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(u[0],u[1],u[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 cc(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],u=o*c-i*s,d=i*a-r*c,f=r*s-o*a,m=Math.hypot(u,d,f)||1;return u/=m,d/=m,f/=m,[u,d,f]}function lc(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,mr.default)(r,o.length?o:void 0,2);return{pts:n,tris:i}}function Zn(e){return et(e)<0?[...e].reverse():e}var uc=3;function mc(e,t,n,r){let o=r(e),i=r(t),a=r(n),s=(l,p,b,h)=>Math.abs(r({x:(l.x+p.x)/2,y:(l.y+p.y)/2})-(b+h)/2),c=(e.x+t.x+n.x)/3,u=(e.y+t.y+n.y)/3,d=(o+i+a)/3,f=Math.max(s(e,t,o,i),s(t,n,i,a),s(n,e,a,o),Math.abs(r({x:c,y:u})-d)),m=(l,p,b)=>{let h=Math.abs(r({x:(l+c)/2,y:(p+u)/2})-(b+d)/2);h>f&&(f=h)};return m((e.x+t.x)/2,(e.y+t.y)/2,(o+i)/2),m((t.x+n.x)/2,(t.y+n.y)/2,(i+a)/2),m((n.x+e.x)/2,(n.y+e.y)/2,(a+o)/2),f}function Ft(e,t,n,r,o){if(o<=0)return mc(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(Ft(e,i,s,r,o-1),Ft(i,t,a,r,o-1),Ft(s,a,n,r,o-1),Ft(i,a,s,r,o-1))}function Dt(e,t,n,r,o,i,a,s){if(a>0){let m={x:(t.x+n.x)/2,y:(t.y+n.y)/2},l={x:(n.x+r.x)/2,y:(n.y+r.y)/2},p={x:(r.x+t.x)/2,y:(r.y+t.y)/2};Dt(e,t,m,p,o,i,a-1,s),Dt(e,m,n,l,o,i,a-1,s),Dt(e,p,l,r,o,i,a-1,s),Dt(e,m,l,p,o,i,a-1,s);return}let c=[t.x*G,o(t),t.y*G],u=[n.x*G,o(n),n.y*G],d=[r.x*G,o(r),r.y*G];if(s){e.triN(c,u,d,s(t),s(n),s(r),i);return}let f=cc(c,u,d);f[1]<0&&(f=[-f[0],-f[1],-f[2]]),e.tri(c,u,d,f,i)}var dc=8;function ur(e,t,n){if(!Number.isFinite(n))return e;let r=[],o=(i,a,s,c,u)=>{if(u>0){let d={x:(i.x+a.x)/2,y:(i.y+a.y)/2},f=t(d);if(Math.abs(f-(s+c)/2)>n){o(i,d,s,f,u-1),o(d,a,f,c,u-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),dc)}return r}function nn(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,u=s.y-i.y,d=Math.hypot(c,u);d>t&&Math.abs((a.x-i.x)*u-(a.y-i.y)*c)/d<t||r.push(a)}return r.length>=3?r:n}var on=.001*He*.1;function ue(e,t,n,r,o,i,a,s,c=1/0,u){if(!t||t.length<3||(c===void 0&&(c=1/0),Math.abs(et(t))<1e-4))return;let d=nn(ur(nn(Zn(t),on),r,c),on),f=n?.map(P=>nn(ur(nn(Zn(P),on),r,c),on)).filter(P=>P.length>=3&&Math.abs(et(P))>=1e-4),{pts:m,tris:l}=lc(d,f),p=[i[0]*s.top,i[1]*s.top,i[2]*s.top],b=[i[0]*s.bottomCap,i[1]*s.bottomCap,i[2]*s.bottomCap],h=[a[0]*s.top,a[1]*s.top,a[2]*s.top],y=[a[0]*s.wallBottom,a[1]*s.wallBottom,a[2]*s.wallBottom],x=0;if(Number.isFinite(c))for(;x<uc;x++){let P=0;for(let M=0;M<l.length;M+=3){let R=Ft(m[l[M]],m[l[M+1]],m[l[M+2]],r,x);R>P&&(P=R)}if(P<=c)break}for(let P=0;P<l.length;P+=3){let M=m[l[P]],R=m[l[P+1]],k=m[l[P+2]];Dt(e,M,R,k,r,p,x,u);let z=[M.x*G,o,M.y*G],V=[R.x*G,o,R.y*G],L=[k.x*G,o,k.y*G];e.tri(z,L,V,[0,-1,0],b)}let g=P=>{if(x<=0)return P;let M=1<<x,R=[];for(let k=0;k<P.length;k++){let z=P[k],V=P[(k+1)%P.length];for(let L=0;L<M;L++){let A=L/M;R.push({x:z.x+(V.x-z.x)*A,y:z.y+(V.y-z.y)*A})}}return R},v=Qn(d),C=[{ring:g(d),flip:!1}];if(f)for(let P of f)P.length>=3&&C.push({ring:g(P),flip:!0});for(let{ring:P,flip:M}of C)for(let R=0;R<P.length;R++){let k=P[R],z=P[(R+1)%P.length],V=(z.x-k.x)*G,A=(z.y-k.y)*G,_=-V,B=Math.hypot(A,_)||1;A/=B,_/=B;let S=(k.x+z.x)/2-v.x,E=(k.y+z.y)/2-v.y,T=A*S+_*E;M&&(T=-T),T<0&&(A=-A,_=-_);let w=[A,0,_],F=[k.x*G,r(k),k.y*G],I=[z.x*G,r(z),z.y*G],O=[k.x*G,o,k.y*G],j=[z.x*G,o,z.y*G];e.tri(F,I,j,w,h,h,y),e.tri(F,j,O,w,h,y,y)}}function fr(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 an(e,t,n=2.5){if(t<=0||e.length<3)return e;let r=Zn(e),o=r.length,i=[];for(let s=0;s<o;s++){let c=r[s],u=r[(s+1)%o],d=u.x-c.x,f=u.y-c.y,m=Math.hypot(d,f)||1;i.push({x:f/m,y:-d/m})}let a=[];for(let s=0;s<o;s++){let c=r[s],u=i[(s-1+o)%o],d=i[s],f=u.x+d.x,m=u.y+d.y,l=Math.hypot(f,m),p=()=>{a.push([c.x+u.x*t,c.y+u.y*t]),a.push([c.x+d.x*t,c.y+d.y*t])};if(l<1e-9){p();continue}f/=l,m/=l;let b=f*u.x+m*u.y,h=1/Math.max(b,1e-6);if(!Number.isFinite(h)||h>n){p();continue}a.push([c.x+f*t*h,c.y+m*t*h])}if(a.length<3)return e;try{let s=dr.default.union([[...a,a[0]]]),c=null,u=-1/0;for(let f of s){let m=Math.abs(et(f[0].map(([l,p])=>({x:l,y:p}))));m>u&&(u=m,c=f[0])}if(!c)return e;let d=c.map(([f,m])=>({x:f,y:m}));if(d.length>1){let f=d[0],m=d[d.length-1];Math.abs(f.x-m.x)<1e-9&&Math.abs(f.y-m.y)<1e-9&&d.pop()}return d.length>=3?d:e}catch{return e}}function sn(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 Ot(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 ae={pedestal:0,pad:1,back:2,arm:3,footrest:4,leg:5,body:10,head:11},fc=.44,pc=.15,pr=.3,hc=.24;function hr(e){return e===void 0||!Number.isFinite(e)||e<=0?hc:Math.min(pr,Math.max(pc,e*fc))}var Jn=.21,bc=.05,eo=.45,cn=eo+bc,br=.92,to=1.205,yr=-.23,gr=.38,yc=[{part:ae.pedestal,min:[-.3,0,-.3],max:[.3,.36,.3]},{part:ae.pad,min:[-1,.36,-.95],max:[1,eo,1]},{part:ae.back,min:[-1,cn,-1],max:[1,br,-.72]},{part:ae.arm,min:[-1,.44,-.82],max:[-.78,.65,.78]},{part:ae.arm,min:[.78,.44,-.82],max:[1,.65,.78]},{part:ae.footrest,min:[-.9,.18,.78],max:[.9,.31,1.34]},{part:ae.leg,min:[-.82,0,-.7],max:[-.62,.37,-.48]},{part:ae.leg,min:[.62,0,-.7],max:[.82,.37,-.48]},{part:ae.leg,min:[-.82,0,.48],max:[-.62,.37,.7]},{part:ae.leg,min:[.62,0,.48],max:[.82,.37,.7]}],gc=[{part:ae.body,min:[-.52,.39,-.08],max:[-.08,.55,.82]},{part:ae.body,min:[.08,.39,-.08],max:[.52,.55,.82]},{part:ae.body,min:[-.47,.05,.58],max:[-.13,.43,.82]},{part:ae.body,min:[.13,.05,.58],max:[.47,.43,.82]},{part:ae.head,min:[-.16,1.04,-.33],max:[.16,1.1,-.13]}],xc=[{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 xr(){let e=[],t=[],n=[],r=[],o=(B,S,E)=>{let T=n.length,[w,F,I]=B,O=[F[0]-w[0],F[1]-w[1],F[2]-w[2]],j=[I[0]-w[0],I[1]-w[1],I[2]-w[2]],H=O[1]*j[2]-O[2]*j[1],N=O[2]*j[0]-O[0]*j[2],D=O[0]*j[1]-O[1]*j[0],W=Math.hypot(H,N,D);W>1e-9?(H/=W,N/=W,D/=W):[H,N,D]=S,H*S[0]+N*S[1]+D*S[2]<0&&(H=-H,N=-N,D=-D);for(let X of B)e.push(...X),t.push(H,N,D),n.push(E);r.push(T,T+1,T+2,T,T+2,T+3)},i=B=>{for(let S of xc){let E=S.c.map(T=>T.map((w,F)=>w?B.max[F]:B.min[F]));o(E,S.n,B.part)}};for(let B of yc)i(B);for(let B of gc)i(B);let a=eo,s=1.08,c=.47,u=.69,d=-.55,f=.08,m=-.48,l=.01,p=[-c,a,d],b=[c,a,d],h=[-c,a,f],y=[c,a,f],x=[-u,s,m],g=[u,s,m],v=[-u,s,l],C=[u,s,l];o([b,g,C,y],[1,0,0],ae.body),o([h,v,x,p],[-1,0,0],ae.body),o([v,C,g,x],[0,1,0],ae.body),o([p,b,y,h],[0,-1,0],ae.body),o([y,C,v,h],[0,0,1],ae.body),o([p,x,g,b],[0,0,-1],ae.body);let P=10,M=8,R=[0,to,yr],k=[.42,.115,gr],z=n.length;for(let B=0;B<=M;B++){let S=Math.PI*B/M,E=Math.cos(S),T=Math.sin(S);for(let w=0;w<=P;w++){let F=Math.PI*2*w/P,I=T*Math.cos(F),O=T*Math.sin(F);e.push(R[0]+k[0]*I,R[1]+k[1]*E,R[2]+k[2]*O);let j=I/k[0],H=E/k[1],N=O/k[2],D=Math.hypot(j,H,N)||1;j/=D,H/=D,N/=D,t.push(j,H,N),n.push(ae.head)}}for(let B=0;B<M;B++)for(let S=0;S<P;S++){let E=z+B*(P+1)+S,T=E+P+1;r.push(E,T,E+1,E+1,T,T+1)}let V=new Float32Array(e),L=new Float32Array(t),A=new Float32Array(n),_=new Uint16Array(r);return{position:V,normal:L,part:A,index:_,vertexCount:n.length,indexCount:r.length}}function vr(e,t,n,r){let o=new Float32Array(t),i=u=>e[u*3],a=u=>e[u*3+2],s=0,c=(u,d)=>{let f=d-u;for(let m=u;m<d;m++){let[l,p]=r(m),b=l-i(m),h=p-a(m);if(f>=2){let y=Math.max(u,m-1),x=Math.min(d-1,m+1),g=i(x)-i(y),v=a(x)-a(y),C=Math.hypot(g,v);if(C>1e-6){let P=-v/C,M=g/C;P*b+M*h<0&&(P=-P,M=-M),b=P,h=M}}o[m]=b===0&&h===0?0:Math.atan2(b,h)}};for(let u=1;u<=t;u++)(u===t||n(u)!==n(s))&&(c(s,u),s=u);return o}var De=.22;function Sr(e,t){let n=pe[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 vc=.42;function Sc(e){let t=e.length,n=new Float64Array(t);if(t<2)return n.fill(1/0),n;let r=1/0,o=1/0,i=-1/0,a=-1/0;for(let p of e)p.x<r&&(r=p.x),p.y<o&&(o=p.y),p.x>i&&(i=p.x),p.y>a&&(a=p.y);let s=Math.max(i-r,1e-6),c=Math.max(a-o,1e-6),u=Math.max(Math.sqrt(s*c/t),1e-6),d=Math.max(1,Math.ceil(s/u)+1),f=Math.max(1,Math.ceil(c/u)+1),m=new Map,l=(p,b)=>{let h=Math.min(d-1,Math.max(0,Math.floor((p-r)/u)));return Math.min(f-1,Math.max(0,Math.floor((b-o)/u)))*d+h};for(let p=0;p<t;p++){let b=l(e[p].x,e[p].y),h=m.get(b);h?h.push(p):m.set(b,[p])}for(let p=0;p<t;p++){let b=e[p],h=Math.min(d-1,Math.max(0,Math.floor((b.x-r)/u))),y=Math.min(f-1,Math.max(0,Math.floor((b.y-o)/u))),x=1/0;for(let g=1;g<=4;g++){for(let v=y-g;v<=y+g;v++)if(!(v<0||v>=f))for(let C=h-g;C<=h+g;C++){if(C<0||C>=d||g>1&&Math.abs(v-y)<g&&Math.abs(C-h)<g)continue;let P=m.get(v*d+C);if(P)for(let M of P){if(M===p)continue;let R=Math.hypot(e[M].x-b.x,e[M].y-b.y);R<x&&(x=R)}}if(Number.isFinite(x)&&x<=g*u)break}n[p]=x}return n}function Mc(e){let t=e.eyeHeightM;return Number.isFinite(t)?Math.max(0,t-Ie):0}function Mr(e,t,n,r,o,i){let a=e.length,s=new Float32Array(a*3),c=new Float32Array(a),u=new Float32Array(a*3),d=new Float32Array(a),f=new Float32Array(a),m=new Float32Array(a),l=new Float32Array(a),p=new Float32Array(a*3),b=new Map,h=Sc(e);for(let y=0;y<a;y++){let x=e[y],v=(n?.seatPitchU(y)??h[y])*G;d[y]=Number.isFinite(v)?Math.max(.06,Math.min(De,v*vc)):De,f[y]=hr(Number.isFinite(v)?v:void 0);let C=cr(x.glyph,{seatGlyph:i?.get(x.categoryKey)});m[y]=sr.indexOf(C),l[y]=x.wheelchairSpaceType==="no-seat"?0:1,s[y*3]=x.x*G,s[y*3+1]=n?n.seatDeckY(y):Mc(x),s[y*3+2]=x.y*G,c[y]=It(t?t(x):"available");let P=ne(o?.get(x.categoryKey)??"#6e7bff")??[.43,.48,1];if(u[y*3]=P[0],u[y*3+1]=P[1],u[y*3+2]=P[2],x.accessibility?.length){let M=ne(rr(x.accessibility));M&&(p[y*3]=M[0],p[y*3+1]=M[1],p[y*3+2]=M[2])}b.set(x.id,y)}return{count:a,iPosition:s,iState:c,iCategory:u,iMaxRadius:d,iRing:p,idToIndex:b,iChairWidth:f,iGlyph:m,iPhysicalSeat:l,iFloor:r??new Float32Array(a),iYaw:new Float32Array(a)}}var wc=64;function no(e,t){let n=[];for(let a of t){let s=e.idToIndex.get(a.seatId);if(s===void 0)continue;let c=It(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+wc){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 Pc=.15,Cc=1.6;function wr(e){return $o(e??1,Pc,Cc)}var Ac=.15,Rc=.9,Ec=1.76;function Ic(){return{background:{top:[...Je.top],bottom:[...Je.bottom]},structure:jn,seatStates:{...jo},seatScale:1,materials:{seat:null,shell:null,roughness:.78}}}function Pr(e){let t=Ic();if(!e)return t;let n=ne(e.background);if(n){t.background={top:Pe(n,Rc),bottom:Pe(n,Ec)};let a={};for(let[s,c]of Object.entries(jn))a[s]=ge(c,n,Ac);t.structure=a}let r=ne(e.selectionColor)??ne(e.accent);r&&(t.seatStates={...t.seatStates,selected:r});let o=e.seatScale;typeof o=="number"&&Number.isFinite(o)&&(t.seatScale=wr(o));let i=e.venue3d;if(i){let a=ne(i.deck),s=ne(i.fascia);a&&(t.structure={...t.structure,tierTop:a,gaTop:a}),s&&(t.structure={...t.structure,tierWall:s,gaWall:s}),t.materials.seat=ne(i.seat),t.materials.shell=ne(i.shell),typeof i.roughness=="number"&&Number.isFinite(i.roughness)&&(t.materials.roughness=Math.min(1,Math.max(0,i.roughness)))}return t}function Cr(e,t){let n=[];for(let r of t)n.push(...e.seatStates[r]);return n}function Ar(e,t){let n=1-t,r=n*n*n,o=3*n*n*t,i=3*n*t*t,a=t*t*t;return{x:r*e.start.x+o*e.control1.x+i*e.control2.x+a*e.end.x,y:r*e.start.y+o*e.control1.y+i*e.control2.y+a*e.end.y}}function Rr(e,t,n=192){if(!Number.isInteger(t)||t<1)throw new Error("Path point count must be a positive integer");if(t===1)return[Ar(e,.5)];let r=Array.from({length:n+1},(c,u)=>Ar(e,u/n)),o=new Float64Array(r.length);for(let c=1;c<r.length;c+=1){let u=r[c].x-r[c-1].x,d=r[c].y-r[c-1].y;o[c]=o[c-1]+Math.hypot(u,d)}let i=o[o.length-1];if(i<=1e-9)return Array.from({length:t},()=>({...e.start}));let a=[],s=1;for(let c=0;c<t;c+=1){let u=i*c/(t-1);for(;s<o.length-1&&o[s]<u;)s+=1;let d=o[s-1],f=o[s],m=f===d?0:(u-d)/(f-d);a.push({x:r[s-1].x+(r[s].x-r[s-1].x)*m,y:r[s-1].y+(r[s].y-r[s-1].y)*m})}return a}function Er(e){let t=new Map,n=new Map;for(let r of e){if(r.type!=="row"||!r.segmentedRow)continue;let o=n.get(r.segmentedRow.groupId)??[];o.push(r),n.set(r.segmentedRow.groupId,o)}for(let[r,o]of n){let i=o.slice().sort((m,l)=>m.segmentedRow.componentIndex-l.segmentedRow.componentIndex),a=i[0]?.segmentedRow?.componentCount??0,s=i[0]?.segmentedRow;if(!s||!(a>=2&&i.length===a&&s?.boundaryBefore==="start"&&i.every((m,l)=>m.segmentedRow?.kind==="segmented-row-v1"&&m.segmentedRow.groupId===r&&m.segmentedRow.componentCount===a&&m.segmentedRow.componentIndex===l&&m.segmentedRow.repeatLabelOnComponents===s.repeatLabelOnComponents&&(l===0?m.segmentedRow.boundaryBefore==="start":m.segmentedRow.boundaryBefore!=="start")&&m.segmentedRow.displayLabel===s.displayLabel)))continue;let u=i.reduce((m,l)=>m+l.seatCount,0),d=0,f=0;for(let m of i)m.segmentedRow.boundaryBefore==="break"&&(d+=1),t.set(m.id,{groupId:r,adjacencyOffset:d,displayOffset:f,displayLabel:s.displayLabel,totalSeats:u,canonical:i[0],viewFromSeatUrl:s.viewFromSeatUrl,viewFromSeatMeta:s.viewFromSeatMeta,confidenceEvidence:s.confidenceEvidence}),d+=m.seatCount,f+=m.seatCount}return t}var Tc="ABCDEFGHIJKLMNOPQRSTUVWXYZ";var _c="abcdefghijklmnopqrstuvwxyz";function Lc(e,t){let n=t.length,r=e+1,o="";for(;r>0;){r-=1;let i=r%n;o=t[i]+o,r=Math.floor(r/n)}return o}function oo(e,t=!1){let n=t?_c:Tc;return Lc(Math.max(0,Math.floor(e)-1),n)}var kc=[[1e3,"M"],[900,"CM"],[500,"D"],[400,"CD"],[100,"C"],[90,"XC"],[50,"L"],[40,"XL"],[10,"X"],[9,"IX"],[5,"V"],[4,"IV"],[1,"I"]];function Ir(e){if(!Number.isFinite(e)||e<=0)return String(e);let t=Math.floor(e),n="";for(let[r,o]of kc)for(;t>=r;)n+=o,t-=r;return n}function Fc(e){let t=new Array(e);return Array.from({length:e},(n,r)=>r).sort((n,r)=>Math.abs(2*n-(e-1))-Math.abs(2*r-(e-1))||n-r).forEach((n,r)=>t[n]=r),t}function ln(e,t){let n=e.seatLabelStart??1,r=e.seatNumbering?.direction??"ltr",o=e.seatNumbering?.step??1,i=e.seatNumbering?.scheme??"decimal",a=e.seatNumbering?.prefix??"",s=e.seatNumbering?.endAt,c=e.seatCount;if(i==="updown"||i==="updown-descending"){let l=Math.ceil(c/2),p=i==="updown"?t<l?n+2*t:n-1+2*(c-t):t<l?n+2*(l-1-t):n+1+2*(t-l);return`${a}${p}`}let u=i==="odd"||i==="even"?2:o,d=s!=null&&Number.isFinite(s)?s-(c-1)*u:n,f=r==="center"?Fc(c)[t]:r==="rtl"?c-1-t:t,m;switch(i){case"odd":{let l=d%2===1?d:d+1;m=String(l+f*2);break}case"even":{let l=d%2===0?d:d+1;m=String(l+f*2);break}case"roman":m=Ir(d+f*o);break;case"letters-upper":m=oo(d+f*o,!1);break;case"letters-lower":m=oo(d+f*o,!0);break;default:m=String(d+f*o);break}return`${a}${m}`}function Dc(e){return{...e.canonical,seatCount:e.totalSeats,label:e.displayLabel,displayLabel:e.displayLabel}}function Tr(e,t,n){return n?.label??`${e.seatLabelBase??e.label}-${ln(e,t)}`}function ro(e,t,n,r){if(r?.displayLabel)return r.displayLabel;if(e.seatDisplayLabelMode==="number")return ln(e,t);if(!n)return`${e.displayLabel||e.label}-${ln(e,t)}`;let o=Dc(n),i=n.displayOffset+t;return`${n.displayLabel}-${ln(o,i)}`}function _r(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 yt(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,u=s*s+c*c,d=u>1e-12?((t-i.x)*s+(n-i.y)*c)/u:0;d<0?d=0:d>1&&(d=1);let f=Math.hypot(t-(i.x+d*s),n-(i.y+d*c));f<r&&(r=f)}return r}function Oc(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 Lr(e,t){return Math.hypot(e.cx-t.cx,e.cy-t.cy)-e.r-t.r}function io(e,t){let n=1/0;for(let r of _r(e)){let o=yt(t,r.x,r.y);o<n&&(n=o)}for(let r of _r(t)){let o=yt(e,r.x,r.y);o<n&&(n=o)}return n}function Vc(e,t){if(e.length<3)return{pts:e,seatIndices:t};let n=0,r=0;for(let d of e)n+=d.x,r+=d.y;n/=e.length,r/=e.length;let o=-1,i=e[0];for(let d of e){let f=Math.hypot(d.x-n,d.y-r);f>o&&(o=f,i=d)}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 u=e.map((d,f)=>({p:d,i:f,t:(d.x-n)*a+(d.y-r)*s})).sort((d,f)=>d.t-f.t);return{pts:u.map(d=>d.p),seatIndices:u.map(d=>t[d.i])}}function ao(e){let t=e.length;if(t<3)return null;let n=0,r=0;for(let x of e)n+=x.x,r+=x.y;n/=t,r/=t;let o=0,i=0,a=0,s=0,c=0,u=0,d=0;for(let x of e){let g=x.x-n,v=x.y-r;o+=g*g,a+=v*v,i+=g*v,s+=g*g*g,c+=v*v*v,u+=g*v*v,d+=v*g*g}let f=o*a-i*i;if(Math.abs(f)<1e-9)return null;let m=(s+u)/2,l=(c+d)/2,p=(m*a-l*i)/f,b=(l*o-m*i)/f,h=p+n,y=b+r;return!Number.isFinite(h)||!Number.isFinite(y)?null:{cx:h,cy:y}}var Bc=.15;function Nc(e){if(e.length<2)return null;let t=e.map(x=>{let g=0,v=0;for(let C of x.pts)g+=C.x,v+=C.y;return{x:g/x.pts.length,y:v/x.pts.length}}),n=0,r=0;for(let x of t)n+=x.x,r+=x.y;n/=t.length,r/=t.length;let o=0,i=0,a=0;for(let x of t){let g=x.x-n,v=x.y-r;o+=g*g,i+=g*v,a+=v*v}let s=o+a,c=o*a-i*i,u=s/2+Math.sqrt(Math.max(0,s*s/4-c)),d,f;Math.abs(i)>1e-12?(d=u-a,f=i):o>=a?(d=1,f=0):(d=0,f=1);let m=Math.hypot(d,f);if(!(m>1e-12))return null;d/=m,f/=m;let l=1/0,p=-1/0,b=[];for(let x of e){let g=1/0,v=-1/0;for(let C of x.pts){let P=C.x*d+C.y*f;P<g&&(g=P),P>v&&(v=P),P<l&&(l=P),P>p&&(p=P)}b.push(v-g)}let h=p-l;return h>1e-9?(b.sort((x,g)=>x-g),b[Math.min(b.length-1,Math.floor(b.length*.9))]/h<=Gc?{x:d,y:f}:null):null}var Gc=.35;function un(e,t,n,r){let o=new Map;for(let h of n){let y=t[h],x=y.rowId||`__seat-${h}`,g=o.get(x);g||(g={pts:[],idx:[]},o.set(x,g)),g.pts.push({x:y.x,y:y.y}),g.idx.push(h)}if(!o.size)return{sectionId:e,rows:[],blockCount:0};let i=[];for(let[h,y]of o){let x=Vc(y.pts,y.idx),g=0;for(let v of x.pts)g+=Math.hypot(v.x-r.x,v.y-r.y);i.push({id:h,pts:x.pts,seatIndices:x.seatIndices,blockId:-1,ordinal:0,blockDepth:0,focalDistance:g/x.pts.length})}let a=i.map(h=>Oc(h.pts)),s=[];for(let h=0;h<i.length;h++){let y=1/0;for(let x=0;x<i.length;x++){if(h===x||Lr(a[h],a[x])>=y)continue;let g=io(i[h].pts,i[x].pts);g<y&&(y=g)}Number.isFinite(y)&&s.push(y)}s.sort((h,y)=>h-y);let c=s.length?s[Math.floor(s.length/2)]:1,u=Math.max(c*1.8,1e-6),d=i.map(()=>[]);for(let h=0;h<i.length;h++)for(let y=h+1;y<i.length;y++)Lr(a[h],a[y])>u||io(i[h].pts,i[y].pts)<=u&&(d[h].push(y),d[y].push(h));let f=0;for(let h=0;h<i.length;h++){if(i[h].blockId!==-1)continue;let y=f++,x=[h];for(i[h].blockId=y;x.length;){let g=x.pop();for(let v of d[g])i[v].blockId===-1&&(i[v].blockId=y,x.push(v))}}let m=new Map;for(let h of i){let y=m.get(h.blockId)??[];y.push(h),m.set(h.blockId,y)}let l=[];for(let h of i){if(h.pts.length<4)continue;let y=ao(h.pts);y&&(!Number.isFinite(y.cx)||!Number.isFinite(y.cy)||l.push({x:y.cx,y:y.cy}))}let p=l.length>=2?(()=>{let h=l.map(g=>g.x).sort((g,v)=>g-v),y=l.map(g=>g.y).sort((g,v)=>g-v),x=Math.floor(l.length/2);return{cx:h[x],cy:y[x]}})():null;if(p){let h=P=>Math.hypot(P.x-p.cx,P.y-p.cy),y=1/0,x=-1/0,g=[];for(let P of i){let M=1/0,R=-1/0;for(let k of P.pts){let z=h(k);z<M&&(M=z),z>R&&(R=z)}g.push(R-M),M<y&&(y=M),R>x&&(x=R)}let v=x-y;g.sort((P,M)=>P-M);let C=g[Math.min(g.length-1,Math.floor(g.length*.9))];if(v>1e-9&&C/v<=Bc){let P=i.map(S=>{let E=0;for(let T of S.pts)E+=h(T);return{row:S,radius:E/S.pts.length}}),M=0,R=0;for(let S of P)M+=S.radius,R+=S.row.focalDistance;M/=P.length,R/=P.length;let k=0;for(let S of P)k+=(S.radius-M)*(S.row.focalDistance-R);if(k<0)for(let S of P)S.radius=-S.radius;let V=1/0;for(let S of P)S.radius<V&&(V=S.radius);P.sort((S,E)=>S.radius-E.radius);let L=-1,A=-1/0,_=v/Math.max(1,P.length)*.5,B=[];for(let S of P)S.radius-A>_&&(L++,A=S.radius),S.row.ordinal=L,S.row.blockDepth=S.radius-V,B.push(S.row);return{sectionId:e,rows:B,blockCount:f}}}let b=[];for(let[,h]of m){let y=Nc(h);if(y){let x=v=>{let C=0;for(let P of v.pts)C+=P.x*y.x+P.y*y.y;return C/v.pts.length};h.sort((v,C)=>x(v)-x(C)),h.length>=2&&h[0].focalDistance>h[h.length-1].focalDistance&&h.reverse();let g=0;for(let v=0;v<h.length;v++)v>0&&(g+=io(h[v-1].pts,h[v].pts)),h[v].ordinal=v,h[v].blockDepth=g,b.push(h[v])}else{let x=1/0;for(let g of h)g.focalDistance<x&&(x=g.focalDistance);h.sort((g,v)=>g.focalDistance-v.focalDistance);for(let g=0;g<h.length;g++)h[g].ordinal=g,h[g].blockDepth=Math.max(0,h[g].focalDistance-x),b.push(h[g])}}return{sectionId:e,rows:b,blockCount:f}}var zc=/^\d{4}-\d{2}-\d{2}$/;function Uc(e){let t=Date.parse(e);return Number.isFinite(t)?zc.test(e)?t+864e5:t:null}function Hc(e,t=Date.now()){if(e.validUntil===void 0){if(e.status!=="approved")return!0;let r=e.assessedAt?Date.parse(e.assessedAt):Number.NaN;return Number.isFinite(r)&&(t instanceof Date?t.getTime():t)<=r+366*864e5}let n=Uc(e.validUntil);return n===null?!1:(t instanceof Date?t.getTime():t)<n}function jc(e,t,n){return!(e.eventConfigurationId&&e.eventConfigurationId!==t||e.eventConfigurationVersion!==void 0&&e.eventConfigurationVersion!==n)}function Yc(e){return e.status!=="draft"&&e.status!=="retracted"}function Xc(e,t){return e.status===void 0?t===void 0:e.status!=="approved"?!0:typeof t=="string"&&typeof e.basisSha256=="string"&&e.basisSha256===t}function kr(e,t={}){return!!e&&Yc(e)&&jc(e,t.activeConfigurationId,t.activeConfigurationVersion)&&Xc(e,t.activeBasisSha256)&&Hc(e,t.now)}var yf=Math.PI*2;function mn(e){return e==="pitch-football"||e==="rink-hockey"||e==="track-athletics"||e==="oval-cricket"}var Wc=/^data:image\/(?:png|jpe?g|webp|gif|avif);base64,[a-z0-9+/]+={0,2}$/i,Kc=/[\s"'<>`\\]/;function qc(e){if(typeof e!="string"||!e||e.length>2e6||e!==e.trim())return!1;if(e.startsWith("data:"))return Wc.test(e);if(Kc.test(e))return!1;try{let t=new URL(e);return t.protocol==="https:"&&!t.username&&!t.password}catch{return!1}}function Fr(e){let t=e.trim();return qc(t)?t:null}var so="seatlayer.event-configuration/1";var gt=100,$c=120,Qc=1e5,Zc=1e4,Jc=/^[a-f0-9]{64}$/,el=new Set(["stage","screen","barrier","camera_platform","sound_desk","rigging_truss"]);function Vt(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function nt(e,t){return typeof e=="string"&&e.length>=1&&e.length<=t&&e.normalize("NFKC").trim()===e}function tl(e){return typeof e=="number"&&Number.isInteger(e)&&e>0}function Dr(e){return!Array.isArray(e)||e.length>Qc||!e.every(t=>nt(t,gt))?null:[...new Set(e)].sort()}function nl(e){return!Vt(e)||!nt(e.chartId,gt)||!nt(e.version,gt)||e.sha256!==void 0&&(typeof e.sha256!="string"||!Jc.test(e.sha256))?null:{chartId:e.chartId,version:e.version,...typeof e.sha256=="string"?{sha256:e.sha256}:{}}}function co(e,t,n){return typeof e=="number"&&Number.isFinite(e)&&e>=t&&e<=n}function ol(e){return Vt(e)?e.mode==="none"||e.mode==="opaque"?e.opacity===void 0?{mode:e.mode}:null:e.mode==="partial"&&co(e.opacity,.01,.99)?{mode:"partial",opacity:e.opacity}:null:null}function rl(e,t){if(e===void 0)return;if(!Array.isArray(e)||e.length>Zc)return null;let n=new Set(t),r=new Set,o=new Set,i=0,a=[];for(let s of e){if(!Vt(s)||!nt(s.id,gt)||!nt(s.objectId,gt)||!n.has(s.objectId)||!el.has(String(s.kind))||!co(s.heightM,.05,50)||s.baseElevationM!==void 0&&!co(s.baseElevationM,-10,100))return null;let c=ol(s.occlusion);if(!c||r.has(s.id)||o.has(s.objectId))return null;let u=s.contentImageUrl===void 0?void 0:typeof s.contentImageUrl=="string"?Fr(s.contentImageUrl):null;if(s.contentImageUrl!==void 0&&(!u||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,...u?{contentImageUrl:u}:{}})}return a.sort((s,c)=>s.id.localeCompare(c.id))}function il(e){let t=[];if(!Vt(e))return{issues:[{code:"invalid_export",path:"configuration",message:"Configuration must be an object"}]};e.schema!==so&&t.push({code:"unsupported_schema",path:"configuration.schema",message:`Configuration schema must be ${so}`}),nt(e.id,gt)||t.push({code:"invalid_id",path:"configuration.id",message:"Configuration id must contain 1 to 100 normalized characters"}),nt(e.label,$c)||t.push({code:"invalid_label",path:"configuration.label",message:"Configuration label must contain 1 to 120 normalized characters"}),tl(e.version)||t.push({code:"invalid_version",path:"configuration.version",message:"Configuration version must be a positive integer"});let n=nl(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=Vt(e.overlay)?e.overlay:null,o=Dr(r?.objectIds),i=Dr(r?.productionKillSeatIds),a=o?rl(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:so,id:e.id,label:e.label,version:e.version,baseVenue:n,overlay:{objectIds:o,productionKillSeatIds:i,...a!==void 0?{productionElements:a}:{}}}}}function Or(e){let t=il(e);return t.value?{ok:!0,value:t.value}:{ok:!1,issues:t.issues}}function al(e){if((e.kind==="polygon"||e.kind==="polyline"||e.kind==="line")&&e.points&&e.points.length>=2)return e.points;if(e.x==null||e.y==null||e.width==null||e.height==null)return null;let t=e.x,n=e.y,r=e.width,o=e.height;return[{x:t,y:n},{x:t+r,y:n},{x:t+r,y:n+o},{x:t,y:n+o}]}function sl(e,t,n){let r=n*Math.PI/180,o=Math.cos(r),i=Math.sin(r),a=e.x-t.x,s=e.y-t.y;return{x:t.x+a*o-s*i,y:t.y+a*i+s*o}}function Vr(e){let t=al(e);if(!t||t.length<2)return null;let n=e.rotation??0,r=Math.abs(n)<1e-6?t:t.map(c=>sl(c,{x:t.reduce((u,d)=>u+d.x,0)/t.length,y:t.reduce((u,d)=>u+d.y,0)/t.length},n)),o=1/0,i=1/0,a=-1/0,s=-1/0;for(let c of r)o=Math.min(o,c.x),i=Math.min(i,c.y),a=Math.max(a,c.x),s=Math.max(s,c.y);return!Number.isFinite(o)||a-o<1e-6||s-i<1e-6?null:{minX:o,minY:i,maxX:a,maxY:s}}var cl=5,ll=3,ul=.92,ml=1.9,dl=2,fl=.6,pl=1,hl=.06;function bl(e){return e.heightM!==void 0?e.heightM:mn(e.stageKind)?hl:pl}function Br(e){let t=1/0,n=1/0,r=-1/0,o=-1/0,i=-1/0;for(let a of zr(e)){let s=a.baseHeightM??0;for(let c of a.objects){if(c.type!=="shape"||c.role!=="stage")continue;let u=Vr(c);u&&(t=Math.min(t,u.minX),n=Math.min(n,u.minY),r=Math.max(r,u.maxX),o=Math.max(o,u.maxY),i=Math.max(i,s+bl(c)))}}return!Number.isFinite(t)||!Number.isFinite(i)?null:{minX:t,minY:n,maxX:r,maxY:o,deckTopM:i}}function yl(e,t,n,r){let o=1/0,i=1/0,a=-1/0,s=-1/0;for(let l of e)Number.isFinite(l.eyeHeightM)&&(o=Math.min(o,l.x),a=Math.max(a,l.x),i=Math.min(i,l.y),s=Math.max(s,l.y));if(!Number.isFinite(o))return null;let c=o*t,u=i*t,d=Math.max(1,Math.ceil((a-o)*t/n)+1),f=Math.max(1,Math.ceil((s-i)*t/n)+1),m=new Float64Array(d*f).fill(-1/0);for(let l of e){if(!Number.isFinite(l.eyeHeightM))continue;let p=l.eyeHeightM-Ie,b=Math.min(d-1,Math.max(0,Math.floor((l.x*t-c)/n))),y=Math.min(f-1,Math.max(0,Math.floor((l.y*t-u)/n)))*d+b,x=p+r;x>m[y]&&(m[y]=x)}return{cellM:n,minX:c,minY:u,cols:d,rows:f,top:m}}function gl(e,t,n){let r=Math.floor((t-e.minX)/e.cellM),o=Math.floor((n-e.minY)/e.cellM);return r<0||o<0||r>=e.cols||o>=e.rows?-1/0:e.top[o*e.cols+r]}function Nr(e,t,n={}){let r=new Map;if(!t||!e.length)return r;let o=n.metresPerChartUnit??be,i=n.cellM??fl,a=n.chairBackM??ul,s=n.selfRowSkipM??dl,c=n.clearThreshold??.9,u=n.partialThreshold??.25,d=Math.max(1,n.columns??cl),f=Math.max(1,n.rows??ll),m=yl(e,o,i,a);if(!m)return r;let l=(t.maxX-t.minX)*o,p=(t.maxY-t.minY)*o,b=l>=p,h=(t.minX+t.maxX)/2*o,y=(t.minY+t.maxY)/2*o,x=[];for(let v=0;v<d;v++){let C=(v+.5)/d-.5,P=b?h+C*l:h,M=b?y:y+C*p;for(let R=0;R<f;R++){let k=t.deckTopM+(f===1?0:R/(f-1)*ml);x.push({x:P,y:M,z:k})}}let g=i/2;for(let v of e){if(!Number.isFinite(v.eyeHeightM))continue;let C=v.x*o,P=v.y*o,M=v.eyeHeightM,R=0,k=1/0;for(let V of x){let L=V.x-C,A=V.y-P,_=Math.hypot(L,A);if(!(_>s)){R++;continue}let B=L/_,S=A/_,E=0;for(let T=s;T<_;T+=g){let w=gl(m,C+B*T,P+S*T);if(!(!Number.isFinite(w)||w>=M)&&w>M+(V.z-M)*T/_){E=T;break}}E?k=Math.min(k,E):R++}let z=R/x.length;z>=c||r.set(v.id,{seatId:v.id,mark:z<u?"obstructedView":"restrictedView",visibleFraction:z,totalRays:x.length,atDistanceM:Number.isFinite(k)?k:0})}return r}function Gr(e,t){if(!t.size)return 0;let n=0;for(let r of e){let o=t.get(r.id);if(!o)continue;let i=r.commercial;i?.restrictedView!==void 0||i?.obstructedView!==void 0||(r.commercial={...i,[o.mark]:!0},n++)}return n}function lo(e){return e?e.accessibility?.length?e.wheelchairSpaceType&&!e.accessibility.includes("wheelchair")?["wheelchair",...e.accessibility]:e.accessibility:e.wheelchairSpaceType?["wheelchair"]:e.accessible?["wheelchair"]:[]:[]}var fn=Math.PI/180;var Bt=16;function uo(e,t,n,r){let o=n*fn,i=Math.cos(o),a=Math.sin(o);return{x:r.x+e*i-t*a,y:r.y+e*a+t*i}}function xl(e){let{seatCount:t,seatSpacing:n,curve:r,rotation:o,origin:i}=e,a=[];if(e.path)return Rr(e.path,t);if(t<=1)return t===1&&a.push({x:i.x,y:i.y}),a;if(r===0){for(let u=0;u<t;u++)a.push(uo(u*n,0,o,i));return a}let s=r/(t-1)*fn,c=n/(2*Math.sin(Math.abs(s)/2));for(let u=0;u<t;u++){let d=u*s,f=c*Math.sin(d),m=-c+c*Math.cos(d);a.push(uo(f,m,o,i))}return a}function vl(e){let t=new Map;if(e.overrides)for(let n of e.overrides)t.set(n.index,n);return t}function Sl(e,t){let n=vl(e);return xl(e).map((r,o)=>{let i=n.get(o),a=lo(i),s=Tr(e,o,i),c={...e.commercial,...i?.commercial};return{index:o,x:r.x+(i?.dx??0),y:r.y+(i?.dy??0),label:s,displayLabel:ro(e,o,t,i),categoryKey:i?.categoryKey??e.categoryKey,skipped:!!i?.skip,accessible:a.length>0,accessibility:a,wheelchairSpaceType:i?.wheelchairSpaceType,commercial:Object.values(c).some(u=>u!==void 0&&u!==!1&&u!=="")?c:void 0,glyph:i?.glyph,viewUrl:i?.viewFromSeatUrl??e.viewFromSeatUrl,viewMeta:i?.viewFromSeatUrl?i.viewFromSeatMeta:e.viewFromSeatMeta,labelStyle:i?.labelStyle??e.seatLabelStyle}})}function Xr(e){let t=[];for(let n of Sl(e))n.skipped||t.push({id:`${e.id}:${n.index}`,label:n.label,displayLabel:n.displayLabel===n.label?void 0:n.displayLabel,x:n.x,y:n.y,rowId:e.id,categoryKey:n.categoryKey,accessible:n.accessible||void 0,accessibility:n.accessibility.length?n.accessibility:void 0,wheelchairSpaceType:n.wheelchairSpaceType,commercial:n.commercial,glyph:n.glyph,viewUrl:n.viewUrl,viewMeta:n.viewMeta,labelStyle:n.labelStyle});return t}function Ml(e){if(e.seatCountsBySide)return{...e.seatCountsBySide};let t=e.sides&&e.sides.length?e.sides:["top","bottom"],n=["top","bottom","left","right"].filter(i=>t.includes(i)),r={top:0,bottom:0,left:0,right:0};if(!n.length)return r;let o=Math.max(0,Math.round(e.seatCount));for(let i=0;i<o;i++)r[n[i%n.length]]+=1;return r}function wl(e){let t=[],n=Math.max(0,Math.round(e.seatCount));if(n===0)return t;let r=new Map((e.overrides??[]).map(d=>[d.index,d])),o=(d,f,m,l)=>{let p=r.get(d),b=lo(p),h=p?.label??`${e.label}-${d+1}`,y=e.displayLabel??e.label;return{index:d,label:h,displayLabel:p?.displayLabel??`${y}-${d+1}`,x:f+(p?.dx??0),y:m+(p?.dy??0),categoryKey:p?.categoryKey??e.categoryKey,skipped:!!p?.skip,accessible:b.length>0,accessibility:b,wheelchairSpaceType:p?.wheelchairSpaceType,commercial:p?.commercial,glyph:p?.glyph,viewUrl:p?.viewFromSeatUrl,viewMeta:p?.viewFromSeatUrl?p.viewFromSeatMeta:void 0,labelStyle:p?.labelStyle,...l?{side:l}:{}}};if(e.shape==="round"){let d=(e.radius??40)+Bt,f=e.rotation*fn,m=Math.max(0,Math.min(360,e.seatArc??360));if(m>=360||n===1){for(let h=0;h<n;h++){let y=f+h/n*2*Math.PI;t.push(o(h,e.center.x+d*Math.cos(y),e.center.y+d*Math.sin(y)))}return t}let l=m*fn,p=(2*Math.PI-l)/2,b=f+p;for(let h=0;h<n;h++){let y=b+h/(n-1)*l;t.push(o(h,e.center.x+d*Math.cos(y),e.center.y+d*Math.sin(y)))}return t}let i=e.width??80,a=e.height??50,s=Ml(e),c=["top","bottom","left","right"],u=0;for(let d of c){let f=s[d];for(let m=0;m<f;m++){let l,p;d==="top"?(l=-i/2+(m+.5)*i/f,p=-a/2-Bt):d==="bottom"?(l=-i/2+(m+.5)*i/f,p=a/2+Bt):d==="left"?(l=-i/2-Bt,p=-a/2+(m+.5)*a/f):(l=i/2+Bt,p=-a/2+(m+.5)*a/f);let b=uo(l,p,e.rotation,e.center);t.push(o(u++,b.x,b.y,d))}}return t}function Pl(e){return wl(e).filter(t=>!t.skipped).map(t=>({id:`${e.id}:${t.index}`,label:t.label,...t.displayLabel!==t.label?{displayLabel:t.displayLabel}:{},x:t.x,y:t.y,rowId:e.id,categoryKey:t.categoryKey,...t.accessible?{accessible:!0}:{},...t.accessibility.length?{accessibility:t.accessibility}:{},...t.wheelchairSpaceType?{wheelchairSpaceType:t.wheelchairSpaceType}:{},...t.commercial?{commercial:t.commercial}:{},...t.glyph?{glyph:t.glyph}:{},...t.viewUrl?{viewUrl:t.viewUrl}:{},...t.viewUrl&&t.viewMeta?{viewMeta:t.viewMeta}:{},...t.labelStyle?{labelStyle:t.labelStyle}:{}}))}function Cl(e){return[{id:`${e.id}:0`,label:e.label,...e.displayLabel&&e.displayLabel!==e.label?{displayLabel:e.displayLabel}:{},x:e.center.x,y:e.center.y,rowId:e.id,categoryKey:e.categoryKey,kind:"booth"}]}function Ur(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 Al(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 ot(e,t,n){return Ur(e,t)&&!(n??[]).some(r=>Ur(e,r)||Al(e,r))}function dn(e){if(!e.length)return{x:0,y:0};let t=0,n=0;for(let r of e)t+=r.x,n+=r.y;return{x:t/e.length,y:n/e.length}}function Wr(e){switch(e.type){case"row":{let t=Xr(e);if(!t.length)return{x:e.origin.x,y:e.origin.y};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}}case"table":case"booth":return{x:e.center.x,y:e.center.y};case"gaArea":return dn(e.points);case"section":return dn(e.outline);case"text":return{x:e.position.x,y:e.position.y};case"shape":return e.points&&e.points.length?dn(e.points):e.x!=null&&e.y!=null&&e.width!=null&&e.height!=null?{x:e.x+e.width/2,y:e.y+e.height/2}:{x:e.x??0,y:e.y??0};case"decorImage":return{x:e.x+e.width/2,y:e.y+e.height/2}}}function Hr(e,t){return e.length===t.length&&e.every((n,r)=>n.x===t[r].x&&n.y===t[r].y)}function Rl(e,t){if(e.type!=="gaArea"||!Hr(e.points,t.outline))return!1;let n=e.holes??[],r=t.holes??[];return n.length===r.length&&n.every((o,i)=>Hr(o,r[i]))}function El(e,t,n=e.filter(o=>o.type==="section"),r=Wr(t)){let o="referenceInventorySource"in t?t.referenceInventorySource?.logicalSectionId:void 0;return(o?n.find(a=>(a.logicalSectionId??a.id)===o&&(Rl(t,a)||ot(r,a.outline,a.holes))):void 0)??n.find(a=>ot(r,a.outline,a.holes))}function zr(e){return e.floors&&e.floors.length?e.floors:[{id:"floor-0",name:"Main",objects:e.objects,focalPoint:e.focalPoint,referenceImage:e.referenceImage,backgroundImage:e.backgroundImage}]}function jr(e,t,n,r,o,i,a,s,c){let u=[],d=e.filter(b=>b.type==="section"),f=Er(e),m=b=>!b?.eventConfigurationId||b.eventConfigurationId===r&&(b.eventConfigurationVersion===void 0||b.eventConfigurationVersion===c),l=b=>kr(b,{activeConfigurationId:r,activeConfigurationVersion:c,activeBasisSha256:o,now:s}),p=(b,h)=>l(b)?{...b,coverage:h}:void 0;for(let b of e){let h=[];if(b.type==="row"?h=Xr(b):b.type==="table"?h=Pl(b):b.type==="booth"&&(h=Cl(b)),!h.length)continue;for(let C of h)C.viewUrl&&!m(C.viewMeta)&&(C.viewUrl=void 0,C.viewMeta=void 0);if(b.type==="row"){let C=f.get(b.id);if(C){let P=new Map((b.overrides??[]).map(M=>[M.index,M]));for(let M of h){let R=Number(M.id.slice(M.id.lastIndexOf(":")+1));if(!Number.isInteger(R))continue;M.logicalRowId=C.groupId,M.logicalSeatIndex=C.adjacencyOffset+R,P.get(R)?.displayLabel||(M.displayLabel=ro(b,R,C)),!M.viewUrl&&C.viewFromSeatUrl&&m(C.viewFromSeatMeta)&&(M.viewUrl=C.viewFromSeatUrl,M.viewMeta=C.viewFromSeatMeta);let k=P.get(R)?.confidenceEvidence;M.confidenceEvidence=p(k,"exact-seat")??p(b.confidenceEvidence,"row-representative")??p(C.confidenceEvidence,"row-representative")}}}let y=El(e,b,d,b.type==="row"?dn(h):Wr(b)),x=y?.viewFromSeatUrl,v=(y?.zone?t?.find(C=>C.id===y.zone):void 0)?.focalPoint??n;for(let C of h){if(!C.confidenceEvidence){let P=Number(C.id.slice(C.id.lastIndexOf(":")+1)),M=(b.type==="row"||b.type==="table")&&Number.isInteger(P)?b.overrides?.find(R=>R.index===P)?.confidenceEvidence:void 0;C.confidenceEvidence=p(M,"exact-seat")??(b.type==="row"?p(b.confidenceEvidence,"row-representative"):void 0)}C.confidenceEvidence??=p(y?.confidenceEvidence,"section-representative")??(a?p(a.evidence,a.coverage):void 0),!C.viewUrl&&x&&m(y?.viewFromSeatMeta)&&(C.viewUrl=x,C.viewMeta=y?.viewFromSeatMeta),!C.viewUrl&&i&&m(i.meta)&&(C.viewUrl=i.url,C.viewMeta=i.meta),y&&(C.sectionId=y.logicalSectionId??y.id),y?.zone&&(C.zoneId=y.zone),v&&(C.focalPoint={...v})}u.push(...h)}return u}function Kr(e,t={}){if(e.floors?.length){let r=[];for(let o of e.floors){let i=o.focalPoint??e.focalPoint,a=o.viewFromSeatUrl?{url:o.viewFromSeatUrl,meta:o.viewFromSeatMeta}:e.viewFromSeatUrl?{url:e.viewFromSeatUrl,meta:e.viewFromSeatMeta}:void 0,s=o.confidenceEvidence?{evidence:o.confidenceEvidence,coverage:"floor-representative"}:e.confidenceEvidence?{evidence:e.confidenceEvidence,coverage:"venue-representative"}:void 0,c=jr(o.objects,e.zones,i,e.eventConfigurationId,e.confidenceBasisSha256,a,s,t.now,t.eventConfigurationVersion??e.eventConfigurationVersion);t.resolveEyeHeights!==!1&&Yr(o.objects,o.focalPoint??e.focalPoint,o.baseHeightM??0,c);for(let u of c)u.floorId=o.id;r.push(...c)}return r}let n=jr(e.objects,e.zones,e.focalPoint,e.eventConfigurationId,e.confidenceBasisSha256,e.viewFromSeatUrl?{url:e.viewFromSeatUrl,meta:e.viewFromSeatMeta}:void 0,e.confidenceEvidence?{evidence:e.confidenceEvidence,coverage:"venue-representative"}:void 0,t.now,t.eventConfigurationVersion??e.eventConfigurationVersion);return t.resolveEyeHeights!==!1&&Yr(e.objects,e.focalPoint,t.floorBaseHeightM??0,n),Il(e,n,t)}function Il(e,t,n){return!n.deriveRestrictedView||e.derivedRestrictedView===!1||n.resolveEyeHeights===!1||Gr(t,Nr(t,Br(e))),t}function Yr(e,t,n,r){let o=e.filter(f=>f.type==="section"),i=n>0||o.some(f=>f.height!==void 0||f.rake!==void 0||(f.elevation??0)>0);if(!o.length||!i||!t){for(let f of r)f.eyeHeightM=n+Ie;return}let a=new Array(r.length),s=new Map;for(let f of o)s.has(f.id)||s.set(f.id,f);let c=new Map,u=new Map;for(let f=0;f<r.length;f++){let m=r[f],p=(m.sectionId?s.get(m.sectionId)??o.find(h=>h.logicalSectionId===m.sectionId&&ot({x:m.x,y:m.y},h.outline,h.holes)):void 0)??o.find(h=>ot({x:m.x,y:m.y},h.outline,h.holes))??null;if(a[f]=p,!p)continue;c.has(p.id)||c.set(p.id,tn(p,{floorBaseHeightM:n}));let b=u.get(p.id);b?b.push(f):u.set(p.id,[f])}let d=new Array(r.length).fill(void 0);for(let[f,m]of u){let l=c.get(f);if(!l)continue;let p=l.rake>0?Math.tan(l.rake*Math.PI/180):0,b=un(f,r,m,t);for(let h of b.rows){let y=h.blockDepth*be*p,x=l.height+y;for(let g of h.seatIndices)d[g]=x}}for(let f=0;f<r.length;f++){let m=r[f],l=a[f];if(!l){m.eyeHeightM=n+Ie;continue}let p=c.get(l.id);m.eyeHeightM=(d[f]??p.height)+Ie}}function Tl(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 _l(e,t){if(!e.length)return null;let n=0,r=0,o=0;for(let l of e)n+=l.x,r+=l.y,o+=Math.hypot(l.x-t.x,l.y-t.y);let i=e.length;n/=i,r/=i,o/=i;let a=e[0],s=-1;for(let l of e){let p=Math.hypot(l.x-n,l.y-r);p>s&&(s=p,a=l)}let c=a.x-n,u=a.y-r,d=Math.hypot(c,u);d>1e-9?(c/=d,u/=d):(c=1,u=0);let f=[...e].sort((l,p)=>(l.x-n)*c+(l.y-r)*u-((p.x-n)*c+(p.y-r)*u)),m=0;for(let l of f){let p=Math.hypot(l.x-n,l.y-r);p>m&&(m=p)}return{pts:f,cx:n,cy:r,radius:m,depth:o}}function qr(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,u=s.y-a.y,d=c*c+u*u,f=d>1e-12?((t-a.x)*c+(n-a.y)*u)/d:0;f<0?f=0:f>1&&(f=1);let m=Math.hypot(t-(a.x+f*c),n-(a.y+f*u));m<o&&(o=m)}return o}var pn=8;function Ll(e,t,n){let r=new Array(pn).fill(1/0),o=new Array(pn).fill(-1);for(let d=0;d<e.length;d++){let f=e[d],m=Math.hypot(t-f.cx,n-f.cy)-f.radius;for(let l=0;l<pn;l++)if(m<r[l]){for(let p=pn-1;p>l;p--)r[p]=r[p-1],o[p]=o[p-1];r[l]=m,o[l]=d;break}}let i=new Array(3).fill(1/0),a=new Array(3).fill(-1);for(let d of o){if(d<0)continue;let f=qr(e[d],t,n);for(let m=0;m<3;m++)if(f<i[m]){for(let l=2;l>m;l--)i[l]=i[l-1],a[l]=a[l-1];i[m]=f,a[m]=d;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,u=0;for(let d=0;d<3;d++){let f=a[d];if(f<0||i[d]>s)continue;let m=1/(i[d]*i[d]);c+=m*e[f].depth,u+=m}return u>0?c/u:e[a[0]].depth}function kl(e){let t=(r,o)=>Ll(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 u=qr(c,r,o);u<i&&(i=u,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 $r(e,t){let n=[];for(let r of e){let o=_l(r.points,t);o&&n.push(o)}return n.length<2?Tl(t):(n.sort((r,o)=>r.depth-o.depth),kl(n))}var po=mt(require("polygon-clipping"),1);var ei=mt(require("earcut"),1);var Fl=.58,Qr=.01,Ce=De*1.5*He,Dl=.5,Ol=.6;function Vl(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)],u=c.x-s.x,d=c.y-s.y,f=Math.hypot(u,d);if(f<1e-9){r.push([0,0]);continue}u/=f,d/=f,r.push([-d,u])}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 Bl(e,t){if(e.length<2||t<=0)return[...e];let n=[...e],r=(a,s)=>{let c=s.x-a.x,u=s.y-a.y,d=Math.hypot(c,u)||1;return{x:c/d,y:u/d}},o=r(n[1],n[0]),i=r(n[n.length-2],n[n.length-1]);return n.unshift({x:n[0].x+o.x*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 Zr=Math.PI/12;function Nl(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 ti(e,t){if(!e.length||!(t>0))return[];let n=Nl(e),r=(s,c,u,d)=>{let f=u-c;for(;f<0;)f+=Math.PI*2;for(;f>Math.PI*2;)f-=Math.PI*2;let m=Math.max(1,Math.ceil(f/Zr)),l=t/Math.cos(f/m/2);for(let p=0;p<=m;p++){let b=c+f*p/m;d.push({x:s.x+Math.cos(b)*l,y:s.y+Math.sin(b)*l})}};if(n.length<3){let s=0,c=0;for(let l of n)s+=l.x,c+=l.y;s/=n.length||1,c/=n.length||1;let u=0;for(let l of n)u=Math.max(u,Math.hypot(l.x-s,l.y-c));let d=[],f=Math.max(3,Math.ceil(Math.PI*2/Zr)),m=(u+t)/Math.cos(Math.PI/f);for(let l=0;l<f;l++){let p=l/f*Math.PI*2;d.push({x:s+Math.cos(p)*m,y:c+Math.sin(p)*m})}return d}let o=n.length,i=[];for(let s=0;s<o;s++){let c=n[s],u=n[(s+1)%o];i.push(Math.atan2(-(u.x-c.x),u.y-c.y))}let a=[];for(let s=0;s<o;s++)r(n[s],i[(s+o-1)%o],i[s],a);return ai(a)}function Gl(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,u=s*s+c*c,d=u>1e-12?((t-i.x)*s+(n-i.y)*c)/u:0;d<0?d=0:d>1&&(d=1);let f=Math.hypot(t-(i.x+d*s),n-(i.y+d*c));f<r&&(r=f)}return r}function hn(e){let t=e.map(o=>{let i=0,a=0;for(let u of o.pts)i+=u.x,a+=u.y;let s=o.pts.length||1;i/=s,a/=s;let c=0;for(let u of o.pts){let d=Math.hypot(u.x-i,u.y-a);d>c&&(c=d)}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 d of i){let f=1/0;for(let m=0;m<e.length;m++){if(m===o||Math.abs(e[m].y-e[o].y)<.001)continue;let l=t[m],p=Math.hypot(d.x-l.cx,d.y-l.cy)-l.rad;if(p>=f&&p>=s)continue;let b=Gl(e[m].pts,d.x,d.y);b<f&&(f=b),e[m].depth<e[o].depth&&b<s&&(s=b,c=e[m].y)}Number.isFinite(f)&&f>0&&a.push(f)}a.sort((d,f)=>d-f);let u=a.length?a[Math.floor(a.length/2)]:1;r.push({pitch:u,belowY:c})}return r}function ni(e,t,n,r){let o=e[t],i=o.pts.length>=2?[...o.pts]:o.pts.length===1?(()=>{let d=o.pts[0],f=d.x-r.x,m=d.y-r.y,l=Math.hypot(f,m)||1;f/=l,m/=l;let p=Math.max(n[t].pitch,.001)*.5;return[{x:d.x+m*p,y:d.y-f*p},{x:d.x-m*p,y:d.y+f*p}]})():[];if(i.length<2)return null;let a=0,s=0;for(let d=1;d<i.length;d++){let f=Math.hypot(i[d].x-i[d-1].x,i[d].y-i[d-1].y);f>1e-6&&(a+=f,s++)}let c=s>0?a/s:0,u=Bl(i,Math.max(c*Ol,Ce));return{pts:u,nrm:Vl(u,r),front:Math.max(n[t].pitch*Fl,Ce),back:Math.max(n[t].pitch*Dl,Ce)}}var xt=1.5,oi=.3;function mo(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 f=1;f<e.length-1;f++){let m=e[f],l=a>1e-12?Math.abs((m.x-n.x)*i-(m.y-n.y)*o)/a:Math.hypot(m.x-n.x,m.y-n.y);l>s&&(s=l,c=f)}if(s<=t||c<0)return[n,r];let u=mo(e.slice(0,c+1),t),d=mo(e.slice(c),t);return[...u.slice(0,-1),...d]}function ri(e,t){if(e.length<4)return e;let n=mo([...e,e[0]],t);return n.pop(),n.length>=3?n:e}function ii(e,t,n){if(e.length<2)return[];let r=n??hn(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 x of a){let g=e[x].patch;g&&g.length>=3?i.push({outline:[...g],holes:[],topY:e[x].y}):s.push(x)}if(!s.length)continue;s.sort((x,g)=>e[x].depth-e[g].depth);let u=s.map(x=>ni(e,x,r,t)).filter(x=>x!==null);if(!u.length)continue;let d=(x,g)=>({x:x.pts[g].x-x.nrm[g][0]*(x.front+xt),y:x.pts[g].y-x.nrm[g][1]*(x.front+xt)}),f=(x,g)=>({x:x.pts[g].x+x.nrm[g][0]*(x.back+xt),y:x.pts[g].y+x.nrm[g][1]*(x.back+xt)}),m=u[0],l=u[u.length-1],p=[];for(let x=0;x<m.pts.length;x++)p.push(d(m,x));for(let x of u)p.push(f(x,x.pts.length-1));for(let x=l.pts.length-1;x>=0;x--)p.push(f(l,x));for(let x=u.length-1;x>=0;x--)p.push(d(u[x],0));let b=ai(p),h=1/0;for(let x of s)e[x].y<h&&(h=e[x].y);if(!Number.isFinite(h))continue;if(b.length>=3&&Math.abs(et(b))>1e-6&&u.every(x=>{let g=x.pts[Math.floor(x.pts.length/2)];return kt(b,g.x,g.y)})){i.push({outline:ri(b,oi),holes:[],topY:h});continue}for(let x of zl(u))i.push({outline:x,holes:[],topY:h})}return i}function zl(e){let t=[];for(let n of e){let r=[],o=[],i=n.front+xt,a=n.back+xt;for(let c=0;c<n.pts.length;c++){let u=n.pts[c],d=n.nrm[c];r.push([u.x-d[0]*i,u.y-d[1]*i]),o.push([u.x+d[0]*a,u.y+d[1]*a])}let s=[...r,...o.reverse()];s.length<3||(s.push(s[0]),t.push([s]))}if(!t.length)return[];try{let n=po.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,u])=>({x:c,y:u})),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(ri(i,oi))}return r}catch{return[]}}function ai(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 fo=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(!kt(n,o.x,o.y)){r=!1;break}if(r)return!0}return!1}};function Jr(e,t,n,r,o,i){if(r.length<3)return;if(n.containsAll(r)){let u=[0,1,0],d=r[0];for(let f=1;f+1<r.length;f++){let m=r[f],l=r[f+1];e.tri([d.x*G,o,d.y*G],[m.x*G,o,m.y*G],[l.x*G,o,l.y*G],u,i)}return}let a=r.map(u=>[u.x,u.y]);a.push(a[0]);let s;try{s=po.default.intersection([a],t)}catch{return}let c=[0,1,0];for(let u of s){if(!u.length||u[0].length<4)continue;let d=u[0],f=[],m=[];for(let p=0;p<d.length-1;p++)f.push(d[p][0],d[p][1]),m.push([d[p][0],d[p][1]]);if(m.length<3)continue;let l=(0,ei.default)(f,void 0,2);for(let p=0;p<l.length;p+=3){let b=m[l[p]],h=m[l[p+1]],y=m[l[p+2]];e.tri([b[0]*G,o,b[1]*G],[h[0]*G,o,h[1]*G],[y[0]*G,o,y[1]*G],c,i)}}}function si(e,t,n,r,o,i,a){if(t.length<2)return;let s=a??hn(t),c=[0,1,0],u=i&&i.length>=3?[[...i.map(l=>[l.x,l.y]),[i[0].x,i[0].y]]]:null,d=i&&i.length>=3?new fo([[...i]]):null,f=l=>{e.setMaterial(2),l(),e.setMaterial(0)},m=l=>{e.setMaterial(3),l(),e.setMaterial(0)};for(let l=0;l<t.length;l++){let p=t[l];if(p.patch&&p.patch.length>=3){let C=[...p.patch],P=s[l].belowY??r;if(m(()=>{if(u&&d)Jr(e,u,d,C,p.y,o.tread);else{let M=C[0];for(let R=1;R+1<C.length;R++){let k=C[R],z=C[R+1];e.tri([M.x*G,p.y,M.y*G],[k.x*G,p.y,k.y*G],[z.x*G,p.y,z.y*G],c,o.tread)}}}),p.y>P+Qr){let M=0,R=0;for(let k of C)M+=k.x,R+=k.y;M/=C.length,R/=C.length,f(()=>{for(let k=0;k<C.length;k++){let z=C[k],V=C[(k+1)%C.length],L=V.x-z.x,A=V.y-z.y,_=Math.hypot(L,A);if(_<1e-6)continue;let B=A/_,S=-L/_;(z.x-M)*B+(z.y-R)*S<0&&(B=-B,S=-S);let E=[B,0,S],T=[z.x*G,p.y,z.y*G],w=[V.x*G,p.y,V.y*G],F=[z.x*G,P,z.y*G],I=[V.x*G,P,V.y*G];e.tri(T,w,I,E,o.riser),e.tri(T,I,F,E,o.riser)}})}continue}let b=ni(t,l,s,n);if(!b)continue;let{pts:h,nrm:y,front:x,back:g}=b,v=s[l].belowY??r;for(let C=0;C+1<h.length;C++){let P=h[C],M=h[C+1],R=y[C],k=y[C+1];if(Math.hypot(M.x-P.x,M.y-P.y)<1e-6||R[0]===0&&R[1]===0||k[0]===0&&k[1]===0)continue;let z=[(P.x-R[0]*x)*G,p.y,(P.y-R[1]*x)*G],V=[(M.x-k[0]*x)*G,p.y,(M.y-k[1]*x)*G],L=[(P.x+R[0]*g)*G,p.y,(P.y+R[1]*g)*G],A=[(M.x+k[0]*g)*G,p.y,(M.y+k[1]*g)*G];if(m(()=>{u&&d?Jr(e,u,d,[{x:P.x-R[0]*x,y:P.y-R[1]*x},{x:M.x-k[0]*x,y:M.y-k[1]*x},{x:M.x+k[0]*g,y:M.y+k[1]*g},{x:P.x+R[0]*g,y:P.y+R[1]*g}],p.y,o.tread):(e.tri(z,V,A,c,o.tread),e.tri(z,A,L,c,o.tread))}),p.y>v+Qr){let _=[z[0],v,z[2]],B=[V[0],v,V[2]],S=[-R[0],0,-R[1]];f(()=>{e.tri(z,V,B,S,o.riser),e.tri(z,B,_,S,o.riser)})}}}}function ci(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 bn(e,t){return e.minX<=t.maxX&&t.minX<=e.maxX&&e.minY<=t.maxY&&t.minY<=e.maxY}var ho=mt(require("polygon-clipping"),1);function Ul(e,t){let n=e.eventConfigurationIds;return!n?.length||!!t&&n.includes(t)}function li(e,t){return e.filter(n=>n.type!=="shape"||Ul(n,t))}function ui(e,t){let n=e.focalPoint??{x:0,y:0};return e.floors?.length?e.floors.map((r,o)=>({objects:li(r.objects,t),focal:{x:(r.focalPoint??n).x,y:(r.focalPoint??n).y},baseHeightM:r.baseHeightM??0,index:o})):[{objects:li(e.objects,t),focal:n,baseHeightM:0,index:0}]}var Hl={minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};function vt(e){return ci(e)??Hl}function mi(e,t){let n=an(e.outline,Ce),r=vt(n),o=t.filter(a=>a!==e&&a.outline&&a.outline.length>=3&&bn(r,vt(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=ho.default.difference([i(n)],...o.map(c=>[i(c.outline)])),s=[];for(let c of a){if(!c.length)continue;let u=c[0].map(([d,f])=>({x:d,y:f}));if(u.length>1){let d=u[0],f=u[u.length-1];Math.abs(d.x-f.x)<1e-9&&Math.abs(d.y-f.y)<1e-9&&u.pop()}u.length>=3&&s.push(u)}return s.length?s:[n]}catch{return[n]}}function di(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=ho.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(([u,d])=>({x:u,y:d}));if(c.length>1){let u=c[0],d=c[c.length-1];Math.abs(u.x-d.x)<1e-9&&Math.abs(u.y-d.y)<1e-9&&c.pop()}c.length>=3&&o.push({outline:c,holes:[],topY:i.topY})}}return o.length?o:e}var jl=.05,fi=.05,Yl=.15,bo=25;function pi(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,u=[],d=new Set;for(let m=0;m<e.length;m+=1){let l=e[m];for(let p of l.objects){if(p.type==="table"&&d.add(p.id),p.type!=="section"||!p.outline||p.outline.length<3)continue;let b=an(p.outline,Ce);c.set(p.id,{section:p,unit:l,frontU:1/0,hasSeats:!1,rows:new Map,seatIndices:[]}),u.push({id:p.id,floorIndex:m,box:vt(b),section:p,unit:l,outline:b})}}let f=new Map;for(let m of u){let l=f.get(m.floorIndex);l?l.push(m):f.set(m.floorIndex,[m])}for(let m=0;m<t.length;m++){let l=t[m],p=n?f.get(n[m])??[]:u,b=l.sectionId?p.find(y=>y.id===l.sectionId)??p.find(y=>y.section.logicalSectionId===l.sectionId&&ot({x:l.x,y:l.y},y.outline,y.section.holes)):void 0,h=b?[b]:p;for(let y of h){if(n&&y.floorIndex!==n[m]||!b&&(l.x<y.box.minX||l.x>y.box.maxX||l.y<y.box.minY||l.y>y.box.maxY||!ot({x:l.x,y:l.y},y.outline,y.section.holes)))continue;o[m]=y.id;let x=c.get(y.id);x.hasSeats=!0;let g=l.focalPoint??y.unit.focal,v=Math.hypot(l.x-g.x,l.y-g.y);v<x.frontU&&(x.frontU=v),x.seatIndices.push(m);let C=l.rowId||`__seat-${m}`,P=x.rows.get(C);P?P.push({x:l.x,y:l.y}):x.rows.set(C,[{x:l.x,y:l.y}]);break}}for(let[m,l]of c){let p=tn(l.section,{floorBaseHeightM:l.unit.baseHeightM}),b=l.unit.baseHeightM,h=p.rake>0?Math.tan(p.rake*Math.PI/180):0,y=p.rake<=.01&&p.height<=b+.001,x=l.section.surfaceKind,g=x==="flat"?!0:x==="rakedRows"&&p.rake>.01?!1:y,v=l.hasSeats?un(m,t,l.seatIndices,l.unit.focal):{sectionId:m,rows:[],blockCount:0},P=v.rows.length<2?$r([...l.rows.values()].map(T=>({points:T})),l.unit.focal):null,M=1/0;if(P){if(l.hasSeats)for(let T of l.rows.values())for(let w of T){let F=P.depthAt(w.x,w.y);F<M&&(M=F)}if(!l.hasSeats||!Number.isFinite(M)){M=1/0;for(let T of l.section.outline){let w=P.depthAt(T.x,T.y);w<M&&(M=w)}}}let R=b+jl,k=Math.max(R,p.height),z=T=>{let w=Math.max(0,T-M)*be,F=Math.min(w*h,bo);return Math.max(R,p.height+F)},V=T=>{let w=Math.max(0,T)*be,F=Math.min(w*h,bo);return Math.max(R,p.height+F)},L=g?[]:v.rows.map(T=>({pts:T.pts,y:V(T.blockDepth),depth:T.blockDepth,blockId:T.blockId,...d.has(T.id)?{patch:ti(T.pts,Ce)}:{}})),A=L.length?L[0].y:k,_=L.map(T=>{let w=T.patch&&T.patch.length>=3?T.patch:T.pts,F=0,I=0;for(let H of w)F+=H.x,I+=H.y;let O=w.length||1;F/=O,I/=O;let j=0;for(let H of w){let N=Math.hypot(H.x-F,H.y-I);N>j&&(j=N)}return{cx:F,cy:I,rad:j}}),B=g?()=>k:L.length>=2?(T,w)=>{let F=1/0,I=A;for(let O=0;O<L.length;O++){let j=_[O];if(Math.hypot(T-j.cx,w-j.cy)-j.rad>=F)continue;let H=L[O].patch,N=H&&H.length>=3?kt(H,T,w)?0:yt(H,T,w):yt(L[O].pts,T,w);N<F&&(F=N,I=L[O].y)}return I}:(T,w)=>P?z(P.depthAt(T,w)):k,S=[0,1,0],E=L.length>=2||g?()=>S:(T,w)=>{if(!P)return S;let F=P.depthAt(T,w);if(F<=M)return S;let I=(F-M)*be;if(I*h>=bo||p.height+I*h<=R)return S;let[O,j]=P.gradientAt(T,w);if(O===0&&j===0)return S;let H=1/Math.hypot(h,1);return[-O*h*H,H,-j*h*H]};if(!g)for(let T of v.rows){let w=V(T.blockDepth);for(let F of T.seatIndices)a[F]=w}for(let T of v.rows){let w=[];for(let H=1;H<T.pts.length;H++){let N=Math.hypot(T.pts[H].x-T.pts[H-1].x,T.pts[H].y-T.pts[H-1].y);N>1e-6&&w.push(N)}w.sort((H,N)=>H-N);let F=w.length?w[Math.floor(w.length/2)]:1/0,I=1/0,O=T.pts[Math.floor(T.pts.length/2)];if(O)for(let H of v.rows){if(H===T||H.blockId!==T.blockId)continue;let N=yt(H.pts,O.x,O.y);N>1e-6&&N<I&&(I=N)}let j=Math.min(F,Math.max(I,F*.5));if(Number.isFinite(j)&&j>0)for(let H of T.seatIndices)s[H]=j}r.set(m,{sectionId:m,deckAt:B,normalAt:E,flat:g,bottomY:b,rowLevels:L,landingY:A})}for(let m=0;m<t.length;m++){let l=o[m],p=t[m];if(l){let h=a[m];i[m]=(h??r.get(l).deckAt(p.x,p.y))+Yl;continue}let b=p.eyeHeightM;i[m]=Number.isFinite(b)?Math.max(0,b-Ie):0}return{bySection:r,seatOwner:o,seatDeckY:m=>i[m],seatPitchU:m=>s[m]}}var le={top:1,wallBottom:.5,bottomCap:.4};function Oe(e,t){if(!e)return t;let n=Pe(Et(e,.4),.62);return ge(t,n,.72)}function hi(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,u=0,d=0;for(let[f,m]of a){let l=ne(n.get(f));l&&(s+=l[0]*m,c+=l[1]*m,u+=l[2]*m,d+=m)}d>0&&o.set(i,[s/d,c/d,u/d])}return o}function bi(e,t){return ne(e.color)??t.get(e.logicalSectionId??e.id)??null}var yi=mt(require("polygon-clipping"),1);function Xl(e,t){return e===void 0||t===void 0?!0:Math.abs(e-t)<.001}var yn=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=vt(t),i=this.rings.filter((c,u)=>bn(o,this.boxes[u])&&Xl(n,this.levels[u])),a=[[r]];if(i.length)try{a=yi.default.difference([r],...i).map(u=>u.map(d=>d.map(([f,m])=>[f,m])))}catch{a=[[r]]}this.rings.push([r]),this.boxes.push(o),this.levels.push(n);let s=[];for(let c of a){if(!c.length)continue;let u=c[0].map(([d,f])=>({x:d,y:f}));if(u.length>1){let d=u[0],f=u[u.length-1];Math.abs(d.x-f.x)<1e-9&&Math.abs(d.y-f.y)<1e-9&&u.pop()}u.length>=3&&s.push(u)}return s}};function Wl(e,t){if(!t)return e;let n=1/0,r=-1/0,o=1/0,i=-1/0;for(let f of e)n=Math.min(n,f.x),r=Math.max(r,f.x),o=Math.min(o,f.y),i=Math.max(i,f.y);let a=(n+r)/2,s=(o+i)/2,c=t*Math.PI/180,u=Math.cos(c),d=Math.sin(c);return e.map(f=>{let m=f.x-a,l=f.y-s;return{x:a+m*u-l*d,y:s+m*d+l*u}})}function rt(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=Ot(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=sn(n,r,e.width/2,e.height/2)}return t?Wl(t,e.rotation):null}function Nt(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"&&mn(e.stageKind)?{kind:"stage",heightM:.06}:n[t]??{kind:"plate",heightM:.25};return{...r,heightM:e.heightM??r.heightM}}var Kl=.08;function gi(e,t){let n=rt(e),r=Nt(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 d of n)i=Math.min(i,d.x),a=Math.min(a,d.y),s=Math.max(s,d.x),c=Math.max(c,d.y);let u=o;for(let d of t)s>d.minX&&i<d.maxX&&c>d.minY&&a<d.maxY&&u<=d.topOffsetM+1e-6&&(u=d.topOffsetM+Kl);return t.push({minX:i,minY:a,maxX:s,maxY:c,topOffsetM:u}),u}function je(e,t,n){return{x:e.x+(t.x-e.x)*n,y:e.y+(t.y-e.y)*n}}function xi(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 Gt(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 vi(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 Ve(e,t,n,r,o,i){ue(e,t,void 0,()=>n,r,o,i,le)}var yo=2.4,ql=.75,$l=.15;function zt(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,u=r/2;return[[-c,-u],[c,-u],[c,u],[-c,u]].map(([d,f])=>({x:t.x+d*a-f*s,y:t.y+d*s+f*a}))}function Si(e,t,n,r,o){let i=zt(t);i&&ue(e,i,void 0,()=>n+yo,n,Oe(r,o.boothTop),o.boothWall,le)}function go(e){if(e.shape==="round"){let d=e.radius;return d?sn(e.center.x,e.center.y,d,d,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,u=n/2;return[[-c,-u],[c,-u],[c,u],[-c,u]].map(([d,f])=>({x:o.x+d*a-f*s,y:o.y+d*s+f*a}))}function Mi(e,t,n,r,o){let i=go(t);i&&ue(e,i,void 0,()=>n+ql,n,Oe(r,o.tableTop),o.tableWall,le)}function wi(e,t,n,r,o,i,a,s){let c=rt(t);if(!c)return;let u=s?s.kind==="stage":t.role==="stage",d=s?s.kind==="screen":t.role==="screen",f=s?{kind:u?"stage":"solid",heightM:s.topY-s.baseY}:Nt(t),m=s?.baseY??n,l=s?.topY??n+r;if(u&&a){let x=1/0,g=-1/0,v=1/0,C=-1/0;for(let P of c)P.x<x&&(x=P.x),P.x>g&&(g=P.x),P.y<v&&(v=P.y),P.y>C&&(C=P.y);a.push({cx:(x+g)/2*G,cz:(v+C)/2*G,y:l,halfX:Math.max((g-x)/2*G,.5),halfZ:Math.max((C-v)/2*G,.5)})}let p=ne(t.fill),b=u&&p?ge(o.stageTop,Pe(Et(p,.18),.9),.9):Oe(p,u?o.stageTop:o.decorTop),h=d?p:null,y=u?p?ge(o.stageWall,Pe(p,.58),.82):o.stageWall:d?h?ge(Pe(h,1.42),[.24,.46,.82],.08):[.24,.46,.82]:Oe(ne(t.fill),o.decorWall);if(f.kind==="portal"&&c.length===4){let x=xi(c);Ve(e,Gt(x,0,.16),l,m,b,y),Ve(e,Gt(x,.84,1),l,m,b,y),Ve(e,x,l,Math.max(m,l-.35),b,y);return}if(f.kind==="suite"&&c.length===4){let x=c.map((C,P)=>{let M=c[(P+1)%4],R=(C.x+M.x)/2,k=(C.y+M.y)/2;return Math.hypot(R-i.x,k-i.y)}),g=x.indexOf(Math.min(...x)),v=[0,1,2,3].map(C=>c[(g+C)%4]);Ve(e,Gt(v,0,.08),l,m,b,y),Ve(e,Gt(v,.92,1),l,m,b,y),Ve(e,vi(v,.88,1),l,m,b,y),Ve(e,v,l,Math.max(m,l-.18),b,y);return}Ve(e,c,l,m,b,y)}function xo(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),u=Math.sin(s),d=r/2,f=o/2;return[[-d,-f],[d,-f],[d,f],[-d,f]].map(([m,l])=>({x:i+m*c-l*u,y:a+m*u+l*c}))}function Ql(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 ne(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=ne(s[1].trim());c&&a.push(c)}return a.length?a.reduce((s,c,u)=>ge(s,c,1/(u+1)),a[0]):null}function Pi(e,t,n,r){if(t.layer==="foreground")return;let o=xo(t);if(!o)return;let i=n+$l,a=Oe(Ql(t.href),r.decorTop),s=Math.max(0,Math.min(1,t.opacity??1));s<1&&(a=ge(r.ground,a,s)),ue(e,o,void 0,()=>i,n,a,ge(a,r.decorWall,.5),le)}function Ci(e,t,n,r,o){if(!t.points||t.points.length<3)return;let i=Oe(r,o.gaTop);ue(e,t.points,t.holes,()=>n+.15,n,i,o.gaWall,le)}var Zl=Math.PI/180,oe=96,Jl=6,eu=60,tu=150,Ai=.2,nu=.35;function ou(e,t){let n=Math.atan2(t.x-e.x,t.y-e.y)/Zl;return n<0?n+360:n}function gn(e){if(!e.length)return NaN;let t=[...e].sort((n,r)=>n-r);return t[Math.floor(t.length/2)]}function xn(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 u=i+c;if(t)u=(u%r+r)%r;else if(u<0||u>=r)continue;a+=e[u],s++}o[i]=a/s}return o}function Ri(e,t){let n=e.filter(m=>m.rows.length>=1);if(n.length<1)return null;let r=[],o=0,i=0,a=0;for(let m of n)for(let l of m.rows){for(let p of l.pts)o+=p.x,i+=p.y,a++;if(l.pts.length>=4){let p=ao(l.pts);p&&Number.isFinite(p.cx)&&Number.isFinite(p.cy)&&r.push({x:p.cx,y:p.cy})}}if(!a)return null;let s={x:o/a,y:i/a},c=s;if(r.length>=8){let m=gn(r.map(y=>y.x)),l=gn(r.map(y=>y.y)),p=0;for(let y of n)for(let x of y.rows)for(let g of x.pts){let v=Math.hypot(g.x-s.x,g.y-s.y);v>p&&(p=v)}let b=0,h=p*.2;for(let y of n)for(let x of y.rows)for(let g of x.pts)Math.hypot(g.x-m,g.y-l)<h&&b++;Math.hypot(m-s.x,l-s.y)<=p&&b/a<.01&&(c={x:m,y:l})}let u=[];for(let m of n){let l={sectionId:m.sectionId,rMin:1/0,rMax:-1/0,samples:[]};for(let p of m.rows)for(let b of p.pts){let h=Math.hypot(b.x-c.x,b.y-c.y),y=Math.min(oe-1,Math.floor(ou(c,b)/(360/oe)));l.samples.push({r:h,bin:y,levelM:p.levelM}),h<l.rMin&&(l.rMin=h),h>l.rMax&&(l.rMax=h)}l.samples.length&&u.push(l)}if(!u.length)return null;u.sort((m,l)=>m.rMin+m.rMax-(l.rMin+l.rMax));let d=[];for(let m of u){let l=!1;for(let p of d){let b=Math.min(m.rMax,p.rMax)-Math.max(m.rMin,p.rMin),h=Math.min(m.rMax-m.rMin,p.rMax-p.rMin);if(h>1e-9&&b>=nu*h){p.members.push(m),p.rMin=Math.min(p.rMin,m.rMin),p.rMax=Math.max(p.rMax,m.rMax),l=!0;break}}l||d.push({members:[m],rMin:m.rMin,rMax:m.rMax})}let f=[];for(let m of d){let l=new Array(oe).fill(null);for(let A of m.members)for(let _ of A.samples){let B=l[_.bin];B||(B={samples:[]},l[_.bin]=B),B.samples.push({r:_.r,levelM:_.levelM})}let p=l.map(A=>!!A);if(!p.filter(Boolean).length)continue;let h=[],y=[];for(let A of l){if(!A)continue;let _=1/0,B=-1/0;for(let S of A.samples)S.r<_&&(_=S.r),S.r>B&&(B=S.r);h.push(_),y.push(B)}let x=gn(h),g=gn(y);if(!(x>=Ai*g)||!(g>0))continue;let v=[...h].sort((A,_)=>A-_);if(!(v[Math.floor(v.length*.1)]>=Ai*g))continue;let P=l.map(A=>{if(!A)return null;let _=[...A.samples].sort((O,j)=>O.r-j.r),B=_[0].r,S=_[_.length-1].r,E=_[0].levelM,T=-1/0;for(let O of _)O.levelM>T&&(T=O.levelM);let w=[];for(let O of _){let j={r:O.r,l:O.levelM};for(;w.length&&Math.abs(w[w.length-1].r-j.r)<1e-9;){if(w[w.length-1].l<=j.l){j.skip=!0;break}w.pop()}if(!j.skip){for(;w.length>=2;){let H=w[w.length-2],N=w[w.length-1];if((N.r-H.r)*(j.l-H.l)-(N.l-H.l)*(j.r-H.r)<=0)w.pop();else break}w.push(j)}}let F=w.map(O=>O.r),I=w.map(O=>O.l);return{inner:B,outer:S,front:E,top:T,profile:{rs:F,ls:I}}}),M=p.slice();for(let A=0;A<oe;A++){if(M[A])continue;let _=-1,B=-1,S=0;for(let D=1;D<=oe;D++){let W=(A-D+oe*2)%oe;if(M[W]){_=W;break}}for(let D=1;D<=oe;D++){let W=(A+D)%oe;if(M[W]){B=W,S=D;break}}if(_<0||B<0)continue;let E=0;for(let D=1;D<=oe;D++){let W=(A-D+oe*2)%oe;if(p[W]){E=D;break}}if(E-1+S>Jl)continue;let w=P[_],F=P[B],I=E/(E+S),O=w.inner+(F.inner-w.inner)*I,j=w.outer+(F.outer-w.outer)*I,H=w.front+(F.front-w.front)*I,N=w.top+(F.top-w.top)*I;P[A]={inner:O,outer:j,front:H,top:N,profile:{rs:[O,j],ls:[H,N]}}}for(let A=0;A<oe;A++)P[A]&&(M[A]=!0);let R=360/oe,k=[],z=M.filter(Boolean).length,V=[];if(z===oe)V.push({start:0,len:oe});else{let A=0;for(;M[A];)A=(A+1)%oe;let _=-1;for(let B=0;B<=oe;B++){let S=(A+B)%oe,E=B<oe&&M[S];if(E&&_<0)_=S;else if(!E&&_>=0){let T=(S-_+oe)%oe||oe;V.push({start:_,len:T}),_=-1}}}for(let A of V){if(A.len*R<eu&&A.len<oe)continue;let _=A.len===oe,B=new Float64Array(A.len),S=new Float64Array(A.len),E=new Float64Array(A.len),T=new Float64Array(A.len),w=[];for(let D=0;D<A.len;D++){let W=P[(A.start+D)%oe];B[D]=W.inner,S[D]=W.outer,E[D]=W.front,T[D]=W.top,w.push(W.profile??{rs:[W.inner,W.outer],ls:[W.front,W.top]})}let F=xn(B,_),I=xn(S,_),O=xn(E,_),j=xn(T,_);for(let D=0;D<A.len;D++)F[D]>B[D]&&(F[D]=B[D]),I[D]<S[D]&&(I[D]=S[D]),F[D]>I[D]-1e-6&&(F[D]=Math.max(0,I[D]-1e-6)),j[D]<O[D]&&(j[D]=O[D]);let H={startBin:A.start,binCount:A.len,closed:_,innerR:F,outerR:I,frontLevelM:O,topLevelM:j,profiles:w},N=(D,W,X)=>{let Q=w[D],q=Q.rs,K=Q.ls;if(W<=q[0]){K[0]>X&&(K[0]=X);return}if(W>=q[q.length-1]){K[K.length-1]>X&&(K[K.length-1]=X);return}for(let Z=0;Z+1<q.length;Z++)if(W<=q[Z+1]){K[Z]>X&&(K[Z]=X),K[Z+1]>X&&(K[Z+1]=X);return}};for(let D=0;D<A.len;D++){let W=l[(A.start+D)%oe];if(W)for(let X of W.samples){N(D,X.r,X.levelM);let Q=_?(D-1+A.len)%A.len:D-1,q=_?(D+1)%A.len:D+1;Q>=0&&N(Q,X.r,X.levelM),q<A.len&&N(q,X.r,X.levelM)}}k.push(H)}k.reduce((A,_)=>A+_.binCount*R,0)<tu||f.push({arcs:k,sectionIds:m.members.map(A=>A.sectionId),innerRMedian:x,outerRMedian:g})}if(!f.length)return null;if(f.sort((m,l)=>m.innerRMedian-l.innerRMedian),t){let m=f[f.length-1].outerRMedian;if(Math.hypot(t.x-c.x,t.y-c.y)>.9*m)return null}return{centre:c,binCount:oe,binStepDeg:360/oe,rings:f}}function Ei(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,u=d=>{let f=t.profiles[d],m=f.rs,l=f.ls;if(r<=m[0])return l[0];if(r>=m[m.length-1])return l[l.length-1];for(let p=0;p+1<m.length;p++)if(r<=m[p+1]){let b=m[p+1]-m[p],h=b>1e-9?(r-m[p])/b:0;return l[p]+(l[p+1]-l[p])*h}return l[l.length-1]};return u(a)*(1-c)+u(s)*c}var ru=.25,iu=1.2,au=.6,su=.45,cu=2.3,lu=Math.PI/180;function it(e,t,n){let r=n*lu;return{x:e.x+t*Math.sin(r),y:e.y+t*Math.cos(r)}}function uu(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 mu=24;function du(e,t,n,r,o,i,a,s){let c=n.binCount,u=mu,d=be,f=i+.02,m=[];for(let L=0;L<c;L++){let A=(n.startBin+L+.5)*t.binStepDeg,_=new Float64Array(u+1);for(let B=0;B<=u;B++){let S=r[L]+(o[L]-r[L])*B/u;_[B]=Math.max(f,Ei(t,n,A,S)-ru)}m.push(_)}let l=[a.bandTop[0]*s.top,a.bandTop[1]*s.top,a.bandTop[2]*s.top],p=[a.bandTop[0]*s.bottomCap,a.bandTop[1]*s.bottomCap,a.bandTop[2]*s.bottomCap],b=[a.bandWall[0]*s.top,a.bandWall[1]*s.top,a.bandWall[2]*s.top],h=[a.bandWall[0]*s.wallBottom,a.bandWall[1]*s.wallBottom,a.bandWall[2]*s.wallBottom],y=(L,A)=>{let _=(n.startBin+L+.5)*t.binStepDeg,B=r[L]+(o[L]-r[L])*A/u,S=it(t.centre,B,_);return[S.x*d,m[L][A],S.y*d]};{let L=Math.tan(12*Math.PI/180);for(let A=0;A<6;A++){let _=!1;for(let S=0;S<c;S++)for(let E=u-1;E>=0;E--)m[S][E]>m[S][E+1]&&(m[S][E]=m[S][E+1],_=!0);let B=n.closed?c:c-1;for(let S=0;S<B;S++){let E=(S+1)%c;for(let T=0;T<=u;T++){let w=m[E][T]-m[S][T];if(Math.abs(w)>1)continue;let F=r[S]+(o[S]-r[S])*T/u,I=r[E]+(o[E]-r[E])*T/u,O=it(t.centre,F,(n.startBin+S+.5)*t.binStepDeg),j=it(t.centre,I,(n.startBin+E+.5)*t.binStepDeg),H=L*Math.hypot(j.x-O.x,j.y-O.y)*d;w>H?(m[E][T]=m[S][T]+H,_=!0):-w>H&&(m[S][T]=m[E][T]+H,_=!0)}}if(!_)break}}let x=1,g=(L,A)=>{for(let _=0;_<=u;_+=4)if(Math.abs(m[L][_]-m[A][_])>x)return!0;return Math.abs(m[L][u]-m[A][u])>x},v=Math.tan(38*Math.PI/180),C=L=>(o[L]-r[L])/u*d,P=(L,A)=>m[L][A+1]-m[L][A]>v*Math.max(1e-6,C(L)),M=(L,A)=>{let _=n.closed?(L-1+c)%c:Math.max(0,L-1),B=n.closed?(L+1)%c:Math.min(c-1,L+1);Math.abs(m[_][A]-m[L][A])>x&&(_=L),Math.abs(m[B][A]-m[L][A])>x&&(B=L);let S=Math.max(0,A-1),E=Math.min(u,A+1);S<A&&P(L,S)&&(S=A),E>A&&P(L,A)&&(E=A);let T=y(_,A),w=y(B,A),F=y(L,S),I=y(L,E),O=w[0]-T[0],j=w[1]-T[1],H=w[2]-T[2],N=I[0]-F[0],D=I[1]-F[1],W=I[2]-F[2],X=j*W-H*D,Q=H*N-O*W,q=O*D-j*N,K=Math.hypot(X,Q,q);return K>1e-12?(X/=K,Q/=K,q/=K,Q<0&&(X=-X,Q=-Q,q=-q),[X,Q,q]):[0,1,0]},R=(L,A)=>{let _=[L[0],i,L[2]],B=[A[0],i,A[2]],S=A[0]-L[0],E=A[2]-L[2],T=Math.hypot(S,E);if(!(T>1e-12))return;let w=[E/T,0,-S/T];e.tri(L,A,B,w,b,b,h),e.tri(L,B,_,w,b,h,h)},k=.05*He,z=L=>o[L]-r[L]<k,V=n.closed?c:c-1;for(let L=0;L<V;L++){let A=(L+1)%c;if(z(L)||z(A))continue;if(g(L,A)){let w=(n.startBin+L+1)*t.binStepDeg,F=(D,W)=>{let X=(r[L]+r[A])/2,Q=(o[L]+o[A])/2,q=X+(Q-X)*W/u,K=it(t.centre,q,w);return[K.x*d,m[D][W],K.y*d]};for(let D=0;D<u;D++){let W=y(L,D),X=y(L,D+1),Q=F(L,D),q=F(L,D+1),K=M(L,D),Z=M(L,D+1);e.triN(W,Q,q,K,K,Z,l),e.triN(W,q,X,K,Z,Z,l);let te=y(A,D),Me=y(A,D+1),Ae=F(A,D),Be=F(A,D+1),ke=M(A,D),Ne=M(A,D+1);e.triN(Ae,te,Me,ke,ke,Ne,l),e.triN(Ae,Me,Be,ke,Ne,Ne,l);let we=F(L,D),de=F(L,D+1),Ge=F(A,D+1),ct=F(A,D),lt=de[0]-we[0],Fe=de[2]-we[2],qe=Math.hypot(lt,Fe);if(qe>1e-12){let ut=[Fe/qe,0,-lt/qe];e.tri(we,de,Ge,ut,b),e.tri(we,Ge,ct,ut,b)}}let I=y(L,0),O=y(A,0),j=y(A,u),H=y(L,u),N=D=>[D[0],i,D[2]];e.tri(N(I),N(j),N(O),[0,-1,0],p),e.tri(N(I),N(H),N(j),[0,-1,0],p),R(I,O),R(H,j);continue}for(let w=0;w<u;w++){let F=M(L,w),I=M(A,w),O=M(A,w+1),j=M(L,w+1);if(P(L,w)||P(A,w)){let X=(de,Ge)=>{let ct=(n.startBin+de+.5)*t.binStepDeg,lt=r[de]+(o[de]-r[de])*(w+.5)/u,Fe=it(t.centre,lt,ct);return[Fe.x*d,Ge,Fe.y*d]},Q=y(L,w),q=y(A,w),K=X(L,m[L][w]),Z=X(A,m[A][w]);e.triN(Q,q,Z,F,I,I,l),e.triN(Q,Z,K,F,I,F,l);let te=y(A,w+1),Me=y(L,w+1),Ae=X(L,m[L][w+1]),Be=X(A,m[A][w+1]);e.triN(Ae,Be,te,j,O,O,l),e.triN(Ae,te,Me,j,O,j,l);let ke=Z[0]-K[0],Ne=Z[2]-K[2],we=Math.hypot(ke,Ne);if(we>1e-12){let de=[-Ne/we,0,ke/we];e.tri(K,Z,Be,de,b),e.tri(K,Be,Ae,de,b)}continue}let H=y(L,w),N=y(A,w),D=y(A,w+1),W=y(L,w+1);e.triN(H,N,D,F,I,O,l),e.triN(H,D,W,F,O,j,l)}let _=y(L,0),B=y(A,0),S=y(A,u),E=y(L,u),T=w=>[w[0],i,w[2]];e.tri(T(_),T(S),T(B),[0,-1,0],p),e.tri(T(_),T(E),T(S),[0,-1,0],p),R(_,B),R(E,S)}if(!n.closed)for(let L of[0,c-1])for(let A=0;A<u;A++)R(y(L,A),y(L,A+1))}function Ii(e,t,n){let{bottomY:r,colors:o,ao:i}=n,a=new Float64Array(t.binCount).fill(-1/0);for(let d of t.rings)for(let f of d.arcs){let m=new Float64Array(f.binCount),l=new Float64Array(f.binCount);for(let b=0;b<f.binCount;b++){let h=(f.startBin+b)%t.binCount,y=Math.max(0,f.innerR[b]-Ce);m[b]=Math.max(y,a[h]+.001),l[b]=Math.max(m[b]+.001,f.outerR[b]+Ce)}let p=0;for(let b=0;b<f.binCount;b++){let h=f.topLevelM[b]-r;h>p&&(p=h)}p>=iu&&du(e,t,f,m,l,r,o,i);for(let b=0;b<f.binCount;b++){let h=(f.startBin+b)%t.binCount;l[b]>a[h]&&(a[h]=l[b])}}if(n.deriveShell===!1||uu(n.shapes,t))return;let s=t.rings[t.rings.length-1],c=au*He,u=su*He;for(let d of s.arcs){let f=[],m=[];for(let b=0;b<d.binCount;b++){let h=(d.startBin+b+.5)*t.binStepDeg,y=d.outerR[b]+Ce+c;f.push(it(t.centre,y,h)),m.push(it(t.centre,y+u,h))}let l=-1/0;for(let b=0;b<d.binCount;b++)d.topLevelM[b]>l&&(l=d.topLevelM[b]);let p=()=>l+cu;d.closed?ue(e,m,[f.slice().reverse()],p,r,o.shellTop,o.shellWall,i):ue(e,[...m,...f.slice().reverse()],void 0,p,r,o.shellTop,o.shellWall,i)}}function Ti(e,t,n,r,o,i,a,s){if(!t.outline||t.outline.length<3)return;let c=n.baseHeightM,u=Oe(r,s.tierTop);if(!o)return;let d=h=>o.deckAt(h.x,h.y),f=mi(t,a),m=f[0]??t.outline;if(o.rowLevels.length>=2){let h=hn(o.rowLevels),y=di(ii(o.rowLevels,n.focal,h),f),x=()=>[0,1,0];for(let v of y){let C=Math.max(c,v.topY-.02);for(let P of i.subtract(v.outline,C))ue(e,P,v.holes,()=>C,c,u,s.tierWall,le,void 0,x)}y.length||ue(e,m,t.holes,()=>o.landingY,c,u,s.tierWall,le);let g={tread:[u[0]*le.top,u[1]*le.top,u[2]*le.top],riser:[u[0]*.72,u[1]*.72,u[2]*.72]};for(let v of f.length?f:[m])si(e,o.rowLevels,n.focal,o.landingY,g,v,h);return}let l=o.flat?1/0:fi,p=h=>o.normalAt(h.x,h.y),b=o.flat?o.landingY:void 0;for(let h of i.subtract(m,b))ue(e,h,t.holes,d,c,u,s.tierWall,le,l,p)}function fu(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 u=t[a],d=o.get(s);d||(d=new Map,o.set(s,d));let f=u.rowId||`__seat-${a}`,m=d.get(f);m||(m={pts:[],levelM:0,n:0},d.set(f,m)),m.pts.push({x:u.x,y:u.y}),m.levelM+=n.seatDeckY(a),m.n++}let i=[];for(let a of e.objects){if(a.type!=="section")continue;let s=n.bySection.get(a.id);if(s&&s.rowLevels.length>=2){let u=s.rowLevels.filter(d=>!d.patch).map(d=>({pts:d.pts,levelM:d.y}));u.length>=2&&i.push({sectionId:a.id,rows:u});continue}let c=o.get(a.id);c&&i.push({sectionId:a.id,rows:[...c.values()].map(u=>({pts:u.pts,levelM:u.levelM/u.n}))})}return i}function _i(e,t,n,r,o,i,a=!0){let s=fu(t,n,r);if(!s.length)return;let c=Ri(s,t.focal);c&&(e.setMaterial(0),Ii(e,c,{bottomY:t.baseHeightM,colors:{bandTop:Pe(o.tierTop,.8),bandWall:o.tierWall,shellTop:i??Pe(o.tierWall,1.15),shellWall:i??o.tierWall},ao:le,shapes:t.objects.filter(u=>u.type==="shape"),deriveShell:a}))}var Li=/^[\p{L}\p{N}]{1,4}$/u,pu=/^([\p{L}\p{N}]{2,})[\s\-\u2013\u2014\u00b7_./]+(.+)$/u;function ki(e,t){let n=t?.trim();if(!n)return e;let r=e.toLocaleLowerCase("en-US"),o=n.toLocaleLowerCase("en-US");if(r.startsWith(`${o} `)){let a=e.slice(n.length).trim();if(Li.test(a))return a}let i=pu.exec(e);if(i){let a=i[1].toLocaleLowerCase("en-US"),s=i[2].trim();if((o.startsWith(a)||a.startsWith(o))&&Li.test(s))return s}return e}function Fi(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 Di(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 hu=1.15,bu=2.75,yu=4.5,gu=.85,xu=.5,vu=.26;function Oi(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>=hu&&a.add("zone"),o<=(i?bu:yu)&&(a.add("section"),a.add("ga")),o<=gu&&(a.add("annotation"),a.add("booth")),o<=xu&&a.add("row"),o<=vu&&a.add("seat"),a}function Vi(e,t,n,r,o,i=6){let a=i+t,s=r-i-t,c=i+n,u=o-i-n;return{...e,x:a>s?r/2:Math.max(a,Math.min(s,e.x)),y:c>u?o/2:Math.max(c,Math.min(u,e.y))}}function Ye(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],u=o[1]*i+o[5]*a+o[9]*s+o[13],d=o[2]*i+o[6]*a+o[10]*s+o[14],f=o[3]*i+o[7]*a+o[11]*s+o[15];if(!(f>1e-6))return{x:0,y:0,depth:1/0,visible:!1};let m=c/f,l=u/f,p=d/f,b=m>=-1.05&&m<=1.05&&l>=-1.05&&l<=1.05&&p<=1;return{x:(m*.5+.5)*n,y:(1-(l*.5+.5))*r,depth:p,visible:b}}function Bi(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(vo(i,s,t,n)){a=!0;break}a||r.push(i)}return r}var Su=6;function vo(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+Su):n;return o<a&&i<r}function Ni(e,t,n){return e.length*t*.58+(n?14:0)}var Mu={row:8,seat:14};function Gi(e){return e<480?{row:5,seat:8}:e<768?{row:6,seat:10}:Mu}function zi(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 So(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 u of o)if(vo(s,u,t,n)){c=!0;break}if(!c){for(let u of a)if(vo(s,u,t,n)){c=!0;break}}c||a.push(s)}return a}var wu=6,Pu=2.2,Ui=.1,Cu=.3,Au=1.8,Ru=.9,Eu=.55,Iu=6e3;function Hi(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 d of n)for(let f of d.objects)f.type==="section"&&f.zone&&c.set(f.id,f.zone);let u=new Map;for(let d=0;d<r.length;d++){let f=r[d],m=o.seatOwner[d],l=f.zoneId??(m?c.get(m):void 0);if(!l)continue;let p=u.get(l);p||(p={n:0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0,sumY:0},u.set(l,p)),p.n++,f.x<p.minX&&(p.minX=f.x),f.y<p.minY&&(p.minY=f.y),f.x>p.maxX&&(p.maxX=f.x),f.y>p.maxY&&(p.maxY=f.y),p.sumY+=o.seatDeckY(d)}for(let d of a){let f=u.get(d.id),m=[];for(let[l,p]of c)p===d.id&&m.push(l);if(!f||f.n===0){s.push({id:d.id,label:d.label,color:ne(d.color),sectionIds:m,seatCount:0,center:[0,0,0],radius:0,focalWorld:[(d.focalPoint??i).x*G,1.5,(d.focalPoint??i).y*G]});continue}s.push({id:d.id,label:d.label,color:ne(d.color),sectionIds:m,seatCount:f.n,center:[(f.minX+f.maxX)/2*G,f.sumY/f.n,(f.minY+f.maxY)/2*G],radius:.5*Math.hypot((f.maxX-f.minX)*G,(f.maxY-f.minY)*G)||1,focalWorld:[(d.focalPoint??i).x*G,1.5,(d.focalPoint??i).y*G]})}}return s}function ji(e){let{doc:t,units:n,seats:r,surfaces:o,seatData:i,hintedSeatFloor:a,zones:s,focal:c}=e,u=[],d=[],f=[];for(let m of s)m.seatCount!==0&&u.push({id:`zone:${m.id}`,kind:"zone",text:m.label,anchor:[m.center[0],m.center[1]+wu,m.center[2]],color:t.zones?.find(l=>l.id===m.id)?.color});{let m=new Map,l=new Map;for(let p=0;p<r.length;p++){let b=o.seatOwner[p];if(!b)continue;let h=m.get(b);h||(h={n:0,x:0,y:0,deck:0},m.set(b,h)),h.n++,h.x+=r[p].x,h.y+=r[p].y,h.deck+=o.seatDeckY(p);let y=l.get(b);y||(y={minX:1/0,maxX:-1/0,minY:1/0,maxY:-1/0},l.set(b,y)),r[p].x<y.minX&&(y.minX=r[p].x),r[p].x>y.maxX&&(y.maxX=r[p].x),r[p].y<y.minY&&(y.minY=r[p].y),r[p].y>y.maxY&&(y.maxY=r[p].y)}for(let p of n)for(let b of p.objects){if(b.type!=="section")continue;let h=m.get(b.id);if(!h||h.n===0)continue;let y=l.get(b.id),x=[h.x/h.n*G,h.deck/h.n,h.y/h.n*G],g=b.displayLabel||b.label||b.id;d.push({id:b.id,floorIndex:p.index,label:g,seatCount:h.n,center:x,radius:Math.max(1,Math.hypot(y.maxX-y.minX,y.maxY-y.minY)*.5*G),focalWorld:[p.focal.x*G,p.baseHeightM+1.5,p.focal.y*G]});let v=t.floors?.[p.index]?.name?.trim().toLocaleLowerCase();n.length>1&&v===g.trim().toLocaleLowerCase()||u.push({id:`section:${b.id}`,kind:"section",text:g,anchor:[x[0],x[1]+Pu,x[2]],floorIndex:p.index})}}{for(let b of n)for(let h of b.objects){if(h.type!=="gaArea")continue;let y=Lt(h.points);if(!y)continue;let x=h.displayLabel||h.label||h.id;u.push({id:`ga:${h.id}`,kind:"ga",text:h.capacity>0?`${x} \xB7 ${h.capacity.toLocaleString()}`:x,anchor:[y.x*G,b.baseHeightM+Au,y.y*G],floorIndex:b.index})}let m=new Map;for(let b of n)for(let h of b.objects)h.type==="section"&&m.set(h.id,h.displayLabel||h.label||h.id);let l=new Map;for(let b=0;b<r.length;b++){let h=r[b],y=Math.hypot(h.x-c.x,h.y-c.y),x=l.get(h.rowId);(!x||y>x.far)&&l.set(h.rowId,{seat:h,index:b,far:y})}for(let[b,h]of l){let y=Tu(h.seat.label,b,m.get(h.seat.sectionId??""));y&&u.push({id:`row:${b}`,kind:"row",text:y,anchor:[h.seat.x*G,o.seatDeckY(h.index)+Ru,h.seat.y*G],floorIndex:a[h.index]})}let p=new Map;for(let b=0;b<r.length;b++){let h=r[b],y=h.label?h.label.lastIndexOf("-"):-1,x=p.get(h.rowId);x||(x={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},p.set(h.rowId,x));let g=b*3,v=i.iPosition[g],C=i.iPosition[g+1],P=i.iPosition[g+2];x.n++,x.x+=v,x.y+=C,x.z+=P,x.minX=Math.min(x.minX,v),x.maxX=Math.max(x.maxX,v),x.minZ=Math.min(x.minZ,P),x.maxZ=Math.max(x.maxZ,P)}for(let[b,h]of p)f.push({id:b,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<=Iu)for(let b=0;b<r.length;b++){let h=r[b],y=Mo(h.displayLabel||h.label);y&&u.push({id:`seat:${h.id}`,kind:"seat",text:y,anchor:[h.x*G,o.seatDeckY(b)+Eu,h.y*G],floorIndex:a[b]})}}for(let m of n)for(let l of m.objects)if(l.type==="shape"&&l.role&&["entrance","exit","screen","suite","obstruction"].includes(l.role)){let p=rt(l),b=p?Lt(p):null;if(!b||!l.label)continue;u.push({id:`architecture:${l.id}`,kind:"annotation",text:l.label,anchor:[b.x*G,m.baseHeightM+Nt(l).heightM+Ui,b.y*G],color:l.fill,floorIndex:m.index})}else if(l.type==="text"){if(!l.text)continue;u.push({id:`text:${l.id}`,kind:"annotation",text:l.text,anchor:[l.position.x*G,m.baseHeightM+Ui,l.position.y*G],color:l.color,rotation:l.rotation,floorIndex:m.index})}else if(l.type==="booth"){let p=zt(l);if(!p)continue;let b=Lt(p);if(!b)continue;u.push({id:`booth:${l.id}`,kind:"booth",text:l.displayLabel||l.label||l.id,anchor:[b.x*G,m.baseHeightM+yo+Cu,b.y*G],floorIndex:m.index})}return{labels:u,sections:d,rows:f}}function Yi(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 Mo(e){let t=e.lastIndexOf("-");return t>=0&&t<e.length-1?e.slice(t+1):e}function Tu(e,t,n){let r=e?e.lastIndexOf("-"):-1,o=r>0?e.slice(0,r):t;return o&&ki(o,n)}function Xi(e){let{doc:t,units:n,seats:r,surfaces:o,solids:i,hintedSeatFloor:a,seatFloor:s}=e,c=[];{let u=n.map(()=>({minX:1/0,minY:1/0,minZ:1/0,maxX:-1/0,maxY:-1/0,maxZ:-1/0}));for(let m=0;m<i.floor.length;m+=1){let l=Math.max(0,Math.min(n.length-1,Math.round(i.floor[m]))),p=m*3,b=u[l];b.minX=Math.min(b.minX,i.position[p]),b.minY=Math.min(b.minY,i.position[p+1]),b.minZ=Math.min(b.minZ,i.position[p+2]),b.maxX=Math.max(b.maxX,i.position[p]),b.maxY=Math.max(b.maxY,i.position[p+1]),b.maxZ=Math.max(b.maxZ,i.position[p+2])}let d=new Map;for(let m=0;m<n.length;m++)for(let l of n[m].objects)l.type==="section"&&d.set(l.id,m);let f=n.map(()=>({n:0,minX:1/0,minY:1/0,minDeck:1/0,maxX:-1/0,maxY:-1/0,maxDeck:-1/0,sumX:0,sumDeck:0,sumZ:0}));for(let m=0;m<r.length;m++){let l=o.seatOwner[m],p=(l!==null?d.get(l):void 0)??a[m];if(p===void 0)continue;let b=f[p],h=r[m];b.n++,h.x<b.minX&&(b.minX=h.x),h.y<b.minY&&(b.minY=h.y),h.x>b.maxX&&(b.maxX=h.x),h.y>b.maxY&&(b.maxY=h.y);let y=o.seatDeckY(m);b.sumX+=h.x*G,b.sumDeck+=y,b.sumZ+=h.y*G,b.minDeck=Math.min(b.minDeck,y),b.maxDeck=Math.max(b.maxDeck,y+1.6),s[m]=p}for(let m=0;m<n.length;m++){let l=f[m],p=t.floors?.[m],b=u[m],h=Math.min(l.n?l.minX*G:n[m].focal.x*G-1,Number.isFinite(b.minX)?b.minX:1/0),y=Math.max(l.n?l.maxX*G:n[m].focal.x*G+1,Number.isFinite(b.maxX)?b.maxX:-1/0),x=Math.min(l.n?l.minY*G:n[m].focal.y*G-1,Number.isFinite(b.minZ)?b.minZ:1/0),g=Math.max(l.n?l.maxY*G:n[m].focal.y*G+1,Number.isFinite(b.maxZ)?b.maxZ:-1/0),v=Math.min(l.n?Math.min(n[m].baseHeightM,l.minDeck):n[m].baseHeightM,Number.isFinite(b.minY)?b.minY:1/0),C=Math.max(l.n?Math.max(l.maxDeck,v+.5):v+.5,Number.isFinite(b.maxY)?b.maxY:-1/0),P=[l.n?l.sumX/l.n:(h+y)/2,l.n?l.sumDeck/l.n:(v+C)/2,l.n?l.sumZ/l.n:(x+g)/2],M=Math.max(1,.5*Math.hypot(y-h,C-v,g-x));c.push({index:m,id:p?.id??`floor-${m}`,label:p?.name??(n.length>1?`Floor ${m+1}`:"Venue"),seatCount:l.n,center:P,radius:M,box:{min:[h,v,x],max:[y,C,g]},focalWorld:[n[m].focal.x*G,n[m].baseHeightM+1.5,n[m].focal.y*G]})}}return c}function wo(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 u of c.outline)a(u.x,u.y);else if(c.type==="shape"&&c.points)for(let u of c.points)a(u.x,u.y);else if(c.type==="gaArea")for(let u of c.points)a(u.x,u.y);else if(c.type==="booth"){let u=zt(c);if(u)for(let d of u)a(d.x,d.y)}else if(c.type==="table"){let u=go(c);if(u)for(let d of u)a(d.x,d.y)}else if(c.type==="decorImage"){let u=xo(c);if(u)for(let d of u)a(d.x,d.y)}return Number.isFinite(n)||(n=-100,r=-100,o=100,i=100),{minX:n,minY:r,maxX:o,maxY:i}}function Wi(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=Ot(o.minX-a,o.minY-a,o.maxX-o.minX+a*2,o.maxY-o.minY+a*2);ue(e,s,void 0,()=>0,-.4,i.ground,i.ground,le)}else{let a=t.reduce((l,p)=>p.baseHeightM<l.baseHeightM?p:l);e.setFloor(a.index);let s=n.filter((l,p)=>r[p]===a.index),c=wo([a],s),u=Math.hypot(c.maxX-c.minX,c.maxY-c.minY),d=Math.max(28,Math.min(80,u*.04)),f=Ot(c.minX-d,c.minY-d,c.maxX-c.minX+d*2,c.maxY-c.minY+d*2),m=a.baseHeightM-.03;ue(e,f,void 0,()=>m,m-.22,i.ground,i.ground,le)}}function Ki(e,t,n){let{cx:r,cz:o,radius:i}=n,a=1/0,s=1/0,c=1/0,u=-1/0,d=-1/0,f=-1/0,m=(b,h,y)=>{a=Math.min(a,b),u=Math.max(u,b),s=Math.min(s,h),d=Math.max(d,h),c=Math.min(c,y),f=Math.max(f,y)};for(let b=0;b<e.position.length;b+=3)m(e.position[b],e.position[b+1],e.position[b+2]);for(let b=0;b<t.count;b++){let h=b*3,y=t.iPosition[h],x=t.iPosition[h+1],g=t.iPosition[h+2],v=Math.max(.35,t.iMaxRadius[b]??.35);m(y-v,x,g-v),m(y+v,x+1.6,g+v)}Number.isFinite(a)||(a=r-i,u=r+i,s=0,d=i*.16,c=o-i,f=o+i);let l=[(a+u)/2,(s+d)/2,(c+f)/2],p=Math.max(1,.5*Math.hypot(u-a,d-s,f-c));return{center:l,radius:p,minY:s,maxY:d}}function qi(e,t,n,r,o,i){let a=1/0,s=1/0,c=-1/0,u=-1/0;for(let v=0;v<e.count;v++){let C=v*3,P=e.iPosition[C],M=e.iPosition[C+2];P<a&&(a=P),P>c&&(c=P),M<s&&(s=M),M>u&&(u=M)}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),u=Math.max(u,v.cz+v.halfZ);let d=n.minX*G,f=n.maxX*G,m=n.minY*G,l=n.maxY*G,p=d,b=f,h=m,y=l;if(Number.isFinite(a)){let v=Math.max(2,.06*Math.hypot(c-a,u-s));p=Math.max(d,a-v),b=Math.min(f,c+v),h=Math.max(m,s-v),y=Math.min(l,u+v)}let x=Math.min(0,r),g=Math.max(o,i*.05);return{min:[p,x,h],max:[b,g,y]}}function $i(e,t,n){let r=()=>({byObjectId:new Map,elements:[]});if(!t||!e)return r();let o=Or(t);if(!o.ok||o.value.id!==e)return r();let i=new Map;for(let f of n)for(let m of f.objects)m.type==="shape"&&i.set(m.id,{shape:m,unit:f});let a=new Set,s=new Set,c=new Map((t.overlay.productionElements??[]).map(f=>{let m=f.runtimeContentImageUrl;return[f.id,typeof m=="string"&&/^(?:blob:|data:image\/|https:\/\/)/.test(m)?m:void 0]})),u=[];for(let f of o.value.overlay.productionElements??[]){let m=i.get(f.objectId),l=m?rt(m.shape):null,p=f.baseElevationM??0;if(!m||!l||l.length<3||!f.id||a.has(f.id)||s.has(f.objectId)||!Number.isFinite(f.heightM)||f.heightM<.05||f.heightM>50||!Number.isFinite(p)||p<-10||p>100)return r();a.add(f.id),s.add(f.objectId);let b=l.map(R=>R.x*G),h=l.map(R=>R.y*G),y=m.unit.baseHeightM+p,x=Math.min(...b),g=Math.max(...b),v=Math.min(...h),C=Math.max(...h),P,M=c.get(f.id)??f.contentImageUrl;if(f.kind==="screen"&&M)if(g-x>=C-v){let R=Math.abs(v-m.unit.focal.y*G)<=Math.abs(C-m.unit.focal.y*G)?v-.006:C+.006;P=[[x,y,R],[g,y,R],[x,y+f.heightM,R],[g,y+f.heightM,R]]}else{let R=Math.abs(x-m.unit.focal.x*G)<=Math.abs(g-m.unit.focal.x*G)?x-.006:g+.006;P=[[R,y,v],[R,y,C],[R,y+f.heightM,v],[R,y+f.heightM,C]]}u.push({id:f.id,objectId:f.objectId,kind:f.kind,floorIndex:m.unit.index,baseY:y,topY:y+f.heightM,bounds:{min:[x,y,v],max:[g,y+f.heightM,C]},occlusion:f.occlusion,...M?{contentImageUrl:M}:{},...P?{contentPlane:P}:{}})}let d=u.sort((f,m)=>f.id.localeCompare(m.id));return{byObjectId:new Map(d.map(f=>[f.objectId,f])),elements:d}}function ve(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function xe(e){return Array.isArray(e)?e:[]}function _u(e){let t=[e];for(;t.length;){let n=t.pop();if(Array.isArray(n)){t.push(...n);continue}if(!ve(n))continue;let r=ve(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 vn(e,t){return!Array.isArray(e)||e.length!==t||!e.every(n=>typeof n=="number"&&Number.isFinite(n))?null:e}function Lu(){return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}function ku(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 Fu(e){let t=vn(e.matrix,16);if(t)return t;if(e.matrix!==void 0)return null;let n=e.translation===void 0?[0,0,0]:vn(e.translation,3),r=e.rotation===void 0?[0,0,0,1]:vn(e.rotation,4),o=e.scale===void 0?[1,1,1]:vn(e.scale,3);if(!n||!r||!o)return null;let[i,a,s,c]=r,u=Math.hypot(i,a,s,c);if(!(u>1e-8))return null;let d=i/u,f=a/u,m=s/u,l=c/u,p=d+d,b=f+f,h=m+m,y=d*p,x=d*b,g=d*h,v=f*b,C=f*h,P=m*h,M=l*p,R=l*b,k=l*h;return[(1-(v+P))*o[0],(x+k)*o[0],(g-R)*o[0],0,(x-k)*o[1],(1-(y+P))*o[1],(C+M)*o[1],0,(g+R)*o[2],(C-M)*o[2],(1-(y+v))*o[2],0,n[0],n[1],n[2],1]}function Du(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 Ou(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],u=e[10],d=i*u-a*c,f=a*s-o*u,m=o*c-i*s,l=t*d+n*f+r*m;if(Math.abs(l)<1e-12)return null;let p=1/l;return[d*p,f*p,m*p,(r*c-n*u)*p,(t*u-r*s)*p,(n*s-t*c)*p,(n*a-r*i)*p,(r*o-t*a)*p,(t*i-n*o)*p]}function Qi(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 Vu(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(!ve(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 Bu(e){return e===5120||e===5121?1:e===5122||e===5123?2:e===5125||e===5126?4:0}function Nu(e){return e==="SCALAR"?1:e==="VEC2"?2:e==="VEC3"?3:e==="VEC4"?4:0}function Gu(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 zu(e){let t=e instanceof Uint8Array?e:new Uint8Array(e),n=Vu(t);if(!n)return{ok:!1,issue:"invalid_glb"};let{json:r,bin:o}=n;if(!ve(r.asset)||r.asset.version!=="2.0")return{ok:!1,issue:"unsupported_glb"};let i=xe(r.extensionsUsed).filter(v=>typeof v=="string");if(i.includes("KHR_draco_mesh_compression")||_u(r))return{ok:!1,issue:"draco_not_allowed"};if(i.length||xe(r.extensionsRequired).length)return{ok:!1,issue:"unsupported_glb"};if(xe(r.images).length||xe(r.textures).length)return{ok:!1,issue:"external_resource"};let a=xe(r.buffers);if(a.length!==1||!ve(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=xe(r.accessors),c=xe(r.bufferViews),u=xe(r.meshes),d=xe(r.nodes),f=xe(r.scenes),m=typeof r.scene=="number"?r.scene:0;if(!ve(f[m]))return{ok:!1,issue:"unsupported_glb"};let l=new DataView(o.buffer,o.byteOffset,o.byteLength),p=(v,C,P)=>{if(typeof v!="number"||!Number.isInteger(v)||!ve(s[v]))return null;let M=s[v];if(M.type!==C||M.sparse!==void 0||M.normalized===!0||typeof M.count!="number"||!Number.isInteger(M.count)||M.count<1||typeof M.componentType!="number"||!P.includes(M.componentType)||typeof M.bufferView!="number")return null;let R=c[M.bufferView];if(!ve(R)||R.buffer!==0||typeof R.byteLength!="number"||!Number.isInteger(R.byteLength)||R.byteLength<0)return null;let k=Nu(M.type),z=Bu(M.componentType),V=typeof R.byteStride=="number"?R.byteStride:k*z,L=typeof R.byteOffset=="number"?R.byteOffset:0,A=typeof M.byteOffset=="number"?M.byteOffset:0,_=L+A,B=A+(M.count-1)*V+k*z;if(!Number.isInteger(V)||!Number.isInteger(L)||!Number.isInteger(A)||V<k*z||L<0||A<0||L+R.byteLength>o.byteLength||B>R.byteLength)return null;let S=[];for(let E=0;E<M.count;E++){let T=[];for(let w=0;w<k;w++){let F=Gu(l,_+E*V+w*z,M.componentType);if(!Number.isFinite(F))return null;T.push(F)}S.push(T)}return S},b=[],h=[],y=0,x=new Set,g=(v,C)=>{if(typeof v!="number"||!Number.isInteger(v)||!ve(d[v])||x.has(v))return!1;x.add(v);let P=d[v],M=Fu(P);if(!M)return!1;let R=ku(C,M),k=Ou(R);if(!k)return!1;if(P.mesh!==void 0){if(typeof P.mesh!="number")return!1;let z=u[P.mesh];if(!ve(z))return!1;for(let V of xe(z.primitives)){if(!ve(V)||V.mode!==void 0&&V.mode!==4||!ve(V.attributes))return!1;let L=p(V.attributes.POSITION,"VEC3",[5126]),A=V.attributes.NORMAL===void 0?null:p(V.attributes.NORMAL,"VEC3",[5126]);if(!L||V.attributes.NORMAL!==void 0&&!A)return!1;let _=L.length;if(V.indices!==void 0){let S=typeof V.indices=="number"?s[V.indices]:null;_=ve(S)?S.count:void 0}if(typeof _!="number"||!Number.isInteger(_)||_%3!==0||(y+=_/3,y>1e5))return!1;let B=V.indices===void 0?L.map((S,E)=>[E]):p(V.indices,"SCALAR",[5121,5123,5125]);if(!B||B.length%3!==0||B.length!==_)return!1;for(let S=0;S<B.length;S+=3){let E=[B[S][0],B[S+1][0],B[S+2][0]];if(E.some(F=>!Number.isInteger(F)||F<0||F>=L.length))return!1;let T=E.map(F=>Du(R,...L[F])),w=null;if(!A){let F=T[1][0]-T[0][0],I=T[1][1]-T[0][1],O=T[1][2]-T[0][2],j=T[2][0]-T[0][0],H=T[2][1]-T[0][1],N=T[2][2]-T[0][2];w=Qi([1,0,0,0,1,0,0,0,1],I*N-O*H,O*j-F*N,F*H-I*j)}for(let F=0;F<3;F++)b.push(...T[F]),h.push(...A?Qi(k,...A[E[F]]):w)}}}for(let z of xe(P.children))if(!g(z,R))return!1;return x.delete(v),!0};for(let v of xe(f[m].nodes))if(!g(v,Lu()))return{ok:!1,issue:y>1e5?"triangle_limit":"unsupported_glb"};return!y||b.length!==y*9||h.length!==b.length?{ok:!1,issue:"unsupported_glb"}:{ok:!0,triangleCount:y,position:new Float32Array(b),normal:new Float32Array(h)}}function Zi(e){try{return zu(e)}catch{return{ok:!1,issue:"invalid_glb"}}}function St(e){let{doc:t}=e,n=Pr(t.theme),r=n.structure,o=ui(t,e.eventConfigurationId??t.eventConfigurationId),i=$i(e.eventConfigurationId,e.eventConfiguration,o),a=e.seats,s=new rn,c=null;if(e.registeredShellGlb){let S=Zi(e.registeredShellGlb);if(S.ok){let E=S.position.length/3,T=new Float32Array(S.position.length),w=n.materials.shell??r.tierWall;for(let F=0;F<E;F++){let I=S.normal[F*3+1],O=I<-.25?.4:.62+.38*Math.max(0,I);T[F*3]=w[0]*O,T[F*3+1]=w[1]*O,T[F*3+2]=w[2]*O}c={position:S.position,normal:S.normal,color:T,floor:new Float32Array(E).fill(-2),material:new Float32Array(E),count:E}}}let u=new Map;for(let S of o)for(let E of S.objects)u.set(E.id,S.index),E.type==="section"&&u.set(E.logicalSectionId??E.id,S.index);let d=a.map(S=>u.get(S.sectionId??"")??u.get(S.rowId??"")??0),f=wo(o,a);Wi(s,o,a,d,f,r);let m=hi(t,a),l=new Map,p=new Map;for(let S of t.categories??[])l.set(S.key,S.color),S.seatGlyph&&p.set(S.key,S.seatGlyph);let b=[],h=pi(o,a,d),y=new Float32Array(a.length),x=[];for(let S=0;S<o.length;S++){let E=o[S];s.setFloor(S);let T=new yn,w=[],F=E.objects.filter(I=>I.type==="section"&&!!I.outline&&I.outline.length>=3);for(let I of E.objects)if(I.type==="section"){let O=s.vertexCount;Ti(s,I,E,bi(I,m),h.bySection.get(I.id),T,F,r);let j=s.vertexCount-O;j>0&&x.push({sectionId:I.id,start:O,count:j})}else if(I.type==="shape"){let O=i.byObjectId.get(I.id);s.setMaterial((O?.kind??I.role)==="screen"?1:0),wi(s,I,E.baseHeightM,gi(I,w),r,E.focal,b,O),s.setMaterial(0)}else I.type==="gaArea"?Ci(s,I,E.baseHeightM,ne(l.get(I.categoryKey)),r):I.type==="booth"?Si(s,I,E.baseHeightM,ne(l.get(I.categoryKey)),r):I.type==="table"?Mi(s,I,E.baseHeightM,ne(I.fill??t.theme?.decorFill??"#232c40"),r):I.type==="decorImage"&&Pi(s,I,E.baseHeightM,r);_i(s,E,a,h,r,n.materials.shell,!c)}let g=o.length>1?{x:o.reduce((S,E)=>S+E.focal.x,0)/o.length,y:o.reduce((S,E)=>S+E.focal.y,0)/o.length}:t.focalPoint??{x:(f.minX+f.maxX)/2,y:(f.minY+f.maxY)/2},v=fr(c?[s.build(),c]:[s.build()]),C=Mr(a,e.initialState,h,y,l,p),P=Hi({doc:t,units:o,seats:a,surfaces:h,focal:g}),{labels:M,sections:R,rows:k}=ji({doc:t,units:o,seats:a,surfaces:h,seatData:C,hintedSeatFloor:d,zones:P,focal:g}),z=Xi({doc:t,units:o,seats:a,surfaces:h,solids:v,hintedSeatFloor:d,seatFloor:y});Yi(M,z),C.iYaw=vr(C.iPosition,a.length,S=>a[S].rowId,S=>{let E=o[y[S]]?.focal??g;return[E.x*G,E.y*G]});let V=(f.minX+f.maxX)/2*G,L=(f.minY+f.maxY)/2*G,A=.5*Math.hypot((f.maxX-f.minX)*G,(f.maxY-f.minY)*G)||10,_=Ki(v,C,{cx:V,cz:L,radius:A}),B=qi(C,b,f,_.minY,_.maxY,A);return{solids:v,sectionSolidRanges:x,seats:C,bounds:{center:[(B.min[0]+B.max[0])/2,(B.min[1]+B.max[1])/2,(B.min[2]+B.max[2])/2],radius:A,groundY:0,box:B},renderBounds:{center:_.center,radius:_.radius},stateColorLUT:Cr(n,pe),theme:n,seatCount:a.length,focalWorld:[g.x*G,1.5,g.y*G],zones:P,stages:b,productionElements:i.elements,sections:R,rows:k,labels:M,floors:z}}var Uu=88,Hu=20,Ji={floor:{size:14,weight:"700",opacity:.98},zone:{size:15,weight:"600",opacity:.95},section:{size:12,weight:"500",opacity:.88},ga:{size:12,weight:"500",opacity:.88},booth:{size:11,weight:"500",opacity:.85},annotation:{size:11,weight:"400",opacity:.75},row:{size:11.5,weight:"700",opacity:.94},seat:{size:12.5,weight:"800",opacity:1}},ju=640,Yu=.8,Xu=11,Wu="3px 7px",Ku="2px 5px",ea="rgba(10,14,22,.62)",qu="#f4f7fb",ta=5,na=2,$u=6,Ut=new Set(["row","seat"]),oa={floor:5,zone:4,section:3,ga:3,booth:2,annotation:1},Sn={row:{x:66,y:20},seat:{x:52,y:22}},Co=ne,Po=e=>Ho(e);function Ao(e,t){let n=Po(e),r=Po(t);return(Math.max(n,r)+.05)/(Math.min(n,r)+.05)}function Ro(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 Qu(e,t=[.04,.06,.1],n=!0){let r=Po(t)<.42,o=r?"#f4f7fb":"#0b1220",i=r?"rgba(8,12,22,.78)":"rgba(255,255,255,.84)",a=n?Ro(i,t):t,s=Co(e),c=n?7:4.5,u=s&&Ao(s,a)>=c?e:o;return r?{ink:u,backing:i,border:"rgba(210,222,245,.24)"}:{ink:u,backing:i,border:"rgba(11,18,32,.22)"}}function Zu(e,t=[.04,.06,.1]){let n=Ro(ea,t),r=Co(e);return{ink:r&&Ao(r,n)>=4.5?e:qu,backing:ea}}var Ju='ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif',Mn=class{constructor(t,n={}){this.nodes=new Map;this.labels=[];this.forcedDense=!1;this.selectedSeatLabelIds=new Set;this.narrowStage=!1;this.opts=n,this.root=document.createElement("div"),this.root.setAttribute("data-view3d-labels","");let r=this.root.style;r.position="absolute",r.inset="0",r.pointerEvents="none",r.overflow="hidden",r.fontFamily=n.fontFamily||Ju,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}`))}sizeFor(t){let n=Ji[t].size;return!this.narrowStage||Ut.has(t)?n:Math.max(Xu,n*Yu)}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;this.narrowStage=n>0&&n<ju;let s=Oi(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 v=Ye(t,g.anchor,n,r);if(!v.visible)continue;let C=Ut.has(g.kind),P=this.sizeFor(g.kind),M=Ni(g.text,P,!C)+(C?ta*2:0),R=Vi(v,M/2,P/2+(C?na:4),n,r),k=a?Math.hypot(g.anchor[0]-a[0],g.anchor[1]-a[1],g.anchor[2]-a[2]):1;c.push({label:g,screen:R,focus:zi(R,k,n,r),halfWidth:M/2,...this.selectedSeatLabelIds.has(g.id)?{priority:1}:{}})}let u=Di(c.filter(g=>g.label.kind==="floor"),n),d=[...c.filter(g=>!Ut.has(g.label.kind)&&g.label.kind!=="floor"),...u],f=Bi(d,Uu,Hu),m=Gi(n),l=So(c.filter(g=>g.label.kind==="row"),Sn.row.x,Sn.row.y,m.row,f),p=So(c.filter(g=>g.label.kind==="seat"),Sn.seat.x,Sn.seat.y,m.seat,[...f,...l]),b=[...f,...l,...p],h=new Set(b.map(g=>g.label.id));for(let{label:g,screen:v}of b){let P=this.nodeFor(g).style;P.display="",P.transform=`translate(-50%, -50%) translate(${v.x.toFixed(1)}px, ${v.y.toFixed(1)}px)`}let y=b.filter(({label:g})=>!Ut.has(g.kind)).sort((g,v)=>oa[v.label.kind]-oa[g.label.kind]||g.screen.depth-v.screen.depth||g.focus-v.focus),x=[];for(let{label:g}of y){let v=this.nodes.get(g.id);if(!v||v.style.display==="none")continue;let C=v.getBoundingClientRect();x.some(M=>C.left<M.right+3&&C.right+3>M.left&&C.top<M.bottom+3&&C.bottom+3>M.top)?v.style.display="none":x.push(C)}for(let[g,v]of this.nodes)h.has(g)||(v.style.display="none")}nodeFor(t){let n=this.nodes.get(t.id);if(!n){n=document.createElement("div");let p=n.style;p.position="absolute",p.left="0",p.top="0",p.whiteSpace="nowrap",p.textShadow="0 1px 3px rgba(0,0,0,0.85), 0 0 8px rgba(0,0,0,0.55)",p.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=Ji[t.kind],i=n.style;i.fontSize=`${this.sizeFor(t.kind)}px`,i.fontWeight=r?"800":o.weight,i.opacity=r?"1":String(o.opacity);let a=Ut.has(t.kind),s=!a,c=Qu(t.color??this.opts.ink,this.opts.backgroundRgb,!0),u=a?Zu(t.color??this.opts.ink,this.opts.backgroundRgb):c;i.color=r?"#ecf8ff":u.ink,i.background=r?"rgba(10,28,45,.9)":u.backing,i.border=r?"1px solid rgba(89,199,255,.92)":s?`1px solid ${c.border}`:"",i.borderRadius=r||s?"999px":`${$u}px`;let d=this.narrowStage?Ku:Wu;i.padding=r||s?d:`${na}px ${ta}px`,i.lineHeight=a?"1.1":"",i.boxShadow=r?"0 0 0 2px rgba(41,176,255,.18), 0 5px 14px rgba(0,0,0,.35)":s?"0 3px 10px rgba(0,0,0,.24)":"0 1px 4px rgba(0,0,0,.28)",i.letterSpacing=t.kind==="zone"||t.kind==="floor"?"0.08em":"0.02em";let f=this.opts.backgroundRgb??[.04,.06,.1],m=Co(r?"#ecf8ff":u.ink)??[1,1,1],l=Ro(r?"rgba(10,28,45,.9)":u.backing,f);return n.dataset.qualityContrast=Ao(m,l).toFixed(3),(t.kind==="zone"||t.kind==="floor")&&(i.textTransform="uppercase"),n}dispose(){this.root.remove(),this.nodes.clear()}};var ia=1;var em=new Set(["floor","zone","section","ga","booth","annotation"]);function tm(e){return e.every(t=>Number.isFinite(t))}function nm(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 ra(e){return e.length?Math.round(Math.min(...e)*100)/100:null}function at(e){return Math.round(e*1e4)/1e4}function om(e){if(e)return{box:{x:at(e.box.x),y:at(e.box.y),width:at(e.box.width),height:at(e.box.height)},horizontalFillRatio:at(e.horizontalFillRatio),verticalFillRatio:at(e.verticalFillRatio),visibleAreaRatio:at(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 wn(e){let t=e.labels.filter(s=>s.visible&&s.screenBox),n=t.filter(s=>em.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)nm(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",tm(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:u})=>({id:s,kind:c,text:u})).sort((s,c)=>s.kind.localeCompare(c.kind)||s.id.localeCompare(c.id)),framing:om(e.framing)},metrics:{minimumHierarchyFontPx:ra(n.map(s=>s.renderedFontPx)),minimumHierarchyContrast:ra(n.map(s=>s.contrast)),projectedReliefPx:Math.round(e.scene.projectedReliefPx*100)/100},findings:a}}var ce=require("ogl");var Xe=require("ogl");var Pn=`
|
|
21
21
|
float chairWeight(float depth) {
|
|
22
22
|
return 1.0 - smoothstep(uChairFull, uChairNone, depth);
|
|
23
|
-
}`,
|
|
23
|
+
}`,aa=`
|
|
24
24
|
float occupantWeight(float depth) {
|
|
25
25
|
float nearWeight = smoothstep(${Jo.toFixed(1)}, ${er.toFixed(1)}, depth);
|
|
26
26
|
float farWeight = 1.0 - smoothstep(${Qo.toFixed(1)}, ${Zo.toFixed(1)}, depth);
|
|
27
27
|
return nearWeight * farWeight;
|
|
28
|
-
}`,
|
|
28
|
+
}`,sa=`
|
|
29
29
|
float glyphEq(float glyph, float expected) {
|
|
30
30
|
return 1.0 - step(0.25, abs(glyph - expected));
|
|
31
31
|
}
|
|
@@ -211,7 +211,7 @@ out float vDim;
|
|
|
211
211
|
out float vDotWeight; // 1 = the dot IS this seat, 0 = the chair has taken over
|
|
212
212
|
out float vPhysicalSeat;
|
|
213
213
|
out float vPixelRadius;
|
|
214
|
-
${
|
|
214
|
+
${Pn}
|
|
215
215
|
void main() {
|
|
216
216
|
vec4 mv = modelViewMatrix * vec4(iOffset, 1.0);
|
|
217
217
|
float depth = max(-mv.z, 0.001);
|
|
@@ -334,9 +334,9 @@ out vec3 vRing;
|
|
|
334
334
|
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
|
-
${
|
|
338
|
-
${ia}
|
|
337
|
+
${Pn}
|
|
339
338
|
${aa}
|
|
339
|
+
${sa}
|
|
340
340
|
void main() {
|
|
341
341
|
vec4 anchor = modelViewMatrix * vec4(iOffset, 1.0);
|
|
342
342
|
float viewDepth = -anchor.z;
|
|
@@ -518,7 +518,7 @@ out float vPhysicalSeat;
|
|
|
518
518
|
out float vDotWeight;
|
|
519
519
|
out float vHidden;
|
|
520
520
|
flat out vec3 vPick;
|
|
521
|
-
${
|
|
521
|
+
${Pn}
|
|
522
522
|
void main() {
|
|
523
523
|
int id = gl_InstanceID + 1; // 0 reserved for no-hit
|
|
524
524
|
vPick = vec3(float(id & 255), float((id >> 8) & 255), float((id >> 16) & 255)) / 255.0;
|
|
@@ -569,9 +569,9 @@ uniform float uBackBase;
|
|
|
569
569
|
uniform float uFocusFloor;
|
|
570
570
|
flat out vec3 vPick;
|
|
571
571
|
out float vHidden;
|
|
572
|
-
${
|
|
573
|
-
${ia}
|
|
572
|
+
${Pn}
|
|
574
573
|
${aa}
|
|
574
|
+
${sa}
|
|
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 ca(e){return new Xe.Program(e,{vertex:dm,fragment:fm,transparent:!1,depthTest:!0,depthWrite:!0,cullFace:!1,uniforms:{uSeatRadius:{value:De},uSeatScale:{value:1},uMinPixels:{value:ht},uPixelToWorld:{value:.002},uChairFull:{value:_t},uChairNone:{value:bt},uFocusFloor:{value:-1}}})}function la(e){return new Xe.Program(e,{vertex:pm,fragment:hm,transparent:!1,depthTest:!0,depthWrite:!0,cullFace:!1,uniforms:{uChairFull:{value:_t},uChairNone:{value:bt},uBackRake:{value:Jn},uBackBase:{value:cn},uFocusFloor:{value:-1}}})}function ua(e){return new Xe.Program(e,{vertex:bm,fragment:ym,transparent:!1,depthTest:!0,depthWrite:!0,cullFace:!1,uniforms:{uFocusFloor:{value:-1}}})}function ma(e,t=.78){return new Xe.Program(e,{vertex:rm,fragment:im,cullFace:!1,depthTest:!0,depthWrite:!0,uniforms:{uKeyDir:{value:new Float32Array([.38,.86,.34])},uFocusFloor:{value:-1},uStructureDetail:{value:0},uRoughness:{value:t}}})}function da(e){return new Xe.Program(e,{vertex:am,fragment:sm,transparent:!0,depthTest:!0,depthWrite:!1,cullFace:!1,uniforms:{uSeatRadius:{value:De},uSeatScale:{value:1},uMinPixels:{value:ht},uPixelToWorld:{value:.002},uSeatFade:{value:0},uSeatDetail:{value:0},uFocusFloor:{value:-1},uFadeColor:{value:new Float32Array([.32,.37,.43])},uChairFull:{value:_t},uChairNone:{value:bt}}})}function fa(e,t=.78){return new Xe.Program(e,{vertex:cm,fragment:lm,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:_t},uChairNone:{value:bt},uBackRake:{value:Jn},uBackBase:{value:cn},uFocusFloor:{value:-1},uRoughness:{value:t}}})}function pa(e,t,n){return new Xe.Program(e,{vertex:um,fragment:mm,depthTest:!1,depthWrite:!1,cullFace:!1,uniforms:{uTop:{value:new Float32Array(t)},uBottom:{value:new Float32Array(n)}}})}var gm=.65,xm=new Set(["dimmed","sold"]),vm=new Set(["dimmed","sold","held"]);function ha(e,t,n){let r=new Set,o=!1,i=pe.indexOf("dimmed"),a=!1;for(let c=0;c<n.length;c+=1)if(n[c]===i){a=!0;break}let s=a?vm:xm;for(let c of e){let u=t.get(c.sectionId);if(!u||!u.length){r.add(c.sectionId);continue}let d=!1;for(let f of u){let m=pe[n[f]]??"available";if(!s.has(m)){d=!0;break}}d?r.add(c.sectionId):o=!0}return{lit:r,anyUnlit:o}}function ba(e,t,n,r,o,i){let a=[];for(let s of e){let c=o===null||o.has(s.sectionId);if(r.get(s.sectionId)===c)continue;r.set(s.sectionId,c);let u=(s.start+s.count)*3;for(let d=s.start*3;d<u;d++)t[d]=c?n[d]:n[d]+(i[d%3]-n[d])*gm;a.push(s)}return a}function ya(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 Sm=new Float32Array([-1,-1,1,-1,1,1,-1,-1,1,1,-1,1]),Mm=new Float32Array([-1,-1,3,-1,-1,3]);function ga(e,t){let n=new ce.Transform,r=new ce.Transform,o=new ce.Geometry(e,{position:{size:2,data:Mm}}),i=pa(e,t.theme.background.top,t.theme.background.bottom),a=new ce.Mesh(e,{geometry:o,program:i});a.frustumCulled=!1,a.setParent(r);let s=new ce.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=ma(e,t.theme.materials.roughness),u=new ce.Mesh(e,{geometry:s,program:c});u.frustumCulled=!1,u.setParent(n);let d=da(e),f=new Float32Array(t.seats.count*3),m=pe.map(X=>t.theme.seatStates[X]);ya(f,t.seats.iState,0,t.seats.count,m,t.seats.iCategory);let l=new ce.Geometry(e,{position:{size:2,data:Sm},iOffset:{size:3,data:t.seats.iPosition,instanced:1},iColor:{size:3,data:f,instanced:1},iMaxRadius:{size:1,data:t.seats.iMaxRadius,instanced:1},iPhysicalSeat:{size:1,data:t.seats.iPhysicalSeat,instanced:1},iRing:{size:3,data:t.seats.iRing,instanced:1},iFloor:{size:1,data:t.seats.iFloor,instanced:1}}),p=new ce.Mesh(e,{geometry:l,program:d});p.frustumCulled=!1,t.seats.count>0&&p.setParent(n);let b=l.attributes.iColor,h=t.solids.color.slice(),y=t.theme.structure.ground,x=new Map(t.sectionSolidRanges.map(X=>[X.sectionId,!0])),g=xr(),v=fa(e,t.theme.materials.roughness),C=en,P=new Float32Array(C*3),M=new Float32Array(C*3),R=new Float32Array(C),k=new Float32Array(C),z=new Float32Array(C),V=new Float32Array(C*3),L=new Float32Array(C),A=new Float32Array(C),_=new Float32Array(C),B=new Float32Array(C),S=new ce.Geometry(e,{position:{size:3,data:g.position},normal:{size:3,data:g.normal},part:{size:1,data:g.part},index:{data:g.index},iOffset:{size:3,data:P,instanced:1},iColor:{size:3,data:M,instanced:1},iRadius:{size:1,data:R,instanced:1},iYaw:{size:1,data:k,instanced:1},iGlyph:{size:1,data:z,instanced:1},iRing:{size:3,data:V,instanced:1},iFloor:{size:1,data:L,instanced:1},iPhysicalSeat:{size:1,data:A,instanced:1},iSeed:{size:1,data:B,instanced:1},iPickIndex:{size:1,data:_,instanced:1}}),E=new ce.Mesh(e,{geometry:S,program:v});E.frustumCulled=!1;let T=0,w=!1,F=!1,I=null,O=null,j=null,H=new Int32Array(0),N=()=>{let X=t.seats;for(let Q=0;Q<T;Q++){let q=H[Q];B[Q]=Sr(X.iState[q],q);let Z=X.iCategory&&X.iState[q]===0?null:m[X.iState[q]]??m[0];if(Z)M[Q*3]=Z[0],M[Q*3+1]=Z[1],M[Q*3+2]=Z[2];else{let te=t.theme.materials.seat??Yo([X.iCategory[q*3],X.iCategory[q*3+1],X.iCategory[q*3+2]]);M[Q*3]=te[0],M[Q*3+1]=te[1],M[Q*3+2]=te[2]}}S.attributes.iColor.needsUpdate=!0,S.attributes.iSeed.needsUpdate=!0},D={main:n,background:r,seatProgram:d,solidProgram:c,chairProgram:v,seatGeometry:l,chairGeometry:S,solidGeometry:s,drawCalls:3,setNearSeats(X,Q){let q=Math.min(Q,C);if(H=X,T=q,q===0){E.parent&&E.setParent(null),S.instancedCount=0,D.drawCalls=3+(w?1:0);return}let K=t.seats;for(let Z=0;Z<q;Z++){let te=X[Z];P[Z*3]=K.iPosition[te*3],P[Z*3+1]=K.iPosition[te*3+1],P[Z*3+2]=K.iPosition[te*3+2],R[Z]=K.iChairWidth[te],k[Z]=K.iYaw[te],z[Z]=K.iGlyph[te],V[Z*3]=K.iRing[te*3],V[Z*3+1]=K.iRing[te*3+1],V[Z*3+2]=K.iRing[te*3+2],L[Z]=K.iFloor[te],A[Z]=K.iPhysicalSeat[te],_[Z]=te+1}N(),S.attributes.iOffset.needsUpdate=!0,S.attributes.iRadius.needsUpdate=!0,S.attributes.iYaw.needsUpdate=!0,S.attributes.iGlyph.needsUpdate=!0,S.attributes.iRing.needsUpdate=!0,S.attributes.iFloor.needsUpdate=!0,S.attributes.iPhysicalSeat.needsUpdate=!0,S.attributes.iSeed.needsUpdate=!0,S.attributes.iPickIndex.needsUpdate=!0,S.instancedCount=q,E.parent||E.setParent(n),D.drawCalls=4+(w?1:0)},nearSeatCount(){return T},setSectionShellLit(X){let Q=ba(t.sectionSolidRanges,t.solids.color,h,x,X,y);if(!Q.length)return;let q=s.attributes.color,K=q.buffer;if(!K){q.needsUpdate=!0;return}e.bindBuffer(e.ARRAY_BUFFER,K);for(let Z of Q){let te=t.solids.color.subarray(Z.start*3,(Z.start+Z.count)*3);e.bufferSubData(e.ARRAY_BUFFER,Z.start*3*Float32Array.BYTES_PER_ELEMENT,te)}},uploadSeatStateRuns(X){if(!X.length)return;T&&N();for(let q of X)ya(f,t.seats.iState,q.start,q.length,m,t.seats.iCategory);let Q=b.buffer;if(!Q){b.needsUpdate=!0;return}e.bindBuffer(e.ARRAY_BUFFER,Q);for(let q of X){let K=f.subarray(q.start*3,(q.start+q.length)*3);e.bufferSubData(e.ARRAY_BUFFER,q.start*3*Float32Array.BYTES_PER_ELEMENT,K)}},dispose(){F=!0,o.remove(),i.remove(),s.remove(),c.remove(),l.remove(),d.remove(),S.remove(),v.remove(),I?.remove(),O?.remove(),j?.texture&&e.deleteTexture(j.texture)}},W=t.productionElements.find(X=>X.contentImageUrl&&X.contentPlane);if(W?.contentImageUrl&&W.contentPlane?.length===4&&typeof Image<"u"){let X=new Image;X.crossOrigin="anonymous",X.onload=()=>{if(F)return;let Q=W.contentPlane;I=new ce.Geometry(e,{position:{size:3,data:new Float32Array(Q.flat())},uv:{size:2,data:new Float32Array([0,1,1,1,0,0,1,0])},floorIndex:{size:1,data:new Float32Array(4).fill(W.floorIndex)},index:{data:new Uint16Array([0,1,2,2,1,3])}}),j=new ce.Texture(e,{image:X,generateMipmaps:!0,wrapS:e.CLAMP_TO_EDGE,wrapT:e.CLAMP_TO_EDGE,flipY:!1}),O=new ce.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:j},uFocusFloor:{value:-1}},transparent:!1,depthTest:!0,depthWrite:!0,cullFace:!1});let q=new ce.Mesh(e,{geometry:I,program:O});q.frustumCulled=!1,q.setParent(n),D.screenProgram=O,w=!0,D.drawCalls=3+(T?1:0)+1},X.src=W.contentImageUrl}return D}var _e=require("ogl");function wm(e,t,n){let r=e+(t<<8)+(n<<16);return r===0?-1:r-1}function ga(e,t,n,r,o,i){let a=-1,s=1/0;for(let c=0;c<n;c++)for(let m=0;m<t;m++){let u=(c*t+m)*4,p=wm(e[u],e[u+1],e[u+2]);if(p<0||p>=i)continue;let d=m-r,l=c-o,f=d*d+l*l;f<s&&(s=f,a=p)}return a}function xa(e,t,n,r,o,i){let a=e-n.left,s=t-n.top,c=Math.round(a*r),m=Math.round((n.height-s)*r);return{x:Math.max(0,Math.min(o-1,c)),y:Math.max(0,Math.min(i-1,m))}}var Pm=["uSeatRadius","uSeatScale","uMinPixels","uPixelToWorld"],Pn=class{constructor(t,n,r,o,i){this.seatScene=new _e.Transform;this.chairScene=new _e.Transform;this.solidScene=new _e.Transform;this.target=null;this.restoreClear=[0,0,0];this.renderer=t,this.gl=t.gl,this.maxIndex=i,this.seatProg=sa(this.gl),this.chairProg=ca(this.gl),this.depthProg=la(this.gl);let a=new _e.Mesh(this.gl,{geometry:n,program:this.seatProg});a.frustumCulled=!1,a.setParent(this.seatScene);let s=new _e.Mesh(this.gl,{geometry:r,program:this.chairProg});s.frustumCulled=!1,s.setParent(this.chairScene);let c=new _e.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 Pm)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 _e.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,m=Math.max(0,n-o),u=Math.max(0,r-o),p=Math.max(1,Math.min(s,n+o+1)-m),d=Math.max(1,Math.min(c,r+o+1)-u);i.enable(i.SCISSOR_TEST),i.scissor(m,u,p,d);let[l,f,b]=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(l,f,b,1),i.disable(i.SCISSOR_TEST);let h=new Uint8Array(p*d*4);return this.renderer.bindFramebuffer(a),i.readPixels(m,u,p,d,i.RGBA,i.UNSIGNED_BYTE,h),this.renderer.bindFramebuffer(),ga(h,p,d,n-m,r-u,this.maxIndex)}dispose(){this.destroyTarget(),this.seatProg.remove(),this.chairProg.remove(),this.depthProg.remove()}};function va(e,t){let n=[];for(let r of t)e.has(r.seatId)?e.set(r.seatId,It(r.state)):n.push(r);return n}function Sa(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:pe[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 Cm(e,t){return[e[0]-t[0],e[1]-t[1],e[2]-t[2]]}function Ma(e,t){return[e[0]+t[0],e[1]+t[1],e[2]+t[2]]}function Am(e,t){return[e[0]*t,e[1]*t,e[2]*t]}function wa(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 Eo(e){let t=Math.max(0,Math.min(1,e));return t*t*t*(t*(t*6-15)+10)}function Io(e,t){return Math.max(0,Math.min(1,e+t))}function Pa(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],m=e[i+1],u=e[Math.min(n-1,i+2)],p=a*a,d=p*a,l=[0,0,0];for(let f=0;f<3;f++)l[f]=.5*(2*c[f]+(-s[f]+m[f])*a+(2*s[f]-5*c[f]+4*m[f]-u[f])*p+(-s[f]+3*c[f]-3*m[f]+u[f])*d);return l}function To(e,t,n,r,o){let i=wa(Cm(t,n));i[0]===0&&i[1]===0&&i[2]===0&&(i=[0,0,1]);let a=Ma(Ma(t,Am(i,2.5)),[0,1.5,0]),s=[t[0]-r[0],0,t[2]-r[2]],c=wa(s);c[0]===0&&c[2]===0&&(c=[i[0],0,i[2]]);let m=Math.max(1,o),u=[r[0]+c[0]*m*1.3,r[1]+m*.75,r[2]+c[2]*m*1.3];return{waypoints:[e,u,a],finalPos:a}}function _o(e,t,n=35,r=28){let o=Eo(t),i=Pa(e,o),a=Eo(Math.max(0,Math.min(1,(t-.66)/.34)));return{pos:i,fov:n+(r-n)*a,eased:o}}function Ea(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 Cn=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}=_o(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,Io(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 Ia=eo,Rm=.12,Em=.25,Im=1.5;function Ta(e,t,n=0,r,o){let i=[t.x*G,n+Im,t.y*G],a=o?[o[0],o[1],o[2]]:i,s=e[1],c=Number.isFinite(s)?s+Ia:Number.isFinite(r)?n+r:n+Ia,m=i[0]-e[0],u=i[2]-e[2],p=Math.hypot(m,u),d=p>.001?Math.min(Rm,p*Em):0,l=p>.001?m/p:0,f=p>.001?u/p:0;return{eye:[e[0]+l*d,c,e[2]+f*d],focal:a}}var st=Math.PI/180,Tm=45,_a=80,An=70,_m=1,Lm=.99;function km(e,t){if(!(e<_m))return _a;if(!(Number.isFinite(t)&&t>0))return An;let n=2*Math.atan(t/(2*Rn*Lm)/Math.max(.05,e))/st;return Math.max(An,Math.min(_a,n))}var Fm=.25,Rn=1,Dm=.25,Om=12*st,Vm=.2,Bm=1.5,La=.8,ka=6,Va=1.9,Nm=2/3,Gm=.12,zm=.9,Um=1.2,Hm=2,Ba=.05,jm=6;function Na(e,t,n=0){if(!e.length)return{min:[t[0]-6,n,t[2]-6],max:[t[0]+6,Math.max(n+La,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,m=a-i,u=Math.max(c,Math.min(m,ka))/2,p=Math.max(m,Math.min(c,ka))/2,d=(r+o)/2,l=(i+a)/2;return{min:[d-u,n,l-p],max:[d+u,Math.max(n+La,s),l+p]}}function Ym(e){return{min:[e.min[0],e.min[1],e.min[2]],max:[e.max[0],e.max[1]+Va,e.max[2]]}}function Lo(e){let t=e.max[1];return[(e.min[0]+e.max[0])/2,Math.max(e.min[1]+Bm,t+Vm,t+Va*Nm),(e.min[2]+e.max[2])/2]}function Ga(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 Fa(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,m=Math.hypot(s,c);if(m<1e-6)return 1/0;s/=m,c/=m;let u=1/0,p=-1/0;for(let d=0;d<8;d++){let l=(d&1?n.max[0]:n.min[0])-e[0],f=(d&2?n.max[1]:n.min[1])-e[1],b=(d&4?n.max[2]:n.min[2])-e[2],h=Math.max(Ba,l*r+f*o+b*i),y=(l*s+b*c)/h;y<u&&(u=y),y>p&&(p=y)}return p-u}function Da(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,m=Math.hypot(s,c);if(m<1e-6)return 1/0;s/=m,c/=m;let u=-c*o,p=c*r-s*i,d=s*o,l=1/0,f=-1/0;for(let b=0;b<8;b++){let h=(b&1?n.max[0]:n.min[0])-e[0],y=(b&2?n.max[1]:n.min[1])-e[1],x=(b&4?n.max[2]:n.min[2])-e[2],g=Math.max(Ba,h*r+y*o+x*i),v=(h*u+y*p+x*d)/g;v<l&&(l=v),v>f&&(f=v)}return f-l}function En(e,t){return Math.tan(e*st/2)*Math.max(.05,t)}function Oa(e,t,n){let r=km(n,e),o=c=>Math.max(Tm,Math.min(r,c)),i=c=>2*Math.atan(c)/st,a=Number.isFinite(e)&&e>0?o(i(e/(2*Fm)/Math.max(.05,n))):r;if(!(Number.isFinite(t)&&t>0))return a;let s=Math.min(a,o(i(t/(2*Gm))));return e/(2*En(s,n))>Rn?a:s}function za(e,t,n){let r=Lo(t),o=[e[0],e[1],e[2]],i=0,a=0,s=l=>{if(!(l>0))return;let f=Ga(o,r);o[0]+=f.x*l,o[2]+=f.z*l,a+=l},c=t.max[1]+Dm-o[1];c>0&&(o[1]+=c,i=c,s(c/Math.tan(Om)));let m=Ym(t),u=Fa(o,r,t),p=Oa(u,Da(o,r,m),n),d=u/(2*En(p,n));for(let l=0;l<jm&&d>Rn;l++){let f=Math.max(1,Math.hypot(o[0]-r[0],o[2]-r[2])),b=Number.isFinite(d)?d/Rn:2;s(Math.min(60,f*(Math.min(4,b)-1)+.5)),u=Fa(o,r,t),p=Oa(u,Da(o,r,m),n),d=u/(2*En(p,n))}return{eye:o,focal:r,fov:p,raisedM:i,pulledBackM:a,stageFrameWidth:d}}function Xm(e,t,n){let r=Math.tan(t*st/2),o=En(t,n);return Math.max(1,e/Math.max(.05,Math.min(r,o)))}function Ua(e,t){let{aspect:n,venue:r}=t,o=e.focal,i=Ga(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=Hm*(t.rowDepthM??zm);s.push({name:"row",eye:[e.eye[0]+i.x*c,e.eye[1]+Um,e.eye[2]+i.z*c],focal:o,fov:e.fov});let m=(d,l,f,b)=>{let h=Xm(f,e.fov,n)*1.08,y=h*Math.sin(b*st),x=h*Math.cos(b*st);return{name:d,eye:[l[0]+i.x*x,l[1]+y,l[2]+i.z*x],focal:l,fov:e.fov}};t.section&&t.section.radius>0&&s.push(m("section",t.section.center,t.section.radius,14)),s.push(m("venue",r.center,Math.max(1,r.radius),26));let u=[],p=-1/0;for(let d of s){let l=a(d.eye);u.length&&l<=p+.5||(u.push(d),p=l)}return u}var Wa=require("ogl"),jt=Math.PI/180,Ha=320,ja=70*jt,Wm=32*jt,Km=24*jt,Ya=.0026,qm=.22,$m=.006,Qm=180,Zm=4,Se=(e,t,n)=>Math.max(t,Math.min(n,e)),Xa=e=>e<.5?4*e*e*e:1-Math.pow(-2*e+2,3)/2;function Ka(e){let{canvas:t,camera:n}=e,r=[],o=!1,i=0,a=0,s=0,c=0,m=0,u=0,p=!1,d=[0,0],l=0,f=!1,b=null,h=null,y=new Map,x=!1,g=0,v=0,R=0,P=0,M=()=>o&&r.length?r[Se(Math.round(i),0,r.length-1)].name:null,A=()=>{let w=M();w!==b&&(b=w,e.onStopChange?.(w))},k=()=>{if(!o||!r.length)return;let w=r[Se(Math.floor(i),0,r.length-1)],F=r[Se(Math.ceil(i),0,r.length-1)],I=Se(i-Math.floor(i),0,1),O=(Me,Ae)=>Me+(Ae-Me)*I,j=[O(w.eye[0],F.eye[0]),O(w.eye[1],F.eye[1]),O(w.eye[2],F.eye[2])],H=[O(w.focal[0],F.focal[0]),O(w.focal[1],F.focal[1]),O(w.focal[2],F.focal[2])],N=H[0]-j[0],D=H[1]-j[1],W=H[2]-j[2],X=Math.hypot(N,D,W)||1,Q=Math.atan2(N,W),q=Math.asin(Se(D/X,-1,1)),K=Q+a,Z=Se(q+s,-80*jt,80*jt),te=Math.cos(Z)*X;N=Math.sin(K)*te,D=Math.sin(Z)*X,W=Math.cos(K)*te,n.position.set(j[0],j[1],j[2]),n.fov=O(w.fov,F.fov),n.updateProjectionMatrix(),n.lookAt(new Wa.Vec3(j[0]+N,j[1]+D,j[2]+W)),e.onApplied?.()},z=()=>{if(!o||!r.length)return;let w=Se(Math.round(i),0,r.length-1);if(e.reducedMotion()){p=!1,i=w,k(),A(),e.requestRender();return}if(Math.abs(w-i)<.001){p=!1,A();return}c=i,m=w,u=performance.now(),p=!0,e.requestRender()},V=w=>{!o||r.length<2||(p=!1,i=Se(i+w,0,r.length-1),k(),A(),e.requestRender())},L=(w,F)=>{o&&(p=!1,f=!1,a=Se(a-w*Ya,-ja,ja),s=Se(s-F*Ya,-Km,Wm),k(),e.requestRender())},C=w=>{o&&(y.set(w.pointerId,{x:w.clientX,y:w.clientY}),y.size===1?(x=!0,P=0,g=w.clientX,v=w.clientY):y.size===2&&(x=!1,R=_()))},_=()=>{let w=[...y.values()];return w.length<2?0:Math.hypot(w[0].x-w[1].x,w[0].y-w[1].y)},B=w=>{if(!o||!y.has(w.pointerId))return;if(y.set(w.pointerId,{x:w.clientX,y:w.clientY}),y.size>=2){let O=_();R>0&&V((R-O)*$m),R=O;return}if(!x)return;let F=w.clientX-g,I=w.clientY-v;g=w.clientX,v=w.clientY,P+=Math.abs(F)+Math.abs(I),!(P<=Zm)&&L(F,I)},S=w=>{y.delete(w.pointerId)&&(y.size<2&&(R=0),y.size===0&&(x=!1,z()))},E=w=>{if(!o)return;w.preventDefault();let F=w.deltaMode===1?16:w.deltaMode===2?100:1,I=Se(w.deltaY*F/100,-2,2);V(I*qm),h&&clearTimeout(h),h=setTimeout(()=>{h=null,z()},Qm)},T=()=>{o&&(o=!1,p=!1,f=!1,r=[],y.clear(),x=!1,h&&(clearTimeout(h),h=null),b!==null&&(b=null,e.onStopChange?.(null)))};return t.addEventListener("pointerdown",C),t.addEventListener("pointermove",B),t.addEventListener("pointerup",S),t.addEventListener("pointercancel",S),t.addEventListener("wheel",E,{passive:!1}),{get active(){return o},enter(w){if(w.length<2){T();return}r=w,o=!0,i=0,a=0,s=0,p=!1,f=!1,b=null,k(),A(),e.requestRender()},exit:T,recentre(){return o?Math.abs(a)<1e-4&&Math.abs(s)<1e-4?!0:e.reducedMotion()?(f=!1,a=0,s=0,k(),e.requestRender(),!0):(d=[a,s],l=performance.now(),f=!0,e.requestRender(),!0):!1},update(w){if(!o)return!1;let F=!1;if(f){let I=Se((w-l)/Ha,0,1),O=1-Xa(I);a=d[0]*O,s=d[1]*O,I>=1?(f=!1,a=0,s=0):F=!0}if(p){let I=Se((w-u)/Ha,0,1);i=c+(m-c)*Xa(I),I>=1?(p=!1,i=m,A()):F=!0}return k(),F},currentStop:M,dispose(){T(),t.removeEventListener("pointerdown",C),t.removeEventListener("pointermove",B),t.removeEventListener("pointerup",S),t.removeEventListener("pointercancel",S),t.removeEventListener("wheel",E)}}}function qa(e){return e.flying?"cinematic":e.panoramaMounted?"panorama":e.seatViewActive?"seatView":"orbit"}var Oo=null;function cs(){return Oo??=Promise.resolve().then(()=>(ss(),as)).catch(e=>{throw Oo=null,e}),Oo}var ls=()=>typeof performance<"u"&&performance.now?performance.now():Date.now(),Dn=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=ls(),this.emit("3d_panorama_opened")}panoramaClosed(){let t=this.panoramaOpenedAt?Math.round(ls()-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 us(e){let t=e.style.position;return getComputedStyle(e).position!=="static"?()=>{}:(e.style.position="relative",()=>{e.style.position==="relative"&&(e.style.position=t)})}function ms(e){let{container:t,model:n,opts:r,expandedSeatById:o,seatIdsByRow:i,isNarrow:a}=e,s=null,c=()=>{if(!s)return;let p=a();Object.assign(s.style,p?{left:"12px",right:"12px",bottom:"70px",transform:"none",justifyContent:"center"}:{left:"50%",right:"auto",bottom:"18px",transform:"translateX(-50%)",justifyContent:"initial"})},m=()=>{s?.remove(),s=null};return{show:(p,d,l=!1)=>{if(m(),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 b=r.chrome?.caption!==!1,h=r.chrome?.seatStepper!==!1;if(!b&&!h)return null;let y=o.get(p),x=y?.sectionId?n.sections.find(z=>z.id===y.sectionId):void 0,g=y?.label??p;f.setAttribute("aria-label",`Explore views near ${x?.label?`${x.label}, `:""}seat ${g}`);let v=document.createElement("span");v.textContent=r.seatViewCaption?.(p)??["Live 3D seat view",x?.label,g].filter(Boolean).join(" \xB7 "),Object.assign(v.style,{maxWidth:"min(70vw, 560px)",padding:"5px 10px",borderRadius:"999px",overflow:"hidden",color:"#d9e3f5",background:"rgba(12,18,32,0.72)",font:"600 11px/1.2 inherit",textOverflow:"ellipsis",whiteSpace:"nowrap",backdropFilter:"blur(6px)"}),b&&f.appendChild(v);let R=document.createElement("div");Object.assign(R.style,{display:"flex",alignItems:"center",justifyContent:"center",gap:"6px"}),f.appendChild(R);let P=y?.rowId?i.get(y.rowId):void 0,M=P?.indexOf(p)??-1,A=M>=0?[P?.[M-1],P?.[M+1]]:[void 0,void 0],k=(z,V,L,C=!1)=>{let _=document.createElement("button");_.type="button",_.textContent=z,_.setAttribute("aria-label",V),Object.assign(_.style,{minHeight:"44px",padding:C?"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"}),C||(_.style.minWidth="44px"),C&&(_.dataset.panoramaTrigger=""),_.addEventListener("click",L),R.appendChild(_)};if(h&&A[0]){let z=o.get(A[0])?.label??A[0];k("\u2039",`View previous seat ${z}`,()=>{e.flyToSeat(A[0])})}if(h&&r.getSeatView){let z=r.seatViewActionLabel?.(p)??"Open 360\xB0 panorama";k(l?`\u21BB Retry ${z}`:`\u25C9 ${z}`,`${l?"Retry":z} from seat ${g}`,()=>{if(e.isDisposed()||d!==e.flightGen()){m();return}m(),e.openPanorama(p,400,d)},!0)}if(h&&A[1]){let z=o.get(A[1])?.label??A[1];k("\u203A",`View next seat ${z}`,()=>{e.flyToSeat(A[1])})}return!R.childElementCount&&!b?null:(t.appendChild(f),s=f,c(),f)},remove:m,layout:c}}var fd={rotate:"Drag to rotate the venue",move:"Drag to move the venue",zoomIn:"Zoom in",zoomOut:"Zoom out",fitView:"Show whole venue"};function ds(e){let{container:t,orbit:n,isNarrow:r}=e,o={...fd,...e.labels??{}},i=(g,v)=>{g.setAttribute("aria-label",v),g.title=v},a=document.createElement("div"),s=!1;a.className="sl-3d-navigation-controls",Object.assign(a.style,{position:"absolute",right:"14px",bottom:"14px",display:"flex",zIndex:"4",flexDirection:"column",alignItems:"flex-end",gap:"7px"});let c=document.createElement("div");c.setAttribute("role","group"),c.setAttribute("aria-label","3D drag mode"),Object.assign(c.style,{display:"flex",flexDirection:"column",gap:"6px",alignItems:"flex-end"});let m=document.createElement("div");m.setAttribute("role","group"),m.setAttribute("aria-label","3D view controls"),Object.assign(m.style,{display:"flex",flexDirection:"column",gap:"6px",alignItems:"flex-end"});let u=document.createElement("button");u.type="button",u.textContent="\u21BB",i(u,o.rotate);let p=document.createElement("button");p.type="button",p.textContent="\u2725",i(p,o.move);let d=document.createElement("button");d.type="button",d.textContent="\u2212",i(d,o.zoomOut);let l=document.createElement("button");l.type="button",l.textContent="+",i(l,o.zoomIn);for(let g of[u,p,d,l])g.className="sl-3d-icon-control",Object.assign(g.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"});c.append(u,p),m.append(l,d);let f=g=>{n.setPrimaryDragMode(g);let v=g==="orbit";u.setAttribute("aria-pressed",String(v)),p.setAttribute("aria-pressed",String(!v)),u.style.background=v?"rgba(96,110,150,0.68)":"rgba(12,18,32,0.82)",p.style.background=v?"rgba(12,18,32,0.82)":"rgba(96,110,150,0.68)",a.title=v?`${o.rotate} \xB7 ${o.move} with Shift`:`${o.move} \xB7 ${o.rotate} with Shift`};u.addEventListener("click",()=>f("orbit")),p.addEventListener("click",()=>f("pan"));let b=()=>{let{atMin:g,atMax:v}=n.dollyLimitState();l.disabled!==g&&(l.disabled=g),d.disabled!==v&&(d.disabled=v)};d.addEventListener("click",()=>{n.zoomBy(Tt),b()}),l.addEventListener("click",()=>{n.zoomBy(pt),b()}),a.append(c,m),f("orbit"),t.appendChild(a);let h=e.enabled!==!1,y=()=>{let g=r();a.style.display=s||!h?"none":"flex",a.style.right=g?"12px":"14px",a.style.bottom=g?"calc(env(safe-area-inset-bottom, 0px) + 76px)":"14px",c.style.display=g?"none":"flex",l.style.display=g?"none":"",d.style.display=g?"none":""};return y(),{element:a,utilityControls:m,setNavigationMode:f,syncZoomLimits:b,setSeatViewLocked:g=>{s=g,n.setInteractionEnabled(!g),y()},seatViewLocked:()=>s,layout:y}}var pd=12;function hd(e,t){if(!e)return!1;let n=e.x-t[0],r=e.y-t[1],o=e.z-t[2];return Math.hypot(n,r,o)>pd}function fs(e){let{glctx:t,orbit:n,model:r,seats:o,opts:i,cinematic:a,analytics:s,seatIdByIndex:c,sectionIdBySeatId:m,tapSlop:u,tapMs:p,cancelFlight:d,focusSectionCamera:l,setSelection:f,ensureSeatView:b}=e,h=0,y=0,x=0,g=-1,v=!1,R=!1,P=V=>{e.seatViewLocked()||g===-1&&(g=V.pointerId,h=V.clientX,y=V.clientY,x=performance.now(),v=!1,R=a.active,a.active&&(s.cinematicCancelled(),d(),i.onViewTargetChange?.(null)))},M=V=>{V.pointerId===g&&Math.hypot(V.clientX-h,V.clientY-y)>u&&(v=!0)},A=(V,L,C,_,B)=>{let S=t.canvas.getBoundingClientRect(),E=t.canvas.clientWidth||S.width||1,T=t.canvas.clientHeight||S.height||1,w=V-S.left,F=L-S.top,I=_*_,O=-1,j=I,H=1/0;for(let N of o){if(C&&N.sectionId!==C)continue;let D=r.seats.idToIndex.get(N.id);if(D===void 0)continue;if(B){let Z=Math.round(r.seats.iState[D]??0);if(Z!==0&&Z!==3)continue}let W=D*3,X=Ye(n.camera.projectionViewMatrix,[r.seats.iPosition[W],r.seats.iPosition[W+1]+.55,r.seats.iPosition[W+2]],E,T);if(!X.visible)continue;let Q=X.x-w,q=X.y-F,K=Q*Q+q*q;(K<j||Math.abs(K-j)<1&&X.depth<H)&&(O=D,j=K,H=X.depth)}return O},k=(V,L)=>{let C=e.gpu(),_=e.pick();if(!C||!_)return-1;_.syncFromSeatProgram(C.seatProgram);let B=t.canvas.getBoundingClientRect(),S=t.renderer.dpr,{x:E,y:T}=xa(V,L,B,S,t.gl.drawingBufferWidth,t.gl.drawingBufferHeight),w=Math.max(2,Math.round(8*S));return _.pick(n.camera,E,T,w)};return{onDown:P,onMove:M,onUp:V=>{if(V.pointerId!==g)return;let L=!v&&performance.now()-x<p;if(g=-1,R){R=!1;return}let C=e.gpu(),_=e.pick();if(!L||!C||!_)return;let B=k(V.clientX,V.clientY);if(e.focusedSectionId()&&B>=0){let T=c[B],w=T?m.get(T):void 0;if(w&&w!==e.focusedSectionId()&&l(w))return}if(e.focusedSectionId()&&B<0&&(B=A(V.clientX,V.clientY,e.focusedSectionId(),44,!1)),e.focusedSectionId()&&B<0){let T=A(V.clientX,V.clientY,null,72,!1),w=T>=0?c[T]:void 0,F=w?m.get(w):void 0;if(F&&F!==e.focusedSectionId()&&l(F))return}if(!e.focusedSectionId()){B<0&&(B=A(V.clientX,V.clientY,null,42,!1));let T=B>=0?c[B]:void 0,w=T?m.get(T):void 0;if(w&&l(w))return}if(B<0||B>=c.length){e.selection().size&&(f([]),i.onViewTargetChange?.(null));return}let S=c[B],E=pe[Math.round(r.seats.iState[B]??0)]??"available";if(E!=="available"&&E!=="selected"){i.onSeatInspect?.(S,E);return}if(e.selection().has(S)&&e.selection().size===1){f([]),i.onViewTargetChange?.(null),i.onSeatPick?.(S);return}if(f([S]),b(S),s.seatPicked(S,m.get(S)),i.onSeatPick?.(S),e.focusedSectionId()){let T=B*3,w=[r.seats.iPosition[T],r.seats.iPosition[T+1],r.seats.iPosition[T+2]];hd(n.camera?.position,w)&&e.focusSeatCamera(S)}}}}var On=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 l=0;l<this.count;l++){let f=t[l*3],b=t[l*3+2];f<n&&(n=f),f>o&&(o=f),b<r&&(r=b),b>i&&(i=b)}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,m=new Int32Array(c+1),u=l=>{let f=Math.min(this.cols-1,Math.max(0,Math.floor((t[l*3]-n)/this.cell)));return Math.min(this.rows-1,Math.max(0,Math.floor((t[l*3+2]-r)/this.cell)))*this.cols+f};for(let l=0;l<this.count;l++)m[u(l)+1]++;for(let l=0;l<c;l++)m[l+1]+=m[l];let p=new Int32Array(this.count),d=m.slice(0,c);for(let l=0;l<this.count;l++)p[d[u(l)]++]=l;this.cellStart=m,this.cellItems=p}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,m=Math.floor((t-this.minX)/this.cell),u=Math.floor((n-this.minZ)/this.cell),p=Math.ceil(r/this.cell)+1,d=this.iPosition,l=0;for(let f=0;f<=p&&l<s;f++){let b=u-f,h=u+f,y=m-f,x=m+f;for(let g=b;g<=h&&l<s;g++){if(g<0||g>=this.rows)continue;let v=g===b||g===h;for(let R=y;R<=x&&l<s;R++){if(!v&&R!==y&&R!==x){R=x-1;continue}if(R<0||R>=this.cols)continue;let P=g*this.cols+R;for(let M=i[P],A=i[P+1];M<A&&l<s;M++){let k=a[M],z=d[k*3]-t,V=d[k*3+2]-n;z*z+V*V<=c&&(o[l++]=k)}}}}return l}};var Vn=class{constructor(t){this.ctx=t;this.detailVisible=!1;this.seatDetailMix=0;this.structureDetailMix=0;this.nearBuf=new Int32Array(en);this.lastGatherX=1/0;this.lastGatherZ=1/0;this.nearIndex=new On(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)<Wn)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>Xn){r.nearSeatCount()&&r.setNearSeats(this.nearBuf,0);return}let s=this.nearIndex.gather(o.x,o.z,Xn,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 Bn=require("ogl");function ps(){let e="http://www.w3.org/2000/svg",t=document.createElementNS(e,"svg");t.setAttribute("viewBox","0 0 24 24"),t.setAttribute("width","18"),t.setAttribute("height","18"),t.setAttribute("aria-hidden","true"),t.setAttribute("focusable","false"),t.setAttribute("fill","none"),t.setAttribute("stroke","currentColor"),t.setAttribute("stroke-width","2"),t.setAttribute("stroke-linecap","round"),t.setAttribute("stroke-linejoin","round");let n=document.createElementNS(e,"path");return n.setAttribute("d","M8 3H5a2 2 0 0 0-2 2v3M16 3h3a2 2 0 0 0 2 2v3M8 21H5a2 2 0 0 0-2-2v-3M16 21h3a2 2 0 0 0 2-2v-3"),t.appendChild(n),t}function ys(e){let{container:t,model:n,opts:r,orbit:o,cinematic:i,analytics:a,loop:s,labelOverlay:c,stageAzimuth:m,overviewFraming:u}=e,p=0,d=-1,l=(M,A,k=28)=>{o.camera.position.set(M[0],M[1],M[2]),o.camera.lookAt(new Bn.Vec3(A[0],A[1],A[2])),o.camera.fov=k,o.camera.updateProjectionMatrix()},f=document.createElement("button");f.className="sl-3d-overview-control sl-3d-icon-control",f.type="button",f.replaceChildren(ps());let b=r.navLabels?.fitView??"Show whole venue";f.setAttribute("aria-label",b),f.title=b,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.firstElementChild||f.replaceChildren(ps())};h();let y=M=>{d=M;let A=e.gpu();A&&(A.seatProgram.uniforms.uFocusFloor.value=M,A.solidProgram.uniforms.uFocusFloor.value=M,A.chairProgram.uniforms.uFocusFloor.value=M),e.showSectionSeatLabels(null)},x=()=>{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 M=d>=0?n.floors[d]:null;if(e.setNearFieldDetailEnabled(!!M),e.setSeatViewLocked(!1),g(),e.removeArriveChip(),e.setNavigationMode("orbit"),M){let A=M.focalWorld[0]-M.center[0],k=M.focalWorld[2]-M.center[2],z=Math.hypot(A,k)>M.radius*.12?Math.atan2(A,k):m,V={center:M.center,radius:M.radius,box:M.box},L={polarDeg:58,margin:1.12};e.reducedMotion()?o.frame(V,!1,z,!1,L):o.frameSoft(V,z,!1,L)}else e.reducedMotion()?o.frame(n.bounds,!1,m,r.portraitOverviewCrop===!0,u):o.frameSoft(n.bounds,m,r.portraitOverviewCrop===!0,u);e.showSectionSeatLabels(null),s.requestRender()},g=()=>{p++,e.setSeatStepping(!1),e.panoramaLoadAbort()?.abort(),e.setPanoramaLoadAbort(null),i.active&&(i.cancel(),o.resumeAfterFlight(n.focalWorld))},v=M=>{if(e.isDisposed()||!e.gpu())return Promise.resolve();let A=n.seats.idToIndex.get(M);if(A===void 0)return Promise.resolve();e.setNearFieldDetailEnabled(!0),r.onViewTargetChange?.(M),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 k=e.inSeatView()&&r.arriveAtSeatEye===!0;e.setSeatStepping(k),e.setSeatViewLocked(!1);let z=++p;k?e.showArriveChip(M,z):e.removeArriveChip();let{eye:V,focal:L}=e.resolvedSeatViewPose(M,A),C=r.arriveAtSeatEye?e.seatViewArrival(M,A):null,_=C?C.focal:L,B=[o.camera.position.x,o.camera.position.y,o.camera.position.z],S=To(B,C?.eye??V,_,n.bounds.center,n.bounds.radius),E=C?C.eye:r.arriveAtSeatEye?V:S.finalPos,T=C?C.fov:r.arriveAtSeatEye?t.clientWidth/Math.max(1,t.clientHeight)<.7?An:65:28,w=[S.waypoints[0],S.waypoints[1],E];if(c.setVisible(!1),e.reducedMotion())return e.setSeatStepping(!1),l(E,_,T),s.requestRender(),a.cinematicSkipped(),e.isDisposed()||o.syncFromCamera(),e.setSeatViewLocked(r.arriveAtSeatEye===!0),C&&e.enterSeatView(C.stops),e.showArriveChip(M,z),Promise.resolve();let F=new Bn.Quat().copy(o.camera.quaternion),I=Ea(o.camera,E,_);s.requestRender();let O=k?700:2500;return i.start(w,F,I,O,T).then(()=>{e.isDisposed()||z!==p||(e.setSeatStepping(!1),a.cinematicPlayed(O),o.resumeAfterFlight(_),e.setSeatViewLocked(r.arriveAtSeatEye===!0),C&&e.enterSeatView(C.stops),s.requestRender(),e.showArriveChip(M,z))})},R=M=>{let A=n.sections.find(L=>L.id===M);if(!A||A.seatCount===0)return!1;e.setNearFieldDetailEnabled(!0),e.setSeatStepping(!1),e.setSeatViewLocked(!1),i.cancel(),e.removeArriveChip(),n.floors.length>1&&d!==A.floorIndex&&y(A.floorIndex),e.setNavigationMode("pan"),e.showSectionSeatLabels(M);let k=A.focalWorld[0]-A.center[0],z=A.focalWorld[2]-A.center[2],V=Math.hypot(k,z)>A.radius*.12?Math.atan2(k,z):void 0;return o.frame({center:A.center,radius:Math.max(5,A.radius*.5)},!1,V),r.onSectionFocusChange?.(M),s.requestRender(),!0},P=M=>{if(e.isDisposed()||!e.gpu())return!1;let A=n.seats.idToIndex.get(M);if(A===void 0)return!1;let k=A*3,z=[n.seats.iPosition[k],n.seats.iPosition[k+1]+.55,n.seats.iPosition[k+2]];return e.reducedMotion()?o.frame({center:z,radius:hs},!1,void 0,!1,bs):o.frameSoft({center:z,radius:hs},void 0,!1,bs),s.requestRender(),!0};return f.addEventListener("click",x),{overviewChip:f,layoutOverviewChip:h,flightGen:()=>p,focusedFloor:()=>d,applyFloorFocus:y,placeCameraFinal:l,cancelFlight:g,focusOverview:x,flyToSeat:v,focusSectionCamera:R,focusSeatCamera:P}}var hs=4.5,bs={polarDeg:48,margin:1.25};var yd={};function gs(e){let t=performance.now();return{model:St(e),buildMs:performance.now()-t,source:"main"}}function bd(e){let t=Wr(e.doc);return{...gs({...e,seats:t}),seats:t}}function xs(e,t,n){if(typeof Worker>"u")return Promise.resolve(t());let r;try{r=new Worker(new URL("./scene/scene.worker.js",yd.url),{type:"module"})}catch{return Promise.resolve(t())}return new Promise(o=>{let i=!1,a=m=>{i||(i=!0,clearTimeout(c),r.terminate(),o(m))},s=()=>a(t()),c=window.setTimeout(s,15e3);r.onerror=s,r.onmessage=m=>{let u=n(m.data);u?a(u):s()},r.postMessage(e)})}function vs(e){return xs(e,()=>gs(e),({model:t,buildMs:n})=>({model:t,buildMs:n,source:"worker"}))}function Ss(e){return xs(e,()=>bd(e),({model:t,buildMs:n,seats:r})=>r?{model:t,buildMs:n,seats:r,source:"worker"}:null)}var gd=Math.PI/180,xd=6,vd=500;function Sd(e,t,n={}){let r=performance.now(),o=t.prepared?.model??St(t),i=new Dn(n.onAnalytics),a=new Array(o.seats.count);for(let[U,Y]of o.seats.idToIndex)a[Y]=U;let s=new Map(t.seats.map(U=>[U.id,U])),c=new Map;for(let U of t.seats){if(!U.rowId)continue;let Y=c.get(U.rowId);Y?Y.push(U.id):c.set(U.rowId,[U.id])}let m=new Map;for(let U of t.seats)m.set(U.id,U.sectionId);let u=new Map;for(let[U,Y]of o.seats.idToIndex){let $=m.get(U);if(!$)continue;let ee=u.get($);ee?ee.push(Y):u.set($,[Y])}let p=()=>{if(!l||!o.sectionSolidRanges.length)return;let{lit:U,anyUnlit:Y}=pa(o.sectionSolidRanges,u,o.seats.iState);l.setSectionShellLit(Y?U:null)},d=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)),l=null,f=null,b=!1,h=!1,y=!1,x=new Map,g=null,v=null,R=null,P=new Map,M=null,A=()=>{R===null&&(R=e.style.zIndex,e.style.zIndex="20")},k=()=>{R!==null&&(e.style.zIndex==="20"&&(e.style.zIndex=R),R=null)},z=!1,V=()=>z?fe.focusedFloor():-1,L=()=>{l=ya(S.gl,o),p(),f=new Pn(S.renderer,l.seatGeometry,l.chairGeometry,l.solidGeometry,o.seats.count),S.setClearColor(o.theme.background.top),f.setRestoreClear(o.theme.background.top),l.seatProgram.uniforms.uSeatRadius.value=De*o.theme.seatScale,l.seatProgram.uniforms.uFocusFloor.value=V(),l.solidProgram.uniforms.uFocusFloor.value=V(),l.chairProgram.uniforms.uFocusFloor.value=V(),l.screenProgram&&(l.screenProgram.uniforms.uFocusFloor.value=V()),_.forceRegather()},C=!1,_=new Vn({model:o,orbit:()=>E,gpu:()=>l}),B=U=>_.setDetailEnabled(U),S=new Qt(e,{onContextLost:()=>{y||i.contextLost(),b=!0,K.stop(),l=null,f=null},onContextRestored:()=>{L(),b=!1,y||i.contextRestored(),K.requestRender()}}),E=new Zt(S.gl,S.canvas,()=>K.requestRender(),()=>i.orbitEngaged());E.setAspect(S.aspect);let T=(t.doc.floors?.flatMap(U=>U.objects)??t.doc.objects).some(U=>U.type==="section"&&U.physical3dProvenance?.surfaceKind?.status==="inferred"),w=(()=>{if(T&&o.stages.length===0)return;let U=o.focalWorld[0]-o.bounds.center[0],Y=o.focalWorld[2]-o.bounds.center[2];return Math.hypot(U,Y)>o.bounds.radius*.12?Math.atan2(U,Y):void 0})(),F=o.floors.length>1?{polarDeg:48,margin:1.1}:{margin:1.1},I=typeof window<"u"&&!!window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches;E.frame(o.bounds,!I&&n.skipInitialOverviewAnimation!==!0,w,n.portraitOverviewCrop===!0,F);let O=new Cn(E.camera),j=us(e),H=new Sn(e,{fontFamily:t.doc.theme?.fontFamily,ink:t.doc.theme?.textColor,backgroundRgb:o.theme.background.top}),N=o.labels,D=()=>ki(N,o.floors.length,V());H.setLabels(D());let W=null,X=U=>{if(W=U,H.setForcedDense(!!U),!U){H.setLabels(D());return}let Y=t.seats.filter(J=>J.sectionId===U),$=new Set(Y.map(J=>J.id)),ee=new Set(Y.map(J=>J.rowId)),re=new Set(x.keys()),ie=new Set(Y.filter(J=>re.has(J.id)).map(J=>J.id)),se=D().filter(J=>J.kind!=="row"&&J.kind!=="seat"||(J.kind==="row"?ee.has(J.id.slice(4)):$.has(J.id.slice(5))&&(ie.size===0||ie.has(J.id.slice(5)))));if(o.seatCount<=6e3&&ie.size===0){H.setLabels(se);return}let me=ie.size?Y.filter(J=>ie.has(J.id)):Y,Qe=new Set(me.map(J=>`seat:${J.id}`)),Ue=me.flatMap(J=>{let ye=o.seats.idToIndex.get(J.id);if(ye===void 0)return[];let Re=ye*3;return[{id:`seat:${J.id}`,kind:"seat",text:re.has(J.id)?J.displayLabel||J.label:Mo(J.displayLabel||J.label),anchor:[o.seats.iPosition[Re],o.seats.iPosition[Re+1]+(re.has(J.id)?1.05:.55),o.seats.iPosition[Re+2]]}]});H.setLabels([...se.filter(J=>!Qe.has(J.id)),...Ue])};L();let Q=null,q=null,K=new Jt(U=>{if(b||!l||h)return!1;let Y=qa({flying:O.active,panoramaMounted:g!==null,seatViewActive:Q?.active===!0}),$=Y==="cinematic"?O.update(performance.now()):Y==="seatView"?Q.update(performance.now()):Y==="orbit"?E.update():!1;q?.syncZoomLimits();let ee=V()>=0?o.floors[V()]:null,re=ee?.radius??o.bounds.radius,ie=tr(E.currentDistance,re),se=C?{center:[E.camera.position.x,E.camera.position.y,E.camera.position.z],radius:520}:o.renderBounds;E.updateClipping(se);let me=ee?.center??o.renderBounds.center,Qe=ee?.radius??o.renderBounds.radius,Ue=(Ee,At)=>Math.hypot(E.camera.position.x-Ee[0],E.camera.position.y-Ee[1],E.camera.position.z-Ee[2])<=At*(_.detailVisible?1.8:1.55),J=Ue(me,Qe);if(!J&&W){let Ee=o.sections.find(At=>At.id===W);Ee&&(J=Ue(Ee.center,Math.max(12,Ee.radius*2)))}_.detailVisible=J;let ye=l.seatProgram.uniforms;ye.uSeatScale.value=ie.scale,ye.uSeatFade.value=ie.fade;let Re=!!ee&&nr(ee.seatCount,S.canvas.clientWidth||1,S.canvas.clientHeight||1),Wt=or(o.seats.count,re,E.currentDistance,E.camera.fov,S.canvas.clientHeight||1),Ct=_.detailVisible||Re||Wt?1:0,Kt=_.detailVisible||V()>=0||o.floors.length>1?1:0;return _.ease(U,Ct,Kt),ye.uSeatDetail.value=_.seatDetailMix,l.solidProgram.uniforms.uStructureDetail.value=_.structureDetailMix,ye.uMinPixels.value=ie.minPixels,ye.uPixelToWorld.value=2*Math.tan(E.camera.fov*gd/2)/Math.max(1,S.pixelHeight),_.update(_.detailVisible),S.renderer.render({scene:l.background,clear:!0}),S.renderer.render({scene:l.main,camera:E.camera,clear:!1}),H.update(E.camera.projectionViewMatrix,S.canvas.clientWidth||1,S.canvas.clientHeight||1,E.currentDistance,re,[E.camera.position.x,E.camera.position.y,E.camera.position.z]),$||_.seatDetailMix!==Ct||_.structureDetailMix!==Kt}),Z=typeof ResizeObserver<"u"?new ResizeObserver(()=>Gn.resize()):null;Z?.observe(e);let te=U=>{let Y=re=>{let ie=o.seats.idToIndex.get(re);return ie===void 0?void 0:o.seats.iState[ie]},{updates:$,next:ee}=Sa(x,U,Y);if(x=ee,H.setSelectedSeatIds(x.keys()),W&&X(W),$.length){let re=to(o.seats,$);l&&l.uploadSeatStateRuns(re),p(),K.requestRender()}},Me=()=>M!==null?M:typeof window<"u"&&!!window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,Ae=8,Be=U=>{if(!n.getSeatView)return null;let Y=P.get(U);if(!Y)for(Y=Promise.resolve(n.getSeatView(U)),P.set(U,Y),Y.catch(()=>{P.get(U)===Y&&P.delete(U)});P.size>Ae;){let $=P.keys().next().value;if($===void 0)break;P.delete($)}return Y},ke=Na(o.stages,o.focalWorld,o.bounds.groundY??0),Ne=Lo(ke),we=(U,Y)=>{let $=s.get(U),ee=Math.max(0,Math.round(o.seats.iFloor[Y]??0)),re=t.doc.floors?.[ee],ie=o.floors[ee],se=re?.focalPoint??t.doc.focalPoint,me=ie?{x:ie.focalWorld[0]/G,y:ie.focalWorld[2]/G}:se,Qe=$?.focalPoint?{x:$.focalPoint.x+me.x-se.x,y:$.focalPoint.y+me.y-se.y}:me,Ue=[o.seats.iPosition[Y*3],o.seats.iPosition[Y*3+1],o.seats.iPosition[Y*3+2]];return Ta(Ue,Qe,re?.baseHeightM??0,$?.eyeHeightM,Ne)},de=()=>(e.clientWidth||S.canvas.clientWidth)<=520,Ge=null,ct=null,lt=async(U,Y,$)=>{if(!n.getSeatView||y||$!==fe.flightGen())return;let ee;try{ee=await cs()}catch{if(i.panoramaFailed(U,"mount"),!y&&$===fe.flightGen()){let re=qe(U,$,!0);requestAnimationFrame(()=>re?.querySelector("[data-panorama-trigger]")?.focus())}return}if(!(y||$!==fe.flightGen()||!Ge))return ct??=ee.createOpenPanorama(Ge),ct(U,Y,$)},Fe=ms({container:e,model:o,opts:n,expandedSeatById:s,seatIdsByRow:c,isNarrow:de,isDisposed:()=>y,flightGen:()=>fe.flightGen(),flyToSeat:U=>No(U),openPanorama:(U,Y,$)=>lt(U,Y,$)}),qe=Fe.show,ut=Fe.remove,Ms=Fe.layout,$e=ds({container:e,orbit:E,isNarrow:de,enabled:n.chrome?.controlDock!==!1,...n.navLabels?{labels:n.navLabels}:{}});q=$e;let ws=$e.element,wt=$e.setNavigationMode,Ps=$e.layout,Cs=$e.utilityControls,Pt=null,Vo=!1,Xt=U=>{$e.setSeatViewLocked(U),U||Q?.exit()};Q=Ka({canvas:S.canvas,camera:E.camera,requestRender:()=>K.requestRender(),reducedMotion:Me,onStopChange:U=>{let Y=U??(Vo?"seat":null);Pt=Y;try{n.onSeatViewStopChange?.(Y)}catch{}},onApplied:()=>{y||E.syncFromCamera()}});let As=(U,Y)=>{let{eye:$}=we(U,Y),ee=(e.clientWidth||S.canvas.clientWidth||1)/Math.max(1,e.clientHeight||S.canvas.clientHeight||1),re=za($,ke,ee);if(n.seatViewStops===!1)return{...re,stops:[]};let ie=m.get(U),se=ie?o.sections.find(me=>me.id===ie):void 0;return{...re,stops:Ua(re,{aspect:ee,section:se&&se.seatCount>0?{center:se.center,radius:se.radius}:null,venue:{center:o.bounds.center,radius:o.bounds.radius}})}},fe=ys({container:e,model:o,opts:n,orbit:E,cinematic:O,analytics:i,loop:K,labelOverlay:H,stageAzimuth:w,overviewFraming:F,gpu:()=>l,isDisposed:()=>y,panorama:()=>g,setPanorama:U=>{g=U},setPanoramaSphereVisible:U=>{C=U},panoramaLoadAbort:()=>v,setPanoramaLoadAbort:U=>{v=U},setFrozen:U=>{h=U},restorePanoramaLayer:k,reducedMotion:Me,resolvedSeatViewPose:we,showSectionSeatLabels:X,setNearFieldDetailEnabled:B,setSeatViewLocked:Xt,setNavigationMode:wt,showArriveChip:qe,removeArriveChip:ut,inSeatView:()=>Pt!==null,setSeatStepping:U=>{Vo=U},seatViewArrival:(U,Y)=>n.arriveAtSeatEye?As(U,Y):null,enterSeatView:U=>Q?.enter(U)});z=!0;let Nn=fe.overviewChip,Rs=fe.layoutOverviewChip,Es=fe.applyFloorFocus,Is=fe.focusOverview,Bo=fe.cancelFlight,No=fe.flyToSeat,Go=fe.focusSectionCamera;Cs.appendChild(Nn),Ge={container:e,model:o,opts:n,analytics:i,orbit:E,loop:K,seatsById:s,ensureSeatView:Be,resolvedSeatViewPose:we,gpu:()=>l,gl:S.gl,isContextLost:()=>b,isDisposed:()=>y,flightGen:()=>fe.flightGen(),setPanorama:U=>{g=U},getLoadAbort:()=>v,setLoadAbort:U=>{v=U},setPanoramaSphereVisible:U=>{C=U,U&&Q?.exit()},setFrozen:U=>{h=U},raisePanoramaLayer:A,restorePanoramaLayer:k,getOverviewChip:()=>Nn,labelOverlay:H,reducedMotion:Me,removeArriveChip:ut,showArriveChip:qe};let ze=fs({glctx:S,orbit:E,model:o,seats:t.seats,opts:n,cinematic:O,analytics:i,seatIdByIndex:a,sectionIdBySeatId:m,tapSlop:xd,tapMs:vd,gpu:()=>l,pick:()=>f,seatViewLocked:()=>$e.seatViewLocked(),focusedSectionId:()=>W,selection:()=>x,cancelFlight:Bo,focusSectionCamera:Go,focusSeatCamera:fe.focusSeatCamera,setSelection:te,ensureSeatView:Be});S.canvas.addEventListener("pointerdown",ze.onDown),S.canvas.addEventListener("pointermove",ze.onMove),S.canvas.addEventListener("pointerup",ze.onUp),S.canvas.addEventListener("pointercancel",ze.onUp),K.requestRender();let Gn={setAvailability(U){let Y=va(x,U),$=to(o.seats,Y);$.length&&l&&l.uploadSeatStateRuns($),p(),K.requestRender()},setSelection:te,setNavigationMode:wt,zoomIn(){E.zoomBy(pt),K.requestRender()},zoomOut(){E.zoomBy(Tt),K.requestRender()},flyToSeat:No,focusOverview:Is,seatViewStop:()=>Pt,recentreSeatView:()=>Q?.recentre()??!1,resize(){let{width:U,height:Y}=S.resize();E.setAspect(U/Math.max(1,Y)),Ms(),Ps(),Rs(),K.requestRender()},stats(){return{...K.stats(),drawCalls:l?l.drawCalls:0,seatCount:o.seatCount}},getQualityEvidence(){let U=K.stats(),Y=S.canvas.clientWidth||1,$=S.canvas.clientHeight||1,ee=o.bounds.center,re=Ye(E.camera.projectionViewMatrix,[ee[0],o.bounds.box.min[1],ee[2]],Y,$),ie=Ye(E.camera.projectionViewMatrix,[ee[0],o.bounds.box.max[1],ee[2]],Y,$),se=o.bounds.box,me=[se.min[0],se.max[0]].flatMap(J=>[se.min[1],se.max[1]].flatMap(ye=>[se.min[2],se.max[2]].map(Re=>Ye(E.camera.projectionViewMatrix,[J,ye,Re],Y,$)))).filter(J=>Number.isFinite(J.x)&&Number.isFinite(J.y)&&Number.isFinite(J.depth)),Qe=me.length?(()=>{let J=Math.min(...me.map(Ze=>Ze.x)),ye=Math.max(...me.map(Ze=>Ze.x)),Re=Math.min(...me.map(Ze=>Ze.y)),Wt=Math.max(...me.map(Ze=>Ze.y)),Ct=Math.max(0,J),Kt=Math.min(Y,ye),Ee=Math.max(0,Re),At=Math.min($,Wt),qt=Math.max(0,Kt-Ct),zn=Math.max(0,At-Ee);return{box:{x:Ct,y:Ee,width:qt,height:zn},horizontalFillRatio:qt/Y,verticalFillRatio:zn/$,visibleAreaRatio:qt*zn/(Y*$),clippedEdges:[...Re<0?["top"]:[],...ye>Y?["right"]:[],...Wt>$?["bottom"]:[],...J<0?["left"]:[]]}})():void 0,Ue=String(S.gl.getParameter(S.gl.VERSION)??"");return{viewport:{width:Y,height:$},context:{webgl2:/webgl\s*2/i.test(Ue),lost:b},frame:{rendered:U.rendered,idle:U.idle},camera:{position:[E.camera.position.x,E.camera.position.y,E.camera.position.z],distance:E.currentDistance,verticalFovDeg:E.fovY},scene:{seatCount:o.seatCount,floorCount:o.floors.length,zoneCount:o.zones.length,sectionCount:o.sections.length,authoredRelief:d,renderedVerticalSpanM:Math.max(0,o.bounds.box.max[1]-o.bounds.box.min[1]),projectedReliefPx:re.visible&&ie.visible?Math.abs(re.y-ie.y):0},labels:H.qualityEvidence(),framing:Qe,...Pt?{seatView:{fovDeg:E.camera.fov,stop:Pt}}:{}}},getQualityReport(){return Mn(Gn.getQualityEvidence())},loseContextForTest(){S.simulateContextLossCycle()},floors(){return o.floors},focusFloor(U){if(U!==null&&!o.floors.some($=>$.index===U))return!1;let Y=U??-1;if(B(U!==null),Xt(!1),Es(Y),wt("orbit"),U===null)O.cancel(),Me()?E.frame(o.bounds,!1,w,n.portraitOverviewCrop===!0,F):E.frameSoft(o.bounds,w,n.portraitOverviewCrop===!0,F);else{let $=o.floors[U];if($.seatCount>0){O.cancel();let ee=$.focalWorld[0]-$.center[0],re=$.focalWorld[2]-$.center[2],ie=Math.hypot(ee,re)>$.radius*.12?Math.atan2(ee,re):w;E.frame({center:$.center,radius:$.radius,box:$.box},!1,ie,!1,{polarDeg:58,margin:1.12})}}return K.requestRender(),!0},zones(){return o.zones},focusZone(U){let Y=o.zones.find(ie=>ie.id===U);if(!Y||Y.seatCount===0)return!1;B(!1),Xt(!1),O.cancel(),wt("orbit"),X(null),n.onSectionFocusChange?.(null);let $=Y.focalWorld[0]-Y.center[0],ee=Y.focalWorld[2]-Y.center[2],re=Math.hypot($,ee)>Y.radius*.12?Math.atan2($,ee):void 0;return E.frame({center:Y.center,radius:Y.radius*1.25},!1,re),K.requestRender(),!0},sections(){return o.sections},focusSection(U){return Go(U)},rows(U){return U?o.rows.filter(Y=>Y.sectionId===U):o.rows},seatsInRow(U){return t.seats.filter(Y=>Y.rowId===U).map(Y=>({id:Y.id,label:Y.displayLabel||Y.label}))},focusRow(U){let Y=o.rows.find($=>$.id===U);return!Y||Y.seatCount===0?!1:(B(!0),Xt(!1),O.cancel(),wt("pan"),Y.sectionId&&(X(Y.sectionId),n.onSectionFocusChange?.(Y.sectionId)),E.frame({center:Y.center,radius:Math.max(2.5,Y.radius*.65)}),K.requestRender(),!0)},setReducedMotionForTest(U){M=U},dispose(){y=!0,ut(),Nn.remove(),ws.remove(),Bo(),Q?.dispose(),K.stop(),H.dispose(),Z?.disconnect(),g&&(g.dispose(),g=null),k(),j(),S.canvas.removeEventListener("pointerdown",ze.onDown),S.canvas.removeEventListener("pointermove",ze.onMove),S.canvas.removeEventListener("pointerup",ze.onUp),S.canvas.removeEventListener("pointercancel",ze.onUp),E.dispose(),f&&f.dispose(),l&&l.dispose(),l=null,f=null,S.dispose()}};return i.opened(o.seatCount,d,t.prepared?.buildMs??performance.now()-r,t.prepared?.source??"inline"),Gn}0&&(module.exports={VENUE3D_QUALITY_REPORT_VERSION,buildSceneModel,inspectVenue3DQualityEvidence,mountVenue3D,prepareVenue3D,prepareVenue3DFromChart});
|
|
641
|
+
void main(){ if(vDim>0.5) discard; vec4 c=texture(uImage,vUv); if(c.a<0.01) discard; fragColor=c; }`,uniforms:{uImage:{value:j},uFocusFloor:{value:-1}},transparent:!1,depthTest:!0,depthWrite:!0,cullFace:!1});let q=new ce.Mesh(e,{geometry:I,program:O});q.frustumCulled=!1,q.setParent(n),D.screenProgram=O,w=!0,D.drawCalls=3+(T?1:0)+1},X.src=W.contentImageUrl}return D}var _e=require("ogl");function wm(e,t,n){let r=e+(t<<8)+(n<<16);return r===0?-1:r-1}function xa(e,t,n,r,o,i){let a=-1,s=1/0;for(let c=0;c<n;c++)for(let u=0;u<t;u++){let d=(c*t+u)*4,f=wm(e[d],e[d+1],e[d+2]);if(f<0||f>=i)continue;let m=u-r,l=c-o,p=m*m+l*l;p<s&&(s=p,a=f)}return a}function va(e,t,n,r,o,i){let a=e-n.left,s=t-n.top,c=Math.round(a*r),u=Math.round((n.height-s)*r);return{x:Math.max(0,Math.min(o-1,c)),y:Math.max(0,Math.min(i-1,u))}}var Pm=["uSeatRadius","uSeatScale","uMinPixels","uPixelToWorld"],Cn=class{constructor(t,n,r,o,i){this.seatScene=new _e.Transform;this.chairScene=new _e.Transform;this.solidScene=new _e.Transform;this.target=null;this.restoreClear=[0,0,0];this.renderer=t,this.gl=t.gl,this.maxIndex=i,this.seatProg=ca(this.gl),this.chairProg=la(this.gl),this.depthProg=ua(this.gl);let a=new _e.Mesh(this.gl,{geometry:n,program:this.seatProg});a.frustumCulled=!1,a.setParent(this.seatScene);let s=new _e.Mesh(this.gl,{geometry:r,program:this.chairProg});s.frustumCulled=!1,s.setParent(this.chairScene);let c=new _e.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 Pm)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 _e.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,u=Math.max(0,n-o),d=Math.max(0,r-o),f=Math.max(1,Math.min(s,n+o+1)-u),m=Math.max(1,Math.min(c,r+o+1)-d);i.enable(i.SCISSOR_TEST),i.scissor(u,d,f,m);let[l,p,b]=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(l,p,b,1),i.disable(i.SCISSOR_TEST);let h=new Uint8Array(f*m*4);return this.renderer.bindFramebuffer(a),i.readPixels(u,d,f,m,i.RGBA,i.UNSIGNED_BYTE,h),this.renderer.bindFramebuffer(),xa(h,f,m,n-u,r-d,this.maxIndex)}dispose(){this.destroyTarget(),this.seatProg.remove(),this.chairProg.remove(),this.depthProg.remove()}};function Sa(e,t){let n=[];for(let r of t)e.has(r.seatId)?e.set(r.seatId,It(r.state)):n.push(r);return n}function Ma(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:pe[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 Cm(e,t){return[e[0]-t[0],e[1]-t[1],e[2]-t[2]]}function wa(e,t){return[e[0]+t[0],e[1]+t[1],e[2]+t[2]]}function Am(e,t){return[e[0]*t,e[1]*t,e[2]*t]}function Pa(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 Eo(e){let t=Math.max(0,Math.min(1,e));return t*t*t*(t*(t*6-15)+10)}function Io(e,t){return Math.max(0,Math.min(1,e+t))}function Ca(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],u=e[i+1],d=e[Math.min(n-1,i+2)],f=a*a,m=f*a,l=[0,0,0];for(let p=0;p<3;p++)l[p]=.5*(2*c[p]+(-s[p]+u[p])*a+(2*s[p]-5*c[p]+4*u[p]-d[p])*f+(-s[p]+3*c[p]-3*u[p]+d[p])*m);return l}function To(e,t,n,r,o){let i=Pa(Cm(t,n));i[0]===0&&i[1]===0&&i[2]===0&&(i=[0,0,1]);let a=wa(wa(t,Am(i,2.5)),[0,1.5,0]),s=[t[0]-r[0],0,t[2]-r[2]],c=Pa(s);c[0]===0&&c[2]===0&&(c=[i[0],0,i[2]]);let u=Math.max(1,o),d=[r[0]+c[0]*u*1.3,r[1]+u*.75,r[2]+c[2]*u*1.3];return{waypoints:[e,d,a],finalPos:a}}function _o(e,t,n=35,r=28){let o=Eo(t),i=Ca(e,o),a=Eo(Math.max(0,Math.min(1,(t-.66)/.34)));return{pos:i,fov:n+(r-n)*a,eased:o}}function Ia(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 An=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}=_o(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,Io(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 Ta=to,Rm=.12,Em=.25,Im=1.5;function _a(e,t,n=0,r,o){let i=[t.x*G,n+Im,t.y*G],a=o?[o[0],o[1],o[2]]:i,s=e[1],c=Number.isFinite(s)?s+Ta:Number.isFinite(r)?n+r:n+Ta,u=i[0]-e[0],d=i[2]-e[2],f=Math.hypot(u,d),m=f>.001?Math.min(Rm,f*Em):0,l=f>.001?u/f:0,p=f>.001?d/f:0;return{eye:[e[0]+l*m,c,e[2]+p*m],focal:a}}var st=Math.PI/180,Tm=45,La=80,Rn=70,_m=1,Lm=.99;function km(e,t){if(!(e<_m))return La;if(!(Number.isFinite(t)&&t>0))return Rn;let n=2*Math.atan(t/(2*En*Lm)/Math.max(.05,e))/st;return Math.max(Rn,Math.min(La,n))}var Fm=.25,En=1,Dm=.25,Om=12*st,Vm=.2,Bm=1.5,ka=.8,Fa=6,Ba=1.9,Nm=2/3,Gm=.12,zm=.9,Um=1.2,Hm=2,Na=.05,jm=6;function Ga(e,t,n=0){if(!e.length)return{min:[t[0]-6,n,t[2]-6],max:[t[0]+6,Math.max(n+ka,t[1]),t[2]+6]};let r=1/0,o=-1/0,i=1/0,a=-1/0,s=n;for(let p of e)r=Math.min(r,p.cx-p.halfX),o=Math.max(o,p.cx+p.halfX),i=Math.min(i,p.cz-p.halfZ),a=Math.max(a,p.cz+p.halfZ),s=Math.max(s,p.y);let c=o-r,u=a-i,d=Math.max(c,Math.min(u,Fa))/2,f=Math.max(u,Math.min(c,Fa))/2,m=(r+o)/2,l=(i+a)/2;return{min:[m-d,n,l-f],max:[m+d,Math.max(n+ka,s),l+f]}}function Ym(e){return{min:[e.min[0],e.min[1],e.min[2]],max:[e.max[0],e.max[1]+Ba,e.max[2]]}}function Lo(e){let t=e.max[1];return[(e.min[0]+e.max[0])/2,Math.max(e.min[1]+Bm,t+Vm,t+Ba*Nm),(e.min[2]+e.max[2])/2]}function za(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 Da(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,u=Math.hypot(s,c);if(u<1e-6)return 1/0;s/=u,c/=u;let d=1/0,f=-1/0;for(let m=0;m<8;m++){let l=(m&1?n.max[0]:n.min[0])-e[0],p=(m&2?n.max[1]:n.min[1])-e[1],b=(m&4?n.max[2]:n.min[2])-e[2],h=Math.max(Na,l*r+p*o+b*i),y=(l*s+b*c)/h;y<d&&(d=y),y>f&&(f=y)}return f-d}function Oa(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,u=Math.hypot(s,c);if(u<1e-6)return 1/0;s/=u,c/=u;let d=-c*o,f=c*r-s*i,m=s*o,l=1/0,p=-1/0;for(let b=0;b<8;b++){let h=(b&1?n.max[0]:n.min[0])-e[0],y=(b&2?n.max[1]:n.min[1])-e[1],x=(b&4?n.max[2]:n.min[2])-e[2],g=Math.max(Na,h*r+y*o+x*i),v=(h*d+y*f+x*m)/g;v<l&&(l=v),v>p&&(p=v)}return p-l}function In(e,t){return Math.tan(e*st/2)*Math.max(.05,t)}function Va(e,t,n){let r=km(n,e),o=c=>Math.max(Tm,Math.min(r,c)),i=c=>2*Math.atan(c)/st,a=Number.isFinite(e)&&e>0?o(i(e/(2*Fm)/Math.max(.05,n))):r;if(!(Number.isFinite(t)&&t>0))return a;let s=Math.min(a,o(i(t/(2*Gm))));return e/(2*In(s,n))>En?a:s}function Ua(e,t,n){let r=Lo(t),o=[e[0],e[1],e[2]],i=0,a=0,s=l=>{if(!(l>0))return;let p=za(o,r);o[0]+=p.x*l,o[2]+=p.z*l,a+=l},c=t.max[1]+Dm-o[1];c>0&&(o[1]+=c,i=c,s(c/Math.tan(Om)));let u=Ym(t),d=Da(o,r,t),f=Va(d,Oa(o,r,u),n),m=d/(2*In(f,n));for(let l=0;l<jm&&m>En;l++){let p=Math.max(1,Math.hypot(o[0]-r[0],o[2]-r[2])),b=Number.isFinite(m)?m/En:2;s(Math.min(60,p*(Math.min(4,b)-1)+.5)),d=Da(o,r,t),f=Va(d,Oa(o,r,u),n),m=d/(2*In(f,n))}return{eye:o,focal:r,fov:f,raisedM:i,pulledBackM:a,stageFrameWidth:m}}function Xm(e,t,n){let r=Math.tan(t*st/2),o=In(t,n);return Math.max(1,e/Math.max(.05,Math.min(r,o)))}function Ha(e,t){let{aspect:n,venue:r}=t,o=e.focal,i=za(e.eye,o),a=m=>(m[0]-o[0])*i.x+(m[2]-o[2])*i.z,s=[{name:"seat",eye:e.eye,focal:o,fov:e.fov}],c=Hm*(t.rowDepthM??zm);s.push({name:"row",eye:[e.eye[0]+i.x*c,e.eye[1]+Um,e.eye[2]+i.z*c],focal:o,fov:e.fov});let u=(m,l,p,b)=>{let h=Xm(p,e.fov,n)*1.08,y=h*Math.sin(b*st),x=h*Math.cos(b*st);return{name:m,eye:[l[0]+i.x*x,l[1]+y,l[2]+i.z*x],focal:l,fov:e.fov}};t.section&&t.section.radius>0&&s.push(u("section",t.section.center,t.section.radius,14)),s.push(u("venue",r.center,Math.max(1,r.radius),26));let d=[],f=-1/0;for(let m of s){let l=a(m.eye);d.length&&l<=f+.5||(d.push(m),f=l)}return d}var Ka=require("ogl"),jt=Math.PI/180,ja=320,Ya=70*jt,Wm=32*jt,Km=24*jt,Xa=.0026,qm=.22,$m=.006,Qm=180,Zm=4,Se=(e,t,n)=>Math.max(t,Math.min(n,e)),Wa=e=>e<.5?4*e*e*e:1-Math.pow(-2*e+2,3)/2;function qa(e){let{canvas:t,camera:n}=e,r=[],o=!1,i=0,a=0,s=0,c=0,u=0,d=0,f=!1,m=[0,0],l=0,p=!1,b=null,h=null,y=new Map,x=!1,g=0,v=0,C=0,P=0,M=()=>o&&r.length?r[Se(Math.round(i),0,r.length-1)].name:null,R=()=>{let w=M();w!==b&&(b=w,e.onStopChange?.(w))},k=()=>{if(!o||!r.length)return;let w=r[Se(Math.floor(i),0,r.length-1)],F=r[Se(Math.ceil(i),0,r.length-1)],I=Se(i-Math.floor(i),0,1),O=(Me,Ae)=>Me+(Ae-Me)*I,j=[O(w.eye[0],F.eye[0]),O(w.eye[1],F.eye[1]),O(w.eye[2],F.eye[2])],H=[O(w.focal[0],F.focal[0]),O(w.focal[1],F.focal[1]),O(w.focal[2],F.focal[2])],N=H[0]-j[0],D=H[1]-j[1],W=H[2]-j[2],X=Math.hypot(N,D,W)||1,Q=Math.atan2(N,W),q=Math.asin(Se(D/X,-1,1)),K=Q+a,Z=Se(q+s,-80*jt,80*jt),te=Math.cos(Z)*X;N=Math.sin(K)*te,D=Math.sin(Z)*X,W=Math.cos(K)*te,n.position.set(j[0],j[1],j[2]),n.fov=O(w.fov,F.fov),n.updateProjectionMatrix(),n.lookAt(new Ka.Vec3(j[0]+N,j[1]+D,j[2]+W)),e.onApplied?.()},z=()=>{if(!o||!r.length)return;let w=Se(Math.round(i),0,r.length-1);if(e.reducedMotion()){f=!1,i=w,k(),R(),e.requestRender();return}if(Math.abs(w-i)<.001){f=!1,R();return}c=i,u=w,d=performance.now(),f=!0,e.requestRender()},V=w=>{!o||r.length<2||(f=!1,i=Se(i+w,0,r.length-1),k(),R(),e.requestRender())},L=(w,F)=>{o&&(f=!1,p=!1,a=Se(a-w*Xa,-Ya,Ya),s=Se(s-F*Xa,-Km,Wm),k(),e.requestRender())},A=w=>{o&&(y.set(w.pointerId,{x:w.clientX,y:w.clientY}),y.size===1?(x=!0,P=0,g=w.clientX,v=w.clientY):y.size===2&&(x=!1,C=_()))},_=()=>{let w=[...y.values()];return w.length<2?0:Math.hypot(w[0].x-w[1].x,w[0].y-w[1].y)},B=w=>{if(!o||!y.has(w.pointerId))return;if(y.set(w.pointerId,{x:w.clientX,y:w.clientY}),y.size>=2){let O=_();C>0&&V((C-O)*$m),C=O;return}if(!x)return;let F=w.clientX-g,I=w.clientY-v;g=w.clientX,v=w.clientY,P+=Math.abs(F)+Math.abs(I),!(P<=Zm)&&L(F,I)},S=w=>{y.delete(w.pointerId)&&(y.size<2&&(C=0),y.size===0&&(x=!1,z()))},E=w=>{if(!o)return;w.preventDefault();let F=w.deltaMode===1?16:w.deltaMode===2?100:1,I=Se(w.deltaY*F/100,-2,2);V(I*qm),h&&clearTimeout(h),h=setTimeout(()=>{h=null,z()},Qm)},T=()=>{o&&(o=!1,f=!1,p=!1,r=[],y.clear(),x=!1,h&&(clearTimeout(h),h=null),b!==null&&(b=null,e.onStopChange?.(null)))};return t.addEventListener("pointerdown",A),t.addEventListener("pointermove",B),t.addEventListener("pointerup",S),t.addEventListener("pointercancel",S),t.addEventListener("wheel",E,{passive:!1}),{get active(){return o},enter(w){if(w.length<2){T();return}r=w,o=!0,i=0,a=0,s=0,f=!1,p=!1,b=null,k(),R(),e.requestRender()},exit:T,recentre(){return o?Math.abs(a)<1e-4&&Math.abs(s)<1e-4?!0:e.reducedMotion()?(p=!1,a=0,s=0,k(),e.requestRender(),!0):(m=[a,s],l=performance.now(),p=!0,e.requestRender(),!0):!1},update(w){if(!o)return!1;let F=!1;if(p){let I=Se((w-l)/ja,0,1),O=1-Wa(I);a=m[0]*O,s=m[1]*O,I>=1?(p=!1,a=0,s=0):F=!0}if(f){let I=Se((w-d)/ja,0,1);i=c+(u-c)*Wa(I),I>=1?(f=!1,i=u,R()):F=!0}return k(),F},currentStop:M,dispose(){T(),t.removeEventListener("pointerdown",A),t.removeEventListener("pointermove",B),t.removeEventListener("pointerup",S),t.removeEventListener("pointercancel",S),t.removeEventListener("wheel",E)}}}function $a(e){return e.flying?"cinematic":e.panoramaMounted?"panorama":e.seatViewActive?"seatView":"orbit"}var Oo=null;function ls(){return Oo??=Promise.resolve().then(()=>(cs(),ss)).catch(e=>{throw Oo=null,e}),Oo}var us=()=>typeof performance<"u"&&performance.now?performance.now():Date.now(),On=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=us(),this.emit("3d_panorama_opened")}panoramaClosed(){let t=this.panoramaOpenedAt?Math.round(us()-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 ms(e){let t=e.style.position;return getComputedStyle(e).position!=="static"?()=>{}:(e.style.position="relative",()=>{e.style.position==="relative"&&(e.style.position=t)})}function ds(e){let{container:t,model:n,opts:r,expandedSeatById:o,seatIdsByRow:i,isNarrow:a}=e,s=null,c=()=>{if(!s)return;let f=a();Object.assign(s.style,f?{left:"12px",right:"12px",bottom:"70px",transform:"none",justifyContent:"center"}:{left:"50%",right:"auto",bottom:"18px",transform:"translateX(-50%)",justifyContent:"initial"})},u=()=>{s?.remove(),s=null};return{show:(f,m,l=!1)=>{if(u(),e.isDisposed())return null;let p=document.createElement("div");p.setAttribute("role","group"),Object.assign(p.style,{position:"absolute",display:"flex",flexDirection:"column",alignItems:"center",gap:"6px",zIndex:"4"});let b=r.chrome?.caption!==!1,h=r.chrome?.seatStepper!==!1;if(!b&&!h)return null;let y=o.get(f),x=y?.sectionId?n.sections.find(z=>z.id===y.sectionId):void 0,g=y?.label??f;p.setAttribute("aria-label",`Explore views near ${x?.label?`${x.label}, `:""}seat ${g}`);let v=document.createElement("span");v.textContent=r.seatViewCaption?.(f)??["Live 3D seat view",x?.label,g].filter(Boolean).join(" \xB7 "),Object.assign(v.style,{maxWidth:"min(70vw, 560px)",padding:"5px 10px",borderRadius:"999px",overflow:"hidden",color:"#d9e3f5",background:"rgba(12,18,32,0.72)",font:"600 11px/1.2 inherit",textOverflow:"ellipsis",whiteSpace:"nowrap",backdropFilter:"blur(6px)"}),b&&p.appendChild(v);let C=document.createElement("div");Object.assign(C.style,{display:"flex",alignItems:"center",justifyContent:"center",gap:"6px"}),p.appendChild(C);let P=y?.rowId?i.get(y.rowId):void 0,M=P?.indexOf(f)??-1,R=M>=0?[P?.[M-1],P?.[M+1]]:[void 0,void 0],k=(z,V,L,A=!1)=>{let _=document.createElement("button");_.type="button",_.textContent=z,_.setAttribute("aria-label",V),Object.assign(_.style,{minHeight:"44px",padding:A?"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"}),A||(_.style.minWidth="44px"),A&&(_.dataset.panoramaTrigger=""),_.addEventListener("click",L),C.appendChild(_)};if(h&&R[0]){let z=o.get(R[0])?.label??R[0];k("\u2039",`View previous seat ${z}`,()=>{e.flyToSeat(R[0])})}if(h&&r.getSeatView){let z=r.seatViewActionLabel?.(f)??"Open 360\xB0 panorama";k(l?`\u21BB Retry ${z}`:`\u25C9 ${z}`,`${l?"Retry":z} from seat ${g}`,()=>{if(e.isDisposed()||m!==e.flightGen()){u();return}u(),e.openPanorama(f,400,m)},!0)}if(h&&R[1]){let z=o.get(R[1])?.label??R[1];k("\u203A",`View next seat ${z}`,()=>{e.flyToSeat(R[1])})}return!C.childElementCount&&!b?null:(t.appendChild(p),s=p,c(),p)},remove:u,layout:c}}var fd={rotate:"Drag to rotate the venue",move:"Drag to move the venue",zoomIn:"Zoom in",zoomOut:"Zoom out",fitView:"Show whole venue"};function fs(e){let{container:t,orbit:n,isNarrow:r}=e,o={...fd,...e.labels??{}},i=(g,v)=>{g.setAttribute("aria-label",v),g.title=v},a=document.createElement("div"),s=!1;a.className="sl-3d-navigation-controls",Object.assign(a.style,{position:"absolute",right:"14px",bottom:"14px",display:"flex",zIndex:"4",flexDirection:"column",alignItems:"flex-end",gap:"7px"});let c=document.createElement("div");c.setAttribute("role","group"),c.setAttribute("aria-label","3D drag mode"),Object.assign(c.style,{display:"flex",flexDirection:"column",gap:"6px",alignItems:"flex-end"});let u=document.createElement("div");u.setAttribute("role","group"),u.setAttribute("aria-label","3D view controls"),Object.assign(u.style,{display:"flex",flexDirection:"column",gap:"6px",alignItems:"flex-end"});let d=document.createElement("button");d.type="button",d.textContent="\u21BB",i(d,o.rotate);let f=document.createElement("button");f.type="button",f.textContent="\u2725",i(f,o.move);let m=document.createElement("button");m.type="button",m.textContent="\u2212",i(m,o.zoomOut);let l=document.createElement("button");l.type="button",l.textContent="+",i(l,o.zoomIn);for(let g of[d,f,m,l])g.className="sl-3d-icon-control",Object.assign(g.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"});c.append(d,f),u.append(l,m);let p=g=>{n.setPrimaryDragMode(g);let v=g==="orbit";d.setAttribute("aria-pressed",String(v)),f.setAttribute("aria-pressed",String(!v)),d.style.background=v?"rgba(96,110,150,0.68)":"rgba(12,18,32,0.82)",f.style.background=v?"rgba(12,18,32,0.82)":"rgba(96,110,150,0.68)",a.title=v?`${o.rotate} \xB7 ${o.move} with Shift`:`${o.move} \xB7 ${o.rotate} with Shift`};d.addEventListener("click",()=>p("orbit")),f.addEventListener("click",()=>p("pan"));let b=()=>{let{atMin:g,atMax:v}=n.dollyLimitState();l.disabled!==g&&(l.disabled=g),m.disabled!==v&&(m.disabled=v)};m.addEventListener("click",()=>{n.zoomBy(Tt),b()}),l.addEventListener("click",()=>{n.zoomBy(pt),b()}),a.append(c,u),p("orbit"),t.appendChild(a);let h=e.enabled!==!1,y=()=>{let g=r();a.style.display=s||!h?"none":"flex",a.style.right=g?"12px":"14px",a.style.bottom=g?"calc(env(safe-area-inset-bottom, 0px) + 76px)":"14px",c.style.display=g?"none":"flex",l.style.display=g?"none":"",m.style.display=g?"none":""};return y(),{element:a,utilityControls:u,setNavigationMode:p,syncZoomLimits:b,setSeatViewLocked:g=>{s=g,n.setInteractionEnabled(!g),y()},seatViewLocked:()=>s,layout:y}}var pd=12;function hd(e,t){if(!e)return!1;let n=e.x-t[0],r=e.y-t[1],o=e.z-t[2];return Math.hypot(n,r,o)>pd}function ps(e){let{glctx:t,orbit:n,model:r,seats:o,opts:i,cinematic:a,analytics:s,seatIdByIndex:c,sectionIdBySeatId:u,tapSlop:d,tapMs:f,cancelFlight:m,focusSectionCamera:l,setSelection:p,ensureSeatView:b}=e,h=0,y=0,x=0,g=-1,v=!1,C=!1,P=V=>{e.seatViewLocked()||g===-1&&(g=V.pointerId,h=V.clientX,y=V.clientY,x=performance.now(),v=!1,C=a.active,a.active&&(s.cinematicCancelled(),m(),i.onViewTargetChange?.(null)))},M=V=>{V.pointerId===g&&Math.hypot(V.clientX-h,V.clientY-y)>d&&(v=!0)},R=(V,L,A,_,B)=>{let S=t.canvas.getBoundingClientRect(),E=t.canvas.clientWidth||S.width||1,T=t.canvas.clientHeight||S.height||1,w=V-S.left,F=L-S.top,I=_*_,O=-1,j=I,H=1/0;for(let N of o){if(A&&N.sectionId!==A)continue;let D=r.seats.idToIndex.get(N.id);if(D===void 0)continue;if(B){let Z=Math.round(r.seats.iState[D]??0);if(Z!==0&&Z!==3)continue}let W=D*3,X=Ye(n.camera.projectionViewMatrix,[r.seats.iPosition[W],r.seats.iPosition[W+1]+.55,r.seats.iPosition[W+2]],E,T);if(!X.visible)continue;let Q=X.x-w,q=X.y-F,K=Q*Q+q*q;(K<j||Math.abs(K-j)<1&&X.depth<H)&&(O=D,j=K,H=X.depth)}return O},k=(V,L)=>{let A=e.gpu(),_=e.pick();if(!A||!_)return-1;_.syncFromSeatProgram(A.seatProgram);let B=t.canvas.getBoundingClientRect(),S=t.renderer.dpr,{x:E,y:T}=va(V,L,B,S,t.gl.drawingBufferWidth,t.gl.drawingBufferHeight),w=Math.max(2,Math.round(8*S));return _.pick(n.camera,E,T,w)};return{onDown:P,onMove:M,onUp:V=>{if(V.pointerId!==g)return;let L=!v&&performance.now()-x<f;if(g=-1,C){C=!1;return}let A=e.gpu(),_=e.pick();if(!L||!A||!_)return;let B=k(V.clientX,V.clientY);if(e.focusedSectionId()&&B>=0){let T=c[B],w=T?u.get(T):void 0;if(w&&w!==e.focusedSectionId()&&l(w))return}if(e.focusedSectionId()&&B<0&&(B=R(V.clientX,V.clientY,e.focusedSectionId(),44,!1)),e.focusedSectionId()&&B<0){let T=R(V.clientX,V.clientY,null,72,!1),w=T>=0?c[T]:void 0,F=w?u.get(w):void 0;if(F&&F!==e.focusedSectionId()&&l(F))return}if(!e.focusedSectionId()){B<0&&(B=R(V.clientX,V.clientY,null,42,!1));let T=B>=0?c[B]:void 0,w=T?u.get(T):void 0;if(w&&l(w))return}if(B<0||B>=c.length){e.selection().size&&(p([]),i.onViewTargetChange?.(null));return}let S=c[B],E=pe[Math.round(r.seats.iState[B]??0)]??"available";if(E!=="available"&&E!=="selected"){i.onSeatInspect?.(S,E);return}if(e.selection().has(S)&&e.selection().size===1){p([]),i.onViewTargetChange?.(null),i.onSeatPick?.(S);return}if(p([S]),b(S),s.seatPicked(S,u.get(S)),i.onSeatPick?.(S),e.focusedSectionId()){let T=B*3,w=[r.seats.iPosition[T],r.seats.iPosition[T+1],r.seats.iPosition[T+2]];hd(n.camera?.position,w)&&e.focusSeatCamera(S)}}}}var Vn=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 l=0;l<this.count;l++){let p=t[l*3],b=t[l*3+2];p<n&&(n=p),p>o&&(o=p),b<r&&(r=b),b>i&&(i=b)}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,u=new Int32Array(c+1),d=l=>{let p=Math.min(this.cols-1,Math.max(0,Math.floor((t[l*3]-n)/this.cell)));return Math.min(this.rows-1,Math.max(0,Math.floor((t[l*3+2]-r)/this.cell)))*this.cols+p};for(let l=0;l<this.count;l++)u[d(l)+1]++;for(let l=0;l<c;l++)u[l+1]+=u[l];let f=new Int32Array(this.count),m=u.slice(0,c);for(let l=0;l<this.count;l++)f[m[d(l)]++]=l;this.cellStart=u,this.cellItems=f}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,u=Math.floor((t-this.minX)/this.cell),d=Math.floor((n-this.minZ)/this.cell),f=Math.ceil(r/this.cell)+1,m=this.iPosition,l=0;for(let p=0;p<=f&&l<s;p++){let b=d-p,h=d+p,y=u-p,x=u+p;for(let g=b;g<=h&&l<s;g++){if(g<0||g>=this.rows)continue;let v=g===b||g===h;for(let C=y;C<=x&&l<s;C++){if(!v&&C!==y&&C!==x){C=x-1;continue}if(C<0||C>=this.cols)continue;let P=g*this.cols+C;for(let M=i[P],R=i[P+1];M<R&&l<s;M++){let k=a[M],z=m[k*3]-t,V=m[k*3+2]-n;z*z+V*V<=c&&(o[l++]=k)}}}}return l}};var Bn=class{constructor(t){this.ctx=t;this.detailVisible=!1;this.seatDetailMix=0;this.structureDetailMix=0;this.nearBuf=new Int32Array(en);this.lastGatherX=1/0;this.lastGatherZ=1/0;this.nearIndex=new Vn(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)<Kn)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>Wn){r.nearSeatCount()&&r.setNearSeats(this.nearBuf,0);return}let s=this.nearIndex.gather(o.x,o.z,Wn,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 Nn=require("ogl");function hs(){let e="http://www.w3.org/2000/svg",t=document.createElementNS(e,"svg");t.setAttribute("viewBox","0 0 24 24"),t.setAttribute("width","18"),t.setAttribute("height","18"),t.setAttribute("aria-hidden","true"),t.setAttribute("focusable","false"),t.setAttribute("fill","none"),t.setAttribute("stroke","currentColor"),t.setAttribute("stroke-width","2"),t.setAttribute("stroke-linecap","round"),t.setAttribute("stroke-linejoin","round");let n=document.createElementNS(e,"path");return n.setAttribute("d","M8 3H5a2 2 0 0 0-2 2v3M16 3h3a2 2 0 0 0 2 2v3M8 21H5a2 2 0 0 0-2-2v-3M16 21h3a2 2 0 0 0 2-2v-3"),t.appendChild(n),t}function gs(e){let{container:t,model:n,opts:r,orbit:o,cinematic:i,analytics:a,loop:s,labelOverlay:c,stageAzimuth:u,overviewFraming:d}=e,f=0,m=-1,l=(M,R,k=28)=>{o.camera.position.set(M[0],M[1],M[2]),o.camera.lookAt(new Nn.Vec3(R[0],R[1],R[2])),o.camera.fov=k,o.camera.updateProjectionMatrix()},p=document.createElement("button");p.className="sl-3d-overview-control sl-3d-icon-control",p.type="button",p.replaceChildren(hs());let b=r.navLabels?.fitView??"Show whole venue";p.setAttribute("aria-label",b),p.title=b,Object.assign(p.style,{width:"44px",minWidth:"44px",minHeight:"44px",padding:"9px",borderRadius:"999px",background:"rgba(12,18,32,0.72)",color:"#c9d4ea",border:"1px solid rgba(150,165,205,0.35)",backdropFilter:"blur(6px)",font:"600 11px/1 inherit",cursor:"pointer",whiteSpace:"nowrap"});let h=()=>{p.firstElementChild||p.replaceChildren(hs())};h();let y=M=>{m=M;let R=e.gpu();R&&(R.seatProgram.uniforms.uFocusFloor.value=M,R.solidProgram.uniforms.uFocusFloor.value=M,R.chairProgram.uniforms.uFocusFloor.value=M),e.showSectionSeatLabels(null)},x=()=>{if(e.isDisposed())return;r.onViewTargetChange?.(null),r.onSectionFocusChange?.(null),e.panorama()&&(e.panorama().dispose(),e.setPanorama(null),a.panoramaClosed()),e.setPanoramaSphereVisible(!1),e.panoramaLoadAbort()?.abort(),e.setPanoramaLoadAbort(null),e.restorePanoramaLayer(),p.style.display="",c.setVisible(!0),e.setFrozen(!1);let M=m>=0?n.floors[m]:null;if(e.setNearFieldDetailEnabled(!!M),e.setSeatViewLocked(!1),g(),e.removeArriveChip(),e.setNavigationMode("orbit"),M){let R=M.focalWorld[0]-M.center[0],k=M.focalWorld[2]-M.center[2],z=Math.hypot(R,k)>M.radius*.12?Math.atan2(R,k):u,V={center:M.center,radius:M.radius,box:M.box},L={polarDeg:58,margin:1.12};e.reducedMotion()?o.frame(V,!1,z,!1,L):o.frameSoft(V,z,!1,L)}else e.reducedMotion()?o.frame(n.bounds,!1,u,r.portraitOverviewCrop===!0,d):o.frameSoft(n.bounds,u,r.portraitOverviewCrop===!0,d);e.showSectionSeatLabels(null),s.requestRender()},g=()=>{f++,e.setSeatStepping(!1),e.panoramaLoadAbort()?.abort(),e.setPanoramaLoadAbort(null),i.active&&(i.cancel(),o.resumeAfterFlight(n.focalWorld))},v=M=>{if(e.isDisposed()||!e.gpu())return Promise.resolve();let R=n.seats.idToIndex.get(M);if(R===void 0)return Promise.resolve();e.setNearFieldDetailEnabled(!0),r.onViewTargetChange?.(M),e.panorama()&&(e.panorama().dispose(),e.setPanorama(null),e.setPanoramaSphereVisible(!1),p.style.display="",e.restorePanoramaLayer()),e.panoramaLoadAbort()?.abort(),e.setPanoramaLoadAbort(null),e.setFrozen(!1);let k=e.inSeatView()&&r.arriveAtSeatEye===!0;e.setSeatStepping(k),e.setSeatViewLocked(!1);let z=++f;k?e.showArriveChip(M,z):e.removeArriveChip();let{eye:V,focal:L}=e.resolvedSeatViewPose(M,R),A=r.arriveAtSeatEye?e.seatViewArrival(M,R):null,_=A?A.focal:L,B=[o.camera.position.x,o.camera.position.y,o.camera.position.z],S=To(B,A?.eye??V,_,n.bounds.center,n.bounds.radius),E=A?A.eye:r.arriveAtSeatEye?V:S.finalPos,T=A?A.fov:r.arriveAtSeatEye?t.clientWidth/Math.max(1,t.clientHeight)<.7?Rn:65:28,w=[S.waypoints[0],S.waypoints[1],E];if(c.setVisible(!1),e.reducedMotion())return e.setSeatStepping(!1),l(E,_,T),s.requestRender(),a.cinematicSkipped(),e.isDisposed()||o.syncFromCamera(),e.setSeatViewLocked(r.arriveAtSeatEye===!0),A&&e.enterSeatView(A.stops),e.showArriveChip(M,z),Promise.resolve();let F=new Nn.Quat().copy(o.camera.quaternion),I=Ia(o.camera,E,_);s.requestRender();let O=k?700:2500;return i.start(w,F,I,O,T).then(()=>{e.isDisposed()||z!==f||(e.setSeatStepping(!1),a.cinematicPlayed(O),o.resumeAfterFlight(_),e.setSeatViewLocked(r.arriveAtSeatEye===!0),A&&e.enterSeatView(A.stops),s.requestRender(),e.showArriveChip(M,z))})},C=M=>{let R=n.sections.find(L=>L.id===M);if(!R||R.seatCount===0)return!1;e.setNearFieldDetailEnabled(!0),e.setSeatStepping(!1),e.setSeatViewLocked(!1),i.cancel(),e.removeArriveChip(),n.floors.length>1&&m!==R.floorIndex&&y(R.floorIndex),e.setNavigationMode("pan"),e.showSectionSeatLabels(M);let k=R.focalWorld[0]-R.center[0],z=R.focalWorld[2]-R.center[2],V=Math.hypot(k,z)>R.radius*.12?Math.atan2(k,z):void 0;return o.frame({center:R.center,radius:Math.max(5,R.radius*.5)},!1,V),r.onSectionFocusChange?.(M),s.requestRender(),!0},P=M=>{if(e.isDisposed()||!e.gpu())return!1;let R=n.seats.idToIndex.get(M);if(R===void 0)return!1;let k=R*3,z=[n.seats.iPosition[k],n.seats.iPosition[k+1]+.55,n.seats.iPosition[k+2]];return e.reducedMotion()?o.frame({center:z,radius:bs},!1,void 0,!1,ys):o.frameSoft({center:z,radius:bs},void 0,!1,ys),s.requestRender(),!0};return p.addEventListener("click",x),{overviewChip:p,layoutOverviewChip:h,flightGen:()=>f,focusedFloor:()=>m,applyFloorFocus:y,placeCameraFinal:l,cancelFlight:g,focusOverview:x,flyToSeat:v,focusSectionCamera:C,focusSeatCamera:P}}var bs=4.5,ys={polarDeg:48,margin:1.25};var yd={};function xs(e){let t=performance.now();return{model:St(e),buildMs:performance.now()-t,source:"main"}}function bd(e){let t=Kr(e.doc);return{...xs({...e,seats:t}),seats:t}}function vs(e,t,n){if(typeof Worker>"u")return Promise.resolve(t());let r;try{r=new Worker(new URL("./scene/scene.worker.js",yd.url),{type:"module"})}catch{return Promise.resolve(t())}return new Promise(o=>{let i=!1,a=u=>{i||(i=!0,clearTimeout(c),r.terminate(),o(u))},s=()=>a(t()),c=window.setTimeout(s,15e3);r.onerror=s,r.onmessage=u=>{let d=n(u.data);d?a(d):s()},r.postMessage(e)})}function Ss(e){return vs(e,()=>xs(e),({model:t,buildMs:n})=>({model:t,buildMs:n,source:"worker"}))}function Ms(e){return vs(e,()=>bd(e),({model:t,buildMs:n,seats:r})=>r?{model:t,buildMs:n,seats:r,source:"worker"}:null)}var gd=Math.PI/180,xd=6,vd=500;function Sd(e,t,n={}){let r=performance.now(),o=t.prepared?.model??St(t),i=new On(n.onAnalytics),a=new Array(o.seats.count);for(let[U,Y]of o.seats.idToIndex)a[Y]=U;let s=new Map(t.seats.map(U=>[U.id,U])),c=new Map;for(let U of t.seats){if(!U.rowId)continue;let Y=c.get(U.rowId);Y?Y.push(U.id):c.set(U.rowId,[U.id])}let u=new Map;for(let U of t.seats)u.set(U.id,U.sectionId);let d=new Map;for(let[U,Y]of o.seats.idToIndex){let $=u.get(U);if(!$)continue;let ee=d.get($);ee?ee.push(Y):d.set($,[Y])}let f=()=>{if(!l||!o.sectionSolidRanges.length)return;let{lit:U,anyUnlit:Y}=ha(o.sectionSolidRanges,d,o.seats.iState);l.setSectionShellLit(Y?U:null)},m=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)),l=null,p=null,b=!1,h=!1,y=!1,x=new Map,g=null,v=null,C=null,P=new Map,M=null,R=()=>{C===null&&(C=e.style.zIndex,e.style.zIndex="20")},k=()=>{C!==null&&(e.style.zIndex==="20"&&(e.style.zIndex=C),C=null)},z=!1,V=()=>z?fe.focusedFloor():-1,L=()=>{l=ga(S.gl,o),f(),p=new Cn(S.renderer,l.seatGeometry,l.chairGeometry,l.solidGeometry,o.seats.count),S.setClearColor(o.theme.background.top),p.setRestoreClear(o.theme.background.top),l.seatProgram.uniforms.uSeatRadius.value=De*o.theme.seatScale,l.seatProgram.uniforms.uFocusFloor.value=V(),l.solidProgram.uniforms.uFocusFloor.value=V(),l.chairProgram.uniforms.uFocusFloor.value=V(),l.screenProgram&&(l.screenProgram.uniforms.uFocusFloor.value=V()),_.forceRegather()},A=!1,_=new Bn({model:o,orbit:()=>E,gpu:()=>l}),B=U=>_.setDetailEnabled(U),S=new Qt(e,{onContextLost:()=>{y||i.contextLost(),b=!0,K.stop(),l=null,p=null},onContextRestored:()=>{L(),b=!1,y||i.contextRestored(),K.requestRender()}}),E=new Zt(S.gl,S.canvas,()=>K.requestRender(),()=>i.orbitEngaged());E.setAspect(S.aspect);let T=(t.doc.floors?.flatMap(U=>U.objects)??t.doc.objects).some(U=>U.type==="section"&&U.physical3dProvenance?.surfaceKind?.status==="inferred"),w=(()=>{if(T&&o.stages.length===0)return;let U=o.focalWorld[0]-o.bounds.center[0],Y=o.focalWorld[2]-o.bounds.center[2];return Math.hypot(U,Y)>o.bounds.radius*.12?Math.atan2(U,Y):void 0})(),F=o.floors.length>1?{polarDeg:48,margin:1.1}:{margin:1.1},I=typeof window<"u"&&!!window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches;E.frame(o.bounds,!I&&n.skipInitialOverviewAnimation!==!0,w,n.portraitOverviewCrop===!0,F);let O=new An(E.camera),j=ms(e),H=new Mn(e,{fontFamily:t.doc.theme?.fontFamily,ink:t.doc.theme?.textColor,backgroundRgb:o.theme.background.top}),N=o.labels,D=()=>Fi(N,o.floors.length,V());H.setLabels(D());let W=null,X=U=>{if(W=U,H.setForcedDense(!!U),!U){H.setLabels(D());return}let Y=t.seats.filter(J=>J.sectionId===U),$=new Set(Y.map(J=>J.id)),ee=new Set(Y.map(J=>J.rowId)),re=new Set(x.keys()),ie=new Set(Y.filter(J=>re.has(J.id)).map(J=>J.id)),se=D().filter(J=>J.kind!=="row"&&J.kind!=="seat"||(J.kind==="row"?ee.has(J.id.slice(4)):$.has(J.id.slice(5))&&(ie.size===0||ie.has(J.id.slice(5)))));if(o.seatCount<=6e3&&ie.size===0){H.setLabels(se);return}let me=ie.size?Y.filter(J=>ie.has(J.id)):Y,Qe=new Set(me.map(J=>`seat:${J.id}`)),Ue=me.flatMap(J=>{let ye=o.seats.idToIndex.get(J.id);if(ye===void 0)return[];let Re=ye*3;return[{id:`seat:${J.id}`,kind:"seat",text:re.has(J.id)?J.displayLabel||J.label:Mo(J.displayLabel||J.label),anchor:[o.seats.iPosition[Re],o.seats.iPosition[Re+1]+(re.has(J.id)?1.05:.55),o.seats.iPosition[Re+2]]}]});H.setLabels([...se.filter(J=>!Qe.has(J.id)),...Ue])};L();let Q=null,q=null,K=new Jt(U=>{if(b||!l||h)return!1;let Y=$a({flying:O.active,panoramaMounted:g!==null,seatViewActive:Q?.active===!0}),$=Y==="cinematic"?O.update(performance.now()):Y==="seatView"?Q.update(performance.now()):Y==="orbit"?E.update():!1;q?.syncZoomLimits();let ee=V()>=0?o.floors[V()]:null,re=ee?.radius??o.bounds.radius,ie=tr(E.currentDistance,re),se=A?{center:[E.camera.position.x,E.camera.position.y,E.camera.position.z],radius:520}:o.renderBounds;E.updateClipping(se);let me=ee?.center??o.renderBounds.center,Qe=ee?.radius??o.renderBounds.radius,Ue=(Ee,At)=>Math.hypot(E.camera.position.x-Ee[0],E.camera.position.y-Ee[1],E.camera.position.z-Ee[2])<=At*(_.detailVisible?1.8:1.55),J=Ue(me,Qe);if(!J&&W){let Ee=o.sections.find(At=>At.id===W);Ee&&(J=Ue(Ee.center,Math.max(12,Ee.radius*2)))}_.detailVisible=J;let ye=l.seatProgram.uniforms;ye.uSeatScale.value=ie.scale,ye.uSeatFade.value=ie.fade;let Re=!!ee&&nr(ee.seatCount,S.canvas.clientWidth||1,S.canvas.clientHeight||1),Wt=or(o.seats.count,re,E.currentDistance,E.camera.fov,S.canvas.clientHeight||1),Ct=_.detailVisible||Re||Wt?1:0,Kt=_.detailVisible||V()>=0||o.floors.length>1?1:0;return _.ease(U,Ct,Kt),ye.uSeatDetail.value=_.seatDetailMix,l.solidProgram.uniforms.uStructureDetail.value=_.structureDetailMix,ye.uMinPixels.value=ie.minPixels,ye.uPixelToWorld.value=2*Math.tan(E.camera.fov*gd/2)/Math.max(1,S.pixelHeight),_.update(_.detailVisible),S.renderer.render({scene:l.background,clear:!0}),S.renderer.render({scene:l.main,camera:E.camera,clear:!1}),H.update(E.camera.projectionViewMatrix,S.canvas.clientWidth||1,S.canvas.clientHeight||1,E.currentDistance,re,[E.camera.position.x,E.camera.position.y,E.camera.position.z]),$||_.seatDetailMix!==Ct||_.structureDetailMix!==Kt}),Z=typeof ResizeObserver<"u"?new ResizeObserver(()=>zn.resize()):null;Z?.observe(e);let te=U=>{let Y=re=>{let ie=o.seats.idToIndex.get(re);return ie===void 0?void 0:o.seats.iState[ie]},{updates:$,next:ee}=Ma(x,U,Y);if(x=ee,H.setSelectedSeatIds(x.keys()),W&&X(W),$.length){let re=no(o.seats,$);l&&l.uploadSeatStateRuns(re),f(),K.requestRender()}},Me=()=>M!==null?M:typeof window<"u"&&!!window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,Ae=8,Be=U=>{if(!n.getSeatView)return null;let Y=P.get(U);if(!Y)for(Y=Promise.resolve(n.getSeatView(U)),P.set(U,Y),Y.catch(()=>{P.get(U)===Y&&P.delete(U)});P.size>Ae;){let $=P.keys().next().value;if($===void 0)break;P.delete($)}return Y},ke=Ga(o.stages,o.focalWorld,o.bounds.groundY??0),Ne=Lo(ke),we=(U,Y)=>{let $=s.get(U),ee=Math.max(0,Math.round(o.seats.iFloor[Y]??0)),re=t.doc.floors?.[ee],ie=o.floors[ee],se=re?.focalPoint??t.doc.focalPoint,me=ie?{x:ie.focalWorld[0]/G,y:ie.focalWorld[2]/G}:se,Qe=$?.focalPoint?{x:$.focalPoint.x+me.x-se.x,y:$.focalPoint.y+me.y-se.y}:me,Ue=[o.seats.iPosition[Y*3],o.seats.iPosition[Y*3+1],o.seats.iPosition[Y*3+2]];return _a(Ue,Qe,re?.baseHeightM??0,$?.eyeHeightM,Ne)},de=()=>(e.clientWidth||S.canvas.clientWidth)<=520,Ge=null,ct=null,lt=async(U,Y,$)=>{if(!n.getSeatView||y||$!==fe.flightGen())return;let ee;try{ee=await ls()}catch{if(i.panoramaFailed(U,"mount"),!y&&$===fe.flightGen()){let re=qe(U,$,!0);requestAnimationFrame(()=>re?.querySelector("[data-panorama-trigger]")?.focus())}return}if(!(y||$!==fe.flightGen()||!Ge))return ct??=ee.createOpenPanorama(Ge),ct(U,Y,$)},Fe=ds({container:e,model:o,opts:n,expandedSeatById:s,seatIdsByRow:c,isNarrow:de,isDisposed:()=>y,flightGen:()=>fe.flightGen(),flyToSeat:U=>No(U),openPanorama:(U,Y,$)=>lt(U,Y,$)}),qe=Fe.show,ut=Fe.remove,ws=Fe.layout,$e=fs({container:e,orbit:E,isNarrow:de,enabled:n.chrome?.controlDock!==!1,...n.navLabels?{labels:n.navLabels}:{}});q=$e;let Ps=$e.element,wt=$e.setNavigationMode,Cs=$e.layout,As=$e.utilityControls,Pt=null,Vo=!1,Xt=U=>{$e.setSeatViewLocked(U),U||Q?.exit()};Q=qa({canvas:S.canvas,camera:E.camera,requestRender:()=>K.requestRender(),reducedMotion:Me,onStopChange:U=>{let Y=U??(Vo?"seat":null);Pt=Y;try{n.onSeatViewStopChange?.(Y)}catch{}},onApplied:()=>{y||E.syncFromCamera()}});let Rs=(U,Y)=>{let{eye:$}=we(U,Y),ee=(e.clientWidth||S.canvas.clientWidth||1)/Math.max(1,e.clientHeight||S.canvas.clientHeight||1),re=Ua($,ke,ee);if(n.seatViewStops===!1)return{...re,stops:[]};let ie=u.get(U),se=ie?o.sections.find(me=>me.id===ie):void 0;return{...re,stops:Ha(re,{aspect:ee,section:se&&se.seatCount>0?{center:se.center,radius:se.radius}:null,venue:{center:o.bounds.center,radius:o.bounds.radius}})}},fe=gs({container:e,model:o,opts:n,orbit:E,cinematic:O,analytics:i,loop:K,labelOverlay:H,stageAzimuth:w,overviewFraming:F,gpu:()=>l,isDisposed:()=>y,panorama:()=>g,setPanorama:U=>{g=U},setPanoramaSphereVisible:U=>{A=U},panoramaLoadAbort:()=>v,setPanoramaLoadAbort:U=>{v=U},setFrozen:U=>{h=U},restorePanoramaLayer:k,reducedMotion:Me,resolvedSeatViewPose:we,showSectionSeatLabels:X,setNearFieldDetailEnabled:B,setSeatViewLocked:Xt,setNavigationMode:wt,showArriveChip:qe,removeArriveChip:ut,inSeatView:()=>Pt!==null,setSeatStepping:U=>{Vo=U},seatViewArrival:(U,Y)=>n.arriveAtSeatEye?Rs(U,Y):null,enterSeatView:U=>Q?.enter(U)});z=!0;let Gn=fe.overviewChip,Es=fe.layoutOverviewChip,Is=fe.applyFloorFocus,Ts=fe.focusOverview,Bo=fe.cancelFlight,No=fe.flyToSeat,Go=fe.focusSectionCamera;As.appendChild(Gn),Ge={container:e,model:o,opts:n,analytics:i,orbit:E,loop:K,seatsById:s,ensureSeatView:Be,resolvedSeatViewPose:we,gpu:()=>l,gl:S.gl,isContextLost:()=>b,isDisposed:()=>y,flightGen:()=>fe.flightGen(),setPanorama:U=>{g=U},getLoadAbort:()=>v,setLoadAbort:U=>{v=U},setPanoramaSphereVisible:U=>{A=U,U&&Q?.exit()},setFrozen:U=>{h=U},raisePanoramaLayer:R,restorePanoramaLayer:k,getOverviewChip:()=>Gn,labelOverlay:H,reducedMotion:Me,removeArriveChip:ut,showArriveChip:qe};let ze=ps({glctx:S,orbit:E,model:o,seats:t.seats,opts:n,cinematic:O,analytics:i,seatIdByIndex:a,sectionIdBySeatId:u,tapSlop:xd,tapMs:vd,gpu:()=>l,pick:()=>p,seatViewLocked:()=>$e.seatViewLocked(),focusedSectionId:()=>W,selection:()=>x,cancelFlight:Bo,focusSectionCamera:Go,focusSeatCamera:fe.focusSeatCamera,setSelection:te,ensureSeatView:Be});S.canvas.addEventListener("pointerdown",ze.onDown),S.canvas.addEventListener("pointermove",ze.onMove),S.canvas.addEventListener("pointerup",ze.onUp),S.canvas.addEventListener("pointercancel",ze.onUp),K.requestRender();let zn={setAvailability(U){let Y=Sa(x,U),$=no(o.seats,Y);$.length&&l&&l.uploadSeatStateRuns($),f(),K.requestRender()},setSelection:te,setNavigationMode:wt,zoomIn(){E.zoomBy(pt),K.requestRender()},zoomOut(){E.zoomBy(Tt),K.requestRender()},flyToSeat:No,focusOverview:Ts,seatViewStop:()=>Pt,recentreSeatView:()=>Q?.recentre()??!1,resize(){let{width:U,height:Y}=S.resize();E.setAspect(U/Math.max(1,Y)),ws(),Cs(),Es(),K.requestRender()},stats(){return{...K.stats(),drawCalls:l?l.drawCalls:0,seatCount:o.seatCount}},getQualityEvidence(){let U=K.stats(),Y=S.canvas.clientWidth||1,$=S.canvas.clientHeight||1,ee=o.bounds.center,re=Ye(E.camera.projectionViewMatrix,[ee[0],o.bounds.box.min[1],ee[2]],Y,$),ie=Ye(E.camera.projectionViewMatrix,[ee[0],o.bounds.box.max[1],ee[2]],Y,$),se=o.bounds.box,me=[se.min[0],se.max[0]].flatMap(J=>[se.min[1],se.max[1]].flatMap(ye=>[se.min[2],se.max[2]].map(Re=>Ye(E.camera.projectionViewMatrix,[J,ye,Re],Y,$)))).filter(J=>Number.isFinite(J.x)&&Number.isFinite(J.y)&&Number.isFinite(J.depth)),Qe=me.length?(()=>{let J=Math.min(...me.map(Ze=>Ze.x)),ye=Math.max(...me.map(Ze=>Ze.x)),Re=Math.min(...me.map(Ze=>Ze.y)),Wt=Math.max(...me.map(Ze=>Ze.y)),Ct=Math.max(0,J),Kt=Math.min(Y,ye),Ee=Math.max(0,Re),At=Math.min($,Wt),qt=Math.max(0,Kt-Ct),Un=Math.max(0,At-Ee);return{box:{x:Ct,y:Ee,width:qt,height:Un},horizontalFillRatio:qt/Y,verticalFillRatio:Un/$,visibleAreaRatio:qt*Un/(Y*$),clippedEdges:[...Re<0?["top"]:[],...ye>Y?["right"]:[],...Wt>$?["bottom"]:[],...J<0?["left"]:[]]}})():void 0,Ue=String(S.gl.getParameter(S.gl.VERSION)??"");return{viewport:{width:Y,height:$},context:{webgl2:/webgl\s*2/i.test(Ue),lost:b},frame:{rendered:U.rendered,idle:U.idle},camera:{position:[E.camera.position.x,E.camera.position.y,E.camera.position.z],distance:E.currentDistance,verticalFovDeg:E.fovY},scene:{seatCount:o.seatCount,floorCount:o.floors.length,zoneCount:o.zones.length,sectionCount:o.sections.length,authoredRelief:m,renderedVerticalSpanM:Math.max(0,o.bounds.box.max[1]-o.bounds.box.min[1]),projectedReliefPx:re.visible&&ie.visible?Math.abs(re.y-ie.y):0},labels:H.qualityEvidence(),framing:Qe,...Pt?{seatView:{fovDeg:E.camera.fov,stop:Pt}}:{}}},getQualityReport(){return wn(zn.getQualityEvidence())},loseContextForTest(){S.simulateContextLossCycle()},floors(){return o.floors},focusFloor(U){if(U!==null&&!o.floors.some($=>$.index===U))return!1;let Y=U??-1;if(B(U!==null),Xt(!1),Is(Y),wt("orbit"),U===null)O.cancel(),Me()?E.frame(o.bounds,!1,w,n.portraitOverviewCrop===!0,F):E.frameSoft(o.bounds,w,n.portraitOverviewCrop===!0,F);else{let $=o.floors[U];if($.seatCount>0){O.cancel();let ee=$.focalWorld[0]-$.center[0],re=$.focalWorld[2]-$.center[2],ie=Math.hypot(ee,re)>$.radius*.12?Math.atan2(ee,re):w;E.frame({center:$.center,radius:$.radius,box:$.box},!1,ie,!1,{polarDeg:58,margin:1.12})}}return K.requestRender(),!0},zones(){return o.zones},focusZone(U){let Y=o.zones.find(ie=>ie.id===U);if(!Y||Y.seatCount===0)return!1;B(!1),Xt(!1),O.cancel(),wt("orbit"),X(null),n.onSectionFocusChange?.(null);let $=Y.focalWorld[0]-Y.center[0],ee=Y.focalWorld[2]-Y.center[2],re=Math.hypot($,ee)>Y.radius*.12?Math.atan2($,ee):void 0;return E.frame({center:Y.center,radius:Y.radius*1.25},!1,re),K.requestRender(),!0},sections(){return o.sections},focusSection(U){return Go(U)},rows(U){return U?o.rows.filter(Y=>Y.sectionId===U):o.rows},seatsInRow(U){return t.seats.filter(Y=>Y.rowId===U).map(Y=>({id:Y.id,label:Y.displayLabel||Y.label}))},focusRow(U){let Y=o.rows.find($=>$.id===U);return!Y||Y.seatCount===0?!1:(B(!0),Xt(!1),O.cancel(),wt("pan"),Y.sectionId&&(X(Y.sectionId),n.onSectionFocusChange?.(Y.sectionId)),E.frame({center:Y.center,radius:Math.max(2.5,Y.radius*.65)}),K.requestRender(),!0)},setReducedMotionForTest(U){M=U},dispose(){y=!0,ut(),Gn.remove(),Ps.remove(),Bo(),Q?.dispose(),K.stop(),H.dispose(),Z?.disconnect(),g&&(g.dispose(),g=null),k(),j(),S.canvas.removeEventListener("pointerdown",ze.onDown),S.canvas.removeEventListener("pointermove",ze.onMove),S.canvas.removeEventListener("pointerup",ze.onUp),S.canvas.removeEventListener("pointercancel",ze.onUp),E.dispose(),p&&p.dispose(),l&&l.dispose(),l=null,p=null,S.dispose()}};return i.opened(o.seatCount,m,t.prepared?.buildMs??performance.now()-r,t.prepared?.source??"inline"),zn}0&&(module.exports={VENUE3D_QUALITY_REPORT_VERSION,buildSceneModel,inspectVenue3DQualityEvidence,mountVenue3D,prepareVenue3D,prepareVenue3DFromChart});
|