@seatlayer/core 0.73.0 → 0.75.1

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 (150) hide show
  1. package/README.md +3 -2
  2. package/dist/ar-JOSU54ZZ.js +1 -0
  3. package/dist/be-UDIVAZGH.js +1 -0
  4. package/dist/bg-AJX2SNK4.js +1 -0
  5. package/dist/ca-MC23KMQH.js +1 -0
  6. package/dist/{categoryInventory-Bcmnr6ZH.d.ts → categoryInventory-C5I2U-EM.d.ts} +1 -1
  7. package/dist/{categoryInventory-DueSAIBX.d.cts → categoryInventory-DFp26meo.d.cts} +1 -1
  8. package/dist/chunk-KHFCTR3V.js +1 -0
  9. package/dist/{chunk-UX67GDLV.js → chunk-N3DPHRJ3.js} +1 -1
  10. package/dist/{chunk-JLYR66MT.js → chunk-OGIAQX62.js} +1 -1
  11. package/dist/chunk-QUOAQQMP.js +1 -0
  12. package/dist/chunk-SPM2LMKI.js +1 -0
  13. package/dist/{chunk-N5NRM4NW.js → chunk-TN6DFYEV.js} +1 -1
  14. package/dist/{chunk-ZMYRXJOA.js → chunk-UVAV3E7K.js} +1 -1
  15. package/dist/chunk-X2GZ5O7C.js +1 -0
  16. package/dist/{chunk-BAWUBGWY.js → chunk-YACNGDTE.js} +1 -1
  17. package/dist/core/chart-ops/index.cjs +1 -1
  18. package/dist/core/chart-ops/index.d.cts +4 -4
  19. package/dist/core/chart-ops/index.d.ts +4 -4
  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 +4 -4
  23. package/dist/core/inventory/index.d.ts +4 -4
  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 +5 -5
  27. package/dist/core/layout/index.d.ts +5 -5
  28. package/dist/core/layout/index.js +1 -1
  29. package/dist/core/quality/index.d.cts +3 -3
  30. package/dist/core/quality/index.d.ts +3 -3
  31. package/dist/core/render-assets/index.d.cts +1 -1
  32. package/dist/core/render-assets/index.d.ts +1 -1
  33. package/dist/core/render-assets/index.js +1 -1
  34. package/dist/core/seatConfidence.d.cts +1 -1
  35. package/dist/core/seatConfidence.d.ts +1 -1
  36. package/dist/core/sections/index.cjs +1 -1
  37. package/dist/core/sections/index.d.cts +5 -5
  38. package/dist/core/sections/index.d.ts +5 -5
  39. package/dist/core/sections/index.js +1 -1
  40. package/dist/cs-Q4OEV3NE.js +1 -0
  41. package/dist/cy-TPDRMPTK.js +1 -0
  42. package/dist/da-U6XXTCII.js +1 -0
  43. package/dist/de-ZV54ZWHR.js +1 -0
  44. package/dist/el-5VQKNNQV.js +1 -0
  45. package/dist/es-Y3BNIAEW.js +1 -0
  46. package/dist/et-HCCA6TE3.js +1 -0
  47. package/dist/{eventConfigurations-C7YAqkFR.d.ts → eventConfigurations-BQGuLLv0.d.ts} +1 -1
  48. package/dist/{eventConfigurations-DwXdrjqj.d.cts → eventConfigurations-DAaOaKJK.d.cts} +1 -1
  49. package/dist/fa-SZ3EAODM.js +1 -0
  50. package/dist/fi-S34TMT35.js +1 -0
  51. package/dist/fr-RQIXNHQ5.js +1 -0
  52. package/dist/he-PPNABESI.js +1 -0
  53. package/dist/hr-IZOGRWC5.js +1 -0
  54. package/dist/hu-K7EOGFAB.js +1 -0
  55. package/dist/index.cjs +1 -1
  56. package/dist/index.d.cts +148 -14
  57. package/dist/index.d.ts +148 -14
  58. package/dist/index.js +1 -1
  59. package/dist/it-PD5WJDNR.js +1 -0
  60. package/dist/ja-3CFZ2KK6.js +1 -0
  61. package/dist/ku-MQJTRLDV.js +1 -0
  62. package/dist/{labeling-iugoy25P.d.cts → labeling-BZp91HiS.d.cts} +1 -1
  63. package/dist/{labeling-BUCj-kHU.d.ts → labeling-Duul2sao.d.ts} +1 -1
  64. package/dist/{layout-Dv3R0Mpw.d.ts → layout-DGbWo5fV.d.ts} +12 -3
  65. package/dist/{layout-DPJX6D9k.d.cts → layout-Gkx3fo5_.d.cts} +12 -3
  66. package/dist/localeLoaders-ETY2H7H3.js +1 -0
  67. package/dist/lt-6Q5DJHXR.js +1 -0
  68. package/dist/lv-BQ3LWGW6.js +1 -0
  69. package/dist/nl-ZPVH2YGT.js +1 -0
  70. package/dist/no-R7I6YW7N.js +1 -0
  71. package/dist/openPanorama-6FMXAJ6O.js +20 -0
  72. package/dist/pl-EU2O5DYI.js +1 -0
  73. package/dist/pt-UMSFOY5P.js +1 -0
  74. package/dist/{renderedQuality-CfonzUpl.d.ts → renderedQuality-BYhJ3Cer.d.ts} +1 -1
  75. package/dist/{renderedQuality-CSHrmnHf.d.cts → renderedQuality-CEPse8ir.d.cts} +1 -1
  76. package/dist/{renderer-Dn4Plcv9.d.cts → renderer-BlLKrW-U.d.ts} +17 -1
  77. package/dist/{renderer-C5avrVLy.d.ts → renderer-Cv_gzYvT.d.cts} +17 -1
  78. package/dist/ro-GR35LU2L.js +1 -0
  79. package/dist/ru-CXYAZQEV.js +1 -0
  80. package/dist/{sections-DhJ7TukF.d.cts → sections-CRSGPI3T.d.cts} +1 -1
  81. package/dist/{sections-uV7vqDHj.d.ts → sections-DIVvr8QN.d.ts} +1 -1
  82. package/dist/{segmentedRowModel-DgSEzAYd.d.ts → segmentedRowModel-CD-YT9bT.d.ts} +1 -1
  83. package/dist/{segmentedRowModel-DWOjcPrU.d.cts → segmentedRowModel-CvyOS6Bx.d.cts} +1 -1
  84. package/dist/sk-GUB52YMC.js +1 -0
  85. package/dist/sl-J7N6LDON.js +1 -0
  86. package/dist/sr-A7GQEH7K.js +1 -0
  87. package/dist/sv-ARLHHSPZ.js +1 -0
  88. package/dist/{ticketRestrictions-JT87K45q.d.cts → ticketRestrictions-C31mrE97.d.cts} +2 -2
  89. package/dist/{ticketRestrictions-DIh61MqE.d.ts → ticketRestrictions-DXO2eckD.d.ts} +2 -2
  90. package/dist/tr-6TE3U7WM.js +1 -0
  91. package/dist/{types-Dx4jA8aI.d.cts → types-BVRza86Q.d.cts} +15 -0
  92. package/dist/{types-Dx4jA8aI.d.ts → types-BVRza86Q.d.ts} +15 -0
  93. package/dist/uk-RMVPSRMH.js +1 -0
  94. package/dist/view3d/crossfade/panorama.cjs +1 -1
  95. package/dist/view3d/crossfade/panorama.d.cts +20 -2
  96. package/dist/view3d/crossfade/panorama.d.ts +20 -2
  97. package/dist/view3d/crossfade/panorama.js +1 -1
  98. package/dist/view3d/index.cjs +31 -31
  99. package/dist/view3d/index.d.cts +30 -3
  100. package/dist/view3d/index.d.ts +30 -3
  101. package/dist/view3d/index.js +25 -25
  102. package/dist/view3d/scene/scene.worker.cjs +1 -1
  103. package/dist/view3d/scene/scene.worker.js +1 -1
  104. package/dist/zh-Hans-SNO4DA32.js +1 -0
  105. package/dist/zh-Hant-TVIKBD5S.js +1 -0
  106. package/package.json +2 -2
  107. package/dist/ar-JP4VPYJ2.js +0 -1
  108. package/dist/be-ROTFZNMH.js +0 -1
  109. package/dist/bg-YMQ3B5NS.js +0 -1
  110. package/dist/ca-L2OMCHWL.js +0 -1
  111. package/dist/chunk-52MZJZMW.js +0 -1
  112. package/dist/chunk-5JB4VW6B.js +0 -1
  113. package/dist/chunk-BLPBTW6I.js +0 -1
  114. package/dist/chunk-HDY2MYYH.js +0 -1
  115. package/dist/chunk-KN7GLEAI.js +0 -1
  116. package/dist/chunk-YFV4DSSX.js +0 -1
  117. package/dist/cs-CHBOZAYY.js +0 -1
  118. package/dist/cy-ZIVBYZBX.js +0 -1
  119. package/dist/da-PUY5IIER.js +0 -1
  120. package/dist/de-ILFIEU77.js +0 -1
  121. package/dist/el-5EG3QS5T.js +0 -1
  122. package/dist/es-YXZQB5VZ.js +0 -1
  123. package/dist/et-FZIUC4FC.js +0 -1
  124. package/dist/fa-KKBNUDRE.js +0 -1
  125. package/dist/fi-B6JSP5Z5.js +0 -1
  126. package/dist/fr-T5LHFRKG.js +0 -1
  127. package/dist/he-JF4HU75D.js +0 -1
  128. package/dist/hr-S5OXZ3NI.js +0 -1
  129. package/dist/hu-ZZDYG6ZF.js +0 -1
  130. package/dist/it-A5VCFTQP.js +0 -1
  131. package/dist/ja-PAJD5HFJ.js +0 -1
  132. package/dist/ku-KV2AIB6I.js +0 -1
  133. package/dist/localeLoaders-VULFUGJH.js +0 -1
  134. package/dist/lt-OSFNYQ2L.js +0 -1
  135. package/dist/lv-5INNWEN5.js +0 -1
  136. package/dist/nl-YOLY3DXM.js +0 -1
  137. package/dist/no-C5MG5NPH.js +0 -1
  138. package/dist/openPanorama-HGRYMWKC.js +0 -20
  139. package/dist/pl-ERGM2HA3.js +0 -1
  140. package/dist/pt-S6SBTHES.js +0 -1
  141. package/dist/ro-NQ4LIATX.js +0 -1
  142. package/dist/ru-ICFP6U3S.js +0 -1
  143. package/dist/sk-VYH6WIZ2.js +0 -1
  144. package/dist/sl-AA54VE5P.js +0 -1
  145. package/dist/sr-Z27ZL5ZE.js +0 -1
  146. package/dist/sv-BT4MNMB5.js +0 -1
  147. package/dist/tr-3TSE3BBR.js +0 -1
  148. package/dist/uk-YD2PBENU.js +0 -1
  149. package/dist/zh-Hans-VPQE6LWU.js +0 -1
  150. package/dist/zh-Hant-PUKPX45I.js +0 -1
@@ -1,4 +1,4 @@
1
- "use strict";var $a=Object.create;var Yt=Object.defineProperty;var Za=Object.getOwnPropertyDescriptor;var Ja=Object.getOwnPropertyNames;var es=Object.getPrototypeOf,ts=Object.prototype.hasOwnProperty;var wt=(e,t,n)=>()=>{if(n)throw n[0];try{return e&&(t=e(e=0)),t}catch(r){throw n=[r],r}};var Eo=(e,t)=>{for(var n in t)Yt(e,n,{get:t[n],enumerable:!0})},To=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Ja(t))!ts.call(e,o)&&o!==n&&Yt(e,o,{get:()=>t[o],enumerable:!(r=Za(t,o))||r.enumerable});return e};var st=(e,t,n)=>(n=e!=null?$a(es(e)):{},To(t||!e||!e.__esModule?Yt(n,"default",{value:e,enumerable:!0}):n,e)),ns=e=>To(Yt({},"__esModule",{value:!0}),e);function Nu(e,t){return!Number.isFinite(e)||!Number.isFinite(t)||e<=0||t<=0?0:Math.ceil(e*t*4*(4/3))}function Gu(e){return(e!==void 0&&e<=2?32:e!==void 0&&e>=8?192:96)*1024*1024}function Sn(e){let t=typeof navigator>"u"?void 0:navigator;return{saveData:t?.connection?.saveData===!0,maxTextureSize:e,maxDecodedBytes:Gu(t?.deviceMemory)}}function Mn(e,t={}){let n=e.previewUrl?.trim();if(!n||n===e.url)return{initialUrl:e.url,initialWidth:e.sourceWidth,initialHeight:e.sourceHeight,reason:"full-only"};let r={initialUrl:n,initialWidth:e.previewWidth,initialHeight:e.previewHeight};if(t.saveData)return{...r,reason:"save-data"};let o=[...e.variants??[],...e.sourceWidth!==void 0&&e.sourceHeight!==void 0?[{url:e.url,width:e.sourceWidth,height:e.sourceHeight}]:[]].filter(c=>c.url.trim()&&c.url!==n&&Number.isFinite(c.width)&&c.width>0&&Number.isFinite(c.height)&&c.height>0).sort((c,l)=>c.width*c.height-l.width*l.height);if(!o.length)return{...r,upgradeUrl:e.url,reason:"progressive"};let i=o.filter(c=>t.maxTextureSize===void 0||Math.max(c.width,c.height)<=t.maxTextureSize);if(!i.length)return{...r,reason:"texture-limit"};let a=i.filter(c=>t.maxDecodedBytes===void 0||Nu(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 Ma(){return new DOMException("Panorama image load aborted","AbortError")}function Gt(e,t){return new Promise((n,r)=>{if(t?.aborted){r(Ma());return}let o=new Image;o.crossOrigin="anonymous";let i=!1,a=()=>{o.onload=null,o.onerror=null,t?.removeEventListener("abort",c)},s=l=>{i||(i=!0,a(),l?r(l):n(o))},c=()=>{o.src="",s(Ma())};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 wn(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 So=wt(()=>{"use strict"});function Pa(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 Mo(e){return Math.max(zu,Math.min(Uu,e))}function Hu(e,t,n){let r=(.5+e/360)*n;return t/2-r}function ju(e,t=Cn){return e*(180/t)}function wa(e,t,n){return(e-t)/2+Pn(n,t)}function Pn(e,t){let n=Le/180*t;return Math.max(-n,Math.min(n,e))}function Ca(e,t,n={}){let r=n.fadeMs??400,o=t.initialBearingDeg??0,i=Mn(t,Sn()),a=new AbortController,s=()=>a.abort();n.signal?.addEventListener("abort",s,{once:!0});let c=document.createElement("div"),l=document.activeElement instanceof HTMLElement?document.activeElement:null;c.setAttribute("role","dialog"),c.setAttribute("aria-modal","true"),c.setAttribute("aria-label",n.seatLabel?`View from ${n.seatLabel}`:"View from seat"),c.tabIndex=-1,Object.assign(c.style,{position:"absolute",inset:"0",zIndex:"10",opacity:"0",transition:`opacity ${r}ms ease`,background:"#05070c",overflow:"hidden",touchAction:"none"});let u=document.createElement("div");Object.assign(u.style,{position:"absolute",inset:"0",backgroundImage:`url("${i.initialUrl}")`,backgroundRepeat:"repeat-x",cursor:"grab"}),c.appendChild(u);let p=document.createElement("button");if(p.type="button",p.setAttribute("aria-label","Close"),p.textContent="\u2715",Object.assign(p.style,{position:"absolute",top:"12px",right:"12px",zIndex:"2",width:"44px",height:"44px",borderRadius:"999px",cursor:"pointer",border:"1px solid rgba(255,255,255,0.25)",background:"rgba(8,12,18,0.6)",color:"#e6edf3",fontSize:"15px",lineHeight:"1"}),c.appendChild(p),n.disclosure){let _=document.createElement("div");_.textContent=`${n.disclosurePrefix??"360\xB0 panorama"} \xB7 ${n.disclosure}`,Object.assign(_.style,{position:"absolute",top:"12px",left:"12px",zIndex:"2",maxWidth:"calc(100% - 88px)",padding:"8px 11px",borderRadius:"999px",overflow:"hidden",color:"#dce6f8",background:"rgba(8,12,18,0.68)",font:"600 11px/1.2 ui-sans-serif, system-ui, sans-serif",textOverflow:"ellipsis",whiteSpace:"nowrap",pointerEvents:"none",backdropFilter:"blur(6px)"}),c.appendChild(_)}let d=document.createElement("div");d.textContent="Drag to look \xB7 pinch or scroll to zoom \xB7 Esc to close",Object.assign(d.style,{position:"absolute",bottom:"12px",left:"0",right:"0",textAlign:"center",color:"rgba(230,237,243,0.7)",font:"12px ui-sans-serif, system-ui, sans-serif",pointerEvents:"none"}),c.appendChild(d),e.appendChild(c),p.focus({preventScroll:!0});let f=0,m=0,h=0,y=0,b=Cn,g=()=>{let _=c.clientHeight||1,F=c.clientWidth||1,X=C.naturalWidth||F*2,W=C.naturalHeight||_,q=f>0?(F/2-h)/f:0,Q=m>0?y/m:0;m=ju(_,b),f=m*(X/W),u.style.backgroundSize=`${f}px ${m}px`,x?h=F/2-q*f:(h=Hu(o,F,f),y=Pn((t.initialPitchDeg??0)/180*m,m),x=!0),y=Pn(Q*m,m),u.style.backgroundPosition=`${h}px ${wa(_,m,y)}px`},x=!1,v=()=>{let _=c.clientHeight||1;y=Pn(y,m),u.style.backgroundPosition=`${h}px ${wa(_,m,y)}px`},C=new Image;C.onload=g,C.src=i.initialUrl;let S=()=>{};i.upgradeUrl&&(S=wn(()=>{(t.resolveUrl?t.resolveUrl(i.upgradeUrl):Promise.resolve(i.upgradeUrl)).then(F=>!F||a.signal.aborted?null:Gt(F,a.signal).then(X=>({full:X,url:F}))).then(F=>{F&&(M||a.signal.aborted||(C=F.full,u.style.backgroundImage=`url("${F.url}")`,g()))}).catch(()=>{})})),requestAnimationFrame(g);let A=!1,L=0,O=0,z=0,B=new Map,T=()=>{let[_,F]=[...B.values()];return _&&F?Math.hypot(_.x-F.x,_.y-F.y):0},w=_=>{let F=Mo(_);F!==b&&(b=F,g())},R=_=>{B.set(_.pointerId,{x:_.clientX,y:_.clientY}),A=B.size===1,L=_.clientX,O=_.clientY,B.size===2&&(z=T()),u.style.cursor="grabbing";try{u.setPointerCapture?.(_.pointerId)}catch{}},P=_=>{if(B.has(_.pointerId)){if(B.set(_.pointerId,{x:_.clientX,y:_.clientY}),B.size>=2){let F=T();z>0&&F>0&&w(b*(z/F)),z=F,A=!1;return}A&&(h+=_.clientX-L,y+=_.clientY-O,L=_.clientX,O=_.clientY,v())}},I=_=>{B.delete(_.pointerId),z=B.size===2?T():0;let F=B.values().next().value;A=B.size===1,F?(L=F.x,O=F.y):u.style.cursor="grab";try{u.releasePointerCapture?.(_.pointerId)}catch{}},G=_=>{_.preventDefault(),w(b+_.deltaY*.04)};u.addEventListener("pointerdown",R),u.addEventListener("pointermove",P),u.addEventListener("pointerup",I),u.addEventListener("pointercancel",I),u.addEventListener("wheel",G,{passive:!1});let k=!1,M=!1,E=0,D=()=>{u.removeEventListener("pointerdown",R),u.removeEventListener("pointermove",P),u.removeEventListener("pointerup",I),u.removeEventListener("pointercancel",I),u.removeEventListener("wheel",G),window.removeEventListener("keydown",j)},V=()=>{S(),a.abort(),n.signal?.removeEventListener("abort",s),E&&(window.clearTimeout(E),E=0),D(),c.parentNode&&c.parentNode.removeChild(c),l?.isConnected&&l.focus({preventScroll:!0})},H=()=>{if(k)return;k=!0,c.style.opacity="0";let _=()=>{E=0,!M&&(V(),n.onClose?.())};E=window.setTimeout(_,r)},j=_=>{if(_.key==="Tab"){_.preventDefault(),p.focus({preventScroll:!0});return}if(_.key==="Escape"){_.stopPropagation(),H();return}if(_.key==="ArrowLeft"||_.key==="ArrowRight")h+=_.key==="ArrowLeft"?-32:32;else if(_.key==="ArrowUp"||_.key==="ArrowDown")y+=(_.key==="ArrowUp"?4:-4)*(m/180);else if(_.key==="+"||_.key==="="){w(b-5),_.preventDefault();return}else if(_.key==="-"){w(b+5),_.preventDefault();return}else return;_.preventDefault(),v()};return window.addEventListener("keydown",j),p.addEventListener("click",H),requestAnimationFrame(()=>{c.style.opacity="1"}),{close:H,dispose(){k=!0,M=!0,V()}}}var Cn,zu,Uu,Le,wo=wt(()=>{"use strict";So();Cn=70,zu=35,Uu=90;Le=35});function Ku(e=Xu,t=Yu,n=Wu){let r=e+1,o=t+1,i=r*o,a=new Float32Array(i*3),s=new Float32Array(i*2);for(let u=0;u<o;u++){let p=u/t,d=p*Math.PI,f=Math.sin(d),m=Math.cos(d);for(let h=0;h<r;h++){let y=h/e,b=(y-.5)*Math.PI*2,g=u*r+h;a[g*3]=n*f*Math.sin(b),a[g*3+1]=n*m,a[g*3+2]=-n*f*Math.cos(b),s[g*2]=y,s[g*2+1]=p}}let c=new Uint16Array(e*t*6),l=0;for(let u=0;u<t;u++)for(let p=0;p<e;p++){let d=u*r+p,f=d+r;c[l++]=d,c[l++]=f,c[l++]=d+1,c[l++]=d+1,c[l++]=f,c[l++]=f+1}return{position:a,uv:s,index:c}}function Aa(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 Ia(e,t){let{position:n,uv:r,index:o}=Ku(),i=new qe.Geometry(e,{position:{size:3,data:n},uv:{size:2,data:r},index:{data:o}}),a=new qe.Texture(e,{image:t,wrapS:e.CLAMP_TO_EDGE,wrapT:e.CLAMP_TO_EDGE,generateMipmaps:!0,flipY:!1}),s=new qe.Program(e,{vertex:qu,fragment:Qu,uniforms:{uPano:{value:a},uOpacity:{value:0}},transparent:!0,depthTest:!1,depthWrite:!1}),c=new qe.Mesh(e,{geometry:i,program:s});return{mesh:c,setOpacity(l){s.uniforms.uOpacity.value=Math.max(0,Math.min(1,l))},setImage(l){a.image=l,a.needsUpdate=!0},dispose(){c.setParent(null),i.remove(),a.texture&&e.deleteTexture(a.texture),s.remove()}}}var qe,Xu,Yu,Wu,qu,Qu,Ra=wt(()=>{"use strict";qe=require("ogl"),Xu=64,Yu=32,Wu=500;qu=`#version 300 es
1
+ "use strict";var gs=Object.create;var Kt=Object.defineProperty;var xs=Object.getOwnPropertyDescriptor;var vs=Object.getOwnPropertyNames;var Ss=Object.getPrototypeOf,Ms=Object.prototype.hasOwnProperty;var Ct=(e,t,n)=>()=>{if(n)throw n[0];try{return e&&(t=e(e=0)),t}catch(r){throw n=[r],r}};var Oo=(e,t)=>{for(var n in t)Kt(e,n,{get:t[n],enumerable:!0})},Vo=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of vs(t))!Ms.call(e,o)&&o!==n&&Kt(e,o,{get:()=>t[o],enumerable:!(r=xs(t,o))||r.enumerable});return e};var lt=(e,t,n)=>(n=e!=null?gs(Ss(e)):{},Vo(t||!e||!e.__esModule?Kt(n,"default",{value:e,enumerable:!0}):n,e)),ws=e=>Vo(Kt({},"__esModule",{value:!0}),e);function Ad(e,t){return!Number.isFinite(e)||!Number.isFinite(t)||e<=0||t<=0?0:Math.ceil(e*t*4*(4/3))}function Rd(e){return(e!==void 0&&e<=2?32:e!==void 0&&e>=8?192:96)*1024*1024}function An(e){let t=typeof navigator>"u"?void 0:navigator;return{saveData:t?.connection?.saveData===!0,maxTextureSize:e,maxDecodedBytes:Rd(t?.deviceMemory)}}function Rn(e,t={}){let n=e.previewUrl?.trim();if(!n||n===e.url)return{initialUrl:e.url,initialWidth:e.sourceWidth,initialHeight:e.sourceHeight,reason:"full-only"};let r={initialUrl:n,initialWidth:e.previewWidth,initialHeight:e.previewHeight};if(t.saveData)return{...r,reason:"save-data"};let o=[...e.variants??[],...e.sourceWidth!==void 0&&e.sourceHeight!==void 0?[{url:e.url,width:e.sourceWidth,height:e.sourceHeight}]:[]].filter(c=>c.url.trim()&&c.url!==n&&Number.isFinite(c.width)&&c.width>0&&Number.isFinite(c.height)&&c.height>0).sort((c,u)=>c.width*c.height-u.width*u.height);if(!o.length)return{...r,upgradeUrl:e.url,reason:"progressive"};let i=o.filter(c=>t.maxTextureSize===void 0||Math.max(c.width,c.height)<=t.maxTextureSize);if(!i.length)return{...r,reason:"texture-limit"};let a=i.filter(c=>t.maxDecodedBytes===void 0||Ad(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 Ht(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 In(e){let t=globalThis;if(t.requestIdleCallback){let r=t.requestIdleCallback(e,{timeout:1200});return()=>t.cancelIdleCallback?.(r)}let n=globalThis.setTimeout(e,32);return()=>globalThis.clearTimeout(n)}var Io=Ct(()=>{"use strict"});function Ua(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 Eo(e){return Math.max(Id,Math.min(Ed,e))}function Td(e,t,n){let r=(.5+e/360)*n;return t/2-r}function _d(e,t=Tn){return e*(180/t)}function Ha(e,t,n){return(e-t)/2+En(n,t)}function En(e,t){let n=ke/180*t;return Math.max(-n,Math.min(n,e))}function kd(){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 To(e){return e||(kd()?"Drag to look \xB7 pinch to zoom \xB7 tap \u2715 to close":"Drag to look \xB7 pinch or scroll to zoom \xB7 Esc to close")}function ja(e,t,n={}){let r=n.fadeMs??400,o=t.initialBearingDeg??0,i=Rn(t,An()),a=new AbortController,s=()=>a.abort();n.signal?.addEventListener("abort",s,{once:!0});let c=document.createElement("div"),u=document.activeElement instanceof HTMLElement?document.activeElement:null;c.setAttribute("role","dialog"),c.setAttribute("aria-modal","true"),c.setAttribute("aria-label",n.seatLabel?`View from ${n.seatLabel}`:"View from seat"),c.tabIndex=-1,Object.assign(c.style,{position:"absolute",inset:"0",zIndex:"10",opacity:"0",transition:`opacity ${r}ms ease`,background:"#05070c",overflow:"hidden",touchAction:"none"});let d=document.createElement("div");Object.assign(d.style,{position:"absolute",inset:"0",backgroundImage:`url("${i.initialUrl}")`,backgroundRepeat:"repeat-x",cursor:"grab"}),c.appendChild(d);let p=document.createElement("button");if(p.type="button",p.setAttribute("aria-label","Close"),p.textContent="\u2715",Object.assign(p.style,{position:"absolute",top:"12px",right:"12px",zIndex:"2",width:"44px",height:"44px",borderRadius:"999px",cursor:"pointer",border:"1px solid rgba(255,255,255,0.25)",background:"rgba(8,12,18,0.6)",color:"#e6edf3",fontSize:"15px",lineHeight:"1"}),c.appendChild(p),n.disclosure){let N=document.createElement("div");N.textContent=`${n.disclosurePrefix??"360\xB0 panorama"} \xB7 ${n.disclosure}`,Object.assign(N.style,{position:"absolute",top:"calc(12px + var(--sl-3d-top-inset, 0px))",left:"12px",zIndex:"2",maxWidth:"calc(100% - 88px)",padding:"8px 11px",borderRadius:"999px",overflow:"hidden",color:"#dce6f8",background:"rgba(8,12,18,0.68)",font:"600 11px/1.2 ui-sans-serif, system-ui, sans-serif",textOverflow:"ellipsis",whiteSpace:"nowrap",pointerEvents:"none",backdropFilter:"blur(6px)"}),c.appendChild(N)}let m=document.createElement("div");m.textContent=To(n.lookAroundHint),Object.assign(m.style,{position:"absolute",bottom:"12px",left:"0",right:"0",textAlign:"center",color:"rgba(230,237,243,0.7)",font:"12px ui-sans-serif, system-ui, sans-serif",pointerEvents:"none"}),c.appendChild(m),e.appendChild(c),p.focus({preventScroll:!0});let l=0,f=0,h=0,y=0,b=Tn,x=()=>{let N=c.clientHeight||1,F=c.clientWidth||1,K=P.naturalWidth||F*2,X=P.naturalHeight||N,Q=l>0?(F/2-h)/l:0,W=f>0?y/f:0;f=_d(N,b),l=f*(K/X),d.style.backgroundSize=`${l}px ${f}px`,g?h=F/2-Q*l:(h=Td(o,F,l),y=En((t.initialPitchDeg??0)/180*f,f),g=!0),y=En(W*f,f),d.style.backgroundPosition=`${h}px ${Ha(N,f,y)}px`},g=!1,v=()=>{let N=c.clientHeight||1;y=En(y,f),d.style.backgroundPosition=`${h}px ${Ha(N,f,y)}px`},P=new Image;P.onload=x,P.src=i.initialUrl;let S=()=>{};i.upgradeUrl&&(S=In(()=>{(t.resolveUrl?t.resolveUrl(i.upgradeUrl):Promise.resolve(i.upgradeUrl)).then(F=>!F||a.signal.aborted?null:Ht(F,a.signal).then(K=>({full:K,url:F}))).then(F=>{F&&(w||a.signal.aborted||(P=F.full,d.style.backgroundImage=`url("${F.url}")`,x()))}).catch(()=>{})})),requestAnimationFrame(x);let C=!1,T=0,B=0,z=0,D=new Map,k=()=>{let[N,F]=[...D.values()];return N&&F?Math.hypot(N.x-F.x,N.y-F.y):0},A=N=>{let F=Eo(N);F!==b&&(b=F,x())},_=N=>{D.set(N.pointerId,{x:N.clientX,y:N.clientY}),C=D.size===1,T=N.clientX,B=N.clientY,D.size===2&&(z=k()),d.style.cursor="grabbing";try{d.setPointerCapture?.(N.pointerId)}catch{}},V=N=>{if(D.has(N.pointerId)){if(D.set(N.pointerId,{x:N.clientX,y:N.clientY}),D.size>=2){let F=k();z>0&&F>0&&A(b*(z/F)),z=F,C=!1;return}C&&(h+=N.clientX-T,y+=N.clientY-B,T=N.clientX,B=N.clientY,v())}},M=N=>{D.delete(N.pointerId),z=D.size===2?k():0;let F=D.values().next().value;C=D.size===1,F?(T=F.x,B=F.y):d.style.cursor="grab";try{d.releasePointerCapture?.(N.pointerId)}catch{}},R=N=>{N.preventDefault(),A(b+N.deltaY*.04)};d.addEventListener("pointerdown",_),d.addEventListener("pointermove",V),d.addEventListener("pointerup",M),d.addEventListener("pointercancel",M),d.addEventListener("wheel",R,{passive:!1});let E=!1,w=!1,L=0,I=()=>{d.removeEventListener("pointerdown",_),d.removeEventListener("pointermove",V),d.removeEventListener("pointerup",M),d.removeEventListener("pointercancel",M),d.removeEventListener("wheel",R),window.removeEventListener("keydown",U)},O=()=>{S(),a.abort(),n.signal?.removeEventListener("abort",s),L&&(window.clearTimeout(L),L=0),I(),c.parentNode&&c.parentNode.removeChild(c),u?.isConnected&&u.focus({preventScroll:!0})},j=()=>{if(E)return;E=!0,c.style.opacity="0";let N=()=>{L=0,!w&&(O(),n.onClose?.())};L=window.setTimeout(N,r)},U=N=>{if(N.key==="Tab"){N.preventDefault(),p.focus({preventScroll:!0});return}if(N.key==="Escape"){N.stopPropagation(),j();return}if(N.key==="ArrowLeft"||N.key==="ArrowRight")h+=N.key==="ArrowLeft"?-32:32;else if(N.key==="ArrowUp"||N.key==="ArrowDown")y+=(N.key==="ArrowUp"?4:-4)*(f/180);else if(N.key==="+"||N.key==="="){A(b-5),N.preventDefault();return}else if(N.key==="-"){A(b+5),N.preventDefault();return}else return;N.preventDefault(),v()};return window.addEventListener("keydown",U),p.addEventListener("click",j),requestAnimationFrame(()=>{c.style.opacity="1"}),{close:j,dispose(){E=!0,w=!0,O()}}}var Tn,Id,Ed,ke,_n=Ct(()=>{"use strict";Io();Tn=70,Id=35,Ed=90;ke=35});function Od(e=Ld,t=Fd,n=Dd){let r=e+1,o=t+1,i=r*o,a=new Float32Array(i*3),s=new Float32Array(i*2);for(let d=0;d<o;d++){let p=d/t,m=p*Math.PI,l=Math.sin(m),f=Math.cos(m);for(let h=0;h<r;h++){let y=h/e,b=(y-.5)*Math.PI*2,x=d*r+h;a[x*3]=n*l*Math.sin(b),a[x*3+1]=n*f,a[x*3+2]=-n*l*Math.cos(b),s[x*2]=y,s[x*2+1]=p}}let c=new Uint16Array(e*t*6),u=0;for(let d=0;d<t;d++)for(let p=0;p<e;p++){let m=d*r+p,l=m+r;c[u++]=m,c[u++]=l,c[u++]=m+1,c[u++]=m+1,c[u++]=l,c[u++]=l+1}return{position:a,uv:s,index:c}}function Ya(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 Xa(e,t){let{position:n,uv:r,index:o}=Od(),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:Vd,fragment:Bd,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,Ld,Fd,Dd,Vd,Bd,Wa=Ct(()=>{"use strict";Ke=require("ogl"),Ld=64,Fd=32,Dd=500;Vd=`#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
- }`,Qu=`#version 300 es
11
+ }`,Bd=`#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 Ta(e,t,n,r={}){let o=r.fadeMs??400,i=t?.initialBearingDeg??0,a=Math.max(-Le,Math.min(Le,t?.initialPitchDeg??0)),s=Cn,c=!1,l=new AbortController,u=()=>l.abort();r.signal?.addEventListener("abort",u,{once:!0});let p=()=>{},d=[n.camera.position.x,n.camera.position.y,n.camera.position.z];if(!t&&n.cameraOriginWorld&&n.camera.position.set(n.cameraOriginWorld[0],n.cameraOriginWorld[1],n.cameraOriginWorld[2]),!t&&n.focalWorld){let D=n.camera.position,V=n.focalWorld[0]-D.x,H=n.focalWorld[1]-D.y,j=n.focalWorld[2]-D.z,_=Math.hypot(V,j);_>.001&&(i=Math.atan2(V,-j)*180/Math.PI,a=Math.max(-Le,Math.min(Le,Math.atan2(H,_)*180/Math.PI)))}let f=null;if(t){let D=n.gl.getParameter(n.gl.MAX_TEXTURE_SIZE),V=Mn(t,Sn(D)),H;try{let j=t.resolveUrl?await t.resolveUrl(V.initialUrl):V.initialUrl;if(!j)throw new Error("panorama_asset_unavailable");H=await Gt(j,l.signal)}catch{return r.signal?.removeEventListener("abort",u),null}try{f=Ia(n.gl,H)}catch{return l.abort(),r.signal?.removeEventListener("abort",u),null}f.mesh.renderOrder=999,f.mesh.setParent(n.scene),V.upgradeUrl&&(p=wn(()=>{(t.resolveUrl?t.resolveUrl(V.upgradeUrl):Promise.resolve(V.upgradeUrl)).then(_=>!_||l.signal.aborted?null:Gt(_,l.signal)).then(_=>{_&&(c||l.signal.aborted||(f?.setImage(_),n.requestRender()))}).catch(()=>{})}))}let m=n.camera.fov;n.camera.perspective({fov:s,aspect:n.camera.aspect});let h=n.camera.quaternion.slice(),y=()=>{let D=n.camera.position;f?.mesh.position.set(D.x,D.y,D.z);let[V,H,j]=Aa(i,a);n.camera.lookAt([D.x+V,D.y+H,D.z+j]),n.requestRender()};y();let b=document.createElement("div"),g=document.activeElement instanceof HTMLElement?document.activeElement:null;b.setAttribute("role","dialog"),b.setAttribute("aria-modal","true"),b.setAttribute("aria-label",r.seatLabel?`View from ${r.seatLabel}`:"View from seat"),b.tabIndex=-1,Object.assign(b.style,{position:"absolute",inset:"0",zIndex:"10",cursor:"grab",touchAction:"none"});let x=document.createElement("button");if(x.type="button",x.setAttribute("aria-label","Close"),x.textContent="\u2715",Object.assign(x.style,{position:"absolute",top:"12px",right:"12px",zIndex:"2",width:"44px",height:"44px",borderRadius:"999px",cursor:"pointer",border:"1px solid rgba(255,255,255,0.25)",background:"rgba(8,12,18,0.6)",color:"#e6edf3",fontSize:"15px",lineHeight:"1"}),b.appendChild(x),r.disclosure){let D=document.createElement("div");D.textContent=`${r.disclosurePrefix??"360\xB0 panorama"} \xB7 ${r.disclosure}`,Object.assign(D.style,{position:"absolute",top:"12px",left:"12px",zIndex:"2",maxWidth:"calc(100% - 88px)",padding:"8px 11px",borderRadius:"999px",overflow:"hidden",color:"#dce6f8",background:"rgba(8,12,18,0.68)",font:"600 11px/1.2 ui-sans-serif, system-ui, sans-serif",textOverflow:"ellipsis",whiteSpace:"nowrap",pointerEvents:"none",backdropFilter:"blur(6px)"}),b.appendChild(D)}let v=document.createElement("div");v.textContent="Drag to look \xB7 pinch or scroll to zoom \xB7 Esc to close",Object.assign(v.style,{position:"absolute",bottom:"12px",left:"0",right:"0",textAlign:"center",color:"rgba(230,237,243,0.7)",font:"12px ui-sans-serif, system-ui, sans-serif",pointerEvents:"none"}),b.appendChild(v),e.appendChild(b),x.focus({preventScroll:!0});let C=!1,S=0,A=0,L=0,O=new Map,z=()=>{let[D,V]=[...O.values()];return D&&V?Math.hypot(D.x-V.x,D.y-V.y):0},B=D=>{let V=Mo(D);V!==s&&(s=V,n.camera.perspective({fov:s,aspect:n.camera.aspect}),y())},T=D=>{D.target!==x&&(O.set(D.pointerId,{x:D.clientX,y:D.clientY}),C=O.size===1,S=D.clientX,A=D.clientY,O.size===2&&(L=z()),b.setPointerCapture?.(D.pointerId),b.style.cursor="grabbing")},w=D=>{if(O.has(D.pointerId)){if(O.set(D.pointerId,{x:D.clientX,y:D.clientY}),O.size>=2){let V=z();L>0&&V>0&&B(s*(L/V)),L=V,C=!1;return}C&&(i+=(D.clientX-S)*Ea,a=Math.max(-Le,Math.min(Le,a+(D.clientY-A)*Ea)),S=D.clientX,A=D.clientY,y())}},R=D=>{O.delete(D.pointerId),L=O.size===2?z():0;let V=O.values().next().value;C=O.size===1,V?(S=V.x,A=V.y):b.style.cursor="grab";try{b.releasePointerCapture?.(D.pointerId)}catch{}},P=D=>{D.preventDefault(),B(s+D.deltaY*.04)};b.addEventListener("pointerdown",T),b.addEventListener("pointermove",w),b.addEventListener("pointerup",R),b.addEventListener("pointercancel",R),b.addEventListener("wheel",P,{passive:!1});let I=D=>{if(!c){if(D.key==="Tab"){D.preventDefault(),x.focus({preventScroll:!0});return}if(D.key==="Escape"){D.stopPropagation(),E.close();return}if(D.key==="ArrowLeft"||D.key==="ArrowRight")i+=D.key==="ArrowLeft"?-4:4;else if(D.key==="ArrowUp"||D.key==="ArrowDown")a=Math.max(-Le,Math.min(Le,a+(D.key==="ArrowUp"?4:-4)));else if(D.key==="+"||D.key==="="){B(s-5),D.preventDefault();return}else if(D.key==="-"){B(s+5),D.preventDefault();return}else return;D.preventDefault(),y()}};window.addEventListener("keydown",I);let G=0,k=(D,V)=>{if(!f){V?.();return}let H=D===1?0:1,j=performance.now(),_=()=>{if(c)return;let F=o<=0?1:Math.min(1,(performance.now()-j)/o);f?.setOpacity(H+(D-H)*F),n.requestRender(),F<1?G=requestAnimationFrame(_):V?.()};G=requestAnimationFrame(_)};k(1);let M=()=>{c||(c=!0,p(),l.abort(),r.signal?.removeEventListener("abort",u),cancelAnimationFrame(G),b.removeEventListener("pointerdown",T),b.removeEventListener("pointermove",w),b.removeEventListener("pointerup",R),b.removeEventListener("pointercancel",R),b.removeEventListener("wheel",P),window.removeEventListener("keydown",I),b.remove(),g?.isConnected&&g.focus({preventScroll:!0}),f?.dispose(),n.camera.position.set(d[0],d[1],d[2]),n.camera.perspective({fov:m,aspect:n.camera.aspect}),n.camera.quaternion.set(h[0],h[1],h[2],h[3]),n.requestRender())},E={close(){if(c)return;let D=()=>{M(),r.onClose?.()};cancelAnimationFrame(G),k(0,D)},dispose:M};return x.addEventListener("click",()=>E.close()),E}var Ea,ka=wt(()=>{"use strict";Ra();wo();So();Ea=.15});var La={};Eo(La,{createOpenPanorama:()=>$u});function $u(e){let{container:t,model:n,opts:r,analytics:o,orbit:i,loop:a,seatsById:s,ensureSeatView:c,resolvedSeatViewPose:l,gpu:u,gl:p,isContextLost:d,isDisposed:f,flightGen:m,setPanorama:h,getLoadAbort:y,setLoadAbort:b,setPanoramaSphereVisible:g,setFrozen:x,raisePanoramaLayer:v,restorePanoramaLayer:C,getOverviewChip:S,labelOverlay:A,reducedMotion:L,removeArriveChip:O,showArriveChip:z}=e;return async(B,T,w)=>{y()?.abort();let R=new AbortController;b(R);let P=n.seats.idToIndex.get(B);if(P===void 0){i.syncFromCamera();return}let I=s.get(B)?.label??B,G=l(B,P),k=c(B);if(!k){R.abort(),y()===R&&b(null),i.syncFromCamera();return}x(!0),a.stop();let M;try{M=await k}catch{if(y()===R&&b(null),o.panoramaFailed(B,"source"),!f()&&w===m()){x(!1),i.resumeAfterFlight(G.focal),a.requestRender();let X=z(B,w,!0);requestAnimationFrame(()=>X?.querySelector("[data-panorama-trigger]")?.focus())}return}if(f()||w!==m()){R.abort(),y()===R&&b(null);return}O();let E=S(),D=()=>{R.abort(),y()===R&&b(null),h(null),g(!1),C(),E.style.display="",A.setVisible(!r.arriveAtSeatEye),x(!1),o.panoramaClosed(),i.resumeAfterFlight(G.focal),a.requestRender();let X=z(B,m());requestAnimationFrame(()=>X?.querySelector("[data-panorama-trigger]")?.focus())},V=M.generated===!0,H=Pa(M);v(),g(!V),E.style.display="none";let j=L()?0:T,_=u(),F=_&&!d()?await Ta(t,V?null:M,{gl:p,scene:_.main,camera:i.camera,requestRender:()=>a.requestRender(),cameraOriginWorld:V?G.eye:void 0,focalWorld:G.focal},{fadeMs:j,seatLabel:I,disclosure:H,disclosurePrefix:V?"Live seat-eye view":"360\xB0 panorama",onClose:D,signal:R.signal}):null;if(f()||w!==m()){R.abort(),g(!1),y()===R&&b(null),F?.dispose(),E.style.display="",C();return}if(F)i.syncFromCamera(),A.setVisible(!1),x(!1),a.requestRender(),h(F);else if(V){C(),E.style.display="",x(!1),i.resumeAfterFlight(G.focal),a.requestRender(),h(null),g(!1),o.panoramaFailed(B,"mount");let X=z(B,m(),!0);requestAnimationFrame(()=>X?.querySelector("[data-panorama-trigger]")?.focus()),y()===R&&b(null);return}else g(!1),o.panoramaFallback(B),h(Ca(t,M,{fadeMs:j,seatLabel:I,disclosure:H,onClose:D,signal:R.signal}));o.panoramaOpened()}}var _a=wt(()=>{"use strict";wo();ka()});var rd={};Eo(rd,{VENUE3D_QUALITY_REPORT_VERSION:()=>Fi,buildSceneModel:()=>bt,inspectVenue3DQualityEvidence:()=>bn,mountVenue3D:()=>od,prepareVenue3D:()=>Ha,prepareVenue3DFromChart:()=>ja});module.exports=ns(rd);var Fo=require("ogl");var os=/^#?([\da-f]{3}|[\da-f]{6})$/i;function rs(e){let t=os.exec((e??"").trim());if(!t)return null;let n=t[1].length===3?t[1].split("").map(o=>o+o).join(""):t[1],r=parseInt(n,16);return[r>>16&255,r>>8&255,r&255]}function ee(e){let t=rs(e);return t?[t[0]/255,t[1]/255,t[2]/255]:null}function _n(e){let t=e/255;return t<=.04045?t/12.92:((t+.055)/1.055)**2.4}function is(e){return .2126*_n(e[0])+.7152*_n(e[1])+.0722*_n(e[2])}function ko(e){return is([e[0]*255,e[1]*255,e[2]*255])}function as(e){return .2126*e[0]+.7152*e[1]+.0722*e[2]}function he(e,t,n){return[e[0]+(t[0]-e[0])*n,e[1]+(t[1]-e[1])*n,e[2]+(t[2]-e[2])*n]}function Pt(e,t){let n=as(e);return he(e,[n,n,n],t)}var Ae=["available","held","sold","selected","dimmed"];function Ct(e){let t=Ae.indexOf(e);return t<0?0:t}var Lo={available:[.24,.82,.52],held:[.95,.66,.22],sold:[.34,.39,.45],selected:[.24,.74,1],dimmed:[.28,.32,.37]};function _o(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 Fn={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 ve(e,t){return[Math.min(1,e[0]*t),Math.min(1,e[1]*t),Math.min(1,e[2]*t)]}function ss(){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 Wt=class{constructor(t,n){this.clearRgb=[0,0,0];this.container=t,this.canvas=document.createElement("canvas"),this.canvas.style.display="block",this.canvas.style.width="100%",this.canvas.style.height="100%",this.canvas.style.touchAction="none",this.canvas.tabIndex=0,this.canvas.setAttribute("role","application"),this.canvas.setAttribute("aria-label","Interactive 3D venue. Drag or use arrow keys to look around; pinch, scroll, plus or minus to zoom."),this.renderer=new Fo.Renderer({canvas:this.canvas,dpr:ss(),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 lt=require("ogl"),me=Math.PI/180,Dn=15*me,On=80*me,ct=.12,Do=35,Oo=1.25,Kt=class{constructor(t,n,r,o){this.fovY=Do;this.target=new lt.Vec3;this.azimuth=-30*me;this.polar=55*me;this.distance=10;this.azT=-30*me;this.polT=55*me;this.distT=10;this.minDist=1;this.maxDist=100;this.gestureFired=!1;this.interactionEnabled=!0;this.dragging=!1;this.panning=!1;this.lastX=0;this.lastY=0;this.activePointers=new Map;this.pinchDist=0;this.pinchCx=0;this.pinchCy=0;this.targetT=new lt.Vec3;this.panAnchor=new lt.Vec3;this.panLimit=0;this.primaryDragMode="orbit";this.camera=new lt.Camera(t,{fov:Do,near:.1,far:5e3,aspect:1}),this.canvas=n,this.requestRender=r,this.onGesture=o,this.onPointerDown=i=>{if(this.interactionEnabled){try{this.canvas.setPointerCapture?.(i.pointerId)}catch{}if(this.activePointers.set(i.pointerId,{x:i.clientX,y:i.clientY}),this.activePointers.size===1){let a=i.button===2||i.button===1,s=i.button===0&&(i.shiftKey?this.primaryDragMode==="orbit":this.primaryDragMode==="pan");this.panning=a||s,this.dragging=!this.panning,this.lastX=i.clientX,this.lastY=i.clientY}else if(this.activePointers.size===2){this.dragging=!1,this.panning=!1,this.pinchDist=this.currentPinchDistance();let a=this.pinchCentroid();this.pinchCx=a.x,this.pinchCy=a.y}}},this.onPointerMove=i=>{if(!this.interactionEnabled||!this.activePointers.has(i.pointerId))return;if(this.activePointers.set(i.pointerId,{x:i.clientX,y:i.clientY}),this.activePointers.size>=2){let c=this.currentPinchDistance();this.pinchDist>0&&(this.dollyBy(Math.exp((this.pinchDist-c)*.005)),this.fireGesture()),this.pinchDist=c;let l=this.pinchCentroid();this.panBy(l.x-this.pinchCx,l.y-this.pinchCy),this.pinchCx=l.x,this.pinchCy=l.y;return}let a=i.clientX-this.lastX,s=i.clientY-this.lastY;if(this.panning){this.lastX=i.clientX,this.lastY=i.clientY,(a!==0||s!==0)&&(this.panBy(a,s),this.fireGesture());return}this.dragging&&(this.lastX=i.clientX,this.lastY=i.clientY,(a!==0||s!==0)&&this.fireGesture(),this.azT-=a*.006,this.polT=Math.max(Dn,Math.min(On,this.polT-s*.006)),this.requestRender())},this.onPointerUp=i=>{this.activePointers.delete(i.pointerId);try{this.canvas.releasePointerCapture?.(i.pointerId)}catch{}this.activePointers.size<2&&(this.pinchDist=0),this.activePointers.size===0&&(this.dragging=!1,this.panning=!1)},this.onContextMenu=i=>{i.preventDefault()},this.onWheel=i=>{if(i.preventDefault(),!this.interactionEnabled)return;let a=i.deltaMode===1?16:i.deltaMode===2?100:1,s=Math.max(-2,Math.min(2,i.deltaY*a/100));this.dollyBy(Math.exp(s*.22)),this.fireGesture()},this.onKeyDown=i=>{if(!this.interactionEnabled)return;let a=7*me;if(i.shiftKey&&(i.key==="ArrowLeft"||i.key==="ArrowRight"||i.key==="ArrowUp"||i.key==="ArrowDown"))this.panBy(i.key==="ArrowLeft"?-32:i.key==="ArrowRight"?32:0,i.key==="ArrowUp"?-32:i.key==="ArrowDown"?32:0);else if(i.key==="ArrowLeft"||i.key==="ArrowRight")this.azT+=i.key==="ArrowLeft"?-a:a;else if(i.key==="ArrowUp"||i.key==="ArrowDown")this.polT=Math.max(Dn,Math.min(On,this.polT+(i.key==="ArrowUp"?-a:a)));else if(i.key==="+"||i.key==="=")this.dollyBy(.82);else if(i.key==="-"||i.key==="_")this.dollyBy(1.22);else return;i.preventDefault(),this.fireGesture(),this.requestRender()},n.addEventListener("pointerdown",this.onPointerDown),n.addEventListener("pointermove",this.onPointerMove),n.addEventListener("pointerup",this.onPointerUp),n.addEventListener("pointercancel",this.onPointerUp),n.addEventListener("wheel",this.onWheel,{passive:!1}),n.addEventListener("keydown",this.onKeyDown),n.addEventListener("contextmenu",this.onContextMenu)}pinchCentroid(){let t=[...this.activePointers.values()];if(!t.length)return{x:0,y:0};let n=0,r=0;for(let o of t)n+=o.x,r+=o.y;return{x:n/t.length,y:r/t.length}}panBy(t,n){let r=this.canvas.clientHeight||1,o=2*this.distance*Math.tan(this.fovY*me/2)/r,i=Math.sin(this.azimuth),a=Math.cos(this.azimuth),s=a,c=-i,l=Math.cos(this.polar),u=Math.sin(this.polar),p=-i*l,d=-a*l;this.targetT.x+=(-t*s+n*p)*o,this.targetT.z+=(-t*c+n*d)*o,this.targetT.y+=n*u*o,this.clampPan(),this.requestRender()}clampPan(){if(this.panLimit<=0)return;let t=this.panLimit,n=this.panAnchor.x,r=this.panAnchor.y,o=this.panAnchor.z;this.targetT.x=Math.max(n-t,Math.min(n+t,this.targetT.x)),this.targetT.z=Math.max(o-t,Math.min(o+t,this.targetT.z)),this.targetT.y=Math.max(r-t*.5,Math.min(r+t,this.targetT.y))}fireGesture(){this.gestureFired||(this.gestureFired=!0,this.onGesture?.())}currentPinchDistance(){let t=[...this.activePointers.values()];return t.length<2?0:Math.hypot(t[0].x-t[1].x,t[0].y-t[1].y)}dollyBy(t){this.distT=Math.max(this.minDist,Math.min(this.maxDist,this.distT*t)),this.requestRender()}zoomBy(t){this.interactionEnabled&&(this.dollyBy(t),this.fireGesture())}setPrimaryDragMode(t){this.primaryDragMode=t}setInteractionEnabled(t){this.interactionEnabled=t,!t&&(this.activePointers.clear(),this.dragging=!1,this.panning=!1,this.pinchDist=0)}frame(t,n=!1,r,o=!1,i){this.target.set(t.center[0],t.center[1],t.center[2]),this.targetT.copy(this.target),this.panAnchor.copy(this.target),this.panLimit=Math.max(1,t.radius)*1.5;let a=Math.max(1,t.radius),s=this.fovY*me/2,c=o?Math.max(.82,this.camera.aspect||1):this.camera.aspect||1,l=Math.atan(Math.tan(s)*c);this.azT=r??-30*me,this.polT=Math.max(15,Math.min(80,i?.polarDeg??55))*me;let u=this.fitDistance(t,s,l,this.azT,this.polT);this.distT=u*Math.max(1.05,Math.min(2,i?.margin??Oo)),this.minDist=Math.max(2,a*.12),this.maxDist=u*4,n?(this.azimuth=this.azT,this.polar=12*me,this.distance=this.distT*1.7):(this.azimuth=this.azT,this.polar=this.polT,this.distance=this.distT),this.applyPosition()}setAspect(t){this.camera.perspective({aspect:t})}frameSoft(t,n,r=!1,o){this.target.set(t.center[0],t.center[1],t.center[2]),this.targetT.copy(this.target),this.panAnchor.copy(this.target),this.panLimit=Math.max(1,t.radius)*1.5,this.syncFromCamera(),this.camera.perspective({fov:this.fovY,aspect:this.camera.aspect});let i=this.fovY*me/2,a=r?Math.max(.82,this.camera.aspect||1):this.camera.aspect||1,s=Math.atan(Math.tan(i)*a);this.azT=n??this.azimuth,this.polT=Math.max(15,Math.min(80,o?.polarDeg??55))*me;let c=this.fitDistance(t,i,s,this.azT,this.polT);this.distT=c*Math.max(1.05,Math.min(2,o?.margin??Oo))}fitDistance(t,n,r,o,i){let a=Math.max(1,t.radius),s=Math.max(a/Math.tan(n),a/Math.tan(r)),c=t.box;if(!c)return s;let l=Math.sin(i),u=-l*Math.sin(o),p=-Math.cos(i),d=-l*Math.cos(o);if(Math.abs(p)>.999)return s;let f=-d,m=u,h=Math.hypot(f,m);f/=h,m/=h;let y=-m*p,b=m*u-f*d,g=f*p,x=Math.tan(r),v=Math.tan(n),C=1;for(let S=0;S<8;S++){let A=(S&1?c.max[0]:c.min[0])-t.center[0],L=(S&2?c.max[1]:c.min[1])-t.center[1],O=(S&4?c.max[2]:c.min[2])-t.center[2],z=A*u+L*p+O*d,B=Math.abs(A*f+O*m),T=Math.abs(A*y+L*b+O*g);C=Math.max(C,B/x-z,T/v-z)}return Math.min(s,Math.max(C,a*.35))}updateClipping(t){let n=this.camera.position.x-t.center[0],r=this.camera.position.y-t.center[1],o=this.camera.position.z-t.center[2],i=Math.hypot(n,r,o),a=Math.max(1,t.radius)*1.18,s=Math.max(.05,i-a),c=Math.max(s+10,i+a);this.camera.perspective({near:s,far:c,aspect:this.camera.aspect})}update(){let t=this.azT-this.azimuth,n=this.polT-this.polar,r=this.distT-this.distance,o=this.targetT.x-this.target.x,i=this.targetT.y-this.target.y,a=this.targetT.z-this.target.z,s=Math.max(1e-4,this.distance*1e-4),c=Math.abs(t)>1e-4||Math.abs(n)>1e-4||Math.abs(r)>1e-4||Math.abs(o)>s||Math.abs(i)>s||Math.abs(a)>s;return this.azimuth+=t*ct,this.polar+=n*ct,this.distance+=r*ct,this.target.x+=o*ct,this.target.y+=i*ct,this.target.z+=a*ct,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(Dn,Math.min(On,Math.acos(Math.max(-1,Math.min(1,n/o)))));this.distance=this.distT=o,this.polar=this.polT=i,this.azimuth=this.azT=Math.atan2(t,r)}setTarget(t){this.target.set(t[0],t[1],t[2]),this.targetT.copy(this.target)}resumeAfterFlight(t){this.camera.perspective({fov:this.fovY,aspect:this.camera.aspect}),t&&this.target.set(t[0],t[1],t[2]),this.targetT.copy(this.target),this.syncFromCamera()}applyPosition(){let t=Math.sin(this.polar),n=this.target.x+this.distance*t*Math.sin(this.azimuth),r=this.target.y+this.distance*Math.cos(this.polar),o=this.target.z+this.distance*t*Math.cos(this.azimuth);this.camera.position.set(n,r,o),this.camera.lookAt(this.target)}dispose(){this.canvas.removeEventListener("pointerdown",this.onPointerDown),this.canvas.removeEventListener("pointermove",this.onPointerMove),this.canvas.removeEventListener("pointerup",this.onPointerUp),this.canvas.removeEventListener("pointercancel",this.onPointerUp),this.canvas.removeEventListener("wheel",this.onWheel),this.canvas.removeEventListener("keydown",this.onKeyDown),this.canvas.removeEventListener("contextmenu",this.onContextMenu),this.activePointers.clear()}};var qt=class{constructor(t){this.rafId=0;this.running=!1;this.lastTime=0;this.fpsEma=0;this.rendered=0;this.tick=t=>{let n=this.lastTime?(t-this.lastTime)/1e3:.016666666666666666;if(this.lastTime=t,n>0){let o=1/n;this.fpsEma=this.fpsEma?this.fpsEma*.9+o*.1:o}this.rendered++,this.frame(n)?this.rafId=requestAnimationFrame(this.tick):(this.running=!1,this.rafId=0)};this.frame=t}requestRender(){this.running||(this.running=!0,this.lastTime=0,this.rafId=requestAnimationFrame(this.tick))}stats(){return{fps:this.running?Math.round(this.fpsEma):0,rendered:this.rendered,idle:!this.running}}stop(){this.rafId&&cancelAnimationFrame(this.rafId),this.rafId=0,this.running=!1}};function Vo(e,t,n){return Math.max(t,Math.min(n,e))}var ut=2.5,cs=1.15,At=6,dt=10,Bo=6,No=9.5,Go=.9,zo=2.2,Vn=30,Bn=4,Qt=8192;var pd=dt+Bn;function Uo(e,t){let n=t*1.4,r=t*3.2;if(e<=n)return{scale:1,fade:0,minPixels:ut};let o=Math.min(1,(e-n)/Math.max(.001,r-n));return{scale:1-o*.4,fade:o*.55,minPixels:ut+o*(cs-ut)}}function Ho(e,t,n){return!(e>0)||!(t>0)||!(n>0)?!1:t*n/e>=64}function jo(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 ls=[{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"}],bd=new Map(ls.map(e=>[e.key,e]));var us={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 Xo(e){let t=e?.[0];return t&&us[t]||"#3b82f6"}var ds=[{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"}],yd=new Map(ds.map(e=>[e.key,e]));var ms=["reference-focal","bar","entrance","exit","restroom","screen","sound","concession","coat","wall","rail","suite","obstruction"],gd=new Set(ms);var Wo=[{key:"circle",label:"Standard seat",shortLabel:"Standard",useCase:"General assigned seating",group:"general",path:null,bounds:null},{key:"theatre",label:"Theatre chair",shortLabel:"Theatre",useCase:"Auditoriums, arenas and stadium stands",group:"fixed",path:"M4.5 3.5 Q4.5 1.5 6.5 1.5 L17.5 1.5 Q19.5 1.5 19.5 3.5 L19.5 13 L4.5 13 Z M3.5 12 L20.5 12 Q22.5 12 22.5 14 L22.5 21 Q22.5 22.5 21 22.5 Q19.5 22.5 19.5 21 L19.5 17.5 L4.5 17.5 L4.5 21 Q4.5 22.5 3 22.5 Q1.5 22.5 1.5 21 L1.5 14 Q1.5 12 3.5 12 Z",bounds:{x:1.5,y:1.5,width:21,height:21}},{key:"dining",label:"Dining chair",shortLabel:"Dining",useCase:"Banquets, restaurants and table seating",group:"flexible",path:"M7 1 Q6 1 6 2.5 L6.75 10.5 L5 10.5 Q4 10.5 4 12 L4 14 Q4 15 5.25 15 L6 15 L4 23 L7 23 L9.5 15 L14.5 15 L17 23 L20 23 L18 15 L18.75 15 Q20 15 20 14 L20 12 Q20 10.5 19 10.5 L17.25 10.5 L18 2.5 Q18 1 17 1 Z",bounds:{x:4,y:1,width:16,height:22}},{key:"folding",label:"Folding chair",shortLabel:"Folding",useCase:"Concert floors, ceremonies and conferences",group:"flexible",path:"M6 2 Q5 2 5 3 L6 8 L18 8 L19 3 Q19 2 18 2 Z M5 9 L19 9 Q20 9 20 10.5 L19 13 L5 13 L4 10.5 Q4 9 5 9 Z M6 12 L9 12 L12 17 L15 12 L18 12 L14 19 L17 23 L14 23 L12 21 L10 23 L7 23 L10 19 Z",bounds:{x:4,y:2,width:16,height:21}},{key:"armchair",label:"Premium armchair",shortLabel:"Armchair",useCase:"Boxes, lounges and club seating",group:"premium",path:"M3.5 4 Q3.5 1.5 6 1.5 L18 1.5 Q20.5 1.5 20.5 4 L20.5 13 L3.5 13 Z M1.5 12.5 Q1.5 10 3.25 10 Q5 10 5 12.5 L5 13.5 L19 13.5 L19 12.5 Q19 10 20.75 10 Q22.5 10 22.5 12.5 L22.5 19.5 Q22.5 22 20 22 L4 22 Q1.5 22 1.5 19.5 Z",bounds:{x:1.5,y:1.5,width:21,height:20.5}},{key:"recliner",label:"Recliner",shortLabel:"Recliner",useCase:"Luxury cinemas and premium clubs",group:"premium",path:"M7 2 Q7 1 8.5 1 L15.5 1 Q17 1 17 2 L19 13 L5 13 Z M4 9 Q2 9 2 11.5 L2 16 Q2 18 4 18 L6 18 L6 15 L18 15 L18 18 L20 18 Q22 18 22 16 L22 11.5 Q22 9 20 9 Q18 9 18 11 L18 13 L6 13 L6 11 Q6 9 4 9 Z M7 17 L17 17 Q18 17 18.5 18.5 L19.5 22.5 L4.5 22.5 L5.5 18.5 Q6 17 7 17 Z",bounds:{x:2,y:1,width:20,height:21.5}},{key:"stool",label:"Stool",shortLabel:"Stool",useCase:"Bars, high-tops and seating rails",group:"flexible",path:"M6 2.5 L18 2.5 Q22 2.5 22 6.5 L22 12 Q22 16 18 16 L6 16 Q2 16 2 12 L2 6.5 Q2 2.5 6 2.5 Z M6 15.5 L9.5 15.5 L7.5 22.5 L3 22.5 Z M14.5 15.5 L18 15.5 L20.5 22.5 L16 22.5 Z",bounds:{x:2,y:2.5,width:20,height:20}},{key:"bench",label:"Bench place",shortLabel:"Bench",useCase:"Pews, bleachers and terraces",group:"fixed",path:"M2.5 0.5 L21.5 0.5 Q23 0.5 23 2 L23 5 Q23 6.5 21.5 6.5 L2.5 6.5 Q1 6.5 1 5 L1 2 Q1 0.5 2.5 0.5 Z M2 7.5 L22 7.5 Q23.5 7.5 23.5 9 L23.5 15.5 Q23.5 17 22 17 L18 17 L18 21.5 Q18 22.5 16.75 22.5 Q15.5 22.5 15.5 21.5 L15.5 17 L8.5 17 L8.5 21.5 Q8.5 22.5 7.25 22.5 Q6 22.5 6 21.5 L6 17 L2 17 Q0.5 17 0.5 15.5 L0.5 9 Q0.5 7.5 2 7.5 Z",bounds:{x:.5,y:.5,width:23,height:22}}],Ko=Wo.map(e=>e.key),fs=new Map(Wo.map(e=>[e.key,e]));function Yo(e){return typeof e=="string"&&fs.has(e)}function qo(e,t){return Yo(e)?e:Yo(t?.seatGlyph)?t.seatGlyph:"circle"}var Se=.02291666666666667,He=1/Se,ps=58,hs=ps*Se;var bs=3,Qo=0,Nn=120,ys=0,gs=45,xs=7,je=1.2;function Gn(e,t,n,r){return Number.isFinite(e)?Math.max(t,Math.min(n,e)):r}function vs(e){return!Number.isFinite(e)||!Number.isInteger(e)||e<0?0:e<=xs?e:bs}function $t(e,t={}){let n=Gn(t.floorBaseHeightM,Qo,Nn,0),r=Math.min(Nn,n+vs(e.elevation)*hs),o=e.height===void 0?r:Gn(e.height,Qo,Nn,r),i=Gn(e.rake,ys,gs,0);return{height:o,rake:i}}var Zo=st(require("earcut"),1),Jo=st(require("polygon-clipping"),1);var Pd=Math.PI/180;function zn(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 It(e){return e.length?zn(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 Rt(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 N=Se,Ss=.002;function Ms(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<Ss}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)}},en=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){Ms(t,n,r)||(this.pos.push3(t[0],t[1],t[2]),this.pos.push3(n[0],n[1],n[2]),this.pos.push3(r[0],r[1],r[2]),this.nor.push3(o[0],o[1],o[2]),this.nor.push3(o[0],o[1],o[2]),this.nor.push3(o[0],o[1],o[2]),this.col.push3(i[0],i[1],i[2]),this.col.push3(a[0],a[1],a[2]),this.col.push3(s[0],s[1],s[2]),this.flr.push1(this.currentFloor),this.flr.push1(this.currentFloor),this.flr.push1(this.currentFloor),this.mat.push1(this.currentMaterial),this.mat.push1(this.currentMaterial),this.mat.push1(this.currentMaterial))}triN(t,n,r,o,i,a,s,c=s,l=s){[...t,...n,...r].every(Number.isFinite)&&(this.pos.push3(t[0],t[1],t[2]),this.pos.push3(n[0],n[1],n[2]),this.pos.push3(r[0],r[1],r[2]),this.nor.push3(o[0],o[1],o[2]),this.nor.push3(i[0],i[1],i[2]),this.nor.push3(a[0],a[1],a[2]),this.col.push3(s[0],s[1],s[2]),this.col.push3(c[0],c[1],c[2]),this.col.push3(l[0],l[1],l[2]),this.flr.push1(this.currentFloor),this.flr.push1(this.currentFloor),this.flr.push1(this.currentFloor),this.mat.push1(this.currentMaterial),this.mat.push1(this.currentMaterial),this.mat.push1(this.currentMaterial))}get vertexCount(){return this.pos.length/3}build(){return{position:this.pos.toArray(),normal:this.nor.toArray(),color:this.col.toArray(),floor:this.flr.toArray(),material:this.mat.toArray(),count:this.pos.length/3}}};function ws(e,t,n){let r=t[0]-e[0],o=t[1]-e[1],i=t[2]-e[2],a=n[0]-e[0],s=n[1]-e[1],c=n[2]-e[2],l=o*c-i*s,u=i*a-r*c,p=r*s-o*a,d=Math.hypot(l,u,p)||1;return l/=d,u/=d,p/=d,[l,u,p]}function Ps(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,Zo.default)(r,o.length?o:void 0,2);return{pts:n,tris:i}}function Un(e){return et(e)<0?[...e].reverse():e}var Cs=3;function As(e,t,n,r){let o=r(e),i=r(t),a=r(n),s=(f,m,h,y)=>Math.abs(r({x:(f.x+m.x)/2,y:(f.y+m.y)/2})-(h+y)/2),c=(e.x+t.x+n.x)/3,l=(e.y+t.y+n.y)/3,u=(o+i+a)/3,p=Math.max(s(e,t,o,i),s(t,n,i,a),s(n,e,a,o),Math.abs(r({x:c,y:l})-u)),d=(f,m,h)=>{let y=Math.abs(r({x:(f+c)/2,y:(m+l)/2})-(h+u)/2);y>p&&(p=y)};return d((e.x+t.x)/2,(e.y+t.y)/2,(o+i)/2),d((t.x+n.x)/2,(t.y+n.y)/2,(i+a)/2),d((n.x+e.x)/2,(n.y+e.y)/2,(a+o)/2),p}function Et(e,t,n,r,o){if(o<=0)return As(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(Et(e,i,s,r,o-1),Et(i,t,a,r,o-1),Et(s,a,n,r,o-1),Et(i,a,s,r,o-1))}function Tt(e,t,n,r,o,i,a,s){if(a>0){let d={x:(t.x+n.x)/2,y:(t.y+n.y)/2},f={x:(n.x+r.x)/2,y:(n.y+r.y)/2},m={x:(r.x+t.x)/2,y:(r.y+t.y)/2};Tt(e,t,d,m,o,i,a-1,s),Tt(e,d,n,f,o,i,a-1,s),Tt(e,m,f,r,o,i,a-1,s),Tt(e,d,f,m,o,i,a-1,s);return}let c=[t.x*N,o(t),t.y*N],l=[n.x*N,o(n),n.y*N],u=[r.x*N,o(r),r.y*N];if(s){e.triN(c,l,u,s(t),s(n),s(r),i);return}let p=ws(c,l,u);p[1]<0&&(p=[-p[0],-p[1],-p[2]]),e.tri(c,l,u,p,i)}var Is=8;function $o(e,t,n){if(!Number.isFinite(n))return e;let r=[],o=(i,a,s,c,l)=>{if(l>0){let u={x:(i.x+a.x)/2,y:(i.y+a.y)/2},p=t(u);if(Math.abs(p-(s+c)/2)>n){o(i,u,s,p,l-1),o(u,a,p,c,l-1);return}}r.push(i)};for(let i=0;i<e.length;i++){let a=e[i],s=e[(i+1)%e.length];o(a,s,t(a),t(s),Is)}return r}function Zt(e,t){if(e.length<3)return e;let n=[];for(let o of e){let i=n[n.length-1];i&&Math.hypot(o.x-i.x,o.y-i.y)<t||n.push(o)}for(;n.length>2&&Math.hypot(n[0].x-n[n.length-1].x,n[0].y-n[n.length-1].y)<t;)n.pop();if(n.length<3)return e;let r=[];for(let o=0;o<n.length;o++){let i=r.length?r[r.length-1]:n[(o-1+n.length)%n.length],a=n[o],s=n[(o+1)%n.length],c=s.x-i.x,l=s.y-i.y,u=Math.hypot(c,l);u>t&&Math.abs((a.x-i.x)*l-(a.y-i.y)*c)/u<t||r.push(a)}return r.length>=3?r:n}var Jt=.001*He*.1;function le(e,t,n,r,o,i,a,s,c=1/0,l){if(!t||t.length<3||(c===void 0&&(c=1/0),Math.abs(et(t))<1e-4))return;let u=Zt($o(Zt(Un(t),Jt),r,c),Jt),p=n?.map(S=>Zt($o(Zt(Un(S),Jt),r,c),Jt)).filter(S=>S.length>=3&&Math.abs(et(S))>=1e-4),{pts:d,tris:f}=Ps(u,p),m=[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],y=[a[0]*s.top,a[1]*s.top,a[2]*s.top],b=[a[0]*s.wallBottom,a[1]*s.wallBottom,a[2]*s.wallBottom],g=0;if(Number.isFinite(c))for(;g<Cs;g++){let S=0;for(let A=0;A<f.length;A+=3){let L=Et(d[f[A]],d[f[A+1]],d[f[A+2]],r,g);L>S&&(S=L)}if(S<=c)break}for(let S=0;S<f.length;S+=3){let A=d[f[S]],L=d[f[S+1]],O=d[f[S+2]];Tt(e,A,L,O,r,m,g,l);let z=[A.x*N,o,A.y*N],B=[L.x*N,o,L.y*N],T=[O.x*N,o,O.y*N];e.tri(z,T,B,[0,-1,0],h)}let x=S=>{if(g<=0)return S;let A=1<<g,L=[];for(let O=0;O<S.length;O++){let z=S[O],B=S[(O+1)%S.length];for(let T=0;T<A;T++){let w=T/A;L.push({x:z.x+(B.x-z.x)*w,y:z.y+(B.y-z.y)*w})}}return L},v=zn(u),C=[{ring:x(u),flip:!1}];if(p)for(let S of p)S.length>=3&&C.push({ring:x(S),flip:!0});for(let{ring:S,flip:A}of C)for(let L=0;L<S.length;L++){let O=S[L],z=S[(L+1)%S.length],B=(z.x-O.x)*N,w=(z.y-O.y)*N,R=-B,P=Math.hypot(w,R)||1;w/=P,R/=P;let I=(O.x+z.x)/2-v.x,G=(O.y+z.y)/2-v.y,k=w*I+R*G;A&&(k=-k),k<0&&(w=-w,R=-R);let M=[w,0,R],E=[O.x*N,r(O),O.y*N],D=[z.x*N,r(z),z.y*N],V=[O.x*N,o,O.y*N],H=[z.x*N,o,z.y*N];e.tri(E,D,H,M,y,y,b),e.tri(E,H,V,M,y,b,b)}}function er(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 tn(e,t,n=2.5){if(t<=0||e.length<3)return e;let r=Un(e),o=r.length,i=[];for(let s=0;s<o;s++){let c=r[s],l=r[(s+1)%o],u=l.x-c.x,p=l.y-c.y,d=Math.hypot(u,p)||1;i.push({x:p/d,y:-u/d})}let a=[];for(let s=0;s<o;s++){let c=r[s],l=i[(s-1+o)%o],u=i[s],p=l.x+u.x,d=l.y+u.y,f=Math.hypot(p,d),m=()=>{a.push([c.x+l.x*t,c.y+l.y*t]),a.push([c.x+u.x*t,c.y+u.y*t])};if(f<1e-9){m();continue}p/=f,d/=f;let h=p*l.x+d*l.y,y=1/Math.max(h,1e-6);if(!Number.isFinite(y)||y>n){m();continue}a.push([c.x+p*t*y,c.y+d*t*y])}if(a.length<3)return e;try{let s=Jo.default.union([[...a,a[0]]]),c=null,l=-1/0;for(let p of s){let d=Math.abs(et(p[0].map(([f,m])=>({x:f,y:m}))));d>l&&(l=d,c=p[0])}if(!c)return e;let u=c.map(([p,d])=>({x:p,y:d}));if(u.length>1){let p=u[0],d=u[u.length-1];Math.abs(p.x-d.x)<1e-9&&Math.abs(p.y-d.y)<1e-9&&u.pop()}return u.length>=3?u:e}catch{return e}}function nn(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 kt(e,t,n,r){return[{x:e,y:t},{x:e+n,y:t},{x:e+n,y:t+r},{x:e,y:t+r}]}var ie={pedestal:0,pad:1,back:2,arm:3,footrest:4,leg:5,body:10,head:11},Rs=.44,Es=.15,Ts=.3,ks=.24;function tr(e){return e===void 0||!Number.isFinite(e)||e<=0?ks:Math.min(Ts,Math.max(Es,e*Rs))}var Hn=.21,Ls=.05,jn=.45,on=jn+Ls,_s=[{part:ie.pedestal,min:[-.3,0,-.3],max:[.3,.36,.3]},{part:ie.pad,min:[-1,.36,-.95],max:[1,jn,1]},{part:ie.back,min:[-1,on,-1],max:[1,.92,-.72]},{part:ie.arm,min:[-1,.44,-.82],max:[-.78,.65,.78]},{part:ie.arm,min:[.78,.44,-.82],max:[1,.65,.78]},{part:ie.footrest,min:[-.9,.18,.78],max:[.9,.31,1.34]},{part:ie.leg,min:[-.82,0,-.7],max:[-.62,.37,-.48]},{part:ie.leg,min:[.62,0,-.7],max:[.82,.37,-.48]},{part:ie.leg,min:[-.82,0,.48],max:[-.62,.37,.7]},{part:ie.leg,min:[.62,0,.48],max:[.82,.37,.7]}],Fs=[{part:ie.body,min:[-.52,.39,-.08],max:[-.08,.55,.82]},{part:ie.body,min:[.08,.39,-.08],max:[.52,.55,.82]},{part:ie.body,min:[-.47,.05,.58],max:[-.13,.43,.82]},{part:ie.body,min:[.13,.05,.58],max:[.47,.43,.82]},{part:ie.head,min:[-.16,1.04,-.33],max:[.16,1.1,-.13]}],Ds=[{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 nr(){let e=[],t=[],n=[],r=[],o=(P,I,G)=>{let k=n.length,[M,E,D]=P,V=[E[0]-M[0],E[1]-M[1],E[2]-M[2]],H=[D[0]-M[0],D[1]-M[1],D[2]-M[2]],j=V[1]*H[2]-V[2]*H[1],_=V[2]*H[0]-V[0]*H[2],F=V[0]*H[1]-V[1]*H[0],X=Math.hypot(j,_,F);X>1e-9?(j/=X,_/=X,F/=X):[j,_,F]=I,j*I[0]+_*I[1]+F*I[2]<0&&(j=-j,_=-_,F=-F);for(let W of P)e.push(...W),t.push(j,_,F),n.push(G);r.push(k,k+1,k+2,k,k+2,k+3)},i=P=>{for(let I of Ds){let G=I.c.map(k=>k.map((M,E)=>M?P.max[E]:P.min[E]));o(G,I.n,P.part)}};for(let P of _s)i(P);for(let P of Fs)i(P);let a=jn,s=1.08,c=.47,l=.69,u=-.55,p=.08,d=-.48,f=.01,m=[-c,a,u],h=[c,a,u],y=[-c,a,p],b=[c,a,p],g=[-l,s,d],x=[l,s,d],v=[-l,s,f],C=[l,s,f];o([h,x,C,b],[1,0,0],ie.body),o([y,v,g,m],[-1,0,0],ie.body),o([v,C,x,g],[0,1,0],ie.body),o([m,h,b,y],[0,-1,0],ie.body),o([b,C,v,y],[0,0,1],ie.body),o([m,g,x,h],[0,0,-1],ie.body);let S=10,A=8,L=[0,1.205,-.23],O=[.42,.115,.38],z=n.length;for(let P=0;P<=A;P++){let I=Math.PI*P/A,G=Math.cos(I),k=Math.sin(I);for(let M=0;M<=S;M++){let E=Math.PI*2*M/S,D=k*Math.cos(E),V=k*Math.sin(E);e.push(L[0]+O[0]*D,L[1]+O[1]*G,L[2]+O[2]*V);let H=D/O[0],j=G/O[1],_=V/O[2],F=Math.hypot(H,j,_)||1;H/=F,j/=F,_/=F,t.push(H,j,_),n.push(ie.head)}}for(let P=0;P<A;P++)for(let I=0;I<S;I++){let G=z+P*(S+1)+I,k=G+S+1;r.push(G,k,G+1,G+1,k,k+1)}let B=new Float32Array(e),T=new Float32Array(t),w=new Float32Array(n),R=new Uint16Array(r);return{position:B,normal:T,part:w,index:R,vertexCount:n.length,indexCount:r.length}}function or(e,t,n,r){let o=new Float32Array(t),i=l=>e[l*3],a=l=>e[l*3+2],s=0,c=(l,u)=>{let p=u-l;for(let d=l;d<u;d++){let[f,m]=r(d),h=f-i(d),y=m-a(d);if(p>=2){let b=Math.max(l,d-1),g=Math.min(u-1,d+1),x=i(g)-i(b),v=a(g)-a(b),C=Math.hypot(x,v);if(C>1e-6){let S=-v/C,A=x/C;S*h+A*y<0&&(S=-S,A=-A),h=S,y=A}}o[d]=h===0&&y===0?0:Math.atan2(h,y)}};for(let l=1;l<=t;l++)(l===t||n(l)!==n(s))&&(c(s,l),s=l);return o}var Oe=.22;function rr(e,t){let n=Ae[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 Os=.42;function Vs(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 m of e)m.x<r&&(r=m.x),m.y<o&&(o=m.y),m.x>i&&(i=m.x),m.y>a&&(a=m.y);let s=Math.max(i-r,1e-6),c=Math.max(a-o,1e-6),l=Math.max(Math.sqrt(s*c/t),1e-6),u=Math.max(1,Math.ceil(s/l)+1),p=Math.max(1,Math.ceil(c/l)+1),d=new Map,f=(m,h)=>{let y=Math.min(u-1,Math.max(0,Math.floor((m-r)/l)));return Math.min(p-1,Math.max(0,Math.floor((h-o)/l)))*u+y};for(let m=0;m<t;m++){let h=f(e[m].x,e[m].y),y=d.get(h);y?y.push(m):d.set(h,[m])}for(let m=0;m<t;m++){let h=e[m],y=Math.min(u-1,Math.max(0,Math.floor((h.x-r)/l))),b=Math.min(p-1,Math.max(0,Math.floor((h.y-o)/l))),g=1/0;for(let x=1;x<=4;x++){for(let v=b-x;v<=b+x;v++)if(!(v<0||v>=p))for(let C=y-x;C<=y+x;C++){if(C<0||C>=u||x>1&&Math.abs(v-b)<x&&Math.abs(C-y)<x)continue;let S=d.get(v*u+C);if(S)for(let A of S){if(A===m)continue;let L=Math.hypot(e[A].x-h.x,e[A].y-h.y);L<g&&(g=L)}}if(Number.isFinite(g)&&g<=x*l)break}n[m]=g}return n}function Bs(e){let t=e.eyeHeightM;return Number.isFinite(t)?Math.max(0,t-je):0}function ir(e,t,n,r,o,i){let a=e.length,s=new Float32Array(a*3),c=new Float32Array(a),l=new Float32Array(a*3),u=new Float32Array(a),p=new Float32Array(a),d=new Float32Array(a),f=new Float32Array(a),m=new Float32Array(a*3),h=new Map,y=Vs(e);for(let b=0;b<a;b++){let g=e[b],v=(n?.seatPitchU(b)??y[b])*N;u[b]=Number.isFinite(v)?Math.max(.06,Math.min(Oe,v*Os)):Oe,p[b]=tr(Number.isFinite(v)?v:void 0);let C=qo(g.glyph,{seatGlyph:i?.get(g.categoryKey)});d[b]=Ko.indexOf(C),f[b]=g.wheelchairSpaceType==="no-seat"?0:1,s[b*3]=g.x*N,s[b*3+1]=n?n.seatDeckY(b):Bs(g),s[b*3+2]=g.y*N,c[b]=Ct(t?t(g):"available");let S=ee(o?.get(g.categoryKey)??"#6e7bff")??[.43,.48,1];if(l[b*3]=S[0],l[b*3+1]=S[1],l[b*3+2]=S[2],g.accessibility?.length){let A=ee(Xo(g.accessibility));A&&(m[b*3]=A[0],m[b*3+1]=A[1],m[b*3+2]=A[2])}h.set(g.id,b)}return{count:a,iPosition:s,iState:c,iCategory:l,iMaxRadius:u,iRing:m,idToIndex:h,iChairWidth:p,iGlyph:d,iPhysicalSeat:f,iFloor:r??new Float32Array(a),iYaw:new Float32Array(a)}}var Ns=64;function Xn(e,t){let n=[];for(let a of t){let s=e.idToIndex.get(a.seatId);if(s===void 0)continue;let c=Ct(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+Ns){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 Gs=.15,zs=1.6;function ar(e){return Vo(e??1,Gs,zs)}var Us=.15,Hs=.9,js=1.76;function Xs(){return{background:{top:[...Je.top],bottom:[...Je.bottom]},structure:Fn,seatStates:{...Lo},seatScale:1,materials:{seat:null,shell:null,roughness:.78}}}function sr(e){let t=Xs();if(!e)return t;let n=ee(e.background);if(n){t.background={top:ve(n,Hs),bottom:ve(n,js)};let a={};for(let[s,c]of Object.entries(Fn))a[s]=he(c,n,Us);t.structure=a}let r=ee(e.selectionColor)??ee(e.accent);r&&(t.seatStates={...t.seatStates,selected:r});let o=e.seatScale;typeof o=="number"&&Number.isFinite(o)&&(t.seatScale=ar(o));let i=e.venue3d;if(i){let a=ee(i.deck),s=ee(i.fascia);a&&(t.structure={...t.structure,tierTop:a,gaTop:a}),s&&(t.structure={...t.structure,tierWall:s,gaWall:s}),t.materials.seat=ee(i.seat),t.materials.shell=ee(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 lr(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 ur(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[lr(e,.5)];let r=Array.from({length:n+1},(c,l)=>lr(e,l/n)),o=new Float64Array(r.length);for(let c=1;c<r.length;c+=1){let l=r[c].x-r[c-1].x,u=r[c].y-r[c-1].y;o[c]=o[c-1]+Math.hypot(l,u)}let i=o[o.length-1];if(i<=1e-9)return Array.from({length:t},()=>({...e.start}));let a=[],s=1;for(let c=0;c<t;c+=1){let l=i*c/(t-1);for(;s<o.length-1&&o[s]<l;)s+=1;let u=o[s-1],p=o[s],d=p===u?0:(l-u)/(p-u);a.push({x:r[s-1].x+(r[s].x-r[s-1].x)*d,y:r[s-1].y+(r[s].y-r[s-1].y)*d})}return a}function dr(e){let t=new Map,n=new Map;for(let r of e){if(r.type!=="row"||!r.segmentedRow)continue;let o=n.get(r.segmentedRow.groupId)??[];o.push(r),n.set(r.segmentedRow.groupId,o)}for(let[r,o]of n){let i=o.slice().sort((d,f)=>d.segmentedRow.componentIndex-f.segmentedRow.componentIndex),a=i[0]?.segmentedRow?.componentCount??0,s=i[0]?.segmentedRow;if(!s||!(a>=2&&i.length===a&&s?.boundaryBefore==="start"&&i.every((d,f)=>d.segmentedRow?.kind==="segmented-row-v1"&&d.segmentedRow.groupId===r&&d.segmentedRow.componentCount===a&&d.segmentedRow.componentIndex===f&&d.segmentedRow.repeatLabelOnComponents===s.repeatLabelOnComponents&&(f===0?d.segmentedRow.boundaryBefore==="start":d.segmentedRow.boundaryBefore!=="start")&&d.segmentedRow.displayLabel===s.displayLabel)))continue;let l=i.reduce((d,f)=>d+f.seatCount,0),u=0,p=0;for(let d of i)d.segmentedRow.boundaryBefore==="break"&&(u+=1),t.set(d.id,{groupId:r,adjacencyOffset:u,displayOffset:p,displayLabel:s.displayLabel,totalSeats:l,canonical:i[0],viewFromSeatUrl:s.viewFromSeatUrl,viewFromSeatMeta:s.viewFromSeatMeta,confidenceEvidence:s.confidenceEvidence}),u+=d.seatCount,p+=d.seatCount}return t}var Ys="ABCDEFGHIJKLMNOPQRSTUVWXYZ";var Ws="abcdefghijklmnopqrstuvwxyz";function Ks(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 Yn(e,t=!1){let n=t?Ws:Ys;return Ks(Math.max(0,Math.floor(e)-1),n)}var qs=[[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 mr(e){if(!Number.isFinite(e)||e<=0)return String(e);let t=Math.floor(e),n="";for(let[r,o]of qs)for(;t>=r;)n+=o,t-=r;return n}function Qs(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 Wn(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 f=Math.ceil(c/2),m=i==="updown"?t<f?n+2*t:n-1+2*(c-t):t<f?n+2*(f-1-t):n+1+2*(t-f);return`${a}${m}`}let l=i==="odd"||i==="even"?2:o,u=s!=null&&Number.isFinite(s)?s-(c-1)*l:n,p=r==="center"?Qs(c)[t]:r==="rtl"?c-1-t:t,d;switch(i){case"odd":{let f=u%2===1?u:u+1;d=String(f+p*2);break}case"even":{let f=u%2===0?u:u+1;d=String(f+p*2);break}case"roman":d=mr(u+p*o);break;case"letters-upper":d=Yn(u+p*o,!1);break;case"letters-lower":d=Yn(u+p*o,!0);break;default:d=String(u+p*o);break}return`${a}${d}`}function $s(e){return{...e.canonical,seatCount:e.totalSeats,label:e.displayLabel,displayLabel:e.displayLabel}}function fr(e,t,n){return n?.label??`${e.label}-${Wn(e,t)}`}function Kn(e,t,n,r){if(r?.displayLabel)return r.displayLabel;if(!n)return`${e.displayLabel||e.label}-${Wn(e,t)}`;let o=$s(n),i=n.displayOffset+t;return`${n.displayLabel}-${Wn(o,i)}`}function pr(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 mt(e,t,n){if(!e.length)return 1/0;if(e.length===1)return Math.hypot(t-e[0].x,n-e[0].y);let r=1/0;for(let o=0;o+1<e.length;o++){let i=e[o],a=e[o+1],s=a.x-i.x,c=a.y-i.y,l=s*s+c*c,u=l>1e-12?((t-i.x)*s+(n-i.y)*c)/l:0;u<0?u=0:u>1&&(u=1);let p=Math.hypot(t-(i.x+u*s),n-(i.y+u*c));p<r&&(r=p)}return r}function Zs(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 hr(e,t){return Math.hypot(e.cx-t.cx,e.cy-t.cy)-e.r-t.r}function qn(e,t){let n=1/0;for(let r of pr(e)){let o=mt(t,r.x,r.y);o<n&&(n=o)}for(let r of pr(t)){let o=mt(e,r.x,r.y);o<n&&(n=o)}return n}function Js(e,t){if(e.length<3)return{pts:e,seatIndices:t};let n=0,r=0;for(let u of e)n+=u.x,r+=u.y;n/=e.length,r/=e.length;let o=-1,i=e[0];for(let u of e){let p=Math.hypot(u.x-n,u.y-r);p>o&&(o=p,i=u)}let a=i.x-n,s=i.y-r,c=Math.hypot(a,s);c>1e-9?(a/=c,s/=c):(a=1,s=0);let l=e.map((u,p)=>({p:u,i:p,t:(u.x-n)*a+(u.y-r)*s})).sort((u,p)=>u.t-p.t);return{pts:l.map(u=>u.p),seatIndices:l.map(u=>t[u.i])}}function Qn(e){let t=e.length;if(t<3)return null;let n=0,r=0;for(let g of e)n+=g.x,r+=g.y;n/=t,r/=t;let o=0,i=0,a=0,s=0,c=0,l=0,u=0;for(let g of e){let x=g.x-n,v=g.y-r;o+=x*x,a+=v*v,i+=x*v,s+=x*x*x,c+=v*v*v,l+=x*v*v,u+=v*x*x}let p=o*a-i*i;if(Math.abs(p)<1e-9)return null;let d=(s+l)/2,f=(c+u)/2,m=(d*a-f*i)/p,h=(f*o-d*i)/p,y=m+n,b=h+r;return!Number.isFinite(y)||!Number.isFinite(b)?null:{cx:y,cy:b}}var ec=.15;function tc(e){if(e.length<2)return null;let t=e.map(g=>{let x=0,v=0;for(let C of g.pts)x+=C.x,v+=C.y;return{x:x/g.pts.length,y:v/g.pts.length}}),n=0,r=0;for(let g of t)n+=g.x,r+=g.y;n/=t.length,r/=t.length;let o=0,i=0,a=0;for(let g of t){let x=g.x-n,v=g.y-r;o+=x*x,i+=x*v,a+=v*v}let s=o+a,c=o*a-i*i,l=s/2+Math.sqrt(Math.max(0,s*s/4-c)),u,p;Math.abs(i)>1e-12?(u=l-a,p=i):o>=a?(u=1,p=0):(u=0,p=1);let d=Math.hypot(u,p);if(!(d>1e-12))return null;u/=d,p/=d;let f=1/0,m=-1/0,h=[];for(let g of e){let x=1/0,v=-1/0;for(let C of g.pts){let S=C.x*u+C.y*p;S<x&&(x=S),S>v&&(v=S),S<f&&(f=S),S>m&&(m=S)}h.push(v-x)}let y=m-f;return y>1e-9?(h.sort((g,x)=>g-x),h[Math.min(h.length-1,Math.floor(h.length*.9))]/y<=nc?{x:u,y:p}:null):null}var nc=.35;function rn(e,t,n,r){let o=new Map;for(let y of n){let b=t[y],g=b.rowId||`__seat-${y}`,x=o.get(g);x||(x={pts:[],idx:[]},o.set(g,x)),x.pts.push({x:b.x,y:b.y}),x.idx.push(y)}if(!o.size)return{sectionId:e,rows:[],blockCount:0};let i=[];for(let[y,b]of o){let g=Js(b.pts,b.idx),x=0;for(let v of g.pts)x+=Math.hypot(v.x-r.x,v.y-r.y);i.push({id:y,pts:g.pts,seatIndices:g.seatIndices,blockId:-1,ordinal:0,blockDepth:0,focalDistance:x/g.pts.length})}let a=i.map(y=>Zs(y.pts)),s=[];for(let y=0;y<i.length;y++){let b=1/0;for(let g=0;g<i.length;g++){if(y===g||hr(a[y],a[g])>=b)continue;let x=qn(i[y].pts,i[g].pts);x<b&&(b=x)}Number.isFinite(b)&&s.push(b)}s.sort((y,b)=>y-b);let c=s.length?s[Math.floor(s.length/2)]:1,l=Math.max(c*1.8,1e-6),u=i.map(()=>[]);for(let y=0;y<i.length;y++)for(let b=y+1;b<i.length;b++)hr(a[y],a[b])>l||qn(i[y].pts,i[b].pts)<=l&&(u[y].push(b),u[b].push(y));let p=0;for(let y=0;y<i.length;y++){if(i[y].blockId!==-1)continue;let b=p++,g=[y];for(i[y].blockId=b;g.length;){let x=g.pop();for(let v of u[x])i[v].blockId===-1&&(i[v].blockId=b,g.push(v))}}let d=new Map;for(let y of i){let b=d.get(y.blockId)??[];b.push(y),d.set(y.blockId,b)}let f=[];for(let y of i){if(y.pts.length<4)continue;let b=Qn(y.pts);b&&(!Number.isFinite(b.cx)||!Number.isFinite(b.cy)||f.push({x:b.cx,y:b.cy}))}let m=f.length>=2?(()=>{let y=f.map(x=>x.x).sort((x,v)=>x-v),b=f.map(x=>x.y).sort((x,v)=>x-v),g=Math.floor(f.length/2);return{cx:y[g],cy:b[g]}})():null;if(m){let y=S=>Math.hypot(S.x-m.cx,S.y-m.cy),b=1/0,g=-1/0,x=[];for(let S of i){let A=1/0,L=-1/0;for(let O of S.pts){let z=y(O);z<A&&(A=z),z>L&&(L=z)}x.push(L-A),A<b&&(b=A),L>g&&(g=L)}let v=g-b;x.sort((S,A)=>S-A);let C=x[Math.min(x.length-1,Math.floor(x.length*.9))];if(v>1e-9&&C/v<=ec){let S=i.map(I=>{let G=0;for(let k of I.pts)G+=y(k);return{row:I,radius:G/I.pts.length}}),A=0,L=0;for(let I of S)A+=I.radius,L+=I.row.focalDistance;A/=S.length,L/=S.length;let O=0;for(let I of S)O+=(I.radius-A)*(I.row.focalDistance-L);if(O<0)for(let I of S)I.radius=-I.radius;let B=1/0;for(let I of S)I.radius<B&&(B=I.radius);S.sort((I,G)=>I.radius-G.radius);let T=-1,w=-1/0,R=v/Math.max(1,S.length)*.5,P=[];for(let I of S)I.radius-w>R&&(T++,w=I.radius),I.row.ordinal=T,I.row.blockDepth=I.radius-B,P.push(I.row);return{sectionId:e,rows:P,blockCount:p}}}let h=[];for(let[,y]of d){let b=tc(y);if(b){let g=v=>{let C=0;for(let S of v.pts)C+=S.x*b.x+S.y*b.y;return C/v.pts.length};y.sort((v,C)=>g(v)-g(C)),y.length>=2&&y[0].focalDistance>y[y.length-1].focalDistance&&y.reverse();let x=0;for(let v=0;v<y.length;v++)v>0&&(x+=qn(y[v-1].pts,y[v].pts)),y[v].ordinal=v,y[v].blockDepth=x,h.push(y[v])}else{let g=1/0;for(let x of y)x.focalDistance<g&&(g=x.focalDistance);y.sort((x,v)=>x.focalDistance-v.focalDistance);for(let x=0;x<y.length;x++)y[x].ordinal=x,y[x].blockDepth=Math.max(0,y[x].focalDistance-g),h.push(y[x])}}return{sectionId:e,rows:h,blockCount:p}}var oc=/^\d{4}-\d{2}-\d{2}$/;function rc(e){let t=Date.parse(e);return Number.isFinite(t)?oc.test(e)?t+864e5:t:null}function ic(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=rc(e.validUntil);return n===null?!1:(t instanceof Date?t.getTime():t)<n}function ac(e,t,n){return!(e.eventConfigurationId&&e.eventConfigurationId!==t||e.eventConfigurationVersion!==void 0&&e.eventConfigurationVersion!==n)}function sc(e){return e.status!=="draft"&&e.status!=="retracted"}function cc(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 br(e,t={}){return!!e&&sc(e)&&ac(e,t.activeConfigurationId,t.activeConfigurationVersion)&&cc(e,t.activeBasisSha256)&&ic(e,t.now)}function Sr(e){return e?e.accessibility&&e.accessibility.length?e.wheelchairSpaceType&&!e.accessibility.includes("wheelchair")?["wheelchair",...e.accessibility]:e.accessibility:e.wheelchairSpaceType?["wheelchair"]:e.accessible?["wheelchair"]:[]:[]}var an=Math.PI/180;var Lt=16;function Zn(e,t,n,r){let o=n*an,i=Math.cos(o),a=Math.sin(o);return{x:r.x+e*i-t*a,y:r.y+e*a+t*i}}function lc(e){let{seatCount:t,seatSpacing:n,curve:r,rotation:o,origin:i}=e,a=[];if(e.path)return ur(e.path,t);if(t<=1)return t===1&&a.push({x:i.x,y:i.y}),a;if(r===0){for(let l=0;l<t;l++)a.push(Zn(l*n,0,o,i));return a}let s=r/(t-1)*an,c=n/(2*Math.sin(Math.abs(s)/2));for(let l=0;l<t;l++){let u=l*s,p=c*Math.sin(u),d=-c+c*Math.cos(u);a.push(Zn(p,d,o,i))}return a}function uc(e){let t=new Map;if(e.overrides)for(let n of e.overrides)t.set(n.index,n);return t}function dc(e,t){let n=uc(e);return lc(e).map((r,o)=>{let i=n.get(o),a=Sr(i),s=fr(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:Kn(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(l=>l!==void 0&&l!==!1&&l!=="")?c:void 0,glyph:i?.glyph,viewUrl:i?.viewFromSeatUrl??e.viewFromSeatUrl,viewMeta:i?.viewFromSeatUrl?i.viewFromSeatMeta:e.viewFromSeatMeta,labelStyle:i?.labelStyle}})}function Mr(e){let t=[];for(let n of dc(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 mc(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 fc(e){let t=[],n=Math.max(0,Math.round(e.seatCount));if(n===0)return t;let r=new Map((e.overrides??[]).map(u=>[u.index,u])),o=(u,p,d,f)=>{let m=r.get(u),h=Sr(m),y=m?.label??`${e.label}-${u+1}`,b=e.displayLabel??e.label;return{index:u,label:y,displayLabel:m?.displayLabel??`${b}-${u+1}`,x:p+(m?.dx??0),y:d+(m?.dy??0),categoryKey:m?.categoryKey??e.categoryKey,skipped:!!m?.skip,accessible:h.length>0,accessibility:h,wheelchairSpaceType:m?.wheelchairSpaceType,commercial:m?.commercial,glyph:m?.glyph,viewUrl:m?.viewFromSeatUrl,viewMeta:m?.viewFromSeatUrl?m.viewFromSeatMeta:void 0,labelStyle:m?.labelStyle,...f?{side:f}:{}}};if(e.shape==="round"){let u=(e.radius??40)+Lt,p=e.rotation*an,d=Math.max(0,Math.min(360,e.seatArc??360));if(d>=360||n===1){for(let y=0;y<n;y++){let b=p+y/n*2*Math.PI;t.push(o(y,e.center.x+u*Math.cos(b),e.center.y+u*Math.sin(b)))}return t}let f=d*an,m=(2*Math.PI-f)/2,h=p+m;for(let y=0;y<n;y++){let b=h+y/(n-1)*f;t.push(o(y,e.center.x+u*Math.cos(b),e.center.y+u*Math.sin(b)))}return t}let i=e.width??80,a=e.height??50,s=mc(e),c=["top","bottom","left","right"],l=0;for(let u of c){let p=s[u];for(let d=0;d<p;d++){let f,m;u==="top"?(f=-i/2+(d+.5)*i/p,m=-a/2-Lt):u==="bottom"?(f=-i/2+(d+.5)*i/p,m=a/2+Lt):u==="left"?(f=-i/2-Lt,m=-a/2+(d+.5)*a/p):(f=i/2+Lt,m=-a/2+(d+.5)*a/p);let h=Zn(f,m,e.rotation,e.center);t.push(o(l++,h.x,h.y,u))}}return t}function pc(e){return fc(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 hc(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 yr(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 bc(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 nt(e,t,n){return yr(e,t)&&!(n??[]).some(r=>yr(e,r)||bc(e,r))}function $n(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 yc(e){switch(e.type){case"row":{let t=Mr(e);if(!t.length)return{x:e.origin.x,y:e.origin.y};let n=0,r=0;for(let o of t)n+=o.x,r+=o.y;return{x:n/t.length,y:r/t.length}}case"table":case"booth":return{x:e.center.x,y:e.center.y};case"gaArea":return $n(e.points);case"section":return $n(e.outline);case"text":return{x:e.position.x,y:e.position.y};case"shape":return e.points&&e.points.length?$n(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 gr(e,t){return e.length===t.length&&e.every((n,r)=>n.x===t[r].x&&n.y===t[r].y)}function gc(e,t){if(e.type!=="gaArea"||!gr(e.points,t.outline))return!1;let n=e.holes??[],r=t.holes??[];return n.length===r.length&&n.every((o,i)=>gr(o,r[i]))}function xc(e,t){let n=e.filter(a=>a.type==="section"),r="referenceInventorySource"in t?t.referenceInventorySource?.logicalSectionId:void 0,o=yc(t);return(r?n.find(a=>(a.logicalSectionId??a.id)===r&&(gc(t,a)||nt(o,a.outline,a.holes))):void 0)??n.find(a=>nt(o,a.outline,a.holes))}function xr(e,t,n,r,o,i,a,s,c){let l=[],u=dr(e),p=m=>!m?.eventConfigurationId||m.eventConfigurationId===r&&(m.eventConfigurationVersion===void 0||m.eventConfigurationVersion===c),d=m=>br(m,{activeConfigurationId:r,activeConfigurationVersion:c,activeBasisSha256:o,now:s}),f=(m,h)=>d(m)?{...m,coverage:h}:void 0;for(let m of e){let h=[];if(m.type==="row"?h=Mr(m):m.type==="table"?h=pc(m):m.type==="booth"&&(h=hc(m)),!h.length)continue;for(let v of h)v.viewUrl&&!p(v.viewMeta)&&(v.viewUrl=void 0,v.viewMeta=void 0);if(m.type==="row"){let v=u.get(m.id);if(v){let C=new Map((m.overrides??[]).map(S=>[S.index,S]));for(let S of h){let A=Number(S.id.slice(S.id.lastIndexOf(":")+1));if(!Number.isInteger(A))continue;S.logicalRowId=v.groupId,S.logicalSeatIndex=v.adjacencyOffset+A,C.get(A)?.displayLabel||(S.displayLabel=Kn(m,A,v)),!S.viewUrl&&v.viewFromSeatUrl&&p(v.viewFromSeatMeta)&&(S.viewUrl=v.viewFromSeatUrl,S.viewMeta=v.viewFromSeatMeta);let L=C.get(A)?.confidenceEvidence;S.confidenceEvidence=f(L,"exact-seat")??f(m.confidenceEvidence,"row-representative")??f(v.confidenceEvidence,"row-representative")}}}let y=xc(e,m),b=y?.viewFromSeatUrl,x=(y?.zone?t?.find(v=>v.id===y.zone):void 0)?.focalPoint??n;for(let v of h){if(!v.confidenceEvidence){let C=Number(v.id.slice(v.id.lastIndexOf(":")+1)),S=(m.type==="row"||m.type==="table")&&Number.isInteger(C)?m.overrides?.find(A=>A.index===C)?.confidenceEvidence:void 0;v.confidenceEvidence=f(S,"exact-seat")??(m.type==="row"?f(m.confidenceEvidence,"row-representative"):void 0)}v.confidenceEvidence??=f(y?.confidenceEvidence,"section-representative")??(a?f(a.evidence,a.coverage):void 0),!v.viewUrl&&b&&p(y?.viewFromSeatMeta)&&(v.viewUrl=b,v.viewMeta=y?.viewFromSeatMeta),!v.viewUrl&&i&&p(i.meta)&&(v.viewUrl=i.url,v.viewMeta=i.meta),y&&(v.sectionId=y.logicalSectionId??y.id),y?.zone&&(v.zoneId=y.zone),x&&(v.focalPoint={...x})}l.push(...h)}return l}function wr(e,t={}){if(e.floors?.length){let r=[];for(let o of e.floors){let i=o.focalPoint??e.focalPoint,a=o.viewFromSeatUrl?{url:o.viewFromSeatUrl,meta:o.viewFromSeatMeta}:e.viewFromSeatUrl?{url:e.viewFromSeatUrl,meta:e.viewFromSeatMeta}:void 0,s=o.confidenceEvidence?{evidence:o.confidenceEvidence,coverage:"floor-representative"}:e.confidenceEvidence?{evidence:e.confidenceEvidence,coverage:"venue-representative"}:void 0,c=xr(o.objects,e.zones,i,e.eventConfigurationId,e.confidenceBasisSha256,a,s,t.now,t.eventConfigurationVersion??e.eventConfigurationVersion);t.resolveEyeHeights!==!1&&vr(o.objects,o.focalPoint??e.focalPoint,o.baseHeightM??0,c);for(let l of c)l.floorId=o.id;r.push(...c)}return r}let n=xr(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&&vr(e.objects,e.focalPoint,t.floorBaseHeightM??0,n),n}function vr(e,t,n,r){let o=e.filter(u=>u.type==="section"),i=n>0||o.some(u=>u.height!==void 0||u.rake!==void 0||(u.elevation??0)>0);if(!o.length||!i||!t){for(let u of r)u.eyeHeightM=n+je;return}let a=new Array(r.length),s=new Map,c=new Map;for(let u=0;u<r.length;u++){let p=r[u],f=(p.sectionId?o.find(h=>h.id===p.sectionId)??o.find(h=>h.logicalSectionId===p.sectionId&&nt({x:p.x,y:p.y},h.outline,h.holes)):void 0)??o.find(h=>nt({x:p.x,y:p.y},h.outline,h.holes))??null;if(a[u]=f,!f)continue;s.has(f.id)||s.set(f.id,$t(f,{floorBaseHeightM:n}));let m=c.get(f.id);m?m.push(u):c.set(f.id,[u])}let l=new Array(r.length).fill(void 0);for(let[u,p]of c){let d=s.get(u);if(!d)continue;let f=d.rake>0?Math.tan(d.rake*Math.PI/180):0,m=rn(u,r,p,t);for(let h of m.rows){let y=h.blockDepth*Se*f,b=d.height+y;for(let g of h.seatIndices)l[g]=b}}for(let u=0;u<r.length;u++){let p=r[u],d=a[u];if(!d){p.eyeHeightM=n+je;continue}let f=s.get(d.id);p.eyeHeightM=(l[u]??f.height)+je}}function vc(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 Sc(e,t){if(!e.length)return null;let n=0,r=0,o=0;for(let f of e)n+=f.x,r+=f.y,o+=Math.hypot(f.x-t.x,f.y-t.y);let i=e.length;n/=i,r/=i,o/=i;let a=e[0],s=-1;for(let f of e){let m=Math.hypot(f.x-n,f.y-r);m>s&&(s=m,a=f)}let c=a.x-n,l=a.y-r,u=Math.hypot(c,l);u>1e-9?(c/=u,l/=u):(c=1,l=0);let p=[...e].sort((f,m)=>(f.x-n)*c+(f.y-r)*l-((m.x-n)*c+(m.y-r)*l)),d=0;for(let f of p){let m=Math.hypot(f.x-n,f.y-r);m>d&&(d=m)}return{pts:p,cx:n,cy:r,radius:d,depth:o}}function Pr(e,t,n){let r=e.pts;if(r.length===1)return Math.hypot(t-r[0].x,n-r[0].y);let o=1/0;for(let i=0;i+1<r.length;i++){let a=r[i],s=r[i+1],c=s.x-a.x,l=s.y-a.y,u=c*c+l*l,p=u>1e-12?((t-a.x)*c+(n-a.y)*l)/u:0;p<0?p=0:p>1&&(p=1);let d=Math.hypot(t-(a.x+p*c),n-(a.y+p*l));d<o&&(o=d)}return o}var sn=8;function Mc(e,t,n){let r=new Array(sn).fill(1/0),o=new Array(sn).fill(-1);for(let u=0;u<e.length;u++){let p=e[u],d=Math.hypot(t-p.cx,n-p.cy)-p.radius;for(let f=0;f<sn;f++)if(d<r[f]){for(let m=sn-1;m>f;m--)r[m]=r[m-1],o[m]=o[m-1];r[f]=d,o[f]=u;break}}let i=new Array(3).fill(1/0),a=new Array(3).fill(-1);for(let u of o){if(u<0)continue;let p=Pr(e[u],t,n);for(let d=0;d<3;d++)if(p<i[d]){for(let f=2;f>d;f--)i[f]=i[f-1],a[f]=a[f-1];i[d]=p,a[d]=u;break}}if(a[0]<0)return 0;if(i[0]<1e-6)return e[a[0]].depth;let s=i[0]*2.2,c=0,l=0;for(let u=0;u<3;u++){let p=a[u];if(p<0||i[u]>s)continue;let d=1/(i[u]*i[u]);c+=d*e[p].depth,l+=d}return l>0?c/l:e[a[0]].depth}function wc(e){let t=(r,o)=>Mc(e,r,o),n=(r,o)=>{let i=1/0,a=-1;for(let s=0;s<e.length;s++){let c=e[s];if(Math.hypot(r-c.cx,o-c.cy)-c.radius>=i)continue;let l=Pr(c,r,o);l<i&&(i=l,a=s)}return a};return{kind:"rows",rowCount:e.length,rows:e,nearestRow:n,depthAt:t,gradientAt:(r,o)=>{let i=(t(r+.5,o)-t(r-.5,o))/1,a=(t(r,o+.5)-t(r,o-.5))/(2*.5),s=Math.hypot(i,a);return s<1e-9?[0,0]:[i/s,a/s]}}}function Cr(e,t){let n=[];for(let r of e){let o=Sc(r.points,t);o&&n.push(o)}return n.length<2?vc(t):(n.sort((r,o)=>r.depth-o.depth),wc(n))}var to=st(require("polygon-clipping"),1);var Er=st(require("earcut"),1);var Pc=.58,Ar=.01,Me=Oe*1.5*He,Cc=.5,Ac=.6;function Ic(e,t){let n=e.length,r=[];for(let a=0;a<n;a++){let s=e[Math.max(0,a-1)],c=e[Math.min(n-1,a+1)],l=c.x-s.x,u=c.y-s.y,p=Math.hypot(l,u);if(p<1e-9){r.push([0,0]);continue}l/=p,u/=p,r.push([-u,l])}let o=0;for(let a=0;a<n;a++)o+=(e[a].x-t.x)*r[a][0]+(e[a].y-t.y)*r[a][1];return o<0?r.map(([a,s])=>[-a,-s]):r}function Rc(e,t){if(e.length<2||t<=0)return[...e];let n=[...e],r=(a,s)=>{let c=s.x-a.x,l=s.y-a.y,u=Math.hypot(c,l)||1;return{x:c/u,y:l/u}},o=r(n[1],n[0]),i=r(n[n.length-2],n[n.length-1]);return n.unshift({x:n[0].x+o.x*t,y:n[0].y+o.y*t}),n.push({x:n[n.length-1].x+i.x*t,y:n[n.length-1].y+i.y*t}),n}var Ir=Math.PI/12;function Ec(e){if(e.length<3)return[...e];let t=[...e].sort((i,a)=>i.x-a.x||i.y-a.y),n=(i,a,s)=>(a.x-i.x)*(s.y-i.y)-(a.y-i.y)*(s.x-i.x),r=i=>{let a=[];for(let s of i){for(;a.length>=2&&n(a[a.length-2],a[a.length-1],s)<=0;)a.pop();a.push(s)}return a.pop(),a},o=[...r(t),...r([...t].reverse())];return o.length>=3?o:[...e]}function Tr(e,t){if(!e.length||!(t>0))return[];let n=Ec(e),r=(s,c,l,u)=>{let p=l-c;for(;p<0;)p+=Math.PI*2;for(;p>Math.PI*2;)p-=Math.PI*2;let d=Math.max(1,Math.ceil(p/Ir)),f=t/Math.cos(p/d/2);for(let m=0;m<=d;m++){let h=c+p*m/d;u.push({x:s.x+Math.cos(h)*f,y:s.y+Math.sin(h)*f})}};if(n.length<3){let s=0,c=0;for(let f of n)s+=f.x,c+=f.y;s/=n.length||1,c/=n.length||1;let l=0;for(let f of n)l=Math.max(l,Math.hypot(f.x-s,f.y-c));let u=[],p=Math.max(3,Math.ceil(Math.PI*2/Ir)),d=(l+t)/Math.cos(Math.PI/p);for(let f=0;f<p;f++){let m=f/p*Math.PI*2;u.push({x:s+Math.cos(m)*d,y:c+Math.sin(m)*d})}return u}let o=n.length,i=[];for(let s=0;s<o;s++){let c=n[s],l=n[(s+1)%o];i.push(Math.atan2(-(l.x-c.x),l.y-c.y))}let a=[];for(let s=0;s<o;s++)r(n[s],i[(s+o-1)%o],i[s],a);return Dr(a)}function Tc(e,t,n){if(e.length===1)return Math.hypot(t-e[0].x,n-e[0].y);let r=1/0;for(let o=0;o+1<e.length;o++){let i=e[o],a=e[o+1],s=a.x-i.x,c=a.y-i.y,l=s*s+c*c,u=l>1e-12?((t-i.x)*s+(n-i.y)*c)/l:0;u<0?u=0:u>1&&(u=1);let p=Math.hypot(t-(i.x+u*s),n-(i.y+u*c));p<r&&(r=p)}return r}function cn(e){let t=e.map(o=>{let i=0,a=0;for(let l of o.pts)i+=l.x,a+=l.y;let s=o.pts.length||1;i/=s,a/=s;let c=0;for(let l of o.pts){let u=Math.hypot(l.x-i,l.y-a);u>c&&(c=u)}return{cx:i,cy:a,rad:c}}),n=o=>{let i=o.length;return i<=2?[...o]:[o[Math.floor(i*.25)],o[Math.floor(i*.5)],o[Math.floor(i*.75)]]},r=[];for(let o=0;o<e.length;o++){let i=n(e[o].pts),a=[],s=1/0,c=null;for(let u of i){let p=1/0;for(let d=0;d<e.length;d++){if(d===o||Math.abs(e[d].y-e[o].y)<.001)continue;let f=t[d],m=Math.hypot(u.x-f.cx,u.y-f.cy)-f.rad;if(m>=p&&m>=s)continue;let h=Tc(e[d].pts,u.x,u.y);h<p&&(p=h),e[d].depth<e[o].depth&&h<s&&(s=h,c=e[d].y)}Number.isFinite(p)&&p>0&&a.push(p)}a.sort((u,p)=>u-p);let l=a.length?a[Math.floor(a.length/2)]:1;r.push({pitch:l,belowY:c})}return r}function kr(e,t,n,r){let o=e[t],i=o.pts.length>=2?[...o.pts]:o.pts.length===1?(()=>{let u=o.pts[0],p=u.x-r.x,d=u.y-r.y,f=Math.hypot(p,d)||1;p/=f,d/=f;let m=Math.max(n[t].pitch,.001)*.5;return[{x:u.x+d*m,y:u.y-p*m},{x:u.x-d*m,y:u.y+p*m}]})():[];if(i.length<2)return null;let a=0,s=0;for(let u=1;u<i.length;u++){let p=Math.hypot(i[u].x-i[u-1].x,i[u].y-i[u-1].y);p>1e-6&&(a+=p,s++)}let c=s>0?a/s:0,l=Rc(i,Math.max(c*Ac,Me));return{pts:l,nrm:Ic(l,r),front:Math.max(n[t].pitch*Pc,Me),back:Math.max(n[t].pitch*Cc,Me)}}var ft=1.5,Lr=.3;function Jn(e,t){if(e.length<3)return e;let n=e[0],r=e[e.length-1],o=r.x-n.x,i=r.y-n.y,a=Math.hypot(o,i),s=-1,c=-1;for(let p=1;p<e.length-1;p++){let d=e[p],f=a>1e-12?Math.abs((d.x-n.x)*i-(d.y-n.y)*o)/a:Math.hypot(d.x-n.x,d.y-n.y);f>s&&(s=f,c=p)}if(s<=t||c<0)return[n,r];let l=Jn(e.slice(0,c+1),t),u=Jn(e.slice(c),t);return[...l.slice(0,-1),...u]}function _r(e,t){if(e.length<4)return e;let n=Jn([...e,e[0]],t);return n.pop(),n.length>=3?n:e}function Fr(e,t,n){if(e.length<2)return[];let r=n??cn(e),o=new Map;for(let a=0;a<e.length;a++){let s=o.get(e[a].blockId);s?s.push(a):o.set(e[a].blockId,[a])}let i=[];for(let[,a]of o){let s=[];for(let g of a){let x=e[g].patch;x&&x.length>=3?i.push({outline:[...x],holes:[],topY:e[g].y}):s.push(g)}if(!s.length)continue;s.sort((g,x)=>e[g].depth-e[x].depth);let l=s.map(g=>kr(e,g,r,t)).filter(g=>g!==null);if(!l.length)continue;let u=(g,x)=>({x:g.pts[x].x-g.nrm[x][0]*(g.front+ft),y:g.pts[x].y-g.nrm[x][1]*(g.front+ft)}),p=(g,x)=>({x:g.pts[x].x+g.nrm[x][0]*(g.back+ft),y:g.pts[x].y+g.nrm[x][1]*(g.back+ft)}),d=l[0],f=l[l.length-1],m=[];for(let g=0;g<d.pts.length;g++)m.push(u(d,g));for(let g of l)m.push(p(g,g.pts.length-1));for(let g=f.pts.length-1;g>=0;g--)m.push(p(f,g));for(let g=l.length-1;g>=0;g--)m.push(u(l[g],0));let h=Dr(m),y=1/0;for(let g of s)e[g].y<y&&(y=e[g].y);if(!Number.isFinite(y))continue;if(h.length>=3&&Math.abs(et(h))>1e-6&&l.every(g=>{let x=g.pts[Math.floor(g.pts.length/2)];return Rt(h,x.x,x.y)})){i.push({outline:_r(h,Lr),holes:[],topY:y});continue}for(let g of kc(l))i.push({outline:g,holes:[],topY:y})}return i}function kc(e){let t=[];for(let n of e){let r=[],o=[],i=n.front+ft,a=n.back+ft;for(let c=0;c<n.pts.length;c++){let l=n.pts[c],u=n.nrm[c];r.push([l.x-u[0]*i,l.y-u[1]*i]),o.push([l.x+u[0]*a,l.y+u[1]*a])}let s=[...r,...o.reverse()];s.length<3||(s.push(s[0]),t.push([s]))}if(!t.length)return[];try{let n=to.default.union(t[0],...t.slice(1)),r=[];for(let o of n){if(!o.length||o[0].length<4)continue;let i=o[0].map(([c,l])=>({x:c,y:l})),a=i[0],s=i[i.length-1];i.length>1&&Math.abs(a.x-s.x)<1e-9&&Math.abs(a.y-s.y)<1e-9&&i.pop(),i.length>=3&&r.push(_r(i,Lr))}return r}catch{return[]}}function Dr(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 eo=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(!Rt(n,o.x,o.y)){r=!1;break}if(r)return!0}return!1}};function Rr(e,t,n,r,o,i){if(r.length<3)return;if(n.containsAll(r)){let l=[0,1,0],u=r[0];for(let p=1;p+1<r.length;p++){let d=r[p],f=r[p+1];e.tri([u.x*N,o,u.y*N],[d.x*N,o,d.y*N],[f.x*N,o,f.y*N],l,i)}return}let a=r.map(l=>[l.x,l.y]);a.push(a[0]);let s;try{s=to.default.intersection([a],t)}catch{return}let c=[0,1,0];for(let l of s){if(!l.length||l[0].length<4)continue;let u=l[0],p=[],d=[];for(let m=0;m<u.length-1;m++)p.push(u[m][0],u[m][1]),d.push([u[m][0],u[m][1]]);if(d.length<3)continue;let f=(0,Er.default)(p,void 0,2);for(let m=0;m<f.length;m+=3){let h=d[f[m]],y=d[f[m+1]],b=d[f[m+2]];e.tri([h[0]*N,o,h[1]*N],[y[0]*N,o,y[1]*N],[b[0]*N,o,b[1]*N],c,i)}}}function Or(e,t,n,r,o,i,a){if(t.length<2)return;let s=a??cn(t),c=[0,1,0],l=i&&i.length>=3?[[...i.map(f=>[f.x,f.y]),[i[0].x,i[0].y]]]:null,u=i&&i.length>=3?new eo([[...i]]):null,p=f=>{e.setMaterial(2),f(),e.setMaterial(0)},d=f=>{e.setMaterial(3),f(),e.setMaterial(0)};for(let f=0;f<t.length;f++){let m=t[f];if(m.patch&&m.patch.length>=3){let C=[...m.patch],S=s[f].belowY??r;if(d(()=>{if(l&&u)Rr(e,l,u,C,m.y,o.tread);else{let A=C[0];for(let L=1;L+1<C.length;L++){let O=C[L],z=C[L+1];e.tri([A.x*N,m.y,A.y*N],[O.x*N,m.y,O.y*N],[z.x*N,m.y,z.y*N],c,o.tread)}}}),m.y>S+Ar){let A=0,L=0;for(let O of C)A+=O.x,L+=O.y;A/=C.length,L/=C.length,p(()=>{for(let O=0;O<C.length;O++){let z=C[O],B=C[(O+1)%C.length],T=B.x-z.x,w=B.y-z.y,R=Math.hypot(T,w);if(R<1e-6)continue;let P=w/R,I=-T/R;(z.x-A)*P+(z.y-L)*I<0&&(P=-P,I=-I);let G=[P,0,I],k=[z.x*N,m.y,z.y*N],M=[B.x*N,m.y,B.y*N],E=[z.x*N,S,z.y*N],D=[B.x*N,S,B.y*N];e.tri(k,M,D,G,o.riser),e.tri(k,D,E,G,o.riser)}})}continue}let h=kr(t,f,s,n);if(!h)continue;let{pts:y,nrm:b,front:g,back:x}=h,v=s[f].belowY??r;for(let C=0;C+1<y.length;C++){let S=y[C],A=y[C+1],L=b[C],O=b[C+1];if(Math.hypot(A.x-S.x,A.y-S.y)<1e-6||L[0]===0&&L[1]===0||O[0]===0&&O[1]===0)continue;let z=[(S.x-L[0]*g)*N,m.y,(S.y-L[1]*g)*N],B=[(A.x-O[0]*g)*N,m.y,(A.y-O[1]*g)*N],T=[(S.x+L[0]*x)*N,m.y,(S.y+L[1]*x)*N],w=[(A.x+O[0]*x)*N,m.y,(A.y+O[1]*x)*N];if(d(()=>{l&&u?Rr(e,l,u,[{x:S.x-L[0]*g,y:S.y-L[1]*g},{x:A.x-O[0]*g,y:A.y-O[1]*g},{x:A.x+O[0]*x,y:A.y+O[1]*x},{x:S.x+L[0]*x,y:S.y+L[1]*x}],m.y,o.tread):(e.tri(z,B,w,c,o.tread),e.tri(z,w,T,c,o.tread))}),m.y>v+Ar){let R=[z[0],v,z[2]],P=[B[0],v,B[2]],I=[-L[0],0,-L[1]];p(()=>{e.tri(z,B,P,I,o.riser),e.tri(z,P,R,I,o.riser)})}}}}function Vr(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 ln(e,t){return e.minX<=t.maxX&&t.minX<=e.maxX&&e.minY<=t.maxY&&t.minY<=e.maxY}var no=st(require("polygon-clipping"),1);function Lc(e,t){let n=e.eventConfigurationIds;return!n?.length||!!t&&n.includes(t)}function Br(e,t){return e.filter(n=>n.type!=="shape"||Lc(n,t))}function Nr(e,t){let n=e.focalPoint??{x:0,y:0};return e.floors?.length?e.floors.map((r,o)=>({objects:Br(r.objects,t),focal:{x:(r.focalPoint??n).x,y:(r.focalPoint??n).y},baseHeightM:r.baseHeightM??0,index:o})):[{objects:Br(e.objects,t),focal:n,baseHeightM:0,index:0}]}var _c={minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};function pt(e){return Vr(e)??_c}function Gr(e,t){let n=tn(e.outline,Me),r=pt(n),o=t.filter(a=>a!==e&&a.outline&&a.outline.length>=3&&ln(r,pt(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=no.default.difference([i(n)],...o.map(c=>[i(c.outline)])),s=[];for(let c of a){if(!c.length)continue;let l=c[0].map(([u,p])=>({x:u,y:p}));if(l.length>1){let u=l[0],p=l[l.length-1];Math.abs(u.x-p.x)<1e-9&&Math.abs(u.y-p.y)<1e-9&&l.pop()}l.length>=3&&s.push(l)}return s.length?s:[n]}catch{return[n]}}function zr(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=no.default.intersection([n(i.outline)],r.flat())}catch{o.push(i);continue}for(let s of a){if(!s.length)continue;let c=s[0].map(([l,u])=>({x:l,y:u}));if(c.length>1){let l=c[0],u=c[c.length-1];Math.abs(l.x-u.x)<1e-9&&Math.abs(l.y-u.y)<1e-9&&c.pop()}c.length>=3&&o.push({outline:c,holes:[],topY:i.topY})}}return o.length?o:e}var Fc=.05,Ur=.05,Dc=.15,oo=25;function Hr(e,t,n){let r=new Map,o=new Array(t.length).fill(null),i=new Float64Array(t.length),a=new Array(t.length).fill(void 0),s=new Array(t.length).fill(void 0),c=new Map,l=[],u=new Set;for(let d=0;d<e.length;d+=1){let f=e[d];for(let m of f.objects){if(m.type==="table"&&u.add(m.id),m.type!=="section"||!m.outline||m.outline.length<3)continue;let h=tn(m.outline,Me);c.set(m.id,{section:m,unit:f,frontU:1/0,hasSeats:!1,rows:new Map,seatIndices:[]}),l.push({id:m.id,floorIndex:d,box:pt(h),section:m,unit:f,outline:h})}}let p=new Map;for(let d of l){let f=p.get(d.floorIndex);f?f.push(d):p.set(d.floorIndex,[d])}for(let d=0;d<t.length;d++){let f=t[d],m=n?p.get(n[d])??[]:l,h=f.sectionId?m.find(b=>b.id===f.sectionId)??m.find(b=>b.section.logicalSectionId===f.sectionId&&nt({x:f.x,y:f.y},b.outline,b.section.holes)):void 0,y=h?[h]:m;for(let b of y){if(n&&b.floorIndex!==n[d]||!h&&(f.x<b.box.minX||f.x>b.box.maxX||f.y<b.box.minY||f.y>b.box.maxY||!nt({x:f.x,y:f.y},b.outline,b.section.holes)))continue;o[d]=b.id;let g=c.get(b.id);g.hasSeats=!0;let x=f.focalPoint??b.unit.focal,v=Math.hypot(f.x-x.x,f.y-x.y);v<g.frontU&&(g.frontU=v),g.seatIndices.push(d);let C=f.rowId||`__seat-${d}`,S=g.rows.get(C);S?S.push({x:f.x,y:f.y}):g.rows.set(C,[{x:f.x,y:f.y}]);break}}for(let[d,f]of c){let m=$t(f.section,{floorBaseHeightM:f.unit.baseHeightM}),h=f.unit.baseHeightM,y=m.rake>0?Math.tan(m.rake*Math.PI/180):0,b=m.rake<=.01&&m.height<=h+.001,g=f.section.surfaceKind,x=g==="flat"?!0:g==="rakedRows"&&m.rake>.01?!1:b,v=f.hasSeats?rn(d,t,f.seatIndices,f.unit.focal):{sectionId:d,rows:[],blockCount:0},S=v.rows.length<2?Cr([...f.rows.values()].map(k=>({points:k})),f.unit.focal):null,A=1/0;if(S){if(f.hasSeats)for(let k of f.rows.values())for(let M of k){let E=S.depthAt(M.x,M.y);E<A&&(A=E)}if(!f.hasSeats||!Number.isFinite(A)){A=1/0;for(let k of f.section.outline){let M=S.depthAt(k.x,k.y);M<A&&(A=M)}}}let L=h+Fc,O=Math.max(L,m.height),z=k=>{let M=Math.max(0,k-A)*Se,E=Math.min(M*y,oo);return Math.max(L,m.height+E)},B=k=>{let M=Math.max(0,k)*Se,E=Math.min(M*y,oo);return Math.max(L,m.height+E)},T=x?[]:v.rows.map(k=>({pts:k.pts,y:B(k.blockDepth),depth:k.blockDepth,blockId:k.blockId,...u.has(k.id)?{patch:Tr(k.pts,Me)}:{}})),w=T.length?T[0].y:O,R=T.map(k=>{let M=k.patch&&k.patch.length>=3?k.patch:k.pts,E=0,D=0;for(let j of M)E+=j.x,D+=j.y;let V=M.length||1;E/=V,D/=V;let H=0;for(let j of M){let _=Math.hypot(j.x-E,j.y-D);_>H&&(H=_)}return{cx:E,cy:D,rad:H}}),P=x?()=>O:T.length>=2?(k,M)=>{let E=1/0,D=w;for(let V=0;V<T.length;V++){let H=R[V];if(Math.hypot(k-H.cx,M-H.cy)-H.rad>=E)continue;let j=T[V].patch,_=j&&j.length>=3?Rt(j,k,M)?0:mt(j,k,M):mt(T[V].pts,k,M);_<E&&(E=_,D=T[V].y)}return D}:(k,M)=>S?z(S.depthAt(k,M)):O,I=[0,1,0],G=T.length>=2||x?()=>I:(k,M)=>{if(!S)return I;let E=S.depthAt(k,M);if(E<=A)return I;let D=(E-A)*Se;if(D*y>=oo||m.height+D*y<=L)return I;let[V,H]=S.gradientAt(k,M);if(V===0&&H===0)return I;let j=1/Math.hypot(y,1);return[-V*y*j,j,-H*y*j]};if(!x)for(let k of v.rows){let M=B(k.blockDepth);for(let E of k.seatIndices)a[E]=M}for(let k of v.rows){let M=[];for(let j=1;j<k.pts.length;j++){let _=Math.hypot(k.pts[j].x-k.pts[j-1].x,k.pts[j].y-k.pts[j-1].y);_>1e-6&&M.push(_)}M.sort((j,_)=>j-_);let E=M.length?M[Math.floor(M.length/2)]:1/0,D=1/0,V=k.pts[Math.floor(k.pts.length/2)];if(V)for(let j of v.rows){if(j===k||j.blockId!==k.blockId)continue;let _=mt(j.pts,V.x,V.y);_>1e-6&&_<D&&(D=_)}let H=Math.min(E,Math.max(D,E*.5));if(Number.isFinite(H)&&H>0)for(let j of k.seatIndices)s[j]=H}r.set(d,{sectionId:d,deckAt:P,normalAt:G,flat:x,bottomY:h,rowLevels:T,landingY:w})}for(let d=0;d<t.length;d++){let f=o[d],m=t[d];if(f){let y=a[d];i[d]=(y??r.get(f).deckAt(m.x,m.y))+Dc;continue}let h=m.eyeHeightM;i[d]=Number.isFinite(h)?Math.max(0,h-je):0}return{bySection:r,seatOwner:o,seatDeckY:d=>i[d],seatPitchU:d=>s[d]}}var ce={top:1,wallBottom:.5,bottomCap:.4};function Ve(e,t){if(!e)return t;let n=ve(Pt(e,.4),.62);return he(t,n,.72)}function jr(e,t){let n=new Map;for(let i of e.categories??[])n.set(i.key,i.color);let r=new Map;for(let i of t){if(!i.sectionId)continue;let a=r.get(i.sectionId);a||(a=new Map,r.set(i.sectionId,a)),a.set(i.categoryKey,(a.get(i.categoryKey)??0)+1)}let o=new Map;for(let[i,a]of r){let s=0,c=0,l=0,u=0;for(let[p,d]of a){let f=ee(n.get(p));f&&(s+=f[0]*d,c+=f[1]*d,l+=f[2]*d,u+=d)}u>0&&o.set(i,[s/u,c/u,l/u])}return o}function Xr(e,t){return ee(e.color)??t.get(e.logicalSectionId??e.id)??null}var Rm=Math.PI*2;function Yr(e){return e==="pitch-football"||e==="rink-hockey"||e==="track-athletics"||e==="oval-cricket"}var Wr=st(require("polygon-clipping"),1);function Oc(e,t){return e===void 0||t===void 0?!0:Math.abs(e-t)<.001}var un=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=pt(t),i=this.rings.filter((c,l)=>ln(o,this.boxes[l])&&Oc(n,this.levels[l])),a=[[r]];if(i.length)try{a=Wr.default.difference([r],...i).map(l=>l.map(u=>u.map(([p,d])=>[p,d])))}catch{a=[[r]]}this.rings.push([r]),this.boxes.push(o),this.levels.push(n);let s=[];for(let c of a){if(!c.length)continue;let l=c[0].map(([u,p])=>({x:u,y:p}));if(l.length>1){let u=l[0],p=l[l.length-1];Math.abs(u.x-p.x)<1e-9&&Math.abs(u.y-p.y)<1e-9&&l.pop()}l.length>=3&&s.push(l)}return s}};function Vc(e,t){if(!t)return e;let n=1/0,r=-1/0,o=1/0,i=-1/0;for(let p of e)n=Math.min(n,p.x),r=Math.max(r,p.x),o=Math.min(o,p.y),i=Math.max(i,p.y);let a=(n+r)/2,s=(o+i)/2,c=t*Math.PI/180,l=Math.cos(c),u=Math.sin(c);return e.map(p=>{let d=p.x-a,f=p.y-s;return{x:a+d*l-f*u,y:s+d*u+f*l}})}function ot(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=kt(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=nn(n,r,e.width/2,e.height/2)}return t?Vc(t,e.rotation):null}function _t(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"&&Yr(e.stageKind)?{kind:"stage",heightM:.06}:n[t]??{kind:"plate",heightM:.25};return{...r,heightM:e.heightM??r.heightM}}var Bc=.08;function Kr(e,t){let n=ot(e),r=_t(e),o=r.heightM;if(!n||r.kind!=="plate"&&r.kind!=="stage")return o;let i=1/0,a=1/0,s=-1/0,c=-1/0;for(let u of n)i=Math.min(i,u.x),a=Math.min(a,u.y),s=Math.max(s,u.x),c=Math.max(c,u.y);let l=o;for(let u of t)s>u.minX&&i<u.maxX&&c>u.minY&&a<u.maxY&&l<=u.topOffsetM+1e-6&&(l=u.topOffsetM+Bc);return t.push({minX:i,minY:a,maxX:s,maxY:c,topOffsetM:l}),l}function Xe(e,t,n){return{x:e.x+(t.x-e.x)*n,y:e.y+(t.y-e.y)*n}}function qr(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 Ft(e,t,n){return[Xe(e[0],e[1],t),Xe(e[0],e[1],n),Xe(e[3],e[2],n),Xe(e[3],e[2],t)]}function Qr(e,t,n){return[Xe(e[0],e[3],t),Xe(e[1],e[2],t),Xe(e[1],e[2],n),Xe(e[0],e[3],n)]}function Be(e,t,n,r,o,i){le(e,t,void 0,()=>n,r,o,i,ce)}var ro=2.4,Nc=.75,Gc=.15;function Dt(e){if(e.points&&e.points.length>=3)return e.points;let{center:t,width:n,height:r,rotation:o}=e;if(!n||!r)return null;let i=(o??0)*Math.PI/180,a=Math.cos(i),s=Math.sin(i),c=n/2,l=r/2;return[[-c,-l],[c,-l],[c,l],[-c,l]].map(([u,p])=>({x:t.x+u*a-p*s,y:t.y+u*s+p*a}))}function $r(e,t,n,r,o){let i=Dt(t);i&&le(e,i,void 0,()=>n+ro,n,Ve(r,o.boothTop),o.boothWall,ce)}function io(e){if(e.shape==="round"){let u=e.radius;return u?nn(e.center.x,e.center.y,u,u,24):null}let{width:t,height:n,rotation:r,center:o}=e;if(!t||!n)return null;let i=(r??0)*Math.PI/180,a=Math.cos(i),s=Math.sin(i),c=t/2,l=n/2;return[[-c,-l],[c,-l],[c,l],[-c,l]].map(([u,p])=>({x:o.x+u*a-p*s,y:o.y+u*s+p*a}))}function Zr(e,t,n,r,o){let i=io(t);i&&le(e,i,void 0,()=>n+Nc,n,Ve(r,o.tableTop),o.tableWall,ce)}function Jr(e,t,n,r,o,i,a,s){let c=ot(t);if(!c)return;let l=s?s.kind==="stage":t.role==="stage",u=s?s.kind==="screen":t.role==="screen",p=s?{kind:l?"stage":"solid",heightM:s.topY-s.baseY}:_t(t),d=s?.baseY??n,f=s?.topY??n+r;if(l&&a){let g=1/0,x=-1/0,v=1/0,C=-1/0;for(let S of c)S.x<g&&(g=S.x),S.x>x&&(x=S.x),S.y<v&&(v=S.y),S.y>C&&(C=S.y);a.push({cx:(g+x)/2*N,cz:(v+C)/2*N,y:f,halfX:Math.max((x-g)/2*N,.5),halfZ:Math.max((C-v)/2*N,.5)})}let m=ee(t.fill),h=l&&m?he(o.stageTop,ve(Pt(m,.18),.9),.9):Ve(m,l?o.stageTop:o.decorTop),y=u?m:null,b=l?m?he(o.stageWall,ve(m,.58),.82):o.stageWall:u?y?he(ve(y,1.42),[.24,.46,.82],.08):[.24,.46,.82]:Ve(ee(t.fill),o.decorWall);if(p.kind==="portal"&&c.length===4){let g=qr(c);Be(e,Ft(g,0,.16),f,d,h,b),Be(e,Ft(g,.84,1),f,d,h,b),Be(e,g,f,Math.max(d,f-.35),h,b);return}if(p.kind==="suite"&&c.length===4){let g=c.map((C,S)=>{let A=c[(S+1)%4],L=(C.x+A.x)/2,O=(C.y+A.y)/2;return Math.hypot(L-i.x,O-i.y)}),x=g.indexOf(Math.min(...g)),v=[0,1,2,3].map(C=>c[(x+C)%4]);Be(e,Ft(v,0,.08),f,d,h,b),Be(e,Ft(v,.92,1),f,d,h,b),Be(e,Qr(v,.88,1),f,d,h,b),Be(e,v,f,Math.max(d,f-.18),h,b);return}Be(e,c,f,d,h,b)}function ao(e){let{x:t,y:n,width:r,height:o}=e;if(!r||!o)return null;let i=t+r/2,a=n+o/2,s=(e.rotation??0)*Math.PI/180,c=Math.cos(s),l=Math.sin(s),u=r/2,p=o/2;return[[-u,-p],[u,-p],[u,p],[-u,p]].map(([d,f])=>({x:i+d*c-f*l,y:a+d*l+f*c}))}function zc(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 ee(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=ee(s[1].trim());c&&a.push(c)}return a.length?a.reduce((s,c,l)=>he(s,c,1/(l+1)),a[0]):null}function ei(e,t,n,r){if(t.layer==="foreground")return;let o=ao(t);if(!o)return;let i=n+Gc,a=Ve(zc(t.href),r.decorTop),s=Math.max(0,Math.min(1,t.opacity??1));s<1&&(a=he(r.ground,a,s)),le(e,o,void 0,()=>i,n,a,he(a,r.decorWall,.5),ce)}function ti(e,t,n,r,o){if(!t.points||t.points.length<3)return;let i=Ve(r,o.gaTop);le(e,t.points,t.holes,()=>n+.15,n,i,o.gaWall,ce)}var Uc=Math.PI/180,te=96,Hc=6,jc=60,Xc=150,ni=.2,Yc=.35;function Wc(e,t){let n=Math.atan2(t.x-e.x,t.y-e.y)/Uc;return n<0?n+360:n}function dn(e){if(!e.length)return NaN;let t=[...e].sort((n,r)=>n-r);return t[Math.floor(t.length/2)]}function mn(e,t,n=2){let r=e.length,o=new Float64Array(r);for(let i=0;i<r;i++){let a=0,s=0;for(let c=-n;c<=n;c++){let l=i+c;if(t)l=(l%r+r)%r;else if(l<0||l>=r)continue;a+=e[l],s++}o[i]=a/s}return o}function oi(e,t){let n=e.filter(d=>d.rows.length>=1);if(n.length<1)return null;let r=[],o=0,i=0,a=0;for(let d of n)for(let f of d.rows){for(let m of f.pts)o+=m.x,i+=m.y,a++;if(f.pts.length>=4){let m=Qn(f.pts);m&&Number.isFinite(m.cx)&&Number.isFinite(m.cy)&&r.push({x:m.cx,y:m.cy})}}if(!a)return null;let s={x:o/a,y:i/a},c=s;if(r.length>=8){let d=dn(r.map(b=>b.x)),f=dn(r.map(b=>b.y)),m=0;for(let b of n)for(let g of b.rows)for(let x of g.pts){let v=Math.hypot(x.x-s.x,x.y-s.y);v>m&&(m=v)}let h=0,y=m*.2;for(let b of n)for(let g of b.rows)for(let x of g.pts)Math.hypot(x.x-d,x.y-f)<y&&h++;Math.hypot(d-s.x,f-s.y)<=m&&h/a<.01&&(c={x:d,y:f})}let l=[];for(let d of n){let f={sectionId:d.sectionId,rMin:1/0,rMax:-1/0,samples:[]};for(let m of d.rows)for(let h of m.pts){let y=Math.hypot(h.x-c.x,h.y-c.y),b=Math.min(te-1,Math.floor(Wc(c,h)/(360/te)));f.samples.push({r:y,bin:b,levelM:m.levelM}),y<f.rMin&&(f.rMin=y),y>f.rMax&&(f.rMax=y)}f.samples.length&&l.push(f)}if(!l.length)return null;l.sort((d,f)=>d.rMin+d.rMax-(f.rMin+f.rMax));let u=[];for(let d of l){let f=!1;for(let m of u){let h=Math.min(d.rMax,m.rMax)-Math.max(d.rMin,m.rMin),y=Math.min(d.rMax-d.rMin,m.rMax-m.rMin);if(y>1e-9&&h>=Yc*y){m.members.push(d),m.rMin=Math.min(m.rMin,d.rMin),m.rMax=Math.max(m.rMax,d.rMax),f=!0;break}}f||u.push({members:[d],rMin:d.rMin,rMax:d.rMax})}let p=[];for(let d of u){let f=new Array(te).fill(null);for(let w of d.members)for(let R of w.samples){let P=f[R.bin];P||(P={samples:[]},f[R.bin]=P),P.samples.push({r:R.r,levelM:R.levelM})}let m=f.map(w=>!!w);if(!m.filter(Boolean).length)continue;let y=[],b=[];for(let w of f){if(!w)continue;let R=1/0,P=-1/0;for(let I of w.samples)I.r<R&&(R=I.r),I.r>P&&(P=I.r);y.push(R),b.push(P)}let g=dn(y),x=dn(b);if(!(g>=ni*x)||!(x>0))continue;let v=[...y].sort((w,R)=>w-R);if(!(v[Math.floor(v.length*.1)]>=ni*x))continue;let S=f.map(w=>{if(!w)return null;let R=[...w.samples].sort((V,H)=>V.r-H.r),P=R[0].r,I=R[R.length-1].r,G=R[0].levelM,k=-1/0;for(let V of R)V.levelM>k&&(k=V.levelM);let M=[];for(let V of R){let H={r:V.r,l:V.levelM};for(;M.length&&Math.abs(M[M.length-1].r-H.r)<1e-9;){if(M[M.length-1].l<=H.l){H.skip=!0;break}M.pop()}if(!H.skip){for(;M.length>=2;){let j=M[M.length-2],_=M[M.length-1];if((_.r-j.r)*(H.l-j.l)-(_.l-j.l)*(H.r-j.r)<=0)M.pop();else break}M.push(H)}}let E=M.map(V=>V.r),D=M.map(V=>V.l);return{inner:P,outer:I,front:G,top:k,profile:{rs:E,ls:D}}}),A=m.slice();for(let w=0;w<te;w++){if(A[w])continue;let R=-1,P=-1,I=0;for(let F=1;F<=te;F++){let X=(w-F+te*2)%te;if(A[X]){R=X;break}}for(let F=1;F<=te;F++){let X=(w+F)%te;if(A[X]){P=X,I=F;break}}if(R<0||P<0)continue;let G=0;for(let F=1;F<=te;F++){let X=(w-F+te*2)%te;if(m[X]){G=F;break}}if(G-1+I>Hc)continue;let M=S[R],E=S[P],D=G/(G+I),V=M.inner+(E.inner-M.inner)*D,H=M.outer+(E.outer-M.outer)*D,j=M.front+(E.front-M.front)*D,_=M.top+(E.top-M.top)*D;S[w]={inner:V,outer:H,front:j,top:_,profile:{rs:[V,H],ls:[j,_]}}}for(let w=0;w<te;w++)S[w]&&(A[w]=!0);let L=360/te,O=[],z=A.filter(Boolean).length,B=[];if(z===te)B.push({start:0,len:te});else{let w=0;for(;A[w];)w=(w+1)%te;let R=-1;for(let P=0;P<=te;P++){let I=(w+P)%te,G=P<te&&A[I];if(G&&R<0)R=I;else if(!G&&R>=0){let k=(I-R+te)%te||te;B.push({start:R,len:k}),R=-1}}}for(let w of B){if(w.len*L<jc&&w.len<te)continue;let R=w.len===te,P=new Float64Array(w.len),I=new Float64Array(w.len),G=new Float64Array(w.len),k=new Float64Array(w.len),M=[];for(let F=0;F<w.len;F++){let X=S[(w.start+F)%te];P[F]=X.inner,I[F]=X.outer,G[F]=X.front,k[F]=X.top,M.push(X.profile??{rs:[X.inner,X.outer],ls:[X.front,X.top]})}let E=mn(P,R),D=mn(I,R),V=mn(G,R),H=mn(k,R);for(let F=0;F<w.len;F++)E[F]>P[F]&&(E[F]=P[F]),D[F]<I[F]&&(D[F]=I[F]),E[F]>D[F]-1e-6&&(E[F]=Math.max(0,D[F]-1e-6)),H[F]<V[F]&&(H[F]=V[F]);let j={startBin:w.start,binCount:w.len,closed:R,innerR:E,outerR:D,frontLevelM:V,topLevelM:H,profiles:M},_=(F,X,W)=>{let q=M[F],Q=q.rs,Z=q.ls;if(X<=Q[0]){Z[0]>W&&(Z[0]=W);return}if(X>=Q[Q.length-1]){Z[Z.length-1]>W&&(Z[Z.length-1]=W);return}for(let re=0;re+1<Q.length;re++)if(X<=Q[re+1]){Z[re]>W&&(Z[re]=W),Z[re+1]>W&&(Z[re+1]=W);return}};for(let F=0;F<w.len;F++){let X=f[(w.start+F)%te];if(X)for(let W of X.samples){_(F,W.r,W.levelM);let q=R?(F-1+w.len)%w.len:F-1,Q=R?(F+1)%w.len:F+1;q>=0&&_(q,W.r,W.levelM),Q<w.len&&_(Q,W.r,W.levelM)}}O.push(j)}O.reduce((w,R)=>w+R.binCount*L,0)<Xc||p.push({arcs:O,sectionIds:d.members.map(w=>w.sectionId),innerRMedian:g,outerRMedian:x})}if(!p.length)return null;if(p.sort((d,f)=>d.innerRMedian-f.innerRMedian),t){let d=p[p.length-1].outerRMedian;if(Math.hypot(t.x-c.x,t.y-c.y)>.9*d)return null}return{centre:c,binCount:te,binStepDeg:360/te,rings:p}}function ri(e,t,n,r){let o=e.binStepDeg,i=n/o-.5-t.startBin;i=(i%e.binCount+e.binCount)%e.binCount,i>t.binCount-1&&(t.closed?i=i-t.binCount<t.binCount-i?0:t.binCount-1:i=i-(t.binCount-1)<e.binCount-i?t.binCount-1:0);let a=Math.floor(i),s=t.closed?(a+1)%t.binCount:Math.min(t.binCount-1,a+1),c=i-a,l=u=>{let p=t.profiles[u],d=p.rs,f=p.ls;if(r<=d[0])return f[0];if(r>=d[d.length-1])return f[f.length-1];for(let m=0;m+1<d.length;m++)if(r<=d[m+1]){let h=d[m+1]-d[m],y=h>1e-9?(r-d[m])/h:0;return f[m]+(f[m+1]-f[m])*y}return f[f.length-1]};return l(a)*(1-c)+l(s)*c}var Kc=.25,qc=1.2,Qc=.6,$c=.45,Zc=2.3,Jc=Math.PI/180;function rt(e,t,n){let r=n*Jc;return{x:e.x+t*Math.sin(r),y:e.y+t*Math.cos(r)}}function el(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 tl=24;function nl(e,t,n,r,o,i,a,s){let c=n.binCount,l=tl,u=Se,p=i+.02,d=[];for(let T=0;T<c;T++){let w=(n.startBin+T+.5)*t.binStepDeg,R=new Float64Array(l+1);for(let P=0;P<=l;P++){let I=r[T]+(o[T]-r[T])*P/l;R[P]=Math.max(p,ri(t,n,w,I)-Kc)}d.push(R)}let f=[a.bandTop[0]*s.top,a.bandTop[1]*s.top,a.bandTop[2]*s.top],m=[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],y=[a.bandWall[0]*s.wallBottom,a.bandWall[1]*s.wallBottom,a.bandWall[2]*s.wallBottom],b=(T,w)=>{let R=(n.startBin+T+.5)*t.binStepDeg,P=r[T]+(o[T]-r[T])*w/l,I=rt(t.centre,P,R);return[I.x*u,d[T][w],I.y*u]};{let T=Math.tan(12*Math.PI/180);for(let w=0;w<6;w++){let R=!1;for(let I=0;I<c;I++)for(let G=l-1;G>=0;G--)d[I][G]>d[I][G+1]&&(d[I][G]=d[I][G+1],R=!0);let P=n.closed?c:c-1;for(let I=0;I<P;I++){let G=(I+1)%c;for(let k=0;k<=l;k++){let M=d[G][k]-d[I][k];if(Math.abs(M)>1)continue;let E=r[I]+(o[I]-r[I])*k/l,D=r[G]+(o[G]-r[G])*k/l,V=rt(t.centre,E,(n.startBin+I+.5)*t.binStepDeg),H=rt(t.centre,D,(n.startBin+G+.5)*t.binStepDeg),j=T*Math.hypot(H.x-V.x,H.y-V.y)*u;M>j?(d[G][k]=d[I][k]+j,R=!0):-M>j&&(d[I][k]=d[G][k]+j,R=!0)}}if(!R)break}}let g=1,x=(T,w)=>{for(let R=0;R<=l;R+=4)if(Math.abs(d[T][R]-d[w][R])>g)return!0;return Math.abs(d[T][l]-d[w][l])>g},v=Math.tan(38*Math.PI/180),C=T=>(o[T]-r[T])/l*u,S=(T,w)=>d[T][w+1]-d[T][w]>v*Math.max(1e-6,C(T)),A=(T,w)=>{let R=n.closed?(T-1+c)%c:Math.max(0,T-1),P=n.closed?(T+1)%c:Math.min(c-1,T+1);Math.abs(d[R][w]-d[T][w])>g&&(R=T),Math.abs(d[P][w]-d[T][w])>g&&(P=T);let I=Math.max(0,w-1),G=Math.min(l,w+1);I<w&&S(T,I)&&(I=w),G>w&&S(T,w)&&(G=w);let k=b(R,w),M=b(P,w),E=b(T,I),D=b(T,G),V=M[0]-k[0],H=M[1]-k[1],j=M[2]-k[2],_=D[0]-E[0],F=D[1]-E[1],X=D[2]-E[2],W=H*X-j*F,q=j*_-V*X,Q=V*F-H*_,Z=Math.hypot(W,q,Q);return Z>1e-12?(W/=Z,q/=Z,Q/=Z,q<0&&(W=-W,q=-q,Q=-Q),[W,q,Q]):[0,1,0]},L=(T,w)=>{let R=[T[0],i,T[2]],P=[w[0],i,w[2]],I=w[0]-T[0],G=w[2]-T[2],k=Math.hypot(I,G);if(!(k>1e-12))return;let M=[G/k,0,-I/k];e.tri(T,w,P,M,h,h,y),e.tri(T,P,R,M,h,y,y)},O=.05*He,z=T=>o[T]-r[T]<O,B=n.closed?c:c-1;for(let T=0;T<B;T++){let w=(T+1)%c;if(z(T)||z(w))continue;if(x(T,w)){let M=(n.startBin+T+1)*t.binStepDeg,E=(F,X)=>{let W=(r[T]+r[w])/2,q=(o[T]+o[w])/2,Q=W+(q-W)*X/l,Z=rt(t.centre,Q,M);return[Z.x*u,d[F][X],Z.y*u]};for(let F=0;F<l;F++){let X=b(T,F),W=b(T,F+1),q=E(T,F),Q=E(T,F+1),Z=A(T,F),re=A(T,F+1);e.triN(X,q,Q,Z,Z,re,f),e.triN(X,Q,W,Z,re,re,f);let Ie=b(w,F),we=b(w,F+1),Pe=E(w,F),_e=E(w,F+1),Fe=A(w,F),Ne=A(w,F+1);e.triN(Pe,Ie,we,Fe,Fe,Ne,f),e.triN(Pe,we,_e,Fe,Ne,Ne,f);let xe=E(T,F),de=E(T,F+1),Ge=E(w,F+1),xt=E(w,F),Ce=de[0]-xe[0],Qe=de[2]-xe[2],De=Math.hypot(Ce,Qe);if(De>1e-12){let zt=[Qe/De,0,-Ce/De];e.tri(xe,de,Ge,zt,h),e.tri(xe,Ge,xt,zt,h)}}let D=b(T,0),V=b(w,0),H=b(w,l),j=b(T,l),_=F=>[F[0],i,F[2]];e.tri(_(D),_(H),_(V),[0,-1,0],m),e.tri(_(D),_(j),_(H),[0,-1,0],m),L(D,V),L(j,H);continue}for(let M=0;M<l;M++){let E=A(T,M),D=A(w,M),V=A(w,M+1),H=A(T,M+1);if(S(T,M)||S(w,M)){let W=(de,Ge)=>{let xt=(n.startBin+de+.5)*t.binStepDeg,Ce=r[de]+(o[de]-r[de])*(M+.5)/l,Qe=rt(t.centre,Ce,xt);return[Qe.x*u,Ge,Qe.y*u]},q=b(T,M),Q=b(w,M),Z=W(T,d[T][M]),re=W(w,d[w][M]);e.triN(q,Q,re,E,D,D,f),e.triN(q,re,Z,E,D,E,f);let Ie=b(w,M+1),we=b(T,M+1),Pe=W(T,d[T][M+1]),_e=W(w,d[w][M+1]);e.triN(Pe,_e,Ie,H,V,V,f),e.triN(Pe,Ie,we,H,V,H,f);let Fe=re[0]-Z[0],Ne=re[2]-Z[2],xe=Math.hypot(Fe,Ne);if(xe>1e-12){let de=[-Ne/xe,0,Fe/xe];e.tri(Z,re,_e,de,h),e.tri(Z,_e,Pe,de,h)}continue}let j=b(T,M),_=b(w,M),F=b(w,M+1),X=b(T,M+1);e.triN(j,_,F,E,D,V,f),e.triN(j,F,X,E,V,H,f)}let R=b(T,0),P=b(w,0),I=b(w,l),G=b(T,l),k=M=>[M[0],i,M[2]];e.tri(k(R),k(I),k(P),[0,-1,0],m),e.tri(k(R),k(G),k(I),[0,-1,0],m),L(R,P),L(G,I)}if(!n.closed)for(let T of[0,c-1])for(let w=0;w<l;w++)L(b(T,w),b(T,w+1))}function ii(e,t,n){let{bottomY:r,colors:o,ao:i}=n,a=new Float64Array(t.binCount).fill(-1/0);for(let u of t.rings)for(let p of u.arcs){let d=new Float64Array(p.binCount),f=new Float64Array(p.binCount);for(let h=0;h<p.binCount;h++){let y=(p.startBin+h)%t.binCount,b=Math.max(0,p.innerR[h]-Me);d[h]=Math.max(b,a[y]+.001),f[h]=Math.max(d[h]+.001,p.outerR[h]+Me)}let m=0;for(let h=0;h<p.binCount;h++){let y=p.topLevelM[h]-r;y>m&&(m=y)}m>=qc&&nl(e,t,p,d,f,r,o,i);for(let h=0;h<p.binCount;h++){let y=(p.startBin+h)%t.binCount;f[h]>a[y]&&(a[y]=f[h])}}if(n.deriveShell===!1||el(n.shapes,t))return;let s=t.rings[t.rings.length-1],c=Qc*He,l=$c*He;for(let u of s.arcs){let p=[],d=[];for(let h=0;h<u.binCount;h++){let y=(u.startBin+h+.5)*t.binStepDeg,b=u.outerR[h]+Me+c;p.push(rt(t.centre,b,y)),d.push(rt(t.centre,b+l,y))}let f=-1/0;for(let h=0;h<u.binCount;h++)u.topLevelM[h]>f&&(f=u.topLevelM[h]);let m=()=>f+Zc;u.closed?le(e,d,[p.slice().reverse()],m,r,o.shellTop,o.shellWall,i):le(e,[...d,...p.slice().reverse()],void 0,m,r,o.shellTop,o.shellWall,i)}}function ai(e,t,n,r,o,i,a,s){if(!t.outline||t.outline.length<3)return;let c=n.baseHeightM,l=Ve(r,s.tierTop);if(!o)return;let u=y=>o.deckAt(y.x,y.y),p=Gr(t,a),d=p[0]??t.outline;if(o.rowLevels.length>=2){let y=cn(o.rowLevels),b=zr(Fr(o.rowLevels,n.focal,y),p),g=()=>[0,1,0];for(let v of b){let C=Math.max(c,v.topY-.02);for(let S of i.subtract(v.outline,C))le(e,S,v.holes,()=>C,c,l,s.tierWall,ce,void 0,g)}b.length||le(e,d,t.holes,()=>o.landingY,c,l,s.tierWall,ce);let x={tread:[l[0]*ce.top,l[1]*ce.top,l[2]*ce.top],riser:[l[0]*.72,l[1]*.72,l[2]*.72]};for(let v of p.length?p:[d])Or(e,o.rowLevels,n.focal,o.landingY,x,v,y);return}let f=o.flat?1/0:Ur,m=y=>o.normalAt(y.x,y.y),h=o.flat?o.landingY:void 0;for(let y of i.subtract(d,h))le(e,y,t.holes,u,c,l,s.tierWall,ce,f,m)}function ol(e,t,n){let r=new Set;for(let a of e.objects)a.type==="section"&&r.add(a.id);let o=new Map;for(let a=0;a<t.length;a++){let s=n.seatOwner[a];if(!s||!r.has(s))continue;let c=n.bySection.get(s);if(c&&c.rowLevels.length>=2)continue;let l=t[a],u=o.get(s);u||(u=new Map,o.set(s,u));let p=l.rowId||`__seat-${a}`,d=u.get(p);d||(d={pts:[],levelM:0,n:0},u.set(p,d)),d.pts.push({x:l.x,y:l.y}),d.levelM+=n.seatDeckY(a),d.n++}let i=[];for(let a of e.objects){if(a.type!=="section")continue;let s=n.bySection.get(a.id);if(s&&s.rowLevels.length>=2){let l=s.rowLevels.filter(u=>!u.patch).map(u=>({pts:u.pts,levelM:u.y}));l.length>=2&&i.push({sectionId:a.id,rows:l});continue}let c=o.get(a.id);c&&i.push({sectionId:a.id,rows:[...c.values()].map(l=>({pts:l.pts,levelM:l.levelM/l.n}))})}return i}function si(e,t,n,r,o,i,a=!0){let s=ol(t,n,r);if(!s.length)return;let c=oi(s,t.focal);c&&(e.setMaterial(0),ii(e,c,{bottomY:t.baseHeightM,colors:{bandTop:ve(o.tierTop,.8),bandWall:o.tierWall,shellTop:i??ve(o.tierWall,1.15),shellWall:i??o.tierWall},ao:ce,shapes:t.objects.filter(l=>l.type==="shape"),deriveShell:a}))}function ci(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 li(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 rl=1.15,il=2.75,al=4.5,sl=.85,cl=.5,ll=.26;function ui(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>=rl&&a.add("zone"),o<=(i?il:al)&&(a.add("section"),a.add("ga")),o<=sl&&(a.add("annotation"),a.add("booth")),o<=cl&&a.add("row"),o<=ll&&a.add("seat"),a}function di(e,t,n,r,o,i=6){let a=i+t,s=r-i-t,c=i+n,l=o-i-n;return{...e,x:a>s?r/2:Math.max(a,Math.min(s,e.x)),y:c>l?o/2:Math.max(c,Math.min(l,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],l=o[1]*i+o[5]*a+o[9]*s+o[13],u=o[2]*i+o[6]*a+o[10]*s+o[14],p=o[3]*i+o[7]*a+o[11]*s+o[15];if(!(p>1e-6))return{x:0,y:0,depth:1/0,visible:!1};let d=c/p,f=l/p,m=u/p,h=d>=-1.05&&d<=1.05&&f>=-1.05&&f<=1.05&&m<=1;return{x:(d*.5+.5)*n,y:(1-(f*.5+.5))*r,depth:m,visible:h}}function mi(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 ul=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+ul):n;return o<a&&i<r}function fi(e,t,n){return e.length*t*.58+(n?14:0)}var dl={row:8,seat:14};function pi(e){return e<480?{row:5,seat:8}:e<768?{row:6,seat:10}:dl}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 co(e,t,n,r,o=[]){let i=[...e].sort((s,c)=>(c.priority??0)-(s.priority??0)||s.focus-c.focus),a=[];for(let s of i){if(a.length>=r)break;let c=!1;for(let l of o)if(so(s,l,t,n)){c=!0;break}if(!c){for(let l of a)if(so(s,l,t,n)){c=!0;break}}c||a.push(s)}return a}var ml=6,fl=2.2,bi=.1,pl=.3,hl=1.8,bl=.9,yl=.55,gl=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 u of n)for(let p of u.objects)p.type==="section"&&p.zone&&c.set(p.id,p.zone);let l=new Map;for(let u=0;u<r.length;u++){let p=r[u],d=o.seatOwner[u],f=p.zoneId??(d?c.get(d):void 0);if(!f)continue;let m=l.get(f);m||(m={n:0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0,sumY:0},l.set(f,m)),m.n++,p.x<m.minX&&(m.minX=p.x),p.y<m.minY&&(m.minY=p.y),p.x>m.maxX&&(m.maxX=p.x),p.y>m.maxY&&(m.maxY=p.y),m.sumY+=o.seatDeckY(u)}for(let u of a){let p=l.get(u.id),d=[];for(let[f,m]of c)m===u.id&&d.push(f);if(!p||p.n===0){s.push({id:u.id,label:u.label,color:ee(u.color),sectionIds:d,seatCount:0,center:[0,0,0],radius:0,focalWorld:[(u.focalPoint??i).x*N,1.5,(u.focalPoint??i).y*N]});continue}s.push({id:u.id,label:u.label,color:ee(u.color),sectionIds:d,seatCount:p.n,center:[(p.minX+p.maxX)/2*N,p.sumY/p.n,(p.minY+p.maxY)/2*N],radius:.5*Math.hypot((p.maxX-p.minX)*N,(p.maxY-p.minY)*N)||1,focalWorld:[(u.focalPoint??i).x*N,1.5,(u.focalPoint??i).y*N]})}}return s}function gi(e){let{doc:t,units:n,seats:r,surfaces:o,seatData:i,hintedSeatFloor:a,zones:s,focal:c}=e,l=[],u=[],p=[];for(let d of s)d.seatCount!==0&&l.push({id:`zone:${d.id}`,kind:"zone",text:d.label,anchor:[d.center[0],d.center[1]+ml,d.center[2]],color:t.zones?.find(f=>f.id===d.id)?.color});{let d=new Map,f=new Map;for(let m=0;m<r.length;m++){let h=o.seatOwner[m];if(!h)continue;let y=d.get(h);y||(y={n:0,x:0,y:0,deck:0},d.set(h,y)),y.n++,y.x+=r[m].x,y.y+=r[m].y,y.deck+=o.seatDeckY(m);let b=f.get(h);b||(b={minX:1/0,maxX:-1/0,minY:1/0,maxY:-1/0},f.set(h,b)),r[m].x<b.minX&&(b.minX=r[m].x),r[m].x>b.maxX&&(b.maxX=r[m].x),r[m].y<b.minY&&(b.minY=r[m].y),r[m].y>b.maxY&&(b.maxY=r[m].y)}for(let m of n)for(let h of m.objects){if(h.type!=="section")continue;let y=d.get(h.id);if(!y||y.n===0)continue;let b=f.get(h.id),g=[y.x/y.n*N,y.deck/y.n,y.y/y.n*N],x=h.displayLabel||h.label||h.id;u.push({id:h.id,floorIndex:m.index,label:x,seatCount:y.n,center:g,radius:Math.max(1,Math.hypot(b.maxX-b.minX,b.maxY-b.minY)*.5*N),focalWorld:[m.focal.x*N,m.baseHeightM+1.5,m.focal.y*N]});let v=t.floors?.[m.index]?.name?.trim().toLocaleLowerCase();n.length>1&&v===x.trim().toLocaleLowerCase()||l.push({id:`section:${h.id}`,kind:"section",text:x,anchor:[g[0],g[1]+fl,g[2]],floorIndex:m.index})}}{for(let m of n)for(let h of m.objects){if(h.type!=="gaArea")continue;let y=It(h.points);if(!y)continue;let b=h.displayLabel||h.label||h.id;l.push({id:`ga:${h.id}`,kind:"ga",text:h.capacity>0?`${b} \xB7 ${h.capacity.toLocaleString()}`:b,anchor:[y.x*N,m.baseHeightM+hl,y.y*N],floorIndex:m.index})}let d=new Map;for(let m=0;m<r.length;m++){let h=r[m],y=Math.hypot(h.x-c.x,h.y-c.y),b=d.get(h.rowId);(!b||y>b.far)&&d.set(h.rowId,{seat:h,index:m,far:y})}for(let[m,h]of d){let y=h.seat.label?h.seat.label.lastIndexOf("-"):-1,b=y>0?h.seat.label.slice(0,y):m;b&&l.push({id:`row:${m}`,kind:"row",text:b,anchor:[h.seat.x*N,o.seatDeckY(h.index)+bl,h.seat.y*N],floorIndex:a[h.index]})}let f=new Map;for(let m=0;m<r.length;m++){let h=r[m],y=h.label?h.label.lastIndexOf("-"):-1,b=f.get(h.rowId);b||(b={n:0,x:0,y:0,z:0,minX:1/0,maxX:-1/0,minZ:1/0,maxZ:-1/0,label:y>0?h.label.slice(0,y):h.rowId,sectionId:h.sectionId},f.set(h.rowId,b));let g=m*3,x=i.iPosition[g],v=i.iPosition[g+1],C=i.iPosition[g+2];b.n++,b.x+=x,b.y+=v,b.z+=C,b.minX=Math.min(b.minX,x),b.maxX=Math.max(b.maxX,x),b.minZ=Math.min(b.minZ,C),b.maxZ=Math.max(b.maxZ,C)}for(let[m,h]of f)p.push({id:m,label:h.label,sectionId:h.sectionId,seatCount:h.n,center:[h.x/h.n,h.y/h.n,h.z/h.n],radius:Math.max(.8,Math.hypot(h.maxX-h.minX,h.maxZ-h.minZ)*.5)});if(r.length<=gl)for(let m=0;m<r.length;m++){let h=r[m],y=h.displayLabel||h.label;y&&l.push({id:`seat:${h.id}`,kind:"seat",text:y,anchor:[h.x*N,o.seatDeckY(m)+yl,h.y*N],floorIndex:a[m]})}}for(let d of n)for(let f of d.objects)if(f.type==="shape"&&f.role&&["entrance","exit","screen","suite","obstruction"].includes(f.role)){let m=ot(f),h=m?It(m):null;if(!h||!f.label)continue;l.push({id:`architecture:${f.id}`,kind:"annotation",text:f.label,anchor:[h.x*N,d.baseHeightM+_t(f).heightM+bi,h.y*N],color:f.fill,floorIndex:d.index})}else if(f.type==="text"){if(!f.text)continue;l.push({id:`text:${f.id}`,kind:"annotation",text:f.text,anchor:[f.position.x*N,d.baseHeightM+bi,f.position.y*N],color:f.color,rotation:f.rotation,floorIndex:d.index})}else if(f.type==="booth"){let m=Dt(f);if(!m)continue;let h=It(m);if(!h)continue;l.push({id:`booth:${f.id}`,kind:"booth",text:f.displayLabel||f.label||f.id,anchor:[h.x*N,d.baseHeightM+ro+pl,h.y*N],floorIndex:d.index})}return{labels:l,sections:u,rows:p}}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 vi(e){let{doc:t,units:n,seats:r,surfaces:o,solids:i,hintedSeatFloor:a,seatFloor:s}=e,c=[];{let l=n.map(()=>({minX:1/0,minY:1/0,minZ:1/0,maxX:-1/0,maxY:-1/0,maxZ:-1/0}));for(let d=0;d<i.floor.length;d+=1){let f=Math.max(0,Math.min(n.length-1,Math.round(i.floor[d]))),m=d*3,h=l[f];h.minX=Math.min(h.minX,i.position[m]),h.minY=Math.min(h.minY,i.position[m+1]),h.minZ=Math.min(h.minZ,i.position[m+2]),h.maxX=Math.max(h.maxX,i.position[m]),h.maxY=Math.max(h.maxY,i.position[m+1]),h.maxZ=Math.max(h.maxZ,i.position[m+2])}let u=new Map;for(let d=0;d<n.length;d++)for(let f of n[d].objects)f.type==="section"&&u.set(f.id,d);let p=n.map(()=>({n:0,minX:1/0,minY:1/0,minDeck:1/0,maxX:-1/0,maxY:-1/0,maxDeck:-1/0,sumX:0,sumDeck:0,sumZ:0}));for(let d=0;d<r.length;d++){let f=o.seatOwner[d],m=(f!==null?u.get(f):void 0)??a[d];if(m===void 0)continue;let h=p[m],y=r[d];h.n++,y.x<h.minX&&(h.minX=y.x),y.y<h.minY&&(h.minY=y.y),y.x>h.maxX&&(h.maxX=y.x),y.y>h.maxY&&(h.maxY=y.y);let b=o.seatDeckY(d);h.sumX+=y.x*N,h.sumDeck+=b,h.sumZ+=y.y*N,h.minDeck=Math.min(h.minDeck,b),h.maxDeck=Math.max(h.maxDeck,b+1.6),s[d]=m}for(let d=0;d<n.length;d++){let f=p[d],m=t.floors?.[d],h=l[d],y=Math.min(f.n?f.minX*N:n[d].focal.x*N-1,Number.isFinite(h.minX)?h.minX:1/0),b=Math.max(f.n?f.maxX*N:n[d].focal.x*N+1,Number.isFinite(h.maxX)?h.maxX:-1/0),g=Math.min(f.n?f.minY*N:n[d].focal.y*N-1,Number.isFinite(h.minZ)?h.minZ:1/0),x=Math.max(f.n?f.maxY*N:n[d].focal.y*N+1,Number.isFinite(h.maxZ)?h.maxZ:-1/0),v=Math.min(f.n?Math.min(n[d].baseHeightM,f.minDeck):n[d].baseHeightM,Number.isFinite(h.minY)?h.minY:1/0),C=Math.max(f.n?Math.max(f.maxDeck,v+.5):v+.5,Number.isFinite(h.maxY)?h.maxY:-1/0),S=[f.n?f.sumX/f.n:(y+b)/2,f.n?f.sumDeck/f.n:(v+C)/2,f.n?f.sumZ/f.n:(g+x)/2],A=Math.max(1,.5*Math.hypot(b-y,C-v,x-g));c.push({index:d,id:m?.id??`floor-${d}`,label:m?.name??(n.length>1?`Floor ${d+1}`:"Venue"),seatCount:f.n,center:S,radius:A,box:{min:[y,v,g],max:[b,C,x]},focalWorld:[n[d].focal.x*N,n[d].baseHeightM+1.5,n[d].focal.y*N]})}}return c}function lo(e,t){let n=1/0,r=1/0,o=-1/0,i=-1/0,a=(s,c)=>{s<n&&(n=s),c<r&&(r=c),s>o&&(o=s),c>i&&(i=c)};for(let s of t)a(s.x,s.y);for(let s of e)for(let c of s.objects)if(c.type==="section")for(let l of c.outline)a(l.x,l.y);else if(c.type==="shape"&&c.points)for(let l of c.points)a(l.x,l.y);else if(c.type==="gaArea")for(let l of c.points)a(l.x,l.y);else if(c.type==="booth"){let l=Dt(c);if(l)for(let u of l)a(u.x,u.y)}else if(c.type==="table"){let l=io(c);if(l)for(let u of l)a(u.x,u.y)}else if(c.type==="decorImage"){let l=ao(c);if(l)for(let u of l)a(u.x,u.y)}return Number.isFinite(n)||(n=-100,r=-100,o=100,i=100),{minX:n,minY:r,maxX:o,maxY:i}}function Si(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=kt(o.minX-a,o.minY-a,o.maxX-o.minX+a*2,o.maxY-o.minY+a*2);le(e,s,void 0,()=>0,-.4,i.ground,i.ground,ce)}else{let a=t.reduce((f,m)=>m.baseHeightM<f.baseHeightM?m:f);e.setFloor(a.index);let s=n.filter((f,m)=>r[m]===a.index),c=lo([a],s),l=Math.hypot(c.maxX-c.minX,c.maxY-c.minY),u=Math.max(28,Math.min(80,l*.04)),p=kt(c.minX-u,c.minY-u,c.maxX-c.minX+u*2,c.maxY-c.minY+u*2),d=a.baseHeightM-.03;le(e,p,void 0,()=>d,d-.22,i.ground,i.ground,ce)}}function Mi(e,t,n){let{cx:r,cz:o,radius:i}=n,a=1/0,s=1/0,c=1/0,l=-1/0,u=-1/0,p=-1/0,d=(h,y,b)=>{a=Math.min(a,h),l=Math.max(l,h),s=Math.min(s,y),u=Math.max(u,y),c=Math.min(c,b),p=Math.max(p,b)};for(let h=0;h<e.position.length;h+=3)d(e.position[h],e.position[h+1],e.position[h+2]);for(let h=0;h<t.count;h++){let y=h*3,b=t.iPosition[y],g=t.iPosition[y+1],x=t.iPosition[y+2],v=Math.max(.35,t.iMaxRadius[h]??.35);d(b-v,g,x-v),d(b+v,g+1.6,x+v)}Number.isFinite(a)||(a=r-i,l=r+i,s=0,u=i*.16,c=o-i,p=o+i);let f=[(a+l)/2,(s+u)/2,(c+p)/2],m=Math.max(1,.5*Math.hypot(l-a,u-s,p-c));return{center:f,radius:m,minY:s,maxY:u}}function wi(e,t,n,r,o,i){let a=1/0,s=1/0,c=-1/0,l=-1/0;for(let v=0;v<e.count;v++){let C=v*3,S=e.iPosition[C],A=e.iPosition[C+2];S<a&&(a=S),S>c&&(c=S),A<s&&(s=A),A>l&&(l=A)}for(let v of t)a=Math.min(a,v.cx-v.halfX),c=Math.max(c,v.cx+v.halfX),s=Math.min(s,v.cz-v.halfZ),l=Math.max(l,v.cz+v.halfZ);let u=n.minX*N,p=n.maxX*N,d=n.minY*N,f=n.maxY*N,m=u,h=p,y=d,b=f;if(Number.isFinite(a)){let v=Math.max(2,.06*Math.hypot(c-a,l-s));m=Math.max(u,a-v),h=Math.min(p,c+v),y=Math.max(d,s-v),b=Math.min(f,l+v)}let g=Math.min(0,r),x=Math.max(o,i*.05);return{min:[m,g,y],max:[h,x,b]}}var xl=/^data:image\/(?:png|jpe?g|webp|gif|avif);base64,[a-z0-9+/]+={0,2}$/i,vl=/[\s"'<>`\\]/;function Sl(e){if(typeof e!="string"||!e||e.length>2e6||e!==e.trim())return!1;if(e.startsWith("data:"))return xl.test(e);if(vl.test(e))return!1;try{let t=new URL(e);return t.protocol==="https:"&&!t.username&&!t.password}catch{return!1}}function Pi(e){let t=e.trim();return Sl(t)?t:null}var uo="seatlayer.event-configuration/1";var ht=100,Ml=120,wl=1e5,Pl=1e4,Cl=/^[a-f0-9]{64}$/,Al=new Set(["stage","screen","barrier","camera_platform","sound_desk","rigging_truss"]);function Ot(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function it(e,t){return typeof e=="string"&&e.length>=1&&e.length<=t&&e.normalize("NFKC").trim()===e}function Il(e){return typeof e=="number"&&Number.isInteger(e)&&e>0}function Ci(e){return!Array.isArray(e)||e.length>wl||!e.every(t=>it(t,ht))?null:[...new Set(e)].sort()}function Rl(e){return!Ot(e)||!it(e.chartId,ht)||!it(e.version,ht)||e.sha256!==void 0&&(typeof e.sha256!="string"||!Cl.test(e.sha256))?null:{chartId:e.chartId,version:e.version,...typeof e.sha256=="string"?{sha256:e.sha256}:{}}}function mo(e,t,n){return typeof e=="number"&&Number.isFinite(e)&&e>=t&&e<=n}function El(e){return Ot(e)?e.mode==="none"||e.mode==="opaque"?e.opacity===void 0?{mode:e.mode}:null:e.mode==="partial"&&mo(e.opacity,.01,.99)?{mode:"partial",opacity:e.opacity}:null:null}function Tl(e,t){if(e===void 0)return;if(!Array.isArray(e)||e.length>Pl)return null;let n=new Set(t),r=new Set,o=new Set,i=0,a=[];for(let s of e){if(!Ot(s)||!it(s.id,ht)||!it(s.objectId,ht)||!n.has(s.objectId)||!Al.has(String(s.kind))||!mo(s.heightM,.05,50)||s.baseElevationM!==void 0&&!mo(s.baseElevationM,-10,100))return null;let c=El(s.occlusion);if(!c||r.has(s.id)||o.has(s.objectId))return null;let l=s.contentImageUrl===void 0?void 0:typeof s.contentImageUrl=="string"?Pi(s.contentImageUrl):null;if(s.contentImageUrl!==void 0&&(!l||s.kind!=="screen"||++i>1))return null;r.add(s.id),o.add(s.objectId),a.push({id:s.id,objectId:s.objectId,kind:s.kind,heightM:s.heightM,...s.baseElevationM!==void 0?{baseElevationM:s.baseElevationM}:{},occlusion:c,...l?{contentImageUrl:l}:{}})}return a.sort((s,c)=>s.id.localeCompare(c.id))}function kl(e){let t=[];if(!Ot(e))return{issues:[{code:"invalid_export",path:"configuration",message:"Configuration must be an object"}]};e.schema!==uo&&t.push({code:"unsupported_schema",path:"configuration.schema",message:`Configuration schema must be ${uo}`}),it(e.id,ht)||t.push({code:"invalid_id",path:"configuration.id",message:"Configuration id must contain 1 to 100 normalized characters"}),it(e.label,Ml)||t.push({code:"invalid_label",path:"configuration.label",message:"Configuration label must contain 1 to 120 normalized characters"}),Il(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=Ot(e.overlay)?e.overlay:null,o=Ci(r?.objectIds),i=Ci(r?.productionKillSeatIds),a=o?Tl(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:uo,id:e.id,label:e.label,version:e.version,baseVenue:n,overlay:{objectIds:o,productionKillSeatIds:i,...a!==void 0?{productionElements:a}:{}}}}}function Ai(e){let t=kl(e);return t.value?{ok:!0,value:t.value}:{ok:!1,issues:t.issues}}function Ii(e,t,n){let r=()=>({byObjectId:new Map,elements:[]});if(!t||!e)return r();let o=Ai(t);if(!o.ok||o.value.id!==e)return r();let i=new Map;for(let p of n)for(let d of p.objects)d.type==="shape"&&i.set(d.id,{shape:d,unit:p});let a=new Set,s=new Set,c=new Map((t.overlay.productionElements??[]).map(p=>{let d=p.runtimeContentImageUrl;return[p.id,typeof d=="string"&&/^(?:blob:|data:image\/|https:\/\/)/.test(d)?d:void 0]})),l=[];for(let p of o.value.overlay.productionElements??[]){let d=i.get(p.objectId),f=d?ot(d.shape):null,m=p.baseElevationM??0;if(!d||!f||f.length<3||!p.id||a.has(p.id)||s.has(p.objectId)||!Number.isFinite(p.heightM)||p.heightM<.05||p.heightM>50||!Number.isFinite(m)||m<-10||m>100)return r();a.add(p.id),s.add(p.objectId);let h=f.map(L=>L.x*N),y=f.map(L=>L.y*N),b=d.unit.baseHeightM+m,g=Math.min(...h),x=Math.max(...h),v=Math.min(...y),C=Math.max(...y),S,A=c.get(p.id)??p.contentImageUrl;if(p.kind==="screen"&&A)if(x-g>=C-v){let L=Math.abs(v-d.unit.focal.y*N)<=Math.abs(C-d.unit.focal.y*N)?v-.006:C+.006;S=[[g,b,L],[x,b,L],[g,b+p.heightM,L],[x,b+p.heightM,L]]}else{let L=Math.abs(g-d.unit.focal.x*N)<=Math.abs(x-d.unit.focal.x*N)?g-.006:x+.006;S=[[L,b,v],[L,b,C],[L,b+p.heightM,v],[L,b+p.heightM,C]]}l.push({id:p.id,objectId:p.objectId,kind:p.kind,floorIndex:d.unit.index,baseY:b,topY:b+p.heightM,bounds:{min:[g,b,v],max:[x,b+p.heightM,C]},occlusion:p.occlusion,...A?{contentImageUrl:A}:{},...S?{contentPlane:S}:{}})}let u=l.sort((p,d)=>p.id.localeCompare(d.id));return{byObjectId:new Map(u.map(p=>[p.objectId,p])),elements:u}}function ye(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function be(e){return Array.isArray(e)?e:[]}function Ll(e){let t=[e];for(;t.length;){let n=t.pop();if(Array.isArray(n)){t.push(...n);continue}if(!ye(n))continue;let r=ye(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 fn(e,t){return!Array.isArray(e)||e.length!==t||!e.every(n=>typeof n=="number"&&Number.isFinite(n))?null:e}function _l(){return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}function Fl(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 Dl(e){let t=fn(e.matrix,16);if(t)return t;if(e.matrix!==void 0)return null;let n=e.translation===void 0?[0,0,0]:fn(e.translation,3),r=e.rotation===void 0?[0,0,0,1]:fn(e.rotation,4),o=e.scale===void 0?[1,1,1]:fn(e.scale,3);if(!n||!r||!o)return null;let[i,a,s,c]=r,l=Math.hypot(i,a,s,c);if(!(l>1e-8))return null;let u=i/l,p=a/l,d=s/l,f=c/l,m=u+u,h=p+p,y=d+d,b=u*m,g=u*h,x=u*y,v=p*h,C=p*y,S=d*y,A=f*m,L=f*h,O=f*y;return[(1-(v+S))*o[0],(g+O)*o[0],(x-L)*o[0],0,(g-O)*o[1],(1-(b+S))*o[1],(C+A)*o[1],0,(x+L)*o[2],(C-A)*o[2],(1-(b+v))*o[2],0,n[0],n[1],n[2],1]}function Ol(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 Vl(e){let t=e[0],n=e[4],r=e[8],o=e[1],i=e[5],a=e[9],s=e[2],c=e[6],l=e[10],u=i*l-a*c,p=a*s-o*l,d=o*c-i*s,f=t*u+n*p+r*d;if(Math.abs(f)<1e-12)return null;let m=1/f;return[u*m,p*m,d*m,(r*c-n*l)*m,(t*l-r*s)*m,(n*s-t*c)*m,(n*a-r*i)*m,(r*o-t*a)*m,(t*i-n*o)*m]}function Ri(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 Bl(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(!ye(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 Nl(e){return e===5120||e===5121?1:e===5122||e===5123?2:e===5125||e===5126?4:0}function Gl(e){return e==="SCALAR"?1:e==="VEC2"?2:e==="VEC3"?3:e==="VEC4"?4:0}function zl(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 Ul(e){let t=e instanceof Uint8Array?e:new Uint8Array(e),n=Bl(t);if(!n)return{ok:!1,issue:"invalid_glb"};let{json:r,bin:o}=n;if(!ye(r.asset)||r.asset.version!=="2.0")return{ok:!1,issue:"unsupported_glb"};let i=be(r.extensionsUsed).filter(v=>typeof v=="string");if(i.includes("KHR_draco_mesh_compression")||Ll(r))return{ok:!1,issue:"draco_not_allowed"};if(i.length||be(r.extensionsRequired).length)return{ok:!1,issue:"unsupported_glb"};if(be(r.images).length||be(r.textures).length)return{ok:!1,issue:"external_resource"};let a=be(r.buffers);if(a.length!==1||!ye(a[0])||a[0].uri!==void 0||typeof a[0].byteLength!="number"||!Number.isInteger(a[0].byteLength)||a[0].byteLength<0||a[0].byteLength>o.byteLength)return{ok:!1,issue:"external_resource"};let s=be(r.accessors),c=be(r.bufferViews),l=be(r.meshes),u=be(r.nodes),p=be(r.scenes),d=typeof r.scene=="number"?r.scene:0;if(!ye(p[d]))return{ok:!1,issue:"unsupported_glb"};let f=new DataView(o.buffer,o.byteOffset,o.byteLength),m=(v,C,S)=>{if(typeof v!="number"||!Number.isInteger(v)||!ye(s[v]))return null;let A=s[v];if(A.type!==C||A.sparse!==void 0||A.normalized===!0||typeof A.count!="number"||!Number.isInteger(A.count)||A.count<1||typeof A.componentType!="number"||!S.includes(A.componentType)||typeof A.bufferView!="number")return null;let L=c[A.bufferView];if(!ye(L)||L.buffer!==0||typeof L.byteLength!="number"||!Number.isInteger(L.byteLength)||L.byteLength<0)return null;let O=Gl(A.type),z=Nl(A.componentType),B=typeof L.byteStride=="number"?L.byteStride:O*z,T=typeof L.byteOffset=="number"?L.byteOffset:0,w=typeof A.byteOffset=="number"?A.byteOffset:0,R=T+w,P=w+(A.count-1)*B+O*z;if(!Number.isInteger(B)||!Number.isInteger(T)||!Number.isInteger(w)||B<O*z||T<0||w<0||T+L.byteLength>o.byteLength||P>L.byteLength)return null;let I=[];for(let G=0;G<A.count;G++){let k=[];for(let M=0;M<O;M++){let E=zl(f,R+G*B+M*z,A.componentType);if(!Number.isFinite(E))return null;k.push(E)}I.push(k)}return I},h=[],y=[],b=0,g=new Set,x=(v,C)=>{if(typeof v!="number"||!Number.isInteger(v)||!ye(u[v])||g.has(v))return!1;g.add(v);let S=u[v],A=Dl(S);if(!A)return!1;let L=Fl(C,A),O=Vl(L);if(!O)return!1;if(S.mesh!==void 0){if(typeof S.mesh!="number")return!1;let z=l[S.mesh];if(!ye(z))return!1;for(let B of be(z.primitives)){if(!ye(B)||B.mode!==void 0&&B.mode!==4||!ye(B.attributes))return!1;let T=m(B.attributes.POSITION,"VEC3",[5126]),w=B.attributes.NORMAL===void 0?null:m(B.attributes.NORMAL,"VEC3",[5126]);if(!T||B.attributes.NORMAL!==void 0&&!w)return!1;let R=T.length;if(B.indices!==void 0){let I=typeof B.indices=="number"?s[B.indices]:null;R=ye(I)?I.count:void 0}if(typeof R!="number"||!Number.isInteger(R)||R%3!==0||(b+=R/3,b>1e5))return!1;let P=B.indices===void 0?T.map((I,G)=>[G]):m(B.indices,"SCALAR",[5121,5123,5125]);if(!P||P.length%3!==0||P.length!==R)return!1;for(let I=0;I<P.length;I+=3){let G=[P[I][0],P[I+1][0],P[I+2][0]];if(G.some(E=>!Number.isInteger(E)||E<0||E>=T.length))return!1;let k=G.map(E=>Ol(L,...T[E])),M=null;if(!w){let E=k[1][0]-k[0][0],D=k[1][1]-k[0][1],V=k[1][2]-k[0][2],H=k[2][0]-k[0][0],j=k[2][1]-k[0][1],_=k[2][2]-k[0][2];M=Ri([1,0,0,0,1,0,0,0,1],D*_-V*j,V*H-E*_,E*j-D*H)}for(let E=0;E<3;E++)h.push(...k[E]),y.push(...w?Ri(O,...w[G[E]]):M)}}}for(let z of be(S.children))if(!x(z,L))return!1;return g.delete(v),!0};for(let v of be(p[d].nodes))if(!x(v,_l()))return{ok:!1,issue:b>1e5?"triangle_limit":"unsupported_glb"};return!b||h.length!==b*9||y.length!==h.length?{ok:!1,issue:"unsupported_glb"}:{ok:!0,triangleCount:b,position:new Float32Array(h),normal:new Float32Array(y)}}function Ei(e){try{return Ul(e)}catch{return{ok:!1,issue:"invalid_glb"}}}function bt(e){let{doc:t}=e,n=sr(t.theme),r=n.structure,o=Nr(t,e.eventConfigurationId??t.eventConfigurationId),i=Ii(e.eventConfigurationId,e.eventConfiguration,o),a=e.seats,s=new en,c=null;if(e.registeredShellGlb){let P=Ei(e.registeredShellGlb);if(P.ok){let I=P.position.length/3,G=new Float32Array(P.position.length),k=n.materials.shell??r.tierWall;for(let M=0;M<I;M++){let E=P.normal[M*3+1],D=E<-.25?.4:.62+.38*Math.max(0,E);G[M*3]=k[0]*D,G[M*3+1]=k[1]*D,G[M*3+2]=k[2]*D}c={position:P.position,normal:P.normal,color:G,floor:new Float32Array(I).fill(-2),material:new Float32Array(I),count:I}}}let l=new Map;for(let P of o)for(let I of P.objects)l.set(I.id,P.index),I.type==="section"&&l.set(I.logicalSectionId??I.id,P.index);let u=a.map(P=>l.get(P.sectionId??"")??l.get(P.rowId??"")??0),p=lo(o,a);Si(s,o,a,u,p,r);let d=jr(t,a),f=new Map,m=new Map;for(let P of t.categories??[])f.set(P.key,P.color),P.seatGlyph&&m.set(P.key,P.seatGlyph);let h=[],y=Hr(o,a,u),b=new Float32Array(a.length);for(let P=0;P<o.length;P++){let I=o[P];s.setFloor(P);let G=new un,k=[],M=I.objects.filter(E=>E.type==="section"&&!!E.outline&&E.outline.length>=3);for(let E of I.objects)if(E.type==="section")ai(s,E,I,Xr(E,d),y.bySection.get(E.id),G,M,r);else if(E.type==="shape"){let D=i.byObjectId.get(E.id);s.setMaterial((D?.kind??E.role)==="screen"?1:0),Jr(s,E,I.baseHeightM,Kr(E,k),r,I.focal,h,D),s.setMaterial(0)}else E.type==="gaArea"?ti(s,E,I.baseHeightM,ee(f.get(E.categoryKey)),r):E.type==="booth"?$r(s,E,I.baseHeightM,ee(f.get(E.categoryKey)),r):E.type==="table"?Zr(s,E,I.baseHeightM,ee(f.get(E.categoryKey)),r):E.type==="decorImage"&&ei(s,E,I.baseHeightM,r);si(s,I,a,y,r,n.materials.shell,!c)}let g=o.length>1?{x:o.reduce((P,I)=>P+I.focal.x,0)/o.length,y:o.reduce((P,I)=>P+I.focal.y,0)/o.length}:t.focalPoint??{x:(p.minX+p.maxX)/2,y:(p.minY+p.maxY)/2},x=er(c?[s.build(),c]:[s.build()]),v=ir(a,e.initialState,y,b,f,m),C=yi({doc:t,units:o,seats:a,surfaces:y,focal:g}),{labels:S,sections:A,rows:L}=gi({doc:t,units:o,seats:a,surfaces:y,seatData:v,hintedSeatFloor:u,zones:C,focal:g}),O=vi({doc:t,units:o,seats:a,surfaces:y,solids:x,hintedSeatFloor:u,seatFloor:b});xi(S,O),v.iYaw=or(v.iPosition,a.length,P=>a[P].rowId,P=>{let I=o[b[P]]?.focal??g;return[I.x*N,I.y*N]});let z=(p.minX+p.maxX)/2*N,B=(p.minY+p.maxY)/2*N,T=.5*Math.hypot((p.maxX-p.minX)*N,(p.maxY-p.minY)*N)||10,w=Mi(x,v,{cx:z,cz:B,radius:T}),R=wi(v,h,p,w.minY,w.maxY,T);return{solids:x,seats:v,bounds:{center:[(R.min[0]+R.max[0])/2,(R.min[1]+R.max[1])/2,(R.min[2]+R.max[2])/2],radius:T,groundY:0,box:R},renderBounds:{center:w.center,radius:w.radius},stateColorLUT:cr(n,Ae),theme:n,seatCount:a.length,focalWorld:[g.x*N,1.5,g.y*N],zones:C,stages:h,productionElements:i.elements,sections:A,rows:L,labels:S,floors:O}}var Hl=88,jl=20,fo={floor:{size:14,weight:"700",opacity:.98},zone:{size:15,weight:"600",opacity:.95},section:{size:12,weight:"500",opacity:.88},ga:{size:12,weight:"500",opacity:.88},booth:{size:11,weight:"500",opacity:.85},annotation:{size:11,weight:"400",opacity:.75},row:{size:10.5,weight:"600",opacity:.8},seat:{size:9.5,weight:"500",opacity:.72}},Vt=new Set(["row","seat"]),Ti={floor:5,zone:4,section:3,ga:3,booth:2,annotation:1},pn={row:{x:62,y:16},seat:{x:46,y:18}},ki=ee,po=e=>ko(e);function Li(e,t){let n=po(e),r=po(t);return(Math.max(n,r)+.05)/(Math.min(n,r)+.05)}function ho(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 Xl(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?ho(i,t):t,s=ki(e),c=n?7:4.5,l=s&&Li(s,a)>=c?e:o;return r?{ink:l,backing:i,border:"rgba(210,222,245,.24)"}:{ink:l,backing:i,border:"rgba(11,18,32,.22)"}}var hn=class{constructor(t,n={}){this.nodes=new Map;this.labels=[];this.forcedDense=!1;this.selectedSeatLabelIds=new Set;this.opts=n,this.root=document.createElement("div"),this.root.setAttribute("data-view3d-labels","");let r=this.root.style;r.position="absolute",r.inset="0",r.pointerEvents="none",r.overflow="hidden",n.fontFamily&&(r.fontFamily=n.fontFamily),t.appendChild(this.root)}setVisible(t){this.root.style.visibility=t?"":"hidden"}setLabels(t){this.labels=t;for(let[n,r]of this.nodes)t.some(o=>o.id===n)||(r.remove(),this.nodes.delete(n))}setForcedDense(t){this.forcedDense=t}setSelectedSeatIds(t){this.selectedSeatLabelIds=new Set(Array.from(t,n=>`seat:${n}`))}qualityEvidence(){let t=this.root.getBoundingClientRect(),n=this.root.style.visibility!=="hidden";return this.labels.map(r=>{let o=this.nodes.get(r.id),i=o?.getBoundingClientRect(),a=!!(n&&o&&o.style.display!=="none"&&i&&i.width>0&&i.height>0);return{id:r.id,kind:r.kind,text:r.text,visible:a,renderedFontPx:o&&Number.parseFloat(o.style.fontSize)||0,contrast:o?Number(o.dataset.qualityContrast??0):0,...a&&i?{screenBox:{x:i.x-t.x,y:i.y-t.y,width:i.width,height:i.height}}:{}}})}update(t,n,r,o,i,a){if(!this.labels.length)return;let s=ui(o,i,{hasZoneLabels:this.labels.some(x=>x.kind==="zone")});this.forcedDense&&(s.add("row"),s.add("seat"));let c=[];for(let x of this.labels){if(!s.has(x.kind))continue;let v=Ye(t,x.anchor,n,r);if(!v.visible)continue;let C=fi(x.text,fo[x.kind].size,!Vt.has(x.kind)),S=!Vt.has(x.kind),A=di(v,C/2,fo[x.kind].size/2+(S?4:1),n,r),L=a?Math.hypot(x.anchor[0]-a[0],x.anchor[1]-a[1],x.anchor[2]-a[2]):1;c.push({label:x,screen:A,focus:hi(A,L,n,r),halfWidth:C/2,...this.selectedSeatLabelIds.has(x.id)?{priority:1}:{}})}let l=li(c.filter(x=>x.label.kind==="floor"),n),u=[...c.filter(x=>!Vt.has(x.label.kind)&&x.label.kind!=="floor"),...l],p=mi(u,Hl,jl),d=pi(n),f=co(c.filter(x=>x.label.kind==="row"),pn.row.x,pn.row.y,d.row,p),m=co(c.filter(x=>x.label.kind==="seat"),pn.seat.x,pn.seat.y,d.seat,[...p,...f]),h=[...p,...f,...m],y=new Set(h.map(x=>x.label.id));for(let{label:x,screen:v}of h){let S=this.nodeFor(x).style;S.display="",S.transform=`translate(-50%, -50%) translate(${v.x.toFixed(1)}px, ${v.y.toFixed(1)}px)`}let b=h.filter(({label:x})=>!Vt.has(x.kind)).sort((x,v)=>Ti[v.label.kind]-Ti[x.label.kind]||x.screen.depth-v.screen.depth||x.focus-v.focus),g=[];for(let{label:x}of b){let v=this.nodes.get(x.id);if(!v||v.style.display==="none")continue;let C=v.getBoundingClientRect();g.some(A=>C.left<A.right+3&&C.right+3>A.left&&C.top<A.bottom+3&&C.bottom+3>A.top)?v.style.display="none":g.push(C)}for(let[x,v]of this.nodes)y.has(x)||(v.style.display="none")}nodeFor(t){let n=this.nodes.get(t.id);if(!n){n=document.createElement("div");let p=n.style;p.position="absolute",p.left="0",p.top="0",p.whiteSpace="nowrap",p.textShadow="0 1px 3px rgba(0,0,0,0.85), 0 0 8px rgba(0,0,0,0.55)",p.display="none",this.root.appendChild(n),this.nodes.set(t.id,n)}n.textContent=t.text,n.setAttribute("data-label-kind",t.kind);let r=this.selectedSeatLabelIds.has(t.id);n.toggleAttribute("data-selected-seat",r);let o=fo[t.kind],i=n.style;i.fontSize=`${o.size}px`,i.fontWeight=r?"800":o.weight,i.opacity=r?"1":String(o.opacity);let a=!Vt.has(t.kind),s=Xl(t.color??this.opts.ink,this.opts.backgroundRgb,a);i.color=r?"#ecf8ff":s.ink,i.background=r?"rgba(10,28,45,.9)":a?s.backing:"",i.border=r?"1px solid rgba(89,199,255,.92)":a?`1px solid ${s.border}`:"",i.borderRadius=r||a?"999px":"",i.padding=r||a?"3px 7px":"",i.boxShadow=r?"0 0 0 2px rgba(41,176,255,.18), 0 5px 14px rgba(0,0,0,.35)":a?"0 3px 10px rgba(0,0,0,.24)":"",i.letterSpacing=t.kind==="zone"||t.kind==="floor"?"0.08em":"0.02em";let c=this.opts.backgroundRgb??[.04,.06,.1],l=ki(r?"#ecf8ff":s.ink)??[1,1,1],u=r?ho("rgba(10,28,45,.9)",c):a?ho(s.backing,c):c;return n.dataset.qualityContrast=Li(l,u).toFixed(3),(t.kind==="zone"||t.kind==="floor")&&(i.textTransform="uppercase"),n}dispose(){this.root.remove(),this.nodes.clear()}};var Fi=1;var Yl=new Set(["floor","zone","section","ga","booth","annotation"]);function Wl(e){return e.every(t=>Number.isFinite(t))}function Kl(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 _i(e){return e.length?Math.round(Math.min(...e)*100)/100:null}function at(e){return Math.round(e*1e4)/1e4}function ql(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 bn(e){let t=e.labels.filter(s=>s.visible&&s.screenBox),n=t.filter(s=>Yl.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)Kl(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",Wl(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:l})=>({id:s,kind:c,text:l})).sort((s,c)=>s.kind.localeCompare(c.kind)||s.id.localeCompare(c.id)),framing:ql(e.framing)},metrics:{minimumHierarchyFontPx:_i(n.map(s=>s.renderedFontPx)),minimumHierarchyContrast:_i(n.map(s=>s.contrast)),projectedReliefPx:Math.round(e.scene.projectedReliefPx*100)/100},findings:a}}var se=require("ogl");var We=require("ogl");var yn=`
20
+ }`});async function qa(e,t,n,r={}){let o=r.fadeMs??400,i=t?.initialBearingDeg??0,a=Math.max(-ke,Math.min(ke,t?.initialPitchDeg??0)),s=Tn,c=!1,u=new AbortController,d=()=>u.abort();r.signal?.addEventListener("abort",d,{once:!0});let p=()=>{},m=[n.camera.position.x,n.camera.position.y,n.camera.position.z];if(!t&&n.cameraOriginWorld&&n.camera.position.set(n.cameraOriginWorld[0],n.cameraOriginWorld[1],n.cameraOriginWorld[2]),!t&&n.focalWorld){let I=n.camera.position,O=n.focalWorld[0]-I.x,j=n.focalWorld[1]-I.y,U=n.focalWorld[2]-I.z,N=Math.hypot(O,U);N>.001&&(i=Math.atan2(O,-U)*180/Math.PI,a=Math.max(-ke,Math.min(ke,Math.atan2(j,N)*180/Math.PI)))}let l=null;if(t){let I=n.gl.getParameter(n.gl.MAX_TEXTURE_SIZE),O=Rn(t,An(I)),j;try{let U=t.resolveUrl?await t.resolveUrl(O.initialUrl):O.initialUrl;if(!U)throw new Error("panorama_asset_unavailable");j=await Ht(U,u.signal)}catch{return r.signal?.removeEventListener("abort",d),null}try{l=Xa(n.gl,j)}catch{return u.abort(),r.signal?.removeEventListener("abort",d),null}l.mesh.renderOrder=999,l.mesh.setParent(n.scene),O.upgradeUrl&&(p=In(()=>{(t.resolveUrl?t.resolveUrl(O.upgradeUrl):Promise.resolve(O.upgradeUrl)).then(N=>!N||u.signal.aborted?null:Ht(N,u.signal)).then(N=>{N&&(c||u.signal.aborted||(l?.setImage(N),n.requestRender()))}).catch(()=>{})}))}let f=n.camera.fov;n.camera.perspective({fov:s,aspect:n.camera.aspect});let h=n.camera.quaternion.slice(),y=()=>{let I=n.camera.position;l?.mesh.position.set(I.x,I.y,I.z);let[O,j,U]=Ya(i,a);n.camera.lookAt([I.x+O,I.y+j,I.z+U]),n.requestRender()};y();let b=document.createElement("div"),x=document.activeElement instanceof HTMLElement?document.activeElement:null;b.setAttribute("role","dialog"),b.setAttribute("aria-modal","true"),b.setAttribute("aria-label",r.seatLabel?`View from ${r.seatLabel}`:"View from seat"),b.tabIndex=-1,Object.assign(b.style,{position:"absolute",inset:"0",zIndex:"10",cursor:"grab",touchAction:"none"});let g=document.createElement("button");if(g.type="button",g.setAttribute("aria-label","Close"),g.textContent="\u2715",Object.assign(g.style,{position:"absolute",top:"12px",right:"12px",zIndex:"2",width:"44px",height:"44px",borderRadius:"999px",cursor:"pointer",border:"1px solid rgba(255,255,255,0.25)",background:"rgba(8,12,18,0.6)",color:"#e6edf3",fontSize:"15px",lineHeight:"1"}),b.appendChild(g),r.disclosure){let I=document.createElement("div");I.textContent=`${r.disclosurePrefix??"360\xB0 panorama"} \xB7 ${r.disclosure}`,Object.assign(I.style,{position:"absolute",top:"calc(12px + var(--sl-3d-top-inset, 0px))",left:"12px",zIndex:"2",maxWidth:"calc(100% - 88px)",padding:"8px 11px",borderRadius:"999px",overflow:"hidden",color:"#dce6f8",background:"rgba(8,12,18,0.68)",font:"600 11px/1.2 ui-sans-serif, system-ui, sans-serif",textOverflow:"ellipsis",whiteSpace:"nowrap",pointerEvents:"none",backdropFilter:"blur(6px)"}),b.appendChild(I)}let v=document.createElement("div");v.textContent=To(r.lookAroundHint),Object.assign(v.style,{position:"absolute",bottom:"12px",left:"0",right:"0",textAlign:"center",color:"rgba(230,237,243,0.7)",font:"12px ui-sans-serif, system-ui, sans-serif",pointerEvents:"none"}),b.appendChild(v),e.appendChild(b),g.focus({preventScroll:!0});let P=!1,S=0,C=0,T=0,B=new Map,z=()=>{let[I,O]=[...B.values()];return I&&O?Math.hypot(I.x-O.x,I.y-O.y):0},D=I=>{let O=Eo(I);O!==s&&(s=O,n.camera.perspective({fov:s,aspect:n.camera.aspect}),y())},k=I=>{I.target!==g&&(B.set(I.pointerId,{x:I.clientX,y:I.clientY}),P=B.size===1,S=I.clientX,C=I.clientY,B.size===2&&(T=z()),b.setPointerCapture?.(I.pointerId),b.style.cursor="grabbing")},A=I=>{if(B.has(I.pointerId)){if(B.set(I.pointerId,{x:I.clientX,y:I.clientY}),B.size>=2){let O=z();T>0&&O>0&&D(s*(T/O)),T=O,P=!1;return}P&&(i+=(I.clientX-S)*Ka,a=Math.max(-ke,Math.min(ke,a+(I.clientY-C)*Ka)),S=I.clientX,C=I.clientY,y())}},_=I=>{B.delete(I.pointerId),T=B.size===2?z():0;let O=B.values().next().value;P=B.size===1,O?(S=O.x,C=O.y):b.style.cursor="grab";try{b.releasePointerCapture?.(I.pointerId)}catch{}},V=I=>{I.preventDefault(),D(s+I.deltaY*.04)};b.addEventListener("pointerdown",k),b.addEventListener("pointermove",A),b.addEventListener("pointerup",_),b.addEventListener("pointercancel",_),b.addEventListener("wheel",V,{passive:!1});let M=I=>{if(!c){if(I.key==="Tab"){I.preventDefault(),g.focus({preventScroll:!0});return}if(I.key==="Escape"){I.stopPropagation(),L.close();return}if(I.key==="ArrowLeft"||I.key==="ArrowRight")i+=I.key==="ArrowLeft"?-4:4;else if(I.key==="ArrowUp"||I.key==="ArrowDown")a=Math.max(-ke,Math.min(ke,a+(I.key==="ArrowUp"?4:-4)));else if(I.key==="+"||I.key==="="){D(s-5),I.preventDefault();return}else if(I.key==="-"){D(s+5),I.preventDefault();return}else return;I.preventDefault(),y()}};window.addEventListener("keydown",M);let R=0,E=(I,O)=>{if(!l){O?.();return}let j=I===1?0:1,U=performance.now(),N=()=>{if(c)return;let F=o<=0?1:Math.min(1,(performance.now()-U)/o);l?.setOpacity(j+(I-j)*F),n.requestRender(),F<1?R=requestAnimationFrame(N):O?.()};R=requestAnimationFrame(N)};E(1);let w=()=>{c||(c=!0,p(),u.abort(),r.signal?.removeEventListener("abort",d),cancelAnimationFrame(R),b.removeEventListener("pointerdown",k),b.removeEventListener("pointermove",A),b.removeEventListener("pointerup",_),b.removeEventListener("pointercancel",_),b.removeEventListener("wheel",V),window.removeEventListener("keydown",M),b.remove(),x?.isConnected&&x.focus({preventScroll:!0}),l?.dispose(),n.camera.position.set(m[0],m[1],m[2]),n.camera.perspective({fov:f,aspect:n.camera.aspect}),n.camera.quaternion.set(h[0],h[1],h[2],h[3]),n.requestRender())},L={close(){if(c)return;let I=()=>{w(),r.onClose?.()};cancelAnimationFrame(R),E(0,I)},dispose:w};return g.addEventListener("click",()=>L.close()),L}var Ka,Qa=Ct(()=>{"use strict";Wa();_n();_n();Io();Ka=.15});var Za={};Oo(Za,{createOpenPanorama:()=>Nd});function Nd(e){let{container:t,model:n,opts:r,analytics:o,orbit:i,loop:a,seatsById:s,ensureSeatView:c,resolvedSeatViewPose:u,gpu:d,gl:p,isContextLost:m,isDisposed:l,flightGen:f,setPanorama:h,getLoadAbort:y,setLoadAbort:b,setPanoramaSphereVisible:x,setFrozen:g,raisePanoramaLayer:v,restorePanoramaLayer:P,getOverviewChip:S,labelOverlay:C,reducedMotion:T,removeArriveChip:B,showArriveChip:z}=e;return async(D,k,A)=>{y()?.abort();let _=new AbortController;b(_);let V=n.seats.idToIndex.get(D);if(V===void 0){i.syncFromCamera();return}let M=s.get(D)?.label??D,R=u(D,V),E=c(D);if(!E){_.abort(),y()===_&&b(null),i.syncFromCamera();return}g(!0),a.stop();let w;try{w=await E}catch{if(y()===_&&b(null),o.panoramaFailed(D,"source"),!l()&&A===f()){g(!1),i.resumeAfterFlight(R.focal),a.requestRender();let K=z(D,A,!0);requestAnimationFrame(()=>K?.querySelector("[data-panorama-trigger]")?.focus())}return}if(l()||A!==f()){_.abort(),y()===_&&b(null);return}B();let L=S(),I=()=>{_.abort(),y()===_&&b(null),h(null),x(!1),P(),L.style.display="",C.setVisible(!r.arriveAtSeatEye),g(!1),o.panoramaClosed(),i.resumeAfterFlight(R.focal),a.requestRender();let K=z(D,f());requestAnimationFrame(()=>K?.querySelector("[data-panorama-trigger]")?.focus())},O=w.generated===!0,j=Ua(w);v(),x(!O),L.style.display="none";let U=T()?0:k,N=d(),F=N&&!m()?await qa(t,O?null:w,{gl:p,scene:N.main,camera:i.camera,requestRender:()=>a.requestRender(),cameraOriginWorld:O?R.eye:void 0,focalWorld:R.focal},{fadeMs:U,seatLabel:M,disclosure:j,disclosurePrefix:O?"Live seat-eye view":"360\xB0 panorama",lookAroundHint:r.lookAroundHint,onClose:I,signal:_.signal}):null;if(l()||A!==f()){_.abort(),x(!1),y()===_&&b(null),F?.dispose(),L.style.display="",P();return}if(F)i.syncFromCamera(),C.setVisible(!1),g(!1),a.requestRender(),h(F);else if(O){P(),L.style.display="",g(!1),i.resumeAfterFlight(R.focal),a.requestRender(),h(null),x(!1),o.panoramaFailed(D,"mount");let K=z(D,f(),!0);requestAnimationFrame(()=>K?.querySelector("[data-panorama-trigger]")?.focus()),y()===_&&b(null);return}else x(!1),o.panoramaFallback(D),h(ja(t,w,{fadeMs:U,seatLabel:M,disclosure:j,onClose:I,signal:_.signal,lookAroundHint:r.lookAroundHint}));o.panoramaOpened()}}var $a=Ct(()=>{"use strict";_n();Qa()});var Xd={};Oo(Xd,{VENUE3D_QUALITY_REPORT_VERSION:()=>qi,buildSceneModel:()=>gt,inspectVenue3DQualityEvidence:()=>xn,mountVenue3D:()=>Yd,prepareVenue3D:()=>ls,prepareVenue3DFromChart:()=>us});module.exports=ws(Xd);var zo=require("ogl");var Ps=/^#?([\da-f]{3}|[\da-f]{6})$/i;function Cs(e){let t=Ps.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=Cs(e);return t?[t[0]/255,t[1]/255,t[2]/255]:null}function Nn(e){let t=e/255;return t<=.04045?t/12.92:((t+.055)/1.055)**2.4}function As(e){return .2126*Nn(e[0])+.7152*Nn(e[1])+.0722*Nn(e[2])}function Bo(e){return As([e[0]*255,e[1]*255,e[2]*255])}function Rs(e){return .2126*e[0]+.7152*e[1]+.0722*e[2]}function ge(e,t,n){return[e[0]+(t[0]-e[0])*n,e[1]+(t[1]-e[1])*n,e[2]+(t[2]-e[2])*n]}function At(e,t){let n=Rs(e);return ge(e,[n,n,n],t)}var fe=["available","held","sold","selected","dimmed"];function Rt(e){let t=fe.indexOf(e);return t<0?0:t}var No={available:[.24,.82,.52],held:[.95,.66,.22],sold:[.34,.39,.45],selected:[.24,.74,1],dimmed:[.28,.32,.37]};function Go(e){let t=.2126*e[0]+.7152*e[1]+.0722*e[2],n=.42,r=.62;return[(t+(e[0]-t)*n)*r,(t+(e[1]-t)*n)*r,(t+(e[2]-t)*n)*r]}var Gn={ground:[.07,.085,.11],tierTop:[.24,.28,.34],tierWall:[.17,.2,.25],stageTop:[.94,.7,.38],stageWall:[.48,.33,.18],decorTop:[.22,.25,.29],decorWall:[.15,.17,.2],gaTop:[.24,.28,.33],gaWall:[.16,.19,.23],boothTop:[.3,.33,.38],boothWall:[.2,.23,.27],tableTop:[.38,.34,.29],tableWall:[.24,.21,.18]},Je={top:[.05,.06,.08],bottom:[.1,.12,.15]};function Me(e,t){return[Math.min(1,e[0]*t),Math.min(1,e[1]*t),Math.min(1,e[2]*t)]}function Is(){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 zo.Renderer({canvas:this.canvas,dpr:Is(),alpha:!1,antialias:!1,depth:!0,stencil:!1,powerPreference:"high-performance",webgl:2}),this.gl=this.renderer.gl,this.clearRgb=[Je.top[0],Je.top[1],Je.top[2]],this.gl.clearColor(this.clearRgb[0],this.clearRgb[1],this.clearRgb[2],1),t.appendChild(this.canvas),this.lostHandler=r=>{r.preventDefault(),n.onContextLost()},this.restoredHandler=()=>n.onContextRestored(),this.canvas.addEventListener("webglcontextlost",this.lostHandler,!1),this.canvas.addEventListener("webglcontextrestored",this.restoredHandler,!1),this.resize()}setClearColor(t){this.clearRgb=[t[0],t[1],t[2]],this.gl.clearColor(t[0],t[1],t[2],1)}get clearColor(){return this.clearRgb}resize(){let t=Math.max(1,this.container.clientWidth||this.canvas.clientWidth||1),n=Math.max(1,this.container.clientHeight||this.canvas.clientHeight||1);return this.renderer.setSize(t,n),{width:t,height:n}}get pixelHeight(){return this.renderer.height*this.renderer.dpr}get aspect(){return this.renderer.width/Math.max(1,this.renderer.height)}dispose(){this.canvas.removeEventListener("webglcontextlost",this.lostHandler,!1),this.canvas.removeEventListener("webglcontextrestored",this.restoredHandler,!1);let t=this.gl.getExtension("WEBGL_lose_context");t&&t.loseContext(),this.canvas.parentNode&&this.canvas.parentNode.removeChild(this.canvas)}simulateContextLossCycle(){let t=this.gl.getExtension("WEBGL_lose_context");t&&(t.loseContext(),setTimeout(()=>{t.restoreContext&&t.restoreContext()},300))}};var dt=require("ogl"),pe=Math.PI/180,zn=15*pe,Hn=80*pe,ut=.12,Ho=35,Uo=1.25,Qt=class{constructor(t,n,r,o){this.fovY=Ho;this.target=new dt.Vec3;this.azimuth=-30*pe;this.polar=55*pe;this.distance=10;this.azT=-30*pe;this.polT=55*pe;this.distT=10;this.minDist=1;this.maxDist=100;this.gestureFired=!1;this.interactionEnabled=!0;this.dragging=!1;this.panning=!1;this.lastX=0;this.lastY=0;this.activePointers=new Map;this.pinchDist=0;this.pinchCx=0;this.pinchCy=0;this.targetT=new dt.Vec3;this.panAnchor=new dt.Vec3;this.panLimit=0;this.primaryDragMode="orbit";this.camera=new dt.Camera(t,{fov:Ho,near:.1,far:5e3,aspect:1}),this.canvas=n,this.requestRender=r,this.onGesture=o,this.onPointerDown=i=>{if(this.interactionEnabled){try{this.canvas.setPointerCapture?.(i.pointerId)}catch{}if(this.activePointers.set(i.pointerId,{x:i.clientX,y:i.clientY}),this.activePointers.size===1){let a=i.button===2||i.button===1,s=i.button===0&&(i.shiftKey?this.primaryDragMode==="orbit":this.primaryDragMode==="pan");this.panning=a||s,this.dragging=!this.panning,this.lastX=i.clientX,this.lastY=i.clientY}else if(this.activePointers.size===2){this.dragging=!1,this.panning=!1,this.pinchDist=this.currentPinchDistance();let a=this.pinchCentroid();this.pinchCx=a.x,this.pinchCy=a.y}}},this.onPointerMove=i=>{if(!this.interactionEnabled||!this.activePointers.has(i.pointerId))return;if(this.activePointers.set(i.pointerId,{x:i.clientX,y:i.clientY}),this.activePointers.size>=2){let c=this.currentPinchDistance();this.pinchDist>0&&(this.dollyBy(Math.exp((this.pinchDist-c)*.005)),this.fireGesture()),this.pinchDist=c;let u=this.pinchCentroid();this.panBy(u.x-this.pinchCx,u.y-this.pinchCy),this.pinchCx=u.x,this.pinchCy=u.y;return}let a=i.clientX-this.lastX,s=i.clientY-this.lastY;if(this.panning){this.lastX=i.clientX,this.lastY=i.clientY,(a!==0||s!==0)&&(this.panBy(a,s),this.fireGesture());return}this.dragging&&(this.lastX=i.clientX,this.lastY=i.clientY,(a!==0||s!==0)&&this.fireGesture(),this.azT-=a*.006,this.polT=Math.max(zn,Math.min(Hn,this.polT-s*.006)),this.requestRender())},this.onPointerUp=i=>{this.activePointers.delete(i.pointerId);try{this.canvas.releasePointerCapture?.(i.pointerId)}catch{}this.activePointers.size<2&&(this.pinchDist=0),this.activePointers.size===0&&(this.dragging=!1,this.panning=!1)},this.onContextMenu=i=>{i.preventDefault()},this.onWheel=i=>{if(i.preventDefault(),!this.interactionEnabled)return;let a=i.deltaMode===1?16:i.deltaMode===2?100:1,s=Math.max(-2,Math.min(2,i.deltaY*a/100));this.dollyBy(Math.exp(s*.22)),this.fireGesture()},this.onKeyDown=i=>{if(!this.interactionEnabled)return;let a=7*pe;if(i.shiftKey&&(i.key==="ArrowLeft"||i.key==="ArrowRight"||i.key==="ArrowUp"||i.key==="ArrowDown"))this.panBy(i.key==="ArrowLeft"?-32:i.key==="ArrowRight"?32:0,i.key==="ArrowUp"?-32:i.key==="ArrowDown"?32:0);else if(i.key==="ArrowLeft"||i.key==="ArrowRight")this.azT+=i.key==="ArrowLeft"?-a:a;else if(i.key==="ArrowUp"||i.key==="ArrowDown")this.polT=Math.max(zn,Math.min(Hn,this.polT+(i.key==="ArrowUp"?-a:a)));else if(i.key==="+"||i.key==="=")this.dollyBy(.82);else if(i.key==="-"||i.key==="_")this.dollyBy(1.22);else return;i.preventDefault(),this.fireGesture(),this.requestRender()},n.addEventListener("pointerdown",this.onPointerDown),n.addEventListener("pointermove",this.onPointerMove),n.addEventListener("pointerup",this.onPointerUp),n.addEventListener("pointercancel",this.onPointerUp),n.addEventListener("wheel",this.onWheel,{passive:!1}),n.addEventListener("keydown",this.onKeyDown),n.addEventListener("contextmenu",this.onContextMenu)}pinchCentroid(){let t=[...this.activePointers.values()];if(!t.length)return{x:0,y:0};let n=0,r=0;for(let o of t)n+=o.x,r+=o.y;return{x:n/t.length,y:r/t.length}}panBy(t,n){let r=this.canvas.clientHeight||1,o=2*this.distance*Math.tan(this.fovY*pe/2)/r,i=Math.sin(this.azimuth),a=Math.cos(this.azimuth),s=a,c=-i,u=Math.cos(this.polar),d=Math.sin(this.polar),p=-i*u,m=-a*u;this.targetT.x+=(-t*s+n*p)*o,this.targetT.z+=(-t*c+n*m)*o,this.targetT.y+=n*d*o,this.clampPan(),this.requestRender()}clampPan(){if(this.panLimit<=0)return;let t=this.panLimit,n=this.panAnchor.x,r=this.panAnchor.y,o=this.panAnchor.z;this.targetT.x=Math.max(n-t,Math.min(n+t,this.targetT.x)),this.targetT.z=Math.max(o-t,Math.min(o+t,this.targetT.z)),this.targetT.y=Math.max(r-t*.5,Math.min(r+t,this.targetT.y))}fireGesture(){this.gestureFired||(this.gestureFired=!0,this.onGesture?.())}currentPinchDistance(){let t=[...this.activePointers.values()];return t.length<2?0:Math.hypot(t[0].x-t[1].x,t[0].y-t[1].y)}dollyBy(t){this.distT=Math.max(this.minDist,Math.min(this.maxDist,this.distT*t)),this.requestRender()}zoomBy(t){this.interactionEnabled&&(this.dollyBy(t),this.fireGesture())}setPrimaryDragMode(t){this.primaryDragMode=t}setInteractionEnabled(t){this.interactionEnabled=t,!t&&(this.activePointers.clear(),this.dragging=!1,this.panning=!1,this.pinchDist=0)}frame(t,n=!1,r,o=!1,i){this.target.set(t.center[0],t.center[1],t.center[2]),this.targetT.copy(this.target),this.panAnchor.copy(this.target),this.panLimit=Math.max(1,t.radius)*1.5;let a=Math.max(1,t.radius),s=this.fovY*pe/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*pe,this.polT=Math.max(15,Math.min(80,i?.polarDeg??55))*pe;let d=this.fitDistance(t,s,u,this.azT,this.polT);this.distT=d*Math.max(1.05,Math.min(2,i?.margin??Uo)),this.minDist=Math.max(2,a*.12),this.maxDist=d*4,n?(this.azimuth=this.azT,this.polar=12*pe,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*pe/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))*pe;let c=this.fitDistance(t,i,s,this.azT,this.polT);this.distT=c*Math.max(1.05,Math.min(2,o?.margin??Uo))}fitDistance(t,n,r,o,i){let a=Math.max(1,t.radius),s=Math.max(a/Math.tan(n),a/Math.tan(r)),c=t.box;if(!c)return s;let u=Math.sin(i),d=-u*Math.sin(o),p=-Math.cos(i),m=-u*Math.cos(o);if(Math.abs(p)>.999)return s;let l=-m,f=d,h=Math.hypot(l,f);l/=h,f/=h;let y=-f*p,b=f*d-l*m,x=l*p,g=Math.tan(r),v=Math.tan(n),P=1;for(let S=0;S<8;S++){let C=(S&1?c.max[0]:c.min[0])-t.center[0],T=(S&2?c.max[1]:c.min[1])-t.center[1],B=(S&4?c.max[2]:c.min[2])-t.center[2],z=C*d+T*p+B*m,D=Math.abs(C*l+B*f),k=Math.abs(C*y+T*b+B*x);P=Math.max(P,D/g-z,k/v-z)}return Math.min(s,Math.max(P,a*.35))}updateClipping(t){let n=this.camera.position.x-t.center[0],r=this.camera.position.y-t.center[1],o=this.camera.position.z-t.center[2],i=Math.hypot(n,r,o),a=Math.max(1,t.radius)*1.18,s=Math.max(.05,i-a),c=Math.max(s+10,i+a);this.camera.perspective({near:s,far:c,aspect:this.camera.aspect})}update(){let t=this.azT-this.azimuth,n=this.polT-this.polar,r=this.distT-this.distance,o=this.targetT.x-this.target.x,i=this.targetT.y-this.target.y,a=this.targetT.z-this.target.z,s=Math.max(1e-4,this.distance*1e-4),c=Math.abs(t)>1e-4||Math.abs(n)>1e-4||Math.abs(r)>1e-4||Math.abs(o)>s||Math.abs(i)>s||Math.abs(a)>s;return this.azimuth+=t*ut,this.polar+=n*ut,this.distance+=r*ut,this.target.x+=o*ut,this.target.y+=i*ut,this.target.z+=a*ut,c&&this.applyPosition(),c}get currentDistance(){return this.distance}syncFromCamera(){let t=this.camera.position.x-this.target.x,n=this.camera.position.y-this.target.y,r=this.camera.position.z-this.target.z,o=Math.hypot(t,n,r)||1,i=Math.max(zn,Math.min(Hn,Math.acos(Math.max(-1,Math.min(1,n/o)))));this.distance=this.distT=o,this.polar=this.polT=i,this.azimuth=this.azT=Math.atan2(t,r)}setTarget(t){this.target.set(t[0],t[1],t[2]),this.targetT.copy(this.target)}resumeAfterFlight(t){this.camera.perspective({fov:this.fovY,aspect:this.camera.aspect}),t&&this.target.set(t[0],t[1],t[2]),this.targetT.copy(this.target),this.syncFromCamera()}applyPosition(){let t=Math.sin(this.polar),n=this.target.x+this.distance*t*Math.sin(this.azimuth),r=this.target.y+this.distance*Math.cos(this.polar),o=this.target.z+this.distance*t*Math.cos(this.azimuth);this.camera.position.set(n,r,o),this.camera.lookAt(this.target)}dispose(){this.canvas.removeEventListener("pointerdown",this.onPointerDown),this.canvas.removeEventListener("pointermove",this.onPointerMove),this.canvas.removeEventListener("pointerup",this.onPointerUp),this.canvas.removeEventListener("pointercancel",this.onPointerUp),this.canvas.removeEventListener("wheel",this.onWheel),this.canvas.removeEventListener("keydown",this.onKeyDown),this.canvas.removeEventListener("contextmenu",this.onContextMenu),this.activePointers.clear()}};var Zt=class{constructor(t){this.rafId=0;this.running=!1;this.lastTime=0;this.fpsEma=0;this.rendered=0;this.tick=t=>{let n=this.lastTime?(t-this.lastTime)/1e3:.016666666666666666;if(this.lastTime=t,n>0){let o=1/n;this.fpsEma=this.fpsEma?this.fpsEma*.9+o*.1:o}this.rendered++,this.frame(n)?this.rafId=requestAnimationFrame(this.tick):(this.running=!1,this.rafId=0)};this.frame=t}requestRender(){this.running||(this.running=!0,this.lastTime=0,this.rafId=requestAnimationFrame(this.tick))}stats(){return{fps:this.running?Math.round(this.fpsEma):0,rendered:this.rendered,idle:!this.running}}stop(){this.rafId&&cancelAnimationFrame(this.rafId),this.rafId=0,this.running=!1}};function jo(e,t,n){return Math.max(t,Math.min(n,e))}var mt=2.5,Es=1.15,It=6,ft=10,Yo=6,Xo=9.5,Wo=.9,Ko=2.2,Un=30,jn=4,$t=8192;var nm=ft+jn;function qo(e,t){let n=t*1.4,r=t*3.2;if(e<=n)return{scale:1,fade:0,minPixels:mt};let o=Math.min(1,(e-n)/Math.max(.001,r-n));return{scale:1-o*.4,fade:o*.55,minPixels:mt+o*(Es-mt)}}function Qo(e,t,n){return!(e>0)||!(t>0)||!(n>0)?!1:t*n/e>=64}function Zo(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 Ts=[{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"}],rm=new Map(Ts.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 $o(e){let t=e?.[0];return t&&_s[t]||"#3b82f6"}var ks=[{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"}],im=new Map(ks.map(e=>[e.key,e]));var Ls=["reference-focal","bar","entrance","exit","restroom","screen","sound","concession","coat","wall","rail","suite","obstruction"],am=new Set(Ls);var er=[{key:"circle",label:"Standard seat",shortLabel:"Standard",useCase:"General assigned seating",group:"general",path:null,bounds:null},{key:"theatre",label:"Theatre chair",shortLabel:"Theatre",useCase:"Auditoriums, arenas and stadium stands",group:"fixed",path:"M4.5 3.5 Q4.5 1.5 6.5 1.5 L17.5 1.5 Q19.5 1.5 19.5 3.5 L19.5 13 L4.5 13 Z M3.5 12 L20.5 12 Q22.5 12 22.5 14 L22.5 21 Q22.5 22.5 21 22.5 Q19.5 22.5 19.5 21 L19.5 17.5 L4.5 17.5 L4.5 21 Q4.5 22.5 3 22.5 Q1.5 22.5 1.5 21 L1.5 14 Q1.5 12 3.5 12 Z",bounds:{x:1.5,y:1.5,width:21,height:21}},{key:"dining",label:"Dining chair",shortLabel:"Dining",useCase:"Banquets, restaurants and table seating",group:"flexible",path:"M7 1 Q6 1 6 2.5 L6.75 10.5 L5 10.5 Q4 10.5 4 12 L4 14 Q4 15 5.25 15 L6 15 L4 23 L7 23 L9.5 15 L14.5 15 L17 23 L20 23 L18 15 L18.75 15 Q20 15 20 14 L20 12 Q20 10.5 19 10.5 L17.25 10.5 L18 2.5 Q18 1 17 1 Z",bounds:{x:4,y:1,width:16,height:22}},{key:"folding",label:"Folding chair",shortLabel:"Folding",useCase:"Concert floors, ceremonies and conferences",group:"flexible",path:"M6 2 Q5 2 5 3 L6 8 L18 8 L19 3 Q19 2 18 2 Z M5 9 L19 9 Q20 9 20 10.5 L19 13 L5 13 L4 10.5 Q4 9 5 9 Z M6 12 L9 12 L12 17 L15 12 L18 12 L14 19 L17 23 L14 23 L12 21 L10 23 L7 23 L10 19 Z",bounds:{x:4,y:2,width:16,height:21}},{key:"armchair",label:"Premium armchair",shortLabel:"Armchair",useCase:"Boxes, lounges and club seating",group:"premium",path:"M3.5 4 Q3.5 1.5 6 1.5 L18 1.5 Q20.5 1.5 20.5 4 L20.5 13 L3.5 13 Z M1.5 12.5 Q1.5 10 3.25 10 Q5 10 5 12.5 L5 13.5 L19 13.5 L19 12.5 Q19 10 20.75 10 Q22.5 10 22.5 12.5 L22.5 19.5 Q22.5 22 20 22 L4 22 Q1.5 22 1.5 19.5 Z",bounds:{x:1.5,y:1.5,width:21,height:20.5}},{key:"recliner",label:"Recliner",shortLabel:"Recliner",useCase:"Luxury cinemas and premium clubs",group:"premium",path:"M7 2 Q7 1 8.5 1 L15.5 1 Q17 1 17 2 L19 13 L5 13 Z M4 9 Q2 9 2 11.5 L2 16 Q2 18 4 18 L6 18 L6 15 L18 15 L18 18 L20 18 Q22 18 22 16 L22 11.5 Q22 9 20 9 Q18 9 18 11 L18 13 L6 13 L6 11 Q6 9 4 9 Z M7 17 L17 17 Q18 17 18.5 18.5 L19.5 22.5 L4.5 22.5 L5.5 18.5 Q6 17 7 17 Z",bounds:{x:2,y:1,width:20,height:21.5}},{key:"stool",label:"Stool",shortLabel:"Stool",useCase:"Bars, high-tops and seating rails",group:"flexible",path:"M6 2.5 L18 2.5 Q22 2.5 22 6.5 L22 12 Q22 16 18 16 L6 16 Q2 16 2 12 L2 6.5 Q2 2.5 6 2.5 Z M6 15.5 L9.5 15.5 L7.5 22.5 L3 22.5 Z M14.5 15.5 L18 15.5 L20.5 22.5 L16 22.5 Z",bounds:{x:2,y:2.5,width:20,height:20}},{key:"bench",label:"Bench place",shortLabel:"Bench",useCase:"Pews, bleachers and terraces",group:"fixed",path:"M2.5 0.5 L21.5 0.5 Q23 0.5 23 2 L23 5 Q23 6.5 21.5 6.5 L2.5 6.5 Q1 6.5 1 5 L1 2 Q1 0.5 2.5 0.5 Z M2 7.5 L22 7.5 Q23.5 7.5 23.5 9 L23.5 15.5 Q23.5 17 22 17 L18 17 L18 21.5 Q18 22.5 16.75 22.5 Q15.5 22.5 15.5 21.5 L15.5 17 L8.5 17 L8.5 21.5 Q8.5 22.5 7.25 22.5 Q6 22.5 6 21.5 L6 17 L2 17 Q0.5 17 0.5 15.5 L0.5 9 Q0.5 7.5 2 7.5 Z",bounds:{x:.5,y:.5,width:23,height:22}}],tr=er.map(e=>e.key),Fs=new Map(er.map(e=>[e.key,e]));function Jo(e){return typeof e=="string"&&Fs.has(e)}function nr(e,t){return Jo(e)?e:Jo(t?.seatGlyph)?t.seatGlyph:"circle"}var he=.02291666666666667,Ue=1/he,Ds=58,Os=Ds*he;var Vs=3,or=0,Yn=120,Bs=0,Ns=45,Gs=7,Ee=1.2;function Xn(e,t,n,r){return Number.isFinite(e)?Math.max(t,Math.min(n,e)):r}function zs(e){return!Number.isFinite(e)||!Number.isInteger(e)||e<0?0:e<=Gs?e:Vs}function Jt(e,t={}){let n=Xn(t.floorBaseHeightM,or,Yn,0),r=Math.min(Yn,n+zs(e.elevation)*Os),o=e.height===void 0?r:Xn(e.height,or,Yn,r),i=Xn(e.rake,Bs,Ns,0);return{height:o,rake:i}}var ir=lt(require("earcut"),1),ar=lt(require("polygon-clipping"),1);var mm=Math.PI/180;function Wn(e){let t=0,n=0;for(let o of e)t+=o.x,n+=o.y;let r=e.length||1;return{x:t/r,y:n/r}}function Et(e){return e.length?Wn(e):null}function et(e){let t=0;for(let n=0,r=e.length;n<r;n+=1){let o=e[n],i=e[(n+1)%r];t+=o.x*i.y-i.x*o.y}return t/2}function Tt(e,t,n){let r=!1;for(let o=0,i=e.length-1;o<e.length;i=o++){let a=e[o],s=e[i];a.y>n!=s.y>n&&t<(s.x-a.x)*(n-a.y)/(s.y-a.y)+a.x&&(r=!r)}return r}var G=he,Hs=.002;function Us(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<Hs}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)}},nn=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){Us(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 js(e,t,n){let r=t[0]-e[0],o=t[1]-e[1],i=t[2]-e[2],a=n[0]-e[0],s=n[1]-e[1],c=n[2]-e[2],u=o*c-i*s,d=i*a-r*c,p=r*s-o*a,m=Math.hypot(u,d,p)||1;return u/=m,d/=m,p/=m,[u,d,p]}function Ys(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,ir.default)(r,o.length?o:void 0,2);return{pts:n,tris:i}}function Kn(e){return et(e)<0?[...e].reverse():e}var Xs=3;function Ws(e,t,n,r){let o=r(e),i=r(t),a=r(n),s=(l,f,h,y)=>Math.abs(r({x:(l.x+f.x)/2,y:(l.y+f.y)/2})-(h+y)/2),c=(e.x+t.x+n.x)/3,u=(e.y+t.y+n.y)/3,d=(o+i+a)/3,p=Math.max(s(e,t,o,i),s(t,n,i,a),s(n,e,a,o),Math.abs(r({x:c,y:u})-d)),m=(l,f,h)=>{let y=Math.abs(r({x:(l+c)/2,y:(f+u)/2})-(h+d)/2);y>p&&(p=y)};return m((e.x+t.x)/2,(e.y+t.y)/2,(o+i)/2),m((t.x+n.x)/2,(t.y+n.y)/2,(i+a)/2),m((n.x+e.x)/2,(n.y+e.y)/2,(a+o)/2),p}function _t(e,t,n,r,o){if(o<=0)return Ws(e,t,n,r);let i={x:(e.x+t.x)/2,y:(e.y+t.y)/2},a={x:(t.x+n.x)/2,y:(t.y+n.y)/2},s={x:(n.x+e.x)/2,y:(n.y+e.y)/2};return Math.max(_t(e,i,s,r,o-1),_t(i,t,a,r,o-1),_t(s,a,n,r,o-1),_t(i,a,s,r,o-1))}function kt(e,t,n,r,o,i,a,s){if(a>0){let m={x:(t.x+n.x)/2,y:(t.y+n.y)/2},l={x:(n.x+r.x)/2,y:(n.y+r.y)/2},f={x:(r.x+t.x)/2,y:(r.y+t.y)/2};kt(e,t,m,f,o,i,a-1,s),kt(e,m,n,l,o,i,a-1,s),kt(e,f,l,r,o,i,a-1,s),kt(e,m,l,f,o,i,a-1,s);return}let c=[t.x*G,o(t),t.y*G],u=[n.x*G,o(n),n.y*G],d=[r.x*G,o(r),r.y*G];if(s){e.triN(c,u,d,s(t),s(n),s(r),i);return}let p=js(c,u,d);p[1]<0&&(p=[-p[0],-p[1],-p[2]]),e.tri(c,u,d,p,i)}var Ks=8;function rr(e,t,n){if(!Number.isFinite(n))return e;let r=[],o=(i,a,s,c,u)=>{if(u>0){let d={x:(i.x+a.x)/2,y:(i.y+a.y)/2},p=t(d);if(Math.abs(p-(s+c)/2)>n){o(i,d,s,p,u-1),o(d,a,p,c,u-1);return}}r.push(i)};for(let i=0;i<e.length;i++){let a=e[i],s=e[(i+1)%e.length];o(a,s,t(a),t(s),Ks)}return r}function en(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 tn=.001*Ue*.1;function ue(e,t,n,r,o,i,a,s,c=1/0,u){if(!t||t.length<3||(c===void 0&&(c=1/0),Math.abs(et(t))<1e-4))return;let d=en(rr(en(Kn(t),tn),r,c),tn),p=n?.map(S=>en(rr(en(Kn(S),tn),r,c),tn)).filter(S=>S.length>=3&&Math.abs(et(S))>=1e-4),{pts:m,tris:l}=Ys(d,p),f=[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],y=[a[0]*s.top,a[1]*s.top,a[2]*s.top],b=[a[0]*s.wallBottom,a[1]*s.wallBottom,a[2]*s.wallBottom],x=0;if(Number.isFinite(c))for(;x<Xs;x++){let S=0;for(let C=0;C<l.length;C+=3){let T=_t(m[l[C]],m[l[C+1]],m[l[C+2]],r,x);T>S&&(S=T)}if(S<=c)break}for(let S=0;S<l.length;S+=3){let C=m[l[S]],T=m[l[S+1]],B=m[l[S+2]];kt(e,C,T,B,r,f,x,u);let z=[C.x*G,o,C.y*G],D=[T.x*G,o,T.y*G],k=[B.x*G,o,B.y*G];e.tri(z,k,D,[0,-1,0],h)}let g=S=>{if(x<=0)return S;let C=1<<x,T=[];for(let B=0;B<S.length;B++){let z=S[B],D=S[(B+1)%S.length];for(let k=0;k<C;k++){let A=k/C;T.push({x:z.x+(D.x-z.x)*A,y:z.y+(D.y-z.y)*A})}}return T},v=Wn(d),P=[{ring:g(d),flip:!1}];if(p)for(let S of p)S.length>=3&&P.push({ring:g(S),flip:!0});for(let{ring:S,flip:C}of P)for(let T=0;T<S.length;T++){let B=S[T],z=S[(T+1)%S.length],D=(z.x-B.x)*G,A=(z.y-B.y)*G,_=-D,V=Math.hypot(A,_)||1;A/=V,_/=V;let M=(B.x+z.x)/2-v.x,R=(B.y+z.y)/2-v.y,E=A*M+_*R;C&&(E=-E),E<0&&(A=-A,_=-_);let w=[A,0,_],L=[B.x*G,r(B),B.y*G],I=[z.x*G,r(z),z.y*G],O=[B.x*G,o,B.y*G],j=[z.x*G,o,z.y*G];e.tri(L,I,j,w,y,y,b),e.tri(L,j,O,w,y,b,b)}}function sr(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 on(e,t,n=2.5){if(t<=0||e.length<3)return e;let r=Kn(e),o=r.length,i=[];for(let s=0;s<o;s++){let c=r[s],u=r[(s+1)%o],d=u.x-c.x,p=u.y-c.y,m=Math.hypot(d,p)||1;i.push({x:p/m,y:-d/m})}let a=[];for(let s=0;s<o;s++){let c=r[s],u=i[(s-1+o)%o],d=i[s],p=u.x+d.x,m=u.y+d.y,l=Math.hypot(p,m),f=()=>{a.push([c.x+u.x*t,c.y+u.y*t]),a.push([c.x+d.x*t,c.y+d.y*t])};if(l<1e-9){f();continue}p/=l,m/=l;let h=p*u.x+m*u.y,y=1/Math.max(h,1e-6);if(!Number.isFinite(y)||y>n){f();continue}a.push([c.x+p*t*y,c.y+m*t*y])}if(a.length<3)return e;try{let s=ar.default.union([[...a,a[0]]]),c=null,u=-1/0;for(let p of s){let m=Math.abs(et(p[0].map(([l,f])=>({x:l,y:f}))));m>u&&(u=m,c=p[0])}if(!c)return e;let d=c.map(([p,m])=>({x:p,y:m}));if(d.length>1){let p=d[0],m=d[d.length-1];Math.abs(p.x-m.x)<1e-9&&Math.abs(p.y-m.y)<1e-9&&d.pop()}return d.length>=3?d:e}catch{return e}}function rn(e,t,n,r,o=28){let i=[];for(let a=0;a<o;a++){let s=a/o*Math.PI*2;i.push({x:e+n*Math.cos(s),y:t+r*Math.sin(s)})}return i}function Lt(e,t,n,r){return[{x:e,y:t},{x:e+n,y:t},{x:e+n,y:t+r},{x:e,y:t+r}]}var ae={pedestal:0,pad:1,back:2,arm:3,footrest:4,leg:5,body:10,head:11},qs=.44,Qs=.15,cr=.3,Zs=.24;function lr(e){return e===void 0||!Number.isFinite(e)||e<=0?Zs:Math.min(cr,Math.max(Qs,e*qs))}var qn=.21,$s=.05,Qn=.45,an=Qn+$s,ur=.92,Zn=1.205,dr=-.23,mr=.38,Js=[{part:ae.pedestal,min:[-.3,0,-.3],max:[.3,.36,.3]},{part:ae.pad,min:[-1,.36,-.95],max:[1,Qn,1]},{part:ae.back,min:[-1,an,-1],max:[1,ur,-.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]}],ec=[{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]}],tc=[{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 fr(){let e=[],t=[],n=[],r=[],o=(V,M,R)=>{let E=n.length,[w,L,I]=V,O=[L[0]-w[0],L[1]-w[1],L[2]-w[2]],j=[I[0]-w[0],I[1]-w[1],I[2]-w[2]],U=O[1]*j[2]-O[2]*j[1],N=O[2]*j[0]-O[0]*j[2],F=O[0]*j[1]-O[1]*j[0],K=Math.hypot(U,N,F);K>1e-9?(U/=K,N/=K,F/=K):[U,N,F]=M,U*M[0]+N*M[1]+F*M[2]<0&&(U=-U,N=-N,F=-F);for(let X of V)e.push(...X),t.push(U,N,F),n.push(R);r.push(E,E+1,E+2,E,E+2,E+3)},i=V=>{for(let M of tc){let R=M.c.map(E=>E.map((w,L)=>w?V.max[L]:V.min[L]));o(R,M.n,V.part)}};for(let V of Js)i(V);for(let V of ec)i(V);let a=Qn,s=1.08,c=.47,u=.69,d=-.55,p=.08,m=-.48,l=.01,f=[-c,a,d],h=[c,a,d],y=[-c,a,p],b=[c,a,p],x=[-u,s,m],g=[u,s,m],v=[-u,s,l],P=[u,s,l];o([h,g,P,b],[1,0,0],ae.body),o([y,v,x,f],[-1,0,0],ae.body),o([v,P,g,x],[0,1,0],ae.body),o([f,h,b,y],[0,-1,0],ae.body),o([b,P,v,y],[0,0,1],ae.body),o([f,x,g,h],[0,0,-1],ae.body);let S=10,C=8,T=[0,Zn,dr],B=[.42,.115,mr],z=n.length;for(let V=0;V<=C;V++){let M=Math.PI*V/C,R=Math.cos(M),E=Math.sin(M);for(let w=0;w<=S;w++){let L=Math.PI*2*w/S,I=E*Math.cos(L),O=E*Math.sin(L);e.push(T[0]+B[0]*I,T[1]+B[1]*R,T[2]+B[2]*O);let j=I/B[0],U=R/B[1],N=O/B[2],F=Math.hypot(j,U,N)||1;j/=F,U/=F,N/=F,t.push(j,U,N),n.push(ae.head)}}for(let V=0;V<C;V++)for(let M=0;M<S;M++){let R=z+V*(S+1)+M,E=R+S+1;r.push(R,E,R+1,R+1,E,E+1)}let D=new Float32Array(e),k=new Float32Array(t),A=new Float32Array(n),_=new Uint16Array(r);return{position:D,normal:k,part:A,index:_,vertexCount:n.length,indexCount:r.length}}function pr(e,t,n,r){let o=new Float32Array(t),i=u=>e[u*3],a=u=>e[u*3+2],s=0,c=(u,d)=>{let p=d-u;for(let m=u;m<d;m++){let[l,f]=r(m),h=l-i(m),y=f-a(m);if(p>=2){let b=Math.max(u,m-1),x=Math.min(d-1,m+1),g=i(x)-i(b),v=a(x)-a(b),P=Math.hypot(g,v);if(P>1e-6){let S=-v/P,C=g/P;S*h+C*y<0&&(S=-S,C=-C),h=S,y=C}}o[m]=h===0&&y===0?0:Math.atan2(h,y)}};for(let u=1;u<=t;u++)(u===t||n(u)!==n(s))&&(c(s,u),s=u);return o}var De=.22;function hr(e,t){let n=fe[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 nc=.42;function oc(e){let t=e.length,n=new Float64Array(t);if(t<2)return n.fill(1/0),n;let r=1/0,o=1/0,i=-1/0,a=-1/0;for(let f of e)f.x<r&&(r=f.x),f.y<o&&(o=f.y),f.x>i&&(i=f.x),f.y>a&&(a=f.y);let s=Math.max(i-r,1e-6),c=Math.max(a-o,1e-6),u=Math.max(Math.sqrt(s*c/t),1e-6),d=Math.max(1,Math.ceil(s/u)+1),p=Math.max(1,Math.ceil(c/u)+1),m=new Map,l=(f,h)=>{let y=Math.min(d-1,Math.max(0,Math.floor((f-r)/u)));return Math.min(p-1,Math.max(0,Math.floor((h-o)/u)))*d+y};for(let f=0;f<t;f++){let h=l(e[f].x,e[f].y),y=m.get(h);y?y.push(f):m.set(h,[f])}for(let f=0;f<t;f++){let h=e[f],y=Math.min(d-1,Math.max(0,Math.floor((h.x-r)/u))),b=Math.min(p-1,Math.max(0,Math.floor((h.y-o)/u))),x=1/0;for(let g=1;g<=4;g++){for(let v=b-g;v<=b+g;v++)if(!(v<0||v>=p))for(let P=y-g;P<=y+g;P++){if(P<0||P>=d||g>1&&Math.abs(v-b)<g&&Math.abs(P-y)<g)continue;let S=m.get(v*d+P);if(S)for(let C of S){if(C===f)continue;let T=Math.hypot(e[C].x-h.x,e[C].y-h.y);T<x&&(x=T)}}if(Number.isFinite(x)&&x<=g*u)break}n[f]=x}return n}function rc(e){let t=e.eyeHeightM;return Number.isFinite(t)?Math.max(0,t-Ee):0}function br(e,t,n,r,o,i){let a=e.length,s=new Float32Array(a*3),c=new Float32Array(a),u=new Float32Array(a*3),d=new Float32Array(a),p=new Float32Array(a),m=new Float32Array(a),l=new Float32Array(a),f=new Float32Array(a*3),h=new Map,y=oc(e);for(let b=0;b<a;b++){let x=e[b],v=(n?.seatPitchU(b)??y[b])*G;d[b]=Number.isFinite(v)?Math.max(.06,Math.min(De,v*nc)):De,p[b]=lr(Number.isFinite(v)?v:void 0);let P=nr(x.glyph,{seatGlyph:i?.get(x.categoryKey)});m[b]=tr.indexOf(P),l[b]=x.wheelchairSpaceType==="no-seat"?0:1,s[b*3]=x.x*G,s[b*3+1]=n?n.seatDeckY(b):rc(x),s[b*3+2]=x.y*G,c[b]=Rt(t?t(x):"available");let S=ne(o?.get(x.categoryKey)??"#6e7bff")??[.43,.48,1];if(u[b*3]=S[0],u[b*3+1]=S[1],u[b*3+2]=S[2],x.accessibility?.length){let C=ne($o(x.accessibility));C&&(f[b*3]=C[0],f[b*3+1]=C[1],f[b*3+2]=C[2])}h.set(x.id,b)}return{count:a,iPosition:s,iState:c,iCategory:u,iMaxRadius:d,iRing:f,idToIndex:h,iChairWidth:p,iGlyph:m,iPhysicalSeat:l,iFloor:r??new Float32Array(a),iYaw:new Float32Array(a)}}var ic=64;function $n(e,t){let n=[];for(let a of t){let s=e.idToIndex.get(a.seatId);if(s===void 0)continue;let c=Rt(a.state);e.iState[s]!==c&&(e.iState[s]=c,n.push(s))}if(!n.length)return[];n.sort((a,s)=>a-s);let r=[],o=n[0],i=n[0];for(let a=1;a<n.length;a++){let s=n[a];if(s!==i){if(s<=i+ic){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,sc=1.6;function yr(e){return jo(e??1,ac,sc)}var cc=.15,lc=.9,uc=1.76;function dc(){return{background:{top:[...Je.top],bottom:[...Je.bottom]},structure:Gn,seatStates:{...No},seatScale:1,materials:{seat:null,shell:null,roughness:.78}}}function gr(e){let t=dc();if(!e)return t;let n=ne(e.background);if(n){t.background={top:Me(n,lc),bottom:Me(n,uc)};let a={};for(let[s,c]of Object.entries(Gn))a[s]=ge(c,n,cc);t.structure=a}let r=ne(e.selectionColor)??ne(e.accent);r&&(t.seatStates={...t.seatStates,selected:r});let o=e.seatScale;typeof o=="number"&&Number.isFinite(o)&&(t.seatScale=yr(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 xr(e,t){let n=[];for(let r of t)n.push(...e.seatStates[r]);return n}function vr(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 Sr(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[vr(e,.5)];let r=Array.from({length:n+1},(c,u)=>vr(e,u/n)),o=new Float64Array(r.length);for(let c=1;c<r.length;c+=1){let u=r[c].x-r[c-1].x,d=r[c].y-r[c-1].y;o[c]=o[c-1]+Math.hypot(u,d)}let i=o[o.length-1];if(i<=1e-9)return Array.from({length:t},()=>({...e.start}));let a=[],s=1;for(let c=0;c<t;c+=1){let u=i*c/(t-1);for(;s<o.length-1&&o[s]<u;)s+=1;let d=o[s-1],p=o[s],m=p===d?0:(u-d)/(p-d);a.push({x:r[s-1].x+(r[s].x-r[s-1].x)*m,y:r[s-1].y+(r[s].y-r[s-1].y)*m})}return a}function Mr(e){let t=new Map,n=new Map;for(let r of e){if(r.type!=="row"||!r.segmentedRow)continue;let o=n.get(r.segmentedRow.groupId)??[];o.push(r),n.set(r.segmentedRow.groupId,o)}for(let[r,o]of n){let i=o.slice().sort((m,l)=>m.segmentedRow.componentIndex-l.segmentedRow.componentIndex),a=i[0]?.segmentedRow?.componentCount??0,s=i[0]?.segmentedRow;if(!s||!(a>=2&&i.length===a&&s?.boundaryBefore==="start"&&i.every((m,l)=>m.segmentedRow?.kind==="segmented-row-v1"&&m.segmentedRow.groupId===r&&m.segmentedRow.componentCount===a&&m.segmentedRow.componentIndex===l&&m.segmentedRow.repeatLabelOnComponents===s.repeatLabelOnComponents&&(l===0?m.segmentedRow.boundaryBefore==="start":m.segmentedRow.boundaryBefore!=="start")&&m.segmentedRow.displayLabel===s.displayLabel)))continue;let u=i.reduce((m,l)=>m+l.seatCount,0),d=0,p=0;for(let m of i)m.segmentedRow.boundaryBefore==="break"&&(d+=1),t.set(m.id,{groupId:r,adjacencyOffset:d,displayOffset:p,displayLabel:s.displayLabel,totalSeats:u,canonical:i[0],viewFromSeatUrl:s.viewFromSeatUrl,viewFromSeatMeta:s.viewFromSeatMeta,confidenceEvidence:s.confidenceEvidence}),d+=m.seatCount,p+=m.seatCount}return t}var mc="ABCDEFGHIJKLMNOPQRSTUVWXYZ";var fc="abcdefghijklmnopqrstuvwxyz";function pc(e,t){let n=t.length,r=e+1,o="";for(;r>0;){r-=1;let i=r%n;o=t[i]+o,r=Math.floor(r/n)}return o}function Jn(e,t=!1){let n=t?fc:mc;return pc(Math.max(0,Math.floor(e)-1),n)}var hc=[[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 wr(e){if(!Number.isFinite(e)||e<=0)return String(e);let t=Math.floor(e),n="";for(let[r,o]of hc)for(;t>=r;)n+=o,t-=r;return n}function bc(e){let t=new Array(e);return Array.from({length:e},(n,r)=>r).sort((n,r)=>Math.abs(2*n-(e-1))-Math.abs(2*r-(e-1))||n-r).forEach((n,r)=>t[n]=r),t}function eo(e,t){let n=e.seatLabelStart??1,r=e.seatNumbering?.direction??"ltr",o=e.seatNumbering?.step??1,i=e.seatNumbering?.scheme??"decimal",a=e.seatNumbering?.prefix??"",s=e.seatNumbering?.endAt,c=e.seatCount;if(i==="updown"||i==="updown-descending"){let l=Math.ceil(c/2),f=i==="updown"?t<l?n+2*t:n-1+2*(c-t):t<l?n+2*(l-1-t):n+1+2*(t-l);return`${a}${f}`}let u=i==="odd"||i==="even"?2:o,d=s!=null&&Number.isFinite(s)?s-(c-1)*u:n,p=r==="center"?bc(c)[t]:r==="rtl"?c-1-t:t,m;switch(i){case"odd":{let l=d%2===1?d:d+1;m=String(l+p*2);break}case"even":{let l=d%2===0?d:d+1;m=String(l+p*2);break}case"roman":m=wr(d+p*o);break;case"letters-upper":m=Jn(d+p*o,!1);break;case"letters-lower":m=Jn(d+p*o,!0);break;default:m=String(d+p*o);break}return`${a}${m}`}function yc(e){return{...e.canonical,seatCount:e.totalSeats,label:e.displayLabel,displayLabel:e.displayLabel}}function Pr(e,t,n){return n?.label??`${e.label}-${eo(e,t)}`}function to(e,t,n,r){if(r?.displayLabel)return r.displayLabel;if(!n)return`${e.displayLabel||e.label}-${eo(e,t)}`;let o=yc(n),i=n.displayOffset+t;return`${n.displayLabel}-${eo(o,i)}`}function Cr(e){let t=e.length;return t<=3?[...e]:[e[Math.floor(t*.25)],e[Math.floor(t*.5)],e[Math.floor(t*.75)]]}function pt(e,t,n){if(!e.length)return 1/0;if(e.length===1)return Math.hypot(t-e[0].x,n-e[0].y);let r=1/0;for(let o=0;o+1<e.length;o++){let i=e[o],a=e[o+1],s=a.x-i.x,c=a.y-i.y,u=s*s+c*c,d=u>1e-12?((t-i.x)*s+(n-i.y)*c)/u:0;d<0?d=0:d>1&&(d=1);let p=Math.hypot(t-(i.x+d*s),n-(i.y+d*c));p<r&&(r=p)}return r}function gc(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 Ar(e,t){return Math.hypot(e.cx-t.cx,e.cy-t.cy)-e.r-t.r}function no(e,t){let n=1/0;for(let r of Cr(e)){let o=pt(t,r.x,r.y);o<n&&(n=o)}for(let r of Cr(t)){let o=pt(e,r.x,r.y);o<n&&(n=o)}return n}function xc(e,t){if(e.length<3)return{pts:e,seatIndices:t};let n=0,r=0;for(let d of e)n+=d.x,r+=d.y;n/=e.length,r/=e.length;let o=-1,i=e[0];for(let d of e){let p=Math.hypot(d.x-n,d.y-r);p>o&&(o=p,i=d)}let a=i.x-n,s=i.y-r,c=Math.hypot(a,s);c>1e-9?(a/=c,s/=c):(a=1,s=0);let u=e.map((d,p)=>({p:d,i:p,t:(d.x-n)*a+(d.y-r)*s})).sort((d,p)=>d.t-p.t);return{pts:u.map(d=>d.p),seatIndices:u.map(d=>t[d.i])}}function oo(e){let t=e.length;if(t<3)return null;let n=0,r=0;for(let x of e)n+=x.x,r+=x.y;n/=t,r/=t;let o=0,i=0,a=0,s=0,c=0,u=0,d=0;for(let x of e){let g=x.x-n,v=x.y-r;o+=g*g,a+=v*v,i+=g*v,s+=g*g*g,c+=v*v*v,u+=g*v*v,d+=v*g*g}let p=o*a-i*i;if(Math.abs(p)<1e-9)return null;let m=(s+u)/2,l=(c+d)/2,f=(m*a-l*i)/p,h=(l*o-m*i)/p,y=f+n,b=h+r;return!Number.isFinite(y)||!Number.isFinite(b)?null:{cx:y,cy:b}}var vc=.15;function Sc(e){if(e.length<2)return null;let t=e.map(x=>{let g=0,v=0;for(let P of x.pts)g+=P.x,v+=P.y;return{x:g/x.pts.length,y:v/x.pts.length}}),n=0,r=0;for(let x of t)n+=x.x,r+=x.y;n/=t.length,r/=t.length;let o=0,i=0,a=0;for(let x of t){let g=x.x-n,v=x.y-r;o+=g*g,i+=g*v,a+=v*v}let s=o+a,c=o*a-i*i,u=s/2+Math.sqrt(Math.max(0,s*s/4-c)),d,p;Math.abs(i)>1e-12?(d=u-a,p=i):o>=a?(d=1,p=0):(d=0,p=1);let m=Math.hypot(d,p);if(!(m>1e-12))return null;d/=m,p/=m;let l=1/0,f=-1/0,h=[];for(let x of e){let g=1/0,v=-1/0;for(let P of x.pts){let S=P.x*d+P.y*p;S<g&&(g=S),S>v&&(v=S),S<l&&(l=S),S>f&&(f=S)}h.push(v-g)}let y=f-l;return y>1e-9?(h.sort((x,g)=>x-g),h[Math.min(h.length-1,Math.floor(h.length*.9))]/y<=Mc?{x:d,y:p}:null):null}var Mc=.35;function sn(e,t,n,r){let o=new Map;for(let y of n){let b=t[y],x=b.rowId||`__seat-${y}`,g=o.get(x);g||(g={pts:[],idx:[]},o.set(x,g)),g.pts.push({x:b.x,y:b.y}),g.idx.push(y)}if(!o.size)return{sectionId:e,rows:[],blockCount:0};let i=[];for(let[y,b]of o){let x=xc(b.pts,b.idx),g=0;for(let v of x.pts)g+=Math.hypot(v.x-r.x,v.y-r.y);i.push({id:y,pts:x.pts,seatIndices:x.seatIndices,blockId:-1,ordinal:0,blockDepth:0,focalDistance:g/x.pts.length})}let a=i.map(y=>gc(y.pts)),s=[];for(let y=0;y<i.length;y++){let b=1/0;for(let x=0;x<i.length;x++){if(y===x||Ar(a[y],a[x])>=b)continue;let g=no(i[y].pts,i[x].pts);g<b&&(b=g)}Number.isFinite(b)&&s.push(b)}s.sort((y,b)=>y-b);let c=s.length?s[Math.floor(s.length/2)]:1,u=Math.max(c*1.8,1e-6),d=i.map(()=>[]);for(let y=0;y<i.length;y++)for(let b=y+1;b<i.length;b++)Ar(a[y],a[b])>u||no(i[y].pts,i[b].pts)<=u&&(d[y].push(b),d[b].push(y));let p=0;for(let y=0;y<i.length;y++){if(i[y].blockId!==-1)continue;let b=p++,x=[y];for(i[y].blockId=b;x.length;){let g=x.pop();for(let v of d[g])i[v].blockId===-1&&(i[v].blockId=b,x.push(v))}}let m=new Map;for(let y of i){let b=m.get(y.blockId)??[];b.push(y),m.set(y.blockId,b)}let l=[];for(let y of i){if(y.pts.length<4)continue;let b=oo(y.pts);b&&(!Number.isFinite(b.cx)||!Number.isFinite(b.cy)||l.push({x:b.cx,y:b.cy}))}let f=l.length>=2?(()=>{let y=l.map(g=>g.x).sort((g,v)=>g-v),b=l.map(g=>g.y).sort((g,v)=>g-v),x=Math.floor(l.length/2);return{cx:y[x],cy:b[x]}})():null;if(f){let y=S=>Math.hypot(S.x-f.cx,S.y-f.cy),b=1/0,x=-1/0,g=[];for(let S of i){let C=1/0,T=-1/0;for(let B of S.pts){let z=y(B);z<C&&(C=z),z>T&&(T=z)}g.push(T-C),C<b&&(b=C),T>x&&(x=T)}let v=x-b;g.sort((S,C)=>S-C);let P=g[Math.min(g.length-1,Math.floor(g.length*.9))];if(v>1e-9&&P/v<=vc){let S=i.map(M=>{let R=0;for(let E of M.pts)R+=y(E);return{row:M,radius:R/M.pts.length}}),C=0,T=0;for(let M of S)C+=M.radius,T+=M.row.focalDistance;C/=S.length,T/=S.length;let B=0;for(let M of S)B+=(M.radius-C)*(M.row.focalDistance-T);if(B<0)for(let M of S)M.radius=-M.radius;let D=1/0;for(let M of S)M.radius<D&&(D=M.radius);S.sort((M,R)=>M.radius-R.radius);let k=-1,A=-1/0,_=v/Math.max(1,S.length)*.5,V=[];for(let M of S)M.radius-A>_&&(k++,A=M.radius),M.row.ordinal=k,M.row.blockDepth=M.radius-D,V.push(M.row);return{sectionId:e,rows:V,blockCount:p}}}let h=[];for(let[,y]of m){let b=Sc(y);if(b){let x=v=>{let P=0;for(let S of v.pts)P+=S.x*b.x+S.y*b.y;return P/v.pts.length};y.sort((v,P)=>x(v)-x(P)),y.length>=2&&y[0].focalDistance>y[y.length-1].focalDistance&&y.reverse();let g=0;for(let v=0;v<y.length;v++)v>0&&(g+=no(y[v-1].pts,y[v].pts)),y[v].ordinal=v,y[v].blockDepth=g,h.push(y[v])}else{let x=1/0;for(let g of y)g.focalDistance<x&&(x=g.focalDistance);y.sort((g,v)=>g.focalDistance-v.focalDistance);for(let g=0;g<y.length;g++)y[g].ordinal=g,y[g].blockDepth=Math.max(0,y[g].focalDistance-x),h.push(y[g])}}return{sectionId:e,rows:h,blockCount:p}}var wc=/^\d{4}-\d{2}-\d{2}$/;function Pc(e){let t=Date.parse(e);return Number.isFinite(t)?wc.test(e)?t+864e5:t:null}function Cc(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=Pc(e.validUntil);return n===null?!1:(t instanceof Date?t.getTime():t)<n}function Ac(e,t,n){return!(e.eventConfigurationId&&e.eventConfigurationId!==t||e.eventConfigurationVersion!==void 0&&e.eventConfigurationVersion!==n)}function Rc(e){return e.status!=="draft"&&e.status!=="retracted"}function Ic(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 Rr(e,t={}){return!!e&&Rc(e)&&Ac(e,t.activeConfigurationId,t.activeConfigurationVersion)&&Ic(e,t.activeBasisSha256)&&Cc(e,t.now)}var Gm=Math.PI*2;function cn(e){return e==="pitch-football"||e==="rink-hockey"||e==="track-athletics"||e==="oval-cricket"}var Ec=/^data:image\/(?:png|jpe?g|webp|gif|avif);base64,[a-z0-9+/]+={0,2}$/i,Tc=/[\s"'<>`\\]/;function _c(e){if(typeof e!="string"||!e||e.length>2e6||e!==e.trim())return!1;if(e.startsWith("data:"))return Ec.test(e);if(Tc.test(e))return!1;try{let t=new URL(e);return t.protocol==="https:"&&!t.username&&!t.password}catch{return!1}}function Ir(e){let t=e.trim();return _c(t)?t:null}var ro="seatlayer.event-configuration/1";var ht=100,kc=120,Lc=1e5,Fc=1e4,Dc=/^[a-f0-9]{64}$/,Oc=new Set(["stage","screen","barrier","camera_platform","sound_desk","rigging_truss"]);function Ft(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function nt(e,t){return typeof e=="string"&&e.length>=1&&e.length<=t&&e.normalize("NFKC").trim()===e}function Vc(e){return typeof e=="number"&&Number.isInteger(e)&&e>0}function Er(e){return!Array.isArray(e)||e.length>Lc||!e.every(t=>nt(t,ht))?null:[...new Set(e)].sort()}function Bc(e){return!Ft(e)||!nt(e.chartId,ht)||!nt(e.version,ht)||e.sha256!==void 0&&(typeof e.sha256!="string"||!Dc.test(e.sha256))?null:{chartId:e.chartId,version:e.version,...typeof e.sha256=="string"?{sha256:e.sha256}:{}}}function io(e,t,n){return typeof e=="number"&&Number.isFinite(e)&&e>=t&&e<=n}function Nc(e){return Ft(e)?e.mode==="none"||e.mode==="opaque"?e.opacity===void 0?{mode:e.mode}:null:e.mode==="partial"&&io(e.opacity,.01,.99)?{mode:"partial",opacity:e.opacity}:null:null}function Gc(e,t){if(e===void 0)return;if(!Array.isArray(e)||e.length>Fc)return null;let n=new Set(t),r=new Set,o=new Set,i=0,a=[];for(let s of e){if(!Ft(s)||!nt(s.id,ht)||!nt(s.objectId,ht)||!n.has(s.objectId)||!Oc.has(String(s.kind))||!io(s.heightM,.05,50)||s.baseElevationM!==void 0&&!io(s.baseElevationM,-10,100))return null;let c=Nc(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"?Ir(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 zc(e){let t=[];if(!Ft(e))return{issues:[{code:"invalid_export",path:"configuration",message:"Configuration must be an object"}]};e.schema!==ro&&t.push({code:"unsupported_schema",path:"configuration.schema",message:`Configuration schema must be ${ro}`}),nt(e.id,ht)||t.push({code:"invalid_id",path:"configuration.id",message:"Configuration id must contain 1 to 100 normalized characters"}),nt(e.label,kc)||t.push({code:"invalid_label",path:"configuration.label",message:"Configuration label must contain 1 to 120 normalized characters"}),Vc(e.version)||t.push({code:"invalid_version",path:"configuration.version",message:"Configuration version must be a positive integer"});let n=Bc(e.baseVenue);n||t.push({code:"invalid_base_venue",path:"configuration.baseVenue",message:"Base venue must identify one normalized chart id and exact version"});let r=Ft(e.overlay)?e.overlay:null,o=Er(r?.objectIds),i=Er(r?.productionKillSeatIds),a=o?Gc(r?.productionElements,o):null;return(!r||!o||!i)&&t.push({code:"invalid_overlay",path:"configuration.overlay",message:"Overlay ids must be bounded arrays of normalized stable ids"}),a===null&&t.push({code:"invalid_production_element",path:"configuration.overlay.productionElements",message:"Production elements must be unique, bounded semantics over referenced base-venue objects"}),t.length||!n||!o||!i||a===null?{issues:t}:{issues:t,value:{schema:ro,id:e.id,label:e.label,version:e.version,baseVenue:n,overlay:{objectIds:o,productionKillSeatIds:i,...a!==void 0?{productionElements:a}:{}}}}}function Tr(e){let t=zc(e);return t.value?{ok:!0,value:t.value}:{ok:!1,issues:t.issues}}function Hc(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 Uc(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 _r(e){let t=Hc(e);if(!t||t.length<2)return null;let n=e.rotation??0,r=Math.abs(n)<1e-6?t:t.map(c=>Uc(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 jc=5,Yc=3,Xc=.92,Wc=1.9,Kc=2,qc=.6,Qc=1,Zc=.06;function $c(e){return e.heightM!==void 0?e.heightM:cn(e.stageKind)?Zc:Qc}function kr(e){let t=1/0,n=1/0,r=-1/0,o=-1/0,i=-1/0;for(let a of Dr(e)){let s=a.baseHeightM??0;for(let c of a.objects){if(c.type!=="shape"||c.role!=="stage")continue;let u=_r(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+$c(c)))}}return!Number.isFinite(t)||!Number.isFinite(i)?null:{minX:t,minY:n,maxX:r,maxY:o,deckTopM:i}}function Jc(e,t,n,r){let o=1/0,i=1/0,a=-1/0,s=-1/0;for(let l of e)Number.isFinite(l.eyeHeightM)&&(o=Math.min(o,l.x),a=Math.max(a,l.x),i=Math.min(i,l.y),s=Math.max(s,l.y));if(!Number.isFinite(o))return null;let c=o*t,u=i*t,d=Math.max(1,Math.ceil((a-o)*t/n)+1),p=Math.max(1,Math.ceil((s-i)*t/n)+1),m=new Float64Array(d*p).fill(-1/0);for(let l of e){if(!Number.isFinite(l.eyeHeightM))continue;let f=l.eyeHeightM-Ee,h=Math.min(d-1,Math.max(0,Math.floor((l.x*t-c)/n))),b=Math.min(p-1,Math.max(0,Math.floor((l.y*t-u)/n)))*d+h,x=f+r;x>m[b]&&(m[b]=x)}return{cellM:n,minX:c,minY:u,cols:d,rows:p,top:m}}function el(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 Lr(e,t,n={}){let r=new Map;if(!t||!e.length)return r;let o=n.metresPerChartUnit??he,i=n.cellM??qc,a=n.chairBackM??Xc,s=n.selfRowSkipM??Kc,c=n.clearThreshold??.9,u=n.partialThreshold??.25,d=Math.max(1,n.columns??jc),p=Math.max(1,n.rows??Yc),m=Jc(e,o,i,a);if(!m)return r;let l=(t.maxX-t.minX)*o,f=(t.maxY-t.minY)*o,h=l>=f,y=(t.minX+t.maxX)/2*o,b=(t.minY+t.maxY)/2*o,x=[];for(let v=0;v<d;v++){let P=(v+.5)/d-.5,S=h?y+P*l:y,C=h?b:b+P*f;for(let T=0;T<p;T++){let B=t.deckTopM+(p===1?0:T/(p-1)*Wc);x.push({x:S,y:C,z:B})}}let g=i/2;for(let v of e){if(!Number.isFinite(v.eyeHeightM))continue;let P=v.x*o,S=v.y*o,C=v.eyeHeightM,T=0,B=1/0;for(let D of x){let k=D.x-P,A=D.y-S,_=Math.hypot(k,A);if(!(_>s)){T++;continue}let V=k/_,M=A/_,R=0;for(let E=s;E<_;E+=g){let w=el(m,P+V*E,S+M*E);if(!(!Number.isFinite(w)||w>=C)&&w>C+(D.z-C)*E/_){R=E;break}}R?B=Math.min(B,R):T++}let z=T/x.length;z>=c||r.set(v.id,{seatId:v.id,mark:z<u?"obstructedView":"restrictedView",visibleFraction:z,totalRays:x.length,atDistanceM:Number.isFinite(B)?B:0})}return r}function Fr(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 Gr(e){return e?e.accessibility&&e.accessibility.length?e.wheelchairSpaceType&&!e.accessibility.includes("wheelchair")?["wheelchair",...e.accessibility]:e.accessibility:e.wheelchairSpaceType?["wheelchair"]:e.accessible?["wheelchair"]:[]:[]}var ln=Math.PI/180;var Dt=16;function so(e,t,n,r){let o=n*ln,i=Math.cos(o),a=Math.sin(o);return{x:r.x+e*i-t*a,y:r.y+e*a+t*i}}function tl(e){let{seatCount:t,seatSpacing:n,curve:r,rotation:o,origin:i}=e,a=[];if(e.path)return Sr(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(so(u*n,0,o,i));return a}let s=r/(t-1)*ln,c=n/(2*Math.sin(Math.abs(s)/2));for(let u=0;u<t;u++){let d=u*s,p=c*Math.sin(d),m=-c+c*Math.cos(d);a.push(so(p,m,o,i))}return a}function nl(e){let t=new Map;if(e.overrides)for(let n of e.overrides)t.set(n.index,n);return t}function ol(e,t){let n=nl(e);return tl(e).map((r,o)=>{let i=n.get(o),a=Gr(i),s=Pr(e,o,i),c={...e.commercial,...i?.commercial};return{index:o,x:r.x+(i?.dx??0),y:r.y+(i?.dy??0),label:s,displayLabel:to(e,o,t,i),categoryKey:i?.categoryKey??e.categoryKey,skipped:!!i?.skip,accessible:a.length>0,accessibility:a,wheelchairSpaceType:i?.wheelchairSpaceType,commercial:Object.values(c).some(u=>u!==void 0&&u!==!1&&u!=="")?c:void 0,glyph:i?.glyph,viewUrl:i?.viewFromSeatUrl??e.viewFromSeatUrl,viewMeta:i?.viewFromSeatUrl?i.viewFromSeatMeta:e.viewFromSeatMeta,labelStyle:i?.labelStyle}})}function zr(e){let t=[];for(let n of ol(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 rl(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 il(e){let t=[],n=Math.max(0,Math.round(e.seatCount));if(n===0)return t;let r=new Map((e.overrides??[]).map(d=>[d.index,d])),o=(d,p,m,l)=>{let f=r.get(d),h=Gr(f),y=f?.label??`${e.label}-${d+1}`,b=e.displayLabel??e.label;return{index:d,label:y,displayLabel:f?.displayLabel??`${b}-${d+1}`,x:p+(f?.dx??0),y:m+(f?.dy??0),categoryKey:f?.categoryKey??e.categoryKey,skipped:!!f?.skip,accessible:h.length>0,accessibility:h,wheelchairSpaceType:f?.wheelchairSpaceType,commercial:f?.commercial,glyph:f?.glyph,viewUrl:f?.viewFromSeatUrl,viewMeta:f?.viewFromSeatUrl?f.viewFromSeatMeta:void 0,labelStyle:f?.labelStyle,...l?{side:l}:{}}};if(e.shape==="round"){let d=(e.radius??40)+Dt,p=e.rotation*ln,m=Math.max(0,Math.min(360,e.seatArc??360));if(m>=360||n===1){for(let y=0;y<n;y++){let b=p+y/n*2*Math.PI;t.push(o(y,e.center.x+d*Math.cos(b),e.center.y+d*Math.sin(b)))}return t}let l=m*ln,f=(2*Math.PI-l)/2,h=p+f;for(let y=0;y<n;y++){let b=h+y/(n-1)*l;t.push(o(y,e.center.x+d*Math.cos(b),e.center.y+d*Math.sin(b)))}return t}let i=e.width??80,a=e.height??50,s=rl(e),c=["top","bottom","left","right"],u=0;for(let d of c){let p=s[d];for(let m=0;m<p;m++){let l,f;d==="top"?(l=-i/2+(m+.5)*i/p,f=-a/2-Dt):d==="bottom"?(l=-i/2+(m+.5)*i/p,f=a/2+Dt):d==="left"?(l=-i/2-Dt,f=-a/2+(m+.5)*a/p):(l=i/2+Dt,f=-a/2+(m+.5)*a/p);let h=so(l,f,e.rotation,e.center);t.push(o(u++,h.x,h.y,d))}}return t}function al(e){return il(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 sl(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 Or(e,t){let n=!1;for(let r=0,o=t.length-1;r<t.length;o=r++){let i=t[r].x,a=t[r].y,s=t[o].x,c=t[o].y;a>e.y!=c>e.y&&e.x<(s-i)*(e.y-a)/(c-a)+i&&(n=!n)}return n}function cl(e,t){return t.some((n,r)=>{let o=t[(r+1)%t.length],i=(e.y-n.y)*(o.x-n.x)-(e.x-n.x)*(o.y-n.y);if(Math.abs(i)>1e-7)return!1;let a=(e.x-n.x)*(o.x-n.x)+(e.y-n.y)*(o.y-n.y),s=(o.x-n.x)**2+(o.y-n.y)**2;return a>=-1e-7&&a<=s+1e-7})}function ot(e,t,n){return Or(e,t)&&!(n??[]).some(r=>Or(e,r)||cl(e,r))}function ao(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 ll(e){switch(e.type){case"row":{let t=zr(e);if(!t.length)return{x:e.origin.x,y:e.origin.y};let n=0,r=0;for(let o of t)n+=o.x,r+=o.y;return{x:n/t.length,y:r/t.length}}case"table":case"booth":return{x:e.center.x,y:e.center.y};case"gaArea":return ao(e.points);case"section":return ao(e.outline);case"text":return{x:e.position.x,y:e.position.y};case"shape":return e.points&&e.points.length?ao(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 Vr(e,t){return e.length===t.length&&e.every((n,r)=>n.x===t[r].x&&n.y===t[r].y)}function ul(e,t){if(e.type!=="gaArea"||!Vr(e.points,t.outline))return!1;let n=e.holes??[],r=t.holes??[];return n.length===r.length&&n.every((o,i)=>Vr(o,r[i]))}function dl(e,t){let n=e.filter(a=>a.type==="section"),r="referenceInventorySource"in t?t.referenceInventorySource?.logicalSectionId:void 0,o=ll(t);return(r?n.find(a=>(a.logicalSectionId??a.id)===r&&(ul(t,a)||ot(o,a.outline,a.holes))):void 0)??n.find(a=>ot(o,a.outline,a.holes))}function Dr(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 Br(e,t,n,r,o,i,a,s,c){let u=[],d=Mr(e),p=f=>!f?.eventConfigurationId||f.eventConfigurationId===r&&(f.eventConfigurationVersion===void 0||f.eventConfigurationVersion===c),m=f=>Rr(f,{activeConfigurationId:r,activeConfigurationVersion:c,activeBasisSha256:o,now:s}),l=(f,h)=>m(f)?{...f,coverage:h}:void 0;for(let f of e){let h=[];if(f.type==="row"?h=zr(f):f.type==="table"?h=al(f):f.type==="booth"&&(h=sl(f)),!h.length)continue;for(let v of h)v.viewUrl&&!p(v.viewMeta)&&(v.viewUrl=void 0,v.viewMeta=void 0);if(f.type==="row"){let v=d.get(f.id);if(v){let P=new Map((f.overrides??[]).map(S=>[S.index,S]));for(let S of h){let C=Number(S.id.slice(S.id.lastIndexOf(":")+1));if(!Number.isInteger(C))continue;S.logicalRowId=v.groupId,S.logicalSeatIndex=v.adjacencyOffset+C,P.get(C)?.displayLabel||(S.displayLabel=to(f,C,v)),!S.viewUrl&&v.viewFromSeatUrl&&p(v.viewFromSeatMeta)&&(S.viewUrl=v.viewFromSeatUrl,S.viewMeta=v.viewFromSeatMeta);let T=P.get(C)?.confidenceEvidence;S.confidenceEvidence=l(T,"exact-seat")??l(f.confidenceEvidence,"row-representative")??l(v.confidenceEvidence,"row-representative")}}}let y=dl(e,f),b=y?.viewFromSeatUrl,g=(y?.zone?t?.find(v=>v.id===y.zone):void 0)?.focalPoint??n;for(let v of h){if(!v.confidenceEvidence){let P=Number(v.id.slice(v.id.lastIndexOf(":")+1)),S=(f.type==="row"||f.type==="table")&&Number.isInteger(P)?f.overrides?.find(C=>C.index===P)?.confidenceEvidence:void 0;v.confidenceEvidence=l(S,"exact-seat")??(f.type==="row"?l(f.confidenceEvidence,"row-representative"):void 0)}v.confidenceEvidence??=l(y?.confidenceEvidence,"section-representative")??(a?l(a.evidence,a.coverage):void 0),!v.viewUrl&&b&&p(y?.viewFromSeatMeta)&&(v.viewUrl=b,v.viewMeta=y?.viewFromSeatMeta),!v.viewUrl&&i&&p(i.meta)&&(v.viewUrl=i.url,v.viewMeta=i.meta),y&&(v.sectionId=y.logicalSectionId??y.id),y?.zone&&(v.zoneId=y.zone),g&&(v.focalPoint={...g})}u.push(...h)}return u}function Hr(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=Br(o.objects,e.zones,i,e.eventConfigurationId,e.confidenceBasisSha256,a,s,t.now,t.eventConfigurationVersion??e.eventConfigurationVersion);t.resolveEyeHeights!==!1&&Nr(o.objects,o.focalPoint??e.focalPoint,o.baseHeightM??0,c);for(let u of c)u.floorId=o.id;r.push(...c)}return r}let n=Br(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&&Nr(e.objects,e.focalPoint,t.floorBaseHeightM??0,n),ml(e,n,t)}function ml(e,t,n){return!n.deriveRestrictedView||e.derivedRestrictedView===!1||n.resolveEyeHeights===!1||Fr(t,Lr(t,kr(e))),t}function Nr(e,t,n,r){let o=e.filter(d=>d.type==="section"),i=n>0||o.some(d=>d.height!==void 0||d.rake!==void 0||(d.elevation??0)>0);if(!o.length||!i||!t){for(let d of r)d.eyeHeightM=n+Ee;return}let a=new Array(r.length),s=new Map,c=new Map;for(let d=0;d<r.length;d++){let p=r[d],l=(p.sectionId?o.find(h=>h.id===p.sectionId)??o.find(h=>h.logicalSectionId===p.sectionId&&ot({x:p.x,y:p.y},h.outline,h.holes)):void 0)??o.find(h=>ot({x:p.x,y:p.y},h.outline,h.holes))??null;if(a[d]=l,!l)continue;s.has(l.id)||s.set(l.id,Jt(l,{floorBaseHeightM:n}));let f=c.get(l.id);f?f.push(d):c.set(l.id,[d])}let u=new Array(r.length).fill(void 0);for(let[d,p]of c){let m=s.get(d);if(!m)continue;let l=m.rake>0?Math.tan(m.rake*Math.PI/180):0,f=sn(d,r,p,t);for(let h of f.rows){let y=h.blockDepth*he*l,b=m.height+y;for(let x of h.seatIndices)u[x]=b}}for(let d=0;d<r.length;d++){let p=r[d],m=a[d];if(!m){p.eyeHeightM=n+Ee;continue}let l=s.get(m.id);p.eyeHeightM=(u[d]??l.height)+Ee}}function fl(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 pl(e,t){if(!e.length)return null;let n=0,r=0,o=0;for(let l of e)n+=l.x,r+=l.y,o+=Math.hypot(l.x-t.x,l.y-t.y);let i=e.length;n/=i,r/=i,o/=i;let a=e[0],s=-1;for(let l of e){let f=Math.hypot(l.x-n,l.y-r);f>s&&(s=f,a=l)}let c=a.x-n,u=a.y-r,d=Math.hypot(c,u);d>1e-9?(c/=d,u/=d):(c=1,u=0);let p=[...e].sort((l,f)=>(l.x-n)*c+(l.y-r)*u-((f.x-n)*c+(f.y-r)*u)),m=0;for(let l of p){let f=Math.hypot(l.x-n,l.y-r);f>m&&(m=f)}return{pts:p,cx:n,cy:r,radius:m,depth:o}}function Ur(e,t,n){let r=e.pts;if(r.length===1)return Math.hypot(t-r[0].x,n-r[0].y);let o=1/0;for(let i=0;i+1<r.length;i++){let a=r[i],s=r[i+1],c=s.x-a.x,u=s.y-a.y,d=c*c+u*u,p=d>1e-12?((t-a.x)*c+(n-a.y)*u)/d:0;p<0?p=0:p>1&&(p=1);let m=Math.hypot(t-(a.x+p*c),n-(a.y+p*u));m<o&&(o=m)}return o}var un=8;function hl(e,t,n){let r=new Array(un).fill(1/0),o=new Array(un).fill(-1);for(let d=0;d<e.length;d++){let p=e[d],m=Math.hypot(t-p.cx,n-p.cy)-p.radius;for(let l=0;l<un;l++)if(m<r[l]){for(let f=un-1;f>l;f--)r[f]=r[f-1],o[f]=o[f-1];r[l]=m,o[l]=d;break}}let i=new Array(3).fill(1/0),a=new Array(3).fill(-1);for(let d of o){if(d<0)continue;let p=Ur(e[d],t,n);for(let m=0;m<3;m++)if(p<i[m]){for(let l=2;l>m;l--)i[l]=i[l-1],a[l]=a[l-1];i[m]=p,a[m]=d;break}}if(a[0]<0)return 0;if(i[0]<1e-6)return e[a[0]].depth;let s=i[0]*2.2,c=0,u=0;for(let d=0;d<3;d++){let p=a[d];if(p<0||i[d]>s)continue;let m=1/(i[d]*i[d]);c+=m*e[p].depth,u+=m}return u>0?c/u:e[a[0]].depth}function bl(e){let t=(r,o)=>hl(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=Ur(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 jr(e,t){let n=[];for(let r of e){let o=pl(r.points,t);o&&n.push(o)}return n.length<2?fl(t):(n.sort((r,o)=>r.depth-o.depth),bl(n))}var uo=lt(require("polygon-clipping"),1);var Kr=lt(require("earcut"),1);var yl=.58,Yr=.01,we=De*1.5*Ue,gl=.5,xl=.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,p=Math.hypot(u,d);if(p<1e-9){r.push([0,0]);continue}u/=p,d/=p,r.push([-d,u])}let o=0;for(let a=0;a<n;a++)o+=(e[a].x-t.x)*r[a][0]+(e[a].y-t.y)*r[a][1];return o<0?r.map(([a,s])=>[-a,-s]):r}function Sl(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 Xr=Math.PI/12;function Ml(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 qr(e,t){if(!e.length||!(t>0))return[];let n=Ml(e),r=(s,c,u,d)=>{let p=u-c;for(;p<0;)p+=Math.PI*2;for(;p>Math.PI*2;)p-=Math.PI*2;let m=Math.max(1,Math.ceil(p/Xr)),l=t/Math.cos(p/m/2);for(let f=0;f<=m;f++){let h=c+p*f/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=[],p=Math.max(3,Math.ceil(Math.PI*2/Xr)),m=(u+t)/Math.cos(Math.PI/p);for(let l=0;l<p;l++){let f=l/p*Math.PI*2;d.push({x:s+Math.cos(f)*m,y:c+Math.sin(f)*m})}return d}let o=n.length,i=[];for(let s=0;s<o;s++){let c=n[s],u=n[(s+1)%o];i.push(Math.atan2(-(u.x-c.x),u.y-c.y))}let a=[];for(let s=0;s<o;s++)r(n[s],i[(s+o-1)%o],i[s],a);return ei(a)}function wl(e,t,n){if(e.length===1)return Math.hypot(t-e[0].x,n-e[0].y);let r=1/0;for(let o=0;o+1<e.length;o++){let i=e[o],a=e[o+1],s=a.x-i.x,c=a.y-i.y,u=s*s+c*c,d=u>1e-12?((t-i.x)*s+(n-i.y)*c)/u:0;d<0?d=0:d>1&&(d=1);let p=Math.hypot(t-(i.x+d*s),n-(i.y+d*c));p<r&&(r=p)}return r}function dn(e){let t=e.map(o=>{let i=0,a=0;for(let u of o.pts)i+=u.x,a+=u.y;let s=o.pts.length||1;i/=s,a/=s;let c=0;for(let u of o.pts){let d=Math.hypot(u.x-i,u.y-a);d>c&&(c=d)}return{cx:i,cy:a,rad:c}}),n=o=>{let i=o.length;return i<=2?[...o]:[o[Math.floor(i*.25)],o[Math.floor(i*.5)],o[Math.floor(i*.75)]]},r=[];for(let o=0;o<e.length;o++){let i=n(e[o].pts),a=[],s=1/0,c=null;for(let d of i){let p=1/0;for(let m=0;m<e.length;m++){if(m===o||Math.abs(e[m].y-e[o].y)<.001)continue;let l=t[m],f=Math.hypot(d.x-l.cx,d.y-l.cy)-l.rad;if(f>=p&&f>=s)continue;let h=wl(e[m].pts,d.x,d.y);h<p&&(p=h),e[m].depth<e[o].depth&&h<s&&(s=h,c=e[m].y)}Number.isFinite(p)&&p>0&&a.push(p)}a.sort((d,p)=>d-p);let u=a.length?a[Math.floor(a.length/2)]:1;r.push({pitch:u,belowY:c})}return r}function Qr(e,t,n,r){let o=e[t],i=o.pts.length>=2?[...o.pts]:o.pts.length===1?(()=>{let d=o.pts[0],p=d.x-r.x,m=d.y-r.y,l=Math.hypot(p,m)||1;p/=l,m/=l;let f=Math.max(n[t].pitch,.001)*.5;return[{x:d.x+m*f,y:d.y-p*f},{x:d.x-m*f,y:d.y+p*f}]})():[];if(i.length<2)return null;let a=0,s=0;for(let d=1;d<i.length;d++){let p=Math.hypot(i[d].x-i[d-1].x,i[d].y-i[d-1].y);p>1e-6&&(a+=p,s++)}let c=s>0?a/s:0,u=Sl(i,Math.max(c*xl,we));return{pts:u,nrm:vl(u,r),front:Math.max(n[t].pitch*yl,we),back:Math.max(n[t].pitch*gl,we)}}var bt=1.5,Zr=.3;function co(e,t){if(e.length<3)return e;let n=e[0],r=e[e.length-1],o=r.x-n.x,i=r.y-n.y,a=Math.hypot(o,i),s=-1,c=-1;for(let p=1;p<e.length-1;p++){let m=e[p],l=a>1e-12?Math.abs((m.x-n.x)*i-(m.y-n.y)*o)/a:Math.hypot(m.x-n.x,m.y-n.y);l>s&&(s=l,c=p)}if(s<=t||c<0)return[n,r];let u=co(e.slice(0,c+1),t),d=co(e.slice(c),t);return[...u.slice(0,-1),...d]}function $r(e,t){if(e.length<4)return e;let n=co([...e,e[0]],t);return n.pop(),n.length>=3?n:e}function Jr(e,t,n){if(e.length<2)return[];let r=n??dn(e),o=new Map;for(let a=0;a<e.length;a++){let s=o.get(e[a].blockId);s?s.push(a):o.set(e[a].blockId,[a])}let i=[];for(let[,a]of o){let s=[];for(let x of a){let g=e[x].patch;g&&g.length>=3?i.push({outline:[...g],holes:[],topY:e[x].y}):s.push(x)}if(!s.length)continue;s.sort((x,g)=>e[x].depth-e[g].depth);let u=s.map(x=>Qr(e,x,r,t)).filter(x=>x!==null);if(!u.length)continue;let d=(x,g)=>({x:x.pts[g].x-x.nrm[g][0]*(x.front+bt),y:x.pts[g].y-x.nrm[g][1]*(x.front+bt)}),p=(x,g)=>({x:x.pts[g].x+x.nrm[g][0]*(x.back+bt),y:x.pts[g].y+x.nrm[g][1]*(x.back+bt)}),m=u[0],l=u[u.length-1],f=[];for(let x=0;x<m.pts.length;x++)f.push(d(m,x));for(let x of u)f.push(p(x,x.pts.length-1));for(let x=l.pts.length-1;x>=0;x--)f.push(p(l,x));for(let x=u.length-1;x>=0;x--)f.push(d(u[x],0));let h=ei(f),y=1/0;for(let x of s)e[x].y<y&&(y=e[x].y);if(!Number.isFinite(y))continue;if(h.length>=3&&Math.abs(et(h))>1e-6&&u.every(x=>{let g=x.pts[Math.floor(x.pts.length/2)];return Tt(h,g.x,g.y)})){i.push({outline:$r(h,Zr),holes:[],topY:y});continue}for(let x of Pl(u))i.push({outline:x,holes:[],topY:y})}return i}function Pl(e){let t=[];for(let n of e){let r=[],o=[],i=n.front+bt,a=n.back+bt;for(let c=0;c<n.pts.length;c++){let u=n.pts[c],d=n.nrm[c];r.push([u.x-d[0]*i,u.y-d[1]*i]),o.push([u.x+d[0]*a,u.y+d[1]*a])}let s=[...r,...o.reverse()];s.length<3||(s.push(s[0]),t.push([s]))}if(!t.length)return[];try{let n=uo.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($r(i,Zr))}return r}catch{return[]}}function ei(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 lo=class{constructor(t){this.minX=1/0;this.minY=1/0;this.maxX=-1/0;this.maxY=-1/0;this.rings=t;for(let n of t)for(let r of n)r.x<this.minX&&(this.minX=r.x),r.y<this.minY&&(this.minY=r.y),r.x>this.maxX&&(this.maxX=r.x),r.y>this.maxY&&(this.maxY=r.y)}containsAll(t){for(let n of t)if(n.x<this.minX||n.x>this.maxX||n.y<this.minY||n.y>this.maxY)return!1;for(let n of this.rings){let r=!0;for(let o of t)if(!Tt(n,o.x,o.y)){r=!1;break}if(r)return!0}return!1}};function Wr(e,t,n,r,o,i){if(r.length<3)return;if(n.containsAll(r)){let u=[0,1,0],d=r[0];for(let p=1;p+1<r.length;p++){let m=r[p],l=r[p+1];e.tri([d.x*G,o,d.y*G],[m.x*G,o,m.y*G],[l.x*G,o,l.y*G],u,i)}return}let a=r.map(u=>[u.x,u.y]);a.push(a[0]);let s;try{s=uo.default.intersection([a],t)}catch{return}let c=[0,1,0];for(let u of s){if(!u.length||u[0].length<4)continue;let d=u[0],p=[],m=[];for(let f=0;f<d.length-1;f++)p.push(d[f][0],d[f][1]),m.push([d[f][0],d[f][1]]);if(m.length<3)continue;let l=(0,Kr.default)(p,void 0,2);for(let f=0;f<l.length;f+=3){let h=m[l[f]],y=m[l[f+1]],b=m[l[f+2]];e.tri([h[0]*G,o,h[1]*G],[y[0]*G,o,y[1]*G],[b[0]*G,o,b[1]*G],c,i)}}}function ti(e,t,n,r,o,i,a){if(t.length<2)return;let s=a??dn(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 lo([[...i]]):null,p=l=>{e.setMaterial(2),l(),e.setMaterial(0)},m=l=>{e.setMaterial(3),l(),e.setMaterial(0)};for(let l=0;l<t.length;l++){let f=t[l];if(f.patch&&f.patch.length>=3){let P=[...f.patch],S=s[l].belowY??r;if(m(()=>{if(u&&d)Wr(e,u,d,P,f.y,o.tread);else{let C=P[0];for(let T=1;T+1<P.length;T++){let B=P[T],z=P[T+1];e.tri([C.x*G,f.y,C.y*G],[B.x*G,f.y,B.y*G],[z.x*G,f.y,z.y*G],c,o.tread)}}}),f.y>S+Yr){let C=0,T=0;for(let B of P)C+=B.x,T+=B.y;C/=P.length,T/=P.length,p(()=>{for(let B=0;B<P.length;B++){let z=P[B],D=P[(B+1)%P.length],k=D.x-z.x,A=D.y-z.y,_=Math.hypot(k,A);if(_<1e-6)continue;let V=A/_,M=-k/_;(z.x-C)*V+(z.y-T)*M<0&&(V=-V,M=-M);let R=[V,0,M],E=[z.x*G,f.y,z.y*G],w=[D.x*G,f.y,D.y*G],L=[z.x*G,S,z.y*G],I=[D.x*G,S,D.y*G];e.tri(E,w,I,R,o.riser),e.tri(E,I,L,R,o.riser)}})}continue}let h=Qr(t,l,s,n);if(!h)continue;let{pts:y,nrm:b,front:x,back:g}=h,v=s[l].belowY??r;for(let P=0;P+1<y.length;P++){let S=y[P],C=y[P+1],T=b[P],B=b[P+1];if(Math.hypot(C.x-S.x,C.y-S.y)<1e-6||T[0]===0&&T[1]===0||B[0]===0&&B[1]===0)continue;let z=[(S.x-T[0]*x)*G,f.y,(S.y-T[1]*x)*G],D=[(C.x-B[0]*x)*G,f.y,(C.y-B[1]*x)*G],k=[(S.x+T[0]*g)*G,f.y,(S.y+T[1]*g)*G],A=[(C.x+B[0]*g)*G,f.y,(C.y+B[1]*g)*G];if(m(()=>{u&&d?Wr(e,u,d,[{x:S.x-T[0]*x,y:S.y-T[1]*x},{x:C.x-B[0]*x,y:C.y-B[1]*x},{x:C.x+B[0]*g,y:C.y+B[1]*g},{x:S.x+T[0]*g,y:S.y+T[1]*g}],f.y,o.tread):(e.tri(z,D,A,c,o.tread),e.tri(z,A,k,c,o.tread))}),f.y>v+Yr){let _=[z[0],v,z[2]],V=[D[0],v,D[2]],M=[-T[0],0,-T[1]];p(()=>{e.tri(z,D,V,M,o.riser),e.tri(z,V,_,M,o.riser)})}}}}function ni(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 mn(e,t){return e.minX<=t.maxX&&t.minX<=e.maxX&&e.minY<=t.maxY&&t.minY<=e.maxY}var mo=lt(require("polygon-clipping"),1);function Cl(e,t){let n=e.eventConfigurationIds;return!n?.length||!!t&&n.includes(t)}function oi(e,t){return e.filter(n=>n.type!=="shape"||Cl(n,t))}function ri(e,t){let n=e.focalPoint??{x:0,y:0};return e.floors?.length?e.floors.map((r,o)=>({objects:oi(r.objects,t),focal:{x:(r.focalPoint??n).x,y:(r.focalPoint??n).y},baseHeightM:r.baseHeightM??0,index:o})):[{objects:oi(e.objects,t),focal:n,baseHeightM:0,index:0}]}var Al={minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};function yt(e){return ni(e)??Al}function ii(e,t){let n=on(e.outline,we),r=yt(n),o=t.filter(a=>a!==e&&a.outline&&a.outline.length>=3&&mn(r,yt(a.outline)));if(!o.length)return[n];let i=a=>{let s=a.map(c=>[c.x,c.y]);return s.push(s[0]),s};try{let a=mo.default.difference([i(n)],...o.map(c=>[i(c.outline)])),s=[];for(let c of a){if(!c.length)continue;let u=c[0].map(([d,p])=>({x:d,y:p}));if(u.length>1){let d=u[0],p=u[u.length-1];Math.abs(d.x-p.x)<1e-9&&Math.abs(d.y-p.y)<1e-9&&u.pop()}u.length>=3&&s.push(u)}return s.length?s:[n]}catch{return[n]}}function ai(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=mo.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 Rl=.05,si=.05,Il=.15,fo=25;function ci(e,t,n){let r=new Map,o=new Array(t.length).fill(null),i=new Float64Array(t.length),a=new Array(t.length).fill(void 0),s=new Array(t.length).fill(void 0),c=new Map,u=[],d=new Set;for(let m=0;m<e.length;m+=1){let l=e[m];for(let f of l.objects){if(f.type==="table"&&d.add(f.id),f.type!=="section"||!f.outline||f.outline.length<3)continue;let h=on(f.outline,we);c.set(f.id,{section:f,unit:l,frontU:1/0,hasSeats:!1,rows:new Map,seatIndices:[]}),u.push({id:f.id,floorIndex:m,box:yt(h),section:f,unit:l,outline:h})}}let p=new Map;for(let m of u){let l=p.get(m.floorIndex);l?l.push(m):p.set(m.floorIndex,[m])}for(let m=0;m<t.length;m++){let l=t[m],f=n?p.get(n[m])??[]:u,h=l.sectionId?f.find(b=>b.id===l.sectionId)??f.find(b=>b.section.logicalSectionId===l.sectionId&&ot({x:l.x,y:l.y},b.outline,b.section.holes)):void 0,y=h?[h]:f;for(let b of y){if(n&&b.floorIndex!==n[m]||!h&&(l.x<b.box.minX||l.x>b.box.maxX||l.y<b.box.minY||l.y>b.box.maxY||!ot({x:l.x,y:l.y},b.outline,b.section.holes)))continue;o[m]=b.id;let x=c.get(b.id);x.hasSeats=!0;let g=l.focalPoint??b.unit.focal,v=Math.hypot(l.x-g.x,l.y-g.y);v<x.frontU&&(x.frontU=v),x.seatIndices.push(m);let P=l.rowId||`__seat-${m}`,S=x.rows.get(P);S?S.push({x:l.x,y:l.y}):x.rows.set(P,[{x:l.x,y:l.y}]);break}}for(let[m,l]of c){let f=Jt(l.section,{floorBaseHeightM:l.unit.baseHeightM}),h=l.unit.baseHeightM,y=f.rake>0?Math.tan(f.rake*Math.PI/180):0,b=f.rake<=.01&&f.height<=h+.001,x=l.section.surfaceKind,g=x==="flat"?!0:x==="rakedRows"&&f.rake>.01?!1:b,v=l.hasSeats?sn(m,t,l.seatIndices,l.unit.focal):{sectionId:m,rows:[],blockCount:0},S=v.rows.length<2?jr([...l.rows.values()].map(E=>({points:E})),l.unit.focal):null,C=1/0;if(S){if(l.hasSeats)for(let E of l.rows.values())for(let w of E){let L=S.depthAt(w.x,w.y);L<C&&(C=L)}if(!l.hasSeats||!Number.isFinite(C)){C=1/0;for(let E of l.section.outline){let w=S.depthAt(E.x,E.y);w<C&&(C=w)}}}let T=h+Rl,B=Math.max(T,f.height),z=E=>{let w=Math.max(0,E-C)*he,L=Math.min(w*y,fo);return Math.max(T,f.height+L)},D=E=>{let w=Math.max(0,E)*he,L=Math.min(w*y,fo);return Math.max(T,f.height+L)},k=g?[]:v.rows.map(E=>({pts:E.pts,y:D(E.blockDepth),depth:E.blockDepth,blockId:E.blockId,...d.has(E.id)?{patch:qr(E.pts,we)}:{}})),A=k.length?k[0].y:B,_=k.map(E=>{let w=E.patch&&E.patch.length>=3?E.patch:E.pts,L=0,I=0;for(let U of w)L+=U.x,I+=U.y;let O=w.length||1;L/=O,I/=O;let j=0;for(let U of w){let N=Math.hypot(U.x-L,U.y-I);N>j&&(j=N)}return{cx:L,cy:I,rad:j}}),V=g?()=>B:k.length>=2?(E,w)=>{let L=1/0,I=A;for(let O=0;O<k.length;O++){let j=_[O];if(Math.hypot(E-j.cx,w-j.cy)-j.rad>=L)continue;let U=k[O].patch,N=U&&U.length>=3?Tt(U,E,w)?0:pt(U,E,w):pt(k[O].pts,E,w);N<L&&(L=N,I=k[O].y)}return I}:(E,w)=>S?z(S.depthAt(E,w)):B,M=[0,1,0],R=k.length>=2||g?()=>M:(E,w)=>{if(!S)return M;let L=S.depthAt(E,w);if(L<=C)return M;let I=(L-C)*he;if(I*y>=fo||f.height+I*y<=T)return M;let[O,j]=S.gradientAt(E,w);if(O===0&&j===0)return M;let U=1/Math.hypot(y,1);return[-O*y*U,U,-j*y*U]};if(!g)for(let E of v.rows){let w=D(E.blockDepth);for(let L of E.seatIndices)a[L]=w}for(let E of v.rows){let w=[];for(let U=1;U<E.pts.length;U++){let N=Math.hypot(E.pts[U].x-E.pts[U-1].x,E.pts[U].y-E.pts[U-1].y);N>1e-6&&w.push(N)}w.sort((U,N)=>U-N);let L=w.length?w[Math.floor(w.length/2)]:1/0,I=1/0,O=E.pts[Math.floor(E.pts.length/2)];if(O)for(let U of v.rows){if(U===E||U.blockId!==E.blockId)continue;let N=pt(U.pts,O.x,O.y);N>1e-6&&N<I&&(I=N)}let j=Math.min(L,Math.max(I,L*.5));if(Number.isFinite(j)&&j>0)for(let U of E.seatIndices)s[U]=j}r.set(m,{sectionId:m,deckAt:V,normalAt:R,flat:g,bottomY:h,rowLevels:k,landingY:A})}for(let m=0;m<t.length;m++){let l=o[m],f=t[m];if(l){let y=a[m];i[m]=(y??r.get(l).deckAt(f.x,f.y))+Il;continue}let h=f.eyeHeightM;i[m]=Number.isFinite(h)?Math.max(0,h-Ee):0}return{bySection:r,seatOwner:o,seatDeckY:m=>i[m],seatPitchU:m=>s[m]}}var le={top:1,wallBottom:.5,bottomCap:.4};function Oe(e,t){if(!e)return t;let n=Me(At(e,.4),.62);return ge(t,n,.72)}function li(e,t){let n=new Map;for(let i of e.categories??[])n.set(i.key,i.color);let r=new Map;for(let i of t){if(!i.sectionId)continue;let a=r.get(i.sectionId);a||(a=new Map,r.set(i.sectionId,a)),a.set(i.categoryKey,(a.get(i.categoryKey)??0)+1)}let o=new Map;for(let[i,a]of r){let s=0,c=0,u=0,d=0;for(let[p,m]of a){let l=ne(n.get(p));l&&(s+=l[0]*m,c+=l[1]*m,u+=l[2]*m,d+=m)}d>0&&o.set(i,[s/d,c/d,u/d])}return o}function ui(e,t){return ne(e.color)??t.get(e.logicalSectionId??e.id)??null}var di=lt(require("polygon-clipping"),1);function El(e,t){return e===void 0||t===void 0?!0:Math.abs(e-t)<.001}var fn=class{constructor(){this.rings=[];this.boxes=[];this.levels=[]}subtract(t,n){let r=t.map(c=>[c.x,c.y]);if(r.length<3)return[];r.push(r[0]);let o=yt(t),i=this.rings.filter((c,u)=>mn(o,this.boxes[u])&&El(n,this.levels[u])),a=[[r]];if(i.length)try{a=di.default.difference([r],...i).map(u=>u.map(d=>d.map(([p,m])=>[p,m])))}catch{a=[[r]]}this.rings.push([r]),this.boxes.push(o),this.levels.push(n);let s=[];for(let c of a){if(!c.length)continue;let u=c[0].map(([d,p])=>({x:d,y:p}));if(u.length>1){let d=u[0],p=u[u.length-1];Math.abs(d.x-p.x)<1e-9&&Math.abs(d.y-p.y)<1e-9&&u.pop()}u.length>=3&&s.push(u)}return s}};function Tl(e,t){if(!t)return e;let n=1/0,r=-1/0,o=1/0,i=-1/0;for(let p of e)n=Math.min(n,p.x),r=Math.max(r,p.x),o=Math.min(o,p.y),i=Math.max(i,p.y);let a=(n+r)/2,s=(o+i)/2,c=t*Math.PI/180,u=Math.cos(c),d=Math.sin(c);return e.map(p=>{let m=p.x-a,l=p.y-s;return{x:a+m*u-l*d,y:s+m*d+l*u}})}function rt(e){let t=null;if(e.kind==="polygon"&&e.points&&e.points.length>=3&&(t=e.points),e.kind==="rect"&&e.width&&e.height&&(t=Lt(e.x??0,e.y??0,e.width,e.height)),e.kind==="ellipse"&&e.width&&e.height){let n=(e.x??0)+e.width/2,r=(e.y??0)+e.height/2;t=rn(n,r,e.width/2,e.height/2)}return t?Tl(t,e.rotation):null}function Ot(e){let t=e.role??"",n={stage:{kind:"stage",heightM:1},entrance:{kind:"portal",heightM:2.7},exit:{kind:"portal",heightM:2.7},screen:{kind:"solid",heightM:6},wall:{kind:"solid",heightM:2.8},rail:{kind:"solid",heightM:1.1},suite:{kind:"suite",heightM:3},obstruction:{kind:"solid",heightM:4.5},sound:{kind:"solid",heightM:1.45},restroom:{kind:"solid",heightM:2.4},bar:{kind:"solid",heightM:1.1},concession:{kind:"solid",heightM:1.1},coat:{kind:"solid",heightM:1.1},goal:{kind:"portal",heightM:1.8}},r=t==="stage"&&cn(e.stageKind)?{kind:"stage",heightM:.06}:n[t]??{kind:"plate",heightM:.25};return{...r,heightM:e.heightM??r.heightM}}var _l=.08;function mi(e,t){let n=rt(e),r=Ot(e),o=r.heightM;if(!n||r.kind!=="plate"&&r.kind!=="stage")return o;let i=1/0,a=1/0,s=-1/0,c=-1/0;for(let d of n)i=Math.min(i,d.x),a=Math.min(a,d.y),s=Math.max(s,d.x),c=Math.max(c,d.y);let u=o;for(let d of t)s>d.minX&&i<d.maxX&&c>d.minY&&a<d.maxY&&u<=d.topOffsetM+1e-6&&(u=d.topOffsetM+_l);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 fi(e){if(e.length!==4)return e;let t=Math.hypot(e[1].x-e[0].x,e[1].y-e[0].y),n=Math.hypot(e[2].x-e[1].x,e[2].y-e[1].y);return t>=n?e:[e[1],e[2],e[3],e[0]]}function Vt(e,t,n){return[je(e[0],e[1],t),je(e[0],e[1],n),je(e[3],e[2],n),je(e[3],e[2],t)]}function pi(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 po=2.4,kl=.75,Ll=.15;function Bt(e){if(e.points&&e.points.length>=3)return e.points;let{center:t,width:n,height:r,rotation:o}=e;if(!n||!r)return null;let i=(o??0)*Math.PI/180,a=Math.cos(i),s=Math.sin(i),c=n/2,u=r/2;return[[-c,-u],[c,-u],[c,u],[-c,u]].map(([d,p])=>({x:t.x+d*a-p*s,y:t.y+d*s+p*a}))}function hi(e,t,n,r,o){let i=Bt(t);i&&ue(e,i,void 0,()=>n+po,n,Oe(r,o.boothTop),o.boothWall,le)}function ho(e){if(e.shape==="round"){let d=e.radius;return d?rn(e.center.x,e.center.y,d,d,24):null}let{width:t,height:n,rotation:r,center:o}=e;if(!t||!n)return null;let i=(r??0)*Math.PI/180,a=Math.cos(i),s=Math.sin(i),c=t/2,u=n/2;return[[-c,-u],[c,-u],[c,u],[-c,u]].map(([d,p])=>({x:o.x+d*a-p*s,y:o.y+d*s+p*a}))}function bi(e,t,n,r,o){let i=ho(t);i&&ue(e,i,void 0,()=>n+kl,n,Oe(r,o.tableTop),o.tableWall,le)}function yi(e,t,n,r,o,i,a,s){let c=rt(t);if(!c)return;let u=s?s.kind==="stage":t.role==="stage",d=s?s.kind==="screen":t.role==="screen",p=s?{kind:u?"stage":"solid",heightM:s.topY-s.baseY}:Ot(t),m=s?.baseY??n,l=s?.topY??n+r;if(u&&a){let x=1/0,g=-1/0,v=1/0,P=-1/0;for(let S of c)S.x<x&&(x=S.x),S.x>g&&(g=S.x),S.y<v&&(v=S.y),S.y>P&&(P=S.y);a.push({cx:(x+g)/2*G,cz:(v+P)/2*G,y:l,halfX:Math.max((g-x)/2*G,.5),halfZ:Math.max((P-v)/2*G,.5)})}let f=ne(t.fill),h=u&&f?ge(o.stageTop,Me(At(f,.18),.9),.9):Oe(f,u?o.stageTop:o.decorTop),y=d?f:null,b=u?f?ge(o.stageWall,Me(f,.58),.82):o.stageWall:d?y?ge(Me(y,1.42),[.24,.46,.82],.08):[.24,.46,.82]:Oe(ne(t.fill),o.decorWall);if(p.kind==="portal"&&c.length===4){let x=fi(c);Ve(e,Vt(x,0,.16),l,m,h,b),Ve(e,Vt(x,.84,1),l,m,h,b),Ve(e,x,l,Math.max(m,l-.35),h,b);return}if(p.kind==="suite"&&c.length===4){let x=c.map((P,S)=>{let C=c[(S+1)%4],T=(P.x+C.x)/2,B=(P.y+C.y)/2;return Math.hypot(T-i.x,B-i.y)}),g=x.indexOf(Math.min(...x)),v=[0,1,2,3].map(P=>c[(g+P)%4]);Ve(e,Vt(v,0,.08),l,m,h,b),Ve(e,Vt(v,.92,1),l,m,h,b),Ve(e,pi(v,.88,1),l,m,h,b),Ve(e,v,l,Math.max(m,l-.18),h,b);return}Ve(e,c,l,m,h,b)}function bo(e){let{x:t,y:n,width:r,height:o}=e;if(!r||!o)return null;let i=t+r/2,a=n+o/2,s=(e.rotation??0)*Math.PI/180,c=Math.cos(s),u=Math.sin(s),d=r/2,p=o/2;return[[-d,-p],[d,-p],[d,p],[-d,p]].map(([m,l])=>({x:i+m*c-l*u,y:a+m*u+l*c}))}function Fl(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 gi(e,t,n,r){if(t.layer==="foreground")return;let o=bo(t);if(!o)return;let i=n+Ll,a=Oe(Fl(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 xi(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 Dl=Math.PI/180,oe=96,Ol=6,Vl=60,Bl=150,vi=.2,Nl=.35;function Gl(e,t){let n=Math.atan2(t.x-e.x,t.y-e.y)/Dl;return n<0?n+360:n}function pn(e){if(!e.length)return NaN;let t=[...e].sort((n,r)=>n-r);return t[Math.floor(t.length/2)]}function hn(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 Si(e,t){let n=e.filter(m=>m.rows.length>=1);if(n.length<1)return null;let r=[],o=0,i=0,a=0;for(let m of n)for(let l of m.rows){for(let f of l.pts)o+=f.x,i+=f.y,a++;if(l.pts.length>=4){let f=oo(l.pts);f&&Number.isFinite(f.cx)&&Number.isFinite(f.cy)&&r.push({x:f.cx,y:f.cy})}}if(!a)return null;let s={x:o/a,y:i/a},c=s;if(r.length>=8){let m=pn(r.map(b=>b.x)),l=pn(r.map(b=>b.y)),f=0;for(let b of n)for(let x of b.rows)for(let g of x.pts){let v=Math.hypot(g.x-s.x,g.y-s.y);v>f&&(f=v)}let h=0,y=f*.2;for(let b of n)for(let x of b.rows)for(let g of x.pts)Math.hypot(g.x-m,g.y-l)<y&&h++;Math.hypot(m-s.x,l-s.y)<=f&&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 f of m.rows)for(let h of f.pts){let y=Math.hypot(h.x-c.x,h.y-c.y),b=Math.min(oe-1,Math.floor(Gl(c,h)/(360/oe)));l.samples.push({r:y,bin:b,levelM:f.levelM}),y<l.rMin&&(l.rMin=y),y>l.rMax&&(l.rMax=y)}l.samples.length&&u.push(l)}if(!u.length)return null;u.sort((m,l)=>m.rMin+m.rMax-(l.rMin+l.rMax));let d=[];for(let m of u){let l=!1;for(let f of d){let h=Math.min(m.rMax,f.rMax)-Math.max(m.rMin,f.rMin),y=Math.min(m.rMax-m.rMin,f.rMax-f.rMin);if(y>1e-9&&h>=Nl*y){f.members.push(m),f.rMin=Math.min(f.rMin,m.rMin),f.rMax=Math.max(f.rMax,m.rMax),l=!0;break}}l||d.push({members:[m],rMin:m.rMin,rMax:m.rMax})}let p=[];for(let m of d){let l=new Array(oe).fill(null);for(let A of m.members)for(let _ of A.samples){let V=l[_.bin];V||(V={samples:[]},l[_.bin]=V),V.samples.push({r:_.r,levelM:_.levelM})}let f=l.map(A=>!!A);if(!f.filter(Boolean).length)continue;let y=[],b=[];for(let A of l){if(!A)continue;let _=1/0,V=-1/0;for(let M of A.samples)M.r<_&&(_=M.r),M.r>V&&(V=M.r);y.push(_),b.push(V)}let x=pn(y),g=pn(b);if(!(x>=vi*g)||!(g>0))continue;let v=[...y].sort((A,_)=>A-_);if(!(v[Math.floor(v.length*.1)]>=vi*g))continue;let S=l.map(A=>{if(!A)return null;let _=[...A.samples].sort((O,j)=>O.r-j.r),V=_[0].r,M=_[_.length-1].r,R=_[0].levelM,E=-1/0;for(let O of _)O.levelM>E&&(E=O.levelM);let w=[];for(let O of _){let j={r:O.r,l:O.levelM};for(;w.length&&Math.abs(w[w.length-1].r-j.r)<1e-9;){if(w[w.length-1].l<=j.l){j.skip=!0;break}w.pop()}if(!j.skip){for(;w.length>=2;){let U=w[w.length-2],N=w[w.length-1];if((N.r-U.r)*(j.l-U.l)-(N.l-U.l)*(j.r-U.r)<=0)w.pop();else break}w.push(j)}}let L=w.map(O=>O.r),I=w.map(O=>O.l);return{inner:V,outer:M,front:R,top:E,profile:{rs:L,ls:I}}}),C=f.slice();for(let A=0;A<oe;A++){if(C[A])continue;let _=-1,V=-1,M=0;for(let F=1;F<=oe;F++){let K=(A-F+oe*2)%oe;if(C[K]){_=K;break}}for(let F=1;F<=oe;F++){let K=(A+F)%oe;if(C[K]){V=K,M=F;break}}if(_<0||V<0)continue;let R=0;for(let F=1;F<=oe;F++){let K=(A-F+oe*2)%oe;if(f[K]){R=F;break}}if(R-1+M>Ol)continue;let w=S[_],L=S[V],I=R/(R+M),O=w.inner+(L.inner-w.inner)*I,j=w.outer+(L.outer-w.outer)*I,U=w.front+(L.front-w.front)*I,N=w.top+(L.top-w.top)*I;S[A]={inner:O,outer:j,front:U,top:N,profile:{rs:[O,j],ls:[U,N]}}}for(let A=0;A<oe;A++)S[A]&&(C[A]=!0);let T=360/oe,B=[],z=C.filter(Boolean).length,D=[];if(z===oe)D.push({start:0,len:oe});else{let A=0;for(;C[A];)A=(A+1)%oe;let _=-1;for(let V=0;V<=oe;V++){let M=(A+V)%oe,R=V<oe&&C[M];if(R&&_<0)_=M;else if(!R&&_>=0){let E=(M-_+oe)%oe||oe;D.push({start:_,len:E}),_=-1}}}for(let A of D){if(A.len*T<Vl&&A.len<oe)continue;let _=A.len===oe,V=new Float64Array(A.len),M=new Float64Array(A.len),R=new Float64Array(A.len),E=new Float64Array(A.len),w=[];for(let F=0;F<A.len;F++){let K=S[(A.start+F)%oe];V[F]=K.inner,M[F]=K.outer,R[F]=K.front,E[F]=K.top,w.push(K.profile??{rs:[K.inner,K.outer],ls:[K.front,K.top]})}let L=hn(V,_),I=hn(M,_),O=hn(R,_),j=hn(E,_);for(let F=0;F<A.len;F++)L[F]>V[F]&&(L[F]=V[F]),I[F]<M[F]&&(I[F]=M[F]),L[F]>I[F]-1e-6&&(L[F]=Math.max(0,I[F]-1e-6)),j[F]<O[F]&&(j[F]=O[F]);let U={startBin:A.start,binCount:A.len,closed:_,innerR:L,outerR:I,frontLevelM:O,topLevelM:j,profiles:w},N=(F,K,X)=>{let Q=w[F],W=Q.rs,Z=Q.ls;if(K<=W[0]){Z[0]>X&&(Z[0]=X);return}if(K>=W[W.length-1]){Z[Z.length-1]>X&&(Z[Z.length-1]=X);return}for(let $=0;$+1<W.length;$++)if(K<=W[$+1]){Z[$]>X&&(Z[$]=X),Z[$+1]>X&&(Z[$+1]=X);return}};for(let F=0;F<A.len;F++){let K=l[(A.start+F)%oe];if(K)for(let X of K.samples){N(F,X.r,X.levelM);let Q=_?(F-1+A.len)%A.len:F-1,W=_?(F+1)%A.len:F+1;Q>=0&&N(Q,X.r,X.levelM),W<A.len&&N(W,X.r,X.levelM)}}B.push(U)}B.reduce((A,_)=>A+_.binCount*T,0)<Bl||p.push({arcs:B,sectionIds:m.members.map(A=>A.sectionId),innerRMedian:x,outerRMedian:g})}if(!p.length)return null;if(p.sort((m,l)=>m.innerRMedian-l.innerRMedian),t){let m=p[p.length-1].outerRMedian;if(Math.hypot(t.x-c.x,t.y-c.y)>.9*m)return null}return{centre:c,binCount:oe,binStepDeg:360/oe,rings:p}}function Mi(e,t,n,r){let o=e.binStepDeg,i=n/o-.5-t.startBin;i=(i%e.binCount+e.binCount)%e.binCount,i>t.binCount-1&&(t.closed?i=i-t.binCount<t.binCount-i?0:t.binCount-1:i=i-(t.binCount-1)<e.binCount-i?t.binCount-1:0);let a=Math.floor(i),s=t.closed?(a+1)%t.binCount:Math.min(t.binCount-1,a+1),c=i-a,u=d=>{let p=t.profiles[d],m=p.rs,l=p.ls;if(r<=m[0])return l[0];if(r>=m[m.length-1])return l[l.length-1];for(let f=0;f+1<m.length;f++)if(r<=m[f+1]){let h=m[f+1]-m[f],y=h>1e-9?(r-m[f])/h:0;return l[f]+(l[f+1]-l[f])*y}return l[l.length-1]};return u(a)*(1-c)+u(s)*c}var zl=.25,Hl=1.2,Ul=.6,jl=.45,Yl=2.3,Xl=Math.PI/180;function it(e,t,n){let r=n*Xl;return{x:e.x+t*Math.sin(r),y:e.y+t*Math.cos(r)}}function Wl(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 Kl=24;function ql(e,t,n,r,o,i,a,s){let c=n.binCount,u=Kl,d=he,p=i+.02,m=[];for(let k=0;k<c;k++){let A=(n.startBin+k+.5)*t.binStepDeg,_=new Float64Array(u+1);for(let V=0;V<=u;V++){let M=r[k]+(o[k]-r[k])*V/u;_[V]=Math.max(p,Mi(t,n,A,M)-zl)}m.push(_)}let l=[a.bandTop[0]*s.top,a.bandTop[1]*s.top,a.bandTop[2]*s.top],f=[a.bandTop[0]*s.bottomCap,a.bandTop[1]*s.bottomCap,a.bandTop[2]*s.bottomCap],h=[a.bandWall[0]*s.top,a.bandWall[1]*s.top,a.bandWall[2]*s.top],y=[a.bandWall[0]*s.wallBottom,a.bandWall[1]*s.wallBottom,a.bandWall[2]*s.wallBottom],b=(k,A)=>{let _=(n.startBin+k+.5)*t.binStepDeg,V=r[k]+(o[k]-r[k])*A/u,M=it(t.centre,V,_);return[M.x*d,m[k][A],M.y*d]};{let k=Math.tan(12*Math.PI/180);for(let A=0;A<6;A++){let _=!1;for(let M=0;M<c;M++)for(let R=u-1;R>=0;R--)m[M][R]>m[M][R+1]&&(m[M][R]=m[M][R+1],_=!0);let V=n.closed?c:c-1;for(let M=0;M<V;M++){let R=(M+1)%c;for(let E=0;E<=u;E++){let w=m[R][E]-m[M][E];if(Math.abs(w)>1)continue;let L=r[M]+(o[M]-r[M])*E/u,I=r[R]+(o[R]-r[R])*E/u,O=it(t.centre,L,(n.startBin+M+.5)*t.binStepDeg),j=it(t.centre,I,(n.startBin+R+.5)*t.binStepDeg),U=k*Math.hypot(j.x-O.x,j.y-O.y)*d;w>U?(m[R][E]=m[M][E]+U,_=!0):-w>U&&(m[M][E]=m[R][E]+U,_=!0)}}if(!_)break}}let x=1,g=(k,A)=>{for(let _=0;_<=u;_+=4)if(Math.abs(m[k][_]-m[A][_])>x)return!0;return Math.abs(m[k][u]-m[A][u])>x},v=Math.tan(38*Math.PI/180),P=k=>(o[k]-r[k])/u*d,S=(k,A)=>m[k][A+1]-m[k][A]>v*Math.max(1e-6,P(k)),C=(k,A)=>{let _=n.closed?(k-1+c)%c:Math.max(0,k-1),V=n.closed?(k+1)%c:Math.min(c-1,k+1);Math.abs(m[_][A]-m[k][A])>x&&(_=k),Math.abs(m[V][A]-m[k][A])>x&&(V=k);let M=Math.max(0,A-1),R=Math.min(u,A+1);M<A&&S(k,M)&&(M=A),R>A&&S(k,A)&&(R=A);let E=b(_,A),w=b(V,A),L=b(k,M),I=b(k,R),O=w[0]-E[0],j=w[1]-E[1],U=w[2]-E[2],N=I[0]-L[0],F=I[1]-L[1],K=I[2]-L[2],X=j*K-U*F,Q=U*N-O*K,W=O*F-j*N,Z=Math.hypot(X,Q,W);return Z>1e-12?(X/=Z,Q/=Z,W/=Z,Q<0&&(X=-X,Q=-Q,W=-W),[X,Q,W]):[0,1,0]},T=(k,A)=>{let _=[k[0],i,k[2]],V=[A[0],i,A[2]],M=A[0]-k[0],R=A[2]-k[2],E=Math.hypot(M,R);if(!(E>1e-12))return;let w=[R/E,0,-M/E];e.tri(k,A,V,w,h,h,y),e.tri(k,V,_,w,h,y,y)},B=.05*Ue,z=k=>o[k]-r[k]<B,D=n.closed?c:c-1;for(let k=0;k<D;k++){let A=(k+1)%c;if(z(k)||z(A))continue;if(g(k,A)){let w=(n.startBin+k+1)*t.binStepDeg,L=(F,K)=>{let X=(r[k]+r[A])/2,Q=(o[k]+o[A])/2,W=X+(Q-X)*K/u,Z=it(t.centre,W,w);return[Z.x*d,m[F][K],Z.y*d]};for(let F=0;F<u;F++){let K=b(k,F),X=b(k,F+1),Q=L(k,F),W=L(k,F+1),Z=C(k,F),$=C(k,F+1);e.triN(K,Q,W,Z,Z,$,l),e.triN(K,W,X,Z,$,$,l);let te=b(A,F),Le=b(A,F+1),Pe=L(A,F),Be=L(A,F+1),Ne=C(A,F),Ae=C(A,F+1);e.triN(Pe,te,Le,Ne,Ne,Ae,l),e.triN(Pe,Le,Be,Ne,Ae,Ae,l);let Ce=L(k,F),me=L(k,F+1),qe=L(A,F+1),vt=L(A,F),Ge=me[0]-Ce[0],Fe=me[2]-Ce[2],Qe=Math.hypot(Ge,Fe);if(Qe>1e-12){let Ut=[Fe/Qe,0,-Ge/Qe];e.tri(Ce,me,qe,Ut,h),e.tri(Ce,qe,vt,Ut,h)}}let I=b(k,0),O=b(A,0),j=b(A,u),U=b(k,u),N=F=>[F[0],i,F[2]];e.tri(N(I),N(j),N(O),[0,-1,0],f),e.tri(N(I),N(U),N(j),[0,-1,0],f),T(I,O),T(U,j);continue}for(let w=0;w<u;w++){let L=C(k,w),I=C(A,w),O=C(A,w+1),j=C(k,w+1);if(S(k,w)||S(A,w)){let X=(me,qe)=>{let vt=(n.startBin+me+.5)*t.binStepDeg,Ge=r[me]+(o[me]-r[me])*(w+.5)/u,Fe=it(t.centre,Ge,vt);return[Fe.x*d,qe,Fe.y*d]},Q=b(k,w),W=b(A,w),Z=X(k,m[k][w]),$=X(A,m[A][w]);e.triN(Q,W,$,L,I,I,l),e.triN(Q,$,Z,L,I,L,l);let te=b(A,w+1),Le=b(k,w+1),Pe=X(k,m[k][w+1]),Be=X(A,m[A][w+1]);e.triN(Pe,Be,te,j,O,O,l),e.triN(Pe,te,Le,j,O,j,l);let Ne=$[0]-Z[0],Ae=$[2]-Z[2],Ce=Math.hypot(Ne,Ae);if(Ce>1e-12){let me=[-Ae/Ce,0,Ne/Ce];e.tri(Z,$,Be,me,h),e.tri(Z,Be,Pe,me,h)}continue}let U=b(k,w),N=b(A,w),F=b(A,w+1),K=b(k,w+1);e.triN(U,N,F,L,I,O,l),e.triN(U,F,K,L,O,j,l)}let _=b(k,0),V=b(A,0),M=b(A,u),R=b(k,u),E=w=>[w[0],i,w[2]];e.tri(E(_),E(M),E(V),[0,-1,0],f),e.tri(E(_),E(R),E(M),[0,-1,0],f),T(_,V),T(R,M)}if(!n.closed)for(let k of[0,c-1])for(let A=0;A<u;A++)T(b(k,A),b(k,A+1))}function wi(e,t,n){let{bottomY:r,colors:o,ao:i}=n,a=new Float64Array(t.binCount).fill(-1/0);for(let d of t.rings)for(let p of d.arcs){let m=new Float64Array(p.binCount),l=new Float64Array(p.binCount);for(let h=0;h<p.binCount;h++){let y=(p.startBin+h)%t.binCount,b=Math.max(0,p.innerR[h]-we);m[h]=Math.max(b,a[y]+.001),l[h]=Math.max(m[h]+.001,p.outerR[h]+we)}let f=0;for(let h=0;h<p.binCount;h++){let y=p.topLevelM[h]-r;y>f&&(f=y)}f>=Hl&&ql(e,t,p,m,l,r,o,i);for(let h=0;h<p.binCount;h++){let y=(p.startBin+h)%t.binCount;l[h]>a[y]&&(a[y]=l[h])}}if(n.deriveShell===!1||Wl(n.shapes,t))return;let s=t.rings[t.rings.length-1],c=Ul*Ue,u=jl*Ue;for(let d of s.arcs){let p=[],m=[];for(let h=0;h<d.binCount;h++){let y=(d.startBin+h+.5)*t.binStepDeg,b=d.outerR[h]+we+c;p.push(it(t.centre,b,y)),m.push(it(t.centre,b+u,y))}let l=-1/0;for(let h=0;h<d.binCount;h++)d.topLevelM[h]>l&&(l=d.topLevelM[h]);let f=()=>l+Yl;d.closed?ue(e,m,[p.slice().reverse()],f,r,o.shellTop,o.shellWall,i):ue(e,[...m,...p.slice().reverse()],void 0,f,r,o.shellTop,o.shellWall,i)}}function Pi(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=y=>o.deckAt(y.x,y.y),p=ii(t,a),m=p[0]??t.outline;if(o.rowLevels.length>=2){let y=dn(o.rowLevels),b=ai(Jr(o.rowLevels,n.focal,y),p),x=()=>[0,1,0];for(let v of b){let P=Math.max(c,v.topY-.02);for(let S of i.subtract(v.outline,P))ue(e,S,v.holes,()=>P,c,u,s.tierWall,le,void 0,x)}b.length||ue(e,m,t.holes,()=>o.landingY,c,u,s.tierWall,le);let g={tread:[u[0]*le.top,u[1]*le.top,u[2]*le.top],riser:[u[0]*.72,u[1]*.72,u[2]*.72]};for(let v of p.length?p:[m])ti(e,o.rowLevels,n.focal,o.landingY,g,v,y);return}let l=o.flat?1/0:si,f=y=>o.normalAt(y.x,y.y),h=o.flat?o.landingY:void 0;for(let y of i.subtract(m,h))ue(e,y,t.holes,d,c,u,s.tierWall,le,l,f)}function Ql(e,t,n){let r=new Set;for(let a of e.objects)a.type==="section"&&r.add(a.id);let o=new Map;for(let a=0;a<t.length;a++){let s=n.seatOwner[a];if(!s||!r.has(s))continue;let c=n.bySection.get(s);if(c&&c.rowLevels.length>=2)continue;let u=t[a],d=o.get(s);d||(d=new Map,o.set(s,d));let p=u.rowId||`__seat-${a}`,m=d.get(p);m||(m={pts:[],levelM:0,n:0},d.set(p,m)),m.pts.push({x:u.x,y:u.y}),m.levelM+=n.seatDeckY(a),m.n++}let i=[];for(let a of e.objects){if(a.type!=="section")continue;let s=n.bySection.get(a.id);if(s&&s.rowLevels.length>=2){let u=s.rowLevels.filter(d=>!d.patch).map(d=>({pts:d.pts,levelM:d.y}));u.length>=2&&i.push({sectionId:a.id,rows:u});continue}let c=o.get(a.id);c&&i.push({sectionId:a.id,rows:[...c.values()].map(u=>({pts:u.pts,levelM:u.levelM/u.n}))})}return i}function Ci(e,t,n,r,o,i,a=!0){let s=Ql(t,n,r);if(!s.length)return;let c=Si(s,t.focal);c&&(e.setMaterial(0),wi(e,c,{bottomY:t.baseHeightM,colors:{bandTop:Me(o.tierTop,.8),bandWall:o.tierWall,shellTop:i??Me(o.tierWall,1.15),shellWall:i??o.tierWall},ao:le,shapes:t.objects.filter(u=>u.type==="shape"),deriveShell:a}))}function Ai(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 Ri(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 Zl=1.15,$l=2.75,Jl=4.5,eu=.85,tu=.5,nu=.26;function Ii(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>=Zl&&a.add("zone"),o<=(i?$l:Jl)&&(a.add("section"),a.add("ga")),o<=eu&&(a.add("annotation"),a.add("booth")),o<=tu&&a.add("row"),o<=nu&&a.add("seat"),a}function Ei(e,t,n,r,o,i=6){let a=i+t,s=r-i-t,c=i+n,u=o-i-n;return{...e,x:a>s?r/2:Math.max(a,Math.min(s,e.x)),y:c>u?o/2:Math.max(c,Math.min(u,e.y))}}function Ye(e,t,n,r){let o=e,i=t[0],a=t[1],s=t[2],c=o[0]*i+o[4]*a+o[8]*s+o[12],u=o[1]*i+o[5]*a+o[9]*s+o[13],d=o[2]*i+o[6]*a+o[10]*s+o[14],p=o[3]*i+o[7]*a+o[11]*s+o[15];if(!(p>1e-6))return{x:0,y:0,depth:1/0,visible:!1};let m=c/p,l=u/p,f=d/p,h=m>=-1.05&&m<=1.05&&l>=-1.05&&l<=1.05&&f<=1;return{x:(m*.5+.5)*n,y:(1-(l*.5+.5))*r,depth:f,visible:h}}function Ti(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(yo(i,s,t,n)){a=!0;break}a||r.push(i)}return r}var ou=6;function yo(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+ou):n;return o<a&&i<r}function _i(e,t,n){return e.length*t*.58+(n?14:0)}var ru={row:8,seat:14};function ki(e){return e<480?{row:5,seat:8}:e<768?{row:6,seat:10}:ru}function Li(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 go(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(yo(s,u,t,n)){c=!0;break}if(!c){for(let u of a)if(yo(s,u,t,n)){c=!0;break}}c||a.push(s)}return a}var iu=6,au=2.2,Fi=.1,su=.3,cu=1.8,lu=.9,uu=.55,du=6e3;function Di(e){let{doc:t,units:n,seats:r,surfaces:o,focal:i}=e,a=t.zones??[],s=[];if(a.length){let c=new Map;for(let d of n)for(let p of d.objects)p.type==="section"&&p.zone&&c.set(p.id,p.zone);let u=new Map;for(let d=0;d<r.length;d++){let p=r[d],m=o.seatOwner[d],l=p.zoneId??(m?c.get(m):void 0);if(!l)continue;let f=u.get(l);f||(f={n:0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0,sumY:0},u.set(l,f)),f.n++,p.x<f.minX&&(f.minX=p.x),p.y<f.minY&&(f.minY=p.y),p.x>f.maxX&&(f.maxX=p.x),p.y>f.maxY&&(f.maxY=p.y),f.sumY+=o.seatDeckY(d)}for(let d of a){let p=u.get(d.id),m=[];for(let[l,f]of c)f===d.id&&m.push(l);if(!p||p.n===0){s.push({id:d.id,label:d.label,color:ne(d.color),sectionIds:m,seatCount:0,center:[0,0,0],radius:0,focalWorld:[(d.focalPoint??i).x*G,1.5,(d.focalPoint??i).y*G]});continue}s.push({id:d.id,label:d.label,color:ne(d.color),sectionIds:m,seatCount:p.n,center:[(p.minX+p.maxX)/2*G,p.sumY/p.n,(p.minY+p.maxY)/2*G],radius:.5*Math.hypot((p.maxX-p.minX)*G,(p.maxY-p.minY)*G)||1,focalWorld:[(d.focalPoint??i).x*G,1.5,(d.focalPoint??i).y*G]})}}return s}function Oi(e){let{doc:t,units:n,seats:r,surfaces:o,seatData:i,hintedSeatFloor:a,zones:s,focal:c}=e,u=[],d=[],p=[];for(let m of s)m.seatCount!==0&&u.push({id:`zone:${m.id}`,kind:"zone",text:m.label,anchor:[m.center[0],m.center[1]+iu,m.center[2]],color:t.zones?.find(l=>l.id===m.id)?.color});{let m=new Map,l=new Map;for(let f=0;f<r.length;f++){let h=o.seatOwner[f];if(!h)continue;let y=m.get(h);y||(y={n:0,x:0,y:0,deck:0},m.set(h,y)),y.n++,y.x+=r[f].x,y.y+=r[f].y,y.deck+=o.seatDeckY(f);let b=l.get(h);b||(b={minX:1/0,maxX:-1/0,minY:1/0,maxY:-1/0},l.set(h,b)),r[f].x<b.minX&&(b.minX=r[f].x),r[f].x>b.maxX&&(b.maxX=r[f].x),r[f].y<b.minY&&(b.minY=r[f].y),r[f].y>b.maxY&&(b.maxY=r[f].y)}for(let f of n)for(let h of f.objects){if(h.type!=="section")continue;let y=m.get(h.id);if(!y||y.n===0)continue;let b=l.get(h.id),x=[y.x/y.n*G,y.deck/y.n,y.y/y.n*G],g=h.displayLabel||h.label||h.id;d.push({id:h.id,floorIndex:f.index,label:g,seatCount:y.n,center:x,radius:Math.max(1,Math.hypot(b.maxX-b.minX,b.maxY-b.minY)*.5*G),focalWorld:[f.focal.x*G,f.baseHeightM+1.5,f.focal.y*G]});let v=t.floors?.[f.index]?.name?.trim().toLocaleLowerCase();n.length>1&&v===g.trim().toLocaleLowerCase()||u.push({id:`section:${h.id}`,kind:"section",text:g,anchor:[x[0],x[1]+au,x[2]],floorIndex:f.index})}}{for(let f of n)for(let h of f.objects){if(h.type!=="gaArea")continue;let y=Et(h.points);if(!y)continue;let b=h.displayLabel||h.label||h.id;u.push({id:`ga:${h.id}`,kind:"ga",text:h.capacity>0?`${b} \xB7 ${h.capacity.toLocaleString()}`:b,anchor:[y.x*G,f.baseHeightM+cu,y.y*G],floorIndex:f.index})}let m=new Map;for(let f=0;f<r.length;f++){let h=r[f],y=Math.hypot(h.x-c.x,h.y-c.y),b=m.get(h.rowId);(!b||y>b.far)&&m.set(h.rowId,{seat:h,index:f,far:y})}for(let[f,h]of m){let y=h.seat.label?h.seat.label.lastIndexOf("-"):-1,b=y>0?h.seat.label.slice(0,y):f;b&&u.push({id:`row:${f}`,kind:"row",text:b,anchor:[h.seat.x*G,o.seatDeckY(h.index)+lu,h.seat.y*G],floorIndex:a[h.index]})}let l=new Map;for(let f=0;f<r.length;f++){let h=r[f],y=h.label?h.label.lastIndexOf("-"):-1,b=l.get(h.rowId);b||(b={n:0,x:0,y:0,z:0,minX:1/0,maxX:-1/0,minZ:1/0,maxZ:-1/0,label:y>0?h.label.slice(0,y):h.rowId,sectionId:h.sectionId},l.set(h.rowId,b));let x=f*3,g=i.iPosition[x],v=i.iPosition[x+1],P=i.iPosition[x+2];b.n++,b.x+=g,b.y+=v,b.z+=P,b.minX=Math.min(b.minX,g),b.maxX=Math.max(b.maxX,g),b.minZ=Math.min(b.minZ,P),b.maxZ=Math.max(b.maxZ,P)}for(let[f,h]of l)p.push({id:f,label:h.label,sectionId:h.sectionId,seatCount:h.n,center:[h.x/h.n,h.y/h.n,h.z/h.n],radius:Math.max(.8,Math.hypot(h.maxX-h.minX,h.maxZ-h.minZ)*.5)});if(r.length<=du)for(let f=0;f<r.length;f++){let h=r[f],y=h.displayLabel||h.label;y&&u.push({id:`seat:${h.id}`,kind:"seat",text:y,anchor:[h.x*G,o.seatDeckY(f)+uu,h.y*G],floorIndex:a[f]})}}for(let m of n)for(let l of m.objects)if(l.type==="shape"&&l.role&&["entrance","exit","screen","suite","obstruction"].includes(l.role)){let f=rt(l),h=f?Et(f):null;if(!h||!l.label)continue;u.push({id:`architecture:${l.id}`,kind:"annotation",text:l.label,anchor:[h.x*G,m.baseHeightM+Ot(l).heightM+Fi,h.y*G],color:l.fill,floorIndex:m.index})}else if(l.type==="text"){if(!l.text)continue;u.push({id:`text:${l.id}`,kind:"annotation",text:l.text,anchor:[l.position.x*G,m.baseHeightM+Fi,l.position.y*G],color:l.color,rotation:l.rotation,floorIndex:m.index})}else if(l.type==="booth"){let f=Bt(l);if(!f)continue;let h=Et(f);if(!h)continue;u.push({id:`booth:${l.id}`,kind:"booth",text:l.displayLabel||l.label||l.id,anchor:[h.x*G,m.baseHeightM+po+su,h.y*G],floorIndex:m.index})}return{labels:u,sections:d,rows:p}}function Vi(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 Bi(e){let{doc:t,units:n,seats:r,surfaces:o,solids:i,hintedSeatFloor:a,seatFloor:s}=e,c=[];{let u=n.map(()=>({minX:1/0,minY:1/0,minZ:1/0,maxX:-1/0,maxY:-1/0,maxZ:-1/0}));for(let m=0;m<i.floor.length;m+=1){let l=Math.max(0,Math.min(n.length-1,Math.round(i.floor[m]))),f=m*3,h=u[l];h.minX=Math.min(h.minX,i.position[f]),h.minY=Math.min(h.minY,i.position[f+1]),h.minZ=Math.min(h.minZ,i.position[f+2]),h.maxX=Math.max(h.maxX,i.position[f]),h.maxY=Math.max(h.maxY,i.position[f+1]),h.maxZ=Math.max(h.maxZ,i.position[f+2])}let d=new Map;for(let m=0;m<n.length;m++)for(let l of n[m].objects)l.type==="section"&&d.set(l.id,m);let p=n.map(()=>({n:0,minX:1/0,minY:1/0,minDeck:1/0,maxX:-1/0,maxY:-1/0,maxDeck:-1/0,sumX:0,sumDeck:0,sumZ:0}));for(let m=0;m<r.length;m++){let l=o.seatOwner[m],f=(l!==null?d.get(l):void 0)??a[m];if(f===void 0)continue;let h=p[f],y=r[m];h.n++,y.x<h.minX&&(h.minX=y.x),y.y<h.minY&&(h.minY=y.y),y.x>h.maxX&&(h.maxX=y.x),y.y>h.maxY&&(h.maxY=y.y);let b=o.seatDeckY(m);h.sumX+=y.x*G,h.sumDeck+=b,h.sumZ+=y.y*G,h.minDeck=Math.min(h.minDeck,b),h.maxDeck=Math.max(h.maxDeck,b+1.6),s[m]=f}for(let m=0;m<n.length;m++){let l=p[m],f=t.floors?.[m],h=u[m],y=Math.min(l.n?l.minX*G:n[m].focal.x*G-1,Number.isFinite(h.minX)?h.minX:1/0),b=Math.max(l.n?l.maxX*G:n[m].focal.x*G+1,Number.isFinite(h.maxX)?h.maxX:-1/0),x=Math.min(l.n?l.minY*G:n[m].focal.y*G-1,Number.isFinite(h.minZ)?h.minZ:1/0),g=Math.max(l.n?l.maxY*G:n[m].focal.y*G+1,Number.isFinite(h.maxZ)?h.maxZ:-1/0),v=Math.min(l.n?Math.min(n[m].baseHeightM,l.minDeck):n[m].baseHeightM,Number.isFinite(h.minY)?h.minY:1/0),P=Math.max(l.n?Math.max(l.maxDeck,v+.5):v+.5,Number.isFinite(h.maxY)?h.maxY:-1/0),S=[l.n?l.sumX/l.n:(y+b)/2,l.n?l.sumDeck/l.n:(v+P)/2,l.n?l.sumZ/l.n:(x+g)/2],C=Math.max(1,.5*Math.hypot(b-y,P-v,g-x));c.push({index:m,id:f?.id??`floor-${m}`,label:f?.name??(n.length>1?`Floor ${m+1}`:"Venue"),seatCount:l.n,center:S,radius:C,box:{min:[y,v,x],max:[b,P,g]},focalWorld:[n[m].focal.x*G,n[m].baseHeightM+1.5,n[m].focal.y*G]})}}return c}function xo(e,t){let n=1/0,r=1/0,o=-1/0,i=-1/0,a=(s,c)=>{s<n&&(n=s),c<r&&(r=c),s>o&&(o=s),c>i&&(i=c)};for(let s of t)a(s.x,s.y);for(let s of e)for(let c of s.objects)if(c.type==="section")for(let u of c.outline)a(u.x,u.y);else if(c.type==="shape"&&c.points)for(let u of c.points)a(u.x,u.y);else if(c.type==="gaArea")for(let u of c.points)a(u.x,u.y);else if(c.type==="booth"){let u=Bt(c);if(u)for(let d of u)a(d.x,d.y)}else if(c.type==="table"){let u=ho(c);if(u)for(let d of u)a(d.x,d.y)}else if(c.type==="decorImage"){let u=bo(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 Ni(e,t,n,r,o,i){if(t.length===1){let a=Math.max(60,(o.maxX-o.minX+o.maxY-o.minY)*.06),s=Lt(o.minX-a,o.minY-a,o.maxX-o.minX+a*2,o.maxY-o.minY+a*2);ue(e,s,void 0,()=>0,-.4,i.ground,i.ground,le)}else{let a=t.reduce((l,f)=>f.baseHeightM<l.baseHeightM?f:l);e.setFloor(a.index);let s=n.filter((l,f)=>r[f]===a.index),c=xo([a],s),u=Math.hypot(c.maxX-c.minX,c.maxY-c.minY),d=Math.max(28,Math.min(80,u*.04)),p=Lt(c.minX-d,c.minY-d,c.maxX-c.minX+d*2,c.maxY-c.minY+d*2),m=a.baseHeightM-.03;ue(e,p,void 0,()=>m,m-.22,i.ground,i.ground,le)}}function Gi(e,t,n){let{cx:r,cz:o,radius:i}=n,a=1/0,s=1/0,c=1/0,u=-1/0,d=-1/0,p=-1/0,m=(h,y,b)=>{a=Math.min(a,h),u=Math.max(u,h),s=Math.min(s,y),d=Math.max(d,y),c=Math.min(c,b),p=Math.max(p,b)};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 y=h*3,b=t.iPosition[y],x=t.iPosition[y+1],g=t.iPosition[y+2],v=Math.max(.35,t.iMaxRadius[h]??.35);m(b-v,x,g-v),m(b+v,x+1.6,g+v)}Number.isFinite(a)||(a=r-i,u=r+i,s=0,d=i*.16,c=o-i,p=o+i);let l=[(a+u)/2,(s+d)/2,(c+p)/2],f=Math.max(1,.5*Math.hypot(u-a,d-s,p-c));return{center:l,radius:f,minY:s,maxY:d}}function zi(e,t,n,r,o,i){let a=1/0,s=1/0,c=-1/0,u=-1/0;for(let v=0;v<e.count;v++){let P=v*3,S=e.iPosition[P],C=e.iPosition[P+2];S<a&&(a=S),S>c&&(c=S),C<s&&(s=C),C>u&&(u=C)}for(let v of t)a=Math.min(a,v.cx-v.halfX),c=Math.max(c,v.cx+v.halfX),s=Math.min(s,v.cz-v.halfZ),u=Math.max(u,v.cz+v.halfZ);let d=n.minX*G,p=n.maxX*G,m=n.minY*G,l=n.maxY*G,f=d,h=p,y=m,b=l;if(Number.isFinite(a)){let v=Math.max(2,.06*Math.hypot(c-a,u-s));f=Math.max(d,a-v),h=Math.min(p,c+v),y=Math.max(m,s-v),b=Math.min(l,u+v)}let x=Math.min(0,r),g=Math.max(o,i*.05);return{min:[f,x,y],max:[h,g,b]}}function Hi(e,t,n){let r=()=>({byObjectId:new Map,elements:[]});if(!t||!e)return r();let o=Tr(t);if(!o.ok||o.value.id!==e)return r();let i=new Map;for(let p of n)for(let m of p.objects)m.type==="shape"&&i.set(m.id,{shape:m,unit:p});let a=new Set,s=new Set,c=new Map((t.overlay.productionElements??[]).map(p=>{let m=p.runtimeContentImageUrl;return[p.id,typeof m=="string"&&/^(?:blob:|data:image\/|https:\/\/)/.test(m)?m:void 0]})),u=[];for(let p of o.value.overlay.productionElements??[]){let m=i.get(p.objectId),l=m?rt(m.shape):null,f=p.baseElevationM??0;if(!m||!l||l.length<3||!p.id||a.has(p.id)||s.has(p.objectId)||!Number.isFinite(p.heightM)||p.heightM<.05||p.heightM>50||!Number.isFinite(f)||f<-10||f>100)return r();a.add(p.id),s.add(p.objectId);let h=l.map(T=>T.x*G),y=l.map(T=>T.y*G),b=m.unit.baseHeightM+f,x=Math.min(...h),g=Math.max(...h),v=Math.min(...y),P=Math.max(...y),S,C=c.get(p.id)??p.contentImageUrl;if(p.kind==="screen"&&C)if(g-x>=P-v){let T=Math.abs(v-m.unit.focal.y*G)<=Math.abs(P-m.unit.focal.y*G)?v-.006:P+.006;S=[[x,b,T],[g,b,T],[x,b+p.heightM,T],[g,b+p.heightM,T]]}else{let T=Math.abs(x-m.unit.focal.x*G)<=Math.abs(g-m.unit.focal.x*G)?x-.006:g+.006;S=[[T,b,v],[T,b,P],[T,b+p.heightM,v],[T,b+p.heightM,P]]}u.push({id:p.id,objectId:p.objectId,kind:p.kind,floorIndex:m.unit.index,baseY:b,topY:b+p.heightM,bounds:{min:[x,b,v],max:[g,b+p.heightM,P]},occlusion:p.occlusion,...C?{contentImageUrl:C}:{},...S?{contentPlane:S}:{}})}let d=u.sort((p,m)=>p.id.localeCompare(m.id));return{byObjectId:new Map(d.map(p=>[p.objectId,p])),elements:d}}function ve(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function xe(e){return Array.isArray(e)?e:[]}function mu(e){let t=[e];for(;t.length;){let n=t.pop();if(Array.isArray(n)){t.push(...n);continue}if(!ve(n))continue;let r=ve(n.extensions)?n.extensions:null;if(r&&Object.prototype.hasOwnProperty.call(r,"KHR_draco_mesh_compression"))return!0;t.push(...Object.values(n))}return!1}function bn(e,t){return!Array.isArray(e)||e.length!==t||!e.every(n=>typeof n=="number"&&Number.isFinite(n))?null:e}function fu(){return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}function pu(e,t){let n=new Array(16).fill(0);for(let r=0;r<4;r++)for(let o=0;o<4;o++)for(let i=0;i<4;i++)n[r*4+o]+=e[i*4+o]*t[r*4+i];return n}function hu(e){let t=bn(e.matrix,16);if(t)return t;if(e.matrix!==void 0)return null;let n=e.translation===void 0?[0,0,0]:bn(e.translation,3),r=e.rotation===void 0?[0,0,0,1]:bn(e.rotation,4),o=e.scale===void 0?[1,1,1]:bn(e.scale,3);if(!n||!r||!o)return null;let[i,a,s,c]=r,u=Math.hypot(i,a,s,c);if(!(u>1e-8))return null;let d=i/u,p=a/u,m=s/u,l=c/u,f=d+d,h=p+p,y=m+m,b=d*f,x=d*h,g=d*y,v=p*h,P=p*y,S=m*y,C=l*f,T=l*h,B=l*y;return[(1-(v+S))*o[0],(x+B)*o[0],(g-T)*o[0],0,(x-B)*o[1],(1-(b+S))*o[1],(P+C)*o[1],0,(g+T)*o[2],(P-C)*o[2],(1-(b+v))*o[2],0,n[0],n[1],n[2],1]}function bu(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 yu(e){let t=e[0],n=e[4],r=e[8],o=e[1],i=e[5],a=e[9],s=e[2],c=e[6],u=e[10],d=i*u-a*c,p=a*s-o*u,m=o*c-i*s,l=t*d+n*p+r*m;if(Math.abs(l)<1e-12)return null;let f=1/l;return[d*f,p*f,m*f,(r*c-n*u)*f,(t*u-r*s)*f,(n*s-t*c)*f,(n*a-r*i)*f,(r*o-t*a)*f,(t*i-n*o)*f]}function Ui(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 gu(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 xu(e){return e===5120||e===5121?1:e===5122||e===5123?2:e===5125||e===5126?4:0}function vu(e){return e==="SCALAR"?1:e==="VEC2"?2:e==="VEC3"?3:e==="VEC4"?4:0}function Su(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 Mu(e){let t=e instanceof Uint8Array?e:new Uint8Array(e),n=gu(t);if(!n)return{ok:!1,issue:"invalid_glb"};let{json:r,bin:o}=n;if(!ve(r.asset)||r.asset.version!=="2.0")return{ok:!1,issue:"unsupported_glb"};let i=xe(r.extensionsUsed).filter(v=>typeof v=="string");if(i.includes("KHR_draco_mesh_compression")||mu(r))return{ok:!1,issue:"draco_not_allowed"};if(i.length||xe(r.extensionsRequired).length)return{ok:!1,issue:"unsupported_glb"};if(xe(r.images).length||xe(r.textures).length)return{ok:!1,issue:"external_resource"};let a=xe(r.buffers);if(a.length!==1||!ve(a[0])||a[0].uri!==void 0||typeof a[0].byteLength!="number"||!Number.isInteger(a[0].byteLength)||a[0].byteLength<0||a[0].byteLength>o.byteLength)return{ok:!1,issue:"external_resource"};let s=xe(r.accessors),c=xe(r.bufferViews),u=xe(r.meshes),d=xe(r.nodes),p=xe(r.scenes),m=typeof r.scene=="number"?r.scene:0;if(!ve(p[m]))return{ok:!1,issue:"unsupported_glb"};let l=new DataView(o.buffer,o.byteOffset,o.byteLength),f=(v,P,S)=>{if(typeof v!="number"||!Number.isInteger(v)||!ve(s[v]))return null;let C=s[v];if(C.type!==P||C.sparse!==void 0||C.normalized===!0||typeof C.count!="number"||!Number.isInteger(C.count)||C.count<1||typeof C.componentType!="number"||!S.includes(C.componentType)||typeof C.bufferView!="number")return null;let T=c[C.bufferView];if(!ve(T)||T.buffer!==0||typeof T.byteLength!="number"||!Number.isInteger(T.byteLength)||T.byteLength<0)return null;let B=vu(C.type),z=xu(C.componentType),D=typeof T.byteStride=="number"?T.byteStride:B*z,k=typeof T.byteOffset=="number"?T.byteOffset:0,A=typeof C.byteOffset=="number"?C.byteOffset:0,_=k+A,V=A+(C.count-1)*D+B*z;if(!Number.isInteger(D)||!Number.isInteger(k)||!Number.isInteger(A)||D<B*z||k<0||A<0||k+T.byteLength>o.byteLength||V>T.byteLength)return null;let M=[];for(let R=0;R<C.count;R++){let E=[];for(let w=0;w<B;w++){let L=Su(l,_+R*D+w*z,C.componentType);if(!Number.isFinite(L))return null;E.push(L)}M.push(E)}return M},h=[],y=[],b=0,x=new Set,g=(v,P)=>{if(typeof v!="number"||!Number.isInteger(v)||!ve(d[v])||x.has(v))return!1;x.add(v);let S=d[v],C=hu(S);if(!C)return!1;let T=pu(P,C),B=yu(T);if(!B)return!1;if(S.mesh!==void 0){if(typeof S.mesh!="number")return!1;let z=u[S.mesh];if(!ve(z))return!1;for(let D of xe(z.primitives)){if(!ve(D)||D.mode!==void 0&&D.mode!==4||!ve(D.attributes))return!1;let k=f(D.attributes.POSITION,"VEC3",[5126]),A=D.attributes.NORMAL===void 0?null:f(D.attributes.NORMAL,"VEC3",[5126]);if(!k||D.attributes.NORMAL!==void 0&&!A)return!1;let _=k.length;if(D.indices!==void 0){let M=typeof D.indices=="number"?s[D.indices]:null;_=ve(M)?M.count:void 0}if(typeof _!="number"||!Number.isInteger(_)||_%3!==0||(b+=_/3,b>1e5))return!1;let V=D.indices===void 0?k.map((M,R)=>[R]):f(D.indices,"SCALAR",[5121,5123,5125]);if(!V||V.length%3!==0||V.length!==_)return!1;for(let M=0;M<V.length;M+=3){let R=[V[M][0],V[M+1][0],V[M+2][0]];if(R.some(L=>!Number.isInteger(L)||L<0||L>=k.length))return!1;let E=R.map(L=>bu(T,...k[L])),w=null;if(!A){let L=E[1][0]-E[0][0],I=E[1][1]-E[0][1],O=E[1][2]-E[0][2],j=E[2][0]-E[0][0],U=E[2][1]-E[0][1],N=E[2][2]-E[0][2];w=Ui([1,0,0,0,1,0,0,0,1],I*N-O*U,O*j-L*N,L*U-I*j)}for(let L=0;L<3;L++)h.push(...E[L]),y.push(...A?Ui(B,...A[R[L]]):w)}}}for(let z of xe(S.children))if(!g(z,T))return!1;return x.delete(v),!0};for(let v of xe(p[m].nodes))if(!g(v,fu()))return{ok:!1,issue:b>1e5?"triangle_limit":"unsupported_glb"};return!b||h.length!==b*9||y.length!==h.length?{ok:!1,issue:"unsupported_glb"}:{ok:!0,triangleCount:b,position:new Float32Array(h),normal:new Float32Array(y)}}function ji(e){try{return Mu(e)}catch{return{ok:!1,issue:"invalid_glb"}}}function gt(e){let{doc:t}=e,n=gr(t.theme),r=n.structure,o=ri(t,e.eventConfigurationId??t.eventConfigurationId),i=Hi(e.eventConfigurationId,e.eventConfiguration,o),a=e.seats,s=new nn,c=null;if(e.registeredShellGlb){let M=ji(e.registeredShellGlb);if(M.ok){let R=M.position.length/3,E=new Float32Array(M.position.length),w=n.materials.shell??r.tierWall;for(let L=0;L<R;L++){let I=M.normal[L*3+1],O=I<-.25?.4:.62+.38*Math.max(0,I);E[L*3]=w[0]*O,E[L*3+1]=w[1]*O,E[L*3+2]=w[2]*O}c={position:M.position,normal:M.normal,color:E,floor:new Float32Array(R).fill(-2),material:new Float32Array(R),count:R}}}let u=new Map;for(let M of o)for(let R of M.objects)u.set(R.id,M.index),R.type==="section"&&u.set(R.logicalSectionId??R.id,M.index);let d=a.map(M=>u.get(M.sectionId??"")??u.get(M.rowId??"")??0),p=xo(o,a);Ni(s,o,a,d,p,r);let m=li(t,a),l=new Map,f=new Map;for(let M of t.categories??[])l.set(M.key,M.color),M.seatGlyph&&f.set(M.key,M.seatGlyph);let h=[],y=ci(o,a,d),b=new Float32Array(a.length),x=[];for(let M=0;M<o.length;M++){let R=o[M];s.setFloor(M);let E=new fn,w=[],L=R.objects.filter(I=>I.type==="section"&&!!I.outline&&I.outline.length>=3);for(let I of R.objects)if(I.type==="section"){let O=s.vertexCount;Pi(s,I,R,ui(I,m),y.bySection.get(I.id),E,L,r);let j=s.vertexCount-O;j>0&&x.push({sectionId:I.id,start:O,count:j})}else if(I.type==="shape"){let O=i.byObjectId.get(I.id);s.setMaterial((O?.kind??I.role)==="screen"?1:0),yi(s,I,R.baseHeightM,mi(I,w),r,R.focal,h,O),s.setMaterial(0)}else I.type==="gaArea"?xi(s,I,R.baseHeightM,ne(l.get(I.categoryKey)),r):I.type==="booth"?hi(s,I,R.baseHeightM,ne(l.get(I.categoryKey)),r):I.type==="table"?bi(s,I,R.baseHeightM,ne(l.get(I.categoryKey)),r):I.type==="decorImage"&&gi(s,I,R.baseHeightM,r);Ci(s,R,a,y,r,n.materials.shell,!c)}let g=o.length>1?{x:o.reduce((M,R)=>M+R.focal.x,0)/o.length,y:o.reduce((M,R)=>M+R.focal.y,0)/o.length}:t.focalPoint??{x:(p.minX+p.maxX)/2,y:(p.minY+p.maxY)/2},v=sr(c?[s.build(),c]:[s.build()]),P=br(a,e.initialState,y,b,l,f),S=Di({doc:t,units:o,seats:a,surfaces:y,focal:g}),{labels:C,sections:T,rows:B}=Oi({doc:t,units:o,seats:a,surfaces:y,seatData:P,hintedSeatFloor:d,zones:S,focal:g}),z=Bi({doc:t,units:o,seats:a,surfaces:y,solids:v,hintedSeatFloor:d,seatFloor:b});Vi(C,z),P.iYaw=pr(P.iPosition,a.length,M=>a[M].rowId,M=>{let R=o[b[M]]?.focal??g;return[R.x*G,R.y*G]});let D=(p.minX+p.maxX)/2*G,k=(p.minY+p.maxY)/2*G,A=.5*Math.hypot((p.maxX-p.minX)*G,(p.maxY-p.minY)*G)||10,_=Gi(v,P,{cx:D,cz:k,radius:A}),V=zi(P,h,p,_.minY,_.maxY,A);return{solids:v,sectionSolidRanges:x,seats:P,bounds:{center:[(V.min[0]+V.max[0])/2,(V.min[1]+V.max[1])/2,(V.min[2]+V.max[2])/2],radius:A,groundY:0,box:V},renderBounds:{center:_.center,radius:_.radius},stateColorLUT:xr(n,fe),theme:n,seatCount:a.length,focalWorld:[g.x*G,1.5,g.y*G],zones:S,stages:h,productionElements:i.elements,sections:T,rows:B,labels:C,floors:z}}var wu=88,Pu=20,vo={floor:{size:14,weight:"700",opacity:.98},zone:{size:15,weight:"600",opacity:.95},section:{size:12,weight:"500",opacity:.88},ga:{size:12,weight:"500",opacity:.88},booth:{size:11,weight:"500",opacity:.85},annotation:{size:11,weight:"400",opacity:.75},row:{size:10.5,weight:"600",opacity:.8},seat:{size:9.5,weight:"500",opacity:.72}},Nt=new Set(["row","seat"]),Yi={floor:5,zone:4,section:3,ga:3,booth:2,annotation:1},yn={row:{x:62,y:16},seat:{x:46,y:18}},Xi=ne,So=e=>Bo(e);function Wi(e,t){let n=So(e),r=So(t);return(Math.max(n,r)+.05)/(Math.min(n,r)+.05)}function Mo(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 Cu(e,t=[.04,.06,.1],n=!0){let r=So(t)<.42,o=r?"#f4f7fb":"#0b1220",i=r?"rgba(8,12,22,.78)":"rgba(255,255,255,.84)",a=n?Mo(i,t):t,s=Xi(e),c=n?7:4.5,u=s&&Wi(s,a)>=c?e:o;return r?{ink:u,backing:i,border:"rgba(210,222,245,.24)"}:{ink:u,backing:i,border:"rgba(11,18,32,.22)"}}var Au='ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif',gn=class{constructor(t,n={}){this.nodes=new Map;this.labels=[];this.forcedDense=!1;this.selectedSeatLabelIds=new Set;this.opts=n,this.root=document.createElement("div"),this.root.setAttribute("data-view3d-labels","");let r=this.root.style;r.position="absolute",r.inset="0",r.pointerEvents="none",r.overflow="hidden",r.fontFamily=n.fontFamily||Au,t.appendChild(this.root)}setVisible(t){this.root.style.visibility=t?"":"hidden"}setLabels(t){this.labels=t;for(let[n,r]of this.nodes)t.some(o=>o.id===n)||(r.remove(),this.nodes.delete(n))}setForcedDense(t){this.forcedDense=t}setSelectedSeatIds(t){this.selectedSeatLabelIds=new Set(Array.from(t,n=>`seat:${n}`))}qualityEvidence(){let t=this.root.getBoundingClientRect(),n=this.root.style.visibility!=="hidden";return this.labels.map(r=>{let o=this.nodes.get(r.id),i=o?.getBoundingClientRect(),a=!!(n&&o&&o.style.display!=="none"&&i&&i.width>0&&i.height>0);return{id:r.id,kind:r.kind,text:r.text,visible:a,renderedFontPx:o&&Number.parseFloat(o.style.fontSize)||0,contrast:o?Number(o.dataset.qualityContrast??0):0,...a&&i?{screenBox:{x:i.x-t.x,y:i.y-t.y,width:i.width,height:i.height}}:{}}})}update(t,n,r,o,i,a){if(!this.labels.length)return;let s=Ii(o,i,{hasZoneLabels:this.labels.some(g=>g.kind==="zone")});this.forcedDense&&(s.add("row"),s.add("seat"));let c=[];for(let g of this.labels){if(!s.has(g.kind))continue;let v=Ye(t,g.anchor,n,r);if(!v.visible)continue;let P=_i(g.text,vo[g.kind].size,!Nt.has(g.kind)),S=!Nt.has(g.kind),C=Ei(v,P/2,vo[g.kind].size/2+(S?4:1),n,r),T=a?Math.hypot(g.anchor[0]-a[0],g.anchor[1]-a[1],g.anchor[2]-a[2]):1;c.push({label:g,screen:C,focus:Li(C,T,n,r),halfWidth:P/2,...this.selectedSeatLabelIds.has(g.id)?{priority:1}:{}})}let u=Ri(c.filter(g=>g.label.kind==="floor"),n),d=[...c.filter(g=>!Nt.has(g.label.kind)&&g.label.kind!=="floor"),...u],p=Ti(d,wu,Pu),m=ki(n),l=go(c.filter(g=>g.label.kind==="row"),yn.row.x,yn.row.y,m.row,p),f=go(c.filter(g=>g.label.kind==="seat"),yn.seat.x,yn.seat.y,m.seat,[...p,...l]),h=[...p,...l,...f],y=new Set(h.map(g=>g.label.id));for(let{label:g,screen:v}of h){let S=this.nodeFor(g).style;S.display="",S.transform=`translate(-50%, -50%) translate(${v.x.toFixed(1)}px, ${v.y.toFixed(1)}px)`}let b=h.filter(({label:g})=>!Nt.has(g.kind)).sort((g,v)=>Yi[v.label.kind]-Yi[g.label.kind]||g.screen.depth-v.screen.depth||g.focus-v.focus),x=[];for(let{label:g}of b){let v=this.nodes.get(g.id);if(!v||v.style.display==="none")continue;let P=v.getBoundingClientRect();x.some(C=>P.left<C.right+3&&P.right+3>C.left&&P.top<C.bottom+3&&P.bottom+3>C.top)?v.style.display="none":x.push(P)}for(let[g,v]of this.nodes)y.has(g)||(v.style.display="none")}nodeFor(t){let n=this.nodes.get(t.id);if(!n){n=document.createElement("div");let p=n.style;p.position="absolute",p.left="0",p.top="0",p.whiteSpace="nowrap",p.textShadow="0 1px 3px rgba(0,0,0,0.85), 0 0 8px rgba(0,0,0,0.55)",p.display="none",this.root.appendChild(n),this.nodes.set(t.id,n)}n.textContent=t.text,n.setAttribute("data-label-kind",t.kind);let r=this.selectedSeatLabelIds.has(t.id);n.toggleAttribute("data-selected-seat",r);let o=vo[t.kind],i=n.style;i.fontSize=`${o.size}px`,i.fontWeight=r?"800":o.weight,i.opacity=r?"1":String(o.opacity);let a=!Nt.has(t.kind),s=Cu(t.color??this.opts.ink,this.opts.backgroundRgb,a);i.color=r?"#ecf8ff":s.ink,i.background=r?"rgba(10,28,45,.9)":a?s.backing:"",i.border=r?"1px solid rgba(89,199,255,.92)":a?`1px solid ${s.border}`:"",i.borderRadius=r||a?"999px":"",i.padding=r||a?"3px 7px":"",i.boxShadow=r?"0 0 0 2px rgba(41,176,255,.18), 0 5px 14px rgba(0,0,0,.35)":a?"0 3px 10px rgba(0,0,0,.24)":"",i.letterSpacing=t.kind==="zone"||t.kind==="floor"?"0.08em":"0.02em";let c=this.opts.backgroundRgb??[.04,.06,.1],u=Xi(r?"#ecf8ff":s.ink)??[1,1,1],d=r?Mo("rgba(10,28,45,.9)",c):a?Mo(s.backing,c):c;return n.dataset.qualityContrast=Wi(u,d).toFixed(3),(t.kind==="zone"||t.kind==="floor")&&(i.textTransform="uppercase"),n}dispose(){this.root.remove(),this.nodes.clear()}};var qi=1;var Ru=new Set(["floor","zone","section","ga","booth","annotation"]);function Iu(e){return e.every(t=>Number.isFinite(t))}function Eu(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 Ki(e){return e.length?Math.round(Math.min(...e)*100)/100:null}function at(e){return Math.round(e*1e4)/1e4}function Tu(e){if(e)return{box:{x:at(e.box.x),y:at(e.box.y),width:at(e.box.width),height:at(e.box.height)},horizontalFillRatio:at(e.horizontalFillRatio),verticalFillRatio:at(e.verticalFillRatio),visibleAreaRatio:at(e.visibleAreaRatio),clippedEdges:[...e.clippedEdges]}}function Te(e,t,n){return n.length?{code:e,message:t,count:n.length,samples:n.slice(0,20)}:null}function xn(e){let t=e.labels.filter(s=>s.visible&&s.screenBox),n=t.filter(s=>Ru.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)Eu(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",Iu(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:Tu(e.framing)},metrics:{minimumHierarchyFontPx:Ki(n.map(s=>s.renderedFontPx)),minimumHierarchyContrast:Ki(n.map(s=>s.contrast)),projectedReliefPx:Math.round(e.scene.projectedReliefPx*100)/100},findings:a}}var ce=require("ogl");var Xe=require("ogl");var vn=`
21
21
  float chairWeight(float depth) {
22
22
  return 1.0 - smoothstep(uChairFull, uChairNone, depth);
23
- }`,Di=`
23
+ }`,Qi=`
24
24
  float occupantWeight(float depth) {
25
- float nearWeight = smoothstep(${Go.toFixed(1)}, ${zo.toFixed(1)}, depth);
26
- float farWeight = 1.0 - smoothstep(${Bo.toFixed(1)}, ${No.toFixed(1)}, depth);
25
+ float nearWeight = smoothstep(${Wo.toFixed(1)}, ${Ko.toFixed(1)}, depth);
26
+ float farWeight = 1.0 - smoothstep(${Yo.toFixed(1)}, ${Xo.toFixed(1)}, depth);
27
27
  return nearWeight * farWeight;
28
- }`,Oi=`
28
+ }`,Zi=`
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
- }`,Ql=`#version 300 es
77
+ }`,_u=`#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
- }`,$l=`#version 300 es
115
+ }`,ku=`#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
- }`,Zl=`#version 300 es
188
+ }`,Lu=`#version 300 es
189
189
  precision highp float;
190
190
  in vec2 position; // quad corner in [-1,1]
191
191
  in vec3 iOffset; // per-instance world position
@@ -211,7 +211,7 @@ out float vDim;
211
211
  out float vDotWeight; // 1 = the dot IS this seat, 0 = the chair has taken over
212
212
  out float vPhysicalSeat;
213
213
  out float vPixelRadius;
214
- ${yn}
214
+ ${vn}
215
215
  void main() {
216
216
  vec4 mv = modelViewMatrix * vec4(iOffset, 1.0);
217
217
  float depth = max(-mv.z, 0.001);
@@ -244,7 +244,7 @@ void main() {
244
244
  vPhysicalSeat = iPhysicalSeat;
245
245
  vDim = (uFocusFloor < -0.5 || abs(iFloor - uFocusFloor) < 0.5) ? 0.0 : 1.0;
246
246
  gl_Position = projectionMatrix * mv;
247
- }`,Jl=`#version 300 es
247
+ }`,Fu=`#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
- }`,eu=`#version 300 es
306
+ }`,Du=`#version 300 es
307
307
  precision highp float;
308
308
  in vec3 position; // local: x/z in units of the seat radius, y in METRES
309
309
  in vec3 normal;
@@ -334,9 +334,9 @@ out vec3 vRing;
334
334
  out float vDim;
335
335
  out float vOccupant; // 1 = this vertex belongs to a person, not to the chair
336
336
  out vec3 vOccupantTint;
337
- ${yn}
338
- ${Di}
339
- ${Oi}
337
+ ${vn}
338
+ ${Qi}
339
+ ${Zi}
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
- }`,tu=`#version 300 es
425
+ }`,Ou=`#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
- }`,nu=`#version 300 es
482
+ }`,Vu=`#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
- }`,ou=`#version 300 es
489
+ }`,Bu=`#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
- }`,ru=`#version 300 es
500
+ }`,Nu=`#version 300 es
501
501
  precision highp float;
502
502
  in vec2 position;
503
503
  in vec3 iOffset;
@@ -518,7 +518,7 @@ out float vPhysicalSeat;
518
518
  out float vDotWeight;
519
519
  out float vHidden;
520
520
  flat out vec3 vPick;
521
- ${yn}
521
+ ${vn}
522
522
  void main() {
523
523
  int id = gl_InstanceID + 1; // 0 reserved for no-hit
524
524
  vPick = vec3(float(id & 255), float((id >> 8) & 255), float((id >> 16) & 255)) / 255.0;
@@ -534,7 +534,7 @@ void main() {
534
534
  vPhysicalSeat = iPhysicalSeat;
535
535
  vHidden = (uFocusFloor > -0.5 && abs(iFloor - uFocusFloor) > 0.5) ? 1.0 : 0.0;
536
536
  gl_Position = projectionMatrix * mv;
537
- }`,iu=`#version 300 es
537
+ }`,Gu=`#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
- }`,au=`#version 300 es
551
+ }`,zu=`#version 300 es
552
552
  precision highp float;
553
553
  in vec3 position;
554
554
  in float part;
@@ -569,9 +569,9 @@ uniform float uBackBase;
569
569
  uniform float uFocusFloor;
570
570
  flat out vec3 vPick;
571
571
  out float vHidden;
572
- ${yn}
573
- ${Di}
574
- ${Oi}
572
+ ${vn}
573
+ ${Qi}
574
+ ${Zi}
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
- }`,su=`#version 300 es
607
+ }`,Hu=`#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
- }`,cu=`#version 300 es
615
+ }`,Uu=`#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
- }`,lu=`#version 300 es
626
+ }`,ju=`#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 Vi(e){return new We.Program(e,{vertex:ru,fragment:iu,transparent:!1,depthTest:!0,depthWrite:!0,cullFace:!1,uniforms:{uSeatRadius:{value:Oe},uSeatScale:{value:1},uMinPixels:{value:ut},uPixelToWorld:{value:.002},uChairFull:{value:At},uChairNone:{value:dt},uFocusFloor:{value:-1}}})}function Bi(e){return new We.Program(e,{vertex:au,fragment:su,transparent:!1,depthTest:!0,depthWrite:!0,cullFace:!1,uniforms:{uChairFull:{value:At},uChairNone:{value:dt},uBackRake:{value:Hn},uBackBase:{value:on},uFocusFloor:{value:-1}}})}function Ni(e){return new We.Program(e,{vertex:cu,fragment:lu,transparent:!1,depthTest:!0,depthWrite:!0,cullFace:!1,uniforms:{uFocusFloor:{value:-1}}})}function Gi(e,t=.78){return new We.Program(e,{vertex:Ql,fragment:$l,cullFace:!1,depthTest:!0,depthWrite:!0,uniforms:{uKeyDir:{value:new Float32Array([.38,.86,.34])},uFocusFloor:{value:-1},uStructureDetail:{value:0},uRoughness:{value:t}}})}function zi(e){return new We.Program(e,{vertex:Zl,fragment:Jl,transparent:!0,depthTest:!0,depthWrite:!1,cullFace:!1,uniforms:{uSeatRadius:{value:Oe},uSeatScale:{value:1},uMinPixels:{value:ut},uPixelToWorld:{value:.002},uSeatFade:{value:0},uSeatDetail:{value:0},uFocusFloor:{value:-1},uFadeColor:{value:new Float32Array([.32,.37,.43])},uChairFull:{value:At},uChairNone:{value:dt}}})}function Ui(e,t=.78){return new We.Program(e,{vertex:eu,fragment:tu,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:At},uChairNone:{value:dt},uBackRake:{value:Hn},uBackBase:{value:on},uFocusFloor:{value:-1},uRoughness:{value:t}}})}function Hi(e,t,n){return new We.Program(e,{vertex:nu,fragment:ou,depthTest:!1,depthWrite:!1,cullFace:!1,uniforms:{uTop:{value:new Float32Array(t)},uBottom:{value:new Float32Array(n)}}})}function ji(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 uu=new Float32Array([-1,-1,1,-1,1,1,-1,-1,1,1,-1,1]),du=new Float32Array([-1,-1,3,-1,-1,3]);function Xi(e,t){let n=new se.Transform,r=new se.Transform,o=new se.Geometry(e,{position:{size:2,data:du}}),i=Hi(e,t.theme.background.top,t.theme.background.bottom),a=new se.Mesh(e,{geometry:o,program:i});a.frustumCulled=!1,a.setParent(r);let s=new se.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=Gi(e,t.theme.materials.roughness),l=new se.Mesh(e,{geometry:s,program:c});l.frustumCulled=!1,l.setParent(n);let u=zi(e),p=new Float32Array(t.seats.count*3),d=Ae.map(_=>t.theme.seatStates[_]);ji(p,t.seats.iState,0,t.seats.count,d,t.seats.iCategory);let f=new se.Geometry(e,{position:{size:2,data:uu},iOffset:{size:3,data:t.seats.iPosition,instanced:1},iColor:{size:3,data:p,instanced:1},iMaxRadius:{size:1,data:t.seats.iMaxRadius,instanced:1},iPhysicalSeat:{size:1,data:t.seats.iPhysicalSeat,instanced:1},iRing:{size:3,data:t.seats.iRing,instanced:1},iFloor:{size:1,data:t.seats.iFloor,instanced:1}}),m=new se.Mesh(e,{geometry:f,program:u});m.frustumCulled=!1,t.seats.count>0&&m.setParent(n);let h=f.attributes.iColor,y=nr(),b=Ui(e,t.theme.materials.roughness),g=Qt,x=new Float32Array(g*3),v=new Float32Array(g*3),C=new Float32Array(g),S=new Float32Array(g),A=new Float32Array(g),L=new Float32Array(g*3),O=new Float32Array(g),z=new Float32Array(g),B=new Float32Array(g),T=new Float32Array(g),w=new se.Geometry(e,{position:{size:3,data:y.position},normal:{size:3,data:y.normal},part:{size:1,data:y.part},index:{data:y.index},iOffset:{size:3,data:x,instanced:1},iColor:{size:3,data:v,instanced:1},iRadius:{size:1,data:C,instanced:1},iYaw:{size:1,data:S,instanced:1},iGlyph:{size:1,data:A,instanced:1},iRing:{size:3,data:L,instanced:1},iFloor:{size:1,data:O,instanced:1},iPhysicalSeat:{size:1,data:z,instanced:1},iSeed:{size:1,data:T,instanced:1},iPickIndex:{size:1,data:B,instanced:1}}),R=new se.Mesh(e,{geometry:w,program:b});R.frustumCulled=!1;let P=0,I=!1,G=!1,k=null,M=null,E=null,D=new Int32Array(0),V=()=>{let _=t.seats;for(let F=0;F<P;F++){let X=D[F];T[F]=rr(_.iState[X],X);let q=_.iCategory&&_.iState[X]===0?null:d[_.iState[X]]??d[0];if(q)v[F*3]=q[0],v[F*3+1]=q[1],v[F*3+2]=q[2];else{let Q=t.theme.materials.seat??_o([_.iCategory[X*3],_.iCategory[X*3+1],_.iCategory[X*3+2]]);v[F*3]=Q[0],v[F*3+1]=Q[1],v[F*3+2]=Q[2]}}w.attributes.iColor.needsUpdate=!0,w.attributes.iSeed.needsUpdate=!0},H={main:n,background:r,seatProgram:u,solidProgram:c,chairProgram:b,seatGeometry:f,chairGeometry:w,solidGeometry:s,drawCalls:3,setNearSeats(_,F){let X=Math.min(F,g);if(D=_,P=X,X===0){R.parent&&R.setParent(null),w.instancedCount=0,H.drawCalls=3+(I?1:0);return}let W=t.seats;for(let q=0;q<X;q++){let Q=_[q];x[q*3]=W.iPosition[Q*3],x[q*3+1]=W.iPosition[Q*3+1],x[q*3+2]=W.iPosition[Q*3+2],C[q]=W.iChairWidth[Q],S[q]=W.iYaw[Q],A[q]=W.iGlyph[Q],L[q*3]=W.iRing[Q*3],L[q*3+1]=W.iRing[Q*3+1],L[q*3+2]=W.iRing[Q*3+2],O[q]=W.iFloor[Q],z[q]=W.iPhysicalSeat[Q],B[q]=Q+1}V(),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=X,R.parent||R.setParent(n),H.drawCalls=4+(I?1:0)},nearSeatCount(){return P},uploadSeatStateRuns(_){if(!_.length)return;P&&V();for(let X of _)ji(p,t.seats.iState,X.start,X.length,d,t.seats.iCategory);let F=h.buffer;if(!F){h.needsUpdate=!0;return}e.bindBuffer(e.ARRAY_BUFFER,F);for(let X of _){let W=p.subarray(X.start*3,(X.start+X.length)*3);e.bufferSubData(e.ARRAY_BUFFER,X.start*3*Float32Array.BYTES_PER_ELEMENT,W)}},dispose(){G=!0,o.remove(),i.remove(),s.remove(),c.remove(),f.remove(),u.remove(),w.remove(),b.remove(),k?.remove(),M?.remove(),E?.texture&&e.deleteTexture(E.texture)}},j=t.productionElements.find(_=>_.contentImageUrl&&_.contentPlane);if(j?.contentImageUrl&&j.contentPlane?.length===4&&typeof Image<"u"){let _=new Image;_.crossOrigin="anonymous",_.onload=()=>{if(G)return;let F=j.contentPlane;k=new se.Geometry(e,{position:{size:3,data:new Float32Array(F.flat())},uv:{size:2,data:new Float32Array([0,1,1,1,0,0,1,0])},floorIndex:{size:1,data:new Float32Array(4).fill(j.floorIndex)},index:{data:new Uint16Array([0,1,2,2,1,3])}}),E=new se.Texture(e,{image:_,generateMipmaps:!0,wrapS:e.CLAMP_TO_EDGE,wrapT:e.CLAMP_TO_EDGE,flipY:!1}),M=new se.Program(e,{vertex:`#version 300 es
633
+ }`;function $i(e){return new Xe.Program(e,{vertex:Nu,fragment:Gu,transparent:!1,depthTest:!0,depthWrite:!0,cullFace:!1,uniforms:{uSeatRadius:{value:De},uSeatScale:{value:1},uMinPixels:{value:mt},uPixelToWorld:{value:.002},uChairFull:{value:It},uChairNone:{value:ft},uFocusFloor:{value:-1}}})}function Ji(e){return new Xe.Program(e,{vertex:zu,fragment:Hu,transparent:!1,depthTest:!0,depthWrite:!0,cullFace:!1,uniforms:{uChairFull:{value:It},uChairNone:{value:ft},uBackRake:{value:qn},uBackBase:{value:an},uFocusFloor:{value:-1}}})}function ea(e){return new Xe.Program(e,{vertex:Uu,fragment:ju,transparent:!1,depthTest:!0,depthWrite:!0,cullFace:!1,uniforms:{uFocusFloor:{value:-1}}})}function ta(e,t=.78){return new Xe.Program(e,{vertex:_u,fragment:ku,cullFace:!1,depthTest:!0,depthWrite:!0,uniforms:{uKeyDir:{value:new Float32Array([.38,.86,.34])},uFocusFloor:{value:-1},uStructureDetail:{value:0},uRoughness:{value:t}}})}function na(e){return new Xe.Program(e,{vertex:Lu,fragment:Fu,transparent:!0,depthTest:!0,depthWrite:!1,cullFace:!1,uniforms:{uSeatRadius:{value:De},uSeatScale:{value:1},uMinPixels:{value:mt},uPixelToWorld:{value:.002},uSeatFade:{value:0},uSeatDetail:{value:0},uFocusFloor:{value:-1},uFadeColor:{value:new Float32Array([.32,.37,.43])},uChairFull:{value:It},uChairNone:{value:ft}}})}function oa(e,t=.78){return new Xe.Program(e,{vertex:Du,fragment:Ou,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:It},uChairNone:{value:ft},uBackRake:{value:qn},uBackBase:{value:an},uFocusFloor:{value:-1},uRoughness:{value:t}}})}function ra(e,t,n){return new Xe.Program(e,{vertex:Vu,fragment:Bu,depthTest:!1,depthWrite:!1,cullFace:!1,uniforms:{uTop:{value:new Float32Array(t)},uBottom:{value:new Float32Array(n)}}})}var Yu=.65,Xu=new Set(["dimmed","sold"]),Wu=new Set(["dimmed","sold","held"]);function ia(e,t,n){let r=new Set,o=!1,i=fe.indexOf("dimmed"),a=!1;for(let c=0;c<n.length;c+=1)if(n[c]===i){a=!0;break}let s=a?Wu:Xu;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 p of u){let m=fe[n[p]]??"available";if(!s.has(m)){d=!0;break}}d?r.add(c.sectionId):o=!0}return{lit:r,anyUnlit:o}}function aa(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])*Yu;a.push(s)}return a}function sa(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 Ku=new Float32Array([-1,-1,1,-1,1,1,-1,-1,1,1,-1,1]),qu=new Float32Array([-1,-1,3,-1,-1,3]);function ca(e,t){let n=new ce.Transform,r=new ce.Transform,o=new ce.Geometry(e,{position:{size:2,data:qu}}),i=ra(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=ta(e,t.theme.materials.roughness),u=new ce.Mesh(e,{geometry:s,program:c});u.frustumCulled=!1,u.setParent(n);let d=na(e),p=new Float32Array(t.seats.count*3),m=fe.map(X=>t.theme.seatStates[X]);sa(p,t.seats.iState,0,t.seats.count,m,t.seats.iCategory);let l=new ce.Geometry(e,{position:{size:2,data:Ku},iOffset:{size:3,data:t.seats.iPosition,instanced:1},iColor:{size:3,data:p,instanced:1},iMaxRadius:{size:1,data:t.seats.iMaxRadius,instanced:1},iPhysicalSeat:{size:1,data:t.seats.iPhysicalSeat,instanced:1},iRing:{size:3,data:t.seats.iRing,instanced:1},iFloor:{size:1,data:t.seats.iFloor,instanced:1}}),f=new ce.Mesh(e,{geometry:l,program:d});f.frustumCulled=!1,t.seats.count>0&&f.setParent(n);let h=l.attributes.iColor,y=t.solids.color.slice(),b=t.theme.structure.ground,x=new Map(t.sectionSolidRanges.map(X=>[X.sectionId,!0])),g=fr(),v=oa(e,t.theme.materials.roughness),P=$t,S=new Float32Array(P*3),C=new Float32Array(P*3),T=new Float32Array(P),B=new Float32Array(P),z=new Float32Array(P),D=new Float32Array(P*3),k=new Float32Array(P),A=new Float32Array(P),_=new Float32Array(P),V=new Float32Array(P),M=new ce.Geometry(e,{position:{size:3,data:g.position},normal:{size:3,data:g.normal},part:{size:1,data:g.part},index:{data:g.index},iOffset:{size:3,data:S,instanced:1},iColor:{size:3,data:C,instanced:1},iRadius:{size:1,data:T,instanced:1},iYaw:{size:1,data:B,instanced:1},iGlyph:{size:1,data:z,instanced:1},iRing:{size:3,data:D,instanced:1},iFloor:{size:1,data:k,instanced:1},iPhysicalSeat:{size:1,data:A,instanced:1},iSeed:{size:1,data:V,instanced:1},iPickIndex:{size:1,data:_,instanced:1}}),R=new ce.Mesh(e,{geometry:M,program:v});R.frustumCulled=!1;let E=0,w=!1,L=!1,I=null,O=null,j=null,U=new Int32Array(0),N=()=>{let X=t.seats;for(let Q=0;Q<E;Q++){let W=U[Q];V[Q]=hr(X.iState[W],W);let $=X.iCategory&&X.iState[W]===0?null:m[X.iState[W]]??m[0];if($)C[Q*3]=$[0],C[Q*3+1]=$[1],C[Q*3+2]=$[2];else{let te=t.theme.materials.seat??Go([X.iCategory[W*3],X.iCategory[W*3+1],X.iCategory[W*3+2]]);C[Q*3]=te[0],C[Q*3+1]=te[1],C[Q*3+2]=te[2]}}M.attributes.iColor.needsUpdate=!0,M.attributes.iSeed.needsUpdate=!0},F={main:n,background:r,seatProgram:d,solidProgram:c,chairProgram:v,seatGeometry:l,chairGeometry:M,solidGeometry:s,drawCalls:3,setNearSeats(X,Q){let W=Math.min(Q,P);if(U=X,E=W,W===0){R.parent&&R.setParent(null),M.instancedCount=0,F.drawCalls=3+(w?1:0);return}let Z=t.seats;for(let $=0;$<W;$++){let te=X[$];S[$*3]=Z.iPosition[te*3],S[$*3+1]=Z.iPosition[te*3+1],S[$*3+2]=Z.iPosition[te*3+2],T[$]=Z.iChairWidth[te],B[$]=Z.iYaw[te],z[$]=Z.iGlyph[te],D[$*3]=Z.iRing[te*3],D[$*3+1]=Z.iRing[te*3+1],D[$*3+2]=Z.iRing[te*3+2],k[$]=Z.iFloor[te],A[$]=Z.iPhysicalSeat[te],_[$]=te+1}N(),M.attributes.iOffset.needsUpdate=!0,M.attributes.iRadius.needsUpdate=!0,M.attributes.iYaw.needsUpdate=!0,M.attributes.iGlyph.needsUpdate=!0,M.attributes.iRing.needsUpdate=!0,M.attributes.iFloor.needsUpdate=!0,M.attributes.iPhysicalSeat.needsUpdate=!0,M.attributes.iSeed.needsUpdate=!0,M.attributes.iPickIndex.needsUpdate=!0,M.instancedCount=W,R.parent||R.setParent(n),F.drawCalls=4+(w?1:0)},nearSeatCount(){return E},setSectionShellLit(X){let Q=aa(t.sectionSolidRanges,t.solids.color,y,x,X,b);if(!Q.length)return;let W=s.attributes.color,Z=W.buffer;if(!Z){W.needsUpdate=!0;return}e.bindBuffer(e.ARRAY_BUFFER,Z);for(let $ of Q){let te=t.solids.color.subarray($.start*3,($.start+$.count)*3);e.bufferSubData(e.ARRAY_BUFFER,$.start*3*Float32Array.BYTES_PER_ELEMENT,te)}},uploadSeatStateRuns(X){if(!X.length)return;E&&N();for(let W of X)sa(p,t.seats.iState,W.start,W.length,m,t.seats.iCategory);let Q=h.buffer;if(!Q){h.needsUpdate=!0;return}e.bindBuffer(e.ARRAY_BUFFER,Q);for(let W of X){let Z=p.subarray(W.start*3,(W.start+W.length)*3);e.bufferSubData(e.ARRAY_BUFFER,W.start*3*Float32Array.BYTES_PER_ELEMENT,Z)}},dispose(){L=!0,o.remove(),i.remove(),s.remove(),c.remove(),l.remove(),d.remove(),M.remove(),v.remove(),I?.remove(),O?.remove(),j?.texture&&e.deleteTexture(j.texture)}},K=t.productionElements.find(X=>X.contentImageUrl&&X.contentPlane);if(K?.contentImageUrl&&K.contentPlane?.length===4&&typeof Image<"u"){let X=new Image;X.crossOrigin="anonymous",X.onload=()=>{if(L)return;let Q=K.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(K.floorIndex)},index:{data:new Uint16Array([0,1,2,2,1,3])}}),j=new ce.Texture(e,{image:X,generateMipmaps:!0,wrapS:e.CLAMP_TO_EDGE,wrapT:e.CLAMP_TO_EDGE,flipY:!1}),O=new ce.Program(e,{vertex:`#version 300 es
634
634
  precision highp float;
635
635
  in vec3 position; in vec2 uv; in float floorIndex;
636
636
  uniform mat4 modelViewMatrix; uniform mat4 projectionMatrix; uniform float uFocusFloor;
@@ -638,4 +638,4 @@ void main() {
638
638
  void main(){ vUv=uv; vDim=(uFocusFloor < -0.5 || abs(floorIndex-uFocusFloor)<0.5)?0.0:1.0; gl_Position=projectionMatrix*modelViewMatrix*vec4(position,1.0); }`,fragment:`#version 300 es
639
639
  precision highp float;
640
640
  in vec2 vUv; in float vDim; uniform sampler2D uImage; out vec4 fragColor;
641
- void main(){ if(vDim>0.5) discard; vec4 c=texture(uImage,vUv); if(c.a<0.01) discard; fragColor=c; }`,uniforms:{uImage:{value:E},uFocusFloor:{value:-1}},transparent:!1,depthTest:!0,depthWrite:!0,cullFace:!1});let X=new se.Mesh(e,{geometry:k,program:M});X.frustumCulled=!1,X.setParent(n),H.screenProgram=M,I=!0,H.drawCalls=3+(P?1:0)+1},_.src=j.contentImageUrl}return H}var ke=require("ogl");function mu(e,t,n){let r=e+(t<<8)+(n<<16);return r===0?-1:r-1}function Yi(e,t,n,r,o,i){let a=-1,s=1/0;for(let c=0;c<n;c++)for(let l=0;l<t;l++){let u=(c*t+l)*4,p=mu(e[u],e[u+1],e[u+2]);if(p<0||p>=i)continue;let d=l-r,f=c-o,m=d*d+f*f;m<s&&(s=m,a=p)}return a}function Wi(e,t,n,r,o,i){let a=e-n.left,s=t-n.top,c=Math.round(a*r),l=Math.round((n.height-s)*r);return{x:Math.max(0,Math.min(o-1,c)),y:Math.max(0,Math.min(i-1,l))}}var fu=["uSeatRadius","uSeatScale","uMinPixels","uPixelToWorld"],gn=class{constructor(t,n,r,o,i){this.seatScene=new ke.Transform;this.chairScene=new ke.Transform;this.solidScene=new ke.Transform;this.target=null;this.restoreClear=[0,0,0];this.renderer=t,this.gl=t.gl,this.maxIndex=i,this.seatProg=Vi(this.gl),this.chairProg=Bi(this.gl),this.depthProg=Ni(this.gl);let a=new ke.Mesh(this.gl,{geometry:n,program:this.seatProg});a.frustumCulled=!1,a.setParent(this.seatScene);let s=new ke.Mesh(this.gl,{geometry:r,program:this.chairProg});s.frustumCulled=!1,s.setParent(this.chairScene);let c=new ke.Mesh(this.gl,{geometry:o,program:this.depthProg});c.frustumCulled=!1,c.setParent(this.solidScene)}setRestoreClear(t){this.restoreClear=[t[0],t[1],t[2]]}syncFromSeatProgram(t){for(let r of fu)this.seatProg.uniforms[r].value=t.uniforms[r].value;let n=t.uniforms.uFocusFloor.value;this.seatProg.uniforms.uFocusFloor.value=n,this.chairProg.uniforms.uFocusFloor.value=n,this.depthProg.uniforms.uFocusFloor.value=n}ensureTarget(){let t=this.gl.drawingBufferWidth,n=this.gl.drawingBufferHeight;return this.target&&(this.target.width!==t||this.target.height!==n)&&this.destroyTarget(),this.target||(this.target=new ke.RenderTarget(this.gl,{width:t,height:n,depth:!0})),this.target}destroyTarget(){if(!this.target)return;let t=this.gl;this.target.buffer&&t.deleteFramebuffer(this.target.buffer);for(let n of this.target.textures??[])n.texture&&t.deleteTexture(n.texture);this.target.depthBuffer&&t.deleteRenderbuffer(this.target.depthBuffer),this.target=null}pick(t,n,r,o){let i=this.gl,a=this.ensureTarget(),s=i.drawingBufferWidth,c=i.drawingBufferHeight,l=Math.max(0,n-o),u=Math.max(0,r-o),p=Math.max(1,Math.min(s,n+o+1)-l),d=Math.max(1,Math.min(c,r+o+1)-u);i.enable(i.SCISSOR_TEST),i.scissor(l,u,p,d);let[f,m,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(f,m,h,1),i.disable(i.SCISSOR_TEST);let y=new Uint8Array(p*d*4);return this.renderer.bindFramebuffer(a),i.readPixels(l,u,p,d,i.RGBA,i.UNSIGNED_BYTE,y),this.renderer.bindFramebuffer(),Yi(y,p,d,n-l,r-u,this.maxIndex)}dispose(){this.destroyTarget(),this.seatProg.remove(),this.chairProg.remove(),this.depthProg.remove()}};function Ki(e,t){let n=[];for(let r of t)e.has(r.seatId)?e.set(r.seatId,Ct(r.state)):n.push(r);return n}function qi(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:Ae[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 Ke=require("ogl");function pu(e,t){return[e[0]-t[0],e[1]-t[1],e[2]-t[2]]}function Qi(e,t){return[e[0]+t[0],e[1]+t[1],e[2]+t[2]]}function hu(e,t){return[e[0]*t,e[1]*t,e[2]*t]}function $i(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 bo(e){let t=Math.max(0,Math.min(1,e));return t*t*t*(t*(t*6-15)+10)}function yo(e,t){return Math.max(0,Math.min(1,e+t))}function Zi(e,t){let n=e.length;if(n===0)return[0,0,0];if(n===1)return[...e[0]];let r=Math.max(0,Math.min(1,t)),o=n-1,i=Math.floor(r*o);i>=o&&(i=o-1);let a=r*o-i,s=e[Math.max(0,i-1)],c=e[i],l=e[i+1],u=e[Math.min(n-1,i+2)],p=a*a,d=p*a,f=[0,0,0];for(let m=0;m<3;m++)f[m]=.5*(2*c[m]+(-s[m]+l[m])*a+(2*s[m]-5*c[m]+4*l[m]-u[m])*p+(-s[m]+3*c[m]-3*l[m]+u[m])*d);return f}function go(e,t,n,r,o){let i=$i(pu(t,n));i[0]===0&&i[1]===0&&i[2]===0&&(i=[0,0,1]);let a=Qi(Qi(t,hu(i,2.5)),[0,1.5,0]),s=[t[0]-r[0],0,t[2]-r[2]],c=$i(s);c[0]===0&&c[2]===0&&(c=[i[0],0,i[2]]);let l=Math.max(1,o),u=[r[0]+c[0]*l*1.3,r[1]+l*.75,r[2]+c[2]*l*1.3];return{waypoints:[e,u,a],finalPos:a}}function xo(e,t,n=35,r=28){let o=bo(t),i=Zi(e,o),a=bo(Math.max(0,Math.min(1,(t-.66)/.34)));return{pos:i,fov:n+(r-n)*a,eased:o}}function na(e,t,n){let r=e.position.clone(),o=new Ke.Quat().copy(e.quaternion);e.position.set(t[0],t[1],t[2]),e.lookAt(new Ke.Vec3(n[0],n[1],n[2]));let i=new Ke.Quat().copy(e.quaternion);return e.position.copy(r),e.quaternion.copy(o),i}var xn=class{constructor(t){this.active=!1;this.waypoints=[];this.startQuat=new Ke.Quat;this.endQuat=new Ke.Quat;this.outQuat=new Ke.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}=xo(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,yo(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 bu=1.02,yu=1.5;function oa(e,t,n=0,r){let o=Number.isFinite(r)?n+r:e[1]+bu;return{eye:[e[0],o,e[2]],focal:[t.x*N,n+yu,t.y*N]}}var gt=Math.PI/180,gu=45,ra=80,xu=.25,vo=1,vu=.25,Su=12*gt,Mu=.2,wu=1.5,ia=.8,aa=6,ua=1.9,Pu=2/3,Cu=.12,Au=.9,Iu=1.2,Ru=2,da=.05,Eu=6;function ma(e,t,n=0){if(!e.length)return{min:[t[0]-6,n,t[2]-6],max:[t[0]+6,Math.max(n+ia,t[1]),t[2]+6]};let r=1/0,o=-1/0,i=1/0,a=-1/0,s=n;for(let m of e)r=Math.min(r,m.cx-m.halfX),o=Math.max(o,m.cx+m.halfX),i=Math.min(i,m.cz-m.halfZ),a=Math.max(a,m.cz+m.halfZ),s=Math.max(s,m.y);let c=o-r,l=a-i,u=Math.max(c,Math.min(l,aa))/2,p=Math.max(l,Math.min(c,aa))/2,d=(r+o)/2,f=(i+a)/2;return{min:[d-u,n,f-p],max:[d+u,Math.max(n+ia,s),f+p]}}function Tu(e){return{min:[e.min[0],e.min[1],e.min[2]],max:[e.max[0],e.max[1]+ua,e.max[2]]}}function ku(e){let t=e.max[1];return[(e.min[0]+e.max[0])/2,Math.max(e.min[1]+wu,t+Mu,t+ua*Pu),(e.min[2]+e.max[2])/2]}function fa(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 sa(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,l=Math.hypot(s,c);if(l<1e-6)return 1/0;s/=l,c/=l;let u=1/0,p=-1/0;for(let d=0;d<8;d++){let f=(d&1?n.max[0]:n.min[0])-e[0],m=(d&2?n.max[1]:n.min[1])-e[1],h=(d&4?n.max[2]:n.min[2])-e[2],y=Math.max(da,f*r+m*o+h*i),b=(f*s+h*c)/y;b<u&&(u=b),b>p&&(p=b)}return p-u}function ca(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,l=Math.hypot(s,c);if(l<1e-6)return 1/0;s/=l,c/=l;let u=-c*o,p=c*r-s*i,d=s*o,f=1/0,m=-1/0;for(let h=0;h<8;h++){let y=(h&1?n.max[0]:n.min[0])-e[0],b=(h&2?n.max[1]:n.min[1])-e[1],g=(h&4?n.max[2]:n.min[2])-e[2],x=Math.max(da,y*r+b*o+g*i),v=(y*u+b*p+g*d)/x;v<f&&(f=v),v>m&&(m=v)}return m-f}function vn(e,t){return Math.tan(e*gt/2)*Math.max(.05,t)}function la(e,t,n){let r=s=>Math.max(gu,Math.min(ra,s)),o=s=>2*Math.atan(s)/gt,i=Number.isFinite(e)&&e>0?r(o(e/(2*xu)/Math.max(.05,n))):ra;if(!(Number.isFinite(t)&&t>0))return i;let a=Math.min(i,r(o(t/(2*Cu))));return e/(2*vn(a,n))>vo?i:a}function pa(e,t,n){let r=ku(t),o=[e[0],e[1],e[2]],i=0,a=0,s=f=>{if(!(f>0))return;let m=fa(o,r);o[0]+=m.x*f,o[2]+=m.z*f,a+=f},c=t.max[1]+vu-o[1];c>0&&(o[1]+=c,i=c,s(c/Math.tan(Su)));let l=Tu(t),u=sa(o,r,t),p=la(u,ca(o,r,l),n),d=u/(2*vn(p,n));for(let f=0;f<Eu&&d>vo;f++){let m=Math.max(1,Math.hypot(o[0]-r[0],o[2]-r[2])),h=Number.isFinite(d)?d/vo:2;s(Math.min(60,m*(Math.min(4,h)-1)+.5)),u=sa(o,r,t),p=la(u,ca(o,r,l),n),d=u/(2*vn(p,n))}return{eye:o,focal:r,fov:p,raisedM:i,pulledBackM:a,stageFrameWidth:d}}function Lu(e,t,n){let r=Math.tan(t*gt/2),o=vn(t,n);return Math.max(1,e/Math.max(.05,Math.min(r,o)))}function ha(e,t){let{aspect:n,venue:r}=t,o=e.focal,i=fa(e.eye,o),a=d=>(d[0]-o[0])*i.x+(d[2]-o[2])*i.z,s=[{name:"seat",eye:e.eye,focal:o,fov:e.fov}],c=Ru*(t.rowDepthM??Au);s.push({name:"row",eye:[e.eye[0]+i.x*c,e.eye[1]+Iu,e.eye[2]+i.z*c],focal:o,fov:e.fov});let l=(d,f,m,h)=>{let y=Lu(m,e.fov,n)*1.08,b=y*Math.sin(h*gt),g=y*Math.cos(h*gt);return{name:d,eye:[f[0]+i.x*g,f[1]+b,f[2]+i.z*g],focal:f,fov:e.fov}};t.section&&t.section.radius>0&&s.push(l("section",t.section.center,t.section.radius,14)),s.push(l("venue",r.center,Math.max(1,r.radius),26));let u=[],p=-1/0;for(let d of s){let f=a(d.eye);u.length&&f<=p+.5||(u.push(d),p=f)}return u}var va=require("ogl"),Nt=Math.PI/180,ba=320,ya=70*Nt,_u=32*Nt,Fu=24*Nt,ga=.0026,Du=.22,Ou=.006,Vu=180,Bu=4,ge=(e,t,n)=>Math.max(t,Math.min(n,e)),xa=e=>e<.5?4*e*e*e:1-Math.pow(-2*e+2,3)/2;function Sa(e){let{canvas:t,camera:n}=e,r=[],o=!1,i=0,a=0,s=0,c=0,l=0,u=0,p=!1,d=[0,0],f=0,m=!1,h=null,y=null,b=new Map,g=!1,x=0,v=0,C=0,S=0,A=()=>o&&r.length?r[ge(Math.round(i),0,r.length-1)].name:null,L=()=>{let M=A();M!==h&&(h=M,e.onStopChange?.(M))},O=()=>{if(!o||!r.length)return;let M=r[ge(Math.floor(i),0,r.length-1)],E=r[ge(Math.ceil(i),0,r.length-1)],D=ge(i-Math.floor(i),0,1),V=(we,Pe)=>we+(Pe-we)*D,H=[V(M.eye[0],E.eye[0]),V(M.eye[1],E.eye[1]),V(M.eye[2],E.eye[2])],j=[V(M.focal[0],E.focal[0]),V(M.focal[1],E.focal[1]),V(M.focal[2],E.focal[2])],_=j[0]-H[0],F=j[1]-H[1],X=j[2]-H[2],W=Math.hypot(_,F,X)||1,q=Math.atan2(_,X),Q=Math.asin(ge(F/W,-1,1)),Z=q+a,re=ge(Q+s,-80*Nt,80*Nt),Ie=Math.cos(re)*W;_=Math.sin(Z)*Ie,F=Math.sin(re)*W,X=Math.cos(Z)*Ie,n.position.set(H[0],H[1],H[2]),n.fov=V(M.fov,E.fov),n.updateProjectionMatrix(),n.lookAt(new va.Vec3(H[0]+_,H[1]+F,H[2]+X)),e.onApplied?.()},z=()=>{if(!o||!r.length)return;let M=ge(Math.round(i),0,r.length-1);if(e.reducedMotion()){p=!1,i=M,O(),L(),e.requestRender();return}if(Math.abs(M-i)<.001){p=!1,L();return}c=i,l=M,u=performance.now(),p=!0,e.requestRender()},B=M=>{!o||r.length<2||(p=!1,i=ge(i+M,0,r.length-1),O(),L(),e.requestRender())},T=(M,E)=>{o&&(p=!1,m=!1,a=ge(a-M*ga,-ya,ya),s=ge(s-E*ga,-Fu,_u),O(),e.requestRender())},w=M=>{o&&(b.set(M.pointerId,{x:M.clientX,y:M.clientY}),b.size===1?(g=!0,S=0,x=M.clientX,v=M.clientY):b.size===2&&(g=!1,C=R()))},R=()=>{let M=[...b.values()];return M.length<2?0:Math.hypot(M[0].x-M[1].x,M[0].y-M[1].y)},P=M=>{if(!o||!b.has(M.pointerId))return;if(b.set(M.pointerId,{x:M.clientX,y:M.clientY}),b.size>=2){let V=R();C>0&&B((C-V)*Ou),C=V;return}if(!g)return;let E=M.clientX-x,D=M.clientY-v;x=M.clientX,v=M.clientY,S+=Math.abs(E)+Math.abs(D),!(S<=Bu)&&T(E,D)},I=M=>{b.delete(M.pointerId)&&(b.size<2&&(C=0),b.size===0&&(g=!1,z()))},G=M=>{if(!o)return;M.preventDefault();let E=M.deltaMode===1?16:M.deltaMode===2?100:1,D=ge(M.deltaY*E/100,-2,2);B(D*Du),y&&clearTimeout(y),y=setTimeout(()=>{y=null,z()},Vu)},k=()=>{o&&(o=!1,p=!1,m=!1,r=[],b.clear(),g=!1,y&&(clearTimeout(y),y=null),h!==null&&(h=null,e.onStopChange?.(null)))};return t.addEventListener("pointerdown",w),t.addEventListener("pointermove",P),t.addEventListener("pointerup",I),t.addEventListener("pointercancel",I),t.addEventListener("wheel",G,{passive:!1}),{get active(){return o},enter(M){if(M.length<2){k();return}r=M,o=!0,i=0,a=0,s=0,p=!1,m=!1,h=null,O(),L(),e.requestRender()},exit:k,recentre(){return o?Math.abs(a)<1e-4&&Math.abs(s)<1e-4?!0:e.reducedMotion()?(m=!1,a=0,s=0,O(),e.requestRender(),!0):(d=[a,s],f=performance.now(),m=!0,e.requestRender(),!0):!1},update(M){if(!o)return!1;let E=!1;if(m){let D=ge((M-f)/ba,0,1),V=1-xa(D);a=d[0]*V,s=d[1]*V,D>=1?(m=!1,a=0,s=0):E=!0}if(p){let D=ge((M-u)/ba,0,1);i=c+(l-c)*xa(D),D>=1?(p=!1,i=l,L()):E=!0}return O(),E},currentStop:A,dispose(){k(),t.removeEventListener("pointerdown",w),t.removeEventListener("pointermove",P),t.removeEventListener("pointerup",I),t.removeEventListener("pointercancel",I),t.removeEventListener("wheel",G)}}}var Po=null;function Fa(){return Po??=Promise.resolve().then(()=>(_a(),La)).catch(e=>{throw Po=null,e}),Po}var Da=()=>typeof performance<"u"&&performance.now?performance.now():Date.now(),An=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=Da(),this.emit("3d_panorama_opened")}panoramaClosed(){let t=this.panoramaOpenedAt?Math.round(Da()-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 Oa(e){let t=e.style.position;return getComputedStyle(e).position!=="static"?()=>{}:(e.style.position="relative",()=>{e.style.position==="relative"&&(e.style.position=t)})}function Va(e){let{container:t,model:n,opts:r,expandedSeatById:o,seatIdsByRow:i,isNarrow:a}=e,s=null,c=()=>{if(!s)return;let p=a();Object.assign(s.style,p?{left:"12px",right:"12px",bottom:"70px",transform:"none",justifyContent:"center"}:{left:"50%",right:"auto",bottom:"18px",transform:"translateX(-50%)",justifyContent:"initial"})},l=()=>{s?.remove(),s=null};return{show:(p,d,f=!1)=>{if(l(),e.isDisposed())return null;let m=document.createElement("div");m.setAttribute("role","group"),Object.assign(m.style,{position:"absolute",display:"flex",flexDirection:"column",alignItems:"center",gap:"6px",zIndex:"4"});let h=r.chrome?.caption!==!1,y=r.chrome?.seatStepper!==!1;if(!h&&!y)return null;let b=o.get(p),g=b?.sectionId?n.sections.find(z=>z.id===b.sectionId):void 0,x=b?.label??p;m.setAttribute("aria-label",`Explore views near ${g?.label?`${g.label}, `:""}seat ${x}`);let v=document.createElement("span");v.textContent=r.seatViewCaption?.(p)??["Live 3D seat view",g?.label,x].filter(Boolean).join(" \xB7 "),Object.assign(v.style,{maxWidth:"min(70vw, 560px)",padding:"5px 10px",borderRadius:"999px",overflow:"hidden",color:"#d9e3f5",background:"rgba(12,18,32,0.72)",font:"600 11px/1.2 inherit",textOverflow:"ellipsis",whiteSpace:"nowrap",backdropFilter:"blur(6px)"}),h&&m.appendChild(v);let C=document.createElement("div");Object.assign(C.style,{display:"flex",alignItems:"center",justifyContent:"center",gap:"6px"}),m.appendChild(C);let S=b?.rowId?i.get(b.rowId):void 0,A=S?.indexOf(p)??-1,L=A>=0?[S?.[A-1],S?.[A+1]]:[void 0,void 0],O=(z,B,T,w=!1)=>{let R=document.createElement("button");R.type="button",R.textContent=z,R.setAttribute("aria-label",B),Object.assign(R.style,{minHeight:"44px",padding:w?"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"}),w||(R.style.minWidth="44px"),w&&(R.dataset.panoramaTrigger=""),R.addEventListener("click",T),C.appendChild(R)};if(y&&L[0]){let z=o.get(L[0])?.label??L[0];O("\u2039",`View previous seat ${z}`,()=>{e.flyToSeat(L[0])})}if(y&&r.getSeatView){let z=r.seatViewActionLabel?.(p)??"Open 360\xB0 panorama";O(f?`\u21BB Retry ${z}`:`\u25C9 ${z}`,`${f?"Retry":z} from seat ${x}`,()=>{if(e.isDisposed()||d!==e.flightGen()){l();return}l(),e.openPanorama(p,400,d)},!0)}if(y&&L[1]){let z=o.get(L[1])?.label??L[1];O("\u203A",`View next seat ${z}`,()=>{e.flyToSeat(L[1])})}return!C.childElementCount&&!h?null:(t.appendChild(m),s=m,c(),m)},remove:l,layout:c}}function Ba(e){let{container:t,orbit:n,isNarrow:r}=e,o=document.createElement("div"),i=!1;o.className="sl-3d-navigation-controls",Object.assign(o.style,{position:"absolute",right:"14px",bottom:"14px",display:"flex",zIndex:"4",flexDirection:"column",alignItems:"flex-end",gap:"7px"});let a=document.createElement("div");a.setAttribute("role","group"),a.setAttribute("aria-label","3D drag mode"),Object.assign(a.style,{display:"flex",flexDirection:"column",gap:"6px",alignItems:"flex-end"});let s=document.createElement("div");s.setAttribute("role","group"),s.setAttribute("aria-label","3D view controls"),Object.assign(s.style,{display:"flex",flexDirection:"column",gap:"6px",alignItems:"flex-end"});let c=document.createElement("button");c.type="button",c.textContent="\u21BB",c.setAttribute("aria-label","Drag to rotate the 3D venue"),c.dataset.tooltip="Rotate venue";let l=document.createElement("button");l.type="button",l.textContent="\u2725",l.setAttribute("aria-label","Drag to move the 3D venue left, right, up or down"),l.dataset.tooltip="Move venue";let u=document.createElement("button");u.type="button",u.textContent="\u2212",u.setAttribute("aria-label","Zoom out of the 3D venue"),u.dataset.tooltip="Zoom out";let p=document.createElement("button");p.type="button",p.textContent="+",p.setAttribute("aria-label","Zoom into the 3D venue"),p.dataset.tooltip="Zoom in";for(let y of[c,l,u,p])y.className="sl-3d-icon-control",Object.assign(y.style,{width:"44px",minWidth:"44px",minHeight:"44px",padding:"9px",border:"1px solid rgba(150,165,205,0.35)",borderRadius:"999px",color:"#c9d4ea",background:"rgba(12,18,32,0.82)",font:"600 17px/1 inherit",backdropFilter:"blur(6px)",cursor:"pointer",whiteSpace:"nowrap"});a.append(c,l),s.append(p,u);let d=y=>{n.setPrimaryDragMode(y);let b=y==="orbit";c.setAttribute("aria-pressed",String(b)),l.setAttribute("aria-pressed",String(!b)),c.style.background=b?"rgba(96,110,150,0.68)":"rgba(12,18,32,0.82)",l.style.background=b?"rgba(12,18,32,0.82)":"rgba(96,110,150,0.68)",o.title=b?"Drag to rotate \xB7 Shift-drag to move":"Drag to move \xB7 Shift-drag to rotate"};c.addEventListener("click",()=>d("orbit")),l.addEventListener("click",()=>d("pan")),u.addEventListener("click",()=>n.zoomBy(1.22)),p.addEventListener("click",()=>n.zoomBy(.82)),o.append(a,s),d("orbit"),t.appendChild(o);let f=e.enabled!==!1,m=()=>{let y=r();o.style.display=i||!f?"none":"flex",o.style.right=y?"12px":"14px",o.style.bottom=y?"calc(env(safe-area-inset-bottom, 0px) + 76px)":"14px",a.style.display=y?"none":"flex",p.style.display=y?"none":"",u.style.display=y?"none":""};return m(),{element:o,utilityControls:s,setNavigationMode:d,setSeatViewLocked:y=>{i=y,n.setInteractionEnabled(!y),m()},seatViewLocked:()=>i,layout:m}}function Na(e){let{glctx:t,orbit:n,model:r,seats:o,opts:i,cinematic:a,analytics:s,seatIdByIndex:c,sectionIdBySeatId:l,tapSlop:u,tapMs:p,cancelFlight:d,focusSectionCamera:f,setSelection:m,ensureSeatView:h}=e,y=0,b=0,g=0,x=-1,v=!1,C=!1,S=B=>{e.seatViewLocked()||x===-1&&(x=B.pointerId,y=B.clientX,b=B.clientY,g=performance.now(),v=!1,C=a.active,a.active&&(s.cinematicCancelled(),d(),i.onViewTargetChange?.(null)))},A=B=>{B.pointerId===x&&Math.hypot(B.clientX-y,B.clientY-b)>u&&(v=!0)},L=(B,T,w,R,P)=>{let I=t.canvas.getBoundingClientRect(),G=t.canvas.clientWidth||I.width||1,k=t.canvas.clientHeight||I.height||1,M=B-I.left,E=T-I.top,D=R*R,V=-1,H=D,j=1/0;for(let _ of o){if(w&&_.sectionId!==w)continue;let F=r.seats.idToIndex.get(_.id);if(F===void 0)continue;if(P){let re=Math.round(r.seats.iState[F]??0);if(re!==0&&re!==3)continue}let X=F*3,W=Ye(n.camera.projectionViewMatrix,[r.seats.iPosition[X],r.seats.iPosition[X+1]+.55,r.seats.iPosition[X+2]],G,k);if(!W.visible)continue;let q=W.x-M,Q=W.y-E,Z=q*q+Q*Q;(Z<H||Math.abs(Z-H)<1&&W.depth<j)&&(V=F,H=Z,j=W.depth)}return V},O=(B,T)=>{let w=e.gpu(),R=e.pick();if(!w||!R)return-1;R.syncFromSeatProgram(w.seatProgram);let P=t.canvas.getBoundingClientRect(),I=t.renderer.dpr,{x:G,y:k}=Wi(B,T,P,I,t.gl.drawingBufferWidth,t.gl.drawingBufferHeight),M=Math.max(2,Math.round(8*I));return R.pick(n.camera,G,k,M)};return{onDown:S,onMove:A,onUp:B=>{if(B.pointerId!==x)return;let T=!v&&performance.now()-g<p;if(x=-1,C){C=!1;return}let w=e.gpu(),R=e.pick();if(!T||!w||!R)return;let P=O(B.clientX,B.clientY);if(e.focusedSectionId()&&P>=0){let k=c[P],M=k?l.get(k):void 0;if(M&&M!==e.focusedSectionId()&&f(M))return}if(e.focusedSectionId()&&P<0&&(P=L(B.clientX,B.clientY,e.focusedSectionId(),44,!1)),e.focusedSectionId()&&P<0){let k=L(B.clientX,B.clientY,null,72,!1),M=k>=0?c[k]:void 0,E=M?l.get(M):void 0;if(E&&E!==e.focusedSectionId()&&f(E))return}if(!e.focusedSectionId()){P<0&&(P=L(B.clientX,B.clientY,null,42,!1));let k=P>=0?c[P]:void 0,M=k?l.get(k):void 0;if(M&&f(M))return}if(P<0||P>=c.length){e.selection().size&&(m([]),i.onViewTargetChange?.(null));return}let I=c[P],G=Ae[Math.round(r.seats.iState[P]??0)]??"available";if(G!=="available"&&G!=="selected"){i.onSeatInspect?.(I,G);return}if(e.selection().has(I)&&e.selection().size===1){m([]),i.onViewTargetChange?.(null),i.onSeatPick?.(I);return}m([I]),h(I),s.seatPicked(I,l.get(I)),i.onSeatPick?.(I)}}}var In=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 f=0;f<this.count;f++){let m=t[f*3],h=t[f*3+2];m<n&&(n=m),m>o&&(o=m),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,l=new Int32Array(c+1),u=f=>{let m=Math.min(this.cols-1,Math.max(0,Math.floor((t[f*3]-n)/this.cell)));return Math.min(this.rows-1,Math.max(0,Math.floor((t[f*3+2]-r)/this.cell)))*this.cols+m};for(let f=0;f<this.count;f++)l[u(f)+1]++;for(let f=0;f<c;f++)l[f+1]+=l[f];let p=new Int32Array(this.count),d=l.slice(0,c);for(let f=0;f<this.count;f++)p[d[u(f)]++]=f;this.cellStart=l,this.cellItems=p}gather(t,n,r,o){this.ensureGrid();let i=this.cellStart,a=this.cellItems;if(!i||!a)return 0;let s=o.length,c=r*r,l=Math.floor((t-this.minX)/this.cell),u=Math.floor((n-this.minZ)/this.cell),p=Math.ceil(r/this.cell)+1,d=this.iPosition,f=0;for(let m=0;m<=p&&f<s;m++){let h=u-m,y=u+m,b=l-m,g=l+m;for(let x=h;x<=y&&f<s;x++){if(x<0||x>=this.rows)continue;let v=x===h||x===y;for(let C=b;C<=g&&f<s;C++){if(!v&&C!==b&&C!==g){C=g-1;continue}if(C<0||C>=this.cols)continue;let S=x*this.cols+C;for(let A=i[S],L=i[S+1];A<L&&f<s;A++){let O=a[A],z=d[O*3]-t,B=d[O*3+2]-n;z*z+B*B<=c&&(o[f++]=O)}}}}return f}};var Rn=class{constructor(t){this.ctx=t;this.detailVisible=!1;this.seatDetailMix=0;this.structureDetailMix=0;this.nearBuf=new Int32Array(Qt);this.lastGatherX=1/0;this.lastGatherZ=1/0;this.nearIndex=new In(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)<Bn)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>Vn){r.nearSeatCount()&&r.setNearSeats(this.nearBuf,0);return}let s=this.nearIndex.gather(o.x,o.z,Vn,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 En=require("ogl");function Ga(e){let{container:t,model:n,opts:r,orbit:o,cinematic:i,analytics:a,loop:s,labelOverlay:c,stageAzimuth:l,overviewFraming:u}=e,p=0,d=-1,f=(C,S,A=28)=>{o.camera.position.set(C[0],C[1],C[2]),o.camera.lookAt(new En.Vec3(S[0],S[1],S[2])),o.camera.fov=A,o.camera.updateProjectionMatrix()},m=document.createElement("button");m.className="sl-3d-overview-control sl-3d-icon-control",m.type="button",m.textContent="\u2302",m.setAttribute("aria-label","Fit the active level or whole venue in view"),m.dataset.tooltip="Fit view",Object.assign(m.style,{width:"44px",minWidth:"44px",minHeight:"44px",padding:"9px",borderRadius:"999px",background:"rgba(12,18,32,0.72)",color:"#c9d4ea",border:"1px solid rgba(150,165,205,0.35)",backdropFilter:"blur(6px)",font:"600 11px/1 inherit",cursor:"pointer",whiteSpace:"nowrap"});let h=()=>{m.textContent="\u2302"};h();let y=C=>{d=C;let S=e.gpu();S&&(S.seatProgram.uniforms.uFocusFloor.value=C,S.solidProgram.uniforms.uFocusFloor.value=C,S.chairProgram.uniforms.uFocusFloor.value=C),e.showSectionSeatLabels(null)},b=()=>{if(e.isDisposed())return;r.onViewTargetChange?.(null),r.onSectionFocusChange?.(null),e.panorama()&&(e.panorama().dispose(),e.setPanorama(null),a.panoramaClosed()),e.setPanoramaSphereVisible(!1),e.panoramaLoadAbort()?.abort(),e.setPanoramaLoadAbort(null),e.restorePanoramaLayer(),m.style.display="",c.setVisible(!0),e.setFrozen(!1);let C=d>=0?n.floors[d]:null;if(e.setNearFieldDetailEnabled(!!C),e.setSeatViewLocked(!1),g(),e.removeArriveChip(),e.setNavigationMode("orbit"),C){let S=C.focalWorld[0]-C.center[0],A=C.focalWorld[2]-C.center[2],L=Math.hypot(S,A)>C.radius*.12?Math.atan2(S,A):l,O={center:C.center,radius:C.radius,box:C.box},z={polarDeg:58,margin:1.12};e.reducedMotion()?o.frame(O,!1,L,!1,z):o.frameSoft(O,L,!1,z)}else e.reducedMotion()?o.frame(n.bounds,!1,l,r.portraitOverviewCrop===!0,u):o.frameSoft(n.bounds,l,r.portraitOverviewCrop===!0,u);e.showSectionSeatLabels(null),s.requestRender()},g=()=>{p++,e.setSeatStepping(!1),e.panoramaLoadAbort()?.abort(),e.setPanoramaLoadAbort(null),i.active&&(i.cancel(),o.resumeAfterFlight(n.focalWorld))},x=C=>{if(e.isDisposed()||!e.gpu())return Promise.resolve();let S=n.seats.idToIndex.get(C);if(S===void 0)return Promise.resolve();e.setNearFieldDetailEnabled(!0),r.onViewTargetChange?.(C),e.panorama()&&(e.panorama().dispose(),e.setPanorama(null),e.setPanoramaSphereVisible(!1),m.style.display="",e.restorePanoramaLayer()),e.panoramaLoadAbort()?.abort(),e.setPanoramaLoadAbort(null),e.setFrozen(!1);let A=e.inSeatView()&&r.arriveAtSeatEye===!0;e.setSeatStepping(A),e.setSeatViewLocked(!1);let L=++p;A?e.showArriveChip(C,L):e.removeArriveChip();let{eye:O,focal:z}=e.resolvedSeatViewPose(C,S),B=r.arriveAtSeatEye?e.seatViewArrival(C,S):null,T=B?B.focal:z,w=[o.camera.position.x,o.camera.position.y,o.camera.position.z],R=go(w,B?.eye??O,T,n.bounds.center,n.bounds.radius),P=B?B.eye:r.arriveAtSeatEye?O:R.finalPos,I=B?B.fov:r.arriveAtSeatEye?t.clientWidth/Math.max(1,t.clientHeight)<.7?90:65:28,G=[R.waypoints[0],R.waypoints[1],P];if(c.setVisible(!1),e.reducedMotion())return e.setSeatStepping(!1),f(P,T,I),s.requestRender(),a.cinematicSkipped(),e.isDisposed()||o.syncFromCamera(),e.setSeatViewLocked(r.arriveAtSeatEye===!0),B&&e.enterSeatView(B.stops),e.showArriveChip(C,L),Promise.resolve();let k=new En.Quat().copy(o.camera.quaternion),M=na(o.camera,P,T);s.requestRender();let E=A?700:2500;return i.start(G,k,M,E,I).then(()=>{e.isDisposed()||L!==p||(e.setSeatStepping(!1),a.cinematicPlayed(E),o.resumeAfterFlight(T),e.setSeatViewLocked(r.arriveAtSeatEye===!0),B&&e.enterSeatView(B.stops),s.requestRender(),e.showArriveChip(C,L))})},v=C=>{let S=n.sections.find(z=>z.id===C);if(!S||S.seatCount===0)return!1;e.setNearFieldDetailEnabled(!0),e.setSeatStepping(!1),e.setSeatViewLocked(!1),i.cancel(),e.removeArriveChip(),n.floors.length>1&&d!==S.floorIndex&&y(S.floorIndex),e.setNavigationMode("pan"),e.showSectionSeatLabels(C);let A=S.focalWorld[0]-S.center[0],L=S.focalWorld[2]-S.center[2],O=Math.hypot(A,L)>S.radius*.12?Math.atan2(A,L):void 0;return o.frame({center:S.center,radius:Math.max(5,S.radius*.5)},!1,O),r.onSectionFocusChange?.(C),s.requestRender(),!0};return m.addEventListener("click",b),{overviewChip:m,layoutOverviewChip:h,flightGen:()=>p,focusedFloor:()=>d,applyFloorFocus:y,placeCameraFinal:f,cancelFlight:g,focusOverview:b,flyToSeat:x,focusSectionCamera:v}}var Ju={};function za(e){let t=performance.now();return{model:bt(e),buildMs:performance.now()-t,source:"main"}}function Zu(e){let t=wr(e.doc);return{...za({...e,seats:t}),seats:t}}function Ua(e,t,n){if(typeof Worker>"u")return Promise.resolve(t());let r;try{r=new Worker(new URL("./scene/scene.worker.js",Ju.url),{type:"module"})}catch{return Promise.resolve(t())}return new Promise(o=>{let i=!1,a=l=>{i||(i=!0,clearTimeout(c),r.terminate(),o(l))},s=()=>a(t()),c=window.setTimeout(s,15e3);r.onerror=s,r.onmessage=l=>{let u=n(l.data);u?a(u):s()},r.postMessage(e)})}function Ha(e){return Ua(e,()=>za(e),({model:t,buildMs:n})=>({model:t,buildMs:n,source:"worker"}))}function ja(e){return Ua(e,()=>Zu(e),({model:t,buildMs:n,seats:r})=>r?{model:t,buildMs:n,seats:r,source:"worker"}:null)}var ed=Math.PI/180,td=6,nd=500;function od(e,t,n={}){let r=performance.now(),o=t.prepared?.model??bt(t),i=new An(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 l=new Map;for(let U of t.seats)l.set(U.id,U.sectionId);let u=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)),p=null,d=null,f=!1,m=!1,h=!1,y=new Map,b=null,g=null,x=null,v=new Map,C=null,S=()=>{x===null&&(x=e.style.zIndex,e.style.zIndex="20")},A=()=>{x!==null&&(e.style.zIndex==="20"&&(e.style.zIndex=x),x=null)},L=!1,O=()=>L?fe.focusedFloor():-1,z=()=>{p=Xi(R.gl,o),d=new gn(R.renderer,p.seatGeometry,p.chairGeometry,p.solidGeometry,o.seats.count),R.setClearColor(o.theme.background.top),d.setRestoreClear(o.theme.background.top),p.seatProgram.uniforms.uSeatRadius.value=Oe*o.theme.seatScale,p.seatProgram.uniforms.uFocusFloor.value=O(),p.solidProgram.uniforms.uFocusFloor.value=O(),p.chairProgram.uniforms.uFocusFloor.value=O(),p.screenProgram&&(p.screenProgram.uniforms.uFocusFloor.value=O()),T.forceRegather()},B=!1,T=new Rn({model:o,orbit:()=>P,gpu:()=>p}),w=U=>T.setDetailEnabled(U),R=new Wt(e,{onContextLost:()=>{h||i.contextLost(),f=!0,W.stop(),p=null,d=null},onContextRestored:()=>{z(),f=!1,h||i.contextRestored(),W.requestRender()}}),P=new Kt(R.gl,R.canvas,()=>W.requestRender(),()=>i.orbitEngaged());P.setAspect(R.aspect);let I=(t.doc.floors?.flatMap(U=>U.objects)??t.doc.objects).some(U=>U.type==="section"&&U.physical3dProvenance?.surfaceKind?.status==="inferred"),G=(()=>{if(I&&o.stages.length===0)return;let U=o.focalWorld[0]-o.bounds.center[0],Y=o.focalWorld[2]-o.bounds.center[2];return Math.hypot(U,Y)>o.bounds.radius*.12?Math.atan2(U,Y):void 0})(),k=o.floors.length>1?{polarDeg:48,margin:1.1}:{margin:1.1},M=typeof window<"u"&&!!window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches;P.frame(o.bounds,!M&&n.skipInitialOverviewAnimation!==!0,G,n.portraitOverviewCrop===!0,k);let E=new xn(P.camera),D=Oa(e),V=new hn(e,{fontFamily:t.doc.theme?.fontFamily,ink:t.doc.theme?.textColor,backgroundRgb:o.theme.background.top}),H=o.labels,j=()=>ci(H,o.floors.length,O());V.setLabels(j());let _=null,F=U=>{if(_=U,V.setForcedDense(!!U),!U){V.setLabels(j());return}let Y=t.seats.filter($=>$.sectionId===U),K=new Set(Y.map($=>$.id)),J=new Set(Y.map($=>$.rowId)),ne=new Set(y.keys()),oe=new Set(Y.filter($=>ne.has($.id)).map($=>$.id)),ae=j().filter($=>$.kind!=="row"&&$.kind!=="seat"||($.kind==="row"?J.has($.id.slice(4)):K.has($.id.slice(5))&&(oe.size===0||oe.has($.id.slice(5)))));if(o.seatCount<=6e3&&oe.size===0){V.setLabels(ae);return}let ue=oe.size?Y.filter($=>oe.has($.id)):Y,$e=new Set(ue.map($=>`seat:${$.id}`)),Ue=ue.flatMap($=>{let pe=o.seats.idToIndex.get($.id);if(pe===void 0)return[];let Re=pe*3;return[{id:`seat:${$.id}`,kind:"seat",text:$.displayLabel||$.label,anchor:[o.seats.iPosition[Re],o.seats.iPosition[Re+1]+(ne.has($.id)?1.05:.55),o.seats.iPosition[Re+2]]}]});V.setLabels([...ae.filter($=>!$e.has($.id)),...Ue])};z();let X=null,W=new qt(U=>{if(f||!p||m)return!1;let K=E.active?E.update(performance.now()):X?.active?X.update(performance.now()):P.update(),J=O()>=0?o.floors[O()]:null,ne=J?.radius??o.bounds.radius,oe=Uo(P.currentDistance,ne),ae=B?{center:[P.camera.position.x,P.camera.position.y,P.camera.position.z],radius:520}:o.renderBounds;P.updateClipping(ae);let ue=J?.center??o.renderBounds.center,$e=J?.radius??o.renderBounds.radius,Ue=(Ee,Mt)=>Math.hypot(P.camera.position.x-Ee[0],P.camera.position.y-Ee[1],P.camera.position.z-Ee[2])<=Mt*(T.detailVisible?1.8:1.55),$=Ue(ue,$e);if(!$&&_){let Ee=o.sections.find(Mt=>Mt.id===_);Ee&&($=Ue(Ee.center,Math.max(12,Ee.radius*2)))}T.detailVisible=$;let pe=p.seatProgram.uniforms;pe.uSeatScale.value=oe.scale,pe.uSeatFade.value=oe.fade;let Re=!!J&&Ho(J.seatCount,R.canvas.clientWidth||1,R.canvas.clientHeight||1),Ht=jo(o.seats.count,ne,P.currentDistance,P.camera.fov,R.canvas.clientHeight||1),St=T.detailVisible||Re||Ht?1:0,jt=T.detailVisible||O()>=0||o.floors.length>1?1:0;return T.ease(U,St,jt),pe.uSeatDetail.value=T.seatDetailMix,p.solidProgram.uniforms.uStructureDetail.value=T.structureDetailMix,pe.uMinPixels.value=oe.minPixels,pe.uPixelToWorld.value=2*Math.tan(P.camera.fov*ed/2)/Math.max(1,R.pixelHeight),T.update(T.detailVisible),R.renderer.render({scene:p.background,clear:!0}),R.renderer.render({scene:p.main,camera:P.camera,clear:!1}),V.update(P.camera.projectionViewMatrix,R.canvas.clientWidth||1,R.canvas.clientHeight||1,P.currentDistance,ne,[P.camera.position.x,P.camera.position.y,P.camera.position.z]),K||T.seatDetailMix!==St||T.structureDetailMix!==jt}),q=typeof ResizeObserver<"u"?new ResizeObserver(()=>kn.resize()):null;q?.observe(e);let Q=U=>{let Y=ne=>{let oe=o.seats.idToIndex.get(ne);return oe===void 0?void 0:o.seats.iState[oe]},{updates:K,next:J}=qi(y,U,Y);if(y=J,V.setSelectedSeatIds(y.keys()),_&&F(_),K.length){let ne=Xn(o.seats,K);p&&p.uploadSeatStateRuns(ne),W.requestRender()}},Z=()=>C!==null?C:typeof window<"u"&&!!window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,re=8,Ie=U=>{if(!n.getSeatView)return null;let Y=v.get(U);if(!Y)for(Y=Promise.resolve(n.getSeatView(U)),v.set(U,Y),Y.catch(()=>{v.get(U)===Y&&v.delete(U)});v.size>re;){let K=v.keys().next().value;if(K===void 0)break;v.delete(K)}return Y},we=(U,Y)=>{let K=s.get(U),J=Math.max(0,Math.round(o.seats.iFloor[Y]??0)),ne=t.doc.floors?.[J],oe=o.floors[J],ae=ne?.focalPoint??t.doc.focalPoint,ue=oe?{x:oe.focalWorld[0]/N,y:oe.focalWorld[2]/N}:ae,$e=K?.focalPoint?{x:K.focalPoint.x+ue.x-ae.x,y:K.focalPoint.y+ue.y-ae.y}:ue,Ue=[o.seats.iPosition[Y*3],o.seats.iPosition[Y*3+1],o.seats.iPosition[Y*3+2]];return oa(Ue,$e,ne?.baseHeightM??0,K?.eyeHeightM)},Pe=()=>(e.clientWidth||R.canvas.clientWidth)<=520,_e=null,Fe=null,Ne=async(U,Y,K)=>{if(!n.getSeatView||h||K!==fe.flightGen())return;let J;try{J=await Fa()}catch{if(i.panoramaFailed(U,"mount"),!h&&K===fe.flightGen()){let ne=de(U,K,!0);requestAnimationFrame(()=>ne?.querySelector("[data-panorama-trigger]")?.focus())}return}if(!(h||K!==fe.flightGen()||!_e))return Fe??=J.createOpenPanorama(_e),Fe(U,Y,K)},xe=Va({container:e,model:o,opts:n,expandedSeatById:s,seatIdsByRow:c,isNarrow:Pe,isDisposed:()=>h,flightGen:()=>fe.flightGen(),flyToSeat:U=>Io(U),openPanorama:(U,Y,K)=>Ne(U,Y,K)}),de=xe.show,Ge=xe.remove,xt=xe.layout,Ce=Ba({container:e,orbit:P,isNarrow:Pe,enabled:n.chrome?.controlDock!==!1}),Qe=Ce.element,De=Ce.setNavigationMode,zt=Ce.layout,Xa=Ce.utilityControls,vt=null,Co=!1,Ut=U=>{Ce.setSeatViewLocked(U),U||X?.exit()};X=Sa({canvas:R.canvas,camera:P.camera,requestRender:()=>W.requestRender(),reducedMotion:Z,onStopChange:U=>{let Y=U??(Co?"seat":null);vt=Y;try{n.onSeatViewStopChange?.(Y)}catch{}},onApplied:()=>{h||P.syncFromCamera()}});let Ya=ma(o.stages,o.focalWorld,o.bounds.groundY??0),Wa=(U,Y)=>{let{eye:K}=we(U,Y),J=(e.clientWidth||R.canvas.clientWidth||1)/Math.max(1,e.clientHeight||R.canvas.clientHeight||1),ne=pa(K,Ya,J);if(n.seatViewStops===!1)return{...ne,stops:[]};let oe=l.get(U),ae=oe?o.sections.find(ue=>ue.id===oe):void 0;return{...ne,stops:ha(ne,{aspect:J,section:ae&&ae.seatCount>0?{center:ae.center,radius:ae.radius}:null,venue:{center:o.bounds.center,radius:o.bounds.radius}})}},fe=Ga({container:e,model:o,opts:n,orbit:P,cinematic:E,analytics:i,loop:W,labelOverlay:V,stageAzimuth:G,overviewFraming:k,gpu:()=>p,isDisposed:()=>h,panorama:()=>b,setPanorama:U=>{b=U},setPanoramaSphereVisible:U=>{B=U},panoramaLoadAbort:()=>g,setPanoramaLoadAbort:U=>{g=U},setFrozen:U=>{m=U},restorePanoramaLayer:A,reducedMotion:Z,resolvedSeatViewPose:we,showSectionSeatLabels:F,setNearFieldDetailEnabled:w,setSeatViewLocked:Ut,setNavigationMode:De,showArriveChip:de,removeArriveChip:Ge,inSeatView:()=>vt!==null,setSeatStepping:U=>{Co=U},seatViewArrival:(U,Y)=>n.arriveAtSeatEye?Wa(U,Y):null,enterSeatView:U=>X?.enter(U)});L=!0;let Tn=fe.overviewChip,Ka=fe.layoutOverviewChip,qa=fe.applyFloorFocus,Qa=fe.focusOverview,Ao=fe.cancelFlight,Io=fe.flyToSeat,Ro=fe.focusSectionCamera;Xa.appendChild(Tn),_e={container:e,model:o,opts:n,analytics:i,orbit:P,loop:W,seatsById:s,ensureSeatView:Ie,resolvedSeatViewPose:we,gpu:()=>p,gl:R.gl,isContextLost:()=>f,isDisposed:()=>h,flightGen:()=>fe.flightGen(),setPanorama:U=>{b=U},getLoadAbort:()=>g,setLoadAbort:U=>{g=U},setPanoramaSphereVisible:U=>{B=U,U&&X?.exit()},setFrozen:U=>{m=U},raisePanoramaLayer:S,restorePanoramaLayer:A,getOverviewChip:()=>Tn,labelOverlay:V,reducedMotion:Z,removeArriveChip:Ge,showArriveChip:de};let ze=Na({glctx:R,orbit:P,model:o,seats:t.seats,opts:n,cinematic:E,analytics:i,seatIdByIndex:a,sectionIdBySeatId:l,tapSlop:td,tapMs:nd,gpu:()=>p,pick:()=>d,seatViewLocked:()=>Ce.seatViewLocked(),focusedSectionId:()=>_,selection:()=>y,cancelFlight:Ao,focusSectionCamera:Ro,setSelection:Q,ensureSeatView:Ie});R.canvas.addEventListener("pointerdown",ze.onDown),R.canvas.addEventListener("pointermove",ze.onMove),R.canvas.addEventListener("pointerup",ze.onUp),R.canvas.addEventListener("pointercancel",ze.onUp),W.requestRender();let kn={setAvailability(U){let Y=Ki(y,U),K=Xn(o.seats,Y);K.length&&p&&p.uploadSeatStateRuns(K),W.requestRender()},setSelection:Q,setNavigationMode:De,zoomIn(){P.zoomBy(.82),W.requestRender()},zoomOut(){P.zoomBy(1.22),W.requestRender()},flyToSeat:Io,focusOverview:Qa,seatViewStop:()=>vt,recentreSeatView:()=>X?.recentre()??!1,resize(){let{width:U,height:Y}=R.resize();P.setAspect(U/Math.max(1,Y)),xt(),zt(),Ka(),W.requestRender()},stats(){return{...W.stats(),drawCalls:p?p.drawCalls:0,seatCount:o.seatCount}},getQualityEvidence(){let U=W.stats(),Y=R.canvas.clientWidth||1,K=R.canvas.clientHeight||1,J=o.bounds.center,ne=Ye(P.camera.projectionViewMatrix,[J[0],o.bounds.box.min[1],J[2]],Y,K),oe=Ye(P.camera.projectionViewMatrix,[J[0],o.bounds.box.max[1],J[2]],Y,K),ae=o.bounds.box,ue=[ae.min[0],ae.max[0]].flatMap($=>[ae.min[1],ae.max[1]].flatMap(pe=>[ae.min[2],ae.max[2]].map(Re=>Ye(P.camera.projectionViewMatrix,[$,pe,Re],Y,K)))).filter($=>Number.isFinite($.x)&&Number.isFinite($.y)&&Number.isFinite($.depth)),$e=ue.length?(()=>{let $=Math.min(...ue.map(Ze=>Ze.x)),pe=Math.max(...ue.map(Ze=>Ze.x)),Re=Math.min(...ue.map(Ze=>Ze.y)),Ht=Math.max(...ue.map(Ze=>Ze.y)),St=Math.max(0,$),jt=Math.min(Y,pe),Ee=Math.max(0,Re),Mt=Math.min(K,Ht),Xt=Math.max(0,jt-St),Ln=Math.max(0,Mt-Ee);return{box:{x:St,y:Ee,width:Xt,height:Ln},horizontalFillRatio:Xt/Y,verticalFillRatio:Ln/K,visibleAreaRatio:Xt*Ln/(Y*K),clippedEdges:[...Re<0?["top"]:[],...pe>Y?["right"]:[],...Ht>K?["bottom"]:[],...$<0?["left"]:[]]}})():void 0,Ue=String(R.gl.getParameter(R.gl.VERSION)??"");return{viewport:{width:Y,height:K},context:{webgl2:/webgl\s*2/i.test(Ue),lost:f},frame:{rendered:U.rendered,idle:U.idle},camera:{position:[P.camera.position.x,P.camera.position.y,P.camera.position.z],distance:P.currentDistance,verticalFovDeg:P.fovY},scene:{seatCount:o.seatCount,floorCount:o.floors.length,zoneCount:o.zones.length,sectionCount:o.sections.length,authoredRelief:u,renderedVerticalSpanM:Math.max(0,o.bounds.box.max[1]-o.bounds.box.min[1]),projectedReliefPx:ne.visible&&oe.visible?Math.abs(ne.y-oe.y):0},labels:V.qualityEvidence(),framing:$e,...vt?{seatView:{fovDeg:P.camera.fov,stop:vt}}:{}}},getQualityReport(){return bn(kn.getQualityEvidence())},loseContextForTest(){R.simulateContextLossCycle()},floors(){return o.floors},focusFloor(U){if(U!==null&&!o.floors.some(K=>K.index===U))return!1;let Y=U??-1;if(w(U!==null),Ut(!1),qa(Y),De("orbit"),U===null)E.cancel(),Z()?P.frame(o.bounds,!1,G,n.portraitOverviewCrop===!0,k):P.frameSoft(o.bounds,G,n.portraitOverviewCrop===!0,k);else{let K=o.floors[U];if(K.seatCount>0){E.cancel();let J=K.focalWorld[0]-K.center[0],ne=K.focalWorld[2]-K.center[2],oe=Math.hypot(J,ne)>K.radius*.12?Math.atan2(J,ne):G;P.frame({center:K.center,radius:K.radius,box:K.box},!1,oe,!1,{polarDeg:58,margin:1.12})}}return W.requestRender(),!0},zones(){return o.zones},focusZone(U){let Y=o.zones.find(oe=>oe.id===U);if(!Y||Y.seatCount===0)return!1;w(!1),Ut(!1),E.cancel(),De("orbit"),F(null),n.onSectionFocusChange?.(null);let K=Y.focalWorld[0]-Y.center[0],J=Y.focalWorld[2]-Y.center[2],ne=Math.hypot(K,J)>Y.radius*.12?Math.atan2(K,J):void 0;return P.frame({center:Y.center,radius:Y.radius*1.25},!1,ne),W.requestRender(),!0},sections(){return o.sections},focusSection(U){return Ro(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(K=>K.id===U);return!Y||Y.seatCount===0?!1:(w(!0),Ut(!1),E.cancel(),De("pan"),Y.sectionId&&(F(Y.sectionId),n.onSectionFocusChange?.(Y.sectionId)),P.frame({center:Y.center,radius:Math.max(2.5,Y.radius*.65)}),W.requestRender(),!0)},setReducedMotionForTest(U){C=U},dispose(){h=!0,Ge(),Tn.remove(),Qe.remove(),Ao(),X?.dispose(),W.stop(),V.dispose(),q?.disconnect(),b&&(b.dispose(),b=null),A(),D(),R.canvas.removeEventListener("pointerdown",ze.onDown),R.canvas.removeEventListener("pointermove",ze.onMove),R.canvas.removeEventListener("pointerup",ze.onUp),R.canvas.removeEventListener("pointercancel",ze.onUp),P.dispose(),d&&d.dispose(),p&&p.dispose(),p=null,d=null,R.dispose()}};return i.opened(o.seatCount,u,t.prepared?.buildMs??performance.now()-r,t.prepared?.source??"inline"),kn}0&&(module.exports={VENUE3D_QUALITY_REPORT_VERSION,buildSceneModel,inspectVenue3DQualityEvidence,mountVenue3D,prepareVenue3D,prepareVenue3DFromChart});
641
+ void main(){ if(vDim>0.5) discard; vec4 c=texture(uImage,vUv); if(c.a<0.01) discard; fragColor=c; }`,uniforms:{uImage:{value:j},uFocusFloor:{value:-1}},transparent:!1,depthTest:!0,depthWrite:!0,cullFace:!1});let W=new ce.Mesh(e,{geometry:I,program:O});W.frustumCulled=!1,W.setParent(n),F.screenProgram=O,w=!0,F.drawCalls=3+(E?1:0)+1},X.src=K.contentImageUrl}return F}var _e=require("ogl");function Qu(e,t,n){let r=e+(t<<8)+(n<<16);return r===0?-1:r-1}function la(e,t,n,r,o,i){let a=-1,s=1/0;for(let c=0;c<n;c++)for(let u=0;u<t;u++){let d=(c*t+u)*4,p=Qu(e[d],e[d+1],e[d+2]);if(p<0||p>=i)continue;let m=u-r,l=c-o,f=m*m+l*l;f<s&&(s=f,a=p)}return a}function ua(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 Zu=["uSeatRadius","uSeatScale","uMinPixels","uPixelToWorld"],Sn=class{constructor(t,n,r,o,i){this.seatScene=new _e.Transform;this.chairScene=new _e.Transform;this.solidScene=new _e.Transform;this.target=null;this.restoreClear=[0,0,0];this.renderer=t,this.gl=t.gl,this.maxIndex=i,this.seatProg=$i(this.gl),this.chairProg=Ji(this.gl),this.depthProg=ea(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 Zu)this.seatProg.uniforms[r].value=t.uniforms[r].value;let n=t.uniforms.uFocusFloor.value;this.seatProg.uniforms.uFocusFloor.value=n,this.chairProg.uniforms.uFocusFloor.value=n,this.depthProg.uniforms.uFocusFloor.value=n}ensureTarget(){let t=this.gl.drawingBufferWidth,n=this.gl.drawingBufferHeight;return this.target&&(this.target.width!==t||this.target.height!==n)&&this.destroyTarget(),this.target||(this.target=new _e.RenderTarget(this.gl,{width:t,height:n,depth:!0})),this.target}destroyTarget(){if(!this.target)return;let t=this.gl;this.target.buffer&&t.deleteFramebuffer(this.target.buffer);for(let n of this.target.textures??[])n.texture&&t.deleteTexture(n.texture);this.target.depthBuffer&&t.deleteRenderbuffer(this.target.depthBuffer),this.target=null}pick(t,n,r,o){let i=this.gl,a=this.ensureTarget(),s=i.drawingBufferWidth,c=i.drawingBufferHeight,u=Math.max(0,n-o),d=Math.max(0,r-o),p=Math.max(1,Math.min(s,n+o+1)-u),m=Math.max(1,Math.min(c,r+o+1)-d);i.enable(i.SCISSOR_TEST),i.scissor(u,d,p,m);let[l,f,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,f,h,1),i.disable(i.SCISSOR_TEST);let y=new Uint8Array(p*m*4);return this.renderer.bindFramebuffer(a),i.readPixels(u,d,p,m,i.RGBA,i.UNSIGNED_BYTE,y),this.renderer.bindFramebuffer(),la(y,p,m,n-u,r-d,this.maxIndex)}dispose(){this.destroyTarget(),this.seatProg.remove(),this.chairProg.remove(),this.depthProg.remove()}};function da(e,t){let n=[];for(let r of t)e.has(r.seatId)?e.set(r.seatId,Rt(r.state)):n.push(r);return n}function ma(e,t,n){let r=new Set;for(let a of t)(e.has(a)||n(a)!==void 0)&&r.add(a);let o=new Map(e),i=[];for(let[a,s]of e)r.has(a)||(i.push({seatId:a,state:fe[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 $u(e,t){return[e[0]-t[0],e[1]-t[1],e[2]-t[2]]}function fa(e,t){return[e[0]+t[0],e[1]+t[1],e[2]+t[2]]}function Ju(e,t){return[e[0]*t,e[1]*t,e[2]*t]}function pa(e){let t=Math.hypot(e[0],e[1],e[2]);return t>1e-6?[e[0]/t,e[1]/t,e[2]/t]:[0,0,0]}function wo(e){let t=Math.max(0,Math.min(1,e));return t*t*t*(t*(t*6-15)+10)}function Po(e,t){return Math.max(0,Math.min(1,e+t))}function ha(e,t){let n=e.length;if(n===0)return[0,0,0];if(n===1)return[...e[0]];let r=Math.max(0,Math.min(1,t)),o=n-1,i=Math.floor(r*o);i>=o&&(i=o-1);let a=r*o-i,s=e[Math.max(0,i-1)],c=e[i],u=e[i+1],d=e[Math.min(n-1,i+2)],p=a*a,m=p*a,l=[0,0,0];for(let f=0;f<3;f++)l[f]=.5*(2*c[f]+(-s[f]+u[f])*a+(2*s[f]-5*c[f]+4*u[f]-d[f])*p+(-s[f]+3*c[f]-3*u[f]+d[f])*m);return l}function Co(e,t,n,r,o){let i=pa($u(t,n));i[0]===0&&i[1]===0&&i[2]===0&&(i=[0,0,1]);let a=fa(fa(t,Ju(i,2.5)),[0,1.5,0]),s=[t[0]-r[0],0,t[2]-r[2]],c=pa(s);c[0]===0&&c[2]===0&&(c=[i[0],0,i[2]]);let u=Math.max(1,o),d=[r[0]+c[0]*u*1.3,r[1]+u*.75,r[2]+c[2]*u*1.3];return{waypoints:[e,d,a],finalPos:a}}function Ao(e,t,n=35,r=28){let o=wo(t),i=ha(e,o),a=wo(Math.max(0,Math.min(1,(t-.66)/.34)));return{pos:i,fov:n+(r-n)*a,eased:o}}function xa(e,t,n){let r=e.position.clone(),o=new We.Quat().copy(e.quaternion);e.position.set(t[0],t[1],t[2]),e.lookAt(new We.Vec3(n[0],n[1],n[2]));let i=new We.Quat().copy(e.quaternion);return e.position.copy(r),e.quaternion.copy(o),i}var Mn=class{constructor(t){this.active=!1;this.waypoints=[];this.startQuat=new We.Quat;this.endQuat=new We.Quat;this.outQuat=new We.Quat;this.startTime=0;this.duration=2500;this.endFov=28;this.resolveFn=null;this.camera=t}start(t,n,r,o=2500,i=28){return this.settle(),this.waypoints=t,this.startQuat.copy(n),this.endQuat.copy(r),this.duration=o,this.endFov=i,this.startTime=performance.now(),this.active=!0,new Promise(a=>{this.resolveFn=a})}update(t){if(!this.active)return!1;let n=Math.min(1,(t-this.startTime)/this.duration),{pos:r,fov:o,eased:i}=Ao(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,Po(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 va=Zn,ed=.12,td=.25,nd=1.5;function Sa(e,t,n=0,r,o){let i=[t.x*G,n+nd,t.y*G],a=o?[o[0],o[1],o[2]]:i,s=e[1],c=Number.isFinite(s)?s+va:Number.isFinite(r)?n+r:n+va,u=i[0]-e[0],d=i[2]-e[2],p=Math.hypot(u,d),m=p>.001?Math.min(ed,p*td):0,l=p>.001?u/p:0,f=p>.001?d/p:0;return{eye:[e[0]+l*m,c,e[2]+f*m],focal:a}}var st=Math.PI/180,od=45,Ma=80,wn=70,rd=1,id=.99;function ad(e,t){if(!(e<rd))return Ma;if(!(Number.isFinite(t)&&t>0))return wn;let n=2*Math.atan(t/(2*Pn*id)/Math.max(.05,e))/st;return Math.max(wn,Math.min(Ma,n))}var sd=.25,Pn=1,cd=.25,ld=12*st,ud=.2,dd=1.5,wa=.8,Pa=6,Ia=1.9,md=2/3,fd=.12,pd=.9,hd=1.2,bd=2,Ea=.05,yd=6;function Ta(e,t,n=0){if(!e.length)return{min:[t[0]-6,n,t[2]-6],max:[t[0]+6,Math.max(n+wa,t[1]),t[2]+6]};let r=1/0,o=-1/0,i=1/0,a=-1/0,s=n;for(let f of e)r=Math.min(r,f.cx-f.halfX),o=Math.max(o,f.cx+f.halfX),i=Math.min(i,f.cz-f.halfZ),a=Math.max(a,f.cz+f.halfZ),s=Math.max(s,f.y);let c=o-r,u=a-i,d=Math.max(c,Math.min(u,Pa))/2,p=Math.max(u,Math.min(c,Pa))/2,m=(r+o)/2,l=(i+a)/2;return{min:[m-d,n,l-p],max:[m+d,Math.max(n+wa,s),l+p]}}function gd(e){return{min:[e.min[0],e.min[1],e.min[2]],max:[e.max[0],e.max[1]+Ia,e.max[2]]}}function Ro(e){let t=e.max[1];return[(e.min[0]+e.max[0])/2,Math.max(e.min[1]+dd,t+ud,t+Ia*md),(e.min[2]+e.max[2])/2]}function _a(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 Ca(e,t,n){let r=t[0]-e[0],o=t[1]-e[1],i=t[2]-e[2],a=Math.hypot(r,o,i)||1;r/=a,o/=a,i/=a;let s=-i,c=r,u=Math.hypot(s,c);if(u<1e-6)return 1/0;s/=u,c/=u;let d=1/0,p=-1/0;for(let m=0;m<8;m++){let l=(m&1?n.max[0]:n.min[0])-e[0],f=(m&2?n.max[1]:n.min[1])-e[1],h=(m&4?n.max[2]:n.min[2])-e[2],y=Math.max(Ea,l*r+f*o+h*i),b=(l*s+h*c)/y;b<d&&(d=b),b>p&&(p=b)}return p-d}function Aa(e,t,n){let r=t[0]-e[0],o=t[1]-e[1],i=t[2]-e[2],a=Math.hypot(r,o,i)||1;r/=a,o/=a,i/=a;let s=-i,c=r,u=Math.hypot(s,c);if(u<1e-6)return 1/0;s/=u,c/=u;let d=-c*o,p=c*r-s*i,m=s*o,l=1/0,f=-1/0;for(let h=0;h<8;h++){let y=(h&1?n.max[0]:n.min[0])-e[0],b=(h&2?n.max[1]:n.min[1])-e[1],x=(h&4?n.max[2]:n.min[2])-e[2],g=Math.max(Ea,y*r+b*o+x*i),v=(y*d+b*p+x*m)/g;v<l&&(l=v),v>f&&(f=v)}return f-l}function Cn(e,t){return Math.tan(e*st/2)*Math.max(.05,t)}function Ra(e,t,n){let r=ad(n,e),o=c=>Math.max(od,Math.min(r,c)),i=c=>2*Math.atan(c)/st,a=Number.isFinite(e)&&e>0?o(i(e/(2*sd)/Math.max(.05,n))):r;if(!(Number.isFinite(t)&&t>0))return a;let s=Math.min(a,o(i(t/(2*fd))));return e/(2*Cn(s,n))>Pn?a:s}function ka(e,t,n){let r=Ro(t),o=[e[0],e[1],e[2]],i=0,a=0,s=l=>{if(!(l>0))return;let f=_a(o,r);o[0]+=f.x*l,o[2]+=f.z*l,a+=l},c=t.max[1]+cd-o[1];c>0&&(o[1]+=c,i=c,s(c/Math.tan(ld)));let u=gd(t),d=Ca(o,r,t),p=Ra(d,Aa(o,r,u),n),m=d/(2*Cn(p,n));for(let l=0;l<yd&&m>Pn;l++){let f=Math.max(1,Math.hypot(o[0]-r[0],o[2]-r[2])),h=Number.isFinite(m)?m/Pn:2;s(Math.min(60,f*(Math.min(4,h)-1)+.5)),d=Ca(o,r,t),p=Ra(d,Aa(o,r,u),n),m=d/(2*Cn(p,n))}return{eye:o,focal:r,fov:p,raisedM:i,pulledBackM:a,stageFrameWidth:m}}function xd(e,t,n){let r=Math.tan(t*st/2),o=Cn(t,n);return Math.max(1,e/Math.max(.05,Math.min(r,o)))}function La(e,t){let{aspect:n,venue:r}=t,o=e.focal,i=_a(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=bd*(t.rowDepthM??pd);s.push({name:"row",eye:[e.eye[0]+i.x*c,e.eye[1]+hd,e.eye[2]+i.z*c],focal:o,fov:e.fov});let u=(m,l,f,h)=>{let y=xd(f,e.fov,n)*1.08,b=y*Math.sin(h*st),x=y*Math.cos(h*st);return{name:m,eye:[l[0]+i.x*x,l[1]+b,l[2]+i.z*x],focal:l,fov:e.fov}};t.section&&t.section.radius>0&&s.push(u("section",t.section.center,t.section.radius,14)),s.push(u("venue",r.center,Math.max(1,r.radius),26));let d=[],p=-1/0;for(let m of s){let l=a(m.eye);d.length&&l<=p+.5||(d.push(m),p=l)}return d}var Ba=require("ogl"),zt=Math.PI/180,Fa=320,Da=70*zt,vd=32*zt,Sd=24*zt,Oa=.0026,Md=.22,wd=.006,Pd=180,Cd=4,Se=(e,t,n)=>Math.max(t,Math.min(n,e)),Va=e=>e<.5?4*e*e*e:1-Math.pow(-2*e+2,3)/2;function Na(e){let{canvas:t,camera:n}=e,r=[],o=!1,i=0,a=0,s=0,c=0,u=0,d=0,p=!1,m=[0,0],l=0,f=!1,h=null,y=null,b=new Map,x=!1,g=0,v=0,P=0,S=0,C=()=>o&&r.length?r[Se(Math.round(i),0,r.length-1)].name:null,T=()=>{let w=C();w!==h&&(h=w,e.onStopChange?.(w))},B=()=>{if(!o||!r.length)return;let w=r[Se(Math.floor(i),0,r.length-1)],L=r[Se(Math.ceil(i),0,r.length-1)],I=Se(i-Math.floor(i),0,1),O=(Le,Pe)=>Le+(Pe-Le)*I,j=[O(w.eye[0],L.eye[0]),O(w.eye[1],L.eye[1]),O(w.eye[2],L.eye[2])],U=[O(w.focal[0],L.focal[0]),O(w.focal[1],L.focal[1]),O(w.focal[2],L.focal[2])],N=U[0]-j[0],F=U[1]-j[1],K=U[2]-j[2],X=Math.hypot(N,F,K)||1,Q=Math.atan2(N,K),W=Math.asin(Se(F/X,-1,1)),Z=Q+a,$=Se(W+s,-80*zt,80*zt),te=Math.cos($)*X;N=Math.sin(Z)*te,F=Math.sin($)*X,K=Math.cos(Z)*te,n.position.set(j[0],j[1],j[2]),n.fov=O(w.fov,L.fov),n.updateProjectionMatrix(),n.lookAt(new Ba.Vec3(j[0]+N,j[1]+F,j[2]+K)),e.onApplied?.()},z=()=>{if(!o||!r.length)return;let w=Se(Math.round(i),0,r.length-1);if(e.reducedMotion()){p=!1,i=w,B(),T(),e.requestRender();return}if(Math.abs(w-i)<.001){p=!1,T();return}c=i,u=w,d=performance.now(),p=!0,e.requestRender()},D=w=>{!o||r.length<2||(p=!1,i=Se(i+w,0,r.length-1),B(),T(),e.requestRender())},k=(w,L)=>{o&&(p=!1,f=!1,a=Se(a-w*Oa,-Da,Da),s=Se(s-L*Oa,-Sd,vd),B(),e.requestRender())},A=w=>{o&&(b.set(w.pointerId,{x:w.clientX,y:w.clientY}),b.size===1?(x=!0,S=0,g=w.clientX,v=w.clientY):b.size===2&&(x=!1,P=_()))},_=()=>{let w=[...b.values()];return w.length<2?0:Math.hypot(w[0].x-w[1].x,w[0].y-w[1].y)},V=w=>{if(!o||!b.has(w.pointerId))return;if(b.set(w.pointerId,{x:w.clientX,y:w.clientY}),b.size>=2){let O=_();P>0&&D((P-O)*wd),P=O;return}if(!x)return;let L=w.clientX-g,I=w.clientY-v;g=w.clientX,v=w.clientY,S+=Math.abs(L)+Math.abs(I),!(S<=Cd)&&k(L,I)},M=w=>{b.delete(w.pointerId)&&(b.size<2&&(P=0),b.size===0&&(x=!1,z()))},R=w=>{if(!o)return;w.preventDefault();let L=w.deltaMode===1?16:w.deltaMode===2?100:1,I=Se(w.deltaY*L/100,-2,2);D(I*Md),y&&clearTimeout(y),y=setTimeout(()=>{y=null,z()},Pd)},E=()=>{o&&(o=!1,p=!1,f=!1,r=[],b.clear(),x=!1,y&&(clearTimeout(y),y=null),h!==null&&(h=null,e.onStopChange?.(null)))};return t.addEventListener("pointerdown",A),t.addEventListener("pointermove",V),t.addEventListener("pointerup",M),t.addEventListener("pointercancel",M),t.addEventListener("wheel",R,{passive:!1}),{get active(){return o},enter(w){if(w.length<2){E();return}r=w,o=!0,i=0,a=0,s=0,p=!1,f=!1,h=null,B(),T(),e.requestRender()},exit:E,recentre(){return o?Math.abs(a)<1e-4&&Math.abs(s)<1e-4?!0:e.reducedMotion()?(f=!1,a=0,s=0,B(),e.requestRender(),!0):(m=[a,s],l=performance.now(),f=!0,e.requestRender(),!0):!1},update(w){if(!o)return!1;let L=!1;if(f){let I=Se((w-l)/Fa,0,1),O=1-Va(I);a=m[0]*O,s=m[1]*O,I>=1?(f=!1,a=0,s=0):L=!0}if(p){let I=Se((w-d)/Fa,0,1);i=c+(u-c)*Va(I),I>=1?(p=!1,i=u,T()):L=!0}return B(),L},currentStop:C,dispose(){E(),t.removeEventListener("pointerdown",A),t.removeEventListener("pointermove",V),t.removeEventListener("pointerup",M),t.removeEventListener("pointercancel",M),t.removeEventListener("wheel",R)}}}function Ga(e){return e.flying?"cinematic":e.panoramaMounted?"panorama":e.seatViewActive?"seatView":"orbit"}var _o=null;function Ja(){return _o??=Promise.resolve().then(()=>($a(),Za)).catch(e=>{throw _o=null,e}),_o}var es=()=>typeof performance<"u"&&performance.now?performance.now():Date.now(),kn=class{constructor(t){this.orbitLatched=!1;this.panoramaOpenedAt=0;this.cb=t}emit(t,n){if(this.cb)try{this.cb(t,n)}catch{}}opened(t,n,r,o){this.emit("3d_opened",{seats:t,hasHeights:n,...r===void 0?{}:{buildMs:Math.round(r)},...o===void 0?{}:{prepSource:o}})}orbitEngaged(){this.orbitLatched||(this.orbitLatched=!0,this.emit("3d_orbit_engaged"))}seatPicked(t,n){this.emit("3d_seat_picked",{seatId:t,sectionId:n})}cinematicPlayed(t){this.emit("3d_cinematic_played",{durationMs:t,reducedMotion:!1})}cinematicSkipped(){this.emit("3d_cinematic_skipped",{reducedMotion:!0})}cinematicCancelled(){this.emit("3d_cinematic_cancelled")}panoramaOpened(){this.panoramaOpenedAt=es(),this.emit("3d_panorama_opened")}panoramaClosed(){let t=this.panoramaOpenedAt?Math.round(es()-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 ts(e){let t=e.style.position;return getComputedStyle(e).position!=="static"?()=>{}:(e.style.position="relative",()=>{e.style.position==="relative"&&(e.style.position=t)})}function ns(e){let{container:t,model:n,opts:r,expandedSeatById:o,seatIdsByRow:i,isNarrow:a}=e,s=null,c=()=>{if(!s)return;let p=a();Object.assign(s.style,p?{left:"12px",right:"12px",bottom:"70px",transform:"none",justifyContent:"center"}:{left:"50%",right:"auto",bottom:"18px",transform:"translateX(-50%)",justifyContent:"initial"})},u=()=>{s?.remove(),s=null};return{show:(p,m,l=!1)=>{if(u(),e.isDisposed())return null;let f=document.createElement("div");f.setAttribute("role","group"),Object.assign(f.style,{position:"absolute",display:"flex",flexDirection:"column",alignItems:"center",gap:"6px",zIndex:"4"});let h=r.chrome?.caption!==!1,y=r.chrome?.seatStepper!==!1;if(!h&&!y)return null;let b=o.get(p),x=b?.sectionId?n.sections.find(z=>z.id===b.sectionId):void 0,g=b?.label??p;f.setAttribute("aria-label",`Explore views near ${x?.label?`${x.label}, `:""}seat ${g}`);let v=document.createElement("span");v.textContent=r.seatViewCaption?.(p)??["Live 3D seat view",x?.label,g].filter(Boolean).join(" \xB7 "),Object.assign(v.style,{maxWidth:"min(70vw, 560px)",padding:"5px 10px",borderRadius:"999px",overflow:"hidden",color:"#d9e3f5",background:"rgba(12,18,32,0.72)",font:"600 11px/1.2 inherit",textOverflow:"ellipsis",whiteSpace:"nowrap",backdropFilter:"blur(6px)"}),h&&f.appendChild(v);let P=document.createElement("div");Object.assign(P.style,{display:"flex",alignItems:"center",justifyContent:"center",gap:"6px"}),f.appendChild(P);let S=b?.rowId?i.get(b.rowId):void 0,C=S?.indexOf(p)??-1,T=C>=0?[S?.[C-1],S?.[C+1]]:[void 0,void 0],B=(z,D,k,A=!1)=>{let _=document.createElement("button");_.type="button",_.textContent=z,_.setAttribute("aria-label",D),Object.assign(_.style,{minHeight:"44px",padding:A?"10px 16px":"10px",borderRadius:"999px",background:"rgba(12,18,32,0.78)",color:"#eef1f8",border:"1px solid rgba(150,165,205,0.4)",backdropFilter:"blur(6px)",font:"600 13px/1 inherit",cursor:"pointer",whiteSpace:"nowrap"}),A||(_.style.minWidth="44px"),A&&(_.dataset.panoramaTrigger=""),_.addEventListener("click",k),P.appendChild(_)};if(y&&T[0]){let z=o.get(T[0])?.label??T[0];B("\u2039",`View previous seat ${z}`,()=>{e.flyToSeat(T[0])})}if(y&&r.getSeatView){let z=r.seatViewActionLabel?.(p)??"Open 360\xB0 panorama";B(l?`\u21BB Retry ${z}`:`\u25C9 ${z}`,`${l?"Retry":z} from seat ${g}`,()=>{if(e.isDisposed()||m!==e.flightGen()){u();return}u(),e.openPanorama(p,400,m)},!0)}if(y&&T[1]){let z=o.get(T[1])?.label??T[1];B("\u203A",`View next seat ${z}`,()=>{e.flyToSeat(T[1])})}return!P.childElementCount&&!h?null:(t.appendChild(f),s=f,c(),f)},remove:u,layout:c}}function os(e){let{container:t,orbit:n,isNarrow:r}=e,o=document.createElement("div"),i=!1;o.className="sl-3d-navigation-controls",Object.assign(o.style,{position:"absolute",right:"14px",bottom:"14px",display:"flex",zIndex:"4",flexDirection:"column",alignItems:"flex-end",gap:"7px"});let a=document.createElement("div");a.setAttribute("role","group"),a.setAttribute("aria-label","3D drag mode"),Object.assign(a.style,{display:"flex",flexDirection:"column",gap:"6px",alignItems:"flex-end"});let s=document.createElement("div");s.setAttribute("role","group"),s.setAttribute("aria-label","3D view controls"),Object.assign(s.style,{display:"flex",flexDirection:"column",gap:"6px",alignItems:"flex-end"});let c=document.createElement("button");c.type="button",c.textContent="\u21BB",c.setAttribute("aria-label","Drag to rotate the 3D venue"),c.dataset.tooltip="Rotate venue";let u=document.createElement("button");u.type="button",u.textContent="\u2725",u.setAttribute("aria-label","Drag to move the 3D venue left, right, up or down"),u.dataset.tooltip="Move venue";let d=document.createElement("button");d.type="button",d.textContent="\u2212",d.setAttribute("aria-label","Zoom out of the 3D venue"),d.dataset.tooltip="Zoom out";let p=document.createElement("button");p.type="button",p.textContent="+",p.setAttribute("aria-label","Zoom into the 3D venue"),p.dataset.tooltip="Zoom in";for(let y of[c,u,d,p])y.className="sl-3d-icon-control",Object.assign(y.style,{width:"44px",minWidth:"44px",minHeight:"44px",padding:"9px",border:"1px solid rgba(150,165,205,0.35)",borderRadius:"999px",color:"#c9d4ea",background:"rgba(12,18,32,0.82)",font:"600 17px/1 inherit",backdropFilter:"blur(6px)",cursor:"pointer",whiteSpace:"nowrap"});a.append(c,u),s.append(p,d);let m=y=>{n.setPrimaryDragMode(y);let b=y==="orbit";c.setAttribute("aria-pressed",String(b)),u.setAttribute("aria-pressed",String(!b)),c.style.background=b?"rgba(96,110,150,0.68)":"rgba(12,18,32,0.82)",u.style.background=b?"rgba(12,18,32,0.82)":"rgba(96,110,150,0.68)",o.title=b?"Drag to rotate \xB7 Shift-drag to move":"Drag to move \xB7 Shift-drag to rotate"};c.addEventListener("click",()=>m("orbit")),u.addEventListener("click",()=>m("pan")),d.addEventListener("click",()=>n.zoomBy(1.22)),p.addEventListener("click",()=>n.zoomBy(.82)),o.append(a,s),m("orbit"),t.appendChild(o);let l=e.enabled!==!1,f=()=>{let y=r();o.style.display=i||!l?"none":"flex",o.style.right=y?"12px":"14px",o.style.bottom=y?"calc(env(safe-area-inset-bottom, 0px) + 76px)":"14px",a.style.display=y?"none":"flex",p.style.display=y?"none":"",d.style.display=y?"none":""};return f(),{element:o,utilityControls:s,setNavigationMode:m,setSeatViewLocked:y=>{i=y,n.setInteractionEnabled(!y),f()},seatViewLocked:()=>i,layout:f}}function rs(e){let{glctx:t,orbit:n,model:r,seats:o,opts:i,cinematic:a,analytics:s,seatIdByIndex:c,sectionIdBySeatId:u,tapSlop:d,tapMs:p,cancelFlight:m,focusSectionCamera:l,setSelection:f,ensureSeatView:h}=e,y=0,b=0,x=0,g=-1,v=!1,P=!1,S=D=>{e.seatViewLocked()||g===-1&&(g=D.pointerId,y=D.clientX,b=D.clientY,x=performance.now(),v=!1,P=a.active,a.active&&(s.cinematicCancelled(),m(),i.onViewTargetChange?.(null)))},C=D=>{D.pointerId===g&&Math.hypot(D.clientX-y,D.clientY-b)>d&&(v=!0)},T=(D,k,A,_,V)=>{let M=t.canvas.getBoundingClientRect(),R=t.canvas.clientWidth||M.width||1,E=t.canvas.clientHeight||M.height||1,w=D-M.left,L=k-M.top,I=_*_,O=-1,j=I,U=1/0;for(let N of o){if(A&&N.sectionId!==A)continue;let F=r.seats.idToIndex.get(N.id);if(F===void 0)continue;if(V){let $=Math.round(r.seats.iState[F]??0);if($!==0&&$!==3)continue}let K=F*3,X=Ye(n.camera.projectionViewMatrix,[r.seats.iPosition[K],r.seats.iPosition[K+1]+.55,r.seats.iPosition[K+2]],R,E);if(!X.visible)continue;let Q=X.x-w,W=X.y-L,Z=Q*Q+W*W;(Z<j||Math.abs(Z-j)<1&&X.depth<U)&&(O=F,j=Z,U=X.depth)}return O},B=(D,k)=>{let A=e.gpu(),_=e.pick();if(!A||!_)return-1;_.syncFromSeatProgram(A.seatProgram);let V=t.canvas.getBoundingClientRect(),M=t.renderer.dpr,{x:R,y:E}=ua(D,k,V,M,t.gl.drawingBufferWidth,t.gl.drawingBufferHeight),w=Math.max(2,Math.round(8*M));return _.pick(n.camera,R,E,w)};return{onDown:S,onMove:C,onUp:D=>{if(D.pointerId!==g)return;let k=!v&&performance.now()-x<p;if(g=-1,P){P=!1;return}let A=e.gpu(),_=e.pick();if(!k||!A||!_)return;let V=B(D.clientX,D.clientY);if(e.focusedSectionId()&&V>=0){let E=c[V],w=E?u.get(E):void 0;if(w&&w!==e.focusedSectionId()&&l(w))return}if(e.focusedSectionId()&&V<0&&(V=T(D.clientX,D.clientY,e.focusedSectionId(),44,!1)),e.focusedSectionId()&&V<0){let E=T(D.clientX,D.clientY,null,72,!1),w=E>=0?c[E]:void 0,L=w?u.get(w):void 0;if(L&&L!==e.focusedSectionId()&&l(L))return}if(!e.focusedSectionId()){V<0&&(V=T(D.clientX,D.clientY,null,42,!1));let E=V>=0?c[V]:void 0,w=E?u.get(E):void 0;if(w&&l(w))return}if(V<0||V>=c.length){e.selection().size&&(f([]),i.onViewTargetChange?.(null));return}let M=c[V],R=fe[Math.round(r.seats.iState[V]??0)]??"available";if(R!=="available"&&R!=="selected"){i.onSeatInspect?.(M,R);return}if(e.selection().has(M)&&e.selection().size===1){f([]),i.onViewTargetChange?.(null),i.onSeatPick?.(M);return}f([M]),h(M),s.seatPicked(M,u.get(M)),i.onSeatPick?.(M)}}}var Ln=class{constructor(t,n){this.minX=0;this.minZ=0;this.cell=1;this.cols=1;this.rows=1;this.cellStart=null;this.cellItems=null;this.iPosition=t,this.count=n}ensureGrid(){if(this.cellStart||this.count===0)return;let t=this.iPosition,n=1/0,r=1/0,o=-1/0,i=-1/0;for(let l=0;l<this.count;l++){let f=t[l*3],h=t[l*3+2];f<n&&(n=f),f>o&&(o=f),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 f=Math.min(this.cols-1,Math.max(0,Math.floor((t[l*3]-n)/this.cell)));return Math.min(this.rows-1,Math.max(0,Math.floor((t[l*3+2]-r)/this.cell)))*this.cols+f};for(let l=0;l<this.count;l++)u[d(l)+1]++;for(let l=0;l<c;l++)u[l+1]+=u[l];let p=new Int32Array(this.count),m=u.slice(0,c);for(let l=0;l<this.count;l++)p[m[d(l)]++]=l;this.cellStart=u,this.cellItems=p}gather(t,n,r,o){this.ensureGrid();let i=this.cellStart,a=this.cellItems;if(!i||!a)return 0;let s=o.length,c=r*r,u=Math.floor((t-this.minX)/this.cell),d=Math.floor((n-this.minZ)/this.cell),p=Math.ceil(r/this.cell)+1,m=this.iPosition,l=0;for(let f=0;f<=p&&l<s;f++){let h=d-f,y=d+f,b=u-f,x=u+f;for(let g=h;g<=y&&l<s;g++){if(g<0||g>=this.rows)continue;let v=g===h||g===y;for(let P=b;P<=x&&l<s;P++){if(!v&&P!==b&&P!==x){P=x-1;continue}if(P<0||P>=this.cols)continue;let S=g*this.cols+P;for(let C=i[S],T=i[S+1];C<T&&l<s;C++){let B=a[C],z=m[B*3]-t,D=m[B*3+2]-n;z*z+D*D<=c&&(o[l++]=B)}}}}return l}};var Fn=class{constructor(t){this.ctx=t;this.detailVisible=!1;this.seatDetailMix=0;this.structureDetailMix=0;this.nearBuf=new Int32Array($t);this.lastGatherX=1/0;this.lastGatherZ=1/0;this.nearIndex=new Ln(t.model.seats.iPosition,t.model.seats.count)}forceRegather(){this.lastGatherX=1/0}setDetailEnabled(t){let n=this.ctx.gpu();t||(this.detailVisible=!1),this.lastGatherX=1/0,this.lastGatherZ=1/0,!t&&n?.nearSeatCount()&&n.setNearSeats(this.nearBuf,0)}update(t){let{model:n}=this.ctx,r=this.ctx.gpu();if(!r)return;if(!t){r.nearSeatCount()&&r.setNearSeats(this.nearBuf,0);return}let o=this.ctx.orbit().camera.position;if(Math.hypot(o.x-this.lastGatherX,o.z-this.lastGatherZ)<jn)return;if(this.lastGatherX=o.x,this.lastGatherZ=o.z,Math.hypot(o.x-n.bounds.center[0],o.z-n.bounds.center[2])-n.bounds.radius>Un){r.nearSeatCount()&&r.setNearSeats(this.nearBuf,0);return}let s=this.nearIndex.gather(o.x,o.z,Un,this.nearBuf);s===0&&r.nearSeatCount()===0||r.setNearSeats(this.nearBuf,s)}ease(t,n,r){let o=1-Math.exp(-t*9),i=1-Math.exp(-t*20);this.seatDetailMix+=(n-this.seatDetailMix)*(n>this.seatDetailMix?o:i),this.structureDetailMix+=(r-this.structureDetailMix)*(r>this.structureDetailMix?o:i),Math.abs(n-this.seatDetailMix)<.01&&(this.seatDetailMix=n),Math.abs(r-this.structureDetailMix)<.01&&(this.structureDetailMix=r)}};var Dn=require("ogl");function is(){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 as(e){let{container:t,model:n,opts:r,orbit:o,cinematic:i,analytics:a,loop:s,labelOverlay:c,stageAzimuth:u,overviewFraming:d}=e,p=0,m=-1,l=(P,S,C=28)=>{o.camera.position.set(P[0],P[1],P[2]),o.camera.lookAt(new Dn.Vec3(S[0],S[1],S[2])),o.camera.fov=C,o.camera.updateProjectionMatrix()},f=document.createElement("button");f.className="sl-3d-overview-control sl-3d-icon-control",f.type="button",f.replaceChildren(is()),f.setAttribute("aria-label","Fit the active level or whole venue in view"),f.dataset.tooltip="Fit view",Object.assign(f.style,{width:"44px",minWidth:"44px",minHeight:"44px",padding:"9px",borderRadius:"999px",background:"rgba(12,18,32,0.72)",color:"#c9d4ea",border:"1px solid rgba(150,165,205,0.35)",backdropFilter:"blur(6px)",font:"600 11px/1 inherit",cursor:"pointer",whiteSpace:"nowrap"});let h=()=>{f.firstElementChild||f.replaceChildren(is())};h();let y=P=>{m=P;let S=e.gpu();S&&(S.seatProgram.uniforms.uFocusFloor.value=P,S.solidProgram.uniforms.uFocusFloor.value=P,S.chairProgram.uniforms.uFocusFloor.value=P),e.showSectionSeatLabels(null)},b=()=>{if(e.isDisposed())return;r.onViewTargetChange?.(null),r.onSectionFocusChange?.(null),e.panorama()&&(e.panorama().dispose(),e.setPanorama(null),a.panoramaClosed()),e.setPanoramaSphereVisible(!1),e.panoramaLoadAbort()?.abort(),e.setPanoramaLoadAbort(null),e.restorePanoramaLayer(),f.style.display="",c.setVisible(!0),e.setFrozen(!1);let P=m>=0?n.floors[m]:null;if(e.setNearFieldDetailEnabled(!!P),e.setSeatViewLocked(!1),x(),e.removeArriveChip(),e.setNavigationMode("orbit"),P){let S=P.focalWorld[0]-P.center[0],C=P.focalWorld[2]-P.center[2],T=Math.hypot(S,C)>P.radius*.12?Math.atan2(S,C):u,B={center:P.center,radius:P.radius,box:P.box},z={polarDeg:58,margin:1.12};e.reducedMotion()?o.frame(B,!1,T,!1,z):o.frameSoft(B,T,!1,z)}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()},x=()=>{p++,e.setSeatStepping(!1),e.panoramaLoadAbort()?.abort(),e.setPanoramaLoadAbort(null),i.active&&(i.cancel(),o.resumeAfterFlight(n.focalWorld))},g=P=>{if(e.isDisposed()||!e.gpu())return Promise.resolve();let S=n.seats.idToIndex.get(P);if(S===void 0)return Promise.resolve();e.setNearFieldDetailEnabled(!0),r.onViewTargetChange?.(P),e.panorama()&&(e.panorama().dispose(),e.setPanorama(null),e.setPanoramaSphereVisible(!1),f.style.display="",e.restorePanoramaLayer()),e.panoramaLoadAbort()?.abort(),e.setPanoramaLoadAbort(null),e.setFrozen(!1);let C=e.inSeatView()&&r.arriveAtSeatEye===!0;e.setSeatStepping(C),e.setSeatViewLocked(!1);let T=++p;C?e.showArriveChip(P,T):e.removeArriveChip();let{eye:B,focal:z}=e.resolvedSeatViewPose(P,S),D=r.arriveAtSeatEye?e.seatViewArrival(P,S):null,k=D?D.focal:z,A=[o.camera.position.x,o.camera.position.y,o.camera.position.z],_=Co(A,D?.eye??B,k,n.bounds.center,n.bounds.radius),V=D?D.eye:r.arriveAtSeatEye?B:_.finalPos,M=D?D.fov:r.arriveAtSeatEye?t.clientWidth/Math.max(1,t.clientHeight)<.7?wn:65:28,R=[_.waypoints[0],_.waypoints[1],V];if(c.setVisible(!1),e.reducedMotion())return e.setSeatStepping(!1),l(V,k,M),s.requestRender(),a.cinematicSkipped(),e.isDisposed()||o.syncFromCamera(),e.setSeatViewLocked(r.arriveAtSeatEye===!0),D&&e.enterSeatView(D.stops),e.showArriveChip(P,T),Promise.resolve();let E=new Dn.Quat().copy(o.camera.quaternion),w=xa(o.camera,V,k);s.requestRender();let L=C?700:2500;return i.start(R,E,w,L,M).then(()=>{e.isDisposed()||T!==p||(e.setSeatStepping(!1),a.cinematicPlayed(L),o.resumeAfterFlight(k),e.setSeatViewLocked(r.arriveAtSeatEye===!0),D&&e.enterSeatView(D.stops),s.requestRender(),e.showArriveChip(P,T))})},v=P=>{let S=n.sections.find(z=>z.id===P);if(!S||S.seatCount===0)return!1;e.setNearFieldDetailEnabled(!0),e.setSeatStepping(!1),e.setSeatViewLocked(!1),i.cancel(),e.removeArriveChip(),n.floors.length>1&&m!==S.floorIndex&&y(S.floorIndex),e.setNavigationMode("pan"),e.showSectionSeatLabels(P);let C=S.focalWorld[0]-S.center[0],T=S.focalWorld[2]-S.center[2],B=Math.hypot(C,T)>S.radius*.12?Math.atan2(C,T):void 0;return o.frame({center:S.center,radius:Math.max(5,S.radius*.5)},!1,B),r.onSectionFocusChange?.(P),s.requestRender(),!0};return f.addEventListener("click",b),{overviewChip:f,layoutOverviewChip:h,flightGen:()=>p,focusedFloor:()=>m,applyFloorFocus:y,placeCameraFinal:l,cancelFlight:x,focusOverview:b,flyToSeat:g,focusSectionCamera:v}}var zd={};function ss(e){let t=performance.now();return{model:gt(e),buildMs:performance.now()-t,source:"main"}}function Gd(e){let t=Hr(e.doc);return{...ss({...e,seats:t}),seats:t}}function cs(e,t,n){if(typeof Worker>"u")return Promise.resolve(t());let r;try{r=new Worker(new URL("./scene/scene.worker.js",zd.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 ls(e){return cs(e,()=>ss(e),({model:t,buildMs:n})=>({model:t,buildMs:n,source:"worker"}))}function us(e){return cs(e,()=>Gd(e),({model:t,buildMs:n,seats:r})=>r?{model:t,buildMs:n,seats:r,source:"worker"}:null)}var Hd=Math.PI/180,Ud=6,jd=500;function Yd(e,t,n={}){let r=performance.now(),o=t.prepared?.model??gt(t),i=new kn(n.onAnalytics),a=new Array(o.seats.count);for(let[H,Y]of o.seats.idToIndex)a[Y]=H;let s=new Map(t.seats.map(H=>[H.id,H])),c=new Map;for(let H of t.seats){if(!H.rowId)continue;let Y=c.get(H.rowId);Y?Y.push(H.id):c.set(H.rowId,[H.id])}let u=new Map;for(let H of t.seats)u.set(H.id,H.sectionId);let d=new Map;for(let[H,Y]of o.seats.idToIndex){let q=u.get(H);if(!q)continue;let ee=d.get(q);ee?ee.push(Y):d.set(q,[Y])}let p=()=>{if(!l||!o.sectionSolidRanges.length)return;let{lit:H,anyUnlit:Y}=ia(o.sectionSolidRanges,d,o.seats.iState);l.setSectionShellLit(Y?H:null)},m=t.doc.floors?.some(Y=>(Y.baseHeightM??0)>0)?!0:(t.doc.floors?.flatMap(Y=>Y.objects)??t.doc.objects).some(Y=>Y.type==="section"&&((Y.height??0)>0||(Y.rake??0)>0)),l=null,f=null,h=!1,y=!1,b=!1,x=new Map,g=null,v=null,P=null,S=new Map,C=null,T=()=>{P===null&&(P=e.style.zIndex,e.style.zIndex="20")},B=()=>{P!==null&&(e.style.zIndex==="20"&&(e.style.zIndex=P),P=null)},z=!1,D=()=>z?be.focusedFloor():-1,k=()=>{l=ca(M.gl,o),p(),f=new Sn(M.renderer,l.seatGeometry,l.chairGeometry,l.solidGeometry,o.seats.count),M.setClearColor(o.theme.background.top),f.setRestoreClear(o.theme.background.top),l.seatProgram.uniforms.uSeatRadius.value=De*o.theme.seatScale,l.seatProgram.uniforms.uFocusFloor.value=D(),l.solidProgram.uniforms.uFocusFloor.value=D(),l.chairProgram.uniforms.uFocusFloor.value=D(),l.screenProgram&&(l.screenProgram.uniforms.uFocusFloor.value=D()),_.forceRegather()},A=!1,_=new Fn({model:o,orbit:()=>R,gpu:()=>l}),V=H=>_.setDetailEnabled(H),M=new qt(e,{onContextLost:()=>{b||i.contextLost(),h=!0,W.stop(),l=null,f=null},onContextRestored:()=>{k(),h=!1,b||i.contextRestored(),W.requestRender()}}),R=new Qt(M.gl,M.canvas,()=>W.requestRender(),()=>i.orbitEngaged());R.setAspect(M.aspect);let E=(t.doc.floors?.flatMap(H=>H.objects)??t.doc.objects).some(H=>H.type==="section"&&H.physical3dProvenance?.surfaceKind?.status==="inferred"),w=(()=>{if(E&&o.stages.length===0)return;let H=o.focalWorld[0]-o.bounds.center[0],Y=o.focalWorld[2]-o.bounds.center[2];return Math.hypot(H,Y)>o.bounds.radius*.12?Math.atan2(H,Y):void 0})(),L=o.floors.length>1?{polarDeg:48,margin:1.1}:{margin:1.1},I=typeof window<"u"&&!!window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches;R.frame(o.bounds,!I&&n.skipInitialOverviewAnimation!==!0,w,n.portraitOverviewCrop===!0,L);let O=new Mn(R.camera),j=ts(e),U=new gn(e,{fontFamily:t.doc.theme?.fontFamily,ink:t.doc.theme?.textColor,backgroundRgb:o.theme.background.top}),N=o.labels,F=()=>Ai(N,o.floors.length,D());U.setLabels(F());let K=null,X=H=>{if(K=H,U.setForcedDense(!!H),!H){U.setLabels(F());return}let Y=t.seats.filter(J=>J.sectionId===H),q=new Set(Y.map(J=>J.id)),ee=new Set(Y.map(J=>J.rowId)),re=new Set(x.keys()),ie=new Set(Y.filter(J=>re.has(J.id)).map(J=>J.id)),se=F().filter(J=>J.kind!=="row"&&J.kind!=="seat"||(J.kind==="row"?ee.has(J.id.slice(4)):q.has(J.id.slice(5))&&(ie.size===0||ie.has(J.id.slice(5)))));if(o.seatCount<=6e3&&ie.size===0){U.setLabels(se);return}let de=ie.size?Y.filter(J=>ie.has(J.id)):Y,Ze=new Set(de.map(J=>`seat:${J.id}`)),He=de.flatMap(J=>{let ye=o.seats.idToIndex.get(J.id);if(ye===void 0)return[];let Re=ye*3;return[{id:`seat:${J.id}`,kind:"seat",text:J.displayLabel||J.label,anchor:[o.seats.iPosition[Re],o.seats.iPosition[Re+1]+(re.has(J.id)?1.05:.55),o.seats.iPosition[Re+2]]}]});U.setLabels([...se.filter(J=>!Ze.has(J.id)),...He])};k();let Q=null,W=new Zt(H=>{if(h||!l||y)return!1;let Y=Ga({flying:O.active,panoramaMounted:g!==null,seatViewActive:Q?.active===!0}),q=Y==="cinematic"?O.update(performance.now()):Y==="seatView"?Q.update(performance.now()):Y==="orbit"?R.update():!1,ee=D()>=0?o.floors[D()]:null,re=ee?.radius??o.bounds.radius,ie=qo(R.currentDistance,re),se=A?{center:[R.camera.position.x,R.camera.position.y,R.camera.position.z],radius:520}:o.renderBounds;R.updateClipping(se);let de=ee?.center??o.renderBounds.center,Ze=ee?.radius??o.renderBounds.radius,He=(Ie,Pt)=>Math.hypot(R.camera.position.x-Ie[0],R.camera.position.y-Ie[1],R.camera.position.z-Ie[2])<=Pt*(_.detailVisible?1.8:1.55),J=He(de,Ze);if(!J&&K){let Ie=o.sections.find(Pt=>Pt.id===K);Ie&&(J=He(Ie.center,Math.max(12,Ie.radius*2)))}_.detailVisible=J;let ye=l.seatProgram.uniforms;ye.uSeatScale.value=ie.scale,ye.uSeatFade.value=ie.fade;let Re=!!ee&&Qo(ee.seatCount,M.canvas.clientWidth||1,M.canvas.clientHeight||1),Yt=Zo(o.seats.count,re,R.currentDistance,R.camera.fov,M.canvas.clientHeight||1),wt=_.detailVisible||Re||Yt?1:0,Xt=_.detailVisible||D()>=0||o.floors.length>1?1:0;return _.ease(H,wt,Xt),ye.uSeatDetail.value=_.seatDetailMix,l.solidProgram.uniforms.uStructureDetail.value=_.structureDetailMix,ye.uMinPixels.value=ie.minPixels,ye.uPixelToWorld.value=2*Math.tan(R.camera.fov*Hd/2)/Math.max(1,M.pixelHeight),_.update(_.detailVisible),M.renderer.render({scene:l.background,clear:!0}),M.renderer.render({scene:l.main,camera:R.camera,clear:!1}),U.update(R.camera.projectionViewMatrix,M.canvas.clientWidth||1,M.canvas.clientHeight||1,R.currentDistance,re,[R.camera.position.x,R.camera.position.y,R.camera.position.z]),q||_.seatDetailMix!==wt||_.structureDetailMix!==Xt}),Z=typeof ResizeObserver<"u"?new ResizeObserver(()=>Vn.resize()):null;Z?.observe(e);let $=H=>{let Y=re=>{let ie=o.seats.idToIndex.get(re);return ie===void 0?void 0:o.seats.iState[ie]},{updates:q,next:ee}=ma(x,H,Y);if(x=ee,U.setSelectedSeatIds(x.keys()),K&&X(K),q.length){let re=$n(o.seats,q);l&&l.uploadSeatStateRuns(re),p(),W.requestRender()}},te=()=>C!==null?C:typeof window<"u"&&!!window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,Le=8,Pe=H=>{if(!n.getSeatView)return null;let Y=S.get(H);if(!Y)for(Y=Promise.resolve(n.getSeatView(H)),S.set(H,Y),Y.catch(()=>{S.get(H)===Y&&S.delete(H)});S.size>Le;){let q=S.keys().next().value;if(q===void 0)break;S.delete(q)}return Y},Be=Ta(o.stages,o.focalWorld,o.bounds.groundY??0),Ne=Ro(Be),Ae=(H,Y)=>{let q=s.get(H),ee=Math.max(0,Math.round(o.seats.iFloor[Y]??0)),re=t.doc.floors?.[ee],ie=o.floors[ee],se=re?.focalPoint??t.doc.focalPoint,de=ie?{x:ie.focalWorld[0]/G,y:ie.focalWorld[2]/G}:se,Ze=q?.focalPoint?{x:q.focalPoint.x+de.x-se.x,y:q.focalPoint.y+de.y-se.y}:de,He=[o.seats.iPosition[Y*3],o.seats.iPosition[Y*3+1],o.seats.iPosition[Y*3+2]];return Sa(He,Ze,re?.baseHeightM??0,q?.eyeHeightM,Ne)},Ce=()=>(e.clientWidth||M.canvas.clientWidth)<=520,me=null,qe=null,vt=async(H,Y,q)=>{if(!n.getSeatView||b||q!==be.flightGen())return;let ee;try{ee=await Ja()}catch{if(i.panoramaFailed(H,"mount"),!b&&q===be.flightGen()){let re=Fe(H,q,!0);requestAnimationFrame(()=>re?.querySelector("[data-panorama-trigger]")?.focus())}return}if(!(b||q!==be.flightGen()||!me))return qe??=ee.createOpenPanorama(me),qe(H,Y,q)},Ge=ns({container:e,model:o,opts:n,expandedSeatById:s,seatIdsByRow:c,isNarrow:Ce,isDisposed:()=>b,flightGen:()=>be.flightGen(),flyToSeat:H=>Fo(H),openPanorama:(H,Y,q)=>vt(H,Y,q)}),Fe=Ge.show,Qe=Ge.remove,Ut=Ge.layout,ct=os({container:e,orbit:R,isNarrow:Ce,enabled:n.chrome?.controlDock!==!1}),ds=ct.element,St=ct.setNavigationMode,ms=ct.layout,fs=ct.utilityControls,Mt=null,ko=!1,jt=H=>{ct.setSeatViewLocked(H),H||Q?.exit()};Q=Na({canvas:M.canvas,camera:R.camera,requestRender:()=>W.requestRender(),reducedMotion:te,onStopChange:H=>{let Y=H??(ko?"seat":null);Mt=Y;try{n.onSeatViewStopChange?.(Y)}catch{}},onApplied:()=>{b||R.syncFromCamera()}});let ps=(H,Y)=>{let{eye:q}=Ae(H,Y),ee=(e.clientWidth||M.canvas.clientWidth||1)/Math.max(1,e.clientHeight||M.canvas.clientHeight||1),re=ka(q,Be,ee);if(n.seatViewStops===!1)return{...re,stops:[]};let ie=u.get(H),se=ie?o.sections.find(de=>de.id===ie):void 0;return{...re,stops:La(re,{aspect:ee,section:se&&se.seatCount>0?{center:se.center,radius:se.radius}:null,venue:{center:o.bounds.center,radius:o.bounds.radius}})}},be=as({container:e,model:o,opts:n,orbit:R,cinematic:O,analytics:i,loop:W,labelOverlay:U,stageAzimuth:w,overviewFraming:L,gpu:()=>l,isDisposed:()=>b,panorama:()=>g,setPanorama:H=>{g=H},setPanoramaSphereVisible:H=>{A=H},panoramaLoadAbort:()=>v,setPanoramaLoadAbort:H=>{v=H},setFrozen:H=>{y=H},restorePanoramaLayer:B,reducedMotion:te,resolvedSeatViewPose:Ae,showSectionSeatLabels:X,setNearFieldDetailEnabled:V,setSeatViewLocked:jt,setNavigationMode:St,showArriveChip:Fe,removeArriveChip:Qe,inSeatView:()=>Mt!==null,setSeatStepping:H=>{ko=H},seatViewArrival:(H,Y)=>n.arriveAtSeatEye?ps(H,Y):null,enterSeatView:H=>Q?.enter(H)});z=!0;let On=be.overviewChip,hs=be.layoutOverviewChip,bs=be.applyFloorFocus,ys=be.focusOverview,Lo=be.cancelFlight,Fo=be.flyToSeat,Do=be.focusSectionCamera;fs.appendChild(On),me={container:e,model:o,opts:n,analytics:i,orbit:R,loop:W,seatsById:s,ensureSeatView:Pe,resolvedSeatViewPose:Ae,gpu:()=>l,gl:M.gl,isContextLost:()=>h,isDisposed:()=>b,flightGen:()=>be.flightGen(),setPanorama:H=>{g=H},getLoadAbort:()=>v,setLoadAbort:H=>{v=H},setPanoramaSphereVisible:H=>{A=H,H&&Q?.exit()},setFrozen:H=>{y=H},raisePanoramaLayer:T,restorePanoramaLayer:B,getOverviewChip:()=>On,labelOverlay:U,reducedMotion:te,removeArriveChip:Qe,showArriveChip:Fe};let ze=rs({glctx:M,orbit:R,model:o,seats:t.seats,opts:n,cinematic:O,analytics:i,seatIdByIndex:a,sectionIdBySeatId:u,tapSlop:Ud,tapMs:jd,gpu:()=>l,pick:()=>f,seatViewLocked:()=>ct.seatViewLocked(),focusedSectionId:()=>K,selection:()=>x,cancelFlight:Lo,focusSectionCamera:Do,setSelection:$,ensureSeatView:Pe});M.canvas.addEventListener("pointerdown",ze.onDown),M.canvas.addEventListener("pointermove",ze.onMove),M.canvas.addEventListener("pointerup",ze.onUp),M.canvas.addEventListener("pointercancel",ze.onUp),W.requestRender();let Vn={setAvailability(H){let Y=da(x,H),q=$n(o.seats,Y);q.length&&l&&l.uploadSeatStateRuns(q),p(),W.requestRender()},setSelection:$,setNavigationMode:St,zoomIn(){R.zoomBy(.82),W.requestRender()},zoomOut(){R.zoomBy(1.22),W.requestRender()},flyToSeat:Fo,focusOverview:ys,seatViewStop:()=>Mt,recentreSeatView:()=>Q?.recentre()??!1,resize(){let{width:H,height:Y}=M.resize();R.setAspect(H/Math.max(1,Y)),Ut(),ms(),hs(),W.requestRender()},stats(){return{...W.stats(),drawCalls:l?l.drawCalls:0,seatCount:o.seatCount}},getQualityEvidence(){let H=W.stats(),Y=M.canvas.clientWidth||1,q=M.canvas.clientHeight||1,ee=o.bounds.center,re=Ye(R.camera.projectionViewMatrix,[ee[0],o.bounds.box.min[1],ee[2]],Y,q),ie=Ye(R.camera.projectionViewMatrix,[ee[0],o.bounds.box.max[1],ee[2]],Y,q),se=o.bounds.box,de=[se.min[0],se.max[0]].flatMap(J=>[se.min[1],se.max[1]].flatMap(ye=>[se.min[2],se.max[2]].map(Re=>Ye(R.camera.projectionViewMatrix,[J,ye,Re],Y,q)))).filter(J=>Number.isFinite(J.x)&&Number.isFinite(J.y)&&Number.isFinite(J.depth)),Ze=de.length?(()=>{let J=Math.min(...de.map($e=>$e.x)),ye=Math.max(...de.map($e=>$e.x)),Re=Math.min(...de.map($e=>$e.y)),Yt=Math.max(...de.map($e=>$e.y)),wt=Math.max(0,J),Xt=Math.min(Y,ye),Ie=Math.max(0,Re),Pt=Math.min(q,Yt),Wt=Math.max(0,Xt-wt),Bn=Math.max(0,Pt-Ie);return{box:{x:wt,y:Ie,width:Wt,height:Bn},horizontalFillRatio:Wt/Y,verticalFillRatio:Bn/q,visibleAreaRatio:Wt*Bn/(Y*q),clippedEdges:[...Re<0?["top"]:[],...ye>Y?["right"]:[],...Yt>q?["bottom"]:[],...J<0?["left"]:[]]}})():void 0,He=String(M.gl.getParameter(M.gl.VERSION)??"");return{viewport:{width:Y,height:q},context:{webgl2:/webgl\s*2/i.test(He),lost:h},frame:{rendered:H.rendered,idle:H.idle},camera:{position:[R.camera.position.x,R.camera.position.y,R.camera.position.z],distance:R.currentDistance,verticalFovDeg:R.fovY},scene:{seatCount:o.seatCount,floorCount:o.floors.length,zoneCount:o.zones.length,sectionCount:o.sections.length,authoredRelief:m,renderedVerticalSpanM:Math.max(0,o.bounds.box.max[1]-o.bounds.box.min[1]),projectedReliefPx:re.visible&&ie.visible?Math.abs(re.y-ie.y):0},labels:U.qualityEvidence(),framing:Ze,...Mt?{seatView:{fovDeg:R.camera.fov,stop:Mt}}:{}}},getQualityReport(){return xn(Vn.getQualityEvidence())},loseContextForTest(){M.simulateContextLossCycle()},floors(){return o.floors},focusFloor(H){if(H!==null&&!o.floors.some(q=>q.index===H))return!1;let Y=H??-1;if(V(H!==null),jt(!1),bs(Y),St("orbit"),H===null)O.cancel(),te()?R.frame(o.bounds,!1,w,n.portraitOverviewCrop===!0,L):R.frameSoft(o.bounds,w,n.portraitOverviewCrop===!0,L);else{let q=o.floors[H];if(q.seatCount>0){O.cancel();let ee=q.focalWorld[0]-q.center[0],re=q.focalWorld[2]-q.center[2],ie=Math.hypot(ee,re)>q.radius*.12?Math.atan2(ee,re):w;R.frame({center:q.center,radius:q.radius,box:q.box},!1,ie,!1,{polarDeg:58,margin:1.12})}}return W.requestRender(),!0},zones(){return o.zones},focusZone(H){let Y=o.zones.find(ie=>ie.id===H);if(!Y||Y.seatCount===0)return!1;V(!1),jt(!1),O.cancel(),St("orbit"),X(null),n.onSectionFocusChange?.(null);let q=Y.focalWorld[0]-Y.center[0],ee=Y.focalWorld[2]-Y.center[2],re=Math.hypot(q,ee)>Y.radius*.12?Math.atan2(q,ee):void 0;return R.frame({center:Y.center,radius:Y.radius*1.25},!1,re),W.requestRender(),!0},sections(){return o.sections},focusSection(H){return Do(H)},rows(H){return H?o.rows.filter(Y=>Y.sectionId===H):o.rows},seatsInRow(H){return t.seats.filter(Y=>Y.rowId===H).map(Y=>({id:Y.id,label:Y.displayLabel||Y.label}))},focusRow(H){let Y=o.rows.find(q=>q.id===H);return!Y||Y.seatCount===0?!1:(V(!0),jt(!1),O.cancel(),St("pan"),Y.sectionId&&(X(Y.sectionId),n.onSectionFocusChange?.(Y.sectionId)),R.frame({center:Y.center,radius:Math.max(2.5,Y.radius*.65)}),W.requestRender(),!0)},setReducedMotionForTest(H){C=H},dispose(){b=!0,Qe(),On.remove(),ds.remove(),Lo(),Q?.dispose(),W.stop(),U.dispose(),Z?.disconnect(),g&&(g.dispose(),g=null),B(),j(),M.canvas.removeEventListener("pointerdown",ze.onDown),M.canvas.removeEventListener("pointermove",ze.onMove),M.canvas.removeEventListener("pointerup",ze.onUp),M.canvas.removeEventListener("pointercancel",ze.onUp),R.dispose(),f&&f.dispose(),l&&l.dispose(),l=null,f=null,M.dispose()}};return i.opened(o.seatCount,m,t.prepared?.buildMs??performance.now()-r,t.prepared?.source??"inline"),Vn}0&&(module.exports={VENUE3D_QUALITY_REPORT_VERSION,buildSceneModel,inspectVenue3DQualityEvidence,mountVenue3D,prepareVenue3D,prepareVenue3DFromChart});