@seatlayer/core 0.92.5 → 0.94.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.
Files changed (126) hide show
  1. package/dist/ar-2SI7NFFP.js +1 -0
  2. package/dist/be-U2FT56IF.js +1 -0
  3. package/dist/bg-CZXBFEYM.js +1 -0
  4. package/dist/ca-S6HHRSSW.js +1 -0
  5. package/dist/{chunk-6FTHCEJW.js → chunk-A3ZL3R75.js} +1 -1
  6. package/dist/{chunk-S4H34KCG.js → chunk-CEIVHWRB.js} +1 -1
  7. package/dist/{chunk-4I2VWFJY.js → chunk-F2EXXZSZ.js} +1 -1
  8. package/dist/chunk-F7TP67LK.js +1 -0
  9. package/dist/{chunk-HC3U5BWH.js → chunk-LAX7F5ML.js} +1 -1
  10. package/dist/{chunk-NRZY5UXV.js → chunk-LFJUXTIO.js} +1 -1
  11. package/dist/{chunk-NKJS7MLW.js → chunk-M5X6G7FD.js} +1 -1
  12. package/dist/chunk-M7JA4BGP.js +1 -0
  13. package/dist/{chunk-K42NW62J.js → chunk-O3DGXAIC.js} +1 -1
  14. package/dist/{chunk-LVIAHZ4N.js → chunk-Q3MSDG4S.js} +1 -1
  15. package/dist/{chunk-TXF2XAK4.js → chunk-TKYTTEJ2.js} +1 -1
  16. package/dist/{chunk-LQKUHEL6.js → chunk-U7CVRE4P.js} +1 -1
  17. package/dist/core/chart-ops/index.cjs +1 -1
  18. package/dist/core/chart-ops/index.d.cts +18 -3
  19. package/dist/core/chart-ops/index.d.ts +18 -3
  20. package/dist/core/chart-ops/index.js +1 -1
  21. package/dist/core/inventory/index.cjs +1 -1
  22. package/dist/core/inventory/index.d.cts +2 -2
  23. package/dist/core/inventory/index.d.ts +2 -2
  24. package/dist/core/inventory/index.js +1 -1
  25. package/dist/core/layout/index.cjs +1 -1
  26. package/dist/core/layout/index.d.cts +2 -2
  27. package/dist/core/layout/index.d.ts +2 -2
  28. package/dist/core/layout/index.js +1 -1
  29. package/dist/core/quality/index.d.cts +2 -2
  30. package/dist/core/quality/index.d.ts +2 -2
  31. package/dist/core/quality/index.js +1 -1
  32. package/dist/core/sections/index.cjs +1 -1
  33. package/dist/core/sections/index.d.cts +1 -1
  34. package/dist/core/sections/index.d.ts +1 -1
  35. package/dist/core/sections/index.js +1 -1
  36. package/dist/cs-LGHHO6S2.js +1 -0
  37. package/dist/cy-BR55DXTI.js +1 -0
  38. package/dist/da-AWX6N4TO.js +1 -0
  39. package/dist/de-77YNHYP5.js +1 -0
  40. package/dist/el-NIQKJA32.js +1 -0
  41. package/dist/es-VHGELLST.js +1 -0
  42. package/dist/et-4TD7XADS.js +1 -0
  43. package/dist/fa-UAZ5KV3N.js +1 -0
  44. package/dist/fi-JLCYSRVX.js +1 -0
  45. package/dist/fr-JX7QFSSO.js +1 -0
  46. package/dist/he-DOZ45PIT.js +1 -0
  47. package/dist/hr-H3GWMNG4.js +1 -0
  48. package/dist/hu-GSQF7ES3.js +1 -0
  49. package/dist/index.cjs +1 -1
  50. package/dist/index.d.cts +34 -17
  51. package/dist/index.d.ts +34 -17
  52. package/dist/index.js +1 -1
  53. package/dist/it-PAUFAEAT.js +1 -0
  54. package/dist/ja-HFHAFCUM.js +1 -0
  55. package/dist/ku-KG57RZH4.js +1 -0
  56. package/dist/localeLoaders-7RRR6IXA.js +1 -0
  57. package/dist/lt-OWGR7NDQ.js +1 -0
  58. package/dist/lv-NI4L2PLM.js +1 -0
  59. package/dist/nl-KJNBH7GK.js +1 -0
  60. package/dist/no-DPBJYJKY.js +1 -0
  61. package/dist/pl-XAV56ZWO.js +1 -0
  62. package/dist/pt-4V7DSTE3.js +1 -0
  63. package/dist/{renderedQuality-D5G1fHtR.d.ts → renderedQuality-BrCnk3-x.d.ts} +1 -1
  64. package/dist/{renderedQuality-DThBK6x4.d.cts → renderedQuality-CXlWvz_l.d.cts} +1 -1
  65. package/dist/{renderer-B7IrAGHP.d.ts → renderer-DbnKKo5K.d.ts} +100 -1
  66. package/dist/{renderer-BePADdjE.d.cts → renderer-fetXkaDe.d.cts} +100 -1
  67. package/dist/ro-OIPNCCS7.js +1 -0
  68. package/dist/ru-JS5BEIO5.js +1 -0
  69. package/dist/sk-CS5FNAAC.js +1 -0
  70. package/dist/sl-UKLY77MM.js +1 -0
  71. package/dist/sr-DGGTR6NQ.js +1 -0
  72. package/dist/sv-6O6AJ5ZD.js +1 -0
  73. package/dist/{tableSizing-D7dXthik.d.ts → tableSizing-CPYpm4iH.d.ts} +14 -2
  74. package/dist/{tableSizing-DUSD6Ksr.d.cts → tableSizing-DKo6Zlt_.d.cts} +14 -2
  75. package/dist/{ticketRestrictions-5qEU-1eK.d.cts → ticketRestrictions-CEgj821Q.d.cts} +1 -1
  76. package/dist/{ticketRestrictions-rrajqzOB.d.ts → ticketRestrictions-le9Yoa10.d.ts} +1 -1
  77. package/dist/tr-HSODCNOA.js +1 -0
  78. package/dist/uk-PLZCNDOX.js +1 -0
  79. package/dist/view3d/index.cjs +25 -25
  80. package/dist/view3d/index.d.cts +1 -1
  81. package/dist/view3d/index.d.ts +1 -1
  82. package/dist/view3d/index.js +1 -1
  83. package/dist/view3d/scene/scene.worker.cjs +1 -1
  84. package/dist/view3d/scene/scene.worker.js +1 -1
  85. package/dist/zh-Hans-DQX4CWFR.js +1 -0
  86. package/dist/zh-Hant-MAEIHPS4.js +1 -0
  87. package/package.json +1 -1
  88. package/dist/ar-KGNNNJUO.js +0 -1
  89. package/dist/be-LE7QOODV.js +0 -1
  90. package/dist/bg-CVE3J6PP.js +0 -1
  91. package/dist/ca-IKKNYKM3.js +0 -1
  92. package/dist/chunk-D5ZLXZYU.js +0 -1
  93. package/dist/chunk-F45ZMLCU.js +0 -1
  94. package/dist/cs-URM2GHWN.js +0 -1
  95. package/dist/cy-2M2GE2B4.js +0 -1
  96. package/dist/da-WAXH2D7H.js +0 -1
  97. package/dist/de-H4PSHII3.js +0 -1
  98. package/dist/el-U4RQJNUD.js +0 -1
  99. package/dist/es-ZS7OFHRA.js +0 -1
  100. package/dist/et-ZZIBRHRO.js +0 -1
  101. package/dist/fa-7QW4XHTK.js +0 -1
  102. package/dist/fi-P6C2UJG3.js +0 -1
  103. package/dist/fr-UNQNIKP7.js +0 -1
  104. package/dist/he-EBIDVS7Q.js +0 -1
  105. package/dist/hr-ELYMVVXF.js +0 -1
  106. package/dist/hu-XWENOXUQ.js +0 -1
  107. package/dist/it-AAI5NPRW.js +0 -1
  108. package/dist/ja-6WK4CCNS.js +0 -1
  109. package/dist/ku-7NHUIS6X.js +0 -1
  110. package/dist/localeLoaders-THFBL37Y.js +0 -1
  111. package/dist/lt-LRK6MX3B.js +0 -1
  112. package/dist/lv-OLYBSH3S.js +0 -1
  113. package/dist/nl-QWXHNW6I.js +0 -1
  114. package/dist/no-2KC54QOY.js +0 -1
  115. package/dist/pl-47XPU4H7.js +0 -1
  116. package/dist/pt-PTM7NPGE.js +0 -1
  117. package/dist/ro-MGGJVFMK.js +0 -1
  118. package/dist/ru-TPAADG2S.js +0 -1
  119. package/dist/sk-Y3IOBKYW.js +0 -1
  120. package/dist/sl-UUI7EHW5.js +0 -1
  121. package/dist/sr-LAJHZ4FT.js +0 -1
  122. package/dist/sv-SRHCVAW4.js +0 -1
  123. package/dist/tr-CASRE75P.js +0 -1
  124. package/dist/uk-6A5ZWUPH.js +0 -1
  125. package/dist/zh-Hans-QN3XNYBM.js +0 -1
  126. package/dist/zh-Hant-CMJBSD2M.js +0 -1
@@ -1,4 +1,4 @@
1
- "use strict";var Ls=Object.create;var $t=Object.defineProperty;var ks=Object.getOwnPropertyDescriptor;var Fs=Object.getOwnPropertyNames;var Ds=Object.getPrototypeOf,Os=Object.prototype.hasOwnProperty;var Rt=(e,t,n)=>()=>{if(n)throw n[0];try{return e&&(t=e(e=0)),t}catch(r){throw n=[r],r}};var zo=(e,t)=>{for(var n in t)$t(e,n,{get:t[n],enumerable:!0})},Uo=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Fs(t))!Os.call(e,o)&&o!==n&&$t(e,o,{get:()=>t[o],enumerable:!(r=ks(t,o))||r.enumerable});return e};var mt=(e,t,n)=>(n=e!=null?Ls(Ds(e)):{},Uo(t||!e||!e.__esModule?$t(n,"default",{value:e,enumerable:!0}):n,e)),Vs=e=>Uo($t({},"__esModule",{value:!0}),e);function Jm(e,t){return!Number.isFinite(e)||!Number.isFinite(t)||e<=0||t<=0?0:Math.ceil(e*t*4*(4/3))}function ed(e){return(e!==void 0&&e<=2?32:e!==void 0&&e>=8?192:96)*1024*1024}function Tn(e){let t=typeof navigator>"u"?void 0:navigator;return{saveData:t?.connection?.saveData===!0,maxTextureSize:e,maxDecodedBytes:ed(t?.deviceMemory)}}function _n(e,t={}){let n=e.previewUrl?.trim();if(!n||n===e.url)return{initialUrl:e.url,initialWidth:e.sourceWidth,initialHeight:e.sourceHeight,reason:"full-only"};let r={initialUrl:n,initialWidth:e.previewWidth,initialHeight:e.previewHeight};if(t.saveData)return{...r,reason:"save-data"};let o=[...e.variants??[],...e.sourceWidth!==void 0&&e.sourceHeight!==void 0?[{url:e.url,width:e.sourceWidth,height:e.sourceHeight}]:[]].filter(c=>c.url.trim()&&c.url!==n&&Number.isFinite(c.width)&&c.width>0&&Number.isFinite(c.height)&&c.height>0).sort((c,u)=>c.width*c.height-u.width*u.height);if(!o.length)return{...r,upgradeUrl:e.url,reason:"progressive"};let i=o.filter(c=>t.maxTextureSize===void 0||Math.max(c.width,c.height)<=t.maxTextureSize);if(!i.length)return{...r,reason:"texture-limit"};let a=i.filter(c=>t.maxDecodedBytes===void 0||Jm(c.width,c.height)<=t.maxDecodedBytes);if(!a.length)return{...r,reason:"memory-limit"};let s=a[a.length-1];return{...r,upgradeUrl:s.url,reason:"progressive"}}function Za(){return new DOMException("Panorama image load aborted","AbortError")}function Yt(e,t){return new Promise((n,r)=>{if(t?.aborted){r(Za());return}let o=new Image;o.crossOrigin="anonymous";let i=!1,a=()=>{o.onload=null,o.onerror=null,t?.removeEventListener("abort",c)},s=u=>{i||(i=!0,a(),u?r(u):n(o))},c=()=>{o.src="",s(Za())};o.onload=()=>{(typeof o.decode=="function"?o.decode():Promise.resolve()).then(()=>s(),()=>s())},o.onerror=()=>s(new Error("panorama_image_failed")),t?.addEventListener("abort",c,{once:!0}),o.src=e})}function Ln(e){let t=globalThis;if(t.requestIdleCallback){let r=t.requestIdleCallback(e,{timeout:1200});return()=>t.cancelIdleCallback?.(r)}let n=globalThis.setTimeout(e,32);return()=>globalThis.clearTimeout(n)}var ko=Rt(()=>{"use strict"});function es(e){let t=e.mediaKind==="demo-render",n=e.generated||e.mediaKind==="model"?"Live 3D \xB7 chart-derived seat-eye":t?e.coverage==="exact-seat"?"AI-generated exact-seat demo":e.coverage==="row-representative"?"AI-generated representative row demo":e.coverage==="section-representative"?"AI-generated representative section demo":e.coverage==="floor-representative"?"AI-generated representative floor demo":"AI-generated illustrative venue demo":e.coverage==="exact-seat"?"Exact seat photo":e.coverage==="row-representative"?"Representative row view":e.coverage==="section-representative"?"Representative section view":e.coverage==="floor-representative"?"Representative floor view":e.coverage==="venue-representative"?"Representative venue view":"Venue photo",r=e.capturedAt&&/^\d{4}/.test(e.capturedAt)?e.capturedAt.slice(0,4):"";return[n,r?`${t?"created":"captured"} ${r}`:"",e.sourceLabel??""].filter(Boolean).join(" \xB7 ")}function Fo(e){return Math.max(td,Math.min(nd,e))}function od(e,t,n){let r=(.5+e/360)*n;return t/2-r}function rd(e,t=Fn){return e*(180/t)}function Ja(e,t,n){return(e-t)/2+kn(n,t)}function kn(e,t){let n=Le/180*t;return Math.max(-n,Math.min(n,e))}function id(){if(typeof window>"u")return!1;try{if(typeof window.matchMedia=="function"&&window.matchMedia("(pointer: coarse)").matches)return!0}catch{}return"ontouchstart"in window}function Do(e){return e||(id()?"Drag to look \xB7 pinch to zoom \xB7 tap \u2715 to close":"Drag to look \xB7 pinch or scroll to zoom \xB7 Esc to close")}function ts(e,t,n={}){let r=n.fadeMs??400,o=t.initialBearingDeg??0,i=_n(t,Tn()),a=new AbortController,s=()=>a.abort();n.signal?.addEventListener("abort",s,{once:!0});let c=document.createElement("div"),u=document.activeElement instanceof HTMLElement?document.activeElement:null;c.setAttribute("role","dialog"),c.setAttribute("aria-modal","true"),c.setAttribute("aria-label",n.seatLabel?`View from ${n.seatLabel}`:"View from seat"),c.tabIndex=-1,Object.assign(c.style,{position:"absolute",inset:"0",zIndex:"10",opacity:"0",transition:`opacity ${r}ms ease`,background:"#05070c",overflow:"hidden",touchAction:"none"});let d=document.createElement("div");Object.assign(d.style,{position:"absolute",inset:"0",backgroundImage:`url("${i.initialUrl}")`,backgroundRepeat:"repeat-x",cursor:"grab"}),c.appendChild(d);let f=document.createElement("button");if(f.type="button",f.setAttribute("aria-label","Close"),f.textContent="\u2715",Object.assign(f.style,{position:"absolute",top:"12px",right:"12px",zIndex:"2",width:"44px",height:"44px",borderRadius:"999px",cursor:"pointer",border:"1px solid rgba(255,255,255,0.25)",background:"rgba(8,12,18,0.6)",color:"#e6edf3",fontSize:"15px",lineHeight:"1"}),c.appendChild(f),n.disclosure){let 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 m=document.createElement("div");m.textContent=Do(n.lookAroundHint),Object.assign(m.style,{position:"absolute",bottom:"12px",left:"0",right:"0",textAlign:"center",color:"rgba(230,237,243,0.7)",font:"12px ui-sans-serif, system-ui, sans-serif",pointerEvents:"none"}),c.appendChild(m),e.appendChild(c),f.focus({preventScroll:!0});let l=0,p=0,h=0,b=0,y=Fn,v=()=>{let G=c.clientHeight||1,V=c.clientWidth||1,W=R.naturalWidth||V*2,X=R.naturalHeight||G,Q=l>0?(V/2-h)/l:0,q=p>0?b/p:0;p=rd(G,y),l=p*(W/X),d.style.backgroundSize=`${l}px ${p}px`,S?h=V/2-Q*l:(h=od(o,V,l),b=kn((t.initialPitchDeg??0)/180*p,p),S=!0),b=kn(q*p,p),d.style.backgroundPosition=`${h}px ${Ja(G,p,b)}px`},S=!1,M=()=>{let G=c.clientHeight||1;b=kn(b,p),d.style.backgroundPosition=`${h}px ${Ja(G,p,b)}px`},R=new Image;R.onload=v,R.src=i.initialUrl;let x=()=>{};i.upgradeUrl&&(x=Ln(()=>{(t.resolveUrl?t.resolveUrl(i.upgradeUrl):Promise.resolve(i.upgradeUrl)).then(V=>!V||a.signal.aborted?null:Yt(V,a.signal).then(W=>({full:W,url:V}))).then(V=>{V&&(P||a.signal.aborted||(R=V.full,d.style.backgroundImage=`url("${V.url}")`,v()))}).catch(()=>{})})),requestAnimationFrame(v);let g=!1,C=0,E=0,D=0,B=new Map,L=()=>{let[G,V]=[...B.values()];return G&&V?Math.hypot(G.x-V.x,G.y-V.y):0},A=G=>{let V=Fo(G);V!==y&&(y=V,v())},k=G=>{B.set(G.pointerId,{x:G.clientX,y:G.clientY}),g=B.size===1,C=G.clientX,E=G.clientY,B.size===2&&(D=L()),d.style.cursor="grabbing";try{d.setPointerCapture?.(G.pointerId)}catch{}},N=G=>{if(B.has(G.pointerId)){if(B.set(G.pointerId,{x:G.clientX,y:G.clientY}),B.size>=2){let V=L();D>0&&V>0&&A(y*(D/V)),D=V,g=!1;return}g&&(h+=G.clientX-C,b+=G.clientY-E,C=G.clientX,E=G.clientY,M())}},w=G=>{B.delete(G.pointerId),D=B.size===2?L():0;let V=B.values().next().value;g=B.size===1,V?(C=V.x,E=V.y):d.style.cursor="grab";try{d.releasePointerCapture?.(G.pointerId)}catch{}},T=G=>{G.preventDefault(),A(y+G.deltaY*.04)};d.addEventListener("pointerdown",k),d.addEventListener("pointermove",N),d.addEventListener("pointerup",w),d.addEventListener("pointercancel",w),d.addEventListener("wheel",T,{passive:!1});let _=!1,P=!1,O=0,I=()=>{d.removeEventListener("pointerdown",k),d.removeEventListener("pointermove",N),d.removeEventListener("pointerup",w),d.removeEventListener("pointercancel",w),d.removeEventListener("wheel",T),window.removeEventListener("keydown",j)},F=()=>{x(),a.abort(),n.signal?.removeEventListener("abort",s),O&&(window.clearTimeout(O),O=0),I(),c.parentNode&&c.parentNode.removeChild(c),u?.isConnected&&u.focus({preventScroll:!0})},H=()=>{if(_)return;_=!0,c.style.opacity="0";let G=()=>{O=0,!P&&(F(),n.onClose?.())};O=window.setTimeout(G,r)},j=G=>{if(G.key==="Tab"){G.preventDefault(),f.focus({preventScroll:!0});return}if(G.key==="Escape"){G.stopPropagation(),H();return}if(G.key==="ArrowLeft"||G.key==="ArrowRight")h+=G.key==="ArrowLeft"?-32:32;else if(G.key==="ArrowUp"||G.key==="ArrowDown")b+=(G.key==="ArrowUp"?4:-4)*(p/180);else if(G.key==="+"||G.key==="="){A(y-5),G.preventDefault();return}else if(G.key==="-"){A(y+5),G.preventDefault();return}else return;G.preventDefault(),M()};return window.addEventListener("keydown",j),f.addEventListener("click",H),requestAnimationFrame(()=>{c.style.opacity="1"}),{close:H,dispose(){_=!0,P=!0,F()}}}var Fn,td,nd,Le,Dn=Rt(()=>{"use strict";ko();Fn=70,td=35,nd=90;Le=35});function ld(e=ad,t=sd,n=cd){let r=e+1,o=t+1,i=r*o,a=new Float32Array(i*3),s=new Float32Array(i*2);for(let d=0;d<o;d++){let f=d/t,m=f*Math.PI,l=Math.sin(m),p=Math.cos(m);for(let h=0;h<r;h++){let b=h/e,y=(b-.5)*Math.PI*2,v=d*r+h;a[v*3]=n*l*Math.sin(y),a[v*3+1]=n*p,a[v*3+2]=-n*l*Math.cos(y),s[v*2]=b,s[v*2+1]=f}}let c=new Uint16Array(e*t*6),u=0;for(let d=0;d<t;d++)for(let f=0;f<e;f++){let m=d*r+f,l=m+r;c[u++]=m,c[u++]=l,c[u++]=m+1,c[u++]=m+1,c[u++]=l,c[u++]=l+1}return{position:a,uv:s,index:c}}function ns(e,t){let n=e*Math.PI/180,r=t*Math.PI/180,o=Math.cos(r);return[o*Math.sin(n),Math.sin(r),-o*Math.cos(n)]}function os(e,t){let{position:n,uv:r,index:o}=ld(),i=new Ke.Geometry(e,{position:{size:3,data:n},uv:{size:2,data:r},index:{data:o}}),a=new Ke.Texture(e,{image:t,wrapS:e.CLAMP_TO_EDGE,wrapT:e.CLAMP_TO_EDGE,generateMipmaps:!0,flipY:!1}),s=new Ke.Program(e,{vertex:ud,fragment:md,uniforms:{uPano:{value:a},uOpacity:{value:0}},transparent:!0,depthTest:!1,depthWrite:!1}),c=new Ke.Mesh(e,{geometry:i,program:s});return{mesh:c,setOpacity(u){s.uniforms.uOpacity.value=Math.max(0,Math.min(1,u))},setImage(u){a.image=u,a.needsUpdate=!0},dispose(){c.setParent(null),i.remove(),a.texture&&e.deleteTexture(a.texture),s.remove()}}}var Ke,ad,sd,cd,ud,md,rs=Rt(()=>{"use strict";Ke=require("ogl"),ad=64,sd=32,cd=500;ud=`#version 300 es
1
+ "use strict";var ks=Object.create;var $t=Object.defineProperty;var Fs=Object.getOwnPropertyDescriptor;var Ds=Object.getOwnPropertyNames;var Os=Object.getPrototypeOf,Vs=Object.prototype.hasOwnProperty;var Rt=(e,t,n)=>()=>{if(n)throw n[0];try{return e&&(t=e(e=0)),t}catch(r){throw n=[r],r}};var Uo=(e,t)=>{for(var n in t)$t(e,n,{get:t[n],enumerable:!0})},Ho=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Ds(t))!Vs.call(e,o)&&o!==n&&$t(e,o,{get:()=>t[o],enumerable:!(r=Fs(t,o))||r.enumerable});return e};var mt=(e,t,n)=>(n=e!=null?ks(Os(e)):{},Ho(t||!e||!e.__esModule?$t(n,"default",{value:e,enumerable:!0}):n,e)),Bs=e=>Ho($t({},"__esModule",{value:!0}),e);function ed(e,t){return!Number.isFinite(e)||!Number.isFinite(t)||e<=0||t<=0?0:Math.ceil(e*t*4*(4/3))}function td(e){return(e!==void 0&&e<=2?32:e!==void 0&&e>=8?192:96)*1024*1024}function Tn(e){let t=typeof navigator>"u"?void 0:navigator;return{saveData:t?.connection?.saveData===!0,maxTextureSize:e,maxDecodedBytes:td(t?.deviceMemory)}}function _n(e,t={}){let n=e.previewUrl?.trim();if(!n||n===e.url)return{initialUrl:e.url,initialWidth:e.sourceWidth,initialHeight:e.sourceHeight,reason:"full-only"};let r={initialUrl:n,initialWidth:e.previewWidth,initialHeight:e.previewHeight};if(t.saveData)return{...r,reason:"save-data"};let o=[...e.variants??[],...e.sourceWidth!==void 0&&e.sourceHeight!==void 0?[{url:e.url,width:e.sourceWidth,height:e.sourceHeight}]:[]].filter(c=>c.url.trim()&&c.url!==n&&Number.isFinite(c.width)&&c.width>0&&Number.isFinite(c.height)&&c.height>0).sort((c,u)=>c.width*c.height-u.width*u.height);if(!o.length)return{...r,upgradeUrl:e.url,reason:"progressive"};let i=o.filter(c=>t.maxTextureSize===void 0||Math.max(c.width,c.height)<=t.maxTextureSize);if(!i.length)return{...r,reason:"texture-limit"};let a=i.filter(c=>t.maxDecodedBytes===void 0||ed(c.width,c.height)<=t.maxDecodedBytes);if(!a.length)return{...r,reason:"memory-limit"};let s=a[a.length-1];return{...r,upgradeUrl:s.url,reason:"progressive"}}function Ja(){return new DOMException("Panorama image load aborted","AbortError")}function Yt(e,t){return new Promise((n,r)=>{if(t?.aborted){r(Ja());return}let o=new Image;o.crossOrigin="anonymous";let i=!1,a=()=>{o.onload=null,o.onerror=null,t?.removeEventListener("abort",c)},s=u=>{i||(i=!0,a(),u?r(u):n(o))},c=()=>{o.src="",s(Ja())};o.onload=()=>{(typeof o.decode=="function"?o.decode():Promise.resolve()).then(()=>s(),()=>s())},o.onerror=()=>s(new Error("panorama_image_failed")),t?.addEventListener("abort",c,{once:!0}),o.src=e})}function Ln(e){let t=globalThis;if(t.requestIdleCallback){let r=t.requestIdleCallback(e,{timeout:1200});return()=>t.cancelIdleCallback?.(r)}let n=globalThis.setTimeout(e,32);return()=>globalThis.clearTimeout(n)}var Fo=Rt(()=>{"use strict"});function ts(e){let t=e.mediaKind==="demo-render",n=e.generated||e.mediaKind==="model"?"Live 3D \xB7 chart-derived seat-eye":t?e.coverage==="exact-seat"?"AI-generated exact-seat demo":e.coverage==="row-representative"?"AI-generated representative row demo":e.coverage==="section-representative"?"AI-generated representative section demo":e.coverage==="floor-representative"?"AI-generated representative floor demo":"AI-generated illustrative venue demo":e.coverage==="exact-seat"?"Exact seat photo":e.coverage==="row-representative"?"Representative row view":e.coverage==="section-representative"?"Representative section view":e.coverage==="floor-representative"?"Representative floor view":e.coverage==="venue-representative"?"Representative venue view":"Venue photo",r=e.capturedAt&&/^\d{4}/.test(e.capturedAt)?e.capturedAt.slice(0,4):"";return[n,r?`${t?"created":"captured"} ${r}`:"",e.sourceLabel??""].filter(Boolean).join(" \xB7 ")}function Do(e){return Math.max(nd,Math.min(od,e))}function rd(e,t,n){let r=(.5+e/360)*n;return t/2-r}function id(e,t=Fn){return e*(180/t)}function es(e,t,n){return(e-t)/2+kn(n,t)}function kn(e,t){let n=Le/180*t;return Math.max(-n,Math.min(n,e))}function ad(){if(typeof window>"u")return!1;try{if(typeof window.matchMedia=="function"&&window.matchMedia("(pointer: coarse)").matches)return!0}catch{}return"ontouchstart"in window}function Oo(e){return e||(ad()?"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 ns(e,t,n={}){let r=n.fadeMs??400,o=t.initialBearingDeg??0,i=_n(t,Tn()),a=new AbortController,s=()=>a.abort();n.signal?.addEventListener("abort",s,{once:!0});let c=document.createElement("div"),u=document.activeElement instanceof HTMLElement?document.activeElement:null;c.setAttribute("role","dialog"),c.setAttribute("aria-modal","true"),c.setAttribute("aria-label",n.seatLabel?`View from ${n.seatLabel}`:"View from seat"),c.tabIndex=-1,Object.assign(c.style,{position:"absolute",inset:"0",zIndex:"10",opacity:"0",transition:`opacity ${r}ms ease`,background:"#05070c",overflow:"hidden",touchAction:"none"});let d=document.createElement("div");Object.assign(d.style,{position:"absolute",inset:"0",backgroundImage:`url("${i.initialUrl}")`,backgroundRepeat:"repeat-x",cursor:"grab"}),c.appendChild(d);let f=document.createElement("button");if(f.type="button",f.setAttribute("aria-label","Close"),f.textContent="\u2715",Object.assign(f.style,{position:"absolute",top:"12px",right:"12px",zIndex:"2",width:"44px",height:"44px",borderRadius:"999px",cursor:"pointer",border:"1px solid rgba(255,255,255,0.25)",background:"rgba(8,12,18,0.6)",color:"#e6edf3",fontSize:"15px",lineHeight:"1"}),c.appendChild(f),n.disclosure){let 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 m=document.createElement("div");m.textContent=Oo(n.lookAroundHint),Object.assign(m.style,{position:"absolute",bottom:"12px",left:"0",right:"0",textAlign:"center",color:"rgba(230,237,243,0.7)",font:"12px ui-sans-serif, system-ui, sans-serif",pointerEvents:"none"}),c.appendChild(m),e.appendChild(c),f.focus({preventScroll:!0});let l=0,p=0,h=0,b=0,y=Fn,v=()=>{let G=c.clientHeight||1,V=c.clientWidth||1,W=R.naturalWidth||V*2,X=R.naturalHeight||G,Q=l>0?(V/2-h)/l:0,q=p>0?b/p:0;p=id(G,y),l=p*(W/X),d.style.backgroundSize=`${l}px ${p}px`,S?h=V/2-Q*l:(h=rd(o,V,l),b=kn((t.initialPitchDeg??0)/180*p,p),S=!0),b=kn(q*p,p),d.style.backgroundPosition=`${h}px ${es(G,p,b)}px`},S=!1,M=()=>{let G=c.clientHeight||1;b=kn(b,p),d.style.backgroundPosition=`${h}px ${es(G,p,b)}px`},R=new Image;R.onload=v,R.src=i.initialUrl;let x=()=>{};i.upgradeUrl&&(x=Ln(()=>{(t.resolveUrl?t.resolveUrl(i.upgradeUrl):Promise.resolve(i.upgradeUrl)).then(V=>!V||a.signal.aborted?null:Yt(V,a.signal).then(W=>({full:W,url:V}))).then(V=>{V&&(P||a.signal.aborted||(R=V.full,d.style.backgroundImage=`url("${V.url}")`,v()))}).catch(()=>{})})),requestAnimationFrame(v);let g=!1,C=0,E=0,D=0,B=new Map,L=()=>{let[G,V]=[...B.values()];return G&&V?Math.hypot(G.x-V.x,G.y-V.y):0},A=G=>{let V=Do(G);V!==y&&(y=V,v())},k=G=>{B.set(G.pointerId,{x:G.clientX,y:G.clientY}),g=B.size===1,C=G.clientX,E=G.clientY,B.size===2&&(D=L()),d.style.cursor="grabbing";try{d.setPointerCapture?.(G.pointerId)}catch{}},N=G=>{if(B.has(G.pointerId)){if(B.set(G.pointerId,{x:G.clientX,y:G.clientY}),B.size>=2){let V=L();D>0&&V>0&&A(y*(D/V)),D=V,g=!1;return}g&&(h+=G.clientX-C,b+=G.clientY-E,C=G.clientX,E=G.clientY,M())}},w=G=>{B.delete(G.pointerId),D=B.size===2?L():0;let V=B.values().next().value;g=B.size===1,V?(C=V.x,E=V.y):d.style.cursor="grab";try{d.releasePointerCapture?.(G.pointerId)}catch{}},T=G=>{G.preventDefault(),A(y+G.deltaY*.04)};d.addEventListener("pointerdown",k),d.addEventListener("pointermove",N),d.addEventListener("pointerup",w),d.addEventListener("pointercancel",w),d.addEventListener("wheel",T,{passive:!1});let _=!1,P=!1,O=0,I=()=>{d.removeEventListener("pointerdown",k),d.removeEventListener("pointermove",N),d.removeEventListener("pointerup",w),d.removeEventListener("pointercancel",w),d.removeEventListener("wheel",T),window.removeEventListener("keydown",j)},F=()=>{x(),a.abort(),n.signal?.removeEventListener("abort",s),O&&(window.clearTimeout(O),O=0),I(),c.parentNode&&c.parentNode.removeChild(c),u?.isConnected&&u.focus({preventScroll:!0})},H=()=>{if(_)return;_=!0,c.style.opacity="0";let G=()=>{O=0,!P&&(F(),n.onClose?.())};O=window.setTimeout(G,r)},j=G=>{if(G.key==="Tab"){G.preventDefault(),f.focus({preventScroll:!0});return}if(G.key==="Escape"){G.stopPropagation(),H();return}if(G.key==="ArrowLeft"||G.key==="ArrowRight")h+=G.key==="ArrowLeft"?-32:32;else if(G.key==="ArrowUp"||G.key==="ArrowDown")b+=(G.key==="ArrowUp"?4:-4)*(p/180);else if(G.key==="+"||G.key==="="){A(y-5),G.preventDefault();return}else if(G.key==="-"){A(y+5),G.preventDefault();return}else return;G.preventDefault(),M()};return window.addEventListener("keydown",j),f.addEventListener("click",H),requestAnimationFrame(()=>{c.style.opacity="1"}),{close:H,dispose(){_=!0,P=!0,F()}}}var Fn,nd,od,Le,Dn=Rt(()=>{"use strict";Fo();Fn=70,nd=35,od=90;Le=35});function ud(e=sd,t=cd,n=ld){let r=e+1,o=t+1,i=r*o,a=new Float32Array(i*3),s=new Float32Array(i*2);for(let d=0;d<o;d++){let f=d/t,m=f*Math.PI,l=Math.sin(m),p=Math.cos(m);for(let h=0;h<r;h++){let b=h/e,y=(b-.5)*Math.PI*2,v=d*r+h;a[v*3]=n*l*Math.sin(y),a[v*3+1]=n*p,a[v*3+2]=-n*l*Math.cos(y),s[v*2]=b,s[v*2+1]=f}}let c=new Uint16Array(e*t*6),u=0;for(let d=0;d<t;d++)for(let f=0;f<e;f++){let m=d*r+f,l=m+r;c[u++]=m,c[u++]=l,c[u++]=m+1,c[u++]=m+1,c[u++]=l,c[u++]=l+1}return{position:a,uv:s,index:c}}function os(e,t){let n=e*Math.PI/180,r=t*Math.PI/180,o=Math.cos(r);return[o*Math.sin(n),Math.sin(r),-o*Math.cos(n)]}function rs(e,t){let{position:n,uv:r,index:o}=ud(),i=new Ke.Geometry(e,{position:{size:3,data:n},uv:{size:2,data:r},index:{data:o}}),a=new Ke.Texture(e,{image:t,wrapS:e.CLAMP_TO_EDGE,wrapT:e.CLAMP_TO_EDGE,generateMipmaps:!0,flipY:!1}),s=new Ke.Program(e,{vertex:md,fragment:dd,uniforms:{uPano:{value:a},uOpacity:{value:0}},transparent:!0,depthTest:!1,depthWrite:!1}),c=new Ke.Mesh(e,{geometry:i,program:s});return{mesh:c,setOpacity(u){s.uniforms.uOpacity.value=Math.max(0,Math.min(1,u))},setImage(u){a.image=u,a.needsUpdate=!0},dispose(){c.setParent(null),i.remove(),a.texture&&e.deleteTexture(a.texture),s.remove()}}}var Ke,sd,cd,ld,md,dd,is=Rt(()=>{"use strict";Ke=require("ogl"),sd=64,cd=32,ld=500;md=`#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
- }`,md=`#version 300 es
11
+ }`,dd=`#version 300 es
12
12
  precision highp float;
13
13
  in vec2 vUv;
14
14
  uniform sampler2D uPano;
@@ -17,15 +17,15 @@ out vec4 fragColor;
17
17
  void main() {
18
18
  vec3 rgb = texture(uPano, vUv).rgb;
19
19
  fragColor = vec4(rgb, uOpacity);
20
- }`});async function as(e,t,n,r={}){let o=r.fadeMs??400,i=t?.initialBearingDeg??0,a=Math.max(-Le,Math.min(Le,t?.initialPitchDeg??0)),s=Fn,c=!1,u=new AbortController,d=()=>u.abort();r.signal?.addEventListener("abort",d,{once:!0});let f=()=>{},m=[n.camera.position.x,n.camera.position.y,n.camera.position.z];if(!t&&n.cameraOriginWorld&&n.camera.position.set(n.cameraOriginWorld[0],n.cameraOriginWorld[1],n.cameraOriginWorld[2]),!t&&n.focalWorld){let I=n.camera.position,F=n.focalWorld[0]-I.x,H=n.focalWorld[1]-I.y,j=n.focalWorld[2]-I.z,G=Math.hypot(F,j);G>.001&&(i=Math.atan2(F,-j)*180/Math.PI,a=Math.max(-Le,Math.min(Le,Math.atan2(H,G)*180/Math.PI)))}let l=null;if(t){let I=n.gl.getParameter(n.gl.MAX_TEXTURE_SIZE),F=_n(t,Tn(I)),H;try{let j=t.resolveUrl?await t.resolveUrl(F.initialUrl):F.initialUrl;if(!j)throw new Error("panorama_asset_unavailable");H=await Yt(j,u.signal)}catch{return r.signal?.removeEventListener("abort",d),null}try{l=os(n.gl,H)}catch{return u.abort(),r.signal?.removeEventListener("abort",d),null}l.mesh.renderOrder=999,l.mesh.setParent(n.scene),F.upgradeUrl&&(f=Ln(()=>{(t.resolveUrl?t.resolveUrl(F.upgradeUrl):Promise.resolve(F.upgradeUrl)).then(G=>!G||u.signal.aborted?null:Yt(G,u.signal)).then(G=>{G&&(c||u.signal.aborted||(l?.setImage(G),n.requestRender()))}).catch(()=>{})}))}let p=n.camera.fov;n.camera.perspective({fov:s,aspect:n.camera.aspect});let h=n.camera.quaternion.slice(),b=()=>{let I=n.camera.position;l?.mesh.position.set(I.x,I.y,I.z);let[F,H,j]=ns(i,a);n.camera.lookAt([I.x+F,I.y+H,I.z+j]),n.requestRender()};b();let y=document.createElement("div"),v=document.activeElement instanceof HTMLElement?document.activeElement:null;y.setAttribute("role","dialog"),y.setAttribute("aria-modal","true"),y.setAttribute("aria-label",r.seatLabel?`View from ${r.seatLabel}`:"View from seat"),y.tabIndex=-1,Object.assign(y.style,{position:"absolute",inset:"0",zIndex:"10",cursor:"grab",touchAction:"none"});let 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),r.disclosure){let I=document.createElement("div");I.textContent=`${r.disclosurePrefix??"360\xB0 panorama"} \xB7 ${r.disclosure}`,Object.assign(I.style,{position:"absolute",top:"calc(12px + var(--sl-3d-top-inset, 0px))",left:"12px",zIndex:"2",maxWidth:"calc(100% - 88px)",padding:"8px 11px",borderRadius:"999px",overflow:"hidden",color:"#dce6f8",background:"rgba(8,12,18,0.68)",font:"600 11px/1.2 ui-sans-serif, system-ui, sans-serif",textOverflow:"ellipsis",whiteSpace:"nowrap",pointerEvents:"none",backdropFilter:"blur(6px)"}),y.appendChild(I)}let M=document.createElement("div");M.textContent=Do(r.lookAroundHint),Object.assign(M.style,{position:"absolute",bottom:"12px",left:"0",right:"0",textAlign:"center",color:"rgba(230,237,243,0.7)",font:"12px ui-sans-serif, system-ui, sans-serif",pointerEvents:"none"}),y.appendChild(M),e.appendChild(y),S.focus({preventScroll:!0});let R=!1,x=0,g=0,C=0,E=new Map,D=()=>{let[I,F]=[...E.values()];return I&&F?Math.hypot(I.x-F.x,I.y-F.y):0},B=I=>{let F=Fo(I);F!==s&&(s=F,n.camera.perspective({fov:s,aspect:n.camera.aspect}),b())},L=I=>{I.target!==S&&(E.set(I.pointerId,{x:I.clientX,y:I.clientY}),R=E.size===1,x=I.clientX,g=I.clientY,E.size===2&&(C=D()),y.setPointerCapture?.(I.pointerId),y.style.cursor="grabbing")},A=I=>{if(E.has(I.pointerId)){if(E.set(I.pointerId,{x:I.clientX,y:I.clientY}),E.size>=2){let F=D();C>0&&F>0&&B(s*(C/F)),C=F,R=!1;return}R&&(i+=(I.clientX-x)*is,a=Math.max(-Le,Math.min(Le,a+(I.clientY-g)*is)),x=I.clientX,g=I.clientY,b())}},k=I=>{E.delete(I.pointerId),C=E.size===2?D():0;let F=E.values().next().value;R=E.size===1,F?(x=F.x,g=F.y):y.style.cursor="grab";try{y.releasePointerCapture?.(I.pointerId)}catch{}},N=I=>{I.preventDefault(),B(s+I.deltaY*.04)};y.addEventListener("pointerdown",L),y.addEventListener("pointermove",A),y.addEventListener("pointerup",k),y.addEventListener("pointercancel",k),y.addEventListener("wheel",N,{passive:!1});let w=I=>{if(!c){if(I.key==="Tab"){I.preventDefault(),S.focus({preventScroll:!0});return}if(I.key==="Escape"){I.stopPropagation(),O.close();return}if(I.key==="ArrowLeft"||I.key==="ArrowRight")i+=I.key==="ArrowLeft"?-4:4;else if(I.key==="ArrowUp"||I.key==="ArrowDown")a=Math.max(-Le,Math.min(Le,a+(I.key==="ArrowUp"?4:-4)));else if(I.key==="+"||I.key==="="){B(s-5),I.preventDefault();return}else if(I.key==="-"){B(s+5),I.preventDefault();return}else return;I.preventDefault(),b()}};window.addEventListener("keydown",w);let T=0,_=(I,F)=>{if(!l){F?.();return}let H=I===1?0:1,j=performance.now(),G=()=>{if(c)return;let V=o<=0?1:Math.min(1,(performance.now()-j)/o);l?.setOpacity(H+(I-H)*V),n.requestRender(),V<1?T=requestAnimationFrame(G):F?.()};T=requestAnimationFrame(G)};_(1);let P=()=>{c||(c=!0,f(),u.abort(),r.signal?.removeEventListener("abort",d),cancelAnimationFrame(T),y.removeEventListener("pointerdown",L),y.removeEventListener("pointermove",A),y.removeEventListener("pointerup",k),y.removeEventListener("pointercancel",k),y.removeEventListener("wheel",N),window.removeEventListener("keydown",w),y.remove(),v?.isConnected&&v.focus({preventScroll:!0}),l?.dispose(),n.camera.position.set(m[0],m[1],m[2]),n.camera.perspective({fov:p,aspect:n.camera.aspect}),n.camera.quaternion.set(h[0],h[1],h[2],h[3]),n.requestRender())},O={close(){if(c)return;let I=()=>{P(),r.onClose?.()};cancelAnimationFrame(T),_(0,I)},dispose:P};return S.addEventListener("click",()=>O.close()),O}var is,ss=Rt(()=>{"use strict";rs();Dn();Dn();ko();is=.15});var cs={};zo(cs,{createOpenPanorama:()=>dd});function dd(e){let{container:t,model:n,opts:r,analytics:o,orbit:i,loop:a,seatsById:s,ensureSeatView:c,resolvedSeatViewPose:u,gpu:d,gl:f,isContextLost:m,isDisposed:l,flightGen:p,setPanorama:h,getLoadAbort:b,setLoadAbort:y,setPanoramaSphereVisible:v,setFrozen:S,raisePanoramaLayer:M,restorePanoramaLayer:R,getOverviewChip:x,labelOverlay:g,reducedMotion:C,removeArriveChip:E,showArriveChip:D}=e;return async(B,L,A)=>{b()?.abort();let k=new AbortController;y(k);let N=n.seats.idToIndex.get(B);if(N===void 0){i.syncFromCamera();return}let w=s.get(B)?.label??B,T=u(B,N),_=c(B);if(!_){k.abort(),b()===k&&y(null),i.syncFromCamera();return}S(!0),a.stop();let P;try{P=await _}catch{if(b()===k&&y(null),o.panoramaFailed(B,"source"),!l()&&A===p()){S(!1),i.resumeAfterFlight(T.focal),a.requestRender();let W=D(B,A,!0);requestAnimationFrame(()=>W?.querySelector("[data-panorama-trigger]")?.focus())}return}if(l()||A!==p()){k.abort(),b()===k&&y(null);return}E();let O=x(),I=()=>{k.abort(),b()===k&&y(null),h(null),v(!1),R(),O.style.display="",g.setVisible(!r.arriveAtSeatEye),S(!1),o.panoramaClosed(),i.resumeAfterFlight(T.focal),a.requestRender();let W=D(B,p());requestAnimationFrame(()=>W?.querySelector("[data-panorama-trigger]")?.focus())},F=P.generated===!0,H=es(P);M(),v(!F),O.style.display="none";let j=C()?0:L,G=d(),V=G&&!m()?await as(t,F?null:P,{gl:f,scene:G.main,camera:i.camera,requestRender:()=>a.requestRender(),cameraOriginWorld:F?T.eye:void 0,focalWorld:T.focal},{fadeMs:j,seatLabel:w,disclosure:H,disclosurePrefix:F?"Live seat-eye view":"360\xB0 panorama",lookAroundHint:r.lookAroundHint,onClose:I,signal:k.signal}):null;if(l()||A!==p()){k.abort(),v(!1),b()===k&&y(null),V?.dispose(),O.style.display="",R();return}if(V)i.syncFromCamera(),g.setVisible(!1),S(!1),a.requestRender(),h(V);else if(F){R(),O.style.display="",S(!1),i.resumeAfterFlight(T.focal),a.requestRender(),h(null),v(!1),o.panoramaFailed(B,"mount");let W=D(B,p(),!0);requestAnimationFrame(()=>W?.querySelector("[data-panorama-trigger]")?.focus()),b()===k&&y(null);return}else v(!1),o.panoramaFallback(B),h(ts(t,P,{fadeMs:j,seatLabel:w,disclosure:H,onClose:I,signal:k.signal,lookAroundHint:r.lookAroundHint}));o.panoramaOpened()}}var ls=Rt(()=>{"use strict";Dn();ss()});var Md={};zo(Md,{VENUE3D_QUALITY_REPORT_VERSION:()=>aa,buildSceneModel:()=>St,inspectVenue3DQualityEvidence:()=>wn,mountVenue3D:()=>Sd,prepareVenue3D:()=>Ms,prepareVenue3DFromChart:()=>ws});module.exports=Vs(Md);var Xo=require("ogl");var Bs=/^#?([\da-f]{3}|[\da-f]{6})$/i;function Ns(e){let t=Bs.exec((e??"").trim());if(!t)return null;let n=t[1].length===3?t[1].split("").map(o=>o+o).join(""):t[1],r=parseInt(n,16);return[r>>16&255,r>>8&255,r&255]}function ne(e){let t=Ns(e);return t?[t[0]/255,t[1]/255,t[2]/255]:null}function Hn(e){let t=e/255;return t<=.04045?t/12.92:((t+.055)/1.055)**2.4}function Gs(e){return .2126*Hn(e[0])+.7152*Hn(e[1])+.0722*Hn(e[2])}function Ho(e){return Gs([e[0]*255,e[1]*255,e[2]*255])}function zs(e){return .2126*e[0]+.7152*e[1]+.0722*e[2]}function ge(e,t,n){return[e[0]+(t[0]-e[0])*n,e[1]+(t[1]-e[1])*n,e[2]+(t[2]-e[2])*n]}function Et(e,t){let n=zs(e);return ge(e,[n,n,n],t)}var pe=["available","held","sold","selected","dimmed"];function It(e){let t=pe.indexOf(e);return t<0?0:t}var jo={available:[.24,.82,.52],held:[.95,.66,.22],sold:[.34,.39,.45],selected:[.24,.74,1],dimmed:[.28,.32,.37]};function Yo(e){let t=.2126*e[0]+.7152*e[1]+.0722*e[2],n=.42,r=.62;return[(t+(e[0]-t)*n)*r,(t+(e[1]-t)*n)*r,(t+(e[2]-t)*n)*r]}var jn={ground:[.07,.085,.11],tierTop:[.24,.28,.34],tierWall:[.17,.2,.25],stageTop:[.94,.7,.38],stageWall:[.48,.33,.18],decorTop:[.22,.25,.29],decorWall:[.15,.17,.2],gaTop:[.24,.28,.33],gaWall:[.16,.19,.23],boothTop:[.3,.33,.38],boothWall:[.2,.23,.27],tableTop:[.38,.34,.29],tableWall:[.24,.21,.18]},Je={top:[.05,.06,.08],bottom:[.1,.12,.15]};function Pe(e,t){return[Math.min(1,e[0]*t),Math.min(1,e[1]*t),Math.min(1,e[2]*t)]}function Us(){let e=typeof window<"u"&&window.devicePixelRatio||1,t=navigator.deviceMemory,n=typeof t=="number"&&t<=4?1.5:2;return Math.min(e,n)}var Qt=class{constructor(t,n){this.clearRgb=[0,0,0];this.container=t,this.canvas=document.createElement("canvas"),this.canvas.style.display="block",this.canvas.style.width="100%",this.canvas.style.height="100%",this.canvas.style.touchAction="none",this.canvas.tabIndex=0,this.canvas.setAttribute("role","application"),this.canvas.setAttribute("aria-label","Interactive 3D venue. Drag or use arrow keys to look around; pinch, scroll, plus or minus to zoom."),this.renderer=new Xo.Renderer({canvas:this.canvas,dpr:Us(),alpha:!1,antialias:!1,depth:!0,stencil:!1,powerPreference:"high-performance",webgl:2}),this.gl=this.renderer.gl,this.clearRgb=[Je.top[0],Je.top[1],Je.top[2]],this.gl.clearColor(this.clearRgb[0],this.clearRgb[1],this.clearRgb[2],1),t.appendChild(this.canvas),this.lostHandler=r=>{r.preventDefault(),n.onContextLost()},this.restoredHandler=()=>n.onContextRestored(),this.canvas.addEventListener("webglcontextlost",this.lostHandler,!1),this.canvas.addEventListener("webglcontextrestored",this.restoredHandler,!1),this.resize()}setClearColor(t){this.clearRgb=[t[0],t[1],t[2]],this.gl.clearColor(t[0],t[1],t[2],1)}get clearColor(){return this.clearRgb}resize(){let t=Math.max(1,this.container.clientWidth||this.canvas.clientWidth||1),n=Math.max(1,this.container.clientHeight||this.canvas.clientHeight||1);return this.renderer.setSize(t,n),{width:t,height:n}}get pixelHeight(){return this.renderer.height*this.renderer.dpr}get aspect(){return this.renderer.width/Math.max(1,this.renderer.height)}dispose(){this.canvas.removeEventListener("webglcontextlost",this.lostHandler,!1),this.canvas.removeEventListener("webglcontextrestored",this.restoredHandler,!1);let t=this.gl.getExtension("WEBGL_lose_context");t&&t.loseContext(),this.canvas.parentNode&&this.canvas.parentNode.removeChild(this.canvas)}simulateContextLossCycle(){let t=this.gl.getExtension("WEBGL_lose_context");t&&(t.loseContext(),setTimeout(()=>{t.restoreContext&&t.restoreContext()},300))}};var ft=require("ogl"),he=Math.PI/180,Yn=15*he,Xn=80*he,dt=.12,Wo=35,Ko=1.25,qo=.006,Hs=4,pt=.82,Tt=1/pt,js=.12,Ys=2;function Xs(e,t){return{azimuth:e*qo,polar:-t*qo}}function Ws(e,t,n){let r=Math.max(Ys,Math.max(1,t)*js),o=n*Hs;return{minDist:e?Math.min(e.minDist,r):r,maxDist:e?Math.max(e.maxDist,o):o}}var Zt=class{constructor(t,n,r,o){this.fovY=Wo;this.target=new ft.Vec3;this.azimuth=-30*he;this.polar=55*he;this.distance=10;this.azT=-30*he;this.polT=55*he;this.distT=10;this.minDist=1;this.maxDist=100;this.envelope=null;this.gestureFired=!1;this.interactionEnabled=!0;this.dragging=!1;this.panning=!1;this.lastX=0;this.lastY=0;this.activePointers=new Map;this.pinchDist=0;this.pinchCx=0;this.pinchCy=0;this.targetT=new ft.Vec3;this.panAnchor=new ft.Vec3;this.panLimit=0;this.primaryDragMode="orbit";this.camera=new ft.Camera(t,{fov:Wo,near:.1,far:5e3,aspect:1}),this.canvas=n,this.requestRender=r,this.onGesture=o,this.onPointerDown=i=>{if(this.interactionEnabled){try{this.canvas.setPointerCapture?.(i.pointerId)}catch{}if(this.activePointers.set(i.pointerId,{x:i.clientX,y:i.clientY}),this.activePointers.size===1){let a=i.button===2||i.button===1,s=i.button===0&&(i.shiftKey?this.primaryDragMode==="orbit":this.primaryDragMode==="pan");this.panning=a||s,this.dragging=!this.panning,this.lastX=i.clientX,this.lastY=i.clientY}else if(this.activePointers.size===2){this.dragging=!1,this.panning=!1,this.pinchDist=this.currentPinchDistance();let a=this.pinchCentroid();this.pinchCx=a.x,this.pinchCy=a.y}}},this.onPointerMove=i=>{if(!this.interactionEnabled||!this.activePointers.has(i.pointerId))return;if(this.activePointers.set(i.pointerId,{x:i.clientX,y:i.clientY}),this.activePointers.size>=2){let u=this.currentPinchDistance();this.pinchDist>0&&(this.dollyBy(Math.exp((this.pinchDist-u)*.005)),this.fireGesture()),this.pinchDist=u;let d=this.pinchCentroid();this.panBy(d.x-this.pinchCx,d.y-this.pinchCy),this.pinchCx=d.x,this.pinchCy=d.y;return}let a=i.clientX-this.lastX,s=i.clientY-this.lastY;if(this.panning){this.lastX=i.clientX,this.lastY=i.clientY,(a!==0||s!==0)&&(this.panBy(a,s),this.fireGesture());return}if(!this.dragging)return;this.lastX=i.clientX,this.lastY=i.clientY,(a!==0||s!==0)&&this.fireGesture();let c=Xs(a,s);this.azT+=c.azimuth,this.polT=Math.max(Yn,Math.min(Xn,this.polT+c.polar)),this.requestRender()},this.onPointerUp=i=>{this.activePointers.delete(i.pointerId);try{this.canvas.releasePointerCapture?.(i.pointerId)}catch{}this.activePointers.size<2&&(this.pinchDist=0),this.activePointers.size===0&&(this.dragging=!1,this.panning=!1)},this.onContextMenu=i=>{i.preventDefault()},this.onWheel=i=>{if(i.preventDefault(),!this.interactionEnabled)return;let a=i.deltaMode===1?16:i.deltaMode===2?100:1,s=Math.max(-2,Math.min(2,i.deltaY*a/100));this.dollyBy(Math.exp(s*.22)),this.fireGesture()},this.onKeyDown=i=>{if(!this.interactionEnabled)return;let a=7*he;if(i.shiftKey&&(i.key==="ArrowLeft"||i.key==="ArrowRight"||i.key==="ArrowUp"||i.key==="ArrowDown"))this.panBy(i.key==="ArrowLeft"?-32:i.key==="ArrowRight"?32:0,i.key==="ArrowUp"?-32:i.key==="ArrowDown"?32:0);else if(i.key==="ArrowLeft"||i.key==="ArrowRight")this.azT+=i.key==="ArrowLeft"?-a:a;else if(i.key==="ArrowUp"||i.key==="ArrowDown")this.polT=Math.max(Yn,Math.min(Xn,this.polT+(i.key==="ArrowUp"?-a:a)));else if(i.key==="+"||i.key==="=")this.dollyBy(pt);else if(i.key==="-"||i.key==="_")this.dollyBy(Tt);else return;i.preventDefault(),this.fireGesture(),this.requestRender()},n.addEventListener("pointerdown",this.onPointerDown),n.addEventListener("pointermove",this.onPointerMove),n.addEventListener("pointerup",this.onPointerUp),n.addEventListener("pointercancel",this.onPointerUp),n.addEventListener("wheel",this.onWheel,{passive:!1}),n.addEventListener("keydown",this.onKeyDown),n.addEventListener("contextmenu",this.onContextMenu)}pinchCentroid(){let t=[...this.activePointers.values()];if(!t.length)return{x:0,y:0};let n=0,r=0;for(let o of t)n+=o.x,r+=o.y;return{x:n/t.length,y:r/t.length}}panBy(t,n){let r=this.canvas.clientHeight||1,o=2*this.distance*Math.tan(this.fovY*he/2)/r,i=Math.sin(this.azimuth),a=Math.cos(this.azimuth),s=a,c=-i,u=Math.cos(this.polar),d=Math.sin(this.polar),f=-i*u,m=-a*u;this.targetT.x+=(-t*s+n*f)*o,this.targetT.z+=(-t*c+n*m)*o,this.targetT.y+=n*d*o,this.clampPan(),this.requestRender()}clampPan(){if(this.panLimit<=0)return;let t=this.panLimit,n=this.panAnchor.x,r=this.panAnchor.y,o=this.panAnchor.z;this.targetT.x=Math.max(n-t,Math.min(n+t,this.targetT.x)),this.targetT.z=Math.max(o-t,Math.min(o+t,this.targetT.z)),this.targetT.y=Math.max(r-t*.5,Math.min(r+t,this.targetT.y))}fireGesture(){this.gestureFired||(this.gestureFired=!0,this.onGesture?.())}currentPinchDistance(){let t=[...this.activePointers.values()];return t.length<2?0:Math.hypot(t[0].x-t[1].x,t[0].y-t[1].y)}dollyBy(t){this.distT=Math.max(this.minDist,Math.min(this.maxDist,this.distT*t)),this.requestRender()}zoomBy(t){this.interactionEnabled&&(this.dollyBy(t),this.fireGesture())}dollyLimitState(){return{atMin:this.distT<=this.minDist+1e-6,atMax:this.distT>=this.maxDist-1e-6}}setPrimaryDragMode(t){this.primaryDragMode=t}setInteractionEnabled(t){this.interactionEnabled=t,!t&&(this.activePointers.clear(),this.dragging=!1,this.panning=!1,this.pinchDist=0)}frame(t,n=!1,r,o=!1,i){this.target.set(t.center[0],t.center[1],t.center[2]),this.targetT.copy(this.target),this.panAnchor.copy(this.target),this.panLimit=Math.max(1,t.radius)*1.5;let a=Math.max(1,t.radius),s=this.fovY*he/2,c=o?Math.max(.82,this.camera.aspect||1):this.camera.aspect||1,u=Math.atan(Math.tan(s)*c);this.azT=r??-30*he,this.polT=Math.max(15,Math.min(80,i?.polarDeg??55))*he;let d=this.fitDistance(t,s,u,this.azT,this.polT);this.distT=d*Math.max(1.05,Math.min(2,i?.margin??Ko)),this.envelope=Ws(this.envelope,a,d),this.minDist=this.envelope.minDist,this.maxDist=this.envelope.maxDist,n?(this.azimuth=this.azT,this.polar=12*he,this.distance=this.distT*1.7):(this.azimuth=this.azT,this.polar=this.polT,this.distance=this.distT),this.applyPosition()}setAspect(t){this.camera.perspective({aspect:t})}frameSoft(t,n,r=!1,o){this.target.set(t.center[0],t.center[1],t.center[2]),this.targetT.copy(this.target),this.panAnchor.copy(this.target),this.panLimit=Math.max(1,t.radius)*1.5,this.syncFromCamera(),this.camera.perspective({fov:this.fovY,aspect:this.camera.aspect});let i=this.fovY*he/2,a=r?Math.max(.82,this.camera.aspect||1):this.camera.aspect||1,s=Math.atan(Math.tan(i)*a);this.azT=n??this.azimuth,this.polT=Math.max(15,Math.min(80,o?.polarDeg??55))*he;let c=this.fitDistance(t,i,s,this.azT,this.polT);this.distT=c*Math.max(1.05,Math.min(2,o?.margin??Ko))}fitDistance(t,n,r,o,i){let a=Math.max(1,t.radius),s=Math.max(a/Math.tan(n),a/Math.tan(r)),c=t.box;if(!c)return s;let u=Math.sin(i),d=-u*Math.sin(o),f=-Math.cos(i),m=-u*Math.cos(o);if(Math.abs(f)>.999)return s;let l=-m,p=d,h=Math.hypot(l,p);l/=h,p/=h;let b=-p*f,y=p*d-l*m,v=l*f,S=Math.tan(r),M=Math.tan(n),R=1;for(let x=0;x<8;x++){let g=(x&1?c.max[0]:c.min[0])-t.center[0],C=(x&2?c.max[1]:c.min[1])-t.center[1],E=(x&4?c.max[2]:c.min[2])-t.center[2],D=g*d+C*f+E*m,B=Math.abs(g*l+E*p),L=Math.abs(g*b+C*y+E*v);R=Math.max(R,B/S-D,L/M-D)}return Math.min(s,Math.max(R,a*.35))}updateClipping(t){let n=this.camera.position.x-t.center[0],r=this.camera.position.y-t.center[1],o=this.camera.position.z-t.center[2],i=Math.hypot(n,r,o),a=Math.max(1,t.radius)*1.18,s=Math.max(.05,i-a),c=Math.max(s+10,i+a);this.camera.perspective({near:s,far:c,aspect:this.camera.aspect})}update(){let t=this.azT-this.azimuth,n=this.polT-this.polar,r=this.distT-this.distance,o=this.targetT.x-this.target.x,i=this.targetT.y-this.target.y,a=this.targetT.z-this.target.z,s=Math.max(1e-4,this.distance*1e-4),c=Math.abs(t)>1e-4||Math.abs(n)>1e-4||Math.abs(r)>1e-4||Math.abs(o)>s||Math.abs(i)>s||Math.abs(a)>s;return this.azimuth+=t*dt,this.polar+=n*dt,this.distance+=r*dt,this.target.x+=o*dt,this.target.y+=i*dt,this.target.z+=a*dt,c&&this.applyPosition(),c}get currentDistance(){return this.distance}syncFromCamera(){let t=this.camera.position.x-this.target.x,n=this.camera.position.y-this.target.y,r=this.camera.position.z-this.target.z,o=Math.hypot(t,n,r)||1,i=Math.max(Yn,Math.min(Xn,Math.acos(Math.max(-1,Math.min(1,n/o)))));this.distance=this.distT=o,this.polar=this.polT=i,this.azimuth=this.azT=Math.atan2(t,r)}setTarget(t){this.target.set(t[0],t[1],t[2]),this.targetT.copy(this.target)}resumeAfterFlight(t){this.camera.perspective({fov:this.fovY,aspect:this.camera.aspect}),t&&this.target.set(t[0],t[1],t[2]),this.targetT.copy(this.target),this.syncFromCamera()}applyPosition(){let t=Math.sin(this.polar),n=this.target.x+this.distance*t*Math.sin(this.azimuth),r=this.target.y+this.distance*Math.cos(this.polar),o=this.target.z+this.distance*t*Math.cos(this.azimuth);this.camera.position.set(n,r,o),this.camera.lookAt(this.target)}dispose(){this.canvas.removeEventListener("pointerdown",this.onPointerDown),this.canvas.removeEventListener("pointermove",this.onPointerMove),this.canvas.removeEventListener("pointerup",this.onPointerUp),this.canvas.removeEventListener("pointercancel",this.onPointerUp),this.canvas.removeEventListener("wheel",this.onWheel),this.canvas.removeEventListener("keydown",this.onKeyDown),this.canvas.removeEventListener("contextmenu",this.onContextMenu),this.activePointers.clear()}};var Jt=class{constructor(t){this.rafId=0;this.running=!1;this.lastTime=0;this.fpsEma=0;this.rendered=0;this.tick=t=>{let n=this.lastTime?(t-this.lastTime)/1e3:.016666666666666666;if(this.lastTime=t,n>0){let o=1/n;this.fpsEma=this.fpsEma?this.fpsEma*.9+o*.1:o}this.rendered++,this.frame(n)?this.rafId=requestAnimationFrame(this.tick):(this.running=!1,this.rafId=0)};this.frame=t}requestRender(){this.running||(this.running=!0,this.lastTime=0,this.rafId=requestAnimationFrame(this.tick))}stats(){return{fps:this.running?Math.round(this.fpsEma):0,rendered:this.rendered,idle:!this.running}}stop(){this.rafId&&cancelAnimationFrame(this.rafId),this.rafId=0,this.running=!1}};function $o(e,t,n){return Math.max(t,Math.min(n,e))}var ht=2.5,Ks=1.15,_t=6,bt=10,Qo=6,Zo=9.5,Jo=.9,er=2.2,Wn=30,Kn=4,en=8192;var Ld=bt+Kn;function tr(e,t){let n=t*1.4,r=t*3.2;if(e<=n)return{scale:1,fade:0,minPixels:ht};let o=Math.min(1,(e-n)/Math.max(.001,r-n));return{scale:1-o*.4,fade:o*.55,minPixels:ht+o*(Ks-ht)}}function nr(e,t,n){return!(e>0)||!(t>0)||!(n>0)?!1:t*n/e>=64}function or(e,t,n,r,o){if(!(e>0)||!(t>0)||!(n>0)||!(r>0)||!(o>0))return!1;let i=Math.tan(r/2*Math.PI/180);if(!(i>0))return!1;let a=t/(n*i)*(o/2);return Math.PI*a*a/e>=64}var qs=[{key:"wheelchair",label:"Wheelchair space",short:"Wheelchair",icon:"\u267F"},{key:"companion",label:"Companion seat",short:"Companion",icon:"\u{1F9D1}\u200D\u{1F91D}\u200D\u{1F9D1}"},{key:"semi-ambulatory",label:"Semi-ambulatory (limited mobility)",short:"Limited mobility",icon:"\u{1F9AF}"},{key:"designated-aisle",label:"Designated aisle / transfer seat",short:"Aisle transfer",icon:"AS"},{key:"step-free",label:"Step-free accessible seat",short:"Step-free",icon:"SF"},{key:"hearing",label:"Assistive listening",short:"Hearing",icon:"\u{1F9BB}"},{key:"cart",label:"CART live-caption view",short:"CART captions",icon:"CC"},{key:"sign-language",label:"Sign-language view",short:"Sign language",icon:"\u{1F91F}"},{key:"low-vision",label:"Blind / low-vision viewing",short:"Low vision",icon:"LV"},{key:"sensory-friendly",label:"Quiet / sensory-friendly seating",short:"Sensory-friendly",icon:"QS"},{key:"plus-size",label:"Plus-size seat",short:"Plus-size",icon:"\u{1F4BA}"},{key:"lift-armrest",label:"Lift-up armrest",short:"Lift armrest",icon:"\u2195\uFE0F"}],Fd=new Map(qs.map(e=>[e.key,e]));var $s={wheelchair:"#3b82f6",companion:"#8b5cf6","semi-ambulatory":"#0ea5e9","designated-aisle":"#0284c7","step-free":"#16a34a",hearing:"#14b8a6",cart:"#7c3aed","sign-language":"#f59e0b","low-vision":"#d97706","sensory-friendly":"#6366f1","plus-size":"#ec4899","lift-armrest":"#22c55e"};function rr(e){let t=e?.[0];return t&&$s[t]||"#3b82f6"}var Qs=[{key:"obstructedView",label:"Obstructed view",short:"Obstructed",icon:"\u26D4"},{key:"restrictedView",label:"Restricted view",short:"Restricted",icon:"\u{1F441}"},{key:"premium",label:"Premium seat",short:"Premium",icon:"\u2605"}],Dd=new Map(Qs.map(e=>[e.key,e]));var Zs=["reference-focal","bar","entrance","exit","restroom","screen","sound","concession","coat","wall","rail","suite","obstruction"],Od=new Set(Zs);var ar=[{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}}],sr=ar.map(e=>e.key),Js=new Map(ar.map(e=>[e.key,e]));function ir(e){return typeof e=="string"&&Js.has(e)}function cr(e,t){return ir(e)?e:ir(t?.seatGlyph)?t.seatGlyph:"circle"}var be=.02291666666666667,He=1/be,ec=58,tc=ec*be;var nc=3,lr=0,qn=120,oc=0,rc=45,ic=7,Ie=1.2;function $n(e,t,n,r){return Number.isFinite(e)?Math.max(t,Math.min(n,e)):r}function ac(e){return!Number.isFinite(e)||!Number.isInteger(e)||e<0?0:e<=ic?e:nc}function tn(e,t={}){let n=$n(t.floorBaseHeightM,lr,qn,0),r=Math.min(qn,n+ac(e.elevation)*tc),o=e.height===void 0?r:$n(e.height,lr,qn,r),i=$n(e.rake,oc,rc,0);return{height:o,rake:i}}var mr=mt(require("earcut"),1),dr=mt(require("polygon-clipping"),1);var Ud=Math.PI/180;function Qn(e){let t=0,n=0;for(let o of e)t+=o.x,n+=o.y;let r=e.length||1;return{x:t/r,y:n/r}}function Lt(e){return e.length?Qn(e):null}function et(e){let t=0;for(let n=0,r=e.length;n<r;n+=1){let o=e[n],i=e[(n+1)%r];t+=o.x*i.y-i.x*o.y}return t/2}function kt(e,t,n){let r=!1;for(let o=0,i=e.length-1;o<e.length;i=o++){let a=e[o],s=e[i];a.y>n!=s.y>n&&t<(s.x-a.x)*(n-a.y)/(s.y-a.y)+a.x&&(r=!r)}return r}var z=be,sc=.002;function cc(e,t,n){let r=Math.hypot(t[0]-e[0],t[1]-e[1],t[2]-e[2]),o=Math.hypot(n[0]-t[0],n[1]-t[1],n[2]-t[2]),i=Math.hypot(e[0]-n[0],e[1]-n[1],e[2]-n[2]),a=Math.max(r,o,i);if(a<1e-9)return!0;let s=(r+o+i)/2;return 2*Math.sqrt(Math.max(0,s*(s-r)*(s-o)*(s-i)))/a<sc}var tt=class{constructor(t=16384){this.len=0;this.buf=new Float32Array(t)}push3(t,n,r){this.len+3>this.buf.length&&this.grow(this.len+3),this.buf[this.len++]=t,this.buf[this.len++]=n,this.buf[this.len++]=r}push1(t){this.len+1>this.buf.length&&this.grow(this.len+1),this.buf[this.len++]=t}grow(t){let n=this.buf.length*2;for(;n<t;)n*=2;let r=new Float32Array(n);r.set(this.buf.subarray(0,this.len)),this.buf=r}get length(){return this.len}toArray(){return this.buf.slice(0,this.len)}},rn=class{constructor(){this.pos=new tt;this.nor=new tt;this.col=new tt;this.flr=new tt;this.mat=new tt;this.currentFloor=0;this.currentMaterial=0}setFloor(t){this.currentFloor=t}setMaterial(t){this.currentMaterial=t}tri(t,n,r,o,i,a=i,s=i){cc(t,n,r)||(this.pos.push3(t[0],t[1],t[2]),this.pos.push3(n[0],n[1],n[2]),this.pos.push3(r[0],r[1],r[2]),this.nor.push3(o[0],o[1],o[2]),this.nor.push3(o[0],o[1],o[2]),this.nor.push3(o[0],o[1],o[2]),this.col.push3(i[0],i[1],i[2]),this.col.push3(a[0],a[1],a[2]),this.col.push3(s[0],s[1],s[2]),this.flr.push1(this.currentFloor),this.flr.push1(this.currentFloor),this.flr.push1(this.currentFloor),this.mat.push1(this.currentMaterial),this.mat.push1(this.currentMaterial),this.mat.push1(this.currentMaterial))}triN(t,n,r,o,i,a,s,c=s,u=s){[...t,...n,...r].every(Number.isFinite)&&(this.pos.push3(t[0],t[1],t[2]),this.pos.push3(n[0],n[1],n[2]),this.pos.push3(r[0],r[1],r[2]),this.nor.push3(o[0],o[1],o[2]),this.nor.push3(i[0],i[1],i[2]),this.nor.push3(a[0],a[1],a[2]),this.col.push3(s[0],s[1],s[2]),this.col.push3(c[0],c[1],c[2]),this.col.push3(u[0],u[1],u[2]),this.flr.push1(this.currentFloor),this.flr.push1(this.currentFloor),this.flr.push1(this.currentFloor),this.mat.push1(this.currentMaterial),this.mat.push1(this.currentMaterial),this.mat.push1(this.currentMaterial))}get vertexCount(){return this.pos.length/3}build(){return{position:this.pos.toArray(),normal:this.nor.toArray(),color:this.col.toArray(),floor:this.flr.toArray(),material:this.mat.toArray(),count:this.pos.length/3}}};function lc(e,t,n){let r=t[0]-e[0],o=t[1]-e[1],i=t[2]-e[2],a=n[0]-e[0],s=n[1]-e[1],c=n[2]-e[2],u=o*c-i*s,d=i*a-r*c,f=r*s-o*a,m=Math.hypot(u,d,f)||1;return u/=m,d/=m,f/=m,[u,d,f]}function uc(e,t){let n=[...e],r=[];for(let a of e)r.push(a.x,a.y);let o=[];if(t){for(let a of t)if(!(a.length<3)){o.push(n.length);for(let s of a)n.push(s),r.push(s.x,s.y)}}let i=(0,mr.default)(r,o.length?o:void 0,2);return{pts:n,tris:i}}function Zn(e){return et(e)<0?[...e].reverse():e}var mc=3;function dc(e,t,n,r){let o=r(e),i=r(t),a=r(n),s=(l,p,h,b)=>Math.abs(r({x:(l.x+p.x)/2,y:(l.y+p.y)/2})-(h+b)/2),c=(e.x+t.x+n.x)/3,u=(e.y+t.y+n.y)/3,d=(o+i+a)/3,f=Math.max(s(e,t,o,i),s(t,n,i,a),s(n,e,a,o),Math.abs(r({x:c,y:u})-d)),m=(l,p,h)=>{let b=Math.abs(r({x:(l+c)/2,y:(p+u)/2})-(h+d)/2);b>f&&(f=b)};return m((e.x+t.x)/2,(e.y+t.y)/2,(o+i)/2),m((t.x+n.x)/2,(t.y+n.y)/2,(i+a)/2),m((n.x+e.x)/2,(n.y+e.y)/2,(a+o)/2),f}function Ft(e,t,n,r,o){if(o<=0)return dc(e,t,n,r);let i={x:(e.x+t.x)/2,y:(e.y+t.y)/2},a={x:(t.x+n.x)/2,y:(t.y+n.y)/2},s={x:(n.x+e.x)/2,y:(n.y+e.y)/2};return Math.max(Ft(e,i,s,r,o-1),Ft(i,t,a,r,o-1),Ft(s,a,n,r,o-1),Ft(i,a,s,r,o-1))}function Dt(e,t,n,r,o,i,a,s){if(a>0){let m={x:(t.x+n.x)/2,y:(t.y+n.y)/2},l={x:(n.x+r.x)/2,y:(n.y+r.y)/2},p={x:(r.x+t.x)/2,y:(r.y+t.y)/2};Dt(e,t,m,p,o,i,a-1,s),Dt(e,m,n,l,o,i,a-1,s),Dt(e,p,l,r,o,i,a-1,s),Dt(e,m,l,p,o,i,a-1,s);return}let c=[t.x*z,o(t),t.y*z],u=[n.x*z,o(n),n.y*z],d=[r.x*z,o(r),r.y*z];if(s){e.triN(c,u,d,s(t),s(n),s(r),i);return}let f=lc(c,u,d);f[1]<0&&(f=[-f[0],-f[1],-f[2]]),e.tri(c,u,d,f,i)}var fc=8;function ur(e,t,n){if(!Number.isFinite(n))return e;let r=[],o=(i,a,s,c,u)=>{if(u>0){let d={x:(i.x+a.x)/2,y:(i.y+a.y)/2},f=t(d);if(Math.abs(f-(s+c)/2)>n){o(i,d,s,f,u-1),o(d,a,f,c,u-1);return}}r.push(i)};for(let i=0;i<e.length;i++){let a=e[i],s=e[(i+1)%e.length];o(a,s,t(a),t(s),fc)}return r}function nn(e,t){if(e.length<3)return e;let n=[];for(let o of e){let i=n[n.length-1];i&&Math.hypot(o.x-i.x,o.y-i.y)<t||n.push(o)}for(;n.length>2&&Math.hypot(n[0].x-n[n.length-1].x,n[0].y-n[n.length-1].y)<t;)n.pop();if(n.length<3)return e;let r=[];for(let o=0;o<n.length;o++){let i=r.length?r[r.length-1]:n[(o-1+n.length)%n.length],a=n[o],s=n[(o+1)%n.length],c=s.x-i.x,u=s.y-i.y,d=Math.hypot(c,u);d>t&&Math.abs((a.x-i.x)*u-(a.y-i.y)*c)/d<t||r.push(a)}return r.length>=3?r:n}var on=.001*He*.1;function ue(e,t,n,r,o,i,a,s,c=1/0,u){if(!t||t.length<3||(c===void 0&&(c=1/0),Math.abs(et(t))<1e-4))return;let d=nn(ur(nn(Zn(t),on),r,c),on),f=n?.map(x=>nn(ur(nn(Zn(x),on),r,c),on)).filter(x=>x.length>=3&&Math.abs(et(x))>=1e-4),{pts:m,tris:l}=uc(d,f),p=[i[0]*s.top,i[1]*s.top,i[2]*s.top],h=[i[0]*s.bottomCap,i[1]*s.bottomCap,i[2]*s.bottomCap],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],v=0;if(Number.isFinite(c))for(;v<mc;v++){let x=0;for(let g=0;g<l.length;g+=3){let C=Ft(m[l[g]],m[l[g+1]],m[l[g+2]],r,v);C>x&&(x=C)}if(x<=c)break}for(let x=0;x<l.length;x+=3){let g=m[l[x]],C=m[l[x+1]],E=m[l[x+2]];Dt(e,g,C,E,r,p,v,u);let D=[g.x*z,o,g.y*z],B=[C.x*z,o,C.y*z],L=[E.x*z,o,E.y*z];e.tri(D,L,B,[0,-1,0],h)}let S=x=>{if(v<=0)return x;let g=1<<v,C=[];for(let E=0;E<x.length;E++){let D=x[E],B=x[(E+1)%x.length];for(let L=0;L<g;L++){let A=L/g;C.push({x:D.x+(B.x-D.x)*A,y:D.y+(B.y-D.y)*A})}}return C},M=Qn(d),R=[{ring:S(d),flip:!1}];if(f)for(let x of f)x.length>=3&&R.push({ring:S(x),flip:!0});for(let{ring:x,flip:g}of R)for(let C=0;C<x.length;C++){let E=x[C],D=x[(C+1)%x.length],B=(D.x-E.x)*z,A=(D.y-E.y)*z,k=-B,N=Math.hypot(A,k)||1;A/=N,k/=N;let w=(E.x+D.x)/2-M.x,T=(E.y+D.y)/2-M.y,_=A*w+k*T;g&&(_=-_),_<0&&(A=-A,k=-k);let P=[A,0,k],O=[E.x*z,r(E),E.y*z],I=[D.x*z,r(D),D.y*z],F=[E.x*z,o,E.y*z],H=[D.x*z,o,D.y*z];e.tri(O,I,H,P,b,b,y),e.tri(O,H,F,P,b,y,y)}}function fr(e){let t=0;for(let c of e)t+=c.count;let n=new Float32Array(t*3),r=new Float32Array(t*3),o=new Float32Array(t*3),i=new Float32Array(t),a=new Float32Array(t),s=0;for(let c of e)n.set(c.position,s*3),r.set(c.normal,s*3),o.set(c.color,s*3),i.set(c.floor,s),a.set(c.material,s),s+=c.count;return{position:n,normal:r,color:o,floor:i,material:a,count:t}}function an(e,t,n=2.5){if(t<=0||e.length<3)return e;let r=Zn(e),o=r.length,i=[];for(let s=0;s<o;s++){let c=r[s],u=r[(s+1)%o],d=u.x-c.x,f=u.y-c.y,m=Math.hypot(d,f)||1;i.push({x:f/m,y:-d/m})}let a=[];for(let s=0;s<o;s++){let c=r[s],u=i[(s-1+o)%o],d=i[s],f=u.x+d.x,m=u.y+d.y,l=Math.hypot(f,m),p=()=>{a.push([c.x+u.x*t,c.y+u.y*t]),a.push([c.x+d.x*t,c.y+d.y*t])};if(l<1e-9){p();continue}f/=l,m/=l;let h=f*u.x+m*u.y,b=1/Math.max(h,1e-6);if(!Number.isFinite(b)||b>n){p();continue}a.push([c.x+f*t*b,c.y+m*t*b])}if(a.length<3)return e;try{let s=dr.default.union([[...a,a[0]]]),c=null,u=-1/0;for(let f of s){let m=Math.abs(et(f[0].map(([l,p])=>({x:l,y:p}))));m>u&&(u=m,c=f[0])}if(!c)return e;let d=c.map(([f,m])=>({x:f,y:m}));if(d.length>1){let f=d[0],m=d[d.length-1];Math.abs(f.x-m.x)<1e-9&&Math.abs(f.y-m.y)<1e-9&&d.pop()}return d.length>=3?d:e}catch{return e}}function sn(e,t,n,r,o=28){let i=[];for(let a=0;a<o;a++){let s=a/o*Math.PI*2;i.push({x:e+n*Math.cos(s),y:t+r*Math.sin(s)})}return i}function Ot(e,t,n,r){return[{x:e,y:t},{x:e+n,y:t},{x:e+n,y:t+r},{x:e,y:t+r}]}var ae={pedestal:0,pad:1,back:2,arm:3,footrest:4,leg:5,body:10,head:11},pc=.44,hc=.15,pr=.3,bc=.24;function hr(e){return e===void 0||!Number.isFinite(e)||e<=0?bc:Math.min(pr,Math.max(hc,e*pc))}var Jn=.21,yc=.05,eo=.45,cn=eo+yc,br=.92,to=1.205,yr=-.23,gr=.38,gc=[{part:ae.pedestal,min:[-.3,0,-.3],max:[.3,.36,.3]},{part:ae.pad,min:[-1,.36,-.95],max:[1,eo,1]},{part:ae.back,min:[-1,cn,-1],max:[1,br,-.72]},{part:ae.arm,min:[-1,.44,-.82],max:[-.78,.65,.78]},{part:ae.arm,min:[.78,.44,-.82],max:[1,.65,.78]},{part:ae.footrest,min:[-.9,.18,.78],max:[.9,.31,1.34]},{part:ae.leg,min:[-.82,0,-.7],max:[-.62,.37,-.48]},{part:ae.leg,min:[.62,0,-.7],max:[.82,.37,-.48]},{part:ae.leg,min:[-.82,0,.48],max:[-.62,.37,.7]},{part:ae.leg,min:[.62,0,.48],max:[.82,.37,.7]}],xc=[{part:ae.body,min:[-.52,.39,-.08],max:[-.08,.55,.82]},{part:ae.body,min:[.08,.39,-.08],max:[.52,.55,.82]},{part:ae.body,min:[-.47,.05,.58],max:[-.13,.43,.82]},{part:ae.body,min:[.13,.05,.58],max:[.47,.43,.82]},{part:ae.head,min:[-.16,1.04,-.33],max:[.16,1.1,-.13]}],vc=[{n:[1,0,0],c:[[1,0,0],[1,1,0],[1,1,1],[1,0,1]]},{n:[-1,0,0],c:[[0,0,1],[0,1,1],[0,1,0],[0,0,0]]},{n:[0,1,0],c:[[0,1,0],[0,1,1],[1,1,1],[1,1,0]]},{n:[0,-1,0],c:[[0,0,1],[0,0,0],[1,0,0],[1,0,1]]},{n:[0,0,1],c:[[0,0,1],[1,0,1],[1,1,1],[0,1,1]]},{n:[0,0,-1],c:[[1,0,0],[0,0,0],[0,1,0],[1,1,0]]}];function xr(){let e=[],t=[],n=[],r=[],o=(N,w,T)=>{let _=n.length,[P,O,I]=N,F=[O[0]-P[0],O[1]-P[1],O[2]-P[2]],H=[I[0]-P[0],I[1]-P[1],I[2]-P[2]],j=F[1]*H[2]-F[2]*H[1],G=F[2]*H[0]-F[0]*H[2],V=F[0]*H[1]-F[1]*H[0],W=Math.hypot(j,G,V);W>1e-9?(j/=W,G/=W,V/=W):[j,G,V]=w,j*w[0]+G*w[1]+V*w[2]<0&&(j=-j,G=-G,V=-V);for(let X of N)e.push(...X),t.push(j,G,V),n.push(T);r.push(_,_+1,_+2,_,_+2,_+3)},i=N=>{for(let w of vc){let T=w.c.map(_=>_.map((P,O)=>P?N.max[O]:N.min[O]));o(T,w.n,N.part)}};for(let N of gc)i(N);for(let N of xc)i(N);let a=eo,s=1.08,c=.47,u=.69,d=-.55,f=.08,m=-.48,l=.01,p=[-c,a,d],h=[c,a,d],b=[-c,a,f],y=[c,a,f],v=[-u,s,m],S=[u,s,m],M=[-u,s,l],R=[u,s,l];o([h,S,R,y],[1,0,0],ae.body),o([b,M,v,p],[-1,0,0],ae.body),o([M,R,S,v],[0,1,0],ae.body),o([p,h,y,b],[0,-1,0],ae.body),o([y,R,M,b],[0,0,1],ae.body),o([p,v,S,h],[0,0,-1],ae.body);let x=10,g=8,C=[0,to,yr],E=[.42,.115,gr],D=n.length;for(let N=0;N<=g;N++){let w=Math.PI*N/g,T=Math.cos(w),_=Math.sin(w);for(let P=0;P<=x;P++){let O=Math.PI*2*P/x,I=_*Math.cos(O),F=_*Math.sin(O);e.push(C[0]+E[0]*I,C[1]+E[1]*T,C[2]+E[2]*F);let H=I/E[0],j=T/E[1],G=F/E[2],V=Math.hypot(H,j,G)||1;H/=V,j/=V,G/=V,t.push(H,j,G),n.push(ae.head)}}for(let N=0;N<g;N++)for(let w=0;w<x;w++){let T=D+N*(x+1)+w,_=T+x+1;r.push(T,_,T+1,T+1,_,_+1)}let B=new Float32Array(e),L=new Float32Array(t),A=new Float32Array(n),k=new Uint16Array(r);return{position:B,normal:L,part:A,index:k,vertexCount:n.length,indexCount:r.length}}function vr(e,t,n,r){let o=new Float32Array(t),i=u=>e[u*3],a=u=>e[u*3+2],s=0,c=(u,d)=>{let f=d-u;for(let m=u;m<d;m++){let[l,p]=r(m),h=l-i(m),b=p-a(m);if(f>=2){let y=Math.max(u,m-1),v=Math.min(d-1,m+1),S=i(v)-i(y),M=a(v)-a(y),R=Math.hypot(S,M);if(R>1e-6){let x=-M/R,g=S/R;x*h+g*b<0&&(x=-x,g=-g),h=x,b=g}}o[m]=h===0&&b===0?0:Math.atan2(h,b)}};for(let u=1;u<=t;u++)(u===t||n(u)!==n(s))&&(c(s,u),s=u);return o}var De=.22;function Sr(e,t){let n=pe[e];if(n!=="sold"&&n!=="held")return-1;let r=(t+1)*2654435761;return r^=r>>>15,r=Math.imul(r,2246822519),r^=r>>>13,(r>>>0)%1e5/1e5}var Sc=.42;function Mc(e){let t=e.length,n=new Float64Array(t);if(t<2)return n.fill(1/0),n;let r=1/0,o=1/0,i=-1/0,a=-1/0;for(let p of e)p.x<r&&(r=p.x),p.y<o&&(o=p.y),p.x>i&&(i=p.x),p.y>a&&(a=p.y);let s=Math.max(i-r,1e-6),c=Math.max(a-o,1e-6),u=Math.max(Math.sqrt(s*c/t),1e-6),d=Math.max(1,Math.ceil(s/u)+1),f=Math.max(1,Math.ceil(c/u)+1),m=new Map,l=(p,h)=>{let b=Math.min(d-1,Math.max(0,Math.floor((p-r)/u)));return Math.min(f-1,Math.max(0,Math.floor((h-o)/u)))*d+b};for(let p=0;p<t;p++){let h=l(e[p].x,e[p].y),b=m.get(h);b?b.push(p):m.set(h,[p])}for(let p=0;p<t;p++){let h=e[p],b=Math.min(d-1,Math.max(0,Math.floor((h.x-r)/u))),y=Math.min(f-1,Math.max(0,Math.floor((h.y-o)/u))),v=1/0;for(let S=1;S<=4;S++){for(let M=y-S;M<=y+S;M++)if(!(M<0||M>=f))for(let R=b-S;R<=b+S;R++){if(R<0||R>=d||S>1&&Math.abs(M-y)<S&&Math.abs(R-b)<S)continue;let x=m.get(M*d+R);if(x)for(let g of x){if(g===p)continue;let C=Math.hypot(e[g].x-h.x,e[g].y-h.y);C<v&&(v=C)}}if(Number.isFinite(v)&&v<=S*u)break}n[p]=v}return n}function wc(e){let t=e.eyeHeightM;return Number.isFinite(t)?Math.max(0,t-Ie):0}function Mr(e,t,n,r,o,i){let a=e.length,s=new Float32Array(a*3),c=new Float32Array(a),u=new Float32Array(a*3),d=new Float32Array(a),f=new Float32Array(a),m=new Float32Array(a),l=new Float32Array(a),p=new Float32Array(a*3),h=new Map,b=Mc(e);for(let y=0;y<a;y++){let v=e[y],M=(n?.seatPitchU(y)??b[y])*z;d[y]=Number.isFinite(M)?Math.max(.06,Math.min(De,M*Sc)):De,f[y]=hr(Number.isFinite(M)?M:void 0);let R=cr(v.glyph,{seatGlyph:i?.get(v.categoryKey)});m[y]=sr.indexOf(R),l[y]=v.wheelchairSpaceType==="no-seat"?0:1,s[y*3]=v.x*z,s[y*3+1]=n?n.seatDeckY(y):wc(v),s[y*3+2]=v.y*z,c[y]=It(t?t(v):"available");let x=ne(o?.get(v.categoryKey)??"#6e7bff")??[.43,.48,1];if(u[y*3]=x[0],u[y*3+1]=x[1],u[y*3+2]=x[2],v.accessibility?.length){let g=ne(rr(v.accessibility));g&&(p[y*3]=g[0],p[y*3+1]=g[1],p[y*3+2]=g[2])}h.set(v.id,y)}return{count:a,iPosition:s,iState:c,iCategory:u,iMaxRadius:d,iRing:p,idToIndex:h,iChairWidth:f,iGlyph:m,iPhysicalSeat:l,iFloor:r??new Float32Array(a),iYaw:new Float32Array(a)}}var Pc=64;function no(e,t){let n=[];for(let a of t){let s=e.idToIndex.get(a.seatId);if(s===void 0)continue;let c=It(a.state);e.iState[s]!==c&&(e.iState[s]=c,n.push(s))}if(!n.length)return[];n.sort((a,s)=>a-s);let r=[],o=n[0],i=n[0];for(let a=1;a<n.length;a++){let s=n[a];if(s!==i){if(s<=i+Pc){i=s;continue}r.push({start:o,length:i-o+1}),o=s,i=s}}return r.push({start:o,length:i-o+1}),r}var Cc=.15,Ac=1.6;function wr(e){return $o(e??1,Cc,Ac)}var Rc=.15,Ec=.9,Ic=1.76;function Tc(){return{background:{top:[...Je.top],bottom:[...Je.bottom]},structure:jn,seatStates:{...jo},seatScale:1,materials:{seat:null,shell:null,roughness:.78}}}function Pr(e){let t=Tc();if(!e)return t;let n=ne(e.background);if(n){t.background={top:Pe(n,Ec),bottom:Pe(n,Ic)};let a={};for(let[s,c]of Object.entries(jn))a[s]=ge(c,n,Rc);t.structure=a}let r=ne(e.selectionColor)??ne(e.accent);r&&(t.seatStates={...t.seatStates,selected:r});let o=e.seatScale;typeof o=="number"&&Number.isFinite(o)&&(t.seatScale=wr(o));let i=e.venue3d;if(i){let a=ne(i.deck),s=ne(i.fascia);a&&(t.structure={...t.structure,tierTop:a,gaTop:a}),s&&(t.structure={...t.structure,tierWall:s,gaWall:s}),t.materials.seat=ne(i.seat),t.materials.shell=ne(i.shell),typeof i.roughness=="number"&&Number.isFinite(i.roughness)&&(t.materials.roughness=Math.min(1,Math.max(0,i.roughness)))}return t}function Cr(e,t){let n=[];for(let r of t)n.push(...e.seatStates[r]);return n}function Ar(e,t){let n=1-t,r=n*n*n,o=3*n*n*t,i=3*n*t*t,a=t*t*t;return{x:r*e.start.x+o*e.control1.x+i*e.control2.x+a*e.end.x,y:r*e.start.y+o*e.control1.y+i*e.control2.y+a*e.end.y}}function Rr(e,t,n=192){if(!Number.isInteger(t)||t<1)throw new Error("Path point count must be a positive integer");if(t===1)return[Ar(e,.5)];let r=Array.from({length:n+1},(c,u)=>Ar(e,u/n)),o=new Float64Array(r.length);for(let c=1;c<r.length;c+=1){let u=r[c].x-r[c-1].x,d=r[c].y-r[c-1].y;o[c]=o[c-1]+Math.hypot(u,d)}let i=o[o.length-1];if(i<=1e-9)return Array.from({length:t},()=>({...e.start}));let a=[],s=1;for(let c=0;c<t;c+=1){let u=i*c/(t-1);for(;s<o.length-1&&o[s]<u;)s+=1;let d=o[s-1],f=o[s],m=f===d?0:(u-d)/(f-d);a.push({x:r[s-1].x+(r[s].x-r[s-1].x)*m,y:r[s-1].y+(r[s].y-r[s-1].y)*m})}return a}function Er(e){let t=new Map,n=new Map;for(let r of e){if(r.type!=="row"||!r.segmentedRow)continue;let o=n.get(r.segmentedRow.groupId)??[];o.push(r),n.set(r.segmentedRow.groupId,o)}for(let[r,o]of n){let i=o.slice().sort((m,l)=>m.segmentedRow.componentIndex-l.segmentedRow.componentIndex),a=i[0]?.segmentedRow?.componentCount??0,s=i[0]?.segmentedRow;if(!s||!(a>=2&&i.length===a&&s?.boundaryBefore==="start"&&i.every((m,l)=>m.segmentedRow?.kind==="segmented-row-v1"&&m.segmentedRow.groupId===r&&m.segmentedRow.componentCount===a&&m.segmentedRow.componentIndex===l&&m.segmentedRow.repeatLabelOnComponents===s.repeatLabelOnComponents&&(l===0?m.segmentedRow.boundaryBefore==="start":m.segmentedRow.boundaryBefore!=="start")&&m.segmentedRow.displayLabel===s.displayLabel)))continue;let u=i.reduce((m,l)=>m+l.seatCount,0),d=0,f=0;for(let m of i)m.segmentedRow.boundaryBefore==="break"&&(d+=1),t.set(m.id,{groupId:r,adjacencyOffset:d,displayOffset:f,displayLabel:s.displayLabel,totalSeats:u,canonical:i[0],viewFromSeatUrl:s.viewFromSeatUrl,viewFromSeatMeta:s.viewFromSeatMeta,confidenceEvidence:s.confidenceEvidence}),d+=m.seatCount,f+=m.seatCount}return t}var _c="ABCDEFGHIJKLMNOPQRSTUVWXYZ";var Lc="abcdefghijklmnopqrstuvwxyz";function kc(e,t){let n=t.length,r=e+1,o="";for(;r>0;){r-=1;let i=r%n;o=t[i]+o,r=Math.floor(r/n)}return o}function oo(e,t=!1){let n=t?Lc:_c;return kc(Math.max(0,Math.floor(e)-1),n)}var Fc=[[1e3,"M"],[900,"CM"],[500,"D"],[400,"CD"],[100,"C"],[90,"XC"],[50,"L"],[40,"XL"],[10,"X"],[9,"IX"],[5,"V"],[4,"IV"],[1,"I"]];function Ir(e){if(!Number.isFinite(e)||e<=0)return String(e);let t=Math.floor(e),n="";for(let[r,o]of Fc)for(;t>=r;)n+=o,t-=r;return n}function Dc(e){let t=new Array(e);return Array.from({length:e},(n,r)=>r).sort((n,r)=>Math.abs(2*n-(e-1))-Math.abs(2*r-(e-1))||n-r).forEach((n,r)=>t[n]=r),t}function ln(e,t){let n=e.seatLabelStart??1,r=e.seatNumbering?.direction??"ltr",o=e.seatNumbering?.step??1,i=e.seatNumbering?.scheme??"decimal",a=e.seatNumbering?.prefix??"",s=e.seatNumbering?.endAt,c=e.seatCount;if(i==="updown"||i==="updown-descending"){let l=Math.ceil(c/2),p=i==="updown"?t<l?n+2*t:n-1+2*(c-t):t<l?n+2*(l-1-t):n+1+2*(t-l);return`${a}${p}`}let u=i==="odd"||i==="even"?2:o,d=s!=null&&Number.isFinite(s)?s-(c-1)*u:n,f=r==="center"?Dc(c)[t]:r==="rtl"?c-1-t:t,m;switch(i){case"odd":{let l=d%2===1?d:d+1;m=String(l+f*2);break}case"even":{let l=d%2===0?d:d+1;m=String(l+f*2);break}case"roman":m=Ir(d+f*o);break;case"letters-upper":m=oo(d+f*o,!1);break;case"letters-lower":m=oo(d+f*o,!0);break;default:m=String(d+f*o);break}return`${a}${m}`}function Oc(e){return{...e.canonical,seatCount:e.totalSeats,label:e.displayLabel,displayLabel:e.displayLabel}}function Tr(e,t,n){return n?.label??`${e.seatLabelBase??e.label}-${ln(e,t)}`}function ro(e,t,n,r){if(r?.displayLabel)return r.displayLabel;if(e.seatDisplayLabelMode==="number")return ln(e,t);if(!n)return`${e.displayLabel||e.label}-${ln(e,t)}`;let o=Oc(n),i=n.displayOffset+t;return`${n.displayLabel}-${ln(o,i)}`}function _r(e){let t=e.length;return t<=3?[...e]:[e[Math.floor(t*.25)],e[Math.floor(t*.5)],e[Math.floor(t*.75)]]}function yt(e,t,n){if(!e.length)return 1/0;if(e.length===1)return Math.hypot(t-e[0].x,n-e[0].y);let r=1/0;for(let o=0;o+1<e.length;o++){let i=e[o],a=e[o+1],s=a.x-i.x,c=a.y-i.y,u=s*s+c*c,d=u>1e-12?((t-i.x)*s+(n-i.y)*c)/u:0;d<0?d=0:d>1&&(d=1);let f=t-(i.x+d*s),m=n-(i.y+d*c);if(Math.abs(f)>=r||Math.abs(m)>=r)continue;let l=Math.hypot(f,m);l<r&&(r=l)}return r}function Vc(e){let t=0,n=0;for(let i of e)t+=i.x,n+=i.y;let r=e.length||1;t/=r,n/=r;let o=0;for(let i of e){let a=Math.hypot(i.x-t,i.y-n);a>o&&(o=a)}return{cx:t,cy:n,r:o}}function Lr(e,t){return Math.hypot(e.cx-t.cx,e.cy-t.cy)-e.r-t.r}function io(e,t){let n=1/0;for(let r of _r(e)){let o=yt(t,r.x,r.y);o<n&&(n=o)}for(let r of _r(t)){let o=yt(e,r.x,r.y);o<n&&(n=o)}return n}function Bc(e,t){if(e.length<3)return{pts:e,seatIndices:t};let n=0,r=0;for(let d of e)n+=d.x,r+=d.y;n/=e.length,r/=e.length;let o=-1,i=e[0];for(let d of e){let f=Math.hypot(d.x-n,d.y-r);f>o&&(o=f,i=d)}let a=i.x-n,s=i.y-r,c=Math.hypot(a,s);c>1e-9?(a/=c,s/=c):(a=1,s=0);let u=e.map((d,f)=>({p:d,i:f,t:(d.x-n)*a+(d.y-r)*s})).sort((d,f)=>d.t-f.t);return{pts:u.map(d=>d.p),seatIndices:u.map(d=>t[d.i])}}function ao(e){let t=e.length;if(t<3)return null;let n=0,r=0;for(let v of e)n+=v.x,r+=v.y;n/=t,r/=t;let o=0,i=0,a=0,s=0,c=0,u=0,d=0;for(let v of e){let S=v.x-n,M=v.y-r;o+=S*S,a+=M*M,i+=S*M,s+=S*S*S,c+=M*M*M,u+=S*M*M,d+=M*S*S}let f=o*a-i*i;if(Math.abs(f)<1e-9)return null;let m=(s+u)/2,l=(c+d)/2,p=(m*a-l*i)/f,h=(l*o-m*i)/f,b=p+n,y=h+r;return!Number.isFinite(b)||!Number.isFinite(y)?null:{cx:b,cy:y}}var Nc=.15;function Gc(e){if(e.length<2)return null;let t=e.map(v=>{let S=0,M=0;for(let R of v.pts)S+=R.x,M+=R.y;return{x:S/v.pts.length,y:M/v.pts.length}}),n=0,r=0;for(let v of t)n+=v.x,r+=v.y;n/=t.length,r/=t.length;let o=0,i=0,a=0;for(let v of t){let S=v.x-n,M=v.y-r;o+=S*S,i+=S*M,a+=M*M}let s=o+a,c=o*a-i*i,u=s/2+Math.sqrt(Math.max(0,s*s/4-c)),d,f;Math.abs(i)>1e-12?(d=u-a,f=i):o>=a?(d=1,f=0):(d=0,f=1);let m=Math.hypot(d,f);if(!(m>1e-12))return null;d/=m,f/=m;let l=1/0,p=-1/0,h=[];for(let v of e){let S=1/0,M=-1/0;for(let R of v.pts){let x=R.x*d+R.y*f;x<S&&(S=x),x>M&&(M=x),x<l&&(l=x),x>p&&(p=x)}h.push(M-S)}let b=p-l;return b>1e-9?(h.sort((v,S)=>v-S),h[Math.min(h.length-1,Math.floor(h.length*.9))]/b<=zc?{x:d,y:f}:null):null}var zc=.35;function un(e,t,n,r){let o=new Map;for(let x of n){let g=t[x],C=g.rowId||`__seat-${x}`,E=o.get(C);E||(E={pts:[],idx:[]},o.set(C,E)),E.pts.push({x:g.x,y:g.y}),E.idx.push(x)}if(!o.size)return{sectionId:e,rows:[],blockCount:0};let i=[];for(let[x,g]of o){let C=Bc(g.pts,g.idx),E=0;for(let D of C.pts)E+=Math.hypot(D.x-r.x,D.y-r.y);i.push({id:x,pts:C.pts,seatIndices:C.seatIndices,blockId:-1,ordinal:0,blockDepth:0,focalDistance:E/C.pts.length})}let a=i.map(x=>Vc(x.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((x,g)=>[x,g])):null,d=(x,g)=>(x>g&&([x,g]=[g,x]),x*(2*i.length-x-1)/2+(g-x-1)),f=(x,g)=>{if(!c)return io(i[x].pts,i[g].pts);let C=d(x,g),E=c[C];if(!Number.isNaN(E))return E;let D=io(i[x].pts,i[g].pts);return c[C]=D,D},m=(x,g)=>u?f(u.get(x),u.get(g)):io(x.pts,g.pts),l=[];for(let x=0;x<i.length;x++){let g=1/0;for(let C=0;C<i.length;C++){if(x===C||Lr(a[x],a[C])>=g)continue;let E=f(x,C);E<g&&(g=E)}Number.isFinite(g)&&l.push(g)}l.sort((x,g)=>x-g);let p=l.length?l[Math.floor(l.length/2)]:1,h=Math.max(p*1.8,1e-6),b=i.map(()=>[]);for(let x=0;x<i.length;x++)for(let g=x+1;g<i.length;g++)Lr(a[x],a[g])>h||f(x,g)<=h&&(b[x].push(g),b[g].push(x));let y=0;for(let x=0;x<i.length;x++){if(i[x].blockId!==-1)continue;let g=y++,C=[x];for(i[x].blockId=g;C.length;){let E=C.pop();for(let D of b[E])i[D].blockId===-1&&(i[D].blockId=g,C.push(D))}}let v=new Map;for(let x of i){let g=v.get(x.blockId)??[];g.push(x),v.set(x.blockId,g)}let S=[];for(let x of i){if(x.pts.length<4)continue;let g=ao(x.pts);g&&(!Number.isFinite(g.cx)||!Number.isFinite(g.cy)||S.push({x:g.cx,y:g.cy}))}let M=S.length>=2?(()=>{let x=S.map(E=>E.x).sort((E,D)=>E-D),g=S.map(E=>E.y).sort((E,D)=>E-D),C=Math.floor(S.length/2);return{cx:x[C],cy:g[C]}})():null;if(M){let x=L=>Math.hypot(L.x-M.cx,L.y-M.cy),g=1/0,C=-1/0,E=[];for(let L of i){let A=1/0,k=-1/0;for(let N of L.pts){let w=x(N);w<A&&(A=w),w>k&&(k=w)}E.push(k-A),A<g&&(g=A),k>C&&(C=k)}let D=C-g;E.sort((L,A)=>L-A);let B=E[Math.min(E.length-1,Math.floor(E.length*.9))];if(D>1e-9&&B/D<=Nc){let L=i.map(F=>{let H=0;for(let j of F.pts)H+=x(j);return{row:F,radius:H/F.pts.length}}),A=0,k=0;for(let F of L)A+=F.radius,k+=F.row.focalDistance;A/=L.length,k/=L.length;let N=0;for(let F of L)N+=(F.radius-A)*(F.row.focalDistance-k);if(N<0)for(let F of L)F.radius=-F.radius;let T=1/0;for(let F of L)F.radius<T&&(T=F.radius);L.sort((F,H)=>F.radius-H.radius);let _=-1,P=-1/0,O=D/Math.max(1,L.length)*.5,I=[];for(let F of L)F.radius-P>O&&(_++,P=F.radius),F.row.ordinal=_,F.row.blockDepth=F.radius-T,I.push(F.row);return{sectionId:e,rows:I,blockCount:y}}}let R=[];for(let[,x]of v){let g=Gc(x);if(g){let C=D=>{let B=0;for(let L of D.pts)B+=L.x*g.x+L.y*g.y;return B/D.pts.length};x.sort((D,B)=>C(D)-C(B)),x.length>=2&&x[0].focalDistance>x[x.length-1].focalDistance&&x.reverse();let E=0;for(let D=0;D<x.length;D++)D>0&&(E+=m(x[D-1],x[D])),x[D].ordinal=D,x[D].blockDepth=E,R.push(x[D])}else{let C=1/0;for(let E of x)E.focalDistance<C&&(C=E.focalDistance);x.sort((E,D)=>E.focalDistance-D.focalDistance);for(let E=0;E<x.length;E++)x[E].ordinal=E,x[E].blockDepth=Math.max(0,x[E].focalDistance-C),R.push(x[E])}}return{sectionId:e,rows:R,blockCount:y}}var Uc=/^\d{4}-\d{2}-\d{2}$/;function Hc(e){let t=Date.parse(e);return Number.isFinite(t)?Uc.test(e)?t+864e5:t:null}function jc(e,t=Date.now()){if(e.validUntil===void 0){if(e.status!=="approved")return!0;let r=e.assessedAt?Date.parse(e.assessedAt):Number.NaN;return Number.isFinite(r)&&(t instanceof Date?t.getTime():t)<=r+366*864e5}let n=Hc(e.validUntil);return n===null?!1:(t instanceof Date?t.getTime():t)<n}function Yc(e,t,n){return!(e.eventConfigurationId&&e.eventConfigurationId!==t||e.eventConfigurationVersion!==void 0&&e.eventConfigurationVersion!==n)}function Xc(e){return e.status!=="draft"&&e.status!=="retracted"}function Wc(e,t){return e.status===void 0?t===void 0:e.status!=="approved"?!0:typeof t=="string"&&typeof e.basisSha256=="string"&&e.basisSha256===t}function kr(e,t={}){return!!e&&Xc(e)&&Yc(e,t.activeConfigurationId,t.activeConfigurationVersion)&&Wc(e,t.activeBasisSha256)&&jc(e,t.now)}var yf=Math.PI*2;function mn(e){return e==="pitch-football"||e==="rink-hockey"||e==="track-athletics"||e==="oval-cricket"}var Kc=/^data:image\/(?:png|jpe?g|webp|gif|avif);base64,[a-z0-9+/]+={0,2}$/i,qc=/[\s"'<>`\\]/;function $c(e){if(typeof e!="string"||!e||e.length>2e6||e!==e.trim())return!1;if(e.startsWith("data:"))return Kc.test(e);if(qc.test(e))return!1;try{let t=new URL(e);return t.protocol==="https:"&&!t.username&&!t.password}catch{return!1}}function Fr(e){let t=e.trim();return $c(t)?t:null}var so="seatlayer.event-configuration/1";var gt=100,Qc=120,Zc=2e5,Jc=1e4,el=/^[a-f0-9]{64}$/,tl=new Set(["stage","screen","barrier","camera_platform","sound_desk","rigging_truss"]);function Vt(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function nt(e,t){return typeof e=="string"&&e.length>=1&&e.length<=t&&e.normalize("NFKC").trim()===e}function nl(e){return typeof e=="number"&&Number.isInteger(e)&&e>0}function Dr(e){return!Array.isArray(e)||e.length>Zc||!e.every(t=>nt(t,gt))?null:[...new Set(e)].sort()}function ol(e){return!Vt(e)||!nt(e.chartId,gt)||!nt(e.version,gt)||e.sha256!==void 0&&(typeof e.sha256!="string"||!el.test(e.sha256))?null:{chartId:e.chartId,version:e.version,...typeof e.sha256=="string"?{sha256:e.sha256}:{}}}function co(e,t,n){return typeof e=="number"&&Number.isFinite(e)&&e>=t&&e<=n}function rl(e){return Vt(e)?e.mode==="none"||e.mode==="opaque"?e.opacity===void 0?{mode:e.mode}:null:e.mode==="partial"&&co(e.opacity,.01,.99)?{mode:"partial",opacity:e.opacity}:null:null}function il(e,t){if(e===void 0)return;if(!Array.isArray(e)||e.length>Jc)return null;let n=new Set(t),r=new Set,o=new Set,i=0,a=[];for(let s of e){if(!Vt(s)||!nt(s.id,gt)||!nt(s.objectId,gt)||!n.has(s.objectId)||!tl.has(String(s.kind))||!co(s.heightM,.05,50)||s.baseElevationM!==void 0&&!co(s.baseElevationM,-10,100))return null;let c=rl(s.occlusion);if(!c||r.has(s.id)||o.has(s.objectId))return null;let u=s.contentImageUrl===void 0?void 0:typeof s.contentImageUrl=="string"?Fr(s.contentImageUrl):null;if(s.contentImageUrl!==void 0&&(!u||s.kind!=="screen"||++i>1))return null;r.add(s.id),o.add(s.objectId),a.push({id:s.id,objectId:s.objectId,kind:s.kind,heightM:s.heightM,...s.baseElevationM!==void 0?{baseElevationM:s.baseElevationM}:{},occlusion:c,...u?{contentImageUrl:u}:{}})}return a.sort((s,c)=>s.id.localeCompare(c.id))}function al(e){let t=[];if(!Vt(e))return{issues:[{code:"invalid_export",path:"configuration",message:"Configuration must be an object"}]};e.schema!==so&&t.push({code:"unsupported_schema",path:"configuration.schema",message:`Configuration schema must be ${so}`}),nt(e.id,gt)||t.push({code:"invalid_id",path:"configuration.id",message:"Configuration id must contain 1 to 100 normalized characters"}),nt(e.label,Qc)||t.push({code:"invalid_label",path:"configuration.label",message:"Configuration label must contain 1 to 120 normalized characters"}),nl(e.version)||t.push({code:"invalid_version",path:"configuration.version",message:"Configuration version must be a positive integer"});let n=ol(e.baseVenue);n||t.push({code:"invalid_base_venue",path:"configuration.baseVenue",message:"Base venue must identify one normalized chart id and exact version"});let r=Vt(e.overlay)?e.overlay:null,o=Dr(r?.objectIds),i=Dr(r?.productionKillSeatIds),a=o?il(r?.productionElements,o):null;return(!r||!o||!i)&&t.push({code:"invalid_overlay",path:"configuration.overlay",message:"Overlay ids must be bounded arrays of normalized stable ids"}),a===null&&t.push({code:"invalid_production_element",path:"configuration.overlay.productionElements",message:"Production elements must be unique, bounded semantics over referenced base-venue objects"}),t.length||!n||!o||!i||a===null?{issues:t}:{issues:t,value:{schema:so,id:e.id,label:e.label,version:e.version,baseVenue:n,overlay:{objectIds:o,productionKillSeatIds:i,...a!==void 0?{productionElements:a}:{}}}}}function Or(e){let t=al(e);return t.value?{ok:!0,value:t.value}:{ok:!1,issues:t.issues}}function sl(e){if((e.kind==="polygon"||e.kind==="polyline"||e.kind==="line")&&e.points&&e.points.length>=2)return e.points;if(e.x==null||e.y==null||e.width==null||e.height==null)return null;let t=e.x,n=e.y,r=e.width,o=e.height;return[{x:t,y:n},{x:t+r,y:n},{x:t+r,y:n+o},{x:t,y:n+o}]}function cl(e,t,n){let r=n*Math.PI/180,o=Math.cos(r),i=Math.sin(r),a=e.x-t.x,s=e.y-t.y;return{x:t.x+a*o-s*i,y:t.y+a*i+s*o}}function Vr(e){let t=sl(e);if(!t||t.length<2)return null;let n=e.rotation??0,r=Math.abs(n)<1e-6?t:t.map(c=>cl(c,{x:t.reduce((u,d)=>u+d.x,0)/t.length,y:t.reduce((u,d)=>u+d.y,0)/t.length},n)),o=1/0,i=1/0,a=-1/0,s=-1/0;for(let c of r)o=Math.min(o,c.x),i=Math.min(i,c.y),a=Math.max(a,c.x),s=Math.max(s,c.y);return!Number.isFinite(o)||a-o<1e-6||s-i<1e-6?null:{minX:o,minY:i,maxX:a,maxY:s}}var ll=5,ul=3,ml=.92,dl=1.9,fl=2,pl=.6,hl=1,bl=.06;function yl(e){return e.heightM!==void 0?e.heightM:mn(e.stageKind)?bl:hl}function Br(e){let t=1/0,n=1/0,r=-1/0,o=-1/0,i=-1/0;for(let a of zr(e)){let s=a.baseHeightM??0;for(let c of a.objects){if(c.type!=="shape"||c.role!=="stage")continue;let u=Vr(c);u&&(t=Math.min(t,u.minX),n=Math.min(n,u.minY),r=Math.max(r,u.maxX),o=Math.max(o,u.maxY),i=Math.max(i,s+yl(c)))}}return!Number.isFinite(t)||!Number.isFinite(i)?null:{minX:t,minY:n,maxX:r,maxY:o,deckTopM:i}}function gl(e,t,n,r){let o=1/0,i=1/0,a=-1/0,s=-1/0;for(let l of e)Number.isFinite(l.eyeHeightM)&&(o=Math.min(o,l.x),a=Math.max(a,l.x),i=Math.min(i,l.y),s=Math.max(s,l.y));if(!Number.isFinite(o))return null;let c=o*t,u=i*t,d=Math.max(1,Math.ceil((a-o)*t/n)+1),f=Math.max(1,Math.ceil((s-i)*t/n)+1),m=new Float64Array(d*f).fill(-1/0);for(let l of e){if(!Number.isFinite(l.eyeHeightM))continue;let p=l.eyeHeightM-Ie,h=Math.min(d-1,Math.max(0,Math.floor((l.x*t-c)/n))),y=Math.min(f-1,Math.max(0,Math.floor((l.y*t-u)/n)))*d+h,v=p+r;v>m[y]&&(m[y]=v)}return{cellM:n,minX:c,minY:u,cols:d,rows:f,top:m}}function xl(e,t,n){let r=Math.floor((t-e.minX)/e.cellM),o=Math.floor((n-e.minY)/e.cellM);return r<0||o<0||r>=e.cols||o>=e.rows?-1/0:e.top[o*e.cols+r]}function Nr(e,t,n={}){let r=new Map;if(!t||!e.length)return r;let o=n.metresPerChartUnit??be,i=n.cellM??pl,a=n.chairBackM??ml,s=n.selfRowSkipM??fl,c=n.clearThreshold??.9,u=n.partialThreshold??.25,d=Math.max(1,n.columns??ll),f=Math.max(1,n.rows??ul),m=gl(e,o,i,a);if(!m)return r;let l=(t.maxX-t.minX)*o,p=(t.maxY-t.minY)*o,h=l>=p,b=(t.minX+t.maxX)/2*o,y=(t.minY+t.maxY)/2*o,v=[];for(let M=0;M<d;M++){let R=(M+.5)/d-.5,x=h?b+R*l:b,g=h?y:y+R*p;for(let C=0;C<f;C++){let E=t.deckTopM+(f===1?0:C/(f-1)*dl);v.push({x,y:g,z:E})}}let S=i/2;for(let M of e){if(!Number.isFinite(M.eyeHeightM))continue;let R=M.x*o,x=M.y*o,g=M.eyeHeightM,C=0,E=1/0;for(let B of v){let L=B.x-R,A=B.y-x,k=Math.hypot(L,A);if(!(k>s)){C++;continue}let N=L/k,w=A/k,T=0;for(let _=s;_<k;_+=S){let P=xl(m,R+N*_,x+w*_);if(!(!Number.isFinite(P)||P>=g)&&P>g+(B.z-g)*_/k){T=_;break}}T?E=Math.min(E,T):C++}let D=C/v.length;D>=c||r.set(M.id,{seatId:M.id,mark:D<u?"obstructedView":"restrictedView",visibleFraction:D,totalRays:v.length,atDistanceM:Number.isFinite(E)?E:0})}return r}function Gr(e,t){if(!t.size)return 0;let n=0;for(let r of e){let o=t.get(r.id);if(!o)continue;let i=r.commercial;i?.restrictedView!==void 0||i?.obstructedView!==void 0||(r.commercial={...i,[o.mark]:!0},n++)}return n}function lo(e){return e?e.accessibility?.length?e.wheelchairSpaceType&&!e.accessibility.includes("wheelchair")?["wheelchair",...e.accessibility]:e.accessibility:e.wheelchairSpaceType?["wheelchair"]:e.accessible?["wheelchair"]:[]:[]}var fn=Math.PI/180;var Bt=16;function uo(e,t,n,r){let o=n*fn,i=Math.cos(o),a=Math.sin(o);return{x:r.x+e*i-t*a,y:r.y+e*a+t*i}}function Xr(e){let{seatCount:t,seatSpacing:n,curve:r,rotation:o,origin:i}=e,a=[];if(e.path)return Rr(e.path,t);if(t<=1)return t===1&&a.push({x:i.x,y:i.y}),a;if(r===0){for(let u=0;u<t;u++)a.push(uo(u*n,0,o,i));return a}let s=r/(t-1)*fn,c=n/(2*Math.sin(Math.abs(s)/2));for(let u=0;u<t;u++){let d=u*s,f=c*Math.sin(d),m=-c+c*Math.cos(d);a.push(uo(f,m,o,i))}return a}function Wr(e){let t=new Map;if(e.overrides)for(let n of e.overrides)t.set(n.index,n);return t}function vl(e,t){let n=Wr(e);return Xr(e).map((r,o)=>{let i=n.get(o),a=lo(i),s=Tr(e,o,i),c={...e.commercial,...i?.commercial};return{index:o,x:r.x+(i?.dx??0),y:r.y+(i?.dy??0),label:s,displayLabel:ro(e,o,t,i),categoryKey:i?.categoryKey??e.categoryKey,skipped:!!i?.skip,accessible:a.length>0,accessibility:a,wheelchairSpaceType:i?.wheelchairSpaceType,commercial:Object.values(c).some(u=>u!==void 0&&u!==!1&&u!=="")?c:void 0,glyph:i?.glyph,viewUrl:i?.viewFromSeatUrl??e.viewFromSeatUrl,viewMeta:i?.viewFromSeatUrl?i.viewFromSeatMeta:e.viewFromSeatMeta,labelStyle:i?.labelStyle??e.seatLabelStyle}})}function Sl(e){let t=[];for(let n of vl(e))n.skipped||t.push({id:`${e.id}:${n.index}`,label:n.label,displayLabel:n.displayLabel===n.label?void 0:n.displayLabel,x:n.x,y:n.y,rowId:e.id,categoryKey:n.categoryKey,accessible:n.accessible||void 0,accessibility:n.accessibility.length?n.accessibility:void 0,wheelchairSpaceType:n.wheelchairSpaceType,commercial:n.commercial,glyph:n.glyph,viewUrl:n.viewUrl,viewMeta:n.viewMeta,labelStyle:n.labelStyle});return t}function Ml(e){if(e.seatCountsBySide)return{...e.seatCountsBySide};let t=e.sides&&e.sides.length?e.sides:["top","bottom"],n=["top","bottom","left","right"].filter(i=>t.includes(i)),r={top:0,bottom:0,left:0,right:0};if(!n.length)return r;let o=Math.max(0,Math.round(e.seatCount));for(let i=0;i<o;i++)r[n[i%n.length]]+=1;return r}function wl(e){let t=[],n=Math.max(0,Math.round(e.seatCount));if(n===0)return t;let r=new Map((e.overrides??[]).map(d=>[d.index,d])),o=(d,f,m,l)=>{let p=r.get(d),h=lo(p),b=p?.label??`${e.label}-${d+1}`,y=e.displayLabel??e.label;return{index:d,label:b,displayLabel:p?.displayLabel??`${y}-${d+1}`,x:f+(p?.dx??0),y:m+(p?.dy??0),categoryKey:p?.categoryKey??e.categoryKey,skipped:!!p?.skip,accessible:h.length>0,accessibility:h,wheelchairSpaceType:p?.wheelchairSpaceType,commercial:p?.commercial,glyph:p?.glyph,viewUrl:p?.viewFromSeatUrl,viewMeta:p?.viewFromSeatUrl?p.viewFromSeatMeta:void 0,labelStyle:p?.labelStyle,...l?{side:l}:{}}};if(e.shape==="round"){let d=(e.radius??40)+Bt,f=e.rotation*fn,m=Math.max(0,Math.min(360,e.seatArc??360));if(m>=360||n===1){for(let b=0;b<n;b++){let y=f+b/n*2*Math.PI;t.push(o(b,e.center.x+d*Math.cos(y),e.center.y+d*Math.sin(y)))}return t}let l=m*fn,p=(2*Math.PI-l)/2,h=f+p;for(let b=0;b<n;b++){let y=h+b/(n-1)*l;t.push(o(b,e.center.x+d*Math.cos(y),e.center.y+d*Math.sin(y)))}return t}let i=e.width??80,a=e.height??50,s=Ml(e),c=["top","bottom","left","right"],u=0;for(let d of c){let f=s[d];for(let m=0;m<f;m++){let l,p;d==="top"?(l=-i/2+(m+.5)*i/f,p=-a/2-Bt):d==="bottom"?(l=-i/2+(m+.5)*i/f,p=a/2+Bt):d==="left"?(l=-i/2-Bt,p=-a/2+(m+.5)*a/f):(l=i/2+Bt,p=-a/2+(m+.5)*a/f);let h=uo(l,p,e.rotation,e.center);t.push(o(u++,h.x,h.y,d))}}return t}function Pl(e){return wl(e).filter(t=>!t.skipped).map(t=>({id:`${e.id}:${t.index}`,label:t.label,...t.displayLabel!==t.label?{displayLabel:t.displayLabel}:{},x:t.x,y:t.y,rowId:e.id,categoryKey:t.categoryKey,...t.accessible?{accessible:!0}:{},...t.accessibility.length?{accessibility:t.accessibility}:{},...t.wheelchairSpaceType?{wheelchairSpaceType:t.wheelchairSpaceType}:{},...t.commercial?{commercial:t.commercial}:{},...t.glyph?{glyph:t.glyph}:{},...t.viewUrl?{viewUrl:t.viewUrl}:{},...t.viewUrl&&t.viewMeta?{viewMeta:t.viewMeta}:{},...t.labelStyle?{labelStyle:t.labelStyle}:{}}))}function Cl(e){return[{id:`${e.id}:0`,label:e.label,...e.displayLabel&&e.displayLabel!==e.label?{displayLabel:e.displayLabel}:{},x:e.center.x,y:e.center.y,rowId:e.id,categoryKey:e.categoryKey,kind:"booth"}]}function Ur(e,t){let n=!1;for(let r=0,o=t.length-1;r<t.length;o=r++){let i=t[r].x,a=t[r].y,s=t[o].x,c=t[o].y;a>e.y!=c>e.y&&e.x<(s-i)*(e.y-a)/(c-a)+i&&(n=!n)}return n}function Al(e,t){return t.some((n,r)=>{let o=t[(r+1)%t.length],i=(e.y-n.y)*(o.x-n.x)-(e.x-n.x)*(o.y-n.y);if(Math.abs(i)>1e-7)return!1;let a=(e.x-n.x)*(o.x-n.x)+(e.y-n.y)*(o.y-n.y),s=(o.x-n.x)**2+(o.y-n.y)**2;return a>=-1e-7&&a<=s+1e-7})}function ot(e,t,n){return Ur(e,t)&&!(n??[]).some(r=>Ur(e,r)||Al(e,r))}function dn(e){if(!e.length)return{x:0,y:0};let t=0,n=0;for(let r of e)t+=r.x,n+=r.y;return{x:t/e.length,y:n/e.length}}function Kr(e){switch(e.type){case"row":{let t=Xr(e),n=Wr(e),r=0,o=0,i=0;for(let a=0;a<t.length;a++){let s=n.get(a);s?.skip||(r+=t[a].x+(s?.dx??0),o+=t[a].y+(s?.dy??0),i++)}return i?{x:r/i,y:o/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 dn(e.points);case"section":return dn(e.outline);case"text":return{x:e.position.x,y:e.position.y};case"shape":return e.points&&e.points.length?dn(e.points):e.x!=null&&e.y!=null&&e.width!=null&&e.height!=null?{x:e.x+e.width/2,y:e.y+e.height/2}:{x:e.x??0,y:e.y??0};case"decorImage":return{x:e.x+e.width/2,y:e.y+e.height/2}}}function Hr(e,t){return e.length===t.length&&e.every((n,r)=>n.x===t[r].x&&n.y===t[r].y)}function Rl(e,t){if(e.type!=="gaArea"||!Hr(e.points,t.outline))return!1;let n=e.holes??[],r=t.holes??[];return n.length===r.length&&n.every((o,i)=>Hr(o,r[i]))}function El(e,t,n=e.filter(o=>o.type==="section"),r=Kr(t)){let o="referenceInventorySource"in t?t.referenceInventorySource?.logicalSectionId:void 0;return(o?n.find(a=>(a.logicalSectionId??a.id)===o&&(Rl(t,a)||ot(r,a.outline,a.holes))):void 0)??n.find(a=>ot(r,a.outline,a.holes))}function zr(e){return e.floors&&e.floors.length?e.floors:[{id:"floor-0",name:"Main",objects:e.objects,focalPoint:e.focalPoint,referenceImage:e.referenceImage,backgroundImage:e.backgroundImage}]}function jr(e,t,n,r,o,i,a,s,c){let u=[],d=e.filter(h=>h.type==="section"),f=Er(e),m=h=>!h?.eventConfigurationId||h.eventConfigurationId===r&&(h.eventConfigurationVersion===void 0||h.eventConfigurationVersion===c),l=h=>kr(h,{activeConfigurationId:r,activeConfigurationVersion:c,activeBasisSha256:o,now:s}),p=(h,b)=>l(h)?{...h,coverage:b}:void 0;for(let h of e){let b=[];if(h.type==="row"?b=Sl(h):h.type==="table"?b=Pl(h):h.type==="booth"&&(b=Cl(h)),!b.length)continue;for(let R of b)R.viewUrl&&!m(R.viewMeta)&&(R.viewUrl=void 0,R.viewMeta=void 0);if(h.type==="row"){let R=f.get(h.id);if(R){let x=new Map((h.overrides??[]).map(g=>[g.index,g]));for(let g of b){let C=Number(g.id.slice(g.id.lastIndexOf(":")+1));if(!Number.isInteger(C))continue;g.logicalRowId=R.groupId,g.logicalSeatIndex=R.adjacencyOffset+C,x.get(C)?.displayLabel||(g.displayLabel=ro(h,C,R)),!g.viewUrl&&R.viewFromSeatUrl&&m(R.viewFromSeatMeta)&&(g.viewUrl=R.viewFromSeatUrl,g.viewMeta=R.viewFromSeatMeta);let E=x.get(C)?.confidenceEvidence;g.confidenceEvidence=p(E,"exact-seat")??p(h.confidenceEvidence,"row-representative")??p(R.confidenceEvidence,"row-representative")}}}let y=El(e,h,d,h.type==="row"?dn(b):Kr(h)),v=y?.viewFromSeatUrl,M=(y?.zone?t?.find(R=>R.id===y.zone):void 0)?.focalPoint??n;for(let R of b){if(!R.confidenceEvidence){let x=Number(R.id.slice(R.id.lastIndexOf(":")+1)),g=(h.type==="row"||h.type==="table")&&Number.isInteger(x)?h.overrides?.find(C=>C.index===x)?.confidenceEvidence:void 0;R.confidenceEvidence=p(g,"exact-seat")??(h.type==="row"?p(h.confidenceEvidence,"row-representative"):void 0)}R.confidenceEvidence??=p(y?.confidenceEvidence,"section-representative")??(a?p(a.evidence,a.coverage):void 0),!R.viewUrl&&v&&m(y?.viewFromSeatMeta)&&(R.viewUrl=v,R.viewMeta=y?.viewFromSeatMeta),!R.viewUrl&&i&&m(i.meta)&&(R.viewUrl=i.url,R.viewMeta=i.meta),y&&(R.sectionId=y.logicalSectionId??y.id),y?.zone&&(R.zoneId=y.zone),M&&(R.focalPoint={...M})}u.push(...b)}return u}function qr(e,t={}){if(e.floors?.length){let r=[];for(let o of e.floors){let i=o.focalPoint??e.focalPoint,a=o.viewFromSeatUrl?{url:o.viewFromSeatUrl,meta:o.viewFromSeatMeta}:e.viewFromSeatUrl?{url:e.viewFromSeatUrl,meta:e.viewFromSeatMeta}:void 0,s=o.confidenceEvidence?{evidence:o.confidenceEvidence,coverage:"floor-representative"}:e.confidenceEvidence?{evidence:e.confidenceEvidence,coverage:"venue-representative"}:void 0,c=jr(o.objects,e.zones,i,e.eventConfigurationId,e.confidenceBasisSha256,a,s,t.now,t.eventConfigurationVersion??e.eventConfigurationVersion);t.resolveEyeHeights!==!1&&Yr(o.objects,o.focalPoint??e.focalPoint,o.baseHeightM??0,c);for(let u of c)u.floorId=o.id;for(let u of c)r.push(u)}return r}let n=jr(e.objects,e.zones,e.focalPoint,e.eventConfigurationId,e.confidenceBasisSha256,e.viewFromSeatUrl?{url:e.viewFromSeatUrl,meta:e.viewFromSeatMeta}:void 0,e.confidenceEvidence?{evidence:e.confidenceEvidence,coverage:"venue-representative"}:void 0,t.now,t.eventConfigurationVersion??e.eventConfigurationVersion);return t.resolveEyeHeights!==!1&&Yr(e.objects,e.focalPoint,t.floorBaseHeightM??0,n),Il(e,n,t)}function Il(e,t,n){return!n.deriveRestrictedView||e.derivedRestrictedView===!1||n.resolveEyeHeights===!1||Gr(t,Nr(t,Br(e))),t}function Yr(e,t,n,r){let o=e.filter(f=>f.type==="section"),i=n>0||o.some(f=>f.height!==void 0||f.rake!==void 0||(f.elevation??0)>0);if(!o.length||!i||!t){for(let f of r)f.eyeHeightM=n+Ie;return}let a=new Array(r.length),s=new Map;for(let f of o)s.has(f.id)||s.set(f.id,f);let c=new Map,u=new Map;for(let f=0;f<r.length;f++){let m=r[f],p=(m.sectionId?s.get(m.sectionId)??o.find(b=>b.logicalSectionId===m.sectionId&&ot({x:m.x,y:m.y},b.outline,b.holes)):void 0)??o.find(b=>ot({x:m.x,y:m.y},b.outline,b.holes))??null;if(a[f]=p,!p)continue;c.has(p.id)||c.set(p.id,tn(p,{floorBaseHeightM:n}));let h=u.get(p.id);h?h.push(f):u.set(p.id,[f])}let d=new Array(r.length).fill(void 0);for(let[f,m]of u){let l=c.get(f);if(!l)continue;let p=l.rake>0?Math.tan(l.rake*Math.PI/180):0,h=un(f,r,m,t);for(let b of h.rows){let y=b.blockDepth*be*p,v=l.height+y;for(let S of b.seatIndices)d[S]=v}}for(let f=0;f<r.length;f++){let m=r[f],l=a[f];if(!l){m.eyeHeightM=n+Ie;continue}let p=c.get(l.id);m.eyeHeightM=(d[f]??p.height)+Ie}}function Tl(e){return{kind:"radial",rowCount:0,rows:[],nearestRow:()=>-1,depthAt:(t,n)=>Math.hypot(t-e.x,n-e.y),gradientAt:(t,n)=>{let r=t-e.x,o=n-e.y,i=Math.hypot(r,o);return i<1e-9?[0,0]:[r/i,o/i]}}}function _l(e,t){if(!e.length)return null;let n=0,r=0,o=0;for(let l of e)n+=l.x,r+=l.y,o+=Math.hypot(l.x-t.x,l.y-t.y);let i=e.length;n/=i,r/=i,o/=i;let a=e[0],s=-1;for(let l of e){let p=Math.hypot(l.x-n,l.y-r);p>s&&(s=p,a=l)}let c=a.x-n,u=a.y-r,d=Math.hypot(c,u);d>1e-9?(c/=d,u/=d):(c=1,u=0);let f=[...e].sort((l,p)=>(l.x-n)*c+(l.y-r)*u-((p.x-n)*c+(p.y-r)*u)),m=0;for(let l of f){let p=Math.hypot(l.x-n,l.y-r);p>m&&(m=p)}return{pts:f,cx:n,cy:r,radius:m,depth:o}}function $r(e,t,n){let r=e.pts;if(r.length===1)return Math.hypot(t-r[0].x,n-r[0].y);let o=1/0;for(let i=0;i+1<r.length;i++){let a=r[i],s=r[i+1],c=s.x-a.x,u=s.y-a.y,d=c*c+u*u,f=d>1e-12?((t-a.x)*c+(n-a.y)*u)/d:0;f<0?f=0:f>1&&(f=1);let m=Math.hypot(t-(a.x+f*c),n-(a.y+f*u));m<o&&(o=m)}return o}var pn=8;function Ll(e,t,n){let r=new Array(pn).fill(1/0),o=new Array(pn).fill(-1);for(let d=0;d<e.length;d++){let f=e[d],m=Math.hypot(t-f.cx,n-f.cy)-f.radius;for(let l=0;l<pn;l++)if(m<r[l]){for(let p=pn-1;p>l;p--)r[p]=r[p-1],o[p]=o[p-1];r[l]=m,o[l]=d;break}}let i=new Array(3).fill(1/0),a=new Array(3).fill(-1);for(let d of o){if(d<0)continue;let f=$r(e[d],t,n);for(let m=0;m<3;m++)if(f<i[m]){for(let l=2;l>m;l--)i[l]=i[l-1],a[l]=a[l-1];i[m]=f,a[m]=d;break}}if(a[0]<0)return 0;if(i[0]<1e-6)return e[a[0]].depth;let s=i[0]*2.2,c=0,u=0;for(let d=0;d<3;d++){let f=a[d];if(f<0||i[d]>s)continue;let m=1/(i[d]*i[d]);c+=m*e[f].depth,u+=m}return u>0?c/u:e[a[0]].depth}function kl(e){let t=(r,o)=>Ll(e,r,o),n=(r,o)=>{let i=1/0,a=-1;for(let s=0;s<e.length;s++){let c=e[s];if(Math.hypot(r-c.cx,o-c.cy)-c.radius>=i)continue;let u=$r(c,r,o);u<i&&(i=u,a=s)}return a};return{kind:"rows",rowCount:e.length,rows:e,nearestRow:n,depthAt:t,gradientAt:(r,o)=>{let i=(t(r+.5,o)-t(r-.5,o))/1,a=(t(r,o+.5)-t(r,o-.5))/(2*.5),s=Math.hypot(i,a);return s<1e-9?[0,0]:[i/s,a/s]}}}function Qr(e,t){let n=[];for(let r of e){let o=_l(r.points,t);o&&n.push(o)}return n.length<2?Tl(t):(n.sort((r,o)=>r.depth-o.depth),kl(n))}var po=mt(require("polygon-clipping"),1);var ti=mt(require("earcut"),1);var Fl=.58,Zr=.01,Ce=De*1.5*He,Dl=.5,Ol=.6;function Vl(e,t){let n=e.length,r=[];for(let a=0;a<n;a++){let s=e[Math.max(0,a-1)],c=e[Math.min(n-1,a+1)],u=c.x-s.x,d=c.y-s.y,f=Math.hypot(u,d);if(f<1e-9){r.push([0,0]);continue}u/=f,d/=f,r.push([-d,u])}let o=0;for(let a=0;a<n;a++)o+=(e[a].x-t.x)*r[a][0]+(e[a].y-t.y)*r[a][1];return o<0?r.map(([a,s])=>[-a,-s]):r}function Bl(e,t){if(e.length<2||t<=0)return[...e];let n=[...e],r=(a,s)=>{let c=s.x-a.x,u=s.y-a.y,d=Math.hypot(c,u)||1;return{x:c/d,y:u/d}},o=r(n[1],n[0]),i=r(n[n.length-2],n[n.length-1]);return n.unshift({x:n[0].x+o.x*t,y:n[0].y+o.y*t}),n.push({x:n[n.length-1].x+i.x*t,y:n[n.length-1].y+i.y*t}),n}var Jr=Math.PI/12;function Nl(e){if(e.length<3)return[...e];let t=[...e].sort((i,a)=>i.x-a.x||i.y-a.y),n=(i,a,s)=>(a.x-i.x)*(s.y-i.y)-(a.y-i.y)*(s.x-i.x),r=i=>{let a=[];for(let s of i){for(;a.length>=2&&n(a[a.length-2],a[a.length-1],s)<=0;)a.pop();a.push(s)}return a.pop(),a},o=[...r(t),...r([...t].reverse())];return o.length>=3?o:[...e]}function ni(e,t){if(!e.length||!(t>0))return[];let n=Nl(e),r=(s,c,u,d)=>{let f=u-c;for(;f<0;)f+=Math.PI*2;for(;f>Math.PI*2;)f-=Math.PI*2;let m=Math.max(1,Math.ceil(f/Jr)),l=t/Math.cos(f/m/2);for(let p=0;p<=m;p++){let h=c+f*p/m;d.push({x:s.x+Math.cos(h)*l,y:s.y+Math.sin(h)*l})}};if(n.length<3){let s=0,c=0;for(let l of n)s+=l.x,c+=l.y;s/=n.length||1,c/=n.length||1;let u=0;for(let l of n)u=Math.max(u,Math.hypot(l.x-s,l.y-c));let d=[],f=Math.max(3,Math.ceil(Math.PI*2/Jr)),m=(u+t)/Math.cos(Math.PI/f);for(let l=0;l<f;l++){let p=l/f*Math.PI*2;d.push({x:s+Math.cos(p)*m,y:c+Math.sin(p)*m})}return d}let o=n.length,i=[];for(let s=0;s<o;s++){let c=n[s],u=n[(s+1)%o];i.push(Math.atan2(-(u.x-c.x),u.y-c.y))}let a=[];for(let s=0;s<o;s++)r(n[s],i[(s+o-1)%o],i[s],a);return si(a)}function Gl(e,t,n){if(e.length===1)return Math.hypot(t-e[0].x,n-e[0].y);let r=1/0;for(let o=0;o+1<e.length;o++){let i=e[o],a=e[o+1],s=a.x-i.x,c=a.y-i.y,u=s*s+c*c,d=u>1e-12?((t-i.x)*s+(n-i.y)*c)/u:0;d<0?d=0:d>1&&(d=1);let f=Math.hypot(t-(i.x+d*s),n-(i.y+d*c));f<r&&(r=f)}return r}function hn(e){let t=e.map(o=>{let i=0,a=0;for(let u of o.pts)i+=u.x,a+=u.y;let s=o.pts.length||1;i/=s,a/=s;let c=0;for(let u of o.pts){let d=Math.hypot(u.x-i,u.y-a);d>c&&(c=d)}return{cx:i,cy:a,rad:c}}),n=o=>{let i=o.length;return i<=2?[...o]:[o[Math.floor(i*.25)],o[Math.floor(i*.5)],o[Math.floor(i*.75)]]},r=[];for(let o=0;o<e.length;o++){let i=n(e[o].pts),a=[],s=1/0,c=null;for(let d of i){let f=1/0;for(let m=0;m<e.length;m++){if(m===o||Math.abs(e[m].y-e[o].y)<.001)continue;let l=t[m],p=Math.hypot(d.x-l.cx,d.y-l.cy)-l.rad;if(p>=f&&p>=s)continue;let h=Gl(e[m].pts,d.x,d.y);h<f&&(f=h),e[m].depth<e[o].depth&&h<s&&(s=h,c=e[m].y)}Number.isFinite(f)&&f>0&&a.push(f)}a.sort((d,f)=>d-f);let u=a.length?a[Math.floor(a.length/2)]:1;r.push({pitch:u,belowY:c})}return r}function oi(e,t,n,r){let o=e[t],i=o.pts.length>=2?[...o.pts]:o.pts.length===1?(()=>{let d=o.pts[0],f=d.x-r.x,m=d.y-r.y,l=Math.hypot(f,m)||1;f/=l,m/=l;let p=Math.max(n[t].pitch,.001)*.5;return[{x:d.x+m*p,y:d.y-f*p},{x:d.x-m*p,y:d.y+f*p}]})():[];if(i.length<2)return null;let a=0,s=0;for(let d=1;d<i.length;d++){let f=Math.hypot(i[d].x-i[d-1].x,i[d].y-i[d-1].y);f>1e-6&&(a+=f,s++)}let c=s>0?a/s:0,u=Bl(i,Math.max(c*Ol,Ce));return{pts:u,nrm:Vl(u,r),front:Math.max(n[t].pitch*Fl,Ce),back:Math.max(n[t].pitch*Dl,Ce)}}var xt=1.5,ri=.3;function mo(e,t){if(e.length<3)return e;let n=e[0],r=e[e.length-1],o=r.x-n.x,i=r.y-n.y,a=Math.hypot(o,i),s=-1,c=-1;for(let f=1;f<e.length-1;f++){let m=e[f],l=a>1e-12?Math.abs((m.x-n.x)*i-(m.y-n.y)*o)/a:Math.hypot(m.x-n.x,m.y-n.y);l>s&&(s=l,c=f)}if(s<=t||c<0)return[n,r];let u=mo(e.slice(0,c+1),t),d=mo(e.slice(c),t);return[...u.slice(0,-1),...d]}function ii(e,t){if(e.length<4)return e;let n=mo([...e,e[0]],t);return n.pop(),n.length>=3?n:e}function ai(e,t,n){if(e.length<2)return[];let r=n??hn(e),o=new Map;for(let a=0;a<e.length;a++){let s=o.get(e[a].blockId);s?s.push(a):o.set(e[a].blockId,[a])}let i=[];for(let[,a]of o){let s=[];for(let v of a){let S=e[v].patch;S&&S.length>=3?i.push({outline:[...S],holes:[],topY:e[v].y}):s.push(v)}if(!s.length)continue;s.sort((v,S)=>e[v].depth-e[S].depth);let u=s.map(v=>oi(e,v,r,t)).filter(v=>v!==null);if(!u.length)continue;let d=(v,S)=>({x:v.pts[S].x-v.nrm[S][0]*(v.front+xt),y:v.pts[S].y-v.nrm[S][1]*(v.front+xt)}),f=(v,S)=>({x:v.pts[S].x+v.nrm[S][0]*(v.back+xt),y:v.pts[S].y+v.nrm[S][1]*(v.back+xt)}),m=u[0],l=u[u.length-1],p=[];for(let v=0;v<m.pts.length;v++)p.push(d(m,v));for(let v of u)p.push(f(v,v.pts.length-1));for(let v=l.pts.length-1;v>=0;v--)p.push(f(l,v));for(let v=u.length-1;v>=0;v--)p.push(d(u[v],0));let h=si(p),b=1/0;for(let v of s)e[v].y<b&&(b=e[v].y);if(!Number.isFinite(b))continue;if(h.length>=3&&Math.abs(et(h))>1e-6&&u.every(v=>{let S=v.pts[Math.floor(v.pts.length/2)];return kt(h,S.x,S.y)})){i.push({outline:ii(h,ri),holes:[],topY:b});continue}for(let v of zl(u))i.push({outline:v,holes:[],topY:b})}return i}function zl(e){let t=[];for(let n of e){let r=[],o=[],i=n.front+xt,a=n.back+xt;for(let c=0;c<n.pts.length;c++){let u=n.pts[c],d=n.nrm[c];r.push([u.x-d[0]*i,u.y-d[1]*i]),o.push([u.x+d[0]*a,u.y+d[1]*a])}let s=[...r,...o.reverse()];s.length<3||(s.push(s[0]),t.push([s]))}if(!t.length)return[];try{let n=po.default.union(t[0],...t.slice(1)),r=[];for(let o of n){if(!o.length||o[0].length<4)continue;let i=o[0].map(([c,u])=>({x:c,y:u})),a=i[0],s=i[i.length-1];i.length>1&&Math.abs(a.x-s.x)<1e-9&&Math.abs(a.y-s.y)<1e-9&&i.pop(),i.length>=3&&r.push(ii(i,ri))}return r}catch{return[]}}function si(e){let t=[];for(let n of e){let r=t[t.length-1];r&&Math.hypot(n.x-r.x,n.y-r.y)<1e-9||t.push(n)}for(;t.length>2&&Math.hypot(t[0].x-t[t.length-1].x,t[0].y-t[t.length-1].y)<1e-9;)t.pop();return t}var fo=class{constructor(t){this.minX=1/0;this.minY=1/0;this.maxX=-1/0;this.maxY=-1/0;this.rings=t;for(let n of t)for(let r of n)r.x<this.minX&&(this.minX=r.x),r.y<this.minY&&(this.minY=r.y),r.x>this.maxX&&(this.maxX=r.x),r.y>this.maxY&&(this.maxY=r.y)}containsAll(t){for(let n of t)if(n.x<this.minX||n.x>this.maxX||n.y<this.minY||n.y>this.maxY)return!1;for(let n of this.rings){let r=!0;for(let o of t)if(!kt(n,o.x,o.y)){r=!1;break}if(r)return!0}return!1}};function ei(e,t,n,r,o,i){if(r.length<3)return;if(n.containsAll(r)){let u=[0,1,0],d=r[0];for(let f=1;f+1<r.length;f++){let m=r[f],l=r[f+1];e.tri([d.x*z,o,d.y*z],[m.x*z,o,m.y*z],[l.x*z,o,l.y*z],u,i)}return}let a=r.map(u=>[u.x,u.y]);a.push(a[0]);let s;try{s=po.default.intersection([a],t)}catch{return}let c=[0,1,0];for(let u of s){if(!u.length||u[0].length<4)continue;let d=u[0],f=[],m=[];for(let p=0;p<d.length-1;p++)f.push(d[p][0],d[p][1]),m.push([d[p][0],d[p][1]]);if(m.length<3)continue;let l=(0,ti.default)(f,void 0,2);for(let p=0;p<l.length;p+=3){let h=m[l[p]],b=m[l[p+1]],y=m[l[p+2]];e.tri([h[0]*z,o,h[1]*z],[b[0]*z,o,b[1]*z],[y[0]*z,o,y[1]*z],c,i)}}}function ci(e,t,n,r,o,i,a){if(t.length<2)return;let s=a??hn(t),c=[0,1,0],u=i&&i.length>=3?[[...i.map(l=>[l.x,l.y]),[i[0].x,i[0].y]]]:null,d=i&&i.length>=3?new fo([[...i]]):null,f=l=>{e.setMaterial(2),l(),e.setMaterial(0)},m=l=>{e.setMaterial(3),l(),e.setMaterial(0)};for(let l=0;l<t.length;l++){let p=t[l];if(p.patch&&p.patch.length>=3){let R=[...p.patch],x=s[l].belowY??r;if(m(()=>{if(u&&d)ei(e,u,d,R,p.y,o.tread);else{let g=R[0];for(let C=1;C+1<R.length;C++){let E=R[C],D=R[C+1];e.tri([g.x*z,p.y,g.y*z],[E.x*z,p.y,E.y*z],[D.x*z,p.y,D.y*z],c,o.tread)}}}),p.y>x+Zr){let g=0,C=0;for(let E of R)g+=E.x,C+=E.y;g/=R.length,C/=R.length,f(()=>{for(let E=0;E<R.length;E++){let D=R[E],B=R[(E+1)%R.length],L=B.x-D.x,A=B.y-D.y,k=Math.hypot(L,A);if(k<1e-6)continue;let N=A/k,w=-L/k;(D.x-g)*N+(D.y-C)*w<0&&(N=-N,w=-w);let T=[N,0,w],_=[D.x*z,p.y,D.y*z],P=[B.x*z,p.y,B.y*z],O=[D.x*z,x,D.y*z],I=[B.x*z,x,B.y*z];e.tri(_,P,I,T,o.riser),e.tri(_,I,O,T,o.riser)}})}continue}let h=oi(t,l,s,n);if(!h)continue;let{pts:b,nrm:y,front:v,back:S}=h,M=s[l].belowY??r;for(let R=0;R+1<b.length;R++){let x=b[R],g=b[R+1],C=y[R],E=y[R+1];if(Math.hypot(g.x-x.x,g.y-x.y)<1e-6||C[0]===0&&C[1]===0||E[0]===0&&E[1]===0)continue;let D=[(x.x-C[0]*v)*z,p.y,(x.y-C[1]*v)*z],B=[(g.x-E[0]*v)*z,p.y,(g.y-E[1]*v)*z],L=[(x.x+C[0]*S)*z,p.y,(x.y+C[1]*S)*z],A=[(g.x+E[0]*S)*z,p.y,(g.y+E[1]*S)*z];if(m(()=>{u&&d?ei(e,u,d,[{x:x.x-C[0]*v,y:x.y-C[1]*v},{x:g.x-E[0]*v,y:g.y-E[1]*v},{x:g.x+E[0]*S,y:g.y+E[1]*S},{x:x.x+C[0]*S,y:x.y+C[1]*S}],p.y,o.tread):(e.tri(D,B,A,c,o.tread),e.tri(D,A,L,c,o.tread))}),p.y>M+Zr){let k=[D[0],M,D[2]],N=[B[0],M,B[2]],w=[-C[0],0,-C[1]];f(()=>{e.tri(D,B,N,w,o.riser),e.tri(D,N,k,w,o.riser)})}}}}function li(e){let t=1/0,n=1/0,r=-1/0,o=-1/0,i=!1;for(let a of e)!Number.isFinite(a.x)||!Number.isFinite(a.y)||(i=!0,a.x<t&&(t=a.x),a.y<n&&(n=a.y),a.x>r&&(r=a.x),a.y>o&&(o=a.y));return i?{minX:t,minY:n,maxX:r,maxY:o}:null}function bn(e,t){return e.minX<=t.maxX&&t.minX<=e.maxX&&e.minY<=t.maxY&&t.minY<=e.maxY}var ho=mt(require("polygon-clipping"),1);function Ul(e,t){let n=e.eventConfigurationIds;return!n?.length||!!t&&n.includes(t)}function ui(e,t){return e.filter(n=>n.type!=="shape"||Ul(n,t))}function mi(e,t){let n=e.focalPoint??{x:0,y:0};return e.floors?.length?e.floors.map((r,o)=>({objects:ui(r.objects,t),focal:{x:(r.focalPoint??n).x,y:(r.focalPoint??n).y},baseHeightM:r.baseHeightM??0,index:o})):[{objects:ui(e.objects,t),focal:n,baseHeightM:0,index:0}]}var Hl={minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};function vt(e){return li(e)??Hl}function di(e,t){let n=an(e.outline,Ce),r=vt(n),o=t.filter(a=>a!==e&&a.outline&&a.outline.length>=3&&bn(r,vt(a.outline)));if(!o.length)return[n];let i=a=>{let s=a.map(c=>[c.x,c.y]);return s.push(s[0]),s};try{let a=ho.default.difference([i(n)],...o.map(c=>[i(c.outline)])),s=[];for(let c of a){if(!c.length)continue;let u=c[0].map(([d,f])=>({x:d,y:f}));if(u.length>1){let d=u[0],f=u[u.length-1];Math.abs(d.x-f.x)<1e-9&&Math.abs(d.y-f.y)<1e-9&&u.pop()}u.length>=3&&s.push(u)}return s.length?s:[n]}catch{return[n]}}function fi(e,t){if(!t.length)return e;let n=i=>{let a=i.map(s=>[s.x,s.y]);return a.push(a[0]),a},r=t.map(i=>[n(i)]),o=[];for(let i of e){let a;try{a=ho.default.intersection([n(i.outline)],r.flat())}catch{o.push(i);continue}for(let s of a){if(!s.length)continue;let c=s[0].map(([u,d])=>({x:u,y:d}));if(c.length>1){let u=c[0],d=c[c.length-1];Math.abs(u.x-d.x)<1e-9&&Math.abs(u.y-d.y)<1e-9&&c.pop()}c.length>=3&&o.push({outline:c,holes:[],topY:i.topY})}}return o.length?o:e}var jl=.05,pi=.05,Yl=.15,bo=25;function hi(e,t,n){let r=new Map,o=new Array(t.length).fill(null),i=new Float64Array(t.length),a=new Array(t.length).fill(void 0),s=new Array(t.length).fill(void 0),c=new Map,u=[],d=new Set;for(let m=0;m<e.length;m+=1){let l=e[m];for(let p of l.objects){if(p.type==="table"&&d.add(p.id),p.type!=="section"||!p.outline||p.outline.length<3)continue;let h=an(p.outline,Ce);c.set(p.id,{section:p,unit:l,frontU:1/0,hasSeats:!1,rows:new Map,seatIndices:[]}),u.push({id:p.id,floorIndex:m,box:vt(h),section:p,unit:l,outline:h})}}let f=new Map;for(let m of u){let l=f.get(m.floorIndex);l?l.push(m):f.set(m.floorIndex,[m])}for(let m=0;m<t.length;m++){let l=t[m],p=n?f.get(n[m])??[]:u,h=l.sectionId?p.find(y=>y.id===l.sectionId)??p.find(y=>y.section.logicalSectionId===l.sectionId&&ot({x:l.x,y:l.y},y.outline,y.section.holes)):void 0,b=h?[h]:p;for(let y of b){if(n&&y.floorIndex!==n[m]||!h&&(l.x<y.box.minX||l.x>y.box.maxX||l.y<y.box.minY||l.y>y.box.maxY||!ot({x:l.x,y:l.y},y.outline,y.section.holes)))continue;o[m]=y.id;let v=c.get(y.id);v.hasSeats=!0;let S=l.focalPoint??y.unit.focal,M=Math.hypot(l.x-S.x,l.y-S.y);M<v.frontU&&(v.frontU=M),v.seatIndices.push(m);let R=l.rowId||`__seat-${m}`,x=v.rows.get(R);x?x.push({x:l.x,y:l.y}):v.rows.set(R,[{x:l.x,y:l.y}]);break}}for(let[m,l]of c){let p=tn(l.section,{floorBaseHeightM:l.unit.baseHeightM}),h=l.unit.baseHeightM,b=p.rake>0?Math.tan(p.rake*Math.PI/180):0,y=p.rake<=.01&&p.height<=h+.001,v=l.section.surfaceKind,S=v==="flat"?!0:v==="rakedRows"&&p.rake>.01?!1:y,M=l.hasSeats?un(m,t,l.seatIndices,l.unit.focal):{sectionId:m,rows:[],blockCount:0},x=M.rows.length<2?Qr([...l.rows.values()].map(_=>({points:_})),l.unit.focal):null,g=1/0;if(x){if(l.hasSeats)for(let _ of l.rows.values())for(let P of _){let O=x.depthAt(P.x,P.y);O<g&&(g=O)}if(!l.hasSeats||!Number.isFinite(g)){g=1/0;for(let _ of l.section.outline){let P=x.depthAt(_.x,_.y);P<g&&(g=P)}}}let C=h+jl,E=Math.max(C,p.height),D=_=>{let P=Math.max(0,_-g)*be,O=Math.min(P*b,bo);return Math.max(C,p.height+O)},B=_=>{let P=Math.max(0,_)*be,O=Math.min(P*b,bo);return Math.max(C,p.height+O)},L=S?[]:M.rows.map(_=>({pts:_.pts,y:B(_.blockDepth),depth:_.blockDepth,blockId:_.blockId,...d.has(_.id)?{patch:ni(_.pts,Ce)}:{}})),A=L.length?L[0].y:E,k=L.map(_=>{let P=_.patch&&_.patch.length>=3?_.patch:_.pts,O=0,I=0;for(let j of P)O+=j.x,I+=j.y;let F=P.length||1;O/=F,I/=F;let H=0;for(let j of P){let G=Math.hypot(j.x-O,j.y-I);G>H&&(H=G)}return{cx:O,cy:I,rad:H}}),N=S?()=>E:L.length>=2?(_,P)=>{let O=1/0,I=A;for(let F=0;F<L.length;F++){let H=k[F];if(Math.hypot(_-H.cx,P-H.cy)-H.rad>=O)continue;let j=L[F].patch,G=j&&j.length>=3?kt(j,_,P)?0:yt(j,_,P):yt(L[F].pts,_,P);G<O&&(O=G,I=L[F].y)}return I}:(_,P)=>x?D(x.depthAt(_,P)):E,w=[0,1,0],T=L.length>=2||S?()=>w:(_,P)=>{if(!x)return w;let O=x.depthAt(_,P);if(O<=g)return w;let I=(O-g)*be;if(I*b>=bo||p.height+I*b<=C)return w;let[F,H]=x.gradientAt(_,P);if(F===0&&H===0)return w;let j=1/Math.hypot(b,1);return[-F*b*j,j,-H*b*j]};if(!S)for(let _ of M.rows){let P=B(_.blockDepth);for(let O of _.seatIndices)a[O]=P}for(let _ of M.rows){let P=[];for(let j=1;j<_.pts.length;j++){let G=Math.hypot(_.pts[j].x-_.pts[j-1].x,_.pts[j].y-_.pts[j-1].y);G>1e-6&&P.push(G)}P.sort((j,G)=>j-G);let O=P.length?P[Math.floor(P.length/2)]:1/0,I=1/0,F=_.pts[Math.floor(_.pts.length/2)];if(F)for(let j of M.rows){if(j===_||j.blockId!==_.blockId)continue;let G=yt(j.pts,F.x,F.y);G>1e-6&&G<I&&(I=G)}let H=Math.min(O,Math.max(I,O*.5));if(Number.isFinite(H)&&H>0)for(let j of _.seatIndices)s[j]=H}r.set(m,{sectionId:m,deckAt:N,normalAt:T,flat:S,bottomY:h,rowLevels:L,landingY:A})}for(let m=0;m<t.length;m++){let l=o[m],p=t[m];if(l){let b=a[m];i[m]=(b??r.get(l).deckAt(p.x,p.y))+Yl;continue}let h=p.eyeHeightM;i[m]=Number.isFinite(h)?Math.max(0,h-Ie):0}return{bySection:r,seatOwner:o,seatDeckY:m=>i[m],seatPitchU:m=>s[m]}}var le={top:1,wallBottom:.5,bottomCap:.4};function Oe(e,t){if(!e)return t;let n=Pe(Et(e,.4),.62);return ge(t,n,.72)}function bi(e,t){let n=new Map;for(let i of e.categories??[])n.set(i.key,i.color);let r=new Map;for(let i of t){if(!i.sectionId)continue;let a=r.get(i.sectionId);a||(a=new Map,r.set(i.sectionId,a)),a.set(i.categoryKey,(a.get(i.categoryKey)??0)+1)}let o=new Map;for(let[i,a]of r){let s=0,c=0,u=0,d=0;for(let[f,m]of a){let l=ne(n.get(f));l&&(s+=l[0]*m,c+=l[1]*m,u+=l[2]*m,d+=m)}d>0&&o.set(i,[s/d,c/d,u/d])}return o}function yi(e,t){return ne(e.color)??t.get(e.logicalSectionId??e.id)??null}var gi=mt(require("polygon-clipping"),1);function Xl(e,t){return e===void 0||t===void 0?!0:Math.abs(e-t)<.001}var yn=class{constructor(){this.rings=[];this.boxes=[];this.levels=[]}subtract(t,n){let r=t.map(c=>[c.x,c.y]);if(r.length<3)return[];r.push(r[0]);let o=vt(t),i=this.rings.filter((c,u)=>bn(o,this.boxes[u])&&Xl(n,this.levels[u])),a=[[r]];if(i.length)try{a=gi.default.difference([r],...i).map(u=>u.map(d=>d.map(([f,m])=>[f,m])))}catch{a=[[r]]}this.rings.push([r]),this.boxes.push(o),this.levels.push(n);let s=[];for(let c of a){if(!c.length)continue;let u=c[0].map(([d,f])=>({x:d,y:f}));if(u.length>1){let d=u[0],f=u[u.length-1];Math.abs(d.x-f.x)<1e-9&&Math.abs(d.y-f.y)<1e-9&&u.pop()}u.length>=3&&s.push(u)}return s}};function Wl(e,t){if(!t)return e;let n=1/0,r=-1/0,o=1/0,i=-1/0;for(let f of e)n=Math.min(n,f.x),r=Math.max(r,f.x),o=Math.min(o,f.y),i=Math.max(i,f.y);let a=(n+r)/2,s=(o+i)/2,c=t*Math.PI/180,u=Math.cos(c),d=Math.sin(c);return e.map(f=>{let m=f.x-a,l=f.y-s;return{x:a+m*u-l*d,y:s+m*d+l*u}})}function rt(e){let t=null;if(e.kind==="polygon"&&e.points&&e.points.length>=3&&(t=e.points),e.kind==="rect"&&e.width&&e.height&&(t=Ot(e.x??0,e.y??0,e.width,e.height)),e.kind==="ellipse"&&e.width&&e.height){let n=(e.x??0)+e.width/2,r=(e.y??0)+e.height/2;t=sn(n,r,e.width/2,e.height/2)}return t?Wl(t,e.rotation):null}function Nt(e){let t=e.role??"",n={stage:{kind:"stage",heightM:1},entrance:{kind:"portal",heightM:2.7},exit:{kind:"portal",heightM:2.7},screen:{kind:"solid",heightM:6},wall:{kind:"solid",heightM:2.8},rail:{kind:"solid",heightM:1.1},suite:{kind:"suite",heightM:3},obstruction:{kind:"solid",heightM:4.5},sound:{kind:"solid",heightM:1.45},restroom:{kind:"solid",heightM:2.4},bar:{kind:"solid",heightM:1.1},concession:{kind:"solid",heightM:1.1},coat:{kind:"solid",heightM:1.1},goal:{kind:"portal",heightM:1.8}},r=t==="stage"&&mn(e.stageKind)?{kind:"stage",heightM:.06}:n[t]??{kind:"plate",heightM:.25};return{...r,heightM:e.heightM??r.heightM}}var Kl=.08;function xi(e,t){let n=rt(e),r=Nt(e),o=r.heightM;if(!n||r.kind!=="plate"&&r.kind!=="stage")return o;let i=1/0,a=1/0,s=-1/0,c=-1/0;for(let d of n)i=Math.min(i,d.x),a=Math.min(a,d.y),s=Math.max(s,d.x),c=Math.max(c,d.y);let u=o;for(let d of t)s>d.minX&&i<d.maxX&&c>d.minY&&a<d.maxY&&u<=d.topOffsetM+1e-6&&(u=d.topOffsetM+Kl);return t.push({minX:i,minY:a,maxX:s,maxY:c,topOffsetM:u}),u}function je(e,t,n){return{x:e.x+(t.x-e.x)*n,y:e.y+(t.y-e.y)*n}}function vi(e){if(e.length!==4)return e;let t=Math.hypot(e[1].x-e[0].x,e[1].y-e[0].y),n=Math.hypot(e[2].x-e[1].x,e[2].y-e[1].y);return t>=n?e:[e[1],e[2],e[3],e[0]]}function Gt(e,t,n){return[je(e[0],e[1],t),je(e[0],e[1],n),je(e[3],e[2],n),je(e[3],e[2],t)]}function Si(e,t,n){return[je(e[0],e[3],t),je(e[1],e[2],t),je(e[1],e[2],n),je(e[0],e[3],n)]}function Ve(e,t,n,r,o,i){ue(e,t,void 0,()=>n,r,o,i,le)}var yo=2.4,ql=.75,$l=.15;function zt(e){if(e.points&&e.points.length>=3)return e.points;let{center:t,width:n,height:r,rotation:o}=e;if(!n||!r)return null;let i=(o??0)*Math.PI/180,a=Math.cos(i),s=Math.sin(i),c=n/2,u=r/2;return[[-c,-u],[c,-u],[c,u],[-c,u]].map(([d,f])=>({x:t.x+d*a-f*s,y:t.y+d*s+f*a}))}function Mi(e,t,n,r,o){let i=zt(t);i&&ue(e,i,void 0,()=>n+yo,n,Oe(r,o.boothTop),o.boothWall,le)}function go(e){if(e.shape==="round"){let d=e.radius;return d?sn(e.center.x,e.center.y,d,d,24):null}let{width:t,height:n,rotation:r,center:o}=e;if(!t||!n)return null;let i=(r??0)*Math.PI/180,a=Math.cos(i),s=Math.sin(i),c=t/2,u=n/2;return[[-c,-u],[c,-u],[c,u],[-c,u]].map(([d,f])=>({x:o.x+d*a-f*s,y:o.y+d*s+f*a}))}function wi(e,t,n,r,o){let i=go(t);i&&ue(e,i,void 0,()=>n+ql,n,Oe(r,o.tableTop),o.tableWall,le)}function Pi(e,t,n,r,o,i,a,s){let c=rt(t);if(!c)return;let u=s?s.kind==="stage":t.role==="stage",d=s?s.kind==="screen":t.role==="screen",f=s?{kind:u?"stage":"solid",heightM:s.topY-s.baseY}:Nt(t),m=s?.baseY??n,l=s?.topY??n+r;if(u&&a){let v=1/0,S=-1/0,M=1/0,R=-1/0;for(let x of c)x.x<v&&(v=x.x),x.x>S&&(S=x.x),x.y<M&&(M=x.y),x.y>R&&(R=x.y);a.push({cx:(v+S)/2*z,cz:(M+R)/2*z,y:l,halfX:Math.max((S-v)/2*z,.5),halfZ:Math.max((R-M)/2*z,.5)})}let p=ne(t.fill),h=u&&p?ge(o.stageTop,Pe(Et(p,.18),.9),.9):Oe(p,u?o.stageTop:o.decorTop),b=d?p:null,y=u?p?ge(o.stageWall,Pe(p,.58),.82):o.stageWall:d?b?ge(Pe(b,1.42),[.24,.46,.82],.08):[.24,.46,.82]:Oe(ne(t.fill),o.decorWall);if(f.kind==="portal"&&c.length===4){let v=vi(c);Ve(e,Gt(v,0,.16),l,m,h,y),Ve(e,Gt(v,.84,1),l,m,h,y),Ve(e,v,l,Math.max(m,l-.35),h,y);return}if(f.kind==="suite"&&c.length===4){let v=c.map((R,x)=>{let g=c[(x+1)%4],C=(R.x+g.x)/2,E=(R.y+g.y)/2;return Math.hypot(C-i.x,E-i.y)}),S=v.indexOf(Math.min(...v)),M=[0,1,2,3].map(R=>c[(S+R)%4]);Ve(e,Gt(M,0,.08),l,m,h,y),Ve(e,Gt(M,.92,1),l,m,h,y),Ve(e,Si(M,.88,1),l,m,h,y),Ve(e,M,l,Math.max(m,l-.18),h,y);return}Ve(e,c,l,m,h,y)}function xo(e){let{x:t,y:n,width:r,height:o}=e;if(!r||!o)return null;let i=t+r/2,a=n+o/2,s=(e.rotation??0)*Math.PI/180,c=Math.cos(s),u=Math.sin(s),d=r/2,f=o/2;return[[-d,-f],[d,-f],[d,f],[-d,f]].map(([m,l])=>({x:i+m*c-l*u,y:a+m*u+l*c}))}function Ql(e){if(!e||!e.startsWith("data:image/svg+xml"))return null;let t=e.slice(e.indexOf(",")+1);if(/;base64/i.test(e.slice(0,e.indexOf(","))))try{t=atob(t)}catch{return null}else try{t=decodeURIComponent(t)}catch{}let n=t.match(/<(?:rect|path)\b[^>]*\bfill="([^"]+)"/i);if(!n)return null;let r=n[1].trim();if(r==="none"||r==="transparent")return null;let o=r.match(/^url\(#([^)]+)\)$/);if(!o)return ne(r);let i=t.match(new RegExp(`<(?:linear|radial)Gradient\\b[^>]*\\bid="${o[1]}"[^>]*>([\\s\\S]*?)</(?:linear|radial)Gradient>`,"i"));if(!i)return null;let a=[];for(let s of i[1].matchAll(/stop-color="([^"]+)"/gi)){let c=ne(s[1].trim());c&&a.push(c)}return a.length?a.reduce((s,c,u)=>ge(s,c,1/(u+1)),a[0]):null}function Ci(e,t,n,r){if(t.layer==="foreground")return;let o=xo(t);if(!o)return;let i=n+$l,a=Oe(Ql(t.href),r.decorTop),s=Math.max(0,Math.min(1,t.opacity??1));s<1&&(a=ge(r.ground,a,s)),ue(e,o,void 0,()=>i,n,a,ge(a,r.decorWall,.5),le)}function Ai(e,t,n,r,o){if(!t.points||t.points.length<3)return;let i=Oe(r,o.gaTop);ue(e,t.points,t.holes,()=>n+.15,n,i,o.gaWall,le)}var Zl=Math.PI/180,oe=96,Jl=6,eu=60,tu=150,Ri=.2,nu=.35;function ou(e,t){let n=Math.atan2(t.x-e.x,t.y-e.y)/Zl;return n<0?n+360:n}function gn(e){if(!e.length)return NaN;let t=[...e].sort((n,r)=>n-r);return t[Math.floor(t.length/2)]}function xn(e,t,n=2){let r=e.length,o=new Float64Array(r);for(let i=0;i<r;i++){let a=0,s=0;for(let c=-n;c<=n;c++){let u=i+c;if(t)u=(u%r+r)%r;else if(u<0||u>=r)continue;a+=e[u],s++}o[i]=a/s}return o}function Ei(e,t){let n=e.filter(m=>m.rows.length>=1);if(n.length<1)return null;let r=[],o=0,i=0,a=0;for(let m of n)for(let l of m.rows){for(let p of l.pts)o+=p.x,i+=p.y,a++;if(l.pts.length>=4){let p=ao(l.pts);p&&Number.isFinite(p.cx)&&Number.isFinite(p.cy)&&r.push({x:p.cx,y:p.cy})}}if(!a)return null;let s={x:o/a,y:i/a},c=s;if(r.length>=8){let m=gn(r.map(y=>y.x)),l=gn(r.map(y=>y.y)),p=0;for(let y of n)for(let v of y.rows)for(let S of v.pts){let M=Math.hypot(S.x-s.x,S.y-s.y);M>p&&(p=M)}let h=0,b=p*.2;for(let y of n)for(let v of y.rows)for(let S of v.pts)Math.hypot(S.x-m,S.y-l)<b&&h++;Math.hypot(m-s.x,l-s.y)<=p&&h/a<.01&&(c={x:m,y:l})}let u=[];for(let m of n){let l={sectionId:m.sectionId,rMin:1/0,rMax:-1/0,samples:[]};for(let p of m.rows)for(let h of p.pts){let b=Math.hypot(h.x-c.x,h.y-c.y),y=Math.min(oe-1,Math.floor(ou(c,h)/(360/oe)));l.samples.push({r:b,bin:y,levelM:p.levelM}),b<l.rMin&&(l.rMin=b),b>l.rMax&&(l.rMax=b)}l.samples.length&&u.push(l)}if(!u.length)return null;u.sort((m,l)=>m.rMin+m.rMax-(l.rMin+l.rMax));let d=[];for(let m of u){let l=!1;for(let p of d){let h=Math.min(m.rMax,p.rMax)-Math.max(m.rMin,p.rMin),b=Math.min(m.rMax-m.rMin,p.rMax-p.rMin);if(b>1e-9&&h>=nu*b){p.members.push(m),p.rMin=Math.min(p.rMin,m.rMin),p.rMax=Math.max(p.rMax,m.rMax),l=!0;break}}l||d.push({members:[m],rMin:m.rMin,rMax:m.rMax})}let f=[];for(let m of d){let l=new Array(oe).fill(null);for(let A of m.members)for(let k of A.samples){let N=l[k.bin];N||(N={samples:[]},l[k.bin]=N),N.samples.push({r:k.r,levelM:k.levelM})}let p=l.map(A=>!!A);if(!p.filter(Boolean).length)continue;let b=[],y=[];for(let A of l){if(!A)continue;let k=1/0,N=-1/0;for(let w of A.samples)w.r<k&&(k=w.r),w.r>N&&(N=w.r);b.push(k),y.push(N)}let v=gn(b),S=gn(y);if(!(v>=Ri*S)||!(S>0))continue;let M=[...b].sort((A,k)=>A-k);if(!(M[Math.floor(M.length*.1)]>=Ri*S))continue;let x=l.map(A=>{if(!A)return null;let k=[...A.samples].sort((F,H)=>F.r-H.r),N=k[0].r,w=k[k.length-1].r,T=k[0].levelM,_=-1/0;for(let F of k)F.levelM>_&&(_=F.levelM);let P=[];for(let F of k){let H={r:F.r,l:F.levelM};for(;P.length&&Math.abs(P[P.length-1].r-H.r)<1e-9;){if(P[P.length-1].l<=H.l){H.skip=!0;break}P.pop()}if(!H.skip){for(;P.length>=2;){let j=P[P.length-2],G=P[P.length-1];if((G.r-j.r)*(H.l-j.l)-(G.l-j.l)*(H.r-j.r)<=0)P.pop();else break}P.push(H)}}let O=P.map(F=>F.r),I=P.map(F=>F.l);return{inner:N,outer:w,front:T,top:_,profile:{rs:O,ls:I}}}),g=p.slice();for(let A=0;A<oe;A++){if(g[A])continue;let k=-1,N=-1,w=0;for(let V=1;V<=oe;V++){let W=(A-V+oe*2)%oe;if(g[W]){k=W;break}}for(let V=1;V<=oe;V++){let W=(A+V)%oe;if(g[W]){N=W,w=V;break}}if(k<0||N<0)continue;let T=0;for(let V=1;V<=oe;V++){let W=(A-V+oe*2)%oe;if(p[W]){T=V;break}}if(T-1+w>Jl)continue;let P=x[k],O=x[N],I=T/(T+w),F=P.inner+(O.inner-P.inner)*I,H=P.outer+(O.outer-P.outer)*I,j=P.front+(O.front-P.front)*I,G=P.top+(O.top-P.top)*I;x[A]={inner:F,outer:H,front:j,top:G,profile:{rs:[F,H],ls:[j,G]}}}for(let A=0;A<oe;A++)x[A]&&(g[A]=!0);let C=360/oe,E=[],D=g.filter(Boolean).length,B=[];if(D===oe)B.push({start:0,len:oe});else{let A=0;for(;g[A];)A=(A+1)%oe;let k=-1;for(let N=0;N<=oe;N++){let w=(A+N)%oe,T=N<oe&&g[w];if(T&&k<0)k=w;else if(!T&&k>=0){let _=(w-k+oe)%oe||oe;B.push({start:k,len:_}),k=-1}}}for(let A of B){if(A.len*C<eu&&A.len<oe)continue;let k=A.len===oe,N=new Float64Array(A.len),w=new Float64Array(A.len),T=new Float64Array(A.len),_=new Float64Array(A.len),P=[];for(let V=0;V<A.len;V++){let W=x[(A.start+V)%oe];N[V]=W.inner,w[V]=W.outer,T[V]=W.front,_[V]=W.top,P.push(W.profile??{rs:[W.inner,W.outer],ls:[W.front,W.top]})}let O=xn(N,k),I=xn(w,k),F=xn(T,k),H=xn(_,k);for(let V=0;V<A.len;V++)O[V]>N[V]&&(O[V]=N[V]),I[V]<w[V]&&(I[V]=w[V]),O[V]>I[V]-1e-6&&(O[V]=Math.max(0,I[V]-1e-6)),H[V]<F[V]&&(H[V]=F[V]);let j={startBin:A.start,binCount:A.len,closed:k,innerR:O,outerR:I,frontLevelM:F,topLevelM:H,profiles:P},G=(V,W,X)=>{let Q=P[V],q=Q.rs,K=Q.ls;if(W<=q[0]){K[0]>X&&(K[0]=X);return}if(W>=q[q.length-1]){K[K.length-1]>X&&(K[K.length-1]=X);return}for(let Z=0;Z+1<q.length;Z++)if(W<=q[Z+1]){K[Z]>X&&(K[Z]=X),K[Z+1]>X&&(K[Z+1]=X);return}};for(let V=0;V<A.len;V++){let W=l[(A.start+V)%oe];if(W)for(let X of W.samples){G(V,X.r,X.levelM);let Q=k?(V-1+A.len)%A.len:V-1,q=k?(V+1)%A.len:V+1;Q>=0&&G(Q,X.r,X.levelM),q<A.len&&G(q,X.r,X.levelM)}}E.push(j)}E.reduce((A,k)=>A+k.binCount*C,0)<tu||f.push({arcs:E,sectionIds:m.members.map(A=>A.sectionId),innerRMedian:v,outerRMedian:S})}if(!f.length)return null;if(f.sort((m,l)=>m.innerRMedian-l.innerRMedian),t){let m=f[f.length-1].outerRMedian;if(Math.hypot(t.x-c.x,t.y-c.y)>.9*m)return null}return{centre:c,binCount:oe,binStepDeg:360/oe,rings:f}}function Ii(e,t,n,r){let o=e.binStepDeg,i=n/o-.5-t.startBin;i=(i%e.binCount+e.binCount)%e.binCount,i>t.binCount-1&&(t.closed?i=i-t.binCount<t.binCount-i?0:t.binCount-1:i=i-(t.binCount-1)<e.binCount-i?t.binCount-1:0);let a=Math.floor(i),s=t.closed?(a+1)%t.binCount:Math.min(t.binCount-1,a+1),c=i-a,u=d=>{let f=t.profiles[d],m=f.rs,l=f.ls;if(r<=m[0])return l[0];if(r>=m[m.length-1])return l[l.length-1];for(let p=0;p+1<m.length;p++)if(r<=m[p+1]){let h=m[p+1]-m[p],b=h>1e-9?(r-m[p])/h:0;return l[p]+(l[p+1]-l[p])*b}return l[l.length-1]};return u(a)*(1-c)+u(s)*c}var ru=.25,iu=1.2,au=.6,su=.45,cu=2.3,lu=Math.PI/180;function it(e,t,n){let r=n*lu;return{x:e.x+t*Math.sin(r),y:e.y+t*Math.cos(r)}}function uu(e,t){let n=t.rings[t.rings.length-1];if(!n)return!1;let r=n.outerRMedian*.85;for(let o of e){if(o.role!=="wall")continue;let i=o.points&&o.points.length>=2?o.points:o.x!==void 0&&o.y!==void 0&&o.width!==void 0&&o.height!==void 0?[{x:o.x,y:o.y},{x:o.x+o.width,y:o.y},{x:o.x+o.width,y:o.y+o.height},{x:o.x,y:o.y+o.height}]:[];if(i.length<2)continue;let a=0;for(let s of i)Math.hypot(s.x-t.centre.x,s.y-t.centre.y)>=r&&a++;if(a>=i.length/2)return!0}return!1}var mu=24;function du(e,t,n,r,o,i,a,s){let c=n.binCount,u=mu,d=be,f=i+.02,m=[];for(let L=0;L<c;L++){let A=(n.startBin+L+.5)*t.binStepDeg,k=new Float64Array(u+1);for(let N=0;N<=u;N++){let w=r[L]+(o[L]-r[L])*N/u;k[N]=Math.max(f,Ii(t,n,A,w)-ru)}m.push(k)}let l=[a.bandTop[0]*s.top,a.bandTop[1]*s.top,a.bandTop[2]*s.top],p=[a.bandTop[0]*s.bottomCap,a.bandTop[1]*s.bottomCap,a.bandTop[2]*s.bottomCap],h=[a.bandWall[0]*s.top,a.bandWall[1]*s.top,a.bandWall[2]*s.top],b=[a.bandWall[0]*s.wallBottom,a.bandWall[1]*s.wallBottom,a.bandWall[2]*s.wallBottom],y=(L,A)=>{let k=(n.startBin+L+.5)*t.binStepDeg,N=r[L]+(o[L]-r[L])*A/u,w=it(t.centre,N,k);return[w.x*d,m[L][A],w.y*d]};{let L=Math.tan(12*Math.PI/180);for(let A=0;A<6;A++){let k=!1;for(let w=0;w<c;w++)for(let T=u-1;T>=0;T--)m[w][T]>m[w][T+1]&&(m[w][T]=m[w][T+1],k=!0);let N=n.closed?c:c-1;for(let w=0;w<N;w++){let T=(w+1)%c;for(let _=0;_<=u;_++){let P=m[T][_]-m[w][_];if(Math.abs(P)>1)continue;let O=r[w]+(o[w]-r[w])*_/u,I=r[T]+(o[T]-r[T])*_/u,F=it(t.centre,O,(n.startBin+w+.5)*t.binStepDeg),H=it(t.centre,I,(n.startBin+T+.5)*t.binStepDeg),j=L*Math.hypot(H.x-F.x,H.y-F.y)*d;P>j?(m[T][_]=m[w][_]+j,k=!0):-P>j&&(m[w][_]=m[T][_]+j,k=!0)}}if(!k)break}}let v=1,S=(L,A)=>{for(let k=0;k<=u;k+=4)if(Math.abs(m[L][k]-m[A][k])>v)return!0;return Math.abs(m[L][u]-m[A][u])>v},M=Math.tan(38*Math.PI/180),R=L=>(o[L]-r[L])/u*d,x=(L,A)=>m[L][A+1]-m[L][A]>M*Math.max(1e-6,R(L)),g=(L,A)=>{let k=n.closed?(L-1+c)%c:Math.max(0,L-1),N=n.closed?(L+1)%c:Math.min(c-1,L+1);Math.abs(m[k][A]-m[L][A])>v&&(k=L),Math.abs(m[N][A]-m[L][A])>v&&(N=L);let w=Math.max(0,A-1),T=Math.min(u,A+1);w<A&&x(L,w)&&(w=A),T>A&&x(L,A)&&(T=A);let _=y(k,A),P=y(N,A),O=y(L,w),I=y(L,T),F=P[0]-_[0],H=P[1]-_[1],j=P[2]-_[2],G=I[0]-O[0],V=I[1]-O[1],W=I[2]-O[2],X=H*W-j*V,Q=j*G-F*W,q=F*V-H*G,K=Math.hypot(X,Q,q);return K>1e-12?(X/=K,Q/=K,q/=K,Q<0&&(X=-X,Q=-Q,q=-q),[X,Q,q]):[0,1,0]},C=(L,A)=>{let k=[L[0],i,L[2]],N=[A[0],i,A[2]],w=A[0]-L[0],T=A[2]-L[2],_=Math.hypot(w,T);if(!(_>1e-12))return;let P=[T/_,0,-w/_];e.tri(L,A,N,P,h,h,b),e.tri(L,N,k,P,h,b,b)},E=.05*He,D=L=>o[L]-r[L]<E,B=n.closed?c:c-1;for(let L=0;L<B;L++){let A=(L+1)%c;if(D(L)||D(A))continue;if(S(L,A)){let P=(n.startBin+L+1)*t.binStepDeg,O=(V,W)=>{let X=(r[L]+r[A])/2,Q=(o[L]+o[A])/2,q=X+(Q-X)*W/u,K=it(t.centre,q,P);return[K.x*d,m[V][W],K.y*d]};for(let V=0;V<u;V++){let W=y(L,V),X=y(L,V+1),Q=O(L,V),q=O(L,V+1),K=g(L,V),Z=g(L,V+1);e.triN(W,Q,q,K,K,Z,l),e.triN(W,q,X,K,Z,Z,l);let te=y(A,V),Me=y(A,V+1),Ae=O(A,V),Be=O(A,V+1),ke=g(A,V),Ne=g(A,V+1);e.triN(Ae,te,Me,ke,ke,Ne,l),e.triN(Ae,Me,Be,ke,Ne,Ne,l);let we=O(L,V),de=O(L,V+1),Ge=O(A,V+1),ct=O(A,V),lt=de[0]-we[0],Fe=de[2]-we[2],qe=Math.hypot(lt,Fe);if(qe>1e-12){let ut=[Fe/qe,0,-lt/qe];e.tri(we,de,Ge,ut,h),e.tri(we,Ge,ct,ut,h)}}let I=y(L,0),F=y(A,0),H=y(A,u),j=y(L,u),G=V=>[V[0],i,V[2]];e.tri(G(I),G(H),G(F),[0,-1,0],p),e.tri(G(I),G(j),G(H),[0,-1,0],p),C(I,F),C(j,H);continue}for(let P=0;P<u;P++){let O=g(L,P),I=g(A,P),F=g(A,P+1),H=g(L,P+1);if(x(L,P)||x(A,P)){let X=(de,Ge)=>{let ct=(n.startBin+de+.5)*t.binStepDeg,lt=r[de]+(o[de]-r[de])*(P+.5)/u,Fe=it(t.centre,lt,ct);return[Fe.x*d,Ge,Fe.y*d]},Q=y(L,P),q=y(A,P),K=X(L,m[L][P]),Z=X(A,m[A][P]);e.triN(Q,q,Z,O,I,I,l),e.triN(Q,Z,K,O,I,O,l);let te=y(A,P+1),Me=y(L,P+1),Ae=X(L,m[L][P+1]),Be=X(A,m[A][P+1]);e.triN(Ae,Be,te,H,F,F,l),e.triN(Ae,te,Me,H,F,H,l);let ke=Z[0]-K[0],Ne=Z[2]-K[2],we=Math.hypot(ke,Ne);if(we>1e-12){let de=[-Ne/we,0,ke/we];e.tri(K,Z,Be,de,h),e.tri(K,Be,Ae,de,h)}continue}let j=y(L,P),G=y(A,P),V=y(A,P+1),W=y(L,P+1);e.triN(j,G,V,O,I,F,l),e.triN(j,V,W,O,F,H,l)}let k=y(L,0),N=y(A,0),w=y(A,u),T=y(L,u),_=P=>[P[0],i,P[2]];e.tri(_(k),_(w),_(N),[0,-1,0],p),e.tri(_(k),_(T),_(w),[0,-1,0],p),C(k,N),C(T,w)}if(!n.closed)for(let L of[0,c-1])for(let A=0;A<u;A++)C(y(L,A),y(L,A+1))}function Ti(e,t,n){let{bottomY:r,colors:o,ao:i}=n,a=new Float64Array(t.binCount).fill(-1/0);for(let d of t.rings)for(let f of d.arcs){let m=new Float64Array(f.binCount),l=new Float64Array(f.binCount);for(let h=0;h<f.binCount;h++){let b=(f.startBin+h)%t.binCount,y=Math.max(0,f.innerR[h]-Ce);m[h]=Math.max(y,a[b]+.001),l[h]=Math.max(m[h]+.001,f.outerR[h]+Ce)}let p=0;for(let h=0;h<f.binCount;h++){let b=f.topLevelM[h]-r;b>p&&(p=b)}p>=iu&&du(e,t,f,m,l,r,o,i);for(let h=0;h<f.binCount;h++){let b=(f.startBin+h)%t.binCount;l[h]>a[b]&&(a[b]=l[h])}}if(n.deriveShell===!1||uu(n.shapes,t))return;let s=t.rings[t.rings.length-1],c=au*He,u=su*He;for(let d of s.arcs){let f=[],m=[];for(let h=0;h<d.binCount;h++){let b=(d.startBin+h+.5)*t.binStepDeg,y=d.outerR[h]+Ce+c;f.push(it(t.centre,y,b)),m.push(it(t.centre,y+u,b))}let l=-1/0;for(let h=0;h<d.binCount;h++)d.topLevelM[h]>l&&(l=d.topLevelM[h]);let p=()=>l+cu;d.closed?ue(e,m,[f.slice().reverse()],p,r,o.shellTop,o.shellWall,i):ue(e,[...m,...f.slice().reverse()],void 0,p,r,o.shellTop,o.shellWall,i)}}function _i(e,t,n,r,o,i,a,s){if(!t.outline||t.outline.length<3)return;let c=n.baseHeightM,u=Oe(r,s.tierTop);if(!o)return;let d=b=>o.deckAt(b.x,b.y),f=di(t,a),m=f[0]??t.outline;if(o.rowLevels.length>=2){let b=hn(o.rowLevels),y=fi(ai(o.rowLevels,n.focal,b),f),v=()=>[0,1,0];for(let M of y){let R=Math.max(c,M.topY-.02);for(let x of i.subtract(M.outline,R))ue(e,x,M.holes,()=>R,c,u,s.tierWall,le,void 0,v)}y.length||ue(e,m,t.holes,()=>o.landingY,c,u,s.tierWall,le);let S={tread:[u[0]*le.top,u[1]*le.top,u[2]*le.top],riser:[u[0]*.72,u[1]*.72,u[2]*.72]};for(let M of f.length?f:[m])ci(e,o.rowLevels,n.focal,o.landingY,S,M,b);return}let l=o.flat?1/0:pi,p=b=>o.normalAt(b.x,b.y),h=o.flat?o.landingY:void 0;for(let b of i.subtract(m,h))ue(e,b,t.holes,d,c,u,s.tierWall,le,l,p)}function fu(e,t,n){let r=new Set;for(let a of e.objects)a.type==="section"&&r.add(a.id);let o=new Map;for(let a=0;a<t.length;a++){let s=n.seatOwner[a];if(!s||!r.has(s))continue;let c=n.bySection.get(s);if(c&&c.rowLevels.length>=2)continue;let u=t[a],d=o.get(s);d||(d=new Map,o.set(s,d));let f=u.rowId||`__seat-${a}`,m=d.get(f);m||(m={pts:[],levelM:0,n:0},d.set(f,m)),m.pts.push({x:u.x,y:u.y}),m.levelM+=n.seatDeckY(a),m.n++}let i=[];for(let a of e.objects){if(a.type!=="section")continue;let s=n.bySection.get(a.id);if(s&&s.rowLevels.length>=2){let u=s.rowLevels.filter(d=>!d.patch).map(d=>({pts:d.pts,levelM:d.y}));u.length>=2&&i.push({sectionId:a.id,rows:u});continue}let c=o.get(a.id);c&&i.push({sectionId:a.id,rows:[...c.values()].map(u=>({pts:u.pts,levelM:u.levelM/u.n}))})}return i}function Li(e,t,n,r,o,i,a=!0){let s=fu(t,n,r);if(!s.length)return;let c=Ei(s,t.focal);c&&(e.setMaterial(0),Ti(e,c,{bottomY:t.baseHeightM,colors:{bandTop:Pe(o.tierTop,.8),bandWall:o.tierWall,shellTop:i??Pe(o.tierWall,1.15),shellWall:i??o.tierWall},ao:le,shapes:t.objects.filter(u=>u.type==="shape"),deriveShell:a}))}var ki=/^[\p{L}\p{N}]{1,4}$/u,pu=/^([\p{L}\p{N}]{2,})[\s\-\u2013\u2014\u00b7_./]+(.+)$/u;function Fi(e,t){let n=t?.trim();if(!n)return e;let r=e.toLocaleLowerCase("en-US"),o=n.toLocaleLowerCase("en-US");if(r.startsWith(`${o} `)){let a=e.slice(n.length).trim();if(ki.test(a))return a}let i=pu.exec(e);if(i){let a=i[1].toLocaleLowerCase("en-US"),s=i[2].trim();if((o.startsWith(a)||a.startsWith(o))&&ki.test(s))return s}return e}function Di(e,t,n){return n<0?t>1?e.filter(r=>r.kind==="floor"):[...e]:e.filter(r=>r.floorIndex===void 0||r.floorIndex===n)}function Oi(e,t){let n=[...e].sort((o,i)=>o.screen.y-i.screen.y),r=[];for(let o of n){let i=r.find(a=>a.some(s=>Math.abs(s.screen.x-o.screen.x)<104&&Math.abs(s.screen.y-o.screen.y)<34));i?i.push(o):r.push([o])}return r.flatMap(o=>o.length<2?o:o.map((i,a)=>({...i,screen:{...i.screen,x:Math.max(54,Math.min(t-54,i.screen.x+(a-(o.length-1)/2)*104))}})))}var hu=1.15,bu=2.75,yu=4.5,gu=.85,xu=.5,vu=.26;function Vi(e,t,n){let r=Math.max(1e-6,t),o=e/r,i=n?.hasZoneLabels??!0,a=new Set;return o>=.75&&a.add("floor"),o>=hu&&a.add("zone"),o<=(i?bu:yu)&&(a.add("section"),a.add("ga")),o<=gu&&(a.add("annotation"),a.add("booth")),o<=xu&&a.add("row"),o<=vu&&a.add("seat"),a}function Bi(e,t,n,r,o,i=6){let a=i+t,s=r-i-t,c=i+n,u=o-i-n;return{...e,x:a>s?r/2:Math.max(a,Math.min(s,e.x)),y:c>u?o/2:Math.max(c,Math.min(u,e.y))}}function Ye(e,t,n,r){let o=e,i=t[0],a=t[1],s=t[2],c=o[0]*i+o[4]*a+o[8]*s+o[12],u=o[1]*i+o[5]*a+o[9]*s+o[13],d=o[2]*i+o[6]*a+o[10]*s+o[14],f=o[3]*i+o[7]*a+o[11]*s+o[15];if(!(f>1e-6))return{x:0,y:0,depth:1/0,visible:!1};let m=c/f,l=u/f,p=d/f,h=m>=-1.05&&m<=1.05&&l>=-1.05&&l<=1.05&&p<=1;return{x:(m*.5+.5)*n,y:(1-(l*.5+.5))*r,depth:p,visible:h}}function Ni(e,t,n=t){let r=[],o=[...e].sort((i,a)=>i.screen.depth-a.screen.depth);for(let i of o){let a=!1;for(let s of r)if(vo(i,s,t,n)){a=!0;break}a||r.push(i)}return r}var Su=6;function vo(e,t,n,r){let o=Math.abs(e.screen.x-t.screen.x),i=Math.abs(e.screen.y-t.screen.y),a=e.halfWidth!=null&&t.halfWidth!=null?Math.max(n,e.halfWidth+t.halfWidth+Su):n;return o<a&&i<r}function Gi(e,t,n){return e.length*t*.58+(n?14:0)}var Mu={row:8,seat:14};function zi(e){return e<480?{row:5,seat:8}:e<768?{row:6,seat:10}:Mu}function Ui(e,t,n,r){let o=Math.max(1,Math.min(n,r)*.5),i=Math.min(2,Math.hypot(e.x-n/2,e.y-r/2)/o);return t*(1+1.5*i)}function So(e,t,n,r,o=[]){let i=[...e].sort((s,c)=>(c.priority??0)-(s.priority??0)||s.focus-c.focus),a=[];for(let s of i){if(a.length>=r)break;let c=!1;for(let u of o)if(vo(s,u,t,n)){c=!0;break}if(!c){for(let u of a)if(vo(s,u,t,n)){c=!0;break}}c||a.push(s)}return a}var wu=6,Pu=2.2,Hi=.1,Cu=.3,Au=1.8,Ru=.9,Eu=.55,Iu=6e3;function ji(e){let{doc:t,units:n,seats:r,surfaces:o,focal:i}=e,a=t.zones??[],s=[];if(a.length){let c=new Map;for(let d of n)for(let f of d.objects)f.type==="section"&&f.zone&&c.set(f.id,f.zone);let u=new Map;for(let d=0;d<r.length;d++){let f=r[d],m=o.seatOwner[d],l=f.zoneId??(m?c.get(m):void 0);if(!l)continue;let p=u.get(l);p||(p={n:0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0,sumY:0},u.set(l,p)),p.n++,f.x<p.minX&&(p.minX=f.x),f.y<p.minY&&(p.minY=f.y),f.x>p.maxX&&(p.maxX=f.x),f.y>p.maxY&&(p.maxY=f.y),p.sumY+=o.seatDeckY(d)}for(let d of a){let f=u.get(d.id),m=[];for(let[l,p]of c)p===d.id&&m.push(l);if(!f||f.n===0){s.push({id:d.id,label:d.label,color:ne(d.color),sectionIds:m,seatCount:0,center:[0,0,0],radius:0,focalWorld:[(d.focalPoint??i).x*z,1.5,(d.focalPoint??i).y*z]});continue}s.push({id:d.id,label:d.label,color:ne(d.color),sectionIds:m,seatCount:f.n,center:[(f.minX+f.maxX)/2*z,f.sumY/f.n,(f.minY+f.maxY)/2*z],radius:.5*Math.hypot((f.maxX-f.minX)*z,(f.maxY-f.minY)*z)||1,focalWorld:[(d.focalPoint??i).x*z,1.5,(d.focalPoint??i).y*z]})}}return s}function Yi(e){let{doc:t,units:n,seats:r,surfaces:o,seatData:i,hintedSeatFloor:a,zones:s,focal:c}=e,u=[],d=[],f=[];for(let m of s)m.seatCount!==0&&u.push({id:`zone:${m.id}`,kind:"zone",text:m.label,anchor:[m.center[0],m.center[1]+wu,m.center[2]],color:t.zones?.find(l=>l.id===m.id)?.color});{let m=new Map,l=new Map;for(let p=0;p<r.length;p++){let h=o.seatOwner[p];if(!h)continue;let b=m.get(h);b||(b={n:0,x:0,y:0,deck:0},m.set(h,b)),b.n++,b.x+=r[p].x,b.y+=r[p].y,b.deck+=o.seatDeckY(p);let y=l.get(h);y||(y={minX:1/0,maxX:-1/0,minY:1/0,maxY:-1/0},l.set(h,y)),r[p].x<y.minX&&(y.minX=r[p].x),r[p].x>y.maxX&&(y.maxX=r[p].x),r[p].y<y.minY&&(y.minY=r[p].y),r[p].y>y.maxY&&(y.maxY=r[p].y)}for(let p of n)for(let h of p.objects){if(h.type!=="section")continue;let b=m.get(h.id);if(!b||b.n===0)continue;let y=l.get(h.id),v=[b.x/b.n*z,b.deck/b.n,b.y/b.n*z],S=h.displayLabel||h.label||h.id;d.push({id:h.id,floorIndex:p.index,label:S,seatCount:b.n,center:v,radius:Math.max(1,Math.hypot(y.maxX-y.minX,y.maxY-y.minY)*.5*z),focalWorld:[p.focal.x*z,p.baseHeightM+1.5,p.focal.y*z]});let M=t.floors?.[p.index]?.name?.trim().toLocaleLowerCase();n.length>1&&M===S.trim().toLocaleLowerCase()||u.push({id:`section:${h.id}`,kind:"section",text:S,anchor:[v[0],v[1]+Pu,v[2]],floorIndex:p.index})}}{for(let h of n)for(let b of h.objects){if(b.type!=="gaArea")continue;let y=Lt(b.points);if(!y)continue;let v=b.displayLabel||b.label||b.id;u.push({id:`ga:${b.id}`,kind:"ga",text:b.capacity>0?`${v} \xB7 ${b.capacity.toLocaleString()}`:v,anchor:[y.x*z,h.baseHeightM+Au,y.y*z],floorIndex:h.index})}let m=new Map;for(let h of n)for(let b of h.objects)b.type==="section"&&m.set(b.id,b.displayLabel||b.label||b.id);let l=new Map;for(let h=0;h<r.length;h++){let b=r[h],y=Math.hypot(b.x-c.x,b.y-c.y),v=l.get(b.rowId);(!v||y>v.far)&&l.set(b.rowId,{seat:b,index:h,far:y})}for(let[h,b]of l){let y=Tu(b.seat.label,h,m.get(b.seat.sectionId??""));y&&u.push({id:`row:${h}`,kind:"row",text:y,anchor:[b.seat.x*z,o.seatDeckY(b.index)+Ru,b.seat.y*z],floorIndex:a[b.index]})}let p=new Map;for(let h=0;h<r.length;h++){let b=r[h],y=b.label?b.label.lastIndexOf("-"):-1,v=p.get(b.rowId);v||(v={n:0,x:0,y:0,z:0,minX:1/0,maxX:-1/0,minZ:1/0,maxZ:-1/0,label:y>0?b.label.slice(0,y):b.rowId,sectionId:b.sectionId},p.set(b.rowId,v));let S=h*3,M=i.iPosition[S],R=i.iPosition[S+1],x=i.iPosition[S+2];v.n++,v.x+=M,v.y+=R,v.z+=x,v.minX=Math.min(v.minX,M),v.maxX=Math.max(v.maxX,M),v.minZ=Math.min(v.minZ,x),v.maxZ=Math.max(v.maxZ,x)}for(let[h,b]of p)f.push({id:h,label:b.label,sectionId:b.sectionId,seatCount:b.n,center:[b.x/b.n,b.y/b.n,b.z/b.n],radius:Math.max(.8,Math.hypot(b.maxX-b.minX,b.maxZ-b.minZ)*.5)});if(r.length<=Iu)for(let h=0;h<r.length;h++){let b=r[h],y=Mo(b.displayLabel||b.label);y&&u.push({id:`seat:${b.id}`,kind:"seat",text:y,anchor:[b.x*z,o.seatDeckY(h)+Eu,b.y*z],floorIndex:a[h]})}}for(let m of n)for(let l of m.objects)if(l.type==="shape"&&l.role&&["entrance","exit","screen","suite","obstruction"].includes(l.role)){let p=rt(l),h=p?Lt(p):null;if(!h||!l.label)continue;u.push({id:`architecture:${l.id}`,kind:"annotation",text:l.label,anchor:[h.x*z,m.baseHeightM+Nt(l).heightM+Hi,h.y*z],color:l.fill,floorIndex:m.index})}else if(l.type==="text"){if(!l.text)continue;u.push({id:`text:${l.id}`,kind:"annotation",text:l.text,anchor:[l.position.x*z,m.baseHeightM+Hi,l.position.y*z],color:l.color,rotation:l.rotation,floorIndex:m.index})}else if(l.type==="booth"){let p=zt(l);if(!p)continue;let h=Lt(p);if(!h)continue;u.push({id:`booth:${l.id}`,kind:"booth",text:l.displayLabel||l.label||l.id,anchor:[h.x*z,m.baseHeightM+yo+Cu,h.y*z],floorIndex:m.index})}return{labels:u,sections:d,rows:f}}function Xi(e,t){if(t.length>1)for(let n of t)e.push({id:`floor:${n.id}`,kind:"floor",text:n.label,anchor:[n.center[0],n.box.max[1]+1.2,n.center[2]],floorIndex:n.index})}function Mo(e){let t=e.lastIndexOf("-");return t>=0&&t<e.length-1?e.slice(t+1):e}function Tu(e,t,n){let r=e?e.lastIndexOf("-"):-1,o=r>0?e.slice(0,r):t;return o&&Fi(o,n)}function Wi(e){let{doc:t,units:n,seats:r,surfaces:o,solids:i,hintedSeatFloor:a,seatFloor:s}=e,c=[];{let u=n.map(()=>({minX:1/0,minY:1/0,minZ:1/0,maxX:-1/0,maxY:-1/0,maxZ:-1/0}));for(let m=0;m<i.floor.length;m+=1){let l=Math.max(0,Math.min(n.length-1,Math.round(i.floor[m]))),p=m*3,h=u[l];h.minX=Math.min(h.minX,i.position[p]),h.minY=Math.min(h.minY,i.position[p+1]),h.minZ=Math.min(h.minZ,i.position[p+2]),h.maxX=Math.max(h.maxX,i.position[p]),h.maxY=Math.max(h.maxY,i.position[p+1]),h.maxZ=Math.max(h.maxZ,i.position[p+2])}let d=new Map;for(let m=0;m<n.length;m++)for(let l of n[m].objects)l.type==="section"&&d.set(l.id,m);let f=n.map(()=>({n:0,minX:1/0,minY:1/0,minDeck:1/0,maxX:-1/0,maxY:-1/0,maxDeck:-1/0,sumX:0,sumDeck:0,sumZ:0}));for(let m=0;m<r.length;m++){let l=o.seatOwner[m],p=(l!==null?d.get(l):void 0)??a[m];if(p===void 0)continue;let h=f[p],b=r[m];h.n++,b.x<h.minX&&(h.minX=b.x),b.y<h.minY&&(h.minY=b.y),b.x>h.maxX&&(h.maxX=b.x),b.y>h.maxY&&(h.maxY=b.y);let y=o.seatDeckY(m);h.sumX+=b.x*z,h.sumDeck+=y,h.sumZ+=b.y*z,h.minDeck=Math.min(h.minDeck,y),h.maxDeck=Math.max(h.maxDeck,y+1.6),s[m]=p}for(let m=0;m<n.length;m++){let l=f[m],p=t.floors?.[m],h=u[m],b=Math.min(l.n?l.minX*z:n[m].focal.x*z-1,Number.isFinite(h.minX)?h.minX:1/0),y=Math.max(l.n?l.maxX*z:n[m].focal.x*z+1,Number.isFinite(h.maxX)?h.maxX:-1/0),v=Math.min(l.n?l.minY*z:n[m].focal.y*z-1,Number.isFinite(h.minZ)?h.minZ:1/0),S=Math.max(l.n?l.maxY*z:n[m].focal.y*z+1,Number.isFinite(h.maxZ)?h.maxZ:-1/0),M=Math.min(l.n?Math.min(n[m].baseHeightM,l.minDeck):n[m].baseHeightM,Number.isFinite(h.minY)?h.minY:1/0),R=Math.max(l.n?Math.max(l.maxDeck,M+.5):M+.5,Number.isFinite(h.maxY)?h.maxY:-1/0),x=[l.n?l.sumX/l.n:(b+y)/2,l.n?l.sumDeck/l.n:(M+R)/2,l.n?l.sumZ/l.n:(v+S)/2],g=Math.max(1,.5*Math.hypot(y-b,R-M,S-v));c.push({index:m,id:p?.id??`floor-${m}`,label:p?.name??(n.length>1?`Floor ${m+1}`:"Venue"),seatCount:l.n,center:x,radius:g,box:{min:[b,M,v],max:[y,R,S]},focalWorld:[n[m].focal.x*z,n[m].baseHeightM+1.5,n[m].focal.y*z]})}}return c}function wo(e,t){let n=1/0,r=1/0,o=-1/0,i=-1/0,a=(s,c)=>{s<n&&(n=s),c<r&&(r=c),s>o&&(o=s),c>i&&(i=c)};for(let s of t)a(s.x,s.y);for(let s of e)for(let c of s.objects)if(c.type==="section")for(let u of c.outline)a(u.x,u.y);else if(c.type==="shape"&&c.points)for(let u of c.points)a(u.x,u.y);else if(c.type==="gaArea")for(let u of c.points)a(u.x,u.y);else if(c.type==="booth"){let u=zt(c);if(u)for(let d of u)a(d.x,d.y)}else if(c.type==="table"){let u=go(c);if(u)for(let d of u)a(d.x,d.y)}else if(c.type==="decorImage"){let u=xo(c);if(u)for(let d of u)a(d.x,d.y)}return Number.isFinite(n)||(n=-100,r=-100,o=100,i=100),{minX:n,minY:r,maxX:o,maxY:i}}function Ki(e,t,n,r,o,i){if(t.length===1){let a=Math.max(60,(o.maxX-o.minX+o.maxY-o.minY)*.06),s=Ot(o.minX-a,o.minY-a,o.maxX-o.minX+a*2,o.maxY-o.minY+a*2);ue(e,s,void 0,()=>0,-.4,i.ground,i.ground,le)}else{let a=t.reduce((l,p)=>p.baseHeightM<l.baseHeightM?p:l);e.setFloor(a.index);let s=n.filter((l,p)=>r[p]===a.index),c=wo([a],s),u=Math.hypot(c.maxX-c.minX,c.maxY-c.minY),d=Math.max(28,Math.min(80,u*.04)),f=Ot(c.minX-d,c.minY-d,c.maxX-c.minX+d*2,c.maxY-c.minY+d*2),m=a.baseHeightM-.03;ue(e,f,void 0,()=>m,m-.22,i.ground,i.ground,le)}}function qi(e,t,n){let{cx:r,cz:o,radius:i}=n,a=1/0,s=1/0,c=1/0,u=-1/0,d=-1/0,f=-1/0,m=(h,b,y)=>{a=Math.min(a,h),u=Math.max(u,h),s=Math.min(s,b),d=Math.max(d,b),c=Math.min(c,y),f=Math.max(f,y)};for(let h=0;h<e.position.length;h+=3)m(e.position[h],e.position[h+1],e.position[h+2]);for(let h=0;h<t.count;h++){let b=h*3,y=t.iPosition[b],v=t.iPosition[b+1],S=t.iPosition[b+2],M=Math.max(.35,t.iMaxRadius[h]??.35);m(y-M,v,S-M),m(y+M,v+1.6,S+M)}Number.isFinite(a)||(a=r-i,u=r+i,s=0,d=i*.16,c=o-i,f=o+i);let l=[(a+u)/2,(s+d)/2,(c+f)/2],p=Math.max(1,.5*Math.hypot(u-a,d-s,f-c));return{center:l,radius:p,minY:s,maxY:d}}function $i(e,t,n,r,o,i){let a=1/0,s=1/0,c=-1/0,u=-1/0;for(let M=0;M<e.count;M++){let R=M*3,x=e.iPosition[R],g=e.iPosition[R+2];x<a&&(a=x),x>c&&(c=x),g<s&&(s=g),g>u&&(u=g)}for(let M of t)a=Math.min(a,M.cx-M.halfX),c=Math.max(c,M.cx+M.halfX),s=Math.min(s,M.cz-M.halfZ),u=Math.max(u,M.cz+M.halfZ);let d=n.minX*z,f=n.maxX*z,m=n.minY*z,l=n.maxY*z,p=d,h=f,b=m,y=l;if(Number.isFinite(a)){let M=Math.max(2,.06*Math.hypot(c-a,u-s));p=Math.max(d,a-M),h=Math.min(f,c+M),b=Math.max(m,s-M),y=Math.min(l,u+M)}let v=Math.min(0,r),S=Math.max(o,i*.05);return{min:[p,v,b],max:[h,S,y]}}function Qi(e,t,n){let r=()=>({byObjectId:new Map,elements:[]});if(!t||!e)return r();let o=Or(t);if(!o.ok||o.value.id!==e)return r();let i=new Map;for(let f of n)for(let m of f.objects)m.type==="shape"&&i.set(m.id,{shape:m,unit:f});let a=new Set,s=new Set,c=new Map((t.overlay.productionElements??[]).map(f=>{let m=f.runtimeContentImageUrl;return[f.id,typeof m=="string"&&/^(?:blob:|data:image\/|https:\/\/)/.test(m)?m:void 0]})),u=[];for(let f of o.value.overlay.productionElements??[]){let m=i.get(f.objectId),l=m?rt(m.shape):null,p=f.baseElevationM??0;if(!m||!l||l.length<3||!f.id||a.has(f.id)||s.has(f.objectId)||!Number.isFinite(f.heightM)||f.heightM<.05||f.heightM>50||!Number.isFinite(p)||p<-10||p>100)return r();a.add(f.id),s.add(f.objectId);let h=l.map(C=>C.x*z),b=l.map(C=>C.y*z),y=m.unit.baseHeightM+p,v=Math.min(...h),S=Math.max(...h),M=Math.min(...b),R=Math.max(...b),x,g=c.get(f.id)??f.contentImageUrl;if(f.kind==="screen"&&g)if(S-v>=R-M){let C=Math.abs(M-m.unit.focal.y*z)<=Math.abs(R-m.unit.focal.y*z)?M-.006:R+.006;x=[[v,y,C],[S,y,C],[v,y+f.heightM,C],[S,y+f.heightM,C]]}else{let C=Math.abs(v-m.unit.focal.x*z)<=Math.abs(S-m.unit.focal.x*z)?v-.006:S+.006;x=[[C,y,M],[C,y,R],[C,y+f.heightM,M],[C,y+f.heightM,R]]}u.push({id:f.id,objectId:f.objectId,kind:f.kind,floorIndex:m.unit.index,baseY:y,topY:y+f.heightM,bounds:{min:[v,y,M],max:[S,y+f.heightM,R]},occlusion:f.occlusion,...g?{contentImageUrl:g}:{},...x?{contentPlane:x}:{}})}let d=u.sort((f,m)=>f.id.localeCompare(m.id));return{byObjectId:new Map(d.map(f=>[f.objectId,f])),elements:d}}function ve(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function xe(e){return Array.isArray(e)?e:[]}function _u(e){let t=[e];for(;t.length;){let n=t.pop();if(Array.isArray(n)){t.push(...n);continue}if(!ve(n))continue;let r=ve(n.extensions)?n.extensions:null;if(r&&Object.prototype.hasOwnProperty.call(r,"KHR_draco_mesh_compression"))return!0;t.push(...Object.values(n))}return!1}function vn(e,t){return!Array.isArray(e)||e.length!==t||!e.every(n=>typeof n=="number"&&Number.isFinite(n))?null:e}function Lu(){return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}function ku(e,t){let n=new Array(16).fill(0);for(let r=0;r<4;r++)for(let o=0;o<4;o++)for(let i=0;i<4;i++)n[r*4+o]+=e[i*4+o]*t[r*4+i];return n}function Fu(e){let t=vn(e.matrix,16);if(t)return t;if(e.matrix!==void 0)return null;let n=e.translation===void 0?[0,0,0]:vn(e.translation,3),r=e.rotation===void 0?[0,0,0,1]:vn(e.rotation,4),o=e.scale===void 0?[1,1,1]:vn(e.scale,3);if(!n||!r||!o)return null;let[i,a,s,c]=r,u=Math.hypot(i,a,s,c);if(!(u>1e-8))return null;let d=i/u,f=a/u,m=s/u,l=c/u,p=d+d,h=f+f,b=m+m,y=d*p,v=d*h,S=d*b,M=f*h,R=f*b,x=m*b,g=l*p,C=l*h,E=l*b;return[(1-(M+x))*o[0],(v+E)*o[0],(S-C)*o[0],0,(v-E)*o[1],(1-(y+x))*o[1],(R+g)*o[1],0,(S+C)*o[2],(R-g)*o[2],(1-(y+M))*o[2],0,n[0],n[1],n[2],1]}function Du(e,t,n,r){return[e[0]*t+e[4]*n+e[8]*r+e[12],e[1]*t+e[5]*n+e[9]*r+e[13],e[2]*t+e[6]*n+e[10]*r+e[14]]}function Ou(e){let t=e[0],n=e[4],r=e[8],o=e[1],i=e[5],a=e[9],s=e[2],c=e[6],u=e[10],d=i*u-a*c,f=a*s-o*u,m=o*c-i*s,l=t*d+n*f+r*m;if(Math.abs(l)<1e-12)return null;let p=1/l;return[d*p,f*p,m*p,(r*c-n*u)*p,(t*u-r*s)*p,(n*s-t*c)*p,(n*a-r*i)*p,(r*o-t*a)*p,(t*i-n*o)*p]}function Zi(e,t,n,r){let o=e[0]*t+e[1]*n+e[2]*r,i=e[3]*t+e[4]*n+e[5]*r,a=e[6]*t+e[7]*n+e[8]*r,s=Math.hypot(o,i,a)||1;return o/=s,i/=s,a/=s,[o,i,a]}function Vu(e){if(e.byteLength<20||e.byteLength>8388608)return null;let t=new DataView(e.buffer,e.byteOffset,e.byteLength);if(t.getUint32(0,!0)!==1179937895||t.getUint32(4,!0)!==2||t.getUint32(8,!0)!==e.byteLength)return null;let n=12,r=null,o=null;for(;n+8<=e.byteLength;){let i=t.getUint32(n,!0),a=t.getUint32(n+4,!0);if(n+=8,i%4!==0||n+i>e.byteLength)return null;let s=e.subarray(n,n+i);if(a===1313821514&&!r)try{let c=JSON.parse(new TextDecoder().decode(s).replace(/[\u0000 ]+$/g,""));if(!ve(c))return null;r=c}catch{return null}else if(a===5130562&&!o)o=s;else return null;n+=i}return n===e.byteLength&&r&&o?{json:r,bin:o}:null}function Bu(e){return e===5120||e===5121?1:e===5122||e===5123?2:e===5125||e===5126?4:0}function Nu(e){return e==="SCALAR"?1:e==="VEC2"?2:e==="VEC3"?3:e==="VEC4"?4:0}function Gu(e,t,n){return n===5120?e.getInt8(t):n===5121?e.getUint8(t):n===5122?e.getInt16(t,!0):n===5123?e.getUint16(t,!0):n===5125?e.getUint32(t,!0):e.getFloat32(t,!0)}function zu(e){let t=e instanceof Uint8Array?e:new Uint8Array(e),n=Vu(t);if(!n)return{ok:!1,issue:"invalid_glb"};let{json:r,bin:o}=n;if(!ve(r.asset)||r.asset.version!=="2.0")return{ok:!1,issue:"unsupported_glb"};let i=xe(r.extensionsUsed).filter(M=>typeof M=="string");if(i.includes("KHR_draco_mesh_compression")||_u(r))return{ok:!1,issue:"draco_not_allowed"};if(i.length||xe(r.extensionsRequired).length)return{ok:!1,issue:"unsupported_glb"};if(xe(r.images).length||xe(r.textures).length)return{ok:!1,issue:"external_resource"};let a=xe(r.buffers);if(a.length!==1||!ve(a[0])||a[0].uri!==void 0||typeof a[0].byteLength!="number"||!Number.isInteger(a[0].byteLength)||a[0].byteLength<0||a[0].byteLength>o.byteLength)return{ok:!1,issue:"external_resource"};let s=xe(r.accessors),c=xe(r.bufferViews),u=xe(r.meshes),d=xe(r.nodes),f=xe(r.scenes),m=typeof r.scene=="number"?r.scene:0;if(!ve(f[m]))return{ok:!1,issue:"unsupported_glb"};let l=new DataView(o.buffer,o.byteOffset,o.byteLength),p=(M,R,x)=>{if(typeof M!="number"||!Number.isInteger(M)||!ve(s[M]))return null;let g=s[M];if(g.type!==R||g.sparse!==void 0||g.normalized===!0||typeof g.count!="number"||!Number.isInteger(g.count)||g.count<1||typeof g.componentType!="number"||!x.includes(g.componentType)||typeof g.bufferView!="number")return null;let C=c[g.bufferView];if(!ve(C)||C.buffer!==0||typeof C.byteLength!="number"||!Number.isInteger(C.byteLength)||C.byteLength<0)return null;let E=Nu(g.type),D=Bu(g.componentType),B=typeof C.byteStride=="number"?C.byteStride:E*D,L=typeof C.byteOffset=="number"?C.byteOffset:0,A=typeof g.byteOffset=="number"?g.byteOffset:0,k=L+A,N=A+(g.count-1)*B+E*D;if(!Number.isInteger(B)||!Number.isInteger(L)||!Number.isInteger(A)||B<E*D||L<0||A<0||L+C.byteLength>o.byteLength||N>C.byteLength)return null;let w=[];for(let T=0;T<g.count;T++){let _=[];for(let P=0;P<E;P++){let O=Gu(l,k+T*B+P*D,g.componentType);if(!Number.isFinite(O))return null;_.push(O)}w.push(_)}return w},h=[],b=[],y=0,v=new Set,S=(M,R)=>{if(typeof M!="number"||!Number.isInteger(M)||!ve(d[M])||v.has(M))return!1;v.add(M);let x=d[M],g=Fu(x);if(!g)return!1;let C=ku(R,g),E=Ou(C);if(!E)return!1;if(x.mesh!==void 0){if(typeof x.mesh!="number")return!1;let D=u[x.mesh];if(!ve(D))return!1;for(let B of xe(D.primitives)){if(!ve(B)||B.mode!==void 0&&B.mode!==4||!ve(B.attributes))return!1;let L=p(B.attributes.POSITION,"VEC3",[5126]),A=B.attributes.NORMAL===void 0?null:p(B.attributes.NORMAL,"VEC3",[5126]);if(!L||B.attributes.NORMAL!==void 0&&!A)return!1;let k=L.length;if(B.indices!==void 0){let w=typeof B.indices=="number"?s[B.indices]:null;k=ve(w)?w.count:void 0}if(typeof k!="number"||!Number.isInteger(k)||k%3!==0||(y+=k/3,y>1e5))return!1;let N=B.indices===void 0?L.map((w,T)=>[T]):p(B.indices,"SCALAR",[5121,5123,5125]);if(!N||N.length%3!==0||N.length!==k)return!1;for(let w=0;w<N.length;w+=3){let T=[N[w][0],N[w+1][0],N[w+2][0]];if(T.some(O=>!Number.isInteger(O)||O<0||O>=L.length))return!1;let _=T.map(O=>Du(C,...L[O])),P=null;if(!A){let O=_[1][0]-_[0][0],I=_[1][1]-_[0][1],F=_[1][2]-_[0][2],H=_[2][0]-_[0][0],j=_[2][1]-_[0][1],G=_[2][2]-_[0][2];P=Zi([1,0,0,0,1,0,0,0,1],I*G-F*j,F*H-O*G,O*j-I*H)}for(let O=0;O<3;O++)h.push(..._[O]),b.push(...A?Zi(E,...A[T[O]]):P)}}}for(let D of xe(x.children))if(!S(D,C))return!1;return v.delete(M),!0};for(let M of xe(f[m].nodes))if(!S(M,Lu()))return{ok:!1,issue:y>1e5?"triangle_limit":"unsupported_glb"};return!y||h.length!==y*9||b.length!==h.length?{ok:!1,issue:"unsupported_glb"}:{ok:!0,triangleCount:y,position:new Float32Array(h),normal:new Float32Array(b)}}function Ji(e){try{return zu(e)}catch{return{ok:!1,issue:"invalid_glb"}}}function St(e){let{doc:t}=e,n=Pr(t.theme),r=n.structure,o=mi(t,e.eventConfigurationId??t.eventConfigurationId),i=Qi(e.eventConfigurationId,e.eventConfiguration,o),a=e.seats,s=new rn,c=null;if(e.registeredShellGlb){let w=Ji(e.registeredShellGlb);if(w.ok){let T=w.position.length/3,_=new Float32Array(w.position.length),P=n.materials.shell??r.tierWall;for(let O=0;O<T;O++){let I=w.normal[O*3+1],F=I<-.25?.4:.62+.38*Math.max(0,I);_[O*3]=P[0]*F,_[O*3+1]=P[1]*F,_[O*3+2]=P[2]*F}c={position:w.position,normal:w.normal,color:_,floor:new Float32Array(T).fill(-2),material:new Float32Array(T),count:T}}}let u=new Map;for(let w of o)for(let T of w.objects)u.set(T.id,w.index),T.type==="section"&&u.set(T.logicalSectionId??T.id,w.index);let d=a.map(w=>u.get(w.sectionId??"")??u.get(w.rowId??"")??0),f=wo(o,a);Ki(s,o,a,d,f,r);let m=bi(t,a),l=new Map,p=new Map;for(let w of t.categories??[])l.set(w.key,w.color),w.seatGlyph&&p.set(w.key,w.seatGlyph);let h=[],b=hi(o,a,d),y=new Float32Array(a.length),v=[];for(let w=0;w<o.length;w++){let T=o[w];s.setFloor(w);let _=new yn,P=[],O=T.objects.filter(I=>I.type==="section"&&!!I.outline&&I.outline.length>=3);for(let I of T.objects)if(I.type==="section"){let F=s.vertexCount;_i(s,I,T,yi(I,m),b.bySection.get(I.id),_,O,r);let H=s.vertexCount-F;H>0&&v.push({sectionId:I.id,start:F,count:H})}else if(I.type==="shape"){let F=i.byObjectId.get(I.id);s.setMaterial((F?.kind??I.role)==="screen"?1:0),Pi(s,I,T.baseHeightM,xi(I,P),r,T.focal,h,F),s.setMaterial(0)}else I.type==="gaArea"?Ai(s,I,T.baseHeightM,ne(l.get(I.categoryKey)),r):I.type==="booth"?Mi(s,I,T.baseHeightM,ne(l.get(I.categoryKey)),r):I.type==="table"?wi(s,I,T.baseHeightM,ne(I.fill??t.theme?.decorFill??"#232c40"),r):I.type==="decorImage"&&Ci(s,I,T.baseHeightM,r);Li(s,T,a,b,r,n.materials.shell,!c)}let S=o.length>1?{x:o.reduce((w,T)=>w+T.focal.x,0)/o.length,y:o.reduce((w,T)=>w+T.focal.y,0)/o.length}:t.focalPoint??{x:(f.minX+f.maxX)/2,y:(f.minY+f.maxY)/2},M=fr(c?[s.build(),c]:[s.build()]),R=Mr(a,e.initialState,b,y,l,p),x=ji({doc:t,units:o,seats:a,surfaces:b,focal:S}),{labels:g,sections:C,rows:E}=Yi({doc:t,units:o,seats:a,surfaces:b,seatData:R,hintedSeatFloor:d,zones:x,focal:S}),D=Wi({doc:t,units:o,seats:a,surfaces:b,solids:M,hintedSeatFloor:d,seatFloor:y});Xi(g,D),R.iYaw=vr(R.iPosition,a.length,w=>a[w].rowId,w=>{let T=o[y[w]]?.focal??S;return[T.x*z,T.y*z]});let B=(f.minX+f.maxX)/2*z,L=(f.minY+f.maxY)/2*z,A=.5*Math.hypot((f.maxX-f.minX)*z,(f.maxY-f.minY)*z)||10,k=qi(M,R,{cx:B,cz:L,radius:A}),N=$i(R,h,f,k.minY,k.maxY,A);return{solids:M,sectionSolidRanges:v,seats:R,bounds:{center:[(N.min[0]+N.max[0])/2,(N.min[1]+N.max[1])/2,(N.min[2]+N.max[2])/2],radius:A,groundY:0,box:N},renderBounds:{center:k.center,radius:k.radius},stateColorLUT:Cr(n,pe),theme:n,seatCount:a.length,focalWorld:[S.x*z,1.5,S.y*z],zones:x,stages:h,productionElements:i.elements,sections:C,rows:E,labels:g,floors:D}}var Uu=88,Hu=20,ea={floor:{size:14,weight:"700",opacity:.98},zone:{size:15,weight:"600",opacity:.95},section:{size:12,weight:"500",opacity:.88},ga:{size:12,weight:"500",opacity:.88},booth:{size:11,weight:"500",opacity:.85},annotation:{size:11,weight:"400",opacity:.75},row:{size:11.5,weight:"700",opacity:.94},seat:{size:12.5,weight:"800",opacity:1}},ju=640,Yu=.8,Xu=11,Wu="3px 7px",Ku="2px 5px",ta="rgba(10,14,22,.62)",qu="#f4f7fb",na=5,oa=2,$u=6,Ut=new Set(["row","seat"]),ra={floor:5,zone:4,section:3,ga:3,booth:2,annotation:1},Sn={row:{x:66,y:20},seat:{x:52,y:22}},Co=ne,Po=e=>Ho(e);function Ao(e,t){let n=Po(e),r=Po(t);return(Math.max(n,r)+.05)/(Math.min(n,r)+.05)}function Ro(e,t){let n=/rgba\((\d+),(\d+),(\d+),([\d.]+)\)/.exec(e.replace(/\s/g,""));if(!n)return t;let r=Math.max(0,Math.min(1,Number(n[4])));return[1,2,3].map(o=>Number(n[o])/255*r+t[o-1]*(1-r))}function Qu(e,t=[.04,.06,.1],n=!0){let r=Po(t)<.42,o=r?"#f4f7fb":"#0b1220",i=r?"rgba(8,12,22,.78)":"rgba(255,255,255,.84)",a=n?Ro(i,t):t,s=Co(e),c=n?7:4.5,u=s&&Ao(s,a)>=c?e:o;return r?{ink:u,backing:i,border:"rgba(210,222,245,.24)"}:{ink:u,backing:i,border:"rgba(11,18,32,.22)"}}function Zu(e,t=[.04,.06,.1]){let n=Ro(ta,t),r=Co(e);return{ink:r&&Ao(r,n)>=4.5?e:qu,backing:ta}}var Ju='ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif',Mn=class{constructor(t,n={}){this.nodes=new Map;this.labels=[];this.forcedDense=!1;this.selectedSeatLabelIds=new Set;this.narrowStage=!1;this.opts=n,this.root=document.createElement("div"),this.root.setAttribute("data-view3d-labels","");let r=this.root.style;r.position="absolute",r.inset="0",r.pointerEvents="none",r.overflow="hidden",r.fontFamily=n.fontFamily||Ju,t.appendChild(this.root)}setVisible(t){this.root.style.visibility=t?"":"hidden"}setLabels(t){this.labels=t;for(let[n,r]of this.nodes)t.some(o=>o.id===n)||(r.remove(),this.nodes.delete(n))}setForcedDense(t){this.forcedDense=t}setSelectedSeatIds(t){this.selectedSeatLabelIds=new Set(Array.from(t,n=>`seat:${n}`))}sizeFor(t){let n=ea[t].size;return!this.narrowStage||Ut.has(t)?n:Math.max(Xu,n*Yu)}qualityEvidence(){let t=this.root.getBoundingClientRect(),n=this.root.style.visibility!=="hidden";return this.labels.map(r=>{let o=this.nodes.get(r.id),i=o?.getBoundingClientRect(),a=!!(n&&o&&o.style.display!=="none"&&i&&i.width>0&&i.height>0);return{id:r.id,kind:r.kind,text:r.text,visible:a,renderedFontPx:o&&Number.parseFloat(o.style.fontSize)||0,contrast:o?Number(o.dataset.qualityContrast??0):0,...a&&i?{screenBox:{x:i.x-t.x,y:i.y-t.y,width:i.width,height:i.height}}:{}}})}update(t,n,r,o,i,a){if(!this.labels.length)return;this.narrowStage=n>0&&n<ju;let s=Vi(o,i,{hasZoneLabels:this.labels.some(S=>S.kind==="zone")});this.forcedDense&&(s.add("row"),s.add("seat"));let c=[];for(let S of this.labels){if(!s.has(S.kind))continue;let M=Ye(t,S.anchor,n,r);if(!M.visible)continue;let R=Ut.has(S.kind),x=this.sizeFor(S.kind),g=Gi(S.text,x,!R)+(R?na*2:0),C=Bi(M,g/2,x/2+(R?oa:4),n,r),E=a?Math.hypot(S.anchor[0]-a[0],S.anchor[1]-a[1],S.anchor[2]-a[2]):1;c.push({label:S,screen:C,focus:Ui(C,E,n,r),halfWidth:g/2,...this.selectedSeatLabelIds.has(S.id)?{priority:1}:{}})}let u=Oi(c.filter(S=>S.label.kind==="floor"),n),d=[...c.filter(S=>!Ut.has(S.label.kind)&&S.label.kind!=="floor"),...u],f=Ni(d,Uu,Hu),m=zi(n),l=So(c.filter(S=>S.label.kind==="row"),Sn.row.x,Sn.row.y,m.row,f),p=So(c.filter(S=>S.label.kind==="seat"),Sn.seat.x,Sn.seat.y,m.seat,[...f,...l]),h=[...f,...l,...p],b=new Set(h.map(S=>S.label.id));for(let{label:S,screen:M}of h){let x=this.nodeFor(S).style;x.display="",x.transform=`translate(-50%, -50%) translate(${M.x.toFixed(1)}px, ${M.y.toFixed(1)}px)`}let y=h.filter(({label:S})=>!Ut.has(S.kind)).sort((S,M)=>ra[M.label.kind]-ra[S.label.kind]||S.screen.depth-M.screen.depth||S.focus-M.focus),v=[];for(let{label:S}of y){let M=this.nodes.get(S.id);if(!M||M.style.display==="none")continue;let R=M.getBoundingClientRect();v.some(g=>R.left<g.right+3&&R.right+3>g.left&&R.top<g.bottom+3&&R.bottom+3>g.top)?M.style.display="none":v.push(R)}for(let[S,M]of this.nodes)b.has(S)||(M.style.display="none")}nodeFor(t){let n=this.nodes.get(t.id);if(!n){n=document.createElement("div");let p=n.style;p.position="absolute",p.left="0",p.top="0",p.whiteSpace="nowrap",p.textShadow="0 1px 3px rgba(0,0,0,0.85), 0 0 8px rgba(0,0,0,0.55)",p.display="none",this.root.appendChild(n),this.nodes.set(t.id,n)}n.textContent=t.text,n.setAttribute("data-label-kind",t.kind);let r=this.selectedSeatLabelIds.has(t.id);n.toggleAttribute("data-selected-seat",r);let o=ea[t.kind],i=n.style;i.fontSize=`${this.sizeFor(t.kind)}px`,i.fontWeight=r?"800":o.weight,i.opacity=r?"1":String(o.opacity);let a=Ut.has(t.kind),s=!a,c=Qu(t.color??this.opts.ink,this.opts.backgroundRgb,!0),u=a?Zu(t.color??this.opts.ink,this.opts.backgroundRgb):c;i.color=r?"#ecf8ff":u.ink,i.background=r?"rgba(10,28,45,.9)":u.backing,i.border=r?"1px solid rgba(89,199,255,.92)":s?`1px solid ${c.border}`:"",i.borderRadius=r||s?"999px":`${$u}px`;let d=this.narrowStage?Ku:Wu;i.padding=r||s?d:`${oa}px ${na}px`,i.lineHeight=a?"1.1":"",i.boxShadow=r?"0 0 0 2px rgba(41,176,255,.18), 0 5px 14px rgba(0,0,0,.35)":s?"0 3px 10px rgba(0,0,0,.24)":"0 1px 4px rgba(0,0,0,.28)",i.letterSpacing=t.kind==="zone"||t.kind==="floor"?"0.08em":"0.02em";let f=this.opts.backgroundRgb??[.04,.06,.1],m=Co(r?"#ecf8ff":u.ink)??[1,1,1],l=Ro(r?"rgba(10,28,45,.9)":u.backing,f);return n.dataset.qualityContrast=Ao(m,l).toFixed(3),(t.kind==="zone"||t.kind==="floor")&&(i.textTransform="uppercase"),n}dispose(){this.root.remove(),this.nodes.clear()}};var aa=1;var em=new Set(["floor","zone","section","ga","booth","annotation"]);function tm(e){return e.every(t=>Number.isFinite(t))}function nm(e,t){return e.x<t.x+t.width&&e.x+e.width>t.x&&e.y<t.y+t.height&&e.y+e.height>t.y}function ia(e){return e.length?Math.round(Math.min(...e)*100)/100:null}function at(e){return Math.round(e*1e4)/1e4}function om(e){if(e)return{box:{x:at(e.box.x),y:at(e.box.y),width:at(e.box.width),height:at(e.box.height)},horizontalFillRatio:at(e.horizontalFillRatio),verticalFillRatio:at(e.verticalFillRatio),visibleAreaRatio:at(e.visibleAreaRatio),clippedEdges:[...e.clippedEdges]}}function Te(e,t,n){return n.length?{code:e,message:t,count:n.length,samples:n.slice(0,20)}:null}function wn(e){let t=e.labels.filter(s=>s.visible&&s.screenBox),n=t.filter(s=>em.has(s.kind)),r=e.scene.floorCount>1?e.scene.floorCount:e.scene.zoneCount||e.scene.sectionCount,o=[];for(let s=0;s<n.length;s+=1)for(let c=0;c<s;c+=1)nm(n[s].screenBox,n[c].screenBox)&&o.push({primaryId:n[s].id,primaryLabel:n[s].text,secondaryId:n[c].id});let i=[...e.camera.position,e.camera.distance,e.camera.verticalFovDeg],a=[Te("webgl2-unavailable","The venue scene must render through WebGL2",e.context.webgl2?[]:[{primaryId:"renderer",primaryLabel:"WebGL2"}]),Te("context-lost","The WebGL context must be live at capture",e.context.lost?[{primaryId:"renderer",primaryLabel:"context lost"}]:[]),Te("frame-not-stable","The captured 3D frame must be rendered and parked",e.frame.rendered>0&&e.frame.idle?[]:[{primaryId:"renderer",primaryLabel:"unstable frame"}]),Te("viewport-empty","The 3D viewport must have visible dimensions",e.viewport.width>1&&e.viewport.height>1?[]:[{primaryId:"viewport",primaryLabel:`${e.viewport.width}\xD7${e.viewport.height}`}]),Te("camera-invalid","The capture camera must have a finite physical pose",tm(i)&&e.camera.distance>0&&e.camera.verticalFovDeg>0&&e.camera.verticalFovDeg<180?[]:[{primaryId:"camera",primaryLabel:"invalid pose"}]),Te("authored-relief-not-visible","Authored 3D height or rake must produce visible screen-space relief",!e.scene.authoredRelief||e.scene.renderedVerticalSpanM>.05&&e.scene.projectedReliefPx>=2?[]:[{primaryId:"scene",primaryLabel:"authored relief",measured:e.scene.projectedReliefPx,minimum:2}]),Te("hierarchy-label-missing","A venue with authored hierarchy must show at least one structural label",r===0||n.length>0?[]:[{primaryId:"labels",primaryLabel:`${r} expected hierarchy labels`}]),Te("hierarchy-label-undersized","Visible 3D hierarchy labels must remain readable",n.filter(s=>s.renderedFontPx<11).map(s=>({primaryId:s.id,primaryLabel:s.text,measured:s.renderedFontPx,minimum:11}))),Te("hierarchy-label-contrast-low","Visible 3D hierarchy labels must meet text contrast",n.filter(s=>s.contrast<4.5).map(s=>({primaryId:s.id,primaryLabel:s.text,measured:s.contrast,minimum:4.5}))),Te("hierarchy-label-collision","Visible 3D hierarchy labels must not overlap",o)].filter(s=>!!s);return{version:1,state:"venue3d",passed:a.length===0,resolvedRules:["rendered-3d-webgl-context","rendered-3d-stable-frame","rendered-3d-camera-pose","rendered-3d-relief-projection","rendered-3d-label-size","rendered-3d-label-contrast","rendered-3d-label-collision"],viewport:e.viewport,context:e.context,frame:e.frame,camera:e.camera,scene:e.scene,composition:{visibleLabels:t.map(({id:s,kind:c,text:u})=>({id:s,kind:c,text:u})).sort((s,c)=>s.kind.localeCompare(c.kind)||s.id.localeCompare(c.id)),framing:om(e.framing)},metrics:{minimumHierarchyFontPx:ia(n.map(s=>s.renderedFontPx)),minimumHierarchyContrast:ia(n.map(s=>s.contrast)),projectedReliefPx:Math.round(e.scene.projectedReliefPx*100)/100},findings:a}}var ce=require("ogl");var Xe=require("ogl");var Pn=`
20
+ }`});async function ss(e,t,n,r={}){let o=r.fadeMs??400,i=t?.initialBearingDeg??0,a=Math.max(-Le,Math.min(Le,t?.initialPitchDeg??0)),s=Fn,c=!1,u=new AbortController,d=()=>u.abort();r.signal?.addEventListener("abort",d,{once:!0});let f=()=>{},m=[n.camera.position.x,n.camera.position.y,n.camera.position.z];if(!t&&n.cameraOriginWorld&&n.camera.position.set(n.cameraOriginWorld[0],n.cameraOriginWorld[1],n.cameraOriginWorld[2]),!t&&n.focalWorld){let I=n.camera.position,F=n.focalWorld[0]-I.x,H=n.focalWorld[1]-I.y,j=n.focalWorld[2]-I.z,G=Math.hypot(F,j);G>.001&&(i=Math.atan2(F,-j)*180/Math.PI,a=Math.max(-Le,Math.min(Le,Math.atan2(H,G)*180/Math.PI)))}let l=null;if(t){let I=n.gl.getParameter(n.gl.MAX_TEXTURE_SIZE),F=_n(t,Tn(I)),H;try{let j=t.resolveUrl?await t.resolveUrl(F.initialUrl):F.initialUrl;if(!j)throw new Error("panorama_asset_unavailable");H=await Yt(j,u.signal)}catch{return r.signal?.removeEventListener("abort",d),null}try{l=rs(n.gl,H)}catch{return u.abort(),r.signal?.removeEventListener("abort",d),null}l.mesh.renderOrder=999,l.mesh.setParent(n.scene),F.upgradeUrl&&(f=Ln(()=>{(t.resolveUrl?t.resolveUrl(F.upgradeUrl):Promise.resolve(F.upgradeUrl)).then(G=>!G||u.signal.aborted?null:Yt(G,u.signal)).then(G=>{G&&(c||u.signal.aborted||(l?.setImage(G),n.requestRender()))}).catch(()=>{})}))}let p=n.camera.fov;n.camera.perspective({fov:s,aspect:n.camera.aspect});let h=n.camera.quaternion.slice(),b=()=>{let I=n.camera.position;l?.mesh.position.set(I.x,I.y,I.z);let[F,H,j]=os(i,a);n.camera.lookAt([I.x+F,I.y+H,I.z+j]),n.requestRender()};b();let y=document.createElement("div"),v=document.activeElement instanceof HTMLElement?document.activeElement:null;y.setAttribute("role","dialog"),y.setAttribute("aria-modal","true"),y.setAttribute("aria-label",r.seatLabel?`View from ${r.seatLabel}`:"View from seat"),y.tabIndex=-1,Object.assign(y.style,{position:"absolute",inset:"0",zIndex:"10",cursor:"grab",touchAction:"none"});let 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),r.disclosure){let I=document.createElement("div");I.textContent=`${r.disclosurePrefix??"360\xB0 panorama"} \xB7 ${r.disclosure}`,Object.assign(I.style,{position:"absolute",top:"calc(12px + var(--sl-3d-top-inset, 0px))",left:"12px",zIndex:"2",maxWidth:"calc(100% - 88px)",padding:"8px 11px",borderRadius:"999px",overflow:"hidden",color:"#dce6f8",background:"rgba(8,12,18,0.68)",font:"600 11px/1.2 ui-sans-serif, system-ui, sans-serif",textOverflow:"ellipsis",whiteSpace:"nowrap",pointerEvents:"none",backdropFilter:"blur(6px)"}),y.appendChild(I)}let M=document.createElement("div");M.textContent=Oo(r.lookAroundHint),Object.assign(M.style,{position:"absolute",bottom:"12px",left:"0",right:"0",textAlign:"center",color:"rgba(230,237,243,0.7)",font:"12px ui-sans-serif, system-ui, sans-serif",pointerEvents:"none"}),y.appendChild(M),e.appendChild(y),S.focus({preventScroll:!0});let R=!1,x=0,g=0,C=0,E=new Map,D=()=>{let[I,F]=[...E.values()];return I&&F?Math.hypot(I.x-F.x,I.y-F.y):0},B=I=>{let F=Do(I);F!==s&&(s=F,n.camera.perspective({fov:s,aspect:n.camera.aspect}),b())},L=I=>{I.target!==S&&(E.set(I.pointerId,{x:I.clientX,y:I.clientY}),R=E.size===1,x=I.clientX,g=I.clientY,E.size===2&&(C=D()),y.setPointerCapture?.(I.pointerId),y.style.cursor="grabbing")},A=I=>{if(E.has(I.pointerId)){if(E.set(I.pointerId,{x:I.clientX,y:I.clientY}),E.size>=2){let F=D();C>0&&F>0&&B(s*(C/F)),C=F,R=!1;return}R&&(i+=(I.clientX-x)*as,a=Math.max(-Le,Math.min(Le,a+(I.clientY-g)*as)),x=I.clientX,g=I.clientY,b())}},k=I=>{E.delete(I.pointerId),C=E.size===2?D():0;let F=E.values().next().value;R=E.size===1,F?(x=F.x,g=F.y):y.style.cursor="grab";try{y.releasePointerCapture?.(I.pointerId)}catch{}},N=I=>{I.preventDefault(),B(s+I.deltaY*.04)};y.addEventListener("pointerdown",L),y.addEventListener("pointermove",A),y.addEventListener("pointerup",k),y.addEventListener("pointercancel",k),y.addEventListener("wheel",N,{passive:!1});let w=I=>{if(!c){if(I.key==="Tab"){I.preventDefault(),S.focus({preventScroll:!0});return}if(I.key==="Escape"){I.stopPropagation(),O.close();return}if(I.key==="ArrowLeft"||I.key==="ArrowRight")i+=I.key==="ArrowLeft"?-4:4;else if(I.key==="ArrowUp"||I.key==="ArrowDown")a=Math.max(-Le,Math.min(Le,a+(I.key==="ArrowUp"?4:-4)));else if(I.key==="+"||I.key==="="){B(s-5),I.preventDefault();return}else if(I.key==="-"){B(s+5),I.preventDefault();return}else return;I.preventDefault(),b()}};window.addEventListener("keydown",w);let T=0,_=(I,F)=>{if(!l){F?.();return}let H=I===1?0:1,j=performance.now(),G=()=>{if(c)return;let V=o<=0?1:Math.min(1,(performance.now()-j)/o);l?.setOpacity(H+(I-H)*V),n.requestRender(),V<1?T=requestAnimationFrame(G):F?.()};T=requestAnimationFrame(G)};_(1);let P=()=>{c||(c=!0,f(),u.abort(),r.signal?.removeEventListener("abort",d),cancelAnimationFrame(T),y.removeEventListener("pointerdown",L),y.removeEventListener("pointermove",A),y.removeEventListener("pointerup",k),y.removeEventListener("pointercancel",k),y.removeEventListener("wheel",N),window.removeEventListener("keydown",w),y.remove(),v?.isConnected&&v.focus({preventScroll:!0}),l?.dispose(),n.camera.position.set(m[0],m[1],m[2]),n.camera.perspective({fov:p,aspect:n.camera.aspect}),n.camera.quaternion.set(h[0],h[1],h[2],h[3]),n.requestRender())},O={close(){if(c)return;let I=()=>{P(),r.onClose?.()};cancelAnimationFrame(T),_(0,I)},dispose:P};return S.addEventListener("click",()=>O.close()),O}var as,cs=Rt(()=>{"use strict";is();Dn();Dn();Fo();as=.15});var ls={};Uo(ls,{createOpenPanorama:()=>fd});function fd(e){let{container:t,model:n,opts:r,analytics:o,orbit:i,loop:a,seatsById:s,ensureSeatView:c,resolvedSeatViewPose:u,gpu:d,gl:f,isContextLost:m,isDisposed:l,flightGen:p,setPanorama:h,getLoadAbort:b,setLoadAbort:y,setPanoramaSphereVisible:v,setFrozen:S,raisePanoramaLayer:M,restorePanoramaLayer:R,getOverviewChip:x,labelOverlay:g,reducedMotion:C,removeArriveChip:E,showArriveChip:D}=e;return async(B,L,A)=>{b()?.abort();let k=new AbortController;y(k);let N=n.seats.idToIndex.get(B);if(N===void 0){i.syncFromCamera();return}let w=s.get(B)?.label??B,T=u(B,N),_=c(B);if(!_){k.abort(),b()===k&&y(null),i.syncFromCamera();return}S(!0),a.stop();let P;try{P=await _}catch{if(b()===k&&y(null),o.panoramaFailed(B,"source"),!l()&&A===p()){S(!1),i.resumeAfterFlight(T.focal),a.requestRender();let W=D(B,A,!0);requestAnimationFrame(()=>W?.querySelector("[data-panorama-trigger]")?.focus())}return}if(l()||A!==p()){k.abort(),b()===k&&y(null);return}E();let O=x(),I=()=>{k.abort(),b()===k&&y(null),h(null),v(!1),R(),O.style.display="",g.setVisible(!r.arriveAtSeatEye),S(!1),o.panoramaClosed(),i.resumeAfterFlight(T.focal),a.requestRender();let W=D(B,p());requestAnimationFrame(()=>W?.querySelector("[data-panorama-trigger]")?.focus())},F=P.generated===!0,H=ts(P);M(),v(!F),O.style.display="none";let j=C()?0:L,G=d(),V=G&&!m()?await ss(t,F?null:P,{gl:f,scene:G.main,camera:i.camera,requestRender:()=>a.requestRender(),cameraOriginWorld:F?T.eye:void 0,focalWorld:T.focal},{fadeMs:j,seatLabel:w,disclosure:H,disclosurePrefix:F?"Live seat-eye view":"360\xB0 panorama",lookAroundHint:r.lookAroundHint,onClose:I,signal:k.signal}):null;if(l()||A!==p()){k.abort(),v(!1),b()===k&&y(null),V?.dispose(),O.style.display="",R();return}if(V)i.syncFromCamera(),g.setVisible(!1),S(!1),a.requestRender(),h(V);else if(F){R(),O.style.display="",S(!1),i.resumeAfterFlight(T.focal),a.requestRender(),h(null),v(!1),o.panoramaFailed(B,"mount");let W=D(B,p(),!0);requestAnimationFrame(()=>W?.querySelector("[data-panorama-trigger]")?.focus()),b()===k&&y(null);return}else v(!1),o.panoramaFallback(B),h(ns(t,P,{fadeMs:j,seatLabel:w,disclosure:H,onClose:I,signal:k.signal,lookAroundHint:r.lookAroundHint}));o.panoramaOpened()}}var us=Rt(()=>{"use strict";Dn();cs()});var wd={};Uo(wd,{VENUE3D_QUALITY_REPORT_VERSION:()=>sa,buildSceneModel:()=>St,inspectVenue3DQualityEvidence:()=>wn,mountVenue3D:()=>Md,prepareVenue3D:()=>ws,prepareVenue3DFromChart:()=>Ps});module.exports=Bs(wd);var Wo=require("ogl");var Ns=/^#?([\da-f]{3}|[\da-f]{6})$/i;function Gs(e){let t=Ns.exec((e??"").trim());if(!t)return null;let n=t[1].length===3?t[1].split("").map(o=>o+o).join(""):t[1],r=parseInt(n,16);return[r>>16&255,r>>8&255,r&255]}function ne(e){let t=Gs(e);return t?[t[0]/255,t[1]/255,t[2]/255]:null}function Hn(e){let t=e/255;return t<=.04045?t/12.92:((t+.055)/1.055)**2.4}function zs(e){return .2126*Hn(e[0])+.7152*Hn(e[1])+.0722*Hn(e[2])}function jo(e){return zs([e[0]*255,e[1]*255,e[2]*255])}function Us(e){return .2126*e[0]+.7152*e[1]+.0722*e[2]}function ge(e,t,n){return[e[0]+(t[0]-e[0])*n,e[1]+(t[1]-e[1])*n,e[2]+(t[2]-e[2])*n]}function Et(e,t){let n=Us(e);return ge(e,[n,n,n],t)}var pe=["available","held","sold","selected","dimmed"];function It(e){let t=pe.indexOf(e);return t<0?0:t}var Yo={available:[.24,.82,.52],held:[.95,.66,.22],sold:[.34,.39,.45],selected:[.24,.74,1],dimmed:[.28,.32,.37]};function Xo(e){let t=.2126*e[0]+.7152*e[1]+.0722*e[2],n=.42,r=.62;return[(t+(e[0]-t)*n)*r,(t+(e[1]-t)*n)*r,(t+(e[2]-t)*n)*r]}var jn={ground:[.07,.085,.11],tierTop:[.24,.28,.34],tierWall:[.17,.2,.25],stageTop:[.94,.7,.38],stageWall:[.48,.33,.18],decorTop:[.22,.25,.29],decorWall:[.15,.17,.2],gaTop:[.24,.28,.33],gaWall:[.16,.19,.23],boothTop:[.3,.33,.38],boothWall:[.2,.23,.27],tableTop:[.38,.34,.29],tableWall:[.24,.21,.18]},Je={top:[.05,.06,.08],bottom:[.1,.12,.15]};function Pe(e,t){return[Math.min(1,e[0]*t),Math.min(1,e[1]*t),Math.min(1,e[2]*t)]}function Hs(){let e=typeof window<"u"&&window.devicePixelRatio||1,t=navigator.deviceMemory,n=typeof t=="number"&&t<=4?1.5:2;return Math.min(e,n)}var Qt=class{constructor(t,n){this.clearRgb=[0,0,0];this.container=t,this.canvas=document.createElement("canvas"),this.canvas.style.display="block",this.canvas.style.width="100%",this.canvas.style.height="100%",this.canvas.style.touchAction="none",this.canvas.tabIndex=0,this.canvas.setAttribute("role","application"),this.canvas.setAttribute("aria-label","Interactive 3D venue. Drag or use arrow keys to look around; pinch, scroll, plus or minus to zoom."),this.renderer=new Wo.Renderer({canvas:this.canvas,dpr:Hs(),alpha:!1,antialias:!1,depth:!0,stencil:!1,powerPreference:"high-performance",webgl:2}),this.gl=this.renderer.gl,this.clearRgb=[Je.top[0],Je.top[1],Je.top[2]],this.gl.clearColor(this.clearRgb[0],this.clearRgb[1],this.clearRgb[2],1),t.appendChild(this.canvas),this.lostHandler=r=>{r.preventDefault(),n.onContextLost()},this.restoredHandler=()=>n.onContextRestored(),this.canvas.addEventListener("webglcontextlost",this.lostHandler,!1),this.canvas.addEventListener("webglcontextrestored",this.restoredHandler,!1),this.resize()}setClearColor(t){this.clearRgb=[t[0],t[1],t[2]],this.gl.clearColor(t[0],t[1],t[2],1)}get clearColor(){return this.clearRgb}resize(){let t=Math.max(1,this.container.clientWidth||this.canvas.clientWidth||1),n=Math.max(1,this.container.clientHeight||this.canvas.clientHeight||1);return this.renderer.setSize(t,n),{width:t,height:n}}get pixelHeight(){return this.renderer.height*this.renderer.dpr}get aspect(){return this.renderer.width/Math.max(1,this.renderer.height)}dispose(){this.canvas.removeEventListener("webglcontextlost",this.lostHandler,!1),this.canvas.removeEventListener("webglcontextrestored",this.restoredHandler,!1);let t=this.gl.getExtension("WEBGL_lose_context");t&&t.loseContext(),this.canvas.parentNode&&this.canvas.parentNode.removeChild(this.canvas)}simulateContextLossCycle(){let t=this.gl.getExtension("WEBGL_lose_context");t&&(t.loseContext(),setTimeout(()=>{t.restoreContext&&t.restoreContext()},300))}};var ft=require("ogl"),he=Math.PI/180,Yn=15*he,Xn=80*he,dt=.12,Ko=35,qo=1.25,$o=.006,js=4,pt=.82,Tt=1/pt,Ys=.12,Xs=2;function Ws(e,t){return{azimuth:e*$o,polar:-t*$o}}function Ks(e,t,n){let r=Math.max(Xs,Math.max(1,t)*Ys),o=n*js;return{minDist:e?Math.min(e.minDist,r):r,maxDist:e?Math.max(e.maxDist,o):o}}var Zt=class{constructor(t,n,r,o){this.fovY=Ko;this.target=new ft.Vec3;this.azimuth=-30*he;this.polar=55*he;this.distance=10;this.azT=-30*he;this.polT=55*he;this.distT=10;this.minDist=1;this.maxDist=100;this.envelope=null;this.gestureFired=!1;this.interactionEnabled=!0;this.dragging=!1;this.panning=!1;this.lastX=0;this.lastY=0;this.activePointers=new Map;this.pinchDist=0;this.pinchCx=0;this.pinchCy=0;this.targetT=new ft.Vec3;this.panAnchor=new ft.Vec3;this.panLimit=0;this.primaryDragMode="orbit";this.camera=new ft.Camera(t,{fov:Ko,near:.1,far:5e3,aspect:1}),this.canvas=n,this.requestRender=r,this.onGesture=o,this.onPointerDown=i=>{if(this.interactionEnabled){try{this.canvas.setPointerCapture?.(i.pointerId)}catch{}if(this.activePointers.set(i.pointerId,{x:i.clientX,y:i.clientY}),this.activePointers.size===1){let a=i.button===2||i.button===1,s=i.button===0&&(i.shiftKey?this.primaryDragMode==="orbit":this.primaryDragMode==="pan");this.panning=a||s,this.dragging=!this.panning,this.lastX=i.clientX,this.lastY=i.clientY}else if(this.activePointers.size===2){this.dragging=!1,this.panning=!1,this.pinchDist=this.currentPinchDistance();let a=this.pinchCentroid();this.pinchCx=a.x,this.pinchCy=a.y}}},this.onPointerMove=i=>{if(!this.interactionEnabled||!this.activePointers.has(i.pointerId))return;if(this.activePointers.set(i.pointerId,{x:i.clientX,y:i.clientY}),this.activePointers.size>=2){let u=this.currentPinchDistance();this.pinchDist>0&&(this.dollyBy(Math.exp((this.pinchDist-u)*.005)),this.fireGesture()),this.pinchDist=u;let d=this.pinchCentroid();this.panBy(d.x-this.pinchCx,d.y-this.pinchCy),this.pinchCx=d.x,this.pinchCy=d.y;return}let a=i.clientX-this.lastX,s=i.clientY-this.lastY;if(this.panning){this.lastX=i.clientX,this.lastY=i.clientY,(a!==0||s!==0)&&(this.panBy(a,s),this.fireGesture());return}if(!this.dragging)return;this.lastX=i.clientX,this.lastY=i.clientY,(a!==0||s!==0)&&this.fireGesture();let c=Ws(a,s);this.azT+=c.azimuth,this.polT=Math.max(Yn,Math.min(Xn,this.polT+c.polar)),this.requestRender()},this.onPointerUp=i=>{this.activePointers.delete(i.pointerId);try{this.canvas.releasePointerCapture?.(i.pointerId)}catch{}this.activePointers.size<2&&(this.pinchDist=0),this.activePointers.size===0&&(this.dragging=!1,this.panning=!1)},this.onContextMenu=i=>{i.preventDefault()},this.onWheel=i=>{if(i.preventDefault(),!this.interactionEnabled)return;let a=i.deltaMode===1?16:i.deltaMode===2?100:1,s=Math.max(-2,Math.min(2,i.deltaY*a/100));this.dollyBy(Math.exp(s*.22)),this.fireGesture()},this.onKeyDown=i=>{if(!this.interactionEnabled)return;let a=7*he;if(i.shiftKey&&(i.key==="ArrowLeft"||i.key==="ArrowRight"||i.key==="ArrowUp"||i.key==="ArrowDown"))this.panBy(i.key==="ArrowLeft"?-32:i.key==="ArrowRight"?32:0,i.key==="ArrowUp"?-32:i.key==="ArrowDown"?32:0);else if(i.key==="ArrowLeft"||i.key==="ArrowRight")this.azT+=i.key==="ArrowLeft"?-a:a;else if(i.key==="ArrowUp"||i.key==="ArrowDown")this.polT=Math.max(Yn,Math.min(Xn,this.polT+(i.key==="ArrowUp"?-a:a)));else if(i.key==="+"||i.key==="=")this.dollyBy(pt);else if(i.key==="-"||i.key==="_")this.dollyBy(Tt);else return;i.preventDefault(),this.fireGesture(),this.requestRender()},n.addEventListener("pointerdown",this.onPointerDown),n.addEventListener("pointermove",this.onPointerMove),n.addEventListener("pointerup",this.onPointerUp),n.addEventListener("pointercancel",this.onPointerUp),n.addEventListener("wheel",this.onWheel,{passive:!1}),n.addEventListener("keydown",this.onKeyDown),n.addEventListener("contextmenu",this.onContextMenu)}pinchCentroid(){let t=[...this.activePointers.values()];if(!t.length)return{x:0,y:0};let n=0,r=0;for(let o of t)n+=o.x,r+=o.y;return{x:n/t.length,y:r/t.length}}panBy(t,n){let r=this.canvas.clientHeight||1,o=2*this.distance*Math.tan(this.fovY*he/2)/r,i=Math.sin(this.azimuth),a=Math.cos(this.azimuth),s=a,c=-i,u=Math.cos(this.polar),d=Math.sin(this.polar),f=-i*u,m=-a*u;this.targetT.x+=(-t*s+n*f)*o,this.targetT.z+=(-t*c+n*m)*o,this.targetT.y+=n*d*o,this.clampPan(),this.requestRender()}clampPan(){if(this.panLimit<=0)return;let t=this.panLimit,n=this.panAnchor.x,r=this.panAnchor.y,o=this.panAnchor.z;this.targetT.x=Math.max(n-t,Math.min(n+t,this.targetT.x)),this.targetT.z=Math.max(o-t,Math.min(o+t,this.targetT.z)),this.targetT.y=Math.max(r-t*.5,Math.min(r+t,this.targetT.y))}fireGesture(){this.gestureFired||(this.gestureFired=!0,this.onGesture?.())}currentPinchDistance(){let t=[...this.activePointers.values()];return t.length<2?0:Math.hypot(t[0].x-t[1].x,t[0].y-t[1].y)}dollyBy(t){this.distT=Math.max(this.minDist,Math.min(this.maxDist,this.distT*t)),this.requestRender()}zoomBy(t){this.interactionEnabled&&(this.dollyBy(t),this.fireGesture())}dollyLimitState(){return{atMin:this.distT<=this.minDist+1e-6,atMax:this.distT>=this.maxDist-1e-6}}setPrimaryDragMode(t){this.primaryDragMode=t}setInteractionEnabled(t){this.interactionEnabled=t,!t&&(this.activePointers.clear(),this.dragging=!1,this.panning=!1,this.pinchDist=0)}frame(t,n=!1,r,o=!1,i){this.target.set(t.center[0],t.center[1],t.center[2]),this.targetT.copy(this.target),this.panAnchor.copy(this.target),this.panLimit=Math.max(1,t.radius)*1.5;let a=Math.max(1,t.radius),s=this.fovY*he/2,c=o?Math.max(.82,this.camera.aspect||1):this.camera.aspect||1,u=Math.atan(Math.tan(s)*c);this.azT=r??-30*he,this.polT=Math.max(15,Math.min(80,i?.polarDeg??55))*he;let d=this.fitDistance(t,s,u,this.azT,this.polT);this.distT=d*Math.max(1.05,Math.min(2,i?.margin??qo)),this.envelope=Ks(this.envelope,a,d),this.minDist=this.envelope.minDist,this.maxDist=this.envelope.maxDist,n?(this.azimuth=this.azT,this.polar=12*he,this.distance=this.distT*1.7):(this.azimuth=this.azT,this.polar=this.polT,this.distance=this.distT),this.applyPosition()}setAspect(t){this.camera.perspective({aspect:t})}frameSoft(t,n,r=!1,o){this.target.set(t.center[0],t.center[1],t.center[2]),this.targetT.copy(this.target),this.panAnchor.copy(this.target),this.panLimit=Math.max(1,t.radius)*1.5,this.syncFromCamera(),this.camera.perspective({fov:this.fovY,aspect:this.camera.aspect});let i=this.fovY*he/2,a=r?Math.max(.82,this.camera.aspect||1):this.camera.aspect||1,s=Math.atan(Math.tan(i)*a);this.azT=n??this.azimuth,this.polT=Math.max(15,Math.min(80,o?.polarDeg??55))*he;let c=this.fitDistance(t,i,s,this.azT,this.polT);this.distT=c*Math.max(1.05,Math.min(2,o?.margin??qo))}fitDistance(t,n,r,o,i){let a=Math.max(1,t.radius),s=Math.max(a/Math.tan(n),a/Math.tan(r)),c=t.box;if(!c)return s;let u=Math.sin(i),d=-u*Math.sin(o),f=-Math.cos(i),m=-u*Math.cos(o);if(Math.abs(f)>.999)return s;let l=-m,p=d,h=Math.hypot(l,p);l/=h,p/=h;let b=-p*f,y=p*d-l*m,v=l*f,S=Math.tan(r),M=Math.tan(n),R=1;for(let x=0;x<8;x++){let g=(x&1?c.max[0]:c.min[0])-t.center[0],C=(x&2?c.max[1]:c.min[1])-t.center[1],E=(x&4?c.max[2]:c.min[2])-t.center[2],D=g*d+C*f+E*m,B=Math.abs(g*l+E*p),L=Math.abs(g*b+C*y+E*v);R=Math.max(R,B/S-D,L/M-D)}return Math.min(s,Math.max(R,a*.35))}updateClipping(t){let n=this.camera.position.x-t.center[0],r=this.camera.position.y-t.center[1],o=this.camera.position.z-t.center[2],i=Math.hypot(n,r,o),a=Math.max(1,t.radius)*1.18,s=Math.max(.05,i-a),c=Math.max(s+10,i+a);this.camera.perspective({near:s,far:c,aspect:this.camera.aspect})}update(){let t=this.azT-this.azimuth,n=this.polT-this.polar,r=this.distT-this.distance,o=this.targetT.x-this.target.x,i=this.targetT.y-this.target.y,a=this.targetT.z-this.target.z,s=Math.max(1e-4,this.distance*1e-4),c=Math.abs(t)>1e-4||Math.abs(n)>1e-4||Math.abs(r)>1e-4||Math.abs(o)>s||Math.abs(i)>s||Math.abs(a)>s;return this.azimuth+=t*dt,this.polar+=n*dt,this.distance+=r*dt,this.target.x+=o*dt,this.target.y+=i*dt,this.target.z+=a*dt,c&&this.applyPosition(),c}get currentDistance(){return this.distance}syncFromCamera(){let t=this.camera.position.x-this.target.x,n=this.camera.position.y-this.target.y,r=this.camera.position.z-this.target.z,o=Math.hypot(t,n,r)||1,i=Math.max(Yn,Math.min(Xn,Math.acos(Math.max(-1,Math.min(1,n/o)))));this.distance=this.distT=o,this.polar=this.polT=i,this.azimuth=this.azT=Math.atan2(t,r)}setTarget(t){this.target.set(t[0],t[1],t[2]),this.targetT.copy(this.target)}resumeAfterFlight(t){this.camera.perspective({fov:this.fovY,aspect:this.camera.aspect}),t&&this.target.set(t[0],t[1],t[2]),this.targetT.copy(this.target),this.syncFromCamera()}applyPosition(){let t=Math.sin(this.polar),n=this.target.x+this.distance*t*Math.sin(this.azimuth),r=this.target.y+this.distance*Math.cos(this.polar),o=this.target.z+this.distance*t*Math.cos(this.azimuth);this.camera.position.set(n,r,o),this.camera.lookAt(this.target)}dispose(){this.canvas.removeEventListener("pointerdown",this.onPointerDown),this.canvas.removeEventListener("pointermove",this.onPointerMove),this.canvas.removeEventListener("pointerup",this.onPointerUp),this.canvas.removeEventListener("pointercancel",this.onPointerUp),this.canvas.removeEventListener("wheel",this.onWheel),this.canvas.removeEventListener("keydown",this.onKeyDown),this.canvas.removeEventListener("contextmenu",this.onContextMenu),this.activePointers.clear()}};var Jt=class{constructor(t){this.rafId=0;this.running=!1;this.lastTime=0;this.fpsEma=0;this.rendered=0;this.tick=t=>{let n=this.lastTime?(t-this.lastTime)/1e3:.016666666666666666;if(this.lastTime=t,n>0){let o=1/n;this.fpsEma=this.fpsEma?this.fpsEma*.9+o*.1:o}this.rendered++,this.frame(n)?this.rafId=requestAnimationFrame(this.tick):(this.running=!1,this.rafId=0)};this.frame=t}requestRender(){this.running||(this.running=!0,this.lastTime=0,this.rafId=requestAnimationFrame(this.tick))}stats(){return{fps:this.running?Math.round(this.fpsEma):0,rendered:this.rendered,idle:!this.running}}stop(){this.rafId&&cancelAnimationFrame(this.rafId),this.rafId=0,this.running=!1}};function Qo(e,t,n){return Math.max(t,Math.min(n,e))}var ht=2.5,qs=1.15,_t=6,bt=10,Zo=6,Jo=9.5,er=.9,tr=2.2,Wn=30,Kn=4,en=8192;var kd=bt+Kn;function nr(e,t){let n=t*1.4,r=t*3.2;if(e<=n)return{scale:1,fade:0,minPixels:ht};let o=Math.min(1,(e-n)/Math.max(.001,r-n));return{scale:1-o*.4,fade:o*.55,minPixels:ht+o*(qs-ht)}}function or(e,t,n){return!(e>0)||!(t>0)||!(n>0)?!1:t*n/e>=64}function rr(e,t,n,r,o){if(!(e>0)||!(t>0)||!(n>0)||!(r>0)||!(o>0))return!1;let i=Math.tan(r/2*Math.PI/180);if(!(i>0))return!1;let a=t/(n*i)*(o/2);return Math.PI*a*a/e>=64}var $s=[{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"}],Dd=new Map($s.map(e=>[e.key,e]));var Qs={wheelchair:"#3b82f6",companion:"#8b5cf6","semi-ambulatory":"#0ea5e9","designated-aisle":"#0284c7","step-free":"#16a34a",hearing:"#14b8a6",cart:"#7c3aed","sign-language":"#f59e0b","low-vision":"#d97706","sensory-friendly":"#6366f1","plus-size":"#ec4899","lift-armrest":"#22c55e"};function ir(e){let t=e?.[0];return t&&Qs[t]||"#3b82f6"}var Zs=[{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"}],Od=new Map(Zs.map(e=>[e.key,e]));var Js=["reference-focal","bar","entrance","exit","restroom","screen","sound","concession","coat","wall","rail","suite","obstruction"],Vd=new Set(Js);var sr=[{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}}],cr=sr.map(e=>e.key),ec=new Map(sr.map(e=>[e.key,e]));function ar(e){return typeof e=="string"&&ec.has(e)}function lr(e,t){return ar(e)?e:ar(t?.seatGlyph)?t.seatGlyph:"circle"}var be=.02291666666666667,He=1/be,tc=58,nc=tc*be;var oc=3,ur=0,qn=120,rc=0,ic=45,ac=7,Ie=1.2;function $n(e,t,n,r){return Number.isFinite(e)?Math.max(t,Math.min(n,e)):r}function sc(e){return!Number.isFinite(e)||!Number.isInteger(e)||e<0?0:e<=ac?e:oc}function tn(e,t={}){let n=$n(t.floorBaseHeightM,ur,qn,0),r=Math.min(qn,n+sc(e.elevation)*nc),o=e.height===void 0?r:$n(e.height,ur,qn,r),i=$n(e.rake,rc,ic,0);return{height:o,rake:i}}var dr=mt(require("earcut"),1),fr=mt(require("polygon-clipping"),1);var Hd=Math.PI/180;function Qn(e){let t=0,n=0;for(let o of e)t+=o.x,n+=o.y;let r=e.length||1;return{x:t/r,y:n/r}}function Lt(e){return e.length?Qn(e):null}function et(e){let t=0;for(let n=0,r=e.length;n<r;n+=1){let o=e[n],i=e[(n+1)%r];t+=o.x*i.y-i.x*o.y}return t/2}function kt(e,t,n){let r=!1;for(let o=0,i=e.length-1;o<e.length;i=o++){let a=e[o],s=e[i];a.y>n!=s.y>n&&t<(s.x-a.x)*(n-a.y)/(s.y-a.y)+a.x&&(r=!r)}return r}var z=be,cc=.002;function lc(e,t,n){let r=Math.hypot(t[0]-e[0],t[1]-e[1],t[2]-e[2]),o=Math.hypot(n[0]-t[0],n[1]-t[1],n[2]-t[2]),i=Math.hypot(e[0]-n[0],e[1]-n[1],e[2]-n[2]),a=Math.max(r,o,i);if(a<1e-9)return!0;let s=(r+o+i)/2;return 2*Math.sqrt(Math.max(0,s*(s-r)*(s-o)*(s-i)))/a<cc}var tt=class{constructor(t=16384){this.len=0;this.buf=new Float32Array(t)}push3(t,n,r){this.len+3>this.buf.length&&this.grow(this.len+3),this.buf[this.len++]=t,this.buf[this.len++]=n,this.buf[this.len++]=r}push1(t){this.len+1>this.buf.length&&this.grow(this.len+1),this.buf[this.len++]=t}grow(t){let n=this.buf.length*2;for(;n<t;)n*=2;let r=new Float32Array(n);r.set(this.buf.subarray(0,this.len)),this.buf=r}get length(){return this.len}toArray(){return this.buf.slice(0,this.len)}},rn=class{constructor(){this.pos=new tt;this.nor=new tt;this.col=new tt;this.flr=new tt;this.mat=new tt;this.currentFloor=0;this.currentMaterial=0}setFloor(t){this.currentFloor=t}setMaterial(t){this.currentMaterial=t}tri(t,n,r,o,i,a=i,s=i){lc(t,n,r)||(this.pos.push3(t[0],t[1],t[2]),this.pos.push3(n[0],n[1],n[2]),this.pos.push3(r[0],r[1],r[2]),this.nor.push3(o[0],o[1],o[2]),this.nor.push3(o[0],o[1],o[2]),this.nor.push3(o[0],o[1],o[2]),this.col.push3(i[0],i[1],i[2]),this.col.push3(a[0],a[1],a[2]),this.col.push3(s[0],s[1],s[2]),this.flr.push1(this.currentFloor),this.flr.push1(this.currentFloor),this.flr.push1(this.currentFloor),this.mat.push1(this.currentMaterial),this.mat.push1(this.currentMaterial),this.mat.push1(this.currentMaterial))}triN(t,n,r,o,i,a,s,c=s,u=s){[...t,...n,...r].every(Number.isFinite)&&(this.pos.push3(t[0],t[1],t[2]),this.pos.push3(n[0],n[1],n[2]),this.pos.push3(r[0],r[1],r[2]),this.nor.push3(o[0],o[1],o[2]),this.nor.push3(i[0],i[1],i[2]),this.nor.push3(a[0],a[1],a[2]),this.col.push3(s[0],s[1],s[2]),this.col.push3(c[0],c[1],c[2]),this.col.push3(u[0],u[1],u[2]),this.flr.push1(this.currentFloor),this.flr.push1(this.currentFloor),this.flr.push1(this.currentFloor),this.mat.push1(this.currentMaterial),this.mat.push1(this.currentMaterial),this.mat.push1(this.currentMaterial))}get vertexCount(){return this.pos.length/3}build(){return{position:this.pos.toArray(),normal:this.nor.toArray(),color:this.col.toArray(),floor:this.flr.toArray(),material:this.mat.toArray(),count:this.pos.length/3}}};function uc(e,t,n){let r=t[0]-e[0],o=t[1]-e[1],i=t[2]-e[2],a=n[0]-e[0],s=n[1]-e[1],c=n[2]-e[2],u=o*c-i*s,d=i*a-r*c,f=r*s-o*a,m=Math.hypot(u,d,f)||1;return u/=m,d/=m,f/=m,[u,d,f]}function mc(e,t){let n=[...e],r=[];for(let a of e)r.push(a.x,a.y);let o=[];if(t){for(let a of t)if(!(a.length<3)){o.push(n.length);for(let s of a)n.push(s),r.push(s.x,s.y)}}let i=(0,dr.default)(r,o.length?o:void 0,2);return{pts:n,tris:i}}function Zn(e){return et(e)<0?[...e].reverse():e}var dc=3;function fc(e,t,n,r){let o=r(e),i=r(t),a=r(n),s=(l,p,h,b)=>Math.abs(r({x:(l.x+p.x)/2,y:(l.y+p.y)/2})-(h+b)/2),c=(e.x+t.x+n.x)/3,u=(e.y+t.y+n.y)/3,d=(o+i+a)/3,f=Math.max(s(e,t,o,i),s(t,n,i,a),s(n,e,a,o),Math.abs(r({x:c,y:u})-d)),m=(l,p,h)=>{let b=Math.abs(r({x:(l+c)/2,y:(p+u)/2})-(h+d)/2);b>f&&(f=b)};return m((e.x+t.x)/2,(e.y+t.y)/2,(o+i)/2),m((t.x+n.x)/2,(t.y+n.y)/2,(i+a)/2),m((n.x+e.x)/2,(n.y+e.y)/2,(a+o)/2),f}function Ft(e,t,n,r,o){if(o<=0)return fc(e,t,n,r);let i={x:(e.x+t.x)/2,y:(e.y+t.y)/2},a={x:(t.x+n.x)/2,y:(t.y+n.y)/2},s={x:(n.x+e.x)/2,y:(n.y+e.y)/2};return Math.max(Ft(e,i,s,r,o-1),Ft(i,t,a,r,o-1),Ft(s,a,n,r,o-1),Ft(i,a,s,r,o-1))}function Dt(e,t,n,r,o,i,a,s){if(a>0){let m={x:(t.x+n.x)/2,y:(t.y+n.y)/2},l={x:(n.x+r.x)/2,y:(n.y+r.y)/2},p={x:(r.x+t.x)/2,y:(r.y+t.y)/2};Dt(e,t,m,p,o,i,a-1,s),Dt(e,m,n,l,o,i,a-1,s),Dt(e,p,l,r,o,i,a-1,s),Dt(e,m,l,p,o,i,a-1,s);return}let c=[t.x*z,o(t),t.y*z],u=[n.x*z,o(n),n.y*z],d=[r.x*z,o(r),r.y*z];if(s){e.triN(c,u,d,s(t),s(n),s(r),i);return}let f=uc(c,u,d);f[1]<0&&(f=[-f[0],-f[1],-f[2]]),e.tri(c,u,d,f,i)}var pc=8;function mr(e,t,n){if(!Number.isFinite(n))return e;let r=[],o=(i,a,s,c,u)=>{if(u>0){let d={x:(i.x+a.x)/2,y:(i.y+a.y)/2},f=t(d);if(Math.abs(f-(s+c)/2)>n){o(i,d,s,f,u-1),o(d,a,f,c,u-1);return}}r.push(i)};for(let i=0;i<e.length;i++){let a=e[i],s=e[(i+1)%e.length];o(a,s,t(a),t(s),pc)}return r}function nn(e,t){if(e.length<3)return e;let n=[];for(let o of e){let i=n[n.length-1];i&&Math.hypot(o.x-i.x,o.y-i.y)<t||n.push(o)}for(;n.length>2&&Math.hypot(n[0].x-n[n.length-1].x,n[0].y-n[n.length-1].y)<t;)n.pop();if(n.length<3)return e;let r=[];for(let o=0;o<n.length;o++){let i=r.length?r[r.length-1]:n[(o-1+n.length)%n.length],a=n[o],s=n[(o+1)%n.length],c=s.x-i.x,u=s.y-i.y,d=Math.hypot(c,u);d>t&&Math.abs((a.x-i.x)*u-(a.y-i.y)*c)/d<t||r.push(a)}return r.length>=3?r:n}var on=.001*He*.1;function ue(e,t,n,r,o,i,a,s,c=1/0,u){if(!t||t.length<3||(c===void 0&&(c=1/0),Math.abs(et(t))<1e-4))return;let d=nn(mr(nn(Zn(t),on),r,c),on),f=n?.map(x=>nn(mr(nn(Zn(x),on),r,c),on)).filter(x=>x.length>=3&&Math.abs(et(x))>=1e-4),{pts:m,tris:l}=mc(d,f),p=[i[0]*s.top,i[1]*s.top,i[2]*s.top],h=[i[0]*s.bottomCap,i[1]*s.bottomCap,i[2]*s.bottomCap],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],v=0;if(Number.isFinite(c))for(;v<dc;v++){let x=0;for(let g=0;g<l.length;g+=3){let C=Ft(m[l[g]],m[l[g+1]],m[l[g+2]],r,v);C>x&&(x=C)}if(x<=c)break}for(let x=0;x<l.length;x+=3){let g=m[l[x]],C=m[l[x+1]],E=m[l[x+2]];Dt(e,g,C,E,r,p,v,u);let D=[g.x*z,o,g.y*z],B=[C.x*z,o,C.y*z],L=[E.x*z,o,E.y*z];e.tri(D,L,B,[0,-1,0],h)}let S=x=>{if(v<=0)return x;let g=1<<v,C=[];for(let E=0;E<x.length;E++){let D=x[E],B=x[(E+1)%x.length];for(let L=0;L<g;L++){let A=L/g;C.push({x:D.x+(B.x-D.x)*A,y:D.y+(B.y-D.y)*A})}}return C},M=Qn(d),R=[{ring:S(d),flip:!1}];if(f)for(let x of f)x.length>=3&&R.push({ring:S(x),flip:!0});for(let{ring:x,flip:g}of R)for(let C=0;C<x.length;C++){let E=x[C],D=x[(C+1)%x.length],B=(D.x-E.x)*z,A=(D.y-E.y)*z,k=-B,N=Math.hypot(A,k)||1;A/=N,k/=N;let w=(E.x+D.x)/2-M.x,T=(E.y+D.y)/2-M.y,_=A*w+k*T;g&&(_=-_),_<0&&(A=-A,k=-k);let P=[A,0,k],O=[E.x*z,r(E),E.y*z],I=[D.x*z,r(D),D.y*z],F=[E.x*z,o,E.y*z],H=[D.x*z,o,D.y*z];e.tri(O,I,H,P,b,b,y),e.tri(O,H,F,P,b,y,y)}}function pr(e){let t=0;for(let c of e)t+=c.count;let n=new Float32Array(t*3),r=new Float32Array(t*3),o=new Float32Array(t*3),i=new Float32Array(t),a=new Float32Array(t),s=0;for(let c of e)n.set(c.position,s*3),r.set(c.normal,s*3),o.set(c.color,s*3),i.set(c.floor,s),a.set(c.material,s),s+=c.count;return{position:n,normal:r,color:o,floor:i,material:a,count:t}}function an(e,t,n=2.5){if(t<=0||e.length<3)return e;let r=Zn(e),o=r.length,i=[];for(let s=0;s<o;s++){let c=r[s],u=r[(s+1)%o],d=u.x-c.x,f=u.y-c.y,m=Math.hypot(d,f)||1;i.push({x:f/m,y:-d/m})}let a=[];for(let s=0;s<o;s++){let c=r[s],u=i[(s-1+o)%o],d=i[s],f=u.x+d.x,m=u.y+d.y,l=Math.hypot(f,m),p=()=>{a.push([c.x+u.x*t,c.y+u.y*t]),a.push([c.x+d.x*t,c.y+d.y*t])};if(l<1e-9){p();continue}f/=l,m/=l;let h=f*u.x+m*u.y,b=1/Math.max(h,1e-6);if(!Number.isFinite(b)||b>n){p();continue}a.push([c.x+f*t*b,c.y+m*t*b])}if(a.length<3)return e;try{let s=fr.default.union([[...a,a[0]]]),c=null,u=-1/0;for(let f of s){let m=Math.abs(et(f[0].map(([l,p])=>({x:l,y:p}))));m>u&&(u=m,c=f[0])}if(!c)return e;let d=c.map(([f,m])=>({x:f,y:m}));if(d.length>1){let f=d[0],m=d[d.length-1];Math.abs(f.x-m.x)<1e-9&&Math.abs(f.y-m.y)<1e-9&&d.pop()}return d.length>=3?d:e}catch{return e}}function sn(e,t,n,r,o=28){let i=[];for(let a=0;a<o;a++){let s=a/o*Math.PI*2;i.push({x:e+n*Math.cos(s),y:t+r*Math.sin(s)})}return i}function Ot(e,t,n,r){return[{x:e,y:t},{x:e+n,y:t},{x:e+n,y:t+r},{x:e,y:t+r}]}var ae={pedestal:0,pad:1,back:2,arm:3,footrest:4,leg:5,body:10,head:11},hc=.44,bc=.15,hr=.3,yc=.24;function br(e){return e===void 0||!Number.isFinite(e)||e<=0?yc:Math.min(hr,Math.max(bc,e*hc))}var Jn=.21,gc=.05,eo=.45,cn=eo+gc,yr=.92,to=1.205,gr=-.23,xr=.38,xc=[{part:ae.pedestal,min:[-.3,0,-.3],max:[.3,.36,.3]},{part:ae.pad,min:[-1,.36,-.95],max:[1,eo,1]},{part:ae.back,min:[-1,cn,-1],max:[1,yr,-.72]},{part:ae.arm,min:[-1,.44,-.82],max:[-.78,.65,.78]},{part:ae.arm,min:[.78,.44,-.82],max:[1,.65,.78]},{part:ae.footrest,min:[-.9,.18,.78],max:[.9,.31,1.34]},{part:ae.leg,min:[-.82,0,-.7],max:[-.62,.37,-.48]},{part:ae.leg,min:[.62,0,-.7],max:[.82,.37,-.48]},{part:ae.leg,min:[-.82,0,.48],max:[-.62,.37,.7]},{part:ae.leg,min:[.62,0,.48],max:[.82,.37,.7]}],vc=[{part:ae.body,min:[-.52,.39,-.08],max:[-.08,.55,.82]},{part:ae.body,min:[.08,.39,-.08],max:[.52,.55,.82]},{part:ae.body,min:[-.47,.05,.58],max:[-.13,.43,.82]},{part:ae.body,min:[.13,.05,.58],max:[.47,.43,.82]},{part:ae.head,min:[-.16,1.04,-.33],max:[.16,1.1,-.13]}],Sc=[{n:[1,0,0],c:[[1,0,0],[1,1,0],[1,1,1],[1,0,1]]},{n:[-1,0,0],c:[[0,0,1],[0,1,1],[0,1,0],[0,0,0]]},{n:[0,1,0],c:[[0,1,0],[0,1,1],[1,1,1],[1,1,0]]},{n:[0,-1,0],c:[[0,0,1],[0,0,0],[1,0,0],[1,0,1]]},{n:[0,0,1],c:[[0,0,1],[1,0,1],[1,1,1],[0,1,1]]},{n:[0,0,-1],c:[[1,0,0],[0,0,0],[0,1,0],[1,1,0]]}];function vr(){let e=[],t=[],n=[],r=[],o=(N,w,T)=>{let _=n.length,[P,O,I]=N,F=[O[0]-P[0],O[1]-P[1],O[2]-P[2]],H=[I[0]-P[0],I[1]-P[1],I[2]-P[2]],j=F[1]*H[2]-F[2]*H[1],G=F[2]*H[0]-F[0]*H[2],V=F[0]*H[1]-F[1]*H[0],W=Math.hypot(j,G,V);W>1e-9?(j/=W,G/=W,V/=W):[j,G,V]=w,j*w[0]+G*w[1]+V*w[2]<0&&(j=-j,G=-G,V=-V);for(let X of N)e.push(...X),t.push(j,G,V),n.push(T);r.push(_,_+1,_+2,_,_+2,_+3)},i=N=>{for(let w of Sc){let T=w.c.map(_=>_.map((P,O)=>P?N.max[O]:N.min[O]));o(T,w.n,N.part)}};for(let N of xc)i(N);for(let N of vc)i(N);let a=eo,s=1.08,c=.47,u=.69,d=-.55,f=.08,m=-.48,l=.01,p=[-c,a,d],h=[c,a,d],b=[-c,a,f],y=[c,a,f],v=[-u,s,m],S=[u,s,m],M=[-u,s,l],R=[u,s,l];o([h,S,R,y],[1,0,0],ae.body),o([b,M,v,p],[-1,0,0],ae.body),o([M,R,S,v],[0,1,0],ae.body),o([p,h,y,b],[0,-1,0],ae.body),o([y,R,M,b],[0,0,1],ae.body),o([p,v,S,h],[0,0,-1],ae.body);let x=10,g=8,C=[0,to,gr],E=[.42,.115,xr],D=n.length;for(let N=0;N<=g;N++){let w=Math.PI*N/g,T=Math.cos(w),_=Math.sin(w);for(let P=0;P<=x;P++){let O=Math.PI*2*P/x,I=_*Math.cos(O),F=_*Math.sin(O);e.push(C[0]+E[0]*I,C[1]+E[1]*T,C[2]+E[2]*F);let H=I/E[0],j=T/E[1],G=F/E[2],V=Math.hypot(H,j,G)||1;H/=V,j/=V,G/=V,t.push(H,j,G),n.push(ae.head)}}for(let N=0;N<g;N++)for(let w=0;w<x;w++){let T=D+N*(x+1)+w,_=T+x+1;r.push(T,_,T+1,T+1,_,_+1)}let B=new Float32Array(e),L=new Float32Array(t),A=new Float32Array(n),k=new Uint16Array(r);return{position:B,normal:L,part:A,index:k,vertexCount:n.length,indexCount:r.length}}function Sr(e,t,n,r){let o=new Float32Array(t),i=u=>e[u*3],a=u=>e[u*3+2],s=0,c=(u,d)=>{let f=d-u;for(let m=u;m<d;m++){let[l,p]=r(m),h=l-i(m),b=p-a(m);if(f>=2){let y=Math.max(u,m-1),v=Math.min(d-1,m+1),S=i(v)-i(y),M=a(v)-a(y),R=Math.hypot(S,M);if(R>1e-6){let x=-M/R,g=S/R;x*h+g*b<0&&(x=-x,g=-g),h=x,b=g}}o[m]=h===0&&b===0?0:Math.atan2(h,b)}};for(let u=1;u<=t;u++)(u===t||n(u)!==n(s))&&(c(s,u),s=u);return o}var De=.22;function Mr(e,t){let n=pe[e];if(n!=="sold"&&n!=="held")return-1;let r=(t+1)*2654435761;return r^=r>>>15,r=Math.imul(r,2246822519),r^=r>>>13,(r>>>0)%1e5/1e5}var Mc=.42;function wc(e){let t=e.length,n=new Float64Array(t);if(t<2)return n.fill(1/0),n;let r=1/0,o=1/0,i=-1/0,a=-1/0;for(let p of e)p.x<r&&(r=p.x),p.y<o&&(o=p.y),p.x>i&&(i=p.x),p.y>a&&(a=p.y);let s=Math.max(i-r,1e-6),c=Math.max(a-o,1e-6),u=Math.max(Math.sqrt(s*c/t),1e-6),d=Math.max(1,Math.ceil(s/u)+1),f=Math.max(1,Math.ceil(c/u)+1),m=new Map,l=(p,h)=>{let b=Math.min(d-1,Math.max(0,Math.floor((p-r)/u)));return Math.min(f-1,Math.max(0,Math.floor((h-o)/u)))*d+b};for(let p=0;p<t;p++){let h=l(e[p].x,e[p].y),b=m.get(h);b?b.push(p):m.set(h,[p])}for(let p=0;p<t;p++){let h=e[p],b=Math.min(d-1,Math.max(0,Math.floor((h.x-r)/u))),y=Math.min(f-1,Math.max(0,Math.floor((h.y-o)/u))),v=1/0;for(let S=1;S<=4;S++){for(let M=y-S;M<=y+S;M++)if(!(M<0||M>=f))for(let R=b-S;R<=b+S;R++){if(R<0||R>=d||S>1&&Math.abs(M-y)<S&&Math.abs(R-b)<S)continue;let x=m.get(M*d+R);if(x)for(let g of x){if(g===p)continue;let C=Math.hypot(e[g].x-h.x,e[g].y-h.y);C<v&&(v=C)}}if(Number.isFinite(v)&&v<=S*u)break}n[p]=v}return n}function Pc(e){let t=e.eyeHeightM;return Number.isFinite(t)?Math.max(0,t-Ie):0}function wr(e,t,n,r,o,i){let a=e.length,s=new Float32Array(a*3),c=new Float32Array(a),u=new Float32Array(a*3),d=new Float32Array(a),f=new Float32Array(a),m=new Float32Array(a),l=new Float32Array(a),p=new Float32Array(a*3),h=new Map,b=wc(e);for(let y=0;y<a;y++){let v=e[y],M=(n?.seatPitchU(y)??b[y])*z;d[y]=Number.isFinite(M)?Math.max(.06,Math.min(De,M*Mc)):De,f[y]=br(Number.isFinite(M)?M:void 0);let R=lr(v.glyph,{seatGlyph:i?.get(v.categoryKey)});m[y]=cr.indexOf(R),l[y]=v.wheelchairSpaceType==="no-seat"?0:1,s[y*3]=v.x*z,s[y*3+1]=n?n.seatDeckY(y):Pc(v),s[y*3+2]=v.y*z,c[y]=It(t?t(v):"available");let x=ne(o?.get(v.categoryKey)??"#6e7bff")??[.43,.48,1];if(u[y*3]=x[0],u[y*3+1]=x[1],u[y*3+2]=x[2],v.accessibility?.length){let g=ne(ir(v.accessibility));g&&(p[y*3]=g[0],p[y*3+1]=g[1],p[y*3+2]=g[2])}h.set(v.id,y)}return{count:a,iPosition:s,iState:c,iCategory:u,iMaxRadius:d,iRing:p,idToIndex:h,iChairWidth:f,iGlyph:m,iPhysicalSeat:l,iFloor:r??new Float32Array(a),iYaw:new Float32Array(a)}}var Cc=64;function no(e,t){let n=[];for(let a of t){let s=e.idToIndex.get(a.seatId);if(s===void 0)continue;let c=It(a.state);e.iState[s]!==c&&(e.iState[s]=c,n.push(s))}if(!n.length)return[];n.sort((a,s)=>a-s);let r=[],o=n[0],i=n[0];for(let a=1;a<n.length;a++){let s=n[a];if(s!==i){if(s<=i+Cc){i=s;continue}r.push({start:o,length:i-o+1}),o=s,i=s}}return r.push({start:o,length:i-o+1}),r}var Ac=.15,Rc=1.6;function Pr(e){return Qo(e??1,Ac,Rc)}var Ec=.15,Ic=.9,Tc=1.76;function _c(){return{background:{top:[...Je.top],bottom:[...Je.bottom]},structure:jn,seatStates:{...Yo},seatScale:1,materials:{seat:null,shell:null,roughness:.78}}}function Cr(e){let t=_c();if(!e)return t;let n=ne(e.background);if(n){t.background={top:Pe(n,Ic),bottom:Pe(n,Tc)};let a={};for(let[s,c]of Object.entries(jn))a[s]=ge(c,n,Ec);t.structure=a}let r=ne(e.selectionColor)??ne(e.accent);r&&(t.seatStates={...t.seatStates,selected:r});let o=e.seatScale;typeof o=="number"&&Number.isFinite(o)&&(t.seatScale=Pr(o));let i=e.venue3d;if(i){let a=ne(i.deck),s=ne(i.fascia);a&&(t.structure={...t.structure,tierTop:a,gaTop:a}),s&&(t.structure={...t.structure,tierWall:s,gaWall:s}),t.materials.seat=ne(i.seat),t.materials.shell=ne(i.shell),typeof i.roughness=="number"&&Number.isFinite(i.roughness)&&(t.materials.roughness=Math.min(1,Math.max(0,i.roughness)))}return t}function Ar(e,t){let n=[];for(let r of t)n.push(...e.seatStates[r]);return n}function Rr(e,t){let n=1-t,r=n*n*n,o=3*n*n*t,i=3*n*t*t,a=t*t*t;return{x:r*e.start.x+o*e.control1.x+i*e.control2.x+a*e.end.x,y:r*e.start.y+o*e.control1.y+i*e.control2.y+a*e.end.y}}function Er(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[Rr(e,.5)];let r=Array.from({length:n+1},(c,u)=>Rr(e,u/n)),o=new Float64Array(r.length);for(let c=1;c<r.length;c+=1){let u=r[c].x-r[c-1].x,d=r[c].y-r[c-1].y;o[c]=o[c-1]+Math.hypot(u,d)}let i=o[o.length-1];if(i<=1e-9)return Array.from({length:t},()=>({...e.start}));let a=[],s=1;for(let c=0;c<t;c+=1){let u=i*c/(t-1);for(;s<o.length-1&&o[s]<u;)s+=1;let d=o[s-1],f=o[s],m=f===d?0:(u-d)/(f-d);a.push({x:r[s-1].x+(r[s].x-r[s-1].x)*m,y:r[s-1].y+(r[s].y-r[s-1].y)*m})}return a}function Ir(e){let t=new Map,n=new Map;for(let r of e){if(r.type!=="row"||!r.segmentedRow)continue;let o=n.get(r.segmentedRow.groupId)??[];o.push(r),n.set(r.segmentedRow.groupId,o)}for(let[r,o]of n){let i=o.slice().sort((m,l)=>m.segmentedRow.componentIndex-l.segmentedRow.componentIndex),a=i[0]?.segmentedRow?.componentCount??0,s=i[0]?.segmentedRow;if(!s||!(a>=2&&i.length===a&&s?.boundaryBefore==="start"&&i.every((m,l)=>m.segmentedRow?.kind==="segmented-row-v1"&&m.segmentedRow.groupId===r&&m.segmentedRow.componentCount===a&&m.segmentedRow.componentIndex===l&&m.segmentedRow.repeatLabelOnComponents===s.repeatLabelOnComponents&&(l===0?m.segmentedRow.boundaryBefore==="start":m.segmentedRow.boundaryBefore!=="start")&&m.segmentedRow.displayLabel===s.displayLabel)))continue;let u=i.reduce((m,l)=>m+l.seatCount,0),d=0,f=0;for(let m of i)m.segmentedRow.boundaryBefore==="break"&&(d+=1),t.set(m.id,{groupId:r,adjacencyOffset:d,displayOffset:f,displayLabel:s.displayLabel,totalSeats:u,canonical:i[0],viewFromSeatUrl:s.viewFromSeatUrl,viewFromSeatMeta:s.viewFromSeatMeta,confidenceEvidence:s.confidenceEvidence}),d+=m.seatCount,f+=m.seatCount}return t}var Lc="ABCDEFGHIJKLMNOPQRSTUVWXYZ";var kc="abcdefghijklmnopqrstuvwxyz";function Fc(e,t){let n=t.length,r=e+1,o="";for(;r>0;){r-=1;let i=r%n;o=t[i]+o,r=Math.floor(r/n)}return o}function oo(e,t=!1){let n=t?kc:Lc;return Fc(Math.max(0,Math.floor(e)-1),n)}var Dc=[[1e3,"M"],[900,"CM"],[500,"D"],[400,"CD"],[100,"C"],[90,"XC"],[50,"L"],[40,"XL"],[10,"X"],[9,"IX"],[5,"V"],[4,"IV"],[1,"I"]];function Tr(e){if(!Number.isFinite(e)||e<=0)return String(e);let t=Math.floor(e),n="";for(let[r,o]of Dc)for(;t>=r;)n+=o,t-=r;return n}function Oc(e){let t=new Array(e);return Array.from({length:e},(n,r)=>r).sort((n,r)=>Math.abs(2*n-(e-1))-Math.abs(2*r-(e-1))||n-r).forEach((n,r)=>t[n]=r),t}function ln(e,t){let n=e.seatLabelStart??1,r=e.seatNumbering?.direction??"ltr",o=e.seatNumbering?.step??1,i=e.seatNumbering?.scheme??"decimal",a=e.seatNumbering?.prefix??"",s=e.seatNumbering?.endAt,c=e.seatCount;if(i==="updown"||i==="updown-descending"){let l=Math.ceil(c/2),p=i==="updown"?t<l?n+2*t:n-1+2*(c-t):t<l?n+2*(l-1-t):n+1+2*(t-l);return`${a}${p}`}let u=i==="odd"||i==="even"?2:o,d=s!=null&&Number.isFinite(s)?s-(c-1)*u:n,f=r==="center"?Oc(c)[t]:r==="rtl"?c-1-t:t,m;switch(i){case"odd":{let l=d%2===1?d:d+1;m=String(l+f*2);break}case"even":{let l=d%2===0?d:d+1;m=String(l+f*2);break}case"roman":m=Tr(d+f*o);break;case"letters-upper":m=oo(d+f*o,!1);break;case"letters-lower":m=oo(d+f*o,!0);break;default:m=String(d+f*o);break}return`${a}${m}`}function Vc(e){return{...e.canonical,seatCount:e.totalSeats,label:e.displayLabel,displayLabel:e.displayLabel}}function _r(e,t,n){return n?.label??`${e.seatLabelBase??e.label}-${ln(e,t)}`}function ro(e,t,n,r){if(r?.displayLabel)return r.displayLabel;if(e.seatDisplayLabelMode==="number")return ln(e,t);if(!n)return`${e.displayLabel||e.label}-${ln(e,t)}`;let o=Vc(n),i=n.displayOffset+t;return`${n.displayLabel}-${ln(o,i)}`}function Lr(e){let t=e.length;return t<=3?[...e]:[e[Math.floor(t*.25)],e[Math.floor(t*.5)],e[Math.floor(t*.75)]]}function yt(e,t,n){if(!e.length)return 1/0;if(e.length===1)return Math.hypot(t-e[0].x,n-e[0].y);let r=1/0;for(let o=0;o+1<e.length;o++){let i=e[o],a=e[o+1],s=a.x-i.x,c=a.y-i.y,u=s*s+c*c,d=u>1e-12?((t-i.x)*s+(n-i.y)*c)/u:0;d<0?d=0:d>1&&(d=1);let f=t-(i.x+d*s),m=n-(i.y+d*c);if(Math.abs(f)>=r||Math.abs(m)>=r)continue;let l=Math.hypot(f,m);l<r&&(r=l)}return r}function Bc(e){let t=0,n=0;for(let i of e)t+=i.x,n+=i.y;let r=e.length||1;t/=r,n/=r;let o=0;for(let i of e){let a=Math.hypot(i.x-t,i.y-n);a>o&&(o=a)}return{cx:t,cy:n,r:o}}function kr(e,t){return Math.hypot(e.cx-t.cx,e.cy-t.cy)-e.r-t.r}function io(e,t){let n=1/0;for(let r of Lr(e)){let o=yt(t,r.x,r.y);o<n&&(n=o)}for(let r of Lr(t)){let o=yt(e,r.x,r.y);o<n&&(n=o)}return n}function Nc(e,t){if(e.length<3)return{pts:e,seatIndices:t};let n=0,r=0;for(let d of e)n+=d.x,r+=d.y;n/=e.length,r/=e.length;let o=-1,i=e[0];for(let d of e){let f=Math.hypot(d.x-n,d.y-r);f>o&&(o=f,i=d)}let a=i.x-n,s=i.y-r,c=Math.hypot(a,s);c>1e-9?(a/=c,s/=c):(a=1,s=0);let u=e.map((d,f)=>({p:d,i:f,t:(d.x-n)*a+(d.y-r)*s})).sort((d,f)=>d.t-f.t);return{pts:u.map(d=>d.p),seatIndices:u.map(d=>t[d.i])}}function ao(e){let t=e.length;if(t<3)return null;let n=0,r=0;for(let v of e)n+=v.x,r+=v.y;n/=t,r/=t;let o=0,i=0,a=0,s=0,c=0,u=0,d=0;for(let v of e){let S=v.x-n,M=v.y-r;o+=S*S,a+=M*M,i+=S*M,s+=S*S*S,c+=M*M*M,u+=S*M*M,d+=M*S*S}let f=o*a-i*i;if(Math.abs(f)<1e-9)return null;let m=(s+u)/2,l=(c+d)/2,p=(m*a-l*i)/f,h=(l*o-m*i)/f,b=p+n,y=h+r;return!Number.isFinite(b)||!Number.isFinite(y)?null:{cx:b,cy:y}}var Gc=.15;function zc(e){if(e.length<2)return null;let t=e.map(v=>{let S=0,M=0;for(let R of v.pts)S+=R.x,M+=R.y;return{x:S/v.pts.length,y:M/v.pts.length}}),n=0,r=0;for(let v of t)n+=v.x,r+=v.y;n/=t.length,r/=t.length;let o=0,i=0,a=0;for(let v of t){let S=v.x-n,M=v.y-r;o+=S*S,i+=S*M,a+=M*M}let s=o+a,c=o*a-i*i,u=s/2+Math.sqrt(Math.max(0,s*s/4-c)),d,f;Math.abs(i)>1e-12?(d=u-a,f=i):o>=a?(d=1,f=0):(d=0,f=1);let m=Math.hypot(d,f);if(!(m>1e-12))return null;d/=m,f/=m;let l=1/0,p=-1/0,h=[];for(let v of e){let S=1/0,M=-1/0;for(let R of v.pts){let x=R.x*d+R.y*f;x<S&&(S=x),x>M&&(M=x),x<l&&(l=x),x>p&&(p=x)}h.push(M-S)}let b=p-l;return b>1e-9?(h.sort((v,S)=>v-S),h[Math.min(h.length-1,Math.floor(h.length*.9))]/b<=Uc?{x:d,y:f}:null):null}var Uc=.35;function un(e,t,n,r){let o=new Map;for(let x of n){let g=t[x],C=g.rowId||`__seat-${x}`,E=o.get(C);E||(E={pts:[],idx:[]},o.set(C,E)),E.pts.push({x:g.x,y:g.y}),E.idx.push(x)}if(!o.size)return{sectionId:e,rows:[],blockCount:0};let i=[];for(let[x,g]of o){let C=Nc(g.pts,g.idx),E=0;for(let D of C.pts)E+=Math.hypot(D.x-r.x,D.y-r.y);i.push({id:x,pts:C.pts,seatIndices:C.seatIndices,blockId:-1,ordinal:0,blockDepth:0,focalDistance:E/C.pts.length})}let a=i.map(x=>Bc(x.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((x,g)=>[x,g])):null,d=(x,g)=>(x>g&&([x,g]=[g,x]),x*(2*i.length-x-1)/2+(g-x-1)),f=(x,g)=>{if(!c)return io(i[x].pts,i[g].pts);let C=d(x,g),E=c[C];if(!Number.isNaN(E))return E;let D=io(i[x].pts,i[g].pts);return c[C]=D,D},m=(x,g)=>u?f(u.get(x),u.get(g)):io(x.pts,g.pts),l=[];for(let x=0;x<i.length;x++){let g=1/0;for(let C=0;C<i.length;C++){if(x===C||kr(a[x],a[C])>=g)continue;let E=f(x,C);E<g&&(g=E)}Number.isFinite(g)&&l.push(g)}l.sort((x,g)=>x-g);let p=l.length?l[Math.floor(l.length/2)]:1,h=Math.max(p*1.8,1e-6),b=i.map(()=>[]);for(let x=0;x<i.length;x++)for(let g=x+1;g<i.length;g++)kr(a[x],a[g])>h||f(x,g)<=h&&(b[x].push(g),b[g].push(x));let y=0;for(let x=0;x<i.length;x++){if(i[x].blockId!==-1)continue;let g=y++,C=[x];for(i[x].blockId=g;C.length;){let E=C.pop();for(let D of b[E])i[D].blockId===-1&&(i[D].blockId=g,C.push(D))}}let v=new Map;for(let x of i){let g=v.get(x.blockId)??[];g.push(x),v.set(x.blockId,g)}let S=[];for(let x of i){if(x.pts.length<4)continue;let g=ao(x.pts);g&&(!Number.isFinite(g.cx)||!Number.isFinite(g.cy)||S.push({x:g.cx,y:g.cy}))}let M=S.length>=2?(()=>{let x=S.map(E=>E.x).sort((E,D)=>E-D),g=S.map(E=>E.y).sort((E,D)=>E-D),C=Math.floor(S.length/2);return{cx:x[C],cy:g[C]}})():null;if(M){let x=L=>Math.hypot(L.x-M.cx,L.y-M.cy),g=1/0,C=-1/0,E=[];for(let L of i){let A=1/0,k=-1/0;for(let N of L.pts){let w=x(N);w<A&&(A=w),w>k&&(k=w)}E.push(k-A),A<g&&(g=A),k>C&&(C=k)}let D=C-g;E.sort((L,A)=>L-A);let B=E[Math.min(E.length-1,Math.floor(E.length*.9))];if(D>1e-9&&B/D<=Gc){let L=i.map(F=>{let H=0;for(let j of F.pts)H+=x(j);return{row:F,radius:H/F.pts.length}}),A=0,k=0;for(let F of L)A+=F.radius,k+=F.row.focalDistance;A/=L.length,k/=L.length;let N=0;for(let F of L)N+=(F.radius-A)*(F.row.focalDistance-k);if(N<0)for(let F of L)F.radius=-F.radius;let T=1/0;for(let F of L)F.radius<T&&(T=F.radius);L.sort((F,H)=>F.radius-H.radius);let _=-1,P=-1/0,O=D/Math.max(1,L.length)*.5,I=[];for(let F of L)F.radius-P>O&&(_++,P=F.radius),F.row.ordinal=_,F.row.blockDepth=F.radius-T,I.push(F.row);return{sectionId:e,rows:I,blockCount:y}}}let R=[];for(let[,x]of v){let g=zc(x);if(g){let C=D=>{let B=0;for(let L of D.pts)B+=L.x*g.x+L.y*g.y;return B/D.pts.length};x.sort((D,B)=>C(D)-C(B)),x.length>=2&&x[0].focalDistance>x[x.length-1].focalDistance&&x.reverse();let E=0;for(let D=0;D<x.length;D++)D>0&&(E+=m(x[D-1],x[D])),x[D].ordinal=D,x[D].blockDepth=E,R.push(x[D])}else{let C=1/0;for(let E of x)E.focalDistance<C&&(C=E.focalDistance);x.sort((E,D)=>E.focalDistance-D.focalDistance);for(let E=0;E<x.length;E++)x[E].ordinal=E,x[E].blockDepth=Math.max(0,x[E].focalDistance-C),R.push(x[E])}}return{sectionId:e,rows:R,blockCount:y}}var Hc=/^\d{4}-\d{2}-\d{2}$/;function jc(e){let t=Date.parse(e);return Number.isFinite(t)?Hc.test(e)?t+864e5:t:null}function Yc(e,t=Date.now()){if(e.validUntil===void 0){if(e.status!=="approved")return!0;let r=e.assessedAt?Date.parse(e.assessedAt):Number.NaN;return Number.isFinite(r)&&(t instanceof Date?t.getTime():t)<=r+366*864e5}let n=jc(e.validUntil);return n===null?!1:(t instanceof Date?t.getTime():t)<n}function Xc(e,t,n){return!(e.eventConfigurationId&&e.eventConfigurationId!==t||e.eventConfigurationVersion!==void 0&&e.eventConfigurationVersion!==n)}function Wc(e){return e.status!=="draft"&&e.status!=="retracted"}function Kc(e,t){return e.status===void 0?t===void 0:e.status!=="approved"?!0:typeof t=="string"&&typeof e.basisSha256=="string"&&e.basisSha256===t}function Fr(e,t={}){return!!e&&Wc(e)&&Xc(e,t.activeConfigurationId,t.activeConfigurationVersion)&&Kc(e,t.activeBasisSha256)&&Yc(e,t.now)}var gf=Math.PI*2;function mn(e){return e==="pitch-football"||e==="rink-hockey"||e==="track-athletics"||e==="oval-cricket"}var qc=/^data:image\/(?:png|jpe?g|webp|gif|avif);base64,[a-z0-9+/]+={0,2}$/i,$c=/[\s"'<>`\\]/;function Qc(e){if(typeof e!="string"||!e||e.length>2e6||e!==e.trim())return!1;if(e.startsWith("data:"))return qc.test(e);if($c.test(e))return!1;try{let t=new URL(e);return t.protocol==="https:"&&!t.username&&!t.password}catch{return!1}}function Dr(e){let t=e.trim();return Qc(t)?t:null}var so="seatlayer.event-configuration/1";var gt=100,Zc=120,Jc=2e5,el=1e4,tl=/^[a-f0-9]{64}$/,nl=new Set(["stage","screen","barrier","camera_platform","sound_desk","rigging_truss"]);function Vt(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function nt(e,t){return typeof e=="string"&&e.length>=1&&e.length<=t&&e.normalize("NFKC").trim()===e}function ol(e){return typeof e=="number"&&Number.isInteger(e)&&e>0}function Or(e){return!Array.isArray(e)||e.length>Jc||!e.every(t=>nt(t,gt))?null:[...new Set(e)].sort()}function rl(e){return!Vt(e)||!nt(e.chartId,gt)||!nt(e.version,gt)||e.sha256!==void 0&&(typeof e.sha256!="string"||!tl.test(e.sha256))?null:{chartId:e.chartId,version:e.version,...typeof e.sha256=="string"?{sha256:e.sha256}:{}}}function co(e,t,n){return typeof e=="number"&&Number.isFinite(e)&&e>=t&&e<=n}function il(e){return Vt(e)?e.mode==="none"||e.mode==="opaque"?e.opacity===void 0?{mode:e.mode}:null:e.mode==="partial"&&co(e.opacity,.01,.99)?{mode:"partial",opacity:e.opacity}:null:null}function al(e,t){if(e===void 0)return;if(!Array.isArray(e)||e.length>el)return null;let n=new Set(t),r=new Set,o=new Set,i=0,a=[];for(let s of e){if(!Vt(s)||!nt(s.id,gt)||!nt(s.objectId,gt)||!n.has(s.objectId)||!nl.has(String(s.kind))||!co(s.heightM,.05,50)||s.baseElevationM!==void 0&&!co(s.baseElevationM,-10,100))return null;let c=il(s.occlusion);if(!c||r.has(s.id)||o.has(s.objectId))return null;let u=s.contentImageUrl===void 0?void 0:typeof s.contentImageUrl=="string"?Dr(s.contentImageUrl):null;if(s.contentImageUrl!==void 0&&(!u||s.kind!=="screen"||++i>1))return null;r.add(s.id),o.add(s.objectId),a.push({id:s.id,objectId:s.objectId,kind:s.kind,heightM:s.heightM,...s.baseElevationM!==void 0?{baseElevationM:s.baseElevationM}:{},occlusion:c,...u?{contentImageUrl:u}:{}})}return a.sort((s,c)=>s.id.localeCompare(c.id))}function sl(e){let t=[];if(!Vt(e))return{issues:[{code:"invalid_export",path:"configuration",message:"Configuration must be an object"}]};e.schema!==so&&t.push({code:"unsupported_schema",path:"configuration.schema",message:`Configuration schema must be ${so}`}),nt(e.id,gt)||t.push({code:"invalid_id",path:"configuration.id",message:"Configuration id must contain 1 to 100 normalized characters"}),nt(e.label,Zc)||t.push({code:"invalid_label",path:"configuration.label",message:"Configuration label must contain 1 to 120 normalized characters"}),ol(e.version)||t.push({code:"invalid_version",path:"configuration.version",message:"Configuration version must be a positive integer"});let n=rl(e.baseVenue);n||t.push({code:"invalid_base_venue",path:"configuration.baseVenue",message:"Base venue must identify one normalized chart id and exact version"});let r=Vt(e.overlay)?e.overlay:null,o=Or(r?.objectIds),i=Or(r?.productionKillSeatIds),a=o?al(r?.productionElements,o):null;return(!r||!o||!i)&&t.push({code:"invalid_overlay",path:"configuration.overlay",message:"Overlay ids must be bounded arrays of normalized stable ids"}),a===null&&t.push({code:"invalid_production_element",path:"configuration.overlay.productionElements",message:"Production elements must be unique, bounded semantics over referenced base-venue objects"}),t.length||!n||!o||!i||a===null?{issues:t}:{issues:t,value:{schema:so,id:e.id,label:e.label,version:e.version,baseVenue:n,overlay:{objectIds:o,productionKillSeatIds:i,...a!==void 0?{productionElements:a}:{}}}}}function Vr(e){let t=sl(e);return t.value?{ok:!0,value:t.value}:{ok:!1,issues:t.issues}}function cl(e){if((e.kind==="polygon"||e.kind==="polyline"||e.kind==="line")&&e.points&&e.points.length>=2)return e.points;if(e.x==null||e.y==null||e.width==null||e.height==null)return null;let t=e.x,n=e.y,r=e.width,o=e.height;return[{x:t,y:n},{x:t+r,y:n},{x:t+r,y:n+o},{x:t,y:n+o}]}function ll(e,t,n){let r=n*Math.PI/180,o=Math.cos(r),i=Math.sin(r),a=e.x-t.x,s=e.y-t.y;return{x:t.x+a*o-s*i,y:t.y+a*i+s*o}}function Br(e){let t=cl(e);if(!t||t.length<2)return null;let n=e.rotation??0,r=Math.abs(n)<1e-6?t:t.map(c=>ll(c,{x:t.reduce((u,d)=>u+d.x,0)/t.length,y:t.reduce((u,d)=>u+d.y,0)/t.length},n)),o=1/0,i=1/0,a=-1/0,s=-1/0;for(let c of r)o=Math.min(o,c.x),i=Math.min(i,c.y),a=Math.max(a,c.x),s=Math.max(s,c.y);return!Number.isFinite(o)||a-o<1e-6||s-i<1e-6?null:{minX:o,minY:i,maxX:a,maxY:s}}var ul=5,ml=3,dl=.92,fl=1.9,pl=2,hl=.6,bl=1,yl=.06;function gl(e){return e.heightM!==void 0?e.heightM:mn(e.stageKind)?yl:bl}function Nr(e){let t=1/0,n=1/0,r=-1/0,o=-1/0,i=-1/0;for(let a of Ur(e)){let s=a.baseHeightM??0;for(let c of a.objects){if(c.type!=="shape"||c.role!=="stage")continue;let u=Br(c);u&&(t=Math.min(t,u.minX),n=Math.min(n,u.minY),r=Math.max(r,u.maxX),o=Math.max(o,u.maxY),i=Math.max(i,s+gl(c)))}}return!Number.isFinite(t)||!Number.isFinite(i)?null:{minX:t,minY:n,maxX:r,maxY:o,deckTopM:i}}function xl(e,t,n,r){let o=1/0,i=1/0,a=-1/0,s=-1/0;for(let l of e)Number.isFinite(l.eyeHeightM)&&(o=Math.min(o,l.x),a=Math.max(a,l.x),i=Math.min(i,l.y),s=Math.max(s,l.y));if(!Number.isFinite(o))return null;let c=o*t,u=i*t,d=Math.max(1,Math.ceil((a-o)*t/n)+1),f=Math.max(1,Math.ceil((s-i)*t/n)+1),m=new Float64Array(d*f).fill(-1/0);for(let l of e){if(!Number.isFinite(l.eyeHeightM))continue;let p=l.eyeHeightM-Ie,h=Math.min(d-1,Math.max(0,Math.floor((l.x*t-c)/n))),y=Math.min(f-1,Math.max(0,Math.floor((l.y*t-u)/n)))*d+h,v=p+r;v>m[y]&&(m[y]=v)}return{cellM:n,minX:c,minY:u,cols:d,rows:f,top:m}}function vl(e,t,n){let r=Math.floor((t-e.minX)/e.cellM),o=Math.floor((n-e.minY)/e.cellM);return r<0||o<0||r>=e.cols||o>=e.rows?-1/0:e.top[o*e.cols+r]}function Gr(e,t,n={}){let r=new Map;if(!t||!e.length)return r;let o=n.metresPerChartUnit??be,i=n.cellM??hl,a=n.chairBackM??dl,s=n.selfRowSkipM??pl,c=n.clearThreshold??.9,u=n.partialThreshold??.25,d=Math.max(1,n.columns??ul),f=Math.max(1,n.rows??ml),m=xl(e,o,i,a);if(!m)return r;let l=(t.maxX-t.minX)*o,p=(t.maxY-t.minY)*o,h=l>=p,b=(t.minX+t.maxX)/2*o,y=(t.minY+t.maxY)/2*o,v=[];for(let M=0;M<d;M++){let R=(M+.5)/d-.5,x=h?b+R*l:b,g=h?y:y+R*p;for(let C=0;C<f;C++){let E=t.deckTopM+(f===1?0:C/(f-1)*fl);v.push({x,y:g,z:E})}}let S=i/2;for(let M of e){if(!Number.isFinite(M.eyeHeightM))continue;let R=M.x*o,x=M.y*o,g=M.eyeHeightM,C=0,E=1/0;for(let B of v){let L=B.x-R,A=B.y-x,k=Math.hypot(L,A);if(!(k>s)){C++;continue}let N=L/k,w=A/k,T=0;for(let _=s;_<k;_+=S){let P=vl(m,R+N*_,x+w*_);if(!(!Number.isFinite(P)||P>=g)&&P>g+(B.z-g)*_/k){T=_;break}}T?E=Math.min(E,T):C++}let D=C/v.length;D>=c||r.set(M.id,{seatId:M.id,mark:D<u?"obstructedView":"restrictedView",visibleFraction:D,totalRays:v.length,atDistanceM:Number.isFinite(E)?E:0})}return r}function zr(e,t){if(!t.size)return 0;let n=0;for(let r of e){let o=t.get(r.id);if(!o)continue;let i=r.commercial;i?.restrictedView!==void 0||i?.obstructedView!==void 0||(r.commercial={...i,[o.mark]:!0},n++)}return n}function lo(e){return e?e.accessibility?.length?e.wheelchairSpaceType&&!e.accessibility.includes("wheelchair")?["wheelchair",...e.accessibility]:e.accessibility:e.wheelchairSpaceType?["wheelchair"]:e.accessible?["wheelchair"]:[]:[]}var fn=Math.PI/180;var Bt=16;function uo(e,t,n,r){let o=n*fn,i=Math.cos(o),a=Math.sin(o);return{x:r.x+e*i-t*a,y:r.y+e*a+t*i}}function Wr(e){let{seatCount:t,seatSpacing:n,curve:r,rotation:o,origin:i}=e,a=[];if(e.path)return Er(e.path,t);if(t<=1)return t===1&&a.push({x:i.x,y:i.y}),a;if(r===0){for(let u=0;u<t;u++)a.push(uo(u*n,0,o,i));return a}let s=r/(t-1)*fn,c=n/(2*Math.sin(Math.abs(s)/2));for(let u=0;u<t;u++){let d=u*s,f=c*Math.sin(d),m=-c+c*Math.cos(d);a.push(uo(f,m,o,i))}return a}function Kr(e){let t=new Map;if(e.overrides)for(let n of e.overrides)t.set(n.index,n);return t}function Sl(e,t){let n=Kr(e);return Wr(e).map((r,o)=>{let i=n.get(o),a=lo(i),s=_r(e,o,i),c={...e.commercial,...i?.commercial};return{index:o,x:r.x+(i?.dx??0),y:r.y+(i?.dy??0),label:s,displayLabel:ro(e,o,t,i),categoryKey:i?.categoryKey??e.categoryKey,skipped:!!i?.skip,accessible:a.length>0,accessibility:a,wheelchairSpaceType:i?.wheelchairSpaceType,commercial:Object.values(c).some(u=>u!==void 0&&u!==!1&&u!=="")?c:void 0,glyph:i?.glyph,viewUrl:i?.viewFromSeatUrl??e.viewFromSeatUrl,viewMeta:i?.viewFromSeatUrl?i.viewFromSeatMeta:e.viewFromSeatMeta,labelStyle:i?.labelStyle??e.seatLabelStyle}})}function Ml(e){let t=[];for(let n of Sl(e))n.skipped||t.push({id:`${e.id}:${n.index}`,label:n.label,displayLabel:n.displayLabel===n.label?void 0:n.displayLabel,x:n.x,y:n.y,rowId:e.id,categoryKey:n.categoryKey,accessible:n.accessible||void 0,accessibility:n.accessibility.length?n.accessibility:void 0,wheelchairSpaceType:n.wheelchairSpaceType,commercial:n.commercial,glyph:n.glyph,viewUrl:n.viewUrl,viewMeta:n.viewMeta,labelStyle:n.labelStyle});return t}function wl(e){if(e.seatCountsBySide)return{...e.seatCountsBySide};let t=e.sides&&e.sides.length?e.sides:["top","bottom"],n=["top","bottom","left","right"].filter(i=>t.includes(i)),r={top:0,bottom:0,left:0,right:0};if(!n.length)return r;let o=Math.max(0,Math.round(e.seatCount));for(let i=0;i<o;i++)r[n[i%n.length]]+=1;return r}function Pl(e){let t=[],n=Math.max(0,Math.round(e.seatCount));if(n===0)return t;let r=new Map((e.overrides??[]).map(d=>[d.index,d])),o=(d,f,m,l)=>{let p=r.get(d),h=lo(p),b=p?.label??`${e.label}-${d+1}`,y=e.displayLabel??e.label;return{index:d,label:b,displayLabel:p?.displayLabel??`${y}-${d+1}`,x:f+(p?.dx??0),y:m+(p?.dy??0),categoryKey:p?.categoryKey??e.categoryKey,skipped:!!p?.skip,accessible:h.length>0,accessibility:h,wheelchairSpaceType:p?.wheelchairSpaceType,commercial:p?.commercial,glyph:p?.glyph,viewUrl:p?.viewFromSeatUrl,viewMeta:p?.viewFromSeatUrl?p.viewFromSeatMeta:void 0,labelStyle:p?.labelStyle,...l?{side:l}:{}}};if(e.shape==="round"){let d=(e.radius??40)+Bt,f=e.rotation*fn,m=Math.max(0,Math.min(360,e.seatArc??360));if(m>=360||n===1){for(let b=0;b<n;b++){let y=f+b/n*2*Math.PI;t.push(o(b,e.center.x+d*Math.cos(y),e.center.y+d*Math.sin(y)))}return t}let l=m*fn,p=(2*Math.PI-l)/2,h=f+p;for(let b=0;b<n;b++){let y=h+b/(n-1)*l;t.push(o(b,e.center.x+d*Math.cos(y),e.center.y+d*Math.sin(y)))}return t}let i=e.width??80,a=e.height??50,s=wl(e),c=["top","bottom","left","right"],u=0;for(let d of c){let f=s[d];for(let m=0;m<f;m++){let l,p;d==="top"?(l=-i/2+(m+.5)*i/f,p=-a/2-Bt):d==="bottom"?(l=-i/2+(m+.5)*i/f,p=a/2+Bt):d==="left"?(l=-i/2-Bt,p=-a/2+(m+.5)*a/f):(l=i/2+Bt,p=-a/2+(m+.5)*a/f);let h=uo(l,p,e.rotation,e.center);t.push(o(u++,h.x,h.y,d))}}return t}function Cl(e){return Pl(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 Al(e){return[{id:`${e.id}:0`,label:e.label,...e.displayLabel&&e.displayLabel!==e.label?{displayLabel:e.displayLabel}:{},x:e.center.x,y:e.center.y,rowId:e.id,categoryKey:e.categoryKey,kind:"booth"}]}function Hr(e,t){let n=!1;for(let r=0,o=t.length-1;r<t.length;o=r++){let i=t[r].x,a=t[r].y,s=t[o].x,c=t[o].y;a>e.y!=c>e.y&&e.x<(s-i)*(e.y-a)/(c-a)+i&&(n=!n)}return n}function Rl(e,t){return t.some((n,r)=>{let o=t[(r+1)%t.length],i=(e.y-n.y)*(o.x-n.x)-(e.x-n.x)*(o.y-n.y);if(Math.abs(i)>1e-7)return!1;let a=(e.x-n.x)*(o.x-n.x)+(e.y-n.y)*(o.y-n.y),s=(o.x-n.x)**2+(o.y-n.y)**2;return a>=-1e-7&&a<=s+1e-7})}function mo(e){return Array.isArray(e)?e.filter(t=>Array.isArray(t)&&t.length>=3):[]}function ot(e,t,n){return Hr(e,t)&&!mo(n).some(r=>Hr(e,r)||Rl(e,r))}function dn(e){if(!e.length)return{x:0,y:0};let t=0,n=0;for(let r of e)t+=r.x,n+=r.y;return{x:t/e.length,y:n/e.length}}function qr(e){switch(e.type){case"row":{let t=Wr(e),n=Kr(e),r=0,o=0,i=0;for(let a=0;a<t.length;a++){let s=n.get(a);s?.skip||(r+=t[a].x+(s?.dx??0),o+=t[a].y+(s?.dy??0),i++)}return i?{x:r/i,y:o/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 dn(e.points);case"section":return dn(e.outline);case"text":return{x:e.position.x,y:e.position.y};case"shape":return e.points&&e.points.length?dn(e.points):e.x!=null&&e.y!=null&&e.width!=null&&e.height!=null?{x:e.x+e.width/2,y:e.y+e.height/2}:{x:e.x??0,y:e.y??0};case"decorImage":return{x:e.x+e.width/2,y:e.y+e.height/2}}}function jr(e,t){return e.length===t.length&&e.every((n,r)=>n.x===t[r].x&&n.y===t[r].y)}function El(e,t){if(e.type!=="gaArea"||!jr(e.points,t.outline))return!1;let n=mo(e.holes),r=mo(t.holes);return n.length===r.length&&n.every((o,i)=>jr(o,r[i]))}function Il(e,t,n=e.filter(o=>o.type==="section"),r=qr(t)){let o="referenceInventorySource"in t?t.referenceInventorySource?.logicalSectionId:void 0;return(o?n.find(a=>(a.logicalSectionId??a.id)===o&&(El(t,a)||ot(r,a.outline,a.holes))):void 0)??n.find(a=>ot(r,a.outline,a.holes))}function Ur(e){return e.floors&&e.floors.length?e.floors:[{id:"floor-0",name:"Main",objects:e.objects,focalPoint:e.focalPoint,referenceImage:e.referenceImage,backgroundImage:e.backgroundImage}]}function Yr(e,t,n,r,o,i,a,s,c){let u=[],d=e.filter(h=>h.type==="section"),f=Ir(e),m=h=>!h?.eventConfigurationId||h.eventConfigurationId===r&&(h.eventConfigurationVersion===void 0||h.eventConfigurationVersion===c),l=h=>Fr(h,{activeConfigurationId:r,activeConfigurationVersion:c,activeBasisSha256:o,now:s}),p=(h,b)=>l(h)?{...h,coverage:b}:void 0;for(let h of e){let b=[];if(h.type==="row"?b=Ml(h):h.type==="table"?b=Cl(h):h.type==="booth"&&(b=Al(h)),!b.length)continue;for(let R of b)R.viewUrl&&!m(R.viewMeta)&&(R.viewUrl=void 0,R.viewMeta=void 0);if(h.type==="row"){let R=f.get(h.id);if(R){let x=new Map((h.overrides??[]).map(g=>[g.index,g]));for(let g of b){let C=Number(g.id.slice(g.id.lastIndexOf(":")+1));if(!Number.isInteger(C))continue;g.logicalRowId=R.groupId,g.logicalSeatIndex=R.adjacencyOffset+C,x.get(C)?.displayLabel||(g.displayLabel=ro(h,C,R)),!g.viewUrl&&R.viewFromSeatUrl&&m(R.viewFromSeatMeta)&&(g.viewUrl=R.viewFromSeatUrl,g.viewMeta=R.viewFromSeatMeta);let E=x.get(C)?.confidenceEvidence;g.confidenceEvidence=p(E,"exact-seat")??p(h.confidenceEvidence,"row-representative")??p(R.confidenceEvidence,"row-representative")}}}let y=Il(e,h,d,h.type==="row"?dn(b):qr(h)),v=y?.viewFromSeatUrl,M=(y?.zone?t?.find(R=>R.id===y.zone):void 0)?.focalPoint??n;for(let R of b){if(!R.confidenceEvidence){let x=Number(R.id.slice(R.id.lastIndexOf(":")+1)),g=(h.type==="row"||h.type==="table")&&Number.isInteger(x)?h.overrides?.find(C=>C.index===x)?.confidenceEvidence:void 0;R.confidenceEvidence=p(g,"exact-seat")??(h.type==="row"?p(h.confidenceEvidence,"row-representative"):void 0)}R.confidenceEvidence??=p(y?.confidenceEvidence,"section-representative")??(a?p(a.evidence,a.coverage):void 0),!R.viewUrl&&v&&m(y?.viewFromSeatMeta)&&(R.viewUrl=v,R.viewMeta=y?.viewFromSeatMeta),!R.viewUrl&&i&&m(i.meta)&&(R.viewUrl=i.url,R.viewMeta=i.meta),y&&(R.sectionId=y.logicalSectionId??y.id),y?.zone&&(R.zoneId=y.zone),M&&(R.focalPoint={...M})}u.push(...b)}return u}function $r(e,t={}){if(e.floors?.length){let r=[];for(let o of e.floors){let i=o.focalPoint??e.focalPoint,a=o.viewFromSeatUrl?{url:o.viewFromSeatUrl,meta:o.viewFromSeatMeta}:e.viewFromSeatUrl?{url:e.viewFromSeatUrl,meta:e.viewFromSeatMeta}:void 0,s=o.confidenceEvidence?{evidence:o.confidenceEvidence,coverage:"floor-representative"}:e.confidenceEvidence?{evidence:e.confidenceEvidence,coverage:"venue-representative"}:void 0,c=Yr(o.objects,e.zones,i,e.eventConfigurationId,e.confidenceBasisSha256,a,s,t.now,t.eventConfigurationVersion??e.eventConfigurationVersion);t.resolveEyeHeights!==!1&&Xr(o.objects,o.focalPoint??e.focalPoint,o.baseHeightM??0,c);for(let u of c)u.floorId=o.id;for(let u of c)r.push(u)}return r}let n=Yr(e.objects,e.zones,e.focalPoint,e.eventConfigurationId,e.confidenceBasisSha256,e.viewFromSeatUrl?{url:e.viewFromSeatUrl,meta:e.viewFromSeatMeta}:void 0,e.confidenceEvidence?{evidence:e.confidenceEvidence,coverage:"venue-representative"}:void 0,t.now,t.eventConfigurationVersion??e.eventConfigurationVersion);return t.resolveEyeHeights!==!1&&Xr(e.objects,e.focalPoint,t.floorBaseHeightM??0,n),Tl(e,n,t)}function Tl(e,t,n){return!n.deriveRestrictedView||e.derivedRestrictedView===!1||n.resolveEyeHeights===!1||zr(t,Gr(t,Nr(e))),t}function Xr(e,t,n,r){let o=e.filter(f=>f.type==="section"),i=n>0||o.some(f=>f.height!==void 0||f.rake!==void 0||(f.elevation??0)>0);if(!o.length||!i||!t){for(let f of r)f.eyeHeightM=n+Ie;return}let a=new Array(r.length),s=new Map;for(let f of o)s.has(f.id)||s.set(f.id,f);let c=new Map,u=new Map;for(let f=0;f<r.length;f++){let m=r[f],p=(m.sectionId?s.get(m.sectionId)??o.find(b=>b.logicalSectionId===m.sectionId&&ot({x:m.x,y:m.y},b.outline,b.holes)):void 0)??o.find(b=>ot({x:m.x,y:m.y},b.outline,b.holes))??null;if(a[f]=p,!p)continue;c.has(p.id)||c.set(p.id,tn(p,{floorBaseHeightM:n}));let h=u.get(p.id);h?h.push(f):u.set(p.id,[f])}let d=new Array(r.length).fill(void 0);for(let[f,m]of u){let l=c.get(f);if(!l)continue;let p=l.rake>0?Math.tan(l.rake*Math.PI/180):0,h=un(f,r,m,t);for(let b of h.rows){let y=b.blockDepth*be*p,v=l.height+y;for(let S of b.seatIndices)d[S]=v}}for(let f=0;f<r.length;f++){let m=r[f],l=a[f];if(!l){m.eyeHeightM=n+Ie;continue}let p=c.get(l.id);m.eyeHeightM=(d[f]??p.height)+Ie}}function _l(e){return{kind:"radial",rowCount:0,rows:[],nearestRow:()=>-1,depthAt:(t,n)=>Math.hypot(t-e.x,n-e.y),gradientAt:(t,n)=>{let r=t-e.x,o=n-e.y,i=Math.hypot(r,o);return i<1e-9?[0,0]:[r/i,o/i]}}}function Ll(e,t){if(!e.length)return null;let n=0,r=0,o=0;for(let l of e)n+=l.x,r+=l.y,o+=Math.hypot(l.x-t.x,l.y-t.y);let i=e.length;n/=i,r/=i,o/=i;let a=e[0],s=-1;for(let l of e){let p=Math.hypot(l.x-n,l.y-r);p>s&&(s=p,a=l)}let c=a.x-n,u=a.y-r,d=Math.hypot(c,u);d>1e-9?(c/=d,u/=d):(c=1,u=0);let f=[...e].sort((l,p)=>(l.x-n)*c+(l.y-r)*u-((p.x-n)*c+(p.y-r)*u)),m=0;for(let l of f){let p=Math.hypot(l.x-n,l.y-r);p>m&&(m=p)}return{pts:f,cx:n,cy:r,radius:m,depth:o}}function Qr(e,t,n){let r=e.pts;if(r.length===1)return Math.hypot(t-r[0].x,n-r[0].y);let o=1/0;for(let i=0;i+1<r.length;i++){let a=r[i],s=r[i+1],c=s.x-a.x,u=s.y-a.y,d=c*c+u*u,f=d>1e-12?((t-a.x)*c+(n-a.y)*u)/d:0;f<0?f=0:f>1&&(f=1);let m=Math.hypot(t-(a.x+f*c),n-(a.y+f*u));m<o&&(o=m)}return o}var pn=8;function kl(e,t,n){let r=new Array(pn).fill(1/0),o=new Array(pn).fill(-1);for(let d=0;d<e.length;d++){let f=e[d],m=Math.hypot(t-f.cx,n-f.cy)-f.radius;for(let l=0;l<pn;l++)if(m<r[l]){for(let p=pn-1;p>l;p--)r[p]=r[p-1],o[p]=o[p-1];r[l]=m,o[l]=d;break}}let i=new Array(3).fill(1/0),a=new Array(3).fill(-1);for(let d of o){if(d<0)continue;let f=Qr(e[d],t,n);for(let m=0;m<3;m++)if(f<i[m]){for(let l=2;l>m;l--)i[l]=i[l-1],a[l]=a[l-1];i[m]=f,a[m]=d;break}}if(a[0]<0)return 0;if(i[0]<1e-6)return e[a[0]].depth;let s=i[0]*2.2,c=0,u=0;for(let d=0;d<3;d++){let f=a[d];if(f<0||i[d]>s)continue;let m=1/(i[d]*i[d]);c+=m*e[f].depth,u+=m}return u>0?c/u:e[a[0]].depth}function Fl(e){let t=(r,o)=>kl(e,r,o),n=(r,o)=>{let i=1/0,a=-1;for(let s=0;s<e.length;s++){let c=e[s];if(Math.hypot(r-c.cx,o-c.cy)-c.radius>=i)continue;let u=Qr(c,r,o);u<i&&(i=u,a=s)}return a};return{kind:"rows",rowCount:e.length,rows:e,nearestRow:n,depthAt:t,gradientAt:(r,o)=>{let i=(t(r+.5,o)-t(r-.5,o))/1,a=(t(r,o+.5)-t(r,o-.5))/(2*.5),s=Math.hypot(i,a);return s<1e-9?[0,0]:[i/s,a/s]}}}function Zr(e,t){let n=[];for(let r of e){let o=Ll(r.points,t);o&&n.push(o)}return n.length<2?_l(t):(n.sort((r,o)=>r.depth-o.depth),Fl(n))}var ho=mt(require("polygon-clipping"),1);var ni=mt(require("earcut"),1);var Dl=.58,Jr=.01,Ce=De*1.5*He,Ol=.5,Vl=.6;function Bl(e,t){let n=e.length,r=[];for(let a=0;a<n;a++){let s=e[Math.max(0,a-1)],c=e[Math.min(n-1,a+1)],u=c.x-s.x,d=c.y-s.y,f=Math.hypot(u,d);if(f<1e-9){r.push([0,0]);continue}u/=f,d/=f,r.push([-d,u])}let o=0;for(let a=0;a<n;a++)o+=(e[a].x-t.x)*r[a][0]+(e[a].y-t.y)*r[a][1];return o<0?r.map(([a,s])=>[-a,-s]):r}function Nl(e,t){if(e.length<2||t<=0)return[...e];let n=[...e],r=(a,s)=>{let c=s.x-a.x,u=s.y-a.y,d=Math.hypot(c,u)||1;return{x:c/d,y:u/d}},o=r(n[1],n[0]),i=r(n[n.length-2],n[n.length-1]);return n.unshift({x:n[0].x+o.x*t,y:n[0].y+o.y*t}),n.push({x:n[n.length-1].x+i.x*t,y:n[n.length-1].y+i.y*t}),n}var ei=Math.PI/12;function Gl(e){if(e.length<3)return[...e];let t=[...e].sort((i,a)=>i.x-a.x||i.y-a.y),n=(i,a,s)=>(a.x-i.x)*(s.y-i.y)-(a.y-i.y)*(s.x-i.x),r=i=>{let a=[];for(let s of i){for(;a.length>=2&&n(a[a.length-2],a[a.length-1],s)<=0;)a.pop();a.push(s)}return a.pop(),a},o=[...r(t),...r([...t].reverse())];return o.length>=3?o:[...e]}function oi(e,t){if(!e.length||!(t>0))return[];let n=Gl(e),r=(s,c,u,d)=>{let f=u-c;for(;f<0;)f+=Math.PI*2;for(;f>Math.PI*2;)f-=Math.PI*2;let m=Math.max(1,Math.ceil(f/ei)),l=t/Math.cos(f/m/2);for(let p=0;p<=m;p++){let h=c+f*p/m;d.push({x:s.x+Math.cos(h)*l,y:s.y+Math.sin(h)*l})}};if(n.length<3){let s=0,c=0;for(let l of n)s+=l.x,c+=l.y;s/=n.length||1,c/=n.length||1;let u=0;for(let l of n)u=Math.max(u,Math.hypot(l.x-s,l.y-c));let d=[],f=Math.max(3,Math.ceil(Math.PI*2/ei)),m=(u+t)/Math.cos(Math.PI/f);for(let l=0;l<f;l++){let p=l/f*Math.PI*2;d.push({x:s+Math.cos(p)*m,y:c+Math.sin(p)*m})}return d}let o=n.length,i=[];for(let s=0;s<o;s++){let c=n[s],u=n[(s+1)%o];i.push(Math.atan2(-(u.x-c.x),u.y-c.y))}let a=[];for(let s=0;s<o;s++)r(n[s],i[(s+o-1)%o],i[s],a);return ci(a)}function zl(e,t,n){if(e.length===1)return Math.hypot(t-e[0].x,n-e[0].y);let r=1/0;for(let o=0;o+1<e.length;o++){let i=e[o],a=e[o+1],s=a.x-i.x,c=a.y-i.y,u=s*s+c*c,d=u>1e-12?((t-i.x)*s+(n-i.y)*c)/u:0;d<0?d=0:d>1&&(d=1);let f=Math.hypot(t-(i.x+d*s),n-(i.y+d*c));f<r&&(r=f)}return r}function hn(e){let t=e.map(o=>{let i=0,a=0;for(let u of o.pts)i+=u.x,a+=u.y;let s=o.pts.length||1;i/=s,a/=s;let c=0;for(let u of o.pts){let d=Math.hypot(u.x-i,u.y-a);d>c&&(c=d)}return{cx:i,cy:a,rad:c}}),n=o=>{let i=o.length;return i<=2?[...o]:[o[Math.floor(i*.25)],o[Math.floor(i*.5)],o[Math.floor(i*.75)]]},r=[];for(let o=0;o<e.length;o++){let i=n(e[o].pts),a=[],s=1/0,c=null;for(let d of i){let f=1/0;for(let m=0;m<e.length;m++){if(m===o||Math.abs(e[m].y-e[o].y)<.001)continue;let l=t[m],p=Math.hypot(d.x-l.cx,d.y-l.cy)-l.rad;if(p>=f&&p>=s)continue;let h=zl(e[m].pts,d.x,d.y);h<f&&(f=h),e[m].depth<e[o].depth&&h<s&&(s=h,c=e[m].y)}Number.isFinite(f)&&f>0&&a.push(f)}a.sort((d,f)=>d-f);let u=a.length?a[Math.floor(a.length/2)]:1;r.push({pitch:u,belowY:c})}return r}function ri(e,t,n,r){let o=e[t],i=o.pts.length>=2?[...o.pts]:o.pts.length===1?(()=>{let d=o.pts[0],f=d.x-r.x,m=d.y-r.y,l=Math.hypot(f,m)||1;f/=l,m/=l;let p=Math.max(n[t].pitch,.001)*.5;return[{x:d.x+m*p,y:d.y-f*p},{x:d.x-m*p,y:d.y+f*p}]})():[];if(i.length<2)return null;let a=0,s=0;for(let d=1;d<i.length;d++){let f=Math.hypot(i[d].x-i[d-1].x,i[d].y-i[d-1].y);f>1e-6&&(a+=f,s++)}let c=s>0?a/s:0,u=Nl(i,Math.max(c*Vl,Ce));return{pts:u,nrm:Bl(u,r),front:Math.max(n[t].pitch*Dl,Ce),back:Math.max(n[t].pitch*Ol,Ce)}}var xt=1.5,ii=.3;function fo(e,t){if(e.length<3)return e;let n=e[0],r=e[e.length-1],o=r.x-n.x,i=r.y-n.y,a=Math.hypot(o,i),s=-1,c=-1;for(let f=1;f<e.length-1;f++){let m=e[f],l=a>1e-12?Math.abs((m.x-n.x)*i-(m.y-n.y)*o)/a:Math.hypot(m.x-n.x,m.y-n.y);l>s&&(s=l,c=f)}if(s<=t||c<0)return[n,r];let u=fo(e.slice(0,c+1),t),d=fo(e.slice(c),t);return[...u.slice(0,-1),...d]}function ai(e,t){if(e.length<4)return e;let n=fo([...e,e[0]],t);return n.pop(),n.length>=3?n:e}function si(e,t,n){if(e.length<2)return[];let r=n??hn(e),o=new Map;for(let a=0;a<e.length;a++){let s=o.get(e[a].blockId);s?s.push(a):o.set(e[a].blockId,[a])}let i=[];for(let[,a]of o){let s=[];for(let v of a){let S=e[v].patch;S&&S.length>=3?i.push({outline:[...S],holes:[],topY:e[v].y}):s.push(v)}if(!s.length)continue;s.sort((v,S)=>e[v].depth-e[S].depth);let u=s.map(v=>ri(e,v,r,t)).filter(v=>v!==null);if(!u.length)continue;let d=(v,S)=>({x:v.pts[S].x-v.nrm[S][0]*(v.front+xt),y:v.pts[S].y-v.nrm[S][1]*(v.front+xt)}),f=(v,S)=>({x:v.pts[S].x+v.nrm[S][0]*(v.back+xt),y:v.pts[S].y+v.nrm[S][1]*(v.back+xt)}),m=u[0],l=u[u.length-1],p=[];for(let v=0;v<m.pts.length;v++)p.push(d(m,v));for(let v of u)p.push(f(v,v.pts.length-1));for(let v=l.pts.length-1;v>=0;v--)p.push(f(l,v));for(let v=u.length-1;v>=0;v--)p.push(d(u[v],0));let h=ci(p),b=1/0;for(let v of s)e[v].y<b&&(b=e[v].y);if(!Number.isFinite(b))continue;if(h.length>=3&&Math.abs(et(h))>1e-6&&u.every(v=>{let S=v.pts[Math.floor(v.pts.length/2)];return kt(h,S.x,S.y)})){i.push({outline:ai(h,ii),holes:[],topY:b});continue}for(let v of Ul(u))i.push({outline:v,holes:[],topY:b})}return i}function Ul(e){let t=[];for(let n of e){let r=[],o=[],i=n.front+xt,a=n.back+xt;for(let c=0;c<n.pts.length;c++){let u=n.pts[c],d=n.nrm[c];r.push([u.x-d[0]*i,u.y-d[1]*i]),o.push([u.x+d[0]*a,u.y+d[1]*a])}let s=[...r,...o.reverse()];s.length<3||(s.push(s[0]),t.push([s]))}if(!t.length)return[];try{let n=ho.default.union(t[0],...t.slice(1)),r=[];for(let o of n){if(!o.length||o[0].length<4)continue;let i=o[0].map(([c,u])=>({x:c,y:u})),a=i[0],s=i[i.length-1];i.length>1&&Math.abs(a.x-s.x)<1e-9&&Math.abs(a.y-s.y)<1e-9&&i.pop(),i.length>=3&&r.push(ai(i,ii))}return r}catch{return[]}}function ci(e){let t=[];for(let n of e){let r=t[t.length-1];r&&Math.hypot(n.x-r.x,n.y-r.y)<1e-9||t.push(n)}for(;t.length>2&&Math.hypot(t[0].x-t[t.length-1].x,t[0].y-t[t.length-1].y)<1e-9;)t.pop();return t}var po=class{constructor(t){this.minX=1/0;this.minY=1/0;this.maxX=-1/0;this.maxY=-1/0;this.rings=t;for(let n of t)for(let r of n)r.x<this.minX&&(this.minX=r.x),r.y<this.minY&&(this.minY=r.y),r.x>this.maxX&&(this.maxX=r.x),r.y>this.maxY&&(this.maxY=r.y)}containsAll(t){for(let n of t)if(n.x<this.minX||n.x>this.maxX||n.y<this.minY||n.y>this.maxY)return!1;for(let n of this.rings){let r=!0;for(let o of t)if(!kt(n,o.x,o.y)){r=!1;break}if(r)return!0}return!1}};function ti(e,t,n,r,o,i){if(r.length<3)return;if(n.containsAll(r)){let u=[0,1,0],d=r[0];for(let f=1;f+1<r.length;f++){let m=r[f],l=r[f+1];e.tri([d.x*z,o,d.y*z],[m.x*z,o,m.y*z],[l.x*z,o,l.y*z],u,i)}return}let a=r.map(u=>[u.x,u.y]);a.push(a[0]);let s;try{s=ho.default.intersection([a],t)}catch{return}let c=[0,1,0];for(let u of s){if(!u.length||u[0].length<4)continue;let d=u[0],f=[],m=[];for(let p=0;p<d.length-1;p++)f.push(d[p][0],d[p][1]),m.push([d[p][0],d[p][1]]);if(m.length<3)continue;let l=(0,ni.default)(f,void 0,2);for(let p=0;p<l.length;p+=3){let h=m[l[p]],b=m[l[p+1]],y=m[l[p+2]];e.tri([h[0]*z,o,h[1]*z],[b[0]*z,o,b[1]*z],[y[0]*z,o,y[1]*z],c,i)}}}function li(e,t,n,r,o,i,a){if(t.length<2)return;let s=a??hn(t),c=[0,1,0],u=i&&i.length>=3?[[...i.map(l=>[l.x,l.y]),[i[0].x,i[0].y]]]:null,d=i&&i.length>=3?new po([[...i]]):null,f=l=>{e.setMaterial(2),l(),e.setMaterial(0)},m=l=>{e.setMaterial(3),l(),e.setMaterial(0)};for(let l=0;l<t.length;l++){let p=t[l];if(p.patch&&p.patch.length>=3){let R=[...p.patch],x=s[l].belowY??r;if(m(()=>{if(u&&d)ti(e,u,d,R,p.y,o.tread);else{let g=R[0];for(let C=1;C+1<R.length;C++){let E=R[C],D=R[C+1];e.tri([g.x*z,p.y,g.y*z],[E.x*z,p.y,E.y*z],[D.x*z,p.y,D.y*z],c,o.tread)}}}),p.y>x+Jr){let g=0,C=0;for(let E of R)g+=E.x,C+=E.y;g/=R.length,C/=R.length,f(()=>{for(let E=0;E<R.length;E++){let D=R[E],B=R[(E+1)%R.length],L=B.x-D.x,A=B.y-D.y,k=Math.hypot(L,A);if(k<1e-6)continue;let N=A/k,w=-L/k;(D.x-g)*N+(D.y-C)*w<0&&(N=-N,w=-w);let T=[N,0,w],_=[D.x*z,p.y,D.y*z],P=[B.x*z,p.y,B.y*z],O=[D.x*z,x,D.y*z],I=[B.x*z,x,B.y*z];e.tri(_,P,I,T,o.riser),e.tri(_,I,O,T,o.riser)}})}continue}let h=ri(t,l,s,n);if(!h)continue;let{pts:b,nrm:y,front:v,back:S}=h,M=s[l].belowY??r;for(let R=0;R+1<b.length;R++){let x=b[R],g=b[R+1],C=y[R],E=y[R+1];if(Math.hypot(g.x-x.x,g.y-x.y)<1e-6||C[0]===0&&C[1]===0||E[0]===0&&E[1]===0)continue;let D=[(x.x-C[0]*v)*z,p.y,(x.y-C[1]*v)*z],B=[(g.x-E[0]*v)*z,p.y,(g.y-E[1]*v)*z],L=[(x.x+C[0]*S)*z,p.y,(x.y+C[1]*S)*z],A=[(g.x+E[0]*S)*z,p.y,(g.y+E[1]*S)*z];if(m(()=>{u&&d?ti(e,u,d,[{x:x.x-C[0]*v,y:x.y-C[1]*v},{x:g.x-E[0]*v,y:g.y-E[1]*v},{x:g.x+E[0]*S,y:g.y+E[1]*S},{x:x.x+C[0]*S,y:x.y+C[1]*S}],p.y,o.tread):(e.tri(D,B,A,c,o.tread),e.tri(D,A,L,c,o.tread))}),p.y>M+Jr){let k=[D[0],M,D[2]],N=[B[0],M,B[2]],w=[-C[0],0,-C[1]];f(()=>{e.tri(D,B,N,w,o.riser),e.tri(D,N,k,w,o.riser)})}}}}function ui(e){let t=1/0,n=1/0,r=-1/0,o=-1/0,i=!1;for(let a of e)!Number.isFinite(a.x)||!Number.isFinite(a.y)||(i=!0,a.x<t&&(t=a.x),a.y<n&&(n=a.y),a.x>r&&(r=a.x),a.y>o&&(o=a.y));return i?{minX:t,minY:n,maxX:r,maxY:o}:null}function bn(e,t){return e.minX<=t.maxX&&t.minX<=e.maxX&&e.minY<=t.maxY&&t.minY<=e.maxY}var bo=mt(require("polygon-clipping"),1);function Hl(e,t){let n=e.eventConfigurationIds;return!n?.length||!!t&&n.includes(t)}function mi(e,t){return e.filter(n=>n.type!=="shape"||Hl(n,t))}function di(e,t){let n=e.focalPoint??{x:0,y:0};return e.floors?.length?e.floors.map((r,o)=>({objects:mi(r.objects,t),focal:{x:(r.focalPoint??n).x,y:(r.focalPoint??n).y},baseHeightM:r.baseHeightM??0,index:o})):[{objects:mi(e.objects,t),focal:n,baseHeightM:0,index:0}]}var jl={minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};function vt(e){return ui(e)??jl}function fi(e,t){let n=an(e.outline,Ce),r=vt(n),o=t.filter(a=>a!==e&&a.outline&&a.outline.length>=3&&bn(r,vt(a.outline)));if(!o.length)return[n];let i=a=>{let s=a.map(c=>[c.x,c.y]);return s.push(s[0]),s};try{let a=bo.default.difference([i(n)],...o.map(c=>[i(c.outline)])),s=[];for(let c of a){if(!c.length)continue;let u=c[0].map(([d,f])=>({x:d,y:f}));if(u.length>1){let d=u[0],f=u[u.length-1];Math.abs(d.x-f.x)<1e-9&&Math.abs(d.y-f.y)<1e-9&&u.pop()}u.length>=3&&s.push(u)}return s.length?s:[n]}catch{return[n]}}function pi(e,t){if(!t.length)return e;let n=i=>{let a=i.map(s=>[s.x,s.y]);return a.push(a[0]),a},r=t.map(i=>[n(i)]),o=[];for(let i of e){let a;try{a=bo.default.intersection([n(i.outline)],r.flat())}catch{o.push(i);continue}for(let s of a){if(!s.length)continue;let c=s[0].map(([u,d])=>({x:u,y:d}));if(c.length>1){let u=c[0],d=c[c.length-1];Math.abs(u.x-d.x)<1e-9&&Math.abs(u.y-d.y)<1e-9&&c.pop()}c.length>=3&&o.push({outline:c,holes:[],topY:i.topY})}}return o.length?o:e}var Yl=.05,hi=.05,Xl=.15,yo=25;function bi(e,t,n){let r=new Map,o=new Array(t.length).fill(null),i=new Float64Array(t.length),a=new Array(t.length).fill(void 0),s=new Array(t.length).fill(void 0),c=new Map,u=[],d=new Set;for(let m=0;m<e.length;m+=1){let l=e[m];for(let p of l.objects){if(p.type==="table"&&d.add(p.id),p.type!=="section"||!p.outline||p.outline.length<3)continue;let h=an(p.outline,Ce);c.set(p.id,{section:p,unit:l,frontU:1/0,hasSeats:!1,rows:new Map,seatIndices:[]}),u.push({id:p.id,floorIndex:m,box:vt(h),section:p,unit:l,outline:h})}}let f=new Map;for(let m of u){let l=f.get(m.floorIndex);l?l.push(m):f.set(m.floorIndex,[m])}for(let m=0;m<t.length;m++){let l=t[m],p=n?f.get(n[m])??[]:u,h=l.sectionId?p.find(y=>y.id===l.sectionId)??p.find(y=>y.section.logicalSectionId===l.sectionId&&ot({x:l.x,y:l.y},y.outline,y.section.holes)):void 0,b=h?[h]:p;for(let y of b){if(n&&y.floorIndex!==n[m]||!h&&(l.x<y.box.minX||l.x>y.box.maxX||l.y<y.box.minY||l.y>y.box.maxY||!ot({x:l.x,y:l.y},y.outline,y.section.holes)))continue;o[m]=y.id;let v=c.get(y.id);v.hasSeats=!0;let S=l.focalPoint??y.unit.focal,M=Math.hypot(l.x-S.x,l.y-S.y);M<v.frontU&&(v.frontU=M),v.seatIndices.push(m);let R=l.rowId||`__seat-${m}`,x=v.rows.get(R);x?x.push({x:l.x,y:l.y}):v.rows.set(R,[{x:l.x,y:l.y}]);break}}for(let[m,l]of c){let p=tn(l.section,{floorBaseHeightM:l.unit.baseHeightM}),h=l.unit.baseHeightM,b=p.rake>0?Math.tan(p.rake*Math.PI/180):0,y=p.rake<=.01&&p.height<=h+.001,v=l.section.surfaceKind,S=v==="flat"?!0:v==="rakedRows"&&p.rake>.01?!1:y,M=l.hasSeats?un(m,t,l.seatIndices,l.unit.focal):{sectionId:m,rows:[],blockCount:0},x=M.rows.length<2?Zr([...l.rows.values()].map(_=>({points:_})),l.unit.focal):null,g=1/0;if(x){if(l.hasSeats)for(let _ of l.rows.values())for(let P of _){let O=x.depthAt(P.x,P.y);O<g&&(g=O)}if(!l.hasSeats||!Number.isFinite(g)){g=1/0;for(let _ of l.section.outline){let P=x.depthAt(_.x,_.y);P<g&&(g=P)}}}let C=h+Yl,E=Math.max(C,p.height),D=_=>{let P=Math.max(0,_-g)*be,O=Math.min(P*b,yo);return Math.max(C,p.height+O)},B=_=>{let P=Math.max(0,_)*be,O=Math.min(P*b,yo);return Math.max(C,p.height+O)},L=S?[]:M.rows.map(_=>({pts:_.pts,y:B(_.blockDepth),depth:_.blockDepth,blockId:_.blockId,...d.has(_.id)?{patch:oi(_.pts,Ce)}:{}})),A=L.length?L[0].y:E,k=L.map(_=>{let P=_.patch&&_.patch.length>=3?_.patch:_.pts,O=0,I=0;for(let j of P)O+=j.x,I+=j.y;let F=P.length||1;O/=F,I/=F;let H=0;for(let j of P){let G=Math.hypot(j.x-O,j.y-I);G>H&&(H=G)}return{cx:O,cy:I,rad:H}}),N=S?()=>E:L.length>=2?(_,P)=>{let O=1/0,I=A;for(let F=0;F<L.length;F++){let H=k[F];if(Math.hypot(_-H.cx,P-H.cy)-H.rad>=O)continue;let j=L[F].patch,G=j&&j.length>=3?kt(j,_,P)?0:yt(j,_,P):yt(L[F].pts,_,P);G<O&&(O=G,I=L[F].y)}return I}:(_,P)=>x?D(x.depthAt(_,P)):E,w=[0,1,0],T=L.length>=2||S?()=>w:(_,P)=>{if(!x)return w;let O=x.depthAt(_,P);if(O<=g)return w;let I=(O-g)*be;if(I*b>=yo||p.height+I*b<=C)return w;let[F,H]=x.gradientAt(_,P);if(F===0&&H===0)return w;let j=1/Math.hypot(b,1);return[-F*b*j,j,-H*b*j]};if(!S)for(let _ of M.rows){let P=B(_.blockDepth);for(let O of _.seatIndices)a[O]=P}for(let _ of M.rows){let P=[];for(let j=1;j<_.pts.length;j++){let G=Math.hypot(_.pts[j].x-_.pts[j-1].x,_.pts[j].y-_.pts[j-1].y);G>1e-6&&P.push(G)}P.sort((j,G)=>j-G);let O=P.length?P[Math.floor(P.length/2)]:1/0,I=1/0,F=_.pts[Math.floor(_.pts.length/2)];if(F)for(let j of M.rows){if(j===_||j.blockId!==_.blockId)continue;let G=yt(j.pts,F.x,F.y);G>1e-6&&G<I&&(I=G)}let H=Math.min(O,Math.max(I,O*.5));if(Number.isFinite(H)&&H>0)for(let j of _.seatIndices)s[j]=H}r.set(m,{sectionId:m,deckAt:N,normalAt:T,flat:S,bottomY:h,rowLevels:L,landingY:A})}for(let m=0;m<t.length;m++){let l=o[m],p=t[m];if(l){let b=a[m];i[m]=(b??r.get(l).deckAt(p.x,p.y))+Xl;continue}let h=p.eyeHeightM;i[m]=Number.isFinite(h)?Math.max(0,h-Ie):0}return{bySection:r,seatOwner:o,seatDeckY:m=>i[m],seatPitchU:m=>s[m]}}var le={top:1,wallBottom:.5,bottomCap:.4};function Oe(e,t){if(!e)return t;let n=Pe(Et(e,.4),.62);return ge(t,n,.72)}function yi(e,t){let n=new Map;for(let i of e.categories??[])n.set(i.key,i.color);let r=new Map;for(let i of t){if(!i.sectionId)continue;let a=r.get(i.sectionId);a||(a=new Map,r.set(i.sectionId,a)),a.set(i.categoryKey,(a.get(i.categoryKey)??0)+1)}let o=new Map;for(let[i,a]of r){let s=0,c=0,u=0,d=0;for(let[f,m]of a){let l=ne(n.get(f));l&&(s+=l[0]*m,c+=l[1]*m,u+=l[2]*m,d+=m)}d>0&&o.set(i,[s/d,c/d,u/d])}return o}function gi(e,t){return ne(e.color)??t.get(e.logicalSectionId??e.id)??null}var xi=mt(require("polygon-clipping"),1);function Wl(e,t){return e===void 0||t===void 0?!0:Math.abs(e-t)<.001}var yn=class{constructor(){this.rings=[];this.boxes=[];this.levels=[]}subtract(t,n){let r=t.map(c=>[c.x,c.y]);if(r.length<3)return[];r.push(r[0]);let o=vt(t),i=this.rings.filter((c,u)=>bn(o,this.boxes[u])&&Wl(n,this.levels[u])),a=[[r]];if(i.length)try{a=xi.default.difference([r],...i).map(u=>u.map(d=>d.map(([f,m])=>[f,m])))}catch{a=[[r]]}this.rings.push([r]),this.boxes.push(o),this.levels.push(n);let s=[];for(let c of a){if(!c.length)continue;let u=c[0].map(([d,f])=>({x:d,y:f}));if(u.length>1){let d=u[0],f=u[u.length-1];Math.abs(d.x-f.x)<1e-9&&Math.abs(d.y-f.y)<1e-9&&u.pop()}u.length>=3&&s.push(u)}return s}};function Kl(e,t){if(!t)return e;let n=1/0,r=-1/0,o=1/0,i=-1/0;for(let f of e)n=Math.min(n,f.x),r=Math.max(r,f.x),o=Math.min(o,f.y),i=Math.max(i,f.y);let a=(n+r)/2,s=(o+i)/2,c=t*Math.PI/180,u=Math.cos(c),d=Math.sin(c);return e.map(f=>{let m=f.x-a,l=f.y-s;return{x:a+m*u-l*d,y:s+m*d+l*u}})}function rt(e){let t=null;if(e.kind==="polygon"&&e.points&&e.points.length>=3&&(t=e.points),e.kind==="rect"&&e.width&&e.height&&(t=Ot(e.x??0,e.y??0,e.width,e.height)),e.kind==="ellipse"&&e.width&&e.height){let n=(e.x??0)+e.width/2,r=(e.y??0)+e.height/2;t=sn(n,r,e.width/2,e.height/2)}return t?Kl(t,e.rotation):null}function Nt(e){let t=e.role??"",n={stage:{kind:"stage",heightM:1},entrance:{kind:"portal",heightM:2.7},exit:{kind:"portal",heightM:2.7},screen:{kind:"solid",heightM:6},wall:{kind:"solid",heightM:2.8},rail:{kind:"solid",heightM:1.1},suite:{kind:"suite",heightM:3},obstruction:{kind:"solid",heightM:4.5},sound:{kind:"solid",heightM:1.45},restroom:{kind:"solid",heightM:2.4},bar:{kind:"solid",heightM:1.1},concession:{kind:"solid",heightM:1.1},coat:{kind:"solid",heightM:1.1},goal:{kind:"portal",heightM:1.8}},r=t==="stage"&&mn(e.stageKind)?{kind:"stage",heightM:.06}:n[t]??{kind:"plate",heightM:.25};return{...r,heightM:e.heightM??r.heightM}}var ql=.08;function vi(e,t){let n=rt(e),r=Nt(e),o=r.heightM;if(!n||r.kind!=="plate"&&r.kind!=="stage")return o;let i=1/0,a=1/0,s=-1/0,c=-1/0;for(let d of n)i=Math.min(i,d.x),a=Math.min(a,d.y),s=Math.max(s,d.x),c=Math.max(c,d.y);let u=o;for(let d of t)s>d.minX&&i<d.maxX&&c>d.minY&&a<d.maxY&&u<=d.topOffsetM+1e-6&&(u=d.topOffsetM+ql);return t.push({minX:i,minY:a,maxX:s,maxY:c,topOffsetM:u}),u}function je(e,t,n){return{x:e.x+(t.x-e.x)*n,y:e.y+(t.y-e.y)*n}}function Si(e){if(e.length!==4)return e;let t=Math.hypot(e[1].x-e[0].x,e[1].y-e[0].y),n=Math.hypot(e[2].x-e[1].x,e[2].y-e[1].y);return t>=n?e:[e[1],e[2],e[3],e[0]]}function Gt(e,t,n){return[je(e[0],e[1],t),je(e[0],e[1],n),je(e[3],e[2],n),je(e[3],e[2],t)]}function Mi(e,t,n){return[je(e[0],e[3],t),je(e[1],e[2],t),je(e[1],e[2],n),je(e[0],e[3],n)]}function Ve(e,t,n,r,o,i){ue(e,t,void 0,()=>n,r,o,i,le)}var go=2.4,$l=.75,Ql=.15;function zt(e){if(e.points&&e.points.length>=3)return e.points;let{center:t,width:n,height:r,rotation:o}=e;if(!n||!r)return null;let i=(o??0)*Math.PI/180,a=Math.cos(i),s=Math.sin(i),c=n/2,u=r/2;return[[-c,-u],[c,-u],[c,u],[-c,u]].map(([d,f])=>({x:t.x+d*a-f*s,y:t.y+d*s+f*a}))}function wi(e,t,n,r,o){let i=zt(t);i&&ue(e,i,void 0,()=>n+go,n,Oe(r,o.boothTop),o.boothWall,le)}function xo(e){if(e.shape==="round"){let d=e.radius;return d?sn(e.center.x,e.center.y,d,d,24):null}let{width:t,height:n,rotation:r,center:o}=e;if(!t||!n)return null;let i=(r??0)*Math.PI/180,a=Math.cos(i),s=Math.sin(i),c=t/2,u=n/2;return[[-c,-u],[c,-u],[c,u],[-c,u]].map(([d,f])=>({x:o.x+d*a-f*s,y:o.y+d*s+f*a}))}function Pi(e,t,n,r,o){let i=xo(t);i&&ue(e,i,void 0,()=>n+$l,n,Oe(r,o.tableTop),o.tableWall,le)}function Ci(e,t,n,r,o,i,a,s){let c=rt(t);if(!c)return;let u=s?s.kind==="stage":t.role==="stage",d=s?s.kind==="screen":t.role==="screen",f=s?{kind:u?"stage":"solid",heightM:s.topY-s.baseY}:Nt(t),m=s?.baseY??n,l=s?.topY??n+r;if(u&&a){let v=1/0,S=-1/0,M=1/0,R=-1/0;for(let x of c)x.x<v&&(v=x.x),x.x>S&&(S=x.x),x.y<M&&(M=x.y),x.y>R&&(R=x.y);a.push({cx:(v+S)/2*z,cz:(M+R)/2*z,y:l,halfX:Math.max((S-v)/2*z,.5),halfZ:Math.max((R-M)/2*z,.5)})}let p=ne(t.fill),h=u&&p?ge(o.stageTop,Pe(Et(p,.18),.9),.9):Oe(p,u?o.stageTop:o.decorTop),b=d?p:null,y=u?p?ge(o.stageWall,Pe(p,.58),.82):o.stageWall:d?b?ge(Pe(b,1.42),[.24,.46,.82],.08):[.24,.46,.82]:Oe(ne(t.fill),o.decorWall);if(f.kind==="portal"&&c.length===4){let v=Si(c);Ve(e,Gt(v,0,.16),l,m,h,y),Ve(e,Gt(v,.84,1),l,m,h,y),Ve(e,v,l,Math.max(m,l-.35),h,y);return}if(f.kind==="suite"&&c.length===4){let v=c.map((R,x)=>{let g=c[(x+1)%4],C=(R.x+g.x)/2,E=(R.y+g.y)/2;return Math.hypot(C-i.x,E-i.y)}),S=v.indexOf(Math.min(...v)),M=[0,1,2,3].map(R=>c[(S+R)%4]);Ve(e,Gt(M,0,.08),l,m,h,y),Ve(e,Gt(M,.92,1),l,m,h,y),Ve(e,Mi(M,.88,1),l,m,h,y),Ve(e,M,l,Math.max(m,l-.18),h,y);return}Ve(e,c,l,m,h,y)}function vo(e){let{x:t,y:n,width:r,height:o}=e;if(!r||!o)return null;let i=t+r/2,a=n+o/2,s=(e.rotation??0)*Math.PI/180,c=Math.cos(s),u=Math.sin(s),d=r/2,f=o/2;return[[-d,-f],[d,-f],[d,f],[-d,f]].map(([m,l])=>({x:i+m*c-l*u,y:a+m*u+l*c}))}function Zl(e){if(!e||!e.startsWith("data:image/svg+xml"))return null;let t=e.slice(e.indexOf(",")+1);if(/;base64/i.test(e.slice(0,e.indexOf(","))))try{t=atob(t)}catch{return null}else try{t=decodeURIComponent(t)}catch{}let n=t.match(/<(?:rect|path)\b[^>]*\bfill="([^"]+)"/i);if(!n)return null;let r=n[1].trim();if(r==="none"||r==="transparent")return null;let o=r.match(/^url\(#([^)]+)\)$/);if(!o)return ne(r);let i=t.match(new RegExp(`<(?:linear|radial)Gradient\\b[^>]*\\bid="${o[1]}"[^>]*>([\\s\\S]*?)</(?:linear|radial)Gradient>`,"i"));if(!i)return null;let a=[];for(let s of i[1].matchAll(/stop-color="([^"]+)"/gi)){let c=ne(s[1].trim());c&&a.push(c)}return a.length?a.reduce((s,c,u)=>ge(s,c,1/(u+1)),a[0]):null}function Ai(e,t,n,r){if(t.layer==="foreground")return;let o=vo(t);if(!o)return;let i=n+Ql,a=Oe(Zl(t.href),r.decorTop),s=Math.max(0,Math.min(1,t.opacity??1));s<1&&(a=ge(r.ground,a,s)),ue(e,o,void 0,()=>i,n,a,ge(a,r.decorWall,.5),le)}function Ri(e,t,n,r,o){if(!t.points||t.points.length<3)return;let i=Oe(r,o.gaTop);ue(e,t.points,t.holes,()=>n+.15,n,i,o.gaWall,le)}var Jl=Math.PI/180,oe=96,eu=6,tu=60,nu=150,Ei=.2,ou=.35;function ru(e,t){let n=Math.atan2(t.x-e.x,t.y-e.y)/Jl;return n<0?n+360:n}function gn(e){if(!e.length)return NaN;let t=[...e].sort((n,r)=>n-r);return t[Math.floor(t.length/2)]}function xn(e,t,n=2){let r=e.length,o=new Float64Array(r);for(let i=0;i<r;i++){let a=0,s=0;for(let c=-n;c<=n;c++){let u=i+c;if(t)u=(u%r+r)%r;else if(u<0||u>=r)continue;a+=e[u],s++}o[i]=a/s}return o}function Ii(e,t){let n=e.filter(m=>m.rows.length>=1);if(n.length<1)return null;let r=[],o=0,i=0,a=0;for(let m of n)for(let l of m.rows){for(let p of l.pts)o+=p.x,i+=p.y,a++;if(l.pts.length>=4){let p=ao(l.pts);p&&Number.isFinite(p.cx)&&Number.isFinite(p.cy)&&r.push({x:p.cx,y:p.cy})}}if(!a)return null;let s={x:o/a,y:i/a},c=s;if(r.length>=8){let m=gn(r.map(y=>y.x)),l=gn(r.map(y=>y.y)),p=0;for(let y of n)for(let v of y.rows)for(let S of v.pts){let M=Math.hypot(S.x-s.x,S.y-s.y);M>p&&(p=M)}let h=0,b=p*.2;for(let y of n)for(let v of y.rows)for(let S of v.pts)Math.hypot(S.x-m,S.y-l)<b&&h++;Math.hypot(m-s.x,l-s.y)<=p&&h/a<.01&&(c={x:m,y:l})}let u=[];for(let m of n){let l={sectionId:m.sectionId,rMin:1/0,rMax:-1/0,samples:[]};for(let p of m.rows)for(let h of p.pts){let b=Math.hypot(h.x-c.x,h.y-c.y),y=Math.min(oe-1,Math.floor(ru(c,h)/(360/oe)));l.samples.push({r:b,bin:y,levelM:p.levelM}),b<l.rMin&&(l.rMin=b),b>l.rMax&&(l.rMax=b)}l.samples.length&&u.push(l)}if(!u.length)return null;u.sort((m,l)=>m.rMin+m.rMax-(l.rMin+l.rMax));let d=[];for(let m of u){let l=!1;for(let p of d){let h=Math.min(m.rMax,p.rMax)-Math.max(m.rMin,p.rMin),b=Math.min(m.rMax-m.rMin,p.rMax-p.rMin);if(b>1e-9&&h>=ou*b){p.members.push(m),p.rMin=Math.min(p.rMin,m.rMin),p.rMax=Math.max(p.rMax,m.rMax),l=!0;break}}l||d.push({members:[m],rMin:m.rMin,rMax:m.rMax})}let f=[];for(let m of d){let l=new Array(oe).fill(null);for(let A of m.members)for(let k of A.samples){let N=l[k.bin];N||(N={samples:[]},l[k.bin]=N),N.samples.push({r:k.r,levelM:k.levelM})}let p=l.map(A=>!!A);if(!p.filter(Boolean).length)continue;let b=[],y=[];for(let A of l){if(!A)continue;let k=1/0,N=-1/0;for(let w of A.samples)w.r<k&&(k=w.r),w.r>N&&(N=w.r);b.push(k),y.push(N)}let v=gn(b),S=gn(y);if(!(v>=Ei*S)||!(S>0))continue;let M=[...b].sort((A,k)=>A-k);if(!(M[Math.floor(M.length*.1)]>=Ei*S))continue;let x=l.map(A=>{if(!A)return null;let k=[...A.samples].sort((F,H)=>F.r-H.r),N=k[0].r,w=k[k.length-1].r,T=k[0].levelM,_=-1/0;for(let F of k)F.levelM>_&&(_=F.levelM);let P=[];for(let F of k){let H={r:F.r,l:F.levelM};for(;P.length&&Math.abs(P[P.length-1].r-H.r)<1e-9;){if(P[P.length-1].l<=H.l){H.skip=!0;break}P.pop()}if(!H.skip){for(;P.length>=2;){let j=P[P.length-2],G=P[P.length-1];if((G.r-j.r)*(H.l-j.l)-(G.l-j.l)*(H.r-j.r)<=0)P.pop();else break}P.push(H)}}let O=P.map(F=>F.r),I=P.map(F=>F.l);return{inner:N,outer:w,front:T,top:_,profile:{rs:O,ls:I}}}),g=p.slice();for(let A=0;A<oe;A++){if(g[A])continue;let k=-1,N=-1,w=0;for(let V=1;V<=oe;V++){let W=(A-V+oe*2)%oe;if(g[W]){k=W;break}}for(let V=1;V<=oe;V++){let W=(A+V)%oe;if(g[W]){N=W,w=V;break}}if(k<0||N<0)continue;let T=0;for(let V=1;V<=oe;V++){let W=(A-V+oe*2)%oe;if(p[W]){T=V;break}}if(T-1+w>eu)continue;let P=x[k],O=x[N],I=T/(T+w),F=P.inner+(O.inner-P.inner)*I,H=P.outer+(O.outer-P.outer)*I,j=P.front+(O.front-P.front)*I,G=P.top+(O.top-P.top)*I;x[A]={inner:F,outer:H,front:j,top:G,profile:{rs:[F,H],ls:[j,G]}}}for(let A=0;A<oe;A++)x[A]&&(g[A]=!0);let C=360/oe,E=[],D=g.filter(Boolean).length,B=[];if(D===oe)B.push({start:0,len:oe});else{let A=0;for(;g[A];)A=(A+1)%oe;let k=-1;for(let N=0;N<=oe;N++){let w=(A+N)%oe,T=N<oe&&g[w];if(T&&k<0)k=w;else if(!T&&k>=0){let _=(w-k+oe)%oe||oe;B.push({start:k,len:_}),k=-1}}}for(let A of B){if(A.len*C<tu&&A.len<oe)continue;let k=A.len===oe,N=new Float64Array(A.len),w=new Float64Array(A.len),T=new Float64Array(A.len),_=new Float64Array(A.len),P=[];for(let V=0;V<A.len;V++){let W=x[(A.start+V)%oe];N[V]=W.inner,w[V]=W.outer,T[V]=W.front,_[V]=W.top,P.push(W.profile??{rs:[W.inner,W.outer],ls:[W.front,W.top]})}let O=xn(N,k),I=xn(w,k),F=xn(T,k),H=xn(_,k);for(let V=0;V<A.len;V++)O[V]>N[V]&&(O[V]=N[V]),I[V]<w[V]&&(I[V]=w[V]),O[V]>I[V]-1e-6&&(O[V]=Math.max(0,I[V]-1e-6)),H[V]<F[V]&&(H[V]=F[V]);let j={startBin:A.start,binCount:A.len,closed:k,innerR:O,outerR:I,frontLevelM:F,topLevelM:H,profiles:P},G=(V,W,X)=>{let Q=P[V],q=Q.rs,K=Q.ls;if(W<=q[0]){K[0]>X&&(K[0]=X);return}if(W>=q[q.length-1]){K[K.length-1]>X&&(K[K.length-1]=X);return}for(let Z=0;Z+1<q.length;Z++)if(W<=q[Z+1]){K[Z]>X&&(K[Z]=X),K[Z+1]>X&&(K[Z+1]=X);return}};for(let V=0;V<A.len;V++){let W=l[(A.start+V)%oe];if(W)for(let X of W.samples){G(V,X.r,X.levelM);let Q=k?(V-1+A.len)%A.len:V-1,q=k?(V+1)%A.len:V+1;Q>=0&&G(Q,X.r,X.levelM),q<A.len&&G(q,X.r,X.levelM)}}E.push(j)}E.reduce((A,k)=>A+k.binCount*C,0)<nu||f.push({arcs:E,sectionIds:m.members.map(A=>A.sectionId),innerRMedian:v,outerRMedian:S})}if(!f.length)return null;if(f.sort((m,l)=>m.innerRMedian-l.innerRMedian),t){let m=f[f.length-1].outerRMedian;if(Math.hypot(t.x-c.x,t.y-c.y)>.9*m)return null}return{centre:c,binCount:oe,binStepDeg:360/oe,rings:f}}function Ti(e,t,n,r){let o=e.binStepDeg,i=n/o-.5-t.startBin;i=(i%e.binCount+e.binCount)%e.binCount,i>t.binCount-1&&(t.closed?i=i-t.binCount<t.binCount-i?0:t.binCount-1:i=i-(t.binCount-1)<e.binCount-i?t.binCount-1:0);let a=Math.floor(i),s=t.closed?(a+1)%t.binCount:Math.min(t.binCount-1,a+1),c=i-a,u=d=>{let f=t.profiles[d],m=f.rs,l=f.ls;if(r<=m[0])return l[0];if(r>=m[m.length-1])return l[l.length-1];for(let p=0;p+1<m.length;p++)if(r<=m[p+1]){let h=m[p+1]-m[p],b=h>1e-9?(r-m[p])/h:0;return l[p]+(l[p+1]-l[p])*b}return l[l.length-1]};return u(a)*(1-c)+u(s)*c}var iu=.25,au=1.2,su=.6,cu=.45,lu=2.3,uu=Math.PI/180;function it(e,t,n){let r=n*uu;return{x:e.x+t*Math.sin(r),y:e.y+t*Math.cos(r)}}function mu(e,t){let n=t.rings[t.rings.length-1];if(!n)return!1;let r=n.outerRMedian*.85;for(let o of e){if(o.role!=="wall")continue;let i=o.points&&o.points.length>=2?o.points:o.x!==void 0&&o.y!==void 0&&o.width!==void 0&&o.height!==void 0?[{x:o.x,y:o.y},{x:o.x+o.width,y:o.y},{x:o.x+o.width,y:o.y+o.height},{x:o.x,y:o.y+o.height}]:[];if(i.length<2)continue;let a=0;for(let s of i)Math.hypot(s.x-t.centre.x,s.y-t.centre.y)>=r&&a++;if(a>=i.length/2)return!0}return!1}var du=24;function fu(e,t,n,r,o,i,a,s){let c=n.binCount,u=du,d=be,f=i+.02,m=[];for(let L=0;L<c;L++){let A=(n.startBin+L+.5)*t.binStepDeg,k=new Float64Array(u+1);for(let N=0;N<=u;N++){let w=r[L]+(o[L]-r[L])*N/u;k[N]=Math.max(f,Ti(t,n,A,w)-iu)}m.push(k)}let l=[a.bandTop[0]*s.top,a.bandTop[1]*s.top,a.bandTop[2]*s.top],p=[a.bandTop[0]*s.bottomCap,a.bandTop[1]*s.bottomCap,a.bandTop[2]*s.bottomCap],h=[a.bandWall[0]*s.top,a.bandWall[1]*s.top,a.bandWall[2]*s.top],b=[a.bandWall[0]*s.wallBottom,a.bandWall[1]*s.wallBottom,a.bandWall[2]*s.wallBottom],y=(L,A)=>{let k=(n.startBin+L+.5)*t.binStepDeg,N=r[L]+(o[L]-r[L])*A/u,w=it(t.centre,N,k);return[w.x*d,m[L][A],w.y*d]};{let L=Math.tan(12*Math.PI/180);for(let A=0;A<6;A++){let k=!1;for(let w=0;w<c;w++)for(let T=u-1;T>=0;T--)m[w][T]>m[w][T+1]&&(m[w][T]=m[w][T+1],k=!0);let N=n.closed?c:c-1;for(let w=0;w<N;w++){let T=(w+1)%c;for(let _=0;_<=u;_++){let P=m[T][_]-m[w][_];if(Math.abs(P)>1)continue;let O=r[w]+(o[w]-r[w])*_/u,I=r[T]+(o[T]-r[T])*_/u,F=it(t.centre,O,(n.startBin+w+.5)*t.binStepDeg),H=it(t.centre,I,(n.startBin+T+.5)*t.binStepDeg),j=L*Math.hypot(H.x-F.x,H.y-F.y)*d;P>j?(m[T][_]=m[w][_]+j,k=!0):-P>j&&(m[w][_]=m[T][_]+j,k=!0)}}if(!k)break}}let v=1,S=(L,A)=>{for(let k=0;k<=u;k+=4)if(Math.abs(m[L][k]-m[A][k])>v)return!0;return Math.abs(m[L][u]-m[A][u])>v},M=Math.tan(38*Math.PI/180),R=L=>(o[L]-r[L])/u*d,x=(L,A)=>m[L][A+1]-m[L][A]>M*Math.max(1e-6,R(L)),g=(L,A)=>{let k=n.closed?(L-1+c)%c:Math.max(0,L-1),N=n.closed?(L+1)%c:Math.min(c-1,L+1);Math.abs(m[k][A]-m[L][A])>v&&(k=L),Math.abs(m[N][A]-m[L][A])>v&&(N=L);let w=Math.max(0,A-1),T=Math.min(u,A+1);w<A&&x(L,w)&&(w=A),T>A&&x(L,A)&&(T=A);let _=y(k,A),P=y(N,A),O=y(L,w),I=y(L,T),F=P[0]-_[0],H=P[1]-_[1],j=P[2]-_[2],G=I[0]-O[0],V=I[1]-O[1],W=I[2]-O[2],X=H*W-j*V,Q=j*G-F*W,q=F*V-H*G,K=Math.hypot(X,Q,q);return K>1e-12?(X/=K,Q/=K,q/=K,Q<0&&(X=-X,Q=-Q,q=-q),[X,Q,q]):[0,1,0]},C=(L,A)=>{let k=[L[0],i,L[2]],N=[A[0],i,A[2]],w=A[0]-L[0],T=A[2]-L[2],_=Math.hypot(w,T);if(!(_>1e-12))return;let P=[T/_,0,-w/_];e.tri(L,A,N,P,h,h,b),e.tri(L,N,k,P,h,b,b)},E=.05*He,D=L=>o[L]-r[L]<E,B=n.closed?c:c-1;for(let L=0;L<B;L++){let A=(L+1)%c;if(D(L)||D(A))continue;if(S(L,A)){let P=(n.startBin+L+1)*t.binStepDeg,O=(V,W)=>{let X=(r[L]+r[A])/2,Q=(o[L]+o[A])/2,q=X+(Q-X)*W/u,K=it(t.centre,q,P);return[K.x*d,m[V][W],K.y*d]};for(let V=0;V<u;V++){let W=y(L,V),X=y(L,V+1),Q=O(L,V),q=O(L,V+1),K=g(L,V),Z=g(L,V+1);e.triN(W,Q,q,K,K,Z,l),e.triN(W,q,X,K,Z,Z,l);let te=y(A,V),Me=y(A,V+1),Ae=O(A,V),Be=O(A,V+1),ke=g(A,V),Ne=g(A,V+1);e.triN(Ae,te,Me,ke,ke,Ne,l),e.triN(Ae,Me,Be,ke,Ne,Ne,l);let we=O(L,V),de=O(L,V+1),Ge=O(A,V+1),ct=O(A,V),lt=de[0]-we[0],Fe=de[2]-we[2],qe=Math.hypot(lt,Fe);if(qe>1e-12){let ut=[Fe/qe,0,-lt/qe];e.tri(we,de,Ge,ut,h),e.tri(we,Ge,ct,ut,h)}}let I=y(L,0),F=y(A,0),H=y(A,u),j=y(L,u),G=V=>[V[0],i,V[2]];e.tri(G(I),G(H),G(F),[0,-1,0],p),e.tri(G(I),G(j),G(H),[0,-1,0],p),C(I,F),C(j,H);continue}for(let P=0;P<u;P++){let O=g(L,P),I=g(A,P),F=g(A,P+1),H=g(L,P+1);if(x(L,P)||x(A,P)){let X=(de,Ge)=>{let ct=(n.startBin+de+.5)*t.binStepDeg,lt=r[de]+(o[de]-r[de])*(P+.5)/u,Fe=it(t.centre,lt,ct);return[Fe.x*d,Ge,Fe.y*d]},Q=y(L,P),q=y(A,P),K=X(L,m[L][P]),Z=X(A,m[A][P]);e.triN(Q,q,Z,O,I,I,l),e.triN(Q,Z,K,O,I,O,l);let te=y(A,P+1),Me=y(L,P+1),Ae=X(L,m[L][P+1]),Be=X(A,m[A][P+1]);e.triN(Ae,Be,te,H,F,F,l),e.triN(Ae,te,Me,H,F,H,l);let ke=Z[0]-K[0],Ne=Z[2]-K[2],we=Math.hypot(ke,Ne);if(we>1e-12){let de=[-Ne/we,0,ke/we];e.tri(K,Z,Be,de,h),e.tri(K,Be,Ae,de,h)}continue}let j=y(L,P),G=y(A,P),V=y(A,P+1),W=y(L,P+1);e.triN(j,G,V,O,I,F,l),e.triN(j,V,W,O,F,H,l)}let k=y(L,0),N=y(A,0),w=y(A,u),T=y(L,u),_=P=>[P[0],i,P[2]];e.tri(_(k),_(w),_(N),[0,-1,0],p),e.tri(_(k),_(T),_(w),[0,-1,0],p),C(k,N),C(T,w)}if(!n.closed)for(let L of[0,c-1])for(let A=0;A<u;A++)C(y(L,A),y(L,A+1))}function _i(e,t,n){let{bottomY:r,colors:o,ao:i}=n,a=new Float64Array(t.binCount).fill(-1/0);for(let d of t.rings)for(let f of d.arcs){let m=new Float64Array(f.binCount),l=new Float64Array(f.binCount);for(let h=0;h<f.binCount;h++){let b=(f.startBin+h)%t.binCount,y=Math.max(0,f.innerR[h]-Ce);m[h]=Math.max(y,a[b]+.001),l[h]=Math.max(m[h]+.001,f.outerR[h]+Ce)}let p=0;for(let h=0;h<f.binCount;h++){let b=f.topLevelM[h]-r;b>p&&(p=b)}p>=au&&fu(e,t,f,m,l,r,o,i);for(let h=0;h<f.binCount;h++){let b=(f.startBin+h)%t.binCount;l[h]>a[b]&&(a[b]=l[h])}}if(n.deriveShell===!1||mu(n.shapes,t))return;let s=t.rings[t.rings.length-1],c=su*He,u=cu*He;for(let d of s.arcs){let f=[],m=[];for(let h=0;h<d.binCount;h++){let b=(d.startBin+h+.5)*t.binStepDeg,y=d.outerR[h]+Ce+c;f.push(it(t.centre,y,b)),m.push(it(t.centre,y+u,b))}let l=-1/0;for(let h=0;h<d.binCount;h++)d.topLevelM[h]>l&&(l=d.topLevelM[h]);let p=()=>l+lu;d.closed?ue(e,m,[f.slice().reverse()],p,r,o.shellTop,o.shellWall,i):ue(e,[...m,...f.slice().reverse()],void 0,p,r,o.shellTop,o.shellWall,i)}}function Li(e,t,n,r,o,i,a,s){if(!t.outline||t.outline.length<3)return;let c=n.baseHeightM,u=Oe(r,s.tierTop);if(!o)return;let d=b=>o.deckAt(b.x,b.y),f=fi(t,a),m=f[0]??t.outline;if(o.rowLevels.length>=2){let b=hn(o.rowLevels),y=pi(si(o.rowLevels,n.focal,b),f),v=()=>[0,1,0];for(let M of y){let R=Math.max(c,M.topY-.02);for(let x of i.subtract(M.outline,R))ue(e,x,M.holes,()=>R,c,u,s.tierWall,le,void 0,v)}y.length||ue(e,m,t.holes,()=>o.landingY,c,u,s.tierWall,le);let S={tread:[u[0]*le.top,u[1]*le.top,u[2]*le.top],riser:[u[0]*.72,u[1]*.72,u[2]*.72]};for(let M of f.length?f:[m])li(e,o.rowLevels,n.focal,o.landingY,S,M,b);return}let l=o.flat?1/0:hi,p=b=>o.normalAt(b.x,b.y),h=o.flat?o.landingY:void 0;for(let b of i.subtract(m,h))ue(e,b,t.holes,d,c,u,s.tierWall,le,l,p)}function pu(e,t,n){let r=new Set;for(let a of e.objects)a.type==="section"&&r.add(a.id);let o=new Map;for(let a=0;a<t.length;a++){let s=n.seatOwner[a];if(!s||!r.has(s))continue;let c=n.bySection.get(s);if(c&&c.rowLevels.length>=2)continue;let u=t[a],d=o.get(s);d||(d=new Map,o.set(s,d));let f=u.rowId||`__seat-${a}`,m=d.get(f);m||(m={pts:[],levelM:0,n:0},d.set(f,m)),m.pts.push({x:u.x,y:u.y}),m.levelM+=n.seatDeckY(a),m.n++}let i=[];for(let a of e.objects){if(a.type!=="section")continue;let s=n.bySection.get(a.id);if(s&&s.rowLevels.length>=2){let u=s.rowLevels.filter(d=>!d.patch).map(d=>({pts:d.pts,levelM:d.y}));u.length>=2&&i.push({sectionId:a.id,rows:u});continue}let c=o.get(a.id);c&&i.push({sectionId:a.id,rows:[...c.values()].map(u=>({pts:u.pts,levelM:u.levelM/u.n}))})}return i}function ki(e,t,n,r,o,i,a=!0){let s=pu(t,n,r);if(!s.length)return;let c=Ii(s,t.focal);c&&(e.setMaterial(0),_i(e,c,{bottomY:t.baseHeightM,colors:{bandTop:Pe(o.tierTop,.8),bandWall:o.tierWall,shellTop:i??Pe(o.tierWall,1.15),shellWall:i??o.tierWall},ao:le,shapes:t.objects.filter(u=>u.type==="shape"),deriveShell:a}))}var Fi=/^[\p{L}\p{N}]{1,4}$/u,hu=/^([\p{L}\p{N}]{2,})[\s\-\u2013\u2014\u00b7_./]+(.+)$/u;function Di(e,t){let n=t?.trim();if(!n)return e;let r=e.toLocaleLowerCase("en-US"),o=n.toLocaleLowerCase("en-US");if(r.startsWith(`${o} `)){let a=e.slice(n.length).trim();if(Fi.test(a))return a}let i=hu.exec(e);if(i){let a=i[1].toLocaleLowerCase("en-US"),s=i[2].trim();if((o.startsWith(a)||a.startsWith(o))&&Fi.test(s))return s}return e}function Oi(e,t,n){return n<0?t>1?e.filter(r=>r.kind==="floor"):[...e]:e.filter(r=>r.floorIndex===void 0||r.floorIndex===n)}function Vi(e,t){let n=[...e].sort((o,i)=>o.screen.y-i.screen.y),r=[];for(let o of n){let i=r.find(a=>a.some(s=>Math.abs(s.screen.x-o.screen.x)<104&&Math.abs(s.screen.y-o.screen.y)<34));i?i.push(o):r.push([o])}return r.flatMap(o=>o.length<2?o:o.map((i,a)=>({...i,screen:{...i.screen,x:Math.max(54,Math.min(t-54,i.screen.x+(a-(o.length-1)/2)*104))}})))}var bu=1.15,yu=2.75,gu=4.5,xu=.85,vu=.5,Su=.26;function Bi(e,t,n){let r=Math.max(1e-6,t),o=e/r,i=n?.hasZoneLabels??!0,a=new Set;return o>=.75&&a.add("floor"),o>=bu&&a.add("zone"),o<=(i?yu:gu)&&(a.add("section"),a.add("ga")),o<=xu&&(a.add("annotation"),a.add("booth")),o<=vu&&a.add("row"),o<=Su&&a.add("seat"),a}function Ni(e,t,n,r,o,i=6){let a=i+t,s=r-i-t,c=i+n,u=o-i-n;return{...e,x:a>s?r/2:Math.max(a,Math.min(s,e.x)),y:c>u?o/2:Math.max(c,Math.min(u,e.y))}}function Ye(e,t,n,r){let o=e,i=t[0],a=t[1],s=t[2],c=o[0]*i+o[4]*a+o[8]*s+o[12],u=o[1]*i+o[5]*a+o[9]*s+o[13],d=o[2]*i+o[6]*a+o[10]*s+o[14],f=o[3]*i+o[7]*a+o[11]*s+o[15];if(!(f>1e-6))return{x:0,y:0,depth:1/0,visible:!1};let m=c/f,l=u/f,p=d/f,h=m>=-1.05&&m<=1.05&&l>=-1.05&&l<=1.05&&p<=1;return{x:(m*.5+.5)*n,y:(1-(l*.5+.5))*r,depth:p,visible:h}}function Gi(e,t,n=t){let r=[],o=[...e].sort((i,a)=>i.screen.depth-a.screen.depth);for(let i of o){let a=!1;for(let s of r)if(So(i,s,t,n)){a=!0;break}a||r.push(i)}return r}var Mu=6;function So(e,t,n,r){let o=Math.abs(e.screen.x-t.screen.x),i=Math.abs(e.screen.y-t.screen.y),a=e.halfWidth!=null&&t.halfWidth!=null?Math.max(n,e.halfWidth+t.halfWidth+Mu):n;return o<a&&i<r}function zi(e,t,n){return e.length*t*.58+(n?14:0)}var wu={row:8,seat:14};function Ui(e){return e<480?{row:5,seat:8}:e<768?{row:6,seat:10}:wu}function Hi(e,t,n,r){let o=Math.max(1,Math.min(n,r)*.5),i=Math.min(2,Math.hypot(e.x-n/2,e.y-r/2)/o);return t*(1+1.5*i)}function Mo(e,t,n,r,o=[]){let i=[...e].sort((s,c)=>(c.priority??0)-(s.priority??0)||s.focus-c.focus),a=[];for(let s of i){if(a.length>=r)break;let c=!1;for(let u of o)if(So(s,u,t,n)){c=!0;break}if(!c){for(let u of a)if(So(s,u,t,n)){c=!0;break}}c||a.push(s)}return a}var Pu=6,Cu=2.2,ji=.1,Au=.3,Ru=1.8,Eu=.9,Iu=.55,Tu=6e3;function Yi(e){let{doc:t,units:n,seats:r,surfaces:o,focal:i}=e,a=t.zones??[],s=[];if(a.length){let c=new Map;for(let d of n)for(let f of d.objects)f.type==="section"&&f.zone&&c.set(f.id,f.zone);let u=new Map;for(let d=0;d<r.length;d++){let f=r[d],m=o.seatOwner[d],l=f.zoneId??(m?c.get(m):void 0);if(!l)continue;let p=u.get(l);p||(p={n:0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0,sumY:0},u.set(l,p)),p.n++,f.x<p.minX&&(p.minX=f.x),f.y<p.minY&&(p.minY=f.y),f.x>p.maxX&&(p.maxX=f.x),f.y>p.maxY&&(p.maxY=f.y),p.sumY+=o.seatDeckY(d)}for(let d of a){let f=u.get(d.id),m=[];for(let[l,p]of c)p===d.id&&m.push(l);if(!f||f.n===0){s.push({id:d.id,label:d.label,color:ne(d.color),sectionIds:m,seatCount:0,center:[0,0,0],radius:0,focalWorld:[(d.focalPoint??i).x*z,1.5,(d.focalPoint??i).y*z]});continue}s.push({id:d.id,label:d.label,color:ne(d.color),sectionIds:m,seatCount:f.n,center:[(f.minX+f.maxX)/2*z,f.sumY/f.n,(f.minY+f.maxY)/2*z],radius:.5*Math.hypot((f.maxX-f.minX)*z,(f.maxY-f.minY)*z)||1,focalWorld:[(d.focalPoint??i).x*z,1.5,(d.focalPoint??i).y*z]})}}return s}function Xi(e){let{doc:t,units:n,seats:r,surfaces:o,seatData:i,hintedSeatFloor:a,zones:s,focal:c}=e,u=[],d=[],f=[];for(let m of s)m.seatCount!==0&&u.push({id:`zone:${m.id}`,kind:"zone",text:m.label,anchor:[m.center[0],m.center[1]+Pu,m.center[2]],color:t.zones?.find(l=>l.id===m.id)?.color});{let m=new Map,l=new Map;for(let p=0;p<r.length;p++){let h=o.seatOwner[p];if(!h)continue;let b=m.get(h);b||(b={n:0,x:0,y:0,deck:0},m.set(h,b)),b.n++,b.x+=r[p].x,b.y+=r[p].y,b.deck+=o.seatDeckY(p);let y=l.get(h);y||(y={minX:1/0,maxX:-1/0,minY:1/0,maxY:-1/0},l.set(h,y)),r[p].x<y.minX&&(y.minX=r[p].x),r[p].x>y.maxX&&(y.maxX=r[p].x),r[p].y<y.minY&&(y.minY=r[p].y),r[p].y>y.maxY&&(y.maxY=r[p].y)}for(let p of n)for(let h of p.objects){if(h.type!=="section")continue;let b=m.get(h.id);if(!b||b.n===0)continue;let y=l.get(h.id),v=[b.x/b.n*z,b.deck/b.n,b.y/b.n*z],S=h.displayLabel||h.label||h.id;d.push({id:h.id,floorIndex:p.index,label:S,seatCount:b.n,center:v,radius:Math.max(1,Math.hypot(y.maxX-y.minX,y.maxY-y.minY)*.5*z),focalWorld:[p.focal.x*z,p.baseHeightM+1.5,p.focal.y*z]});let M=t.floors?.[p.index]?.name?.trim().toLocaleLowerCase();n.length>1&&M===S.trim().toLocaleLowerCase()||u.push({id:`section:${h.id}`,kind:"section",text:S,anchor:[v[0],v[1]+Cu,v[2]],floorIndex:p.index})}}{for(let h of n)for(let b of h.objects){if(b.type!=="gaArea")continue;let y=Lt(b.points);if(!y)continue;let v=b.displayLabel||b.label||b.id;u.push({id:`ga:${b.id}`,kind:"ga",text:b.capacity>0?`${v} \xB7 ${b.capacity.toLocaleString()}`:v,anchor:[y.x*z,h.baseHeightM+Ru,y.y*z],floorIndex:h.index})}let m=new Map;for(let h of n)for(let b of h.objects)b.type==="section"&&m.set(b.id,b.displayLabel||b.label||b.id);let l=new Map;for(let h=0;h<r.length;h++){let b=r[h],y=Math.hypot(b.x-c.x,b.y-c.y),v=l.get(b.rowId);(!v||y>v.far)&&l.set(b.rowId,{seat:b,index:h,far:y})}for(let[h,b]of l){let y=_u(b.seat.label,h,m.get(b.seat.sectionId??""));y&&u.push({id:`row:${h}`,kind:"row",text:y,anchor:[b.seat.x*z,o.seatDeckY(b.index)+Eu,b.seat.y*z],floorIndex:a[b.index]})}let p=new Map;for(let h=0;h<r.length;h++){let b=r[h],y=b.label?b.label.lastIndexOf("-"):-1,v=p.get(b.rowId);v||(v={n:0,x:0,y:0,z:0,minX:1/0,maxX:-1/0,minZ:1/0,maxZ:-1/0,label:y>0?b.label.slice(0,y):b.rowId,sectionId:b.sectionId},p.set(b.rowId,v));let S=h*3,M=i.iPosition[S],R=i.iPosition[S+1],x=i.iPosition[S+2];v.n++,v.x+=M,v.y+=R,v.z+=x,v.minX=Math.min(v.minX,M),v.maxX=Math.max(v.maxX,M),v.minZ=Math.min(v.minZ,x),v.maxZ=Math.max(v.maxZ,x)}for(let[h,b]of p)f.push({id:h,label:b.label,sectionId:b.sectionId,seatCount:b.n,center:[b.x/b.n,b.y/b.n,b.z/b.n],radius:Math.max(.8,Math.hypot(b.maxX-b.minX,b.maxZ-b.minZ)*.5)});if(r.length<=Tu)for(let h=0;h<r.length;h++){let b=r[h],y=wo(b.displayLabel||b.label);y&&u.push({id:`seat:${b.id}`,kind:"seat",text:y,anchor:[b.x*z,o.seatDeckY(h)+Iu,b.y*z],floorIndex:a[h]})}}for(let m of n)for(let l of m.objects)if(l.type==="shape"&&l.role&&["entrance","exit","screen","suite","obstruction"].includes(l.role)){let p=rt(l),h=p?Lt(p):null;if(!h||!l.label)continue;u.push({id:`architecture:${l.id}`,kind:"annotation",text:l.label,anchor:[h.x*z,m.baseHeightM+Nt(l).heightM+ji,h.y*z],color:l.fill,floorIndex:m.index})}else if(l.type==="text"){if(!l.text)continue;u.push({id:`text:${l.id}`,kind:"annotation",text:l.text,anchor:[l.position.x*z,m.baseHeightM+ji,l.position.y*z],color:l.color,rotation:l.rotation,floorIndex:m.index})}else if(l.type==="booth"){let p=zt(l);if(!p)continue;let h=Lt(p);if(!h)continue;u.push({id:`booth:${l.id}`,kind:"booth",text:l.displayLabel||l.label||l.id,anchor:[h.x*z,m.baseHeightM+go+Au,h.y*z],floorIndex:m.index})}return{labels:u,sections:d,rows:f}}function Wi(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 wo(e){let t=e.lastIndexOf("-");return t>=0&&t<e.length-1?e.slice(t+1):e}function _u(e,t,n){let r=e?e.lastIndexOf("-"):-1,o=r>0?e.slice(0,r):t;return o&&Di(o,n)}function Ki(e){let{doc:t,units:n,seats:r,surfaces:o,solids:i,hintedSeatFloor:a,seatFloor:s}=e,c=[];{let u=n.map(()=>({minX:1/0,minY:1/0,minZ:1/0,maxX:-1/0,maxY:-1/0,maxZ:-1/0}));for(let m=0;m<i.floor.length;m+=1){let l=Math.max(0,Math.min(n.length-1,Math.round(i.floor[m]))),p=m*3,h=u[l];h.minX=Math.min(h.minX,i.position[p]),h.minY=Math.min(h.minY,i.position[p+1]),h.minZ=Math.min(h.minZ,i.position[p+2]),h.maxX=Math.max(h.maxX,i.position[p]),h.maxY=Math.max(h.maxY,i.position[p+1]),h.maxZ=Math.max(h.maxZ,i.position[p+2])}let d=new Map;for(let m=0;m<n.length;m++)for(let l of n[m].objects)l.type==="section"&&d.set(l.id,m);let f=n.map(()=>({n:0,minX:1/0,minY:1/0,minDeck:1/0,maxX:-1/0,maxY:-1/0,maxDeck:-1/0,sumX:0,sumDeck:0,sumZ:0}));for(let m=0;m<r.length;m++){let l=o.seatOwner[m],p=(l!==null?d.get(l):void 0)??a[m];if(p===void 0)continue;let h=f[p],b=r[m];h.n++,b.x<h.minX&&(h.minX=b.x),b.y<h.minY&&(h.minY=b.y),b.x>h.maxX&&(h.maxX=b.x),b.y>h.maxY&&(h.maxY=b.y);let y=o.seatDeckY(m);h.sumX+=b.x*z,h.sumDeck+=y,h.sumZ+=b.y*z,h.minDeck=Math.min(h.minDeck,y),h.maxDeck=Math.max(h.maxDeck,y+1.6),s[m]=p}for(let m=0;m<n.length;m++){let l=f[m],p=t.floors?.[m],h=u[m],b=Math.min(l.n?l.minX*z:n[m].focal.x*z-1,Number.isFinite(h.minX)?h.minX:1/0),y=Math.max(l.n?l.maxX*z:n[m].focal.x*z+1,Number.isFinite(h.maxX)?h.maxX:-1/0),v=Math.min(l.n?l.minY*z:n[m].focal.y*z-1,Number.isFinite(h.minZ)?h.minZ:1/0),S=Math.max(l.n?l.maxY*z:n[m].focal.y*z+1,Number.isFinite(h.maxZ)?h.maxZ:-1/0),M=Math.min(l.n?Math.min(n[m].baseHeightM,l.minDeck):n[m].baseHeightM,Number.isFinite(h.minY)?h.minY:1/0),R=Math.max(l.n?Math.max(l.maxDeck,M+.5):M+.5,Number.isFinite(h.maxY)?h.maxY:-1/0),x=[l.n?l.sumX/l.n:(b+y)/2,l.n?l.sumDeck/l.n:(M+R)/2,l.n?l.sumZ/l.n:(v+S)/2],g=Math.max(1,.5*Math.hypot(y-b,R-M,S-v));c.push({index:m,id:p?.id??`floor-${m}`,label:p?.name??(n.length>1?`Floor ${m+1}`:"Venue"),seatCount:l.n,center:x,radius:g,box:{min:[b,M,v],max:[y,R,S]},focalWorld:[n[m].focal.x*z,n[m].baseHeightM+1.5,n[m].focal.y*z]})}}return c}function Po(e,t){let n=1/0,r=1/0,o=-1/0,i=-1/0,a=(s,c)=>{s<n&&(n=s),c<r&&(r=c),s>o&&(o=s),c>i&&(i=c)};for(let s of t)a(s.x,s.y);for(let s of e)for(let c of s.objects)if(c.type==="section")for(let u of c.outline)a(u.x,u.y);else if(c.type==="shape"&&c.points)for(let u of c.points)a(u.x,u.y);else if(c.type==="gaArea")for(let u of c.points)a(u.x,u.y);else if(c.type==="booth"){let u=zt(c);if(u)for(let d of u)a(d.x,d.y)}else if(c.type==="table"){let u=xo(c);if(u)for(let d of u)a(d.x,d.y)}else if(c.type==="decorImage"){let u=vo(c);if(u)for(let d of u)a(d.x,d.y)}return Number.isFinite(n)||(n=-100,r=-100,o=100,i=100),{minX:n,minY:r,maxX:o,maxY:i}}function qi(e,t,n,r,o,i){if(t.length===1){let a=Math.max(60,(o.maxX-o.minX+o.maxY-o.minY)*.06),s=Ot(o.minX-a,o.minY-a,o.maxX-o.minX+a*2,o.maxY-o.minY+a*2);ue(e,s,void 0,()=>0,-.4,i.ground,i.ground,le)}else{let a=t.reduce((l,p)=>p.baseHeightM<l.baseHeightM?p:l);e.setFloor(a.index);let s=n.filter((l,p)=>r[p]===a.index),c=Po([a],s),u=Math.hypot(c.maxX-c.minX,c.maxY-c.minY),d=Math.max(28,Math.min(80,u*.04)),f=Ot(c.minX-d,c.minY-d,c.maxX-c.minX+d*2,c.maxY-c.minY+d*2),m=a.baseHeightM-.03;ue(e,f,void 0,()=>m,m-.22,i.ground,i.ground,le)}}function $i(e,t,n){let{cx:r,cz:o,radius:i}=n,a=1/0,s=1/0,c=1/0,u=-1/0,d=-1/0,f=-1/0,m=(h,b,y)=>{a=Math.min(a,h),u=Math.max(u,h),s=Math.min(s,b),d=Math.max(d,b),c=Math.min(c,y),f=Math.max(f,y)};for(let h=0;h<e.position.length;h+=3)m(e.position[h],e.position[h+1],e.position[h+2]);for(let h=0;h<t.count;h++){let b=h*3,y=t.iPosition[b],v=t.iPosition[b+1],S=t.iPosition[b+2],M=Math.max(.35,t.iMaxRadius[h]??.35);m(y-M,v,S-M),m(y+M,v+1.6,S+M)}Number.isFinite(a)||(a=r-i,u=r+i,s=0,d=i*.16,c=o-i,f=o+i);let l=[(a+u)/2,(s+d)/2,(c+f)/2],p=Math.max(1,.5*Math.hypot(u-a,d-s,f-c));return{center:l,radius:p,minY:s,maxY:d}}function Qi(e,t,n,r,o,i){let a=1/0,s=1/0,c=-1/0,u=-1/0;for(let M=0;M<e.count;M++){let R=M*3,x=e.iPosition[R],g=e.iPosition[R+2];x<a&&(a=x),x>c&&(c=x),g<s&&(s=g),g>u&&(u=g)}for(let M of t)a=Math.min(a,M.cx-M.halfX),c=Math.max(c,M.cx+M.halfX),s=Math.min(s,M.cz-M.halfZ),u=Math.max(u,M.cz+M.halfZ);let d=n.minX*z,f=n.maxX*z,m=n.minY*z,l=n.maxY*z,p=d,h=f,b=m,y=l;if(Number.isFinite(a)){let M=Math.max(2,.06*Math.hypot(c-a,u-s));p=Math.max(d,a-M),h=Math.min(f,c+M),b=Math.max(m,s-M),y=Math.min(l,u+M)}let v=Math.min(0,r),S=Math.max(o,i*.05);return{min:[p,v,b],max:[h,S,y]}}function Zi(e,t,n){let r=()=>({byObjectId:new Map,elements:[]});if(!t||!e)return r();let o=Vr(t);if(!o.ok||o.value.id!==e)return r();let i=new Map;for(let f of n)for(let m of f.objects)m.type==="shape"&&i.set(m.id,{shape:m,unit:f});let a=new Set,s=new Set,c=new Map((t.overlay.productionElements??[]).map(f=>{let m=f.runtimeContentImageUrl;return[f.id,typeof m=="string"&&/^(?:blob:|data:image\/|https:\/\/)/.test(m)?m:void 0]})),u=[];for(let f of o.value.overlay.productionElements??[]){let m=i.get(f.objectId),l=m?rt(m.shape):null,p=f.baseElevationM??0;if(!m||!l||l.length<3||!f.id||a.has(f.id)||s.has(f.objectId)||!Number.isFinite(f.heightM)||f.heightM<.05||f.heightM>50||!Number.isFinite(p)||p<-10||p>100)return r();a.add(f.id),s.add(f.objectId);let h=l.map(C=>C.x*z),b=l.map(C=>C.y*z),y=m.unit.baseHeightM+p,v=Math.min(...h),S=Math.max(...h),M=Math.min(...b),R=Math.max(...b),x,g=c.get(f.id)??f.contentImageUrl;if(f.kind==="screen"&&g)if(S-v>=R-M){let C=Math.abs(M-m.unit.focal.y*z)<=Math.abs(R-m.unit.focal.y*z)?M-.006:R+.006;x=[[v,y,C],[S,y,C],[v,y+f.heightM,C],[S,y+f.heightM,C]]}else{let C=Math.abs(v-m.unit.focal.x*z)<=Math.abs(S-m.unit.focal.x*z)?v-.006:S+.006;x=[[C,y,M],[C,y,R],[C,y+f.heightM,M],[C,y+f.heightM,R]]}u.push({id:f.id,objectId:f.objectId,kind:f.kind,floorIndex:m.unit.index,baseY:y,topY:y+f.heightM,bounds:{min:[v,y,M],max:[S,y+f.heightM,R]},occlusion:f.occlusion,...g?{contentImageUrl:g}:{},...x?{contentPlane:x}:{}})}let d=u.sort((f,m)=>f.id.localeCompare(m.id));return{byObjectId:new Map(d.map(f=>[f.objectId,f])),elements:d}}function ve(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function xe(e){return Array.isArray(e)?e:[]}function Lu(e){let t=[e];for(;t.length;){let n=t.pop();if(Array.isArray(n)){t.push(...n);continue}if(!ve(n))continue;let r=ve(n.extensions)?n.extensions:null;if(r&&Object.prototype.hasOwnProperty.call(r,"KHR_draco_mesh_compression"))return!0;t.push(...Object.values(n))}return!1}function vn(e,t){return!Array.isArray(e)||e.length!==t||!e.every(n=>typeof n=="number"&&Number.isFinite(n))?null:e}function ku(){return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}function Fu(e,t){let n=new Array(16).fill(0);for(let r=0;r<4;r++)for(let o=0;o<4;o++)for(let i=0;i<4;i++)n[r*4+o]+=e[i*4+o]*t[r*4+i];return n}function Du(e){let t=vn(e.matrix,16);if(t)return t;if(e.matrix!==void 0)return null;let n=e.translation===void 0?[0,0,0]:vn(e.translation,3),r=e.rotation===void 0?[0,0,0,1]:vn(e.rotation,4),o=e.scale===void 0?[1,1,1]:vn(e.scale,3);if(!n||!r||!o)return null;let[i,a,s,c]=r,u=Math.hypot(i,a,s,c);if(!(u>1e-8))return null;let d=i/u,f=a/u,m=s/u,l=c/u,p=d+d,h=f+f,b=m+m,y=d*p,v=d*h,S=d*b,M=f*h,R=f*b,x=m*b,g=l*p,C=l*h,E=l*b;return[(1-(M+x))*o[0],(v+E)*o[0],(S-C)*o[0],0,(v-E)*o[1],(1-(y+x))*o[1],(R+g)*o[1],0,(S+C)*o[2],(R-g)*o[2],(1-(y+M))*o[2],0,n[0],n[1],n[2],1]}function Ou(e,t,n,r){return[e[0]*t+e[4]*n+e[8]*r+e[12],e[1]*t+e[5]*n+e[9]*r+e[13],e[2]*t+e[6]*n+e[10]*r+e[14]]}function Vu(e){let t=e[0],n=e[4],r=e[8],o=e[1],i=e[5],a=e[9],s=e[2],c=e[6],u=e[10],d=i*u-a*c,f=a*s-o*u,m=o*c-i*s,l=t*d+n*f+r*m;if(Math.abs(l)<1e-12)return null;let p=1/l;return[d*p,f*p,m*p,(r*c-n*u)*p,(t*u-r*s)*p,(n*s-t*c)*p,(n*a-r*i)*p,(r*o-t*a)*p,(t*i-n*o)*p]}function Ji(e,t,n,r){let o=e[0]*t+e[1]*n+e[2]*r,i=e[3]*t+e[4]*n+e[5]*r,a=e[6]*t+e[7]*n+e[8]*r,s=Math.hypot(o,i,a)||1;return o/=s,i/=s,a/=s,[o,i,a]}function Bu(e){if(e.byteLength<20||e.byteLength>8388608)return null;let t=new DataView(e.buffer,e.byteOffset,e.byteLength);if(t.getUint32(0,!0)!==1179937895||t.getUint32(4,!0)!==2||t.getUint32(8,!0)!==e.byteLength)return null;let n=12,r=null,o=null;for(;n+8<=e.byteLength;){let i=t.getUint32(n,!0),a=t.getUint32(n+4,!0);if(n+=8,i%4!==0||n+i>e.byteLength)return null;let s=e.subarray(n,n+i);if(a===1313821514&&!r)try{let c=JSON.parse(new TextDecoder().decode(s).replace(/[\u0000 ]+$/g,""));if(!ve(c))return null;r=c}catch{return null}else if(a===5130562&&!o)o=s;else return null;n+=i}return n===e.byteLength&&r&&o?{json:r,bin:o}:null}function Nu(e){return e===5120||e===5121?1:e===5122||e===5123?2:e===5125||e===5126?4:0}function Gu(e){return e==="SCALAR"?1:e==="VEC2"?2:e==="VEC3"?3:e==="VEC4"?4:0}function zu(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 Uu(e){let t=e instanceof Uint8Array?e:new Uint8Array(e),n=Bu(t);if(!n)return{ok:!1,issue:"invalid_glb"};let{json:r,bin:o}=n;if(!ve(r.asset)||r.asset.version!=="2.0")return{ok:!1,issue:"unsupported_glb"};let i=xe(r.extensionsUsed).filter(M=>typeof M=="string");if(i.includes("KHR_draco_mesh_compression")||Lu(r))return{ok:!1,issue:"draco_not_allowed"};if(i.length||xe(r.extensionsRequired).length)return{ok:!1,issue:"unsupported_glb"};if(xe(r.images).length||xe(r.textures).length)return{ok:!1,issue:"external_resource"};let a=xe(r.buffers);if(a.length!==1||!ve(a[0])||a[0].uri!==void 0||typeof a[0].byteLength!="number"||!Number.isInteger(a[0].byteLength)||a[0].byteLength<0||a[0].byteLength>o.byteLength)return{ok:!1,issue:"external_resource"};let s=xe(r.accessors),c=xe(r.bufferViews),u=xe(r.meshes),d=xe(r.nodes),f=xe(r.scenes),m=typeof r.scene=="number"?r.scene:0;if(!ve(f[m]))return{ok:!1,issue:"unsupported_glb"};let l=new DataView(o.buffer,o.byteOffset,o.byteLength),p=(M,R,x)=>{if(typeof M!="number"||!Number.isInteger(M)||!ve(s[M]))return null;let g=s[M];if(g.type!==R||g.sparse!==void 0||g.normalized===!0||typeof g.count!="number"||!Number.isInteger(g.count)||g.count<1||typeof g.componentType!="number"||!x.includes(g.componentType)||typeof g.bufferView!="number")return null;let C=c[g.bufferView];if(!ve(C)||C.buffer!==0||typeof C.byteLength!="number"||!Number.isInteger(C.byteLength)||C.byteLength<0)return null;let E=Gu(g.type),D=Nu(g.componentType),B=typeof C.byteStride=="number"?C.byteStride:E*D,L=typeof C.byteOffset=="number"?C.byteOffset:0,A=typeof g.byteOffset=="number"?g.byteOffset:0,k=L+A,N=A+(g.count-1)*B+E*D;if(!Number.isInteger(B)||!Number.isInteger(L)||!Number.isInteger(A)||B<E*D||L<0||A<0||L+C.byteLength>o.byteLength||N>C.byteLength)return null;let w=[];for(let T=0;T<g.count;T++){let _=[];for(let P=0;P<E;P++){let O=zu(l,k+T*B+P*D,g.componentType);if(!Number.isFinite(O))return null;_.push(O)}w.push(_)}return w},h=[],b=[],y=0,v=new Set,S=(M,R)=>{if(typeof M!="number"||!Number.isInteger(M)||!ve(d[M])||v.has(M))return!1;v.add(M);let x=d[M],g=Du(x);if(!g)return!1;let C=Fu(R,g),E=Vu(C);if(!E)return!1;if(x.mesh!==void 0){if(typeof x.mesh!="number")return!1;let D=u[x.mesh];if(!ve(D))return!1;for(let B of xe(D.primitives)){if(!ve(B)||B.mode!==void 0&&B.mode!==4||!ve(B.attributes))return!1;let L=p(B.attributes.POSITION,"VEC3",[5126]),A=B.attributes.NORMAL===void 0?null:p(B.attributes.NORMAL,"VEC3",[5126]);if(!L||B.attributes.NORMAL!==void 0&&!A)return!1;let k=L.length;if(B.indices!==void 0){let w=typeof B.indices=="number"?s[B.indices]:null;k=ve(w)?w.count:void 0}if(typeof k!="number"||!Number.isInteger(k)||k%3!==0||(y+=k/3,y>1e5))return!1;let N=B.indices===void 0?L.map((w,T)=>[T]):p(B.indices,"SCALAR",[5121,5123,5125]);if(!N||N.length%3!==0||N.length!==k)return!1;for(let w=0;w<N.length;w+=3){let T=[N[w][0],N[w+1][0],N[w+2][0]];if(T.some(O=>!Number.isInteger(O)||O<0||O>=L.length))return!1;let _=T.map(O=>Ou(C,...L[O])),P=null;if(!A){let O=_[1][0]-_[0][0],I=_[1][1]-_[0][1],F=_[1][2]-_[0][2],H=_[2][0]-_[0][0],j=_[2][1]-_[0][1],G=_[2][2]-_[0][2];P=Ji([1,0,0,0,1,0,0,0,1],I*G-F*j,F*H-O*G,O*j-I*H)}for(let O=0;O<3;O++)h.push(..._[O]),b.push(...A?Ji(E,...A[T[O]]):P)}}}for(let D of xe(x.children))if(!S(D,C))return!1;return v.delete(M),!0};for(let M of xe(f[m].nodes))if(!S(M,ku()))return{ok:!1,issue:y>1e5?"triangle_limit":"unsupported_glb"};return!y||h.length!==y*9||b.length!==h.length?{ok:!1,issue:"unsupported_glb"}:{ok:!0,triangleCount:y,position:new Float32Array(h),normal:new Float32Array(b)}}function ea(e){try{return Uu(e)}catch{return{ok:!1,issue:"invalid_glb"}}}function St(e){let{doc:t}=e,n=Cr(t.theme),r=n.structure,o=di(t,e.eventConfigurationId??t.eventConfigurationId),i=Zi(e.eventConfigurationId,e.eventConfiguration,o),a=e.seats,s=new rn,c=null;if(e.registeredShellGlb){let w=ea(e.registeredShellGlb);if(w.ok){let T=w.position.length/3,_=new Float32Array(w.position.length),P=n.materials.shell??r.tierWall;for(let O=0;O<T;O++){let I=w.normal[O*3+1],F=I<-.25?.4:.62+.38*Math.max(0,I);_[O*3]=P[0]*F,_[O*3+1]=P[1]*F,_[O*3+2]=P[2]*F}c={position:w.position,normal:w.normal,color:_,floor:new Float32Array(T).fill(-2),material:new Float32Array(T),count:T}}}let u=new Map;for(let w of o)for(let T of w.objects)u.set(T.id,w.index),T.type==="section"&&u.set(T.logicalSectionId??T.id,w.index);let d=a.map(w=>u.get(w.sectionId??"")??u.get(w.rowId??"")??0),f=Po(o,a);qi(s,o,a,d,f,r);let m=yi(t,a),l=new Map,p=new Map;for(let w of t.categories??[])l.set(w.key,w.color),w.seatGlyph&&p.set(w.key,w.seatGlyph);let h=[],b=bi(o,a,d),y=new Float32Array(a.length),v=[];for(let w=0;w<o.length;w++){let T=o[w];s.setFloor(w);let _=new yn,P=[],O=T.objects.filter(I=>I.type==="section"&&!!I.outline&&I.outline.length>=3);for(let I of T.objects)if(I.type==="section"){let F=s.vertexCount;Li(s,I,T,gi(I,m),b.bySection.get(I.id),_,O,r);let H=s.vertexCount-F;H>0&&v.push({sectionId:I.id,start:F,count:H})}else if(I.type==="shape"){let F=i.byObjectId.get(I.id);s.setMaterial((F?.kind??I.role)==="screen"?1:0),Ci(s,I,T.baseHeightM,vi(I,P),r,T.focal,h,F),s.setMaterial(0)}else I.type==="gaArea"?Ri(s,I,T.baseHeightM,ne(l.get(I.categoryKey)),r):I.type==="booth"?wi(s,I,T.baseHeightM,ne(l.get(I.categoryKey)),r):I.type==="table"?Pi(s,I,T.baseHeightM,ne(I.fill??t.theme?.decorFill??"#232c40"),r):I.type==="decorImage"&&Ai(s,I,T.baseHeightM,r);ki(s,T,a,b,r,n.materials.shell,!c)}let S=o.length>1?{x:o.reduce((w,T)=>w+T.focal.x,0)/o.length,y:o.reduce((w,T)=>w+T.focal.y,0)/o.length}:t.focalPoint??{x:(f.minX+f.maxX)/2,y:(f.minY+f.maxY)/2},M=pr(c?[s.build(),c]:[s.build()]),R=wr(a,e.initialState,b,y,l,p),x=Yi({doc:t,units:o,seats:a,surfaces:b,focal:S}),{labels:g,sections:C,rows:E}=Xi({doc:t,units:o,seats:a,surfaces:b,seatData:R,hintedSeatFloor:d,zones:x,focal:S}),D=Ki({doc:t,units:o,seats:a,surfaces:b,solids:M,hintedSeatFloor:d,seatFloor:y});Wi(g,D),R.iYaw=Sr(R.iPosition,a.length,w=>a[w].rowId,w=>{let T=o[y[w]]?.focal??S;return[T.x*z,T.y*z]});let B=(f.minX+f.maxX)/2*z,L=(f.minY+f.maxY)/2*z,A=.5*Math.hypot((f.maxX-f.minX)*z,(f.maxY-f.minY)*z)||10,k=$i(M,R,{cx:B,cz:L,radius:A}),N=Qi(R,h,f,k.minY,k.maxY,A);return{solids:M,sectionSolidRanges:v,seats:R,bounds:{center:[(N.min[0]+N.max[0])/2,(N.min[1]+N.max[1])/2,(N.min[2]+N.max[2])/2],radius:A,groundY:0,box:N},renderBounds:{center:k.center,radius:k.radius},stateColorLUT:Ar(n,pe),theme:n,seatCount:a.length,focalWorld:[S.x*z,1.5,S.y*z],zones:x,stages:h,productionElements:i.elements,sections:C,rows:E,labels:g,floors:D}}var Hu=88,ju=20,ta={floor:{size:14,weight:"700",opacity:.98},zone:{size:15,weight:"600",opacity:.95},section:{size:12,weight:"500",opacity:.88},ga:{size:12,weight:"500",opacity:.88},booth:{size:11,weight:"500",opacity:.85},annotation:{size:11,weight:"400",opacity:.75},row:{size:11.5,weight:"700",opacity:.94},seat:{size:12.5,weight:"800",opacity:1}},Yu=640,Xu=.8,Wu=11,Ku="3px 7px",qu="2px 5px",na="rgba(10,14,22,.62)",$u="#f4f7fb",oa=5,ra=2,Qu=6,Ut=new Set(["row","seat"]),ia={floor:5,zone:4,section:3,ga:3,booth:2,annotation:1},Sn={row:{x:66,y:20},seat:{x:52,y:22}},Ao=ne,Co=e=>jo(e);function Ro(e,t){let n=Co(e),r=Co(t);return(Math.max(n,r)+.05)/(Math.min(n,r)+.05)}function Eo(e,t){let n=/rgba\((\d+),(\d+),(\d+),([\d.]+)\)/.exec(e.replace(/\s/g,""));if(!n)return t;let r=Math.max(0,Math.min(1,Number(n[4])));return[1,2,3].map(o=>Number(n[o])/255*r+t[o-1]*(1-r))}function Zu(e,t=[.04,.06,.1],n=!0){let r=Co(t)<.42,o=r?"#f4f7fb":"#0b1220",i=r?"rgba(8,12,22,.78)":"rgba(255,255,255,.84)",a=n?Eo(i,t):t,s=Ao(e),c=n?7:4.5,u=s&&Ro(s,a)>=c?e:o;return r?{ink:u,backing:i,border:"rgba(210,222,245,.24)"}:{ink:u,backing:i,border:"rgba(11,18,32,.22)"}}function Ju(e,t=[.04,.06,.1]){let n=Eo(na,t),r=Ao(e);return{ink:r&&Ro(r,n)>=4.5?e:$u,backing:na}}var em='ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif',Mn=class{constructor(t,n={}){this.nodes=new Map;this.labels=[];this.forcedDense=!1;this.selectedSeatLabelIds=new Set;this.narrowStage=!1;this.opts=n,this.root=document.createElement("div"),this.root.setAttribute("data-view3d-labels","");let r=this.root.style;r.position="absolute",r.inset="0",r.pointerEvents="none",r.overflow="hidden",r.fontFamily=n.fontFamily||em,t.appendChild(this.root)}setVisible(t){this.root.style.visibility=t?"":"hidden"}setLabels(t){this.labels=t;for(let[n,r]of this.nodes)t.some(o=>o.id===n)||(r.remove(),this.nodes.delete(n))}setForcedDense(t){this.forcedDense=t}setSelectedSeatIds(t){this.selectedSeatLabelIds=new Set(Array.from(t,n=>`seat:${n}`))}sizeFor(t){let n=ta[t].size;return!this.narrowStage||Ut.has(t)?n:Math.max(Wu,n*Xu)}qualityEvidence(){let t=this.root.getBoundingClientRect(),n=this.root.style.visibility!=="hidden";return this.labels.map(r=>{let o=this.nodes.get(r.id),i=o?.getBoundingClientRect(),a=!!(n&&o&&o.style.display!=="none"&&i&&i.width>0&&i.height>0);return{id:r.id,kind:r.kind,text:r.text,visible:a,renderedFontPx:o&&Number.parseFloat(o.style.fontSize)||0,contrast:o?Number(o.dataset.qualityContrast??0):0,...a&&i?{screenBox:{x:i.x-t.x,y:i.y-t.y,width:i.width,height:i.height}}:{}}})}update(t,n,r,o,i,a){if(!this.labels.length)return;this.narrowStage=n>0&&n<Yu;let s=Bi(o,i,{hasZoneLabels:this.labels.some(S=>S.kind==="zone")});this.forcedDense&&(s.add("row"),s.add("seat"));let c=[];for(let S of this.labels){if(!s.has(S.kind))continue;let M=Ye(t,S.anchor,n,r);if(!M.visible)continue;let R=Ut.has(S.kind),x=this.sizeFor(S.kind),g=zi(S.text,x,!R)+(R?oa*2:0),C=Ni(M,g/2,x/2+(R?ra:4),n,r),E=a?Math.hypot(S.anchor[0]-a[0],S.anchor[1]-a[1],S.anchor[2]-a[2]):1;c.push({label:S,screen:C,focus:Hi(C,E,n,r),halfWidth:g/2,...this.selectedSeatLabelIds.has(S.id)?{priority:1}:{}})}let u=Vi(c.filter(S=>S.label.kind==="floor"),n),d=[...c.filter(S=>!Ut.has(S.label.kind)&&S.label.kind!=="floor"),...u],f=Gi(d,Hu,ju),m=Ui(n),l=Mo(c.filter(S=>S.label.kind==="row"),Sn.row.x,Sn.row.y,m.row,f),p=Mo(c.filter(S=>S.label.kind==="seat"),Sn.seat.x,Sn.seat.y,m.seat,[...f,...l]),h=[...f,...l,...p],b=new Set(h.map(S=>S.label.id));for(let{label:S,screen:M}of h){let x=this.nodeFor(S).style;x.display="",x.transform=`translate(-50%, -50%) translate(${M.x.toFixed(1)}px, ${M.y.toFixed(1)}px)`}let y=h.filter(({label:S})=>!Ut.has(S.kind)).sort((S,M)=>ia[M.label.kind]-ia[S.label.kind]||S.screen.depth-M.screen.depth||S.focus-M.focus),v=[];for(let{label:S}of y){let M=this.nodes.get(S.id);if(!M||M.style.display==="none")continue;let R=M.getBoundingClientRect();v.some(g=>R.left<g.right+3&&R.right+3>g.left&&R.top<g.bottom+3&&R.bottom+3>g.top)?M.style.display="none":v.push(R)}for(let[S,M]of this.nodes)b.has(S)||(M.style.display="none")}nodeFor(t){let n=this.nodes.get(t.id);if(!n){n=document.createElement("div");let p=n.style;p.position="absolute",p.left="0",p.top="0",p.whiteSpace="nowrap",p.textShadow="0 1px 3px rgba(0,0,0,0.85), 0 0 8px rgba(0,0,0,0.55)",p.display="none",this.root.appendChild(n),this.nodes.set(t.id,n)}n.textContent=t.text,n.setAttribute("data-label-kind",t.kind);let r=this.selectedSeatLabelIds.has(t.id);n.toggleAttribute("data-selected-seat",r);let o=ta[t.kind],i=n.style;i.fontSize=`${this.sizeFor(t.kind)}px`,i.fontWeight=r?"800":o.weight,i.opacity=r?"1":String(o.opacity);let a=Ut.has(t.kind),s=!a,c=Zu(t.color??this.opts.ink,this.opts.backgroundRgb,!0),u=a?Ju(t.color??this.opts.ink,this.opts.backgroundRgb):c;i.color=r?"#ecf8ff":u.ink,i.background=r?"rgba(10,28,45,.9)":u.backing,i.border=r?"1px solid rgba(89,199,255,.92)":s?`1px solid ${c.border}`:"",i.borderRadius=r||s?"999px":`${Qu}px`;let d=this.narrowStage?qu:Ku;i.padding=r||s?d:`${ra}px ${oa}px`,i.lineHeight=a?"1.1":"",i.boxShadow=r?"0 0 0 2px rgba(41,176,255,.18), 0 5px 14px rgba(0,0,0,.35)":s?"0 3px 10px rgba(0,0,0,.24)":"0 1px 4px rgba(0,0,0,.28)",i.letterSpacing=t.kind==="zone"||t.kind==="floor"?"0.08em":"0.02em";let f=this.opts.backgroundRgb??[.04,.06,.1],m=Ao(r?"#ecf8ff":u.ink)??[1,1,1],l=Eo(r?"rgba(10,28,45,.9)":u.backing,f);return n.dataset.qualityContrast=Ro(m,l).toFixed(3),(t.kind==="zone"||t.kind==="floor")&&(i.textTransform="uppercase"),n}dispose(){this.root.remove(),this.nodes.clear()}};var sa=1;var tm=new Set(["floor","zone","section","ga","booth","annotation"]);function nm(e){return e.every(t=>Number.isFinite(t))}function om(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 aa(e){return e.length?Math.round(Math.min(...e)*100)/100:null}function at(e){return Math.round(e*1e4)/1e4}function rm(e){if(e)return{box:{x:at(e.box.x),y:at(e.box.y),width:at(e.box.width),height:at(e.box.height)},horizontalFillRatio:at(e.horizontalFillRatio),verticalFillRatio:at(e.verticalFillRatio),visibleAreaRatio:at(e.visibleAreaRatio),clippedEdges:[...e.clippedEdges]}}function Te(e,t,n){return n.length?{code:e,message:t,count:n.length,samples:n.slice(0,20)}:null}function wn(e){let t=e.labels.filter(s=>s.visible&&s.screenBox),n=t.filter(s=>tm.has(s.kind)),r=e.scene.floorCount>1?e.scene.floorCount:e.scene.zoneCount||e.scene.sectionCount,o=[];for(let s=0;s<n.length;s+=1)for(let c=0;c<s;c+=1)om(n[s].screenBox,n[c].screenBox)&&o.push({primaryId:n[s].id,primaryLabel:n[s].text,secondaryId:n[c].id});let i=[...e.camera.position,e.camera.distance,e.camera.verticalFovDeg],a=[Te("webgl2-unavailable","The venue scene must render through WebGL2",e.context.webgl2?[]:[{primaryId:"renderer",primaryLabel:"WebGL2"}]),Te("context-lost","The WebGL context must be live at capture",e.context.lost?[{primaryId:"renderer",primaryLabel:"context lost"}]:[]),Te("frame-not-stable","The captured 3D frame must be rendered and parked",e.frame.rendered>0&&e.frame.idle?[]:[{primaryId:"renderer",primaryLabel:"unstable frame"}]),Te("viewport-empty","The 3D viewport must have visible dimensions",e.viewport.width>1&&e.viewport.height>1?[]:[{primaryId:"viewport",primaryLabel:`${e.viewport.width}\xD7${e.viewport.height}`}]),Te("camera-invalid","The capture camera must have a finite physical pose",nm(i)&&e.camera.distance>0&&e.camera.verticalFovDeg>0&&e.camera.verticalFovDeg<180?[]:[{primaryId:"camera",primaryLabel:"invalid pose"}]),Te("authored-relief-not-visible","Authored 3D height or rake must produce visible screen-space relief",!e.scene.authoredRelief||e.scene.renderedVerticalSpanM>.05&&e.scene.projectedReliefPx>=2?[]:[{primaryId:"scene",primaryLabel:"authored relief",measured:e.scene.projectedReliefPx,minimum:2}]),Te("hierarchy-label-missing","A venue with authored hierarchy must show at least one structural label",r===0||n.length>0?[]:[{primaryId:"labels",primaryLabel:`${r} expected hierarchy labels`}]),Te("hierarchy-label-undersized","Visible 3D hierarchy labels must remain readable",n.filter(s=>s.renderedFontPx<11).map(s=>({primaryId:s.id,primaryLabel:s.text,measured:s.renderedFontPx,minimum:11}))),Te("hierarchy-label-contrast-low","Visible 3D hierarchy labels must meet text contrast",n.filter(s=>s.contrast<4.5).map(s=>({primaryId:s.id,primaryLabel:s.text,measured:s.contrast,minimum:4.5}))),Te("hierarchy-label-collision","Visible 3D hierarchy labels must not overlap",o)].filter(s=>!!s);return{version:1,state:"venue3d",passed:a.length===0,resolvedRules:["rendered-3d-webgl-context","rendered-3d-stable-frame","rendered-3d-camera-pose","rendered-3d-relief-projection","rendered-3d-label-size","rendered-3d-label-contrast","rendered-3d-label-collision"],viewport:e.viewport,context:e.context,frame:e.frame,camera:e.camera,scene:e.scene,composition:{visibleLabels:t.map(({id:s,kind:c,text:u})=>({id:s,kind:c,text:u})).sort((s,c)=>s.kind.localeCompare(c.kind)||s.id.localeCompare(c.id)),framing:rm(e.framing)},metrics:{minimumHierarchyFontPx:aa(n.map(s=>s.renderedFontPx)),minimumHierarchyContrast:aa(n.map(s=>s.contrast)),projectedReliefPx:Math.round(e.scene.projectedReliefPx*100)/100},findings:a}}var ce=require("ogl");var Xe=require("ogl");var Pn=`
21
21
  float chairWeight(float depth) {
22
22
  return 1.0 - smoothstep(uChairFull, uChairNone, depth);
23
- }`,sa=`
23
+ }`,ca=`
24
24
  float occupantWeight(float depth) {
25
- float nearWeight = smoothstep(${Jo.toFixed(1)}, ${er.toFixed(1)}, depth);
26
- float farWeight = 1.0 - smoothstep(${Qo.toFixed(1)}, ${Zo.toFixed(1)}, depth);
25
+ float nearWeight = smoothstep(${er.toFixed(1)}, ${tr.toFixed(1)}, depth);
26
+ float farWeight = 1.0 - smoothstep(${Zo.toFixed(1)}, ${Jo.toFixed(1)}, depth);
27
27
  return nearWeight * farWeight;
28
- }`,ca=`
28
+ }`,la=`
29
29
  float glyphEq(float glyph, float expected) {
30
30
  return 1.0 - step(0.25, abs(glyph - expected));
31
31
  }
@@ -74,7 +74,7 @@ vec3 glyphChairPosition(vec3 p, float partId, float glyph) {
74
74
  p.y += 0.16;
75
75
  }
76
76
  return p;
77
- }`,rm=`#version 300 es
77
+ }`,im=`#version 300 es
78
78
  precision highp float;
79
79
  in vec3 position;
80
80
  in vec3 normal;
@@ -112,7 +112,7 @@ void main() {
112
112
  vNormalWorld = normalize(mat3(modelMatrix) * normal);
113
113
  vColor = color;
114
114
  gl_Position = projectionMatrix * mv;
115
- }`,im=`#version 300 es
115
+ }`,am=`#version 300 es
116
116
  precision highp float;
117
117
  in vec3 vColor;
118
118
  in vec3 vNormalWorld;
@@ -185,7 +185,7 @@ void main() {
185
185
  + vec3(0.20, 0.10, 0.34) * focalHalo;
186
186
  base = mix(base, display, poweredDisplay * verticalFace * 0.92);
187
187
  fragColor = vec4(base, 1.0);
188
- }`,am=`#version 300 es
188
+ }`,sm=`#version 300 es
189
189
  precision highp float;
190
190
  in vec2 position; // quad corner in [-1,1]
191
191
  in vec3 iOffset; // per-instance world position
@@ -244,7 +244,7 @@ void main() {
244
244
  vPhysicalSeat = iPhysicalSeat;
245
245
  vDim = (uFocusFloor < -0.5 || abs(iFloor - uFocusFloor) < 0.5) ? 0.0 : 1.0;
246
246
  gl_Position = projectionMatrix * mv;
247
- }`,sm=`#version 300 es
247
+ }`,cm=`#version 300 es
248
248
  precision highp float;
249
249
  in vec2 vUv;
250
250
  in vec3 vColor;
@@ -303,7 +303,7 @@ void main() {
303
303
  alpha *= vDotWeight;
304
304
  if (alpha <= 0.0) discard;
305
305
  fragColor = vec4(c, alpha);
306
- }`,cm=`#version 300 es
306
+ }`,lm=`#version 300 es
307
307
  precision highp float;
308
308
  in vec3 position; // local: x/z in units of the seat radius, y in METRES
309
309
  in vec3 normal;
@@ -335,8 +335,8 @@ out float vDim;
335
335
  out float vOccupant; // 1 = this vertex belongs to a person, not to the chair
336
336
  out vec3 vOccupantTint;
337
337
  ${Pn}
338
- ${sa}
339
338
  ${ca}
339
+ ${la}
340
340
  void main() {
341
341
  vec4 anchor = modelViewMatrix * vec4(iOffset, 1.0);
342
342
  float viewDepth = -anchor.z;
@@ -422,7 +422,7 @@ void main() {
422
422
  vRing = iRing;
423
423
  vDim = (uFocusFloor < -0.5 || abs(iFloor - uFocusFloor) < 0.5) ? 0.0 : 1.0;
424
424
  gl_Position = projectionMatrix * mv;
425
- }`,lm=`#version 300 es
425
+ }`,um=`#version 300 es
426
426
  precision highp float;
427
427
  in vec3 vColor;
428
428
  in vec3 vNormalWorld;
@@ -479,14 +479,14 @@ void main() {
479
479
  float sheen = clamp((1.0 - uRoughness) / 0.22, 0.15, 2.0);
480
480
  base += vec3(0.26, 0.31, 0.38) * fres * 0.55 * mix(sheen, 1.0, vOccupant);
481
481
  fragColor = vec4(base, 1.0);
482
- }`,um=`#version 300 es
482
+ }`,mm=`#version 300 es
483
483
  precision highp float;
484
484
  in vec2 position;
485
485
  out vec2 vUv;
486
486
  void main() {
487
487
  vUv = position * 0.5 + 0.5;
488
488
  gl_Position = vec4(position, 0.999, 1.0);
489
- }`,mm=`#version 300 es
489
+ }`,dm=`#version 300 es
490
490
  precision highp float;
491
491
  in vec2 vUv;
492
492
  uniform vec3 uTop;
@@ -497,7 +497,7 @@ void main() {
497
497
  vec2 c = vUv - 0.5;
498
498
  float vig = 1.0 - dot(c, c) * 0.85; // soft vignette
499
499
  fragColor = vec4(col * vig, 1.0);
500
- }`,dm=`#version 300 es
500
+ }`,fm=`#version 300 es
501
501
  precision highp float;
502
502
  in vec2 position;
503
503
  in vec3 iOffset;
@@ -534,7 +534,7 @@ void main() {
534
534
  vPhysicalSeat = iPhysicalSeat;
535
535
  vHidden = (uFocusFloor > -0.5 && abs(iFloor - uFocusFloor) > 0.5) ? 1.0 : 0.0;
536
536
  gl_Position = projectionMatrix * mv;
537
- }`,fm=`#version 300 es
537
+ }`,pm=`#version 300 es
538
538
  precision highp float;
539
539
  in vec2 vUv;
540
540
  in float vPhysicalSeat;
@@ -548,7 +548,7 @@ void main() {
548
548
  float d = mix(max(abs(vUv.x), abs(vUv.y)), length(vUv), vPhysicalSeat);
549
549
  if (d > 1.0) discard; // hit-mask matches chair/bay shape
550
550
  fragColor = vec4(vPick, 1.0);
551
- }`,pm=`#version 300 es
551
+ }`,hm=`#version 300 es
552
552
  precision highp float;
553
553
  in vec3 position;
554
554
  in float part;
@@ -570,8 +570,8 @@ uniform float uFocusFloor;
570
570
  flat out vec3 vPick;
571
571
  out float vHidden;
572
572
  ${Pn}
573
- ${sa}
574
573
  ${ca}
574
+ ${la}
575
575
  void main() {
576
576
  int id = int(iPickIndex + 0.5); // already global index + 1
577
577
  vPick = vec3(float(id & 255), float((id >> 8) & 255), float((id >> 16) & 255)) / 255.0;
@@ -604,7 +604,7 @@ void main() {
604
604
  float c = cos(iYaw), s = sin(iYaw);
605
605
  vec3 rp = vec3(p.x * c + p.z * s, p.y, -p.x * s + p.z * c);
606
606
  gl_Position = projectionMatrix * modelViewMatrix * vec4(iOffset + rp, 1.0);
607
- }`,hm=`#version 300 es
607
+ }`,bm=`#version 300 es
608
608
  precision highp float;
609
609
  flat in vec3 vPick;
610
610
  in float vHidden;
@@ -612,7 +612,7 @@ out vec4 fragColor;
612
612
  void main() {
613
613
  if (vHidden > 0.5) discard;
614
614
  fragColor = vec4(vPick, 1.0);
615
- }`,bm=`#version 300 es
615
+ }`,ym=`#version 300 es
616
616
  precision highp float;
617
617
  in vec3 position;
618
618
  in float floorIndex;
@@ -623,14 +623,14 @@ out float vHidden;
623
623
  void main() {
624
624
  vHidden = (uFocusFloor > -0.5 && abs(floorIndex - uFocusFloor) > 0.5) ? 1.0 : 0.0;
625
625
  gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
626
- }`,ym=`#version 300 es
626
+ }`,gm=`#version 300 es
627
627
  precision highp float;
628
628
  in float vHidden;
629
629
  out vec4 fragColor;
630
630
  void main() {
631
631
  if (vHidden > 0.5) discard;
632
632
  fragColor = vec4(0.0, 0.0, 0.0, 1.0);
633
- }`;function la(e){return new Xe.Program(e,{vertex:dm,fragment:fm,transparent:!1,depthTest:!0,depthWrite:!0,cullFace:!1,uniforms:{uSeatRadius:{value:De},uSeatScale:{value:1},uMinPixels:{value:ht},uPixelToWorld:{value:.002},uChairFull:{value:_t},uChairNone:{value:bt},uFocusFloor:{value:-1}}})}function ua(e){return new Xe.Program(e,{vertex:pm,fragment:hm,transparent:!1,depthTest:!0,depthWrite:!0,cullFace:!1,uniforms:{uChairFull:{value:_t},uChairNone:{value:bt},uBackRake:{value:Jn},uBackBase:{value:cn},uFocusFloor:{value:-1}}})}function ma(e){return new Xe.Program(e,{vertex:bm,fragment:ym,transparent:!1,depthTest:!0,depthWrite:!0,cullFace:!1,uniforms:{uFocusFloor:{value:-1}}})}function da(e,t=.78){return new Xe.Program(e,{vertex:rm,fragment:im,cullFace:!1,depthTest:!0,depthWrite:!0,uniforms:{uKeyDir:{value:new Float32Array([.38,.86,.34])},uFocusFloor:{value:-1},uStructureDetail:{value:0},uRoughness:{value:t}}})}function fa(e){return new Xe.Program(e,{vertex:am,fragment:sm,transparent:!0,depthTest:!0,depthWrite:!1,cullFace:!1,uniforms:{uSeatRadius:{value:De},uSeatScale:{value:1},uMinPixels:{value:ht},uPixelToWorld:{value:.002},uSeatFade:{value:0},uSeatDetail:{value:0},uFocusFloor:{value:-1},uFadeColor:{value:new Float32Array([.32,.37,.43])},uChairFull:{value:_t},uChairNone:{value:bt}}})}function pa(e,t=.78){return new Xe.Program(e,{vertex:cm,fragment:lm,transparent:!1,depthTest:!0,depthWrite:!0,cullFace:!1,uniforms:{uKeyDir:{value:new Float32Array([.38,.86,.34])},uFadeColor:{value:new Float32Array([.32,.37,.43])},uChairFull:{value:_t},uChairNone:{value:bt},uBackRake:{value:Jn},uBackBase:{value:cn},uFocusFloor:{value:-1},uRoughness:{value:t}}})}function ha(e,t,n){return new Xe.Program(e,{vertex:um,fragment:mm,depthTest:!1,depthWrite:!1,cullFace:!1,uniforms:{uTop:{value:new Float32Array(t)},uBottom:{value:new Float32Array(n)}}})}var gm=.65,xm=new Set(["dimmed","sold"]),vm=new Set(["dimmed","sold","held"]);function ba(e,t,n){let r=new Set,o=!1,i=pe.indexOf("dimmed"),a=!1;for(let c=0;c<n.length;c+=1)if(n[c]===i){a=!0;break}let s=a?vm:xm;for(let c of e){let u=t.get(c.sectionId);if(!u||!u.length){r.add(c.sectionId);continue}let d=!1;for(let f of u){let m=pe[n[f]]??"available";if(!s.has(m)){d=!0;break}}d?r.add(c.sectionId):o=!0}return{lit:r,anyUnlit:o}}function ya(e,t,n,r,o,i){let a=[];for(let s of e){let c=o===null||o.has(s.sectionId);if(r.get(s.sectionId)===c)continue;r.set(s.sectionId,c);let u=(s.start+s.count)*3;for(let d=s.start*3;d<u;d++)t[d]=c?n[d]:n[d]+(i[d%3]-n[d])*gm;a.push(s)}return a}function ga(e,t,n,r,o,i){for(let a=n;a<n+r;a++){let c=i&&t[a]===0?null:o[t[a]]??o[0];e[a*3]=c?c[0]:i[a*3],e[a*3+1]=c?c[1]:i[a*3+1],e[a*3+2]=c?c[2]:i[a*3+2]}}var Sm=new Float32Array([-1,-1,1,-1,1,1,-1,-1,1,1,-1,1]),Mm=new Float32Array([-1,-1,3,-1,-1,3]);function xa(e,t){let n=new ce.Transform,r=new ce.Transform,o=new ce.Geometry(e,{position:{size:2,data:Mm}}),i=ha(e,t.theme.background.top,t.theme.background.bottom),a=new ce.Mesh(e,{geometry:o,program:i});a.frustumCulled=!1,a.setParent(r);let s=new ce.Geometry(e,{position:{size:3,data:t.solids.position},normal:{size:3,data:t.solids.normal},color:{size:3,data:t.solids.color},floorIndex:{size:1,data:t.solids.floor},materialIndex:{size:1,data:t.solids.material}}),c=da(e,t.theme.materials.roughness),u=new ce.Mesh(e,{geometry:s,program:c});u.frustumCulled=!1,u.setParent(n);let d=fa(e),f=new Float32Array(t.seats.count*3),m=pe.map(X=>t.theme.seatStates[X]);ga(f,t.seats.iState,0,t.seats.count,m,t.seats.iCategory);let l=new ce.Geometry(e,{position:{size:2,data:Sm},iOffset:{size:3,data:t.seats.iPosition,instanced:1},iColor:{size:3,data:f,instanced:1},iMaxRadius:{size:1,data:t.seats.iMaxRadius,instanced:1},iPhysicalSeat:{size:1,data:t.seats.iPhysicalSeat,instanced:1},iRing:{size:3,data:t.seats.iRing,instanced:1},iFloor:{size:1,data:t.seats.iFloor,instanced:1}}),p=new ce.Mesh(e,{geometry:l,program:d});p.frustumCulled=!1,t.seats.count>0&&p.setParent(n);let h=l.attributes.iColor,b=t.solids.color.slice(),y=t.theme.structure.ground,v=new Map(t.sectionSolidRanges.map(X=>[X.sectionId,!0])),S=xr(),M=pa(e,t.theme.materials.roughness),R=en,x=new Float32Array(R*3),g=new Float32Array(R*3),C=new Float32Array(R),E=new Float32Array(R),D=new Float32Array(R),B=new Float32Array(R*3),L=new Float32Array(R),A=new Float32Array(R),k=new Float32Array(R),N=new Float32Array(R),w=new ce.Geometry(e,{position:{size:3,data:S.position},normal:{size:3,data:S.normal},part:{size:1,data:S.part},index:{data:S.index},iOffset:{size:3,data:x,instanced:1},iColor:{size:3,data:g,instanced:1},iRadius:{size:1,data:C,instanced:1},iYaw:{size:1,data:E,instanced:1},iGlyph:{size:1,data:D,instanced:1},iRing:{size:3,data:B,instanced:1},iFloor:{size:1,data:L,instanced:1},iPhysicalSeat:{size:1,data:A,instanced:1},iSeed:{size:1,data:N,instanced:1},iPickIndex:{size:1,data:k,instanced:1}}),T=new ce.Mesh(e,{geometry:w,program:M});T.frustumCulled=!1;let _=0,P=!1,O=!1,I=null,F=null,H=null,j=new Int32Array(0),G=()=>{let X=t.seats;for(let Q=0;Q<_;Q++){let q=j[Q];N[Q]=Sr(X.iState[q],q);let Z=X.iCategory&&X.iState[q]===0?null:m[X.iState[q]]??m[0];if(Z)g[Q*3]=Z[0],g[Q*3+1]=Z[1],g[Q*3+2]=Z[2];else{let te=t.theme.materials.seat??Yo([X.iCategory[q*3],X.iCategory[q*3+1],X.iCategory[q*3+2]]);g[Q*3]=te[0],g[Q*3+1]=te[1],g[Q*3+2]=te[2]}}w.attributes.iColor.needsUpdate=!0,w.attributes.iSeed.needsUpdate=!0},V={main:n,background:r,seatProgram:d,solidProgram:c,chairProgram:M,seatGeometry:l,chairGeometry:w,solidGeometry:s,drawCalls:3,setNearSeats(X,Q){let q=Math.min(Q,R);if(j=X,_=q,q===0){T.parent&&T.setParent(null),w.instancedCount=0,V.drawCalls=3+(P?1:0);return}let K=t.seats;for(let Z=0;Z<q;Z++){let te=X[Z];x[Z*3]=K.iPosition[te*3],x[Z*3+1]=K.iPosition[te*3+1],x[Z*3+2]=K.iPosition[te*3+2],C[Z]=K.iChairWidth[te],E[Z]=K.iYaw[te],D[Z]=K.iGlyph[te],B[Z*3]=K.iRing[te*3],B[Z*3+1]=K.iRing[te*3+1],B[Z*3+2]=K.iRing[te*3+2],L[Z]=K.iFloor[te],A[Z]=K.iPhysicalSeat[te],k[Z]=te+1}G(),w.attributes.iOffset.needsUpdate=!0,w.attributes.iRadius.needsUpdate=!0,w.attributes.iYaw.needsUpdate=!0,w.attributes.iGlyph.needsUpdate=!0,w.attributes.iRing.needsUpdate=!0,w.attributes.iFloor.needsUpdate=!0,w.attributes.iPhysicalSeat.needsUpdate=!0,w.attributes.iSeed.needsUpdate=!0,w.attributes.iPickIndex.needsUpdate=!0,w.instancedCount=q,T.parent||T.setParent(n),V.drawCalls=4+(P?1:0)},nearSeatCount(){return _},setSectionShellLit(X){let Q=ya(t.sectionSolidRanges,t.solids.color,b,v,X,y);if(!Q.length)return;let q=s.attributes.color,K=q.buffer;if(!K){q.needsUpdate=!0;return}e.bindBuffer(e.ARRAY_BUFFER,K);for(let Z of Q){let te=t.solids.color.subarray(Z.start*3,(Z.start+Z.count)*3);e.bufferSubData(e.ARRAY_BUFFER,Z.start*3*Float32Array.BYTES_PER_ELEMENT,te)}},uploadSeatStateRuns(X){if(!X.length)return;_&&G();for(let q of X)ga(f,t.seats.iState,q.start,q.length,m,t.seats.iCategory);let Q=h.buffer;if(!Q){h.needsUpdate=!0;return}e.bindBuffer(e.ARRAY_BUFFER,Q);for(let q of X){let K=f.subarray(q.start*3,(q.start+q.length)*3);e.bufferSubData(e.ARRAY_BUFFER,q.start*3*Float32Array.BYTES_PER_ELEMENT,K)}},dispose(){O=!0,o.remove(),i.remove(),s.remove(),c.remove(),l.remove(),d.remove(),w.remove(),M.remove(),I?.remove(),F?.remove(),H?.texture&&e.deleteTexture(H.texture)}},W=t.productionElements.find(X=>X.contentImageUrl&&X.contentPlane);if(W?.contentImageUrl&&W.contentPlane?.length===4&&typeof Image<"u"){let X=new Image;X.crossOrigin="anonymous",X.onload=()=>{if(O)return;let Q=W.contentPlane;I=new ce.Geometry(e,{position:{size:3,data:new Float32Array(Q.flat())},uv:{size:2,data:new Float32Array([0,1,1,1,0,0,1,0])},floorIndex:{size:1,data:new Float32Array(4).fill(W.floorIndex)},index:{data:new Uint16Array([0,1,2,2,1,3])}}),H=new ce.Texture(e,{image:X,generateMipmaps:!0,wrapS:e.CLAMP_TO_EDGE,wrapT:e.CLAMP_TO_EDGE,flipY:!1}),F=new ce.Program(e,{vertex:`#version 300 es
633
+ }`;function ua(e){return new Xe.Program(e,{vertex:fm,fragment:pm,transparent:!1,depthTest:!0,depthWrite:!0,cullFace:!1,uniforms:{uSeatRadius:{value:De},uSeatScale:{value:1},uMinPixels:{value:ht},uPixelToWorld:{value:.002},uChairFull:{value:_t},uChairNone:{value:bt},uFocusFloor:{value:-1}}})}function ma(e){return new Xe.Program(e,{vertex:hm,fragment:bm,transparent:!1,depthTest:!0,depthWrite:!0,cullFace:!1,uniforms:{uChairFull:{value:_t},uChairNone:{value:bt},uBackRake:{value:Jn},uBackBase:{value:cn},uFocusFloor:{value:-1}}})}function da(e){return new Xe.Program(e,{vertex:ym,fragment:gm,transparent:!1,depthTest:!0,depthWrite:!0,cullFace:!1,uniforms:{uFocusFloor:{value:-1}}})}function fa(e,t=.78){return new Xe.Program(e,{vertex:im,fragment:am,cullFace:!1,depthTest:!0,depthWrite:!0,uniforms:{uKeyDir:{value:new Float32Array([.38,.86,.34])},uFocusFloor:{value:-1},uStructureDetail:{value:0},uRoughness:{value:t}}})}function pa(e){return new Xe.Program(e,{vertex:sm,fragment:cm,transparent:!0,depthTest:!0,depthWrite:!1,cullFace:!1,uniforms:{uSeatRadius:{value:De},uSeatScale:{value:1},uMinPixels:{value:ht},uPixelToWorld:{value:.002},uSeatFade:{value:0},uSeatDetail:{value:0},uFocusFloor:{value:-1},uFadeColor:{value:new Float32Array([.32,.37,.43])},uChairFull:{value:_t},uChairNone:{value:bt}}})}function ha(e,t=.78){return new Xe.Program(e,{vertex:lm,fragment:um,transparent:!1,depthTest:!0,depthWrite:!0,cullFace:!1,uniforms:{uKeyDir:{value:new Float32Array([.38,.86,.34])},uFadeColor:{value:new Float32Array([.32,.37,.43])},uChairFull:{value:_t},uChairNone:{value:bt},uBackRake:{value:Jn},uBackBase:{value:cn},uFocusFloor:{value:-1},uRoughness:{value:t}}})}function ba(e,t,n){return new Xe.Program(e,{vertex:mm,fragment:dm,depthTest:!1,depthWrite:!1,cullFace:!1,uniforms:{uTop:{value:new Float32Array(t)},uBottom:{value:new Float32Array(n)}}})}var xm=.65,vm=new Set(["dimmed","sold"]),Sm=new Set(["dimmed","sold","held"]);function ya(e,t,n){let r=new Set,o=!1,i=pe.indexOf("dimmed"),a=!1;for(let c=0;c<n.length;c+=1)if(n[c]===i){a=!0;break}let s=a?Sm:vm;for(let c of e){let u=t.get(c.sectionId);if(!u||!u.length){r.add(c.sectionId);continue}let d=!1;for(let f of u){let m=pe[n[f]]??"available";if(!s.has(m)){d=!0;break}}d?r.add(c.sectionId):o=!0}return{lit:r,anyUnlit:o}}function ga(e,t,n,r,o,i){let a=[];for(let s of e){let c=o===null||o.has(s.sectionId);if(r.get(s.sectionId)===c)continue;r.set(s.sectionId,c);let u=(s.start+s.count)*3;for(let d=s.start*3;d<u;d++)t[d]=c?n[d]:n[d]+(i[d%3]-n[d])*xm;a.push(s)}return a}function xa(e,t,n,r,o,i){for(let a=n;a<n+r;a++){let c=i&&t[a]===0?null:o[t[a]]??o[0];e[a*3]=c?c[0]:i[a*3],e[a*3+1]=c?c[1]:i[a*3+1],e[a*3+2]=c?c[2]:i[a*3+2]}}var Mm=new Float32Array([-1,-1,1,-1,1,1,-1,-1,1,1,-1,1]),wm=new Float32Array([-1,-1,3,-1,-1,3]);function va(e,t){let n=new ce.Transform,r=new ce.Transform,o=new ce.Geometry(e,{position:{size:2,data:wm}}),i=ba(e,t.theme.background.top,t.theme.background.bottom),a=new ce.Mesh(e,{geometry:o,program:i});a.frustumCulled=!1,a.setParent(r);let s=new ce.Geometry(e,{position:{size:3,data:t.solids.position},normal:{size:3,data:t.solids.normal},color:{size:3,data:t.solids.color},floorIndex:{size:1,data:t.solids.floor},materialIndex:{size:1,data:t.solids.material}}),c=fa(e,t.theme.materials.roughness),u=new ce.Mesh(e,{geometry:s,program:c});u.frustumCulled=!1,u.setParent(n);let d=pa(e),f=new Float32Array(t.seats.count*3),m=pe.map(X=>t.theme.seatStates[X]);xa(f,t.seats.iState,0,t.seats.count,m,t.seats.iCategory);let l=new ce.Geometry(e,{position:{size:2,data:Mm},iOffset:{size:3,data:t.seats.iPosition,instanced:1},iColor:{size:3,data:f,instanced:1},iMaxRadius:{size:1,data:t.seats.iMaxRadius,instanced:1},iPhysicalSeat:{size:1,data:t.seats.iPhysicalSeat,instanced:1},iRing:{size:3,data:t.seats.iRing,instanced:1},iFloor:{size:1,data:t.seats.iFloor,instanced:1}}),p=new ce.Mesh(e,{geometry:l,program:d});p.frustumCulled=!1,t.seats.count>0&&p.setParent(n);let h=l.attributes.iColor,b=t.solids.color.slice(),y=t.theme.structure.ground,v=new Map(t.sectionSolidRanges.map(X=>[X.sectionId,!0])),S=vr(),M=ha(e,t.theme.materials.roughness),R=en,x=new Float32Array(R*3),g=new Float32Array(R*3),C=new Float32Array(R),E=new Float32Array(R),D=new Float32Array(R),B=new Float32Array(R*3),L=new Float32Array(R),A=new Float32Array(R),k=new Float32Array(R),N=new Float32Array(R),w=new ce.Geometry(e,{position:{size:3,data:S.position},normal:{size:3,data:S.normal},part:{size:1,data:S.part},index:{data:S.index},iOffset:{size:3,data:x,instanced:1},iColor:{size:3,data:g,instanced:1},iRadius:{size:1,data:C,instanced:1},iYaw:{size:1,data:E,instanced:1},iGlyph:{size:1,data:D,instanced:1},iRing:{size:3,data:B,instanced:1},iFloor:{size:1,data:L,instanced:1},iPhysicalSeat:{size:1,data:A,instanced:1},iSeed:{size:1,data:N,instanced:1},iPickIndex:{size:1,data:k,instanced:1}}),T=new ce.Mesh(e,{geometry:w,program:M});T.frustumCulled=!1;let _=0,P=!1,O=!1,I=null,F=null,H=null,j=new Int32Array(0),G=()=>{let X=t.seats;for(let Q=0;Q<_;Q++){let q=j[Q];N[Q]=Mr(X.iState[q],q);let Z=X.iCategory&&X.iState[q]===0?null:m[X.iState[q]]??m[0];if(Z)g[Q*3]=Z[0],g[Q*3+1]=Z[1],g[Q*3+2]=Z[2];else{let te=t.theme.materials.seat??Xo([X.iCategory[q*3],X.iCategory[q*3+1],X.iCategory[q*3+2]]);g[Q*3]=te[0],g[Q*3+1]=te[1],g[Q*3+2]=te[2]}}w.attributes.iColor.needsUpdate=!0,w.attributes.iSeed.needsUpdate=!0},V={main:n,background:r,seatProgram:d,solidProgram:c,chairProgram:M,seatGeometry:l,chairGeometry:w,solidGeometry:s,drawCalls:3,setNearSeats(X,Q){let q=Math.min(Q,R);if(j=X,_=q,q===0){T.parent&&T.setParent(null),w.instancedCount=0,V.drawCalls=3+(P?1:0);return}let K=t.seats;for(let Z=0;Z<q;Z++){let te=X[Z];x[Z*3]=K.iPosition[te*3],x[Z*3+1]=K.iPosition[te*3+1],x[Z*3+2]=K.iPosition[te*3+2],C[Z]=K.iChairWidth[te],E[Z]=K.iYaw[te],D[Z]=K.iGlyph[te],B[Z*3]=K.iRing[te*3],B[Z*3+1]=K.iRing[te*3+1],B[Z*3+2]=K.iRing[te*3+2],L[Z]=K.iFloor[te],A[Z]=K.iPhysicalSeat[te],k[Z]=te+1}G(),w.attributes.iOffset.needsUpdate=!0,w.attributes.iRadius.needsUpdate=!0,w.attributes.iYaw.needsUpdate=!0,w.attributes.iGlyph.needsUpdate=!0,w.attributes.iRing.needsUpdate=!0,w.attributes.iFloor.needsUpdate=!0,w.attributes.iPhysicalSeat.needsUpdate=!0,w.attributes.iSeed.needsUpdate=!0,w.attributes.iPickIndex.needsUpdate=!0,w.instancedCount=q,T.parent||T.setParent(n),V.drawCalls=4+(P?1:0)},nearSeatCount(){return _},setSectionShellLit(X){let Q=ga(t.sectionSolidRanges,t.solids.color,b,v,X,y);if(!Q.length)return;let q=s.attributes.color,K=q.buffer;if(!K){q.needsUpdate=!0;return}e.bindBuffer(e.ARRAY_BUFFER,K);for(let Z of Q){let te=t.solids.color.subarray(Z.start*3,(Z.start+Z.count)*3);e.bufferSubData(e.ARRAY_BUFFER,Z.start*3*Float32Array.BYTES_PER_ELEMENT,te)}},uploadSeatStateRuns(X){if(!X.length)return;_&&G();for(let q of X)xa(f,t.seats.iState,q.start,q.length,m,t.seats.iCategory);let Q=h.buffer;if(!Q){h.needsUpdate=!0;return}e.bindBuffer(e.ARRAY_BUFFER,Q);for(let q of X){let K=f.subarray(q.start*3,(q.start+q.length)*3);e.bufferSubData(e.ARRAY_BUFFER,q.start*3*Float32Array.BYTES_PER_ELEMENT,K)}},dispose(){O=!0,o.remove(),i.remove(),s.remove(),c.remove(),l.remove(),d.remove(),w.remove(),M.remove(),I?.remove(),F?.remove(),H?.texture&&e.deleteTexture(H.texture)}},W=t.productionElements.find(X=>X.contentImageUrl&&X.contentPlane);if(W?.contentImageUrl&&W.contentPlane?.length===4&&typeof Image<"u"){let X=new Image;X.crossOrigin="anonymous",X.onload=()=>{if(O)return;let Q=W.contentPlane;I=new ce.Geometry(e,{position:{size:3,data:new Float32Array(Q.flat())},uv:{size:2,data:new Float32Array([0,1,1,1,0,0,1,0])},floorIndex:{size:1,data:new Float32Array(4).fill(W.floorIndex)},index:{data:new Uint16Array([0,1,2,2,1,3])}}),H=new ce.Texture(e,{image:X,generateMipmaps:!0,wrapS:e.CLAMP_TO_EDGE,wrapT:e.CLAMP_TO_EDGE,flipY:!1}),F=new ce.Program(e,{vertex:`#version 300 es
634
634
  precision highp float;
635
635
  in vec3 position; in vec2 uv; in float floorIndex;
636
636
  uniform mat4 modelViewMatrix; uniform mat4 projectionMatrix; uniform float uFocusFloor;
@@ -638,4 +638,4 @@ void main() {
638
638
  void main(){ vUv=uv; vDim=(uFocusFloor < -0.5 || abs(floorIndex-uFocusFloor)<0.5)?0.0:1.0; gl_Position=projectionMatrix*modelViewMatrix*vec4(position,1.0); }`,fragment:`#version 300 es
639
639
  precision highp float;
640
640
  in vec2 vUv; in float vDim; uniform sampler2D uImage; out vec4 fragColor;
641
- void main(){ if(vDim>0.5) discard; vec4 c=texture(uImage,vUv); if(c.a<0.01) discard; fragColor=c; }`,uniforms:{uImage:{value:H},uFocusFloor:{value:-1}},transparent:!1,depthTest:!0,depthWrite:!0,cullFace:!1});let q=new ce.Mesh(e,{geometry:I,program:F});q.frustumCulled=!1,q.setParent(n),V.screenProgram=F,P=!0,V.drawCalls=3+(_?1:0)+1},X.src=W.contentImageUrl}return V}var _e=require("ogl");function wm(e,t,n){let r=e+(t<<8)+(n<<16);return r===0?-1:r-1}function va(e,t,n,r,o,i){let a=-1,s=1/0;for(let c=0;c<n;c++)for(let u=0;u<t;u++){let d=(c*t+u)*4,f=wm(e[d],e[d+1],e[d+2]);if(f<0||f>=i)continue;let m=u-r,l=c-o,p=m*m+l*l;p<s&&(s=p,a=f)}return a}function Sa(e,t,n,r,o,i){let a=e-n.left,s=t-n.top,c=Math.round(a*r),u=Math.round((n.height-s)*r);return{x:Math.max(0,Math.min(o-1,c)),y:Math.max(0,Math.min(i-1,u))}}var Pm=["uSeatRadius","uSeatScale","uMinPixels","uPixelToWorld"],Cn=class{constructor(t,n,r,o,i){this.seatScene=new _e.Transform;this.chairScene=new _e.Transform;this.solidScene=new _e.Transform;this.target=null;this.restoreClear=[0,0,0];this.renderer=t,this.gl=t.gl,this.maxIndex=i,this.seatProg=la(this.gl),this.chairProg=ua(this.gl),this.depthProg=ma(this.gl);let a=new _e.Mesh(this.gl,{geometry:n,program:this.seatProg});a.frustumCulled=!1,a.setParent(this.seatScene);let s=new _e.Mesh(this.gl,{geometry:r,program:this.chairProg});s.frustumCulled=!1,s.setParent(this.chairScene);let c=new _e.Mesh(this.gl,{geometry:o,program:this.depthProg});c.frustumCulled=!1,c.setParent(this.solidScene)}setRestoreClear(t){this.restoreClear=[t[0],t[1],t[2]]}syncFromSeatProgram(t){for(let r of Pm)this.seatProg.uniforms[r].value=t.uniforms[r].value;let n=t.uniforms.uFocusFloor.value;this.seatProg.uniforms.uFocusFloor.value=n,this.chairProg.uniforms.uFocusFloor.value=n,this.depthProg.uniforms.uFocusFloor.value=n}ensureTarget(){let t=this.gl.drawingBufferWidth,n=this.gl.drawingBufferHeight;return this.target&&(this.target.width!==t||this.target.height!==n)&&this.destroyTarget(),this.target||(this.target=new _e.RenderTarget(this.gl,{width:t,height:n,depth:!0})),this.target}destroyTarget(){if(!this.target)return;let t=this.gl;this.target.buffer&&t.deleteFramebuffer(this.target.buffer);for(let n of this.target.textures??[])n.texture&&t.deleteTexture(n.texture);this.target.depthBuffer&&t.deleteRenderbuffer(this.target.depthBuffer),this.target=null}pick(t,n,r,o){let i=this.gl,a=this.ensureTarget(),s=i.drawingBufferWidth,c=i.drawingBufferHeight,u=Math.max(0,n-o),d=Math.max(0,r-o),f=Math.max(1,Math.min(s,n+o+1)-u),m=Math.max(1,Math.min(c,r+o+1)-d);i.enable(i.SCISSOR_TEST),i.scissor(u,d,f,m);let[l,p,h]=this.restoreClear;i.clearColor(0,0,0,1),this.renderer.render({scene:this.solidScene,camera:t,target:a,clear:!0}),this.renderer.render({scene:this.seatScene,camera:t,target:a,clear:!1}),this.renderer.render({scene:this.chairScene,camera:t,target:a,clear:!1}),i.clearColor(l,p,h,1),i.disable(i.SCISSOR_TEST);let b=new Uint8Array(f*m*4);return this.renderer.bindFramebuffer(a),i.readPixels(u,d,f,m,i.RGBA,i.UNSIGNED_BYTE,b),this.renderer.bindFramebuffer(),va(b,f,m,n-u,r-d,this.maxIndex)}dispose(){this.destroyTarget(),this.seatProg.remove(),this.chairProg.remove(),this.depthProg.remove()}};function Ma(e,t){let n=[];for(let r of t)e.has(r.seatId)?e.set(r.seatId,It(r.state)):n.push(r);return n}function wa(e,t,n){let r=new Set;for(let a of t)(e.has(a)||n(a)!==void 0)&&r.add(a);let o=new Map(e),i=[];for(let[a,s]of e)r.has(a)||(i.push({seatId:a,state:pe[s]??"available"}),o.delete(a));for(let a of r){if(o.has(a))continue;let s=n(a);s!==void 0&&(o.set(a,s),i.push({seatId:a,state:"selected"}))}return{updates:i,next:o}}var We=require("ogl");function Cm(e,t){return[e[0]-t[0],e[1]-t[1],e[2]-t[2]]}function Pa(e,t){return[e[0]+t[0],e[1]+t[1],e[2]+t[2]]}function Am(e,t){return[e[0]*t,e[1]*t,e[2]*t]}function Ca(e){let t=Math.hypot(e[0],e[1],e[2]);return t>1e-6?[e[0]/t,e[1]/t,e[2]/t]:[0,0,0]}function Eo(e){let t=Math.max(0,Math.min(1,e));return t*t*t*(t*(t*6-15)+10)}function Io(e,t){return Math.max(0,Math.min(1,e+t))}function Aa(e,t){let n=e.length;if(n===0)return[0,0,0];if(n===1)return[...e[0]];let r=Math.max(0,Math.min(1,t)),o=n-1,i=Math.floor(r*o);i>=o&&(i=o-1);let a=r*o-i,s=e[Math.max(0,i-1)],c=e[i],u=e[i+1],d=e[Math.min(n-1,i+2)],f=a*a,m=f*a,l=[0,0,0];for(let p=0;p<3;p++)l[p]=.5*(2*c[p]+(-s[p]+u[p])*a+(2*s[p]-5*c[p]+4*u[p]-d[p])*f+(-s[p]+3*c[p]-3*u[p]+d[p])*m);return l}function To(e,t,n,r,o){let i=Ca(Cm(t,n));i[0]===0&&i[1]===0&&i[2]===0&&(i=[0,0,1]);let a=Pa(Pa(t,Am(i,2.5)),[0,1.5,0]),s=[t[0]-r[0],0,t[2]-r[2]],c=Ca(s);c[0]===0&&c[2]===0&&(c=[i[0],0,i[2]]);let u=Math.max(1,o),d=[r[0]+c[0]*u*1.3,r[1]+u*.75,r[2]+c[2]*u*1.3];return{waypoints:[e,d,a],finalPos:a}}function _o(e,t,n=35,r=28){let o=Eo(t),i=Aa(e,o),a=Eo(Math.max(0,Math.min(1,(t-.66)/.34)));return{pos:i,fov:n+(r-n)*a,eased:o}}function Ta(e,t,n){let r=e.position.clone(),o=new We.Quat().copy(e.quaternion);e.position.set(t[0],t[1],t[2]),e.lookAt(new We.Vec3(n[0],n[1],n[2]));let i=new We.Quat().copy(e.quaternion);return e.position.copy(r),e.quaternion.copy(o),i}var An=class{constructor(t){this.active=!1;this.waypoints=[];this.startQuat=new We.Quat;this.endQuat=new We.Quat;this.outQuat=new We.Quat;this.startTime=0;this.duration=2500;this.endFov=28;this.resolveFn=null;this.camera=t}start(t,n,r,o=2500,i=28){return this.settle(),this.waypoints=t,this.startQuat.copy(n),this.endQuat.copy(r),this.duration=o,this.endFov=i,this.startTime=performance.now(),this.active=!0,new Promise(a=>{this.resolveFn=a})}update(t){if(!this.active)return!1;let n=Math.min(1,(t-this.startTime)/this.duration),{pos:r,fov:o,eased:i}=_o(this.waypoints,n,35,this.endFov);return this.camera.position.set(r[0],r[1],r[2]),this.outQuat.copy(this.startQuat).slerp(this.endQuat,Io(i,.15)),this.camera.quaternion.copy(this.outQuat),this.camera.fov=o,this.camera.updateProjectionMatrix(),n>=1?(this.settle(),!1):!0}cancel(){this.settle()}settle(){this.active=!1;let t=this.resolveFn;this.resolveFn=null,t&&t()}};var _a=to,Rm=.12,Em=.25,Im=1.5;function La(e,t,n=0,r,o){let i=[t.x*z,n+Im,t.y*z],a=o?[o[0],o[1],o[2]]:i,s=e[1],c=Number.isFinite(s)?s+_a:Number.isFinite(r)?n+r:n+_a,u=i[0]-e[0],d=i[2]-e[2],f=Math.hypot(u,d),m=f>.001?Math.min(Rm,f*Em):0,l=f>.001?u/f:0,p=f>.001?d/f:0;return{eye:[e[0]+l*m,c,e[2]+p*m],focal:a}}var st=Math.PI/180,Tm=45,ka=80,Rn=70,_m=1,Lm=.99;function km(e,t){if(!(e<_m))return ka;if(!(Number.isFinite(t)&&t>0))return Rn;let n=2*Math.atan(t/(2*En*Lm)/Math.max(.05,e))/st;return Math.max(Rn,Math.min(ka,n))}var Fm=.25,En=1,Dm=.25,Om=12*st,Vm=.2,Bm=1.5,Fa=.8,Da=6,Na=1.9,Nm=2/3,Gm=.12,zm=.9,Um=1.2,Hm=2,Ga=.05,jm=6;function za(e,t,n=0){if(!e.length)return{min:[t[0]-6,n,t[2]-6],max:[t[0]+6,Math.max(n+Fa,t[1]),t[2]+6]};let r=1/0,o=-1/0,i=1/0,a=-1/0,s=n;for(let p of e)r=Math.min(r,p.cx-p.halfX),o=Math.max(o,p.cx+p.halfX),i=Math.min(i,p.cz-p.halfZ),a=Math.max(a,p.cz+p.halfZ),s=Math.max(s,p.y);let c=o-r,u=a-i,d=Math.max(c,Math.min(u,Da))/2,f=Math.max(u,Math.min(c,Da))/2,m=(r+o)/2,l=(i+a)/2;return{min:[m-d,n,l-f],max:[m+d,Math.max(n+Fa,s),l+f]}}function Ym(e){return{min:[e.min[0],e.min[1],e.min[2]],max:[e.max[0],e.max[1]+Na,e.max[2]]}}function Lo(e){let t=e.max[1];return[(e.min[0]+e.max[0])/2,Math.max(e.min[1]+Bm,t+Vm,t+Na*Nm),(e.min[2]+e.max[2])/2]}function Ua(e,t){let n=e[0]-t[0],r=e[2]-t[2],o=Math.hypot(n,r);return o<.001?{x:0,z:1}:{x:n/o,z:r/o}}function Oa(e,t,n){let r=t[0]-e[0],o=t[1]-e[1],i=t[2]-e[2],a=Math.hypot(r,o,i)||1;r/=a,o/=a,i/=a;let s=-i,c=r,u=Math.hypot(s,c);if(u<1e-6)return 1/0;s/=u,c/=u;let d=1/0,f=-1/0;for(let m=0;m<8;m++){let l=(m&1?n.max[0]:n.min[0])-e[0],p=(m&2?n.max[1]:n.min[1])-e[1],h=(m&4?n.max[2]:n.min[2])-e[2],b=Math.max(Ga,l*r+p*o+h*i),y=(l*s+h*c)/b;y<d&&(d=y),y>f&&(f=y)}return f-d}function Va(e,t,n){let r=t[0]-e[0],o=t[1]-e[1],i=t[2]-e[2],a=Math.hypot(r,o,i)||1;r/=a,o/=a,i/=a;let s=-i,c=r,u=Math.hypot(s,c);if(u<1e-6)return 1/0;s/=u,c/=u;let d=-c*o,f=c*r-s*i,m=s*o,l=1/0,p=-1/0;for(let h=0;h<8;h++){let b=(h&1?n.max[0]:n.min[0])-e[0],y=(h&2?n.max[1]:n.min[1])-e[1],v=(h&4?n.max[2]:n.min[2])-e[2],S=Math.max(Ga,b*r+y*o+v*i),M=(b*d+y*f+v*m)/S;M<l&&(l=M),M>p&&(p=M)}return p-l}function In(e,t){return Math.tan(e*st/2)*Math.max(.05,t)}function Ba(e,t,n){let r=km(n,e),o=c=>Math.max(Tm,Math.min(r,c)),i=c=>2*Math.atan(c)/st,a=Number.isFinite(e)&&e>0?o(i(e/(2*Fm)/Math.max(.05,n))):r;if(!(Number.isFinite(t)&&t>0))return a;let s=Math.min(a,o(i(t/(2*Gm))));return e/(2*In(s,n))>En?a:s}function Ha(e,t,n){let r=Lo(t),o=[e[0],e[1],e[2]],i=0,a=0,s=l=>{if(!(l>0))return;let p=Ua(o,r);o[0]+=p.x*l,o[2]+=p.z*l,a+=l},c=t.max[1]+Dm-o[1];c>0&&(o[1]+=c,i=c,s(c/Math.tan(Om)));let u=Ym(t),d=Oa(o,r,t),f=Ba(d,Va(o,r,u),n),m=d/(2*In(f,n));for(let l=0;l<jm&&m>En;l++){let p=Math.max(1,Math.hypot(o[0]-r[0],o[2]-r[2])),h=Number.isFinite(m)?m/En:2;s(Math.min(60,p*(Math.min(4,h)-1)+.5)),d=Oa(o,r,t),f=Ba(d,Va(o,r,u),n),m=d/(2*In(f,n))}return{eye:o,focal:r,fov:f,raisedM:i,pulledBackM:a,stageFrameWidth:m}}function Xm(e,t,n){let r=Math.tan(t*st/2),o=In(t,n);return Math.max(1,e/Math.max(.05,Math.min(r,o)))}function ja(e,t){let{aspect:n,venue:r}=t,o=e.focal,i=Ua(e.eye,o),a=m=>(m[0]-o[0])*i.x+(m[2]-o[2])*i.z,s=[{name:"seat",eye:e.eye,focal:o,fov:e.fov}],c=Hm*(t.rowDepthM??zm);s.push({name:"row",eye:[e.eye[0]+i.x*c,e.eye[1]+Um,e.eye[2]+i.z*c],focal:o,fov:e.fov});let u=(m,l,p,h)=>{let b=Xm(p,e.fov,n)*1.08,y=b*Math.sin(h*st),v=b*Math.cos(h*st);return{name:m,eye:[l[0]+i.x*v,l[1]+y,l[2]+i.z*v],focal:l,fov:e.fov}};t.section&&t.section.radius>0&&s.push(u("section",t.section.center,t.section.radius,14)),s.push(u("venue",r.center,Math.max(1,r.radius),26));let d=[],f=-1/0;for(let m of s){let l=a(m.eye);d.length&&l<=f+.5||(d.push(m),f=l)}return d}var qa=require("ogl"),jt=Math.PI/180,Ya=320,Xa=70*jt,Wm=32*jt,Km=24*jt,Wa=.0026,qm=.22,$m=.006,Qm=180,Zm=4,Se=(e,t,n)=>Math.max(t,Math.min(n,e)),Ka=e=>e<.5?4*e*e*e:1-Math.pow(-2*e+2,3)/2;function $a(e){let{canvas:t,camera:n}=e,r=[],o=!1,i=0,a=0,s=0,c=0,u=0,d=0,f=!1,m=[0,0],l=0,p=!1,h=null,b=null,y=new Map,v=!1,S=0,M=0,R=0,x=0,g=()=>o&&r.length?r[Se(Math.round(i),0,r.length-1)].name:null,C=()=>{let P=g();P!==h&&(h=P,e.onStopChange?.(P))},E=()=>{if(!o||!r.length)return;let P=r[Se(Math.floor(i),0,r.length-1)],O=r[Se(Math.ceil(i),0,r.length-1)],I=Se(i-Math.floor(i),0,1),F=(Me,Ae)=>Me+(Ae-Me)*I,H=[F(P.eye[0],O.eye[0]),F(P.eye[1],O.eye[1]),F(P.eye[2],O.eye[2])],j=[F(P.focal[0],O.focal[0]),F(P.focal[1],O.focal[1]),F(P.focal[2],O.focal[2])],G=j[0]-H[0],V=j[1]-H[1],W=j[2]-H[2],X=Math.hypot(G,V,W)||1,Q=Math.atan2(G,W),q=Math.asin(Se(V/X,-1,1)),K=Q+a,Z=Se(q+s,-80*jt,80*jt),te=Math.cos(Z)*X;G=Math.sin(K)*te,V=Math.sin(Z)*X,W=Math.cos(K)*te,n.position.set(H[0],H[1],H[2]),n.fov=F(P.fov,O.fov),n.updateProjectionMatrix(),n.lookAt(new qa.Vec3(H[0]+G,H[1]+V,H[2]+W)),e.onApplied?.()},D=()=>{if(!o||!r.length)return;let P=Se(Math.round(i),0,r.length-1);if(e.reducedMotion()){f=!1,i=P,E(),C(),e.requestRender();return}if(Math.abs(P-i)<.001){f=!1,C();return}c=i,u=P,d=performance.now(),f=!0,e.requestRender()},B=P=>{!o||r.length<2||(f=!1,i=Se(i+P,0,r.length-1),E(),C(),e.requestRender())},L=(P,O)=>{o&&(f=!1,p=!1,a=Se(a-P*Wa,-Xa,Xa),s=Se(s-O*Wa,-Km,Wm),E(),e.requestRender())},A=P=>{o&&(y.set(P.pointerId,{x:P.clientX,y:P.clientY}),y.size===1?(v=!0,x=0,S=P.clientX,M=P.clientY):y.size===2&&(v=!1,R=k()))},k=()=>{let P=[...y.values()];return P.length<2?0:Math.hypot(P[0].x-P[1].x,P[0].y-P[1].y)},N=P=>{if(!o||!y.has(P.pointerId))return;if(y.set(P.pointerId,{x:P.clientX,y:P.clientY}),y.size>=2){let F=k();R>0&&B((R-F)*$m),R=F;return}if(!v)return;let O=P.clientX-S,I=P.clientY-M;S=P.clientX,M=P.clientY,x+=Math.abs(O)+Math.abs(I),!(x<=Zm)&&L(O,I)},w=P=>{y.delete(P.pointerId)&&(y.size<2&&(R=0),y.size===0&&(v=!1,D()))},T=P=>{if(!o)return;P.preventDefault();let O=P.deltaMode===1?16:P.deltaMode===2?100:1,I=Se(P.deltaY*O/100,-2,2);B(I*qm),b&&clearTimeout(b),b=setTimeout(()=>{b=null,D()},Qm)},_=()=>{o&&(o=!1,f=!1,p=!1,r=[],y.clear(),v=!1,b&&(clearTimeout(b),b=null),h!==null&&(h=null,e.onStopChange?.(null)))};return t.addEventListener("pointerdown",A),t.addEventListener("pointermove",N),t.addEventListener("pointerup",w),t.addEventListener("pointercancel",w),t.addEventListener("wheel",T,{passive:!1}),{get active(){return o},enter(P){if(P.length<2){_();return}r=P,o=!0,i=0,a=0,s=0,f=!1,p=!1,h=null,E(),C(),e.requestRender()},exit:_,recentre(){return o?Math.abs(a)<1e-4&&Math.abs(s)<1e-4?!0:e.reducedMotion()?(p=!1,a=0,s=0,E(),e.requestRender(),!0):(m=[a,s],l=performance.now(),p=!0,e.requestRender(),!0):!1},update(P){if(!o)return!1;let O=!1;if(p){let I=Se((P-l)/Ya,0,1),F=1-Ka(I);a=m[0]*F,s=m[1]*F,I>=1?(p=!1,a=0,s=0):O=!0}if(f){let I=Se((P-d)/Ya,0,1);i=c+(u-c)*Ka(I),I>=1?(f=!1,i=u,C()):O=!0}return E(),O},currentStop:g,dispose(){_(),t.removeEventListener("pointerdown",A),t.removeEventListener("pointermove",N),t.removeEventListener("pointerup",w),t.removeEventListener("pointercancel",w),t.removeEventListener("wheel",T)}}}function Qa(e){return e.flying?"cinematic":e.panoramaMounted?"panorama":e.seatViewActive?"seatView":"orbit"}var Oo=null;function us(){return Oo??=Promise.resolve().then(()=>(ls(),cs)).catch(e=>{throw Oo=null,e}),Oo}var ms=()=>typeof performance<"u"&&performance.now?performance.now():Date.now(),On=class{constructor(t){this.orbitLatched=!1;this.panoramaOpenedAt=0;this.cb=t}emit(t,n){if(this.cb)try{this.cb(t,n)}catch{}}opened(t,n,r,o){this.emit("3d_opened",{seats:t,hasHeights:n,...r===void 0?{}:{buildMs:Math.round(r)},...o===void 0?{}:{prepSource:o}})}orbitEngaged(){this.orbitLatched||(this.orbitLatched=!0,this.emit("3d_orbit_engaged"))}seatPicked(t,n){this.emit("3d_seat_picked",{seatId:t,sectionId:n})}cinematicPlayed(t){this.emit("3d_cinematic_played",{durationMs:t,reducedMotion:!1})}cinematicSkipped(){this.emit("3d_cinematic_skipped",{reducedMotion:!0})}cinematicCancelled(){this.emit("3d_cinematic_cancelled")}panoramaOpened(){this.panoramaOpenedAt=ms(),this.emit("3d_panorama_opened")}panoramaClosed(){let t=this.panoramaOpenedAt?Math.round(ms()-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 ds(e){let t=e.style.position;return getComputedStyle(e).position!=="static"?()=>{}:(e.style.position="relative",()=>{e.style.position==="relative"&&(e.style.position=t)})}function fs(e){let{container:t,model:n,opts:r,expandedSeatById:o,seatIdsByRow:i,isNarrow:a}=e,s=null,c=()=>{if(!s)return;let f=a();Object.assign(s.style,f?{left:"12px",right:"12px",bottom:"70px",transform:"none",justifyContent:"center"}:{left:"50%",right:"auto",bottom:"18px",transform:"translateX(-50%)",justifyContent:"initial"})},u=()=>{s?.remove(),s=null};return{show:(f,m,l=!1)=>{if(u(),e.isDisposed())return null;let p=document.createElement("div");p.setAttribute("role","group"),Object.assign(p.style,{position:"absolute",display:"flex",flexDirection:"column",alignItems:"center",gap:"6px",zIndex:"4"});let h=r.chrome?.caption!==!1,b=r.chrome?.seatStepper!==!1;if(!h&&!b)return null;let y=o.get(f),v=y?.sectionId?n.sections.find(D=>D.id===y.sectionId):void 0,S=y?.label??f;p.setAttribute("aria-label",`Explore views near ${v?.label?`${v.label}, `:""}seat ${S}`);let M=document.createElement("span");M.textContent=r.seatViewCaption?.(f)??["Live 3D seat view",v?.label,S].filter(Boolean).join(" \xB7 "),Object.assign(M.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)"}),h&&p.appendChild(M);let R=document.createElement("div");Object.assign(R.style,{display:"flex",alignItems:"center",justifyContent:"center",gap:"6px"}),p.appendChild(R);let x=y?.rowId?i.get(y.rowId):void 0,g=x?.indexOf(f)??-1,C=g>=0?[x?.[g-1],x?.[g+1]]:[void 0,void 0],E=(D,B,L,A=!1)=>{let k=document.createElement("button");k.type="button",k.textContent=D,k.setAttribute("aria-label",B),Object.assign(k.style,{minHeight:"44px",padding:A?"10px 16px":"10px",borderRadius:"999px",background:"rgba(12,18,32,0.78)",color:"#eef1f8",border:"1px solid rgba(150,165,205,0.4)",backdropFilter:"blur(6px)",font:"600 13px/1 inherit",cursor:"pointer",whiteSpace:"nowrap"}),A||(k.style.minWidth="44px"),A&&(k.dataset.panoramaTrigger=""),k.addEventListener("click",L),R.appendChild(k)};if(b&&C[0]){let D=o.get(C[0])?.label??C[0];E("\u2039",`View previous seat ${D}`,()=>{e.flyToSeat(C[0])})}if(b&&r.getSeatView){let D=r.seatViewActionLabel?.(f)??"Open 360\xB0 panorama";E(l?`\u21BB Retry ${D}`:`\u25C9 ${D}`,`${l?"Retry":D} from seat ${S}`,()=>{if(e.isDisposed()||m!==e.flightGen()){u();return}u(),e.openPanorama(f,400,m)},!0)}if(b&&C[1]){let D=o.get(C[1])?.label??C[1];E("\u203A",`View next seat ${D}`,()=>{e.flyToSeat(C[1])})}return!R.childElementCount&&!h?null:(t.appendChild(p),s=p,c(),p)},remove:u,layout:c}}var fd={rotate:"Drag to rotate the venue",move:"Drag to move the venue",zoomIn:"Zoom in",zoomOut:"Zoom out",fitView:"Show whole venue"};function ps(e){let{container:t,orbit:n,isNarrow:r}=e,o={...fd,...e.labels??{}},i=(S,M)=>{S.setAttribute("aria-label",M),S.title=M},a=document.createElement("div"),s=!1;a.className="sl-3d-navigation-controls",Object.assign(a.style,{position:"absolute",right:"14px",bottom:"14px",display:"flex",zIndex:"4",flexDirection:"column",alignItems:"flex-end",gap:"7px"});let c=document.createElement("div");c.setAttribute("role","group"),c.setAttribute("aria-label","3D drag mode"),Object.assign(c.style,{display:"flex",flexDirection:"column",gap:"6px",alignItems:"flex-end"});let u=document.createElement("div");u.setAttribute("role","group"),u.setAttribute("aria-label","3D view controls"),Object.assign(u.style,{display:"flex",flexDirection:"column",gap:"6px",alignItems:"flex-end"});let d=document.createElement("button");d.type="button",d.textContent="\u21BB",i(d,o.rotate);let f=document.createElement("button");f.type="button",f.textContent="\u2725",i(f,o.move);let m=document.createElement("button");m.type="button",m.textContent="\u2212",i(m,o.zoomOut);let l=document.createElement("button");l.type="button",l.textContent="+",i(l,o.zoomIn);for(let S of[d,f,m,l])S.className="sl-3d-icon-control",Object.assign(S.style,{width:"44px",minWidth:"44px",minHeight:"44px",padding:"9px",border:"1px solid rgba(150,165,205,0.35)",borderRadius:"999px",color:"#c9d4ea",background:"rgba(12,18,32,0.82)",font:"600 17px/1 inherit",backdropFilter:"blur(6px)",cursor:"pointer",whiteSpace:"nowrap"});c.append(d,f),u.append(l,m);let p=S=>{n.setPrimaryDragMode(S);let M=S==="orbit";d.setAttribute("aria-pressed",String(M)),f.setAttribute("aria-pressed",String(!M)),d.style.background=M?"rgba(96,110,150,0.68)":"rgba(12,18,32,0.82)",f.style.background=M?"rgba(12,18,32,0.82)":"rgba(96,110,150,0.68)",a.title=M?`${o.rotate} \xB7 ${o.move} with Shift`:`${o.move} \xB7 ${o.rotate} with Shift`};d.addEventListener("click",()=>p("orbit")),f.addEventListener("click",()=>p("pan"));let h=()=>{let{atMin:S,atMax:M}=n.dollyLimitState();l.disabled!==S&&(l.disabled=S),m.disabled!==M&&(m.disabled=M)};m.addEventListener("click",()=>{n.zoomBy(Tt),h()}),l.addEventListener("click",()=>{n.zoomBy(pt),h()}),a.append(c,u),p("orbit"),t.appendChild(a);let b=e.enabled!==!1,y=()=>{let S=r();a.style.display=s||!b?"none":"flex",a.style.right=S?"12px":"14px",a.style.bottom=S?"calc(env(safe-area-inset-bottom, 0px) + 76px)":"14px",c.style.display=S?"none":"flex",l.style.display=S?"none":"",m.style.display=S?"none":""};return y(),{element:a,utilityControls:u,setNavigationMode:p,syncZoomLimits:h,setSeatViewLocked:S=>{s=S,n.setInteractionEnabled(!S),y()},seatViewLocked:()=>s,layout:y}}var pd=12;function hd(e,t){if(!e)return!1;let n=e.x-t[0],r=e.y-t[1],o=e.z-t[2];return Math.hypot(n,r,o)>pd}function hs(e){let{glctx:t,orbit:n,model:r,seats:o,opts:i,cinematic:a,analytics:s,seatIdByIndex:c,sectionIdBySeatId:u,tapSlop:d,tapMs:f,cancelFlight:m,focusSectionCamera:l,setSelection:p,ensureSeatView:h}=e,b=0,y=0,v=0,S=-1,M=!1,R=!1,x=B=>{e.seatViewLocked()||S===-1&&(S=B.pointerId,b=B.clientX,y=B.clientY,v=performance.now(),M=!1,R=a.active,a.active&&(s.cinematicCancelled(),m(),i.onViewTargetChange?.(null)))},g=B=>{B.pointerId===S&&Math.hypot(B.clientX-b,B.clientY-y)>d&&(M=!0)},C=(B,L,A,k,N)=>{let w=t.canvas.getBoundingClientRect(),T=t.canvas.clientWidth||w.width||1,_=t.canvas.clientHeight||w.height||1,P=B-w.left,O=L-w.top,I=k*k,F=-1,H=I,j=1/0;for(let G of o){if(A&&G.sectionId!==A)continue;let V=r.seats.idToIndex.get(G.id);if(V===void 0)continue;if(N){let Z=Math.round(r.seats.iState[V]??0);if(Z!==0&&Z!==3)continue}let W=V*3,X=Ye(n.camera.projectionViewMatrix,[r.seats.iPosition[W],r.seats.iPosition[W+1]+.55,r.seats.iPosition[W+2]],T,_);if(!X.visible)continue;let Q=X.x-P,q=X.y-O,K=Q*Q+q*q;(K<H||Math.abs(K-H)<1&&X.depth<j)&&(F=V,H=K,j=X.depth)}return F},E=(B,L)=>{let A=e.gpu(),k=e.pick();if(!A||!k)return-1;k.syncFromSeatProgram(A.seatProgram);let N=t.canvas.getBoundingClientRect(),w=t.renderer.dpr,{x:T,y:_}=Sa(B,L,N,w,t.gl.drawingBufferWidth,t.gl.drawingBufferHeight),P=Math.max(2,Math.round(8*w));return k.pick(n.camera,T,_,P)};return{onDown:x,onMove:g,onUp:B=>{if(B.pointerId!==S)return;let L=!M&&performance.now()-v<f;if(S=-1,R){R=!1;return}let A=e.gpu(),k=e.pick();if(!L||!A||!k)return;let N=E(B.clientX,B.clientY);if(e.focusedSectionId()&&N>=0){let _=c[N],P=_?u.get(_):void 0;if(P&&P!==e.focusedSectionId()&&l(P))return}if(e.focusedSectionId()&&N<0&&(N=C(B.clientX,B.clientY,e.focusedSectionId(),44,!1)),e.focusedSectionId()&&N<0){let _=C(B.clientX,B.clientY,null,72,!1),P=_>=0?c[_]:void 0,O=P?u.get(P):void 0;if(O&&O!==e.focusedSectionId()&&l(O))return}if(!e.focusedSectionId()){N<0&&(N=C(B.clientX,B.clientY,null,42,!1));let _=N>=0?c[N]:void 0,P=_?u.get(_):void 0;if(P&&l(P))return}if(N<0||N>=c.length){e.selection().size&&(p([]),i.onViewTargetChange?.(null));return}let w=c[N],T=pe[Math.round(r.seats.iState[N]??0)]??"available";if(T!=="available"&&T!=="selected"){i.onSeatInspect?.(w,T);return}if(e.selection().has(w)&&e.selection().size===1){p([]),i.onViewTargetChange?.(null),i.onSeatPick?.(w);return}if(p([w]),h(w),s.seatPicked(w,u.get(w)),i.onSeatPick?.(w),e.focusedSectionId()){let _=N*3,P=[r.seats.iPosition[_],r.seats.iPosition[_+1],r.seats.iPosition[_+2]];hd(n.camera?.position,P)&&e.focusSeatCamera(w)}}}}var Vn=class{constructor(t,n){this.minX=0;this.minZ=0;this.cell=1;this.cols=1;this.rows=1;this.cellStart=null;this.cellItems=null;this.iPosition=t,this.count=n}ensureGrid(){if(this.cellStart||this.count===0)return;let t=this.iPosition,n=1/0,r=1/0,o=-1/0,i=-1/0;for(let l=0;l<this.count;l++){let p=t[l*3],h=t[l*3+2];p<n&&(n=p),p>o&&(o=p),h<r&&(r=h),h>i&&(i=h)}let a=Math.max(o-n,.001),s=Math.max(i-r,.001);this.cell=Math.max(Math.sqrt(a*s*4/this.count),.25),this.cols=Math.max(1,Math.ceil(a/this.cell)+1),this.rows=Math.max(1,Math.ceil(s/this.cell)+1),this.minX=n,this.minZ=r;let c=this.cols*this.rows,u=new Int32Array(c+1),d=l=>{let p=Math.min(this.cols-1,Math.max(0,Math.floor((t[l*3]-n)/this.cell)));return Math.min(this.rows-1,Math.max(0,Math.floor((t[l*3+2]-r)/this.cell)))*this.cols+p};for(let l=0;l<this.count;l++)u[d(l)+1]++;for(let l=0;l<c;l++)u[l+1]+=u[l];let f=new Int32Array(this.count),m=u.slice(0,c);for(let l=0;l<this.count;l++)f[m[d(l)]++]=l;this.cellStart=u,this.cellItems=f}gather(t,n,r,o){this.ensureGrid();let i=this.cellStart,a=this.cellItems;if(!i||!a)return 0;let s=o.length,c=r*r,u=Math.floor((t-this.minX)/this.cell),d=Math.floor((n-this.minZ)/this.cell),f=Math.ceil(r/this.cell)+1,m=this.iPosition,l=0;for(let p=0;p<=f&&l<s;p++){let h=d-p,b=d+p,y=u-p,v=u+p;for(let S=h;S<=b&&l<s;S++){if(S<0||S>=this.rows)continue;let M=S===h||S===b;for(let R=y;R<=v&&l<s;R++){if(!M&&R!==y&&R!==v){R=v-1;continue}if(R<0||R>=this.cols)continue;let x=S*this.cols+R;for(let g=i[x],C=i[x+1];g<C&&l<s;g++){let E=a[g],D=m[E*3]-t,B=m[E*3+2]-n;D*D+B*B<=c&&(o[l++]=E)}}}}return l}};var Bn=class{constructor(t){this.ctx=t;this.detailVisible=!1;this.seatDetailMix=0;this.structureDetailMix=0;this.nearBuf=new Int32Array(en);this.lastGatherX=1/0;this.lastGatherZ=1/0;this.nearIndex=new Vn(t.model.seats.iPosition,t.model.seats.count)}forceRegather(){this.lastGatherX=1/0}setDetailEnabled(t){let n=this.ctx.gpu();t||(this.detailVisible=!1),this.lastGatherX=1/0,this.lastGatherZ=1/0,!t&&n?.nearSeatCount()&&n.setNearSeats(this.nearBuf,0)}update(t){let{model:n}=this.ctx,r=this.ctx.gpu();if(!r)return;if(!t){r.nearSeatCount()&&r.setNearSeats(this.nearBuf,0);return}let o=this.ctx.orbit().camera.position;if(Math.hypot(o.x-this.lastGatherX,o.z-this.lastGatherZ)<Kn)return;if(this.lastGatherX=o.x,this.lastGatherZ=o.z,Math.hypot(o.x-n.bounds.center[0],o.z-n.bounds.center[2])-n.bounds.radius>Wn){r.nearSeatCount()&&r.setNearSeats(this.nearBuf,0);return}let s=this.nearIndex.gather(o.x,o.z,Wn,this.nearBuf);s===0&&r.nearSeatCount()===0||r.setNearSeats(this.nearBuf,s)}ease(t,n,r){let o=1-Math.exp(-t*9),i=1-Math.exp(-t*20);this.seatDetailMix+=(n-this.seatDetailMix)*(n>this.seatDetailMix?o:i),this.structureDetailMix+=(r-this.structureDetailMix)*(r>this.structureDetailMix?o:i),Math.abs(n-this.seatDetailMix)<.01&&(this.seatDetailMix=n),Math.abs(r-this.structureDetailMix)<.01&&(this.structureDetailMix=r)}};var Nn=require("ogl");function bs(){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 xs(e){let{container:t,model:n,opts:r,orbit:o,cinematic:i,analytics:a,loop:s,labelOverlay:c,stageAzimuth:u,overviewFraming:d}=e,f=0,m=-1,l=(g,C,E=28)=>{o.camera.position.set(g[0],g[1],g[2]),o.camera.lookAt(new Nn.Vec3(C[0],C[1],C[2])),o.camera.fov=E,o.camera.updateProjectionMatrix()},p=document.createElement("button");p.className="sl-3d-overview-control sl-3d-icon-control",p.type="button",p.replaceChildren(bs());let h=r.navLabels?.fitView??"Show whole venue";p.setAttribute("aria-label",h),p.title=h,Object.assign(p.style,{width:"44px",minWidth:"44px",minHeight:"44px",padding:"9px",borderRadius:"999px",background:"rgba(12,18,32,0.72)",color:"#c9d4ea",border:"1px solid rgba(150,165,205,0.35)",backdropFilter:"blur(6px)",font:"600 11px/1 inherit",cursor:"pointer",whiteSpace:"nowrap"});let b=()=>{p.firstElementChild||p.replaceChildren(bs())};b();let y=g=>{m=g;let C=e.gpu();C&&(C.seatProgram.uniforms.uFocusFloor.value=g,C.solidProgram.uniforms.uFocusFloor.value=g,C.chairProgram.uniforms.uFocusFloor.value=g),e.showSectionSeatLabels(null)},v=()=>{if(e.isDisposed())return;r.onViewTargetChange?.(null),r.onSectionFocusChange?.(null),e.panorama()&&(e.panorama().dispose(),e.setPanorama(null),a.panoramaClosed()),e.setPanoramaSphereVisible(!1),e.panoramaLoadAbort()?.abort(),e.setPanoramaLoadAbort(null),e.restorePanoramaLayer(),p.style.display="",c.setVisible(!0),e.setFrozen(!1);let g=m>=0?n.floors[m]:null;if(e.setNearFieldDetailEnabled(!!g),e.setSeatViewLocked(!1),S(),e.removeArriveChip(),e.setNavigationMode("orbit"),g){let C=g.focalWorld[0]-g.center[0],E=g.focalWorld[2]-g.center[2],D=Math.hypot(C,E)>g.radius*.12?Math.atan2(C,E):u,B={center:g.center,radius:g.radius,box:g.box},L={polarDeg:58,margin:1.12};e.reducedMotion()?o.frame(B,!1,D,!1,L):o.frameSoft(B,D,!1,L)}else e.reducedMotion()?o.frame(n.bounds,!1,u,r.portraitOverviewCrop===!0,d):o.frameSoft(n.bounds,u,r.portraitOverviewCrop===!0,d);e.showSectionSeatLabels(null),s.requestRender()},S=()=>{f++,e.setSeatStepping(!1),e.panoramaLoadAbort()?.abort(),e.setPanoramaLoadAbort(null),i.active&&(i.cancel(),o.resumeAfterFlight(n.focalWorld))},M=g=>{if(e.isDisposed()||!e.gpu())return Promise.resolve();let C=n.seats.idToIndex.get(g);if(C===void 0)return Promise.resolve();e.setNearFieldDetailEnabled(!0),r.onViewTargetChange?.(g),e.panorama()&&(e.panorama().dispose(),e.setPanorama(null),e.setPanoramaSphereVisible(!1),p.style.display="",e.restorePanoramaLayer()),e.panoramaLoadAbort()?.abort(),e.setPanoramaLoadAbort(null),e.setFrozen(!1);let E=e.inSeatView()&&r.arriveAtSeatEye===!0;e.setSeatStepping(E),e.setSeatViewLocked(!1);let D=++f;E?e.showArriveChip(g,D):e.removeArriveChip();let{eye:B,focal:L}=e.resolvedSeatViewPose(g,C),A=r.arriveAtSeatEye?e.seatViewArrival(g,C):null,k=A?A.focal:L,N=[o.camera.position.x,o.camera.position.y,o.camera.position.z],w=To(N,A?.eye??B,k,n.bounds.center,n.bounds.radius),T=A?A.eye:r.arriveAtSeatEye?B:w.finalPos,_=A?A.fov:r.arriveAtSeatEye?t.clientWidth/Math.max(1,t.clientHeight)<.7?Rn:65:28,P=[w.waypoints[0],w.waypoints[1],T];if(c.setVisible(!1),e.reducedMotion())return e.setSeatStepping(!1),l(T,k,_),s.requestRender(),a.cinematicSkipped(),e.isDisposed()||o.syncFromCamera(),e.setSeatViewLocked(r.arriveAtSeatEye===!0),A&&e.enterSeatView(A.stops),e.showArriveChip(g,D),Promise.resolve();let O=new Nn.Quat().copy(o.camera.quaternion),I=Ta(o.camera,T,k);s.requestRender();let F=E?700:2500;return i.start(P,O,I,F,_).then(()=>{e.isDisposed()||D!==f||(e.setSeatStepping(!1),a.cinematicPlayed(F),o.resumeAfterFlight(k),e.setSeatViewLocked(r.arriveAtSeatEye===!0),A&&e.enterSeatView(A.stops),s.requestRender(),e.showArriveChip(g,D))})},R=g=>{let C=n.sections.find(L=>L.id===g);if(!C||C.seatCount===0)return!1;e.setNearFieldDetailEnabled(!0),e.setSeatStepping(!1),e.setSeatViewLocked(!1),i.cancel(),e.removeArriveChip(),n.floors.length>1&&m!==C.floorIndex&&y(C.floorIndex),e.setNavigationMode("pan"),e.showSectionSeatLabels(g);let E=C.focalWorld[0]-C.center[0],D=C.focalWorld[2]-C.center[2],B=Math.hypot(E,D)>C.radius*.12?Math.atan2(E,D):void 0;return o.frame({center:C.center,radius:Math.max(5,C.radius*.5)},!1,B),r.onSectionFocusChange?.(g),s.requestRender(),!0},x=g=>{if(e.isDisposed()||!e.gpu())return!1;let C=n.seats.idToIndex.get(g);if(C===void 0)return!1;let E=C*3,D=[n.seats.iPosition[E],n.seats.iPosition[E+1]+.55,n.seats.iPosition[E+2]];return e.reducedMotion()?o.frame({center:D,radius:ys},!1,void 0,!1,gs):o.frameSoft({center:D,radius:ys},void 0,!1,gs),s.requestRender(),!0};return p.addEventListener("click",v),{overviewChip:p,layoutOverviewChip:b,flightGen:()=>f,focusedFloor:()=>m,applyFloorFocus:y,placeCameraFinal:l,cancelFlight:S,focusOverview:v,flyToSeat:M,focusSectionCamera:R,focusSeatCamera:x}}var ys=4.5,gs={polarDeg:48,margin:1.25};var yd={};function vs(e){let t=performance.now();return{model:St(e),buildMs:performance.now()-t,source:"main"}}function bd(e){let t=qr(e.doc);return{...vs({...e,seats:t}),seats:t}}function Ss(e,t,n){if(typeof Worker>"u")return Promise.resolve(t());let r;try{r=new Worker(new URL("./scene/scene.worker.js",yd.url),{type:"module"})}catch{return Promise.resolve(t())}return new Promise(o=>{let i=!1,a=u=>{i||(i=!0,clearTimeout(c),r.terminate(),o(u))},s=()=>a(t()),c=window.setTimeout(s,15e3);r.onerror=s,r.onmessage=u=>{let d=n(u.data);d?a(d):s()},r.postMessage(e)})}function Ms(e){return Ss(e,()=>vs(e),({model:t,buildMs:n})=>({model:t,buildMs:n,source:"worker"}))}function ws(e){return Ss(e,()=>bd(e),({model:t,buildMs:n,seats:r})=>r?{model:t,buildMs:n,seats:r,source:"worker"}:null)}var gd=Math.PI/180,xd=6,vd=500;function Sd(e,t,n={}){let r=performance.now(),o=t.prepared?.model??St(t),i=new On(n.onAnalytics),a=new Array(o.seats.count);for(let[U,Y]of o.seats.idToIndex)a[Y]=U;let s=new Map(t.seats.map(U=>[U.id,U])),c=new Map;for(let U of t.seats){if(!U.rowId)continue;let Y=c.get(U.rowId);Y?Y.push(U.id):c.set(U.rowId,[U.id])}let u=new Map;for(let U of t.seats)u.set(U.id,U.sectionId);let d=new Map;for(let[U,Y]of o.seats.idToIndex){let $=u.get(U);if(!$)continue;let ee=d.get($);ee?ee.push(Y):d.set($,[Y])}let f=()=>{if(!l||!o.sectionSolidRanges.length)return;let{lit:U,anyUnlit:Y}=ba(o.sectionSolidRanges,d,o.seats.iState);l.setSectionShellLit(Y?U:null)},m=t.doc.floors?.some(Y=>(Y.baseHeightM??0)>0)?!0:(t.doc.floors?.flatMap(Y=>Y.objects)??t.doc.objects).some(Y=>Y.type==="section"&&((Y.height??0)>0||(Y.rake??0)>0)),l=null,p=null,h=!1,b=!1,y=!1,v=new Map,S=null,M=null,R=null,x=new Map,g=null,C=()=>{R===null&&(R=e.style.zIndex,e.style.zIndex="20")},E=()=>{R!==null&&(e.style.zIndex==="20"&&(e.style.zIndex=R),R=null)},D=!1,B=()=>D?fe.focusedFloor():-1,L=()=>{l=xa(w.gl,o),f(),p=new Cn(w.renderer,l.seatGeometry,l.chairGeometry,l.solidGeometry,o.seats.count),w.setClearColor(o.theme.background.top),p.setRestoreClear(o.theme.background.top),l.seatProgram.uniforms.uSeatRadius.value=De*o.theme.seatScale,l.seatProgram.uniforms.uFocusFloor.value=B(),l.solidProgram.uniforms.uFocusFloor.value=B(),l.chairProgram.uniforms.uFocusFloor.value=B(),l.screenProgram&&(l.screenProgram.uniforms.uFocusFloor.value=B()),k.forceRegather()},A=!1,k=new Bn({model:o,orbit:()=>T,gpu:()=>l}),N=U=>k.setDetailEnabled(U),w=new Qt(e,{onContextLost:()=>{y||i.contextLost(),h=!0,K.stop(),l=null,p=null},onContextRestored:()=>{L(),h=!1,y||i.contextRestored(),K.requestRender()}}),T=new Zt(w.gl,w.canvas,()=>K.requestRender(),()=>i.orbitEngaged());T.setAspect(w.aspect);let _=(t.doc.floors?.flatMap(U=>U.objects)??t.doc.objects).some(U=>U.type==="section"&&U.physical3dProvenance?.surfaceKind?.status==="inferred"),P=(()=>{if(_&&o.stages.length===0)return;let U=o.focalWorld[0]-o.bounds.center[0],Y=o.focalWorld[2]-o.bounds.center[2];return Math.hypot(U,Y)>o.bounds.radius*.12?Math.atan2(U,Y):void 0})(),O=o.floors.length>1?{polarDeg:48,margin:1.1}:{margin:1.1},I=typeof window<"u"&&!!window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches;T.frame(o.bounds,!I&&n.skipInitialOverviewAnimation!==!0,P,n.portraitOverviewCrop===!0,O);let F=new An(T.camera),H=ds(e),j=new Mn(e,{fontFamily:t.doc.theme?.fontFamily,ink:t.doc.theme?.textColor,backgroundRgb:o.theme.background.top}),G=o.labels,V=()=>Di(G,o.floors.length,B());j.setLabels(V());let W=null,X=U=>{if(W=U,j.setForcedDense(!!U),!U){j.setLabels(V());return}let Y=t.seats.filter(J=>J.sectionId===U),$=new Set(Y.map(J=>J.id)),ee=new Set(Y.map(J=>J.rowId)),re=new Set(v.keys()),ie=new Set(Y.filter(J=>re.has(J.id)).map(J=>J.id)),se=V().filter(J=>J.kind!=="row"&&J.kind!=="seat"||(J.kind==="row"?ee.has(J.id.slice(4)):$.has(J.id.slice(5))&&(ie.size===0||ie.has(J.id.slice(5)))));if(o.seatCount<=6e3&&ie.size===0){j.setLabels(se);return}let me=ie.size?Y.filter(J=>ie.has(J.id)):Y,Qe=new Set(me.map(J=>`seat:${J.id}`)),Ue=me.flatMap(J=>{let ye=o.seats.idToIndex.get(J.id);if(ye===void 0)return[];let Re=ye*3;return[{id:`seat:${J.id}`,kind:"seat",text:re.has(J.id)?J.displayLabel||J.label:Mo(J.displayLabel||J.label),anchor:[o.seats.iPosition[Re],o.seats.iPosition[Re+1]+(re.has(J.id)?1.05:.55),o.seats.iPosition[Re+2]]}]});j.setLabels([...se.filter(J=>!Qe.has(J.id)),...Ue])};L();let Q=null,q=null,K=new Jt(U=>{if(h||!l||b)return!1;let Y=Qa({flying:F.active,panoramaMounted:S!==null,seatViewActive:Q?.active===!0}),$=Y==="cinematic"?F.update(performance.now()):Y==="seatView"?Q.update(performance.now()):Y==="orbit"?T.update():!1;q?.syncZoomLimits();let ee=B()>=0?o.floors[B()]:null,re=ee?.radius??o.bounds.radius,ie=tr(T.currentDistance,re),se=A?{center:[T.camera.position.x,T.camera.position.y,T.camera.position.z],radius:520}:o.renderBounds;T.updateClipping(se);let me=ee?.center??o.renderBounds.center,Qe=ee?.radius??o.renderBounds.radius,Ue=(Ee,At)=>Math.hypot(T.camera.position.x-Ee[0],T.camera.position.y-Ee[1],T.camera.position.z-Ee[2])<=At*(k.detailVisible?1.8:1.55),J=Ue(me,Qe);if(!J&&W){let Ee=o.sections.find(At=>At.id===W);Ee&&(J=Ue(Ee.center,Math.max(12,Ee.radius*2)))}k.detailVisible=J;let ye=l.seatProgram.uniforms;ye.uSeatScale.value=ie.scale,ye.uSeatFade.value=ie.fade;let Re=!!ee&&nr(ee.seatCount,w.canvas.clientWidth||1,w.canvas.clientHeight||1),Wt=or(o.seats.count,re,T.currentDistance,T.camera.fov,w.canvas.clientHeight||1),Ct=k.detailVisible||Re||Wt?1:0,Kt=k.detailVisible||B()>=0||o.floors.length>1?1:0;return k.ease(U,Ct,Kt),ye.uSeatDetail.value=k.seatDetailMix,l.solidProgram.uniforms.uStructureDetail.value=k.structureDetailMix,ye.uMinPixels.value=ie.minPixels,ye.uPixelToWorld.value=2*Math.tan(T.camera.fov*gd/2)/Math.max(1,w.pixelHeight),k.update(k.detailVisible),w.renderer.render({scene:l.background,clear:!0}),w.renderer.render({scene:l.main,camera:T.camera,clear:!1}),j.update(T.camera.projectionViewMatrix,w.canvas.clientWidth||1,w.canvas.clientHeight||1,T.currentDistance,re,[T.camera.position.x,T.camera.position.y,T.camera.position.z]),$||k.seatDetailMix!==Ct||k.structureDetailMix!==Kt}),Z=typeof ResizeObserver<"u"?new ResizeObserver(()=>zn.resize()):null;Z?.observe(e);let te=U=>{let Y=re=>{let ie=o.seats.idToIndex.get(re);return ie===void 0?void 0:o.seats.iState[ie]},{updates:$,next:ee}=wa(v,U,Y);if(v=ee,j.setSelectedSeatIds(v.keys()),W&&X(W),$.length){let re=no(o.seats,$);l&&l.uploadSeatStateRuns(re),f(),K.requestRender()}},Me=()=>g!==null?g:typeof window<"u"&&!!window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,Ae=8,Be=U=>{if(!n.getSeatView)return null;let Y=x.get(U);if(!Y)for(Y=Promise.resolve(n.getSeatView(U)),x.set(U,Y),Y.catch(()=>{x.get(U)===Y&&x.delete(U)});x.size>Ae;){let $=x.keys().next().value;if($===void 0)break;x.delete($)}return Y},ke=za(o.stages,o.focalWorld,o.bounds.groundY??0),Ne=Lo(ke),we=(U,Y)=>{let $=s.get(U),ee=Math.max(0,Math.round(o.seats.iFloor[Y]??0)),re=t.doc.floors?.[ee],ie=o.floors[ee],se=re?.focalPoint??t.doc.focalPoint,me=ie?{x:ie.focalWorld[0]/z,y:ie.focalWorld[2]/z}:se,Qe=$?.focalPoint?{x:$.focalPoint.x+me.x-se.x,y:$.focalPoint.y+me.y-se.y}:me,Ue=[o.seats.iPosition[Y*3],o.seats.iPosition[Y*3+1],o.seats.iPosition[Y*3+2]];return La(Ue,Qe,re?.baseHeightM??0,$?.eyeHeightM,Ne)},de=()=>(e.clientWidth||w.canvas.clientWidth)<=520,Ge=null,ct=null,lt=async(U,Y,$)=>{if(!n.getSeatView||y||$!==fe.flightGen())return;let ee;try{ee=await us()}catch{if(i.panoramaFailed(U,"mount"),!y&&$===fe.flightGen()){let re=qe(U,$,!0);requestAnimationFrame(()=>re?.querySelector("[data-panorama-trigger]")?.focus())}return}if(!(y||$!==fe.flightGen()||!Ge))return ct??=ee.createOpenPanorama(Ge),ct(U,Y,$)},Fe=fs({container:e,model:o,opts:n,expandedSeatById:s,seatIdsByRow:c,isNarrow:de,isDisposed:()=>y,flightGen:()=>fe.flightGen(),flyToSeat:U=>No(U),openPanorama:(U,Y,$)=>lt(U,Y,$)}),qe=Fe.show,ut=Fe.remove,Ps=Fe.layout,$e=ps({container:e,orbit:T,isNarrow:de,enabled:n.chrome?.controlDock!==!1,...n.navLabels?{labels:n.navLabels}:{}});q=$e;let Cs=$e.element,wt=$e.setNavigationMode,As=$e.layout,Rs=$e.utilityControls,Pt=null,Vo=!1,Xt=U=>{$e.setSeatViewLocked(U),U||Q?.exit()};Q=$a({canvas:w.canvas,camera:T.camera,requestRender:()=>K.requestRender(),reducedMotion:Me,onStopChange:U=>{let Y=U??(Vo?"seat":null);Pt=Y;try{n.onSeatViewStopChange?.(Y)}catch{}},onApplied:()=>{y||T.syncFromCamera()}});let Es=(U,Y)=>{let{eye:$}=we(U,Y),ee=(e.clientWidth||w.canvas.clientWidth||1)/Math.max(1,e.clientHeight||w.canvas.clientHeight||1),re=Ha($,ke,ee);if(n.seatViewStops===!1)return{...re,stops:[]};let ie=u.get(U),se=ie?o.sections.find(me=>me.id===ie):void 0;return{...re,stops:ja(re,{aspect:ee,section:se&&se.seatCount>0?{center:se.center,radius:se.radius}:null,venue:{center:o.bounds.center,radius:o.bounds.radius}})}},fe=xs({container:e,model:o,opts:n,orbit:T,cinematic:F,analytics:i,loop:K,labelOverlay:j,stageAzimuth:P,overviewFraming:O,gpu:()=>l,isDisposed:()=>y,panorama:()=>S,setPanorama:U=>{S=U},setPanoramaSphereVisible:U=>{A=U},panoramaLoadAbort:()=>M,setPanoramaLoadAbort:U=>{M=U},setFrozen:U=>{b=U},restorePanoramaLayer:E,reducedMotion:Me,resolvedSeatViewPose:we,showSectionSeatLabels:X,setNearFieldDetailEnabled:N,setSeatViewLocked:Xt,setNavigationMode:wt,showArriveChip:qe,removeArriveChip:ut,inSeatView:()=>Pt!==null,setSeatStepping:U=>{Vo=U},seatViewArrival:(U,Y)=>n.arriveAtSeatEye?Es(U,Y):null,enterSeatView:U=>Q?.enter(U)});D=!0;let Gn=fe.overviewChip,Is=fe.layoutOverviewChip,Ts=fe.applyFloorFocus,_s=fe.focusOverview,Bo=fe.cancelFlight,No=fe.flyToSeat,Go=fe.focusSectionCamera;Rs.appendChild(Gn),Ge={container:e,model:o,opts:n,analytics:i,orbit:T,loop:K,seatsById:s,ensureSeatView:Be,resolvedSeatViewPose:we,gpu:()=>l,gl:w.gl,isContextLost:()=>h,isDisposed:()=>y,flightGen:()=>fe.flightGen(),setPanorama:U=>{S=U},getLoadAbort:()=>M,setLoadAbort:U=>{M=U},setPanoramaSphereVisible:U=>{A=U,U&&Q?.exit()},setFrozen:U=>{b=U},raisePanoramaLayer:C,restorePanoramaLayer:E,getOverviewChip:()=>Gn,labelOverlay:j,reducedMotion:Me,removeArriveChip:ut,showArriveChip:qe};let ze=hs({glctx:w,orbit:T,model:o,seats:t.seats,opts:n,cinematic:F,analytics:i,seatIdByIndex:a,sectionIdBySeatId:u,tapSlop:xd,tapMs:vd,gpu:()=>l,pick:()=>p,seatViewLocked:()=>$e.seatViewLocked(),focusedSectionId:()=>W,selection:()=>v,cancelFlight:Bo,focusSectionCamera:Go,focusSeatCamera:fe.focusSeatCamera,setSelection:te,ensureSeatView:Be});w.canvas.addEventListener("pointerdown",ze.onDown),w.canvas.addEventListener("pointermove",ze.onMove),w.canvas.addEventListener("pointerup",ze.onUp),w.canvas.addEventListener("pointercancel",ze.onUp),K.requestRender();let zn={setAvailability(U){let Y=Ma(v,U),$=no(o.seats,Y);$.length&&l&&l.uploadSeatStateRuns($),f(),K.requestRender()},setSelection:te,setNavigationMode:wt,zoomIn(){T.zoomBy(pt),K.requestRender()},zoomOut(){T.zoomBy(Tt),K.requestRender()},flyToSeat:No,focusOverview:_s,seatViewStop:()=>Pt,recentreSeatView:()=>Q?.recentre()??!1,resize(){let{width:U,height:Y}=w.resize();T.setAspect(U/Math.max(1,Y)),Ps(),As(),Is(),K.requestRender()},stats(){return{...K.stats(),drawCalls:l?l.drawCalls:0,seatCount:o.seatCount}},getQualityEvidence(){let U=K.stats(),Y=w.canvas.clientWidth||1,$=w.canvas.clientHeight||1,ee=o.bounds.center,re=Ye(T.camera.projectionViewMatrix,[ee[0],o.bounds.box.min[1],ee[2]],Y,$),ie=Ye(T.camera.projectionViewMatrix,[ee[0],o.bounds.box.max[1],ee[2]],Y,$),se=o.bounds.box,me=[se.min[0],se.max[0]].flatMap(J=>[se.min[1],se.max[1]].flatMap(ye=>[se.min[2],se.max[2]].map(Re=>Ye(T.camera.projectionViewMatrix,[J,ye,Re],Y,$)))).filter(J=>Number.isFinite(J.x)&&Number.isFinite(J.y)&&Number.isFinite(J.depth)),Qe=me.length?(()=>{let J=Math.min(...me.map(Ze=>Ze.x)),ye=Math.max(...me.map(Ze=>Ze.x)),Re=Math.min(...me.map(Ze=>Ze.y)),Wt=Math.max(...me.map(Ze=>Ze.y)),Ct=Math.max(0,J),Kt=Math.min(Y,ye),Ee=Math.max(0,Re),At=Math.min($,Wt),qt=Math.max(0,Kt-Ct),Un=Math.max(0,At-Ee);return{box:{x:Ct,y:Ee,width:qt,height:Un},horizontalFillRatio:qt/Y,verticalFillRatio:Un/$,visibleAreaRatio:qt*Un/(Y*$),clippedEdges:[...Re<0?["top"]:[],...ye>Y?["right"]:[],...Wt>$?["bottom"]:[],...J<0?["left"]:[]]}})():void 0,Ue=String(w.gl.getParameter(w.gl.VERSION)??"");return{viewport:{width:Y,height:$},context:{webgl2:/webgl\s*2/i.test(Ue),lost:h},frame:{rendered:U.rendered,idle:U.idle},camera:{position:[T.camera.position.x,T.camera.position.y,T.camera.position.z],distance:T.currentDistance,verticalFovDeg:T.fovY},scene:{seatCount:o.seatCount,floorCount:o.floors.length,zoneCount:o.zones.length,sectionCount:o.sections.length,authoredRelief:m,renderedVerticalSpanM:Math.max(0,o.bounds.box.max[1]-o.bounds.box.min[1]),projectedReliefPx:re.visible&&ie.visible?Math.abs(re.y-ie.y):0},labels:j.qualityEvidence(),framing:Qe,...Pt?{seatView:{fovDeg:T.camera.fov,stop:Pt}}:{}}},getQualityReport(){return wn(zn.getQualityEvidence())},loseContextForTest(){w.simulateContextLossCycle()},floors(){return o.floors},focusFloor(U){if(U!==null&&!o.floors.some($=>$.index===U))return!1;let Y=U??-1;if(N(U!==null),Xt(!1),Ts(Y),wt("orbit"),U===null)F.cancel(),Me()?T.frame(o.bounds,!1,P,n.portraitOverviewCrop===!0,O):T.frameSoft(o.bounds,P,n.portraitOverviewCrop===!0,O);else{let $=o.floors[U];if($.seatCount>0){F.cancel();let ee=$.focalWorld[0]-$.center[0],re=$.focalWorld[2]-$.center[2],ie=Math.hypot(ee,re)>$.radius*.12?Math.atan2(ee,re):P;T.frame({center:$.center,radius:$.radius,box:$.box},!1,ie,!1,{polarDeg:58,margin:1.12})}}return K.requestRender(),!0},zones(){return o.zones},focusZone(U){let Y=o.zones.find(ie=>ie.id===U);if(!Y||Y.seatCount===0)return!1;N(!1),Xt(!1),F.cancel(),wt("orbit"),X(null),n.onSectionFocusChange?.(null);let $=Y.focalWorld[0]-Y.center[0],ee=Y.focalWorld[2]-Y.center[2],re=Math.hypot($,ee)>Y.radius*.12?Math.atan2($,ee):void 0;return T.frame({center:Y.center,radius:Y.radius*1.25},!1,re),K.requestRender(),!0},sections(){return o.sections},focusSection(U){return Go(U)},rows(U){return U?o.rows.filter(Y=>Y.sectionId===U):o.rows},seatsInRow(U){return t.seats.filter(Y=>Y.rowId===U).map(Y=>({id:Y.id,label:Y.displayLabel||Y.label}))},focusRow(U){let Y=o.rows.find($=>$.id===U);return!Y||Y.seatCount===0?!1:(N(!0),Xt(!1),F.cancel(),wt("pan"),Y.sectionId&&(X(Y.sectionId),n.onSectionFocusChange?.(Y.sectionId)),T.frame({center:Y.center,radius:Math.max(2.5,Y.radius*.65)}),K.requestRender(),!0)},setReducedMotionForTest(U){g=U},dispose(){y=!0,ut(),Gn.remove(),Cs.remove(),Bo(),Q?.dispose(),K.stop(),j.dispose(),Z?.disconnect(),S&&(S.dispose(),S=null),E(),H(),w.canvas.removeEventListener("pointerdown",ze.onDown),w.canvas.removeEventListener("pointermove",ze.onMove),w.canvas.removeEventListener("pointerup",ze.onUp),w.canvas.removeEventListener("pointercancel",ze.onUp),T.dispose(),p&&p.dispose(),l&&l.dispose(),l=null,p=null,w.dispose()}};return i.opened(o.seatCount,m,t.prepared?.buildMs??performance.now()-r,t.prepared?.source??"inline"),zn}0&&(module.exports={VENUE3D_QUALITY_REPORT_VERSION,buildSceneModel,inspectVenue3DQualityEvidence,mountVenue3D,prepareVenue3D,prepareVenue3DFromChart});
641
+ void main(){ if(vDim>0.5) discard; vec4 c=texture(uImage,vUv); if(c.a<0.01) discard; fragColor=c; }`,uniforms:{uImage:{value:H},uFocusFloor:{value:-1}},transparent:!1,depthTest:!0,depthWrite:!0,cullFace:!1});let q=new ce.Mesh(e,{geometry:I,program:F});q.frustumCulled=!1,q.setParent(n),V.screenProgram=F,P=!0,V.drawCalls=3+(_?1:0)+1},X.src=W.contentImageUrl}return V}var _e=require("ogl");function Pm(e,t,n){let r=e+(t<<8)+(n<<16);return r===0?-1:r-1}function Sa(e,t,n,r,o,i){let a=-1,s=1/0;for(let c=0;c<n;c++)for(let u=0;u<t;u++){let d=(c*t+u)*4,f=Pm(e[d],e[d+1],e[d+2]);if(f<0||f>=i)continue;let m=u-r,l=c-o,p=m*m+l*l;p<s&&(s=p,a=f)}return a}function Ma(e,t,n,r,o,i){let a=e-n.left,s=t-n.top,c=Math.round(a*r),u=Math.round((n.height-s)*r);return{x:Math.max(0,Math.min(o-1,c)),y:Math.max(0,Math.min(i-1,u))}}var Cm=["uSeatRadius","uSeatScale","uMinPixels","uPixelToWorld"],Cn=class{constructor(t,n,r,o,i){this.seatScene=new _e.Transform;this.chairScene=new _e.Transform;this.solidScene=new _e.Transform;this.target=null;this.restoreClear=[0,0,0];this.renderer=t,this.gl=t.gl,this.maxIndex=i,this.seatProg=ua(this.gl),this.chairProg=ma(this.gl),this.depthProg=da(this.gl);let a=new _e.Mesh(this.gl,{geometry:n,program:this.seatProg});a.frustumCulled=!1,a.setParent(this.seatScene);let s=new _e.Mesh(this.gl,{geometry:r,program:this.chairProg});s.frustumCulled=!1,s.setParent(this.chairScene);let c=new _e.Mesh(this.gl,{geometry:o,program:this.depthProg});c.frustumCulled=!1,c.setParent(this.solidScene)}setRestoreClear(t){this.restoreClear=[t[0],t[1],t[2]]}syncFromSeatProgram(t){for(let r of Cm)this.seatProg.uniforms[r].value=t.uniforms[r].value;let n=t.uniforms.uFocusFloor.value;this.seatProg.uniforms.uFocusFloor.value=n,this.chairProg.uniforms.uFocusFloor.value=n,this.depthProg.uniforms.uFocusFloor.value=n}ensureTarget(){let t=this.gl.drawingBufferWidth,n=this.gl.drawingBufferHeight;return this.target&&(this.target.width!==t||this.target.height!==n)&&this.destroyTarget(),this.target||(this.target=new _e.RenderTarget(this.gl,{width:t,height:n,depth:!0})),this.target}destroyTarget(){if(!this.target)return;let t=this.gl;this.target.buffer&&t.deleteFramebuffer(this.target.buffer);for(let n of this.target.textures??[])n.texture&&t.deleteTexture(n.texture);this.target.depthBuffer&&t.deleteRenderbuffer(this.target.depthBuffer),this.target=null}pick(t,n,r,o){let i=this.gl,a=this.ensureTarget(),s=i.drawingBufferWidth,c=i.drawingBufferHeight,u=Math.max(0,n-o),d=Math.max(0,r-o),f=Math.max(1,Math.min(s,n+o+1)-u),m=Math.max(1,Math.min(c,r+o+1)-d);i.enable(i.SCISSOR_TEST),i.scissor(u,d,f,m);let[l,p,h]=this.restoreClear;i.clearColor(0,0,0,1),this.renderer.render({scene:this.solidScene,camera:t,target:a,clear:!0}),this.renderer.render({scene:this.seatScene,camera:t,target:a,clear:!1}),this.renderer.render({scene:this.chairScene,camera:t,target:a,clear:!1}),i.clearColor(l,p,h,1),i.disable(i.SCISSOR_TEST);let b=new Uint8Array(f*m*4);return this.renderer.bindFramebuffer(a),i.readPixels(u,d,f,m,i.RGBA,i.UNSIGNED_BYTE,b),this.renderer.bindFramebuffer(),Sa(b,f,m,n-u,r-d,this.maxIndex)}dispose(){this.destroyTarget(),this.seatProg.remove(),this.chairProg.remove(),this.depthProg.remove()}};function wa(e,t){let n=[];for(let r of t)e.has(r.seatId)?e.set(r.seatId,It(r.state)):n.push(r);return n}function Pa(e,t,n){let r=new Set;for(let a of t)(e.has(a)||n(a)!==void 0)&&r.add(a);let o=new Map(e),i=[];for(let[a,s]of e)r.has(a)||(i.push({seatId:a,state:pe[s]??"available"}),o.delete(a));for(let a of r){if(o.has(a))continue;let s=n(a);s!==void 0&&(o.set(a,s),i.push({seatId:a,state:"selected"}))}return{updates:i,next:o}}var We=require("ogl");function Am(e,t){return[e[0]-t[0],e[1]-t[1],e[2]-t[2]]}function Ca(e,t){return[e[0]+t[0],e[1]+t[1],e[2]+t[2]]}function Rm(e,t){return[e[0]*t,e[1]*t,e[2]*t]}function Aa(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 Io(e){let t=Math.max(0,Math.min(1,e));return t*t*t*(t*(t*6-15)+10)}function To(e,t){return Math.max(0,Math.min(1,e+t))}function Ra(e,t){let n=e.length;if(n===0)return[0,0,0];if(n===1)return[...e[0]];let r=Math.max(0,Math.min(1,t)),o=n-1,i=Math.floor(r*o);i>=o&&(i=o-1);let a=r*o-i,s=e[Math.max(0,i-1)],c=e[i],u=e[i+1],d=e[Math.min(n-1,i+2)],f=a*a,m=f*a,l=[0,0,0];for(let p=0;p<3;p++)l[p]=.5*(2*c[p]+(-s[p]+u[p])*a+(2*s[p]-5*c[p]+4*u[p]-d[p])*f+(-s[p]+3*c[p]-3*u[p]+d[p])*m);return l}function _o(e,t,n,r,o){let i=Aa(Am(t,n));i[0]===0&&i[1]===0&&i[2]===0&&(i=[0,0,1]);let a=Ca(Ca(t,Rm(i,2.5)),[0,1.5,0]),s=[t[0]-r[0],0,t[2]-r[2]],c=Aa(s);c[0]===0&&c[2]===0&&(c=[i[0],0,i[2]]);let u=Math.max(1,o),d=[r[0]+c[0]*u*1.3,r[1]+u*.75,r[2]+c[2]*u*1.3];return{waypoints:[e,d,a],finalPos:a}}function Lo(e,t,n=35,r=28){let o=Io(t),i=Ra(e,o),a=Io(Math.max(0,Math.min(1,(t-.66)/.34)));return{pos:i,fov:n+(r-n)*a,eased:o}}function _a(e,t,n){let r=e.position.clone(),o=new We.Quat().copy(e.quaternion);e.position.set(t[0],t[1],t[2]),e.lookAt(new We.Vec3(n[0],n[1],n[2]));let i=new We.Quat().copy(e.quaternion);return e.position.copy(r),e.quaternion.copy(o),i}var An=class{constructor(t){this.active=!1;this.waypoints=[];this.startQuat=new We.Quat;this.endQuat=new We.Quat;this.outQuat=new We.Quat;this.startTime=0;this.duration=2500;this.endFov=28;this.resolveFn=null;this.camera=t}start(t,n,r,o=2500,i=28){return this.settle(),this.waypoints=t,this.startQuat.copy(n),this.endQuat.copy(r),this.duration=o,this.endFov=i,this.startTime=performance.now(),this.active=!0,new Promise(a=>{this.resolveFn=a})}update(t){if(!this.active)return!1;let n=Math.min(1,(t-this.startTime)/this.duration),{pos:r,fov:o,eased:i}=Lo(this.waypoints,n,35,this.endFov);return this.camera.position.set(r[0],r[1],r[2]),this.outQuat.copy(this.startQuat).slerp(this.endQuat,To(i,.15)),this.camera.quaternion.copy(this.outQuat),this.camera.fov=o,this.camera.updateProjectionMatrix(),n>=1?(this.settle(),!1):!0}cancel(){this.settle()}settle(){this.active=!1;let t=this.resolveFn;this.resolveFn=null,t&&t()}};var La=to,Em=.12,Im=.25,Tm=1.5;function ka(e,t,n=0,r,o){let i=[t.x*z,n+Tm,t.y*z],a=o?[o[0],o[1],o[2]]:i,s=e[1],c=Number.isFinite(s)?s+La:Number.isFinite(r)?n+r:n+La,u=i[0]-e[0],d=i[2]-e[2],f=Math.hypot(u,d),m=f>.001?Math.min(Em,f*Im):0,l=f>.001?u/f:0,p=f>.001?d/f:0;return{eye:[e[0]+l*m,c,e[2]+p*m],focal:a}}var st=Math.PI/180,_m=45,Fa=80,Rn=70,Lm=1,km=.99;function Fm(e,t){if(!(e<Lm))return Fa;if(!(Number.isFinite(t)&&t>0))return Rn;let n=2*Math.atan(t/(2*En*km)/Math.max(.05,e))/st;return Math.max(Rn,Math.min(Fa,n))}var Dm=.25,En=1,Om=.25,Vm=12*st,Bm=.2,Nm=1.5,Da=.8,Oa=6,Ga=1.9,Gm=2/3,zm=.12,Um=.9,Hm=1.2,jm=2,za=.05,Ym=6;function Ua(e,t,n=0){if(!e.length)return{min:[t[0]-6,n,t[2]-6],max:[t[0]+6,Math.max(n+Da,t[1]),t[2]+6]};let r=1/0,o=-1/0,i=1/0,a=-1/0,s=n;for(let p of e)r=Math.min(r,p.cx-p.halfX),o=Math.max(o,p.cx+p.halfX),i=Math.min(i,p.cz-p.halfZ),a=Math.max(a,p.cz+p.halfZ),s=Math.max(s,p.y);let c=o-r,u=a-i,d=Math.max(c,Math.min(u,Oa))/2,f=Math.max(u,Math.min(c,Oa))/2,m=(r+o)/2,l=(i+a)/2;return{min:[m-d,n,l-f],max:[m+d,Math.max(n+Da,s),l+f]}}function Xm(e){return{min:[e.min[0],e.min[1],e.min[2]],max:[e.max[0],e.max[1]+Ga,e.max[2]]}}function ko(e){let t=e.max[1];return[(e.min[0]+e.max[0])/2,Math.max(e.min[1]+Nm,t+Bm,t+Ga*Gm),(e.min[2]+e.max[2])/2]}function Ha(e,t){let n=e[0]-t[0],r=e[2]-t[2],o=Math.hypot(n,r);return o<.001?{x:0,z:1}:{x:n/o,z:r/o}}function Va(e,t,n){let r=t[0]-e[0],o=t[1]-e[1],i=t[2]-e[2],a=Math.hypot(r,o,i)||1;r/=a,o/=a,i/=a;let s=-i,c=r,u=Math.hypot(s,c);if(u<1e-6)return 1/0;s/=u,c/=u;let d=1/0,f=-1/0;for(let m=0;m<8;m++){let l=(m&1?n.max[0]:n.min[0])-e[0],p=(m&2?n.max[1]:n.min[1])-e[1],h=(m&4?n.max[2]:n.min[2])-e[2],b=Math.max(za,l*r+p*o+h*i),y=(l*s+h*c)/b;y<d&&(d=y),y>f&&(f=y)}return f-d}function Ba(e,t,n){let r=t[0]-e[0],o=t[1]-e[1],i=t[2]-e[2],a=Math.hypot(r,o,i)||1;r/=a,o/=a,i/=a;let s=-i,c=r,u=Math.hypot(s,c);if(u<1e-6)return 1/0;s/=u,c/=u;let d=-c*o,f=c*r-s*i,m=s*o,l=1/0,p=-1/0;for(let h=0;h<8;h++){let b=(h&1?n.max[0]:n.min[0])-e[0],y=(h&2?n.max[1]:n.min[1])-e[1],v=(h&4?n.max[2]:n.min[2])-e[2],S=Math.max(za,b*r+y*o+v*i),M=(b*d+y*f+v*m)/S;M<l&&(l=M),M>p&&(p=M)}return p-l}function In(e,t){return Math.tan(e*st/2)*Math.max(.05,t)}function Na(e,t,n){let r=Fm(n,e),o=c=>Math.max(_m,Math.min(r,c)),i=c=>2*Math.atan(c)/st,a=Number.isFinite(e)&&e>0?o(i(e/(2*Dm)/Math.max(.05,n))):r;if(!(Number.isFinite(t)&&t>0))return a;let s=Math.min(a,o(i(t/(2*zm))));return e/(2*In(s,n))>En?a:s}function ja(e,t,n){let r=ko(t),o=[e[0],e[1],e[2]],i=0,a=0,s=l=>{if(!(l>0))return;let p=Ha(o,r);o[0]+=p.x*l,o[2]+=p.z*l,a+=l},c=t.max[1]+Om-o[1];c>0&&(o[1]+=c,i=c,s(c/Math.tan(Vm)));let u=Xm(t),d=Va(o,r,t),f=Na(d,Ba(o,r,u),n),m=d/(2*In(f,n));for(let l=0;l<Ym&&m>En;l++){let p=Math.max(1,Math.hypot(o[0]-r[0],o[2]-r[2])),h=Number.isFinite(m)?m/En:2;s(Math.min(60,p*(Math.min(4,h)-1)+.5)),d=Va(o,r,t),f=Na(d,Ba(o,r,u),n),m=d/(2*In(f,n))}return{eye:o,focal:r,fov:f,raisedM:i,pulledBackM:a,stageFrameWidth:m}}function Wm(e,t,n){let r=Math.tan(t*st/2),o=In(t,n);return Math.max(1,e/Math.max(.05,Math.min(r,o)))}function Ya(e,t){let{aspect:n,venue:r}=t,o=e.focal,i=Ha(e.eye,o),a=m=>(m[0]-o[0])*i.x+(m[2]-o[2])*i.z,s=[{name:"seat",eye:e.eye,focal:o,fov:e.fov}],c=jm*(t.rowDepthM??Um);s.push({name:"row",eye:[e.eye[0]+i.x*c,e.eye[1]+Hm,e.eye[2]+i.z*c],focal:o,fov:e.fov});let u=(m,l,p,h)=>{let b=Wm(p,e.fov,n)*1.08,y=b*Math.sin(h*st),v=b*Math.cos(h*st);return{name:m,eye:[l[0]+i.x*v,l[1]+y,l[2]+i.z*v],focal:l,fov:e.fov}};t.section&&t.section.radius>0&&s.push(u("section",t.section.center,t.section.radius,14)),s.push(u("venue",r.center,Math.max(1,r.radius),26));let d=[],f=-1/0;for(let m of s){let l=a(m.eye);d.length&&l<=f+.5||(d.push(m),f=l)}return d}var $a=require("ogl"),jt=Math.PI/180,Xa=320,Wa=70*jt,Km=32*jt,qm=24*jt,Ka=.0026,$m=.22,Qm=.006,Zm=180,Jm=4,Se=(e,t,n)=>Math.max(t,Math.min(n,e)),qa=e=>e<.5?4*e*e*e:1-Math.pow(-2*e+2,3)/2;function Qa(e){let{canvas:t,camera:n}=e,r=[],o=!1,i=0,a=0,s=0,c=0,u=0,d=0,f=!1,m=[0,0],l=0,p=!1,h=null,b=null,y=new Map,v=!1,S=0,M=0,R=0,x=0,g=()=>o&&r.length?r[Se(Math.round(i),0,r.length-1)].name:null,C=()=>{let P=g();P!==h&&(h=P,e.onStopChange?.(P))},E=()=>{if(!o||!r.length)return;let P=r[Se(Math.floor(i),0,r.length-1)],O=r[Se(Math.ceil(i),0,r.length-1)],I=Se(i-Math.floor(i),0,1),F=(Me,Ae)=>Me+(Ae-Me)*I,H=[F(P.eye[0],O.eye[0]),F(P.eye[1],O.eye[1]),F(P.eye[2],O.eye[2])],j=[F(P.focal[0],O.focal[0]),F(P.focal[1],O.focal[1]),F(P.focal[2],O.focal[2])],G=j[0]-H[0],V=j[1]-H[1],W=j[2]-H[2],X=Math.hypot(G,V,W)||1,Q=Math.atan2(G,W),q=Math.asin(Se(V/X,-1,1)),K=Q+a,Z=Se(q+s,-80*jt,80*jt),te=Math.cos(Z)*X;G=Math.sin(K)*te,V=Math.sin(Z)*X,W=Math.cos(K)*te,n.position.set(H[0],H[1],H[2]),n.fov=F(P.fov,O.fov),n.updateProjectionMatrix(),n.lookAt(new $a.Vec3(H[0]+G,H[1]+V,H[2]+W)),e.onApplied?.()},D=()=>{if(!o||!r.length)return;let P=Se(Math.round(i),0,r.length-1);if(e.reducedMotion()){f=!1,i=P,E(),C(),e.requestRender();return}if(Math.abs(P-i)<.001){f=!1,C();return}c=i,u=P,d=performance.now(),f=!0,e.requestRender()},B=P=>{!o||r.length<2||(f=!1,i=Se(i+P,0,r.length-1),E(),C(),e.requestRender())},L=(P,O)=>{o&&(f=!1,p=!1,a=Se(a-P*Ka,-Wa,Wa),s=Se(s-O*Ka,-qm,Km),E(),e.requestRender())},A=P=>{o&&(y.set(P.pointerId,{x:P.clientX,y:P.clientY}),y.size===1?(v=!0,x=0,S=P.clientX,M=P.clientY):y.size===2&&(v=!1,R=k()))},k=()=>{let P=[...y.values()];return P.length<2?0:Math.hypot(P[0].x-P[1].x,P[0].y-P[1].y)},N=P=>{if(!o||!y.has(P.pointerId))return;if(y.set(P.pointerId,{x:P.clientX,y:P.clientY}),y.size>=2){let F=k();R>0&&B((R-F)*Qm),R=F;return}if(!v)return;let O=P.clientX-S,I=P.clientY-M;S=P.clientX,M=P.clientY,x+=Math.abs(O)+Math.abs(I),!(x<=Jm)&&L(O,I)},w=P=>{y.delete(P.pointerId)&&(y.size<2&&(R=0),y.size===0&&(v=!1,D()))},T=P=>{if(!o)return;P.preventDefault();let O=P.deltaMode===1?16:P.deltaMode===2?100:1,I=Se(P.deltaY*O/100,-2,2);B(I*$m),b&&clearTimeout(b),b=setTimeout(()=>{b=null,D()},Zm)},_=()=>{o&&(o=!1,f=!1,p=!1,r=[],y.clear(),v=!1,b&&(clearTimeout(b),b=null),h!==null&&(h=null,e.onStopChange?.(null)))};return t.addEventListener("pointerdown",A),t.addEventListener("pointermove",N),t.addEventListener("pointerup",w),t.addEventListener("pointercancel",w),t.addEventListener("wheel",T,{passive:!1}),{get active(){return o},enter(P){if(P.length<2){_();return}r=P,o=!0,i=0,a=0,s=0,f=!1,p=!1,h=null,E(),C(),e.requestRender()},exit:_,recentre(){return o?Math.abs(a)<1e-4&&Math.abs(s)<1e-4?!0:e.reducedMotion()?(p=!1,a=0,s=0,E(),e.requestRender(),!0):(m=[a,s],l=performance.now(),p=!0,e.requestRender(),!0):!1},update(P){if(!o)return!1;let O=!1;if(p){let I=Se((P-l)/Xa,0,1),F=1-qa(I);a=m[0]*F,s=m[1]*F,I>=1?(p=!1,a=0,s=0):O=!0}if(f){let I=Se((P-d)/Xa,0,1);i=c+(u-c)*qa(I),I>=1?(f=!1,i=u,C()):O=!0}return E(),O},currentStop:g,dispose(){_(),t.removeEventListener("pointerdown",A),t.removeEventListener("pointermove",N),t.removeEventListener("pointerup",w),t.removeEventListener("pointercancel",w),t.removeEventListener("wheel",T)}}}function Za(e){return e.flying?"cinematic":e.panoramaMounted?"panorama":e.seatViewActive?"seatView":"orbit"}var Vo=null;function ms(){return Vo??=Promise.resolve().then(()=>(us(),ls)).catch(e=>{throw Vo=null,e}),Vo}var ds=()=>typeof performance<"u"&&performance.now?performance.now():Date.now(),On=class{constructor(t){this.orbitLatched=!1;this.panoramaOpenedAt=0;this.cb=t}emit(t,n){if(this.cb)try{this.cb(t,n)}catch{}}opened(t,n,r,o){this.emit("3d_opened",{seats:t,hasHeights:n,...r===void 0?{}:{buildMs:Math.round(r)},...o===void 0?{}:{prepSource:o}})}orbitEngaged(){this.orbitLatched||(this.orbitLatched=!0,this.emit("3d_orbit_engaged"))}seatPicked(t,n){this.emit("3d_seat_picked",{seatId:t,sectionId:n})}cinematicPlayed(t){this.emit("3d_cinematic_played",{durationMs:t,reducedMotion:!1})}cinematicSkipped(){this.emit("3d_cinematic_skipped",{reducedMotion:!0})}cinematicCancelled(){this.emit("3d_cinematic_cancelled")}panoramaOpened(){this.panoramaOpenedAt=ds(),this.emit("3d_panorama_opened")}panoramaClosed(){let t=this.panoramaOpenedAt?Math.round(ds()-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 fs(e){let t=e.style.position;return getComputedStyle(e).position!=="static"?()=>{}:(e.style.position="relative",()=>{e.style.position==="relative"&&(e.style.position=t)})}function ps(e){let{container:t,model:n,opts:r,expandedSeatById:o,seatIdsByRow:i,isNarrow:a}=e,s=null,c=()=>{if(!s)return;let f=a();Object.assign(s.style,f?{left:"12px",right:"12px",bottom:"70px",transform:"none",justifyContent:"center"}:{left:"50%",right:"auto",bottom:"18px",transform:"translateX(-50%)",justifyContent:"initial"})},u=()=>{s?.remove(),s=null};return{show:(f,m,l=!1)=>{if(u(),e.isDisposed())return null;let p=document.createElement("div");p.setAttribute("role","group"),Object.assign(p.style,{position:"absolute",display:"flex",flexDirection:"column",alignItems:"center",gap:"6px",zIndex:"4"});let h=r.chrome?.caption!==!1,b=r.chrome?.seatStepper!==!1;if(!h&&!b)return null;let y=o.get(f),v=y?.sectionId?n.sections.find(D=>D.id===y.sectionId):void 0,S=y?.label??f;p.setAttribute("aria-label",`Explore views near ${v?.label?`${v.label}, `:""}seat ${S}`);let M=document.createElement("span");M.textContent=r.seatViewCaption?.(f)??["Live 3D seat view",v?.label,S].filter(Boolean).join(" \xB7 "),Object.assign(M.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)"}),h&&p.appendChild(M);let R=document.createElement("div");Object.assign(R.style,{display:"flex",alignItems:"center",justifyContent:"center",gap:"6px"}),p.appendChild(R);let x=y?.rowId?i.get(y.rowId):void 0,g=x?.indexOf(f)??-1,C=g>=0?[x?.[g-1],x?.[g+1]]:[void 0,void 0],E=(D,B,L,A=!1)=>{let k=document.createElement("button");k.type="button",k.textContent=D,k.setAttribute("aria-label",B),Object.assign(k.style,{minHeight:"44px",padding:A?"10px 16px":"10px",borderRadius:"999px",background:"rgba(12,18,32,0.78)",color:"#eef1f8",border:"1px solid rgba(150,165,205,0.4)",backdropFilter:"blur(6px)",font:"600 13px/1 inherit",cursor:"pointer",whiteSpace:"nowrap"}),A||(k.style.minWidth="44px"),A&&(k.dataset.panoramaTrigger=""),k.addEventListener("click",L),R.appendChild(k)};if(b&&C[0]){let D=o.get(C[0])?.label??C[0];E("\u2039",`View previous seat ${D}`,()=>{e.flyToSeat(C[0])})}if(b&&r.getSeatView){let D=r.seatViewActionLabel?.(f)??"Open 360\xB0 panorama";E(l?`\u21BB Retry ${D}`:`\u25C9 ${D}`,`${l?"Retry":D} from seat ${S}`,()=>{if(e.isDisposed()||m!==e.flightGen()){u();return}u(),e.openPanorama(f,400,m)},!0)}if(b&&C[1]){let D=o.get(C[1])?.label??C[1];E("\u203A",`View next seat ${D}`,()=>{e.flyToSeat(C[1])})}return!R.childElementCount&&!h?null:(t.appendChild(p),s=p,c(),p)},remove:u,layout:c}}var pd={rotate:"Drag to rotate the venue",move:"Drag to move the venue",zoomIn:"Zoom in",zoomOut:"Zoom out",fitView:"Show whole venue"};function hs(e){let{container:t,orbit:n,isNarrow:r}=e,o={...pd,...e.labels??{}},i=(S,M)=>{S.setAttribute("aria-label",M),S.title=M},a=document.createElement("div"),s=!1;a.className="sl-3d-navigation-controls",Object.assign(a.style,{position:"absolute",right:"14px",bottom:"14px",display:"flex",zIndex:"4",flexDirection:"column",alignItems:"flex-end",gap:"7px"});let c=document.createElement("div");c.setAttribute("role","group"),c.setAttribute("aria-label","3D drag mode"),Object.assign(c.style,{display:"flex",flexDirection:"column",gap:"6px",alignItems:"flex-end"});let u=document.createElement("div");u.setAttribute("role","group"),u.setAttribute("aria-label","3D view controls"),Object.assign(u.style,{display:"flex",flexDirection:"column",gap:"6px",alignItems:"flex-end"});let d=document.createElement("button");d.type="button",d.textContent="\u21BB",i(d,o.rotate);let f=document.createElement("button");f.type="button",f.textContent="\u2725",i(f,o.move);let m=document.createElement("button");m.type="button",m.textContent="\u2212",i(m,o.zoomOut);let l=document.createElement("button");l.type="button",l.textContent="+",i(l,o.zoomIn);for(let S of[d,f,m,l])S.className="sl-3d-icon-control",Object.assign(S.style,{width:"44px",minWidth:"44px",minHeight:"44px",padding:"9px",border:"1px solid rgba(150,165,205,0.35)",borderRadius:"999px",color:"#c9d4ea",background:"rgba(12,18,32,0.82)",font:"600 17px/1 inherit",backdropFilter:"blur(6px)",cursor:"pointer",whiteSpace:"nowrap"});c.append(d,f),u.append(l,m);let p=S=>{n.setPrimaryDragMode(S);let M=S==="orbit";d.setAttribute("aria-pressed",String(M)),f.setAttribute("aria-pressed",String(!M)),d.style.background=M?"rgba(96,110,150,0.68)":"rgba(12,18,32,0.82)",f.style.background=M?"rgba(12,18,32,0.82)":"rgba(96,110,150,0.68)",a.title=M?`${o.rotate} \xB7 ${o.move} with Shift`:`${o.move} \xB7 ${o.rotate} with Shift`};d.addEventListener("click",()=>p("orbit")),f.addEventListener("click",()=>p("pan"));let h=()=>{let{atMin:S,atMax:M}=n.dollyLimitState();l.disabled!==S&&(l.disabled=S),m.disabled!==M&&(m.disabled=M)};m.addEventListener("click",()=>{n.zoomBy(Tt),h()}),l.addEventListener("click",()=>{n.zoomBy(pt),h()}),a.append(c,u),p("orbit"),t.appendChild(a);let b=e.enabled!==!1,y=()=>{let S=r();a.style.display=s||!b?"none":"flex",a.style.right=S?"12px":"14px",a.style.bottom=S?"calc(env(safe-area-inset-bottom, 0px) + 76px)":"14px",c.style.display=S?"none":"flex",l.style.display=S?"none":"",m.style.display=S?"none":""};return y(),{element:a,utilityControls:u,setNavigationMode:p,syncZoomLimits:h,setSeatViewLocked:S=>{s=S,n.setInteractionEnabled(!S),y()},seatViewLocked:()=>s,layout:y}}var hd=12;function bd(e,t){if(!e)return!1;let n=e.x-t[0],r=e.y-t[1],o=e.z-t[2];return Math.hypot(n,r,o)>hd}function bs(e){let{glctx:t,orbit:n,model:r,seats:o,opts:i,cinematic:a,analytics:s,seatIdByIndex:c,sectionIdBySeatId:u,tapSlop:d,tapMs:f,cancelFlight:m,focusSectionCamera:l,setSelection:p,ensureSeatView:h}=e,b=0,y=0,v=0,S=-1,M=!1,R=!1,x=B=>{e.seatViewLocked()||S===-1&&(S=B.pointerId,b=B.clientX,y=B.clientY,v=performance.now(),M=!1,R=a.active,a.active&&(s.cinematicCancelled(),m(),i.onViewTargetChange?.(null)))},g=B=>{B.pointerId===S&&Math.hypot(B.clientX-b,B.clientY-y)>d&&(M=!0)},C=(B,L,A,k,N)=>{let w=t.canvas.getBoundingClientRect(),T=t.canvas.clientWidth||w.width||1,_=t.canvas.clientHeight||w.height||1,P=B-w.left,O=L-w.top,I=k*k,F=-1,H=I,j=1/0;for(let G of o){if(A&&G.sectionId!==A)continue;let V=r.seats.idToIndex.get(G.id);if(V===void 0)continue;if(N){let Z=Math.round(r.seats.iState[V]??0);if(Z!==0&&Z!==3)continue}let W=V*3,X=Ye(n.camera.projectionViewMatrix,[r.seats.iPosition[W],r.seats.iPosition[W+1]+.55,r.seats.iPosition[W+2]],T,_);if(!X.visible)continue;let Q=X.x-P,q=X.y-O,K=Q*Q+q*q;(K<H||Math.abs(K-H)<1&&X.depth<j)&&(F=V,H=K,j=X.depth)}return F},E=(B,L)=>{let A=e.gpu(),k=e.pick();if(!A||!k)return-1;k.syncFromSeatProgram(A.seatProgram);let N=t.canvas.getBoundingClientRect(),w=t.renderer.dpr,{x:T,y:_}=Ma(B,L,N,w,t.gl.drawingBufferWidth,t.gl.drawingBufferHeight),P=Math.max(2,Math.round(8*w));return k.pick(n.camera,T,_,P)};return{onDown:x,onMove:g,onUp:B=>{if(B.pointerId!==S)return;let L=!M&&performance.now()-v<f;if(S=-1,R){R=!1;return}let A=e.gpu(),k=e.pick();if(!L||!A||!k)return;let N=E(B.clientX,B.clientY);if(e.focusedSectionId()&&N>=0){let _=c[N],P=_?u.get(_):void 0;if(P&&P!==e.focusedSectionId()&&l(P))return}if(e.focusedSectionId()&&N<0&&(N=C(B.clientX,B.clientY,e.focusedSectionId(),44,!1)),e.focusedSectionId()&&N<0){let _=C(B.clientX,B.clientY,null,72,!1),P=_>=0?c[_]:void 0,O=P?u.get(P):void 0;if(O&&O!==e.focusedSectionId()&&l(O))return}if(!e.focusedSectionId()){N<0&&(N=C(B.clientX,B.clientY,null,42,!1));let _=N>=0?c[N]:void 0,P=_?u.get(_):void 0;if(P&&l(P))return}if(N<0||N>=c.length){e.selection().size&&(p([]),i.onViewTargetChange?.(null));return}let w=c[N],T=pe[Math.round(r.seats.iState[N]??0)]??"available";if(T!=="available"&&T!=="selected"){i.onSeatInspect?.(w,T);return}if(e.selection().has(w)&&e.selection().size===1){p([]),i.onViewTargetChange?.(null),i.onSeatPick?.(w);return}if(p([w]),h(w),s.seatPicked(w,u.get(w)),i.onSeatPick?.(w),e.focusedSectionId()){let _=N*3,P=[r.seats.iPosition[_],r.seats.iPosition[_+1],r.seats.iPosition[_+2]];bd(n.camera?.position,P)&&e.focusSeatCamera(w)}}}}var Vn=class{constructor(t,n){this.minX=0;this.minZ=0;this.cell=1;this.cols=1;this.rows=1;this.cellStart=null;this.cellItems=null;this.iPosition=t,this.count=n}ensureGrid(){if(this.cellStart||this.count===0)return;let t=this.iPosition,n=1/0,r=1/0,o=-1/0,i=-1/0;for(let l=0;l<this.count;l++){let p=t[l*3],h=t[l*3+2];p<n&&(n=p),p>o&&(o=p),h<r&&(r=h),h>i&&(i=h)}let a=Math.max(o-n,.001),s=Math.max(i-r,.001);this.cell=Math.max(Math.sqrt(a*s*4/this.count),.25),this.cols=Math.max(1,Math.ceil(a/this.cell)+1),this.rows=Math.max(1,Math.ceil(s/this.cell)+1),this.minX=n,this.minZ=r;let c=this.cols*this.rows,u=new Int32Array(c+1),d=l=>{let p=Math.min(this.cols-1,Math.max(0,Math.floor((t[l*3]-n)/this.cell)));return Math.min(this.rows-1,Math.max(0,Math.floor((t[l*3+2]-r)/this.cell)))*this.cols+p};for(let l=0;l<this.count;l++)u[d(l)+1]++;for(let l=0;l<c;l++)u[l+1]+=u[l];let f=new Int32Array(this.count),m=u.slice(0,c);for(let l=0;l<this.count;l++)f[m[d(l)]++]=l;this.cellStart=u,this.cellItems=f}gather(t,n,r,o){this.ensureGrid();let i=this.cellStart,a=this.cellItems;if(!i||!a)return 0;let s=o.length,c=r*r,u=Math.floor((t-this.minX)/this.cell),d=Math.floor((n-this.minZ)/this.cell),f=Math.ceil(r/this.cell)+1,m=this.iPosition,l=0;for(let p=0;p<=f&&l<s;p++){let h=d-p,b=d+p,y=u-p,v=u+p;for(let S=h;S<=b&&l<s;S++){if(S<0||S>=this.rows)continue;let M=S===h||S===b;for(let R=y;R<=v&&l<s;R++){if(!M&&R!==y&&R!==v){R=v-1;continue}if(R<0||R>=this.cols)continue;let x=S*this.cols+R;for(let g=i[x],C=i[x+1];g<C&&l<s;g++){let E=a[g],D=m[E*3]-t,B=m[E*3+2]-n;D*D+B*B<=c&&(o[l++]=E)}}}}return l}};var Bn=class{constructor(t){this.ctx=t;this.detailVisible=!1;this.seatDetailMix=0;this.structureDetailMix=0;this.nearBuf=new Int32Array(en);this.lastGatherX=1/0;this.lastGatherZ=1/0;this.nearIndex=new Vn(t.model.seats.iPosition,t.model.seats.count)}forceRegather(){this.lastGatherX=1/0}setDetailEnabled(t){let n=this.ctx.gpu();t||(this.detailVisible=!1),this.lastGatherX=1/0,this.lastGatherZ=1/0,!t&&n?.nearSeatCount()&&n.setNearSeats(this.nearBuf,0)}update(t){let{model:n}=this.ctx,r=this.ctx.gpu();if(!r)return;if(!t){r.nearSeatCount()&&r.setNearSeats(this.nearBuf,0);return}let o=this.ctx.orbit().camera.position;if(Math.hypot(o.x-this.lastGatherX,o.z-this.lastGatherZ)<Kn)return;if(this.lastGatherX=o.x,this.lastGatherZ=o.z,Math.hypot(o.x-n.bounds.center[0],o.z-n.bounds.center[2])-n.bounds.radius>Wn){r.nearSeatCount()&&r.setNearSeats(this.nearBuf,0);return}let s=this.nearIndex.gather(o.x,o.z,Wn,this.nearBuf);s===0&&r.nearSeatCount()===0||r.setNearSeats(this.nearBuf,s)}ease(t,n,r){let o=1-Math.exp(-t*9),i=1-Math.exp(-t*20);this.seatDetailMix+=(n-this.seatDetailMix)*(n>this.seatDetailMix?o:i),this.structureDetailMix+=(r-this.structureDetailMix)*(r>this.structureDetailMix?o:i),Math.abs(n-this.seatDetailMix)<.01&&(this.seatDetailMix=n),Math.abs(r-this.structureDetailMix)<.01&&(this.structureDetailMix=r)}};var Nn=require("ogl");function ys(){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 vs(e){let{container:t,model:n,opts:r,orbit:o,cinematic:i,analytics:a,loop:s,labelOverlay:c,stageAzimuth:u,overviewFraming:d}=e,f=0,m=-1,l=(g,C,E=28)=>{o.camera.position.set(g[0],g[1],g[2]),o.camera.lookAt(new Nn.Vec3(C[0],C[1],C[2])),o.camera.fov=E,o.camera.updateProjectionMatrix()},p=document.createElement("button");p.className="sl-3d-overview-control sl-3d-icon-control",p.type="button",p.replaceChildren(ys());let h=r.navLabels?.fitView??"Show whole venue";p.setAttribute("aria-label",h),p.title=h,Object.assign(p.style,{width:"44px",minWidth:"44px",minHeight:"44px",padding:"9px",borderRadius:"999px",background:"rgba(12,18,32,0.72)",color:"#c9d4ea",border:"1px solid rgba(150,165,205,0.35)",backdropFilter:"blur(6px)",font:"600 11px/1 inherit",cursor:"pointer",whiteSpace:"nowrap"});let b=()=>{p.firstElementChild||p.replaceChildren(ys())};b();let y=g=>{m=g;let C=e.gpu();C&&(C.seatProgram.uniforms.uFocusFloor.value=g,C.solidProgram.uniforms.uFocusFloor.value=g,C.chairProgram.uniforms.uFocusFloor.value=g),e.showSectionSeatLabels(null)},v=()=>{if(e.isDisposed())return;r.onViewTargetChange?.(null),r.onSectionFocusChange?.(null),e.panorama()&&(e.panorama().dispose(),e.setPanorama(null),a.panoramaClosed()),e.setPanoramaSphereVisible(!1),e.panoramaLoadAbort()?.abort(),e.setPanoramaLoadAbort(null),e.restorePanoramaLayer(),p.style.display="",c.setVisible(!0),e.setFrozen(!1);let g=m>=0?n.floors[m]:null;if(e.setNearFieldDetailEnabled(!!g),e.setSeatViewLocked(!1),S(),e.removeArriveChip(),e.setNavigationMode("orbit"),g){let C=g.focalWorld[0]-g.center[0],E=g.focalWorld[2]-g.center[2],D=Math.hypot(C,E)>g.radius*.12?Math.atan2(C,E):u,B={center:g.center,radius:g.radius,box:g.box},L={polarDeg:58,margin:1.12};e.reducedMotion()?o.frame(B,!1,D,!1,L):o.frameSoft(B,D,!1,L)}else e.reducedMotion()?o.frame(n.bounds,!1,u,r.portraitOverviewCrop===!0,d):o.frameSoft(n.bounds,u,r.portraitOverviewCrop===!0,d);e.showSectionSeatLabels(null),s.requestRender()},S=()=>{f++,e.setSeatStepping(!1),e.panoramaLoadAbort()?.abort(),e.setPanoramaLoadAbort(null),i.active&&(i.cancel(),o.resumeAfterFlight(n.focalWorld))},M=g=>{if(e.isDisposed()||!e.gpu())return Promise.resolve();let C=n.seats.idToIndex.get(g);if(C===void 0)return Promise.resolve();e.setNearFieldDetailEnabled(!0),r.onViewTargetChange?.(g),e.panorama()&&(e.panorama().dispose(),e.setPanorama(null),e.setPanoramaSphereVisible(!1),p.style.display="",e.restorePanoramaLayer()),e.panoramaLoadAbort()?.abort(),e.setPanoramaLoadAbort(null),e.setFrozen(!1);let E=e.inSeatView()&&r.arriveAtSeatEye===!0;e.setSeatStepping(E),e.setSeatViewLocked(!1);let D=++f;E?e.showArriveChip(g,D):e.removeArriveChip();let{eye:B,focal:L}=e.resolvedSeatViewPose(g,C),A=r.arriveAtSeatEye?e.seatViewArrival(g,C):null,k=A?A.focal:L,N=[o.camera.position.x,o.camera.position.y,o.camera.position.z],w=_o(N,A?.eye??B,k,n.bounds.center,n.bounds.radius),T=A?A.eye:r.arriveAtSeatEye?B:w.finalPos,_=A?A.fov:r.arriveAtSeatEye?t.clientWidth/Math.max(1,t.clientHeight)<.7?Rn:65:28,P=[w.waypoints[0],w.waypoints[1],T];if(c.setVisible(!1),e.reducedMotion())return e.setSeatStepping(!1),l(T,k,_),s.requestRender(),a.cinematicSkipped(),e.isDisposed()||o.syncFromCamera(),e.setSeatViewLocked(r.arriveAtSeatEye===!0),A&&e.enterSeatView(A.stops),e.showArriveChip(g,D),Promise.resolve();let O=new Nn.Quat().copy(o.camera.quaternion),I=_a(o.camera,T,k);s.requestRender();let F=E?700:2500;return i.start(P,O,I,F,_).then(()=>{e.isDisposed()||D!==f||(e.setSeatStepping(!1),a.cinematicPlayed(F),o.resumeAfterFlight(k),e.setSeatViewLocked(r.arriveAtSeatEye===!0),A&&e.enterSeatView(A.stops),s.requestRender(),e.showArriveChip(g,D))})},R=g=>{let C=n.sections.find(L=>L.id===g);if(!C||C.seatCount===0)return!1;e.setNearFieldDetailEnabled(!0),e.setSeatStepping(!1),e.setSeatViewLocked(!1),i.cancel(),e.removeArriveChip(),n.floors.length>1&&m!==C.floorIndex&&y(C.floorIndex),e.setNavigationMode("pan"),e.showSectionSeatLabels(g);let E=C.focalWorld[0]-C.center[0],D=C.focalWorld[2]-C.center[2],B=Math.hypot(E,D)>C.radius*.12?Math.atan2(E,D):void 0;return o.frame({center:C.center,radius:Math.max(5,C.radius*.5)},!1,B),r.onSectionFocusChange?.(g),s.requestRender(),!0},x=g=>{if(e.isDisposed()||!e.gpu())return!1;let C=n.seats.idToIndex.get(g);if(C===void 0)return!1;let E=C*3,D=[n.seats.iPosition[E],n.seats.iPosition[E+1]+.55,n.seats.iPosition[E+2]];return e.reducedMotion()?o.frame({center:D,radius:gs},!1,void 0,!1,xs):o.frameSoft({center:D,radius:gs},void 0,!1,xs),s.requestRender(),!0};return p.addEventListener("click",v),{overviewChip:p,layoutOverviewChip:b,flightGen:()=>f,focusedFloor:()=>m,applyFloorFocus:y,placeCameraFinal:l,cancelFlight:S,focusOverview:v,flyToSeat:M,focusSectionCamera:R,focusSeatCamera:x}}var gs=4.5,xs={polarDeg:48,margin:1.25};var gd={};function Ss(e){let t=performance.now();return{model:St(e),buildMs:performance.now()-t,source:"main"}}function yd(e){let t=$r(e.doc);return{...Ss({...e,seats:t}),seats:t}}function Ms(e,t,n){if(typeof Worker>"u")return Promise.resolve(t());let r;try{r=new Worker(new URL("./scene/scene.worker.js",gd.url),{type:"module"})}catch{return Promise.resolve(t())}return new Promise(o=>{let i=!1,a=u=>{i||(i=!0,clearTimeout(c),r.terminate(),o(u))},s=()=>a(t()),c=window.setTimeout(s,15e3);r.onerror=s,r.onmessage=u=>{let d=n(u.data);d?a(d):s()},r.postMessage(e)})}function ws(e){return Ms(e,()=>Ss(e),({model:t,buildMs:n})=>({model:t,buildMs:n,source:"worker"}))}function Ps(e){return Ms(e,()=>yd(e),({model:t,buildMs:n,seats:r})=>r?{model:t,buildMs:n,seats:r,source:"worker"}:null)}var xd=Math.PI/180,vd=6,Sd=500;function Md(e,t,n={}){let r=performance.now(),o=t.prepared?.model??St(t),i=new On(n.onAnalytics),a=new Array(o.seats.count);for(let[U,Y]of o.seats.idToIndex)a[Y]=U;let s=new Map(t.seats.map(U=>[U.id,U])),c=new Map;for(let U of t.seats){if(!U.rowId)continue;let Y=c.get(U.rowId);Y?Y.push(U.id):c.set(U.rowId,[U.id])}let u=new Map;for(let U of t.seats)u.set(U.id,U.sectionId);let d=new Map;for(let[U,Y]of o.seats.idToIndex){let $=u.get(U);if(!$)continue;let ee=d.get($);ee?ee.push(Y):d.set($,[Y])}let f=()=>{if(!l||!o.sectionSolidRanges.length)return;let{lit:U,anyUnlit:Y}=ya(o.sectionSolidRanges,d,o.seats.iState);l.setSectionShellLit(Y?U:null)},m=t.doc.floors?.some(Y=>(Y.baseHeightM??0)>0)?!0:(t.doc.floors?.flatMap(Y=>Y.objects)??t.doc.objects).some(Y=>Y.type==="section"&&((Y.height??0)>0||(Y.rake??0)>0)),l=null,p=null,h=!1,b=!1,y=!1,v=new Map,S=null,M=null,R=null,x=new Map,g=null,C=()=>{R===null&&(R=e.style.zIndex,e.style.zIndex="20")},E=()=>{R!==null&&(e.style.zIndex==="20"&&(e.style.zIndex=R),R=null)},D=!1,B=()=>D?fe.focusedFloor():-1,L=()=>{l=va(w.gl,o),f(),p=new Cn(w.renderer,l.seatGeometry,l.chairGeometry,l.solidGeometry,o.seats.count),w.setClearColor(o.theme.background.top),p.setRestoreClear(o.theme.background.top),l.seatProgram.uniforms.uSeatRadius.value=De*o.theme.seatScale,l.seatProgram.uniforms.uFocusFloor.value=B(),l.solidProgram.uniforms.uFocusFloor.value=B(),l.chairProgram.uniforms.uFocusFloor.value=B(),l.screenProgram&&(l.screenProgram.uniforms.uFocusFloor.value=B()),k.forceRegather()},A=!1,k=new Bn({model:o,orbit:()=>T,gpu:()=>l}),N=U=>k.setDetailEnabled(U),w=new Qt(e,{onContextLost:()=>{y||i.contextLost(),h=!0,K.stop(),l=null,p=null},onContextRestored:()=>{L(),h=!1,y||i.contextRestored(),K.requestRender()}}),T=new Zt(w.gl,w.canvas,()=>K.requestRender(),()=>i.orbitEngaged());T.setAspect(w.aspect);let _=(t.doc.floors?.flatMap(U=>U.objects)??t.doc.objects).some(U=>U.type==="section"&&U.physical3dProvenance?.surfaceKind?.status==="inferred"),P=(()=>{if(_&&o.stages.length===0)return;let U=o.focalWorld[0]-o.bounds.center[0],Y=o.focalWorld[2]-o.bounds.center[2];return Math.hypot(U,Y)>o.bounds.radius*.12?Math.atan2(U,Y):void 0})(),O=o.floors.length>1?{polarDeg:48,margin:1.1}:{margin:1.1},I=typeof window<"u"&&!!window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches;T.frame(o.bounds,!I&&n.skipInitialOverviewAnimation!==!0,P,n.portraitOverviewCrop===!0,O);let F=new An(T.camera),H=fs(e),j=new Mn(e,{fontFamily:t.doc.theme?.fontFamily,ink:t.doc.theme?.textColor,backgroundRgb:o.theme.background.top}),G=o.labels,V=()=>Oi(G,o.floors.length,B());j.setLabels(V());let W=null,X=U=>{if(W=U,j.setForcedDense(!!U),!U){j.setLabels(V());return}let Y=t.seats.filter(J=>J.sectionId===U),$=new Set(Y.map(J=>J.id)),ee=new Set(Y.map(J=>J.rowId)),re=new Set(v.keys()),ie=new Set(Y.filter(J=>re.has(J.id)).map(J=>J.id)),se=V().filter(J=>J.kind!=="row"&&J.kind!=="seat"||(J.kind==="row"?ee.has(J.id.slice(4)):$.has(J.id.slice(5))&&(ie.size===0||ie.has(J.id.slice(5)))));if(o.seatCount<=6e3&&ie.size===0){j.setLabels(se);return}let me=ie.size?Y.filter(J=>ie.has(J.id)):Y,Qe=new Set(me.map(J=>`seat:${J.id}`)),Ue=me.flatMap(J=>{let ye=o.seats.idToIndex.get(J.id);if(ye===void 0)return[];let Re=ye*3;return[{id:`seat:${J.id}`,kind:"seat",text:re.has(J.id)?J.displayLabel||J.label:wo(J.displayLabel||J.label),anchor:[o.seats.iPosition[Re],o.seats.iPosition[Re+1]+(re.has(J.id)?1.05:.55),o.seats.iPosition[Re+2]]}]});j.setLabels([...se.filter(J=>!Qe.has(J.id)),...Ue])};L();let Q=null,q=null,K=new Jt(U=>{if(h||!l||b)return!1;let Y=Za({flying:F.active,panoramaMounted:S!==null,seatViewActive:Q?.active===!0}),$=Y==="cinematic"?F.update(performance.now()):Y==="seatView"?Q.update(performance.now()):Y==="orbit"?T.update():!1;q?.syncZoomLimits();let ee=B()>=0?o.floors[B()]:null,re=ee?.radius??o.bounds.radius,ie=nr(T.currentDistance,re),se=A?{center:[T.camera.position.x,T.camera.position.y,T.camera.position.z],radius:520}:o.renderBounds;T.updateClipping(se);let me=ee?.center??o.renderBounds.center,Qe=ee?.radius??o.renderBounds.radius,Ue=(Ee,At)=>Math.hypot(T.camera.position.x-Ee[0],T.camera.position.y-Ee[1],T.camera.position.z-Ee[2])<=At*(k.detailVisible?1.8:1.55),J=Ue(me,Qe);if(!J&&W){let Ee=o.sections.find(At=>At.id===W);Ee&&(J=Ue(Ee.center,Math.max(12,Ee.radius*2)))}k.detailVisible=J;let ye=l.seatProgram.uniforms;ye.uSeatScale.value=ie.scale,ye.uSeatFade.value=ie.fade;let Re=!!ee&&or(ee.seatCount,w.canvas.clientWidth||1,w.canvas.clientHeight||1),Wt=rr(o.seats.count,re,T.currentDistance,T.camera.fov,w.canvas.clientHeight||1),Ct=k.detailVisible||Re||Wt?1:0,Kt=k.detailVisible||B()>=0||o.floors.length>1?1:0;return k.ease(U,Ct,Kt),ye.uSeatDetail.value=k.seatDetailMix,l.solidProgram.uniforms.uStructureDetail.value=k.structureDetailMix,ye.uMinPixels.value=ie.minPixels,ye.uPixelToWorld.value=2*Math.tan(T.camera.fov*xd/2)/Math.max(1,w.pixelHeight),k.update(k.detailVisible),w.renderer.render({scene:l.background,clear:!0}),w.renderer.render({scene:l.main,camera:T.camera,clear:!1}),j.update(T.camera.projectionViewMatrix,w.canvas.clientWidth||1,w.canvas.clientHeight||1,T.currentDistance,re,[T.camera.position.x,T.camera.position.y,T.camera.position.z]),$||k.seatDetailMix!==Ct||k.structureDetailMix!==Kt}),Z=typeof ResizeObserver<"u"?new ResizeObserver(()=>zn.resize()):null;Z?.observe(e);let te=U=>{let Y=re=>{let ie=o.seats.idToIndex.get(re);return ie===void 0?void 0:o.seats.iState[ie]},{updates:$,next:ee}=Pa(v,U,Y);if(v=ee,j.setSelectedSeatIds(v.keys()),W&&X(W),$.length){let re=no(o.seats,$);l&&l.uploadSeatStateRuns(re),f(),K.requestRender()}},Me=()=>g!==null?g:typeof window<"u"&&!!window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,Ae=8,Be=U=>{if(!n.getSeatView)return null;let Y=x.get(U);if(!Y)for(Y=Promise.resolve(n.getSeatView(U)),x.set(U,Y),Y.catch(()=>{x.get(U)===Y&&x.delete(U)});x.size>Ae;){let $=x.keys().next().value;if($===void 0)break;x.delete($)}return Y},ke=Ua(o.stages,o.focalWorld,o.bounds.groundY??0),Ne=ko(ke),we=(U,Y)=>{let $=s.get(U),ee=Math.max(0,Math.round(o.seats.iFloor[Y]??0)),re=t.doc.floors?.[ee],ie=o.floors[ee],se=re?.focalPoint??t.doc.focalPoint,me=ie?{x:ie.focalWorld[0]/z,y:ie.focalWorld[2]/z}:se,Qe=$?.focalPoint?{x:$.focalPoint.x+me.x-se.x,y:$.focalPoint.y+me.y-se.y}:me,Ue=[o.seats.iPosition[Y*3],o.seats.iPosition[Y*3+1],o.seats.iPosition[Y*3+2]];return ka(Ue,Qe,re?.baseHeightM??0,$?.eyeHeightM,Ne)},de=()=>(e.clientWidth||w.canvas.clientWidth)<=520,Ge=null,ct=null,lt=async(U,Y,$)=>{if(!n.getSeatView||y||$!==fe.flightGen())return;let ee;try{ee=await ms()}catch{if(i.panoramaFailed(U,"mount"),!y&&$===fe.flightGen()){let re=qe(U,$,!0);requestAnimationFrame(()=>re?.querySelector("[data-panorama-trigger]")?.focus())}return}if(!(y||$!==fe.flightGen()||!Ge))return ct??=ee.createOpenPanorama(Ge),ct(U,Y,$)},Fe=ps({container:e,model:o,opts:n,expandedSeatById:s,seatIdsByRow:c,isNarrow:de,isDisposed:()=>y,flightGen:()=>fe.flightGen(),flyToSeat:U=>Go(U),openPanorama:(U,Y,$)=>lt(U,Y,$)}),qe=Fe.show,ut=Fe.remove,Cs=Fe.layout,$e=hs({container:e,orbit:T,isNarrow:de,enabled:n.chrome?.controlDock!==!1,...n.navLabels?{labels:n.navLabels}:{}});q=$e;let As=$e.element,wt=$e.setNavigationMode,Rs=$e.layout,Es=$e.utilityControls,Pt=null,Bo=!1,Xt=U=>{$e.setSeatViewLocked(U),U||Q?.exit()};Q=Qa({canvas:w.canvas,camera:T.camera,requestRender:()=>K.requestRender(),reducedMotion:Me,onStopChange:U=>{let Y=U??(Bo?"seat":null);Pt=Y;try{n.onSeatViewStopChange?.(Y)}catch{}},onApplied:()=>{y||T.syncFromCamera()}});let Is=(U,Y)=>{let{eye:$}=we(U,Y),ee=(e.clientWidth||w.canvas.clientWidth||1)/Math.max(1,e.clientHeight||w.canvas.clientHeight||1),re=ja($,ke,ee);if(n.seatViewStops===!1)return{...re,stops:[]};let ie=u.get(U),se=ie?o.sections.find(me=>me.id===ie):void 0;return{...re,stops:Ya(re,{aspect:ee,section:se&&se.seatCount>0?{center:se.center,radius:se.radius}:null,venue:{center:o.bounds.center,radius:o.bounds.radius}})}},fe=vs({container:e,model:o,opts:n,orbit:T,cinematic:F,analytics:i,loop:K,labelOverlay:j,stageAzimuth:P,overviewFraming:O,gpu:()=>l,isDisposed:()=>y,panorama:()=>S,setPanorama:U=>{S=U},setPanoramaSphereVisible:U=>{A=U},panoramaLoadAbort:()=>M,setPanoramaLoadAbort:U=>{M=U},setFrozen:U=>{b=U},restorePanoramaLayer:E,reducedMotion:Me,resolvedSeatViewPose:we,showSectionSeatLabels:X,setNearFieldDetailEnabled:N,setSeatViewLocked:Xt,setNavigationMode:wt,showArriveChip:qe,removeArriveChip:ut,inSeatView:()=>Pt!==null,setSeatStepping:U=>{Bo=U},seatViewArrival:(U,Y)=>n.arriveAtSeatEye?Is(U,Y):null,enterSeatView:U=>Q?.enter(U)});D=!0;let Gn=fe.overviewChip,Ts=fe.layoutOverviewChip,_s=fe.applyFloorFocus,Ls=fe.focusOverview,No=fe.cancelFlight,Go=fe.flyToSeat,zo=fe.focusSectionCamera;Es.appendChild(Gn),Ge={container:e,model:o,opts:n,analytics:i,orbit:T,loop:K,seatsById:s,ensureSeatView:Be,resolvedSeatViewPose:we,gpu:()=>l,gl:w.gl,isContextLost:()=>h,isDisposed:()=>y,flightGen:()=>fe.flightGen(),setPanorama:U=>{S=U},getLoadAbort:()=>M,setLoadAbort:U=>{M=U},setPanoramaSphereVisible:U=>{A=U,U&&Q?.exit()},setFrozen:U=>{b=U},raisePanoramaLayer:C,restorePanoramaLayer:E,getOverviewChip:()=>Gn,labelOverlay:j,reducedMotion:Me,removeArriveChip:ut,showArriveChip:qe};let ze=bs({glctx:w,orbit:T,model:o,seats:t.seats,opts:n,cinematic:F,analytics:i,seatIdByIndex:a,sectionIdBySeatId:u,tapSlop:vd,tapMs:Sd,gpu:()=>l,pick:()=>p,seatViewLocked:()=>$e.seatViewLocked(),focusedSectionId:()=>W,selection:()=>v,cancelFlight:No,focusSectionCamera:zo,focusSeatCamera:fe.focusSeatCamera,setSelection:te,ensureSeatView:Be});w.canvas.addEventListener("pointerdown",ze.onDown),w.canvas.addEventListener("pointermove",ze.onMove),w.canvas.addEventListener("pointerup",ze.onUp),w.canvas.addEventListener("pointercancel",ze.onUp),K.requestRender();let zn={setAvailability(U){let Y=wa(v,U),$=no(o.seats,Y);$.length&&l&&l.uploadSeatStateRuns($),f(),K.requestRender()},setSelection:te,setNavigationMode:wt,zoomIn(){T.zoomBy(pt),K.requestRender()},zoomOut(){T.zoomBy(Tt),K.requestRender()},flyToSeat:Go,focusOverview:Ls,seatViewStop:()=>Pt,recentreSeatView:()=>Q?.recentre()??!1,resize(){let{width:U,height:Y}=w.resize();T.setAspect(U/Math.max(1,Y)),Cs(),Rs(),Ts(),K.requestRender()},stats(){return{...K.stats(),drawCalls:l?l.drawCalls:0,seatCount:o.seatCount}},getQualityEvidence(){let U=K.stats(),Y=w.canvas.clientWidth||1,$=w.canvas.clientHeight||1,ee=o.bounds.center,re=Ye(T.camera.projectionViewMatrix,[ee[0],o.bounds.box.min[1],ee[2]],Y,$),ie=Ye(T.camera.projectionViewMatrix,[ee[0],o.bounds.box.max[1],ee[2]],Y,$),se=o.bounds.box,me=[se.min[0],se.max[0]].flatMap(J=>[se.min[1],se.max[1]].flatMap(ye=>[se.min[2],se.max[2]].map(Re=>Ye(T.camera.projectionViewMatrix,[J,ye,Re],Y,$)))).filter(J=>Number.isFinite(J.x)&&Number.isFinite(J.y)&&Number.isFinite(J.depth)),Qe=me.length?(()=>{let J=Math.min(...me.map(Ze=>Ze.x)),ye=Math.max(...me.map(Ze=>Ze.x)),Re=Math.min(...me.map(Ze=>Ze.y)),Wt=Math.max(...me.map(Ze=>Ze.y)),Ct=Math.max(0,J),Kt=Math.min(Y,ye),Ee=Math.max(0,Re),At=Math.min($,Wt),qt=Math.max(0,Kt-Ct),Un=Math.max(0,At-Ee);return{box:{x:Ct,y:Ee,width:qt,height:Un},horizontalFillRatio:qt/Y,verticalFillRatio:Un/$,visibleAreaRatio:qt*Un/(Y*$),clippedEdges:[...Re<0?["top"]:[],...ye>Y?["right"]:[],...Wt>$?["bottom"]:[],...J<0?["left"]:[]]}})():void 0,Ue=String(w.gl.getParameter(w.gl.VERSION)??"");return{viewport:{width:Y,height:$},context:{webgl2:/webgl\s*2/i.test(Ue),lost:h},frame:{rendered:U.rendered,idle:U.idle},camera:{position:[T.camera.position.x,T.camera.position.y,T.camera.position.z],distance:T.currentDistance,verticalFovDeg:T.fovY},scene:{seatCount:o.seatCount,floorCount:o.floors.length,zoneCount:o.zones.length,sectionCount:o.sections.length,authoredRelief:m,renderedVerticalSpanM:Math.max(0,o.bounds.box.max[1]-o.bounds.box.min[1]),projectedReliefPx:re.visible&&ie.visible?Math.abs(re.y-ie.y):0},labels:j.qualityEvidence(),framing:Qe,...Pt?{seatView:{fovDeg:T.camera.fov,stop:Pt}}:{}}},getQualityReport(){return wn(zn.getQualityEvidence())},loseContextForTest(){w.simulateContextLossCycle()},floors(){return o.floors},focusFloor(U){if(U!==null&&!o.floors.some($=>$.index===U))return!1;let Y=U??-1;if(N(U!==null),Xt(!1),_s(Y),wt("orbit"),U===null)F.cancel(),Me()?T.frame(o.bounds,!1,P,n.portraitOverviewCrop===!0,O):T.frameSoft(o.bounds,P,n.portraitOverviewCrop===!0,O);else{let $=o.floors[U];if($.seatCount>0){F.cancel();let ee=$.focalWorld[0]-$.center[0],re=$.focalWorld[2]-$.center[2],ie=Math.hypot(ee,re)>$.radius*.12?Math.atan2(ee,re):P;T.frame({center:$.center,radius:$.radius,box:$.box},!1,ie,!1,{polarDeg:58,margin:1.12})}}return K.requestRender(),!0},zones(){return o.zones},focusZone(U){let Y=o.zones.find(ie=>ie.id===U);if(!Y||Y.seatCount===0)return!1;N(!1),Xt(!1),F.cancel(),wt("orbit"),X(null),n.onSectionFocusChange?.(null);let $=Y.focalWorld[0]-Y.center[0],ee=Y.focalWorld[2]-Y.center[2],re=Math.hypot($,ee)>Y.radius*.12?Math.atan2($,ee):void 0;return T.frame({center:Y.center,radius:Y.radius*1.25},!1,re),K.requestRender(),!0},sections(){return o.sections},focusSection(U){return zo(U)},rows(U){return U?o.rows.filter(Y=>Y.sectionId===U):o.rows},seatsInRow(U){return t.seats.filter(Y=>Y.rowId===U).map(Y=>({id:Y.id,label:Y.displayLabel||Y.label}))},focusRow(U){let Y=o.rows.find($=>$.id===U);return!Y||Y.seatCount===0?!1:(N(!0),Xt(!1),F.cancel(),wt("pan"),Y.sectionId&&(X(Y.sectionId),n.onSectionFocusChange?.(Y.sectionId)),T.frame({center:Y.center,radius:Math.max(2.5,Y.radius*.65)}),K.requestRender(),!0)},setReducedMotionForTest(U){g=U},dispose(){y=!0,ut(),Gn.remove(),As.remove(),No(),Q?.dispose(),K.stop(),j.dispose(),Z?.disconnect(),S&&(S.dispose(),S=null),E(),H(),w.canvas.removeEventListener("pointerdown",ze.onDown),w.canvas.removeEventListener("pointermove",ze.onMove),w.canvas.removeEventListener("pointerup",ze.onUp),w.canvas.removeEventListener("pointercancel",ze.onUp),T.dispose(),p&&p.dispose(),l&&l.dispose(),l=null,p=null,w.dispose()}};return i.opened(o.seatCount,m,t.prepared?.buildMs??performance.now()-r,t.prepared?.source??"inline"),zn}0&&(module.exports={VENUE3D_QUALITY_REPORT_VERSION,buildSceneModel,inspectVenue3DQualityEvidence,mountVenue3D,prepareVenue3D,prepareVenue3DFromChart});