@seatlayer/core 0.81.0 → 0.83.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ar-5VHC7HRK.js +1 -0
- package/dist/be-TK6YL7O3.js +1 -0
- package/dist/bg-FMA4EULF.js +1 -0
- package/dist/ca-A45FK52V.js +1 -0
- package/dist/{categoryInventory-H-Z3zkdw.d.ts → categoryInventory-CJAUVm-9.d.ts} +1 -1
- package/dist/{categoryInventory-B0QvDW6c.d.cts → categoryInventory-CXB_6cKR.d.cts} +1 -1
- package/dist/chunk-4ABXX5PL.js +1 -0
- package/dist/chunk-4I2VWFJY.js +1 -0
- package/dist/chunk-56QTNPLP.js +1 -0
- package/dist/{chunk-SKMHD76O.js → chunk-APMDM2YC.js} +1 -1
- package/dist/chunk-BS37TGPX.js +1 -0
- package/dist/chunk-FQ2MMJMH.js +1 -0
- package/dist/chunk-NJTU4QK7.js +1 -0
- package/dist/chunk-OTN5IFWY.js +1 -0
- package/dist/chunk-P4J57TK6.js +1 -0
- package/dist/chunk-TQN2VWQO.js +1 -0
- package/dist/core/chart-ops/index.cjs +1 -1
- package/dist/core/chart-ops/index.d.cts +4 -4
- package/dist/core/chart-ops/index.d.ts +4 -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.cjs +1 -1
- package/dist/core/layout/index.d.cts +5 -5
- package/dist/core/layout/index.d.ts +5 -5
- package/dist/core/layout/index.js +1 -1
- package/dist/core/quality/index.cjs +1 -1
- package/dist/core/quality/index.d.cts +32 -4
- package/dist/core/quality/index.d.ts +32 -4
- package/dist/core/quality/index.js +1 -1
- package/dist/core/render-assets/index.cjs +1 -1
- package/dist/core/render-assets/index.d.cts +2 -1
- package/dist/core/render-assets/index.d.ts +2 -1
- package/dist/core/render-assets/index.js +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/cs-IBLFYLZM.js +1 -0
- package/dist/cy-34ELUEIL.js +1 -0
- package/dist/da-GQN6BRAO.js +1 -0
- package/dist/de-T7KW4S4R.js +1 -0
- package/dist/el-AGMWKSVL.js +1 -0
- package/dist/es-3MLQHBEG.js +1 -0
- package/dist/et-ZXPWQ5KO.js +1 -0
- package/dist/{eventConfigurations-DaOxuIpn.d.cts → eventConfigurations-CwfetQY5.d.cts} +1 -1
- package/dist/{eventConfigurations-BPPbXP9X.d.ts → eventConfigurations-mKY39sfQ.d.ts} +1 -1
- package/dist/fa-JKTXTNCZ.js +1 -0
- package/dist/fi-WMJXY2WO.js +1 -0
- package/dist/fr-D3X5YMNY.js +1 -0
- package/dist/he-E2UR2UQO.js +1 -0
- package/dist/hr-5EGOH3G2.js +1 -0
- package/dist/hu-YR7UJX5F.js +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +190 -33
- package/dist/index.d.ts +190 -33
- package/dist/index.js +1 -1
- package/dist/it-375P5GZ3.js +1 -0
- package/dist/ja-PWGPUXT6.js +1 -0
- package/dist/ku-OAI5XCN4.js +1 -0
- package/dist/{labeling-DE1CwnnZ.d.cts → labeling-BXgKZTmM.d.cts} +1 -1
- package/dist/{labeling-DKieA71R.d.ts → labeling-DA9cTa22.d.ts} +1 -1
- package/dist/localeLoaders-TE4NBRUR.js +1 -0
- package/dist/lt-OT4GWRKU.js +1 -0
- package/dist/lv-4GFUUG4J.js +1 -0
- package/dist/nl-3U3HO52W.js +1 -0
- package/dist/no-T3RYHJIQ.js +1 -0
- package/dist/pl-AVH2HJME.js +1 -0
- package/dist/pt-F7JVGJFC.js +1 -0
- package/dist/{renderedQuality-BLLTXbOO.d.cts → renderedQuality-BzTliRbk.d.cts} +1 -1
- package/dist/{renderedQuality-KkuudVDV.d.ts → renderedQuality-D32EPlWq.d.ts} +1 -1
- package/dist/{renderer-B2yUBVOg.d.ts → renderer-C9TqalQD.d.cts} +8 -1
- package/dist/{renderer-DCfWXUcm.d.cts → renderer-Kxpv-Iv6.d.ts} +8 -1
- package/dist/ro-G3EVESXP.js +1 -0
- package/dist/ru-PW6NG5JX.js +1 -0
- package/dist/seatTypeIcons-CKPTA_-Q.d.cts +62 -0
- package/dist/seatTypeIcons-DlGnOWfb.d.ts +62 -0
- package/dist/{sections-LFcH15oQ.d.cts → sections-CMh0XgP2.d.cts} +1 -1
- package/dist/{sections-DOho5-zT.d.ts → sections-DImaB4fK.d.ts} +1 -1
- package/dist/{segmentedRowModel-DpFBEaLn.d.ts → segmentedRowModel-B0bIfSCS.d.ts} +1 -1
- package/dist/{segmentedRowModel-DQylOwZU.d.cts → segmentedRowModel-Cu6ojvdO.d.cts} +1 -1
- package/dist/sk-5MC3SLDB.js +1 -0
- package/dist/sl-D7X2YP2P.js +1 -0
- package/dist/sr-NYTF6LCE.js +1 -0
- package/dist/sv-IDFALD5B.js +1 -0
- package/dist/{tableSizing-DcZAr8Cc.d.ts → tableSizing-CGzjNFm4.d.ts} +10 -4
- package/dist/{tableSizing-amFdMq3T.d.cts → tableSizing-Dp_GGrlh.d.cts} +10 -4
- package/dist/{ticketRestrictions-D3Euerz2.d.cts → ticketRestrictions-CgpE7mdU.d.cts} +2 -2
- package/dist/{ticketRestrictions-fMxTjCsC.d.ts → ticketRestrictions-LP9gbybN.d.ts} +2 -2
- package/dist/tr-J5MTCS62.js +1 -0
- package/dist/{types-9TsSrYGB.d.cts → types-CF7_htTi.d.cts} +4 -1
- package/dist/{types-9TsSrYGB.d.ts → types-CF7_htTi.d.ts} +4 -1
- package/dist/uk-VPWVG4AX.js +1 -0
- package/dist/view3d/crossfade/panorama.d.cts +1 -1
- package/dist/view3d/crossfade/panorama.d.ts +1 -1
- package/dist/view3d/index.cjs +31 -31
- package/dist/view3d/index.d.cts +25 -3
- package/dist/view3d/index.d.ts +25 -3
- package/dist/view3d/index.js +29 -29
- package/dist/view3d/scene/scene.worker.js +1 -1
- package/dist/zh-Hans-72N63TPO.js +1 -0
- package/dist/zh-Hant-WNSFW5HB.js +1 -0
- package/package.json +1 -1
- package/dist/ar-IJCDEZFA.js +0 -1
- package/dist/be-LFJ7QTC3.js +0 -1
- package/dist/bg-J3TMRABG.js +0 -1
- package/dist/ca-MM2WRHUU.js +0 -1
- package/dist/chunk-C7MR6CFC.js +0 -1
- package/dist/chunk-GQLJAU75.js +0 -1
- package/dist/chunk-NQZAZFAC.js +0 -1
- package/dist/chunk-QLDV5ZGA.js +0 -1
- package/dist/chunk-WXGW2SYC.js +0 -1
- package/dist/chunk-YXOSJLK7.js +0 -1
- package/dist/cs-EIYYGA34.js +0 -1
- package/dist/cy-47BXX465.js +0 -1
- package/dist/da-UZ6ZWBRN.js +0 -1
- package/dist/de-PG4VZQPH.js +0 -1
- package/dist/el-XD5OOYKU.js +0 -1
- package/dist/es-GCDK6L27.js +0 -1
- package/dist/et-Y6LRXTLO.js +0 -1
- package/dist/fa-LC5L6ZTN.js +0 -1
- package/dist/fi-EQC74RHM.js +0 -1
- package/dist/fr-FJSMA757.js +0 -1
- package/dist/he-6EZS42SY.js +0 -1
- package/dist/hr-I4GSAXXP.js +0 -1
- package/dist/hu-Q5ZEW7FT.js +0 -1
- package/dist/it-VVXY7L2S.js +0 -1
- package/dist/ja-ZKPATNFV.js +0 -1
- package/dist/ku-S7DGMHQK.js +0 -1
- package/dist/localeLoaders-NM53E5H6.js +0 -1
- package/dist/lt-US73MBW6.js +0 -1
- package/dist/lv-PHQRHAV3.js +0 -1
- package/dist/nl-7KYZ3WST.js +0 -1
- package/dist/no-43QWDAF4.js +0 -1
- package/dist/pl-RH6CXGP4.js +0 -1
- package/dist/pt-4COVCMUB.js +0 -1
- package/dist/ro-C7FUGVS5.js +0 -1
- package/dist/ru-GWBT3VHX.js +0 -1
- package/dist/sk-WVA5IWFS.js +0 -1
- package/dist/sl-NRKGTU6J.js +0 -1
- package/dist/sr-PXGQJ7N7.js +0 -1
- package/dist/sv-54BGXBGQ.js +0 -1
- package/dist/tr-C4LQVHXM.js +0 -1
- package/dist/uk-SWCERYU2.js +0 -1
- package/dist/zh-Hans-DL67M6B2.js +0 -1
- package/dist/zh-Hant-Z65RGQ6L.js +0 -1
package/dist/view3d/index.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var As=Object.create;var Wt=Object.defineProperty;var Rs=Object.getOwnPropertyDescriptor;var Is=Object.getOwnPropertyNames;var Es=Object.getPrototypeOf,Ts=Object.prototype.hasOwnProperty;var Ct=(e,t,n)=>()=>{if(n)throw n[0];try{return e&&(t=e(e=0)),t}catch(r){throw n=[r],r}};var Go=(e,t)=>{for(var n in t)Wt(e,n,{get:t[n],enumerable:!0})},zo=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Is(t))!Ts.call(e,o)&&o!==n&&Wt(e,o,{get:()=>t[o],enumerable:!(r=Rs(t,o))||r.enumerable});return e};var lt=(e,t,n)=>(n=e!=null?As(Es(e)):{},zo(t||!e||!e.__esModule?Wt(n,"default",{value:e,enumerable:!0}):n,e)),_s=e=>zo(Wt({},"__esModule",{value:!0}),e);function Nd(e,t){return!Number.isFinite(e)||!Number.isFinite(t)||e<=0||t<=0?0:Math.ceil(e*t*4*(4/3))}function Gd(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:Gd(t?.deviceMemory)}}function Rn(e,t={}){let n=e.previewUrl?.trim();if(!n||n===e.url)return{initialUrl:e.url,initialWidth:e.sourceWidth,initialHeight:e.sourceHeight,reason:"full-only"};let r={initialUrl:n,initialWidth:e.previewWidth,initialHeight:e.previewHeight};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||Nd(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 Wa(){return new DOMException("Panorama image load aborted","AbortError")}function zt(e,t){return new Promise((n,r)=>{if(t?.aborted){r(Wa());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(Wa())};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 In(e){let t=globalThis;if(t.requestIdleCallback){let r=t.requestIdleCallback(e,{timeout:1200});return()=>t.cancelIdleCallback?.(r)}let n=globalThis.setTimeout(e,32);return()=>globalThis.clearTimeout(n)}var ko=Ct(()=>{"use strict"});function qa(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 Lo(e){return Math.max(zd,Math.min(Hd,e))}function Ud(e,t,n){let r=(.5+e/360)*n;return t/2-r}function jd(e,t=Tn){return e*(180/t)}function Ka(e,t,n){return(e-t)/2+En(n,t)}function En(e,t){let n=ke/180*t;return Math.max(-n,Math.min(n,e))}function Yd(){if(typeof window>"u")return!1;try{if(typeof window.matchMedia=="function"&&window.matchMedia("(pointer: coarse)").matches)return!0}catch{}return"ontouchstart"in window}function Fo(e){return e||(Yd()?"Drag to look \xB7 pinch to zoom \xB7 tap \u2715 to close":"Drag to look \xB7 pinch or scroll to zoom \xB7 Esc to close")}function Qa(e,t,n={}){let r=n.fadeMs??400,o=t.initialBearingDeg??0,i=Rn(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 d=document.createElement("div");Object.assign(d.style,{position:"absolute",inset:"0",backgroundImage:`url("${i.initialUrl}")`,backgroundRepeat:"repeat-x",cursor:"grab"}),c.appendChild(d);let p=document.createElement("button");if(p.type="button",p.setAttribute("aria-label","Close"),p.textContent="\u2715",Object.assign(p.style,{position:"absolute",top:"12px",right:"12px",zIndex:"2",width:"44px",height:"44px",borderRadius:"999px",cursor:"pointer",border:"1px solid rgba(255,255,255,0.25)",background:"rgba(8,12,18,0.6)",color:"#e6edf3",fontSize:"15px",lineHeight:"1"}),c.appendChild(p),n.disclosure){let N=document.createElement("div");N.textContent=`${n.disclosurePrefix??"360\xB0 panorama"} \xB7 ${n.disclosure}`,Object.assign(N.style,{position:"absolute",top:"calc(12px + var(--sl-3d-top-inset, 0px))",left:"12px",zIndex:"2",maxWidth:"calc(100% - 88px)",padding:"8px 11px",borderRadius:"999px",overflow:"hidden",color:"#dce6f8",background:"rgba(8,12,18,0.68)",font:"600 11px/1.2 ui-sans-serif, system-ui, sans-serif",textOverflow:"ellipsis",whiteSpace:"nowrap",pointerEvents:"none",backdropFilter:"blur(6px)"}),c.appendChild(N)}let m=document.createElement("div");m.textContent=Fo(n.lookAroundHint),Object.assign(m.style,{position:"absolute",bottom:"12px",left:"0",right:"0",textAlign:"center",color:"rgba(230,237,243,0.7)",font:"12px ui-sans-serif, system-ui, sans-serif",pointerEvents:"none"}),c.appendChild(m),e.appendChild(c),p.focus({preventScroll:!0});let l=0,f=0,b=0,h=0,y=Tn,g=()=>{let N=c.clientHeight||1,F=c.clientWidth||1,K=A.naturalWidth||F*2,X=A.naturalHeight||N,Q=l>0?(F/2-b)/l:0,W=f>0?h/f:0;f=jd(N,y),l=f*(K/X),d.style.backgroundSize=`${l}px ${f}px`,x?b=F/2-Q*l:(b=Ud(o,F,l),h=En((t.initialPitchDeg??0)/180*f,f),x=!0),h=En(W*f,f),d.style.backgroundPosition=`${b}px ${Ka(N,f,h)}px`},x=!1,v=()=>{let N=c.clientHeight||1;h=En(h,f),d.style.backgroundPosition=`${b}px ${Ka(N,f,h)}px`},A=new Image;A.onload=g,A.src=i.initialUrl;let S=()=>{};i.upgradeUrl&&(S=In(()=>{(t.resolveUrl?t.resolveUrl(i.upgradeUrl):Promise.resolve(i.upgradeUrl)).then(F=>!F||a.signal.aborted?null:zt(F,a.signal).then(K=>({full:K,url:F}))).then(F=>{F&&(w||a.signal.aborted||(A=F.full,d.style.backgroundImage=`url("${F.url}")`,g()))}).catch(()=>{})})),requestAnimationFrame(g);let P=!1,T=0,D=0,z=0,B=new Map,_=()=>{let[N,F]=[...B.values()];return N&&F?Math.hypot(N.x-F.x,N.y-F.y):0},C=N=>{let F=Lo(N);F!==y&&(y=F,g())},k=N=>{B.set(N.pointerId,{x:N.clientX,y:N.clientY}),P=B.size===1,T=N.clientX,D=N.clientY,B.size===2&&(z=_()),d.style.cursor="grabbing";try{d.setPointerCapture?.(N.pointerId)}catch{}},V=N=>{if(B.has(N.pointerId)){if(B.set(N.pointerId,{x:N.clientX,y:N.clientY}),B.size>=2){let F=_();z>0&&F>0&&C(y*(z/F)),z=F,P=!1;return}P&&(b+=N.clientX-T,h+=N.clientY-D,T=N.clientX,D=N.clientY,v())}},M=N=>{B.delete(N.pointerId),z=B.size===2?_():0;let F=B.values().next().value;P=B.size===1,F?(T=F.x,D=F.y):d.style.cursor="grab";try{d.releasePointerCapture?.(N.pointerId)}catch{}},R=N=>{N.preventDefault(),C(y+N.deltaY*.04)};d.addEventListener("pointerdown",k),d.addEventListener("pointermove",V),d.addEventListener("pointerup",M),d.addEventListener("pointercancel",M),d.addEventListener("wheel",R,{passive:!1});let E=!1,w=!1,L=0,I=()=>{d.removeEventListener("pointerdown",k),d.removeEventListener("pointermove",V),d.removeEventListener("pointerup",M),d.removeEventListener("pointercancel",M),d.removeEventListener("wheel",R),window.removeEventListener("keydown",U)},O=()=>{S(),a.abort(),n.signal?.removeEventListener("abort",s),L&&(window.clearTimeout(L),L=0),I(),c.parentNode&&c.parentNode.removeChild(c),u?.isConnected&&u.focus({preventScroll:!0})},j=()=>{if(E)return;E=!0,c.style.opacity="0";let N=()=>{L=0,!w&&(O(),n.onClose?.())};L=window.setTimeout(N,r)},U=N=>{if(N.key==="Tab"){N.preventDefault(),p.focus({preventScroll:!0});return}if(N.key==="Escape"){N.stopPropagation(),j();return}if(N.key==="ArrowLeft"||N.key==="ArrowRight")b+=N.key==="ArrowLeft"?-32:32;else if(N.key==="ArrowUp"||N.key==="ArrowDown")h+=(N.key==="ArrowUp"?4:-4)*(f/180);else if(N.key==="+"||N.key==="="){C(y-5),N.preventDefault();return}else if(N.key==="-"){C(y+5),N.preventDefault();return}else return;N.preventDefault(),v()};return window.addEventListener("keydown",U),p.addEventListener("click",j),requestAnimationFrame(()=>{c.style.opacity="1"}),{close:j,dispose(){E=!0,w=!0,O()}}}var Tn,zd,Hd,ke,_n=Ct(()=>{"use strict";ko();Tn=70,zd=35,Hd=90;ke=35});function qd(e=Xd,t=Wd,n=Kd){let r=e+1,o=t+1,i=r*o,a=new Float32Array(i*3),s=new Float32Array(i*2);for(let d=0;d<o;d++){let p=d/t,m=p*Math.PI,l=Math.sin(m),f=Math.cos(m);for(let b=0;b<r;b++){let h=b/e,y=(h-.5)*Math.PI*2,g=d*r+b;a[g*3]=n*l*Math.sin(y),a[g*3+1]=n*f,a[g*3+2]=-n*l*Math.cos(y),s[g*2]=h,s[g*2+1]=p}}let c=new Uint16Array(e*t*6),u=0;for(let d=0;d<t;d++)for(let p=0;p<e;p++){let m=d*r+p,l=m+r;c[u++]=m,c[u++]=l,c[u++]=m+1,c[u++]=m+1,c[u++]=l,c[u++]=l+1}return{position:a,uv:s,index:c}}function $a(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 Za(e,t){let{position:n,uv:r,index:o}=qd(),i=new Ke.Geometry(e,{position:{size:3,data:n},uv:{size:2,data:r},index:{data:o}}),a=new Ke.Texture(e,{image:t,wrapS:e.CLAMP_TO_EDGE,wrapT:e.CLAMP_TO_EDGE,generateMipmaps:!0,flipY:!1}),s=new Ke.Program(e,{vertex:Qd,fragment:$d,uniforms:{uPano:{value:a},uOpacity:{value:0}},transparent:!0,depthTest:!1,depthWrite:!1}),c=new Ke.Mesh(e,{geometry:i,program:s});return{mesh:c,setOpacity(u){s.uniforms.uOpacity.value=Math.max(0,Math.min(1,u))},setImage(u){a.image=u,a.needsUpdate=!0},dispose(){c.setParent(null),i.remove(),a.texture&&e.deleteTexture(a.texture),s.remove()}}}var Ke,Xd,Wd,Kd,Qd,$d,Ja=Ct(()=>{"use strict";Ke=require("ogl"),Xd=64,Wd=32,Kd=500;Qd=`#version 300 es
|
|
1
|
+
"use strict";var Ts=Object.create;var qt=Object.defineProperty;var _s=Object.getOwnPropertyDescriptor;var Ls=Object.getOwnPropertyNames;var ks=Object.getPrototypeOf,Fs=Object.prototype.hasOwnProperty;var Et=(e,t,n)=>()=>{if(n)throw n[0];try{return e&&(t=e(e=0)),t}catch(r){throw n=[r],r}};var Uo=(e,t)=>{for(var n in t)qt(e,n,{get:t[n],enumerable:!0})},Ho=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Ls(t))!Fs.call(e,o)&&o!==n&&qt(e,o,{get:()=>t[o],enumerable:!(r=_s(t,o))||r.enumerable});return e};var mt=(e,t,n)=>(n=e!=null?Ts(ks(e)):{},Ho(t||!e||!e.__esModule?qt(n,"default",{value:e,enumerable:!0}):n,e)),Ds=e=>Ho(qt({},"__esModule",{value:!0}),e);function Km(e,t){return!Number.isFinite(e)||!Number.isFinite(t)||e<=0||t<=0?0:Math.ceil(e*t*4*(4/3))}function qm(e){return(e!==void 0&&e<=2?32:e!==void 0&&e>=8?192:96)*1024*1024}function In(e){let t=typeof navigator>"u"?void 0:navigator;return{saveData:t?.connection?.saveData===!0,maxTextureSize:e,maxDecodedBytes:qm(t?.deviceMemory)}}function Rn(e,t={}){let n=e.previewUrl?.trim();if(!n||n===e.url)return{initialUrl:e.url,initialWidth:e.sourceWidth,initialHeight:e.sourceHeight,reason:"full-only"};let r={initialUrl:n,initialWidth:e.previewWidth,initialHeight:e.previewHeight};if(t.saveData)return{...r,reason:"save-data"};let o=[...e.variants??[],...e.sourceWidth!==void 0&&e.sourceHeight!==void 0?[{url:e.url,width:e.sourceWidth,height:e.sourceHeight}]:[]].filter(c=>c.url.trim()&&c.url!==n&&Number.isFinite(c.width)&&c.width>0&&Number.isFinite(c.height)&&c.height>0).sort((c,m)=>c.width*c.height-m.width*m.height);if(!o.length)return{...r,upgradeUrl:e.url,reason:"progressive"};let i=o.filter(c=>t.maxTextureSize===void 0||Math.max(c.width,c.height)<=t.maxTextureSize);if(!i.length)return{...r,reason:"texture-limit"};let a=i.filter(c=>t.maxDecodedBytes===void 0||Km(c.width,c.height)<=t.maxDecodedBytes);if(!a.length)return{...r,reason:"memory-limit"};let s=a[a.length-1];return{...r,upgradeUrl:s.url,reason:"progressive"}}function $a(){return new DOMException("Panorama image load aborted","AbortError")}function jt(e,t){return new Promise((n,r)=>{if(t?.aborted){r($a());return}let o=new Image;o.crossOrigin="anonymous";let i=!1,a=()=>{o.onload=null,o.onerror=null,t?.removeEventListener("abort",c)},s=m=>{i||(i=!0,a(),m?r(m):n(o))},c=()=>{o.src="",s($a())};o.onload=()=>{(typeof o.decode=="function"?o.decode():Promise.resolve()).then(()=>s(),()=>s())},o.onerror=()=>s(new Error("panorama_image_failed")),t?.addEventListener("abort",c,{once:!0}),o.src=e})}function Tn(e){let t=globalThis;if(t.requestIdleCallback){let r=t.requestIdleCallback(e,{timeout:1200});return()=>t.cancelIdleCallback?.(r)}let n=globalThis.setTimeout(e,32);return()=>globalThis.clearTimeout(n)}var Fo=Et(()=>{"use strict"});function Za(e){let t=e.mediaKind==="demo-render",n=e.generated||e.mediaKind==="model"?"Live 3D \xB7 chart-derived seat-eye":t?e.coverage==="exact-seat"?"AI-generated exact-seat demo":e.coverage==="row-representative"?"AI-generated representative row demo":e.coverage==="section-representative"?"AI-generated representative section demo":e.coverage==="floor-representative"?"AI-generated representative floor demo":"AI-generated illustrative venue demo":e.coverage==="exact-seat"?"Exact seat photo":e.coverage==="row-representative"?"Representative row view":e.coverage==="section-representative"?"Representative section view":e.coverage==="floor-representative"?"Representative floor view":e.coverage==="venue-representative"?"Representative venue view":"Venue photo",r=e.capturedAt&&/^\d{4}/.test(e.capturedAt)?e.capturedAt.slice(0,4):"";return[n,r?`${t?"created":"captured"} ${r}`:"",e.sourceLabel??""].filter(Boolean).join(" \xB7 ")}function Do(e){return Math.max($m,Math.min(Qm,e))}function Zm(e,t,n){let r=(.5+e/360)*n;return t/2-r}function Jm(e,t=Ln){return e*(180/t)}function Qa(e,t,n){return(e-t)/2+_n(n,t)}function _n(e,t){let n=Le/180*t;return Math.max(-n,Math.min(n,e))}function ed(){if(typeof window>"u")return!1;try{if(typeof window.matchMedia=="function"&&window.matchMedia("(pointer: coarse)").matches)return!0}catch{}return"ontouchstart"in window}function Oo(e){return e||(ed()?"Drag to look \xB7 pinch to zoom \xB7 tap \u2715 to close":"Drag to look \xB7 pinch or scroll to zoom \xB7 Esc to close")}function Ja(e,t,n={}){let r=n.fadeMs??400,o=t.initialBearingDeg??0,i=Rn(t,In()),a=new AbortController,s=()=>a.abort();n.signal?.addEventListener("abort",s,{once:!0});let c=document.createElement("div"),m=document.activeElement instanceof HTMLElement?document.activeElement:null;c.setAttribute("role","dialog"),c.setAttribute("aria-modal","true"),c.setAttribute("aria-label",n.seatLabel?`View from ${n.seatLabel}`:"View from seat"),c.tabIndex=-1,Object.assign(c.style,{position:"absolute",inset:"0",zIndex:"10",opacity:"0",transition:`opacity ${r}ms ease`,background:"#05070c",overflow:"hidden",touchAction:"none"});let u=document.createElement("div");Object.assign(u.style,{position:"absolute",inset:"0",backgroundImage:`url("${i.initialUrl}")`,backgroundRepeat:"repeat-x",cursor:"grab"}),c.appendChild(u);let p=document.createElement("button");if(p.type="button",p.setAttribute("aria-label","Close"),p.textContent="\u2715",Object.assign(p.style,{position:"absolute",top:"12px",right:"12px",zIndex:"2",width:"44px",height:"44px",borderRadius:"999px",cursor:"pointer",border:"1px solid rgba(255,255,255,0.25)",background:"rgba(8,12,18,0.6)",color:"#e6edf3",fontSize:"15px",lineHeight:"1"}),c.appendChild(p),n.disclosure){let N=document.createElement("div");N.textContent=`${n.disclosurePrefix??"360\xB0 panorama"} \xB7 ${n.disclosure}`,Object.assign(N.style,{position:"absolute",top:"calc(12px + var(--sl-3d-top-inset, 0px))",left:"12px",zIndex:"2",maxWidth:"calc(100% - 88px)",padding:"8px 11px",borderRadius:"999px",overflow:"hidden",color:"#dce6f8",background:"rgba(8,12,18,0.68)",font:"600 11px/1.2 ui-sans-serif, system-ui, sans-serif",textOverflow:"ellipsis",whiteSpace:"nowrap",pointerEvents:"none",backdropFilter:"blur(6px)"}),c.appendChild(N)}let d=document.createElement("div");d.textContent=Oo(n.lookAroundHint),Object.assign(d.style,{position:"absolute",bottom:"12px",left:"0",right:"0",textAlign:"center",color:"rgba(230,237,243,0.7)",font:"12px ui-sans-serif, system-ui, sans-serif",pointerEvents:"none"}),c.appendChild(d),e.appendChild(c),p.focus({preventScroll:!0});let l=0,f=0,b=0,h=0,y=Ln,x=()=>{let N=c.clientHeight||1,F=c.clientWidth||1,W=A.naturalWidth||F*2,X=A.naturalHeight||N,Q=l>0?(F/2-b)/l:0,q=f>0?h/f:0;f=Jm(N,y),l=f*(W/X),u.style.backgroundSize=`${l}px ${f}px`,g?b=F/2-Q*l:(b=Zm(o,F,l),h=_n((t.initialPitchDeg??0)/180*f,f),g=!0),h=_n(q*f,f),u.style.backgroundPosition=`${b}px ${Qa(N,f,h)}px`},g=!1,v=()=>{let N=c.clientHeight||1;h=_n(h,f),u.style.backgroundPosition=`${b}px ${Qa(N,f,h)}px`},A=new Image;A.onload=x,A.src=i.initialUrl;let P=()=>{};i.upgradeUrl&&(P=Tn(()=>{(t.resolveUrl?t.resolveUrl(i.upgradeUrl):Promise.resolve(i.upgradeUrl)).then(F=>!F||a.signal.aborted?null:jt(F,a.signal).then(W=>({full:W,url:F}))).then(F=>{F&&(w||a.signal.aborted||(A=F.full,u.style.backgroundImage=`url("${F.url}")`,x()))}).catch(()=>{})})),requestAnimationFrame(x);let M=!1,E=0,D=0,z=0,V=new Map,L=()=>{let[N,F]=[...V.values()];return N&&F?Math.hypot(N.x-F.x,N.y-F.y):0},C=N=>{let F=Do(N);F!==y&&(y=F,x())},_=N=>{V.set(N.pointerId,{x:N.clientX,y:N.clientY}),M=V.size===1,E=N.clientX,D=N.clientY,V.size===2&&(z=L()),u.style.cursor="grabbing";try{u.setPointerCapture?.(N.pointerId)}catch{}},B=N=>{if(V.has(N.pointerId)){if(V.set(N.pointerId,{x:N.clientX,y:N.clientY}),V.size>=2){let F=L();z>0&&F>0&&C(y*(z/F)),z=F,M=!1;return}M&&(b+=N.clientX-E,h+=N.clientY-D,E=N.clientX,D=N.clientY,v())}},S=N=>{V.delete(N.pointerId),z=V.size===2?L():0;let F=V.values().next().value;M=V.size===1,F?(E=F.x,D=F.y):u.style.cursor="grab";try{u.releasePointerCapture?.(N.pointerId)}catch{}},I=N=>{N.preventDefault(),C(y+N.deltaY*.04)};u.addEventListener("pointerdown",_),u.addEventListener("pointermove",B),u.addEventListener("pointerup",S),u.addEventListener("pointercancel",S),u.addEventListener("wheel",I,{passive:!1});let T=!1,w=!1,k=0,R=()=>{u.removeEventListener("pointerdown",_),u.removeEventListener("pointermove",B),u.removeEventListener("pointerup",S),u.removeEventListener("pointercancel",S),u.removeEventListener("wheel",I),window.removeEventListener("keydown",H)},O=()=>{P(),a.abort(),n.signal?.removeEventListener("abort",s),k&&(window.clearTimeout(k),k=0),R(),c.parentNode&&c.parentNode.removeChild(c),m?.isConnected&&m.focus({preventScroll:!0})},j=()=>{if(T)return;T=!0,c.style.opacity="0";let N=()=>{k=0,!w&&(O(),n.onClose?.())};k=window.setTimeout(N,r)},H=N=>{if(N.key==="Tab"){N.preventDefault(),p.focus({preventScroll:!0});return}if(N.key==="Escape"){N.stopPropagation(),j();return}if(N.key==="ArrowLeft"||N.key==="ArrowRight")b+=N.key==="ArrowLeft"?-32:32;else if(N.key==="ArrowUp"||N.key==="ArrowDown")h+=(N.key==="ArrowUp"?4:-4)*(f/180);else if(N.key==="+"||N.key==="="){C(y-5),N.preventDefault();return}else if(N.key==="-"){C(y+5),N.preventDefault();return}else return;N.preventDefault(),v()};return window.addEventListener("keydown",H),p.addEventListener("click",j),requestAnimationFrame(()=>{c.style.opacity="1"}),{close:j,dispose(){T=!0,w=!0,O()}}}var Ln,$m,Qm,Le,kn=Et(()=>{"use strict";Fo();Ln=70,$m=35,Qm=90;Le=35});function rd(e=td,t=nd,n=od){let r=e+1,o=t+1,i=r*o,a=new Float32Array(i*3),s=new Float32Array(i*2);for(let u=0;u<o;u++){let p=u/t,d=p*Math.PI,l=Math.sin(d),f=Math.cos(d);for(let b=0;b<r;b++){let h=b/e,y=(h-.5)*Math.PI*2,x=u*r+b;a[x*3]=n*l*Math.sin(y),a[x*3+1]=n*f,a[x*3+2]=-n*l*Math.cos(y),s[x*2]=h,s[x*2+1]=p}}let c=new Uint16Array(e*t*6),m=0;for(let u=0;u<t;u++)for(let p=0;p<e;p++){let d=u*r+p,l=d+r;c[m++]=d,c[m++]=l,c[m++]=d+1,c[m++]=d+1,c[m++]=l,c[m++]=l+1}return{position:a,uv:s,index:c}}function es(e,t){let n=e*Math.PI/180,r=t*Math.PI/180,o=Math.cos(r);return[o*Math.sin(n),Math.sin(r),-o*Math.cos(n)]}function ts(e,t){let{position:n,uv:r,index:o}=rd(),i=new Ke.Geometry(e,{position:{size:3,data:n},uv:{size:2,data:r},index:{data:o}}),a=new Ke.Texture(e,{image:t,wrapS:e.CLAMP_TO_EDGE,wrapT:e.CLAMP_TO_EDGE,generateMipmaps:!0,flipY:!1}),s=new Ke.Program(e,{vertex:id,fragment:ad,uniforms:{uPano:{value:a},uOpacity:{value:0}},transparent:!0,depthTest:!1,depthWrite:!1}),c=new Ke.Mesh(e,{geometry:i,program:s});return{mesh:c,setOpacity(m){s.uniforms.uOpacity.value=Math.max(0,Math.min(1,m))},setImage(m){a.image=m,a.needsUpdate=!0},dispose(){c.setParent(null),i.remove(),a.texture&&e.deleteTexture(a.texture),s.remove()}}}var Ke,td,nd,od,id,ad,ns=Et(()=>{"use strict";Ke=require("ogl"),td=64,nd=32,od=500;id=`#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
|
+
}`,ad=`#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 ts(e,t,n,r={}){let o=r.fadeMs??400,i=t?.initialBearingDeg??0,a=Math.max(-ke,Math.min(ke,t?.initialPitchDeg??0)),s=Tn,c=!1,u=new AbortController,d=()=>u.abort();r.signal?.addEventListener("abort",d,{once:!0});let p=()=>{},m=[n.camera.position.x,n.camera.position.y,n.camera.position.z];if(!t&&n.cameraOriginWorld&&n.camera.position.set(n.cameraOriginWorld[0],n.cameraOriginWorld[1],n.cameraOriginWorld[2]),!t&&n.focalWorld){let I=n.camera.position,O=n.focalWorld[0]-I.x,j=n.focalWorld[1]-I.y,U=n.focalWorld[2]-I.z,N=Math.hypot(O,U);N>.001&&(i=Math.atan2(O,-U)*180/Math.PI,a=Math.max(-ke,Math.min(ke,Math.atan2(j,N)*180/Math.PI)))}let l=null;if(t){let I=n.gl.getParameter(n.gl.MAX_TEXTURE_SIZE),O=Rn(t,An(I)),j;try{let U=t.resolveUrl?await t.resolveUrl(O.initialUrl):O.initialUrl;if(!U)throw new Error("panorama_asset_unavailable");j=await zt(U,u.signal)}catch{return r.signal?.removeEventListener("abort",d),null}try{l=Za(n.gl,j)}catch{return u.abort(),r.signal?.removeEventListener("abort",d),null}l.mesh.renderOrder=999,l.mesh.setParent(n.scene),O.upgradeUrl&&(p=In(()=>{(t.resolveUrl?t.resolveUrl(O.upgradeUrl):Promise.resolve(O.upgradeUrl)).then(N=>!N||u.signal.aborted?null:zt(N,u.signal)).then(N=>{N&&(c||u.signal.aborted||(l?.setImage(N),n.requestRender()))}).catch(()=>{})}))}let f=n.camera.fov;n.camera.perspective({fov:s,aspect:n.camera.aspect});let b=n.camera.quaternion.slice(),h=()=>{let I=n.camera.position;l?.mesh.position.set(I.x,I.y,I.z);let[O,j,U]=$a(i,a);n.camera.lookAt([I.x+O,I.y+j,I.z+U]),n.requestRender()};h();let y=document.createElement("div"),g=document.activeElement instanceof HTMLElement?document.activeElement:null;y.setAttribute("role","dialog"),y.setAttribute("aria-modal","true"),y.setAttribute("aria-label",r.seatLabel?`View from ${r.seatLabel}`:"View from seat"),y.tabIndex=-1,Object.assign(y.style,{position:"absolute",inset:"0",zIndex:"10",cursor:"grab",touchAction:"none"});let x=document.createElement("button");if(x.type="button",x.setAttribute("aria-label","Close"),x.textContent="\u2715",Object.assign(x.style,{position:"absolute",top:"12px",right:"12px",zIndex:"2",width:"44px",height:"44px",borderRadius:"999px",cursor:"pointer",border:"1px solid rgba(255,255,255,0.25)",background:"rgba(8,12,18,0.6)",color:"#e6edf3",fontSize:"15px",lineHeight:"1"}),y.appendChild(x),r.disclosure){let I=document.createElement("div");I.textContent=`${r.disclosurePrefix??"360\xB0 panorama"} \xB7 ${r.disclosure}`,Object.assign(I.style,{position:"absolute",top:"calc(12px + var(--sl-3d-top-inset, 0px))",left:"12px",zIndex:"2",maxWidth:"calc(100% - 88px)",padding:"8px 11px",borderRadius:"999px",overflow:"hidden",color:"#dce6f8",background:"rgba(8,12,18,0.68)",font:"600 11px/1.2 ui-sans-serif, system-ui, sans-serif",textOverflow:"ellipsis",whiteSpace:"nowrap",pointerEvents:"none",backdropFilter:"blur(6px)"}),y.appendChild(I)}let v=document.createElement("div");v.textContent=Fo(r.lookAroundHint),Object.assign(v.style,{position:"absolute",bottom:"12px",left:"0",right:"0",textAlign:"center",color:"rgba(230,237,243,0.7)",font:"12px ui-sans-serif, system-ui, sans-serif",pointerEvents:"none"}),y.appendChild(v),e.appendChild(y),x.focus({preventScroll:!0});let A=!1,S=0,P=0,T=0,D=new Map,z=()=>{let[I,O]=[...D.values()];return I&&O?Math.hypot(I.x-O.x,I.y-O.y):0},B=I=>{let O=Lo(I);O!==s&&(s=O,n.camera.perspective({fov:s,aspect:n.camera.aspect}),h())},_=I=>{I.target!==x&&(D.set(I.pointerId,{x:I.clientX,y:I.clientY}),A=D.size===1,S=I.clientX,P=I.clientY,D.size===2&&(T=z()),y.setPointerCapture?.(I.pointerId),y.style.cursor="grabbing")},C=I=>{if(D.has(I.pointerId)){if(D.set(I.pointerId,{x:I.clientX,y:I.clientY}),D.size>=2){let O=z();T>0&&O>0&&B(s*(T/O)),T=O,A=!1;return}A&&(i+=(I.clientX-S)*es,a=Math.max(-ke,Math.min(ke,a+(I.clientY-P)*es)),S=I.clientX,P=I.clientY,h())}},k=I=>{D.delete(I.pointerId),T=D.size===2?z():0;let O=D.values().next().value;A=D.size===1,O?(S=O.x,P=O.y):y.style.cursor="grab";try{y.releasePointerCapture?.(I.pointerId)}catch{}},V=I=>{I.preventDefault(),B(s+I.deltaY*.04)};y.addEventListener("pointerdown",_),y.addEventListener("pointermove",C),y.addEventListener("pointerup",k),y.addEventListener("pointercancel",k),y.addEventListener("wheel",V,{passive:!1});let M=I=>{if(!c){if(I.key==="Tab"){I.preventDefault(),x.focus({preventScroll:!0});return}if(I.key==="Escape"){I.stopPropagation(),L.close();return}if(I.key==="ArrowLeft"||I.key==="ArrowRight")i+=I.key==="ArrowLeft"?-4:4;else if(I.key==="ArrowUp"||I.key==="ArrowDown")a=Math.max(-ke,Math.min(ke,a+(I.key==="ArrowUp"?4:-4)));else if(I.key==="+"||I.key==="="){B(s-5),I.preventDefault();return}else if(I.key==="-"){B(s+5),I.preventDefault();return}else return;I.preventDefault(),h()}};window.addEventListener("keydown",M);let R=0,E=(I,O)=>{if(!l){O?.();return}let j=I===1?0:1,U=performance.now(),N=()=>{if(c)return;let F=o<=0?1:Math.min(1,(performance.now()-U)/o);l?.setOpacity(j+(I-j)*F),n.requestRender(),F<1?R=requestAnimationFrame(N):O?.()};R=requestAnimationFrame(N)};E(1);let w=()=>{c||(c=!0,p(),u.abort(),r.signal?.removeEventListener("abort",d),cancelAnimationFrame(R),y.removeEventListener("pointerdown",_),y.removeEventListener("pointermove",C),y.removeEventListener("pointerup",k),y.removeEventListener("pointercancel",k),y.removeEventListener("wheel",V),window.removeEventListener("keydown",M),y.remove(),g?.isConnected&&g.focus({preventScroll:!0}),l?.dispose(),n.camera.position.set(m[0],m[1],m[2]),n.camera.perspective({fov:f,aspect:n.camera.aspect}),n.camera.quaternion.set(b[0],b[1],b[2],b[3]),n.requestRender())},L={close(){if(c)return;let I=()=>{w(),r.onClose?.()};cancelAnimationFrame(R),E(0,I)},dispose:w};return x.addEventListener("click",()=>L.close()),L}var es,ns=Ct(()=>{"use strict";Ja();_n();_n();ko();es=.15});var os={};Go(os,{createOpenPanorama:()=>Zd});function Zd(e){let{container:t,model:n,opts:r,analytics:o,orbit:i,loop:a,seatsById:s,ensureSeatView:c,resolvedSeatViewPose:u,gpu:d,gl:p,isContextLost:m,isDisposed:l,flightGen:f,setPanorama:b,getLoadAbort:h,setLoadAbort:y,setPanoramaSphereVisible:g,setFrozen:x,raisePanoramaLayer:v,restorePanoramaLayer:A,getOverviewChip:S,labelOverlay:P,reducedMotion:T,removeArriveChip:D,showArriveChip:z}=e;return async(B,_,C)=>{h()?.abort();let k=new AbortController;y(k);let V=n.seats.idToIndex.get(B);if(V===void 0){i.syncFromCamera();return}let M=s.get(B)?.label??B,R=u(B,V),E=c(B);if(!E){k.abort(),h()===k&&y(null),i.syncFromCamera();return}x(!0),a.stop();let w;try{w=await E}catch{if(h()===k&&y(null),o.panoramaFailed(B,"source"),!l()&&C===f()){x(!1),i.resumeAfterFlight(R.focal),a.requestRender();let K=z(B,C,!0);requestAnimationFrame(()=>K?.querySelector("[data-panorama-trigger]")?.focus())}return}if(l()||C!==f()){k.abort(),h()===k&&y(null);return}D();let L=S(),I=()=>{k.abort(),h()===k&&y(null),b(null),g(!1),A(),L.style.display="",P.setVisible(!r.arriveAtSeatEye),x(!1),o.panoramaClosed(),i.resumeAfterFlight(R.focal),a.requestRender();let K=z(B,f());requestAnimationFrame(()=>K?.querySelector("[data-panorama-trigger]")?.focus())},O=w.generated===!0,j=qa(w);v(),g(!O),L.style.display="none";let U=T()?0:_,N=d(),F=N&&!m()?await ts(t,O?null:w,{gl:p,scene:N.main,camera:i.camera,requestRender:()=>a.requestRender(),cameraOriginWorld:O?R.eye:void 0,focalWorld:R.focal},{fadeMs:U,seatLabel:M,disclosure:j,disclosurePrefix:O?"Live seat-eye view":"360\xB0 panorama",lookAroundHint:r.lookAroundHint,onClose:I,signal:k.signal}):null;if(l()||C!==f()){k.abort(),g(!1),h()===k&&y(null),F?.dispose(),L.style.display="",A();return}if(F)i.syncFromCamera(),P.setVisible(!1),x(!1),a.requestRender(),b(F);else if(O){A(),L.style.display="",x(!1),i.resumeAfterFlight(R.focal),a.requestRender(),b(null),g(!1),o.panoramaFailed(B,"mount");let K=z(B,f(),!0);requestAnimationFrame(()=>K?.querySelector("[data-panorama-trigger]")?.focus()),h()===k&&y(null);return}else g(!1),o.panoramaFallback(B),b(Qa(t,w,{fadeMs:U,seatLabel:M,disclosure:j,onClose:I,signal:k.signal,lookAroundHint:r.lookAroundHint}));o.panoramaOpened()}}var rs=Ct(()=>{"use strict";_n();ns()});var sm={};Go(sm,{VENUE3D_QUALITY_REPORT_VERSION:()=>ta,buildSceneModel:()=>gt,inspectVenue3DQualityEvidence:()=>xn,mountVenue3D:()=>am,prepareVenue3D:()=>ys,prepareVenue3DFromChart:()=>gs});module.exports=_s(sm);var Yo=require("ogl");var ks=/^#?([\da-f]{3}|[\da-f]{6})$/i;function Ls(e){let t=ks.exec((e??"").trim());if(!t)return null;let n=t[1].length===3?t[1].split("").map(o=>o+o).join(""):t[1],r=parseInt(n,16);return[r>>16&255,r>>8&255,r&255]}function ne(e){let t=Ls(e);return t?[t[0]/255,t[1]/255,t[2]/255]:null}function Nn(e){let t=e/255;return t<=.04045?t/12.92:((t+.055)/1.055)**2.4}function Fs(e){return .2126*Nn(e[0])+.7152*Nn(e[1])+.0722*Nn(e[2])}function Ho(e){return Fs([e[0]*255,e[1]*255,e[2]*255])}function Ds(e){return .2126*e[0]+.7152*e[1]+.0722*e[2]}function ge(e,t,n){return[e[0]+(t[0]-e[0])*n,e[1]+(t[1]-e[1])*n,e[2]+(t[2]-e[2])*n]}function At(e,t){let n=Ds(e);return ge(e,[n,n,n],t)}var pe=["available","held","sold","selected","dimmed"];function Rt(e){let t=pe.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 jo(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 Gn={ground:[.07,.085,.11],tierTop:[.24,.28,.34],tierWall:[.17,.2,.25],stageTop:[.94,.7,.38],stageWall:[.48,.33,.18],decorTop:[.22,.25,.29],decorWall:[.15,.17,.2],gaTop:[.24,.28,.33],gaWall:[.16,.19,.23],boothTop:[.3,.33,.38],boothWall:[.2,.23,.27],tableTop:[.38,.34,.29],tableWall:[.24,.21,.18]},Je={top:[.05,.06,.08],bottom:[.1,.12,.15]};function Me(e,t){return[Math.min(1,e[0]*t),Math.min(1,e[1]*t),Math.min(1,e[2]*t)]}function Os(){let e=typeof window<"u"&&window.devicePixelRatio||1,t=navigator.deviceMemory,n=typeof t=="number"&&t<=4?1.5:2;return Math.min(e,n)}var Kt=class{constructor(t,n){this.clearRgb=[0,0,0];this.container=t,this.canvas=document.createElement("canvas"),this.canvas.style.display="block",this.canvas.style.width="100%",this.canvas.style.height="100%",this.canvas.style.touchAction="none",this.canvas.tabIndex=0,this.canvas.setAttribute("role","application"),this.canvas.setAttribute("aria-label","Interactive 3D venue. Drag or use arrow keys to look around; pinch, scroll, plus or minus to zoom."),this.renderer=new Yo.Renderer({canvas:this.canvas,dpr:Os(),alpha:!1,antialias:!1,depth:!0,stencil:!1,powerPreference:"high-performance",webgl:2}),this.gl=this.renderer.gl,this.clearRgb=[Je.top[0],Je.top[1],Je.top[2]],this.gl.clearColor(this.clearRgb[0],this.clearRgb[1],this.clearRgb[2],1),t.appendChild(this.canvas),this.lostHandler=r=>{r.preventDefault(),n.onContextLost()},this.restoredHandler=()=>n.onContextRestored(),this.canvas.addEventListener("webglcontextlost",this.lostHandler,!1),this.canvas.addEventListener("webglcontextrestored",this.restoredHandler,!1),this.resize()}setClearColor(t){this.clearRgb=[t[0],t[1],t[2]],this.gl.clearColor(t[0],t[1],t[2],1)}get clearColor(){return this.clearRgb}resize(){let t=Math.max(1,this.container.clientWidth||this.canvas.clientWidth||1),n=Math.max(1,this.container.clientHeight||this.canvas.clientHeight||1);return this.renderer.setSize(t,n),{width:t,height:n}}get pixelHeight(){return this.renderer.height*this.renderer.dpr}get aspect(){return this.renderer.width/Math.max(1,this.renderer.height)}dispose(){this.canvas.removeEventListener("webglcontextlost",this.lostHandler,!1),this.canvas.removeEventListener("webglcontextrestored",this.restoredHandler,!1);let t=this.gl.getExtension("WEBGL_lose_context");t&&t.loseContext(),this.canvas.parentNode&&this.canvas.parentNode.removeChild(this.canvas)}simulateContextLossCycle(){let t=this.gl.getExtension("WEBGL_lose_context");t&&(t.loseContext(),setTimeout(()=>{t.restoreContext&&t.restoreContext()},300))}};var dt=require("ogl"),he=Math.PI/180,zn=15*he,Hn=80*he,ut=.12,Xo=35,Wo=1.25,qt=class{constructor(t,n,r,o){this.fovY=Xo;this.target=new dt.Vec3;this.azimuth=-30*he;this.polar=55*he;this.distance=10;this.azT=-30*he;this.polT=55*he;this.distT=10;this.minDist=1;this.maxDist=100;this.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 dt.Vec3;this.panAnchor=new dt.Vec3;this.panLimit=0;this.primaryDragMode="orbit";this.camera=new dt.Camera(t,{fov:Xo,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(zn,Math.min(Hn,this.polT-s*.006)),this.requestRender())},this.onPointerUp=i=>{this.activePointers.delete(i.pointerId);try{this.canvas.releasePointerCapture?.(i.pointerId)}catch{}this.activePointers.size<2&&(this.pinchDist=0),this.activePointers.size===0&&(this.dragging=!1,this.panning=!1)},this.onContextMenu=i=>{i.preventDefault()},this.onWheel=i=>{if(i.preventDefault(),!this.interactionEnabled)return;let a=i.deltaMode===1?16:i.deltaMode===2?100:1,s=Math.max(-2,Math.min(2,i.deltaY*a/100));this.dollyBy(Math.exp(s*.22)),this.fireGesture()},this.onKeyDown=i=>{if(!this.interactionEnabled)return;let a=7*he;if(i.shiftKey&&(i.key==="ArrowLeft"||i.key==="ArrowRight"||i.key==="ArrowUp"||i.key==="ArrowDown"))this.panBy(i.key==="ArrowLeft"?-32:i.key==="ArrowRight"?32:0,i.key==="ArrowUp"?-32:i.key==="ArrowDown"?32:0);else if(i.key==="ArrowLeft"||i.key==="ArrowRight")this.azT+=i.key==="ArrowLeft"?-a:a;else if(i.key==="ArrowUp"||i.key==="ArrowDown")this.polT=Math.max(zn,Math.min(Hn,this.polT+(i.key==="ArrowUp"?-a:a)));else if(i.key==="+"||i.key==="=")this.dollyBy(.82);else if(i.key==="-"||i.key==="_")this.dollyBy(1.22);else return;i.preventDefault(),this.fireGesture(),this.requestRender()},n.addEventListener("pointerdown",this.onPointerDown),n.addEventListener("pointermove",this.onPointerMove),n.addEventListener("pointerup",this.onPointerUp),n.addEventListener("pointercancel",this.onPointerUp),n.addEventListener("wheel",this.onWheel,{passive:!1}),n.addEventListener("keydown",this.onKeyDown),n.addEventListener("contextmenu",this.onContextMenu)}pinchCentroid(){let t=[...this.activePointers.values()];if(!t.length)return{x:0,y:0};let n=0,r=0;for(let o of t)n+=o.x,r+=o.y;return{x:n/t.length,y:r/t.length}}panBy(t,n){let r=this.canvas.clientHeight||1,o=2*this.distance*Math.tan(this.fovY*he/2)/r,i=Math.sin(this.azimuth),a=Math.cos(this.azimuth),s=a,c=-i,u=Math.cos(this.polar),d=Math.sin(this.polar),p=-i*u,m=-a*u;this.targetT.x+=(-t*s+n*p)*o,this.targetT.z+=(-t*c+n*m)*o,this.targetT.y+=n*d*o,this.clampPan(),this.requestRender()}clampPan(){if(this.panLimit<=0)return;let t=this.panLimit,n=this.panAnchor.x,r=this.panAnchor.y,o=this.panAnchor.z;this.targetT.x=Math.max(n-t,Math.min(n+t,this.targetT.x)),this.targetT.z=Math.max(o-t,Math.min(o+t,this.targetT.z)),this.targetT.y=Math.max(r-t*.5,Math.min(r+t,this.targetT.y))}fireGesture(){this.gestureFired||(this.gestureFired=!0,this.onGesture?.())}currentPinchDistance(){let t=[...this.activePointers.values()];return t.length<2?0:Math.hypot(t[0].x-t[1].x,t[0].y-t[1].y)}dollyBy(t){this.distT=Math.max(this.minDist,Math.min(this.maxDist,this.distT*t)),this.requestRender()}zoomBy(t){this.interactionEnabled&&(this.dollyBy(t),this.fireGesture())}setPrimaryDragMode(t){this.primaryDragMode=t}setInteractionEnabled(t){this.interactionEnabled=t,!t&&(this.activePointers.clear(),this.dragging=!1,this.panning=!1,this.pinchDist=0)}frame(t,n=!1,r,o=!1,i){this.target.set(t.center[0],t.center[1],t.center[2]),this.targetT.copy(this.target),this.panAnchor.copy(this.target),this.panLimit=Math.max(1,t.radius)*1.5;let a=Math.max(1,t.radius),s=this.fovY*he/2,c=o?Math.max(.82,this.camera.aspect||1):this.camera.aspect||1,u=Math.atan(Math.tan(s)*c);this.azT=r??-30*he,this.polT=Math.max(15,Math.min(80,i?.polarDeg??55))*he;let d=this.fitDistance(t,s,u,this.azT,this.polT);this.distT=d*Math.max(1.05,Math.min(2,i?.margin??Wo)),this.minDist=Math.max(2,a*.12),this.maxDist=d*4,n?(this.azimuth=this.azT,this.polar=12*he,this.distance=this.distT*1.7):(this.azimuth=this.azT,this.polar=this.polT,this.distance=this.distT),this.applyPosition()}setAspect(t){this.camera.perspective({aspect:t})}frameSoft(t,n,r=!1,o){this.target.set(t.center[0],t.center[1],t.center[2]),this.targetT.copy(this.target),this.panAnchor.copy(this.target),this.panLimit=Math.max(1,t.radius)*1.5,this.syncFromCamera(),this.camera.perspective({fov:this.fovY,aspect:this.camera.aspect});let i=this.fovY*he/2,a=r?Math.max(.82,this.camera.aspect||1):this.camera.aspect||1,s=Math.atan(Math.tan(i)*a);this.azT=n??this.azimuth,this.polT=Math.max(15,Math.min(80,o?.polarDeg??55))*he;let c=this.fitDistance(t,i,s,this.azT,this.polT);this.distT=c*Math.max(1.05,Math.min(2,o?.margin??Wo))}fitDistance(t,n,r,o,i){let a=Math.max(1,t.radius),s=Math.max(a/Math.tan(n),a/Math.tan(r)),c=t.box;if(!c)return s;let u=Math.sin(i),d=-u*Math.sin(o),p=-Math.cos(i),m=-u*Math.cos(o);if(Math.abs(p)>.999)return s;let l=-m,f=d,b=Math.hypot(l,f);l/=b,f/=b;let h=-f*p,y=f*d-l*m,g=l*p,x=Math.tan(r),v=Math.tan(n),A=1;for(let S=0;S<8;S++){let P=(S&1?c.max[0]:c.min[0])-t.center[0],T=(S&2?c.max[1]:c.min[1])-t.center[1],D=(S&4?c.max[2]:c.min[2])-t.center[2],z=P*d+T*p+D*m,B=Math.abs(P*l+D*f),_=Math.abs(P*h+T*y+D*g);A=Math.max(A,B/x-z,_/v-z)}return Math.min(s,Math.max(A,a*.35))}updateClipping(t){let n=this.camera.position.x-t.center[0],r=this.camera.position.y-t.center[1],o=this.camera.position.z-t.center[2],i=Math.hypot(n,r,o),a=Math.max(1,t.radius)*1.18,s=Math.max(.05,i-a),c=Math.max(s+10,i+a);this.camera.perspective({near:s,far:c,aspect:this.camera.aspect})}update(){let t=this.azT-this.azimuth,n=this.polT-this.polar,r=this.distT-this.distance,o=this.targetT.x-this.target.x,i=this.targetT.y-this.target.y,a=this.targetT.z-this.target.z,s=Math.max(1e-4,this.distance*1e-4),c=Math.abs(t)>1e-4||Math.abs(n)>1e-4||Math.abs(r)>1e-4||Math.abs(o)>s||Math.abs(i)>s||Math.abs(a)>s;return this.azimuth+=t*ut,this.polar+=n*ut,this.distance+=r*ut,this.target.x+=o*ut,this.target.y+=i*ut,this.target.z+=a*ut,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(zn,Math.min(Hn,Math.acos(Math.max(-1,Math.min(1,n/o)))));this.distance=this.distT=o,this.polar=this.polT=i,this.azimuth=this.azT=Math.atan2(t,r)}setTarget(t){this.target.set(t[0],t[1],t[2]),this.targetT.copy(this.target)}resumeAfterFlight(t){this.camera.perspective({fov:this.fovY,aspect:this.camera.aspect}),t&&this.target.set(t[0],t[1],t[2]),this.targetT.copy(this.target),this.syncFromCamera()}applyPosition(){let t=Math.sin(this.polar),n=this.target.x+this.distance*t*Math.sin(this.azimuth),r=this.target.y+this.distance*Math.cos(this.polar),o=this.target.z+this.distance*t*Math.cos(this.azimuth);this.camera.position.set(n,r,o),this.camera.lookAt(this.target)}dispose(){this.canvas.removeEventListener("pointerdown",this.onPointerDown),this.canvas.removeEventListener("pointermove",this.onPointerMove),this.canvas.removeEventListener("pointerup",this.onPointerUp),this.canvas.removeEventListener("pointercancel",this.onPointerUp),this.canvas.removeEventListener("wheel",this.onWheel),this.canvas.removeEventListener("keydown",this.onKeyDown),this.canvas.removeEventListener("contextmenu",this.onContextMenu),this.activePointers.clear()}};var Qt=class{constructor(t){this.rafId=0;this.running=!1;this.lastTime=0;this.fpsEma=0;this.rendered=0;this.tick=t=>{let n=this.lastTime?(t-this.lastTime)/1e3:.016666666666666666;if(this.lastTime=t,n>0){let o=1/n;this.fpsEma=this.fpsEma?this.fpsEma*.9+o*.1:o}this.rendered++,this.frame(n)?this.rafId=requestAnimationFrame(this.tick):(this.running=!1,this.rafId=0)};this.frame=t}requestRender(){this.running||(this.running=!0,this.lastTime=0,this.rafId=requestAnimationFrame(this.tick))}stats(){return{fps:this.running?Math.round(this.fpsEma):0,rendered:this.rendered,idle:!this.running}}stop(){this.rafId&&cancelAnimationFrame(this.rafId),this.rafId=0,this.running=!1}};function Ko(e,t,n){return Math.max(t,Math.min(n,e))}var mt=2.5,Vs=1.15,It=6,ft=10,qo=6,Qo=9.5,$o=.9,Zo=2.2,Un=30,jn=4,$t=8192;var ym=ft+jn;function Jo(e,t){let n=t*1.4,r=t*3.2;if(e<=n)return{scale:1,fade:0,minPixels:mt};let o=Math.min(1,(e-n)/Math.max(.001,r-n));return{scale:1-o*.4,fade:o*.55,minPixels:mt+o*(Vs-mt)}}function er(e,t,n){return!(e>0)||!(t>0)||!(n>0)?!1:t*n/e>=64}function tr(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 Bs=[{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"}],xm=new Map(Bs.map(e=>[e.key,e]));var Ns={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 nr(e){let t=e?.[0];return t&&Ns[t]||"#3b82f6"}var Gs=[{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"}],vm=new Map(Gs.map(e=>[e.key,e]));var zs=["reference-focal","bar","entrance","exit","restroom","screen","sound","concession","coat","wall","rail","suite","obstruction"],Sm=new Set(zs);var rr=[{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}}],ir=rr.map(e=>e.key),Hs=new Map(rr.map(e=>[e.key,e]));function or(e){return typeof e=="string"&&Hs.has(e)}function ar(e,t){return or(e)?e:or(t?.seatGlyph)?t.seatGlyph:"circle"}var be=.02291666666666667,Ue=1/be,Us=58,js=Us*be;var Ys=3,sr=0,Yn=120,Xs=0,Ws=45,Ks=7,Ee=1.2;function Xn(e,t,n,r){return Number.isFinite(e)?Math.max(t,Math.min(n,e)):r}function qs(e){return!Number.isFinite(e)||!Number.isInteger(e)||e<0?0:e<=Ks?e:Ys}function Zt(e,t={}){let n=Xn(t.floorBaseHeightM,sr,Yn,0),r=Math.min(Yn,n+qs(e.elevation)*js),o=e.height===void 0?r:Xn(e.height,sr,Yn,r),i=Xn(e.rake,Xs,Ws,0);return{height:o,rake:i}}var lr=lt(require("earcut"),1),ur=lt(require("polygon-clipping"),1);var Rm=Math.PI/180;function Wn(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 Et(e){return e.length?Wn(e):null}function et(e){let t=0;for(let n=0,r=e.length;n<r;n+=1){let o=e[n],i=e[(n+1)%r];t+=o.x*i.y-i.x*o.y}return t/2}function Tt(e,t,n){let r=!1;for(let o=0,i=e.length-1;o<e.length;i=o++){let a=e[o],s=e[i];a.y>n!=s.y>n&&t<(s.x-a.x)*(n-a.y)/(s.y-a.y)+a.x&&(r=!r)}return r}var G=be,Qs=.002;function $s(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<Qs}var tt=class{constructor(t=16384){this.len=0;this.buf=new Float32Array(t)}push3(t,n,r){this.len+3>this.buf.length&&this.grow(this.len+3),this.buf[this.len++]=t,this.buf[this.len++]=n,this.buf[this.len++]=r}push1(t){this.len+1>this.buf.length&&this.grow(this.len+1),this.buf[this.len++]=t}grow(t){let n=this.buf.length*2;for(;n<t;)n*=2;let r=new Float32Array(n);r.set(this.buf.subarray(0,this.len)),this.buf=r}get length(){return this.len}toArray(){return this.buf.slice(0,this.len)}},tn=class{constructor(){this.pos=new tt;this.nor=new tt;this.col=new tt;this.flr=new tt;this.mat=new tt;this.currentFloor=0;this.currentMaterial=0}setFloor(t){this.currentFloor=t}setMaterial(t){this.currentMaterial=t}tri(t,n,r,o,i,a=i,s=i){$s(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 Zs(e,t,n){let r=t[0]-e[0],o=t[1]-e[1],i=t[2]-e[2],a=n[0]-e[0],s=n[1]-e[1],c=n[2]-e[2],u=o*c-i*s,d=i*a-r*c,p=r*s-o*a,m=Math.hypot(u,d,p)||1;return u/=m,d/=m,p/=m,[u,d,p]}function Js(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,lr.default)(r,o.length?o:void 0,2);return{pts:n,tris:i}}function Kn(e){return et(e)<0?[...e].reverse():e}var ec=3;function tc(e,t,n,r){let o=r(e),i=r(t),a=r(n),s=(l,f,b,h)=>Math.abs(r({x:(l.x+f.x)/2,y:(l.y+f.y)/2})-(b+h)/2),c=(e.x+t.x+n.x)/3,u=(e.y+t.y+n.y)/3,d=(o+i+a)/3,p=Math.max(s(e,t,o,i),s(t,n,i,a),s(n,e,a,o),Math.abs(r({x:c,y:u})-d)),m=(l,f,b)=>{let h=Math.abs(r({x:(l+c)/2,y:(f+u)/2})-(b+d)/2);h>p&&(p=h)};return m((e.x+t.x)/2,(e.y+t.y)/2,(o+i)/2),m((t.x+n.x)/2,(t.y+n.y)/2,(i+a)/2),m((n.x+e.x)/2,(n.y+e.y)/2,(a+o)/2),p}function _t(e,t,n,r,o){if(o<=0)return tc(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(_t(e,i,s,r,o-1),_t(i,t,a,r,o-1),_t(s,a,n,r,o-1),_t(i,a,s,r,o-1))}function kt(e,t,n,r,o,i,a,s){if(a>0){let m={x:(t.x+n.x)/2,y:(t.y+n.y)/2},l={x:(n.x+r.x)/2,y:(n.y+r.y)/2},f={x:(r.x+t.x)/2,y:(r.y+t.y)/2};kt(e,t,m,f,o,i,a-1,s),kt(e,m,n,l,o,i,a-1,s),kt(e,f,l,r,o,i,a-1,s),kt(e,m,l,f,o,i,a-1,s);return}let c=[t.x*G,o(t),t.y*G],u=[n.x*G,o(n),n.y*G],d=[r.x*G,o(r),r.y*G];if(s){e.triN(c,u,d,s(t),s(n),s(r),i);return}let p=Zs(c,u,d);p[1]<0&&(p=[-p[0],-p[1],-p[2]]),e.tri(c,u,d,p,i)}var nc=8;function cr(e,t,n){if(!Number.isFinite(n))return e;let r=[],o=(i,a,s,c,u)=>{if(u>0){let d={x:(i.x+a.x)/2,y:(i.y+a.y)/2},p=t(d);if(Math.abs(p-(s+c)/2)>n){o(i,d,s,p,u-1),o(d,a,p,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),nc)}return r}function Jt(e,t){if(e.length<3)return e;let n=[];for(let o of e){let i=n[n.length-1];i&&Math.hypot(o.x-i.x,o.y-i.y)<t||n.push(o)}for(;n.length>2&&Math.hypot(n[0].x-n[n.length-1].x,n[0].y-n[n.length-1].y)<t;)n.pop();if(n.length<3)return e;let r=[];for(let o=0;o<n.length;o++){let i=r.length?r[r.length-1]:n[(o-1+n.length)%n.length],a=n[o],s=n[(o+1)%n.length],c=s.x-i.x,u=s.y-i.y,d=Math.hypot(c,u);d>t&&Math.abs((a.x-i.x)*u-(a.y-i.y)*c)/d<t||r.push(a)}return r.length>=3?r:n}var en=.001*Ue*.1;function ue(e,t,n,r,o,i,a,s,c=1/0,u){if(!t||t.length<3||(c===void 0&&(c=1/0),Math.abs(et(t))<1e-4))return;let d=Jt(cr(Jt(Kn(t),en),r,c),en),p=n?.map(S=>Jt(cr(Jt(Kn(S),en),r,c),en)).filter(S=>S.length>=3&&Math.abs(et(S))>=1e-4),{pts:m,tris:l}=Js(d,p),f=[i[0]*s.top,i[1]*s.top,i[2]*s.top],b=[i[0]*s.bottomCap,i[1]*s.bottomCap,i[2]*s.bottomCap],h=[a[0]*s.top,a[1]*s.top,a[2]*s.top],y=[a[0]*s.wallBottom,a[1]*s.wallBottom,a[2]*s.wallBottom],g=0;if(Number.isFinite(c))for(;g<ec;g++){let S=0;for(let P=0;P<l.length;P+=3){let T=_t(m[l[P]],m[l[P+1]],m[l[P+2]],r,g);T>S&&(S=T)}if(S<=c)break}for(let S=0;S<l.length;S+=3){let P=m[l[S]],T=m[l[S+1]],D=m[l[S+2]];kt(e,P,T,D,r,f,g,u);let z=[P.x*G,o,P.y*G],B=[T.x*G,o,T.y*G],_=[D.x*G,o,D.y*G];e.tri(z,_,B,[0,-1,0],b)}let x=S=>{if(g<=0)return S;let P=1<<g,T=[];for(let D=0;D<S.length;D++){let z=S[D],B=S[(D+1)%S.length];for(let _=0;_<P;_++){let C=_/P;T.push({x:z.x+(B.x-z.x)*C,y:z.y+(B.y-z.y)*C})}}return T},v=Wn(d),A=[{ring:x(d),flip:!1}];if(p)for(let S of p)S.length>=3&&A.push({ring:x(S),flip:!0});for(let{ring:S,flip:P}of A)for(let T=0;T<S.length;T++){let D=S[T],z=S[(T+1)%S.length],B=(z.x-D.x)*G,C=(z.y-D.y)*G,k=-B,V=Math.hypot(C,k)||1;C/=V,k/=V;let M=(D.x+z.x)/2-v.x,R=(D.y+z.y)/2-v.y,E=C*M+k*R;P&&(E=-E),E<0&&(C=-C,k=-k);let w=[C,0,k],L=[D.x*G,r(D),D.y*G],I=[z.x*G,r(z),z.y*G],O=[D.x*G,o,D.y*G],j=[z.x*G,o,z.y*G];e.tri(L,I,j,w,h,h,y),e.tri(L,j,O,w,h,y,y)}}function dr(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 nn(e,t,n=2.5){if(t<=0||e.length<3)return e;let r=Kn(e),o=r.length,i=[];for(let s=0;s<o;s++){let c=r[s],u=r[(s+1)%o],d=u.x-c.x,p=u.y-c.y,m=Math.hypot(d,p)||1;i.push({x:p/m,y:-d/m})}let a=[];for(let s=0;s<o;s++){let c=r[s],u=i[(s-1+o)%o],d=i[s],p=u.x+d.x,m=u.y+d.y,l=Math.hypot(p,m),f=()=>{a.push([c.x+u.x*t,c.y+u.y*t]),a.push([c.x+d.x*t,c.y+d.y*t])};if(l<1e-9){f();continue}p/=l,m/=l;let b=p*u.x+m*u.y,h=1/Math.max(b,1e-6);if(!Number.isFinite(h)||h>n){f();continue}a.push([c.x+p*t*h,c.y+m*t*h])}if(a.length<3)return e;try{let s=ur.default.union([[...a,a[0]]]),c=null,u=-1/0;for(let p of s){let m=Math.abs(et(p[0].map(([l,f])=>({x:l,y:f}))));m>u&&(u=m,c=p[0])}if(!c)return e;let d=c.map(([p,m])=>({x:p,y:m}));if(d.length>1){let p=d[0],m=d[d.length-1];Math.abs(p.x-m.x)<1e-9&&Math.abs(p.y-m.y)<1e-9&&d.pop()}return d.length>=3?d:e}catch{return e}}function on(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 Lt(e,t,n,r){return[{x:e,y:t},{x:e+n,y:t},{x:e+n,y:t+r},{x:e,y:t+r}]}var ae={pedestal:0,pad:1,back:2,arm:3,footrest:4,leg:5,body:10,head:11},oc=.44,rc=.15,mr=.3,ic=.24;function fr(e){return e===void 0||!Number.isFinite(e)||e<=0?ic:Math.min(mr,Math.max(rc,e*oc))}var qn=.21,ac=.05,Qn=.45,rn=Qn+ac,pr=.92,$n=1.205,hr=-.23,br=.38,sc=[{part:ae.pedestal,min:[-.3,0,-.3],max:[.3,.36,.3]},{part:ae.pad,min:[-1,.36,-.95],max:[1,Qn,1]},{part:ae.back,min:[-1,rn,-1],max:[1,pr,-.72]},{part:ae.arm,min:[-1,.44,-.82],max:[-.78,.65,.78]},{part:ae.arm,min:[.78,.44,-.82],max:[1,.65,.78]},{part:ae.footrest,min:[-.9,.18,.78],max:[.9,.31,1.34]},{part:ae.leg,min:[-.82,0,-.7],max:[-.62,.37,-.48]},{part:ae.leg,min:[.62,0,-.7],max:[.82,.37,-.48]},{part:ae.leg,min:[-.82,0,.48],max:[-.62,.37,.7]},{part:ae.leg,min:[.62,0,.48],max:[.82,.37,.7]}],cc=[{part:ae.body,min:[-.52,.39,-.08],max:[-.08,.55,.82]},{part:ae.body,min:[.08,.39,-.08],max:[.52,.55,.82]},{part:ae.body,min:[-.47,.05,.58],max:[-.13,.43,.82]},{part:ae.body,min:[.13,.05,.58],max:[.47,.43,.82]},{part:ae.head,min:[-.16,1.04,-.33],max:[.16,1.1,-.13]}],lc=[{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 yr(){let e=[],t=[],n=[],r=[],o=(V,M,R)=>{let E=n.length,[w,L,I]=V,O=[L[0]-w[0],L[1]-w[1],L[2]-w[2]],j=[I[0]-w[0],I[1]-w[1],I[2]-w[2]],U=O[1]*j[2]-O[2]*j[1],N=O[2]*j[0]-O[0]*j[2],F=O[0]*j[1]-O[1]*j[0],K=Math.hypot(U,N,F);K>1e-9?(U/=K,N/=K,F/=K):[U,N,F]=M,U*M[0]+N*M[1]+F*M[2]<0&&(U=-U,N=-N,F=-F);for(let X of V)e.push(...X),t.push(U,N,F),n.push(R);r.push(E,E+1,E+2,E,E+2,E+3)},i=V=>{for(let M of lc){let R=M.c.map(E=>E.map((w,L)=>w?V.max[L]:V.min[L]));o(R,M.n,V.part)}};for(let V of sc)i(V);for(let V of cc)i(V);let a=Qn,s=1.08,c=.47,u=.69,d=-.55,p=.08,m=-.48,l=.01,f=[-c,a,d],b=[c,a,d],h=[-c,a,p],y=[c,a,p],g=[-u,s,m],x=[u,s,m],v=[-u,s,l],A=[u,s,l];o([b,x,A,y],[1,0,0],ae.body),o([h,v,g,f],[-1,0,0],ae.body),o([v,A,x,g],[0,1,0],ae.body),o([f,b,y,h],[0,-1,0],ae.body),o([y,A,v,h],[0,0,1],ae.body),o([f,g,x,b],[0,0,-1],ae.body);let S=10,P=8,T=[0,$n,hr],D=[.42,.115,br],z=n.length;for(let V=0;V<=P;V++){let M=Math.PI*V/P,R=Math.cos(M),E=Math.sin(M);for(let w=0;w<=S;w++){let L=Math.PI*2*w/S,I=E*Math.cos(L),O=E*Math.sin(L);e.push(T[0]+D[0]*I,T[1]+D[1]*R,T[2]+D[2]*O);let j=I/D[0],U=R/D[1],N=O/D[2],F=Math.hypot(j,U,N)||1;j/=F,U/=F,N/=F,t.push(j,U,N),n.push(ae.head)}}for(let V=0;V<P;V++)for(let M=0;M<S;M++){let R=z+V*(S+1)+M,E=R+S+1;r.push(R,E,R+1,R+1,E,E+1)}let B=new Float32Array(e),_=new Float32Array(t),C=new Float32Array(n),k=new Uint16Array(r);return{position:B,normal:_,part:C,index:k,vertexCount:n.length,indexCount:r.length}}function gr(e,t,n,r){let o=new Float32Array(t),i=u=>e[u*3],a=u=>e[u*3+2],s=0,c=(u,d)=>{let p=d-u;for(let m=u;m<d;m++){let[l,f]=r(m),b=l-i(m),h=f-a(m);if(p>=2){let y=Math.max(u,m-1),g=Math.min(d-1,m+1),x=i(g)-i(y),v=a(g)-a(y),A=Math.hypot(x,v);if(A>1e-6){let S=-v/A,P=x/A;S*b+P*h<0&&(S=-S,P=-P),b=S,h=P}}o[m]=b===0&&h===0?0:Math.atan2(b,h)}};for(let u=1;u<=t;u++)(u===t||n(u)!==n(s))&&(c(s,u),s=u);return o}var De=.22;function xr(e,t){let n=pe[e];if(n!=="sold"&&n!=="held")return-1;let r=(t+1)*2654435761;return r^=r>>>15,r=Math.imul(r,2246822519),r^=r>>>13,(r>>>0)%1e5/1e5}var uc=.42;function dc(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),d=Math.max(1,Math.ceil(s/u)+1),p=Math.max(1,Math.ceil(c/u)+1),m=new Map,l=(f,b)=>{let h=Math.min(d-1,Math.max(0,Math.floor((f-r)/u)));return Math.min(p-1,Math.max(0,Math.floor((b-o)/u)))*d+h};for(let f=0;f<t;f++){let b=l(e[f].x,e[f].y),h=m.get(b);h?h.push(f):m.set(b,[f])}for(let f=0;f<t;f++){let b=e[f],h=Math.min(d-1,Math.max(0,Math.floor((b.x-r)/u))),y=Math.min(p-1,Math.max(0,Math.floor((b.y-o)/u))),g=1/0;for(let x=1;x<=4;x++){for(let v=y-x;v<=y+x;v++)if(!(v<0||v>=p))for(let A=h-x;A<=h+x;A++){if(A<0||A>=d||x>1&&Math.abs(v-y)<x&&Math.abs(A-h)<x)continue;let S=m.get(v*d+A);if(S)for(let P of S){if(P===f)continue;let T=Math.hypot(e[P].x-b.x,e[P].y-b.y);T<g&&(g=T)}}if(Number.isFinite(g)&&g<=x*u)break}n[f]=g}return n}function mc(e){let t=e.eyeHeightM;return Number.isFinite(t)?Math.max(0,t-Ee):0}function vr(e,t,n,r,o,i){let a=e.length,s=new Float32Array(a*3),c=new Float32Array(a),u=new Float32Array(a*3),d=new Float32Array(a),p=new Float32Array(a),m=new Float32Array(a),l=new Float32Array(a),f=new Float32Array(a*3),b=new Map,h=dc(e);for(let y=0;y<a;y++){let g=e[y],v=(n?.seatPitchU(y)??h[y])*G;d[y]=Number.isFinite(v)?Math.max(.06,Math.min(De,v*uc)):De,p[y]=fr(Number.isFinite(v)?v:void 0);let A=ar(g.glyph,{seatGlyph:i?.get(g.categoryKey)});m[y]=ir.indexOf(A),l[y]=g.wheelchairSpaceType==="no-seat"?0:1,s[y*3]=g.x*G,s[y*3+1]=n?n.seatDeckY(y):mc(g),s[y*3+2]=g.y*G,c[y]=Rt(t?t(g):"available");let S=ne(o?.get(g.categoryKey)??"#6e7bff")??[.43,.48,1];if(u[y*3]=S[0],u[y*3+1]=S[1],u[y*3+2]=S[2],g.accessibility?.length){let P=ne(nr(g.accessibility));P&&(f[y*3]=P[0],f[y*3+1]=P[1],f[y*3+2]=P[2])}b.set(g.id,y)}return{count:a,iPosition:s,iState:c,iCategory:u,iMaxRadius:d,iRing:f,idToIndex:b,iChairWidth:p,iGlyph:m,iPhysicalSeat:l,iFloor:r??new Float32Array(a),iYaw:new Float32Array(a)}}var fc=64;function Zn(e,t){let n=[];for(let a of t){let s=e.idToIndex.get(a.seatId);if(s===void 0)continue;let c=Rt(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+fc){i=s;continue}r.push({start:o,length:i-o+1}),o=s,i=s}}return r.push({start:o,length:i-o+1}),r}var pc=.15,hc=1.6;function Sr(e){return Ko(e??1,pc,hc)}var bc=.15,yc=.9,gc=1.76;function xc(){return{background:{top:[...Je.top],bottom:[...Je.bottom]},structure:Gn,seatStates:{...Uo},seatScale:1,materials:{seat:null,shell:null,roughness:.78}}}function Mr(e){let t=xc();if(!e)return t;let n=ne(e.background);if(n){t.background={top:Me(n,yc),bottom:Me(n,gc)};let a={};for(let[s,c]of Object.entries(Gn))a[s]=ge(c,n,bc);t.structure=a}let r=ne(e.selectionColor)??ne(e.accent);r&&(t.seatStates={...t.seatStates,selected:r});let o=e.seatScale;typeof o=="number"&&Number.isFinite(o)&&(t.seatScale=Sr(o));let i=e.venue3d;if(i){let a=ne(i.deck),s=ne(i.fascia);a&&(t.structure={...t.structure,tierTop:a,gaTop:a}),s&&(t.structure={...t.structure,tierWall:s,gaWall:s}),t.materials.seat=ne(i.seat),t.materials.shell=ne(i.shell),typeof i.roughness=="number"&&Number.isFinite(i.roughness)&&(t.materials.roughness=Math.min(1,Math.max(0,i.roughness)))}return t}function wr(e,t){let n=[];for(let r of t)n.push(...e.seatStates[r]);return n}function Pr(e,t){let n=1-t,r=n*n*n,o=3*n*n*t,i=3*n*t*t,a=t*t*t;return{x:r*e.start.x+o*e.control1.x+i*e.control2.x+a*e.end.x,y:r*e.start.y+o*e.control1.y+i*e.control2.y+a*e.end.y}}function Cr(e,t,n=192){if(!Number.isInteger(t)||t<1)throw new Error("Path point count must be a positive integer");if(t===1)return[Pr(e,.5)];let r=Array.from({length:n+1},(c,u)=>Pr(e,u/n)),o=new Float64Array(r.length);for(let c=1;c<r.length;c+=1){let u=r[c].x-r[c-1].x,d=r[c].y-r[c-1].y;o[c]=o[c-1]+Math.hypot(u,d)}let i=o[o.length-1];if(i<=1e-9)return Array.from({length:t},()=>({...e.start}));let a=[],s=1;for(let c=0;c<t;c+=1){let u=i*c/(t-1);for(;s<o.length-1&&o[s]<u;)s+=1;let d=o[s-1],p=o[s],m=p===d?0:(u-d)/(p-d);a.push({x:r[s-1].x+(r[s].x-r[s-1].x)*m,y:r[s-1].y+(r[s].y-r[s-1].y)*m})}return a}function Ar(e){let t=new Map,n=new Map;for(let r of e){if(r.type!=="row"||!r.segmentedRow)continue;let o=n.get(r.segmentedRow.groupId)??[];o.push(r),n.set(r.segmentedRow.groupId,o)}for(let[r,o]of n){let i=o.slice().sort((m,l)=>m.segmentedRow.componentIndex-l.segmentedRow.componentIndex),a=i[0]?.segmentedRow?.componentCount??0,s=i[0]?.segmentedRow;if(!s||!(a>=2&&i.length===a&&s?.boundaryBefore==="start"&&i.every((m,l)=>m.segmentedRow?.kind==="segmented-row-v1"&&m.segmentedRow.groupId===r&&m.segmentedRow.componentCount===a&&m.segmentedRow.componentIndex===l&&m.segmentedRow.repeatLabelOnComponents===s.repeatLabelOnComponents&&(l===0?m.segmentedRow.boundaryBefore==="start":m.segmentedRow.boundaryBefore!=="start")&&m.segmentedRow.displayLabel===s.displayLabel)))continue;let u=i.reduce((m,l)=>m+l.seatCount,0),d=0,p=0;for(let m of i)m.segmentedRow.boundaryBefore==="break"&&(d+=1),t.set(m.id,{groupId:r,adjacencyOffset:d,displayOffset:p,displayLabel:s.displayLabel,totalSeats:u,canonical:i[0],viewFromSeatUrl:s.viewFromSeatUrl,viewFromSeatMeta:s.viewFromSeatMeta,confidenceEvidence:s.confidenceEvidence}),d+=m.seatCount,p+=m.seatCount}return t}var vc="ABCDEFGHIJKLMNOPQRSTUVWXYZ";var Sc="abcdefghijklmnopqrstuvwxyz";function Mc(e,t){let n=t.length,r=e+1,o="";for(;r>0;){r-=1;let i=r%n;o=t[i]+o,r=Math.floor(r/n)}return o}function Jn(e,t=!1){let n=t?Sc:vc;return Mc(Math.max(0,Math.floor(e)-1),n)}var wc=[[1e3,"M"],[900,"CM"],[500,"D"],[400,"CD"],[100,"C"],[90,"XC"],[50,"L"],[40,"XL"],[10,"X"],[9,"IX"],[5,"V"],[4,"IV"],[1,"I"]];function Rr(e){if(!Number.isFinite(e)||e<=0)return String(e);let t=Math.floor(e),n="";for(let[r,o]of wc)for(;t>=r;)n+=o,t-=r;return n}function Pc(e){let t=new Array(e);return Array.from({length:e},(n,r)=>r).sort((n,r)=>Math.abs(2*n-(e-1))-Math.abs(2*r-(e-1))||n-r).forEach((n,r)=>t[n]=r),t}function eo(e,t){let n=e.seatLabelStart??1,r=e.seatNumbering?.direction??"ltr",o=e.seatNumbering?.step??1,i=e.seatNumbering?.scheme??"decimal",a=e.seatNumbering?.prefix??"",s=e.seatNumbering?.endAt,c=e.seatCount;if(i==="updown"||i==="updown-descending"){let l=Math.ceil(c/2),f=i==="updown"?t<l?n+2*t:n-1+2*(c-t):t<l?n+2*(l-1-t):n+1+2*(t-l);return`${a}${f}`}let u=i==="odd"||i==="even"?2:o,d=s!=null&&Number.isFinite(s)?s-(c-1)*u:n,p=r==="center"?Pc(c)[t]:r==="rtl"?c-1-t:t,m;switch(i){case"odd":{let l=d%2===1?d:d+1;m=String(l+p*2);break}case"even":{let l=d%2===0?d:d+1;m=String(l+p*2);break}case"roman":m=Rr(d+p*o);break;case"letters-upper":m=Jn(d+p*o,!1);break;case"letters-lower":m=Jn(d+p*o,!0);break;default:m=String(d+p*o);break}return`${a}${m}`}function Cc(e){return{...e.canonical,seatCount:e.totalSeats,label:e.displayLabel,displayLabel:e.displayLabel}}function Ir(e,t,n){return n?.label??`${e.label}-${eo(e,t)}`}function to(e,t,n,r){if(r?.displayLabel)return r.displayLabel;if(!n)return`${e.displayLabel||e.label}-${eo(e,t)}`;let o=Cc(n),i=n.displayOffset+t;return`${n.displayLabel}-${eo(o,i)}`}function Er(e){let t=e.length;return t<=3?[...e]:[e[Math.floor(t*.25)],e[Math.floor(t*.5)],e[Math.floor(t*.75)]]}function pt(e,t,n){if(!e.length)return 1/0;if(e.length===1)return Math.hypot(t-e[0].x,n-e[0].y);let r=1/0;for(let o=0;o+1<e.length;o++){let i=e[o],a=e[o+1],s=a.x-i.x,c=a.y-i.y,u=s*s+c*c,d=u>1e-12?((t-i.x)*s+(n-i.y)*c)/u:0;d<0?d=0:d>1&&(d=1);let p=Math.hypot(t-(i.x+d*s),n-(i.y+d*c));p<r&&(r=p)}return r}function Ac(e){let t=0,n=0;for(let i of e)t+=i.x,n+=i.y;let r=e.length||1;t/=r,n/=r;let o=0;for(let i of e){let a=Math.hypot(i.x-t,i.y-n);a>o&&(o=a)}return{cx:t,cy:n,r:o}}function Tr(e,t){return Math.hypot(e.cx-t.cx,e.cy-t.cy)-e.r-t.r}function no(e,t){let n=1/0;for(let r of Er(e)){let o=pt(t,r.x,r.y);o<n&&(n=o)}for(let r of Er(t)){let o=pt(e,r.x,r.y);o<n&&(n=o)}return n}function Rc(e,t){if(e.length<3)return{pts:e,seatIndices:t};let n=0,r=0;for(let d of e)n+=d.x,r+=d.y;n/=e.length,r/=e.length;let o=-1,i=e[0];for(let d of e){let p=Math.hypot(d.x-n,d.y-r);p>o&&(o=p,i=d)}let a=i.x-n,s=i.y-r,c=Math.hypot(a,s);c>1e-9?(a/=c,s/=c):(a=1,s=0);let u=e.map((d,p)=>({p:d,i:p,t:(d.x-n)*a+(d.y-r)*s})).sort((d,p)=>d.t-p.t);return{pts:u.map(d=>d.p),seatIndices:u.map(d=>t[d.i])}}function oo(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,d=0;for(let g of e){let x=g.x-n,v=g.y-r;o+=x*x,a+=v*v,i+=x*v,s+=x*x*x,c+=v*v*v,u+=x*v*v,d+=v*x*x}let p=o*a-i*i;if(Math.abs(p)<1e-9)return null;let m=(s+u)/2,l=(c+d)/2,f=(m*a-l*i)/p,b=(l*o-m*i)/p,h=f+n,y=b+r;return!Number.isFinite(h)||!Number.isFinite(y)?null:{cx:h,cy:y}}var Ic=.15;function Ec(e){if(e.length<2)return null;let t=e.map(g=>{let x=0,v=0;for(let A of g.pts)x+=A.x,v+=A.y;return{x:x/g.pts.length,y:v/g.pts.length}}),n=0,r=0;for(let g of t)n+=g.x,r+=g.y;n/=t.length,r/=t.length;let o=0,i=0,a=0;for(let g of t){let x=g.x-n,v=g.y-r;o+=x*x,i+=x*v,a+=v*v}let s=o+a,c=o*a-i*i,u=s/2+Math.sqrt(Math.max(0,s*s/4-c)),d,p;Math.abs(i)>1e-12?(d=u-a,p=i):o>=a?(d=1,p=0):(d=0,p=1);let m=Math.hypot(d,p);if(!(m>1e-12))return null;d/=m,p/=m;let l=1/0,f=-1/0,b=[];for(let g of e){let x=1/0,v=-1/0;for(let A of g.pts){let S=A.x*d+A.y*p;S<x&&(x=S),S>v&&(v=S),S<l&&(l=S),S>f&&(f=S)}b.push(v-x)}let h=f-l;return h>1e-9?(b.sort((g,x)=>g-x),b[Math.min(b.length-1,Math.floor(b.length*.9))]/h<=Tc?{x:d,y:p}:null):null}var Tc=.35;function an(e,t,n,r){let o=new Map;for(let h of n){let y=t[h],g=y.rowId||`__seat-${h}`,x=o.get(g);x||(x={pts:[],idx:[]},o.set(g,x)),x.pts.push({x:y.x,y:y.y}),x.idx.push(h)}if(!o.size)return{sectionId:e,rows:[],blockCount:0};let i=[];for(let[h,y]of o){let g=Rc(y.pts,y.idx),x=0;for(let v of g.pts)x+=Math.hypot(v.x-r.x,v.y-r.y);i.push({id:h,pts:g.pts,seatIndices:g.seatIndices,blockId:-1,ordinal:0,blockDepth:0,focalDistance:x/g.pts.length})}let a=i.map(h=>Ac(h.pts)),s=[];for(let h=0;h<i.length;h++){let y=1/0;for(let g=0;g<i.length;g++){if(h===g||Tr(a[h],a[g])>=y)continue;let x=no(i[h].pts,i[g].pts);x<y&&(y=x)}Number.isFinite(y)&&s.push(y)}s.sort((h,y)=>h-y);let c=s.length?s[Math.floor(s.length/2)]:1,u=Math.max(c*1.8,1e-6),d=i.map(()=>[]);for(let h=0;h<i.length;h++)for(let y=h+1;y<i.length;y++)Tr(a[h],a[y])>u||no(i[h].pts,i[y].pts)<=u&&(d[h].push(y),d[y].push(h));let p=0;for(let h=0;h<i.length;h++){if(i[h].blockId!==-1)continue;let y=p++,g=[h];for(i[h].blockId=y;g.length;){let x=g.pop();for(let v of d[x])i[v].blockId===-1&&(i[v].blockId=y,g.push(v))}}let m=new Map;for(let h of i){let y=m.get(h.blockId)??[];y.push(h),m.set(h.blockId,y)}let l=[];for(let h of i){if(h.pts.length<4)continue;let y=oo(h.pts);y&&(!Number.isFinite(y.cx)||!Number.isFinite(y.cy)||l.push({x:y.cx,y:y.cy}))}let f=l.length>=2?(()=>{let h=l.map(x=>x.x).sort((x,v)=>x-v),y=l.map(x=>x.y).sort((x,v)=>x-v),g=Math.floor(l.length/2);return{cx:h[g],cy:y[g]}})():null;if(f){let h=S=>Math.hypot(S.x-f.cx,S.y-f.cy),y=1/0,g=-1/0,x=[];for(let S of i){let P=1/0,T=-1/0;for(let D of S.pts){let z=h(D);z<P&&(P=z),z>T&&(T=z)}x.push(T-P),P<y&&(y=P),T>g&&(g=T)}let v=g-y;x.sort((S,P)=>S-P);let A=x[Math.min(x.length-1,Math.floor(x.length*.9))];if(v>1e-9&&A/v<=Ic){let S=i.map(M=>{let R=0;for(let E of M.pts)R+=h(E);return{row:M,radius:R/M.pts.length}}),P=0,T=0;for(let M of S)P+=M.radius,T+=M.row.focalDistance;P/=S.length,T/=S.length;let D=0;for(let M of S)D+=(M.radius-P)*(M.row.focalDistance-T);if(D<0)for(let M of S)M.radius=-M.radius;let B=1/0;for(let M of S)M.radius<B&&(B=M.radius);S.sort((M,R)=>M.radius-R.radius);let _=-1,C=-1/0,k=v/Math.max(1,S.length)*.5,V=[];for(let M of S)M.radius-C>k&&(_++,C=M.radius),M.row.ordinal=_,M.row.blockDepth=M.radius-B,V.push(M.row);return{sectionId:e,rows:V,blockCount:p}}}let b=[];for(let[,h]of m){let y=Ec(h);if(y){let g=v=>{let A=0;for(let S of v.pts)A+=S.x*y.x+S.y*y.y;return A/v.pts.length};h.sort((v,A)=>g(v)-g(A)),h.length>=2&&h[0].focalDistance>h[h.length-1].focalDistance&&h.reverse();let x=0;for(let v=0;v<h.length;v++)v>0&&(x+=no(h[v-1].pts,h[v].pts)),h[v].ordinal=v,h[v].blockDepth=x,b.push(h[v])}else{let g=1/0;for(let x of h)x.focalDistance<g&&(g=x.focalDistance);h.sort((x,v)=>x.focalDistance-v.focalDistance);for(let x=0;x<h.length;x++)h[x].ordinal=x,h[x].blockDepth=Math.max(0,h[x].focalDistance-g),b.push(h[x])}}return{sectionId:e,rows:b,blockCount:p}}var _c=/^\d{4}-\d{2}-\d{2}$/;function kc(e){let t=Date.parse(e);return Number.isFinite(t)?_c.test(e)?t+864e5:t:null}function Lc(e,t=Date.now()){if(e.validUntil===void 0){if(e.status!=="approved")return!0;let r=e.assessedAt?Date.parse(e.assessedAt):Number.NaN;return Number.isFinite(r)&&(t instanceof Date?t.getTime():t)<=r+366*864e5}let n=kc(e.validUntil);return n===null?!1:(t instanceof Date?t.getTime():t)<n}function Fc(e,t,n){return!(e.eventConfigurationId&&e.eventConfigurationId!==t||e.eventConfigurationVersion!==void 0&&e.eventConfigurationVersion!==n)}function Dc(e){return e.status!=="draft"&&e.status!=="retracted"}function Oc(e,t){return e.status===void 0?t===void 0:e.status!=="approved"?!0:typeof t=="string"&&typeof e.basisSha256=="string"&&e.basisSha256===t}function _r(e,t={}){return!!e&&Dc(e)&&Fc(e,t.activeConfigurationId,t.activeConfigurationVersion)&&Oc(e,t.activeBasisSha256)&&Lc(e,t.now)}var tf=Math.PI*2;function sn(e){return e==="pitch-football"||e==="rink-hockey"||e==="track-athletics"||e==="oval-cricket"}var Vc=/^data:image\/(?:png|jpe?g|webp|gif|avif);base64,[a-z0-9+/]+={0,2}$/i,Bc=/[\s"'<>`\\]/;function Nc(e){if(typeof e!="string"||!e||e.length>2e6||e!==e.trim())return!1;if(e.startsWith("data:"))return Vc.test(e);if(Bc.test(e))return!1;try{let t=new URL(e);return t.protocol==="https:"&&!t.username&&!t.password}catch{return!1}}function kr(e){let t=e.trim();return Nc(t)?t:null}var ro="seatlayer.event-configuration/1";var ht=100,Gc=120,zc=1e5,Hc=1e4,Uc=/^[a-f0-9]{64}$/,jc=new Set(["stage","screen","barrier","camera_platform","sound_desk","rigging_truss"]);function Ft(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function nt(e,t){return typeof e=="string"&&e.length>=1&&e.length<=t&&e.normalize("NFKC").trim()===e}function Yc(e){return typeof e=="number"&&Number.isInteger(e)&&e>0}function Lr(e){return!Array.isArray(e)||e.length>zc||!e.every(t=>nt(t,ht))?null:[...new Set(e)].sort()}function Xc(e){return!Ft(e)||!nt(e.chartId,ht)||!nt(e.version,ht)||e.sha256!==void 0&&(typeof e.sha256!="string"||!Uc.test(e.sha256))?null:{chartId:e.chartId,version:e.version,...typeof e.sha256=="string"?{sha256:e.sha256}:{}}}function io(e,t,n){return typeof e=="number"&&Number.isFinite(e)&&e>=t&&e<=n}function Wc(e){return Ft(e)?e.mode==="none"||e.mode==="opaque"?e.opacity===void 0?{mode:e.mode}:null:e.mode==="partial"&&io(e.opacity,.01,.99)?{mode:"partial",opacity:e.opacity}:null:null}function Kc(e,t){if(e===void 0)return;if(!Array.isArray(e)||e.length>Hc)return null;let n=new Set(t),r=new Set,o=new Set,i=0,a=[];for(let s of e){if(!Ft(s)||!nt(s.id,ht)||!nt(s.objectId,ht)||!n.has(s.objectId)||!jc.has(String(s.kind))||!io(s.heightM,.05,50)||s.baseElevationM!==void 0&&!io(s.baseElevationM,-10,100))return null;let c=Wc(s.occlusion);if(!c||r.has(s.id)||o.has(s.objectId))return null;let u=s.contentImageUrl===void 0?void 0:typeof s.contentImageUrl=="string"?kr(s.contentImageUrl):null;if(s.contentImageUrl!==void 0&&(!u||s.kind!=="screen"||++i>1))return null;r.add(s.id),o.add(s.objectId),a.push({id:s.id,objectId:s.objectId,kind:s.kind,heightM:s.heightM,...s.baseElevationM!==void 0?{baseElevationM:s.baseElevationM}:{},occlusion:c,...u?{contentImageUrl:u}:{}})}return a.sort((s,c)=>s.id.localeCompare(c.id))}function qc(e){let t=[];if(!Ft(e))return{issues:[{code:"invalid_export",path:"configuration",message:"Configuration must be an object"}]};e.schema!==ro&&t.push({code:"unsupported_schema",path:"configuration.schema",message:`Configuration schema must be ${ro}`}),nt(e.id,ht)||t.push({code:"invalid_id",path:"configuration.id",message:"Configuration id must contain 1 to 100 normalized characters"}),nt(e.label,Gc)||t.push({code:"invalid_label",path:"configuration.label",message:"Configuration label must contain 1 to 120 normalized characters"}),Yc(e.version)||t.push({code:"invalid_version",path:"configuration.version",message:"Configuration version must be a positive integer"});let n=Xc(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=Ft(e.overlay)?e.overlay:null,o=Lr(r?.objectIds),i=Lr(r?.productionKillSeatIds),a=o?Kc(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:ro,id:e.id,label:e.label,version:e.version,baseVenue:n,overlay:{objectIds:o,productionKillSeatIds:i,...a!==void 0?{productionElements:a}:{}}}}}function Fr(e){let t=qc(e);return t.value?{ok:!0,value:t.value}:{ok:!1,issues:t.issues}}function Qc(e){if((e.kind==="polygon"||e.kind==="polyline"||e.kind==="line")&&e.points&&e.points.length>=2)return e.points;if(e.x==null||e.y==null||e.width==null||e.height==null)return null;let t=e.x,n=e.y,r=e.width,o=e.height;return[{x:t,y:n},{x:t+r,y:n},{x:t+r,y:n+o},{x:t,y:n+o}]}function $c(e,t,n){let r=n*Math.PI/180,o=Math.cos(r),i=Math.sin(r),a=e.x-t.x,s=e.y-t.y;return{x:t.x+a*o-s*i,y:t.y+a*i+s*o}}function Dr(e){let t=Qc(e);if(!t||t.length<2)return null;let n=e.rotation??0,r=Math.abs(n)<1e-6?t:t.map(c=>$c(c,{x:t.reduce((u,d)=>u+d.x,0)/t.length,y:t.reduce((u,d)=>u+d.y,0)/t.length},n)),o=1/0,i=1/0,a=-1/0,s=-1/0;for(let c of r)o=Math.min(o,c.x),i=Math.min(i,c.y),a=Math.max(a,c.x),s=Math.max(s,c.y);return!Number.isFinite(o)||a-o<1e-6||s-i<1e-6?null:{minX:o,minY:i,maxX:a,maxY:s}}var Zc=5,Jc=3,el=.92,tl=1.9,nl=2,ol=.6,rl=1,il=.06;function al(e){return e.heightM!==void 0?e.heightM:sn(e.stageKind)?il:rl}function Or(e){let t=1/0,n=1/0,r=-1/0,o=-1/0,i=-1/0;for(let a of Nr(e)){let s=a.baseHeightM??0;for(let c of a.objects){if(c.type!=="shape"||c.role!=="stage")continue;let u=Dr(c);u&&(t=Math.min(t,u.minX),n=Math.min(n,u.minY),r=Math.max(r,u.maxX),o=Math.max(o,u.maxY),i=Math.max(i,s+al(c)))}}return!Number.isFinite(t)||!Number.isFinite(i)?null:{minX:t,minY:n,maxX:r,maxY:o,deckTopM:i}}function sl(e,t,n,r){let o=1/0,i=1/0,a=-1/0,s=-1/0;for(let l of e)Number.isFinite(l.eyeHeightM)&&(o=Math.min(o,l.x),a=Math.max(a,l.x),i=Math.min(i,l.y),s=Math.max(s,l.y));if(!Number.isFinite(o))return null;let c=o*t,u=i*t,d=Math.max(1,Math.ceil((a-o)*t/n)+1),p=Math.max(1,Math.ceil((s-i)*t/n)+1),m=new Float64Array(d*p).fill(-1/0);for(let l of e){if(!Number.isFinite(l.eyeHeightM))continue;let f=l.eyeHeightM-Ee,b=Math.min(d-1,Math.max(0,Math.floor((l.x*t-c)/n))),y=Math.min(p-1,Math.max(0,Math.floor((l.y*t-u)/n)))*d+b,g=f+r;g>m[y]&&(m[y]=g)}return{cellM:n,minX:c,minY:u,cols:d,rows:p,top:m}}function cl(e,t,n){let r=Math.floor((t-e.minX)/e.cellM),o=Math.floor((n-e.minY)/e.cellM);return r<0||o<0||r>=e.cols||o>=e.rows?-1/0:e.top[o*e.cols+r]}function Vr(e,t,n={}){let r=new Map;if(!t||!e.length)return r;let o=n.metresPerChartUnit??be,i=n.cellM??ol,a=n.chairBackM??el,s=n.selfRowSkipM??nl,c=n.clearThreshold??.9,u=n.partialThreshold??.25,d=Math.max(1,n.columns??Zc),p=Math.max(1,n.rows??Jc),m=sl(e,o,i,a);if(!m)return r;let l=(t.maxX-t.minX)*o,f=(t.maxY-t.minY)*o,b=l>=f,h=(t.minX+t.maxX)/2*o,y=(t.minY+t.maxY)/2*o,g=[];for(let v=0;v<d;v++){let A=(v+.5)/d-.5,S=b?h+A*l:h,P=b?y:y+A*f;for(let T=0;T<p;T++){let D=t.deckTopM+(p===1?0:T/(p-1)*tl);g.push({x:S,y:P,z:D})}}let x=i/2;for(let v of e){if(!Number.isFinite(v.eyeHeightM))continue;let A=v.x*o,S=v.y*o,P=v.eyeHeightM,T=0,D=1/0;for(let B of g){let _=B.x-A,C=B.y-S,k=Math.hypot(_,C);if(!(k>s)){T++;continue}let V=_/k,M=C/k,R=0;for(let E=s;E<k;E+=x){let w=cl(m,A+V*E,S+M*E);if(!(!Number.isFinite(w)||w>=P)&&w>P+(B.z-P)*E/k){R=E;break}}R?D=Math.min(D,R):T++}let z=T/g.length;z>=c||r.set(v.id,{seatId:v.id,mark:z<u?"obstructedView":"restrictedView",visibleFraction:z,totalRays:g.length,atDistanceM:Number.isFinite(D)?D:0})}return r}function Br(e,t){if(!t.size)return 0;let n=0;for(let r of e){let o=t.get(r.id);if(!o)continue;let i=r.commercial;i?.restrictedView!==void 0||i?.obstructedView!==void 0||(r.commercial={...i,[o.mark]:!0},n++)}return n}function ao(e){return e?e.accessibility?.length?e.wheelchairSpaceType&&!e.accessibility.includes("wheelchair")?["wheelchair",...e.accessibility]:e.accessibility:e.wheelchairSpaceType?["wheelchair"]:e.accessible?["wheelchair"]:[]:[]}var cn=Math.PI/180;var Dt=16;function co(e,t,n,r){let o=n*cn,i=Math.cos(o),a=Math.sin(o);return{x:r.x+e*i-t*a,y:r.y+e*a+t*i}}function ll(e){let{seatCount:t,seatSpacing:n,curve:r,rotation:o,origin:i}=e,a=[];if(e.path)return Cr(e.path,t);if(t<=1)return t===1&&a.push({x:i.x,y:i.y}),a;if(r===0){for(let u=0;u<t;u++)a.push(co(u*n,0,o,i));return a}let s=r/(t-1)*cn,c=n/(2*Math.sin(Math.abs(s)/2));for(let u=0;u<t;u++){let d=u*s,p=c*Math.sin(d),m=-c+c*Math.cos(d);a.push(co(p,m,o,i))}return a}function ul(e){let t=new Map;if(e.overrides)for(let n of e.overrides)t.set(n.index,n);return t}function dl(e,t){let n=ul(e);return ll(e).map((r,o)=>{let i=n.get(o),a=ao(i),s=Ir(e,o,i),c={...e.commercial,...i?.commercial};return{index:o,x:r.x+(i?.dx??0),y:r.y+(i?.dy??0),label:s,displayLabel:to(e,o,t,i),categoryKey:i?.categoryKey??e.categoryKey,skipped:!!i?.skip,accessible:a.length>0,accessibility:a,wheelchairSpaceType:i?.wheelchairSpaceType,commercial:Object.values(c).some(u=>u!==void 0&&u!==!1&&u!=="")?c:void 0,glyph:i?.glyph,viewUrl:i?.viewFromSeatUrl??e.viewFromSeatUrl,viewMeta:i?.viewFromSeatUrl?i.viewFromSeatMeta:e.viewFromSeatMeta,labelStyle:i?.labelStyle}})}function jr(e){let t=[];for(let n of dl(e))n.skipped||t.push({id:`${e.id}:${n.index}`,label:n.label,displayLabel:n.displayLabel===n.label?void 0:n.displayLabel,x:n.x,y:n.y,rowId:e.id,categoryKey:n.categoryKey,accessible:n.accessible||void 0,accessibility:n.accessibility.length?n.accessibility:void 0,wheelchairSpaceType:n.wheelchairSpaceType,commercial:n.commercial,glyph:n.glyph,viewUrl:n.viewUrl,viewMeta:n.viewMeta,labelStyle:n.labelStyle});return t}function ml(e){if(e.seatCountsBySide)return{...e.seatCountsBySide};let t=e.sides&&e.sides.length?e.sides:["top","bottom"],n=["top","bottom","left","right"].filter(i=>t.includes(i)),r={top:0,bottom:0,left:0,right:0};if(!n.length)return r;let o=Math.max(0,Math.round(e.seatCount));for(let i=0;i<o;i++)r[n[i%n.length]]+=1;return r}function fl(e){let t=[],n=Math.max(0,Math.round(e.seatCount));if(n===0)return t;let r=new Map((e.overrides??[]).map(d=>[d.index,d])),o=(d,p,m,l)=>{let f=r.get(d),b=ao(f),h=f?.label??`${e.label}-${d+1}`,y=e.displayLabel??e.label;return{index:d,label:h,displayLabel:f?.displayLabel??`${y}-${d+1}`,x:p+(f?.dx??0),y:m+(f?.dy??0),categoryKey:f?.categoryKey??e.categoryKey,skipped:!!f?.skip,accessible:b.length>0,accessibility:b,wheelchairSpaceType:f?.wheelchairSpaceType,commercial:f?.commercial,glyph:f?.glyph,viewUrl:f?.viewFromSeatUrl,viewMeta:f?.viewFromSeatUrl?f.viewFromSeatMeta:void 0,labelStyle:f?.labelStyle,...l?{side:l}:{}}};if(e.shape==="round"){let d=(e.radius??40)+Dt,p=e.rotation*cn,m=Math.max(0,Math.min(360,e.seatArc??360));if(m>=360||n===1){for(let h=0;h<n;h++){let y=p+h/n*2*Math.PI;t.push(o(h,e.center.x+d*Math.cos(y),e.center.y+d*Math.sin(y)))}return t}let l=m*cn,f=(2*Math.PI-l)/2,b=p+f;for(let h=0;h<n;h++){let y=b+h/(n-1)*l;t.push(o(h,e.center.x+d*Math.cos(y),e.center.y+d*Math.sin(y)))}return t}let i=e.width??80,a=e.height??50,s=ml(e),c=["top","bottom","left","right"],u=0;for(let d of c){let p=s[d];for(let m=0;m<p;m++){let l,f;d==="top"?(l=-i/2+(m+.5)*i/p,f=-a/2-Dt):d==="bottom"?(l=-i/2+(m+.5)*i/p,f=a/2+Dt):d==="left"?(l=-i/2-Dt,f=-a/2+(m+.5)*a/p):(l=i/2+Dt,f=-a/2+(m+.5)*a/p);let b=co(l,f,e.rotation,e.center);t.push(o(u++,b.x,b.y,d))}}return t}function pl(e){return fl(e).filter(t=>!t.skipped).map(t=>({id:`${e.id}:${t.index}`,label:t.label,...t.displayLabel!==t.label?{displayLabel:t.displayLabel}:{},x:t.x,y:t.y,rowId:e.id,categoryKey:t.categoryKey,...t.accessible?{accessible:!0}:{},...t.accessibility.length?{accessibility:t.accessibility}:{},...t.wheelchairSpaceType?{wheelchairSpaceType:t.wheelchairSpaceType}:{},...t.commercial?{commercial:t.commercial}:{},...t.glyph?{glyph:t.glyph}:{},...t.viewUrl?{viewUrl:t.viewUrl}:{},...t.viewUrl&&t.viewMeta?{viewMeta:t.viewMeta}:{},...t.labelStyle?{labelStyle:t.labelStyle}:{}}))}function hl(e){return[{id:`${e.id}:0`,label:e.label,...e.displayLabel&&e.displayLabel!==e.label?{displayLabel:e.displayLabel}:{},x:e.center.x,y:e.center.y,rowId:e.id,categoryKey:e.categoryKey,kind:"booth"}]}function Gr(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 bl(e,t){return t.some((n,r)=>{let o=t[(r+1)%t.length],i=(e.y-n.y)*(o.x-n.x)-(e.x-n.x)*(o.y-n.y);if(Math.abs(i)>1e-7)return!1;let a=(e.x-n.x)*(o.x-n.x)+(e.y-n.y)*(o.y-n.y),s=(o.x-n.x)**2+(o.y-n.y)**2;return a>=-1e-7&&a<=s+1e-7})}function ot(e,t,n){return Gr(e,t)&&!(n??[]).some(r=>Gr(e,r)||bl(e,r))}function so(e){if(!e.length)return{x:0,y:0};let t=0,n=0;for(let r of e)t+=r.x,n+=r.y;return{x:t/e.length,y:n/e.length}}function yl(e){switch(e.type){case"row":{let t=jr(e);if(!t.length)return{x:e.origin.x,y:e.origin.y};let n=0,r=0;for(let o of t)n+=o.x,r+=o.y;return{x:n/t.length,y:r/t.length}}case"table":case"booth":return{x:e.center.x,y:e.center.y};case"gaArea":return so(e.points);case"section":return so(e.outline);case"text":return{x:e.position.x,y:e.position.y};case"shape":return e.points&&e.points.length?so(e.points):e.x!=null&&e.y!=null&&e.width!=null&&e.height!=null?{x:e.x+e.width/2,y:e.y+e.height/2}:{x:e.x??0,y:e.y??0};case"decorImage":return{x:e.x+e.width/2,y:e.y+e.height/2}}}function zr(e,t){return e.length===t.length&&e.every((n,r)=>n.x===t[r].x&&n.y===t[r].y)}function gl(e,t){if(e.type!=="gaArea"||!zr(e.points,t.outline))return!1;let n=e.holes??[],r=t.holes??[];return n.length===r.length&&n.every((o,i)=>zr(o,r[i]))}function xl(e,t){let n=e.filter(a=>a.type==="section"),r="referenceInventorySource"in t?t.referenceInventorySource?.logicalSectionId:void 0,o=yl(t);return(r?n.find(a=>(a.logicalSectionId??a.id)===r&&(gl(t,a)||ot(o,a.outline,a.holes))):void 0)??n.find(a=>ot(o,a.outline,a.holes))}function Nr(e){return e.floors&&e.floors.length?e.floors:[{id:"floor-0",name:"Main",objects:e.objects,focalPoint:e.focalPoint,referenceImage:e.referenceImage,backgroundImage:e.backgroundImage}]}function Hr(e,t,n,r,o,i,a,s,c){let u=[],d=Ar(e),p=f=>!f?.eventConfigurationId||f.eventConfigurationId===r&&(f.eventConfigurationVersion===void 0||f.eventConfigurationVersion===c),m=f=>_r(f,{activeConfigurationId:r,activeConfigurationVersion:c,activeBasisSha256:o,now:s}),l=(f,b)=>m(f)?{...f,coverage:b}:void 0;for(let f of e){let b=[];if(f.type==="row"?b=jr(f):f.type==="table"?b=pl(f):f.type==="booth"&&(b=hl(f)),!b.length)continue;for(let v of b)v.viewUrl&&!p(v.viewMeta)&&(v.viewUrl=void 0,v.viewMeta=void 0);if(f.type==="row"){let v=d.get(f.id);if(v){let A=new Map((f.overrides??[]).map(S=>[S.index,S]));for(let S of b){let P=Number(S.id.slice(S.id.lastIndexOf(":")+1));if(!Number.isInteger(P))continue;S.logicalRowId=v.groupId,S.logicalSeatIndex=v.adjacencyOffset+P,A.get(P)?.displayLabel||(S.displayLabel=to(f,P,v)),!S.viewUrl&&v.viewFromSeatUrl&&p(v.viewFromSeatMeta)&&(S.viewUrl=v.viewFromSeatUrl,S.viewMeta=v.viewFromSeatMeta);let T=A.get(P)?.confidenceEvidence;S.confidenceEvidence=l(T,"exact-seat")??l(f.confidenceEvidence,"row-representative")??l(v.confidenceEvidence,"row-representative")}}}let h=xl(e,f),y=h?.viewFromSeatUrl,x=(h?.zone?t?.find(v=>v.id===h.zone):void 0)?.focalPoint??n;for(let v of b){if(!v.confidenceEvidence){let A=Number(v.id.slice(v.id.lastIndexOf(":")+1)),S=(f.type==="row"||f.type==="table")&&Number.isInteger(A)?f.overrides?.find(P=>P.index===A)?.confidenceEvidence:void 0;v.confidenceEvidence=l(S,"exact-seat")??(f.type==="row"?l(f.confidenceEvidence,"row-representative"):void 0)}v.confidenceEvidence??=l(h?.confidenceEvidence,"section-representative")??(a?l(a.evidence,a.coverage):void 0),!v.viewUrl&&y&&p(h?.viewFromSeatMeta)&&(v.viewUrl=y,v.viewMeta=h?.viewFromSeatMeta),!v.viewUrl&&i&&p(i.meta)&&(v.viewUrl=i.url,v.viewMeta=i.meta),h&&(v.sectionId=h.logicalSectionId??h.id),h?.zone&&(v.zoneId=h.zone),x&&(v.focalPoint={...x})}u.push(...b)}return u}function Yr(e,t={}){if(e.floors?.length){let r=[];for(let o of e.floors){let i=o.focalPoint??e.focalPoint,a=o.viewFromSeatUrl?{url:o.viewFromSeatUrl,meta:o.viewFromSeatMeta}:e.viewFromSeatUrl?{url:e.viewFromSeatUrl,meta:e.viewFromSeatMeta}:void 0,s=o.confidenceEvidence?{evidence:o.confidenceEvidence,coverage:"floor-representative"}:e.confidenceEvidence?{evidence:e.confidenceEvidence,coverage:"venue-representative"}:void 0,c=Hr(o.objects,e.zones,i,e.eventConfigurationId,e.confidenceBasisSha256,a,s,t.now,t.eventConfigurationVersion??e.eventConfigurationVersion);t.resolveEyeHeights!==!1&&Ur(o.objects,o.focalPoint??e.focalPoint,o.baseHeightM??0,c);for(let u of c)u.floorId=o.id;r.push(...c)}return r}let n=Hr(e.objects,e.zones,e.focalPoint,e.eventConfigurationId,e.confidenceBasisSha256,e.viewFromSeatUrl?{url:e.viewFromSeatUrl,meta:e.viewFromSeatMeta}:void 0,e.confidenceEvidence?{evidence:e.confidenceEvidence,coverage:"venue-representative"}:void 0,t.now,t.eventConfigurationVersion??e.eventConfigurationVersion);return t.resolveEyeHeights!==!1&&Ur(e.objects,e.focalPoint,t.floorBaseHeightM??0,n),vl(e,n,t)}function vl(e,t,n){return!n.deriveRestrictedView||e.derivedRestrictedView===!1||n.resolveEyeHeights===!1||Br(t,Vr(t,Or(e))),t}function Ur(e,t,n,r){let o=e.filter(d=>d.type==="section"),i=n>0||o.some(d=>d.height!==void 0||d.rake!==void 0||(d.elevation??0)>0);if(!o.length||!i||!t){for(let d of r)d.eyeHeightM=n+Ee;return}let a=new Array(r.length),s=new Map,c=new Map;for(let d=0;d<r.length;d++){let p=r[d],l=(p.sectionId?o.find(b=>b.id===p.sectionId)??o.find(b=>b.logicalSectionId===p.sectionId&&ot({x:p.x,y:p.y},b.outline,b.holes)):void 0)??o.find(b=>ot({x:p.x,y:p.y},b.outline,b.holes))??null;if(a[d]=l,!l)continue;s.has(l.id)||s.set(l.id,Zt(l,{floorBaseHeightM:n}));let f=c.get(l.id);f?f.push(d):c.set(l.id,[d])}let u=new Array(r.length).fill(void 0);for(let[d,p]of c){let m=s.get(d);if(!m)continue;let l=m.rake>0?Math.tan(m.rake*Math.PI/180):0,f=an(d,r,p,t);for(let b of f.rows){let h=b.blockDepth*be*l,y=m.height+h;for(let g of b.seatIndices)u[g]=y}}for(let d=0;d<r.length;d++){let p=r[d],m=a[d];if(!m){p.eyeHeightM=n+Ee;continue}let l=s.get(m.id);p.eyeHeightM=(u[d]??l.height)+Ee}}function Sl(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 Ml(e,t){if(!e.length)return null;let n=0,r=0,o=0;for(let l of e)n+=l.x,r+=l.y,o+=Math.hypot(l.x-t.x,l.y-t.y);let i=e.length;n/=i,r/=i,o/=i;let a=e[0],s=-1;for(let l of e){let f=Math.hypot(l.x-n,l.y-r);f>s&&(s=f,a=l)}let c=a.x-n,u=a.y-r,d=Math.hypot(c,u);d>1e-9?(c/=d,u/=d):(c=1,u=0);let p=[...e].sort((l,f)=>(l.x-n)*c+(l.y-r)*u-((f.x-n)*c+(f.y-r)*u)),m=0;for(let l of p){let f=Math.hypot(l.x-n,l.y-r);f>m&&(m=f)}return{pts:p,cx:n,cy:r,radius:m,depth:o}}function Xr(e,t,n){let r=e.pts;if(r.length===1)return Math.hypot(t-r[0].x,n-r[0].y);let o=1/0;for(let i=0;i+1<r.length;i++){let a=r[i],s=r[i+1],c=s.x-a.x,u=s.y-a.y,d=c*c+u*u,p=d>1e-12?((t-a.x)*c+(n-a.y)*u)/d:0;p<0?p=0:p>1&&(p=1);let m=Math.hypot(t-(a.x+p*c),n-(a.y+p*u));m<o&&(o=m)}return o}var ln=8;function wl(e,t,n){let r=new Array(ln).fill(1/0),o=new Array(ln).fill(-1);for(let d=0;d<e.length;d++){let p=e[d],m=Math.hypot(t-p.cx,n-p.cy)-p.radius;for(let l=0;l<ln;l++)if(m<r[l]){for(let f=ln-1;f>l;f--)r[f]=r[f-1],o[f]=o[f-1];r[l]=m,o[l]=d;break}}let i=new Array(3).fill(1/0),a=new Array(3).fill(-1);for(let d of o){if(d<0)continue;let p=Xr(e[d],t,n);for(let m=0;m<3;m++)if(p<i[m]){for(let l=2;l>m;l--)i[l]=i[l-1],a[l]=a[l-1];i[m]=p,a[m]=d;break}}if(a[0]<0)return 0;if(i[0]<1e-6)return e[a[0]].depth;let s=i[0]*2.2,c=0,u=0;for(let d=0;d<3;d++){let p=a[d];if(p<0||i[d]>s)continue;let m=1/(i[d]*i[d]);c+=m*e[p].depth,u+=m}return u>0?c/u:e[a[0]].depth}function Pl(e){let t=(r,o)=>wl(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=Xr(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 Wr(e,t){let n=[];for(let r of e){let o=Ml(r.points,t);o&&n.push(o)}return n.length<2?Sl(t):(n.sort((r,o)=>r.depth-o.depth),Pl(n))}var mo=lt(require("polygon-clipping"),1);var $r=lt(require("earcut"),1);var Cl=.58,Kr=.01,we=De*1.5*Ue,Al=.5,Rl=.6;function Il(e,t){let n=e.length,r=[];for(let a=0;a<n;a++){let s=e[Math.max(0,a-1)],c=e[Math.min(n-1,a+1)],u=c.x-s.x,d=c.y-s.y,p=Math.hypot(u,d);if(p<1e-9){r.push([0,0]);continue}u/=p,d/=p,r.push([-d,u])}let o=0;for(let a=0;a<n;a++)o+=(e[a].x-t.x)*r[a][0]+(e[a].y-t.y)*r[a][1];return o<0?r.map(([a,s])=>[-a,-s]):r}function El(e,t){if(e.length<2||t<=0)return[...e];let n=[...e],r=(a,s)=>{let c=s.x-a.x,u=s.y-a.y,d=Math.hypot(c,u)||1;return{x:c/d,y:u/d}},o=r(n[1],n[0]),i=r(n[n.length-2],n[n.length-1]);return n.unshift({x:n[0].x+o.x*t,y:n[0].y+o.y*t}),n.push({x:n[n.length-1].x+i.x*t,y:n[n.length-1].y+i.y*t}),n}var qr=Math.PI/12;function Tl(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 Zr(e,t){if(!e.length||!(t>0))return[];let n=Tl(e),r=(s,c,u,d)=>{let p=u-c;for(;p<0;)p+=Math.PI*2;for(;p>Math.PI*2;)p-=Math.PI*2;let m=Math.max(1,Math.ceil(p/qr)),l=t/Math.cos(p/m/2);for(let f=0;f<=m;f++){let b=c+p*f/m;d.push({x:s.x+Math.cos(b)*l,y:s.y+Math.sin(b)*l})}};if(n.length<3){let s=0,c=0;for(let l of n)s+=l.x,c+=l.y;s/=n.length||1,c/=n.length||1;let u=0;for(let l of n)u=Math.max(u,Math.hypot(l.x-s,l.y-c));let d=[],p=Math.max(3,Math.ceil(Math.PI*2/qr)),m=(u+t)/Math.cos(Math.PI/p);for(let l=0;l<p;l++){let f=l/p*Math.PI*2;d.push({x:s+Math.cos(f)*m,y:c+Math.sin(f)*m})}return d}let o=n.length,i=[];for(let s=0;s<o;s++){let c=n[s],u=n[(s+1)%o];i.push(Math.atan2(-(u.x-c.x),u.y-c.y))}let a=[];for(let s=0;s<o;s++)r(n[s],i[(s+o-1)%o],i[s],a);return oi(a)}function _l(e,t,n){if(e.length===1)return Math.hypot(t-e[0].x,n-e[0].y);let r=1/0;for(let o=0;o+1<e.length;o++){let i=e[o],a=e[o+1],s=a.x-i.x,c=a.y-i.y,u=s*s+c*c,d=u>1e-12?((t-i.x)*s+(n-i.y)*c)/u:0;d<0?d=0:d>1&&(d=1);let p=Math.hypot(t-(i.x+d*s),n-(i.y+d*c));p<r&&(r=p)}return r}function un(e){let t=e.map(o=>{let i=0,a=0;for(let u of o.pts)i+=u.x,a+=u.y;let s=o.pts.length||1;i/=s,a/=s;let c=0;for(let u of o.pts){let d=Math.hypot(u.x-i,u.y-a);d>c&&(c=d)}return{cx:i,cy:a,rad:c}}),n=o=>{let i=o.length;return i<=2?[...o]:[o[Math.floor(i*.25)],o[Math.floor(i*.5)],o[Math.floor(i*.75)]]},r=[];for(let o=0;o<e.length;o++){let i=n(e[o].pts),a=[],s=1/0,c=null;for(let d of i){let p=1/0;for(let m=0;m<e.length;m++){if(m===o||Math.abs(e[m].y-e[o].y)<.001)continue;let l=t[m],f=Math.hypot(d.x-l.cx,d.y-l.cy)-l.rad;if(f>=p&&f>=s)continue;let b=_l(e[m].pts,d.x,d.y);b<p&&(p=b),e[m].depth<e[o].depth&&b<s&&(s=b,c=e[m].y)}Number.isFinite(p)&&p>0&&a.push(p)}a.sort((d,p)=>d-p);let u=a.length?a[Math.floor(a.length/2)]:1;r.push({pitch:u,belowY:c})}return r}function Jr(e,t,n,r){let o=e[t],i=o.pts.length>=2?[...o.pts]:o.pts.length===1?(()=>{let d=o.pts[0],p=d.x-r.x,m=d.y-r.y,l=Math.hypot(p,m)||1;p/=l,m/=l;let f=Math.max(n[t].pitch,.001)*.5;return[{x:d.x+m*f,y:d.y-p*f},{x:d.x-m*f,y:d.y+p*f}]})():[];if(i.length<2)return null;let a=0,s=0;for(let d=1;d<i.length;d++){let p=Math.hypot(i[d].x-i[d-1].x,i[d].y-i[d-1].y);p>1e-6&&(a+=p,s++)}let c=s>0?a/s:0,u=El(i,Math.max(c*Rl,we));return{pts:u,nrm:Il(u,r),front:Math.max(n[t].pitch*Cl,we),back:Math.max(n[t].pitch*Al,we)}}var bt=1.5,ei=.3;function lo(e,t){if(e.length<3)return e;let n=e[0],r=e[e.length-1],o=r.x-n.x,i=r.y-n.y,a=Math.hypot(o,i),s=-1,c=-1;for(let p=1;p<e.length-1;p++){let m=e[p],l=a>1e-12?Math.abs((m.x-n.x)*i-(m.y-n.y)*o)/a:Math.hypot(m.x-n.x,m.y-n.y);l>s&&(s=l,c=p)}if(s<=t||c<0)return[n,r];let u=lo(e.slice(0,c+1),t),d=lo(e.slice(c),t);return[...u.slice(0,-1),...d]}function ti(e,t){if(e.length<4)return e;let n=lo([...e,e[0]],t);return n.pop(),n.length>=3?n:e}function ni(e,t,n){if(e.length<2)return[];let r=n??un(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=>Jr(e,g,r,t)).filter(g=>g!==null);if(!u.length)continue;let d=(g,x)=>({x:g.pts[x].x-g.nrm[x][0]*(g.front+bt),y:g.pts[x].y-g.nrm[x][1]*(g.front+bt)}),p=(g,x)=>({x:g.pts[x].x+g.nrm[x][0]*(g.back+bt),y:g.pts[x].y+g.nrm[x][1]*(g.back+bt)}),m=u[0],l=u[u.length-1],f=[];for(let g=0;g<m.pts.length;g++)f.push(d(m,g));for(let g of u)f.push(p(g,g.pts.length-1));for(let g=l.pts.length-1;g>=0;g--)f.push(p(l,g));for(let g=u.length-1;g>=0;g--)f.push(d(u[g],0));let b=oi(f),h=1/0;for(let g of s)e[g].y<h&&(h=e[g].y);if(!Number.isFinite(h))continue;if(b.length>=3&&Math.abs(et(b))>1e-6&&u.every(g=>{let x=g.pts[Math.floor(g.pts.length/2)];return Tt(b,x.x,x.y)})){i.push({outline:ti(b,ei),holes:[],topY:h});continue}for(let g of kl(u))i.push({outline:g,holes:[],topY:h})}return i}function kl(e){let t=[];for(let n of e){let r=[],o=[],i=n.front+bt,a=n.back+bt;for(let c=0;c<n.pts.length;c++){let u=n.pts[c],d=n.nrm[c];r.push([u.x-d[0]*i,u.y-d[1]*i]),o.push([u.x+d[0]*a,u.y+d[1]*a])}let s=[...r,...o.reverse()];s.length<3||(s.push(s[0]),t.push([s]))}if(!t.length)return[];try{let n=mo.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(ti(i,ei))}return r}catch{return[]}}function oi(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 uo=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(!Tt(n,o.x,o.y)){r=!1;break}if(r)return!0}return!1}};function Qr(e,t,n,r,o,i){if(r.length<3)return;if(n.containsAll(r)){let u=[0,1,0],d=r[0];for(let p=1;p+1<r.length;p++){let m=r[p],l=r[p+1];e.tri([d.x*G,o,d.y*G],[m.x*G,o,m.y*G],[l.x*G,o,l.y*G],u,i)}return}let a=r.map(u=>[u.x,u.y]);a.push(a[0]);let s;try{s=mo.default.intersection([a],t)}catch{return}let c=[0,1,0];for(let u of s){if(!u.length||u[0].length<4)continue;let d=u[0],p=[],m=[];for(let f=0;f<d.length-1;f++)p.push(d[f][0],d[f][1]),m.push([d[f][0],d[f][1]]);if(m.length<3)continue;let l=(0,$r.default)(p,void 0,2);for(let f=0;f<l.length;f+=3){let b=m[l[f]],h=m[l[f+1]],y=m[l[f+2]];e.tri([b[0]*G,o,b[1]*G],[h[0]*G,o,h[1]*G],[y[0]*G,o,y[1]*G],c,i)}}}function ri(e,t,n,r,o,i,a){if(t.length<2)return;let s=a??un(t),c=[0,1,0],u=i&&i.length>=3?[[...i.map(l=>[l.x,l.y]),[i[0].x,i[0].y]]]:null,d=i&&i.length>=3?new uo([[...i]]):null,p=l=>{e.setMaterial(2),l(),e.setMaterial(0)},m=l=>{e.setMaterial(3),l(),e.setMaterial(0)};for(let l=0;l<t.length;l++){let f=t[l];if(f.patch&&f.patch.length>=3){let A=[...f.patch],S=s[l].belowY??r;if(m(()=>{if(u&&d)Qr(e,u,d,A,f.y,o.tread);else{let P=A[0];for(let T=1;T+1<A.length;T++){let D=A[T],z=A[T+1];e.tri([P.x*G,f.y,P.y*G],[D.x*G,f.y,D.y*G],[z.x*G,f.y,z.y*G],c,o.tread)}}}),f.y>S+Kr){let P=0,T=0;for(let D of A)P+=D.x,T+=D.y;P/=A.length,T/=A.length,p(()=>{for(let D=0;D<A.length;D++){let z=A[D],B=A[(D+1)%A.length],_=B.x-z.x,C=B.y-z.y,k=Math.hypot(_,C);if(k<1e-6)continue;let V=C/k,M=-_/k;(z.x-P)*V+(z.y-T)*M<0&&(V=-V,M=-M);let R=[V,0,M],E=[z.x*G,f.y,z.y*G],w=[B.x*G,f.y,B.y*G],L=[z.x*G,S,z.y*G],I=[B.x*G,S,B.y*G];e.tri(E,w,I,R,o.riser),e.tri(E,I,L,R,o.riser)}})}continue}let b=Jr(t,l,s,n);if(!b)continue;let{pts:h,nrm:y,front:g,back:x}=b,v=s[l].belowY??r;for(let A=0;A+1<h.length;A++){let S=h[A],P=h[A+1],T=y[A],D=y[A+1];if(Math.hypot(P.x-S.x,P.y-S.y)<1e-6||T[0]===0&&T[1]===0||D[0]===0&&D[1]===0)continue;let z=[(S.x-T[0]*g)*G,f.y,(S.y-T[1]*g)*G],B=[(P.x-D[0]*g)*G,f.y,(P.y-D[1]*g)*G],_=[(S.x+T[0]*x)*G,f.y,(S.y+T[1]*x)*G],C=[(P.x+D[0]*x)*G,f.y,(P.y+D[1]*x)*G];if(m(()=>{u&&d?Qr(e,u,d,[{x:S.x-T[0]*g,y:S.y-T[1]*g},{x:P.x-D[0]*g,y:P.y-D[1]*g},{x:P.x+D[0]*x,y:P.y+D[1]*x},{x:S.x+T[0]*x,y:S.y+T[1]*x}],f.y,o.tread):(e.tri(z,B,C,c,o.tread),e.tri(z,C,_,c,o.tread))}),f.y>v+Kr){let k=[z[0],v,z[2]],V=[B[0],v,B[2]],M=[-T[0],0,-T[1]];p(()=>{e.tri(z,B,V,M,o.riser),e.tri(z,V,k,M,o.riser)})}}}}function ii(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 dn(e,t){return e.minX<=t.maxX&&t.minX<=e.maxX&&e.minY<=t.maxY&&t.minY<=e.maxY}var fo=lt(require("polygon-clipping"),1);function Ll(e,t){let n=e.eventConfigurationIds;return!n?.length||!!t&&n.includes(t)}function ai(e,t){return e.filter(n=>n.type!=="shape"||Ll(n,t))}function si(e,t){let n=e.focalPoint??{x:0,y:0};return e.floors?.length?e.floors.map((r,o)=>({objects:ai(r.objects,t),focal:{x:(r.focalPoint??n).x,y:(r.focalPoint??n).y},baseHeightM:r.baseHeightM??0,index:o})):[{objects:ai(e.objects,t),focal:n,baseHeightM:0,index:0}]}var Fl={minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};function yt(e){return ii(e)??Fl}function ci(e,t){let n=nn(e.outline,we),r=yt(n),o=t.filter(a=>a!==e&&a.outline&&a.outline.length>=3&&dn(r,yt(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=fo.default.difference([i(n)],...o.map(c=>[i(c.outline)])),s=[];for(let c of a){if(!c.length)continue;let u=c[0].map(([d,p])=>({x:d,y:p}));if(u.length>1){let d=u[0],p=u[u.length-1];Math.abs(d.x-p.x)<1e-9&&Math.abs(d.y-p.y)<1e-9&&u.pop()}u.length>=3&&s.push(u)}return s.length?s:[n]}catch{return[n]}}function li(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=fo.default.intersection([n(i.outline)],r.flat())}catch{o.push(i);continue}for(let s of a){if(!s.length)continue;let c=s[0].map(([u,d])=>({x:u,y:d}));if(c.length>1){let u=c[0],d=c[c.length-1];Math.abs(u.x-d.x)<1e-9&&Math.abs(u.y-d.y)<1e-9&&c.pop()}c.length>=3&&o.push({outline:c,holes:[],topY:i.topY})}}return o.length?o:e}var Dl=.05,ui=.05,Ol=.15,po=25;function di(e,t,n){let r=new Map,o=new Array(t.length).fill(null),i=new Float64Array(t.length),a=new Array(t.length).fill(void 0),s=new Array(t.length).fill(void 0),c=new Map,u=[],d=new Set;for(let m=0;m<e.length;m+=1){let l=e[m];for(let f of l.objects){if(f.type==="table"&&d.add(f.id),f.type!=="section"||!f.outline||f.outline.length<3)continue;let b=nn(f.outline,we);c.set(f.id,{section:f,unit:l,frontU:1/0,hasSeats:!1,rows:new Map,seatIndices:[]}),u.push({id:f.id,floorIndex:m,box:yt(b),section:f,unit:l,outline:b})}}let p=new Map;for(let m of u){let l=p.get(m.floorIndex);l?l.push(m):p.set(m.floorIndex,[m])}for(let m=0;m<t.length;m++){let l=t[m],f=n?p.get(n[m])??[]:u,b=l.sectionId?f.find(y=>y.id===l.sectionId)??f.find(y=>y.section.logicalSectionId===l.sectionId&&ot({x:l.x,y:l.y},y.outline,y.section.holes)):void 0,h=b?[b]:f;for(let y of h){if(n&&y.floorIndex!==n[m]||!b&&(l.x<y.box.minX||l.x>y.box.maxX||l.y<y.box.minY||l.y>y.box.maxY||!ot({x:l.x,y:l.y},y.outline,y.section.holes)))continue;o[m]=y.id;let g=c.get(y.id);g.hasSeats=!0;let x=l.focalPoint??y.unit.focal,v=Math.hypot(l.x-x.x,l.y-x.y);v<g.frontU&&(g.frontU=v),g.seatIndices.push(m);let A=l.rowId||`__seat-${m}`,S=g.rows.get(A);S?S.push({x:l.x,y:l.y}):g.rows.set(A,[{x:l.x,y:l.y}]);break}}for(let[m,l]of c){let f=Zt(l.section,{floorBaseHeightM:l.unit.baseHeightM}),b=l.unit.baseHeightM,h=f.rake>0?Math.tan(f.rake*Math.PI/180):0,y=f.rake<=.01&&f.height<=b+.001,g=l.section.surfaceKind,x=g==="flat"?!0:g==="rakedRows"&&f.rake>.01?!1:y,v=l.hasSeats?an(m,t,l.seatIndices,l.unit.focal):{sectionId:m,rows:[],blockCount:0},S=v.rows.length<2?Wr([...l.rows.values()].map(E=>({points:E})),l.unit.focal):null,P=1/0;if(S){if(l.hasSeats)for(let E of l.rows.values())for(let w of E){let L=S.depthAt(w.x,w.y);L<P&&(P=L)}if(!l.hasSeats||!Number.isFinite(P)){P=1/0;for(let E of l.section.outline){let w=S.depthAt(E.x,E.y);w<P&&(P=w)}}}let T=b+Dl,D=Math.max(T,f.height),z=E=>{let w=Math.max(0,E-P)*be,L=Math.min(w*h,po);return Math.max(T,f.height+L)},B=E=>{let w=Math.max(0,E)*be,L=Math.min(w*h,po);return Math.max(T,f.height+L)},_=x?[]:v.rows.map(E=>({pts:E.pts,y:B(E.blockDepth),depth:E.blockDepth,blockId:E.blockId,...d.has(E.id)?{patch:Zr(E.pts,we)}:{}})),C=_.length?_[0].y:D,k=_.map(E=>{let w=E.patch&&E.patch.length>=3?E.patch:E.pts,L=0,I=0;for(let U of w)L+=U.x,I+=U.y;let O=w.length||1;L/=O,I/=O;let j=0;for(let U of w){let N=Math.hypot(U.x-L,U.y-I);N>j&&(j=N)}return{cx:L,cy:I,rad:j}}),V=x?()=>D:_.length>=2?(E,w)=>{let L=1/0,I=C;for(let O=0;O<_.length;O++){let j=k[O];if(Math.hypot(E-j.cx,w-j.cy)-j.rad>=L)continue;let U=_[O].patch,N=U&&U.length>=3?Tt(U,E,w)?0:pt(U,E,w):pt(_[O].pts,E,w);N<L&&(L=N,I=_[O].y)}return I}:(E,w)=>S?z(S.depthAt(E,w)):D,M=[0,1,0],R=_.length>=2||x?()=>M:(E,w)=>{if(!S)return M;let L=S.depthAt(E,w);if(L<=P)return M;let I=(L-P)*be;if(I*h>=po||f.height+I*h<=T)return M;let[O,j]=S.gradientAt(E,w);if(O===0&&j===0)return M;let U=1/Math.hypot(h,1);return[-O*h*U,U,-j*h*U]};if(!x)for(let E of v.rows){let w=B(E.blockDepth);for(let L of E.seatIndices)a[L]=w}for(let E of v.rows){let w=[];for(let U=1;U<E.pts.length;U++){let N=Math.hypot(E.pts[U].x-E.pts[U-1].x,E.pts[U].y-E.pts[U-1].y);N>1e-6&&w.push(N)}w.sort((U,N)=>U-N);let L=w.length?w[Math.floor(w.length/2)]:1/0,I=1/0,O=E.pts[Math.floor(E.pts.length/2)];if(O)for(let U of v.rows){if(U===E||U.blockId!==E.blockId)continue;let N=pt(U.pts,O.x,O.y);N>1e-6&&N<I&&(I=N)}let j=Math.min(L,Math.max(I,L*.5));if(Number.isFinite(j)&&j>0)for(let U of E.seatIndices)s[U]=j}r.set(m,{sectionId:m,deckAt:V,normalAt:R,flat:x,bottomY:b,rowLevels:_,landingY:C})}for(let m=0;m<t.length;m++){let l=o[m],f=t[m];if(l){let h=a[m];i[m]=(h??r.get(l).deckAt(f.x,f.y))+Ol;continue}let b=f.eyeHeightM;i[m]=Number.isFinite(b)?Math.max(0,b-Ee):0}return{bySection:r,seatOwner:o,seatDeckY:m=>i[m],seatPitchU:m=>s[m]}}var le={top:1,wallBottom:.5,bottomCap:.4};function Oe(e,t){if(!e)return t;let n=Me(At(e,.4),.62);return ge(t,n,.72)}function mi(e,t){let n=new Map;for(let i of e.categories??[])n.set(i.key,i.color);let r=new Map;for(let i of t){if(!i.sectionId)continue;let a=r.get(i.sectionId);a||(a=new Map,r.set(i.sectionId,a)),a.set(i.categoryKey,(a.get(i.categoryKey)??0)+1)}let o=new Map;for(let[i,a]of r){let s=0,c=0,u=0,d=0;for(let[p,m]of a){let l=ne(n.get(p));l&&(s+=l[0]*m,c+=l[1]*m,u+=l[2]*m,d+=m)}d>0&&o.set(i,[s/d,c/d,u/d])}return o}function fi(e,t){return ne(e.color)??t.get(e.logicalSectionId??e.id)??null}var pi=lt(require("polygon-clipping"),1);function Vl(e,t){return e===void 0||t===void 0?!0:Math.abs(e-t)<.001}var mn=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=yt(t),i=this.rings.filter((c,u)=>dn(o,this.boxes[u])&&Vl(n,this.levels[u])),a=[[r]];if(i.length)try{a=pi.default.difference([r],...i).map(u=>u.map(d=>d.map(([p,m])=>[p,m])))}catch{a=[[r]]}this.rings.push([r]),this.boxes.push(o),this.levels.push(n);let s=[];for(let c of a){if(!c.length)continue;let u=c[0].map(([d,p])=>({x:d,y:p}));if(u.length>1){let d=u[0],p=u[u.length-1];Math.abs(d.x-p.x)<1e-9&&Math.abs(d.y-p.y)<1e-9&&u.pop()}u.length>=3&&s.push(u)}return s}};function Bl(e,t){if(!t)return e;let n=1/0,r=-1/0,o=1/0,i=-1/0;for(let p of e)n=Math.min(n,p.x),r=Math.max(r,p.x),o=Math.min(o,p.y),i=Math.max(i,p.y);let a=(n+r)/2,s=(o+i)/2,c=t*Math.PI/180,u=Math.cos(c),d=Math.sin(c);return e.map(p=>{let m=p.x-a,l=p.y-s;return{x:a+m*u-l*d,y:s+m*d+l*u}})}function rt(e){let t=null;if(e.kind==="polygon"&&e.points&&e.points.length>=3&&(t=e.points),e.kind==="rect"&&e.width&&e.height&&(t=Lt(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=on(n,r,e.width/2,e.height/2)}return t?Bl(t,e.rotation):null}function Ot(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"&&sn(e.stageKind)?{kind:"stage",heightM:.06}:n[t]??{kind:"plate",heightM:.25};return{...r,heightM:e.heightM??r.heightM}}var Nl=.08;function hi(e,t){let n=rt(e),r=Ot(e),o=r.heightM;if(!n||r.kind!=="plate"&&r.kind!=="stage")return o;let i=1/0,a=1/0,s=-1/0,c=-1/0;for(let d of n)i=Math.min(i,d.x),a=Math.min(a,d.y),s=Math.max(s,d.x),c=Math.max(c,d.y);let u=o;for(let d of t)s>d.minX&&i<d.maxX&&c>d.minY&&a<d.maxY&&u<=d.topOffsetM+1e-6&&(u=d.topOffsetM+Nl);return t.push({minX:i,minY:a,maxX:s,maxY:c,topOffsetM:u}),u}function je(e,t,n){return{x:e.x+(t.x-e.x)*n,y:e.y+(t.y-e.y)*n}}function bi(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 Vt(e,t,n){return[je(e[0],e[1],t),je(e[0],e[1],n),je(e[3],e[2],n),je(e[3],e[2],t)]}function yi(e,t,n){return[je(e[0],e[3],t),je(e[1],e[2],t),je(e[1],e[2],n),je(e[0],e[3],n)]}function Ve(e,t,n,r,o,i){ue(e,t,void 0,()=>n,r,o,i,le)}var ho=2.4,Gl=.75,zl=.15;function Bt(e){if(e.points&&e.points.length>=3)return e.points;let{center:t,width:n,height:r,rotation:o}=e;if(!n||!r)return null;let i=(o??0)*Math.PI/180,a=Math.cos(i),s=Math.sin(i),c=n/2,u=r/2;return[[-c,-u],[c,-u],[c,u],[-c,u]].map(([d,p])=>({x:t.x+d*a-p*s,y:t.y+d*s+p*a}))}function gi(e,t,n,r,o){let i=Bt(t);i&&ue(e,i,void 0,()=>n+ho,n,Oe(r,o.boothTop),o.boothWall,le)}function bo(e){if(e.shape==="round"){let d=e.radius;return d?on(e.center.x,e.center.y,d,d,24):null}let{width:t,height:n,rotation:r,center:o}=e;if(!t||!n)return null;let i=(r??0)*Math.PI/180,a=Math.cos(i),s=Math.sin(i),c=t/2,u=n/2;return[[-c,-u],[c,-u],[c,u],[-c,u]].map(([d,p])=>({x:o.x+d*a-p*s,y:o.y+d*s+p*a}))}function xi(e,t,n,r,o){let i=bo(t);i&&ue(e,i,void 0,()=>n+Gl,n,Oe(r,o.tableTop),o.tableWall,le)}function vi(e,t,n,r,o,i,a,s){let c=rt(t);if(!c)return;let u=s?s.kind==="stage":t.role==="stage",d=s?s.kind==="screen":t.role==="screen",p=s?{kind:u?"stage":"solid",heightM:s.topY-s.baseY}:Ot(t),m=s?.baseY??n,l=s?.topY??n+r;if(u&&a){let g=1/0,x=-1/0,v=1/0,A=-1/0;for(let S of c)S.x<g&&(g=S.x),S.x>x&&(x=S.x),S.y<v&&(v=S.y),S.y>A&&(A=S.y);a.push({cx:(g+x)/2*G,cz:(v+A)/2*G,y:l,halfX:Math.max((x-g)/2*G,.5),halfZ:Math.max((A-v)/2*G,.5)})}let f=ne(t.fill),b=u&&f?ge(o.stageTop,Me(At(f,.18),.9),.9):Oe(f,u?o.stageTop:o.decorTop),h=d?f:null,y=u?f?ge(o.stageWall,Me(f,.58),.82):o.stageWall:d?h?ge(Me(h,1.42),[.24,.46,.82],.08):[.24,.46,.82]:Oe(ne(t.fill),o.decorWall);if(p.kind==="portal"&&c.length===4){let g=bi(c);Ve(e,Vt(g,0,.16),l,m,b,y),Ve(e,Vt(g,.84,1),l,m,b,y),Ve(e,g,l,Math.max(m,l-.35),b,y);return}if(p.kind==="suite"&&c.length===4){let g=c.map((A,S)=>{let P=c[(S+1)%4],T=(A.x+P.x)/2,D=(A.y+P.y)/2;return Math.hypot(T-i.x,D-i.y)}),x=g.indexOf(Math.min(...g)),v=[0,1,2,3].map(A=>c[(x+A)%4]);Ve(e,Vt(v,0,.08),l,m,b,y),Ve(e,Vt(v,.92,1),l,m,b,y),Ve(e,yi(v,.88,1),l,m,b,y),Ve(e,v,l,Math.max(m,l-.18),b,y);return}Ve(e,c,l,m,b,y)}function yo(e){let{x:t,y:n,width:r,height:o}=e;if(!r||!o)return null;let i=t+r/2,a=n+o/2,s=(e.rotation??0)*Math.PI/180,c=Math.cos(s),u=Math.sin(s),d=r/2,p=o/2;return[[-d,-p],[d,-p],[d,p],[-d,p]].map(([m,l])=>({x:i+m*c-l*u,y:a+m*u+l*c}))}function Hl(e){if(!e||!e.startsWith("data:image/svg+xml"))return null;let t=e.slice(e.indexOf(",")+1);if(/;base64/i.test(e.slice(0,e.indexOf(","))))try{t=atob(t)}catch{return null}else try{t=decodeURIComponent(t)}catch{}let n=t.match(/<(?:rect|path)\b[^>]*\bfill="([^"]+)"/i);if(!n)return null;let r=n[1].trim();if(r==="none"||r==="transparent")return null;let o=r.match(/^url\(#([^)]+)\)$/);if(!o)return ne(r);let i=t.match(new RegExp(`<(?:linear|radial)Gradient\\b[^>]*\\bid="${o[1]}"[^>]*>([\\s\\S]*?)</(?:linear|radial)Gradient>`,"i"));if(!i)return null;let a=[];for(let s of i[1].matchAll(/stop-color="([^"]+)"/gi)){let c=ne(s[1].trim());c&&a.push(c)}return a.length?a.reduce((s,c,u)=>ge(s,c,1/(u+1)),a[0]):null}function Si(e,t,n,r){if(t.layer==="foreground")return;let o=yo(t);if(!o)return;let i=n+zl,a=Oe(Hl(t.href),r.decorTop),s=Math.max(0,Math.min(1,t.opacity??1));s<1&&(a=ge(r.ground,a,s)),ue(e,o,void 0,()=>i,n,a,ge(a,r.decorWall,.5),le)}function Mi(e,t,n,r,o){if(!t.points||t.points.length<3)return;let i=Oe(r,o.gaTop);ue(e,t.points,t.holes,()=>n+.15,n,i,o.gaWall,le)}var Ul=Math.PI/180,oe=96,jl=6,Yl=60,Xl=150,wi=.2,Wl=.35;function Kl(e,t){let n=Math.atan2(t.x-e.x,t.y-e.y)/Ul;return n<0?n+360:n}function fn(e){if(!e.length)return NaN;let t=[...e].sort((n,r)=>n-r);return t[Math.floor(t.length/2)]}function pn(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 Pi(e,t){let n=e.filter(m=>m.rows.length>=1);if(n.length<1)return null;let r=[],o=0,i=0,a=0;for(let m of n)for(let l of m.rows){for(let f of l.pts)o+=f.x,i+=f.y,a++;if(l.pts.length>=4){let f=oo(l.pts);f&&Number.isFinite(f.cx)&&Number.isFinite(f.cy)&&r.push({x:f.cx,y:f.cy})}}if(!a)return null;let s={x:o/a,y:i/a},c=s;if(r.length>=8){let m=fn(r.map(y=>y.x)),l=fn(r.map(y=>y.y)),f=0;for(let y of n)for(let g of y.rows)for(let x of g.pts){let v=Math.hypot(x.x-s.x,x.y-s.y);v>f&&(f=v)}let b=0,h=f*.2;for(let y of n)for(let g of y.rows)for(let x of g.pts)Math.hypot(x.x-m,x.y-l)<h&&b++;Math.hypot(m-s.x,l-s.y)<=f&&b/a<.01&&(c={x:m,y:l})}let u=[];for(let m of n){let l={sectionId:m.sectionId,rMin:1/0,rMax:-1/0,samples:[]};for(let f of m.rows)for(let b of f.pts){let h=Math.hypot(b.x-c.x,b.y-c.y),y=Math.min(oe-1,Math.floor(Kl(c,b)/(360/oe)));l.samples.push({r:h,bin:y,levelM:f.levelM}),h<l.rMin&&(l.rMin=h),h>l.rMax&&(l.rMax=h)}l.samples.length&&u.push(l)}if(!u.length)return null;u.sort((m,l)=>m.rMin+m.rMax-(l.rMin+l.rMax));let d=[];for(let m of u){let l=!1;for(let f of d){let b=Math.min(m.rMax,f.rMax)-Math.max(m.rMin,f.rMin),h=Math.min(m.rMax-m.rMin,f.rMax-f.rMin);if(h>1e-9&&b>=Wl*h){f.members.push(m),f.rMin=Math.min(f.rMin,m.rMin),f.rMax=Math.max(f.rMax,m.rMax),l=!0;break}}l||d.push({members:[m],rMin:m.rMin,rMax:m.rMax})}let p=[];for(let m of d){let l=new Array(oe).fill(null);for(let C of m.members)for(let k of C.samples){let V=l[k.bin];V||(V={samples:[]},l[k.bin]=V),V.samples.push({r:k.r,levelM:k.levelM})}let f=l.map(C=>!!C);if(!f.filter(Boolean).length)continue;let h=[],y=[];for(let C of l){if(!C)continue;let k=1/0,V=-1/0;for(let M of C.samples)M.r<k&&(k=M.r),M.r>V&&(V=M.r);h.push(k),y.push(V)}let g=fn(h),x=fn(y);if(!(g>=wi*x)||!(x>0))continue;let v=[...h].sort((C,k)=>C-k);if(!(v[Math.floor(v.length*.1)]>=wi*x))continue;let S=l.map(C=>{if(!C)return null;let k=[...C.samples].sort((O,j)=>O.r-j.r),V=k[0].r,M=k[k.length-1].r,R=k[0].levelM,E=-1/0;for(let O of k)O.levelM>E&&(E=O.levelM);let w=[];for(let O of k){let j={r:O.r,l:O.levelM};for(;w.length&&Math.abs(w[w.length-1].r-j.r)<1e-9;){if(w[w.length-1].l<=j.l){j.skip=!0;break}w.pop()}if(!j.skip){for(;w.length>=2;){let U=w[w.length-2],N=w[w.length-1];if((N.r-U.r)*(j.l-U.l)-(N.l-U.l)*(j.r-U.r)<=0)w.pop();else break}w.push(j)}}let L=w.map(O=>O.r),I=w.map(O=>O.l);return{inner:V,outer:M,front:R,top:E,profile:{rs:L,ls:I}}}),P=f.slice();for(let C=0;C<oe;C++){if(P[C])continue;let k=-1,V=-1,M=0;for(let F=1;F<=oe;F++){let K=(C-F+oe*2)%oe;if(P[K]){k=K;break}}for(let F=1;F<=oe;F++){let K=(C+F)%oe;if(P[K]){V=K,M=F;break}}if(k<0||V<0)continue;let R=0;for(let F=1;F<=oe;F++){let K=(C-F+oe*2)%oe;if(f[K]){R=F;break}}if(R-1+M>jl)continue;let w=S[k],L=S[V],I=R/(R+M),O=w.inner+(L.inner-w.inner)*I,j=w.outer+(L.outer-w.outer)*I,U=w.front+(L.front-w.front)*I,N=w.top+(L.top-w.top)*I;S[C]={inner:O,outer:j,front:U,top:N,profile:{rs:[O,j],ls:[U,N]}}}for(let C=0;C<oe;C++)S[C]&&(P[C]=!0);let T=360/oe,D=[],z=P.filter(Boolean).length,B=[];if(z===oe)B.push({start:0,len:oe});else{let C=0;for(;P[C];)C=(C+1)%oe;let k=-1;for(let V=0;V<=oe;V++){let M=(C+V)%oe,R=V<oe&&P[M];if(R&&k<0)k=M;else if(!R&&k>=0){let E=(M-k+oe)%oe||oe;B.push({start:k,len:E}),k=-1}}}for(let C of B){if(C.len*T<Yl&&C.len<oe)continue;let k=C.len===oe,V=new Float64Array(C.len),M=new Float64Array(C.len),R=new Float64Array(C.len),E=new Float64Array(C.len),w=[];for(let F=0;F<C.len;F++){let K=S[(C.start+F)%oe];V[F]=K.inner,M[F]=K.outer,R[F]=K.front,E[F]=K.top,w.push(K.profile??{rs:[K.inner,K.outer],ls:[K.front,K.top]})}let L=pn(V,k),I=pn(M,k),O=pn(R,k),j=pn(E,k);for(let F=0;F<C.len;F++)L[F]>V[F]&&(L[F]=V[F]),I[F]<M[F]&&(I[F]=M[F]),L[F]>I[F]-1e-6&&(L[F]=Math.max(0,I[F]-1e-6)),j[F]<O[F]&&(j[F]=O[F]);let U={startBin:C.start,binCount:C.len,closed:k,innerR:L,outerR:I,frontLevelM:O,topLevelM:j,profiles:w},N=(F,K,X)=>{let Q=w[F],W=Q.rs,$=Q.ls;if(K<=W[0]){$[0]>X&&($[0]=X);return}if(K>=W[W.length-1]){$[$.length-1]>X&&($[$.length-1]=X);return}for(let Z=0;Z+1<W.length;Z++)if(K<=W[Z+1]){$[Z]>X&&($[Z]=X),$[Z+1]>X&&($[Z+1]=X);return}};for(let F=0;F<C.len;F++){let K=l[(C.start+F)%oe];if(K)for(let X of K.samples){N(F,X.r,X.levelM);let Q=k?(F-1+C.len)%C.len:F-1,W=k?(F+1)%C.len:F+1;Q>=0&&N(Q,X.r,X.levelM),W<C.len&&N(W,X.r,X.levelM)}}D.push(U)}D.reduce((C,k)=>C+k.binCount*T,0)<Xl||p.push({arcs:D,sectionIds:m.members.map(C=>C.sectionId),innerRMedian:g,outerRMedian:x})}if(!p.length)return null;if(p.sort((m,l)=>m.innerRMedian-l.innerRMedian),t){let m=p[p.length-1].outerRMedian;if(Math.hypot(t.x-c.x,t.y-c.y)>.9*m)return null}return{centre:c,binCount:oe,binStepDeg:360/oe,rings:p}}function Ci(e,t,n,r){let o=e.binStepDeg,i=n/o-.5-t.startBin;i=(i%e.binCount+e.binCount)%e.binCount,i>t.binCount-1&&(t.closed?i=i-t.binCount<t.binCount-i?0:t.binCount-1:i=i-(t.binCount-1)<e.binCount-i?t.binCount-1:0);let a=Math.floor(i),s=t.closed?(a+1)%t.binCount:Math.min(t.binCount-1,a+1),c=i-a,u=d=>{let p=t.profiles[d],m=p.rs,l=p.ls;if(r<=m[0])return l[0];if(r>=m[m.length-1])return l[l.length-1];for(let f=0;f+1<m.length;f++)if(r<=m[f+1]){let b=m[f+1]-m[f],h=b>1e-9?(r-m[f])/b:0;return l[f]+(l[f+1]-l[f])*h}return l[l.length-1]};return u(a)*(1-c)+u(s)*c}var ql=.25,Ql=1.2,$l=.6,Zl=.45,Jl=2.3,eu=Math.PI/180;function it(e,t,n){let r=n*eu;return{x:e.x+t*Math.sin(r),y:e.y+t*Math.cos(r)}}function tu(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 nu=24;function ou(e,t,n,r,o,i,a,s){let c=n.binCount,u=nu,d=be,p=i+.02,m=[];for(let _=0;_<c;_++){let C=(n.startBin+_+.5)*t.binStepDeg,k=new Float64Array(u+1);for(let V=0;V<=u;V++){let M=r[_]+(o[_]-r[_])*V/u;k[V]=Math.max(p,Ci(t,n,C,M)-ql)}m.push(k)}let l=[a.bandTop[0]*s.top,a.bandTop[1]*s.top,a.bandTop[2]*s.top],f=[a.bandTop[0]*s.bottomCap,a.bandTop[1]*s.bottomCap,a.bandTop[2]*s.bottomCap],b=[a.bandWall[0]*s.top,a.bandWall[1]*s.top,a.bandWall[2]*s.top],h=[a.bandWall[0]*s.wallBottom,a.bandWall[1]*s.wallBottom,a.bandWall[2]*s.wallBottom],y=(_,C)=>{let k=(n.startBin+_+.5)*t.binStepDeg,V=r[_]+(o[_]-r[_])*C/u,M=it(t.centre,V,k);return[M.x*d,m[_][C],M.y*d]};{let _=Math.tan(12*Math.PI/180);for(let C=0;C<6;C++){let k=!1;for(let M=0;M<c;M++)for(let R=u-1;R>=0;R--)m[M][R]>m[M][R+1]&&(m[M][R]=m[M][R+1],k=!0);let V=n.closed?c:c-1;for(let M=0;M<V;M++){let R=(M+1)%c;for(let E=0;E<=u;E++){let w=m[R][E]-m[M][E];if(Math.abs(w)>1)continue;let L=r[M]+(o[M]-r[M])*E/u,I=r[R]+(o[R]-r[R])*E/u,O=it(t.centre,L,(n.startBin+M+.5)*t.binStepDeg),j=it(t.centre,I,(n.startBin+R+.5)*t.binStepDeg),U=_*Math.hypot(j.x-O.x,j.y-O.y)*d;w>U?(m[R][E]=m[M][E]+U,k=!0):-w>U&&(m[M][E]=m[R][E]+U,k=!0)}}if(!k)break}}let g=1,x=(_,C)=>{for(let k=0;k<=u;k+=4)if(Math.abs(m[_][k]-m[C][k])>g)return!0;return Math.abs(m[_][u]-m[C][u])>g},v=Math.tan(38*Math.PI/180),A=_=>(o[_]-r[_])/u*d,S=(_,C)=>m[_][C+1]-m[_][C]>v*Math.max(1e-6,A(_)),P=(_,C)=>{let k=n.closed?(_-1+c)%c:Math.max(0,_-1),V=n.closed?(_+1)%c:Math.min(c-1,_+1);Math.abs(m[k][C]-m[_][C])>g&&(k=_),Math.abs(m[V][C]-m[_][C])>g&&(V=_);let M=Math.max(0,C-1),R=Math.min(u,C+1);M<C&&S(_,M)&&(M=C),R>C&&S(_,C)&&(R=C);let E=y(k,C),w=y(V,C),L=y(_,M),I=y(_,R),O=w[0]-E[0],j=w[1]-E[1],U=w[2]-E[2],N=I[0]-L[0],F=I[1]-L[1],K=I[2]-L[2],X=j*K-U*F,Q=U*N-O*K,W=O*F-j*N,$=Math.hypot(X,Q,W);return $>1e-12?(X/=$,Q/=$,W/=$,Q<0&&(X=-X,Q=-Q,W=-W),[X,Q,W]):[0,1,0]},T=(_,C)=>{let k=[_[0],i,_[2]],V=[C[0],i,C[2]],M=C[0]-_[0],R=C[2]-_[2],E=Math.hypot(M,R);if(!(E>1e-12))return;let w=[R/E,0,-M/E];e.tri(_,C,V,w,b,b,h),e.tri(_,V,k,w,b,h,h)},D=.05*Ue,z=_=>o[_]-r[_]<D,B=n.closed?c:c-1;for(let _=0;_<B;_++){let C=(_+1)%c;if(z(_)||z(C))continue;if(x(_,C)){let w=(n.startBin+_+1)*t.binStepDeg,L=(F,K)=>{let X=(r[_]+r[C])/2,Q=(o[_]+o[C])/2,W=X+(Q-X)*K/u,$=it(t.centre,W,w);return[$.x*d,m[F][K],$.y*d]};for(let F=0;F<u;F++){let K=y(_,F),X=y(_,F+1),Q=L(_,F),W=L(_,F+1),$=P(_,F),Z=P(_,F+1);e.triN(K,Q,W,$,$,Z,l),e.triN(K,W,X,$,Z,Z,l);let te=y(C,F),Le=y(C,F+1),Pe=L(C,F),Be=L(C,F+1),Ne=P(C,F),Ae=P(C,F+1);e.triN(Pe,te,Le,Ne,Ne,Ae,l),e.triN(Pe,Le,Be,Ne,Ae,Ae,l);let Ce=L(_,F),me=L(_,F+1),qe=L(C,F+1),vt=L(C,F),Ge=me[0]-Ce[0],Fe=me[2]-Ce[2],Qe=Math.hypot(Ge,Fe);if(Qe>1e-12){let Ht=[Fe/Qe,0,-Ge/Qe];e.tri(Ce,me,qe,Ht,b),e.tri(Ce,qe,vt,Ht,b)}}let I=y(_,0),O=y(C,0),j=y(C,u),U=y(_,u),N=F=>[F[0],i,F[2]];e.tri(N(I),N(j),N(O),[0,-1,0],f),e.tri(N(I),N(U),N(j),[0,-1,0],f),T(I,O),T(U,j);continue}for(let w=0;w<u;w++){let L=P(_,w),I=P(C,w),O=P(C,w+1),j=P(_,w+1);if(S(_,w)||S(C,w)){let X=(me,qe)=>{let vt=(n.startBin+me+.5)*t.binStepDeg,Ge=r[me]+(o[me]-r[me])*(w+.5)/u,Fe=it(t.centre,Ge,vt);return[Fe.x*d,qe,Fe.y*d]},Q=y(_,w),W=y(C,w),$=X(_,m[_][w]),Z=X(C,m[C][w]);e.triN(Q,W,Z,L,I,I,l),e.triN(Q,Z,$,L,I,L,l);let te=y(C,w+1),Le=y(_,w+1),Pe=X(_,m[_][w+1]),Be=X(C,m[C][w+1]);e.triN(Pe,Be,te,j,O,O,l),e.triN(Pe,te,Le,j,O,j,l);let Ne=Z[0]-$[0],Ae=Z[2]-$[2],Ce=Math.hypot(Ne,Ae);if(Ce>1e-12){let me=[-Ae/Ce,0,Ne/Ce];e.tri($,Z,Be,me,b),e.tri($,Be,Pe,me,b)}continue}let U=y(_,w),N=y(C,w),F=y(C,w+1),K=y(_,w+1);e.triN(U,N,F,L,I,O,l),e.triN(U,F,K,L,O,j,l)}let k=y(_,0),V=y(C,0),M=y(C,u),R=y(_,u),E=w=>[w[0],i,w[2]];e.tri(E(k),E(M),E(V),[0,-1,0],f),e.tri(E(k),E(R),E(M),[0,-1,0],f),T(k,V),T(R,M)}if(!n.closed)for(let _ of[0,c-1])for(let C=0;C<u;C++)T(y(_,C),y(_,C+1))}function Ai(e,t,n){let{bottomY:r,colors:o,ao:i}=n,a=new Float64Array(t.binCount).fill(-1/0);for(let d of t.rings)for(let p of d.arcs){let m=new Float64Array(p.binCount),l=new Float64Array(p.binCount);for(let b=0;b<p.binCount;b++){let h=(p.startBin+b)%t.binCount,y=Math.max(0,p.innerR[b]-we);m[b]=Math.max(y,a[h]+.001),l[b]=Math.max(m[b]+.001,p.outerR[b]+we)}let f=0;for(let b=0;b<p.binCount;b++){let h=p.topLevelM[b]-r;h>f&&(f=h)}f>=Ql&&ou(e,t,p,m,l,r,o,i);for(let b=0;b<p.binCount;b++){let h=(p.startBin+b)%t.binCount;l[b]>a[h]&&(a[h]=l[b])}}if(n.deriveShell===!1||tu(n.shapes,t))return;let s=t.rings[t.rings.length-1],c=$l*Ue,u=Zl*Ue;for(let d of s.arcs){let p=[],m=[];for(let b=0;b<d.binCount;b++){let h=(d.startBin+b+.5)*t.binStepDeg,y=d.outerR[b]+we+c;p.push(it(t.centre,y,h)),m.push(it(t.centre,y+u,h))}let l=-1/0;for(let b=0;b<d.binCount;b++)d.topLevelM[b]>l&&(l=d.topLevelM[b]);let f=()=>l+Jl;d.closed?ue(e,m,[p.slice().reverse()],f,r,o.shellTop,o.shellWall,i):ue(e,[...m,...p.slice().reverse()],void 0,f,r,o.shellTop,o.shellWall,i)}}function Ri(e,t,n,r,o,i,a,s){if(!t.outline||t.outline.length<3)return;let c=n.baseHeightM,u=Oe(r,s.tierTop);if(!o)return;let d=h=>o.deckAt(h.x,h.y),p=ci(t,a),m=p[0]??t.outline;if(o.rowLevels.length>=2){let h=un(o.rowLevels),y=li(ni(o.rowLevels,n.focal,h),p),g=()=>[0,1,0];for(let v of y){let A=Math.max(c,v.topY-.02);for(let S of i.subtract(v.outline,A))ue(e,S,v.holes,()=>A,c,u,s.tierWall,le,void 0,g)}y.length||ue(e,m,t.holes,()=>o.landingY,c,u,s.tierWall,le);let x={tread:[u[0]*le.top,u[1]*le.top,u[2]*le.top],riser:[u[0]*.72,u[1]*.72,u[2]*.72]};for(let v of p.length?p:[m])ri(e,o.rowLevels,n.focal,o.landingY,x,v,h);return}let l=o.flat?1/0:ui,f=h=>o.normalAt(h.x,h.y),b=o.flat?o.landingY:void 0;for(let h of i.subtract(m,b))ue(e,h,t.holes,d,c,u,s.tierWall,le,l,f)}function ru(e,t,n){let r=new Set;for(let a of e.objects)a.type==="section"&&r.add(a.id);let o=new Map;for(let a=0;a<t.length;a++){let s=n.seatOwner[a];if(!s||!r.has(s))continue;let c=n.bySection.get(s);if(c&&c.rowLevels.length>=2)continue;let u=t[a],d=o.get(s);d||(d=new Map,o.set(s,d));let p=u.rowId||`__seat-${a}`,m=d.get(p);m||(m={pts:[],levelM:0,n:0},d.set(p,m)),m.pts.push({x:u.x,y:u.y}),m.levelM+=n.seatDeckY(a),m.n++}let i=[];for(let a of e.objects){if(a.type!=="section")continue;let s=n.bySection.get(a.id);if(s&&s.rowLevels.length>=2){let u=s.rowLevels.filter(d=>!d.patch).map(d=>({pts:d.pts,levelM:d.y}));u.length>=2&&i.push({sectionId:a.id,rows:u});continue}let c=o.get(a.id);c&&i.push({sectionId:a.id,rows:[...c.values()].map(u=>({pts:u.pts,levelM:u.levelM/u.n}))})}return i}function Ii(e,t,n,r,o,i,a=!0){let s=ru(t,n,r);if(!s.length)return;let c=Pi(s,t.focal);c&&(e.setMaterial(0),Ai(e,c,{bottomY:t.baseHeightM,colors:{bandTop:Me(o.tierTop,.8),bandWall:o.tierWall,shellTop:i??Me(o.tierWall,1.15),shellWall:i??o.tierWall},ao:le,shapes:t.objects.filter(u=>u.type==="shape"),deriveShell:a}))}var Ei=/^[\p{L}\p{N}]{1,4}$/u,iu=/^([\p{L}\p{N}]{2,})[\s\-\u2013\u2014\u00b7_./]+(.+)$/u;function Ti(e,t){let n=t?.trim();if(!n)return e;let r=e.toLocaleLowerCase("en-US"),o=n.toLocaleLowerCase("en-US");if(r.startsWith(`${o} `)){let a=e.slice(n.length).trim();if(Ei.test(a))return a}let i=iu.exec(e);if(i){let a=i[1].toLocaleLowerCase("en-US"),s=i[2].trim();if((o.startsWith(a)||a.startsWith(o))&&Ei.test(s))return s}return e}function _i(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 ki(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 au=1.15,su=2.75,cu=4.5,lu=.85,uu=.5,du=.26;function Li(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>=au&&a.add("zone"),o<=(i?su:cu)&&(a.add("section"),a.add("ga")),o<=lu&&(a.add("annotation"),a.add("booth")),o<=uu&&a.add("row"),o<=du&&a.add("seat"),a}function Fi(e,t,n,r,o,i=6){let a=i+t,s=r-i-t,c=i+n,u=o-i-n;return{...e,x:a>s?r/2:Math.max(a,Math.min(s,e.x)),y:c>u?o/2:Math.max(c,Math.min(u,e.y))}}function Ye(e,t,n,r){let o=e,i=t[0],a=t[1],s=t[2],c=o[0]*i+o[4]*a+o[8]*s+o[12],u=o[1]*i+o[5]*a+o[9]*s+o[13],d=o[2]*i+o[6]*a+o[10]*s+o[14],p=o[3]*i+o[7]*a+o[11]*s+o[15];if(!(p>1e-6))return{x:0,y:0,depth:1/0,visible:!1};let m=c/p,l=u/p,f=d/p,b=m>=-1.05&&m<=1.05&&l>=-1.05&&l<=1.05&&f<=1;return{x:(m*.5+.5)*n,y:(1-(l*.5+.5))*r,depth:f,visible:b}}function Di(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(go(i,s,t,n)){a=!0;break}a||r.push(i)}return r}var mu=6;function go(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+mu):n;return o<a&&i<r}function Oi(e,t,n){return e.length*t*.58+(n?14:0)}var fu={row:8,seat:14};function Vi(e){return e<480?{row:5,seat:8}:e<768?{row:6,seat:10}:fu}function Bi(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 xo(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(go(s,u,t,n)){c=!0;break}if(!c){for(let u of a)if(go(s,u,t,n)){c=!0;break}}c||a.push(s)}return a}var pu=6,hu=2.2,Ni=.1,bu=.3,yu=1.8,gu=.9,xu=.55,vu=6e3;function Gi(e){let{doc:t,units:n,seats:r,surfaces:o,focal:i}=e,a=t.zones??[],s=[];if(a.length){let c=new Map;for(let d of n)for(let p of d.objects)p.type==="section"&&p.zone&&c.set(p.id,p.zone);let u=new Map;for(let d=0;d<r.length;d++){let p=r[d],m=o.seatOwner[d],l=p.zoneId??(m?c.get(m):void 0);if(!l)continue;let f=u.get(l);f||(f={n:0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0,sumY:0},u.set(l,f)),f.n++,p.x<f.minX&&(f.minX=p.x),p.y<f.minY&&(f.minY=p.y),p.x>f.maxX&&(f.maxX=p.x),p.y>f.maxY&&(f.maxY=p.y),f.sumY+=o.seatDeckY(d)}for(let d of a){let p=u.get(d.id),m=[];for(let[l,f]of c)f===d.id&&m.push(l);if(!p||p.n===0){s.push({id:d.id,label:d.label,color:ne(d.color),sectionIds:m,seatCount:0,center:[0,0,0],radius:0,focalWorld:[(d.focalPoint??i).x*G,1.5,(d.focalPoint??i).y*G]});continue}s.push({id:d.id,label:d.label,color:ne(d.color),sectionIds:m,seatCount:p.n,center:[(p.minX+p.maxX)/2*G,p.sumY/p.n,(p.minY+p.maxY)/2*G],radius:.5*Math.hypot((p.maxX-p.minX)*G,(p.maxY-p.minY)*G)||1,focalWorld:[(d.focalPoint??i).x*G,1.5,(d.focalPoint??i).y*G]})}}return s}function zi(e){let{doc:t,units:n,seats:r,surfaces:o,seatData:i,hintedSeatFloor:a,zones:s,focal:c}=e,u=[],d=[],p=[];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]+pu,m.center[2]],color:t.zones?.find(l=>l.id===m.id)?.color});{let m=new Map,l=new Map;for(let f=0;f<r.length;f++){let b=o.seatOwner[f];if(!b)continue;let h=m.get(b);h||(h={n:0,x:0,y:0,deck:0},m.set(b,h)),h.n++,h.x+=r[f].x,h.y+=r[f].y,h.deck+=o.seatDeckY(f);let y=l.get(b);y||(y={minX:1/0,maxX:-1/0,minY:1/0,maxY:-1/0},l.set(b,y)),r[f].x<y.minX&&(y.minX=r[f].x),r[f].x>y.maxX&&(y.maxX=r[f].x),r[f].y<y.minY&&(y.minY=r[f].y),r[f].y>y.maxY&&(y.maxY=r[f].y)}for(let f of n)for(let b of f.objects){if(b.type!=="section")continue;let h=m.get(b.id);if(!h||h.n===0)continue;let y=l.get(b.id),g=[h.x/h.n*G,h.deck/h.n,h.y/h.n*G],x=b.displayLabel||b.label||b.id;d.push({id:b.id,floorIndex:f.index,label:x,seatCount:h.n,center:g,radius:Math.max(1,Math.hypot(y.maxX-y.minX,y.maxY-y.minY)*.5*G),focalWorld:[f.focal.x*G,f.baseHeightM+1.5,f.focal.y*G]});let v=t.floors?.[f.index]?.name?.trim().toLocaleLowerCase();n.length>1&&v===x.trim().toLocaleLowerCase()||u.push({id:`section:${b.id}`,kind:"section",text:x,anchor:[g[0],g[1]+hu,g[2]],floorIndex:f.index})}}{for(let b of n)for(let h of b.objects){if(h.type!=="gaArea")continue;let y=Et(h.points);if(!y)continue;let g=h.displayLabel||h.label||h.id;u.push({id:`ga:${h.id}`,kind:"ga",text:h.capacity>0?`${g} \xB7 ${h.capacity.toLocaleString()}`:g,anchor:[y.x*G,b.baseHeightM+yu,y.y*G],floorIndex:b.index})}let m=new Map;for(let b of n)for(let h of b.objects)h.type==="section"&&m.set(h.id,h.displayLabel||h.label||h.id);let l=new Map;for(let b=0;b<r.length;b++){let h=r[b],y=Math.hypot(h.x-c.x,h.y-c.y),g=l.get(h.rowId);(!g||y>g.far)&&l.set(h.rowId,{seat:h,index:b,far:y})}for(let[b,h]of l){let y=Su(h.seat.label,b,m.get(h.seat.sectionId??""));y&&u.push({id:`row:${b}`,kind:"row",text:y,anchor:[h.seat.x*G,o.seatDeckY(h.index)+gu,h.seat.y*G],floorIndex:a[h.index]})}let f=new Map;for(let b=0;b<r.length;b++){let h=r[b],y=h.label?h.label.lastIndexOf("-"):-1,g=f.get(h.rowId);g||(g={n:0,x:0,y:0,z:0,minX:1/0,maxX:-1/0,minZ:1/0,maxZ:-1/0,label:y>0?h.label.slice(0,y):h.rowId,sectionId:h.sectionId},f.set(h.rowId,g));let x=b*3,v=i.iPosition[x],A=i.iPosition[x+1],S=i.iPosition[x+2];g.n++,g.x+=v,g.y+=A,g.z+=S,g.minX=Math.min(g.minX,v),g.maxX=Math.max(g.maxX,v),g.minZ=Math.min(g.minZ,S),g.maxZ=Math.max(g.maxZ,S)}for(let[b,h]of f)p.push({id:b,label:h.label,sectionId:h.sectionId,seatCount:h.n,center:[h.x/h.n,h.y/h.n,h.z/h.n],radius:Math.max(.8,Math.hypot(h.maxX-h.minX,h.maxZ-h.minZ)*.5)});if(r.length<=vu)for(let b=0;b<r.length;b++){let h=r[b],y=vo(h.displayLabel||h.label);y&&u.push({id:`seat:${h.id}`,kind:"seat",text:y,anchor:[h.x*G,o.seatDeckY(b)+xu,h.y*G],floorIndex:a[b]})}}for(let m of n)for(let l of m.objects)if(l.type==="shape"&&l.role&&["entrance","exit","screen","suite","obstruction"].includes(l.role)){let f=rt(l),b=f?Et(f):null;if(!b||!l.label)continue;u.push({id:`architecture:${l.id}`,kind:"annotation",text:l.label,anchor:[b.x*G,m.baseHeightM+Ot(l).heightM+Ni,b.y*G],color:l.fill,floorIndex:m.index})}else if(l.type==="text"){if(!l.text)continue;u.push({id:`text:${l.id}`,kind:"annotation",text:l.text,anchor:[l.position.x*G,m.baseHeightM+Ni,l.position.y*G],color:l.color,rotation:l.rotation,floorIndex:m.index})}else if(l.type==="booth"){let f=Bt(l);if(!f)continue;let b=Et(f);if(!b)continue;u.push({id:`booth:${l.id}`,kind:"booth",text:l.displayLabel||l.label||l.id,anchor:[b.x*G,m.baseHeightM+ho+bu,b.y*G],floorIndex:m.index})}return{labels:u,sections:d,rows:p}}function Hi(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 vo(e){let t=e.lastIndexOf("-");return t>=0&&t<e.length-1?e.slice(t+1):e}function Su(e,t,n){let r=e?e.lastIndexOf("-"):-1,o=r>0?e.slice(0,r):t;return o&&Ti(o,n)}function Ui(e){let{doc:t,units:n,seats:r,surfaces:o,solids:i,hintedSeatFloor:a,seatFloor:s}=e,c=[];{let u=n.map(()=>({minX:1/0,minY:1/0,minZ:1/0,maxX:-1/0,maxY:-1/0,maxZ:-1/0}));for(let m=0;m<i.floor.length;m+=1){let l=Math.max(0,Math.min(n.length-1,Math.round(i.floor[m]))),f=m*3,b=u[l];b.minX=Math.min(b.minX,i.position[f]),b.minY=Math.min(b.minY,i.position[f+1]),b.minZ=Math.min(b.minZ,i.position[f+2]),b.maxX=Math.max(b.maxX,i.position[f]),b.maxY=Math.max(b.maxY,i.position[f+1]),b.maxZ=Math.max(b.maxZ,i.position[f+2])}let d=new Map;for(let m=0;m<n.length;m++)for(let l of n[m].objects)l.type==="section"&&d.set(l.id,m);let p=n.map(()=>({n:0,minX:1/0,minY:1/0,minDeck:1/0,maxX:-1/0,maxY:-1/0,maxDeck:-1/0,sumX:0,sumDeck:0,sumZ:0}));for(let m=0;m<r.length;m++){let l=o.seatOwner[m],f=(l!==null?d.get(l):void 0)??a[m];if(f===void 0)continue;let b=p[f],h=r[m];b.n++,h.x<b.minX&&(b.minX=h.x),h.y<b.minY&&(b.minY=h.y),h.x>b.maxX&&(b.maxX=h.x),h.y>b.maxY&&(b.maxY=h.y);let y=o.seatDeckY(m);b.sumX+=h.x*G,b.sumDeck+=y,b.sumZ+=h.y*G,b.minDeck=Math.min(b.minDeck,y),b.maxDeck=Math.max(b.maxDeck,y+1.6),s[m]=f}for(let m=0;m<n.length;m++){let l=p[m],f=t.floors?.[m],b=u[m],h=Math.min(l.n?l.minX*G:n[m].focal.x*G-1,Number.isFinite(b.minX)?b.minX:1/0),y=Math.max(l.n?l.maxX*G:n[m].focal.x*G+1,Number.isFinite(b.maxX)?b.maxX:-1/0),g=Math.min(l.n?l.minY*G:n[m].focal.y*G-1,Number.isFinite(b.minZ)?b.minZ:1/0),x=Math.max(l.n?l.maxY*G:n[m].focal.y*G+1,Number.isFinite(b.maxZ)?b.maxZ:-1/0),v=Math.min(l.n?Math.min(n[m].baseHeightM,l.minDeck):n[m].baseHeightM,Number.isFinite(b.minY)?b.minY:1/0),A=Math.max(l.n?Math.max(l.maxDeck,v+.5):v+.5,Number.isFinite(b.maxY)?b.maxY:-1/0),S=[l.n?l.sumX/l.n:(h+y)/2,l.n?l.sumDeck/l.n:(v+A)/2,l.n?l.sumZ/l.n:(g+x)/2],P=Math.max(1,.5*Math.hypot(y-h,A-v,x-g));c.push({index:m,id:f?.id??`floor-${m}`,label:f?.name??(n.length>1?`Floor ${m+1}`:"Venue"),seatCount:l.n,center:S,radius:P,box:{min:[h,v,g],max:[y,A,x]},focalWorld:[n[m].focal.x*G,n[m].baseHeightM+1.5,n[m].focal.y*G]})}}return c}function So(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=Bt(c);if(u)for(let d of u)a(d.x,d.y)}else if(c.type==="table"){let u=bo(c);if(u)for(let d of u)a(d.x,d.y)}else if(c.type==="decorImage"){let u=yo(c);if(u)for(let d of u)a(d.x,d.y)}return Number.isFinite(n)||(n=-100,r=-100,o=100,i=100),{minX:n,minY:r,maxX:o,maxY:i}}function ji(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=Lt(o.minX-a,o.minY-a,o.maxX-o.minX+a*2,o.maxY-o.minY+a*2);ue(e,s,void 0,()=>0,-.4,i.ground,i.ground,le)}else{let a=t.reduce((l,f)=>f.baseHeightM<l.baseHeightM?f:l);e.setFloor(a.index);let s=n.filter((l,f)=>r[f]===a.index),c=So([a],s),u=Math.hypot(c.maxX-c.minX,c.maxY-c.minY),d=Math.max(28,Math.min(80,u*.04)),p=Lt(c.minX-d,c.minY-d,c.maxX-c.minX+d*2,c.maxY-c.minY+d*2),m=a.baseHeightM-.03;ue(e,p,void 0,()=>m,m-.22,i.ground,i.ground,le)}}function Yi(e,t,n){let{cx:r,cz:o,radius:i}=n,a=1/0,s=1/0,c=1/0,u=-1/0,d=-1/0,p=-1/0,m=(b,h,y)=>{a=Math.min(a,b),u=Math.max(u,b),s=Math.min(s,h),d=Math.max(d,h),c=Math.min(c,y),p=Math.max(p,y)};for(let b=0;b<e.position.length;b+=3)m(e.position[b],e.position[b+1],e.position[b+2]);for(let b=0;b<t.count;b++){let h=b*3,y=t.iPosition[h],g=t.iPosition[h+1],x=t.iPosition[h+2],v=Math.max(.35,t.iMaxRadius[b]??.35);m(y-v,g,x-v),m(y+v,g+1.6,x+v)}Number.isFinite(a)||(a=r-i,u=r+i,s=0,d=i*.16,c=o-i,p=o+i);let l=[(a+u)/2,(s+d)/2,(c+p)/2],f=Math.max(1,.5*Math.hypot(u-a,d-s,p-c));return{center:l,radius:f,minY:s,maxY:d}}function Xi(e,t,n,r,o,i){let a=1/0,s=1/0,c=-1/0,u=-1/0;for(let v=0;v<e.count;v++){let A=v*3,S=e.iPosition[A],P=e.iPosition[A+2];S<a&&(a=S),S>c&&(c=S),P<s&&(s=P),P>u&&(u=P)}for(let v of t)a=Math.min(a,v.cx-v.halfX),c=Math.max(c,v.cx+v.halfX),s=Math.min(s,v.cz-v.halfZ),u=Math.max(u,v.cz+v.halfZ);let d=n.minX*G,p=n.maxX*G,m=n.minY*G,l=n.maxY*G,f=d,b=p,h=m,y=l;if(Number.isFinite(a)){let v=Math.max(2,.06*Math.hypot(c-a,u-s));f=Math.max(d,a-v),b=Math.min(p,c+v),h=Math.max(m,s-v),y=Math.min(l,u+v)}let g=Math.min(0,r),x=Math.max(o,i*.05);return{min:[f,g,h],max:[b,x,y]}}function Wi(e,t,n){let r=()=>({byObjectId:new Map,elements:[]});if(!t||!e)return r();let o=Fr(t);if(!o.ok||o.value.id!==e)return r();let i=new Map;for(let p of n)for(let m of p.objects)m.type==="shape"&&i.set(m.id,{shape:m,unit:p});let a=new Set,s=new Set,c=new Map((t.overlay.productionElements??[]).map(p=>{let m=p.runtimeContentImageUrl;return[p.id,typeof m=="string"&&/^(?:blob:|data:image\/|https:\/\/)/.test(m)?m:void 0]})),u=[];for(let p of o.value.overlay.productionElements??[]){let m=i.get(p.objectId),l=m?rt(m.shape):null,f=p.baseElevationM??0;if(!m||!l||l.length<3||!p.id||a.has(p.id)||s.has(p.objectId)||!Number.isFinite(p.heightM)||p.heightM<.05||p.heightM>50||!Number.isFinite(f)||f<-10||f>100)return r();a.add(p.id),s.add(p.objectId);let b=l.map(T=>T.x*G),h=l.map(T=>T.y*G),y=m.unit.baseHeightM+f,g=Math.min(...b),x=Math.max(...b),v=Math.min(...h),A=Math.max(...h),S,P=c.get(p.id)??p.contentImageUrl;if(p.kind==="screen"&&P)if(x-g>=A-v){let T=Math.abs(v-m.unit.focal.y*G)<=Math.abs(A-m.unit.focal.y*G)?v-.006:A+.006;S=[[g,y,T],[x,y,T],[g,y+p.heightM,T],[x,y+p.heightM,T]]}else{let T=Math.abs(g-m.unit.focal.x*G)<=Math.abs(x-m.unit.focal.x*G)?g-.006:x+.006;S=[[T,y,v],[T,y,A],[T,y+p.heightM,v],[T,y+p.heightM,A]]}u.push({id:p.id,objectId:p.objectId,kind:p.kind,floorIndex:m.unit.index,baseY:y,topY:y+p.heightM,bounds:{min:[g,y,v],max:[x,y+p.heightM,A]},occlusion:p.occlusion,...P?{contentImageUrl:P}:{},...S?{contentPlane:S}:{}})}let d=u.sort((p,m)=>p.id.localeCompare(m.id));return{byObjectId:new Map(d.map(p=>[p.objectId,p])),elements:d}}function ve(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function xe(e){return Array.isArray(e)?e:[]}function Mu(e){let t=[e];for(;t.length;){let n=t.pop();if(Array.isArray(n)){t.push(...n);continue}if(!ve(n))continue;let r=ve(n.extensions)?n.extensions:null;if(r&&Object.prototype.hasOwnProperty.call(r,"KHR_draco_mesh_compression"))return!0;t.push(...Object.values(n))}return!1}function hn(e,t){return!Array.isArray(e)||e.length!==t||!e.every(n=>typeof n=="number"&&Number.isFinite(n))?null:e}function wu(){return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}function Pu(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 Cu(e){let t=hn(e.matrix,16);if(t)return t;if(e.matrix!==void 0)return null;let n=e.translation===void 0?[0,0,0]:hn(e.translation,3),r=e.rotation===void 0?[0,0,0,1]:hn(e.rotation,4),o=e.scale===void 0?[1,1,1]:hn(e.scale,3);if(!n||!r||!o)return null;let[i,a,s,c]=r,u=Math.hypot(i,a,s,c);if(!(u>1e-8))return null;let d=i/u,p=a/u,m=s/u,l=c/u,f=d+d,b=p+p,h=m+m,y=d*f,g=d*b,x=d*h,v=p*b,A=p*h,S=m*h,P=l*f,T=l*b,D=l*h;return[(1-(v+S))*o[0],(g+D)*o[0],(x-T)*o[0],0,(g-D)*o[1],(1-(y+S))*o[1],(A+P)*o[1],0,(x+T)*o[2],(A-P)*o[2],(1-(y+v))*o[2],0,n[0],n[1],n[2],1]}function Au(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 Ru(e){let t=e[0],n=e[4],r=e[8],o=e[1],i=e[5],a=e[9],s=e[2],c=e[6],u=e[10],d=i*u-a*c,p=a*s-o*u,m=o*c-i*s,l=t*d+n*p+r*m;if(Math.abs(l)<1e-12)return null;let f=1/l;return[d*f,p*f,m*f,(r*c-n*u)*f,(t*u-r*s)*f,(n*s-t*c)*f,(n*a-r*i)*f,(r*o-t*a)*f,(t*i-n*o)*f]}function Ki(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 Iu(e){if(e.byteLength<20||e.byteLength>8388608)return null;let t=new DataView(e.buffer,e.byteOffset,e.byteLength);if(t.getUint32(0,!0)!==1179937895||t.getUint32(4,!0)!==2||t.getUint32(8,!0)!==e.byteLength)return null;let n=12,r=null,o=null;for(;n+8<=e.byteLength;){let i=t.getUint32(n,!0),a=t.getUint32(n+4,!0);if(n+=8,i%4!==0||n+i>e.byteLength)return null;let s=e.subarray(n,n+i);if(a===1313821514&&!r)try{let c=JSON.parse(new TextDecoder().decode(s).replace(/[\u0000 ]+$/g,""));if(!ve(c))return null;r=c}catch{return null}else if(a===5130562&&!o)o=s;else return null;n+=i}return n===e.byteLength&&r&&o?{json:r,bin:o}:null}function Eu(e){return e===5120||e===5121?1:e===5122||e===5123?2:e===5125||e===5126?4:0}function Tu(e){return e==="SCALAR"?1:e==="VEC2"?2:e==="VEC3"?3:e==="VEC4"?4:0}function _u(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 ku(e){let t=e instanceof Uint8Array?e:new Uint8Array(e),n=Iu(t);if(!n)return{ok:!1,issue:"invalid_glb"};let{json:r,bin:o}=n;if(!ve(r.asset)||r.asset.version!=="2.0")return{ok:!1,issue:"unsupported_glb"};let i=xe(r.extensionsUsed).filter(v=>typeof v=="string");if(i.includes("KHR_draco_mesh_compression")||Mu(r))return{ok:!1,issue:"draco_not_allowed"};if(i.length||xe(r.extensionsRequired).length)return{ok:!1,issue:"unsupported_glb"};if(xe(r.images).length||xe(r.textures).length)return{ok:!1,issue:"external_resource"};let a=xe(r.buffers);if(a.length!==1||!ve(a[0])||a[0].uri!==void 0||typeof a[0].byteLength!="number"||!Number.isInteger(a[0].byteLength)||a[0].byteLength<0||a[0].byteLength>o.byteLength)return{ok:!1,issue:"external_resource"};let s=xe(r.accessors),c=xe(r.bufferViews),u=xe(r.meshes),d=xe(r.nodes),p=xe(r.scenes),m=typeof r.scene=="number"?r.scene:0;if(!ve(p[m]))return{ok:!1,issue:"unsupported_glb"};let l=new DataView(o.buffer,o.byteOffset,o.byteLength),f=(v,A,S)=>{if(typeof v!="number"||!Number.isInteger(v)||!ve(s[v]))return null;let P=s[v];if(P.type!==A||P.sparse!==void 0||P.normalized===!0||typeof P.count!="number"||!Number.isInteger(P.count)||P.count<1||typeof P.componentType!="number"||!S.includes(P.componentType)||typeof P.bufferView!="number")return null;let T=c[P.bufferView];if(!ve(T)||T.buffer!==0||typeof T.byteLength!="number"||!Number.isInteger(T.byteLength)||T.byteLength<0)return null;let D=Tu(P.type),z=Eu(P.componentType),B=typeof T.byteStride=="number"?T.byteStride:D*z,_=typeof T.byteOffset=="number"?T.byteOffset:0,C=typeof P.byteOffset=="number"?P.byteOffset:0,k=_+C,V=C+(P.count-1)*B+D*z;if(!Number.isInteger(B)||!Number.isInteger(_)||!Number.isInteger(C)||B<D*z||_<0||C<0||_+T.byteLength>o.byteLength||V>T.byteLength)return null;let M=[];for(let R=0;R<P.count;R++){let E=[];for(let w=0;w<D;w++){let L=_u(l,k+R*B+w*z,P.componentType);if(!Number.isFinite(L))return null;E.push(L)}M.push(E)}return M},b=[],h=[],y=0,g=new Set,x=(v,A)=>{if(typeof v!="number"||!Number.isInteger(v)||!ve(d[v])||g.has(v))return!1;g.add(v);let S=d[v],P=Cu(S);if(!P)return!1;let T=Pu(A,P),D=Ru(T);if(!D)return!1;if(S.mesh!==void 0){if(typeof S.mesh!="number")return!1;let z=u[S.mesh];if(!ve(z))return!1;for(let B of xe(z.primitives)){if(!ve(B)||B.mode!==void 0&&B.mode!==4||!ve(B.attributes))return!1;let _=f(B.attributes.POSITION,"VEC3",[5126]),C=B.attributes.NORMAL===void 0?null:f(B.attributes.NORMAL,"VEC3",[5126]);if(!_||B.attributes.NORMAL!==void 0&&!C)return!1;let k=_.length;if(B.indices!==void 0){let M=typeof B.indices=="number"?s[B.indices]:null;k=ve(M)?M.count:void 0}if(typeof k!="number"||!Number.isInteger(k)||k%3!==0||(y+=k/3,y>1e5))return!1;let V=B.indices===void 0?_.map((M,R)=>[R]):f(B.indices,"SCALAR",[5121,5123,5125]);if(!V||V.length%3!==0||V.length!==k)return!1;for(let M=0;M<V.length;M+=3){let R=[V[M][0],V[M+1][0],V[M+2][0]];if(R.some(L=>!Number.isInteger(L)||L<0||L>=_.length))return!1;let E=R.map(L=>Au(T,..._[L])),w=null;if(!C){let L=E[1][0]-E[0][0],I=E[1][1]-E[0][1],O=E[1][2]-E[0][2],j=E[2][0]-E[0][0],U=E[2][1]-E[0][1],N=E[2][2]-E[0][2];w=Ki([1,0,0,0,1,0,0,0,1],I*N-O*U,O*j-L*N,L*U-I*j)}for(let L=0;L<3;L++)b.push(...E[L]),h.push(...C?Ki(D,...C[R[L]]):w)}}}for(let z of xe(S.children))if(!x(z,T))return!1;return g.delete(v),!0};for(let v of xe(p[m].nodes))if(!x(v,wu()))return{ok:!1,issue:y>1e5?"triangle_limit":"unsupported_glb"};return!y||b.length!==y*9||h.length!==b.length?{ok:!1,issue:"unsupported_glb"}:{ok:!0,triangleCount:y,position:new Float32Array(b),normal:new Float32Array(h)}}function qi(e){try{return ku(e)}catch{return{ok:!1,issue:"invalid_glb"}}}function gt(e){let{doc:t}=e,n=Mr(t.theme),r=n.structure,o=si(t,e.eventConfigurationId??t.eventConfigurationId),i=Wi(e.eventConfigurationId,e.eventConfiguration,o),a=e.seats,s=new tn,c=null;if(e.registeredShellGlb){let M=qi(e.registeredShellGlb);if(M.ok){let R=M.position.length/3,E=new Float32Array(M.position.length),w=n.materials.shell??r.tierWall;for(let L=0;L<R;L++){let I=M.normal[L*3+1],O=I<-.25?.4:.62+.38*Math.max(0,I);E[L*3]=w[0]*O,E[L*3+1]=w[1]*O,E[L*3+2]=w[2]*O}c={position:M.position,normal:M.normal,color:E,floor:new Float32Array(R).fill(-2),material:new Float32Array(R),count:R}}}let u=new Map;for(let M of o)for(let R of M.objects)u.set(R.id,M.index),R.type==="section"&&u.set(R.logicalSectionId??R.id,M.index);let d=a.map(M=>u.get(M.sectionId??"")??u.get(M.rowId??"")??0),p=So(o,a);ji(s,o,a,d,p,r);let m=mi(t,a),l=new Map,f=new Map;for(let M of t.categories??[])l.set(M.key,M.color),M.seatGlyph&&f.set(M.key,M.seatGlyph);let b=[],h=di(o,a,d),y=new Float32Array(a.length),g=[];for(let M=0;M<o.length;M++){let R=o[M];s.setFloor(M);let E=new mn,w=[],L=R.objects.filter(I=>I.type==="section"&&!!I.outline&&I.outline.length>=3);for(let I of R.objects)if(I.type==="section"){let O=s.vertexCount;Ri(s,I,R,fi(I,m),h.bySection.get(I.id),E,L,r);let j=s.vertexCount-O;j>0&&g.push({sectionId:I.id,start:O,count:j})}else if(I.type==="shape"){let O=i.byObjectId.get(I.id);s.setMaterial((O?.kind??I.role)==="screen"?1:0),vi(s,I,R.baseHeightM,hi(I,w),r,R.focal,b,O),s.setMaterial(0)}else I.type==="gaArea"?Mi(s,I,R.baseHeightM,ne(l.get(I.categoryKey)),r):I.type==="booth"?gi(s,I,R.baseHeightM,ne(l.get(I.categoryKey)),r):I.type==="table"?xi(s,I,R.baseHeightM,ne(I.fill??t.theme?.decorFill??"#232c40"),r):I.type==="decorImage"&&Si(s,I,R.baseHeightM,r);Ii(s,R,a,h,r,n.materials.shell,!c)}let x=o.length>1?{x:o.reduce((M,R)=>M+R.focal.x,0)/o.length,y:o.reduce((M,R)=>M+R.focal.y,0)/o.length}:t.focalPoint??{x:(p.minX+p.maxX)/2,y:(p.minY+p.maxY)/2},v=dr(c?[s.build(),c]:[s.build()]),A=vr(a,e.initialState,h,y,l,f),S=Gi({doc:t,units:o,seats:a,surfaces:h,focal:x}),{labels:P,sections:T,rows:D}=zi({doc:t,units:o,seats:a,surfaces:h,seatData:A,hintedSeatFloor:d,zones:S,focal:x}),z=Ui({doc:t,units:o,seats:a,surfaces:h,solids:v,hintedSeatFloor:d,seatFloor:y});Hi(P,z),A.iYaw=gr(A.iPosition,a.length,M=>a[M].rowId,M=>{let R=o[y[M]]?.focal??x;return[R.x*G,R.y*G]});let B=(p.minX+p.maxX)/2*G,_=(p.minY+p.maxY)/2*G,C=.5*Math.hypot((p.maxX-p.minX)*G,(p.maxY-p.minY)*G)||10,k=Yi(v,A,{cx:B,cz:_,radius:C}),V=Xi(A,b,p,k.minY,k.maxY,C);return{solids:v,sectionSolidRanges:g,seats:A,bounds:{center:[(V.min[0]+V.max[0])/2,(V.min[1]+V.max[1])/2,(V.min[2]+V.max[2])/2],radius:C,groundY:0,box:V},renderBounds:{center:k.center,radius:k.radius},stateColorLUT:wr(n,pe),theme:n,seatCount:a.length,focalWorld:[x.x*G,1.5,x.y*G],zones:S,stages:b,productionElements:i.elements,sections:T,rows:D,labels:P,floors:z}}var Lu=88,Fu=20,Mo={floor:{size:14,weight:"700",opacity:.98},zone:{size:15,weight:"600",opacity:.95},section:{size:12,weight:"500",opacity:.88},ga:{size:12,weight:"500",opacity:.88},booth:{size:11,weight:"500",opacity:.85},annotation:{size:11,weight:"400",opacity:.75},row:{size:11.5,weight:"700",opacity:.94},seat:{size:12.5,weight:"800",opacity:1}},Qi="rgba(10,14,22,.62)",Du="#f4f7fb",$i=5,Zi=2,Ou=6,bn=new Set(["row","seat"]),Ji={floor:5,zone:4,section:3,ga:3,booth:2,annotation:1},yn={row:{x:66,y:20},seat:{x:52,y:22}},Po=ne,wo=e=>Ho(e);function Co(e,t){let n=wo(e),r=wo(t);return(Math.max(n,r)+.05)/(Math.min(n,r)+.05)}function Ao(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 Vu(e,t=[.04,.06,.1],n=!0){let r=wo(t)<.42,o=r?"#f4f7fb":"#0b1220",i=r?"rgba(8,12,22,.78)":"rgba(255,255,255,.84)",a=n?Ao(i,t):t,s=Po(e),c=n?7:4.5,u=s&&Co(s,a)>=c?e:o;return r?{ink:u,backing:i,border:"rgba(210,222,245,.24)"}:{ink:u,backing:i,border:"rgba(11,18,32,.22)"}}function Bu(e,t=[.04,.06,.1]){let n=Ao(Qi,t),r=Po(e);return{ink:r&&Co(r,n)>=4.5?e:Du,backing:Qi}}var Nu='ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif',gn=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",r.fontFamily=n.fontFamily||Nu,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=Li(o,i,{hasZoneLabels:this.labels.some(x=>x.kind==="zone")});this.forcedDense&&(s.add("row"),s.add("seat"));let c=[];for(let x of this.labels){if(!s.has(x.kind))continue;let v=Ye(t,x.anchor,n,r);if(!v.visible)continue;let A=bn.has(x.kind),S=Oi(x.text,Mo[x.kind].size,!A)+(A?$i*2:0),P=Fi(v,S/2,Mo[x.kind].size/2+(A?Zi:4),n,r),T=a?Math.hypot(x.anchor[0]-a[0],x.anchor[1]-a[1],x.anchor[2]-a[2]):1;c.push({label:x,screen:P,focus:Bi(P,T,n,r),halfWidth:S/2,...this.selectedSeatLabelIds.has(x.id)?{priority:1}:{}})}let u=ki(c.filter(x=>x.label.kind==="floor"),n),d=[...c.filter(x=>!bn.has(x.label.kind)&&x.label.kind!=="floor"),...u],p=Di(d,Lu,Fu),m=Vi(n),l=xo(c.filter(x=>x.label.kind==="row"),yn.row.x,yn.row.y,m.row,p),f=xo(c.filter(x=>x.label.kind==="seat"),yn.seat.x,yn.seat.y,m.seat,[...p,...l]),b=[...p,...l,...f],h=new Set(b.map(x=>x.label.id));for(let{label:x,screen:v}of b){let S=this.nodeFor(x).style;S.display="",S.transform=`translate(-50%, -50%) translate(${v.x.toFixed(1)}px, ${v.y.toFixed(1)}px)`}let y=b.filter(({label:x})=>!bn.has(x.kind)).sort((x,v)=>Ji[v.label.kind]-Ji[x.label.kind]||x.screen.depth-v.screen.depth||x.focus-v.focus),g=[];for(let{label:x}of y){let v=this.nodes.get(x.id);if(!v||v.style.display==="none")continue;let A=v.getBoundingClientRect();g.some(P=>A.left<P.right+3&&A.right+3>P.left&&A.top<P.bottom+3&&A.bottom+3>P.top)?v.style.display="none":g.push(A)}for(let[x,v]of this.nodes)h.has(x)||(v.style.display="none")}nodeFor(t){let n=this.nodes.get(t.id);if(!n){n=document.createElement("div");let l=n.style;l.position="absolute",l.left="0",l.top="0",l.whiteSpace="nowrap",l.textShadow="0 1px 3px rgba(0,0,0,0.85), 0 0 8px rgba(0,0,0,0.55)",l.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=Mo[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=bn.has(t.kind),s=!a,c=Vu(t.color??this.opts.ink,this.opts.backgroundRgb,!0),u=a?Bu(t.color??this.opts.ink,this.opts.backgroundRgb):c;i.color=r?"#ecf8ff":u.ink,i.background=r?"rgba(10,28,45,.9)":u.backing,i.border=r?"1px solid rgba(89,199,255,.92)":s?`1px solid ${c.border}`:"",i.borderRadius=r||s?"999px":`${Ou}px`,i.padding=r||s?"3px 7px":`${Zi}px ${$i}px`,i.lineHeight=a?"1.1":"",i.boxShadow=r?"0 0 0 2px rgba(41,176,255,.18), 0 5px 14px rgba(0,0,0,.35)":s?"0 3px 10px rgba(0,0,0,.24)":"0 1px 4px rgba(0,0,0,.28)",i.letterSpacing=t.kind==="zone"||t.kind==="floor"?"0.08em":"0.02em";let d=this.opts.backgroundRgb??[.04,.06,.1],p=Po(r?"#ecf8ff":u.ink)??[1,1,1],m=Ao(r?"rgba(10,28,45,.9)":u.backing,d);return n.dataset.qualityContrast=Co(p,m).toFixed(3),(t.kind==="zone"||t.kind==="floor")&&(i.textTransform="uppercase"),n}dispose(){this.root.remove(),this.nodes.clear()}};var ta=1;var Gu=new Set(["floor","zone","section","ga","booth","annotation"]);function zu(e){return e.every(t=>Number.isFinite(t))}function Hu(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 ea(e){return e.length?Math.round(Math.min(...e)*100)/100:null}function at(e){return Math.round(e*1e4)/1e4}function Uu(e){if(e)return{box:{x:at(e.box.x),y:at(e.box.y),width:at(e.box.width),height:at(e.box.height)},horizontalFillRatio:at(e.horizontalFillRatio),verticalFillRatio:at(e.verticalFillRatio),visibleAreaRatio:at(e.visibleAreaRatio),clippedEdges:[...e.clippedEdges]}}function Te(e,t,n){return n.length?{code:e,message:t,count:n.length,samples:n.slice(0,20)}:null}function xn(e){let t=e.labels.filter(s=>s.visible&&s.screenBox),n=t.filter(s=>Gu.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)Hu(n[s].screenBox,n[c].screenBox)&&o.push({primaryId:n[s].id,primaryLabel:n[s].text,secondaryId:n[c].id});let i=[...e.camera.position,e.camera.distance,e.camera.verticalFovDeg],a=[Te("webgl2-unavailable","The venue scene must render through WebGL2",e.context.webgl2?[]:[{primaryId:"renderer",primaryLabel:"WebGL2"}]),Te("context-lost","The WebGL context must be live at capture",e.context.lost?[{primaryId:"renderer",primaryLabel:"context lost"}]:[]),Te("frame-not-stable","The captured 3D frame must be rendered and parked",e.frame.rendered>0&&e.frame.idle?[]:[{primaryId:"renderer",primaryLabel:"unstable frame"}]),Te("viewport-empty","The 3D viewport must have visible dimensions",e.viewport.width>1&&e.viewport.height>1?[]:[{primaryId:"viewport",primaryLabel:`${e.viewport.width}\xD7${e.viewport.height}`}]),Te("camera-invalid","The capture camera must have a finite physical pose",zu(i)&&e.camera.distance>0&&e.camera.verticalFovDeg>0&&e.camera.verticalFovDeg<180?[]:[{primaryId:"camera",primaryLabel:"invalid pose"}]),Te("authored-relief-not-visible","Authored 3D height or rake must produce visible screen-space relief",!e.scene.authoredRelief||e.scene.renderedVerticalSpanM>.05&&e.scene.projectedReliefPx>=2?[]:[{primaryId:"scene",primaryLabel:"authored relief",measured:e.scene.projectedReliefPx,minimum:2}]),Te("hierarchy-label-missing","A venue with authored hierarchy must show at least one structural label",r===0||n.length>0?[]:[{primaryId:"labels",primaryLabel:`${r} expected hierarchy labels`}]),Te("hierarchy-label-undersized","Visible 3D hierarchy labels must remain readable",n.filter(s=>s.renderedFontPx<11).map(s=>({primaryId:s.id,primaryLabel:s.text,measured:s.renderedFontPx,minimum:11}))),Te("hierarchy-label-contrast-low","Visible 3D hierarchy labels must meet text contrast",n.filter(s=>s.contrast<4.5).map(s=>({primaryId:s.id,primaryLabel:s.text,measured:s.contrast,minimum:4.5}))),Te("hierarchy-label-collision","Visible 3D hierarchy labels must not overlap",o)].filter(s=>!!s);return{version:1,state:"venue3d",passed:a.length===0,resolvedRules:["rendered-3d-webgl-context","rendered-3d-stable-frame","rendered-3d-camera-pose","rendered-3d-relief-projection","rendered-3d-label-size","rendered-3d-label-contrast","rendered-3d-label-collision"],viewport:e.viewport,context:e.context,frame:e.frame,camera:e.camera,scene:e.scene,composition:{visibleLabels:t.map(({id:s,kind:c,text:u})=>({id:s,kind:c,text:u})).sort((s,c)=>s.kind.localeCompare(c.kind)||s.id.localeCompare(c.id)),framing:Uu(e.framing)},metrics:{minimumHierarchyFontPx:ea(n.map(s=>s.renderedFontPx)),minimumHierarchyContrast:ea(n.map(s=>s.contrast)),projectedReliefPx:Math.round(e.scene.projectedReliefPx*100)/100},findings:a}}var ce=require("ogl");var Xe=require("ogl");var vn=`
|
|
20
|
+
}`});async function rs(e,t,n,r={}){let o=r.fadeMs??400,i=t?.initialBearingDeg??0,a=Math.max(-Le,Math.min(Le,t?.initialPitchDeg??0)),s=Ln,c=!1,m=new AbortController,u=()=>m.abort();r.signal?.addEventListener("abort",u,{once:!0});let p=()=>{},d=[n.camera.position.x,n.camera.position.y,n.camera.position.z];if(!t&&n.cameraOriginWorld&&n.camera.position.set(n.cameraOriginWorld[0],n.cameraOriginWorld[1],n.cameraOriginWorld[2]),!t&&n.focalWorld){let R=n.camera.position,O=n.focalWorld[0]-R.x,j=n.focalWorld[1]-R.y,H=n.focalWorld[2]-R.z,N=Math.hypot(O,H);N>.001&&(i=Math.atan2(O,-H)*180/Math.PI,a=Math.max(-Le,Math.min(Le,Math.atan2(j,N)*180/Math.PI)))}let l=null;if(t){let R=n.gl.getParameter(n.gl.MAX_TEXTURE_SIZE),O=Rn(t,In(R)),j;try{let H=t.resolveUrl?await t.resolveUrl(O.initialUrl):O.initialUrl;if(!H)throw new Error("panorama_asset_unavailable");j=await jt(H,m.signal)}catch{return r.signal?.removeEventListener("abort",u),null}try{l=ts(n.gl,j)}catch{return m.abort(),r.signal?.removeEventListener("abort",u),null}l.mesh.renderOrder=999,l.mesh.setParent(n.scene),O.upgradeUrl&&(p=Tn(()=>{(t.resolveUrl?t.resolveUrl(O.upgradeUrl):Promise.resolve(O.upgradeUrl)).then(N=>!N||m.signal.aborted?null:jt(N,m.signal)).then(N=>{N&&(c||m.signal.aborted||(l?.setImage(N),n.requestRender()))}).catch(()=>{})}))}let f=n.camera.fov;n.camera.perspective({fov:s,aspect:n.camera.aspect});let b=n.camera.quaternion.slice(),h=()=>{let R=n.camera.position;l?.mesh.position.set(R.x,R.y,R.z);let[O,j,H]=es(i,a);n.camera.lookAt([R.x+O,R.y+j,R.z+H]),n.requestRender()};h();let y=document.createElement("div"),x=document.activeElement instanceof HTMLElement?document.activeElement:null;y.setAttribute("role","dialog"),y.setAttribute("aria-modal","true"),y.setAttribute("aria-label",r.seatLabel?`View from ${r.seatLabel}`:"View from seat"),y.tabIndex=-1,Object.assign(y.style,{position:"absolute",inset:"0",zIndex:"10",cursor:"grab",touchAction:"none"});let g=document.createElement("button");if(g.type="button",g.setAttribute("aria-label","Close"),g.textContent="\u2715",Object.assign(g.style,{position:"absolute",top:"12px",right:"12px",zIndex:"2",width:"44px",height:"44px",borderRadius:"999px",cursor:"pointer",border:"1px solid rgba(255,255,255,0.25)",background:"rgba(8,12,18,0.6)",color:"#e6edf3",fontSize:"15px",lineHeight:"1"}),y.appendChild(g),r.disclosure){let R=document.createElement("div");R.textContent=`${r.disclosurePrefix??"360\xB0 panorama"} \xB7 ${r.disclosure}`,Object.assign(R.style,{position:"absolute",top:"calc(12px + var(--sl-3d-top-inset, 0px))",left:"12px",zIndex:"2",maxWidth:"calc(100% - 88px)",padding:"8px 11px",borderRadius:"999px",overflow:"hidden",color:"#dce6f8",background:"rgba(8,12,18,0.68)",font:"600 11px/1.2 ui-sans-serif, system-ui, sans-serif",textOverflow:"ellipsis",whiteSpace:"nowrap",pointerEvents:"none",backdropFilter:"blur(6px)"}),y.appendChild(R)}let v=document.createElement("div");v.textContent=Oo(r.lookAroundHint),Object.assign(v.style,{position:"absolute",bottom:"12px",left:"0",right:"0",textAlign:"center",color:"rgba(230,237,243,0.7)",font:"12px ui-sans-serif, system-ui, sans-serif",pointerEvents:"none"}),y.appendChild(v),e.appendChild(y),g.focus({preventScroll:!0});let A=!1,P=0,M=0,E=0,D=new Map,z=()=>{let[R,O]=[...D.values()];return R&&O?Math.hypot(R.x-O.x,R.y-O.y):0},V=R=>{let O=Do(R);O!==s&&(s=O,n.camera.perspective({fov:s,aspect:n.camera.aspect}),h())},L=R=>{R.target!==g&&(D.set(R.pointerId,{x:R.clientX,y:R.clientY}),A=D.size===1,P=R.clientX,M=R.clientY,D.size===2&&(E=z()),y.setPointerCapture?.(R.pointerId),y.style.cursor="grabbing")},C=R=>{if(D.has(R.pointerId)){if(D.set(R.pointerId,{x:R.clientX,y:R.clientY}),D.size>=2){let O=z();E>0&&O>0&&V(s*(E/O)),E=O,A=!1;return}A&&(i+=(R.clientX-P)*os,a=Math.max(-Le,Math.min(Le,a+(R.clientY-M)*os)),P=R.clientX,M=R.clientY,h())}},_=R=>{D.delete(R.pointerId),E=D.size===2?z():0;let O=D.values().next().value;A=D.size===1,O?(P=O.x,M=O.y):y.style.cursor="grab";try{y.releasePointerCapture?.(R.pointerId)}catch{}},B=R=>{R.preventDefault(),V(s+R.deltaY*.04)};y.addEventListener("pointerdown",L),y.addEventListener("pointermove",C),y.addEventListener("pointerup",_),y.addEventListener("pointercancel",_),y.addEventListener("wheel",B,{passive:!1});let S=R=>{if(!c){if(R.key==="Tab"){R.preventDefault(),g.focus({preventScroll:!0});return}if(R.key==="Escape"){R.stopPropagation(),k.close();return}if(R.key==="ArrowLeft"||R.key==="ArrowRight")i+=R.key==="ArrowLeft"?-4:4;else if(R.key==="ArrowUp"||R.key==="ArrowDown")a=Math.max(-Le,Math.min(Le,a+(R.key==="ArrowUp"?4:-4)));else if(R.key==="+"||R.key==="="){V(s-5),R.preventDefault();return}else if(R.key==="-"){V(s+5),R.preventDefault();return}else return;R.preventDefault(),h()}};window.addEventListener("keydown",S);let I=0,T=(R,O)=>{if(!l){O?.();return}let j=R===1?0:1,H=performance.now(),N=()=>{if(c)return;let F=o<=0?1:Math.min(1,(performance.now()-H)/o);l?.setOpacity(j+(R-j)*F),n.requestRender(),F<1?I=requestAnimationFrame(N):O?.()};I=requestAnimationFrame(N)};T(1);let w=()=>{c||(c=!0,p(),m.abort(),r.signal?.removeEventListener("abort",u),cancelAnimationFrame(I),y.removeEventListener("pointerdown",L),y.removeEventListener("pointermove",C),y.removeEventListener("pointerup",_),y.removeEventListener("pointercancel",_),y.removeEventListener("wheel",B),window.removeEventListener("keydown",S),y.remove(),x?.isConnected&&x.focus({preventScroll:!0}),l?.dispose(),n.camera.position.set(d[0],d[1],d[2]),n.camera.perspective({fov:f,aspect:n.camera.aspect}),n.camera.quaternion.set(b[0],b[1],b[2],b[3]),n.requestRender())},k={close(){if(c)return;let R=()=>{w(),r.onClose?.()};cancelAnimationFrame(I),T(0,R)},dispose:w};return g.addEventListener("click",()=>k.close()),k}var os,is=Et(()=>{"use strict";ns();kn();kn();Fo();os=.15});var as={};Uo(as,{createOpenPanorama:()=>sd});function sd(e){let{container:t,model:n,opts:r,analytics:o,orbit:i,loop:a,seatsById:s,ensureSeatView:c,resolvedSeatViewPose:m,gpu:u,gl:p,isContextLost:d,isDisposed:l,flightGen:f,setPanorama:b,getLoadAbort:h,setLoadAbort:y,setPanoramaSphereVisible:x,setFrozen:g,raisePanoramaLayer:v,restorePanoramaLayer:A,getOverviewChip:P,labelOverlay:M,reducedMotion:E,removeArriveChip:D,showArriveChip:z}=e;return async(V,L,C)=>{h()?.abort();let _=new AbortController;y(_);let B=n.seats.idToIndex.get(V);if(B===void 0){i.syncFromCamera();return}let S=s.get(V)?.label??V,I=m(V,B),T=c(V);if(!T){_.abort(),h()===_&&y(null),i.syncFromCamera();return}g(!0),a.stop();let w;try{w=await T}catch{if(h()===_&&y(null),o.panoramaFailed(V,"source"),!l()&&C===f()){g(!1),i.resumeAfterFlight(I.focal),a.requestRender();let W=z(V,C,!0);requestAnimationFrame(()=>W?.querySelector("[data-panorama-trigger]")?.focus())}return}if(l()||C!==f()){_.abort(),h()===_&&y(null);return}D();let k=P(),R=()=>{_.abort(),h()===_&&y(null),b(null),x(!1),A(),k.style.display="",M.setVisible(!r.arriveAtSeatEye),g(!1),o.panoramaClosed(),i.resumeAfterFlight(I.focal),a.requestRender();let W=z(V,f());requestAnimationFrame(()=>W?.querySelector("[data-panorama-trigger]")?.focus())},O=w.generated===!0,j=Za(w);v(),x(!O),k.style.display="none";let H=E()?0:L,N=u(),F=N&&!d()?await rs(t,O?null:w,{gl:p,scene:N.main,camera:i.camera,requestRender:()=>a.requestRender(),cameraOriginWorld:O?I.eye:void 0,focalWorld:I.focal},{fadeMs:H,seatLabel:S,disclosure:j,disclosurePrefix:O?"Live seat-eye view":"360\xB0 panorama",lookAroundHint:r.lookAroundHint,onClose:R,signal:_.signal}):null;if(l()||C!==f()){_.abort(),x(!1),h()===_&&y(null),F?.dispose(),k.style.display="",A();return}if(F)i.syncFromCamera(),M.setVisible(!1),g(!1),a.requestRender(),b(F);else if(O){A(),k.style.display="",g(!1),i.resumeAfterFlight(I.focal),a.requestRender(),b(null),x(!1),o.panoramaFailed(V,"mount");let W=z(V,f(),!0);requestAnimationFrame(()=>W?.querySelector("[data-panorama-trigger]")?.focus()),h()===_&&y(null);return}else x(!1),o.panoramaFallback(V),b(Ja(t,w,{fadeMs:H,seatLabel:S,disclosure:j,onClose:R,signal:_.signal,lookAroundHint:r.lookAroundHint}));o.panoramaOpened()}}var ss=Et(()=>{"use strict";kn();is()});var yd={};Uo(yd,{VENUE3D_QUALITY_REPORT_VERSION:()=>ra,buildSceneModel:()=>St,inspectVenue3DQualityEvidence:()=>Sn,mountVenue3D:()=>bd,prepareVenue3D:()=>vs,prepareVenue3DFromChart:()=>Ss});module.exports=Ds(yd);var Wo=require("ogl");var Os=/^#?([\da-f]{3}|[\da-f]{6})$/i;function Vs(e){let t=Os.exec((e??"").trim());if(!t)return null;let n=t[1].length===3?t[1].split("").map(o=>o+o).join(""):t[1],r=parseInt(n,16);return[r>>16&255,r>>8&255,r&255]}function ne(e){let t=Vs(e);return t?[t[0]/255,t[1]/255,t[2]/255]:null}function zn(e){let t=e/255;return t<=.04045?t/12.92:((t+.055)/1.055)**2.4}function Bs(e){return .2126*zn(e[0])+.7152*zn(e[1])+.0722*zn(e[2])}function jo(e){return Bs([e[0]*255,e[1]*255,e[2]*255])}function Ns(e){return .2126*e[0]+.7152*e[1]+.0722*e[2]}function ge(e,t,n){return[e[0]+(t[0]-e[0])*n,e[1]+(t[1]-e[1])*n,e[2]+(t[2]-e[2])*n]}function It(e,t){let n=Ns(e);return ge(e,[n,n,n],t)}var pe=["available","held","sold","selected","dimmed"];function Rt(e){let t=pe.indexOf(e);return t<0?0:t}var Yo={available:[.24,.82,.52],held:[.95,.66,.22],sold:[.34,.39,.45],selected:[.24,.74,1],dimmed:[.28,.32,.37]};function Xo(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 Un={ground:[.07,.085,.11],tierTop:[.24,.28,.34],tierWall:[.17,.2,.25],stageTop:[.94,.7,.38],stageWall:[.48,.33,.18],decorTop:[.22,.25,.29],decorWall:[.15,.17,.2],gaTop:[.24,.28,.33],gaWall:[.16,.19,.23],boothTop:[.3,.33,.38],boothWall:[.2,.23,.27],tableTop:[.38,.34,.29],tableWall:[.24,.21,.18]},Je={top:[.05,.06,.08],bottom:[.1,.12,.15]};function Pe(e,t){return[Math.min(1,e[0]*t),Math.min(1,e[1]*t),Math.min(1,e[2]*t)]}function Gs(){let e=typeof window<"u"&&window.devicePixelRatio||1,t=navigator.deviceMemory,n=typeof t=="number"&&t<=4?1.5:2;return Math.min(e,n)}var $t=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 Wo.Renderer({canvas:this.canvas,dpr:Gs(),alpha:!1,antialias:!1,depth:!0,stencil:!1,powerPreference:"high-performance",webgl:2}),this.gl=this.renderer.gl,this.clearRgb=[Je.top[0],Je.top[1],Je.top[2]],this.gl.clearColor(this.clearRgb[0],this.clearRgb[1],this.clearRgb[2],1),t.appendChild(this.canvas),this.lostHandler=r=>{r.preventDefault(),n.onContextLost()},this.restoredHandler=()=>n.onContextRestored(),this.canvas.addEventListener("webglcontextlost",this.lostHandler,!1),this.canvas.addEventListener("webglcontextrestored",this.restoredHandler,!1),this.resize()}setClearColor(t){this.clearRgb=[t[0],t[1],t[2]],this.gl.clearColor(t[0],t[1],t[2],1)}get clearColor(){return this.clearRgb}resize(){let t=Math.max(1,this.container.clientWidth||this.canvas.clientWidth||1),n=Math.max(1,this.container.clientHeight||this.canvas.clientHeight||1);return this.renderer.setSize(t,n),{width:t,height:n}}get pixelHeight(){return this.renderer.height*this.renderer.dpr}get aspect(){return this.renderer.width/Math.max(1,this.renderer.height)}dispose(){this.canvas.removeEventListener("webglcontextlost",this.lostHandler,!1),this.canvas.removeEventListener("webglcontextrestored",this.restoredHandler,!1);let t=this.gl.getExtension("WEBGL_lose_context");t&&t.loseContext(),this.canvas.parentNode&&this.canvas.parentNode.removeChild(this.canvas)}simulateContextLossCycle(){let t=this.gl.getExtension("WEBGL_lose_context");t&&(t.loseContext(),setTimeout(()=>{t.restoreContext&&t.restoreContext()},300))}};var ft=require("ogl"),he=Math.PI/180,Hn=15*he,jn=80*he,dt=.12,Ko=35,qo=1.25,$o=.006,zs=4,pt=.82,Tt=1/pt,Us=.12,Hs=2;function js(e,t){return{azimuth:e*$o,polar:-t*$o}}function Ys(e,t,n){let r=Math.max(Hs,Math.max(1,t)*Us),o=n*zs;return{minDist:e?Math.min(e.minDist,r):r,maxDist:e?Math.max(e.maxDist,o):o}}var Qt=class{constructor(t,n,r,o){this.fovY=Ko;this.target=new ft.Vec3;this.azimuth=-30*he;this.polar=55*he;this.distance=10;this.azT=-30*he;this.polT=55*he;this.distT=10;this.minDist=1;this.maxDist=100;this.envelope=null;this.gestureFired=!1;this.interactionEnabled=!0;this.dragging=!1;this.panning=!1;this.lastX=0;this.lastY=0;this.activePointers=new Map;this.pinchDist=0;this.pinchCx=0;this.pinchCy=0;this.targetT=new ft.Vec3;this.panAnchor=new ft.Vec3;this.panLimit=0;this.primaryDragMode="orbit";this.camera=new ft.Camera(t,{fov:Ko,near:.1,far:5e3,aspect:1}),this.canvas=n,this.requestRender=r,this.onGesture=o,this.onPointerDown=i=>{if(this.interactionEnabled){try{this.canvas.setPointerCapture?.(i.pointerId)}catch{}if(this.activePointers.set(i.pointerId,{x:i.clientX,y:i.clientY}),this.activePointers.size===1){let a=i.button===2||i.button===1,s=i.button===0&&(i.shiftKey?this.primaryDragMode==="orbit":this.primaryDragMode==="pan");this.panning=a||s,this.dragging=!this.panning,this.lastX=i.clientX,this.lastY=i.clientY}else if(this.activePointers.size===2){this.dragging=!1,this.panning=!1,this.pinchDist=this.currentPinchDistance();let a=this.pinchCentroid();this.pinchCx=a.x,this.pinchCy=a.y}}},this.onPointerMove=i=>{if(!this.interactionEnabled||!this.activePointers.has(i.pointerId))return;if(this.activePointers.set(i.pointerId,{x:i.clientX,y:i.clientY}),this.activePointers.size>=2){let m=this.currentPinchDistance();this.pinchDist>0&&(this.dollyBy(Math.exp((this.pinchDist-m)*.005)),this.fireGesture()),this.pinchDist=m;let u=this.pinchCentroid();this.panBy(u.x-this.pinchCx,u.y-this.pinchCy),this.pinchCx=u.x,this.pinchCy=u.y;return}let a=i.clientX-this.lastX,s=i.clientY-this.lastY;if(this.panning){this.lastX=i.clientX,this.lastY=i.clientY,(a!==0||s!==0)&&(this.panBy(a,s),this.fireGesture());return}if(!this.dragging)return;this.lastX=i.clientX,this.lastY=i.clientY,(a!==0||s!==0)&&this.fireGesture();let c=js(a,s);this.azT+=c.azimuth,this.polT=Math.max(Hn,Math.min(jn,this.polT+c.polar)),this.requestRender()},this.onPointerUp=i=>{this.activePointers.delete(i.pointerId);try{this.canvas.releasePointerCapture?.(i.pointerId)}catch{}this.activePointers.size<2&&(this.pinchDist=0),this.activePointers.size===0&&(this.dragging=!1,this.panning=!1)},this.onContextMenu=i=>{i.preventDefault()},this.onWheel=i=>{if(i.preventDefault(),!this.interactionEnabled)return;let a=i.deltaMode===1?16:i.deltaMode===2?100:1,s=Math.max(-2,Math.min(2,i.deltaY*a/100));this.dollyBy(Math.exp(s*.22)),this.fireGesture()},this.onKeyDown=i=>{if(!this.interactionEnabled)return;let a=7*he;if(i.shiftKey&&(i.key==="ArrowLeft"||i.key==="ArrowRight"||i.key==="ArrowUp"||i.key==="ArrowDown"))this.panBy(i.key==="ArrowLeft"?-32:i.key==="ArrowRight"?32:0,i.key==="ArrowUp"?-32:i.key==="ArrowDown"?32:0);else if(i.key==="ArrowLeft"||i.key==="ArrowRight")this.azT+=i.key==="ArrowLeft"?-a:a;else if(i.key==="ArrowUp"||i.key==="ArrowDown")this.polT=Math.max(Hn,Math.min(jn,this.polT+(i.key==="ArrowUp"?-a:a)));else if(i.key==="+"||i.key==="=")this.dollyBy(pt);else if(i.key==="-"||i.key==="_")this.dollyBy(Tt);else return;i.preventDefault(),this.fireGesture(),this.requestRender()},n.addEventListener("pointerdown",this.onPointerDown),n.addEventListener("pointermove",this.onPointerMove),n.addEventListener("pointerup",this.onPointerUp),n.addEventListener("pointercancel",this.onPointerUp),n.addEventListener("wheel",this.onWheel,{passive:!1}),n.addEventListener("keydown",this.onKeyDown),n.addEventListener("contextmenu",this.onContextMenu)}pinchCentroid(){let t=[...this.activePointers.values()];if(!t.length)return{x:0,y:0};let n=0,r=0;for(let o of t)n+=o.x,r+=o.y;return{x:n/t.length,y:r/t.length}}panBy(t,n){let r=this.canvas.clientHeight||1,o=2*this.distance*Math.tan(this.fovY*he/2)/r,i=Math.sin(this.azimuth),a=Math.cos(this.azimuth),s=a,c=-i,m=Math.cos(this.polar),u=Math.sin(this.polar),p=-i*m,d=-a*m;this.targetT.x+=(-t*s+n*p)*o,this.targetT.z+=(-t*c+n*d)*o,this.targetT.y+=n*u*o,this.clampPan(),this.requestRender()}clampPan(){if(this.panLimit<=0)return;let t=this.panLimit,n=this.panAnchor.x,r=this.panAnchor.y,o=this.panAnchor.z;this.targetT.x=Math.max(n-t,Math.min(n+t,this.targetT.x)),this.targetT.z=Math.max(o-t,Math.min(o+t,this.targetT.z)),this.targetT.y=Math.max(r-t*.5,Math.min(r+t,this.targetT.y))}fireGesture(){this.gestureFired||(this.gestureFired=!0,this.onGesture?.())}currentPinchDistance(){let t=[...this.activePointers.values()];return t.length<2?0:Math.hypot(t[0].x-t[1].x,t[0].y-t[1].y)}dollyBy(t){this.distT=Math.max(this.minDist,Math.min(this.maxDist,this.distT*t)),this.requestRender()}zoomBy(t){this.interactionEnabled&&(this.dollyBy(t),this.fireGesture())}dollyLimitState(){return{atMin:this.distT<=this.minDist+1e-6,atMax:this.distT>=this.maxDist-1e-6}}setPrimaryDragMode(t){this.primaryDragMode=t}setInteractionEnabled(t){this.interactionEnabled=t,!t&&(this.activePointers.clear(),this.dragging=!1,this.panning=!1,this.pinchDist=0)}frame(t,n=!1,r,o=!1,i){this.target.set(t.center[0],t.center[1],t.center[2]),this.targetT.copy(this.target),this.panAnchor.copy(this.target),this.panLimit=Math.max(1,t.radius)*1.5;let a=Math.max(1,t.radius),s=this.fovY*he/2,c=o?Math.max(.82,this.camera.aspect||1):this.camera.aspect||1,m=Math.atan(Math.tan(s)*c);this.azT=r??-30*he,this.polT=Math.max(15,Math.min(80,i?.polarDeg??55))*he;let u=this.fitDistance(t,s,m,this.azT,this.polT);this.distT=u*Math.max(1.05,Math.min(2,i?.margin??qo)),this.envelope=Ys(this.envelope,a,u),this.minDist=this.envelope.minDist,this.maxDist=this.envelope.maxDist,n?(this.azimuth=this.azT,this.polar=12*he,this.distance=this.distT*1.7):(this.azimuth=this.azT,this.polar=this.polT,this.distance=this.distT),this.applyPosition()}setAspect(t){this.camera.perspective({aspect:t})}frameSoft(t,n,r=!1,o){this.target.set(t.center[0],t.center[1],t.center[2]),this.targetT.copy(this.target),this.panAnchor.copy(this.target),this.panLimit=Math.max(1,t.radius)*1.5,this.syncFromCamera(),this.camera.perspective({fov:this.fovY,aspect:this.camera.aspect});let i=this.fovY*he/2,a=r?Math.max(.82,this.camera.aspect||1):this.camera.aspect||1,s=Math.atan(Math.tan(i)*a);this.azT=n??this.azimuth,this.polT=Math.max(15,Math.min(80,o?.polarDeg??55))*he;let c=this.fitDistance(t,i,s,this.azT,this.polT);this.distT=c*Math.max(1.05,Math.min(2,o?.margin??qo))}fitDistance(t,n,r,o,i){let a=Math.max(1,t.radius),s=Math.max(a/Math.tan(n),a/Math.tan(r)),c=t.box;if(!c)return s;let m=Math.sin(i),u=-m*Math.sin(o),p=-Math.cos(i),d=-m*Math.cos(o);if(Math.abs(p)>.999)return s;let l=-d,f=u,b=Math.hypot(l,f);l/=b,f/=b;let h=-f*p,y=f*u-l*d,x=l*p,g=Math.tan(r),v=Math.tan(n),A=1;for(let P=0;P<8;P++){let M=(P&1?c.max[0]:c.min[0])-t.center[0],E=(P&2?c.max[1]:c.min[1])-t.center[1],D=(P&4?c.max[2]:c.min[2])-t.center[2],z=M*u+E*p+D*d,V=Math.abs(M*l+D*f),L=Math.abs(M*h+E*y+D*x);A=Math.max(A,V/g-z,L/v-z)}return Math.min(s,Math.max(A,a*.35))}updateClipping(t){let n=this.camera.position.x-t.center[0],r=this.camera.position.y-t.center[1],o=this.camera.position.z-t.center[2],i=Math.hypot(n,r,o),a=Math.max(1,t.radius)*1.18,s=Math.max(.05,i-a),c=Math.max(s+10,i+a);this.camera.perspective({near:s,far:c,aspect:this.camera.aspect})}update(){let t=this.azT-this.azimuth,n=this.polT-this.polar,r=this.distT-this.distance,o=this.targetT.x-this.target.x,i=this.targetT.y-this.target.y,a=this.targetT.z-this.target.z,s=Math.max(1e-4,this.distance*1e-4),c=Math.abs(t)>1e-4||Math.abs(n)>1e-4||Math.abs(r)>1e-4||Math.abs(o)>s||Math.abs(i)>s||Math.abs(a)>s;return this.azimuth+=t*dt,this.polar+=n*dt,this.distance+=r*dt,this.target.x+=o*dt,this.target.y+=i*dt,this.target.z+=a*dt,c&&this.applyPosition(),c}get currentDistance(){return this.distance}syncFromCamera(){let t=this.camera.position.x-this.target.x,n=this.camera.position.y-this.target.y,r=this.camera.position.z-this.target.z,o=Math.hypot(t,n,r)||1,i=Math.max(Hn,Math.min(jn,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 Zt=class{constructor(t){this.rafId=0;this.running=!1;this.lastTime=0;this.fpsEma=0;this.rendered=0;this.tick=t=>{let n=this.lastTime?(t-this.lastTime)/1e3:.016666666666666666;if(this.lastTime=t,n>0){let o=1/n;this.fpsEma=this.fpsEma?this.fpsEma*.9+o*.1:o}this.rendered++,this.frame(n)?this.rafId=requestAnimationFrame(this.tick):(this.running=!1,this.rafId=0)};this.frame=t}requestRender(){this.running||(this.running=!0,this.lastTime=0,this.rafId=requestAnimationFrame(this.tick))}stats(){return{fps:this.running?Math.round(this.fpsEma):0,rendered:this.rendered,idle:!this.running}}stop(){this.rafId&&cancelAnimationFrame(this.rafId),this.rafId=0,this.running=!1}};function Qo(e,t,n){return Math.max(t,Math.min(n,e))}var ht=2.5,Xs=1.15,_t=6,bt=10,Zo=6,Jo=9.5,er=.9,tr=2.2,Yn=30,Xn=4,Jt=8192;var Ed=bt+Xn;function nr(e,t){let n=t*1.4,r=t*3.2;if(e<=n)return{scale:1,fade:0,minPixels:ht};let o=Math.min(1,(e-n)/Math.max(.001,r-n));return{scale:1-o*.4,fade:o*.55,minPixels:ht+o*(Xs-ht)}}function or(e,t,n){return!(e>0)||!(t>0)||!(n>0)?!1:t*n/e>=64}function rr(e,t,n,r,o){if(!(e>0)||!(t>0)||!(n>0)||!(r>0)||!(o>0))return!1;let i=Math.tan(r/2*Math.PI/180);if(!(i>0))return!1;let a=t/(n*i)*(o/2);return Math.PI*a*a/e>=64}var Ws=[{key:"wheelchair",label:"Wheelchair space",short:"Wheelchair",icon:"\u267F"},{key:"companion",label:"Companion seat",short:"Companion",icon:"\u{1F9D1}\u200D\u{1F91D}\u200D\u{1F9D1}"},{key:"semi-ambulatory",label:"Semi-ambulatory (limited mobility)",short:"Limited mobility",icon:"\u{1F9AF}"},{key:"designated-aisle",label:"Designated aisle / transfer seat",short:"Aisle transfer",icon:"AS"},{key:"step-free",label:"Step-free accessible seat",short:"Step-free",icon:"SF"},{key:"hearing",label:"Assistive listening",short:"Hearing",icon:"\u{1F9BB}"},{key:"cart",label:"CART live-caption view",short:"CART captions",icon:"CC"},{key:"sign-language",label:"Sign-language view",short:"Sign language",icon:"\u{1F91F}"},{key:"low-vision",label:"Blind / low-vision viewing",short:"Low vision",icon:"LV"},{key:"sensory-friendly",label:"Quiet / sensory-friendly seating",short:"Sensory-friendly",icon:"QS"},{key:"plus-size",label:"Plus-size seat",short:"Plus-size",icon:"\u{1F4BA}"},{key:"lift-armrest",label:"Lift-up armrest",short:"Lift armrest",icon:"\u2195\uFE0F"}],Rd=new Map(Ws.map(e=>[e.key,e]));var Ks={wheelchair:"#3b82f6",companion:"#8b5cf6","semi-ambulatory":"#0ea5e9","designated-aisle":"#0284c7","step-free":"#16a34a",hearing:"#14b8a6",cart:"#7c3aed","sign-language":"#f59e0b","low-vision":"#d97706","sensory-friendly":"#6366f1","plus-size":"#ec4899","lift-armrest":"#22c55e"};function ir(e){let t=e?.[0];return t&&Ks[t]||"#3b82f6"}var qs=[{key:"obstructedView",label:"Obstructed view",short:"Obstructed",icon:"\u26D4"},{key:"restrictedView",label:"Restricted view",short:"Restricted",icon:"\u{1F441}"},{key:"premium",label:"Premium seat",short:"Premium",icon:"\u2605"}],Td=new Map(qs.map(e=>[e.key,e]));var $s=["reference-focal","bar","entrance","exit","restroom","screen","sound","concession","coat","wall","rail","suite","obstruction"],_d=new Set($s);var sr=[{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}}],cr=sr.map(e=>e.key),Qs=new Map(sr.map(e=>[e.key,e]));function ar(e){return typeof e=="string"&&Qs.has(e)}function lr(e,t){return ar(e)?e:ar(t?.seatGlyph)?t.seatGlyph:"circle"}var be=.02291666666666667,He=1/be,Zs=58,Js=Zs*be;var ec=3,ur=0,Wn=120,tc=0,nc=45,oc=7,Re=1.2;function Kn(e,t,n,r){return Number.isFinite(e)?Math.max(t,Math.min(n,e)):r}function rc(e){return!Number.isFinite(e)||!Number.isInteger(e)||e<0?0:e<=oc?e:ec}function en(e,t={}){let n=Kn(t.floorBaseHeightM,ur,Wn,0),r=Math.min(Wn,n+rc(e.elevation)*Js),o=e.height===void 0?r:Kn(e.height,ur,Wn,r),i=Kn(e.rake,tc,nc,0);return{height:o,rake:i}}var dr=mt(require("earcut"),1),fr=mt(require("polygon-clipping"),1);var Vd=Math.PI/180;function qn(e){let t=0,n=0;for(let o of e)t+=o.x,n+=o.y;let r=e.length||1;return{x:t/r,y:n/r}}function Lt(e){return e.length?qn(e):null}function et(e){let t=0;for(let n=0,r=e.length;n<r;n+=1){let o=e[n],i=e[(n+1)%r];t+=o.x*i.y-i.x*o.y}return t/2}function kt(e,t,n){let r=!1;for(let o=0,i=e.length-1;o<e.length;i=o++){let a=e[o],s=e[i];a.y>n!=s.y>n&&t<(s.x-a.x)*(n-a.y)/(s.y-a.y)+a.x&&(r=!r)}return r}var G=be,ic=.002;function ac(e,t,n){let r=Math.hypot(t[0]-e[0],t[1]-e[1],t[2]-e[2]),o=Math.hypot(n[0]-t[0],n[1]-t[1],n[2]-t[2]),i=Math.hypot(e[0]-n[0],e[1]-n[1],e[2]-n[2]),a=Math.max(r,o,i);if(a<1e-9)return!0;let s=(r+o+i)/2;return 2*Math.sqrt(Math.max(0,s*(s-r)*(s-o)*(s-i)))/a<ic}var tt=class{constructor(t=16384){this.len=0;this.buf=new Float32Array(t)}push3(t,n,r){this.len+3>this.buf.length&&this.grow(this.len+3),this.buf[this.len++]=t,this.buf[this.len++]=n,this.buf[this.len++]=r}push1(t){this.len+1>this.buf.length&&this.grow(this.len+1),this.buf[this.len++]=t}grow(t){let n=this.buf.length*2;for(;n<t;)n*=2;let r=new Float32Array(n);r.set(this.buf.subarray(0,this.len)),this.buf=r}get length(){return this.len}toArray(){return this.buf.slice(0,this.len)}},on=class{constructor(){this.pos=new tt;this.nor=new tt;this.col=new tt;this.flr=new tt;this.mat=new tt;this.currentFloor=0;this.currentMaterial=0}setFloor(t){this.currentFloor=t}setMaterial(t){this.currentMaterial=t}tri(t,n,r,o,i,a=i,s=i){ac(t,n,r)||(this.pos.push3(t[0],t[1],t[2]),this.pos.push3(n[0],n[1],n[2]),this.pos.push3(r[0],r[1],r[2]),this.nor.push3(o[0],o[1],o[2]),this.nor.push3(o[0],o[1],o[2]),this.nor.push3(o[0],o[1],o[2]),this.col.push3(i[0],i[1],i[2]),this.col.push3(a[0],a[1],a[2]),this.col.push3(s[0],s[1],s[2]),this.flr.push1(this.currentFloor),this.flr.push1(this.currentFloor),this.flr.push1(this.currentFloor),this.mat.push1(this.currentMaterial),this.mat.push1(this.currentMaterial),this.mat.push1(this.currentMaterial))}triN(t,n,r,o,i,a,s,c=s,m=s){[...t,...n,...r].every(Number.isFinite)&&(this.pos.push3(t[0],t[1],t[2]),this.pos.push3(n[0],n[1],n[2]),this.pos.push3(r[0],r[1],r[2]),this.nor.push3(o[0],o[1],o[2]),this.nor.push3(i[0],i[1],i[2]),this.nor.push3(a[0],a[1],a[2]),this.col.push3(s[0],s[1],s[2]),this.col.push3(c[0],c[1],c[2]),this.col.push3(m[0],m[1],m[2]),this.flr.push1(this.currentFloor),this.flr.push1(this.currentFloor),this.flr.push1(this.currentFloor),this.mat.push1(this.currentMaterial),this.mat.push1(this.currentMaterial),this.mat.push1(this.currentMaterial))}get vertexCount(){return this.pos.length/3}build(){return{position:this.pos.toArray(),normal:this.nor.toArray(),color:this.col.toArray(),floor:this.flr.toArray(),material:this.mat.toArray(),count:this.pos.length/3}}};function sc(e,t,n){let r=t[0]-e[0],o=t[1]-e[1],i=t[2]-e[2],a=n[0]-e[0],s=n[1]-e[1],c=n[2]-e[2],m=o*c-i*s,u=i*a-r*c,p=r*s-o*a,d=Math.hypot(m,u,p)||1;return m/=d,u/=d,p/=d,[m,u,p]}function cc(e,t){let n=[...e],r=[];for(let a of e)r.push(a.x,a.y);let o=[];if(t){for(let a of t)if(!(a.length<3)){o.push(n.length);for(let s of a)n.push(s),r.push(s.x,s.y)}}let i=(0,dr.default)(r,o.length?o:void 0,2);return{pts:n,tris:i}}function $n(e){return et(e)<0?[...e].reverse():e}var lc=3;function uc(e,t,n,r){let o=r(e),i=r(t),a=r(n),s=(l,f,b,h)=>Math.abs(r({x:(l.x+f.x)/2,y:(l.y+f.y)/2})-(b+h)/2),c=(e.x+t.x+n.x)/3,m=(e.y+t.y+n.y)/3,u=(o+i+a)/3,p=Math.max(s(e,t,o,i),s(t,n,i,a),s(n,e,a,o),Math.abs(r({x:c,y:m})-u)),d=(l,f,b)=>{let h=Math.abs(r({x:(l+c)/2,y:(f+m)/2})-(b+u)/2);h>p&&(p=h)};return d((e.x+t.x)/2,(e.y+t.y)/2,(o+i)/2),d((t.x+n.x)/2,(t.y+n.y)/2,(i+a)/2),d((n.x+e.x)/2,(n.y+e.y)/2,(a+o)/2),p}function Ft(e,t,n,r,o){if(o<=0)return uc(e,t,n,r);let i={x:(e.x+t.x)/2,y:(e.y+t.y)/2},a={x:(t.x+n.x)/2,y:(t.y+n.y)/2},s={x:(n.x+e.x)/2,y:(n.y+e.y)/2};return Math.max(Ft(e,i,s,r,o-1),Ft(i,t,a,r,o-1),Ft(s,a,n,r,o-1),Ft(i,a,s,r,o-1))}function Dt(e,t,n,r,o,i,a,s){if(a>0){let d={x:(t.x+n.x)/2,y:(t.y+n.y)/2},l={x:(n.x+r.x)/2,y:(n.y+r.y)/2},f={x:(r.x+t.x)/2,y:(r.y+t.y)/2};Dt(e,t,d,f,o,i,a-1,s),Dt(e,d,n,l,o,i,a-1,s),Dt(e,f,l,r,o,i,a-1,s),Dt(e,d,l,f,o,i,a-1,s);return}let c=[t.x*G,o(t),t.y*G],m=[n.x*G,o(n),n.y*G],u=[r.x*G,o(r),r.y*G];if(s){e.triN(c,m,u,s(t),s(n),s(r),i);return}let p=sc(c,m,u);p[1]<0&&(p=[-p[0],-p[1],-p[2]]),e.tri(c,m,u,p,i)}var mc=8;function mr(e,t,n){if(!Number.isFinite(n))return e;let r=[],o=(i,a,s,c,m)=>{if(m>0){let u={x:(i.x+a.x)/2,y:(i.y+a.y)/2},p=t(u);if(Math.abs(p-(s+c)/2)>n){o(i,u,s,p,m-1),o(u,a,p,c,m-1);return}}r.push(i)};for(let i=0;i<e.length;i++){let a=e[i],s=e[(i+1)%e.length];o(a,s,t(a),t(s),mc)}return r}function tn(e,t){if(e.length<3)return e;let n=[];for(let o of e){let i=n[n.length-1];i&&Math.hypot(o.x-i.x,o.y-i.y)<t||n.push(o)}for(;n.length>2&&Math.hypot(n[0].x-n[n.length-1].x,n[0].y-n[n.length-1].y)<t;)n.pop();if(n.length<3)return e;let r=[];for(let o=0;o<n.length;o++){let i=r.length?r[r.length-1]:n[(o-1+n.length)%n.length],a=n[o],s=n[(o+1)%n.length],c=s.x-i.x,m=s.y-i.y,u=Math.hypot(c,m);u>t&&Math.abs((a.x-i.x)*m-(a.y-i.y)*c)/u<t||r.push(a)}return r.length>=3?r:n}var nn=.001*He*.1;function ue(e,t,n,r,o,i,a,s,c=1/0,m){if(!t||t.length<3||(c===void 0&&(c=1/0),Math.abs(et(t))<1e-4))return;let u=tn(mr(tn($n(t),nn),r,c),nn),p=n?.map(P=>tn(mr(tn($n(P),nn),r,c),nn)).filter(P=>P.length>=3&&Math.abs(et(P))>=1e-4),{pts:d,tris:l}=cc(u,p),f=[i[0]*s.top,i[1]*s.top,i[2]*s.top],b=[i[0]*s.bottomCap,i[1]*s.bottomCap,i[2]*s.bottomCap],h=[a[0]*s.top,a[1]*s.top,a[2]*s.top],y=[a[0]*s.wallBottom,a[1]*s.wallBottom,a[2]*s.wallBottom],x=0;if(Number.isFinite(c))for(;x<lc;x++){let P=0;for(let M=0;M<l.length;M+=3){let E=Ft(d[l[M]],d[l[M+1]],d[l[M+2]],r,x);E>P&&(P=E)}if(P<=c)break}for(let P=0;P<l.length;P+=3){let M=d[l[P]],E=d[l[P+1]],D=d[l[P+2]];Dt(e,M,E,D,r,f,x,m);let z=[M.x*G,o,M.y*G],V=[E.x*G,o,E.y*G],L=[D.x*G,o,D.y*G];e.tri(z,L,V,[0,-1,0],b)}let g=P=>{if(x<=0)return P;let M=1<<x,E=[];for(let D=0;D<P.length;D++){let z=P[D],V=P[(D+1)%P.length];for(let L=0;L<M;L++){let C=L/M;E.push({x:z.x+(V.x-z.x)*C,y:z.y+(V.y-z.y)*C})}}return E},v=qn(u),A=[{ring:g(u),flip:!1}];if(p)for(let P of p)P.length>=3&&A.push({ring:g(P),flip:!0});for(let{ring:P,flip:M}of A)for(let E=0;E<P.length;E++){let D=P[E],z=P[(E+1)%P.length],V=(z.x-D.x)*G,C=(z.y-D.y)*G,_=-V,B=Math.hypot(C,_)||1;C/=B,_/=B;let S=(D.x+z.x)/2-v.x,I=(D.y+z.y)/2-v.y,T=C*S+_*I;M&&(T=-T),T<0&&(C=-C,_=-_);let w=[C,0,_],k=[D.x*G,r(D),D.y*G],R=[z.x*G,r(z),z.y*G],O=[D.x*G,o,D.y*G],j=[z.x*G,o,z.y*G];e.tri(k,R,j,w,h,h,y),e.tri(k,j,O,w,h,y,y)}}function pr(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 rn(e,t,n=2.5){if(t<=0||e.length<3)return e;let r=$n(e),o=r.length,i=[];for(let s=0;s<o;s++){let c=r[s],m=r[(s+1)%o],u=m.x-c.x,p=m.y-c.y,d=Math.hypot(u,p)||1;i.push({x:p/d,y:-u/d})}let a=[];for(let s=0;s<o;s++){let c=r[s],m=i[(s-1+o)%o],u=i[s],p=m.x+u.x,d=m.y+u.y,l=Math.hypot(p,d),f=()=>{a.push([c.x+m.x*t,c.y+m.y*t]),a.push([c.x+u.x*t,c.y+u.y*t])};if(l<1e-9){f();continue}p/=l,d/=l;let b=p*m.x+d*m.y,h=1/Math.max(b,1e-6);if(!Number.isFinite(h)||h>n){f();continue}a.push([c.x+p*t*h,c.y+d*t*h])}if(a.length<3)return e;try{let s=fr.default.union([[...a,a[0]]]),c=null,m=-1/0;for(let p of s){let d=Math.abs(et(p[0].map(([l,f])=>({x:l,y:f}))));d>m&&(m=d,c=p[0])}if(!c)return e;let u=c.map(([p,d])=>({x:p,y:d}));if(u.length>1){let p=u[0],d=u[u.length-1];Math.abs(p.x-d.x)<1e-9&&Math.abs(p.y-d.y)<1e-9&&u.pop()}return u.length>=3?u:e}catch{return e}}function an(e,t,n,r,o=28){let i=[];for(let a=0;a<o;a++){let s=a/o*Math.PI*2;i.push({x:e+n*Math.cos(s),y:t+r*Math.sin(s)})}return i}function Ot(e,t,n,r){return[{x:e,y:t},{x:e+n,y:t},{x:e+n,y:t+r},{x:e,y:t+r}]}var ae={pedestal:0,pad:1,back:2,arm:3,footrest:4,leg:5,body:10,head:11},dc=.44,fc=.15,hr=.3,pc=.24;function br(e){return e===void 0||!Number.isFinite(e)||e<=0?pc:Math.min(hr,Math.max(fc,e*dc))}var Qn=.21,hc=.05,Zn=.45,sn=Zn+hc,yr=.92,Jn=1.205,gr=-.23,xr=.38,bc=[{part:ae.pedestal,min:[-.3,0,-.3],max:[.3,.36,.3]},{part:ae.pad,min:[-1,.36,-.95],max:[1,Zn,1]},{part:ae.back,min:[-1,sn,-1],max:[1,yr,-.72]},{part:ae.arm,min:[-1,.44,-.82],max:[-.78,.65,.78]},{part:ae.arm,min:[.78,.44,-.82],max:[1,.65,.78]},{part:ae.footrest,min:[-.9,.18,.78],max:[.9,.31,1.34]},{part:ae.leg,min:[-.82,0,-.7],max:[-.62,.37,-.48]},{part:ae.leg,min:[.62,0,-.7],max:[.82,.37,-.48]},{part:ae.leg,min:[-.82,0,.48],max:[-.62,.37,.7]},{part:ae.leg,min:[.62,0,.48],max:[.82,.37,.7]}],yc=[{part:ae.body,min:[-.52,.39,-.08],max:[-.08,.55,.82]},{part:ae.body,min:[.08,.39,-.08],max:[.52,.55,.82]},{part:ae.body,min:[-.47,.05,.58],max:[-.13,.43,.82]},{part:ae.body,min:[.13,.05,.58],max:[.47,.43,.82]},{part:ae.head,min:[-.16,1.04,-.33],max:[.16,1.1,-.13]}],gc=[{n:[1,0,0],c:[[1,0,0],[1,1,0],[1,1,1],[1,0,1]]},{n:[-1,0,0],c:[[0,0,1],[0,1,1],[0,1,0],[0,0,0]]},{n:[0,1,0],c:[[0,1,0],[0,1,1],[1,1,1],[1,1,0]]},{n:[0,-1,0],c:[[0,0,1],[0,0,0],[1,0,0],[1,0,1]]},{n:[0,0,1],c:[[0,0,1],[1,0,1],[1,1,1],[0,1,1]]},{n:[0,0,-1],c:[[1,0,0],[0,0,0],[0,1,0],[1,1,0]]}];function vr(){let e=[],t=[],n=[],r=[],o=(B,S,I)=>{let T=n.length,[w,k,R]=B,O=[k[0]-w[0],k[1]-w[1],k[2]-w[2]],j=[R[0]-w[0],R[1]-w[1],R[2]-w[2]],H=O[1]*j[2]-O[2]*j[1],N=O[2]*j[0]-O[0]*j[2],F=O[0]*j[1]-O[1]*j[0],W=Math.hypot(H,N,F);W>1e-9?(H/=W,N/=W,F/=W):[H,N,F]=S,H*S[0]+N*S[1]+F*S[2]<0&&(H=-H,N=-N,F=-F);for(let X of B)e.push(...X),t.push(H,N,F),n.push(I);r.push(T,T+1,T+2,T,T+2,T+3)},i=B=>{for(let S of gc){let I=S.c.map(T=>T.map((w,k)=>w?B.max[k]:B.min[k]));o(I,S.n,B.part)}};for(let B of bc)i(B);for(let B of yc)i(B);let a=Zn,s=1.08,c=.47,m=.69,u=-.55,p=.08,d=-.48,l=.01,f=[-c,a,u],b=[c,a,u],h=[-c,a,p],y=[c,a,p],x=[-m,s,d],g=[m,s,d],v=[-m,s,l],A=[m,s,l];o([b,g,A,y],[1,0,0],ae.body),o([h,v,x,f],[-1,0,0],ae.body),o([v,A,g,x],[0,1,0],ae.body),o([f,b,y,h],[0,-1,0],ae.body),o([y,A,v,h],[0,0,1],ae.body),o([f,x,g,b],[0,0,-1],ae.body);let P=10,M=8,E=[0,Jn,gr],D=[.42,.115,xr],z=n.length;for(let B=0;B<=M;B++){let S=Math.PI*B/M,I=Math.cos(S),T=Math.sin(S);for(let w=0;w<=P;w++){let k=Math.PI*2*w/P,R=T*Math.cos(k),O=T*Math.sin(k);e.push(E[0]+D[0]*R,E[1]+D[1]*I,E[2]+D[2]*O);let j=R/D[0],H=I/D[1],N=O/D[2],F=Math.hypot(j,H,N)||1;j/=F,H/=F,N/=F,t.push(j,H,N),n.push(ae.head)}}for(let B=0;B<M;B++)for(let S=0;S<P;S++){let I=z+B*(P+1)+S,T=I+P+1;r.push(I,T,I+1,I+1,T,T+1)}let V=new Float32Array(e),L=new Float32Array(t),C=new Float32Array(n),_=new Uint16Array(r);return{position:V,normal:L,part:C,index:_,vertexCount:n.length,indexCount:r.length}}function Sr(e,t,n,r){let o=new Float32Array(t),i=m=>e[m*3],a=m=>e[m*3+2],s=0,c=(m,u)=>{let p=u-m;for(let d=m;d<u;d++){let[l,f]=r(d),b=l-i(d),h=f-a(d);if(p>=2){let y=Math.max(m,d-1),x=Math.min(u-1,d+1),g=i(x)-i(y),v=a(x)-a(y),A=Math.hypot(g,v);if(A>1e-6){let P=-v/A,M=g/A;P*b+M*h<0&&(P=-P,M=-M),b=P,h=M}}o[d]=b===0&&h===0?0:Math.atan2(b,h)}};for(let m=1;m<=t;m++)(m===t||n(m)!==n(s))&&(c(s,m),s=m);return o}var De=.22;function Mr(e,t){let n=pe[e];if(n!=="sold"&&n!=="held")return-1;let r=(t+1)*2654435761;return r^=r>>>15,r=Math.imul(r,2246822519),r^=r>>>13,(r>>>0)%1e5/1e5}var xc=.42;function vc(e){let t=e.length,n=new Float64Array(t);if(t<2)return n.fill(1/0),n;let r=1/0,o=1/0,i=-1/0,a=-1/0;for(let f of e)f.x<r&&(r=f.x),f.y<o&&(o=f.y),f.x>i&&(i=f.x),f.y>a&&(a=f.y);let s=Math.max(i-r,1e-6),c=Math.max(a-o,1e-6),m=Math.max(Math.sqrt(s*c/t),1e-6),u=Math.max(1,Math.ceil(s/m)+1),p=Math.max(1,Math.ceil(c/m)+1),d=new Map,l=(f,b)=>{let h=Math.min(u-1,Math.max(0,Math.floor((f-r)/m)));return Math.min(p-1,Math.max(0,Math.floor((b-o)/m)))*u+h};for(let f=0;f<t;f++){let b=l(e[f].x,e[f].y),h=d.get(b);h?h.push(f):d.set(b,[f])}for(let f=0;f<t;f++){let b=e[f],h=Math.min(u-1,Math.max(0,Math.floor((b.x-r)/m))),y=Math.min(p-1,Math.max(0,Math.floor((b.y-o)/m))),x=1/0;for(let g=1;g<=4;g++){for(let v=y-g;v<=y+g;v++)if(!(v<0||v>=p))for(let A=h-g;A<=h+g;A++){if(A<0||A>=u||g>1&&Math.abs(v-y)<g&&Math.abs(A-h)<g)continue;let P=d.get(v*u+A);if(P)for(let M of P){if(M===f)continue;let E=Math.hypot(e[M].x-b.x,e[M].y-b.y);E<x&&(x=E)}}if(Number.isFinite(x)&&x<=g*m)break}n[f]=x}return n}function Sc(e){let t=e.eyeHeightM;return Number.isFinite(t)?Math.max(0,t-Re):0}function wr(e,t,n,r,o,i){let a=e.length,s=new Float32Array(a*3),c=new Float32Array(a),m=new Float32Array(a*3),u=new Float32Array(a),p=new Float32Array(a),d=new Float32Array(a),l=new Float32Array(a),f=new Float32Array(a*3),b=new Map,h=vc(e);for(let y=0;y<a;y++){let x=e[y],v=(n?.seatPitchU(y)??h[y])*G;u[y]=Number.isFinite(v)?Math.max(.06,Math.min(De,v*xc)):De,p[y]=br(Number.isFinite(v)?v:void 0);let A=lr(x.glyph,{seatGlyph:i?.get(x.categoryKey)});d[y]=cr.indexOf(A),l[y]=x.wheelchairSpaceType==="no-seat"?0:1,s[y*3]=x.x*G,s[y*3+1]=n?n.seatDeckY(y):Sc(x),s[y*3+2]=x.y*G,c[y]=Rt(t?t(x):"available");let P=ne(o?.get(x.categoryKey)??"#6e7bff")??[.43,.48,1];if(m[y*3]=P[0],m[y*3+1]=P[1],m[y*3+2]=P[2],x.accessibility?.length){let M=ne(ir(x.accessibility));M&&(f[y*3]=M[0],f[y*3+1]=M[1],f[y*3+2]=M[2])}b.set(x.id,y)}return{count:a,iPosition:s,iState:c,iCategory:m,iMaxRadius:u,iRing:f,idToIndex:b,iChairWidth:p,iGlyph:d,iPhysicalSeat:l,iFloor:r??new Float32Array(a),iYaw:new Float32Array(a)}}var Mc=64;function eo(e,t){let n=[];for(let a of t){let s=e.idToIndex.get(a.seatId);if(s===void 0)continue;let c=Rt(a.state);e.iState[s]!==c&&(e.iState[s]=c,n.push(s))}if(!n.length)return[];n.sort((a,s)=>a-s);let r=[],o=n[0],i=n[0];for(let a=1;a<n.length;a++){let s=n[a];if(s!==i){if(s<=i+Mc){i=s;continue}r.push({start:o,length:i-o+1}),o=s,i=s}}return r.push({start:o,length:i-o+1}),r}var wc=.15,Pc=1.6;function Pr(e){return Qo(e??1,wc,Pc)}var Cc=.15,Ac=.9,Ec=1.76;function Ic(){return{background:{top:[...Je.top],bottom:[...Je.bottom]},structure:Un,seatStates:{...Yo},seatScale:1,materials:{seat:null,shell:null,roughness:.78}}}function Cr(e){let t=Ic();if(!e)return t;let n=ne(e.background);if(n){t.background={top:Pe(n,Ac),bottom:Pe(n,Ec)};let a={};for(let[s,c]of Object.entries(Un))a[s]=ge(c,n,Cc);t.structure=a}let r=ne(e.selectionColor)??ne(e.accent);r&&(t.seatStates={...t.seatStates,selected:r});let o=e.seatScale;typeof o=="number"&&Number.isFinite(o)&&(t.seatScale=Pr(o));let i=e.venue3d;if(i){let a=ne(i.deck),s=ne(i.fascia);a&&(t.structure={...t.structure,tierTop:a,gaTop:a}),s&&(t.structure={...t.structure,tierWall:s,gaWall:s}),t.materials.seat=ne(i.seat),t.materials.shell=ne(i.shell),typeof i.roughness=="number"&&Number.isFinite(i.roughness)&&(t.materials.roughness=Math.min(1,Math.max(0,i.roughness)))}return t}function Ar(e,t){let n=[];for(let r of t)n.push(...e.seatStates[r]);return n}function Er(e,t){let n=1-t,r=n*n*n,o=3*n*n*t,i=3*n*t*t,a=t*t*t;return{x:r*e.start.x+o*e.control1.x+i*e.control2.x+a*e.end.x,y:r*e.start.y+o*e.control1.y+i*e.control2.y+a*e.end.y}}function Ir(e,t,n=192){if(!Number.isInteger(t)||t<1)throw new Error("Path point count must be a positive integer");if(t===1)return[Er(e,.5)];let r=Array.from({length:n+1},(c,m)=>Er(e,m/n)),o=new Float64Array(r.length);for(let c=1;c<r.length;c+=1){let m=r[c].x-r[c-1].x,u=r[c].y-r[c-1].y;o[c]=o[c-1]+Math.hypot(m,u)}let i=o[o.length-1];if(i<=1e-9)return Array.from({length:t},()=>({...e.start}));let a=[],s=1;for(let c=0;c<t;c+=1){let m=i*c/(t-1);for(;s<o.length-1&&o[s]<m;)s+=1;let u=o[s-1],p=o[s],d=p===u?0:(m-u)/(p-u);a.push({x:r[s-1].x+(r[s].x-r[s-1].x)*d,y:r[s-1].y+(r[s].y-r[s-1].y)*d})}return a}function Rr(e){let t=new Map,n=new Map;for(let r of e){if(r.type!=="row"||!r.segmentedRow)continue;let o=n.get(r.segmentedRow.groupId)??[];o.push(r),n.set(r.segmentedRow.groupId,o)}for(let[r,o]of n){let i=o.slice().sort((d,l)=>d.segmentedRow.componentIndex-l.segmentedRow.componentIndex),a=i[0]?.segmentedRow?.componentCount??0,s=i[0]?.segmentedRow;if(!s||!(a>=2&&i.length===a&&s?.boundaryBefore==="start"&&i.every((d,l)=>d.segmentedRow?.kind==="segmented-row-v1"&&d.segmentedRow.groupId===r&&d.segmentedRow.componentCount===a&&d.segmentedRow.componentIndex===l&&d.segmentedRow.repeatLabelOnComponents===s.repeatLabelOnComponents&&(l===0?d.segmentedRow.boundaryBefore==="start":d.segmentedRow.boundaryBefore!=="start")&&d.segmentedRow.displayLabel===s.displayLabel)))continue;let m=i.reduce((d,l)=>d+l.seatCount,0),u=0,p=0;for(let d of i)d.segmentedRow.boundaryBefore==="break"&&(u+=1),t.set(d.id,{groupId:r,adjacencyOffset:u,displayOffset:p,displayLabel:s.displayLabel,totalSeats:m,canonical:i[0],viewFromSeatUrl:s.viewFromSeatUrl,viewFromSeatMeta:s.viewFromSeatMeta,confidenceEvidence:s.confidenceEvidence}),u+=d.seatCount,p+=d.seatCount}return t}var Rc="ABCDEFGHIJKLMNOPQRSTUVWXYZ";var Tc="abcdefghijklmnopqrstuvwxyz";function _c(e,t){let n=t.length,r=e+1,o="";for(;r>0;){r-=1;let i=r%n;o=t[i]+o,r=Math.floor(r/n)}return o}function to(e,t=!1){let n=t?Tc:Rc;return _c(Math.max(0,Math.floor(e)-1),n)}var Lc=[[1e3,"M"],[900,"CM"],[500,"D"],[400,"CD"],[100,"C"],[90,"XC"],[50,"L"],[40,"XL"],[10,"X"],[9,"IX"],[5,"V"],[4,"IV"],[1,"I"]];function Tr(e){if(!Number.isFinite(e)||e<=0)return String(e);let t=Math.floor(e),n="";for(let[r,o]of Lc)for(;t>=r;)n+=o,t-=r;return n}function kc(e){let t=new Array(e);return Array.from({length:e},(n,r)=>r).sort((n,r)=>Math.abs(2*n-(e-1))-Math.abs(2*r-(e-1))||n-r).forEach((n,r)=>t[n]=r),t}function no(e,t){let n=e.seatLabelStart??1,r=e.seatNumbering?.direction??"ltr",o=e.seatNumbering?.step??1,i=e.seatNumbering?.scheme??"decimal",a=e.seatNumbering?.prefix??"",s=e.seatNumbering?.endAt,c=e.seatCount;if(i==="updown"||i==="updown-descending"){let l=Math.ceil(c/2),f=i==="updown"?t<l?n+2*t:n-1+2*(c-t):t<l?n+2*(l-1-t):n+1+2*(t-l);return`${a}${f}`}let m=i==="odd"||i==="even"?2:o,u=s!=null&&Number.isFinite(s)?s-(c-1)*m:n,p=r==="center"?kc(c)[t]:r==="rtl"?c-1-t:t,d;switch(i){case"odd":{let l=u%2===1?u:u+1;d=String(l+p*2);break}case"even":{let l=u%2===0?u:u+1;d=String(l+p*2);break}case"roman":d=Tr(u+p*o);break;case"letters-upper":d=to(u+p*o,!1);break;case"letters-lower":d=to(u+p*o,!0);break;default:d=String(u+p*o);break}return`${a}${d}`}function Fc(e){return{...e.canonical,seatCount:e.totalSeats,label:e.displayLabel,displayLabel:e.displayLabel}}function _r(e,t,n){return n?.label??`${e.label}-${no(e,t)}`}function oo(e,t,n,r){if(r?.displayLabel)return r.displayLabel;if(!n)return`${e.displayLabel||e.label}-${no(e,t)}`;let o=Fc(n),i=n.displayOffset+t;return`${n.displayLabel}-${no(o,i)}`}function Lr(e){let t=e.length;return t<=3?[...e]:[e[Math.floor(t*.25)],e[Math.floor(t*.5)],e[Math.floor(t*.75)]]}function yt(e,t,n){if(!e.length)return 1/0;if(e.length===1)return Math.hypot(t-e[0].x,n-e[0].y);let r=1/0;for(let o=0;o+1<e.length;o++){let i=e[o],a=e[o+1],s=a.x-i.x,c=a.y-i.y,m=s*s+c*c,u=m>1e-12?((t-i.x)*s+(n-i.y)*c)/m:0;u<0?u=0:u>1&&(u=1);let p=Math.hypot(t-(i.x+u*s),n-(i.y+u*c));p<r&&(r=p)}return r}function Dc(e){let t=0,n=0;for(let i of e)t+=i.x,n+=i.y;let r=e.length||1;t/=r,n/=r;let o=0;for(let i of e){let a=Math.hypot(i.x-t,i.y-n);a>o&&(o=a)}return{cx:t,cy:n,r:o}}function kr(e,t){return Math.hypot(e.cx-t.cx,e.cy-t.cy)-e.r-t.r}function ro(e,t){let n=1/0;for(let r of Lr(e)){let o=yt(t,r.x,r.y);o<n&&(n=o)}for(let r of Lr(t)){let o=yt(e,r.x,r.y);o<n&&(n=o)}return n}function Oc(e,t){if(e.length<3)return{pts:e,seatIndices:t};let n=0,r=0;for(let u of e)n+=u.x,r+=u.y;n/=e.length,r/=e.length;let o=-1,i=e[0];for(let u of e){let p=Math.hypot(u.x-n,u.y-r);p>o&&(o=p,i=u)}let a=i.x-n,s=i.y-r,c=Math.hypot(a,s);c>1e-9?(a/=c,s/=c):(a=1,s=0);let m=e.map((u,p)=>({p:u,i:p,t:(u.x-n)*a+(u.y-r)*s})).sort((u,p)=>u.t-p.t);return{pts:m.map(u=>u.p),seatIndices:m.map(u=>t[u.i])}}function io(e){let t=e.length;if(t<3)return null;let n=0,r=0;for(let x of e)n+=x.x,r+=x.y;n/=t,r/=t;let o=0,i=0,a=0,s=0,c=0,m=0,u=0;for(let x of e){let g=x.x-n,v=x.y-r;o+=g*g,a+=v*v,i+=g*v,s+=g*g*g,c+=v*v*v,m+=g*v*v,u+=v*g*g}let p=o*a-i*i;if(Math.abs(p)<1e-9)return null;let d=(s+m)/2,l=(c+u)/2,f=(d*a-l*i)/p,b=(l*o-d*i)/p,h=f+n,y=b+r;return!Number.isFinite(h)||!Number.isFinite(y)?null:{cx:h,cy:y}}var Vc=.15;function Bc(e){if(e.length<2)return null;let t=e.map(x=>{let g=0,v=0;for(let A of x.pts)g+=A.x,v+=A.y;return{x:g/x.pts.length,y:v/x.pts.length}}),n=0,r=0;for(let x of t)n+=x.x,r+=x.y;n/=t.length,r/=t.length;let o=0,i=0,a=0;for(let x of t){let g=x.x-n,v=x.y-r;o+=g*g,i+=g*v,a+=v*v}let s=o+a,c=o*a-i*i,m=s/2+Math.sqrt(Math.max(0,s*s/4-c)),u,p;Math.abs(i)>1e-12?(u=m-a,p=i):o>=a?(u=1,p=0):(u=0,p=1);let d=Math.hypot(u,p);if(!(d>1e-12))return null;u/=d,p/=d;let l=1/0,f=-1/0,b=[];for(let x of e){let g=1/0,v=-1/0;for(let A of x.pts){let P=A.x*u+A.y*p;P<g&&(g=P),P>v&&(v=P),P<l&&(l=P),P>f&&(f=P)}b.push(v-g)}let h=f-l;return h>1e-9?(b.sort((x,g)=>x-g),b[Math.min(b.length-1,Math.floor(b.length*.9))]/h<=Nc?{x:u,y:p}:null):null}var Nc=.35;function cn(e,t,n,r){let o=new Map;for(let h of n){let y=t[h],x=y.rowId||`__seat-${h}`,g=o.get(x);g||(g={pts:[],idx:[]},o.set(x,g)),g.pts.push({x:y.x,y:y.y}),g.idx.push(h)}if(!o.size)return{sectionId:e,rows:[],blockCount:0};let i=[];for(let[h,y]of o){let x=Oc(y.pts,y.idx),g=0;for(let v of x.pts)g+=Math.hypot(v.x-r.x,v.y-r.y);i.push({id:h,pts:x.pts,seatIndices:x.seatIndices,blockId:-1,ordinal:0,blockDepth:0,focalDistance:g/x.pts.length})}let a=i.map(h=>Dc(h.pts)),s=[];for(let h=0;h<i.length;h++){let y=1/0;for(let x=0;x<i.length;x++){if(h===x||kr(a[h],a[x])>=y)continue;let g=ro(i[h].pts,i[x].pts);g<y&&(y=g)}Number.isFinite(y)&&s.push(y)}s.sort((h,y)=>h-y);let c=s.length?s[Math.floor(s.length/2)]:1,m=Math.max(c*1.8,1e-6),u=i.map(()=>[]);for(let h=0;h<i.length;h++)for(let y=h+1;y<i.length;y++)kr(a[h],a[y])>m||ro(i[h].pts,i[y].pts)<=m&&(u[h].push(y),u[y].push(h));let p=0;for(let h=0;h<i.length;h++){if(i[h].blockId!==-1)continue;let y=p++,x=[h];for(i[h].blockId=y;x.length;){let g=x.pop();for(let v of u[g])i[v].blockId===-1&&(i[v].blockId=y,x.push(v))}}let d=new Map;for(let h of i){let y=d.get(h.blockId)??[];y.push(h),d.set(h.blockId,y)}let l=[];for(let h of i){if(h.pts.length<4)continue;let y=io(h.pts);y&&(!Number.isFinite(y.cx)||!Number.isFinite(y.cy)||l.push({x:y.cx,y:y.cy}))}let f=l.length>=2?(()=>{let h=l.map(g=>g.x).sort((g,v)=>g-v),y=l.map(g=>g.y).sort((g,v)=>g-v),x=Math.floor(l.length/2);return{cx:h[x],cy:y[x]}})():null;if(f){let h=P=>Math.hypot(P.x-f.cx,P.y-f.cy),y=1/0,x=-1/0,g=[];for(let P of i){let M=1/0,E=-1/0;for(let D of P.pts){let z=h(D);z<M&&(M=z),z>E&&(E=z)}g.push(E-M),M<y&&(y=M),E>x&&(x=E)}let v=x-y;g.sort((P,M)=>P-M);let A=g[Math.min(g.length-1,Math.floor(g.length*.9))];if(v>1e-9&&A/v<=Vc){let P=i.map(S=>{let I=0;for(let T of S.pts)I+=h(T);return{row:S,radius:I/S.pts.length}}),M=0,E=0;for(let S of P)M+=S.radius,E+=S.row.focalDistance;M/=P.length,E/=P.length;let D=0;for(let S of P)D+=(S.radius-M)*(S.row.focalDistance-E);if(D<0)for(let S of P)S.radius=-S.radius;let V=1/0;for(let S of P)S.radius<V&&(V=S.radius);P.sort((S,I)=>S.radius-I.radius);let L=-1,C=-1/0,_=v/Math.max(1,P.length)*.5,B=[];for(let S of P)S.radius-C>_&&(L++,C=S.radius),S.row.ordinal=L,S.row.blockDepth=S.radius-V,B.push(S.row);return{sectionId:e,rows:B,blockCount:p}}}let b=[];for(let[,h]of d){let y=Bc(h);if(y){let x=v=>{let A=0;for(let P of v.pts)A+=P.x*y.x+P.y*y.y;return A/v.pts.length};h.sort((v,A)=>x(v)-x(A)),h.length>=2&&h[0].focalDistance>h[h.length-1].focalDistance&&h.reverse();let g=0;for(let v=0;v<h.length;v++)v>0&&(g+=ro(h[v-1].pts,h[v].pts)),h[v].ordinal=v,h[v].blockDepth=g,b.push(h[v])}else{let x=1/0;for(let g of h)g.focalDistance<x&&(x=g.focalDistance);h.sort((g,v)=>g.focalDistance-v.focalDistance);for(let g=0;g<h.length;g++)h[g].ordinal=g,h[g].blockDepth=Math.max(0,h[g].focalDistance-x),b.push(h[g])}}return{sectionId:e,rows:b,blockCount:p}}var Gc=/^\d{4}-\d{2}-\d{2}$/;function zc(e){let t=Date.parse(e);return Number.isFinite(t)?Gc.test(e)?t+864e5:t:null}function Uc(e,t=Date.now()){if(e.validUntil===void 0){if(e.status!=="approved")return!0;let r=e.assessedAt?Date.parse(e.assessedAt):Number.NaN;return Number.isFinite(r)&&(t instanceof Date?t.getTime():t)<=r+366*864e5}let n=zc(e.validUntil);return n===null?!1:(t instanceof Date?t.getTime():t)<n}function Hc(e,t,n){return!(e.eventConfigurationId&&e.eventConfigurationId!==t||e.eventConfigurationVersion!==void 0&&e.eventConfigurationVersion!==n)}function jc(e){return e.status!=="draft"&&e.status!=="retracted"}function Yc(e,t){return e.status===void 0?t===void 0:e.status!=="approved"?!0:typeof t=="string"&&typeof e.basisSha256=="string"&&e.basisSha256===t}function Fr(e,t={}){return!!e&&jc(e)&&Hc(e,t.activeConfigurationId,t.activeConfigurationVersion)&&Yc(e,t.activeBasisSha256)&&Uc(e,t.now)}var df=Math.PI*2;function ln(e){return e==="pitch-football"||e==="rink-hockey"||e==="track-athletics"||e==="oval-cricket"}var Xc=/^data:image\/(?:png|jpe?g|webp|gif|avif);base64,[a-z0-9+/]+={0,2}$/i,Wc=/[\s"'<>`\\]/;function Kc(e){if(typeof e!="string"||!e||e.length>2e6||e!==e.trim())return!1;if(e.startsWith("data:"))return Xc.test(e);if(Wc.test(e))return!1;try{let t=new URL(e);return t.protocol==="https:"&&!t.username&&!t.password}catch{return!1}}function Dr(e){let t=e.trim();return Kc(t)?t:null}var ao="seatlayer.event-configuration/1";var gt=100,qc=120,$c=1e5,Qc=1e4,Zc=/^[a-f0-9]{64}$/,Jc=new Set(["stage","screen","barrier","camera_platform","sound_desk","rigging_truss"]);function Vt(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function nt(e,t){return typeof e=="string"&&e.length>=1&&e.length<=t&&e.normalize("NFKC").trim()===e}function el(e){return typeof e=="number"&&Number.isInteger(e)&&e>0}function Or(e){return!Array.isArray(e)||e.length>$c||!e.every(t=>nt(t,gt))?null:[...new Set(e)].sort()}function tl(e){return!Vt(e)||!nt(e.chartId,gt)||!nt(e.version,gt)||e.sha256!==void 0&&(typeof e.sha256!="string"||!Zc.test(e.sha256))?null:{chartId:e.chartId,version:e.version,...typeof e.sha256=="string"?{sha256:e.sha256}:{}}}function so(e,t,n){return typeof e=="number"&&Number.isFinite(e)&&e>=t&&e<=n}function nl(e){return Vt(e)?e.mode==="none"||e.mode==="opaque"?e.opacity===void 0?{mode:e.mode}:null:e.mode==="partial"&&so(e.opacity,.01,.99)?{mode:"partial",opacity:e.opacity}:null:null}function ol(e,t){if(e===void 0)return;if(!Array.isArray(e)||e.length>Qc)return null;let n=new Set(t),r=new Set,o=new Set,i=0,a=[];for(let s of e){if(!Vt(s)||!nt(s.id,gt)||!nt(s.objectId,gt)||!n.has(s.objectId)||!Jc.has(String(s.kind))||!so(s.heightM,.05,50)||s.baseElevationM!==void 0&&!so(s.baseElevationM,-10,100))return null;let c=nl(s.occlusion);if(!c||r.has(s.id)||o.has(s.objectId))return null;let m=s.contentImageUrl===void 0?void 0:typeof s.contentImageUrl=="string"?Dr(s.contentImageUrl):null;if(s.contentImageUrl!==void 0&&(!m||s.kind!=="screen"||++i>1))return null;r.add(s.id),o.add(s.objectId),a.push({id:s.id,objectId:s.objectId,kind:s.kind,heightM:s.heightM,...s.baseElevationM!==void 0?{baseElevationM:s.baseElevationM}:{},occlusion:c,...m?{contentImageUrl:m}:{}})}return a.sort((s,c)=>s.id.localeCompare(c.id))}function rl(e){let t=[];if(!Vt(e))return{issues:[{code:"invalid_export",path:"configuration",message:"Configuration must be an object"}]};e.schema!==ao&&t.push({code:"unsupported_schema",path:"configuration.schema",message:`Configuration schema must be ${ao}`}),nt(e.id,gt)||t.push({code:"invalid_id",path:"configuration.id",message:"Configuration id must contain 1 to 100 normalized characters"}),nt(e.label,qc)||t.push({code:"invalid_label",path:"configuration.label",message:"Configuration label must contain 1 to 120 normalized characters"}),el(e.version)||t.push({code:"invalid_version",path:"configuration.version",message:"Configuration version must be a positive integer"});let n=tl(e.baseVenue);n||t.push({code:"invalid_base_venue",path:"configuration.baseVenue",message:"Base venue must identify one normalized chart id and exact version"});let r=Vt(e.overlay)?e.overlay:null,o=Or(r?.objectIds),i=Or(r?.productionKillSeatIds),a=o?ol(r?.productionElements,o):null;return(!r||!o||!i)&&t.push({code:"invalid_overlay",path:"configuration.overlay",message:"Overlay ids must be bounded arrays of normalized stable ids"}),a===null&&t.push({code:"invalid_production_element",path:"configuration.overlay.productionElements",message:"Production elements must be unique, bounded semantics over referenced base-venue objects"}),t.length||!n||!o||!i||a===null?{issues:t}:{issues:t,value:{schema:ao,id:e.id,label:e.label,version:e.version,baseVenue:n,overlay:{objectIds:o,productionKillSeatIds:i,...a!==void 0?{productionElements:a}:{}}}}}function Vr(e){let t=rl(e);return t.value?{ok:!0,value:t.value}:{ok:!1,issues:t.issues}}function il(e){if((e.kind==="polygon"||e.kind==="polyline"||e.kind==="line")&&e.points&&e.points.length>=2)return e.points;if(e.x==null||e.y==null||e.width==null||e.height==null)return null;let t=e.x,n=e.y,r=e.width,o=e.height;return[{x:t,y:n},{x:t+r,y:n},{x:t+r,y:n+o},{x:t,y:n+o}]}function al(e,t,n){let r=n*Math.PI/180,o=Math.cos(r),i=Math.sin(r),a=e.x-t.x,s=e.y-t.y;return{x:t.x+a*o-s*i,y:t.y+a*i+s*o}}function Br(e){let t=il(e);if(!t||t.length<2)return null;let n=e.rotation??0,r=Math.abs(n)<1e-6?t:t.map(c=>al(c,{x:t.reduce((m,u)=>m+u.x,0)/t.length,y:t.reduce((m,u)=>m+u.y,0)/t.length},n)),o=1/0,i=1/0,a=-1/0,s=-1/0;for(let c of r)o=Math.min(o,c.x),i=Math.min(i,c.y),a=Math.max(a,c.x),s=Math.max(s,c.y);return!Number.isFinite(o)||a-o<1e-6||s-i<1e-6?null:{minX:o,minY:i,maxX:a,maxY:s}}var sl=5,cl=3,ll=.92,ul=1.9,ml=2,dl=.6,fl=1,pl=.06;function hl(e){return e.heightM!==void 0?e.heightM:ln(e.stageKind)?pl:fl}function Nr(e){let t=1/0,n=1/0,r=-1/0,o=-1/0,i=-1/0;for(let a of Ur(e)){let s=a.baseHeightM??0;for(let c of a.objects){if(c.type!=="shape"||c.role!=="stage")continue;let m=Br(c);m&&(t=Math.min(t,m.minX),n=Math.min(n,m.minY),r=Math.max(r,m.maxX),o=Math.max(o,m.maxY),i=Math.max(i,s+hl(c)))}}return!Number.isFinite(t)||!Number.isFinite(i)?null:{minX:t,minY:n,maxX:r,maxY:o,deckTopM:i}}function bl(e,t,n,r){let o=1/0,i=1/0,a=-1/0,s=-1/0;for(let l of e)Number.isFinite(l.eyeHeightM)&&(o=Math.min(o,l.x),a=Math.max(a,l.x),i=Math.min(i,l.y),s=Math.max(s,l.y));if(!Number.isFinite(o))return null;let c=o*t,m=i*t,u=Math.max(1,Math.ceil((a-o)*t/n)+1),p=Math.max(1,Math.ceil((s-i)*t/n)+1),d=new Float64Array(u*p).fill(-1/0);for(let l of e){if(!Number.isFinite(l.eyeHeightM))continue;let f=l.eyeHeightM-Re,b=Math.min(u-1,Math.max(0,Math.floor((l.x*t-c)/n))),y=Math.min(p-1,Math.max(0,Math.floor((l.y*t-m)/n)))*u+b,x=f+r;x>d[y]&&(d[y]=x)}return{cellM:n,minX:c,minY:m,cols:u,rows:p,top:d}}function yl(e,t,n){let r=Math.floor((t-e.minX)/e.cellM),o=Math.floor((n-e.minY)/e.cellM);return r<0||o<0||r>=e.cols||o>=e.rows?-1/0:e.top[o*e.cols+r]}function Gr(e,t,n={}){let r=new Map;if(!t||!e.length)return r;let o=n.metresPerChartUnit??be,i=n.cellM??dl,a=n.chairBackM??ll,s=n.selfRowSkipM??ml,c=n.clearThreshold??.9,m=n.partialThreshold??.25,u=Math.max(1,n.columns??sl),p=Math.max(1,n.rows??cl),d=bl(e,o,i,a);if(!d)return r;let l=(t.maxX-t.minX)*o,f=(t.maxY-t.minY)*o,b=l>=f,h=(t.minX+t.maxX)/2*o,y=(t.minY+t.maxY)/2*o,x=[];for(let v=0;v<u;v++){let A=(v+.5)/u-.5,P=b?h+A*l:h,M=b?y:y+A*f;for(let E=0;E<p;E++){let D=t.deckTopM+(p===1?0:E/(p-1)*ul);x.push({x:P,y:M,z:D})}}let g=i/2;for(let v of e){if(!Number.isFinite(v.eyeHeightM))continue;let A=v.x*o,P=v.y*o,M=v.eyeHeightM,E=0,D=1/0;for(let V of x){let L=V.x-A,C=V.y-P,_=Math.hypot(L,C);if(!(_>s)){E++;continue}let B=L/_,S=C/_,I=0;for(let T=s;T<_;T+=g){let w=yl(d,A+B*T,P+S*T);if(!(!Number.isFinite(w)||w>=M)&&w>M+(V.z-M)*T/_){I=T;break}}I?D=Math.min(D,I):E++}let z=E/x.length;z>=c||r.set(v.id,{seatId:v.id,mark:z<m?"obstructedView":"restrictedView",visibleFraction:z,totalRays:x.length,atDistanceM:Number.isFinite(D)?D:0})}return r}function zr(e,t){if(!t.size)return 0;let n=0;for(let r of e){let o=t.get(r.id);if(!o)continue;let i=r.commercial;i?.restrictedView!==void 0||i?.obstructedView!==void 0||(r.commercial={...i,[o.mark]:!0},n++)}return n}function co(e){return e?e.accessibility?.length?e.wheelchairSpaceType&&!e.accessibility.includes("wheelchair")?["wheelchair",...e.accessibility]:e.accessibility:e.wheelchairSpaceType?["wheelchair"]:e.accessible?["wheelchair"]:[]:[]}var un=Math.PI/180;var Bt=16;function uo(e,t,n,r){let o=n*un,i=Math.cos(o),a=Math.sin(o);return{x:r.x+e*i-t*a,y:r.y+e*a+t*i}}function gl(e){let{seatCount:t,seatSpacing:n,curve:r,rotation:o,origin:i}=e,a=[];if(e.path)return Ir(e.path,t);if(t<=1)return t===1&&a.push({x:i.x,y:i.y}),a;if(r===0){for(let m=0;m<t;m++)a.push(uo(m*n,0,o,i));return a}let s=r/(t-1)*un,c=n/(2*Math.sin(Math.abs(s)/2));for(let m=0;m<t;m++){let u=m*s,p=c*Math.sin(u),d=-c+c*Math.cos(u);a.push(uo(p,d,o,i))}return a}function xl(e){let t=new Map;if(e.overrides)for(let n of e.overrides)t.set(n.index,n);return t}function vl(e,t){let n=xl(e);return gl(e).map((r,o)=>{let i=n.get(o),a=co(i),s=_r(e,o,i),c={...e.commercial,...i?.commercial};return{index:o,x:r.x+(i?.dx??0),y:r.y+(i?.dy??0),label:s,displayLabel:oo(e,o,t,i),categoryKey:i?.categoryKey??e.categoryKey,skipped:!!i?.skip,accessible:a.length>0,accessibility:a,wheelchairSpaceType:i?.wheelchairSpaceType,commercial:Object.values(c).some(m=>m!==void 0&&m!==!1&&m!=="")?c:void 0,glyph:i?.glyph,viewUrl:i?.viewFromSeatUrl??e.viewFromSeatUrl,viewMeta:i?.viewFromSeatUrl?i.viewFromSeatMeta:e.viewFromSeatMeta,labelStyle:i?.labelStyle}})}function Wr(e){let t=[];for(let n of vl(e))n.skipped||t.push({id:`${e.id}:${n.index}`,label:n.label,displayLabel:n.displayLabel===n.label?void 0:n.displayLabel,x:n.x,y:n.y,rowId:e.id,categoryKey:n.categoryKey,accessible:n.accessible||void 0,accessibility:n.accessibility.length?n.accessibility:void 0,wheelchairSpaceType:n.wheelchairSpaceType,commercial:n.commercial,glyph:n.glyph,viewUrl:n.viewUrl,viewMeta:n.viewMeta,labelStyle:n.labelStyle});return t}function Sl(e){if(e.seatCountsBySide)return{...e.seatCountsBySide};let t=e.sides&&e.sides.length?e.sides:["top","bottom"],n=["top","bottom","left","right"].filter(i=>t.includes(i)),r={top:0,bottom:0,left:0,right:0};if(!n.length)return r;let o=Math.max(0,Math.round(e.seatCount));for(let i=0;i<o;i++)r[n[i%n.length]]+=1;return r}function Ml(e){let t=[],n=Math.max(0,Math.round(e.seatCount));if(n===0)return t;let r=new Map((e.overrides??[]).map(u=>[u.index,u])),o=(u,p,d,l)=>{let f=r.get(u),b=co(f),h=f?.label??`${e.label}-${u+1}`,y=e.displayLabel??e.label;return{index:u,label:h,displayLabel:f?.displayLabel??`${y}-${u+1}`,x:p+(f?.dx??0),y:d+(f?.dy??0),categoryKey:f?.categoryKey??e.categoryKey,skipped:!!f?.skip,accessible:b.length>0,accessibility:b,wheelchairSpaceType:f?.wheelchairSpaceType,commercial:f?.commercial,glyph:f?.glyph,viewUrl:f?.viewFromSeatUrl,viewMeta:f?.viewFromSeatUrl?f.viewFromSeatMeta:void 0,labelStyle:f?.labelStyle,...l?{side:l}:{}}};if(e.shape==="round"){let u=(e.radius??40)+Bt,p=e.rotation*un,d=Math.max(0,Math.min(360,e.seatArc??360));if(d>=360||n===1){for(let h=0;h<n;h++){let y=p+h/n*2*Math.PI;t.push(o(h,e.center.x+u*Math.cos(y),e.center.y+u*Math.sin(y)))}return t}let l=d*un,f=(2*Math.PI-l)/2,b=p+f;for(let h=0;h<n;h++){let y=b+h/(n-1)*l;t.push(o(h,e.center.x+u*Math.cos(y),e.center.y+u*Math.sin(y)))}return t}let i=e.width??80,a=e.height??50,s=Sl(e),c=["top","bottom","left","right"],m=0;for(let u of c){let p=s[u];for(let d=0;d<p;d++){let l,f;u==="top"?(l=-i/2+(d+.5)*i/p,f=-a/2-Bt):u==="bottom"?(l=-i/2+(d+.5)*i/p,f=a/2+Bt):u==="left"?(l=-i/2-Bt,f=-a/2+(d+.5)*a/p):(l=i/2+Bt,f=-a/2+(d+.5)*a/p);let b=uo(l,f,e.rotation,e.center);t.push(o(m++,b.x,b.y,u))}}return t}function wl(e){return Ml(e).filter(t=>!t.skipped).map(t=>({id:`${e.id}:${t.index}`,label:t.label,...t.displayLabel!==t.label?{displayLabel:t.displayLabel}:{},x:t.x,y:t.y,rowId:e.id,categoryKey:t.categoryKey,...t.accessible?{accessible:!0}:{},...t.accessibility.length?{accessibility:t.accessibility}:{},...t.wheelchairSpaceType?{wheelchairSpaceType:t.wheelchairSpaceType}:{},...t.commercial?{commercial:t.commercial}:{},...t.glyph?{glyph:t.glyph}:{},...t.viewUrl?{viewUrl:t.viewUrl}:{},...t.viewUrl&&t.viewMeta?{viewMeta:t.viewMeta}:{},...t.labelStyle?{labelStyle:t.labelStyle}:{}}))}function Pl(e){return[{id:`${e.id}:0`,label:e.label,...e.displayLabel&&e.displayLabel!==e.label?{displayLabel:e.displayLabel}:{},x:e.center.x,y:e.center.y,rowId:e.id,categoryKey:e.categoryKey,kind:"booth"}]}function Hr(e,t){let n=!1;for(let r=0,o=t.length-1;r<t.length;o=r++){let i=t[r].x,a=t[r].y,s=t[o].x,c=t[o].y;a>e.y!=c>e.y&&e.x<(s-i)*(e.y-a)/(c-a)+i&&(n=!n)}return n}function Cl(e,t){return t.some((n,r)=>{let o=t[(r+1)%t.length],i=(e.y-n.y)*(o.x-n.x)-(e.x-n.x)*(o.y-n.y);if(Math.abs(i)>1e-7)return!1;let a=(e.x-n.x)*(o.x-n.x)+(e.y-n.y)*(o.y-n.y),s=(o.x-n.x)**2+(o.y-n.y)**2;return a>=-1e-7&&a<=s+1e-7})}function ot(e,t,n){return Hr(e,t)&&!(n??[]).some(r=>Hr(e,r)||Cl(e,r))}function lo(e){if(!e.length)return{x:0,y:0};let t=0,n=0;for(let r of e)t+=r.x,n+=r.y;return{x:t/e.length,y:n/e.length}}function Al(e){switch(e.type){case"row":{let t=Wr(e);if(!t.length)return{x:e.origin.x,y:e.origin.y};let n=0,r=0;for(let o of t)n+=o.x,r+=o.y;return{x:n/t.length,y:r/t.length}}case"table":case"booth":return{x:e.center.x,y:e.center.y};case"gaArea":return lo(e.points);case"section":return lo(e.outline);case"text":return{x:e.position.x,y:e.position.y};case"shape":return e.points&&e.points.length?lo(e.points):e.x!=null&&e.y!=null&&e.width!=null&&e.height!=null?{x:e.x+e.width/2,y:e.y+e.height/2}:{x:e.x??0,y:e.y??0};case"decorImage":return{x:e.x+e.width/2,y:e.y+e.height/2}}}function jr(e,t){return e.length===t.length&&e.every((n,r)=>n.x===t[r].x&&n.y===t[r].y)}function El(e,t){if(e.type!=="gaArea"||!jr(e.points,t.outline))return!1;let n=e.holes??[],r=t.holes??[];return n.length===r.length&&n.every((o,i)=>jr(o,r[i]))}function Il(e,t){let n=e.filter(a=>a.type==="section"),r="referenceInventorySource"in t?t.referenceInventorySource?.logicalSectionId:void 0,o=Al(t);return(r?n.find(a=>(a.logicalSectionId??a.id)===r&&(El(t,a)||ot(o,a.outline,a.holes))):void 0)??n.find(a=>ot(o,a.outline,a.holes))}function Ur(e){return e.floors&&e.floors.length?e.floors:[{id:"floor-0",name:"Main",objects:e.objects,focalPoint:e.focalPoint,referenceImage:e.referenceImage,backgroundImage:e.backgroundImage}]}function Yr(e,t,n,r,o,i,a,s,c){let m=[],u=Rr(e),p=f=>!f?.eventConfigurationId||f.eventConfigurationId===r&&(f.eventConfigurationVersion===void 0||f.eventConfigurationVersion===c),d=f=>Fr(f,{activeConfigurationId:r,activeConfigurationVersion:c,activeBasisSha256:o,now:s}),l=(f,b)=>d(f)?{...f,coverage:b}:void 0;for(let f of e){let b=[];if(f.type==="row"?b=Wr(f):f.type==="table"?b=wl(f):f.type==="booth"&&(b=Pl(f)),!b.length)continue;for(let v of b)v.viewUrl&&!p(v.viewMeta)&&(v.viewUrl=void 0,v.viewMeta=void 0);if(f.type==="row"){let v=u.get(f.id);if(v){let A=new Map((f.overrides??[]).map(P=>[P.index,P]));for(let P of b){let M=Number(P.id.slice(P.id.lastIndexOf(":")+1));if(!Number.isInteger(M))continue;P.logicalRowId=v.groupId,P.logicalSeatIndex=v.adjacencyOffset+M,A.get(M)?.displayLabel||(P.displayLabel=oo(f,M,v)),!P.viewUrl&&v.viewFromSeatUrl&&p(v.viewFromSeatMeta)&&(P.viewUrl=v.viewFromSeatUrl,P.viewMeta=v.viewFromSeatMeta);let E=A.get(M)?.confidenceEvidence;P.confidenceEvidence=l(E,"exact-seat")??l(f.confidenceEvidence,"row-representative")??l(v.confidenceEvidence,"row-representative")}}}let h=Il(e,f),y=h?.viewFromSeatUrl,g=(h?.zone?t?.find(v=>v.id===h.zone):void 0)?.focalPoint??n;for(let v of b){if(!v.confidenceEvidence){let A=Number(v.id.slice(v.id.lastIndexOf(":")+1)),P=(f.type==="row"||f.type==="table")&&Number.isInteger(A)?f.overrides?.find(M=>M.index===A)?.confidenceEvidence:void 0;v.confidenceEvidence=l(P,"exact-seat")??(f.type==="row"?l(f.confidenceEvidence,"row-representative"):void 0)}v.confidenceEvidence??=l(h?.confidenceEvidence,"section-representative")??(a?l(a.evidence,a.coverage):void 0),!v.viewUrl&&y&&p(h?.viewFromSeatMeta)&&(v.viewUrl=y,v.viewMeta=h?.viewFromSeatMeta),!v.viewUrl&&i&&p(i.meta)&&(v.viewUrl=i.url,v.viewMeta=i.meta),h&&(v.sectionId=h.logicalSectionId??h.id),h?.zone&&(v.zoneId=h.zone),g&&(v.focalPoint={...g})}m.push(...b)}return m}function Kr(e,t={}){if(e.floors?.length){let r=[];for(let o of e.floors){let i=o.focalPoint??e.focalPoint,a=o.viewFromSeatUrl?{url:o.viewFromSeatUrl,meta:o.viewFromSeatMeta}:e.viewFromSeatUrl?{url:e.viewFromSeatUrl,meta:e.viewFromSeatMeta}:void 0,s=o.confidenceEvidence?{evidence:o.confidenceEvidence,coverage:"floor-representative"}:e.confidenceEvidence?{evidence:e.confidenceEvidence,coverage:"venue-representative"}:void 0,c=Yr(o.objects,e.zones,i,e.eventConfigurationId,e.confidenceBasisSha256,a,s,t.now,t.eventConfigurationVersion??e.eventConfigurationVersion);t.resolveEyeHeights!==!1&&Xr(o.objects,o.focalPoint??e.focalPoint,o.baseHeightM??0,c);for(let m of c)m.floorId=o.id;r.push(...c)}return r}let n=Yr(e.objects,e.zones,e.focalPoint,e.eventConfigurationId,e.confidenceBasisSha256,e.viewFromSeatUrl?{url:e.viewFromSeatUrl,meta:e.viewFromSeatMeta}:void 0,e.confidenceEvidence?{evidence:e.confidenceEvidence,coverage:"venue-representative"}:void 0,t.now,t.eventConfigurationVersion??e.eventConfigurationVersion);return t.resolveEyeHeights!==!1&&Xr(e.objects,e.focalPoint,t.floorBaseHeightM??0,n),Rl(e,n,t)}function Rl(e,t,n){return!n.deriveRestrictedView||e.derivedRestrictedView===!1||n.resolveEyeHeights===!1||zr(t,Gr(t,Nr(e))),t}function Xr(e,t,n,r){let o=e.filter(u=>u.type==="section"),i=n>0||o.some(u=>u.height!==void 0||u.rake!==void 0||(u.elevation??0)>0);if(!o.length||!i||!t){for(let u of r)u.eyeHeightM=n+Re;return}let a=new Array(r.length),s=new Map,c=new Map;for(let u=0;u<r.length;u++){let p=r[u],l=(p.sectionId?o.find(b=>b.id===p.sectionId)??o.find(b=>b.logicalSectionId===p.sectionId&&ot({x:p.x,y:p.y},b.outline,b.holes)):void 0)??o.find(b=>ot({x:p.x,y:p.y},b.outline,b.holes))??null;if(a[u]=l,!l)continue;s.has(l.id)||s.set(l.id,en(l,{floorBaseHeightM:n}));let f=c.get(l.id);f?f.push(u):c.set(l.id,[u])}let m=new Array(r.length).fill(void 0);for(let[u,p]of c){let d=s.get(u);if(!d)continue;let l=d.rake>0?Math.tan(d.rake*Math.PI/180):0,f=cn(u,r,p,t);for(let b of f.rows){let h=b.blockDepth*be*l,y=d.height+h;for(let x of b.seatIndices)m[x]=y}}for(let u=0;u<r.length;u++){let p=r[u],d=a[u];if(!d){p.eyeHeightM=n+Re;continue}let l=s.get(d.id);p.eyeHeightM=(m[u]??l.height)+Re}}function Tl(e){return{kind:"radial",rowCount:0,rows:[],nearestRow:()=>-1,depthAt:(t,n)=>Math.hypot(t-e.x,n-e.y),gradientAt:(t,n)=>{let r=t-e.x,o=n-e.y,i=Math.hypot(r,o);return i<1e-9?[0,0]:[r/i,o/i]}}}function _l(e,t){if(!e.length)return null;let n=0,r=0,o=0;for(let l of e)n+=l.x,r+=l.y,o+=Math.hypot(l.x-t.x,l.y-t.y);let i=e.length;n/=i,r/=i,o/=i;let a=e[0],s=-1;for(let l of e){let f=Math.hypot(l.x-n,l.y-r);f>s&&(s=f,a=l)}let c=a.x-n,m=a.y-r,u=Math.hypot(c,m);u>1e-9?(c/=u,m/=u):(c=1,m=0);let p=[...e].sort((l,f)=>(l.x-n)*c+(l.y-r)*m-((f.x-n)*c+(f.y-r)*m)),d=0;for(let l of p){let f=Math.hypot(l.x-n,l.y-r);f>d&&(d=f)}return{pts:p,cx:n,cy:r,radius:d,depth:o}}function qr(e,t,n){let r=e.pts;if(r.length===1)return Math.hypot(t-r[0].x,n-r[0].y);let o=1/0;for(let i=0;i+1<r.length;i++){let a=r[i],s=r[i+1],c=s.x-a.x,m=s.y-a.y,u=c*c+m*m,p=u>1e-12?((t-a.x)*c+(n-a.y)*m)/u:0;p<0?p=0:p>1&&(p=1);let d=Math.hypot(t-(a.x+p*c),n-(a.y+p*m));d<o&&(o=d)}return o}var mn=8;function Ll(e,t,n){let r=new Array(mn).fill(1/0),o=new Array(mn).fill(-1);for(let u=0;u<e.length;u++){let p=e[u],d=Math.hypot(t-p.cx,n-p.cy)-p.radius;for(let l=0;l<mn;l++)if(d<r[l]){for(let f=mn-1;f>l;f--)r[f]=r[f-1],o[f]=o[f-1];r[l]=d,o[l]=u;break}}let i=new Array(3).fill(1/0),a=new Array(3).fill(-1);for(let u of o){if(u<0)continue;let p=qr(e[u],t,n);for(let d=0;d<3;d++)if(p<i[d]){for(let l=2;l>d;l--)i[l]=i[l-1],a[l]=a[l-1];i[d]=p,a[d]=u;break}}if(a[0]<0)return 0;if(i[0]<1e-6)return e[a[0]].depth;let s=i[0]*2.2,c=0,m=0;for(let u=0;u<3;u++){let p=a[u];if(p<0||i[u]>s)continue;let d=1/(i[u]*i[u]);c+=d*e[p].depth,m+=d}return m>0?c/m:e[a[0]].depth}function kl(e){let t=(r,o)=>Ll(e,r,o),n=(r,o)=>{let i=1/0,a=-1;for(let s=0;s<e.length;s++){let c=e[s];if(Math.hypot(r-c.cx,o-c.cy)-c.radius>=i)continue;let m=qr(c,r,o);m<i&&(i=m,a=s)}return a};return{kind:"rows",rowCount:e.length,rows:e,nearestRow:n,depthAt:t,gradientAt:(r,o)=>{let i=(t(r+.5,o)-t(r-.5,o))/1,a=(t(r,o+.5)-t(r,o-.5))/(2*.5),s=Math.hypot(i,a);return s<1e-9?[0,0]:[i/s,a/s]}}}function $r(e,t){let n=[];for(let r of e){let o=_l(r.points,t);o&&n.push(o)}return n.length<2?Tl(t):(n.sort((r,o)=>r.depth-o.depth),kl(n))}var po=mt(require("polygon-clipping"),1);var ei=mt(require("earcut"),1);var Fl=.58,Qr=.01,Ce=De*1.5*He,Dl=.5,Ol=.6;function Vl(e,t){let n=e.length,r=[];for(let a=0;a<n;a++){let s=e[Math.max(0,a-1)],c=e[Math.min(n-1,a+1)],m=c.x-s.x,u=c.y-s.y,p=Math.hypot(m,u);if(p<1e-9){r.push([0,0]);continue}m/=p,u/=p,r.push([-u,m])}let o=0;for(let a=0;a<n;a++)o+=(e[a].x-t.x)*r[a][0]+(e[a].y-t.y)*r[a][1];return o<0?r.map(([a,s])=>[-a,-s]):r}function Bl(e,t){if(e.length<2||t<=0)return[...e];let n=[...e],r=(a,s)=>{let c=s.x-a.x,m=s.y-a.y,u=Math.hypot(c,m)||1;return{x:c/u,y:m/u}},o=r(n[1],n[0]),i=r(n[n.length-2],n[n.length-1]);return n.unshift({x:n[0].x+o.x*t,y:n[0].y+o.y*t}),n.push({x:n[n.length-1].x+i.x*t,y:n[n.length-1].y+i.y*t}),n}var Zr=Math.PI/12;function Nl(e){if(e.length<3)return[...e];let t=[...e].sort((i,a)=>i.x-a.x||i.y-a.y),n=(i,a,s)=>(a.x-i.x)*(s.y-i.y)-(a.y-i.y)*(s.x-i.x),r=i=>{let a=[];for(let s of i){for(;a.length>=2&&n(a[a.length-2],a[a.length-1],s)<=0;)a.pop();a.push(s)}return a.pop(),a},o=[...r(t),...r([...t].reverse())];return o.length>=3?o:[...e]}function ti(e,t){if(!e.length||!(t>0))return[];let n=Nl(e),r=(s,c,m,u)=>{let p=m-c;for(;p<0;)p+=Math.PI*2;for(;p>Math.PI*2;)p-=Math.PI*2;let d=Math.max(1,Math.ceil(p/Zr)),l=t/Math.cos(p/d/2);for(let f=0;f<=d;f++){let b=c+p*f/d;u.push({x:s.x+Math.cos(b)*l,y:s.y+Math.sin(b)*l})}};if(n.length<3){let s=0,c=0;for(let l of n)s+=l.x,c+=l.y;s/=n.length||1,c/=n.length||1;let m=0;for(let l of n)m=Math.max(m,Math.hypot(l.x-s,l.y-c));let u=[],p=Math.max(3,Math.ceil(Math.PI*2/Zr)),d=(m+t)/Math.cos(Math.PI/p);for(let l=0;l<p;l++){let f=l/p*Math.PI*2;u.push({x:s+Math.cos(f)*d,y:c+Math.sin(f)*d})}return u}let o=n.length,i=[];for(let s=0;s<o;s++){let c=n[s],m=n[(s+1)%o];i.push(Math.atan2(-(m.x-c.x),m.y-c.y))}let a=[];for(let s=0;s<o;s++)r(n[s],i[(s+o-1)%o],i[s],a);return ai(a)}function Gl(e,t,n){if(e.length===1)return Math.hypot(t-e[0].x,n-e[0].y);let r=1/0;for(let o=0;o+1<e.length;o++){let i=e[o],a=e[o+1],s=a.x-i.x,c=a.y-i.y,m=s*s+c*c,u=m>1e-12?((t-i.x)*s+(n-i.y)*c)/m:0;u<0?u=0:u>1&&(u=1);let p=Math.hypot(t-(i.x+u*s),n-(i.y+u*c));p<r&&(r=p)}return r}function dn(e){let t=e.map(o=>{let i=0,a=0;for(let m of o.pts)i+=m.x,a+=m.y;let s=o.pts.length||1;i/=s,a/=s;let c=0;for(let m of o.pts){let u=Math.hypot(m.x-i,m.y-a);u>c&&(c=u)}return{cx:i,cy:a,rad:c}}),n=o=>{let i=o.length;return i<=2?[...o]:[o[Math.floor(i*.25)],o[Math.floor(i*.5)],o[Math.floor(i*.75)]]},r=[];for(let o=0;o<e.length;o++){let i=n(e[o].pts),a=[],s=1/0,c=null;for(let u of i){let p=1/0;for(let d=0;d<e.length;d++){if(d===o||Math.abs(e[d].y-e[o].y)<.001)continue;let l=t[d],f=Math.hypot(u.x-l.cx,u.y-l.cy)-l.rad;if(f>=p&&f>=s)continue;let b=Gl(e[d].pts,u.x,u.y);b<p&&(p=b),e[d].depth<e[o].depth&&b<s&&(s=b,c=e[d].y)}Number.isFinite(p)&&p>0&&a.push(p)}a.sort((u,p)=>u-p);let m=a.length?a[Math.floor(a.length/2)]:1;r.push({pitch:m,belowY:c})}return r}function ni(e,t,n,r){let o=e[t],i=o.pts.length>=2?[...o.pts]:o.pts.length===1?(()=>{let u=o.pts[0],p=u.x-r.x,d=u.y-r.y,l=Math.hypot(p,d)||1;p/=l,d/=l;let f=Math.max(n[t].pitch,.001)*.5;return[{x:u.x+d*f,y:u.y-p*f},{x:u.x-d*f,y:u.y+p*f}]})():[];if(i.length<2)return null;let a=0,s=0;for(let u=1;u<i.length;u++){let p=Math.hypot(i[u].x-i[u-1].x,i[u].y-i[u-1].y);p>1e-6&&(a+=p,s++)}let c=s>0?a/s:0,m=Bl(i,Math.max(c*Ol,Ce));return{pts:m,nrm:Vl(m,r),front:Math.max(n[t].pitch*Fl,Ce),back:Math.max(n[t].pitch*Dl,Ce)}}var xt=1.5,oi=.3;function mo(e,t){if(e.length<3)return e;let n=e[0],r=e[e.length-1],o=r.x-n.x,i=r.y-n.y,a=Math.hypot(o,i),s=-1,c=-1;for(let p=1;p<e.length-1;p++){let d=e[p],l=a>1e-12?Math.abs((d.x-n.x)*i-(d.y-n.y)*o)/a:Math.hypot(d.x-n.x,d.y-n.y);l>s&&(s=l,c=p)}if(s<=t||c<0)return[n,r];let m=mo(e.slice(0,c+1),t),u=mo(e.slice(c),t);return[...m.slice(0,-1),...u]}function ri(e,t){if(e.length<4)return e;let n=mo([...e,e[0]],t);return n.pop(),n.length>=3?n:e}function ii(e,t,n){if(e.length<2)return[];let r=n??dn(e),o=new Map;for(let a=0;a<e.length;a++){let s=o.get(e[a].blockId);s?s.push(a):o.set(e[a].blockId,[a])}let i=[];for(let[,a]of o){let s=[];for(let x of a){let g=e[x].patch;g&&g.length>=3?i.push({outline:[...g],holes:[],topY:e[x].y}):s.push(x)}if(!s.length)continue;s.sort((x,g)=>e[x].depth-e[g].depth);let m=s.map(x=>ni(e,x,r,t)).filter(x=>x!==null);if(!m.length)continue;let u=(x,g)=>({x:x.pts[g].x-x.nrm[g][0]*(x.front+xt),y:x.pts[g].y-x.nrm[g][1]*(x.front+xt)}),p=(x,g)=>({x:x.pts[g].x+x.nrm[g][0]*(x.back+xt),y:x.pts[g].y+x.nrm[g][1]*(x.back+xt)}),d=m[0],l=m[m.length-1],f=[];for(let x=0;x<d.pts.length;x++)f.push(u(d,x));for(let x of m)f.push(p(x,x.pts.length-1));for(let x=l.pts.length-1;x>=0;x--)f.push(p(l,x));for(let x=m.length-1;x>=0;x--)f.push(u(m[x],0));let b=ai(f),h=1/0;for(let x of s)e[x].y<h&&(h=e[x].y);if(!Number.isFinite(h))continue;if(b.length>=3&&Math.abs(et(b))>1e-6&&m.every(x=>{let g=x.pts[Math.floor(x.pts.length/2)];return kt(b,g.x,g.y)})){i.push({outline:ri(b,oi),holes:[],topY:h});continue}for(let x of zl(m))i.push({outline:x,holes:[],topY:h})}return i}function zl(e){let t=[];for(let n of e){let r=[],o=[],i=n.front+xt,a=n.back+xt;for(let c=0;c<n.pts.length;c++){let m=n.pts[c],u=n.nrm[c];r.push([m.x-u[0]*i,m.y-u[1]*i]),o.push([m.x+u[0]*a,m.y+u[1]*a])}let s=[...r,...o.reverse()];s.length<3||(s.push(s[0]),t.push([s]))}if(!t.length)return[];try{let n=po.default.union(t[0],...t.slice(1)),r=[];for(let o of n){if(!o.length||o[0].length<4)continue;let i=o[0].map(([c,m])=>({x:c,y:m})),a=i[0],s=i[i.length-1];i.length>1&&Math.abs(a.x-s.x)<1e-9&&Math.abs(a.y-s.y)<1e-9&&i.pop(),i.length>=3&&r.push(ri(i,oi))}return r}catch{return[]}}function ai(e){let t=[];for(let n of e){let r=t[t.length-1];r&&Math.hypot(n.x-r.x,n.y-r.y)<1e-9||t.push(n)}for(;t.length>2&&Math.hypot(t[0].x-t[t.length-1].x,t[0].y-t[t.length-1].y)<1e-9;)t.pop();return t}var fo=class{constructor(t){this.minX=1/0;this.minY=1/0;this.maxX=-1/0;this.maxY=-1/0;this.rings=t;for(let n of t)for(let r of n)r.x<this.minX&&(this.minX=r.x),r.y<this.minY&&(this.minY=r.y),r.x>this.maxX&&(this.maxX=r.x),r.y>this.maxY&&(this.maxY=r.y)}containsAll(t){for(let n of t)if(n.x<this.minX||n.x>this.maxX||n.y<this.minY||n.y>this.maxY)return!1;for(let n of this.rings){let r=!0;for(let o of t)if(!kt(n,o.x,o.y)){r=!1;break}if(r)return!0}return!1}};function Jr(e,t,n,r,o,i){if(r.length<3)return;if(n.containsAll(r)){let m=[0,1,0],u=r[0];for(let p=1;p+1<r.length;p++){let d=r[p],l=r[p+1];e.tri([u.x*G,o,u.y*G],[d.x*G,o,d.y*G],[l.x*G,o,l.y*G],m,i)}return}let a=r.map(m=>[m.x,m.y]);a.push(a[0]);let s;try{s=po.default.intersection([a],t)}catch{return}let c=[0,1,0];for(let m of s){if(!m.length||m[0].length<4)continue;let u=m[0],p=[],d=[];for(let f=0;f<u.length-1;f++)p.push(u[f][0],u[f][1]),d.push([u[f][0],u[f][1]]);if(d.length<3)continue;let l=(0,ei.default)(p,void 0,2);for(let f=0;f<l.length;f+=3){let b=d[l[f]],h=d[l[f+1]],y=d[l[f+2]];e.tri([b[0]*G,o,b[1]*G],[h[0]*G,o,h[1]*G],[y[0]*G,o,y[1]*G],c,i)}}}function si(e,t,n,r,o,i,a){if(t.length<2)return;let s=a??dn(t),c=[0,1,0],m=i&&i.length>=3?[[...i.map(l=>[l.x,l.y]),[i[0].x,i[0].y]]]:null,u=i&&i.length>=3?new fo([[...i]]):null,p=l=>{e.setMaterial(2),l(),e.setMaterial(0)},d=l=>{e.setMaterial(3),l(),e.setMaterial(0)};for(let l=0;l<t.length;l++){let f=t[l];if(f.patch&&f.patch.length>=3){let A=[...f.patch],P=s[l].belowY??r;if(d(()=>{if(m&&u)Jr(e,m,u,A,f.y,o.tread);else{let M=A[0];for(let E=1;E+1<A.length;E++){let D=A[E],z=A[E+1];e.tri([M.x*G,f.y,M.y*G],[D.x*G,f.y,D.y*G],[z.x*G,f.y,z.y*G],c,o.tread)}}}),f.y>P+Qr){let M=0,E=0;for(let D of A)M+=D.x,E+=D.y;M/=A.length,E/=A.length,p(()=>{for(let D=0;D<A.length;D++){let z=A[D],V=A[(D+1)%A.length],L=V.x-z.x,C=V.y-z.y,_=Math.hypot(L,C);if(_<1e-6)continue;let B=C/_,S=-L/_;(z.x-M)*B+(z.y-E)*S<0&&(B=-B,S=-S);let I=[B,0,S],T=[z.x*G,f.y,z.y*G],w=[V.x*G,f.y,V.y*G],k=[z.x*G,P,z.y*G],R=[V.x*G,P,V.y*G];e.tri(T,w,R,I,o.riser),e.tri(T,R,k,I,o.riser)}})}continue}let b=ni(t,l,s,n);if(!b)continue;let{pts:h,nrm:y,front:x,back:g}=b,v=s[l].belowY??r;for(let A=0;A+1<h.length;A++){let P=h[A],M=h[A+1],E=y[A],D=y[A+1];if(Math.hypot(M.x-P.x,M.y-P.y)<1e-6||E[0]===0&&E[1]===0||D[0]===0&&D[1]===0)continue;let z=[(P.x-E[0]*x)*G,f.y,(P.y-E[1]*x)*G],V=[(M.x-D[0]*x)*G,f.y,(M.y-D[1]*x)*G],L=[(P.x+E[0]*g)*G,f.y,(P.y+E[1]*g)*G],C=[(M.x+D[0]*g)*G,f.y,(M.y+D[1]*g)*G];if(d(()=>{m&&u?Jr(e,m,u,[{x:P.x-E[0]*x,y:P.y-E[1]*x},{x:M.x-D[0]*x,y:M.y-D[1]*x},{x:M.x+D[0]*g,y:M.y+D[1]*g},{x:P.x+E[0]*g,y:P.y+E[1]*g}],f.y,o.tread):(e.tri(z,V,C,c,o.tread),e.tri(z,C,L,c,o.tread))}),f.y>v+Qr){let _=[z[0],v,z[2]],B=[V[0],v,V[2]],S=[-E[0],0,-E[1]];p(()=>{e.tri(z,V,B,S,o.riser),e.tri(z,B,_,S,o.riser)})}}}}function ci(e){let t=1/0,n=1/0,r=-1/0,o=-1/0,i=!1;for(let a of e)!Number.isFinite(a.x)||!Number.isFinite(a.y)||(i=!0,a.x<t&&(t=a.x),a.y<n&&(n=a.y),a.x>r&&(r=a.x),a.y>o&&(o=a.y));return i?{minX:t,minY:n,maxX:r,maxY:o}:null}function fn(e,t){return e.minX<=t.maxX&&t.minX<=e.maxX&&e.minY<=t.maxY&&t.minY<=e.maxY}var ho=mt(require("polygon-clipping"),1);function Ul(e,t){let n=e.eventConfigurationIds;return!n?.length||!!t&&n.includes(t)}function li(e,t){return e.filter(n=>n.type!=="shape"||Ul(n,t))}function ui(e,t){let n=e.focalPoint??{x:0,y:0};return e.floors?.length?e.floors.map((r,o)=>({objects:li(r.objects,t),focal:{x:(r.focalPoint??n).x,y:(r.focalPoint??n).y},baseHeightM:r.baseHeightM??0,index:o})):[{objects:li(e.objects,t),focal:n,baseHeightM:0,index:0}]}var Hl={minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};function vt(e){return ci(e)??Hl}function mi(e,t){let n=rn(e.outline,Ce),r=vt(n),o=t.filter(a=>a!==e&&a.outline&&a.outline.length>=3&&fn(r,vt(a.outline)));if(!o.length)return[n];let i=a=>{let s=a.map(c=>[c.x,c.y]);return s.push(s[0]),s};try{let a=ho.default.difference([i(n)],...o.map(c=>[i(c.outline)])),s=[];for(let c of a){if(!c.length)continue;let m=c[0].map(([u,p])=>({x:u,y:p}));if(m.length>1){let u=m[0],p=m[m.length-1];Math.abs(u.x-p.x)<1e-9&&Math.abs(u.y-p.y)<1e-9&&m.pop()}m.length>=3&&s.push(m)}return s.length?s:[n]}catch{return[n]}}function di(e,t){if(!t.length)return e;let n=i=>{let a=i.map(s=>[s.x,s.y]);return a.push(a[0]),a},r=t.map(i=>[n(i)]),o=[];for(let i of e){let a;try{a=ho.default.intersection([n(i.outline)],r.flat())}catch{o.push(i);continue}for(let s of a){if(!s.length)continue;let c=s[0].map(([m,u])=>({x:m,y:u}));if(c.length>1){let m=c[0],u=c[c.length-1];Math.abs(m.x-u.x)<1e-9&&Math.abs(m.y-u.y)<1e-9&&c.pop()}c.length>=3&&o.push({outline:c,holes:[],topY:i.topY})}}return o.length?o:e}var jl=.05,fi=.05,Yl=.15,bo=25;function pi(e,t,n){let r=new Map,o=new Array(t.length).fill(null),i=new Float64Array(t.length),a=new Array(t.length).fill(void 0),s=new Array(t.length).fill(void 0),c=new Map,m=[],u=new Set;for(let d=0;d<e.length;d+=1){let l=e[d];for(let f of l.objects){if(f.type==="table"&&u.add(f.id),f.type!=="section"||!f.outline||f.outline.length<3)continue;let b=rn(f.outline,Ce);c.set(f.id,{section:f,unit:l,frontU:1/0,hasSeats:!1,rows:new Map,seatIndices:[]}),m.push({id:f.id,floorIndex:d,box:vt(b),section:f,unit:l,outline:b})}}let p=new Map;for(let d of m){let l=p.get(d.floorIndex);l?l.push(d):p.set(d.floorIndex,[d])}for(let d=0;d<t.length;d++){let l=t[d],f=n?p.get(n[d])??[]:m,b=l.sectionId?f.find(y=>y.id===l.sectionId)??f.find(y=>y.section.logicalSectionId===l.sectionId&&ot({x:l.x,y:l.y},y.outline,y.section.holes)):void 0,h=b?[b]:f;for(let y of h){if(n&&y.floorIndex!==n[d]||!b&&(l.x<y.box.minX||l.x>y.box.maxX||l.y<y.box.minY||l.y>y.box.maxY||!ot({x:l.x,y:l.y},y.outline,y.section.holes)))continue;o[d]=y.id;let x=c.get(y.id);x.hasSeats=!0;let g=l.focalPoint??y.unit.focal,v=Math.hypot(l.x-g.x,l.y-g.y);v<x.frontU&&(x.frontU=v),x.seatIndices.push(d);let A=l.rowId||`__seat-${d}`,P=x.rows.get(A);P?P.push({x:l.x,y:l.y}):x.rows.set(A,[{x:l.x,y:l.y}]);break}}for(let[d,l]of c){let f=en(l.section,{floorBaseHeightM:l.unit.baseHeightM}),b=l.unit.baseHeightM,h=f.rake>0?Math.tan(f.rake*Math.PI/180):0,y=f.rake<=.01&&f.height<=b+.001,x=l.section.surfaceKind,g=x==="flat"?!0:x==="rakedRows"&&f.rake>.01?!1:y,v=l.hasSeats?cn(d,t,l.seatIndices,l.unit.focal):{sectionId:d,rows:[],blockCount:0},P=v.rows.length<2?$r([...l.rows.values()].map(T=>({points:T})),l.unit.focal):null,M=1/0;if(P){if(l.hasSeats)for(let T of l.rows.values())for(let w of T){let k=P.depthAt(w.x,w.y);k<M&&(M=k)}if(!l.hasSeats||!Number.isFinite(M)){M=1/0;for(let T of l.section.outline){let w=P.depthAt(T.x,T.y);w<M&&(M=w)}}}let E=b+jl,D=Math.max(E,f.height),z=T=>{let w=Math.max(0,T-M)*be,k=Math.min(w*h,bo);return Math.max(E,f.height+k)},V=T=>{let w=Math.max(0,T)*be,k=Math.min(w*h,bo);return Math.max(E,f.height+k)},L=g?[]:v.rows.map(T=>({pts:T.pts,y:V(T.blockDepth),depth:T.blockDepth,blockId:T.blockId,...u.has(T.id)?{patch:ti(T.pts,Ce)}:{}})),C=L.length?L[0].y:D,_=L.map(T=>{let w=T.patch&&T.patch.length>=3?T.patch:T.pts,k=0,R=0;for(let H of w)k+=H.x,R+=H.y;let O=w.length||1;k/=O,R/=O;let j=0;for(let H of w){let N=Math.hypot(H.x-k,H.y-R);N>j&&(j=N)}return{cx:k,cy:R,rad:j}}),B=g?()=>D:L.length>=2?(T,w)=>{let k=1/0,R=C;for(let O=0;O<L.length;O++){let j=_[O];if(Math.hypot(T-j.cx,w-j.cy)-j.rad>=k)continue;let H=L[O].patch,N=H&&H.length>=3?kt(H,T,w)?0:yt(H,T,w):yt(L[O].pts,T,w);N<k&&(k=N,R=L[O].y)}return R}:(T,w)=>P?z(P.depthAt(T,w)):D,S=[0,1,0],I=L.length>=2||g?()=>S:(T,w)=>{if(!P)return S;let k=P.depthAt(T,w);if(k<=M)return S;let R=(k-M)*be;if(R*h>=bo||f.height+R*h<=E)return S;let[O,j]=P.gradientAt(T,w);if(O===0&&j===0)return S;let H=1/Math.hypot(h,1);return[-O*h*H,H,-j*h*H]};if(!g)for(let T of v.rows){let w=V(T.blockDepth);for(let k of T.seatIndices)a[k]=w}for(let T of v.rows){let w=[];for(let H=1;H<T.pts.length;H++){let N=Math.hypot(T.pts[H].x-T.pts[H-1].x,T.pts[H].y-T.pts[H-1].y);N>1e-6&&w.push(N)}w.sort((H,N)=>H-N);let k=w.length?w[Math.floor(w.length/2)]:1/0,R=1/0,O=T.pts[Math.floor(T.pts.length/2)];if(O)for(let H of v.rows){if(H===T||H.blockId!==T.blockId)continue;let N=yt(H.pts,O.x,O.y);N>1e-6&&N<R&&(R=N)}let j=Math.min(k,Math.max(R,k*.5));if(Number.isFinite(j)&&j>0)for(let H of T.seatIndices)s[H]=j}r.set(d,{sectionId:d,deckAt:B,normalAt:I,flat:g,bottomY:b,rowLevels:L,landingY:C})}for(let d=0;d<t.length;d++){let l=o[d],f=t[d];if(l){let h=a[d];i[d]=(h??r.get(l).deckAt(f.x,f.y))+Yl;continue}let b=f.eyeHeightM;i[d]=Number.isFinite(b)?Math.max(0,b-Re):0}return{bySection:r,seatOwner:o,seatDeckY:d=>i[d],seatPitchU:d=>s[d]}}var le={top:1,wallBottom:.5,bottomCap:.4};function Oe(e,t){if(!e)return t;let n=Pe(It(e,.4),.62);return ge(t,n,.72)}function hi(e,t){let n=new Map;for(let i of e.categories??[])n.set(i.key,i.color);let r=new Map;for(let i of t){if(!i.sectionId)continue;let a=r.get(i.sectionId);a||(a=new Map,r.set(i.sectionId,a)),a.set(i.categoryKey,(a.get(i.categoryKey)??0)+1)}let o=new Map;for(let[i,a]of r){let s=0,c=0,m=0,u=0;for(let[p,d]of a){let l=ne(n.get(p));l&&(s+=l[0]*d,c+=l[1]*d,m+=l[2]*d,u+=d)}u>0&&o.set(i,[s/u,c/u,m/u])}return o}function bi(e,t){return ne(e.color)??t.get(e.logicalSectionId??e.id)??null}var yi=mt(require("polygon-clipping"),1);function Xl(e,t){return e===void 0||t===void 0?!0:Math.abs(e-t)<.001}var pn=class{constructor(){this.rings=[];this.boxes=[];this.levels=[]}subtract(t,n){let r=t.map(c=>[c.x,c.y]);if(r.length<3)return[];r.push(r[0]);let o=vt(t),i=this.rings.filter((c,m)=>fn(o,this.boxes[m])&&Xl(n,this.levels[m])),a=[[r]];if(i.length)try{a=yi.default.difference([r],...i).map(m=>m.map(u=>u.map(([p,d])=>[p,d])))}catch{a=[[r]]}this.rings.push([r]),this.boxes.push(o),this.levels.push(n);let s=[];for(let c of a){if(!c.length)continue;let m=c[0].map(([u,p])=>({x:u,y:p}));if(m.length>1){let u=m[0],p=m[m.length-1];Math.abs(u.x-p.x)<1e-9&&Math.abs(u.y-p.y)<1e-9&&m.pop()}m.length>=3&&s.push(m)}return s}};function Wl(e,t){if(!t)return e;let n=1/0,r=-1/0,o=1/0,i=-1/0;for(let p of e)n=Math.min(n,p.x),r=Math.max(r,p.x),o=Math.min(o,p.y),i=Math.max(i,p.y);let a=(n+r)/2,s=(o+i)/2,c=t*Math.PI/180,m=Math.cos(c),u=Math.sin(c);return e.map(p=>{let d=p.x-a,l=p.y-s;return{x:a+d*m-l*u,y:s+d*u+l*m}})}function rt(e){let t=null;if(e.kind==="polygon"&&e.points&&e.points.length>=3&&(t=e.points),e.kind==="rect"&&e.width&&e.height&&(t=Ot(e.x??0,e.y??0,e.width,e.height)),e.kind==="ellipse"&&e.width&&e.height){let n=(e.x??0)+e.width/2,r=(e.y??0)+e.height/2;t=an(n,r,e.width/2,e.height/2)}return t?Wl(t,e.rotation):null}function Nt(e){let t=e.role??"",n={stage:{kind:"stage",heightM:1},entrance:{kind:"portal",heightM:2.7},exit:{kind:"portal",heightM:2.7},screen:{kind:"solid",heightM:6},wall:{kind:"solid",heightM:2.8},rail:{kind:"solid",heightM:1.1},suite:{kind:"suite",heightM:3},obstruction:{kind:"solid",heightM:4.5},sound:{kind:"solid",heightM:1.45},restroom:{kind:"solid",heightM:2.4},bar:{kind:"solid",heightM:1.1},concession:{kind:"solid",heightM:1.1},coat:{kind:"solid",heightM:1.1},goal:{kind:"portal",heightM:1.8}},r=t==="stage"&&ln(e.stageKind)?{kind:"stage",heightM:.06}:n[t]??{kind:"plate",heightM:.25};return{...r,heightM:e.heightM??r.heightM}}var Kl=.08;function gi(e,t){let n=rt(e),r=Nt(e),o=r.heightM;if(!n||r.kind!=="plate"&&r.kind!=="stage")return o;let i=1/0,a=1/0,s=-1/0,c=-1/0;for(let u of n)i=Math.min(i,u.x),a=Math.min(a,u.y),s=Math.max(s,u.x),c=Math.max(c,u.y);let m=o;for(let u of t)s>u.minX&&i<u.maxX&&c>u.minY&&a<u.maxY&&m<=u.topOffsetM+1e-6&&(m=u.topOffsetM+Kl);return t.push({minX:i,minY:a,maxX:s,maxY:c,topOffsetM:m}),m}function je(e,t,n){return{x:e.x+(t.x-e.x)*n,y:e.y+(t.y-e.y)*n}}function xi(e){if(e.length!==4)return e;let t=Math.hypot(e[1].x-e[0].x,e[1].y-e[0].y),n=Math.hypot(e[2].x-e[1].x,e[2].y-e[1].y);return t>=n?e:[e[1],e[2],e[3],e[0]]}function Gt(e,t,n){return[je(e[0],e[1],t),je(e[0],e[1],n),je(e[3],e[2],n),je(e[3],e[2],t)]}function vi(e,t,n){return[je(e[0],e[3],t),je(e[1],e[2],t),je(e[1],e[2],n),je(e[0],e[3],n)]}function Ve(e,t,n,r,o,i){ue(e,t,void 0,()=>n,r,o,i,le)}var yo=2.4,ql=.75,$l=.15;function zt(e){if(e.points&&e.points.length>=3)return e.points;let{center:t,width:n,height:r,rotation:o}=e;if(!n||!r)return null;let i=(o??0)*Math.PI/180,a=Math.cos(i),s=Math.sin(i),c=n/2,m=r/2;return[[-c,-m],[c,-m],[c,m],[-c,m]].map(([u,p])=>({x:t.x+u*a-p*s,y:t.y+u*s+p*a}))}function Si(e,t,n,r,o){let i=zt(t);i&&ue(e,i,void 0,()=>n+yo,n,Oe(r,o.boothTop),o.boothWall,le)}function go(e){if(e.shape==="round"){let u=e.radius;return u?an(e.center.x,e.center.y,u,u,24):null}let{width:t,height:n,rotation:r,center:o}=e;if(!t||!n)return null;let i=(r??0)*Math.PI/180,a=Math.cos(i),s=Math.sin(i),c=t/2,m=n/2;return[[-c,-m],[c,-m],[c,m],[-c,m]].map(([u,p])=>({x:o.x+u*a-p*s,y:o.y+u*s+p*a}))}function Mi(e,t,n,r,o){let i=go(t);i&&ue(e,i,void 0,()=>n+ql,n,Oe(r,o.tableTop),o.tableWall,le)}function wi(e,t,n,r,o,i,a,s){let c=rt(t);if(!c)return;let m=s?s.kind==="stage":t.role==="stage",u=s?s.kind==="screen":t.role==="screen",p=s?{kind:m?"stage":"solid",heightM:s.topY-s.baseY}:Nt(t),d=s?.baseY??n,l=s?.topY??n+r;if(m&&a){let x=1/0,g=-1/0,v=1/0,A=-1/0;for(let P of c)P.x<x&&(x=P.x),P.x>g&&(g=P.x),P.y<v&&(v=P.y),P.y>A&&(A=P.y);a.push({cx:(x+g)/2*G,cz:(v+A)/2*G,y:l,halfX:Math.max((g-x)/2*G,.5),halfZ:Math.max((A-v)/2*G,.5)})}let f=ne(t.fill),b=m&&f?ge(o.stageTop,Pe(It(f,.18),.9),.9):Oe(f,m?o.stageTop:o.decorTop),h=u?f:null,y=m?f?ge(o.stageWall,Pe(f,.58),.82):o.stageWall:u?h?ge(Pe(h,1.42),[.24,.46,.82],.08):[.24,.46,.82]:Oe(ne(t.fill),o.decorWall);if(p.kind==="portal"&&c.length===4){let x=xi(c);Ve(e,Gt(x,0,.16),l,d,b,y),Ve(e,Gt(x,.84,1),l,d,b,y),Ve(e,x,l,Math.max(d,l-.35),b,y);return}if(p.kind==="suite"&&c.length===4){let x=c.map((A,P)=>{let M=c[(P+1)%4],E=(A.x+M.x)/2,D=(A.y+M.y)/2;return Math.hypot(E-i.x,D-i.y)}),g=x.indexOf(Math.min(...x)),v=[0,1,2,3].map(A=>c[(g+A)%4]);Ve(e,Gt(v,0,.08),l,d,b,y),Ve(e,Gt(v,.92,1),l,d,b,y),Ve(e,vi(v,.88,1),l,d,b,y),Ve(e,v,l,Math.max(d,l-.18),b,y);return}Ve(e,c,l,d,b,y)}function xo(e){let{x:t,y:n,width:r,height:o}=e;if(!r||!o)return null;let i=t+r/2,a=n+o/2,s=(e.rotation??0)*Math.PI/180,c=Math.cos(s),m=Math.sin(s),u=r/2,p=o/2;return[[-u,-p],[u,-p],[u,p],[-u,p]].map(([d,l])=>({x:i+d*c-l*m,y:a+d*m+l*c}))}function Ql(e){if(!e||!e.startsWith("data:image/svg+xml"))return null;let t=e.slice(e.indexOf(",")+1);if(/;base64/i.test(e.slice(0,e.indexOf(","))))try{t=atob(t)}catch{return null}else try{t=decodeURIComponent(t)}catch{}let n=t.match(/<(?:rect|path)\b[^>]*\bfill="([^"]+)"/i);if(!n)return null;let r=n[1].trim();if(r==="none"||r==="transparent")return null;let o=r.match(/^url\(#([^)]+)\)$/);if(!o)return ne(r);let i=t.match(new RegExp(`<(?:linear|radial)Gradient\\b[^>]*\\bid="${o[1]}"[^>]*>([\\s\\S]*?)</(?:linear|radial)Gradient>`,"i"));if(!i)return null;let a=[];for(let s of i[1].matchAll(/stop-color="([^"]+)"/gi)){let c=ne(s[1].trim());c&&a.push(c)}return a.length?a.reduce((s,c,m)=>ge(s,c,1/(m+1)),a[0]):null}function Pi(e,t,n,r){if(t.layer==="foreground")return;let o=xo(t);if(!o)return;let i=n+$l,a=Oe(Ql(t.href),r.decorTop),s=Math.max(0,Math.min(1,t.opacity??1));s<1&&(a=ge(r.ground,a,s)),ue(e,o,void 0,()=>i,n,a,ge(a,r.decorWall,.5),le)}function Ci(e,t,n,r,o){if(!t.points||t.points.length<3)return;let i=Oe(r,o.gaTop);ue(e,t.points,t.holes,()=>n+.15,n,i,o.gaWall,le)}var Zl=Math.PI/180,oe=96,Jl=6,eu=60,tu=150,Ai=.2,nu=.35;function ou(e,t){let n=Math.atan2(t.x-e.x,t.y-e.y)/Zl;return n<0?n+360:n}function hn(e){if(!e.length)return NaN;let t=[...e].sort((n,r)=>n-r);return t[Math.floor(t.length/2)]}function bn(e,t,n=2){let r=e.length,o=new Float64Array(r);for(let i=0;i<r;i++){let a=0,s=0;for(let c=-n;c<=n;c++){let m=i+c;if(t)m=(m%r+r)%r;else if(m<0||m>=r)continue;a+=e[m],s++}o[i]=a/s}return o}function Ei(e,t){let n=e.filter(d=>d.rows.length>=1);if(n.length<1)return null;let r=[],o=0,i=0,a=0;for(let d of n)for(let l of d.rows){for(let f of l.pts)o+=f.x,i+=f.y,a++;if(l.pts.length>=4){let f=io(l.pts);f&&Number.isFinite(f.cx)&&Number.isFinite(f.cy)&&r.push({x:f.cx,y:f.cy})}}if(!a)return null;let s={x:o/a,y:i/a},c=s;if(r.length>=8){let d=hn(r.map(y=>y.x)),l=hn(r.map(y=>y.y)),f=0;for(let y of n)for(let x of y.rows)for(let g of x.pts){let v=Math.hypot(g.x-s.x,g.y-s.y);v>f&&(f=v)}let b=0,h=f*.2;for(let y of n)for(let x of y.rows)for(let g of x.pts)Math.hypot(g.x-d,g.y-l)<h&&b++;Math.hypot(d-s.x,l-s.y)<=f&&b/a<.01&&(c={x:d,y:l})}let m=[];for(let d of n){let l={sectionId:d.sectionId,rMin:1/0,rMax:-1/0,samples:[]};for(let f of d.rows)for(let b of f.pts){let h=Math.hypot(b.x-c.x,b.y-c.y),y=Math.min(oe-1,Math.floor(ou(c,b)/(360/oe)));l.samples.push({r:h,bin:y,levelM:f.levelM}),h<l.rMin&&(l.rMin=h),h>l.rMax&&(l.rMax=h)}l.samples.length&&m.push(l)}if(!m.length)return null;m.sort((d,l)=>d.rMin+d.rMax-(l.rMin+l.rMax));let u=[];for(let d of m){let l=!1;for(let f of u){let b=Math.min(d.rMax,f.rMax)-Math.max(d.rMin,f.rMin),h=Math.min(d.rMax-d.rMin,f.rMax-f.rMin);if(h>1e-9&&b>=nu*h){f.members.push(d),f.rMin=Math.min(f.rMin,d.rMin),f.rMax=Math.max(f.rMax,d.rMax),l=!0;break}}l||u.push({members:[d],rMin:d.rMin,rMax:d.rMax})}let p=[];for(let d of u){let l=new Array(oe).fill(null);for(let C of d.members)for(let _ of C.samples){let B=l[_.bin];B||(B={samples:[]},l[_.bin]=B),B.samples.push({r:_.r,levelM:_.levelM})}let f=l.map(C=>!!C);if(!f.filter(Boolean).length)continue;let h=[],y=[];for(let C of l){if(!C)continue;let _=1/0,B=-1/0;for(let S of C.samples)S.r<_&&(_=S.r),S.r>B&&(B=S.r);h.push(_),y.push(B)}let x=hn(h),g=hn(y);if(!(x>=Ai*g)||!(g>0))continue;let v=[...h].sort((C,_)=>C-_);if(!(v[Math.floor(v.length*.1)]>=Ai*g))continue;let P=l.map(C=>{if(!C)return null;let _=[...C.samples].sort((O,j)=>O.r-j.r),B=_[0].r,S=_[_.length-1].r,I=_[0].levelM,T=-1/0;for(let O of _)O.levelM>T&&(T=O.levelM);let w=[];for(let O of _){let j={r:O.r,l:O.levelM};for(;w.length&&Math.abs(w[w.length-1].r-j.r)<1e-9;){if(w[w.length-1].l<=j.l){j.skip=!0;break}w.pop()}if(!j.skip){for(;w.length>=2;){let H=w[w.length-2],N=w[w.length-1];if((N.r-H.r)*(j.l-H.l)-(N.l-H.l)*(j.r-H.r)<=0)w.pop();else break}w.push(j)}}let k=w.map(O=>O.r),R=w.map(O=>O.l);return{inner:B,outer:S,front:I,top:T,profile:{rs:k,ls:R}}}),M=f.slice();for(let C=0;C<oe;C++){if(M[C])continue;let _=-1,B=-1,S=0;for(let F=1;F<=oe;F++){let W=(C-F+oe*2)%oe;if(M[W]){_=W;break}}for(let F=1;F<=oe;F++){let W=(C+F)%oe;if(M[W]){B=W,S=F;break}}if(_<0||B<0)continue;let I=0;for(let F=1;F<=oe;F++){let W=(C-F+oe*2)%oe;if(f[W]){I=F;break}}if(I-1+S>Jl)continue;let w=P[_],k=P[B],R=I/(I+S),O=w.inner+(k.inner-w.inner)*R,j=w.outer+(k.outer-w.outer)*R,H=w.front+(k.front-w.front)*R,N=w.top+(k.top-w.top)*R;P[C]={inner:O,outer:j,front:H,top:N,profile:{rs:[O,j],ls:[H,N]}}}for(let C=0;C<oe;C++)P[C]&&(M[C]=!0);let E=360/oe,D=[],z=M.filter(Boolean).length,V=[];if(z===oe)V.push({start:0,len:oe});else{let C=0;for(;M[C];)C=(C+1)%oe;let _=-1;for(let B=0;B<=oe;B++){let S=(C+B)%oe,I=B<oe&&M[S];if(I&&_<0)_=S;else if(!I&&_>=0){let T=(S-_+oe)%oe||oe;V.push({start:_,len:T}),_=-1}}}for(let C of V){if(C.len*E<eu&&C.len<oe)continue;let _=C.len===oe,B=new Float64Array(C.len),S=new Float64Array(C.len),I=new Float64Array(C.len),T=new Float64Array(C.len),w=[];for(let F=0;F<C.len;F++){let W=P[(C.start+F)%oe];B[F]=W.inner,S[F]=W.outer,I[F]=W.front,T[F]=W.top,w.push(W.profile??{rs:[W.inner,W.outer],ls:[W.front,W.top]})}let k=bn(B,_),R=bn(S,_),O=bn(I,_),j=bn(T,_);for(let F=0;F<C.len;F++)k[F]>B[F]&&(k[F]=B[F]),R[F]<S[F]&&(R[F]=S[F]),k[F]>R[F]-1e-6&&(k[F]=Math.max(0,R[F]-1e-6)),j[F]<O[F]&&(j[F]=O[F]);let H={startBin:C.start,binCount:C.len,closed:_,innerR:k,outerR:R,frontLevelM:O,topLevelM:j,profiles:w},N=(F,W,X)=>{let Q=w[F],q=Q.rs,K=Q.ls;if(W<=q[0]){K[0]>X&&(K[0]=X);return}if(W>=q[q.length-1]){K[K.length-1]>X&&(K[K.length-1]=X);return}for(let Z=0;Z+1<q.length;Z++)if(W<=q[Z+1]){K[Z]>X&&(K[Z]=X),K[Z+1]>X&&(K[Z+1]=X);return}};for(let F=0;F<C.len;F++){let W=l[(C.start+F)%oe];if(W)for(let X of W.samples){N(F,X.r,X.levelM);let Q=_?(F-1+C.len)%C.len:F-1,q=_?(F+1)%C.len:F+1;Q>=0&&N(Q,X.r,X.levelM),q<C.len&&N(q,X.r,X.levelM)}}D.push(H)}D.reduce((C,_)=>C+_.binCount*E,0)<tu||p.push({arcs:D,sectionIds:d.members.map(C=>C.sectionId),innerRMedian:x,outerRMedian:g})}if(!p.length)return null;if(p.sort((d,l)=>d.innerRMedian-l.innerRMedian),t){let d=p[p.length-1].outerRMedian;if(Math.hypot(t.x-c.x,t.y-c.y)>.9*d)return null}return{centre:c,binCount:oe,binStepDeg:360/oe,rings:p}}function Ii(e,t,n,r){let o=e.binStepDeg,i=n/o-.5-t.startBin;i=(i%e.binCount+e.binCount)%e.binCount,i>t.binCount-1&&(t.closed?i=i-t.binCount<t.binCount-i?0:t.binCount-1:i=i-(t.binCount-1)<e.binCount-i?t.binCount-1:0);let a=Math.floor(i),s=t.closed?(a+1)%t.binCount:Math.min(t.binCount-1,a+1),c=i-a,m=u=>{let p=t.profiles[u],d=p.rs,l=p.ls;if(r<=d[0])return l[0];if(r>=d[d.length-1])return l[l.length-1];for(let f=0;f+1<d.length;f++)if(r<=d[f+1]){let b=d[f+1]-d[f],h=b>1e-9?(r-d[f])/b:0;return l[f]+(l[f+1]-l[f])*h}return l[l.length-1]};return m(a)*(1-c)+m(s)*c}var ru=.25,iu=1.2,au=.6,su=.45,cu=2.3,lu=Math.PI/180;function it(e,t,n){let r=n*lu;return{x:e.x+t*Math.sin(r),y:e.y+t*Math.cos(r)}}function uu(e,t){let n=t.rings[t.rings.length-1];if(!n)return!1;let r=n.outerRMedian*.85;for(let o of e){if(o.role!=="wall")continue;let i=o.points&&o.points.length>=2?o.points:o.x!==void 0&&o.y!==void 0&&o.width!==void 0&&o.height!==void 0?[{x:o.x,y:o.y},{x:o.x+o.width,y:o.y},{x:o.x+o.width,y:o.y+o.height},{x:o.x,y:o.y+o.height}]:[];if(i.length<2)continue;let a=0;for(let s of i)Math.hypot(s.x-t.centre.x,s.y-t.centre.y)>=r&&a++;if(a>=i.length/2)return!0}return!1}var mu=24;function du(e,t,n,r,o,i,a,s){let c=n.binCount,m=mu,u=be,p=i+.02,d=[];for(let L=0;L<c;L++){let C=(n.startBin+L+.5)*t.binStepDeg,_=new Float64Array(m+1);for(let B=0;B<=m;B++){let S=r[L]+(o[L]-r[L])*B/m;_[B]=Math.max(p,Ii(t,n,C,S)-ru)}d.push(_)}let l=[a.bandTop[0]*s.top,a.bandTop[1]*s.top,a.bandTop[2]*s.top],f=[a.bandTop[0]*s.bottomCap,a.bandTop[1]*s.bottomCap,a.bandTop[2]*s.bottomCap],b=[a.bandWall[0]*s.top,a.bandWall[1]*s.top,a.bandWall[2]*s.top],h=[a.bandWall[0]*s.wallBottom,a.bandWall[1]*s.wallBottom,a.bandWall[2]*s.wallBottom],y=(L,C)=>{let _=(n.startBin+L+.5)*t.binStepDeg,B=r[L]+(o[L]-r[L])*C/m,S=it(t.centre,B,_);return[S.x*u,d[L][C],S.y*u]};{let L=Math.tan(12*Math.PI/180);for(let C=0;C<6;C++){let _=!1;for(let S=0;S<c;S++)for(let I=m-1;I>=0;I--)d[S][I]>d[S][I+1]&&(d[S][I]=d[S][I+1],_=!0);let B=n.closed?c:c-1;for(let S=0;S<B;S++){let I=(S+1)%c;for(let T=0;T<=m;T++){let w=d[I][T]-d[S][T];if(Math.abs(w)>1)continue;let k=r[S]+(o[S]-r[S])*T/m,R=r[I]+(o[I]-r[I])*T/m,O=it(t.centre,k,(n.startBin+S+.5)*t.binStepDeg),j=it(t.centre,R,(n.startBin+I+.5)*t.binStepDeg),H=L*Math.hypot(j.x-O.x,j.y-O.y)*u;w>H?(d[I][T]=d[S][T]+H,_=!0):-w>H&&(d[S][T]=d[I][T]+H,_=!0)}}if(!_)break}}let x=1,g=(L,C)=>{for(let _=0;_<=m;_+=4)if(Math.abs(d[L][_]-d[C][_])>x)return!0;return Math.abs(d[L][m]-d[C][m])>x},v=Math.tan(38*Math.PI/180),A=L=>(o[L]-r[L])/m*u,P=(L,C)=>d[L][C+1]-d[L][C]>v*Math.max(1e-6,A(L)),M=(L,C)=>{let _=n.closed?(L-1+c)%c:Math.max(0,L-1),B=n.closed?(L+1)%c:Math.min(c-1,L+1);Math.abs(d[_][C]-d[L][C])>x&&(_=L),Math.abs(d[B][C]-d[L][C])>x&&(B=L);let S=Math.max(0,C-1),I=Math.min(m,C+1);S<C&&P(L,S)&&(S=C),I>C&&P(L,C)&&(I=C);let T=y(_,C),w=y(B,C),k=y(L,S),R=y(L,I),O=w[0]-T[0],j=w[1]-T[1],H=w[2]-T[2],N=R[0]-k[0],F=R[1]-k[1],W=R[2]-k[2],X=j*W-H*F,Q=H*N-O*W,q=O*F-j*N,K=Math.hypot(X,Q,q);return K>1e-12?(X/=K,Q/=K,q/=K,Q<0&&(X=-X,Q=-Q,q=-q),[X,Q,q]):[0,1,0]},E=(L,C)=>{let _=[L[0],i,L[2]],B=[C[0],i,C[2]],S=C[0]-L[0],I=C[2]-L[2],T=Math.hypot(S,I);if(!(T>1e-12))return;let w=[I/T,0,-S/T];e.tri(L,C,B,w,b,b,h),e.tri(L,B,_,w,b,h,h)},D=.05*He,z=L=>o[L]-r[L]<D,V=n.closed?c:c-1;for(let L=0;L<V;L++){let C=(L+1)%c;if(z(L)||z(C))continue;if(g(L,C)){let w=(n.startBin+L+1)*t.binStepDeg,k=(F,W)=>{let X=(r[L]+r[C])/2,Q=(o[L]+o[C])/2,q=X+(Q-X)*W/m,K=it(t.centre,q,w);return[K.x*u,d[F][W],K.y*u]};for(let F=0;F<m;F++){let W=y(L,F),X=y(L,F+1),Q=k(L,F),q=k(L,F+1),K=M(L,F),Z=M(L,F+1);e.triN(W,Q,q,K,K,Z,l),e.triN(W,q,X,K,Z,Z,l);let te=y(C,F),Me=y(C,F+1),Ae=k(C,F),Be=k(C,F+1),ke=M(C,F),Ne=M(C,F+1);e.triN(Ae,te,Me,ke,ke,Ne,l),e.triN(Ae,Me,Be,ke,Ne,Ne,l);let we=k(L,F),de=k(L,F+1),Ge=k(C,F+1),ct=k(C,F),lt=de[0]-we[0],Fe=de[2]-we[2],qe=Math.hypot(lt,Fe);if(qe>1e-12){let ut=[Fe/qe,0,-lt/qe];e.tri(we,de,Ge,ut,b),e.tri(we,Ge,ct,ut,b)}}let R=y(L,0),O=y(C,0),j=y(C,m),H=y(L,m),N=F=>[F[0],i,F[2]];e.tri(N(R),N(j),N(O),[0,-1,0],f),e.tri(N(R),N(H),N(j),[0,-1,0],f),E(R,O),E(H,j);continue}for(let w=0;w<m;w++){let k=M(L,w),R=M(C,w),O=M(C,w+1),j=M(L,w+1);if(P(L,w)||P(C,w)){let X=(de,Ge)=>{let ct=(n.startBin+de+.5)*t.binStepDeg,lt=r[de]+(o[de]-r[de])*(w+.5)/m,Fe=it(t.centre,lt,ct);return[Fe.x*u,Ge,Fe.y*u]},Q=y(L,w),q=y(C,w),K=X(L,d[L][w]),Z=X(C,d[C][w]);e.triN(Q,q,Z,k,R,R,l),e.triN(Q,Z,K,k,R,k,l);let te=y(C,w+1),Me=y(L,w+1),Ae=X(L,d[L][w+1]),Be=X(C,d[C][w+1]);e.triN(Ae,Be,te,j,O,O,l),e.triN(Ae,te,Me,j,O,j,l);let ke=Z[0]-K[0],Ne=Z[2]-K[2],we=Math.hypot(ke,Ne);if(we>1e-12){let de=[-Ne/we,0,ke/we];e.tri(K,Z,Be,de,b),e.tri(K,Be,Ae,de,b)}continue}let H=y(L,w),N=y(C,w),F=y(C,w+1),W=y(L,w+1);e.triN(H,N,F,k,R,O,l),e.triN(H,F,W,k,O,j,l)}let _=y(L,0),B=y(C,0),S=y(C,m),I=y(L,m),T=w=>[w[0],i,w[2]];e.tri(T(_),T(S),T(B),[0,-1,0],f),e.tri(T(_),T(I),T(S),[0,-1,0],f),E(_,B),E(I,S)}if(!n.closed)for(let L of[0,c-1])for(let C=0;C<m;C++)E(y(L,C),y(L,C+1))}function Ri(e,t,n){let{bottomY:r,colors:o,ao:i}=n,a=new Float64Array(t.binCount).fill(-1/0);for(let u of t.rings)for(let p of u.arcs){let d=new Float64Array(p.binCount),l=new Float64Array(p.binCount);for(let b=0;b<p.binCount;b++){let h=(p.startBin+b)%t.binCount,y=Math.max(0,p.innerR[b]-Ce);d[b]=Math.max(y,a[h]+.001),l[b]=Math.max(d[b]+.001,p.outerR[b]+Ce)}let f=0;for(let b=0;b<p.binCount;b++){let h=p.topLevelM[b]-r;h>f&&(f=h)}f>=iu&&du(e,t,p,d,l,r,o,i);for(let b=0;b<p.binCount;b++){let h=(p.startBin+b)%t.binCount;l[b]>a[h]&&(a[h]=l[b])}}if(n.deriveShell===!1||uu(n.shapes,t))return;let s=t.rings[t.rings.length-1],c=au*He,m=su*He;for(let u of s.arcs){let p=[],d=[];for(let b=0;b<u.binCount;b++){let h=(u.startBin+b+.5)*t.binStepDeg,y=u.outerR[b]+Ce+c;p.push(it(t.centre,y,h)),d.push(it(t.centre,y+m,h))}let l=-1/0;for(let b=0;b<u.binCount;b++)u.topLevelM[b]>l&&(l=u.topLevelM[b]);let f=()=>l+cu;u.closed?ue(e,d,[p.slice().reverse()],f,r,o.shellTop,o.shellWall,i):ue(e,[...d,...p.slice().reverse()],void 0,f,r,o.shellTop,o.shellWall,i)}}function Ti(e,t,n,r,o,i,a,s){if(!t.outline||t.outline.length<3)return;let c=n.baseHeightM,m=Oe(r,s.tierTop);if(!o)return;let u=h=>o.deckAt(h.x,h.y),p=mi(t,a),d=p[0]??t.outline;if(o.rowLevels.length>=2){let h=dn(o.rowLevels),y=di(ii(o.rowLevels,n.focal,h),p),x=()=>[0,1,0];for(let v of y){let A=Math.max(c,v.topY-.02);for(let P of i.subtract(v.outline,A))ue(e,P,v.holes,()=>A,c,m,s.tierWall,le,void 0,x)}y.length||ue(e,d,t.holes,()=>o.landingY,c,m,s.tierWall,le);let g={tread:[m[0]*le.top,m[1]*le.top,m[2]*le.top],riser:[m[0]*.72,m[1]*.72,m[2]*.72]};for(let v of p.length?p:[d])si(e,o.rowLevels,n.focal,o.landingY,g,v,h);return}let l=o.flat?1/0:fi,f=h=>o.normalAt(h.x,h.y),b=o.flat?o.landingY:void 0;for(let h of i.subtract(d,b))ue(e,h,t.holes,u,c,m,s.tierWall,le,l,f)}function fu(e,t,n){let r=new Set;for(let a of e.objects)a.type==="section"&&r.add(a.id);let o=new Map;for(let a=0;a<t.length;a++){let s=n.seatOwner[a];if(!s||!r.has(s))continue;let c=n.bySection.get(s);if(c&&c.rowLevels.length>=2)continue;let m=t[a],u=o.get(s);u||(u=new Map,o.set(s,u));let p=m.rowId||`__seat-${a}`,d=u.get(p);d||(d={pts:[],levelM:0,n:0},u.set(p,d)),d.pts.push({x:m.x,y:m.y}),d.levelM+=n.seatDeckY(a),d.n++}let i=[];for(let a of e.objects){if(a.type!=="section")continue;let s=n.bySection.get(a.id);if(s&&s.rowLevels.length>=2){let m=s.rowLevels.filter(u=>!u.patch).map(u=>({pts:u.pts,levelM:u.y}));m.length>=2&&i.push({sectionId:a.id,rows:m});continue}let c=o.get(a.id);c&&i.push({sectionId:a.id,rows:[...c.values()].map(m=>({pts:m.pts,levelM:m.levelM/m.n}))})}return i}function _i(e,t,n,r,o,i,a=!0){let s=fu(t,n,r);if(!s.length)return;let c=Ei(s,t.focal);c&&(e.setMaterial(0),Ri(e,c,{bottomY:t.baseHeightM,colors:{bandTop:Pe(o.tierTop,.8),bandWall:o.tierWall,shellTop:i??Pe(o.tierWall,1.15),shellWall:i??o.tierWall},ao:le,shapes:t.objects.filter(m=>m.type==="shape"),deriveShell:a}))}var Li=/^[\p{L}\p{N}]{1,4}$/u,pu=/^([\p{L}\p{N}]{2,})[\s\-\u2013\u2014\u00b7_./]+(.+)$/u;function ki(e,t){let n=t?.trim();if(!n)return e;let r=e.toLocaleLowerCase("en-US"),o=n.toLocaleLowerCase("en-US");if(r.startsWith(`${o} `)){let a=e.slice(n.length).trim();if(Li.test(a))return a}let i=pu.exec(e);if(i){let a=i[1].toLocaleLowerCase("en-US"),s=i[2].trim();if((o.startsWith(a)||a.startsWith(o))&&Li.test(s))return s}return e}function Fi(e,t,n){return n<0?t>1?e.filter(r=>r.kind==="floor"):[...e]:e.filter(r=>r.floorIndex===void 0||r.floorIndex===n)}function Di(e,t){let n=[...e].sort((o,i)=>o.screen.y-i.screen.y),r=[];for(let o of n){let i=r.find(a=>a.some(s=>Math.abs(s.screen.x-o.screen.x)<104&&Math.abs(s.screen.y-o.screen.y)<34));i?i.push(o):r.push([o])}return r.flatMap(o=>o.length<2?o:o.map((i,a)=>({...i,screen:{...i.screen,x:Math.max(54,Math.min(t-54,i.screen.x+(a-(o.length-1)/2)*104))}})))}var hu=1.15,bu=2.75,yu=4.5,gu=.85,xu=.5,vu=.26;function Oi(e,t,n){let r=Math.max(1e-6,t),o=e/r,i=n?.hasZoneLabels??!0,a=new Set;return o>=.75&&a.add("floor"),o>=hu&&a.add("zone"),o<=(i?bu:yu)&&(a.add("section"),a.add("ga")),o<=gu&&(a.add("annotation"),a.add("booth")),o<=xu&&a.add("row"),o<=vu&&a.add("seat"),a}function Vi(e,t,n,r,o,i=6){let a=i+t,s=r-i-t,c=i+n,m=o-i-n;return{...e,x:a>s?r/2:Math.max(a,Math.min(s,e.x)),y:c>m?o/2:Math.max(c,Math.min(m,e.y))}}function Ye(e,t,n,r){let o=e,i=t[0],a=t[1],s=t[2],c=o[0]*i+o[4]*a+o[8]*s+o[12],m=o[1]*i+o[5]*a+o[9]*s+o[13],u=o[2]*i+o[6]*a+o[10]*s+o[14],p=o[3]*i+o[7]*a+o[11]*s+o[15];if(!(p>1e-6))return{x:0,y:0,depth:1/0,visible:!1};let d=c/p,l=m/p,f=u/p,b=d>=-1.05&&d<=1.05&&l>=-1.05&&l<=1.05&&f<=1;return{x:(d*.5+.5)*n,y:(1-(l*.5+.5))*r,depth:f,visible:b}}function Bi(e,t,n=t){let r=[],o=[...e].sort((i,a)=>i.screen.depth-a.screen.depth);for(let i of o){let a=!1;for(let s of r)if(vo(i,s,t,n)){a=!0;break}a||r.push(i)}return r}var Su=6;function vo(e,t,n,r){let o=Math.abs(e.screen.x-t.screen.x),i=Math.abs(e.screen.y-t.screen.y),a=e.halfWidth!=null&&t.halfWidth!=null?Math.max(n,e.halfWidth+t.halfWidth+Su):n;return o<a&&i<r}function Ni(e,t,n){return e.length*t*.58+(n?14:0)}var Mu={row:8,seat:14};function Gi(e){return e<480?{row:5,seat:8}:e<768?{row:6,seat:10}:Mu}function zi(e,t,n,r){let o=Math.max(1,Math.min(n,r)*.5),i=Math.min(2,Math.hypot(e.x-n/2,e.y-r/2)/o);return t*(1+1.5*i)}function So(e,t,n,r,o=[]){let i=[...e].sort((s,c)=>(c.priority??0)-(s.priority??0)||s.focus-c.focus),a=[];for(let s of i){if(a.length>=r)break;let c=!1;for(let m of o)if(vo(s,m,t,n)){c=!0;break}if(!c){for(let m of a)if(vo(s,m,t,n)){c=!0;break}}c||a.push(s)}return a}var wu=6,Pu=2.2,Ui=.1,Cu=.3,Au=1.8,Eu=.9,Iu=.55,Ru=6e3;function Hi(e){let{doc:t,units:n,seats:r,surfaces:o,focal:i}=e,a=t.zones??[],s=[];if(a.length){let c=new Map;for(let u of n)for(let p of u.objects)p.type==="section"&&p.zone&&c.set(p.id,p.zone);let m=new Map;for(let u=0;u<r.length;u++){let p=r[u],d=o.seatOwner[u],l=p.zoneId??(d?c.get(d):void 0);if(!l)continue;let f=m.get(l);f||(f={n:0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0,sumY:0},m.set(l,f)),f.n++,p.x<f.minX&&(f.minX=p.x),p.y<f.minY&&(f.minY=p.y),p.x>f.maxX&&(f.maxX=p.x),p.y>f.maxY&&(f.maxY=p.y),f.sumY+=o.seatDeckY(u)}for(let u of a){let p=m.get(u.id),d=[];for(let[l,f]of c)f===u.id&&d.push(l);if(!p||p.n===0){s.push({id:u.id,label:u.label,color:ne(u.color),sectionIds:d,seatCount:0,center:[0,0,0],radius:0,focalWorld:[(u.focalPoint??i).x*G,1.5,(u.focalPoint??i).y*G]});continue}s.push({id:u.id,label:u.label,color:ne(u.color),sectionIds:d,seatCount:p.n,center:[(p.minX+p.maxX)/2*G,p.sumY/p.n,(p.minY+p.maxY)/2*G],radius:.5*Math.hypot((p.maxX-p.minX)*G,(p.maxY-p.minY)*G)||1,focalWorld:[(u.focalPoint??i).x*G,1.5,(u.focalPoint??i).y*G]})}}return s}function ji(e){let{doc:t,units:n,seats:r,surfaces:o,seatData:i,hintedSeatFloor:a,zones:s,focal:c}=e,m=[],u=[],p=[];for(let d of s)d.seatCount!==0&&m.push({id:`zone:${d.id}`,kind:"zone",text:d.label,anchor:[d.center[0],d.center[1]+wu,d.center[2]],color:t.zones?.find(l=>l.id===d.id)?.color});{let d=new Map,l=new Map;for(let f=0;f<r.length;f++){let b=o.seatOwner[f];if(!b)continue;let h=d.get(b);h||(h={n:0,x:0,y:0,deck:0},d.set(b,h)),h.n++,h.x+=r[f].x,h.y+=r[f].y,h.deck+=o.seatDeckY(f);let y=l.get(b);y||(y={minX:1/0,maxX:-1/0,minY:1/0,maxY:-1/0},l.set(b,y)),r[f].x<y.minX&&(y.minX=r[f].x),r[f].x>y.maxX&&(y.maxX=r[f].x),r[f].y<y.minY&&(y.minY=r[f].y),r[f].y>y.maxY&&(y.maxY=r[f].y)}for(let f of n)for(let b of f.objects){if(b.type!=="section")continue;let h=d.get(b.id);if(!h||h.n===0)continue;let y=l.get(b.id),x=[h.x/h.n*G,h.deck/h.n,h.y/h.n*G],g=b.displayLabel||b.label||b.id;u.push({id:b.id,floorIndex:f.index,label:g,seatCount:h.n,center:x,radius:Math.max(1,Math.hypot(y.maxX-y.minX,y.maxY-y.minY)*.5*G),focalWorld:[f.focal.x*G,f.baseHeightM+1.5,f.focal.y*G]});let v=t.floors?.[f.index]?.name?.trim().toLocaleLowerCase();n.length>1&&v===g.trim().toLocaleLowerCase()||m.push({id:`section:${b.id}`,kind:"section",text:g,anchor:[x[0],x[1]+Pu,x[2]],floorIndex:f.index})}}{for(let b of n)for(let h of b.objects){if(h.type!=="gaArea")continue;let y=Lt(h.points);if(!y)continue;let x=h.displayLabel||h.label||h.id;m.push({id:`ga:${h.id}`,kind:"ga",text:h.capacity>0?`${x} \xB7 ${h.capacity.toLocaleString()}`:x,anchor:[y.x*G,b.baseHeightM+Au,y.y*G],floorIndex:b.index})}let d=new Map;for(let b of n)for(let h of b.objects)h.type==="section"&&d.set(h.id,h.displayLabel||h.label||h.id);let l=new Map;for(let b=0;b<r.length;b++){let h=r[b],y=Math.hypot(h.x-c.x,h.y-c.y),x=l.get(h.rowId);(!x||y>x.far)&&l.set(h.rowId,{seat:h,index:b,far:y})}for(let[b,h]of l){let y=Tu(h.seat.label,b,d.get(h.seat.sectionId??""));y&&m.push({id:`row:${b}`,kind:"row",text:y,anchor:[h.seat.x*G,o.seatDeckY(h.index)+Eu,h.seat.y*G],floorIndex:a[h.index]})}let f=new Map;for(let b=0;b<r.length;b++){let h=r[b],y=h.label?h.label.lastIndexOf("-"):-1,x=f.get(h.rowId);x||(x={n:0,x:0,y:0,z:0,minX:1/0,maxX:-1/0,minZ:1/0,maxZ:-1/0,label:y>0?h.label.slice(0,y):h.rowId,sectionId:h.sectionId},f.set(h.rowId,x));let g=b*3,v=i.iPosition[g],A=i.iPosition[g+1],P=i.iPosition[g+2];x.n++,x.x+=v,x.y+=A,x.z+=P,x.minX=Math.min(x.minX,v),x.maxX=Math.max(x.maxX,v),x.minZ=Math.min(x.minZ,P),x.maxZ=Math.max(x.maxZ,P)}for(let[b,h]of f)p.push({id:b,label:h.label,sectionId:h.sectionId,seatCount:h.n,center:[h.x/h.n,h.y/h.n,h.z/h.n],radius:Math.max(.8,Math.hypot(h.maxX-h.minX,h.maxZ-h.minZ)*.5)});if(r.length<=Ru)for(let b=0;b<r.length;b++){let h=r[b],y=Mo(h.displayLabel||h.label);y&&m.push({id:`seat:${h.id}`,kind:"seat",text:y,anchor:[h.x*G,o.seatDeckY(b)+Iu,h.y*G],floorIndex:a[b]})}}for(let d of n)for(let l of d.objects)if(l.type==="shape"&&l.role&&["entrance","exit","screen","suite","obstruction"].includes(l.role)){let f=rt(l),b=f?Lt(f):null;if(!b||!l.label)continue;m.push({id:`architecture:${l.id}`,kind:"annotation",text:l.label,anchor:[b.x*G,d.baseHeightM+Nt(l).heightM+Ui,b.y*G],color:l.fill,floorIndex:d.index})}else if(l.type==="text"){if(!l.text)continue;m.push({id:`text:${l.id}`,kind:"annotation",text:l.text,anchor:[l.position.x*G,d.baseHeightM+Ui,l.position.y*G],color:l.color,rotation:l.rotation,floorIndex:d.index})}else if(l.type==="booth"){let f=zt(l);if(!f)continue;let b=Lt(f);if(!b)continue;m.push({id:`booth:${l.id}`,kind:"booth",text:l.displayLabel||l.label||l.id,anchor:[b.x*G,d.baseHeightM+yo+Cu,b.y*G],floorIndex:d.index})}return{labels:m,sections:u,rows:p}}function Yi(e,t){if(t.length>1)for(let n of t)e.push({id:`floor:${n.id}`,kind:"floor",text:n.label,anchor:[n.center[0],n.box.max[1]+1.2,n.center[2]],floorIndex:n.index})}function Mo(e){let t=e.lastIndexOf("-");return t>=0&&t<e.length-1?e.slice(t+1):e}function Tu(e,t,n){let r=e?e.lastIndexOf("-"):-1,o=r>0?e.slice(0,r):t;return o&&ki(o,n)}function Xi(e){let{doc:t,units:n,seats:r,surfaces:o,solids:i,hintedSeatFloor:a,seatFloor:s}=e,c=[];{let m=n.map(()=>({minX:1/0,minY:1/0,minZ:1/0,maxX:-1/0,maxY:-1/0,maxZ:-1/0}));for(let d=0;d<i.floor.length;d+=1){let l=Math.max(0,Math.min(n.length-1,Math.round(i.floor[d]))),f=d*3,b=m[l];b.minX=Math.min(b.minX,i.position[f]),b.minY=Math.min(b.minY,i.position[f+1]),b.minZ=Math.min(b.minZ,i.position[f+2]),b.maxX=Math.max(b.maxX,i.position[f]),b.maxY=Math.max(b.maxY,i.position[f+1]),b.maxZ=Math.max(b.maxZ,i.position[f+2])}let u=new Map;for(let d=0;d<n.length;d++)for(let l of n[d].objects)l.type==="section"&&u.set(l.id,d);let p=n.map(()=>({n:0,minX:1/0,minY:1/0,minDeck:1/0,maxX:-1/0,maxY:-1/0,maxDeck:-1/0,sumX:0,sumDeck:0,sumZ:0}));for(let d=0;d<r.length;d++){let l=o.seatOwner[d],f=(l!==null?u.get(l):void 0)??a[d];if(f===void 0)continue;let b=p[f],h=r[d];b.n++,h.x<b.minX&&(b.minX=h.x),h.y<b.minY&&(b.minY=h.y),h.x>b.maxX&&(b.maxX=h.x),h.y>b.maxY&&(b.maxY=h.y);let y=o.seatDeckY(d);b.sumX+=h.x*G,b.sumDeck+=y,b.sumZ+=h.y*G,b.minDeck=Math.min(b.minDeck,y),b.maxDeck=Math.max(b.maxDeck,y+1.6),s[d]=f}for(let d=0;d<n.length;d++){let l=p[d],f=t.floors?.[d],b=m[d],h=Math.min(l.n?l.minX*G:n[d].focal.x*G-1,Number.isFinite(b.minX)?b.minX:1/0),y=Math.max(l.n?l.maxX*G:n[d].focal.x*G+1,Number.isFinite(b.maxX)?b.maxX:-1/0),x=Math.min(l.n?l.minY*G:n[d].focal.y*G-1,Number.isFinite(b.minZ)?b.minZ:1/0),g=Math.max(l.n?l.maxY*G:n[d].focal.y*G+1,Number.isFinite(b.maxZ)?b.maxZ:-1/0),v=Math.min(l.n?Math.min(n[d].baseHeightM,l.minDeck):n[d].baseHeightM,Number.isFinite(b.minY)?b.minY:1/0),A=Math.max(l.n?Math.max(l.maxDeck,v+.5):v+.5,Number.isFinite(b.maxY)?b.maxY:-1/0),P=[l.n?l.sumX/l.n:(h+y)/2,l.n?l.sumDeck/l.n:(v+A)/2,l.n?l.sumZ/l.n:(x+g)/2],M=Math.max(1,.5*Math.hypot(y-h,A-v,g-x));c.push({index:d,id:f?.id??`floor-${d}`,label:f?.name??(n.length>1?`Floor ${d+1}`:"Venue"),seatCount:l.n,center:P,radius:M,box:{min:[h,v,x],max:[y,A,g]},focalWorld:[n[d].focal.x*G,n[d].baseHeightM+1.5,n[d].focal.y*G]})}}return c}function wo(e,t){let n=1/0,r=1/0,o=-1/0,i=-1/0,a=(s,c)=>{s<n&&(n=s),c<r&&(r=c),s>o&&(o=s),c>i&&(i=c)};for(let s of t)a(s.x,s.y);for(let s of e)for(let c of s.objects)if(c.type==="section")for(let m of c.outline)a(m.x,m.y);else if(c.type==="shape"&&c.points)for(let m of c.points)a(m.x,m.y);else if(c.type==="gaArea")for(let m of c.points)a(m.x,m.y);else if(c.type==="booth"){let m=zt(c);if(m)for(let u of m)a(u.x,u.y)}else if(c.type==="table"){let m=go(c);if(m)for(let u of m)a(u.x,u.y)}else if(c.type==="decorImage"){let m=xo(c);if(m)for(let u of m)a(u.x,u.y)}return Number.isFinite(n)||(n=-100,r=-100,o=100,i=100),{minX:n,minY:r,maxX:o,maxY:i}}function Wi(e,t,n,r,o,i){if(t.length===1){let a=Math.max(60,(o.maxX-o.minX+o.maxY-o.minY)*.06),s=Ot(o.minX-a,o.minY-a,o.maxX-o.minX+a*2,o.maxY-o.minY+a*2);ue(e,s,void 0,()=>0,-.4,i.ground,i.ground,le)}else{let a=t.reduce((l,f)=>f.baseHeightM<l.baseHeightM?f:l);e.setFloor(a.index);let s=n.filter((l,f)=>r[f]===a.index),c=wo([a],s),m=Math.hypot(c.maxX-c.minX,c.maxY-c.minY),u=Math.max(28,Math.min(80,m*.04)),p=Ot(c.minX-u,c.minY-u,c.maxX-c.minX+u*2,c.maxY-c.minY+u*2),d=a.baseHeightM-.03;ue(e,p,void 0,()=>d,d-.22,i.ground,i.ground,le)}}function Ki(e,t,n){let{cx:r,cz:o,radius:i}=n,a=1/0,s=1/0,c=1/0,m=-1/0,u=-1/0,p=-1/0,d=(b,h,y)=>{a=Math.min(a,b),m=Math.max(m,b),s=Math.min(s,h),u=Math.max(u,h),c=Math.min(c,y),p=Math.max(p,y)};for(let b=0;b<e.position.length;b+=3)d(e.position[b],e.position[b+1],e.position[b+2]);for(let b=0;b<t.count;b++){let h=b*3,y=t.iPosition[h],x=t.iPosition[h+1],g=t.iPosition[h+2],v=Math.max(.35,t.iMaxRadius[b]??.35);d(y-v,x,g-v),d(y+v,x+1.6,g+v)}Number.isFinite(a)||(a=r-i,m=r+i,s=0,u=i*.16,c=o-i,p=o+i);let l=[(a+m)/2,(s+u)/2,(c+p)/2],f=Math.max(1,.5*Math.hypot(m-a,u-s,p-c));return{center:l,radius:f,minY:s,maxY:u}}function qi(e,t,n,r,o,i){let a=1/0,s=1/0,c=-1/0,m=-1/0;for(let v=0;v<e.count;v++){let A=v*3,P=e.iPosition[A],M=e.iPosition[A+2];P<a&&(a=P),P>c&&(c=P),M<s&&(s=M),M>m&&(m=M)}for(let v of t)a=Math.min(a,v.cx-v.halfX),c=Math.max(c,v.cx+v.halfX),s=Math.min(s,v.cz-v.halfZ),m=Math.max(m,v.cz+v.halfZ);let u=n.minX*G,p=n.maxX*G,d=n.minY*G,l=n.maxY*G,f=u,b=p,h=d,y=l;if(Number.isFinite(a)){let v=Math.max(2,.06*Math.hypot(c-a,m-s));f=Math.max(u,a-v),b=Math.min(p,c+v),h=Math.max(d,s-v),y=Math.min(l,m+v)}let x=Math.min(0,r),g=Math.max(o,i*.05);return{min:[f,x,h],max:[b,g,y]}}function $i(e,t,n){let r=()=>({byObjectId:new Map,elements:[]});if(!t||!e)return r();let o=Vr(t);if(!o.ok||o.value.id!==e)return r();let i=new Map;for(let p of n)for(let d of p.objects)d.type==="shape"&&i.set(d.id,{shape:d,unit:p});let a=new Set,s=new Set,c=new Map((t.overlay.productionElements??[]).map(p=>{let d=p.runtimeContentImageUrl;return[p.id,typeof d=="string"&&/^(?:blob:|data:image\/|https:\/\/)/.test(d)?d:void 0]})),m=[];for(let p of o.value.overlay.productionElements??[]){let d=i.get(p.objectId),l=d?rt(d.shape):null,f=p.baseElevationM??0;if(!d||!l||l.length<3||!p.id||a.has(p.id)||s.has(p.objectId)||!Number.isFinite(p.heightM)||p.heightM<.05||p.heightM>50||!Number.isFinite(f)||f<-10||f>100)return r();a.add(p.id),s.add(p.objectId);let b=l.map(E=>E.x*G),h=l.map(E=>E.y*G),y=d.unit.baseHeightM+f,x=Math.min(...b),g=Math.max(...b),v=Math.min(...h),A=Math.max(...h),P,M=c.get(p.id)??p.contentImageUrl;if(p.kind==="screen"&&M)if(g-x>=A-v){let E=Math.abs(v-d.unit.focal.y*G)<=Math.abs(A-d.unit.focal.y*G)?v-.006:A+.006;P=[[x,y,E],[g,y,E],[x,y+p.heightM,E],[g,y+p.heightM,E]]}else{let E=Math.abs(x-d.unit.focal.x*G)<=Math.abs(g-d.unit.focal.x*G)?x-.006:g+.006;P=[[E,y,v],[E,y,A],[E,y+p.heightM,v],[E,y+p.heightM,A]]}m.push({id:p.id,objectId:p.objectId,kind:p.kind,floorIndex:d.unit.index,baseY:y,topY:y+p.heightM,bounds:{min:[x,y,v],max:[g,y+p.heightM,A]},occlusion:p.occlusion,...M?{contentImageUrl:M}:{},...P?{contentPlane:P}:{}})}let u=m.sort((p,d)=>p.id.localeCompare(d.id));return{byObjectId:new Map(u.map(p=>[p.objectId,p])),elements:u}}function ve(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function xe(e){return Array.isArray(e)?e:[]}function _u(e){let t=[e];for(;t.length;){let n=t.pop();if(Array.isArray(n)){t.push(...n);continue}if(!ve(n))continue;let r=ve(n.extensions)?n.extensions:null;if(r&&Object.prototype.hasOwnProperty.call(r,"KHR_draco_mesh_compression"))return!0;t.push(...Object.values(n))}return!1}function yn(e,t){return!Array.isArray(e)||e.length!==t||!e.every(n=>typeof n=="number"&&Number.isFinite(n))?null:e}function Lu(){return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}function ku(e,t){let n=new Array(16).fill(0);for(let r=0;r<4;r++)for(let o=0;o<4;o++)for(let i=0;i<4;i++)n[r*4+o]+=e[i*4+o]*t[r*4+i];return n}function Fu(e){let t=yn(e.matrix,16);if(t)return t;if(e.matrix!==void 0)return null;let n=e.translation===void 0?[0,0,0]:yn(e.translation,3),r=e.rotation===void 0?[0,0,0,1]:yn(e.rotation,4),o=e.scale===void 0?[1,1,1]:yn(e.scale,3);if(!n||!r||!o)return null;let[i,a,s,c]=r,m=Math.hypot(i,a,s,c);if(!(m>1e-8))return null;let u=i/m,p=a/m,d=s/m,l=c/m,f=u+u,b=p+p,h=d+d,y=u*f,x=u*b,g=u*h,v=p*b,A=p*h,P=d*h,M=l*f,E=l*b,D=l*h;return[(1-(v+P))*o[0],(x+D)*o[0],(g-E)*o[0],0,(x-D)*o[1],(1-(y+P))*o[1],(A+M)*o[1],0,(g+E)*o[2],(A-M)*o[2],(1-(y+v))*o[2],0,n[0],n[1],n[2],1]}function Du(e,t,n,r){return[e[0]*t+e[4]*n+e[8]*r+e[12],e[1]*t+e[5]*n+e[9]*r+e[13],e[2]*t+e[6]*n+e[10]*r+e[14]]}function Ou(e){let t=e[0],n=e[4],r=e[8],o=e[1],i=e[5],a=e[9],s=e[2],c=e[6],m=e[10],u=i*m-a*c,p=a*s-o*m,d=o*c-i*s,l=t*u+n*p+r*d;if(Math.abs(l)<1e-12)return null;let f=1/l;return[u*f,p*f,d*f,(r*c-n*m)*f,(t*m-r*s)*f,(n*s-t*c)*f,(n*a-r*i)*f,(r*o-t*a)*f,(t*i-n*o)*f]}function Qi(e,t,n,r){let o=e[0]*t+e[1]*n+e[2]*r,i=e[3]*t+e[4]*n+e[5]*r,a=e[6]*t+e[7]*n+e[8]*r,s=Math.hypot(o,i,a)||1;return o/=s,i/=s,a/=s,[o,i,a]}function Vu(e){if(e.byteLength<20||e.byteLength>8388608)return null;let t=new DataView(e.buffer,e.byteOffset,e.byteLength);if(t.getUint32(0,!0)!==1179937895||t.getUint32(4,!0)!==2||t.getUint32(8,!0)!==e.byteLength)return null;let n=12,r=null,o=null;for(;n+8<=e.byteLength;){let i=t.getUint32(n,!0),a=t.getUint32(n+4,!0);if(n+=8,i%4!==0||n+i>e.byteLength)return null;let s=e.subarray(n,n+i);if(a===1313821514&&!r)try{let c=JSON.parse(new TextDecoder().decode(s).replace(/[\u0000 ]+$/g,""));if(!ve(c))return null;r=c}catch{return null}else if(a===5130562&&!o)o=s;else return null;n+=i}return n===e.byteLength&&r&&o?{json:r,bin:o}:null}function Bu(e){return e===5120||e===5121?1:e===5122||e===5123?2:e===5125||e===5126?4:0}function Nu(e){return e==="SCALAR"?1:e==="VEC2"?2:e==="VEC3"?3:e==="VEC4"?4:0}function Gu(e,t,n){return n===5120?e.getInt8(t):n===5121?e.getUint8(t):n===5122?e.getInt16(t,!0):n===5123?e.getUint16(t,!0):n===5125?e.getUint32(t,!0):e.getFloat32(t,!0)}function zu(e){let t=e instanceof Uint8Array?e:new Uint8Array(e),n=Vu(t);if(!n)return{ok:!1,issue:"invalid_glb"};let{json:r,bin:o}=n;if(!ve(r.asset)||r.asset.version!=="2.0")return{ok:!1,issue:"unsupported_glb"};let i=xe(r.extensionsUsed).filter(v=>typeof v=="string");if(i.includes("KHR_draco_mesh_compression")||_u(r))return{ok:!1,issue:"draco_not_allowed"};if(i.length||xe(r.extensionsRequired).length)return{ok:!1,issue:"unsupported_glb"};if(xe(r.images).length||xe(r.textures).length)return{ok:!1,issue:"external_resource"};let a=xe(r.buffers);if(a.length!==1||!ve(a[0])||a[0].uri!==void 0||typeof a[0].byteLength!="number"||!Number.isInteger(a[0].byteLength)||a[0].byteLength<0||a[0].byteLength>o.byteLength)return{ok:!1,issue:"external_resource"};let s=xe(r.accessors),c=xe(r.bufferViews),m=xe(r.meshes),u=xe(r.nodes),p=xe(r.scenes),d=typeof r.scene=="number"?r.scene:0;if(!ve(p[d]))return{ok:!1,issue:"unsupported_glb"};let l=new DataView(o.buffer,o.byteOffset,o.byteLength),f=(v,A,P)=>{if(typeof v!="number"||!Number.isInteger(v)||!ve(s[v]))return null;let M=s[v];if(M.type!==A||M.sparse!==void 0||M.normalized===!0||typeof M.count!="number"||!Number.isInteger(M.count)||M.count<1||typeof M.componentType!="number"||!P.includes(M.componentType)||typeof M.bufferView!="number")return null;let E=c[M.bufferView];if(!ve(E)||E.buffer!==0||typeof E.byteLength!="number"||!Number.isInteger(E.byteLength)||E.byteLength<0)return null;let D=Nu(M.type),z=Bu(M.componentType),V=typeof E.byteStride=="number"?E.byteStride:D*z,L=typeof E.byteOffset=="number"?E.byteOffset:0,C=typeof M.byteOffset=="number"?M.byteOffset:0,_=L+C,B=C+(M.count-1)*V+D*z;if(!Number.isInteger(V)||!Number.isInteger(L)||!Number.isInteger(C)||V<D*z||L<0||C<0||L+E.byteLength>o.byteLength||B>E.byteLength)return null;let S=[];for(let I=0;I<M.count;I++){let T=[];for(let w=0;w<D;w++){let k=Gu(l,_+I*V+w*z,M.componentType);if(!Number.isFinite(k))return null;T.push(k)}S.push(T)}return S},b=[],h=[],y=0,x=new Set,g=(v,A)=>{if(typeof v!="number"||!Number.isInteger(v)||!ve(u[v])||x.has(v))return!1;x.add(v);let P=u[v],M=Fu(P);if(!M)return!1;let E=ku(A,M),D=Ou(E);if(!D)return!1;if(P.mesh!==void 0){if(typeof P.mesh!="number")return!1;let z=m[P.mesh];if(!ve(z))return!1;for(let V of xe(z.primitives)){if(!ve(V)||V.mode!==void 0&&V.mode!==4||!ve(V.attributes))return!1;let L=f(V.attributes.POSITION,"VEC3",[5126]),C=V.attributes.NORMAL===void 0?null:f(V.attributes.NORMAL,"VEC3",[5126]);if(!L||V.attributes.NORMAL!==void 0&&!C)return!1;let _=L.length;if(V.indices!==void 0){let S=typeof V.indices=="number"?s[V.indices]:null;_=ve(S)?S.count:void 0}if(typeof _!="number"||!Number.isInteger(_)||_%3!==0||(y+=_/3,y>1e5))return!1;let B=V.indices===void 0?L.map((S,I)=>[I]):f(V.indices,"SCALAR",[5121,5123,5125]);if(!B||B.length%3!==0||B.length!==_)return!1;for(let S=0;S<B.length;S+=3){let I=[B[S][0],B[S+1][0],B[S+2][0]];if(I.some(k=>!Number.isInteger(k)||k<0||k>=L.length))return!1;let T=I.map(k=>Du(E,...L[k])),w=null;if(!C){let k=T[1][0]-T[0][0],R=T[1][1]-T[0][1],O=T[1][2]-T[0][2],j=T[2][0]-T[0][0],H=T[2][1]-T[0][1],N=T[2][2]-T[0][2];w=Qi([1,0,0,0,1,0,0,0,1],R*N-O*H,O*j-k*N,k*H-R*j)}for(let k=0;k<3;k++)b.push(...T[k]),h.push(...C?Qi(D,...C[I[k]]):w)}}}for(let z of xe(P.children))if(!g(z,E))return!1;return x.delete(v),!0};for(let v of xe(p[d].nodes))if(!g(v,Lu()))return{ok:!1,issue:y>1e5?"triangle_limit":"unsupported_glb"};return!y||b.length!==y*9||h.length!==b.length?{ok:!1,issue:"unsupported_glb"}:{ok:!0,triangleCount:y,position:new Float32Array(b),normal:new Float32Array(h)}}function Zi(e){try{return zu(e)}catch{return{ok:!1,issue:"invalid_glb"}}}function St(e){let{doc:t}=e,n=Cr(t.theme),r=n.structure,o=ui(t,e.eventConfigurationId??t.eventConfigurationId),i=$i(e.eventConfigurationId,e.eventConfiguration,o),a=e.seats,s=new on,c=null;if(e.registeredShellGlb){let S=Zi(e.registeredShellGlb);if(S.ok){let I=S.position.length/3,T=new Float32Array(S.position.length),w=n.materials.shell??r.tierWall;for(let k=0;k<I;k++){let R=S.normal[k*3+1],O=R<-.25?.4:.62+.38*Math.max(0,R);T[k*3]=w[0]*O,T[k*3+1]=w[1]*O,T[k*3+2]=w[2]*O}c={position:S.position,normal:S.normal,color:T,floor:new Float32Array(I).fill(-2),material:new Float32Array(I),count:I}}}let m=new Map;for(let S of o)for(let I of S.objects)m.set(I.id,S.index),I.type==="section"&&m.set(I.logicalSectionId??I.id,S.index);let u=a.map(S=>m.get(S.sectionId??"")??m.get(S.rowId??"")??0),p=wo(o,a);Wi(s,o,a,u,p,r);let d=hi(t,a),l=new Map,f=new Map;for(let S of t.categories??[])l.set(S.key,S.color),S.seatGlyph&&f.set(S.key,S.seatGlyph);let b=[],h=pi(o,a,u),y=new Float32Array(a.length),x=[];for(let S=0;S<o.length;S++){let I=o[S];s.setFloor(S);let T=new pn,w=[],k=I.objects.filter(R=>R.type==="section"&&!!R.outline&&R.outline.length>=3);for(let R of I.objects)if(R.type==="section"){let O=s.vertexCount;Ti(s,R,I,bi(R,d),h.bySection.get(R.id),T,k,r);let j=s.vertexCount-O;j>0&&x.push({sectionId:R.id,start:O,count:j})}else if(R.type==="shape"){let O=i.byObjectId.get(R.id);s.setMaterial((O?.kind??R.role)==="screen"?1:0),wi(s,R,I.baseHeightM,gi(R,w),r,I.focal,b,O),s.setMaterial(0)}else R.type==="gaArea"?Ci(s,R,I.baseHeightM,ne(l.get(R.categoryKey)),r):R.type==="booth"?Si(s,R,I.baseHeightM,ne(l.get(R.categoryKey)),r):R.type==="table"?Mi(s,R,I.baseHeightM,ne(R.fill??t.theme?.decorFill??"#232c40"),r):R.type==="decorImage"&&Pi(s,R,I.baseHeightM,r);_i(s,I,a,h,r,n.materials.shell,!c)}let g=o.length>1?{x:o.reduce((S,I)=>S+I.focal.x,0)/o.length,y:o.reduce((S,I)=>S+I.focal.y,0)/o.length}:t.focalPoint??{x:(p.minX+p.maxX)/2,y:(p.minY+p.maxY)/2},v=pr(c?[s.build(),c]:[s.build()]),A=wr(a,e.initialState,h,y,l,f),P=Hi({doc:t,units:o,seats:a,surfaces:h,focal:g}),{labels:M,sections:E,rows:D}=ji({doc:t,units:o,seats:a,surfaces:h,seatData:A,hintedSeatFloor:u,zones:P,focal:g}),z=Xi({doc:t,units:o,seats:a,surfaces:h,solids:v,hintedSeatFloor:u,seatFloor:y});Yi(M,z),A.iYaw=Sr(A.iPosition,a.length,S=>a[S].rowId,S=>{let I=o[y[S]]?.focal??g;return[I.x*G,I.y*G]});let V=(p.minX+p.maxX)/2*G,L=(p.minY+p.maxY)/2*G,C=.5*Math.hypot((p.maxX-p.minX)*G,(p.maxY-p.minY)*G)||10,_=Ki(v,A,{cx:V,cz:L,radius:C}),B=qi(A,b,p,_.minY,_.maxY,C);return{solids:v,sectionSolidRanges:x,seats:A,bounds:{center:[(B.min[0]+B.max[0])/2,(B.min[1]+B.max[1])/2,(B.min[2]+B.max[2])/2],radius:C,groundY:0,box:B},renderBounds:{center:_.center,radius:_.radius},stateColorLUT:Ar(n,pe),theme:n,seatCount:a.length,focalWorld:[g.x*G,1.5,g.y*G],zones:P,stages:b,productionElements:i.elements,sections:E,rows:D,labels:M,floors:z}}var Uu=88,Hu=20,Po={floor:{size:14,weight:"700",opacity:.98},zone:{size:15,weight:"600",opacity:.95},section:{size:12,weight:"500",opacity:.88},ga:{size:12,weight:"500",opacity:.88},booth:{size:11,weight:"500",opacity:.85},annotation:{size:11,weight:"400",opacity:.75},row:{size:11.5,weight:"700",opacity:.94},seat:{size:12.5,weight:"800",opacity:1}},Ji="rgba(10,14,22,.62)",ju="#f4f7fb",ea=5,ta=2,Yu=6,gn=new Set(["row","seat"]),na={floor:5,zone:4,section:3,ga:3,booth:2,annotation:1},xn={row:{x:66,y:20},seat:{x:52,y:22}},Ao=ne,Co=e=>jo(e);function Eo(e,t){let n=Co(e),r=Co(t);return(Math.max(n,r)+.05)/(Math.min(n,r)+.05)}function Io(e,t){let n=/rgba\((\d+),(\d+),(\d+),([\d.]+)\)/.exec(e.replace(/\s/g,""));if(!n)return t;let r=Math.max(0,Math.min(1,Number(n[4])));return[1,2,3].map(o=>Number(n[o])/255*r+t[o-1]*(1-r))}function Xu(e,t=[.04,.06,.1],n=!0){let r=Co(t)<.42,o=r?"#f4f7fb":"#0b1220",i=r?"rgba(8,12,22,.78)":"rgba(255,255,255,.84)",a=n?Io(i,t):t,s=Ao(e),c=n?7:4.5,m=s&&Eo(s,a)>=c?e:o;return r?{ink:m,backing:i,border:"rgba(210,222,245,.24)"}:{ink:m,backing:i,border:"rgba(11,18,32,.22)"}}function Wu(e,t=[.04,.06,.1]){let n=Io(Ji,t),r=Ao(e);return{ink:r&&Eo(r,n)>=4.5?e:ju,backing:Ji}}var Ku='ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif',vn=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",r.fontFamily=n.fontFamily||Ku,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=Oi(o,i,{hasZoneLabels:this.labels.some(g=>g.kind==="zone")});this.forcedDense&&(s.add("row"),s.add("seat"));let c=[];for(let g of this.labels){if(!s.has(g.kind))continue;let v=Ye(t,g.anchor,n,r);if(!v.visible)continue;let A=gn.has(g.kind),P=Ni(g.text,Po[g.kind].size,!A)+(A?ea*2:0),M=Vi(v,P/2,Po[g.kind].size/2+(A?ta:4),n,r),E=a?Math.hypot(g.anchor[0]-a[0],g.anchor[1]-a[1],g.anchor[2]-a[2]):1;c.push({label:g,screen:M,focus:zi(M,E,n,r),halfWidth:P/2,...this.selectedSeatLabelIds.has(g.id)?{priority:1}:{}})}let m=Di(c.filter(g=>g.label.kind==="floor"),n),u=[...c.filter(g=>!gn.has(g.label.kind)&&g.label.kind!=="floor"),...m],p=Bi(u,Uu,Hu),d=Gi(n),l=So(c.filter(g=>g.label.kind==="row"),xn.row.x,xn.row.y,d.row,p),f=So(c.filter(g=>g.label.kind==="seat"),xn.seat.x,xn.seat.y,d.seat,[...p,...l]),b=[...p,...l,...f],h=new Set(b.map(g=>g.label.id));for(let{label:g,screen:v}of b){let P=this.nodeFor(g).style;P.display="",P.transform=`translate(-50%, -50%) translate(${v.x.toFixed(1)}px, ${v.y.toFixed(1)}px)`}let y=b.filter(({label:g})=>!gn.has(g.kind)).sort((g,v)=>na[v.label.kind]-na[g.label.kind]||g.screen.depth-v.screen.depth||g.focus-v.focus),x=[];for(let{label:g}of y){let v=this.nodes.get(g.id);if(!v||v.style.display==="none")continue;let A=v.getBoundingClientRect();x.some(M=>A.left<M.right+3&&A.right+3>M.left&&A.top<M.bottom+3&&A.bottom+3>M.top)?v.style.display="none":x.push(A)}for(let[g,v]of this.nodes)h.has(g)||(v.style.display="none")}nodeFor(t){let n=this.nodes.get(t.id);if(!n){n=document.createElement("div");let l=n.style;l.position="absolute",l.left="0",l.top="0",l.whiteSpace="nowrap",l.textShadow="0 1px 3px rgba(0,0,0,0.85), 0 0 8px rgba(0,0,0,0.55)",l.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=Po[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=gn.has(t.kind),s=!a,c=Xu(t.color??this.opts.ink,this.opts.backgroundRgb,!0),m=a?Wu(t.color??this.opts.ink,this.opts.backgroundRgb):c;i.color=r?"#ecf8ff":m.ink,i.background=r?"rgba(10,28,45,.9)":m.backing,i.border=r?"1px solid rgba(89,199,255,.92)":s?`1px solid ${c.border}`:"",i.borderRadius=r||s?"999px":`${Yu}px`,i.padding=r||s?"3px 7px":`${ta}px ${ea}px`,i.lineHeight=a?"1.1":"",i.boxShadow=r?"0 0 0 2px rgba(41,176,255,.18), 0 5px 14px rgba(0,0,0,.35)":s?"0 3px 10px rgba(0,0,0,.24)":"0 1px 4px rgba(0,0,0,.28)",i.letterSpacing=t.kind==="zone"||t.kind==="floor"?"0.08em":"0.02em";let u=this.opts.backgroundRgb??[.04,.06,.1],p=Ao(r?"#ecf8ff":m.ink)??[1,1,1],d=Io(r?"rgba(10,28,45,.9)":m.backing,u);return n.dataset.qualityContrast=Eo(p,d).toFixed(3),(t.kind==="zone"||t.kind==="floor")&&(i.textTransform="uppercase"),n}dispose(){this.root.remove(),this.nodes.clear()}};var ra=1;var qu=new Set(["floor","zone","section","ga","booth","annotation"]);function $u(e){return e.every(t=>Number.isFinite(t))}function Qu(e,t){return e.x<t.x+t.width&&e.x+e.width>t.x&&e.y<t.y+t.height&&e.y+e.height>t.y}function oa(e){return e.length?Math.round(Math.min(...e)*100)/100:null}function at(e){return Math.round(e*1e4)/1e4}function Zu(e){if(e)return{box:{x:at(e.box.x),y:at(e.box.y),width:at(e.box.width),height:at(e.box.height)},horizontalFillRatio:at(e.horizontalFillRatio),verticalFillRatio:at(e.verticalFillRatio),visibleAreaRatio:at(e.visibleAreaRatio),clippedEdges:[...e.clippedEdges]}}function Te(e,t,n){return n.length?{code:e,message:t,count:n.length,samples:n.slice(0,20)}:null}function Sn(e){let t=e.labels.filter(s=>s.visible&&s.screenBox),n=t.filter(s=>qu.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)Qu(n[s].screenBox,n[c].screenBox)&&o.push({primaryId:n[s].id,primaryLabel:n[s].text,secondaryId:n[c].id});let i=[...e.camera.position,e.camera.distance,e.camera.verticalFovDeg],a=[Te("webgl2-unavailable","The venue scene must render through WebGL2",e.context.webgl2?[]:[{primaryId:"renderer",primaryLabel:"WebGL2"}]),Te("context-lost","The WebGL context must be live at capture",e.context.lost?[{primaryId:"renderer",primaryLabel:"context lost"}]:[]),Te("frame-not-stable","The captured 3D frame must be rendered and parked",e.frame.rendered>0&&e.frame.idle?[]:[{primaryId:"renderer",primaryLabel:"unstable frame"}]),Te("viewport-empty","The 3D viewport must have visible dimensions",e.viewport.width>1&&e.viewport.height>1?[]:[{primaryId:"viewport",primaryLabel:`${e.viewport.width}\xD7${e.viewport.height}`}]),Te("camera-invalid","The capture camera must have a finite physical pose",$u(i)&&e.camera.distance>0&&e.camera.verticalFovDeg>0&&e.camera.verticalFovDeg<180?[]:[{primaryId:"camera",primaryLabel:"invalid pose"}]),Te("authored-relief-not-visible","Authored 3D height or rake must produce visible screen-space relief",!e.scene.authoredRelief||e.scene.renderedVerticalSpanM>.05&&e.scene.projectedReliefPx>=2?[]:[{primaryId:"scene",primaryLabel:"authored relief",measured:e.scene.projectedReliefPx,minimum:2}]),Te("hierarchy-label-missing","A venue with authored hierarchy must show at least one structural label",r===0||n.length>0?[]:[{primaryId:"labels",primaryLabel:`${r} expected hierarchy labels`}]),Te("hierarchy-label-undersized","Visible 3D hierarchy labels must remain readable",n.filter(s=>s.renderedFontPx<11).map(s=>({primaryId:s.id,primaryLabel:s.text,measured:s.renderedFontPx,minimum:11}))),Te("hierarchy-label-contrast-low","Visible 3D hierarchy labels must meet text contrast",n.filter(s=>s.contrast<4.5).map(s=>({primaryId:s.id,primaryLabel:s.text,measured:s.contrast,minimum:4.5}))),Te("hierarchy-label-collision","Visible 3D hierarchy labels must not overlap",o)].filter(s=>!!s);return{version:1,state:"venue3d",passed:a.length===0,resolvedRules:["rendered-3d-webgl-context","rendered-3d-stable-frame","rendered-3d-camera-pose","rendered-3d-relief-projection","rendered-3d-label-size","rendered-3d-label-contrast","rendered-3d-label-collision"],viewport:e.viewport,context:e.context,frame:e.frame,camera:e.camera,scene:e.scene,composition:{visibleLabels:t.map(({id:s,kind:c,text:m})=>({id:s,kind:c,text:m})).sort((s,c)=>s.kind.localeCompare(c.kind)||s.id.localeCompare(c.id)),framing:Zu(e.framing)},metrics:{minimumHierarchyFontPx:oa(n.map(s=>s.renderedFontPx)),minimumHierarchyContrast:oa(n.map(s=>s.contrast)),projectedReliefPx:Math.round(e.scene.projectedReliefPx*100)/100},findings:a}}var ce=require("ogl");var Xe=require("ogl");var Mn=`
|
|
21
21
|
float chairWeight(float depth) {
|
|
22
22
|
return 1.0 - smoothstep(uChairFull, uChairNone, depth);
|
|
23
|
-
}`,
|
|
23
|
+
}`,ia=`
|
|
24
24
|
float occupantWeight(float depth) {
|
|
25
|
-
float nearWeight = smoothstep(${
|
|
26
|
-
float farWeight = 1.0 - smoothstep(${
|
|
25
|
+
float nearWeight = smoothstep(${er.toFixed(1)}, ${tr.toFixed(1)}, depth);
|
|
26
|
+
float farWeight = 1.0 - smoothstep(${Zo.toFixed(1)}, ${Jo.toFixed(1)}, depth);
|
|
27
27
|
return nearWeight * farWeight;
|
|
28
|
-
}`,
|
|
28
|
+
}`,aa=`
|
|
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
|
+
}`,Ju=`#version 300 es
|
|
78
78
|
precision highp float;
|
|
79
79
|
in vec3 position;
|
|
80
80
|
in vec3 normal;
|
|
@@ -112,7 +112,7 @@ void main() {
|
|
|
112
112
|
vNormalWorld = normalize(mat3(modelMatrix) * normal);
|
|
113
113
|
vColor = color;
|
|
114
114
|
gl_Position = projectionMatrix * mv;
|
|
115
|
-
}`,
|
|
115
|
+
}`,em=`#version 300 es
|
|
116
116
|
precision highp float;
|
|
117
117
|
in vec3 vColor;
|
|
118
118
|
in vec3 vNormalWorld;
|
|
@@ -185,7 +185,7 @@ void main() {
|
|
|
185
185
|
+ vec3(0.20, 0.10, 0.34) * focalHalo;
|
|
186
186
|
base = mix(base, display, poweredDisplay * verticalFace * 0.92);
|
|
187
187
|
fragColor = vec4(base, 1.0);
|
|
188
|
-
}`,
|
|
188
|
+
}`,tm=`#version 300 es
|
|
189
189
|
precision highp float;
|
|
190
190
|
in vec2 position; // quad corner in [-1,1]
|
|
191
191
|
in vec3 iOffset; // per-instance world position
|
|
@@ -211,7 +211,7 @@ out float vDim;
|
|
|
211
211
|
out float vDotWeight; // 1 = the dot IS this seat, 0 = the chair has taken over
|
|
212
212
|
out float vPhysicalSeat;
|
|
213
213
|
out float vPixelRadius;
|
|
214
|
-
${
|
|
214
|
+
${Mn}
|
|
215
215
|
void main() {
|
|
216
216
|
vec4 mv = modelViewMatrix * vec4(iOffset, 1.0);
|
|
217
217
|
float depth = max(-mv.z, 0.001);
|
|
@@ -244,7 +244,7 @@ void main() {
|
|
|
244
244
|
vPhysicalSeat = iPhysicalSeat;
|
|
245
245
|
vDim = (uFocusFloor < -0.5 || abs(iFloor - uFocusFloor) < 0.5) ? 0.0 : 1.0;
|
|
246
246
|
gl_Position = projectionMatrix * mv;
|
|
247
|
-
}`,
|
|
247
|
+
}`,nm=`#version 300 es
|
|
248
248
|
precision highp float;
|
|
249
249
|
in vec2 vUv;
|
|
250
250
|
in vec3 vColor;
|
|
@@ -303,7 +303,7 @@ void main() {
|
|
|
303
303
|
alpha *= vDotWeight;
|
|
304
304
|
if (alpha <= 0.0) discard;
|
|
305
305
|
fragColor = vec4(c, alpha);
|
|
306
|
-
}`,
|
|
306
|
+
}`,om=`#version 300 es
|
|
307
307
|
precision highp float;
|
|
308
308
|
in vec3 position; // local: x/z in units of the seat radius, y in METRES
|
|
309
309
|
in vec3 normal;
|
|
@@ -334,9 +334,9 @@ out vec3 vRing;
|
|
|
334
334
|
out float vDim;
|
|
335
335
|
out float vOccupant; // 1 = this vertex belongs to a person, not to the chair
|
|
336
336
|
out vec3 vOccupantTint;
|
|
337
|
-
${
|
|
338
|
-
${
|
|
339
|
-
${
|
|
337
|
+
${Mn}
|
|
338
|
+
${ia}
|
|
339
|
+
${aa}
|
|
340
340
|
void main() {
|
|
341
341
|
vec4 anchor = modelViewMatrix * vec4(iOffset, 1.0);
|
|
342
342
|
float viewDepth = -anchor.z;
|
|
@@ -422,7 +422,7 @@ void main() {
|
|
|
422
422
|
vRing = iRing;
|
|
423
423
|
vDim = (uFocusFloor < -0.5 || abs(iFloor - uFocusFloor) < 0.5) ? 0.0 : 1.0;
|
|
424
424
|
gl_Position = projectionMatrix * mv;
|
|
425
|
-
}`,
|
|
425
|
+
}`,rm=`#version 300 es
|
|
426
426
|
precision highp float;
|
|
427
427
|
in vec3 vColor;
|
|
428
428
|
in vec3 vNormalWorld;
|
|
@@ -479,14 +479,14 @@ void main() {
|
|
|
479
479
|
float sheen = clamp((1.0 - uRoughness) / 0.22, 0.15, 2.0);
|
|
480
480
|
base += vec3(0.26, 0.31, 0.38) * fres * 0.55 * mix(sheen, 1.0, vOccupant);
|
|
481
481
|
fragColor = vec4(base, 1.0);
|
|
482
|
-
}`,
|
|
482
|
+
}`,im=`#version 300 es
|
|
483
483
|
precision highp float;
|
|
484
484
|
in vec2 position;
|
|
485
485
|
out vec2 vUv;
|
|
486
486
|
void main() {
|
|
487
487
|
vUv = position * 0.5 + 0.5;
|
|
488
488
|
gl_Position = vec4(position, 0.999, 1.0);
|
|
489
|
-
}
|
|
489
|
+
}`,am=`#version 300 es
|
|
490
490
|
precision highp float;
|
|
491
491
|
in vec2 vUv;
|
|
492
492
|
uniform vec3 uTop;
|
|
@@ -497,7 +497,7 @@ void main() {
|
|
|
497
497
|
vec2 c = vUv - 0.5;
|
|
498
498
|
float vig = 1.0 - dot(c, c) * 0.85; // soft vignette
|
|
499
499
|
fragColor = vec4(col * vig, 1.0);
|
|
500
|
-
}`,
|
|
500
|
+
}`,sm=`#version 300 es
|
|
501
501
|
precision highp float;
|
|
502
502
|
in vec2 position;
|
|
503
503
|
in vec3 iOffset;
|
|
@@ -518,7 +518,7 @@ out float vPhysicalSeat;
|
|
|
518
518
|
out float vDotWeight;
|
|
519
519
|
out float vHidden;
|
|
520
520
|
flat out vec3 vPick;
|
|
521
|
-
${
|
|
521
|
+
${Mn}
|
|
522
522
|
void main() {
|
|
523
523
|
int id = gl_InstanceID + 1; // 0 reserved for no-hit
|
|
524
524
|
vPick = vec3(float(id & 255), float((id >> 8) & 255), float((id >> 16) & 255)) / 255.0;
|
|
@@ -534,7 +534,7 @@ void main() {
|
|
|
534
534
|
vPhysicalSeat = iPhysicalSeat;
|
|
535
535
|
vHidden = (uFocusFloor > -0.5 && abs(iFloor - uFocusFloor) > 0.5) ? 1.0 : 0.0;
|
|
536
536
|
gl_Position = projectionMatrix * mv;
|
|
537
|
-
}`,
|
|
537
|
+
}`,cm=`#version 300 es
|
|
538
538
|
precision highp float;
|
|
539
539
|
in vec2 vUv;
|
|
540
540
|
in float vPhysicalSeat;
|
|
@@ -548,7 +548,7 @@ void main() {
|
|
|
548
548
|
float d = mix(max(abs(vUv.x), abs(vUv.y)), length(vUv), vPhysicalSeat);
|
|
549
549
|
if (d > 1.0) discard; // hit-mask matches chair/bay shape
|
|
550
550
|
fragColor = vec4(vPick, 1.0);
|
|
551
|
-
}`,
|
|
551
|
+
}`,lm=`#version 300 es
|
|
552
552
|
precision highp float;
|
|
553
553
|
in vec3 position;
|
|
554
554
|
in float part;
|
|
@@ -569,9 +569,9 @@ uniform float uBackBase;
|
|
|
569
569
|
uniform float uFocusFloor;
|
|
570
570
|
flat out vec3 vPick;
|
|
571
571
|
out float vHidden;
|
|
572
|
-
${
|
|
573
|
-
${
|
|
574
|
-
${
|
|
572
|
+
${Mn}
|
|
573
|
+
${ia}
|
|
574
|
+
${aa}
|
|
575
575
|
void main() {
|
|
576
576
|
int id = int(iPickIndex + 0.5); // already global index + 1
|
|
577
577
|
vPick = vec3(float(id & 255), float((id >> 8) & 255), float((id >> 16) & 255)) / 255.0;
|
|
@@ -604,7 +604,7 @@ void main() {
|
|
|
604
604
|
float c = cos(iYaw), s = sin(iYaw);
|
|
605
605
|
vec3 rp = vec3(p.x * c + p.z * s, p.y, -p.x * s + p.z * c);
|
|
606
606
|
gl_Position = projectionMatrix * modelViewMatrix * vec4(iOffset + rp, 1.0);
|
|
607
|
-
}`,
|
|
607
|
+
}`,um=`#version 300 es
|
|
608
608
|
precision highp float;
|
|
609
609
|
flat in vec3 vPick;
|
|
610
610
|
in float vHidden;
|
|
@@ -612,7 +612,7 @@ out vec4 fragColor;
|
|
|
612
612
|
void main() {
|
|
613
613
|
if (vHidden > 0.5) discard;
|
|
614
614
|
fragColor = vec4(vPick, 1.0);
|
|
615
|
-
}`,
|
|
615
|
+
}`,mm=`#version 300 es
|
|
616
616
|
precision highp float;
|
|
617
617
|
in vec3 position;
|
|
618
618
|
in float floorIndex;
|
|
@@ -623,14 +623,14 @@ out float vHidden;
|
|
|
623
623
|
void main() {
|
|
624
624
|
vHidden = (uFocusFloor > -0.5 && abs(floorIndex - uFocusFloor) > 0.5) ? 1.0 : 0.0;
|
|
625
625
|
gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
|
|
626
|
-
}`,
|
|
626
|
+
}`,dm=`#version 300 es
|
|
627
627
|
precision highp float;
|
|
628
628
|
in float vHidden;
|
|
629
629
|
out vec4 fragColor;
|
|
630
630
|
void main() {
|
|
631
631
|
if (vHidden > 0.5) discard;
|
|
632
632
|
fragColor = vec4(0.0, 0.0, 0.0, 1.0);
|
|
633
|
-
}`;function
|
|
633
|
+
}`;function sa(e){return new Xe.Program(e,{vertex:sm,fragment:cm,transparent:!1,depthTest:!0,depthWrite:!0,cullFace:!1,uniforms:{uSeatRadius:{value:De},uSeatScale:{value:1},uMinPixels:{value:ht},uPixelToWorld:{value:.002},uChairFull:{value:_t},uChairNone:{value:bt},uFocusFloor:{value:-1}}})}function ca(e){return new Xe.Program(e,{vertex:lm,fragment:um,transparent:!1,depthTest:!0,depthWrite:!0,cullFace:!1,uniforms:{uChairFull:{value:_t},uChairNone:{value:bt},uBackRake:{value:Qn},uBackBase:{value:sn},uFocusFloor:{value:-1}}})}function la(e){return new Xe.Program(e,{vertex:mm,fragment:dm,transparent:!1,depthTest:!0,depthWrite:!0,cullFace:!1,uniforms:{uFocusFloor:{value:-1}}})}function ua(e,t=.78){return new Xe.Program(e,{vertex:Ju,fragment:em,cullFace:!1,depthTest:!0,depthWrite:!0,uniforms:{uKeyDir:{value:new Float32Array([.38,.86,.34])},uFocusFloor:{value:-1},uStructureDetail:{value:0},uRoughness:{value:t}}})}function ma(e){return new Xe.Program(e,{vertex:tm,fragment:nm,transparent:!0,depthTest:!0,depthWrite:!1,cullFace:!1,uniforms:{uSeatRadius:{value:De},uSeatScale:{value:1},uMinPixels:{value:ht},uPixelToWorld:{value:.002},uSeatFade:{value:0},uSeatDetail:{value:0},uFocusFloor:{value:-1},uFadeColor:{value:new Float32Array([.32,.37,.43])},uChairFull:{value:_t},uChairNone:{value:bt}}})}function da(e,t=.78){return new Xe.Program(e,{vertex:om,fragment:rm,transparent:!1,depthTest:!0,depthWrite:!0,cullFace:!1,uniforms:{uKeyDir:{value:new Float32Array([.38,.86,.34])},uFadeColor:{value:new Float32Array([.32,.37,.43])},uChairFull:{value:_t},uChairNone:{value:bt},uBackRake:{value:Qn},uBackBase:{value:sn},uFocusFloor:{value:-1},uRoughness:{value:t}}})}function fa(e,t,n){return new Xe.Program(e,{vertex:im,fragment:am,depthTest:!1,depthWrite:!1,cullFace:!1,uniforms:{uTop:{value:new Float32Array(t)},uBottom:{value:new Float32Array(n)}}})}var fm=.65,pm=new Set(["dimmed","sold"]),hm=new Set(["dimmed","sold","held"]);function pa(e,t,n){let r=new Set,o=!1,i=pe.indexOf("dimmed"),a=!1;for(let c=0;c<n.length;c+=1)if(n[c]===i){a=!0;break}let s=a?hm:pm;for(let c of e){let m=t.get(c.sectionId);if(!m||!m.length){r.add(c.sectionId);continue}let u=!1;for(let p of m){let d=pe[n[p]]??"available";if(!s.has(d)){u=!0;break}}u?r.add(c.sectionId):o=!0}return{lit:r,anyUnlit:o}}function ha(e,t,n,r,o,i){let a=[];for(let s of e){let c=o===null||o.has(s.sectionId);if(r.get(s.sectionId)===c)continue;r.set(s.sectionId,c);let m=(s.start+s.count)*3;for(let u=s.start*3;u<m;u++)t[u]=c?n[u]:n[u]+(i[u%3]-n[u])*fm;a.push(s)}return a}function ba(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 bm=new Float32Array([-1,-1,1,-1,1,1,-1,-1,1,1,-1,1]),ym=new Float32Array([-1,-1,3,-1,-1,3]);function ya(e,t){let n=new ce.Transform,r=new ce.Transform,o=new ce.Geometry(e,{position:{size:2,data:ym}}),i=fa(e,t.theme.background.top,t.theme.background.bottom),a=new ce.Mesh(e,{geometry:o,program:i});a.frustumCulled=!1,a.setParent(r);let s=new ce.Geometry(e,{position:{size:3,data:t.solids.position},normal:{size:3,data:t.solids.normal},color:{size:3,data:t.solids.color},floorIndex:{size:1,data:t.solids.floor},materialIndex:{size:1,data:t.solids.material}}),c=ua(e,t.theme.materials.roughness),m=new ce.Mesh(e,{geometry:s,program:c});m.frustumCulled=!1,m.setParent(n);let u=ma(e),p=new Float32Array(t.seats.count*3),d=pe.map(X=>t.theme.seatStates[X]);ba(p,t.seats.iState,0,t.seats.count,d,t.seats.iCategory);let l=new ce.Geometry(e,{position:{size:2,data:bm},iOffset:{size:3,data:t.seats.iPosition,instanced:1},iColor:{size:3,data:p,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 ce.Mesh(e,{geometry:l,program:u});f.frustumCulled=!1,t.seats.count>0&&f.setParent(n);let b=l.attributes.iColor,h=t.solids.color.slice(),y=t.theme.structure.ground,x=new Map(t.sectionSolidRanges.map(X=>[X.sectionId,!0])),g=vr(),v=da(e,t.theme.materials.roughness),A=Jt,P=new Float32Array(A*3),M=new Float32Array(A*3),E=new Float32Array(A),D=new Float32Array(A),z=new Float32Array(A),V=new Float32Array(A*3),L=new Float32Array(A),C=new Float32Array(A),_=new Float32Array(A),B=new Float32Array(A),S=new ce.Geometry(e,{position:{size:3,data:g.position},normal:{size:3,data:g.normal},part:{size:1,data:g.part},index:{data:g.index},iOffset:{size:3,data:P,instanced:1},iColor:{size:3,data:M,instanced:1},iRadius:{size:1,data:E,instanced:1},iYaw:{size:1,data:D,instanced:1},iGlyph:{size:1,data:z,instanced:1},iRing:{size:3,data:V,instanced:1},iFloor:{size:1,data:L,instanced:1},iPhysicalSeat:{size:1,data:C,instanced:1},iSeed:{size:1,data:B,instanced:1},iPickIndex:{size:1,data:_,instanced:1}}),I=new ce.Mesh(e,{geometry:S,program:v});I.frustumCulled=!1;let T=0,w=!1,k=!1,R=null,O=null,j=null,H=new Int32Array(0),N=()=>{let X=t.seats;for(let Q=0;Q<T;Q++){let q=H[Q];B[Q]=Mr(X.iState[q],q);let Z=X.iCategory&&X.iState[q]===0?null:d[X.iState[q]]??d[0];if(Z)M[Q*3]=Z[0],M[Q*3+1]=Z[1],M[Q*3+2]=Z[2];else{let te=t.theme.materials.seat??Xo([X.iCategory[q*3],X.iCategory[q*3+1],X.iCategory[q*3+2]]);M[Q*3]=te[0],M[Q*3+1]=te[1],M[Q*3+2]=te[2]}}S.attributes.iColor.needsUpdate=!0,S.attributes.iSeed.needsUpdate=!0},F={main:n,background:r,seatProgram:u,solidProgram:c,chairProgram:v,seatGeometry:l,chairGeometry:S,solidGeometry:s,drawCalls:3,setNearSeats(X,Q){let q=Math.min(Q,A);if(H=X,T=q,q===0){I.parent&&I.setParent(null),S.instancedCount=0,F.drawCalls=3+(w?1:0);return}let K=t.seats;for(let Z=0;Z<q;Z++){let te=X[Z];P[Z*3]=K.iPosition[te*3],P[Z*3+1]=K.iPosition[te*3+1],P[Z*3+2]=K.iPosition[te*3+2],E[Z]=K.iChairWidth[te],D[Z]=K.iYaw[te],z[Z]=K.iGlyph[te],V[Z*3]=K.iRing[te*3],V[Z*3+1]=K.iRing[te*3+1],V[Z*3+2]=K.iRing[te*3+2],L[Z]=K.iFloor[te],C[Z]=K.iPhysicalSeat[te],_[Z]=te+1}N(),S.attributes.iOffset.needsUpdate=!0,S.attributes.iRadius.needsUpdate=!0,S.attributes.iYaw.needsUpdate=!0,S.attributes.iGlyph.needsUpdate=!0,S.attributes.iRing.needsUpdate=!0,S.attributes.iFloor.needsUpdate=!0,S.attributes.iPhysicalSeat.needsUpdate=!0,S.attributes.iSeed.needsUpdate=!0,S.attributes.iPickIndex.needsUpdate=!0,S.instancedCount=q,I.parent||I.setParent(n),F.drawCalls=4+(w?1:0)},nearSeatCount(){return T},setSectionShellLit(X){let Q=ha(t.sectionSolidRanges,t.solids.color,h,x,X,y);if(!Q.length)return;let q=s.attributes.color,K=q.buffer;if(!K){q.needsUpdate=!0;return}e.bindBuffer(e.ARRAY_BUFFER,K);for(let Z of Q){let te=t.solids.color.subarray(Z.start*3,(Z.start+Z.count)*3);e.bufferSubData(e.ARRAY_BUFFER,Z.start*3*Float32Array.BYTES_PER_ELEMENT,te)}},uploadSeatStateRuns(X){if(!X.length)return;T&&N();for(let q of X)ba(p,t.seats.iState,q.start,q.length,d,t.seats.iCategory);let Q=b.buffer;if(!Q){b.needsUpdate=!0;return}e.bindBuffer(e.ARRAY_BUFFER,Q);for(let q of X){let K=p.subarray(q.start*3,(q.start+q.length)*3);e.bufferSubData(e.ARRAY_BUFFER,q.start*3*Float32Array.BYTES_PER_ELEMENT,K)}},dispose(){k=!0,o.remove(),i.remove(),s.remove(),c.remove(),l.remove(),u.remove(),S.remove(),v.remove(),R?.remove(),O?.remove(),j?.texture&&e.deleteTexture(j.texture)}},W=t.productionElements.find(X=>X.contentImageUrl&&X.contentPlane);if(W?.contentImageUrl&&W.contentPlane?.length===4&&typeof Image<"u"){let X=new Image;X.crossOrigin="anonymous",X.onload=()=>{if(k)return;let Q=W.contentPlane;R=new ce.Geometry(e,{position:{size:3,data:new Float32Array(Q.flat())},uv:{size:2,data:new Float32Array([0,1,1,1,0,0,1,0])},floorIndex:{size:1,data:new Float32Array(4).fill(W.floorIndex)},index:{data:new Uint16Array([0,1,2,2,1,3])}}),j=new ce.Texture(e,{image:X,generateMipmaps:!0,wrapS:e.CLAMP_TO_EDGE,wrapT:e.CLAMP_TO_EDGE,flipY:!1}),O=new ce.Program(e,{vertex:`#version 300 es
|
|
634
634
|
precision highp float;
|
|
635
635
|
in vec3 position; in vec2 uv; in float floorIndex;
|
|
636
636
|
uniform mat4 modelViewMatrix; uniform mat4 projectionMatrix; uniform float uFocusFloor;
|
|
@@ -638,4 +638,4 @@ void main() {
|
|
|
638
638
|
void main(){ vUv=uv; vDim=(uFocusFloor < -0.5 || abs(floorIndex-uFocusFloor)<0.5)?0.0:1.0; gl_Position=projectionMatrix*modelViewMatrix*vec4(position,1.0); }`,fragment:`#version 300 es
|
|
639
639
|
precision highp float;
|
|
640
640
|
in vec2 vUv; in float vDim; uniform sampler2D uImage; out vec4 fragColor;
|
|
641
|
-
void main(){ if(vDim>0.5) discard; vec4 c=texture(uImage,vUv); if(c.a<0.01) discard; fragColor=c; }`,uniforms:{uImage:{value:j},uFocusFloor:{value:-1}},transparent:!1,depthTest:!0,depthWrite:!0,cullFace:!1});let W=new ce.Mesh(e,{geometry:I,program:O});W.frustumCulled=!1,W.setParent(n),F.screenProgram=O,w=!0,F.drawCalls=3+(E?1:0)+1},X.src=K.contentImageUrl}return F}var _e=require("ogl");function ld(e,t,n){let r=e+(t<<8)+(n<<16);return r===0?-1:r-1}function ha(e,t,n,r,o,i){let a=-1,s=1/0;for(let c=0;c<n;c++)for(let u=0;u<t;u++){let d=(c*t+u)*4,p=ld(e[d],e[d+1],e[d+2]);if(p<0||p>=i)continue;let m=u-r,l=c-o,f=m*m+l*l;f<s&&(s=f,a=p)}return a}function ba(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 ud=["uSeatRadius","uSeatScale","uMinPixels","uPixelToWorld"],Sn=class{constructor(t,n,r,o,i){this.seatScene=new _e.Transform;this.chairScene=new _e.Transform;this.solidScene=new _e.Transform;this.target=null;this.restoreClear=[0,0,0];this.renderer=t,this.gl=t.gl,this.maxIndex=i,this.seatProg=ra(this.gl),this.chairProg=ia(this.gl),this.depthProg=aa(this.gl);let a=new _e.Mesh(this.gl,{geometry:n,program:this.seatProg});a.frustumCulled=!1,a.setParent(this.seatScene);let s=new _e.Mesh(this.gl,{geometry:r,program:this.chairProg});s.frustumCulled=!1,s.setParent(this.chairScene);let c=new _e.Mesh(this.gl,{geometry:o,program:this.depthProg});c.frustumCulled=!1,c.setParent(this.solidScene)}setRestoreClear(t){this.restoreClear=[t[0],t[1],t[2]]}syncFromSeatProgram(t){for(let r of ud)this.seatProg.uniforms[r].value=t.uniforms[r].value;let n=t.uniforms.uFocusFloor.value;this.seatProg.uniforms.uFocusFloor.value=n,this.chairProg.uniforms.uFocusFloor.value=n,this.depthProg.uniforms.uFocusFloor.value=n}ensureTarget(){let t=this.gl.drawingBufferWidth,n=this.gl.drawingBufferHeight;return this.target&&(this.target.width!==t||this.target.height!==n)&&this.destroyTarget(),this.target||(this.target=new _e.RenderTarget(this.gl,{width:t,height:n,depth:!0})),this.target}destroyTarget(){if(!this.target)return;let t=this.gl;this.target.buffer&&t.deleteFramebuffer(this.target.buffer);for(let n of this.target.textures??[])n.texture&&t.deleteTexture(n.texture);this.target.depthBuffer&&t.deleteRenderbuffer(this.target.depthBuffer),this.target=null}pick(t,n,r,o){let i=this.gl,a=this.ensureTarget(),s=i.drawingBufferWidth,c=i.drawingBufferHeight,u=Math.max(0,n-o),d=Math.max(0,r-o),p=Math.max(1,Math.min(s,n+o+1)-u),m=Math.max(1,Math.min(c,r+o+1)-d);i.enable(i.SCISSOR_TEST),i.scissor(u,d,p,m);let[l,f,b]=this.restoreClear;i.clearColor(0,0,0,1),this.renderer.render({scene:this.solidScene,camera:t,target:a,clear:!0}),this.renderer.render({scene:this.seatScene,camera:t,target:a,clear:!1}),this.renderer.render({scene:this.chairScene,camera:t,target:a,clear:!1}),i.clearColor(l,f,b,1),i.disable(i.SCISSOR_TEST);let h=new Uint8Array(p*m*4);return this.renderer.bindFramebuffer(a),i.readPixels(u,d,p,m,i.RGBA,i.UNSIGNED_BYTE,h),this.renderer.bindFramebuffer(),ha(h,p,m,n-u,r-d,this.maxIndex)}dispose(){this.destroyTarget(),this.seatProg.remove(),this.chairProg.remove(),this.depthProg.remove()}};function ya(e,t){let n=[];for(let r of t)e.has(r.seatId)?e.set(r.seatId,Rt(r.state)):n.push(r);return n}function ga(e,t,n){let r=new Set;for(let a of t)(e.has(a)||n(a)!==void 0)&&r.add(a);let o=new Map(e),i=[];for(let[a,s]of e)r.has(a)||(i.push({seatId:a,state:pe[s]??"available"}),o.delete(a));for(let a of r){if(o.has(a))continue;let s=n(a);s!==void 0&&(o.set(a,s),i.push({seatId:a,state:"selected"}))}return{updates:i,next:o}}var We=require("ogl");function dd(e,t){return[e[0]-t[0],e[1]-t[1],e[2]-t[2]]}function xa(e,t){return[e[0]+t[0],e[1]+t[1],e[2]+t[2]]}function md(e,t){return[e[0]*t,e[1]*t,e[2]*t]}function va(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 Ro(e){let t=Math.max(0,Math.min(1,e));return t*t*t*(t*(t*6-15)+10)}function Io(e,t){return Math.max(0,Math.min(1,e+t))}function Sa(e,t){let n=e.length;if(n===0)return[0,0,0];if(n===1)return[...e[0]];let r=Math.max(0,Math.min(1,t)),o=n-1,i=Math.floor(r*o);i>=o&&(i=o-1);let a=r*o-i,s=e[Math.max(0,i-1)],c=e[i],u=e[i+1],d=e[Math.min(n-1,i+2)],p=a*a,m=p*a,l=[0,0,0];for(let f=0;f<3;f++)l[f]=.5*(2*c[f]+(-s[f]+u[f])*a+(2*s[f]-5*c[f]+4*u[f]-d[f])*p+(-s[f]+3*c[f]-3*u[f]+d[f])*m);return l}function Eo(e,t,n,r,o){let i=va(dd(t,n));i[0]===0&&i[1]===0&&i[2]===0&&(i=[0,0,1]);let a=xa(xa(t,md(i,2.5)),[0,1.5,0]),s=[t[0]-r[0],0,t[2]-r[2]],c=va(s);c[0]===0&&c[2]===0&&(c=[i[0],0,i[2]]);let u=Math.max(1,o),d=[r[0]+c[0]*u*1.3,r[1]+u*.75,r[2]+c[2]*u*1.3];return{waypoints:[e,d,a],finalPos:a}}function To(e,t,n=35,r=28){let o=Ro(t),i=Sa(e,o),a=Ro(Math.max(0,Math.min(1,(t-.66)/.34)));return{pos:i,fov:n+(r-n)*a,eased:o}}function Ca(e,t,n){let r=e.position.clone(),o=new We.Quat().copy(e.quaternion);e.position.set(t[0],t[1],t[2]),e.lookAt(new We.Vec3(n[0],n[1],n[2]));let i=new We.Quat().copy(e.quaternion);return e.position.copy(r),e.quaternion.copy(o),i}var Mn=class{constructor(t){this.active=!1;this.waypoints=[];this.startQuat=new We.Quat;this.endQuat=new We.Quat;this.outQuat=new We.Quat;this.startTime=0;this.duration=2500;this.endFov=28;this.resolveFn=null;this.camera=t}start(t,n,r,o=2500,i=28){return this.settle(),this.waypoints=t,this.startQuat.copy(n),this.endQuat.copy(r),this.duration=o,this.endFov=i,this.startTime=performance.now(),this.active=!0,new Promise(a=>{this.resolveFn=a})}update(t){if(!this.active)return!1;let n=Math.min(1,(t-this.startTime)/this.duration),{pos:r,fov:o,eased:i}=To(this.waypoints,n,35,this.endFov);return this.camera.position.set(r[0],r[1],r[2]),this.outQuat.copy(this.startQuat).slerp(this.endQuat,Io(i,.15)),this.camera.quaternion.copy(this.outQuat),this.camera.fov=o,this.camera.updateProjectionMatrix(),n>=1?(this.settle(),!1):!0}cancel(){this.settle()}settle(){this.active=!1;let t=this.resolveFn;this.resolveFn=null,t&&t()}};var Aa=$n,fd=.12,pd=.25,hd=1.5;function Ra(e,t,n=0,r,o){let i=[t.x*G,n+hd,t.y*G],a=o?[o[0],o[1],o[2]]:i,s=e[1],c=Number.isFinite(s)?s+Aa:Number.isFinite(r)?n+r:n+Aa,u=i[0]-e[0],d=i[2]-e[2],p=Math.hypot(u,d),m=p>.001?Math.min(fd,p*pd):0,l=p>.001?u/p:0,f=p>.001?d/p:0;return{eye:[e[0]+l*m,c,e[2]+f*m],focal:a}}var st=Math.PI/180,bd=45,Ia=80,wn=70,yd=1,gd=.99;function xd(e,t){if(!(e<yd))return Ia;if(!(Number.isFinite(t)&&t>0))return wn;let n=2*Math.atan(t/(2*Pn*gd)/Math.max(.05,e))/st;return Math.max(wn,Math.min(Ia,n))}var vd=.25,Pn=1,Sd=.25,Md=12*st,wd=.2,Pd=1.5,Ea=.8,Ta=6,Fa=1.9,Cd=2/3,Ad=.12,Rd=.9,Id=1.2,Ed=2,Da=.05,Td=6;function Oa(e,t,n=0){if(!e.length)return{min:[t[0]-6,n,t[2]-6],max:[t[0]+6,Math.max(n+Ea,t[1]),t[2]+6]};let r=1/0,o=-1/0,i=1/0,a=-1/0,s=n;for(let f of e)r=Math.min(r,f.cx-f.halfX),o=Math.max(o,f.cx+f.halfX),i=Math.min(i,f.cz-f.halfZ),a=Math.max(a,f.cz+f.halfZ),s=Math.max(s,f.y);let c=o-r,u=a-i,d=Math.max(c,Math.min(u,Ta))/2,p=Math.max(u,Math.min(c,Ta))/2,m=(r+o)/2,l=(i+a)/2;return{min:[m-d,n,l-p],max:[m+d,Math.max(n+Ea,s),l+p]}}function _d(e){return{min:[e.min[0],e.min[1],e.min[2]],max:[e.max[0],e.max[1]+Fa,e.max[2]]}}function _o(e){let t=e.max[1];return[(e.min[0]+e.max[0])/2,Math.max(e.min[1]+Pd,t+wd,t+Fa*Cd),(e.min[2]+e.max[2])/2]}function Va(e,t){let n=e[0]-t[0],r=e[2]-t[2],o=Math.hypot(n,r);return o<.001?{x:0,z:1}:{x:n/o,z:r/o}}function _a(e,t,n){let r=t[0]-e[0],o=t[1]-e[1],i=t[2]-e[2],a=Math.hypot(r,o,i)||1;r/=a,o/=a,i/=a;let s=-i,c=r,u=Math.hypot(s,c);if(u<1e-6)return 1/0;s/=u,c/=u;let d=1/0,p=-1/0;for(let m=0;m<8;m++){let l=(m&1?n.max[0]:n.min[0])-e[0],f=(m&2?n.max[1]:n.min[1])-e[1],b=(m&4?n.max[2]:n.min[2])-e[2],h=Math.max(Da,l*r+f*o+b*i),y=(l*s+b*c)/h;y<d&&(d=y),y>p&&(p=y)}return p-d}function ka(e,t,n){let r=t[0]-e[0],o=t[1]-e[1],i=t[2]-e[2],a=Math.hypot(r,o,i)||1;r/=a,o/=a,i/=a;let s=-i,c=r,u=Math.hypot(s,c);if(u<1e-6)return 1/0;s/=u,c/=u;let d=-c*o,p=c*r-s*i,m=s*o,l=1/0,f=-1/0;for(let b=0;b<8;b++){let h=(b&1?n.max[0]:n.min[0])-e[0],y=(b&2?n.max[1]:n.min[1])-e[1],g=(b&4?n.max[2]:n.min[2])-e[2],x=Math.max(Da,h*r+y*o+g*i),v=(h*d+y*p+g*m)/x;v<l&&(l=v),v>f&&(f=v)}return f-l}function Cn(e,t){return Math.tan(e*st/2)*Math.max(.05,t)}function La(e,t,n){let r=xd(n,e),o=c=>Math.max(bd,Math.min(r,c)),i=c=>2*Math.atan(c)/st,a=Number.isFinite(e)&&e>0?o(i(e/(2*vd)/Math.max(.05,n))):r;if(!(Number.isFinite(t)&&t>0))return a;let s=Math.min(a,o(i(t/(2*Ad))));return e/(2*Cn(s,n))>Pn?a:s}function Ba(e,t,n){let r=_o(t),o=[e[0],e[1],e[2]],i=0,a=0,s=l=>{if(!(l>0))return;let f=Va(o,r);o[0]+=f.x*l,o[2]+=f.z*l,a+=l},c=t.max[1]+Sd-o[1];c>0&&(o[1]+=c,i=c,s(c/Math.tan(Md)));let u=_d(t),d=_a(o,r,t),p=La(d,ka(o,r,u),n),m=d/(2*Cn(p,n));for(let l=0;l<Td&&m>Pn;l++){let f=Math.max(1,Math.hypot(o[0]-r[0],o[2]-r[2])),b=Number.isFinite(m)?m/Pn:2;s(Math.min(60,f*(Math.min(4,b)-1)+.5)),d=_a(o,r,t),p=La(d,ka(o,r,u),n),m=d/(2*Cn(p,n))}return{eye:o,focal:r,fov:p,raisedM:i,pulledBackM:a,stageFrameWidth:m}}function kd(e,t,n){let r=Math.tan(t*st/2),o=Cn(t,n);return Math.max(1,e/Math.max(.05,Math.min(r,o)))}function Na(e,t){let{aspect:n,venue:r}=t,o=e.focal,i=Va(e.eye,o),a=m=>(m[0]-o[0])*i.x+(m[2]-o[2])*i.z,s=[{name:"seat",eye:e.eye,focal:o,fov:e.fov}],c=Ed*(t.rowDepthM??Rd);s.push({name:"row",eye:[e.eye[0]+i.x*c,e.eye[1]+Id,e.eye[2]+i.z*c],focal:o,fov:e.fov});let u=(m,l,f,b)=>{let h=kd(f,e.fov,n)*1.08,y=h*Math.sin(b*st),g=h*Math.cos(b*st);return{name:m,eye:[l[0]+i.x*g,l[1]+y,l[2]+i.z*g],focal:l,fov:e.fov}};t.section&&t.section.radius>0&&s.push(u("section",t.section.center,t.section.radius,14)),s.push(u("venue",r.center,Math.max(1,r.radius),26));let d=[],p=-1/0;for(let m of s){let l=a(m.eye);d.length&&l<=p+.5||(d.push(m),p=l)}return d}var ja=require("ogl"),Gt=Math.PI/180,Ga=320,za=70*Gt,Ld=32*Gt,Fd=24*Gt,Ha=.0026,Dd=.22,Od=.006,Vd=180,Bd=4,Se=(e,t,n)=>Math.max(t,Math.min(n,e)),Ua=e=>e<.5?4*e*e*e:1-Math.pow(-2*e+2,3)/2;function Ya(e){let{canvas:t,camera:n}=e,r=[],o=!1,i=0,a=0,s=0,c=0,u=0,d=0,p=!1,m=[0,0],l=0,f=!1,b=null,h=null,y=new Map,g=!1,x=0,v=0,A=0,S=0,P=()=>o&&r.length?r[Se(Math.round(i),0,r.length-1)].name:null,T=()=>{let w=P();w!==b&&(b=w,e.onStopChange?.(w))},D=()=>{if(!o||!r.length)return;let w=r[Se(Math.floor(i),0,r.length-1)],L=r[Se(Math.ceil(i),0,r.length-1)],I=Se(i-Math.floor(i),0,1),O=(Le,Pe)=>Le+(Pe-Le)*I,j=[O(w.eye[0],L.eye[0]),O(w.eye[1],L.eye[1]),O(w.eye[2],L.eye[2])],U=[O(w.focal[0],L.focal[0]),O(w.focal[1],L.focal[1]),O(w.focal[2],L.focal[2])],N=U[0]-j[0],F=U[1]-j[1],K=U[2]-j[2],X=Math.hypot(N,F,K)||1,Q=Math.atan2(N,K),W=Math.asin(Se(F/X,-1,1)),$=Q+a,Z=Se(W+s,-80*Gt,80*Gt),te=Math.cos(Z)*X;N=Math.sin($)*te,F=Math.sin(Z)*X,K=Math.cos($)*te,n.position.set(j[0],j[1],j[2]),n.fov=O(w.fov,L.fov),n.updateProjectionMatrix(),n.lookAt(new ja.Vec3(j[0]+N,j[1]+F,j[2]+K)),e.onApplied?.()},z=()=>{if(!o||!r.length)return;let w=Se(Math.round(i),0,r.length-1);if(e.reducedMotion()){p=!1,i=w,D(),T(),e.requestRender();return}if(Math.abs(w-i)<.001){p=!1,T();return}c=i,u=w,d=performance.now(),p=!0,e.requestRender()},B=w=>{!o||r.length<2||(p=!1,i=Se(i+w,0,r.length-1),D(),T(),e.requestRender())},_=(w,L)=>{o&&(p=!1,f=!1,a=Se(a-w*Ha,-za,za),s=Se(s-L*Ha,-Fd,Ld),D(),e.requestRender())},C=w=>{o&&(y.set(w.pointerId,{x:w.clientX,y:w.clientY}),y.size===1?(g=!0,S=0,x=w.clientX,v=w.clientY):y.size===2&&(g=!1,A=k()))},k=()=>{let w=[...y.values()];return w.length<2?0:Math.hypot(w[0].x-w[1].x,w[0].y-w[1].y)},V=w=>{if(!o||!y.has(w.pointerId))return;if(y.set(w.pointerId,{x:w.clientX,y:w.clientY}),y.size>=2){let O=k();A>0&&B((A-O)*Od),A=O;return}if(!g)return;let L=w.clientX-x,I=w.clientY-v;x=w.clientX,v=w.clientY,S+=Math.abs(L)+Math.abs(I),!(S<=Bd)&&_(L,I)},M=w=>{y.delete(w.pointerId)&&(y.size<2&&(A=0),y.size===0&&(g=!1,z()))},R=w=>{if(!o)return;w.preventDefault();let L=w.deltaMode===1?16:w.deltaMode===2?100:1,I=Se(w.deltaY*L/100,-2,2);B(I*Dd),h&&clearTimeout(h),h=setTimeout(()=>{h=null,z()},Vd)},E=()=>{o&&(o=!1,p=!1,f=!1,r=[],y.clear(),g=!1,h&&(clearTimeout(h),h=null),b!==null&&(b=null,e.onStopChange?.(null)))};return t.addEventListener("pointerdown",C),t.addEventListener("pointermove",V),t.addEventListener("pointerup",M),t.addEventListener("pointercancel",M),t.addEventListener("wheel",R,{passive:!1}),{get active(){return o},enter(w){if(w.length<2){E();return}r=w,o=!0,i=0,a=0,s=0,p=!1,f=!1,b=null,D(),T(),e.requestRender()},exit:E,recentre(){return o?Math.abs(a)<1e-4&&Math.abs(s)<1e-4?!0:e.reducedMotion()?(f=!1,a=0,s=0,D(),e.requestRender(),!0):(m=[a,s],l=performance.now(),f=!0,e.requestRender(),!0):!1},update(w){if(!o)return!1;let L=!1;if(f){let I=Se((w-l)/Ga,0,1),O=1-Ua(I);a=m[0]*O,s=m[1]*O,I>=1?(f=!1,a=0,s=0):L=!0}if(p){let I=Se((w-d)/Ga,0,1);i=c+(u-c)*Ua(I),I>=1?(p=!1,i=u,T()):L=!0}return D(),L},currentStop:P,dispose(){E(),t.removeEventListener("pointerdown",C),t.removeEventListener("pointermove",V),t.removeEventListener("pointerup",M),t.removeEventListener("pointercancel",M),t.removeEventListener("wheel",R)}}}function Xa(e){return e.flying?"cinematic":e.panoramaMounted?"panorama":e.seatViewActive?"seatView":"orbit"}var Do=null;function is(){return Do??=Promise.resolve().then(()=>(rs(),os)).catch(e=>{throw Do=null,e}),Do}var as=()=>typeof performance<"u"&&performance.now?performance.now():Date.now(),kn=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=as(),this.emit("3d_panorama_opened")}panoramaClosed(){let t=this.panoramaOpenedAt?Math.round(as()-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 ss(e){let t=e.style.position;return getComputedStyle(e).position!=="static"?()=>{}:(e.style.position="relative",()=>{e.style.position==="relative"&&(e.style.position=t)})}function cs(e){let{container:t,model:n,opts:r,expandedSeatById:o,seatIdsByRow:i,isNarrow:a}=e,s=null,c=()=>{if(!s)return;let p=a();Object.assign(s.style,p?{left:"12px",right:"12px",bottom:"70px",transform:"none",justifyContent:"center"}:{left:"50%",right:"auto",bottom:"18px",transform:"translateX(-50%)",justifyContent:"initial"})},u=()=>{s?.remove(),s=null};return{show:(p,m,l=!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 b=r.chrome?.caption!==!1,h=r.chrome?.seatStepper!==!1;if(!b&&!h)return null;let y=o.get(p),g=y?.sectionId?n.sections.find(z=>z.id===y.sectionId):void 0,x=y?.label??p;f.setAttribute("aria-label",`Explore views near ${g?.label?`${g.label}, `:""}seat ${x}`);let v=document.createElement("span");v.textContent=r.seatViewCaption?.(p)??["Live 3D seat view",g?.label,x].filter(Boolean).join(" \xB7 "),Object.assign(v.style,{maxWidth:"min(70vw, 560px)",padding:"5px 10px",borderRadius:"999px",overflow:"hidden",color:"#d9e3f5",background:"rgba(12,18,32,0.72)",font:"600 11px/1.2 inherit",textOverflow:"ellipsis",whiteSpace:"nowrap",backdropFilter:"blur(6px)"}),b&&f.appendChild(v);let A=document.createElement("div");Object.assign(A.style,{display:"flex",alignItems:"center",justifyContent:"center",gap:"6px"}),f.appendChild(A);let S=y?.rowId?i.get(y.rowId):void 0,P=S?.indexOf(p)??-1,T=P>=0?[S?.[P-1],S?.[P+1]]:[void 0,void 0],D=(z,B,_,C=!1)=>{let k=document.createElement("button");k.type="button",k.textContent=z,k.setAttribute("aria-label",B),Object.assign(k.style,{minHeight:"44px",padding:C?"10px 16px":"10px",borderRadius:"999px",background:"rgba(12,18,32,0.78)",color:"#eef1f8",border:"1px solid rgba(150,165,205,0.4)",backdropFilter:"blur(6px)",font:"600 13px/1 inherit",cursor:"pointer",whiteSpace:"nowrap"}),C||(k.style.minWidth="44px"),C&&(k.dataset.panoramaTrigger=""),k.addEventListener("click",_),A.appendChild(k)};if(h&&T[0]){let z=o.get(T[0])?.label??T[0];D("\u2039",`View previous seat ${z}`,()=>{e.flyToSeat(T[0])})}if(h&&r.getSeatView){let z=r.seatViewActionLabel?.(p)??"Open 360\xB0 panorama";D(l?`\u21BB Retry ${z}`:`\u25C9 ${z}`,`${l?"Retry":z} from seat ${x}`,()=>{if(e.isDisposed()||m!==e.flightGen()){u();return}u(),e.openPanorama(p,400,m)},!0)}if(h&&T[1]){let z=o.get(T[1])?.label??T[1];D("\u203A",`View next seat ${z}`,()=>{e.flyToSeat(T[1])})}return!A.childElementCount&&!b?null:(t.appendChild(f),s=f,c(),f)},remove:u,layout:c}}function ls(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 d=document.createElement("button");d.type="button",d.textContent="\u2212",d.setAttribute("aria-label","Zoom out of the 3D venue"),d.dataset.tooltip="Zoom out";let p=document.createElement("button");p.type="button",p.textContent="+",p.setAttribute("aria-label","Zoom into the 3D venue"),p.dataset.tooltip="Zoom in";for(let h of[c,u,d,p])h.className="sl-3d-icon-control",Object.assign(h.style,{width:"44px",minWidth:"44px",minHeight:"44px",padding:"9px",border:"1px solid rgba(150,165,205,0.35)",borderRadius:"999px",color:"#c9d4ea",background:"rgba(12,18,32,0.82)",font:"600 17px/1 inherit",backdropFilter:"blur(6px)",cursor:"pointer",whiteSpace:"nowrap"});a.append(c,u),s.append(p,d);let m=h=>{n.setPrimaryDragMode(h);let y=h==="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")),d.addEventListener("click",()=>n.zoomBy(1.22)),p.addEventListener("click",()=>n.zoomBy(.82)),o.append(a,s),m("orbit"),t.appendChild(o);let l=e.enabled!==!1,f=()=>{let h=r();o.style.display=i||!l?"none":"flex",o.style.right=h?"12px":"14px",o.style.bottom=h?"calc(env(safe-area-inset-bottom, 0px) + 76px)":"14px",a.style.display=h?"none":"flex",p.style.display=h?"none":"",d.style.display=h?"none":""};return f(),{element:o,utilityControls:s,setNavigationMode:m,setSeatViewLocked:h=>{i=h,n.setInteractionEnabled(!h),f()},seatViewLocked:()=>i,layout:f}}var Jd=12;function em(e,t){if(!e)return!1;let n=e.x-t[0],r=e.y-t[1],o=e.z-t[2];return Math.hypot(n,r,o)>Jd}function us(e){let{glctx:t,orbit:n,model:r,seats:o,opts:i,cinematic:a,analytics:s,seatIdByIndex:c,sectionIdBySeatId:u,tapSlop:d,tapMs:p,cancelFlight:m,focusSectionCamera:l,setSelection:f,ensureSeatView:b}=e,h=0,y=0,g=0,x=-1,v=!1,A=!1,S=B=>{e.seatViewLocked()||x===-1&&(x=B.pointerId,h=B.clientX,y=B.clientY,g=performance.now(),v=!1,A=a.active,a.active&&(s.cinematicCancelled(),m(),i.onViewTargetChange?.(null)))},P=B=>{B.pointerId===x&&Math.hypot(B.clientX-h,B.clientY-y)>d&&(v=!0)},T=(B,_,C,k,V)=>{let M=t.canvas.getBoundingClientRect(),R=t.canvas.clientWidth||M.width||1,E=t.canvas.clientHeight||M.height||1,w=B-M.left,L=_-M.top,I=k*k,O=-1,j=I,U=1/0;for(let N of o){if(C&&N.sectionId!==C)continue;let F=r.seats.idToIndex.get(N.id);if(F===void 0)continue;if(V){let Z=Math.round(r.seats.iState[F]??0);if(Z!==0&&Z!==3)continue}let K=F*3,X=Ye(n.camera.projectionViewMatrix,[r.seats.iPosition[K],r.seats.iPosition[K+1]+.55,r.seats.iPosition[K+2]],R,E);if(!X.visible)continue;let Q=X.x-w,W=X.y-L,$=Q*Q+W*W;($<j||Math.abs($-j)<1&&X.depth<U)&&(O=F,j=$,U=X.depth)}return O},D=(B,_)=>{let C=e.gpu(),k=e.pick();if(!C||!k)return-1;k.syncFromSeatProgram(C.seatProgram);let V=t.canvas.getBoundingClientRect(),M=t.renderer.dpr,{x:R,y:E}=ba(B,_,V,M,t.gl.drawingBufferWidth,t.gl.drawingBufferHeight),w=Math.max(2,Math.round(8*M));return k.pick(n.camera,R,E,w)};return{onDown:S,onMove:P,onUp:B=>{if(B.pointerId!==x)return;let _=!v&&performance.now()-g<p;if(x=-1,A){A=!1;return}let C=e.gpu(),k=e.pick();if(!_||!C||!k)return;let V=D(B.clientX,B.clientY);if(e.focusedSectionId()&&V>=0){let E=c[V],w=E?u.get(E):void 0;if(w&&w!==e.focusedSectionId()&&l(w))return}if(e.focusedSectionId()&&V<0&&(V=T(B.clientX,B.clientY,e.focusedSectionId(),44,!1)),e.focusedSectionId()&&V<0){let E=T(B.clientX,B.clientY,null,72,!1),w=E>=0?c[E]:void 0,L=w?u.get(w):void 0;if(L&&L!==e.focusedSectionId()&&l(L))return}if(!e.focusedSectionId()){V<0&&(V=T(B.clientX,B.clientY,null,42,!1));let E=V>=0?c[V]:void 0,w=E?u.get(E):void 0;if(w&&l(w))return}if(V<0||V>=c.length){e.selection().size&&(f([]),i.onViewTargetChange?.(null));return}let M=c[V],R=pe[Math.round(r.seats.iState[V]??0)]??"available";if(R!=="available"&&R!=="selected"){i.onSeatInspect?.(M,R);return}if(e.selection().has(M)&&e.selection().size===1){f([]),i.onViewTargetChange?.(null),i.onSeatPick?.(M);return}if(f([M]),b(M),s.seatPicked(M,u.get(M)),i.onSeatPick?.(M),e.focusedSectionId()){let E=V*3,w=[r.seats.iPosition[E],r.seats.iPosition[E+1],r.seats.iPosition[E+2]];em(n.camera?.position,w)&&e.focusSeatCamera(M)}}}}var Ln=class{constructor(t,n){this.minX=0;this.minZ=0;this.cell=1;this.cols=1;this.rows=1;this.cellStart=null;this.cellItems=null;this.iPosition=t,this.count=n}ensureGrid(){if(this.cellStart||this.count===0)return;let t=this.iPosition,n=1/0,r=1/0,o=-1/0,i=-1/0;for(let l=0;l<this.count;l++){let f=t[l*3],b=t[l*3+2];f<n&&(n=f),f>o&&(o=f),b<r&&(r=b),b>i&&(i=b)}let a=Math.max(o-n,.001),s=Math.max(i-r,.001);this.cell=Math.max(Math.sqrt(a*s*4/this.count),.25),this.cols=Math.max(1,Math.ceil(a/this.cell)+1),this.rows=Math.max(1,Math.ceil(s/this.cell)+1),this.minX=n,this.minZ=r;let c=this.cols*this.rows,u=new Int32Array(c+1),d=l=>{let f=Math.min(this.cols-1,Math.max(0,Math.floor((t[l*3]-n)/this.cell)));return Math.min(this.rows-1,Math.max(0,Math.floor((t[l*3+2]-r)/this.cell)))*this.cols+f};for(let l=0;l<this.count;l++)u[d(l)+1]++;for(let l=0;l<c;l++)u[l+1]+=u[l];let p=new Int32Array(this.count),m=u.slice(0,c);for(let l=0;l<this.count;l++)p[m[d(l)]++]=l;this.cellStart=u,this.cellItems=p}gather(t,n,r,o){this.ensureGrid();let i=this.cellStart,a=this.cellItems;if(!i||!a)return 0;let s=o.length,c=r*r,u=Math.floor((t-this.minX)/this.cell),d=Math.floor((n-this.minZ)/this.cell),p=Math.ceil(r/this.cell)+1,m=this.iPosition,l=0;for(let f=0;f<=p&&l<s;f++){let b=d-f,h=d+f,y=u-f,g=u+f;for(let x=b;x<=h&&l<s;x++){if(x<0||x>=this.rows)continue;let v=x===b||x===h;for(let A=y;A<=g&&l<s;A++){if(!v&&A!==y&&A!==g){A=g-1;continue}if(A<0||A>=this.cols)continue;let S=x*this.cols+A;for(let P=i[S],T=i[S+1];P<T&&l<s;P++){let D=a[P],z=m[D*3]-t,B=m[D*3+2]-n;z*z+B*B<=c&&(o[l++]=D)}}}}return l}};var Fn=class{constructor(t){this.ctx=t;this.detailVisible=!1;this.seatDetailMix=0;this.structureDetailMix=0;this.nearBuf=new Int32Array($t);this.lastGatherX=1/0;this.lastGatherZ=1/0;this.nearIndex=new Ln(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)<jn)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>Un){r.nearSeatCount()&&r.setNearSeats(this.nearBuf,0);return}let s=this.nearIndex.gather(o.x,o.z,Un,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 Dn=require("ogl");function ds(){let e="http://www.w3.org/2000/svg",t=document.createElementNS(e,"svg");t.setAttribute("viewBox","0 0 24 24"),t.setAttribute("width","18"),t.setAttribute("height","18"),t.setAttribute("aria-hidden","true"),t.setAttribute("focusable","false"),t.setAttribute("fill","none"),t.setAttribute("stroke","currentColor"),t.setAttribute("stroke-width","2"),t.setAttribute("stroke-linecap","round"),t.setAttribute("stroke-linejoin","round");let n=document.createElementNS(e,"path");return n.setAttribute("d","M8 3H5a2 2 0 0 0-2 2v3M16 3h3a2 2 0 0 0 2 2v3M8 21H5a2 2 0 0 0-2-2v-3M16 21h3a2 2 0 0 0 2-2v-3"),t.appendChild(n),t}function ps(e){let{container:t,model:n,opts:r,orbit:o,cinematic:i,analytics:a,loop:s,labelOverlay:c,stageAzimuth:u,overviewFraming:d}=e,p=0,m=-1,l=(S,P,T=28)=>{o.camera.position.set(S[0],S[1],S[2]),o.camera.lookAt(new Dn.Vec3(P[0],P[1],P[2])),o.camera.fov=T,o.camera.updateProjectionMatrix()},f=document.createElement("button");f.className="sl-3d-overview-control sl-3d-icon-control",f.type="button",f.replaceChildren(ds()),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 b=()=>{f.firstElementChild||f.replaceChildren(ds())};b();let h=S=>{m=S;let P=e.gpu();P&&(P.seatProgram.uniforms.uFocusFloor.value=S,P.solidProgram.uniforms.uFocusFloor.value=S,P.chairProgram.uniforms.uFocusFloor.value=S),e.showSectionSeatLabels(null)},y=()=>{if(e.isDisposed())return;r.onViewTargetChange?.(null),r.onSectionFocusChange?.(null),e.panorama()&&(e.panorama().dispose(),e.setPanorama(null),a.panoramaClosed()),e.setPanoramaSphereVisible(!1),e.panoramaLoadAbort()?.abort(),e.setPanoramaLoadAbort(null),e.restorePanoramaLayer(),f.style.display="",c.setVisible(!0),e.setFrozen(!1);let S=m>=0?n.floors[m]:null;if(e.setNearFieldDetailEnabled(!!S),e.setSeatViewLocked(!1),g(),e.removeArriveChip(),e.setNavigationMode("orbit"),S){let P=S.focalWorld[0]-S.center[0],T=S.focalWorld[2]-S.center[2],D=Math.hypot(P,T)>S.radius*.12?Math.atan2(P,T):u,z={center:S.center,radius:S.radius,box:S.box},B={polarDeg:58,margin:1.12};e.reducedMotion()?o.frame(z,!1,D,!1,B):o.frameSoft(z,D,!1,B)}else e.reducedMotion()?o.frame(n.bounds,!1,u,r.portraitOverviewCrop===!0,d):o.frameSoft(n.bounds,u,r.portraitOverviewCrop===!0,d);e.showSectionSeatLabels(null),s.requestRender()},g=()=>{p++,e.setSeatStepping(!1),e.panoramaLoadAbort()?.abort(),e.setPanoramaLoadAbort(null),i.active&&(i.cancel(),o.resumeAfterFlight(n.focalWorld))},x=S=>{if(e.isDisposed()||!e.gpu())return Promise.resolve();let P=n.seats.idToIndex.get(S);if(P===void 0)return Promise.resolve();e.setNearFieldDetailEnabled(!0),r.onViewTargetChange?.(S),e.panorama()&&(e.panorama().dispose(),e.setPanorama(null),e.setPanoramaSphereVisible(!1),f.style.display="",e.restorePanoramaLayer()),e.panoramaLoadAbort()?.abort(),e.setPanoramaLoadAbort(null),e.setFrozen(!1);let T=e.inSeatView()&&r.arriveAtSeatEye===!0;e.setSeatStepping(T),e.setSeatViewLocked(!1);let D=++p;T?e.showArriveChip(S,D):e.removeArriveChip();let{eye:z,focal:B}=e.resolvedSeatViewPose(S,P),_=r.arriveAtSeatEye?e.seatViewArrival(S,P):null,C=_?_.focal:B,k=[o.camera.position.x,o.camera.position.y,o.camera.position.z],V=Eo(k,_?.eye??z,C,n.bounds.center,n.bounds.radius),M=_?_.eye:r.arriveAtSeatEye?z:V.finalPos,R=_?_.fov:r.arriveAtSeatEye?t.clientWidth/Math.max(1,t.clientHeight)<.7?wn:65:28,E=[V.waypoints[0],V.waypoints[1],M];if(c.setVisible(!1),e.reducedMotion())return e.setSeatStepping(!1),l(M,C,R),s.requestRender(),a.cinematicSkipped(),e.isDisposed()||o.syncFromCamera(),e.setSeatViewLocked(r.arriveAtSeatEye===!0),_&&e.enterSeatView(_.stops),e.showArriveChip(S,D),Promise.resolve();let w=new Dn.Quat().copy(o.camera.quaternion),L=Ca(o.camera,M,C);s.requestRender();let I=T?700:2500;return i.start(E,w,L,I,R).then(()=>{e.isDisposed()||D!==p||(e.setSeatStepping(!1),a.cinematicPlayed(I),o.resumeAfterFlight(C),e.setSeatViewLocked(r.arriveAtSeatEye===!0),_&&e.enterSeatView(_.stops),s.requestRender(),e.showArriveChip(S,D))})},v=S=>{let P=n.sections.find(B=>B.id===S);if(!P||P.seatCount===0)return!1;e.setNearFieldDetailEnabled(!0),e.setSeatStepping(!1),e.setSeatViewLocked(!1),i.cancel(),e.removeArriveChip(),n.floors.length>1&&m!==P.floorIndex&&h(P.floorIndex),e.setNavigationMode("pan"),e.showSectionSeatLabels(S);let T=P.focalWorld[0]-P.center[0],D=P.focalWorld[2]-P.center[2],z=Math.hypot(T,D)>P.radius*.12?Math.atan2(T,D):void 0;return o.frame({center:P.center,radius:Math.max(5,P.radius*.5)},!1,z),r.onSectionFocusChange?.(S),s.requestRender(),!0},A=S=>{if(e.isDisposed()||!e.gpu())return!1;let P=n.seats.idToIndex.get(S);if(P===void 0)return!1;let T=P*3,D=[n.seats.iPosition[T],n.seats.iPosition[T+1]+.55,n.seats.iPosition[T+2]];return e.reducedMotion()?o.frame({center:D,radius:ms},!1,void 0,!1,fs):o.frameSoft({center:D,radius:ms},void 0,!1,fs),s.requestRender(),!0};return f.addEventListener("click",y),{overviewChip:f,layoutOverviewChip:b,flightGen:()=>p,focusedFloor:()=>m,applyFloorFocus:h,placeCameraFinal:l,cancelFlight:g,focusOverview:y,flyToSeat:x,focusSectionCamera:v,focusSeatCamera:A}}var ms=4.5,fs={polarDeg:48,margin:1.25};var nm={};function hs(e){let t=performance.now();return{model:gt(e),buildMs:performance.now()-t,source:"main"}}function tm(e){let t=Yr(e.doc);return{...hs({...e,seats:t}),seats:t}}function bs(e,t,n){if(typeof Worker>"u")return Promise.resolve(t());let r;try{r=new Worker(new URL("./scene/scene.worker.js",nm.url),{type:"module"})}catch{return Promise.resolve(t())}return new Promise(o=>{let i=!1,a=u=>{i||(i=!0,clearTimeout(c),r.terminate(),o(u))},s=()=>a(t()),c=window.setTimeout(s,15e3);r.onerror=s,r.onmessage=u=>{let d=n(u.data);d?a(d):s()},r.postMessage(e)})}function ys(e){return bs(e,()=>hs(e),({model:t,buildMs:n})=>({model:t,buildMs:n,source:"worker"}))}function gs(e){return bs(e,()=>tm(e),({model:t,buildMs:n,seats:r})=>r?{model:t,buildMs:n,seats:r,source:"worker"}:null)}var om=Math.PI/180,rm=6,im=500;function am(e,t,n={}){let r=performance.now(),o=t.prepared?.model??gt(t),i=new kn(n.onAnalytics),a=new Array(o.seats.count);for(let[H,Y]of o.seats.idToIndex)a[Y]=H;let s=new Map(t.seats.map(H=>[H.id,H])),c=new Map;for(let H of t.seats){if(!H.rowId)continue;let Y=c.get(H.rowId);Y?Y.push(H.id):c.set(H.rowId,[H.id])}let u=new Map;for(let H of t.seats)u.set(H.id,H.sectionId);let d=new Map;for(let[H,Y]of o.seats.idToIndex){let q=u.get(H);if(!q)continue;let ee=d.get(q);ee?ee.push(Y):d.set(q,[Y])}let p=()=>{if(!l||!o.sectionSolidRanges.length)return;let{lit:H,anyUnlit:Y}=da(o.sectionSolidRanges,d,o.seats.iState);l.setSectionShellLit(Y?H:null)},m=t.doc.floors?.some(Y=>(Y.baseHeightM??0)>0)?!0:(t.doc.floors?.flatMap(Y=>Y.objects)??t.doc.objects).some(Y=>Y.type==="section"&&((Y.height??0)>0||(Y.rake??0)>0)),l=null,f=null,b=!1,h=!1,y=!1,g=new Map,x=null,v=null,A=null,S=new Map,P=null,T=()=>{A===null&&(A=e.style.zIndex,e.style.zIndex="20")},D=()=>{A!==null&&(e.style.zIndex==="20"&&(e.style.zIndex=A),A=null)},z=!1,B=()=>z?fe.focusedFloor():-1,_=()=>{l=pa(M.gl,o),p(),f=new Sn(M.renderer,l.seatGeometry,l.chairGeometry,l.solidGeometry,o.seats.count),M.setClearColor(o.theme.background.top),f.setRestoreClear(o.theme.background.top),l.seatProgram.uniforms.uSeatRadius.value=De*o.theme.seatScale,l.seatProgram.uniforms.uFocusFloor.value=B(),l.solidProgram.uniforms.uFocusFloor.value=B(),l.chairProgram.uniforms.uFocusFloor.value=B(),l.screenProgram&&(l.screenProgram.uniforms.uFocusFloor.value=B()),k.forceRegather()},C=!1,k=new Fn({model:o,orbit:()=>R,gpu:()=>l}),V=H=>k.setDetailEnabled(H),M=new Kt(e,{onContextLost:()=>{y||i.contextLost(),b=!0,W.stop(),l=null,f=null},onContextRestored:()=>{_(),b=!1,y||i.contextRestored(),W.requestRender()}}),R=new qt(M.gl,M.canvas,()=>W.requestRender(),()=>i.orbitEngaged());R.setAspect(M.aspect);let E=(t.doc.floors?.flatMap(H=>H.objects)??t.doc.objects).some(H=>H.type==="section"&&H.physical3dProvenance?.surfaceKind?.status==="inferred"),w=(()=>{if(E&&o.stages.length===0)return;let H=o.focalWorld[0]-o.bounds.center[0],Y=o.focalWorld[2]-o.bounds.center[2];return Math.hypot(H,Y)>o.bounds.radius*.12?Math.atan2(H,Y):void 0})(),L=o.floors.length>1?{polarDeg:48,margin:1.1}:{margin:1.1},I=typeof window<"u"&&!!window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches;R.frame(o.bounds,!I&&n.skipInitialOverviewAnimation!==!0,w,n.portraitOverviewCrop===!0,L);let O=new Mn(R.camera),j=ss(e),U=new gn(e,{fontFamily:t.doc.theme?.fontFamily,ink:t.doc.theme?.textColor,backgroundRgb:o.theme.background.top}),N=o.labels,F=()=>_i(N,o.floors.length,B());U.setLabels(F());let K=null,X=H=>{if(K=H,U.setForcedDense(!!H),!H){U.setLabels(F());return}let Y=t.seats.filter(J=>J.sectionId===H),q=new Set(Y.map(J=>J.id)),ee=new Set(Y.map(J=>J.rowId)),re=new Set(g.keys()),ie=new Set(Y.filter(J=>re.has(J.id)).map(J=>J.id)),se=F().filter(J=>J.kind!=="row"&&J.kind!=="seat"||(J.kind==="row"?ee.has(J.id.slice(4)):q.has(J.id.slice(5))&&(ie.size===0||ie.has(J.id.slice(5)))));if(o.seatCount<=6e3&&ie.size===0){U.setLabels(se);return}let de=ie.size?Y.filter(J=>ie.has(J.id)):Y,$e=new Set(de.map(J=>`seat:${J.id}`)),He=de.flatMap(J=>{let ye=o.seats.idToIndex.get(J.id);if(ye===void 0)return[];let Re=ye*3;return[{id:`seat:${J.id}`,kind:"seat",text:re.has(J.id)?J.displayLabel||J.label:vo(J.displayLabel||J.label),anchor:[o.seats.iPosition[Re],o.seats.iPosition[Re+1]+(re.has(J.id)?1.05:.55),o.seats.iPosition[Re+2]]}]});U.setLabels([...se.filter(J=>!$e.has(J.id)),...He])};_();let Q=null,W=new Qt(H=>{if(b||!l||h)return!1;let Y=Xa({flying:O.active,panoramaMounted:x!==null,seatViewActive:Q?.active===!0}),q=Y==="cinematic"?O.update(performance.now()):Y==="seatView"?Q.update(performance.now()):Y==="orbit"?R.update():!1,ee=B()>=0?o.floors[B()]:null,re=ee?.radius??o.bounds.radius,ie=Jo(R.currentDistance,re),se=C?{center:[R.camera.position.x,R.camera.position.y,R.camera.position.z],radius:520}:o.renderBounds;R.updateClipping(se);let de=ee?.center??o.renderBounds.center,$e=ee?.radius??o.renderBounds.radius,He=(Ie,Pt)=>Math.hypot(R.camera.position.x-Ie[0],R.camera.position.y-Ie[1],R.camera.position.z-Ie[2])<=Pt*(k.detailVisible?1.8:1.55),J=He(de,$e);if(!J&&K){let Ie=o.sections.find(Pt=>Pt.id===K);Ie&&(J=He(Ie.center,Math.max(12,Ie.radius*2)))}k.detailVisible=J;let ye=l.seatProgram.uniforms;ye.uSeatScale.value=ie.scale,ye.uSeatFade.value=ie.fade;let Re=!!ee&&er(ee.seatCount,M.canvas.clientWidth||1,M.canvas.clientHeight||1),jt=tr(o.seats.count,re,R.currentDistance,R.camera.fov,M.canvas.clientHeight||1),wt=k.detailVisible||Re||jt?1:0,Yt=k.detailVisible||B()>=0||o.floors.length>1?1:0;return k.ease(H,wt,Yt),ye.uSeatDetail.value=k.seatDetailMix,l.solidProgram.uniforms.uStructureDetail.value=k.structureDetailMix,ye.uMinPixels.value=ie.minPixels,ye.uPixelToWorld.value=2*Math.tan(R.camera.fov*om/2)/Math.max(1,M.pixelHeight),k.update(k.detailVisible),M.renderer.render({scene:l.background,clear:!0}),M.renderer.render({scene:l.main,camera:R.camera,clear:!1}),U.update(R.camera.projectionViewMatrix,M.canvas.clientWidth||1,M.canvas.clientHeight||1,R.currentDistance,re,[R.camera.position.x,R.camera.position.y,R.camera.position.z]),q||k.seatDetailMix!==wt||k.structureDetailMix!==Yt}),$=typeof ResizeObserver<"u"?new ResizeObserver(()=>Vn.resize()):null;$?.observe(e);let Z=H=>{let Y=re=>{let ie=o.seats.idToIndex.get(re);return ie===void 0?void 0:o.seats.iState[ie]},{updates:q,next:ee}=ga(g,H,Y);if(g=ee,U.setSelectedSeatIds(g.keys()),K&&X(K),q.length){let re=Zn(o.seats,q);l&&l.uploadSeatStateRuns(re),p(),W.requestRender()}},te=()=>P!==null?P:typeof window<"u"&&!!window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,Le=8,Pe=H=>{if(!n.getSeatView)return null;let Y=S.get(H);if(!Y)for(Y=Promise.resolve(n.getSeatView(H)),S.set(H,Y),Y.catch(()=>{S.get(H)===Y&&S.delete(H)});S.size>Le;){let q=S.keys().next().value;if(q===void 0)break;S.delete(q)}return Y},Be=Oa(o.stages,o.focalWorld,o.bounds.groundY??0),Ne=_o(Be),Ae=(H,Y)=>{let q=s.get(H),ee=Math.max(0,Math.round(o.seats.iFloor[Y]??0)),re=t.doc.floors?.[ee],ie=o.floors[ee],se=re?.focalPoint??t.doc.focalPoint,de=ie?{x:ie.focalWorld[0]/G,y:ie.focalWorld[2]/G}:se,$e=q?.focalPoint?{x:q.focalPoint.x+de.x-se.x,y:q.focalPoint.y+de.y-se.y}:de,He=[o.seats.iPosition[Y*3],o.seats.iPosition[Y*3+1],o.seats.iPosition[Y*3+2]];return Ra(He,$e,re?.baseHeightM??0,q?.eyeHeightM,Ne)},Ce=()=>(e.clientWidth||M.canvas.clientWidth)<=520,me=null,qe=null,vt=async(H,Y,q)=>{if(!n.getSeatView||y||q!==fe.flightGen())return;let ee;try{ee=await is()}catch{if(i.panoramaFailed(H,"mount"),!y&&q===fe.flightGen()){let re=Fe(H,q,!0);requestAnimationFrame(()=>re?.querySelector("[data-panorama-trigger]")?.focus())}return}if(!(y||q!==fe.flightGen()||!me))return qe??=ee.createOpenPanorama(me),qe(H,Y,q)},Ge=cs({container:e,model:o,opts:n,expandedSeatById:s,seatIdsByRow:c,isNarrow:Ce,isDisposed:()=>y,flightGen:()=>fe.flightGen(),flyToSeat:H=>Bo(H),openPanorama:(H,Y,q)=>vt(H,Y,q)}),Fe=Ge.show,Qe=Ge.remove,Ht=Ge.layout,ct=ls({container:e,orbit:R,isNarrow:Ce,enabled:n.chrome?.controlDock!==!1}),xs=ct.element,St=ct.setNavigationMode,vs=ct.layout,Ss=ct.utilityControls,Mt=null,Oo=!1,Ut=H=>{ct.setSeatViewLocked(H),H||Q?.exit()};Q=Ya({canvas:M.canvas,camera:R.camera,requestRender:()=>W.requestRender(),reducedMotion:te,onStopChange:H=>{let Y=H??(Oo?"seat":null);Mt=Y;try{n.onSeatViewStopChange?.(Y)}catch{}},onApplied:()=>{y||R.syncFromCamera()}});let Ms=(H,Y)=>{let{eye:q}=Ae(H,Y),ee=(e.clientWidth||M.canvas.clientWidth||1)/Math.max(1,e.clientHeight||M.canvas.clientHeight||1),re=Ba(q,Be,ee);if(n.seatViewStops===!1)return{...re,stops:[]};let ie=u.get(H),se=ie?o.sections.find(de=>de.id===ie):void 0;return{...re,stops:Na(re,{aspect:ee,section:se&&se.seatCount>0?{center:se.center,radius:se.radius}:null,venue:{center:o.bounds.center,radius:o.bounds.radius}})}},fe=ps({container:e,model:o,opts:n,orbit:R,cinematic:O,analytics:i,loop:W,labelOverlay:U,stageAzimuth:w,overviewFraming:L,gpu:()=>l,isDisposed:()=>y,panorama:()=>x,setPanorama:H=>{x=H},setPanoramaSphereVisible:H=>{C=H},panoramaLoadAbort:()=>v,setPanoramaLoadAbort:H=>{v=H},setFrozen:H=>{h=H},restorePanoramaLayer:D,reducedMotion:te,resolvedSeatViewPose:Ae,showSectionSeatLabels:X,setNearFieldDetailEnabled:V,setSeatViewLocked:Ut,setNavigationMode:St,showArriveChip:Fe,removeArriveChip:Qe,inSeatView:()=>Mt!==null,setSeatStepping:H=>{Oo=H},seatViewArrival:(H,Y)=>n.arriveAtSeatEye?Ms(H,Y):null,enterSeatView:H=>Q?.enter(H)});z=!0;let On=fe.overviewChip,ws=fe.layoutOverviewChip,Ps=fe.applyFloorFocus,Cs=fe.focusOverview,Vo=fe.cancelFlight,Bo=fe.flyToSeat,No=fe.focusSectionCamera;Ss.appendChild(On),me={container:e,model:o,opts:n,analytics:i,orbit:R,loop:W,seatsById:s,ensureSeatView:Pe,resolvedSeatViewPose:Ae,gpu:()=>l,gl:M.gl,isContextLost:()=>b,isDisposed:()=>y,flightGen:()=>fe.flightGen(),setPanorama:H=>{x=H},getLoadAbort:()=>v,setLoadAbort:H=>{v=H},setPanoramaSphereVisible:H=>{C=H,H&&Q?.exit()},setFrozen:H=>{h=H},raisePanoramaLayer:T,restorePanoramaLayer:D,getOverviewChip:()=>On,labelOverlay:U,reducedMotion:te,removeArriveChip:Qe,showArriveChip:Fe};let ze=us({glctx:M,orbit:R,model:o,seats:t.seats,opts:n,cinematic:O,analytics:i,seatIdByIndex:a,sectionIdBySeatId:u,tapSlop:rm,tapMs:im,gpu:()=>l,pick:()=>f,seatViewLocked:()=>ct.seatViewLocked(),focusedSectionId:()=>K,selection:()=>g,cancelFlight:Vo,focusSectionCamera:No,focusSeatCamera:fe.focusSeatCamera,setSelection:Z,ensureSeatView:Pe});M.canvas.addEventListener("pointerdown",ze.onDown),M.canvas.addEventListener("pointermove",ze.onMove),M.canvas.addEventListener("pointerup",ze.onUp),M.canvas.addEventListener("pointercancel",ze.onUp),W.requestRender();let Vn={setAvailability(H){let Y=ya(g,H),q=Zn(o.seats,Y);q.length&&l&&l.uploadSeatStateRuns(q),p(),W.requestRender()},setSelection:Z,setNavigationMode:St,zoomIn(){R.zoomBy(.82),W.requestRender()},zoomOut(){R.zoomBy(1.22),W.requestRender()},flyToSeat:Bo,focusOverview:Cs,seatViewStop:()=>Mt,recentreSeatView:()=>Q?.recentre()??!1,resize(){let{width:H,height:Y}=M.resize();R.setAspect(H/Math.max(1,Y)),Ht(),vs(),ws(),W.requestRender()},stats(){return{...W.stats(),drawCalls:l?l.drawCalls:0,seatCount:o.seatCount}},getQualityEvidence(){let H=W.stats(),Y=M.canvas.clientWidth||1,q=M.canvas.clientHeight||1,ee=o.bounds.center,re=Ye(R.camera.projectionViewMatrix,[ee[0],o.bounds.box.min[1],ee[2]],Y,q),ie=Ye(R.camera.projectionViewMatrix,[ee[0],o.bounds.box.max[1],ee[2]],Y,q),se=o.bounds.box,de=[se.min[0],se.max[0]].flatMap(J=>[se.min[1],se.max[1]].flatMap(ye=>[se.min[2],se.max[2]].map(Re=>Ye(R.camera.projectionViewMatrix,[J,ye,Re],Y,q)))).filter(J=>Number.isFinite(J.x)&&Number.isFinite(J.y)&&Number.isFinite(J.depth)),$e=de.length?(()=>{let J=Math.min(...de.map(Ze=>Ze.x)),ye=Math.max(...de.map(Ze=>Ze.x)),Re=Math.min(...de.map(Ze=>Ze.y)),jt=Math.max(...de.map(Ze=>Ze.y)),wt=Math.max(0,J),Yt=Math.min(Y,ye),Ie=Math.max(0,Re),Pt=Math.min(q,jt),Xt=Math.max(0,Yt-wt),Bn=Math.max(0,Pt-Ie);return{box:{x:wt,y:Ie,width:Xt,height:Bn},horizontalFillRatio:Xt/Y,verticalFillRatio:Bn/q,visibleAreaRatio:Xt*Bn/(Y*q),clippedEdges:[...Re<0?["top"]:[],...ye>Y?["right"]:[],...jt>q?["bottom"]:[],...J<0?["left"]:[]]}})():void 0,He=String(M.gl.getParameter(M.gl.VERSION)??"");return{viewport:{width:Y,height:q},context:{webgl2:/webgl\s*2/i.test(He),lost:b},frame:{rendered:H.rendered,idle:H.idle},camera:{position:[R.camera.position.x,R.camera.position.y,R.camera.position.z],distance:R.currentDistance,verticalFovDeg:R.fovY},scene:{seatCount:o.seatCount,floorCount:o.floors.length,zoneCount:o.zones.length,sectionCount:o.sections.length,authoredRelief:m,renderedVerticalSpanM:Math.max(0,o.bounds.box.max[1]-o.bounds.box.min[1]),projectedReliefPx:re.visible&&ie.visible?Math.abs(re.y-ie.y):0},labels:U.qualityEvidence(),framing:$e,...Mt?{seatView:{fovDeg:R.camera.fov,stop:Mt}}:{}}},getQualityReport(){return xn(Vn.getQualityEvidence())},loseContextForTest(){M.simulateContextLossCycle()},floors(){return o.floors},focusFloor(H){if(H!==null&&!o.floors.some(q=>q.index===H))return!1;let Y=H??-1;if(V(H!==null),Ut(!1),Ps(Y),St("orbit"),H===null)O.cancel(),te()?R.frame(o.bounds,!1,w,n.portraitOverviewCrop===!0,L):R.frameSoft(o.bounds,w,n.portraitOverviewCrop===!0,L);else{let q=o.floors[H];if(q.seatCount>0){O.cancel();let ee=q.focalWorld[0]-q.center[0],re=q.focalWorld[2]-q.center[2],ie=Math.hypot(ee,re)>q.radius*.12?Math.atan2(ee,re):w;R.frame({center:q.center,radius:q.radius,box:q.box},!1,ie,!1,{polarDeg:58,margin:1.12})}}return W.requestRender(),!0},zones(){return o.zones},focusZone(H){let Y=o.zones.find(ie=>ie.id===H);if(!Y||Y.seatCount===0)return!1;V(!1),Ut(!1),O.cancel(),St("orbit"),X(null),n.onSectionFocusChange?.(null);let q=Y.focalWorld[0]-Y.center[0],ee=Y.focalWorld[2]-Y.center[2],re=Math.hypot(q,ee)>Y.radius*.12?Math.atan2(q,ee):void 0;return R.frame({center:Y.center,radius:Y.radius*1.25},!1,re),W.requestRender(),!0},sections(){return o.sections},focusSection(H){return No(H)},rows(H){return H?o.rows.filter(Y=>Y.sectionId===H):o.rows},seatsInRow(H){return t.seats.filter(Y=>Y.rowId===H).map(Y=>({id:Y.id,label:Y.displayLabel||Y.label}))},focusRow(H){let Y=o.rows.find(q=>q.id===H);return!Y||Y.seatCount===0?!1:(V(!0),Ut(!1),O.cancel(),St("pan"),Y.sectionId&&(X(Y.sectionId),n.onSectionFocusChange?.(Y.sectionId)),R.frame({center:Y.center,radius:Math.max(2.5,Y.radius*.65)}),W.requestRender(),!0)},setReducedMotionForTest(H){P=H},dispose(){y=!0,Qe(),On.remove(),xs.remove(),Vo(),Q?.dispose(),W.stop(),U.dispose(),$?.disconnect(),x&&(x.dispose(),x=null),D(),j(),M.canvas.removeEventListener("pointerdown",ze.onDown),M.canvas.removeEventListener("pointermove",ze.onMove),M.canvas.removeEventListener("pointerup",ze.onUp),M.canvas.removeEventListener("pointercancel",ze.onUp),R.dispose(),f&&f.dispose(),l&&l.dispose(),l=null,f=null,M.dispose()}};return i.opened(o.seatCount,m,t.prepared?.buildMs??performance.now()-r,t.prepared?.source??"inline"),Vn}0&&(module.exports={VENUE3D_QUALITY_REPORT_VERSION,buildSceneModel,inspectVenue3DQualityEvidence,mountVenue3D,prepareVenue3D,prepareVenue3DFromChart});
|
|
641
|
+
void main(){ if(vDim>0.5) discard; vec4 c=texture(uImage,vUv); if(c.a<0.01) discard; fragColor=c; }`,uniforms:{uImage:{value:j},uFocusFloor:{value:-1}},transparent:!1,depthTest:!0,depthWrite:!0,cullFace:!1});let q=new ce.Mesh(e,{geometry:R,program:O});q.frustumCulled=!1,q.setParent(n),F.screenProgram=O,w=!0,F.drawCalls=3+(T?1:0)+1},X.src=W.contentImageUrl}return F}var _e=require("ogl");function gm(e,t,n){let r=e+(t<<8)+(n<<16);return r===0?-1:r-1}function ga(e,t,n,r,o,i){let a=-1,s=1/0;for(let c=0;c<n;c++)for(let m=0;m<t;m++){let u=(c*t+m)*4,p=gm(e[u],e[u+1],e[u+2]);if(p<0||p>=i)continue;let d=m-r,l=c-o,f=d*d+l*l;f<s&&(s=f,a=p)}return a}function xa(e,t,n,r,o,i){let a=e-n.left,s=t-n.top,c=Math.round(a*r),m=Math.round((n.height-s)*r);return{x:Math.max(0,Math.min(o-1,c)),y:Math.max(0,Math.min(i-1,m))}}var xm=["uSeatRadius","uSeatScale","uMinPixels","uPixelToWorld"],wn=class{constructor(t,n,r,o,i){this.seatScene=new _e.Transform;this.chairScene=new _e.Transform;this.solidScene=new _e.Transform;this.target=null;this.restoreClear=[0,0,0];this.renderer=t,this.gl=t.gl,this.maxIndex=i,this.seatProg=sa(this.gl),this.chairProg=ca(this.gl),this.depthProg=la(this.gl);let a=new _e.Mesh(this.gl,{geometry:n,program:this.seatProg});a.frustumCulled=!1,a.setParent(this.seatScene);let s=new _e.Mesh(this.gl,{geometry:r,program:this.chairProg});s.frustumCulled=!1,s.setParent(this.chairScene);let c=new _e.Mesh(this.gl,{geometry:o,program:this.depthProg});c.frustumCulled=!1,c.setParent(this.solidScene)}setRestoreClear(t){this.restoreClear=[t[0],t[1],t[2]]}syncFromSeatProgram(t){for(let r of xm)this.seatProg.uniforms[r].value=t.uniforms[r].value;let n=t.uniforms.uFocusFloor.value;this.seatProg.uniforms.uFocusFloor.value=n,this.chairProg.uniforms.uFocusFloor.value=n,this.depthProg.uniforms.uFocusFloor.value=n}ensureTarget(){let t=this.gl.drawingBufferWidth,n=this.gl.drawingBufferHeight;return this.target&&(this.target.width!==t||this.target.height!==n)&&this.destroyTarget(),this.target||(this.target=new _e.RenderTarget(this.gl,{width:t,height:n,depth:!0})),this.target}destroyTarget(){if(!this.target)return;let t=this.gl;this.target.buffer&&t.deleteFramebuffer(this.target.buffer);for(let n of this.target.textures??[])n.texture&&t.deleteTexture(n.texture);this.target.depthBuffer&&t.deleteRenderbuffer(this.target.depthBuffer),this.target=null}pick(t,n,r,o){let i=this.gl,a=this.ensureTarget(),s=i.drawingBufferWidth,c=i.drawingBufferHeight,m=Math.max(0,n-o),u=Math.max(0,r-o),p=Math.max(1,Math.min(s,n+o+1)-m),d=Math.max(1,Math.min(c,r+o+1)-u);i.enable(i.SCISSOR_TEST),i.scissor(m,u,p,d);let[l,f,b]=this.restoreClear;i.clearColor(0,0,0,1),this.renderer.render({scene:this.solidScene,camera:t,target:a,clear:!0}),this.renderer.render({scene:this.seatScene,camera:t,target:a,clear:!1}),this.renderer.render({scene:this.chairScene,camera:t,target:a,clear:!1}),i.clearColor(l,f,b,1),i.disable(i.SCISSOR_TEST);let h=new Uint8Array(p*d*4);return this.renderer.bindFramebuffer(a),i.readPixels(m,u,p,d,i.RGBA,i.UNSIGNED_BYTE,h),this.renderer.bindFramebuffer(),ga(h,p,d,n-m,r-u,this.maxIndex)}dispose(){this.destroyTarget(),this.seatProg.remove(),this.chairProg.remove(),this.depthProg.remove()}};function va(e,t){let n=[];for(let r of t)e.has(r.seatId)?e.set(r.seatId,Rt(r.state)):n.push(r);return n}function Sa(e,t,n){let r=new Set;for(let a of t)(e.has(a)||n(a)!==void 0)&&r.add(a);let o=new Map(e),i=[];for(let[a,s]of e)r.has(a)||(i.push({seatId:a,state:pe[s]??"available"}),o.delete(a));for(let a of r){if(o.has(a))continue;let s=n(a);s!==void 0&&(o.set(a,s),i.push({seatId:a,state:"selected"}))}return{updates:i,next:o}}var We=require("ogl");function vm(e,t){return[e[0]-t[0],e[1]-t[1],e[2]-t[2]]}function Ma(e,t){return[e[0]+t[0],e[1]+t[1],e[2]+t[2]]}function Sm(e,t){return[e[0]*t,e[1]*t,e[2]*t]}function wa(e){let t=Math.hypot(e[0],e[1],e[2]);return t>1e-6?[e[0]/t,e[1]/t,e[2]/t]:[0,0,0]}function Ro(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 Pa(e,t){let n=e.length;if(n===0)return[0,0,0];if(n===1)return[...e[0]];let r=Math.max(0,Math.min(1,t)),o=n-1,i=Math.floor(r*o);i>=o&&(i=o-1);let a=r*o-i,s=e[Math.max(0,i-1)],c=e[i],m=e[i+1],u=e[Math.min(n-1,i+2)],p=a*a,d=p*a,l=[0,0,0];for(let f=0;f<3;f++)l[f]=.5*(2*c[f]+(-s[f]+m[f])*a+(2*s[f]-5*c[f]+4*m[f]-u[f])*p+(-s[f]+3*c[f]-3*m[f]+u[f])*d);return l}function _o(e,t,n,r,o){let i=wa(vm(t,n));i[0]===0&&i[1]===0&&i[2]===0&&(i=[0,0,1]);let a=Ma(Ma(t,Sm(i,2.5)),[0,1.5,0]),s=[t[0]-r[0],0,t[2]-r[2]],c=wa(s);c[0]===0&&c[2]===0&&(c=[i[0],0,i[2]]);let m=Math.max(1,o),u=[r[0]+c[0]*m*1.3,r[1]+m*.75,r[2]+c[2]*m*1.3];return{waypoints:[e,u,a],finalPos:a}}function Lo(e,t,n=35,r=28){let o=Ro(t),i=Pa(e,o),a=Ro(Math.max(0,Math.min(1,(t-.66)/.34)));return{pos:i,fov:n+(r-n)*a,eased:o}}function Ia(e,t,n){let r=e.position.clone(),o=new We.Quat().copy(e.quaternion);e.position.set(t[0],t[1],t[2]),e.lookAt(new We.Vec3(n[0],n[1],n[2]));let i=new We.Quat().copy(e.quaternion);return e.position.copy(r),e.quaternion.copy(o),i}var Pn=class{constructor(t){this.active=!1;this.waypoints=[];this.startQuat=new We.Quat;this.endQuat=new We.Quat;this.outQuat=new We.Quat;this.startTime=0;this.duration=2500;this.endFov=28;this.resolveFn=null;this.camera=t}start(t,n,r,o=2500,i=28){return this.settle(),this.waypoints=t,this.startQuat.copy(n),this.endQuat.copy(r),this.duration=o,this.endFov=i,this.startTime=performance.now(),this.active=!0,new Promise(a=>{this.resolveFn=a})}update(t){if(!this.active)return!1;let n=Math.min(1,(t-this.startTime)/this.duration),{pos:r,fov:o,eased:i}=Lo(this.waypoints,n,35,this.endFov);return this.camera.position.set(r[0],r[1],r[2]),this.outQuat.copy(this.startQuat).slerp(this.endQuat,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 Ra=Jn,Mm=.12,wm=.25,Pm=1.5;function Ta(e,t,n=0,r,o){let i=[t.x*G,n+Pm,t.y*G],a=o?[o[0],o[1],o[2]]:i,s=e[1],c=Number.isFinite(s)?s+Ra:Number.isFinite(r)?n+r:n+Ra,m=i[0]-e[0],u=i[2]-e[2],p=Math.hypot(m,u),d=p>.001?Math.min(Mm,p*wm):0,l=p>.001?m/p:0,f=p>.001?u/p:0;return{eye:[e[0]+l*d,c,e[2]+f*d],focal:a}}var st=Math.PI/180,Cm=45,_a=80,Cn=70,Am=1,Em=.99;function Im(e,t){if(!(e<Am))return _a;if(!(Number.isFinite(t)&&t>0))return Cn;let n=2*Math.atan(t/(2*An*Em)/Math.max(.05,e))/st;return Math.max(Cn,Math.min(_a,n))}var Rm=.25,An=1,Tm=.25,_m=12*st,Lm=.2,km=1.5,La=.8,ka=6,Va=1.9,Fm=2/3,Dm=.12,Om=.9,Vm=1.2,Bm=2,Ba=.05,Nm=6;function Na(e,t,n=0){if(!e.length)return{min:[t[0]-6,n,t[2]-6],max:[t[0]+6,Math.max(n+La,t[1]),t[2]+6]};let r=1/0,o=-1/0,i=1/0,a=-1/0,s=n;for(let f of e)r=Math.min(r,f.cx-f.halfX),o=Math.max(o,f.cx+f.halfX),i=Math.min(i,f.cz-f.halfZ),a=Math.max(a,f.cz+f.halfZ),s=Math.max(s,f.y);let c=o-r,m=a-i,u=Math.max(c,Math.min(m,ka))/2,p=Math.max(m,Math.min(c,ka))/2,d=(r+o)/2,l=(i+a)/2;return{min:[d-u,n,l-p],max:[d+u,Math.max(n+La,s),l+p]}}function Gm(e){return{min:[e.min[0],e.min[1],e.min[2]],max:[e.max[0],e.max[1]+Va,e.max[2]]}}function ko(e){let t=e.max[1];return[(e.min[0]+e.max[0])/2,Math.max(e.min[1]+km,t+Lm,t+Va*Fm),(e.min[2]+e.max[2])/2]}function Ga(e,t){let n=e[0]-t[0],r=e[2]-t[2],o=Math.hypot(n,r);return o<.001?{x:0,z:1}:{x:n/o,z:r/o}}function Fa(e,t,n){let r=t[0]-e[0],o=t[1]-e[1],i=t[2]-e[2],a=Math.hypot(r,o,i)||1;r/=a,o/=a,i/=a;let s=-i,c=r,m=Math.hypot(s,c);if(m<1e-6)return 1/0;s/=m,c/=m;let u=1/0,p=-1/0;for(let d=0;d<8;d++){let l=(d&1?n.max[0]:n.min[0])-e[0],f=(d&2?n.max[1]:n.min[1])-e[1],b=(d&4?n.max[2]:n.min[2])-e[2],h=Math.max(Ba,l*r+f*o+b*i),y=(l*s+b*c)/h;y<u&&(u=y),y>p&&(p=y)}return p-u}function Da(e,t,n){let r=t[0]-e[0],o=t[1]-e[1],i=t[2]-e[2],a=Math.hypot(r,o,i)||1;r/=a,o/=a,i/=a;let s=-i,c=r,m=Math.hypot(s,c);if(m<1e-6)return 1/0;s/=m,c/=m;let u=-c*o,p=c*r-s*i,d=s*o,l=1/0,f=-1/0;for(let b=0;b<8;b++){let h=(b&1?n.max[0]:n.min[0])-e[0],y=(b&2?n.max[1]:n.min[1])-e[1],x=(b&4?n.max[2]:n.min[2])-e[2],g=Math.max(Ba,h*r+y*o+x*i),v=(h*u+y*p+x*d)/g;v<l&&(l=v),v>f&&(f=v)}return f-l}function En(e,t){return Math.tan(e*st/2)*Math.max(.05,t)}function Oa(e,t,n){let r=Im(n,e),o=c=>Math.max(Cm,Math.min(r,c)),i=c=>2*Math.atan(c)/st,a=Number.isFinite(e)&&e>0?o(i(e/(2*Rm)/Math.max(.05,n))):r;if(!(Number.isFinite(t)&&t>0))return a;let s=Math.min(a,o(i(t/(2*Dm))));return e/(2*En(s,n))>An?a:s}function za(e,t,n){let r=ko(t),o=[e[0],e[1],e[2]],i=0,a=0,s=l=>{if(!(l>0))return;let f=Ga(o,r);o[0]+=f.x*l,o[2]+=f.z*l,a+=l},c=t.max[1]+Tm-o[1];c>0&&(o[1]+=c,i=c,s(c/Math.tan(_m)));let m=Gm(t),u=Fa(o,r,t),p=Oa(u,Da(o,r,m),n),d=u/(2*En(p,n));for(let l=0;l<Nm&&d>An;l++){let f=Math.max(1,Math.hypot(o[0]-r[0],o[2]-r[2])),b=Number.isFinite(d)?d/An:2;s(Math.min(60,f*(Math.min(4,b)-1)+.5)),u=Fa(o,r,t),p=Oa(u,Da(o,r,m),n),d=u/(2*En(p,n))}return{eye:o,focal:r,fov:p,raisedM:i,pulledBackM:a,stageFrameWidth:d}}function zm(e,t,n){let r=Math.tan(t*st/2),o=En(t,n);return Math.max(1,e/Math.max(.05,Math.min(r,o)))}function Ua(e,t){let{aspect:n,venue:r}=t,o=e.focal,i=Ga(e.eye,o),a=d=>(d[0]-o[0])*i.x+(d[2]-o[2])*i.z,s=[{name:"seat",eye:e.eye,focal:o,fov:e.fov}],c=Bm*(t.rowDepthM??Om);s.push({name:"row",eye:[e.eye[0]+i.x*c,e.eye[1]+Vm,e.eye[2]+i.z*c],focal:o,fov:e.fov});let m=(d,l,f,b)=>{let h=zm(f,e.fov,n)*1.08,y=h*Math.sin(b*st),x=h*Math.cos(b*st);return{name:d,eye:[l[0]+i.x*x,l[1]+y,l[2]+i.z*x],focal:l,fov:e.fov}};t.section&&t.section.radius>0&&s.push(m("section",t.section.center,t.section.radius,14)),s.push(m("venue",r.center,Math.max(1,r.radius),26));let u=[],p=-1/0;for(let d of s){let l=a(d.eye);u.length&&l<=p+.5||(u.push(d),p=l)}return u}var Wa=require("ogl"),Ht=Math.PI/180,Ha=320,ja=70*Ht,Um=32*Ht,Hm=24*Ht,Ya=.0026,jm=.22,Ym=.006,Xm=180,Wm=4,Se=(e,t,n)=>Math.max(t,Math.min(n,e)),Xa=e=>e<.5?4*e*e*e:1-Math.pow(-2*e+2,3)/2;function Ka(e){let{canvas:t,camera:n}=e,r=[],o=!1,i=0,a=0,s=0,c=0,m=0,u=0,p=!1,d=[0,0],l=0,f=!1,b=null,h=null,y=new Map,x=!1,g=0,v=0,A=0,P=0,M=()=>o&&r.length?r[Se(Math.round(i),0,r.length-1)].name:null,E=()=>{let w=M();w!==b&&(b=w,e.onStopChange?.(w))},D=()=>{if(!o||!r.length)return;let w=r[Se(Math.floor(i),0,r.length-1)],k=r[Se(Math.ceil(i),0,r.length-1)],R=Se(i-Math.floor(i),0,1),O=(Me,Ae)=>Me+(Ae-Me)*R,j=[O(w.eye[0],k.eye[0]),O(w.eye[1],k.eye[1]),O(w.eye[2],k.eye[2])],H=[O(w.focal[0],k.focal[0]),O(w.focal[1],k.focal[1]),O(w.focal[2],k.focal[2])],N=H[0]-j[0],F=H[1]-j[1],W=H[2]-j[2],X=Math.hypot(N,F,W)||1,Q=Math.atan2(N,W),q=Math.asin(Se(F/X,-1,1)),K=Q+a,Z=Se(q+s,-80*Ht,80*Ht),te=Math.cos(Z)*X;N=Math.sin(K)*te,F=Math.sin(Z)*X,W=Math.cos(K)*te,n.position.set(j[0],j[1],j[2]),n.fov=O(w.fov,k.fov),n.updateProjectionMatrix(),n.lookAt(new Wa.Vec3(j[0]+N,j[1]+F,j[2]+W)),e.onApplied?.()},z=()=>{if(!o||!r.length)return;let w=Se(Math.round(i),0,r.length-1);if(e.reducedMotion()){p=!1,i=w,D(),E(),e.requestRender();return}if(Math.abs(w-i)<.001){p=!1,E();return}c=i,m=w,u=performance.now(),p=!0,e.requestRender()},V=w=>{!o||r.length<2||(p=!1,i=Se(i+w,0,r.length-1),D(),E(),e.requestRender())},L=(w,k)=>{o&&(p=!1,f=!1,a=Se(a-w*Ya,-ja,ja),s=Se(s-k*Ya,-Hm,Um),D(),e.requestRender())},C=w=>{o&&(y.set(w.pointerId,{x:w.clientX,y:w.clientY}),y.size===1?(x=!0,P=0,g=w.clientX,v=w.clientY):y.size===2&&(x=!1,A=_()))},_=()=>{let w=[...y.values()];return w.length<2?0:Math.hypot(w[0].x-w[1].x,w[0].y-w[1].y)},B=w=>{if(!o||!y.has(w.pointerId))return;if(y.set(w.pointerId,{x:w.clientX,y:w.clientY}),y.size>=2){let O=_();A>0&&V((A-O)*Ym),A=O;return}if(!x)return;let k=w.clientX-g,R=w.clientY-v;g=w.clientX,v=w.clientY,P+=Math.abs(k)+Math.abs(R),!(P<=Wm)&&L(k,R)},S=w=>{y.delete(w.pointerId)&&(y.size<2&&(A=0),y.size===0&&(x=!1,z()))},I=w=>{if(!o)return;w.preventDefault();let k=w.deltaMode===1?16:w.deltaMode===2?100:1,R=Se(w.deltaY*k/100,-2,2);V(R*jm),h&&clearTimeout(h),h=setTimeout(()=>{h=null,z()},Xm)},T=()=>{o&&(o=!1,p=!1,f=!1,r=[],y.clear(),x=!1,h&&(clearTimeout(h),h=null),b!==null&&(b=null,e.onStopChange?.(null)))};return t.addEventListener("pointerdown",C),t.addEventListener("pointermove",B),t.addEventListener("pointerup",S),t.addEventListener("pointercancel",S),t.addEventListener("wheel",I,{passive:!1}),{get active(){return o},enter(w){if(w.length<2){T();return}r=w,o=!0,i=0,a=0,s=0,p=!1,f=!1,b=null,D(),E(),e.requestRender()},exit:T,recentre(){return o?Math.abs(a)<1e-4&&Math.abs(s)<1e-4?!0:e.reducedMotion()?(f=!1,a=0,s=0,D(),e.requestRender(),!0):(d=[a,s],l=performance.now(),f=!0,e.requestRender(),!0):!1},update(w){if(!o)return!1;let k=!1;if(f){let R=Se((w-l)/Ha,0,1),O=1-Xa(R);a=d[0]*O,s=d[1]*O,R>=1?(f=!1,a=0,s=0):k=!0}if(p){let R=Se((w-u)/Ha,0,1);i=c+(m-c)*Xa(R),R>=1?(p=!1,i=m,E()):k=!0}return D(),k},currentStop:M,dispose(){T(),t.removeEventListener("pointerdown",C),t.removeEventListener("pointermove",B),t.removeEventListener("pointerup",S),t.removeEventListener("pointercancel",S),t.removeEventListener("wheel",I)}}}function qa(e){return e.flying?"cinematic":e.panoramaMounted?"panorama":e.seatViewActive?"seatView":"orbit"}var Vo=null;function cs(){return Vo??=Promise.resolve().then(()=>(ss(),as)).catch(e=>{throw Vo=null,e}),Vo}var ls=()=>typeof performance<"u"&&performance.now?performance.now():Date.now(),Fn=class{constructor(t){this.orbitLatched=!1;this.panoramaOpenedAt=0;this.cb=t}emit(t,n){if(this.cb)try{this.cb(t,n)}catch{}}opened(t,n,r,o){this.emit("3d_opened",{seats:t,hasHeights:n,...r===void 0?{}:{buildMs:Math.round(r)},...o===void 0?{}:{prepSource:o}})}orbitEngaged(){this.orbitLatched||(this.orbitLatched=!0,this.emit("3d_orbit_engaged"))}seatPicked(t,n){this.emit("3d_seat_picked",{seatId:t,sectionId:n})}cinematicPlayed(t){this.emit("3d_cinematic_played",{durationMs:t,reducedMotion:!1})}cinematicSkipped(){this.emit("3d_cinematic_skipped",{reducedMotion:!0})}cinematicCancelled(){this.emit("3d_cinematic_cancelled")}panoramaOpened(){this.panoramaOpenedAt=ls(),this.emit("3d_panorama_opened")}panoramaClosed(){let t=this.panoramaOpenedAt?Math.round(ls()-this.panoramaOpenedAt):0;this.panoramaOpenedAt=0,this.emit("3d_panorama_closed",{viewMs:t})}panoramaFailed(t,n){this.emit("3d_panorama_failed",{seatId:t,phase:n})}panoramaFallback(t){this.emit("3d_panorama_fallback",{seatId:t})}contextLost(){this.emit("3d_context_lost")}contextRestored(){this.emit("3d_context_restored")}};function us(e){let t=e.style.position;return getComputedStyle(e).position!=="static"?()=>{}:(e.style.position="relative",()=>{e.style.position==="relative"&&(e.style.position=t)})}function ms(e){let{container:t,model:n,opts:r,expandedSeatById:o,seatIdsByRow:i,isNarrow:a}=e,s=null,c=()=>{if(!s)return;let p=a();Object.assign(s.style,p?{left:"12px",right:"12px",bottom:"70px",transform:"none",justifyContent:"center"}:{left:"50%",right:"auto",bottom:"18px",transform:"translateX(-50%)",justifyContent:"initial"})},m=()=>{s?.remove(),s=null};return{show:(p,d,l=!1)=>{if(m(),e.isDisposed())return null;let f=document.createElement("div");f.setAttribute("role","group"),Object.assign(f.style,{position:"absolute",display:"flex",flexDirection:"column",alignItems:"center",gap:"6px",zIndex:"4"});let b=r.chrome?.caption!==!1,h=r.chrome?.seatStepper!==!1;if(!b&&!h)return null;let y=o.get(p),x=y?.sectionId?n.sections.find(z=>z.id===y.sectionId):void 0,g=y?.label??p;f.setAttribute("aria-label",`Explore views near ${x?.label?`${x.label}, `:""}seat ${g}`);let v=document.createElement("span");v.textContent=r.seatViewCaption?.(p)??["Live 3D seat view",x?.label,g].filter(Boolean).join(" \xB7 "),Object.assign(v.style,{maxWidth:"min(70vw, 560px)",padding:"5px 10px",borderRadius:"999px",overflow:"hidden",color:"#d9e3f5",background:"rgba(12,18,32,0.72)",font:"600 11px/1.2 inherit",textOverflow:"ellipsis",whiteSpace:"nowrap",backdropFilter:"blur(6px)"}),b&&f.appendChild(v);let A=document.createElement("div");Object.assign(A.style,{display:"flex",alignItems:"center",justifyContent:"center",gap:"6px"}),f.appendChild(A);let P=y?.rowId?i.get(y.rowId):void 0,M=P?.indexOf(p)??-1,E=M>=0?[P?.[M-1],P?.[M+1]]:[void 0,void 0],D=(z,V,L,C=!1)=>{let _=document.createElement("button");_.type="button",_.textContent=z,_.setAttribute("aria-label",V),Object.assign(_.style,{minHeight:"44px",padding:C?"10px 16px":"10px",borderRadius:"999px",background:"rgba(12,18,32,0.78)",color:"#eef1f8",border:"1px solid rgba(150,165,205,0.4)",backdropFilter:"blur(6px)",font:"600 13px/1 inherit",cursor:"pointer",whiteSpace:"nowrap"}),C||(_.style.minWidth="44px"),C&&(_.dataset.panoramaTrigger=""),_.addEventListener("click",L),A.appendChild(_)};if(h&&E[0]){let z=o.get(E[0])?.label??E[0];D("\u2039",`View previous seat ${z}`,()=>{e.flyToSeat(E[0])})}if(h&&r.getSeatView){let z=r.seatViewActionLabel?.(p)??"Open 360\xB0 panorama";D(l?`\u21BB Retry ${z}`:`\u25C9 ${z}`,`${l?"Retry":z} from seat ${g}`,()=>{if(e.isDisposed()||d!==e.flightGen()){m();return}m(),e.openPanorama(p,400,d)},!0)}if(h&&E[1]){let z=o.get(E[1])?.label??E[1];D("\u203A",`View next seat ${z}`,()=>{e.flyToSeat(E[1])})}return!A.childElementCount&&!b?null:(t.appendChild(f),s=f,c(),f)},remove:m,layout:c}}var cd={rotate:"Drag to rotate the venue",move:"Drag to move the venue",zoomIn:"Zoom in",zoomOut:"Zoom out",fitView:"Show whole venue"};function ds(e){let{container:t,orbit:n,isNarrow:r}=e,o={...cd,...e.labels??{}},i=(g,v)=>{g.setAttribute("aria-label",v),g.title=v},a=document.createElement("div"),s=!1;a.className="sl-3d-navigation-controls",Object.assign(a.style,{position:"absolute",right:"14px",bottom:"14px",display:"flex",zIndex:"4",flexDirection:"column",alignItems:"flex-end",gap:"7px"});let c=document.createElement("div");c.setAttribute("role","group"),c.setAttribute("aria-label","3D drag mode"),Object.assign(c.style,{display:"flex",flexDirection:"column",gap:"6px",alignItems:"flex-end"});let m=document.createElement("div");m.setAttribute("role","group"),m.setAttribute("aria-label","3D view controls"),Object.assign(m.style,{display:"flex",flexDirection:"column",gap:"6px",alignItems:"flex-end"});let u=document.createElement("button");u.type="button",u.textContent="\u21BB",i(u,o.rotate);let p=document.createElement("button");p.type="button",p.textContent="\u2725",i(p,o.move);let d=document.createElement("button");d.type="button",d.textContent="\u2212",i(d,o.zoomOut);let l=document.createElement("button");l.type="button",l.textContent="+",i(l,o.zoomIn);for(let g of[u,p,d,l])g.className="sl-3d-icon-control",Object.assign(g.style,{width:"44px",minWidth:"44px",minHeight:"44px",padding:"9px",border:"1px solid rgba(150,165,205,0.35)",borderRadius:"999px",color:"#c9d4ea",background:"rgba(12,18,32,0.82)",font:"600 17px/1 inherit",backdropFilter:"blur(6px)",cursor:"pointer",whiteSpace:"nowrap"});c.append(u,p),m.append(l,d);let f=g=>{n.setPrimaryDragMode(g);let v=g==="orbit";u.setAttribute("aria-pressed",String(v)),p.setAttribute("aria-pressed",String(!v)),u.style.background=v?"rgba(96,110,150,0.68)":"rgba(12,18,32,0.82)",p.style.background=v?"rgba(12,18,32,0.82)":"rgba(96,110,150,0.68)",a.title=v?`${o.rotate} \xB7 ${o.move} with Shift`:`${o.move} \xB7 ${o.rotate} with Shift`};u.addEventListener("click",()=>f("orbit")),p.addEventListener("click",()=>f("pan"));let b=()=>{let{atMin:g,atMax:v}=n.dollyLimitState();l.disabled!==g&&(l.disabled=g),d.disabled!==v&&(d.disabled=v)};d.addEventListener("click",()=>{n.zoomBy(Tt),b()}),l.addEventListener("click",()=>{n.zoomBy(pt),b()}),a.append(c,m),f("orbit"),t.appendChild(a);let h=e.enabled!==!1,y=()=>{let g=r();a.style.display=s||!h?"none":"flex",a.style.right=g?"12px":"14px",a.style.bottom=g?"calc(env(safe-area-inset-bottom, 0px) + 76px)":"14px",c.style.display=g?"none":"flex",l.style.display=g?"none":"",d.style.display=g?"none":""};return y(),{element:a,utilityControls:m,setNavigationMode:f,syncZoomLimits:b,setSeatViewLocked:g=>{s=g,n.setInteractionEnabled(!g),y()},seatViewLocked:()=>s,layout:y}}var ld=12;function ud(e,t){if(!e)return!1;let n=e.x-t[0],r=e.y-t[1],o=e.z-t[2];return Math.hypot(n,r,o)>ld}function fs(e){let{glctx:t,orbit:n,model:r,seats:o,opts:i,cinematic:a,analytics:s,seatIdByIndex:c,sectionIdBySeatId:m,tapSlop:u,tapMs:p,cancelFlight:d,focusSectionCamera:l,setSelection:f,ensureSeatView:b}=e,h=0,y=0,x=0,g=-1,v=!1,A=!1,P=V=>{e.seatViewLocked()||g===-1&&(g=V.pointerId,h=V.clientX,y=V.clientY,x=performance.now(),v=!1,A=a.active,a.active&&(s.cinematicCancelled(),d(),i.onViewTargetChange?.(null)))},M=V=>{V.pointerId===g&&Math.hypot(V.clientX-h,V.clientY-y)>u&&(v=!0)},E=(V,L,C,_,B)=>{let S=t.canvas.getBoundingClientRect(),I=t.canvas.clientWidth||S.width||1,T=t.canvas.clientHeight||S.height||1,w=V-S.left,k=L-S.top,R=_*_,O=-1,j=R,H=1/0;for(let N of o){if(C&&N.sectionId!==C)continue;let F=r.seats.idToIndex.get(N.id);if(F===void 0)continue;if(B){let Z=Math.round(r.seats.iState[F]??0);if(Z!==0&&Z!==3)continue}let W=F*3,X=Ye(n.camera.projectionViewMatrix,[r.seats.iPosition[W],r.seats.iPosition[W+1]+.55,r.seats.iPosition[W+2]],I,T);if(!X.visible)continue;let Q=X.x-w,q=X.y-k,K=Q*Q+q*q;(K<j||Math.abs(K-j)<1&&X.depth<H)&&(O=F,j=K,H=X.depth)}return O},D=(V,L)=>{let C=e.gpu(),_=e.pick();if(!C||!_)return-1;_.syncFromSeatProgram(C.seatProgram);let B=t.canvas.getBoundingClientRect(),S=t.renderer.dpr,{x:I,y:T}=xa(V,L,B,S,t.gl.drawingBufferWidth,t.gl.drawingBufferHeight),w=Math.max(2,Math.round(8*S));return _.pick(n.camera,I,T,w)};return{onDown:P,onMove:M,onUp:V=>{if(V.pointerId!==g)return;let L=!v&&performance.now()-x<p;if(g=-1,A){A=!1;return}let C=e.gpu(),_=e.pick();if(!L||!C||!_)return;let B=D(V.clientX,V.clientY);if(e.focusedSectionId()&&B>=0){let T=c[B],w=T?m.get(T):void 0;if(w&&w!==e.focusedSectionId()&&l(w))return}if(e.focusedSectionId()&&B<0&&(B=E(V.clientX,V.clientY,e.focusedSectionId(),44,!1)),e.focusedSectionId()&&B<0){let T=E(V.clientX,V.clientY,null,72,!1),w=T>=0?c[T]:void 0,k=w?m.get(w):void 0;if(k&&k!==e.focusedSectionId()&&l(k))return}if(!e.focusedSectionId()){B<0&&(B=E(V.clientX,V.clientY,null,42,!1));let T=B>=0?c[B]:void 0,w=T?m.get(T):void 0;if(w&&l(w))return}if(B<0||B>=c.length){e.selection().size&&(f([]),i.onViewTargetChange?.(null));return}let S=c[B],I=pe[Math.round(r.seats.iState[B]??0)]??"available";if(I!=="available"&&I!=="selected"){i.onSeatInspect?.(S,I);return}if(e.selection().has(S)&&e.selection().size===1){f([]),i.onViewTargetChange?.(null),i.onSeatPick?.(S);return}if(f([S]),b(S),s.seatPicked(S,m.get(S)),i.onSeatPick?.(S),e.focusedSectionId()){let T=B*3,w=[r.seats.iPosition[T],r.seats.iPosition[T+1],r.seats.iPosition[T+2]];ud(n.camera?.position,w)&&e.focusSeatCamera(S)}}}}var Dn=class{constructor(t,n){this.minX=0;this.minZ=0;this.cell=1;this.cols=1;this.rows=1;this.cellStart=null;this.cellItems=null;this.iPosition=t,this.count=n}ensureGrid(){if(this.cellStart||this.count===0)return;let t=this.iPosition,n=1/0,r=1/0,o=-1/0,i=-1/0;for(let l=0;l<this.count;l++){let f=t[l*3],b=t[l*3+2];f<n&&(n=f),f>o&&(o=f),b<r&&(r=b),b>i&&(i=b)}let a=Math.max(o-n,.001),s=Math.max(i-r,.001);this.cell=Math.max(Math.sqrt(a*s*4/this.count),.25),this.cols=Math.max(1,Math.ceil(a/this.cell)+1),this.rows=Math.max(1,Math.ceil(s/this.cell)+1),this.minX=n,this.minZ=r;let c=this.cols*this.rows,m=new Int32Array(c+1),u=l=>{let f=Math.min(this.cols-1,Math.max(0,Math.floor((t[l*3]-n)/this.cell)));return Math.min(this.rows-1,Math.max(0,Math.floor((t[l*3+2]-r)/this.cell)))*this.cols+f};for(let l=0;l<this.count;l++)m[u(l)+1]++;for(let l=0;l<c;l++)m[l+1]+=m[l];let p=new Int32Array(this.count),d=m.slice(0,c);for(let l=0;l<this.count;l++)p[d[u(l)]++]=l;this.cellStart=m,this.cellItems=p}gather(t,n,r,o){this.ensureGrid();let i=this.cellStart,a=this.cellItems;if(!i||!a)return 0;let s=o.length,c=r*r,m=Math.floor((t-this.minX)/this.cell),u=Math.floor((n-this.minZ)/this.cell),p=Math.ceil(r/this.cell)+1,d=this.iPosition,l=0;for(let f=0;f<=p&&l<s;f++){let b=u-f,h=u+f,y=m-f,x=m+f;for(let g=b;g<=h&&l<s;g++){if(g<0||g>=this.rows)continue;let v=g===b||g===h;for(let A=y;A<=x&&l<s;A++){if(!v&&A!==y&&A!==x){A=x-1;continue}if(A<0||A>=this.cols)continue;let P=g*this.cols+A;for(let M=i[P],E=i[P+1];M<E&&l<s;M++){let D=a[M],z=d[D*3]-t,V=d[D*3+2]-n;z*z+V*V<=c&&(o[l++]=D)}}}}return l}};var On=class{constructor(t){this.ctx=t;this.detailVisible=!1;this.seatDetailMix=0;this.structureDetailMix=0;this.nearBuf=new Int32Array(Jt);this.lastGatherX=1/0;this.lastGatherZ=1/0;this.nearIndex=new Dn(t.model.seats.iPosition,t.model.seats.count)}forceRegather(){this.lastGatherX=1/0}setDetailEnabled(t){let n=this.ctx.gpu();t||(this.detailVisible=!1),this.lastGatherX=1/0,this.lastGatherZ=1/0,!t&&n?.nearSeatCount()&&n.setNearSeats(this.nearBuf,0)}update(t){let{model:n}=this.ctx,r=this.ctx.gpu();if(!r)return;if(!t){r.nearSeatCount()&&r.setNearSeats(this.nearBuf,0);return}let o=this.ctx.orbit().camera.position;if(Math.hypot(o.x-this.lastGatherX,o.z-this.lastGatherZ)<Xn)return;if(this.lastGatherX=o.x,this.lastGatherZ=o.z,Math.hypot(o.x-n.bounds.center[0],o.z-n.bounds.center[2])-n.bounds.radius>Yn){r.nearSeatCount()&&r.setNearSeats(this.nearBuf,0);return}let s=this.nearIndex.gather(o.x,o.z,Yn,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 Vn=require("ogl");function ps(){let e="http://www.w3.org/2000/svg",t=document.createElementNS(e,"svg");t.setAttribute("viewBox","0 0 24 24"),t.setAttribute("width","18"),t.setAttribute("height","18"),t.setAttribute("aria-hidden","true"),t.setAttribute("focusable","false"),t.setAttribute("fill","none"),t.setAttribute("stroke","currentColor"),t.setAttribute("stroke-width","2"),t.setAttribute("stroke-linecap","round"),t.setAttribute("stroke-linejoin","round");let n=document.createElementNS(e,"path");return n.setAttribute("d","M8 3H5a2 2 0 0 0-2 2v3M16 3h3a2 2 0 0 0 2 2v3M8 21H5a2 2 0 0 0-2-2v-3M16 21h3a2 2 0 0 0 2-2v-3"),t.appendChild(n),t}function ys(e){let{container:t,model:n,opts:r,orbit:o,cinematic:i,analytics:a,loop:s,labelOverlay:c,stageAzimuth:m,overviewFraming:u}=e,p=0,d=-1,l=(M,E,D=28)=>{o.camera.position.set(M[0],M[1],M[2]),o.camera.lookAt(new Vn.Vec3(E[0],E[1],E[2])),o.camera.fov=D,o.camera.updateProjectionMatrix()},f=document.createElement("button");f.className="sl-3d-overview-control sl-3d-icon-control",f.type="button",f.replaceChildren(ps());let b=r.navLabels?.fitView??"Show whole venue";f.setAttribute("aria-label",b),f.title=b,Object.assign(f.style,{width:"44px",minWidth:"44px",minHeight:"44px",padding:"9px",borderRadius:"999px",background:"rgba(12,18,32,0.72)",color:"#c9d4ea",border:"1px solid rgba(150,165,205,0.35)",backdropFilter:"blur(6px)",font:"600 11px/1 inherit",cursor:"pointer",whiteSpace:"nowrap"});let h=()=>{f.firstElementChild||f.replaceChildren(ps())};h();let y=M=>{d=M;let E=e.gpu();E&&(E.seatProgram.uniforms.uFocusFloor.value=M,E.solidProgram.uniforms.uFocusFloor.value=M,E.chairProgram.uniforms.uFocusFloor.value=M),e.showSectionSeatLabels(null)},x=()=>{if(e.isDisposed())return;r.onViewTargetChange?.(null),r.onSectionFocusChange?.(null),e.panorama()&&(e.panorama().dispose(),e.setPanorama(null),a.panoramaClosed()),e.setPanoramaSphereVisible(!1),e.panoramaLoadAbort()?.abort(),e.setPanoramaLoadAbort(null),e.restorePanoramaLayer(),f.style.display="",c.setVisible(!0),e.setFrozen(!1);let M=d>=0?n.floors[d]:null;if(e.setNearFieldDetailEnabled(!!M),e.setSeatViewLocked(!1),g(),e.removeArriveChip(),e.setNavigationMode("orbit"),M){let E=M.focalWorld[0]-M.center[0],D=M.focalWorld[2]-M.center[2],z=Math.hypot(E,D)>M.radius*.12?Math.atan2(E,D):m,V={center:M.center,radius:M.radius,box:M.box},L={polarDeg:58,margin:1.12};e.reducedMotion()?o.frame(V,!1,z,!1,L):o.frameSoft(V,z,!1,L)}else e.reducedMotion()?o.frame(n.bounds,!1,m,r.portraitOverviewCrop===!0,u):o.frameSoft(n.bounds,m,r.portraitOverviewCrop===!0,u);e.showSectionSeatLabels(null),s.requestRender()},g=()=>{p++,e.setSeatStepping(!1),e.panoramaLoadAbort()?.abort(),e.setPanoramaLoadAbort(null),i.active&&(i.cancel(),o.resumeAfterFlight(n.focalWorld))},v=M=>{if(e.isDisposed()||!e.gpu())return Promise.resolve();let E=n.seats.idToIndex.get(M);if(E===void 0)return Promise.resolve();e.setNearFieldDetailEnabled(!0),r.onViewTargetChange?.(M),e.panorama()&&(e.panorama().dispose(),e.setPanorama(null),e.setPanoramaSphereVisible(!1),f.style.display="",e.restorePanoramaLayer()),e.panoramaLoadAbort()?.abort(),e.setPanoramaLoadAbort(null),e.setFrozen(!1);let D=e.inSeatView()&&r.arriveAtSeatEye===!0;e.setSeatStepping(D),e.setSeatViewLocked(!1);let z=++p;D?e.showArriveChip(M,z):e.removeArriveChip();let{eye:V,focal:L}=e.resolvedSeatViewPose(M,E),C=r.arriveAtSeatEye?e.seatViewArrival(M,E):null,_=C?C.focal:L,B=[o.camera.position.x,o.camera.position.y,o.camera.position.z],S=_o(B,C?.eye??V,_,n.bounds.center,n.bounds.radius),I=C?C.eye:r.arriveAtSeatEye?V:S.finalPos,T=C?C.fov:r.arriveAtSeatEye?t.clientWidth/Math.max(1,t.clientHeight)<.7?Cn:65:28,w=[S.waypoints[0],S.waypoints[1],I];if(c.setVisible(!1),e.reducedMotion())return e.setSeatStepping(!1),l(I,_,T),s.requestRender(),a.cinematicSkipped(),e.isDisposed()||o.syncFromCamera(),e.setSeatViewLocked(r.arriveAtSeatEye===!0),C&&e.enterSeatView(C.stops),e.showArriveChip(M,z),Promise.resolve();let k=new Vn.Quat().copy(o.camera.quaternion),R=Ia(o.camera,I,_);s.requestRender();let O=D?700:2500;return i.start(w,k,R,O,T).then(()=>{e.isDisposed()||z!==p||(e.setSeatStepping(!1),a.cinematicPlayed(O),o.resumeAfterFlight(_),e.setSeatViewLocked(r.arriveAtSeatEye===!0),C&&e.enterSeatView(C.stops),s.requestRender(),e.showArriveChip(M,z))})},A=M=>{let E=n.sections.find(L=>L.id===M);if(!E||E.seatCount===0)return!1;e.setNearFieldDetailEnabled(!0),e.setSeatStepping(!1),e.setSeatViewLocked(!1),i.cancel(),e.removeArriveChip(),n.floors.length>1&&d!==E.floorIndex&&y(E.floorIndex),e.setNavigationMode("pan"),e.showSectionSeatLabels(M);let D=E.focalWorld[0]-E.center[0],z=E.focalWorld[2]-E.center[2],V=Math.hypot(D,z)>E.radius*.12?Math.atan2(D,z):void 0;return o.frame({center:E.center,radius:Math.max(5,E.radius*.5)},!1,V),r.onSectionFocusChange?.(M),s.requestRender(),!0},P=M=>{if(e.isDisposed()||!e.gpu())return!1;let E=n.seats.idToIndex.get(M);if(E===void 0)return!1;let D=E*3,z=[n.seats.iPosition[D],n.seats.iPosition[D+1]+.55,n.seats.iPosition[D+2]];return e.reducedMotion()?o.frame({center:z,radius:hs},!1,void 0,!1,bs):o.frameSoft({center:z,radius:hs},void 0,!1,bs),s.requestRender(),!0};return f.addEventListener("click",x),{overviewChip:f,layoutOverviewChip:h,flightGen:()=>p,focusedFloor:()=>d,applyFloorFocus:y,placeCameraFinal:l,cancelFlight:g,focusOverview:x,flyToSeat:v,focusSectionCamera:A,focusSeatCamera:P}}var hs=4.5,bs={polarDeg:48,margin:1.25};var dd={};function gs(e){let t=performance.now();return{model:St(e),buildMs:performance.now()-t,source:"main"}}function md(e){let t=Kr(e.doc);return{...gs({...e,seats:t}),seats:t}}function xs(e,t,n){if(typeof Worker>"u")return Promise.resolve(t());let r;try{r=new Worker(new URL("./scene/scene.worker.js",dd.url),{type:"module"})}catch{return Promise.resolve(t())}return new Promise(o=>{let i=!1,a=m=>{i||(i=!0,clearTimeout(c),r.terminate(),o(m))},s=()=>a(t()),c=window.setTimeout(s,15e3);r.onerror=s,r.onmessage=m=>{let u=n(m.data);u?a(u):s()},r.postMessage(e)})}function vs(e){return xs(e,()=>gs(e),({model:t,buildMs:n})=>({model:t,buildMs:n,source:"worker"}))}function Ss(e){return xs(e,()=>md(e),({model:t,buildMs:n,seats:r})=>r?{model:t,buildMs:n,seats:r,source:"worker"}:null)}var fd=Math.PI/180,pd=6,hd=500;function bd(e,t,n={}){let r=performance.now(),o=t.prepared?.model??St(t),i=new Fn(n.onAnalytics),a=new Array(o.seats.count);for(let[U,Y]of o.seats.idToIndex)a[Y]=U;let s=new Map(t.seats.map(U=>[U.id,U])),c=new Map;for(let U of t.seats){if(!U.rowId)continue;let Y=c.get(U.rowId);Y?Y.push(U.id):c.set(U.rowId,[U.id])}let m=new Map;for(let U of t.seats)m.set(U.id,U.sectionId);let u=new Map;for(let[U,Y]of o.seats.idToIndex){let $=m.get(U);if(!$)continue;let ee=u.get($);ee?ee.push(Y):u.set($,[Y])}let p=()=>{if(!l||!o.sectionSolidRanges.length)return;let{lit:U,anyUnlit:Y}=pa(o.sectionSolidRanges,u,o.seats.iState);l.setSectionShellLit(Y?U:null)},d=t.doc.floors?.some(Y=>(Y.baseHeightM??0)>0)?!0:(t.doc.floors?.flatMap(Y=>Y.objects)??t.doc.objects).some(Y=>Y.type==="section"&&((Y.height??0)>0||(Y.rake??0)>0)),l=null,f=null,b=!1,h=!1,y=!1,x=new Map,g=null,v=null,A=null,P=new Map,M=null,E=()=>{A===null&&(A=e.style.zIndex,e.style.zIndex="20")},D=()=>{A!==null&&(e.style.zIndex==="20"&&(e.style.zIndex=A),A=null)},z=!1,V=()=>z?fe.focusedFloor():-1,L=()=>{l=ya(S.gl,o),p(),f=new wn(S.renderer,l.seatGeometry,l.chairGeometry,l.solidGeometry,o.seats.count),S.setClearColor(o.theme.background.top),f.setRestoreClear(o.theme.background.top),l.seatProgram.uniforms.uSeatRadius.value=De*o.theme.seatScale,l.seatProgram.uniforms.uFocusFloor.value=V(),l.solidProgram.uniforms.uFocusFloor.value=V(),l.chairProgram.uniforms.uFocusFloor.value=V(),l.screenProgram&&(l.screenProgram.uniforms.uFocusFloor.value=V()),_.forceRegather()},C=!1,_=new On({model:o,orbit:()=>I,gpu:()=>l}),B=U=>_.setDetailEnabled(U),S=new $t(e,{onContextLost:()=>{y||i.contextLost(),b=!0,K.stop(),l=null,f=null},onContextRestored:()=>{L(),b=!1,y||i.contextRestored(),K.requestRender()}}),I=new Qt(S.gl,S.canvas,()=>K.requestRender(),()=>i.orbitEngaged());I.setAspect(S.aspect);let T=(t.doc.floors?.flatMap(U=>U.objects)??t.doc.objects).some(U=>U.type==="section"&&U.physical3dProvenance?.surfaceKind?.status==="inferred"),w=(()=>{if(T&&o.stages.length===0)return;let U=o.focalWorld[0]-o.bounds.center[0],Y=o.focalWorld[2]-o.bounds.center[2];return Math.hypot(U,Y)>o.bounds.radius*.12?Math.atan2(U,Y):void 0})(),k=o.floors.length>1?{polarDeg:48,margin:1.1}:{margin:1.1},R=typeof window<"u"&&!!window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches;I.frame(o.bounds,!R&&n.skipInitialOverviewAnimation!==!0,w,n.portraitOverviewCrop===!0,k);let O=new Pn(I.camera),j=us(e),H=new vn(e,{fontFamily:t.doc.theme?.fontFamily,ink:t.doc.theme?.textColor,backgroundRgb:o.theme.background.top}),N=o.labels,F=()=>Fi(N,o.floors.length,V());H.setLabels(F());let W=null,X=U=>{if(W=U,H.setForcedDense(!!U),!U){H.setLabels(F());return}let Y=t.seats.filter(J=>J.sectionId===U),$=new Set(Y.map(J=>J.id)),ee=new Set(Y.map(J=>J.rowId)),re=new Set(x.keys()),ie=new Set(Y.filter(J=>re.has(J.id)).map(J=>J.id)),se=F().filter(J=>J.kind!=="row"&&J.kind!=="seat"||(J.kind==="row"?ee.has(J.id.slice(4)):$.has(J.id.slice(5))&&(ie.size===0||ie.has(J.id.slice(5)))));if(o.seatCount<=6e3&&ie.size===0){H.setLabels(se);return}let me=ie.size?Y.filter(J=>ie.has(J.id)):Y,Qe=new Set(me.map(J=>`seat:${J.id}`)),Ue=me.flatMap(J=>{let ye=o.seats.idToIndex.get(J.id);if(ye===void 0)return[];let Ee=ye*3;return[{id:`seat:${J.id}`,kind:"seat",text:re.has(J.id)?J.displayLabel||J.label:Mo(J.displayLabel||J.label),anchor:[o.seats.iPosition[Ee],o.seats.iPosition[Ee+1]+(re.has(J.id)?1.05:.55),o.seats.iPosition[Ee+2]]}]});H.setLabels([...se.filter(J=>!Qe.has(J.id)),...Ue])};L();let Q=null,q=null,K=new Zt(U=>{if(b||!l||h)return!1;let Y=qa({flying:O.active,panoramaMounted:g!==null,seatViewActive:Q?.active===!0}),$=Y==="cinematic"?O.update(performance.now()):Y==="seatView"?Q.update(performance.now()):Y==="orbit"?I.update():!1;q?.syncZoomLimits();let ee=V()>=0?o.floors[V()]:null,re=ee?.radius??o.bounds.radius,ie=nr(I.currentDistance,re),se=C?{center:[I.camera.position.x,I.camera.position.y,I.camera.position.z],radius:520}:o.renderBounds;I.updateClipping(se);let me=ee?.center??o.renderBounds.center,Qe=ee?.radius??o.renderBounds.radius,Ue=(Ie,At)=>Math.hypot(I.camera.position.x-Ie[0],I.camera.position.y-Ie[1],I.camera.position.z-Ie[2])<=At*(_.detailVisible?1.8:1.55),J=Ue(me,Qe);if(!J&&W){let Ie=o.sections.find(At=>At.id===W);Ie&&(J=Ue(Ie.center,Math.max(12,Ie.radius*2)))}_.detailVisible=J;let ye=l.seatProgram.uniforms;ye.uSeatScale.value=ie.scale,ye.uSeatFade.value=ie.fade;let Ee=!!ee&&or(ee.seatCount,S.canvas.clientWidth||1,S.canvas.clientHeight||1),Xt=rr(o.seats.count,re,I.currentDistance,I.camera.fov,S.canvas.clientHeight||1),Ct=_.detailVisible||Ee||Xt?1:0,Wt=_.detailVisible||V()>=0||o.floors.length>1?1:0;return _.ease(U,Ct,Wt),ye.uSeatDetail.value=_.seatDetailMix,l.solidProgram.uniforms.uStructureDetail.value=_.structureDetailMix,ye.uMinPixels.value=ie.minPixels,ye.uPixelToWorld.value=2*Math.tan(I.camera.fov*fd/2)/Math.max(1,S.pixelHeight),_.update(_.detailVisible),S.renderer.render({scene:l.background,clear:!0}),S.renderer.render({scene:l.main,camera:I.camera,clear:!1}),H.update(I.camera.projectionViewMatrix,S.canvas.clientWidth||1,S.canvas.clientHeight||1,I.currentDistance,re,[I.camera.position.x,I.camera.position.y,I.camera.position.z]),$||_.seatDetailMix!==Ct||_.structureDetailMix!==Wt}),Z=typeof ResizeObserver<"u"?new ResizeObserver(()=>Nn.resize()):null;Z?.observe(e);let te=U=>{let Y=re=>{let ie=o.seats.idToIndex.get(re);return ie===void 0?void 0:o.seats.iState[ie]},{updates:$,next:ee}=Sa(x,U,Y);if(x=ee,H.setSelectedSeatIds(x.keys()),W&&X(W),$.length){let re=eo(o.seats,$);l&&l.uploadSeatStateRuns(re),p(),K.requestRender()}},Me=()=>M!==null?M:typeof window<"u"&&!!window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,Ae=8,Be=U=>{if(!n.getSeatView)return null;let Y=P.get(U);if(!Y)for(Y=Promise.resolve(n.getSeatView(U)),P.set(U,Y),Y.catch(()=>{P.get(U)===Y&&P.delete(U)});P.size>Ae;){let $=P.keys().next().value;if($===void 0)break;P.delete($)}return Y},ke=Na(o.stages,o.focalWorld,o.bounds.groundY??0),Ne=ko(ke),we=(U,Y)=>{let $=s.get(U),ee=Math.max(0,Math.round(o.seats.iFloor[Y]??0)),re=t.doc.floors?.[ee],ie=o.floors[ee],se=re?.focalPoint??t.doc.focalPoint,me=ie?{x:ie.focalWorld[0]/G,y:ie.focalWorld[2]/G}:se,Qe=$?.focalPoint?{x:$.focalPoint.x+me.x-se.x,y:$.focalPoint.y+me.y-se.y}:me,Ue=[o.seats.iPosition[Y*3],o.seats.iPosition[Y*3+1],o.seats.iPosition[Y*3+2]];return Ta(Ue,Qe,re?.baseHeightM??0,$?.eyeHeightM,Ne)},de=()=>(e.clientWidth||S.canvas.clientWidth)<=520,Ge=null,ct=null,lt=async(U,Y,$)=>{if(!n.getSeatView||y||$!==fe.flightGen())return;let ee;try{ee=await cs()}catch{if(i.panoramaFailed(U,"mount"),!y&&$===fe.flightGen()){let re=qe(U,$,!0);requestAnimationFrame(()=>re?.querySelector("[data-panorama-trigger]")?.focus())}return}if(!(y||$!==fe.flightGen()||!Ge))return ct??=ee.createOpenPanorama(Ge),ct(U,Y,$)},Fe=ms({container:e,model:o,opts:n,expandedSeatById:s,seatIdsByRow:c,isNarrow:de,isDisposed:()=>y,flightGen:()=>fe.flightGen(),flyToSeat:U=>Go(U),openPanorama:(U,Y,$)=>lt(U,Y,$)}),qe=Fe.show,ut=Fe.remove,Ms=Fe.layout,$e=ds({container:e,orbit:I,isNarrow:de,enabled:n.chrome?.controlDock!==!1,...n.navLabels?{labels:n.navLabels}:{}});q=$e;let ws=$e.element,wt=$e.setNavigationMode,Ps=$e.layout,Cs=$e.utilityControls,Pt=null,Bo=!1,Yt=U=>{$e.setSeatViewLocked(U),U||Q?.exit()};Q=Ka({canvas:S.canvas,camera:I.camera,requestRender:()=>K.requestRender(),reducedMotion:Me,onStopChange:U=>{let Y=U??(Bo?"seat":null);Pt=Y;try{n.onSeatViewStopChange?.(Y)}catch{}},onApplied:()=>{y||I.syncFromCamera()}});let As=(U,Y)=>{let{eye:$}=we(U,Y),ee=(e.clientWidth||S.canvas.clientWidth||1)/Math.max(1,e.clientHeight||S.canvas.clientHeight||1),re=za($,ke,ee);if(n.seatViewStops===!1)return{...re,stops:[]};let ie=m.get(U),se=ie?o.sections.find(me=>me.id===ie):void 0;return{...re,stops:Ua(re,{aspect:ee,section:se&&se.seatCount>0?{center:se.center,radius:se.radius}:null,venue:{center:o.bounds.center,radius:o.bounds.radius}})}},fe=ys({container:e,model:o,opts:n,orbit:I,cinematic:O,analytics:i,loop:K,labelOverlay:H,stageAzimuth:w,overviewFraming:k,gpu:()=>l,isDisposed:()=>y,panorama:()=>g,setPanorama:U=>{g=U},setPanoramaSphereVisible:U=>{C=U},panoramaLoadAbort:()=>v,setPanoramaLoadAbort:U=>{v=U},setFrozen:U=>{h=U},restorePanoramaLayer:D,reducedMotion:Me,resolvedSeatViewPose:we,showSectionSeatLabels:X,setNearFieldDetailEnabled:B,setSeatViewLocked:Yt,setNavigationMode:wt,showArriveChip:qe,removeArriveChip:ut,inSeatView:()=>Pt!==null,setSeatStepping:U=>{Bo=U},seatViewArrival:(U,Y)=>n.arriveAtSeatEye?As(U,Y):null,enterSeatView:U=>Q?.enter(U)});z=!0;let Bn=fe.overviewChip,Es=fe.layoutOverviewChip,Is=fe.applyFloorFocus,Rs=fe.focusOverview,No=fe.cancelFlight,Go=fe.flyToSeat,zo=fe.focusSectionCamera;Cs.appendChild(Bn),Ge={container:e,model:o,opts:n,analytics:i,orbit:I,loop:K,seatsById:s,ensureSeatView:Be,resolvedSeatViewPose:we,gpu:()=>l,gl:S.gl,isContextLost:()=>b,isDisposed:()=>y,flightGen:()=>fe.flightGen(),setPanorama:U=>{g=U},getLoadAbort:()=>v,setLoadAbort:U=>{v=U},setPanoramaSphereVisible:U=>{C=U,U&&Q?.exit()},setFrozen:U=>{h=U},raisePanoramaLayer:E,restorePanoramaLayer:D,getOverviewChip:()=>Bn,labelOverlay:H,reducedMotion:Me,removeArriveChip:ut,showArriveChip:qe};let ze=fs({glctx:S,orbit:I,model:o,seats:t.seats,opts:n,cinematic:O,analytics:i,seatIdByIndex:a,sectionIdBySeatId:m,tapSlop:pd,tapMs:hd,gpu:()=>l,pick:()=>f,seatViewLocked:()=>$e.seatViewLocked(),focusedSectionId:()=>W,selection:()=>x,cancelFlight:No,focusSectionCamera:zo,focusSeatCamera:fe.focusSeatCamera,setSelection:te,ensureSeatView:Be});S.canvas.addEventListener("pointerdown",ze.onDown),S.canvas.addEventListener("pointermove",ze.onMove),S.canvas.addEventListener("pointerup",ze.onUp),S.canvas.addEventListener("pointercancel",ze.onUp),K.requestRender();let Nn={setAvailability(U){let Y=va(x,U),$=eo(o.seats,Y);$.length&&l&&l.uploadSeatStateRuns($),p(),K.requestRender()},setSelection:te,setNavigationMode:wt,zoomIn(){I.zoomBy(pt),K.requestRender()},zoomOut(){I.zoomBy(Tt),K.requestRender()},flyToSeat:Go,focusOverview:Rs,seatViewStop:()=>Pt,recentreSeatView:()=>Q?.recentre()??!1,resize(){let{width:U,height:Y}=S.resize();I.setAspect(U/Math.max(1,Y)),Ms(),Ps(),Es(),K.requestRender()},stats(){return{...K.stats(),drawCalls:l?l.drawCalls:0,seatCount:o.seatCount}},getQualityEvidence(){let U=K.stats(),Y=S.canvas.clientWidth||1,$=S.canvas.clientHeight||1,ee=o.bounds.center,re=Ye(I.camera.projectionViewMatrix,[ee[0],o.bounds.box.min[1],ee[2]],Y,$),ie=Ye(I.camera.projectionViewMatrix,[ee[0],o.bounds.box.max[1],ee[2]],Y,$),se=o.bounds.box,me=[se.min[0],se.max[0]].flatMap(J=>[se.min[1],se.max[1]].flatMap(ye=>[se.min[2],se.max[2]].map(Ee=>Ye(I.camera.projectionViewMatrix,[J,ye,Ee],Y,$)))).filter(J=>Number.isFinite(J.x)&&Number.isFinite(J.y)&&Number.isFinite(J.depth)),Qe=me.length?(()=>{let J=Math.min(...me.map(Ze=>Ze.x)),ye=Math.max(...me.map(Ze=>Ze.x)),Ee=Math.min(...me.map(Ze=>Ze.y)),Xt=Math.max(...me.map(Ze=>Ze.y)),Ct=Math.max(0,J),Wt=Math.min(Y,ye),Ie=Math.max(0,Ee),At=Math.min($,Xt),Kt=Math.max(0,Wt-Ct),Gn=Math.max(0,At-Ie);return{box:{x:Ct,y:Ie,width:Kt,height:Gn},horizontalFillRatio:Kt/Y,verticalFillRatio:Gn/$,visibleAreaRatio:Kt*Gn/(Y*$),clippedEdges:[...Ee<0?["top"]:[],...ye>Y?["right"]:[],...Xt>$?["bottom"]:[],...J<0?["left"]:[]]}})():void 0,Ue=String(S.gl.getParameter(S.gl.VERSION)??"");return{viewport:{width:Y,height:$},context:{webgl2:/webgl\s*2/i.test(Ue),lost:b},frame:{rendered:U.rendered,idle:U.idle},camera:{position:[I.camera.position.x,I.camera.position.y,I.camera.position.z],distance:I.currentDistance,verticalFovDeg:I.fovY},scene:{seatCount:o.seatCount,floorCount:o.floors.length,zoneCount:o.zones.length,sectionCount:o.sections.length,authoredRelief:d,renderedVerticalSpanM:Math.max(0,o.bounds.box.max[1]-o.bounds.box.min[1]),projectedReliefPx:re.visible&&ie.visible?Math.abs(re.y-ie.y):0},labels:H.qualityEvidence(),framing:Qe,...Pt?{seatView:{fovDeg:I.camera.fov,stop:Pt}}:{}}},getQualityReport(){return Sn(Nn.getQualityEvidence())},loseContextForTest(){S.simulateContextLossCycle()},floors(){return o.floors},focusFloor(U){if(U!==null&&!o.floors.some($=>$.index===U))return!1;let Y=U??-1;if(B(U!==null),Yt(!1),Is(Y),wt("orbit"),U===null)O.cancel(),Me()?I.frame(o.bounds,!1,w,n.portraitOverviewCrop===!0,k):I.frameSoft(o.bounds,w,n.portraitOverviewCrop===!0,k);else{let $=o.floors[U];if($.seatCount>0){O.cancel();let ee=$.focalWorld[0]-$.center[0],re=$.focalWorld[2]-$.center[2],ie=Math.hypot(ee,re)>$.radius*.12?Math.atan2(ee,re):w;I.frame({center:$.center,radius:$.radius,box:$.box},!1,ie,!1,{polarDeg:58,margin:1.12})}}return K.requestRender(),!0},zones(){return o.zones},focusZone(U){let Y=o.zones.find(ie=>ie.id===U);if(!Y||Y.seatCount===0)return!1;B(!1),Yt(!1),O.cancel(),wt("orbit"),X(null),n.onSectionFocusChange?.(null);let $=Y.focalWorld[0]-Y.center[0],ee=Y.focalWorld[2]-Y.center[2],re=Math.hypot($,ee)>Y.radius*.12?Math.atan2($,ee):void 0;return I.frame({center:Y.center,radius:Y.radius*1.25},!1,re),K.requestRender(),!0},sections(){return o.sections},focusSection(U){return zo(U)},rows(U){return U?o.rows.filter(Y=>Y.sectionId===U):o.rows},seatsInRow(U){return t.seats.filter(Y=>Y.rowId===U).map(Y=>({id:Y.id,label:Y.displayLabel||Y.label}))},focusRow(U){let Y=o.rows.find($=>$.id===U);return!Y||Y.seatCount===0?!1:(B(!0),Yt(!1),O.cancel(),wt("pan"),Y.sectionId&&(X(Y.sectionId),n.onSectionFocusChange?.(Y.sectionId)),I.frame({center:Y.center,radius:Math.max(2.5,Y.radius*.65)}),K.requestRender(),!0)},setReducedMotionForTest(U){M=U},dispose(){y=!0,ut(),Bn.remove(),ws.remove(),No(),Q?.dispose(),K.stop(),H.dispose(),Z?.disconnect(),g&&(g.dispose(),g=null),D(),j(),S.canvas.removeEventListener("pointerdown",ze.onDown),S.canvas.removeEventListener("pointermove",ze.onMove),S.canvas.removeEventListener("pointerup",ze.onUp),S.canvas.removeEventListener("pointercancel",ze.onUp),I.dispose(),f&&f.dispose(),l&&l.dispose(),l=null,f=null,S.dispose()}};return i.opened(o.seatCount,d,t.prepared?.buildMs??performance.now()-r,t.prepared?.source??"inline"),Nn}0&&(module.exports={VENUE3D_QUALITY_REPORT_VERSION,buildSceneModel,inspectVenue3DQualityEvidence,mountVenue3D,prepareVenue3D,prepareVenue3DFromChart});
|