@seatlayer/core 0.67.13 → 0.67.14
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/{categoryInventory-CDGQe2Ag.d.ts → categoryInventory-B1bjit6B.d.ts} +1 -1
- package/dist/{categoryInventory-BI3jJaqD.d.cts → categoryInventory-CAHGQ07K.d.cts} +1 -1
- package/dist/chunk-IO2A6P65.js +1 -0
- package/dist/chunk-IUQZK7OA.js +1 -0
- package/dist/{chunk-VI3IZS2B.js → chunk-OBBSZUYF.js} +1 -1
- package/dist/core/chart-ops/index.cjs +1 -1
- package/dist/core/chart-ops/index.d.cts +11 -4
- package/dist/core/chart-ops/index.d.ts +11 -4
- package/dist/core/chart-ops/index.js +1 -1
- package/dist/core/inventory/index.cjs +1 -1
- package/dist/core/inventory/index.d.cts +4 -4
- package/dist/core/inventory/index.d.ts +4 -4
- package/dist/core/inventory/index.js +1 -1
- package/dist/core/layout/index.d.cts +4 -4
- package/dist/core/layout/index.d.ts +4 -4
- package/dist/core/quality/index.d.cts +3 -3
- package/dist/core/quality/index.d.ts +3 -3
- package/dist/core/render-assets/index.d.cts +1 -1
- package/dist/core/render-assets/index.d.ts +1 -1
- package/dist/core/seatConfidence.d.cts +1 -1
- package/dist/core/seatConfidence.d.ts +1 -1
- package/dist/core/sections/index.d.cts +5 -5
- package/dist/core/sections/index.d.ts +5 -5
- package/dist/{eventConfigurations-YqyHnreh.d.cts → eventConfigurations-D66ZLfYS.d.cts} +3 -1
- package/dist/{eventConfigurations-DImP8Cd6.d.ts → eventConfigurations-IWEhHywT.d.ts} +3 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +12 -12
- package/dist/index.d.ts +12 -12
- package/dist/index.js +1 -1
- package/dist/{labeling-lXzjJrgV.d.cts → labeling-BCiv5l6e.d.cts} +1 -1
- package/dist/{labeling-Cb7ZwhoO.d.ts → labeling-DO9p-xLj.d.ts} +1 -1
- package/dist/{layout-cZ3VfeJR.d.cts → layout-BUz3xFCE.d.cts} +3 -3
- package/dist/{layout-ByBMw1t7.d.ts → layout-DzuyZFRr.d.ts} +3 -3
- package/dist/{renderedQuality-6ta0nSPm.d.cts → renderedQuality-L1g0XZ0i.d.cts} +1 -1
- package/dist/{renderedQuality-BJKHot_g.d.ts → renderedQuality-Xaar1aMI.d.ts} +1 -1
- package/dist/{renderer-B9GavToM.d.ts → renderer-BQuknAQY.d.ts} +1 -1
- package/dist/{renderer-C9BLd1g2.d.cts → renderer-DyVuc7SF.d.cts} +1 -1
- package/dist/{sections-ND5PRE4j.d.cts → sections-CkMXEJEf.d.cts} +1 -1
- package/dist/{sections-BvZ1cQkD.d.ts → sections-j5aC-O5u.d.ts} +1 -1
- package/dist/{segmentedRowModel-CLKP-2ca.d.ts → segmentedRowModel-CLLfsLFG.d.ts} +1 -1
- package/dist/{segmentedRowModel-BB9MPufB.d.cts → segmentedRowModel-DhcYIheF.d.cts} +1 -1
- package/dist/{ticketRestrictions-CjV47RNG.d.cts → ticketRestrictions-AgAcdcYP.d.cts} +2 -2
- package/dist/{ticketRestrictions-DUQ8wHjG.d.ts → ticketRestrictions-BJVsVMnP.d.ts} +2 -2
- package/dist/{types-hv6QjPRV.d.cts → types-BKw6Dn_O.d.cts} +18 -1
- package/dist/{types-hv6QjPRV.d.ts → types-BKw6Dn_O.d.ts} +18 -1
- package/dist/view3d/crossfade/panorama.d.cts +1 -1
- package/dist/view3d/crossfade/panorama.d.ts +1 -1
- package/dist/view3d/index.cjs +52 -33
- package/dist/view3d/index.d.cts +15 -3
- package/dist/view3d/index.d.ts +15 -3
- package/dist/view3d/index.js +50 -31
- package/package.json +1 -1
- package/dist/chunk-3TAVIEVO.js +0 -1
- package/dist/chunk-BTW7IGNT.js +0 -1
package/dist/view3d/index.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var Xi=Object.create;var Ft=Object.defineProperty;var Yi=Object.getOwnPropertyDescriptor;var Wi=Object.getOwnPropertyNames;var Ki=Object.getPrototypeOf,Qi=Object.prototype.hasOwnProperty;var bt=(e,t,n)=>()=>{if(n)throw n[0];try{return e&&(t=e(e=0)),t}catch(r){throw n=[r],r}};var so=(e,t)=>{for(var n in t)Ft(e,n,{get:t[n],enumerable:!0})},co=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Wi(t))!Qi.call(e,o)&&o!==n&&Ft(e,o,{get:()=>t[o],enumerable:!(r=Yi(t,o))||r.enumerable});return e};var ot=(e,t,n)=>(n=e!=null?Xi(Ki(e)):{},co(t||!e||!e.__esModule?Ft(n,"default",{value:e,enumerable:!0}):n,e)),qi=e=>co(Ft({},"__esModule",{value:!0}),e);function Ic(e,t){return!Number.isFinite(e)||!Number.isFinite(t)||e<=0||t<=0?0:Math.ceil(e*t*4*(4/3))}function Ac(e){return(e!==void 0&&e<=2?32:e!==void 0&&e>=8?192:96)*1024*1024}function an(e){let t=typeof navigator>"u"?void 0:navigator;return{saveData:t?.connection?.saveData===!0,maxTextureSize:e,maxDecodedBytes:Ac(t?.deviceMemory)}}function sn(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||Ic(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 vi(){return new DOMException("Panorama image load aborted","AbortError")}function Rt(e,t){return new Promise((n,r)=>{if(t?.aborted){r(vi());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(vi())};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 cn(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 eo=bt(()=>{"use strict"});function Si(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 to(e){return Math.max(Ec,Math.min(Rc,e))}function Tc(e,t,n){let r=(.5+e/360)*n;return t/2-r}function kc(e,t=un){return e*(180/t)}function Mi(e,t,n){return(e-t)/2+ln(n,t)}function ln(e,t){let n=Re/180*t;return Math.max(-n,Math.min(n,e))}function wi(e,t,n={}){let r=n.fadeMs??400,o=t.initialBearingDeg??0,i=sn(t,an()),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 l=document.createElement("div");Object.assign(l.style,{position:"absolute",inset:"0",backgroundImage:`url("${i.initialUrl}")`,backgroundRepeat:"repeat-x",cursor:"grab"}),c.appendChild(l);let h=document.createElement("button");if(h.type="button",h.setAttribute("aria-label","Close"),h.textContent="\u2715",Object.assign(h.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(h),n.disclosure){let _=document.createElement("div");_.textContent=`${n.disclosurePrefix??"360\xB0 panorama"} \xB7 ${n.disclosure}`,Object.assign(_.style,{position:"absolute",top:"12px",left:"12px",zIndex:"2",maxWidth:"calc(100% - 88px)",padding:"8px 11px",borderRadius:"999px",overflow:"hidden",color:"#dce6f8",background:"rgba(8,12,18,0.68)",font:"600 11px/1.2 ui-sans-serif, system-ui, sans-serif",textOverflow:"ellipsis",whiteSpace:"nowrap",pointerEvents:"none",backdropFilter:"blur(6px)"}),c.appendChild(_)}let m=document.createElement("div");m.textContent="Drag to look \xB7 pinch or scroll to zoom \xB7 Esc to close",Object.assign(m.style,{position:"absolute",bottom:"12px",left:"0",right:"0",textAlign:"center",color:"rgba(230,237,243,0.7)",font:"12px ui-sans-serif, system-ui, sans-serif",pointerEvents:"none"}),c.appendChild(m),e.appendChild(c),h.focus({preventScroll:!0});let d=0,f=0,p=0,y=0,b=un,g=()=>{let _=c.clientHeight||1,L=c.clientWidth||1,Y=I.naturalWidth||L*2,K=I.naturalHeight||_,J=d>0?(L/2-p)/d:0,Z=f>0?y/f:0;f=kc(_,b),d=f*(Y/K),l.style.backgroundSize=`${d}px ${f}px`,x?p=L/2-J*d:(p=Tc(o,L,d),y=ln((t.initialPitchDeg??0)/180*f,f),x=!0),y=ln(Z*f,f),l.style.backgroundPosition=`${p}px ${Mi(_,f,y)}px`},x=!1,S=()=>{let _=c.clientHeight||1;y=ln(y,f),l.style.backgroundPosition=`${p}px ${Mi(_,f,y)}px`},I=new Image;I.onload=g,I.src=i.initialUrl;let v=()=>{};i.upgradeUrl&&(v=cn(()=>{(t.resolveUrl?t.resolveUrl(i.upgradeUrl):Promise.resolve(i.upgradeUrl)).then(L=>!L||a.signal.aborted?null:Rt(L,a.signal).then(Y=>({full:Y,url:L}))).then(L=>{L&&(w||a.signal.aborted||(I=L.full,l.style.backgroundImage=`url("${L.url}")`,g()))}).catch(()=>{})})),requestAnimationFrame(g);let R=!1,O=0,V=0,U=0,N=new Map,A=()=>{let[_,L]=[...N.values()];return _&&L?Math.hypot(_.x-L.x,_.y-L.y):0},M=_=>{let L=to(_);L!==b&&(b=L,g())},P=_=>{N.set(_.pointerId,{x:_.clientX,y:_.clientY}),R=N.size===1,O=_.clientX,V=_.clientY,N.size===2&&(U=A()),l.style.cursor="grabbing";try{l.setPointerCapture?.(_.pointerId)}catch{}},C=_=>{if(N.has(_.pointerId)){if(N.set(_.pointerId,{x:_.clientX,y:_.clientY}),N.size>=2){let L=A();U>0&&L>0&&M(b*(U/L)),U=L,R=!1;return}R&&(p+=_.clientX-O,y+=_.clientY-V,O=_.clientX,V=_.clientY,S())}},T=_=>{N.delete(_.pointerId),U=N.size===2?A():0;let L=N.values().next().value;R=N.size===1,L?(O=L.x,V=L.y):l.style.cursor="grab";try{l.releasePointerCapture?.(_.pointerId)}catch{}},H=_=>{_.preventDefault(),M(b+_.deltaY*.04)};l.addEventListener("pointerdown",P),l.addEventListener("pointermove",C),l.addEventListener("pointerup",T),l.addEventListener("pointercancel",T),l.addEventListener("wheel",H,{passive:!1});let k=!1,w=!1,B=0,E=()=>{l.removeEventListener("pointerdown",P),l.removeEventListener("pointermove",C),l.removeEventListener("pointerup",T),l.removeEventListener("pointercancel",T),l.removeEventListener("wheel",H),window.removeEventListener("keydown",G)},F=()=>{v(),a.abort(),n.signal?.removeEventListener("abort",s),B&&(window.clearTimeout(B),B=0),E(),c.parentNode&&c.parentNode.removeChild(c),u?.isConnected&&u.focus({preventScroll:!0})},z=()=>{if(k)return;k=!0,c.style.opacity="0";let _=()=>{B=0,!w&&(F(),n.onClose?.())};B=window.setTimeout(_,r)},G=_=>{if(_.key==="Tab"){_.preventDefault(),h.focus({preventScroll:!0});return}if(_.key==="Escape"){_.stopPropagation(),z();return}if(_.key==="ArrowLeft"||_.key==="ArrowRight")p+=_.key==="ArrowLeft"?-32:32;else if(_.key==="ArrowUp"||_.key==="ArrowDown")y+=(_.key==="ArrowUp"?4:-4)*(f/180);else if(_.key==="+"||_.key==="="){M(b-5),_.preventDefault();return}else if(_.key==="-"){M(b+5),_.preventDefault();return}else return;_.preventDefault(),S()};return window.addEventListener("keydown",G),h.addEventListener("click",z),requestAnimationFrame(()=>{c.style.opacity="1"}),{close:z,dispose(){k=!0,w=!0,F()}}}var un,Ec,Rc,Re,no=bt(()=>{"use strict";eo();un=70,Ec=35,Rc=90;Re=35});function Dc(e=Lc,t=_c,n=Fc){let r=e+1,o=t+1,i=r*o,a=new Float32Array(i*3),s=new Float32Array(i*2);for(let l=0;l<o;l++){let h=l/t,m=h*Math.PI,d=Math.sin(m),f=Math.cos(m);for(let p=0;p<r;p++){let y=p/e,b=(y-.5)*Math.PI*2,g=l*r+p;a[g*3]=n*d*Math.sin(b),a[g*3+1]=n*f,a[g*3+2]=-n*d*Math.cos(b),s[g*2]=y,s[g*2+1]=h}}let c=new Uint16Array(e*t*6),u=0;for(let l=0;l<t;l++)for(let h=0;h<e;h++){let m=l*r+h,d=m+r;c[u++]=m,c[u++]=d,c[u++]=m+1,c[u++]=m+1,c[u++]=d,c[u++]=d+1}return{position:a,uv:s,index:c}}function Pi(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 Ci(e,t){let{position:n,uv:r,index:o}=Dc(),i=new je.Geometry(e,{position:{size:3,data:n},uv:{size:2,data:r},index:{data:o}}),a=new je.Texture(e,{image:t,wrapS:e.CLAMP_TO_EDGE,wrapT:e.CLAMP_TO_EDGE,generateMipmaps:!0,flipY:!1}),s=new je.Program(e,{vertex:Oc,fragment:Bc,uniforms:{uPano:{value:a},uOpacity:{value:0}},transparent:!0,depthTest:!1,depthWrite:!1}),c=new je.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 je,Lc,_c,Fc,Oc,Bc,Ii=bt(()=>{"use strict";je=require("ogl"),Lc=64,_c=32,Fc=500;Oc=`#version 300 es
|
|
1
|
+
"use strict";var $i=Object.create;var Bt=Object.defineProperty;var Ji=Object.getOwnPropertyDescriptor;var ea=Object.getOwnPropertyNames;var ta=Object.getPrototypeOf,na=Object.prototype.hasOwnProperty;var xt=(e,t,n)=>()=>{if(n)throw n[0];try{return e&&(t=e(e=0)),t}catch(r){throw n=[r],r}};var mo=(e,t)=>{for(var n in t)Bt(e,n,{get:t[n],enumerable:!0})},fo=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of ea(t))!na.call(e,o)&&o!==n&&Bt(e,o,{get:()=>t[o],enumerable:!(r=Ji(t,o))||r.enumerable});return e};var it=(e,t,n)=>(n=e!=null?$i(ta(e)):{},fo(t||!e||!e.__esModule?Bt(n,"default",{value:e,enumerable:!0}):n,e)),oa=e=>fo(Bt({},"__esModule",{value:!0}),e);function Qc(e,t){return!Number.isFinite(e)||!Number.isFinite(t)||e<=0||t<=0?0:Math.ceil(e*t*4*(4/3))}function Zc(e){return(e!==void 0&&e<=2?32:e!==void 0&&e>=8?192:96)*1024*1024}function un(e){let t=typeof navigator>"u"?void 0:navigator;return{saveData:t?.connection?.saveData===!0,maxTextureSize:e,maxDecodedBytes:Zc(t?.deviceMemory)}}function dn(e,t={}){let n=e.previewUrl?.trim();if(!n||n===e.url)return{initialUrl:e.url,initialWidth:e.sourceWidth,initialHeight:e.sourceHeight,reason:"full-only"};let r={initialUrl:n,initialWidth:e.previewWidth,initialHeight:e.previewHeight};if(t.saveData)return{...r,reason:"save-data"};let o=[...e.variants??[],...e.sourceWidth!==void 0&&e.sourceHeight!==void 0?[{url:e.url,width:e.sourceWidth,height:e.sourceHeight}]:[]].filter(c=>c.url.trim()&&c.url!==n&&Number.isFinite(c.width)&&c.width>0&&Number.isFinite(c.height)&&c.height>0).sort((c,l)=>c.width*c.height-l.width*l.height);if(!o.length)return{...r,upgradeUrl:e.url,reason:"progressive"};let i=o.filter(c=>t.maxTextureSize===void 0||Math.max(c.width,c.height)<=t.maxTextureSize);if(!i.length)return{...r,reason:"texture-limit"};let a=i.filter(c=>t.maxDecodedBytes===void 0||Qc(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 Ai(){return new DOMException("Panorama image load aborted","AbortError")}function Lt(e,t){return new Promise((n,r)=>{if(t?.aborted){r(Ai());return}let o=new Image;o.crossOrigin="anonymous";let i=!1,a=()=>{o.onload=null,o.onerror=null,t?.removeEventListener("abort",c)},s=l=>{i||(i=!0,a(),l?r(l):n(o))},c=()=>{o.src="",s(Ai())};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 mn(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 ro=xt(()=>{"use strict"});function Ei(e){let t=e.mediaKind==="demo-render",n=e.generated||e.mediaKind==="model"?"Live 3D \xB7 chart-derived seat-eye":t?e.coverage==="exact-seat"?"AI-generated exact-seat demo":e.coverage==="row-representative"?"AI-generated representative row demo":e.coverage==="section-representative"?"AI-generated representative section demo":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 io(e){return Math.max($c,Math.min(Jc,e))}function el(e,t,n){let r=(.5+e/360)*n;return t/2-r}function tl(e,t=hn){return e*(180/t)}function Ri(e,t,n){return(e-t)/2+fn(n,t)}function fn(e,t){let n=Te/180*t;return Math.max(-n,Math.min(n,e))}function ki(e,t,n={}){let r=n.fadeMs??400,o=t.initialBearingDeg??0,i=dn(t,un()),a=new AbortController,s=()=>a.abort();n.signal?.addEventListener("abort",s,{once:!0});let c=document.createElement("div"),l=document.activeElement instanceof HTMLElement?document.activeElement:null;c.setAttribute("role","dialog"),c.setAttribute("aria-modal","true"),c.setAttribute("aria-label",n.seatLabel?`View from ${n.seatLabel}`:"View from seat"),c.tabIndex=-1,Object.assign(c.style,{position:"absolute",inset:"0",zIndex:"10",opacity:"0",transition:`opacity ${r}ms ease`,background:"#05070c",overflow:"hidden",touchAction:"none"});let f=document.createElement("div");Object.assign(f.style,{position:"absolute",inset:"0",backgroundImage:`url("${i.initialUrl}")`,backgroundRepeat:"repeat-x",cursor:"grab"}),c.appendChild(f);let u=document.createElement("button");if(u.type="button",u.setAttribute("aria-label","Close"),u.textContent="\u2715",Object.assign(u.style,{position:"absolute",top:"12px",right:"12px",zIndex:"2",width:"44px",height:"44px",borderRadius:"999px",cursor:"pointer",border:"1px solid rgba(255,255,255,0.25)",background:"rgba(8,12,18,0.6)",color:"#e6edf3",fontSize:"15px",lineHeight:"1"}),c.appendChild(u),n.disclosure){let T=document.createElement("div");T.textContent=`${n.disclosurePrefix??"360\xB0 panorama"} \xB7 ${n.disclosure}`,Object.assign(T.style,{position:"absolute",top:"12px",left:"12px",zIndex:"2",maxWidth:"calc(100% - 88px)",padding:"8px 11px",borderRadius:"999px",overflow:"hidden",color:"#dce6f8",background:"rgba(8,12,18,0.68)",font:"600 11px/1.2 ui-sans-serif, system-ui, sans-serif",textOverflow:"ellipsis",whiteSpace:"nowrap",pointerEvents:"none",backdropFilter:"blur(6px)"}),c.appendChild(T)}let d=document.createElement("div");d.textContent="Drag to look \xB7 pinch or scroll to zoom \xB7 Esc to close",Object.assign(d.style,{position:"absolute",bottom:"12px",left:"0",right:"0",textAlign:"center",color:"rgba(230,237,243,0.7)",font:"12px ui-sans-serif, system-ui, sans-serif",pointerEvents:"none"}),c.appendChild(d),e.appendChild(c),u.focus({preventScroll:!0});let m=0,h=0,p=0,g=0,b=hn,y=()=>{let T=c.clientHeight||1,L=c.clientWidth||1,H=C.naturalWidth||L*2,W=C.naturalHeight||T,q=m>0?(L/2-p)/m:0,Q=h>0?g/h:0;h=tl(T,b),m=h*(H/W),f.style.backgroundSize=`${m}px ${h}px`,x?p=L/2-q*m:(p=el(o,L,m),g=fn((t.initialPitchDeg??0)/180*h,h),x=!0),g=fn(Q*h,h),f.style.backgroundPosition=`${p}px ${Ri(T,h,g)}px`},x=!1,v=()=>{let T=c.clientHeight||1;g=fn(g,h),f.style.backgroundPosition=`${p}px ${Ri(T,h,g)}px`},C=new Image;C.onload=y,C.src=i.initialUrl;let M=()=>{};i.upgradeUrl&&(M=mn(()=>{(t.resolveUrl?t.resolveUrl(i.upgradeUrl):Promise.resolve(i.upgradeUrl)).then(L=>!L||a.signal.aborted?null:Lt(L,a.signal).then(H=>({full:H,url:L}))).then(L=>{L&&(E||a.signal.aborted||(C=L.full,f.style.backgroundImage=`url("${L.url}")`,y()))}).catch(()=>{})})),requestAnimationFrame(y);let I=!1,_=0,B=0,z=0,V=new Map,A=()=>{let[T,L]=[...V.values()];return T&&L?Math.hypot(T.x-L.x,T.y-L.y):0},S=T=>{let L=io(T);L!==b&&(b=L,y())},R=T=>{V.set(T.pointerId,{x:T.clientX,y:T.clientY}),I=V.size===1,_=T.clientX,B=T.clientY,V.size===2&&(z=A()),f.style.cursor="grabbing";try{f.setPointerCapture?.(T.pointerId)}catch{}},w=T=>{if(V.has(T.pointerId)){if(V.set(T.pointerId,{x:T.clientX,y:T.clientY}),V.size>=2){let L=A();z>0&&L>0&&S(b*(z/L)),z=L,I=!1;return}I&&(p+=T.clientX-_,g+=T.clientY-B,_=T.clientX,B=T.clientY,v())}},P=T=>{V.delete(T.pointerId),z=V.size===2?A():0;let L=V.values().next().value;I=V.size===1,L?(_=L.x,B=L.y):f.style.cursor="grab";try{f.releasePointerCapture?.(T.pointerId)}catch{}},G=T=>{T.preventDefault(),S(b+T.deltaY*.04)};f.addEventListener("pointerdown",R),f.addEventListener("pointermove",w),f.addEventListener("pointerup",P),f.addEventListener("pointercancel",P),f.addEventListener("wheel",G,{passive:!1});let k=!1,E=!1,F=0,D=()=>{f.removeEventListener("pointerdown",R),f.removeEventListener("pointermove",w),f.removeEventListener("pointerup",P),f.removeEventListener("pointercancel",P),f.removeEventListener("wheel",G),window.removeEventListener("keydown",U)},N=()=>{M(),a.abort(),n.signal?.removeEventListener("abort",s),F&&(window.clearTimeout(F),F=0),D(),c.parentNode&&c.parentNode.removeChild(c),l?.isConnected&&l.focus({preventScroll:!0})},j=()=>{if(k)return;k=!0,c.style.opacity="0";let T=()=>{F=0,!E&&(N(),n.onClose?.())};F=window.setTimeout(T,r)},U=T=>{if(T.key==="Tab"){T.preventDefault(),u.focus({preventScroll:!0});return}if(T.key==="Escape"){T.stopPropagation(),j();return}if(T.key==="ArrowLeft"||T.key==="ArrowRight")p+=T.key==="ArrowLeft"?-32:32;else if(T.key==="ArrowUp"||T.key==="ArrowDown")g+=(T.key==="ArrowUp"?4:-4)*(h/180);else if(T.key==="+"||T.key==="="){S(b-5),T.preventDefault();return}else if(T.key==="-"){S(b+5),T.preventDefault();return}else return;T.preventDefault(),v()};return window.addEventListener("keydown",U),u.addEventListener("click",j),requestAnimationFrame(()=>{c.style.opacity="1"}),{close:j,dispose(){k=!0,E=!0,N()}}}var hn,$c,Jc,Te,ao=xt(()=>{"use strict";ro();hn=70,$c=35,Jc=90;Te=35});function il(e=nl,t=ol,n=rl){let r=e+1,o=t+1,i=r*o,a=new Float32Array(i*3),s=new Float32Array(i*2);for(let f=0;f<o;f++){let u=f/t,d=u*Math.PI,m=Math.sin(d),h=Math.cos(d);for(let p=0;p<r;p++){let g=p/e,b=(g-.5)*Math.PI*2,y=f*r+p;a[y*3]=n*m*Math.sin(b),a[y*3+1]=n*h,a[y*3+2]=-n*m*Math.cos(b),s[y*2]=g,s[y*2+1]=u}}let c=new Uint16Array(e*t*6),l=0;for(let f=0;f<t;f++)for(let u=0;u<e;u++){let d=f*r+u,m=d+r;c[l++]=d,c[l++]=m,c[l++]=d+1,c[l++]=d+1,c[l++]=m,c[l++]=m+1}return{position:a,uv:s,index:c}}function Ti(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 Li(e,t){let{position:n,uv:r,index:o}=il(),i=new Ye.Geometry(e,{position:{size:3,data:n},uv:{size:2,data:r},index:{data:o}}),a=new Ye.Texture(e,{image:t,wrapS:e.CLAMP_TO_EDGE,wrapT:e.CLAMP_TO_EDGE,generateMipmaps:!0,flipY:!1}),s=new Ye.Program(e,{vertex:al,fragment:sl,uniforms:{uPano:{value:a},uOpacity:{value:0}},transparent:!0,depthTest:!1,depthWrite:!1}),c=new Ye.Mesh(e,{geometry:i,program:s});return{mesh:c,setOpacity(l){s.uniforms.uOpacity.value=Math.max(0,Math.min(1,l))},setImage(l){a.image=l,a.needsUpdate=!0},dispose(){c.setParent(null),i.remove(),a.texture&&e.deleteTexture(a.texture),s.remove()}}}var Ye,nl,ol,rl,al,sl,_i=xt(()=>{"use strict";Ye=require("ogl"),nl=64,ol=32,rl=500;al=`#version 300 es
|
|
2
2
|
precision highp float;
|
|
3
3
|
in vec3 position;
|
|
4
4
|
in vec2 uv;
|
|
@@ -8,7 +8,7 @@ out vec2 vUv;
|
|
|
8
8
|
void main() {
|
|
9
9
|
vUv = uv;
|
|
10
10
|
gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
|
|
11
|
-
}`,
|
|
11
|
+
}`,sl=`#version 300 es
|
|
12
12
|
precision highp float;
|
|
13
13
|
in vec2 vUv;
|
|
14
14
|
uniform sampler2D uPano;
|
|
@@ -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 Ei(e,t,n,r={}){let o=r.fadeMs??400,i=t?.initialBearingDeg??0,a=Math.max(-Re,Math.min(Re,t?.initialPitchDeg??0)),s=un,c=!1,u=new AbortController,l=()=>u.abort();r.signal?.addEventListener("abort",l,{once:!0});let h=()=>{},m=[n.camera.position.x,n.camera.position.y,n.camera.position.z];if(!t&&n.cameraOriginWorld&&n.camera.position.set(n.cameraOriginWorld[0],n.cameraOriginWorld[1],n.cameraOriginWorld[2]),!t&&n.focalWorld){let E=n.camera.position,F=n.focalWorld[0]-E.x,z=n.focalWorld[1]-E.y,G=n.focalWorld[2]-E.z,_=Math.hypot(F,G);_>.001&&(i=Math.atan2(F,-G)*180/Math.PI,a=Math.max(-Re,Math.min(Re,Math.atan2(z,_)*180/Math.PI)))}let d=null;if(t){let E=n.gl.getParameter(n.gl.MAX_TEXTURE_SIZE),F=sn(t,an(E)),z;try{let G=t.resolveUrl?await t.resolveUrl(F.initialUrl):F.initialUrl;if(!G)throw new Error("panorama_asset_unavailable");z=await Rt(G,u.signal)}catch{return r.signal?.removeEventListener("abort",l),null}try{d=Ci(n.gl,z)}catch{return u.abort(),r.signal?.removeEventListener("abort",l),null}d.mesh.renderOrder=999,d.mesh.setParent(n.scene),F.upgradeUrl&&(h=cn(()=>{(t.resolveUrl?t.resolveUrl(F.upgradeUrl):Promise.resolve(F.upgradeUrl)).then(_=>!_||u.signal.aborted?null:Rt(_,u.signal)).then(_=>{_&&(c||u.signal.aborted||(d?.setImage(_),n.requestRender()))}).catch(()=>{})}))}let f=n.camera.fov;n.camera.perspective({fov:s,aspect:n.camera.aspect});let p=n.camera.quaternion.slice(),y=()=>{let E=n.camera.position;d?.mesh.position.set(E.x,E.y,E.z);let[F,z,G]=Pi(i,a);n.camera.lookAt([E.x+F,E.y+z,E.z+G]),n.requestRender()};y();let b=document.createElement("div"),g=document.activeElement instanceof HTMLElement?document.activeElement:null;b.setAttribute("role","dialog"),b.setAttribute("aria-modal","true"),b.setAttribute("aria-label",r.seatLabel?`View from ${r.seatLabel}`:"View from seat"),b.tabIndex=-1,Object.assign(b.style,{position:"absolute",inset:"0",zIndex:"10",cursor:"grab",touchAction:"none"});let x=document.createElement("button");if(x.type="button",x.setAttribute("aria-label","Close"),x.textContent="\u2715",Object.assign(x.style,{position:"absolute",top:"12px",right:"12px",zIndex:"2",width:"44px",height:"44px",borderRadius:"999px",cursor:"pointer",border:"1px solid rgba(255,255,255,0.25)",background:"rgba(8,12,18,0.6)",color:"#e6edf3",fontSize:"15px",lineHeight:"1"}),b.appendChild(x),r.disclosure){let E=document.createElement("div");E.textContent=`${r.disclosurePrefix??"360\xB0 panorama"} \xB7 ${r.disclosure}`,Object.assign(E.style,{position:"absolute",top:"12px",left:"12px",zIndex:"2",maxWidth:"calc(100% - 88px)",padding:"8px 11px",borderRadius:"999px",overflow:"hidden",color:"#dce6f8",background:"rgba(8,12,18,0.68)",font:"600 11px/1.2 ui-sans-serif, system-ui, sans-serif",textOverflow:"ellipsis",whiteSpace:"nowrap",pointerEvents:"none",backdropFilter:"blur(6px)"}),b.appendChild(E)}let S=document.createElement("div");S.textContent="Drag to look \xB7 pinch or scroll to zoom \xB7 Esc to close",Object.assign(S.style,{position:"absolute",bottom:"12px",left:"0",right:"0",textAlign:"center",color:"rgba(230,237,243,0.7)",font:"12px ui-sans-serif, system-ui, sans-serif",pointerEvents:"none"}),b.appendChild(S),e.appendChild(b),x.focus({preventScroll:!0});let I=!1,v=0,R=0,O=0,V=new Map,U=()=>{let[E,F]=[...V.values()];return E&&F?Math.hypot(E.x-F.x,E.y-F.y):0},N=E=>{let F=to(E);F!==s&&(s=F,n.camera.perspective({fov:s,aspect:n.camera.aspect}),y())},A=E=>{E.target!==x&&(V.set(E.pointerId,{x:E.clientX,y:E.clientY}),I=V.size===1,v=E.clientX,R=E.clientY,V.size===2&&(O=U()),b.setPointerCapture?.(E.pointerId),b.style.cursor="grabbing")},M=E=>{if(V.has(E.pointerId)){if(V.set(E.pointerId,{x:E.clientX,y:E.clientY}),V.size>=2){let F=U();O>0&&F>0&&N(s*(O/F)),O=F,I=!1;return}I&&(i+=(E.clientX-v)*Ai,a=Math.max(-Re,Math.min(Re,a+(E.clientY-R)*Ai)),v=E.clientX,R=E.clientY,y())}},P=E=>{V.delete(E.pointerId),O=V.size===2?U():0;let F=V.values().next().value;I=V.size===1,F?(v=F.x,R=F.y):b.style.cursor="grab";try{b.releasePointerCapture?.(E.pointerId)}catch{}},C=E=>{E.preventDefault(),N(s+E.deltaY*.04)};b.addEventListener("pointerdown",A),b.addEventListener("pointermove",M),b.addEventListener("pointerup",P),b.addEventListener("pointercancel",P),b.addEventListener("wheel",C,{passive:!1});let T=E=>{if(!c){if(E.key==="Tab"){E.preventDefault(),x.focus({preventScroll:!0});return}if(E.key==="Escape"){E.stopPropagation(),B.close();return}if(E.key==="ArrowLeft"||E.key==="ArrowRight")i+=E.key==="ArrowLeft"?-4:4;else if(E.key==="ArrowUp"||E.key==="ArrowDown")a=Math.max(-Re,Math.min(Re,a+(E.key==="ArrowUp"?4:-4)));else if(E.key==="+"||E.key==="="){N(s-5),E.preventDefault();return}else if(E.key==="-"){N(s+5),E.preventDefault();return}else return;E.preventDefault(),y()}};window.addEventListener("keydown",T);let H=0,k=(E,F)=>{if(!d){F?.();return}let z=E===1?0:1,G=performance.now(),_=()=>{if(c)return;let L=o<=0?1:Math.min(1,(performance.now()-G)/o);d?.setOpacity(z+(E-z)*L),n.requestRender(),L<1?H=requestAnimationFrame(_):F?.()};H=requestAnimationFrame(_)};k(1);let w=()=>{c||(c=!0,h(),u.abort(),r.signal?.removeEventListener("abort",l),cancelAnimationFrame(H),b.removeEventListener("pointerdown",A),b.removeEventListener("pointermove",M),b.removeEventListener("pointerup",P),b.removeEventListener("pointercancel",P),b.removeEventListener("wheel",C),window.removeEventListener("keydown",T),b.remove(),g?.isConnected&&g.focus({preventScroll:!0}),d?.dispose(),n.camera.position.set(m[0],m[1],m[2]),n.camera.perspective({fov:f,aspect:n.camera.aspect}),n.camera.quaternion.set(p[0],p[1],p[2],p[3]),n.requestRender())},B={close(){if(c)return;let E=()=>{w(),r.onClose?.()};cancelAnimationFrame(H),k(0,E)},dispose:w};return x.addEventListener("click",()=>B.close()),B}var Ai,Ri=bt(()=>{"use strict";Ii();no();eo();Ai=.15});var Ti={};so(Ti,{createOpenPanorama:()=>Vc});function Vc(e){let{container:t,model:n,opts:r,analytics:o,orbit:i,loop:a,seatsById:s,ensureSeatView:c,resolvedSeatViewPose:u,gpu:l,gl:h,isContextLost:m,isDisposed:d,flightGen:f,setPanorama:p,getLoadAbort:y,setLoadAbort:b,setPanoramaSphereVisible:g,setFrozen:x,raisePanoramaLayer:S,restorePanoramaLayer:I,getOverviewChip:v,labelOverlay:R,reducedMotion:O,removeArriveChip:V,showArriveChip:U}=e;return async(N,A,M)=>{y()?.abort();let P=new AbortController;b(P);let C=n.seats.idToIndex.get(N);if(C===void 0){i.syncFromCamera();return}let T=s.get(N)?.label??N,H=u(N,C),k=c(N);if(!k){P.abort(),y()===P&&b(null),i.syncFromCamera();return}x(!0),a.stop();let w;try{w=await k}catch{if(y()===P&&b(null),o.panoramaFailed(N,"source"),!d()&&M===f()){x(!1),i.resumeAfterFlight(H.focal),a.requestRender();let Y=U(N,M,!0);requestAnimationFrame(()=>Y?.querySelector("[data-panorama-trigger]")?.focus())}return}if(d()||M!==f()){P.abort(),y()===P&&b(null);return}V();let B=v(),E=()=>{P.abort(),y()===P&&b(null),p(null),g(!1),I(),B.style.display="",R.setVisible(!r.arriveAtSeatEye),x(!1),o.panoramaClosed(),i.resumeAfterFlight(H.focal),a.requestRender();let Y=U(N,f());requestAnimationFrame(()=>Y?.querySelector("[data-panorama-trigger]")?.focus())},F=w.generated===!0,z=Si(w);S(),g(!F),B.style.display="none";let G=O()?0:A,_=l(),L=_&&!m()?await Ei(t,F?null:w,{gl:h,scene:_.main,camera:i.camera,requestRender:()=>a.requestRender(),cameraOriginWorld:F?H.eye:void 0,focalWorld:H.focal},{fadeMs:G,seatLabel:T,disclosure:z,disclosurePrefix:F?"Live seat-eye view":"360\xB0 panorama",onClose:E,signal:P.signal}):null;if(d()||M!==f()){P.abort(),g(!1),y()===P&&b(null),L?.dispose(),B.style.display="",I();return}if(L)i.syncFromCamera(),R.setVisible(!1),x(!1),a.requestRender(),p(L);else if(F){I(),B.style.display="",x(!1),i.resumeAfterFlight(H.focal),a.requestRender(),p(null),g(!1),o.panoramaFailed(N,"mount");let Y=U(N,f(),!0);requestAnimationFrame(()=>Y?.querySelector("[data-panorama-trigger]")?.focus()),y()===P&&b(null);return}else g(!1),o.panoramaFallback(N),p(wi(t,w,{fadeMs:G,seatLabel:T,disclosure:z,onClose:E,signal:P.signal}));o.panoramaOpened()}}var ki=bt(()=>{"use strict";no();Ri()});var Uc={};so(Uc,{VENUE3D_QUALITY_REPORT_VERSION:()=>Zr,buildSceneModel:()=>dt,inspectVenue3DQualityEvidence:()=>tn,mountVenue3D:()=>jc,prepareVenue3D:()=>Gi});module.exports=qi(Uc);var fo=require("ogl");var Zi=/^#?([\da-f]{3}|[\da-f]{6})$/i;function $i(e){let t=Zi.exec((e??"").trim());if(!t)return null;let n=t[1].length===3?t[1].split("").map(o=>o+o).join(""):t[1],r=parseInt(n,16);return[r>>16&255,r>>8&255,r&255]}function te(e){let t=$i(e);return t?[t[0]/255,t[1]/255,t[2]/255]:null}function gn(e){let t=e/255;return t<=.04045?t/12.92:((t+.055)/1.055)**2.4}function Ji(e){return .2126*gn(e[0])+.7152*gn(e[1])+.0722*gn(e[2])}function lo(e){return Ji([e[0]*255,e[1]*255,e[2]*255])}function ea(e){return .2126*e[0]+.7152*e[1]+.0722*e[2]}function he(e,t,n){return[e[0]+(t[0]-e[0])*n,e[1]+(t[1]-e[1])*n,e[2]+(t[2]-e[2])*n]}function yt(e,t){let n=ea(e);return he(e,[n,n,n],t)}var xe=["available","held","sold","selected","dimmed"];function gt(e){let t=xe.indexOf(e);return t<0?0:t}var uo={available:[.24,.82,.52],held:[.95,.66,.22],sold:[.34,.39,.45],selected:[.24,.74,1],dimmed:[.28,.32,.37]};function mo(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 xn={ground:[.07,.085,.11],tierTop:[.24,.28,.34],tierWall:[.17,.2,.25],stageTop:[.94,.7,.38],stageWall:[.48,.33,.18],decorTop:[.22,.25,.29],decorWall:[.15,.17,.2],gaTop:[.24,.28,.33],gaWall:[.16,.19,.23],boothTop:[.3,.33,.38],boothWall:[.2,.23,.27],tableTop:[.38,.34,.29],tableWall:[.24,.21,.18]},Ke={top:[.05,.06,.08],bottom:[.1,.12,.15]};function ye(e,t){return[Math.min(1,e[0]*t),Math.min(1,e[1]*t),Math.min(1,e[2]*t)]}function ta(){let e=typeof window<"u"&&window.devicePixelRatio||1,t=navigator.deviceMemory,n=typeof t=="number"&&t<=4?1.5:2;return Math.min(e,n)}var Dt=class{constructor(t,n){this.clearRgb=[0,0,0];this.container=t,this.canvas=document.createElement("canvas"),this.canvas.style.display="block",this.canvas.style.width="100%",this.canvas.style.height="100%",this.canvas.style.touchAction="none",this.canvas.tabIndex=0,this.canvas.setAttribute("role","application"),this.canvas.setAttribute("aria-label","Interactive 3D venue. Drag or use arrow keys to look around; pinch, scroll, plus or minus to zoom."),this.renderer=new fo.Renderer({canvas:this.canvas,dpr:ta(),alpha:!1,antialias:!1,depth:!0,stencil:!1,powerPreference:"high-performance",webgl:2}),this.gl=this.renderer.gl,this.clearRgb=[Ke.top[0],Ke.top[1],Ke.top[2]],this.gl.clearColor(this.clearRgb[0],this.clearRgb[1],this.clearRgb[2],1),t.appendChild(this.canvas),this.lostHandler=r=>{r.preventDefault(),n.onContextLost()},this.restoredHandler=()=>n.onContextRestored(),this.canvas.addEventListener("webglcontextlost",this.lostHandler,!1),this.canvas.addEventListener("webglcontextrestored",this.restoredHandler,!1),this.resize()}setClearColor(t){this.clearRgb=[t[0],t[1],t[2]],this.gl.clearColor(t[0],t[1],t[2],1)}get clearColor(){return this.clearRgb}resize(){let t=Math.max(1,this.container.clientWidth||this.canvas.clientWidth||1),n=Math.max(1,this.container.clientHeight||this.canvas.clientHeight||1);return this.renderer.setSize(t,n),{width:t,height:n}}get pixelHeight(){return this.renderer.height*this.renderer.dpr}get aspect(){return this.renderer.width/Math.max(1,this.renderer.height)}dispose(){this.canvas.removeEventListener("webglcontextlost",this.lostHandler,!1),this.canvas.removeEventListener("webglcontextrestored",this.restoredHandler,!1);let t=this.gl.getExtension("WEBGL_lose_context");t&&t.loseContext(),this.canvas.parentNode&&this.canvas.parentNode.removeChild(this.canvas)}simulateContextLossCycle(){let t=this.gl.getExtension("WEBGL_lose_context");t&&(t.loseContext(),setTimeout(()=>{t.restoreContext&&t.restoreContext()},300))}};var it=require("ogl"),de=Math.PI/180,vn=15*de,Mn=80*de,rt=.12,ho=35,po=1.25,Ot=class{constructor(t,n,r,o){this.fovY=ho;this.target=new it.Vec3;this.azimuth=-30*de;this.polar=55*de;this.distance=10;this.azT=-30*de;this.polT=55*de;this.distT=10;this.minDist=1;this.maxDist=100;this.gestureFired=!1;this.interactionEnabled=!0;this.dragging=!1;this.panning=!1;this.lastX=0;this.lastY=0;this.activePointers=new Map;this.pinchDist=0;this.pinchCx=0;this.pinchCy=0;this.targetT=new it.Vec3;this.panAnchor=new it.Vec3;this.panLimit=0;this.primaryDragMode="orbit";this.camera=new it.Camera(t,{fov:ho,near:.1,far:5e3,aspect:1}),this.canvas=n,this.requestRender=r,this.onGesture=o,this.onPointerDown=i=>{if(this.interactionEnabled){try{this.canvas.setPointerCapture?.(i.pointerId)}catch{}if(this.activePointers.set(i.pointerId,{x:i.clientX,y:i.clientY}),this.activePointers.size===1){let a=i.button===2||i.button===1,s=i.button===0&&(i.shiftKey?this.primaryDragMode==="orbit":this.primaryDragMode==="pan");this.panning=a||s,this.dragging=!this.panning,this.lastX=i.clientX,this.lastY=i.clientY}else if(this.activePointers.size===2){this.dragging=!1,this.panning=!1,this.pinchDist=this.currentPinchDistance();let a=this.pinchCentroid();this.pinchCx=a.x,this.pinchCy=a.y}}},this.onPointerMove=i=>{if(!this.interactionEnabled||!this.activePointers.has(i.pointerId))return;if(this.activePointers.set(i.pointerId,{x:i.clientX,y:i.clientY}),this.activePointers.size>=2){let c=this.currentPinchDistance();this.pinchDist>0&&(this.dollyBy(Math.exp((this.pinchDist-c)*.005)),this.fireGesture()),this.pinchDist=c;let 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}this.dragging&&(this.lastX=i.clientX,this.lastY=i.clientY,(a!==0||s!==0)&&this.fireGesture(),this.azT-=a*.006,this.polT=Math.max(vn,Math.min(Mn,this.polT-s*.006)),this.requestRender())},this.onPointerUp=i=>{this.activePointers.delete(i.pointerId);try{this.canvas.releasePointerCapture?.(i.pointerId)}catch{}this.activePointers.size<2&&(this.pinchDist=0),this.activePointers.size===0&&(this.dragging=!1,this.panning=!1)},this.onContextMenu=i=>{i.preventDefault()},this.onWheel=i=>{if(i.preventDefault(),!this.interactionEnabled)return;let a=i.deltaMode===1?16:i.deltaMode===2?100:1,s=Math.max(-2,Math.min(2,i.deltaY*a/100));this.dollyBy(Math.exp(s*.22)),this.fireGesture()},this.onKeyDown=i=>{if(!this.interactionEnabled)return;let a=7*de;if(i.shiftKey&&(i.key==="ArrowLeft"||i.key==="ArrowRight"||i.key==="ArrowUp"||i.key==="ArrowDown"))this.panBy(i.key==="ArrowLeft"?-32:i.key==="ArrowRight"?32:0,i.key==="ArrowUp"?-32:i.key==="ArrowDown"?32:0);else if(i.key==="ArrowLeft"||i.key==="ArrowRight")this.azT+=i.key==="ArrowLeft"?-a:a;else if(i.key==="ArrowUp"||i.key==="ArrowDown")this.polT=Math.max(vn,Math.min(Mn,this.polT+(i.key==="ArrowUp"?-a:a)));else if(i.key==="+"||i.key==="=")this.dollyBy(.82);else if(i.key==="-"||i.key==="_")this.dollyBy(1.22);else return;i.preventDefault(),this.fireGesture(),this.requestRender()},n.addEventListener("pointerdown",this.onPointerDown),n.addEventListener("pointermove",this.onPointerMove),n.addEventListener("pointerup",this.onPointerUp),n.addEventListener("pointercancel",this.onPointerUp),n.addEventListener("wheel",this.onWheel,{passive:!1}),n.addEventListener("keydown",this.onKeyDown),n.addEventListener("contextmenu",this.onContextMenu)}pinchCentroid(){let t=[...this.activePointers.values()];if(!t.length)return{x:0,y:0};let n=0,r=0;for(let o of t)n+=o.x,r+=o.y;return{x:n/t.length,y:r/t.length}}panBy(t,n){let r=this.canvas.clientHeight||1,o=2*this.distance*Math.tan(this.fovY*de/2)/r,i=Math.sin(this.azimuth),a=Math.cos(this.azimuth),s=a,c=-i,u=Math.cos(this.polar),l=Math.sin(this.polar),h=-i*u,m=-a*u;this.targetT.x+=(-t*s+n*h)*o,this.targetT.z+=(-t*c+n*m)*o,this.targetT.y+=n*l*o,this.clampPan(),this.requestRender()}clampPan(){if(this.panLimit<=0)return;let t=this.panLimit,n=this.panAnchor.x,r=this.panAnchor.y,o=this.panAnchor.z;this.targetT.x=Math.max(n-t,Math.min(n+t,this.targetT.x)),this.targetT.z=Math.max(o-t,Math.min(o+t,this.targetT.z)),this.targetT.y=Math.max(r-t*.5,Math.min(r+t,this.targetT.y))}fireGesture(){this.gestureFired||(this.gestureFired=!0,this.onGesture?.())}currentPinchDistance(){let t=[...this.activePointers.values()];return t.length<2?0:Math.hypot(t[0].x-t[1].x,t[0].y-t[1].y)}dollyBy(t){this.distT=Math.max(this.minDist,Math.min(this.maxDist,this.distT*t)),this.requestRender()}zoomBy(t){this.interactionEnabled&&(this.dollyBy(t),this.fireGesture())}setPrimaryDragMode(t){this.primaryDragMode=t}setInteractionEnabled(t){this.interactionEnabled=t,!t&&(this.activePointers.clear(),this.dragging=!1,this.panning=!1,this.pinchDist=0)}frame(t,n=!1,r,o=!1,i){this.target.set(t.center[0],t.center[1],t.center[2]),this.targetT.copy(this.target),this.panAnchor.copy(this.target),this.panLimit=Math.max(1,t.radius)*1.5;let a=Math.max(1,t.radius),s=this.fovY*de/2,c=o?Math.max(.82,this.camera.aspect||1):this.camera.aspect||1,u=Math.atan(Math.tan(s)*c);this.azT=r??-30*de,this.polT=Math.max(15,Math.min(80,i?.polarDeg??55))*de;let l=this.fitDistance(t,s,u,this.azT,this.polT);this.distT=l*Math.max(1.05,Math.min(2,i?.margin??po)),this.minDist=Math.max(2,a*.12),this.maxDist=l*4,n?(this.azimuth=this.azT,this.polar=12*de,this.distance=this.distT*1.7):(this.azimuth=this.azT,this.polar=this.polT,this.distance=this.distT),this.applyPosition()}setAspect(t){this.camera.perspective({aspect:t})}frameSoft(t,n,r=!1,o){this.target.set(t.center[0],t.center[1],t.center[2]),this.targetT.copy(this.target),this.panAnchor.copy(this.target),this.panLimit=Math.max(1,t.radius)*1.5,this.syncFromCamera(),this.camera.perspective({fov:this.fovY,aspect:this.camera.aspect});let i=this.fovY*de/2,a=r?Math.max(.82,this.camera.aspect||1):this.camera.aspect||1,s=Math.atan(Math.tan(i)*a);this.azT=n??this.azimuth,this.polT=Math.max(15,Math.min(80,o?.polarDeg??55))*de;let c=this.fitDistance(t,i,s,this.azT,this.polT);this.distT=c*Math.max(1.05,Math.min(2,o?.margin??po))}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),l=-u*Math.sin(o),h=-Math.cos(i),m=-u*Math.cos(o);if(Math.abs(h)>.999)return s;let d=-m,f=l,p=Math.hypot(d,f);d/=p,f/=p;let y=-f*h,b=f*l-d*m,g=d*h,x=Math.tan(r),S=Math.tan(n),I=1;for(let v=0;v<8;v++){let R=(v&1?c.max[0]:c.min[0])-t.center[0],O=(v&2?c.max[1]:c.min[1])-t.center[1],V=(v&4?c.max[2]:c.min[2])-t.center[2],U=R*l+O*h+V*m,N=Math.abs(R*d+V*f),A=Math.abs(R*y+O*b+V*g);I=Math.max(I,N/x-U,A/S-U)}return Math.min(s,Math.max(I,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*rt,this.polar+=n*rt,this.distance+=r*rt,this.target.x+=o*rt,this.target.y+=i*rt,this.target.z+=a*rt,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(vn,Math.min(Mn,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 Bt=class{constructor(t){this.rafId=0;this.running=!1;this.lastTime=0;this.fpsEma=0;this.rendered=0;this.tick=t=>{let n=this.lastTime?(t-this.lastTime)/1e3:.016666666666666666;if(this.lastTime=t,n>0){let o=1/n;this.fpsEma=this.fpsEma?this.fpsEma*.9+o*.1:o}this.rendered++,this.frame(n)?this.rafId=requestAnimationFrame(this.tick):(this.running=!1,this.rafId=0)};this.frame=t}requestRender(){this.running||(this.running=!0,this.lastTime=0,this.rafId=requestAnimationFrame(this.tick))}stats(){return{fps:this.running?Math.round(this.fpsEma):0,rendered:this.rendered,idle:!this.running}}stop(){this.rafId&&cancelAnimationFrame(this.rafId),this.rafId=0,this.running=!1}};var at=2.5,na=1.15,xt=6,st=10,bo=6,yo=9.5,go=.9,xo=2.2,Sn=30,wn=4,Vt=8192;var Jc=st+wn;function vo(e,t){let n=t*1.4,r=t*3.2;if(e<=n)return{scale:1,fade:0,minPixels:at};let o=Math.min(1,(e-n)/Math.max(.001,r-n));return{scale:1-o*.4,fade:o*.55,minPixels:at+o*(na-at)}}function Mo(e,t,n){return!(e>0)||!(t>0)||!(n>0)?!1:t*n/e>=64}function So(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 oa=[{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"}],tl=new Map(oa.map(e=>[e.key,e]));var ra={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 wo(e){let t=e?.[0];return t&&ra[t]||"#3b82f6"}var ia=[{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"}],nl=new Map(ia.map(e=>[e.key,e]));var aa=["reference-focal","bar","entrance","exit","restroom","screen","sound","concession","coat","wall","rail","suite","obstruction"],ol=new Set(aa);var Co=[{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}}],Io=Co.map(e=>e.key),sa=new Map(Co.map(e=>[e.key,e]));function Po(e){return typeof e=="string"&&sa.has(e)}function Ao(e,t){return Po(e)?e:Po(t?.seatGlyph)?t.seatGlyph:"circle"}var Ie=.02291666666666667,Ve=1/Ie,ca=58,la=ca*Ie;var ua=3,Eo=0,Pn=120,da=0,ma=45,fa=7,Nt=1.2;function Cn(e,t,n,r){return Number.isFinite(e)?Math.max(t,Math.min(n,e)):r}function ha(e){return!Number.isFinite(e)||!Number.isInteger(e)||e<0?0:e<=fa?e:ua}function Ro(e,t={}){let n=Cn(t.floorBaseHeightM,Eo,Pn,0),r=Math.min(Pn,n+ha(e.elevation)*la),o=e.height===void 0?r:Cn(e.height,Eo,Pn,r),i=Cn(e.rake,da,ma,0);return{height:o,rake:i}}var ko=ot(require("earcut"),1),Lo=ot(require("polygon-clipping"),1);var ll=Math.PI/180;function In(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 vt(e){return e.length?In(e):null}function Qe(e){let t=0;for(let n=0,r=e.length;n<r;n+=1){let o=e[n],i=e[(n+1)%r];t+=o.x*i.y-i.x*o.y}return t/2}function Mt(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 D=Ie,pa=.002;function ba(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<pa}var qe=class{constructor(t=16384){this.len=0;this.buf=new Float32Array(t)}push3(t,n,r){this.len+3>this.buf.length&&this.grow(this.len+3),this.buf[this.len++]=t,this.buf[this.len++]=n,this.buf[this.len++]=r}push1(t){this.len+1>this.buf.length&&this.grow(this.len+1),this.buf[this.len++]=t}grow(t){let n=this.buf.length*2;for(;n<t;)n*=2;let r=new Float32Array(n);r.set(this.buf.subarray(0,this.len)),this.buf=r}get length(){return this.len}toArray(){return this.buf.slice(0,this.len)}},Ht=class{constructor(){this.pos=new qe;this.nor=new qe;this.col=new qe;this.flr=new qe;this.mat=new qe;this.currentFloor=0;this.currentMaterial=0}setFloor(t){this.currentFloor=t}setMaterial(t){this.currentMaterial=t}tri(t,n,r,o,i,a=i,s=i){ba(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 ya(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,l=i*a-r*c,h=r*s-o*a,m=Math.hypot(u,l,h)||1;return u/=m,l/=m,h/=m,[u,l,h]}function ga(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,ko.default)(r,o.length?o:void 0,2);return{pts:n,tris:i}}function An(e){return Qe(e)<0?[...e].reverse():e}var xa=3;function va(e,t,n,r){let o=r(e),i=r(t),a=r(n),s=(d,f,p,y)=>Math.abs(r({x:(d.x+f.x)/2,y:(d.y+f.y)/2})-(p+y)/2),c=(e.x+t.x+n.x)/3,u=(e.y+t.y+n.y)/3,l=(o+i+a)/3,h=Math.max(s(e,t,o,i),s(t,n,i,a),s(n,e,a,o),Math.abs(r({x:c,y:u})-l)),m=(d,f,p)=>{let y=Math.abs(r({x:(d+c)/2,y:(f+u)/2})-(p+l)/2);y>h&&(h=y)};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),h}function St(e,t,n,r,o){if(o<=0)return va(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(St(e,i,s,r,o-1),St(i,t,a,r,o-1),St(s,a,n,r,o-1),St(i,a,s,r,o-1))}function wt(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},d={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};wt(e,t,m,f,o,i,a-1,s),wt(e,m,n,d,o,i,a-1,s),wt(e,f,d,r,o,i,a-1,s),wt(e,m,d,f,o,i,a-1,s);return}let c=[t.x*D,o(t),t.y*D],u=[n.x*D,o(n),n.y*D],l=[r.x*D,o(r),r.y*D];if(s){e.triN(c,u,l,s(t),s(n),s(r),i);return}let h=ya(c,u,l);h[1]<0&&(h=[-h[0],-h[1],-h[2]]),e.tri(c,u,l,h,i)}var Ma=8;function To(e,t,n){if(!Number.isFinite(n))return e;let r=[],o=(i,a,s,c,u)=>{if(u>0){let l={x:(i.x+a.x)/2,y:(i.y+a.y)/2},h=t(l);if(Math.abs(h-(s+c)/2)>n){o(i,l,s,h,u-1),o(l,a,h,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),Ma)}return r}function Gt(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,l=Math.hypot(c,u);l>t&&Math.abs((a.x-i.x)*u-(a.y-i.y)*c)/l<t||r.push(a)}return r.length>=3?r:n}var zt=.001*Ve*.1;function se(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(Qe(t))<1e-4))return;let l=Gt(To(Gt(An(t),zt),r,c),zt),h=n?.map(v=>Gt(To(Gt(An(v),zt),r,c),zt)).filter(v=>v.length>=3&&Math.abs(Qe(v))>=1e-4),{pts:m,tris:d}=ga(l,h),f=[i[0]*s.top,i[1]*s.top,i[2]*s.top],p=[i[0]*s.bottomCap,i[1]*s.bottomCap,i[2]*s.bottomCap],y=[a[0]*s.top,a[1]*s.top,a[2]*s.top],b=[a[0]*s.wallBottom,a[1]*s.wallBottom,a[2]*s.wallBottom],g=0;if(Number.isFinite(c))for(;g<xa;g++){let v=0;for(let R=0;R<d.length;R+=3){let O=St(m[d[R]],m[d[R+1]],m[d[R+2]],r,g);O>v&&(v=O)}if(v<=c)break}for(let v=0;v<d.length;v+=3){let R=m[d[v]],O=m[d[v+1]],V=m[d[v+2]];wt(e,R,O,V,r,f,g,u);let U=[R.x*D,o,R.y*D],N=[O.x*D,o,O.y*D],A=[V.x*D,o,V.y*D];e.tri(U,A,N,[0,-1,0],p)}let x=v=>{if(g<=0)return v;let R=1<<g,O=[];for(let V=0;V<v.length;V++){let U=v[V],N=v[(V+1)%v.length];for(let A=0;A<R;A++){let M=A/R;O.push({x:U.x+(N.x-U.x)*M,y:U.y+(N.y-U.y)*M})}}return O},S=In(l),I=[{ring:x(l),flip:!1}];if(h)for(let v of h)v.length>=3&&I.push({ring:x(v),flip:!0});for(let{ring:v,flip:R}of I)for(let O=0;O<v.length;O++){let V=v[O],U=v[(O+1)%v.length],N=(U.x-V.x)*D,M=(U.y-V.y)*D,P=-N,C=Math.hypot(M,P)||1;M/=C,P/=C;let T=(V.x+U.x)/2-S.x,H=(V.y+U.y)/2-S.y,k=M*T+P*H;R&&(k=-k),k<0&&(M=-M,P=-P);let w=[M,0,P],B=[V.x*D,r(V),V.y*D],E=[U.x*D,r(U),U.y*D],F=[V.x*D,o,V.y*D],z=[U.x*D,o,U.y*D];e.tri(B,E,z,w,y,y,b),e.tri(B,z,F,w,y,b,b)}}function _o(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 jt(e,t,n=2.5){if(t<=0||e.length<3)return e;let r=An(e),o=r.length,i=[];for(let s=0;s<o;s++){let c=r[s],u=r[(s+1)%o],l=u.x-c.x,h=u.y-c.y,m=Math.hypot(l,h)||1;i.push({x:h/m,y:-l/m})}let a=[];for(let s=0;s<o;s++){let c=r[s],u=i[(s-1+o)%o],l=i[s],h=u.x+l.x,m=u.y+l.y,d=Math.hypot(h,m),f=()=>{a.push([c.x+u.x*t,c.y+u.y*t]),a.push([c.x+l.x*t,c.y+l.y*t])};if(d<1e-9){f();continue}h/=d,m/=d;let p=h*u.x+m*u.y,y=1/Math.max(p,1e-6);if(!Number.isFinite(y)||y>n){f();continue}a.push([c.x+h*t*y,c.y+m*t*y])}if(a.length<3)return e;try{let s=Lo.default.union([[...a,a[0]]]),c=null,u=-1/0;for(let h of s){let m=Math.abs(Qe(h[0].map(([d,f])=>({x:d,y:f}))));m>u&&(u=m,c=h[0])}if(!c)return e;let l=c.map(([h,m])=>({x:h,y:m}));if(l.length>1){let h=l[0],m=l[l.length-1];Math.abs(h.x-m.x)<1e-9&&Math.abs(h.y-m.y)<1e-9&&l.pop()}return l.length>=3?l:e}catch{return e}}function Ut(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 Pt(e,t,n,r){return[{x:e,y:t},{x:e+n,y:t},{x:e+n,y:t+r},{x:e,y:t+r}]}var ie={pedestal:0,pad:1,back:2,arm:3,footrest:4,leg:5,body:10,head:11},Sa=.44,wa=.15,Pa=.3,Ca=.24;function Fo(e){return e===void 0||!Number.isFinite(e)||e<=0?Ca:Math.min(Pa,Math.max(wa,e*Sa))}var En=.21,Ia=.05,Rn=.45,Xt=Rn+Ia,Aa=[{part:ie.pedestal,min:[-.3,0,-.3],max:[.3,.36,.3]},{part:ie.pad,min:[-1,.36,-.95],max:[1,Rn,1]},{part:ie.back,min:[-1,Xt,-1],max:[1,.92,-.72]},{part:ie.arm,min:[-1,.44,-.82],max:[-.78,.65,.78]},{part:ie.arm,min:[.78,.44,-.82],max:[1,.65,.78]},{part:ie.footrest,min:[-.9,.18,.78],max:[.9,.31,1.34]},{part:ie.leg,min:[-.82,0,-.7],max:[-.62,.37,-.48]},{part:ie.leg,min:[.62,0,-.7],max:[.82,.37,-.48]},{part:ie.leg,min:[-.82,0,.48],max:[-.62,.37,.7]},{part:ie.leg,min:[.62,0,.48],max:[.82,.37,.7]}],Ea=[{part:ie.body,min:[-.52,.39,-.08],max:[-.08,.55,.82]},{part:ie.body,min:[.08,.39,-.08],max:[.52,.55,.82]},{part:ie.body,min:[-.47,.05,.58],max:[-.13,.43,.82]},{part:ie.body,min:[.13,.05,.58],max:[.47,.43,.82]},{part:ie.head,min:[-.16,1.04,-.33],max:[.16,1.1,-.13]}],Ra=[{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 Do(){let e=[],t=[],n=[],r=[],o=(C,T,H)=>{let k=n.length,[w,B,E]=C,F=[B[0]-w[0],B[1]-w[1],B[2]-w[2]],z=[E[0]-w[0],E[1]-w[1],E[2]-w[2]],G=F[1]*z[2]-F[2]*z[1],_=F[2]*z[0]-F[0]*z[2],L=F[0]*z[1]-F[1]*z[0],Y=Math.hypot(G,_,L);Y>1e-9?(G/=Y,_/=Y,L/=Y):[G,_,L]=T,G*T[0]+_*T[1]+L*T[2]<0&&(G=-G,_=-_,L=-L);for(let K of C)e.push(...K),t.push(G,_,L),n.push(H);r.push(k,k+1,k+2,k,k+2,k+3)},i=C=>{for(let T of Ra){let H=T.c.map(k=>k.map((w,B)=>w?C.max[B]:C.min[B]));o(H,T.n,C.part)}};for(let C of Aa)i(C);for(let C of Ea)i(C);let a=Rn,s=1.08,c=.47,u=.69,l=-.55,h=.08,m=-.48,d=.01,f=[-c,a,l],p=[c,a,l],y=[-c,a,h],b=[c,a,h],g=[-u,s,m],x=[u,s,m],S=[-u,s,d],I=[u,s,d];o([p,x,I,b],[1,0,0],ie.body),o([y,S,g,f],[-1,0,0],ie.body),o([S,I,x,g],[0,1,0],ie.body),o([f,p,b,y],[0,-1,0],ie.body),o([b,I,S,y],[0,0,1],ie.body),o([f,g,x,p],[0,0,-1],ie.body);let v=10,R=8,O=[0,1.205,-.23],V=[.42,.115,.38],U=n.length;for(let C=0;C<=R;C++){let T=Math.PI*C/R,H=Math.cos(T),k=Math.sin(T);for(let w=0;w<=v;w++){let B=Math.PI*2*w/v,E=k*Math.cos(B),F=k*Math.sin(B);e.push(O[0]+V[0]*E,O[1]+V[1]*H,O[2]+V[2]*F);let z=E/V[0],G=H/V[1],_=F/V[2],L=Math.hypot(z,G,_)||1;z/=L,G/=L,_/=L,t.push(z,G,_),n.push(ie.head)}}for(let C=0;C<R;C++)for(let T=0;T<v;T++){let H=U+C*(v+1)+T,k=H+v+1;r.push(H,k,H+1,H+1,k,k+1)}let N=new Float32Array(e),A=new Float32Array(t),M=new Float32Array(n),P=new Uint16Array(r);return{position:N,normal:A,part:M,index:P,vertexCount:n.length,indexCount:r.length}}function Oo(e,t,n,r){let o=new Float32Array(t),i=u=>e[u*3],a=u=>e[u*3+2],s=0,c=(u,l)=>{let h=l-u;for(let m=u;m<l;m++){let[d,f]=r(m),p=d-i(m),y=f-a(m);if(h>=2){let b=Math.max(u,m-1),g=Math.min(l-1,m+1),x=i(g)-i(b),S=a(g)-a(b),I=Math.hypot(x,S);if(I>1e-6){let v=-S/I,R=x/I;v*p+R*y<0&&(v=-v,R=-R),p=v,y=R}}o[m]=p===0&&y===0?0:Math.atan2(p,y)}};for(let u=1;u<=t;u++)(u===t||n(u)!==n(s))&&(c(s,u),s=u);return o}var Te=.22;function Bo(e,t){let n=xe[e];if(n!=="sold"&&n!=="held")return-1;let r=(t+1)*2654435761;return r^=r>>>15,r=Math.imul(r,2246822519),r^=r>>>13,(r>>>0)%1e5/1e5}var Ta=.42;function ka(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),u=Math.max(Math.sqrt(s*c/t),1e-6),l=Math.max(1,Math.ceil(s/u)+1),h=Math.max(1,Math.ceil(c/u)+1),m=new Map,d=(f,p)=>{let y=Math.min(l-1,Math.max(0,Math.floor((f-r)/u)));return Math.min(h-1,Math.max(0,Math.floor((p-o)/u)))*l+y};for(let f=0;f<t;f++){let p=d(e[f].x,e[f].y),y=m.get(p);y?y.push(f):m.set(p,[f])}for(let f=0;f<t;f++){let p=e[f],y=Math.min(l-1,Math.max(0,Math.floor((p.x-r)/u))),b=Math.min(h-1,Math.max(0,Math.floor((p.y-o)/u))),g=1/0;for(let x=1;x<=4;x++){for(let S=b-x;S<=b+x;S++)if(!(S<0||S>=h))for(let I=y-x;I<=y+x;I++){if(I<0||I>=l||x>1&&Math.abs(S-b)<x&&Math.abs(I-y)<x)continue;let v=m.get(S*l+I);if(v)for(let R of v){if(R===f)continue;let O=Math.hypot(e[R].x-p.x,e[R].y-p.y);O<g&&(g=O)}}if(Number.isFinite(g)&&g<=x*u)break}n[f]=g}return n}function La(e){let t=e.eyeHeightM;return Number.isFinite(t)?Math.max(0,t-Nt):0}function Vo(e,t,n,r,o,i){let a=e.length,s=new Float32Array(a*3),c=new Float32Array(a),u=new Float32Array(a*3),l=new Float32Array(a),h=new Float32Array(a),m=new Float32Array(a),d=new Float32Array(a),f=new Float32Array(a*3),p=new Map,y=ka(e);for(let b=0;b<a;b++){let g=e[b],S=(n?.seatPitchU(b)??y[b])*D;l[b]=Number.isFinite(S)?Math.max(.06,Math.min(Te,S*Ta)):Te,h[b]=Fo(Number.isFinite(S)?S:void 0);let I=Ao(g.glyph,{seatGlyph:i?.get(g.categoryKey)});m[b]=Io.indexOf(I),d[b]=g.wheelchairSpaceType==="no-seat"?0:1,s[b*3]=g.x*D,s[b*3+1]=n?n.seatDeckY(b):La(g),s[b*3+2]=g.y*D,c[b]=gt(t?t(g):"available");let v=te(o?.get(g.categoryKey)??"#6e7bff")??[.43,.48,1];if(u[b*3]=v[0],u[b*3+1]=v[1],u[b*3+2]=v[2],g.accessibility?.length){let R=te(wo(g.accessibility));R&&(f[b*3]=R[0],f[b*3+1]=R[1],f[b*3+2]=R[2])}p.set(g.id,b)}return{count:a,iPosition:s,iState:c,iCategory:u,iMaxRadius:l,iRing:f,idToIndex:p,iChairWidth:h,iGlyph:m,iPhysicalSeat:d,iFloor:r??new Float32Array(a),iYaw:new Float32Array(a)}}var _a=64;function Tn(e,t){let n=[];for(let a of t){let s=e.idToIndex.get(a.seatId);if(s===void 0)continue;let c=gt(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+_a){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 Fa=.15,Da=.9,Oa=1.76,Ba=.7,Va=1.6;function Na(){return{background:{top:[...Ke.top],bottom:[...Ke.bottom]},structure:xn,seatStates:{...uo},seatScale:1}}function No(e){let t=Na();if(!e)return t;let n=te(e.background);if(n){t.background={top:ye(n,Da),bottom:ye(n,Oa)};let i={};for(let[a,s]of Object.entries(xn))i[a]=he(s,n,Fa);t.structure=i}let r=te(e.selectionColor)??te(e.accent);r&&(t.seatStates={...t.seatStates,selected:r});let o=e.seatScale;return typeof o=="number"&&Number.isFinite(o)&&(t.seatScale=Math.min(Va,Math.max(Ba,o))),t}function Go(e,t){let n=[];for(let r of t)n.push(...e.seatStates[r]);return n}function zo(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 ct(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,l=u>1e-12?((t-i.x)*s+(n-i.y)*c)/u:0;l<0?l=0:l>1&&(l=1);let h=Math.hypot(t-(i.x+l*s),n-(i.y+l*c));h<r&&(r=h)}return r}function Ga(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 Ho(e,t){return Math.hypot(e.cx-t.cx,e.cy-t.cy)-e.r-t.r}function kn(e,t){let n=1/0;for(let r of zo(e)){let o=ct(t,r.x,r.y);o<n&&(n=o)}for(let r of zo(t)){let o=ct(e,r.x,r.y);o<n&&(n=o)}return n}function za(e,t){if(e.length<3)return{pts:e,seatIndices:t};let n=0,r=0;for(let l of e)n+=l.x,r+=l.y;n/=e.length,r/=e.length;let o=-1,i=e[0];for(let l of e){let h=Math.hypot(l.x-n,l.y-r);h>o&&(o=h,i=l)}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((l,h)=>({p:l,i:h,t:(l.x-n)*a+(l.y-r)*s})).sort((l,h)=>l.t-h.t);return{pts:u.map(l=>l.p),seatIndices:u.map(l=>t[l.i])}}function Ln(e){let t=e.length;if(t<3)return null;let n=0,r=0;for(let g of e)n+=g.x,r+=g.y;n/=t,r/=t;let o=0,i=0,a=0,s=0,c=0,u=0,l=0;for(let g of e){let x=g.x-n,S=g.y-r;o+=x*x,a+=S*S,i+=x*S,s+=x*x*x,c+=S*S*S,u+=x*S*S,l+=S*x*x}let h=o*a-i*i;if(Math.abs(h)<1e-9)return null;let m=(s+u)/2,d=(c+l)/2,f=(m*a-d*i)/h,p=(d*o-m*i)/h,y=f+n,b=p+r;return!Number.isFinite(y)||!Number.isFinite(b)?null:{cx:y,cy:b}}var Ha=.15;function ja(e){if(e.length<2)return null;let t=e.map(g=>{let x=0,S=0;for(let I of g.pts)x+=I.x,S+=I.y;return{x:x/g.pts.length,y:S/g.pts.length}}),n=0,r=0;for(let g of t)n+=g.x,r+=g.y;n/=t.length,r/=t.length;let o=0,i=0,a=0;for(let g of t){let x=g.x-n,S=g.y-r;o+=x*x,i+=x*S,a+=S*S}let s=o+a,c=o*a-i*i,u=s/2+Math.sqrt(Math.max(0,s*s/4-c)),l,h;Math.abs(i)>1e-12?(l=u-a,h=i):o>=a?(l=1,h=0):(l=0,h=1);let m=Math.hypot(l,h);if(!(m>1e-12))return null;l/=m,h/=m;let d=1/0,f=-1/0,p=[];for(let g of e){let x=1/0,S=-1/0;for(let I of g.pts){let v=I.x*l+I.y*h;v<x&&(x=v),v>S&&(S=v),v<d&&(d=v),v>f&&(f=v)}p.push(S-x)}let y=f-d;return y>1e-9?(p.sort((g,x)=>g-x),p[Math.min(p.length-1,Math.floor(p.length*.9))]/y<=Ua?{x:l,y:h}:null):null}var Ua=.35;function jo(e,t,n,r){let o=new Map;for(let y of n){let b=t[y],g=b.rowId||`__seat-${y}`,x=o.get(g);x||(x={pts:[],idx:[]},o.set(g,x)),x.pts.push({x:b.x,y:b.y}),x.idx.push(y)}if(!o.size)return{sectionId:e,rows:[],blockCount:0};let i=[];for(let[y,b]of o){let g=za(b.pts,b.idx),x=0;for(let S of g.pts)x+=Math.hypot(S.x-r.x,S.y-r.y);i.push({id:y,pts:g.pts,seatIndices:g.seatIndices,blockId:-1,ordinal:0,blockDepth:0,focalDistance:x/g.pts.length})}let a=i.map(y=>Ga(y.pts)),s=[];for(let y=0;y<i.length;y++){let b=1/0;for(let g=0;g<i.length;g++){if(y===g||Ho(a[y],a[g])>=b)continue;let x=kn(i[y].pts,i[g].pts);x<b&&(b=x)}Number.isFinite(b)&&s.push(b)}s.sort((y,b)=>y-b);let c=s.length?s[Math.floor(s.length/2)]:1,u=Math.max(c*1.8,1e-6),l=i.map(()=>[]);for(let y=0;y<i.length;y++)for(let b=y+1;b<i.length;b++)Ho(a[y],a[b])>u||kn(i[y].pts,i[b].pts)<=u&&(l[y].push(b),l[b].push(y));let h=0;for(let y=0;y<i.length;y++){if(i[y].blockId!==-1)continue;let b=h++,g=[y];for(i[y].blockId=b;g.length;){let x=g.pop();for(let S of l[x])i[S].blockId===-1&&(i[S].blockId=b,g.push(S))}}let m=new Map;for(let y of i){let b=m.get(y.blockId)??[];b.push(y),m.set(y.blockId,b)}let d=[];for(let y of i){if(y.pts.length<4)continue;let b=Ln(y.pts);b&&(!Number.isFinite(b.cx)||!Number.isFinite(b.cy)||d.push({x:b.cx,y:b.cy}))}let f=d.length>=2?(()=>{let y=d.map(x=>x.x).sort((x,S)=>x-S),b=d.map(x=>x.y).sort((x,S)=>x-S),g=Math.floor(d.length/2);return{cx:y[g],cy:b[g]}})():null;if(f){let y=v=>Math.hypot(v.x-f.cx,v.y-f.cy),b=1/0,g=-1/0,x=[];for(let v of i){let R=1/0,O=-1/0;for(let V of v.pts){let U=y(V);U<R&&(R=U),U>O&&(O=U)}x.push(O-R),R<b&&(b=R),O>g&&(g=O)}let S=g-b;x.sort((v,R)=>v-R);let I=x[Math.min(x.length-1,Math.floor(x.length*.9))];if(S>1e-9&&I/S<=Ha){let v=i.map(T=>{let H=0;for(let k of T.pts)H+=y(k);return{row:T,radius:H/T.pts.length}}),R=0,O=0;for(let T of v)R+=T.radius,O+=T.row.focalDistance;R/=v.length,O/=v.length;let V=0;for(let T of v)V+=(T.radius-R)*(T.row.focalDistance-O);if(V<0)for(let T of v)T.radius=-T.radius;let N=1/0;for(let T of v)T.radius<N&&(N=T.radius);v.sort((T,H)=>T.radius-H.radius);let A=-1,M=-1/0,P=S/Math.max(1,v.length)*.5,C=[];for(let T of v)T.radius-M>P&&(A++,M=T.radius),T.row.ordinal=A,T.row.blockDepth=T.radius-N,C.push(T.row);return{sectionId:e,rows:C,blockCount:h}}}let p=[];for(let[,y]of m){let b=ja(y);if(b){let g=S=>{let I=0;for(let v of S.pts)I+=v.x*b.x+v.y*b.y;return I/S.pts.length};y.sort((S,I)=>g(S)-g(I)),y.length>=2&&y[0].focalDistance>y[y.length-1].focalDistance&&y.reverse();let x=0;for(let S=0;S<y.length;S++)S>0&&(x+=kn(y[S-1].pts,y[S].pts)),y[S].ordinal=S,y[S].blockDepth=x,p.push(y[S])}else{let g=1/0;for(let x of y)x.focalDistance<g&&(g=x.focalDistance);y.sort((x,S)=>x.focalDistance-S.focalDistance);for(let x=0;x<y.length;x++)y[x].ordinal=x,y[x].blockDepth=Math.max(0,y[x].focalDistance-g),p.push(y[x])}}return{sectionId:e,rows:p,blockCount:h}}var El=Math.PI/180;function Uo(e,t){let n=!1;for(let r=0,o=t.length-1;r<t.length;o=r++){let i=t[r].x,a=t[r].y,s=t[o].x,c=t[o].y;a>e.y!=c>e.y&&e.x<(s-i)*(e.y-a)/(c-a)+i&&(n=!n)}return n}function Xa(e,t){return t.some((n,r)=>{let o=t[(r+1)%t.length],i=(e.y-n.y)*(o.x-n.x)-(e.x-n.x)*(o.y-n.y);if(Math.abs(i)>1e-7)return!1;let a=(e.x-n.x)*(o.x-n.x)+(e.y-n.y)*(o.y-n.y),s=(o.x-n.x)**2+(o.y-n.y)**2;return a>=-1e-7&&a<=s+1e-7})}function _n(e,t,n){return Uo(e,t)&&!(n??[]).some(r=>Uo(e,r)||Xa(e,r))}function Ya(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 Wa(e,t){if(!e.length)return null;let n=0,r=0,o=0;for(let d of e)n+=d.x,r+=d.y,o+=Math.hypot(d.x-t.x,d.y-t.y);let i=e.length;n/=i,r/=i,o/=i;let a=e[0],s=-1;for(let d of e){let f=Math.hypot(d.x-n,d.y-r);f>s&&(s=f,a=d)}let c=a.x-n,u=a.y-r,l=Math.hypot(c,u);l>1e-9?(c/=l,u/=l):(c=1,u=0);let h=[...e].sort((d,f)=>(d.x-n)*c+(d.y-r)*u-((f.x-n)*c+(f.y-r)*u)),m=0;for(let d of h){let f=Math.hypot(d.x-n,d.y-r);f>m&&(m=f)}return{pts:h,cx:n,cy:r,radius:m,depth:o}}function Xo(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,l=c*c+u*u,h=l>1e-12?((t-a.x)*c+(n-a.y)*u)/l:0;h<0?h=0:h>1&&(h=1);let m=Math.hypot(t-(a.x+h*c),n-(a.y+h*u));m<o&&(o=m)}return o}var Yt=8;function Ka(e,t,n){let r=new Array(Yt).fill(1/0),o=new Array(Yt).fill(-1);for(let l=0;l<e.length;l++){let h=e[l],m=Math.hypot(t-h.cx,n-h.cy)-h.radius;for(let d=0;d<Yt;d++)if(m<r[d]){for(let f=Yt-1;f>d;f--)r[f]=r[f-1],o[f]=o[f-1];r[d]=m,o[d]=l;break}}let i=new Array(3).fill(1/0),a=new Array(3).fill(-1);for(let l of o){if(l<0)continue;let h=Xo(e[l],t,n);for(let m=0;m<3;m++)if(h<i[m]){for(let d=2;d>m;d--)i[d]=i[d-1],a[d]=a[d-1];i[m]=h,a[m]=l;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 l=0;l<3;l++){let h=a[l];if(h<0||i[l]>s)continue;let m=1/(i[l]*i[l]);c+=m*e[h].depth,u+=m}return u>0?c/u:e[a[0]].depth}function Qa(e){let t=(r,o)=>Ka(e,r,o),n=(r,o)=>{let i=1/0,a=-1;for(let s=0;s<e.length;s++){let c=e[s];if(Math.hypot(r-c.cx,o-c.cy)-c.radius>=i)continue;let u=Xo(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 Yo(e,t){let n=[];for(let r of e){let o=Wa(r.points,t);o&&n.push(o)}return n.length<2?Ya(t):(n.sort((r,o)=>r.depth-o.depth),Qa(n))}var On=ot(require("polygon-clipping"),1);var qo=ot(require("earcut"),1);var qa=.58,Wo=.01,ge=Te*1.5*Ve,Za=.5,$a=.6;function Ja(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,l=c.y-s.y,h=Math.hypot(u,l);if(h<1e-9){r.push([0,0]);continue}u/=h,l/=h,r.push([-l,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 es(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,l=Math.hypot(c,u)||1;return{x:c/l,y:u/l}},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 Ko=Math.PI/12;function ts(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 Zo(e,t){if(!e.length||!(t>0))return[];let n=ts(e),r=(s,c,u,l)=>{let h=u-c;for(;h<0;)h+=Math.PI*2;for(;h>Math.PI*2;)h-=Math.PI*2;let m=Math.max(1,Math.ceil(h/Ko)),d=t/Math.cos(h/m/2);for(let f=0;f<=m;f++){let p=c+h*f/m;l.push({x:s.x+Math.cos(p)*d,y:s.y+Math.sin(p)*d})}};if(n.length<3){let s=0,c=0;for(let d of n)s+=d.x,c+=d.y;s/=n.length||1,c/=n.length||1;let u=0;for(let d of n)u=Math.max(u,Math.hypot(d.x-s,d.y-c));let l=[],h=Math.max(3,Math.ceil(Math.PI*2/Ko)),m=(u+t)/Math.cos(Math.PI/h);for(let d=0;d<h;d++){let f=d/h*Math.PI*2;l.push({x:s+Math.cos(f)*m,y:c+Math.sin(f)*m})}return l}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 nr(a)}function ns(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,l=u>1e-12?((t-i.x)*s+(n-i.y)*c)/u:0;l<0?l=0:l>1&&(l=1);let h=Math.hypot(t-(i.x+l*s),n-(i.y+l*c));h<r&&(r=h)}return r}function Wt(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 l=Math.hypot(u.x-i,u.y-a);l>c&&(c=l)}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 l of i){let h=1/0;for(let m=0;m<e.length;m++){if(m===o||Math.abs(e[m].y-e[o].y)<.001)continue;let d=t[m],f=Math.hypot(l.x-d.cx,l.y-d.cy)-d.rad;if(f>=h&&f>=s)continue;let p=ns(e[m].pts,l.x,l.y);p<h&&(h=p),e[m].depth<e[o].depth&&p<s&&(s=p,c=e[m].y)}Number.isFinite(h)&&h>0&&a.push(h)}a.sort((l,h)=>l-h);let u=a.length?a[Math.floor(a.length/2)]:1;r.push({pitch:u,belowY:c})}return r}function $o(e,t,n,r){let o=e[t],i=o.pts.length>=2?[...o.pts]:o.pts.length===1?(()=>{let l=o.pts[0],h=l.x-r.x,m=l.y-r.y,d=Math.hypot(h,m)||1;h/=d,m/=d;let f=Math.max(n[t].pitch,.001)*.5;return[{x:l.x+m*f,y:l.y-h*f},{x:l.x-m*f,y:l.y+h*f}]})():[];if(i.length<2)return null;let a=0,s=0;for(let l=1;l<i.length;l++){let h=Math.hypot(i[l].x-i[l-1].x,i[l].y-i[l-1].y);h>1e-6&&(a+=h,s++)}let c=s>0?a/s:0,u=es(i,Math.max(c*$a,ge));return{pts:u,nrm:Ja(u,r),front:Math.max(n[t].pitch*qa,ge),back:Math.max(n[t].pitch*Za,ge)}}var lt=1.5,Jo=.3;function Fn(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 h=1;h<e.length-1;h++){let m=e[h],d=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);d>s&&(s=d,c=h)}if(s<=t||c<0)return[n,r];let u=Fn(e.slice(0,c+1),t),l=Fn(e.slice(c),t);return[...u.slice(0,-1),...l]}function er(e,t){if(e.length<4)return e;let n=Fn([...e,e[0]],t);return n.pop(),n.length>=3?n:e}function tr(e,t,n){if(e.length<2)return[];let r=n??Wt(e),o=new Map;for(let a=0;a<e.length;a++){let s=o.get(e[a].blockId);s?s.push(a):o.set(e[a].blockId,[a])}let i=[];for(let[,a]of o){let s=[];for(let g of a){let x=e[g].patch;x&&x.length>=3?i.push({outline:[...x],holes:[],topY:e[g].y}):s.push(g)}if(!s.length)continue;s.sort((g,x)=>e[g].depth-e[x].depth);let u=s.map(g=>$o(e,g,r,t)).filter(g=>g!==null);if(!u.length)continue;let l=(g,x)=>({x:g.pts[x].x-g.nrm[x][0]*(g.front+lt),y:g.pts[x].y-g.nrm[x][1]*(g.front+lt)}),h=(g,x)=>({x:g.pts[x].x+g.nrm[x][0]*(g.back+lt),y:g.pts[x].y+g.nrm[x][1]*(g.back+lt)}),m=u[0],d=u[u.length-1],f=[];for(let g=0;g<m.pts.length;g++)f.push(l(m,g));for(let g of u)f.push(h(g,g.pts.length-1));for(let g=d.pts.length-1;g>=0;g--)f.push(h(d,g));for(let g=u.length-1;g>=0;g--)f.push(l(u[g],0));let p=nr(f),y=1/0;for(let g of s)e[g].y<y&&(y=e[g].y);if(!Number.isFinite(y))continue;if(p.length>=3&&Math.abs(Qe(p))>1e-6&&u.every(g=>{let x=g.pts[Math.floor(g.pts.length/2)];return Mt(p,x.x,x.y)})){i.push({outline:er(p,Jo),holes:[],topY:y});continue}for(let g of os(u))i.push({outline:g,holes:[],topY:y})}return i}function os(e){let t=[];for(let n of e){let r=[],o=[],i=n.front+lt,a=n.back+lt;for(let c=0;c<n.pts.length;c++){let u=n.pts[c],l=n.nrm[c];r.push([u.x-l[0]*i,u.y-l[1]*i]),o.push([u.x+l[0]*a,u.y+l[1]*a])}let s=[...r,...o.reverse()];s.length<3||(s.push(s[0]),t.push([s]))}if(!t.length)return[];try{let n=On.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(er(i,Jo))}return r}catch{return[]}}function nr(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 Dn=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(!Mt(n,o.x,o.y)){r=!1;break}if(r)return!0}return!1}};function Qo(e,t,n,r,o,i){if(r.length<3)return;if(n.containsAll(r)){let u=[0,1,0],l=r[0];for(let h=1;h+1<r.length;h++){let m=r[h],d=r[h+1];e.tri([l.x*D,o,l.y*D],[m.x*D,o,m.y*D],[d.x*D,o,d.y*D],u,i)}return}let a=r.map(u=>[u.x,u.y]);a.push(a[0]);let s;try{s=On.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 l=u[0],h=[],m=[];for(let f=0;f<l.length-1;f++)h.push(l[f][0],l[f][1]),m.push([l[f][0],l[f][1]]);if(m.length<3)continue;let d=(0,qo.default)(h,void 0,2);for(let f=0;f<d.length;f+=3){let p=m[d[f]],y=m[d[f+1]],b=m[d[f+2]];e.tri([p[0]*D,o,p[1]*D],[y[0]*D,o,y[1]*D],[b[0]*D,o,b[1]*D],c,i)}}}function or(e,t,n,r,o,i,a){if(t.length<2)return;let s=a??Wt(t),c=[0,1,0],u=i&&i.length>=3?[[...i.map(d=>[d.x,d.y]),[i[0].x,i[0].y]]]:null,l=i&&i.length>=3?new Dn([[...i]]):null,h=d=>{e.setMaterial(2),d(),e.setMaterial(0)},m=d=>{e.setMaterial(3),d(),e.setMaterial(0)};for(let d=0;d<t.length;d++){let f=t[d];if(f.patch&&f.patch.length>=3){let I=[...f.patch],v=s[d].belowY??r;if(m(()=>{if(u&&l)Qo(e,u,l,I,f.y,o.tread);else{let R=I[0];for(let O=1;O+1<I.length;O++){let V=I[O],U=I[O+1];e.tri([R.x*D,f.y,R.y*D],[V.x*D,f.y,V.y*D],[U.x*D,f.y,U.y*D],c,o.tread)}}}),f.y>v+Wo){let R=0,O=0;for(let V of I)R+=V.x,O+=V.y;R/=I.length,O/=I.length,h(()=>{for(let V=0;V<I.length;V++){let U=I[V],N=I[(V+1)%I.length],A=N.x-U.x,M=N.y-U.y,P=Math.hypot(A,M);if(P<1e-6)continue;let C=M/P,T=-A/P;(U.x-R)*C+(U.y-O)*T<0&&(C=-C,T=-T);let H=[C,0,T],k=[U.x*D,f.y,U.y*D],w=[N.x*D,f.y,N.y*D],B=[U.x*D,v,U.y*D],E=[N.x*D,v,N.y*D];e.tri(k,w,E,H,o.riser),e.tri(k,E,B,H,o.riser)}})}continue}let p=$o(t,d,s,n);if(!p)continue;let{pts:y,nrm:b,front:g,back:x}=p,S=s[d].belowY??r;for(let I=0;I+1<y.length;I++){let v=y[I],R=y[I+1],O=b[I],V=b[I+1];if(Math.hypot(R.x-v.x,R.y-v.y)<1e-6||O[0]===0&&O[1]===0||V[0]===0&&V[1]===0)continue;let U=[(v.x-O[0]*g)*D,f.y,(v.y-O[1]*g)*D],N=[(R.x-V[0]*g)*D,f.y,(R.y-V[1]*g)*D],A=[(v.x+O[0]*x)*D,f.y,(v.y+O[1]*x)*D],M=[(R.x+V[0]*x)*D,f.y,(R.y+V[1]*x)*D];if(m(()=>{u&&l?Qo(e,u,l,[{x:v.x-O[0]*g,y:v.y-O[1]*g},{x:R.x-V[0]*g,y:R.y-V[1]*g},{x:R.x+V[0]*x,y:R.y+V[1]*x},{x:v.x+O[0]*x,y:v.y+O[1]*x}],f.y,o.tread):(e.tri(U,N,M,c,o.tread),e.tri(U,M,A,c,o.tread))}),f.y>S+Wo){let P=[U[0],S,U[2]],C=[N[0],S,N[2]],T=[-O[0],0,-O[1]];h(()=>{e.tri(U,N,C,T,o.riser),e.tri(U,C,P,T,o.riser)})}}}}function rr(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 Kt(e,t){return e.minX<=t.maxX&&t.minX<=e.maxX&&e.minY<=t.maxY&&t.minY<=e.maxY}var Bn=ot(require("polygon-clipping"),1);function rs(e,t){let n=e.eventConfigurationIds;return!n?.length||!!t&&n.includes(t)}function ir(e,t){return e.filter(n=>n.type!=="shape"||rs(n,t))}function ar(e,t){let n=e.focalPoint??{x:0,y:0};return e.floors?.length?e.floors.map((r,o)=>({objects:ir(r.objects,t),focal:{x:(r.focalPoint??n).x,y:(r.focalPoint??n).y},baseHeightM:r.baseHeightM??0,index:o})):[{objects:ir(e.objects,t),focal:n,baseHeightM:0,index:0}]}var is={minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};function ut(e){return rr(e)??is}function sr(e,t){let n=jt(e.outline,ge),r=ut(n),o=t.filter(a=>a!==e&&a.outline&&a.outline.length>=3&&Kt(r,ut(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=Bn.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(([l,h])=>({x:l,y:h}));if(u.length>1){let l=u[0],h=u[u.length-1];Math.abs(l.x-h.x)<1e-9&&Math.abs(l.y-h.y)<1e-9&&u.pop()}u.length>=3&&s.push(u)}return s.length?s:[n]}catch{return[n]}}function cr(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=Bn.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,l])=>({x:u,y:l}));if(c.length>1){let u=c[0],l=c[c.length-1];Math.abs(u.x-l.x)<1e-9&&Math.abs(u.y-l.y)<1e-9&&c.pop()}c.length>=3&&o.push({outline:c,holes:[],topY:i.topY})}}return o.length?o:e}var as=.05,lr=.05,ss=.15,Vn=25;function ur(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=[],l=new Set;for(let m=0;m<e.length;m+=1){let d=e[m];for(let f of d.objects){if(f.type==="table"&&l.add(f.id),f.type!=="section"||!f.outline||f.outline.length<3)continue;let p=jt(f.outline,ge);c.set(f.id,{section:f,unit:d,frontU:1/0,hasSeats:!1,rows:new Map,seatIndices:[]}),u.push({id:f.id,floorIndex:m,box:ut(p),section:f,unit:d,outline:p})}}let h=new Map;for(let m of u){let d=h.get(m.floorIndex);d?d.push(m):h.set(m.floorIndex,[m])}for(let m=0;m<t.length;m++){let d=t[m],f=n?h.get(n[m])??[]:u,p=d.sectionId?f.find(b=>b.id===d.sectionId)??f.find(b=>b.section.logicalSectionId===d.sectionId&&_n({x:d.x,y:d.y},b.outline,b.section.holes)):void 0,y=p?[p]:f;for(let b of y){if(n&&b.floorIndex!==n[m]||!p&&(d.x<b.box.minX||d.x>b.box.maxX||d.y<b.box.minY||d.y>b.box.maxY||!_n({x:d.x,y:d.y},b.outline,b.section.holes)))continue;o[m]=b.id;let g=c.get(b.id);g.hasSeats=!0;let x=d.focalPoint??b.unit.focal,S=Math.hypot(d.x-x.x,d.y-x.y);S<g.frontU&&(g.frontU=S),g.seatIndices.push(m);let I=d.rowId||`__seat-${m}`,v=g.rows.get(I);v?v.push({x:d.x,y:d.y}):g.rows.set(I,[{x:d.x,y:d.y}]);break}}for(let[m,d]of c){let f=Ro(d.section,{floorBaseHeightM:d.unit.baseHeightM}),p=d.unit.baseHeightM,y=f.rake>0?Math.tan(f.rake*Math.PI/180):0,b=f.rake<=.01&&f.height<=p+.001,g=d.section.surfaceKind,x=g==="flat"?!0:g==="rakedRows"&&f.rake>.01?!1:b,S=d.hasSeats?jo(m,t,d.seatIndices,d.unit.focal):{sectionId:m,rows:[],blockCount:0},v=S.rows.length<2?Yo([...d.rows.values()].map(k=>({points:k})),d.unit.focal):null,R=1/0;if(v){if(d.hasSeats)for(let k of d.rows.values())for(let w of k){let B=v.depthAt(w.x,w.y);B<R&&(R=B)}if(!d.hasSeats||!Number.isFinite(R)){R=1/0;for(let k of d.section.outline){let w=v.depthAt(k.x,k.y);w<R&&(R=w)}}}let O=p+as,V=Math.max(O,f.height),U=k=>{let w=Math.max(0,k-R)*Ie,B=Math.min(w*y,Vn);return Math.max(O,f.height+B)},N=k=>{let w=Math.max(0,k)*Ie,B=Math.min(w*y,Vn);return Math.max(O,f.height+B)},A=x?[]:S.rows.map(k=>({pts:k.pts,y:N(k.blockDepth),depth:k.blockDepth,blockId:k.blockId,...l.has(k.id)?{patch:Zo(k.pts,ge)}:{}})),M=A.length?A[0].y:V,P=A.map(k=>{let w=k.patch&&k.patch.length>=3?k.patch:k.pts,B=0,E=0;for(let G of w)B+=G.x,E+=G.y;let F=w.length||1;B/=F,E/=F;let z=0;for(let G of w){let _=Math.hypot(G.x-B,G.y-E);_>z&&(z=_)}return{cx:B,cy:E,rad:z}}),C=x?()=>V:A.length>=2?(k,w)=>{let B=1/0,E=M;for(let F=0;F<A.length;F++){let z=P[F];if(Math.hypot(k-z.cx,w-z.cy)-z.rad>=B)continue;let G=A[F].patch,_=G&&G.length>=3?Mt(G,k,w)?0:ct(G,k,w):ct(A[F].pts,k,w);_<B&&(B=_,E=A[F].y)}return E}:(k,w)=>v?U(v.depthAt(k,w)):V,T=[0,1,0],H=A.length>=2||x?()=>T:(k,w)=>{if(!v)return T;let B=v.depthAt(k,w);if(B<=R)return T;let E=(B-R)*Ie;if(E*y>=Vn||f.height+E*y<=O)return T;let[F,z]=v.gradientAt(k,w);if(F===0&&z===0)return T;let G=1/Math.hypot(y,1);return[-F*y*G,G,-z*y*G]};if(!x)for(let k of S.rows){let w=N(k.blockDepth);for(let B of k.seatIndices)a[B]=w}for(let k of S.rows){let w=[];for(let G=1;G<k.pts.length;G++){let _=Math.hypot(k.pts[G].x-k.pts[G-1].x,k.pts[G].y-k.pts[G-1].y);_>1e-6&&w.push(_)}w.sort((G,_)=>G-_);let B=w.length?w[Math.floor(w.length/2)]:1/0,E=1/0,F=k.pts[Math.floor(k.pts.length/2)];if(F)for(let G of S.rows){if(G===k||G.blockId!==k.blockId)continue;let _=ct(G.pts,F.x,F.y);_>1e-6&&_<E&&(E=_)}let z=Math.min(B,Math.max(E,B*.5));if(Number.isFinite(z)&&z>0)for(let G of k.seatIndices)s[G]=z}r.set(m,{sectionId:m,deckAt:C,normalAt:H,flat:x,bottomY:p,rowLevels:A,landingY:M})}for(let m=0;m<t.length;m++){let d=o[m],f=t[m];if(d){let y=a[m];i[m]=(y??r.get(d).deckAt(f.x,f.y))+ss;continue}let p=f.eyeHeightM;i[m]=Number.isFinite(p)?Math.max(0,p-Nt):0}return{bySection:r,seatOwner:o,seatDeckY:m=>i[m],seatPitchU:m=>s[m]}}var ae={top:1,wallBottom:.5,bottomCap:.4};function ke(e,t){if(!e)return t;let n=ye(yt(e,.4),.62);return he(t,n,.72)}function dr(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,l=0;for(let[h,m]of a){let d=te(n.get(h));d&&(s+=d[0]*m,c+=d[1]*m,u+=d[2]*m,l+=m)}l>0&&o.set(i,[s/l,c/l,u/l])}return o}function mr(e,t){return te(e.color)??t.get(e.logicalSectionId??e.id)??null}var Jl=Math.PI*2;function fr(e){return e==="pitch-football"||e==="rink-hockey"||e==="track-athletics"||e==="oval-cricket"}var hr=ot(require("polygon-clipping"),1);function cs(e,t){return e===void 0||t===void 0?!0:Math.abs(e-t)<.001}var Qt=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=ut(t),i=this.rings.filter((c,u)=>Kt(o,this.boxes[u])&&cs(n,this.levels[u])),a=[[r]];if(i.length)try{a=hr.default.difference([r],...i).map(u=>u.map(l=>l.map(([h,m])=>[h,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(([l,h])=>({x:l,y:h}));if(u.length>1){let l=u[0],h=u[u.length-1];Math.abs(l.x-h.x)<1e-9&&Math.abs(l.y-h.y)<1e-9&&u.pop()}u.length>=3&&s.push(u)}return s}};function ls(e,t){if(!t)return e;let n=1/0,r=-1/0,o=1/0,i=-1/0;for(let h of e)n=Math.min(n,h.x),r=Math.max(r,h.x),o=Math.min(o,h.y),i=Math.max(i,h.y);let a=(n+r)/2,s=(o+i)/2,c=t*Math.PI/180,u=Math.cos(c),l=Math.sin(c);return e.map(h=>{let m=h.x-a,d=h.y-s;return{x:a+m*u-d*l,y:s+m*l+d*u}})}function Ze(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=Pt(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=Ut(n,r,e.width/2,e.height/2)}return t?ls(t,e.rotation):null}function Ct(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"&&fr(e.stageKind)?{kind:"stage",heightM:.06}:n[t]??{kind:"plate",heightM:.25};return{...r,heightM:e.heightM??r.heightM}}var us=.08;function pr(e,t){let n=Ze(e),r=Ct(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 l of n)i=Math.min(i,l.x),a=Math.min(a,l.y),s=Math.max(s,l.x),c=Math.max(c,l.y);let u=o;for(let l of t)s>l.minX&&i<l.maxX&&c>l.minY&&a<l.maxY&&u<=l.topOffsetM+1e-6&&(u=l.topOffsetM+us);return t.push({minX:i,minY:a,maxX:s,maxY:c,topOffsetM:u}),u}function Ne(e,t,n){return{x:e.x+(t.x-e.x)*n,y:e.y+(t.y-e.y)*n}}function br(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 It(e,t,n){return[Ne(e[0],e[1],t),Ne(e[0],e[1],n),Ne(e[3],e[2],n),Ne(e[3],e[2],t)]}function yr(e,t,n){return[Ne(e[0],e[3],t),Ne(e[1],e[2],t),Ne(e[1],e[2],n),Ne(e[0],e[3],n)]}function Le(e,t,n,r,o,i){se(e,t,void 0,()=>n,r,o,i,ae)}var Nn=2.4,ds=.75,ms=.15;function At(e){if(e.points&&e.points.length>=3)return e.points;let{center:t,width:n,height:r,rotation:o}=e;if(!n||!r)return null;let i=(o??0)*Math.PI/180,a=Math.cos(i),s=Math.sin(i),c=n/2,u=r/2;return[[-c,-u],[c,-u],[c,u],[-c,u]].map(([l,h])=>({x:t.x+l*a-h*s,y:t.y+l*s+h*a}))}function gr(e,t,n,r,o){let i=At(t);i&&se(e,i,void 0,()=>n+Nn,n,ke(r,o.boothTop),o.boothWall,ae)}function Gn(e){if(e.shape==="round"){let l=e.radius;return l?Ut(e.center.x,e.center.y,l,l,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(([l,h])=>({x:o.x+l*a-h*s,y:o.y+l*s+h*a}))}function xr(e,t,n,r,o){let i=Gn(t);i&&se(e,i,void 0,()=>n+ds,n,ke(r,o.tableTop),o.tableWall,ae)}function vr(e,t,n,r,o,i,a,s){let c=Ze(t);if(!c)return;let u=s?s.kind==="stage":t.role==="stage",l=s?s.kind==="screen":t.role==="screen",h=s?{kind:u?"stage":"solid",heightM:s.topY-s.baseY}:Ct(t),m=s?.baseY??n,d=s?.topY??n+r;if(u&&a){let g=1/0,x=-1/0,S=1/0,I=-1/0;for(let v of c)v.x<g&&(g=v.x),v.x>x&&(x=v.x),v.y<S&&(S=v.y),v.y>I&&(I=v.y);a.push({cx:(g+x)/2*D,cz:(S+I)/2*D,y:d,halfX:Math.max((x-g)/2*D,.5),halfZ:Math.max((I-S)/2*D,.5)})}let f=te(t.fill),p=u&&f?he(o.stageTop,ye(yt(f,.18),.9),.9):ke(f,u?o.stageTop:o.decorTop),y=l?f:null,b=u?f?he(o.stageWall,ye(f,.58),.82):o.stageWall:l?y?he(ye(y,1.42),[.24,.46,.82],.08):[.24,.46,.82]:ke(te(t.fill),o.decorWall);if(h.kind==="portal"&&c.length===4){let g=br(c);Le(e,It(g,0,.16),d,m,p,b),Le(e,It(g,.84,1),d,m,p,b),Le(e,g,d,Math.max(m,d-.35),p,b);return}if(h.kind==="suite"&&c.length===4){let g=c.map((I,v)=>{let R=c[(v+1)%4],O=(I.x+R.x)/2,V=(I.y+R.y)/2;return Math.hypot(O-i.x,V-i.y)}),x=g.indexOf(Math.min(...g)),S=[0,1,2,3].map(I=>c[(x+I)%4]);Le(e,It(S,0,.08),d,m,p,b),Le(e,It(S,.92,1),d,m,p,b),Le(e,yr(S,.88,1),d,m,p,b),Le(e,S,d,Math.max(m,d-.18),p,b);return}Le(e,c,d,m,p,b)}function zn(e){let{x:t,y:n,width:r,height:o}=e;if(!r||!o)return null;let i=t+r/2,a=n+o/2,s=(e.rotation??0)*Math.PI/180,c=Math.cos(s),u=Math.sin(s),l=r/2,h=o/2;return[[-l,-h],[l,-h],[l,h],[-l,h]].map(([m,d])=>({x:i+m*c-d*u,y:a+m*u+d*c}))}function fs(e){if(!e||!e.startsWith("data:image/svg+xml"))return null;let t=e.slice(e.indexOf(",")+1);if(/;base64/i.test(e.slice(0,e.indexOf(","))))try{t=atob(t)}catch{return null}else try{t=decodeURIComponent(t)}catch{}let n=t.match(/<(?:rect|path)\b[^>]*\bfill="([^"]+)"/i);if(!n)return null;let r=n[1].trim();if(r==="none"||r==="transparent")return null;let o=r.match(/^url\(#([^)]+)\)$/);if(!o)return te(r);let i=t.match(new RegExp(`<(?:linear|radial)Gradient\\b[^>]*\\bid="${o[1]}"[^>]*>([\\s\\S]*?)</(?:linear|radial)Gradient>`,"i"));if(!i)return null;let a=[];for(let s of i[1].matchAll(/stop-color="([^"]+)"/gi)){let c=te(s[1].trim());c&&a.push(c)}return a.length?a.reduce((s,c,u)=>he(s,c,1/(u+1)),a[0]):null}function Mr(e,t,n,r){if(t.layer==="foreground")return;let o=zn(t);if(!o)return;let i=n+ms,a=ke(fs(t.href),r.decorTop),s=Math.max(0,Math.min(1,t.opacity??1));s<1&&(a=he(r.ground,a,s)),se(e,o,void 0,()=>i,n,a,he(a,r.decorWall,.5),ae)}function Sr(e,t,n,r,o){if(!t.points||t.points.length<3)return;let i=ke(r,o.gaTop);se(e,t.points,t.holes,()=>n+.15,n,i,o.gaWall,ae)}var hs=Math.PI/180,$=96,ps=6,bs=60,ys=150,wr=.2,gs=.35;function xs(e,t){let n=Math.atan2(t.x-e.x,t.y-e.y)/hs;return n<0?n+360:n}function qt(e){if(!e.length)return NaN;let t=[...e].sort((n,r)=>n-r);return t[Math.floor(t.length/2)]}function Zt(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 Pr(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 d of m.rows){for(let f of d.pts)o+=f.x,i+=f.y,a++;if(d.pts.length>=4){let f=Ln(d.pts);f&&Number.isFinite(f.cx)&&Number.isFinite(f.cy)&&r.push({x:f.cx,y:f.cy})}}if(!a)return null;let s={x:o/a,y:i/a},c=s;if(r.length>=8){let m=qt(r.map(b=>b.x)),d=qt(r.map(b=>b.y)),f=0;for(let b of n)for(let g of b.rows)for(let x of g.pts){let S=Math.hypot(x.x-s.x,x.y-s.y);S>f&&(f=S)}let p=0,y=f*.2;for(let b of n)for(let g of b.rows)for(let x of g.pts)Math.hypot(x.x-m,x.y-d)<y&&p++;Math.hypot(m-s.x,d-s.y)<=f&&p/a<.01&&(c={x:m,y:d})}let u=[];for(let m of n){let d={sectionId:m.sectionId,rMin:1/0,rMax:-1/0,samples:[]};for(let f of m.rows)for(let p of f.pts){let y=Math.hypot(p.x-c.x,p.y-c.y),b=Math.min($-1,Math.floor(xs(c,p)/(360/$)));d.samples.push({r:y,bin:b,levelM:f.levelM}),y<d.rMin&&(d.rMin=y),y>d.rMax&&(d.rMax=y)}d.samples.length&&u.push(d)}if(!u.length)return null;u.sort((m,d)=>m.rMin+m.rMax-(d.rMin+d.rMax));let l=[];for(let m of u){let d=!1;for(let f of l){let p=Math.min(m.rMax,f.rMax)-Math.max(m.rMin,f.rMin),y=Math.min(m.rMax-m.rMin,f.rMax-f.rMin);if(y>1e-9&&p>=gs*y){f.members.push(m),f.rMin=Math.min(f.rMin,m.rMin),f.rMax=Math.max(f.rMax,m.rMax),d=!0;break}}d||l.push({members:[m],rMin:m.rMin,rMax:m.rMax})}let h=[];for(let m of l){let d=new Array($).fill(null);for(let M of m.members)for(let P of M.samples){let C=d[P.bin];C||(C={samples:[]},d[P.bin]=C),C.samples.push({r:P.r,levelM:P.levelM})}let f=d.map(M=>!!M);if(!f.filter(Boolean).length)continue;let y=[],b=[];for(let M of d){if(!M)continue;let P=1/0,C=-1/0;for(let T of M.samples)T.r<P&&(P=T.r),T.r>C&&(C=T.r);y.push(P),b.push(C)}let g=qt(y),x=qt(b);if(!(g>=wr*x)||!(x>0))continue;let S=[...y].sort((M,P)=>M-P);if(!(S[Math.floor(S.length*.1)]>=wr*x))continue;let v=d.map(M=>{if(!M)return null;let P=[...M.samples].sort((F,z)=>F.r-z.r),C=P[0].r,T=P[P.length-1].r,H=P[0].levelM,k=-1/0;for(let F of P)F.levelM>k&&(k=F.levelM);let w=[];for(let F of P){let z={r:F.r,l:F.levelM};for(;w.length&&Math.abs(w[w.length-1].r-z.r)<1e-9;){if(w[w.length-1].l<=z.l){z.skip=!0;break}w.pop()}if(!z.skip){for(;w.length>=2;){let G=w[w.length-2],_=w[w.length-1];if((_.r-G.r)*(z.l-G.l)-(_.l-G.l)*(z.r-G.r)<=0)w.pop();else break}w.push(z)}}let B=w.map(F=>F.r),E=w.map(F=>F.l);return{inner:C,outer:T,front:H,top:k,profile:{rs:B,ls:E}}}),R=f.slice();for(let M=0;M<$;M++){if(R[M])continue;let P=-1,C=-1,T=0;for(let L=1;L<=$;L++){let Y=(M-L+$*2)%$;if(R[Y]){P=Y;break}}for(let L=1;L<=$;L++){let Y=(M+L)%$;if(R[Y]){C=Y,T=L;break}}if(P<0||C<0)continue;let H=0;for(let L=1;L<=$;L++){let Y=(M-L+$*2)%$;if(f[Y]){H=L;break}}if(H-1+T>ps)continue;let w=v[P],B=v[C],E=H/(H+T),F=w.inner+(B.inner-w.inner)*E,z=w.outer+(B.outer-w.outer)*E,G=w.front+(B.front-w.front)*E,_=w.top+(B.top-w.top)*E;v[M]={inner:F,outer:z,front:G,top:_,profile:{rs:[F,z],ls:[G,_]}}}for(let M=0;M<$;M++)v[M]&&(R[M]=!0);let O=360/$,V=[],U=R.filter(Boolean).length,N=[];if(U===$)N.push({start:0,len:$});else{let M=0;for(;R[M];)M=(M+1)%$;let P=-1;for(let C=0;C<=$;C++){let T=(M+C)%$,H=C<$&&R[T];if(H&&P<0)P=T;else if(!H&&P>=0){let k=(T-P+$)%$||$;N.push({start:P,len:k}),P=-1}}}for(let M of N){if(M.len*O<bs&&M.len<$)continue;let P=M.len===$,C=new Float64Array(M.len),T=new Float64Array(M.len),H=new Float64Array(M.len),k=new Float64Array(M.len),w=[];for(let L=0;L<M.len;L++){let Y=v[(M.start+L)%$];C[L]=Y.inner,T[L]=Y.outer,H[L]=Y.front,k[L]=Y.top,w.push(Y.profile??{rs:[Y.inner,Y.outer],ls:[Y.front,Y.top]})}let B=Zt(C,P),E=Zt(T,P),F=Zt(H,P),z=Zt(k,P);for(let L=0;L<M.len;L++)B[L]>C[L]&&(B[L]=C[L]),E[L]<T[L]&&(E[L]=T[L]),B[L]>E[L]-1e-6&&(B[L]=Math.max(0,E[L]-1e-6)),z[L]<F[L]&&(z[L]=F[L]);let G={startBin:M.start,binCount:M.len,closed:P,innerR:B,outerR:E,frontLevelM:F,topLevelM:z,profiles:w},_=(L,Y,K)=>{let J=w[L],Z=J.rs,q=J.ls;if(Y<=Z[0]){q[0]>K&&(q[0]=K);return}if(Y>=Z[Z.length-1]){q[q.length-1]>K&&(q[q.length-1]=K);return}for(let ne=0;ne+1<Z.length;ne++)if(Y<=Z[ne+1]){q[ne]>K&&(q[ne]=K),q[ne+1]>K&&(q[ne+1]=K);return}};for(let L=0;L<M.len;L++){let Y=d[(M.start+L)%$];if(Y)for(let K of Y.samples){_(L,K.r,K.levelM);let J=P?(L-1+M.len)%M.len:L-1,Z=P?(L+1)%M.len:L+1;J>=0&&_(J,K.r,K.levelM),Z<M.len&&_(Z,K.r,K.levelM)}}V.push(G)}V.reduce((M,P)=>M+P.binCount*O,0)<ys||h.push({arcs:V,sectionIds:m.members.map(M=>M.sectionId),innerRMedian:g,outerRMedian:x})}if(!h.length)return null;if(h.sort((m,d)=>m.innerRMedian-d.innerRMedian),t){let m=h[h.length-1].outerRMedian;if(Math.hypot(t.x-c.x,t.y-c.y)>.9*m)return null}return{centre:c,binCount:$,binStepDeg:360/$,rings:h}}function Cr(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=l=>{let h=t.profiles[l],m=h.rs,d=h.ls;if(r<=m[0])return d[0];if(r>=m[m.length-1])return d[d.length-1];for(let f=0;f+1<m.length;f++)if(r<=m[f+1]){let p=m[f+1]-m[f],y=p>1e-9?(r-m[f])/p:0;return d[f]+(d[f+1]-d[f])*y}return d[d.length-1]};return u(a)*(1-c)+u(s)*c}var vs=.25,Ms=1.2,Ss=.6,ws=.45,Ps=2.3,Cs=Math.PI/180;function $e(e,t,n){let r=n*Cs;return{x:e.x+t*Math.sin(r),y:e.y+t*Math.cos(r)}}function Is(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 As=24;function Es(e,t,n,r,o,i,a,s){let c=n.binCount,u=As,l=Ie,h=i+.02,m=[];for(let A=0;A<c;A++){let M=(n.startBin+A+.5)*t.binStepDeg,P=new Float64Array(u+1);for(let C=0;C<=u;C++){let T=r[A]+(o[A]-r[A])*C/u;P[C]=Math.max(h,Cr(t,n,M,T)-vs)}m.push(P)}let d=[a.bandTop[0]*s.top,a.bandTop[1]*s.top,a.bandTop[2]*s.top],f=[a.bandTop[0]*s.bottomCap,a.bandTop[1]*s.bottomCap,a.bandTop[2]*s.bottomCap],p=[a.bandWall[0]*s.top,a.bandWall[1]*s.top,a.bandWall[2]*s.top],y=[a.bandWall[0]*s.wallBottom,a.bandWall[1]*s.wallBottom,a.bandWall[2]*s.wallBottom],b=(A,M)=>{let P=(n.startBin+A+.5)*t.binStepDeg,C=r[A]+(o[A]-r[A])*M/u,T=$e(t.centre,C,P);return[T.x*l,m[A][M],T.y*l]};{let A=Math.tan(12*Math.PI/180);for(let M=0;M<6;M++){let P=!1;for(let T=0;T<c;T++)for(let H=u-1;H>=0;H--)m[T][H]>m[T][H+1]&&(m[T][H]=m[T][H+1],P=!0);let C=n.closed?c:c-1;for(let T=0;T<C;T++){let H=(T+1)%c;for(let k=0;k<=u;k++){let w=m[H][k]-m[T][k];if(Math.abs(w)>1)continue;let B=r[T]+(o[T]-r[T])*k/u,E=r[H]+(o[H]-r[H])*k/u,F=$e(t.centre,B,(n.startBin+T+.5)*t.binStepDeg),z=$e(t.centre,E,(n.startBin+H+.5)*t.binStepDeg),G=A*Math.hypot(z.x-F.x,z.y-F.y)*l;w>G?(m[H][k]=m[T][k]+G,P=!0):-w>G&&(m[T][k]=m[H][k]+G,P=!0)}}if(!P)break}}let g=1,x=(A,M)=>{for(let P=0;P<=u;P+=4)if(Math.abs(m[A][P]-m[M][P])>g)return!0;return Math.abs(m[A][u]-m[M][u])>g},S=Math.tan(38*Math.PI/180),I=A=>(o[A]-r[A])/u*l,v=(A,M)=>m[A][M+1]-m[A][M]>S*Math.max(1e-6,I(A)),R=(A,M)=>{let P=n.closed?(A-1+c)%c:Math.max(0,A-1),C=n.closed?(A+1)%c:Math.min(c-1,A+1);Math.abs(m[P][M]-m[A][M])>g&&(P=A),Math.abs(m[C][M]-m[A][M])>g&&(C=A);let T=Math.max(0,M-1),H=Math.min(u,M+1);T<M&&v(A,T)&&(T=M),H>M&&v(A,M)&&(H=M);let k=b(P,M),w=b(C,M),B=b(A,T),E=b(A,H),F=w[0]-k[0],z=w[1]-k[1],G=w[2]-k[2],_=E[0]-B[0],L=E[1]-B[1],Y=E[2]-B[2],K=z*Y-G*L,J=G*_-F*Y,Z=F*L-z*_,q=Math.hypot(K,J,Z);return q>1e-12?(K/=q,J/=q,Z/=q,J<0&&(K=-K,J=-J,Z=-Z),[K,J,Z]):[0,1,0]},O=(A,M)=>{let P=[A[0],i,A[2]],C=[M[0],i,M[2]],T=M[0]-A[0],H=M[2]-A[2],k=Math.hypot(T,H);if(!(k>1e-12))return;let w=[H/k,0,-T/k];e.tri(A,M,C,w,p,p,y),e.tri(A,C,P,w,p,y,y)},V=.05*Ve,U=A=>o[A]-r[A]<V,N=n.closed?c:c-1;for(let A=0;A<N;A++){let M=(A+1)%c;if(U(A)||U(M))continue;if(x(A,M)){let w=(n.startBin+A+1)*t.binStepDeg,B=(L,Y)=>{let K=(r[A]+r[M])/2,J=(o[A]+o[M])/2,Z=K+(J-K)*Y/u,q=$e(t.centre,Z,w);return[q.x*l,m[L][Y],q.y*l]};for(let L=0;L<u;L++){let Y=b(A,L),K=b(A,L+1),J=B(A,L),Z=B(A,L+1),q=R(A,L),ne=R(A,L+1);e.triN(Y,J,Z,q,q,ne,d),e.triN(Y,Z,K,q,ne,ne,d);let Ue=b(M,L),Xe=b(M,L+1),ve=B(M,L),_e=B(M,L+1),Fe=R(M,L),Me=R(M,L+1);e.triN(ve,Ue,Xe,Fe,Fe,Me,d),e.triN(ve,Xe,_e,Fe,Me,Me,d);let be=B(A,L),ce=B(A,L+1),tt=B(M,L+1),Se=B(M,L),nt=ce[0]-be[0],we=ce[2]-be[2],De=Math.hypot(nt,we);if(De>1e-12){let Tt=[we/De,0,-nt/De];e.tri(be,ce,tt,Tt,p),e.tri(be,tt,Se,Tt,p)}}let E=b(A,0),F=b(M,0),z=b(M,u),G=b(A,u),_=L=>[L[0],i,L[2]];e.tri(_(E),_(z),_(F),[0,-1,0],f),e.tri(_(E),_(G),_(z),[0,-1,0],f),O(E,F),O(G,z);continue}for(let w=0;w<u;w++){let B=R(A,w),E=R(M,w),F=R(M,w+1),z=R(A,w+1);if(v(A,w)||v(M,w)){let K=(ce,tt)=>{let Se=(n.startBin+ce+.5)*t.binStepDeg,nt=r[ce]+(o[ce]-r[ce])*(w+.5)/u,we=$e(t.centre,nt,Se);return[we.x*l,tt,we.y*l]},J=b(A,w),Z=b(M,w),q=K(A,m[A][w]),ne=K(M,m[M][w]);e.triN(J,Z,ne,B,E,E,d),e.triN(J,ne,q,B,E,B,d);let Ue=b(M,w+1),Xe=b(A,w+1),ve=K(A,m[A][w+1]),_e=K(M,m[M][w+1]);e.triN(ve,_e,Ue,z,F,F,d),e.triN(ve,Ue,Xe,z,F,z,d);let Fe=ne[0]-q[0],Me=ne[2]-q[2],be=Math.hypot(Fe,Me);if(be>1e-12){let ce=[-Me/be,0,Fe/be];e.tri(q,ne,_e,ce,p),e.tri(q,_e,ve,ce,p)}continue}let G=b(A,w),_=b(M,w),L=b(M,w+1),Y=b(A,w+1);e.triN(G,_,L,B,E,F,d),e.triN(G,L,Y,B,F,z,d)}let P=b(A,0),C=b(M,0),T=b(M,u),H=b(A,u),k=w=>[w[0],i,w[2]];e.tri(k(P),k(T),k(C),[0,-1,0],f),e.tri(k(P),k(H),k(T),[0,-1,0],f),O(P,C),O(H,T)}if(!n.closed)for(let A of[0,c-1])for(let M=0;M<u;M++)O(b(A,M),b(A,M+1))}function Ir(e,t,n){let{bottomY:r,colors:o,ao:i}=n,a=new Float64Array(t.binCount).fill(-1/0);for(let l of t.rings)for(let h of l.arcs){let m=new Float64Array(h.binCount),d=new Float64Array(h.binCount);for(let p=0;p<h.binCount;p++){let y=(h.startBin+p)%t.binCount,b=Math.max(0,h.innerR[p]-ge);m[p]=Math.max(b,a[y]+.001),d[p]=Math.max(m[p]+.001,h.outerR[p]+ge)}let f=0;for(let p=0;p<h.binCount;p++){let y=h.topLevelM[p]-r;y>f&&(f=y)}f>=Ms&&Es(e,t,h,m,d,r,o,i);for(let p=0;p<h.binCount;p++){let y=(h.startBin+p)%t.binCount;d[p]>a[y]&&(a[y]=d[p])}}if(Is(n.shapes,t))return;let s=t.rings[t.rings.length-1],c=Ss*Ve,u=ws*Ve;for(let l of s.arcs){let h=[],m=[];for(let p=0;p<l.binCount;p++){let y=(l.startBin+p+.5)*t.binStepDeg,b=l.outerR[p]+ge+c;h.push($e(t.centre,b,y)),m.push($e(t.centre,b+u,y))}let d=-1/0;for(let p=0;p<l.binCount;p++)l.topLevelM[p]>d&&(d=l.topLevelM[p]);let f=()=>d+Ps;l.closed?se(e,m,[h.slice().reverse()],f,r,o.shellTop,o.shellWall,i):se(e,[...m,...h.slice().reverse()],void 0,f,r,o.shellTop,o.shellWall,i)}}function Ar(e,t,n,r,o,i,a,s){if(!t.outline||t.outline.length<3)return;let c=n.baseHeightM,u=ke(r,s.tierTop);if(!o)return;let l=y=>o.deckAt(y.x,y.y),h=sr(t,a),m=h[0]??t.outline;if(o.rowLevels.length>=2){let y=Wt(o.rowLevels),b=cr(tr(o.rowLevels,n.focal,y),h),g=()=>[0,1,0];for(let S of b){let I=Math.max(c,S.topY-.02);for(let v of i.subtract(S.outline,I))se(e,v,S.holes,()=>I,c,u,s.tierWall,ae,void 0,g)}b.length||se(e,m,t.holes,()=>o.landingY,c,u,s.tierWall,ae);let x={tread:[u[0]*ae.top,u[1]*ae.top,u[2]*ae.top],riser:[u[0]*.72,u[1]*.72,u[2]*.72]};for(let S of h.length?h:[m])or(e,o.rowLevels,n.focal,o.landingY,x,S,y);return}let d=o.flat?1/0:lr,f=y=>o.normalAt(y.x,y.y),p=o.flat?o.landingY:void 0;for(let y of i.subtract(m,p))se(e,y,t.holes,l,c,u,s.tierWall,ae,d,f)}function Rs(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],l=o.get(s);l||(l=new Map,o.set(s,l));let h=u.rowId||`__seat-${a}`,m=l.get(h);m||(m={pts:[],levelM:0,n:0},l.set(h,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(l=>!l.patch).map(l=>({pts:l.pts,levelM:l.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 Er(e,t,n,r,o){let i=Rs(t,n,r);if(!i.length)return;let a=Pr(i,t.focal);a&&(e.setMaterial(0),Ir(e,a,{bottomY:t.baseHeightM,colors:{bandTop:ye(o.tierTop,.8),bandWall:o.tierWall,shellTop:ye(o.tierWall,1.15),shellWall:o.tierWall},ao:ae,shapes:t.objects.filter(s=>s.type==="shape")}))}function Rr(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 Tr(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 Ts=1.15,ks=3.25,Ls=4.5,_s=.85,Fs=.5,Ds=.26;function kr(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>=Ts&&a.add("zone"),o<=(i?ks:Ls)&&(a.add("section"),a.add("ga")),o<=_s&&(a.add("annotation"),a.add("booth")),o<=Fs&&a.add("row"),o<=Ds&&a.add("seat"),a}function Ge(e,t,n,r){let o=e,i=t[0],a=t[1],s=t[2],c=o[0]*i+o[4]*a+o[8]*s+o[12],u=o[1]*i+o[5]*a+o[9]*s+o[13],l=o[2]*i+o[6]*a+o[10]*s+o[14],h=o[3]*i+o[7]*a+o[11]*s+o[15];if(!(h>1e-6))return{x:0,y:0,depth:1/0,visible:!1};let m=c/h,d=u/h,f=l/h,p=m>=-1.05&&m<=1.05&&d>=-1.05&&d<=1.05&&f<=1;return{x:(m*.5+.5)*n,y:(1-(d*.5+.5))*r,depth:f,visible:p}}function Lr(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(Hn(i,s,t,n)){a=!0;break}a||r.push(i)}return r}var Os=6;function Hn(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+Os):n;return o<a&&i<r}function _r(e,t,n){return e.length*t*.58+(n?14:0)}var jn={row:8,seat:14};function Fr(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 Un(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(Hn(s,u,t,n)){c=!0;break}if(!c){for(let u of a)if(Hn(s,u,t,n)){c=!0;break}}c||a.push(s)}return a}var Bs=6,Vs=2.2,Dr=.1,Ns=.3,Gs=1.8,zs=.9,Hs=.55,js=6e3;function Or(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 l of n)for(let h of l.objects)h.type==="section"&&h.zone&&c.set(h.id,h.zone);let u=new Map;for(let l=0;l<r.length;l++){let h=r[l],m=o.seatOwner[l],d=h.zoneId??(m?c.get(m):void 0);if(!d)continue;let f=u.get(d);f||(f={n:0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0,sumY:0},u.set(d,f)),f.n++,h.x<f.minX&&(f.minX=h.x),h.y<f.minY&&(f.minY=h.y),h.x>f.maxX&&(f.maxX=h.x),h.y>f.maxY&&(f.maxY=h.y),f.sumY+=o.seatDeckY(l)}for(let l of a){let h=u.get(l.id),m=[];for(let[d,f]of c)f===l.id&&m.push(d);if(!h||h.n===0){s.push({id:l.id,label:l.label,color:te(l.color),sectionIds:m,seatCount:0,center:[0,0,0],radius:0,focalWorld:[(l.focalPoint??i).x*D,1.5,(l.focalPoint??i).y*D]});continue}s.push({id:l.id,label:l.label,color:te(l.color),sectionIds:m,seatCount:h.n,center:[(h.minX+h.maxX)/2*D,h.sumY/h.n,(h.minY+h.maxY)/2*D],radius:.5*Math.hypot((h.maxX-h.minX)*D,(h.maxY-h.minY)*D)||1,focalWorld:[(l.focalPoint??i).x*D,1.5,(l.focalPoint??i).y*D]})}}return s}function Br(e){let{doc:t,units:n,seats:r,surfaces:o,seatData:i,hintedSeatFloor:a,zones:s,focal:c}=e,u=[],l=[],h=[];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]+Bs,m.center[2]],color:t.zones?.find(d=>d.id===m.id)?.color});{let m=new Map,d=new Map;for(let f=0;f<r.length;f++){let p=o.seatOwner[f];if(!p)continue;let y=m.get(p);y||(y={n:0,x:0,y:0,deck:0},m.set(p,y)),y.n++,y.x+=r[f].x,y.y+=r[f].y,y.deck+=o.seatDeckY(f);let b=d.get(p);b||(b={minX:1/0,maxX:-1/0,minY:1/0,maxY:-1/0},d.set(p,b)),r[f].x<b.minX&&(b.minX=r[f].x),r[f].x>b.maxX&&(b.maxX=r[f].x),r[f].y<b.minY&&(b.minY=r[f].y),r[f].y>b.maxY&&(b.maxY=r[f].y)}for(let f of n)for(let p of f.objects){if(p.type!=="section")continue;let y=m.get(p.id);if(!y||y.n===0)continue;let b=d.get(p.id),g=[y.x/y.n*D,y.deck/y.n,y.y/y.n*D],x=p.displayLabel||p.label||p.id;l.push({id:p.id,floorIndex:f.index,label:x,seatCount:y.n,center:g,radius:Math.max(1,Math.hypot(b.maxX-b.minX,b.maxY-b.minY)*.5*D),focalWorld:[f.focal.x*D,f.baseHeightM+1.5,f.focal.y*D]});let S=t.floors?.[f.index]?.name?.trim().toLocaleLowerCase();n.length>1&&S===x.trim().toLocaleLowerCase()||u.push({id:`section:${p.id}`,kind:"section",text:x,anchor:[g[0],g[1]+Vs,g[2]],floorIndex:f.index})}}{for(let f of n)for(let p of f.objects){if(p.type!=="gaArea")continue;let y=vt(p.points);if(!y)continue;let b=p.displayLabel||p.label||p.id;u.push({id:`ga:${p.id}`,kind:"ga",text:p.capacity>0?`${b} \xB7 ${p.capacity.toLocaleString()}`:b,anchor:[y.x*D,f.baseHeightM+Gs,y.y*D],floorIndex:f.index})}let m=new Map;for(let f=0;f<r.length;f++){let p=r[f],y=Math.hypot(p.x-c.x,p.y-c.y),b=m.get(p.rowId);(!b||y>b.far)&&m.set(p.rowId,{seat:p,index:f,far:y})}for(let[f,p]of m){let y=p.seat.label?p.seat.label.lastIndexOf("-"):-1,b=y>0?p.seat.label.slice(0,y):f;b&&u.push({id:`row:${f}`,kind:"row",text:b,anchor:[p.seat.x*D,o.seatDeckY(p.index)+zs,p.seat.y*D],floorIndex:a[p.index]})}let d=new Map;for(let f=0;f<r.length;f++){let p=r[f],y=p.label?p.label.lastIndexOf("-"):-1,b=d.get(p.rowId);b||(b={n:0,x:0,y:0,z:0,minX:1/0,maxX:-1/0,minZ:1/0,maxZ:-1/0,label:y>0?p.label.slice(0,y):p.rowId,sectionId:p.sectionId},d.set(p.rowId,b));let g=f*3,x=i.iPosition[g],S=i.iPosition[g+1],I=i.iPosition[g+2];b.n++,b.x+=x,b.y+=S,b.z+=I,b.minX=Math.min(b.minX,x),b.maxX=Math.max(b.maxX,x),b.minZ=Math.min(b.minZ,I),b.maxZ=Math.max(b.maxZ,I)}for(let[f,p]of d)h.push({id:f,label:p.label,sectionId:p.sectionId,seatCount:p.n,center:[p.x/p.n,p.y/p.n,p.z/p.n],radius:Math.max(.8,Math.hypot(p.maxX-p.minX,p.maxZ-p.minZ)*.5)});if(r.length<=js)for(let f=0;f<r.length;f++){let p=r[f],y=p.displayLabel||p.label;y&&u.push({id:`seat:${p.id}`,kind:"seat",text:y,anchor:[p.x*D,o.seatDeckY(f)+Hs,p.y*D],floorIndex:a[f]})}}for(let m of n)for(let d of m.objects)if(d.type==="shape"&&d.role&&["entrance","exit","screen","suite","obstruction"].includes(d.role)){let f=Ze(d),p=f?vt(f):null;if(!p||!d.label)continue;u.push({id:`architecture:${d.id}`,kind:"annotation",text:d.label,anchor:[p.x*D,m.baseHeightM+Ct(d).heightM+Dr,p.y*D],color:d.fill,floorIndex:m.index})}else if(d.type==="text"){if(!d.text)continue;u.push({id:`text:${d.id}`,kind:"annotation",text:d.text,anchor:[d.position.x*D,m.baseHeightM+Dr,d.position.y*D],color:d.color,rotation:d.rotation,floorIndex:m.index})}else if(d.type==="booth"){let f=At(d);if(!f)continue;let p=vt(f);if(!p)continue;u.push({id:`booth:${d.id}`,kind:"booth",text:d.displayLabel||d.label||d.id,anchor:[p.x*D,m.baseHeightM+Nn+Ns,p.y*D],floorIndex:m.index})}return{labels:u,sections:l,rows:h}}function Vr(e,t){if(t.length>1)for(let n of t)e.push({id:`floor:${n.id}`,kind:"floor",text:n.label,anchor:[n.center[0],n.box.max[1]+1.2,n.center[2]],floorIndex:n.index})}function Nr(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 d=Math.max(0,Math.min(n.length-1,Math.round(i.floor[m]))),f=m*3,p=u[d];p.minX=Math.min(p.minX,i.position[f]),p.minY=Math.min(p.minY,i.position[f+1]),p.minZ=Math.min(p.minZ,i.position[f+2]),p.maxX=Math.max(p.maxX,i.position[f]),p.maxY=Math.max(p.maxY,i.position[f+1]),p.maxZ=Math.max(p.maxZ,i.position[f+2])}let l=new Map;for(let m=0;m<n.length;m++)for(let d of n[m].objects)d.type==="section"&&l.set(d.id,m);let h=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 d=o.seatOwner[m],f=(d!==null?l.get(d):void 0)??a[m];if(f===void 0)continue;let p=h[f],y=r[m];p.n++,y.x<p.minX&&(p.minX=y.x),y.y<p.minY&&(p.minY=y.y),y.x>p.maxX&&(p.maxX=y.x),y.y>p.maxY&&(p.maxY=y.y);let b=o.seatDeckY(m);p.sumX+=y.x*D,p.sumDeck+=b,p.sumZ+=y.y*D,p.minDeck=Math.min(p.minDeck,b),p.maxDeck=Math.max(p.maxDeck,b+1.6),s[m]=f}for(let m=0;m<n.length;m++){let d=h[m],f=t.floors?.[m],p=u[m],y=Math.min(d.n?d.minX*D:n[m].focal.x*D-1,Number.isFinite(p.minX)?p.minX:1/0),b=Math.max(d.n?d.maxX*D:n[m].focal.x*D+1,Number.isFinite(p.maxX)?p.maxX:-1/0),g=Math.min(d.n?d.minY*D:n[m].focal.y*D-1,Number.isFinite(p.minZ)?p.minZ:1/0),x=Math.max(d.n?d.maxY*D:n[m].focal.y*D+1,Number.isFinite(p.maxZ)?p.maxZ:-1/0),S=Math.min(d.n?Math.min(n[m].baseHeightM,d.minDeck):n[m].baseHeightM,Number.isFinite(p.minY)?p.minY:1/0),I=Math.max(d.n?Math.max(d.maxDeck,S+.5):S+.5,Number.isFinite(p.maxY)?p.maxY:-1/0),v=[d.n?d.sumX/d.n:(y+b)/2,d.n?d.sumDeck/d.n:(S+I)/2,d.n?d.sumZ/d.n:(g+x)/2],R=Math.max(1,.5*Math.hypot(b-y,I-S,x-g));c.push({index:m,id:f?.id??`floor-${m}`,label:f?.name??(n.length>1?`Floor ${m+1}`:"Venue"),seatCount:d.n,center:v,radius:R,box:{min:[y,S,g],max:[b,I,x]},focalWorld:[n[m].focal.x*D,n[m].baseHeightM+1.5,n[m].focal.y*D]})}}return c}function Xn(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=At(c);if(u)for(let l of u)a(l.x,l.y)}else if(c.type==="table"){let u=Gn(c);if(u)for(let l of u)a(l.x,l.y)}else if(c.type==="decorImage"){let u=zn(c);if(u)for(let l of u)a(l.x,l.y)}return Number.isFinite(n)||(n=-100,r=-100,o=100,i=100),{minX:n,minY:r,maxX:o,maxY:i}}function Gr(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=Pt(o.minX-a,o.minY-a,o.maxX-o.minX+a*2,o.maxY-o.minY+a*2);se(e,s,void 0,()=>0,-.4,i.ground,i.ground,ae)}else{let a=t.reduce((d,f)=>f.baseHeightM<d.baseHeightM?f:d);e.setFloor(a.index);let s=n.filter((d,f)=>r[f]===a.index),c=Xn([a],s),u=Math.hypot(c.maxX-c.minX,c.maxY-c.minY),l=Math.max(28,Math.min(80,u*.04)),h=Pt(c.minX-l,c.minY-l,c.maxX-c.minX+l*2,c.maxY-c.minY+l*2),m=a.baseHeightM-.03;se(e,h,void 0,()=>m,m-.22,i.ground,i.ground,ae)}}function zr(e,t,n){let{cx:r,cz:o,radius:i}=n,a=1/0,s=1/0,c=1/0,u=-1/0,l=-1/0,h=-1/0,m=(p,y,b)=>{a=Math.min(a,p),u=Math.max(u,p),s=Math.min(s,y),l=Math.max(l,y),c=Math.min(c,b),h=Math.max(h,b)};for(let p=0;p<e.position.length;p+=3)m(e.position[p],e.position[p+1],e.position[p+2]);for(let p=0;p<t.count;p++){let y=p*3,b=t.iPosition[y],g=t.iPosition[y+1],x=t.iPosition[y+2],S=Math.max(.35,t.iMaxRadius[p]??.35);m(b-S,g,x-S),m(b+S,g+1.6,x+S)}Number.isFinite(a)||(a=r-i,u=r+i,s=0,l=i*.16,c=o-i,h=o+i);let d=[(a+u)/2,(s+l)/2,(c+h)/2],f=Math.max(1,.5*Math.hypot(u-a,l-s,h-c));return{center:d,radius:f,minY:s,maxY:l}}function Hr(e,t,n,r,o,i){let a=1/0,s=1/0,c=-1/0,u=-1/0;for(let S=0;S<e.count;S++){let I=S*3,v=e.iPosition[I],R=e.iPosition[I+2];v<a&&(a=v),v>c&&(c=v),R<s&&(s=R),R>u&&(u=R)}for(let S of t)a=Math.min(a,S.cx-S.halfX),c=Math.max(c,S.cx+S.halfX),s=Math.min(s,S.cz-S.halfZ),u=Math.max(u,S.cz+S.halfZ);let l=n.minX*D,h=n.maxX*D,m=n.minY*D,d=n.maxY*D,f=l,p=h,y=m,b=d;if(Number.isFinite(a)){let S=Math.max(2,.06*Math.hypot(c-a,u-s));f=Math.max(l,a-S),p=Math.min(h,c+S),y=Math.max(m,s-S),b=Math.min(d,u+S)}let g=Math.min(0,r),x=Math.max(o,i*.05);return{min:[f,g,y],max:[p,x,b]}}var Yn="seatlayer.event-configuration/1";var Us=/^[a-f0-9]{64}$/,Xs=new Set(["stage","screen","barrier","camera_platform","sound_desk","rigging_truss"]);function Et(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function Je(e,t){return typeof e=="string"&&e.length>=1&&e.length<=t&&e.normalize("NFKC").trim()===e}function Ys(e){return typeof e=="number"&&Number.isInteger(e)&&e>0}function jr(e){return!Array.isArray(e)||e.length>1e5||!e.every(t=>Je(t,100))?null:[...new Set(e)].sort()}function Ws(e){return!Et(e)||!Je(e.chartId,100)||!Je(e.version,100)||e.sha256!==void 0&&(typeof e.sha256!="string"||!Us.test(e.sha256))?null:{chartId:e.chartId,version:e.version,...typeof e.sha256=="string"?{sha256:e.sha256}:{}}}function Wn(e,t,n){return typeof e=="number"&&Number.isFinite(e)&&e>=t&&e<=n}function Ks(e){return Et(e)?e.mode==="none"||e.mode==="opaque"?e.opacity===void 0?{mode:e.mode}:null:e.mode==="partial"&&Wn(e.opacity,.01,.99)?{mode:"partial",opacity:e.opacity}:null:null}function Qs(e,t){if(e===void 0)return;if(!Array.isArray(e)||e.length>1e4)return null;let n=new Set(t),r=new Set,o=new Set,i=[];for(let a of e){if(!Et(a)||!Je(a.id,100)||!Je(a.objectId,100)||!n.has(a.objectId)||!Xs.has(String(a.kind))||!Wn(a.heightM,.05,50)||a.baseElevationM!==void 0&&!Wn(a.baseElevationM,-10,100))return null;let s=Ks(a.occlusion);if(!s||r.has(a.id)||o.has(a.objectId))return null;r.add(a.id),o.add(a.objectId),i.push({id:a.id,objectId:a.objectId,kind:a.kind,heightM:a.heightM,...a.baseElevationM!==void 0?{baseElevationM:a.baseElevationM}:{},occlusion:s})}return i.sort((a,s)=>a.id.localeCompare(s.id))}function qs(e){let t=[];if(!Et(e))return{issues:[{code:"invalid_export",path:"configuration",message:"Configuration must be an object"}]};e.schema!==Yn&&t.push({code:"unsupported_schema",path:"configuration.schema",message:`Configuration schema must be ${Yn}`}),Je(e.id,100)||t.push({code:"invalid_id",path:"configuration.id",message:"Configuration id must contain 1 to 100 normalized characters"}),Je(e.label,120)||t.push({code:"invalid_label",path:"configuration.label",message:"Configuration label must contain 1 to 120 normalized characters"}),Ys(e.version)||t.push({code:"invalid_version",path:"configuration.version",message:"Configuration version must be a positive integer"});let n=Ws(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=Et(e.overlay)?e.overlay:null,o=jr(r?.objectIds),i=jr(r?.productionKillSeatIds),a=o?Qs(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:Yn,id:e.id,label:e.label,version:e.version,baseVenue:n,overlay:{objectIds:o,productionKillSeatIds:i,...a!==void 0?{productionElements:a}:{}}}}}function Ur(e){let t=qs(e);return t.value?{ok:!0,value:t.value}:{ok:!1,issues:t.issues}}function Xr(e,t,n){let r=()=>({byObjectId:new Map,elements:[]});if(!t||!e)return r();let o=Ur(t);if(!o.ok||o.value.id!==e)return r();let i=new Map;for(let l of n)for(let h of l.objects)h.type==="shape"&&i.set(h.id,{shape:h,unit:l});let a=new Set,s=new Set,c=[];for(let l of o.value.overlay.productionElements??[]){let h=i.get(l.objectId),m=h?Ze(h.shape):null,d=l.baseElevationM??0;if(!h||!m||m.length<3||!l.id||a.has(l.id)||s.has(l.objectId)||!Number.isFinite(l.heightM)||l.heightM<.05||l.heightM>50||!Number.isFinite(d)||d<-10||d>100)return r();a.add(l.id),s.add(l.objectId);let f=m.map(b=>b.x*D),p=m.map(b=>b.y*D),y=h.unit.baseHeightM+d;c.push({id:l.id,objectId:l.objectId,kind:l.kind,floorIndex:h.unit.index,baseY:y,topY:y+l.heightM,bounds:{min:[Math.min(...f),y,Math.min(...p)],max:[Math.max(...f),y+l.heightM,Math.max(...p)]},occlusion:l.occlusion})}let u=c.sort((l,h)=>l.id.localeCompare(h.id));return{byObjectId:new Map(u.map(l=>[l.objectId,l])),elements:u}}function dt(e){let{doc:t}=e,n=No(t.theme),r=n.structure,o=ar(t,e.eventConfigurationId??t.eventConfigurationId),i=Xr(e.eventConfigurationId,e.eventConfiguration,o),a=e.seats,s=new Ht,c=new Map;for(let P of o)for(let C of P.objects)c.set(C.id,P.index),C.type==="section"&&c.set(C.logicalSectionId??C.id,P.index);let u=a.map(P=>c.get(P.sectionId??"")??c.get(P.rowId??"")??0),l=Xn(o,a);Gr(s,o,a,u,l,r);let h=dr(t,a),m=new Map,d=new Map;for(let P of t.categories??[])m.set(P.key,P.color),P.seatGlyph&&d.set(P.key,P.seatGlyph);let f=[],p=ur(o,a,u),y=new Float32Array(a.length);for(let P=0;P<o.length;P++){let C=o[P];s.setFloor(P);let T=new Qt,H=[],k=C.objects.filter(w=>w.type==="section"&&!!w.outline&&w.outline.length>=3);for(let w of C.objects)if(w.type==="section")Ar(s,w,C,mr(w,h),p.bySection.get(w.id),T,k,r);else if(w.type==="shape"){let B=i.byObjectId.get(w.id);s.setMaterial((B?.kind??w.role)==="screen"?1:0),vr(s,w,C.baseHeightM,pr(w,H),r,C.focal,f,B),s.setMaterial(0)}else w.type==="gaArea"?Sr(s,w,C.baseHeightM,te(m.get(w.categoryKey)),r):w.type==="booth"?gr(s,w,C.baseHeightM,te(m.get(w.categoryKey)),r):w.type==="table"?xr(s,w,C.baseHeightM,te(m.get(w.categoryKey)),r):w.type==="decorImage"&&Mr(s,w,C.baseHeightM,r);Er(s,C,a,p,r)}let b=o.length>1?{x:o.reduce((P,C)=>P+C.focal.x,0)/o.length,y:o.reduce((P,C)=>P+C.focal.y,0)/o.length}:t.focalPoint??{x:(l.minX+l.maxX)/2,y:(l.minY+l.maxY)/2},g=_o([s.build()]),x=Vo(a,e.initialState,p,y,m,d),S=Or({doc:t,units:o,seats:a,surfaces:p,focal:b}),{labels:I,sections:v,rows:R}=Br({doc:t,units:o,seats:a,surfaces:p,seatData:x,hintedSeatFloor:u,zones:S,focal:b}),O=Nr({doc:t,units:o,seats:a,surfaces:p,solids:g,hintedSeatFloor:u,seatFloor:y});Vr(I,O),x.iYaw=Oo(x.iPosition,a.length,P=>a[P].rowId,P=>{let C=o[y[P]]?.focal??b;return[C.x*D,C.y*D]});let V=(l.minX+l.maxX)/2*D,U=(l.minY+l.maxY)/2*D,N=.5*Math.hypot((l.maxX-l.minX)*D,(l.maxY-l.minY)*D)||10,A=zr(g,x,{cx:V,cz:U,radius:N}),M=Hr(x,f,l,A.minY,A.maxY,N);return{solids:g,seats:x,bounds:{center:[(M.min[0]+M.max[0])/2,(M.min[1]+M.max[1])/2,(M.min[2]+M.max[2])/2],radius:N,groundY:0,box:M},renderBounds:{center:A.center,radius:A.radius},stateColorLUT:Go(n,xe),theme:n,seatCount:a.length,focalWorld:[b.x*D,1.5,b.y*D],zones:S,stages:f,productionElements:i.elements,sections:v,rows:R,labels:I,floors:O}}var Zs=88,$s=20,Yr={floor:{size:14,weight:"700",opacity:.98},zone:{size:15,weight:"600",opacity:.95},section:{size:12,weight:"500",opacity:.88},ga:{size:12,weight:"500",opacity:.88},booth:{size:11,weight:"500",opacity:.85},annotation:{size:11,weight:"400",opacity:.75},row:{size:10.5,weight:"600",opacity:.8},seat:{size:9.5,weight:"500",opacity:.72}},$t=new Set(["row","seat"]),Wr={floor:5,zone:4,section:3,ga:3,booth:2,annotation:1},Jt={row:{x:62,y:16},seat:{x:46,y:18}},Kr=te,Kn=e=>lo(e);function Qr(e,t){let n=Kn(e),r=Kn(t);return(Math.max(n,r)+.05)/(Math.min(n,r)+.05)}function Qn(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 Js(e,t=[.04,.06,.1],n=!0){let r=Kn(t)<.42,o=r?"#f4f7fb":"#0b1220",i=r?"rgba(8,12,22,.78)":"rgba(255,255,255,.84)",a=n?Qn(i,t):t,s=Kr(e),c=n?7:4.5,u=s&&Qr(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)"}}var en=class{constructor(t,n={}){this.nodes=new Map;this.labels=[];this.forcedDense=!1;this.selectedSeatLabelIds=new Set;this.opts=n,this.root=document.createElement("div"),this.root.setAttribute("data-view3d-labels","");let r=this.root.style;r.position="absolute",r.inset="0",r.pointerEvents="none",r.overflow="hidden",n.fontFamily&&(r.fontFamily=n.fontFamily),t.appendChild(this.root)}setVisible(t){this.root.style.visibility=t?"":"hidden"}setLabels(t){this.labels=t;for(let[n,r]of this.nodes)t.some(o=>o.id===n)||(r.remove(),this.nodes.delete(n))}setForcedDense(t){this.forcedDense=t}setSelectedSeatIds(t){this.selectedSeatLabelIds=new Set(Array.from(t,n=>`seat:${n}`))}qualityEvidence(){let t=this.root.getBoundingClientRect(),n=this.root.style.visibility!=="hidden";return this.labels.map(r=>{let o=this.nodes.get(r.id),i=o?.getBoundingClientRect(),a=!!(n&&o&&o.style.display!=="none"&&i&&i.width>0&&i.height>0);return{id:r.id,kind:r.kind,text:r.text,visible:a,renderedFontPx:o&&Number.parseFloat(o.style.fontSize)||0,contrast:o?Number(o.dataset.qualityContrast??0):0,...a&&i?{screenBox:{x:i.x-t.x,y:i.y-t.y,width:i.width,height:i.height}}:{}}})}update(t,n,r,o,i,a){if(!this.labels.length)return;let s=kr(o,i,{hasZoneLabels:this.labels.some(g=>g.kind==="zone")});this.forcedDense&&(s.add("row"),s.add("seat"));let c=[];for(let g of this.labels){if(!s.has(g.kind))continue;let x=Ge(t,g.anchor,n,r);if(!x.visible)continue;let S=a?Math.hypot(g.anchor[0]-a[0],g.anchor[1]-a[1],g.anchor[2]-a[2]):1;c.push({label:g,screen:x,focus:Fr(x,S,n,r),halfWidth:_r(g.text,Yr[g.kind].size,!$t.has(g.kind))/2,...this.selectedSeatLabelIds.has(g.id)?{priority:1}:{}})}let u=Tr(c.filter(g=>g.label.kind==="floor"),n),l=[...c.filter(g=>!$t.has(g.label.kind)&&g.label.kind!=="floor"),...u],h=Lr(l,Zs,$s),m=Un(c.filter(g=>g.label.kind==="row"),Jt.row.x,Jt.row.y,jn.row,h),d=Un(c.filter(g=>g.label.kind==="seat"),Jt.seat.x,Jt.seat.y,jn.seat,[...h,...m]),f=[...h,...m,...d],p=new Set(f.map(g=>g.label.id));for(let{label:g,screen:x}of f){let I=this.nodeFor(g).style;I.display="",I.transform=`translate(-50%, -50%) translate(${x.x.toFixed(1)}px, ${x.y.toFixed(1)}px)`}let y=f.filter(({label:g})=>!$t.has(g.kind)).sort((g,x)=>Wr[x.label.kind]-Wr[g.label.kind]||g.screen.depth-x.screen.depth||g.focus-x.focus),b=[];for(let{label:g}of y){let x=this.nodes.get(g.id);if(!x||x.style.display==="none")continue;let S=x.getBoundingClientRect();b.some(v=>S.left<v.right+3&&S.right+3>v.left&&S.top<v.bottom+3&&S.bottom+3>v.top)?x.style.display="none":b.push(S)}for(let[g,x]of this.nodes)p.has(g)||(x.style.display="none")}nodeFor(t){let n=this.nodes.get(t.id);if(!n){n=document.createElement("div");let h=n.style;h.position="absolute",h.left="0",h.top="0",h.whiteSpace="nowrap",h.textShadow="0 1px 3px rgba(0,0,0,0.85), 0 0 8px rgba(0,0,0,0.55)",h.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=Yr[t.kind],i=n.style;i.fontSize=`${o.size}px`,i.fontWeight=r?"800":o.weight,i.opacity=r?"1":String(o.opacity);let a=!$t.has(t.kind),s=Js(t.color??this.opts.ink,this.opts.backgroundRgb,a);i.color=r?"#ecf8ff":s.ink,i.background=r?"rgba(10,28,45,.9)":a?s.backing:"",i.border=r?"1px solid rgba(89,199,255,.92)":a?`1px solid ${s.border}`:"",i.borderRadius=r||a?"999px":"",i.padding=r||a?"3px 7px":"",i.boxShadow=r?"0 0 0 2px rgba(41,176,255,.18), 0 5px 14px rgba(0,0,0,.35)":a?"0 3px 10px rgba(0,0,0,.24)":"",i.letterSpacing=t.kind==="zone"||t.kind==="floor"?"0.08em":"0.02em";let c=this.opts.backgroundRgb??[.04,.06,.1],u=Kr(r?"#ecf8ff":s.ink)??[1,1,1],l=r?Qn("rgba(10,28,45,.9)",c):a?Qn(s.backing,c):c;return n.dataset.qualityContrast=Qr(u,l).toFixed(3),(t.kind==="zone"||t.kind==="floor")&&(i.textTransform="uppercase"),n}dispose(){this.root.remove(),this.nodes.clear()}};var Zr=1;var ec=new Set(["floor","zone","section","ga","booth","annotation"]);function tc(e){return e.every(t=>Number.isFinite(t))}function nc(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 qr(e){return e.length?Math.round(Math.min(...e)*100)/100:null}function et(e){return Math.round(e*1e4)/1e4}function oc(e){if(e)return{box:{x:et(e.box.x),y:et(e.box.y),width:et(e.box.width),height:et(e.box.height)},horizontalFillRatio:et(e.horizontalFillRatio),verticalFillRatio:et(e.verticalFillRatio),visibleAreaRatio:et(e.visibleAreaRatio),clippedEdges:[...e.clippedEdges]}}function Ae(e,t,n){return n.length?{code:e,message:t,count:n.length,samples:n.slice(0,20)}:null}function tn(e){let t=e.labels.filter(s=>s.visible&&s.screenBox),n=t.filter(s=>ec.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)nc(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=[Ae("webgl2-unavailable","The venue scene must render through WebGL2",e.context.webgl2?[]:[{primaryId:"renderer",primaryLabel:"WebGL2"}]),Ae("context-lost","The WebGL context must be live at capture",e.context.lost?[{primaryId:"renderer",primaryLabel:"context lost"}]:[]),Ae("frame-not-stable","The captured 3D frame must be rendered and parked",e.frame.rendered>0&&e.frame.idle?[]:[{primaryId:"renderer",primaryLabel:"unstable frame"}]),Ae("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}`}]),Ae("camera-invalid","The capture camera must have a finite physical pose",tc(i)&&e.camera.distance>0&&e.camera.verticalFovDeg>0&&e.camera.verticalFovDeg<180?[]:[{primaryId:"camera",primaryLabel:"invalid pose"}]),Ae("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}]),Ae("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`}]),Ae("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}))),Ae("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}))),Ae("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:oc(e.framing)},metrics:{minimumHierarchyFontPx:qr(n.map(s=>s.renderedFontPx)),minimumHierarchyContrast:qr(n.map(s=>s.contrast)),projectedReliefPx:Math.round(e.scene.projectedReliefPx*100)/100},findings:a}}var pe=require("ogl");var ze=require("ogl");var nn=`
|
|
20
|
+
}`});async function Di(e,t,n,r={}){let o=r.fadeMs??400,i=t?.initialBearingDeg??0,a=Math.max(-Te,Math.min(Te,t?.initialPitchDeg??0)),s=hn,c=!1,l=new AbortController,f=()=>l.abort();r.signal?.addEventListener("abort",f,{once:!0});let u=()=>{},d=[n.camera.position.x,n.camera.position.y,n.camera.position.z];if(!t&&n.cameraOriginWorld&&n.camera.position.set(n.cameraOriginWorld[0],n.cameraOriginWorld[1],n.cameraOriginWorld[2]),!t&&n.focalWorld){let D=n.camera.position,N=n.focalWorld[0]-D.x,j=n.focalWorld[1]-D.y,U=n.focalWorld[2]-D.z,T=Math.hypot(N,U);T>.001&&(i=Math.atan2(N,-U)*180/Math.PI,a=Math.max(-Te,Math.min(Te,Math.atan2(j,T)*180/Math.PI)))}let m=null;if(t){let D=n.gl.getParameter(n.gl.MAX_TEXTURE_SIZE),N=dn(t,un(D)),j;try{let U=t.resolveUrl?await t.resolveUrl(N.initialUrl):N.initialUrl;if(!U)throw new Error("panorama_asset_unavailable");j=await Lt(U,l.signal)}catch{return r.signal?.removeEventListener("abort",f),null}try{m=Li(n.gl,j)}catch{return l.abort(),r.signal?.removeEventListener("abort",f),null}m.mesh.renderOrder=999,m.mesh.setParent(n.scene),N.upgradeUrl&&(u=mn(()=>{(t.resolveUrl?t.resolveUrl(N.upgradeUrl):Promise.resolve(N.upgradeUrl)).then(T=>!T||l.signal.aborted?null:Lt(T,l.signal)).then(T=>{T&&(c||l.signal.aborted||(m?.setImage(T),n.requestRender()))}).catch(()=>{})}))}let h=n.camera.fov;n.camera.perspective({fov:s,aspect:n.camera.aspect});let p=n.camera.quaternion.slice(),g=()=>{let D=n.camera.position;m?.mesh.position.set(D.x,D.y,D.z);let[N,j,U]=Ti(i,a);n.camera.lookAt([D.x+N,D.y+j,D.z+U]),n.requestRender()};g();let b=document.createElement("div"),y=document.activeElement instanceof HTMLElement?document.activeElement:null;b.setAttribute("role","dialog"),b.setAttribute("aria-modal","true"),b.setAttribute("aria-label",r.seatLabel?`View from ${r.seatLabel}`:"View from seat"),b.tabIndex=-1,Object.assign(b.style,{position:"absolute",inset:"0",zIndex:"10",cursor:"grab",touchAction:"none"});let x=document.createElement("button");if(x.type="button",x.setAttribute("aria-label","Close"),x.textContent="\u2715",Object.assign(x.style,{position:"absolute",top:"12px",right:"12px",zIndex:"2",width:"44px",height:"44px",borderRadius:"999px",cursor:"pointer",border:"1px solid rgba(255,255,255,0.25)",background:"rgba(8,12,18,0.6)",color:"#e6edf3",fontSize:"15px",lineHeight:"1"}),b.appendChild(x),r.disclosure){let D=document.createElement("div");D.textContent=`${r.disclosurePrefix??"360\xB0 panorama"} \xB7 ${r.disclosure}`,Object.assign(D.style,{position:"absolute",top:"12px",left:"12px",zIndex:"2",maxWidth:"calc(100% - 88px)",padding:"8px 11px",borderRadius:"999px",overflow:"hidden",color:"#dce6f8",background:"rgba(8,12,18,0.68)",font:"600 11px/1.2 ui-sans-serif, system-ui, sans-serif",textOverflow:"ellipsis",whiteSpace:"nowrap",pointerEvents:"none",backdropFilter:"blur(6px)"}),b.appendChild(D)}let v=document.createElement("div");v.textContent="Drag to look \xB7 pinch or scroll to zoom \xB7 Esc to close",Object.assign(v.style,{position:"absolute",bottom:"12px",left:"0",right:"0",textAlign:"center",color:"rgba(230,237,243,0.7)",font:"12px ui-sans-serif, system-ui, sans-serif",pointerEvents:"none"}),b.appendChild(v),e.appendChild(b),x.focus({preventScroll:!0});let C=!1,M=0,I=0,_=0,B=new Map,z=()=>{let[D,N]=[...B.values()];return D&&N?Math.hypot(D.x-N.x,D.y-N.y):0},V=D=>{let N=io(D);N!==s&&(s=N,n.camera.perspective({fov:s,aspect:n.camera.aspect}),g())},A=D=>{D.target!==x&&(B.set(D.pointerId,{x:D.clientX,y:D.clientY}),C=B.size===1,M=D.clientX,I=D.clientY,B.size===2&&(_=z()),b.setPointerCapture?.(D.pointerId),b.style.cursor="grabbing")},S=D=>{if(B.has(D.pointerId)){if(B.set(D.pointerId,{x:D.clientX,y:D.clientY}),B.size>=2){let N=z();_>0&&N>0&&V(s*(_/N)),_=N,C=!1;return}C&&(i+=(D.clientX-M)*Fi,a=Math.max(-Te,Math.min(Te,a+(D.clientY-I)*Fi)),M=D.clientX,I=D.clientY,g())}},R=D=>{B.delete(D.pointerId),_=B.size===2?z():0;let N=B.values().next().value;C=B.size===1,N?(M=N.x,I=N.y):b.style.cursor="grab";try{b.releasePointerCapture?.(D.pointerId)}catch{}},w=D=>{D.preventDefault(),V(s+D.deltaY*.04)};b.addEventListener("pointerdown",A),b.addEventListener("pointermove",S),b.addEventListener("pointerup",R),b.addEventListener("pointercancel",R),b.addEventListener("wheel",w,{passive:!1});let P=D=>{if(!c){if(D.key==="Tab"){D.preventDefault(),x.focus({preventScroll:!0});return}if(D.key==="Escape"){D.stopPropagation(),F.close();return}if(D.key==="ArrowLeft"||D.key==="ArrowRight")i+=D.key==="ArrowLeft"?-4:4;else if(D.key==="ArrowUp"||D.key==="ArrowDown")a=Math.max(-Te,Math.min(Te,a+(D.key==="ArrowUp"?4:-4)));else if(D.key==="+"||D.key==="="){V(s-5),D.preventDefault();return}else if(D.key==="-"){V(s+5),D.preventDefault();return}else return;D.preventDefault(),g()}};window.addEventListener("keydown",P);let G=0,k=(D,N)=>{if(!m){N?.();return}let j=D===1?0:1,U=performance.now(),T=()=>{if(c)return;let L=o<=0?1:Math.min(1,(performance.now()-U)/o);m?.setOpacity(j+(D-j)*L),n.requestRender(),L<1?G=requestAnimationFrame(T):N?.()};G=requestAnimationFrame(T)};k(1);let E=()=>{c||(c=!0,u(),l.abort(),r.signal?.removeEventListener("abort",f),cancelAnimationFrame(G),b.removeEventListener("pointerdown",A),b.removeEventListener("pointermove",S),b.removeEventListener("pointerup",R),b.removeEventListener("pointercancel",R),b.removeEventListener("wheel",w),window.removeEventListener("keydown",P),b.remove(),y?.isConnected&&y.focus({preventScroll:!0}),m?.dispose(),n.camera.position.set(d[0],d[1],d[2]),n.camera.perspective({fov:h,aspect:n.camera.aspect}),n.camera.quaternion.set(p[0],p[1],p[2],p[3]),n.requestRender())},F={close(){if(c)return;let D=()=>{E(),r.onClose?.()};cancelAnimationFrame(G),k(0,D)},dispose:E};return x.addEventListener("click",()=>F.close()),F}var Fi,Oi=xt(()=>{"use strict";_i();ao();ro();Fi=.15});var Bi={};mo(Bi,{createOpenPanorama:()=>cl});function cl(e){let{container:t,model:n,opts:r,analytics:o,orbit:i,loop:a,seatsById:s,ensureSeatView:c,resolvedSeatViewPose:l,gpu:f,gl:u,isContextLost:d,isDisposed:m,flightGen:h,setPanorama:p,getLoadAbort:g,setLoadAbort:b,setPanoramaSphereVisible:y,setFrozen:x,raisePanoramaLayer:v,restorePanoramaLayer:C,getOverviewChip:M,labelOverlay:I,reducedMotion:_,removeArriveChip:B,showArriveChip:z}=e;return async(V,A,S)=>{g()?.abort();let R=new AbortController;b(R);let w=n.seats.idToIndex.get(V);if(w===void 0){i.syncFromCamera();return}let P=s.get(V)?.label??V,G=l(V,w),k=c(V);if(!k){R.abort(),g()===R&&b(null),i.syncFromCamera();return}x(!0),a.stop();let E;try{E=await k}catch{if(g()===R&&b(null),o.panoramaFailed(V,"source"),!m()&&S===h()){x(!1),i.resumeAfterFlight(G.focal),a.requestRender();let H=z(V,S,!0);requestAnimationFrame(()=>H?.querySelector("[data-panorama-trigger]")?.focus())}return}if(m()||S!==h()){R.abort(),g()===R&&b(null);return}B();let F=M(),D=()=>{R.abort(),g()===R&&b(null),p(null),y(!1),C(),F.style.display="",I.setVisible(!r.arriveAtSeatEye),x(!1),o.panoramaClosed(),i.resumeAfterFlight(G.focal),a.requestRender();let H=z(V,h());requestAnimationFrame(()=>H?.querySelector("[data-panorama-trigger]")?.focus())},N=E.generated===!0,j=Ei(E);v(),y(!N),F.style.display="none";let U=_()?0:A,T=f(),L=T&&!d()?await Di(t,N?null:E,{gl:u,scene:T.main,camera:i.camera,requestRender:()=>a.requestRender(),cameraOriginWorld:N?G.eye:void 0,focalWorld:G.focal},{fadeMs:U,seatLabel:P,disclosure:j,disclosurePrefix:N?"Live seat-eye view":"360\xB0 panorama",onClose:D,signal:R.signal}):null;if(m()||S!==h()){R.abort(),y(!1),g()===R&&b(null),L?.dispose(),F.style.display="",C();return}if(L)i.syncFromCamera(),I.setVisible(!1),x(!1),a.requestRender(),p(L);else if(N){C(),F.style.display="",x(!1),i.resumeAfterFlight(G.focal),a.requestRender(),p(null),y(!1),o.panoramaFailed(V,"mount");let H=z(V,h(),!0);requestAnimationFrame(()=>H?.querySelector("[data-panorama-trigger]")?.focus()),g()===R&&b(null);return}else y(!1),o.panoramaFallback(V),p(ki(t,E,{fadeMs:U,seatLabel:P,disclosure:j,onClose:D,signal:R.signal}));o.panoramaOpened()}}var Vi=xt(()=>{"use strict";ao();Oi()});var hl={};mo(hl,{VENUE3D_QUALITY_REPORT_VERSION:()=>ri,buildSceneModel:()=>ht,inspectVenue3DQualityEvidence:()=>an,mountVenue3D:()=>fl,prepareVenue3D:()=>Wi});module.exports=oa(hl);var go=require("ogl");var ra=/^#?([\da-f]{3}|[\da-f]{6})$/i;function ia(e){let t=ra.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 J(e){let t=ia(e);return t?[t[0]/255,t[1]/255,t[2]/255]:null}function Sn(e){let t=e/255;return t<=.04045?t/12.92:((t+.055)/1.055)**2.4}function aa(e){return .2126*Sn(e[0])+.7152*Sn(e[1])+.0722*Sn(e[2])}function ho(e){return aa([e[0]*255,e[1]*255,e[2]*255])}function sa(e){return .2126*e[0]+.7152*e[1]+.0722*e[2]}function pe(e,t,n){return[e[0]+(t[0]-e[0])*n,e[1]+(t[1]-e[1])*n,e[2]+(t[2]-e[2])*n]}function vt(e,t){let n=sa(e);return pe(e,[n,n,n],t)}var Me=["available","held","sold","selected","dimmed"];function Mt(e){let t=Me.indexOf(e);return t<0?0:t}var po={available:[.24,.82,.52],held:[.95,.66,.22],sold:[.34,.39,.45],selected:[.24,.74,1],dimmed:[.28,.32,.37]};function bo(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 wn={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]},Qe={top:[.05,.06,.08],bottom:[.1,.12,.15]};function xe(e,t){return[Math.min(1,e[0]*t),Math.min(1,e[1]*t),Math.min(1,e[2]*t)]}function ca(){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 Vt=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 go.Renderer({canvas:this.canvas,dpr:ca(),alpha:!1,antialias:!1,depth:!0,stencil:!1,powerPreference:"high-performance",webgl:2}),this.gl=this.renderer.gl,this.clearRgb=[Qe.top[0],Qe.top[1],Qe.top[2]],this.gl.clearColor(this.clearRgb[0],this.clearRgb[1],this.clearRgb[2],1),t.appendChild(this.canvas),this.lostHandler=r=>{r.preventDefault(),n.onContextLost()},this.restoredHandler=()=>n.onContextRestored(),this.canvas.addEventListener("webglcontextlost",this.lostHandler,!1),this.canvas.addEventListener("webglcontextrestored",this.restoredHandler,!1),this.resize()}setClearColor(t){this.clearRgb=[t[0],t[1],t[2]],this.gl.clearColor(t[0],t[1],t[2],1)}get clearColor(){return this.clearRgb}resize(){let t=Math.max(1,this.container.clientWidth||this.canvas.clientWidth||1),n=Math.max(1,this.container.clientHeight||this.canvas.clientHeight||1);return this.renderer.setSize(t,n),{width:t,height:n}}get pixelHeight(){return this.renderer.height*this.renderer.dpr}get aspect(){return this.renderer.width/Math.max(1,this.renderer.height)}dispose(){this.canvas.removeEventListener("webglcontextlost",this.lostHandler,!1),this.canvas.removeEventListener("webglcontextrestored",this.restoredHandler,!1);let t=this.gl.getExtension("WEBGL_lose_context");t&&t.loseContext(),this.canvas.parentNode&&this.canvas.parentNode.removeChild(this.canvas)}simulateContextLossCycle(){let t=this.gl.getExtension("WEBGL_lose_context");t&&(t.loseContext(),setTimeout(()=>{t.restoreContext&&t.restoreContext()},300))}};var st=require("ogl"),me=Math.PI/180,Pn=15*me,Cn=80*me,at=.12,yo=35,xo=1.25,Nt=class{constructor(t,n,r,o){this.fovY=yo;this.target=new st.Vec3;this.azimuth=-30*me;this.polar=55*me;this.distance=10;this.azT=-30*me;this.polT=55*me;this.distT=10;this.minDist=1;this.maxDist=100;this.gestureFired=!1;this.interactionEnabled=!0;this.dragging=!1;this.panning=!1;this.lastX=0;this.lastY=0;this.activePointers=new Map;this.pinchDist=0;this.pinchCx=0;this.pinchCy=0;this.targetT=new st.Vec3;this.panAnchor=new st.Vec3;this.panLimit=0;this.primaryDragMode="orbit";this.camera=new st.Camera(t,{fov:yo,near:.1,far:5e3,aspect:1}),this.canvas=n,this.requestRender=r,this.onGesture=o,this.onPointerDown=i=>{if(this.interactionEnabled){try{this.canvas.setPointerCapture?.(i.pointerId)}catch{}if(this.activePointers.set(i.pointerId,{x:i.clientX,y:i.clientY}),this.activePointers.size===1){let a=i.button===2||i.button===1,s=i.button===0&&(i.shiftKey?this.primaryDragMode==="orbit":this.primaryDragMode==="pan");this.panning=a||s,this.dragging=!this.panning,this.lastX=i.clientX,this.lastY=i.clientY}else if(this.activePointers.size===2){this.dragging=!1,this.panning=!1,this.pinchDist=this.currentPinchDistance();let a=this.pinchCentroid();this.pinchCx=a.x,this.pinchCy=a.y}}},this.onPointerMove=i=>{if(!this.interactionEnabled||!this.activePointers.has(i.pointerId))return;if(this.activePointers.set(i.pointerId,{x:i.clientX,y:i.clientY}),this.activePointers.size>=2){let c=this.currentPinchDistance();this.pinchDist>0&&(this.dollyBy(Math.exp((this.pinchDist-c)*.005)),this.fireGesture()),this.pinchDist=c;let l=this.pinchCentroid();this.panBy(l.x-this.pinchCx,l.y-this.pinchCy),this.pinchCx=l.x,this.pinchCy=l.y;return}let a=i.clientX-this.lastX,s=i.clientY-this.lastY;if(this.panning){this.lastX=i.clientX,this.lastY=i.clientY,(a!==0||s!==0)&&(this.panBy(a,s),this.fireGesture());return}this.dragging&&(this.lastX=i.clientX,this.lastY=i.clientY,(a!==0||s!==0)&&this.fireGesture(),this.azT-=a*.006,this.polT=Math.max(Pn,Math.min(Cn,this.polT-s*.006)),this.requestRender())},this.onPointerUp=i=>{this.activePointers.delete(i.pointerId);try{this.canvas.releasePointerCapture?.(i.pointerId)}catch{}this.activePointers.size<2&&(this.pinchDist=0),this.activePointers.size===0&&(this.dragging=!1,this.panning=!1)},this.onContextMenu=i=>{i.preventDefault()},this.onWheel=i=>{if(i.preventDefault(),!this.interactionEnabled)return;let a=i.deltaMode===1?16:i.deltaMode===2?100:1,s=Math.max(-2,Math.min(2,i.deltaY*a/100));this.dollyBy(Math.exp(s*.22)),this.fireGesture()},this.onKeyDown=i=>{if(!this.interactionEnabled)return;let a=7*me;if(i.shiftKey&&(i.key==="ArrowLeft"||i.key==="ArrowRight"||i.key==="ArrowUp"||i.key==="ArrowDown"))this.panBy(i.key==="ArrowLeft"?-32:i.key==="ArrowRight"?32:0,i.key==="ArrowUp"?-32:i.key==="ArrowDown"?32:0);else if(i.key==="ArrowLeft"||i.key==="ArrowRight")this.azT+=i.key==="ArrowLeft"?-a:a;else if(i.key==="ArrowUp"||i.key==="ArrowDown")this.polT=Math.max(Pn,Math.min(Cn,this.polT+(i.key==="ArrowUp"?-a:a)));else if(i.key==="+"||i.key==="=")this.dollyBy(.82);else if(i.key==="-"||i.key==="_")this.dollyBy(1.22);else return;i.preventDefault(),this.fireGesture(),this.requestRender()},n.addEventListener("pointerdown",this.onPointerDown),n.addEventListener("pointermove",this.onPointerMove),n.addEventListener("pointerup",this.onPointerUp),n.addEventListener("pointercancel",this.onPointerUp),n.addEventListener("wheel",this.onWheel,{passive:!1}),n.addEventListener("keydown",this.onKeyDown),n.addEventListener("contextmenu",this.onContextMenu)}pinchCentroid(){let t=[...this.activePointers.values()];if(!t.length)return{x:0,y:0};let n=0,r=0;for(let o of t)n+=o.x,r+=o.y;return{x:n/t.length,y:r/t.length}}panBy(t,n){let r=this.canvas.clientHeight||1,o=2*this.distance*Math.tan(this.fovY*me/2)/r,i=Math.sin(this.azimuth),a=Math.cos(this.azimuth),s=a,c=-i,l=Math.cos(this.polar),f=Math.sin(this.polar),u=-i*l,d=-a*l;this.targetT.x+=(-t*s+n*u)*o,this.targetT.z+=(-t*c+n*d)*o,this.targetT.y+=n*f*o,this.clampPan(),this.requestRender()}clampPan(){if(this.panLimit<=0)return;let t=this.panLimit,n=this.panAnchor.x,r=this.panAnchor.y,o=this.panAnchor.z;this.targetT.x=Math.max(n-t,Math.min(n+t,this.targetT.x)),this.targetT.z=Math.max(o-t,Math.min(o+t,this.targetT.z)),this.targetT.y=Math.max(r-t*.5,Math.min(r+t,this.targetT.y))}fireGesture(){this.gestureFired||(this.gestureFired=!0,this.onGesture?.())}currentPinchDistance(){let t=[...this.activePointers.values()];return t.length<2?0:Math.hypot(t[0].x-t[1].x,t[0].y-t[1].y)}dollyBy(t){this.distT=Math.max(this.minDist,Math.min(this.maxDist,this.distT*t)),this.requestRender()}zoomBy(t){this.interactionEnabled&&(this.dollyBy(t),this.fireGesture())}setPrimaryDragMode(t){this.primaryDragMode=t}setInteractionEnabled(t){this.interactionEnabled=t,!t&&(this.activePointers.clear(),this.dragging=!1,this.panning=!1,this.pinchDist=0)}frame(t,n=!1,r,o=!1,i){this.target.set(t.center[0],t.center[1],t.center[2]),this.targetT.copy(this.target),this.panAnchor.copy(this.target),this.panLimit=Math.max(1,t.radius)*1.5;let a=Math.max(1,t.radius),s=this.fovY*me/2,c=o?Math.max(.82,this.camera.aspect||1):this.camera.aspect||1,l=Math.atan(Math.tan(s)*c);this.azT=r??-30*me,this.polT=Math.max(15,Math.min(80,i?.polarDeg??55))*me;let f=this.fitDistance(t,s,l,this.azT,this.polT);this.distT=f*Math.max(1.05,Math.min(2,i?.margin??xo)),this.minDist=Math.max(2,a*.12),this.maxDist=f*4,n?(this.azimuth=this.azT,this.polar=12*me,this.distance=this.distT*1.7):(this.azimuth=this.azT,this.polar=this.polT,this.distance=this.distT),this.applyPosition()}setAspect(t){this.camera.perspective({aspect:t})}frameSoft(t,n,r=!1,o){this.target.set(t.center[0],t.center[1],t.center[2]),this.targetT.copy(this.target),this.panAnchor.copy(this.target),this.panLimit=Math.max(1,t.radius)*1.5,this.syncFromCamera(),this.camera.perspective({fov:this.fovY,aspect:this.camera.aspect});let i=this.fovY*me/2,a=r?Math.max(.82,this.camera.aspect||1):this.camera.aspect||1,s=Math.atan(Math.tan(i)*a);this.azT=n??this.azimuth,this.polT=Math.max(15,Math.min(80,o?.polarDeg??55))*me;let c=this.fitDistance(t,i,s,this.azT,this.polT);this.distT=c*Math.max(1.05,Math.min(2,o?.margin??xo))}fitDistance(t,n,r,o,i){let a=Math.max(1,t.radius),s=Math.max(a/Math.tan(n),a/Math.tan(r)),c=t.box;if(!c)return s;let l=Math.sin(i),f=-l*Math.sin(o),u=-Math.cos(i),d=-l*Math.cos(o);if(Math.abs(u)>.999)return s;let m=-d,h=f,p=Math.hypot(m,h);m/=p,h/=p;let g=-h*u,b=h*f-m*d,y=m*u,x=Math.tan(r),v=Math.tan(n),C=1;for(let M=0;M<8;M++){let I=(M&1?c.max[0]:c.min[0])-t.center[0],_=(M&2?c.max[1]:c.min[1])-t.center[1],B=(M&4?c.max[2]:c.min[2])-t.center[2],z=I*f+_*u+B*d,V=Math.abs(I*m+B*h),A=Math.abs(I*g+_*b+B*y);C=Math.max(C,V/x-z,A/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*at,this.polar+=n*at,this.distance+=r*at,this.target.x+=o*at,this.target.y+=i*at,this.target.z+=a*at,c&&this.applyPosition(),c}get currentDistance(){return this.distance}syncFromCamera(){let t=this.camera.position.x-this.target.x,n=this.camera.position.y-this.target.y,r=this.camera.position.z-this.target.z,o=Math.hypot(t,n,r)||1,i=Math.max(Pn,Math.min(Cn,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 Gt=class{constructor(t){this.rafId=0;this.running=!1;this.lastTime=0;this.fpsEma=0;this.rendered=0;this.tick=t=>{let n=this.lastTime?(t-this.lastTime)/1e3:.016666666666666666;if(this.lastTime=t,n>0){let o=1/n;this.fpsEma=this.fpsEma?this.fpsEma*.9+o*.1:o}this.rendered++,this.frame(n)?this.rafId=requestAnimationFrame(this.tick):(this.running=!1,this.rafId=0)};this.frame=t}requestRender(){this.running||(this.running=!0,this.lastTime=0,this.rafId=requestAnimationFrame(this.tick))}stats(){return{fps:this.running?Math.round(this.fpsEma):0,rendered:this.rendered,idle:!this.running}}stop(){this.rafId&&cancelAnimationFrame(this.rafId),this.rafId=0,this.running=!1}};var ct=2.5,la=1.15,St=6,lt=10,vo=6,Mo=9.5,So=.9,wo=2.2,In=30,An=4,zt=8192;var wl=lt+An;function Po(e,t){let n=t*1.4,r=t*3.2;if(e<=n)return{scale:1,fade:0,minPixels:ct};let o=Math.min(1,(e-n)/Math.max(.001,r-n));return{scale:1-o*.4,fade:o*.55,minPixels:ct+o*(la-ct)}}function Co(e,t,n){return!(e>0)||!(t>0)||!(n>0)?!1:t*n/e>=64}function Io(e,t,n,r,o){if(!(e>0)||!(t>0)||!(n>0)||!(r>0)||!(o>0))return!1;let i=Math.tan(r/2*Math.PI/180);if(!(i>0))return!1;let a=t/(n*i)*(o/2);return Math.PI*a*a/e>=64}var ua=[{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"}],Cl=new Map(ua.map(e=>[e.key,e]));var da={wheelchair:"#3b82f6",companion:"#8b5cf6","semi-ambulatory":"#0ea5e9","designated-aisle":"#0284c7","step-free":"#16a34a",hearing:"#14b8a6",cart:"#7c3aed","sign-language":"#f59e0b","low-vision":"#d97706","sensory-friendly":"#6366f1","plus-size":"#ec4899","lift-armrest":"#22c55e"};function Ao(e){let t=e?.[0];return t&&da[t]||"#3b82f6"}var ma=[{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"}],Il=new Map(ma.map(e=>[e.key,e]));var fa=["reference-focal","bar","entrance","exit","restroom","screen","sound","concession","coat","wall","rail","suite","obstruction"],Al=new Set(fa);var Eo=[{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}}],ko=Eo.map(e=>e.key),ha=new Map(Eo.map(e=>[e.key,e]));function Ro(e){return typeof e=="string"&&ha.has(e)}function To(e,t){return Ro(e)?e:Ro(t?.seatGlyph)?t.seatGlyph:"circle"}var Re=.02291666666666667,Ge=1/Re,pa=58,ba=pa*Re;var ga=3,Lo=0,Rn=120,ya=0,xa=45,va=7,Ut=1.2;function En(e,t,n,r){return Number.isFinite(e)?Math.max(t,Math.min(n,e)):r}function Ma(e){return!Number.isFinite(e)||!Number.isInteger(e)||e<0?0:e<=va?e:ga}function _o(e,t={}){let n=En(t.floorBaseHeightM,Lo,Rn,0),r=Math.min(Rn,n+Ma(e.elevation)*ba),o=e.height===void 0?r:En(e.height,Lo,Rn,r),i=En(e.rake,ya,xa,0);return{height:o,rake:i}}var Do=it(require("earcut"),1),Oo=it(require("polygon-clipping"),1);var _l=Math.PI/180;function kn(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 wt(e){return e.length?kn(e):null}function Ze(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 Pt(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 O=Re,Sa=.002;function wa(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<Sa}var $e=class{constructor(t=16384){this.len=0;this.buf=new Float32Array(t)}push3(t,n,r){this.len+3>this.buf.length&&this.grow(this.len+3),this.buf[this.len++]=t,this.buf[this.len++]=n,this.buf[this.len++]=r}push1(t){this.len+1>this.buf.length&&this.grow(this.len+1),this.buf[this.len++]=t}grow(t){let n=this.buf.length*2;for(;n<t;)n*=2;let r=new Float32Array(n);r.set(this.buf.subarray(0,this.len)),this.buf=r}get length(){return this.len}toArray(){return this.buf.slice(0,this.len)}},Yt=class{constructor(){this.pos=new $e;this.nor=new $e;this.col=new $e;this.flr=new $e;this.mat=new $e;this.currentFloor=0;this.currentMaterial=0}setFloor(t){this.currentFloor=t}setMaterial(t){this.currentMaterial=t}tri(t,n,r,o,i,a=i,s=i){wa(t,n,r)||(this.pos.push3(t[0],t[1],t[2]),this.pos.push3(n[0],n[1],n[2]),this.pos.push3(r[0],r[1],r[2]),this.nor.push3(o[0],o[1],o[2]),this.nor.push3(o[0],o[1],o[2]),this.nor.push3(o[0],o[1],o[2]),this.col.push3(i[0],i[1],i[2]),this.col.push3(a[0],a[1],a[2]),this.col.push3(s[0],s[1],s[2]),this.flr.push1(this.currentFloor),this.flr.push1(this.currentFloor),this.flr.push1(this.currentFloor),this.mat.push1(this.currentMaterial),this.mat.push1(this.currentMaterial),this.mat.push1(this.currentMaterial))}triN(t,n,r,o,i,a,s,c=s,l=s){[...t,...n,...r].every(Number.isFinite)&&(this.pos.push3(t[0],t[1],t[2]),this.pos.push3(n[0],n[1],n[2]),this.pos.push3(r[0],r[1],r[2]),this.nor.push3(o[0],o[1],o[2]),this.nor.push3(i[0],i[1],i[2]),this.nor.push3(a[0],a[1],a[2]),this.col.push3(s[0],s[1],s[2]),this.col.push3(c[0],c[1],c[2]),this.col.push3(l[0],l[1],l[2]),this.flr.push1(this.currentFloor),this.flr.push1(this.currentFloor),this.flr.push1(this.currentFloor),this.mat.push1(this.currentMaterial),this.mat.push1(this.currentMaterial),this.mat.push1(this.currentMaterial))}get vertexCount(){return this.pos.length/3}build(){return{position:this.pos.toArray(),normal:this.nor.toArray(),color:this.col.toArray(),floor:this.flr.toArray(),material:this.mat.toArray(),count:this.pos.length/3}}};function Pa(e,t,n){let r=t[0]-e[0],o=t[1]-e[1],i=t[2]-e[2],a=n[0]-e[0],s=n[1]-e[1],c=n[2]-e[2],l=o*c-i*s,f=i*a-r*c,u=r*s-o*a,d=Math.hypot(l,f,u)||1;return l/=d,f/=d,u/=d,[l,f,u]}function Ca(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,Do.default)(r,o.length?o:void 0,2);return{pts:n,tris:i}}function Tn(e){return Ze(e)<0?[...e].reverse():e}var Ia=3;function Aa(e,t,n,r){let o=r(e),i=r(t),a=r(n),s=(m,h,p,g)=>Math.abs(r({x:(m.x+h.x)/2,y:(m.y+h.y)/2})-(p+g)/2),c=(e.x+t.x+n.x)/3,l=(e.y+t.y+n.y)/3,f=(o+i+a)/3,u=Math.max(s(e,t,o,i),s(t,n,i,a),s(n,e,a,o),Math.abs(r({x:c,y:l})-f)),d=(m,h,p)=>{let g=Math.abs(r({x:(m+c)/2,y:(h+l)/2})-(p+f)/2);g>u&&(u=g)};return d((e.x+t.x)/2,(e.y+t.y)/2,(o+i)/2),d((t.x+n.x)/2,(t.y+n.y)/2,(i+a)/2),d((n.x+e.x)/2,(n.y+e.y)/2,(a+o)/2),u}function Ct(e,t,n,r,o){if(o<=0)return Aa(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(Ct(e,i,s,r,o-1),Ct(i,t,a,r,o-1),Ct(s,a,n,r,o-1),Ct(i,a,s,r,o-1))}function It(e,t,n,r,o,i,a,s){if(a>0){let d={x:(t.x+n.x)/2,y:(t.y+n.y)/2},m={x:(n.x+r.x)/2,y:(n.y+r.y)/2},h={x:(r.x+t.x)/2,y:(r.y+t.y)/2};It(e,t,d,h,o,i,a-1,s),It(e,d,n,m,o,i,a-1,s),It(e,h,m,r,o,i,a-1,s),It(e,d,m,h,o,i,a-1,s);return}let c=[t.x*O,o(t),t.y*O],l=[n.x*O,o(n),n.y*O],f=[r.x*O,o(r),r.y*O];if(s){e.triN(c,l,f,s(t),s(n),s(r),i);return}let u=Pa(c,l,f);u[1]<0&&(u=[-u[0],-u[1],-u[2]]),e.tri(c,l,f,u,i)}var Ra=8;function Fo(e,t,n){if(!Number.isFinite(n))return e;let r=[],o=(i,a,s,c,l)=>{if(l>0){let f={x:(i.x+a.x)/2,y:(i.y+a.y)/2},u=t(f);if(Math.abs(u-(s+c)/2)>n){o(i,f,s,u,l-1),o(f,a,u,c,l-1);return}}r.push(i)};for(let i=0;i<e.length;i++){let a=e[i],s=e[(i+1)%e.length];o(a,s,t(a),t(s),Ra)}return r}function Ht(e,t){if(e.length<3)return e;let n=[];for(let o of e){let i=n[n.length-1];i&&Math.hypot(o.x-i.x,o.y-i.y)<t||n.push(o)}for(;n.length>2&&Math.hypot(n[0].x-n[n.length-1].x,n[0].y-n[n.length-1].y)<t;)n.pop();if(n.length<3)return e;let r=[];for(let o=0;o<n.length;o++){let i=r.length?r[r.length-1]:n[(o-1+n.length)%n.length],a=n[o],s=n[(o+1)%n.length],c=s.x-i.x,l=s.y-i.y,f=Math.hypot(c,l);f>t&&Math.abs((a.x-i.x)*l-(a.y-i.y)*c)/f<t||r.push(a)}return r.length>=3?r:n}var jt=.001*Ge*.1;function ce(e,t,n,r,o,i,a,s,c=1/0,l){if(!t||t.length<3||(c===void 0&&(c=1/0),Math.abs(Ze(t))<1e-4))return;let f=Ht(Fo(Ht(Tn(t),jt),r,c),jt),u=n?.map(M=>Ht(Fo(Ht(Tn(M),jt),r,c),jt)).filter(M=>M.length>=3&&Math.abs(Ze(M))>=1e-4),{pts:d,tris:m}=Ca(f,u),h=[i[0]*s.top,i[1]*s.top,i[2]*s.top],p=[i[0]*s.bottomCap,i[1]*s.bottomCap,i[2]*s.bottomCap],g=[a[0]*s.top,a[1]*s.top,a[2]*s.top],b=[a[0]*s.wallBottom,a[1]*s.wallBottom,a[2]*s.wallBottom],y=0;if(Number.isFinite(c))for(;y<Ia;y++){let M=0;for(let I=0;I<m.length;I+=3){let _=Ct(d[m[I]],d[m[I+1]],d[m[I+2]],r,y);_>M&&(M=_)}if(M<=c)break}for(let M=0;M<m.length;M+=3){let I=d[m[M]],_=d[m[M+1]],B=d[m[M+2]];It(e,I,_,B,r,h,y,l);let z=[I.x*O,o,I.y*O],V=[_.x*O,o,_.y*O],A=[B.x*O,o,B.y*O];e.tri(z,A,V,[0,-1,0],p)}let x=M=>{if(y<=0)return M;let I=1<<y,_=[];for(let B=0;B<M.length;B++){let z=M[B],V=M[(B+1)%M.length];for(let A=0;A<I;A++){let S=A/I;_.push({x:z.x+(V.x-z.x)*S,y:z.y+(V.y-z.y)*S})}}return _},v=kn(f),C=[{ring:x(f),flip:!1}];if(u)for(let M of u)M.length>=3&&C.push({ring:x(M),flip:!0});for(let{ring:M,flip:I}of C)for(let _=0;_<M.length;_++){let B=M[_],z=M[(_+1)%M.length],V=(z.x-B.x)*O,S=(z.y-B.y)*O,R=-V,w=Math.hypot(S,R)||1;S/=w,R/=w;let P=(B.x+z.x)/2-v.x,G=(B.y+z.y)/2-v.y,k=S*P+R*G;I&&(k=-k),k<0&&(S=-S,R=-R);let E=[S,0,R],F=[B.x*O,r(B),B.y*O],D=[z.x*O,r(z),z.y*O],N=[B.x*O,o,B.y*O],j=[z.x*O,o,z.y*O];e.tri(F,D,j,E,g,g,b),e.tri(F,j,N,E,g,b,b)}}function Bo(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 Xt(e,t,n=2.5){if(t<=0||e.length<3)return e;let r=Tn(e),o=r.length,i=[];for(let s=0;s<o;s++){let c=r[s],l=r[(s+1)%o],f=l.x-c.x,u=l.y-c.y,d=Math.hypot(f,u)||1;i.push({x:u/d,y:-f/d})}let a=[];for(let s=0;s<o;s++){let c=r[s],l=i[(s-1+o)%o],f=i[s],u=l.x+f.x,d=l.y+f.y,m=Math.hypot(u,d),h=()=>{a.push([c.x+l.x*t,c.y+l.y*t]),a.push([c.x+f.x*t,c.y+f.y*t])};if(m<1e-9){h();continue}u/=m,d/=m;let p=u*l.x+d*l.y,g=1/Math.max(p,1e-6);if(!Number.isFinite(g)||g>n){h();continue}a.push([c.x+u*t*g,c.y+d*t*g])}if(a.length<3)return e;try{let s=Oo.default.union([[...a,a[0]]]),c=null,l=-1/0;for(let u of s){let d=Math.abs(Ze(u[0].map(([m,h])=>({x:m,y:h}))));d>l&&(l=d,c=u[0])}if(!c)return e;let f=c.map(([u,d])=>({x:u,y:d}));if(f.length>1){let u=f[0],d=f[f.length-1];Math.abs(u.x-d.x)<1e-9&&Math.abs(u.y-d.y)<1e-9&&f.pop()}return f.length>=3?f:e}catch{return e}}function Wt(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 At(e,t,n,r){return[{x:e,y:t},{x:e+n,y:t},{x:e+n,y:t+r},{x:e,y:t+r}]}var ie={pedestal:0,pad:1,back:2,arm:3,footrest:4,leg:5,body:10,head:11},Ea=.44,ka=.15,Ta=.3,La=.24;function Vo(e){return e===void 0||!Number.isFinite(e)||e<=0?La:Math.min(Ta,Math.max(ka,e*Ea))}var Ln=.21,_a=.05,_n=.45,Kt=_n+_a,Fa=[{part:ie.pedestal,min:[-.3,0,-.3],max:[.3,.36,.3]},{part:ie.pad,min:[-1,.36,-.95],max:[1,_n,1]},{part:ie.back,min:[-1,Kt,-1],max:[1,.92,-.72]},{part:ie.arm,min:[-1,.44,-.82],max:[-.78,.65,.78]},{part:ie.arm,min:[.78,.44,-.82],max:[1,.65,.78]},{part:ie.footrest,min:[-.9,.18,.78],max:[.9,.31,1.34]},{part:ie.leg,min:[-.82,0,-.7],max:[-.62,.37,-.48]},{part:ie.leg,min:[.62,0,-.7],max:[.82,.37,-.48]},{part:ie.leg,min:[-.82,0,.48],max:[-.62,.37,.7]},{part:ie.leg,min:[.62,0,.48],max:[.82,.37,.7]}],Da=[{part:ie.body,min:[-.52,.39,-.08],max:[-.08,.55,.82]},{part:ie.body,min:[.08,.39,-.08],max:[.52,.55,.82]},{part:ie.body,min:[-.47,.05,.58],max:[-.13,.43,.82]},{part:ie.body,min:[.13,.05,.58],max:[.47,.43,.82]},{part:ie.head,min:[-.16,1.04,-.33],max:[.16,1.1,-.13]}],Oa=[{n:[1,0,0],c:[[1,0,0],[1,1,0],[1,1,1],[1,0,1]]},{n:[-1,0,0],c:[[0,0,1],[0,1,1],[0,1,0],[0,0,0]]},{n:[0,1,0],c:[[0,1,0],[0,1,1],[1,1,1],[1,1,0]]},{n:[0,-1,0],c:[[0,0,1],[0,0,0],[1,0,0],[1,0,1]]},{n:[0,0,1],c:[[0,0,1],[1,0,1],[1,1,1],[0,1,1]]},{n:[0,0,-1],c:[[1,0,0],[0,0,0],[0,1,0],[1,1,0]]}];function No(){let e=[],t=[],n=[],r=[],o=(w,P,G)=>{let k=n.length,[E,F,D]=w,N=[F[0]-E[0],F[1]-E[1],F[2]-E[2]],j=[D[0]-E[0],D[1]-E[1],D[2]-E[2]],U=N[1]*j[2]-N[2]*j[1],T=N[2]*j[0]-N[0]*j[2],L=N[0]*j[1]-N[1]*j[0],H=Math.hypot(U,T,L);H>1e-9?(U/=H,T/=H,L/=H):[U,T,L]=P,U*P[0]+T*P[1]+L*P[2]<0&&(U=-U,T=-T,L=-L);for(let W of w)e.push(...W),t.push(U,T,L),n.push(G);r.push(k,k+1,k+2,k,k+2,k+3)},i=w=>{for(let P of Oa){let G=P.c.map(k=>k.map((E,F)=>E?w.max[F]:w.min[F]));o(G,P.n,w.part)}};for(let w of Fa)i(w);for(let w of Da)i(w);let a=_n,s=1.08,c=.47,l=.69,f=-.55,u=.08,d=-.48,m=.01,h=[-c,a,f],p=[c,a,f],g=[-c,a,u],b=[c,a,u],y=[-l,s,d],x=[l,s,d],v=[-l,s,m],C=[l,s,m];o([p,x,C,b],[1,0,0],ie.body),o([g,v,y,h],[-1,0,0],ie.body),o([v,C,x,y],[0,1,0],ie.body),o([h,p,b,g],[0,-1,0],ie.body),o([b,C,v,g],[0,0,1],ie.body),o([h,y,x,p],[0,0,-1],ie.body);let M=10,I=8,_=[0,1.205,-.23],B=[.42,.115,.38],z=n.length;for(let w=0;w<=I;w++){let P=Math.PI*w/I,G=Math.cos(P),k=Math.sin(P);for(let E=0;E<=M;E++){let F=Math.PI*2*E/M,D=k*Math.cos(F),N=k*Math.sin(F);e.push(_[0]+B[0]*D,_[1]+B[1]*G,_[2]+B[2]*N);let j=D/B[0],U=G/B[1],T=N/B[2],L=Math.hypot(j,U,T)||1;j/=L,U/=L,T/=L,t.push(j,U,T),n.push(ie.head)}}for(let w=0;w<I;w++)for(let P=0;P<M;P++){let G=z+w*(M+1)+P,k=G+M+1;r.push(G,k,G+1,G+1,k,k+1)}let V=new Float32Array(e),A=new Float32Array(t),S=new Float32Array(n),R=new Uint16Array(r);return{position:V,normal:A,part:S,index:R,vertexCount:n.length,indexCount:r.length}}function Go(e,t,n,r){let o=new Float32Array(t),i=l=>e[l*3],a=l=>e[l*3+2],s=0,c=(l,f)=>{let u=f-l;for(let d=l;d<f;d++){let[m,h]=r(d),p=m-i(d),g=h-a(d);if(u>=2){let b=Math.max(l,d-1),y=Math.min(f-1,d+1),x=i(y)-i(b),v=a(y)-a(b),C=Math.hypot(x,v);if(C>1e-6){let M=-v/C,I=x/C;M*p+I*g<0&&(M=-M,I=-I),p=M,g=I}}o[d]=p===0&&g===0?0:Math.atan2(p,g)}};for(let l=1;l<=t;l++)(l===t||n(l)!==n(s))&&(c(s,l),s=l);return o}var Le=.22;function zo(e,t){let n=Me[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 Ba=.42;function Va(e){let t=e.length,n=new Float64Array(t);if(t<2)return n.fill(1/0),n;let r=1/0,o=1/0,i=-1/0,a=-1/0;for(let h of e)h.x<r&&(r=h.x),h.y<o&&(o=h.y),h.x>i&&(i=h.x),h.y>a&&(a=h.y);let s=Math.max(i-r,1e-6),c=Math.max(a-o,1e-6),l=Math.max(Math.sqrt(s*c/t),1e-6),f=Math.max(1,Math.ceil(s/l)+1),u=Math.max(1,Math.ceil(c/l)+1),d=new Map,m=(h,p)=>{let g=Math.min(f-1,Math.max(0,Math.floor((h-r)/l)));return Math.min(u-1,Math.max(0,Math.floor((p-o)/l)))*f+g};for(let h=0;h<t;h++){let p=m(e[h].x,e[h].y),g=d.get(p);g?g.push(h):d.set(p,[h])}for(let h=0;h<t;h++){let p=e[h],g=Math.min(f-1,Math.max(0,Math.floor((p.x-r)/l))),b=Math.min(u-1,Math.max(0,Math.floor((p.y-o)/l))),y=1/0;for(let x=1;x<=4;x++){for(let v=b-x;v<=b+x;v++)if(!(v<0||v>=u))for(let C=g-x;C<=g+x;C++){if(C<0||C>=f||x>1&&Math.abs(v-b)<x&&Math.abs(C-g)<x)continue;let M=d.get(v*f+C);if(M)for(let I of M){if(I===h)continue;let _=Math.hypot(e[I].x-p.x,e[I].y-p.y);_<y&&(y=_)}}if(Number.isFinite(y)&&y<=x*l)break}n[h]=y}return n}function Na(e){let t=e.eyeHeightM;return Number.isFinite(t)?Math.max(0,t-Ut):0}function Uo(e,t,n,r,o,i){let a=e.length,s=new Float32Array(a*3),c=new Float32Array(a),l=new Float32Array(a*3),f=new Float32Array(a),u=new Float32Array(a),d=new Float32Array(a),m=new Float32Array(a),h=new Float32Array(a*3),p=new Map,g=Va(e);for(let b=0;b<a;b++){let y=e[b],v=(n?.seatPitchU(b)??g[b])*O;f[b]=Number.isFinite(v)?Math.max(.06,Math.min(Le,v*Ba)):Le,u[b]=Vo(Number.isFinite(v)?v:void 0);let C=To(y.glyph,{seatGlyph:i?.get(y.categoryKey)});d[b]=ko.indexOf(C),m[b]=y.wheelchairSpaceType==="no-seat"?0:1,s[b*3]=y.x*O,s[b*3+1]=n?n.seatDeckY(b):Na(y),s[b*3+2]=y.y*O,c[b]=Mt(t?t(y):"available");let M=J(o?.get(y.categoryKey)??"#6e7bff")??[.43,.48,1];if(l[b*3]=M[0],l[b*3+1]=M[1],l[b*3+2]=M[2],y.accessibility?.length){let I=J(Ao(y.accessibility));I&&(h[b*3]=I[0],h[b*3+1]=I[1],h[b*3+2]=I[2])}p.set(y.id,b)}return{count:a,iPosition:s,iState:c,iCategory:l,iMaxRadius:f,iRing:h,idToIndex:p,iChairWidth:u,iGlyph:d,iPhysicalSeat:m,iFloor:r??new Float32Array(a),iYaw:new Float32Array(a)}}var Ga=64;function Fn(e,t){let n=[];for(let a of t){let s=e.idToIndex.get(a.seatId);if(s===void 0)continue;let c=Mt(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+Ga){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 za=.15,Ua=.9,Ha=1.76,ja=.7,Ya=1.6;function Xa(){return{background:{top:[...Qe.top],bottom:[...Qe.bottom]},structure:wn,seatStates:{...po},seatScale:1,materials:{seat:null,shell:null,roughness:.78}}}function Ho(e){let t=Xa();if(!e)return t;let n=J(e.background);if(n){t.background={top:xe(n,Ua),bottom:xe(n,Ha)};let a={};for(let[s,c]of Object.entries(wn))a[s]=pe(c,n,za);t.structure=a}let r=J(e.selectionColor)??J(e.accent);r&&(t.seatStates={...t.seatStates,selected:r});let o=e.seatScale;typeof o=="number"&&Number.isFinite(o)&&(t.seatScale=Math.min(Ya,Math.max(ja,o)));let i=e.venue3d;if(i){let a=J(i.deck),s=J(i.fascia);a&&(t.structure={...t.structure,tierTop:a,gaTop:a}),s&&(t.structure={...t.structure,tierWall:s,gaWall:s}),t.materials.seat=J(i.seat),t.materials.shell=J(i.shell),typeof i.roughness=="number"&&Number.isFinite(i.roughness)&&(t.materials.roughness=Math.min(1,Math.max(0,i.roughness)))}return t}function jo(e,t){let n=[];for(let r of t)n.push(...e.seatStates[r]);return n}function Yo(e){let t=e.length;return t<=3?[...e]:[e[Math.floor(t*.25)],e[Math.floor(t*.5)],e[Math.floor(t*.75)]]}function ut(e,t,n){if(!e.length)return 1/0;if(e.length===1)return Math.hypot(t-e[0].x,n-e[0].y);let r=1/0;for(let o=0;o+1<e.length;o++){let i=e[o],a=e[o+1],s=a.x-i.x,c=a.y-i.y,l=s*s+c*c,f=l>1e-12?((t-i.x)*s+(n-i.y)*c)/l:0;f<0?f=0:f>1&&(f=1);let u=Math.hypot(t-(i.x+f*s),n-(i.y+f*c));u<r&&(r=u)}return r}function Wa(e){let t=0,n=0;for(let i of e)t+=i.x,n+=i.y;let r=e.length||1;t/=r,n/=r;let o=0;for(let i of e){let a=Math.hypot(i.x-t,i.y-n);a>o&&(o=a)}return{cx:t,cy:n,r:o}}function Xo(e,t){return Math.hypot(e.cx-t.cx,e.cy-t.cy)-e.r-t.r}function Dn(e,t){let n=1/0;for(let r of Yo(e)){let o=ut(t,r.x,r.y);o<n&&(n=o)}for(let r of Yo(t)){let o=ut(e,r.x,r.y);o<n&&(n=o)}return n}function Ka(e,t){if(e.length<3)return{pts:e,seatIndices:t};let n=0,r=0;for(let f of e)n+=f.x,r+=f.y;n/=e.length,r/=e.length;let o=-1,i=e[0];for(let f of e){let u=Math.hypot(f.x-n,f.y-r);u>o&&(o=u,i=f)}let a=i.x-n,s=i.y-r,c=Math.hypot(a,s);c>1e-9?(a/=c,s/=c):(a=1,s=0);let l=e.map((f,u)=>({p:f,i:u,t:(f.x-n)*a+(f.y-r)*s})).sort((f,u)=>f.t-u.t);return{pts:l.map(f=>f.p),seatIndices:l.map(f=>t[f.i])}}function On(e){let t=e.length;if(t<3)return null;let n=0,r=0;for(let y of e)n+=y.x,r+=y.y;n/=t,r/=t;let o=0,i=0,a=0,s=0,c=0,l=0,f=0;for(let y of e){let x=y.x-n,v=y.y-r;o+=x*x,a+=v*v,i+=x*v,s+=x*x*x,c+=v*v*v,l+=x*v*v,f+=v*x*x}let u=o*a-i*i;if(Math.abs(u)<1e-9)return null;let d=(s+l)/2,m=(c+f)/2,h=(d*a-m*i)/u,p=(m*o-d*i)/u,g=h+n,b=p+r;return!Number.isFinite(g)||!Number.isFinite(b)?null:{cx:g,cy:b}}var qa=.15;function Qa(e){if(e.length<2)return null;let t=e.map(y=>{let x=0,v=0;for(let C of y.pts)x+=C.x,v+=C.y;return{x:x/y.pts.length,y:v/y.pts.length}}),n=0,r=0;for(let y of t)n+=y.x,r+=y.y;n/=t.length,r/=t.length;let o=0,i=0,a=0;for(let y of t){let x=y.x-n,v=y.y-r;o+=x*x,i+=x*v,a+=v*v}let s=o+a,c=o*a-i*i,l=s/2+Math.sqrt(Math.max(0,s*s/4-c)),f,u;Math.abs(i)>1e-12?(f=l-a,u=i):o>=a?(f=1,u=0):(f=0,u=1);let d=Math.hypot(f,u);if(!(d>1e-12))return null;f/=d,u/=d;let m=1/0,h=-1/0,p=[];for(let y of e){let x=1/0,v=-1/0;for(let C of y.pts){let M=C.x*f+C.y*u;M<x&&(x=M),M>v&&(v=M),M<m&&(m=M),M>h&&(h=M)}p.push(v-x)}let g=h-m;return g>1e-9?(p.sort((y,x)=>y-x),p[Math.min(p.length-1,Math.floor(p.length*.9))]/g<=Za?{x:f,y:u}:null):null}var Za=.35;function Wo(e,t,n,r){let o=new Map;for(let g of n){let b=t[g],y=b.rowId||`__seat-${g}`,x=o.get(y);x||(x={pts:[],idx:[]},o.set(y,x)),x.pts.push({x:b.x,y:b.y}),x.idx.push(g)}if(!o.size)return{sectionId:e,rows:[],blockCount:0};let i=[];for(let[g,b]of o){let y=Ka(b.pts,b.idx),x=0;for(let v of y.pts)x+=Math.hypot(v.x-r.x,v.y-r.y);i.push({id:g,pts:y.pts,seatIndices:y.seatIndices,blockId:-1,ordinal:0,blockDepth:0,focalDistance:x/y.pts.length})}let a=i.map(g=>Wa(g.pts)),s=[];for(let g=0;g<i.length;g++){let b=1/0;for(let y=0;y<i.length;y++){if(g===y||Xo(a[g],a[y])>=b)continue;let x=Dn(i[g].pts,i[y].pts);x<b&&(b=x)}Number.isFinite(b)&&s.push(b)}s.sort((g,b)=>g-b);let c=s.length?s[Math.floor(s.length/2)]:1,l=Math.max(c*1.8,1e-6),f=i.map(()=>[]);for(let g=0;g<i.length;g++)for(let b=g+1;b<i.length;b++)Xo(a[g],a[b])>l||Dn(i[g].pts,i[b].pts)<=l&&(f[g].push(b),f[b].push(g));let u=0;for(let g=0;g<i.length;g++){if(i[g].blockId!==-1)continue;let b=u++,y=[g];for(i[g].blockId=b;y.length;){let x=y.pop();for(let v of f[x])i[v].blockId===-1&&(i[v].blockId=b,y.push(v))}}let d=new Map;for(let g of i){let b=d.get(g.blockId)??[];b.push(g),d.set(g.blockId,b)}let m=[];for(let g of i){if(g.pts.length<4)continue;let b=On(g.pts);b&&(!Number.isFinite(b.cx)||!Number.isFinite(b.cy)||m.push({x:b.cx,y:b.cy}))}let h=m.length>=2?(()=>{let g=m.map(x=>x.x).sort((x,v)=>x-v),b=m.map(x=>x.y).sort((x,v)=>x-v),y=Math.floor(m.length/2);return{cx:g[y],cy:b[y]}})():null;if(h){let g=M=>Math.hypot(M.x-h.cx,M.y-h.cy),b=1/0,y=-1/0,x=[];for(let M of i){let I=1/0,_=-1/0;for(let B of M.pts){let z=g(B);z<I&&(I=z),z>_&&(_=z)}x.push(_-I),I<b&&(b=I),_>y&&(y=_)}let v=y-b;x.sort((M,I)=>M-I);let C=x[Math.min(x.length-1,Math.floor(x.length*.9))];if(v>1e-9&&C/v<=qa){let M=i.map(P=>{let G=0;for(let k of P.pts)G+=g(k);return{row:P,radius:G/P.pts.length}}),I=0,_=0;for(let P of M)I+=P.radius,_+=P.row.focalDistance;I/=M.length,_/=M.length;let B=0;for(let P of M)B+=(P.radius-I)*(P.row.focalDistance-_);if(B<0)for(let P of M)P.radius=-P.radius;let V=1/0;for(let P of M)P.radius<V&&(V=P.radius);M.sort((P,G)=>P.radius-G.radius);let A=-1,S=-1/0,R=v/Math.max(1,M.length)*.5,w=[];for(let P of M)P.radius-S>R&&(A++,S=P.radius),P.row.ordinal=A,P.row.blockDepth=P.radius-V,w.push(P.row);return{sectionId:e,rows:w,blockCount:u}}}let p=[];for(let[,g]of d){let b=Qa(g);if(b){let y=v=>{let C=0;for(let M of v.pts)C+=M.x*b.x+M.y*b.y;return C/v.pts.length};g.sort((v,C)=>y(v)-y(C)),g.length>=2&&g[0].focalDistance>g[g.length-1].focalDistance&&g.reverse();let x=0;for(let v=0;v<g.length;v++)v>0&&(x+=Dn(g[v-1].pts,g[v].pts)),g[v].ordinal=v,g[v].blockDepth=x,p.push(g[v])}else{let y=1/0;for(let x of g)x.focalDistance<y&&(y=x.focalDistance);g.sort((x,v)=>x.focalDistance-v.focalDistance);for(let x=0;x<g.length;x++)g[x].ordinal=x,g[x].blockDepth=Math.max(0,g[x].focalDistance-y),p.push(g[x])}}return{sectionId:e,rows:p,blockCount:u}}var $l=Math.PI/180;function Ko(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 $a(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 Bn(e,t,n){return Ko(e,t)&&!(n??[]).some(r=>Ko(e,r)||$a(e,r))}function Ja(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 es(e,t){if(!e.length)return null;let n=0,r=0,o=0;for(let m of e)n+=m.x,r+=m.y,o+=Math.hypot(m.x-t.x,m.y-t.y);let i=e.length;n/=i,r/=i,o/=i;let a=e[0],s=-1;for(let m of e){let h=Math.hypot(m.x-n,m.y-r);h>s&&(s=h,a=m)}let c=a.x-n,l=a.y-r,f=Math.hypot(c,l);f>1e-9?(c/=f,l/=f):(c=1,l=0);let u=[...e].sort((m,h)=>(m.x-n)*c+(m.y-r)*l-((h.x-n)*c+(h.y-r)*l)),d=0;for(let m of u){let h=Math.hypot(m.x-n,m.y-r);h>d&&(d=h)}return{pts:u,cx:n,cy:r,radius:d,depth:o}}function qo(e,t,n){let r=e.pts;if(r.length===1)return Math.hypot(t-r[0].x,n-r[0].y);let o=1/0;for(let i=0;i+1<r.length;i++){let a=r[i],s=r[i+1],c=s.x-a.x,l=s.y-a.y,f=c*c+l*l,u=f>1e-12?((t-a.x)*c+(n-a.y)*l)/f:0;u<0?u=0:u>1&&(u=1);let d=Math.hypot(t-(a.x+u*c),n-(a.y+u*l));d<o&&(o=d)}return o}var qt=8;function ts(e,t,n){let r=new Array(qt).fill(1/0),o=new Array(qt).fill(-1);for(let f=0;f<e.length;f++){let u=e[f],d=Math.hypot(t-u.cx,n-u.cy)-u.radius;for(let m=0;m<qt;m++)if(d<r[m]){for(let h=qt-1;h>m;h--)r[h]=r[h-1],o[h]=o[h-1];r[m]=d,o[m]=f;break}}let i=new Array(3).fill(1/0),a=new Array(3).fill(-1);for(let f of o){if(f<0)continue;let u=qo(e[f],t,n);for(let d=0;d<3;d++)if(u<i[d]){for(let m=2;m>d;m--)i[m]=i[m-1],a[m]=a[m-1];i[d]=u,a[d]=f;break}}if(a[0]<0)return 0;if(i[0]<1e-6)return e[a[0]].depth;let s=i[0]*2.2,c=0,l=0;for(let f=0;f<3;f++){let u=a[f];if(u<0||i[f]>s)continue;let d=1/(i[f]*i[f]);c+=d*e[u].depth,l+=d}return l>0?c/l:e[a[0]].depth}function ns(e){let t=(r,o)=>ts(e,r,o),n=(r,o)=>{let i=1/0,a=-1;for(let s=0;s<e.length;s++){let c=e[s];if(Math.hypot(r-c.cx,o-c.cy)-c.radius>=i)continue;let l=qo(c,r,o);l<i&&(i=l,a=s)}return a};return{kind:"rows",rowCount:e.length,rows:e,nearestRow:n,depthAt:t,gradientAt:(r,o)=>{let i=(t(r+.5,o)-t(r-.5,o))/1,a=(t(r,o+.5)-t(r,o-.5))/(2*.5),s=Math.hypot(i,a);return s<1e-9?[0,0]:[i/s,a/s]}}}function Qo(e,t){let n=[];for(let r of e){let o=es(r.points,t);o&&n.push(o)}return n.length<2?Ja(t):(n.sort((r,o)=>r.depth-o.depth),ns(n))}var Gn=it(require("polygon-clipping"),1);var er=it(require("earcut"),1);var os=.58,Zo=.01,ve=Le*1.5*Ge,rs=.5,is=.6;function as(e,t){let n=e.length,r=[];for(let a=0;a<n;a++){let s=e[Math.max(0,a-1)],c=e[Math.min(n-1,a+1)],l=c.x-s.x,f=c.y-s.y,u=Math.hypot(l,f);if(u<1e-9){r.push([0,0]);continue}l/=u,f/=u,r.push([-f,l])}let o=0;for(let a=0;a<n;a++)o+=(e[a].x-t.x)*r[a][0]+(e[a].y-t.y)*r[a][1];return o<0?r.map(([a,s])=>[-a,-s]):r}function ss(e,t){if(e.length<2||t<=0)return[...e];let n=[...e],r=(a,s)=>{let c=s.x-a.x,l=s.y-a.y,f=Math.hypot(c,l)||1;return{x:c/f,y:l/f}},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 $o=Math.PI/12;function cs(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 tr(e,t){if(!e.length||!(t>0))return[];let n=cs(e),r=(s,c,l,f)=>{let u=l-c;for(;u<0;)u+=Math.PI*2;for(;u>Math.PI*2;)u-=Math.PI*2;let d=Math.max(1,Math.ceil(u/$o)),m=t/Math.cos(u/d/2);for(let h=0;h<=d;h++){let p=c+u*h/d;f.push({x:s.x+Math.cos(p)*m,y:s.y+Math.sin(p)*m})}};if(n.length<3){let s=0,c=0;for(let m of n)s+=m.x,c+=m.y;s/=n.length||1,c/=n.length||1;let l=0;for(let m of n)l=Math.max(l,Math.hypot(m.x-s,m.y-c));let f=[],u=Math.max(3,Math.ceil(Math.PI*2/$o)),d=(l+t)/Math.cos(Math.PI/u);for(let m=0;m<u;m++){let h=m/u*Math.PI*2;f.push({x:s+Math.cos(h)*d,y:c+Math.sin(h)*d})}return f}let o=n.length,i=[];for(let s=0;s<o;s++){let c=n[s],l=n[(s+1)%o];i.push(Math.atan2(-(l.x-c.x),l.y-c.y))}let a=[];for(let s=0;s<o;s++)r(n[s],i[(s+o-1)%o],i[s],a);return ar(a)}function ls(e,t,n){if(e.length===1)return Math.hypot(t-e[0].x,n-e[0].y);let r=1/0;for(let o=0;o+1<e.length;o++){let i=e[o],a=e[o+1],s=a.x-i.x,c=a.y-i.y,l=s*s+c*c,f=l>1e-12?((t-i.x)*s+(n-i.y)*c)/l:0;f<0?f=0:f>1&&(f=1);let u=Math.hypot(t-(i.x+f*s),n-(i.y+f*c));u<r&&(r=u)}return r}function Qt(e){let t=e.map(o=>{let i=0,a=0;for(let l of o.pts)i+=l.x,a+=l.y;let s=o.pts.length||1;i/=s,a/=s;let c=0;for(let l of o.pts){let f=Math.hypot(l.x-i,l.y-a);f>c&&(c=f)}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 f of i){let u=1/0;for(let d=0;d<e.length;d++){if(d===o||Math.abs(e[d].y-e[o].y)<.001)continue;let m=t[d],h=Math.hypot(f.x-m.cx,f.y-m.cy)-m.rad;if(h>=u&&h>=s)continue;let p=ls(e[d].pts,f.x,f.y);p<u&&(u=p),e[d].depth<e[o].depth&&p<s&&(s=p,c=e[d].y)}Number.isFinite(u)&&u>0&&a.push(u)}a.sort((f,u)=>f-u);let l=a.length?a[Math.floor(a.length/2)]:1;r.push({pitch:l,belowY:c})}return r}function nr(e,t,n,r){let o=e[t],i=o.pts.length>=2?[...o.pts]:o.pts.length===1?(()=>{let f=o.pts[0],u=f.x-r.x,d=f.y-r.y,m=Math.hypot(u,d)||1;u/=m,d/=m;let h=Math.max(n[t].pitch,.001)*.5;return[{x:f.x+d*h,y:f.y-u*h},{x:f.x-d*h,y:f.y+u*h}]})():[];if(i.length<2)return null;let a=0,s=0;for(let f=1;f<i.length;f++){let u=Math.hypot(i[f].x-i[f-1].x,i[f].y-i[f-1].y);u>1e-6&&(a+=u,s++)}let c=s>0?a/s:0,l=ss(i,Math.max(c*is,ve));return{pts:l,nrm:as(l,r),front:Math.max(n[t].pitch*os,ve),back:Math.max(n[t].pitch*rs,ve)}}var dt=1.5,or=.3;function Vn(e,t){if(e.length<3)return e;let n=e[0],r=e[e.length-1],o=r.x-n.x,i=r.y-n.y,a=Math.hypot(o,i),s=-1,c=-1;for(let u=1;u<e.length-1;u++){let d=e[u],m=a>1e-12?Math.abs((d.x-n.x)*i-(d.y-n.y)*o)/a:Math.hypot(d.x-n.x,d.y-n.y);m>s&&(s=m,c=u)}if(s<=t||c<0)return[n,r];let l=Vn(e.slice(0,c+1),t),f=Vn(e.slice(c),t);return[...l.slice(0,-1),...f]}function rr(e,t){if(e.length<4)return e;let n=Vn([...e,e[0]],t);return n.pop(),n.length>=3?n:e}function ir(e,t,n){if(e.length<2)return[];let r=n??Qt(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 y of a){let x=e[y].patch;x&&x.length>=3?i.push({outline:[...x],holes:[],topY:e[y].y}):s.push(y)}if(!s.length)continue;s.sort((y,x)=>e[y].depth-e[x].depth);let l=s.map(y=>nr(e,y,r,t)).filter(y=>y!==null);if(!l.length)continue;let f=(y,x)=>({x:y.pts[x].x-y.nrm[x][0]*(y.front+dt),y:y.pts[x].y-y.nrm[x][1]*(y.front+dt)}),u=(y,x)=>({x:y.pts[x].x+y.nrm[x][0]*(y.back+dt),y:y.pts[x].y+y.nrm[x][1]*(y.back+dt)}),d=l[0],m=l[l.length-1],h=[];for(let y=0;y<d.pts.length;y++)h.push(f(d,y));for(let y of l)h.push(u(y,y.pts.length-1));for(let y=m.pts.length-1;y>=0;y--)h.push(u(m,y));for(let y=l.length-1;y>=0;y--)h.push(f(l[y],0));let p=ar(h),g=1/0;for(let y of s)e[y].y<g&&(g=e[y].y);if(!Number.isFinite(g))continue;if(p.length>=3&&Math.abs(Ze(p))>1e-6&&l.every(y=>{let x=y.pts[Math.floor(y.pts.length/2)];return Pt(p,x.x,x.y)})){i.push({outline:rr(p,or),holes:[],topY:g});continue}for(let y of us(l))i.push({outline:y,holes:[],topY:g})}return i}function us(e){let t=[];for(let n of e){let r=[],o=[],i=n.front+dt,a=n.back+dt;for(let c=0;c<n.pts.length;c++){let l=n.pts[c],f=n.nrm[c];r.push([l.x-f[0]*i,l.y-f[1]*i]),o.push([l.x+f[0]*a,l.y+f[1]*a])}let s=[...r,...o.reverse()];s.length<3||(s.push(s[0]),t.push([s]))}if(!t.length)return[];try{let n=Gn.default.union(t[0],...t.slice(1)),r=[];for(let o of n){if(!o.length||o[0].length<4)continue;let i=o[0].map(([c,l])=>({x:c,y:l})),a=i[0],s=i[i.length-1];i.length>1&&Math.abs(a.x-s.x)<1e-9&&Math.abs(a.y-s.y)<1e-9&&i.pop(),i.length>=3&&r.push(rr(i,or))}return r}catch{return[]}}function ar(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 Nn=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(!Pt(n,o.x,o.y)){r=!1;break}if(r)return!0}return!1}};function Jo(e,t,n,r,o,i){if(r.length<3)return;if(n.containsAll(r)){let l=[0,1,0],f=r[0];for(let u=1;u+1<r.length;u++){let d=r[u],m=r[u+1];e.tri([f.x*O,o,f.y*O],[d.x*O,o,d.y*O],[m.x*O,o,m.y*O],l,i)}return}let a=r.map(l=>[l.x,l.y]);a.push(a[0]);let s;try{s=Gn.default.intersection([a],t)}catch{return}let c=[0,1,0];for(let l of s){if(!l.length||l[0].length<4)continue;let f=l[0],u=[],d=[];for(let h=0;h<f.length-1;h++)u.push(f[h][0],f[h][1]),d.push([f[h][0],f[h][1]]);if(d.length<3)continue;let m=(0,er.default)(u,void 0,2);for(let h=0;h<m.length;h+=3){let p=d[m[h]],g=d[m[h+1]],b=d[m[h+2]];e.tri([p[0]*O,o,p[1]*O],[g[0]*O,o,g[1]*O],[b[0]*O,o,b[1]*O],c,i)}}}function sr(e,t,n,r,o,i,a){if(t.length<2)return;let s=a??Qt(t),c=[0,1,0],l=i&&i.length>=3?[[...i.map(m=>[m.x,m.y]),[i[0].x,i[0].y]]]:null,f=i&&i.length>=3?new Nn([[...i]]):null,u=m=>{e.setMaterial(2),m(),e.setMaterial(0)},d=m=>{e.setMaterial(3),m(),e.setMaterial(0)};for(let m=0;m<t.length;m++){let h=t[m];if(h.patch&&h.patch.length>=3){let C=[...h.patch],M=s[m].belowY??r;if(d(()=>{if(l&&f)Jo(e,l,f,C,h.y,o.tread);else{let I=C[0];for(let _=1;_+1<C.length;_++){let B=C[_],z=C[_+1];e.tri([I.x*O,h.y,I.y*O],[B.x*O,h.y,B.y*O],[z.x*O,h.y,z.y*O],c,o.tread)}}}),h.y>M+Zo){let I=0,_=0;for(let B of C)I+=B.x,_+=B.y;I/=C.length,_/=C.length,u(()=>{for(let B=0;B<C.length;B++){let z=C[B],V=C[(B+1)%C.length],A=V.x-z.x,S=V.y-z.y,R=Math.hypot(A,S);if(R<1e-6)continue;let w=S/R,P=-A/R;(z.x-I)*w+(z.y-_)*P<0&&(w=-w,P=-P);let G=[w,0,P],k=[z.x*O,h.y,z.y*O],E=[V.x*O,h.y,V.y*O],F=[z.x*O,M,z.y*O],D=[V.x*O,M,V.y*O];e.tri(k,E,D,G,o.riser),e.tri(k,D,F,G,o.riser)}})}continue}let p=nr(t,m,s,n);if(!p)continue;let{pts:g,nrm:b,front:y,back:x}=p,v=s[m].belowY??r;for(let C=0;C+1<g.length;C++){let M=g[C],I=g[C+1],_=b[C],B=b[C+1];if(Math.hypot(I.x-M.x,I.y-M.y)<1e-6||_[0]===0&&_[1]===0||B[0]===0&&B[1]===0)continue;let z=[(M.x-_[0]*y)*O,h.y,(M.y-_[1]*y)*O],V=[(I.x-B[0]*y)*O,h.y,(I.y-B[1]*y)*O],A=[(M.x+_[0]*x)*O,h.y,(M.y+_[1]*x)*O],S=[(I.x+B[0]*x)*O,h.y,(I.y+B[1]*x)*O];if(d(()=>{l&&f?Jo(e,l,f,[{x:M.x-_[0]*y,y:M.y-_[1]*y},{x:I.x-B[0]*y,y:I.y-B[1]*y},{x:I.x+B[0]*x,y:I.y+B[1]*x},{x:M.x+_[0]*x,y:M.y+_[1]*x}],h.y,o.tread):(e.tri(z,V,S,c,o.tread),e.tri(z,S,A,c,o.tread))}),h.y>v+Zo){let R=[z[0],v,z[2]],w=[V[0],v,V[2]],P=[-_[0],0,-_[1]];u(()=>{e.tri(z,V,w,P,o.riser),e.tri(z,w,R,P,o.riser)})}}}}function cr(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 Zt(e,t){return e.minX<=t.maxX&&t.minX<=e.maxX&&e.minY<=t.maxY&&t.minY<=e.maxY}var zn=it(require("polygon-clipping"),1);function ds(e,t){let n=e.eventConfigurationIds;return!n?.length||!!t&&n.includes(t)}function lr(e,t){return e.filter(n=>n.type!=="shape"||ds(n,t))}function ur(e,t){let n=e.focalPoint??{x:0,y:0};return e.floors?.length?e.floors.map((r,o)=>({objects:lr(r.objects,t),focal:{x:(r.focalPoint??n).x,y:(r.focalPoint??n).y},baseHeightM:r.baseHeightM??0,index:o})):[{objects:lr(e.objects,t),focal:n,baseHeightM:0,index:0}]}var ms={minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};function mt(e){return cr(e)??ms}function dr(e,t){let n=Xt(e.outline,ve),r=mt(n),o=t.filter(a=>a!==e&&a.outline&&a.outline.length>=3&&Zt(r,mt(a.outline)));if(!o.length)return[n];let i=a=>{let s=a.map(c=>[c.x,c.y]);return s.push(s[0]),s};try{let a=zn.default.difference([i(n)],...o.map(c=>[i(c.outline)])),s=[];for(let c of a){if(!c.length)continue;let l=c[0].map(([f,u])=>({x:f,y:u}));if(l.length>1){let f=l[0],u=l[l.length-1];Math.abs(f.x-u.x)<1e-9&&Math.abs(f.y-u.y)<1e-9&&l.pop()}l.length>=3&&s.push(l)}return s.length?s:[n]}catch{return[n]}}function mr(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=zn.default.intersection([n(i.outline)],r.flat())}catch{o.push(i);continue}for(let s of a){if(!s.length)continue;let c=s[0].map(([l,f])=>({x:l,y:f}));if(c.length>1){let l=c[0],f=c[c.length-1];Math.abs(l.x-f.x)<1e-9&&Math.abs(l.y-f.y)<1e-9&&c.pop()}c.length>=3&&o.push({outline:c,holes:[],topY:i.topY})}}return o.length?o:e}var fs=.05,fr=.05,hs=.15,Un=25;function hr(e,t,n){let r=new Map,o=new Array(t.length).fill(null),i=new Float64Array(t.length),a=new Array(t.length).fill(void 0),s=new Array(t.length).fill(void 0),c=new Map,l=[],f=new Set;for(let d=0;d<e.length;d+=1){let m=e[d];for(let h of m.objects){if(h.type==="table"&&f.add(h.id),h.type!=="section"||!h.outline||h.outline.length<3)continue;let p=Xt(h.outline,ve);c.set(h.id,{section:h,unit:m,frontU:1/0,hasSeats:!1,rows:new Map,seatIndices:[]}),l.push({id:h.id,floorIndex:d,box:mt(p),section:h,unit:m,outline:p})}}let u=new Map;for(let d of l){let m=u.get(d.floorIndex);m?m.push(d):u.set(d.floorIndex,[d])}for(let d=0;d<t.length;d++){let m=t[d],h=n?u.get(n[d])??[]:l,p=m.sectionId?h.find(b=>b.id===m.sectionId)??h.find(b=>b.section.logicalSectionId===m.sectionId&&Bn({x:m.x,y:m.y},b.outline,b.section.holes)):void 0,g=p?[p]:h;for(let b of g){if(n&&b.floorIndex!==n[d]||!p&&(m.x<b.box.minX||m.x>b.box.maxX||m.y<b.box.minY||m.y>b.box.maxY||!Bn({x:m.x,y:m.y},b.outline,b.section.holes)))continue;o[d]=b.id;let y=c.get(b.id);y.hasSeats=!0;let x=m.focalPoint??b.unit.focal,v=Math.hypot(m.x-x.x,m.y-x.y);v<y.frontU&&(y.frontU=v),y.seatIndices.push(d);let C=m.rowId||`__seat-${d}`,M=y.rows.get(C);M?M.push({x:m.x,y:m.y}):y.rows.set(C,[{x:m.x,y:m.y}]);break}}for(let[d,m]of c){let h=_o(m.section,{floorBaseHeightM:m.unit.baseHeightM}),p=m.unit.baseHeightM,g=h.rake>0?Math.tan(h.rake*Math.PI/180):0,b=h.rake<=.01&&h.height<=p+.001,y=m.section.surfaceKind,x=y==="flat"?!0:y==="rakedRows"&&h.rake>.01?!1:b,v=m.hasSeats?Wo(d,t,m.seatIndices,m.unit.focal):{sectionId:d,rows:[],blockCount:0},M=v.rows.length<2?Qo([...m.rows.values()].map(k=>({points:k})),m.unit.focal):null,I=1/0;if(M){if(m.hasSeats)for(let k of m.rows.values())for(let E of k){let F=M.depthAt(E.x,E.y);F<I&&(I=F)}if(!m.hasSeats||!Number.isFinite(I)){I=1/0;for(let k of m.section.outline){let E=M.depthAt(k.x,k.y);E<I&&(I=E)}}}let _=p+fs,B=Math.max(_,h.height),z=k=>{let E=Math.max(0,k-I)*Re,F=Math.min(E*g,Un);return Math.max(_,h.height+F)},V=k=>{let E=Math.max(0,k)*Re,F=Math.min(E*g,Un);return Math.max(_,h.height+F)},A=x?[]:v.rows.map(k=>({pts:k.pts,y:V(k.blockDepth),depth:k.blockDepth,blockId:k.blockId,...f.has(k.id)?{patch:tr(k.pts,ve)}:{}})),S=A.length?A[0].y:B,R=A.map(k=>{let E=k.patch&&k.patch.length>=3?k.patch:k.pts,F=0,D=0;for(let U of E)F+=U.x,D+=U.y;let N=E.length||1;F/=N,D/=N;let j=0;for(let U of E){let T=Math.hypot(U.x-F,U.y-D);T>j&&(j=T)}return{cx:F,cy:D,rad:j}}),w=x?()=>B:A.length>=2?(k,E)=>{let F=1/0,D=S;for(let N=0;N<A.length;N++){let j=R[N];if(Math.hypot(k-j.cx,E-j.cy)-j.rad>=F)continue;let U=A[N].patch,T=U&&U.length>=3?Pt(U,k,E)?0:ut(U,k,E):ut(A[N].pts,k,E);T<F&&(F=T,D=A[N].y)}return D}:(k,E)=>M?z(M.depthAt(k,E)):B,P=[0,1,0],G=A.length>=2||x?()=>P:(k,E)=>{if(!M)return P;let F=M.depthAt(k,E);if(F<=I)return P;let D=(F-I)*Re;if(D*g>=Un||h.height+D*g<=_)return P;let[N,j]=M.gradientAt(k,E);if(N===0&&j===0)return P;let U=1/Math.hypot(g,1);return[-N*g*U,U,-j*g*U]};if(!x)for(let k of v.rows){let E=V(k.blockDepth);for(let F of k.seatIndices)a[F]=E}for(let k of v.rows){let E=[];for(let U=1;U<k.pts.length;U++){let T=Math.hypot(k.pts[U].x-k.pts[U-1].x,k.pts[U].y-k.pts[U-1].y);T>1e-6&&E.push(T)}E.sort((U,T)=>U-T);let F=E.length?E[Math.floor(E.length/2)]:1/0,D=1/0,N=k.pts[Math.floor(k.pts.length/2)];if(N)for(let U of v.rows){if(U===k||U.blockId!==k.blockId)continue;let T=ut(U.pts,N.x,N.y);T>1e-6&&T<D&&(D=T)}let j=Math.min(F,Math.max(D,F*.5));if(Number.isFinite(j)&&j>0)for(let U of k.seatIndices)s[U]=j}r.set(d,{sectionId:d,deckAt:w,normalAt:G,flat:x,bottomY:p,rowLevels:A,landingY:S})}for(let d=0;d<t.length;d++){let m=o[d],h=t[d];if(m){let g=a[d];i[d]=(g??r.get(m).deckAt(h.x,h.y))+hs;continue}let p=h.eyeHeightM;i[d]=Number.isFinite(p)?Math.max(0,p-Ut):0}return{bySection:r,seatOwner:o,seatDeckY:d=>i[d],seatPitchU:d=>s[d]}}var se={top:1,wallBottom:.5,bottomCap:.4};function _e(e,t){if(!e)return t;let n=xe(vt(e,.4),.62);return pe(t,n,.72)}function pr(e,t){let n=new Map;for(let i of e.categories??[])n.set(i.key,i.color);let r=new Map;for(let i of t){if(!i.sectionId)continue;let a=r.get(i.sectionId);a||(a=new Map,r.set(i.sectionId,a)),a.set(i.categoryKey,(a.get(i.categoryKey)??0)+1)}let o=new Map;for(let[i,a]of r){let s=0,c=0,l=0,f=0;for(let[u,d]of a){let m=J(n.get(u));m&&(s+=m[0]*d,c+=m[1]*d,l+=m[2]*d,f+=d)}f>0&&o.set(i,[s/f,c/f,l/f])}return o}function br(e,t){return J(e.color)??t.get(e.logicalSectionId??e.id)??null}var wu=Math.PI*2;function gr(e){return e==="pitch-football"||e==="rink-hockey"||e==="track-athletics"||e==="oval-cricket"}var yr=it(require("polygon-clipping"),1);function ps(e,t){return e===void 0||t===void 0?!0:Math.abs(e-t)<.001}var $t=class{constructor(){this.rings=[];this.boxes=[];this.levels=[]}subtract(t,n){let r=t.map(c=>[c.x,c.y]);if(r.length<3)return[];r.push(r[0]);let o=mt(t),i=this.rings.filter((c,l)=>Zt(o,this.boxes[l])&&ps(n,this.levels[l])),a=[[r]];if(i.length)try{a=yr.default.difference([r],...i).map(l=>l.map(f=>f.map(([u,d])=>[u,d])))}catch{a=[[r]]}this.rings.push([r]),this.boxes.push(o),this.levels.push(n);let s=[];for(let c of a){if(!c.length)continue;let l=c[0].map(([f,u])=>({x:f,y:u}));if(l.length>1){let f=l[0],u=l[l.length-1];Math.abs(f.x-u.x)<1e-9&&Math.abs(f.y-u.y)<1e-9&&l.pop()}l.length>=3&&s.push(l)}return s}};function bs(e,t){if(!t)return e;let n=1/0,r=-1/0,o=1/0,i=-1/0;for(let u of e)n=Math.min(n,u.x),r=Math.max(r,u.x),o=Math.min(o,u.y),i=Math.max(i,u.y);let a=(n+r)/2,s=(o+i)/2,c=t*Math.PI/180,l=Math.cos(c),f=Math.sin(c);return e.map(u=>{let d=u.x-a,m=u.y-s;return{x:a+d*l-m*f,y:s+d*f+m*l}})}function Je(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=At(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=Wt(n,r,e.width/2,e.height/2)}return t?bs(t,e.rotation):null}function Rt(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"&&gr(e.stageKind)?{kind:"stage",heightM:.06}:n[t]??{kind:"plate",heightM:.25};return{...r,heightM:e.heightM??r.heightM}}var gs=.08;function xr(e,t){let n=Je(e),r=Rt(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 f of n)i=Math.min(i,f.x),a=Math.min(a,f.y),s=Math.max(s,f.x),c=Math.max(c,f.y);let l=o;for(let f of t)s>f.minX&&i<f.maxX&&c>f.minY&&a<f.maxY&&l<=f.topOffsetM+1e-6&&(l=f.topOffsetM+gs);return t.push({minX:i,minY:a,maxX:s,maxY:c,topOffsetM:l}),l}function ze(e,t,n){return{x:e.x+(t.x-e.x)*n,y:e.y+(t.y-e.y)*n}}function vr(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 Et(e,t,n){return[ze(e[0],e[1],t),ze(e[0],e[1],n),ze(e[3],e[2],n),ze(e[3],e[2],t)]}function Mr(e,t,n){return[ze(e[0],e[3],t),ze(e[1],e[2],t),ze(e[1],e[2],n),ze(e[0],e[3],n)]}function Fe(e,t,n,r,o,i){ce(e,t,void 0,()=>n,r,o,i,se)}var Hn=2.4,ys=.75,xs=.15;function kt(e){if(e.points&&e.points.length>=3)return e.points;let{center:t,width:n,height:r,rotation:o}=e;if(!n||!r)return null;let i=(o??0)*Math.PI/180,a=Math.cos(i),s=Math.sin(i),c=n/2,l=r/2;return[[-c,-l],[c,-l],[c,l],[-c,l]].map(([f,u])=>({x:t.x+f*a-u*s,y:t.y+f*s+u*a}))}function Sr(e,t,n,r,o){let i=kt(t);i&&ce(e,i,void 0,()=>n+Hn,n,_e(r,o.boothTop),o.boothWall,se)}function jn(e){if(e.shape==="round"){let f=e.radius;return f?Wt(e.center.x,e.center.y,f,f,24):null}let{width:t,height:n,rotation:r,center:o}=e;if(!t||!n)return null;let i=(r??0)*Math.PI/180,a=Math.cos(i),s=Math.sin(i),c=t/2,l=n/2;return[[-c,-l],[c,-l],[c,l],[-c,l]].map(([f,u])=>({x:o.x+f*a-u*s,y:o.y+f*s+u*a}))}function wr(e,t,n,r,o){let i=jn(t);i&&ce(e,i,void 0,()=>n+ys,n,_e(r,o.tableTop),o.tableWall,se)}function Pr(e,t,n,r,o,i,a,s){let c=Je(t);if(!c)return;let l=s?s.kind==="stage":t.role==="stage",f=s?s.kind==="screen":t.role==="screen",u=s?{kind:l?"stage":"solid",heightM:s.topY-s.baseY}:Rt(t),d=s?.baseY??n,m=s?.topY??n+r;if(l&&a){let y=1/0,x=-1/0,v=1/0,C=-1/0;for(let M of c)M.x<y&&(y=M.x),M.x>x&&(x=M.x),M.y<v&&(v=M.y),M.y>C&&(C=M.y);a.push({cx:(y+x)/2*O,cz:(v+C)/2*O,y:m,halfX:Math.max((x-y)/2*O,.5),halfZ:Math.max((C-v)/2*O,.5)})}let h=J(t.fill),p=l&&h?pe(o.stageTop,xe(vt(h,.18),.9),.9):_e(h,l?o.stageTop:o.decorTop),g=f?h:null,b=l?h?pe(o.stageWall,xe(h,.58),.82):o.stageWall:f?g?pe(xe(g,1.42),[.24,.46,.82],.08):[.24,.46,.82]:_e(J(t.fill),o.decorWall);if(u.kind==="portal"&&c.length===4){let y=vr(c);Fe(e,Et(y,0,.16),m,d,p,b),Fe(e,Et(y,.84,1),m,d,p,b),Fe(e,y,m,Math.max(d,m-.35),p,b);return}if(u.kind==="suite"&&c.length===4){let y=c.map((C,M)=>{let I=c[(M+1)%4],_=(C.x+I.x)/2,B=(C.y+I.y)/2;return Math.hypot(_-i.x,B-i.y)}),x=y.indexOf(Math.min(...y)),v=[0,1,2,3].map(C=>c[(x+C)%4]);Fe(e,Et(v,0,.08),m,d,p,b),Fe(e,Et(v,.92,1),m,d,p,b),Fe(e,Mr(v,.88,1),m,d,p,b),Fe(e,v,m,Math.max(d,m-.18),p,b);return}Fe(e,c,m,d,p,b)}function Yn(e){let{x:t,y:n,width:r,height:o}=e;if(!r||!o)return null;let i=t+r/2,a=n+o/2,s=(e.rotation??0)*Math.PI/180,c=Math.cos(s),l=Math.sin(s),f=r/2,u=o/2;return[[-f,-u],[f,-u],[f,u],[-f,u]].map(([d,m])=>({x:i+d*c-m*l,y:a+d*l+m*c}))}function vs(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 J(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=J(s[1].trim());c&&a.push(c)}return a.length?a.reduce((s,c,l)=>pe(s,c,1/(l+1)),a[0]):null}function Cr(e,t,n,r){if(t.layer==="foreground")return;let o=Yn(t);if(!o)return;let i=n+xs,a=_e(vs(t.href),r.decorTop),s=Math.max(0,Math.min(1,t.opacity??1));s<1&&(a=pe(r.ground,a,s)),ce(e,o,void 0,()=>i,n,a,pe(a,r.decorWall,.5),se)}function Ir(e,t,n,r,o){if(!t.points||t.points.length<3)return;let i=_e(r,o.gaTop);ce(e,t.points,t.holes,()=>n+.15,n,i,o.gaWall,se)}var Ms=Math.PI/180,ee=96,Ss=6,ws=60,Ps=150,Ar=.2,Cs=.35;function Is(e,t){let n=Math.atan2(t.x-e.x,t.y-e.y)/Ms;return n<0?n+360:n}function Jt(e){if(!e.length)return NaN;let t=[...e].sort((n,r)=>n-r);return t[Math.floor(t.length/2)]}function en(e,t,n=2){let r=e.length,o=new Float64Array(r);for(let i=0;i<r;i++){let a=0,s=0;for(let c=-n;c<=n;c++){let l=i+c;if(t)l=(l%r+r)%r;else if(l<0||l>=r)continue;a+=e[l],s++}o[i]=a/s}return o}function Rr(e,t){let n=e.filter(d=>d.rows.length>=1);if(n.length<1)return null;let r=[],o=0,i=0,a=0;for(let d of n)for(let m of d.rows){for(let h of m.pts)o+=h.x,i+=h.y,a++;if(m.pts.length>=4){let h=On(m.pts);h&&Number.isFinite(h.cx)&&Number.isFinite(h.cy)&&r.push({x:h.cx,y:h.cy})}}if(!a)return null;let s={x:o/a,y:i/a},c=s;if(r.length>=8){let d=Jt(r.map(b=>b.x)),m=Jt(r.map(b=>b.y)),h=0;for(let b of n)for(let y of b.rows)for(let x of y.pts){let v=Math.hypot(x.x-s.x,x.y-s.y);v>h&&(h=v)}let p=0,g=h*.2;for(let b of n)for(let y of b.rows)for(let x of y.pts)Math.hypot(x.x-d,x.y-m)<g&&p++;Math.hypot(d-s.x,m-s.y)<=h&&p/a<.01&&(c={x:d,y:m})}let l=[];for(let d of n){let m={sectionId:d.sectionId,rMin:1/0,rMax:-1/0,samples:[]};for(let h of d.rows)for(let p of h.pts){let g=Math.hypot(p.x-c.x,p.y-c.y),b=Math.min(ee-1,Math.floor(Is(c,p)/(360/ee)));m.samples.push({r:g,bin:b,levelM:h.levelM}),g<m.rMin&&(m.rMin=g),g>m.rMax&&(m.rMax=g)}m.samples.length&&l.push(m)}if(!l.length)return null;l.sort((d,m)=>d.rMin+d.rMax-(m.rMin+m.rMax));let f=[];for(let d of l){let m=!1;for(let h of f){let p=Math.min(d.rMax,h.rMax)-Math.max(d.rMin,h.rMin),g=Math.min(d.rMax-d.rMin,h.rMax-h.rMin);if(g>1e-9&&p>=Cs*g){h.members.push(d),h.rMin=Math.min(h.rMin,d.rMin),h.rMax=Math.max(h.rMax,d.rMax),m=!0;break}}m||f.push({members:[d],rMin:d.rMin,rMax:d.rMax})}let u=[];for(let d of f){let m=new Array(ee).fill(null);for(let S of d.members)for(let R of S.samples){let w=m[R.bin];w||(w={samples:[]},m[R.bin]=w),w.samples.push({r:R.r,levelM:R.levelM})}let h=m.map(S=>!!S);if(!h.filter(Boolean).length)continue;let g=[],b=[];for(let S of m){if(!S)continue;let R=1/0,w=-1/0;for(let P of S.samples)P.r<R&&(R=P.r),P.r>w&&(w=P.r);g.push(R),b.push(w)}let y=Jt(g),x=Jt(b);if(!(y>=Ar*x)||!(x>0))continue;let v=[...g].sort((S,R)=>S-R);if(!(v[Math.floor(v.length*.1)]>=Ar*x))continue;let M=m.map(S=>{if(!S)return null;let R=[...S.samples].sort((N,j)=>N.r-j.r),w=R[0].r,P=R[R.length-1].r,G=R[0].levelM,k=-1/0;for(let N of R)N.levelM>k&&(k=N.levelM);let E=[];for(let N of R){let j={r:N.r,l:N.levelM};for(;E.length&&Math.abs(E[E.length-1].r-j.r)<1e-9;){if(E[E.length-1].l<=j.l){j.skip=!0;break}E.pop()}if(!j.skip){for(;E.length>=2;){let U=E[E.length-2],T=E[E.length-1];if((T.r-U.r)*(j.l-U.l)-(T.l-U.l)*(j.r-U.r)<=0)E.pop();else break}E.push(j)}}let F=E.map(N=>N.r),D=E.map(N=>N.l);return{inner:w,outer:P,front:G,top:k,profile:{rs:F,ls:D}}}),I=h.slice();for(let S=0;S<ee;S++){if(I[S])continue;let R=-1,w=-1,P=0;for(let L=1;L<=ee;L++){let H=(S-L+ee*2)%ee;if(I[H]){R=H;break}}for(let L=1;L<=ee;L++){let H=(S+L)%ee;if(I[H]){w=H,P=L;break}}if(R<0||w<0)continue;let G=0;for(let L=1;L<=ee;L++){let H=(S-L+ee*2)%ee;if(h[H]){G=L;break}}if(G-1+P>Ss)continue;let E=M[R],F=M[w],D=G/(G+P),N=E.inner+(F.inner-E.inner)*D,j=E.outer+(F.outer-E.outer)*D,U=E.front+(F.front-E.front)*D,T=E.top+(F.top-E.top)*D;M[S]={inner:N,outer:j,front:U,top:T,profile:{rs:[N,j],ls:[U,T]}}}for(let S=0;S<ee;S++)M[S]&&(I[S]=!0);let _=360/ee,B=[],z=I.filter(Boolean).length,V=[];if(z===ee)V.push({start:0,len:ee});else{let S=0;for(;I[S];)S=(S+1)%ee;let R=-1;for(let w=0;w<=ee;w++){let P=(S+w)%ee,G=w<ee&&I[P];if(G&&R<0)R=P;else if(!G&&R>=0){let k=(P-R+ee)%ee||ee;V.push({start:R,len:k}),R=-1}}}for(let S of V){if(S.len*_<ws&&S.len<ee)continue;let R=S.len===ee,w=new Float64Array(S.len),P=new Float64Array(S.len),G=new Float64Array(S.len),k=new Float64Array(S.len),E=[];for(let L=0;L<S.len;L++){let H=M[(S.start+L)%ee];w[L]=H.inner,P[L]=H.outer,G[L]=H.front,k[L]=H.top,E.push(H.profile??{rs:[H.inner,H.outer],ls:[H.front,H.top]})}let F=en(w,R),D=en(P,R),N=en(G,R),j=en(k,R);for(let L=0;L<S.len;L++)F[L]>w[L]&&(F[L]=w[L]),D[L]<P[L]&&(D[L]=P[L]),F[L]>D[L]-1e-6&&(F[L]=Math.max(0,D[L]-1e-6)),j[L]<N[L]&&(j[L]=N[L]);let U={startBin:S.start,binCount:S.len,closed:R,innerR:F,outerR:D,frontLevelM:N,topLevelM:j,profiles:E},T=(L,H,W)=>{let q=E[L],Q=q.rs,$=q.ls;if(H<=Q[0]){$[0]>W&&($[0]=W);return}if(H>=Q[Q.length-1]){$[$.length-1]>W&&($[$.length-1]=W);return}for(let ne=0;ne+1<Q.length;ne++)if(H<=Q[ne+1]){$[ne]>W&&($[ne]=W),$[ne+1]>W&&($[ne+1]=W);return}};for(let L=0;L<S.len;L++){let H=m[(S.start+L)%ee];if(H)for(let W of H.samples){T(L,W.r,W.levelM);let q=R?(L-1+S.len)%S.len:L-1,Q=R?(L+1)%S.len:L+1;q>=0&&T(q,W.r,W.levelM),Q<S.len&&T(Q,W.r,W.levelM)}}B.push(U)}B.reduce((S,R)=>S+R.binCount*_,0)<Ps||u.push({arcs:B,sectionIds:d.members.map(S=>S.sectionId),innerRMedian:y,outerRMedian:x})}if(!u.length)return null;if(u.sort((d,m)=>d.innerRMedian-m.innerRMedian),t){let d=u[u.length-1].outerRMedian;if(Math.hypot(t.x-c.x,t.y-c.y)>.9*d)return null}return{centre:c,binCount:ee,binStepDeg:360/ee,rings:u}}function Er(e,t,n,r){let o=e.binStepDeg,i=n/o-.5-t.startBin;i=(i%e.binCount+e.binCount)%e.binCount,i>t.binCount-1&&(t.closed?i=i-t.binCount<t.binCount-i?0:t.binCount-1:i=i-(t.binCount-1)<e.binCount-i?t.binCount-1:0);let a=Math.floor(i),s=t.closed?(a+1)%t.binCount:Math.min(t.binCount-1,a+1),c=i-a,l=f=>{let u=t.profiles[f],d=u.rs,m=u.ls;if(r<=d[0])return m[0];if(r>=d[d.length-1])return m[m.length-1];for(let h=0;h+1<d.length;h++)if(r<=d[h+1]){let p=d[h+1]-d[h],g=p>1e-9?(r-d[h])/p:0;return m[h]+(m[h+1]-m[h])*g}return m[m.length-1]};return l(a)*(1-c)+l(s)*c}var As=.25,Rs=1.2,Es=.6,ks=.45,Ts=2.3,Ls=Math.PI/180;function et(e,t,n){let r=n*Ls;return{x:e.x+t*Math.sin(r),y:e.y+t*Math.cos(r)}}function _s(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 Fs=24;function Ds(e,t,n,r,o,i,a,s){let c=n.binCount,l=Fs,f=Re,u=i+.02,d=[];for(let A=0;A<c;A++){let S=(n.startBin+A+.5)*t.binStepDeg,R=new Float64Array(l+1);for(let w=0;w<=l;w++){let P=r[A]+(o[A]-r[A])*w/l;R[w]=Math.max(u,Er(t,n,S,P)-As)}d.push(R)}let m=[a.bandTop[0]*s.top,a.bandTop[1]*s.top,a.bandTop[2]*s.top],h=[a.bandTop[0]*s.bottomCap,a.bandTop[1]*s.bottomCap,a.bandTop[2]*s.bottomCap],p=[a.bandWall[0]*s.top,a.bandWall[1]*s.top,a.bandWall[2]*s.top],g=[a.bandWall[0]*s.wallBottom,a.bandWall[1]*s.wallBottom,a.bandWall[2]*s.wallBottom],b=(A,S)=>{let R=(n.startBin+A+.5)*t.binStepDeg,w=r[A]+(o[A]-r[A])*S/l,P=et(t.centre,w,R);return[P.x*f,d[A][S],P.y*f]};{let A=Math.tan(12*Math.PI/180);for(let S=0;S<6;S++){let R=!1;for(let P=0;P<c;P++)for(let G=l-1;G>=0;G--)d[P][G]>d[P][G+1]&&(d[P][G]=d[P][G+1],R=!0);let w=n.closed?c:c-1;for(let P=0;P<w;P++){let G=(P+1)%c;for(let k=0;k<=l;k++){let E=d[G][k]-d[P][k];if(Math.abs(E)>1)continue;let F=r[P]+(o[P]-r[P])*k/l,D=r[G]+(o[G]-r[G])*k/l,N=et(t.centre,F,(n.startBin+P+.5)*t.binStepDeg),j=et(t.centre,D,(n.startBin+G+.5)*t.binStepDeg),U=A*Math.hypot(j.x-N.x,j.y-N.y)*f;E>U?(d[G][k]=d[P][k]+U,R=!0):-E>U&&(d[P][k]=d[G][k]+U,R=!0)}}if(!R)break}}let y=1,x=(A,S)=>{for(let R=0;R<=l;R+=4)if(Math.abs(d[A][R]-d[S][R])>y)return!0;return Math.abs(d[A][l]-d[S][l])>y},v=Math.tan(38*Math.PI/180),C=A=>(o[A]-r[A])/l*f,M=(A,S)=>d[A][S+1]-d[A][S]>v*Math.max(1e-6,C(A)),I=(A,S)=>{let R=n.closed?(A-1+c)%c:Math.max(0,A-1),w=n.closed?(A+1)%c:Math.min(c-1,A+1);Math.abs(d[R][S]-d[A][S])>y&&(R=A),Math.abs(d[w][S]-d[A][S])>y&&(w=A);let P=Math.max(0,S-1),G=Math.min(l,S+1);P<S&&M(A,P)&&(P=S),G>S&&M(A,S)&&(G=S);let k=b(R,S),E=b(w,S),F=b(A,P),D=b(A,G),N=E[0]-k[0],j=E[1]-k[1],U=E[2]-k[2],T=D[0]-F[0],L=D[1]-F[1],H=D[2]-F[2],W=j*H-U*L,q=U*T-N*H,Q=N*L-j*T,$=Math.hypot(W,q,Q);return $>1e-12?(W/=$,q/=$,Q/=$,q<0&&(W=-W,q=-q,Q=-Q),[W,q,Q]):[0,1,0]},_=(A,S)=>{let R=[A[0],i,A[2]],w=[S[0],i,S[2]],P=S[0]-A[0],G=S[2]-A[2],k=Math.hypot(P,G);if(!(k>1e-12))return;let E=[G/k,0,-P/k];e.tri(A,S,w,E,p,p,g),e.tri(A,w,R,E,p,g,g)},B=.05*Ge,z=A=>o[A]-r[A]<B,V=n.closed?c:c-1;for(let A=0;A<V;A++){let S=(A+1)%c;if(z(A)||z(S))continue;if(x(A,S)){let E=(n.startBin+A+1)*t.binStepDeg,F=(L,H)=>{let W=(r[A]+r[S])/2,q=(o[A]+o[S])/2,Q=W+(q-W)*H/l,$=et(t.centre,Q,E);return[$.x*f,d[L][H],$.y*f]};for(let L=0;L<l;L++){let H=b(A,L),W=b(A,L+1),q=F(A,L),Q=F(A,L+1),$=I(A,L),ne=I(A,L+1);e.triN(H,q,Q,$,$,ne,m),e.triN(H,Q,W,$,ne,ne,m);let Xe=b(S,L),We=b(S,L+1),Se=F(S,L),De=F(S,L+1),Oe=I(S,L),we=I(S,L+1);e.triN(Se,Xe,We,Oe,Oe,we,m),e.triN(Se,We,De,Oe,we,we,m);let ye=F(A,L),le=F(A,L+1),ot=F(S,L+1),Pe=F(S,L),rt=le[0]-ye[0],Ce=le[2]-ye[2],Be=Math.hypot(rt,Ce);if(Be>1e-12){let _t=[Ce/Be,0,-rt/Be];e.tri(ye,le,ot,_t,p),e.tri(ye,ot,Pe,_t,p)}}let D=b(A,0),N=b(S,0),j=b(S,l),U=b(A,l),T=L=>[L[0],i,L[2]];e.tri(T(D),T(j),T(N),[0,-1,0],h),e.tri(T(D),T(U),T(j),[0,-1,0],h),_(D,N),_(U,j);continue}for(let E=0;E<l;E++){let F=I(A,E),D=I(S,E),N=I(S,E+1),j=I(A,E+1);if(M(A,E)||M(S,E)){let W=(le,ot)=>{let Pe=(n.startBin+le+.5)*t.binStepDeg,rt=r[le]+(o[le]-r[le])*(E+.5)/l,Ce=et(t.centre,rt,Pe);return[Ce.x*f,ot,Ce.y*f]},q=b(A,E),Q=b(S,E),$=W(A,d[A][E]),ne=W(S,d[S][E]);e.triN(q,Q,ne,F,D,D,m),e.triN(q,ne,$,F,D,F,m);let Xe=b(S,E+1),We=b(A,E+1),Se=W(A,d[A][E+1]),De=W(S,d[S][E+1]);e.triN(Se,De,Xe,j,N,N,m),e.triN(Se,Xe,We,j,N,j,m);let Oe=ne[0]-$[0],we=ne[2]-$[2],ye=Math.hypot(Oe,we);if(ye>1e-12){let le=[-we/ye,0,Oe/ye];e.tri($,ne,De,le,p),e.tri($,De,Se,le,p)}continue}let U=b(A,E),T=b(S,E),L=b(S,E+1),H=b(A,E+1);e.triN(U,T,L,F,D,N,m),e.triN(U,L,H,F,N,j,m)}let R=b(A,0),w=b(S,0),P=b(S,l),G=b(A,l),k=E=>[E[0],i,E[2]];e.tri(k(R),k(P),k(w),[0,-1,0],h),e.tri(k(R),k(G),k(P),[0,-1,0],h),_(R,w),_(G,P)}if(!n.closed)for(let A of[0,c-1])for(let S=0;S<l;S++)_(b(A,S),b(A,S+1))}function kr(e,t,n){let{bottomY:r,colors:o,ao:i}=n,a=new Float64Array(t.binCount).fill(-1/0);for(let f of t.rings)for(let u of f.arcs){let d=new Float64Array(u.binCount),m=new Float64Array(u.binCount);for(let p=0;p<u.binCount;p++){let g=(u.startBin+p)%t.binCount,b=Math.max(0,u.innerR[p]-ve);d[p]=Math.max(b,a[g]+.001),m[p]=Math.max(d[p]+.001,u.outerR[p]+ve)}let h=0;for(let p=0;p<u.binCount;p++){let g=u.topLevelM[p]-r;g>h&&(h=g)}h>=Rs&&Ds(e,t,u,d,m,r,o,i);for(let p=0;p<u.binCount;p++){let g=(u.startBin+p)%t.binCount;m[p]>a[g]&&(a[g]=m[p])}}if(n.deriveShell===!1||_s(n.shapes,t))return;let s=t.rings[t.rings.length-1],c=Es*Ge,l=ks*Ge;for(let f of s.arcs){let u=[],d=[];for(let p=0;p<f.binCount;p++){let g=(f.startBin+p+.5)*t.binStepDeg,b=f.outerR[p]+ve+c;u.push(et(t.centre,b,g)),d.push(et(t.centre,b+l,g))}let m=-1/0;for(let p=0;p<f.binCount;p++)f.topLevelM[p]>m&&(m=f.topLevelM[p]);let h=()=>m+Ts;f.closed?ce(e,d,[u.slice().reverse()],h,r,o.shellTop,o.shellWall,i):ce(e,[...d,...u.slice().reverse()],void 0,h,r,o.shellTop,o.shellWall,i)}}function Tr(e,t,n,r,o,i,a,s){if(!t.outline||t.outline.length<3)return;let c=n.baseHeightM,l=_e(r,s.tierTop);if(!o)return;let f=g=>o.deckAt(g.x,g.y),u=dr(t,a),d=u[0]??t.outline;if(o.rowLevels.length>=2){let g=Qt(o.rowLevels),b=mr(ir(o.rowLevels,n.focal,g),u),y=()=>[0,1,0];for(let v of b){let C=Math.max(c,v.topY-.02);for(let M of i.subtract(v.outline,C))ce(e,M,v.holes,()=>C,c,l,s.tierWall,se,void 0,y)}b.length||ce(e,d,t.holes,()=>o.landingY,c,l,s.tierWall,se);let x={tread:[l[0]*se.top,l[1]*se.top,l[2]*se.top],riser:[l[0]*.72,l[1]*.72,l[2]*.72]};for(let v of u.length?u:[d])sr(e,o.rowLevels,n.focal,o.landingY,x,v,g);return}let m=o.flat?1/0:fr,h=g=>o.normalAt(g.x,g.y),p=o.flat?o.landingY:void 0;for(let g of i.subtract(d,p))ce(e,g,t.holes,f,c,l,s.tierWall,se,m,h)}function Os(e,t,n){let r=new Set;for(let a of e.objects)a.type==="section"&&r.add(a.id);let o=new Map;for(let a=0;a<t.length;a++){let s=n.seatOwner[a];if(!s||!r.has(s))continue;let c=n.bySection.get(s);if(c&&c.rowLevels.length>=2)continue;let l=t[a],f=o.get(s);f||(f=new Map,o.set(s,f));let u=l.rowId||`__seat-${a}`,d=f.get(u);d||(d={pts:[],levelM:0,n:0},f.set(u,d)),d.pts.push({x:l.x,y:l.y}),d.levelM+=n.seatDeckY(a),d.n++}let i=[];for(let a of e.objects){if(a.type!=="section")continue;let s=n.bySection.get(a.id);if(s&&s.rowLevels.length>=2){let l=s.rowLevels.filter(f=>!f.patch).map(f=>({pts:f.pts,levelM:f.y}));l.length>=2&&i.push({sectionId:a.id,rows:l});continue}let c=o.get(a.id);c&&i.push({sectionId:a.id,rows:[...c.values()].map(l=>({pts:l.pts,levelM:l.levelM/l.n}))})}return i}function Lr(e,t,n,r,o,i,a=!0){let s=Os(t,n,r);if(!s.length)return;let c=Rr(s,t.focal);c&&(e.setMaterial(0),kr(e,c,{bottomY:t.baseHeightM,colors:{bandTop:xe(o.tierTop,.8),bandWall:o.tierWall,shellTop:i??xe(o.tierWall,1.15),shellWall:i??o.tierWall},ao:se,shapes:t.objects.filter(l=>l.type==="shape"),deriveShell:a}))}function _r(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 Fr(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 Bs=1.15,Vs=3.25,Ns=4.5,Gs=.85,zs=.5,Us=.26;function Dr(e,t,n){let r=Math.max(1e-6,t),o=e/r,i=n?.hasZoneLabels??!0,a=new Set;return o>=.75&&a.add("floor"),o>=Bs&&a.add("zone"),o<=(i?Vs:Ns)&&(a.add("section"),a.add("ga")),o<=Gs&&(a.add("annotation"),a.add("booth")),o<=zs&&a.add("row"),o<=Us&&a.add("seat"),a}function Ue(e,t,n,r){let o=e,i=t[0],a=t[1],s=t[2],c=o[0]*i+o[4]*a+o[8]*s+o[12],l=o[1]*i+o[5]*a+o[9]*s+o[13],f=o[2]*i+o[6]*a+o[10]*s+o[14],u=o[3]*i+o[7]*a+o[11]*s+o[15];if(!(u>1e-6))return{x:0,y:0,depth:1/0,visible:!1};let d=c/u,m=l/u,h=f/u,p=d>=-1.05&&d<=1.05&&m>=-1.05&&m<=1.05&&h<=1;return{x:(d*.5+.5)*n,y:(1-(m*.5+.5))*r,depth:h,visible:p}}function Or(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(Xn(i,s,t,n)){a=!0;break}a||r.push(i)}return r}var Hs=6;function Xn(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+Hs):n;return o<a&&i<r}function Br(e,t,n){return e.length*t*.58+(n?14:0)}var Wn={row:8,seat:14};function Vr(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 Kn(e,t,n,r,o=[]){let i=[...e].sort((s,c)=>(c.priority??0)-(s.priority??0)||s.focus-c.focus),a=[];for(let s of i){if(a.length>=r)break;let c=!1;for(let l of o)if(Xn(s,l,t,n)){c=!0;break}if(!c){for(let l of a)if(Xn(s,l,t,n)){c=!0;break}}c||a.push(s)}return a}var js=6,Ys=2.2,Nr=.1,Xs=.3,Ws=1.8,Ks=.9,qs=.55,Qs=6e3;function Gr(e){let{doc:t,units:n,seats:r,surfaces:o,focal:i}=e,a=t.zones??[],s=[];if(a.length){let c=new Map;for(let f of n)for(let u of f.objects)u.type==="section"&&u.zone&&c.set(u.id,u.zone);let l=new Map;for(let f=0;f<r.length;f++){let u=r[f],d=o.seatOwner[f],m=u.zoneId??(d?c.get(d):void 0);if(!m)continue;let h=l.get(m);h||(h={n:0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0,sumY:0},l.set(m,h)),h.n++,u.x<h.minX&&(h.minX=u.x),u.y<h.minY&&(h.minY=u.y),u.x>h.maxX&&(h.maxX=u.x),u.y>h.maxY&&(h.maxY=u.y),h.sumY+=o.seatDeckY(f)}for(let f of a){let u=l.get(f.id),d=[];for(let[m,h]of c)h===f.id&&d.push(m);if(!u||u.n===0){s.push({id:f.id,label:f.label,color:J(f.color),sectionIds:d,seatCount:0,center:[0,0,0],radius:0,focalWorld:[(f.focalPoint??i).x*O,1.5,(f.focalPoint??i).y*O]});continue}s.push({id:f.id,label:f.label,color:J(f.color),sectionIds:d,seatCount:u.n,center:[(u.minX+u.maxX)/2*O,u.sumY/u.n,(u.minY+u.maxY)/2*O],radius:.5*Math.hypot((u.maxX-u.minX)*O,(u.maxY-u.minY)*O)||1,focalWorld:[(f.focalPoint??i).x*O,1.5,(f.focalPoint??i).y*O]})}}return s}function zr(e){let{doc:t,units:n,seats:r,surfaces:o,seatData:i,hintedSeatFloor:a,zones:s,focal:c}=e,l=[],f=[],u=[];for(let d of s)d.seatCount!==0&&l.push({id:`zone:${d.id}`,kind:"zone",text:d.label,anchor:[d.center[0],d.center[1]+js,d.center[2]],color:t.zones?.find(m=>m.id===d.id)?.color});{let d=new Map,m=new Map;for(let h=0;h<r.length;h++){let p=o.seatOwner[h];if(!p)continue;let g=d.get(p);g||(g={n:0,x:0,y:0,deck:0},d.set(p,g)),g.n++,g.x+=r[h].x,g.y+=r[h].y,g.deck+=o.seatDeckY(h);let b=m.get(p);b||(b={minX:1/0,maxX:-1/0,minY:1/0,maxY:-1/0},m.set(p,b)),r[h].x<b.minX&&(b.minX=r[h].x),r[h].x>b.maxX&&(b.maxX=r[h].x),r[h].y<b.minY&&(b.minY=r[h].y),r[h].y>b.maxY&&(b.maxY=r[h].y)}for(let h of n)for(let p of h.objects){if(p.type!=="section")continue;let g=d.get(p.id);if(!g||g.n===0)continue;let b=m.get(p.id),y=[g.x/g.n*O,g.deck/g.n,g.y/g.n*O],x=p.displayLabel||p.label||p.id;f.push({id:p.id,floorIndex:h.index,label:x,seatCount:g.n,center:y,radius:Math.max(1,Math.hypot(b.maxX-b.minX,b.maxY-b.minY)*.5*O),focalWorld:[h.focal.x*O,h.baseHeightM+1.5,h.focal.y*O]});let v=t.floors?.[h.index]?.name?.trim().toLocaleLowerCase();n.length>1&&v===x.trim().toLocaleLowerCase()||l.push({id:`section:${p.id}`,kind:"section",text:x,anchor:[y[0],y[1]+Ys,y[2]],floorIndex:h.index})}}{for(let h of n)for(let p of h.objects){if(p.type!=="gaArea")continue;let g=wt(p.points);if(!g)continue;let b=p.displayLabel||p.label||p.id;l.push({id:`ga:${p.id}`,kind:"ga",text:p.capacity>0?`${b} \xB7 ${p.capacity.toLocaleString()}`:b,anchor:[g.x*O,h.baseHeightM+Ws,g.y*O],floorIndex:h.index})}let d=new Map;for(let h=0;h<r.length;h++){let p=r[h],g=Math.hypot(p.x-c.x,p.y-c.y),b=d.get(p.rowId);(!b||g>b.far)&&d.set(p.rowId,{seat:p,index:h,far:g})}for(let[h,p]of d){let g=p.seat.label?p.seat.label.lastIndexOf("-"):-1,b=g>0?p.seat.label.slice(0,g):h;b&&l.push({id:`row:${h}`,kind:"row",text:b,anchor:[p.seat.x*O,o.seatDeckY(p.index)+Ks,p.seat.y*O],floorIndex:a[p.index]})}let m=new Map;for(let h=0;h<r.length;h++){let p=r[h],g=p.label?p.label.lastIndexOf("-"):-1,b=m.get(p.rowId);b||(b={n:0,x:0,y:0,z:0,minX:1/0,maxX:-1/0,minZ:1/0,maxZ:-1/0,label:g>0?p.label.slice(0,g):p.rowId,sectionId:p.sectionId},m.set(p.rowId,b));let y=h*3,x=i.iPosition[y],v=i.iPosition[y+1],C=i.iPosition[y+2];b.n++,b.x+=x,b.y+=v,b.z+=C,b.minX=Math.min(b.minX,x),b.maxX=Math.max(b.maxX,x),b.minZ=Math.min(b.minZ,C),b.maxZ=Math.max(b.maxZ,C)}for(let[h,p]of m)u.push({id:h,label:p.label,sectionId:p.sectionId,seatCount:p.n,center:[p.x/p.n,p.y/p.n,p.z/p.n],radius:Math.max(.8,Math.hypot(p.maxX-p.minX,p.maxZ-p.minZ)*.5)});if(r.length<=Qs)for(let h=0;h<r.length;h++){let p=r[h],g=p.displayLabel||p.label;g&&l.push({id:`seat:${p.id}`,kind:"seat",text:g,anchor:[p.x*O,o.seatDeckY(h)+qs,p.y*O],floorIndex:a[h]})}}for(let d of n)for(let m of d.objects)if(m.type==="shape"&&m.role&&["entrance","exit","screen","suite","obstruction"].includes(m.role)){let h=Je(m),p=h?wt(h):null;if(!p||!m.label)continue;l.push({id:`architecture:${m.id}`,kind:"annotation",text:m.label,anchor:[p.x*O,d.baseHeightM+Rt(m).heightM+Nr,p.y*O],color:m.fill,floorIndex:d.index})}else if(m.type==="text"){if(!m.text)continue;l.push({id:`text:${m.id}`,kind:"annotation",text:m.text,anchor:[m.position.x*O,d.baseHeightM+Nr,m.position.y*O],color:m.color,rotation:m.rotation,floorIndex:d.index})}else if(m.type==="booth"){let h=kt(m);if(!h)continue;let p=wt(h);if(!p)continue;l.push({id:`booth:${m.id}`,kind:"booth",text:m.displayLabel||m.label||m.id,anchor:[p.x*O,d.baseHeightM+Hn+Xs,p.y*O],floorIndex:d.index})}return{labels:l,sections:f,rows:u}}function Ur(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 Hr(e){let{doc:t,units:n,seats:r,surfaces:o,solids:i,hintedSeatFloor:a,seatFloor:s}=e,c=[];{let l=n.map(()=>({minX:1/0,minY:1/0,minZ:1/0,maxX:-1/0,maxY:-1/0,maxZ:-1/0}));for(let d=0;d<i.floor.length;d+=1){let m=Math.max(0,Math.min(n.length-1,Math.round(i.floor[d]))),h=d*3,p=l[m];p.minX=Math.min(p.minX,i.position[h]),p.minY=Math.min(p.minY,i.position[h+1]),p.minZ=Math.min(p.minZ,i.position[h+2]),p.maxX=Math.max(p.maxX,i.position[h]),p.maxY=Math.max(p.maxY,i.position[h+1]),p.maxZ=Math.max(p.maxZ,i.position[h+2])}let f=new Map;for(let d=0;d<n.length;d++)for(let m of n[d].objects)m.type==="section"&&f.set(m.id,d);let u=n.map(()=>({n:0,minX:1/0,minY:1/0,minDeck:1/0,maxX:-1/0,maxY:-1/0,maxDeck:-1/0,sumX:0,sumDeck:0,sumZ:0}));for(let d=0;d<r.length;d++){let m=o.seatOwner[d],h=(m!==null?f.get(m):void 0)??a[d];if(h===void 0)continue;let p=u[h],g=r[d];p.n++,g.x<p.minX&&(p.minX=g.x),g.y<p.minY&&(p.minY=g.y),g.x>p.maxX&&(p.maxX=g.x),g.y>p.maxY&&(p.maxY=g.y);let b=o.seatDeckY(d);p.sumX+=g.x*O,p.sumDeck+=b,p.sumZ+=g.y*O,p.minDeck=Math.min(p.minDeck,b),p.maxDeck=Math.max(p.maxDeck,b+1.6),s[d]=h}for(let d=0;d<n.length;d++){let m=u[d],h=t.floors?.[d],p=l[d],g=Math.min(m.n?m.minX*O:n[d].focal.x*O-1,Number.isFinite(p.minX)?p.minX:1/0),b=Math.max(m.n?m.maxX*O:n[d].focal.x*O+1,Number.isFinite(p.maxX)?p.maxX:-1/0),y=Math.min(m.n?m.minY*O:n[d].focal.y*O-1,Number.isFinite(p.minZ)?p.minZ:1/0),x=Math.max(m.n?m.maxY*O:n[d].focal.y*O+1,Number.isFinite(p.maxZ)?p.maxZ:-1/0),v=Math.min(m.n?Math.min(n[d].baseHeightM,m.minDeck):n[d].baseHeightM,Number.isFinite(p.minY)?p.minY:1/0),C=Math.max(m.n?Math.max(m.maxDeck,v+.5):v+.5,Number.isFinite(p.maxY)?p.maxY:-1/0),M=[m.n?m.sumX/m.n:(g+b)/2,m.n?m.sumDeck/m.n:(v+C)/2,m.n?m.sumZ/m.n:(y+x)/2],I=Math.max(1,.5*Math.hypot(b-g,C-v,x-y));c.push({index:d,id:h?.id??`floor-${d}`,label:h?.name??(n.length>1?`Floor ${d+1}`:"Venue"),seatCount:m.n,center:M,radius:I,box:{min:[g,v,y],max:[b,C,x]},focalWorld:[n[d].focal.x*O,n[d].baseHeightM+1.5,n[d].focal.y*O]})}}return c}function qn(e,t){let n=1/0,r=1/0,o=-1/0,i=-1/0,a=(s,c)=>{s<n&&(n=s),c<r&&(r=c),s>o&&(o=s),c>i&&(i=c)};for(let s of t)a(s.x,s.y);for(let s of e)for(let c of s.objects)if(c.type==="section")for(let l of c.outline)a(l.x,l.y);else if(c.type==="shape"&&c.points)for(let l of c.points)a(l.x,l.y);else if(c.type==="gaArea")for(let l of c.points)a(l.x,l.y);else if(c.type==="booth"){let l=kt(c);if(l)for(let f of l)a(f.x,f.y)}else if(c.type==="table"){let l=jn(c);if(l)for(let f of l)a(f.x,f.y)}else if(c.type==="decorImage"){let l=Yn(c);if(l)for(let f of l)a(f.x,f.y)}return Number.isFinite(n)||(n=-100,r=-100,o=100,i=100),{minX:n,minY:r,maxX:o,maxY:i}}function jr(e,t,n,r,o,i){if(t.length===1){let a=Math.max(60,(o.maxX-o.minX+o.maxY-o.minY)*.06),s=At(o.minX-a,o.minY-a,o.maxX-o.minX+a*2,o.maxY-o.minY+a*2);ce(e,s,void 0,()=>0,-.4,i.ground,i.ground,se)}else{let a=t.reduce((m,h)=>h.baseHeightM<m.baseHeightM?h:m);e.setFloor(a.index);let s=n.filter((m,h)=>r[h]===a.index),c=qn([a],s),l=Math.hypot(c.maxX-c.minX,c.maxY-c.minY),f=Math.max(28,Math.min(80,l*.04)),u=At(c.minX-f,c.minY-f,c.maxX-c.minX+f*2,c.maxY-c.minY+f*2),d=a.baseHeightM-.03;ce(e,u,void 0,()=>d,d-.22,i.ground,i.ground,se)}}function Yr(e,t,n){let{cx:r,cz:o,radius:i}=n,a=1/0,s=1/0,c=1/0,l=-1/0,f=-1/0,u=-1/0,d=(p,g,b)=>{a=Math.min(a,p),l=Math.max(l,p),s=Math.min(s,g),f=Math.max(f,g),c=Math.min(c,b),u=Math.max(u,b)};for(let p=0;p<e.position.length;p+=3)d(e.position[p],e.position[p+1],e.position[p+2]);for(let p=0;p<t.count;p++){let g=p*3,b=t.iPosition[g],y=t.iPosition[g+1],x=t.iPosition[g+2],v=Math.max(.35,t.iMaxRadius[p]??.35);d(b-v,y,x-v),d(b+v,y+1.6,x+v)}Number.isFinite(a)||(a=r-i,l=r+i,s=0,f=i*.16,c=o-i,u=o+i);let m=[(a+l)/2,(s+f)/2,(c+u)/2],h=Math.max(1,.5*Math.hypot(l-a,f-s,u-c));return{center:m,radius:h,minY:s,maxY:f}}function Xr(e,t,n,r,o,i){let a=1/0,s=1/0,c=-1/0,l=-1/0;for(let v=0;v<e.count;v++){let C=v*3,M=e.iPosition[C],I=e.iPosition[C+2];M<a&&(a=M),M>c&&(c=M),I<s&&(s=I),I>l&&(l=I)}for(let v of t)a=Math.min(a,v.cx-v.halfX),c=Math.max(c,v.cx+v.halfX),s=Math.min(s,v.cz-v.halfZ),l=Math.max(l,v.cz+v.halfZ);let f=n.minX*O,u=n.maxX*O,d=n.minY*O,m=n.maxY*O,h=f,p=u,g=d,b=m;if(Number.isFinite(a)){let v=Math.max(2,.06*Math.hypot(c-a,l-s));h=Math.max(f,a-v),p=Math.min(u,c+v),g=Math.max(d,s-v),b=Math.min(m,l+v)}let y=Math.min(0,r),x=Math.max(o,i*.05);return{min:[h,y,g],max:[p,x,b]}}var Zs=/^data:image\/(?:png|jpe?g|webp|gif|avif);base64,[a-z0-9+/]+={0,2}$/i,$s=/[\s"'<>`\\]/;function Js(e){if(typeof e!="string"||!e||e.length>2e6||e!==e.trim())return!1;if(e.startsWith("data:"))return Zs.test(e);if($s.test(e))return!1;try{let t=new URL(e);return t.protocol==="https:"&&!t.username&&!t.password}catch{return!1}}function Wr(e){let t=e.trim();return Js(t)?t:null}var Qn="seatlayer.event-configuration/1";var ft=100,ec=120,tc=1e5,nc=1e4,oc=/^[a-f0-9]{64}$/,rc=new Set(["stage","screen","barrier","camera_platform","sound_desk","rigging_truss"]);function Tt(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function tt(e,t){return typeof e=="string"&&e.length>=1&&e.length<=t&&e.normalize("NFKC").trim()===e}function ic(e){return typeof e=="number"&&Number.isInteger(e)&&e>0}function Kr(e){return!Array.isArray(e)||e.length>tc||!e.every(t=>tt(t,ft))?null:[...new Set(e)].sort()}function ac(e){return!Tt(e)||!tt(e.chartId,ft)||!tt(e.version,ft)||e.sha256!==void 0&&(typeof e.sha256!="string"||!oc.test(e.sha256))?null:{chartId:e.chartId,version:e.version,...typeof e.sha256=="string"?{sha256:e.sha256}:{}}}function Zn(e,t,n){return typeof e=="number"&&Number.isFinite(e)&&e>=t&&e<=n}function sc(e){return Tt(e)?e.mode==="none"||e.mode==="opaque"?e.opacity===void 0?{mode:e.mode}:null:e.mode==="partial"&&Zn(e.opacity,.01,.99)?{mode:"partial",opacity:e.opacity}:null:null}function cc(e,t){if(e===void 0)return;if(!Array.isArray(e)||e.length>nc)return null;let n=new Set(t),r=new Set,o=new Set,i=0,a=[];for(let s of e){if(!Tt(s)||!tt(s.id,ft)||!tt(s.objectId,ft)||!n.has(s.objectId)||!rc.has(String(s.kind))||!Zn(s.heightM,.05,50)||s.baseElevationM!==void 0&&!Zn(s.baseElevationM,-10,100))return null;let c=sc(s.occlusion);if(!c||r.has(s.id)||o.has(s.objectId))return null;let l=s.contentImageUrl===void 0?void 0:typeof s.contentImageUrl=="string"?Wr(s.contentImageUrl):null;if(s.contentImageUrl!==void 0&&(!l||s.kind!=="screen"||++i>1))return null;r.add(s.id),o.add(s.objectId),a.push({id:s.id,objectId:s.objectId,kind:s.kind,heightM:s.heightM,...s.baseElevationM!==void 0?{baseElevationM:s.baseElevationM}:{},occlusion:c,...l?{contentImageUrl:l}:{}})}return a.sort((s,c)=>s.id.localeCompare(c.id))}function lc(e){let t=[];if(!Tt(e))return{issues:[{code:"invalid_export",path:"configuration",message:"Configuration must be an object"}]};e.schema!==Qn&&t.push({code:"unsupported_schema",path:"configuration.schema",message:`Configuration schema must be ${Qn}`}),tt(e.id,ft)||t.push({code:"invalid_id",path:"configuration.id",message:"Configuration id must contain 1 to 100 normalized characters"}),tt(e.label,ec)||t.push({code:"invalid_label",path:"configuration.label",message:"Configuration label must contain 1 to 120 normalized characters"}),ic(e.version)||t.push({code:"invalid_version",path:"configuration.version",message:"Configuration version must be a positive integer"});let n=ac(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=Tt(e.overlay)?e.overlay:null,o=Kr(r?.objectIds),i=Kr(r?.productionKillSeatIds),a=o?cc(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:Qn,id:e.id,label:e.label,version:e.version,baseVenue:n,overlay:{objectIds:o,productionKillSeatIds:i,...a!==void 0?{productionElements:a}:{}}}}}function qr(e){let t=lc(e);return t.value?{ok:!0,value:t.value}:{ok:!1,issues:t.issues}}function Qr(e,t,n){let r=()=>({byObjectId:new Map,elements:[]});if(!t||!e)return r();let o=qr(t);if(!o.ok||o.value.id!==e)return r();let i=new Map;for(let u of n)for(let d of u.objects)d.type==="shape"&&i.set(d.id,{shape:d,unit:u});let a=new Set,s=new Set,c=new Map((t.overlay.productionElements??[]).map(u=>{let d=u.runtimeContentImageUrl;return[u.id,typeof d=="string"&&/^(?:blob:|data:image\/|https:\/\/)/.test(d)?d:void 0]})),l=[];for(let u of o.value.overlay.productionElements??[]){let d=i.get(u.objectId),m=d?Je(d.shape):null,h=u.baseElevationM??0;if(!d||!m||m.length<3||!u.id||a.has(u.id)||s.has(u.objectId)||!Number.isFinite(u.heightM)||u.heightM<.05||u.heightM>50||!Number.isFinite(h)||h<-10||h>100)return r();a.add(u.id),s.add(u.objectId);let p=m.map(_=>_.x*O),g=m.map(_=>_.y*O),b=d.unit.baseHeightM+h,y=Math.min(...p),x=Math.max(...p),v=Math.min(...g),C=Math.max(...g),M,I=c.get(u.id)??u.contentImageUrl;if(u.kind==="screen"&&I)if(x-y>=C-v){let _=Math.abs(v-d.unit.focal.y*O)<=Math.abs(C-d.unit.focal.y*O)?v-.006:C+.006;M=[[y,b,_],[x,b,_],[y,b+u.heightM,_],[x,b+u.heightM,_]]}else{let _=Math.abs(y-d.unit.focal.x*O)<=Math.abs(x-d.unit.focal.x*O)?y-.006:x+.006;M=[[_,b,v],[_,b,C],[_,b+u.heightM,v],[_,b+u.heightM,C]]}l.push({id:u.id,objectId:u.objectId,kind:u.kind,floorIndex:d.unit.index,baseY:b,topY:b+u.heightM,bounds:{min:[y,b,v],max:[x,b+u.heightM,C]},occlusion:u.occlusion,...I?{contentImageUrl:I}:{},...M?{contentPlane:M}:{}})}let f=l.sort((u,d)=>u.id.localeCompare(d.id));return{byObjectId:new Map(f.map(u=>[u.objectId,u])),elements:f}}function ge(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function be(e){return Array.isArray(e)?e:[]}function uc(e){let t=[e];for(;t.length;){let n=t.pop();if(Array.isArray(n)){t.push(...n);continue}if(!ge(n))continue;let r=ge(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 tn(e,t){return!Array.isArray(e)||e.length!==t||!e.every(n=>typeof n=="number"&&Number.isFinite(n))?null:e}function dc(){return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}function mc(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 fc(e){let t=tn(e.matrix,16);if(t)return t;if(e.matrix!==void 0)return null;let n=e.translation===void 0?[0,0,0]:tn(e.translation,3),r=e.rotation===void 0?[0,0,0,1]:tn(e.rotation,4),o=e.scale===void 0?[1,1,1]:tn(e.scale,3);if(!n||!r||!o)return null;let[i,a,s,c]=r,l=Math.hypot(i,a,s,c);if(!(l>1e-8))return null;let f=i/l,u=a/l,d=s/l,m=c/l,h=f+f,p=u+u,g=d+d,b=f*h,y=f*p,x=f*g,v=u*p,C=u*g,M=d*g,I=m*h,_=m*p,B=m*g;return[(1-(v+M))*o[0],(y+B)*o[0],(x-_)*o[0],0,(y-B)*o[1],(1-(b+M))*o[1],(C+I)*o[1],0,(x+_)*o[2],(C-I)*o[2],(1-(b+v))*o[2],0,n[0],n[1],n[2],1]}function hc(e,t,n,r){return[e[0]*t+e[4]*n+e[8]*r+e[12],e[1]*t+e[5]*n+e[9]*r+e[13],e[2]*t+e[6]*n+e[10]*r+e[14]]}function pc(e){let t=e[0],n=e[4],r=e[8],o=e[1],i=e[5],a=e[9],s=e[2],c=e[6],l=e[10],f=i*l-a*c,u=a*s-o*l,d=o*c-i*s,m=t*f+n*u+r*d;if(Math.abs(m)<1e-12)return null;let h=1/m;return[f*h,u*h,d*h,(r*c-n*l)*h,(t*l-r*s)*h,(n*s-t*c)*h,(n*a-r*i)*h,(r*o-t*a)*h,(t*i-n*o)*h]}function Zr(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 bc(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(!ge(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 gc(e){return e===5120||e===5121?1:e===5122||e===5123?2:e===5125||e===5126?4:0}function yc(e){return e==="SCALAR"?1:e==="VEC2"?2:e==="VEC3"?3:e==="VEC4"?4:0}function xc(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 vc(e){let t=e instanceof Uint8Array?e:new Uint8Array(e),n=bc(t);if(!n)return{ok:!1,issue:"invalid_glb"};let{json:r,bin:o}=n;if(!ge(r.asset)||r.asset.version!=="2.0")return{ok:!1,issue:"unsupported_glb"};let i=be(r.extensionsUsed).filter(v=>typeof v=="string");if(i.includes("KHR_draco_mesh_compression")||uc(r))return{ok:!1,issue:"draco_not_allowed"};if(i.length||be(r.extensionsRequired).length)return{ok:!1,issue:"unsupported_glb"};if(be(r.images).length||be(r.textures).length)return{ok:!1,issue:"external_resource"};let a=be(r.buffers);if(a.length!==1||!ge(a[0])||a[0].uri!==void 0||typeof a[0].byteLength!="number"||!Number.isInteger(a[0].byteLength)||a[0].byteLength<0||a[0].byteLength>o.byteLength)return{ok:!1,issue:"external_resource"};let s=be(r.accessors),c=be(r.bufferViews),l=be(r.meshes),f=be(r.nodes),u=be(r.scenes),d=typeof r.scene=="number"?r.scene:0;if(!ge(u[d]))return{ok:!1,issue:"unsupported_glb"};let m=new DataView(o.buffer,o.byteOffset,o.byteLength),h=(v,C,M)=>{if(typeof v!="number"||!Number.isInteger(v)||!ge(s[v]))return null;let I=s[v];if(I.type!==C||I.sparse!==void 0||I.normalized===!0||typeof I.count!="number"||!Number.isInteger(I.count)||I.count<1||typeof I.componentType!="number"||!M.includes(I.componentType)||typeof I.bufferView!="number")return null;let _=c[I.bufferView];if(!ge(_)||_.buffer!==0||typeof _.byteLength!="number"||!Number.isInteger(_.byteLength)||_.byteLength<0)return null;let B=yc(I.type),z=gc(I.componentType),V=typeof _.byteStride=="number"?_.byteStride:B*z,A=typeof _.byteOffset=="number"?_.byteOffset:0,S=typeof I.byteOffset=="number"?I.byteOffset:0,R=A+S,w=S+(I.count-1)*V+B*z;if(!Number.isInteger(V)||!Number.isInteger(A)||!Number.isInteger(S)||V<B*z||A<0||S<0||A+_.byteLength>o.byteLength||w>_.byteLength)return null;let P=[];for(let G=0;G<I.count;G++){let k=[];for(let E=0;E<B;E++){let F=xc(m,R+G*V+E*z,I.componentType);if(!Number.isFinite(F))return null;k.push(F)}P.push(k)}return P},p=[],g=[],b=0,y=new Set,x=(v,C)=>{if(typeof v!="number"||!Number.isInteger(v)||!ge(f[v])||y.has(v))return!1;y.add(v);let M=f[v],I=fc(M);if(!I)return!1;let _=mc(C,I),B=pc(_);if(!B)return!1;if(M.mesh!==void 0){if(typeof M.mesh!="number")return!1;let z=l[M.mesh];if(!ge(z))return!1;for(let V of be(z.primitives)){if(!ge(V)||V.mode!==void 0&&V.mode!==4||!ge(V.attributes))return!1;let A=h(V.attributes.POSITION,"VEC3",[5126]),S=V.attributes.NORMAL===void 0?null:h(V.attributes.NORMAL,"VEC3",[5126]);if(!A||V.attributes.NORMAL!==void 0&&!S)return!1;let R=A.length;if(V.indices!==void 0){let P=typeof V.indices=="number"?s[V.indices]:null;R=ge(P)?P.count:void 0}if(typeof R!="number"||!Number.isInteger(R)||R%3!==0||(b+=R/3,b>1e5))return!1;let w=V.indices===void 0?A.map((P,G)=>[G]):h(V.indices,"SCALAR",[5121,5123,5125]);if(!w||w.length%3!==0||w.length!==R)return!1;for(let P=0;P<w.length;P+=3){let G=[w[P][0],w[P+1][0],w[P+2][0]];if(G.some(F=>!Number.isInteger(F)||F<0||F>=A.length))return!1;let k=G.map(F=>hc(_,...A[F])),E=null;if(!S){let F=k[1][0]-k[0][0],D=k[1][1]-k[0][1],N=k[1][2]-k[0][2],j=k[2][0]-k[0][0],U=k[2][1]-k[0][1],T=k[2][2]-k[0][2];E=Zr([1,0,0,0,1,0,0,0,1],D*T-N*U,N*j-F*T,F*U-D*j)}for(let F=0;F<3;F++)p.push(...k[F]),g.push(...S?Zr(B,...S[G[F]]):E)}}}for(let z of be(M.children))if(!x(z,_))return!1;return y.delete(v),!0};for(let v of be(u[d].nodes))if(!x(v,dc()))return{ok:!1,issue:b>1e5?"triangle_limit":"unsupported_glb"};return!b||p.length!==b*9||g.length!==p.length?{ok:!1,issue:"unsupported_glb"}:{ok:!0,triangleCount:b,position:new Float32Array(p),normal:new Float32Array(g)}}function $r(e){try{return vc(e)}catch{return{ok:!1,issue:"invalid_glb"}}}function ht(e){let{doc:t}=e,n=Ho(t.theme),r=n.structure,o=ur(t,e.eventConfigurationId??t.eventConfigurationId),i=Qr(e.eventConfigurationId,e.eventConfiguration,o),a=e.seats,s=new Yt,c=null;if(e.registeredShellGlb){let w=$r(e.registeredShellGlb);if(w.ok){let P=w.position.length/3,G=new Float32Array(w.position.length),k=n.materials.shell??r.tierWall;for(let E=0;E<P;E++){let F=w.normal[E*3+1],D=F<-.25?.4:.62+.38*Math.max(0,F);G[E*3]=k[0]*D,G[E*3+1]=k[1]*D,G[E*3+2]=k[2]*D}c={position:w.position,normal:w.normal,color:G,floor:new Float32Array(P).fill(-2),material:new Float32Array(P),count:P}}}let l=new Map;for(let w of o)for(let P of w.objects)l.set(P.id,w.index),P.type==="section"&&l.set(P.logicalSectionId??P.id,w.index);let f=a.map(w=>l.get(w.sectionId??"")??l.get(w.rowId??"")??0),u=qn(o,a);jr(s,o,a,f,u,r);let d=pr(t,a),m=new Map,h=new Map;for(let w of t.categories??[])m.set(w.key,w.color),w.seatGlyph&&h.set(w.key,w.seatGlyph);let p=[],g=hr(o,a,f),b=new Float32Array(a.length);for(let w=0;w<o.length;w++){let P=o[w];s.setFloor(w);let G=new $t,k=[],E=P.objects.filter(F=>F.type==="section"&&!!F.outline&&F.outline.length>=3);for(let F of P.objects)if(F.type==="section")Tr(s,F,P,br(F,d),g.bySection.get(F.id),G,E,r);else if(F.type==="shape"){let D=i.byObjectId.get(F.id);s.setMaterial((D?.kind??F.role)==="screen"?1:0),Pr(s,F,P.baseHeightM,xr(F,k),r,P.focal,p,D),s.setMaterial(0)}else F.type==="gaArea"?Ir(s,F,P.baseHeightM,J(m.get(F.categoryKey)),r):F.type==="booth"?Sr(s,F,P.baseHeightM,J(m.get(F.categoryKey)),r):F.type==="table"?wr(s,F,P.baseHeightM,J(m.get(F.categoryKey)),r):F.type==="decorImage"&&Cr(s,F,P.baseHeightM,r);Lr(s,P,a,g,r,n.materials.shell,!c)}let y=o.length>1?{x:o.reduce((w,P)=>w+P.focal.x,0)/o.length,y:o.reduce((w,P)=>w+P.focal.y,0)/o.length}:t.focalPoint??{x:(u.minX+u.maxX)/2,y:(u.minY+u.maxY)/2},x=Bo(c?[s.build(),c]:[s.build()]),v=Uo(a,e.initialState,g,b,m,h),C=Gr({doc:t,units:o,seats:a,surfaces:g,focal:y}),{labels:M,sections:I,rows:_}=zr({doc:t,units:o,seats:a,surfaces:g,seatData:v,hintedSeatFloor:f,zones:C,focal:y}),B=Hr({doc:t,units:o,seats:a,surfaces:g,solids:x,hintedSeatFloor:f,seatFloor:b});Ur(M,B),v.iYaw=Go(v.iPosition,a.length,w=>a[w].rowId,w=>{let P=o[b[w]]?.focal??y;return[P.x*O,P.y*O]});let z=(u.minX+u.maxX)/2*O,V=(u.minY+u.maxY)/2*O,A=.5*Math.hypot((u.maxX-u.minX)*O,(u.maxY-u.minY)*O)||10,S=Yr(x,v,{cx:z,cz:V,radius:A}),R=Xr(v,p,u,S.minY,S.maxY,A);return{solids:x,seats:v,bounds:{center:[(R.min[0]+R.max[0])/2,(R.min[1]+R.max[1])/2,(R.min[2]+R.max[2])/2],radius:A,groundY:0,box:R},renderBounds:{center:S.center,radius:S.radius},stateColorLUT:jo(n,Me),theme:n,seatCount:a.length,focalWorld:[y.x*O,1.5,y.y*O],zones:C,stages:p,productionElements:i.elements,sections:I,rows:_,labels:M,floors:B}}var Mc=88,Sc=20,Jr={floor:{size:14,weight:"700",opacity:.98},zone:{size:15,weight:"600",opacity:.95},section:{size:12,weight:"500",opacity:.88},ga:{size:12,weight:"500",opacity:.88},booth:{size:11,weight:"500",opacity:.85},annotation:{size:11,weight:"400",opacity:.75},row:{size:10.5,weight:"600",opacity:.8},seat:{size:9.5,weight:"500",opacity:.72}},nn=new Set(["row","seat"]),ei={floor:5,zone:4,section:3,ga:3,booth:2,annotation:1},on={row:{x:62,y:16},seat:{x:46,y:18}},ti=J,$n=e=>ho(e);function ni(e,t){let n=$n(e),r=$n(t);return(Math.max(n,r)+.05)/(Math.min(n,r)+.05)}function Jn(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 wc(e,t=[.04,.06,.1],n=!0){let r=$n(t)<.42,o=r?"#f4f7fb":"#0b1220",i=r?"rgba(8,12,22,.78)":"rgba(255,255,255,.84)",a=n?Jn(i,t):t,s=ti(e),c=n?7:4.5,l=s&&ni(s,a)>=c?e:o;return r?{ink:l,backing:i,border:"rgba(210,222,245,.24)"}:{ink:l,backing:i,border:"rgba(11,18,32,.22)"}}var rn=class{constructor(t,n={}){this.nodes=new Map;this.labels=[];this.forcedDense=!1;this.selectedSeatLabelIds=new Set;this.opts=n,this.root=document.createElement("div"),this.root.setAttribute("data-view3d-labels","");let r=this.root.style;r.position="absolute",r.inset="0",r.pointerEvents="none",r.overflow="hidden",n.fontFamily&&(r.fontFamily=n.fontFamily),t.appendChild(this.root)}setVisible(t){this.root.style.visibility=t?"":"hidden"}setLabels(t){this.labels=t;for(let[n,r]of this.nodes)t.some(o=>o.id===n)||(r.remove(),this.nodes.delete(n))}setForcedDense(t){this.forcedDense=t}setSelectedSeatIds(t){this.selectedSeatLabelIds=new Set(Array.from(t,n=>`seat:${n}`))}qualityEvidence(){let t=this.root.getBoundingClientRect(),n=this.root.style.visibility!=="hidden";return this.labels.map(r=>{let o=this.nodes.get(r.id),i=o?.getBoundingClientRect(),a=!!(n&&o&&o.style.display!=="none"&&i&&i.width>0&&i.height>0);return{id:r.id,kind:r.kind,text:r.text,visible:a,renderedFontPx:o&&Number.parseFloat(o.style.fontSize)||0,contrast:o?Number(o.dataset.qualityContrast??0):0,...a&&i?{screenBox:{x:i.x-t.x,y:i.y-t.y,width:i.width,height:i.height}}:{}}})}update(t,n,r,o,i,a){if(!this.labels.length)return;let s=Dr(o,i,{hasZoneLabels:this.labels.some(y=>y.kind==="zone")});this.forcedDense&&(s.add("row"),s.add("seat"));let c=[];for(let y of this.labels){if(!s.has(y.kind))continue;let x=Ue(t,y.anchor,n,r);if(!x.visible)continue;let v=a?Math.hypot(y.anchor[0]-a[0],y.anchor[1]-a[1],y.anchor[2]-a[2]):1;c.push({label:y,screen:x,focus:Vr(x,v,n,r),halfWidth:Br(y.text,Jr[y.kind].size,!nn.has(y.kind))/2,...this.selectedSeatLabelIds.has(y.id)?{priority:1}:{}})}let l=Fr(c.filter(y=>y.label.kind==="floor"),n),f=[...c.filter(y=>!nn.has(y.label.kind)&&y.label.kind!=="floor"),...l],u=Or(f,Mc,Sc),d=Kn(c.filter(y=>y.label.kind==="row"),on.row.x,on.row.y,Wn.row,u),m=Kn(c.filter(y=>y.label.kind==="seat"),on.seat.x,on.seat.y,Wn.seat,[...u,...d]),h=[...u,...d,...m],p=new Set(h.map(y=>y.label.id));for(let{label:y,screen:x}of h){let C=this.nodeFor(y).style;C.display="",C.transform=`translate(-50%, -50%) translate(${x.x.toFixed(1)}px, ${x.y.toFixed(1)}px)`}let g=h.filter(({label:y})=>!nn.has(y.kind)).sort((y,x)=>ei[x.label.kind]-ei[y.label.kind]||y.screen.depth-x.screen.depth||y.focus-x.focus),b=[];for(let{label:y}of g){let x=this.nodes.get(y.id);if(!x||x.style.display==="none")continue;let v=x.getBoundingClientRect();b.some(M=>v.left<M.right+3&&v.right+3>M.left&&v.top<M.bottom+3&&v.bottom+3>M.top)?x.style.display="none":b.push(v)}for(let[y,x]of this.nodes)p.has(y)||(x.style.display="none")}nodeFor(t){let n=this.nodes.get(t.id);if(!n){n=document.createElement("div");let u=n.style;u.position="absolute",u.left="0",u.top="0",u.whiteSpace="nowrap",u.textShadow="0 1px 3px rgba(0,0,0,0.85), 0 0 8px rgba(0,0,0,0.55)",u.display="none",this.root.appendChild(n),this.nodes.set(t.id,n)}n.textContent=t.text,n.setAttribute("data-label-kind",t.kind);let r=this.selectedSeatLabelIds.has(t.id);n.toggleAttribute("data-selected-seat",r);let o=Jr[t.kind],i=n.style;i.fontSize=`${o.size}px`,i.fontWeight=r?"800":o.weight,i.opacity=r?"1":String(o.opacity);let a=!nn.has(t.kind),s=wc(t.color??this.opts.ink,this.opts.backgroundRgb,a);i.color=r?"#ecf8ff":s.ink,i.background=r?"rgba(10,28,45,.9)":a?s.backing:"",i.border=r?"1px solid rgba(89,199,255,.92)":a?`1px solid ${s.border}`:"",i.borderRadius=r||a?"999px":"",i.padding=r||a?"3px 7px":"",i.boxShadow=r?"0 0 0 2px rgba(41,176,255,.18), 0 5px 14px rgba(0,0,0,.35)":a?"0 3px 10px rgba(0,0,0,.24)":"",i.letterSpacing=t.kind==="zone"||t.kind==="floor"?"0.08em":"0.02em";let c=this.opts.backgroundRgb??[.04,.06,.1],l=ti(r?"#ecf8ff":s.ink)??[1,1,1],f=r?Jn("rgba(10,28,45,.9)",c):a?Jn(s.backing,c):c;return n.dataset.qualityContrast=ni(l,f).toFixed(3),(t.kind==="zone"||t.kind==="floor")&&(i.textTransform="uppercase"),n}dispose(){this.root.remove(),this.nodes.clear()}};var ri=1;var Pc=new Set(["floor","zone","section","ga","booth","annotation"]);function Cc(e){return e.every(t=>Number.isFinite(t))}function Ic(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 oi(e){return e.length?Math.round(Math.min(...e)*100)/100:null}function nt(e){return Math.round(e*1e4)/1e4}function Ac(e){if(e)return{box:{x:nt(e.box.x),y:nt(e.box.y),width:nt(e.box.width),height:nt(e.box.height)},horizontalFillRatio:nt(e.horizontalFillRatio),verticalFillRatio:nt(e.verticalFillRatio),visibleAreaRatio:nt(e.visibleAreaRatio),clippedEdges:[...e.clippedEdges]}}function Ee(e,t,n){return n.length?{code:e,message:t,count:n.length,samples:n.slice(0,20)}:null}function an(e){let t=e.labels.filter(s=>s.visible&&s.screenBox),n=t.filter(s=>Pc.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)Ic(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=[Ee("webgl2-unavailable","The venue scene must render through WebGL2",e.context.webgl2?[]:[{primaryId:"renderer",primaryLabel:"WebGL2"}]),Ee("context-lost","The WebGL context must be live at capture",e.context.lost?[{primaryId:"renderer",primaryLabel:"context lost"}]:[]),Ee("frame-not-stable","The captured 3D frame must be rendered and parked",e.frame.rendered>0&&e.frame.idle?[]:[{primaryId:"renderer",primaryLabel:"unstable frame"}]),Ee("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}`}]),Ee("camera-invalid","The capture camera must have a finite physical pose",Cc(i)&&e.camera.distance>0&&e.camera.verticalFovDeg>0&&e.camera.verticalFovDeg<180?[]:[{primaryId:"camera",primaryLabel:"invalid pose"}]),Ee("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}]),Ee("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`}]),Ee("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}))),Ee("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}))),Ee("hierarchy-label-collision","Visible 3D hierarchy labels must not overlap",o)].filter(s=>!!s);return{version:1,state:"venue3d",passed:a.length===0,resolvedRules:["rendered-3d-webgl-context","rendered-3d-stable-frame","rendered-3d-camera-pose","rendered-3d-relief-projection","rendered-3d-label-size","rendered-3d-label-contrast","rendered-3d-label-collision"],viewport:e.viewport,context:e.context,frame:e.frame,camera:e.camera,scene:e.scene,composition:{visibleLabels:t.map(({id:s,kind:c,text:l})=>({id:s,kind:c,text:l})).sort((s,c)=>s.kind.localeCompare(c.kind)||s.id.localeCompare(c.id)),framing:Ac(e.framing)},metrics:{minimumHierarchyFontPx:oi(n.map(s=>s.renderedFontPx)),minimumHierarchyContrast:oi(n.map(s=>s.contrast)),projectedReliefPx:Math.round(e.scene.projectedReliefPx*100)/100},findings:a}}var ae=require("ogl");var He=require("ogl");var sn=`
|
|
21
21
|
float chairWeight(float depth) {
|
|
22
22
|
return 1.0 - smoothstep(uChairFull, uChairNone, depth);
|
|
23
|
-
}
|
|
23
|
+
}`,ii=`
|
|
24
24
|
float occupantWeight(float depth) {
|
|
25
|
-
float nearWeight = smoothstep(${
|
|
26
|
-
float farWeight = 1.0 - smoothstep(${
|
|
25
|
+
float nearWeight = smoothstep(${So.toFixed(1)}, ${wo.toFixed(1)}, depth);
|
|
26
|
+
float farWeight = 1.0 - smoothstep(${vo.toFixed(1)}, ${Mo.toFixed(1)}, depth);
|
|
27
27
|
return nearWeight * farWeight;
|
|
28
|
-
}`,
|
|
28
|
+
}`,ai=`
|
|
29
29
|
float glyphEq(float glyph, float expected) {
|
|
30
30
|
return 1.0 - step(0.25, abs(glyph - expected));
|
|
31
31
|
}
|
|
@@ -74,7 +74,7 @@ vec3 glyphChairPosition(vec3 p, float partId, float glyph) {
|
|
|
74
74
|
p.y += 0.16;
|
|
75
75
|
}
|
|
76
76
|
return p;
|
|
77
|
-
}`,
|
|
77
|
+
}`,Rc=`#version 300 es
|
|
78
78
|
precision highp float;
|
|
79
79
|
in vec3 position;
|
|
80
80
|
in vec3 normal;
|
|
@@ -97,7 +97,9 @@ out float vMaterial;
|
|
|
97
97
|
void main() {
|
|
98
98
|
// Per-floor isolation without splitting the merged mesh into a draw call per
|
|
99
99
|
// floor. The fragment pass removes non-focused floors for a clean level view.
|
|
100
|
-
|
|
100
|
+
// A registered venue-wide shell uses floor -2 and remains context while a
|
|
101
|
+
// buyer focuses an individual level. Ordinary authored solids stay scoped.
|
|
102
|
+
vDim = (floorIndex < -1.5 || uFocusFloor < -0.5 || abs(floorIndex - uFocusFloor) < 0.5) ? 0.0 : 1.0;
|
|
101
103
|
vMaterial = materialIndex;
|
|
102
104
|
vec4 world = modelMatrix * vec4(position, 1.0);
|
|
103
105
|
vec4 mv = modelViewMatrix * vec4(position, 1.0);
|
|
@@ -110,7 +112,7 @@ void main() {
|
|
|
110
112
|
vNormalWorld = normalize(mat3(modelMatrix) * normal);
|
|
111
113
|
vColor = color;
|
|
112
114
|
gl_Position = projectionMatrix * mv;
|
|
113
|
-
}`,
|
|
115
|
+
}`,Ec=`#version 300 es
|
|
114
116
|
precision highp float;
|
|
115
117
|
in vec3 vColor;
|
|
116
118
|
in vec3 vNormalWorld;
|
|
@@ -121,6 +123,7 @@ in float vDim;
|
|
|
121
123
|
in float vMaterial;
|
|
122
124
|
uniform vec3 uKeyDir; // WORLD space, unit, points at the light
|
|
123
125
|
uniform float uStructureDetail;
|
|
126
|
+
uniform float uRoughness;
|
|
124
127
|
out vec4 fragColor;
|
|
125
128
|
void main() {
|
|
126
129
|
if (vDim > 0.5) discard;
|
|
@@ -151,7 +154,12 @@ void main() {
|
|
|
151
154
|
float fill = max(dot(N, fillDir), 0.0);
|
|
152
155
|
vec3 base = vColorRung * (0.52 + 0.34 * hemi) + vColorRung * key * 0.34 + vColorRung * fill * 0.10;
|
|
153
156
|
float fres = pow(1.0 - max(dot(normalize(vNormalView), V), 0.0), 3.0);
|
|
154
|
-
|
|
157
|
+
// Material 1 is a powered display and keeps its authored emission treatment.
|
|
158
|
+
// Every architectural material uses the venue roughness token; 0.78 maps to
|
|
159
|
+
// exactly the historical rim strength so an unthemed chart does not shift.
|
|
160
|
+
float poweredMaterial = 1.0 - step(0.5, abs(vMaterial - 1.0));
|
|
161
|
+
float sheen = mix(clamp((1.0 - uRoughness) / 0.22, 0.15, 2.0), 1.0, poweredMaterial);
|
|
162
|
+
base += vec3(0.26, 0.31, 0.38) * fres * 0.35 * sheen; // cool rim, restrained
|
|
155
163
|
// Bright, saturated authored screen faces should read as powered displays,
|
|
156
164
|
// not painted slabs. Vertex colour is deliberately the material signal here:
|
|
157
165
|
// muted tiers and structure never cross these thresholds. The broad waves
|
|
@@ -177,7 +185,7 @@ void main() {
|
|
|
177
185
|
+ vec3(0.20, 0.10, 0.34) * focalHalo;
|
|
178
186
|
base = mix(base, display, poweredDisplay * verticalFace * 0.92);
|
|
179
187
|
fragColor = vec4(base, 1.0);
|
|
180
|
-
}`,
|
|
188
|
+
}`,kc=`#version 300 es
|
|
181
189
|
precision highp float;
|
|
182
190
|
in vec2 position; // quad corner in [-1,1]
|
|
183
191
|
in vec3 iOffset; // per-instance world position
|
|
@@ -203,7 +211,7 @@ out float vDim;
|
|
|
203
211
|
out float vDotWeight; // 1 = the dot IS this seat, 0 = the chair has taken over
|
|
204
212
|
out float vPhysicalSeat;
|
|
205
213
|
out float vPixelRadius;
|
|
206
|
-
${
|
|
214
|
+
${sn}
|
|
207
215
|
void main() {
|
|
208
216
|
vec4 mv = modelViewMatrix * vec4(iOffset, 1.0);
|
|
209
217
|
float depth = max(-mv.z, 0.001);
|
|
@@ -236,7 +244,7 @@ void main() {
|
|
|
236
244
|
vPhysicalSeat = iPhysicalSeat;
|
|
237
245
|
vDim = (uFocusFloor < -0.5 || abs(iFloor - uFocusFloor) < 0.5) ? 0.0 : 1.0;
|
|
238
246
|
gl_Position = projectionMatrix * mv;
|
|
239
|
-
}`,
|
|
247
|
+
}`,Tc=`#version 300 es
|
|
240
248
|
precision highp float;
|
|
241
249
|
in vec2 vUv;
|
|
242
250
|
in vec3 vColor;
|
|
@@ -249,6 +257,7 @@ in float vPixelRadius;
|
|
|
249
257
|
uniform float uSeatFade; // fade toward tier colour with distance (LOD)
|
|
250
258
|
uniform float uSeatDetail; // 0 for venue/area overview; 1 in section/row/seat
|
|
251
259
|
uniform vec3 uFadeColor;
|
|
260
|
+
uniform float uRoughness;
|
|
252
261
|
out vec4 fragColor;
|
|
253
262
|
void main() {
|
|
254
263
|
if (vDim > 0.5) discard;
|
|
@@ -294,7 +303,7 @@ void main() {
|
|
|
294
303
|
alpha *= vDotWeight;
|
|
295
304
|
if (alpha <= 0.0) discard;
|
|
296
305
|
fragColor = vec4(c, alpha);
|
|
297
|
-
}`,
|
|
306
|
+
}`,Lc=`#version 300 es
|
|
298
307
|
precision highp float;
|
|
299
308
|
in vec3 position; // local: x/z in units of the seat radius, y in METRES
|
|
300
309
|
in vec3 normal;
|
|
@@ -325,9 +334,9 @@ out vec3 vRing;
|
|
|
325
334
|
out float vDim;
|
|
326
335
|
out float vOccupant; // 1 = this vertex belongs to a person, not to the chair
|
|
327
336
|
out vec3 vOccupantTint;
|
|
328
|
-
${
|
|
329
|
-
${
|
|
330
|
-
${
|
|
337
|
+
${sn}
|
|
338
|
+
${ii}
|
|
339
|
+
${ai}
|
|
331
340
|
void main() {
|
|
332
341
|
vec4 anchor = modelViewMatrix * vec4(iOffset, 1.0);
|
|
333
342
|
float viewDepth = -anchor.z;
|
|
@@ -413,7 +422,7 @@ void main() {
|
|
|
413
422
|
vRing = iRing;
|
|
414
423
|
vDim = (uFocusFloor < -0.5 || abs(iFloor - uFocusFloor) < 0.5) ? 0.0 : 1.0;
|
|
415
424
|
gl_Position = projectionMatrix * mv;
|
|
416
|
-
}`,
|
|
425
|
+
}`,_c=`#version 300 es
|
|
417
426
|
precision highp float;
|
|
418
427
|
in vec3 vColor;
|
|
419
428
|
in vec3 vNormalWorld;
|
|
@@ -427,6 +436,7 @@ in float vOccupant;
|
|
|
427
436
|
in vec3 vOccupantTint;
|
|
428
437
|
uniform vec3 uKeyDir;
|
|
429
438
|
uniform vec3 uFadeColor;
|
|
439
|
+
uniform float uRoughness;
|
|
430
440
|
out vec4 fragColor;
|
|
431
441
|
void main() {
|
|
432
442
|
if (vDim > 0.5) discard;
|
|
@@ -466,16 +476,17 @@ void main() {
|
|
|
466
476
|
float fres = pow(1.0 - max(dot(normalize(vNormalView), V), 0.0), 3.0);
|
|
467
477
|
// A brighter rim than the solids get: it picks out every chair's own edge,
|
|
468
478
|
// which is what stops a block of them merging into one mass up close.
|
|
469
|
-
|
|
479
|
+
float sheen = clamp((1.0 - uRoughness) / 0.22, 0.15, 2.0);
|
|
480
|
+
base += vec3(0.26, 0.31, 0.38) * fres * 0.55 * mix(sheen, 1.0, vOccupant);
|
|
470
481
|
fragColor = vec4(base, 1.0);
|
|
471
|
-
}`,
|
|
482
|
+
}`,Fc=`#version 300 es
|
|
472
483
|
precision highp float;
|
|
473
484
|
in vec2 position;
|
|
474
485
|
out vec2 vUv;
|
|
475
486
|
void main() {
|
|
476
487
|
vUv = position * 0.5 + 0.5;
|
|
477
488
|
gl_Position = vec4(position, 0.999, 1.0);
|
|
478
|
-
}`,
|
|
489
|
+
}`,Dc=`#version 300 es
|
|
479
490
|
precision highp float;
|
|
480
491
|
in vec2 vUv;
|
|
481
492
|
uniform vec3 uTop;
|
|
@@ -486,7 +497,7 @@ void main() {
|
|
|
486
497
|
vec2 c = vUv - 0.5;
|
|
487
498
|
float vig = 1.0 - dot(c, c) * 0.85; // soft vignette
|
|
488
499
|
fragColor = vec4(col * vig, 1.0);
|
|
489
|
-
}`,
|
|
500
|
+
}`,Oc=`#version 300 es
|
|
490
501
|
precision highp float;
|
|
491
502
|
in vec2 position;
|
|
492
503
|
in vec3 iOffset;
|
|
@@ -507,7 +518,7 @@ out float vPhysicalSeat;
|
|
|
507
518
|
out float vDotWeight;
|
|
508
519
|
out float vHidden;
|
|
509
520
|
flat out vec3 vPick;
|
|
510
|
-
${
|
|
521
|
+
${sn}
|
|
511
522
|
void main() {
|
|
512
523
|
int id = gl_InstanceID + 1; // 0 reserved for no-hit
|
|
513
524
|
vPick = vec3(float(id & 255), float((id >> 8) & 255), float((id >> 16) & 255)) / 255.0;
|
|
@@ -523,7 +534,7 @@ void main() {
|
|
|
523
534
|
vPhysicalSeat = iPhysicalSeat;
|
|
524
535
|
vHidden = (uFocusFloor > -0.5 && abs(iFloor - uFocusFloor) > 0.5) ? 1.0 : 0.0;
|
|
525
536
|
gl_Position = projectionMatrix * mv;
|
|
526
|
-
}`,
|
|
537
|
+
}`,Bc=`#version 300 es
|
|
527
538
|
precision highp float;
|
|
528
539
|
in vec2 vUv;
|
|
529
540
|
in float vPhysicalSeat;
|
|
@@ -537,7 +548,7 @@ void main() {
|
|
|
537
548
|
float d = mix(max(abs(vUv.x), abs(vUv.y)), length(vUv), vPhysicalSeat);
|
|
538
549
|
if (d > 1.0) discard; // hit-mask matches chair/bay shape
|
|
539
550
|
fragColor = vec4(vPick, 1.0);
|
|
540
|
-
}`,
|
|
551
|
+
}`,Vc=`#version 300 es
|
|
541
552
|
precision highp float;
|
|
542
553
|
in vec3 position;
|
|
543
554
|
in float part;
|
|
@@ -558,9 +569,9 @@ uniform float uBackBase;
|
|
|
558
569
|
uniform float uFocusFloor;
|
|
559
570
|
flat out vec3 vPick;
|
|
560
571
|
out float vHidden;
|
|
561
|
-
${
|
|
562
|
-
${
|
|
563
|
-
${
|
|
572
|
+
${sn}
|
|
573
|
+
${ii}
|
|
574
|
+
${ai}
|
|
564
575
|
void main() {
|
|
565
576
|
int id = int(iPickIndex + 0.5); // already global index + 1
|
|
566
577
|
vPick = vec3(float(id & 255), float((id >> 8) & 255), float((id >> 16) & 255)) / 255.0;
|
|
@@ -593,7 +604,7 @@ void main() {
|
|
|
593
604
|
float c = cos(iYaw), s = sin(iYaw);
|
|
594
605
|
vec3 rp = vec3(p.x * c + p.z * s, p.y, -p.x * s + p.z * c);
|
|
595
606
|
gl_Position = projectionMatrix * modelViewMatrix * vec4(iOffset + rp, 1.0);
|
|
596
|
-
}`,
|
|
607
|
+
}`,Nc=`#version 300 es
|
|
597
608
|
precision highp float;
|
|
598
609
|
flat in vec3 vPick;
|
|
599
610
|
in float vHidden;
|
|
@@ -601,7 +612,7 @@ out vec4 fragColor;
|
|
|
601
612
|
void main() {
|
|
602
613
|
if (vHidden > 0.5) discard;
|
|
603
614
|
fragColor = vec4(vPick, 1.0);
|
|
604
|
-
}`,
|
|
615
|
+
}`,Gc=`#version 300 es
|
|
605
616
|
precision highp float;
|
|
606
617
|
in vec3 position;
|
|
607
618
|
in float floorIndex;
|
|
@@ -612,11 +623,19 @@ out float vHidden;
|
|
|
612
623
|
void main() {
|
|
613
624
|
vHidden = (uFocusFloor > -0.5 && abs(floorIndex - uFocusFloor) > 0.5) ? 1.0 : 0.0;
|
|
614
625
|
gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
|
|
615
|
-
}`,
|
|
626
|
+
}`,zc=`#version 300 es
|
|
616
627
|
precision highp float;
|
|
617
628
|
in float vHidden;
|
|
618
629
|
out vec4 fragColor;
|
|
619
630
|
void main() {
|
|
620
631
|
if (vHidden > 0.5) discard;
|
|
621
632
|
fragColor = vec4(0.0, 0.0, 0.0, 1.0);
|
|
622
|
-
}`;function ei(e){return new ze.Program(e,{vertex:mc,fragment:fc,transparent:!1,depthTest:!0,depthWrite:!0,cullFace:!1,uniforms:{uSeatRadius:{value:Te},uSeatScale:{value:1},uMinPixels:{value:at},uPixelToWorld:{value:.002},uChairFull:{value:xt},uChairNone:{value:st},uFocusFloor:{value:-1}}})}function ti(e){return new ze.Program(e,{vertex:hc,fragment:pc,transparent:!1,depthTest:!0,depthWrite:!0,cullFace:!1,uniforms:{uChairFull:{value:xt},uChairNone:{value:st},uBackRake:{value:En},uBackBase:{value:Xt},uFocusFloor:{value:-1}}})}function ni(e){return new ze.Program(e,{vertex:bc,fragment:yc,transparent:!1,depthTest:!0,depthWrite:!0,cullFace:!1,uniforms:{uFocusFloor:{value:-1}}})}function oi(e){return new ze.Program(e,{vertex:rc,fragment:ic,cullFace:!1,depthTest:!0,depthWrite:!0,uniforms:{uKeyDir:{value:new Float32Array([.38,.86,.34])},uFocusFloor:{value:-1},uStructureDetail:{value:0}}})}function ri(e){return new ze.Program(e,{vertex:ac,fragment:sc,transparent:!0,depthTest:!0,depthWrite:!1,cullFace:!1,uniforms:{uSeatRadius:{value:Te},uSeatScale:{value:1},uMinPixels:{value:at},uPixelToWorld:{value:.002},uSeatFade:{value:0},uSeatDetail:{value:0},uFocusFloor:{value:-1},uFadeColor:{value:new Float32Array([.32,.37,.43])},uChairFull:{value:xt},uChairNone:{value:st}}})}function ii(e){return new ze.Program(e,{vertex:cc,fragment:lc,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:xt},uChairNone:{value:st},uBackRake:{value:En},uBackBase:{value:Xt},uFocusFloor:{value:-1}}})}function ai(e,t,n){return new ze.Program(e,{vertex:uc,fragment:dc,depthTest:!1,depthWrite:!1,cullFace:!1,uniforms:{uTop:{value:new Float32Array(t)},uBottom:{value:new Float32Array(n)}}})}function si(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 gc=new Float32Array([-1,-1,1,-1,1,1,-1,-1,1,1,-1,1]),xc=new Float32Array([-1,-1,3,-1,-1,3]);function ci(e,t){let n=new pe.Transform,r=new pe.Transform,o=new pe.Geometry(e,{position:{size:2,data:xc}}),i=ai(e,t.theme.background.top,t.theme.background.bottom),a=new pe.Mesh(e,{geometry:o,program:i});a.frustumCulled=!1,a.setParent(r);let s=new pe.Geometry(e,{position:{size:3,data:t.solids.position},normal:{size:3,data:t.solids.normal},color:{size:3,data:t.solids.color},floorIndex:{size:1,data:t.solids.floor},materialIndex:{size:1,data:t.solids.material}}),c=oi(e),u=new pe.Mesh(e,{geometry:s,program:c});u.frustumCulled=!1,u.setParent(n);let l=ri(e),h=new Float32Array(t.seats.count*3),m=xe.map(w=>t.theme.seatStates[w]);si(h,t.seats.iState,0,t.seats.count,m,t.seats.iCategory);let d=new pe.Geometry(e,{position:{size:2,data:gc},iOffset:{size:3,data:t.seats.iPosition,instanced:1},iColor:{size:3,data:h,instanced:1},iMaxRadius:{size:1,data:t.seats.iMaxRadius,instanced:1},iPhysicalSeat:{size:1,data:t.seats.iPhysicalSeat,instanced:1},iRing:{size:3,data:t.seats.iRing,instanced:1},iFloor:{size:1,data:t.seats.iFloor,instanced:1}}),f=new pe.Mesh(e,{geometry:d,program:l});f.frustumCulled=!1,t.seats.count>0&&f.setParent(n);let p=d.attributes.iColor,y=Do(),b=ii(e),g=Vt,x=new Float32Array(g*3),S=new Float32Array(g*3),I=new Float32Array(g),v=new Float32Array(g),R=new Float32Array(g),O=new Float32Array(g*3),V=new Float32Array(g),U=new Float32Array(g),N=new Float32Array(g),A=new Float32Array(g),M=new pe.Geometry(e,{position:{size:3,data:y.position},normal:{size:3,data:y.normal},part:{size:1,data:y.part},index:{data:y.index},iOffset:{size:3,data:x,instanced:1},iColor:{size:3,data:S,instanced:1},iRadius:{size:1,data:I,instanced:1},iYaw:{size:1,data:v,instanced:1},iGlyph:{size:1,data:R,instanced:1},iRing:{size:3,data:O,instanced:1},iFloor:{size:1,data:V,instanced:1},iPhysicalSeat:{size:1,data:U,instanced:1},iSeed:{size:1,data:A,instanced:1},iPickIndex:{size:1,data:N,instanced:1}}),P=new pe.Mesh(e,{geometry:M,program:b});P.frustumCulled=!1;let C=0,T=new Int32Array(0),H=()=>{let w=t.seats;for(let B=0;B<C;B++){let E=T[B];A[B]=Bo(w.iState[E],E);let z=w.iCategory&&w.iState[E]===0?null:m[w.iState[E]]??m[0];if(z)S[B*3]=z[0],S[B*3+1]=z[1],S[B*3+2]=z[2];else{let G=mo([w.iCategory[E*3],w.iCategory[E*3+1],w.iCategory[E*3+2]]);S[B*3]=G[0],S[B*3+1]=G[1],S[B*3+2]=G[2]}}M.attributes.iColor.needsUpdate=!0,M.attributes.iSeed.needsUpdate=!0},k={main:n,background:r,seatProgram:l,solidProgram:c,chairProgram:b,seatGeometry:d,chairGeometry:M,solidGeometry:s,drawCalls:3,setNearSeats(w,B){let E=Math.min(B,g);if(T=w,C=E,E===0){P.parent&&P.setParent(null),M.instancedCount=0,k.drawCalls=3;return}let F=t.seats;for(let z=0;z<E;z++){let G=w[z];x[z*3]=F.iPosition[G*3],x[z*3+1]=F.iPosition[G*3+1],x[z*3+2]=F.iPosition[G*3+2],I[z]=F.iChairWidth[G],v[z]=F.iYaw[G],R[z]=F.iGlyph[G],O[z*3]=F.iRing[G*3],O[z*3+1]=F.iRing[G*3+1],O[z*3+2]=F.iRing[G*3+2],V[z]=F.iFloor[G],U[z]=F.iPhysicalSeat[G],N[z]=G+1}H(),M.attributes.iOffset.needsUpdate=!0,M.attributes.iRadius.needsUpdate=!0,M.attributes.iYaw.needsUpdate=!0,M.attributes.iGlyph.needsUpdate=!0,M.attributes.iRing.needsUpdate=!0,M.attributes.iFloor.needsUpdate=!0,M.attributes.iPhysicalSeat.needsUpdate=!0,M.attributes.iSeed.needsUpdate=!0,M.attributes.iPickIndex.needsUpdate=!0,M.instancedCount=E,P.parent||P.setParent(n),k.drawCalls=4},nearSeatCount(){return C},uploadSeatStateRuns(w){if(!w.length)return;C&&H();for(let E of w)si(h,t.seats.iState,E.start,E.length,m,t.seats.iCategory);let B=p.buffer;if(!B){p.needsUpdate=!0;return}e.bindBuffer(e.ARRAY_BUFFER,B);for(let E of w){let F=h.subarray(E.start*3,(E.start+E.length)*3);e.bufferSubData(e.ARRAY_BUFFER,E.start*3*Float32Array.BYTES_PER_ELEMENT,F)}},dispose(){o.remove(),i.remove(),s.remove(),c.remove(),d.remove(),l.remove(),M.remove(),b.remove()}};return k}var Ee=require("ogl");function vc(e,t,n){let r=e+(t<<8)+(n<<16);return r===0?-1:r-1}function li(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 l=(c*t+u)*4,h=vc(e[l],e[l+1],e[l+2]);if(h<0||h>=i)continue;let m=u-r,d=c-o,f=m*m+d*d;f<s&&(s=f,a=h)}return a}function ui(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 Mc=["uSeatRadius","uSeatScale","uMinPixels","uPixelToWorld"],on=class{constructor(t,n,r,o,i){this.seatScene=new Ee.Transform;this.chairScene=new Ee.Transform;this.solidScene=new Ee.Transform;this.target=null;this.restoreClear=[0,0,0];this.renderer=t,this.gl=t.gl,this.maxIndex=i,this.seatProg=ei(this.gl),this.chairProg=ti(this.gl),this.depthProg=ni(this.gl);let a=new Ee.Mesh(this.gl,{geometry:n,program:this.seatProg});a.frustumCulled=!1,a.setParent(this.seatScene);let s=new Ee.Mesh(this.gl,{geometry:r,program:this.chairProg});s.frustumCulled=!1,s.setParent(this.chairScene);let c=new Ee.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 Mc)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 Ee.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),l=Math.max(0,r-o),h=Math.max(1,Math.min(s,n+o+1)-u),m=Math.max(1,Math.min(c,r+o+1)-l);i.enable(i.SCISSOR_TEST),i.scissor(u,l,h,m);let[d,f,p]=this.restoreClear;i.clearColor(0,0,0,1),this.renderer.render({scene:this.solidScene,camera:t,target:a,clear:!0}),this.renderer.render({scene:this.seatScene,camera:t,target:a,clear:!1}),this.renderer.render({scene:this.chairScene,camera:t,target:a,clear:!1}),i.clearColor(d,f,p,1),i.disable(i.SCISSOR_TEST);let y=new Uint8Array(h*m*4);return this.renderer.bindFramebuffer(a),i.readPixels(u,l,h,m,i.RGBA,i.UNSIGNED_BYTE,y),this.renderer.bindFramebuffer(),li(y,h,m,n-u,r-l,this.maxIndex)}dispose(){this.destroyTarget(),this.seatProg.remove(),this.chairProg.remove(),this.depthProg.remove()}};function di(e,t){let n=[];for(let r of t)e.has(r.seatId)?e.set(r.seatId,gt(r.state)):n.push(r);return n}function mi(e,t,n){let r=new Set;for(let a of t)(e.has(a)||n(a)!==void 0)&&r.add(a);let o=new Map(e),i=[];for(let[a,s]of e)r.has(a)||(i.push({seatId:a,state:xe[s]??"available"}),o.delete(a));for(let a of r){if(o.has(a))continue;let s=n(a);s!==void 0&&(o.set(a,s),i.push({seatId:a,state:"selected"}))}return{updates:i,next:o}}var He=require("ogl");function Sc(e,t){return[e[0]-t[0],e[1]-t[1],e[2]-t[2]]}function fi(e,t){return[e[0]+t[0],e[1]+t[1],e[2]+t[2]]}function wc(e,t){return[e[0]*t,e[1]*t,e[2]*t]}function hi(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 qn(e){let t=Math.max(0,Math.min(1,e));return t*t*t*(t*(t*6-15)+10)}function Zn(e,t){return Math.max(0,Math.min(1,e+t))}function pi(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],l=e[Math.min(n-1,i+2)],h=a*a,m=h*a,d=[0,0,0];for(let f=0;f<3;f++)d[f]=.5*(2*c[f]+(-s[f]+u[f])*a+(2*s[f]-5*c[f]+4*u[f]-l[f])*h+(-s[f]+3*c[f]-3*u[f]+l[f])*m);return d}function $n(e,t,n,r,o){let i=hi(Sc(t,n));i[0]===0&&i[1]===0&&i[2]===0&&(i=[0,0,1]);let a=fi(fi(t,wc(i,2.5)),[0,1.5,0]),s=[t[0]-r[0],0,t[2]-r[2]],c=hi(s);c[0]===0&&c[2]===0&&(c=[i[0],0,i[2]]);let u=Math.max(1,o),l=[r[0]+c[0]*u*1.3,r[1]+u*.75,r[2]+c[2]*u*1.3];return{waypoints:[e,l,a],finalPos:a}}function Jn(e,t,n=35,r=28){let o=qn(t),i=pi(e,o),a=qn(Math.max(0,Math.min(1,(t-.66)/.34)));return{pos:i,fov:n+(r-n)*a,eased:o}}function gi(e,t,n){let r=e.position.clone(),o=new He.Quat().copy(e.quaternion);e.position.set(t[0],t[1],t[2]),e.lookAt(new He.Vec3(n[0],n[1],n[2]));let i=new He.Quat().copy(e.quaternion);return e.position.copy(r),e.quaternion.copy(o),i}var rn=class{constructor(t){this.active=!1;this.waypoints=[];this.startQuat=new He.Quat;this.endQuat=new He.Quat;this.outQuat=new He.Quat;this.startTime=0;this.duration=2500;this.endFov=28;this.resolveFn=null;this.camera=t}start(t,n,r,o=2500,i=28){return this.settle(),this.waypoints=t,this.startQuat.copy(n),this.endQuat.copy(r),this.duration=o,this.endFov=i,this.startTime=performance.now(),this.active=!0,new Promise(a=>{this.resolveFn=a})}update(t){if(!this.active)return!1;let n=Math.min(1,(t-this.startTime)/this.duration),{pos:r,fov:o,eased:i}=Jn(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,Zn(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 Pc=1.02,Cc=1.5;function xi(e,t,n=0,r){let o=Number.isFinite(r)?n+r:e[1]+Pc;return{eye:[e[0],o,e[2]],focal:[t.x*D,n+Cc,t.y*D]}}var oo=null;function Li(){return oo??=Promise.resolve().then(()=>(ki(),Ti)).catch(e=>{throw oo=null,e}),oo}var _i=()=>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=_i(),this.emit("3d_panorama_opened")}panoramaClosed(){let t=this.panoramaOpenedAt?Math.round(_i()-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 Fi(e){let t=e.style.position;return getComputedStyle(e).position!=="static"?()=>{}:(e.style.position="relative",()=>{e.style.position==="relative"&&(e.style.position=t)})}function Di(e){let{container:t,model:n,opts:r,expandedSeatById:o,seatIdsByRow:i,isNarrow:a}=e,s=null,c=()=>{if(!s)return;let h=a();Object.assign(s.style,h?{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:(h,m,d=!1)=>{if(u(),e.isDisposed())return null;let f=document.createElement("div");f.setAttribute("role","group"),Object.assign(f.style,{position:"absolute",display:"flex",flexDirection:"column",alignItems:"center",gap:"6px",zIndex:"4"});let p=o.get(h),y=p?.sectionId?n.sections.find(O=>O.id===p.sectionId):void 0,b=p?.label??h;f.setAttribute("aria-label",`Explore views near ${y?.label?`${y.label}, `:""}seat ${b}`);let g=document.createElement("span");g.textContent=["Live 3D seat view",y?.label,b].filter(Boolean).join(" \xB7 "),Object.assign(g.style,{maxWidth:"min(320px, calc(100vw - 32px))",padding:"5px 10px",borderRadius:"999px",overflow:"hidden",color:"#d9e3f5",background:"rgba(12,18,32,0.72)",font:"600 11px/1.2 inherit",textOverflow:"ellipsis",whiteSpace:"nowrap",backdropFilter:"blur(6px)"}),f.appendChild(g);let x=document.createElement("div");Object.assign(x.style,{display:"flex",alignItems:"center",justifyContent:"center",gap:"6px"}),f.appendChild(x);let S=p?.rowId?i.get(p.rowId):void 0,I=S?.indexOf(h)??-1,v=I>=0?[S?.[I-1],S?.[I+1]]:[void 0,void 0],R=(O,V,U,N=!1)=>{let A=document.createElement("button");A.type="button",A.textContent=O,A.setAttribute("aria-label",V),Object.assign(A.style,{minHeight:"44px",padding:N?"10px 16px":"10px",borderRadius:"999px",background:"rgba(12,18,32,0.78)",color:"#eef1f8",border:"1px solid rgba(150,165,205,0.4)",backdropFilter:"blur(6px)",font:"600 13px/1 inherit",cursor:"pointer",whiteSpace:"nowrap"}),N||(A.style.minWidth="44px"),N&&(A.dataset.panoramaTrigger=""),A.addEventListener("click",U),x.appendChild(A)};if(v[0]){let O=o.get(v[0])?.label??v[0];R("\u2039",`View previous seat ${O}`,()=>{e.flyToSeat(v[0])})}if(r.getSeatView){let O=r.seatViewActionLabel?.(h)??"Open 360\xB0 panorama";R(d?`\u21BB Retry ${O}`:`\u25C9 ${O}`,`${d?"Retry":O} from seat ${b}`,()=>{if(e.isDisposed()||m!==e.flightGen()){u();return}u(),e.openPanorama(h,400,m)},!0)}if(v[1]){let O=o.get(v[1])?.label??v[1];R("\u203A",`View next seat ${O}`,()=>{e.flyToSeat(v[1])})}return x.childElementCount?(t.appendChild(f),s=f,c(),f):null},remove:u,layout:c}}function Oi(e){let{container:t,orbit:n,isNarrow:r}=e,o=document.createElement("div"),i=!1;o.className="sl-3d-navigation-controls",Object.assign(o.style,{position:"absolute",right:"14px",bottom:"14px",display:"flex",zIndex:"4",flexDirection:"column",alignItems:"flex-end",gap:"7px"});let a=document.createElement("div");a.setAttribute("role","group"),a.setAttribute("aria-label","3D drag mode"),Object.assign(a.style,{display:"flex",flexDirection:"column",gap:"6px",alignItems:"flex-end"});let s=document.createElement("div");s.setAttribute("role","group"),s.setAttribute("aria-label","3D view controls"),Object.assign(s.style,{display:"flex",flexDirection:"column",gap:"6px",alignItems:"flex-end"});let c=document.createElement("button");c.type="button",c.textContent="\u21BB",c.setAttribute("aria-label","Drag to rotate the 3D venue"),c.dataset.tooltip="Rotate venue";let u=document.createElement("button");u.type="button",u.textContent="\u2725",u.setAttribute("aria-label","Drag to move the 3D venue left, right, up or down"),u.dataset.tooltip="Move venue";let l=document.createElement("button");l.type="button",l.textContent="\u2212",l.setAttribute("aria-label","Zoom out of the 3D venue"),l.dataset.tooltip="Zoom out";let h=document.createElement("button");h.type="button",h.textContent="+",h.setAttribute("aria-label","Zoom into the 3D venue"),h.dataset.tooltip="Zoom in";for(let p of[c,u,l,h])p.className="sl-3d-icon-control",Object.assign(p.style,{width:"44px",minWidth:"44px",minHeight:"44px",padding:"9px",border:"1px solid rgba(150,165,205,0.35)",borderRadius:"999px",color:"#c9d4ea",background:"rgba(12,18,32,0.82)",font:"600 17px/1 inherit",backdropFilter:"blur(6px)",cursor:"pointer",whiteSpace:"nowrap"});a.append(c,u),s.append(h,l);let m=p=>{n.setPrimaryDragMode(p);let y=p==="orbit";c.setAttribute("aria-pressed",String(y)),u.setAttribute("aria-pressed",String(!y)),c.style.background=y?"rgba(96,110,150,0.68)":"rgba(12,18,32,0.82)",u.style.background=y?"rgba(12,18,32,0.82)":"rgba(96,110,150,0.68)",o.title=y?"Drag to rotate \xB7 Shift-drag to move":"Drag to move \xB7 Shift-drag to rotate"};c.addEventListener("click",()=>m("orbit")),u.addEventListener("click",()=>m("pan")),l.addEventListener("click",()=>n.zoomBy(1.22)),h.addEventListener("click",()=>n.zoomBy(.82)),o.append(a,s),m("orbit"),t.appendChild(o);let d=()=>{let p=r();o.style.display=i?"none":"flex",o.style.right=p?"12px":"14px",o.style.bottom=p?"calc(env(safe-area-inset-bottom, 0px) + 76px)":"14px",a.style.display=p?"none":"flex",h.style.display=p?"none":"",l.style.display=p?"none":""};return d(),{element:o,utilityControls:s,setNavigationMode:m,setSeatViewLocked:p=>{i=p,n.setInteractionEnabled(!p),d()},seatViewLocked:()=>i,layout:d}}function Bi(e){let{glctx:t,orbit:n,model:r,seats:o,opts:i,cinematic:a,analytics:s,seatIdByIndex:c,sectionIdBySeatId:u,tapSlop:l,tapMs:h,cancelFlight:m,focusSectionCamera:d,setSelection:f,ensureSeatView:p}=e,y=0,b=0,g=0,x=-1,S=!1,I=!1,v=N=>{e.seatViewLocked()||x===-1&&(x=N.pointerId,y=N.clientX,b=N.clientY,g=performance.now(),S=!1,I=a.active,a.active&&(s.cinematicCancelled(),m(),i.onViewTargetChange?.(null)))},R=N=>{N.pointerId===x&&Math.hypot(N.clientX-y,N.clientY-b)>l&&(S=!0)},O=(N,A,M,P,C)=>{let T=t.canvas.getBoundingClientRect(),H=t.canvas.clientWidth||T.width||1,k=t.canvas.clientHeight||T.height||1,w=N-T.left,B=A-T.top,E=P*P,F=-1,z=E,G=1/0;for(let _ of o){if(M&&_.sectionId!==M)continue;let L=r.seats.idToIndex.get(_.id);if(L===void 0)continue;if(C){let ne=Math.round(r.seats.iState[L]??0);if(ne!==0&&ne!==3)continue}let Y=L*3,K=Ge(n.camera.projectionViewMatrix,[r.seats.iPosition[Y],r.seats.iPosition[Y+1]+.55,r.seats.iPosition[Y+2]],H,k);if(!K.visible)continue;let J=K.x-w,Z=K.y-B,q=J*J+Z*Z;(q<z||Math.abs(q-z)<1&&K.depth<G)&&(F=L,z=q,G=K.depth)}return F},V=(N,A)=>{let M=e.gpu(),P=e.pick();if(!M||!P)return-1;P.syncFromSeatProgram(M.seatProgram);let C=t.canvas.getBoundingClientRect(),T=t.renderer.dpr,{x:H,y:k}=ui(N,A,C,T,t.gl.drawingBufferWidth,t.gl.drawingBufferHeight),w=Math.max(2,Math.round(8*T));return P.pick(n.camera,H,k,w)};return{onDown:v,onMove:R,onUp:N=>{if(N.pointerId!==x)return;let A=!S&&performance.now()-g<h;if(x=-1,I){I=!1;return}let M=e.gpu(),P=e.pick();if(!A||!M||!P)return;let C=V(N.clientX,N.clientY);if(e.focusedSectionId()&&C>=0){let k=c[C],w=k?u.get(k):void 0;if(w&&w!==e.focusedSectionId()&&d(w))return}if(e.focusedSectionId()&&C<0&&(C=O(N.clientX,N.clientY,e.focusedSectionId(),44,!1)),e.focusedSectionId()&&C<0){let k=O(N.clientX,N.clientY,null,72,!1),w=k>=0?c[k]:void 0,B=w?u.get(w):void 0;if(B&&B!==e.focusedSectionId()&&d(B))return}if(!e.focusedSectionId()){C<0&&(C=O(N.clientX,N.clientY,null,42,!1));let k=C>=0?c[C]:void 0,w=k?u.get(k):void 0;if(w&&d(w))return}if(C<0||C>=c.length){e.selection().size&&(f([]),i.onViewTargetChange?.(null));return}let T=c[C],H=xe[Math.round(r.seats.iState[C]??0)]??"available";if(H!=="available"&&H!=="selected"){i.onSeatInspect?.(T,H);return}if(e.selection().has(T)&&e.selection().size===1){f([]),i.onViewTargetChange?.(null);return}f([T]),p(T),s.seatPicked(T,u.get(T)),i.onSeatPick?.(T)}}}var mn=class{constructor(t,n){this.minX=0;this.minZ=0;this.cell=1;this.cols=1;this.rows=1;this.cellStart=null;this.cellItems=null;this.iPosition=t,this.count=n}ensureGrid(){if(this.cellStart||this.count===0)return;let t=this.iPosition,n=1/0,r=1/0,o=-1/0,i=-1/0;for(let d=0;d<this.count;d++){let f=t[d*3],p=t[d*3+2];f<n&&(n=f),f>o&&(o=f),p<r&&(r=p),p>i&&(i=p)}let a=Math.max(o-n,.001),s=Math.max(i-r,.001);this.cell=Math.max(Math.sqrt(a*s*4/this.count),.25),this.cols=Math.max(1,Math.ceil(a/this.cell)+1),this.rows=Math.max(1,Math.ceil(s/this.cell)+1),this.minX=n,this.minZ=r;let c=this.cols*this.rows,u=new Int32Array(c+1),l=d=>{let f=Math.min(this.cols-1,Math.max(0,Math.floor((t[d*3]-n)/this.cell)));return Math.min(this.rows-1,Math.max(0,Math.floor((t[d*3+2]-r)/this.cell)))*this.cols+f};for(let d=0;d<this.count;d++)u[l(d)+1]++;for(let d=0;d<c;d++)u[d+1]+=u[d];let h=new Int32Array(this.count),m=u.slice(0,c);for(let d=0;d<this.count;d++)h[m[l(d)]++]=d;this.cellStart=u,this.cellItems=h}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),l=Math.floor((n-this.minZ)/this.cell),h=Math.ceil(r/this.cell)+1,m=this.iPosition,d=0;for(let f=0;f<=h&&d<s;f++){let p=l-f,y=l+f,b=u-f,g=u+f;for(let x=p;x<=y&&d<s;x++){if(x<0||x>=this.rows)continue;let S=x===p||x===y;for(let I=b;I<=g&&d<s;I++){if(!S&&I!==b&&I!==g){I=g-1;continue}if(I<0||I>=this.cols)continue;let v=x*this.cols+I;for(let R=i[v],O=i[v+1];R<O&&d<s;R++){let V=a[R],U=m[V*3]-t,N=m[V*3+2]-n;U*U+N*N<=c&&(o[d++]=V)}}}}return d}};var fn=class{constructor(t){this.ctx=t;this.detailVisible=!1;this.seatDetailMix=0;this.structureDetailMix=0;this.nearBuf=new Int32Array(Vt);this.lastGatherX=1/0;this.lastGatherZ=1/0;this.nearIndex=new mn(t.model.seats.iPosition,t.model.seats.count)}forceRegather(){this.lastGatherX=1/0}setDetailEnabled(t){let n=this.ctx.gpu();t||(this.detailVisible=!1),this.lastGatherX=1/0,this.lastGatherZ=1/0,!t&&n?.nearSeatCount()&&n.setNearSeats(this.nearBuf,0)}update(t){let{model:n}=this.ctx,r=this.ctx.gpu();if(!r)return;if(!t){r.nearSeatCount()&&r.setNearSeats(this.nearBuf,0);return}let o=this.ctx.orbit().camera.position;if(Math.hypot(o.x-this.lastGatherX,o.z-this.lastGatherZ)<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>Sn){r.nearSeatCount()&&r.setNearSeats(this.nearBuf,0);return}let s=this.nearIndex.gather(o.x,o.z,Sn,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 hn=require("ogl");function Vi(e){let{container:t,model:n,opts:r,orbit:o,cinematic:i,analytics:a,loop:s,labelOverlay:c,stageAzimuth:u,overviewFraming:l}=e,h=0,m=-1,d=(I,v,R=28)=>{o.camera.position.set(I[0],I[1],I[2]),o.camera.lookAt(new hn.Vec3(v[0],v[1],v[2])),o.camera.fov=R,o.camera.updateProjectionMatrix()},f=document.createElement("button");f.className="sl-3d-overview-control sl-3d-icon-control",f.type="button",f.textContent="\u2302",f.setAttribute("aria-label","Fit the active level or whole venue in view"),f.dataset.tooltip="Fit view",Object.assign(f.style,{width:"44px",minWidth:"44px",minHeight:"44px",padding:"9px",borderRadius:"999px",background:"rgba(12,18,32,0.72)",color:"#c9d4ea",border:"1px solid rgba(150,165,205,0.35)",backdropFilter:"blur(6px)",font:"600 11px/1 inherit",cursor:"pointer",whiteSpace:"nowrap"});let p=()=>{f.textContent="\u2302"};p();let y=I=>{m=I;let v=e.gpu();v&&(v.seatProgram.uniforms.uFocusFloor.value=I,v.solidProgram.uniforms.uFocusFloor.value=I,v.chairProgram.uniforms.uFocusFloor.value=I),e.showSectionSeatLabels(null)},b=()=>{if(e.isDisposed())return;r.onViewTargetChange?.(null),r.onSectionFocusChange?.(null),e.panorama()&&(e.panorama().dispose(),e.setPanorama(null),a.panoramaClosed()),e.setPanoramaSphereVisible(!1),e.panoramaLoadAbort()?.abort(),e.setPanoramaLoadAbort(null),e.restorePanoramaLayer(),f.style.display="",c.setVisible(!0),e.setFrozen(!1);let I=m>=0?n.floors[m]:null;if(e.setNearFieldDetailEnabled(!!I),e.setSeatViewLocked(!1),g(),e.removeArriveChip(),e.setNavigationMode("orbit"),I){let v=I.focalWorld[0]-I.center[0],R=I.focalWorld[2]-I.center[2],O=Math.hypot(v,R)>I.radius*.12?Math.atan2(v,R):u,V={center:I.center,radius:I.radius,box:I.box},U={polarDeg:58,margin:1.12};e.reducedMotion()?o.frame(V,!1,O,!1,U):o.frameSoft(V,O,!1,U)}else e.reducedMotion()?o.frame(n.bounds,!1,u,r.portraitOverviewCrop===!0,l):o.frameSoft(n.bounds,u,r.portraitOverviewCrop===!0,l);e.showSectionSeatLabels(null),s.requestRender()},g=()=>{h++,e.panoramaLoadAbort()?.abort(),e.setPanoramaLoadAbort(null),i.active&&(i.cancel(),o.resumeAfterFlight(n.focalWorld))},x=I=>{if(e.isDisposed()||!e.gpu())return Promise.resolve();let v=n.seats.idToIndex.get(I);if(v===void 0)return Promise.resolve();e.setNearFieldDetailEnabled(!0),r.onViewTargetChange?.(I),e.panorama()&&(e.panorama().dispose(),e.setPanorama(null),e.setPanoramaSphereVisible(!1),f.style.display="",e.restorePanoramaLayer()),e.panoramaLoadAbort()?.abort(),e.setPanoramaLoadAbort(null),e.setFrozen(!1),e.setSeatViewLocked(!1);let R=++h;e.removeArriveChip();let{eye:O,focal:V}=e.resolvedSeatViewPose(I,v),U=[o.camera.position.x,o.camera.position.y,o.camera.position.z],N=$n(U,O,V,n.bounds.center,n.bounds.radius),A=r.arriveAtSeatEye?O:N.finalPos,M=r.arriveAtSeatEye?t.clientWidth/Math.max(1,t.clientHeight)<.7?90:65:28,P=[N.waypoints[0],N.waypoints[1],A];if(c.setVisible(!1),e.reducedMotion())return d(A,V,M),s.requestRender(),a.cinematicSkipped(),e.isDisposed()||o.syncFromCamera(),e.setSeatViewLocked(r.arriveAtSeatEye===!0),e.showArriveChip(I,R),Promise.resolve();let C=new hn.Quat().copy(o.camera.quaternion),T=gi(o.camera,A,V);return s.requestRender(),i.start(P,C,T,2500,M).then(()=>{e.isDisposed()||R!==h||(a.cinematicPlayed(2500),o.resumeAfterFlight(V),e.setSeatViewLocked(r.arriveAtSeatEye===!0),s.requestRender(),e.showArriveChip(I,R))})},S=I=>{let v=n.sections.find(U=>U.id===I);if(!v||v.seatCount===0)return!1;e.setNearFieldDetailEnabled(!0),e.setSeatViewLocked(!1),i.cancel(),e.removeArriveChip(),n.floors.length>1&&m!==v.floorIndex&&y(v.floorIndex),e.setNavigationMode("pan"),e.showSectionSeatLabels(I);let R=v.focalWorld[0]-v.center[0],O=v.focalWorld[2]-v.center[2],V=Math.hypot(R,O)>v.radius*.12?Math.atan2(R,O):void 0;return o.frame({center:v.center,radius:Math.max(5,v.radius*.5)},!1,V),r.onSectionFocusChange?.(I),s.requestRender(),!0};return f.addEventListener("click",b),{overviewChip:f,layoutOverviewChip:p,flightGen:()=>h,focusedFloor:()=>m,applyFloorFocus:y,placeCameraFinal:d,cancelFlight:g,focusOverview:b,flyToSeat:x,focusSectionCamera:S}}var Nc={};function Ni(e){let t=performance.now();return{model:dt(e),buildMs:performance.now()-t,source:"main"}}function Gi(e){return typeof Worker>"u"?Promise.resolve(Ni(e)):new Promise(t=>{let n=new Worker(new URL("./scene/scene.worker.ts",Nc.url),{type:"module"}),r=!1,o=s=>{r||(r=!0,clearTimeout(a),n.terminate(),t(s))},i=()=>o(Ni(e)),a=window.setTimeout(i,15e3);n.onerror=i,n.onmessage=s=>{o({model:s.data.model,buildMs:s.data.buildMs,source:"worker"})},n.postMessage(e)})}var Gc=Math.PI/180,zc=6,Hc=500;function jc(e,t,n={}){let r=performance.now(),o=t.prepared?.model??dt(t),i=new dn(n.onAnalytics),a=new Array(o.seats.count);for(let[j,X]of o.seats.idToIndex)a[X]=j;let s=new Map(t.seats.map(j=>[j.id,j])),c=new Map;for(let j of t.seats){if(!j.rowId)continue;let X=c.get(j.rowId);X?X.push(j.id):c.set(j.rowId,[j.id])}let u=new Map;for(let j of t.seats)u.set(j.id,j.sectionId);let l=t.doc.floors?.some(X=>(X.baseHeightM??0)>0)?!0:(t.doc.floors?.flatMap(X=>X.objects)??t.doc.objects).some(X=>X.type==="section"&&((X.height??0)>0||(X.rake??0)>0)),h=null,m=null,d=!1,f=!1,p=!1,y=new Map,b=null,g=null,x=null,S=new Map,I=null,v=()=>{x===null&&(x=e.style.zIndex,e.style.zIndex="20")},R=()=>{x!==null&&(e.style.zIndex==="20"&&(e.style.zIndex=x),x=null)},O=!1,V=()=>O?me.focusedFloor():-1,U=()=>{h=ci(P.gl,o),m=new on(P.renderer,h.seatGeometry,h.chairGeometry,h.solidGeometry,o.seats.count),P.setClearColor(o.theme.background.top),m.setRestoreClear(o.theme.background.top),h.seatProgram.uniforms.uSeatRadius.value=Te*o.theme.seatScale,h.seatProgram.uniforms.uFocusFloor.value=V(),h.solidProgram.uniforms.uFocusFloor.value=V(),h.chairProgram.uniforms.uFocusFloor.value=V(),A.forceRegather()},N=!1,A=new fn({model:o,orbit:()=>C,gpu:()=>h}),M=j=>A.setDetailEnabled(j),P=new Dt(e,{onContextLost:()=>{p||i.contextLost(),d=!0,Y.stop(),h=null,m=null},onContextRestored:()=>{U(),d=!1,p||i.contextRestored(),Y.requestRender()}}),C=new Ot(P.gl,P.canvas,()=>Y.requestRender(),()=>i.orbitEngaged());C.setAspect(P.aspect);let T=(t.doc.floors?.flatMap(j=>j.objects)??t.doc.objects).some(j=>j.type==="section"&&j.physical3dProvenance?.surfaceKind?.status==="inferred"),H=(()=>{if(T&&o.stages.length===0)return;let j=o.focalWorld[0]-o.bounds.center[0],X=o.focalWorld[2]-o.bounds.center[2];return Math.hypot(j,X)>o.bounds.radius*.12?Math.atan2(j,X):void 0})(),k=o.floors.length>1?{polarDeg:48,margin:1.1}:void 0,w=typeof window<"u"&&!!window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches;C.frame(o.bounds,!w&&n.skipInitialOverviewAnimation!==!0,H,n.portraitOverviewCrop===!0,k);let B=new rn(C.camera),E=Fi(e),F=new en(e,{fontFamily:t.doc.theme?.fontFamily,ink:t.doc.theme?.textColor,backgroundRgb:o.theme.background.top}),z=o.labels,G=()=>Rr(z,o.floors.length,V());F.setLabels(G());let _=null,L=j=>{if(_=j,F.setForcedDense(!!j),!j){F.setLabels(G());return}let X=t.seats.filter(Q=>Q.sectionId===j),W=new Set(X.map(Q=>Q.id)),ee=new Set(X.map(Q=>Q.rowId)),oe=new Set(y.keys()),re=new Set(X.filter(Q=>oe.has(Q.id)).map(Q=>Q.id)),le=G().filter(Q=>Q.kind!=="row"&&Q.kind!=="seat"||(Q.kind==="row"?ee.has(Q.id.slice(4)):W.has(Q.id.slice(5))&&(re.size===0||re.has(Q.id.slice(5)))));if(o.seatCount<=6e3&&re.size===0){F.setLabels(le);return}let ue=re.size?X.filter(Q=>re.has(Q.id)):X,Ye=new Set(ue.map(Q=>`seat:${Q.id}`)),Be=ue.flatMap(Q=>{let fe=o.seats.idToIndex.get(Q.id);if(fe===void 0)return[];let Pe=fe*3;return[{id:`seat:${Q.id}`,kind:"seat",text:Q.displayLabel||Q.label,anchor:[o.seats.iPosition[Pe],o.seats.iPosition[Pe+1]+(oe.has(Q.id)?1.05:.55),o.seats.iPosition[Pe+2]]}]});F.setLabels([...le.filter(Q=>!Ye.has(Q.id)),...Be])};U();let Y=new Bt(j=>{if(d||!h||f)return!1;let W=B.active?B.update(performance.now()):C.update(),ee=V()>=0?o.floors[V()]:null,oe=ee?.radius??o.bounds.radius,re=vo(C.currentDistance,oe),le=N?{center:[C.camera.position.x,C.camera.position.y,C.camera.position.z],radius:520}:o.renderBounds;C.updateClipping(le);let ue=ee?.center??o.renderBounds.center,Ye=ee?.radius??o.renderBounds.radius,Be=(Ce,pt)=>Math.hypot(C.camera.position.x-Ce[0],C.camera.position.y-Ce[1],C.camera.position.z-Ce[2])<=pt*(A.detailVisible?1.8:1.55),Q=Be(ue,Ye);if(!Q&&_){let Ce=o.sections.find(pt=>pt.id===_);Ce&&(Q=Be(Ce.center,Math.max(12,Ce.radius*2)))}A.detailVisible=Q;let fe=h.seatProgram.uniforms;fe.uSeatScale.value=re.scale,fe.uSeatFade.value=re.fade;let Pe=!!ee&&Mo(ee.seatCount,P.canvas.clientWidth||1,P.canvas.clientHeight||1),kt=So(o.seats.count,oe,C.currentDistance,C.camera.fov,P.canvas.clientHeight||1),ht=A.detailVisible||Pe||kt?1:0,Lt=A.detailVisible||V()>=0||o.floors.length>1?1:0;return A.ease(j,ht,Lt),fe.uSeatDetail.value=A.seatDetailMix,h.solidProgram.uniforms.uStructureDetail.value=A.structureDetailMix,fe.uMinPixels.value=re.minPixels,fe.uPixelToWorld.value=2*Math.tan(C.camera.fov*Gc/2)/Math.max(1,P.pixelHeight),A.update(A.detailVisible),P.renderer.render({scene:h.background,clear:!0}),P.renderer.render({scene:h.main,camera:C.camera,clear:!1}),F.update(C.camera.projectionViewMatrix,P.canvas.clientWidth||1,P.canvas.clientHeight||1,C.currentDistance,oe,[C.camera.position.x,C.camera.position.y,C.camera.position.z]),W||A.seatDetailMix!==ht||A.structureDetailMix!==Lt}),K=typeof ResizeObserver<"u"?new ResizeObserver(()=>bn.resize()):null;K?.observe(e);let J=j=>{let X=oe=>{let re=o.seats.idToIndex.get(oe);return re===void 0?void 0:o.seats.iState[re]},{updates:W,next:ee}=mi(y,j,X);if(y=ee,F.setSelectedSeatIds(y.keys()),_&&L(_),W.length){let oe=Tn(o.seats,W);h&&h.uploadSeatStateRuns(oe),Y.requestRender()}},Z=()=>I!==null?I:typeof window<"u"&&!!window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,q=8,ne=j=>{if(!n.getSeatView)return null;let X=S.get(j);if(!X)for(X=Promise.resolve(n.getSeatView(j)),S.set(j,X),X.catch(()=>{S.get(j)===X&&S.delete(j)});S.size>q;){let W=S.keys().next().value;if(W===void 0)break;S.delete(W)}return X},Ue=(j,X)=>{let W=s.get(j),ee=Math.max(0,Math.round(o.seats.iFloor[X]??0)),oe=t.doc.floors?.[ee],re=o.floors[ee],le=oe?.focalPoint??t.doc.focalPoint,ue=re?{x:re.focalWorld[0]/D,y:re.focalWorld[2]/D}:le,Ye=W?.focalPoint?{x:W.focalPoint.x+ue.x-le.x,y:W.focalPoint.y+ue.y-le.y}:ue,Be=[o.seats.iPosition[X*3],o.seats.iPosition[X*3+1],o.seats.iPosition[X*3+2]];return xi(Be,Ye,oe?.baseHeightM??0,W?.eyeHeightM)},Xe=()=>(e.clientWidth||P.canvas.clientWidth)<=520,ve=null,_e=null,Fe=async(j,X,W)=>{if(!n.getSeatView||p||W!==me.flightGen())return;let ee;try{ee=await Li()}catch{if(i.panoramaFailed(j,"mount"),!p&&W===me.flightGen()){let oe=be(j,W,!0);requestAnimationFrame(()=>oe?.querySelector("[data-panorama-trigger]")?.focus())}return}if(!(p||W!==me.flightGen()||!ve))return _e??=ee.createOpenPanorama(ve),_e(j,X,W)},Me=Di({container:e,model:o,opts:n,expandedSeatById:s,seatIdsByRow:c,isNarrow:Xe,isDisposed:()=>p,flightGen:()=>me.flightGen(),flyToSeat:j=>io(j),openPanorama:(j,X,W)=>Fe(j,X,W)}),be=Me.show,ce=Me.remove,tt=Me.layout,Se=Oi({container:e,orbit:C,isNarrow:Xe}),nt=Se.element,we=Se.setNavigationMode,De=Se.setSeatViewLocked,Tt=Se.layout,zi=Se.utilityControls,me=Vi({container:e,model:o,opts:n,orbit:C,cinematic:B,analytics:i,loop:Y,labelOverlay:F,stageAzimuth:H,overviewFraming:k,gpu:()=>h,isDisposed:()=>p,panorama:()=>b,setPanorama:j=>{b=j},setPanoramaSphereVisible:j=>{N=j},panoramaLoadAbort:()=>g,setPanoramaLoadAbort:j=>{g=j},setFrozen:j=>{f=j},restorePanoramaLayer:R,reducedMotion:Z,resolvedSeatViewPose:Ue,showSectionSeatLabels:L,setNearFieldDetailEnabled:M,setSeatViewLocked:De,setNavigationMode:we,showArriveChip:be,removeArriveChip:ce});O=!0;let pn=me.overviewChip,Hi=me.layoutOverviewChip,ji=me.applyFloorFocus,Ui=me.focusOverview,ro=me.cancelFlight,io=me.flyToSeat,ao=me.focusSectionCamera;zi.appendChild(pn),ve={container:e,model:o,opts:n,analytics:i,orbit:C,loop:Y,seatsById:s,ensureSeatView:ne,resolvedSeatViewPose:Ue,gpu:()=>h,gl:P.gl,isContextLost:()=>d,isDisposed:()=>p,flightGen:()=>me.flightGen(),setPanorama:j=>{b=j},getLoadAbort:()=>g,setLoadAbort:j=>{g=j},setPanoramaSphereVisible:j=>{N=j},setFrozen:j=>{f=j},raisePanoramaLayer:v,restorePanoramaLayer:R,getOverviewChip:()=>pn,labelOverlay:F,reducedMotion:Z,removeArriveChip:ce,showArriveChip:be};let Oe=Bi({glctx:P,orbit:C,model:o,seats:t.seats,opts:n,cinematic:B,analytics:i,seatIdByIndex:a,sectionIdBySeatId:u,tapSlop:zc,tapMs:Hc,gpu:()=>h,pick:()=>m,seatViewLocked:()=>Se.seatViewLocked(),focusedSectionId:()=>_,selection:()=>y,cancelFlight:ro,focusSectionCamera:ao,setSelection:J,ensureSeatView:ne});P.canvas.addEventListener("pointerdown",Oe.onDown),P.canvas.addEventListener("pointermove",Oe.onMove),P.canvas.addEventListener("pointerup",Oe.onUp),P.canvas.addEventListener("pointercancel",Oe.onUp),Y.requestRender();let bn={setAvailability(j){let X=di(y,j),W=Tn(o.seats,X);W.length&&h&&h.uploadSeatStateRuns(W),Y.requestRender()},setSelection:J,flyToSeat:io,focusOverview:Ui,resize(){let{width:j,height:X}=P.resize();C.setAspect(j/Math.max(1,X)),tt(),Tt(),Hi(),Y.requestRender()},stats(){return{...Y.stats(),drawCalls:h?h.drawCalls:0,seatCount:o.seatCount}},getQualityEvidence(){let j=Y.stats(),X=P.canvas.clientWidth||1,W=P.canvas.clientHeight||1,ee=o.bounds.center,oe=Ge(C.camera.projectionViewMatrix,[ee[0],o.bounds.box.min[1],ee[2]],X,W),re=Ge(C.camera.projectionViewMatrix,[ee[0],o.bounds.box.max[1],ee[2]],X,W),le=o.bounds.box,ue=[le.min[0],le.max[0]].flatMap(Q=>[le.min[1],le.max[1]].flatMap(fe=>[le.min[2],le.max[2]].map(Pe=>Ge(C.camera.projectionViewMatrix,[Q,fe,Pe],X,W)))).filter(Q=>Number.isFinite(Q.x)&&Number.isFinite(Q.y)&&Number.isFinite(Q.depth)),Ye=ue.length?(()=>{let Q=Math.min(...ue.map(We=>We.x)),fe=Math.max(...ue.map(We=>We.x)),Pe=Math.min(...ue.map(We=>We.y)),kt=Math.max(...ue.map(We=>We.y)),ht=Math.max(0,Q),Lt=Math.min(X,fe),Ce=Math.max(0,Pe),pt=Math.min(W,kt),_t=Math.max(0,Lt-ht),yn=Math.max(0,pt-Ce);return{box:{x:ht,y:Ce,width:_t,height:yn},horizontalFillRatio:_t/X,verticalFillRatio:yn/W,visibleAreaRatio:_t*yn/(X*W),clippedEdges:[...Pe<0?["top"]:[],...fe>X?["right"]:[],...kt>W?["bottom"]:[],...Q<0?["left"]:[]]}})():void 0,Be=String(P.gl.getParameter(P.gl.VERSION)??"");return{viewport:{width:X,height:W},context:{webgl2:/webgl\s*2/i.test(Be),lost:d},frame:{rendered:j.rendered,idle:j.idle},camera:{position:[C.camera.position.x,C.camera.position.y,C.camera.position.z],distance:C.currentDistance,verticalFovDeg:C.fovY},scene:{seatCount:o.seatCount,floorCount:o.floors.length,zoneCount:o.zones.length,sectionCount:o.sections.length,authoredRelief:l,renderedVerticalSpanM:Math.max(0,o.bounds.box.max[1]-o.bounds.box.min[1]),projectedReliefPx:oe.visible&&re.visible?Math.abs(oe.y-re.y):0},labels:F.qualityEvidence(),framing:Ye}},getQualityReport(){return tn(bn.getQualityEvidence())},loseContextForTest(){P.simulateContextLossCycle()},floors(){return o.floors},focusFloor(j){if(j!==null&&!o.floors.some(W=>W.index===j))return!1;let X=j??-1;if(M(j!==null),De(!1),ji(X),we("orbit"),j===null)B.cancel(),Z()?C.frame(o.bounds,!1,H,n.portraitOverviewCrop===!0,k):C.frameSoft(o.bounds,H,n.portraitOverviewCrop===!0,k);else{let W=o.floors[j];if(W.seatCount>0){B.cancel();let ee=W.focalWorld[0]-W.center[0],oe=W.focalWorld[2]-W.center[2],re=Math.hypot(ee,oe)>W.radius*.12?Math.atan2(ee,oe):H;C.frame({center:W.center,radius:W.radius,box:W.box},!1,re,!1,{polarDeg:58,margin:1.12})}}return Y.requestRender(),!0},zones(){return o.zones},focusZone(j){let X=o.zones.find(re=>re.id===j);if(!X||X.seatCount===0)return!1;M(!1),De(!1),B.cancel(),we("orbit"),L(null),n.onSectionFocusChange?.(null);let W=X.focalWorld[0]-X.center[0],ee=X.focalWorld[2]-X.center[2],oe=Math.hypot(W,ee)>X.radius*.12?Math.atan2(W,ee):void 0;return C.frame({center:X.center,radius:X.radius*1.25},!1,oe),Y.requestRender(),!0},sections(){return o.sections},focusSection(j){return ao(j)},rows(j){return j?o.rows.filter(X=>X.sectionId===j):o.rows},seatsInRow(j){return t.seats.filter(X=>X.rowId===j).map(X=>({id:X.id,label:X.displayLabel||X.label}))},focusRow(j){let X=o.rows.find(W=>W.id===j);return!X||X.seatCount===0?!1:(M(!0),De(!1),B.cancel(),we("pan"),X.sectionId&&(L(X.sectionId),n.onSectionFocusChange?.(X.sectionId)),C.frame({center:X.center,radius:Math.max(2.5,X.radius*.65)}),Y.requestRender(),!0)},setReducedMotionForTest(j){I=j},dispose(){p=!0,ce(),pn.remove(),nt.remove(),ro(),Y.stop(),F.dispose(),K?.disconnect(),b&&(b.dispose(),b=null),R(),E(),P.canvas.removeEventListener("pointerdown",Oe.onDown),P.canvas.removeEventListener("pointermove",Oe.onMove),P.canvas.removeEventListener("pointerup",Oe.onUp),P.canvas.removeEventListener("pointercancel",Oe.onUp),C.dispose(),m&&m.dispose(),h&&h.dispose(),h=null,m=null,P.dispose()}};return i.opened(o.seatCount,l,t.prepared?.buildMs??performance.now()-r,t.prepared?.source??"inline"),bn}0&&(module.exports={VENUE3D_QUALITY_REPORT_VERSION,buildSceneModel,inspectVenue3DQualityEvidence,mountVenue3D,prepareVenue3D});
|
|
633
|
+
}`;function si(e){return new He.Program(e,{vertex:Oc,fragment:Bc,transparent:!1,depthTest:!0,depthWrite:!0,cullFace:!1,uniforms:{uSeatRadius:{value:Le},uSeatScale:{value:1},uMinPixels:{value:ct},uPixelToWorld:{value:.002},uChairFull:{value:St},uChairNone:{value:lt},uFocusFloor:{value:-1}}})}function ci(e){return new He.Program(e,{vertex:Vc,fragment:Nc,transparent:!1,depthTest:!0,depthWrite:!0,cullFace:!1,uniforms:{uChairFull:{value:St},uChairNone:{value:lt},uBackRake:{value:Ln},uBackBase:{value:Kt},uFocusFloor:{value:-1}}})}function li(e){return new He.Program(e,{vertex:Gc,fragment:zc,transparent:!1,depthTest:!0,depthWrite:!0,cullFace:!1,uniforms:{uFocusFloor:{value:-1}}})}function ui(e,t=.78){return new He.Program(e,{vertex:Rc,fragment:Ec,cullFace:!1,depthTest:!0,depthWrite:!0,uniforms:{uKeyDir:{value:new Float32Array([.38,.86,.34])},uFocusFloor:{value:-1},uStructureDetail:{value:0},uRoughness:{value:t}}})}function di(e){return new He.Program(e,{vertex:kc,fragment:Tc,transparent:!0,depthTest:!0,depthWrite:!1,cullFace:!1,uniforms:{uSeatRadius:{value:Le},uSeatScale:{value:1},uMinPixels:{value:ct},uPixelToWorld:{value:.002},uSeatFade:{value:0},uSeatDetail:{value:0},uFocusFloor:{value:-1},uFadeColor:{value:new Float32Array([.32,.37,.43])},uChairFull:{value:St},uChairNone:{value:lt}}})}function mi(e,t=.78){return new He.Program(e,{vertex:Lc,fragment:_c,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:St},uChairNone:{value:lt},uBackRake:{value:Ln},uBackBase:{value:Kt},uFocusFloor:{value:-1},uRoughness:{value:t}}})}function fi(e,t,n){return new He.Program(e,{vertex:Fc,fragment:Dc,depthTest:!1,depthWrite:!1,cullFace:!1,uniforms:{uTop:{value:new Float32Array(t)},uBottom:{value:new Float32Array(n)}}})}function hi(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 Uc=new Float32Array([-1,-1,1,-1,1,1,-1,-1,1,1,-1,1]),Hc=new Float32Array([-1,-1,3,-1,-1,3]);function pi(e,t){let n=new ae.Transform,r=new ae.Transform,o=new ae.Geometry(e,{position:{size:2,data:Hc}}),i=fi(e,t.theme.background.top,t.theme.background.bottom),a=new ae.Mesh(e,{geometry:o,program:i});a.frustumCulled=!1,a.setParent(r);let s=new ae.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=ui(e,t.theme.materials.roughness),l=new ae.Mesh(e,{geometry:s,program:c});l.frustumCulled=!1,l.setParent(n);let f=di(e),u=new Float32Array(t.seats.count*3),d=Me.map(T=>t.theme.seatStates[T]);hi(u,t.seats.iState,0,t.seats.count,d,t.seats.iCategory);let m=new ae.Geometry(e,{position:{size:2,data:Uc},iOffset:{size:3,data:t.seats.iPosition,instanced:1},iColor:{size:3,data:u,instanced:1},iMaxRadius:{size:1,data:t.seats.iMaxRadius,instanced:1},iPhysicalSeat:{size:1,data:t.seats.iPhysicalSeat,instanced:1},iRing:{size:3,data:t.seats.iRing,instanced:1},iFloor:{size:1,data:t.seats.iFloor,instanced:1}}),h=new ae.Mesh(e,{geometry:m,program:f});h.frustumCulled=!1,t.seats.count>0&&h.setParent(n);let p=m.attributes.iColor,g=No(),b=mi(e,t.theme.materials.roughness),y=zt,x=new Float32Array(y*3),v=new Float32Array(y*3),C=new Float32Array(y),M=new Float32Array(y),I=new Float32Array(y),_=new Float32Array(y*3),B=new Float32Array(y),z=new Float32Array(y),V=new Float32Array(y),A=new Float32Array(y),S=new ae.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:x,instanced:1},iColor:{size:3,data:v,instanced:1},iRadius:{size:1,data:C,instanced:1},iYaw:{size:1,data:M,instanced:1},iGlyph:{size:1,data:I,instanced:1},iRing:{size:3,data:_,instanced:1},iFloor:{size:1,data:B,instanced:1},iPhysicalSeat:{size:1,data:z,instanced:1},iSeed:{size:1,data:A,instanced:1},iPickIndex:{size:1,data:V,instanced:1}}),R=new ae.Mesh(e,{geometry:S,program:b});R.frustumCulled=!1;let w=0,P=!1,G=!1,k=null,E=null,F=null,D=new Int32Array(0),N=()=>{let T=t.seats;for(let L=0;L<w;L++){let H=D[L];A[L]=zo(T.iState[H],H);let q=T.iCategory&&T.iState[H]===0?null:d[T.iState[H]]??d[0];if(q)v[L*3]=q[0],v[L*3+1]=q[1],v[L*3+2]=q[2];else{let Q=t.theme.materials.seat??bo([T.iCategory[H*3],T.iCategory[H*3+1],T.iCategory[H*3+2]]);v[L*3]=Q[0],v[L*3+1]=Q[1],v[L*3+2]=Q[2]}}S.attributes.iColor.needsUpdate=!0,S.attributes.iSeed.needsUpdate=!0},j={main:n,background:r,seatProgram:f,solidProgram:c,chairProgram:b,seatGeometry:m,chairGeometry:S,solidGeometry:s,drawCalls:3,setNearSeats(T,L){let H=Math.min(L,y);if(D=T,w=H,H===0){R.parent&&R.setParent(null),S.instancedCount=0,j.drawCalls=3+(P?1:0);return}let W=t.seats;for(let q=0;q<H;q++){let Q=T[q];x[q*3]=W.iPosition[Q*3],x[q*3+1]=W.iPosition[Q*3+1],x[q*3+2]=W.iPosition[Q*3+2],C[q]=W.iChairWidth[Q],M[q]=W.iYaw[Q],I[q]=W.iGlyph[Q],_[q*3]=W.iRing[Q*3],_[q*3+1]=W.iRing[Q*3+1],_[q*3+2]=W.iRing[Q*3+2],B[q]=W.iFloor[Q],z[q]=W.iPhysicalSeat[Q],V[q]=Q+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=H,R.parent||R.setParent(n),j.drawCalls=4+(P?1:0)},nearSeatCount(){return w},uploadSeatStateRuns(T){if(!T.length)return;w&&N();for(let H of T)hi(u,t.seats.iState,H.start,H.length,d,t.seats.iCategory);let L=p.buffer;if(!L){p.needsUpdate=!0;return}e.bindBuffer(e.ARRAY_BUFFER,L);for(let H of T){let W=u.subarray(H.start*3,(H.start+H.length)*3);e.bufferSubData(e.ARRAY_BUFFER,H.start*3*Float32Array.BYTES_PER_ELEMENT,W)}},dispose(){G=!0,o.remove(),i.remove(),s.remove(),c.remove(),m.remove(),f.remove(),S.remove(),b.remove(),k?.remove(),E?.remove(),F?.texture&&e.deleteTexture(F.texture)}},U=t.productionElements.find(T=>T.contentImageUrl&&T.contentPlane);if(U?.contentImageUrl&&U.contentPlane?.length===4&&typeof Image<"u"){let T=new Image;T.crossOrigin="anonymous",T.onload=()=>{if(G)return;let L=U.contentPlane;k=new ae.Geometry(e,{position:{size:3,data:new Float32Array(L.flat())},uv:{size:2,data:new Float32Array([0,1,1,1,0,0,1,0])},floorIndex:{size:1,data:new Float32Array(4).fill(U.floorIndex)},index:{data:new Uint16Array([0,1,2,2,1,3])}}),F=new ae.Texture(e,{image:T,generateMipmaps:!0,wrapS:e.CLAMP_TO_EDGE,wrapT:e.CLAMP_TO_EDGE,flipY:!1}),E=new ae.Program(e,{vertex:`#version 300 es
|
|
634
|
+
precision highp float;
|
|
635
|
+
in vec3 position; in vec2 uv; in float floorIndex;
|
|
636
|
+
uniform mat4 modelViewMatrix; uniform mat4 projectionMatrix; uniform float uFocusFloor;
|
|
637
|
+
out vec2 vUv; out float vDim;
|
|
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
|
+
precision highp float;
|
|
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:F},uFocusFloor:{value:-1}},transparent:!1,depthTest:!0,depthWrite:!0,cullFace:!1});let H=new ae.Mesh(e,{geometry:k,program:E});H.frustumCulled=!1,H.setParent(n),j.screenProgram=E,P=!0,j.drawCalls=3+(w?1:0)+1},T.src=U.contentImageUrl}return j}var ke=require("ogl");function jc(e,t,n){let r=e+(t<<8)+(n<<16);return r===0?-1:r-1}function bi(e,t,n,r,o,i){let a=-1,s=1/0;for(let c=0;c<n;c++)for(let l=0;l<t;l++){let f=(c*t+l)*4,u=jc(e[f],e[f+1],e[f+2]);if(u<0||u>=i)continue;let d=l-r,m=c-o,h=d*d+m*m;h<s&&(s=h,a=u)}return a}function gi(e,t,n,r,o,i){let a=e-n.left,s=t-n.top,c=Math.round(a*r),l=Math.round((n.height-s)*r);return{x:Math.max(0,Math.min(o-1,c)),y:Math.max(0,Math.min(i-1,l))}}var Yc=["uSeatRadius","uSeatScale","uMinPixels","uPixelToWorld"],cn=class{constructor(t,n,r,o,i){this.seatScene=new ke.Transform;this.chairScene=new ke.Transform;this.solidScene=new ke.Transform;this.target=null;this.restoreClear=[0,0,0];this.renderer=t,this.gl=t.gl,this.maxIndex=i,this.seatProg=si(this.gl),this.chairProg=ci(this.gl),this.depthProg=li(this.gl);let a=new ke.Mesh(this.gl,{geometry:n,program:this.seatProg});a.frustumCulled=!1,a.setParent(this.seatScene);let s=new ke.Mesh(this.gl,{geometry:r,program:this.chairProg});s.frustumCulled=!1,s.setParent(this.chairScene);let c=new ke.Mesh(this.gl,{geometry:o,program:this.depthProg});c.frustumCulled=!1,c.setParent(this.solidScene)}setRestoreClear(t){this.restoreClear=[t[0],t[1],t[2]]}syncFromSeatProgram(t){for(let r of Yc)this.seatProg.uniforms[r].value=t.uniforms[r].value;let n=t.uniforms.uFocusFloor.value;this.seatProg.uniforms.uFocusFloor.value=n,this.chairProg.uniforms.uFocusFloor.value=n,this.depthProg.uniforms.uFocusFloor.value=n}ensureTarget(){let t=this.gl.drawingBufferWidth,n=this.gl.drawingBufferHeight;return this.target&&(this.target.width!==t||this.target.height!==n)&&this.destroyTarget(),this.target||(this.target=new ke.RenderTarget(this.gl,{width:t,height:n,depth:!0})),this.target}destroyTarget(){if(!this.target)return;let t=this.gl;this.target.buffer&&t.deleteFramebuffer(this.target.buffer);for(let n of this.target.textures??[])n.texture&&t.deleteTexture(n.texture);this.target.depthBuffer&&t.deleteRenderbuffer(this.target.depthBuffer),this.target=null}pick(t,n,r,o){let i=this.gl,a=this.ensureTarget(),s=i.drawingBufferWidth,c=i.drawingBufferHeight,l=Math.max(0,n-o),f=Math.max(0,r-o),u=Math.max(1,Math.min(s,n+o+1)-l),d=Math.max(1,Math.min(c,r+o+1)-f);i.enable(i.SCISSOR_TEST),i.scissor(l,f,u,d);let[m,h,p]=this.restoreClear;i.clearColor(0,0,0,1),this.renderer.render({scene:this.solidScene,camera:t,target:a,clear:!0}),this.renderer.render({scene:this.seatScene,camera:t,target:a,clear:!1}),this.renderer.render({scene:this.chairScene,camera:t,target:a,clear:!1}),i.clearColor(m,h,p,1),i.disable(i.SCISSOR_TEST);let g=new Uint8Array(u*d*4);return this.renderer.bindFramebuffer(a),i.readPixels(l,f,u,d,i.RGBA,i.UNSIGNED_BYTE,g),this.renderer.bindFramebuffer(),bi(g,u,d,n-l,r-f,this.maxIndex)}dispose(){this.destroyTarget(),this.seatProg.remove(),this.chairProg.remove(),this.depthProg.remove()}};function yi(e,t){let n=[];for(let r of t)e.has(r.seatId)?e.set(r.seatId,Mt(r.state)):n.push(r);return n}function xi(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:Me[s]??"available"}),o.delete(a));for(let a of r){if(o.has(a))continue;let s=n(a);s!==void 0&&(o.set(a,s),i.push({seatId:a,state:"selected"}))}return{updates:i,next:o}}var je=require("ogl");function Xc(e,t){return[e[0]-t[0],e[1]-t[1],e[2]-t[2]]}function vi(e,t){return[e[0]+t[0],e[1]+t[1],e[2]+t[2]]}function Wc(e,t){return[e[0]*t,e[1]*t,e[2]*t]}function Mi(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 to(e,t){return Math.max(0,Math.min(1,e+t))}function Si(e,t){let n=e.length;if(n===0)return[0,0,0];if(n===1)return[...e[0]];let r=Math.max(0,Math.min(1,t)),o=n-1,i=Math.floor(r*o);i>=o&&(i=o-1);let a=r*o-i,s=e[Math.max(0,i-1)],c=e[i],l=e[i+1],f=e[Math.min(n-1,i+2)],u=a*a,d=u*a,m=[0,0,0];for(let h=0;h<3;h++)m[h]=.5*(2*c[h]+(-s[h]+l[h])*a+(2*s[h]-5*c[h]+4*l[h]-f[h])*u+(-s[h]+3*c[h]-3*l[h]+f[h])*d);return m}function no(e,t,n,r,o){let i=Mi(Xc(t,n));i[0]===0&&i[1]===0&&i[2]===0&&(i=[0,0,1]);let a=vi(vi(t,Wc(i,2.5)),[0,1.5,0]),s=[t[0]-r[0],0,t[2]-r[2]],c=Mi(s);c[0]===0&&c[2]===0&&(c=[i[0],0,i[2]]);let l=Math.max(1,o),f=[r[0]+c[0]*l*1.3,r[1]+l*.75,r[2]+c[2]*l*1.3];return{waypoints:[e,f,a],finalPos:a}}function oo(e,t,n=35,r=28){let o=eo(t),i=Si(e,o),a=eo(Math.max(0,Math.min(1,(t-.66)/.34)));return{pos:i,fov:n+(r-n)*a,eased:o}}function Ci(e,t,n){let r=e.position.clone(),o=new je.Quat().copy(e.quaternion);e.position.set(t[0],t[1],t[2]),e.lookAt(new je.Vec3(n[0],n[1],n[2]));let i=new je.Quat().copy(e.quaternion);return e.position.copy(r),e.quaternion.copy(o),i}var ln=class{constructor(t){this.active=!1;this.waypoints=[];this.startQuat=new je.Quat;this.endQuat=new je.Quat;this.outQuat=new je.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}=oo(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,to(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 Kc=1.02,qc=1.5;function Ii(e,t,n=0,r){let o=Number.isFinite(r)?n+r:e[1]+Kc;return{eye:[e[0],o,e[2]],focal:[t.x*O,n+qc,t.y*O]}}var so=null;function Ni(){return so??=Promise.resolve().then(()=>(Vi(),Bi)).catch(e=>{throw so=null,e}),so}var Gi=()=>typeof performance<"u"&&performance.now?performance.now():Date.now(),pn=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=Gi(),this.emit("3d_panorama_opened")}panoramaClosed(){let t=this.panoramaOpenedAt?Math.round(Gi()-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 zi(e){let t=e.style.position;return getComputedStyle(e).position!=="static"?()=>{}:(e.style.position="relative",()=>{e.style.position==="relative"&&(e.style.position=t)})}function Ui(e){let{container:t,model:n,opts:r,expandedSeatById:o,seatIdsByRow:i,isNarrow:a}=e,s=null,c=()=>{if(!s)return;let u=a();Object.assign(s.style,u?{left:"12px",right:"12px",bottom:"70px",transform:"none",justifyContent:"center"}:{left:"50%",right:"auto",bottom:"18px",transform:"translateX(-50%)",justifyContent:"initial"})},l=()=>{s?.remove(),s=null};return{show:(u,d,m=!1)=>{if(l(),e.isDisposed())return null;let h=document.createElement("div");h.setAttribute("role","group"),Object.assign(h.style,{position:"absolute",display:"flex",flexDirection:"column",alignItems:"center",gap:"6px",zIndex:"4"});let p=o.get(u),g=p?.sectionId?n.sections.find(_=>_.id===p.sectionId):void 0,b=p?.label??u;h.setAttribute("aria-label",`Explore views near ${g?.label?`${g.label}, `:""}seat ${b}`);let y=document.createElement("span");y.textContent=["Live 3D seat view",g?.label,b].filter(Boolean).join(" \xB7 "),Object.assign(y.style,{maxWidth:"min(320px, calc(100vw - 32px))",padding:"5px 10px",borderRadius:"999px",overflow:"hidden",color:"#d9e3f5",background:"rgba(12,18,32,0.72)",font:"600 11px/1.2 inherit",textOverflow:"ellipsis",whiteSpace:"nowrap",backdropFilter:"blur(6px)"}),h.appendChild(y);let x=document.createElement("div");Object.assign(x.style,{display:"flex",alignItems:"center",justifyContent:"center",gap:"6px"}),h.appendChild(x);let v=p?.rowId?i.get(p.rowId):void 0,C=v?.indexOf(u)??-1,M=C>=0?[v?.[C-1],v?.[C+1]]:[void 0,void 0],I=(_,B,z,V=!1)=>{let A=document.createElement("button");A.type="button",A.textContent=_,A.setAttribute("aria-label",B),Object.assign(A.style,{minHeight:"44px",padding:V?"10px 16px":"10px",borderRadius:"999px",background:"rgba(12,18,32,0.78)",color:"#eef1f8",border:"1px solid rgba(150,165,205,0.4)",backdropFilter:"blur(6px)",font:"600 13px/1 inherit",cursor:"pointer",whiteSpace:"nowrap"}),V||(A.style.minWidth="44px"),V&&(A.dataset.panoramaTrigger=""),A.addEventListener("click",z),x.appendChild(A)};if(M[0]){let _=o.get(M[0])?.label??M[0];I("\u2039",`View previous seat ${_}`,()=>{e.flyToSeat(M[0])})}if(r.getSeatView){let _=r.seatViewActionLabel?.(u)??"Open 360\xB0 panorama";I(m?`\u21BB Retry ${_}`:`\u25C9 ${_}`,`${m?"Retry":_} from seat ${b}`,()=>{if(e.isDisposed()||d!==e.flightGen()){l();return}l(),e.openPanorama(u,400,d)},!0)}if(M[1]){let _=o.get(M[1])?.label??M[1];I("\u203A",`View next seat ${_}`,()=>{e.flyToSeat(M[1])})}return x.childElementCount?(t.appendChild(h),s=h,c(),h):null},remove:l,layout:c}}function Hi(e){let{container:t,orbit:n,isNarrow:r}=e,o=document.createElement("div"),i=!1;o.className="sl-3d-navigation-controls",Object.assign(o.style,{position:"absolute",right:"14px",bottom:"14px",display:"flex",zIndex:"4",flexDirection:"column",alignItems:"flex-end",gap:"7px"});let a=document.createElement("div");a.setAttribute("role","group"),a.setAttribute("aria-label","3D drag mode"),Object.assign(a.style,{display:"flex",flexDirection:"column",gap:"6px",alignItems:"flex-end"});let s=document.createElement("div");s.setAttribute("role","group"),s.setAttribute("aria-label","3D view controls"),Object.assign(s.style,{display:"flex",flexDirection:"column",gap:"6px",alignItems:"flex-end"});let c=document.createElement("button");c.type="button",c.textContent="\u21BB",c.setAttribute("aria-label","Drag to rotate the 3D venue"),c.dataset.tooltip="Rotate venue";let l=document.createElement("button");l.type="button",l.textContent="\u2725",l.setAttribute("aria-label","Drag to move the 3D venue left, right, up or down"),l.dataset.tooltip="Move venue";let f=document.createElement("button");f.type="button",f.textContent="\u2212",f.setAttribute("aria-label","Zoom out of the 3D venue"),f.dataset.tooltip="Zoom out";let u=document.createElement("button");u.type="button",u.textContent="+",u.setAttribute("aria-label","Zoom into the 3D venue"),u.dataset.tooltip="Zoom in";for(let p of[c,l,f,u])p.className="sl-3d-icon-control",Object.assign(p.style,{width:"44px",minWidth:"44px",minHeight:"44px",padding:"9px",border:"1px solid rgba(150,165,205,0.35)",borderRadius:"999px",color:"#c9d4ea",background:"rgba(12,18,32,0.82)",font:"600 17px/1 inherit",backdropFilter:"blur(6px)",cursor:"pointer",whiteSpace:"nowrap"});a.append(c,l),s.append(u,f);let d=p=>{n.setPrimaryDragMode(p);let g=p==="orbit";c.setAttribute("aria-pressed",String(g)),l.setAttribute("aria-pressed",String(!g)),c.style.background=g?"rgba(96,110,150,0.68)":"rgba(12,18,32,0.82)",l.style.background=g?"rgba(12,18,32,0.82)":"rgba(96,110,150,0.68)",o.title=g?"Drag to rotate \xB7 Shift-drag to move":"Drag to move \xB7 Shift-drag to rotate"};c.addEventListener("click",()=>d("orbit")),l.addEventListener("click",()=>d("pan")),f.addEventListener("click",()=>n.zoomBy(1.22)),u.addEventListener("click",()=>n.zoomBy(.82)),o.append(a,s),d("orbit"),t.appendChild(o);let m=()=>{let p=r();o.style.display=i?"none":"flex",o.style.right=p?"12px":"14px",o.style.bottom=p?"calc(env(safe-area-inset-bottom, 0px) + 76px)":"14px",a.style.display=p?"none":"flex",u.style.display=p?"none":"",f.style.display=p?"none":""};return m(),{element:o,utilityControls:s,setNavigationMode:d,setSeatViewLocked:p=>{i=p,n.setInteractionEnabled(!p),m()},seatViewLocked:()=>i,layout:m}}function ji(e){let{glctx:t,orbit:n,model:r,seats:o,opts:i,cinematic:a,analytics:s,seatIdByIndex:c,sectionIdBySeatId:l,tapSlop:f,tapMs:u,cancelFlight:d,focusSectionCamera:m,setSelection:h,ensureSeatView:p}=e,g=0,b=0,y=0,x=-1,v=!1,C=!1,M=V=>{e.seatViewLocked()||x===-1&&(x=V.pointerId,g=V.clientX,b=V.clientY,y=performance.now(),v=!1,C=a.active,a.active&&(s.cinematicCancelled(),d(),i.onViewTargetChange?.(null)))},I=V=>{V.pointerId===x&&Math.hypot(V.clientX-g,V.clientY-b)>f&&(v=!0)},_=(V,A,S,R,w)=>{let P=t.canvas.getBoundingClientRect(),G=t.canvas.clientWidth||P.width||1,k=t.canvas.clientHeight||P.height||1,E=V-P.left,F=A-P.top,D=R*R,N=-1,j=D,U=1/0;for(let T of o){if(S&&T.sectionId!==S)continue;let L=r.seats.idToIndex.get(T.id);if(L===void 0)continue;if(w){let ne=Math.round(r.seats.iState[L]??0);if(ne!==0&&ne!==3)continue}let H=L*3,W=Ue(n.camera.projectionViewMatrix,[r.seats.iPosition[H],r.seats.iPosition[H+1]+.55,r.seats.iPosition[H+2]],G,k);if(!W.visible)continue;let q=W.x-E,Q=W.y-F,$=q*q+Q*Q;($<j||Math.abs($-j)<1&&W.depth<U)&&(N=L,j=$,U=W.depth)}return N},B=(V,A)=>{let S=e.gpu(),R=e.pick();if(!S||!R)return-1;R.syncFromSeatProgram(S.seatProgram);let w=t.canvas.getBoundingClientRect(),P=t.renderer.dpr,{x:G,y:k}=gi(V,A,w,P,t.gl.drawingBufferWidth,t.gl.drawingBufferHeight),E=Math.max(2,Math.round(8*P));return R.pick(n.camera,G,k,E)};return{onDown:M,onMove:I,onUp:V=>{if(V.pointerId!==x)return;let A=!v&&performance.now()-y<u;if(x=-1,C){C=!1;return}let S=e.gpu(),R=e.pick();if(!A||!S||!R)return;let w=B(V.clientX,V.clientY);if(e.focusedSectionId()&&w>=0){let k=c[w],E=k?l.get(k):void 0;if(E&&E!==e.focusedSectionId()&&m(E))return}if(e.focusedSectionId()&&w<0&&(w=_(V.clientX,V.clientY,e.focusedSectionId(),44,!1)),e.focusedSectionId()&&w<0){let k=_(V.clientX,V.clientY,null,72,!1),E=k>=0?c[k]:void 0,F=E?l.get(E):void 0;if(F&&F!==e.focusedSectionId()&&m(F))return}if(!e.focusedSectionId()){w<0&&(w=_(V.clientX,V.clientY,null,42,!1));let k=w>=0?c[w]:void 0,E=k?l.get(k):void 0;if(E&&m(E))return}if(w<0||w>=c.length){e.selection().size&&(h([]),i.onViewTargetChange?.(null));return}let P=c[w],G=Me[Math.round(r.seats.iState[w]??0)]??"available";if(G!=="available"&&G!=="selected"){i.onSeatInspect?.(P,G);return}if(e.selection().has(P)&&e.selection().size===1){h([]),i.onViewTargetChange?.(null);return}h([P]),p(P),s.seatPicked(P,l.get(P)),i.onSeatPick?.(P)}}}var bn=class{constructor(t,n){this.minX=0;this.minZ=0;this.cell=1;this.cols=1;this.rows=1;this.cellStart=null;this.cellItems=null;this.iPosition=t,this.count=n}ensureGrid(){if(this.cellStart||this.count===0)return;let t=this.iPosition,n=1/0,r=1/0,o=-1/0,i=-1/0;for(let m=0;m<this.count;m++){let h=t[m*3],p=t[m*3+2];h<n&&(n=h),h>o&&(o=h),p<r&&(r=p),p>i&&(i=p)}let a=Math.max(o-n,.001),s=Math.max(i-r,.001);this.cell=Math.max(Math.sqrt(a*s*4/this.count),.25),this.cols=Math.max(1,Math.ceil(a/this.cell)+1),this.rows=Math.max(1,Math.ceil(s/this.cell)+1),this.minX=n,this.minZ=r;let c=this.cols*this.rows,l=new Int32Array(c+1),f=m=>{let h=Math.min(this.cols-1,Math.max(0,Math.floor((t[m*3]-n)/this.cell)));return Math.min(this.rows-1,Math.max(0,Math.floor((t[m*3+2]-r)/this.cell)))*this.cols+h};for(let m=0;m<this.count;m++)l[f(m)+1]++;for(let m=0;m<c;m++)l[m+1]+=l[m];let u=new Int32Array(this.count),d=l.slice(0,c);for(let m=0;m<this.count;m++)u[d[f(m)]++]=m;this.cellStart=l,this.cellItems=u}gather(t,n,r,o){this.ensureGrid();let i=this.cellStart,a=this.cellItems;if(!i||!a)return 0;let s=o.length,c=r*r,l=Math.floor((t-this.minX)/this.cell),f=Math.floor((n-this.minZ)/this.cell),u=Math.ceil(r/this.cell)+1,d=this.iPosition,m=0;for(let h=0;h<=u&&m<s;h++){let p=f-h,g=f+h,b=l-h,y=l+h;for(let x=p;x<=g&&m<s;x++){if(x<0||x>=this.rows)continue;let v=x===p||x===g;for(let C=b;C<=y&&m<s;C++){if(!v&&C!==b&&C!==y){C=y-1;continue}if(C<0||C>=this.cols)continue;let M=x*this.cols+C;for(let I=i[M],_=i[M+1];I<_&&m<s;I++){let B=a[I],z=d[B*3]-t,V=d[B*3+2]-n;z*z+V*V<=c&&(o[m++]=B)}}}}return m}};var gn=class{constructor(t){this.ctx=t;this.detailVisible=!1;this.seatDetailMix=0;this.structureDetailMix=0;this.nearBuf=new Int32Array(zt);this.lastGatherX=1/0;this.lastGatherZ=1/0;this.nearIndex=new bn(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)<An)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>In){r.nearSeatCount()&&r.setNearSeats(this.nearBuf,0);return}let s=this.nearIndex.gather(o.x,o.z,In,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 yn=require("ogl");function Yi(e){let{container:t,model:n,opts:r,orbit:o,cinematic:i,analytics:a,loop:s,labelOverlay:c,stageAzimuth:l,overviewFraming:f}=e,u=0,d=-1,m=(C,M,I=28)=>{o.camera.position.set(C[0],C[1],C[2]),o.camera.lookAt(new yn.Vec3(M[0],M[1],M[2])),o.camera.fov=I,o.camera.updateProjectionMatrix()},h=document.createElement("button");h.className="sl-3d-overview-control sl-3d-icon-control",h.type="button",h.textContent="\u2302",h.setAttribute("aria-label","Fit the active level or whole venue in view"),h.dataset.tooltip="Fit view",Object.assign(h.style,{width:"44px",minWidth:"44px",minHeight:"44px",padding:"9px",borderRadius:"999px",background:"rgba(12,18,32,0.72)",color:"#c9d4ea",border:"1px solid rgba(150,165,205,0.35)",backdropFilter:"blur(6px)",font:"600 11px/1 inherit",cursor:"pointer",whiteSpace:"nowrap"});let p=()=>{h.textContent="\u2302"};p();let g=C=>{d=C;let M=e.gpu();M&&(M.seatProgram.uniforms.uFocusFloor.value=C,M.solidProgram.uniforms.uFocusFloor.value=C,M.chairProgram.uniforms.uFocusFloor.value=C),e.showSectionSeatLabels(null)},b=()=>{if(e.isDisposed())return;r.onViewTargetChange?.(null),r.onSectionFocusChange?.(null),e.panorama()&&(e.panorama().dispose(),e.setPanorama(null),a.panoramaClosed()),e.setPanoramaSphereVisible(!1),e.panoramaLoadAbort()?.abort(),e.setPanoramaLoadAbort(null),e.restorePanoramaLayer(),h.style.display="",c.setVisible(!0),e.setFrozen(!1);let C=d>=0?n.floors[d]:null;if(e.setNearFieldDetailEnabled(!!C),e.setSeatViewLocked(!1),y(),e.removeArriveChip(),e.setNavigationMode("orbit"),C){let M=C.focalWorld[0]-C.center[0],I=C.focalWorld[2]-C.center[2],_=Math.hypot(M,I)>C.radius*.12?Math.atan2(M,I):l,B={center:C.center,radius:C.radius,box:C.box},z={polarDeg:58,margin:1.12};e.reducedMotion()?o.frame(B,!1,_,!1,z):o.frameSoft(B,_,!1,z)}else e.reducedMotion()?o.frame(n.bounds,!1,l,r.portraitOverviewCrop===!0,f):o.frameSoft(n.bounds,l,r.portraitOverviewCrop===!0,f);e.showSectionSeatLabels(null),s.requestRender()},y=()=>{u++,e.panoramaLoadAbort()?.abort(),e.setPanoramaLoadAbort(null),i.active&&(i.cancel(),o.resumeAfterFlight(n.focalWorld))},x=C=>{if(e.isDisposed()||!e.gpu())return Promise.resolve();let M=n.seats.idToIndex.get(C);if(M===void 0)return Promise.resolve();e.setNearFieldDetailEnabled(!0),r.onViewTargetChange?.(C),e.panorama()&&(e.panorama().dispose(),e.setPanorama(null),e.setPanoramaSphereVisible(!1),h.style.display="",e.restorePanoramaLayer()),e.panoramaLoadAbort()?.abort(),e.setPanoramaLoadAbort(null),e.setFrozen(!1),e.setSeatViewLocked(!1);let I=++u;e.removeArriveChip();let{eye:_,focal:B}=e.resolvedSeatViewPose(C,M),z=[o.camera.position.x,o.camera.position.y,o.camera.position.z],V=no(z,_,B,n.bounds.center,n.bounds.radius),A=r.arriveAtSeatEye?_:V.finalPos,S=r.arriveAtSeatEye?t.clientWidth/Math.max(1,t.clientHeight)<.7?90:65:28,R=[V.waypoints[0],V.waypoints[1],A];if(c.setVisible(!1),e.reducedMotion())return m(A,B,S),s.requestRender(),a.cinematicSkipped(),e.isDisposed()||o.syncFromCamera(),e.setSeatViewLocked(r.arriveAtSeatEye===!0),e.showArriveChip(C,I),Promise.resolve();let w=new yn.Quat().copy(o.camera.quaternion),P=Ci(o.camera,A,B);return s.requestRender(),i.start(R,w,P,2500,S).then(()=>{e.isDisposed()||I!==u||(a.cinematicPlayed(2500),o.resumeAfterFlight(B),e.setSeatViewLocked(r.arriveAtSeatEye===!0),s.requestRender(),e.showArriveChip(C,I))})},v=C=>{let M=n.sections.find(z=>z.id===C);if(!M||M.seatCount===0)return!1;e.setNearFieldDetailEnabled(!0),e.setSeatViewLocked(!1),i.cancel(),e.removeArriveChip(),n.floors.length>1&&d!==M.floorIndex&&g(M.floorIndex),e.setNavigationMode("pan"),e.showSectionSeatLabels(C);let I=M.focalWorld[0]-M.center[0],_=M.focalWorld[2]-M.center[2],B=Math.hypot(I,_)>M.radius*.12?Math.atan2(I,_):void 0;return o.frame({center:M.center,radius:Math.max(5,M.radius*.5)},!1,B),r.onSectionFocusChange?.(C),s.requestRender(),!0};return h.addEventListener("click",b),{overviewChip:h,layoutOverviewChip:p,flightGen:()=>u,focusedFloor:()=>d,applyFloorFocus:g,placeCameraFinal:m,cancelFlight:y,focusOverview:b,flyToSeat:x,focusSectionCamera:v}}var ll={};function Xi(e){let t=performance.now();return{model:ht(e),buildMs:performance.now()-t,source:"main"}}function Wi(e){return typeof Worker>"u"?Promise.resolve(Xi(e)):new Promise(t=>{let n=new Worker(new URL("./scene/scene.worker.ts",ll.url),{type:"module"}),r=!1,o=s=>{r||(r=!0,clearTimeout(a),n.terminate(),t(s))},i=()=>o(Xi(e)),a=window.setTimeout(i,15e3);n.onerror=i,n.onmessage=s=>{o({model:s.data.model,buildMs:s.data.buildMs,source:"worker"})},n.postMessage(e)})}var ul=Math.PI/180,dl=6,ml=500;function fl(e,t,n={}){let r=performance.now(),o=t.prepared?.model??ht(t),i=new pn(n.onAnalytics),a=new Array(o.seats.count);for(let[Y,X]of o.seats.idToIndex)a[X]=Y;let s=new Map(t.seats.map(Y=>[Y.id,Y])),c=new Map;for(let Y of t.seats){if(!Y.rowId)continue;let X=c.get(Y.rowId);X?X.push(Y.id):c.set(Y.rowId,[Y.id])}let l=new Map;for(let Y of t.seats)l.set(Y.id,Y.sectionId);let f=t.doc.floors?.some(X=>(X.baseHeightM??0)>0)?!0:(t.doc.floors?.flatMap(X=>X.objects)??t.doc.objects).some(X=>X.type==="section"&&((X.height??0)>0||(X.rake??0)>0)),u=null,d=null,m=!1,h=!1,p=!1,g=new Map,b=null,y=null,x=null,v=new Map,C=null,M=()=>{x===null&&(x=e.style.zIndex,e.style.zIndex="20")},I=()=>{x!==null&&(e.style.zIndex==="20"&&(e.style.zIndex=x),x=null)},_=!1,B=()=>_?fe.focusedFloor():-1,z=()=>{u=pi(R.gl,o),d=new cn(R.renderer,u.seatGeometry,u.chairGeometry,u.solidGeometry,o.seats.count),R.setClearColor(o.theme.background.top),d.setRestoreClear(o.theme.background.top),u.seatProgram.uniforms.uSeatRadius.value=Le*o.theme.seatScale,u.seatProgram.uniforms.uFocusFloor.value=B(),u.solidProgram.uniforms.uFocusFloor.value=B(),u.chairProgram.uniforms.uFocusFloor.value=B(),u.screenProgram&&(u.screenProgram.uniforms.uFocusFloor.value=B()),A.forceRegather()},V=!1,A=new gn({model:o,orbit:()=>w,gpu:()=>u}),S=Y=>A.setDetailEnabled(Y),R=new Vt(e,{onContextLost:()=>{p||i.contextLost(),m=!0,H.stop(),u=null,d=null},onContextRestored:()=>{z(),m=!1,p||i.contextRestored(),H.requestRender()}}),w=new Nt(R.gl,R.canvas,()=>H.requestRender(),()=>i.orbitEngaged());w.setAspect(R.aspect);let P=(t.doc.floors?.flatMap(Y=>Y.objects)??t.doc.objects).some(Y=>Y.type==="section"&&Y.physical3dProvenance?.surfaceKind?.status==="inferred"),G=(()=>{if(P&&o.stages.length===0)return;let Y=o.focalWorld[0]-o.bounds.center[0],X=o.focalWorld[2]-o.bounds.center[2];return Math.hypot(Y,X)>o.bounds.radius*.12?Math.atan2(Y,X):void 0})(),k=o.floors.length>1?{polarDeg:48,margin:1.1}:void 0,E=typeof window<"u"&&!!window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches;w.frame(o.bounds,!E&&n.skipInitialOverviewAnimation!==!0,G,n.portraitOverviewCrop===!0,k);let F=new ln(w.camera),D=zi(e),N=new rn(e,{fontFamily:t.doc.theme?.fontFamily,ink:t.doc.theme?.textColor,backgroundRgb:o.theme.background.top}),j=o.labels,U=()=>_r(j,o.floors.length,B());N.setLabels(U());let T=null,L=Y=>{if(T=Y,N.setForcedDense(!!Y),!Y){N.setLabels(U());return}let X=t.seats.filter(Z=>Z.sectionId===Y),K=new Set(X.map(Z=>Z.id)),te=new Set(X.map(Z=>Z.rowId)),oe=new Set(g.keys()),re=new Set(X.filter(Z=>oe.has(Z.id)).map(Z=>Z.id)),ue=U().filter(Z=>Z.kind!=="row"&&Z.kind!=="seat"||(Z.kind==="row"?te.has(Z.id.slice(4)):K.has(Z.id.slice(5))&&(re.size===0||re.has(Z.id.slice(5)))));if(o.seatCount<=6e3&&re.size===0){N.setLabels(ue);return}let de=re.size?X.filter(Z=>re.has(Z.id)):X,Ke=new Set(de.map(Z=>`seat:${Z.id}`)),Ne=de.flatMap(Z=>{let he=o.seats.idToIndex.get(Z.id);if(he===void 0)return[];let Ie=he*3;return[{id:`seat:${Z.id}`,kind:"seat",text:Z.displayLabel||Z.label,anchor:[o.seats.iPosition[Ie],o.seats.iPosition[Ie+1]+(oe.has(Z.id)?1.05:.55),o.seats.iPosition[Ie+2]]}]});N.setLabels([...ue.filter(Z=>!Ke.has(Z.id)),...Ne])};z();let H=new Gt(Y=>{if(m||!u||h)return!1;let K=F.active?F.update(performance.now()):w.update(),te=B()>=0?o.floors[B()]:null,oe=te?.radius??o.bounds.radius,re=Po(w.currentDistance,oe),ue=V?{center:[w.camera.position.x,w.camera.position.y,w.camera.position.z],radius:520}:o.renderBounds;w.updateClipping(ue);let de=te?.center??o.renderBounds.center,Ke=te?.radius??o.renderBounds.radius,Ne=(Ae,yt)=>Math.hypot(w.camera.position.x-Ae[0],w.camera.position.y-Ae[1],w.camera.position.z-Ae[2])<=yt*(A.detailVisible?1.8:1.55),Z=Ne(de,Ke);if(!Z&&T){let Ae=o.sections.find(yt=>yt.id===T);Ae&&(Z=Ne(Ae.center,Math.max(12,Ae.radius*2)))}A.detailVisible=Z;let he=u.seatProgram.uniforms;he.uSeatScale.value=re.scale,he.uSeatFade.value=re.fade;let Ie=!!te&&Co(te.seatCount,R.canvas.clientWidth||1,R.canvas.clientHeight||1),Ft=Io(o.seats.count,oe,w.currentDistance,w.camera.fov,R.canvas.clientHeight||1),gt=A.detailVisible||Ie||Ft?1:0,Dt=A.detailVisible||B()>=0||o.floors.length>1?1:0;return A.ease(Y,gt,Dt),he.uSeatDetail.value=A.seatDetailMix,u.solidProgram.uniforms.uStructureDetail.value=A.structureDetailMix,he.uMinPixels.value=re.minPixels,he.uPixelToWorld.value=2*Math.tan(w.camera.fov*ul/2)/Math.max(1,R.pixelHeight),A.update(A.detailVisible),R.renderer.render({scene:u.background,clear:!0}),R.renderer.render({scene:u.main,camera:w.camera,clear:!1}),N.update(w.camera.projectionViewMatrix,R.canvas.clientWidth||1,R.canvas.clientHeight||1,w.currentDistance,oe,[w.camera.position.x,w.camera.position.y,w.camera.position.z]),K||A.seatDetailMix!==gt||A.structureDetailMix!==Dt}),W=typeof ResizeObserver<"u"?new ResizeObserver(()=>vn.resize()):null;W?.observe(e);let q=Y=>{let X=oe=>{let re=o.seats.idToIndex.get(oe);return re===void 0?void 0:o.seats.iState[re]},{updates:K,next:te}=xi(g,Y,X);if(g=te,N.setSelectedSeatIds(g.keys()),T&&L(T),K.length){let oe=Fn(o.seats,K);u&&u.uploadSeatStateRuns(oe),H.requestRender()}},Q=()=>C!==null?C:typeof window<"u"&&!!window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,$=8,ne=Y=>{if(!n.getSeatView)return null;let X=v.get(Y);if(!X)for(X=Promise.resolve(n.getSeatView(Y)),v.set(Y,X),X.catch(()=>{v.get(Y)===X&&v.delete(Y)});v.size>$;){let K=v.keys().next().value;if(K===void 0)break;v.delete(K)}return X},Xe=(Y,X)=>{let K=s.get(Y),te=Math.max(0,Math.round(o.seats.iFloor[X]??0)),oe=t.doc.floors?.[te],re=o.floors[te],ue=oe?.focalPoint??t.doc.focalPoint,de=re?{x:re.focalWorld[0]/O,y:re.focalWorld[2]/O}:ue,Ke=K?.focalPoint?{x:K.focalPoint.x+de.x-ue.x,y:K.focalPoint.y+de.y-ue.y}:de,Ne=[o.seats.iPosition[X*3],o.seats.iPosition[X*3+1],o.seats.iPosition[X*3+2]];return Ii(Ne,Ke,oe?.baseHeightM??0,K?.eyeHeightM)},We=()=>(e.clientWidth||R.canvas.clientWidth)<=520,Se=null,De=null,Oe=async(Y,X,K)=>{if(!n.getSeatView||p||K!==fe.flightGen())return;let te;try{te=await Ni()}catch{if(i.panoramaFailed(Y,"mount"),!p&&K===fe.flightGen()){let oe=ye(Y,K,!0);requestAnimationFrame(()=>oe?.querySelector("[data-panorama-trigger]")?.focus())}return}if(!(p||K!==fe.flightGen()||!Se))return De??=te.createOpenPanorama(Se),De(Y,X,K)},we=Ui({container:e,model:o,opts:n,expandedSeatById:s,seatIdsByRow:c,isNarrow:We,isDisposed:()=>p,flightGen:()=>fe.flightGen(),flyToSeat:Y=>lo(Y),openPanorama:(Y,X,K)=>Oe(Y,X,K)}),ye=we.show,le=we.remove,ot=we.layout,Pe=Hi({container:e,orbit:w,isNarrow:We}),rt=Pe.element,Ce=Pe.setNavigationMode,Be=Pe.setSeatViewLocked,_t=Pe.layout,Ki=Pe.utilityControls,fe=Yi({container:e,model:o,opts:n,orbit:w,cinematic:F,analytics:i,loop:H,labelOverlay:N,stageAzimuth:G,overviewFraming:k,gpu:()=>u,isDisposed:()=>p,panorama:()=>b,setPanorama:Y=>{b=Y},setPanoramaSphereVisible:Y=>{V=Y},panoramaLoadAbort:()=>y,setPanoramaLoadAbort:Y=>{y=Y},setFrozen:Y=>{h=Y},restorePanoramaLayer:I,reducedMotion:Q,resolvedSeatViewPose:Xe,showSectionSeatLabels:L,setNearFieldDetailEnabled:S,setSeatViewLocked:Be,setNavigationMode:Ce,showArriveChip:ye,removeArriveChip:le});_=!0;let xn=fe.overviewChip,qi=fe.layoutOverviewChip,Qi=fe.applyFloorFocus,Zi=fe.focusOverview,co=fe.cancelFlight,lo=fe.flyToSeat,uo=fe.focusSectionCamera;Ki.appendChild(xn),Se={container:e,model:o,opts:n,analytics:i,orbit:w,loop:H,seatsById:s,ensureSeatView:ne,resolvedSeatViewPose:Xe,gpu:()=>u,gl:R.gl,isContextLost:()=>m,isDisposed:()=>p,flightGen:()=>fe.flightGen(),setPanorama:Y=>{b=Y},getLoadAbort:()=>y,setLoadAbort:Y=>{y=Y},setPanoramaSphereVisible:Y=>{V=Y},setFrozen:Y=>{h=Y},raisePanoramaLayer:M,restorePanoramaLayer:I,getOverviewChip:()=>xn,labelOverlay:N,reducedMotion:Q,removeArriveChip:le,showArriveChip:ye};let Ve=ji({glctx:R,orbit:w,model:o,seats:t.seats,opts:n,cinematic:F,analytics:i,seatIdByIndex:a,sectionIdBySeatId:l,tapSlop:dl,tapMs:ml,gpu:()=>u,pick:()=>d,seatViewLocked:()=>Pe.seatViewLocked(),focusedSectionId:()=>T,selection:()=>g,cancelFlight:co,focusSectionCamera:uo,setSelection:q,ensureSeatView:ne});R.canvas.addEventListener("pointerdown",Ve.onDown),R.canvas.addEventListener("pointermove",Ve.onMove),R.canvas.addEventListener("pointerup",Ve.onUp),R.canvas.addEventListener("pointercancel",Ve.onUp),H.requestRender();let vn={setAvailability(Y){let X=yi(g,Y),K=Fn(o.seats,X);K.length&&u&&u.uploadSeatStateRuns(K),H.requestRender()},setSelection:q,flyToSeat:lo,focusOverview:Zi,resize(){let{width:Y,height:X}=R.resize();w.setAspect(Y/Math.max(1,X)),ot(),_t(),qi(),H.requestRender()},stats(){return{...H.stats(),drawCalls:u?u.drawCalls:0,seatCount:o.seatCount}},getQualityEvidence(){let Y=H.stats(),X=R.canvas.clientWidth||1,K=R.canvas.clientHeight||1,te=o.bounds.center,oe=Ue(w.camera.projectionViewMatrix,[te[0],o.bounds.box.min[1],te[2]],X,K),re=Ue(w.camera.projectionViewMatrix,[te[0],o.bounds.box.max[1],te[2]],X,K),ue=o.bounds.box,de=[ue.min[0],ue.max[0]].flatMap(Z=>[ue.min[1],ue.max[1]].flatMap(he=>[ue.min[2],ue.max[2]].map(Ie=>Ue(w.camera.projectionViewMatrix,[Z,he,Ie],X,K)))).filter(Z=>Number.isFinite(Z.x)&&Number.isFinite(Z.y)&&Number.isFinite(Z.depth)),Ke=de.length?(()=>{let Z=Math.min(...de.map(qe=>qe.x)),he=Math.max(...de.map(qe=>qe.x)),Ie=Math.min(...de.map(qe=>qe.y)),Ft=Math.max(...de.map(qe=>qe.y)),gt=Math.max(0,Z),Dt=Math.min(X,he),Ae=Math.max(0,Ie),yt=Math.min(K,Ft),Ot=Math.max(0,Dt-gt),Mn=Math.max(0,yt-Ae);return{box:{x:gt,y:Ae,width:Ot,height:Mn},horizontalFillRatio:Ot/X,verticalFillRatio:Mn/K,visibleAreaRatio:Ot*Mn/(X*K),clippedEdges:[...Ie<0?["top"]:[],...he>X?["right"]:[],...Ft>K?["bottom"]:[],...Z<0?["left"]:[]]}})():void 0,Ne=String(R.gl.getParameter(R.gl.VERSION)??"");return{viewport:{width:X,height:K},context:{webgl2:/webgl\s*2/i.test(Ne),lost:m},frame:{rendered:Y.rendered,idle:Y.idle},camera:{position:[w.camera.position.x,w.camera.position.y,w.camera.position.z],distance:w.currentDistance,verticalFovDeg:w.fovY},scene:{seatCount:o.seatCount,floorCount:o.floors.length,zoneCount:o.zones.length,sectionCount:o.sections.length,authoredRelief:f,renderedVerticalSpanM:Math.max(0,o.bounds.box.max[1]-o.bounds.box.min[1]),projectedReliefPx:oe.visible&&re.visible?Math.abs(oe.y-re.y):0},labels:N.qualityEvidence(),framing:Ke}},getQualityReport(){return an(vn.getQualityEvidence())},loseContextForTest(){R.simulateContextLossCycle()},floors(){return o.floors},focusFloor(Y){if(Y!==null&&!o.floors.some(K=>K.index===Y))return!1;let X=Y??-1;if(S(Y!==null),Be(!1),Qi(X),Ce("orbit"),Y===null)F.cancel(),Q()?w.frame(o.bounds,!1,G,n.portraitOverviewCrop===!0,k):w.frameSoft(o.bounds,G,n.portraitOverviewCrop===!0,k);else{let K=o.floors[Y];if(K.seatCount>0){F.cancel();let te=K.focalWorld[0]-K.center[0],oe=K.focalWorld[2]-K.center[2],re=Math.hypot(te,oe)>K.radius*.12?Math.atan2(te,oe):G;w.frame({center:K.center,radius:K.radius,box:K.box},!1,re,!1,{polarDeg:58,margin:1.12})}}return H.requestRender(),!0},zones(){return o.zones},focusZone(Y){let X=o.zones.find(re=>re.id===Y);if(!X||X.seatCount===0)return!1;S(!1),Be(!1),F.cancel(),Ce("orbit"),L(null),n.onSectionFocusChange?.(null);let K=X.focalWorld[0]-X.center[0],te=X.focalWorld[2]-X.center[2],oe=Math.hypot(K,te)>X.radius*.12?Math.atan2(K,te):void 0;return w.frame({center:X.center,radius:X.radius*1.25},!1,oe),H.requestRender(),!0},sections(){return o.sections},focusSection(Y){return uo(Y)},rows(Y){return Y?o.rows.filter(X=>X.sectionId===Y):o.rows},seatsInRow(Y){return t.seats.filter(X=>X.rowId===Y).map(X=>({id:X.id,label:X.displayLabel||X.label}))},focusRow(Y){let X=o.rows.find(K=>K.id===Y);return!X||X.seatCount===0?!1:(S(!0),Be(!1),F.cancel(),Ce("pan"),X.sectionId&&(L(X.sectionId),n.onSectionFocusChange?.(X.sectionId)),w.frame({center:X.center,radius:Math.max(2.5,X.radius*.65)}),H.requestRender(),!0)},setReducedMotionForTest(Y){C=Y},dispose(){p=!0,le(),xn.remove(),rt.remove(),co(),H.stop(),N.dispose(),W?.disconnect(),b&&(b.dispose(),b=null),I(),D(),R.canvas.removeEventListener("pointerdown",Ve.onDown),R.canvas.removeEventListener("pointermove",Ve.onMove),R.canvas.removeEventListener("pointerup",Ve.onUp),R.canvas.removeEventListener("pointercancel",Ve.onUp),w.dispose(),d&&d.dispose(),u&&u.dispose(),u=null,d=null,R.dispose()}};return i.opened(o.seatCount,f,t.prepared?.buildMs??performance.now()-r,t.prepared?.source??"inline"),vn}0&&(module.exports={VENUE3D_QUALITY_REPORT_VERSION,buildSceneModel,inspectVenue3DQualityEvidence,mountVenue3D,prepareVenue3D});
|