@seatlayer/core 0.100.0 → 0.102.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-TGXEBJUB.js +1 -0
- package/dist/be-JIDOHWF6.js +1 -0
- package/dist/bg-ODVJNCC2.js +1 -0
- package/dist/ca-3I7TMWYU.js +1 -0
- package/dist/{categoryInventory-DuOez0-4.d.cts → categoryInventory-7gSFTu0l.d.cts} +1 -1
- package/dist/{categoryInventory-DdJdJ4Og.d.ts → categoryInventory-hJxuFF9L.d.ts} +1 -1
- package/dist/chunk-254ABRJF.js +1 -0
- package/dist/{chunk-VWT44HBR.js → chunk-4DYJCT62.js} +1 -1
- package/dist/chunk-4R6TXHY2.js +1 -0
- package/dist/{chunk-D723OZEY.js → chunk-66T4EAUA.js} +1 -1
- package/dist/{chunk-GLGXP5I7.js → chunk-AFJWTB7L.js} +1 -1
- package/dist/chunk-COECA63Q.js +1 -0
- package/dist/chunk-EIV3CAGV.js +1 -0
- package/dist/chunk-FOIYJ5NT.js +1 -0
- package/dist/chunk-FUFRWRPM.js +1 -0
- package/dist/{chunk-KFVUBZMK.js → chunk-GPZFVQXV.js} +1 -1
- package/dist/{chunk-L34T3APU.js → chunk-GTRYL7YV.js} +1 -1
- package/dist/chunk-JRZHC75P.js +1 -0
- package/dist/chunk-KTMZ3QAO.js +1 -0
- package/dist/chunk-PHV2U54Y.js +1 -0
- package/dist/chunk-TAMY7HTV.js +1 -0
- package/dist/chunk-UEDS3HJ3.js +1 -0
- package/dist/{chunk-P4J57TK6.js → chunk-YPVYZYMH.js} +1 -1
- package/dist/chunk-ZS5YFXSE.js +1 -0
- package/dist/core/chart-ops/index.cjs +1 -1
- package/dist/core/chart-ops/index.d.cts +30 -9
- package/dist/core/chart-ops/index.d.ts +30 -9
- package/dist/core/chart-ops/index.js +1 -1
- package/dist/core/inventory/index.cjs +1 -1
- package/dist/core/inventory/index.d.cts +72 -5
- package/dist/core/inventory/index.d.ts +72 -5
- package/dist/core/inventory/index.js +1 -1
- package/dist/core/layout/index.cjs +1 -1
- package/dist/core/layout/index.d.cts +63 -6
- package/dist/core/layout/index.d.ts +63 -6
- package/dist/core/layout/index.js +1 -1
- package/dist/core/quality/index.cjs +1 -1
- package/dist/core/quality/index.d.cts +18 -4
- package/dist/core/quality/index.d.ts +18 -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 -2
- package/dist/core/render-assets/index.d.ts +2 -2
- 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.cjs +1 -1
- package/dist/core/sections/index.d.cts +5 -5
- package/dist/core/sections/index.d.ts +5 -5
- package/dist/core/sections/index.js +1 -1
- package/dist/cs-XXB624Z3.js +1 -0
- package/dist/cy-W2QNU2GO.js +1 -0
- package/dist/da-Q47YPK2E.js +1 -0
- package/dist/de-TS3DPLM5.js +1 -0
- package/dist/{el-ZPFVDCWA.js → el-3JQUH6DB.js} +1 -1
- package/dist/es-GP7VOX7S.js +1 -0
- package/dist/et-A22OMZ6V.js +1 -0
- package/dist/{eventConfigurations-DYn5XP3J.d.cts → eventConfigurations-BHIfPJJJ.d.cts} +1 -1
- package/dist/{eventConfigurations-BISNREZL.d.ts → eventConfigurations-I5UBS6r9.d.ts} +1 -1
- package/dist/fa-5MS3C6YX.js +1 -0
- package/dist/fi-OJLAOJO2.js +1 -0
- package/dist/fr-7ATOYJCF.js +1 -0
- package/dist/he-37LKRY5W.js +1 -0
- package/dist/hi-YXZ5EWK7.js +1 -0
- package/dist/hr-QFOPGLMR.js +1 -0
- package/dist/hu-RHRBK46E.js +1 -0
- package/dist/id-A5Q3MLSX.js +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +58 -17
- package/dist/index.d.ts +58 -17
- package/dist/index.js +1 -1
- package/dist/it-KG53QPQF.js +1 -0
- package/dist/ja-CC6EPUSN.js +1 -0
- package/dist/ko-7H4RGYFK.js +1 -0
- package/dist/ku-HFYWPSS4.js +1 -0
- package/dist/{labeling-CzuSxAkr.d.ts → labeling-2A31f781.d.cts} +11 -3
- package/dist/{labeling-owTTG6e0.d.cts → labeling-CDKZ9TO1.d.ts} +11 -3
- package/dist/localeLoaders-4YMC7FIZ.js +1 -0
- package/dist/lt-HQXE7W47.js +1 -0
- package/dist/lv-AN25XXPB.js +1 -0
- package/dist/ms-CWAYSF6E.js +1 -0
- package/dist/nl-63QBRZSZ.js +1 -0
- package/dist/no-RAPQMKWU.js +1 -0
- package/dist/pl-ILSTD4ZV.js +1 -0
- package/dist/pt-WF3US5D7.js +1 -0
- package/dist/{renderedQuality-BZycehrC.d.cts → renderedQuality-CwZ8hY-5.d.cts} +1 -1
- package/dist/{renderedQuality-DPElQ3-x.d.ts → renderedQuality-wDIiUId3.d.ts} +1 -1
- package/dist/{renderer-DnsIDiWN.d.cts → renderer-CdJx5l3B.d.ts} +12 -3
- package/dist/{renderer-DPKIlnuF.d.ts → renderer-D6ggv3bV.d.cts} +12 -3
- package/dist/ro-XR3HT6DE.js +1 -0
- package/dist/ru-TLJEWDPA.js +1 -0
- package/dist/{seatTypeIcons-dy3XQVWN.d.ts → seatTypeIcons-DMJX4rVN.d.cts} +2 -2
- package/dist/{seatTypeIcons-QwEebl3k.d.cts → seatTypeIcons-UpUTD8Xf.d.ts} +2 -2
- package/dist/{sections-DSIfnBJY.d.cts → sections-CempT5a0.d.cts} +5 -2
- package/dist/{sections-C8VTe6BN.d.ts → sections-lpdfwSdO.d.ts} +5 -2
- package/dist/{segmentedRowModel-CDvvJJ4-.d.cts → segmentedRowModel-Ddx5ol8T.d.cts} +1 -1
- package/dist/{segmentedRowModel-I8eYUQft.d.ts → segmentedRowModel-HwY4XuYa.d.ts} +1 -1
- package/dist/sk-OJC2EL3Z.js +1 -0
- package/dist/sl-7RGTVXCV.js +1 -0
- package/dist/sr-NHDJ54BS.js +1 -0
- package/dist/sv-ZODCCBCU.js +1 -0
- package/dist/{tableSizing-x8ADFtKS.d.cts → tableSizing-BJqAuJDg.d.cts} +3 -3
- package/dist/{tableSizing-0PwrOWi5.d.ts → tableSizing-C0zx97eg.d.ts} +3 -3
- package/dist/th-VCZA4MP5.js +1 -0
- package/dist/{ticketRestrictions-C8H-XJha.d.ts → ticketRestrictions-AU8UUmdL.d.ts} +39 -3
- package/dist/{ticketRestrictions-O-fv0Os6.d.cts → ticketRestrictions-DDQHiKF-.d.cts} +39 -3
- package/dist/tr-ROKZO3HC.js +1 -0
- package/dist/{types-DWx32xXH.d.cts → types-DL7qIUrD.d.cts} +85 -2
- package/dist/{types-DWx32xXH.d.ts → types-DL7qIUrD.d.ts} +85 -2
- package/dist/uk-LP2DPUHC.js +1 -0
- package/dist/vi-JDK3JRJR.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 +102 -60
- package/dist/view3d/index.d.cts +26 -5
- package/dist/view3d/index.d.ts +26 -5
- package/dist/view3d/index.js +100 -58
- package/dist/view3d/scene/scene.worker.cjs +1 -1
- package/dist/view3d/scene/scene.worker.js +1 -1
- package/dist/zh-Hans-P3GB3FAZ.js +1 -0
- package/dist/zh-Hant-YU4OKSFZ.js +1 -0
- package/package.json +1 -1
- package/dist/ar-Q44JP5JY.js +0 -1
- package/dist/be-CGFFSIQL.js +0 -1
- package/dist/bg-WOYK6OLH.js +0 -1
- package/dist/ca-77ZVI3X5.js +0 -1
- package/dist/chunk-23OTKCJU.js +0 -1
- package/dist/chunk-5BMXWOE7.js +0 -1
- package/dist/chunk-5ITK5236.js +0 -1
- package/dist/chunk-COOPHSHM.js +0 -1
- package/dist/chunk-CTIGUXXK.js +0 -1
- package/dist/chunk-HO4MFTVX.js +0 -1
- package/dist/chunk-HYEZPOZU.js +0 -1
- package/dist/chunk-N4J4CT6P.js +0 -1
- package/dist/chunk-QJXSZT3H.js +0 -1
- package/dist/chunk-UIMDB6GZ.js +0 -1
- package/dist/chunk-UISTXRO5.js +0 -1
- package/dist/cs-OSBZYCSR.js +0 -1
- package/dist/cy-ZCOJW2WH.js +0 -1
- package/dist/da-2PDK6JTR.js +0 -1
- package/dist/de-R5LLVFUU.js +0 -1
- package/dist/es-7YASJP32.js +0 -1
- package/dist/et-J4TV6KQL.js +0 -1
- package/dist/fa-4TEO7UGM.js +0 -1
- package/dist/fi-GIUDDKMH.js +0 -1
- package/dist/fr-J5J2XJLA.js +0 -1
- package/dist/he-OCEHSVUJ.js +0 -1
- package/dist/hi-EK5CTBW5.js +0 -1
- package/dist/hr-SLDTQOYC.js +0 -1
- package/dist/hu-2QNE77NO.js +0 -1
- package/dist/id-LGDAFQJK.js +0 -1
- package/dist/it-DT4Y3IYB.js +0 -1
- package/dist/ja-D5EY2XCQ.js +0 -1
- package/dist/ko-DD2NV45Q.js +0 -1
- package/dist/ku-KZCMVLBE.js +0 -1
- package/dist/localeLoaders-GGAKX22E.js +0 -1
- package/dist/lt-QWGTJ47Y.js +0 -1
- package/dist/lv-LYAIG3VK.js +0 -1
- package/dist/ms-XTF4KNGD.js +0 -1
- package/dist/nl-QEXY6XHS.js +0 -1
- package/dist/no-HCOXN2CN.js +0 -1
- package/dist/pl-BWY53TSD.js +0 -1
- package/dist/pt-2UJUBCPL.js +0 -1
- package/dist/ro-GGXOLTED.js +0 -1
- package/dist/ru-ZTFK3WCU.js +0 -1
- package/dist/sk-KU543Y2U.js +0 -1
- package/dist/sl-FT576R7A.js +0 -1
- package/dist/sr-WE3J46JE.js +0 -1
- package/dist/sv-YEAOPSEB.js +0 -1
- package/dist/th-BEBRDHJA.js +0 -1
- package/dist/tr-LOAHUPSH.js +0 -1
- package/dist/uk-2GMICSHN.js +0 -1
- package/dist/vi-TC5B6AUR.js +0 -1
- package/dist/zh-Hans-TSZWTZQY.js +0 -1
- package/dist/zh-Hant-TLB4FZYM.js +0 -1
package/dist/view3d/index.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var cm=Object.create;var Yn=Object.defineProperty;var lm=Object.getOwnPropertyDescriptor;var um=Object.getOwnPropertyNames;var mm=Object.getPrototypeOf,fm=Object.prototype.hasOwnProperty;var un=(e,t,n)=>()=>{if(n)throw n[0];try{return e&&(t=e(e=0)),t}catch(o){throw n=[o],o}};var Di=(e,t)=>{for(var n in t)Yn(e,n,{get:t[n],enumerable:!0})},Ni=(e,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of um(t))!fm.call(e,r)&&r!==n&&Yn(e,r,{get:()=>t[r],enumerable:!(o=lm(t,r))||o.enumerable});return e};var at=(e,t,n)=>(n=e!=null?cm(mm(e)):{},Ni(t||!e||!e.__esModule?Yn(n,"default",{value:e,enumerable:!0}):n,e)),dm=e=>Ni(Yn({},"__esModule",{value:!0}),e);function N0(e,t){return!Number.isFinite(e)||!Number.isFinite(t)||e<=0||t<=0?0:Math.ceil(e*t*4*(4/3))}function B0(e){return(e!==void 0&&e<=2?32:e!==void 0&&e>=8?192:96)*1024*1024}function Bo(e){let t=typeof navigator>"u"?void 0:navigator;return{saveData:t?.connection?.saveData===!0,maxTextureSize:e,maxDecodedBytes:B0(t?.deviceMemory)}}function Vo(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 o={initialUrl:n,initialWidth:e.previewWidth,initialHeight:e.previewHeight};if(t.saveData)return{...o,reason:"save-data"};let r=[...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(!r.length)return{...o,upgradeUrl:e.url,reason:"progressive"};let i=r.filter(c=>t.maxTextureSize===void 0||Math.max(c.width,c.height)<=t.maxTextureSize);if(!i.length)return{...o,reason:"texture-limit"};let a=i.filter(c=>t.maxDecodedBytes===void 0||N0(c.width,c.height)<=t.maxDecodedBytes);if(!a.length)return{...o,reason:"memory-limit"};let s=a[a.length-1];return{...o,upgradeUrl:s.url,reason:"progressive"}}function Mu(){return new DOMException("Panorama image load aborted","AbortError")}function Hn(e,t){return new Promise((n,o)=>{if(t?.aborted){o(Mu());return}let r=new Image;r.crossOrigin="anonymous";let i=!1,a=()=>{r.onload=null,r.onerror=null,t?.removeEventListener("abort",c)},s=u=>{i||(i=!0,a(),u?o(u):n(r))},c=()=>{r.src="",s(Mu())};r.onload=()=>{(typeof r.decode=="function"?r.decode():Promise.resolve()).then(()=>s(),()=>s())},r.onerror=()=>s(new Error("panorama_image_failed")),t?.addEventListener("abort",c,{once:!0}),r.src=e})}function Ho(e){let t=globalThis;if(t.requestIdleCallback){let o=t.requestIdleCallback(e,{timeout:1200});return()=>t.cancelIdleCallback?.(o)}let n=globalThis.setTimeout(e,32);return()=>globalThis.clearTimeout(n)}var bi=un(()=>{"use strict"});function wu(e){if(e.generated||e.mediaKind==="model")return"built from the chart";let t=e.mediaKind==="demo-render",n=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",o=e.capturedAt&&/^\d{4}/.test(e.capturedAt)?e.capturedAt.slice(0,4):"";return[n,o?`${t?"created":"captured"} ${o}`:"",e.sourceLabel??""].filter(Boolean).join(" \xB7 ")}function yi(e){return Math.max(V0,Math.min(H0,e))}function G0(e,t,n){let o=(.5+e/360)*n;return t/2-o}function z0(e,t=zo){return e*(180/t)}function Su(e,t,n){return(e-t)/2+Go(n,t)}function Go(e,t){let n=it/180*t;return Math.max(-n,Math.min(n,e))}function U0(){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 gi(e){return e||(U0()?"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 Pu(e,t,n={}){let o=n.fadeMs??400,r=t.initialBearingDeg??0,i=Vo(t,Bo()),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 ${o}ms ease`,background:"#05070c",overflow:"hidden",touchAction:"none"});let l=document.createElement("div");Object.assign(l.style,{position:"absolute",inset:"0",backgroundImage:`url("${i.initialUrl}")`,backgroundRepeat:"repeat-x",cursor:"grab"}),c.appendChild(l);let m=document.createElement("button");if(m.type="button",m.setAttribute("aria-label","Close"),m.textContent="\u2715",Object.assign(m.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(m),n.disclosure){let H=document.createElement("div");H.textContent=`${n.disclosurePrefix??"360\xB0 panorama"} \xB7 ${n.disclosure}`,Object.assign(H.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(H)}let h=document.createElement("div");h.textContent=gi(n.lookAroundHint),Object.assign(h.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(h),e.appendChild(c),m.focus({preventScroll:!0});let f=0,d=0,p=0,b=0,g=zo,v=()=>{let H=c.clientHeight||1,z=c.clientWidth||1,$=M.naturalWidth||z*2,Q=M.naturalHeight||H,ae=f>0?(z/2-p)/f:0,q=d>0?b/d:0;d=z0(H,g),f=d*($/Q),l.style.backgroundSize=`${f}px ${d}px`,w?p=z/2-ae*f:(p=G0(r,z,f),b=Go((t.initialPitchDeg??0)/180*d,d),w=!0),b=Go(q*d,d),l.style.backgroundPosition=`${p}px ${Su(H,d,b)}px`},w=!1,R=()=>{let H=c.clientHeight||1;b=Go(b,d),l.style.backgroundPosition=`${p}px ${Su(H,d,b)}px`},M=new Image;M.onload=v,M.src=i.initialUrl;let y=()=>{};i.upgradeUrl&&(y=Ho(()=>{(t.resolveUrl?t.resolveUrl(i.upgradeUrl):Promise.resolve(i.upgradeUrl)).then(z=>!z||a.signal.aborted?null:Hn(z,a.signal).then($=>({full:$,url:z}))).then(z=>{z&&(V||a.signal.aborted||(M=z.full,l.style.backgroundImage=`url("${z.url}")`,v()))}).catch(()=>{})})),requestAnimationFrame(v);let P=!1,x=0,S=0,A=0,_=new Map,D=()=>{let[H,z]=[..._.values()];return H&&z?Math.hypot(H.x-z.x,H.y-z.y):0},E=H=>{let z=yi(H);z!==g&&(g=z,v())},I=H=>{_.set(H.pointerId,{x:H.clientX,y:H.clientY}),P=_.size===1,x=H.clientX,S=H.clientY,_.size===2&&(A=D()),l.style.cursor="grabbing";try{l.setPointerCapture?.(H.pointerId)}catch{}},k=H=>{if(_.has(H.pointerId)){if(_.set(H.pointerId,{x:H.clientX,y:H.clientY}),_.size>=2){let z=D();A>0&&z>0&&E(g*(A/z)),A=z,P=!1;return}P&&(p+=H.clientX-x,b+=H.clientY-S,x=H.clientX,S=H.clientY,R())}},L=H=>{_.delete(H.pointerId),A=_.size===2?D():0;let z=_.values().next().value;P=_.size===1,z?(x=z.x,S=z.y):l.style.cursor="grab";try{l.releasePointerCapture?.(H.pointerId)}catch{}},B=H=>{H.preventDefault(),E(g+H.deltaY*.04)};l.addEventListener("pointerdown",I),l.addEventListener("pointermove",k),l.addEventListener("pointerup",L),l.addEventListener("pointercancel",L),l.addEventListener("wheel",B,{passive:!1});let F=!1,V=!1,N=0,C=()=>{l.removeEventListener("pointerdown",I),l.removeEventListener("pointermove",k),l.removeEventListener("pointerup",L),l.removeEventListener("pointercancel",L),l.removeEventListener("wheel",B),window.removeEventListener("keydown",j)},O=()=>{y(),a.abort(),n.signal?.removeEventListener("abort",s),N&&(window.clearTimeout(N),N=0),C(),c.parentNode&&c.parentNode.removeChild(c),u?.isConnected&&u.focus({preventScroll:!0})},G=()=>{if(F)return;F=!0,c.style.opacity="0";let H=()=>{N=0,!V&&(O(),n.onClose?.())};N=window.setTimeout(H,o)},j=H=>{if(H.key==="Tab"){H.preventDefault(),m.focus({preventScroll:!0});return}if(H.key==="Escape"){H.stopPropagation(),G();return}if(H.key==="ArrowLeft"||H.key==="ArrowRight")p+=H.key==="ArrowLeft"?-32:32;else if(H.key==="ArrowUp"||H.key==="ArrowDown")b+=(H.key==="ArrowUp"?4:-4)*(d/180);else if(H.key==="+"||H.key==="="){E(g-5),H.preventDefault();return}else if(H.key==="-"){E(g+5),H.preventDefault();return}else return;H.preventDefault(),R()};return window.addEventListener("keydown",j),m.addEventListener("click",G),requestAnimationFrame(()=>{c.style.opacity="1"}),{close:G,dispose(){F=!0,V=!0,O()}}}var zo,V0,H0,it,Uo=un(()=>{"use strict";bi();zo=70,V0=35,H0=90;it=35});function Y0(e=j0,t=X0,n=W0){let o=e+1,r=t+1,i=o*r,a=new Float32Array(i*3),s=new Float32Array(i*2);for(let l=0;l<r;l++){let m=l/t,h=m*Math.PI,f=Math.sin(h),d=Math.cos(h);for(let p=0;p<o;p++){let b=p/e,g=(b-.5)*Math.PI*2,v=l*o+p;a[v*3]=n*f*Math.sin(g),a[v*3+1]=n*d,a[v*3+2]=-n*f*Math.cos(g),s[v*2]=b,s[v*2+1]=m}}let c=new Uint16Array(e*t*6),u=0;for(let l=0;l<t;l++)for(let m=0;m<e;m++){let h=l*o+m,f=h+o;c[u++]=h,c[u++]=f,c[u++]=h+1,c[u++]=h+1,c[u++]=f,c[u++]=f+1}return{position:a,uv:s,index:c}}function Iu(e,t){let n=e*Math.PI/180,o=t*Math.PI/180,r=Math.cos(o);return[r*Math.sin(n),Math.sin(o),-r*Math.cos(n)]}function Au(e,t){let{position:n,uv:o,index:r}=Y0(),i=new At.Geometry(e,{position:{size:3,data:n},uv:{size:2,data:o},index:{data:r}}),a=new At.Texture(e,{image:t,wrapS:e.CLAMP_TO_EDGE,wrapT:e.CLAMP_TO_EDGE,generateMipmaps:!0,flipY:!1}),s=new At.Program(e,{vertex:K0,fragment:$0,uniforms:{uPano:{value:a},uOpacity:{value:0}},transparent:!0,depthTest:!1,depthWrite:!1}),c=new At.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 At,j0,X0,W0,K0,$0,Ru=un(()=>{"use strict";At=require("ogl"),j0=64,X0=32,W0=500;K0=`#version 300 es
|
|
1
|
+
"use strict";var Om=Object.create;var to=Object.defineProperty;var Fm=Object.getOwnPropertyDescriptor;var Dm=Object.getOwnPropertyNames;var Nm=Object.getPrototypeOf,Bm=Object.prototype.hasOwnProperty;var xn=(e,t,n)=>()=>{if(n)throw n[0];try{return e&&(t=e(e=0)),t}catch(o){throw n=[o],o}};var oa=(e,t)=>{for(var n in t)to(e,n,{get:t[n],enumerable:!0})},ra=(e,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Dm(t))!Bm.call(e,i)&&i!==n&&to(e,i,{get:()=>t[i],enumerable:!(o=Fm(t,i))||o.enumerable});return e};var nt=(e,t,n)=>(n=e!=null?Om(Nm(e)):{},ra(t||!e||!e.__esModule?to(n,"default",{value:e,enumerable:!0}):n,e)),Vm=e=>ra(to({},"__esModule",{value:!0}),e);function Wg(e,t){return!Number.isFinite(e)||!Number.isFinite(t)||e<=0||t<=0?0:Math.ceil(e*t*4*(4/3))}function Xg(e){return(e!==void 0&&e<=2?32:e!==void 0&&e>=8?192:96)*1024*1024}function Ko(e){let t=typeof navigator>"u"?void 0:navigator;return{saveData:t?.connection?.saveData===!0,maxTextureSize:e,maxDecodedBytes:Xg(t?.deviceMemory)}}function $o(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 o={initialUrl:n,initialWidth:e.previewWidth,initialHeight:e.previewHeight};if(t.saveData)return{...o,reason:"save-data"};let i=[...e.variants??[],...e.sourceWidth!==void 0&&e.sourceHeight!==void 0?[{url:e.url,width:e.sourceWidth,height:e.sourceHeight}]:[]].filter(c=>c.url.trim()&&c.url!==n&&Number.isFinite(c.width)&&c.width>0&&Number.isFinite(c.height)&&c.height>0).sort((c,l)=>c.width*c.height-l.width*l.height);if(!i.length)return{...o,upgradeUrl:e.url,reason:"progressive"};let r=i.filter(c=>t.maxTextureSize===void 0||Math.max(c.width,c.height)<=t.maxTextureSize);if(!r.length)return{...o,reason:"texture-limit"};let a=r.filter(c=>t.maxDecodedBytes===void 0||Wg(c.width,c.height)<=t.maxDecodedBytes);if(!a.length)return{...o,reason:"memory-limit"};let s=a[a.length-1];return{...o,upgradeUrl:s.url,reason:"progressive"}}function $u(){return new DOMException("Panorama image load aborted","AbortError")}function qn(e,t){return new Promise((n,o)=>{if(t?.aborted){o($u());return}let i=new Image;i.crossOrigin="anonymous";let r=!1,a=()=>{i.onload=null,i.onerror=null,t?.removeEventListener("abort",c)},s=l=>{r||(r=!0,a(),l?o(l):n(i))},c=()=>{i.src="",s($u())};i.onload=()=>{(typeof i.decode=="function"?i.decode():Promise.resolve()).then(()=>s(),()=>s())},i.onerror=()=>s(new Error("panorama_image_failed")),t?.addEventListener("abort",c,{once:!0}),i.src=e})}function qo(e){let t=globalThis;if(t.requestIdleCallback){let o=t.requestIdleCallback(e,{timeout:1200});return()=>t.cancelIdleCallback?.(o)}let n=globalThis.setTimeout(e,32);return()=>globalThis.clearTimeout(n)}var Fi=xn(()=>{"use strict"});function Zu(e){if(e.generated||e.mediaKind==="model")return"built from the chart";let t=e.mediaKind==="demo-render",n=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",o=e.capturedAt&&/^\d{4}/.test(e.capturedAt)?e.capturedAt.slice(0,4):"";return[n,o?`${t?"created":"captured"} ${o}`:"",e.sourceLabel??""].filter(Boolean).join(" \xB7 ")}function Di(e){return Math.max(Yg,Math.min(Kg,e))}function $g(e,t,n){let o=(.5+e/360)*n;return t/2-o}function qg(e,t=Qo){return e*(180/t)}function qu(e,t,n){return(e-t)/2+Zo(n,t)}function Zo(e,t){let n=lt/180*t;return Math.max(-n,Math.min(n,e))}function Zg(){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 Ni(e){return e||(Zg()?"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 Qu(e,t,n={}){let o=n.fadeMs??400,i=t.initialBearingDeg??0,r=$o(t,Ko()),a=new AbortController,s=()=>a.abort();n.signal?.addEventListener("abort",s,{once:!0});let c=document.createElement("div"),l=document.activeElement instanceof HTMLElement?document.activeElement:null;c.setAttribute("role","dialog"),c.setAttribute("aria-modal","true"),c.setAttribute("aria-label",n.seatLabel?`View from ${n.seatLabel}`:"View from seat"),c.tabIndex=-1,Object.assign(c.style,{position:"absolute",inset:"0",zIndex:"10",opacity:"0",transition:`opacity ${o}ms ease`,background:"#05070c",overflow:"hidden",touchAction:"none"});let u=document.createElement("div");Object.assign(u.style,{position:"absolute",inset:"0",backgroundImage:`url("${r.initialUrl}")`,backgroundRepeat:"repeat-x",cursor:"grab"}),c.appendChild(u);let m=document.createElement("button");if(m.type="button",m.setAttribute("aria-label","Close"),m.textContent="\u2715",Object.assign(m.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(m),n.disclosure){let G=document.createElement("div");G.textContent=`${n.disclosurePrefix??"360\xB0 panorama"} \xB7 ${n.disclosure}`,Object.assign(G.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(G)}let f=document.createElement("div");f.textContent=Ni(n.lookAroundHint),Object.assign(f.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(f),e.appendChild(c),m.focus({preventScroll:!0});let d=0,h=0,p=0,b=0,y=Qo,x=()=>{let G=c.clientHeight||1,U=c.clientWidth||1,q=M.naturalWidth||U*2,$=M.naturalHeight||G,ee=d>0?(U/2-p)/d:0,Q=h>0?b/h:0;h=qg(G,y),d=h*(q/$),u.style.backgroundSize=`${d}px ${h}px`,S?p=U/2-ee*d:(p=$g(i,U,d),b=Zo((t.initialPitchDeg??0)/180*h,h),S=!0),b=Zo(Q*h,h),u.style.backgroundPosition=`${p}px ${qu(G,h,b)}px`},S=!1,A=()=>{let G=c.clientHeight||1;b=Zo(b,h),u.style.backgroundPosition=`${p}px ${qu(G,h,b)}px`},M=new Image;M.onload=x,M.src=r.initialUrl;let g=()=>{};r.upgradeUrl&&(g=qo(()=>{(t.resolveUrl?t.resolveUrl(r.upgradeUrl):Promise.resolve(r.upgradeUrl)).then(U=>!U||a.signal.aborted?null:qn(U,a.signal).then(q=>({full:q,url:U}))).then(U=>{U&&(H||a.signal.aborted||(M=U.full,u.style.backgroundImage=`url("${U.url}")`,x()))}).catch(()=>{})})),requestAnimationFrame(x);let P=!1,v=0,w=0,R=0,_=new Map,F=()=>{let[G,U]=[..._.values()];return G&&U?Math.hypot(G.x-U.x,G.y-U.y):0},E=G=>{let U=Di(G);U!==y&&(y=U,x())},I=G=>{_.set(G.pointerId,{x:G.clientX,y:G.clientY}),P=_.size===1,v=G.clientX,w=G.clientY,_.size===2&&(R=F()),u.style.cursor="grabbing";try{u.setPointerCapture?.(G.pointerId)}catch{}},T=G=>{if(_.has(G.pointerId)){if(_.set(G.pointerId,{x:G.clientX,y:G.clientY}),_.size>=2){let U=F();R>0&&U>0&&E(y*(R/U)),R=U,P=!1;return}P&&(p+=G.clientX-v,b+=G.clientY-w,v=G.clientX,w=G.clientY,A())}},L=G=>{_.delete(G.pointerId),R=_.size===2?F():0;let U=_.values().next().value;P=_.size===1,U?(v=U.x,w=U.y):u.style.cursor="grab";try{u.releasePointerCapture?.(G.pointerId)}catch{}},V=G=>{G.preventDefault(),E(y+G.deltaY*.04)};u.addEventListener("pointerdown",I),u.addEventListener("pointermove",T),u.addEventListener("pointerup",L),u.addEventListener("pointercancel",L),u.addEventListener("wheel",V,{passive:!1});let O=!1,H=!1,j=0,N=()=>{u.removeEventListener("pointerdown",I),u.removeEventListener("pointermove",T),u.removeEventListener("pointerup",L),u.removeEventListener("pointercancel",L),u.removeEventListener("wheel",V),window.removeEventListener("keydown",D)},k=()=>{g(),a.abort(),n.signal?.removeEventListener("abort",s),j&&(window.clearTimeout(j),j=0),N(),c.parentNode&&c.parentNode.removeChild(c),l?.isConnected&&l.focus({preventScroll:!0})},B=()=>{if(O)return;O=!0,c.style.opacity="0";let G=()=>{j=0,!H&&(k(),n.onClose?.())};j=window.setTimeout(G,o)},D=G=>{if(G.key==="Tab"){G.preventDefault(),m.focus({preventScroll:!0});return}if(G.key==="Escape"){G.stopPropagation(),B();return}if(G.key==="ArrowLeft"||G.key==="ArrowRight")p+=G.key==="ArrowLeft"?-32:32;else if(G.key==="ArrowUp"||G.key==="ArrowDown")b+=(G.key==="ArrowUp"?4:-4)*(h/180);else if(G.key==="+"||G.key==="="){E(y-5),G.preventDefault();return}else if(G.key==="-"){E(y+5),G.preventDefault();return}else return;G.preventDefault(),A()};return window.addEventListener("keydown",D),m.addEventListener("click",B),requestAnimationFrame(()=>{c.style.opacity="1"}),{close:B,dispose(){O=!0,H=!0,k()}}}var Qo,Yg,Kg,lt,Jo=xn(()=>{"use strict";Fi();Qo=70,Yg=35,Kg=90;lt=35});function tx(e=Qg,t=Jg,n=ex){let o=e+1,i=t+1,r=o*i,a=new Float32Array(r*3),s=new Float32Array(r*2);for(let u=0;u<i;u++){let m=u/t,f=m*Math.PI,d=Math.sin(f),h=Math.cos(f);for(let p=0;p<o;p++){let b=p/e,y=(b-.5)*Math.PI*2,x=u*o+p;a[x*3]=n*d*Math.sin(y),a[x*3+1]=n*h,a[x*3+2]=-n*d*Math.cos(y),s[x*2]=b,s[x*2+1]=m}}let c=new Uint16Array(e*t*6),l=0;for(let u=0;u<t;u++)for(let m=0;m<e;m++){let f=u*o+m,d=f+o;c[l++]=f,c[l++]=d,c[l++]=f+1,c[l++]=f+1,c[l++]=d,c[l++]=d+1}return{position:a,uv:s,index:c}}function Ju(e,t){let n=e*Math.PI/180,o=t*Math.PI/180,i=Math.cos(o);return[i*Math.sin(n),Math.sin(o),-i*Math.cos(n)]}function em(e,t){let{position:n,uv:o,index:i}=tx(),r=new Et.Geometry(e,{position:{size:3,data:n},uv:{size:2,data:o},index:{data:i}}),a=new Et.Texture(e,{image:t,wrapS:e.CLAMP_TO_EDGE,wrapT:e.CLAMP_TO_EDGE,generateMipmaps:!0,flipY:!1}),s=new Et.Program(e,{vertex:nx,fragment:ox,uniforms:{uPano:{value:a},uOpacity:{value:0}},transparent:!0,depthTest:!1,depthWrite:!1}),c=new Et.Mesh(e,{geometry:r,program:s});return{mesh:c,setOpacity(l){s.uniforms.uOpacity.value=Math.max(0,Math.min(1,l))},setImage(l){a.image=l,a.needsUpdate=!0},dispose(){c.setParent(null),r.remove(),a.texture&&e.deleteTexture(a.texture),s.remove()}}}var Et,Qg,Jg,ex,nx,ox,tm=xn(()=>{"use strict";Et=require("ogl"),Qg=64,Jg=32,ex=500;nx=`#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
|
+
}`,ox=`#version 300 es
|
|
12
12
|
precision highp float;
|
|
13
13
|
in vec2 vUv;
|
|
14
14
|
uniform sampler2D uPano;
|
|
@@ -17,15 +17,30 @@ out vec4 fragColor;
|
|
|
17
17
|
void main() {
|
|
18
18
|
vec3 rgb = texture(uPano, vUv).rgb;
|
|
19
19
|
fragColor = vec4(rgb, uOpacity);
|
|
20
|
-
}`});async function Cu(e,t,n,o={}){let r=o.fadeMs??400,i=t?.initialBearingDeg??0,a=Math.max(-it,Math.min(it,t?.initialPitchDeg??0)),s=zo,c=!1,u=new AbortController,l=()=>u.abort();o.signal?.addEventListener("abort",l,{once:!0});let m=()=>{},h=[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 C=n.camera.position,O=n.focalWorld[0]-C.x,G=n.focalWorld[1]-C.y,j=n.focalWorld[2]-C.z,H=Math.hypot(O,j);H>.001&&(i=Math.atan2(O,-j)*180/Math.PI,a=Math.max(-it,Math.min(it,Math.atan2(G,H)*180/Math.PI)))}let f=null;if(t){let C=n.gl.getParameter(n.gl.MAX_TEXTURE_SIZE),O=Vo(t,Bo(C)),G;try{let j=t.resolveUrl?await t.resolveUrl(O.initialUrl):O.initialUrl;if(!j)throw new Error("panorama_asset_unavailable");G=await Hn(j,u.signal)}catch{return o.signal?.removeEventListener("abort",l),null}try{f=Au(n.gl,G)}catch{return u.abort(),o.signal?.removeEventListener("abort",l),null}f.mesh.renderOrder=999,f.mesh.setParent(n.scene),O.upgradeUrl&&(m=Ho(()=>{(t.resolveUrl?t.resolveUrl(O.upgradeUrl):Promise.resolve(O.upgradeUrl)).then(H=>!H||u.signal.aborted?null:Hn(H,u.signal)).then(H=>{H&&(c||u.signal.aborted||(f?.setImage(H),n.requestRender()))}).catch(()=>{})}))}let d=n.camera.fov;n.camera.perspective({fov:s,aspect:n.camera.aspect});let p=n.camera.quaternion.slice(),b=()=>{let C=n.camera.position;f?.mesh.position.set(C.x,C.y,C.z);let[O,G,j]=Iu(i,a);n.camera.lookAt([C.x+O,C.y+G,C.z+j]),n.requestRender()};b();let g=document.createElement("div"),v=document.activeElement instanceof HTMLElement?document.activeElement:null;g.setAttribute("role","dialog"),g.setAttribute("aria-modal","true"),g.setAttribute("aria-label",o.seatLabel?`View from ${o.seatLabel}`:"View from seat"),g.tabIndex=-1,Object.assign(g.style,{position:"absolute",inset:"0",zIndex:"10",cursor:"grab",touchAction:"none"});let w=document.createElement("button");if(w.type="button",w.setAttribute("aria-label","Close"),w.textContent="\u2715",Object.assign(w.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"}),g.appendChild(w),o.disclosure){let C=document.createElement("div");C.textContent=`${o.disclosurePrefix??"360\xB0 panorama"} \xB7 ${o.disclosure}`,Object.assign(C.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)"}),g.appendChild(C)}let R=document.createElement("div");R.textContent=gi(o.lookAroundHint),Object.assign(R.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"}),g.appendChild(R),e.appendChild(g),w.focus({preventScroll:!0});let M=!1,y=0,P=0,x=0,S=new Map,A=()=>{let[C,O]=[...S.values()];return C&&O?Math.hypot(C.x-O.x,C.y-O.y):0},_=C=>{let O=yi(C);O!==s&&(s=O,n.camera.perspective({fov:s,aspect:n.camera.aspect}),b())},D=C=>{C.target!==w&&(S.set(C.pointerId,{x:C.clientX,y:C.clientY}),M=S.size===1,y=C.clientX,P=C.clientY,S.size===2&&(x=A()),g.setPointerCapture?.(C.pointerId),g.style.cursor="grabbing")},E=C=>{if(S.has(C.pointerId)){if(S.set(C.pointerId,{x:C.clientX,y:C.clientY}),S.size>=2){let O=A();x>0&&O>0&&_(s*(x/O)),x=O,M=!1;return}M&&(i+=(C.clientX-y)*Eu,a=Math.max(-it,Math.min(it,a+(C.clientY-P)*Eu)),y=C.clientX,P=C.clientY,b())}},I=C=>{S.delete(C.pointerId),x=S.size===2?A():0;let O=S.values().next().value;M=S.size===1,O?(y=O.x,P=O.y):g.style.cursor="grab";try{g.releasePointerCapture?.(C.pointerId)}catch{}},k=C=>{C.preventDefault(),_(s+C.deltaY*.04)};g.addEventListener("pointerdown",D),g.addEventListener("pointermove",E),g.addEventListener("pointerup",I),g.addEventListener("pointercancel",I),g.addEventListener("wheel",k,{passive:!1});let L=C=>{if(!c){if(C.key==="Tab"){C.preventDefault(),w.focus({preventScroll:!0});return}if(C.key==="Escape"){C.stopPropagation(),N.close();return}if(C.key==="ArrowLeft"||C.key==="ArrowRight")i+=C.key==="ArrowLeft"?-4:4;else if(C.key==="ArrowUp"||C.key==="ArrowDown")a=Math.max(-it,Math.min(it,a+(C.key==="ArrowUp"?4:-4)));else if(C.key==="+"||C.key==="="){_(s-5),C.preventDefault();return}else if(C.key==="-"){_(s+5),C.preventDefault();return}else return;C.preventDefault(),b()}};window.addEventListener("keydown",L);let B=0,F=(C,O)=>{if(!f){O?.();return}let G=C===1?0:1,j=performance.now(),H=()=>{if(c)return;let z=r<=0?1:Math.min(1,(performance.now()-j)/r);f?.setOpacity(G+(C-G)*z),n.requestRender(),z<1?B=requestAnimationFrame(H):O?.()};B=requestAnimationFrame(H)};F(1);let V=()=>{c||(c=!0,m(),u.abort(),o.signal?.removeEventListener("abort",l),cancelAnimationFrame(B),g.removeEventListener("pointerdown",D),g.removeEventListener("pointermove",E),g.removeEventListener("pointerup",I),g.removeEventListener("pointercancel",I),g.removeEventListener("wheel",k),window.removeEventListener("keydown",L),g.remove(),v?.isConnected&&v.focus({preventScroll:!0}),f?.dispose(),n.camera.position.set(h[0],h[1],h[2]),n.camera.perspective({fov:d,aspect:n.camera.aspect}),n.camera.quaternion.set(p[0],p[1],p[2],p[3]),n.requestRender())},N={close(){if(c)return;let C=()=>{V(),o.onClose?.()};cancelAnimationFrame(B),F(0,C)},dispose:V};return w.addEventListener("click",()=>N.close()),N}var Eu,_u=un(()=>{"use strict";Ru();Uo();Uo();bi();Eu=.15});var Tu={};Di(Tu,{createOpenPanorama:()=>q0});function q0(e){let{container:t,model:n,opts:o,analytics:r,orbit:i,loop:a,seatsById:s,ensureSeatView:c,resolvedSeatViewPose:u,gpu:l,gl:m,isContextLost:h,isDisposed:f,flightGen:d,setPanorama:p,getLoadAbort:b,setLoadAbort:g,setPanoramaSphereVisible:v,setFrozen:w,raisePanoramaLayer:R,restorePanoramaLayer:M,getOverviewChip:y,labelOverlay:P,reducedMotion:x,removeArriveChip:S,showArriveChip:A}=e;return async(_,D,E)=>{b()?.abort();let I=new AbortController;g(I);let k=n.seats.idToIndex.get(_);if(k===void 0){i.syncFromCamera();return}let L=s.get(_)?.label??_,B=u(_,k),F=c(_);if(!F){I.abort(),b()===I&&g(null),i.syncFromCamera();return}w(!0),a.stop();let V;try{V=await F}catch{if(b()===I&&g(null),r.panoramaFailed(_,"source"),!f()&&E===d()){w(!1),i.resumeAfterFlight(B.focal),a.requestRender();let $=A(_,E,!0);requestAnimationFrame(()=>$?.querySelector("[data-panorama-trigger]")?.focus())}return}if(f()||E!==d()){I.abort(),b()===I&&g(null);return}S();let N=y(),C=()=>{I.abort(),b()===I&&g(null),p(null),v(!1),M(),N.style.display="",P.setVisible(!o.arriveAtSeatEye),w(!1),r.panoramaClosed(),i.resumeAfterFlight(B.focal),a.requestRender();let $=A(_,d());requestAnimationFrame(()=>$?.querySelector("[data-panorama-trigger]")?.focus())},O=V.generated===!0,G=wu(V);R(),v(!O),N.style.display="none";let j=x()?0:D,H=l(),z=H&&!h()?await Cu(t,O?null:V,{gl:m,scene:H.main,camera:i.camera,requestRender:()=>a.requestRender(),cameraOriginWorld:O?B.eye:void 0,focalWorld:B.focal},{fadeMs:j,seatLabel:L,disclosure:G,disclosurePrefix:O?"Live 3D view":"360\xB0 panorama",lookAroundHint:o.lookAroundHint,onClose:C,signal:I.signal}):null;if(f()||E!==d()){I.abort(),v(!1),b()===I&&g(null),z?.dispose(),N.style.display="",M();return}if(z)i.syncFromCamera(),P.setVisible(!1),w(!1),a.requestRender(),p(z);else if(O){M(),N.style.display="",w(!1),i.resumeAfterFlight(B.focal),a.requestRender(),p(null),v(!1),r.panoramaFailed(_,"mount");let $=A(_,d(),!0);requestAnimationFrame(()=>$?.querySelector("[data-panorama-trigger]")?.focus()),b()===I&&g(null);return}else v(!1),r.panoramaFallback(_),p(Pu(t,V,{fadeMs:j,seatLabel:L,disclosure:G,onClose:C,signal:I.signal,lookAroundHint:o.lookAroundHint}));r.panoramaOpened()}}var ku=un(()=>{"use strict";Uo();_u()});var dg={};Di(dg,{VENUE3D_QUALITY_REPORT_VERSION:()=>Pl,autoVenue3d:()=>Ro,buildSceneModel:()=>Qt,estimateVenue3D:()=>Gn,inspectVenue3DQualityEvidence:()=>To,mountVenue3D:()=>fg,prepareVenue3D:()=>Ku,prepareVenue3DFromChart:()=>$u});module.exports=dm(dg);function Bi(e,t,n){let o=Math.floor(t.length/3),r=n.center[0],i=n.center[2];if(o>0){let c=Math.max(1,Math.floor(o/4e3)),u=0,l=0,m=0;for(let h=0;h<o;h+=c)u+=t[h*3],l+=t[h*3+2],m++;r=u/m,i=l/m}let a=e[0]-r,s=e[2]-i;return Math.hypot(a,s)>n.radius*.12?Math.atan2(a,s):void 0}var qu=require("ogl");function Vi(e,t,n="#ffffff"){let{iPosition:o,count:r}=t.seats;if(r<2||typeof document>"u")return null;let i=1/0,a=-1/0,s=1/0,c=-1/0;for(let M=0;M<r;M++){let y=o[M*3],P=o[M*3+2];y<i&&(i=y),y>a&&(a=y),P<s&&(s=P),P>c&&(c=P)}for(let M of t.stages)i=Math.min(i,M.cx-M.halfX),a=Math.max(a,M.cx+M.halfX),s=Math.min(s,M.cz-M.halfZ),c=Math.max(c,M.cz+M.halfZ);let u=Math.min(130/Math.max(.001,a-i),86/Math.max(.001,c-s)),l=(148-(a-i)*u)/2,m=(104-(c-s)*u)/2,h=M=>l+(M-i)*u,f=M=>m+(M-s)*u,d=Math.min(2,typeof window<"u"&&window.devicePixelRatio||1),p=document.createElement("canvas");p.width=Math.round(148*d),p.height=Math.round(104*d),p.setAttribute("aria-hidden","true"),p.setAttribute("data-seat-locator","");let b=p.style;b.position="absolute",b.left="12px",b.bottom="12px",b.width="148px",b.height="104px",b.borderRadius="10px",b.background="rgba(10,14,22,.72)",b.border="1px solid rgba(255,255,255,.14)",b.boxShadow="0 4px 14px rgba(0,0,0,.35)",b.pointerEvents="none",b.zIndex="3",b.display="none",e.appendChild(p);let g=document.createElement("canvas");g.width=p.width,g.height=p.height;let v=g.getContext("2d");if(v){v.scale(d,d),v.fillStyle="rgba(214,222,234,.28)";let M=Math.max(1,Math.ceil(r/6e3));for(let y=0;y<r;y+=M)v.fillRect(h(o[y*3])-.6,f(o[y*3+2])-.6,1.2,1.2);v.fillStyle="rgba(236,240,246,.16)",v.strokeStyle="rgba(236,240,246,.55)",v.lineWidth=1;for(let y of t.stages){let P=h(y.cx-y.halfX),x=f(y.cz-y.halfZ),S=y.halfX*2*u,A=y.halfZ*2*u;v.fillRect(P,x,S,A),v.strokeRect(P+.5,x+.5,Math.max(0,S-1),Math.max(0,A-1))}}let w=p.getContext("2d"),R="";return{el:p,update(M,y){if(!M||!w||e.clientWidth>0&&e.clientWidth<560){b.display!=="none"&&(b.display="none"),R="";return}let P=h(M[0]),x=f(M[2]),S=y?Math.atan2(y[2],y[0]):0,A=`${P.toFixed(1)},${x.toFixed(1)},${S.toFixed(2)}`;if(A!==R){if(R=A,b.display="block",w.setTransform(1,0,0,1,0,0),w.clearRect(0,0,p.width,p.height),w.drawImage(g,0,0),w.setTransform(d,0,0,d,0,0),y){let _=w.createRadialGradient(P,x,0,P,x,26);_.addColorStop(0,"rgba(255,255,255,.55)"),_.addColorStop(1,"rgba(255,255,255,0)"),w.fillStyle=_,w.beginPath(),w.moveTo(P,x),w.arc(P,x,26,S-.5,S+.5),w.closePath(),w.fill()}w.fillStyle=n,w.strokeStyle="rgba(10,14,22,.9)",w.lineWidth=1.5,w.beginPath(),w.arc(P,x,3.6,0,Math.PI*2),w.fill(),w.stroke()}},dispose(){p.remove()}}}var Se={pedestal:0,pad:1,back:2,arm:3,footrest:4,leg:5,body:10,head:11},hm=.44,pm=.15,Hi=.3,bm=.24;function Gi(e){return e===void 0||!Number.isFinite(e)||e<=0?bm:Math.min(Hi,Math.max(pm,e*hm))}var fn=.21,ym=.05,or=.45,pt=or+ym,dn=.92,mn=.66,rr=1.205,zi=-.23,Ui=.38,gm=[{part:Se.pedestal,min:[-.3,0,-.3],max:[.3,.36,.3]},{part:Se.pad,min:[-1,.36,-.95],max:[1,or,1]},{part:Se.back,min:[-1,pt,-1],max:[1,dn,-.72]},{part:Se.arm,min:[-1,.44,-.82],max:[-.78,.65,.78]},{part:Se.arm,min:[.78,.44,-.82],max:[1,.65,.78]},{part:Se.footrest,min:[-.9,.18,.78],max:[.9,.31,1.34]},{part:Se.leg,min:[-.82,0,-.7],max:[-.62,.37,-.48]},{part:Se.leg,min:[.62,0,-.7],max:[.82,.37,-.48]},{part:Se.leg,min:[-.82,0,.48],max:[-.62,.37,.7]},{part:Se.leg,min:[.62,0,.48],max:[.82,.37,.7]}],xm=[{part:Se.body,min:[-.52,.39,-.08],max:[-.08,.55,.82]},{part:Se.body,min:[.08,.39,-.08],max:[.52,.55,.82]},{part:Se.body,min:[-.47,.05,.58],max:[-.13,.43,.82]},{part:Se.body,min:[.13,.05,.58],max:[.47,.43,.82]},{part:Se.head,min:[-.16,1.04,-.33],max:[.16,1.1,-.13]}],vm=[{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 ji(){let e=[],t=[],n=[],o=[],r=(L,B,F)=>{let V=n.length,[N,C,O]=L,G=[C[0]-N[0],C[1]-N[1],C[2]-N[2]],j=[O[0]-N[0],O[1]-N[1],O[2]-N[2]],H=G[1]*j[2]-G[2]*j[1],z=G[2]*j[0]-G[0]*j[2],$=G[0]*j[1]-G[1]*j[0],Q=Math.hypot(H,z,$);Q>1e-9?(H/=Q,z/=Q,$/=Q):[H,z,$]=B,H*B[0]+z*B[1]+$*B[2]<0&&(H=-H,z=-z,$=-$);for(let ae of L)e.push(...ae),t.push(H,z,$),n.push(F);o.push(V,V+1,V+2,V,V+2,V+3)},i=L=>{for(let B of vm){let F=B.c.map(V=>V.map((N,C)=>N?L.max[C]:L.min[C]));r(F,B.n,L.part)}},a=(L,B)=>{let[F,V,N]=B?[0,1,2]:[0,2,1],C=L.min[F],O=L.max[F],G=L.min[V],j=L.max[V],H=(O-C)*.1,z=(j-G)*.1,$=B?[[C+H,G],[O-H,G],[O,G+z],[O*.94,j-(j-G)*.23],[O*mn,j],[C*mn,j],[C*.94,j-(j-G)*.23],[C,G+z]]:[[C+H,G],[O-H,G],[O,G+z],[O,j-z],[O-H,j],[C+H,j],[C,j-z],[C,G+z]],Q=(q,W,Y)=>{let K=[0,0,0];return K[F]=q,K[V]=W,K[N]=Y,K},ae=[L.min[N],L.max[N]].map(q=>$.map(([W,Y])=>Q(W,Y,q)));for(let q=0;q<$.length;q++){let W=(q+1)%$.length,Y=[0,0,0];Y[F]=($[q][0]+$[W][0])/2-(C+O)/2,Y[V]=($[q][1]+$[W][1])/2-(G+j)/2,r([ae[0][q],ae[0][W],ae[1][W],ae[1][q]],Y,L.part)}for(let q=0;q<2;q++){let W=[0,0,0];W[N]=q?1:-1;let Y=ae[q];for(let K=1;K<Y.length-1;K++){let ne=n.length;for(let ee of[Y[0],Y[K],Y[K+1]])e.push(...ee),t.push(...W),n.push(L.part);o.push(ne,ne+1,ne+2)}}};for(let L of gm)L.part===Se.pad||L.part===Se.back?a(L,L.part===Se.back):i(L);for(let L of xm)i(L);let s=or,c=1.08,u=.47,l=.69,m=-.55,h=.08,f=-.48,d=.01,p=[-u,s,m],b=[u,s,m],g=[-u,s,h],v=[u,s,h],w=[-l,c,f],R=[l,c,f],M=[-l,c,d],y=[l,c,d];r([b,R,y,v],[1,0,0],Se.body),r([g,M,w,p],[-1,0,0],Se.body),r([M,y,R,w],[0,1,0],Se.body),r([p,b,v,g],[0,-1,0],Se.body),r([v,y,M,g],[0,0,1],Se.body),r([p,w,R,b],[0,0,-1],Se.body);let P=10,x=8,S=[0,rr,zi],A=[.42,.115,Ui],_=n.length;for(let L=0;L<=x;L++){let B=Math.PI*L/x,F=Math.cos(B),V=Math.sin(B);for(let N=0;N<=P;N++){let C=Math.PI*2*N/P,O=V*Math.cos(C),G=V*Math.sin(C);e.push(S[0]+A[0]*O,S[1]+A[1]*F,S[2]+A[2]*G);let j=O/A[0],H=F/A[1],z=G/A[2],$=Math.hypot(j,H,z)||1;j/=$,H/=$,z/=$,t.push(j,H,z),n.push(Se.head)}}for(let L=0;L<x;L++)for(let B=0;B<P;B++){let F=_+L*(P+1)+B,V=F+P+1;o.push(F,V,F+1,F+1,V,V+1)}let D=new Float32Array(e),E=new Float32Array(t),I=new Float32Array(n),k=new Uint16Array(o);return{position:D,normal:E,part:I,index:k,vertexCount:n.length,indexCount:o.length}}function Xi(e,t,n,o){let r=new Float32Array(t),i=u=>e[u*3],a=u=>e[u*3+2],s=0,c=(u,l)=>{let m=l-u;for(let h=u;h<l;h++){let[f,d]=o(h),p=f-i(h),b=d-a(h);if(m>=2){let g=Math.max(u,h-1),v=Math.min(l-1,h+1),w=i(v)-i(g),R=a(v)-a(g),M=Math.hypot(w,R);if(M>1e-6){let y=-R/M,P=w/M;y*p+P*b<0&&(y=-y,P=-P),p=y,b=P}}r[h]=p===0&&b===0?0:Math.atan2(p,b)}};for(let u=1;u<=t;u++)(u===t||n(u)!==n(s))&&(c(s,u),s=u);return r}var ir=78,Wi=18;function Yi(){let e=[],t=[],n=[],o=[],r=[],i=[{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]]}];for(let s of[{part:1,min:[-1,.36,-.95],max:[1,.45,1]},{part:2,min:[-1,pt,-1],max:[1,dn,-.72]}])for(let c of i){let u=e.length/3,l=c.n[1]+(s.part===2?Math.abs(c.n[0])*(1-mn)/(dn-pt):0),m=Math.hypot(c.n[0],l,c.n[2]),h=[c.n[0]/m,l/m,c.n[2]/m];for(let[f,d]of c.c.entries()){let p=d.map((b,g)=>s.min[g]+b*(s.max[g]-s.min[g]));s.part===2&&(p[0]*=1-d[1]*(1-mn)),e.push(...p),t.push(...h),n.push(s.part),o.push(...[[-1,-1],[1,-1],[1,1],[-1,1]][f])}r.push(u,u+1,u+2,u,u+2,u+3)}let a=e.length/3;for(let[s,c]of[[-1,-1],[1,-1],[1,1],[-1,1]])e.push(s,c,0),t.push(0,1,0),n.push(0),o.push(s,c);return r.push(a,a+1,a+2,a,a+2,a+3),r.push(...r.slice(12,18),...r.slice(60,66),...r.slice(72,78)),{position:new Float32Array(e),normal:new Float32Array(t),surface:new Float32Array(n),uv:new Float32Array(o),index:new Uint16Array(r)}}var Ji=require("ogl");var Mm=/^#?([\da-f]{3}|[\da-f]{6})$/i;function Ki(e){let t=e.replace("#","");return{r:parseInt(t.slice(0,2),16),g:parseInt(t.slice(2,4),16),b:parseInt(t.slice(4,6),16)}}function Sm(e){let t=Mm.exec((e??"").trim());if(!t)return null;let n=t[1].length===3?t[1].split("").map(r=>r+r).join(""):t[1],o=parseInt(n,16);return[o>>16&255,o>>8&255,o&255]}function he(e){let t=Sm(e);return t?[t[0]/255,t[1]/255,t[2]/255]:null}function ar(e){let t=e/255;return t<=.04045?t/12.92:((t+.055)/1.055)**2.4}function wm(e){return .2126*ar(e[0])+.7152*ar(e[1])+.0722*ar(e[2])}function $i(e){return wm([e[0]*255,e[1]*255,e[2]*255])}function Pm(e){return .2126*e[0]+.7152*e[1]+.0722*e[2]}function pe(e,t,n){return[e[0]+(t[0]-e[0])*n,e[1]+(t[1]-e[1])*n,e[2]+(t[2]-e[2])*n]}function Ke(e,t){let n=Pm(e);return pe(e,[n,n,n],t)}function qi({r:e,g:t,b:n}){let o=e/255,r=t/255,i=n/255,a=Math.max(o,r,i),s=Math.min(o,r,i),c=(a+s)/2;if(a===s)return{h:0,s:0,l:c};let u=a-s,l=c>.5?u/(2-a-s):u/(a+s),m;return a===o?m=((r-i)/u+(r<i?6:0))/6:a===r?m=((i-o)/u+2)/6:m=((o-r)/u+4)/6,{h:m,s:l,l:c}}var _e=["available","held","sold","selected","dimmed"];function hn(e){let t=_e.indexOf(e);return t<0?0:t}var Zi={available:[.24,.82,.52],held:[.34,.39,.45],sold:[.34,.39,.45],selected:[.24,.74,1],dimmed:[.28,.32,.37]};function Qi(e){let t=.2126*e[0]+.7152*e[1]+.0722*e[2],n=.78,o=.86;return[(t+(e[0]-t)*n)*o,(t+(e[1]-t)*n)*o,(t+(e[2]-t)*n)*o]}var sr={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]},Et={top:[.05,.06,.08],bottom:[.1,.12,.15]};function se(e,t){return[Math.min(1,e[0]*t),Math.min(1,e[1]*t),Math.min(1,e[2]*t)]}function Im(){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 Kn=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 Ji.Renderer({canvas:this.canvas,dpr:Im(),alpha:!1,antialias:!1,depth:!0,stencil:!1,powerPreference:"high-performance",webgl:2}),this.gl=this.renderer.gl,this.clearRgb=[Et.top[0],Et.top[1],Et.top[2]],this.gl.clearColor(this.clearRgb[0],this.clearRgb[1],this.clearRgb[2],1),t.appendChild(this.canvas),this.lostHandler=o=>{o.preventDefault(),n.onContextLost()},this.restoredHandler=()=>n.onContextRestored(),this.canvas.addEventListener("webglcontextlost",this.lostHandler,!1),this.canvas.addEventListener("webglcontextrestored",this.restoredHandler,!1),this.resize()}setClearColor(t){this.clearRgb=[t[0],t[1],t[2]],this.gl.clearColor(t[0],t[1],t[2],1)}get clearColor(){return this.clearRgb}resize(){let t=Math.max(1,this.container.clientWidth||this.canvas.clientWidth||1),n=Math.max(1,this.container.clientHeight||this.canvas.clientHeight||1);return this.renderer.setSize(t,n),{width:t,height:n}}get pixelHeight(){return this.renderer.height*this.renderer.dpr}get aspect(){return this.renderer.width/Math.max(1,this.renderer.height)}dispose(){this.canvas.removeEventListener("webglcontextlost",this.lostHandler,!1),this.canvas.removeEventListener("webglcontextrestored",this.restoredHandler,!1);let t=this.gl.getExtension("WEBGL_lose_context");t&&t.loseContext(),this.canvas.parentNode&&this.canvas.parentNode.removeChild(this.canvas)}simulateContextLossCycle(){let t=this.gl.getExtension("WEBGL_lose_context");t&&(t.loseContext(),setTimeout(()=>{t.restoreContext&&t.restoreContext()},300))}};var Nt=require("ogl"),Ce=Math.PI/180,cr=15*Ce,lr=80*Ce,Dt=.12,ea=35,ur=1.25,ta=.006,Am=4,Bt=.82,pn=1/Bt,Rm=.12,Em=2;function Cm(e,t){return{azimuth:e*ta,polar:-t*ta}}function _m(e,t,n){if(!n)return 1;let o=t[0]-e[0],r=t[2]-e[2];return(n[0]-t[0])*o+(n[2]-t[2])*r<0?-1:1}function na(e,t,n){let o=Math.max(Em,Math.max(1,t)*Rm),r=n*Am;return{minDist:e?Math.min(e.minDist,o):o,maxDist:e?Math.max(e.maxDist,r):r}}var Tm=1.5;function km(e,t,n){let o=Math.max(1,n)*Tm;if(!e)return{anchor:[t[0],t[1],t[2]],limit:o};let[r,i,a]=e.anchor,s=t[1]-i,c=Math.max(Math.abs(t[0]-r),Math.abs(t[2]-a),s>=0?s:-s*2);return{anchor:e.anchor,limit:Math.max(e.limit,c+o)}}function oa(e,t,n,o,r,i,a,s){let c=Math.sin(n),u=[c*Math.sin(t),Math.cos(n),c*Math.cos(t)],l=[e[0]+o*u[0],e[1]+o*u[1],e[2]+o*u[2]],m=[-u[0],-u[1],-u[2]],h=[-m[2],0,m[0]],f=Math.hypot(h[0],h[2])||1;h=[h[0]/f,0,h[2]/f];let d=[h[1]*m[2]-h[2]*m[1],h[2]*m[0]-h[0]*m[2],h[0]*m[1]-h[1]*m[0]],p=Math.tan(r*Ce/2),b=p*(i>0?i:1),g=[0,1,2].map(R=>m[R]+a*b*h[R]+s*p*d[R]);if(g[1]>=-1e-6)return null;let v=(e[1]-l[1])/g[1],w=Math.hypot(g[0],g[1],g[2]);return!(v>0)||v*w>o*Lm?null:[l[0]+g[0]*v,e[1],l[2]+g[2]*v]}var ra=3,Lm=4,ia=.72;function aa(e,t){let n=Math.sin(t),o=-n*Math.sin(e),r=-Math.cos(t),i=-n*Math.cos(e);if(Math.abs(r)>.999)return null;let a=-i,s=o,c=Math.hypot(a,s);return a/=c,s/=c,{fx:o,fy:r,fz:i,rx:a,rz:s,ux:-s*r,uy:s*o-a*i,uz:a*r}}var Om=.4;function Fm(e,t,n,o,r,i){let a=[e.center[0],e.center[1],e.center[2]],s=i(a),c=e.fitPoints,u=aa(o,r);if(!c||c.length<9||!u)return{center:a,distance:s};let{fx:l,fy:m,fz:h,rx:f,rz:d,ux:p,uy:b,uz:g}=u,v=Math.hypot(l,h),w=l/v,R=h/v,M=w*p+R*g,y=Om*Math.max(1,e.radius);for(let P=0;P<3;P++){let x=1/0,S=-1/0,A=1/0,_=-1/0;for(let B=0;B+2<c.length;B+=3){let F=c[B]-a[0],V=c[B+1]-a[1],N=c[B+2]-a[2],C=s+F*l+V*m+N*h;if(!(C>.001))continue;let O=(F*f+N*d)/(C*t),G=(F*p+V*b+N*g)/(C*n);O<x&&(x=O),O>S&&(S=O),G<A&&(A=G),G>_&&(_=G)}if(!Number.isFinite(x))break;let D=(x+S)/2*s*t,E=Math.abs(M)>.1?(A+_)/2*s*n/M:0,I=D*f+E*w,k=D*d+E*R;if(Math.hypot(a[0]+I-e.center[0],a[2]+k-e.center[2])>y){let B=a[0]-e.center[0],F=a[2]-e.center[2],V=B+I,N=F+k,C=y/Math.hypot(V,N);I=V*C-B,k=N*C-F}a=[a[0]+I,a[1],a[2]+k],s=i(a)}return{center:a,distance:s}}var $n=class{constructor(t,n,o,r){this.fovY=ea;this.target=new Nt.Vec3;this.azimuth=-30*Ce;this.polar=55*Ce;this.distance=10;this.azT=-30*Ce;this.polT=55*Ce;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 Nt.Vec3;this.panAnchor=new Nt.Vec3;this.panLimit=0;this.panBox=null;this.grabSign=1;this.zoomPointResolver=null;this.primaryDragMode="orbit";this.camera=new Nt.Camera(t,{fov:ea,near:.1,far:5e3,aspect:1}),this.canvas=n,this.requestRender=o,this.onGesture=r,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.dragging&&(this.grabSign=this.grabSignAt(i.clientX,i.clientY)),this.lastX=i.clientX,this.lastY=i.clientY}else if(this.activePointers.size===2){this.dragging=!1,this.panning=!1,this.pinchDist=this.currentPinchDistance();let a=this.pinchCentroid();this.pinchCx=a.x,this.pinchCy=a.y}}},this.onPointerMove=i=>{if(!this.interactionEnabled||!this.activePointers.has(i.pointerId))return;if(this.activePointers.set(i.pointerId,{x:i.clientX,y:i.clientY}),this.activePointers.size>=2){let u=this.currentPinchDistance(),l=this.pinchCentroid();this.pinchDist>0&&(this.dollyAt(Math.exp((this.pinchDist-u)*.005),l.x,l.y),this.fireGesture()),this.pinchDist=u,this.panBy(l.x-this.pinchCx,l.y-this.pinchCy),this.pinchCx=l.x,this.pinchCy=l.y;return}let a=i.clientX-this.lastX,s=i.clientY-this.lastY;if(this.panning){this.lastX=i.clientX,this.lastY=i.clientY,(a!==0||s!==0)&&(this.panBy(a,s),this.fireGesture());return}if(!this.dragging)return;this.lastX=i.clientX,this.lastY=i.clientY,(a!==0||s!==0)&&this.fireGesture();let c=Cm(a,s);this.azT+=c.azimuth*this.grabSign,this.polT=Math.max(cr,Math.min(lr,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.dollyAt(Math.exp(s*.22),i.clientX,i.clientY),this.fireGesture()},this.onKeyDown=i=>{if(!this.interactionEnabled)return;let a=7*Ce;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(cr,Math.min(lr,this.polT+(i.key==="ArrowUp"?-a:a)));else if(i.key==="+"||i.key==="=")this.dollyBy(Bt);else if(i.key==="-"||i.key==="_")this.dollyBy(pn);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,o=0;for(let r of t)n+=r.x,o+=r.y;return{x:n/t.length,y:o/t.length}}panBy(t,n){let o=this.canvas.clientHeight||1,r=2*this.distance*Math.tan(this.fovY*Ce/2)/o,i=Math.sin(this.azimuth),a=Math.cos(this.azimuth),s=a,c=-i,u=Math.cos(this.polar),l=Math.sin(this.polar),m=-i*u,h=-a*u;this.targetT.x+=(-t*s+n*m)*r,this.targetT.z+=(-t*c+n*h)*r,this.targetT.y+=n*l*r,this.clampPan(),this.requestRender()}widenPanBox(t){this.panBox=km(this.panBox,t.center,t.radius),this.panAnchor.set(this.panBox.anchor[0],this.panBox.anchor[1],this.panBox.anchor[2]),this.panLimit=this.panBox.limit}clampPan(){if(this.panLimit<=0)return;let t=this.panLimit,n=this.panAnchor.x,o=this.panAnchor.y,r=this.panAnchor.z;this.targetT.x=Math.max(n-t,Math.min(n+t,this.targetT.x)),this.targetT.z=Math.max(r-t,Math.min(r+t,this.targetT.z)),this.targetT.y=Math.max(o-t*.5,Math.min(o+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()}dollyAt(t,n,o){let r=this.distT,i=this.canvas.getBoundingClientRect?.(),a=this.zoomPointResolver?.(n,o)??null;if(a){this.distT=Math.max(ra,Math.min(this.maxDist,this.distT*t)),this.minDist=Math.min(this.minDist,Math.max(ra,this.distT)),this.requestRender(),this.scaleTargetAbout(a,this.distT/r);return}let s=i&&i.width>0&&i.height>0?oa([this.targetT.x,this.targetT.y,this.targetT.z],this.azT,this.polT,this.distT,this.fovY,this.camera.aspect||i.width/i.height,(n-i.left)/i.width*2-1,1-(o-i.top)/i.height*2):null;this.dollyBy(t),s&&this.scaleTargetAbout(s,this.distT/r)}scaleTargetAbout(t,n){!Number.isFinite(n)||n===1||(this.targetT.x=t[0]+(this.targetT.x-t[0])*n,this.targetT.y=t[1]+(this.targetT.y-t[1])*n,this.targetT.z=t[2]+(this.targetT.z-t[2])*n,this.clampPan())}grabSignAt(t,n){let o=this.canvas.getBoundingClientRect?.(),r=this.zoomPointResolver?.(t,n)??(o&&o.width>0&&o.height>0?oa([this.target.x,this.target.y,this.target.z],this.azimuth,this.polar,this.distance,this.fovY,this.camera.aspect||o.width/o.height,(t-o.left)/o.width*2-1,1-(n-o.top)/o.height*2):null),i=this.camera.position;return _m([i.x,i.y,i.z],[this.target.x,this.target.y,this.target.z],r)}setZoomPointResolver(t){this.zoomPointResolver=t}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,o,r=!1,i){this.camera.perspective({fov:this.fovY,aspect:this.camera.aspect}),this.target.set(t.center[0],t.center[1],t.center[2]),this.targetT.copy(this.target),this.widenPanBox(t);let a=Math.max(1,t.radius),s=this.fovY*Ce/2,c=r?Math.max(.82,this.camera.aspect||1):this.camera.aspect||1,u=Math.atan(Math.tan(s)*c);this.azT=o??-30*Ce,this.polT=Math.max(15,Math.min(80,i?.polarDeg??55))*Ce;let l=this.framedOn(t,s,u),m=l.distance;this.target.set(l.center[0],l.center[1],l.center[2]),this.targetT.copy(this.target),this.distT=m*Math.max(1.05,Math.min(2,i?.margin??ur)),this.envelope=na(this.envelope,a,m),this.minDist=this.envelope.minDist,this.maxDist=this.envelope.maxDist,n?(this.azimuth=this.azT,this.polar=12*Ce,this.distance=this.distT*1.7):(this.azimuth=this.azT,this.polar=this.polT,this.distance=this.distT),this.applyPosition()}setAspect(t){if(!(t>0)||!Number.isFinite(t))return;let n=this.camera.aspect;if(this.interactionEnabled&&n>0){let o=Math.min(n,1)/Math.min(t,1);this.distance*=o,this.distT*=o,this.maxDist=Math.max(this.maxDist,this.distance,this.distT),this.applyPosition()}this.camera.perspective({aspect:t})}glideTo(t,n){this.syncFromCamera(),this.camera.perspective({fov:this.fovY,aspect:this.camera.aspect}),this.widenPanBox(t),this.targetT.set(t.center[0],t.center[1],t.center[2]);let o=this.fovY*Ce/2,r=Math.atan(Math.tan(o)*(this.camera.aspect||1));this.azT=this.azimuth,this.polT=Math.max(15,Math.min(80,n?.polarDeg??55))*Ce;let i=this.framedOn(t,o,r),a=i.distance;this.targetT.set(i.center[0],i.center[1],i.center[2]),this.distT=a*Math.max(1.05,Math.min(2,n?.margin??ur)),this.envelope=na(this.envelope,Math.max(1,t.radius),a),this.minDist=this.envelope.minDist,this.maxDist=this.envelope.maxDist,this.requestRender()}frameSoft(t,n,o=!1,r){this.target.set(t.center[0],t.center[1],t.center[2]),this.targetT.copy(this.target),this.widenPanBox(t),this.syncFromCamera(),this.camera.perspective({fov:this.fovY,aspect:this.camera.aspect});let i=this.fovY*Ce/2,a=o?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,r?.polarDeg??55))*Ce;let c=this.framedOn(t,i,s);this.targetT.set(c.center[0],c.center[1],c.center[2]),this.distT=c.distance*Math.max(1.05,Math.min(2,r?.margin??ur))}framedOn(t,n,o){return Fm(t,Math.tan(o),Math.tan(n),this.azT,this.polT,r=>this.fitDistance({...t,center:r},n,o,this.azT,this.polT))}fitDistance(t,n,o,r,i){let a=Math.max(1,t.radius),s=Math.max(a/Math.tan(n),a/Math.tan(o)),c=t.box;if(!c)return s;let u=aa(r,i);if(!u)return s;let{fx:l,fy:m,fz:h,rx:f,rz:d,ux:p,uy:b,uz:g}=u,v=Math.tan(o),w=Math.tan(n),R=1;for(let A=0;A<8;A++){let _=(A&1?c.max[0]:c.min[0])-t.center[0],D=(A&2?c.max[1]:c.min[1])-t.center[1],E=(A&4?c.max[2]:c.min[2])-t.center[2],I=_*l+D*m+E*h,k=Math.abs(_*f+E*d),L=Math.abs(_*p+D*b+E*g);R=Math.max(R,k/v-I,L/w-I)}let M=Math.min(s,Math.max(R,a*.35)),y=t.fitPoints;if(!y||y.length<9)return M;let P=0,x=1/(v*ia),S=1/(w*ia);for(let A=0;A+2<y.length;A+=3){let _=y[A]-t.center[0],D=y[A+1]-t.center[1],E=y[A+2]-t.center[2],I=_*l+D*m+E*h,k=Math.abs(_*f+E*d),L=Math.abs(_*p+D*b+E*g);P=Math.max(P,k*x-I,L*S-I)}return Math.min(M*1.5,Math.max(M*.55,P))}updateClipping(t){let n=this.camera.position.x-t.center[0],o=this.camera.position.y-t.center[1],r=this.camera.position.z-t.center[2],i=Math.hypot(this.camera.position.x-this.target.x,this.camera.position.y-this.target.y,this.camera.position.z-this.target.z),a=this.interactionEnabled&&Math.abs(i-this.distance)<=this.distance*.01,{near:s,far:c}=Bm(Math.hypot(n,o,r),t.radius,a?this.distance:null);this.camera.perspective({near:s,far:c,aspect:this.camera.aspect})}update(){let t=this.azT-this.azimuth,n=this.polT-this.polar,o=this.distT-this.distance,r=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(o)>1e-4||Math.abs(r)>s||Math.abs(i)>s||Math.abs(a)>s;return this.azimuth+=t*Dt,this.polar+=n*Dt,this.distance+=o*Dt,this.target.x+=r*Dt,this.target.y+=i*Dt,this.target.z+=a*Dt,c&&this.applyPosition(),c}get currentAzimuth(){return this.azimuth}get currentDistance(){return this.distance}get targetDistance(){return this.distT}syncFromCamera(){let t=this.camera.position.x-this.target.x,n=this.camera.position.y-this.target.y,o=this.camera.position.z-this.target.z,r=Math.hypot(t,n,o)||1,i=Math.max(cr,Math.min(lr,Math.acos(Math.max(-1,Math.min(1,n/r)))));this.distance=this.distT=r,this.polar=this.polT=i,this.azimuth=this.azT=Math.atan2(t,o)}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),o=this.target.y+this.distance*Math.cos(this.polar),r=this.target.z+this.distance*t*Math.cos(this.azimuth);this.camera.position.set(n,o,r),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()}},Dm=.1,Nm=.25;function Bm(e,t,n){let o=Math.max(1,t)*1.18,r=n==null?Nm:Math.max(.05,n*Dm),i=Math.max(r,e-o),a=Math.max(i+10,e+o);return{near:i,far:a}}var qn=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 r=1/n;this.fpsEma=this.fpsEma?this.fpsEma*.9+r*.1:r}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 sa(e){let t=!1;return n=>{n!==t&&(t=n,n?e.dataset.slReady="1":delete e.dataset.slReady)}}function ca(e,t,n){return Math.max(t,Math.min(n,e))}var Vt=2.5,Vm=1.15,bn=12,Ht=22,la=6,ua=9.5,ma=.9,fa=2.2,mr=30,fr=4,Zn=8192;var _g=Ht+fr;function da(e,t){let n=t*1.4,o=t*3.2;if(e<=n)return{scale:1,fade:0,minPixels:Vt};let r=Math.min(1,(e-n)/Math.max(.001,o-n));return{scale:1-r*.4,fade:r*.55,minPixels:Vt+r*(Vm-Vt)}}function ha(e,t,n){return!(e>0)||!(t>0)||!(n>0)?!1:t*n/e>=64}var Hm=12;function pa(e,t,n,o,r){if(!(e>0)||!(t>0)||!(n>0)||!(o>0)||!(r>0))return!1;let i=Math.tan(o/2*Math.PI/180);if(!(i>0))return!1;let a=t/(n*i)*(r/2);return Math.PI*a*a/e>=Hm}var Gm=[{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"}],kg=new Map(Gm.map(e=>[e.key,e]));var zm={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 Qn(e){let t=e?.[0];return t&&zm[t]||"#3b82f6"}var Um=[{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"}],Lg=new Map(Um.map(e=>[e.key,e]));var jm=["reference-focal","bar","entrance","exit","restroom","screen","sound","concession","coat","wall","rail","suite","obstruction"],Og=new Set(jm);var ya=[{key:"circle",label:"Standard seat",shortLabel:"Standard",useCase:"General assigned seating",group:"general",path:null,bounds:null,mark: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},mark:{x:12,y:10,radius:6}},{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},mark:{x:12,y:10,radius:4.5}},{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},mark:{x:12,y:5,radius:3}},{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},mark:{x:12,y:7.5,radius:5.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},mark:{x:12,y:8,radius: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},mark:{x:12,y:9.25,radius:6.5}},{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},mark:{x:12,y:12.25,radius:4.75}}],ga=ya.map(e=>e.key),Xm=new Map(ya.map(e=>[e.key,e]));function ba(e){return typeof e=="string"&&Xm.has(e)}function xa(e,t){return ba(e)?e:ba(t?.seatGlyph)?t.seatGlyph:"circle"}var le=.02291666666666667,Xe=1/le,Wm=58,Ym=Wm*le;var Km=3,va=0,dr=120,$m=0,qm=45,Zm=7,Je=1.2;function hr(e,t,n,o){return Number.isFinite(e)?Math.max(t,Math.min(n,e)):o}function Qm(e){return!Number.isFinite(e)||!Number.isInteger(e)||e<0?0:e<=Zm?e:Km}function bt(e,t={}){let n=hr(t.floorBaseHeightM,va,dr,0),o=Math.min(dr,n+Qm(e.elevation)*Ym),r=e.height===void 0?o:hr(e.height,va,dr,o),i=hr(e.rake,$m,qm,0);return{height:r,rake:i}}var Sa=at(require("earcut"),1),br=at(require("polygon-clipping"),1);var Hg=Math.PI/180;function pr(e){let t=0,n=0;for(let r of e)t+=r.x,n+=r.y;let o=e.length||1;return{x:t/o,y:n/o}}function yn(e){return e.length?pr(e):null}function Ve(e){let t=0;for(let n=0,o=e.length;n<o;n+=1){let r=e[n],i=e[(n+1)%o];t+=r.x*i.y-i.x*r.y}return t/2}function He(e,t,n){let o=!1;for(let r=0,i=e.length-1;r<e.length;i=r++){let a=e[r],s=e[i];a.y>n!=s.y>n&&t<(s.x-a.x)*(n-a.y)/(s.y-a.y)+a.x&&(o=!o)}return o}var T=le,Jm=.002;function ef(e,t,n){let o=Math.hypot(t[0]-e[0],t[1]-e[1],t[2]-e[2]),r=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(o,r,i);if(a<1e-9)return!0;let s=(o+r+i)/2;return 2*Math.sqrt(Math.max(0,s*(s-o)*(s-r)*(s-i)))/a<Jm}var Ct=class{constructor(t=16384){this.len=0;this.buf=new Float32Array(t)}push3(t,n,o){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++]=o}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 o=new Float32Array(n);o.set(this.buf.subarray(0,this.len)),this.buf=o}get length(){return this.len}toArray(){return this.buf.slice(0,this.len)}},to=class{constructor(){this.pos=new Ct;this.nor=new Ct;this.col=new Ct;this.flr=new Ct;this.mat=new Ct;this.currentFloor=0;this.currentMaterial=0}setFloor(t){this.currentFloor=t}setMaterial(t){this.currentMaterial=t}tri(t,n,o,r,i,a=i,s=i){ef(t,n,o)||(this.pos.push3(t[0],t[1],t[2]),this.pos.push3(n[0],n[1],n[2]),this.pos.push3(o[0],o[1],o[2]),this.nor.push3(r[0],r[1],r[2]),this.nor.push3(r[0],r[1],r[2]),this.nor.push3(r[0],r[1],r[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,o,r,i,a,s,c=s,u=s){[...t,...n,...o].every(Number.isFinite)&&(this.pos.push3(t[0],t[1],t[2]),this.pos.push3(n[0],n[1],n[2]),this.pos.push3(o[0],o[1],o[2]),this.nor.push3(r[0],r[1],r[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 tf(e,t,n){let o=t[0]-e[0],r=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=r*c-i*s,l=i*a-o*c,m=o*s-r*a,h=Math.hypot(u,l,m)||1;return u/=h,l/=h,m/=h,[u,l,m]}function nf(e,t){let n=[...e],o=[];for(let a of e)o.push(a.x,a.y);let r=[];if(t){for(let a of t)if(!(a.length<3)){r.push(n.length);for(let s of a)n.push(s),o.push(s.x,s.y)}}let i=(0,Sa.default)(o,r.length?r:void 0,2);return{pts:n,tris:i}}function et(e){return Ve(e)<0?[...e].reverse():e}var of=3;function rf(e,t,n,o){let r=o(e),i=o(t),a=o(n),s=(f,d,p,b)=>Math.abs(o({x:(f.x+d.x)/2,y:(f.y+d.y)/2})-(p+b)/2),c=(e.x+t.x+n.x)/3,u=(e.y+t.y+n.y)/3,l=(r+i+a)/3,m=Math.max(s(e,t,r,i),s(t,n,i,a),s(n,e,a,r),Math.abs(o({x:c,y:u})-l)),h=(f,d,p)=>{let b=Math.abs(o({x:(f+c)/2,y:(d+u)/2})-(p+l)/2);b>m&&(m=b)};return h((e.x+t.x)/2,(e.y+t.y)/2,(r+i)/2),h((t.x+n.x)/2,(t.y+n.y)/2,(i+a)/2),h((n.x+e.x)/2,(n.y+e.y)/2,(a+r)/2),m}function gn(e,t,n,o,r){if(r<=0)return rf(e,t,n,o);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(gn(e,i,s,o,r-1),gn(i,t,a,o,r-1),gn(s,a,n,o,r-1),gn(i,a,s,o,r-1))}function xn(e,t,n,o,r,i,a,s){if(a>0){let h={x:(t.x+n.x)/2,y:(t.y+n.y)/2},f={x:(n.x+o.x)/2,y:(n.y+o.y)/2},d={x:(o.x+t.x)/2,y:(o.y+t.y)/2};xn(e,t,h,d,r,i,a-1,s),xn(e,h,n,f,r,i,a-1,s),xn(e,d,f,o,r,i,a-1,s),xn(e,h,f,d,r,i,a-1,s);return}let c=[t.x*T,r(t),t.y*T],u=[n.x*T,r(n),n.y*T],l=[o.x*T,r(o),o.y*T];if(s){e.triN(c,u,l,s(t),s(n),s(o),i);return}let m=tf(c,u,l);m[1]<0&&(m=[-m[0],-m[1],-m[2]]),e.tri(c,u,l,m,i)}var af=8;function Ma(e,t,n){if(!Number.isFinite(n))return e;let o=[],r=(i,a,s,c,u)=>{if(u>0){let l={x:(i.x+a.x)/2,y:(i.y+a.y)/2},m=t(l);if(Math.abs(m-(s+c)/2)>n){r(i,l,s,m,u-1),r(l,a,m,c,u-1);return}}o.push(i)};for(let i=0;i<e.length;i++){let a=e[i],s=e[(i+1)%e.length];r(a,s,t(a),t(s),af)}return o}function Jn(e,t){if(e.length<3)return e;let n=[];for(let r of e){let i=n[n.length-1];i&&Math.hypot(r.x-i.x,r.y-i.y)<t||n.push(r)}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 o=[];for(let r=0;r<n.length;r++){let i=o.length?o[o.length-1]:n[(r-1+n.length)%n.length],a=n[r],s=n[(r+1)%n.length],c=s.x-i.x,u=s.y-i.y,l=Math.hypot(c,u);l>t&&Math.abs((a.x-i.x)*u-(a.y-i.y)*c)/l<t||o.push(a)}return o.length>=3?o:n}var eo=.001*Xe*.1;function ce(e,t,n,o,r,i,a,s,c=1/0,u){if(!t||t.length<3||(c===void 0&&(c=1/0),Math.abs(Ve(t))<1e-4))return;let l=Jn(Ma(Jn(et(t),eo),o,c),eo),m=n?.map(y=>Jn(Ma(Jn(et(y),eo),o,c),eo)).filter(y=>y.length>=3&&Math.abs(Ve(y))>=1e-4),{pts:h,tris:f}=nf(l,m),d=[i[0]*s.top,i[1]*s.top,i[2]*s.top],p=[i[0]*s.bottomCap,i[1]*s.bottomCap,i[2]*s.bottomCap],b=[a[0]*s.top,a[1]*s.top,a[2]*s.top],g=[a[0]*s.wallBottom,a[1]*s.wallBottom,a[2]*s.wallBottom],v=0;if(Number.isFinite(c))for(;v<of;v++){let y=0;for(let P=0;P<f.length;P+=3){let x=gn(h[f[P]],h[f[P+1]],h[f[P+2]],o,v);x>y&&(y=x)}if(y<=c)break}for(let y=0;y<f.length;y+=3){let P=h[f[y]],x=h[f[y+1]],S=h[f[y+2]];xn(e,P,x,S,o,d,v,u);let A=[P.x*T,r,P.y*T],_=[x.x*T,r,x.y*T],D=[S.x*T,r,S.y*T];e.tri(A,D,_,[0,-1,0],p)}let w=y=>{if(v<=0)return y;let P=1<<v,x=[];for(let S=0;S<y.length;S++){let A=y[S],_=y[(S+1)%y.length];for(let D=0;D<P;D++){let E=D/P;x.push({x:A.x+(_.x-A.x)*E,y:A.y+(_.y-A.y)*E})}}return x},R=pr(l),M=[{ring:w(l),flip:!1}];if(m)for(let y of m)y.length>=3&&M.push({ring:w(y),flip:!0});for(let{ring:y,flip:P}of M)for(let x=0;x<y.length;x++){let S=y[x],A=y[(x+1)%y.length],_=(A.x-S.x)*T,E=(A.y-S.y)*T,I=-_,k=Math.hypot(E,I)||1;E/=k,I/=k;let L=(S.x+A.x)/2-R.x,B=(S.y+A.y)/2-R.y,F=E*L+I*B;P&&(F=-F),F<0&&(E=-E,I=-I);let V=[E,0,I],N=[S.x*T,o(S),S.y*T],C=[A.x*T,o(A),A.y*T],O=[S.x*T,r,S.y*T],G=[A.x*T,r,A.y*T];e.tri(N,C,G,V,b,b,g),e.tri(N,G,O,V,b,g,g)}}function wa(e){let t=0;for(let c of e)t+=c.count;let n=new Float32Array(t*3),o=new Float32Array(t*3),r=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),o.set(c.normal,s*3),r.set(c.color,s*3),i.set(c.floor,s),a.set(c.material,s),s+=c.count;return{position:n,normal:o,color:r,floor:i,material:a,count:t}}function $e(e,t,n=2.5){if(t<=0||e.length<3)return e;let o=et(e),r=o.length,i=[];for(let s=0;s<r;s++){let c=o[s],u=o[(s+1)%r],l=u.x-c.x,m=u.y-c.y,h=Math.hypot(l,m)||1;i.push({x:m/h,y:-l/h})}let a=[];for(let s=0;s<r;s++){let c=o[s],u=i[(s-1+r)%r],l=i[s],m=u.x+l.x,h=u.y+l.y,f=Math.hypot(m,h),d=()=>{a.push([c.x+u.x*t,c.y+u.y*t]),a.push([c.x+l.x*t,c.y+l.y*t])};if(f<1e-9){d();continue}m/=f,h/=f;let p=m*u.x+h*u.y,b=1/Math.max(p,1e-6);if(!Number.isFinite(b)||b>n){d();continue}a.push([c.x+m*t*b,c.y+h*t*b])}if(a.length<3)return e;try{let s=br.default.union([[...a,a[0]]]),c=null,u=-1/0;for(let m of s){let h=Math.abs(Ve(m[0].map(([f,d])=>({x:f,y:d}))));h>u&&(u=h,c=m[0])}if(!c)return e;let l=c.map(([m,h])=>({x:m,y:h}));if(l.length>1){let m=l[0],h=l[l.length-1];Math.abs(m.x-h.x)<1e-9&&Math.abs(m.y-h.y)<1e-9&&l.pop()}return l.length>=3?l:e}catch{return e}}function yt(e,t,n=2.5){if(e.length<3)return[];if(t<=0)return e;let o=et(e),r=o.length,i=[];for(let c=0;c<r;c++){let u=o[c],l=o[(c+1)%r],m=Math.hypot(l.x-u.x,l.y-u.y)||1;i.push({x:-(l.y-u.y)/m,y:(l.x-u.x)/m})}let a=[],s=[];for(let c=0;c<r;c++){let u=o[c],l=i[(c-1+r)%r],m=i[c],h=l.x+m.x,f=l.y+m.y,d=Math.hypot(h,f),p=d<1e-9?1/0:1/Math.max(h/d*l.x+f/d*l.y,1e-6);if(!Number.isFinite(p)||p>n){a.push({x:u.x+l.x*t,y:u.y+l.y*t},{x:u.x+m.x*t,y:u.y+m.y*t}),s.push(c,c);continue}h/=d,f/=d,a.push({x:u.x+h*t*p,y:u.y+f*t*p}),s.push(c)}for(let c=0;c<a.length;c++){let u=(c+1)%a.length,l=s[c],m=s[u];if(m!==(l+1)%r)continue;let h=o[l],f=o[m];if((a[u].x-a[c].x)*(f.x-h.x)+(a[u].y-a[c].y)*(f.y-h.y)<=0)return[]}try{let c=br.default.intersection([[...a.map(d=>[d.x,d.y]),[a[0].x,a[0].y]]],[[...o.map(d=>[d.x,d.y]),[o[0].x,o[0].y]]]),u=null,l=0;for(let d of c){let p=Math.abs(Ve(d[0].map(([b,g])=>({x:b,y:g}))));p>l&&(l=p,u=d[0])}if(!u)return[];let m=u.map(([d,p])=>({x:d,y:p})),h=m[0],f=m[m.length-1];return m.length>1&&Math.abs(h.x-f.x)<1e-9&&Math.abs(h.y-f.y)<1e-9&&m.pop(),m.length>=3?et(m):[]}catch{return[]}}function no(e,t,n,o,r=28){let i=[];for(let a=0;a<r;a++){let s=a/r*Math.PI*2;i.push({x:e+n*Math.cos(s),y:t+o*Math.sin(s)})}return i}function vn(e,t,n,o){return[{x:e,y:t},{x:e+n,y:t},{x:e+n,y:t+o},{x:e,y:t+o}]}var st=.22;function Pa(e,t){let n=_e[e];if(n!=="sold"&&n!=="held")return-1;let o=(t+1)*2654435761;return o^=o>>>15,o=Math.imul(o,2246822519),o^=o>>>13,(o>>>0)%1e5/1e5}var sf=.42;function cf(e){let t=e.length,n=new Float64Array(t);if(t<2)return n.fill(1/0),n;let o=1/0,r=1/0,i=-1/0,a=-1/0;for(let d of e)d.x<o&&(o=d.x),d.y<r&&(r=d.y),d.x>i&&(i=d.x),d.y>a&&(a=d.y);let s=Math.max(i-o,1e-6),c=Math.max(a-r,1e-6),u=Math.max(Math.sqrt(s*c/t),1e-6),l=Math.max(1,Math.ceil(s/u)+1),m=Math.max(1,Math.ceil(c/u)+1),h=new Map,f=(d,p)=>{let b=Math.min(l-1,Math.max(0,Math.floor((d-o)/u)));return Math.min(m-1,Math.max(0,Math.floor((p-r)/u)))*l+b};for(let d=0;d<t;d++){let p=f(e[d].x,e[d].y),b=h.get(p);b?b.push(d):h.set(p,[d])}for(let d=0;d<t;d++){let p=e[d],b=Math.min(l-1,Math.max(0,Math.floor((p.x-o)/u))),g=Math.min(m-1,Math.max(0,Math.floor((p.y-r)/u))),v=1/0;for(let w=1;w<=4;w++){for(let R=g-w;R<=g+w;R++)if(!(R<0||R>=m))for(let M=b-w;M<=b+w;M++){if(M<0||M>=l||w>1&&Math.abs(R-g)<w&&Math.abs(M-b)<w)continue;let y=h.get(R*l+M);if(y)for(let P of y){if(P===d)continue;let x=Math.hypot(e[P].x-p.x,e[P].y-p.y);x<v&&(v=x)}}if(Number.isFinite(v)&&v<=w*u)break}n[d]=v}return n}function lf(e){let t=e.eyeHeightM;return Number.isFinite(t)?Math.max(0,t-Je):0}function Ia(e,t,n,o,r,i){let a=e.length,s=new Float32Array(a*3),c=new Float32Array(a),u=new Float32Array(a*3),l=new Float32Array(a),m=new Float32Array(a),h=new Float32Array(a),f=new Float32Array(a),d=new Float32Array(a*3),p=new Map,b=cf(e);for(let g=0;g<a;g++){let v=e[g],R=(n?.seatPitchU(g)??b[g])*T;l[g]=Number.isFinite(R)?Math.max(.06,Math.min(st,R*sf)):st,m[g]=Gi(Number.isFinite(R)?R:void 0);let M=xa(v.glyph,{seatGlyph:i?.get(v.categoryKey)});h[g]=ga.indexOf(M),f[g]=v.wheelchairSpaceType==="no-seat"?0:1,s[g*3]=v.x*T,s[g*3+1]=n?n.seatDeckY(g):lf(v),s[g*3+2]=v.y*T,c[g]=hn(t?t(v):"available");let y=he(r?.get(v.categoryKey)??"#6e7bff")??[.43,.48,1];if(u[g*3]=y[0],u[g*3+1]=y[1],u[g*3+2]=y[2],v.accessibility?.length){let P=he(Qn(v.accessibility));P&&(d[g*3]=P[0],d[g*3+1]=P[1],d[g*3+2]=P[2])}p.set(v.id,g)}return{count:a,iPosition:s,iState:c,iCategory:u,iMaxRadius:l,iRing:d,idToIndex:p,iChairWidth:m,iGlyph:h,iPhysicalSeat:f,iFloor:o??new Float32Array(a),iSection:new Float32Array(a).fill(-1),iYaw:new Float32Array(a)}}var uf=64;function yr(e,t){let n=[];for(let a of t){let s=e.idToIndex.get(a.seatId);if(s===void 0)continue;let c=hn(a.state);e.iState[s]!==c&&(e.iState[s]=c,n.push(s))}if(!n.length)return[];n.sort((a,s)=>a-s);let o=[],r=n[0],i=n[0];for(let a=1;a<n.length;a++){let s=n[a];if(s!==i){if(s<=i+uf){i=s;continue}o.push({start:r,length:i-r+1}),r=s,i=s}}return o.push({start:r,length:i-r+1}),o}var Mn=3,_t=.38,Sn=.24;function mf(e){if(e.length<3)return null;let t=e[0],n=e[Math.floor(e.length/2)],o=e[e.length-1],r=(n.x-t.x)*T,i=(n.y-t.y)*T,a=(o.x-t.x)*T,s=(o.y-t.y)*T,c=2*(r*s-i*a);if(Math.abs(c)<1e-7)return null;let u=r*r+i*i,l=a*a+s*s,m=(u*s-l*i)/c+t.x*T,h=(r*l-a*u)/c+t.y*T,f=Math.hypot(t.x*T-m,t.y*T-h);return f<1||f>200||!Number.isFinite(f)||e.some(d=>Math.abs(Math.hypot(d.x*T-m,d.y*T-h)-f)>.03)?null:{x:m,z:h,radius:f}}function Aa(e){let t=[],n=new Map,o=(c,u)=>`${Math.floor(c/Mn)},${Math.floor(u/Mn)}`;for(let c of e)for(let u of c.rows){for(let m of u.pts){let h=m.x*T,f=m.y*T,d=o(h,f),p=n.get(d)??[];p.push({x:h,z:f,y:u.y,floor:c.floorIndex}),n.set(d,p)}if(u.patch||u.pts.length<2)continue;let l=mf(u.pts);for(let m of[0,u.pts.length-1]){let h=u.pts[m],f=u.pts[m===0?1:m-1],d=h.x-f.x,p=h.y-f.y,b=Math.hypot(d,p);b<1e-6||t.push({sectionId:c.sectionId,floorIndex:c.floorIndex,curve:l,row:u,point:h,x:h.x*T,z:h.y*T,dx:d/b,dz:p/b})}}let r=new Map;t.forEach((c,u)=>{let l=o(c.x,c.z),m=r.get(l)??[];m.push(u),r.set(l,m)});let i=(c,u)=>{let l=Math.floor(c/Mn),m=Math.floor(u/Mn);return[-1,0,1].flatMap(h=>[-1,0,1].map(f=>`${l+h},${m+f}`))},a=new Map;t.forEach((c,u)=>{let l=-1,m=1/0,h=!1;for(let f of i(c.x,c.z))for(let d of r.get(f)??[]){let p=t[d];if(c.sectionId===p.sectionId&&c.row.blockId===p.row.blockId||c.floorIndex!==p.floorIndex||Math.abs(c.row.y-p.row.y)>.05)continue;let b=p.x-c.x,g=p.z-c.z,v=Math.hypot(b,g);if(v<_t*2+.45||v>Mn)continue;let w=c.curve&&p.curve&&Math.hypot(c.curve.x-p.curve.x,c.curve.z-p.curve.z)<=.05&&Math.abs(c.curve.radius-p.curve.radius)<=.05,R=Math.min((b*c.dx+g*c.dz)/v,(-b*p.dx-g*p.dz)/v);(w?R<.8:R<.98)||!w&&(Math.abs(b*c.dz-g*c.dx)>.15||Math.abs(b*p.dz-g*p.dx)>.15)||(v<m-.02?(l=d,m=v,h=!1):Math.abs(v-m)<=.02&&(h=!0))}l>=0&&!h&&a.set(u,l)});let s=[];for(let[c,u]of a){if(c>=u||a.get(u)!==c)continue;let l=t[c],m=t[u],h=Math.hypot(m.x-l.x,m.z-l.z),f=(m.x-l.x)/h,d=(m.z-l.z)/h,p=!1;for(let g of i((l.x+m.x)/2,(l.z+m.z)/2))for(let v of n.get(g)??[]){if(v.floor!==l.floorIndex||Math.abs(v.y-l.row.y)>.75)continue;let w=(v.x-l.x)*f+(v.z-l.z)*d,R=Math.abs((v.x-l.x)*d-(v.z-l.z)*f);w>.01&&w<h-.01&&R<Sn+_t&&(p=!0)}if(p)continue;let b=(g,v)=>({x:(l.x+f*g-d*v)/T,y:(l.z+d*g+f*v)/T});s.push({sections:[l.sectionId,m.sectionId],blocks:[l.row.blockId,m.row.blockId],floorIndex:l.floorIndex,ends:[l.point,m.point],clearWidthM:h-2*_t,heightM:(l.row.y+m.row.y)/2,outline:[b(_t,-Sn),b(h-_t,-Sn),b(h-_t,Sn),b(_t,Sn)]})}return s}var ff=.15,df=1.6;function Ra(e){return ca(e??1,ff,df)}var hf=.15,pf=.9,bf=1.76;function Ea(e){return!!e&&e[0]*.2126+e[1]*.7152+e[2]*.0722>.55?{zenith:[.36,.58,.84],horizon:[.82,.88,.94]}:{zenith:[.05,.08,.15],horizon:[.3,.38,.5]}}function yf(){return{background:{top:[...Et.top],bottom:[...Et.bottom]},sky:Ea(null),structure:sr,seatStates:{...Zi},seatScale:1,materials:{seat:null,shell:null,roughness:.78}}}function gf(e){return!!e&&e[0]*.2126+e[1]*.7152+e[2]*.0722>.55?{deck:"#c9ccc8",fascia:"#b4bab8",shell:"#c3c9c8",roughness:.87}:{deck:"#69747b",fascia:"#3e4d58",shell:"#526572",roughness:.87}}function Ca(e){let t=yf();e??={};let n=he(e.background);if(n){t.background={top:se(n,pf),bottom:se(n,bf)},t.sky=Ea(n);let s={};for(let[u,l]of Object.entries(sr))s[u]=pe(l,n,hf);n[0]*.2126+n[1]*.7152+n[2]*.0722>.55&&(s.ground=se(n,.86)),t.structure=s}let o=he(e.selectionColor)??he(e.accent);o&&(t.seatStates={...t.seatStates,selected:o});let r=e.seatScale;typeof r=="number"&&Number.isFinite(r)&&(t.seatScale=Ra(r));let i=Object.fromEntries(Object.entries(e.venue3d??{}).filter(([,s])=>s!=null)),a={...gf(n),...i};if(a){let s=he(a.deck),c=he(a.fascia);s&&(t.structure={...t.structure,tierTop:s,gaTop:s}),c&&(t.structure={...t.structure,tierWall:c,gaWall:c}),t.materials.seat=he(a.seat),t.materials.shell=he(a.shell),typeof a.roughness=="number"&&Number.isFinite(a.roughness)&&(t.materials.roughness=Math.min(1,Math.max(0,a.roughness)))}return t}function _a(e,t){let n=[];for(let o of t)n.push(...e.seatStates[o]);return n}var xf=new Set(["pitch-football","rink-hockey","track-athletics","oval-cricket","pitch-rugby","diamond-baseball","court-basketball","court-tennis","ring-boxing"]),vf=new Set(["pitch-football","track-athletics","oval-cricket","pitch-rugby","diamond-baseball"]);function Tt(e){return!!e&&xf.has(e)}function oo(e){return!!e&&vf.has(e)}var ro=1.1,Mf={"pitch-football":{width:105,height:68},"rink-hockey":{width:60,height:30},"track-athletics":{width:176.9,height:92.5},"oval-cricket":{width:150,height:140},"pitch-rugby":{width:120,height:70},"diamond-baseball":{width:140,height:140},"court-basketball":{width:32,height:19},"court-tennis":{width:36.57,height:18.29},"ring-boxing":{width:7.8,height:7.8}},Sf={"pitch-football":"#2f7d4f","rink-hockey":"#e8f1f8","track-athletics":"#a4472f","oval-cricket":"#3d8a53","pitch-rugby":"#2f7d4f","diamond-baseball":"#2f7d4f","court-basketball":"#c8894f","court-tennis":"#3f7a5a","ring-boxing":"#2a4d8f"};var wf=Math.PI*2;function Pf(e,t,n,o,r,i){return{x:r+e*n-t*o,y:i+e*o+t*n}}function Ta(e,t){let n=Math.max(0,e-t),o=[],r=20;for(let i=0;i<=r;i++){let a=-Math.PI/2+i/r*Math.PI;o.push({x:n+t*Math.cos(a),y:t*Math.sin(a)})}for(let i=0;i<=r;i++){let a=Math.PI/2+i/r*Math.PI;o.push({x:-n+t*Math.cos(a),y:t*Math.sin(a)})}return o}var ka=(()=>{let t={x:0,y:52},n=25,o={x:70,y:t.y-70},r=(o.x*o.x+o.y*o.y-4900)/(2*(o.y+70)),i=r+70,a=[],s=Math.atan2(o.y-r,o.x),c=Math.atan2(o.y-r,-o.x);for(let u=0;u<=24;u++){let l=s+(c-s)*u/24;a.push({x:i*Math.cos(l),y:r+i*Math.sin(l)})}return{half:70,home:t,backstop:n,fence:a}})();var io="#f1f5f9";function wn(e){return Tt(e)}function gt(e,t,n,o,r=32){let i=[];for(let a=0;a<r;a++){let s=a/r*wf;i.push({x:e+n*Math.cos(s),y:t+o*Math.sin(s)})}return i}function ct(e,t,n,o){return[{x:e-n,y:t-o},{x:e+n,y:t-o},{x:e+n,y:t+o},{x:e-n,y:t+o}]}function If(e){let{kind:t,cx:n,cy:o,width:r,height:i}=e,a=(e.rotation??0)*Math.PI/180,s=Math.cos(a),c=Math.sin(a),u=r/2,l=i/2,m=[],h=Mf[t],f=p=>h?p/h.width*r:0,d=p=>h?p/h.height*i:0;switch(t){case"pitch-football":{m.push({points:[{x:0,y:-l},{x:0,y:l}],closed:!1}),m.push({points:gt(0,0,f(9.15),d(9.15)),closed:!0});for(let p of[-1,1])m.push({points:ct(p*(u-f(16.5)/2),0,f(16.5)/2,d(40.32)/2),closed:!0}),m.push({points:ct(p*(u-f(5.5)/2),0,f(5.5)/2,d(18.32)/2),closed:!0});break}case"rink-hockey":{m.push({points:[{x:0,y:-l},{x:0,y:l}],closed:!1,ink:"#d63b3b"});for(let p of[-1,1]){m.push({points:[{x:p*f(7.5),y:-l},{x:p*f(7.5),y:l}],closed:!1,ink:"#2f6ecb"}),m.push({points:[{x:p*(u-f(4)),y:-d(11)},{x:p*(u-f(4)),y:d(11)}],closed:!1,ink:"#d63b3b"});for(let b of[-1,1])m.push({points:gt(p*f(20.5),b*d(7),f(4.5),d(4.5)),closed:!0,ink:"#2f6ecb"})}m.push({points:gt(0,0,f(4.5),d(4.5)),closed:!0,ink:"#2f6ecb"});break}case"track-athletics":{let b=l-d(1.22)*8;b>0&&m.push({points:Ta(u-f(1.22)*8,b),closed:!0,fill:"#2f7d4f"});for(let g=1;g<8;g++){let v=d(1.22)*g,w=l-v;if(w<=0)break;m.push({points:Ta(u-f(1.22)*g,w),closed:!0})}break}case"oval-cricket":{m.push({points:gt(0,0,f(27.4),d(27.4+20.12/2),40),closed:!0}),m.push({points:ct(0,0,f(3.05)/2,d(20.12)/2),closed:!0,ink:"#d8cfae"});break}case"pitch-rugby":{let p=b=>({points:[{x:f(b),y:-l},{x:f(b),y:l}],closed:!1});m.push(p(0));for(let b of[-1,1]){m.push(p(b*50),p(b*28));for(let g=-35;g<35;g+=4)m.push({points:[{x:f(b*10),y:d(g)},{x:f(b*10),y:d(Math.min(35,g+2))}],closed:!1})}break}case"diamond-baseball":{let p=(L,B)=>({x:f(L),y:d(B)}),{home:b}=ka,g=27.43,v=g/Math.SQRT2,w={x:b.x+v,y:b.y-v},R={x:b.x,y:b.y-2*v},M={x:b.x-v,y:b.y-v},y={x:b.x,y:b.y-18.44},P="#b98a59",x=Sf["diamond-baseball"],S=38.94,A=[p(b.x,b.y)],_=Math.atan2(b.y-S/Math.SQRT2-y.y,S/Math.SQRT2),D=Math.PI-_;for(let L=0;L<=16;L++){let B=_-(_+Math.PI*2-D)%(Math.PI*2)*(L/16);A.push(p(y.x+29*Math.cos(B),y.y+29*Math.sin(B)))}m.push({points:A,closed:!0,fill:P,ink:P});let E={x:b.x,y:b.y-v},I=[{x:b.x,y:b.y},w,R,M].map(L=>p(E.x+(L.x-E.x)*.84,E.y+(L.y-E.y)*.84));m.push({points:I,closed:!0,fill:x,ink:x}),m.push({points:gt(f(y.x),d(y.y),f(2.74),d(2.74),20),closed:!0,fill:P,ink:P}),m.push({points:gt(f(b.x),d(b.y),f(3.96),d(3.96),20),closed:!0,fill:P,ink:P});let k=ka.fence;m.push({points:[p(b.x,b.y),p(k[0].x,k[0].y)],closed:!1}),m.push({points:[p(b.x,b.y),p(k[k.length-1].x,k[k.length-1].y)],closed:!1});for(let L of[w,R,M])m.push({points:ct(f(L.x),d(L.y),f(.3),d(.3)),closed:!0,fill:io});break}case"court-basketball":{m.push({points:ct(0,0,f(14),d(7.5)),closed:!0}),m.push({points:[{x:0,y:-d(7.5)},{x:0,y:d(7.5)}],closed:!1}),m.push({points:gt(0,0,f(1.8),d(1.8),24),closed:!0});for(let p of[-1,1]){let b=p*14,g=p*(14-5.8),v=p*(14-1.575);m.push({points:ct(f((b+g)/2),0,f(2.9),d(2.45)),closed:!0,fill:"#2f5d8a"}),m.push({points:gt(f(g),0,f(1.8),d(1.8),24),closed:!0});let w=Math.sqrt(6.75*6.75-6.6*6.6),R=[{x:f(b),y:-d(6.6)}],M=Math.atan2(-6.6,-p*w),y=2*Math.atan2(6.6,w);for(let P=0;P<=16;P++){let x=M-p*y*(P/16);R.push({x:f(v+6.75*Math.cos(x)),y:d(6.75*Math.sin(x))})}R.push({x:f(b),y:d(6.6)}),m.push({points:R,closed:!1})}break}case"court-tennis":{m.push({points:ct(0,0,f(11.885),d(5.485)),closed:!0,fill:"#2b5f99"});for(let p of[-1,1])m.push({points:[{x:-f(11.885),y:p*d(4.115)},{x:f(11.885),y:p*d(4.115)}],closed:!1}),m.push({points:[{x:p*f(6.4),y:-d(4.115)},{x:p*f(6.4),y:d(4.115)}],closed:!1});m.push({points:[{x:-f(6.4),y:0},{x:f(6.4),y:0}],closed:!1}),m.push({points:[{x:0,y:-d(6.4)},{x:0,y:d(6.4)}],closed:!1,ink:"#d1d5db"});break}case"ring-boxing":{m.push({points:ct(0,0,f(3.05),d(3.05)),closed:!0});let g=[[-1,-1,"#c53030"],[1,1,"#2b6cb0"],[1,-1,"#e2e8f0"],[-1,1,"#e2e8f0"]];for(let[v,w,R]of g)m.push({points:ct(v*f(3.05),w*d(3.05),f(.3),d(.3)),closed:!0,fill:R,ink:R});break}default:return[]}return m.map(p=>({...p,points:p.points.map(b=>Pf(b.x,b.y,s,c,n,o))}))}function La(e){if(e.role!=="stage"||!wn(e.stageKind))return[];let t=null;if(e.x!=null&&e.y!=null&&e.width!=null&&e.height!=null&&e.width>0&&e.height>0&&[e.x,e.y,e.width,e.height].every(Number.isFinite))t={cx:e.x+e.width/2,cy:e.y+e.height/2,width:e.width,height:e.height};else if(e.points&&e.points.length>=3&&e.points.every(n=>Number.isFinite(n.x)&&Number.isFinite(n.y))){let n=e.points.map(l=>l.x),o=e.points.map(l=>l.y),r=Math.min(...n),i=Math.max(...n),a=Math.min(...o),s=Math.max(...o),c=Math.max(1,i-r),u=Math.max(1,s-a);t={cx:r+c/2,cy:a+u/2,width:c,height:u}}return t?If({kind:e.stageKind,...t}):[]}function Oa(e,t){let n=1-t,o=n*n*n,r=3*n*n*t,i=3*n*t*t,a=t*t*t;return{x:o*e.start.x+r*e.control1.x+i*e.control2.x+a*e.end.x,y:o*e.start.y+r*e.control1.y+i*e.control2.y+a*e.end.y}}function Fa(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[Oa(e,.5)];let o=Array.from({length:n+1},(c,u)=>Oa(e,u/n)),r=new Float64Array(o.length);for(let c=1;c<o.length;c+=1){let u=o[c].x-o[c-1].x,l=o[c].y-o[c-1].y;r[c]=r[c-1]+Math.hypot(u,l)}let i=r[r.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<r.length-1&&r[s]<u;)s+=1;let l=r[s-1],m=r[s],h=m===l?0:(u-l)/(m-l);a.push({x:o[s-1].x+(o[s].x-o[s-1].x)*h,y:o[s-1].y+(o[s].y-o[s-1].y)*h})}return a}function Da(e){let t=new Map,n=new Map;for(let o of e){if(o.type!=="row"||!o.segmentedRow)continue;let r=n.get(o.segmentedRow.groupId)??[];r.push(o),n.set(o.segmentedRow.groupId,r)}for(let[o,r]of n){let i=r.slice().sort((h,f)=>h.segmentedRow.componentIndex-f.segmentedRow.componentIndex),a=i[0]?.segmentedRow?.componentCount??0,s=i[0]?.segmentedRow;if(!s||!(a>=2&&i.length===a&&s?.boundaryBefore==="start"&&i.every((h,f)=>h.segmentedRow?.kind==="segmented-row-v1"&&h.segmentedRow.groupId===o&&h.segmentedRow.componentCount===a&&h.segmentedRow.componentIndex===f&&h.segmentedRow.repeatLabelOnComponents===s.repeatLabelOnComponents&&(f===0?h.segmentedRow.boundaryBefore==="start":h.segmentedRow.boundaryBefore!=="start")&&h.segmentedRow.displayLabel===s.displayLabel)))continue;let u=i.reduce((h,f)=>h+f.seatCount,0),l=0,m=0;for(let h of i)h.segmentedRow.boundaryBefore==="break"&&(l+=1),t.set(h.id,{groupId:o,adjacencyOffset:l,displayOffset:m,displayLabel:s.displayLabel,totalSeats:u,canonical:i[0],viewFromSeatUrl:s.viewFromSeatUrl,viewFromSeatMeta:s.viewFromSeatMeta,confidenceEvidence:s.confidenceEvidence}),l+=h.seatCount,m+=h.seatCount}return t}var Af="ABCDEFGHIJKLMNOPQRSTUVWXYZ";var Rf="abcdefghijklmnopqrstuvwxyz";function Ef(e,t){let n=t.length,o=e+1,r="";for(;o>0;){o-=1;let i=o%n;r=t[i]+r,o=Math.floor(o/n)}return r}function gr(e,t=!1){let n=t?Rf:Af;return Ef(Math.max(0,Math.floor(e)-1),n)}var Cf=[[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 Na(e){if(!Number.isFinite(e)||e<=0)return String(e);let t=Math.floor(e),n="";for(let[o,r]of Cf)for(;t>=o;)n+=r,t-=o;return n}function _f(e){let t=new Array(e);return Array.from({length:e},(n,o)=>o).sort((n,o)=>Math.abs(2*n-(e-1))-Math.abs(2*o-(e-1))||n-o).forEach((n,o)=>t[n]=o),t}function ao(e,t){let n=e.seatLabelStart??1,o=e.seatNumbering?.direction??"ltr",r=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 f=Math.ceil(c/2),d=i==="updown"?t<f?n+2*t:n-1+2*(c-t):t<f?n+2*(f-1-t):n+1+2*(t-f);return`${a}${d}`}let u=i==="odd"||i==="even"?2:r,l=s!=null&&Number.isFinite(s)?s-(c-1)*u:n,m=o==="center"?_f(c)[t]:o==="rtl"?c-1-t:t,h;switch(i){case"odd":{let f=l%2===1?l:l+1;h=String(f+m*2);break}case"even":{let f=l%2===0?l:l+1;h=String(f+m*2);break}case"roman":h=Na(l+m*r);break;case"letters-upper":h=gr(l+m*r,!1);break;case"letters-lower":h=gr(l+m*r,!0);break;default:h=String(l+m*r);break}return`${a}${h}`}function Tf(e){return{...e.canonical,seatCount:e.totalSeats,label:e.displayLabel,displayLabel:e.displayLabel}}function Ba(e,t,n){return n?.label??`${e.seatLabelBase??e.label}-${ao(e,t)}`}function xr(e,t,n,o){if(o?.displayLabel)return o.displayLabel;if(e.seatDisplayLabelMode==="number")return ao(e,t);if(!n)return`${e.displayLabel||e.label}-${ao(e,t)}`;let r=Tf(n),i=n.displayOffset+t;return`${n.displayLabel}-${ao(r,i)}`}function Va(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 Gt(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 o=1/0;for(let r=0;r+1<e.length;r++){let i=e[r],a=e[r+1],s=a.x-i.x,c=a.y-i.y,u=s*s+c*c,l=u>1e-12?((t-i.x)*s+(n-i.y)*c)/u:0;l<0?l=0:l>1&&(l=1);let m=t-(i.x+l*s),h=n-(i.y+l*c);if(Math.abs(m)>=o||Math.abs(h)>=o)continue;let f=Math.hypot(m,h);f<o&&(o=f)}return o}function kf(e){let t=0,n=0;for(let i of e)t+=i.x,n+=i.y;let o=e.length||1;t/=o,n/=o;let r=0;for(let i of e){let a=Math.hypot(i.x-t,i.y-n);a>r&&(r=a)}return{cx:t,cy:n,r}}function Ha(e,t){return Math.hypot(e.cx-t.cx,e.cy-t.cy)-e.r-t.r}function vr(e,t){let n=1/0;for(let o of Va(e)){let r=Gt(t,o.x,o.y);r<n&&(n=r)}for(let o of Va(t)){let r=Gt(e,o.x,o.y);r<n&&(n=r)}return n}function Lf(e,t){if(e.length<3)return{pts:e,seatIndices:t};let n=0,o=0;for(let l of e)n+=l.x,o+=l.y;n/=e.length,o/=e.length;let r=-1,i=e[0];for(let l of e){let m=Math.hypot(l.x-n,l.y-o);m>r&&(r=m,i=l)}let a=i.x-n,s=i.y-o,c=Math.hypot(a,s);c>1e-9?(a/=c,s/=c):(a=1,s=0);let u=e.map((l,m)=>({p:l,i:m,t:(l.x-n)*a+(l.y-o)*s})).sort((l,m)=>l.t-m.t);return{pts:u.map(l=>l.p),seatIndices:u.map(l=>t[l.i])}}function Mr(e){let t=e.length;if(t<3)return null;let n=0,o=0;for(let v of e)n+=v.x,o+=v.y;n/=t,o/=t;let r=0,i=0,a=0,s=0,c=0,u=0,l=0;for(let v of e){let w=v.x-n,R=v.y-o;r+=w*w,a+=R*R,i+=w*R,s+=w*w*w,c+=R*R*R,u+=w*R*R,l+=R*w*w}let m=r*a-i*i;if(Math.abs(m)<1e-9)return null;let h=(s+u)/2,f=(c+l)/2,d=(h*a-f*i)/m,p=(f*r-h*i)/m,b=d+n,g=p+o;return!Number.isFinite(b)||!Number.isFinite(g)?null:{cx:b,cy:g}}var Of=.15;function Ff(e){if(e.length<2)return null;let t=e.map(M=>{let y=0,P=0;for(let x of M.pts)y+=x.x,P+=x.y;return{x:y/M.pts.length,y:P/M.pts.length}}),n=0,o=0;for(let M of t)n+=M.x,o+=M.y;n/=t.length,o/=t.length;let r=0,i=0,a=0;for(let M of t){let y=M.x-n,P=M.y-o;r+=y*y,i+=y*P,a+=P*P}let s=r+a,c=r*a-i*i,u=s/2+Math.sqrt(Math.max(0,s*s/4-c)),l,m;Math.abs(i)>1e-12?(l=u-a,m=i):r>=a?(l=1,m=0):(l=0,m=1);let h=Math.hypot(l,m);if(!(h>1e-12))return null;l/=h,m/=h;let f=0,d=0,p=0;for(let M of e){if(M.pts.length<2)continue;let y=M.pts[0],P=M.pts[M.pts.length-1],x=P.x-y.x,S=P.y-y.y,A=Math.hypot(x,S);if(!(A>1e-9))continue;let _=x/A,D=S/A;f+=(_*_-D*D)*A,d+=2*_*D*A,p+=A}if(p>0&&Math.hypot(f,d)>=Nf*p){let M=Math.atan2(d,f)/2,y=Math.cos(M),P=Math.sin(M);Math.abs(l*y+m*P)>Bf&&(l=-P,m=y)}let b=1/0,g=-1/0,v=[];for(let M of e){let y=1/0,P=-1/0;for(let x of M.pts){let S=x.x*l+x.y*m;S<y&&(y=S),S>P&&(P=S),S<b&&(b=S),S>g&&(g=S)}v.push(P-y)}let w=g-b;return w>1e-9?(v.sort((M,y)=>M-y),v[Math.min(v.length-1,Math.floor(v.length*.9))]/w<=Df?{x:l,y:m}:null):null}var Df=.35,Nf=.8,Bf=.7;function so(e,t,n,o){let r=new Map;for(let y of n){let P=t[y],x=P.rowId||`__seat-${y}`,S=r.get(x);S||(S={pts:[],idx:[]},r.set(x,S)),S.pts.push({x:P.x,y:P.y}),S.idx.push(y)}if(!r.size)return{sectionId:e,rows:[],blockCount:0};let i=[];for(let[y,P]of r){let x=Lf(P.pts,P.idx),S=0;for(let A of x.pts)S+=Math.hypot(A.x-o.x,A.y-o.y);i.push({id:y,pts:x.pts,seatIndices:x.seatIndices,blockId:-1,ordinal:0,blockDepth:0,focalDistance:S/x.pts.length})}let a=i.map(y=>kf(y.pts)),s=i.length<=256?i.length*(i.length-1)/2:0,c=s?new Float64Array(s):null;c?.fill(Number.NaN);let u=c?new Map(i.map((y,P)=>[y,P])):null,l=(y,P)=>(y>P&&([y,P]=[P,y]),y*(2*i.length-y-1)/2+(P-y-1)),m=(y,P)=>{if(!c)return vr(i[y].pts,i[P].pts);let x=l(y,P),S=c[x];if(!Number.isNaN(S))return S;let A=vr(i[y].pts,i[P].pts);return c[x]=A,A},h=(y,P)=>u?m(u.get(y),u.get(P)):vr(y.pts,P.pts),f=[];for(let y=0;y<i.length;y++){let P=1/0;for(let x=0;x<i.length;x++){if(y===x||Ha(a[y],a[x])>=P)continue;let S=m(y,x);S<P&&(P=S)}Number.isFinite(P)&&f.push(P)}f.sort((y,P)=>y-P);let d=f.length?f[Math.floor(f.length/2)]:1,p=Math.max(d*1.8,1e-6),b=i.map(()=>[]);for(let y=0;y<i.length;y++)for(let P=y+1;P<i.length;P++)Ha(a[y],a[P])>p||m(y,P)<=p&&(b[y].push(P),b[P].push(y));let g=0;for(let y=0;y<i.length;y++){if(i[y].blockId!==-1)continue;let P=g++,x=[y];for(i[y].blockId=P;x.length;){let S=x.pop();for(let A of b[S])i[A].blockId===-1&&(i[A].blockId=P,x.push(A))}}let v=new Map;for(let y of i){let P=v.get(y.blockId)??[];P.push(y),v.set(y.blockId,P)}let w=[];for(let y of i){if(y.pts.length<4)continue;let P=Mr(y.pts);P&&(!Number.isFinite(P.cx)||!Number.isFinite(P.cy)||w.push({x:P.cx,y:P.cy}))}let R=w.length>=2?(()=>{let y=w.map(S=>S.x).sort((S,A)=>S-A),P=w.map(S=>S.y).sort((S,A)=>S-A),x=Math.floor(w.length/2);return{cx:y[x],cy:P[x]}})():null;if(R){let y=D=>Math.hypot(D.x-R.cx,D.y-R.cy),P=1/0,x=-1/0,S=[];for(let D of i){let E=1/0,I=-1/0;for(let k of D.pts){let L=y(k);L<E&&(E=L),L>I&&(I=L)}S.push(I-E),E<P&&(P=E),I>x&&(x=I)}let A=x-P;S.sort((D,E)=>D-E);let _=S[Math.min(S.length-1,Math.floor(S.length*.9))];if(A>1e-9&&_/A<=Of){let D=i.map(O=>{let G=0;for(let j of O.pts)G+=y(j);return{row:O,radius:G/O.pts.length}}),E=0,I=0;for(let O of D)E+=O.radius,I+=O.row.focalDistance;E/=D.length,I/=D.length;let k=0;for(let O of D)k+=(O.radius-E)*(O.row.focalDistance-I);if(k<0)for(let O of D)O.radius=-O.radius;let B=1/0;for(let O of D)O.radius<B&&(B=O.radius);D.sort((O,G)=>O.radius-G.radius);let F=-1,V=-1/0,N=A/Math.max(1,D.length)*.5,C=[];for(let O of D)O.radius-V>N&&(F++,V=O.radius),O.row.ordinal=F,O.row.blockDepth=O.radius-B,C.push(O.row);return{sectionId:e,rows:C,blockCount:g}}}let M=[];for(let[,y]of v){let P=Ff(y);if(P){let x=D=>{let E=0;for(let I of D.pts)E+=I.x*P.x+I.y*P.y;return E/D.pts.length};y.sort((D,E)=>x(D)-x(E)),y.length>=2&&y[0].focalDistance>y[y.length-1].focalDistance&&y.reverse();let S=[],A=d*.5;for(let D of y){let E=S[S.length-1];E&&Math.abs(x(D)-x(E[0]))<A?E.push(D):S.push([D])}let _=0;for(let D=0;D<S.length;D++){if(D>0){let E=1/0;for(let I of S[D-1])for(let k of S[D])E=Math.min(E,h(I,k));_+=E}for(let E of S[D])E.ordinal=D,E.blockDepth=_,M.push(E)}}else{let x=1/0;for(let S of y)S.focalDistance<x&&(x=S.focalDistance);y.sort((S,A)=>S.focalDistance-A.focalDistance);for(let S=0;S<y.length;S++)y[S].ordinal=S,y[S].blockDepth=Math.max(0,y[S].focalDistance-x),M.push(y[S])}}return{sectionId:e,rows:M,blockCount:g}}var Vf=/^\d{4}-\d{2}-\d{2}$/;function Hf(e){let t=Date.parse(e);return Number.isFinite(t)?Vf.test(e)?t+864e5:t:null}function Gf(e,t=Date.now()){if(e.validUntil===void 0){if(e.status!=="approved")return!0;let o=e.assessedAt?Date.parse(e.assessedAt):Number.NaN;return Number.isFinite(o)&&(t instanceof Date?t.getTime():t)<=o+366*864e5}let n=Hf(e.validUntil);return n===null?!1:(t instanceof Date?t.getTime():t)<n}function zf(e,t,n){return!(e.eventConfigurationId&&e.eventConfigurationId!==t||e.eventConfigurationVersion!==void 0&&e.eventConfigurationVersion!==n)}function Uf(e){return e.status!=="draft"&&e.status!=="retracted"}function jf(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 Ga(e,t={}){return!!e&&Uf(e)&&zf(e,t.activeConfigurationId,t.activeConfigurationVersion)&&jf(e,t.activeBasisSha256)&&Gf(e,t.now)}var Xf=/^data:image\/(?:png|jpe?g|webp|gif|avif);base64,[a-z0-9+/]+={0,2}$/i,Wf=/[\s"'<>`\\]/;function Yf(e){if(typeof e!="string"||!e||e.length>2e6||e!==e.trim())return!1;if(e.startsWith("data:"))return Xf.test(e);if(Wf.test(e))return!1;try{let t=new URL(e);return t.protocol==="https:"&&!t.username&&!t.password}catch{return!1}}function za(e){let t=e.trim();return Yf(t)?t:null}var Sr="seatlayer.event-configuration/1";var zt=100,Kf=120,$f=2e5,qf=1e4,Zf=/^[a-f0-9]{64}$/,Qf=new Set(["stage","screen","barrier","camera_platform","sound_desk","rigging_truss"]);function Pn(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function kt(e,t){return typeof e=="string"&&e.length>=1&&e.length<=t&&e.normalize("NFKC").trim()===e}function Jf(e){return typeof e=="number"&&Number.isInteger(e)&&e>0}function Ua(e){return!Array.isArray(e)||e.length>$f||!e.every(t=>kt(t,zt))?null:[...new Set(e)].sort()}function ed(e){return!Pn(e)||!kt(e.chartId,zt)||!kt(e.version,zt)||e.sha256!==void 0&&(typeof e.sha256!="string"||!Zf.test(e.sha256))?null:{chartId:e.chartId,version:e.version,...typeof e.sha256=="string"?{sha256:e.sha256}:{}}}function wr(e,t,n){return typeof e=="number"&&Number.isFinite(e)&&e>=t&&e<=n}function td(e){return Pn(e)?e.mode==="none"||e.mode==="opaque"?e.opacity===void 0?{mode:e.mode}:null:e.mode==="partial"&&wr(e.opacity,.01,.99)?{mode:"partial",opacity:e.opacity}:null:null}function nd(e,t){if(e===void 0)return;if(!Array.isArray(e)||e.length>qf)return null;let n=new Set(t),o=new Set,r=new Set,i=0,a=[];for(let s of e){if(!Pn(s)||!kt(s.id,zt)||!kt(s.objectId,zt)||!n.has(s.objectId)||!Qf.has(String(s.kind))||!wr(s.heightM,.05,50)||s.baseElevationM!==void 0&&!wr(s.baseElevationM,-10,100))return null;let c=td(s.occlusion);if(!c||o.has(s.id)||r.has(s.objectId))return null;let u=s.contentImageUrl===void 0?void 0:typeof s.contentImageUrl=="string"?za(s.contentImageUrl):null;if(s.contentImageUrl!==void 0&&(!u||s.kind!=="screen"||++i>1))return null;o.add(s.id),r.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 od(e){let t=[];if(!Pn(e))return{issues:[{code:"invalid_export",path:"configuration",message:"Configuration must be an object"}]};e.schema!==Sr&&t.push({code:"unsupported_schema",path:"configuration.schema",message:`Configuration schema must be ${Sr}`}),kt(e.id,zt)||t.push({code:"invalid_id",path:"configuration.id",message:"Configuration id must contain 1 to 100 normalized characters"}),kt(e.label,Kf)||t.push({code:"invalid_label",path:"configuration.label",message:"Configuration label must contain 1 to 120 normalized characters"}),Jf(e.version)||t.push({code:"invalid_version",path:"configuration.version",message:"Configuration version must be a positive integer"});let n=ed(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 o=Pn(e.overlay)?e.overlay:null,r=Ua(o?.objectIds),i=Ua(o?.productionKillSeatIds),a=r?nd(o?.productionElements,r):null;return(!o||!r||!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||!r||!i||a===null?{issues:t}:{issues:t,value:{schema:Sr,id:e.id,label:e.label,version:e.version,baseVenue:n,overlay:{objectIds:r,productionKillSeatIds:i,...a!==void 0?{productionElements:a}:{}}}}}function ja(e){let t=od(e);return t.value?{ok:!0,value:t.value}:{ok:!1,issues:t.issues}}function rd(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,o=e.width,r=e.height;return[{x:t,y:n},{x:t+o,y:n},{x:t+o,y:n+r},{x:t,y:n+r}]}function id(e,t,n){let o=n*Math.PI/180,r=Math.cos(o),i=Math.sin(o),a=e.x-t.x,s=e.y-t.y;return{x:t.x+a*r-s*i,y:t.y+a*i+s*r}}function Xa(e){let t=rd(e);if(!t||t.length<2)return null;let n=e.rotation??0,o=Math.abs(n)<1e-6?t:t.map(c=>id(c,{x:t.reduce((u,l)=>u+l.x,0)/t.length,y:t.reduce((u,l)=>u+l.y,0)/t.length},n)),r=1/0,i=1/0,a=-1/0,s=-1/0;for(let c of o)r=Math.min(r,c.x),i=Math.min(i,c.y),a=Math.max(a,c.x),s=Math.max(s,c.y);return!Number.isFinite(r)||a-r<1e-6||s-i<1e-6?null:{minX:r,minY:i,maxX:a,maxY:s}}var ad=5,sd=3,cd=.92,ld=1.9,ud=2,md=.6,fd=1,dd=.06;function hd(e){return e.heightM!==void 0?e.heightM:e.stageKind==="ring-boxing"?ro:wn(e.stageKind)?dd:fd}function Wa(e){let t=1/0,n=1/0,o=-1/0,r=-1/0,i=-1/0;for(let a of $a(e)){let s=a.baseHeightM??0;for(let c of a.objects){if(c.type!=="shape"||c.role!=="stage")continue;let u=Xa(c);u&&(t=Math.min(t,u.minX),n=Math.min(n,u.minY),o=Math.max(o,u.maxX),r=Math.max(r,u.maxY),i=Math.max(i,s+hd(c)))}}return!Number.isFinite(t)||!Number.isFinite(i)?null:{minX:t,minY:n,maxX:o,maxY:r,deckTopM:i}}function pd(e,t,n,o){let r=1/0,i=1/0,a=-1/0,s=-1/0;for(let f of e)Number.isFinite(f.eyeHeightM)&&(r=Math.min(r,f.x),a=Math.max(a,f.x),i=Math.min(i,f.y),s=Math.max(s,f.y));if(!Number.isFinite(r))return null;let c=r*t,u=i*t,l=Math.max(1,Math.ceil((a-r)*t/n)+1),m=Math.max(1,Math.ceil((s-i)*t/n)+1),h=new Float64Array(l*m).fill(-1/0);for(let f of e){if(!Number.isFinite(f.eyeHeightM))continue;let d=f.eyeHeightM-Je,p=Math.min(l-1,Math.max(0,Math.floor((f.x*t-c)/n))),g=Math.min(m-1,Math.max(0,Math.floor((f.y*t-u)/n)))*l+p,v=d+o;v>h[g]&&(h[g]=v)}return{cellM:n,minX:c,minY:u,cols:l,rows:m,top:h}}function bd(e,t,n){let o=Math.floor((t-e.minX)/e.cellM),r=Math.floor((n-e.minY)/e.cellM);return o<0||r<0||o>=e.cols||r>=e.rows?-1/0:e.top[r*e.cols+o]}function Ya(e,t,n={}){let o=new Map;if(!t||!e.length)return o;let r=n.metresPerChartUnit??le,i=n.cellM??md,a=n.chairBackM??cd,s=n.selfRowSkipM??ud,c=n.clearThreshold??.9,u=n.partialThreshold??.25,l=Math.max(1,n.columns??ad),m=Math.max(1,n.rows??sd),h=pd(e,r,i,a);if(!h)return o;let f=(t.maxX-t.minX)*r,d=(t.maxY-t.minY)*r,p=f>=d,b=(t.minX+t.maxX)/2*r,g=(t.minY+t.maxY)/2*r,v=[];for(let R=0;R<l;R++){let M=(R+.5)/l-.5,y=p?b+M*f:b,P=p?g:g+M*d;for(let x=0;x<m;x++){let S=t.deckTopM+(m===1?0:x/(m-1)*ld);v.push({x:y,y:P,z:S})}}let w=i/2;for(let R of e){if(!Number.isFinite(R.eyeHeightM))continue;let M=R.x*r,y=R.y*r,P=R.eyeHeightM,x=0,S=1/0;for(let _ of v){let D=_.x-M,E=_.y-y,I=Math.hypot(D,E);if(!(I>s)){x++;continue}let k=D/I,L=E/I,B=0;for(let F=s;F<I;F+=w){let V=bd(h,M+k*F,y+L*F);if(!(!Number.isFinite(V)||V>=P)&&V>P+(_.z-P)*F/I){B=F;break}}B?S=Math.min(S,B):x++}let A=x/v.length;A>=c||o.set(R.id,{seatId:R.id,mark:A<u?"obstructedView":"restrictedView",visibleFraction:A,totalRays:v.length,atDistanceM:Number.isFinite(S)?S:0})}return o}function Ka(e,t){if(!t.size)return 0;let n=0;for(let o of e){let r=t.get(o.id);if(!r)continue;let i=o.commercial;i?.restrictedView!==void 0||i?.obstructedView!==void 0||(o.commercial={...i,[r.mark]:!0},n++)}return n}function Pr(e){return e?e.accessibility?.length?e.wheelchairSpaceType&&!e.accessibility.includes("wheelchair")?["wheelchair",...e.accessibility]:e.accessibility:e.wheelchairSpaceType?["wheelchair"]:e.accessible?["wheelchair"]:[]:[]}var lo=Math.PI/180;var In=16;function Ir(e,t,n,o){let r=n*lo,i=Math.cos(r),a=Math.sin(r);return{x:o.x+e*i-t*a,y:o.y+e*a+t*i}}function es(e){let{seatCount:t,seatSpacing:n,curve:o,rotation:r,origin:i}=e,a=[];if(e.path)return Fa(e.path,t);if(t<=1)return t===1&&a.push({x:i.x,y:i.y}),a;if(o===0){for(let u=0;u<t;u++)a.push(Ir(u*n,0,r,i));return a}let s=o/(t-1)*lo,c=n/(2*Math.sin(Math.abs(s)/2));for(let u=0;u<t;u++){let l=u*s,m=c*Math.sin(l),h=-c+c*Math.cos(l);a.push(Ir(m,h,r,i))}return a}function ts(e){let t=new Map;if(e.overrides)for(let n of e.overrides)t.set(n.index,n);return t}function yd(e,t){let n=ts(e);return es(e).map((o,r)=>{let i=n.get(r),a=Pr(i),s=Ba(e,r,i),c={...e.commercial,...i?.commercial};return{index:r,x:o.x+(i?.dx??0),y:o.y+(i?.dy??0),label:s,displayLabel:xr(e,r,t,i),categoryKey:i?.categoryKey??e.categoryKey,skipped:!!i?.skip,accessible:a.length>0,accessibility:a,wheelchairSpaceType:i?.wheelchairSpaceType,commercial:Object.values(c).some(u=>u!==void 0&&u!==!1&&u!=="")?c:void 0,glyph:i?.glyph,viewUrl:i?.viewFromSeatUrl??e.viewFromSeatUrl,viewMeta:i?.viewFromSeatUrl?i.viewFromSeatMeta:e.viewFromSeatMeta,labelStyle:i?.labelStyle??e.seatLabelStyle}})}function gd(e){let t=[];for(let n of yd(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 xd(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)),o={top:0,bottom:0,left:0,right:0};if(!n.length)return o;let r=Math.max(0,Math.round(e.seatCount));for(let i=0;i<r;i++)o[n[i%n.length]]+=1;return o}function vd(e){let t=[],n=Math.max(0,Math.round(e.seatCount));if(n===0)return t;let o=new Map((e.overrides??[]).map(l=>[l.index,l])),r=(l,m,h,f)=>{let d=o.get(l),p=Pr(d),b=d?.label??`${e.label}-${l+1}`,g=e.displayLabel??e.label;return{index:l,label:b,displayLabel:d?.displayLabel??`${g}-${l+1}`,x:m+(d?.dx??0),y:h+(d?.dy??0),categoryKey:d?.categoryKey??e.categoryKey,skipped:!!d?.skip,accessible:p.length>0,accessibility:p,wheelchairSpaceType:d?.wheelchairSpaceType,commercial:d?.commercial,glyph:d?.glyph,viewUrl:d?.viewFromSeatUrl,viewMeta:d?.viewFromSeatUrl?d.viewFromSeatMeta:void 0,labelStyle:d?.labelStyle,...f?{side:f}:{}}};if(e.shape==="round"){let l=(e.radius??40)+In,m=e.rotation*lo,h=Math.max(0,Math.min(360,e.seatArc??360));if(h>=360||n===1){for(let b=0;b<n;b++){let g=m+b/n*2*Math.PI;t.push(r(b,e.center.x+l*Math.cos(g),e.center.y+l*Math.sin(g)))}return t}let f=h*lo,d=(2*Math.PI-f)/2,p=m+d;for(let b=0;b<n;b++){let g=p+b/(n-1)*f;t.push(r(b,e.center.x+l*Math.cos(g),e.center.y+l*Math.sin(g)))}return t}let i=e.width??80,a=e.height??50,s=xd(e),c=["top","bottom","left","right"],u=0;for(let l of c){let m=s[l];for(let h=0;h<m;h++){let f,d;l==="top"?(f=-i/2+(h+.5)*i/m,d=-a/2-In):l==="bottom"?(f=-i/2+(h+.5)*i/m,d=a/2+In):l==="left"?(f=-i/2-In,d=-a/2+(h+.5)*a/m):(f=i/2+In,d=-a/2+(h+.5)*a/m);let p=Ir(f,d,e.rotation,e.center);t.push(r(u++,p.x,p.y,l))}}return t}function Md(e){return vd(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 Sd(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 qa(e,t){let n=!1;for(let o=0,r=t.length-1;o<t.length;r=o++){let i=t[o].x,a=t[o].y,s=t[r].x,c=t[r].y;a>e.y!=c>e.y&&e.x<(s-i)*(e.y-a)/(c-a)+i&&(n=!n)}return n}function wd(e,t){return t.some((n,o)=>{let r=t[(o+1)%t.length],i=(e.y-n.y)*(r.x-n.x)-(e.x-n.x)*(r.y-n.y);if(Math.abs(i)>1e-7)return!1;let a=(e.x-n.x)*(r.x-n.x)+(e.y-n.y)*(r.y-n.y),s=(r.x-n.x)**2+(r.y-n.y)**2;return a>=-1e-7&&a<=s+1e-7})}function Ar(e){return Array.isArray(e)?e.filter(t=>Array.isArray(t)&&t.length>=3):[]}function Oe(e,t,n){return qa(e,t)&&!Ar(n).some(o=>qa(e,o)||wd(e,o))}function co(e){if(!e.length)return{x:0,y:0};let t=0,n=0;for(let o of e)t+=o.x,n+=o.y;return{x:t/e.length,y:n/e.length}}function ns(e){switch(e.type){case"row":{let t=es(e),n=ts(e),o=0,r=0,i=0;for(let a=0;a<t.length;a++){let s=n.get(a);s?.skip||(o+=t[a].x+(s?.dx??0),r+=t[a].y+(s?.dy??0),i++)}return i?{x:o/i,y:r/i}:{x:e.origin.x,y:e.origin.y}}case"table":case"booth":return{x:e.center.x,y:e.center.y};case"gaArea":return co(e.points);case"section":return co(e.outline);case"text":return{x:e.position.x,y:e.position.y};case"shape":return e.points&&e.points.length?co(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 Za(e,t){return e.length===t.length&&e.every((n,o)=>n.x===t[o].x&&n.y===t[o].y)}function Pd(e,t){if(e.type!=="gaArea"||!Za(e.points,t.outline))return!1;let n=Ar(e.holes),o=Ar(t.holes);return n.length===o.length&&n.every((r,i)=>Za(r,o[i]))}function Id(e,t,n=e.filter(r=>r.type==="section"),o=ns(t)){let r="referenceInventorySource"in t?t.referenceInventorySource?.logicalSectionId:void 0;return(r?n.find(a=>(a.logicalSectionId??a.id)===r&&(Pd(t,a)||Oe(o,a.outline,a.holes))):void 0)??n.find(a=>Oe(o,a.outline,a.holes))}function $a(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 Qa(e,t,n,o,r,i,a,s,c){let u=[],l=e.filter(p=>p.type==="section"),m=Da(e),h=p=>!p?.eventConfigurationId||p.eventConfigurationId===o&&(p.eventConfigurationVersion===void 0||p.eventConfigurationVersion===c),f=p=>Ga(p,{activeConfigurationId:o,activeConfigurationVersion:c,activeBasisSha256:r,now:s}),d=(p,b)=>f(p)?{...p,coverage:b}:void 0;for(let p of e){let b=[];if(p.type==="row"?b=gd(p):p.type==="table"?b=Md(p):p.type==="booth"&&(b=Sd(p)),!b.length)continue;for(let M of b)M.viewUrl&&!h(M.viewMeta)&&(M.viewUrl=void 0,M.viewMeta=void 0);if(p.type==="row"){let M=m.get(p.id);if(M){let y=new Map((p.overrides??[]).map(P=>[P.index,P]));for(let P of b){let x=Number(P.id.slice(P.id.lastIndexOf(":")+1));if(!Number.isInteger(x))continue;P.logicalRowId=M.groupId,P.logicalSeatIndex=M.adjacencyOffset+x,y.get(x)?.displayLabel||(P.displayLabel=xr(p,x,M)),!P.viewUrl&&M.viewFromSeatUrl&&h(M.viewFromSeatMeta)&&(P.viewUrl=M.viewFromSeatUrl,P.viewMeta=M.viewFromSeatMeta);let S=y.get(x)?.confidenceEvidence;P.confidenceEvidence=d(S,"exact-seat")??d(p.confidenceEvidence,"row-representative")??d(M.confidenceEvidence,"row-representative")}}}let g=Id(e,p,l,p.type==="row"?co(b):ns(p)),v=g?.viewFromSeatUrl,R=(g?.zone?t?.find(M=>M.id===g.zone):void 0)?.focalPoint??n;for(let M of b){if(!M.confidenceEvidence){let y=Number(M.id.slice(M.id.lastIndexOf(":")+1)),P=(p.type==="row"||p.type==="table")&&Number.isInteger(y)?p.overrides?.find(x=>x.index===y)?.confidenceEvidence:void 0;M.confidenceEvidence=d(P,"exact-seat")??(p.type==="row"?d(p.confidenceEvidence,"row-representative"):void 0)}M.confidenceEvidence??=d(g?.confidenceEvidence,"section-representative")??(a?d(a.evidence,a.coverage):void 0),!M.viewUrl&&v&&h(g?.viewFromSeatMeta)&&(M.viewUrl=v,M.viewMeta=g?.viewFromSeatMeta),!M.viewUrl&&i&&h(i.meta)&&(M.viewUrl=i.url,M.viewMeta=i.meta),g&&(M.sectionId=g.logicalSectionId??g.id),g?.zone&&(M.zoneId=g.zone),R&&(M.focalPoint={...R})}u.push(...b)}return u}function Ut(e,t={}){if(e.floors?.length){let o=[];for(let r of e.floors){let i=r.focalPoint??e.focalPoint,a=r.viewFromSeatUrl?{url:r.viewFromSeatUrl,meta:r.viewFromSeatMeta}:e.viewFromSeatUrl?{url:e.viewFromSeatUrl,meta:e.viewFromSeatMeta}:void 0,s=r.confidenceEvidence?{evidence:r.confidenceEvidence,coverage:"floor-representative"}:e.confidenceEvidence?{evidence:e.confidenceEvidence,coverage:"venue-representative"}:void 0,c=Qa(r.objects,e.zones,i,e.eventConfigurationId,e.confidenceBasisSha256,a,s,t.now,t.eventConfigurationVersion??e.eventConfigurationVersion);t.resolveEyeHeights!==!1&&Ja(r.objects,r.focalPoint??e.focalPoint,r.baseHeightM??0,c);for(let u of c)u.floorId=r.id;for(let u of c)o.push(u)}return o}let n=Qa(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&&Ja(e.objects,e.focalPoint,t.floorBaseHeightM??0,n),Ad(e,n,t)}function Ad(e,t,n){return!n.deriveRestrictedView||e.derivedRestrictedView===!1||n.resolveEyeHeights===!1||Ka(t,Ya(t,Wa(e))),t}function Ja(e,t,n,o){let r=e.filter(m=>m.type==="section"),i=n>0||r.some(m=>m.height!==void 0||m.rake!==void 0||(m.elevation??0)>0);if(!r.length||!i||!t){for(let m of o)m.eyeHeightM=n+Je;return}let a=new Array(o.length),s=new Map;for(let m of r)s.has(m.id)||s.set(m.id,m);let c=new Map,u=new Map;for(let m=0;m<o.length;m++){let h=o[m],d=(h.sectionId?s.get(h.sectionId)??r.find(b=>b.logicalSectionId===h.sectionId&&Oe({x:h.x,y:h.y},b.outline,b.holes)):void 0)??r.find(b=>Oe({x:h.x,y:h.y},b.outline,b.holes))??null;if(a[m]=d,!d)continue;c.has(d.id)||c.set(d.id,bt(d,{floorBaseHeightM:n}));let p=u.get(d.id);p?p.push(m):u.set(d.id,[m])}let l=new Array(o.length).fill(void 0);for(let[m,h]of u){let f=c.get(m);if(!f)continue;let d=f.rake>0?Math.tan(f.rake*Math.PI/180):0,p=so(m,o,h,t);for(let b of p.rows){let g=b.blockDepth*le*d,v=f.height+g;for(let w of b.seatIndices)l[w]=v}}for(let m=0;m<o.length;m++){let h=o[m],f=a[m];if(!f){h.eyeHeightM=n+Je;continue}let d=c.get(f.id);h.eyeHeightM=(l[m]??d.height)+Je}}function os(e){let t=1/0,n=1/0,o=-1/0,r=-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>o&&(o=a.x),a.y>r&&(r=a.y));return i?{minX:t,minY:n,maxX:o,maxY:r}:null}function jt(e,t){return e.minX<=t.maxX&&t.minX<=e.maxX&&e.minY<=t.maxY&&t.minY<=e.maxY}function An(e){if(e.length<3)return e.map(i=>({...i}));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),o=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},r=[...o(t),...o([...t].reverse())];return r.length>=3?r.map(i=>({...i})):t.map(i=>({...i}))}var ws=at(require("polygon-clipping"),1);var re={top:1,wallBottom:.58,bottomCap:.4};function Lt(e,t){if(!e)return t;let n=se(Ke(e,.4),.62);return pe(t,n,.22)}function rs(e,t){return e?pe(t,se(Ke(e,.25),.74),.62):t}function is(e,t){return e?pe(t,se(Ke(e,.08),.9),.82):t}function as(e,t){let n=new Map;for(let i of e.categories??[])n.set(i.key,i.color);let o=new Map;for(let i of t){if(!i.sectionId)continue;let a=o.get(i.sectionId);a||(a=new Map,o.set(i.sectionId,a)),a.set(i.categoryKey,(a.get(i.categoryKey)??0)+1)}let r=new Map;for(let[i,a]of o){let s=0,c=0,u=0,l=0;for(let[m,h]of a){let f=he(n.get(m));f&&(s+=f[0]*h,c+=f[1]*h,u+=f[2]*h,l+=h)}l>0&&r.set(i,[s/l,c/l,u/l])}return r}function ss(e,t){return he(e.color)??t.get(e.logicalSectionId??e.id)??null}var _r=at(require("polygon-clipping"),1);var Cr=at(require("polygon-clipping"),1);var ms=at(require("earcut"),1);var Rd=.58,cs=.01,We=st*1.5*Xe,Ed=.5,Cd=.6;function _d(e,t){let n=e.length,o=[];for(let a=0;a<n;a++){let s=e[Math.max(0,a-1)],c=e[Math.min(n-1,a+1)],u=c.x-s.x,l=c.y-s.y,m=Math.hypot(u,l);if(m<1e-9){o.push([0,0]);continue}u/=m,l/=m,o.push([-l,u])}let r=0;for(let a=0;a<n;a++)r+=(e[a].x-t.x)*o[a][0]+(e[a].y-t.y)*o[a][1];return r<0?o.map(([a,s])=>[-a,-s]):o}function Td(e,t){if(e.length<2||t<=0)return[...e];let n=[...e],o=(a,s)=>{let c=s.x-a.x,u=s.y-a.y,l=Math.hypot(c,u)||1;return{x:c/l,y:u/l}},r=o(n[1],n[0]),i=o(n[n.length-2],n[n.length-1]);return n.unshift({x:n[0].x+r.x*t,y:n[0].y+r.y*t}),n.push({x:n[n.length-1].x+i.x*t,y:n[n.length-1].y+i.y*t}),n}var ls=Math.PI/12;function kd(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),o=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},r=[...o(t),...o([...t].reverse())];return r.length>=3?r:[...e]}function fs(e,t){if(!e.length||!(t>0))return[];let n=kd(e),o=(s,c,u,l)=>{let m=u-c;for(;m<0;)m+=Math.PI*2;for(;m>Math.PI*2;)m-=Math.PI*2;let h=Math.max(1,Math.ceil(m/ls)),f=t/Math.cos(m/h/2);for(let d=0;d<=h;d++){let p=c+m*d/h;l.push({x:s.x+Math.cos(p)*f,y:s.y+Math.sin(p)*f})}};if(n.length<3){let s=0,c=0;for(let f of n)s+=f.x,c+=f.y;s/=n.length||1,c/=n.length||1;let u=0;for(let f of n)u=Math.max(u,Math.hypot(f.x-s,f.y-c));let l=[],m=Math.max(3,Math.ceil(Math.PI*2/ls)),h=(u+t)/Math.cos(Math.PI/m);for(let f=0;f<m;f++){let d=f/m*Math.PI*2;l.push({x:s+Math.cos(d)*h,y:c+Math.sin(d)*h})}return l}let r=n.length,i=[];for(let s=0;s<r;s++){let c=n[s],u=n[(s+1)%r];i.push(Math.atan2(-(u.x-c.x),u.y-c.y))}let a=[];for(let s=0;s<r;s++)o(n[s],i[(s+r-1)%r],i[s],a);return ys(a)}function Ld(e,t,n){if(e.length===1)return Math.hypot(t-e[0].x,n-e[0].y);let o=1/0;for(let r=0;r+1<e.length;r++){let i=e[r],a=e[r+1],s=a.x-i.x,c=a.y-i.y,u=s*s+c*c,l=u>1e-12?((t-i.x)*s+(n-i.y)*c)/u:0;l<0?l=0:l>1&&(l=1);let m=Math.hypot(t-(i.x+l*s),n-(i.y+l*c));m<o&&(o=m)}return o}function uo(e){let t=e.map(r=>{let i=0,a=0;for(let u of r.pts)i+=u.x,a+=u.y;let s=r.pts.length||1;i/=s,a/=s;let c=0;for(let u of r.pts){let l=Math.hypot(u.x-i,u.y-a);l>c&&(c=l)}return{cx:i,cy:a,rad:c}}),n=r=>{let i=r.length;return i<=2?[...r]:[r[Math.floor(i*.25)],r[Math.floor(i*.5)],r[Math.floor(i*.75)]]},o=[];for(let r=0;r<e.length;r++){let i=n(e[r].pts),a=[],s=1/0,c=null;for(let l of i){let m=1/0;for(let h=0;h<e.length;h++){if(h===r||Math.abs(e[h].y-e[r].y)<.001)continue;let f=t[h],d=Math.hypot(l.x-f.cx,l.y-f.cy)-f.rad;if(d>=m&&d>=s)continue;let p=Ld(e[h].pts,l.x,l.y);p<m&&(m=p),e[h].depth<e[r].depth&&p<s&&(s=p,c=e[h].y)}Number.isFinite(m)&&m>0&&a.push(m)}a.sort((l,m)=>l-m);let u=a.length?a[Math.floor(a.length/2)]:1;o.push({pitch:u,belowY:c})}return o}function ds(e,t,n,o){let r=e[t],i=r.pts.length>=2?[...r.pts]:r.pts.length===1?(()=>{let l=r.pts[0],m=l.x-o.x,h=l.y-o.y,f=Math.hypot(m,h)||1;m/=f,h/=f;let d=Math.max(n[t].pitch,.001)*.5;return[{x:l.x+h*d,y:l.y-m*d},{x:l.x-h*d,y:l.y+m*d}]})():[];if(i.length<2)return null;let a=0,s=0;for(let l=1;l<i.length;l++){let m=Math.hypot(i[l].x-i[l-1].x,i[l].y-i[l-1].y);m>1e-6&&(a+=m,s++)}let c=s>0?a/s:0,u=Td(i,Math.max(c*Cd,We));return{pts:u,nrm:_d(u,o),front:Math.max(n[t].pitch*Rd,We),back:Math.max(n[t].pitch*Ed,We)}}var Xt=1.5,hs=.3;function Rr(e,t){if(e.length<3)return e;let n=e[0],o=e[e.length-1],r=o.x-n.x,i=o.y-n.y,a=Math.hypot(r,i),s=-1,c=-1;for(let m=1;m<e.length-1;m++){let h=e[m],f=a>1e-12?Math.abs((h.x-n.x)*i-(h.y-n.y)*r)/a:Math.hypot(h.x-n.x,h.y-n.y);f>s&&(s=f,c=m)}if(s<=t||c<0)return[n,o];let u=Rr(e.slice(0,c+1),t),l=Rr(e.slice(c),t);return[...u.slice(0,-1),...l]}function ps(e,t){if(e.length<4)return e;let n=Rr([...e,e[0]],t);return n.pop(),n.length>=3?n:e}function Od(e){let t=e.map((o,r)=>{let i=e[(r+1)%e.length];return{a:o,b:i,i:r,minX:Math.min(o.x,i.x),maxX:Math.max(o.x,i.x),minY:Math.min(o.y,i.y),maxY:Math.max(o.y,i.y)}}).sort((o,r)=>o.minX-r.minX),n=(o,r,i)=>(r.x-o.x)*(i.y-o.y)-(r.y-o.y)*(i.x-o.x);for(let o=0;o<t.length;o++){let r=t[o];for(let i=o+1;i<t.length&&t[i].minX<=r.maxX;i++){let a=t[i];if(!(Math.abs(r.i-a.i)===1||Math.abs(r.i-a.i)===e.length-1||r.maxY<a.minY||a.maxY<r.minY)&&n(r.a,r.b,a.a)*n(r.a,r.b,a.b)<=0&&n(a.a,a.b,r.a)*n(a.a,a.b,r.b)<=0)return!0}}return!1}function bs(e,t,n){if(e.length<2)return[];let o=n??uo(e),r=new Map;for(let a=0;a<e.length;a++){let s=r.get(e[a].blockId);s?s.push(a):r.set(e[a].blockId,[a])}let i=[];for(let[,a]of r){let s=[];for(let v of a){let w=e[v].patch;w&&w.length>=3?i.push({outline:[...w],holes:[],topY:e[v].y}):s.push(v)}if(!s.length)continue;s.sort((v,w)=>e[v].depth-e[w].depth);let u=s.map(v=>ds(e,v,o,t)).filter(v=>v!==null);if(!u.length)continue;let l=(v,w)=>({x:v.pts[w].x-v.nrm[w][0]*(v.front+Xt),y:v.pts[w].y-v.nrm[w][1]*(v.front+Xt)}),m=(v,w)=>({x:v.pts[w].x+v.nrm[w][0]*(v.back+Xt),y:v.pts[w].y+v.nrm[w][1]*(v.back+Xt)}),h=u[0],f=u[u.length-1],d=[];for(let v=0;v<h.pts.length;v++)d.push(l(h,v));for(let v of u)d.push(m(v,v.pts.length-1));for(let v=f.pts.length-1;v>=0;v--)d.push(m(f,v));for(let v=u.length-1;v>=0;v--)d.push(l(u[v],0));let p=ys(d),b=1/0;for(let v of s)e[v].y<b&&(b=e[v].y);if(!Number.isFinite(b))continue;if(p.length>=3&&Math.abs(Ve(p))>1e-6&&u.every(v=>{let w=v.pts[Math.floor(v.pts.length/2)];return He(p,w.x,w.y)})&&!Od(p)){i.push({outline:ps(p,hs),holes:[],topY:b});continue}for(let v of Fd(u))i.push({outline:v,holes:[],topY:b})}return i}function Fd(e){let t=[];for(let n of e){let o=[],r=[],i=n.front+Xt,a=n.back+Xt;for(let c=0;c<n.pts.length;c++){let u=n.pts[c],l=n.nrm[c];o.push([u.x-l[0]*i,u.y-l[1]*i]),r.push([u.x+l[0]*a,u.y+l[1]*a])}let s=[...o,...r.reverse()];s.length<3||(s.push(s[0]),t.push([s]))}if(!t.length)return[];try{let n=Cr.default.union(t[0],...t.slice(1)),o=[];for(let r of n){if(!r.length||r[0].length<4)continue;let i=r[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&&o.push(ps(i,hs))}return o}catch{return[]}}function ys(e){let t=[];for(let n of e){let o=t[t.length-1];o&&Math.hypot(n.x-o.x,n.y-o.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 Er=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 o of n)o.x<this.minX&&(this.minX=o.x),o.y<this.minY&&(this.minY=o.y),o.x>this.maxX&&(this.maxX=o.x),o.y>this.maxY&&(this.maxY=o.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 o=!0;for(let r of t)if(!He(n,r.x,r.y)){o=!1;break}if(o)return!0}return!1}};function us(e,t,n,o,r,i){if(o.length<3)return;if(n.containsAll(o)){let u=[0,1,0],l=o[0];for(let m=1;m+1<o.length;m++){let h=o[m],f=o[m+1];e.tri([l.x*T,r,l.y*T],[h.x*T,r,h.y*T],[f.x*T,r,f.y*T],u,i)}return}let a=o.map(u=>[u.x,u.y]);a.push(a[0]);let s;try{s=Cr.default.intersection([a],t)}catch{return}let c=[0,1,0];for(let u of s){if(!u.length||u[0].length<4)continue;let l=u[0],m=[],h=[];for(let d=0;d<l.length-1;d++)m.push(l[d][0],l[d][1]),h.push([l[d][0],l[d][1]]);if(h.length<3)continue;let f=(0,ms.default)(m,void 0,2);for(let d=0;d<f.length;d+=3){let p=h[f[d]],b=h[f[d+1]],g=h[f[d+2]];e.tri([p[0]*T,r,p[1]*T],[b[0]*T,r,b[1]*T],[g[0]*T,r,g[1]*T],c,i)}}}function gs(e,t,n,o,r,i,a){if(t.length<2)return;let s=a??uo(t),c=[0,1,0],u=i&&i.length>=3?[[...i.map(f=>[f.x,f.y]),[i[0].x,i[0].y]]]:null,l=i&&i.length>=3?new Er([[...i]]):null,m=f=>{e.setMaterial(2),f(),e.setMaterial(0)},h=f=>{e.setMaterial(3),f(),e.setMaterial(0)};for(let f=0;f<t.length;f++){let d=t[f];if(d.patch&&d.patch.length>=3){let M=[...d.patch],y=s[f].belowY??o;if(h(()=>{if(u&&l)us(e,u,l,M,d.y,r.tread);else{let P=M[0];for(let x=1;x+1<M.length;x++){let S=M[x],A=M[x+1];e.tri([P.x*T,d.y,P.y*T],[S.x*T,d.y,S.y*T],[A.x*T,d.y,A.y*T],c,r.tread)}}}),d.y>y+cs){let P=0,x=0;for(let S of M)P+=S.x,x+=S.y;P/=M.length,x/=M.length,m(()=>{for(let S=0;S<M.length;S++){let A=M[S],_=M[(S+1)%M.length],D=_.x-A.x,E=_.y-A.y,I=Math.hypot(D,E);if(I<1e-6)continue;let k=E/I,L=-D/I;(A.x-P)*k+(A.y-x)*L<0&&(k=-k,L=-L);let B=[k,0,L],F=[A.x*T,d.y,A.y*T],V=[_.x*T,d.y,_.y*T],N=[A.x*T,y,A.y*T],C=[_.x*T,y,_.y*T];e.tri(F,V,C,B,r.riser),e.tri(F,C,N,B,r.riser)}})}continue}let p=ds(t,f,s,n);if(!p)continue;let{pts:b,nrm:g,front:v,back:w}=p,R=s[f].belowY??o;for(let M=0;M+1<b.length;M++){let y=b[M],P=b[M+1],x=g[M],S=g[M+1];if(Math.hypot(P.x-y.x,P.y-y.y)<1e-6||x[0]===0&&x[1]===0||S[0]===0&&S[1]===0)continue;let A=[(y.x-x[0]*v)*T,d.y,(y.y-x[1]*v)*T],_=[(P.x-S[0]*v)*T,d.y,(P.y-S[1]*v)*T],D=[(y.x+x[0]*w)*T,d.y,(y.y+x[1]*w)*T],E=[(P.x+S[0]*w)*T,d.y,(P.y+S[1]*w)*T];if(h(()=>{u&&l?us(e,u,l,[{x:y.x-x[0]*v,y:y.y-x[1]*v},{x:P.x-S[0]*v,y:P.y-S[1]*v},{x:P.x+S[0]*w,y:P.y+S[1]*w},{x:y.x+x[0]*w,y:y.y+x[1]*w}],d.y,r.tread):(e.tri(A,_,E,c,r.tread),e.tri(A,E,D,c,r.tread))}),d.y>R+cs){let I=[A[0],R,A[2]],k=[_[0],R,_[2]],L=[-x[0],0,-x[1]];m(()=>{e.tri(A,_,k,L,r.riser),e.tri(A,k,I,L,r.riser)})}}}}function Dd(e,t){let n=e.eventConfigurationIds;return!n?.length||!!t&&n.includes(t)}function xs(e,t){return e.filter(n=>n.type!=="shape"||Dd(n,t))}function vs(e,t){let n=e.focalPoint??{x:0,y:0};return e.floors?.length?e.floors.map((o,r)=>({objects:xs(o.objects,t),focal:{x:(o.focalPoint??n).x,y:(o.focalPoint??n).y},baseHeightM:o.baseHeightM??0,index:r})):[{objects:xs(e.objects,t),focal:n,baseHeightM:0,index:0}]}var Nd={minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};function lt(e){return os(e)??Nd}function Ms(e,t){let n=$e(e.outline,We),o=lt(n),r=t.filter(a=>a!==e&&a.outline&&a.outline.length>=3&&jt(o,lt(a.outline)));if(!r.length)return[n];let i=a=>{let s=a.map(c=>[c.x,c.y]);return s.push(s[0]),s};try{let a=_r.default.difference([i(n)],...r.map(c=>[i(c.outline)])),s=[];for(let c of a){if(!c.length)continue;let u=c[0].map(([l,m])=>({x:l,y:m}));if(u.length>1){let l=u[0],m=u[u.length-1];Math.abs(l.x-m.x)<1e-9&&Math.abs(l.y-m.y)<1e-9&&u.pop()}u.length>=3&&s.push(u)}return s.length?s:[n]}catch{return[n]}}function Ss(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},o=t.map(i=>[n(i)]),r=[];for(let i of e){let a;try{a=_r.default.intersection([n(i.outline)],o.flat())}catch{r.push(i);continue}for(let s of a){if(!s.length)continue;let c=s[0].map(([u,l])=>({x:u,y:l}));if(c.length>1){let u=c[0],l=c[c.length-1];Math.abs(u.x-l.x)<1e-9&&Math.abs(u.y-l.y)<1e-9&&c.pop()}c.length>=3&&r.push({outline:c,holes:[],topY:i.topY})}}return r.length?r:e}function Bd(e,t){return e===void 0||t===void 0?!0:Math.abs(e-t)<.001}var mo=class{constructor(){this.rings=[];this.boxes=[];this.levels=[]}subtract(t,n){let o=t.map(c=>[c.x,c.y]);if(o.length<3)return[];o.push(o[0]);let r=lt(t),i=this.rings.filter((c,u)=>jt(r,this.boxes[u])&&Bd(n,this.levels[u])),a=[[o]];if(i.length)try{a=ws.default.difference([o],...i).map(u=>u.map(l=>l.map(([m,h])=>[m,h])))}catch{a=[[o]]}this.rings.push([o]),this.boxes.push(r),this.levels.push(n);let s=[];for(let c of a){if(!c.length)continue;let u=c[0].map(([l,m])=>({x:l,y:m}));if(u.length>1){let l=u[0],m=u[u.length-1];Math.abs(l.x-m.x)<1e-9&&Math.abs(l.y-m.y)<1e-9&&u.pop()}u.length>=3&&s.push(u)}return s}};function fo(e,t){if(!t)return e;let n=1/0,o=-1/0,r=1/0,i=-1/0;for(let m of e)n=Math.min(n,m.x),o=Math.max(o,m.x),r=Math.min(r,m.y),i=Math.max(i,m.y);let a=(n+o)/2,s=(r+i)/2,c=t*Math.PI/180,u=Math.cos(c),l=Math.sin(c);return e.map(m=>{let h=m.x-a,f=m.y-s;return{x:a+h*u-f*l,y:s+h*l+f*u}})}function ve(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=vn(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,o=(e.y??0)+e.height/2;t=no(n,o,e.width/2,e.height/2)}return t?fo(t,e.rotation):null}function qe(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}},o=t==="stage"&&wn(e.stageKind)?{kind:"stage",heightM:e.stageKind==="ring-boxing"?ro:.06}:n[t]??{kind:"plate",heightM:.25};return{...o,heightM:e.heightM??o.heightM}}var Vd=.08,Hd=30,Gd=.015;function zd(e,t){let n=!1;for(let o=0,r=t.length-1;o<t.length;r=o++){let i=t[o],a=t[r];i.y>e.y!=a.y>e.y&&e.x<(a.x-i.x)*(e.y-i.y)/(a.y-i.y)+i.x&&(n=!n)}return n}function Ps(e,t){let n=ve(e)??(e.points?.length?fo(e.points,e.rotation):null),o=qe(e),i=!e.role&&o.kind==="plate"&&e.heightM===void 0&&!!n&&Math.abs(Ve(n))*le**2>=Hd?Gd:o.heightM;if(!n)return{topOffsetM:i,supportOffsetM:0};if(o.kind!=="plate"&&o.kind!=="stage")return{topOffsetM:i,supportOffsetM:0};let a=1/0,s=1/0,c=-1/0,u=-1/0;for(let f of n)a=Math.min(a,f.x),s=Math.min(s,f.y),c=Math.max(c,f.x),u=Math.max(u,f.y);let l=i,m=0,h=1e-6*Math.max(1,c-a,u-s);for(let f of t)c>f.minX&&a<f.maxX&&u>f.minY&&s<f.maxY&&l<=f.topOffsetM+1e-6&&(l=f.topOffsetM+Vd),a>=f.minX-h&&c<=f.maxX+h&&s>=f.minY-h&&u<=f.maxY+h&&(!f.poly||n.every(b=>zd(b,f.poly)||Ud(b,f.poly,h)))&&(m=Math.max(m,f.topOffsetM));return e.fill&&e.fill!=="none"&&e.fill!=="transparent"&&t.push({minX:a,minY:s,maxX:c,maxY:u,topOffsetM:l,poly:n}),{topOffsetM:l,supportOffsetM:Math.min(m,l)}}function Ud(e,t,n){for(let o=0,r=t.length-1;o<t.length;r=o++){let i=t[r],a=t[o],s=a.x-i.x,c=a.y-i.y,u=s*s+c*c,l=u?Math.max(0,Math.min(1,((e.x-i.x)*s+(e.y-i.y)*c)/u)):0;if(Math.hypot(e.x-(i.x+l*s),e.y-(i.y+l*c))<=n)return!0}return!1}function xt(e,t,n){return{x:e.x+(t.x-e.x)*n,y:e.y+(t.y-e.y)*n}}function Ge(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 Te(e,t,n){return[xt(e[0],e[1],t),xt(e[0],e[1],n),xt(e[3],e[2],n),xt(e[3],e[2],t)]}function Rn(e,t,n){return[xt(e[0],e[3],t),xt(e[1],e[2],t),xt(e[1],e[2],n),xt(e[0],e[3],n)]}function de(e,t,n,o,r,i){ce(e,t,void 0,()=>n,o,r,i,re)}var jd=.8,Xd=.6,Wd=2;function Wt(e,t){if(!t.length)return null;let n=[],o=0;for(let a of e.objects){if(a.type!=="shape"||a.role!=="wall")continue;let s=ve(a)??[],c=Is(s)/2;!(c>0)||$d(s)/c*T>Wd||(n.push(...s),o+=c)}if(n.length<3)return null;let r=An(n);if(r.length<3||o<Is(r)*Xd)return null;let i=0;for(let a of t)qd(a,r)&&(i+=1);return i>=t.length*jd?r:null}var As=6,Yd=5,Kd=8;function Rs(e){return Math.max(Kd,(Number.isFinite(e)?e:0)+Yd)}function Es(e){let t=0,n=0,o=0;for(let r=0;r<e.length;r++){let i=e[r],a=e[(r+1)%e.length],s=i.x*a.y-a.x*i.y;t+=s,n+=(i.x+a.x)*s,o+=(i.y+a.y)*s}if(Math.abs(t)<1e-9){let r=0,i=0;for(let a of e)r+=a.x,i+=a.y;return{x:r/Math.max(1,e.length),y:i/Math.max(1,e.length)}}return{x:n/(3*t),y:o/(3*t)}}function $d(e){let t=0;for(let n=0;n<e.length;n++){let o=e[n],r=e[(n+1)%e.length];t+=o.x*r.y-r.x*o.y}return Math.abs(t)/2}function Is(e){let t=0;for(let n=0;n<e.length;n++){let o=e[n],r=e[(n+1)%e.length];t+=Math.hypot(r.x-o.x,r.y-o.y)}return t}function qd(e,t){let n=!1;for(let o=0,r=t.length-1;o<t.length;r=o++){let i=t[o],a=t[r];i.y>e.y!=a.y>e.y&&e.x<(a.x-i.x)*(e.y-i.y)/(a.y-i.y)+i.x&&(n=!n)}return n}function Zd(e){return{kind:"radial",rowCount:0,rows:[],nearestRow:()=>-1,depthAt:(t,n)=>Math.hypot(t-e.x,n-e.y),gradientAt:(t,n)=>{let o=t-e.x,r=n-e.y,i=Math.hypot(o,r);return i<1e-9?[0,0]:[o/i,r/i]}}}function Qd(e,t){if(!e.length)return null;let n=0,o=0,r=0;for(let f of e)n+=f.x,o+=f.y,r+=Math.hypot(f.x-t.x,f.y-t.y);let i=e.length;n/=i,o/=i,r/=i;let a=e[0],s=-1;for(let f of e){let d=Math.hypot(f.x-n,f.y-o);d>s&&(s=d,a=f)}let c=a.x-n,u=a.y-o,l=Math.hypot(c,u);l>1e-9?(c/=l,u/=l):(c=1,u=0);let m=[...e].sort((f,d)=>(f.x-n)*c+(f.y-o)*u-((d.x-n)*c+(d.y-o)*u)),h=0;for(let f of m){let d=Math.hypot(f.x-n,f.y-o);d>h&&(h=d)}return{pts:m,cx:n,cy:o,radius:h,depth:r}}function Cs(e,t,n){let o=e.pts;if(o.length===1)return Math.hypot(t-o[0].x,n-o[0].y);let r=1/0;for(let i=0;i+1<o.length;i++){let a=o[i],s=o[i+1],c=s.x-a.x,u=s.y-a.y,l=c*c+u*u,m=l>1e-12?((t-a.x)*c+(n-a.y)*u)/l:0;m<0?m=0:m>1&&(m=1);let h=Math.hypot(t-(a.x+m*c),n-(a.y+m*u));h<r&&(r=h)}return r}var ho=8;function Jd(e,t,n){let o=new Array(ho).fill(1/0),r=new Array(ho).fill(-1);for(let l=0;l<e.length;l++){let m=e[l],h=Math.hypot(t-m.cx,n-m.cy)-m.radius;for(let f=0;f<ho;f++)if(h<o[f]){for(let d=ho-1;d>f;d--)o[d]=o[d-1],r[d]=r[d-1];o[f]=h,r[f]=l;break}}let i=new Array(3).fill(1/0),a=new Array(3).fill(-1);for(let l of r){if(l<0)continue;let m=Cs(e[l],t,n);for(let h=0;h<3;h++)if(m<i[h]){for(let f=2;f>h;f--)i[f]=i[f-1],a[f]=a[f-1];i[h]=m,a[h]=l;break}}if(a[0]<0)return 0;if(i[0]<1e-6)return e[a[0]].depth;let s=i[0]*2.2,c=0,u=0;for(let l=0;l<3;l++){let m=a[l];if(m<0||i[l]>s)continue;let h=1/(i[l]*i[l]);c+=h*e[m].depth,u+=h}return u>0?c/u:e[a[0]].depth}function eh(e){let t=(o,r)=>Jd(e,o,r),n=(o,r)=>{let i=1/0,a=-1;for(let s=0;s<e.length;s++){let c=e[s];if(Math.hypot(o-c.cx,r-c.cy)-c.radius>=i)continue;let u=Cs(c,o,r);u<i&&(i=u,a=s)}return a};return{kind:"rows",rowCount:e.length,rows:e,nearestRow:n,depthAt:t,gradientAt:(o,r)=>{let i=(t(o+.5,r)-t(o-.5,r))/1,a=(t(o,r+.5)-t(o,r-.5))/(2*.5),s=Math.hypot(i,a);return s<1e-9?[0,0]:[i/s,a/s]}}}function _s(e,t){let n=[];for(let o of e){let r=Qd(o.points,t);r&&n.push(r)}return n.length<2?Zd(t):(n.sort((o,r)=>o.depth-r.depth),eh(n))}var vt=.06,th=.05,ks=.05,Ts=.15,Tr=25;function Ls(e,t,n){let o=new Map,r=new Array(t.length).fill(null),i=new Float64Array(t.length),a=new Array(t.length).fill(void 0),s=new Array(t.length).fill(void 0),c=new Map,u=[],l=new Set;for(let h=0;h<e.length;h+=1){let f=e[h];for(let d of f.objects){if(d.type==="table"&&l.add(d.id),d.type!=="section"||!d.outline||d.outline.length<3)continue;let p=$e(d.outline,We);c.set(d.id,{section:d,unit:f,frontU:1/0,hasSeats:!1,rows:new Map,seatIndices:[]}),u.push({id:d.id,floorIndex:h,box:lt(p),section:d,unit:f,outline:p})}}let m=new Map;for(let h of u){let f=m.get(h.floorIndex);f?f.push(h):m.set(h.floorIndex,[h])}for(let h=0;h<t.length;h++){let f=t[h],d=n?m.get(n[h])??[]:u,p=f.sectionId?d.find(g=>g.id===f.sectionId)??d.find(g=>g.section.logicalSectionId===f.sectionId&&Oe({x:f.x,y:f.y},g.outline,g.section.holes)):void 0,b=p?[p]:d;for(let g of b){if(n&&g.floorIndex!==n[h]||!p&&(f.x<g.box.minX||f.x>g.box.maxX||f.y<g.box.minY||f.y>g.box.maxY||!Oe({x:f.x,y:f.y},g.outline,g.section.holes)))continue;r[h]=g.id;let v=c.get(g.id);v.hasSeats=!0;let w=f.focalPoint??g.unit.focal,R=Math.hypot(f.x-w.x,f.y-w.y);R<v.frontU&&(v.frontU=R),v.seatIndices.push(h);let M=f.rowId||`__seat-${h}`,y=v.rows.get(M);y?y.push({x:f.x,y:f.y}):v.rows.set(M,[{x:f.x,y:f.y}]);break}}for(let[h,f]of c){let d=bt(f.section,{floorBaseHeightM:f.unit.baseHeightM}),p=f.unit.baseHeightM,b=d.rake>0?Math.tan(d.rake*Math.PI/180):0,g=d.rake<=.01&&d.height<=p+.001,v=f.section.surfaceKind,w=v==="flat"?!0:v==="rakedRows"&&d.rake>.01?!1:g,R=f.hasSeats?so(h,t,f.seatIndices,f.unit.focal):{sectionId:h,rows:[],blockCount:0},y=R.rows.length<2?_s([...f.rows.values()].map(F=>({points:F})),f.unit.focal):null,P=1/0;if(y){if(f.hasSeats)for(let F of f.rows.values())for(let V of F){let N=y.depthAt(V.x,V.y);N<P&&(P=N)}if(!f.hasSeats||!Number.isFinite(P)){P=1/0;for(let F of f.section.outline){let V=y.depthAt(F.x,F.y);V<P&&(P=V)}}}let x=p+th,S=Math.max(x,d.height),A=F=>{let V=Math.max(0,F-P)*le,N=Math.min(V*b,Tr);return Math.max(x,d.height+N)},_=F=>{let V=Math.max(0,F)*le,N=Math.min(V*b,Tr);return Math.max(x,d.height+N)},D=w?[]:R.rows.map(F=>({pts:F.pts,y:_(F.blockDepth),depth:F.blockDepth,blockId:F.blockId,...l.has(F.id)?{patch:fs(F.pts,We)}:{}})),E=D.length?D[0].y:S,I=D.map(F=>{let V=F.patch&&F.patch.length>=3?F.patch:F.pts,N=0,C=0;for(let j of V)N+=j.x,C+=j.y;let O=V.length||1;N/=O,C/=O;let G=0;for(let j of V){let H=Math.hypot(j.x-N,j.y-C);H>G&&(G=H)}return{cx:N,cy:C,rad:G}}),k=w?()=>S:D.length>=2?(F,V)=>{let N=1/0,C=E;for(let O=0;O<D.length;O++){let G=I[O];if(Math.hypot(F-G.cx,V-G.cy)-G.rad>=N)continue;let j=D[O].patch,H=j&&j.length>=3?He(j,F,V)?0:Gt(j,F,V):Gt(D[O].pts,F,V);H<N&&(N=H,C=D[O].y)}return C}:(F,V)=>y?A(y.depthAt(F,V)):S,L=[0,1,0],B=D.length>=2||w?()=>L:(F,V)=>{if(!y)return L;let N=y.depthAt(F,V);if(N<=P)return L;let C=(N-P)*le;if(C*b>=Tr||d.height+C*b<=x)return L;let[O,G]=y.gradientAt(F,V);if(O===0&&G===0)return L;let j=1/Math.hypot(b,1);return[-O*b*j,j,-G*b*j]};if(!w)for(let F of R.rows){let V=_(F.blockDepth);for(let N of F.seatIndices)a[N]=V}for(let F of R.rows){let V=[];for(let j=1;j<F.pts.length;j++){let H=Math.hypot(F.pts[j].x-F.pts[j-1].x,F.pts[j].y-F.pts[j-1].y);H>1e-6&&V.push(H)}V.sort((j,H)=>j-H);let N=V.length?V[Math.floor(V.length/2)]:1/0,C=1/0,O=F.pts[Math.floor(F.pts.length/2)];if(O)for(let j of R.rows){if(j===F||j.blockId!==F.blockId)continue;let H=Gt(j.pts,O.x,O.y);H>1e-6&&H<C&&(C=H)}let G=Math.min(N,Math.max(C,N*.5));if(Number.isFinite(G)&&G>0)for(let j of F.seatIndices)s[j]=G}o.set(h,{sectionId:h,deckAt:k,normalAt:B,flat:w,bottomY:p,rowLevels:D,landingY:E})}for(let h=0;h<t.length;h++){let f=r[h],d=t[h];if(f){let g=a[h];i[h]=(g??o.get(f).deckAt(d.x,d.y))+Ts;continue}let p=d.eyeHeightM,b=Number.isFinite(p)?Math.max(0,p-Je):0;i[h]=d.kind==="booth"?b+vt+Ts:b}return{bySection:o,seatOwner:r,seatDeckY:h=>i[h],seatPitchU:h=>s[h]}}function Yt(e,t,n){if(e.length!==4||n<=t)return null;let o=Ge(e),r=Math.hypot(o[1].x-o[0].x,o[1].y-o[0].y)*T,i=Math.hypot(o[3].x-o[0].x,o[3].y-o[0].y)*T;if(r<1e-6||i<1e-6)return null;let a=Math.min(.22/r,.16),s=Math.min(.28,(n-t)*.13),c=Math.min(.065/i,.2);return{quad:o,side:a,face:c,opening:Te(o,a,1-a),openingTop:n-s}}function kr(e,t,n){if(e.length!==4||n-t<=.2)return null;let o=Ge(e),r=Math.hypot(o[1].x-o[0].x,o[1].y-o[0].y)*T;if(r<=1e-6)return null;let i=Math.min(.14,(n-t)*.08,r*.08),a=i/r,s=Te(o,a,1-a);return{quad:o,side:a,trim:i,inner:s,panel:Rn(s,.15,.85),bottom:t+i,top:n-i}}function Os(e,t,n,o){let r=kr(e,t,n);if(!r)return;let{panel:i}=r,a=(v,w)=>({x:(v.x+w.x)/2,y:(v.y+w.y)/2}),s=a(i[0],i[1]),c=a(i[3],i[2]),u=Math.hypot(s.x-o.x,s.y-o.y)<=Math.hypot(c.x-o.x,c.y-o.y),[l,m]=u?[i[0],i[1]]:[i[3],i[2]],h=u?{x:s.x-c.x,y:s.y-c.y}:{x:c.x-s.x,y:c.y-s.y},f=Math.hypot(h.x,h.y);if(f<1e-6)return;-(m.y-l.y)*h.x+(m.x-l.x)*h.y<0&&([l,m]=[m,l]);let d=Math.min(.006,f*T*.05),p=h.x/f*d,b=h.y/f*d,g=(v,w)=>[v.x*T+p,w,v.y*T+b];return[g(l,r.bottom),g(m,r.bottom),g(l,r.top),g(m,r.top)]}var Fs=at(require("polygon-clipping"),1);function ut(e,t,n,o,r,i,a,s={}){let c=lt(t),u=s.ao??re,l=r.flatMap(p=>{if(p.role!=="entrance"&&p.role!=="exit")return[];let b=ve(p);if(!b||b.length!==4||!jt(c,lt(b)))return[];let g=s.portalBase??n,v=Yt(b,g,g+qe(p).heightM);if(!v)return[];let w=Math.min(o,v.openingTop);return w<=n?[]:[{poly:v.opening,height:w}]});if(!l.length)return!1;let m=p=>p.map(b=>[b.x,b.y]),h=[m(t),...(s.holes??[]).map(m)],f=[n,...new Set(l.map(p=>p.height)),o].sort((p,b)=>p-b),d=[];try{for(let p=1;p<f.length;p++){let b=f[p-1],g=f[p];if(g-b<1e-6)continue;let v=l.filter(R=>R.height>b+1e-6).map(R=>[m(R.poly)]),w=v.length?Fs.default.difference(h,...v):[h];d.push({low:b,high:g,polys:w})}}catch{return!1}for(let p of d)for(let b of p.polys){let[g,...v]=b.map(R=>R.map(([M,y])=>({x:M,y}))),w=R=>u.wallBottom+(u.top-u.wallBottom)*(R-n)/(o-n);ce(e,g,v,()=>p.high,p.low,i,a,{...u,top:w(p.high),wallBottom:w(p.low)})}return!0}function Ds(e,t,n,o,r,i,a){let s=o-n;if(s<=0)return;let c=s<1.5?[[n,o,1]]:[[n,n+Math.min(.9,s*.18),.82],[n+Math.min(.9,s*.18),o-.1,1],[o-.1,o,1.1]],u=l=>re.wallBottom+(re.top-re.wallBottom)*(l-n)/s;for(let[l,m,h]of c){let f={...re,top:u(m),wallBottom:u(l)},d=se(i,h),p=se(a,h);ut(e,t,l,m,r,d,p,{portalBase:n,ao:f})||ce(e,t,void 0,()=>m,l,d,p,f)}}function En(e,t,n){let o=he(t.stroke?.color),r=t.stroke?.width??0;if(!o||!Number.isFinite(r)||r<=0)return;let i=t.kind==="line"||t.kind==="polyline",a=i?fo(t.points??[],t.rotation):ve(t);if(!a||a.length<2)return;let s=i?a.length-1:a.length,c=r*.5;for(let u=0;u<s;u++){let l=a[u],m=a[(u+1)%a.length],h=Math.hypot(m.x-l.x,m.y-l.y);if(h<1e-6)continue;let f=-(m.y-l.y)/h*c,d=(m.x-l.x)/h*c,p=[(l.x+f)*T,n,(l.y+d)*T],b=[(m.x+f)*T,n,(m.y+d)*T],g=[(m.x-f)*T,n,(m.y-d)*T],v=[(l.x-f)*T,n,(l.y-d)*T];e.tri(p,b,g,[0,1,0],o),e.tri(p,g,v,[0,1,0],o)}}function Ns(e){return e==="bar"||e==="concession"||e==="coat"||e==="restroom"}var Kt=(e,t,n)=>({x:e.x+(t.x-e.x)*n,y:e.y+(t.y-e.y)*n});function po(e,t,n,o){let[r,i,a,s]=t?e:[e[3],e[2],e[1],e[0]];return[Kt(r,s,n),Kt(i,a,n),Kt(i,a,o),Kt(r,s,o)]}function Bs(e,t,n,o,r,i,a,s,c=!1){if(n.length!==4||r-o<.4)return!1;let u=x=>c?Math.min(x,r):x,l=Ge(n),m=Math.hypot(l[3].x-l[0].x,l[3].y-l[0].y)*T;if(m<.4)return!1;let h=Kt(l[0],l[1],.5),f=Kt(l[3],l[2],.5),d=Math.hypot(h.x-s.x,h.y-s.y)<=Math.hypot(f.x-s.x,f.y-s.y),p=pe(a,[.92,.9,.86],.35),b=se(i,.72),g=r-o;if(t==="restroom"){let x=Math.min(.18,g*.08);return de(e,l,r-x,o,a,i),de(e,l,r,r-x,p,p),!0}let v=o+Math.min(1.1,g),w=t==="coat"?1:Math.min(.5,.75/m),R=po(l,d,0,w);if(de(e,R,v-.05,o,b,i),de(e,R,v,v-.05,p,p),t==="coat"||m<1.2)return!0;if(t==="bar"){let x=po(l,d,Math.max(w+.2,1-.45/m),1),S=u(o+Math.max(Math.min(2.2,g*2),v-o+.6));return de(e,x,S,o,a,b),!0}let M=po(l,d,Math.max(w+.25,.55),1),y=u(o+Math.max(2.6,v-o+1.4));if(y-.14<=v)return!0;de(e,M,y-.14,o,a,i),de(e,l,y,y-.14,p,b);let P=Math.min(.08,.1/Math.max(.1,Math.hypot(l[1].x-l[0].x,l[1].y-l[0].y)*T));for(let[x,S]of[[0,P],[1-P,1]])de(e,po(Te(l,x,S),d,0,Math.min(.08,.1/m)),y-.14,v,b,b);return!0}var nh=[.12,.38,.16],oh=[.72,.62,.45],rh=[.88,.93,.96],Vs=[.95,.95,.94],ih=[.66,.29,.22],Lr={length:20.12,width:3.05},ah=.14,sh=9.76,mt=[.93,.94,.95],bo=[.1,.11,.13],ch=[.45,.85,1.25],lh=1.45,Hs=.012,Gs=.004,uh=1.07,mh=.15;function qt(e,t,n,o,r,i){e.setMaterial(i),ce(e,t,n?[n.slice().reverse()]:void 0,()=>o,o-.004,r,r,re)}var zs=(e,t)=>yt(e,t/T);function Us(e,t,n){let o=t.x-e.x,r=t.y-e.y,i=Math.hypot(o,r);if(i<1e-9)return null;let a=-r/i*n,s=o/i*n;return[{x:e.x+a,y:e.y+s},{x:t.x+a,y:t.y+s},{x:t.x-a,y:t.y-s},{x:e.x-a,y:e.y-s}]}function fh(e,t,n,o){let r=t.map(i=>[i.x*T,n,i.y*T]);e.tri(r[0],r[1],r[2],[0,1,0],o),e.tri(r[0],r[2],r[3],[0,1,0],o)}function yo(e,t,n,o,r,i){let a=n/T,s=[{x:t.x-a,y:t.y-a},{x:t.x+a,y:t.y-a},{x:t.x+a,y:t.y+a},{x:t.x-a,y:t.y+a}];ce(e,s,void 0,()=>r,o,i,se(i,.85),re)}function $t(e,t,n,o,r,i,a){let s=Us(t,n,o/T);s&&ce(e,s,void 0,()=>i,r,a,se(a,.85),re)}function go(e){let t=Ge(e),n={x:(t[0].x+t[2].x)/2,y:(t[0].y+t[2].y)/2},o=Math.hypot(t[1].x-t[0].x,t[1].y-t[0].y)||1,r=Math.hypot(t[3].x-t[0].x,t[3].y-t[0].y)||1,i={x:(t[1].x-t[0].x)/o,y:(t[1].y-t[0].y)/o},a={x:(t[3].x-t[0].x)/r,y:(t[3].y-t[0].y)/r};return{at:(c,u)=>({x:n.x+(i.x*c+a.x*u)/T,y:n.y+(i.y*c+a.y*u)/T}),lengthM:o*T,widthM:r*T}}function js(e,t,n){let o=La(t);if(!o.length)return;let r=1/0,i=-1/0,a=1/0,s=-1/0;for(let w of t.points??[])r=Math.min(r,w.x),i=Math.max(i,w.x),a=Math.min(a,w.y),s=Math.max(s,w.y);let c=(t.rotation??0)*Math.PI/180,u=Math.cos(c),l=Math.sin(c),m=(r+i)/2,h=(a+s)/2,f=w=>c?{x:m+(w.x-m)*u-(w.y-h)*l,y:h+(w.x-m)*l+(w.y-h)*u}:w,d=Math.min(i-r,s-a)*T,p=Math.max(.04,Math.min(.3,d*.004))/T,b=0;e.setMaterial(0);for(let w of o){if(!w.fill)continue;let R=w.points.map(f);qt(e,R,null,n+Hs+b*Gs,he(w.fill)??mt,0),b++}let g=o.filter(w=>!(w.fill&&w.ink===w.fill)),v=[...new Set(g.map(w=>w.ink??io))];for(let w of v){let R=n+Hs+b++*Gs,M=he(w)??mt;for(let y of g){if((y.ink??io)!==w)continue;let P=y.points.map(f),x=y.closed?P.length:P.length-1;for(let S=0;S<x;S++){let A=Us(P[S],P[(S+1)%P.length],p);A&&fh(e,A,R,M)}}}}function Xs(e,t,n,o,r){if(t.length<3)return!1;let i=o+.006,a=r??nh;if(n==="oval-cricket"){let s=t.reduce((M,y)=>M+y.x,0)/t.length,c=t.reduce((M,y)=>M+y.y,0)/t.length,u=M=>t.map(y=>({x:s+(y.x-s)*M,y:c+(y.y-c)*M})),l=8;for(let M=0;M<l;M++){let y=u(1-M/l),P=M===l-1?null:u(1-(M+1)/l);qt(e,y,P,i,se(a,M%2?1.04:.96),4)}let m=t[0];for(let M of t)Math.hypot(M.x-s,M.y-c)>Math.hypot(m.x-s,m.y-c)&&(m=M);let h=Math.hypot(m.x-s,m.y-c)||1,f=(m.x-s)/h,d=(m.y-c)/h,p=-d,b=f,g=Math.min(1,2*h*T*ah/Lr.length),v=Lr.length*g/2/T,w=Lr.width*g/2/T,R=[[-v,-w],[v,-w],[v,w],[-v,w]].map(([M,y])=>({x:s+f*M+p*y,y:c+d*M+b*y}));return qt(e,R,null,i+.004,oh,0),e.setMaterial(0),!0}if(n==="rink-hockey"){let s=zs(t,mh);return qt(e,s,null,i,rh,0),e.setMaterial(0),ce(e,t,[s.slice().reverse()],()=>o+uh,o,Vs,se(Vs,.9),re),!0}if(n==="ring-boxing"&&t.length===4){let{at:s}=go(t),c=[s(-3.05,-3.05),s(3.05,-3.05),s(3.05,3.05),s(-3.05,3.05)],u=[[.77,.19,.19],mt,[.17,.42,.69],mt];e.setMaterial(0),c.forEach((l,m)=>yo(e,l,.07,o,o+lh,u[m]));for(let l of ch)for(let m=0;m<4;m++)$t(e,c[m],c[(m+1)%4],.025,o+l-.025,o+l+.025,mt);return!0}if(n==="court-tennis"&&t.length===4){let{at:s}=go(t);e.setMaterial(0),$t(e,s(0,-6.4),s(0,6.4),.015,o,o+.95,bo),$t(e,s(0,-6.4),s(0,6.4),.03,o+.95,o+1,mt);for(let c of[-1,1])yo(e,s(0,c*6.4),.05,o,o+1.07,bo);return!0}if(n==="court-basketball"&&t.length===4){let{at:s,lengthM:c}=go(t),u=Math.min(14,c/2-.5);e.setMaterial(0);for(let l of[-1,1]){let m=s(l*(u+1.2),0),h=s(l*(u-1.2),0);yo(e,m,.12,o,o+3.4,bo),$t(e,m,h,.06,o+3.25,o+3.4,bo),$t(e,s(l*(u-1.2),-.9),s(l*(u-1.2),.9),.03,o+2.9,o+3.95,mt)}return!0}if(n==="pitch-rugby"&&t.length===4){let{at:s,lengthM:c}=go(t),u=c*(50/120);e.setMaterial(0);for(let l of[-1,1]){for(let m of[-2.8,2.8])yo(e,s(l*u,m),.07,o,o+12,mt);$t(e,s(l*u,-2.8),s(l*u,2.8),.06,o+2.94,o+3.06,mt)}return!0}if(n==="track-athletics"){let s=zs(t,sh);return s.length<3?!1:(qt(e,t,s,i,ih,0),qt(e,s,null,i,a,4),e.setMaterial(0),!0)}return!1}var Ws=[.19,.4,.15],dh=.012,Mo=2.4,hh=1,ph=.75,bh=.15;function Ze(e){if(e.points&&e.points.length>=3)return e.points;let{center:t,width:n,height:o,rotation:r}=e;if(!n||!o)return null;let i=(r??0)*Math.PI/180,a=Math.cos(i),s=Math.sin(i),c=n/2,u=o/2;return[[-c,-u],[c,-u],[c,u],[-c,u]].map(([l,m])=>({x:t.x+l*a-m*s,y:t.y+l*s+m*a}))}function Qs(e,t,n,o,r,i,a=!1){let s=Ze(t);if(s){if(a){let c=Lt(o,r.boothTop),u=et([...s]);ce(e,$e(u,yh/T),[u.slice().reverse()],()=>n+.03,n,c,se(c,.8),re);return}if(!(!t.points&&i&&xh(e,s,n,o,i))){if(!t.points&&i&&s.length===4){gh(e,s,n,o,i);return}ce(e,s,void 0,()=>n+Mo,n,Lt(o,r.boothTop),r.boothWall,re)}}}var Or=1.1,Ys=[.9,.9,.88],yh=.1,xo=[.87,.87,.85],Ks=.08;function Js(e,t){let n=c=>({x:(e[c].x+e[(c+1)%4].x)/2,y:(e[c].y+e[(c+1)%4].y)/2}),o=0,r=1/0;for(let c=0;c<4;c++){let u=n(c),l=Math.hypot(u.x-t.x,u.y-t.y);l<r&&(r=l,o=c)}let i=[0,1,2,3].map(c=>e[(o+c)%4]),a=(c,u,l)=>({x:c.x+(u.x-c.x)*l,y:c.y+(u.y-c.y)*l});return{q:i,part:(c,u,l,m)=>{let h=a(i[0],i[1],c),f=a(i[0],i[1],u),d=a(i[3],i[2],c),p=a(i[3],i[2],u);return[a(h,d,l),a(f,p,l),a(f,p,m),a(h,d,m)]},depthM:Math.hypot(i[3].x-i[0].x,i[3].y-i[0].y)*T,widthM:Math.hypot(i[1].x-i[0].x,i[1].y-i[0].y)*T}}function gh(e,t,n,o,r){let{q:i,part:a}=Js(t,r),s=o??[.35,.42,.55],c=pe(s,[.78,.78,.77],.62),u=pe(s,[.95,.95,.94],.45);de(e,i,n+vt,n,c,se(c,.8)),de(e,a(.05,.95,.72,.98),n+Or-.05,n+vt,u,se(u,.8)),de(e,a(.03,.97,.7,1),n+Or,n+Or-.05,Ys,se(Ys,.9))}function xh(e,t,n,o,r){if(t.length!==4)return!1;let{q:i,part:a,depthM:s,widthM:c}=Js(t,r);if(s<1||c<1)return!1;let u=o??[.35,.42,.55],l=pe(u,[.78,.78,.77],.62),m=n+Mo,h=Ks/c,f=Ks/s;de(e,i,n+vt,n,l,se(l,.8)),de(e,a(0,1,1-f,1),m,n+vt,xo,se(xo,.9));for(let[b,g]of[[0,h],[1-h,1]])de(e,a(b,g,0,1-f),m,n+vt,xo,se(xo,.9));de(e,a(h,1-h,0,Math.min(.5,.06/s)),m,m-.3,u,se(u,.85));let d=Math.min(.4,.6/c),p=Math.min(.12,.3/s);return de(e,a(.5-d,.5+d,.72-p,.72+p),n+hh,n+vt,pe(u,[.95,.95,.94],.7),se(u,.75)),!0}function So(e){if(e.shape==="round"){let l=e.radius;return l?no(e.center.x,e.center.y,l,l,24):null}let{width:t,height:n,rotation:o,center:r}=e;if(!t||!n)return null;let i=(o??0)*Math.PI/180,a=Math.cos(i),s=Math.sin(i),c=t/2,u=n/2;return[[-c,-u],[c,-u],[c,u],[-c,u]].map(([l,m])=>({x:r.x+l*a-m*s,y:r.y+l*s+m*a}))}function ec(e,t,n,o,r,i=!0){let a=So(t);if(!a)return;let s=a.reduce((h,f)=>h+f.x,0)/a.length,c=a.reduce((h,f)=>h+f.y,0)/a.length,u=h=>a.map(f=>({x:s+(f.x-s)*h,y:c+(f.y-c)*h})),l=i&&o?Lt(o,r.tableTop):vh,m=n+ph;ce(e,a,void 0,()=>m,n+Mh,l,se(l,.86),re),ce(e,u(.12),void 0,()=>m+.12,m,$s,se($s,.8),re)}var vh=[.93,.92,.89],$s=[.78,.66,.42],Mh=.25;function tc(e,t,n,o,r,i,a,s,c=[]){let u=ve(t);if(!t.role&&(!t.fill||t.fill==="none"||t.fill==="transparent")||!u){En(e,t,n+o+dh);return}let m=s?s.kind==="stage":t.role==="stage",h=s?s.kind==="screen":t.role==="screen",f=s?{kind:m?"stage":"solid",heightM:s.topY-s.baseY}:qe(t),d=s?.baseY??n,p=s?.topY??n+o;if(m&&a){let x=1/0,S=-1/0,A=1/0,_=-1/0;for(let D of u)D.x<x&&(x=D.x),D.x>S&&(S=D.x),D.y<A&&(A=D.y),D.y>_&&(_=D.y);a.push({cx:(x+S)/2*T,cz:(A+_)/2*T,y:p,halfX:Math.max((S-x)/2*T,.5),halfZ:Math.max((_-A)/2*T,.5)})}let b=he(t.fill),g=t.role==="wall"||t.role==="entrance"||t.role==="exit",v=g?b?se(Ke(b,.12),.95):r.tierTop:m&&b?pe(r.stageTop,se(Ke(b,.18),.9),.9):!t.role&&b?b:Lt(b,m?r.stageTop:r.decorTop),w=h?b:null,R=g?b?se(Ke(b,.12),.85):r.tierWall:m?b?pe(r.stageWall,se(b,.58),.82):r.stageWall:h?w?pe(se(w,1.42),[.24,.46,.82],.08):[.24,.46,.82]:Lt(he(t.fill),r.decorWall);if(t.role==="wall"&&!s){Ds(e,u,d,p,c,v,R),En(e,t,p+.012);return}if(h&&u.length===4&&p-d>.2){let x=kr(u,d,p);if(!x)return;let{quad:S,side:A,trim:_,inner:D,panel:E}=x,I=[.12,.15,.18];for(let[k,L]of[[0,A],[1-A,1]])de(e,Te(S,k,L),p,d,I,I);de(e,D,d+_,d,I,I),de(e,D,p,p-_,I,I),de(e,E,p-_,d+_,R,R),En(e,t,p+.012);return}let M=b?se(Ke(b,.15),.82):R,y=b?se(Ke(b,.1),1.02):v;if(Ns(t.role)&&!s&&Bs(e,t.role,u,d,p,M,y,i,t.heightM!==void 0))return;if((t.role==="sound"||s?.kind==="sound_desk")&&u.length===4&&p-d>.3){let x=Ge(u),S=Math.hypot(x[1].x-x[0].x,x[1].y-x[0].y)*T,A=Math.min(.12,.09/Math.max(S,.001)),_=[.18,.21,.24],D=p-Math.min(.12,(p-d)*.15);for(let[E,I]of[[0,A],[1-A,1]])de(e,Te(x,E,I),D,d,_,_);de(e,x,p,D,v,_);return}if(t.role==="rail"&&u.length===4&&p>d){let x=Ge(u),S=Math.hypot(x[1].x-x[0].x,x[1].y-x[0].y)*T,A=Math.max(1,Math.min(128,Math.ceil(S/1.4))),_=Math.min(.08,.055/Math.max(.055,S)),D=[.58,.64,.66];for(let E=0;E<=A;E++){let I=E/A,k=Math.min(1-_,Math.max(0,I-_/2));de(e,Te(x,k,k+_),p,d,D,se(D,.8))}for(let E of[.52,1]){let I=d+(p-d)*E;de(e,x,I,Math.max(d,I-.055),D,se(D,.8))}return}if(t.role==="goal"&&u.length===4){let x=Ge(u),S=Math.hypot(x[1].x-x[0].x,x[1].y-x[0].y)*T,A=Math.min(.12,.1/Math.max(.1,S)),_=[.9,.94,.94];for(let[D,E]of[[0,A],[1-A,1]])de(e,Te(x,D,E),Math.max(d,p-.1),d,_,_);de(e,x,p,Math.max(d,p-.1),_,_);return}if(f.kind==="portal"&&u.length===4){let x=Yt(u,d,p);if(!x)return;let{quad:S,side:A,face:_,openingTop:D}=x;for(let[E,I,k]of[[0,_,1],[_,1-_,.67],[1-_,1,1]]){let L=Rn(S,E,I),B=se(v,k),F=se(R,k);for(let[V,N]of[[0,A],[1-A,1]])de(e,Te(L,V,N),D,d,B,F);de(e,L,p,D,B,F)}return}if(f.kind==="suite"&&u.length===4){let x=u.map((_,D)=>{let E=u[(D+1)%4],I=(_.x+E.x)/2,k=(_.y+E.y)/2;return Math.hypot(I-i.x,k-i.y)}),S=x.indexOf(Math.min(...x)),A=[0,1,2,3].map(_=>u[(S+_)%4]);de(e,Te(A,0,.08),p,d,v,R),de(e,Te(A,.92,1),p,d,v,R),de(e,Rn(A,.88,1),p,d,v,R),de(e,A,p,Math.max(d,p-.18),v,R);return}if(m&&!t.stageKind?.startsWith("pitch-")&&p-d>.12){let x=p-Math.min(.06,(p-d)*.15);de(e,u,x,d,v,R),de(e,u,p,x,v,pe(v,R,.2))}else de(e,u,p,d,v,R);if((t.stageKind==="pitch-football"||t.stageKind==="pitch-rugby")&&u.length===4){e.setMaterial(4);let x=Ge(u),S=pe(b??Ws,Ws,b?.45:0);for(let A=0;A<12;A++){let _=Te(x,A/12,(A+1)/12),D=se(S,A%2?1.09:.91),E=_.map(I=>[I.x*T,p+.006,I.y*T]);e.tri(E[0],E[1],E[2],[0,1,0],D),e.tri(E[0],E[2],E[3],[0,1,0],D)}}t.stageKind&&t.stageKind!=="pitch-football"&&Xs(e,u,t.stageKind,p,b),m&&Tt(t.stageKind)&&js(e,t,p),e.setMaterial(h?1:0),En(e,t,p+.012)}function wo(e){let{x:t,y:n,width:o,height:r}=e;if(!o||!r)return null;let i=t+o/2,a=n+r/2,s=(e.rotation??0)*Math.PI/180,c=Math.cos(s),u=Math.sin(s),l=o/2,m=r/2;return[[-l,-m],[l,-m],[l,m],[-l,m]].map(([h,f])=>({x:i+h*c-f*u,y:a+h*u+f*c}))}function Sh(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 o=n[1].trim();if(o==="none"||o==="transparent")return null;let r=o.match(/^url\(#([^)]+)\)$/);if(!r)return he(o);let i=t.match(new RegExp(`<(?:linear|radial)Gradient\\b[^>]*\\bid="${r[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=he(s[1].trim());c&&a.push(c)}return a.length?a.reduce((s,c,u)=>pe(s,c,1/(u+1)),a[0]):null}function nc(e,t,n,o){if(t.layer==="foreground")return;let r=wo(t);if(!r)return;let i=n+bh,a=Lt(Sh(t.href),o.decorTop),s=Math.max(0,Math.min(1,t.opacity??1));s<1&&(a=pe(o.ground,a,s)),ce(e,r,void 0,()=>i,n,a,pe(a,o.decorWall,.5),re)}function oc(e,t,n,o,r){if(!t.points||t.points.length<3)return;let i=rs(o,r.gaTop);ce(e,t.points,t.holes,()=>n+qs,n,i,r.gaWall,re),Ih(e,t.points,n+qs)}var qs=.15,vo=[.72,.74,.76],Fr=1.1,Zs=.12,Dr=.05,wh=.06,Ph=2.4;function Ih(e,t,n){let o=et([...t]),r=yt(o,Zs/T),i=yt(o,(Zs+Dr)/T);if(r.length<3||i.length<3)return;for(let s of[n+Fr,n+Fr*.5])ce(e,r,[i.slice().reverse()],()=>s,s-Dr,vo,se(vo,.85),re);let a=wh/2/T;for(let s=0;s<r.length;s++){let c=r[s],u=r[(s+1)%r.length],l=Math.hypot(u.x-c.x,u.y-c.y)*T,m=Math.max(1,Math.round(l/Ph));for(let h=0;h<m;h++){let f=h/m,d=c.x+(u.x-c.x)*f,p=c.y+(u.y-c.y)*f,b=[{x:d-a,y:p-a},{x:d+a,y:p-a},{x:d+a,y:p+a},{x:d-a,y:p+a}];ce(e,b,void 0,()=>n+Fr-Dr,n,vo,se(vo,.8),re)}}}var Nr=.6,rc=3,Ah=.25;function Rh(e,t){if(He(t,e.x,e.y))return 0;let n=1/0;for(let o=0,r=t.length-1;o<t.length;r=o++){let i=t[r],a=t[o],s=a.x-i.x,c=a.y-i.y,u=s*s+c*c||1,l=Math.max(0,Math.min(1,((e.x-i.x)*s+(e.y-i.y)*c)/u));n=Math.min(n,Math.hypot(e.x-(i.x+l*s),e.y-(i.y+l*c)))}return n}function ic(e,t){let n=e.map(a=>({booth:a,ring:Ze(a)})).filter(a=>!!a.ring&&a.ring.length===4&&!a.booth.points),o=n.map(({ring:a})=>({minX:Math.min(...a.map(s=>s.x)),maxX:Math.max(...a.map(s=>s.x)),minY:Math.min(...a.map(s=>s.y)),maxY:Math.max(...a.map(s=>s.y))})),r=(rc+Nr)/T,i=new Map;return n.forEach(({booth:a,ring:s},c)=>{let u={x:s.reduce((f,d)=>f+d.x,0)/4,y:s.reduce((f,d)=>f+d.y,0)/4},l=[0,1,2,3].map(f=>{let d=s[f],p=s[(f+1)%4],b={x:(d.x+p.x)/2,y:(d.y+p.y)/2},g=b.x-u.x,v=b.y-u.y,w=Math.hypot(g,v)||1,R={x:b.x+g/w*Nr/T,y:b.y+v/w*Nr/T},M=rc/T;return o.forEach((y,P)=>{P===c||R.x<y.minX-r||R.x>y.maxX+r||R.y<y.minY-r||R.y>y.maxY+r||(M=Math.min(M,Rh(R,n[P].ring)))}),{open:M*T,toward:{x:b.x+g/w*10/T,y:b.y+v/w*10/T},focal:Math.hypot(b.x-t.x,b.y-t.y)}}),m=Math.max(...l.map(f=>f.open)),h=l.filter(f=>f.open>=m-Ah).sort((f,d)=>f.focal-d.focal)[0];i.set(a.id,h.toward)}),i}var ac=at(require("polygon-clipping"),1);var Eh=.45,Ch=1500,_h=200;function sc(e,t){if(e.role!=="stage"||Tt(e.stageKind))return e;let n=ve(e);if(!n||n.length<3||Math.abs(Ve(n))*T*T>Ch)return e;let o=t.filter(a=>He(n,a.x,a.y));if(!o.length||o.length>_h)return e;let r=Eh/T,i=o.map(a=>[[[a.x-r,a.y-r],[a.x+r,a.y-r],[a.x+r,a.y+r],[a.x-r,a.y+r],[a.x-r,a.y-r]]]);try{let a=ac.default.difference([[...n.map(u=>[u.x,u.y]),[n[0].x,n[0].y]]],...i),s=null,c=0;for(let u of a){let l=u[0].slice(0,-1).map(([h,f])=>({x:h,y:f})),m=Math.abs(Ve(l));m>c&&(c=m,s=l)}return!s||s.length<3?e:{...e,kind:"polygon",points:s,rotation:0}}catch{return e}}var Th=Math.PI/180,ge=96,kh=6,Lh=60,Oh=150,cc=.2,Fh=.35;function Dh(e,t){let n=Math.atan2(t.x-e.x,t.y-e.y)/Th;return n<0?n+360:n}function Po(e){if(!e.length)return NaN;let t=[...e].sort((n,o)=>n-o);return t[Math.floor(t.length/2)]}function Io(e,t,n=2){let o=e.length,r=new Float64Array(o);for(let i=0;i<o;i++){let a=0,s=0;for(let c=-n;c<=n;c++){let u=i+c;if(t)u=(u%o+o)%o;else if(u<0||u>=o)continue;a+=e[u],s++}r[i]=a/s}return r}function lc(e,t){let n=e.filter(h=>h.rows.length>=1);if(n.length<1)return null;let o=[],r=0,i=0,a=0;for(let h of n)for(let f of h.rows){for(let d of f.pts)r+=d.x,i+=d.y,a++;if(f.pts.length>=4){let d=Mr(f.pts);d&&Number.isFinite(d.cx)&&Number.isFinite(d.cy)&&o.push({x:d.cx,y:d.cy})}}if(!a)return null;let s={x:r/a,y:i/a},c=s;if(o.length>=8){let h=Po(o.map(g=>g.x)),f=Po(o.map(g=>g.y)),d=0;for(let g of n)for(let v of g.rows)for(let w of v.pts){let R=Math.hypot(w.x-s.x,w.y-s.y);R>d&&(d=R)}let p=0,b=d*.2;for(let g of n)for(let v of g.rows)for(let w of v.pts)Math.hypot(w.x-h,w.y-f)<b&&p++;Math.hypot(h-s.x,f-s.y)<=d&&p/a<.01&&(c={x:h,y:f})}let u=[];for(let h of n){let f={sectionId:h.sectionId,rMin:1/0,rMax:-1/0,samples:[]};for(let d of h.rows)for(let p of d.pts){let b=Math.hypot(p.x-c.x,p.y-c.y),g=Math.min(ge-1,Math.floor(Dh(c,p)/(360/ge)));f.samples.push({r:b,bin:g,levelM:d.levelM}),b<f.rMin&&(f.rMin=b),b>f.rMax&&(f.rMax=b)}f.samples.length&&u.push(f)}if(!u.length)return null;u.sort((h,f)=>h.rMin+h.rMax-(f.rMin+f.rMax));let l=[];for(let h of u){let f=!1;for(let d of l){let p=Math.min(h.rMax,d.rMax)-Math.max(h.rMin,d.rMin),b=Math.min(h.rMax-h.rMin,d.rMax-d.rMin);if(b>1e-9&&p>=Fh*b){d.members.push(h),d.rMin=Math.min(d.rMin,h.rMin),d.rMax=Math.max(d.rMax,h.rMax),f=!0;break}}f||l.push({members:[h],rMin:h.rMin,rMax:h.rMax})}let m=[];for(let h of l){let f=new Array(ge).fill(null);for(let E of h.members)for(let I of E.samples){let k=f[I.bin];k||(k={samples:[]},f[I.bin]=k),k.samples.push({r:I.r,levelM:I.levelM})}let d=f.map(E=>!!E);if(!d.filter(Boolean).length)continue;let b=[],g=[];for(let E of f){if(!E)continue;let I=1/0,k=-1/0;for(let L of E.samples)L.r<I&&(I=L.r),L.r>k&&(k=L.r);b.push(I),g.push(k)}let v=Po(b),w=Po(g);if(!(v>=cc*w)||!(w>0))continue;let R=[...b].sort((E,I)=>E-I);if(!(R[Math.floor(R.length*.1)]>=cc*w))continue;let y=f.map(E=>{if(!E)return null;let I=[...E.samples].sort((O,G)=>O.r-G.r),k=I[0].r,L=I[I.length-1].r,B=I[0].levelM,F=-1/0;for(let O of I)O.levelM>F&&(F=O.levelM);let V=[];for(let O of I){let G={r:O.r,l:O.levelM};for(;V.length&&Math.abs(V[V.length-1].r-G.r)<1e-9;){if(V[V.length-1].l<=G.l){G.skip=!0;break}V.pop()}if(!G.skip){for(;V.length>=2;){let j=V[V.length-2],H=V[V.length-1];if((H.r-j.r)*(G.l-j.l)-(H.l-j.l)*(G.r-j.r)<=0)V.pop();else break}V.push(G)}}let N=V.map(O=>O.r),C=V.map(O=>O.l);return{inner:k,outer:L,front:B,top:F,profile:{rs:N,ls:C}}}),P=d.slice();for(let E=0;E<ge;E++){if(P[E])continue;let I=-1,k=-1,L=0;for(let z=1;z<=ge;z++){let $=(E-z+ge*2)%ge;if(P[$]){I=$;break}}for(let z=1;z<=ge;z++){let $=(E+z)%ge;if(P[$]){k=$,L=z;break}}if(I<0||k<0)continue;let B=0;for(let z=1;z<=ge;z++){let $=(E-z+ge*2)%ge;if(d[$]){B=z;break}}if(B-1+L>kh)continue;let V=y[I],N=y[k],C=B/(B+L),O=V.inner+(N.inner-V.inner)*C,G=V.outer+(N.outer-V.outer)*C,j=V.front+(N.front-V.front)*C,H=V.top+(N.top-V.top)*C;y[E]={inner:O,outer:G,front:j,top:H,profile:{rs:[O,G],ls:[j,H]}}}for(let E=0;E<ge;E++)y[E]&&(P[E]=!0);let x=360/ge,S=[],A=P.filter(Boolean).length,_=[];if(A===ge)_.push({start:0,len:ge});else{let E=0;for(;P[E];)E=(E+1)%ge;let I=-1;for(let k=0;k<=ge;k++){let L=(E+k)%ge,B=k<ge&&P[L];if(B&&I<0)I=L;else if(!B&&I>=0){let F=(L-I+ge)%ge||ge;_.push({start:I,len:F}),I=-1}}}for(let E of _){if(E.len*x<Lh&&E.len<ge)continue;let I=E.len===ge,k=new Float64Array(E.len),L=new Float64Array(E.len),B=new Float64Array(E.len),F=new Float64Array(E.len),V=[];for(let z=0;z<E.len;z++){let $=y[(E.start+z)%ge];k[z]=$.inner,L[z]=$.outer,B[z]=$.front,F[z]=$.top,V.push($.profile??{rs:[$.inner,$.outer],ls:[$.front,$.top]})}let N=Io(k,I),C=Io(L,I),O=Io(B,I),G=Io(F,I);for(let z=0;z<E.len;z++)N[z]>k[z]&&(N[z]=k[z]),C[z]<L[z]&&(C[z]=L[z]),N[z]>C[z]-1e-6&&(N[z]=Math.max(0,C[z]-1e-6)),G[z]<O[z]&&(G[z]=O[z]);let j={startBin:E.start,binCount:E.len,closed:I,innerR:N,outerR:C,frontLevelM:O,topLevelM:G,profiles:V},H=(z,$,Q)=>{let ae=V[z],q=ae.rs,W=ae.ls;if($<=q[0]){W[0]>Q&&(W[0]=Q);return}if($>=q[q.length-1]){W[W.length-1]>Q&&(W[W.length-1]=Q);return}for(let Y=0;Y+1<q.length;Y++)if($<=q[Y+1]){W[Y]>Q&&(W[Y]=Q),W[Y+1]>Q&&(W[Y+1]=Q);return}};for(let z=0;z<E.len;z++){let $=f[(E.start+z)%ge];if($)for(let Q of $.samples){H(z,Q.r,Q.levelM);let ae=I?(z-1+E.len)%E.len:z-1,q=I?(z+1)%E.len:z+1;ae>=0&&H(ae,Q.r,Q.levelM),q<E.len&&H(q,Q.r,Q.levelM)}}S.push(j)}S.reduce((E,I)=>E+I.binCount*x,0)<Oh||m.push({arcs:S,sectionIds:h.members.map(E=>E.sectionId),innerRMedian:v,outerRMedian:w})}if(!m.length)return null;if(m.sort((h,f)=>h.innerRMedian-f.innerRMedian),t){let h=m[m.length-1].outerRMedian;if(Math.hypot(t.x-c.x,t.y-c.y)>.9*h)return null}return{centre:c,binCount:ge,binStepDeg:360/ge,rings:m}}function uc(e,t,n,o){let r=e.binStepDeg,i=n/r-.5-t.startBin;i=(i%e.binCount+e.binCount)%e.binCount,i>t.binCount-1&&(t.closed?i=i-t.binCount<t.binCount-i?0:t.binCount-1:i=i-(t.binCount-1)<e.binCount-i?t.binCount-1:0);let a=Math.floor(i),s=t.closed?(a+1)%t.binCount:Math.min(t.binCount-1,a+1),c=i-a,u=l=>{let m=t.profiles[l],h=m.rs,f=m.ls;if(o<=h[0])return f[0];if(o>=h[h.length-1])return f[f.length-1];for(let d=0;d+1<h.length;d++)if(o<=h[d+1]){let p=h[d+1]-h[d],b=p>1e-9?(o-h[d])/p:0;return f[d]+(f[d+1]-f[d])*b}return f[f.length-1]};return u(a)*(1-c)+u(s)*c}function Br(e,t,n,o,r,i,a,s,c,u=[],l=r){if(t.length!==n.length||t.length<2||i-r<1.5)return;let m=(p,b,g)=>{ut(e,p,b,g,u,a,s,{portalBase:l,ao:c})||ce(e,p,void 0,()=>g,b,a,s,c)},h=(p,b,g)=>({x:p.x+(b.x-p.x)*g,y:p.y+(b.y-p.y)*g}),f=o?t.length:t.length-1,d=0;for(let p=0;p<f;p++){let b=(p+1)%t.length,g=Math.hypot(n[b].x-n[p].x,n[b].y-n[p].y)*le;if(g<1e-5)continue;let v=(y,P)=>[h(t[p],t[b],y),h(t[p],t[b],P),h(n[p],n[b],P),h(n[p],n[b],y)];m(v(0,1),r,r+.95),m(v(0,1),i-.22,i);let w=Math.ceil((d-.32)/6)*6,R=!1,M=!1;for(let y=w;y<d+g;y+=6){let P=Math.max(0,(y-d)/g),x=Math.min(1,(y+.32-d)/g);x<=P||(m(v(P,x),r+.95,i-.22),R||=P<1e-6,M||=x>1-1e-6)}if(!o&&(p===0&&!R||p===f-1&&!M)){let y=Math.min(1,.32/g);m(v(p===0?0:1-y,p===0?y:1),r+.95,i-.22)}d+=g}}var Mt=at(require("polygon-clipping"),1),_n=.65;function Vr(e,t){let n=1/0;for(let o of t)for(let r=0;r<o.length;r++){let i=o[r],a=o[(r+1)%o.length],s=a.x-i.x,c=a.y-i.y,u=Math.max(0,Math.min(1,((e.x-i.x)*s+(e.y-i.y)*c)/(s*s+c*c||1)));n=Math.min(n,Math.hypot(e.x-i.x-u*s,e.y-i.y-u*c))}return n}var Hr=.01;function mc(e,t,n,o,r,i,a,s=[],c=!0,u={bays:[],walls:[]}){if(o-r<=1e-5)return;let l=o-r>=3,m=l?o-_n:r;e.setMaterial(5);let h=l?[]:s.filter(y=>{if(y.role!=="entrance"&&y.role!=="exit")return!1;let P=ve(y);if(!P)return!1;let x=Yt(P,r,r+qe(y).heightM);return x!==null&&x.openingTop<=o-.12});if((!h.length||!ut(e,t,m,o,h,i,a,{holes:n,portalBase:r}))&&ce(e,t,n,()=>o,m,i,a,re,void 0,()=>[0,1,0]),!l){e.setMaterial(0);return}let f=c&&u.bays.length?Nh(t,n,yt(t,Cn/T),u):null,d=6/T,p=.22/T,b=s.flatMap(y=>{if(y.role!=="entrance"&&y.role!=="exit")return[];let P=ve(y);return P?.length?[{minX:Math.min(...P.map(x=>x.x)),maxX:Math.max(...P.map(x=>x.x)),minY:Math.min(...P.map(x=>x.y)),maxY:Math.max(...P.map(x=>x.y))}]:[]}),g=Math.min(...t.map(y=>y.x)),v=Math.max(...t.map(y=>y.x)),w=Math.min(...t.map(y=>y.y)),R=Math.max(...t.map(y=>y.y));for(let y=g+d/2;y<v;y+=d)for(let P=w+d/2;P<R;P+=d){if(b.some(S=>y+p>=S.minX&&y-p<=S.maxX&&P+p>=S.minY&&P-p<=S.maxY))continue;let x=[{x:y-p,y:P-p},{x:y+p,y:P-p},{x:y+p,y:P+p},{x:y-p,y:P+p}];!Oe({x:y,y:P},t,n)||Vr({x:y,y:P},[t,...n??[]])<p*Math.SQRT2+(c?Cn/T:0)||f&&Vr({x:y,y:P},f.flat())<p*Math.SQRT2+Cn/T||ce(e,x,void 0,()=>m,r,i,a,re)}if(f){for(let[y,...P]of f)ce(e,y,P,()=>m,r-Hr,i,a,re);e.setMaterial(0);return}let M=yt(t,Cn/T);if(c&&M.length>=3){let y=s.filter(S=>{if(S.role!=="entrance"&&S.role!=="exit")return!1;let A=ve(S);return!!A&&A.some(_=>!Oe(_,t,void 0)||Vr(_,[t])<=Cn/T)}),P=[M.slice().reverse()],x=r-Hr;(!y.length||!ut(e,t,x,m,y,i,a,{holes:P,portalBase:r+Hr}))&&ce(e,t,P,()=>m,x,i,a,re)}e.setMaterial(0)}var Gr=.25,Cn=Gr;function Nh(e,t,n,o){if(n.length<3)return null;let r=a=>{let s=a.map(c=>[c.x,c.y]);return s.push(s[0]),s},i=a=>{let[s,...c]=a.map(u=>[r(u)]);return Mt.default.union(s,...c)};try{let a=[r(e),...(t??[]).map(r)],s=Mt.default.difference(a,[r(n)]),c=Mt.default.intersection(a,i(o.bays));if(!c.length)return null;let u=Mt.default.difference(Mt.default.intersection(a,i(o.walls)),c);return Mt.default.union(Mt.default.difference(s,c),u).map(m=>m.map(h=>h.slice(0,-1).map(([f,d])=>({x:f,y:d}))))}catch{return null}}var Bh=.02,Vh=.25,Hh=1.2,Gh=.6,zh=.45,Uh=2.3,jh=Math.PI/180,fc=.005;function tt(e,t,n){let o=n*jh;return{x:e.x+t*Math.sin(o),y:e.y+t*Math.cos(o)}}function Xh(e,t){let n=t.rings[t.rings.length-1];if(!n)return!1;let o=n.outerRMedian*.85;for(let r of e){if(r.role!=="wall")continue;let i=r.points&&r.points.length>=2?r.points:r.x!==void 0&&r.y!==void 0&&r.width!==void 0&&r.height!==void 0?[{x:r.x,y:r.y},{x:r.x+r.width,y:r.y},{x:r.x+r.width,y:r.y+r.height},{x:r.x,y:r.y+r.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)>=o&&a++;if(a>=i.length/2)return!0}return!1}var Wh=24,Yh=.01;function Kh(e,t,n,o,r,i,a,s,c){let u=n.binCount,l=Wh,m=le,h=i+.02,f=i-Yh,d=[];for(let I=0;I<u;I++){let k=(n.startBin+I+.5)*t.binStepDeg,L=new Float64Array(l+1);for(let B=0;B<=l;B++){let F=o[I]+(r[I]-o[I])*B/l;L[B]=Math.max(h,uc(t,n,k,F)-Vh)}d.push(L)}if(c){let I=0;for(let k=0;k+1<u;k++)for(let L=0;L<l;L++){let B=tt(t.centre,o[k]+(r[k]-o[k])*L/l,(n.startBin+k+.5)*t.binStepDeg),F=tt(t.centre,o[k+1]+(r[k+1]-o[k+1])*(L+1)/l,(n.startBin+k+1.5)*t.binStepDeg);I=Math.max(I,Math.hypot(F.x-B.x,F.y-B.y))}for(let k=0;k<u;k++){let L=(n.startBin+k+.5)*t.binStepDeg;for(let B=0;B<=l;B++){let F=tt(t.centre,o[k]+(r[k]-o[k])*B/l,L),V=c(F.x,F.y,I*1.01);V!==null&&(d[k][B]=Math.min(d[k][B],Math.max(f+fc,V-fc)))}}}let p=[a.bandTop[0]*s.top,a.bandTop[1]*s.top,a.bandTop[2]*s.top],b=[a.bandTop[0]*s.bottomCap,a.bandTop[1]*s.bottomCap,a.bandTop[2]*s.bottomCap],g=[a.bandWall[0]*s.top,a.bandWall[1]*s.top,a.bandWall[2]*s.top],v=[a.bandWall[0]*s.wallBottom,a.bandWall[1]*s.wallBottom,a.bandWall[2]*s.wallBottom],w=(I,k)=>{let L=(n.startBin+I+.5)*t.binStepDeg,B=o[I]+(r[I]-o[I])*k/l,F=tt(t.centre,B,L);return[F.x*m,d[I][k],F.y*m]};{let I=Math.tan(12*Math.PI/180);for(let k=0;k<6;k++){let L=!1;for(let F=0;F<u;F++)for(let V=l-1;V>=0;V--)d[F][V]>d[F][V+1]&&(d[F][V]=d[F][V+1],L=!0);let B=n.closed?u:u-1;for(let F=0;F<B;F++){let V=(F+1)%u;for(let N=0;N<=l;N++){let C=d[V][N]-d[F][N];if(Math.abs(C)>1)continue;let O=o[F]+(r[F]-o[F])*N/l,G=o[V]+(r[V]-o[V])*N/l,j=tt(t.centre,O,(n.startBin+F+.5)*t.binStepDeg),H=tt(t.centre,G,(n.startBin+V+.5)*t.binStepDeg),z=I*Math.hypot(H.x-j.x,H.y-j.y)*m;C>z?(d[V][N]=d[F][N]+z,L=!0):-C>z&&(d[F][N]=d[V][N]+z,L=!0)}}if(!L)break}}let R=1,M=(I,k)=>{for(let L=0;L<=l;L+=4)if(Math.abs(d[I][L]-d[k][L])>R)return!0;return Math.abs(d[I][l]-d[k][l])>R},y=Math.tan(38*Math.PI/180),P=I=>(r[I]-o[I])/l*m,x=(I,k)=>d[I][k+1]-d[I][k]>y*Math.max(1e-6,P(I)),S=(I,k)=>{let L=n.closed?(I-1+u)%u:Math.max(0,I-1),B=n.closed?(I+1)%u:Math.min(u-1,I+1);Math.abs(d[L][k]-d[I][k])>R&&(L=I),Math.abs(d[B][k]-d[I][k])>R&&(B=I);let F=Math.max(0,k-1),V=Math.min(l,k+1);F<k&&x(I,F)&&(F=k),V>k&&x(I,k)&&(V=k);let N=w(L,k),C=w(B,k),O=w(I,F),G=w(I,V),j=C[0]-N[0],H=C[1]-N[1],z=C[2]-N[2],$=G[0]-O[0],Q=G[1]-O[1],ae=G[2]-O[2],q=H*ae-z*Q,W=z*$-j*ae,Y=j*Q-H*$,K=Math.hypot(q,W,Y);return K>1e-12?(q/=K,W/=K,Y/=K,W<0&&(q=-q,W=-W,Y=-Y),[q,W,Y]):[0,1,0]},A=(I,k,L=!1)=>{let B=L&&Math.min(I[1],k[1])-i>=3,F=[I[0],B?I[1]-_n:f,I[2]],V=[k[0],B?k[1]-_n:f,k[2]],N=k[0]-I[0],C=k[2]-I[2],O=Math.hypot(N,C);if(!(O>1e-12))return;let G=[C/O,0,-N/O];e.tri(I,k,V,G,g,g,v),e.tri(I,V,F,G,g,v,v)},_=.05*Xe,D=I=>r[I]-o[I]<_,E=n.closed?u:u-1;for(let I=0;I<E;I++){let k=(I+1)%u;if(D(I)||D(k))continue;if(M(I,k)){let C=(n.startBin+I+1)*t.binStepDeg,O=(Q,ae)=>{let q=(o[I]+o[k])/2,W=(r[I]+r[k])/2,Y=q+(W-q)*ae/l,K=tt(t.centre,Y,C);return[K.x*m,d[Q][ae],K.y*m]};for(let Q=0;Q<l;Q++){let ae=w(I,Q),q=w(I,Q+1),W=O(I,Q),Y=O(I,Q+1),K=S(I,Q),ne=S(I,Q+1);e.triN(ae,W,Y,K,K,ne,p),e.triN(ae,Y,q,K,ne,ne,p);let ee=w(k,Q),fe=w(k,Q+1),J=O(k,Q),oe=O(k,Q+1),De=S(k,Q),te=S(k,Q+1);e.triN(J,ee,fe,De,De,te,p),e.triN(J,fe,oe,De,te,te,p);let Me=O(I,Q),we=O(I,Q+1),be=O(k,Q+1),Qe=O(k,Q),je=we[0]-Me[0],Ie=we[2]-Me[2],Ne=Math.hypot(je,Ie);if(Ne>1e-12){let ft=[Ie/Ne,0,-je/Ne];e.tri(Me,we,be,ft,g),e.tri(Me,be,Qe,ft,g)}}let G=w(I,0),j=w(k,0),H=w(k,l),z=w(I,l),$=Q=>[Q[0],f,Q[2]];Math.min(G[1],j[1])-i<3&&(e.tri($(G),$(H),$(j),[0,-1,0],b),e.tri($(G),$(z),$(H),[0,-1,0],b)),A(G,j,!0),A(z,H,!0);continue}for(let C=0;C<l;C++){let O=S(I,C),G=S(k,C),j=S(k,C+1),H=S(I,C+1);if(x(I,C)||x(k,C)){let q=(we,be)=>{let Qe=(n.startBin+we+.5)*t.binStepDeg,je=o[we]+(r[we]-o[we])*(C+.5)/l,Ie=tt(t.centre,je,Qe);return[Ie.x*m,be,Ie.y*m]},W=w(I,C),Y=w(k,C),K=q(I,d[I][C]),ne=q(k,d[k][C]);e.triN(W,Y,ne,O,G,G,p),e.triN(W,ne,K,O,G,O,p);let ee=w(k,C+1),fe=w(I,C+1),J=q(I,d[I][C+1]),oe=q(k,d[k][C+1]);e.triN(J,oe,ee,H,j,j,p),e.triN(J,ee,fe,H,j,H,p);let De=ne[0]-K[0],te=ne[2]-K[2],Me=Math.hypot(De,te);if(Me>1e-12){let we=[-te/Me,0,De/Me];e.tri(K,ne,oe,we,g),e.tri(K,oe,J,we,g)}continue}let z=w(I,C),$=w(k,C),Q=w(k,C+1),ae=w(I,C+1);e.triN(z,$,Q,O,G,j,p),e.triN(z,Q,ae,O,j,H,p)}let L=w(I,0),B=w(k,0),F=w(k,l),V=w(I,l),N=C=>[C[0],f,C[2]];Math.min(L[1],B[1])-i<3&&(e.tri(N(L),N(F),N(B),[0,-1,0],b),e.tri(N(L),N(V),N(F),[0,-1,0],b)),A(L,B,!0),A(V,F,!0)}if(!n.closed)for(let I of[0,u-1])for(let k=0;k<l;k++)A(w(I,k),w(I,k+1))}function dc(e,t,n){let{bottomY:o,colors:r,ao:i}=n,a=new Float64Array(t.binCount).fill(-1/0);for(let l of t.rings)for(let m of l.arcs){let h=new Float64Array(m.binCount),f=new Float64Array(m.binCount);for(let p=0;p<m.binCount;p++){let b=(m.startBin+p)%t.binCount,g=Math.max(0,m.innerR[p]-We);h[p]=Math.max(g,a[b]+.001),f[p]=Math.max(h[p]+.001,m.outerR[p]+We)}let d=0;for(let p=0;p<m.binCount;p++){let b=m.topLevelM[p]-o;b>d&&(d=b)}d>=Hh&&Kh(e,t,m,h,f,o,r,i,n.standTopNear);for(let p=0;p<m.binCount;p++){let b=(m.startBin+p)%t.binCount;f[p]>a[b]&&(a[b]=f[p])}}if(n.deriveShell===!1||Xh(n.shapes,t))return;let s=t.rings[t.rings.length-1],c=Gh*Xe,u=zh*Xe;for(let l of s.arcs){let m=[],h=[];for(let S=0;S<l.binCount;S++){let A=(l.startBin+S+.5)*t.binStepDeg,_=l.outerR[S]+We+c;m.push(tt(t.centre,_,A)),h.push(tt(t.centre,_+u,A))}let f=-1/0;for(let S=0;S<l.binCount;S++)l.topLevelM[S]>f&&(f=l.topLevelM[S]);let d=f+Uh,p=l.closed?h:[...h,...m.slice().reverse()],b=l.closed?[m.slice().reverse()]:void 0,g=pe(r.shellWall,[.66,.71,.72],.62),v=(S,A,_,D,E)=>{let I=Math.abs(D-f)<1e-6?D-Bh:D;ut(e,S,_,I,n.shapes,r.shellTop,E,{holes:A,portalBase:o,ao:i})||ce(e,S,A,()=>I,_,r.shellTop,E,i)},w=Math.max(1,Math.ceil((f-o)/4.5)),R=(f-o)/w,M=new Set,y=n.tierFrontLevels??t.rings.map(S=>{let A=S.arcs.flatMap(_=>Array.from(_.frontLevelM)).filter(Number.isFinite).sort((_,D)=>_-D);return A[Math.floor(A.length/2)]});for(let S of y)Number.isFinite(S)&&S-o>=3&&S<f&&M.add(Math.max(0,Math.min(w-1,Math.floor((S-o)/R))));let P=Math.min(...y.filter(S=>Number.isFinite(S)&&S-o>=3&&S<f));for(let S=0;S<w;S++)o+(S+1)*R<=P-_n&&Number.isFinite(P)&&M.add(S);for(let S=0;S<w;S++){let A=o+(f-o)*S/w,_=o+(f-o)*(S+1)/w;M.has(S)&&_-A>=3.2?(v(p,b,A,A+.45,g),Br(e,m,h,l.closed,A+.45,_-.16,r.shellTop,g,i,n.shapes,o)):v(p,b,A,_-.16,g),v(p,b,_-.16,_,se(g,.62))}Br(e,m,h,l.closed,f,d,r.shellTop,g,i,n.shapes,o);let x=8;for(let S=1;S<h.length;S++){if(x+=Math.hypot(h[S].x-h[S-1].x,h[S].y-h[S-1].y)*le,x<8)continue;x=0;let A=h[S],_=h[S-1],D=A.x-_.x,E=A.y-_.y,I=Math.max(1,Math.hypot(D,E)),k=D/I*.16*Xe,L=E/I*.16*Xe,B=Math.max(1,Math.hypot(A.x-t.centre.x,A.y-t.centre.y)),F=(A.x-t.centre.x)/B*.24*Xe,V=(A.y-t.centre.y)/B*.24*Xe,N=[{x:A.x-k,y:A.y-L},{x:A.x+k,y:A.y+L},{x:A.x+k+F,y:A.y+L+V},{x:A.x-k+F,y:A.y-L+V}];v(N,void 0,o,f,se(g,1.12))}}}var $h=2.5,hc=.65,qh=2,Zh=.03;function Qh(e,t){let n=()=>{let o=t;for(;e.length>2;){let r=e[0],i=e[1],a=Math.hypot(i.x-r.x,i.y-r.y);if(a>o){e[0]={x:r.x+(i.x-r.x)/a*o,y:r.y+(i.y-r.y)/a*o};return}o-=a,e.shift()}};n(),e.reverse(),n(),e.reverse()}function jr(e,t,n){let o=new Map;for(let i of e){let a=o.get(i.blockId);(!a||i.depth<a.depth)&&o.set(i.blockId,i)}let r=[];for(let[i,a]of o){if(a.y-n<$h||a.pts.length<2)continue;let s=a.pts.map(l=>{let m=l.x-t.x,h=l.y-t.y,f=Math.max(1,Math.hypot(m,h));return{x:l.x-m/f*hc/T,y:l.y-h/f*hc/T}}),c=[],u=[s[0]];for(let l=1;l<s.length;l++){let m=s[l-1],h=s[l];Math.hypot(h.x-m.x,h.y-m.y)*T>qh?(u.length>=2&&c.push(u),u=[h]):u.push(h)}u.length>=2&&c.push(u);for(let l of c)Qh(l,Zh/T);c.length&&r.push({blockId:i,y:a.y,runs:c})}return r}var pc=.1,Jh=1.1,ep=.22,zr=.95,Ur=.05,bc=1.8;function yc(e,t,n,o){let r=[.72,.72,.69],i=[.48,.55,.57];for(let a of jr(t,n,o)){let s=a.y;for(let c of a.runs){let u=bc;for(let l=1;l<c.length;l++){let m=c[l-1],h=c[l],f=h.x-m.x,d=h.y-m.y,p=Math.hypot(f,d);if(p<1e-5)continue;let b=g=>{let v=-d/p*g/T/2,w=f/p*g/T/2;return[{x:m.x+v,y:m.y+w},{x:h.x+v,y:h.y+w},{x:h.x-v,y:h.y-w},{x:m.x-v,y:m.y-w}]};if(ce(e,b(ep),void 0,()=>s+pc,s-Jh,r,r,re),ce(e,b(Ur),void 0,()=>s+zr,s+zr-Ur,i,i,re),u+=p*T,u>=bc||l===c.length-1){u=0;let g=.028/T,v=[{x:m.x-g,y:m.y-g},{x:m.x+g,y:m.y-g},{x:m.x+g,y:m.y+g},{x:m.x-g,y:m.y+g}];ce(e,v,void 0,()=>s+zr-Ur,s+pc,i,i,re)}}}}}var tp=.9,np=1.5,op=.3;function gc(e,t,n){let o=[],r=[],i=tp/T,a=np/T,s=op/T;for(let c of e)for(let u of c.runs){if(u.length<2)continue;let l=u.slice(),m=(b,g)=>{let v=l[b],w=l[g],R=Math.hypot(v.x-w.x,v.y-w.y)||1;l[b]={x:v.x+(v.x-w.x)/R*s,y:v.y+(v.y-w.y)/R*s}};m(0,1),m(l.length-1,l.length-2);let h=l.map((b,g)=>{let v=l[Math.max(0,g-1)],w=l[Math.min(l.length-1,g+1)],R=w.x-v.x,M=w.y-v.y,y=Math.hypot(R,M)||1,P=-M/y,x=R/y;return P*(b.x-t.x)+x*(b.y-t.y)<0&&(P=-P,x=-x),{nx:P,ny:x}}),f=l.map((b,g)=>({x:b.x-h[g].nx*a,y:b.y-h[g].ny*a})),d=l.map((b,g)=>({x:b.x+h[g].nx*i,y:b.y+h[g].ny*i})),p=l.map((b,g)=>({x:b.x+h[g].nx*(i+n/T),y:b.y+h[g].ny*(i+n/T)}));o.push([...f,...d.slice().reverse()]),r.push([...d,...p.reverse()])}return{bays:o,walls:r}}var Xr=.88,Ao=.27,rp=1.2,ip=.01;function xc(e,t,n,o,r){let i=[.67,.71,.68],a=[i[0]*Xr,i[1]*Xr,i[2]*Xr],s=c=>!!r&&r.some((u,l)=>l!==c&&u?.belowY!=null&&Math.abs(u.belowY-t[c].y)<1e-6&&t[l].blockId===t[c].blockId);for(let c=0;c<t.length;c++){let u=t[c];if(!(u.pts.length<2))for(let l of[0,u.pts.length-1]){let m=u.pts[l],h=u.pts[l===0?1:l-1],f=m.x-h.x,d=m.y-h.y,p=Math.hypot(f,d);if(p<1e-5)continue;f/=p,d/=p;let b=1/0;for(let k=0;k<n.length;k++){let L=n[k],B=n[(k+1)%n.length],F=B.x-L.x,V=B.y-L.y,N=f*V-d*F;if(Math.abs(N)<1e-8)continue;let C=L.x-m.x,O=L.y-m.y,G=(C*V-O*F)/N,j=(C*d-O*f)/N;G>0&&j>=0&&j<=1&&(b=Math.min(b,G))}let g=.3/T,v=b-.04/T;if(!Number.isFinite(b)||b*T>2||v-g<.12/T)continue;let w=!!o&&s(c),R=r?.[c]?.pitch,M=w&&R&&Number.isFinite(R)?Math.min(rp/T,Math.max(Ao/T,R-Ao/T-ip/T)):Ao/T,y=-d,P=f;o&&y*(o.x-m.x)+P*(o.y-m.y)<0&&(y=-y,P=-P);let x=Ao/T,S=[{x:m.x+f*g+y*x,y:m.y+d*g+P*x},{x:m.x+f*v+y*x,y:m.y+d*v+P*x},{x:m.x+f*v-y*M,y:m.y+d*v-P*M},{x:m.x+f*g-y*M,y:m.y+d*g-P*M}];if(!S.every(k=>He(n,k.x,k.y)))continue;let A=r?.[c]?.belowY,_=A==null?0:u.y-A,D=!!o&&_>.03&&_<=.65;if(D&&o){let k=(L,B)=>Math.hypot((L.x+B.x)/2-o.x,(L.y+B.y)/2-o.y);k(S[0],S[1])>k(S[3],S[2])&&(S=[S[3],S[2],S[1],S[0]])}let E=D?Math.ceil((_-1e-8)/.2):1,I=(k,L,B)=>({x:k.x+(L.x-k.x)*B,y:k.y+(L.y-k.y)*B});for(let k=0;k<E;k++){let L=k/E,B=(k+1)/E,F=[I(S[0],S[3],L),I(S[1],S[2],L),I(S[1],S[2],B),I(S[0],S[3],B)],V=u.y+.008-(D?_*(1-B):0);ce(e,F,void 0,()=>V,V-(D?_/E+.1:.16),i,a,re)}}}}function vc(e,t,n,o,r,i,a,s,c=!1){if(!t.outline||t.outline.length<3)return;let u=n.baseHeightM,l=n.objects.filter(v=>v.type==="shape"&&(v.role==="entrance"||v.role==="exit")),m=is(o,s.tierTop);if(!r)return;let h=v=>r.deckAt(v.x,v.y),f=Ms(t,a),d=f[0]??t.outline;if(r.rowLevels.length>=2){let v=uo(r.rowLevels),w=Ss(bs(r.rowLevels,n.focal,v),f),R=gc(jr(r.rowLevels,n.focal,u),n.focal,Gr);for(let y of w){let P=Math.max(u,y.topY-Mc);for(let x of i.subtract(y.outline,P))mc(e,x,y.holes,P,u,s.tierTop,s.tierWall,l,!c,R)}w.length||ce(e,d,t.holes,()=>r.landingY,u,m,s.tierWall,re);let M={tread:[m[0]*re.top,m[1]*re.top,m[2]*re.top],riser:[m[0]*.72,m[1]*.72,m[2]*.72]};for(let y of f.length?f:[d])gs(e,r.rowLevels,n.focal,r.landingY,M,y,v);yc(e,r.rowLevels,n.focal,u),xc(e,r.rowLevels,t.outline,n.focal,v);return}let p=r.flat?1/0:ks,b=v=>r.normalAt(v.x,v.y),g=r.flat?r.landingY:void 0;for(let v of i.subtract(d,g))ce(e,v,t.holes,h,u,m,s.tierWall,re,p,b)}function ap(e,t,n){let o=new Set;for(let a of e.objects)a.type==="section"&&o.add(a.id);let r=new Map;for(let a=0;a<t.length;a++){let s=n.seatOwner[a];if(!s||!o.has(s))continue;let c=n.bySection.get(s);if(c&&c.rowLevels.length>=2)continue;let u=t[a];if(u.kind==="booth")continue;let l=r.get(s);l||(l=new Map,r.set(s,l));let m=u.rowId||`__seat-${a}`,h=l.get(m);h||(h={pts:[],levelM:0,n:0},l.set(m,h)),h.pts.push({x:u.x,y:u.y}),h.levelM+=n.seatDeckY(a),h.n++}let i=[];for(let a of e.objects){if(a.type!=="section")continue;let s=n.bySection.get(a.id);if(s&&s.rowLevels.length>=2){let u=s.rowLevels.filter(l=>!l.patch).map(l=>({pts:l.pts,levelM:l.y}));u.length>=2&&i.push({sectionId:a.id,rows:u});continue}let c=r.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 sp(e,t){let n=1/0;for(let o=0;o<t.length;o++){let r=t[o],i=t[(o+1)%t.length],a=i.x-r.x,s=i.y-r.y,c=Math.max(0,Math.min(1,((e.x-r.x)*a+(e.y-r.y)*s)/(a*a+s*s||1)));n=Math.min(n,Math.hypot(e.x-r.x-c*a,e.y-r.y-c*s))}return n}var Mc=.02;function cp(e,t){let n=e.objects.filter(o=>o.type==="section"&&!!o.outline&&o.outline.length>=3).flatMap(o=>{let r=t.bySection.get(o.id);if(!r)return[];let i=1/0,a=-1/0,s=1/0,c=-1/0;for(let l of o.outline)l.x<i&&(i=l.x),l.x>a&&(a=l.x),l.y<s&&(s=l.y),l.y>c&&(c=l.y);let u=r.landingY;for(let l of r.rowLevels)u=Math.min(u,l.y-Mc);return[{outline:o.outline,holes:o.holes,surface:r,floorTop:u,minX:i,maxX:a,minY:s,maxY:c}]});return(o,r,i)=>{let a=null;for(let s of n){if(o<s.minX-i||o>s.maxX+i||r<s.minY-i||r>s.maxY+i)continue;let c={x:o,y:r};if(!Oe(c,s.outline,s.holes)&&sp(c,s.outline)>i)continue;let u=Math.min(s.surface.deckAt(o,r),s.floorTop);(a===null||u<a)&&(a=u)}return a}}var lp=3,up=.4;function Sc(e,t,n,o,r,i,a=!0){let s=ap(t,n,o);if(s.length<lp)return;let c=lc(s,t.focal);if(!c)return;let u=Math.max(0,...c.rings.map(l=>l.arcs.reduce((m,h)=>m+h.binCount,0)))/c.binCount;e.setMaterial(5),dc(e,c,{bottomY:t.baseHeightM,tierFrontLevels:s.map(l=>Math.min(...l.rows.map(m=>m.levelM))),colors:{bandTop:se(r.tierTop,.8),bandWall:r.tierWall,shellTop:i??se(r.tierWall,1.15),shellWall:i??r.tierWall},ao:re,shapes:t.objects.filter(l=>l.type==="shape"),deriveShell:a&&u>=up,standTopNear:cp(t,o)}),e.setMaterial(0)}var wc=4;var mp=[[/\b(wc|toilets?|restrooms?|washrooms?|lavatory|loo)\b/i,"restroom"],[/\b(bar|drinks|pub|cocktails?)\b/i,"bar"],[/\b(food|concessions?|snacks?|kiosk|caf[eé]|kitchen|catering)\b/i,"concession"],[/\b(coat ?check|cloak ?room|cloakroom|coats)\b/i,"coat"],[/\b(screen|led wall|projection|video wall)\b/i,"screen"],[/\b(sound|foh|mixing desk|control booth)\b/i,"sound"],[/\b(entrance|entry|way in|gate)\b/i,"entrance"],[/\b(exit|way out)\b/i,"exit"],[/\b(pillar|column|obstruction)\b/i,"obstruction"],[/\b(walls?|outline|boundary|perimeter)\b/i,"wall"]],fp=1.2,dp=12;function Pc(e){if(e.heightM!==void 0)return!1;let t=ve(e);if(!t||t.length<3)return!1;let n=0;for(let r=0;r<t.length;r++){let i=t[r],a=t[(r+1)%t.length];n+=Math.hypot(a.x-i.x,a.y-i.y)}return n*le<dp*2?!1:2*Tn(t)/n*le<=fp}function Wr(e){if(!e)return null;for(let[t,n]of mp)if(t.test(e))return n;return null}var Ac="auto-rows-";function Rc(e){return e.id.startsWith(Ac)&&!e.label}var hp=1.15,pp=.09,Ec=6,bp=34,yp=.35,gp=6,xp=.35,vp=.75,Mp=12,Sp=2.5,wp=40,Pp=[18,24],Ip=[12,16],Ic=14,Ap=.8,Rp=.6,Ep=5,Cp=.3,Cc=.4,_c=2,_p=400,Tp=2.6,kp=.8,Lp=4,Op=26,Fp=.7,Dp=.5,Np=.985,Bp=1.5,Vp=1.8,Hp=3,Gp=25,zp=.985,Up=2,jp=6,Xp=3,Wp=.1,Yp=1.5,Kp=1.6,$p=6e3,qp=.6,Zp="#c3c7cd",Yr=300,Qp=240;function Jp(e,t,n,o){if(!e.fill||!/^#[0-9a-f]{6}$/i.test(e.fill))return null;let r=$r([...t]),i=new Set;for(let l of o)i.add(Math.floor(Math.atan2(l.y-r.y,l.x-r.x)*180/Math.PI/10));if(i.size*10<Qp)return null;let{h:a,s,l:c}=qi(Ki(e.fill));return a<70/360||a>170/360||s<.2||c<.08||c>.75||n.some(l=>l!==e&&l.type==="shape"&&ve(l)?.some(m=>Qr(m,t)))?null:e.kind==="ellipse"?"oval-cricket":e.kind==="rect"?"pitch-football":null}var eb="Estimated from the drawing; confirm with the venue.",qr=e=>{if(!e.length)return null;let t=[...e].sort((o,r)=>o-r),n=Math.floor(t.length/2);return t.length%2?t[n]:(t[n-1]+t[n])/2},$r=e=>({x:e.reduce((t,n)=>t+n.x,0)/e.length,y:e.reduce((t,n)=>t+n.y,0)/e.length}),Tn=e=>{let t=0;for(let n=0;n<e.length;n++){let o=e[n],r=e[(n+1)%e.length];t+=o.x*r.y-r.x*o.y}return Math.abs(t)/2};function tb(e){return e.height!==void 0||e.rake!==void 0||e.elevation!==void 0||e.surfaceKind!==void 0}function Zr(e){let t=new Map;for(let n of e){let o=t.get(n.rowId);o?o.push(n):t.set(n.rowId,[n])}return t}function Qr(e,t){let n=!1;for(let o=0,r=t.length-1;o<t.length;r=o++){let i=t[o],a=t[r];i.y>e.y!=a.y>e.y&&e.x<(a.x-i.x)*(e.y-i.y)/(a.y-i.y)+i.x&&(n=!n)}return n}function Jr(e,t){let n=t[0],o=1/0;for(let r=0;r<t.length;r++){let i=t[r],a=t[(r+1)%t.length],s=a.x-i.x,c=a.y-i.y,u=s*s+c*c,l=u>0?Math.max(0,Math.min(1,((e.x-i.x)*s+(e.y-i.y)*c)/u)):0,m={x:i.x+s*l,y:i.y+c*l},h=Math.hypot(e.x-m.x,e.y-m.y);h<o&&(o=h,n=m)}return n}function Tc(e,t){let n=0,o=0;for(let r of e.values()){if(r.length<3)continue;let i=r[0],a=r[r.length-1],s=a.x-i.x,c=a.y-i.y,u=Math.hypot(s,c);if(u<1e-6)continue;let l={x:(i.x+a.x)/2,y:(i.y+a.y)/2},m=Jr(l,t),h=m.x-l.x,f=m.y-l.y,d=Math.hypot(h,f);d<1e-6||(o+=Math.abs((-c*h+s*f)/(u*d))*r.length,n+=r.length)}return n?o/n:0}function nb(e,t,n){let o=e.filter(p=>p.type==="shape"),r=o.find(p=>p.role==="stage");if(r){let p=ve(r);return p?{shape:r,centre:$r(p),outline:p,inferred:!1}:null}if(!n.length)return null;let i=1/0,a=-1/0,s=1/0,c=-1/0;for(let p of n)i=Math.min(i,p.x),a=Math.max(a,p.x),s=Math.min(s,p.y),c=Math.max(c,p.y);let u=(a-i)*(c-s),l=[];for(let p of o){if(p.role)continue;let b=ve(p);if(!b)continue;let g=Tn(b);if(g*le*le<6||g>u)continue;let v=Math.min(...b.map(S=>S.x)),w=Math.max(...b.map(S=>S.x)),R=Math.min(...b.map(S=>S.y)),M=Math.max(...b.map(S=>S.y)),y=0;for(let S of n)S.x>v&&S.x<w&&S.y>R&&S.y<M&&Qr(S,b)&&y++;if(y>n.length*.05)continue;let P=$r(b),x=Tc(t,b);x>=Ap&&l.push({shape:p,centre:P,outline:b,score:x,area:g,box:[v,R,w,M]})}let m=(p,b)=>b!==p&&b.area>p.area&&p.box[0]>=b.box[0]-1e-6&&p.box[1]>=b.box[1]-1e-6&&p.box[2]<=b.box[2]+1e-6&&p.box[3]<=b.box[3]+1e-6,h=l.filter(p=>!l.some(b=>m(p,b))),f=Math.max(0,...h.map(p=>p.score)),d=h.filter(p=>p.score>=f-.03).sort((p,b)=>b.area-p.area)[0]??null;return d?{shape:d.shape,centre:d.centre,outline:d.outline,inferred:!0}:null}function ob(e,t,n){if(!n||n.length<3)return Math.hypot(e.x-t.x,e.y-t.y);let o=Jr(e,n);return Math.hypot(e.x-o.x,e.y-o.y)}function kc(e){let t=[...e].sort((i,a)=>i.x-a.x||i.y-a.y);if(t.length<3)return t;let n=(i,a,s)=>(a.x-i.x)*(s.y-i.y)-(a.y-i.y)*(s.x-i.x),o=[];for(let i of t){for(;o.length>=2&&n(o[o.length-2],o[o.length-1],i)<=0;)o.pop();o.push(i)}let r=[];for(let i=t.length-1;i>=0;i--){let a=t[i];for(;r.length>=2&&n(r[r.length-2],r[r.length-1],a)<=0;)r.pop();r.push(a)}return[...o.slice(0,-1),...r.slice(0,-1)]}function rb(e){if(!e.length||e.length>$p)return[];let t=[...Zr(e).values()],n=t.map((s,c)=>c),o=s=>n[s]===s?s:n[s]=o(n[s]),r=Kp/le,i=t.map(s=>({minX:Math.min(...s.map(c=>c.x))-r,maxX:Math.max(...s.map(c=>c.x))+r,minY:Math.min(...s.map(c=>c.y))-r,maxY:Math.max(...s.map(c=>c.y))+r}));for(let s=0;s<t.length;s++)for(let c=s+1;c<t.length;c++){let u=i[s],l=i[c];if(u.maxX<l.minX||l.maxX<u.minX||u.maxY<l.minY||l.maxY<u.minY)continue;t[s].some(h=>t[c].some(f=>Math.hypot(h.x-f.x,h.y-f.y)<=r))&&(n[o(s)]=o(c))}let a=new Map;return t.forEach((s,c)=>{let u=o(c),l=a.get(u);l?l.push(...s):a.set(u,[...s])}),[...a.values()].filter(s=>new Set(s.map(c=>c.rowId)).size>=2)}function ib(e,t,n){if(!t.length)return null;let o=t.filter(x=>n.tableIds.has(x.rowId)||x.kind==="booth").length>t.length/2,r=Zr(t),i=!n.outline||Tc(r,n.outline)>=Rp,a=0,s=0;for(let x of r.values()){if(x.length<2)continue;let S=x[0],A=x[x.length-1],_=A.x-S.x,D=A.y-S.y,E=Math.hypot(_,D);if(E<1e-6)continue;let I={x:(S.x+A.x)/2,y:(S.y+A.y)/2},k=i?n.outline?Jr(I,n.outline):n.focal:n.middle,L=-D/E,B=_/E;L*(k.x-I.x)+B*(k.y-I.y)<0&&(L=-L,B=-B),a+=L*x.length,s+=B*x.length}let c={x:t.reduce((x,S)=>x+S.x,0)/t.length,y:t.reduce((x,S)=>x+S.y,0)/t.length};if(Math.hypot(a,s)<1e-9){let x=i?n.focal:n.middle;a=x.x-c.x,s=x.y-c.y}let u=Math.hypot(a,s)||1,l={x:a/u,y:s/u},m=x=>-(x.x*l.x+x.y*l.y),h=x=>-x.x*l.y+x.y*l.x,f=1/0,d=-1/0,p=1/0,b=-1/0,g=1/0,v=new Map;for(let x of t){let S=m(x),A=h(x);f=Math.min(f,S),d=Math.max(d,S),p=Math.min(p,A),b=Math.max(b,A),i&&(g=Math.min(g,ob(x,n.focal,n.outline)));let _=x.logicalRowId??x.rowId,D=v.get(_);D?D.push(S):v.set(_,[S])}i||(g=Math.max(0,f-m(n.middle)));let w=[...v.values()].map(x=>qr(x)).sort((x,S)=>x-S),R=[];if(!o)for(let x of w)R.length&&x-R[R.length-1]<xp/le||R.push(x);let M=tb(e),y=bt(e,{floorBaseHeightM:n.baseHeightM}),P={id:e.id,section:e,authored:M,plane:n,facing:l,facesAction:i,hull:kc(t),sample:t.filter((x,S)=>S%Math.ceil(t.length/_p)===0),frontD:f,backD:d,latMin:p,latMax:b,frontDistance:g,rowDepths:R,rowCount:R.length,level:0,height:y.height,rake:M?y.rake:0,backHeight:0};return P.backHeight=P.height+(d-f)*le*Math.tan(P.rake*Math.PI/180),P}function ab(e,t,n,o){if(e.length<2)return 0;let r=Math.max(1,t*le),i=n+hp-o,a=0,s=0;for(let u=1;u<e.length;u++){let l=Math.max(vp,(e[u]-e[u-1])*le),m=(i+pp)*(r+l)/r;a+=m-i,s+=l,i=m,r+=l}let c=Math.atan(a/s)*180/Math.PI;return Math.round(Math.max(Ec,Math.min(bp,c))*10)/10}function sb(e,t,n=!1){if(!n&&e.facing.x*t.facing.x+e.facing.y*t.facing.y<Cp)return null;let o=-1/0,r=1/0,i=-1/0;for(let h of t.hull){o=Math.max(o,-(h.x*e.facing.x+h.y*e.facing.y));let f=-h.x*e.facing.y+h.y*e.facing.x;r=Math.min(r,f),i=Math.max(i,f)}if(Math.min(e.latMax,i)-Math.max(e.latMin,r)<(n?1e-6:Cc*(e.latMax-e.latMin)))return null;let s=_c/le,c=new Map,u=new Map;for(let h of e.sample){let f=Math.floor((-h.x*e.facing.y+h.y*e.facing.x)/s),d=-(h.x*e.facing.x+h.y*e.facing.y);c.set(f,Math.min(c.get(f)??1/0,d))}for(let h of t.sample){let f=Math.floor((-h.x*e.facing.y+h.y*e.facing.x)/s),d=-(h.x*e.facing.x+h.y*e.facing.y);u.set(f,Math.max(u.get(f)??-1/0,d))}let l=[];for(let[h,f]of c){let d=u.get(h);d!==void 0&&l.push(f-d)}let m=l.length?qr(l):e.frontD-o;return m<-1/le?null:m}function cb(e,t){if(t.plane.floorIndex>=e.plane.floorIndex)return!1;let n=-1/0,o=1/0,r=1/0,i=-1/0;for(let c of t.hull){let u=-(c.x*e.facing.x+c.y*e.facing.y);n=Math.max(n,u),o=Math.min(o,u);let l=-c.x*e.facing.y+c.y*e.facing.x;r=Math.min(r,l),i=Math.max(i,l)}let a=Math.min(e.latMax,i)-Math.max(e.latMin,r),s=Math.min(e.backD,n)-Math.max(e.frontD,o);return a>Cc*(e.latMax-e.latMin)&&s>1/le}function lb(e,t){let n=new Set;for(let o of e){let r=(Math.atan2(o.y-t.y,o.x-t.x)*180/Math.PI+360)%360;n.add(Math.floor(r/10))}return n.size/36}function ub(e,t){let n=1/0,o=-1/0;for(let i of t.hull){let a=-(i.x*e.facing.x+i.y*e.facing.y);n=Math.min(n,a),o=Math.max(o,a)}let r=Math.max(0,Math.min(o-n,e.frontD-n));return t.height+r*le*Math.tan(t.rake*Math.PI/180)}function mb(e,t){if(!e.facesAction)return!1;let n={x:-e.facing.y,y:e.facing.x},o=_c/le,r=Math.max(1,Math.ceil((e.backD-e.frontD)/o)),i={left:new Map,right:new Map};for(let s of t)if(!(s===e||s.plane.floorIndex!==e.plane.floorIndex)&&!(s.facing.x*e.facing.x+s.facing.y*e.facing.y>=Np))for(let c of s.sample){let u=-(c.x*e.facing.x+c.y*e.facing.y);if(u<e.frontD||u>e.backD)continue;let l=-c.x*e.facing.y+c.y*e.facing.x,m=l<e.latMin?"left":l>e.latMax?"right":null;if(!m)return!1;let h=Math.min(r-1,Math.floor((u-e.frontD)/o)),f=m==="left"?e.latMin-l:l-e.latMax;f<(i[m].get(h)?.gap??1/0)&&i[m].set(h,{gap:f,other:s})}let a=s=>{let c=s==="left"?e.latMin:e.latMax,u=0;for(let[l,{other:m}]of i[s]){if((m.facing.x*n.x+m.facing.y*n.y)*(s==="left"?1:-1)<Fp)continue;let f=e.frontD+(l+.5)*o,d={x:-f*e.facing.x+c*n.x,y:-f*e.facing.y+c*n.y},p=-(d.x*m.facing.x+d.y*m.facing.y),b=-d.x*m.facing.y+d.y*m.facing.x;p<m.frontD&&b>=m.latMin&&b<=m.latMax&&u++}return u/r>=Dp};return a("left")&&a("right")}function fb(e,t){if(t.plane.floorIndex!==e.plane.floorIndex||t.facing.x*e.facing.x+t.facing.y*e.facing.y<zp)return!1;let n=1/0,o=-1/0,r=1/0;for(let s of t.hull){let c=-s.x*e.facing.y+s.y*e.facing.x;n=Math.min(n,c),o=Math.max(o,c),r=Math.min(r,-(s.x*e.facing.x+s.y*e.facing.y))}let i=(e.frontD-r)*le;if(i<-Up||i>jp)return!1;let a=Math.max(n-e.latMax,e.latMin-o);return a*le<=Xp&&a*le>=-Wp}function db(e,t=!1,n=!1,o){let r=t?Ip:Pp,i=new Set(n?[]:e.filter(p=>!p.authored&&mb(p,e))),a=[...e].sort((p,b)=>p.plane.floorIndex-b.plane.floorIndex||Number(i.has(b))-Number(i.has(p))||p.frontDistance-b.frontDistance);for(let p of i)o?.add(p.id);let s=(p,b,g)=>{let v=new Map,w=[],R=new Map,M=y=>{if(y.plane.floorIndex===0||y.plane.baseHeightM>0)return y.plane.baseHeightM;let P=R.get(y.plane.floorIndex-1);return P===void 0?y.plane.baseHeightM:P+wc};for(let y of a){if(i.has(y))y.height=M(y),y.level=0,y.rake=0,y.backHeight=y.height,v.set(y.id,void 0);else if(!y.authored){let x=M(y),S;for(let I of w){if(I.plane.floorIndex>y.plane.floorIndex)continue;if(cb(y,I)){let F=ub(y,I)+Tp;F>x&&(x=F,S=I);continue}let k=sb(y,I,i.has(I));if(k==null)continue;let L=n&&!!y.plane.stageDeck&&I.level===0&&I.plane.floorIndex===y.plane.floorIndex&&Math.max(0,k)*le<=Lp,B=i.has(I)?I.height+Bp:L?I.backHeight:I.backHeight+yp+Math.min(gp,Math.max(0,k)*le)*Math.tan(I.rake*Math.PI/180);B>x&&(x=B,S=I)}let A=p.get(y);A&&A.height>x+.01?(x=A.height,S=void 0):A=void 0,y.height=Math.round(Math.min(x,y.plane.baseHeightM+wp)*100)/100;let _=!S&&!A&&y.height>y.plane.baseHeightM;if(y.level=S?S.level+1:A?A.level:_?1:0,y.rake=ab(y.rowDepths,y.frontDistance,y.height,y.plane.focalHeightM),!y.facesAction&&y.rowCount<Ep)y.rake=0;else if(y.level===0){let I=Math.max(1e-6,(y.backD-y.frontD)*le);y.rake=Math.min(y.rake,Mp,Math.round(Math.atan(Sp/I)*1800/Math.PI)/10)}else y.rowCount>=2&&(y.rake=Math.max(y.rake,r[Math.min(y.level,r.length)-1]));let D=(y.backD-y.frontD)*le,E=S&&i.has(S)||A&&g?.has(A.id);if(b!==void 0&&E&&y.rowCount>=2&&(y.rake=b),t&&D>0&&y.height+D*Math.tan(y.rake*Math.PI/180)>y.plane.baseHeightM+Ic){let I=Math.max(0,y.plane.baseHeightM+Ic-y.height);y.rake=Math.max(Ec,Math.round(Math.atan(I/D)*1800/Math.PI)/10)}n&&y.plane.stageDeck&&y.level>0&&(y.rake=Math.min(y.rake,Op)),y.backHeight=y.height+D*Math.tan(y.rake*Math.PI/180),v.set(y.id,S?.id??(A?v.get(A.id):void 0))}let P=y.plane.floorIndex;R.set(P,Math.min(R.get(P)??1/0,y.height)),w.push(y)}return v},c=s(new Map),u=new Map,l=p=>u.get(p)?.height??p.height;for(let p=!0,b=0;p&&b<e.length;b++){p=!1;for(let g of e)if(!(g.authored||i.has(g)))for(let v of e){let w=u.get(v)??v;v===g||w.height-w.plane.baseHeightM<Yp||w.height<=l(g)+.01||fb(g,v)&&(u.set(g,w),p=!0)}}let m=new Map(e.map(p=>[p.id,p])),h=e.filter(p=>!p.authored&&p.rowCount>=2&&i.has(m.get(c.get(p.id)??""))),f=h.length?qr(h.map(p=>p.rake)):void 0;if(!u.size&&f===void 0)return c;let d=new Map([...new Set(u.values())].map(p=>[p,{...p}]));return s(new Map([...u].map(([p,b])=>[p,d.get(b)])),f,new Set(h.map(p=>p.id)))}var Kr=(e,t)=>!!e&&e.x===t.x&&e.y===t.y;function Ro(e,t={x:0,y:-40}){let n=Ut(e),o=new Map;for(let g of n){if(!g.sectionId)continue;let v=o.get(g.sectionId);v?v.push(g):o.set(g.sectionId,[g])}let r={focalInferred:!1,confident:!1,sections:[]},i=e.floors?.length?e.floors.map((g,v)=>({objects:g.objects,floorIndex:v,floorId:g.id,baseHeightM:g.baseHeightM??0,focal:g.focalPoint??e.focalPoint})):[{objects:e.objects,floorIndex:0,floorId:void 0,baseHeightM:0,focal:e.focalPoint}],a=new Set(i.flatMap(g=>g.objects.filter(v=>v.type==="table").map(v=>v.id))),s=[],c,u=new Set,l=i.map(g=>{let v=E=>!e.floors?.length||E.floorId===g.floorId,w=rb(n.filter(E=>!E.sectionId&&E.kind!=="booth"&&!a.has(E.rowId)&&v(E))),R=[];for(let E of w){let I=$e(et(kc(E)),qp/le);if(n.some(L=>!v(L)&&Qr(L,I)))continue;let k=`${Ac}${g.floorIndex}-${R.length}`;u.add(k),o.set(k,E),R.push({type:"section",id:k,label:"",color:Zp,outline:I})}let M=R.length?{...g,objects:[...g.objects,...R]}:g,y=new Set(M.objects.filter(E=>E.type==="section").map(E=>E.logicalSectionId??E.id)),P=[...o.entries()].filter(([E])=>y.has(E)).flatMap(([,E])=>E),x=nb(M.objects,Zr(P),P),S=M.focal;(x||M.focal&&!Kr(M.focal,t))&&(r.confident=!0),x&&(r.stage??={id:x.shape.id,inferred:x.inferred,...M.floorId?{floorId:M.floorId}:{}},(x.inferred||Kr(M.focal,t))&&(S=x.centre,r.focalInferred=!0));let A=x&&(!x.inferred||Tn(x.outline)*le*le<=Yr),_=x?void 0:c,D={tableIds:a,floorIndex:M.floorIndex,floorId:M.floorId,baseHeightM:M.baseHeightM,focal:_?.focal??S,outline:x?.outline??_?.outline,focalHeightM:_?.focalHeightM??M.baseHeightM+(x&&A?qe({...x.shape,role:"stage"}).heightM:0),stageDeck:_?.stageDeck??!!(x&&A&&Tn(x.outline)*le*le<=Yr),middle:P.length?{x:P.reduce((E,I)=>E+I.x,0)/P.length,y:P.reduce((E,I)=>E+I.y,0)/P.length}:S};for(let E of M.objects){if(E.type!=="section")continue;let I=ib(E,o.get(E.logicalSectionId??E.id)??[],D);I&&s.push(I)}return D.outline&&(c=D),Kr(M.focal,D.focal)||(r.focal??=[]).push({...M.floorId?{floorId:M.floorId}:{},point:{...D.focal}}),{unit:M,plane:D,stage:x,planeSeats:P}}),m=i.flatMap(g=>g.objects).map(g=>g.type==="shape"&&!g.role&&(Wr(g.label)==="wall"||!Wr(g.label)&&Pc(g))?{...g,role:"wall"}:g),h=Wt({objects:m},n)!==null;h&&(r.indoor=!0);let f=new Set,d=db(s,h,lb(n,l[0]?.plane.focal??t)<kp,f),p=new Map(s.filter(g=>!g.authored).map(g=>[g.id,g])),b=l.map(({unit:g,plane:v,stage:w,planeSeats:R})=>g.objects.map(M=>{let y=M.type==="shape"&&!M.role&&M.id!==w?.shape.id?Wr(M.label):null;if(M.type==="shape"&&!M.role&&M.id!==w?.shape.id&&(y==="wall"||!y&&Pc(M))&&M.type==="shape"){(r.roles??=[]).push({id:M.id,...v.floorId?{floorId:v.floorId}:{},role:"wall"});let{fill:I,...k}=M;return{...k,role:"wall"}}if(y&&M.type==="shape")return(r.roles??=[]).push({id:M.id,...v.floorId?{floorId:v.floorId}:{},role:y}),{...M,role:y};let x=w?.inferred&&M.id===w.shape.id&&M.type==="shape"?Jp(M,w.outline,g.objects,R):null;if(x&&M.type==="shape")return r.stage?.id===M.id&&(r.stage.field=x),{...M,role:"stage",stageKind:x};let S=M.type==="shape"&&M.id===w?.shape.id&&M.heightM===void 0&&!M.stageKind&&s.some(I=>I.plane===v&&(f.has(I.id)||I.level===0&&I.facesAction&&I.rake<=Hp&&(I.frontDistance+I.backD-I.frontD)*le>=Gp)),A=S?{heightM:Vp}:{};if(w?.inferred&&M.id===w.shape.id&&M.type==="shape"&&Tn(w.outline)*le*le<=Yr)return r.stage?.id===M.id&&(r.stage.deck=!0),{...M,role:"stage",...A};if(S&&M.type==="shape"&&M.role==="stage")return{...M,...A};let _=M.type==="section"?p.get(M.id):void 0;if(!_||M.type!=="section")return M;let D=_.rowCount>=2&&_.rake>0;u.has(_.id)?r.looseRowBlocks=(r.looseRowBlocks??0)+1:r.sections.push({id:_.id,floorId:v.floorId,surfaceKind:D?"rakedRows":"flat",height:_.height,rake:_.rake,stackedOn:d.get(_.id)});let E={status:"inferred",source:"public-2d-topology",note:eb};return{...M,height:_.height,rake:_.rake,surfaceKind:D?"rakedRows":"flat",physical3dProvenance:{height:E,rake:E,surfaceKind:E}}}));if(e.floors?.length){let g=e.floors.map((v,w)=>({...v,objects:b[w],focalPoint:l[w].plane.focal}));return{doc:{...e,floors:g,objects:g[0].objects,focalPoint:g[0].focalPoint},report:r}}return{doc:{...e,objects:b[0],focalPoint:l[0].plane.focal},report:r}}var Lc=/^[\p{L}\p{N}]{1,4}$/u,hb=/^([\p{L}\p{N}]{2,})[\s\-\u2013\u2014\u00b7_./]+(.+)$/u;function Oc(e,t){let n=t?.trim();if(!n)return e;let o=e.toLocaleLowerCase("en-US"),r=n.toLocaleLowerCase("en-US");if(o.startsWith(`${r} `)){let a=e.slice(n.length).trim();if(Lc.test(a))return a}let i=hb.exec(e);if(i){let a=i[1].toLocaleLowerCase("en-US"),s=i[2].trim();if((r.startsWith(a)||a.startsWith(r))&&Lc.test(s))return s}return e}function Fc(e,t,n){return n<0?t>1?e.filter(o=>o.kind==="floor"):[...e]:e.filter(o=>o.floorIndex===void 0||o.floorIndex===n)}function Dc(e,t){let n=[...e].sort((r,i)=>r.screen.y-i.screen.y),o=[];for(let r of n){let i=o.find(a=>a.some(s=>Math.abs(s.screen.x-r.screen.x)<104&&Math.abs(s.screen.y-r.screen.y)<34));i?i.push(r):o.push([r])}return o.flatMap(r=>r.length<2?r:r.map((i,a)=>({...i,screen:{...i.screen,x:Math.max(54,Math.min(t-54,i.screen.x+(a-(r.length-1)/2)*104))}})))}var pb=1.15,bb=2.75,yb=4.5,gb=.85,xb=.5,vb=.26;function Nc(e,t,n){let o=Math.max(1e-6,t),r=e/o,i=n?.hasZoneLabels??!0,a=new Set(["stage"]);return r>=.75&&a.add("floor"),r>=pb&&a.add("zone"),r<=(i?bb:yb)&&(a.add("section"),a.add("ga")),r<=gb&&(a.add("annotation"),a.add("booth")),r<=xb&&a.add("row"),r<=vb&&a.add("seat"),a}function Bc(e,t,n,o,r,i=6){let a=i+t,s=o-i-t,c=i+n,u=r-i-n;return{...e,x:a>s?o/2:Math.max(a,Math.min(s,e.x)),y:c>u?r/2:Math.max(c,Math.min(u,e.y))}}function nt(e,t,n,o){let r=e,i=t[0],a=t[1],s=t[2],c=r[0]*i+r[4]*a+r[8]*s+r[12],u=r[1]*i+r[5]*a+r[9]*s+r[13],l=r[2]*i+r[6]*a+r[10]*s+r[14],m=r[3]*i+r[7]*a+r[11]*s+r[15];if(!(m>1e-6))return{x:0,y:0,depth:1/0,visible:!1};let h=c/m,f=u/m,d=l/m,p=h>=-1.05&&h<=1.05&&f>=-1.05&&f<=1.05&&d<=1;return{x:(h*.5+.5)*n,y:(1-(f*.5+.5))*o,depth:d,visible:p}}function Vc(e,t,n=t){let o=[],r=[...e].sort((i,a)=>i.screen.depth-a.screen.depth);for(let i of r){let a=!1;for(let s of o)if(kn(i,s,t,n)){a=!0;break}a||o.push(i)}return o}var Mb=6;function kn(e,t,n,o){let r=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+Mb):n;return r<a&&i<o}function Hc(e,t,n){return e.length*t*.58+(n?14:0)}var Sb={row:8,seat:14};function Gc(e){return e<480?{row:5,seat:8}:e<768?{row:6,seat:10}:Sb}function zc(e,t,n,o){let r=Math.max(1,Math.min(n,o)*.5),i=Math.min(2,Math.hypot(e.x-n/2,e.y-o/2)/r);return t*(1+1.5*i)}function Ln(e,t,n,o,r=[]){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>=o)break;let c=!1;for(let u of r)if(kn(s,u,t,n)){c=!0;break}if(!c){for(let u of a)if(kn(s,u,t,n)){c=!0;break}}c||a.push(s)}return a}function ei(e,t,n,o){let r=e[3]*t[0]+e[7]*t[1]+e[11]*t[2]+e[15];return r<=0||!(n>0)?0:n*Math.hypot(e[0],e[4],e[8])*o/(2*r)}var wb=6,Pb=2.2,Uc=.1,Ib=new Set(["stage","entrance","exit","screen","suite","obstruction","sound","bar","concession","restroom","coat"]),Ab=.3,Rb=1.8,Eb=.9,Cb=.55,_b=1,jc=4e3,Tb=6,Xc="#d8a425",kb="#e8c15a",ti="#1c1608";function Wc(e){let t=e.accessibility;if(t?.length)return{icon:t.includes("wheelchair")?"wheelchair":t[0],color:Qn(t)};let n=e.commercial;return n?.obstructedView?{icon:"obstructedView",color:Xc,ink:ti}:n?.restrictedView?{icon:"restrictedView",color:Xc,ink:ti}:n?.premium?{icon:"premium",color:kb,ink:ti}:null}var Lb=6e3;function Kc(e){let{doc:t,units:n,seats:o,surfaces:r,focal:i}=e,a=t.zones??[],s=[];if(a.length){let c=new Map;for(let l of n)for(let m of l.objects)m.type==="section"&&m.zone&&c.set(m.id,m.zone);let u=new Map;for(let l=0;l<o.length;l++){let m=o[l],h=r.seatOwner[l],f=m.zoneId??(h?c.get(h):void 0);if(!f)continue;let d=u.get(f);d||(d={n:0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0,sumY:0},u.set(f,d)),d.n++,m.x<d.minX&&(d.minX=m.x),m.y<d.minY&&(d.minY=m.y),m.x>d.maxX&&(d.maxX=m.x),m.y>d.maxY&&(d.maxY=m.y),d.sumY+=r.seatDeckY(l)}for(let l of a){let m=u.get(l.id),h=[];for(let[f,d]of c)d===l.id&&h.push(f);if(!m||m.n===0){s.push({id:l.id,label:l.label,color:he(l.color),sectionIds:h,seatCount:0,center:[0,0,0],radius:0,focalWorld:[(l.focalPoint??i).x*T,1.5,(l.focalPoint??i).y*T]});continue}s.push({id:l.id,label:l.label,color:he(l.color),sectionIds:h,seatCount:m.n,center:[(m.minX+m.maxX)/2*T,m.sumY/m.n,(m.minY+m.maxY)/2*T],radius:.5*Math.hypot((m.maxX-m.minX)*T,(m.maxY-m.minY)*T)||1,focalWorld:[(l.focalPoint??i).x*T,1.5,(l.focalPoint??i).y*T]})}}return s}function $c(e){let{doc:t,units:n,seats:o,surfaces:r,seatData:i,hintedSeatFloor:a,zones:s,focal:c}=e,u=[],l=[],m=[],h=new Map;for(let f of n)for(let d of f.objects){if(d.type!=="section"||!d.zone)continue;let p=(d.displayLabel||d.label||"").trim().toLocaleLowerCase();if(!p)continue;let b=t.floors?.[f.index]?.name?.trim().toLocaleLowerCase();if(n.length>1&&b===p)continue;let g=h.get(d.zone);g||h.set(d.zone,g=new Set),g.add(p)}for(let f of s)f.seatCount!==0&&(h.get(f.id)?.has(f.label.trim().toLocaleLowerCase())||u.push({id:`zone:${f.id}`,kind:"zone",text:f.label,anchor:[f.center[0],f.center[1]+wb,f.center[2]],color:t.zones?.find(d=>d.id===f.id)?.color}));{let f=new Map,d=new Map;for(let p=0;p<o.length;p++){let b=r.seatOwner[p];if(!b)continue;let g=f.get(b);g||(g={n:0,x:0,y:0,deck:0},f.set(b,g)),g.n++,g.x+=o[p].x,g.y+=o[p].y,g.deck+=r.seatDeckY(p);let v=d.get(b);v||(v={minX:1/0,maxX:-1/0,minY:1/0,maxY:-1/0,minDeck:1/0,maxDeck:-1/0},d.set(b,v)),v.minDeck=Math.min(v.minDeck,r.seatDeckY(p)),v.maxDeck=Math.max(v.maxDeck,r.seatDeckY(p)),o[p].x<v.minX&&(v.minX=o[p].x),o[p].x>v.maxX&&(v.maxX=o[p].x),o[p].y<v.minY&&(v.minY=o[p].y),o[p].y>v.maxY&&(v.maxY=o[p].y)}for(let p of n)for(let b of p.objects){if(b.type!=="section"||Rc(b))continue;let g=f.get(b.id);if(!g||g.n===0)continue;let v=d.get(b.id),w=[g.x/g.n*T,g.deck/g.n,g.y/g.n*T],R=b.displayLabel||b.label||b.id;l.push({id:b.id,floorIndex:p.index,label:R,seatCount:g.n,center:w,radius:Math.max(1,Math.hypot(v.maxX-v.minX,v.maxY-v.minY)*.5*T),box:{min:[v.minX*T-.4,v.minDeck,v.minY*T-.4],max:[v.maxX*T+.4,v.maxDeck+1,v.maxY*T+.4]},focalWorld:[p.focal.x*T,p.baseHeightM+1.5,p.focal.y*T]});let M=t.floors?.[p.index]?.name?.trim().toLocaleLowerCase();n.length>1&&M===R.trim().toLocaleLowerCase()||u.push({id:`section:${b.id}`,kind:"section",text:R,anchor:[w[0],w[1]+Pb,w[2]],floorIndex:p.index})}}{for(let M of n)for(let y of M.objects){if(y.type!=="gaArea")continue;let P=yn(y.points);if(!P)continue;let x=y.displayLabel||y.label||y.id;u.push({id:`ga:${y.id}`,kind:"ga",text:y.capacity>0?`${x} \xB7 ${y.capacity.toLocaleString()}`:x,anchor:[P.x*T,M.baseHeightM+Rb,P.y*T],floorIndex:M.index})}let f=new Map,d=new Map;for(let M of n)for(let y of M.objects)if(y.type==="section"&&f.set(y.id,y.displayLabel||y.label||y.id),y.type==="row"){let P=y.displayLabel?.trim()||y.segmentedRow?.displayLabel?.trim();P&&d.set(y.id,P)}let p=new Map;for(let M=0;M<o.length;M++){let y=o[M],P=Math.hypot(y.x-c.x,y.y-c.y),x=p.get(y.rowId);(!x||P>x.far)&&p.set(y.rowId,{seat:y,index:M,far:P})}for(let[M,y]of p){let P=r.seatOwner[y.index]??y.seat.sectionId,x=Yc(y.seat.label,M,f.get(P??""),d.get(M));x&&u.push({id:`row:${M}`,kind:"row",text:x,anchor:[y.seat.x*T,r.seatDeckY(y.index)+Eb,y.seat.y*T],floorIndex:a[y.index]})}let b=new Map;for(let M=0;M<o.length;M++){let y=o[M],P=b.get(y.rowId);P||(P={n:0,x:0,y:0,z:0,minX:1/0,maxX:-1/0,minZ:1/0,maxZ:-1/0,label:Yc(y.label,y.rowId,f.get(r.seatOwner[M]??y.sectionId??""),d.get(y.rowId)),sectionId:r.seatOwner[M]??y.sectionId},b.set(y.rowId,P));let x=M*3,S=i.iPosition[x],A=i.iPosition[x+1],_=i.iPosition[x+2];P.n++,P.x+=S,P.y+=A,P.z+=_,P.minX=Math.min(P.minX,S),P.maxX=Math.max(P.maxX,S),P.minZ=Math.min(P.minZ,_),P.maxZ=Math.max(P.maxZ,_)}for(let[M,y]of b)m.push({id:M,label:y.label,sectionId:y.sectionId,seatCount:y.n,center:[y.x/y.n,y.y/y.n,y.z/y.n],radius:Math.max(.8,Math.hypot(y.maxX-y.minX,y.maxZ-y.minZ)*.5)});let g=0,v=(M,y)=>{g++,u.push({id:`access:${o[M].id}`,kind:"access",text:"",icon:y.icon,color:y.color,...y.ink?{ink:y.ink}:{},seatWidthM:i.iChairWidth[M]*2,anchor:[o[M].x*T,r.seatDeckY(M)+_b,o[M].y*T],floorIndex:a[M],rowId:o[M].rowId})},w=null,R=()=>{if(w){let M=Wc(o[w.seats[0]]),y=w.seats.length,P=Math.max(1,Math.round(y/Tb));for(let x=0;x<P&&g<jc;x++)v(w.seats[Math.min(y-1,Math.floor((x+.5)*y/P))],M)}w=null};for(let M=0;M<o.length&&g<jc;M++){let y=Wc(o[M]);if(y&&o[M].accessibility?.length){R(),v(M,y);continue}if(!y){R();continue}w&&w.rowId===o[M].rowId&&w.icon===y.icon?w.seats.push(M):(R(),w={rowId:o[M].rowId,icon:y.icon,seats:[M]})}if(R(),o.length<=Lb)for(let M=0;M<o.length;M++){let y=o[M],P=ni(y.displayLabel||y.label);P&&u.push({id:`seat:${y.id}`,kind:"seat",seatWidthM:i.iChairWidth[M]*2,text:P,anchor:[y.x*T,r.seatDeckY(M)+Cb,y.y*T],floorIndex:a[M],rowId:y.rowId})}}for(let f of n)for(let d of f.objects)if(d.type==="shape"&&d.role&&Ib.has(d.role)){let p=ve(d),b=p?yn(p):null;if(!b||!d.label)continue;u.push({id:`architecture:${d.id}`,kind:d.role==="stage"?"stage":"annotation",text:d.label,anchor:[b.x*T,f.baseHeightM+qe(d).heightM+Uc,b.y*T],color:d.fill,floorIndex:f.index})}else if(d.type==="text"){if(!d.text)continue;u.push({id:`text:${d.id}`,kind:"annotation",text:d.text,anchor:[d.position.x*T,f.baseHeightM+Uc,d.position.y*T],color:d.color,rotation:d.rotation,floorIndex:f.index})}else if(d.type==="booth"){let p=Ze(d);if(!p)continue;let b=yn(p);if(!b)continue;u.push({id:`booth:${d.id}`,kind:"booth",text:d.displayLabel||d.label||d.id,anchor:[b.x*T,f.baseHeightM+Mo+Ab,b.y*T],floorIndex:f.index})}return{labels:u,sections:l,rows:m}}function qc(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 ni(e){let t=e.lastIndexOf("-");return t>=0&&t<e.length-1?e.slice(t+1):e}function Yc(e,t,n,o){if(o?.trim())return o.trim();let r=e?e.lastIndexOf("-"):-1,i=r>0?e.slice(0,r):t;return i&&Oc(i,n)}function Zc(e){let{doc:t,units:n,seats:o,surfaces:r,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 h=0;h<i.floor.length;h+=1){let f=Math.max(0,Math.min(n.length-1,Math.round(i.floor[h]))),d=h*3,p=u[f];p.minX=Math.min(p.minX,i.position[d]),p.minY=Math.min(p.minY,i.position[d+1]),p.minZ=Math.min(p.minZ,i.position[d+2]),p.maxX=Math.max(p.maxX,i.position[d]),p.maxY=Math.max(p.maxY,i.position[d+1]),p.maxZ=Math.max(p.maxZ,i.position[d+2])}let l=new Map;for(let h=0;h<n.length;h++)for(let f of n[h].objects)f.type==="section"&&l.set(f.id,h);let m=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 h=0;h<o.length;h++){let f=r.seatOwner[h],d=(f!==null?l.get(f):void 0)??a[h];if(d===void 0)continue;let p=m[d],b=o[h];p.n++,b.x<p.minX&&(p.minX=b.x),b.y<p.minY&&(p.minY=b.y),b.x>p.maxX&&(p.maxX=b.x),b.y>p.maxY&&(p.maxY=b.y);let g=r.seatDeckY(h);p.sumX+=b.x*T,p.sumDeck+=g,p.sumZ+=b.y*T,p.minDeck=Math.min(p.minDeck,g),p.maxDeck=Math.max(p.maxDeck,g+1.6),s[h]=d}for(let h=0;h<n.length;h++){let f=m[h],d=t.floors?.[h],p=u[h],b=Math.min(f.n?f.minX*T:n[h].focal.x*T-1,Number.isFinite(p.minX)?p.minX:1/0),g=Math.max(f.n?f.maxX*T:n[h].focal.x*T+1,Number.isFinite(p.maxX)?p.maxX:-1/0),v=Math.min(f.n?f.minY*T:n[h].focal.y*T-1,Number.isFinite(p.minZ)?p.minZ:1/0),w=Math.max(f.n?f.maxY*T:n[h].focal.y*T+1,Number.isFinite(p.maxZ)?p.maxZ:-1/0),R=Math.min(f.n?Math.min(n[h].baseHeightM,f.minDeck):n[h].baseHeightM,Number.isFinite(p.minY)?p.minY:1/0),M=Math.max(f.n?Math.max(f.maxDeck,R+.5):R+.5,Number.isFinite(p.maxY)?p.maxY:-1/0),y=[f.n?f.sumX/f.n:(b+g)/2,f.n?f.sumDeck/f.n:(R+M)/2,f.n?f.sumZ/f.n:(v+w)/2],P=Math.max(1,.5*Math.hypot(g-b,M-R,w-v));c.push({index:h,id:d?.id??`floor-${h}`,label:d?.name??(n.length>1?`Floor ${h+1}`:"Venue"),seatCount:f.n,center:y,radius:P,box:{min:[b,R,v],max:[g,M,w]},focalWorld:[n[h].focal.x*T,n[h].baseHeightM+1.5,n[h].focal.y*T]})}}return c}function oi(e,t){let n=1/0,o=1/0,r=-1/0,i=-1/0,a=(s,c)=>{s<n&&(n=s),c<o&&(o=c),s>r&&(r=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=Ze(c);if(u)for(let l of u)a(l.x,l.y)}else if(c.type==="table"){let u=So(c);if(u)for(let l of u)a(l.x,l.y)}else if(c.type==="decorImage"){let u=wo(c);if(u)for(let l of u)a(l.x,l.y)}return Number.isFinite(n)||(n=-100,o=-100,r=100,i=100),{minX:n,minY:o,maxX:r,maxY:i}}function ol(e,t,n,o,r,i,a){if(t.length===1){let s=n.map(h=>({x:h.x,y:h.y}));for(let h of t[0].objects)h.type==="section"?s.push(...h.outline):h.type==="shape"?s.push(...ve(h)??h.points??[]):h.type==="gaArea"?s.push(...h.points):h.type==="booth"?s.push(...Ze(h)??[]):h.type==="table"?s.push(...So(h)??[]):h.type==="decorImage"&&s.push(...wo(h)??[]);if(el(e,t[0],n,i)||nl(e,t[0],n,s,i))return!1;if(a&&Jc(e,t[0].baseHeightM,s,i,a))return!0;let c=An(s),u=(r.minX+r.maxX)/2,l=(r.minY+r.maxY)/2,m=c.length>=3?c.map(h=>{let f=h.x-u,d=h.y-l,p=Math.max(1,Math.hypot(f,d));return{x:h.x+f/p*80,y:h.y+d/p*80}}):vn(r.minX-28,r.minY-28,r.maxX-r.minX+56,r.maxY-r.minY+56);return ce(e,m,void 0,()=>-.04,-.22,i.ground,i.ground,re),!1}else{let s=t.reduce((b,g)=>g.baseHeightM<b.baseHeightM?g:b);e.setFloor(s.index);let c={...s,objects:t.flatMap(b=>b.objects)},u=n.map(b=>({x:b.x,y:b.y}));for(let b of c.objects)b.type==="section"&&u.push(...b.outline);if(el(e,c,n,i)||nl(e,c,n,u,i))return!1;if(a&&Jc(e,s.baseHeightM,u,i,a))return!0;let l=n.filter((b,g)=>o[g]===s.index),m=oi([s],l),h=Math.hypot(m.maxX-m.minX,m.maxY-m.minY),f=Math.max(28,Math.min(80,h*.04)),d=vn(m.minX-f,m.minY-f,m.maxX-m.minX+f*2,m.maxY-m.minY+f*2),p=s.baseHeightM-.03;return ce(e,d,void 0,()=>p,p-.22,i.ground,i.ground,re),!1}}function ri(e,t,n,o){let{cx:r,cz:i,radius:a}=n,s=1/0,c=1/0,u=1/0,l=-1/0,m=-1/0,h=-1/0,f=(b,g,v)=>{s=Math.min(s,b),l=Math.max(l,b),c=Math.min(c,g),m=Math.max(m,g),u=Math.min(u,v),h=Math.max(h,v)};for(let b=0;b<e.position.length;b+=3){let g=b/3;o&&g>=o[0]&&g<o[1]||f(e.position[b],e.position[b+1],e.position[b+2])}for(let b=0;b<t.count;b++){let g=b*3,v=t.iPosition[g],w=t.iPosition[g+1],R=t.iPosition[g+2],M=Math.max(.35,t.iMaxRadius[b]??.35);f(v-M,w,R-M),f(v+M,w+1.6,R+M)}Number.isFinite(s)||(s=r-a,l=r+a,c=0,m=a*.16,u=i-a,h=i+a);let d=[(s+l)/2,(c+m)/2,(u+h)/2],p=Math.max(1,.5*Math.hypot(l-s,m-c,h-u));return{center:d,radius:p,minY:c,maxY:m}}var Ob=4096;function rl(e,t,n=[]){let o=Math.max(1,Math.ceil(e.count/Ob)),r=Math.ceil(e.count/o),i=new Float32Array((r*2+t.length*4+n.length)*3),a=0;for(let s=0;s<e.count;s+=o){let c=e.iPosition[s*3],u=e.iPosition[s*3+1],l=e.iPosition[s*3+2];i[a++]=c,i[a++]=u,i[a++]=l,i[a++]=c,i[a++]=0,i[a++]=l}for(let[s,c,u]of n)i[a++]=s,i[a++]=c,i[a++]=u;for(let s of t)for(let[c,u]of[[-1,-1],[1,-1],[1,1],[-1,1]])i[a++]=s.cx+c*s.halfX,i[a++]=s.y,i[a++]=s.cz+u*s.halfZ;return i.subarray(0,a)}function il(e,t,n,o,r,i,a=[]){let s=1/0,c=1/0,u=-1/0,l=-1/0;for(let M=0;M<e.count;M++){let y=M*3,P=e.iPosition[y],x=e.iPosition[y+2];P<s&&(s=P),P>u&&(u=P),x<c&&(c=x),x>l&&(l=x)}for(let[M,,y]of a)M<s&&(s=M),M>u&&(u=M),y<c&&(c=y),y>l&&(l=y);for(let M of t)s=Math.min(s,M.cx-M.halfX),u=Math.max(u,M.cx+M.halfX),c=Math.min(c,M.cz-M.halfZ),l=Math.max(l,M.cz+M.halfZ);let m=n.minX*T,h=n.maxX*T,f=n.minY*T,d=n.maxY*T,p=m,b=h,g=f,v=d;if(Number.isFinite(s)){let M=Math.max(2,.06*Math.hypot(u-s,l-c));p=Math.max(m,s-M),b=Math.min(h,u+M),g=Math.max(f,c-M),v=Math.min(d,l+M)}let w=Math.min(0,o),R=Math.max(r,i*.05);return{min:[p,w,g],max:[b,R,v]}}var Qc=12,Fb=.6,Db=40;function Jc(e,t,n,o,r){let i=An([...n]);if(i.length<3)return!1;let a=1/0,s=1/0,c=-1/0,u=-1/0;for(let R of i)a=Math.min(a,R.x),c=Math.max(c,R.x),s=Math.min(s,R.y),u=Math.max(u,R.y);let l=Math.hypot(c-a,u-s)*T,m=$e(i,Qc/T,1.2),h=Math.max(Db,l*Fb),f=$e(i,(Qc+h)/T,1.2);if(m.length!==f.length)return!1;let d=pe(o.ground,[.78,.76,.72],.35),p=pe(o.ground,[.56,.62,.52],.3);ce(e,m,void 0,()=>t-.04,t-.22,d,d,re);let b=t-.05,g=m.map(R=>[R.x*T,b,R.y*T]),v=f.map(R=>[R.x*T,b,R.y*T]),w=[0,1,0];for(let R=0;R<g.length;R++){let M=(R+1)%g.length;e.tri(g[R],v[M],v[R],w,p,r,r),e.tri(g[R],g[M],v[M],w,p,p,r)}return!0}function el(e,t,n,o){let r=Wt(t,n);if(!r)return!1;let i=t.baseHeightM,a=pe(o.ground,[.62,.55,.47],.4);return ce(e,r,void 0,()=>i-.04,i-.22,a,a,re),!0}var Nb=3e3,Bb=20,tl=1.5,Vb=1.2,Hb=.25;function nl(e,t,n,o,r){if(!n.length||n.length>Nb||o.length<3)return!1;for(let S of t.objects){if(S.type==="shape"&&oo(S.stageKind))return!1;if(S.type==="section"){let{height:A}=bt(S,{floorBaseHeightM:t.baseHeightM});if(A-t.baseHeightM>Bb)return!1}}let i=0,a=0;for(let S of o)i+=S.x,a+=S.y;i/=o.length,a/=o.length;let s=0,c=0,u=0;for(let S of o){let A=S.x-i,_=S.y-a;s+=A*A,c+=_*_,u+=A*_}let l=.5*Math.atan2(2*u,s-c),m=Math.cos(l),h=Math.sin(l),f=-h,d=m,p=1/0,b=-1/0,g=1/0,v=-1/0;for(let S of o){let A=(S.x-i)*m+(S.y-a)*h,_=(S.x-i)*f+(S.y-a)*d;p=Math.min(p,A),b=Math.max(b,A),g=Math.min(g,_),v=Math.max(v,_)}let w=S=>[[p-S,g-S],[b+S,g-S],[b+S,v+S],[p-S,v+S]].map(([A,_])=>({x:i+m*A+f*_,y:a+h*A+d*_})),R=w(tl/T),M=w((tl+Hb)/T),y=t.baseHeightM,P=pe(r.ground,[.62,.55,.47],.4),x=pe(r.ground,[.86,.86,.84],.55);return ce(e,M,void 0,()=>y-.04,y-.22,P,P,re),ce(e,M,[R.slice().reverse()],()=>y+Vb,y-.04,pe(x,[1,1,1],.2),x,re),!0}function al(e,t,n){let o=()=>({byObjectId:new Map,elements:[]});if(!t||!e)return o();let r=ja(t);if(!r.ok||r.value.id!==e)return o();let i=new Map;for(let m of n)for(let h of m.objects)h.type==="shape"&&i.set(h.id,{shape:h,unit:m});let a=new Set,s=new Set,c=new Map((t.overlay.productionElements??[]).map(m=>{let h=m.runtimeContentImageUrl;return[m.id,typeof h=="string"&&/^(?:blob:|data:image\/|https:\/\/)/.test(h)?h:void 0]})),u=[];for(let m of r.value.overlay.productionElements??[]){let h=i.get(m.objectId),f=h?ve(h.shape):null,d=m.baseElevationM??0;if(!h||!f||f.length<3||!m.id||a.has(m.id)||s.has(m.objectId)||!Number.isFinite(m.heightM)||m.heightM<.05||m.heightM>50||!Number.isFinite(d)||d<-10||d>100)return o();a.add(m.id),s.add(m.objectId);let p=f.map(x=>x.x*T),b=f.map(x=>x.y*T),g=h.unit.baseHeightM+d,v=Math.min(...p),w=Math.max(...p),R=Math.min(...b),M=Math.max(...b),y,P=c.get(m.id)??m.contentImageUrl;if(m.kind==="screen"&&P&&(y=Os(f,g,g+m.heightM,h.unit.focal),!y))if(w-v>=M-R){let x=Math.abs(R-h.unit.focal.y*T)<=Math.abs(M-h.unit.focal.y*T)?R-.006:M+.006;y=[[v,g,x],[w,g,x],[v,g+m.heightM,x],[w,g+m.heightM,x]]}else{let x=Math.abs(v-h.unit.focal.x*T)<=Math.abs(w-h.unit.focal.x*T)?v-.006:w+.006;y=[[x,g,R],[x,g,M],[x,g+m.heightM,R],[x,g+m.heightM,M]]}u.push({id:m.id,objectId:m.objectId,kind:m.kind,floorIndex:h.unit.index,baseY:g,topY:g+m.heightM,bounds:{min:[v,g,R],max:[w,g+m.heightM,M]},occlusion:m.occlusion,...P?{contentImageUrl:P}:{},...y?{contentPlane:y}:{}})}let l=u.sort((m,h)=>m.id.localeCompare(h.id));return{byObjectId:new Map(l.map(m=>[m.objectId,m])),elements:l}}var sl=[.13,.14,.17],Zt=[.4,.43,.47],Gb=.18,zb=.02,Ub=2.4,jb=1500,Xb=240,Wb=.25;function cl(e,t,n,o){let r=t.stageKind??"";if(Tt(r)||r==="round"||!o.length)return;let i=ve(t);if(!i||i.length<3)return;let a={x:i.reduce((L,B)=>L+B.x,0)/i.length,y:i.reduce((L,B)=>L+B.y,0)/i.length},s=0,c=0,u=new Set;for(let L of o)s+=L.x,c+=L.y,u.add(Math.floor(Math.atan2(L.y-a.y,L.x-a.x)*180/Math.PI/10));let l=a.x-s/o.length,m=a.y-c/o.length,h=Math.hypot(l,m);if(h<1e-6)return;let f=o.reduce((L,B)=>L+Math.hypot(B.x-a.x,B.y-a.y),0)/o.length;if(u.size*10>Xb&&h<Wb*f)return;let d=l/h,p=m/h,b=-p,g=d,v=-1/0,w=1/0,R=1/0,M=-1/0;for(let L of i){let B=(L.x-a.x)*d+(L.y-a.y)*p,F=(L.x-a.x)*b+(L.y-a.y)*g;v=Math.max(v,B),w=Math.min(w,B),R=Math.min(R,F),M=Math.max(M,F)}let y=(M-R)*T,P=(v-w)*T;if(y<3||P<1.5||y*P>jb)return;let x=Gb/T,S=(L,B)=>({x:a.x+d*L+b*B,y:a.y+p*L+g*B}),A=(L,B,F,V)=>[S(L,F),S(L,V),S(B,V),S(B,F)],_=n+Math.max(3.5,Math.min(8,y*.35)),D=n+Math.min(Ub,_-n-1),E=.2/T,I=w+Math.min(P*.25,1.5)/T,k=zb/T;ce(e,A(v-2*x+k,v-x-k,R+x+E,M-x-E),void 0,()=>D,n,sl,sl,re);for(let[L,B]of[[R+x,R+x+E],[M-x-E,M-x]])ce(e,A(v-2*x,v-x,L,B),void 0,()=>_+.3,n,Zt,Zt,re),ce(e,A(I+E,v-2*x,L,B),void 0,()=>_+.3,_,Zt,Zt,re);ce(e,A(I,I+E,R+x,M-x),void 0,()=>_+.3,_,Zt,Zt,re)}function Ue(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function ze(e){return Array.isArray(e)?e:[]}function Yb(e){let t=[e];for(;t.length;){let n=t.pop();if(Array.isArray(n)){t.push(...n);continue}if(!Ue(n))continue;let o=Ue(n.extensions)?n.extensions:null;if(o&&Object.prototype.hasOwnProperty.call(o,"KHR_draco_mesh_compression"))return!0;t.push(...Object.values(n))}return!1}function Eo(e,t){return!Array.isArray(e)||e.length!==t||!e.every(n=>typeof n=="number"&&Number.isFinite(n))?null:e}function Kb(){return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}function $b(e,t){let n=new Array(16).fill(0);for(let o=0;o<4;o++)for(let r=0;r<4;r++)for(let i=0;i<4;i++)n[o*4+r]+=e[i*4+r]*t[o*4+i];return n}function qb(e){let t=Eo(e.matrix,16);if(t)return t;if(e.matrix!==void 0)return null;let n=e.translation===void 0?[0,0,0]:Eo(e.translation,3),o=e.rotation===void 0?[0,0,0,1]:Eo(e.rotation,4),r=e.scale===void 0?[1,1,1]:Eo(e.scale,3);if(!n||!o||!r)return null;let[i,a,s,c]=o,u=Math.hypot(i,a,s,c);if(!(u>1e-8))return null;let l=i/u,m=a/u,h=s/u,f=c/u,d=l+l,p=m+m,b=h+h,g=l*d,v=l*p,w=l*b,R=m*p,M=m*b,y=h*b,P=f*d,x=f*p,S=f*b;return[(1-(R+y))*r[0],(v+S)*r[0],(w-x)*r[0],0,(v-S)*r[1],(1-(g+y))*r[1],(M+P)*r[1],0,(w+x)*r[2],(M-P)*r[2],(1-(g+R))*r[2],0,n[0],n[1],n[2],1]}function Zb(e,t,n,o){return[e[0]*t+e[4]*n+e[8]*o+e[12],e[1]*t+e[5]*n+e[9]*o+e[13],e[2]*t+e[6]*n+e[10]*o+e[14]]}function Qb(e){let t=e[0],n=e[4],o=e[8],r=e[1],i=e[5],a=e[9],s=e[2],c=e[6],u=e[10],l=i*u-a*c,m=a*s-r*u,h=r*c-i*s,f=t*l+n*m+o*h;if(Math.abs(f)<1e-12)return null;let d=1/f;return[l*d,m*d,h*d,(o*c-n*u)*d,(t*u-o*s)*d,(n*s-t*c)*d,(n*a-o*i)*d,(o*r-t*a)*d,(t*i-n*r)*d]}function ll(e,t,n,o){let r=e[0]*t+e[1]*n+e[2]*o,i=e[3]*t+e[4]*n+e[5]*o,a=e[6]*t+e[7]*n+e[8]*o,s=Math.hypot(r,i,a)||1;return r/=s,i/=s,a/=s,[r,i,a]}function Jb(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,o=null,r=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&&!o)try{let c=JSON.parse(new TextDecoder().decode(s).replace(/[\u0000 ]+$/g,""));if(!Ue(c))return null;o=c}catch{return null}else if(a===5130562&&!r)r=s;else return null;n+=i}return n===e.byteLength&&o&&r?{json:o,bin:r}:null}function ey(e){return e===5120||e===5121?1:e===5122||e===5123?2:e===5125||e===5126?4:0}function ty(e){return e==="SCALAR"?1:e==="VEC2"?2:e==="VEC3"?3:e==="VEC4"?4:0}function ny(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 oy(e){let t=e instanceof Uint8Array?e:new Uint8Array(e),n=Jb(t);if(!n)return{ok:!1,issue:"invalid_glb"};let{json:o,bin:r}=n;if(!Ue(o.asset)||o.asset.version!=="2.0")return{ok:!1,issue:"unsupported_glb"};let i=ze(o.extensionsUsed).filter(R=>typeof R=="string");if(i.includes("KHR_draco_mesh_compression")||Yb(o))return{ok:!1,issue:"draco_not_allowed"};if(i.length||ze(o.extensionsRequired).length)return{ok:!1,issue:"unsupported_glb"};if(ze(o.images).length||ze(o.textures).length)return{ok:!1,issue:"external_resource"};let a=ze(o.buffers);if(a.length!==1||!Ue(a[0])||a[0].uri!==void 0||typeof a[0].byteLength!="number"||!Number.isInteger(a[0].byteLength)||a[0].byteLength<0||a[0].byteLength>r.byteLength)return{ok:!1,issue:"external_resource"};let s=ze(o.accessors),c=ze(o.bufferViews),u=ze(o.meshes),l=ze(o.nodes),m=ze(o.scenes),h=typeof o.scene=="number"?o.scene:0;if(!Ue(m[h]))return{ok:!1,issue:"unsupported_glb"};let f=new DataView(r.buffer,r.byteOffset,r.byteLength),d=(R,M,y)=>{if(typeof R!="number"||!Number.isInteger(R)||!Ue(s[R]))return null;let P=s[R];if(P.type!==M||P.sparse!==void 0||P.normalized===!0||typeof P.count!="number"||!Number.isInteger(P.count)||P.count<1||typeof P.componentType!="number"||!y.includes(P.componentType)||typeof P.bufferView!="number")return null;let x=c[P.bufferView];if(!Ue(x)||x.buffer!==0||typeof x.byteLength!="number"||!Number.isInteger(x.byteLength)||x.byteLength<0)return null;let S=ty(P.type),A=ey(P.componentType),_=typeof x.byteStride=="number"?x.byteStride:S*A,D=typeof x.byteOffset=="number"?x.byteOffset:0,E=typeof P.byteOffset=="number"?P.byteOffset:0,I=D+E,k=E+(P.count-1)*_+S*A;if(!Number.isInteger(_)||!Number.isInteger(D)||!Number.isInteger(E)||_<S*A||D<0||E<0||D+x.byteLength>r.byteLength||k>x.byteLength)return null;let L=[];for(let B=0;B<P.count;B++){let F=[];for(let V=0;V<S;V++){let N=ny(f,I+B*_+V*A,P.componentType);if(!Number.isFinite(N))return null;F.push(N)}L.push(F)}return L},p=[],b=[],g=0,v=new Set,w=(R,M)=>{if(typeof R!="number"||!Number.isInteger(R)||!Ue(l[R])||v.has(R))return!1;v.add(R);let y=l[R],P=qb(y);if(!P)return!1;let x=$b(M,P),S=Qb(x);if(!S)return!1;if(y.mesh!==void 0){if(typeof y.mesh!="number")return!1;let A=u[y.mesh];if(!Ue(A))return!1;for(let _ of ze(A.primitives)){if(!Ue(_)||_.mode!==void 0&&_.mode!==4||!Ue(_.attributes))return!1;let D=d(_.attributes.POSITION,"VEC3",[5126]),E=_.attributes.NORMAL===void 0?null:d(_.attributes.NORMAL,"VEC3",[5126]);if(!D||_.attributes.NORMAL!==void 0&&!E)return!1;let I=D.length;if(_.indices!==void 0){let L=typeof _.indices=="number"?s[_.indices]:null;I=Ue(L)?L.count:void 0}if(typeof I!="number"||!Number.isInteger(I)||I%3!==0||(g+=I/3,g>1e5))return!1;let k=_.indices===void 0?D.map((L,B)=>[B]):d(_.indices,"SCALAR",[5121,5123,5125]);if(!k||k.length%3!==0||k.length!==I)return!1;for(let L=0;L<k.length;L+=3){let B=[k[L][0],k[L+1][0],k[L+2][0]];if(B.some(N=>!Number.isInteger(N)||N<0||N>=D.length))return!1;let F=B.map(N=>Zb(x,...D[N])),V=null;if(!E){let N=F[1][0]-F[0][0],C=F[1][1]-F[0][1],O=F[1][2]-F[0][2],G=F[2][0]-F[0][0],j=F[2][1]-F[0][1],H=F[2][2]-F[0][2];V=ll([1,0,0,0,1,0,0,0,1],C*H-O*j,O*G-N*H,N*j-C*G)}for(let N=0;N<3;N++)p.push(...F[N]),b.push(...E?ll(S,...E[B[N]]):V)}}}for(let A of ze(y.children))if(!w(A,x))return!1;return v.delete(R),!0};for(let R of ze(m[h].nodes))if(!w(R,Kb()))return{ok:!1,issue:g>1e5?"triangle_limit":"unsupported_glb"};return!g||p.length!==g*9||b.length!==p.length?{ok:!1,issue:"unsupported_glb"}:{ok:!0,triangleCount:g,position:new Float32Array(p),normal:new Float32Array(b)}}function ul(e){try{return oy(e)}catch{return{ok:!1,issue:"invalid_glb"}}}function Qt(e){let{doc:t}=e,n=Ca(t.theme),o=n.structure,r=vs(t,e.eventConfigurationId??t.eventConfigurationId),i=al(e.eventConfigurationId,e.eventConfiguration,r),a=e.seats,s=new to,c=null;if(e.registeredShellGlb){let W=ul(e.registeredShellGlb);if(W.ok){let Y=W.position.length/3,K=new Float32Array(W.position.length),ne=n.materials.shell??o.tierWall;for(let ee=0;ee<Y;ee++){let fe=W.normal[ee*3+1],J=fe<-.25?.4:.62+.38*Math.max(0,fe);K[ee*3]=ne[0]*J,K[ee*3+1]=ne[1]*J,K[ee*3+2]=ne[2]*J}c={position:W.position,normal:W.normal,color:K,floor:new Float32Array(Y).fill(-2),material:new Float32Array(Y),count:Y}}}let u=new Map;for(let W of r)for(let Y of W.objects)u.set(Y.id,W.index),Y.type==="section"&&u.set(Y.logicalSectionId??Y.id,W.index);let l=a.map(W=>u.get(W.sectionId??"")??u.get(W.rowId??"")??0),m=oi(r,a),h=s.vertexCount,d=ol(s,r,a,l,m,o,pe(n.background.top,n.background.bottom,.5))?s.vertexCount:h,p=as(t,a),b=new Map,g=new Map;for(let W of t.categories??[])b.set(W.key,W.color),W.seatGlyph&&g.set(W.key,W.seatGlyph);let v=[],w=Ls(r,a,l),R=new Map;a.forEach((W,Y)=>{let K=w.seatDeckY(Y);Number.isFinite(K)&&R.set(W.rowId,Math.min(R.get(W.rowId)??1/0,K))});let M=new Float32Array(a.length),y=[],P=new Map((t.floors??[]).map((W,Y)=>[W.id,Y])),x=r.map(()=>[]);for(let W of a){let Y=W.floorId?P.get(W.floorId)??0:0;x[Math.min(Y,x.length-1)]?.push(W)}let S=(W,Y)=>{if(!Y||Y.length<3)return!1;let K=Math.min(...Y.map(J=>J.x)),ne=Math.max(...Y.map(J=>J.x)),ee=Math.min(...Y.map(J=>J.y)),fe=Math.max(...Y.map(J=>J.y));for(let J=0;J<W;J++)for(let oe of x[J])if(!(oe.x<K||oe.x>ne||oe.y<ee||oe.y>fe)&&Oe(oe,Y,void 0))return!0;return!1},A=null,_=W=>r.length===1?a:a.filter((Y,K)=>l[K]===W),D=(W,Y)=>{let K=Ze(W);if(!K)return!1;let ne=1/0,ee=1/0,fe=-1/0,J=-1/0;for(let oe of K)ne=Math.min(ne,oe.x),fe=Math.max(fe,oe.x),ee=Math.min(ee,oe.y),J=Math.max(J,oe.y);return a.some((oe,De)=>oe.kind!=="booth"&&(r.length===1||l[De]===Y)&&oe.x>ne&&oe.x<fe&&oe.y>ee&&oe.y<J&&He(K,oe.x,oe.y))},E;for(let W=0;W<r.length;W++){let Y=r[W];s.setFloor(W);let K=Wt(Y,_(W)),ne=0;if(K){let te=0;for(let Me of Y.objects)if(Me.type==="section")for(let we of w.bySection.get(Me.id)?.rowLevels??[])te=Math.max(te,we.y-Y.baseHeightM);if(ne=Rs(te),!E){let Me=Es(K);E={centre:[Me.x*T,Me.y*T]}}}let ee=new mo,fe=[],J=Y.objects.filter(te=>te.type==="shape"&&(te.role==="entrance"||te.role==="exit")),oe=Y.objects.filter(te=>te.type==="section"&&!!te.outline&&te.outline.length>=3),De=ic(Y.objects.filter(te=>te.type==="booth"),Y.focal);for(let te of Y.objects)if(te.type==="section"){let Me=s.vertexCount;vc(s,te,Y,ss(te,p),w.bySection.get(te.id),ee,oe,o,W>0&&S(W,te.outline));let we=s.vertexCount-Me;we>0&&y.push({sectionId:te.id,start:Me,count:we})}else if(te.type==="shape"){let Me=i.byObjectId.get(te.id),we=v.length,be=K!==null&&te.role==="wall"&&!Me;s.setMaterial(be?As:(Me?.kind??te.role)==="screen"?1:0);let Qe=te.role==="stage"&&!Me?sc(te,_(W)):be&&te.heightM===void 0?{...te,heightM:ne}:te,je=Ps(Qe,fe);if(tc(s,Qe,Y.baseHeightM+je.supportOffsetM,je.topOffsetM-je.supportOffsetM,o,Y.focal,v,Me,J),s.setMaterial(0),te.role==="stage"&&!Me&&v.length>we&&(A??W)===W){A=W;let Ie=t.floors?.[W]?.id,Ne=r.length>1&&Ie?a.filter(ft=>ft.floorId===Ie):a;cl(s,Qe,v[v.length-1].y,Ne)}}else te.type==="gaArea"?oc(s,te,Y.baseHeightM,he(b.get(te.categoryKey)),o):te.type==="booth"?Qs(s,te,Y.baseHeightM,he(b.get(te.categoryKey)),o,De.get(te.id)??Y.focal,D(te,W)):te.type==="table"?ec(s,te,Math.max(Y.baseHeightM,R.get(te.id)??Y.baseHeightM),he(te.fill??t.theme?.decorFill??"#232c40"),o,!!(te.fill??t.theme?.decorFill)):te.type==="decorImage"&&nc(s,te,Y.baseHeightM,o);Sc(s,Y,a,w,o,n.materials.shell,!c)}let I=r.length>1?{x:r.reduce((W,Y)=>W+Y.focal.x,0)/r.length,y:r.reduce((W,Y)=>W+Y.focal.y,0)/r.length}:t.focalPoint??{x:(m.minX+m.maxX)/2,y:(m.minY+m.maxY)/2},k=wa(c?[s.build(),c]:[s.build()]),L=Ia(a,e.initialState,w,M,b,g),B=Kc({doc:t,units:r,seats:a,surfaces:w,focal:I}),{labels:F,sections:V,rows:N}=$c({doc:t,units:r,seats:a,surfaces:w,seatData:L,hintedSeatFloor:l,zones:B,focal:I}),C=new Map(V.map((W,Y)=>[W.id,Y]));w.seatOwner.forEach((W,Y)=>{L.iSection[Y]=W?C.get(W)??-1:-1});let O=Zc({doc:t,units:r,seats:a,surfaces:w,solids:k,hintedSeatFloor:l,seatFloor:M});qc(F,O),L.iYaw=Xi(L.iPosition,a.length,W=>a[W].rowId,W=>{let Y=r[M[W]]?.focal??I;return[Y.x*T,Y.y*T]});let G=(m.minX+m.maxX)/2*T,j=(m.minY+m.maxY)/2*T,H=.5*Math.hypot((m.maxX-m.minX)*T,(m.maxY-m.minY)*T)||10,z=ri(k,L,{cx:G,cz:j,radius:H},[h,d]),$=ri(k,L,{cx:G,cz:j,radius:H}),Q=ry(r),ae=il(L,v,m,z.minY,z.maxY,H,Q);return{sharedAisles:Aa(r.flatMap(W=>W.objects.flatMap(Y=>{if(Y.type!=="section")return[];let K=w.bySection.get(Y.id);return K?[{sectionId:Y.id,floorIndex:W.index,rows:K.rowLevels}]:[]}))),solids:k,sectionSolidRanges:y,seats:L,seatSectionIds:w.seatOwner,bounds:{center:[(ae.min[0]+ae.max[0])/2,(ae.min[1]+ae.max[1])/2,(ae.min[2]+ae.max[2])/2],radius:H,groundY:0,box:ae,fitPoints:rl(L,v,Q)},...E?{room:E}:{},...!E&&r.some(W=>W.objects.some(Y=>Y.type==="shape"&&oo(Y.stageKind)))?{outdoor:!0}:{},renderBounds:{center:z.center,radius:z.radius},clipBounds:{center:$.center,radius:$.radius},stateColorLUT:_a(n,_e),theme:n,seatCount:a.length,focalWorld:[I.x*T,1.5,I.y*T],zones:B,stages:v,productionElements:i.elements,sections:V,rows:N,labels:F,floors:O}}function ry(e){let t=[];for(let n of e)for(let o of n.objects){let r=o.type==="gaArea"?o.points:o.type==="booth"?Ze(o):null;for(let i of r??[])t.push([i.x*T,n.baseHeightM,i.y*T])}return t}var St=require("ogl"),iy=.05,ay=.6,sy=12,cy=1.6,ly=1,uy=2.5,my=650,ml=24;function fy(e){let t=[],n=[],o=[],r=(m,h,f)=>{t.push(...m),n.push(...h),o.push(f)};for(let m=0;m<16;m++){let h=m/16*Math.PI*2,f=(m+1)/16*Math.PI*2,d=w=>[Math.cos(w),0,Math.sin(w)],p=[Math.cos(h)*.012,0,Math.sin(h)*.012],b=[Math.cos(f)*.012,0,Math.sin(f)*.012],g=[Math.cos(h)*.03,1,Math.sin(h)*.03],v=[Math.cos(f)*.03,1,Math.sin(f)*.03];r(p,d(h),0),r(g,d(h),0),r(v,d(f),0),r(p,d(h),0),r(v,d(f),0),r(b,d(f),0)}let c=.16,u=.24,l=.01;for(let m=0;m<48;m++){let h=m/48*Math.PI*2,f=(m+1)/48*Math.PI*2,d=[Math.cos(h)*c,l,Math.sin(h)*c],p=[Math.cos(h)*u,l,Math.sin(h)*u],b=[Math.cos(f)*u,l,Math.sin(f)*u],g=[Math.cos(f)*c,l,Math.sin(f)*c];for(let v of[d,p,b,d,b,g])r(v,[0,1,0],1)}return new St.Geometry(e,{position:{size:3,data:new Float32Array(t)},normal:{size:3,data:new Float32Array(n)},part:{size:1,data:new Float32Array(o)}})}var dy=`#version 300 es
|
|
20
|
+
}`});async function om(e,t,n,o={}){let i=o.fadeMs??400,r=t?.initialBearingDeg??0,a=Math.max(-lt,Math.min(lt,t?.initialPitchDeg??0)),s=Qo,c=!1,l=new AbortController,u=()=>l.abort();o.signal?.addEventListener("abort",u,{once:!0});let m=()=>{},f=[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 N=n.camera.position,k=n.focalWorld[0]-N.x,B=n.focalWorld[1]-N.y,D=n.focalWorld[2]-N.z,G=Math.hypot(k,D);G>.001&&(r=Math.atan2(k,-D)*180/Math.PI,a=Math.max(-lt,Math.min(lt,Math.atan2(B,G)*180/Math.PI)))}let d=null;if(t){let N=n.gl.getParameter(n.gl.MAX_TEXTURE_SIZE),k=$o(t,Ko(N)),B;try{let D=t.resolveUrl?await t.resolveUrl(k.initialUrl):k.initialUrl;if(!D)throw new Error("panorama_asset_unavailable");B=await qn(D,l.signal)}catch{return o.signal?.removeEventListener("abort",u),null}try{d=em(n.gl,B)}catch{return l.abort(),o.signal?.removeEventListener("abort",u),null}d.mesh.renderOrder=999,d.mesh.setParent(n.scene),k.upgradeUrl&&(m=qo(()=>{(t.resolveUrl?t.resolveUrl(k.upgradeUrl):Promise.resolve(k.upgradeUrl)).then(G=>!G||l.signal.aborted?null:qn(G,l.signal)).then(G=>{G&&(c||l.signal.aborted||(d?.setImage(G),n.requestRender()))}).catch(()=>{})}))}let h=n.camera.fov;n.camera.perspective({fov:s,aspect:n.camera.aspect});let p=n.camera.quaternion.slice(),b=()=>{let N=n.camera.position;d?.mesh.position.set(N.x,N.y,N.z);let[k,B,D]=Ju(r,a);n.camera.lookAt([N.x+k,N.y+B,N.z+D]),n.requestRender()};b();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",o.seatLabel?`View from ${o.seatLabel}`:"View from seat"),y.tabIndex=-1,Object.assign(y.style,{position:"absolute",inset:"0",zIndex:"10",cursor:"grab",touchAction:"none"});let S=document.createElement("button");if(S.type="button",S.setAttribute("aria-label","Close"),S.textContent="\u2715",Object.assign(S.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(S),o.disclosure){let N=document.createElement("div");N.textContent=`${o.disclosurePrefix??"360\xB0 panorama"} \xB7 ${o.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)"}),y.appendChild(N)}let A=document.createElement("div");A.textContent=Ni(o.lookAroundHint),Object.assign(A.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(A),e.appendChild(y),S.focus({preventScroll:!0});let M=!1,g=0,P=0,v=0,w=new Map,R=()=>{let[N,k]=[...w.values()];return N&&k?Math.hypot(N.x-k.x,N.y-k.y):0},_=N=>{let k=Di(N);k!==s&&(s=k,n.camera.perspective({fov:s,aspect:n.camera.aspect}),b())},F=N=>{N.target!==S&&(w.set(N.pointerId,{x:N.clientX,y:N.clientY}),M=w.size===1,g=N.clientX,P=N.clientY,w.size===2&&(v=R()),y.setPointerCapture?.(N.pointerId),y.style.cursor="grabbing")},E=N=>{if(w.has(N.pointerId)){if(w.set(N.pointerId,{x:N.clientX,y:N.clientY}),w.size>=2){let k=R();v>0&&k>0&&_(s*(v/k)),v=k,M=!1;return}M&&(r+=(N.clientX-g)*nm,a=Math.max(-lt,Math.min(lt,a+(N.clientY-P)*nm)),g=N.clientX,P=N.clientY,b())}},I=N=>{w.delete(N.pointerId),v=w.size===2?R():0;let k=w.values().next().value;M=w.size===1,k?(g=k.x,P=k.y):y.style.cursor="grab";try{y.releasePointerCapture?.(N.pointerId)}catch{}},T=N=>{N.preventDefault(),_(s+N.deltaY*.04)};y.addEventListener("pointerdown",F),y.addEventListener("pointermove",E),y.addEventListener("pointerup",I),y.addEventListener("pointercancel",I),y.addEventListener("wheel",T,{passive:!1});let L=N=>{if(!c){if(N.key==="Tab"){N.preventDefault(),S.focus({preventScroll:!0});return}if(N.key==="Escape"){N.stopPropagation(),j.close();return}if(N.key==="ArrowLeft"||N.key==="ArrowRight")r+=N.key==="ArrowLeft"?-4:4;else if(N.key==="ArrowUp"||N.key==="ArrowDown")a=Math.max(-lt,Math.min(lt,a+(N.key==="ArrowUp"?4:-4)));else if(N.key==="+"||N.key==="="){_(s-5),N.preventDefault();return}else if(N.key==="-"){_(s+5),N.preventDefault();return}else return;N.preventDefault(),b()}};window.addEventListener("keydown",L);let V=0,O=(N,k)=>{if(!d){k?.();return}let B=N===1?0:1,D=performance.now(),G=()=>{if(c)return;let U=i<=0?1:Math.min(1,(performance.now()-D)/i);d?.setOpacity(B+(N-B)*U),n.requestRender(),U<1?V=requestAnimationFrame(G):k?.()};V=requestAnimationFrame(G)};O(1);let H=()=>{c||(c=!0,m(),l.abort(),o.signal?.removeEventListener("abort",u),cancelAnimationFrame(V),y.removeEventListener("pointerdown",F),y.removeEventListener("pointermove",E),y.removeEventListener("pointerup",I),y.removeEventListener("pointercancel",I),y.removeEventListener("wheel",T),window.removeEventListener("keydown",L),y.remove(),x?.isConnected&&x.focus({preventScroll:!0}),d?.dispose(),n.camera.position.set(f[0],f[1],f[2]),n.camera.perspective({fov:h,aspect:n.camera.aspect}),n.camera.quaternion.set(p[0],p[1],p[2],p[3]),n.requestRender())},j={close(){if(c)return;let N=()=>{H(),o.onClose?.()};cancelAnimationFrame(V),O(0,N)},dispose:H};return S.addEventListener("click",()=>j.close()),j}var nm,rm=xn(()=>{"use strict";tm();Jo();Jo();Fi();nm=.15});var im={};oa(im,{createOpenPanorama:()=>rx});function rx(e){let{container:t,model:n,opts:o,analytics:i,orbit:r,loop:a,seatsById:s,ensureSeatView:c,resolvedSeatViewPose:l,gpu:u,gl:m,isContextLost:f,isDisposed:d,flightGen:h,setPanorama:p,getLoadAbort:b,setLoadAbort:y,setPanoramaSphereVisible:x,setFrozen:S,raisePanoramaLayer:A,restorePanoramaLayer:M,getOverviewChip:g,labelOverlay:P,reducedMotion:v,removeArriveChip:w,showArriveChip:R}=e;return async(_,F,E)=>{b()?.abort();let I=new AbortController;y(I);let T=n.seats.idToIndex.get(_);if(T===void 0){r.syncFromCamera();return}let L=s.get(_)?.label??_,V=l(_,T),O=c(_);if(!O){I.abort(),b()===I&&y(null),r.syncFromCamera();return}S(!0),a.stop();let H;try{H=await O}catch{if(b()===I&&y(null),i.panoramaFailed(_,"source"),!d()&&E===h()){S(!1),r.resumeAfterFlight(V.focal),a.requestRender();let q=R(_,E,!0);requestAnimationFrame(()=>q?.querySelector("[data-panorama-trigger]")?.focus())}return}if(d()||E!==h()){I.abort(),b()===I&&y(null);return}w();let j=g(),N=()=>{I.abort(),b()===I&&y(null),p(null),x(!1),M(),j.style.display="",P.setVisible(!o.arriveAtSeatEye),S(!1),i.panoramaClosed(),r.resumeAfterFlight(V.focal),a.requestRender();let q=R(_,h());requestAnimationFrame(()=>q?.querySelector("[data-panorama-trigger]")?.focus())},k=H.generated===!0,B=Zu(H);A(),x(!k),j.style.display="none";let D=v()?0:F,G=u(),U=G&&!f()?await om(t,k?null:H,{gl:m,scene:G.main,camera:r.camera,requestRender:()=>a.requestRender(),cameraOriginWorld:k?V.eye:void 0,focalWorld:V.focal},{fadeMs:D,seatLabel:L,disclosure:B,disclosurePrefix:k?"Live 3D view":"360\xB0 panorama",lookAroundHint:o.lookAroundHint,onClose:N,signal:I.signal}):null;if(d()||E!==h()){I.abort(),x(!1),b()===I&&y(null),U?.dispose(),j.style.display="",M();return}if(U)r.syncFromCamera(),P.setVisible(!1),S(!1),a.requestRender(),p(U);else if(k){M(),j.style.display="",S(!1),r.resumeAfterFlight(V.focal),a.requestRender(),p(null),x(!1),i.panoramaFailed(_,"mount");let q=R(_,h(),!0);requestAnimationFrame(()=>q?.querySelector("[data-panorama-trigger]")?.focus()),b()===I&&y(null);return}else x(!1),i.panoramaFallback(_),p(Qu(t,H,{fadeMs:D,seatLabel:L,disclosure:B,onClose:N,signal:I.signal,lookAroundHint:o.lookAroundHint}));i.panoramaOpened()}}var am=xn(()=>{"use strict";Jo();rm()});var Mx={};oa(Mx,{VENUE3D_QUALITY_REPORT_VERSION:()=>ql,autoVenue3d:()=>Bo,buildSceneModel:()=>sn,estimateVenue3D:()=>Zn,inspectVenue3DQualityEvidence:()=>Ho,mountVenue3D:()=>vx,prepareVenue3D:()=>Sm,prepareVenue3DFromChart:()=>wm});module.exports=Vm(Mx);function ia(e,t,n){let o=Math.floor(t.length/3),i=n.center[0],r=n.center[2];if(o>0){let c=Math.max(1,Math.floor(o/4e3)),l=0,u=0,m=0;for(let f=0;f<o;f+=c)l+=t[f*3],u+=t[f*3+2],m++;i=l/m,r=u/m}let a=e[0]-i,s=e[2]-r;return Math.hypot(a,s)>n.radius*.12?Math.atan2(a,s):void 0}var Pm=require("ogl");function aa(e,t,n="#ffffff"){let{iPosition:o,count:i}=t.seats;if(i<2||typeof document>"u")return null;let r=1/0,a=-1/0,s=1/0,c=-1/0;for(let M=0;M<i;M++){let g=o[M*3],P=o[M*3+2];g<r&&(r=g),g>a&&(a=g),P<s&&(s=P),P>c&&(c=P)}for(let M of t.stages)r=Math.min(r,M.cx-M.halfX),a=Math.max(a,M.cx+M.halfX),s=Math.min(s,M.cz-M.halfZ),c=Math.max(c,M.cz+M.halfZ);let l=Math.min(130/Math.max(.001,a-r),86/Math.max(.001,c-s)),u=(148-(a-r)*l)/2,m=(104-(c-s)*l)/2,f=M=>u+(M-r)*l,d=M=>m+(M-s)*l,h=Math.min(2,typeof window<"u"&&window.devicePixelRatio||1),p=document.createElement("canvas");p.width=Math.round(148*h),p.height=Math.round(104*h),p.setAttribute("aria-hidden","true"),p.setAttribute("data-seat-locator","");let b=p.style;b.position="absolute",b.left="12px",b.bottom="12px",b.width="148px",b.height="104px",b.borderRadius="10px",b.background="rgba(10,14,22,.72)",b.border="1px solid rgba(255,255,255,.14)",b.boxShadow="0 4px 14px rgba(0,0,0,.35)",b.pointerEvents="none",b.zIndex="3",b.display="none",e.appendChild(p);let y=document.createElement("canvas");y.width=p.width,y.height=p.height;let x=y.getContext("2d");if(x){x.scale(h,h),x.fillStyle="rgba(214,222,234,.28)";let M=Math.max(1,Math.ceil(i/6e3));for(let g=0;g<i;g+=M)x.fillRect(f(o[g*3])-.6,d(o[g*3+2])-.6,1.2,1.2);x.fillStyle="rgba(236,240,246,.16)",x.strokeStyle="rgba(236,240,246,.55)",x.lineWidth=1;for(let g of t.stages){let P=f(g.cx-g.halfX),v=d(g.cz-g.halfZ),w=g.halfX*2*l,R=g.halfZ*2*l;x.fillRect(P,v,w,R),x.strokeRect(P+.5,v+.5,Math.max(0,w-1),Math.max(0,R-1))}}let S=p.getContext("2d"),A="";return{el:p,update(M,g){if(!M||!S||e.clientWidth>0&&e.clientWidth<560){b.display!=="none"&&(b.display="none"),A="";return}let P=f(M[0]),v=d(M[2]),w=g?Math.atan2(g[2],g[0]):0,R=`${P.toFixed(1)},${v.toFixed(1)},${w.toFixed(2)}`;if(R!==A){if(A=R,b.display="block",S.setTransform(1,0,0,1,0,0),S.clearRect(0,0,p.width,p.height),S.drawImage(y,0,0),S.setTransform(h,0,0,h,0,0),g){let _=S.createRadialGradient(P,v,0,P,v,26);_.addColorStop(0,"rgba(255,255,255,.55)"),_.addColorStop(1,"rgba(255,255,255,0)"),S.fillStyle=_,S.beginPath(),S.moveTo(P,v),S.arc(P,v,26,w-.5,w+.5),S.closePath(),S.fill()}S.fillStyle=n,S.strokeStyle="rgba(10,14,22,.9)",S.lineWidth=1.5,S.beginPath(),S.arc(P,v,3.6,0,Math.PI*2),S.fill(),S.stroke()}},dispose(){p.remove()}}}var Me={pedestal:0,pad:1,back:2,arm:3,footrest:4,leg:5,body:10,head:11},Gm=.44,Hm=.15,sa=.3,zm=.24;function ca(e){return e===void 0||!Number.isFinite(e)||e<=0?zm:Math.min(sa,Math.max(Hm,e*Gm))}var Mn=.21,Um=.05,pr=.45,bt=pr+Um,Sn=.92,vn=.66,br=1.205,la=-.23,ua=.38,jm=[{part:Me.pedestal,min:[-.3,0,-.3],max:[.3,.36,.3]},{part:Me.pad,min:[-1,.36,-.95],max:[1,pr,1]},{part:Me.back,min:[-1,bt,-1],max:[1,Sn,-.72]},{part:Me.arm,min:[-1,.44,-.82],max:[-.78,.65,.78]},{part:Me.arm,min:[.78,.44,-.82],max:[1,.65,.78]},{part:Me.footrest,min:[-.9,.18,.78],max:[.9,.31,1.34]},{part:Me.leg,min:[-.82,0,-.7],max:[-.62,.37,-.48]},{part:Me.leg,min:[.62,0,-.7],max:[.82,.37,-.48]},{part:Me.leg,min:[-.82,0,.48],max:[-.62,.37,.7]},{part:Me.leg,min:[.62,0,.48],max:[.82,.37,.7]}],Wm=[{part:Me.body,min:[-.52,.39,-.08],max:[-.08,.55,.82]},{part:Me.body,min:[.08,.39,-.08],max:[.52,.55,.82]},{part:Me.body,min:[-.47,.05,.58],max:[-.13,.43,.82]},{part:Me.body,min:[.13,.05,.58],max:[.47,.43,.82]},{part:Me.head,min:[-.16,1.04,-.33],max:[.16,1.1,-.13]}],Xm=[{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 ma(){let e=[],t=[],n=[],o=[],i=(k,B,D)=>{let G=n.length,[U,q,$]=k,ee=[q[0]-U[0],q[1]-U[1],q[2]-U[2]],Q=[$[0]-U[0],$[1]-U[1],$[2]-U[2]],X=ee[1]*Q[2]-ee[2]*Q[1],Y=ee[2]*Q[0]-ee[0]*Q[2],K=ee[0]*Q[1]-ee[1]*Q[0],re=Math.hypot(X,Y,K);re>1e-9?(X/=re,Y/=re,K/=re):[X,Y,K]=B,X*B[0]+Y*B[1]+K*B[2]<0&&(X=-X,Y=-Y,K=-K);for(let ne of k)e.push(...ne),t.push(X,Y,K),n.push(D);o.push(G,G+1,G+2,G,G+2,G+3)},r=k=>{for(let B of Xm){let D=B.c.map(G=>G.map((U,q)=>U?k.max[q]:k.min[q]));i(D,B.n,k.part)}},a=(k,B)=>{let[D,G,U]=B?[0,1,2]:[0,2,1],q=k.min[D],$=k.max[D],ee=k.min[G],Q=k.max[G],X=($-q)*.1,Y=(Q-ee)*.1,K=B?[[q+X,ee],[$-X,ee],[$,ee+Y],[$*.94,Q-(Q-ee)*.23],[$*vn,Q],[q*vn,Q],[q*.94,Q-(Q-ee)*.23],[q,ee+Y]]:[[q+X,ee],[$-X,ee],[$,ee+Y],[$,Q-Y],[$-X,Q],[q+X,Q],[q,Q-Y],[q,ee+Y]],re=(se,J,ie)=>{let Pe=[0,0,0];return Pe[D]=se,Pe[G]=J,Pe[U]=ie,Pe},ne=[k.min[U],k.max[U]].map(se=>K.map(([J,ie])=>re(J,ie,se)));for(let se=0;se<K.length;se++){let J=(se+1)%K.length,ie=[0,0,0];ie[D]=(K[se][0]+K[J][0])/2-(q+$)/2,ie[G]=(K[se][1]+K[J][1])/2-(ee+Q)/2,i([ne[0][se],ne[0][J],ne[1][J],ne[1][se]],ie,k.part)}for(let se=0;se<2;se++){let J=[0,0,0];J[U]=se?1:-1;let ie=ne[se];for(let Pe=1;Pe<ie.length-1;Pe++){let te=n.length;for(let xe of[ie[0],ie[Pe],ie[Pe+1]])e.push(...xe),t.push(...J),n.push(k.part);o.push(te,te+1,te+2)}}};for(let k of jm)k.part===Me.pad||k.part===Me.back?a(k,k.part===Me.back):r(k);for(let k of Wm)r(k);let s=pr,c=1.08,l=.47,u=.69,m=-.55,f=.08,d=-.48,h=.01,p=[-l,s,m],b=[l,s,m],y=[-l,s,f],x=[l,s,f],S=[-u,c,d],A=[u,c,d],M=[-u,c,h],g=[u,c,h];i([b,A,g,x],[1,0,0],Me.body),i([y,M,S,p],[-1,0,0],Me.body),i([p,b,x,y],[0,-1,0],Me.body);let P=c+.07,v=.24,w=[-v,P,d],R=[v,P,d],_=[-v,P,h],F=[v,P,h];i([M,_,w,S],[-.5,1,0],Me.body),i([_,F,R,w],[0,1,0],Me.body),i([F,g,A,R],[.5,1,0],Me.body),i([x,g,M,y],[0,0,1],Me.body),i([g,F,_,M],[0,0,1],Me.body),i([p,S,A,b],[0,0,-1],Me.body),i([S,w,R,A],[0,0,-1],Me.body);let E=10,I=8,T=[0,br,la],L=[.32,.115,ua],V=n.length;for(let k=0;k<=I;k++){let B=Math.PI*k/I,D=Math.cos(B),G=Math.sin(B);for(let U=0;U<=E;U++){let q=Math.PI*2*U/E,$=G*Math.cos(q),ee=G*Math.sin(q);e.push(T[0]+L[0]*$,T[1]+L[1]*D,T[2]+L[2]*ee);let Q=$/L[0],X=D/L[1],Y=ee/L[2],K=Math.hypot(Q,X,Y)||1;Q/=K,X/=K,Y/=K,t.push(Q,X,Y),n.push(Me.head)}}for(let k=0;k<I;k++)for(let B=0;B<E;B++){let D=V+k*(E+1)+B,G=D+E+1;o.push(D,G,D+1,D+1,G,G+1)}let O=new Float32Array(e),H=new Float32Array(t),j=new Float32Array(n),N=new Uint16Array(o);return{position:O,normal:H,part:j,index:N,vertexCount:n.length,indexCount:o.length}}function fa(e,t,n,o){let i=new Float32Array(t),r=l=>e[l*3],a=l=>e[l*3+2],s=0,c=(l,u)=>{let m=u-l;for(let f=l;f<u;f++){let[d,h]=o(f),p=d-r(f),b=h-a(f);if(m>=2){let y=Math.max(l,f-1),x=Math.min(u-1,f+1),S=r(x)-r(y),A=a(x)-a(y),M=Math.hypot(S,A);if(M>1e-6){let g=-A/M,P=S/M;g*p+P*b<0&&(g=-g,P=-P),p=g,b=P}}i[f]=p===0&&b===0?0:Math.atan2(p,b)}};for(let l=1;l<=t;l++)(l===t||n(l)!==n(s))&&(c(s,l),s=l);return i}var yr=78,da=18;function ha(){let e=[],t=[],n=[],o=[],i=[],r=[{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]]}];for(let s of[{part:1,min:[-1,.36,-.95],max:[1,.45,1]},{part:2,min:[-1,bt,-1],max:[1,Sn,-.72]}])for(let c of r){let l=e.length/3,u=c.n[1]+(s.part===2?Math.abs(c.n[0])*(1-vn)/(Sn-bt):0),m=Math.hypot(c.n[0],u,c.n[2]),f=[c.n[0]/m,u/m,c.n[2]/m];for(let[d,h]of c.c.entries()){let p=h.map((b,y)=>s.min[y]+b*(s.max[y]-s.min[y]));s.part===2&&(p[0]*=1-h[1]*(1-vn)),e.push(...p),t.push(...f),n.push(s.part),o.push(...[[-1,-1],[1,-1],[1,1],[-1,1]][d])}i.push(l,l+1,l+2,l,l+2,l+3)}let a=e.length/3;for(let[s,c]of[[-1,-1],[1,-1],[1,1],[-1,1]])e.push(s,c,0),t.push(0,1,0),n.push(0),o.push(s,c);return i.push(a,a+1,a+2,a,a+2,a+3),i.push(...i.slice(12,18),...i.slice(60,66),...i.slice(72,78)),{position:new Float32Array(e),normal:new Float32Array(t),surface:new Float32Array(n),uv:new Float32Array(o),index:new Uint16Array(i)}}var va=require("ogl");var Ym=/^#?([\da-f]{3}|[\da-f]{6})$/i;function pa(e){let t=e.replace("#","");return{r:parseInt(t.slice(0,2),16),g:parseInt(t.slice(2,4),16),b:parseInt(t.slice(4,6),16)}}function Km(e){let t=Ym.exec((e??"").trim());if(!t)return null;let n=t[1].length===3?t[1].split("").map(i=>i+i).join(""):t[1],o=parseInt(n,16);return[o>>16&255,o>>8&255,o&255]}function he(e){let t=Km(e);return t?[t[0]/255,t[1]/255,t[2]/255]:null}function gr(e){let t=e/255;return t<=.04045?t/12.92:((t+.055)/1.055)**2.4}function $m(e){return .2126*gr(e[0])+.7152*gr(e[1])+.0722*gr(e[2])}function ba(e){return $m([e[0]*255,e[1]*255,e[2]*255])}function qm(e){return .2126*e[0]+.7152*e[1]+.0722*e[2]}function be(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 qe(e,t){let n=qm(e);return be(e,[n,n,n],t)}function ya({r:e,g:t,b:n}){let o=e/255,i=t/255,r=n/255,a=Math.max(o,i,r),s=Math.min(o,i,r),c=(a+s)/2;if(a===s)return{h:0,s:0,l:c};let l=a-s,u=c>.5?l/(2-a-s):l/(a+s),m;return a===o?m=((i-r)/l+(i<r?6:0))/6:a===i?m=((r-o)/l+2)/6:m=((o-i)/l+4)/6,{h:m,s:u,l:c}}var _e=["available","held","sold","selected","dimmed"];function wn(e){let t=_e.indexOf(e);return t<0?0:t}var ga={available:[.24,.82,.52],held:[.34,.39,.45],sold:[.34,.39,.45],selected:[.24,.74,1],dimmed:[.28,.32,.37]};function xa(e){let t=.2126*e[0]+.7152*e[1]+.0722*e[2],n=.78,o=.86;return[(t+(e[0]-t)*n)*o,(t+(e[1]-t)*n)*o,(t+(e[2]-t)*n)*o]}var xr={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]},Lt={top:[.05,.06,.08],bottom:[.1,.12,.15]};function le(e,t){return[Math.min(1,e[0]*t),Math.min(1,e[1]*t),Math.min(1,e[2]*t)]}function Zm(){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 no=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 va.Renderer({canvas:this.canvas,dpr:Zm(),alpha:!1,antialias:!1,depth:!0,stencil:!1,powerPreference:"high-performance",webgl:2}),this.gl=this.renderer.gl,this.clearRgb=[Lt.top[0],Lt.top[1],Lt.top[2]],this.gl.clearColor(this.clearRgb[0],this.clearRgb[1],this.clearRgb[2],1),t.appendChild(this.canvas),this.lostHandler=o=>{o.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 jt=require("ogl"),Te=Math.PI/180,vr=15*Te,Mr=80*Te,Ut=.12,Ma=35,Sr=1.25,Sa=.006,Qm=4,Wt=.82,Pn=1/Wt,Jm=.12,ef=2;function tf(e,t){return{azimuth:0-e*Sa,polar:-t*Sa}}function wa(e,t,n){let o=Math.max(ef,Math.max(1,t)*Jm),i=n*Qm;return{minDist:e?Math.min(e.minDist,o):o,maxDist:e?Math.max(e.maxDist,i):i}}var nf=1.5;function of(e,t,n){let o=Math.max(1,n)*nf;if(!e)return{anchor:[t[0],t[1],t[2]],limit:o};let[i,r,a]=e.anchor,s=t[1]-r,c=Math.max(Math.abs(t[0]-i),Math.abs(t[2]-a),s>=0?s:-s*2);return{anchor:e.anchor,limit:Math.max(e.limit,c+o)}}function rf(e,t,n,o,i,r,a,s){let c=Math.sin(n),l=[c*Math.sin(t),Math.cos(n),c*Math.cos(t)],u=[e[0]+o*l[0],e[1]+o*l[1],e[2]+o*l[2]],m=[-l[0],-l[1],-l[2]],f=[-m[2],0,m[0]],d=Math.hypot(f[0],f[2])||1;f=[f[0]/d,0,f[2]/d];let h=[f[1]*m[2]-f[2]*m[1],f[2]*m[0]-f[0]*m[2],f[0]*m[1]-f[1]*m[0]],p=Math.tan(i*Te/2),b=p*(r>0?r:1),y=[0,1,2].map(A=>m[A]+a*b*f[A]+s*p*h[A]);if(y[1]>=-1e-6)return null;let x=(e[1]-u[1])/y[1],S=Math.hypot(y[0],y[1],y[2]);return!(x>0)||x*S>o*af?null:[u[0]+y[0]*x,e[1],u[2]+y[2]*x]}var Pa=3,af=4,Aa=.72,sf=.6;function cf(e,t,n){return e!=="auto"?e:n!==null&&t<n*sf?"pan":"orbit"}function Ia(e,t){let n=Math.sin(t),o=-n*Math.sin(e),i=-Math.cos(t),r=-n*Math.cos(e);if(Math.abs(i)>.999)return null;let a=-r,s=o,c=Math.hypot(a,s);return a/=c,s/=c,{fx:o,fy:i,fz:r,rx:a,rz:s,ux:-s*i,uy:s*o-a*r,uz:a*i}}var lf=.4;function uf(e,t,n,o,i,r){let a=[e.center[0],e.center[1],e.center[2]],s=r(a),c=e.fitPoints,l=Ia(o,i);if(!c||c.length<9||!l)return{center:a,distance:s};let{fx:u,fy:m,fz:f,rx:d,rz:h,ux:p,uy:b,uz:y}=l,x=Math.hypot(u,f),S=u/x,A=f/x,M=S*p+A*y,g=lf*Math.max(1,e.radius);for(let P=0;P<3;P++){let v=1/0,w=-1/0,R=1/0,_=-1/0;for(let V=0;V+2<c.length;V+=3){let O=c[V]-a[0],H=c[V+1]-a[1],j=c[V+2]-a[2],N=s+O*u+H*m+j*f;if(!(N>.001))continue;let k=(O*d+j*h)/(N*t),B=(O*p+H*b+j*y)/(N*n);k<v&&(v=k),k>w&&(w=k),B<R&&(R=B),B>_&&(_=B)}if(!Number.isFinite(v))break;let F=(v+w)/2*s*t,E=Math.abs(M)>.1?(R+_)/2*s*n/M:0,I=F*d+E*S,T=F*h+E*A;if(Math.hypot(a[0]+I-e.center[0],a[2]+T-e.center[2])>g){let V=a[0]-e.center[0],O=a[2]-e.center[2],H=V+I,j=O+T,N=g/Math.hypot(H,j);I=H*N-V,T=j*N-O}a=[a[0]+I,a[1],a[2]+T],s=r(a)}return{center:a,distance:s}}var oo=class{constructor(t,n,o,i){this.fovY=Ma;this.target=new jt.Vec3;this.azimuth=-30*Te;this.polar=55*Te;this.distance=10;this.azT=-30*Te;this.polT=55*Te;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 jt.Vec3;this.panAnchor=new jt.Vec3;this.panLimit=0;this.panBox=null;this.zoomPointResolver=null;this.primaryDragMode="auto";this.overviewDist=null;this.pinchAngle=0;this.camera=new jt.Camera(t,{fov:Ma,near:.1,far:5e3,aspect:1}),this.canvas=n,this.requestRender=o,this.onGesture=i,this.onPointerDown=r=>{if(this.interactionEnabled){try{this.canvas.setPointerCapture?.(r.pointerId)}catch{}if(this.activePointers.set(r.pointerId,{x:r.clientX,y:r.clientY}),this.activePointers.size===1){let a=this.dragAction(),s=a==="orbit"?"pan":"orbit",c=r.button===2||r.button===1||r.shiftKey?s:a;this.panning=c==="pan",this.dragging=!this.panning,this.lastX=r.clientX,this.lastY=r.clientY}else if(this.activePointers.size===2){this.dragging=!1,this.panning=!1,this.pinchDist=this.currentPinchDistance(),this.pinchAngle=this.currentPinchAngle();let a=this.pinchCentroid();this.pinchCx=a.x,this.pinchCy=a.y}}},this.onPointerMove=r=>{if(!this.interactionEnabled||!this.activePointers.has(r.pointerId))return;if(this.activePointers.set(r.pointerId,{x:r.clientX,y:r.clientY}),this.activePointers.size>=2){let l=this.currentPinchDistance(),u=this.pinchCentroid();this.pinchDist>0&&(this.dollyAt(Math.exp((this.pinchDist-l)*.005),u.x,u.y),this.fireGesture()),this.pinchDist=l;let m=this.currentPinchAngle(),f=m-this.pinchAngle;f>Math.PI&&(f-=2*Math.PI),f<-Math.PI&&(f+=2*Math.PI),this.pinchAngle=m,Math.abs(f)>1e-4&&Math.abs(f)<.5&&(this.azT+=f,this.fireGesture()),this.panBy(u.x-this.pinchCx,u.y-this.pinchCy),this.pinchCx=u.x,this.pinchCy=u.y;return}let a=r.clientX-this.lastX,s=r.clientY-this.lastY;if(this.panning){this.lastX=r.clientX,this.lastY=r.clientY,(a!==0||s!==0)&&(this.panBy(a,s),this.fireGesture());return}if(!this.dragging)return;this.lastX=r.clientX,this.lastY=r.clientY,(a!==0||s!==0)&&this.fireGesture();let c=tf(a,s);this.azT+=c.azimuth,this.polT=Math.max(vr,Math.min(Mr,this.polT+c.polar)),this.requestRender()},this.onPointerUp=r=>{this.activePointers.delete(r.pointerId);try{this.canvas.releasePointerCapture?.(r.pointerId)}catch{}this.activePointers.size<2&&(this.pinchDist=0),this.activePointers.size===0&&(this.dragging=!1,this.panning=!1)},this.onContextMenu=r=>{r.preventDefault()},this.onWheel=r=>{if(r.preventDefault(),!this.interactionEnabled)return;let a=r.deltaMode===1?16:r.deltaMode===2?100:1,s=Math.max(-2,Math.min(2,r.deltaY*a/100));this.dollyAt(Math.exp(s*.22),r.clientX,r.clientY),this.fireGesture()},this.onKeyDown=r=>{if(!this.interactionEnabled)return;let a=7*Te;if(r.shiftKey&&(r.key==="ArrowLeft"||r.key==="ArrowRight"||r.key==="ArrowUp"||r.key==="ArrowDown"))this.panBy(r.key==="ArrowLeft"?-32:r.key==="ArrowRight"?32:0,r.key==="ArrowUp"?-32:r.key==="ArrowDown"?32:0);else if(r.key==="ArrowLeft"||r.key==="ArrowRight")this.azT+=r.key==="ArrowLeft"?a:-a;else if(r.key==="ArrowUp"||r.key==="ArrowDown")this.polT=Math.max(vr,Math.min(Mr,this.polT+(r.key==="ArrowUp"?-a:a)));else if(r.key==="+"||r.key==="=")this.dollyBy(Wt);else if(r.key==="-"||r.key==="_")this.dollyBy(Pn);else return;r.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,o=0;for(let i of t)n+=i.x,o+=i.y;return{x:n/t.length,y:o/t.length}}panBy(t,n){let o=this.canvas.clientHeight||1,i=2*this.distance*Math.tan(this.fovY*Te/2)/o,r=Math.sin(this.azimuth),a=Math.cos(this.azimuth),s=a,c=-r,l=Math.cos(this.polar),u=Math.sin(this.polar),m=-r*l,f=-a*l;this.targetT.x+=(-t*s+n*m)*i,this.targetT.z+=(-t*c+n*f)*i,this.targetT.y+=n*u*i,this.clampPan(),this.requestRender()}widenPanBox(t){this.panBox=of(this.panBox,t.center,t.radius),this.panAnchor.set(this.panBox.anchor[0],this.panBox.anchor[1],this.panBox.anchor[2]),this.panLimit=this.panBox.limit}clampPan(){if(this.panLimit<=0)return;let t=this.panLimit,n=this.panAnchor.x,o=this.panAnchor.y,i=this.panAnchor.z;this.targetT.x=Math.max(n-t,Math.min(n+t,this.targetT.x)),this.targetT.z=Math.max(i-t,Math.min(i+t,this.targetT.z)),this.targetT.y=Math.max(o-t*.5,Math.min(o+t,this.targetT.y))}fireGesture(){this.gestureFired||(this.gestureFired=!0,this.onGesture?.())}currentPinchAngle(){let[t,n]=[...this.activePointers.values()];return t&&n?Math.atan2(n.y-t.y,n.x-t.x):0}dragAction(){return cf(this.primaryDragMode,this.distT,this.overviewDist)}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()}dollyAt(t,n,o){let i=this.distT,r=this.canvas.getBoundingClientRect?.(),a=this.zoomPointResolver?.(n,o)??null;if(a){this.distT=Math.max(Pa,Math.min(this.maxDist,this.distT*t)),this.minDist=Math.min(this.minDist,Math.max(Pa,this.distT)),this.requestRender(),this.scaleTargetAbout(a,this.distT/i);return}let s=r&&r.width>0&&r.height>0?rf([this.targetT.x,this.targetT.y,this.targetT.z],this.azT,this.polT,this.distT,this.fovY,this.camera.aspect||r.width/r.height,(n-r.left)/r.width*2-1,1-(o-r.top)/r.height*2):null;this.dollyBy(t),s&&this.scaleTargetAbout(s,this.distT/i)}scaleTargetAbout(t,n){!Number.isFinite(n)||n===1||(this.targetT.x=t[0]+(this.targetT.x-t[0])*n,this.targetT.y=t[1]+(this.targetT.y-t[1])*n,this.targetT.z=t[2]+(this.targetT.z-t[2])*n,this.clampPan())}setZoomPointResolver(t){this.zoomPointResolver=t}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,o,i=!1,r){this.camera.perspective({fov:this.fovY,aspect:this.camera.aspect}),this.target.set(t.center[0],t.center[1],t.center[2]),this.targetT.copy(this.target),this.widenPanBox(t);let a=Math.max(1,t.radius),s=this.fovY*Te/2,c=i?Math.max(.82,this.camera.aspect||1):this.camera.aspect||1,l=Math.atan(Math.tan(s)*c);this.azT=o??-30*Te,this.polT=Math.max(15,Math.min(80,r?.polarDeg??55))*Te;let u=this.framedOn(t,s,l),m=u.distance;this.target.set(u.center[0],u.center[1],u.center[2]),this.targetT.copy(this.target),this.distT=m*Math.max(1.05,Math.min(2,r?.margin??Sr)),this.envelope=wa(this.envelope,a,m),this.minDist=this.envelope.minDist,this.maxDist=this.envelope.maxDist,this.overviewDist===null&&(this.overviewDist=this.distT),n?(this.azimuth=this.azT,this.polar=12*Te,this.distance=this.distT*1.7):(this.azimuth=this.azT,this.polar=this.polT,this.distance=this.distT),this.applyPosition()}setAspect(t){if(!(t>0)||!Number.isFinite(t))return;let n=this.camera.aspect;if(this.interactionEnabled&&n>0){let o=Math.min(n,1)/Math.min(t,1);this.distance*=o,this.distT*=o,this.overviewDist!==null&&(this.overviewDist*=o),this.maxDist=Math.max(this.maxDist,this.distance,this.distT),this.applyPosition()}this.camera.perspective({aspect:t})}glideTo(t,n){this.syncFromCamera(),this.camera.perspective({fov:this.fovY,aspect:this.camera.aspect}),this.widenPanBox(t),this.targetT.set(t.center[0],t.center[1],t.center[2]);let o=this.fovY*Te/2,i=Math.atan(Math.tan(o)*(this.camera.aspect||1));this.azT=this.azimuth,this.polT=Math.max(15,Math.min(80,n?.polarDeg??55))*Te;let r=this.framedOn(t,o,i),a=r.distance;this.targetT.set(r.center[0],r.center[1],r.center[2]),this.distT=a*Math.max(1.05,Math.min(2,n?.margin??Sr)),this.envelope=wa(this.envelope,Math.max(1,t.radius),a),this.minDist=this.envelope.minDist,this.maxDist=this.envelope.maxDist,this.requestRender()}frameSoft(t,n,o=!1,i){this.target.set(t.center[0],t.center[1],t.center[2]),this.targetT.copy(this.target),this.widenPanBox(t),this.syncFromCamera(),this.camera.perspective({fov:this.fovY,aspect:this.camera.aspect});let r=this.fovY*Te/2,a=o?Math.max(.82,this.camera.aspect||1):this.camera.aspect||1,s=Math.atan(Math.tan(r)*a);this.azT=n??this.azimuth,this.polT=Math.max(15,Math.min(80,i?.polarDeg??55))*Te;let c=this.framedOn(t,r,s);this.targetT.set(c.center[0],c.center[1],c.center[2]),this.distT=c.distance*Math.max(1.05,Math.min(2,i?.margin??Sr))}framedOn(t,n,o){return uf(t,Math.tan(o),Math.tan(n),this.azT,this.polT,i=>this.fitDistance({...t,center:i},n,o,this.azT,this.polT))}fitDistance(t,n,o,i,r){let a=Math.max(1,t.radius),s=Math.max(a/Math.tan(n),a/Math.tan(o)),c=t.box;if(!c)return s;let l=Ia(i,r);if(!l)return s;let{fx:u,fy:m,fz:f,rx:d,rz:h,ux:p,uy:b,uz:y}=l,x=Math.tan(o),S=Math.tan(n),A=1;for(let R=0;R<8;R++){let _=(R&1?c.max[0]:c.min[0])-t.center[0],F=(R&2?c.max[1]:c.min[1])-t.center[1],E=(R&4?c.max[2]:c.min[2])-t.center[2],I=_*u+F*m+E*f,T=Math.abs(_*d+E*h),L=Math.abs(_*p+F*b+E*y);A=Math.max(A,T/x-I,L/S-I)}let M=Math.min(s,Math.max(A,a*.35)),g=t.fitPoints;if(!g||g.length<9)return M;let P=0,v=1/(x*Aa),w=1/(S*Aa);for(let R=0;R+2<g.length;R+=3){let _=g[R]-t.center[0],F=g[R+1]-t.center[1],E=g[R+2]-t.center[2],I=_*u+F*m+E*f,T=Math.abs(_*d+E*h),L=Math.abs(_*p+F*b+E*y);P=Math.max(P,T*v-I,L*w-I)}return Math.min(M*1.5,Math.max(M*.55,P))}updateClipping(t){let n=this.camera.position.x-t.center[0],o=this.camera.position.y-t.center[1],i=this.camera.position.z-t.center[2],r=Math.hypot(this.camera.position.x-this.target.x,this.camera.position.y-this.target.y,this.camera.position.z-this.target.z),a=this.interactionEnabled&&Math.abs(r-this.distance)<=this.distance*.01,{near:s,far:c}=df(Math.hypot(n,o,i),t.radius,a?this.distance:null);this.camera.perspective({near:s,far:c,aspect:this.camera.aspect})}update(){let t=this.azT-this.azimuth,n=this.polT-this.polar,o=this.distT-this.distance,i=this.targetT.x-this.target.x,r=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(o)>1e-4||Math.abs(i)>s||Math.abs(r)>s||Math.abs(a)>s;return this.azimuth+=t*Ut,this.polar+=n*Ut,this.distance+=o*Ut,this.target.x+=i*Ut,this.target.y+=r*Ut,this.target.z+=a*Ut,c&&this.applyPosition(),c}get currentAzimuth(){return this.azimuth}get currentDistance(){return this.distance}get targetDistance(){return this.distT}syncFromCamera(){let t=this.camera.position.x-this.target.x,n=this.camera.position.y-this.target.y,o=this.camera.position.z-this.target.z,i=Math.hypot(t,n,o)||1,r=Math.max(vr,Math.min(Mr,Math.acos(Math.max(-1,Math.min(1,n/i)))));this.distance=this.distT=i,this.polar=this.polT=r,this.azimuth=this.azT=Math.atan2(t,o)}snapshot(){let t=this.target.clone(),n=this.targetT.clone(),{azimuth:o,azT:i,polar:r,polT:a,distance:s,distT:c}=this,l=this.camera.position.clone(),u=[...this.camera.quaternion],m=this.camera.fov;return()=>{this.target.copy(t),this.targetT.copy(n),Object.assign(this,{azimuth:o,azT:i,polar:r,polT:a,distance:s,distT:c}),this.camera.position.copy(l),this.camera.quaternion.set(u[0],u[1],u[2],u[3]),this.camera.perspective({fov:m,aspect:this.camera.aspect}),this.camera.updateMatrixWorld()}}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),o=this.target.y+this.distance*Math.cos(this.polar),i=this.target.z+this.distance*t*Math.cos(this.azimuth);this.camera.position.set(n,o,i),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()}},mf=.1,ff=.25;function df(e,t,n){let o=Math.max(1,t)*1.18,i=n==null?ff:Math.max(.05,n*mf),r=Math.max(i,e-o),a=Math.max(r+10,e+o);return{near:r,far:a}}var ro=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 i=1/n;this.fpsEma=this.fpsEma?this.fpsEma*.9+i*.1:i}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 Ra(e){let t=!1;return n=>{n!==t&&(t=n,n?e.dataset.slReady="1":delete e.dataset.slReady)}}function Ea(e,t,n){return Math.max(t,Math.min(n,e))}var Xt=2.5,hf=1.15,An=12,Yt=22,Ca=6,_a=9.5,Ta=.9,ka=2.2,wr=30,Pr=4,io=8192;var Bx=Yt+Pr;function La(e,t){let n=t*1.4,o=t*3.2;if(e<=n)return{scale:1,fade:0,minPixels:Xt};let i=Math.min(1,(e-n)/Math.max(.001,o-n));return{scale:1-i*.4,fade:i*.55,minPixels:Xt+i*(hf-Xt)}}function Oa(e,t,n){return!(e>0)||!(t>0)||!(n>0)?!1:t*n/e>=64}var pf=12;function Fa(e,t,n,o,i){if(!(e>0)||!(t>0)||!(n>0)||!(o>0)||!(i>0))return!1;let r=Math.tan(o/2*Math.PI/180);if(!(r>0))return!1;let a=t/(n*r)*(i/2);return Math.PI*a*a/e>=pf}var Ar=[{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"}],Gx=new Map(Ar.map(e=>[e.key,e]));var bf={wheelchair:"#3b82f6",companion:"#8b5cf6","semi-ambulatory":"#0ea5e9","designated-aisle":"#0284c7","step-free":"#16a34a",hearing:"#14b8a6",cart:"#7c3aed","sign-language":"#f59e0b","low-vision":"#d97706","sensory-friendly":"#6366f1","plus-size":"#ec4899","lift-armrest":"#22c55e"};function ao(e){let t=e?.[0];return t&&bf[t]||"#3b82f6"}var yf=[{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"}],Hx=new Map(yf.map(e=>[e.key,e]));var gf=["reference-focal","bar","entrance","exit","restroom","screen","sound","concession","coat","wall","rail","suite","obstruction"],zx=new Set(gf);var Na=[{key:"circle",label:"Standard seat",shortLabel:"Standard",useCase:"General assigned seating",group:"general",path:null,bounds:null,mark: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},mark:{x:12,y:10,radius:6}},{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},mark:{x:12,y:10,radius:4.5}},{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},mark:{x:12,y:5,radius:3}},{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},mark:{x:12,y:7.5,radius:5.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},mark:{x:12,y:8,radius: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},mark:{x:12,y:9.25,radius:6.5}},{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},mark:{x:12,y:12.25,radius:4.75}}],Ba=Na.map(e=>e.key),xf=new Map(Na.map(e=>[e.key,e]));function Da(e){return typeof e=="string"&&xf.has(e)}function Va(e,t){return Da(e)?e:Da(t?.seatGlyph)?t.seatGlyph:"circle"}var fe=.02291666666666667,je=1/fe,vf=58,Mf=vf*fe;var Sf=3,Ga=0,Ir=120,wf=0,Pf=45,Af=7,ot=1.2;function Rr(e,t,n,o){return Number.isFinite(e)?Math.max(t,Math.min(n,e)):o}function If(e){return!Number.isFinite(e)||!Number.isInteger(e)||e<0?0:e<=Af?e:Sf}function yt(e,t={}){let n=Rr(t.floorBaseHeightM,Ga,Ir,0),o=Math.min(Ir,n+If(e.elevation)*Mf),i=e.height===void 0?o:Rr(e.height,Ga,Ir,o),r=Rr(e.rake,wf,Pf,0);return{height:i,rake:r}}var za=nt(require("earcut"),1),Cr=nt(require("polygon-clipping"),1);var Kx=Math.PI/180;function Er(e){let t=0,n=0;for(let i of e)t+=i.x,n+=i.y;let o=e.length||1;return{x:t/o,y:n/o}}function Kt(e){return e.length?Er(e):null}function Ve(e){let t=0;for(let n=0,o=e.length;n<o;n+=1){let i=e[n],r=e[(n+1)%o];t+=i.x*r.y-r.x*i.y}return t/2}function Ge(e,t,n){let o=!1;for(let i=0,r=e.length-1;i<e.length;r=i++){let a=e[i],s=e[r];a.y>n!=s.y>n&&t<(s.x-a.x)*(n-a.y)/(s.y-a.y)+a.x&&(o=!o)}return o}var C=fe,Rf=.002;function Ef(e,t,n){let o=Math.hypot(t[0]-e[0],t[1]-e[1],t[2]-e[2]),i=Math.hypot(n[0]-t[0],n[1]-t[1],n[2]-t[2]),r=Math.hypot(e[0]-n[0],e[1]-n[1],e[2]-n[2]),a=Math.max(o,i,r);if(a<1e-9)return!0;let s=(o+i+r)/2;return 2*Math.sqrt(Math.max(0,s*(s-o)*(s-i)*(s-r)))/a<Rf}var Ot=class{constructor(t=16384){this.len=0;this.buf=new Float32Array(t)}push3(t,n,o){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++]=o}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 o=new Float32Array(n);o.set(this.buf.subarray(0,this.len)),this.buf=o}get length(){return this.len}toArray(){return this.buf.slice(0,this.len)}},lo=class{constructor(){this.pos=new Ot;this.nor=new Ot;this.col=new Ot;this.flr=new Ot;this.mat=new Ot;this.currentFloor=0;this.currentMaterial=0}setFloor(t){this.currentFloor=t}setMaterial(t){this.currentMaterial=t}tri(t,n,o,i,r,a=r,s=r){Ef(t,n,o)||(this.pos.push3(t[0],t[1],t[2]),this.pos.push3(n[0],n[1],n[2]),this.pos.push3(o[0],o[1],o[2]),this.nor.push3(i[0],i[1],i[2]),this.nor.push3(i[0],i[1],i[2]),this.nor.push3(i[0],i[1],i[2]),this.col.push3(r[0],r[1],r[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,o,i,r,a,s,c=s,l=s){[...t,...n,...o].every(Number.isFinite)&&(this.pos.push3(t[0],t[1],t[2]),this.pos.push3(n[0],n[1],n[2]),this.pos.push3(o[0],o[1],o[2]),this.nor.push3(i[0],i[1],i[2]),this.nor.push3(r[0],r[1],r[2]),this.nor.push3(a[0],a[1],a[2]),this.col.push3(s[0],s[1],s[2]),this.col.push3(c[0],c[1],c[2]),this.col.push3(l[0],l[1],l[2]),this.flr.push1(this.currentFloor),this.flr.push1(this.currentFloor),this.flr.push1(this.currentFloor),this.mat.push1(this.currentMaterial),this.mat.push1(this.currentMaterial),this.mat.push1(this.currentMaterial))}get vertexCount(){return this.pos.length/3}build(){return{position:this.pos.toArray(),normal:this.nor.toArray(),color:this.col.toArray(),floor:this.flr.toArray(),material:this.mat.toArray(),count:this.pos.length/3}}};function Cf(e,t,n){let o=t[0]-e[0],i=t[1]-e[1],r=t[2]-e[2],a=n[0]-e[0],s=n[1]-e[1],c=n[2]-e[2],l=i*c-r*s,u=r*a-o*c,m=o*s-i*a,f=Math.hypot(l,u,m)||1;return l/=f,u/=f,m/=f,[l,u,m]}function _f(e,t){let n=[...e],o=[];for(let a of e)o.push(a.x,a.y);let i=[];if(t){for(let a of t)if(!(a.length<3)){i.push(n.length);for(let s of a)n.push(s),o.push(s.x,s.y)}}let r=(0,za.default)(o,i.length?i:void 0,2);return{pts:n,tris:r}}function rt(e){return Ve(e)<0?[...e].reverse():e}var Tf=3;function kf(e,t,n,o){let i=o(e),r=o(t),a=o(n),s=(d,h,p,b)=>Math.abs(o({x:(d.x+h.x)/2,y:(d.y+h.y)/2})-(p+b)/2),c=(e.x+t.x+n.x)/3,l=(e.y+t.y+n.y)/3,u=(i+r+a)/3,m=Math.max(s(e,t,i,r),s(t,n,r,a),s(n,e,a,i),Math.abs(o({x:c,y:l})-u)),f=(d,h,p)=>{let b=Math.abs(o({x:(d+c)/2,y:(h+l)/2})-(p+u)/2);b>m&&(m=b)};return f((e.x+t.x)/2,(e.y+t.y)/2,(i+r)/2),f((t.x+n.x)/2,(t.y+n.y)/2,(r+a)/2),f((n.x+e.x)/2,(n.y+e.y)/2,(a+i)/2),m}function In(e,t,n,o,i){if(i<=0)return kf(e,t,n,o);let r={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(In(e,r,s,o,i-1),In(r,t,a,o,i-1),In(s,a,n,o,i-1),In(r,a,s,o,i-1))}function Rn(e,t,n,o,i,r,a,s){if(a>0){let f={x:(t.x+n.x)/2,y:(t.y+n.y)/2},d={x:(n.x+o.x)/2,y:(n.y+o.y)/2},h={x:(o.x+t.x)/2,y:(o.y+t.y)/2};Rn(e,t,f,h,i,r,a-1,s),Rn(e,f,n,d,i,r,a-1,s),Rn(e,h,d,o,i,r,a-1,s),Rn(e,f,d,h,i,r,a-1,s);return}let c=[t.x*C,i(t),t.y*C],l=[n.x*C,i(n),n.y*C],u=[o.x*C,i(o),o.y*C];if(s){e.triN(c,l,u,s(t),s(n),s(o),r);return}let m=Cf(c,l,u);m[1]<0&&(m=[-m[0],-m[1],-m[2]]),e.tri(c,l,u,m,r)}var Lf=8;function Ha(e,t,n){if(!Number.isFinite(n))return e;let o=[],i=(r,a,s,c,l)=>{if(l>0){let u={x:(r.x+a.x)/2,y:(r.y+a.y)/2},m=t(u);if(Math.abs(m-(s+c)/2)>n){i(r,u,s,m,l-1),i(u,a,m,c,l-1);return}}o.push(r)};for(let r=0;r<e.length;r++){let a=e[r],s=e[(r+1)%e.length];i(a,s,t(a),t(s),Lf)}return o}function so(e,t){if(e.length<3)return e;let n=[];for(let i of e){let r=n[n.length-1];r&&Math.hypot(i.x-r.x,i.y-r.y)<t||n.push(i)}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 o=[];for(let i=0;i<n.length;i++){let r=o.length?o[o.length-1]:n[(i-1+n.length)%n.length],a=n[i],s=n[(i+1)%n.length],c=s.x-r.x,l=s.y-r.y,u=Math.hypot(c,l);u>t&&Math.abs((a.x-r.x)*l-(a.y-r.y)*c)/u<t||o.push(a)}return o.length>=3?o:n}var co=.001*je*.1;function ue(e,t,n,o,i,r,a,s,c=1/0,l){if(!t||t.length<3||(c===void 0&&(c=1/0),Math.abs(Ve(t))<1e-4))return;let u=so(Ha(so(rt(t),co),o,c),co),m=n?.map(g=>so(Ha(so(rt(g),co),o,c),co)).filter(g=>g.length>=3&&Math.abs(Ve(g))>=1e-4),{pts:f,tris:d}=_f(u,m),h=[r[0]*s.top,r[1]*s.top,r[2]*s.top],p=[r[0]*s.bottomCap,r[1]*s.bottomCap,r[2]*s.bottomCap],b=[a[0]*s.top,a[1]*s.top,a[2]*s.top],y=[a[0]*s.wallBottom,a[1]*s.wallBottom,a[2]*s.wallBottom],x=0;if(Number.isFinite(c))for(;x<Tf;x++){let g=0;for(let P=0;P<d.length;P+=3){let v=In(f[d[P]],f[d[P+1]],f[d[P+2]],o,x);v>g&&(g=v)}if(g<=c)break}for(let g=0;g<d.length;g+=3){let P=f[d[g]],v=f[d[g+1]],w=f[d[g+2]];Rn(e,P,v,w,o,h,x,l);let R=[P.x*C,i,P.y*C],_=[v.x*C,i,v.y*C],F=[w.x*C,i,w.y*C];e.tri(R,F,_,[0,-1,0],p)}let S=g=>{if(x<=0)return g;let P=1<<x,v=[];for(let w=0;w<g.length;w++){let R=g[w],_=g[(w+1)%g.length];for(let F=0;F<P;F++){let E=F/P;v.push({x:R.x+(_.x-R.x)*E,y:R.y+(_.y-R.y)*E})}}return v},A=Er(u),M=[{ring:S(u),flip:!1}];if(m)for(let g of m)g.length>=3&&M.push({ring:S(g),flip:!0});for(let{ring:g,flip:P}of M)for(let v=0;v<g.length;v++){let w=g[v],R=g[(v+1)%g.length],_=(R.x-w.x)*C,E=(R.y-w.y)*C,I=-_,T=Math.hypot(E,I)||1;E/=T,I/=T;let L=(w.x+R.x)/2-A.x,V=(w.y+R.y)/2-A.y,O=E*L+I*V;P&&(O=-O),O<0&&(E=-E,I=-I);let H=[E,0,I],j=[w.x*C,o(w),w.y*C],N=[R.x*C,o(R),R.y*C],k=[w.x*C,i,w.y*C],B=[R.x*C,i,R.y*C];e.tri(j,N,B,H,b,b,y),e.tri(j,B,k,H,b,y,y)}}function Ua(e){let t=0;for(let c of e)t+=c.count;let n=new Float32Array(t*3),o=new Float32Array(t*3),i=new Float32Array(t*3),r=new Float32Array(t),a=new Float32Array(t),s=0;for(let c of e)n.set(c.position,s*3),o.set(c.normal,s*3),i.set(c.color,s*3),r.set(c.floor,s),a.set(c.material,s),s+=c.count;return{position:n,normal:o,color:i,floor:r,material:a,count:t}}function Ze(e,t,n=2.5){if(t<=0||e.length<3)return e;let o=rt(e),i=o.length,r=[];for(let s=0;s<i;s++){let c=o[s],l=o[(s+1)%i],u=l.x-c.x,m=l.y-c.y,f=Math.hypot(u,m)||1;r.push({x:m/f,y:-u/f})}let a=[];for(let s=0;s<i;s++){let c=o[s],l=r[(s-1+i)%i],u=r[s],m=l.x+u.x,f=l.y+u.y,d=Math.hypot(m,f),h=()=>{a.push([c.x+l.x*t,c.y+l.y*t]),a.push([c.x+u.x*t,c.y+u.y*t])};if(d<1e-9){h();continue}m/=d,f/=d;let p=m*l.x+f*l.y,b=1/Math.max(p,1e-6);if(!Number.isFinite(b)||b>n){h();continue}a.push([c.x+m*t*b,c.y+f*t*b])}if(a.length<3)return e;try{let s=Cr.default.union([[...a,a[0]]]),c=null,l=-1/0;for(let m of s){let f=Math.abs(Ve(m[0].map(([d,h])=>({x:d,y:h}))));f>l&&(l=f,c=m[0])}if(!c)return e;let u=c.map(([m,f])=>({x:m,y:f}));if(u.length>1){let m=u[0],f=u[u.length-1];Math.abs(m.x-f.x)<1e-9&&Math.abs(m.y-f.y)<1e-9&&u.pop()}return u.length>=3?u:e}catch{return e}}function gt(e,t,n=2.5){if(e.length<3)return[];if(t<=0)return e;let o=rt(e),i=o.length,r=[];for(let c=0;c<i;c++){let l=o[c],u=o[(c+1)%i],m=Math.hypot(u.x-l.x,u.y-l.y)||1;r.push({x:-(u.y-l.y)/m,y:(u.x-l.x)/m})}let a=[],s=[];for(let c=0;c<i;c++){let l=o[c],u=r[(c-1+i)%i],m=r[c],f=u.x+m.x,d=u.y+m.y,h=Math.hypot(f,d),p=h<1e-9?1/0:1/Math.max(f/h*u.x+d/h*u.y,1e-6);if(!Number.isFinite(p)||p>n){a.push({x:l.x+u.x*t,y:l.y+u.y*t},{x:l.x+m.x*t,y:l.y+m.y*t}),s.push(c,c);continue}f/=h,d/=h,a.push({x:l.x+f*t*p,y:l.y+d*t*p}),s.push(c)}for(let c=0;c<a.length;c++){let l=(c+1)%a.length,u=s[c],m=s[l];if(m!==(u+1)%i)continue;let f=o[u],d=o[m];if((a[l].x-a[c].x)*(d.x-f.x)+(a[l].y-a[c].y)*(d.y-f.y)<=0)return[]}try{let c=Cr.default.intersection([[...a.map(h=>[h.x,h.y]),[a[0].x,a[0].y]]],[[...o.map(h=>[h.x,h.y]),[o[0].x,o[0].y]]]),l=null,u=0;for(let h of c){let p=Math.abs(Ve(h[0].map(([b,y])=>({x:b,y}))));p>u&&(u=p,l=h[0])}if(!l)return[];let m=l.map(([h,p])=>({x:h,y:p})),f=m[0],d=m[m.length-1];return m.length>1&&Math.abs(f.x-d.x)<1e-9&&Math.abs(f.y-d.y)<1e-9&&m.pop(),m.length>=3?rt(m):[]}catch{return[]}}function uo(e,t,n,o,i=28){let r=[];for(let a=0;a<i;a++){let s=a/i*Math.PI*2;r.push({x:e+n*Math.cos(s),y:t+o*Math.sin(s)})}return r}function En(e,t,n,o){return[{x:e,y:t},{x:e+n,y:t},{x:e+n,y:t+o},{x:e,y:t+o}]}var ut=.22;function ja(e,t){let n=_e[e];if(n!=="sold"&&n!=="held")return-1;let o=(t+1)*2654435761;return o^=o>>>15,o=Math.imul(o,2246822519),o^=o>>>13,(o>>>0)%1e5/1e5}var Of=.42;function Ff(e){let t=e.length,n=new Float64Array(t);if(t<2)return n.fill(1/0),n;let o=1/0,i=1/0,r=-1/0,a=-1/0;for(let h of e)h.x<o&&(o=h.x),h.y<i&&(i=h.y),h.x>r&&(r=h.x),h.y>a&&(a=h.y);let s=Math.max(r-o,1e-6),c=Math.max(a-i,1e-6),l=Math.max(Math.sqrt(s*c/t),1e-6),u=Math.max(1,Math.ceil(s/l)+1),m=Math.max(1,Math.ceil(c/l)+1),f=new Map,d=(h,p)=>{let b=Math.min(u-1,Math.max(0,Math.floor((h-o)/l)));return Math.min(m-1,Math.max(0,Math.floor((p-i)/l)))*u+b};for(let h=0;h<t;h++){let p=d(e[h].x,e[h].y),b=f.get(p);b?b.push(h):f.set(p,[h])}for(let h=0;h<t;h++){let p=e[h],b=Math.min(u-1,Math.max(0,Math.floor((p.x-o)/l))),y=Math.min(m-1,Math.max(0,Math.floor((p.y-i)/l))),x=1/0;for(let S=1;S<=4;S++){for(let A=y-S;A<=y+S;A++)if(!(A<0||A>=m))for(let M=b-S;M<=b+S;M++){if(M<0||M>=u||S>1&&Math.abs(A-y)<S&&Math.abs(M-b)<S)continue;let g=f.get(A*u+M);if(g)for(let P of g){if(P===h)continue;let v=Math.hypot(e[P].x-p.x,e[P].y-p.y);v<x&&(x=v)}}if(Number.isFinite(x)&&x<=S*l)break}n[h]=x}return n}function Df(e){let t=e.eyeHeightM;return Number.isFinite(t)?Math.max(0,t-ot):0}function Wa(e,t,n,o,i,r){let a=e.length,s=new Float32Array(a*3),c=new Float32Array(a),l=new Float32Array(a*3),u=new Float32Array(a),m=new Float32Array(a),f=new Float32Array(a),d=new Float32Array(a),h=new Float32Array(a*3),p=new Map,b=Ff(e);for(let y=0;y<a;y++){let x=e[y],A=(n?.seatPitchU(y)??b[y])*C;u[y]=Number.isFinite(A)?Math.max(.06,Math.min(ut,A*Of)):ut,m[y]=ca(Number.isFinite(A)?A:void 0);let M=Va(x.glyph,{seatGlyph:r?.get(x.categoryKey)});f[y]=Ba.indexOf(M),d[y]=x.wheelchairSpaceType==="no-seat"?0:1,s[y*3]=x.x*C,s[y*3+1]=n?n.seatDeckY(y):Df(x),s[y*3+2]=x.y*C,c[y]=wn(t?t(x):"available");let g=he(i?.get(x.categoryKey)??"#6e7bff")??[.43,.48,1];if(l[y*3]=g[0],l[y*3+1]=g[1],l[y*3+2]=g[2],x.accessibility?.length){let P=he(ao(x.accessibility));P&&(h[y*3]=P[0],h[y*3+1]=P[1],h[y*3+2]=P[2])}p.set(x.id,y)}return{count:a,iPosition:s,iState:c,iCategory:l,iMaxRadius:u,iRing:h,idToIndex:p,iChairWidth:m,iGlyph:f,iPhysicalSeat:d,iFloor:o??new Float32Array(a),iSection:new Float32Array(a).fill(-1),iYaw:new Float32Array(a)}}var Nf=64;function _r(e,t){let n=[];for(let a of t){let s=e.idToIndex.get(a.seatId);if(s===void 0)continue;let c=wn(a.state);e.iState[s]!==c&&(e.iState[s]=c,n.push(s))}if(!n.length)return[];n.sort((a,s)=>a-s);let o=[],i=n[0],r=n[0];for(let a=1;a<n.length;a++){let s=n[a];if(s!==r){if(s<=r+Nf){r=s;continue}o.push({start:i,length:r-i+1}),i=s,r=s}}return o.push({start:i,length:r-i+1}),o}var Cn=3,Ft=.38,_n=.24;function Bf(e){if(e.length<3)return null;let t=e[0],n=e[Math.floor(e.length/2)],o=e[e.length-1],i=(n.x-t.x)*C,r=(n.y-t.y)*C,a=(o.x-t.x)*C,s=(o.y-t.y)*C,c=2*(i*s-r*a);if(Math.abs(c)<1e-7)return null;let l=i*i+r*r,u=a*a+s*s,m=(l*s-u*r)/c+t.x*C,f=(i*u-a*l)/c+t.y*C,d=Math.hypot(t.x*C-m,t.y*C-f);return d<1||d>200||!Number.isFinite(d)||e.some(h=>Math.abs(Math.hypot(h.x*C-m,h.y*C-f)-d)>.03)?null:{x:m,z:f,radius:d}}function Xa(e){let t=[],n=new Map,o=(c,l)=>`${Math.floor(c/Cn)},${Math.floor(l/Cn)}`;for(let c of e)for(let l of c.rows){for(let m of l.pts){let f=m.x*C,d=m.y*C,h=o(f,d),p=n.get(h)??[];p.push({x:f,z:d,y:l.y,floor:c.floorIndex}),n.set(h,p)}if(l.patch||l.pts.length<2)continue;let u=Bf(l.pts);for(let m of[0,l.pts.length-1]){let f=l.pts[m],d=l.pts[m===0?1:m-1],h=f.x-d.x,p=f.y-d.y,b=Math.hypot(h,p);b<1e-6||t.push({sectionId:c.sectionId,floorIndex:c.floorIndex,curve:u,row:l,point:f,x:f.x*C,z:f.y*C,dx:h/b,dz:p/b})}}let i=new Map;t.forEach((c,l)=>{let u=o(c.x,c.z),m=i.get(u)??[];m.push(l),i.set(u,m)});let r=(c,l)=>{let u=Math.floor(c/Cn),m=Math.floor(l/Cn);return[-1,0,1].flatMap(f=>[-1,0,1].map(d=>`${u+f},${m+d}`))},a=new Map;t.forEach((c,l)=>{let u=-1,m=1/0,f=!1;for(let d of r(c.x,c.z))for(let h of i.get(d)??[]){let p=t[h];if(c.sectionId===p.sectionId&&c.row.blockId===p.row.blockId||c.floorIndex!==p.floorIndex||Math.abs(c.row.y-p.row.y)>.05)continue;let b=p.x-c.x,y=p.z-c.z,x=Math.hypot(b,y);if(x<Ft*2+.45||x>Cn)continue;let S=c.curve&&p.curve&&Math.hypot(c.curve.x-p.curve.x,c.curve.z-p.curve.z)<=.05&&Math.abs(c.curve.radius-p.curve.radius)<=.05,A=Math.min((b*c.dx+y*c.dz)/x,(-b*p.dx-y*p.dz)/x);(S?A<.8:A<.98)||!S&&(Math.abs(b*c.dz-y*c.dx)>.15||Math.abs(b*p.dz-y*p.dx)>.15)||(x<m-.02?(u=h,m=x,f=!1):Math.abs(x-m)<=.02&&(f=!0))}u>=0&&!f&&a.set(l,u)});let s=[];for(let[c,l]of a){if(c>=l||a.get(l)!==c)continue;let u=t[c],m=t[l],f=Math.hypot(m.x-u.x,m.z-u.z),d=(m.x-u.x)/f,h=(m.z-u.z)/f,p=!1;for(let y of r((u.x+m.x)/2,(u.z+m.z)/2))for(let x of n.get(y)??[]){if(x.floor!==u.floorIndex||Math.abs(x.y-u.row.y)>.75)continue;let S=(x.x-u.x)*d+(x.z-u.z)*h,A=Math.abs((x.x-u.x)*h-(x.z-u.z)*d);S>.01&&S<f-.01&&A<_n+Ft&&(p=!0)}if(p)continue;let b=(y,x)=>({x:(u.x+d*y-h*x)/C,y:(u.z+h*y+d*x)/C});s.push({sections:[u.sectionId,m.sectionId],blocks:[u.row.blockId,m.row.blockId],floorIndex:u.floorIndex,ends:[u.point,m.point],clearWidthM:f-2*Ft,heightM:(u.row.y+m.row.y)/2,outline:[b(Ft,-_n),b(f-Ft,-_n),b(f-Ft,_n),b(Ft,_n)]})}return s}var Vf=.15,Gf=1.6;function Ya(e){return Ea(e??1,Vf,Gf)}var Hf=.15,zf=.9,Uf=1.76;function Ka(e){return!!e&&e[0]*.2126+e[1]*.7152+e[2]*.0722>.55?{zenith:[.36,.58,.84],horizon:[.82,.88,.94]}:{zenith:[.05,.08,.15],horizon:[.3,.38,.5]}}function jf(){return{background:{top:[...Lt.top],bottom:[...Lt.bottom]},sky:Ka(null),structure:xr,seatStates:{...ga},seatScale:1,materials:{seat:null,shell:null,roughness:.78}}}function Wf(e){return!!e&&e[0]*.2126+e[1]*.7152+e[2]*.0722>.55?{deck:"#c9ccc8",fascia:"#b4bab8",shell:"#c3c9c8",roughness:.87}:{deck:"#69747b",fascia:"#3e4d58",shell:"#526572",roughness:.87}}function $a(e){let t=jf();e??={};let n=he(e.background);if(n){t.background={top:le(n,zf),bottom:le(n,Uf)},t.sky=Ka(n);let s={};for(let[l,u]of Object.entries(xr))s[l]=be(u,n,Hf);n[0]*.2126+n[1]*.7152+n[2]*.0722>.55&&(s.ground=le(n,.86)),t.structure=s}let o=he(e.selectionColor)??he(e.accent);o&&(t.seatStates={...t.seatStates,selected:o});let i=e.seatScale;typeof i=="number"&&Number.isFinite(i)&&(t.seatScale=Ya(i));let r=Object.fromEntries(Object.entries(e.venue3d??{}).filter(([,s])=>s!=null)),a={...Wf(n),...r};if(a){let s=he(a.deck),c=he(a.fascia);s&&(t.structure={...t.structure,tierTop:s,gaTop:s}),c&&(t.structure={...t.structure,tierWall:c,gaWall:c}),t.materials.seat=he(a.seat),t.materials.shell=he(a.shell),typeof a.roughness=="number"&&Number.isFinite(a.roughness)&&(t.materials.roughness=Math.min(1,Math.max(0,a.roughness)))}return t}function qa(e,t){let n=[];for(let o of t)n.push(...e.seatStates[o]);return n}var Xf=new Set(["pitch-football","rink-hockey","track-athletics","oval-cricket","pitch-rugby","diamond-baseball","court-basketball","court-tennis","ring-boxing"]),Yf=new Set(["pitch-football","track-athletics","oval-cricket","pitch-rugby","diamond-baseball"]);function Dt(e){return!!e&&Xf.has(e)}function mo(e){return!!e&&Yf.has(e)}var fo=1.1,Kf={"pitch-football":{width:105,height:68},"rink-hockey":{width:60,height:30},"track-athletics":{width:176.9,height:92.5},"oval-cricket":{width:150,height:140},"pitch-rugby":{width:120,height:70},"diamond-baseball":{width:140,height:140},"court-basketball":{width:32,height:19},"court-tennis":{width:36.57,height:18.29},"ring-boxing":{width:7.8,height:7.8}},$f={"pitch-football":"#2f7d4f","rink-hockey":"#e8f1f8","track-athletics":"#a4472f","oval-cricket":"#3d8a53","pitch-rugby":"#2f7d4f","diamond-baseball":"#2f7d4f","court-basketball":"#c8894f","court-tennis":"#3f7a5a","ring-boxing":"#2a4d8f"};var qf=Math.PI*2;function Zf(e,t,n,o,i,r){return{x:i+e*n-t*o,y:r+e*o+t*n}}function Za(e,t){let n=Math.max(0,e-t),o=[],i=20;for(let r=0;r<=i;r++){let a=-Math.PI/2+r/i*Math.PI;o.push({x:n+t*Math.cos(a),y:t*Math.sin(a)})}for(let r=0;r<=i;r++){let a=Math.PI/2+r/i*Math.PI;o.push({x:-n+t*Math.cos(a),y:t*Math.sin(a)})}return o}var Qa=(()=>{let t={x:0,y:52},n=25,o={x:70,y:t.y-70},i=(o.x*o.x+o.y*o.y-4900)/(2*(o.y+70)),r=i+70,a=[],s=Math.atan2(o.y-i,o.x),c=Math.atan2(o.y-i,-o.x);for(let l=0;l<=24;l++){let u=s+(c-s)*l/24;a.push({x:r*Math.cos(u),y:i+r*Math.sin(u)})}return{half:70,home:t,backstop:n,fence:a}})();var ho="#f1f5f9";function Tn(e){return Dt(e)}function xt(e,t,n,o,i=32){let r=[];for(let a=0;a<i;a++){let s=a/i*qf;r.push({x:e+n*Math.cos(s),y:t+o*Math.sin(s)})}return r}function mt(e,t,n,o){return[{x:e-n,y:t-o},{x:e+n,y:t-o},{x:e+n,y:t+o},{x:e-n,y:t+o}]}function Qf(e){let{kind:t,cx:n,cy:o,width:i,height:r}=e,a=(e.rotation??0)*Math.PI/180,s=Math.cos(a),c=Math.sin(a),l=i/2,u=r/2,m=[],f=Kf[t],d=p=>f?p/f.width*i:0,h=p=>f?p/f.height*r:0;switch(t){case"pitch-football":{m.push({points:[{x:0,y:-u},{x:0,y:u}],closed:!1}),m.push({points:xt(0,0,d(9.15),h(9.15)),closed:!0});for(let p of[-1,1])m.push({points:mt(p*(l-d(16.5)/2),0,d(16.5)/2,h(40.32)/2),closed:!0}),m.push({points:mt(p*(l-d(5.5)/2),0,d(5.5)/2,h(18.32)/2),closed:!0});break}case"rink-hockey":{m.push({points:[{x:0,y:-u},{x:0,y:u}],closed:!1,ink:"#d63b3b"});for(let p of[-1,1]){m.push({points:[{x:p*d(7.5),y:-u},{x:p*d(7.5),y:u}],closed:!1,ink:"#2f6ecb"}),m.push({points:[{x:p*(l-d(4)),y:-h(11)},{x:p*(l-d(4)),y:h(11)}],closed:!1,ink:"#d63b3b"});for(let b of[-1,1])m.push({points:xt(p*d(20.5),b*h(7),d(4.5),h(4.5)),closed:!0,ink:"#2f6ecb"})}m.push({points:xt(0,0,d(4.5),h(4.5)),closed:!0,ink:"#2f6ecb"});break}case"track-athletics":{let b=u-h(1.22)*8;b>0&&m.push({points:Za(l-d(1.22)*8,b),closed:!0,fill:"#2f7d4f"});for(let y=1;y<8;y++){let x=h(1.22)*y,S=u-x;if(S<=0)break;m.push({points:Za(l-d(1.22)*y,S),closed:!0})}break}case"oval-cricket":{m.push({points:xt(0,0,d(27.4),h(27.4+20.12/2),40),closed:!0}),m.push({points:mt(0,0,d(3.05)/2,h(20.12)/2),closed:!0,ink:"#d8cfae"});break}case"pitch-rugby":{let p=b=>({points:[{x:d(b),y:-u},{x:d(b),y:u}],closed:!1});m.push(p(0));for(let b of[-1,1]){m.push(p(b*50),p(b*28));for(let y=-35;y<35;y+=4)m.push({points:[{x:d(b*10),y:h(y)},{x:d(b*10),y:h(Math.min(35,y+2))}],closed:!1})}break}case"diamond-baseball":{let p=(L,V)=>({x:d(L),y:h(V)}),{home:b}=Qa,y=27.43,x=y/Math.SQRT2,S={x:b.x+x,y:b.y-x},A={x:b.x,y:b.y-2*x},M={x:b.x-x,y:b.y-x},g={x:b.x,y:b.y-18.44},P="#b98a59",v=$f["diamond-baseball"],w=38.94,R=[p(b.x,b.y)],_=Math.atan2(b.y-w/Math.SQRT2-g.y,w/Math.SQRT2),F=Math.PI-_;for(let L=0;L<=16;L++){let V=_-(_+Math.PI*2-F)%(Math.PI*2)*(L/16);R.push(p(g.x+29*Math.cos(V),g.y+29*Math.sin(V)))}m.push({points:R,closed:!0,fill:P,ink:P});let E={x:b.x,y:b.y-x},I=[{x:b.x,y:b.y},S,A,M].map(L=>p(E.x+(L.x-E.x)*.84,E.y+(L.y-E.y)*.84));m.push({points:I,closed:!0,fill:v,ink:v}),m.push({points:xt(d(g.x),h(g.y),d(2.74),h(2.74),20),closed:!0,fill:P,ink:P}),m.push({points:xt(d(b.x),h(b.y),d(3.96),h(3.96),20),closed:!0,fill:P,ink:P});let T=Qa.fence;m.push({points:[p(b.x,b.y),p(T[0].x,T[0].y)],closed:!1}),m.push({points:[p(b.x,b.y),p(T[T.length-1].x,T[T.length-1].y)],closed:!1});for(let L of[S,A,M])m.push({points:mt(d(L.x),h(L.y),d(.3),h(.3)),closed:!0,fill:ho});break}case"court-basketball":{m.push({points:mt(0,0,d(14),h(7.5)),closed:!0}),m.push({points:[{x:0,y:-h(7.5)},{x:0,y:h(7.5)}],closed:!1}),m.push({points:xt(0,0,d(1.8),h(1.8),24),closed:!0});for(let p of[-1,1]){let b=p*14,y=p*(14-5.8),x=p*(14-1.575);m.push({points:mt(d((b+y)/2),0,d(2.9),h(2.45)),closed:!0,fill:"#2f5d8a"}),m.push({points:xt(d(y),0,d(1.8),h(1.8),24),closed:!0});let S=Math.sqrt(6.75*6.75-6.6*6.6),A=[{x:d(b),y:-h(6.6)}],M=Math.atan2(-6.6,-p*S),g=2*Math.atan2(6.6,S);for(let P=0;P<=16;P++){let v=M-p*g*(P/16);A.push({x:d(x+6.75*Math.cos(v)),y:h(6.75*Math.sin(v))})}A.push({x:d(b),y:h(6.6)}),m.push({points:A,closed:!1})}break}case"court-tennis":{m.push({points:mt(0,0,d(11.885),h(5.485)),closed:!0,fill:"#2b5f99"});for(let p of[-1,1])m.push({points:[{x:-d(11.885),y:p*h(4.115)},{x:d(11.885),y:p*h(4.115)}],closed:!1}),m.push({points:[{x:p*d(6.4),y:-h(4.115)},{x:p*d(6.4),y:h(4.115)}],closed:!1});m.push({points:[{x:-d(6.4),y:0},{x:d(6.4),y:0}],closed:!1}),m.push({points:[{x:0,y:-h(6.4)},{x:0,y:h(6.4)}],closed:!1,ink:"#d1d5db"});break}case"ring-boxing":{m.push({points:mt(0,0,d(3.05),h(3.05)),closed:!0});let y=[[-1,-1,"#c53030"],[1,1,"#2b6cb0"],[1,-1,"#e2e8f0"],[-1,1,"#e2e8f0"]];for(let[x,S,A]of y)m.push({points:mt(x*d(3.05),S*h(3.05),d(.3),h(.3)),closed:!0,fill:A,ink:A});break}default:return[]}return m.map(p=>({...p,points:p.points.map(b=>Zf(b.x,b.y,s,c,n,o))}))}function Ja(e){if(e.role!=="stage"||!Tn(e.stageKind))return[];let t=null;if(e.x!=null&&e.y!=null&&e.width!=null&&e.height!=null&&e.width>0&&e.height>0&&[e.x,e.y,e.width,e.height].every(Number.isFinite))t={cx:e.x+e.width/2,cy:e.y+e.height/2,width:e.width,height:e.height};else if(e.points&&e.points.length>=3&&e.points.every(n=>Number.isFinite(n.x)&&Number.isFinite(n.y))){let n=e.points.map(u=>u.x),o=e.points.map(u=>u.y),i=Math.min(...n),r=Math.max(...n),a=Math.min(...o),s=Math.max(...o),c=Math.max(1,r-i),l=Math.max(1,s-a);t={cx:i+c/2,cy:a+l/2,width:c,height:l}}return t?Qf({kind:e.stageKind,...t}):[]}function es(e,t){let n=1-t,o=n*n*n,i=3*n*n*t,r=3*n*t*t,a=t*t*t;return{x:o*e.start.x+i*e.control1.x+r*e.control2.x+a*e.end.x,y:o*e.start.y+i*e.control1.y+r*e.control2.y+a*e.end.y}}function ts(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[es(e,.5)];let o=Array.from({length:n+1},(c,l)=>es(e,l/n)),i=new Float64Array(o.length);for(let c=1;c<o.length;c+=1){let l=o[c].x-o[c-1].x,u=o[c].y-o[c-1].y;i[c]=i[c-1]+Math.hypot(l,u)}let r=i[i.length-1];if(r<=1e-9)return Array.from({length:t},()=>({...e.start}));let a=[],s=1;for(let c=0;c<t;c+=1){let l=r*c/(t-1);for(;s<i.length-1&&i[s]<l;)s+=1;let u=i[s-1],m=i[s],f=m===u?0:(l-u)/(m-u);a.push({x:o[s-1].x+(o[s].x-o[s-1].x)*f,y:o[s-1].y+(o[s].y-o[s-1].y)*f})}return a}function ns(e){let t=new Map,n=new Map;for(let o of e){if(o.type!=="row"||!o.segmentedRow)continue;let i=n.get(o.segmentedRow.groupId)??[];i.push(o),n.set(o.segmentedRow.groupId,i)}for(let[o,i]of n){let r=i.slice().sort((f,d)=>f.segmentedRow.componentIndex-d.segmentedRow.componentIndex),a=r[0]?.segmentedRow?.componentCount??0,s=r[0]?.segmentedRow;if(!s||!(a>=2&&r.length===a&&s?.boundaryBefore==="start"&&r.every((f,d)=>f.segmentedRow?.kind==="segmented-row-v1"&&f.segmentedRow.groupId===o&&f.segmentedRow.componentCount===a&&f.segmentedRow.componentIndex===d&&f.segmentedRow.repeatLabelOnComponents===s.repeatLabelOnComponents&&(d===0?f.segmentedRow.boundaryBefore==="start":f.segmentedRow.boundaryBefore!=="start")&&f.segmentedRow.displayLabel===s.displayLabel)))continue;let l=r.reduce((f,d)=>f+d.seatCount,0),u=0,m=0;for(let f of r)f.segmentedRow.boundaryBefore==="break"&&(u+=1),t.set(f.id,{groupId:o,adjacencyOffset:u,displayOffset:m,displayLabel:s.displayLabel,totalSeats:l,canonical:r[0],viewFromSeatUrl:s.viewFromSeatUrl,viewFromSeatMeta:s.viewFromSeatMeta,confidenceEvidence:s.confidenceEvidence}),u+=f.seatCount,m+=f.seatCount}return t}var Jf="ABCDEFGHIJKLMNOPQRSTUVWXYZ";var ed="abcdefghijklmnopqrstuvwxyz";function td(e,t){let n=t.length,o=e+1,i="";for(;o>0;){o-=1;let r=o%n;i=t[r]+i,o=Math.floor(o/n)}return i}function kn(e,t=!1){let n=t?ed:Jf;return td(Math.max(0,Math.floor(e)-1),n)}var nd=[[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 os(e){if(!Number.isFinite(e)||e<=0)return String(e);let t=Math.floor(e),n="";for(let[o,i]of nd)for(;t>=o;)n+=i,t-=o;return n}function od(e){let t=new Array(e);return Array.from({length:e},(n,o)=>o).sort((n,o)=>Math.abs(2*n-(e-1))-Math.abs(2*o-(e-1))||n-o).forEach((n,o)=>t[n]=o),t}function po(e,t){let n=e.seatLabelStart??1,o=e.seatNumbering?.direction??"ltr",i=e.seatNumbering?.step??1,r=e.seatNumbering?.scheme??"decimal",a=e.seatNumbering?.prefix??"",s=e.seatNumbering?.endAt,c=e.seatCount;if(r==="updown"||r==="updown-descending"){let d=Math.ceil(c/2),h=r==="updown"?t<d?n+2*t:n-1+2*(c-t):t<d?n+2*(d-1-t):n+1+2*(t-d);return`${a}${h}`}let l=r==="odd"||r==="even"?2:i,u=s!=null&&Number.isFinite(s)?s-(c-1)*l:n,m=o==="center"?od(c)[t]:o==="rtl"?c-1-t:t,f;switch(r){case"odd":{let d=u%2===1?u:u+1;f=String(d+m*2);break}case"even":{let d=u%2===0?u:u+1;f=String(d+m*2);break}case"roman":f=os(u+m*i);break;case"letters-upper":f=kn(u+m*i,!1);break;case"letters-lower":f=kn(u+m*i,!0);break;default:f=String(u+m*i);break}return`${a}${f}`}function rd(e){return{...e.canonical,seatCount:e.totalSeats,label:e.displayLabel,displayLabel:e.displayLabel}}function rs(e,t,n){return n?.label??`${e.seatLabelBase??e.label}-${po(e,t)}`}function Tr(e,t,n,o){if(o?.displayLabel)return o.displayLabel;if(e.seatDisplayLabelMode==="number")return po(e,t);if(!n)return`${e.displayLabel||e.label}-${po(e,t)}`;let i=rd(n),r=n.displayOffset+t;return`${n.displayLabel}-${po(i,r)}`}function is(e,t){return`${e.label}-${t+1}`}function id(e,t,n){return e?.direction==="anticlockwise"?Math.max(0,t-1-n):n}function ad(e,t){let n=e.chairNumbering,o=n?.start??1,i=id(n,Math.max(0,Math.round(e.seatCount)),t);return n?.format==="letter"?kn(Math.max(1,o)+i):String(o+i)}function as(e,t){let n=ad(e,t);return(e.chairNumbering?.format??"table-number")==="table-number"?`${e.displayLabel??e.label}-${n}`:n}function ss(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 $t(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 o=1/0;for(let i=0;i+1<e.length;i++){let r=e[i],a=e[i+1],s=a.x-r.x,c=a.y-r.y,l=s*s+c*c,u=l>1e-12?((t-r.x)*s+(n-r.y)*c)/l:0;u<0?u=0:u>1&&(u=1);let m=t-(r.x+u*s),f=n-(r.y+u*c);if(Math.abs(m)>=o||Math.abs(f)>=o)continue;let d=Math.hypot(m,f);d<o&&(o=d)}return o}function sd(e){let t=0,n=0;for(let r of e)t+=r.x,n+=r.y;let o=e.length||1;t/=o,n/=o;let i=0;for(let r of e){let a=Math.hypot(r.x-t,r.y-n);a>i&&(i=a)}return{cx:t,cy:n,r:i}}function cs(e,t){return Math.hypot(e.cx-t.cx,e.cy-t.cy)-e.r-t.r}function kr(e,t){let n=1/0;for(let o of ss(e)){let i=$t(t,o.x,o.y);i<n&&(n=i)}for(let o of ss(t)){let i=$t(e,o.x,o.y);i<n&&(n=i)}return n}function cd(e,t){if(e.length<3)return{pts:e,seatIndices:t};let n=0,o=0;for(let u of e)n+=u.x,o+=u.y;n/=e.length,o/=e.length;let i=-1,r=e[0];for(let u of e){let m=Math.hypot(u.x-n,u.y-o);m>i&&(i=m,r=u)}let a=r.x-n,s=r.y-o,c=Math.hypot(a,s);c>1e-9?(a/=c,s/=c):(a=1,s=0);let l=e.map((u,m)=>({p:u,i:m,t:(u.x-n)*a+(u.y-o)*s})).sort((u,m)=>u.t-m.t);return{pts:l.map(u=>u.p),seatIndices:l.map(u=>t[u.i])}}function Lr(e){let t=e.length;if(t<3)return null;let n=0,o=0;for(let x of e)n+=x.x,o+=x.y;n/=t,o/=t;let i=0,r=0,a=0,s=0,c=0,l=0,u=0;for(let x of e){let S=x.x-n,A=x.y-o;i+=S*S,a+=A*A,r+=S*A,s+=S*S*S,c+=A*A*A,l+=S*A*A,u+=A*S*S}let m=i*a-r*r;if(Math.abs(m)<1e-9)return null;let f=(s+l)/2,d=(c+u)/2,h=(f*a-d*r)/m,p=(d*i-f*r)/m,b=h+n,y=p+o;return!Number.isFinite(b)||!Number.isFinite(y)?null:{cx:b,cy:y}}var ld=.15;function ud(e){if(e.length<2)return null;let t=e.map(M=>{let g=0,P=0;for(let v of M.pts)g+=v.x,P+=v.y;return{x:g/M.pts.length,y:P/M.pts.length}}),n=0,o=0;for(let M of t)n+=M.x,o+=M.y;n/=t.length,o/=t.length;let i=0,r=0,a=0;for(let M of t){let g=M.x-n,P=M.y-o;i+=g*g,r+=g*P,a+=P*P}let s=i+a,c=i*a-r*r,l=s/2+Math.sqrt(Math.max(0,s*s/4-c)),u,m;Math.abs(r)>1e-12?(u=l-a,m=r):i>=a?(u=1,m=0):(u=0,m=1);let f=Math.hypot(u,m);if(!(f>1e-12))return null;u/=f,m/=f;let d=0,h=0,p=0;for(let M of e){if(M.pts.length<2)continue;let g=M.pts[0],P=M.pts[M.pts.length-1],v=P.x-g.x,w=P.y-g.y,R=Math.hypot(v,w);if(!(R>1e-9))continue;let _=v/R,F=w/R;d+=(_*_-F*F)*R,h+=2*_*F*R,p+=R}if(p>0&&Math.hypot(d,h)>=fd*p){let M=Math.atan2(h,d)/2,g=Math.cos(M),P=Math.sin(M);Math.abs(u*g+m*P)>dd&&(u=-P,m=g)}let b=1/0,y=-1/0,x=[];for(let M of e){let g=1/0,P=-1/0;for(let v of M.pts){let w=v.x*u+v.y*m;w<g&&(g=w),w>P&&(P=w),w<b&&(b=w),w>y&&(y=w)}x.push(P-g)}let S=y-b;return S>1e-9?(x.sort((M,g)=>M-g),x[Math.min(x.length-1,Math.floor(x.length*.9))]/S<=md?{x:u,y:m}:null):null}var md=.35,fd=.8,dd=.7;function bo(e,t,n,o){let i=new Map;for(let g of n){let P=t[g],v=P.rowId||`__seat-${g}`,w=i.get(v);w||(w={pts:[],idx:[]},i.set(v,w)),w.pts.push({x:P.x,y:P.y}),w.idx.push(g)}if(!i.size)return{sectionId:e,rows:[],blockCount:0};let r=[];for(let[g,P]of i){let v=cd(P.pts,P.idx),w=0;for(let R of v.pts)w+=Math.hypot(R.x-o.x,R.y-o.y);r.push({id:g,pts:v.pts,seatIndices:v.seatIndices,blockId:-1,ordinal:0,blockDepth:0,focalDistance:w/v.pts.length})}let a=r.map(g=>sd(g.pts)),s=r.length<=256?r.length*(r.length-1)/2:0,c=s?new Float64Array(s):null;c?.fill(Number.NaN);let l=c?new Map(r.map((g,P)=>[g,P])):null,u=(g,P)=>(g>P&&([g,P]=[P,g]),g*(2*r.length-g-1)/2+(P-g-1)),m=(g,P)=>{if(!c)return kr(r[g].pts,r[P].pts);let v=u(g,P),w=c[v];if(!Number.isNaN(w))return w;let R=kr(r[g].pts,r[P].pts);return c[v]=R,R},f=(g,P)=>l?m(l.get(g),l.get(P)):kr(g.pts,P.pts),d=[];for(let g=0;g<r.length;g++){let P=1/0;for(let v=0;v<r.length;v++){if(g===v||cs(a[g],a[v])>=P)continue;let w=m(g,v);w<P&&(P=w)}Number.isFinite(P)&&d.push(P)}d.sort((g,P)=>g-P);let h=d.length?d[Math.floor(d.length/2)]:1,p=Math.max(h*1.8,1e-6),b=r.map(()=>[]);for(let g=0;g<r.length;g++)for(let P=g+1;P<r.length;P++)cs(a[g],a[P])>p||m(g,P)<=p&&(b[g].push(P),b[P].push(g));let y=0;for(let g=0;g<r.length;g++){if(r[g].blockId!==-1)continue;let P=y++,v=[g];for(r[g].blockId=P;v.length;){let w=v.pop();for(let R of b[w])r[R].blockId===-1&&(r[R].blockId=P,v.push(R))}}let x=new Map;for(let g of r){let P=x.get(g.blockId)??[];P.push(g),x.set(g.blockId,P)}let S=[];for(let g of r){if(g.pts.length<4)continue;let P=Lr(g.pts);P&&(!Number.isFinite(P.cx)||!Number.isFinite(P.cy)||S.push({x:P.cx,y:P.cy}))}let A=S.length>=2?(()=>{let g=S.map(w=>w.x).sort((w,R)=>w-R),P=S.map(w=>w.y).sort((w,R)=>w-R),v=Math.floor(S.length/2);return{cx:g[v],cy:P[v]}})():null;if(A){let g=F=>Math.hypot(F.x-A.cx,F.y-A.cy),P=1/0,v=-1/0,w=[];for(let F of r){let E=1/0,I=-1/0;for(let T of F.pts){let L=g(T);L<E&&(E=L),L>I&&(I=L)}w.push(I-E),E<P&&(P=E),I>v&&(v=I)}let R=v-P;w.sort((F,E)=>F-E);let _=w[Math.min(w.length-1,Math.floor(w.length*.9))];if(R>1e-9&&_/R<=ld){let F=r.map(k=>{let B=0;for(let D of k.pts)B+=g(D);return{row:k,radius:B/k.pts.length}}),E=0,I=0;for(let k of F)E+=k.radius,I+=k.row.focalDistance;E/=F.length,I/=F.length;let T=0;for(let k of F)T+=(k.radius-E)*(k.row.focalDistance-I);if(T<0)for(let k of F)k.radius=-k.radius;let V=1/0;for(let k of F)k.radius<V&&(V=k.radius);F.sort((k,B)=>k.radius-B.radius);let O=-1,H=-1/0,j=R/Math.max(1,F.length)*.5,N=[];for(let k of F)k.radius-H>j&&(O++,H=k.radius),k.row.ordinal=O,k.row.blockDepth=k.radius-V,N.push(k.row);return{sectionId:e,rows:N,blockCount:y}}}let M=[];for(let[,g]of x){let P=ud(g);if(P){let v=F=>{let E=0;for(let I of F.pts)E+=I.x*P.x+I.y*P.y;return E/F.pts.length};g.sort((F,E)=>v(F)-v(E)),g.length>=2&&g[0].focalDistance>g[g.length-1].focalDistance&&g.reverse();let w=[],R=h*.5;for(let F of g){let E=w[w.length-1];E&&Math.abs(v(F)-v(E[0]))<R?E.push(F):w.push([F])}let _=0;for(let F=0;F<w.length;F++){if(F>0){let E=1/0;for(let I of w[F-1])for(let T of w[F])E=Math.min(E,f(I,T));_+=E}for(let E of w[F])E.ordinal=F,E.blockDepth=_,M.push(E)}}else{let v=1/0;for(let w of g)w.focalDistance<v&&(v=w.focalDistance);g.sort((w,R)=>w.focalDistance-R.focalDistance);for(let w=0;w<g.length;w++)g[w].ordinal=w,g[w].blockDepth=Math.max(0,g[w].focalDistance-v),M.push(g[w])}}return{sectionId:e,rows:M,blockCount:y}}var hd=/^\d{4}-\d{2}-\d{2}$/;function pd(e){let t=Date.parse(e);return Number.isFinite(t)?hd.test(e)?t+864e5:t:null}function bd(e,t=Date.now()){if(e.validUntil===void 0){if(e.status!=="approved")return!0;let o=e.assessedAt?Date.parse(e.assessedAt):Number.NaN;return Number.isFinite(o)&&(t instanceof Date?t.getTime():t)<=o+366*864e5}let n=pd(e.validUntil);return n===null?!1:(t instanceof Date?t.getTime():t)<n}function yd(e,t,n){return!(e.eventConfigurationId&&e.eventConfigurationId!==t||e.eventConfigurationVersion!==void 0&&e.eventConfigurationVersion!==n)}function gd(e){return e.status!=="draft"&&e.status!=="retracted"}function xd(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 ls(e,t={}){return!!e&&gd(e)&&yd(e,t.activeConfigurationId,t.activeConfigurationVersion)&&xd(e,t.activeBasisSha256)&&bd(e,t.now)}var vd=/^data:image\/(?:png|jpe?g|webp|gif|avif);base64,[a-z0-9+/]+={0,2}$/i,Md=/[\s"'<>`\\]/;function Sd(e){if(typeof e!="string"||!e||e.length>2e6||e!==e.trim())return!1;if(e.startsWith("data:"))return vd.test(e);if(Md.test(e))return!1;try{let t=new URL(e);return t.protocol==="https:"&&!t.username&&!t.password}catch{return!1}}function us(e){let t=e.trim();return Sd(t)?t:null}var Or="seatlayer.event-configuration/1";var qt=100,wd=120,Pd=2e5,Ad=1e4,Id=/^[a-f0-9]{64}$/,Rd=new Set(["stage","screen","barrier","camera_platform","sound_desk","rigging_truss"]);function Ln(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 Ed(e){return typeof e=="number"&&Number.isInteger(e)&&e>0}function ms(e){return!Array.isArray(e)||e.length>Pd||!e.every(t=>Nt(t,qt))?null:[...new Set(e)].sort()}function Cd(e){return!Ln(e)||!Nt(e.chartId,qt)||!Nt(e.version,qt)||e.sha256!==void 0&&(typeof e.sha256!="string"||!Id.test(e.sha256))?null:{chartId:e.chartId,version:e.version,...typeof e.sha256=="string"?{sha256:e.sha256}:{}}}function Fr(e,t,n){return typeof e=="number"&&Number.isFinite(e)&&e>=t&&e<=n}function _d(e){return Ln(e)?e.mode==="none"||e.mode==="opaque"?e.opacity===void 0?{mode:e.mode}:null:e.mode==="partial"&&Fr(e.opacity,.01,.99)?{mode:"partial",opacity:e.opacity}:null:null}function Td(e,t){if(e===void 0)return;if(!Array.isArray(e)||e.length>Ad)return null;let n=new Set(t),o=new Set,i=new Set,r=0,a=[];for(let s of e){if(!Ln(s)||!Nt(s.id,qt)||!Nt(s.objectId,qt)||!n.has(s.objectId)||!Rd.has(String(s.kind))||!Fr(s.heightM,.05,50)||s.baseElevationM!==void 0&&!Fr(s.baseElevationM,-10,100))return null;let c=_d(s.occlusion);if(!c||o.has(s.id)||i.has(s.objectId))return null;let l=s.contentImageUrl===void 0?void 0:typeof s.contentImageUrl=="string"?us(s.contentImageUrl):null;if(s.contentImageUrl!==void 0&&(!l||s.kind!=="screen"||++r>1))return null;o.add(s.id),i.add(s.objectId),a.push({id:s.id,objectId:s.objectId,kind:s.kind,heightM:s.heightM,...s.baseElevationM!==void 0?{baseElevationM:s.baseElevationM}:{},occlusion:c,...l?{contentImageUrl:l}:{}})}return a.sort((s,c)=>s.id.localeCompare(c.id))}function kd(e){let t=[];if(!Ln(e))return{issues:[{code:"invalid_export",path:"configuration",message:"Configuration must be an object"}]};e.schema!==Or&&t.push({code:"unsupported_schema",path:"configuration.schema",message:`Configuration schema must be ${Or}`}),Nt(e.id,qt)||t.push({code:"invalid_id",path:"configuration.id",message:"Configuration id must contain 1 to 100 normalized characters"}),Nt(e.label,wd)||t.push({code:"invalid_label",path:"configuration.label",message:"Configuration label must contain 1 to 120 normalized characters"}),Ed(e.version)||t.push({code:"invalid_version",path:"configuration.version",message:"Configuration version must be a positive integer"});let n=Cd(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 o=Ln(e.overlay)?e.overlay:null,i=ms(o?.objectIds),r=ms(o?.productionKillSeatIds),a=i?Td(o?.productionElements,i):null;return(!o||!i||!r)&&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||!i||!r||a===null?{issues:t}:{issues:t,value:{schema:Or,id:e.id,label:e.label,version:e.version,baseVenue:n,overlay:{objectIds:i,productionKillSeatIds:r,...a!==void 0?{productionElements:a}:{}}}}}function fs(e){let t=kd(e);return t.value?{ok:!0,value:t.value}:{ok:!1,issues:t.issues}}function Ld(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,o=e.width,i=e.height;return[{x:t,y:n},{x:t+o,y:n},{x:t+o,y:n+i},{x:t,y:n+i}]}function Od(e,t,n){let o=n*Math.PI/180,i=Math.cos(o),r=Math.sin(o),a=e.x-t.x,s=e.y-t.y;return{x:t.x+a*i-s*r,y:t.y+a*r+s*i}}function ds(e){let t=Ld(e);if(!t||t.length<2)return null;let n=e.rotation??0,o=Math.abs(n)<1e-6?t:t.map(c=>Od(c,{x:t.reduce((l,u)=>l+u.x,0)/t.length,y:t.reduce((l,u)=>l+u.y,0)/t.length},n)),i=1/0,r=1/0,a=-1/0,s=-1/0;for(let c of o)i=Math.min(i,c.x),r=Math.min(r,c.y),a=Math.max(a,c.x),s=Math.max(s,c.y);return!Number.isFinite(i)||a-i<1e-6||s-r<1e-6?null:{minX:i,minY:r,maxX:a,maxY:s}}var Fd=5,Dd=3,Nd=.92,Bd=1.9,Vd=2,Gd=.6,Hd=1,zd=.06;function Ud(e){return e.heightM!==void 0?e.heightM:e.stageKind==="ring-boxing"?fo:Tn(e.stageKind)?zd:Hd}function hs(e){let t=1/0,n=1/0,o=-1/0,i=-1/0,r=-1/0;for(let a of ys(e)){let s=a.baseHeightM??0;for(let c of a.objects){if(c.type!=="shape"||c.role!=="stage")continue;let l=ds(c);l&&(t=Math.min(t,l.minX),n=Math.min(n,l.minY),o=Math.max(o,l.maxX),i=Math.max(i,l.maxY),r=Math.max(r,s+Ud(c)))}}return!Number.isFinite(t)||!Number.isFinite(r)?null:{minX:t,minY:n,maxX:o,maxY:i,deckTopM:r}}function jd(e,t,n,o){let i=1/0,r=1/0,a=-1/0,s=-1/0;for(let d of e)Number.isFinite(d.eyeHeightM)&&(i=Math.min(i,d.x),a=Math.max(a,d.x),r=Math.min(r,d.y),s=Math.max(s,d.y));if(!Number.isFinite(i))return null;let c=i*t,l=r*t,u=Math.max(1,Math.ceil((a-i)*t/n)+1),m=Math.max(1,Math.ceil((s-r)*t/n)+1),f=new Float64Array(u*m).fill(-1/0);for(let d of e){if(!Number.isFinite(d.eyeHeightM))continue;let h=d.eyeHeightM-ot,p=Math.min(u-1,Math.max(0,Math.floor((d.x*t-c)/n))),y=Math.min(m-1,Math.max(0,Math.floor((d.y*t-l)/n)))*u+p,x=h+o;x>f[y]&&(f[y]=x)}return{cellM:n,minX:c,minY:l,cols:u,rows:m,top:f}}function Wd(e,t,n){let o=Math.floor((t-e.minX)/e.cellM),i=Math.floor((n-e.minY)/e.cellM);return o<0||i<0||o>=e.cols||i>=e.rows?-1/0:e.top[i*e.cols+o]}function ps(e,t,n={}){let o=new Map;if(!t||!e.length)return o;let i=n.metresPerChartUnit??fe,r=n.cellM??Gd,a=n.chairBackM??Nd,s=n.selfRowSkipM??Vd,c=n.clearThreshold??.9,l=n.partialThreshold??.25,u=Math.max(1,n.columns??Fd),m=Math.max(1,n.rows??Dd),f=jd(e,i,r,a);if(!f)return o;let d=(t.maxX-t.minX)*i,h=(t.maxY-t.minY)*i,p=d>=h,b=(t.minX+t.maxX)/2*i,y=(t.minY+t.maxY)/2*i,x=[];for(let A=0;A<u;A++){let M=(A+.5)/u-.5,g=p?b+M*d:b,P=p?y:y+M*h;for(let v=0;v<m;v++){let w=t.deckTopM+(m===1?0:v/(m-1)*Bd);x.push({x:g,y:P,z:w})}}let S=r/2;for(let A of e){if(!Number.isFinite(A.eyeHeightM))continue;let M=A.x*i,g=A.y*i,P=A.eyeHeightM,v=0,w=1/0;for(let _ of x){let F=_.x-M,E=_.y-g,I=Math.hypot(F,E);if(!(I>s)){v++;continue}let T=F/I,L=E/I,V=0;for(let O=s;O<I;O+=S){let H=Wd(f,M+T*O,g+L*O);if(!(!Number.isFinite(H)||H>=P)&&H>P+(_.z-P)*O/I){V=O;break}}V?w=Math.min(w,V):v++}let R=v/x.length;R>=c||o.set(A.id,{seatId:A.id,mark:R<l?"obstructedView":"restrictedView",visibleFraction:R,totalRays:x.length,atDistanceM:Number.isFinite(w)?w:0})}return o}function bs(e,t){if(!t.size)return 0;let n=0;for(let o of e){let i=t.get(o.id);if(!i)continue;let r=o.commercial;r?.restrictedView!==void 0||r?.obstructedView!==void 0||(o.commercial={...r,[i.mark]:!0},n++)}return n}function Dr(e){return e?e.accessibility?.length?e.wheelchairSpaceType&&!e.accessibility.includes("wheelchair")?["wheelchair",...e.accessibility]:e.accessibility:e.wheelchairSpaceType?["wheelchair"]:e.accessible?["wheelchair"]:[]:[]}var go=Math.PI/180;var On=16;function Nr(e,t,n,o){let i=n*go,r=Math.cos(i),a=Math.sin(i);return{x:o.x+e*r-t*a,y:o.y+e*a+t*r}}function Ss(e){let{seatCount:t,seatSpacing:n,curve:o,rotation:i,origin:r}=e,a=[];if(e.path)return ts(e.path,t);if(t<=1)return t===1&&a.push({x:r.x,y:r.y}),a;if(o===0){for(let l=0;l<t;l++)a.push(Nr(l*n,0,i,r));return a}let s=o/(t-1)*go,c=n/(2*Math.sin(Math.abs(s)/2));for(let l=0;l<t;l++){let u=l*s,m=c*Math.sin(u),f=-c+c*Math.cos(u);a.push(Nr(m,f,i,r))}return a}function ws(e){let t=new Map;if(e.overrides)for(let n of e.overrides)t.set(n.index,n);return t}function Xd(e,t){let n=ws(e);return Ss(e).map((o,i)=>{let r=n.get(i),a=Dr(r),s=rs(e,i,r),c={...e.commercial,...r?.commercial};return{index:i,x:o.x+(r?.dx??0),y:o.y+(r?.dy??0),label:s,displayLabel:Tr(e,i,t,r),categoryKey:r?.categoryKey??e.categoryKey,skipped:!!r?.skip,accessible:a.length>0,accessibility:a,wheelchairSpaceType:r?.wheelchairSpaceType,commercial:Object.values(c).some(l=>l!==void 0&&l!==!1&&l!=="")?c:void 0,glyph:r?.glyph,viewUrl:r?.viewFromSeatUrl??e.viewFromSeatUrl,viewMeta:r?.viewFromSeatUrl?r.viewFromSeatMeta:e.viewFromSeatMeta,labelStyle:r?.labelStyle??e.seatLabelStyle}})}function Yd(e){let t=[];for(let n of Xd(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 Kd(e){if(e.seatCountsBySide)return{...e.seatCountsBySide};let t=e.sides&&e.sides.length?e.sides:["top","bottom"],n=["top","bottom","left","right"].filter(r=>t.includes(r)),o={top:0,bottom:0,left:0,right:0};if(!n.length)return o;let i=Math.max(0,Math.round(e.seatCount));for(let r=0;r<i;r++)o[n[r%n.length]]+=1;return o}function $d(e){let t=[],n=Math.max(0,Math.round(e.seatCount));if(n===0)return t;let o=new Map((e.overrides??[]).map(u=>[u.index,u])),i=(u,m,f,d)=>{let h=o.get(u),p=Dr(h),b=h?.label??is(e,u);return{index:u,label:b,displayLabel:h?.displayLabel??as(e,u),x:m+(h?.dx??0),y:f+(h?.dy??0),categoryKey:h?.categoryKey??e.categoryKey,skipped:!!h?.skip,accessible:p.length>0,accessibility:p,wheelchairSpaceType:h?.wheelchairSpaceType,commercial:h?.commercial,glyph:h?.glyph,viewUrl:h?.viewFromSeatUrl,viewMeta:h?.viewFromSeatUrl?h.viewFromSeatMeta:void 0,labelStyle:h?.labelStyle,...d?{side:d}:{}}};if(e.shape==="round"){let u=(e.radius??40)+On,m=e.rotation*go,f=Math.max(0,Math.min(360,e.seatArc??360));if(f>=360||n===1){for(let b=0;b<n;b++){let y=m+b/n*2*Math.PI;t.push(i(b,e.center.x+u*Math.cos(y),e.center.y+u*Math.sin(y)))}return t}let d=f*go,h=(2*Math.PI-d)/2,p=m+h;for(let b=0;b<n;b++){let y=p+b/(n-1)*d;t.push(i(b,e.center.x+u*Math.cos(y),e.center.y+u*Math.sin(y)))}return t}let r=e.width??80,a=e.height??50,s=Kd(e),c=["top","bottom","left","right"],l=0;for(let u of c){let m=s[u];for(let f=0;f<m;f++){let d,h;u==="top"?(d=-r/2+(f+.5)*r/m,h=-a/2-On):u==="bottom"?(d=-r/2+(f+.5)*r/m,h=a/2+On):u==="left"?(d=-r/2-On,h=-a/2+(f+.5)*a/m):(d=r/2+On,h=-a/2+(f+.5)*a/m);let p=Nr(d,h,e.rotation,e.center);t.push(i(l++,p.x,p.y,u))}}return t}function qd(e){return $d(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 Zd(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",...e.commercial?.note?{commercial:{note:e.commercial.note}}:{}}]}function gs(e,t){let n=!1;for(let o=0,i=t.length-1;o<t.length;i=o++){let r=t[o].x,a=t[o].y,s=t[i].x,c=t[i].y;a>e.y!=c>e.y&&e.x<(s-r)*(e.y-a)/(c-a)+r&&(n=!n)}return n}function Qd(e,t){return t.some((n,o)=>{let i=t[(o+1)%t.length],r=(e.y-n.y)*(i.x-n.x)-(e.x-n.x)*(i.y-n.y);if(Math.abs(r)>1e-7)return!1;let a=(e.x-n.x)*(i.x-n.x)+(e.y-n.y)*(i.y-n.y),s=(i.x-n.x)**2+(i.y-n.y)**2;return a>=-1e-7&&a<=s+1e-7})}function Br(e){return Array.isArray(e)?e.filter(t=>Array.isArray(t)&&t.length>=3):[]}function Le(e,t,n){return gs(e,t)&&!Br(n).some(o=>gs(e,o)||Qd(e,o))}function yo(e){if(!e.length)return{x:0,y:0};let t=0,n=0;for(let o of e)t+=o.x,n+=o.y;return{x:t/e.length,y:n/e.length}}function Ps(e){switch(e.type){case"row":{let t=Ss(e),n=ws(e),o=0,i=0,r=0;for(let a=0;a<t.length;a++){let s=n.get(a);s?.skip||(o+=t[a].x+(s?.dx??0),i+=t[a].y+(s?.dy??0),r++)}return r?{x:o/r,y:i/r}:{x:e.origin.x,y:e.origin.y}}case"table":case"booth":return{x:e.center.x,y:e.center.y};case"gaArea":return yo(e.points);case"section":return yo(e.outline);case"text":return{x:e.position.x,y:e.position.y};case"shape":return e.points&&e.points.length?yo(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 xs(e,t){return e.length===t.length&&e.every((n,o)=>n.x===t[o].x&&n.y===t[o].y)}function Jd(e,t){if(e.type!=="gaArea"||!xs(e.points,t.outline))return!1;let n=Br(e.holes),o=Br(t.holes);return n.length===o.length&&n.every((i,r)=>xs(i,o[r]))}function eh(e,t,n=e.filter(i=>i.type==="section"),o=Ps(t)){let i="referenceInventorySource"in t?t.referenceInventorySource?.logicalSectionId:void 0;return(i?n.find(a=>(a.logicalSectionId??a.id)===i&&(Jd(t,a)||Le(o,a.outline,a.holes))):void 0)??n.find(a=>Le(o,a.outline,a.holes))}function ys(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 vs(e,t,n,o,i,r,a,s,c){let l=[],u=e.filter(p=>p.type==="section"),m=ns(e),f=p=>!p?.eventConfigurationId||p.eventConfigurationId===o&&(p.eventConfigurationVersion===void 0||p.eventConfigurationVersion===c),d=p=>ls(p,{activeConfigurationId:o,activeConfigurationVersion:c,activeBasisSha256:i,now:s}),h=(p,b)=>d(p)?{...p,coverage:b}:void 0;for(let p of e){let b=[];if(p.type==="row"?b=Yd(p):p.type==="table"?b=qd(p):p.type==="booth"&&(b=Zd(p)),!b.length)continue;for(let M of b)M.viewUrl&&!f(M.viewMeta)&&(M.viewUrl=void 0,M.viewMeta=void 0);if(p.type==="row"){let M=m.get(p.id);if(M){let g=new Map((p.overrides??[]).map(P=>[P.index,P]));for(let P of b){let v=Number(P.id.slice(P.id.lastIndexOf(":")+1));if(!Number.isInteger(v))continue;P.logicalRowId=M.groupId,P.logicalSeatIndex=M.adjacencyOffset+v,g.get(v)?.displayLabel||(P.displayLabel=Tr(p,v,M)),!P.viewUrl&&M.viewFromSeatUrl&&f(M.viewFromSeatMeta)&&(P.viewUrl=M.viewFromSeatUrl,P.viewMeta=M.viewFromSeatMeta);let w=g.get(v)?.confidenceEvidence;P.confidenceEvidence=h(w,"exact-seat")??h(p.confidenceEvidence,"row-representative")??h(M.confidenceEvidence,"row-representative")}}}let y=eh(e,p,u,p.type==="row"?yo(b):Ps(p)),x=y?.viewFromSeatUrl,A=(y?.zone?t?.find(M=>M.id===y.zone):void 0)?.focalPoint??n;for(let M of b){if(!M.confidenceEvidence){let g=Number(M.id.slice(M.id.lastIndexOf(":")+1)),P=(p.type==="row"||p.type==="table")&&Number.isInteger(g)?p.overrides?.find(v=>v.index===g)?.confidenceEvidence:void 0;M.confidenceEvidence=h(P,"exact-seat")??(p.type==="row"?h(p.confidenceEvidence,"row-representative"):void 0)}M.confidenceEvidence??=h(y?.confidenceEvidence,"section-representative")??(a?h(a.evidence,a.coverage):void 0),!M.viewUrl&&x&&f(y?.viewFromSeatMeta)&&(M.viewUrl=x,M.viewMeta=y?.viewFromSeatMeta),!M.viewUrl&&r&&f(r.meta)&&(M.viewUrl=r.url,M.viewMeta=r.meta),y&&(M.sectionId=y.logicalSectionId??y.id),y?.zone&&(M.zoneId=y.zone),A&&(M.focalPoint={...A})}l.push(...b)}return l}function Zt(e,t={}){if(e.floors?.length){let o=[];for(let i of e.floors){let r=i.focalPoint??e.focalPoint,a=i.viewFromSeatUrl?{url:i.viewFromSeatUrl,meta:i.viewFromSeatMeta}:e.viewFromSeatUrl?{url:e.viewFromSeatUrl,meta:e.viewFromSeatMeta}:void 0,s=i.confidenceEvidence?{evidence:i.confidenceEvidence,coverage:"floor-representative"}:e.confidenceEvidence?{evidence:e.confidenceEvidence,coverage:"venue-representative"}:void 0,c=vs(i.objects,e.zones,r,e.eventConfigurationId,e.confidenceBasisSha256,a,s,t.now,t.eventConfigurationVersion??e.eventConfigurationVersion);t.resolveEyeHeights!==!1&&Ms(i.objects,i.focalPoint??e.focalPoint,i.baseHeightM??0,c);for(let l of c)l.floorId=i.id;for(let l of c)o.push(l)}return o}let n=vs(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&&Ms(e.objects,e.focalPoint,t.floorBaseHeightM??0,n),th(e,n,t)}function th(e,t,n){return!n.deriveRestrictedView||e.derivedRestrictedView===!1||n.resolveEyeHeights===!1||bs(t,ps(t,hs(e))),t}function Ms(e,t,n,o){let i=e.filter(m=>m.type==="section"),r=n>0||i.some(m=>m.height!==void 0||m.rake!==void 0||(m.elevation??0)>0);if(!i.length||!r||!t){for(let m of o)m.eyeHeightM=n+ot;return}let a=new Array(o.length),s=new Map;for(let m of i)s.has(m.id)||s.set(m.id,m);let c=new Map,l=new Map;for(let m=0;m<o.length;m++){let f=o[m],h=(f.sectionId?s.get(f.sectionId)??i.find(b=>b.logicalSectionId===f.sectionId&&Le({x:f.x,y:f.y},b.outline,b.holes)):void 0)??i.find(b=>Le({x:f.x,y:f.y},b.outline,b.holes))??null;if(a[m]=h,!h)continue;c.has(h.id)||c.set(h.id,yt(h,{floorBaseHeightM:n}));let p=l.get(h.id);p?p.push(m):l.set(h.id,[m])}let u=new Array(o.length).fill(void 0);for(let[m,f]of l){let d=c.get(m);if(!d)continue;let h=d.rake>0?Math.tan(d.rake*Math.PI/180):0,p=bo(m,o,f,t);for(let b of p.rows){let y=b.blockDepth*fe*h,x=d.height+y;for(let S of b.seatIndices)u[S]=x}}for(let m=0;m<o.length;m++){let f=o[m],d=a[m];if(!d){f.eyeHeightM=n+ot;continue}let h=c.get(d.id);f.eyeHeightM=(u[m]??h.height)+ot}}function As(e){let t=1/0,n=1/0,o=-1/0,i=-1/0,r=!1;for(let a of e)!Number.isFinite(a.x)||!Number.isFinite(a.y)||(r=!0,a.x<t&&(t=a.x),a.y<n&&(n=a.y),a.x>o&&(o=a.x),a.y>i&&(i=a.y));return r?{minX:t,minY:n,maxX:o,maxY:i}:null}function Qt(e,t){return e.minX<=t.maxX&&t.minX<=e.maxX&&e.minY<=t.maxY&&t.minY<=e.maxY}function Fn(e){if(e.length<3)return e.map(r=>({...r}));let t=[...e].sort((r,a)=>r.x-a.x||r.y-a.y),n=(r,a,s)=>(a.x-r.x)*(s.y-r.y)-(a.y-r.y)*(s.x-r.x),o=r=>{let a=[];for(let s of r){for(;a.length>=2&&n(a[a.length-2],a[a.length-1],s)<=0;)a.pop();a.push(s)}return a.pop(),a},i=[...o(t),...o([...t].reverse())];return i.length>=3?i.map(r=>({...r})):t.map(r=>({...r}))}var Ws=nt(require("polygon-clipping"),1);var ae={top:1,wallBottom:.58,bottomCap:.4};function Bt(e,t){if(!e)return t;let n=le(qe(e,.4),.62);return be(t,n,.22)}function Is(e,t){return e?be(t,le(qe(e,.25),.74),.62):t}function Rs(e,t){return e?be(t,le(qe(e,.08),.9),.82):t}function Es(e,t){let n=new Map;for(let r of e.categories??[])n.set(r.key,r.color);let o=new Map;for(let r of t){if(!r.sectionId)continue;let a=o.get(r.sectionId);a||(a=new Map,o.set(r.sectionId,a)),a.set(r.categoryKey,(a.get(r.categoryKey)??0)+1)}let i=new Map;for(let[r,a]of o){let s=0,c=0,l=0,u=0;for(let[m,f]of a){let d=he(n.get(m));d&&(s+=d[0]*f,c+=d[1]*f,l+=d[2]*f,u+=f)}u>0&&i.set(r,[s/u,c/u,l/u])}return i}function Cs(e,t){return he(e.color)??t.get(e.logicalSectionId??e.id)??null}var zr=nt(require("polygon-clipping"),1);var Hr=nt(require("polygon-clipping"),1);var Ls=nt(require("earcut"),1);var nh=.58,_s=.01,We=ut*1.5*je,oh=.5,rh=.6;function ih(e,t){let n=e.length,o=[];for(let a=0;a<n;a++){let s=e[Math.max(0,a-1)],c=e[Math.min(n-1,a+1)],l=c.x-s.x,u=c.y-s.y,m=Math.hypot(l,u);if(m<1e-9){o.push([0,0]);continue}l/=m,u/=m,o.push([-u,l])}let i=0;for(let a=0;a<n;a++)i+=(e[a].x-t.x)*o[a][0]+(e[a].y-t.y)*o[a][1];return i<0?o.map(([a,s])=>[-a,-s]):o}function ah(e,t){if(e.length<2||t<=0)return[...e];let n=[...e],o=(a,s)=>{let c=s.x-a.x,l=s.y-a.y,u=Math.hypot(c,l)||1;return{x:c/u,y:l/u}},i=o(n[1],n[0]),r=o(n[n.length-2],n[n.length-1]);return n.unshift({x:n[0].x+i.x*t,y:n[0].y+i.y*t}),n.push({x:n[n.length-1].x+r.x*t,y:n[n.length-1].y+r.y*t}),n}var Ts=Math.PI/12;function sh(e){if(e.length<3)return[...e];let t=[...e].sort((r,a)=>r.x-a.x||r.y-a.y),n=(r,a,s)=>(a.x-r.x)*(s.y-r.y)-(a.y-r.y)*(s.x-r.x),o=r=>{let a=[];for(let s of r){for(;a.length>=2&&n(a[a.length-2],a[a.length-1],s)<=0;)a.pop();a.push(s)}return a.pop(),a},i=[...o(t),...o([...t].reverse())];return i.length>=3?i:[...e]}function Os(e,t){if(!e.length||!(t>0))return[];let n=sh(e),o=(s,c,l,u)=>{let m=l-c;for(;m<0;)m+=Math.PI*2;for(;m>Math.PI*2;)m-=Math.PI*2;let f=Math.max(1,Math.ceil(m/Ts)),d=t/Math.cos(m/f/2);for(let h=0;h<=f;h++){let p=c+m*h/f;u.push({x:s.x+Math.cos(p)*d,y:s.y+Math.sin(p)*d})}};if(n.length<3){let s=0,c=0;for(let d of n)s+=d.x,c+=d.y;s/=n.length||1,c/=n.length||1;let l=0;for(let d of n)l=Math.max(l,Math.hypot(d.x-s,d.y-c));let u=[],m=Math.max(3,Math.ceil(Math.PI*2/Ts)),f=(l+t)/Math.cos(Math.PI/m);for(let d=0;d<m;d++){let h=d/m*Math.PI*2;u.push({x:s+Math.cos(h)*f,y:c+Math.sin(h)*f})}return u}let i=n.length,r=[];for(let s=0;s<i;s++){let c=n[s],l=n[(s+1)%i];r.push(Math.atan2(-(l.x-c.x),l.y-c.y))}let a=[];for(let s=0;s<i;s++)o(n[s],r[(s+i-1)%i],r[s],a);return Vs(a)}function ch(e,t,n){if(e.length===1)return Math.hypot(t-e[0].x,n-e[0].y);let o=1/0;for(let i=0;i+1<e.length;i++){let r=e[i],a=e[i+1],s=a.x-r.x,c=a.y-r.y,l=s*s+c*c,u=l>1e-12?((t-r.x)*s+(n-r.y)*c)/l:0;u<0?u=0:u>1&&(u=1);let m=Math.hypot(t-(r.x+u*s),n-(r.y+u*c));m<o&&(o=m)}return o}function xo(e){let t=e.map(i=>{let r=0,a=0;for(let l of i.pts)r+=l.x,a+=l.y;let s=i.pts.length||1;r/=s,a/=s;let c=0;for(let l of i.pts){let u=Math.hypot(l.x-r,l.y-a);u>c&&(c=u)}return{cx:r,cy:a,rad:c}}),n=i=>{let r=i.length;return r<=2?[...i]:[i[Math.floor(r*.25)],i[Math.floor(r*.5)],i[Math.floor(r*.75)]]},o=[];for(let i=0;i<e.length;i++){let r=n(e[i].pts),a=[],s=1/0,c=null;for(let u of r){let m=1/0;for(let f=0;f<e.length;f++){if(f===i||Math.abs(e[f].y-e[i].y)<.001)continue;let d=t[f],h=Math.hypot(u.x-d.cx,u.y-d.cy)-d.rad;if(h>=m&&h>=s)continue;let p=ch(e[f].pts,u.x,u.y);p<m&&(m=p),e[f].depth<e[i].depth&&p<s&&(s=p,c=e[f].y)}Number.isFinite(m)&&m>0&&a.push(m)}a.sort((u,m)=>u-m);let l=a.length?a[Math.floor(a.length/2)]:1;o.push({pitch:l,belowY:c})}return o}function Fs(e,t,n,o){let i=e[t],r=i.pts.length>=2?[...i.pts]:i.pts.length===1?(()=>{let u=i.pts[0],m=u.x-o.x,f=u.y-o.y,d=Math.hypot(m,f)||1;m/=d,f/=d;let h=Math.max(n[t].pitch,.001)*.5;return[{x:u.x+f*h,y:u.y-m*h},{x:u.x-f*h,y:u.y+m*h}]})():[];if(r.length<2)return null;let a=0,s=0;for(let u=1;u<r.length;u++){let m=Math.hypot(r[u].x-r[u-1].x,r[u].y-r[u-1].y);m>1e-6&&(a+=m,s++)}let c=s>0?a/s:0,l=ah(r,Math.max(c*rh,We));return{pts:l,nrm:ih(l,o),front:Math.max(n[t].pitch*nh,We),back:Math.max(n[t].pitch*oh,We)}}var Jt=1.5,Ds=.3;function Vr(e,t){if(e.length<3)return e;let n=e[0],o=e[e.length-1],i=o.x-n.x,r=o.y-n.y,a=Math.hypot(i,r),s=-1,c=-1;for(let m=1;m<e.length-1;m++){let f=e[m],d=a>1e-12?Math.abs((f.x-n.x)*r-(f.y-n.y)*i)/a:Math.hypot(f.x-n.x,f.y-n.y);d>s&&(s=d,c=m)}if(s<=t||c<0)return[n,o];let l=Vr(e.slice(0,c+1),t),u=Vr(e.slice(c),t);return[...l.slice(0,-1),...u]}function Ns(e,t){if(e.length<4)return e;let n=Vr([...e,e[0]],t);return n.pop(),n.length>=3?n:e}function lh(e){let t=e.map((o,i)=>{let r=e[(i+1)%e.length];return{a:o,b:r,i,minX:Math.min(o.x,r.x),maxX:Math.max(o.x,r.x),minY:Math.min(o.y,r.y),maxY:Math.max(o.y,r.y)}}).sort((o,i)=>o.minX-i.minX),n=(o,i,r)=>(i.x-o.x)*(r.y-o.y)-(i.y-o.y)*(r.x-o.x);for(let o=0;o<t.length;o++){let i=t[o];for(let r=o+1;r<t.length&&t[r].minX<=i.maxX;r++){let a=t[r];if(!(Math.abs(i.i-a.i)===1||Math.abs(i.i-a.i)===e.length-1||i.maxY<a.minY||a.maxY<i.minY)&&n(i.a,i.b,a.a)*n(i.a,i.b,a.b)<=0&&n(a.a,a.b,i.a)*n(a.a,a.b,i.b)<=0)return!0}}return!1}function Bs(e,t,n){if(e.length<2)return[];let o=n??xo(e),i=new Map;for(let a=0;a<e.length;a++){let s=i.get(e[a].blockId);s?s.push(a):i.set(e[a].blockId,[a])}let r=[];for(let[,a]of i){let s=[];for(let x of a){let S=e[x].patch;S&&S.length>=3?r.push({outline:[...S],holes:[],topY:e[x].y}):s.push(x)}if(!s.length)continue;s.sort((x,S)=>e[x].depth-e[S].depth);let l=s.map(x=>Fs(e,x,o,t)).filter(x=>x!==null);if(!l.length)continue;let u=(x,S)=>({x:x.pts[S].x-x.nrm[S][0]*(x.front+Jt),y:x.pts[S].y-x.nrm[S][1]*(x.front+Jt)}),m=(x,S)=>({x:x.pts[S].x+x.nrm[S][0]*(x.back+Jt),y:x.pts[S].y+x.nrm[S][1]*(x.back+Jt)}),f=l[0],d=l[l.length-1],h=[];for(let x=0;x<f.pts.length;x++)h.push(u(f,x));for(let x of l)h.push(m(x,x.pts.length-1));for(let x=d.pts.length-1;x>=0;x--)h.push(m(d,x));for(let x=l.length-1;x>=0;x--)h.push(u(l[x],0));let p=Vs(h),b=1/0;for(let x of s)e[x].y<b&&(b=e[x].y);if(!Number.isFinite(b))continue;if(p.length>=3&&Math.abs(Ve(p))>1e-6&&l.every(x=>{let S=x.pts[Math.floor(x.pts.length/2)];return Ge(p,S.x,S.y)})&&!lh(p)){r.push({outline:Ns(p,Ds),holes:[],topY:b});continue}for(let x of uh(l))r.push({outline:x,holes:[],topY:b})}return r}function uh(e){let t=[];for(let n of e){let o=[],i=[],r=n.front+Jt,a=n.back+Jt;for(let c=0;c<n.pts.length;c++){let l=n.pts[c],u=n.nrm[c];o.push([l.x-u[0]*r,l.y-u[1]*r]),i.push([l.x+u[0]*a,l.y+u[1]*a])}let s=[...o,...i.reverse()];s.length<3||(s.push(s[0]),t.push([s]))}if(!t.length)return[];try{let n=Hr.default.union(t[0],...t.slice(1)),o=[];for(let i of n){if(!i.length||i[0].length<4)continue;let r=i[0].map(([c,l])=>({x:c,y:l})),a=r[0],s=r[r.length-1];r.length>1&&Math.abs(a.x-s.x)<1e-9&&Math.abs(a.y-s.y)<1e-9&&r.pop(),r.length>=3&&o.push(Ns(r,Ds))}return o}catch{return[]}}function Vs(e){let t=[];for(let n of e){let o=t[t.length-1];o&&Math.hypot(n.x-o.x,n.y-o.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 Gr=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 o of n)o.x<this.minX&&(this.minX=o.x),o.y<this.minY&&(this.minY=o.y),o.x>this.maxX&&(this.maxX=o.x),o.y>this.maxY&&(this.maxY=o.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 o=!0;for(let i of t)if(!Ge(n,i.x,i.y)){o=!1;break}if(o)return!0}return!1}};function ks(e,t,n,o,i,r){if(o.length<3)return;if(n.containsAll(o)){let l=[0,1,0],u=o[0];for(let m=1;m+1<o.length;m++){let f=o[m],d=o[m+1];e.tri([u.x*C,i,u.y*C],[f.x*C,i,f.y*C],[d.x*C,i,d.y*C],l,r)}return}let a=o.map(l=>[l.x,l.y]);a.push(a[0]);let s;try{s=Hr.default.intersection([a],t)}catch{return}let c=[0,1,0];for(let l of s){if(!l.length||l[0].length<4)continue;let u=l[0],m=[],f=[];for(let h=0;h<u.length-1;h++)m.push(u[h][0],u[h][1]),f.push([u[h][0],u[h][1]]);if(f.length<3)continue;let d=(0,Ls.default)(m,void 0,2);for(let h=0;h<d.length;h+=3){let p=f[d[h]],b=f[d[h+1]],y=f[d[h+2]];e.tri([p[0]*C,i,p[1]*C],[b[0]*C,i,b[1]*C],[y[0]*C,i,y[1]*C],c,r)}}}function Gs(e,t,n,o,i,r,a){if(t.length<2)return;let s=a??xo(t),c=[0,1,0],l=r&&r.length>=3?[[...r.map(d=>[d.x,d.y]),[r[0].x,r[0].y]]]:null,u=r&&r.length>=3?new Gr([[...r]]):null,m=d=>{e.setMaterial(2),d(),e.setMaterial(0)},f=d=>{e.setMaterial(3),d(),e.setMaterial(0)};for(let d=0;d<t.length;d++){let h=t[d];if(h.patch&&h.patch.length>=3){let M=[...h.patch],g=s[d].belowY??o;if(f(()=>{if(l&&u)ks(e,l,u,M,h.y,i.tread);else{let P=M[0];for(let v=1;v+1<M.length;v++){let w=M[v],R=M[v+1];e.tri([P.x*C,h.y,P.y*C],[w.x*C,h.y,w.y*C],[R.x*C,h.y,R.y*C],c,i.tread)}}}),h.y>g+_s){let P=0,v=0;for(let w of M)P+=w.x,v+=w.y;P/=M.length,v/=M.length,m(()=>{for(let w=0;w<M.length;w++){let R=M[w],_=M[(w+1)%M.length],F=_.x-R.x,E=_.y-R.y,I=Math.hypot(F,E);if(I<1e-6)continue;let T=E/I,L=-F/I;(R.x-P)*T+(R.y-v)*L<0&&(T=-T,L=-L);let V=[T,0,L],O=[R.x*C,h.y,R.y*C],H=[_.x*C,h.y,_.y*C],j=[R.x*C,g,R.y*C],N=[_.x*C,g,_.y*C];e.tri(O,H,N,V,i.riser),e.tri(O,N,j,V,i.riser)}})}continue}let p=Fs(t,d,s,n);if(!p)continue;let{pts:b,nrm:y,front:x,back:S}=p,A=s[d].belowY??o;for(let M=0;M+1<b.length;M++){let g=b[M],P=b[M+1],v=y[M],w=y[M+1];if(Math.hypot(P.x-g.x,P.y-g.y)<1e-6||v[0]===0&&v[1]===0||w[0]===0&&w[1]===0)continue;let R=[(g.x-v[0]*x)*C,h.y,(g.y-v[1]*x)*C],_=[(P.x-w[0]*x)*C,h.y,(P.y-w[1]*x)*C],F=[(g.x+v[0]*S)*C,h.y,(g.y+v[1]*S)*C],E=[(P.x+w[0]*S)*C,h.y,(P.y+w[1]*S)*C];if(f(()=>{l&&u?ks(e,l,u,[{x:g.x-v[0]*x,y:g.y-v[1]*x},{x:P.x-w[0]*x,y:P.y-w[1]*x},{x:P.x+w[0]*S,y:P.y+w[1]*S},{x:g.x+v[0]*S,y:g.y+v[1]*S}],h.y,i.tread):(e.tri(R,_,E,c,i.tread),e.tri(R,E,F,c,i.tread))}),h.y>A+_s){let I=[R[0],A,R[2]],T=[_[0],A,_[2]],L=[-v[0],0,-v[1]];m(()=>{e.tri(R,_,T,L,i.riser),e.tri(R,T,I,L,i.riser)})}}}}function mh(e,t){let n=e.eventConfigurationIds;return!n?.length||!!t&&n.includes(t)}function Hs(e,t){return e.filter(n=>n.type!=="shape"||mh(n,t))}function zs(e,t){let n=e.focalPoint??{x:0,y:0};return e.floors?.length?e.floors.map((o,i)=>({objects:Hs(o.objects,t),focal:{x:(o.focalPoint??n).x,y:(o.focalPoint??n).y},baseHeightM:o.baseHeightM??0,index:i})):[{objects:Hs(e.objects,t),focal:n,baseHeightM:0,index:0}]}var fh={minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};function ft(e){return As(e)??fh}function Us(e,t){let n=Ze(e.outline,We),o=ft(n),i=t.filter(a=>a!==e&&a.outline&&a.outline.length>=3&&Qt(o,ft(a.outline)));if(!i.length)return[n];let r=a=>{let s=a.map(c=>[c.x,c.y]);return s.push(s[0]),s};try{let a=zr.default.difference([r(n)],...i.map(c=>[r(c.outline)])),s=[];for(let c of a){if(!c.length)continue;let l=c[0].map(([u,m])=>({x:u,y:m}));if(l.length>1){let u=l[0],m=l[l.length-1];Math.abs(u.x-m.x)<1e-9&&Math.abs(u.y-m.y)<1e-9&&l.pop()}l.length>=3&&s.push(l)}return s.length?s:[n]}catch{return[n]}}function js(e,t){if(!t.length)return e;let n=r=>{let a=r.map(s=>[s.x,s.y]);return a.push(a[0]),a},o=t.map(r=>[n(r)]),i=[];for(let r of e){let a;try{a=zr.default.intersection([n(r.outline)],o.flat())}catch{i.push(r);continue}for(let s of a){if(!s.length)continue;let c=s[0].map(([l,u])=>({x:l,y:u}));if(c.length>1){let l=c[0],u=c[c.length-1];Math.abs(l.x-u.x)<1e-9&&Math.abs(l.y-u.y)<1e-9&&c.pop()}c.length>=3&&i.push({outline:c,holes:[],topY:r.topY})}}return i.length?i:e}function dh(e,t){return e===void 0||t===void 0?!0:Math.abs(e-t)<.001}var vo=class{constructor(){this.rings=[];this.boxes=[];this.levels=[]}subtract(t,n){let o=t.map(c=>[c.x,c.y]);if(o.length<3)return[];o.push(o[0]);let i=ft(t),r=this.rings.filter((c,l)=>Qt(i,this.boxes[l])&&dh(n,this.levels[l])),a=[[o]];if(r.length)try{a=Ws.default.difference([o],...r).map(l=>l.map(u=>u.map(([m,f])=>[m,f])))}catch{a=[[o]]}this.rings.push([o]),this.boxes.push(i),this.levels.push(n);let s=[];for(let c of a){if(!c.length)continue;let l=c[0].map(([u,m])=>({x:u,y:m}));if(l.length>1){let u=l[0],m=l[l.length-1];Math.abs(u.x-m.x)<1e-9&&Math.abs(u.y-m.y)<1e-9&&l.pop()}l.length>=3&&s.push(l)}return s}};function Mo(e,t){if(!t)return e;let n=1/0,o=-1/0,i=1/0,r=-1/0;for(let m of e)n=Math.min(n,m.x),o=Math.max(o,m.x),i=Math.min(i,m.y),r=Math.max(r,m.y);let a=(n+o)/2,s=(i+r)/2,c=t*Math.PI/180,l=Math.cos(c),u=Math.sin(c);return e.map(m=>{let f=m.x-a,d=m.y-s;return{x:a+f*l-d*u,y:s+f*u+d*l}})}function ge(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=En(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,o=(e.y??0)+e.height/2;t=uo(n,o,e.width/2,e.height/2)}return t?Mo(t,e.rotation):null}function Qe(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}},o=t==="stage"&&Tn(e.stageKind)?{kind:"stage",heightM:e.stageKind==="ring-boxing"?fo:.06}:n[t]??{kind:"plate",heightM:.25};return{...o,heightM:e.heightM??o.heightM}}var hh=.08,ph=30,bh=.015;function yh(e,t){let n=!1;for(let o=0,i=t.length-1;o<t.length;i=o++){let r=t[o],a=t[i];r.y>e.y!=a.y>e.y&&e.x<(a.x-r.x)*(e.y-r.y)/(a.y-r.y)+r.x&&(n=!n)}return n}function Xs(e,t){let n=ge(e)??(e.points?.length?Mo(e.points,e.rotation):null),o=Qe(e),r=!e.role&&o.kind==="plate"&&e.heightM===void 0&&!!n&&Math.abs(Ve(n))*fe**2>=ph?bh:o.heightM;if(!n)return{topOffsetM:r,supportOffsetM:0};if(o.kind!=="plate"&&o.kind!=="stage")return{topOffsetM:r,supportOffsetM:0};let a=1/0,s=1/0,c=-1/0,l=-1/0;for(let d of n)a=Math.min(a,d.x),s=Math.min(s,d.y),c=Math.max(c,d.x),l=Math.max(l,d.y);let u=r,m=0,f=1e-6*Math.max(1,c-a,l-s);for(let d of t)c>d.minX&&a<d.maxX&&l>d.minY&&s<d.maxY&&u<=d.topOffsetM+1e-6&&(u=d.topOffsetM+hh),a>=d.minX-f&&c<=d.maxX+f&&s>=d.minY-f&&l<=d.maxY+f&&(!d.poly||n.every(b=>yh(b,d.poly)||gh(b,d.poly,f)))&&(m=Math.max(m,d.topOffsetM));return e.fill&&e.fill!=="none"&&e.fill!=="transparent"&&t.push({minX:a,minY:s,maxX:c,maxY:l,topOffsetM:u,poly:n}),{topOffsetM:u,supportOffsetM:Math.min(m,u)}}function gh(e,t,n){for(let o=0,i=t.length-1;o<t.length;i=o++){let r=t[i],a=t[o],s=a.x-r.x,c=a.y-r.y,l=s*s+c*c,u=l?Math.max(0,Math.min(1,((e.x-r.x)*s+(e.y-r.y)*c)/l)):0;if(Math.hypot(e.x-(r.x+u*s),e.y-(r.y+u*c))<=n)return!0}return!1}function vt(e,t,n){return{x:e.x+(t.x-e.x)*n,y:e.y+(t.y-e.y)*n}}function He(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 Oe(e,t,n){return[vt(e[0],e[1],t),vt(e[0],e[1],n),vt(e[3],e[2],n),vt(e[3],e[2],t)]}function Dn(e,t,n){return[vt(e[0],e[3],t),vt(e[1],e[2],t),vt(e[1],e[2],n),vt(e[0],e[3],n)]}function de(e,t,n,o,i,r){ue(e,t,void 0,()=>n,o,i,r,ae)}var xh=.8,vh=.6,Mh=2;function Mt(e,t){if(!t.length)return null;let n=[],o=0;for(let a of e.objects){if(a.type!=="shape"||a.role!=="wall")continue;let s=ge(a)??[],c=Ys(s)/2;!(c>0)||Ph(s)/c*C>Mh||(n.push(...s),o+=c)}if(n.length<3)return null;let i=Fn(n);if(i.length<3||o<Ys(i)*vh)return null;let r=0;for(let a of t)Ah(a,i)&&(r+=1);return r>=t.length*xh?i:null}var So=6,Sh=5,wh=8;function Ks(e){return Math.max(wh,(Number.isFinite(e)?e:0)+Sh)}function en(e){let t=0,n=0,o=0;for(let i=0;i<e.length;i++){let r=e[i],a=e[(i+1)%e.length],s=r.x*a.y-a.x*r.y;t+=s,n+=(r.x+a.x)*s,o+=(r.y+a.y)*s}if(Math.abs(t)<1e-9){let i=0,r=0;for(let a of e)i+=a.x,r+=a.y;return{x:i/Math.max(1,e.length),y:r/Math.max(1,e.length)}}return{x:n/(3*t),y:o/(3*t)}}function Ph(e){let t=0;for(let n=0;n<e.length;n++){let o=e[n],i=e[(n+1)%e.length];t+=o.x*i.y-i.x*o.y}return Math.abs(t)/2}function Ys(e){let t=0;for(let n=0;n<e.length;n++){let o=e[n],i=e[(n+1)%e.length];t+=Math.hypot(i.x-o.x,i.y-o.y)}return t}function Ah(e,t){let n=!1;for(let o=0,i=t.length-1;o<t.length;i=o++){let r=t[o],a=t[i];r.y>e.y!=a.y>e.y&&e.x<(a.x-r.x)*(e.y-r.y)/(a.y-r.y)+r.x&&(n=!n)}return n}function Ih(e){return{kind:"radial",rowCount:0,rows:[],nearestRow:()=>-1,depthAt:(t,n)=>Math.hypot(t-e.x,n-e.y),gradientAt:(t,n)=>{let o=t-e.x,i=n-e.y,r=Math.hypot(o,i);return r<1e-9?[0,0]:[o/r,i/r]}}}function Rh(e,t){if(!e.length)return null;let n=0,o=0,i=0;for(let d of e)n+=d.x,o+=d.y,i+=Math.hypot(d.x-t.x,d.y-t.y);let r=e.length;n/=r,o/=r,i/=r;let a=e[0],s=-1;for(let d of e){let h=Math.hypot(d.x-n,d.y-o);h>s&&(s=h,a=d)}let c=a.x-n,l=a.y-o,u=Math.hypot(c,l);u>1e-9?(c/=u,l/=u):(c=1,l=0);let m=[...e].sort((d,h)=>(d.x-n)*c+(d.y-o)*l-((h.x-n)*c+(h.y-o)*l)),f=0;for(let d of m){let h=Math.hypot(d.x-n,d.y-o);h>f&&(f=h)}return{pts:m,cx:n,cy:o,radius:f,depth:i}}function $s(e,t,n){let o=e.pts;if(o.length===1)return Math.hypot(t-o[0].x,n-o[0].y);let i=1/0;for(let r=0;r+1<o.length;r++){let a=o[r],s=o[r+1],c=s.x-a.x,l=s.y-a.y,u=c*c+l*l,m=u>1e-12?((t-a.x)*c+(n-a.y)*l)/u:0;m<0?m=0:m>1&&(m=1);let f=Math.hypot(t-(a.x+m*c),n-(a.y+m*l));f<i&&(i=f)}return i}var wo=8;function Eh(e,t,n){let o=new Array(wo).fill(1/0),i=new Array(wo).fill(-1);for(let u=0;u<e.length;u++){let m=e[u],f=Math.hypot(t-m.cx,n-m.cy)-m.radius;for(let d=0;d<wo;d++)if(f<o[d]){for(let h=wo-1;h>d;h--)o[h]=o[h-1],i[h]=i[h-1];o[d]=f,i[d]=u;break}}let r=new Array(3).fill(1/0),a=new Array(3).fill(-1);for(let u of i){if(u<0)continue;let m=$s(e[u],t,n);for(let f=0;f<3;f++)if(m<r[f]){for(let d=2;d>f;d--)r[d]=r[d-1],a[d]=a[d-1];r[f]=m,a[f]=u;break}}if(a[0]<0)return 0;if(r[0]<1e-6)return e[a[0]].depth;let s=r[0]*2.2,c=0,l=0;for(let u=0;u<3;u++){let m=a[u];if(m<0||r[u]>s)continue;let f=1/(r[u]*r[u]);c+=f*e[m].depth,l+=f}return l>0?c/l:e[a[0]].depth}function Ch(e){let t=(o,i)=>Eh(e,o,i),n=(o,i)=>{let r=1/0,a=-1;for(let s=0;s<e.length;s++){let c=e[s];if(Math.hypot(o-c.cx,i-c.cy)-c.radius>=r)continue;let l=$s(c,o,i);l<r&&(r=l,a=s)}return a};return{kind:"rows",rowCount:e.length,rows:e,nearestRow:n,depthAt:t,gradientAt:(o,i)=>{let r=(t(o+.5,i)-t(o-.5,i))/1,a=(t(o,i+.5)-t(o,i-.5))/(2*.5),s=Math.hypot(r,a);return s<1e-9?[0,0]:[r/s,a/s]}}}function qs(e,t){let n=[];for(let o of e){let i=Rh(o.points,t);i&&n.push(i)}return n.length<2?Ih(t):(n.sort((o,i)=>o.depth-i.depth),Ch(n))}var St=.06,_h=.05,Qs=.05,Zs=.15,Ur=25;function Js(e,t,n){let o=new Map,i=new Array(t.length).fill(null),r=new Float64Array(t.length),a=new Array(t.length).fill(void 0),s=new Array(t.length).fill(void 0),c=new Map,l=[],u=new Set;for(let f=0;f<e.length;f+=1){let d=e[f];for(let h of d.objects){if(h.type==="table"&&u.add(h.id),h.type!=="section"||!h.outline||h.outline.length<3)continue;let p=Ze(h.outline,We);c.set(h.id,{section:h,unit:d,frontU:1/0,hasSeats:!1,rows:new Map,seatIndices:[]}),l.push({id:h.id,floorIndex:f,box:ft(p),section:h,unit:d,outline:p})}}let m=new Map;for(let f of l){let d=m.get(f.floorIndex);d?d.push(f):m.set(f.floorIndex,[f])}for(let f=0;f<t.length;f++){let d=t[f],h=n?m.get(n[f])??[]:l,p=d.sectionId?h.find(y=>y.id===d.sectionId)??h.find(y=>y.section.logicalSectionId===d.sectionId&&Le({x:d.x,y:d.y},y.outline,y.section.holes)):void 0,b=p?[p]:h;for(let y of b){if(n&&y.floorIndex!==n[f]||!p&&(d.x<y.box.minX||d.x>y.box.maxX||d.y<y.box.minY||d.y>y.box.maxY||!Le({x:d.x,y:d.y},y.outline,y.section.holes)))continue;i[f]=y.id;let x=c.get(y.id);x.hasSeats=!0;let S=d.focalPoint??y.unit.focal,A=Math.hypot(d.x-S.x,d.y-S.y);A<x.frontU&&(x.frontU=A),x.seatIndices.push(f);let M=d.rowId||`__seat-${f}`,g=x.rows.get(M);g?g.push({x:d.x,y:d.y}):x.rows.set(M,[{x:d.x,y:d.y}]);break}}for(let[f,d]of c){let h=yt(d.section,{floorBaseHeightM:d.unit.baseHeightM}),p=d.unit.baseHeightM,b=h.rake>0?Math.tan(h.rake*Math.PI/180):0,y=h.rake<=.01&&h.height<=p+.001,x=d.section.surfaceKind,S=x==="flat"?!0:x==="rakedRows"&&h.rake>.01?!1:y,A=d.hasSeats?bo(f,t,d.seatIndices,d.unit.focal):{sectionId:f,rows:[],blockCount:0},g=A.rows.length<2?qs([...d.rows.values()].map(O=>({points:O})),d.unit.focal):null,P=1/0;if(g){if(d.hasSeats)for(let O of d.rows.values())for(let H of O){let j=g.depthAt(H.x,H.y);j<P&&(P=j)}if(!d.hasSeats||!Number.isFinite(P)){P=1/0;for(let O of d.section.outline){let H=g.depthAt(O.x,O.y);H<P&&(P=H)}}}let v=p+_h,w=Math.max(v,h.height),R=O=>{let H=Math.max(0,O-P)*fe,j=Math.min(H*b,Ur);return Math.max(v,h.height+j)},_=O=>{let H=Math.max(0,O)*fe,j=Math.min(H*b,Ur);return Math.max(v,h.height+j)},F=S?[]:A.rows.map(O=>({pts:O.pts,y:_(O.blockDepth),depth:O.blockDepth,blockId:O.blockId,...u.has(O.id)?{patch:Os(O.pts,We)}:{}})),E=F.length?F[0].y:w,I=F.map(O=>{let H=O.patch&&O.patch.length>=3?O.patch:O.pts,j=0,N=0;for(let D of H)j+=D.x,N+=D.y;let k=H.length||1;j/=k,N/=k;let B=0;for(let D of H){let G=Math.hypot(D.x-j,D.y-N);G>B&&(B=G)}return{cx:j,cy:N,rad:B}}),T=S?()=>w:F.length>=2?(O,H)=>{let j=1/0,N=E;for(let k=0;k<F.length;k++){let B=I[k];if(Math.hypot(O-B.cx,H-B.cy)-B.rad>=j)continue;let D=F[k].patch,G=D&&D.length>=3?Ge(D,O,H)?0:$t(D,O,H):$t(F[k].pts,O,H);G<j&&(j=G,N=F[k].y)}return N}:(O,H)=>g?R(g.depthAt(O,H)):w,L=[0,1,0],V=F.length>=2||S?()=>L:(O,H)=>{if(!g)return L;let j=g.depthAt(O,H);if(j<=P)return L;let N=(j-P)*fe;if(N*b>=Ur||h.height+N*b<=v)return L;let[k,B]=g.gradientAt(O,H);if(k===0&&B===0)return L;let D=1/Math.hypot(b,1);return[-k*b*D,D,-B*b*D]};if(!S)for(let O of A.rows){let H=_(O.blockDepth);for(let j of O.seatIndices)a[j]=H}for(let O of A.rows){let H=[];for(let D=1;D<O.pts.length;D++){let G=Math.hypot(O.pts[D].x-O.pts[D-1].x,O.pts[D].y-O.pts[D-1].y);G>1e-6&&H.push(G)}H.sort((D,G)=>D-G);let j=H.length?H[Math.floor(H.length/2)]:1/0,N=1/0,k=O.pts[Math.floor(O.pts.length/2)];if(k)for(let D of A.rows){if(D===O||D.blockId!==O.blockId)continue;let G=$t(D.pts,k.x,k.y);G>1e-6&&G<N&&(N=G)}let B=Math.min(j,Math.max(N,j*.5));if(Number.isFinite(B)&&B>0)for(let D of O.seatIndices)s[D]=B}o.set(f,{sectionId:f,deckAt:T,normalAt:V,flat:S,bottomY:p,rowLevels:F,landingY:E})}for(let f=0;f<t.length;f++){let d=i[f],h=t[f];if(d){let y=a[f];r[f]=(y??o.get(d).deckAt(h.x,h.y))+Zs;continue}let p=h.eyeHeightM,b=Number.isFinite(p)?Math.max(0,p-ot):0;r[f]=h.kind==="booth"?b+St+Zs:b}return{bySection:o,seatOwner:i,seatDeckY:f=>r[f],seatPitchU:f=>s[f]}}function tn(e,t,n){if(e.length!==4||n<=t)return null;let o=He(e),i=Math.hypot(o[1].x-o[0].x,o[1].y-o[0].y)*C,r=Math.hypot(o[3].x-o[0].x,o[3].y-o[0].y)*C;if(i<1e-6||r<1e-6)return null;let a=Math.min(.22/i,.16),s=Math.min(.28,(n-t)*.13),c=Math.min(.065/r,.2);return{quad:o,side:a,face:c,opening:Oe(o,a,1-a),openingTop:n-s}}function jr(e,t,n){if(e.length!==4||n-t<=.2)return null;let o=He(e),i=Math.hypot(o[1].x-o[0].x,o[1].y-o[0].y)*C;if(i<=1e-6)return null;let r=Math.min(.14,(n-t)*.08,i*.08),a=r/i,s=Oe(o,a,1-a);return{quad:o,side:a,trim:r,inner:s,panel:Dn(s,.15,.85),bottom:t+r,top:n-r}}function ec(e,t,n,o){let i=jr(e,t,n);if(!i)return;let{panel:r}=i,a=(x,S)=>({x:(x.x+S.x)/2,y:(x.y+S.y)/2}),s=a(r[0],r[1]),c=a(r[3],r[2]),l=Math.hypot(s.x-o.x,s.y-o.y)<=Math.hypot(c.x-o.x,c.y-o.y),[u,m]=l?[r[0],r[1]]:[r[3],r[2]],f=l?{x:s.x-c.x,y:s.y-c.y}:{x:c.x-s.x,y:c.y-s.y},d=Math.hypot(f.x,f.y);if(d<1e-6)return;-(m.y-u.y)*f.x+(m.x-u.x)*f.y<0&&([u,m]=[m,u]);let h=Math.min(.006,d*C*.05),p=f.x/d*h,b=f.y/d*h,y=(x,S)=>[x.x*C+p,S,x.y*C+b];return[y(u,i.bottom),y(m,i.bottom),y(u,i.top),y(m,i.top)]}var nc=nt(require("polygon-clipping"),1);var tc=nt(require("polygon-clipping"),1);function dt(e,t,n,o,i,r,a,s={}){let c=ft(t),l=s.ao??ae,u=i.flatMap(p=>{if(p.role!=="entrance"&&p.role!=="exit")return[];let b=ge(p);if(!b||b.length!==4||!Qt(c,ft(b)))return[];let y=s.portalBase??n,x=tn(b,y,y+Qe(p).heightM);if(!x)return[];let S=Math.min(o,x.openingTop);return S<=n?[]:[{poly:x.opening,height:S}]});if(!u.length)return!1;let m=p=>p.map(b=>[b.x,b.y]),f=[m(t),...(s.holes??[]).map(m)],d=[n,...new Set(u.map(p=>p.height)),o].sort((p,b)=>p-b),h=[];try{for(let p=1;p<d.length;p++){let b=d[p-1],y=d[p];if(y-b<1e-6)continue;let x=u.filter(A=>A.height>b+1e-6).map(A=>[m(A.poly)]),S=x.length?tc.default.difference(f,...x):[f];h.push({low:b,high:y,polys:S})}}catch{return!1}for(let p of h)for(let b of p.polys){let[y,...x]=b.map(A=>A.map(([M,g])=>({x:M,y:g}))),S=A=>l.wallBottom+(l.top-l.wallBottom)*(A-n)/(o-n);ue(e,y,x,()=>p.high,p.low,r,a,{...l,top:S(p.high),wallBottom:S(p.low)})}return!0}var Wr={depthM:1.6,thicknessM:.35,minWallM:6};function Po(e,t,n,o,i,r,a,s,c){let l=o-n;if(l<=0)return;let u=s&&(c??l)>=Wr.minWallM?Th(t,s):null,m=u?o-Wr.thicknessM:o,f=m-n,d=f<1.5?[[n,m,1]]:u?[[n,n+Math.min(.9,f*.18),.82],[n+Math.min(.9,f*.18),m,1]]:[[n,n+Math.min(.9,f*.18),.82],[n+Math.min(.9,f*.18),m-.1,1],[m-.1,m,1.1]],h=p=>ae.wallBottom+(ae.top-ae.wallBottom)*(p-n)/l;for(let[p,b,y]of d){let x={...ae,top:h(b),wallBottom:h(p)},S=le(r,y),A=le(a,y);dt(e,t,p,b,i,S,A,{portalBase:n,ao:x})||ue(e,t,void 0,()=>b,p,S,A,x)}for(let[p,...b]of u??[])ue(e,p,b.length?b:void 0,()=>o,m,le(r,1.12),le(a,.78),ae)}function Th(e,t){let n=Wr.depthM/C,o=e.map(a=>{let s=t.x-a.x,c=t.y-a.y,l=Math.hypot(s,c)||1;return{x:a.x+s/l*n,y:a.y+c/l*n}}),i=a=>{let s=a.map(c=>[c.x,c.y]);return s.push(s[0]),s},r=[[i(e)],[i(o)]];for(let a=0;a<e.length;a++){let s=(a+1)%e.length;r.push([i([e[a],e[s],o[s],o[a]])])}try{let[a,...s]=r,c=nc.default.union(a,...s);return c.length?c.map(l=>l.map(u=>u.slice(0,-1).map(([m,f])=>({x:m,y:f})))):null}catch{return null}}function Nn(e,t,n){let o=he(t.stroke?.color),i=t.stroke?.width??0;if(!o||!Number.isFinite(i)||i<=0)return;let r=t.kind==="line"||t.kind==="polyline",a=r?Mo(t.points??[],t.rotation):ge(t);if(!a||a.length<2)return;let s=r?a.length-1:a.length,c=i*.5;for(let l=0;l<s;l++){let u=a[l],m=a[(l+1)%a.length],f=Math.hypot(m.x-u.x,m.y-u.y);if(f<1e-6)continue;let d=-(m.y-u.y)/f*c,h=(m.x-u.x)/f*c,p=[(u.x+d)*C,n,(u.y+h)*C],b=[(m.x+d)*C,n,(m.y+h)*C],y=[(m.x-d)*C,n,(m.y-h)*C],x=[(u.x-d)*C,n,(u.y-h)*C];e.tri(p,b,y,[0,1,0],o),e.tri(p,y,x,[0,1,0],o)}}function oc(e){return e==="bar"||e==="concession"||e==="coat"||e==="restroom"}var nn=(e,t,n)=>({x:e.x+(t.x-e.x)*n,y:e.y+(t.y-e.y)*n});function Ao(e,t,n,o){let[i,r,a,s]=t?e:[e[3],e[2],e[1],e[0]];return[nn(i,s,n),nn(r,a,n),nn(r,a,o),nn(i,s,o)]}function rc(e,t,n,o,i,r,a,s,c=!1){if(n.length!==4||i-o<.4)return!1;let l=v=>c?Math.min(v,i):v,u=He(n),m=Math.hypot(u[3].x-u[0].x,u[3].y-u[0].y)*C;if(m<.4)return!1;let f=nn(u[0],u[1],.5),d=nn(u[3],u[2],.5),h=Math.hypot(f.x-s.x,f.y-s.y)<=Math.hypot(d.x-s.x,d.y-s.y),p=be(a,[.92,.9,.86],.35),b=le(r,.72),y=i-o;if(t==="restroom"){let v=Math.min(.18,y*.08);return de(e,u,i-v,o,a,r),de(e,u,i,i-v,p,p),!0}let x=o+Math.min(1.1,y),S=t==="coat"?1:Math.min(.5,.75/m),A=Ao(u,h,0,S);if(de(e,A,x-.05,o,b,r),de(e,A,x,x-.05,p,p),t==="coat"||m<1.2)return!0;if(t==="bar"){let v=Ao(u,h,Math.max(S+.2,1-.45/m),1),w=l(o+Math.max(Math.min(2.2,y*2),x-o+.6));return de(e,v,w,o,a,b),!0}let M=Ao(u,h,Math.max(S+.25,.55),1),g=l(o+Math.max(2.6,x-o+1.4));if(g-.14<=x)return!0;de(e,M,g-.14,o,a,r),de(e,u,g,g-.14,p,b);let P=Math.min(.08,.1/Math.max(.1,Math.hypot(u[1].x-u[0].x,u[1].y-u[0].y)*C));for(let[v,w]of[[0,P],[1-P,1]])de(e,Ao(Oe(u,v,w),h,0,Math.min(.08,.1/m)),g-.14,x,b,b);return!0}var kh=[.12,.38,.16],Lh=[.72,.62,.45],Oh=[.88,.93,.96],ic=[.95,.95,.94],Fh=[.66,.29,.22],Xr={length:20.12,width:3.05},Dh=.14,Nh=9.76,ht=[.93,.94,.95],Io=[.1,.11,.13],Bh=[.45,.85,1.25],Vh=1.45,ac=.012,sc=.004,Gh=1.07,Hh=.15;function rn(e,t,n,o,i,r){e.setMaterial(r),ue(e,t,n?[n.slice().reverse()]:void 0,()=>o,o-.004,i,i,ae)}var cc=(e,t)=>gt(e,t/C);function lc(e,t,n){let o=t.x-e.x,i=t.y-e.y,r=Math.hypot(o,i);if(r<1e-9)return null;let a=-i/r*n,s=o/r*n;return[{x:e.x+a,y:e.y+s},{x:t.x+a,y:t.y+s},{x:t.x-a,y:t.y-s},{x:e.x-a,y:e.y-s}]}function zh(e,t,n,o){let i=t.map(r=>[r.x*C,n,r.y*C]);e.tri(i[0],i[1],i[2],[0,1,0],o),e.tri(i[0],i[2],i[3],[0,1,0],o)}function Ro(e,t,n,o,i,r){let a=n/C,s=[{x:t.x-a,y:t.y-a},{x:t.x+a,y:t.y-a},{x:t.x+a,y:t.y+a},{x:t.x-a,y:t.y+a}];ue(e,s,void 0,()=>i,o,r,le(r,.85),ae)}function on(e,t,n,o,i,r,a){let s=lc(t,n,o/C);s&&ue(e,s,void 0,()=>r,i,a,le(a,.85),ae)}function Eo(e){let t=He(e),n={x:(t[0].x+t[2].x)/2,y:(t[0].y+t[2].y)/2},o=Math.hypot(t[1].x-t[0].x,t[1].y-t[0].y)||1,i=Math.hypot(t[3].x-t[0].x,t[3].y-t[0].y)||1,r={x:(t[1].x-t[0].x)/o,y:(t[1].y-t[0].y)/o},a={x:(t[3].x-t[0].x)/i,y:(t[3].y-t[0].y)/i};return{at:(c,l)=>({x:n.x+(r.x*c+a.x*l)/C,y:n.y+(r.y*c+a.y*l)/C}),lengthM:o*C,widthM:i*C}}function uc(e,t,n){let o=Ja(t);if(!o.length)return;let i=1/0,r=-1/0,a=1/0,s=-1/0;for(let S of t.points??[])i=Math.min(i,S.x),r=Math.max(r,S.x),a=Math.min(a,S.y),s=Math.max(s,S.y);let c=(t.rotation??0)*Math.PI/180,l=Math.cos(c),u=Math.sin(c),m=(i+r)/2,f=(a+s)/2,d=S=>c?{x:m+(S.x-m)*l-(S.y-f)*u,y:f+(S.x-m)*u+(S.y-f)*l}:S,h=Math.min(r-i,s-a)*C,p=Math.max(.04,Math.min(.3,h*.004))/C,b=0;e.setMaterial(0);for(let S of o){if(!S.fill)continue;let A=S.points.map(d);rn(e,A,null,n+ac+b*sc,he(S.fill)??ht,0),b++}let y=o.filter(S=>!(S.fill&&S.ink===S.fill)),x=[...new Set(y.map(S=>S.ink??ho))];for(let S of x){let A=n+ac+b++*sc,M=he(S)??ht;for(let g of y){if((g.ink??ho)!==S)continue;let P=g.points.map(d),v=g.closed?P.length:P.length-1;for(let w=0;w<v;w++){let R=lc(P[w],P[(w+1)%P.length],p);R&&zh(e,R,A,M)}}}}function mc(e,t,n,o,i){if(t.length<3)return!1;let r=o+.006,a=i??kh;if(n==="oval-cricket"){let s=t.reduce((M,g)=>M+g.x,0)/t.length,c=t.reduce((M,g)=>M+g.y,0)/t.length,l=M=>t.map(g=>({x:s+(g.x-s)*M,y:c+(g.y-c)*M})),u=8;for(let M=0;M<u;M++){let g=l(1-M/u),P=M===u-1?null:l(1-(M+1)/u);rn(e,g,P,r,le(a,M%2?1.04:.96),4)}let m=t[0];for(let M of t)Math.hypot(M.x-s,M.y-c)>Math.hypot(m.x-s,m.y-c)&&(m=M);let f=Math.hypot(m.x-s,m.y-c)||1,d=(m.x-s)/f,h=(m.y-c)/f,p=-h,b=d,y=Math.min(1,2*f*C*Dh/Xr.length),x=Xr.length*y/2/C,S=Xr.width*y/2/C,A=[[-x,-S],[x,-S],[x,S],[-x,S]].map(([M,g])=>({x:s+d*M+p*g,y:c+h*M+b*g}));return rn(e,A,null,r+.004,Lh,0),e.setMaterial(0),!0}if(n==="rink-hockey"){let s=cc(t,Hh);return rn(e,s,null,r,Oh,0),e.setMaterial(0),ue(e,t,[s.slice().reverse()],()=>o+Gh,o,ic,le(ic,.9),ae),!0}if(n==="ring-boxing"&&t.length===4){let{at:s}=Eo(t),c=[s(-3.05,-3.05),s(3.05,-3.05),s(3.05,3.05),s(-3.05,3.05)],l=[[.77,.19,.19],ht,[.17,.42,.69],ht];e.setMaterial(0),c.forEach((u,m)=>Ro(e,u,.07,o,o+Vh,l[m]));for(let u of Bh)for(let m=0;m<4;m++)on(e,c[m],c[(m+1)%4],.025,o+u-.025,o+u+.025,ht);return!0}if(n==="court-tennis"&&t.length===4){let{at:s}=Eo(t);e.setMaterial(0),on(e,s(0,-6.4),s(0,6.4),.015,o,o+.95,Io),on(e,s(0,-6.4),s(0,6.4),.03,o+.95,o+1,ht);for(let c of[-1,1])Ro(e,s(0,c*6.4),.05,o,o+1.07,Io);return!0}if(n==="court-basketball"&&t.length===4){let{at:s,lengthM:c}=Eo(t),l=Math.min(14,c/2-.5);e.setMaterial(0);for(let u of[-1,1]){let m=s(u*(l+1.2),0),f=s(u*(l-1.2),0);Ro(e,m,.12,o,o+3.4,Io),on(e,m,f,.06,o+3.25,o+3.4,Io),on(e,s(u*(l-1.2),-.9),s(u*(l-1.2),.9),.03,o+2.9,o+3.95,ht)}return!0}if(n==="pitch-rugby"&&t.length===4){let{at:s,lengthM:c}=Eo(t),l=c*(50/120);e.setMaterial(0);for(let u of[-1,1]){for(let m of[-2.8,2.8])Ro(e,s(u*l,m),.07,o,o+12,ht);on(e,s(u*l,-2.8),s(u*l,2.8),.06,o+2.94,o+3.06,ht)}return!0}if(n==="track-athletics"){let s=cc(t,Nh);return s.length<3?!1:(rn(e,t,s,r,Fh,0),rn(e,s,null,r,a,4),e.setMaterial(0),!0)}return!1}var fc=[.19,.4,.15],Uh=.012,ko=2.4,jh=1,Wh=.75,Xh=.15;function Je(e){if(e.points&&e.points.length>=3)return e.points;let{center:t,width:n,height:o,rotation:i}=e;if(!n||!o)return null;let r=(i??0)*Math.PI/180,a=Math.cos(r),s=Math.sin(r),c=n/2,l=o/2;return[[-c,-l],[c,-l],[c,l],[-c,l]].map(([u,m])=>({x:t.x+u*a-m*s,y:t.y+u*s+m*a}))}function gc(e,t,n,o,i,r,a=!1){let s=Je(t);if(s){if(a){let c=Bt(o,i.boothTop),l=rt([...s]);ue(e,Ze(l,Yh/C),[l.slice().reverse()],()=>n+.03,n,c,le(c,.8),ae);return}if(!(!t.points&&r&&$h(e,s,n,o,r))){if(!t.points&&r&&s.length===4){Kh(e,s,n,o,r);return}ue(e,s,void 0,()=>n+ko,n,Bt(o,i.boothTop),i.boothWall,ae)}}}var Yr=1.1,dc=[.9,.9,.88],Yh=.1,Co=[.87,.87,.85],hc=.08;function xc(e,t){let n=c=>({x:(e[c].x+e[(c+1)%4].x)/2,y:(e[c].y+e[(c+1)%4].y)/2}),o=0,i=1/0;for(let c=0;c<4;c++){let l=n(c),u=Math.hypot(l.x-t.x,l.y-t.y);u<i&&(i=u,o=c)}let r=[0,1,2,3].map(c=>e[(o+c)%4]),a=(c,l,u)=>({x:c.x+(l.x-c.x)*u,y:c.y+(l.y-c.y)*u});return{q:r,part:(c,l,u,m)=>{let f=a(r[0],r[1],c),d=a(r[0],r[1],l),h=a(r[3],r[2],c),p=a(r[3],r[2],l);return[a(f,h,u),a(d,p,u),a(d,p,m),a(f,h,m)]},depthM:Math.hypot(r[3].x-r[0].x,r[3].y-r[0].y)*C,widthM:Math.hypot(r[1].x-r[0].x,r[1].y-r[0].y)*C}}function Kh(e,t,n,o,i){let{q:r,part:a}=xc(t,i),s=o??[.35,.42,.55],c=be(s,[.78,.78,.77],.62),l=be(s,[.95,.95,.94],.45);de(e,r,n+St,n,c,le(c,.8)),de(e,a(.05,.95,.72,.98),n+Yr-.05,n+St,l,le(l,.8)),de(e,a(.03,.97,.7,1),n+Yr,n+Yr-.05,dc,le(dc,.9))}function $h(e,t,n,o,i){if(t.length!==4)return!1;let{q:r,part:a,depthM:s,widthM:c}=xc(t,i);if(s<1||c<1)return!1;let l=o??[.35,.42,.55],u=be(l,[.78,.78,.77],.62),m=n+ko,f=hc/c,d=hc/s;de(e,r,n+St,n,u,le(u,.8)),de(e,a(0,1,1-d,1),m,n+St,Co,le(Co,.9));for(let[b,y]of[[0,f],[1-f,1]])de(e,a(b,y,0,1-d),m,n+St,Co,le(Co,.9));de(e,a(f,1-f,0,Math.min(.5,.06/s)),m,m-.3,l,le(l,.85));let h=Math.min(.4,.6/c),p=Math.min(.12,.3/s);return de(e,a(.5-h,.5+h,.72-p,.72+p),n+jh,n+St,be(l,[.95,.95,.94],.7),le(l,.75)),!0}function Lo(e){if(e.shape==="round"){let u=e.radius;return u?uo(e.center.x,e.center.y,u,u,24):null}let{width:t,height:n,rotation:o,center:i}=e;if(!t||!n)return null;let r=(o??0)*Math.PI/180,a=Math.cos(r),s=Math.sin(r),c=t/2,l=n/2;return[[-c,-l],[c,-l],[c,l],[-c,l]].map(([u,m])=>({x:i.x+u*a-m*s,y:i.y+u*s+m*a}))}function vc(e,t,n,o,i,r=!0){let a=Lo(t);if(!a)return;let s=a.reduce((f,d)=>f+d.x,0)/a.length,c=a.reduce((f,d)=>f+d.y,0)/a.length,l=f=>a.map(d=>({x:s+(d.x-s)*f,y:c+(d.y-c)*f})),u=r&&o?Bt(o,i.tableTop):qh,m=n+Wh;ue(e,a,void 0,()=>m,n+Zh,u,le(u,.86),ae),ue(e,l(.12),void 0,()=>m+.12,m,pc,le(pc,.8),ae)}var qh=[.93,.92,.89],pc=[.78,.66,.42],Zh=.25,Bn={armM:1.1,widthM:.28,insideM:1.4,low:.043,high:.048};function Qh(e,t,n){let o=e.reduce((y,x)=>y+x.x,0)/4,i=e.reduce((y,x)=>y+x.y,0)/4,r=e[3].x-e[0].x,a=e[3].y-e[0].y,s=Math.hypot(r,a)||1;r/=s,a/=s,r*(t.x-o)+a*(t.y-i)<0&&(r=-r,a=-a);let c=-a,l=r,u=Bn.armM/C,m=Bn.widthM/C,f=s/2+Bn.insideM/C,d=n?-1:1,h=o+r*(f+(n?0:u)),p=i+a*(f+(n?0:u)),b=(y,x)=>({x:h+r*y*d+c*x,y:p+a*y*d+l*x});return[b(0,0),b(-u,u),b(-u-m,u),b(-m,0),b(-u-m,-u),b(-u,-u)]}function Jh(e,t,n,o,i){let r=[.94,.95,.96];ue(e,Qh(t,o,i),void 0,()=>n+Bn.high,n+Bn.low,r,r,ae)}function To(e,t){let n=he(e);return n?{top:le(qe(n,.12),.95),wall:le(qe(n,.12),.85)}:{top:t.tierTop,wall:t.tierWall}}function Mc(e,t,n,o,i,r,a,s,c=[]){let l=ge(t);if(!t.role&&(!t.fill||t.fill==="none"||t.fill==="transparent")||!l){Nn(e,t,n+o+Uh);return}let m=s?s.kind==="stage":t.role==="stage",f=s?s.kind==="screen":t.role==="screen",d=s?{kind:m?"stage":"solid",heightM:s.topY-s.baseY}:Qe(t),h=s?.baseY??n,p=s?.topY??n+o;if(m&&a){let v=1/0,w=-1/0,R=1/0,_=-1/0;for(let F of l)F.x<v&&(v=F.x),F.x>w&&(w=F.x),F.y<R&&(R=F.y),F.y>_&&(_=F.y);a.push({cx:(v+w)/2*C,cz:(R+_)/2*C,y:p,halfX:Math.max((w-v)/2*C,.5),halfZ:Math.max((_-R)/2*C,.5)})}let b=he(t.fill),y=t.role==="wall"||t.role==="entrance"||t.role==="exit",x=y?To(t.fill,i).top:m&&b?be(i.stageTop,le(qe(b,.18),.9),.9):!t.role&&b?b:Bt(b,m?i.stageTop:i.decorTop),S=f?b:null,A=y?To(t.fill,i).wall:m?b?be(i.stageWall,le(b,.58),.82):i.stageWall:f?S?be(le(S,1.42),[.24,.46,.82],.08):[.24,.46,.82]:Bt(he(t.fill),i.decorWall);if(t.role==="wall"&&!s){Po(e,l,h,p,c,x,A,r),Nn(e,t,p+.012);return}if(f&&l.length===4&&p-h>.2){let v=jr(l,h,p);if(!v)return;let{quad:w,side:R,trim:_,inner:F,panel:E}=v,I=[.12,.15,.18];for(let[T,L]of[[0,R],[1-R,1]])de(e,Oe(w,T,L),p,h,I,I);de(e,F,h+_,h,I,I),de(e,F,p,p-_,I,I),de(e,E,p-_,h+_,A,A),Nn(e,t,p+.012);return}let M=b?le(qe(b,.15),.82):A,g=b?le(qe(b,.1),1.02):x;if(oc(t.role)&&!s&&rc(e,t.role,l,h,p,M,g,r,t.heightM!==void 0))return;if((t.role==="sound"||s?.kind==="sound_desk")&&l.length===4&&p-h>.3){let v=He(l),w=Math.hypot(v[1].x-v[0].x,v[1].y-v[0].y)*C,R=Math.min(.12,.09/Math.max(w,.001)),_=[.18,.21,.24],F=p-Math.min(.12,(p-h)*.15);for(let[E,I]of[[0,R],[1-R,1]])de(e,Oe(v,E,I),F,h,_,_);de(e,v,p,F,x,_);return}if(t.role==="rail"&&l.length===4&&p>h){let v=He(l),w=Math.hypot(v[1].x-v[0].x,v[1].y-v[0].y)*C,R=Math.max(1,Math.min(128,Math.ceil(w/1.4))),_=Math.min(.08,.055/Math.max(.055,w)),F=[.58,.64,.66];for(let E=0;E<=R;E++){let I=E/R,T=Math.min(1-_,Math.max(0,I-_/2));de(e,Oe(v,T,T+_),p,h,F,le(F,.8))}for(let E of[.52,1]){let I=h+(p-h)*E;de(e,v,I,Math.max(h,I-.055),F,le(F,.8))}return}if(t.role==="goal"&&l.length===4){let v=He(l),w=Math.hypot(v[1].x-v[0].x,v[1].y-v[0].y)*C,R=Math.min(.12,.1/Math.max(.1,w)),_=[.9,.94,.94];for(let[F,E]of[[0,R],[1-R,1]])de(e,Oe(v,F,E),Math.max(h,p-.1),h,_,_);de(e,v,p,Math.max(h,p-.1),_,_);return}if(d.kind==="portal"&&l.length===4){let v=tn(l,h,p);if(!v)return;let{quad:w,side:R,face:_,openingTop:F}=v;for(let[E,I,T]of[[0,_,1],[_,1-_,.67],[1-_,1,1]]){let L=Dn(w,E,I),V=le(x,T),O=le(A,T);for(let[H,j]of[[0,R],[1-R,1]])de(e,Oe(L,H,j),F,h,V,O);de(e,L,p,F,V,O)}(t.role==="entrance"||t.role==="exit")&&Jh(e,w,h,r,t.role==="exit");return}if(d.kind==="suite"&&l.length===4){let v=l.map((_,F)=>{let E=l[(F+1)%4],I=(_.x+E.x)/2,T=(_.y+E.y)/2;return Math.hypot(I-r.x,T-r.y)}),w=v.indexOf(Math.min(...v)),R=[0,1,2,3].map(_=>l[(w+_)%4]);de(e,Oe(R,0,.08),p,h,x,A),de(e,Oe(R,.92,1),p,h,x,A),de(e,Dn(R,.88,1),p,h,x,A),de(e,R,p,Math.max(h,p-.18),x,A);return}if(m&&!t.stageKind?.startsWith("pitch-")&&p-h>.12){let v=p-Math.min(.06,(p-h)*.15);de(e,l,v,h,x,A),de(e,l,p,v,x,be(x,A,.2))}else de(e,l,p,h,x,A);if((t.stageKind==="pitch-football"||t.stageKind==="pitch-rugby")&&l.length===4){e.setMaterial(4);let v=He(l),w=be(b??fc,fc,b?.45:0);for(let R=0;R<12;R++){let _=Oe(v,R/12,(R+1)/12),F=le(w,R%2?1.09:.91),E=_.map(I=>[I.x*C,p+.006,I.y*C]);e.tri(E[0],E[1],E[2],[0,1,0],F),e.tri(E[0],E[2],E[3],[0,1,0],F)}}t.stageKind&&t.stageKind!=="pitch-football"&&mc(e,l,t.stageKind,p,b),m&&Dt(t.stageKind)&&uc(e,t,p),e.setMaterial(f?1:0),Nn(e,t,p+.012)}function Oo(e){let{x:t,y:n,width:o,height:i}=e;if(!o||!i)return null;let r=t+o/2,a=n+i/2,s=(e.rotation??0)*Math.PI/180,c=Math.cos(s),l=Math.sin(s),u=o/2,m=i/2;return[[-u,-m],[u,-m],[u,m],[-u,m]].map(([f,d])=>({x:r+f*c-d*l,y:a+f*l+d*c}))}function ep(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 o=n[1].trim();if(o==="none"||o==="transparent")return null;let i=o.match(/^url\(#([^)]+)\)$/);if(!i)return he(o);let r=t.match(new RegExp(`<(?:linear|radial)Gradient\\b[^>]*\\bid="${i[1]}"[^>]*>([\\s\\S]*?)</(?:linear|radial)Gradient>`,"i"));if(!r)return null;let a=[];for(let s of r[1].matchAll(/stop-color="([^"]+)"/gi)){let c=he(s[1].trim());c&&a.push(c)}return a.length?a.reduce((s,c,l)=>be(s,c,1/(l+1)),a[0]):null}function Sc(e,t,n,o){if(t.layer==="foreground")return;let i=Oo(t);if(!i)return;let r=n+Xh,a=Bt(ep(t.href),o.decorTop),s=Math.max(0,Math.min(1,t.opacity??1));s<1&&(a=be(o.ground,a,s)),ue(e,i,void 0,()=>r,n,a,be(a,o.decorWall,.5),ae)}function wc(e,t,n,o,i){if(!t.points||t.points.length<3)return;let r=Is(o,i.gaTop);ue(e,t.points,t.holes,()=>n+bc,n,r,i.gaWall,ae),op(e,t.points,n+bc)}var bc=.15,_o=[.72,.74,.76],Kr=1.1,yc=.12,$r=.05,tp=.06,np=2.4;function op(e,t,n){let o=rt([...t]),i=gt(o,yc/C),r=gt(o,(yc+$r)/C);if(i.length<3||r.length<3)return;for(let s of[n+Kr,n+Kr*.5])ue(e,i,[r.slice().reverse()],()=>s,s-$r,_o,le(_o,.85),ae);let a=tp/2/C;for(let s=0;s<i.length;s++){let c=i[s],l=i[(s+1)%i.length],u=Math.hypot(l.x-c.x,l.y-c.y)*C,m=Math.max(1,Math.round(u/np));for(let f=0;f<m;f++){let d=f/m,h=c.x+(l.x-c.x)*d,p=c.y+(l.y-c.y)*d,b=[{x:h-a,y:p-a},{x:h+a,y:p-a},{x:h+a,y:p+a},{x:h-a,y:p+a}];ue(e,b,void 0,()=>n+Kr-$r,n,_o,le(_o,.8),ae)}}}var qr=.6,Pc=3,rp=.25;function ip(e,t){if(Ge(t,e.x,e.y))return 0;let n=1/0;for(let o=0,i=t.length-1;o<t.length;i=o++){let r=t[i],a=t[o],s=a.x-r.x,c=a.y-r.y,l=s*s+c*c||1,u=Math.max(0,Math.min(1,((e.x-r.x)*s+(e.y-r.y)*c)/l));n=Math.min(n,Math.hypot(e.x-(r.x+u*s),e.y-(r.y+u*c)))}return n}function Ac(e,t){let n=e.map(a=>({booth:a,ring:Je(a)})).filter(a=>!!a.ring&&a.ring.length===4&&!a.booth.points),o=n.map(({ring:a})=>({minX:Math.min(...a.map(s=>s.x)),maxX:Math.max(...a.map(s=>s.x)),minY:Math.min(...a.map(s=>s.y)),maxY:Math.max(...a.map(s=>s.y))})),i=(Pc+qr)/C,r=new Map;return n.forEach(({booth:a,ring:s},c)=>{let l={x:s.reduce((d,h)=>d+h.x,0)/4,y:s.reduce((d,h)=>d+h.y,0)/4},u=[0,1,2,3].map(d=>{let h=s[d],p=s[(d+1)%4],b={x:(h.x+p.x)/2,y:(h.y+p.y)/2},y=b.x-l.x,x=b.y-l.y,S=Math.hypot(y,x)||1,A={x:b.x+y/S*qr/C,y:b.y+x/S*qr/C},M=Pc/C;return o.forEach((g,P)=>{P===c||A.x<g.minX-i||A.x>g.maxX+i||A.y<g.minY-i||A.y>g.maxY+i||(M=Math.min(M,ip(A,n[P].ring)))}),{open:M*C,toward:{x:b.x+y/S*10/C,y:b.y+x/S*10/C},focal:Math.hypot(b.x-t.x,b.y-t.y)}}),m=Math.max(...u.map(d=>d.open)),f=u.filter(d=>d.open>=m-rp).sort((d,h)=>d.focal-h.focal)[0];r.set(a.id,f.toward)}),r}var Ic=nt(require("polygon-clipping"),1);var ap=.45,sp=1500,cp=200;function Rc(e,t){if(e.role!=="stage"||Dt(e.stageKind))return e;let n=ge(e);if(!n||n.length<3||Math.abs(Ve(n))*C*C>sp)return e;let o=t.filter(a=>Ge(n,a.x,a.y));if(!o.length||o.length>cp)return e;let i=ap/C,r=o.map(a=>[[[a.x-i,a.y-i],[a.x+i,a.y-i],[a.x+i,a.y+i],[a.x-i,a.y+i],[a.x-i,a.y-i]]]);try{let a=Ic.default.difference([[...n.map(l=>[l.x,l.y]),[n[0].x,n[0].y]]],...r),s=null,c=0;for(let l of a){let u=l[0].slice(0,-1).map(([f,d])=>({x:f,y:d})),m=Math.abs(Ve(u));m>c&&(c=m,s=u)}return!s||s.length<3?e:{...e,kind:"polygon",points:s,rotation:0}}catch{return e}}var lp=Math.PI/180,Se=96,up=6,mp=60,fp=150,Ec=.2,dp=.35;function hp(e,t){let n=Math.atan2(t.x-e.x,t.y-e.y)/lp;return n<0?n+360:n}function Fo(e){if(!e.length)return NaN;let t=[...e].sort((n,o)=>n-o);return t[Math.floor(t.length/2)]}function Do(e,t,n=2){let o=e.length,i=new Float64Array(o);for(let r=0;r<o;r++){let a=0,s=0;for(let c=-n;c<=n;c++){let l=r+c;if(t)l=(l%o+o)%o;else if(l<0||l>=o)continue;a+=e[l],s++}i[r]=a/s}return i}function Cc(e,t){let n=e.filter(f=>f.rows.length>=1);if(n.length<1)return null;let o=[],i=0,r=0,a=0;for(let f of n)for(let d of f.rows){for(let h of d.pts)i+=h.x,r+=h.y,a++;if(d.pts.length>=4){let h=Lr(d.pts);h&&Number.isFinite(h.cx)&&Number.isFinite(h.cy)&&o.push({x:h.cx,y:h.cy})}}if(!a)return null;let s={x:i/a,y:r/a},c=s;if(o.length>=8){let f=Fo(o.map(y=>y.x)),d=Fo(o.map(y=>y.y)),h=0;for(let y of n)for(let x of y.rows)for(let S of x.pts){let A=Math.hypot(S.x-s.x,S.y-s.y);A>h&&(h=A)}let p=0,b=h*.2;for(let y of n)for(let x of y.rows)for(let S of x.pts)Math.hypot(S.x-f,S.y-d)<b&&p++;Math.hypot(f-s.x,d-s.y)<=h&&p/a<.01&&(c={x:f,y:d})}let l=[];for(let f of n){let d={sectionId:f.sectionId,rMin:1/0,rMax:-1/0,samples:[]};for(let h of f.rows)for(let p of h.pts){let b=Math.hypot(p.x-c.x,p.y-c.y),y=Math.min(Se-1,Math.floor(hp(c,p)/(360/Se)));d.samples.push({r:b,bin:y,levelM:h.levelM}),b<d.rMin&&(d.rMin=b),b>d.rMax&&(d.rMax=b)}d.samples.length&&l.push(d)}if(!l.length)return null;l.sort((f,d)=>f.rMin+f.rMax-(d.rMin+d.rMax));let u=[];for(let f of l){let d=!1;for(let h of u){let p=Math.min(f.rMax,h.rMax)-Math.max(f.rMin,h.rMin),b=Math.min(f.rMax-f.rMin,h.rMax-h.rMin);if(b>1e-9&&p>=dp*b){h.members.push(f),h.rMin=Math.min(h.rMin,f.rMin),h.rMax=Math.max(h.rMax,f.rMax),d=!0;break}}d||u.push({members:[f],rMin:f.rMin,rMax:f.rMax})}let m=[];for(let f of u){let d=new Array(Se).fill(null);for(let E of f.members)for(let I of E.samples){let T=d[I.bin];T||(T={samples:[]},d[I.bin]=T),T.samples.push({r:I.r,levelM:I.levelM})}let h=d.map(E=>!!E);if(!h.filter(Boolean).length)continue;let b=[],y=[];for(let E of d){if(!E)continue;let I=1/0,T=-1/0;for(let L of E.samples)L.r<I&&(I=L.r),L.r>T&&(T=L.r);b.push(I),y.push(T)}let x=Fo(b),S=Fo(y);if(!(x>=Ec*S)||!(S>0))continue;let A=[...b].sort((E,I)=>E-I);if(!(A[Math.floor(A.length*.1)]>=Ec*S))continue;let g=d.map(E=>{if(!E)return null;let I=[...E.samples].sort((k,B)=>k.r-B.r),T=I[0].r,L=I[I.length-1].r,V=I[0].levelM,O=-1/0;for(let k of I)k.levelM>O&&(O=k.levelM);let H=[];for(let k of I){let B={r:k.r,l:k.levelM};for(;H.length&&Math.abs(H[H.length-1].r-B.r)<1e-9;){if(H[H.length-1].l<=B.l){B.skip=!0;break}H.pop()}if(!B.skip){for(;H.length>=2;){let D=H[H.length-2],G=H[H.length-1];if((G.r-D.r)*(B.l-D.l)-(G.l-D.l)*(B.r-D.r)<=0)H.pop();else break}H.push(B)}}let j=H.map(k=>k.r),N=H.map(k=>k.l);return{inner:T,outer:L,front:V,top:O,profile:{rs:j,ls:N}}}),P=h.slice();for(let E=0;E<Se;E++){if(P[E])continue;let I=-1,T=-1,L=0;for(let U=1;U<=Se;U++){let q=(E-U+Se*2)%Se;if(P[q]){I=q;break}}for(let U=1;U<=Se;U++){let q=(E+U)%Se;if(P[q]){T=q,L=U;break}}if(I<0||T<0)continue;let V=0;for(let U=1;U<=Se;U++){let q=(E-U+Se*2)%Se;if(h[q]){V=U;break}}if(V-1+L>up)continue;let H=g[I],j=g[T],N=V/(V+L),k=H.inner+(j.inner-H.inner)*N,B=H.outer+(j.outer-H.outer)*N,D=H.front+(j.front-H.front)*N,G=H.top+(j.top-H.top)*N;g[E]={inner:k,outer:B,front:D,top:G,profile:{rs:[k,B],ls:[D,G]}}}for(let E=0;E<Se;E++)g[E]&&(P[E]=!0);let v=360/Se,w=[],R=P.filter(Boolean).length,_=[];if(R===Se)_.push({start:0,len:Se});else{let E=0;for(;P[E];)E=(E+1)%Se;let I=-1;for(let T=0;T<=Se;T++){let L=(E+T)%Se,V=T<Se&&P[L];if(V&&I<0)I=L;else if(!V&&I>=0){let O=(L-I+Se)%Se||Se;_.push({start:I,len:O}),I=-1}}}for(let E of _){if(E.len*v<mp&&E.len<Se)continue;let I=E.len===Se,T=new Float64Array(E.len),L=new Float64Array(E.len),V=new Float64Array(E.len),O=new Float64Array(E.len),H=[];for(let U=0;U<E.len;U++){let q=g[(E.start+U)%Se];T[U]=q.inner,L[U]=q.outer,V[U]=q.front,O[U]=q.top,H.push(q.profile??{rs:[q.inner,q.outer],ls:[q.front,q.top]})}let j=Do(T,I),N=Do(L,I),k=Do(V,I),B=Do(O,I);for(let U=0;U<E.len;U++)j[U]>T[U]&&(j[U]=T[U]),N[U]<L[U]&&(N[U]=L[U]),j[U]>N[U]-1e-6&&(j[U]=Math.max(0,N[U]-1e-6)),B[U]<k[U]&&(B[U]=k[U]);let D={startBin:E.start,binCount:E.len,closed:I,innerR:j,outerR:N,frontLevelM:k,topLevelM:B,profiles:H},G=(U,q,$)=>{let ee=H[U],Q=ee.rs,X=ee.ls;if(q<=Q[0]){X[0]>$&&(X[0]=$);return}if(q>=Q[Q.length-1]){X[X.length-1]>$&&(X[X.length-1]=$);return}for(let Y=0;Y+1<Q.length;Y++)if(q<=Q[Y+1]){X[Y]>$&&(X[Y]=$),X[Y+1]>$&&(X[Y+1]=$);return}};for(let U=0;U<E.len;U++){let q=d[(E.start+U)%Se];if(q)for(let $ of q.samples){G(U,$.r,$.levelM);let ee=I?(U-1+E.len)%E.len:U-1,Q=I?(U+1)%E.len:U+1;ee>=0&&G(ee,$.r,$.levelM),Q<E.len&&G(Q,$.r,$.levelM)}}w.push(D)}w.reduce((E,I)=>E+I.binCount*v,0)<fp||m.push({arcs:w,sectionIds:f.members.map(E=>E.sectionId),innerRMedian:x,outerRMedian:S})}if(!m.length)return null;if(m.sort((f,d)=>f.innerRMedian-d.innerRMedian),t){let f=m[m.length-1].outerRMedian;if(Math.hypot(t.x-c.x,t.y-c.y)>.9*f)return null}return{centre:c,binCount:Se,binStepDeg:360/Se,rings:m}}function _c(e,t,n,o){let i=e.binStepDeg,r=n/i-.5-t.startBin;r=(r%e.binCount+e.binCount)%e.binCount,r>t.binCount-1&&(t.closed?r=r-t.binCount<t.binCount-r?0:t.binCount-1:r=r-(t.binCount-1)<e.binCount-r?t.binCount-1:0);let a=Math.floor(r),s=t.closed?(a+1)%t.binCount:Math.min(t.binCount-1,a+1),c=r-a,l=u=>{let m=t.profiles[u],f=m.rs,d=m.ls;if(o<=f[0])return d[0];if(o>=f[f.length-1])return d[d.length-1];for(let h=0;h+1<f.length;h++)if(o<=f[h+1]){let p=f[h+1]-f[h],b=p>1e-9?(o-f[h])/p:0;return d[h]+(d[h+1]-d[h])*b}return d[d.length-1]};return l(a)*(1-c)+l(s)*c}function Zr(e,t,n,o,i,r,a,s,c,l=[],u=i){if(t.length!==n.length||t.length<2||r-i<1.5)return;let m=(p,b,y)=>{dt(e,p,b,y,l,a,s,{portalBase:u,ao:c})||ue(e,p,void 0,()=>y,b,a,s,c)},f=(p,b,y)=>({x:p.x+(b.x-p.x)*y,y:p.y+(b.y-p.y)*y}),d=o?t.length:t.length-1,h=0;for(let p=0;p<d;p++){let b=(p+1)%t.length,y=Math.hypot(n[b].x-n[p].x,n[b].y-n[p].y)*fe;if(y<1e-5)continue;let x=(g,P)=>[f(t[p],t[b],g),f(t[p],t[b],P),f(n[p],n[b],P),f(n[p],n[b],g)];m(x(0,1),i,i+.95),m(x(0,1),r-.22,r);let S=Math.ceil((h-.32)/6)*6,A=!1,M=!1;for(let g=S;g<h+y;g+=6){let P=Math.max(0,(g-h)/y),v=Math.min(1,(g+.32-h)/y);v<=P||(m(x(P,v),i+.95,r-.22),A||=P<1e-6,M||=v>1-1e-6)}if(!o&&(p===0&&!A||p===d-1&&!M)){let g=Math.min(1,.32/y);m(x(p===0?0:1-g,p===0?g:1),i+.95,r-.22)}h+=y}}var wt=nt(require("polygon-clipping"),1),Gn=.65;function Qr(e,t){let n=1/0;for(let o of t)for(let i=0;i<o.length;i++){let r=o[i],a=o[(i+1)%o.length],s=a.x-r.x,c=a.y-r.y,l=Math.max(0,Math.min(1,((e.x-r.x)*s+(e.y-r.y)*c)/(s*s+c*c||1)));n=Math.min(n,Math.hypot(e.x-r.x-l*s,e.y-r.y-l*c))}return n}var Jr=.01;function Tc(e,t,n,o,i,r,a,s=[],c=!0,l={bays:[],walls:[]}){if(o-i<=1e-5)return;let u=o-i>=3,m=u?o-Gn:i;e.setMaterial(5);let f=u?[]:s.filter(g=>{if(g.role!=="entrance"&&g.role!=="exit")return!1;let P=ge(g);if(!P)return!1;let v=tn(P,i,i+Qe(g).heightM);return v!==null&&v.openingTop<=o-.12});if((!f.length||!dt(e,t,m,o,f,r,a,{holes:n,portalBase:i}))&&ue(e,t,n,()=>o,m,r,a,ae,void 0,()=>[0,1,0]),!u){e.setMaterial(0);return}let d=c&&l.bays.length?pp(t,n,gt(t,Vn/C),l):null,h=6/C,p=.22/C,b=s.flatMap(g=>{if(g.role!=="entrance"&&g.role!=="exit")return[];let P=ge(g);return P?.length?[{minX:Math.min(...P.map(v=>v.x)),maxX:Math.max(...P.map(v=>v.x)),minY:Math.min(...P.map(v=>v.y)),maxY:Math.max(...P.map(v=>v.y))}]:[]}),y=Math.min(...t.map(g=>g.x)),x=Math.max(...t.map(g=>g.x)),S=Math.min(...t.map(g=>g.y)),A=Math.max(...t.map(g=>g.y));for(let g=y+h/2;g<x;g+=h)for(let P=S+h/2;P<A;P+=h){if(b.some(w=>g+p>=w.minX&&g-p<=w.maxX&&P+p>=w.minY&&P-p<=w.maxY))continue;let v=[{x:g-p,y:P-p},{x:g+p,y:P-p},{x:g+p,y:P+p},{x:g-p,y:P+p}];!Le({x:g,y:P},t,n)||Qr({x:g,y:P},[t,...n??[]])<p*Math.SQRT2+(c?Vn/C:0)||d&&Qr({x:g,y:P},d.flat())<p*Math.SQRT2+Vn/C||ue(e,v,void 0,()=>m,i,r,a,ae)}if(d){for(let[g,...P]of d)ue(e,g,P,()=>m,i-Jr,r,a,ae);e.setMaterial(0);return}let M=gt(t,Vn/C);if(c&&M.length>=3){let g=s.filter(w=>{if(w.role!=="entrance"&&w.role!=="exit")return!1;let R=ge(w);return!!R&&R.some(_=>!Le(_,t,void 0)||Qr(_,[t])<=Vn/C)}),P=[M.slice().reverse()],v=i-Jr;(!g.length||!dt(e,t,v,m,g,r,a,{holes:P,portalBase:i+Jr}))&&ue(e,t,P,()=>m,v,r,a,ae)}e.setMaterial(0)}var ei=.25,Vn=ei;function pp(e,t,n,o){if(n.length<3)return null;let i=a=>{let s=a.map(c=>[c.x,c.y]);return s.push(s[0]),s},r=a=>{let[s,...c]=a.map(l=>[i(l)]);return wt.default.union(s,...c)};try{let a=[i(e),...(t??[]).map(i)],s=wt.default.difference(a,[i(n)]),c=wt.default.intersection(a,r(o.bays));if(!c.length)return null;let l=wt.default.difference(wt.default.intersection(a,r(o.walls)),c);return wt.default.union(wt.default.difference(s,c),l).map(m=>m.map(f=>f.slice(0,-1).map(([d,h])=>({x:d,y:h}))))}catch{return null}}var bp=.02,yp=.25,gp=1.2,xp=.6,vp=.45,Mp=2.3,Sp=Math.PI/180,kc=.005;function it(e,t,n){let o=n*Sp;return{x:e.x+t*Math.sin(o),y:e.y+t*Math.cos(o)}}function wp(e,t){let n=t.rings[t.rings.length-1];if(!n)return!1;let o=n.outerRMedian*.85;for(let i of e){if(i.role!=="wall")continue;let r=i.points&&i.points.length>=2?i.points:i.x!==void 0&&i.y!==void 0&&i.width!==void 0&&i.height!==void 0?[{x:i.x,y:i.y},{x:i.x+i.width,y:i.y},{x:i.x+i.width,y:i.y+i.height},{x:i.x,y:i.y+i.height}]:[];if(r.length<2)continue;let a=0;for(let s of r)Math.hypot(s.x-t.centre.x,s.y-t.centre.y)>=o&&a++;if(a>=r.length/2)return!0}return!1}var Pp=24,Ap=.01;function Ip(e,t,n,o,i,r,a,s,c){let l=n.binCount,u=Pp,m=fe,f=r+.02,d=r-Ap,h=[];for(let I=0;I<l;I++){let T=(n.startBin+I+.5)*t.binStepDeg,L=new Float64Array(u+1);for(let V=0;V<=u;V++){let O=o[I]+(i[I]-o[I])*V/u;L[V]=Math.max(f,_c(t,n,T,O)-yp)}h.push(L)}if(c){let I=0;for(let T=0;T+1<l;T++)for(let L=0;L<u;L++){let V=it(t.centre,o[T]+(i[T]-o[T])*L/u,(n.startBin+T+.5)*t.binStepDeg),O=it(t.centre,o[T+1]+(i[T+1]-o[T+1])*(L+1)/u,(n.startBin+T+1.5)*t.binStepDeg);I=Math.max(I,Math.hypot(O.x-V.x,O.y-V.y))}for(let T=0;T<l;T++){let L=(n.startBin+T+.5)*t.binStepDeg;for(let V=0;V<=u;V++){let O=it(t.centre,o[T]+(i[T]-o[T])*V/u,L),H=c(O.x,O.y,I*1.01);H!==null&&(h[T][V]=Math.min(h[T][V],Math.max(d+kc,H-kc)))}}}let p=[a.bandTop[0]*s.top,a.bandTop[1]*s.top,a.bandTop[2]*s.top],b=[a.bandTop[0]*s.bottomCap,a.bandTop[1]*s.bottomCap,a.bandTop[2]*s.bottomCap],y=[a.bandWall[0]*s.top,a.bandWall[1]*s.top,a.bandWall[2]*s.top],x=[a.bandWall[0]*s.wallBottom,a.bandWall[1]*s.wallBottom,a.bandWall[2]*s.wallBottom],S=(I,T)=>{let L=(n.startBin+I+.5)*t.binStepDeg,V=o[I]+(i[I]-o[I])*T/u,O=it(t.centre,V,L);return[O.x*m,h[I][T],O.y*m]};{let I=Math.tan(12*Math.PI/180);for(let T=0;T<6;T++){let L=!1;for(let O=0;O<l;O++)for(let H=u-1;H>=0;H--)h[O][H]>h[O][H+1]&&(h[O][H]=h[O][H+1],L=!0);let V=n.closed?l:l-1;for(let O=0;O<V;O++){let H=(O+1)%l;for(let j=0;j<=u;j++){let N=h[H][j]-h[O][j];if(Math.abs(N)>1)continue;let k=o[O]+(i[O]-o[O])*j/u,B=o[H]+(i[H]-o[H])*j/u,D=it(t.centre,k,(n.startBin+O+.5)*t.binStepDeg),G=it(t.centre,B,(n.startBin+H+.5)*t.binStepDeg),U=I*Math.hypot(G.x-D.x,G.y-D.y)*m;N>U?(h[H][j]=h[O][j]+U,L=!0):-N>U&&(h[O][j]=h[H][j]+U,L=!0)}}if(!L)break}}let A=1,M=(I,T)=>{for(let L=0;L<=u;L+=4)if(Math.abs(h[I][L]-h[T][L])>A)return!0;return Math.abs(h[I][u]-h[T][u])>A},g=Math.tan(38*Math.PI/180),P=I=>(i[I]-o[I])/u*m,v=(I,T)=>h[I][T+1]-h[I][T]>g*Math.max(1e-6,P(I)),w=(I,T)=>{let L=n.closed?(I-1+l)%l:Math.max(0,I-1),V=n.closed?(I+1)%l:Math.min(l-1,I+1);Math.abs(h[L][T]-h[I][T])>A&&(L=I),Math.abs(h[V][T]-h[I][T])>A&&(V=I);let O=Math.max(0,T-1),H=Math.min(u,T+1);O<T&&v(I,O)&&(O=T),H>T&&v(I,T)&&(H=T);let j=S(L,T),N=S(V,T),k=S(I,O),B=S(I,H),D=N[0]-j[0],G=N[1]-j[1],U=N[2]-j[2],q=B[0]-k[0],$=B[1]-k[1],ee=B[2]-k[2],Q=G*ee-U*$,X=U*q-D*ee,Y=D*$-G*q,K=Math.hypot(Q,X,Y);return K>1e-12?(Q/=K,X/=K,Y/=K,X<0&&(Q=-Q,X=-X,Y=-Y),[Q,X,Y]):[0,1,0]},R=(I,T,L=!1)=>{let V=L&&Math.min(I[1],T[1])-r>=3,O=[I[0],V?I[1]-Gn:d,I[2]],H=[T[0],V?T[1]-Gn:d,T[2]],j=T[0]-I[0],N=T[2]-I[2],k=Math.hypot(j,N);if(!(k>1e-12))return;let B=[N/k,0,-j/k];e.tri(I,T,H,B,y,y,x),e.tri(I,H,O,B,y,x,x)},_=.05*je,F=I=>i[I]-o[I]<_,E=n.closed?l:l-1;for(let I=0;I<E;I++){let T=(I+1)%l;if(F(I)||F(T))continue;if(M(I,T)){let N=(n.startBin+I+1)*t.binStepDeg,k=($,ee)=>{let Q=(o[I]+o[T])/2,X=(i[I]+i[T])/2,Y=Q+(X-Q)*ee/u,K=it(t.centre,Y,N);return[K.x*m,h[$][ee],K.y*m]};for(let $=0;$<u;$++){let ee=S(I,$),Q=S(I,$+1),X=k(I,$),Y=k(I,$+1),K=w(I,$),re=w(I,$+1);e.triN(ee,X,Y,K,K,re,p),e.triN(ee,Y,Q,K,re,re,p);let ne=S(T,$),se=S(T,$+1),J=k(T,$),ie=k(T,$+1),Pe=w(T,$),te=w(T,$+1);e.triN(J,ne,se,Pe,Pe,te,p),e.triN(J,se,ie,Pe,te,te,p);let xe=k(I,$),ve=k(I,$+1),Ye=k(T,$+1),et=k(T,$),Ne=ve[0]-xe[0],Ke=ve[2]-xe[2],we=Math.hypot(Ne,Ke);if(we>1e-12){let Ct=[Ke/we,0,-Ne/we];e.tri(xe,ve,Ye,Ct,y),e.tri(xe,Ye,et,Ct,y)}}let B=S(I,0),D=S(T,0),G=S(T,u),U=S(I,u),q=$=>[$[0],d,$[2]];Math.min(B[1],D[1])-r<3&&(e.tri(q(B),q(G),q(D),[0,-1,0],b),e.tri(q(B),q(U),q(G),[0,-1,0],b)),R(B,D,!0),R(U,G,!0);continue}for(let N=0;N<u;N++){let k=w(I,N),B=w(T,N),D=w(T,N+1),G=w(I,N+1);if(v(I,N)||v(T,N)){let Q=(ve,Ye)=>{let et=(n.startBin+ve+.5)*t.binStepDeg,Ne=o[ve]+(i[ve]-o[ve])*(N+.5)/u,Ke=it(t.centre,Ne,et);return[Ke.x*m,Ye,Ke.y*m]},X=S(I,N),Y=S(T,N),K=Q(I,h[I][N]),re=Q(T,h[T][N]);e.triN(X,Y,re,k,B,B,p),e.triN(X,re,K,k,B,k,p);let ne=S(T,N+1),se=S(I,N+1),J=Q(I,h[I][N+1]),ie=Q(T,h[T][N+1]);e.triN(J,ie,ne,G,D,D,p),e.triN(J,ne,se,G,D,G,p);let Pe=re[0]-K[0],te=re[2]-K[2],xe=Math.hypot(Pe,te);if(xe>1e-12){let ve=[-te/xe,0,Pe/xe];e.tri(K,re,ie,ve,y),e.tri(K,ie,J,ve,y)}continue}let U=S(I,N),q=S(T,N),$=S(T,N+1),ee=S(I,N+1);e.triN(U,q,$,k,B,D,p),e.triN(U,$,ee,k,D,G,p)}let L=S(I,0),V=S(T,0),O=S(T,u),H=S(I,u),j=N=>[N[0],d,N[2]];Math.min(L[1],V[1])-r<3&&(e.tri(j(L),j(O),j(V),[0,-1,0],b),e.tri(j(L),j(H),j(O),[0,-1,0],b)),R(L,V,!0),R(H,O,!0)}if(!n.closed)for(let I of[0,l-1])for(let T=0;T<u;T++)R(S(I,T),S(I,T+1))}function Lc(e,t,n){let{bottomY:o,colors:i,ao:r}=n,a=new Float64Array(t.binCount).fill(-1/0);for(let u of t.rings)for(let m of u.arcs){let f=new Float64Array(m.binCount),d=new Float64Array(m.binCount);for(let p=0;p<m.binCount;p++){let b=(m.startBin+p)%t.binCount,y=Math.max(0,m.innerR[p]-We);f[p]=Math.max(y,a[b]+.001),d[p]=Math.max(f[p]+.001,m.outerR[p]+We)}let h=0;for(let p=0;p<m.binCount;p++){let b=m.topLevelM[p]-o;b>h&&(h=b)}h>=gp&&Ip(e,t,m,f,d,o,i,r,n.standTopNear);for(let p=0;p<m.binCount;p++){let b=(m.startBin+p)%t.binCount;d[p]>a[b]&&(a[b]=d[p])}}if(n.deriveShell===!1||wp(n.shapes,t))return;let s=t.rings[t.rings.length-1],c=xp*je,l=vp*je;for(let u of s.arcs){let m=[],f=[];for(let w=0;w<u.binCount;w++){let R=(u.startBin+w+.5)*t.binStepDeg,_=u.outerR[w]+We+c;m.push(it(t.centre,_,R)),f.push(it(t.centre,_+l,R))}let d=-1/0;for(let w=0;w<u.binCount;w++)u.topLevelM[w]>d&&(d=u.topLevelM[w]);let h=d+Mp,p=u.closed?f:[...f,...m.slice().reverse()],b=u.closed?[m.slice().reverse()]:void 0,y=be(i.shellWall,[.66,.71,.72],.62),x=(w,R,_,F,E)=>{let I=Math.abs(F-d)<1e-6?F-bp:F;dt(e,w,_,I,n.shapes,i.shellTop,E,{holes:R,portalBase:o,ao:r})||ue(e,w,R,()=>I,_,i.shellTop,E,r)},S=Math.max(1,Math.ceil((d-o)/4.5)),A=(d-o)/S,M=new Set,g=n.tierFrontLevels??t.rings.map(w=>{let R=w.arcs.flatMap(_=>Array.from(_.frontLevelM)).filter(Number.isFinite).sort((_,F)=>_-F);return R[Math.floor(R.length/2)]});for(let w of g)Number.isFinite(w)&&w-o>=3&&w<d&&M.add(Math.max(0,Math.min(S-1,Math.floor((w-o)/A))));let P=Math.min(...g.filter(w=>Number.isFinite(w)&&w-o>=3&&w<d));for(let w=0;w<S;w++)o+(w+1)*A<=P-Gn&&Number.isFinite(P)&&M.add(w);for(let w=0;w<S;w++){let R=o+(d-o)*w/S,_=o+(d-o)*(w+1)/S;M.has(w)&&_-R>=3.2?(x(p,b,R,R+.45,y),Zr(e,m,f,u.closed,R+.45,_-.16,i.shellTop,y,r,n.shapes,o)):x(p,b,R,_-.16,y),x(p,b,_-.16,_,le(y,.62))}Zr(e,m,f,u.closed,d,h,i.shellTop,y,r,n.shapes,o);let v=8;for(let w=1;w<f.length;w++){if(v+=Math.hypot(f[w].x-f[w-1].x,f[w].y-f[w-1].y)*fe,v<8)continue;v=0;let R=f[w],_=f[w-1],F=R.x-_.x,E=R.y-_.y,I=Math.max(1,Math.hypot(F,E)),T=F/I*.16*je,L=E/I*.16*je,V=Math.max(1,Math.hypot(R.x-t.centre.x,R.y-t.centre.y)),O=(R.x-t.centre.x)/V*.24*je,H=(R.y-t.centre.y)/V*.24*je,j=[{x:R.x-T,y:R.y-L},{x:R.x+T,y:R.y+L},{x:R.x+T+O,y:R.y+L+H},{x:R.x-T+O,y:R.y-L+H}];x(j,void 0,o,d,le(y,1.12))}}}var Rp=2.5,Oc=.65,Ep=2,Cp=.03;function _p(e,t){let n=()=>{let o=t;for(;e.length>2;){let i=e[0],r=e[1],a=Math.hypot(r.x-i.x,r.y-i.y);if(a>o){e[0]={x:i.x+(r.x-i.x)/a*o,y:i.y+(r.y-i.y)/a*o};return}o-=a,e.shift()}};n(),e.reverse(),n(),e.reverse()}function oi(e,t,n){let o=new Map;for(let r of e){let a=o.get(r.blockId);(!a||r.depth<a.depth)&&o.set(r.blockId,r)}let i=[];for(let[r,a]of o){if(a.y-n<Rp||a.pts.length<2)continue;let s=a.pts.map(u=>{let m=u.x-t.x,f=u.y-t.y,d=Math.max(1,Math.hypot(m,f));return{x:u.x-m/d*Oc/C,y:u.y-f/d*Oc/C}}),c=[],l=[s[0]];for(let u=1;u<s.length;u++){let m=s[u-1],f=s[u];Math.hypot(f.x-m.x,f.y-m.y)*C>Ep?(l.length>=2&&c.push(l),l=[f]):l.push(f)}l.length>=2&&c.push(l);for(let u of c)_p(u,Cp/C);c.length&&i.push({blockId:r,y:a.y,runs:c})}return i}var Fc=.1,Tp=1.1,kp=.22,ti=.95,ni=.05,Dc=1.8;function Nc(e,t,n,o){let i=[.72,.72,.69],r=[.48,.55,.57];for(let a of oi(t,n,o)){let s=a.y;for(let c of a.runs){let l=Dc;for(let u=1;u<c.length;u++){let m=c[u-1],f=c[u],d=f.x-m.x,h=f.y-m.y,p=Math.hypot(d,h);if(p<1e-5)continue;let b=y=>{let x=-h/p*y/C/2,S=d/p*y/C/2;return[{x:m.x+x,y:m.y+S},{x:f.x+x,y:f.y+S},{x:f.x-x,y:f.y-S},{x:m.x-x,y:m.y-S}]};if(ue(e,b(kp),void 0,()=>s+Fc,s-Tp,i,i,ae),ue(e,b(ni),void 0,()=>s+ti,s+ti-ni,r,r,ae),l+=p*C,l>=Dc||u===c.length-1){l=0;let y=.028/C,x=[{x:m.x-y,y:m.y-y},{x:m.x+y,y:m.y-y},{x:m.x+y,y:m.y+y},{x:m.x-y,y:m.y+y}];ue(e,x,void 0,()=>s+ti-ni,s+Fc,r,r,ae)}}}}}var Lp=.9,Op=1.5,Fp=.3;function Bc(e,t,n){let o=[],i=[],r=Lp/C,a=Op/C,s=Fp/C;for(let c of e)for(let l of c.runs){if(l.length<2)continue;let u=l.slice(),m=(b,y)=>{let x=u[b],S=u[y],A=Math.hypot(x.x-S.x,x.y-S.y)||1;u[b]={x:x.x+(x.x-S.x)/A*s,y:x.y+(x.y-S.y)/A*s}};m(0,1),m(u.length-1,u.length-2);let f=u.map((b,y)=>{let x=u[Math.max(0,y-1)],S=u[Math.min(u.length-1,y+1)],A=S.x-x.x,M=S.y-x.y,g=Math.hypot(A,M)||1,P=-M/g,v=A/g;return P*(b.x-t.x)+v*(b.y-t.y)<0&&(P=-P,v=-v),{nx:P,ny:v}}),d=u.map((b,y)=>({x:b.x-f[y].nx*a,y:b.y-f[y].ny*a})),h=u.map((b,y)=>({x:b.x+f[y].nx*r,y:b.y+f[y].ny*r})),p=u.map((b,y)=>({x:b.x+f[y].nx*(r+n/C),y:b.y+f[y].ny*(r+n/C)}));o.push([...d,...h.slice().reverse()]),i.push([...h,...p.reverse()])}return{bays:o,walls:i}}var ri=.88,No=.27,Dp=1.2,Np=.01;function Vc(e,t,n,o,i){let r=[.67,.71,.68],a=[r[0]*ri,r[1]*ri,r[2]*ri],s=c=>!!i&&i.some((l,u)=>u!==c&&l?.belowY!=null&&Math.abs(l.belowY-t[c].y)<1e-6&&t[u].blockId===t[c].blockId);for(let c=0;c<t.length;c++){let l=t[c];if(!(l.pts.length<2))for(let u of[0,l.pts.length-1]){let m=l.pts[u],f=l.pts[u===0?1:u-1],d=m.x-f.x,h=m.y-f.y,p=Math.hypot(d,h);if(p<1e-5)continue;d/=p,h/=p;let b=1/0;for(let T=0;T<n.length;T++){let L=n[T],V=n[(T+1)%n.length],O=V.x-L.x,H=V.y-L.y,j=d*H-h*O;if(Math.abs(j)<1e-8)continue;let N=L.x-m.x,k=L.y-m.y,B=(N*H-k*O)/j,D=(N*h-k*d)/j;B>0&&D>=0&&D<=1&&(b=Math.min(b,B))}let y=.3/C,x=b-.04/C;if(!Number.isFinite(b)||b*C>2||x-y<.12/C)continue;let S=!!o&&s(c),A=i?.[c]?.pitch,M=S&&A&&Number.isFinite(A)?Math.min(Dp/C,Math.max(No/C,A-No/C-Np/C)):No/C,g=-h,P=d;o&&g*(o.x-m.x)+P*(o.y-m.y)<0&&(g=-g,P=-P);let v=No/C,w=[{x:m.x+d*y+g*v,y:m.y+h*y+P*v},{x:m.x+d*x+g*v,y:m.y+h*x+P*v},{x:m.x+d*x-g*M,y:m.y+h*x-P*M},{x:m.x+d*y-g*M,y:m.y+h*y-P*M}];if(!w.every(T=>Ge(n,T.x,T.y)))continue;let R=i?.[c]?.belowY,_=R==null?0:l.y-R,F=!!o&&_>.03&&_<=.65;if(F&&o){let T=(L,V)=>Math.hypot((L.x+V.x)/2-o.x,(L.y+V.y)/2-o.y);T(w[0],w[1])>T(w[3],w[2])&&(w=[w[3],w[2],w[1],w[0]])}let E=F?Math.ceil((_-1e-8)/.2):1,I=(T,L,V)=>({x:T.x+(L.x-T.x)*V,y:T.y+(L.y-T.y)*V});for(let T=0;T<E;T++){let L=T/E,V=(T+1)/E,O=[I(w[0],w[3],L),I(w[1],w[2],L),I(w[1],w[2],V),I(w[0],w[3],V)],H=l.y+.008-(F?_*(1-V):0);ue(e,O,void 0,()=>H,H-(F?_/E+.1:.16),r,a,ae)}}}}var Bp=.02,Vp=.012,Gp=.01,Hp=.3,zp=.5;function Up(e,t,n){if(e.length===1)return Math.hypot(t-e[0].x,n-e[0].y);let o=1/0;for(let i=0;i+1<e.length;i++){let r=e[i],a=e[i+1],s=a.x-r.x,c=a.y-r.y,l=s*s+c*c,u=l>1e-12?((t-r.x)*s+(n-r.y)*c)/l:0;u=Math.max(0,Math.min(1,u)),o=Math.min(o,Math.hypot(t-(r.x+u*s),n-(r.y+u*c)))}return o}function jp(e,t,n,o){let i=1/0,r=Number.NaN;for(let a=0;a<e.length;a++){let s=t[a];if(Math.hypot(n-s.cx,o-s.cy)-s.rad>=i)continue;let c=Up(e[a].pts,n,o);c<i&&(i=c,r=e[a].y)}return r}function Gc(e,t,n,o,i,r,a){let s=o.filter(f=>f.pts.length>0);if(s.length<2||t.length<3)return;let c=s.map(f=>{let d=0,h=0;for(let b of f.pts)d+=b.x,h+=b.y;d/=f.pts.length,h/=f.pts.length;let p=0;for(let b of f.pts)p=Math.max(p,Math.hypot(b.x-d,b.y-h));return{cx:d,cy:h,rad:p}}),l=[...t],u=n.map(f=>[...f]),m=Bp/C;for(let f of[l,...u])for(let d=0;d<f.length;d++){let h=f[d],p=f[(d+1)%f.length],b=p.x-h.x,y=p.y-h.y,x=Math.hypot(b,y);if(x*C<.05)continue;let S=(h.x+p.x)/2,A=(h.y+p.y)/2,M=y/x,g=-b/x;Le({x:S+M*m,y:A+g*m},l,u)&&(M=-M,g=-g);let P=i.x-S,v=i.y-A,w=Math.hypot(P,v)||1;if((M*P+g*v)/w>zp)continue;let R=1/0;for(let O of[.2,.5,.8]){let H=jp(s,c,h.x+b*O-M*m*2,h.y+y*O-g*m*2);Number.isFinite(H)&&(R=Math.min(R,H))}if(!Number.isFinite(R)||R-r<Hp)continue;let _=r-Gp,F=R-Vp,E={x:(h.x-M*m)*C,z:(h.y-g*m)*C},I={x:(p.x-M*m)*C,z:(p.y-g*m)*C},T=[M,0,g],L=le(a,ae.wallBottom),V=le(a,ae.top);e.tri([E.x,F,E.z],[I.x,F,I.z],[I.x,_,I.z],T,V,V,L),e.tri([E.x,F,E.z],[I.x,_,I.z],[E.x,_,E.z],T,V,L,L)}}function Hc(e,t,n,o,i,r,a,s,c=!1){if(!t.outline||t.outline.length<3)return;let l=n.baseHeightM,u=n.objects.filter(x=>x.type==="shape"&&(x.role==="entrance"||x.role==="exit")),m=Rs(o,s.tierTop);if(!i)return;let f=x=>i.deckAt(x.x,x.y),d=Us(t,a),h=d[0]??t.outline;if(i.rowLevels.length>=2){let x=xo(i.rowLevels),S=js(Bs(i.rowLevels,n.focal,x),d),A=Bc(oi(i.rowLevels,n.focal,l),n.focal,ei);for(let g of S){let P=Math.max(l,g.topY-zc);for(let v of r.subtract(g.outline,P))Tc(e,v,g.holes,P,l,s.tierTop,s.tierWall,u,!c,A);e.setMaterial(5),Gc(e,g.outline,g.holes,i.rowLevels,n.focal,P,s.tierWall),e.setMaterial(0)}S.length||ue(e,h,t.holes,()=>i.landingY,l,m,s.tierWall,ae);let M={tread:[m[0]*ae.top,m[1]*ae.top,m[2]*ae.top],riser:[m[0]*.72,m[1]*.72,m[2]*.72]};for(let g of d.length?d:[h])Gs(e,i.rowLevels,n.focal,i.landingY,M,g,x);Nc(e,i.rowLevels,n.focal,l),Vc(e,i.rowLevels,t.outline,n.focal,x);return}let p=i.flat?1/0:Qs,b=x=>i.normalAt(x.x,x.y),y=i.flat?i.landingY:void 0;for(let x of r.subtract(h,y))ue(e,x,t.holes,f,l,m,s.tierWall,ae,p,b)}function Wp(e,t,n){let o=new Set;for(let a of e.objects)a.type==="section"&&o.add(a.id);let i=new Map;for(let a=0;a<t.length;a++){let s=n.seatOwner[a];if(!s||!o.has(s))continue;let c=n.bySection.get(s);if(c&&c.rowLevels.length>=2)continue;let l=t[a];if(l.kind==="booth")continue;let u=i.get(s);u||(u=new Map,i.set(s,u));let m=l.rowId||`__seat-${a}`,f=u.get(m);f||(f={pts:[],levelM:0,n:0},u.set(m,f)),f.pts.push({x:l.x,y:l.y}),f.levelM+=n.seatDeckY(a),f.n++}let r=[];for(let a of e.objects){if(a.type!=="section")continue;let s=n.bySection.get(a.id);if(s&&s.rowLevels.length>=2){let l=s.rowLevels.filter(u=>!u.patch).map(u=>({pts:u.pts,levelM:u.y}));l.length>=2&&r.push({sectionId:a.id,rows:l});continue}let c=i.get(a.id);c&&r.push({sectionId:a.id,rows:[...c.values()].map(l=>({pts:l.pts,levelM:l.levelM/l.n}))})}return r}function Xp(e,t){let n=1/0;for(let o=0;o<t.length;o++){let i=t[o],r=t[(o+1)%t.length],a=r.x-i.x,s=r.y-i.y,c=Math.max(0,Math.min(1,((e.x-i.x)*a+(e.y-i.y)*s)/(a*a+s*s||1)));n=Math.min(n,Math.hypot(e.x-i.x-c*a,e.y-i.y-c*s))}return n}var zc=.02;function Yp(e,t){let n=e.objects.filter(o=>o.type==="section"&&!!o.outline&&o.outline.length>=3).flatMap(o=>{let i=t.bySection.get(o.id);if(!i)return[];let r=1/0,a=-1/0,s=1/0,c=-1/0;for(let u of o.outline)u.x<r&&(r=u.x),u.x>a&&(a=u.x),u.y<s&&(s=u.y),u.y>c&&(c=u.y);let l=i.landingY;for(let u of i.rowLevels)l=Math.min(l,u.y-zc);return[{outline:o.outline,holes:o.holes,surface:i,floorTop:l,minX:r,maxX:a,minY:s,maxY:c}]});return(o,i,r)=>{let a=null;for(let s of n){if(o<s.minX-r||o>s.maxX+r||i<s.minY-r||i>s.maxY+r)continue;let c={x:o,y:i};if(!Le(c,s.outline,s.holes)&&Xp(c,s.outline)>r)continue;let l=Math.min(s.surface.deckAt(o,i),s.floorTop);(a===null||l<a)&&(a=l)}return a}}var Kp=3,$p=.4;function Uc(e,t,n,o,i,r,a=!0){let s=Wp(t,n,o);if(s.length<Kp)return;let c=Cc(s,t.focal);if(!c)return;let l=Math.max(0,...c.rings.map(u=>u.arcs.reduce((m,f)=>m+f.binCount,0)))/c.binCount;e.setMaterial(5),Lc(e,c,{bottomY:t.baseHeightM,tierFrontLevels:s.map(u=>Math.min(...u.rows.map(m=>m.levelM))),colors:{bandTop:le(i.tierTop,.8),bandWall:i.tierWall,shellTop:r??le(i.tierWall,1.15),shellWall:r??i.tierWall},ao:ae,shapes:t.objects.filter(u=>u.type==="shape"),deriveShell:a&&l>=$p,standTopNear:Yp(t,o)}),e.setMaterial(0)}var jc=4;var qp=[[/\b(wc|toilets?|restrooms?|washrooms?|lavatory|loo)\b/i,"restroom"],[/\b(bar|drinks|pub|cocktails?)\b/i,"bar"],[/\b(food|concessions?|snacks?|kiosk|caf[eé]|kitchen|catering)\b/i,"concession"],[/\b(coat ?check|cloak ?room|cloakroom|coats)\b/i,"coat"],[/\b(screen|led wall|projection|video wall)\b/i,"screen"],[/\b(sound|foh|mixing desk|control booth)\b/i,"sound"],[/\b(entrance|entry|way in|gate)\b/i,"entrance"],[/\b(exit|way out)\b/i,"exit"],[/\b(pillar|column|obstruction)\b/i,"obstruction"],[/\b(walls?|outline|boundary|perimeter)\b/i,"wall"]],Zp=1.2,Qp=12;function Wc(e){if(e.heightM!==void 0)return!1;let t=ge(e);if(!t||t.length<3)return!1;let n=0;for(let i=0;i<t.length;i++){let r=t[i],a=t[(i+1)%t.length];n+=Math.hypot(a.x-r.x,a.y-r.y)}return n*fe<Qp*2?!1:2*Hn(t)/n*fe<=Zp}function ii(e){if(!e)return null;for(let[t,n]of qp)if(t.test(e))return n;return null}var Yc="auto-rows-";function Kc(e){return e.id.startsWith(Yc)&&!e.label}var Jp=1.15,eb=.09,$c=6,tb=34,nb=.35,ob=6,rb=.35,ib=.75,ab=12,sb=2.5,cb=40,lb=[18,24],ub=[12,16],Xc=14,mb=.8,fb=.6,db=5,hb=.3,qc=.4,Zc=2,pb=400,bb=2.6,yb=.8,gb=4,xb=26,vb=.7,Mb=.5,Sb=.985,wb=1.5,Pb=2.2,Ab=3,Ib=25,Rb=.985,Eb=2,Cb=6,_b=3,Tb=.1,kb=1.5,Lb=1.6,Ob=6e3,Fb=.6,Db="#c3c7cd",ai=300,Nb=240;function Bb(e,t,n,o){if(!e.fill||!/^#[0-9a-f]{6}$/i.test(e.fill))return null;let i=ci([...t]),r=new Set;for(let u of o)r.add(Math.floor(Math.atan2(u.y-i.y,u.x-i.x)*180/Math.PI/10));if(r.size*10<Nb)return null;let{h:a,s,l:c}=ya(pa(e.fill));return a<70/360||a>170/360||s<.2||c<.08||c>.75||n.some(u=>u!==e&&u.type==="shape"&&ge(u)?.some(m=>mi(m,t)))?null:e.kind==="ellipse"?"oval-cricket":e.kind==="rect"?"pitch-football":null}var Vb="Estimated from the drawing; confirm with the venue.",li=e=>{if(!e.length)return null;let t=[...e].sort((o,i)=>o-i),n=Math.floor(t.length/2);return t.length%2?t[n]:(t[n-1]+t[n])/2},ci=e=>({x:e.reduce((t,n)=>t+n.x,0)/e.length,y:e.reduce((t,n)=>t+n.y,0)/e.length}),Hn=e=>{let t=0;for(let n=0;n<e.length;n++){let o=e[n],i=e[(n+1)%e.length];t+=o.x*i.y-i.x*o.y}return Math.abs(t)/2};function Gb(e){return e.height!==void 0||e.rake!==void 0||e.elevation!==void 0||e.surfaceKind!==void 0}function ui(e){let t=new Map;for(let n of e){let o=t.get(n.rowId);o?o.push(n):t.set(n.rowId,[n])}return t}function mi(e,t){let n=!1;for(let o=0,i=t.length-1;o<t.length;i=o++){let r=t[o],a=t[i];r.y>e.y!=a.y>e.y&&e.x<(a.x-r.x)*(e.y-r.y)/(a.y-r.y)+r.x&&(n=!n)}return n}function fi(e,t){let n=t[0],o=1/0;for(let i=0;i<t.length;i++){let r=t[i],a=t[(i+1)%t.length],s=a.x-r.x,c=a.y-r.y,l=s*s+c*c,u=l>0?Math.max(0,Math.min(1,((e.x-r.x)*s+(e.y-r.y)*c)/l)):0,m={x:r.x+s*u,y:r.y+c*u},f=Math.hypot(e.x-m.x,e.y-m.y);f<o&&(o=f,n=m)}return n}function Qc(e,t){let n=0,o=0;for(let i of e.values()){if(i.length<3)continue;let r=i[0],a=i[i.length-1],s=a.x-r.x,c=a.y-r.y,l=Math.hypot(s,c);if(l<1e-6)continue;let u={x:(r.x+a.x)/2,y:(r.y+a.y)/2},m=fi(u,t),f=m.x-u.x,d=m.y-u.y,h=Math.hypot(f,d);h<1e-6||(o+=Math.abs((-c*f+s*d)/(l*h))*i.length,n+=i.length)}return n?o/n:0}function Hb(e,t,n){let o=e.filter(p=>p.type==="shape"),i=o.find(p=>p.role==="stage");if(i){let p=ge(i);return p?{shape:i,centre:ci(p),outline:p,inferred:!1}:null}if(!n.length)return null;let r=1/0,a=-1/0,s=1/0,c=-1/0;for(let p of n)r=Math.min(r,p.x),a=Math.max(a,p.x),s=Math.min(s,p.y),c=Math.max(c,p.y);let l=(a-r)*(c-s),u=[];for(let p of o){if(p.role)continue;let b=ge(p);if(!b)continue;let y=Hn(b);if(y*fe*fe<6||y>l)continue;let x=Math.min(...b.map(w=>w.x)),S=Math.max(...b.map(w=>w.x)),A=Math.min(...b.map(w=>w.y)),M=Math.max(...b.map(w=>w.y)),g=0;for(let w of n)w.x>x&&w.x<S&&w.y>A&&w.y<M&&mi(w,b)&&g++;if(g>n.length*.05)continue;let P=ci(b),v=Qc(t,b);v>=mb&&u.push({shape:p,centre:P,outline:b,score:v,area:y,box:[x,A,S,M]})}let m=(p,b)=>b!==p&&b.area>p.area&&p.box[0]>=b.box[0]-1e-6&&p.box[1]>=b.box[1]-1e-6&&p.box[2]<=b.box[2]+1e-6&&p.box[3]<=b.box[3]+1e-6,f=u.filter(p=>!u.some(b=>m(p,b))),d=Math.max(0,...f.map(p=>p.score)),h=f.filter(p=>p.score>=d-.03).sort((p,b)=>b.area-p.area)[0]??null;return h?{shape:h.shape,centre:h.centre,outline:h.outline,inferred:!0}:null}function zb(e,t,n){if(!n||n.length<3)return Math.hypot(e.x-t.x,e.y-t.y);let o=fi(e,n);return Math.hypot(e.x-o.x,e.y-o.y)}function Jc(e){let t=[...e].sort((r,a)=>r.x-a.x||r.y-a.y);if(t.length<3)return t;let n=(r,a,s)=>(a.x-r.x)*(s.y-r.y)-(a.y-r.y)*(s.x-r.x),o=[];for(let r of t){for(;o.length>=2&&n(o[o.length-2],o[o.length-1],r)<=0;)o.pop();o.push(r)}let i=[];for(let r=t.length-1;r>=0;r--){let a=t[r];for(;i.length>=2&&n(i[i.length-2],i[i.length-1],a)<=0;)i.pop();i.push(a)}return[...o.slice(0,-1),...i.slice(0,-1)]}function Ub(e){if(!e.length||e.length>Ob)return[];let t=[...ui(e).values()],n=t.map((s,c)=>c),o=s=>n[s]===s?s:n[s]=o(n[s]),i=Lb/fe,r=t.map(s=>({minX:Math.min(...s.map(c=>c.x))-i,maxX:Math.max(...s.map(c=>c.x))+i,minY:Math.min(...s.map(c=>c.y))-i,maxY:Math.max(...s.map(c=>c.y))+i}));for(let s=0;s<t.length;s++)for(let c=s+1;c<t.length;c++){let l=r[s],u=r[c];if(l.maxX<u.minX||u.maxX<l.minX||l.maxY<u.minY||u.maxY<l.minY)continue;t[s].some(f=>t[c].some(d=>Math.hypot(f.x-d.x,f.y-d.y)<=i))&&(n[o(s)]=o(c))}let a=new Map;return t.forEach((s,c)=>{let l=o(c),u=a.get(l);u?u.push(...s):a.set(l,[...s])}),[...a.values()].filter(s=>new Set(s.map(c=>c.rowId)).size>=2)}function jb(e,t,n){if(!t.length)return null;let o=t.filter(v=>n.tableIds.has(v.rowId)||v.kind==="booth").length>t.length/2,i=ui(t),r=!n.outline||Qc(i,n.outline)>=fb,a=0,s=0;for(let v of i.values()){if(v.length<2)continue;let w=v[0],R=v[v.length-1],_=R.x-w.x,F=R.y-w.y,E=Math.hypot(_,F);if(E<1e-6)continue;let I={x:(w.x+R.x)/2,y:(w.y+R.y)/2},T=r?n.outline?fi(I,n.outline):n.focal:n.middle,L=-F/E,V=_/E;L*(T.x-I.x)+V*(T.y-I.y)<0&&(L=-L,V=-V),a+=L*v.length,s+=V*v.length}let c={x:t.reduce((v,w)=>v+w.x,0)/t.length,y:t.reduce((v,w)=>v+w.y,0)/t.length};if(Math.hypot(a,s)<1e-9){let v=r?n.focal:n.middle;a=v.x-c.x,s=v.y-c.y}let l=Math.hypot(a,s)||1,u={x:a/l,y:s/l},m=v=>-(v.x*u.x+v.y*u.y),f=v=>-v.x*u.y+v.y*u.x,d=1/0,h=-1/0,p=1/0,b=-1/0,y=1/0,x=new Map;for(let v of t){let w=m(v),R=f(v);d=Math.min(d,w),h=Math.max(h,w),p=Math.min(p,R),b=Math.max(b,R),r&&(y=Math.min(y,zb(v,n.focal,n.outline)));let _=v.logicalRowId??v.rowId,F=x.get(_);F?F.push(w):x.set(_,[w])}r||(y=Math.max(0,d-m(n.middle)));let S=[...x.values()].map(v=>li(v)).sort((v,w)=>v-w),A=[];if(!o)for(let v of S)A.length&&v-A[A.length-1]<rb/fe||A.push(v);let M=Gb(e),g=yt(e,{floorBaseHeightM:n.baseHeightM}),P={id:e.id,section:e,authored:M,plane:n,facing:u,facesAction:r,hull:Jc(t),sample:t.filter((v,w)=>w%Math.ceil(t.length/pb)===0),frontD:d,backD:h,latMin:p,latMax:b,frontDistance:y,rowDepths:A,rowCount:A.length,level:0,height:g.height,rake:M?g.rake:0,backHeight:0};return P.backHeight=P.height+(h-d)*fe*Math.tan(P.rake*Math.PI/180),P}function Wb(e,t,n,o){if(e.length<2)return 0;let i=Math.max(1,t*fe),r=n+Jp-o,a=0,s=0;for(let l=1;l<e.length;l++){let u=Math.max(ib,(e[l]-e[l-1])*fe),m=(r+eb)*(i+u)/i;a+=m-r,s+=u,r=m,i+=u}let c=Math.atan(a/s)*180/Math.PI;return Math.round(Math.max($c,Math.min(tb,c))*10)/10}function Xb(e,t,n=!1){if(!n&&e.facing.x*t.facing.x+e.facing.y*t.facing.y<hb)return null;let o=-1/0,i=1/0,r=-1/0;for(let f of t.hull){o=Math.max(o,-(f.x*e.facing.x+f.y*e.facing.y));let d=-f.x*e.facing.y+f.y*e.facing.x;i=Math.min(i,d),r=Math.max(r,d)}if(Math.min(e.latMax,r)-Math.max(e.latMin,i)<(n?1e-6:qc*(e.latMax-e.latMin)))return null;let s=Zc/fe,c=new Map,l=new Map;for(let f of e.sample){let d=Math.floor((-f.x*e.facing.y+f.y*e.facing.x)/s),h=-(f.x*e.facing.x+f.y*e.facing.y);c.set(d,Math.min(c.get(d)??1/0,h))}for(let f of t.sample){let d=Math.floor((-f.x*e.facing.y+f.y*e.facing.x)/s),h=-(f.x*e.facing.x+f.y*e.facing.y);l.set(d,Math.max(l.get(d)??-1/0,h))}let u=[];for(let[f,d]of c){let h=l.get(f);h!==void 0&&u.push(d-h)}let m=u.length?li(u):e.frontD-o;return m<-1/fe?null:m}function Yb(e,t){if(t.plane.floorIndex>=e.plane.floorIndex)return!1;let n=-1/0,o=1/0,i=1/0,r=-1/0;for(let c of t.hull){let l=-(c.x*e.facing.x+c.y*e.facing.y);n=Math.max(n,l),o=Math.min(o,l);let u=-c.x*e.facing.y+c.y*e.facing.x;i=Math.min(i,u),r=Math.max(r,u)}let a=Math.min(e.latMax,r)-Math.max(e.latMin,i),s=Math.min(e.backD,n)-Math.max(e.frontD,o);return a>qc*(e.latMax-e.latMin)&&s>1/fe}function Kb(e,t){let n=new Set;for(let o of e){let i=(Math.atan2(o.y-t.y,o.x-t.x)*180/Math.PI+360)%360;n.add(Math.floor(i/10))}return n.size/36}function $b(e,t){let n=1/0,o=-1/0;for(let r of t.hull){let a=-(r.x*e.facing.x+r.y*e.facing.y);n=Math.min(n,a),o=Math.max(o,a)}let i=Math.max(0,Math.min(o-n,e.frontD-n));return t.height+i*fe*Math.tan(t.rake*Math.PI/180)}function qb(e,t){if(!e.facesAction)return!1;let n={x:-e.facing.y,y:e.facing.x},o=Zc/fe,i=Math.max(1,Math.ceil((e.backD-e.frontD)/o)),r={left:new Map,right:new Map};for(let s of t)if(!(s===e||s.plane.floorIndex!==e.plane.floorIndex)&&!(s.facing.x*e.facing.x+s.facing.y*e.facing.y>=Sb))for(let c of s.sample){let l=-(c.x*e.facing.x+c.y*e.facing.y);if(l<e.frontD||l>e.backD)continue;let u=-c.x*e.facing.y+c.y*e.facing.x,m=u<e.latMin?"left":u>e.latMax?"right":null;if(!m)return!1;let f=Math.min(i-1,Math.floor((l-e.frontD)/o)),d=m==="left"?e.latMin-u:u-e.latMax;d<(r[m].get(f)?.gap??1/0)&&r[m].set(f,{gap:d,other:s})}let a=s=>{let c=s==="left"?e.latMin:e.latMax,l=0;for(let[u,{other:m}]of r[s]){if((m.facing.x*n.x+m.facing.y*n.y)*(s==="left"?1:-1)<vb)continue;let d=e.frontD+(u+.5)*o,h={x:-d*e.facing.x+c*n.x,y:-d*e.facing.y+c*n.y},p=-(h.x*m.facing.x+h.y*m.facing.y),b=-h.x*m.facing.y+h.y*m.facing.x;p<m.frontD&&b>=m.latMin&&b<=m.latMax&&l++}return l/i>=Mb};return a("left")&&a("right")}function Zb(e,t){if(t.plane.floorIndex!==e.plane.floorIndex||t.facing.x*e.facing.x+t.facing.y*e.facing.y<Rb)return!1;let n=1/0,o=-1/0,i=1/0;for(let s of t.hull){let c=-s.x*e.facing.y+s.y*e.facing.x;n=Math.min(n,c),o=Math.max(o,c),i=Math.min(i,-(s.x*e.facing.x+s.y*e.facing.y))}let r=(e.frontD-i)*fe;if(r<-Eb||r>Cb)return!1;let a=Math.max(n-e.latMax,e.latMin-o);return a*fe<=_b&&a*fe>=-Tb}function Qb(e,t=!1,n=!1,o){let i=t?ub:lb,r=new Set(n?[]:e.filter(p=>!p.authored&&qb(p,e))),a=[...e].sort((p,b)=>p.plane.floorIndex-b.plane.floorIndex||Number(r.has(b))-Number(r.has(p))||p.frontDistance-b.frontDistance);for(let p of r)o?.add(p.id);let s=(p,b,y)=>{let x=new Map,S=[],A=new Map,M=g=>{if(g.plane.floorIndex===0||g.plane.baseHeightM>0)return g.plane.baseHeightM;let P=A.get(g.plane.floorIndex-1);return P===void 0?g.plane.baseHeightM:P+jc};for(let g of a){if(r.has(g))g.height=M(g),g.level=0,g.rake=0,g.backHeight=g.height,x.set(g.id,void 0);else if(!g.authored){let v=M(g),w;for(let I of S){if(I.plane.floorIndex>g.plane.floorIndex)continue;if(Yb(g,I)){let O=$b(g,I)+bb;O>v&&(v=O,w=I);continue}let T=Xb(g,I,r.has(I));if(T==null)continue;let L=n&&!!g.plane.stageDeck&&I.level===0&&I.plane.floorIndex===g.plane.floorIndex&&Math.max(0,T)*fe<=gb,V=r.has(I)?I.height+wb:L?I.backHeight:I.backHeight+nb+Math.min(ob,Math.max(0,T)*fe)*Math.tan(I.rake*Math.PI/180);V>v&&(v=V,w=I)}let R=p.get(g);R&&R.height>v+.01?(v=R.height,w=void 0):R=void 0,g.height=Math.round(Math.min(v,g.plane.baseHeightM+cb)*100)/100;let _=!w&&!R&&g.height>g.plane.baseHeightM;if(g.level=w?w.level+1:R?R.level:_?1:0,g.rake=Wb(g.rowDepths,g.frontDistance,g.height,g.plane.focalHeightM),!g.facesAction&&g.rowCount<db)g.rake=0;else if(g.level===0){let I=Math.max(1e-6,(g.backD-g.frontD)*fe);g.rake=Math.min(g.rake,ab,Math.round(Math.atan(sb/I)*1800/Math.PI)/10)}else g.rowCount>=2&&(g.rake=Math.max(g.rake,i[Math.min(g.level,i.length)-1]));let F=(g.backD-g.frontD)*fe,E=w&&r.has(w)||R&&y?.has(R.id);if(b!==void 0&&E&&g.rowCount>=2&&(g.rake=b),t&&F>0&&g.height+F*Math.tan(g.rake*Math.PI/180)>g.plane.baseHeightM+Xc){let I=Math.max(0,g.plane.baseHeightM+Xc-g.height);g.rake=Math.max($c,Math.round(Math.atan(I/F)*1800/Math.PI)/10)}n&&g.plane.stageDeck&&g.level>0&&(g.rake=Math.min(g.rake,xb)),g.backHeight=g.height+F*Math.tan(g.rake*Math.PI/180),x.set(g.id,w?.id??(R?x.get(R.id):void 0))}let P=g.plane.floorIndex;A.set(P,Math.min(A.get(P)??1/0,g.height)),S.push(g)}return x},c=s(new Map),l=new Map,u=p=>l.get(p)?.height??p.height;for(let p=!0,b=0;p&&b<e.length;b++){p=!1;for(let y of e)if(!(y.authored||r.has(y)))for(let x of e){let S=l.get(x)??x;x===y||S.height-S.plane.baseHeightM<kb||S.height<=u(y)+.01||Zb(y,x)&&(l.set(y,S),p=!0)}}let m=new Map(e.map(p=>[p.id,p])),f=e.filter(p=>!p.authored&&p.rowCount>=2&&r.has(m.get(c.get(p.id)??""))),d=f.length?li(f.map(p=>p.rake)):void 0;if(!l.size&&d===void 0)return c;let h=new Map([...new Set(l.values())].map(p=>[p,{...p}]));return s(new Map([...l].map(([p,b])=>[p,h.get(b)])),d,new Set(f.map(p=>p.id)))}var si=(e,t)=>!!e&&e.x===t.x&&e.y===t.y;function Bo(e,t={x:0,y:-40}){let n=Zt(e),o=new Map;for(let y of n){if(!y.sectionId)continue;let x=o.get(y.sectionId);x?x.push(y):o.set(y.sectionId,[y])}let i={focalInferred:!1,confident:!1,sections:[]},r=e.floors?.length?e.floors.map((y,x)=>({objects:y.objects,floorIndex:x,floorId:y.id,baseHeightM:y.baseHeightM??0,focal:y.focalPoint??e.focalPoint})):[{objects:e.objects,floorIndex:0,floorId:void 0,baseHeightM:0,focal:e.focalPoint}],a=new Set(r.flatMap(y=>y.objects.filter(x=>x.type==="table").map(x=>x.id))),s=[],c,l=new Set,u=r.map(y=>{let x=E=>!e.floors?.length||E.floorId===y.floorId,S=Ub(n.filter(E=>!E.sectionId&&E.kind!=="booth"&&!a.has(E.rowId)&&x(E))),A=[];for(let E of S){let I=Ze(rt(Jc(E)),Fb/fe);if(n.some(L=>!x(L)&&mi(L,I)))continue;let T=`${Yc}${y.floorIndex}-${A.length}`;l.add(T),o.set(T,E),A.push({type:"section",id:T,label:"",color:Db,outline:I})}let M=A.length?{...y,objects:[...y.objects,...A]}:y,g=new Set(M.objects.filter(E=>E.type==="section").map(E=>E.logicalSectionId??E.id)),P=[...o.entries()].filter(([E])=>g.has(E)).flatMap(([,E])=>E),v=Hb(M.objects,ui(P),P),w=M.focal;(v||M.focal&&!si(M.focal,t))&&(i.confident=!0),v&&(i.stage??={id:v.shape.id,inferred:v.inferred,...M.floorId?{floorId:M.floorId}:{}},(v.inferred||si(M.focal,t))&&(w=v.centre,i.focalInferred=!0));let R=v&&(!v.inferred||Hn(v.outline)*fe*fe<=ai),_=v?void 0:c,F={tableIds:a,floorIndex:M.floorIndex,floorId:M.floorId,baseHeightM:M.baseHeightM,focal:_?.focal??w,outline:v?.outline??_?.outline,focalHeightM:_?.focalHeightM??M.baseHeightM+(v&&R?Qe({...v.shape,role:"stage"}).heightM:0),stageDeck:_?.stageDeck??!!(v&&R&&Hn(v.outline)*fe*fe<=ai),middle:P.length?{x:P.reduce((E,I)=>E+I.x,0)/P.length,y:P.reduce((E,I)=>E+I.y,0)/P.length}:w};for(let E of M.objects){if(E.type!=="section")continue;let I=jb(E,o.get(E.logicalSectionId??E.id)??[],F);I&&s.push(I)}return F.outline&&(c=F),si(M.focal,F.focal)||(i.focal??=[]).push({...M.floorId?{floorId:M.floorId}:{},point:{...F.focal}}),{unit:M,plane:F,stage:v,planeSeats:P}}),m=r.flatMap(y=>y.objects).map(y=>y.type==="shape"&&!y.role&&(ii(y.label)==="wall"||!ii(y.label)&&Wc(y))?{...y,role:"wall"}:y),f=Mt({objects:m},n)!==null;f&&(i.indoor=!0);let d=new Set,h=Qb(s,f,Kb(n,u[0]?.plane.focal??t)<yb,d),p=new Map(s.filter(y=>!y.authored).map(y=>[y.id,y])),b=u.map(({unit:y,plane:x,stage:S,planeSeats:A})=>y.objects.map(M=>{let g=M.type==="shape"&&!M.role&&M.id!==S?.shape.id?ii(M.label):null;if(M.type==="shape"&&!M.role&&M.id!==S?.shape.id&&(g==="wall"||!g&&Wc(M))&&M.type==="shape"){(i.roles??=[]).push({id:M.id,...x.floorId?{floorId:x.floorId}:{},role:"wall"});let{fill:I,...T}=M;return{...T,role:"wall"}}if(g&&M.type==="shape")return(i.roles??=[]).push({id:M.id,...x.floorId?{floorId:x.floorId}:{},role:g}),{...M,role:g};let v=S?.inferred&&M.id===S.shape.id&&M.type==="shape"?Bb(M,S.outline,y.objects,A):null;if(v&&M.type==="shape")return i.stage?.id===M.id&&(i.stage.field=v),{...M,role:"stage",stageKind:v};let w=M.type==="shape"&&M.id===S?.shape.id&&M.heightM===void 0&&!M.stageKind&&s.some(I=>I.plane===x&&(d.has(I.id)||I.level===0&&I.facesAction&&I.rake<=Ab&&(I.frontDistance+I.backD-I.frontD)*fe>=Ib)),R=w?{heightM:Pb}:{};if(S?.inferred&&M.id===S.shape.id&&M.type==="shape"&&Hn(S.outline)*fe*fe<=ai)return i.stage?.id===M.id&&(i.stage.deck=!0),{...M,role:"stage",...R};if(w&&M.type==="shape"&&M.role==="stage")return{...M,...R};let _=M.type==="section"?p.get(M.id):void 0;if(!_||M.type!=="section")return M;let F=_.rowCount>=2&&_.rake>0;l.has(_.id)?i.looseRowBlocks=(i.looseRowBlocks??0)+1:i.sections.push({id:_.id,floorId:x.floorId,surfaceKind:F?"rakedRows":"flat",height:_.height,rake:_.rake,stackedOn:h.get(_.id)});let E={status:"inferred",source:"public-2d-topology",note:Vb};return{...M,height:_.height,rake:_.rake,surfaceKind:F?"rakedRows":"flat",physical3dProvenance:{height:E,rake:E,surfaceKind:E}}}));if(e.floors?.length){let y=e.floors.map((x,S)=>({...x,objects:b[S],focalPoint:u[S].plane.focal}));return{doc:{...e,floors:y,objects:y[0].objects,focalPoint:y[0].focalPoint},report:i}}return{doc:{...e,objects:b[0],focalPoint:u[0].plane.focal},report:i}}var el=/^[\p{L}\p{N}]{1,4}$/u,Jb=/^([\p{L}\p{N}]{2,})[\s\-\u2013\u2014\u00b7_./]+(.+)$/u;function tl(e,t){let n=t?.trim();if(!n)return e;let o=e.toLocaleLowerCase("en-US"),i=n.toLocaleLowerCase("en-US");if(o.startsWith(`${i} `)){let a=e.slice(n.length).trim();if(el.test(a))return a}let r=Jb.exec(e);if(r){let a=r[1].toLocaleLowerCase("en-US"),s=r[2].trim();if((i.startsWith(a)||a.startsWith(i))&&el.test(s))return s}return e}var nl={inline:"Inline booth \xB7 1 open side",corner:"Corner booth \xB7 2 open sides",peninsula:"Peninsula booth \xB7 3 open sides",island:"Island booth \xB7 4 open sides"},ey=new Map(Ar.map(e=>[e.key,e.label]));function ty(e){return`picker.access.${e}`}function ol(e){let t=[],n=e.boothType;n&&Object.prototype.hasOwnProperty.call(nl,n)&&t.push({key:`booth:${n}`,icon:"booth",titleKey:`picker.boothType.${n}`,titleFallback:nl[n],tone:"place"});let o=e.wheelchairSpaceType;for(let s of e.accessibility??[]){if(s==="wheelchair"&&o)continue;let c=ey.get(s);c&&t.push({key:`access:${s}`,icon:s,titleKey:ty(s),titleFallback:c,tone:"access"})}o==="no-seat"?t.push({key:"wheelchair:no-seat",icon:"wheelchair",titleKey:"picker.emptyWheelchairSpace",titleFallback:"Empty wheelchair space",tone:"access"}):o==="seat-present"&&t.push({key:"wheelchair:seat-present",icon:"wheelchair",titleKey:"picker.accessiblePhysicalSeat",titleFallback:"Accessible physical seat",tone:"access"}),e.aisle===!0&&t.push({key:"place:aisle",icon:"aisle",titleKey:"picker.aisleSeat",titleFallback:"Aisle seat",tone:"place"});let i=e.commercial;i?.restrictedView&&t.push({key:"mark:restrictedView",icon:"restrictedView",titleKey:"picker.restrictedView",titleFallback:"Restricted view",tone:"warn"}),i?.obstructedView&&t.push({key:"mark:obstructedView",icon:"obstructedView",titleKey:"picker.obstructedView",titleFallback:"Obstructed view",tone:"warn"}),i?.premium&&t.push({key:"mark:premium",icon:"premium",titleKey:"picker.premiumSeat",titleFallback:"Premium seat",tone:"premium"});let r=i?.note?.trim();if(r){let s=t.find(c=>c.tone==="warn"||c.tone==="premium");s?s.note=r:t.push({key:"note",icon:"note",titleKey:"picker.organizerNote",titleFallback:"Organizer note",tone:"note",note:r})}let a=typeof e.entrance=="string"?e.entrance.trim():"";return a&&t.push({key:"place:entrance",icon:"entrance",titleKey:"picker.entrance",titleFallback:"Entrance",tone:"place",note:a}),t}function rl(e,t,n){return n<0?t>1?e.filter(o=>o.kind==="floor"):[...e]:e.filter(o=>o.floorIndex===void 0||o.floorIndex===n)}function il(e,t){let n=[...e].sort((i,r)=>i.screen.y-r.screen.y),o=[];for(let i of n){let r=o.find(a=>a.some(s=>Math.abs(s.screen.x-i.screen.x)<104&&Math.abs(s.screen.y-i.screen.y)<34));r?r.push(i):o.push([i])}return o.flatMap(i=>i.length<2?i:i.map((r,a)=>({...r,screen:{...r.screen,x:Math.max(54,Math.min(t-54,r.screen.x+(a-(i.length-1)/2)*104))}})))}var ny=1.15,oy=2.75,ry=4.5,iy=.85,ay=.5,sy=.26;function al(e,t,n){let o=Math.max(1e-6,t),i=e/o,r=n?.hasZoneLabels??!0,a=new Set(["stage","gate"]);return i>=.75&&a.add("floor"),i>=ny&&a.add("zone"),i<=(r?oy:ry)&&(a.add("section"),a.add("ga")),i<=iy&&(a.add("annotation"),a.add("booth")),i<=ay&&a.add("row"),i<=sy&&a.add("seat"),a}function sl(e,t,n,o,i,r=6){let a=r+t,s=o-r-t,c=r+n,l=i-r-n;return{...e,x:a>s?o/2:Math.max(a,Math.min(s,e.x)),y:c>l?i/2:Math.max(c,Math.min(l,e.y))}}function at(e,t,n,o){let i=e,r=t[0],a=t[1],s=t[2],c=i[0]*r+i[4]*a+i[8]*s+i[12],l=i[1]*r+i[5]*a+i[9]*s+i[13],u=i[2]*r+i[6]*a+i[10]*s+i[14],m=i[3]*r+i[7]*a+i[11]*s+i[15];if(!(m>1e-6))return{x:0,y:0,depth:1/0,visible:!1};let f=c/m,d=l/m,h=u/m,p=f>=-1.05&&f<=1.05&&d>=-1.05&&d<=1.05&&h<=1;return{x:(f*.5+.5)*n,y:(1-(d*.5+.5))*o,depth:h,visible:p}}function cl(e,t,n=t,o=()=>0){let i=[],r=[...e].sort((a,s)=>o(s)-o(a)||a.screen.depth-s.screen.depth);for(let a of r){let s=!1;for(let c of i)if(zn(a,c,t,n)){s=!0;break}s||i.push(a)}return i}var cy=6;function zn(e,t,n,o){let i=Math.abs(e.screen.x-t.screen.x),r=Math.abs(e.screen.y-t.screen.y),a=e.halfWidth!=null&&t.halfWidth!=null?Math.max(n,e.halfWidth+t.halfWidth+cy):n;return i<a&&r<o}function ll(e,t,n){return e.length*t*.58+(n?14:0)}var ly={row:8,seat:14};function ul(e){return e<480?{row:5,seat:8}:e<768?{row:6,seat:10}:ly}function ml(e,t,n,o){let i=Math.max(1,Math.min(n,o)*.5),r=Math.min(2,Math.hypot(e.x-n/2,e.y-o/2)/i);return t*(1+1.5*r)}function Un(e,t,n,o,i=[]){let r=[...e].sort((s,c)=>(c.priority??0)-(s.priority??0)||s.focus-c.focus),a=[];for(let s of r){if(a.length>=o)break;let c=!1;for(let l of i)if(zn(s,l,t,n)){c=!0;break}if(!c){for(let l of a)if(zn(s,l,t,n)){c=!0;break}}c||a.push(s)}return a}function di(e,t,n,o){let i=e[3]*t[0]+e[7]*t[1]+e[11]*t[2]+e[15];return i<=0||!(n>0)?0:n*Math.hypot(e[0],e[4],e[8])*o/(2*i)}var uy=1.5,my=30,fy=4,dy=3.6,hy=6,hi=15,py=3,by=1;function yy(e){return Math.max(dy,Math.min(hy,2.4+.15*e))}var jn=Math.PI*2;function gy(e,t){let n=0,o=0;for(let m of e)n+=m.x,o+=m.y;let i=Math.atan2(o/e.length-t.y,n/e.length-t.x),r=e.map(m=>{let f=Math.atan2(m.y-t.y,m.x-t.x)-i;for(;f>Math.PI;)f-=jn;for(;f<-Math.PI;)f+=jn;return f+i}),a=r.map((m,f)=>f).sort((m,f)=>r[m]-r[f]),s=r[a[0]],c=r[a[a.length-1]];if(c-s>Math.PI)return null;let l=m=>Math.hypot(m.x-t.x,m.y-t.y),u=m=>{let f=e[m],d=(m+e.length-1)%e.length,h=(m+1)%e.length,p=Math.abs(r[d]-r[m])<=Math.abs(r[h]-r[m])?d:h,b=e[p];return l(f)<=l(b)?[f,b]:[b,f]};return{start:s,end:c,startEdge:u(a[0]),endEdge:u(a[a.length-1])}}function fl(e){return e.type==="shape"&&e.role==="wall"&&e.heightM===void 0}function pi(e,t,n=()=>!0){let o=[];for(let c of e){if(!fl(c)||!n(c))continue;let l=ge(c);if(!l||l.length<3)continue;let u=gy(l,t);if(!u)return[];o.push(u)}if(o.length<2)return[];let i=e.flatMap(c=>{if(c.type!=="shape"||c.role!=="entrance"&&c.role!=="exit")return[];let l=ge(c);if(!l?.length)return[];let u=0,m=0;for(let f of l)u+=f.x,m+=f.y;return[{x:u/l.length,y:m/l.length}]}),r=c=>(c%jn+jn)%jn;o.sort((c,l)=>r(c.start)-r(l.start));let a=c=>Math.hypot(c.x-t.x,c.y-t.y),s=[];for(let c=0;c<o.length;c++){let l=o[c],u=o[(c+1)%o.length],m=r(u.start-l.end);if(m<=0||m>=Math.PI/2)continue;let f=g=>r(g-l.end)<m;if(o.some(g=>g!==l&&g!==u&&(f(g.start)||f(g.end)||r(l.end-g.start)<g.end-g.start)))continue;let[h,p]=l.endEdge,[b,y]=u.startEdge,x={x:(h.x+p.x)/2,y:(h.y+p.y)/2},S={x:(b.x+y.x)/2,y:(b.y+y.y)/2},A=Math.hypot(S.x-x.x,S.y-x.y)*C;if(A<uy||A>my||Math.abs(a(x)-a(S))*C>fy+.2*A)continue;let M={x:(x.x+S.x)/2,y:(x.y+S.y)/2};i.some(g=>f(Math.atan2(g.y-t.y,g.x-t.x))&&Math.abs(a(g)-a(M))*C<=py)||s.push({quad:[h,p,y,b],mid:M,widthM:A,openingM:yy(A)})}return s}function dl(e,t){let n=[];for(let r of t)if(r.text?.trim())for(let a of e){let s=Math.hypot(r.position.x-a.mid.x,r.position.y-a.mid.y)*C;s<=hi&&n.push({text:r,gate:a,d:s})}n.sort((r,a)=>r.d-a.d);let o=new Map,i=new Set;for(let{text:r,gate:a}of n)o.has(r.id)||i.has(a)||(o.set(r.id,a),i.add(a));return o}function hl(e,t,n,o,i,r,a,s=()=>!0){let c=pi(t,en(n),s);if(!c.length)return;let l=t.find(m=>fl(m)&&s(m)),u=To(l?.fill,a);e.setMaterial(So);for(let m of c)i-m.openingM<by||Po(e,m.quad,o+m.openingM,o+i,[],u.top,u.wall,r,i);e.setMaterial(0)}var xy=6,vy=2.2,bi=.1,My=/^(gate|entrance|entry|exit|way in|way out|door)s?$/i,Sy=new Set(["stage","entrance","exit","screen","suite","obstruction","sound","bar","concession","restroom","coat"]),wy=.3,Py=1.8,Ay=.9,Iy=.55,Ry=1,pl=4e3,Ey=6,bl="#d8a425",Cy="#e8c15a",yi="#1c1608";function yl(e){let t=_y(e);if(!t)return null;let n=ol(e).find(o=>o.icon===t.icon);return{...t,name:n?.titleFallback??t.icon}}function _y(e){let t=e.accessibility;if(t?.length)return{icon:t.includes("wheelchair")?"wheelchair":t[0],color:ao(t)};let n=e.commercial;return n?.obstructedView?{icon:"obstructedView",color:bl,ink:yi}:n?.restrictedView?{icon:"restrictedView",color:bl,ink:yi}:n?.premium?{icon:"premium",color:Cy,ink:yi}:null}function Ty(e,t){if(!e)return;let n,o=0;for(let[r,a]of e)a>o&&(o=a,n=r);let i=t.categories?.find(r=>r.key===n)?.color;return i&&/^#[0-9a-f]{6}$/i.test(i)?i:void 0}var ky=6e3,Ly=.25,gl=[-90,90,-135,135,-45,45];function Oy(e,t,n,o){let i=e.flatMap(({id:a,a:s,members:c})=>{let l=(s.minX+s.maxX)/2,u=(s.minY+s.maxY)/2,m=.5*Math.hypot(s.maxX-s.minX,s.maxY-s.minY),f=1/0;for(let d of c)f=Math.min(f,Math.hypot(t[d].x-l,t[d].y-u));return c.length&&f>=m*Ly?[{id:a,cx:l,cy:u,half:m,members:c}]:[]}).sort((a,s)=>a.half-s.half),r=new Map;return i.forEach(({id:a,cx:s,cy:c,members:l},u)=>{let m=o.x-s,f=o.y-c,p=(Math.hypot(m,f)>1e-6?Math.atan2(f,m):0)+gl[u%gl.length]*Math.PI/180,b=Math.cos(p),y=Math.sin(p),x=-1,S=-1/0;for(let A of l){let M=(t[A].x-s)*b+(t[A].y-c)*y;M>S&&(S=M,x=A)}r.set(a,[t[x].x*C,n.seatDeckY(x),t[x].y*C])}),r}function vl(e){let{doc:t,units:n,seats:o,surfaces:i,focal:r}=e,a=t.zones??[],s=[];if(a.length){let c=new Map;for(let f of n)for(let d of f.objects)d.type==="section"&&d.zone&&c.set(d.id,d.zone);let l=new Map,u=new Map;for(let f=0;f<o.length;f++){let d=o[f],h=i.seatOwner[f],p=d.zoneId??(h?c.get(h):void 0);if(!p)continue;let b=l.get(p);b||(b={n:0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0,sumY:0},l.set(p,b));let y=u.get(p);y||u.set(p,y=[]),y.push(f),b.n++,d.x<b.minX&&(b.minX=d.x),d.y<b.minY&&(b.minY=d.y),d.x>b.maxX&&(b.maxX=d.x),d.y>b.maxY&&(b.maxY=d.y),b.sumY+=i.seatDeckY(f)}let m=Oy(a.flatMap(f=>{let d=l.get(f.id);return d?[{id:f.id,a:d,members:u.get(f.id)??[]}]:[]}),o,i,r);for(let f of a){let d=l.get(f.id),h=[];for(let[p,b]of c)b===f.id&&h.push(p);if(!d||d.n===0){s.push({id:f.id,label:f.label,color:he(f.color),sectionIds:h,seatCount:0,center:[0,0,0],radius:0,focalWorld:[(f.focalPoint??r).x*C,1.5,(f.focalPoint??r).y*C]});continue}s.push({id:f.id,label:f.label,color:he(f.color),sectionIds:h,seatCount:d.n,...m.has(f.id)?{labelAt:m.get(f.id)}:{},center:[(d.minX+d.maxX)/2*C,d.sumY/d.n,(d.minY+d.maxY)/2*C],radius:.5*Math.hypot((d.maxX-d.minX)*C,(d.maxY-d.minY)*C)||1,focalWorld:[(f.focalPoint??r).x*C,1.5,(f.focalPoint??r).y*C]})}}return s}function Ml(e){let{doc:t,units:n,seats:o,surfaces:i,seatData:r,hintedSeatFloor:a,zones:s,focal:c}=e,l=[],u=[],m=[],f=new Map;for(let d of n)for(let h of d.objects){if(h.type!=="section"||!h.zone)continue;let p=(h.displayLabel||h.label||"").trim().toLocaleLowerCase();if(!p)continue;let b=t.floors?.[d.index]?.name?.trim().toLocaleLowerCase();if(n.length>1&&b===p)continue;let y=f.get(h.zone);y||f.set(h.zone,y=new Set),y.add(p)}for(let d of s)d.seatCount!==0&&(f.get(d.id)?.has(d.label.trim().toLocaleLowerCase())||l.push({id:`zone:${d.id}`,kind:"zone",text:d.label,anchor:[(d.labelAt??d.center)[0],(d.labelAt??d.center)[1]+xy,(d.labelAt??d.center)[2]],color:t.zones?.find(h=>h.id===d.id)?.color}));{let d=new Map,h=new Map,p=new Map,b=new Map;for(let y=0;y<o.length;y++){let x=i.seatOwner[y];if(!x)continue;let S=d.get(x);S||(S={n:0,x:0,y:0,deck:0},d.set(x,S)),S.n++,S.x+=o[y].x,S.y+=o[y].y,S.deck+=i.seatDeckY(y);let A=o[y].categoryKey;if(A){let g=h.get(x);g||(g=new Map,h.set(x,g)),g.set(A,(g.get(A)??0)+1)}if(o[y].accessibility?.includes("wheelchair")){let g=p.get(x);g?g.push(y):p.set(x,[y])}let M=b.get(x);M||(M={minX:1/0,maxX:-1/0,minY:1/0,maxY:-1/0,minDeck:1/0,maxDeck:-1/0},b.set(x,M)),M.minDeck=Math.min(M.minDeck,i.seatDeckY(y)),M.maxDeck=Math.max(M.maxDeck,i.seatDeckY(y)),o[y].x<M.minX&&(M.minX=o[y].x),o[y].x>M.maxX&&(M.maxX=o[y].x),o[y].y<M.minY&&(M.minY=o[y].y),o[y].y>M.maxY&&(M.maxY=o[y].y)}for(let y of n)for(let x of y.objects){if(x.type!=="section"||Kc(x))continue;let S=d.get(x.id);if(!S||S.n===0)continue;let A=b.get(x.id),M=[S.x/S.n*C,S.deck/S.n,S.y/S.n*C],g=x.displayLabel||x.label||x.id;u.push({id:x.id,floorIndex:y.index,label:g,seatCount:S.n,center:M,radius:Math.max(1,Math.hypot(A.maxX-A.minX,A.maxY-A.minY)*.5*C),box:{min:[A.minX*C-.4,A.minDeck,A.minY*C-.4],max:[A.maxX*C+.4,A.maxDeck+1,A.maxY*C+.4]},focalWorld:[y.focal.x*C,y.baseHeightM+1.5,y.focal.y*C]});let P=t.floors?.[y.index]?.name?.trim().toLocaleLowerCase();if(!(n.length>1&&P===g.trim().toLocaleLowerCase())){let v=Ty(h.get(x.id),t),w=p.get(x.id);l.push({id:`section:${x.id}`,kind:"section",text:g,anchor:[M[0],M[1]+vy,M[2]],floorIndex:y.index,...v?{tint:v}:{},...w?{wheelchairSeats:w}:{}})}}}{for(let M of n)for(let g of M.objects){if(g.type!=="gaArea")continue;let P=Kt(g.points);if(!P)continue;let v=g.labelPresentation?.visible===!1?"":g.displayLabel||g.label||g.id,w=g.capacity>0?[v,g.capacity.toLocaleString()].filter(Boolean).join(" \xB7 "):v;w&&l.push({id:`ga:${g.id}`,kind:"ga",text:w,anchor:[P.x*C,M.baseHeightM+Py,P.y*C],floorIndex:M.index})}let d=new Map,h=new Map;for(let M of n)for(let g of M.objects)if(g.type==="section"&&d.set(g.id,g.displayLabel||g.label||g.id),g.type==="row"){let P=g.displayLabel?.trim()||g.segmentedRow?.displayLabel?.trim();P&&h.set(g.id,P)}let p=new Map;for(let M=0;M<o.length;M++){let g=o[M],P=Math.hypot(g.x-c.x,g.y-c.y),v=p.get(g.rowId);(!v||P>v.far)&&p.set(g.rowId,{seat:g,index:M,far:P})}for(let[M,g]of p){let P=i.seatOwner[g.index]??g.seat.sectionId,v=xl(g.seat.label,M,d.get(P??""),h.get(M));v&&l.push({id:`row:${M}`,kind:"row",text:v,anchor:[g.seat.x*C,i.seatDeckY(g.index)+Ay,g.seat.y*C],floorIndex:a[g.index]})}let b=new Map;for(let M=0;M<o.length;M++){let g=o[M],P=b.get(g.rowId);P||(P={n:0,x:0,y:0,z:0,minX:1/0,maxX:-1/0,minZ:1/0,maxZ:-1/0,label:xl(g.label,g.rowId,d.get(i.seatOwner[M]??g.sectionId??""),h.get(g.rowId)),sectionId:i.seatOwner[M]??g.sectionId},b.set(g.rowId,P));let v=M*3,w=r.iPosition[v],R=r.iPosition[v+1],_=r.iPosition[v+2];P.n++,P.x+=w,P.y+=R,P.z+=_,P.minX=Math.min(P.minX,w),P.maxX=Math.max(P.maxX,w),P.minZ=Math.min(P.minZ,_),P.maxZ=Math.max(P.maxZ,_)}for(let[M,g]of b)m.push({id:M,label:g.label,sectionId:g.sectionId,seatCount:g.n,center:[g.x/g.n,g.y/g.n,g.z/g.n],radius:Math.max(.8,Math.hypot(g.maxX-g.minX,g.maxZ-g.minZ)*.5)});let y=0,x=(M,g)=>{y++,l.push({id:`access:${o[M].id}`,kind:"access",text:g.name,icon:g.icon,color:g.color,...g.ink?{ink:g.ink}:{},seatWidthM:r.iChairWidth[M]*2,anchor:[o[M].x*C,i.seatDeckY(M)+Ry,o[M].y*C],floorIndex:a[M],rowId:o[M].rowId})},S=null,A=()=>{if(S){let M=yl(o[S.seats[0]]),g=S.seats.length,P=Math.max(1,Math.round(g/Ey));for(let v=0;v<P&&y<pl;v++)x(S.seats[Math.min(g-1,Math.floor((v+.5)*g/P))],M)}S=null};for(let M=0;M<o.length&&y<pl;M++){let g=yl(o[M]);if(g&&o[M].accessibility?.length){A(),x(M,g);continue}if(!g){A();continue}S&&S.rowId===o[M].rowId&&S.icon===g.icon?S.seats.push(M):(A(),S={rowId:o[M].rowId,icon:g.icon,seats:[M]})}if(A(),o.length<=ky)for(let M=0;M<o.length;M++){let g=o[M],P=gi(g.displayLabel||g.label);P&&l.push({id:`seat:${g.id}`,kind:"seat",seatWidthM:r.iChairWidth[M]*2,text:P,anchor:[g.x*C,i.seatDeckY(M)+Iy,g.y*C],floorIndex:a[M],rowId:g.rowId})}}for(let d of n){let h=Mt(d,n.length===1?o:o.filter((y,x)=>a[x]===d.index)),p=h?dl(pi(d.objects,en(h)),d.objects.filter(y=>y.type==="text")):new Map,b=[...p.values()];for(let y of d.objects){let x=y.type==="text"?p.get(y.id):void 0;if(y.type==="shape"&&(y.role==="entrance"||y.role==="exit")&&My.test(y.label?.trim()??"")){let S=ge(y),A=S?Kt(S):null;if(A&&b.some(M=>Math.hypot(A.x-M.mid.x,A.y-M.mid.y)*C<=hi+M.widthM))continue}if(x&&y.type==="text")l.push({id:`text:${y.id}`,kind:"gate",text:y.text,icon:"entrance",anchor:[x.mid.x*C,d.baseHeightM+x.openingM+bi,x.mid.y*C],color:y.color,floorIndex:d.index});else if(y.type==="shape"&&y.role&&Sy.has(y.role)){let S=ge(y),A=S?Kt(S):null;if(!A||!y.label)continue;l.push({id:`architecture:${y.id}`,kind:y.role==="stage"?"stage":y.role==="entrance"||y.role==="exit"?"gate":"annotation",text:y.label,...y.role==="entrance"||y.role==="exit"?{icon:y.role}:{},anchor:[A.x*C,d.baseHeightM+Qe(y).heightM+bi,A.y*C],color:y.fill,floorIndex:d.index})}else if(y.type==="text"){if(!y.text)continue;l.push({id:`text:${y.id}`,kind:"annotation",text:y.text,anchor:[y.position.x*C,d.baseHeightM+bi,y.position.y*C],color:y.color,rotation:y.rotation,floorIndex:d.index})}else if(y.type==="booth"){if(y.labelPresentation?.visible===!1)continue;let S=Je(y);if(!S)continue;let A=Kt(S);if(!A)continue;l.push({id:`booth:${y.id}`,kind:"booth",text:y.displayLabel||y.label||y.id,anchor:[A.x*C,d.baseHeightM+ko+wy,A.y*C],floorIndex:d.index})}}}return{labels:l,sections:u,rows:m}}function Sl(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 gi(e){let t=e.lastIndexOf("-");return t>=0&&t<e.length-1?e.slice(t+1):e}function xl(e,t,n,o){if(o?.trim())return o.trim();let i=e?e.lastIndexOf("-"):-1,r=i>0?e.slice(0,i):t;return r&&tl(r,n)}function wl(e){let{doc:t,units:n,seats:o,surfaces:i,solids:r,hintedSeatFloor:a,seatFloor:s}=e,c=[];{let l=n.map(()=>({minX:1/0,minY:1/0,minZ:1/0,maxX:-1/0,maxY:-1/0,maxZ:-1/0}));for(let f=0;f<r.floor.length;f+=1){let d=Math.max(0,Math.min(n.length-1,Math.round(r.floor[f]))),h=f*3,p=l[d];p.minX=Math.min(p.minX,r.position[h]),p.minY=Math.min(p.minY,r.position[h+1]),p.minZ=Math.min(p.minZ,r.position[h+2]),p.maxX=Math.max(p.maxX,r.position[h]),p.maxY=Math.max(p.maxY,r.position[h+1]),p.maxZ=Math.max(p.maxZ,r.position[h+2])}let u=new Map;for(let f=0;f<n.length;f++)for(let d of n[f].objects)d.type==="section"&&u.set(d.id,f);let m=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 f=0;f<o.length;f++){let d=i.seatOwner[f],h=(d!==null?u.get(d):void 0)??a[f];if(h===void 0)continue;let p=m[h],b=o[f];p.n++,b.x<p.minX&&(p.minX=b.x),b.y<p.minY&&(p.minY=b.y),b.x>p.maxX&&(p.maxX=b.x),b.y>p.maxY&&(p.maxY=b.y);let y=i.seatDeckY(f);p.sumX+=b.x*C,p.sumDeck+=y,p.sumZ+=b.y*C,p.minDeck=Math.min(p.minDeck,y),p.maxDeck=Math.max(p.maxDeck,y+1.6),s[f]=h}for(let f=0;f<n.length;f++){let d=m[f],h=t.floors?.[f],p=l[f],b=Math.min(d.n?d.minX*C:n[f].focal.x*C-1,Number.isFinite(p.minX)?p.minX:1/0),y=Math.max(d.n?d.maxX*C:n[f].focal.x*C+1,Number.isFinite(p.maxX)?p.maxX:-1/0),x=Math.min(d.n?d.minY*C:n[f].focal.y*C-1,Number.isFinite(p.minZ)?p.minZ:1/0),S=Math.max(d.n?d.maxY*C:n[f].focal.y*C+1,Number.isFinite(p.maxZ)?p.maxZ:-1/0),A=Math.min(d.n?Math.min(n[f].baseHeightM,d.minDeck):n[f].baseHeightM,Number.isFinite(p.minY)?p.minY:1/0),M=Math.max(d.n?Math.max(d.maxDeck,A+.5):A+.5,Number.isFinite(p.maxY)?p.maxY:-1/0),g=[d.n?d.sumX/d.n:(b+y)/2,d.n?d.sumDeck/d.n:(A+M)/2,d.n?d.sumZ/d.n:(x+S)/2],P=Math.max(1,.5*Math.hypot(y-b,M-A,S-x));c.push({index:f,id:h?.id??`floor-${f}`,label:h?.name??(n.length>1?`Floor ${f+1}`:"Venue"),seatCount:d.n,center:g,radius:P,box:{min:[b,A,x],max:[y,M,S]},focalWorld:[n[f].focal.x*C,n[f].baseHeightM+1.5,n[f].focal.y*C]})}}return c}function xi(e,t){let n=1/0,o=1/0,i=-1/0,r=-1/0,a=(s,c)=>{s<n&&(n=s),c<o&&(o=c),s>i&&(i=s),c>r&&(r=c)};for(let s of t)a(s.x,s.y);for(let s of e)for(let c of s.objects)if(c.type==="section")for(let l of c.outline)a(l.x,l.y);else if(c.type==="shape"&&c.points)for(let l of c.points)a(l.x,l.y);else if(c.type==="gaArea")for(let l of c.points)a(l.x,l.y);else if(c.type==="booth"){let l=Je(c);if(l)for(let u of l)a(u.x,u.y)}else if(c.type==="table"){let l=Lo(c);if(l)for(let u of l)a(u.x,u.y)}else if(c.type==="decorImage"){let l=Oo(c);if(l)for(let u of l)a(u.x,u.y)}return Number.isFinite(n)||(n=-100,o=-100,i=100,r=100),{minX:n,minY:o,maxX:i,maxY:r}}function Cl(e,t,n,o,i,r,a){if(t.length===1){let s=n.map(f=>({x:f.x,y:f.y}));for(let f of t[0].objects)f.type==="section"?s.push(...f.outline):f.type==="shape"?s.push(...ge(f)??f.points??[]):f.type==="gaArea"?s.push(...f.points):f.type==="booth"?s.push(...Je(f)??[]):f.type==="table"?s.push(...Lo(f)??[]):f.type==="decorImage"&&s.push(...Oo(f)??[]);if(Il(e,t[0],n,r)||El(e,t[0],n,s,r))return!1;if(a&&Al(e,t[0].baseHeightM,s,r,a))return!0;let c=Fn(s),l=(i.minX+i.maxX)/2,u=(i.minY+i.maxY)/2,m=c.length>=3?c.map(f=>{let d=f.x-l,h=f.y-u,p=Math.max(1,Math.hypot(d,h));return{x:f.x+d/p*80,y:f.y+h/p*80}}):En(i.minX-28,i.minY-28,i.maxX-i.minX+56,i.maxY-i.minY+56);return ue(e,m,void 0,()=>-.04,-.22,r.ground,r.ground,ae),!1}else{let s=t.reduce((b,y)=>y.baseHeightM<b.baseHeightM?y:b);e.setFloor(s.index);let c={...s,objects:t.flatMap(b=>b.objects)},l=n.map(b=>({x:b.x,y:b.y}));for(let b of c.objects)b.type==="section"&&l.push(...b.outline);if(Il(e,c,n,r)||El(e,c,n,l,r))return!1;if(a&&Al(e,s.baseHeightM,l,r,a))return!0;let u=n.filter((b,y)=>o[y]===s.index),m=xi([s],u),f=Math.hypot(m.maxX-m.minX,m.maxY-m.minY),d=Math.max(28,Math.min(80,f*.04)),h=En(m.minX-d,m.minY-d,m.maxX-m.minX+d*2,m.maxY-m.minY+d*2),p=s.baseHeightM-.03;return ue(e,h,void 0,()=>p,p-.22,r.ground,r.ground,ae),!1}}function vi(e,t,n,o){let{cx:i,cz:r,radius:a}=n,s=1/0,c=1/0,l=1/0,u=-1/0,m=-1/0,f=-1/0,d=(b,y,x)=>{s=Math.min(s,b),u=Math.max(u,b),c=Math.min(c,y),m=Math.max(m,y),l=Math.min(l,x),f=Math.max(f,x)};for(let b=0;b<e.position.length;b+=3){let y=b/3;o&&y>=o[0]&&y<o[1]||d(e.position[b],e.position[b+1],e.position[b+2])}for(let b=0;b<t.count;b++){let y=b*3,x=t.iPosition[y],S=t.iPosition[y+1],A=t.iPosition[y+2],M=Math.max(.35,t.iMaxRadius[b]??.35);d(x-M,S,A-M),d(x+M,S+1.6,A+M)}Number.isFinite(s)||(s=i-a,u=i+a,c=0,m=a*.16,l=r-a,f=r+a);let h=[(s+u)/2,(c+m)/2,(l+f)/2],p=Math.max(1,.5*Math.hypot(u-s,m-c,f-l));return{center:h,radius:p,minY:c,maxY:m}}var Fy=4096;function _l(e,t,n=[]){let o=Math.max(1,Math.ceil(e.count/Fy)),i=Math.ceil(e.count/o),r=new Float32Array((i*2+t.length*4+n.length)*3),a=0;for(let s=0;s<e.count;s+=o){let c=e.iPosition[s*3],l=e.iPosition[s*3+1],u=e.iPosition[s*3+2];r[a++]=c,r[a++]=l,r[a++]=u,r[a++]=c,r[a++]=0,r[a++]=u}for(let[s,c,l]of n)r[a++]=s,r[a++]=c,r[a++]=l;for(let s of t)for(let[c,l]of[[-1,-1],[1,-1],[1,1],[-1,1]])r[a++]=s.cx+c*s.halfX,r[a++]=s.y,r[a++]=s.cz+l*s.halfZ;return r.subarray(0,a)}function Tl(e,t,n,o,i,r,a=[]){let s=1/0,c=1/0,l=-1/0,u=-1/0;for(let M=0;M<e.count;M++){let g=M*3,P=e.iPosition[g],v=e.iPosition[g+2];P<s&&(s=P),P>l&&(l=P),v<c&&(c=v),v>u&&(u=v)}for(let[M,,g]of a)M<s&&(s=M),M>l&&(l=M),g<c&&(c=g),g>u&&(u=g);for(let M of t)s=Math.min(s,M.cx-M.halfX),l=Math.max(l,M.cx+M.halfX),c=Math.min(c,M.cz-M.halfZ),u=Math.max(u,M.cz+M.halfZ);let m=n.minX*C,f=n.maxX*C,d=n.minY*C,h=n.maxY*C,p=m,b=f,y=d,x=h;if(Number.isFinite(s)){let M=Math.max(2,.06*Math.hypot(l-s,u-c));p=Math.max(m,s-M),b=Math.min(f,l+M),y=Math.max(d,c-M),x=Math.min(h,u+M)}let S=Math.min(0,o),A=Math.max(i,r*.05);return{min:[p,S,y],max:[b,A,x]}}var Pl=12,Dy=.6,Ny=40;function Al(e,t,n,o,i){let r=Fn([...n]);if(r.length<3)return!1;let a=1/0,s=1/0,c=-1/0,l=-1/0;for(let A of r)a=Math.min(a,A.x),c=Math.max(c,A.x),s=Math.min(s,A.y),l=Math.max(l,A.y);let u=Math.hypot(c-a,l-s)*C,m=Ze(r,Pl/C,1.2),f=Math.max(Ny,u*Dy),d=Ze(r,(Pl+f)/C,1.2);if(m.length!==d.length)return!1;let h=be(o.ground,[.78,.76,.72],.35),p=be(o.ground,[.56,.62,.52],.3);ue(e,m,void 0,()=>t-.04,t-.22,h,h,ae);let b=t-.05,y=m.map(A=>[A.x*C,b,A.y*C]),x=d.map(A=>[A.x*C,b,A.y*C]),S=[0,1,0];for(let A=0;A<y.length;A++){let M=(A+1)%y.length;e.tri(y[A],x[M],x[A],S,p,i,i),e.tri(y[A],y[M],x[M],S,p,p,i)}return!0}function Il(e,t,n,o){let i=Mt(t,n);if(!i)return!1;let r=t.baseHeightM,a=be(o.ground,[.62,.55,.47],.4);return ue(e,i,void 0,()=>r-.04,r-.22,a,a,ae),!0}var By=3e3,Vy=20,Rl=1.5,Gy=1.2,Hy=.25;function El(e,t,n,o,i){if(!n.length||n.length>By||o.length<3)return!1;for(let w of t.objects){if(w.type==="shape"&&mo(w.stageKind))return!1;if(w.type==="section"){let{height:R}=yt(w,{floorBaseHeightM:t.baseHeightM});if(R-t.baseHeightM>Vy)return!1}}let r=0,a=0;for(let w of o)r+=w.x,a+=w.y;r/=o.length,a/=o.length;let s=0,c=0,l=0;for(let w of o){let R=w.x-r,_=w.y-a;s+=R*R,c+=_*_,l+=R*_}let u=.5*Math.atan2(2*l,s-c),m=Math.cos(u),f=Math.sin(u),d=-f,h=m,p=1/0,b=-1/0,y=1/0,x=-1/0;for(let w of o){let R=(w.x-r)*m+(w.y-a)*f,_=(w.x-r)*d+(w.y-a)*h;p=Math.min(p,R),b=Math.max(b,R),y=Math.min(y,_),x=Math.max(x,_)}let S=w=>[[p-w,y-w],[b+w,y-w],[b+w,x+w],[p-w,x+w]].map(([R,_])=>({x:r+m*R+d*_,y:a+f*R+h*_})),A=S(Rl/C),M=S((Rl+Hy)/C),g=t.baseHeightM,P=be(i.ground,[.62,.55,.47],.4),v=be(i.ground,[.86,.86,.84],.55);return ue(e,M,void 0,()=>g-.04,g-.22,P,P,ae),ue(e,M,[A.slice().reverse()],()=>g+Gy,g-.04,be(v,[1,1,1],.2),v,ae),!0}function kl(e,t,n){let o=()=>({byObjectId:new Map,elements:[]});if(!t||!e)return o();let i=fs(t);if(!i.ok||i.value.id!==e)return o();let r=new Map;for(let m of n)for(let f of m.objects)f.type==="shape"&&r.set(f.id,{shape:f,unit:m});let a=new Set,s=new Set,c=new Map((t.overlay.productionElements??[]).map(m=>{let f=m.runtimeContentImageUrl;return[m.id,typeof f=="string"&&/^(?:blob:|data:image\/|https:\/\/)/.test(f)?f:void 0]})),l=[];for(let m of i.value.overlay.productionElements??[]){let f=r.get(m.objectId),d=f?ge(f.shape):null,h=m.baseElevationM??0;if(!f||!d||d.length<3||!m.id||a.has(m.id)||s.has(m.objectId)||!Number.isFinite(m.heightM)||m.heightM<.05||m.heightM>50||!Number.isFinite(h)||h<-10||h>100)return o();a.add(m.id),s.add(m.objectId);let p=d.map(v=>v.x*C),b=d.map(v=>v.y*C),y=f.unit.baseHeightM+h,x=Math.min(...p),S=Math.max(...p),A=Math.min(...b),M=Math.max(...b),g,P=c.get(m.id)??m.contentImageUrl;if(m.kind==="screen"&&P&&(g=ec(d,y,y+m.heightM,f.unit.focal),!g))if(S-x>=M-A){let v=Math.abs(A-f.unit.focal.y*C)<=Math.abs(M-f.unit.focal.y*C)?A-.006:M+.006;g=[[x,y,v],[S,y,v],[x,y+m.heightM,v],[S,y+m.heightM,v]]}else{let v=Math.abs(x-f.unit.focal.x*C)<=Math.abs(S-f.unit.focal.x*C)?x-.006:S+.006;g=[[v,y,A],[v,y,M],[v,y+m.heightM,A],[v,y+m.heightM,M]]}l.push({id:m.id,objectId:m.objectId,kind:m.kind,floorIndex:f.unit.index,baseY:y,topY:y+m.heightM,bounds:{min:[x,y,A],max:[S,y+m.heightM,M]},occlusion:m.occlusion,...P?{contentImageUrl:P}:{},...g?{contentPlane:g}:{}})}let u=l.sort((m,f)=>m.id.localeCompare(f.id));return{byObjectId:new Map(u.map(m=>[m.objectId,m])),elements:u}}var Ll=[.13,.14,.17],an=[.4,.43,.47],zy=.18,Uy=.02,jy=2.4,Wy=1500,Xy=240,Yy=.25;function Ol(e,t,n,o){let i=t.stageKind??"";if(Dt(i)||i==="round"||!o.length)return;let r=ge(t);if(!r||r.length<3)return;let a={x:r.reduce((L,V)=>L+V.x,0)/r.length,y:r.reduce((L,V)=>L+V.y,0)/r.length},s=0,c=0,l=new Set;for(let L of o)s+=L.x,c+=L.y,l.add(Math.floor(Math.atan2(L.y-a.y,L.x-a.x)*180/Math.PI/10));let u=a.x-s/o.length,m=a.y-c/o.length,f=Math.hypot(u,m);if(f<1e-6)return;let d=o.reduce((L,V)=>L+Math.hypot(V.x-a.x,V.y-a.y),0)/o.length;if(l.size*10>Xy&&f<Yy*d)return;let h=u/f,p=m/f,b=-p,y=h,x=-1/0,S=1/0,A=1/0,M=-1/0;for(let L of r){let V=(L.x-a.x)*h+(L.y-a.y)*p,O=(L.x-a.x)*b+(L.y-a.y)*y;x=Math.max(x,V),S=Math.min(S,V),A=Math.min(A,O),M=Math.max(M,O)}let g=(M-A)*C,P=(x-S)*C;if(g<3||P<1.5||g*P>Wy)return;let v=zy/C,w=(L,V)=>({x:a.x+h*L+b*V,y:a.y+p*L+y*V}),R=(L,V,O,H)=>[w(L,O),w(L,H),w(V,H),w(V,O)],_=n+Math.max(3.5,Math.min(8,g*.35)),F=n+Math.min(jy,_-n-1),E=.2/C,I=S+Math.min(P*.25,1.5)/C,T=Uy/C;ue(e,R(x-2*v+T,x-v-T,A+v+E,M-v-E),void 0,()=>F,n,Ll,Ll,ae);for(let[L,V]of[[A+v,A+v+E],[M-v-E,M-v]])ue(e,R(x-2*v,x-v,L,V),void 0,()=>_+.3,n,an,an,ae),ue(e,R(I+E,x-2*v,L,V),void 0,()=>_+.3,_,an,an,ae);ue(e,R(I,I+E,A+v,M-v),void 0,()=>_+.3,_,an,an,ae)}function Ue(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function ze(e){return Array.isArray(e)?e:[]}function Ky(e){let t=[e];for(;t.length;){let n=t.pop();if(Array.isArray(n)){t.push(...n);continue}if(!Ue(n))continue;let o=Ue(n.extensions)?n.extensions:null;if(o&&Object.prototype.hasOwnProperty.call(o,"KHR_draco_mesh_compression"))return!0;t.push(...Object.values(n))}return!1}function Vo(e,t){return!Array.isArray(e)||e.length!==t||!e.every(n=>typeof n=="number"&&Number.isFinite(n))?null:e}function $y(){return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}function qy(e,t){let n=new Array(16).fill(0);for(let o=0;o<4;o++)for(let i=0;i<4;i++)for(let r=0;r<4;r++)n[o*4+i]+=e[r*4+i]*t[o*4+r];return n}function Zy(e){let t=Vo(e.matrix,16);if(t)return t;if(e.matrix!==void 0)return null;let n=e.translation===void 0?[0,0,0]:Vo(e.translation,3),o=e.rotation===void 0?[0,0,0,1]:Vo(e.rotation,4),i=e.scale===void 0?[1,1,1]:Vo(e.scale,3);if(!n||!o||!i)return null;let[r,a,s,c]=o,l=Math.hypot(r,a,s,c);if(!(l>1e-8))return null;let u=r/l,m=a/l,f=s/l,d=c/l,h=u+u,p=m+m,b=f+f,y=u*h,x=u*p,S=u*b,A=m*p,M=m*b,g=f*b,P=d*h,v=d*p,w=d*b;return[(1-(A+g))*i[0],(x+w)*i[0],(S-v)*i[0],0,(x-w)*i[1],(1-(y+g))*i[1],(M+P)*i[1],0,(S+v)*i[2],(M-P)*i[2],(1-(y+A))*i[2],0,n[0],n[1],n[2],1]}function Qy(e,t,n,o){return[e[0]*t+e[4]*n+e[8]*o+e[12],e[1]*t+e[5]*n+e[9]*o+e[13],e[2]*t+e[6]*n+e[10]*o+e[14]]}function Jy(e){let t=e[0],n=e[4],o=e[8],i=e[1],r=e[5],a=e[9],s=e[2],c=e[6],l=e[10],u=r*l-a*c,m=a*s-i*l,f=i*c-r*s,d=t*u+n*m+o*f;if(Math.abs(d)<1e-12)return null;let h=1/d;return[u*h,m*h,f*h,(o*c-n*l)*h,(t*l-o*s)*h,(n*s-t*c)*h,(n*a-o*r)*h,(o*i-t*a)*h,(t*r-n*i)*h]}function Fl(e,t,n,o){let i=e[0]*t+e[1]*n+e[2]*o,r=e[3]*t+e[4]*n+e[5]*o,a=e[6]*t+e[7]*n+e[8]*o,s=Math.hypot(i,r,a)||1;return i/=s,r/=s,a/=s,[i,r,a]}function e0(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,o=null,i=null;for(;n+8<=e.byteLength;){let r=t.getUint32(n,!0),a=t.getUint32(n+4,!0);if(n+=8,r%4!==0||n+r>e.byteLength)return null;let s=e.subarray(n,n+r);if(a===1313821514&&!o)try{let c=JSON.parse(new TextDecoder().decode(s).replace(/[\u0000 ]+$/g,""));if(!Ue(c))return null;o=c}catch{return null}else if(a===5130562&&!i)i=s;else return null;n+=r}return n===e.byteLength&&o&&i?{json:o,bin:i}:null}function t0(e){return e===5120||e===5121?1:e===5122||e===5123?2:e===5125||e===5126?4:0}function n0(e){return e==="SCALAR"?1:e==="VEC2"?2:e==="VEC3"?3:e==="VEC4"?4:0}function o0(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 r0(e){let t=e instanceof Uint8Array?e:new Uint8Array(e),n=e0(t);if(!n)return{ok:!1,issue:"invalid_glb"};let{json:o,bin:i}=n;if(!Ue(o.asset)||o.asset.version!=="2.0")return{ok:!1,issue:"unsupported_glb"};let r=ze(o.extensionsUsed).filter(A=>typeof A=="string");if(r.includes("KHR_draco_mesh_compression")||Ky(o))return{ok:!1,issue:"draco_not_allowed"};if(r.length||ze(o.extensionsRequired).length)return{ok:!1,issue:"unsupported_glb"};if(ze(o.images).length||ze(o.textures).length)return{ok:!1,issue:"external_resource"};let a=ze(o.buffers);if(a.length!==1||!Ue(a[0])||a[0].uri!==void 0||typeof a[0].byteLength!="number"||!Number.isInteger(a[0].byteLength)||a[0].byteLength<0||a[0].byteLength>i.byteLength)return{ok:!1,issue:"external_resource"};let s=ze(o.accessors),c=ze(o.bufferViews),l=ze(o.meshes),u=ze(o.nodes),m=ze(o.scenes),f=typeof o.scene=="number"?o.scene:0;if(!Ue(m[f]))return{ok:!1,issue:"unsupported_glb"};let d=new DataView(i.buffer,i.byteOffset,i.byteLength),h=(A,M,g)=>{if(typeof A!="number"||!Number.isInteger(A)||!Ue(s[A]))return null;let P=s[A];if(P.type!==M||P.sparse!==void 0||P.normalized===!0||typeof P.count!="number"||!Number.isInteger(P.count)||P.count<1||typeof P.componentType!="number"||!g.includes(P.componentType)||typeof P.bufferView!="number")return null;let v=c[P.bufferView];if(!Ue(v)||v.buffer!==0||typeof v.byteLength!="number"||!Number.isInteger(v.byteLength)||v.byteLength<0)return null;let w=n0(P.type),R=t0(P.componentType),_=typeof v.byteStride=="number"?v.byteStride:w*R,F=typeof v.byteOffset=="number"?v.byteOffset:0,E=typeof P.byteOffset=="number"?P.byteOffset:0,I=F+E,T=E+(P.count-1)*_+w*R;if(!Number.isInteger(_)||!Number.isInteger(F)||!Number.isInteger(E)||_<w*R||F<0||E<0||F+v.byteLength>i.byteLength||T>v.byteLength)return null;let L=[];for(let V=0;V<P.count;V++){let O=[];for(let H=0;H<w;H++){let j=o0(d,I+V*_+H*R,P.componentType);if(!Number.isFinite(j))return null;O.push(j)}L.push(O)}return L},p=[],b=[],y=0,x=new Set,S=(A,M)=>{if(typeof A!="number"||!Number.isInteger(A)||!Ue(u[A])||x.has(A))return!1;x.add(A);let g=u[A],P=Zy(g);if(!P)return!1;let v=qy(M,P),w=Jy(v);if(!w)return!1;if(g.mesh!==void 0){if(typeof g.mesh!="number")return!1;let R=l[g.mesh];if(!Ue(R))return!1;for(let _ of ze(R.primitives)){if(!Ue(_)||_.mode!==void 0&&_.mode!==4||!Ue(_.attributes))return!1;let F=h(_.attributes.POSITION,"VEC3",[5126]),E=_.attributes.NORMAL===void 0?null:h(_.attributes.NORMAL,"VEC3",[5126]);if(!F||_.attributes.NORMAL!==void 0&&!E)return!1;let I=F.length;if(_.indices!==void 0){let L=typeof _.indices=="number"?s[_.indices]:null;I=Ue(L)?L.count:void 0}if(typeof I!="number"||!Number.isInteger(I)||I%3!==0||(y+=I/3,y>1e5))return!1;let T=_.indices===void 0?F.map((L,V)=>[V]):h(_.indices,"SCALAR",[5121,5123,5125]);if(!T||T.length%3!==0||T.length!==I)return!1;for(let L=0;L<T.length;L+=3){let V=[T[L][0],T[L+1][0],T[L+2][0]];if(V.some(j=>!Number.isInteger(j)||j<0||j>=F.length))return!1;let O=V.map(j=>Qy(v,...F[j])),H=null;if(!E){let j=O[1][0]-O[0][0],N=O[1][1]-O[0][1],k=O[1][2]-O[0][2],B=O[2][0]-O[0][0],D=O[2][1]-O[0][1],G=O[2][2]-O[0][2];H=Fl([1,0,0,0,1,0,0,0,1],N*G-k*D,k*B-j*G,j*D-N*B)}for(let j=0;j<3;j++)p.push(...O[j]),b.push(...E?Fl(w,...E[V[j]]):H)}}}for(let R of ze(g.children))if(!S(R,v))return!1;return x.delete(A),!0};for(let A of ze(m[f].nodes))if(!S(A,$y()))return{ok:!1,issue:y>1e5?"triangle_limit":"unsupported_glb"};return!y||p.length!==y*9||b.length!==p.length?{ok:!1,issue:"unsupported_glb"}:{ok:!0,triangleCount:y,position:new Float32Array(p),normal:new Float32Array(b)}}function Dl(e){try{return r0(e)}catch{return{ok:!1,issue:"invalid_glb"}}}function sn(e){let{doc:t}=e,n=$a(t.theme),o=n.structure,i=zs(t,e.eventConfigurationId??t.eventConfigurationId),r=kl(e.eventConfigurationId,e.eventConfiguration,i),a=e.seats,s=new lo,c=null;if(e.registeredShellGlb){let X=Dl(e.registeredShellGlb);if(X.ok){let Y=X.position.length/3,K=new Float32Array(X.position.length),re=n.materials.shell??o.tierWall;for(let ne=0;ne<Y;ne++){let se=X.normal[ne*3+1],J=se<-.25?.4:.62+.38*Math.max(0,se);K[ne*3]=re[0]*J,K[ne*3+1]=re[1]*J,K[ne*3+2]=re[2]*J}c={position:X.position,normal:X.normal,color:K,floor:new Float32Array(Y).fill(-2),material:new Float32Array(Y),count:Y}}}let l=new Map;for(let X of i)for(let Y of X.objects)l.set(Y.id,X.index),Y.type==="section"&&l.set(Y.logicalSectionId??Y.id,X.index);let u=a.map(X=>l.get(X.sectionId??"")??l.get(X.rowId??"")??0),m=xi(i,a),f=s.vertexCount,h=Cl(s,i,a,u,m,o,be(n.background.top,n.background.bottom,.5))?s.vertexCount:f,p=Es(t,a),b=new Map,y=new Map;for(let X of t.categories??[])b.set(X.key,X.color),X.seatGlyph&&y.set(X.key,X.seatGlyph);let x=[],S=Js(i,a,u),A=new Map;a.forEach((X,Y)=>{let K=S.seatDeckY(Y);Number.isFinite(K)&&A.set(X.rowId,Math.min(A.get(X.rowId)??1/0,K))});let M=new Float32Array(a.length),g=[],P=new Map((t.floors??[]).map((X,Y)=>[X.id,Y])),v=i.map(()=>[]);for(let X of a){let Y=X.floorId?P.get(X.floorId)??0:0;v[Math.min(Y,v.length-1)]?.push(X)}let w=(X,Y)=>{if(!Y||Y.length<3)return!1;let K=Math.min(...Y.map(J=>J.x)),re=Math.max(...Y.map(J=>J.x)),ne=Math.min(...Y.map(J=>J.y)),se=Math.max(...Y.map(J=>J.y));for(let J=0;J<X;J++)for(let ie of v[J])if(!(ie.x<K||ie.x>re||ie.y<ne||ie.y>se)&&Le(ie,Y,void 0))return!0;return!1},R=null,_=X=>i.length===1?a:a.filter((Y,K)=>u[K]===X),F=(X,Y)=>{let K=Je(X);if(!K)return!1;let re=1/0,ne=1/0,se=-1/0,J=-1/0;for(let ie of K)re=Math.min(re,ie.x),se=Math.max(se,ie.x),ne=Math.min(ne,ie.y),J=Math.max(J,ie.y);return a.some((ie,Pe)=>ie.kind!=="booth"&&(i.length===1||u[Pe]===Y)&&ie.x>re&&ie.x<se&&ie.y>ne&&ie.y<J&&Ge(K,ie.x,ie.y))},E;for(let X=0;X<i.length;X++){let Y=i[X];s.setFloor(X);let K=Mt(Y,_(X)),re=0;if(K){let te=0;for(let xe of Y.objects)if(xe.type==="section")for(let ve of S.bySection.get(xe.id)?.rowLevels??[])te=Math.max(te,ve.y-Y.baseHeightM);if(re=Ks(te),!E){let xe=en(K);E={centre:[xe.x*C,xe.y*C]}}}let ne=new vo,se=[],J=Y.objects.filter(te=>te.type==="shape"&&(te.role==="entrance"||te.role==="exit")),ie=Y.objects.filter(te=>te.type==="section"&&!!te.outline&&te.outline.length>=3),Pe=Ac(Y.objects.filter(te=>te.type==="booth"),Y.focal);for(let te of Y.objects)if(te.type==="section"){let xe=s.vertexCount;Hc(s,te,Y,Cs(te,p),S.bySection.get(te.id),ne,ie,o,X>0&&w(X,te.outline));let ve=s.vertexCount-xe;ve>0&&g.push({sectionId:te.id,start:xe,count:ve})}else if(te.type==="shape"){let xe=r.byObjectId.get(te.id),ve=x.length,Ye=K!==null&&te.role==="wall"&&!xe;s.setMaterial(Ye?So:(xe?.kind??te.role)==="screen"?1:0);let et=te.role==="stage"&&!xe?Rc(te,_(X)):Ye&&te.heightM===void 0?{...te,heightM:re}:te,Ne=Xs(et,se);if(Mc(s,et,Y.baseHeightM+Ne.supportOffsetM,Ne.topOffsetM-Ne.supportOffsetM,o,Y.focal,x,xe,J),s.setMaterial(0),te.role==="stage"&&!xe&&x.length>ve&&(R??X)===X){R=X;let Ke=t.floors?.[X]?.id,we=i.length>1&&Ke?a.filter(Ct=>Ct.floorId===Ke):a;Ol(s,et,x[x.length-1].y,we)}}else te.type==="gaArea"?wc(s,te,Y.baseHeightM,he(b.get(te.categoryKey)),o):te.type==="booth"?gc(s,te,Y.baseHeightM,he(b.get(te.categoryKey)),o,Pe.get(te.id)??Y.focal,F(te,X)):te.type==="table"?vc(s,te,Math.max(Y.baseHeightM,A.get(te.id)??Y.baseHeightM),he(te.fill??t.theme?.decorFill??"#232c40"),o,!!(te.fill??t.theme?.decorFill)):te.type==="decorImage"&&Sc(s,te,Y.baseHeightM,o);K&&hl(s,Y.objects,K,Y.baseHeightM,re,Y.focal,o,te=>!r.byObjectId.has(te.id)),Uc(s,Y,a,S,o,n.materials.shell,!c)}let I=i.length>1?{x:i.reduce((X,Y)=>X+Y.focal.x,0)/i.length,y:i.reduce((X,Y)=>X+Y.focal.y,0)/i.length}:t.focalPoint??{x:(m.minX+m.maxX)/2,y:(m.minY+m.maxY)/2},T=Ua(c?[s.build(),c]:[s.build()]),L=Wa(a,e.initialState,S,M,b,y),V=vl({doc:t,units:i,seats:a,surfaces:S,focal:I}),{labels:O,sections:H,rows:j}=Ml({doc:t,units:i,seats:a,surfaces:S,seatData:L,hintedSeatFloor:u,zones:V,focal:I}),N=new Map(H.map((X,Y)=>[X.id,Y]));S.seatOwner.forEach((X,Y)=>{L.iSection[Y]=X?N.get(X)??-1:-1});let k=wl({doc:t,units:i,seats:a,surfaces:S,solids:T,hintedSeatFloor:u,seatFloor:M});Sl(O,k),L.iYaw=fa(L.iPosition,a.length,X=>a[X].rowId,X=>{let Y=i[M[X]]?.focal??I;return[Y.x*C,Y.y*C]});let B=(m.minX+m.maxX)/2*C,D=(m.minY+m.maxY)/2*C,G=.5*Math.hypot((m.maxX-m.minX)*C,(m.maxY-m.minY)*C)||10,U=vi(T,L,{cx:B,cz:D,radius:G},[f,h]),q=vi(T,L,{cx:B,cz:D,radius:G}),$=i0(i),ee=Tl(L,x,m,U.minY,U.maxY,G,$);return{sharedAisles:Xa(i.flatMap(X=>X.objects.flatMap(Y=>{if(Y.type!=="section")return[];let K=S.bySection.get(Y.id);return K?[{sectionId:Y.id,floorIndex:X.index,rows:K.rowLevels}]:[]}))),solids:T,sectionSolidRanges:g,seats:L,seatSectionIds:S.seatOwner,bounds:{center:[(ee.min[0]+ee.max[0])/2,(ee.min[1]+ee.max[1])/2,(ee.min[2]+ee.max[2])/2],radius:G,groundY:0,box:ee,fitPoints:_l(L,x,$)},...E?{room:E}:{},...!E&&i.some(X=>X.objects.some(Y=>Y.type==="shape"&&mo(Y.stageKind)))?{outdoor:!0}:{},renderBounds:{center:U.center,radius:U.radius},clipBounds:{center:q.center,radius:q.radius},stateColorLUT:qa(n,_e),theme:n,seatCount:a.length,focalWorld:[I.x*C,1.5,I.y*C],zones:V,stages:x,productionElements:r.elements,sections:H,rows:j,labels:O,floors:k}}function i0(e){let t=[];for(let n of e)for(let o of n.objects){let i=o.type==="gaArea"?o.points:o.type==="booth"?Je(o):null;for(let r of i??[])t.push([r.x*C,n.baseHeightM,r.y*C])}return t}var Pt=require("ogl"),a0=.05,s0=1.1,c0=12,l0=1.6,u0=1,m0=2.5,f0=650,Bl=[[-.15,0,0,.15,.13,.42],[-.13,-.45,.36,.13,.02,.47]],Vl={centre:[0,0,-.05],hipRadius:.15,shoulderRadius:.2,height:.56,sides:8,depth:.62},Mi={centre:[0,.74,-.04],radii:[.1,.12,.11]},cn={height:6,baseRadius:.16,topRadius:.3,fadeInFromM:16,fullByM:40},d0=90,iw={height:Mi.centre[1]+Mi.radii[1],radius:Math.max(Vl.shoulderRadius,...Bl.map(e=>Math.max(Math.abs(e[0]),Math.abs(e[3]))))};function h0(e,t){if(t)return 0;let n=(e-cn.fadeInFromM)/(cn.fullByM-cn.fadeInFromM);return Math.max(0,Math.min(1,n))}function p0(e,t){return!t&&e<d0}var Nl=24;function b0(e){let t=[],n=[],o=[],i=(m,f,d)=>{t.push(...m),n.push(...f),o.push(d)};for(let m=0;m<16;m++){let f=m/16*Math.PI*2,d=(m+1)/16*Math.PI*2,h=S=>[Math.cos(S),0,Math.sin(S)],p=[Math.cos(f)*.012,0,Math.sin(f)*.012],b=[Math.cos(d)*.012,0,Math.sin(d)*.012],y=[Math.cos(f)*.03,1,Math.sin(f)*.03],x=[Math.cos(d)*.03,1,Math.sin(d)*.03];i(p,h(f),0),i(y,h(f),0),i(x,h(d),0),i(p,h(f),0),i(x,h(d),0),i(b,h(d),0)}let c=.16,l=.24,u=.01;for(let m=0;m<48;m++){let f=m/48*Math.PI*2,d=(m+1)/48*Math.PI*2,h=[Math.cos(f)*c,u,Math.sin(f)*c],p=[Math.cos(f)*l,u,Math.sin(f)*l],b=[Math.cos(d)*l,u,Math.sin(d)*l],y=[Math.cos(d)*c,u,Math.sin(d)*c];for(let x of[h,p,b,h,b,y])i(x,[0,1,0],1)}for(let[m,f,d,h,p,b]of Bl){let y=[[[0,0,1],[[m,f,b],[h,f,b],[h,p,b],[m,p,b]]],[[0,0,-1],[[h,f,d],[m,f,d],[m,p,d],[h,p,d]]],[[1,0,0],[[h,f,b],[h,f,d],[h,p,d],[h,p,b]]],[[-1,0,0],[[m,f,d],[m,f,b],[m,p,b],[m,p,d]]],[[0,1,0],[[m,p,b],[h,p,b],[h,p,d],[m,p,d]]],[[0,-1,0],[[m,f,d],[h,f,d],[h,f,b],[m,f,b]]]];for(let[x,[S,A,M,g]]of y)for(let P of[S,A,M,S,M,g])i(P,x,2)}{let{centre:m,hipRadius:f,shoulderRadius:d,height:h,sides:p,depth:b}=Vl,y=(x,S,A)=>{let M=x/p*Math.PI*2+Math.PI/p;return[m[0]+Math.cos(M)*S,m[1]+A,m[2]+Math.sin(M)*S*b]};for(let x=0;x<p;x++){let S=y(x,f,0),A=y(x+1,f,0),M=y(x+1,d,h),g=y(x,d,h),P=[A[0]-S[0],A[1]-S[1],A[2]-S[2]],v=[g[0]-S[0],g[1]-S[1],g[2]-S[2]],w=[P[1]*v[2]-P[2]*v[1],P[2]*v[0]-P[0]*v[2],P[0]*v[1]-P[1]*v[0]],R=Math.hypot(...w)||1;w=[w[0]/R,w[1]/R,w[2]/R],w[0]*(S[0]-m[0])+w[2]*(S[2]-m[2])<0&&(w=[-w[0],-w[1],-w[2]]);for(let _ of[S,A,M,S,M,g])i(_,w,2);i([m[0],m[1]+h,m[2]],[0,1,0],2),i(g,[0,1,0],2),i(M,[0,1,0],2)}}{let{centre:m,radii:f}=Mi,d=8,h=(p,b)=>{let y=p/16*Math.PI*2,x=b/d*Math.PI,S=[Math.sin(x)*Math.cos(y),Math.cos(x),Math.sin(x)*Math.sin(y)];return[[m[0]+S[0]*f[0],m[1]+S[1]*f[1],m[2]+S[2]*f[2]],S]};for(let p=0;p<16;p++)for(let b=0;b<d;b++){let y=h(p,b),x=h(p+1,b),S=h(p+1,b+1),A=h(p,b+1);for(let[M,g]of[y,x,S,y,S,A])i(M,g,2)}}for(let m=0;m<32;m++){let f=m/32*Math.PI*2,d=(m+1)/32*Math.PI*2,h=cn.baseRadius,p=cn.topRadius,b=[Math.cos(f)*h,0,Math.sin(f)*h],y=[Math.cos(d)*h,0,Math.sin(d)*h],x=[Math.cos(f)*p,1,Math.sin(f)*p],S=[Math.cos(d)*p,1,Math.sin(d)*p],A=[Math.cos(f),0,Math.sin(f)],M=[Math.cos(d),0,Math.sin(d)];i(b,A,3),i(x,A,3),i(S,M,3),i(b,A,3),i(S,M,3),i(y,M,3)}return new Pt.Geometry(e,{position:{size:3,data:new Float32Array(t)},normal:{size:3,data:new Float32Array(n)},part:{size:1,data:new Float32Array(o)}})}var y0=`#version 300 es
|
|
21
21
|
precision highp float;
|
|
22
22
|
in vec3 position; in vec3 normal; in float part;
|
|
23
23
|
uniform mat4 modelViewMatrix; uniform mat4 projectionMatrix; uniform mat3 normalMatrix;
|
|
24
|
-
uniform vec3 uSeat; uniform float uHeight; uniform float uLift; uniform float uRingScale;
|
|
25
|
-
|
|
24
|
+
uniform vec3 uSeat; uniform float uHeight; uniform float uLift; uniform float uRingScale; uniform float uFigure;
|
|
25
|
+
uniform float uYaw; uniform float uBeamHeight; uniform float uBeam;
|
|
26
|
+
out vec3 vNormal; out float vPart; out float vAlong;
|
|
26
27
|
void main() {
|
|
27
|
-
vNormal = normalize(normalMatrix * normal);
|
|
28
28
|
vPart = part;
|
|
29
|
+
vAlong = position.y;
|
|
30
|
+
if (part > 1.5) {
|
|
31
|
+
// The figure turns to face the show; the beam is round and needs no turn.
|
|
32
|
+
float c = cos(uYaw), s = sin(uYaw);
|
|
33
|
+
vec3 local = part > 2.5
|
|
34
|
+
? vec3(position.x, position.y * uBeamHeight, position.z) * uHeight / 1.1
|
|
35
|
+
: vec3(c * position.x + s * position.z, position.y, -s * position.x + c * position.z);
|
|
36
|
+
vec3 turned = part > 2.5 ? normal : vec3(c * normal.x + s * normal.z, normal.y, -s * normal.x + c * normal.z);
|
|
37
|
+
vNormal = normalize(normalMatrix * turned);
|
|
38
|
+
// Both settle in as the pin lands, and vanish together when not shown.
|
|
39
|
+
float shown = part > 2.5 ? step(0.001, uBeam) : uFigure;
|
|
40
|
+
gl_Position = projectionMatrix * modelViewMatrix * vec4(uSeat + local * shown * (1.0 - uLift * 0.5), 1.0);
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
vNormal = normalize(normalMatrix * normal);
|
|
29
44
|
// The stem rises out of the ring as the pin lands (uLift runs 1 \u2192 0).
|
|
30
45
|
float grow = part > 0.5 ? 1.0 : 1.0 - uLift;
|
|
31
46
|
// The ring is the seat's own size, not the stem's: grown with the stem it
|
|
@@ -33,27 +48,43 @@ void main() {
|
|
|
33
48
|
float scale = part > 0.5 ? uRingScale : uHeight;
|
|
34
49
|
vec3 world = uSeat + vec3(position.x, position.y * grow, position.z) * scale;
|
|
35
50
|
gl_Position = projectionMatrix * modelViewMatrix * vec4(world, 1.0);
|
|
36
|
-
}`,
|
|
51
|
+
}`,g0=`#version 300 es
|
|
37
52
|
precision highp float;
|
|
38
|
-
in vec3 vNormal; in float vPart;
|
|
39
|
-
uniform vec3 uColor; uniform float uRingAlpha;
|
|
53
|
+
in vec3 vNormal; in float vPart; in float vAlong;
|
|
54
|
+
uniform vec3 uColor; uniform float uRingAlpha; uniform vec3 uFigureColor; uniform float uBeam;
|
|
40
55
|
out vec4 fragColor;
|
|
41
56
|
void main() {
|
|
57
|
+
if (vPart > 2.5) {
|
|
58
|
+
// The follow-spot: brightest on the seat, gone well above the head.
|
|
59
|
+
float fade = pow(1.0 - clamp(vAlong, 0.0, 1.0), 2.2);
|
|
60
|
+
fragColor = vec4(mix(vec3(1.0), uFigureColor, 0.45), 0.3 * fade * uBeam);
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
if (vPart > 1.5) {
|
|
64
|
+
// The buyer in the event's selection colour, lit like the stem with a
|
|
65
|
+
// bright rim, so they read as someone rather than one more spectator.
|
|
66
|
+
vec3 n = normalize(vNormal);
|
|
67
|
+
float key = max(dot(n, normalize(vec3(-0.4, 0.7, 0.6))), 0.0);
|
|
68
|
+
float rim = pow(1.0 - abs(n.z), 2.5);
|
|
69
|
+
vec3 c = uFigureColor * (0.42 + 0.55 * key) + vec3(0.28) * rim;
|
|
70
|
+
fragColor = vec4(c, 1.0);
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
42
73
|
if (vPart > 0.5) { fragColor = vec4(uColor, uRingAlpha); return; }
|
|
43
74
|
// View-space light from the upper left: a lit, round stem reads as an
|
|
44
75
|
// object standing in the venue rather than a line drawn on the screen.
|
|
45
76
|
float key = max(dot(normalize(vNormal), normalize(vec3(-0.4, 0.7, 0.6))), 0.0);
|
|
46
77
|
vec3 c = uColor * (0.55 + 0.5 * key) + vec3(0.12) * pow(key, 12.0);
|
|
47
78
|
fragColor = vec4(c, 1.0);
|
|
48
|
-
}`;function py(e){if(e>=1)return 1;if(e<.72){let n=e/.72;return 1-(1-n)*(1-n)}let t=(e-.72)/.28;return 1-.08*Math.sin(t*Math.PI)}function ii(e){return Math.max(ay,Math.min(sy,e*iy))}function fl(e,t){let n=new St.Transform,o=fy(e),r=new Map,i=(a,s)=>{let c=new St.Program(e,{vertex:dy,fragment:hy,uniforms:{uSeat:{value:a},uHeight:{value:1},uLift:{value:0},uRingScale:{value:1},uColor:{value:t},uRingAlpha:{value:.85}},transparent:!0,depthTest:!0,depthWrite:!1,cullFace:!1}),u=new St.Mesh(e,{geometry:o,program:c});return u.frustumCulled=!1,u.setParent(n),{mesh:u,program:c,seat:a,start:s}};return{root:n,setSeats(a,s,c){let u=new Set(a.slice(0,ml).map(l=>l.id));for(let[l,m]of r)u.has(l)||(m.mesh.setParent(null),r.delete(l));for(let l of a.slice(0,ml))r.has(l.id)||r.set(l.id,i(l.position,c?s:-1/0))},update(a,s,c,u=!1){let l=!1;for(let m of r.values()){let h=s[0]-m.seat[0],f=s[1]-m.seat[1],d=s[2]-m.seat[2],p=Math.hypot(h,f,d);m.mesh.visible=!c&&p>(u?ly:uy);let b=ii(p),g=Math.max(0,Math.min(1,(a-m.start)/my));g<1&&(l=!0),m.program.uniforms.uHeight.value=b,m.program.uniforms.uRingScale.value=Math.min(b,cy),m.program.uniforms.uLift.value=u?1:1-py(g),m.program.uniforms.uRingAlpha.value=.55+.4*(g<1?Math.sin(g*Math.PI):0)}return l},dispose(){for(let a of r.values())a.mesh.setParent(null);r.clear(),o.remove()}}}var by={wheelchair:'<circle cx="10.6" cy="3.7" r="1.7" /><path d="M8.9 6.3v4.3a1.3 1.3 0 0 0 1.3 1.3h3.4l1.9 4.5h1.9" /><circle cx="9.7" cy="13.3" r="4.7" />',companion:'<circle cx="6" cy="6" r="2" /><circle cx="14" cy="6" r="2" /><path d="M2.5 16v-3.5A3.5 3.5 0 0 1 6 9a3.5 3.5 0 0 1 3.5 3.5V16M10.5 16v-3.5A3.5 3.5 0 0 1 14 9a3.5 3.5 0 0 1 3.5 3.5V16" />',"semi-ambulatory":'<circle cx="8" cy="4" r="1.7" /><path d="m8 6 2 4 3 2M10 10l-2 3-1 4M10 10l2 7M14 7l2 10" />',"designated-aisle":'<path d="M3.5 5.5v7h8.5V10H6.5M5 12.5V17M11 12.5V17" /><path d="M13.5 6.5H19M16.5 4l2.5 2.5L16.5 9" />',"step-free":'<circle cx="5.5" cy="5" r="1.7" /><path d="M5.5 7v4l3 2M2.5 16.5H8l7-7h3M8 16.5h10" />',hearing:'<path d="M7 16c-1-1.2-1.5-2.4-1.5-3.8V9a5 5 0 1 1 10 0c0 2.2-1.2 3.2-2.6 4-1.2.7-1.7 1.4-1.7 2.4A2.6 2.6 0 0 1 8.6 18" />',cart:'<path d="M8 6.5A4 4 0 1 0 8 13M17 6.5a4 4 0 1 0 0 6.5" />',"sign-language":'<path d="M6 16V8.5a1 1 0 0 1 2 0v3M8 11V5.5a1 1 0 0 1 2 0V11M10 11V4.5a1 1 0 0 1 2 0V11M12 11V6a1 1 0 0 1 2 0v6l1-1.5a1.2 1.2 0 0 1 2 1.3L14 17H9.5A3.5 3.5 0 0 1 6 13.5" />',"low-vision":'<path d="M2.5 10s3-5 7.5-5 7.5 5 7.5 5-3 5-7.5 5-7.5-5-7.5-5Z" /><circle cx="10" cy="10" r="2.5" /><path d="m15 4 .5-1.5M17 5l1.5-.8" />',"sensory-friendly":'<path d="M4 11v-1a6 6 0 0 1 12 0v1M4 11h2.5v5H5a1 1 0 0 1-1-1v-4ZM16 11h-2.5v5H15a1 1 0 0 0 1-1v-4Z" /><path d="M8.5 11.5c.8.7 2.2.7 3 0M9 14c.6.4 1.4.4 2 0" />',"plus-size":'<path d="M5 9V6.5A2.5 2.5 0 0 1 7.5 4h5A2.5 2.5 0 0 1 15 6.5V9M3.5 8.5v5h13v-5M6 13.5V17M14 13.5V17" />',"lift-armrest":'<path d="M5 10V6.5A2.5 2.5 0 0 1 7.5 4h4A2.5 2.5 0 0 1 14 6.5V10M4 9v4h11V9M6 13v4M13 13v4" /><path d="M17 11V4M15 6l2-2 2 2" />',obstructedView:'<path d="M2.5 10s3-5 7.5-5 7.5 5 7.5 5-3 5-7.5 5-7.5-5-7.5-5Z" /><path d="m4 17 12-14" />',restrictedView:'<path d="M2.5 10s3-5 7.5-5 7.5 5 7.5 5-3 5-7.5 5-7.5-5-7.5-5Z" /><path d="M10 7.5v3.5M10 13.5h.01" />',premium:'<path d="m10 2.5 2.2 4.6 5 .7-3.6 3.5.9 5-4.5-2.4-4.5 2.4.9-5-3.6-3.5 5-.7Z" />',note:'<circle cx="10" cy="10" r="7.5" /><path d="M10 9.2v4.6M10 6.3h.01" />'};function yy(e){return by[e]??""}function dl(e,t={}){let n=yy(e);if(!n)return"";let o=t.size??18,r=20;return`<svg viewBox="0 0 ${r} ${r}" width="${o}" height="${o}" fill="none" stroke="currentColor" stroke-width="1.45" stroke-linecap="round" stroke-linejoin="round"`+(t.className?` class="${t.className}"`:"")+` aria-hidden="true" focusable="false">${n}</svg>`}var On="#ffffff",hl="#0b1220",Fn=6,gy=80,pl=14,bl=88,yl=20,gl={floor:{size:14,weight:"700",opacity:.98},stage:{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},access:{size:12,weight:"700",opacity:1}},xy=640,vy=.8,My=11,Sy="3px 7px",wy="2px 5px",xl="rgba(10,14,22,.62)",Py="#f4f7fb",vl=5,Ml=2,Iy=6,Dn=new Set(["row","seat","access"]),Sl={stage:6,floor:5,zone:4,section:3,ga:3,booth:2,annotation:1},Jt={row:{x:66,y:20},seat:{x:52,y:22}},Nn=he,ai=e=>$i(e);function Co(e,t){let n=ai(e),o=ai(t);return(Math.max(n,o)+.05)/(Math.min(n,o)+.05)}function si(e,t){let n=/rgba\((\d+),(\d+),(\d+),([\d.]+)\)/.exec(e.replace(/\s/g,""));if(!n)return t;let o=Math.max(0,Math.min(1,Number(n[4])));return[1,2,3].map(r=>Number(n[r])/255*o+t[r-1]*(1-o))}function Ay(e,t=[.04,.06,.1],n=!0){let o=ai(t)<.42,r=o?"#f4f7fb":"#0b1220",i=o?"rgba(8,12,22,.78)":"rgba(255,255,255,.84)",a=n?si(i,t):t,s=Nn(e),c=n?7:4.5,u=s&&Co(s,a)>=c?e:r;return o?{ink:u,backing:i,border:"rgba(210,222,245,.24)"}:{ink:u,backing:i,border:"rgba(11,18,32,.22)"}}function Ry(e,t=[.04,.06,.1]){let n=si(xl,t),o=Nn(e);return{ink:o&&Co(o,n)>=4.5?e:Py,backing:xl}}var Ey=.8,en=20,Cy=14,_y=60,Ty='ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif',_o=class{constructor(t,n={}){this.nodes=new Map;this.labels=[];this.nodeAppearance=new WeakMap;this.forcedDense=!1;this.overviewDistance=null;this.selectedSeatLabelIds=new Set;this.narrowStage=!1;this.seatNumberRow=void 0;this.seatNumberSeat=null;this.pinHeads=[];this.opts=n,this.root=document.createElement("div"),this.root.setAttribute("data-view3d-labels","");let o=this.root.style;o.position="absolute",o.inset="0",o.pointerEvents="none",o.overflow="hidden",o.fontFamily=n.fontFamily||Ty,t.appendChild(this.root)}setVisible(t){this.root.style.visibility=t?"":"hidden"}setLabels(t){this.labels=t;let n=new Set(t.map(o=>o.id));for(let[o,r]of this.nodes)n.has(o)||(r.remove(),this.nodes.delete(o))}setForcedDense(t){this.forcedDense=t}setOverviewDistance(t){this.overviewDistance=t>0?t:null}setSeatNumberRow(t){return t===this.seatNumberRow?!1:(this.seatNumberRow=t,!0)}setSeatNumberSeat(t){let n=t?`seat:${t}`:null;return n===this.seatNumberSeat?!1:(this.seatNumberSeat=n,!0)}setSelectedSeatIds(t){this.selectedSeatLabelIds=new Set(Array.from(t,n=>`seat:${n}`))}sizeFor(t){let n=gl[t].size;return!this.narrowStage||Dn.has(t)?n:Math.max(My,n*vy)}qualityEvidence(){let t=this.root.getBoundingClientRect(),n=this.root.style.visibility!=="hidden";return this.labels.map(o=>{let r=this.nodes.get(o.id),i=r?.getBoundingClientRect(),a=!!(n&&r&&r.style.display!=="none"&&i&&i.width>0&&i.height>0);return{id:o.id,kind:o.kind,text:o.text,visible:a,renderedFontPx:r&&Number.parseFloat(r.style.fontSize)||0,contrast:r?Number(r.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,o,r,i,a){if(!this.labels.length)return;this.narrowStage=n>0&&n<xy;let s=Nc(r,i,{hasZoneLabels:this.labels.some(x=>x.kind==="zone")});this.forcedDense&&(s.add("row"),s.add("seat"),s.add("access")),!this.forcedDense&&this.overviewDistance!==null&&r>this.overviewDistance*Ey&&(s.delete("section"),s.delete("ga"));let c=[];for(let x of this.labels){if(!s.has(x.kind)&&!(x.kind==="seat"&&this.selectedSeatLabelIds.has(x.id)))continue;let S=x.kind==="seat"&&a&&this.selectedSeatLabelIds.has(x.id)?x.pinBase:void 0,A=S&&a?[S[0],S[1]+ii(Math.hypot(S[0]-a[0],S[1]-a[1],S[2]-a[2])),S[2]]:x.anchor,_=nt(t,A,n,o);if(!_.visible)continue;let D=Dn.has(x.kind),E=this.sizeFor(x.kind),I=x.kind==="access"?en:Hc(x.text,E,!D)+(D?vl*2:0);if(x.kind==="access"&&x.seatWidthM!==void 0&&ei(t,x.anchor,x.seatWidthM,n)<Cy||x.kind==="seat"&&x.seatWidthM!==void 0&&!this.selectedSeatLabelIds.has(x.id)&&ei(t,x.anchor,x.seatWidthM,n)<Math.max(22,I))continue;let k=Bc(_,I/2,E/2+(D?Ml:4),n,o),L=a?Math.hypot(x.anchor[0]-a[0],x.anchor[1]-a[1],x.anchor[2]-a[2]):1;c.push({label:x,screen:k,focus:zc(k,L,n,o),halfWidth:I/2,...this.selectedSeatLabelIds.has(x.id)?{priority:1}:{}})}let u=Dc(c.filter(x=>x.label.kind==="floor"),n),l=[...c.filter(x=>!Dn.has(x.label.kind)&&x.label.kind!=="floor"),...u],m=Gc(n),h=c.filter(x=>x.label.kind==="seat"&&this.selectedSeatLabelIds.has(x.label.id)),f=Ln(h,Jt.seat.x,Jt.seat.y,m.seat);this.placePinHeads(h.filter(x=>x.label.pinBase&&!f.includes(x)).map(x=>x.screen));let d=Vc(l,bl,yl).filter(x=>!f.some(S=>kn(x,S,bl,yl))),p=Ln(c.filter(x=>x.label.kind==="access"),en,en,_y,[...d,...f]),b=Ln(c.filter(x=>x.label.kind==="row"),Jt.row.x,Jt.row.y,m.row,[...d,...f,...p]),g=this.seatNumberRow!==void 0||this.seatNumberSeat!==null,v=Ln(c.filter(x=>x.label.kind==="seat"&&!this.selectedSeatLabelIds.has(x.label.id)&&(this.seatNumberSeat!==null?x.label.id===this.seatNumberSeat:!g||this.seatNumberRow!==null&&x.label.rowId===this.seatNumberRow)),Jt.seat.x,Jt.seat.y,g?gy:m.seat-f.length,[...d,...f,...p,...b]),w=[...d,...p,...b,...f,...v],R=new Set(w.map(x=>x.label.id));for(let{label:x,screen:S}of w){let _=this.nodeFor(x).style;_.display=x.kind==="access"?"flex":"";let D=!!x.pinBase&&this.selectedSeatLabelIds.has(x.id);_.transform=D?`translate(-50%, -100%) translate(${S.x.toFixed(1)}px, ${(S.y-Fn).toFixed(1)}px)`:`translate(-50%, -50%) translate(${S.x.toFixed(1)}px, ${S.y.toFixed(1)}px)`}let y=w.filter(({label:x})=>!Dn.has(x.kind)).sort((x,S)=>Sl[S.label.kind]-Sl[x.label.kind]||x.screen.depth-S.screen.depth||x.focus-S.focus).flatMap(({label:x})=>{let S=this.nodes.get(x.id);return S&&S.style.display!=="none"?[{node:S,box:S.getBoundingClientRect()}]:[]}),P=[];for(let{node:x,box:S}of y)P.some(_=>S.left<_.right+3&&S.right+3>_.left&&S.top<_.bottom+3&&S.bottom+3>_.top)?x.style.display="none":P.push(S);for(let[x,S]of this.nodes)R.has(x)||(S.style.display="none")}nodeFor(t){let n=this.nodes.get(t.id);if(!n){n=document.createElement("div");let p=n.style;p.position="absolute",p.left="0",p.top="0",p.whiteSpace="nowrap",p.display="none",this.root.appendChild(n),this.nodes.set(t.id,n)}let o=this.selectedSeatLabelIds.has(t.id),r=this.nodeAppearance.get(n);if(r&&r.text===t.text+(t.icon??"")&&r.kind===t.kind&&r.color===t.color&&r.selected===o&&r.narrow===this.narrowStage)return n;if(this.nodeAppearance.set(n,{text:t.text+(t.icon??""),kind:t.kind,color:t.color,selected:o,narrow:this.narrowStage}),t.kind==="access")return this.paintAccessChip(n,t);if(n.textContent=t.text,o){let p=document.createElement("span"),b=p.style;b.position="absolute",b.left="50%",b.bottom=`-${Fn}px`,b.transform="translateX(-50%)",b.borderLeft=`${Fn}px solid transparent`,b.borderRight=`${Fn}px solid transparent`,b.borderTop=`${Fn}px solid ${On}`,n.appendChild(p)}n.setAttribute("data-label-kind",t.kind),n.toggleAttribute("data-selected-seat",o);let i=gl[t.kind],a=n.style;a.fontSize=`${this.sizeFor(t.kind)}px`,a.fontWeight=o?"800":i.weight,a.opacity=o?"1":String(i.opacity);let s=Dn.has(t.kind),c=!s,u=Ay(t.color??this.opts.ink,this.opts.backgroundRgb,!0),l=s?Ry(t.color??this.opts.ink,this.opts.backgroundRgb):u;a.color=o?hl:l.ink,a.background=o?On:l.backing,a.border=o?`1px solid ${On}`:c?`1px solid ${u.border}`:"",a.borderRadius=o||c?"999px":`${Iy}px`;let m=this.narrowStage?wy:Sy;a.padding=o||c?m:`${Ml}px ${vl}px`,a.lineHeight=s?"1.1":"",a.boxShadow=o?"0 0 0 3px rgba(255,255,255,.28), 0 0 18px rgba(255,255,255,.55), 0 5px 14px rgba(0,0,0,.45)":c?"0 3px 10px rgba(0,0,0,.24)":"0 1px 4px rgba(0,0,0,.28)",a.textShadow=o||c?"none":"0 1px 1px rgba(0,0,0,0.4)",a.letterSpacing=t.kind==="zone"||t.kind==="floor"?"0.08em":"0.02em";let h=this.opts.backgroundRgb??[.04,.06,.1],f=Nn(o?hl:l.ink)??[1,1,1],d=si(o?On:l.backing,h);return n.dataset.qualityContrast=Co(f,d).toFixed(3),a.textTransform=t.kind==="zone"||t.kind==="floor"?"uppercase":"",n}paintAccessChip(t,n){t.setAttribute("data-label-kind","access"),t.setAttribute("data-access-type",n.icon??""),t.innerHTML=n.icon?dl(n.icon,{size:en-6}):"";let o=t.style;return o.width=`${en}px`,o.height=`${en}px`,o.alignItems="center",o.justifyContent="center",o.borderRadius="50%",o.background=n.color??"#3b82f6",o.color=n.ink??"#ffffff",o.border="1.5px solid #ffffff",o.boxShadow="0 2px 6px rgba(0,0,0,.35)",o.padding="0",o.lineHeight="0",o.boxSizing="border-box",t.dataset.qualityContrast=Co(Nn(n.ink??"#ffffff")??[1,1,1],Nn(n.color??"#3b82f6")??[.23,.51,.96]).toFixed(3),t}placePinHeads(t){for(;this.pinHeads.length<t.length;){let n=document.createElement("div");n.setAttribute("data-pin-head",""),n.setAttribute("aria-hidden","true");let o=n.style;o.position="absolute",o.left="0",o.top="0",o.width=`${pl}px`,o.height=`${pl}px`,o.borderRadius="50%",o.background=On,o.boxShadow="0 0 0 3px rgba(255,255,255,.28), 0 0 14px rgba(255,255,255,.55), 0 3px 8px rgba(0,0,0,.45)",o.pointerEvents="none",this.root.appendChild(n),this.pinHeads.push(n)}this.pinHeads.forEach((n,o)=>{let r=t[o];n.style.display=r?"":"none",r&&(n.style.transform=`translate(-50%, -100%) translate(${r.x.toFixed(1)}px, ${r.y.toFixed(1)}px)`)})}dispose(){this.pinHeads=[],this.root.remove(),this.nodes.clear()}};var Pl=1;var ky=new Set(["floor","stage","zone","section","ga","booth","annotation"]);function Ly(e){return e.every(t=>Number.isFinite(t))}function Oy(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 wl(e){return e.length?Math.round(Math.min(...e)*100)/100:null}function Ot(e){return Math.round(e*1e4)/1e4}function Fy(e){if(e)return{box:{x:Ot(e.box.x),y:Ot(e.box.y),width:Ot(e.box.width),height:Ot(e.box.height)},horizontalFillRatio:Ot(e.horizontalFillRatio),verticalFillRatio:Ot(e.verticalFillRatio),visibleAreaRatio:Ot(e.visibleAreaRatio),clippedEdges:[...e.clippedEdges]}}function ot(e,t,n){return n.length?{code:e,message:t,count:n.length,samples:n.slice(0,20)}:null}function To(e){let t=e.labels.filter(s=>s.visible&&s.screenBox),n=t.filter(s=>ky.has(s.kind)),o=e.scene.floorCount>1?e.scene.floorCount:e.scene.zoneCount||e.scene.sectionCount,r=[];for(let s=0;s<n.length;s+=1)for(let c=0;c<s;c+=1)Oy(n[s].screenBox,n[c].screenBox)&&r.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=[ot("webgl2-unavailable","The venue scene must render through WebGL2",e.context.webgl2?[]:[{primaryId:"renderer",primaryLabel:"WebGL2"}]),ot("context-lost","The WebGL context must be live at capture",e.context.lost?[{primaryId:"renderer",primaryLabel:"context lost"}]:[]),ot("frame-not-stable","The captured 3D frame must be rendered and parked",e.frame.rendered>0&&e.frame.idle?[]:[{primaryId:"renderer",primaryLabel:"unstable frame"}]),ot("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}`}]),ot("camera-invalid","The capture camera must have a finite physical pose",Ly(i)&&e.camera.distance>0&&e.camera.verticalFovDeg>0&&e.camera.verticalFovDeg<180?[]:[{primaryId:"camera",primaryLabel:"invalid pose"}]),ot("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}]),ot("hierarchy-label-missing","A venue with authored hierarchy must show at least one structural label",o===0||n.length>0?[]:[{primaryId:"labels",primaryLabel:`${o} expected hierarchy labels`}]),ot("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}))),ot("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}))),ot("hierarchy-label-collision","Visible 3D hierarchy labels must not overlap",r)].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:Fy(e.framing)},metrics:{minimumHierarchyFontPx:wl(n.map(s=>s.renderedFontPx)),minimumHierarchyContrast:wl(n.map(s=>s.contrast)),projectedReliefPx:Math.round(e.scene.projectedReliefPx*100)/100},findings:a}}function Il(e,t,n){e.fill(0);for(let o=0;o<Math.min(n,t.length);o++)e[t[o]]=1}var Ee=require("ogl");var wt=require("ogl");var ko=`
|
|
79
|
+
}`;function x0(e){if(e>=1)return 1;if(e<.72){let n=e/.72;return 1-(1-n)*(1-n)}let t=(e-.72)/.28;return 1-.08*Math.sin(t*Math.PI)}function Si(e){return Math.max(s0,Math.min(c0,e*a0))}function v0(e){let t=.2126*e[0]+.7152*e[1]+.0722*e[2],n=t>=.25?0:Math.min(.45,(.25-t)*2.2);return e.map(o=>o+(1-o)*n)}function Gl(e,t,n=[.24,.74,1]){n=v0(n);let o=new Pt.Transform,i=b0(e),r=new Map,a=(s,c,l)=>{let u=new Pt.Program(e,{vertex:y0,fragment:g0,uniforms:{uSeat:{value:s},uHeight:{value:1},uLift:{value:0},uRingScale:{value:1},uFigure:{value:1},uYaw:{value:l},uBeamHeight:{value:cn.height},uBeam:{value:0},uFigureColor:{value:n},uColor:{value:t},uRingAlpha:{value:.85}},transparent:!0,depthTest:!0,depthWrite:!1,cullFace:!1}),m=new Pt.Mesh(e,{geometry:i,program:u});return m.frustumCulled=!1,m.setParent(o),{mesh:m,program:u,seat:s,start:c}};return{root:o,setSeats(s,c,l){let u=new Set(s.slice(0,Nl).map(m=>m.id));for(let[m,f]of r)u.has(m)||(f.mesh.setParent(null),r.delete(m));for(let m of s.slice(0,Nl))r.has(m.id)||r.set(m.id,a(m.position,l?c:-1/0,m.facing??0))},update(s,c,l,u=!1){let m=!1;for(let f of r.values()){let d=c[0]-f.seat[0],h=c[1]-f.seat[1],p=c[2]-f.seat[2],b=Math.hypot(d,h,p);f.mesh.visible=!l&&b>(u?u0:m0);let y=Si(b),x=Math.max(0,Math.min(1,(s-f.start)/f0));x<1&&(m=!0),f.program.uniforms.uHeight.value=y,f.program.uniforms.uRingScale.value=Math.min(y,l0),f.program.uniforms.uLift.value=u?1:1-x0(x),f.program.uniforms.uFigure.value=p0(b,u)?1:0,f.program.uniforms.uBeam.value=h0(b,u),f.program.uniforms.uRingAlpha.value=.55+.4*(x<1?Math.sin(x*Math.PI):0)}return m},dispose(){for(let s of r.values())s.mesh.setParent(null);r.clear(),i.remove()}}}var M0={wheelchair:'<circle cx="10.6" cy="3.7" r="1.7" /><path d="M8.9 6.3v4.3a1.3 1.3 0 0 0 1.3 1.3h3.4l1.9 4.5h1.9" /><circle cx="9.7" cy="13.3" r="4.7" />',companion:'<circle cx="6" cy="6" r="2" /><circle cx="14" cy="6" r="2" /><path d="M2.5 16v-3.5A3.5 3.5 0 0 1 6 9a3.5 3.5 0 0 1 3.5 3.5V16M10.5 16v-3.5A3.5 3.5 0 0 1 14 9a3.5 3.5 0 0 1 3.5 3.5V16" />',"semi-ambulatory":'<circle cx="8" cy="4" r="1.7" /><path d="m8 6 2 4 3 2M10 10l-2 3-1 4M10 10l2 7M14 7l2 10" />',"designated-aisle":'<path d="M3.5 5.5v7h8.5V10H6.5M5 12.5V17M11 12.5V17" /><path d="M13.5 6.5H19M16.5 4l2.5 2.5L16.5 9" />',"step-free":'<circle cx="5.5" cy="5" r="1.7" /><path d="M5.5 7v4l3 2M2.5 16.5H8l7-7h3M8 16.5h10" />',hearing:'<path d="M7 16c-1-1.2-1.5-2.4-1.5-3.8V9a5 5 0 1 1 10 0c0 2.2-1.2 3.2-2.6 4-1.2.7-1.7 1.4-1.7 2.4A2.6 2.6 0 0 1 8.6 18" />',cart:'<path d="M8 6.5A4 4 0 1 0 8 13M17 6.5a4 4 0 1 0 0 6.5" />',"sign-language":'<path d="M6 16V8.5a1 1 0 0 1 2 0v3M8 11V5.5a1 1 0 0 1 2 0V11M10 11V4.5a1 1 0 0 1 2 0V11M12 11V6a1 1 0 0 1 2 0v6l1-1.5a1.2 1.2 0 0 1 2 1.3L14 17H9.5A3.5 3.5 0 0 1 6 13.5" />',"low-vision":'<path d="M2.5 10s3-5 7.5-5 7.5 5 7.5 5-3 5-7.5 5-7.5-5-7.5-5Z" /><circle cx="10" cy="10" r="2.5" /><path d="m15 4 .5-1.5M17 5l1.5-.8" />',"sensory-friendly":'<path d="M4 11v-1a6 6 0 0 1 12 0v1M4 11h2.5v5H5a1 1 0 0 1-1-1v-4ZM16 11h-2.5v5H15a1 1 0 0 0 1-1v-4Z" /><path d="M8.5 11.5c.8.7 2.2.7 3 0M9 14c.6.4 1.4.4 2 0" />',"plus-size":'<path d="M5 9V6.5A2.5 2.5 0 0 1 7.5 4h5A2.5 2.5 0 0 1 15 6.5V9M3.5 8.5v5h13v-5M6 13.5V17M14 13.5V17" />',"lift-armrest":'<path d="M5 10V6.5A2.5 2.5 0 0 1 7.5 4h4A2.5 2.5 0 0 1 14 6.5V10M4 9v4h11V9M6 13v4M13 13v4" /><path d="M17 11V4M15 6l2-2 2 2" />',obstructedView:'<path d="M2.5 10s3-5 7.5-5 7.5 5 7.5 5-3 5-7.5 5-7.5-5-7.5-5Z" /><path d="m4 17 12-14" />',restrictedView:'<path d="M2.5 10s3-5 7.5-5 7.5 5 7.5 5-3 5-7.5 5-7.5-5-7.5-5Z" /><path d="M10 7.5v3.5M10 13.5h.01" />',premium:'<path d="m10 2.5 2.2 4.6 5 .7-3.6 3.5.9 5-4.5-2.4-4.5 2.4.9-5-3.6-3.5 5-.7Z" />',note:'<circle cx="10" cy="10" r="7.5" /><path d="M10 9.2v4.6M10 6.3h.01" />',aisle:'<path d="M2.5 6v7h6.5v-2.5H4.5M3.5 13v3.5M8 13v3.5" /><path d="M12.5 3v14M17 3v14" />',entrance:'<path d="M10 3.5h6.5v13H10" /><path d="M3 10h8.5M8.5 7l3 3-3 3" />',booth:'<path d="M3.5 8.5h13v8h-13ZM2.5 8.5 4 4h12l1.5 4.5M8 16.5v-4h4v4" />'};function S0(e){return M0[e]??""}function wi(e,t={}){let n=S0(e);if(!n)return"";let o=t.size??18,i=20;return`<svg viewBox="0 0 ${i} ${i}" width="${o}" height="${o}" fill="none" stroke="currentColor" stroke-width="1.45" stroke-linecap="round" stroke-linejoin="round"`+(t.className?` class="${t.className}"`:"")+` aria-hidden="true" focusable="false">${n}</svg>`}var Wn="#ffffff",Hl="#0b1220",Xn=6,w0=80,zl=14,Ul=88,jl=20,Wl={floor:{size:14,weight:"700",opacity:.98},stage:{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},gate:{size:12,weight:"700",opacity:.98},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},access:{size:12,weight:"700",opacity:1}},P0=640,A0=.8,I0=11,R0="3px 7px",E0="2px 5px",Xl="rgba(10,14,22,.62)",C0="#f4f7fb",Yl=5,Kl=2,_0=6,Yn=new Set(["row","seat","access"]),Pi={stage:6,gate:5,floor:5,zone:4,section:3,ga:3,booth:2,annotation:1},ln={row:{x:66,y:20},seat:{x:52,y:22}},Vt=he,Ai=e=>ba(e);function Gt(e,t){let n=Ai(e),o=Ai(t);return(Math.max(n,o)+.05)/(Math.min(n,o)+.05)}function T0(e){let t=Vt(e);if(!t)return null;let n=r=>`#${r.map(a=>Math.round(Math.max(0,Math.min(1,a))*255).toString(16).padStart(2,"0")).join("")}`,o=t.map(r=>r+(1-r)*.78),i=t.map(r=>r*.62);for(let r=0;r<12&&Gt(i,o)<4.5;r++)i=i.map(a=>a*.8);return{fill:n(o),ink:n(i),border:n(t.map(r=>r+(1-r)*.35)),contrast:Gt(i,o)}}var k0=30;function Ii(e,t){let n=/rgba\((\d+),(\d+),(\d+),([\d.]+)\)/.exec(e.replace(/\s/g,""));if(!n)return t;let o=Math.max(0,Math.min(1,Number(n[4])));return[1,2,3].map(i=>Number(n[i])/255*o+t[i-1]*(1-o))}function L0(e,t=[.04,.06,.1],n=!0){let o=Ai(t)<.42,i=o?"#f4f7fb":"#0b1220",r=o?"rgba(8,12,22,.78)":"rgba(255,255,255,.84)",a=n?Ii(r,t):t,s=Vt(e),c=n?7:4.5,l=s&&Gt(s,a)>=c?e:i;return o?{ink:l,backing:r,border:"rgba(210,222,245,.24)"}:{ink:l,backing:r,border:"rgba(11,18,32,.22)"}}function O0(e,t=[.04,.06,.1]){let n=Ii(Xl,t),o=Vt(e);return{ink:o&&Gt(o,n)>=4.5?e:C0,backing:Xl}}var F0=.8,un=20,D0=14,N0=60,B0='ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif',Go=class{constructor(t,n={}){this.nodes=new Map;this.labels=[];this.wheelchairFree=new Map;this.nodeAppearance=new WeakMap;this.forcedDense=!1;this.overviewDistance=null;this.selectedSeatLabelIds=new Set;this.narrowStage=!1;this.seatNumberRow=void 0;this.seatNumberSeat=null;this.pinHeads=[];this.opts=n,this.root=document.createElement("div"),this.root.setAttribute("data-view3d-labels","");let o=this.root.style;o.position="absolute",o.inset="0",o.pointerEvents="none",o.overflow="hidden",o.fontFamily=n.fontFamily||B0,t.appendChild(this.root)}setVisible(t){this.root.style.visibility=t?"":"hidden"}setLabels(t){this.labels=t;let n=new Set(t.map(o=>o.id));for(let[o,i]of this.nodes)n.has(o)||(i.remove(),this.nodes.delete(o))}setForcedDense(t){this.forcedDense=t}setOverviewDistance(t){this.overviewDistance=t>0?t:null}setSeatNumberRow(t){return t===this.seatNumberRow?!1:(this.seatNumberRow=t,!0)}setSeatNumberSeat(t){let n=t?`seat:${t}`:null;return n===this.seatNumberSeat?!1:(this.seatNumberSeat=n,!0)}setWheelchairFree(t){let n=t.size!==this.wheelchairFree.size;if(!n){for(let[o,i]of t)if(this.wheelchairFree.get(o)!==i){n=!0;break}}return n&&(this.wheelchairFree=new Map(t)),n}setSelectedSeatIds(t){this.selectedSeatLabelIds=new Set(Array.from(t,n=>`seat:${n}`))}sizeFor(t){let n=Wl[t].size;return!this.narrowStage||Yn.has(t)?n:Math.max(I0,n*A0)}qualityEvidence(){let t=this.root.getBoundingClientRect(),n=this.root.style.visibility!=="hidden";return this.labels.map(o=>{let i=this.nodes.get(o.id),r=i?.getBoundingClientRect(),a=!!(n&&i&&i.style.display!=="none"&&r&&r.width>0&&r.height>0);return{id:o.id,kind:o.kind,text:o.text,visible:a,renderedFontPx:i&&Number.parseFloat(i.style.fontSize)||0,contrast:i?Number(i.dataset.qualityContrast??0):0,...a&&r?{screenBox:{x:r.x-t.x,y:r.y-t.y,width:r.width,height:r.height}}:{}}})}update(t,n,o,i,r,a){if(!this.labels.length)return;this.narrowStage=n>0&&n<P0;let s=al(i,r,{hasZoneLabels:this.labels.some(v=>v.kind==="zone")});this.forcedDense&&(s.add("row"),s.add("seat"),s.add("access")),!this.forcedDense&&this.overviewDistance!==null&&i>this.overviewDistance*F0&&(s.delete("section"),s.delete("ga")),s.has("section")&&this.labels.some(v=>v.kind==="section")&&s.delete("zone");let c=[];for(let v of this.labels){if(!s.has(v.kind)&&!(v.kind==="seat"&&this.selectedSeatLabelIds.has(v.id)))continue;let w=v.kind==="seat"&&a&&this.selectedSeatLabelIds.has(v.id)?v.pinBase:void 0,R=w&&a?[w[0],w[1]+Si(Math.hypot(w[0]-a[0],w[1]-a[1],w[2]-a[2])),w[2]]:v.anchor,_=at(t,R,n,o);if(!_.visible)continue;let F=Yn.has(v.kind),E=this.sizeFor(v.kind),I=v.kind==="access"?un:ll(v.text,E,!F)+(F?Yl*2:0)+((this.wheelchairFree.get(v.id)??0)>0?k0:0);if(v.kind==="access"&&v.seatWidthM!==void 0&&di(t,v.anchor,v.seatWidthM,n)<D0||v.kind==="seat"&&v.seatWidthM!==void 0&&!this.selectedSeatLabelIds.has(v.id)&&di(t,v.anchor,v.seatWidthM,n)<Math.max(22,I))continue;let T=sl(_,I/2,E/2+(F?Kl:4),n,o),L=a?Math.hypot(v.anchor[0]-a[0],v.anchor[1]-a[1],v.anchor[2]-a[2]):1;c.push({label:v,screen:T,focus:ml(T,L,n,o),halfWidth:I/2,...this.selectedSeatLabelIds.has(v.id)?{priority:1}:{}})}let l=il(c.filter(v=>v.label.kind==="floor"),n),u=[...c.filter(v=>!Yn.has(v.label.kind)&&v.label.kind!=="floor"),...l],m=ul(n),f=c.filter(v=>v.label.kind==="seat"&&this.selectedSeatLabelIds.has(v.label.id)),d=Un(f,ln.seat.x,ln.seat.y,m.seat);this.placePinHeads(f.filter(v=>v.label.pinBase&&!d.includes(v)).map(v=>v.screen));let h=cl(u,Ul,jl,v=>Pi[v.label.kind]??0).filter(v=>!d.some(w=>zn(v,w,Ul,jl))),p=Un(c.filter(v=>v.label.kind==="access"),un,un,N0,[...h,...d]),b=Un(c.filter(v=>v.label.kind==="row"),ln.row.x,ln.row.y,m.row,[...h,...d,...p]),y=this.seatNumberRow!==void 0||this.seatNumberSeat!==null,x=Un(c.filter(v=>v.label.kind==="seat"&&!this.selectedSeatLabelIds.has(v.label.id)&&(this.seatNumberSeat!==null?v.label.id===this.seatNumberSeat:!y||this.seatNumberRow!==null&&v.label.rowId===this.seatNumberRow)),ln.seat.x,ln.seat.y,y?w0:m.seat-d.length,[...h,...d,...p,...b]),S=[...h,...p,...b,...d,...x],A=new Set(S.map(v=>v.label.id));for(let{label:v,screen:w}of S){let _=this.nodeFor(v).style;_.display=v.kind==="access"?"flex":v.kind==="gate"?"inline-flex":"";let F=!!v.pinBase&&this.selectedSeatLabelIds.has(v.id);_.transform=F?`translate(-50%, -100%) translate(${w.x.toFixed(1)}px, ${(w.y-Xn).toFixed(1)}px)`:`translate(-50%, -50%) translate(${w.x.toFixed(1)}px, ${w.y.toFixed(1)}px)`}let g=S.filter(({label:v})=>!Yn.has(v.kind)).sort((v,w)=>Pi[w.label.kind]-Pi[v.label.kind]||v.screen.depth-w.screen.depth||v.focus-w.focus).flatMap(({label:v})=>{let w=this.nodes.get(v.id);return w&&w.style.display!=="none"?[{node:w,box:w.getBoundingClientRect()}]:[]}),P=[];for(let{node:v,box:w}of g)P.some(_=>w.left<_.right+3&&w.right+3>_.left&&w.top<_.bottom+3&&w.bottom+3>_.top)?v.style.display="none":P.push(w);for(let[v,w]of this.nodes)A.has(v)||(w.style.display="none")}nodeFor(t){let n=this.nodes.get(t.id);if(!n){n=document.createElement("div");let y=n.style;y.position="absolute",y.left="0",y.top="0",y.whiteSpace="nowrap",y.display="none",this.root.appendChild(n),this.nodes.set(t.id,n)}let o=this.selectedSeatLabelIds.has(t.id),i=this.nodeAppearance.get(n),r=this.wheelchairFree.get(t.id)??0,a=t.text+(t.icon??"")+(t.tint??"")+(r>0?`|${r}`:"");if(i&&i.text===a&&i.kind===t.kind&&i.color===t.color&&i.selected===o&&i.narrow===this.narrowStage)return n;if(this.nodeAppearance.set(n,{text:a,kind:t.kind,color:t.color,selected:o,narrow:this.narrowStage}),t.kind==="access")return this.paintAccessChip(n,t);if(n.textContent=t.text,o){let y=document.createElement("span"),x=y.style;x.position="absolute",x.left="50%",x.bottom=`-${Xn}px`,x.transform="translateX(-50%)",x.borderLeft=`${Xn}px solid transparent`,x.borderRight=`${Xn}px solid transparent`,x.borderTop=`${Xn}px solid ${Wn}`,n.appendChild(y)}n.setAttribute("data-label-kind",t.kind),n.toggleAttribute("data-selected-seat",o);let s=Wl[t.kind],c=n.style;c.fontSize=`${this.sizeFor(t.kind)}px`,c.fontWeight=o?"800":s.weight,c.opacity=o?"1":String(s.opacity);let l=Yn.has(t.kind),u=!l,m=L0(t.color??this.opts.ink,this.opts.backgroundRgb,!0),f=l?O0(t.color??this.opts.ink,this.opts.backgroundRgb):m;c.color=o?Hl:f.ink,c.background=o?Wn:f.backing,c.border=o?`1px solid ${Wn}`:u?`1px solid ${m.border}`:"",c.borderRadius=o||u?"999px":`${_0}px`;let d=this.narrowStage?E0:R0;c.padding=o||u?d:`${Kl}px ${Yl}px`,c.lineHeight=l?"1.1":"",c.boxShadow=o?"0 0 0 3px rgba(255,255,255,.28), 0 0 18px rgba(255,255,255,.55), 0 5px 14px rgba(0,0,0,.45)":u?"0 3px 10px rgba(0,0,0,.24)":"0 1px 4px rgba(0,0,0,.28)",c.textShadow=o||u?"none":"0 1px 1px rgba(0,0,0,0.4)",c.letterSpacing=t.kind==="zone"||t.kind==="floor"?"0.08em":"0.02em";let h=this.opts.backgroundRgb??[.04,.06,.1],p=Vt(o?Hl:f.ink)??[1,1,1],b=Ii(o?Wn:f.backing,h);return n.dataset.qualityContrast=Gt(p,b).toFixed(3),c.textTransform=t.kind==="zone"||t.kind==="floor"?"uppercase":"",t.kind==="section"&&this.dressSectionTag(n,t,r),t.kind==="gate"&&this.dressGateTag(n,t),n}dressGateTag(t,n){let o=t.style;o.background="#0f172a",o.color="#ffffff",o.border="1px solid rgba(255,255,255,0.28)",o.textTransform="uppercase",o.letterSpacing="0.06em",o.display="inline-flex",o.alignItems="center",o.gap="5px";let i=document.createElement("span");i.setAttribute("aria-hidden","true"),i.setAttribute("data-gate-arrow",n.icon==="exit"?"out":"in"),i.innerHTML=n.icon==="exit"?'<svg width="12" height="12" viewBox="0 0 12 12" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"><path d="M5 1.5H2v9h3"/><path d="M5.5 6h5M8.5 3.5 11 6 8.5 8.5"/></svg>':'<svg width="12" height="12" viewBox="0 0 12 12" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"><path d="M7 1.5h3v9H7"/><path d="M1 6h5.5M4 3.5 6.5 6 4 8.5"/></svg>',t.prepend(i),t.dataset.qualityContrast=Gt([1,1,1],Vt("#0f172a")).toFixed(3)}dressSectionTag(t,n,o){let i=n.tint?T0(n.tint):null,r=t.style;if(i&&(r.background=i.fill,r.color=i.ink,r.border=`1px solid ${i.border}`,t.dataset.qualityContrast=i.contrast.toFixed(3)),o<=0)return;let a=document.createElement("span");a.setAttribute("data-wheelchair-free",String(o)),a.setAttribute("aria-label",`${o} wheelchair ${o===1?"place":"places"} free`),a.innerHTML=`${wi("wheelchair",{size:11})}<span>${o}</span>`;let s=a.style;s.display="inline-flex",s.alignItems="center",s.gap="2px",s.marginLeft="6px",s.padding="1px 5px",s.borderRadius="999px",s.background="#2563eb",s.color="#ffffff",s.fontSize="0.85em",s.lineHeight="1.2",s.verticalAlign="middle",t.appendChild(a)}paintAccessChip(t,n){t.setAttribute("data-label-kind","access"),t.setAttribute("data-access-type",n.icon??""),t.innerHTML=n.icon?wi(n.icon,{size:un-6}):"",t.setAttribute("role","img"),t.setAttribute("aria-label",n.text);let o=t.style;return o.width=`${un}px`,o.height=`${un}px`,o.alignItems="center",o.justifyContent="center",o.borderRadius="50%",o.background=n.color??"#3b82f6",o.color=n.ink??"#ffffff",o.border="1.5px solid #ffffff",o.boxShadow="0 2px 6px rgba(0,0,0,.35)",o.padding="0",o.lineHeight="0",o.boxSizing="border-box",t.dataset.qualityContrast=Gt(Vt(n.ink??"#ffffff")??[1,1,1],Vt(n.color??"#3b82f6")??[.23,.51,.96]).toFixed(3),t}placePinHeads(t){for(;this.pinHeads.length<t.length;){let n=document.createElement("div");n.setAttribute("data-pin-head",""),n.setAttribute("aria-hidden","true");let o=n.style;o.position="absolute",o.left="0",o.top="0",o.width=`${zl}px`,o.height=`${zl}px`,o.borderRadius="50%",o.background=Wn,o.boxShadow="0 0 0 3px rgba(255,255,255,.28), 0 0 14px rgba(255,255,255,.55), 0 3px 8px rgba(0,0,0,.45)",o.pointerEvents="none",this.root.appendChild(n),this.pinHeads.push(n)}this.pinHeads.forEach((n,o)=>{let i=t[o];n.style.display=i?"":"none",i&&(n.style.transform=`translate(-50%, -100%) translate(${i.x.toFixed(1)}px, ${i.y.toFixed(1)}px)`)})}dispose(){this.pinHeads=[],this.root.remove(),this.nodes.clear()}};var ql=1;var V0=new Set(["floor","stage","zone","section","ga","booth","annotation"]);function G0(e){return e.every(t=>Number.isFinite(t))}function H0(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 $l(e){return e.length?Math.round(Math.min(...e)*100)/100:null}function Ht(e){return Math.round(e*1e4)/1e4}function z0(e){if(e)return{box:{x:Ht(e.box.x),y:Ht(e.box.y),width:Ht(e.box.width),height:Ht(e.box.height)},horizontalFillRatio:Ht(e.horizontalFillRatio),verticalFillRatio:Ht(e.verticalFillRatio),visibleAreaRatio:Ht(e.visibleAreaRatio),clippedEdges:[...e.clippedEdges]}}function st(e,t,n){return n.length?{code:e,message:t,count:n.length,samples:n.slice(0,20)}:null}function Ho(e){let t=e.labels.filter(s=>s.visible&&s.screenBox),n=t.filter(s=>V0.has(s.kind)),o=e.scene.floorCount>1?e.scene.floorCount:e.scene.zoneCount||e.scene.sectionCount,i=[];for(let s=0;s<n.length;s+=1)for(let c=0;c<s;c+=1)H0(n[s].screenBox,n[c].screenBox)&&i.push({primaryId:n[s].id,primaryLabel:n[s].text,secondaryId:n[c].id});let r=[...e.camera.position,e.camera.distance,e.camera.verticalFovDeg],a=[st("webgl2-unavailable","The venue scene must render through WebGL2",e.context.webgl2?[]:[{primaryId:"renderer",primaryLabel:"WebGL2"}]),st("context-lost","The WebGL context must be live at capture",e.context.lost?[{primaryId:"renderer",primaryLabel:"context lost"}]:[]),st("frame-not-stable","The captured 3D frame must be rendered and parked",e.frame.rendered>0&&e.frame.idle?[]:[{primaryId:"renderer",primaryLabel:"unstable frame"}]),st("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}`}]),st("camera-invalid","The capture camera must have a finite physical pose",G0(r)&&e.camera.distance>0&&e.camera.verticalFovDeg>0&&e.camera.verticalFovDeg<180?[]:[{primaryId:"camera",primaryLabel:"invalid pose"}]),st("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}]),st("hierarchy-label-missing","A venue with authored hierarchy must show at least one structural label",o===0||n.length>0?[]:[{primaryId:"labels",primaryLabel:`${o} expected hierarchy labels`}]),st("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}))),st("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}))),st("hierarchy-label-collision","Visible 3D hierarchy labels must not overlap",i)].filter(s=>!!s);return{version:1,state:"venue3d",passed:a.length===0,resolvedRules:["rendered-3d-webgl-context","rendered-3d-stable-frame","rendered-3d-camera-pose","rendered-3d-relief-projection","rendered-3d-label-size","rendered-3d-label-contrast","rendered-3d-label-collision"],viewport:e.viewport,context:e.context,frame:e.frame,camera:e.camera,scene:e.scene,composition:{visibleLabels:t.map(({id:s,kind:c,text:l})=>({id:s,kind:c,text:l})).sort((s,c)=>s.kind.localeCompare(c.kind)||s.id.localeCompare(c.id)),framing:z0(e.framing)},metrics:{minimumHierarchyFontPx:$l(n.map(s=>s.renderedFontPx)),minimumHierarchyContrast:$l(n.map(s=>s.contrast)),projectedReliefPx:Math.round(e.scene.projectedReliefPx*100)/100},findings:a}}function Zl(e,t,n){e.fill(0);for(let o=0;o<Math.min(n,t.length);o++)e[t[o]]=1}var Ce=require("ogl");var At=require("ogl");var zo=`
|
|
49
80
|
float chairWeight(float depth) {
|
|
50
81
|
return 1.0 - smoothstep(uChairFull, uChairNone, depth);
|
|
51
|
-
}`,
|
|
82
|
+
}`,Ql=`
|
|
52
83
|
float occupantWeight(float depth) {
|
|
53
|
-
float nearWeight = smoothstep(${
|
|
54
|
-
float farWeight = 1.0 - smoothstep(${
|
|
84
|
+
float nearWeight = smoothstep(${Ta.toFixed(1)}, ${ka.toFixed(1)}, depth);
|
|
85
|
+
float farWeight = 1.0 - smoothstep(${Ca.toFixed(1)}, ${_a.toFixed(1)}, depth);
|
|
55
86
|
return nearWeight * farWeight;
|
|
56
|
-
}`,
|
|
87
|
+
}`,Ri=`
|
|
57
88
|
float glyphEq(float glyph, float expected) {
|
|
58
89
|
return 1.0 - step(0.25, abs(glyph - expected));
|
|
59
90
|
}
|
|
@@ -102,7 +133,7 @@ vec3 glyphChairPosition(vec3 p, float partId, float glyph) {
|
|
|
102
133
|
p.y += 0.16;
|
|
103
134
|
}
|
|
104
135
|
return p;
|
|
105
|
-
}`,
|
|
136
|
+
}`,U0=1.5,mn=`
|
|
106
137
|
uniform vec4 uSeeThrough; // xyz = the seats looked at, w = cone radius there; 0 = off
|
|
107
138
|
bool seeThroughCut(vec3 p, vec3 eye) {
|
|
108
139
|
if (uSeeThrough.w <= 0.0) return false;
|
|
@@ -111,11 +142,11 @@ bool seeThroughCut(vec3 p, vec3 eye) {
|
|
|
111
142
|
if (len < 1.0) return false;
|
|
112
143
|
vec3 dir = axis / len;
|
|
113
144
|
float t = dot(p - eye, dir);
|
|
114
|
-
if (t <= 0.0 || t > len - ${
|
|
145
|
+
if (t <= 0.0 || t > len - ${U0.toFixed(2)}) return false;
|
|
115
146
|
vec3 onLine = eye + dir * t;
|
|
116
147
|
if (p.y < onLine.y - 0.25) return false;
|
|
117
148
|
return length(p - onLine) < uSeeThrough.w * t / len;
|
|
118
|
-
}`,
|
|
149
|
+
}`,j0=`#version 300 es
|
|
119
150
|
precision highp float;
|
|
120
151
|
in vec3 position;
|
|
121
152
|
in vec3 normal;
|
|
@@ -153,13 +184,13 @@ void main() {
|
|
|
153
184
|
vNormalWorld = normalize(mat3(modelMatrix) * normal);
|
|
154
185
|
vColor = color;
|
|
155
186
|
gl_Position = projectionMatrix * mv;
|
|
156
|
-
}`,
|
|
187
|
+
}`,Jl=`
|
|
157
188
|
bool roomWallHidden(float material, vec3 normalWorld, vec3 posWorld, vec3 eye, vec2 roomCentre) {
|
|
158
189
|
if (abs(material - 6.0) > 0.5) return false;
|
|
159
190
|
vec3 n = normalize(normalWorld);
|
|
160
191
|
if (abs(n.y) > 0.5) return true;
|
|
161
192
|
return dot(n.xz, eye.xz - posWorld.xz) * dot(n.xz, roomCentre - posWorld.xz) <= 0.0;
|
|
162
|
-
}`,
|
|
193
|
+
}`,W0=`#version 300 es
|
|
163
194
|
precision highp float;
|
|
164
195
|
in vec3 vColor;
|
|
165
196
|
in vec3 vNormalWorld;
|
|
@@ -179,8 +210,8 @@ uniform mat4 uShadowMatrix;
|
|
|
179
210
|
uniform vec3 cameraPosition;
|
|
180
211
|
uniform vec2 uRoomCentre;
|
|
181
212
|
out vec4 fragColor;
|
|
182
|
-
${
|
|
183
|
-
${
|
|
213
|
+
${Jl}
|
|
214
|
+
${mn}
|
|
184
215
|
// Stable world-space variation; no textures or per-frame random grain.
|
|
185
216
|
float turfHash(vec2 p) {
|
|
186
217
|
vec3 q = fract(vec3(p.xyx) * 0.1031);
|
|
@@ -311,8 +342,8 @@ void main() {
|
|
|
311
342
|
+ vec3(0.20, 0.10, 0.34) * focalHalo;
|
|
312
343
|
base = mix(base, display, poweredDisplay * verticalFace * 0.92);
|
|
313
344
|
fragColor = vec4(base, 1.0);
|
|
314
|
-
}`,
|
|
315
|
-
${
|
|
345
|
+
}`,eu=`
|
|
346
|
+
${Ri}
|
|
316
347
|
vec4 seatSurface(vec3 source, float radius) {
|
|
317
348
|
vec4 origin = modelViewMatrix * vec4(iOffset, 1.0);
|
|
318
349
|
if (iPhysicalSeat < 0.5) {
|
|
@@ -326,12 +357,12 @@ vec4 seatSurface(vec3 source, float radius) {
|
|
|
326
357
|
if (surface < 0.5) return origin;
|
|
327
358
|
vec3 p = glyphChairPosition(source, surface, iGlyph);
|
|
328
359
|
p.xz *= iChairWidth;
|
|
329
|
-
if (surface > 1.5) p.z -= max(p.y - ${
|
|
360
|
+
if (surface > 1.5) p.z -= max(p.y - ${bt.toFixed(2)}, 0.0) * ${Mn.toFixed(2)} * glyphBackRake(iGlyph);
|
|
330
361
|
float c = cos(iYaw), s = sin(iYaw);
|
|
331
362
|
vec3 rotated = vec3(p.x * c + p.z * s, p.y, -p.x * s + p.z * c);
|
|
332
363
|
return modelViewMatrix * vec4(iOffset + rotated, 1.0);
|
|
333
364
|
}
|
|
334
|
-
`,
|
|
365
|
+
`,X0=`#version 300 es
|
|
335
366
|
precision highp float;
|
|
336
367
|
in float surface;
|
|
337
368
|
in float iYaw;
|
|
@@ -371,9 +402,9 @@ out float vDotWeight; // 1 = the dot IS this seat, 0 = the chair has taken over
|
|
|
371
402
|
out float vPhysicalSeat;
|
|
372
403
|
out float vPixelRadius;
|
|
373
404
|
uniform vec3 cameraPosition;
|
|
374
|
-
${
|
|
375
|
-
${
|
|
376
|
-
${
|
|
405
|
+
${zo}
|
|
406
|
+
${eu}
|
|
407
|
+
${mn}
|
|
377
408
|
void main() {
|
|
378
409
|
if (seeThroughCut(iOffset, cameraPosition)) { gl_Position = vec4(2.0, 2.0, 2.0, 1.0); return; }
|
|
379
410
|
vec4 mv = modelViewMatrix * vec4(iOffset, 1.0);
|
|
@@ -395,7 +426,7 @@ void main() {
|
|
|
395
426
|
mv = seatSurface(position, r);
|
|
396
427
|
// Match the shell's non-uniform width/depth scale before its back rake.
|
|
397
428
|
vec3 n = vec3(normal.x / iChairWidth, normal.y, normal.z / iChairWidth);
|
|
398
|
-
if (surface > 1.5) n.y += n.z * ${
|
|
429
|
+
if (surface > 1.5) n.y += n.z * ${Mn.toFixed(2)} * glyphBackRake(iGlyph);
|
|
399
430
|
n = normalize(n);
|
|
400
431
|
vSeatNormal = vec3(n.x * cos(iYaw) + n.z * sin(iYaw), n.y, -n.x * sin(iYaw) + n.z * cos(iYaw));
|
|
401
432
|
vSeatHeight = position.y;
|
|
@@ -407,13 +438,13 @@ void main() {
|
|
|
407
438
|
vDim = (uFocusFloor < -0.5 || abs(iFloor - uFocusFloor) < 0.5) ? 0.0 : 1.0;
|
|
408
439
|
vSectionFade = (uFocusSection < -0.5 || abs(iSection - uFocusSection) < 0.5) ? 0.0 : 1.0;
|
|
409
440
|
gl_Position = projectionMatrix * mv;
|
|
410
|
-
}`,
|
|
441
|
+
}`,tu=`
|
|
411
442
|
float seatSilhouette(vec2 uv, float physical) {
|
|
412
443
|
// Solid furniture owns its silhouette in geometry. Only empty bays need
|
|
413
444
|
// a fragment mask; cutting physical faces would open holes in the volume.
|
|
414
445
|
return mix(max(abs(uv.x), abs(uv.y)), 0.0, physical);
|
|
415
446
|
}
|
|
416
|
-
`,
|
|
447
|
+
`,Y0=`#version 300 es
|
|
417
448
|
precision highp float;
|
|
418
449
|
in vec3 vSeatNormal;
|
|
419
450
|
in float vSeatHeight;
|
|
@@ -433,7 +464,7 @@ uniform float uSeatDetail; // 0 for venue/area overview; 1 in section/row/sea
|
|
|
433
464
|
uniform vec3 uFadeColor;
|
|
434
465
|
uniform float uRoughness;
|
|
435
466
|
out vec4 fragColor;
|
|
436
|
-
${
|
|
467
|
+
${tu}
|
|
437
468
|
void main() {
|
|
438
469
|
if (vDim > 0.5) discard;
|
|
439
470
|
// Same screen-door dissolve as the structure rung (uStructureDetail): the
|
|
@@ -498,7 +529,7 @@ void main() {
|
|
|
498
529
|
c = mix(c, mix(vec3(lum), vec3(0.93), 0.35), 0.45);
|
|
499
530
|
}
|
|
500
531
|
fragColor = vec4(c, alpha);
|
|
501
|
-
}`,
|
|
532
|
+
}`,K0=`#version 300 es
|
|
502
533
|
precision highp float;
|
|
503
534
|
in vec3 position; // local: x/z in units of the seat radius, y in METRES
|
|
504
535
|
in vec3 normal;
|
|
@@ -534,11 +565,11 @@ out float vSectionFade;
|
|
|
534
565
|
out float vOccupant; // 1 = this vertex belongs to a person, not to the chair
|
|
535
566
|
out vec3 vOccupantTint;
|
|
536
567
|
out float vTaken; // 1 = sold or held: not for sale
|
|
537
|
-
${
|
|
538
|
-
${
|
|
539
|
-
${
|
|
568
|
+
${zo}
|
|
569
|
+
${Ql}
|
|
570
|
+
${Ri}
|
|
540
571
|
uniform vec3 cameraPosition;
|
|
541
|
-
${
|
|
572
|
+
${mn}
|
|
542
573
|
void main() {
|
|
543
574
|
if (seeThroughCut(iOffset, cameraPosition)) { gl_Position = vec4(2.0, 2.0, 2.0, 1.0); return; }
|
|
544
575
|
vec4 anchor = modelViewMatrix * vec4(iOffset, 1.0);
|
|
@@ -625,7 +656,7 @@ void main() {
|
|
|
625
656
|
vDim = (uFocusFloor < -0.5 || abs(iFloor - uFocusFloor) < 0.5) ? 0.0 : 1.0;
|
|
626
657
|
vSectionFade = (uFocusSection < -0.5 || abs(iSection - uFocusSection) < 0.5) ? 0.0 : 1.0;
|
|
627
658
|
gl_Position = projectionMatrix * mv;
|
|
628
|
-
}
|
|
659
|
+
}`,$0=`#version 300 es
|
|
629
660
|
precision highp float;
|
|
630
661
|
in vec3 vColor;
|
|
631
662
|
in vec3 vNormalWorld;
|
|
@@ -656,6 +687,17 @@ void main() {
|
|
|
656
687
|
float fill = max(dot(N, fillDir), 0.0);
|
|
657
688
|
vec3 tint = vColor;
|
|
658
689
|
if (vOccupant > 0.5) tint = vOccupantTint;
|
|
690
|
+
// The crowd in taken seats is one crisp, dark tone, not the seat's muted
|
|
691
|
+
// grey: on a light venue that grey went pale, and the people read as soft
|
|
692
|
+
// grey blobs (owner, 2026-09-25: "not crisp"). Dark silhouettes with the rim
|
|
693
|
+
// below read as an audience at every distance; the head is a step lighter so
|
|
694
|
+
// it separates from the shoulders.
|
|
695
|
+
if (vOccupant > 0.5 && vTaken > 0.5) {
|
|
696
|
+
// A little per-person variety (the clothing hash), so a full stand reads
|
|
697
|
+
// as people and not as one moulded block.
|
|
698
|
+
float vary = dot(vOccupantTint, vec3(0.33)) - 0.3;
|
|
699
|
+
tint = (vPart > 10.5 ? vec3(0.31, 0.32, 0.36) : vec3(0.19, 0.22, 0.27)) + vary * 0.12;
|
|
700
|
+
}
|
|
659
701
|
// The accommodation ring, kept legible once the dot (which drew it) is gone:
|
|
660
702
|
// an accessible seat's support is painted in the ring colour, so the marker
|
|
661
703
|
// survives to close range instead of vanishing exactly when the buyer arrives.
|
|
@@ -692,7 +734,7 @@ void main() {
|
|
|
692
734
|
// toward the venue. Their own clothing and the chair's category tint made a
|
|
693
735
|
// taken seat look like any other at a glance (owner report, 2026-09-23);
|
|
694
736
|
// now only the seats a buyer can take wear full colour.
|
|
695
|
-
if (vTaken > 0.5) {
|
|
737
|
+
if (vTaken > 0.5 && vOccupant < 0.5) {
|
|
696
738
|
float takenLum = dot(base, vec3(0.299, 0.587, 0.114));
|
|
697
739
|
base = mix(vec3(takenLum), uFadeColor, 0.35) * 0.92;
|
|
698
740
|
}
|
|
@@ -703,14 +745,14 @@ void main() {
|
|
|
703
745
|
base = mix(base, mix(vec3(lum), vec3(0.93), 0.35), 0.45);
|
|
704
746
|
}
|
|
705
747
|
fragColor = vec4(base, 1.0);
|
|
706
|
-
}`,
|
|
748
|
+
}`,q0=`#version 300 es
|
|
707
749
|
precision highp float;
|
|
708
750
|
in vec2 position;
|
|
709
751
|
out vec2 vUv;
|
|
710
752
|
void main() {
|
|
711
753
|
vUv = position * 0.5 + 0.5;
|
|
712
754
|
gl_Position = vec4(position, 0.999, 1.0);
|
|
713
|
-
}`,
|
|
755
|
+
}`,Z0=`#version 300 es
|
|
714
756
|
precision highp float;
|
|
715
757
|
in vec2 vUv;
|
|
716
758
|
uniform vec3 uTop;
|
|
@@ -741,7 +783,7 @@ void main() {
|
|
|
741
783
|
col = mix(col, sky, smoothstep(-0.22, 0.03, up));
|
|
742
784
|
}
|
|
743
785
|
fragColor = vec4(col, 1.0);
|
|
744
|
-
}`,
|
|
786
|
+
}`,Q0=`#version 300 es
|
|
745
787
|
precision highp float;
|
|
746
788
|
in float surface;
|
|
747
789
|
in float iYaw;
|
|
@@ -770,9 +812,9 @@ out float vDotWeight;
|
|
|
770
812
|
out float vHidden;
|
|
771
813
|
flat out vec3 vPick;
|
|
772
814
|
uniform vec3 cameraPosition;
|
|
773
|
-
${
|
|
774
|
-
${
|
|
775
|
-
${
|
|
815
|
+
${zo}
|
|
816
|
+
${eu}
|
|
817
|
+
${mn}
|
|
776
818
|
void main() {
|
|
777
819
|
if (seeThroughCut(iOffset, cameraPosition)) { gl_Position = vec4(2.0, 2.0, 2.0, 1.0); return; }
|
|
778
820
|
int id = gl_InstanceID + 1; // 0 reserved for no-hit
|
|
@@ -787,7 +829,7 @@ void main() {
|
|
|
787
829
|
vPhysicalSeat = iPhysicalSeat;
|
|
788
830
|
vHidden = (uFocusFloor > -0.5 && abs(iFloor - uFocusFloor) > 0.5) ? 1.0 : 0.0;
|
|
789
831
|
gl_Position = projectionMatrix * mv;
|
|
790
|
-
}`,
|
|
832
|
+
}`,J0=`#version 300 es
|
|
791
833
|
precision highp float;
|
|
792
834
|
in vec2 vUv;
|
|
793
835
|
in float vPhysicalSeat;
|
|
@@ -795,7 +837,7 @@ in float vDotWeight;
|
|
|
795
837
|
in float vHidden;
|
|
796
838
|
flat in vec3 vPick;
|
|
797
839
|
out vec4 fragColor;
|
|
798
|
-
${
|
|
840
|
+
${tu}
|
|
799
841
|
void main() {
|
|
800
842
|
if (vHidden > 0.5) discard;
|
|
801
843
|
if (vDotWeight <= 0.99) discard;
|
|
@@ -803,7 +845,7 @@ void main() {
|
|
|
803
845
|
float d = seatSilhouette(vUv, vPhysicalSeat);
|
|
804
846
|
if (d > 1.0) discard; // hit-mask matches chair/bay shape
|
|
805
847
|
fragColor = vec4(vPick, 1.0);
|
|
806
|
-
}`,
|
|
848
|
+
}`,eg=`#version 300 es
|
|
807
849
|
precision highp float;
|
|
808
850
|
in vec3 position;
|
|
809
851
|
in float part;
|
|
@@ -826,10 +868,10 @@ flat out vec3 vPick;
|
|
|
826
868
|
out float vChairWeight;
|
|
827
869
|
out float vHidden;
|
|
828
870
|
uniform vec3 cameraPosition;
|
|
829
|
-
${
|
|
830
|
-
${
|
|
831
|
-
${
|
|
832
|
-
${
|
|
871
|
+
${zo}
|
|
872
|
+
${Ql}
|
|
873
|
+
${Ri}
|
|
874
|
+
${mn}
|
|
833
875
|
void main() {
|
|
834
876
|
if (seeThroughCut(iOffset, cameraPosition)) { gl_Position = vec4(2.0, 2.0, 2.0, 1.0); return; }
|
|
835
877
|
int id = int(iPickIndex + 0.5); // already global index + 1
|
|
@@ -864,7 +906,7 @@ void main() {
|
|
|
864
906
|
float c = cos(iYaw), s = sin(iYaw);
|
|
865
907
|
vec3 rp = vec3(p.x * c + p.z * s, p.y, -p.x * s + p.z * c);
|
|
866
908
|
gl_Position = projectionMatrix * modelViewMatrix * vec4(iOffset + rp, 1.0);
|
|
867
|
-
}`,
|
|
909
|
+
}`,tg=`#version 300 es
|
|
868
910
|
precision highp float;
|
|
869
911
|
flat in vec3 vPick;
|
|
870
912
|
in float vHidden;
|
|
@@ -874,7 +916,7 @@ void main() {
|
|
|
874
916
|
if (vHidden > 0.5) discard;
|
|
875
917
|
if (vChairWeight < 0.01) discard;
|
|
876
918
|
fragColor = vec4(vPick, 1.0);
|
|
877
|
-
}
|
|
919
|
+
}`,ng=`#version 300 es
|
|
878
920
|
precision highp float;
|
|
879
921
|
in vec3 position;
|
|
880
922
|
in vec3 normal;
|
|
@@ -894,7 +936,7 @@ void main() {
|
|
|
894
936
|
vNormalWorld = mat3(modelMatrix) * normal;
|
|
895
937
|
vPosWorld = (modelMatrix * vec4(position, 1.0)).xyz;
|
|
896
938
|
gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
|
|
897
|
-
}`,
|
|
939
|
+
}`,og=`#version 300 es
|
|
898
940
|
precision highp float;
|
|
899
941
|
in float vHidden;
|
|
900
942
|
in float vMaterial;
|
|
@@ -903,14 +945,14 @@ in vec3 vPosWorld;
|
|
|
903
945
|
uniform vec3 cameraPosition;
|
|
904
946
|
uniform vec2 uRoomCentre;
|
|
905
947
|
out vec4 fragColor;
|
|
906
|
-
${
|
|
907
|
-
${
|
|
948
|
+
${Jl}
|
|
949
|
+
${mn}
|
|
908
950
|
void main() {
|
|
909
951
|
if (vHidden > 0.5) discard;
|
|
910
952
|
if (roomWallHidden(vMaterial, vNormalWorld, vPosWorld, cameraPosition, uRoomCentre)) discard;
|
|
911
953
|
if (seeThroughCut(vPosWorld, cameraPosition)) discard;
|
|
912
954
|
fragColor = vec4(0.0, 0.0, 0.0, 1.0);
|
|
913
|
-
}`;function
|
|
955
|
+
}`;function nu(e){return new At.Program(e,{vertex:Q0,fragment:J0,transparent:!1,depthTest:!0,depthWrite:!0,cullFace:!1,uniforms:{uSeeThrough:{value:[0,0,0,0]},uSeatRadius:{value:ut},uSeatScale:{value:1},uMinPixels:{value:Xt},uPixelToWorld:{value:.002},uChairFull:{value:An},uChairNone:{value:Yt},uFocusFloor:{value:-1}}})}function ou(e){return new At.Program(e,{vertex:eg,fragment:tg,transparent:!1,depthTest:!0,depthWrite:!0,cullFace:!1,uniforms:{uSeeThrough:{value:[0,0,0,0]},uChairFull:{value:An},uChairNone:{value:Yt},uBackRake:{value:Mn},uBackBase:{value:bt},uFocusFloor:{value:-1}}})}function ru(e){return new At.Program(e,{vertex:ng,fragment:og,transparent:!1,depthTest:!0,depthWrite:!0,cullFace:!1,uniforms:{uSeeThrough:{value:[0,0,0,0]},uFocusFloor:{value:-1},uRoomCentre:{value:new Float32Array([0,0])}}})}function iu(e,t=.78,n=[.63,.66,.65]){return new At.Program(e,{vertex:j0,fragment:W0,cullFace:!1,depthTest:!0,depthWrite:!0,uniforms:{uSeeThrough:{value:[0,0,0,0]},uKeyDir:{value:new Float32Array([-.48,.78,.4])},uFocusFloor:{value:-1},uStructureDetail:{value:0},uDeckColor:{value:new Float32Array(n)},uSectionFilter:{value:0},uRoughness:{value:t},uRoomCentre:{value:new Float32Array([0,0])}}})}function au(e){return new At.Program(e,{vertex:X0,fragment:Y0,transparent:!0,depthTest:!0,depthWrite:!0,cullFace:!1,uniforms:{uSeeThrough:{value:[0,0,0,0]},uKeyDir:{value:new Float32Array([-.48,.78,.4])},uSeatRadius:{value:ut},uSeatScale:{value:1},uMinPixels:{value:Xt},uPixelToWorld:{value:.002},uSeatFade:{value:0},uSeatDetail:{value:0},uFocusFloor:{value:-1},uFocusSection:{value:-1},uFadeColor:{value:new Float32Array([.32,.37,.43])},uChairFull:{value:An},uChairNone:{value:Yt}}})}function su(e,t=.78){return new At.Program(e,{vertex:K0,fragment:$0,transparent:!1,depthTest:!0,depthWrite:!0,cullFace:!1,uniforms:{uSeeThrough:{value:[0,0,0,0]},uKeyDir:{value:new Float32Array([-.48,.78,.4])},uFadeColor:{value:new Float32Array([.32,.37,.43])},uChairFull:{value:An},uChairNone:{value:Yt},uBackRake:{value:Mn},uBackBase:{value:bt},uFocusFloor:{value:-1},uFocusSection:{value:-1},uRoughness:{value:t}}})}function cu(e,t,n,o){return new At.Program(e,{vertex:q0,fragment:Z0,depthTest:!1,depthWrite:!1,cullFace:!1,uniforms:{uTop:{value:new Float32Array(t)},uBottom:{value:new Float32Array(n)},uSky:{value:o?1:0},uZenith:{value:new Float32Array(o?.zenith??[0,0,0])},uHorizon:{value:new Float32Array(o?.horizon??[0,0,0])},uInvViewProj:{value:new Float32Array(16)}}})}var Xe=require("ogl");function lu(e,t,n){let i=Math.max(3,n.radius*1.04),[r,a,s]=n.center,c=new Xe.Camera(e,{left:-i,right:i,bottom:-i,top:i,near:.1,far:i*6});c.position.set(r-i*1.44,a+i*2.34,s+i*1.2),c.lookAt([r,a,s]);let l=new Xe.RenderTarget(e,{width:1024,height:1024,depthTexture:!0,minFilter:e.NEAREST,magFilter:e.NEAREST}),u=new Xe.Program(e,{cullFace:!1,vertex:`#version 300 es
|
|
914
956
|
in vec3 position;
|
|
915
957
|
in float materialIndex;
|
|
916
958
|
uniform mat4 modelViewMatrix;
|
|
@@ -923,7 +965,7 @@ void main() {
|
|
|
923
965
|
void main() {
|
|
924
966
|
if (abs(vMaterial - 6.0) < 0.5) discard;
|
|
925
967
|
fragColor = vec4(1.0);
|
|
926
|
-
}`}),m=new
|
|
968
|
+
}`}),m=new Xe.Transform,f=new Xe.Mesh(e,{geometry:t,program:u});f.frustumCulled=!1,f.setParent(m);let d=e.getParameter(e.COLOR_CLEAR_VALUE),h=e.isEnabled(e.DITHER);try{e.disable(e.DITHER),e.clearColor(1,1,1,1),e.renderer.render({scene:m,camera:c,target:l})}finally{h&&e.enable(e.DITHER),e.clearColor(d[0],d[1],d[2],d[3]),u.remove()}let p=new Xe.Mat4().multiply(c.projectionMatrix,c.viewMatrix);return{texture:l.depthTexture,matrix:p,dispose(){for(let b of l.textures)e.deleteTexture(b.texture);e.deleteTexture(l.depthTexture.texture),e.deleteFramebuffer(l.buffer),l.depthBuffer&&e.deleteRenderbuffer(l.depthBuffer)}}}var rg=.65,ig=new Set(["dimmed","sold"]),ag=new Set(["dimmed","sold","held"]);function uu(e,t,n){let o=new Set,i=!1,r=_e.indexOf("dimmed"),a=!1;for(let c=0;c<n.length;c+=1)if(n[c]===r){a=!0;break}let s=a?ag:ig;for(let c of e){let l=t.get(c.sectionId);if(!l||!l.length){o.add(c.sectionId);continue}let u=!1;for(let m of l){let f=_e[n[m]]??"available";if(!s.has(f)){u=!0;break}}u?o.add(c.sectionId):i=!0}return{lit:o,anyUnlit:i}}function mu(e,t,n,o,i,r){let a=[];for(let s of e){let c=i===null||i.has(s.sectionId);if(o.get(s.sectionId)===c)continue;o.set(s.sectionId,c);let l=(s.start+s.count)*3;for(let u=s.start*3;u<l;u++)t[u]=c?n[u]:n[u]+(r[u%3]-n[u])*rg;a.push(s)}return a}var fu=_e.indexOf("selected");function sg(e,t){return[0,1,2].map(n=>e[n]*.15+.75+t[n]*.1)}function du(e,t,n,o,i,r){for(let a=n;a<n+o;a++){let s=r&&t[a]===0,c=r&&t[a]===fu?sg([r[a*3],r[a*3+1],r[a*3+2]],i[fu]??i[0]):s?null:i[t[a]]??i[0];e[a*3]=c?c[0]:r[a*3],e[a*3+1]=c?c[1]:r[a*3+1],e[a*3+2]=c?c[2]:r[a*3+2]}}var cg=new Float32Array([-1,-1,3,-1,-1,3]);function hu(e,t){let n=new Ce.Transform,o=new Ce.Transform,i=new Ce.Geometry(e,{position:{size:2,data:cg}}),r=cu(e,t.theme.background.top,t.theme.background.bottom,t.outdoor?t.theme.sky:null),a=new Ce.Mesh(e,{geometry:i,program:r});a.frustumCulled=!1,a.setParent(o);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=lu(e,s,t.renderBounds),l=iu(e,t.theme.materials.roughness,t.theme.structure.tierTop);l.uniforms.tVenueShadow={value:c.texture},l.uniforms.uShadowMatrix={value:c.matrix},t.room&&l.uniforms.uRoomCentre.value.set(t.room.centre);let u=new Ce.Mesh(e,{geometry:s,program:l});u.frustumCulled=!1,u.setParent(n);let m=au(e),f=new Float32Array(t.seats.count*3),d=_e.map(K=>t.theme.seatStates[K]),h=t.seats.iCategory.slice();for(let K=0;K<t.seats.count;K++){if(t.seats.iPhysicalSeat[K]<.5)continue;let re=t.theme.materials.seat??xa([h[K*3],h[K*3+1],h[K*3+2]]);h.set(re,K*3)}du(f,t.seats.iState,0,t.seats.count,d,h);let p=ha(),b=new Uint8Array(t.seats.count),y=new Ce.Geometry(e,{position:{size:3,data:p.position},normal:{size:3,data:p.normal},uv:{size:2,data:p.uv},index:{size:1,data:p.index},surface:{size:1,data:p.surface},iYaw:{size:1,data:t.seats.iYaw,instanced:1},iChairWidth:{size:1,data:t.seats.iChairWidth,instanced:1},iGlyph:{size:1,data:t.seats.iGlyph,instanced:1},iOffset:{size:3,data:t.seats.iPosition,instanced:1},iColor:{size:3,data:f,instanced:1},iMaxRadius:{size:1,data:t.seats.iMaxRadius,instanced:1},iHasChair:{size:1,data:b,type:e.UNSIGNED_BYTE,usage:e.DYNAMIC_DRAW,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},iSection:{size:1,data:t.seats.iSection,instanced:1}}),x=new Ce.Mesh(e,{geometry:y,program:m});x.frustumCulled=!1,t.seats.count>0&&x.setParent(n);let S=y.attributes.iColor,A=t.solids.color.slice(),M=t.theme.structure.ground,g=new Map(t.sectionSolidRanges.map(K=>[K.sectionId,!0])),P=ma(),v=su(e,t.theme.materials.roughness),w=io,R=new Float32Array(w*3),_=new Float32Array(w*3),F=new Float32Array(w),E=new Float32Array(w),I=new Float32Array(w),T=new Float32Array(w*3),L=new Float32Array(w),V=new Float32Array(w),O=new Float32Array(w),H=new Float32Array(w),j=new Float32Array(w),N=new Ce.Geometry(e,{position:{size:3,data:P.position},normal:{size:3,data:P.normal},part:{size:1,data:P.part},index:{data:P.index},iOffset:{size:3,data:R,instanced:1},iColor:{size:3,data:_,instanced:1},iRadius:{size:1,data:F,instanced:1},iYaw:{size:1,data:E,instanced:1},iGlyph:{size:1,data:I,instanced:1},iRing:{size:3,data:T,instanced:1},iFloor:{size:1,data:L,instanced:1},iSection:{size:1,data:V,instanced:1},iPhysicalSeat:{size:1,data:O,instanced:1},iSeed:{size:1,data:j,instanced:1},iPickIndex:{size:1,data:H,instanced:1}}),k=new Ce.Mesh(e,{geometry:N,program:v});k.frustumCulled=!1;let B=0,D=!1,G=!1,U=null,q=null,$=null,ee=new Int32Array(0),Q=()=>{let K=t.seats;for(let re=0;re<B;re++){let ne=ee[re];j[re]=ja(K.iState[ne],ne),_[re*3]=f[ne*3],_[re*3+1]=f[ne*3+1],_[re*3+2]=f[ne*3+2]}N.attributes.iColor.needsUpdate=!0,N.attributes.iSeed.needsUpdate=!0},X={main:n,background:o,backgroundProgram:r,seatProgram:m,solidProgram:l,chairProgram:v,seatGeometry:y,chairGeometry:N,solidGeometry:s,drawCalls:3,setNearSeats(K,re){let ne=Math.min(re,w,K.length);if(Zl(b,K,ne),y.attributes.iHasChair.needsUpdate=!0,ee=K,B=ne,ne===0){k.parent&&k.setParent(null),N.instancedCount=0,X.drawCalls=3+(D?1:0);return}let se=t.seats;for(let J=0;J<ne;J++){let ie=K[J];R[J*3]=se.iPosition[ie*3],R[J*3+1]=se.iPosition[ie*3+1],R[J*3+2]=se.iPosition[ie*3+2],F[J]=se.iChairWidth[ie],E[J]=se.iYaw[ie],I[J]=se.iGlyph[ie],T[J*3]=se.iRing[ie*3],T[J*3+1]=se.iRing[ie*3+1],T[J*3+2]=se.iRing[ie*3+2],L[J]=se.iFloor[ie],V[J]=se.iSection[ie],O[J]=se.iPhysicalSeat[ie],H[J]=ie+1}Q(),N.attributes.iOffset.needsUpdate=!0,N.attributes.iRadius.needsUpdate=!0,N.attributes.iYaw.needsUpdate=!0,N.attributes.iGlyph.needsUpdate=!0,N.attributes.iRing.needsUpdate=!0,N.attributes.iFloor.needsUpdate=!0,N.attributes.iSection.needsUpdate=!0,N.attributes.iPhysicalSeat.needsUpdate=!0,N.attributes.iSeed.needsUpdate=!0,N.attributes.iPickIndex.needsUpdate=!0,N.instancedCount=ne,k.parent||k.setParent(n),X.drawCalls=4+(D?1:0)},nearSeatCount(){return B},setSectionShellLit(K){l.uniforms.uSectionFilter.value=K===null?0:1;let re=mu(t.sectionSolidRanges,t.solids.color,A,g,K,M);if(!re.length)return;let ne=s.attributes.color,se=ne.buffer;if(!se){ne.needsUpdate=!0;return}e.bindBuffer(e.ARRAY_BUFFER,se);for(let J of re){let ie=t.solids.color.subarray(J.start*3,(J.start+J.count)*3);e.bufferSubData(e.ARRAY_BUFFER,J.start*3*Float32Array.BYTES_PER_ELEMENT,ie)}},uploadSeatStateRuns(K){if(!K.length)return;B&&Q();for(let ne of K)du(f,t.seats.iState,ne.start,ne.length,d,h);let re=S.buffer;if(!re){S.needsUpdate=!0;return}e.bindBuffer(e.ARRAY_BUFFER,re);for(let ne of K){let se=f.subarray(ne.start*3,(ne.start+ne.length)*3);e.bufferSubData(e.ARRAY_BUFFER,ne.start*3*Float32Array.BYTES_PER_ELEMENT,se)}},dispose(){G=!0,c.dispose(),i.remove(),r.remove(),s.remove(),l.remove(),y.remove(),m.remove(),N.remove(),v.remove(),U?.remove(),q?.remove(),$?.texture&&e.deleteTexture($.texture)}},Y=t.productionElements.find(K=>K.contentImageUrl&&K.contentPlane);if(Y?.contentImageUrl&&Y.contentPlane?.length===4&&typeof Image<"u"){let K=new Image;K.crossOrigin="anonymous",K.onload=()=>{if(G)return;let re=Y.contentPlane;U=new Ce.Geometry(e,{position:{size:3,data:new Float32Array(re.flat())},uv:{size:2,data:new Float32Array([0,1,1,1,0,0,1,0])},floorIndex:{size:1,data:new Float32Array(4).fill(Y.floorIndex)},index:{data:new Uint16Array([0,1,2,2,1,3])}}),$=new Ce.Texture(e,{image:K,generateMipmaps:!0,wrapS:e.CLAMP_TO_EDGE,wrapT:e.CLAMP_TO_EDGE,flipY:!1}),q=new Ce.Program(e,{vertex:`#version 300 es
|
|
927
969
|
precision highp float;
|
|
928
970
|
in vec3 position; in vec2 uv; in float floorIndex;
|
|
929
971
|
uniform mat4 modelViewMatrix; uniform mat4 projectionMatrix; uniform float uFocusFloor;
|
|
@@ -931,4 +973,4 @@ void main() {
|
|
|
931
973
|
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
|
|
932
974
|
precision highp float;
|
|
933
975
|
in vec2 vUv; in float vDim; uniform sampler2D uImage; out vec4 fragColor;
|
|
934
|
-
void main(){ if(vDim>0.5) discard; vec4 c=texture(uImage,vUv); if(c.a<0.01) discard; fragColor=c; }`,uniforms:{uImage:{value:Q},uFocusFloor:{value:-1}},transparent:!1,depthTest:!0,depthWrite:!0,cullFace:!1});let ee=new Ee.Mesh(e,{geometry:z,program:$});ee.frustumCulled=!1,ee.setParent(n),W.screenProgram=$,j=!0,W.drawCalls=3+(G?1:0)+1},K.src=Y.contentImageUrl}return W}var rt=require("ogl");function n0(e,t,n){let o=e+(t<<8)+(n<<16);return o===0?-1:o-1}function Ul(e,t,n,o,r,i){let a=-1,s=1/0;for(let c=0;c<n;c++)for(let u=0;u<t;u++){let l=(c*t+u)*4,m=n0(e[l],e[l+1],e[l+2]);if(m<0||m>=i)continue;let h=u-o,f=c-r,d=h*h+f*f;d<s&&(s=d,a=m)}return a}function jl(e,t,n,o,r,i){let a=e-n.left,s=t-n.top,c=Math.round(a*o),u=Math.round((n.height-s)*o);return{x:Math.max(0,Math.min(r-1,c)),y:Math.max(0,Math.min(i-1,u))}}var o0=["uSeatRadius","uSeatScale","uMinPixels","uPixelToWorld"],Lo=class{constructor(t,n,o,r,i){this.seatScene=new rt.Transform;this.chairScene=new rt.Transform;this.solidScene=new rt.Transform;this.target=null;this.restoreClear=[0,0,0];this.renderer=t,this.gl=t.gl,this.maxIndex=i,this.seatProg=_l(this.gl),this.chairProg=Tl(this.gl),this.depthProg=kl(this.gl);let a=new rt.Mesh(this.gl,{geometry:n,program:this.seatProg});a.frustumCulled=!1,a.setParent(this.seatScene);let s=new rt.Mesh(this.gl,{geometry:o,program:this.chairProg});s.frustumCulled=!1,s.setParent(this.chairScene);let c=new rt.Mesh(this.gl,{geometry:r,program:this.depthProg});c.frustumCulled=!1,c.setParent(this.solidScene)}setRoomCentre(t){this.depthProg.uniforms.uRoomCentre.value.set(t??[0,0])}setRestoreClear(t){this.restoreClear=[t[0],t[1],t[2]]}syncFromSeatProgram(t){for(let r of o0)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;let o=t.uniforms.uSeeThrough?.value;if(o)for(let r of[this.seatProg,this.chairProg,this.depthProg])r.uniforms.uSeeThrough.value=o}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 rt.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,o,r){let i=this.gl,a=this.ensureTarget(),s=i.drawingBufferWidth,c=i.drawingBufferHeight,u=Math.max(0,n-r),l=Math.max(0,o-r),m=Math.max(1,Math.min(s,n+r+1)-u),h=Math.max(1,Math.min(c,o+r+1)-l);i.enable(i.SCISSOR_TEST),i.scissor(u,l,m,h);let[f,d,p]=this.restoreClear;i.clearColor(0,0,0,1),this.renderer.render({scene:this.solidScene,camera:t,target:a,clear:!0}),this.renderer.render({scene:this.seatScene,camera:t,target:a,clear:!1}),this.renderer.render({scene:this.chairScene,camera:t,target:a,clear:!1}),i.clearColor(f,d,p,1),i.disable(i.SCISSOR_TEST);let b=new Uint8Array(m*h*4);return this.renderer.bindFramebuffer(a),i.readPixels(u,l,m,h,i.RGBA,i.UNSIGNED_BYTE,b),this.renderer.bindFramebuffer(),Ul(b,m,h,n-u,o-l,this.maxIndex)}dispose(){this.destroyTarget(),this.seatProg.remove(),this.chairProg.remove(),this.depthProg.remove()}};function Xl(e,t){let n=[];for(let o of t)e.has(o.seatId)?e.set(o.seatId,hn(o.state)):n.push(o);return n}function Wl(e,t,n){let o=new Set;for(let a of t)(e.has(a)||n(a)!==void 0)&&o.add(a);let r=new Map(e),i=[];for(let[a,s]of e)o.has(a)||(i.push({seatId:a,state:_e[s]??"available"}),r.delete(a));for(let a of o){if(r.has(a))continue;let s=n(a);s!==void 0&&(r.set(a,s),i.push({seatId:a,state:"selected"}))}return{updates:i,next:r}}var Pt=require("ogl");function r0(e,t){return[e[0]-t[0],e[1]-t[1],e[2]-t[2]]}function Yl(e,t){return[e[0]+t[0],e[1]+t[1],e[2]+t[2]]}function i0(e,t){return[e[0]*t,e[1]*t,e[2]*t]}function Kl(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 li(e){let t=Math.max(0,Math.min(1,e));return t*t*t*(t*(t*6-15)+10)}function ui(e,t){return Math.max(0,Math.min(1,e+t))}function $l(e,t){let n=e.length;if(n===0)return[0,0,0];if(n===1)return[...e[0]];let o=Math.max(0,Math.min(1,t)),r=n-1,i=Math.floor(o*r);i>=r&&(i=r-1);let a=o*r-i,s=e[Math.max(0,i-1)],c=e[i],u=e[i+1],l=e[Math.min(n-1,i+2)],m=a*a,h=m*a,f=[0,0,0];for(let d=0;d<3;d++)f[d]=.5*(2*c[d]+(-s[d]+u[d])*a+(2*s[d]-5*c[d]+4*u[d]-l[d])*m+(-s[d]+3*c[d]-3*u[d]+l[d])*h);return f}function mi(e,t,n,o,r){let i=Kl(r0(t,n));i[0]===0&&i[1]===0&&i[2]===0&&(i=[0,0,1]);let a=Yl(Yl(t,i0(i,2.5)),[0,1.5,0]),s=[t[0]-o[0],0,t[2]-o[2]],c=Kl(s);c[0]===0&&c[2]===0&&(c=[i[0],0,i[2]]);let u=Math.max(1,r),l=[o[0]+c[0]*u*1.3,o[1]+u*.75,o[2]+c[2]*u*1.3];return{waypoints:[e,l,a],finalPos:a}}function fi(e,t,n=35,o=28){let r=li(t),i=$l(e,r),a=li(Math.max(0,Math.min(1,(t-.66)/.34)));return{pos:i,fov:n+(o-n)*a,eased:r}}function Jl(e,t,n){let o=e.position.clone(),r=new Pt.Quat().copy(e.quaternion);e.position.set(t[0],t[1],t[2]),e.lookAt(new Pt.Vec3(n[0],n[1],n[2]));let i=new Pt.Quat().copy(e.quaternion);return e.position.copy(o),e.quaternion.copy(r),i}var Oo=class{constructor(t){this.active=!1;this.waypoints=[];this.startQuat=new Pt.Quat;this.endQuat=new Pt.Quat;this.outQuat=new Pt.Quat;this.startTime=0;this.duration=2500;this.endFov=28;this.resolveFn=null;this.camera=t}start(t,n,o,r=2500,i=28){return this.settle(),this.waypoints=t,this.startQuat.copy(n),this.endQuat.copy(o),this.duration=r,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:o,fov:r,eased:i}=fi(this.waypoints,n,35,this.endFov);return this.camera.position.set(o[0],o[1],o[2]),this.outQuat.copy(this.startQuat).slerp(this.endQuat,ui(i,.15)),this.camera.quaternion.copy(this.outQuat),this.camera.fov=r,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 eu=rr,a0=.12,s0=.25,c0=1.5;function tu(e,t,n=0,o,r){let i=[t.x*T,n+c0,t.y*T],a=r?[r[0],r[1],r[2]]:i,s=e[1],c=Number.isFinite(s)?s+eu:Number.isFinite(o)?n+o:n+eu,u=i[0]-e[0],l=i[2]-e[2],m=Math.hypot(u,l),h=m>.001?Math.min(a0,m*s0):0,f=m>.001?u/m:0,d=m>.001?l/m:0;return{eye:[e[0]+f*h,c,e[2]+d*h],focal:a}}var It=Math.PI/180,l0=45,di=80,Fo=70,u0=1,m0=.99;function f0(e,t){if(!(e<u0))return di;if(!(Number.isFinite(t)&&t>0))return Fo;let n=2*Math.atan(t/(2*Do*m0)/Math.max(.05,e))/It;return Math.max(Fo,Math.min(di,n))}var d0=.25,Do=1,h0=.25,p0=12*It,b0=.2,y0=1.5,nu=.8,ou=6,lu=1.9,g0=2/3,x0=.12,v0=.9,M0=1.2,S0=2,uu=.05,w0=6;function mu(e,t,n=0){if(!e.length)return{min:[t[0]-6,n,t[2]-6],max:[t[0]+6,Math.max(n+nu,t[1]),t[2]+6]};let o=1/0,r=-1/0,i=1/0,a=-1/0,s=n;for(let d of e)o=Math.min(o,d.cx-d.halfX),r=Math.max(r,d.cx+d.halfX),i=Math.min(i,d.cz-d.halfZ),a=Math.max(a,d.cz+d.halfZ),s=Math.max(s,d.y);let c=r-o,u=a-i,l=Math.max(c,Math.min(u,ou))/2,m=Math.max(u,Math.min(c,ou))/2,h=(o+r)/2,f=(i+a)/2;return{min:[h-l,n,f-m],max:[h+l,Math.max(n+nu,s),f+m]}}function P0(e){return{min:[e.min[0],e.min[1],e.min[2]],max:[e.max[0],e.max[1]+lu,e.max[2]]}}function hi(e){let t=e.max[1];return[(e.min[0]+e.max[0])/2,Math.max(e.min[1]+y0,t+b0,t+lu*g0),(e.min[2]+e.max[2])/2]}function fu(e,t){let n=e[0]-t[0],o=e[2]-t[2],r=Math.hypot(n,o);return r<.001?{x:0,z:1}:{x:n/r,z:o/r}}function ru(e,t,n){let o=t[0]-e[0],r=t[1]-e[1],i=t[2]-e[2],a=Math.hypot(o,r,i)||1;o/=a,r/=a,i/=a;let s=-i,c=o,u=Math.hypot(s,c);if(u<1e-6)return 1/0;s/=u,c/=u;let l=1/0,m=-1/0;for(let h=0;h<8;h++){let f=(h&1?n.max[0]:n.min[0])-e[0],d=(h&2?n.max[1]:n.min[1])-e[1],p=(h&4?n.max[2]:n.min[2])-e[2],b=Math.max(uu,f*o+d*r+p*i),g=(f*s+p*c)/b;g<l&&(l=g),g>m&&(m=g)}return m-l}function iu(e,t,n){let o=t[0]-e[0],r=t[1]-e[1],i=t[2]-e[2],a=Math.hypot(o,r,i)||1;o/=a,r/=a,i/=a;let s=-i,c=o,u=Math.hypot(s,c);if(u<1e-6)return 1/0;s/=u,c/=u;let l=-c*r,m=c*o-s*i,h=s*r,f=1/0,d=-1/0;for(let p=0;p<8;p++){let b=(p&1?n.max[0]:n.min[0])-e[0],g=(p&2?n.max[1]:n.min[1])-e[1],v=(p&4?n.max[2]:n.min[2])-e[2],w=Math.max(uu,b*o+g*r+v*i),R=(b*l+g*m+v*h)/w;R<f&&(f=R),R>d&&(d=R)}return d-f}function No(e,t){return Math.tan(e*It/2)*Math.max(.05,t)}function au(e,t,n){let o=f0(n,e),r=c=>Math.max(l0,Math.min(o,c)),i=c=>2*Math.atan(c)/It,a=Number.isFinite(e)&&e>0?r(i(e/(2*d0)/Math.max(.05,n))):o;if(!(Number.isFinite(t)&&t>0))return a;let s=Math.min(a,r(i(t/(2*x0))));return e/(2*No(s,n))>Do?a:s}function du(e,t,n,o={}){let r=hi(t),i=[e[0],e[1],e[2]],a=0,s=0,c=d=>{if(!(d>0))return;let p=fu(i,r);i[0]+=p.x*d,i[2]+=p.z*d,s+=d},u=o.preserveEye?0:t.max[1]+h0-i[1];u>0&&(i[1]+=u,a=u,c(u/Math.tan(p0)));let l=P0(t),m=ru(i,r,t),h=au(m,iu(i,r,l),n),f=m/(2*No(h,n));for(let d=0;!o.preserveEye&&d<w0&&f>Do;d++){let p=Math.max(1,Math.hypot(i[0]-r[0],i[2]-r[2])),b=Number.isFinite(f)?f/Do:2;c(Math.min(60,p*(Math.min(4,b)-1)+.5)),m=ru(i,r,t),h=au(m,iu(i,r,l),n),f=m/(2*No(h,n))}return{eye:i,focal:r,fov:h,raisedM:a,pulledBackM:s,stageFrameWidth:f}}function I0(e,t,n){let o=Math.tan(t*It/2),r=No(t,n);return Math.max(1,e/Math.max(.05,Math.min(o,r)))}var A0=.7,su=.5,R0=.8;function cu(e,t,n){let o=[t[0]-e[0],t[1]-e[1],t[2]-e[2]],r=[n[0]-e[0],n[1]-e[1],n[2]-e[2]],i=o[0]*r[0]+o[1]*r[1]+o[2]*r[2],a=Math.hypot(o[0],o[1],o[2])*Math.hypot(r[0],r[1],r[2])||1;return Math.acos(Math.max(-1,Math.min(1,i/a)))/It}function E0(e,t,n){let o=u=>{let l=Math.hypot(u[0],u[1],u[2])||1;return[u[0]/l,u[1]/l,u[2]/l]},r=[t[0]-e[0],t[1]-e[1],t[2]-e[2]],i=Math.hypot(r[0],r[1],r[2]),a=o(r),s=o([n[0]-e[0],n[1]-e[1],n[2]-e[2]]),c=o([0,1,2].map(u=>a[u]*(1-su)+s[u]*su));return[e[0]+c[0]*i,e[1]+c[1]*i,e[2]+c[2]*i]}function hu(e,t){let{aspect:n,venue:o}=t,r=e.focal,i=fu(e.eye,r),a=p=>(p[0]-r[0])*i.x+(p[2]-r[2])*i.z,s=[{name:"seat",eye:e.eye,focal:r,fov:e.fov}],c=S0*(t.rowDepthM??v0),u=[e.eye[0]+i.x*c,e.eye[1]+M0,e.eye[2]+i.z*c],l=[e.eye[0],e.eye[1]-A0,e.eye[2]],m=E0(u,r,l);s.push({name:"row",eye:u,focal:m,fov:Math.min(di,Math.max(e.fov,2*Math.max(cu(u,m,l),cu(u,m,r))/R0))});let h=(p,b,g,v)=>{let w=I0(g,e.fov,n)*1.08,R=w*Math.sin(v*It),M=Number.isFinite(t.seatingTopY)?t.seatingTopY+2:-1/0,y=Math.max(R,M-b[1]),P=w*Math.cos(v*It);return{name:p,eye:[b[0]+i.x*P,b[1]+y,b[2]+i.z*P],focal:b,fov:e.fov}};t.section&&t.section.radius>0&&s.push(h("section",t.section.center,t.section.radius,35)),s.push(h("venue",o.center,Math.max(1,o.radius),40));let f=[],d=-1/0;for(let p of s){let b=a(p.eye);f.length&&b<=d+.5||(f.push(p),d=b)}return f}var gu=require("ogl"),Vn=Math.PI/180,pi=320,pu=70*Vn,C0=32*Vn,_0=24*Vn,bu=.0026,T0=.22,k0=.006,L0=180,O0=900,F0=1100,D0=4,Fe=(e,t,n)=>Math.max(t,Math.min(n,e)),yu=e=>e<.5?4*e*e*e:1-Math.pow(-2*e+2,3)/2;function xu(e){let{canvas:t,camera:n}=e,o=[],r=!1,i=0,a=0,s=0,c=0,u=0,l=0,m=pi,h=null,f=()=>{h&&(clearTimeout(h),h=null)},d=!1,p=[0,0],b=0,g=!1,v=null,w=null,R=new Map,M=!1,y=0,P=0,x=0,S=0,A=()=>r&&o.length?o[Fe(Math.round(i),0,o.length-1)].name:null,_=()=>{let O=A();O!==v&&(v=O,e.onStopChange?.(O))},D=()=>{if(!r||!o.length)return;let O=o[Fe(Math.floor(i),0,o.length-1)],G=o[Fe(Math.ceil(i),0,o.length-1)],j=Fe(i-Math.floor(i),0,1),H=(J,oe)=>J+(oe-J)*j,z=[H(O.eye[0],G.eye[0]),H(O.eye[1],G.eye[1]),H(O.eye[2],G.eye[2])],$=[H(O.focal[0],G.focal[0]),H(O.focal[1],G.focal[1]),H(O.focal[2],G.focal[2])],Q=$[0]-z[0],ae=$[1]-z[1],q=$[2]-z[2],W=Math.hypot(Q,ae,q)||1,Y=Math.atan2(Q,q),K=Math.asin(Fe(ae/W,-1,1)),ne=Y+a,ee=Fe(K+s,-80*Vn,80*Vn),fe=Math.cos(ee)*W;Q=Math.sin(ne)*fe,ae=Math.sin(ee)*W,q=Math.cos(ne)*fe,n.position.set(z[0],z[1],z[2]),n.fov=H(O.fov,G.fov),n.updateProjectionMatrix(),n.lookAt(new gu.Vec3(z[0]+Q,z[1]+ae,z[2]+q)),e.onApplied?.()},E=()=>{if(!r||!o.length)return;let O=Fe(Math.round(i),0,o.length-1);if(e.reducedMotion()){d=!1,i=O,D(),_(),e.requestRender();return}if(Math.abs(O-i)<.001){d=!1,_();return}c=i,u=O,l=performance.now(),m=pi,d=!0,e.requestRender()},I=O=>{!r||o.length<2||(f(),d=!1,i=Fe(i+O,0,o.length-1),D(),_(),e.requestRender())},k=(O,G)=>{r&&(f(),d=!1,g=!1,a=Fe(a-O*bu,-pu,pu),s=Fe(s-G*bu,-_0,C0),D(),e.requestRender())},L=O=>{r&&(R.set(O.pointerId,{x:O.clientX,y:O.clientY}),R.size===1?(M=!0,S=0,y=O.clientX,P=O.clientY):R.size===2&&(M=!1,x=B()))},B=()=>{let O=[...R.values()];return O.length<2?0:Math.hypot(O[0].x-O[1].x,O[0].y-O[1].y)},F=O=>{if(!r||!R.has(O.pointerId))return;if(R.set(O.pointerId,{x:O.clientX,y:O.clientY}),R.size>=2){let H=B();x>0&&I((x-H)*k0),x=H;return}if(!M)return;let G=O.clientX-y,j=O.clientY-P;y=O.clientX,P=O.clientY,S+=Math.abs(G)+Math.abs(j),!(S<=D0)&&k(G,j)},V=O=>{R.delete(O.pointerId)&&(R.size<2&&(x=0),R.size===0&&(M=!1,E()))},N=O=>{if(!r)return;O.preventDefault();let G=O.deltaMode===1?16:O.deltaMode===2?100:1,j=Fe(O.deltaY*G/100,-2,2);I(j*T0),w&&clearTimeout(w),w=setTimeout(()=>{w=null,E()},L0)},C=()=>{f(),r&&(r=!1,d=!1,g=!1,o=[],R.clear(),M=!1,w&&(clearTimeout(w),w=null),v!==null&&(v=null,e.onStopChange?.(null)))};return t.addEventListener("pointerdown",L),t.addEventListener("pointermove",F),t.addEventListener("pointerup",V),t.addEventListener("pointercancel",V),t.addEventListener("wheel",N,{passive:!1}),{get active(){return r},enter(O,G=0){if(O.length<2){C();return}f(),o=O,r=!0,i=e.reducedMotion()?0:Fe(G,0,O.length-1),i>0&&(h=setTimeout(()=>{h=null,r&&(c=i,u=0,l=performance.now(),m=F0,d=!0,e.requestRender())},O0)),a=0,s=0,d=!1,g=!1,v=null,D(),_(),e.requestRender()},exit:C,recentre(){return r?Math.abs(a)<1e-4&&Math.abs(s)<1e-4?!0:e.reducedMotion()?(g=!1,a=0,s=0,D(),e.requestRender(),!0):(p=[a,s],b=performance.now(),g=!0,e.requestRender(),!0):!1},update(O){if(!r)return!1;let G=!1;if(g){let j=Fe((O-b)/pi,0,1),H=1-yu(j);a=p[0]*H,s=p[1]*H,j>=1?(g=!1,a=0,s=0):G=!0}if(d){let j=Fe((O-l)/m,0,1);i=c+(u-c)*yu(j),j>=1?(d=!1,i=u,_()):G=!0}return D(),G},currentStop:A,dispose(){C(),t.removeEventListener("pointerdown",L),t.removeEventListener("pointermove",F),t.removeEventListener("pointerup",V),t.removeEventListener("pointercancel",V),t.removeEventListener("wheel",N)}}}function vu(e){return e.flying?"cinematic":e.panoramaMounted?"panorama":e.seatViewActive?"seatView":"orbit"}var xi=null;function Lu(){return xi??=Promise.resolve().then(()=>(ku(),Tu)).catch(e=>{throw xi=null,e}),xi}var Ou=()=>typeof performance<"u"&&performance.now?performance.now():Date.now(),jo=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,o,r){this.emit("3d_opened",{seats:t,hasHeights:n,...o===void 0?{}:{buildMs:Math.round(o)},...r===void 0?{}:{prepSource:r}})}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=Ou(),this.emit("3d_panorama_opened")}panoramaClosed(){let t=this.panoramaOpenedAt?Math.round(Ou()-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 Fu(e){let t=e.style.position;return getComputedStyle(e).position!=="static"?()=>{}:(e.style.position="relative",()=>{e.style.position==="relative"&&(e.style.position=t)})}function Du(e){let{container:t,model:n,opts:o,expandedSeatById:r,seatIdsByRow:i,isNarrow:a}=e,s=null,c=()=>{if(!s)return;let m=a();Object.assign(s.style,m?{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:(m,h,f=!1)=>{if(u(),e.isDisposed())return null;let d=document.createElement("div");d.setAttribute("role","group"),Object.assign(d.style,{position:"absolute",display:"flex",flexDirection:"column",alignItems:"center",gap:"6px",zIndex:"4"});let p=o.chrome?.caption!==!1,b=o.chrome?.seatStepper!==!1;if(!p&&!b)return null;let g=r.get(m),v=g?.sectionId?n.sections.find(A=>A.id===g.sectionId):void 0,w=g?.label??m;d.setAttribute("aria-label",`Explore views near ${v?.label?`${v.label}, `:""}seat ${w}`);let R=document.createElement("span");R.textContent=o.seatViewCaption?.(m)??["Live 3D seat view",v?.label,w].filter(Boolean).join(" \xB7 "),Object.assign(R.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)"}),p&&d.appendChild(R);let M=document.createElement("div");Object.assign(M.style,{display:"flex",alignItems:"center",justifyContent:"center",gap:"6px"}),d.appendChild(M);let y=g?.rowId?i.get(g.rowId):void 0,P=y?.indexOf(m)??-1,x=P>=0?[y?.[P-1],y?.[P+1]]:[void 0,void 0],S=(A,_,D,E=!1)=>{let I=document.createElement("button");I.type="button",I.textContent=A,I.setAttribute("aria-label",_),Object.assign(I.style,{minHeight:"44px",padding:E?"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"}),E||(I.style.minWidth="44px"),E&&(I.dataset.panoramaTrigger=""),I.addEventListener("click",D),M.appendChild(I)};if(b&&x[0]){let A=r.get(x[0])?.label??x[0];S("\u2039",`View previous seat ${A}`,()=>{e.flyToSeat(x[0])})}if(b&&o.getSeatView){let A=o.seatViewActionLabel?.(m)??"Open 360\xB0 panorama";S(f?`\u21BB Retry ${A}`:`\u25C9 ${A}`,`${f?"Retry":A} from seat ${w}`,()=>{if(e.isDisposed()||h!==e.flightGen()){u();return}u(),e.openPanorama(m,400,h)},!0)}if(b&&x[1]){let A=r.get(x[1])?.label??x[1];S("\u203A",`View next seat ${A}`,()=>{e.flyToSeat(x[1])})}return!M.childElementCount&&!p?null:(t.appendChild(d),s=d,c(),d)},remove:u,layout:c}}var Z0={rotate:"Drag to rotate the venue",move:"Drag to move the venue",zoomIn:"Zoom in",zoomOut:"Zoom out",fitView:"Show whole venue"};function Nu(e){let{container:t,orbit:n,isNarrow:o}=e,r={...Z0,...e.labels??{}},i=(w,R)=>{w.setAttribute("aria-label",R),w.title=R},a=document.createElement("div"),s=!1;a.className="sl-3d-navigation-controls",Object.assign(a.style,{position:"absolute",right:"14px",bottom:"14px",display:"flex",zIndex:"4",flexDirection:"column",alignItems:"flex-end",gap:"7px"});let c=document.createElement("div");c.setAttribute("role","group"),c.setAttribute("aria-label","3D drag mode"),Object.assign(c.style,{display:"flex",flexDirection:"column",gap:"6px",alignItems:"flex-end"});let u=document.createElement("div");u.setAttribute("role","group"),u.setAttribute("aria-label","3D view controls"),Object.assign(u.style,{display:"flex",flexDirection:"column",gap:"6px",alignItems:"flex-end"});let l=document.createElement("button");l.type="button",l.textContent="\u21BB",i(l,r.rotate);let m=document.createElement("button");m.type="button",m.textContent="\u2725",i(m,r.move);let h=document.createElement("button");h.type="button",h.textContent="\u2212",i(h,r.zoomOut);let f=document.createElement("button");f.type="button",f.textContent="+",i(f,r.zoomIn);for(let w of[l,m,h,f])w.className="sl-3d-icon-control",Object.assign(w.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(l,m),u.append(f,h);let d=w=>{n.setPrimaryDragMode(w);let R=w==="orbit";l.setAttribute("aria-pressed",String(R)),m.setAttribute("aria-pressed",String(!R)),l.style.background=R?"rgba(96,110,150,0.68)":"rgba(12,18,32,0.82)",m.style.background=R?"rgba(12,18,32,0.82)":"rgba(96,110,150,0.68)",a.title=R?`${r.rotate} \xB7 ${r.move} with Shift`:`${r.move} \xB7 ${r.rotate} with Shift`};l.addEventListener("click",()=>d("orbit")),m.addEventListener("click",()=>d("pan"));let p=()=>{let{atMin:w,atMax:R}=n.dollyLimitState();f.disabled!==w&&(f.disabled=w),h.disabled!==R&&(h.disabled=R)};h.addEventListener("click",()=>{n.zoomBy(pn),p()}),f.addEventListener("click",()=>{n.zoomBy(Bt),p()}),a.append(c,u),d("orbit"),t.appendChild(a);let b=e.enabled!==!1,g=()=>{let w=o();a.style.display=s||!b?"none":"flex",a.style.right=w?"12px":"14px",a.style.bottom=w?"calc(env(safe-area-inset-bottom, 0px) + 76px)":"14px",c.style.display=w?"none":"flex",f.style.display=w?"none":"",h.style.display=w?"none":""};return g(),{element:a,utilityControls:u,setNavigationMode:d,syncZoomLimits:p,setSeatViewLocked:w=>{s=w,n.setInteractionEnabled(!w),g()},seatViewLocked:()=>s,layout:g}}var Q0=.5,Bu=12,Vu=20,J0=28;function eg(e,t,n){return!(e>0)||!(n>0)?0:Q0*n/(2*e*Math.tan(t*Math.PI/360))}function Hu(e){let{glctx:t,orbit:n,model:o,seats:r,opts:i,cinematic:a,analytics:s,seatIdByIndex:c,sectionIdBySeatId:u,tapSlop:l,tapMs:m,cancelFlight:h,focusSectionCamera:f,setSelection:d,ensureSeatView:p}=e,b=0,g=0,v=0,w=-1,R=!1,M=!1,y=E=>{e.seatViewLocked()||w===-1&&(w=E.pointerId,b=E.clientX,g=E.clientY,v=performance.now(),R=!1,M=a.active,a.active&&(s.cinematicCancelled(),h(),i.onViewTargetChange?.(null)))},P=E=>{E.pointerId===w&&Math.hypot(E.clientX-b,E.clientY-g)>l&&(R=!0)},x=(E,I,k,L,B)=>{let F=t.canvas.getBoundingClientRect(),V=t.canvas.clientWidth||F.width||1,N=t.canvas.clientHeight||F.height||1,C=E-F.left,O=I-F.top,G=L*L,j=-1,H=G,z=1/0;for(let $ of r){if(k&&$.sectionId!==k)continue;let Q=o.seats.idToIndex.get($.id);if(Q===void 0)continue;if(B){let ne=Math.round(o.seats.iState[Q]??0);if(ne!==0&&ne!==3)continue}let ae=Q*3,q=nt(n.camera.projectionViewMatrix,[o.seats.iPosition[ae],o.seats.iPosition[ae+1]+.55,o.seats.iPosition[ae+2]],V,N);if(!q.visible)continue;let W=q.x-C,Y=q.y-O,K=W*W+Y*Y;(K<H||Math.abs(K-H)<1&&q.depth<z)&&(j=Q,H=K,z=q.depth)}return j},S=(E,I)=>{let k=e.gpu(),L=e.pick();if(!k||!L)return-1;L.syncFromSeatProgram(k.seatProgram);let B=t.canvas.getBoundingClientRect(),F=t.renderer.dpr,{x:V,y:N}=jl(E,I,B,F,t.gl.drawingBufferWidth,t.gl.drawingBufferHeight),C=Math.max(2,Math.round(8*F));return L.pick(n.camera,V,N,C)},A=()=>t.canvas.clientHeight||t.canvas.getBoundingClientRect().height,_=(E,I=Bu)=>{let k=n.camera?.position;if(!k)return!1;let L=E*3,B=Math.hypot(k.x-o.seats.iPosition[L],k.y-o.seats.iPosition[L+1],k.z-o.seats.iPosition[L+2]);return eg(B,n.fovY,A())>=I};return{onDown:y,onMove:P,onUp:E=>{if(E.pointerId!==w)return;let I=!R&&performance.now()-v<m;if(w=-1,M){M=!1;return}let k=e.gpu(),L=e.pick();if(!I||!k||!L)return;let B=S(E.clientX,E.clientY),F=E.pointerType==="touch"||E.pointerType==="pen",V=F?Vu:Bu,N=B>=0&&_(B,V),C=!1;if(e.focusedSectionId()&&B>=0){let j=c[B],H=j?u.get(j):void 0;if(H&&H!==e.focusedSectionId()&&f(H,{keepCamera:N})){if(!N)return;C=!0}}if(e.focusedSectionId()&&B<0&&(B=x(E.clientX,E.clientY,e.focusedSectionId(),44,!1)),e.focusedSectionId()&&B<0){let j=x(E.clientX,E.clientY,null,72,!1),H=j>=0?c[j]:void 0,z=H?u.get(H):void 0;if(z&&z!==e.focusedSectionId()&&f(z))return}if(!e.focusedSectionId()){B<0&&(B=x(E.clientX,E.clientY,null,42,!1));let j=B>=0?c[B]:void 0,H=j?u.get(j):void 0;if(H&&f(H,{keepCamera:N})){if(!N)return;C=!0}}if(B<0||B>=c.length){e.selection().size&&(d([]),i.onViewTargetChange?.(null));return}let O=c[B];if(F&&e.focusedSectionId()&&!C&&!_(B,Vu)){e.focusSeatCamera(O,{seatPx:J0,viewportHeightPx:A()});return}let G=_e[Math.round(o.seats.iState[B]??0)]??"available";if(G!=="available"&&G!=="selected"){i.onSeatInspect?.(O,G);return}if(e.selection().has(O)&&e.selection().size===1){d([]),i.onViewTargetChange?.(null),i.onSeatPick?.(O);return}d([O]),p(O),s.seatPicked(O,u.get(O)),i.onSeatPick?.(O)}}}var Xo=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,o=1/0,r=-1/0,i=-1/0;for(let f=0;f<this.count;f++){let d=t[f*3],p=t[f*3+2];d<n&&(n=d),d>r&&(r=d),p<o&&(o=p),p>i&&(i=p)}let a=Math.max(r-n,.001),s=Math.max(i-o,.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=o;let c=this.cols*this.rows,u=new Int32Array(c+1),l=f=>{let d=Math.min(this.cols-1,Math.max(0,Math.floor((t[f*3]-n)/this.cell)));return Math.min(this.rows-1,Math.max(0,Math.floor((t[f*3+2]-o)/this.cell)))*this.cols+d};for(let f=0;f<this.count;f++)u[l(f)+1]++;for(let f=0;f<c;f++)u[f+1]+=u[f];let m=new Int32Array(this.count),h=u.slice(0,c);for(let f=0;f<this.count;f++)m[h[l(f)]++]=f;this.cellStart=u,this.cellItems=m}gather(t,n,o,r,i){this.ensureGrid();let a=this.cellStart,s=this.cellItems;if(!a||!s)return 0;let c=r.length,u=o*o,l=Math.floor((t-this.minX)/this.cell),m=Math.floor((n-this.minZ)/this.cell),h=Math.ceil(o/this.cell)+1,f=this.iPosition,d=0;for(let p=0;p<=h&&d<c;p++){let b=m-p,g=m+p,v=l-p,w=l+p;for(let R=b;R<=g&&d<c;R++){if(R<0||R>=this.rows)continue;let M=R===b||R===g;for(let y=v;y<=w&&d<c;y++){if(!M&&y!==v&&y!==w){y=w-1;continue}if(y<0||y>=this.cols)continue;let P=R*this.cols+y;for(let x=a[P],S=a[P+1];x<S&&d<c;x++){let A=s[x],_=f[A*3]-t,D=f[A*3+2]-n,E=i===void 0?0:f[A*3+1]-i;_*_+E*E+D*D<=u&&(r[d++]=A)}}}}return d}};var Wo=class{constructor(t){this.ctx=t;this.detailVisible=!1;this.seatDetailMix=0;this.structureDetailMix=0;this.nearBuf=new Int32Array(Zn);this.lastGatherX=1/0;this.lastGatherZ=1/0;this.lastGatherY=1/0;this.nearIndex=new Xo(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,o=this.ctx.gpu();if(!o)return;if(!t){o.nearSeatCount()&&o.setNearSeats(this.nearBuf,0);return}let r=this.ctx.orbit().camera.position;if(Math.hypot(r.x-this.lastGatherX,r.y-this.lastGatherY,r.z-this.lastGatherZ)<fr)return;if(this.lastGatherX=r.x,this.lastGatherY=r.y,this.lastGatherZ=r.z,Math.hypot(r.x-n.bounds.center[0],r.y-n.bounds.center[1],r.z-n.bounds.center[2])-n.bounds.radius>mr){o.nearSeatCount()&&o.setNearSeats(this.nearBuf,0);return}let s=this.nearIndex.gather(r.x,r.z,mr,this.nearBuf,r.y);s===0&&o.nearSeatCount()===0||o.setNearSeats(this.nearBuf,s)}ease(t,n,o){let r=1-Math.exp(-t*9),i=1-Math.exp(-t*20);this.seatDetailMix+=(n-this.seatDetailMix)*(n>this.seatDetailMix?r:i),this.structureDetailMix+=(o-this.structureDetailMix)*(o>this.structureDetailMix?r:i),Math.abs(n-this.seatDetailMix)<.01&&(this.seatDetailMix=n),Math.abs(o-this.structureDetailMix)<.01&&(this.structureDetailMix=o)}};function Gu(e){let t=Math.max(5,e.radius),n=e.focalWorld[0]-e.center[0],o=e.focalWorld[2]-e.center[2],r=Math.hypot(n,o);if(r<t*.12)return{center:e.center,radius:t,polarDeg:48};let i=Math.min(r*.25,t*.2);return{center:[e.center[0]+n/r*i,e.center[1],e.center[2]+o/r*i],radius:t+i,polarDeg:50}}var Yo=require("ogl");function zu(){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 Uu(e){let{container:t,model:n,opts:o,orbit:r,cinematic:i,analytics:a,loop:s,labelOverlay:c,stageAzimuth:u,overviewFraming:l}=e,m=0,h=-1,f=(A,_,D=28)=>{r.camera.position.set(A[0],A[1],A[2]),r.camera.lookAt(new Yo.Vec3(_[0],_[1],_[2])),r.camera.fov=D,r.camera.updateProjectionMatrix()},d=document.createElement("button");d.className="sl-3d-overview-control sl-3d-icon-control",d.type="button",d.replaceChildren(zu());let p=o.navLabels?.fitView??"Show whole venue";d.setAttribute("aria-label",p),d.title=p,Object.assign(d.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=()=>{d.firstElementChild||d.replaceChildren(zu())};b();let g=A=>{h=A;let _=e.gpu();_&&(_.seatProgram.uniforms.uFocusFloor.value=A,_.solidProgram.uniforms.uFocusFloor.value=A,_.chairProgram.uniforms.uFocusFloor.value=A),e.showSectionSeatLabels(null)},v=null,w=!1,R=()=>{if(v=null,w=!1,e.setSeeThrough?.(null),e.isDisposed())return;o.onViewTargetChange?.(null),o.onSectionFocusChange?.(null),e.panorama()&&(e.panorama().dispose(),e.setPanorama(null),a.panoramaClosed()),e.setPanoramaSphereVisible(!1),e.panoramaLoadAbort()?.abort(),e.setPanoramaLoadAbort(null),e.restorePanoramaLayer(),d.style.display="",c.setVisible(!0),e.setFrozen(!1);let A=h>=0?n.floors[h]:null;if(e.setNearFieldDetailEnabled(!!A),e.setSeatViewLocked(!1),M(),e.removeArriveChip(),e.setNavigationMode("orbit"),A){let _=A.focalWorld[0]-A.center[0],D=A.focalWorld[2]-A.center[2],E=Math.hypot(_,D)>A.radius*.12?Math.atan2(_,D):u,I={center:A.center,radius:A.radius,box:A.box},k={polarDeg:58,margin:1.12};e.reducedMotion()?r.frame(I,!1,E,!1,k):r.frameSoft(I,E,!1,k)}else e.reducedMotion()?r.frame(n.bounds,!1,u,o.portraitOverviewCrop===!0,l):r.frameSoft(n.bounds,u,o.portraitOverviewCrop===!0,l);c.setOverviewDistance(r.targetDistance),e.showSectionSeatLabels(null),s.requestRender()},M=()=>{m++,e.setSeatStepping(!1),e.panoramaLoadAbort()?.abort(),e.setPanoramaLoadAbort(null),i.active&&(i.cancel(),r.resumeAfterFlight(n.focalWorld))},y=A=>{if(e.isDisposed()||!e.gpu())return Promise.resolve();let _=n.seats.idToIndex.get(A);if(_===void 0)return Promise.resolve();e.setNearFieldDetailEnabled(!0),o.onViewTargetChange?.(A),e.panorama()&&(e.panorama().dispose(),e.setPanorama(null),e.setPanoramaSphereVisible(!1),d.style.display="",e.restorePanoramaLayer()),e.panoramaLoadAbort()?.abort(),e.setPanoramaLoadAbort(null),e.setFrozen(!1);let D=e.inSeatView()&&o.arriveAtSeatEye===!0;e.setSeatStepping(D),e.setSeatViewLocked(!1);let E=++m;D?e.showArriveChip(A,E):e.removeArriveChip();let{eye:I,focal:k}=e.resolvedSeatViewPose(A,_),L=o.arriveAtSeatEye?e.seatViewArrival(A,_):null,B=L&&L.stops.length>1&&L.stops[1].name==="row"?L.stops[1]:null,F=L?L.focal:k,V=[r.camera.position.x,r.camera.position.y,r.camera.position.z],N=mi(V,L?.eye??I,F,n.bounds.center,n.bounds.radius),C=B?B.eye:L?L.eye:o.arriveAtSeatEye?I:N.finalPos,O=L?L.fov:o.arriveAtSeatEye?t.clientWidth/Math.max(1,t.clientHeight)<.7?Fo:65:28,G=[N.waypoints[0],N.waypoints[1],C];if(c.setVisible(!1),e.reducedMotion())return e.setSeatStepping(!1),f(C,F,O),s.requestRender(),a.cinematicSkipped(),e.isDisposed()||r.syncFromCamera(),e.setSeatViewLocked(o.arriveAtSeatEye===!0),L&&e.enterSeatView(L.stops),e.showArriveChip(A,E),Promise.resolve();let j=new Yo.Quat().copy(r.camera.quaternion),H=Jl(r.camera,C,F);s.requestRender();let z=D?700:2500;return i.start(G,j,H,z,O).then(()=>{e.isDisposed()||E!==m||(e.setSeatStepping(!1),a.cinematicPlayed(z),r.resumeAfterFlight(F),e.setSeatViewLocked(o.arriveAtSeatEye===!0),L&&e.enterSeatView(L.stops,B?1:0),s.requestRender(),e.showArriveChip(A,E))})},P=(A,_)=>{let D=n.sections.find(E=>E.id===A);if(!D||D.seatCount===0)return!1;if(v=A,w=!1,e.setSeeThrough?.(null),e.setNearFieldDetailEnabled(!0),e.setSeatStepping(!1),e.setSeatViewLocked(!1),i.cancel(),e.removeArriveChip(),n.floors.length>1&&h!==D.floorIndex&&g(D.floorIndex),e.setNavigationMode("pan"),e.panorama()||c.setVisible(!0),e.showSectionSeatLabels(A),!_?.keepCamera){let E=Gu(D),I={polarDeg:E.polarDeg,margin:1.12};e.reducedMotion()?r.frame({center:E.center,radius:E.radius},!1,r.currentAzimuth,!1,I):r.glideTo({center:E.center,radius:E.radius},I)}return o.onSectionFocusChange?.(A),s.requestRender(),!0},x=(A,_)=>{if(e.isDisposed()||!e.gpu())return!1;let D=n.seats.idToIndex.get(A);if(D===void 0)return!1;let E=D*3,I=[n.seats.iPosition[E],n.seats.iPosition[E+1]+.55,n.seats.iPosition[E+2]],k=_?tg(_,r.fovY,r.camera.aspect||1):ju;return w=!0,e.setSeeThrough?.(I),e.reducedMotion()?r.frame({center:I,radius:k},!1,void 0,!1,vi):r.frameSoft({center:I,radius:k},void 0,!1,vi),s.requestRender(),!0},S=()=>{if(e.isNarrow?.()&&w&&v&&P(v)){s.requestRender();return}R()};return d.addEventListener("click",S),{overviewChip:d,layoutOverviewChip:b,flightGen:()=>m,focusedFloor:()=>h,applyFloorFocus:g,placeCameraFinal:f,cancelFlight:M,focusOverview:R,flyToSeat:y,focusSectionCamera:P,focusSeatCamera:x}}var ju=4.5;function tg(e,t,n){let o=Math.tan(t*Math.PI/360),r=o*Math.max(.001,n),a=ng*e.viewportHeightPx/(2*Math.max(1,e.seatPx)*o)*Math.min(o,r)/vi.margin;return Math.max(og,Math.min(ju,a))}var ng=.5,og=1.5,vi={polarDeg:48,margin:1.25};function Gn(e,t){let{doc:n,report:o}=Ro(e),r=o.confident&&(o.sections.length>0||!!o.looseRowBlocks);if(!r&&!o.roles?.length)return null;if(!r){let c=new Map(o.roles.map(f=>[f.id,f.role])),u=f=>f.map(d=>d.type==="shape"&&c.has(d.id)?{...d,role:c.get(d.id)}:d),l=e.floors?.map(f=>({...f,objects:u(f.objects)})),m=new Float64Array(t.length).fill(Number.NaN),h=new Float64Array(t.length*2).fill(Number.NaN);return t.forEach((f,d)=>{f.eyeHeightM!==void 0&&(m[d]=f.eyeHeightM),f.focalPoint&&(h[d*2]=f.focalPoint.x,h[d*2+1]=f.focalPoint.y)}),{doc:{...e,objects:l?.[0]?.objects??u(e.objects),...l?{floors:l}:{}},report:o,eyeHeightM:m,focal:h}}let i=new Map(Ut(n).map(c=>[c.id,c])),a=new Float64Array(t.length).fill(Number.NaN),s=new Float64Array(t.length*2).fill(Number.NaN);return t.forEach((c,u)=>{let l=i.get(c.id)??c;l.eyeHeightM!==void 0&&(a[u]=l.eyeHeightM),l.focalPoint&&(s[u*2]=l.focalPoint.x,s[u*2+1]=l.focalPoint.y)}),{doc:n,report:o,eyeHeightM:a,focal:s}}function Mi(e,t){return e.map((n,o)=>{let r=t.eyeHeightM[o],i=t.focal[o*2],a=t.focal[o*2+1],s={...n};return Number.isNaN(r)?delete s.eyeHeightM:s.eyeHeightM=r,Number.isNaN(i)?delete s.focalPoint:s.focalPoint={x:i,y:a},s})}function Xu(e){let t=e.estimate===!1?null:Gn(e.doc,e.seats);return t?{input:{...e,doc:t.doc,seats:Mi(e.seats,t)},estimate:t}:{input:e}}function Si(e,t,n,o,r,i,a,s,c=.5){let u=-1,l=s*s,m=1/0;for(let h=0;h<t;h++){let f=h*3,d=nt(n,[e[f],e[f+1]+c,e[f+2]],o,r);if(!d.visible)continue;let p=d.x-i,b=d.y-a,g=p*p+b*b;(g<l-4||g<l+4&&d.depth<m)&&(u=h,l=Math.min(l,g),m=d.depth)}return u}var ig={};function Wu(e){let t=performance.now(),{input:n,estimate:o}=Xu(e);return{model:Qt(n),buildMs:performance.now()-t,source:"main",...o?{estimate:o}:{}}}function rg(e){let t=Ut(e.doc);return{...Wu({...e,seats:t}),seats:t}}function Yu(e,t,n){if(typeof Worker>"u")return Promise.resolve(t());let o;try{o=new Worker(new URL("./scene/scene.worker.js",ig.url),{type:"module"})}catch{return Promise.resolve(t())}return new Promise(r=>{let i=!1,a=u=>{i||(i=!0,clearTimeout(c),o.terminate(),r(u))},s=()=>a(t()),c=window.setTimeout(s,15e3);o.onerror=s,o.onmessage=u=>{let l=n(u.data);l?a(l):s()},o.postMessage(e)})}function Ku(e){return Yu(e,()=>Wu(e),({model:t,buildMs:n,estimate:o})=>({model:t,buildMs:n,source:"worker",...o?{estimate:o}:{}}))}function $u(e){return Yu(e,()=>rg(e),({model:t,buildMs:n,seats:o,estimate:r})=>o?{model:t,buildMs:n,seats:o,source:"worker",...r?{estimate:r}:{}}:null)}var ag=40,sg=48,cg=Math.PI/180,lg=6,ug=500,mg=6;function fg(e,t,n={}){let o=performance.now(),r=t.prepared?t.prepared.estimate:t.estimate===!1?null:Gn(t.doc,t.seats);r&&(t={...t,doc:r.doc,seats:Mi(t.seats,r)});let i=t.prepared?.model??Qt(t),a=new jo(n.onAnalytics),s=new Array(i.seats.count);for(let[U,X]of i.seats.idToIndex)s[X]=U;let c=new Map(t.seats.map(U=>[U.id,U])),u=new Map;for(let U of t.seats){if(!U.rowId)continue;let X=u.get(U.rowId);X?X.push(U.id):u.set(U.rowId,[U.id])}let l=new Map,m=[0,0,0,0];function h(){if(b)for(let U of[b.seatProgram,b.solidProgram,b.chairProgram])U.uniforms.uSeeThrough.value=m}t.seats.forEach((U,X)=>{l.set(U.id,i.seatSectionIds?.[X]??U.sectionId)});let f=new Map;for(let[U,X]of i.seats.idToIndex){let Z=l.get(U);if(!Z)continue;let ue=f.get(Z);ue?ue.push(X):f.set(Z,[X])}let d=()=>{if(!b||!i.sectionSolidRanges.length)return;let{lit:U,anyUnlit:X}=Bl(i.sectionSolidRanges,f,i.seats.iState);b.setSectionShellLit(X?U:null)},p=t.doc.floors?.some(X=>(X.baseHeightM??0)>0)?!0:(t.doc.floors?.flatMap(X=>X.objects)??t.doc.objects).some(X=>X.type==="section"&&((X.height??0)>0||(X.rake??0)>0)),b=null,g=null,v=null,w=!1,R=!1,M=!1,y=new Map,P=null,x=null,S=null,A=new Map,_=null,D=()=>{S===null&&(S=e.style.zIndex,e.style.zIndex="20")},E=()=>{S!==null&&(e.style.zIndex==="20"&&(e.style.zIndex=S),S=null)},I=!1,k=()=>I?ke.focusedFloor():-1,L=()=>{b=zl(N.gl,i),g?.dispose(),g=fl(N.gl,[1,1,1]),Ai(!1),d(),fe(),v=new Lo(N.renderer,b.seatGeometry,b.chairGeometry,b.solidGeometry,i.seats.count),N.setClearColor(i.theme.background.top),v.setRestoreClear(i.theme.background.top),v.setRoomCentre(i.room?.centre),b.seatProgram.uniforms.uSeatRadius.value=st*i.theme.seatScale,b.seatProgram.uniforms.uFocusFloor.value=k(),b.solidProgram.uniforms.uFocusFloor.value=k(),b.chairProgram.uniforms.uFocusFloor.value=k(),b.screenProgram&&(b.screenProgram.uniforms.uFocusFloor.value=k()),h(),F.forceRegather()},B=!1,F=new Wo({model:i,orbit:()=>C,gpu:()=>b}),V=U=>F.setDetailEnabled(U),N=new Kn(e,{onContextLost:()=>{M||a.contextLost(),w=!0,be.stop(),b=null,v=null},onContextRestored:()=>{L(),w=!1,M||a.contextRestored(),be.requestRender()}}),C=new $n(N.gl,N.canvas,()=>be.requestRender(),()=>a.orbitEngaged());C.setAspect(N.aspect);let O=(t.doc.floors?.flatMap(U=>U.objects)??t.doc.objects).some(U=>U.type==="section"&&U.physical3dProvenance?.surfaceKind?.status==="inferred"),G=(()=>{if(Number.isFinite(n.overviewAzimuthDeg))return n.overviewAzimuthDeg*Math.PI/180;if(!(O&&i.stages.length===0))return Bi(i.focalWorld,i.seats.iPosition,i.bounds)})(),j=(t.doc.floors?.flatMap(U=>U.objects)??t.doc.objects).some(U=>U.type==="shape"&&U.stageKind?.startsWith("pitch-")),H=i.floors.length>1?{polarDeg:48,margin:1.1}:{polarDeg:j?36:48,margin:1.05},z=typeof window<"u"&&!!window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches;C.frame(i.bounds,!z&&n.skipInitialOverviewAnimation!==!0,G,n.portraitOverviewCrop===!0,H);let $=new Oo(C.camera),Q=Fu(e),ae=Vi(e,i),q=new _o(e,{fontFamily:t.doc.theme?.fontFamily,ink:t.doc.theme?.textColor,backgroundRgb:i.theme.background.top}),W=i.labels,Y=()=>Fc(W,i.floors.length,k());q.setLabels(Y()),q.setOverviewDistance(C.targetDistance);let K=null,ne=()=>[...y.keys()].flatMap(U=>{let X=i.seats.idToIndex.get(U),Z=X===void 0?void 0:t.seats[X];if(X===void 0||Z?.id!==U)return[];let ue=X*3;return[{id:`seat:${U}`,kind:"seat",seatWidthM:i.seats.iChairWidth[X]*2,text:Z.displayLabel||Z.label,anchor:[i.seats.iPosition[ue],i.seats.iPosition[ue+1]+1.05,i.seats.iPosition[ue+2]],pinBase:je(ue)}]}),ee=-1,fe=()=>{b&&(ee=K?i.sections.findIndex(U=>U.id===K):-1,b.seatProgram.uniforms.uFocusSection.value=ee,b.chairProgram.uniforms.uFocusSection.value=ee)},J=U=>{if(K=U,fe(),q.setForcedDense(!!U),!U){let ie=ne(),Le=new Set(ie.map(Ae=>Ae.id));q.setLabels([...Y().filter(Ae=>!Le.has(Ae.id)),...ie]);return}let X=t.seats.filter(ie=>l.get(ie.id)===U),Z=new Set(X.map(ie=>ie.id)),ue=new Set(X.map(ie=>ie.rowId)),me=new Set(y.keys()),xe=new Set(X.filter(ie=>me.has(ie.id)).map(ie=>ie.id)),ye=Y().filter(ie=>ie.kind!=="row"&&ie.kind!=="seat"&&ie.kind!=="access"||ie.kind==="access"&&Z.has(ie.id.slice(7))||(ie.kind==="row"?ue.has(ie.id.slice(4)):Z.has(ie.id.slice(5))));if(i.seatCount<=6e3&&xe.size===0){q.setLabels(ye);return}let Pe=X,Be=new Set(Pe.map(ie=>`seat:${ie.id}`)),ht=Pe.flatMap(ie=>{let Le=i.seats.idToIndex.get(ie.id);if(Le===void 0)return[];let Ae=Le*3;return[{id:`seat:${ie.id}`,kind:"seat",seatWidthM:i.seats.iChairWidth[Le]*2,rowId:ie.rowId,text:me.has(ie.id)?ie.displayLabel||ie.label:ni(ie.displayLabel||ie.label),anchor:[i.seats.iPosition[Ae],i.seats.iPosition[Ae+1]+(me.has(ie.id)?1.05:.55),i.seats.iPosition[Ae+2]],...me.has(ie.id)?{pinBase:je(Ae)}:{}}]});q.setLabels([...ye.filter(ie=>!Be.has(ie.id)),...ht])};L();let oe=null,De=null,te=new qu.Mat4,Me=U=>{if(w||!b||R)return!1;let X=vu({flying:$.active,panoramaMounted:P!==null,seatViewActive:oe?.active===!0}),Z=X==="orbit"?ee:-1;b.seatProgram.uniforms.uFocusSection.value=Z,b.chairProgram.uniforms.uFocusSection.value=Z;let ue=X==="cinematic"?$.update(performance.now()):X==="seatView"?oe.update(performance.now()):X==="orbit"?C.update():!1;De?.syncZoomLimits();let me=k()>=0?i.floors[k()]:null,xe=me?.radius??i.bounds.radius,ye=da(C.currentDistance,xe),Pe=B?{center:[C.camera.position.x,C.camera.position.y,C.camera.position.z],radius:520}:i.clipBounds??i.renderBounds;C.updateClipping(Pe);let Be=me?.center??i.renderBounds.center,ht=me?.radius??i.renderBounds.radius,ie=(Re,nr)=>Math.hypot(C.camera.position.x-Re[0],C.camera.position.y-Re[1],C.camera.position.z-Re[2])<=nr*(F.detailVisible?1.8:1.55),Le=ie(Be,ht);if(!Le&&K){let Re=i.sections.find(nr=>nr.id===K);Re&&(Le=ie(Re.center,Math.max(12,Re.radius*2)))}F.detailVisible=Le;let Ae=b.seatProgram.uniforms;Ae.uSeatScale.value=ye.scale,Ae.uSeatFade.value=ye.fade;let jn=!!me&&ha(me.seatCount,N.canvas.clientWidth||1,N.canvas.clientHeight||1),Xn=pa(i.seats.count,xe,C.currentDistance,C.camera.fov,N.canvas.clientHeight||1),sn=F.detailVisible||jn||Xn?1:0,cn=F.detailVisible||k()>=0||i.floors.length>1?1:0;F.ease(U,sn,cn),Ae.uSeatDetail.value=F.seatDetailMix;let Wn=sn===0&&F.seatDetailMix<.01;b.seatGeometry.setDrawRange(Wn?ir:0,Wn?Wi:ir),b.solidProgram.uniforms.uStructureDetail.value=F.structureDetailMix,Ae.uMinPixels.value=ye.minPixels,Ae.uPixelToWorld.value=2*Math.tan(C.camera.fov*cg/2)/Math.max(1,N.pixelHeight),F.update(F.detailVisible),i.outdoor&&(te.copy(C.camera.projectionViewMatrix).inverse(),b.backgroundProgram.uniforms.uInvViewProj.value.set(te)),N.renderer.render({scene:b.background,clear:!0}),N.renderer.render({scene:b.main,camera:C.camera,clear:!1});let ln=g?g.update(performance.now(),[C.camera.position.x,C.camera.position.y,C.camera.position.z],P!==null,X==="seatView"):!1;if(g&&N.renderer.render({scene:g.root,camera:C.camera,clear:!1}),ae){let Re=C.camera.worldMatrix;ae.update(X==="seatView"?[C.camera.position.x,C.camera.position.y,C.camera.position.z]:null,[-Re[8],-Re[9],-Re[10]])}q.update(C.camera.projectionViewMatrix,N.canvas.clientWidth||1,N.canvas.clientHeight||1,C.currentDistance,xe,[C.camera.position.x,C.camera.position.y,C.camera.position.z]);let Ft=ue||ln||F.seatDetailMix!==sn||F.structureDetailMix!==cn;return we(!Ft),Ft},we=sa(e),be=new qn(Me),Qe=typeof ResizeObserver<"u"?new ResizeObserver(()=>tr.resize()):null;Qe?.observe(e),C.setZoomPointResolver((U,X)=>{let Z=N.canvas.getBoundingClientRect(),ue=N.canvas.clientWidth||Z.width,me=N.canvas.clientHeight||Z.height;if(!(ue>0)||!(me>0))return null;C.camera.updateMatrixWorld();let xe=Si(i.seats.iPosition,i.seats.count,C.camera.projectionViewMatrix,ue,me,U-Z.left,X-Z.top,ag);if(xe<0)return null;let ye=xe*3;return[i.seats.iPosition[ye],i.seats.iPosition[ye+1]+.5,i.seats.iPosition[ye+2]]});function je(U){return[i.seats.iPosition[U],i.seats.iPosition[U+1]+.5,i.seats.iPosition[U+2]]}q.setSeatNumberRow(null);let Ie=null,Ne=0,ft=null,wi=()=>{Ne=0;let U=null,X=null;if(Ie&&!oe?.active&&!$.active){let me=N.canvas.getBoundingClientRect(),xe=N.canvas.clientWidth||me.width,ye=N.canvas.clientHeight||me.height;if(xe>0&&ye>0){let Pe=Si(i.seats.iPosition,i.seats.count,C.camera.projectionViewMatrix,xe,ye,Ie.x-me.left,Ie.y-me.top,sg);U=Pe>=0?t.seats[Pe]?.rowId??null:null;let Be=Pe>=0?t.seats[Pe]?.id??null:null;if(X=Be,Ie.mouse&&!Ie.pressing&&!!K&&!!Be&&l.get(Be)===K){let ie=e.getBoundingClientRect();ft=Be,n.onSeatHover?.(Be,{x:Ie.x-ie.left,y:Ie.y-ie.top})}else Pi()}}else Pi();let Z=Ie?.mouse?X:null,ue=q.setSeatNumberSeat(Z);(q.setSeatNumberRow(U)||ue)&&be.requestRender()};function Pi(){ft!==null&&(ft=null,n.onSeatHover?.(null,null))}let zn=U=>{Ie={x:U.clientX,y:U.clientY,mouse:U.pointerType==="mouse",pressing:U.type==="pointerdown"},Ne||(Ne=requestAnimationFrame(wi))},Ii=U=>{U.pointerType==="mouse"&&(Ie=null,Ne||(Ne=requestAnimationFrame(wi)))};N.canvas.addEventListener("pointermove",zn),N.canvas.addEventListener("pointerdown",zn),N.canvas.addEventListener("pointerleave",Ii);function Ai(U){if(!g)return;let X=[];for(let Z of y.keys()){let ue=i.seats.idToIndex.get(Z);if(ue===void 0)continue;let me=ue*3;X.push({id:Z,position:je(me)})}g.setSeats(X,performance.now(),U)}let Ri=U=>{let X=me=>{let xe=i.seats.idToIndex.get(me);return xe===void 0?void 0:i.seats.iState[xe]},{updates:Z,next:ue}=Wl(y,U,X);if(y=ue,q.setSelectedSeatIds(y.keys()),Ai(!on()),be.requestRender(),J(K),Z.length){let me=yr(i.seats,Z);b&&b.uploadSeatStateRuns(me),d(),be.requestRender()}},on=()=>_!==null?_:typeof window<"u"&&!!window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,Zu=8,Ei=U=>{if(!n.getSeatView)return null;let X=A.get(U);if(!X)for(X=Promise.resolve(n.getSeatView(U)),A.set(U,X),X.catch(()=>{A.get(U)===X&&A.delete(U)});A.size>Zu;){let Z=A.keys().next().value;if(Z===void 0)break;A.delete(Z)}return X},Ci=mu(i.stages,i.focalWorld,i.bounds.groundY??0),Qu=hi(Ci),Ko=(U,X)=>{let Z=c.get(U),ue=Math.max(0,Math.round(i.seats.iFloor[X]??0)),me=t.doc.floors?.[ue],xe=i.floors[ue],ye=me?.focalPoint??t.doc.focalPoint,Pe=xe?{x:xe.focalWorld[0]/T,y:xe.focalWorld[2]/T}:ye,Be=Z?.focalPoint?{x:Z.focalPoint.x+Pe.x-ye.x,y:Z.focalPoint.y+Pe.y-ye.y}:Pe,ht=[i.seats.iPosition[X*3],i.seats.iPosition[X*3+1],i.seats.iPosition[X*3+2]];return tu(ht,Be,me?.baseHeightM??0,Z?.eyeHeightM,Qu)},$o=()=>(e.clientWidth||N.canvas.clientWidth)<=520,qo=null,_i=null,Ju=async(U,X,Z)=>{if(!n.getSeatView||M||Z!==ke.flightGen())return;let ue;try{ue=await Lu()}catch{if(a.panoramaFailed(U,"mount"),!M&&Z===ke.flightGen()){let me=Qo(U,Z,!0);requestAnimationFrame(()=>me?.querySelector("[data-panorama-trigger]")?.focus())}return}if(!(M||Z!==ke.flightGen()||!qo))return _i??=ue.createOpenPanorama(qo),_i(U,X,Z)},Zo=Du({container:e,model:i,opts:n,expandedSeatById:c,seatIdsByRow:u,isNarrow:$o,isDisposed:()=>M,flightGen:()=>ke.flightGen(),flyToSeat:U=>Oi(U),openPanorama:(U,X,Z)=>Ju(U,X,Z)}),Qo=Zo.show,Jo=Zo.remove,em=Zo.layout,Rt=Nu({container:e,orbit:C,isNarrow:$o,enabled:n.chrome?.controlDock!==!1,...n.navLabels?{labels:n.navLabels}:{}});De=Rt;let tm=Rt.element,rn=Rt.setNavigationMode,nm=Rt.layout,om=Rt.utilityControls,an=null,Ti=!1,Un=U=>{Rt.setSeatViewLocked(U),U||oe?.exit()};oe=xu({canvas:N.canvas,camera:C.camera,requestRender:()=>be.requestRender(),reducedMotion:on,onStopChange:U=>{let X=U??(Ti?"seat":null);an=X;try{n.onSeatViewStopChange?.(X)}catch{}},onApplied:()=>{M||C.syncFromCamera()}});let ki=i.sections.reduce((U,X)=>X.seatCount>0&&X.box?Math.max(U,X.box.max[1]):U,-1/0),rm=(U,X)=>{let{eye:Z}=Ko(U,X),ue=(e.clientWidth||N.canvas.clientWidth||1)/Math.max(1,e.clientHeight||N.canvas.clientHeight||1),me=du(Z,Ci,ue,{preserveEye:!0});if(n.seatViewStops===!1)return{...me,stops:[]};let xe=l.get(U),ye=xe?i.sections.find(Pe=>Pe.id===xe):void 0;return{...me,stops:hu(me,{aspect:ue,seatingTopY:Number.isFinite(ki)?ki:i.bounds.box.max[1],section:ye&&ye.seatCount>0?{center:ye.center,radius:ye.radius}:null,venue:{center:i.bounds.center,radius:i.bounds.radius}})}},ke=Uu({isNarrow:$o,setSeeThrough:U=>{m=U?[U[0],U[1],U[2],mg]:[0,0,0,0],h(),be.requestRender()},container:e,model:i,opts:n,orbit:C,cinematic:$,analytics:a,loop:be,labelOverlay:q,stageAzimuth:G,overviewFraming:H,gpu:()=>b,isDisposed:()=>M,panorama:()=>P,setPanorama:U=>{P=U},setPanoramaSphereVisible:U=>{B=U},panoramaLoadAbort:()=>x,setPanoramaLoadAbort:U=>{x=U},setFrozen:U=>{R=U},restorePanoramaLayer:E,reducedMotion:on,resolvedSeatViewPose:Ko,showSectionSeatLabels:J,setNearFieldDetailEnabled:V,setSeatViewLocked:Un,setNavigationMode:rn,showArriveChip:Qo,removeArriveChip:Jo,inSeatView:()=>an!==null,setSeatStepping:U=>{Ti=U},seatViewArrival:(U,X)=>n.arriveAtSeatEye?rm(U,X):null,enterSeatView:(U,X)=>oe?.enter(U,X)});I=!0;let er=ke.overviewChip,im=ke.layoutOverviewChip,am=ke.applyFloorFocus,sm=ke.focusOverview,Li=ke.cancelFlight,Oi=ke.flyToSeat,Fi=ke.focusSectionCamera;om.appendChild(er),qo={container:e,model:i,opts:n,analytics:a,orbit:C,loop:be,seatsById:c,ensureSeatView:Ei,resolvedSeatViewPose:Ko,gpu:()=>b,gl:N.gl,isContextLost:()=>w,isDisposed:()=>M,flightGen:()=>ke.flightGen(),setPanorama:U=>{P=U},getLoadAbort:()=>x,setLoadAbort:U=>{x=U},setPanoramaSphereVisible:U=>{B=U,U&&oe?.exit()},setFrozen:U=>{R=U},raisePanoramaLayer:D,restorePanoramaLayer:E,getOverviewChip:()=>er,labelOverlay:q,reducedMotion:on,removeArriveChip:Jo,showArriveChip:Qo};let dt=Hu({glctx:N,orbit:C,model:i,seats:t.seats,opts:n,cinematic:$,analytics:a,seatIdByIndex:s,sectionIdBySeatId:l,tapSlop:lg,tapMs:ug,gpu:()=>b,pick:()=>v,seatViewLocked:()=>Rt.seatViewLocked(),focusedSectionId:()=>K,selection:()=>y,cancelFlight:Li,focusSectionCamera:Fi,focusSeatCamera:ke.focusSeatCamera,setSelection:Ri,ensureSeatView:Ei});N.canvas.addEventListener("pointerdown",dt.onDown),N.canvas.addEventListener("pointermove",dt.onMove),N.canvas.addEventListener("pointerup",dt.onUp),N.canvas.addEventListener("pointercancel",dt.onUp),be.requestRender();let tr={setAvailability(U){let X=Xl(y,U),Z=yr(i.seats,X);Z.length&&b&&b.uploadSeatStateRuns(Z),d(),be.requestRender()},setSelection:Ri,setNavigationMode:rn,zoomIn(){C.zoomBy(Bt),be.requestRender()},zoomOut(){C.zoomBy(pn),be.requestRender()},flyToSeat:Oi,focusOverview:sm,seatViewStop:()=>an,recentreSeatView:()=>oe?.recentre()??!1,resize(){let{width:U,height:X}=N.resize();C.setAspect(U/Math.max(1,X)),em(),nm(),im(),be.requestRender()},stats(){return{...be.stats(),drawCalls:b?b.drawCalls:0,fallbackTriangles:b?b.seatGeometry.drawRange.count/3*i.seats.count:0,seatCount:i.seatCount}},captureImage(U=1280){if(w||!b||typeof document>"u")return null;Me(0);let X=N.canvas,Z=Math.min(1,U/Math.max(X.width,X.height,1)),ue=document.createElement("canvas");ue.width=Math.max(1,Math.round(X.width*Z)),ue.height=Math.max(1,Math.round(X.height*Z));let me=ue.getContext("2d");return me?(me.drawImage(X,0,0,ue.width,ue.height),ue.toDataURL("image/jpeg",.82)):null},getQualityEvidence(){let U=be.stats(),X=N.canvas.clientWidth||1,Z=N.canvas.clientHeight||1,ue=i.bounds.center,me=nt(C.camera.projectionViewMatrix,[ue[0],i.bounds.box.min[1],ue[2]],X,Z),xe=nt(C.camera.projectionViewMatrix,[ue[0],i.bounds.box.max[1],ue[2]],X,Z),ye=i.bounds.box,Pe=[ye.min[0],ye.max[0]].flatMap(ie=>[ye.min[1],ye.max[1]].flatMap(Le=>[ye.min[2],ye.max[2]].map(Ae=>nt(C.camera.projectionViewMatrix,[ie,Le,Ae],X,Z)))).filter(ie=>Number.isFinite(ie.x)&&Number.isFinite(ie.y)&&Number.isFinite(ie.depth)),Be=Pe.length?(()=>{let ie=Math.min(...Pe.map(Re=>Re.x)),Le=Math.max(...Pe.map(Re=>Re.x)),Ae=Math.min(...Pe.map(Re=>Re.y)),jn=Math.max(...Pe.map(Re=>Re.y)),Xn=Math.max(0,ie),sn=Math.min(X,Le),cn=Math.max(0,Ae),Wn=Math.min(Z,jn),ln=Math.max(0,sn-Xn),Ft=Math.max(0,Wn-cn);return{box:{x:Xn,y:cn,width:ln,height:Ft},horizontalFillRatio:ln/X,verticalFillRatio:Ft/Z,visibleAreaRatio:ln*Ft/(X*Z),clippedEdges:[...Ae<0?["top"]:[],...Le>X?["right"]:[],...jn>Z?["bottom"]:[],...ie<0?["left"]:[]]}})():void 0,ht=String(N.gl.getParameter(N.gl.VERSION)??"");return{viewport:{width:X,height:Z},context:{webgl2:/webgl\s*2/i.test(ht),lost:w},frame:{rendered:U.rendered,idle:U.idle},camera:{position:[C.camera.position.x,C.camera.position.y,C.camera.position.z],distance:C.currentDistance,verticalFovDeg:C.fovY},scene:{seatCount:i.seatCount,floorCount:i.floors.length,zoneCount:i.zones.length,sectionCount:i.sections.length,authoredRelief:p,renderedVerticalSpanM:Math.max(0,i.bounds.box.max[1]-i.bounds.box.min[1]),projectedReliefPx:me.visible&&xe.visible?Math.abs(me.y-xe.y):0},labels:q.qualityEvidence(),framing:Be,...an?{seatView:{fovDeg:C.camera.fov,stop:an}}:{}}},getQualityReport(){return To(tr.getQualityEvidence())},loseContextForTest(){N.simulateContextLossCycle()},floors(){return i.floors},focusFloor(U){if(U!==null&&!i.floors.some(Z=>Z.index===U))return!1;let X=U??-1;if(V(U!==null),Un(!1),am(X),rn("orbit"),U===null)$.cancel(),on()?C.frame(i.bounds,!1,G,n.portraitOverviewCrop===!0,H):C.frameSoft(i.bounds,G,n.portraitOverviewCrop===!0,H),q.setOverviewDistance(C.targetDistance);else{let Z=i.floors[U];if(Z.seatCount>0){$.cancel();let ue=Z.focalWorld[0]-Z.center[0],me=Z.focalWorld[2]-Z.center[2],xe=Math.hypot(ue,me)>Z.radius*.12?Math.atan2(ue,me):G;C.frame({center:Z.center,radius:Z.radius,box:Z.box},!1,xe,!1,{polarDeg:58,margin:1.12}),q.setOverviewDistance(C.targetDistance)}}return be.requestRender(),!0},zones(){return i.zones},focusZone(U){let X=i.zones.find(xe=>xe.id===U);if(!X||X.seatCount===0)return!1;V(!1),Un(!1),$.cancel(),rn("orbit"),J(null),n.onSectionFocusChange?.(null);let Z=X.focalWorld[0]-X.center[0],ue=X.focalWorld[2]-X.center[2],me=Math.hypot(Z,ue)>X.radius*.12?Math.atan2(Z,ue):void 0;return C.frame({center:X.center,radius:X.radius*1.25},!1,me),be.requestRender(),!0},sections(){return i.sections},focusSection(U){return Fi(U)},rows(U){return U?i.rows.filter(X=>X.sectionId===U):i.rows},seatsInRow(U){return t.seats.filter(X=>X.rowId===U).map(X=>({id:X.id,label:X.displayLabel||X.label}))},focusRow(U){let X=i.rows.find(Z=>Z.id===U);return!X||X.seatCount===0?!1:(V(!0),Un(!1),$.cancel(),rn("pan"),X.sectionId&&(J(X.sectionId),n.onSectionFocusChange?.(X.sectionId)),C.frame({center:X.center,radius:Math.max(2.5,X.radius*.65)}),be.requestRender(),!0)},setReducedMotionForTest(U){_=U},dispose(){M=!0,ae?.dispose(),we(!1),Jo(),er.remove(),tm.remove(),Li(),oe?.dispose(),be.stop(),q.dispose(),Qe?.disconnect(),P&&(P.dispose(),P=null),E(),Q(),N.canvas.removeEventListener("pointerdown",dt.onDown),N.canvas.removeEventListener("pointermove",dt.onMove),N.canvas.removeEventListener("pointerup",dt.onUp),N.canvas.removeEventListener("pointercancel",dt.onUp),N.canvas.removeEventListener("pointermove",zn),N.canvas.removeEventListener("pointerdown",zn),N.canvas.removeEventListener("pointerleave",Ii),Ne&&cancelAnimationFrame(Ne),C.dispose(),v&&v.dispose(),b&&b.dispose(),b=null,g?.dispose(),g=null,v=null,N.dispose()}};return a.opened(i.seatCount,p,t.prepared?.buildMs??performance.now()-o,t.prepared?.source??"inline"),tr}0&&(module.exports={VENUE3D_QUALITY_REPORT_VERSION,autoVenue3d,buildSceneModel,estimateVenue3D,inspectVenue3DQualityEvidence,mountVenue3D,prepareVenue3D,prepareVenue3DFromChart});
|
|
976
|
+
void main(){ if(vDim>0.5) discard; vec4 c=texture(uImage,vUv); if(c.a<0.01) discard; fragColor=c; }`,uniforms:{uImage:{value:$},uFocusFloor:{value:-1}},transparent:!1,depthTest:!0,depthWrite:!0,cullFace:!1});let ne=new Ce.Mesh(e,{geometry:U,program:q});ne.frustumCulled=!1,ne.setParent(n),X.screenProgram=q,D=!0,X.drawCalls=3+(B?1:0)+1},K.src=Y.contentImageUrl}return X}var ct=require("ogl");function lg(e,t,n){let o=e+(t<<8)+(n<<16);return o===0?-1:o-1}function pu(e,t,n,o,i,r){let a=-1,s=1/0;for(let c=0;c<n;c++)for(let l=0;l<t;l++){let u=(c*t+l)*4,m=lg(e[u],e[u+1],e[u+2]);if(m<0||m>=r)continue;let f=l-o,d=c-i,h=f*f+d*d;h<s&&(s=h,a=m)}return a}function bu(e,t,n,o,i,r){let a=e-n.left,s=t-n.top,c=Math.round(a*o),l=Math.round((n.height-s)*o);return{x:Math.max(0,Math.min(i-1,c)),y:Math.max(0,Math.min(r-1,l))}}var ug=["uSeatRadius","uSeatScale","uMinPixels","uPixelToWorld"],Uo=class{constructor(t,n,o,i,r){this.seatScene=new ct.Transform;this.chairScene=new ct.Transform;this.solidScene=new ct.Transform;this.target=null;this.restoreClear=[0,0,0];this.renderer=t,this.gl=t.gl,this.maxIndex=r,this.seatProg=nu(this.gl),this.chairProg=ou(this.gl),this.depthProg=ru(this.gl);let a=new ct.Mesh(this.gl,{geometry:n,program:this.seatProg});a.frustumCulled=!1,a.setParent(this.seatScene);let s=new ct.Mesh(this.gl,{geometry:o,program:this.chairProg});s.frustumCulled=!1,s.setParent(this.chairScene);let c=new ct.Mesh(this.gl,{geometry:i,program:this.depthProg});c.frustumCulled=!1,c.setParent(this.solidScene)}setRoomCentre(t){this.depthProg.uniforms.uRoomCentre.value.set(t??[0,0])}setRestoreClear(t){this.restoreClear=[t[0],t[1],t[2]]}syncFromSeatProgram(t){for(let i of ug)this.seatProg.uniforms[i].value=t.uniforms[i].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;let o=t.uniforms.uSeeThrough?.value;if(o)for(let i of[this.seatProg,this.chairProg,this.depthProg])i.uniforms.uSeeThrough.value=o}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 ct.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,o,i){let r=this.gl,a=this.ensureTarget(),s=r.drawingBufferWidth,c=r.drawingBufferHeight,l=Math.max(0,n-i),u=Math.max(0,o-i),m=Math.max(1,Math.min(s,n+i+1)-l),f=Math.max(1,Math.min(c,o+i+1)-u);r.enable(r.SCISSOR_TEST),r.scissor(l,u,m,f);let[d,h,p]=this.restoreClear;r.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}),r.clearColor(d,h,p,1),r.disable(r.SCISSOR_TEST);let b=new Uint8Array(m*f*4);return this.renderer.bindFramebuffer(a),r.readPixels(l,u,m,f,r.RGBA,r.UNSIGNED_BYTE,b),this.renderer.bindFramebuffer(),pu(b,m,f,n-l,o-u,this.maxIndex)}dispose(){this.destroyTarget(),this.seatProg.remove(),this.chairProg.remove(),this.depthProg.remove()}};function yu(e,t){let n=[];for(let o of t)e.has(o.seatId)?e.set(o.seatId,wn(o.state)):n.push(o);return n}function gu(e,t,n){let o=new Set;for(let a of t)(e.has(a)||n(a)!==void 0)&&o.add(a);let i=new Map(e),r=[];for(let[a,s]of e)o.has(a)||(r.push({seatId:a,state:_e[s]??"available"}),i.delete(a));for(let a of o){if(i.has(a))continue;let s=n(a);s!==void 0&&(i.set(a,s),r.push({seatId:a,state:"selected"}))}return{updates:r,next:i}}var It=require("ogl");function mg(e,t){return[e[0]-t[0],e[1]-t[1],e[2]-t[2]]}function xu(e,t){return[e[0]+t[0],e[1]+t[1],e[2]+t[2]]}function fg(e,t){return[e[0]*t,e[1]*t,e[2]*t]}function vu(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 Ei(e){let t=Math.max(0,Math.min(1,e));return t*t*t*(t*(t*6-15)+10)}function Ci(e,t){return Math.max(0,Math.min(1,e+t))}function Mu(e,t){let n=e.length;if(n===0)return[0,0,0];if(n===1)return[...e[0]];let o=Math.max(0,Math.min(1,t)),i=n-1,r=Math.floor(o*i);r>=i&&(r=i-1);let a=o*i-r,s=e[Math.max(0,r-1)],c=e[r],l=e[r+1],u=e[Math.min(n-1,r+2)],m=a*a,f=m*a,d=[0,0,0];for(let h=0;h<3;h++)d[h]=.5*(2*c[h]+(-s[h]+l[h])*a+(2*s[h]-5*c[h]+4*l[h]-u[h])*m+(-s[h]+3*c[h]-3*l[h]+u[h])*f);return d}function _i(e,t,n,o,i){let r=vu(mg(t,n));r[0]===0&&r[1]===0&&r[2]===0&&(r=[0,0,1]);let a=xu(xu(t,fg(r,2.5)),[0,1.5,0]),s=[t[0]-o[0],0,t[2]-o[2]],c=vu(s);c[0]===0&&c[2]===0&&(c=[r[0],0,r[2]]);let l=Math.max(1,i),u=[o[0]+c[0]*l*1.3,o[1]+l*.75,o[2]+c[2]*l*1.3];return{waypoints:[e,u,a],finalPos:a}}function Ti(e,t,n=35,o=28){let i=Ei(t),r=Mu(e,i),a=Ei(Math.max(0,Math.min(1,(t-.66)/.34)));return{pos:r,fov:n+(o-n)*a,eased:i}}function Au(e,t,n){let o=e.position.clone(),i=new It.Quat().copy(e.quaternion);e.position.set(t[0],t[1],t[2]),e.lookAt(new It.Vec3(n[0],n[1],n[2]));let r=new It.Quat().copy(e.quaternion);return e.position.copy(o),e.quaternion.copy(i),r}var jo=class{constructor(t){this.active=!1;this.waypoints=[];this.startQuat=new It.Quat;this.endQuat=new It.Quat;this.outQuat=new It.Quat;this.startTime=0;this.duration=2500;this.endFov=28;this.resolveFn=null;this.camera=t}start(t,n,o,i=2500,r=28){return this.settle(),this.waypoints=t,this.startQuat.copy(n),this.endQuat.copy(o),this.duration=i,this.endFov=r,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:o,fov:i,eased:r}=Ti(this.waypoints,n,35,this.endFov);return this.camera.position.set(o[0],o[1],o[2]),this.outQuat.copy(this.startQuat).slerp(this.endQuat,Ci(r,.15)),this.camera.quaternion.copy(this.outQuat),this.camera.fov=i,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 Iu=br,dg=.12,hg=1.6,Ru=.12;function Eu(e,t,n){let o=e[t*3],i=e[t*3+1],r=e[t*3+2],a=n[0]-o,s=n[2]-r,c=Math.hypot(a,s);if(!(c>.001))return null;let l=a/c,u=s/c,m=1/0,f=null;for(let d=0;d*3<e.length;d++){if(d===t)continue;let h=e[d*3]-o,p=e[d*3+2]-r,b=h*l+p*u;b<.3||b>1.6||Math.abs(h*u-p*l)>.6||b<m&&(m=b,f=i-e[d*3+1])}return f}var pg=.25,bg=1.5;function Cu(e,t,n=0,o,i,r=!1){let a=[t.x*C,n+bg,t.y*C],s=i?[i[0],i[1],i[2]]:a,c=e[1],l=Number.isFinite(c)?c+(r?hg:Iu):Number.isFinite(o)?n+o:n+Iu,u=a[0]-e[0],m=a[2]-e[2],f=Math.hypot(u,m),d=f>.001?Math.min(dg,f*pg):0,h=f>.001?u/f:0,p=f>.001?m/f:0;return{eye:[e[0]+h*d,l,e[2]+p*d],focal:s}}var Rt=Math.PI/180,yg=45,ki=80,Wo=70,gg=1,xg=.99;function vg(e,t){if(!(e<gg))return ki;if(!(Number.isFinite(t)&&t>0))return Wo;let n=2*Math.atan(t/(2*Xo*xg)/Math.max(.05,e))/Rt;return Math.max(Wo,Math.min(ki,n))}var Mg=.25,Xo=1,Sg=.25,wg=12*Rt,Pg=.2,Ag=1.5,_u=.8,Tu=6,Nu=1.9,Ig=2/3,Rg=.12,Eg=.9,Cg=1.2,_g=2,Bu=.05,Tg=6;function Vu(e,t,n=0){if(!e.length)return{min:[t[0]-6,n,t[2]-6],max:[t[0]+6,Math.max(n+_u,t[1]),t[2]+6]};let o=1/0,i=-1/0,r=1/0,a=-1/0,s=n;for(let h of e)o=Math.min(o,h.cx-h.halfX),i=Math.max(i,h.cx+h.halfX),r=Math.min(r,h.cz-h.halfZ),a=Math.max(a,h.cz+h.halfZ),s=Math.max(s,h.y);let c=i-o,l=a-r,u=Math.max(c,Math.min(l,Tu))/2,m=Math.max(l,Math.min(c,Tu))/2,f=(o+i)/2,d=(r+a)/2;return{min:[f-u,n,d-m],max:[f+u,Math.max(n+_u,s),d+m]}}function kg(e){return{min:[e.min[0],e.min[1],e.min[2]],max:[e.max[0],e.max[1]+Nu,e.max[2]]}}function Li(e){let t=e.max[1];return[(e.min[0]+e.max[0])/2,Math.max(e.min[1]+Ag,t+Pg,t+Nu*Ig),(e.min[2]+e.max[2])/2]}function Gu(e,t){let n=e[0]-t[0],o=e[2]-t[2],i=Math.hypot(n,o);return i<.001?{x:0,z:1}:{x:n/i,z:o/i}}function ku(e,t,n){let o=t[0]-e[0],i=t[1]-e[1],r=t[2]-e[2],a=Math.hypot(o,i,r)||1;o/=a,i/=a,r/=a;let s=-r,c=o,l=Math.hypot(s,c);if(l<1e-6)return 1/0;s/=l,c/=l;let u=1/0,m=-1/0;for(let f=0;f<8;f++){let d=(f&1?n.max[0]:n.min[0])-e[0],h=(f&2?n.max[1]:n.min[1])-e[1],p=(f&4?n.max[2]:n.min[2])-e[2],b=Math.max(Bu,d*o+h*i+p*r),y=(d*s+p*c)/b;y<u&&(u=y),y>m&&(m=y)}return m-u}function Lu(e,t,n){let o=t[0]-e[0],i=t[1]-e[1],r=t[2]-e[2],a=Math.hypot(o,i,r)||1;o/=a,i/=a,r/=a;let s=-r,c=o,l=Math.hypot(s,c);if(l<1e-6)return 1/0;s/=l,c/=l;let u=-c*i,m=c*o-s*r,f=s*i,d=1/0,h=-1/0;for(let p=0;p<8;p++){let b=(p&1?n.max[0]:n.min[0])-e[0],y=(p&2?n.max[1]:n.min[1])-e[1],x=(p&4?n.max[2]:n.min[2])-e[2],S=Math.max(Bu,b*o+y*i+x*r),A=(b*u+y*m+x*f)/S;A<d&&(d=A),A>h&&(h=A)}return h-d}function Yo(e,t){return Math.tan(e*Rt/2)*Math.max(.05,t)}function Ou(e,t,n){let o=vg(n,e),i=c=>Math.max(yg,Math.min(o,c)),r=c=>2*Math.atan(c)/Rt,a=Number.isFinite(e)&&e>0?i(r(e/(2*Mg)/Math.max(.05,n))):o;if(!(Number.isFinite(t)&&t>0))return a;let s=Math.min(a,i(r(t/(2*Rg))));return e/(2*Yo(s,n))>Xo?a:s}function Hu(e,t,n,o={}){let i=Li(t),r=[e[0],e[1],e[2]],a=0,s=0,c=h=>{if(!(h>0))return;let p=Gu(r,i);r[0]+=p.x*h,r[2]+=p.z*h,s+=h},l=o.preserveEye?0:t.max[1]+Sg-r[1];l>0&&(r[1]+=l,a=l,c(l/Math.tan(wg)));let u=kg(t),m=ku(r,i,t),f=Ou(m,Lu(r,i,u),n),d=m/(2*Yo(f,n));for(let h=0;!o.preserveEye&&h<Tg&&d>Xo;h++){let p=Math.max(1,Math.hypot(r[0]-i[0],r[2]-i[2])),b=Number.isFinite(d)?d/Xo:2;c(Math.min(60,p*(Math.min(4,b)-1)+.5)),m=ku(r,i,t),f=Ou(m,Lu(r,i,u),n),d=m/(2*Yo(f,n))}return{eye:r,focal:i,fov:f,raisedM:a,pulledBackM:s,stageFrameWidth:d}}function Lg(e,t,n){let o=Math.tan(t*Rt/2),i=Yo(t,n);return Math.max(1,e/Math.max(.05,Math.min(o,i)))}var Og=.7,Fu=.5,Fg=.8;function Du(e,t,n){let o=[t[0]-e[0],t[1]-e[1],t[2]-e[2]],i=[n[0]-e[0],n[1]-e[1],n[2]-e[2]],r=o[0]*i[0]+o[1]*i[1]+o[2]*i[2],a=Math.hypot(o[0],o[1],o[2])*Math.hypot(i[0],i[1],i[2])||1;return Math.acos(Math.max(-1,Math.min(1,r/a)))/Rt}function Dg(e,t,n){let o=l=>{let u=Math.hypot(l[0],l[1],l[2])||1;return[l[0]/u,l[1]/u,l[2]/u]},i=[t[0]-e[0],t[1]-e[1],t[2]-e[2]],r=Math.hypot(i[0],i[1],i[2]),a=o(i),s=o([n[0]-e[0],n[1]-e[1],n[2]-e[2]]),c=o([0,1,2].map(l=>a[l]*(1-Fu)+s[l]*Fu));return[e[0]+c[0]*r,e[1]+c[1]*r,e[2]+c[2]*r]}function zu(e,t){let{aspect:n,venue:o}=t,i=e.focal,r=Gu(e.eye,i),a=p=>(p[0]-i[0])*r.x+(p[2]-i[2])*r.z,s=[{name:"seat",eye:e.eye,focal:i,fov:e.fov}],c=_g*(t.rowDepthM??Eg),l=[e.eye[0]+r.x*c,e.eye[1]+Cg,e.eye[2]+r.z*c],u=[e.eye[0],e.eye[1]-Og,e.eye[2]],m=Dg(l,i,u);s.push({name:"row",eye:l,focal:m,fov:Math.min(ki,Math.max(e.fov,2*Math.max(Du(l,m,u),Du(l,m,i))/Fg))});let f=(p,b,y,x)=>{let S=Lg(y,e.fov,n)*1.08,A=S*Math.sin(x*Rt),M=Number.isFinite(t.seatingTopY)?t.seatingTopY+2:-1/0,g=Math.max(A,M-b[1]),P=S*Math.cos(x*Rt);return{name:p,eye:[b[0]+r.x*P,b[1]+g,b[2]+r.z*P],focal:b,fov:e.fov}};t.section&&t.section.radius>0&&s.push(f("section",t.section.center,t.section.radius,35)),s.push(f("venue",o.center,Math.max(1,o.radius),40));let d=[],h=-1/0;for(let p of s){let b=a(p.eye);d.length&&b<=h+.5||(d.push(p),h=b)}return d}var Xu=require("ogl"),$n=Math.PI/180,Oi=320,Uu=70*$n,Ng=32*$n,Bg=24*$n,ju=.0026,Vg=.22,Gg=.006,Hg=180,zg=900,Ug=1100,jg=4,De=(e,t,n)=>Math.max(t,Math.min(n,e)),Wu=e=>e<.5?4*e*e*e:1-Math.pow(-2*e+2,3)/2;function Yu(e){let{canvas:t,camera:n}=e,o=[],i=!1,r=0,a=0,s=0,c=0,l=0,u=0,m=Oi,f=null,d=()=>{f&&(clearTimeout(f),f=null)},h=!1,p=[0,0],b=0,y=!1,x=null,S=null,A=new Map,M=!1,g=0,P=0,v=0,w=0,R=()=>i&&o.length?o[De(Math.round(r),0,o.length-1)].name:null,_=()=>{let k=R();k!==x&&(x=k,e.onStopChange?.(k))},F=()=>{if(!i||!o.length)return;let k=o[De(Math.floor(r),0,o.length-1)],B=o[De(Math.ceil(r),0,o.length-1)],D=De(r-Math.floor(r),0,1),G=(J,ie)=>J+(ie-J)*D,U=[G(k.eye[0],B.eye[0]),G(k.eye[1],B.eye[1]),G(k.eye[2],B.eye[2])],q=[G(k.focal[0],B.focal[0]),G(k.focal[1],B.focal[1]),G(k.focal[2],B.focal[2])],$=q[0]-U[0],ee=q[1]-U[1],Q=q[2]-U[2],X=Math.hypot($,ee,Q)||1,Y=Math.atan2($,Q),K=Math.asin(De(ee/X,-1,1)),re=Y+a,ne=De(K+s,-80*$n,80*$n),se=Math.cos(ne)*X;$=Math.sin(re)*se,ee=Math.sin(ne)*X,Q=Math.cos(re)*se,n.position.set(U[0],U[1],U[2]),n.fov=G(k.fov,B.fov),n.updateProjectionMatrix(),n.lookAt(new Xu.Vec3(U[0]+$,U[1]+ee,U[2]+Q)),e.onApplied?.()},E=()=>{if(!i||!o.length)return;let k=De(Math.round(r),0,o.length-1);if(e.reducedMotion()){h=!1,r=k,F(),_(),e.requestRender();return}if(Math.abs(k-r)<.001){h=!1,_();return}c=r,l=k,u=performance.now(),m=Oi,h=!0,e.requestRender()},I=k=>{!i||o.length<2||(d(),h=!1,r=De(r+k,0,o.length-1),F(),_(),e.requestRender())},T=(k,B)=>{i&&(d(),h=!1,y=!1,a=De(a-k*ju,-Uu,Uu),s=De(s-B*ju,-Bg,Ng),F(),e.requestRender())},L=k=>{i&&(A.set(k.pointerId,{x:k.clientX,y:k.clientY}),A.size===1?(M=!0,w=0,g=k.clientX,P=k.clientY):A.size===2&&(M=!1,v=V()))},V=()=>{let k=[...A.values()];return k.length<2?0:Math.hypot(k[0].x-k[1].x,k[0].y-k[1].y)},O=k=>{if(!i||!A.has(k.pointerId))return;if(A.set(k.pointerId,{x:k.clientX,y:k.clientY}),A.size>=2){let G=V();v>0&&I((v-G)*Gg),v=G;return}if(!M)return;let B=k.clientX-g,D=k.clientY-P;g=k.clientX,P=k.clientY,w+=Math.abs(B)+Math.abs(D),!(w<=jg)&&T(B,D)},H=k=>{A.delete(k.pointerId)&&(A.size<2&&(v=0),A.size===0&&(M=!1,E()))},j=k=>{if(!i)return;k.preventDefault();let B=k.deltaMode===1?16:k.deltaMode===2?100:1,D=De(k.deltaY*B/100,-2,2);I(D*Vg),S&&clearTimeout(S),S=setTimeout(()=>{S=null,E()},Hg)},N=()=>{d(),i&&(i=!1,h=!1,y=!1,o=[],A.clear(),M=!1,S&&(clearTimeout(S),S=null),x!==null&&(x=null,e.onStopChange?.(null)))};return t.addEventListener("pointerdown",L),t.addEventListener("pointermove",O),t.addEventListener("pointerup",H),t.addEventListener("pointercancel",H),t.addEventListener("wheel",j,{passive:!1}),{get active(){return i},enter(k,B=0){if(k.length<2){N();return}d(),o=k,i=!0,r=e.reducedMotion()?0:De(B,0,k.length-1),r>0&&(f=setTimeout(()=>{f=null,i&&(c=r,l=0,u=performance.now(),m=Ug,h=!0,e.requestRender())},zg)),a=0,s=0,h=!1,y=!1,x=null,F(),_(),e.requestRender()},exit:N,recentre(){return i?Math.abs(a)<1e-4&&Math.abs(s)<1e-4?!0:e.reducedMotion()?(y=!1,a=0,s=0,F(),e.requestRender(),!0):(p=[a,s],b=performance.now(),y=!0,e.requestRender(),!0):!1},update(k){if(!i)return!1;let B=!1;if(y){let D=De((k-b)/Oi,0,1),G=1-Wu(D);a=p[0]*G,s=p[1]*G,D>=1?(y=!1,a=0,s=0):B=!0}if(h){let D=De((k-u)/m,0,1);r=c+(l-c)*Wu(D),D>=1?(h=!1,r=l,_()):B=!0}return F(),B},currentStop:R,dispose(){N(),t.removeEventListener("pointerdown",L),t.removeEventListener("pointermove",O),t.removeEventListener("pointerup",H),t.removeEventListener("pointercancel",H),t.removeEventListener("wheel",j)}}}function Ku(e){return e.flying?"cinematic":e.panoramaMounted?"panorama":e.seatViewActive?"seatView":"orbit"}var Bi=null;function sm(){return Bi??=Promise.resolve().then(()=>(am(),im)).catch(e=>{throw Bi=null,e}),Bi}var cm=()=>typeof performance<"u"&&performance.now?performance.now():Date.now(),er=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,o,i){this.emit("3d_opened",{seats:t,hasHeights:n,...o===void 0?{}:{buildMs:Math.round(o)},...i===void 0?{}:{prepSource:i}})}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=cm(),this.emit("3d_panorama_opened")}panoramaClosed(){let t=this.panoramaOpenedAt?Math.round(cm()-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 lm(e){let t=e.style.position;return getComputedStyle(e).position!=="static"?()=>{}:(e.style.position="relative",()=>{e.style.position==="relative"&&(e.style.position=t)})}function um(e){let{container:t,model:n,opts:o,expandedSeatById:i,seatIdsByRow:r,isNarrow:a}=e,s=null,c=()=>{if(!s)return;let m=a();Object.assign(s.style,m?{left:"12px",right:"12px",bottom:"70px",transform:"none",justifyContent:"center"}:{left:"50%",right:"auto",bottom:"18px",transform:"translateX(-50%)",justifyContent:"initial"})},l=()=>{s?.remove(),s=null};return{show:(m,f,d=!1)=>{if(l(),e.isDisposed())return null;let h=document.createElement("div");h.setAttribute("role","group"),Object.assign(h.style,{position:"absolute",display:"flex",flexDirection:"column",alignItems:"center",gap:"6px",zIndex:"4"});let p=o.chrome?.caption!==!1,b=o.chrome?.seatStepper!==!1;if(!p&&!b)return null;let y=i.get(m),x=y?.sectionId?n.sections.find(R=>R.id===y.sectionId):void 0,S=y?.label??m;h.setAttribute("aria-label",`Explore views near ${x?.label?`${x.label}, `:""}seat ${S}`);let A=document.createElement("span");A.textContent=o.seatViewCaption?.(m)??["Live 3D seat view",x?.label,S].filter(Boolean).join(" \xB7 "),Object.assign(A.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)"}),p&&h.appendChild(A);let M=document.createElement("div");Object.assign(M.style,{display:"flex",alignItems:"center",justifyContent:"center",gap:"6px"}),h.appendChild(M);let g=y?.rowId?r.get(y.rowId):void 0,P=g?.indexOf(m)??-1,v=P>=0?[g?.[P-1],g?.[P+1]]:[void 0,void 0],w=(R,_,F,E=!1)=>{let I=document.createElement("button");I.type="button",I.textContent=R,I.setAttribute("aria-label",_),Object.assign(I.style,{minHeight:"44px",padding:E?"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"}),E||(I.style.minWidth="44px"),E&&(I.dataset.panoramaTrigger=""),I.addEventListener("click",F),M.appendChild(I)};if(b&&v[0]){let R=i.get(v[0])?.label??v[0];w("\u2039",`View previous seat ${R}`,()=>{e.flyToSeat(v[0])})}if(b&&o.getSeatView){let R=o.seatViewActionLabel?.(m)??"Open 360\xB0 panorama";w(d?`\u21BB Retry ${R}`:`\u25C9 ${R}`,`${d?"Retry":R} from seat ${S}`,()=>{if(e.isDisposed()||f!==e.flightGen()){l();return}l(),e.openPanorama(m,400,f)},!0)}if(b&&v[1]){let R=i.get(v[1])?.label??v[1];w("\u203A",`View next seat ${R}`,()=>{e.flyToSeat(v[1])})}return!M.childElementCount&&!p?null:(t.appendChild(h),s=h,c(),h)},remove:l,layout:c}}var ix={rotate:"Drag to rotate the venue",move:"Drag to move the venue",zoomIn:"Zoom in",zoomOut:"Zoom out",fitView:"Show whole venue"};function mm(e){let{container:t,orbit:n,isNarrow:o}=e,i={...ix,...e.labels??{}},r=(M,g)=>{M.setAttribute("aria-label",g),M.title=g},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 l=document.createElement("div");l.setAttribute("role","group"),l.setAttribute("aria-label","3D view controls"),Object.assign(l.style,{display:"flex",flexDirection:"column",gap:"6px",alignItems:"flex-end"});let u=document.createElement("button");u.type="button",u.textContent="\u21BB",r(u,i.rotate);let m=document.createElement("button");m.type="button",m.textContent="\u2725",r(m,i.move);let f=document.createElement("button");f.type="button",f.textContent="\u2212",r(f,i.zoomOut);let d=document.createElement("button");d.type="button",d.textContent="+",r(d,i.zoomIn);for(let M of[u,m,f,d])M.className="sl-3d-icon-control",Object.assign(M.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,m),l.append(d,f);let h=null,p=()=>{let M=n.dragAction();if(M===h)return;h=M;let g=M==="orbit";u.setAttribute("aria-pressed",String(g)),m.setAttribute("aria-pressed",String(!g)),u.style.background=g?"rgba(96,110,150,0.68)":"rgba(12,18,32,0.82)",m.style.background=g?"rgba(12,18,32,0.82)":"rgba(96,110,150,0.68)",a.title=g?`${i.rotate} \xB7 ${i.move} with Shift`:`${i.move} \xB7 ${i.rotate} with Shift`},b=M=>{n.setPrimaryDragMode(M),p()};u.addEventListener("click",()=>b("orbit")),m.addEventListener("click",()=>b("pan"));let y=()=>{let{atMin:M,atMax:g}=n.dollyLimitState();d.disabled!==M&&(d.disabled=M),f.disabled!==g&&(f.disabled=g)};f.addEventListener("click",()=>{n.zoomBy(Pn),y()}),d.addEventListener("click",()=>{n.zoomBy(Wt),y()}),a.append(c,l),b("auto"),t.appendChild(a);let x=e.enabled!==!1,S=()=>{let M=o();a.style.display=s||!x?"none":"flex",a.style.right=M?"12px":"14px",a.style.bottom=M?"calc(env(safe-area-inset-bottom, 0px) + 76px)":"14px",c.style.display=M?"none":"flex",d.style.display=M?"none":"",f.style.display=M?"none":""};return S(),{element:a,utilityControls:l,setNavigationMode:b,syncNavigationMode:p,syncZoomLimits:y,setSeatViewLocked:M=>{s=M,n.setInteractionEnabled(!M),S()},seatViewLocked:()=>s,layout:S}}var ax=.5,fm=12,dm=20,sx=28;function cx(e,t,n){return!(e>0)||!(n>0)?0:ax*n/(2*e*Math.tan(t*Math.PI/360))}function hm(e){let{glctx:t,orbit:n,model:o,seats:i,opts:r,cinematic:a,analytics:s,seatIdByIndex:c,sectionIdBySeatId:l,tapSlop:u,tapMs:m,cancelFlight:f,focusSectionCamera:d,setSelection:h,ensureSeatView:p}=e,b=0,y=0,x=0,S=-1,A=!1,M=!1,g=E=>{e.seatViewLocked()||S===-1&&(S=E.pointerId,b=E.clientX,y=E.clientY,x=performance.now(),A=!1,M=a.active,a.active&&(s.cinematicCancelled(),f(),r.onViewTargetChange?.(null)))},P=E=>{E.pointerId===S&&Math.hypot(E.clientX-b,E.clientY-y)>u&&(A=!0)},v=(E,I,T,L,V)=>{let O=t.canvas.getBoundingClientRect(),H=t.canvas.clientWidth||O.width||1,j=t.canvas.clientHeight||O.height||1,N=E-O.left,k=I-O.top,B=L*L,D=-1,G=B,U=1/0;for(let q of i){if(T&&q.sectionId!==T)continue;let $=o.seats.idToIndex.get(q.id);if($===void 0)continue;if(V){let re=Math.round(o.seats.iState[$]??0);if(re!==0&&re!==3)continue}let ee=$*3,Q=at(n.camera.projectionViewMatrix,[o.seats.iPosition[ee],o.seats.iPosition[ee+1]+.55,o.seats.iPosition[ee+2]],H,j);if(!Q.visible)continue;let X=Q.x-N,Y=Q.y-k,K=X*X+Y*Y;(K<G||Math.abs(K-G)<1&&Q.depth<U)&&(D=$,G=K,U=Q.depth)}return D},w=(E,I)=>{let T=e.gpu(),L=e.pick();if(!T||!L)return-1;L.syncFromSeatProgram(T.seatProgram);let V=t.canvas.getBoundingClientRect(),O=t.renderer.dpr,{x:H,y:j}=bu(E,I,V,O,t.gl.drawingBufferWidth,t.gl.drawingBufferHeight),N=Math.max(2,Math.round(8*O));return L.pick(n.camera,H,j,N)},R=()=>t.canvas.clientHeight||t.canvas.getBoundingClientRect().height,_=(E,I=fm)=>{let T=n.camera?.position;if(!T)return!1;let L=E*3,V=Math.hypot(T.x-o.seats.iPosition[L],T.y-o.seats.iPosition[L+1],T.z-o.seats.iPosition[L+2]);return cx(V,n.fovY,R())>=I};return{onDown:g,onMove:P,onUp:E=>{if(E.pointerId!==S)return;let I=!A&&performance.now()-x<m;if(S=-1,M){M=!1;return}let T=e.gpu(),L=e.pick();if(!I||!T||!L)return;let V=w(E.clientX,E.clientY),O=E.pointerType==="touch"||E.pointerType==="pen",H=O?dm:fm,j=V>=0&&_(V,H),N=!1;if(e.focusedSectionId()&&V>=0){let D=c[V],G=D?l.get(D):void 0;if(G&&G!==e.focusedSectionId()&&d(G,{keepCamera:j})){if(!j)return;N=!0}}if(e.focusedSectionId()&&V<0&&(V=v(E.clientX,E.clientY,e.focusedSectionId(),44,!1)),e.focusedSectionId()&&V<0){let D=v(E.clientX,E.clientY,null,72,!1),G=D>=0?c[D]:void 0,U=G?l.get(G):void 0;if(U&&U!==e.focusedSectionId()&&d(U))return}if(!e.focusedSectionId()){V<0&&(V=v(E.clientX,E.clientY,null,42,!1));let D=V>=0?c[V]:void 0,G=D?l.get(D):void 0;if(G&&d(G,{keepCamera:j})){if(!j)return;N=!0}}if(V<0||V>=c.length){e.selection().size&&(h([]),r.onViewTargetChange?.(null));return}let k=c[V];if(O&&e.focusedSectionId()&&!N&&!_(V,dm)){e.focusSeatCamera(k,{seatPx:sx,viewportHeightPx:R()});return}let B=_e[Math.round(o.seats.iState[V]??0)]??"available";if(B!=="available"&&B!=="selected"){r.onSeatInspect?.(k,B);return}if(e.selection().has(k)&&e.selection().size===1){h([]),r.onViewTargetChange?.(null),r.onSeatPick?.(k);return}h([k]),p(k),s.seatPicked(k,l.get(k)),r.onSeatPick?.(k)}}}var tr=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,o=1/0,i=-1/0,r=-1/0;for(let d=0;d<this.count;d++){let h=t[d*3],p=t[d*3+2];h<n&&(n=h),h>i&&(i=h),p<o&&(o=p),p>r&&(r=p)}let a=Math.max(i-n,.001),s=Math.max(r-o,.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=o;let c=this.cols*this.rows,l=new Int32Array(c+1),u=d=>{let h=Math.min(this.cols-1,Math.max(0,Math.floor((t[d*3]-n)/this.cell)));return Math.min(this.rows-1,Math.max(0,Math.floor((t[d*3+2]-o)/this.cell)))*this.cols+h};for(let d=0;d<this.count;d++)l[u(d)+1]++;for(let d=0;d<c;d++)l[d+1]+=l[d];let m=new Int32Array(this.count),f=l.slice(0,c);for(let d=0;d<this.count;d++)m[f[u(d)]++]=d;this.cellStart=l,this.cellItems=m}gather(t,n,o,i,r){this.ensureGrid();let a=this.cellStart,s=this.cellItems;if(!a||!s)return 0;let c=i.length,l=o*o,u=Math.floor((t-this.minX)/this.cell),m=Math.floor((n-this.minZ)/this.cell),f=Math.ceil(o/this.cell)+1,d=this.iPosition,h=0;for(let p=0;p<=f&&h<c;p++){let b=m-p,y=m+p,x=u-p,S=u+p;for(let A=b;A<=y&&h<c;A++){if(A<0||A>=this.rows)continue;let M=A===b||A===y;for(let g=x;g<=S&&h<c;g++){if(!M&&g!==x&&g!==S){g=S-1;continue}if(g<0||g>=this.cols)continue;let P=A*this.cols+g;for(let v=a[P],w=a[P+1];v<w&&h<c;v++){let R=s[v],_=d[R*3]-t,F=d[R*3+2]-n,E=r===void 0?0:d[R*3+1]-r;_*_+E*E+F*F<=l&&(i[h++]=R)}}}}return h}};var nr=class{constructor(t){this.ctx=t;this.detailVisible=!1;this.seatDetailMix=0;this.structureDetailMix=0;this.nearBuf=new Int32Array(io);this.lastGatherX=1/0;this.lastGatherZ=1/0;this.lastGatherY=1/0;this.nearIndex=new tr(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,o=this.ctx.gpu();if(!o)return;if(!t){o.nearSeatCount()&&o.setNearSeats(this.nearBuf,0);return}let i=this.ctx.orbit().camera.position;if(Math.hypot(i.x-this.lastGatherX,i.y-this.lastGatherY,i.z-this.lastGatherZ)<Pr)return;if(this.lastGatherX=i.x,this.lastGatherY=i.y,this.lastGatherZ=i.z,Math.hypot(i.x-n.bounds.center[0],i.y-n.bounds.center[1],i.z-n.bounds.center[2])-n.bounds.radius>wr){o.nearSeatCount()&&o.setNearSeats(this.nearBuf,0);return}let s=this.nearIndex.gather(i.x,i.z,wr,this.nearBuf,i.y);s===0&&o.nearSeatCount()===0||o.setNearSeats(this.nearBuf,s)}ease(t,n,o){let i=1-Math.exp(-t*9),r=1-Math.exp(-t*20);this.seatDetailMix+=(n-this.seatDetailMix)*(n>this.seatDetailMix?i:r),this.structureDetailMix+=(o-this.structureDetailMix)*(o>this.structureDetailMix?i:r),Math.abs(n-this.seatDetailMix)<.01&&(this.seatDetailMix=n),Math.abs(o-this.structureDetailMix)<.01&&(this.structureDetailMix=o)}};function pm(e){let t=Math.max(5,e.radius),n=e.focalWorld[0]-e.center[0],o=e.focalWorld[2]-e.center[2],i=Math.hypot(n,o);if(i<t*.12)return{center:e.center,radius:t,polarDeg:48};let r=Math.min(i*.25,t*.2);return{center:[e.center[0]+n/i*r,e.center[1],e.center[2]+o/i*r],radius:t+r,polarDeg:50}}var or=require("ogl");function bm(){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 ym(e){let{container:t,model:n,opts:o,orbit:i,cinematic:r,analytics:a,loop:s,labelOverlay:c,stageAzimuth:l,overviewFraming:u}=e,m=0,f=-1,d=(R,_,F=28)=>{i.camera.position.set(R[0],R[1],R[2]),i.camera.lookAt(new or.Vec3(_[0],_[1],_[2])),i.camera.fov=F,i.camera.updateProjectionMatrix()},h=document.createElement("button");h.className="sl-3d-overview-control sl-3d-icon-control",h.type="button",h.replaceChildren(bm());let p=o.navLabels?.fitView??"Show whole venue";h.setAttribute("aria-label",p),h.title=p,Object.assign(h.style,{width:"44px",minWidth:"44px",minHeight:"44px",padding:"9px",borderRadius:"999px",background:"rgba(12,18,32,0.72)",color:"#c9d4ea",border:"1px solid rgba(150,165,205,0.35)",backdropFilter:"blur(6px)",font:"600 11px/1 inherit",cursor:"pointer",whiteSpace:"nowrap"});let b=()=>{h.firstElementChild||h.replaceChildren(bm())};b();let y=R=>{f=R;let _=e.gpu();_&&(_.seatProgram.uniforms.uFocusFloor.value=R,_.solidProgram.uniforms.uFocusFloor.value=R,_.chairProgram.uniforms.uFocusFloor.value=R),e.showSectionSeatLabels(null)},x=null,S=!1,A=()=>{if(x=null,S=!1,e.setSeeThrough?.(null),e.isDisposed())return;o.onViewTargetChange?.(null),o.onSectionFocusChange?.(null),e.panorama()&&(e.panorama().dispose(),e.setPanorama(null),a.panoramaClosed()),e.setPanoramaSphereVisible(!1),e.panoramaLoadAbort()?.abort(),e.setPanoramaLoadAbort(null),e.restorePanoramaLayer(),h.style.display="",c.setVisible(!0),e.setFrozen(!1);let R=f>=0?n.floors[f]:null;if(e.setNearFieldDetailEnabled(!!R),e.setSeatViewLocked(!1),M(),e.removeArriveChip(),e.setNavigationMode("auto"),R){let _=R.focalWorld[0]-R.center[0],F=R.focalWorld[2]-R.center[2],E=Math.hypot(_,F)>R.radius*.12?Math.atan2(_,F):l,I={center:R.center,radius:R.radius,box:R.box},T={polarDeg:58,margin:1.12};e.reducedMotion()?i.frame(I,!1,E,!1,T):i.frameSoft(I,E,!1,T)}else e.reducedMotion()?i.frame(n.bounds,!1,l,o.portraitOverviewCrop===!0,u):i.frameSoft(n.bounds,l,o.portraitOverviewCrop===!0,u);c.setOverviewDistance(i.targetDistance),e.showSectionSeatLabels(null),s.requestRender()},M=()=>{m++,e.setSeatStepping(!1),e.panoramaLoadAbort()?.abort(),e.setPanoramaLoadAbort(null),r.active&&(r.cancel(),i.resumeAfterFlight(n.focalWorld))},g=R=>{if(e.isDisposed()||!e.gpu())return Promise.resolve();let _=n.seats.idToIndex.get(R);if(_===void 0)return Promise.resolve();e.setNearFieldDetailEnabled(!0),o.onViewTargetChange?.(R),e.panorama()&&(e.panorama().dispose(),e.setPanorama(null),e.setPanoramaSphereVisible(!1),h.style.display="",e.restorePanoramaLayer()),e.panoramaLoadAbort()?.abort(),e.setPanoramaLoadAbort(null),e.setFrozen(!1);let F=e.inSeatView()&&o.arriveAtSeatEye===!0;e.setSeatStepping(F),e.setSeatViewLocked(!1);let E=++m;F?e.showArriveChip(R,E):e.removeArriveChip();let{eye:I,focal:T}=e.resolvedSeatViewPose(R,_),L=o.arriveAtSeatEye?e.seatViewArrival(R,_):null,V=L&&L.stops.length>1&&L.stops[1].name==="row"?L.stops[1]:null,O=L?L.focal:T,H=[i.camera.position.x,i.camera.position.y,i.camera.position.z],j=_i(H,L?.eye??I,O,n.bounds.center,n.bounds.radius),N=V?V.eye:L?L.eye:o.arriveAtSeatEye?I:j.finalPos,k=L?L.fov:o.arriveAtSeatEye?t.clientWidth/Math.max(1,t.clientHeight)<.7?Wo:65:28,B=[j.waypoints[0],j.waypoints[1],N];if(c.setVisible(!1),e.reducedMotion())return e.setSeatStepping(!1),d(N,O,k),s.requestRender(),a.cinematicSkipped(),e.isDisposed()||i.syncFromCamera(),e.setSeatViewLocked(o.arriveAtSeatEye===!0),L&&e.enterSeatView(L.stops),e.showArriveChip(R,E),Promise.resolve();let D=new or.Quat().copy(i.camera.quaternion),G=Au(i.camera,N,O);s.requestRender();let U=F?700:2500;return r.start(B,D,G,U,k).then(()=>{e.isDisposed()||E!==m||(e.setSeatStepping(!1),a.cinematicPlayed(U),i.resumeAfterFlight(O),e.setSeatViewLocked(o.arriveAtSeatEye===!0),L&&e.enterSeatView(L.stops,V?1:0),s.requestRender(),e.showArriveChip(R,E))})},P=(R,_)=>{let F=n.sections.find(E=>E.id===R);if(!F||F.seatCount===0)return!1;if(x=R,S=!1,e.setSeeThrough?.(null),e.setNearFieldDetailEnabled(!0),e.setSeatStepping(!1),e.setSeatViewLocked(!1),r.cancel(),e.removeArriveChip(),n.floors.length>1&&f!==F.floorIndex&&y(F.floorIndex),e.setNavigationMode("auto"),e.panorama()||c.setVisible(!0),e.showSectionSeatLabels(R),!_?.keepCamera){let E=pm(F),I={polarDeg:E.polarDeg,margin:1.12};e.reducedMotion()?i.frame({center:E.center,radius:E.radius},!1,i.currentAzimuth,!1,I):i.glideTo({center:E.center,radius:E.radius},I)}return o.onSectionFocusChange?.(R),s.requestRender(),!0},v=(R,_)=>{if(e.isDisposed()||!e.gpu())return!1;let F=n.seats.idToIndex.get(R);if(F===void 0)return!1;let E=F*3,I=[n.seats.iPosition[E],n.seats.iPosition[E+1]+.55,n.seats.iPosition[E+2]],T=_?lx(_,i.fovY,i.camera.aspect||1):gm;return S=!0,e.setSeeThrough?.(I),e.reducedMotion()?i.frame({center:I,radius:T},!1,void 0,!1,Vi):i.frameSoft({center:I,radius:T},void 0,!1,Vi),s.requestRender(),!0},w=()=>{if(e.isNarrow?.()&&S&&x&&P(x)){s.requestRender();return}A()};return h.addEventListener("click",w),{overviewChip:h,layoutOverviewChip:b,flightGen:()=>m,focusedFloor:()=>f,applyFloorFocus:y,placeCameraFinal:d,cancelFlight:M,focusOverview:A,flyToSeat:g,focusSectionCamera:P,focusSeatCamera:v}}var gm=4.5;function lx(e,t,n){let o=Math.tan(t*Math.PI/360),i=o*Math.max(.001,n),a=ux*e.viewportHeightPx/(2*Math.max(1,e.seatPx)*o)*Math.min(o,i)/Vi.margin;return Math.max(mx,Math.min(gm,a))}var ux=.5,mx=1.5,Vi={polarDeg:48,margin:1.25};function Zn(e,t){let{doc:n,report:o}=Bo(e),i=o.confident&&(o.sections.length>0||!!o.looseRowBlocks);if(!i&&!o.roles?.length)return null;if(!i){let c=new Map(o.roles.map(d=>[d.id,d.role])),l=d=>d.map(h=>h.type==="shape"&&c.has(h.id)?{...h,role:c.get(h.id)}:h),u=e.floors?.map(d=>({...d,objects:l(d.objects)})),m=new Float64Array(t.length).fill(Number.NaN),f=new Float64Array(t.length*2).fill(Number.NaN);return t.forEach((d,h)=>{d.eyeHeightM!==void 0&&(m[h]=d.eyeHeightM),d.focalPoint&&(f[h*2]=d.focalPoint.x,f[h*2+1]=d.focalPoint.y)}),{doc:{...e,objects:u?.[0]?.objects??l(e.objects),...u?{floors:u}:{}},report:o,eyeHeightM:m,focal:f}}let r=new Map(Zt(n).map(c=>[c.id,c])),a=new Float64Array(t.length).fill(Number.NaN),s=new Float64Array(t.length*2).fill(Number.NaN);return t.forEach((c,l)=>{let u=r.get(c.id)??c;u.eyeHeightM!==void 0&&(a[l]=u.eyeHeightM),u.focalPoint&&(s[l*2]=u.focalPoint.x,s[l*2+1]=u.focalPoint.y)}),{doc:n,report:o,eyeHeightM:a,focal:s}}function Gi(e,t){return e.map((n,o)=>{let i=t.eyeHeightM[o],r=t.focal[o*2],a=t.focal[o*2+1],s={...n};return Number.isNaN(i)?delete s.eyeHeightM:s.eyeHeightM=i,Number.isNaN(r)?delete s.focalPoint:s.focalPoint={x:r,y:a},s})}function xm(e){let t=e.estimate===!1?null:Zn(e.doc,e.seats);return t?{input:{...e,doc:t.doc,seats:Gi(e.seats,t)},estimate:t}:{input:e}}function Hi(e,t,n,o,i,r,a,s,c=.5){let l=-1,u=s*s,m=1/0;for(let f=0;f<t;f++){let d=f*3,h=at(n,[e[d],e[d+1]+c,e[d+2]],o,i);if(!h.visible)continue;let p=h.x-r,b=h.y-a,y=p*p+b*b;(y<u-4||y<u+4&&h.depth<m)&&(l=f,u=Math.min(u,y),m=h.depth)}return l}var dx={};function vm(e){let t=performance.now(),{input:n,estimate:o}=xm(e);return{model:sn(n),buildMs:performance.now()-t,source:"main",...o?{estimate:o}:{}}}function fx(e){let t=Zt(e.doc);return{...vm({...e,seats:t}),seats:t}}function Mm(e,t,n){if(typeof Worker>"u")return Promise.resolve(t());let o;try{o=new Worker(new URL("./scene/scene.worker.js",dx.url),{type:"module"})}catch{return Promise.resolve(t())}return new Promise(i=>{let r=!1,a=l=>{r||(r=!0,clearTimeout(c),o.terminate(),i(l))},s=()=>a(t()),c=window.setTimeout(s,15e3);o.onerror=s,o.onmessage=l=>{let u=n(l.data);u?a(u):s()},o.postMessage(e)})}function Sm(e){return Mm(e,()=>vm(e),({model:t,buildMs:n,estimate:o})=>({model:t,buildMs:n,source:"worker",...o?{estimate:o}:{}}))}function wm(e){return Mm(e,()=>fx(e),({model:t,buildMs:n,seats:o,estimate:i})=>o?{model:t,buildMs:n,seats:o,source:"worker",...i?{estimate:i}:{}}:null)}var hx=40,px=48,bx=Math.PI/180,yx=6,gx=500,xx=6;function vx(e,t,n={}){let o=performance.now(),i=t.prepared?t.prepared.estimate:t.estimate===!1?null:Zn(t.doc,t.seats);i&&(t={...t,doc:i.doc,seats:Gi(t.seats,i)});let r=t.prepared?.model??sn(t),a=new er(n.onAnalytics),s=new Array(r.seats.count);for(let[z,W]of r.seats.idToIndex)s[W]=z;let c=new Map(t.seats.map(z=>[z.id,z])),l=new Map;for(let z of t.seats){if(!z.rowId)continue;let W=l.get(z.rowId);W?W.push(z.id):l.set(z.rowId,[z.id])}let u=new Map,m=[0,0,0,0];function f(){if(b)for(let z of[b.seatProgram,b.solidProgram,b.chairProgram])z.uniforms.uSeeThrough.value=m}t.seats.forEach((z,W)=>{u.set(z.id,r.seatSectionIds?.[W]??z.sectionId)});let d=new Map;for(let[z,W]of r.seats.idToIndex){let Z=u.get(z);if(!Z)continue;let ce=d.get(Z);ce?ce.push(W):d.set(Z,[W])}let h=()=>{if(!b||!r.sectionSolidRanges.length)return;let{lit:z,anyUnlit:W}=uu(r.sectionSolidRanges,d,r.seats.iState);b.setSectionShellLit(W?z:null)},p=t.doc.floors?.some(W=>(W.baseHeightM??0)>0)?!0:(t.doc.floors?.flatMap(W=>W.objects)??t.doc.objects).some(W=>W.type==="section"&&((W.height??0)>0||(W.rake??0)>0)),b=null,y=null,x=null,S=!1,A=!1,M=!1,g=new Map,P=null,v=null,w=null,R=new Map,_=null,F=()=>{w===null&&(w=e.style.zIndex,e.style.zIndex="20")},E=()=>{w!==null&&(e.style.zIndex==="20"&&(e.style.zIndex=w),w=null)},I=!1,T=()=>I?Fe.focusedFloor():-1,L=()=>{b=hu(B.gl,r),y?.dispose(),y=Gl(B.gl,[1,1,1],r.theme.seatStates.selected),Wi(!1),h(),te(),x=new Uo(B.renderer,b.seatGeometry,b.chairGeometry,b.solidGeometry,r.seats.count),B.setClearColor(r.theme.background.top),x.setRestoreClear(r.theme.background.top),x.setRoomCentre(r.room?.centre),b.seatProgram.uniforms.uSeatRadius.value=ut*r.theme.seatScale,b.seatProgram.uniforms.uFocusFloor.value=T(),b.solidProgram.uniforms.uFocusFloor.value=T(),b.chairProgram.uniforms.uFocusFloor.value=T(),b.screenProgram&&(b.screenProgram.uniforms.uFocusFloor.value=T()),f(),O.forceRegather()},V=!1,O=new nr({model:r,orbit:()=>D,gpu:()=>b}),H=!1,j=new Map,N=24,k=z=>O.setDetailEnabled(z),B=new no(e,{onContextLost:()=>{M||a.contextLost(),S=!0,we.stop(),b=null,x=null},onContextRestored:()=>{L(),S=!1,M||a.contextRestored(),we.requestRender()}}),D=new oo(B.gl,B.canvas,()=>we.requestRender(),()=>a.orbitEngaged());D.setAspect(B.aspect);let G=(t.doc.floors?.flatMap(z=>z.objects)??t.doc.objects).some(z=>z.type==="section"&&z.physical3dProvenance?.surfaceKind?.status==="inferred"),U=(()=>{if(Number.isFinite(n.overviewAzimuthDeg))return n.overviewAzimuthDeg*Math.PI/180;if(!(G&&r.stages.length===0))return ia(r.focalWorld,r.seats.iPosition,r.bounds)})(),q=(t.doc.floors?.flatMap(z=>z.objects)??t.doc.objects).some(z=>z.type==="shape"&&z.stageKind?.startsWith("pitch-")),$=r.floors.length>1?{polarDeg:48,margin:1.1}:{polarDeg:q?36:48,margin:1.05},ee=typeof window<"u"&&!!window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches;D.frame(r.bounds,!ee&&n.skipInitialOverviewAnimation!==!0,U,n.portraitOverviewCrop===!0,$);let Q=new jo(D.camera),X=lm(e),Y=aa(e,r),K=new Go(e,{fontFamily:t.doc.theme?.fontFamily,ink:t.doc.theme?.textColor,backgroundRgb:r.theme.background.top}),re=r.labels,ne=()=>rl(re,r.floors.length,T());K.setLabels(ne()),K.setOverviewDistance(D.targetDistance);let se=()=>{let z=new Map,W=_e.indexOf("available");for(let Z of re){if(!Z.wheelchairSeats)continue;let ce=0;for(let me of Z.wheelchairSeats)r.seats.iState[me]===W&&ce++;ce>0&&z.set(Z.id,ce)}return K.setWheelchairFree(z)};se();let J=null,ie=()=>[...g.keys()].flatMap(z=>{let W=r.seats.idToIndex.get(z),Z=W===void 0?void 0:t.seats[W];if(W===void 0||Z?.id!==z)return[];let ce=W*3;return[{id:`seat:${z}`,kind:"seat",seatWidthM:r.seats.iChairWidth[W]*2,text:Z.displayLabel||Z.label,anchor:[r.seats.iPosition[ce],r.seats.iPosition[ce+1]+1.05,r.seats.iPosition[ce+2]],pinBase:rr(ce)}]}),Pe=-1,te=()=>{b&&(Pe=J?r.sections.findIndex(z=>z.id===J):-1,b.seatProgram.uniforms.uFocusSection.value=Pe,b.chairProgram.uniforms.uFocusSection.value=Pe)},xe=z=>{if(J=z,te(),K.setForcedDense(!!z),!z){let oe=ie(),Re=new Set(oe.map(Ie=>Ie.id));K.setLabels([...ne().filter(Ie=>!Re.has(Ie.id)),...oe]);return}let W=t.seats.filter(oe=>u.get(oe.id)===z),Z=new Set(W.map(oe=>oe.id)),ce=new Set(W.map(oe=>oe.rowId)),me=new Set(g.keys()),pe=new Set(W.filter(oe=>me.has(oe.id)).map(oe=>oe.id)),ye=ne().filter(oe=>oe.kind!=="row"&&oe.kind!=="seat"&&oe.kind!=="access"||oe.kind==="access"&&Z.has(oe.id.slice(7))||(oe.kind==="row"?ce.has(oe.id.slice(4)):Z.has(oe.id.slice(5))));if(r.seatCount<=6e3&&pe.size===0){K.setLabels(ye);return}let Ae=W,ke=new Set(Ae.map(oe=>`seat:${oe.id}`)),Be=Ae.flatMap(oe=>{let Re=r.seats.idToIndex.get(oe.id);if(Re===void 0)return[];let Ie=Re*3;return[{id:`seat:${oe.id}`,kind:"seat",seatWidthM:r.seats.iChairWidth[Re]*2,rowId:oe.rowId,text:me.has(oe.id)?oe.displayLabel||oe.label:gi(oe.displayLabel||oe.label),anchor:[r.seats.iPosition[Ie],r.seats.iPosition[Ie+1]+(me.has(oe.id)?1.05:.55),r.seats.iPosition[Ie+2]],...me.has(oe.id)?{pinBase:rr(Ie)}:{}}]});K.setLabels([...ye.filter(oe=>!ke.has(oe.id)),...Be])};L();let ve=null,Ye=null,et=new Pm.Mat4,Ne=z=>{if(S||!b||A)return!1;let W=Ku({flying:Q.active,panoramaMounted:P!==null,seatViewActive:ve?.active===!0}),Z=W==="orbit"?Pe:-1;b.seatProgram.uniforms.uFocusSection.value=Z,b.chairProgram.uniforms.uFocusSection.value=Z;let ce=H?!1:W==="cinematic"?Q.update(performance.now()):W==="seatView"?ve.update(performance.now()):W==="orbit"?D.update():!1;Ye?.syncZoomLimits(),Ye?.syncNavigationMode();let me=T()>=0?r.floors[T()]:null,pe=me?.radius??r.bounds.radius,ye=La(D.currentDistance,pe),Ae=V?{center:[D.camera.position.x,D.camera.position.y,D.camera.position.z],radius:520}:r.clipBounds??r.renderBounds;D.updateClipping(Ae);let ke=me?.center??r.renderBounds.center,Be=me?.radius??r.renderBounds.radius,oe=(Ee,hr)=>Math.hypot(D.camera.position.x-Ee[0],D.camera.position.y-Ee[1],D.camera.position.z-Ee[2])<=hr*(O.detailVisible?1.8:1.55),Re=oe(ke,Be);if(!Re&&J){let Ee=r.sections.find(hr=>hr.id===J);Ee&&(Re=oe(Ee.center,Math.max(12,Ee.radius*2)))}O.detailVisible=Re;let Ie=b.seatProgram.uniforms;Ie.uSeatScale.value=ye.scale,Ie.uSeatFade.value=ye.fade;let $e=!!me&&Oa(me.seatCount,B.canvas.clientWidth||1,B.canvas.clientHeight||1),kt=Fa(r.seats.count,pe,D.currentDistance,D.camera.fov,B.canvas.clientHeight||1),bn=O.detailVisible||$e||kt?1:0,yn=O.detailVisible||T()>=0||r.floors.length>1?1:0;O.ease(z,bn,yn),Ie.uSeatDetail.value=O.seatDetailMix;let eo=bn===0&&O.seatDetailMix<.01;b.seatGeometry.setDrawRange(eo?yr:0,eo?da:yr),b.solidProgram.uniforms.uStructureDetail.value=O.structureDetailMix,Ie.uMinPixels.value=ye.minPixels,Ie.uPixelToWorld.value=2*Math.tan(D.camera.fov*bx/2)/Math.max(1,B.pixelHeight),O.update(O.detailVisible),r.outdoor&&(et.copy(D.camera.projectionViewMatrix).inverse(),b.backgroundProgram.uniforms.uInvViewProj.value.set(et)),B.renderer.render({scene:b.background,clear:!0}),B.renderer.render({scene:b.main,camera:D.camera,clear:!1});let gn=y?y.update(performance.now(),[D.camera.position.x,D.camera.position.y,D.camera.position.z],P!==null,W==="seatView"):!1;if(y&&B.renderer.render({scene:y.root,camera:D.camera,clear:!1}),Y){let Ee=D.camera.worldMatrix;Y.update(W==="seatView"?[D.camera.position.x,D.camera.position.y,D.camera.position.z]:null,[-Ee[8],-Ee[9],-Ee[10]])}K.update(D.camera.projectionViewMatrix,B.canvas.clientWidth||1,B.canvas.clientHeight||1,D.currentDistance,pe,[D.camera.position.x,D.camera.position.y,D.camera.position.z]);let zt=ce||gn||O.seatDetailMix!==bn||O.structureDetailMix!==yn;return Ke(!zt),zt},Ke=Ra(e),we=new ro(Ne),Ct=typeof ResizeObserver<"u"?new ResizeObserver(()=>dr.resize()):null;Ct?.observe(e),D.setZoomPointResolver((z,W)=>{let Z=B.canvas.getBoundingClientRect(),ce=B.canvas.clientWidth||Z.width,me=B.canvas.clientHeight||Z.height;if(!(ce>0)||!(me>0))return null;D.camera.updateMatrixWorld();let pe=Hi(r.seats.iPosition,r.seats.count,D.camera.projectionViewMatrix,ce,me,z-Z.left,W-Z.top,hx);if(pe<0)return null;let ye=pe*3;return[r.seats.iPosition[ye],r.seats.iPosition[ye+1]+.5,r.seats.iPosition[ye+2]]});function rr(z){return[r.seats.iPosition[z],r.seats.iPosition[z+1]+.5,r.seats.iPosition[z+2]]}K.setSeatNumberRow(null);let tt=null,_t=0,ir=null,zi=()=>{_t=0;let z=null,W=null;if(tt&&!ve?.active&&!Q.active){let me=B.canvas.getBoundingClientRect(),pe=B.canvas.clientWidth||me.width,ye=B.canvas.clientHeight||me.height;if(pe>0&&ye>0){let Ae=Hi(r.seats.iPosition,r.seats.count,D.camera.projectionViewMatrix,pe,ye,tt.x-me.left,tt.y-me.top,px);z=Ae>=0?t.seats[Ae]?.rowId??null:null;let ke=Ae>=0?t.seats[Ae]?.id??null:null;if(W=ke,tt.mouse&&!tt.pressing&&!!J&&!!ke&&u.get(ke)===J){let oe=e.getBoundingClientRect();ir=ke,n.onSeatHover?.(ke,{x:tt.x-oe.left,y:tt.y-oe.top})}else Ui()}}else Ui();let Z=tt?.mouse?W:null,ce=K.setSeatNumberSeat(Z);(K.setSeatNumberRow(z)||ce)&&we.requestRender()};function Ui(){ir!==null&&(ir=null,n.onSeatHover?.(null,null))}let Qn=z=>{tt={x:z.clientX,y:z.clientY,mouse:z.pointerType==="mouse",pressing:z.type==="pointerdown"},_t||(_t=requestAnimationFrame(zi))},ji=z=>{z.pointerType==="mouse"&&(tt=null,_t||(_t=requestAnimationFrame(zi)))};B.canvas.addEventListener("pointermove",Qn),B.canvas.addEventListener("pointerdown",Qn),B.canvas.addEventListener("pointerleave",ji);function Wi(z){if(!y)return;let W=[];for(let Z of g.keys()){let ce=r.seats.idToIndex.get(Z);if(ce===void 0)continue;let me=ce*3,pe=rr(me),ye=Math.atan2(r.focalWorld[0]-pe[0],r.focalWorld[2]-pe[2]);W.push({id:Z,position:pe,facing:ye})}y.setSeats(W,performance.now(),z)}let Xi=z=>{let W=me=>{let pe=r.seats.idToIndex.get(me);return pe===void 0?void 0:r.seats.iState[pe]},{updates:Z,next:ce}=gu(g,z,W);if(g=ce,K.setSelectedSeatIds(g.keys()),Wi(!dn()),we.requestRender(),xe(J),Z.length){let me=_r(r.seats,Z);b&&b.uploadSeatStateRuns(me),h(),we.requestRender()}},dn=()=>_!==null?_:typeof window<"u"&&!!window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,Am=8,Yi=z=>{if(!n.getSeatView)return null;let W=R.get(z);if(!W)for(W=Promise.resolve(n.getSeatView(z)),R.set(z,W),W.catch(()=>{R.get(z)===W&&R.delete(z)});R.size>Am;){let Z=R.keys().next().value;if(Z===void 0)break;R.delete(Z)}return W},Ki=Vu(r.stages,r.focalWorld,r.bounds.groundY??0),$i=Li(Ki),ar=(z,W)=>{let Z=c.get(z),ce=Math.max(0,Math.round(r.seats.iFloor[W]??0)),me=t.doc.floors?.[ce],pe=r.floors[ce],ye=me?.focalPoint??t.doc.focalPoint,Ae=pe?{x:pe.focalWorld[0]/C,y:pe.focalWorld[2]/C}:ye,ke=Z?.focalPoint?{x:Z.focalPoint.x+Ae.x-ye.x,y:Z.focalPoint.y+Ae.y-ye.y}:Ae,Be=[r.seats.iPosition[W*3],r.seats.iPosition[W*3+1],r.seats.iPosition[W*3+2]],oe=Eu(r.seats.iPosition,W,$i),Re=oe!==null&&Math.abs(oe)<Ru;return Cu(Be,ke,me?.baseHeightM??0,Z?.eyeHeightM,$i,Re)},sr=()=>(e.clientWidth||B.canvas.clientWidth)<=520,cr=null,qi=null,Im=async(z,W,Z)=>{if(!n.getSeatView||M||Z!==Fe.flightGen())return;let ce;try{ce=await sm()}catch{if(a.panoramaFailed(z,"mount"),!M&&Z===Fe.flightGen()){let me=ur(z,Z,!0);requestAnimationFrame(()=>me?.querySelector("[data-panorama-trigger]")?.focus())}return}if(!(M||Z!==Fe.flightGen()||!cr))return qi??=ce.createOpenPanorama(cr),qi(z,W,Z)},lr=um({container:e,model:r,opts:n,expandedSeatById:c,seatIdsByRow:l,isNarrow:sr,isDisposed:()=>M,flightGen:()=>Fe.flightGen(),flyToSeat:z=>ta(z),openPanorama:(z,W,Z)=>Im(z,W,Z)}),ur=lr.show,mr=lr.remove,Rm=lr.layout,Tt=mm({container:e,orbit:D,isNarrow:sr,enabled:n.chrome?.controlDock!==!1,...n.navLabels?{labels:n.navLabels}:{}});Ye=Tt;let Em=Tt.element,hn=Tt.setNavigationMode,Cm=Tt.layout,_m=Tt.utilityControls,pn=null,Zi=!1,Jn=z=>{Tt.setSeatViewLocked(z),z||ve?.exit()};ve=Yu({canvas:B.canvas,camera:D.camera,requestRender:()=>we.requestRender(),reducedMotion:dn,onStopChange:z=>{let W=z??(Zi?"seat":null);pn=W;try{n.onSeatViewStopChange?.(W)}catch{}},onApplied:()=>{M||D.syncFromCamera()}});let Qi=r.sections.reduce((z,W)=>W.seatCount>0&&W.box?Math.max(z,W.box.max[1]):z,-1/0),Ji=(z,W)=>{let{eye:Z}=ar(z,W),ce=(e.clientWidth||B.canvas.clientWidth||1)/Math.max(1,e.clientHeight||B.canvas.clientHeight||1),me=Hu(Z,Ki,ce,{preserveEye:!0});if(n.seatViewStops===!1)return{...me,stops:[]};let pe=u.get(z),ye=pe?r.sections.find(Ae=>Ae.id===pe):void 0;return{...me,stops:zu(me,{aspect:ce,seatingTopY:Number.isFinite(Qi)?Qi:r.bounds.box.max[1],section:ye&&ye.seatCount>0?{center:ye.center,radius:ye.radius}:null,venue:{center:r.bounds.center,radius:r.bounds.radius}})}},Fe=ym({isNarrow:sr,setSeeThrough:z=>{m=z?[z[0],z[1],z[2],xx]:[0,0,0,0],f(),we.requestRender()},container:e,model:r,opts:n,orbit:D,cinematic:Q,analytics:a,loop:we,labelOverlay:K,stageAzimuth:U,overviewFraming:$,gpu:()=>b,isDisposed:()=>M,panorama:()=>P,setPanorama:z=>{P=z},setPanoramaSphereVisible:z=>{V=z},panoramaLoadAbort:()=>v,setPanoramaLoadAbort:z=>{v=z},setFrozen:z=>{A=z},restorePanoramaLayer:E,reducedMotion:dn,resolvedSeatViewPose:ar,showSectionSeatLabels:xe,setNearFieldDetailEnabled:k,setSeatViewLocked:Jn,setNavigationMode:hn,showArriveChip:ur,removeArriveChip:mr,inSeatView:()=>pn!==null,setSeatStepping:z=>{Zi=z},seatViewArrival:(z,W)=>n.arriveAtSeatEye?Ji(z,W):null,enterSeatView:(z,W)=>ve?.enter(z,W)});I=!0;let fr=Fe.overviewChip,Tm=Fe.layoutOverviewChip,km=Fe.applyFloorFocus,Lm=Fe.focusOverview,ea=Fe.cancelFlight,ta=Fe.flyToSeat,na=Fe.focusSectionCamera;_m.appendChild(fr),cr={container:e,model:r,opts:n,analytics:a,orbit:D,loop:we,seatsById:c,ensureSeatView:Yi,resolvedSeatViewPose:ar,gpu:()=>b,gl:B.gl,isContextLost:()=>S,isDisposed:()=>M,flightGen:()=>Fe.flightGen(),setPanorama:z=>{P=z},getLoadAbort:()=>v,setLoadAbort:z=>{v=z},setPanoramaSphereVisible:z=>{V=z,z&&ve?.exit()},setFrozen:z=>{A=z},raisePanoramaLayer:F,restorePanoramaLayer:E,getOverviewChip:()=>fr,labelOverlay:K,reducedMotion:dn,removeArriveChip:mr,showArriveChip:ur};let pt=hm({glctx:B,orbit:D,model:r,seats:t.seats,opts:n,cinematic:Q,analytics:a,seatIdByIndex:s,sectionIdBySeatId:u,tapSlop:yx,tapMs:gx,gpu:()=>b,pick:()=>x,seatViewLocked:()=>Tt.seatViewLocked(),focusedSectionId:()=>J,selection:()=>g,cancelFlight:ea,focusSectionCamera:na,focusSeatCamera:Fe.focusSeatCamera,setSelection:Xi,ensureSeatView:Yi});B.canvas.addEventListener("pointerdown",pt.onDown),B.canvas.addEventListener("pointermove",pt.onMove),B.canvas.addEventListener("pointerup",pt.onUp),B.canvas.addEventListener("pointercancel",pt.onUp),we.requestRender();let dr={setAvailability(z){let W=yu(g,z),Z=_r(r.seats,W);Z.length&&b&&b.uploadSeatStateRuns(Z),h(),Z.length&&se(),we.requestRender()},setSelection:Xi,setNavigationMode:hn,zoomIn(){D.zoomBy(Wt),we.requestRender()},zoomOut(){D.zoomBy(Pn),we.requestRender()},flyToSeat:ta,focusOverview:Lm,seatViewStop:()=>pn,recentreSeatView:()=>ve?.recentre()??!1,resize(){let{width:z,height:W}=B.resize();D.setAspect(z/Math.max(1,W)),Rm(),Cm(),Tm(),we.requestRender()},stats(){return{...we.stats(),drawCalls:b?b.drawCalls:0,fallbackTriangles:b?b.seatGeometry.drawRange.count/3*r.seats.count:0,seatCount:r.seatCount}},captureImage(z=1280){if(S||!b||typeof document>"u")return null;Ne(0);let W=B.canvas,Z=Math.min(1,z/Math.max(W.width,W.height,1)),ce=document.createElement("canvas");ce.width=Math.max(1,Math.round(W.width*Z)),ce.height=Math.max(1,Math.round(W.height*Z));let me=ce.getContext("2d");return me?(me.drawImage(W,0,0,ce.width,ce.height),ce.toDataURL("image/jpeg",.82)):null},captureSeatView(z,W=480){if(S||!b||A||typeof document>"u"||Q.active||P!==null||ve?.active)return null;let Z=j.get(z);if(Z)return Z;let ce=r.seats.idToIndex.get(z);if(ce===void 0)return null;let{eye:me,focal:pe,fov:ye}=Ji(z,ce),Ae=D.snapshot(),ke=[O.seatDetailMix,O.structureDetailMix],Be=null;try{H=!0,D.camera.position.set(me[0],me[1],me[2]),D.camera.perspective({fov:ye,aspect:D.camera.aspect}),D.camera.lookAt(pe),D.camera.updateMatrixWorld(),D.syncFromCamera(),O.seatDetailMix=1,O.structureDetailMix=1,O.forceRegather(),Ne(0);let oe=B.canvas,Re=Math.min(oe.width,Math.round(oe.height*16/9)),Ie=Math.round(Re*9/16),$e=document.createElement("canvas");$e.width=Math.max(1,Math.round(W)),$e.height=Math.max(1,Math.round(W*9/16));let kt=$e.getContext("2d");kt&&(kt.drawImage(oe,(oe.width-Re)/2,(oe.height-Ie)/2,Re,Ie,0,0,$e.width,$e.height),Be=$e.toDataURL("image/jpeg",.8))}finally{H=!1,Ae(),O.seatDetailMix=ke[0],O.structureDetailMix=ke[1],O.forceRegather(),Ne(0)}if(Be)for(j.set(z,Be);j.size>N;)j.delete(j.keys().next().value);return Be},getQualityEvidence(){let z=we.stats(),W=B.canvas.clientWidth||1,Z=B.canvas.clientHeight||1,ce=r.bounds.center,me=at(D.camera.projectionViewMatrix,[ce[0],r.bounds.box.min[1],ce[2]],W,Z),pe=at(D.camera.projectionViewMatrix,[ce[0],r.bounds.box.max[1],ce[2]],W,Z),ye=r.bounds.box,Ae=[ye.min[0],ye.max[0]].flatMap(oe=>[ye.min[1],ye.max[1]].flatMap(Re=>[ye.min[2],ye.max[2]].map(Ie=>at(D.camera.projectionViewMatrix,[oe,Re,Ie],W,Z)))).filter(oe=>Number.isFinite(oe.x)&&Number.isFinite(oe.y)&&Number.isFinite(oe.depth)),ke=Ae.length?(()=>{let oe=Math.min(...Ae.map(Ee=>Ee.x)),Re=Math.max(...Ae.map(Ee=>Ee.x)),Ie=Math.min(...Ae.map(Ee=>Ee.y)),$e=Math.max(...Ae.map(Ee=>Ee.y)),kt=Math.max(0,oe),bn=Math.min(W,Re),yn=Math.max(0,Ie),eo=Math.min(Z,$e),gn=Math.max(0,bn-kt),zt=Math.max(0,eo-yn);return{box:{x:kt,y:yn,width:gn,height:zt},horizontalFillRatio:gn/W,verticalFillRatio:zt/Z,visibleAreaRatio:gn*zt/(W*Z),clippedEdges:[...Ie<0?["top"]:[],...Re>W?["right"]:[],...$e>Z?["bottom"]:[],...oe<0?["left"]:[]]}})():void 0,Be=String(B.gl.getParameter(B.gl.VERSION)??"");return{viewport:{width:W,height:Z},context:{webgl2:/webgl\s*2/i.test(Be),lost:S},frame:{rendered:z.rendered,idle:z.idle},camera:{position:[D.camera.position.x,D.camera.position.y,D.camera.position.z],distance:D.currentDistance,verticalFovDeg:D.fovY},scene:{seatCount:r.seatCount,floorCount:r.floors.length,zoneCount:r.zones.length,sectionCount:r.sections.length,authoredRelief:p,renderedVerticalSpanM:Math.max(0,r.bounds.box.max[1]-r.bounds.box.min[1]),projectedReliefPx:me.visible&&pe.visible?Math.abs(me.y-pe.y):0},labels:K.qualityEvidence(),framing:ke,...pn?{seatView:{fovDeg:D.camera.fov,stop:pn}}:{}}},getQualityReport(){return Ho(dr.getQualityEvidence())},loseContextForTest(){B.simulateContextLossCycle()},floors(){return r.floors},focusFloor(z){if(z!==null&&!r.floors.some(Z=>Z.index===z))return!1;let W=z??-1;if(k(z!==null),Jn(!1),km(W),hn("orbit"),z===null)Q.cancel(),dn()?D.frame(r.bounds,!1,U,n.portraitOverviewCrop===!0,$):D.frameSoft(r.bounds,U,n.portraitOverviewCrop===!0,$),K.setOverviewDistance(D.targetDistance);else{let Z=r.floors[z];if(Z.seatCount>0){Q.cancel();let ce=Z.focalWorld[0]-Z.center[0],me=Z.focalWorld[2]-Z.center[2],pe=Math.hypot(ce,me)>Z.radius*.12?Math.atan2(ce,me):U;D.frame({center:Z.center,radius:Z.radius,box:Z.box},!1,pe,!1,{polarDeg:58,margin:1.12}),K.setOverviewDistance(D.targetDistance)}}return we.requestRender(),!0},zones(){return r.zones},focusZone(z){let W=r.zones.find(pe=>pe.id===z);if(!W||W.seatCount===0)return!1;k(!1),Jn(!1),Q.cancel(),hn("orbit"),xe(null),n.onSectionFocusChange?.(null);let Z=W.focalWorld[0]-W.center[0],ce=W.focalWorld[2]-W.center[2],me=Math.hypot(Z,ce)>W.radius*.12?Math.atan2(Z,ce):void 0;return D.frame({center:W.center,radius:W.radius*1.25},!1,me),we.requestRender(),!0},sections(){return r.sections},focusSection(z){return na(z)},rows(z){return z?r.rows.filter(W=>W.sectionId===z):r.rows},seatsInRow(z){return t.seats.filter(W=>W.rowId===z).map(W=>({id:W.id,label:W.displayLabel||W.label}))},focusRow(z){let W=r.rows.find(Z=>Z.id===z);return!W||W.seatCount===0?!1:(k(!0),Jn(!1),Q.cancel(),hn("pan"),W.sectionId&&(xe(W.sectionId),n.onSectionFocusChange?.(W.sectionId)),D.frame({center:W.center,radius:Math.max(2.5,W.radius*.65)}),we.requestRender(),!0)},setReducedMotionForTest(z){_=z},dispose(){M=!0,Y?.dispose(),Ke(!1),mr(),fr.remove(),Em.remove(),ea(),ve?.dispose(),we.stop(),K.dispose(),Ct?.disconnect(),P&&(P.dispose(),P=null),E(),X(),B.canvas.removeEventListener("pointerdown",pt.onDown),B.canvas.removeEventListener("pointermove",pt.onMove),B.canvas.removeEventListener("pointerup",pt.onUp),B.canvas.removeEventListener("pointercancel",pt.onUp),B.canvas.removeEventListener("pointermove",Qn),B.canvas.removeEventListener("pointerdown",Qn),B.canvas.removeEventListener("pointerleave",ji),_t&&cancelAnimationFrame(_t),D.dispose(),x&&x.dispose(),b&&b.dispose(),b=null,y?.dispose(),y=null,x=null,B.dispose()}};return a.opened(r.seatCount,p,t.prepared?.buildMs??performance.now()-o,t.prepared?.source??"inline"),dr}0&&(module.exports={VENUE3D_QUALITY_REPORT_VERSION,autoVenue3d,buildSceneModel,estimateVenue3D,inspectVenue3DQualityEvidence,mountVenue3D,prepareVenue3D,prepareVenue3DFromChart});
|