@seatlayer/core 0.110.0 → 0.111.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (162) hide show
  1. package/dist/ar-IOQUWTKM.js +1 -0
  2. package/dist/be-XLR5WTXS.js +1 -0
  3. package/dist/bg-AVCWLASZ.js +1 -0
  4. package/dist/ca-TKG35ICB.js +1 -0
  5. package/dist/{categoryInventory-BfvwE3nC.d.cts → categoryInventory-BE1AThTx.d.cts} +1 -1
  6. package/dist/{categoryInventory-ClZ-68jI.d.ts → categoryInventory-DxciZQK_.d.ts} +1 -1
  7. package/dist/{chunk-ZYQXT5JP.js → chunk-5FIX35HN.js} +1 -1
  8. package/dist/{chunk-2JFCDE27.js → chunk-5GHPGPWE.js} +1 -1
  9. package/dist/{chunk-MRLWH6RC.js → chunk-AZWAP4OE.js} +1 -1
  10. package/dist/chunk-BXQQKDIX.js +1 -0
  11. package/dist/{chunk-OJSGMXJS.js → chunk-FZ74MVKY.js} +1 -1
  12. package/dist/chunk-JQBJZMLG.js +1 -0
  13. package/dist/{chunk-UUIZHJYL.js → chunk-MN4M5QZ4.js} +1 -1
  14. package/dist/chunk-N6K5NQYG.js +1 -0
  15. package/dist/{chunk-6VOUTNRV.js → chunk-NQLQNJV2.js} +1 -1
  16. package/dist/{chunk-BNLANXXZ.js → chunk-NXS6JFBI.js} +1 -1
  17. package/dist/{chunk-WUNZCUE6.js → chunk-XWTAFHYQ.js} +1 -1
  18. package/dist/{chunk-FBXZWNND.js → chunk-Z6YGWTT3.js} +1 -1
  19. package/dist/core/chart-ops/index.cjs +1 -1
  20. package/dist/core/chart-ops/index.d.cts +7 -5
  21. package/dist/core/chart-ops/index.d.ts +7 -5
  22. package/dist/core/chart-ops/index.js +1 -1
  23. package/dist/core/inventory/index.cjs +1 -1
  24. package/dist/core/inventory/index.d.cts +4 -4
  25. package/dist/core/inventory/index.d.ts +4 -4
  26. package/dist/core/inventory/index.js +1 -1
  27. package/dist/core/layout/index.cjs +1 -1
  28. package/dist/core/layout/index.d.cts +5 -5
  29. package/dist/core/layout/index.d.ts +5 -5
  30. package/dist/core/layout/index.js +1 -1
  31. package/dist/core/quality/index.cjs +1 -1
  32. package/dist/core/quality/index.d.cts +3 -3
  33. package/dist/core/quality/index.d.ts +3 -3
  34. package/dist/core/render-assets/index.cjs +1 -1
  35. package/dist/core/render-assets/index.d.cts +2 -2
  36. package/dist/core/render-assets/index.d.ts +2 -2
  37. package/dist/core/render-assets/index.js +1 -1
  38. package/dist/core/seatConfidence.d.cts +1 -1
  39. package/dist/core/seatConfidence.d.ts +1 -1
  40. package/dist/core/sections/index.d.cts +5 -5
  41. package/dist/core/sections/index.d.ts +5 -5
  42. package/dist/core/sections/index.js +1 -1
  43. package/dist/cs-JRLKXXM5.js +1 -0
  44. package/dist/cy-W3CYXTOV.js +1 -0
  45. package/dist/da-HG4PFYWH.js +1 -0
  46. package/dist/de-KOM2AXXJ.js +1 -0
  47. package/dist/el-NBRQ66EQ.js +1 -0
  48. package/dist/es-AVEG4ZNM.js +1 -0
  49. package/dist/et-33PIOTI4.js +1 -0
  50. package/dist/{eventConfigurations-DsW5Mj2e.d.ts → eventConfigurations-Cdt-e0uD.d.ts} +1 -1
  51. package/dist/{eventConfigurations-dmn9FClw.d.cts → eventConfigurations-D0us5j0K.d.cts} +1 -1
  52. package/dist/fa-CDV2VTXV.js +1 -0
  53. package/dist/fi-TKATIOE6.js +1 -0
  54. package/dist/fr-TMDNSR5N.js +1 -0
  55. package/dist/he-4G7OVLJX.js +1 -0
  56. package/dist/hi-XKXNYPYF.js +1 -0
  57. package/dist/hr-BX444QNM.js +1 -0
  58. package/dist/hu-FM46JMDP.js +1 -0
  59. package/dist/id-CBVTYGFP.js +1 -0
  60. package/dist/index.cjs +1 -1
  61. package/dist/index.d.cts +46 -38
  62. package/dist/index.d.ts +46 -38
  63. package/dist/index.js +1 -1
  64. package/dist/it-ZOFOAG6E.js +1 -0
  65. package/dist/ja-NKEBMXTO.js +1 -0
  66. package/dist/ko-RUCELYV7.js +1 -0
  67. package/dist/ku-KKYBDVSA.js +1 -0
  68. package/dist/{labeling-Bn41ByDd.d.ts → labeling-DXgkxMoi.d.ts} +1 -1
  69. package/dist/{labeling-BmEjVxFt.d.cts → labeling-eYKVPLMb.d.cts} +1 -1
  70. package/dist/localeLoaders-YQXZZVNH.js +1 -0
  71. package/dist/lt-3CJ37W7A.js +1 -0
  72. package/dist/lv-H37RDMRX.js +1 -0
  73. package/dist/ms-E5RVBRE6.js +1 -0
  74. package/dist/nl-QHEOTQ7U.js +1 -0
  75. package/dist/no-43HJQ5MK.js +1 -0
  76. package/dist/pl-4LKJHMFJ.js +1 -0
  77. package/dist/pt-LSSE5QHE.js +1 -0
  78. package/dist/{renderedQuality-MDkNe8GA.d.ts → renderedQuality-Dzo2_8f4.d.ts} +1 -1
  79. package/dist/{renderedQuality-Bt2d0uq1.d.cts → renderedQuality-Frgw6jdx.d.cts} +1 -1
  80. package/dist/{renderer-DH0yI32q.d.cts → renderer-DM2sv1un.d.cts} +1 -1
  81. package/dist/{renderer-BJrpMV6U.d.ts → renderer-DuieD7jP.d.ts} +1 -1
  82. package/dist/ro-U2QASPIY.js +1 -0
  83. package/dist/ru-PTMWREXY.js +1 -0
  84. package/dist/{seatTypeIcons-CG_Uzpaw.d.ts → seatTypeIcons-Bz0OJtEi.d.ts} +1 -1
  85. package/dist/{seatTypeIcons-Ck7oEFei.d.cts → seatTypeIcons-Cm8tjLYl.d.cts} +1 -1
  86. package/dist/{sections-C-UAqr1x.d.ts → sections-Bf_DV0oG.d.ts} +1 -1
  87. package/dist/{sections-C8HApYxd.d.cts → sections-PbQiqN0i.d.cts} +1 -1
  88. package/dist/{segmentedRowModel-DR1w9M13.d.ts → segmentedRowModel-CO7DD803.d.ts} +1 -1
  89. package/dist/{segmentedRowModel-CeoMsBnt.d.cts → segmentedRowModel-Co9LqS4i.d.cts} +1 -1
  90. package/dist/sk-AY2N2ORA.js +1 -0
  91. package/dist/sl-5MQJVNB7.js +1 -0
  92. package/dist/sr-25FTJPUA.js +1 -0
  93. package/dist/{stage-CKb7aNoH.d.cts → stage-BtqKu5aX.d.cts} +1 -1
  94. package/dist/{stage-CKb7aNoH.d.ts → stage-BtqKu5aX.d.ts} +1 -1
  95. package/dist/sv-7VQX4BFH.js +1 -0
  96. package/dist/{tableSizing-RRmpxOXl.d.ts → tableSizing-BDePQyPD.d.ts} +3 -3
  97. package/dist/{tableSizing-Bz-hxLza.d.cts → tableSizing-C6EjKNnk.d.cts} +3 -3
  98. package/dist/th-E53HQMDC.js +1 -0
  99. package/dist/{ticketRestrictions-lq4dH4k6.d.cts → ticketRestrictions-CgYwHQOf.d.cts} +2 -2
  100. package/dist/{ticketRestrictions-C7KUrulv.d.ts → ticketRestrictions-D5wgOq4P.d.ts} +2 -2
  101. package/dist/tr-IIR6E7OD.js +1 -0
  102. package/dist/{types-DM-OneoD.d.ts → types-CGOr0BpE.d.cts} +40 -16
  103. package/dist/{types-DM-OneoD.d.cts → types-CGOr0BpE.d.ts} +40 -16
  104. package/dist/uk-HBINQ4XE.js +1 -0
  105. package/dist/vi-TX6I5RWN.js +1 -0
  106. package/dist/view3d/crossfade/panorama.d.cts +1 -1
  107. package/dist/view3d/crossfade/panorama.d.ts +1 -1
  108. package/dist/view3d/index.cjs +531 -172
  109. package/dist/view3d/index.d.cts +350 -73
  110. package/dist/view3d/index.d.ts +350 -73
  111. package/dist/view3d/index.js +529 -170
  112. package/dist/view3d/scene/scene.worker.cjs +1 -1
  113. package/dist/view3d/scene/scene.worker.js +1 -1
  114. package/dist/zh-Hans-7QNBTEYC.js +1 -0
  115. package/dist/zh-Hant-6KK3D42X.js +1 -0
  116. package/package.json +1 -1
  117. package/dist/ar-O3RHQRH3.js +0 -1
  118. package/dist/be-SXFCG3F5.js +0 -1
  119. package/dist/bg-W7YBNYB2.js +0 -1
  120. package/dist/ca-FA7WHACR.js +0 -1
  121. package/dist/chunk-4N5CHKHD.js +0 -1
  122. package/dist/chunk-4QQG5EEP.js +0 -1
  123. package/dist/chunk-YE4NP3XB.js +0 -1
  124. package/dist/cs-RR3VIKRC.js +0 -1
  125. package/dist/cy-U4JJ5C47.js +0 -1
  126. package/dist/da-ATULGB2M.js +0 -1
  127. package/dist/de-VB543CPC.js +0 -1
  128. package/dist/el-7Y2KXU6N.js +0 -1
  129. package/dist/es-GUV5XIYC.js +0 -1
  130. package/dist/et-SZ6I4Z44.js +0 -1
  131. package/dist/fa-FM6ELEN7.js +0 -1
  132. package/dist/fi-6QQ2M5JI.js +0 -1
  133. package/dist/fr-2SEQSVLR.js +0 -1
  134. package/dist/he-V3EVB7IW.js +0 -1
  135. package/dist/hi-I4QIBK5Q.js +0 -1
  136. package/dist/hr-I5DNEVUU.js +0 -1
  137. package/dist/hu-KTFWBQMF.js +0 -1
  138. package/dist/id-RZWUH426.js +0 -1
  139. package/dist/it-CNQP36V4.js +0 -1
  140. package/dist/ja-JQZOYIHI.js +0 -1
  141. package/dist/ko-6YCWWHFQ.js +0 -1
  142. package/dist/ku-33PM4OWG.js +0 -1
  143. package/dist/localeLoaders-VFQOZMUH.js +0 -1
  144. package/dist/lt-24JO2B7V.js +0 -1
  145. package/dist/lv-HTSDEEAB.js +0 -1
  146. package/dist/ms-PUEZJJ3R.js +0 -1
  147. package/dist/nl-NQPDRSCW.js +0 -1
  148. package/dist/no-3N3MUMSA.js +0 -1
  149. package/dist/pl-YHBEO6ZF.js +0 -1
  150. package/dist/pt-5RPESNZB.js +0 -1
  151. package/dist/ro-XDFXIMHX.js +0 -1
  152. package/dist/ru-BIIALOM5.js +0 -1
  153. package/dist/sk-LHSFRUFT.js +0 -1
  154. package/dist/sl-MPE5TPI3.js +0 -1
  155. package/dist/sr-T3N67KTP.js +0 -1
  156. package/dist/sv-LJWWYUIY.js +0 -1
  157. package/dist/th-E5POGG37.js +0 -1
  158. package/dist/tr-2DCWQ2CY.js +0 -1
  159. package/dist/uk-C3VJP6EA.js +0 -1
  160. package/dist/vi-XVMTKCOL.js +0 -1
  161. package/dist/zh-Hans-RG4CQGBY.js +0 -1
  162. package/dist/zh-Hant-YHNTYPFS.js +0 -1
@@ -1 +1 @@
1
- "use strict";var ka=Object.create;var Jo=Object.defineProperty;var Oa=Object.getOwnPropertyDescriptor;var Ta=Object.getOwnPropertyNames;var La=Object.getPrototypeOf,Ba=Object.prototype.hasOwnProperty;var Fa=(e,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of Ta(t))!Ba.call(e,r)&&r!==n&&Jo(e,r,{get:()=>t[r],enumerable:!(o=Oa(t,r))||o.enumerable});return e};var Ge=(e,t,n)=>(n=e!=null?ka(La(e)):{},Fa(t||!e||!e.__esModule?Jo(n,"default",{value:e,enumerable:!0}):n,e));var id=Math.PI/180;function Se(e,t){return Math.hypot(e.x-t.x,e.y-t.y)}function Un(e,t,n){return{x:e.x+(t.x-e.x)*n,y:e.y+(t.y-e.y)*n}}function Xn(e){let t=0,n=0;for(let r of e)t+=r.x,n+=r.y;let o=e.length||1;return{x:t/o,y:n/o}}function ht(e){return e.length?Xn(e):null}function er(e,t){let n=1-t,o=n*n*n,r=3*n*n*t,i=3*n*t*t,s=t*t*t;return{x:o*e.start.x+r*e.control1.x+i*e.control2.x+s*e.end.x,y:o*e.start.y+r*e.control1.y+i*e.control2.y+s*e.end.y}}function tr(e,t,n=192){if(!Number.isInteger(t)||t<1)throw new Error("Path point count must be a positive integer");if(t===1)return[er(e,.5)];let o=Array.from({length:n+1},(c,u)=>er(e,u/n)),r=new Float64Array(o.length);for(let c=1;c<o.length;c+=1){let u=o[c].x-o[c-1].x,l=o[c].y-o[c-1].y;r[c]=r[c-1]+Math.hypot(u,l)}let i=r[r.length-1];if(i<=1e-9)return Array.from({length:t},()=>({...e.start}));let s=[],a=1;for(let c=0;c<t;c+=1){let u=i*c/(t-1);for(;a<r.length-1&&r[a]<u;)a+=1;let l=r[a-1],f=r[a],m=f===l?0:(u-l)/(f-l);s.push({x:o[a-1].x+(o[a].x-o[a-1].x)*m,y:o[a-1].y+(o[a].y-o[a-1].y)*m})}return s}function Kn(e,t,n){return Math.max(t,Math.min(n,e))}function Na(e){return Kn(e,0,1)}function nr(e){let t=Na(e);return t*t*(3-2*t)}var dt=Math.PI*2;function pt(e){return Number.isFinite(e.x)&&Number.isFinite(e.y)}function Da(e,t,n){let o=t-e;if(n){for(;o<0;)o+=dt;for(;o>=dt;)o-=dt}else{for(;o>0;)o-=dt;for(;o<=-dt;)o+=dt}return o}function ir(e){if(e.version!==1||e.closed!==!0||!pt(e.start)||!Array.isArray(e.segments)||e.segments.length<2||e.segments.length>512)return!1;let t=e.start;for(let n of e.segments){if(!n||!pt(n.end))return!1;if(n.kind==="line"){if(Se(t,n.end)<=1e-9)return!1}else if(n.kind==="bezier"){if(!pt(n.control1)||!pt(n.control2)||Se(t,n.end)<=1e-9)return!1}else if(n.kind==="arc"){if(!pt(n.center)||!Number.isFinite(n.radius)||n.radius<=1e-6||Math.abs(Se(t,n.center)-n.radius)>Math.max(1e-4,n.radius*1e-4)||Math.abs(Se(n.end,n.center)-n.radius)>Math.max(1e-4,n.radius*1e-4)||Se(t,n.end)<=1e-9)return!1}else return!1;t=n.end}return Se(t,e.start)<=1e-4}function Ga(e,t,n){let o=1-n;return{x:o**3*e.x+3*o**2*n*t.control1.x+3*o*n**2*t.control2.x+n**3*t.end.x,y:o**3*e.y+3*o**2*n*t.control1.y+3*o*n**2*t.control2.y+n**3*t.end.y}}function sr(e,t=2){if(!ir(e))throw new Error("Section outline path is invalid");let n=Math.max(.25,t),o=[{...e.start}],r=e.start;for(let i of e.segments){if(i.kind==="line")o.push({...i.end});else if(i.kind==="arc"){let s=Math.atan2(r.y-i.center.y,r.x-i.center.x),a=Math.atan2(i.end.y-i.center.y,i.end.x-i.center.x),c=Da(s,a,i.clockwise),u=Math.max(2,Math.ceil(Math.abs(c)*i.radius/n));for(let l=1;l<=u;l+=1){let f=s+c*l/u;o.push({x:i.center.x+Math.cos(f)*i.radius,y:i.center.y+Math.sin(f)*i.radius})}}else{let s=Se(r,i.control1)+Se(i.control1,i.control2)+Se(i.control2,i.end),a=Math.max(2,Math.ceil(s/n));for(let c=1;c<=a;c+=1)o.push(Ga(r,i,c/a))}r=i.end}return Se(o[o.length-1],o[0])<=1e-4&&o.pop(),o}var ja=45,Yn=150,Ha=60;function Va(e){let t=ja/100;if(e<=t)return Yn;let n=Math.min(1,(e-t)/(1-t));return Yn-n*(Yn-Ha)}var or=.5523;function rr(e,t){return Math.abs(e.x-t.x)<=1e-6&&Math.abs(e.y-t.y)<=1e-6}function Ua(e){let t=[],n=[];for(e.forEach((o,r)=>{pt(o)&&(t.length&&rr(t[t.length-1],o)||(t.push({x:o.x,y:o.y}),n.push(r)))});t.length>1&&rr(t[0],t[t.length-1]);)t.pop(),n.pop();return{points:t,sourceIndex:n}}var Xa=.5,Ka=4/3;function Ya(e,t,n){let o=t.x-e.x,r=t.y-e.y,i=Math.hypot(o,r);if(i<=1e-9)return{kind:"line",end:{...t}};let s=-r/i,a=o/i,c=n*Ka;return{kind:"bezier",control1:{x:e.x+o/3+s*c,y:e.y+r/3+a*c},control2:{x:e.x+o*2/3+s*c,y:e.y+r*2/3+a*c},end:{...t}}}function ar(e,t){let{points:n,sourceIndex:o}=Ua(e),r=n.length;if(r<3)return null;let i=Math.min(100,Math.max(0,t.cornerSmoothing??0))/100,s=t.edgeCurvature,a=new Array(r).fill(0);if(s?.length)for(let w=0;w<r;w+=1){let x=s[o[w]];a[w]=Number.isFinite(x)?Math.min(100,Math.max(-100,x))/100:0}let c=a.some(w=>Math.abs(w)>1e-6);if(i<=0&&!c)return null;let u=t.wideAngleThresholdDeg??Va(i),l=[];for(let w=0;w<r;w+=1)l[w]=Se(n[w],n[(w+1)%r]);let f=new Array(r).fill(0);for(let w=0;w<r;w+=1){let x=n[(w-1+r)%r],b=n[w],S=n[(w+1)%r],I={x:x.x-b.x,y:x.y-b.y},R={x:S.x-b.x,y:S.y-b.y},k=Math.hypot(I.x,I.y),L=Math.hypot(R.x,R.y);if(k<=1e-9||L<=1e-9)continue;let T=Math.min(1,Math.max(-1,(I.x*R.x+I.y*R.y)/(k*L))),v=Math.acos(T)*180/Math.PI;if(v<u)continue;let A=nr((v-u)/(180-u));f[w]=i*A*.5*Math.min(k,L)}for(let w=0;w<r;w+=1){let x=(w+1)%r,b=f[w]+f[x];if(b>l[w]&&b>1e-9){let S=l[w]/b;f[w]*=S,f[x]*=S}}let m=new Array(r),h=new Array(r);for(let w=0;w<r;w+=1){let x=n[(w-1+r)%r],b=n[w],S=n[(w+1)%r];if(f[w]<=1e-6){m[w]={...b},h[w]={...b};continue}let I=Se(b,x)||1,R=Se(b,S)||1;m[w]={x:b.x+(x.x-b.x)/I*f[w],y:b.y+(x.y-b.y)/I*f[w]},h[w]={x:b.x+(S.x-b.x)/R*f[w],y:b.y+(S.y-b.y)/R*f[w]}}if(f.every(w=>w<=1e-6)&&!c)return null;let d=[],p={...h[0]},y=p,g=(w,x)=>{if(Se(y,w)<=1e-9)return;let b=a[x];Math.abs(b)>1e-6?d.push(Ya(y,w,b*Xa*l[x])):d.push({kind:"line",end:{...w}}),y=w};for(let w=1;w<=r;w+=1){let x=w%r,b=n[x];g(m[x],(w-1)%r),f[x]>1e-6&&Se(m[x],h[x])>1e-9&&(d.push({kind:"bezier",control1:Un(m[x],b,or),control2:Un(h[x],b,or),end:{...h[x]}}),y=h[x])}if(!d.length)return null;let M=d[d.length-1];Se(M.end,p)>1e-9&&(M.kind==="line"?M.end={...p}:d.push({kind:"line",end:{...p}}));let P={version:1,closed:!0,start:p,segments:d};return ir(P)?P:null}function Wa(e){let t=e.points??[];if(e.kind!=="polygon"||t.length<3||!Array.isArray(e.edgeCurvature))return[];let n=t.map((o,r)=>{let i=e.edgeCurvature[r];return Number.isFinite(i)?Math.min(100,Math.max(-100,i)):0});return n.some(o=>Math.abs(o)>.5)?n:[]}function za(e){let t=Wa(e);return t.length?ar(e.points,{edgeCurvature:t}):null}function tn(e,t=2){let n=za(e);return n?sr(n,t):e.points??[]}function cr(e){return e.kind==="polygon"?Bt(e.holes):[]}function ur(e){let t=new Map,n=new Map;for(let o of e){if(o.type!=="row"||!o.segmentedRow)continue;let r=n.get(o.segmentedRow.groupId)??[];r.push(o),n.set(o.segmentedRow.groupId,r)}for(let[o,r]of n){let i=r.slice().sort((m,h)=>m.segmentedRow.componentIndex-h.segmentedRow.componentIndex),s=i[0]?.segmentedRow?.componentCount??0,a=i[0]?.segmentedRow;if(!a||!(s>=2&&i.length===s&&a?.boundaryBefore==="start"&&i.every((m,h)=>m.segmentedRow?.kind==="segmented-row-v1"&&m.segmentedRow.groupId===o&&m.segmentedRow.componentCount===s&&m.segmentedRow.componentIndex===h&&m.segmentedRow.repeatLabelOnComponents===a.repeatLabelOnComponents&&(h===0?m.segmentedRow.boundaryBefore==="start":m.segmentedRow.boundaryBefore!=="start")&&m.segmentedRow.displayLabel===a.displayLabel)))continue;let u=i.reduce((m,h)=>m+h.seatCount,0),l=0,f=0;for(let m of i)m.segmentedRow.boundaryBefore==="break"&&(l+=1),t.set(m.id,{groupId:o,adjacencyOffset:l,displayOffset:f,displayLabel:a.displayLabel,totalSeats:u,canonical:i[0],viewFromSeatUrl:a.viewFromSeatUrl,viewFromSeatMeta:a.viewFromSeatMeta,confidenceEvidence:a.confidenceEvidence}),l+=m.seatCount,f+=m.seatCount}return t}var Za="ABCDEFGHIJKLMNOPQRSTUVWXYZ";var $a="abcdefghijklmnopqrstuvwxyz";function Qa(e,t){let n=t.length,o=e+1,r="";for(;o>0;){o-=1;let i=o%n;r=t[i]+r,o=Math.floor(o/n)}return r}function Ft(e,t=!1){let n=t?$a:Za;return Qa(Math.max(0,Math.floor(e)-1),n)}var qa=[[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 fr(e){if(!Number.isFinite(e)||e<=0)return String(e);let t=Math.floor(e),n="";for(let[o,r]of qa)for(;t>=o;)n+=r,t-=o;return n}function Ja(e){let t=new Array(e);return Array.from({length:e},(n,o)=>o).sort((n,o)=>Math.abs(2*n-(e-1))-Math.abs(2*o-(e-1))||n-o).forEach((n,o)=>t[n]=o),t}function zn(e,t){let n=e.seatLabelStart??1,o=e.seatNumbering?.direction??"ltr",r=e.seatNumbering?.step??1,i=e.seatNumbering?.scheme??"decimal",s=e.seatNumbering?.prefix??"",a=e.seatNumbering?.endAt,c=e.seatCount;if(i==="updown"||i==="updown-descending"){let h=Math.ceil(c/2),d=i==="updown"?t<h?n+2*t:n-1+2*(c-t):t<h?n+2*(h-1-t):n+1+2*(t-h);return`${s}${d}`}let u=i==="odd"||i==="even"?2:r,l=a!=null&&Number.isFinite(a)?a-(c-1)*u:n,f=o==="center"?Ja(c)[t]:o==="rtl"?c-1-t:t,m;switch(i){case"odd":{let h=l%2===1?l:l+1;m=String(h+f*2);break}case"even":{let h=l%2===0?l:l+1;m=String(h+f*2);break}case"roman":m=fr(l+f*r);break;case"letters-upper":m=Ft(l+f*r,!1);break;case"letters-lower":m=Ft(l+f*r,!0);break;default:m=String(l+f*r);break}return`${s}${m}`}function ec(e){return{...e.canonical,seatCount:e.totalSeats,label:e.displayLabel,displayLabel:e.displayLabel}}function mr(e,t,n){return n?.label??`${e.seatLabelBase??e.label}-${zn(e,t)}`}function tc(e,t,n,o){if(o?.displayLabel)return null;if(e.seatDisplayLabelMode==="number"||!n)return{row:e.displayLabel||e.label,seat:zn(e,t)};let r=ec(n);return{row:n.displayLabel,seat:zn(r,n.displayOffset+t)}}function Zn(e,t,n,o){let r=tc(e,t,n,o);return r?e.seatDisplayLabelMode==="number"?r.seat:`${r.row}-${r.seat}`:o.displayLabel}function hr(e,t){return`${e.label}-${t+1}`}function nc(e,t,n){return e?.direction==="anticlockwise"?Math.max(0,t-1-n):n}function oc(e,t){let n=e.chairNumbering,o=n?.start??1,r=nc(n,Math.max(0,Math.round(e.seatCount)),t);return n?.format==="letter"?Ft(Math.max(1,o)+r):String(o+r)}function dr(e,t){let n=oc(e,t);return(e.chairNumbering?.format??"table-number")==="table-number"?`${e.displayLabel??e.label}-${n}`:n}var $=.02291666666666667,Oe=1/$,rc=58,ic=rc*$;var sc=3,pr=0,$n=120,ac=0,cc=45,lc=7,je=1.2;function Qn(e,t,n,o){return Number.isFinite(e)?Math.max(t,Math.min(n,e)):o}function uc(e){return!Number.isFinite(e)||!Number.isInteger(e)||e<0?0:e<=lc?e:sc}function Qe(e,t={}){let n=Qn(t.floorBaseHeightM,pr,$n,0),o=Math.min($n,n+uc(e.elevation)*ic),r=e.height===void 0?o:Qn(e.height,pr,$n,o),i=Qn(e.rake,ac,cc,0);return{height:r,rake:i}}function br(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 bt(e,t,n){if(!e.length)return 1/0;if(e.length===1)return Math.hypot(t-e[0].x,n-e[0].y);let o=1/0;for(let r=0;r+1<e.length;r++){let i=e[r],s=e[r+1],a=s.x-i.x,c=s.y-i.y,u=a*a+c*c,l=u>1e-12?((t-i.x)*a+(n-i.y)*c)/u:0;l<0?l=0:l>1&&(l=1);let f=t-(i.x+l*a),m=n-(i.y+l*c);if(Math.abs(f)>=o||Math.abs(m)>=o)continue;let h=Math.hypot(f,m);h<o&&(o=h)}return o}function fc(e){let t=0,n=0;for(let i of e)t+=i.x,n+=i.y;let o=e.length||1;t/=o,n/=o;let r=0;for(let i of e){let s=Math.hypot(i.x-t,i.y-n);s>r&&(r=s)}return{cx:t,cy:n,r}}function yr(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 o of br(e)){let r=bt(t,o.x,o.y);r<n&&(n=r)}for(let o of br(t)){let r=bt(e,o.x,o.y);r<n&&(n=r)}return n}function mc(e,t){if(e.length<3)return{pts:e,seatIndices:t};let n=0,o=0;for(let l of e)n+=l.x,o+=l.y;n/=e.length,o/=e.length;let r=-1,i=e[0];for(let l of e){let f=Math.hypot(l.x-n,l.y-o);f>r&&(r=f,i=l)}let s=i.x-n,a=i.y-o,c=Math.hypot(s,a);c>1e-9?(s/=c,a/=c):(s=1,a=0);let u=e.map((l,f)=>({p:l,i:f,t:(l.x-n)*s+(l.y-o)*a})).sort((l,f)=>l.t-f.t);return{pts:u.map(l=>l.p),seatIndices:u.map(l=>t[l.i])}}function Jn(e){let t=e.length;if(t<3)return null;let n=0,o=0;for(let M of e)n+=M.x,o+=M.y;n/=t,o/=t;let r=0,i=0,s=0,a=0,c=0,u=0,l=0;for(let M of e){let P=M.x-n,w=M.y-o;r+=P*P,s+=w*w,i+=P*w,a+=P*P*P,c+=w*w*w,u+=P*w*w,l+=w*P*P}let f=r*s-i*i;if(Math.abs(f)<1e-9)return null;let m=(a+u)/2,h=(c+l)/2,d=(m*s-h*i)/f,p=(h*r-m*i)/f,y=d+n,g=p+o;return!Number.isFinite(y)||!Number.isFinite(g)?null:{cx:y,cy:g}}var hc=.15,dc=.001;function pc(e){let t=e[0],n=e[e.length-1],o=n.x-t.x,r=n.y-t.y,i=Math.hypot(o,r);if(!(i>1e-9))return 0;let s=0;for(let a of e){let c=Math.abs((a.x-t.x)*r-(a.y-t.y)*o)/i;c>s&&(s=c)}return s/i}function bc(e){if(e.length<2)return null;let t=e.map(x=>{let b=0,S=0;for(let I of x.pts)b+=I.x,S+=I.y;return{x:b/x.pts.length,y:S/x.pts.length}}),n=0,o=0;for(let x of t)n+=x.x,o+=x.y;n/=t.length,o/=t.length;let r=0,i=0,s=0;for(let x of t){let b=x.x-n,S=x.y-o;r+=b*b,i+=b*S,s+=S*S}let a=r+s,c=r*s-i*i,u=a/2+Math.sqrt(Math.max(0,a*a/4-c)),l,f;Math.abs(i)>1e-12?(l=u-s,f=i):r>=s?(l=1,f=0):(l=0,f=1);let m=Math.hypot(l,f);if(!(m>1e-12))return null;l/=m,f/=m;let h=0,d=0,p=0;for(let x of e){if(x.pts.length<2)continue;let b=x.pts[0],S=x.pts[x.pts.length-1],I=S.x-b.x,R=S.y-b.y,k=Math.hypot(I,R);if(!(k>1e-9))continue;let L=I/k,T=R/k;h+=(L*L-T*T)*k,d+=2*L*T*k,p+=k}if(p>0&&Math.hypot(h,d)>=gc*p){let x=Math.atan2(d,h)/2;l=-Math.sin(x),f=Math.cos(x)}let y=1/0,g=-1/0,M=[];for(let x of e){let b=1/0,S=-1/0;for(let I of x.pts){let R=I.x*l+I.y*f;R<b&&(b=R),R>S&&(S=R),R<y&&(y=R),R>g&&(g=R)}M.push(S-b)}let P=g-y;return P>1e-9?(M.sort((x,b)=>x-b),M[Math.min(M.length-1,Math.floor(M.length*.9))]/P<=yc?{x:l,y:f}:null):null}var yc=.35,gc=.8;function nn(e,t,n,o){let r=new Map;for(let b of n){let S=t[b],I=S.rowId||`__seat-${b}`,R=r.get(I);R||(R={pts:[],idx:[]},r.set(I,R)),R.pts.push({x:S.x,y:S.y}),R.idx.push(b)}if(!r.size)return{sectionId:e,rows:[],blockCount:0};let i=[];for(let[b,S]of r){let I=mc(S.pts,S.idx),R=0;for(let k of I.pts)R+=Math.hypot(k.x-o.x,k.y-o.y);i.push({id:b,pts:I.pts,seatIndices:I.seatIndices,blockId:-1,ordinal:0,blockDepth:0,focalDistance:R/I.pts.length})}let s=i.map(b=>fc(b.pts)),a=i.length<=256?i.length*(i.length-1)/2:0,c=a?new Float64Array(a):null;c?.fill(Number.NaN);let u=c?new Map(i.map((b,S)=>[b,S])):null,l=(b,S)=>(b>S&&([b,S]=[S,b]),b*(2*i.length-b-1)/2+(S-b-1)),f=(b,S)=>{if(!c)return qn(i[b].pts,i[S].pts);let I=l(b,S),R=c[I];if(!Number.isNaN(R))return R;let k=qn(i[b].pts,i[S].pts);return c[I]=k,k},m=(b,S)=>u?f(u.get(b),u.get(S)):qn(b.pts,S.pts),h=[];for(let b=0;b<i.length;b++){let S=1/0;for(let I=0;I<i.length;I++){if(b===I||yr(s[b],s[I])>=S)continue;let R=f(b,I);R<S&&(S=R)}Number.isFinite(S)&&h.push(S)}h.sort((b,S)=>b-S);let d=h.length?h[Math.floor(h.length/2)]:1,p=Math.max(d*1.8,1e-6),y=i.map(()=>[]);for(let b=0;b<i.length;b++)for(let S=b+1;S<i.length;S++)yr(s[b],s[S])>p||f(b,S)<=p&&(y[b].push(S),y[S].push(b));let g=0;for(let b=0;b<i.length;b++){if(i[b].blockId!==-1)continue;let S=g++,I=[b];for(i[b].blockId=S;I.length;){let R=I.pop();for(let k of y[R])i[k].blockId===-1&&(i[k].blockId=S,I.push(k))}}let M=new Map;for(let b of i){let S=M.get(b.blockId)??[];S.push(b),M.set(b.blockId,S)}let P=[];for(let b of i){if(b.pts.length<4||pc(b.pts)<dc)continue;let S=Jn(b.pts);S&&(!Number.isFinite(S.cx)||!Number.isFinite(S.cy)||P.push({x:S.cx,y:S.cy}))}let w=P.length>=2?(()=>{let b=P.map(R=>R.x).sort((R,k)=>R-k),S=P.map(R=>R.y).sort((R,k)=>R-k),I=Math.floor(P.length/2);return{cx:b[I],cy:S[I]}})():null;if(w){let b=T=>Math.hypot(T.x-w.cx,T.y-w.cy),S=1/0,I=-1/0,R=[];for(let T of i){let v=1/0,A=-1/0;for(let _ of T.pts){let C=b(_);C<v&&(v=C),C>A&&(A=C)}R.push(A-v),v<S&&(S=v),A>I&&(I=A)}let k=I-S;R.sort((T,v)=>T-v);let L=R[Math.min(R.length-1,Math.floor(R.length*.9))];if(k>1e-9&&L/k<=hc){let T=i.map(N=>{let X=0;for(let V of N.pts)X+=b(V);return{row:N,radius:X/N.pts.length}}),v=0,A=0;for(let N of T)v+=N.radius,A+=N.row.focalDistance;v/=T.length,A/=T.length;let _=0;for(let N of T)_+=(N.radius-v)*(N.row.focalDistance-A);if(_<0)for(let N of T)N.radius=-N.radius;let B=1/0;for(let N of T)N.radius<B&&(B=N.radius);T.sort((N,X)=>N.radius-X.radius);let O=-1,F=-1/0,D=k/Math.max(1,T.length)*.5,j=[];for(let N of T)N.radius-F>D&&(O++,F=N.radius),N.row.ordinal=O,N.row.blockDepth=N.radius-B,j.push(N.row);return{sectionId:e,rows:j,blockCount:g}}}let x=[];for(let[,b]of M){let S=bc(b);if(S){let I=T=>{let v=0;for(let A of T.pts)v+=A.x*S.x+A.y*S.y;return v/T.pts.length};b.sort((T,v)=>I(T)-I(v)),b.length>=2&&b[0].focalDistance>b[b.length-1].focalDistance&&b.reverse();let R=[],k=d*.5;for(let T of b){let v=R[R.length-1];v&&Math.abs(I(T)-I(v[0]))<k?v.push(T):R.push([T])}let L=0;for(let T=0;T<R.length;T++){if(T>0){let v=1/0;for(let A of R[T-1])for(let _ of R[T])v=Math.min(v,m(A,_));v=Math.min(v,Math.abs(I(R[T][0])-I(R[T-1][0]))),L+=v}for(let v of R[T])v.ordinal=T,v.blockDepth=L,x.push(v)}}else{let I=1/0;for(let R of b)R.focalDistance<I&&(I=R.focalDistance);b.sort((R,k)=>R.focalDistance-k.focalDistance);for(let R=0;R<b.length;R++)b[R].ordinal=R,b[R].blockDepth=Math.max(0,b[R].focalDistance-I),x.push(b[R])}}return{sectionId:e,rows:x,blockCount:g}}var xc=/^\d{4}-\d{2}-\d{2}$/;function Mc(e){let t=Date.parse(e);return Number.isFinite(t)?xc.test(e)?t+864e5:t:null}function Sc(e,t=Date.now()){if(e.validUntil===void 0){if(e.status!=="approved")return!0;let o=e.assessedAt?Date.parse(e.assessedAt):Number.NaN;return Number.isFinite(o)&&(t instanceof Date?t.getTime():t)<=o+366*864e5}let n=Mc(e.validUntil);return n===null?!1:(t instanceof Date?t.getTime():t)<n}function Pc(e,t,n){return!(e.eventConfigurationId&&e.eventConfigurationId!==t||e.eventConfigurationVersion!==void 0&&e.eventConfigurationVersion!==n)}function Ic(e){return e.status!=="draft"&&e.status!=="retracted"}function Rc(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 gr(e,t={}){return!!e&&Ic(e)&&Pc(e,t.activeConfigurationId,t.activeConfigurationVersion)&&Rc(e,t.activeBasisSha256)&&Sc(e,t.now)}var wc=new Set(["pitch-football","rink-hockey","track-athletics","oval-cricket","pitch-rugby","diamond-baseball","court-basketball","court-tennis","ring-boxing"]),Ec=new Set(["pitch-football","track-athletics","oval-cricket","pitch-rugby","diamond-baseball"]);function st(e){return!!e&&wc.has(e)}function on(e){return!!e&&Ec.has(e)}var eo=1.1;function Sr(e){return sn(e)?e==="ring-boxing"?eo:.06:1}var Ac={round:{width:6,height:6},"pitch-football":{width:105,height:68},"rink-hockey":{width:60,height:30},"track-athletics":{width:176.9,height:92.5},"oval-cricket":{width:150,height:140},"pitch-rugby":{width:120,height:70},"diamond-baseball":{width:140,height:140},"court-basketball":{width:32,height:19},"court-tennis":{width:36.57,height:18.29},"ring-boxing":{width:7.8,height:7.8}},_c={"pitch-football":"#2f7d4f","rink-hockey":"#e8f1f8","track-athletics":"#a4472f","oval-cricket":"#3d8a53","pitch-rugby":"#2f7d4f","diamond-baseball":"#2f7d4f","court-basketball":"#c8894f","court-tennis":"#3f7a5a","ring-boxing":"#2a4d8f"};var vc=Math.PI*2;function Cc(e,t,n,o,r,i){return{x:r+e*n-t*o,y:i+e*o+t*n}}function xr(e,t){let n=Math.max(0,e-t),o=[],r=20;for(let i=0;i<=r;i++){let s=-Math.PI/2+i/r*Math.PI;o.push({x:n+t*Math.cos(s),y:t*Math.sin(s)})}for(let i=0;i<=r;i++){let s=Math.PI/2+i/r*Math.PI;o.push({x:-n+t*Math.cos(s),y:t*Math.sin(s)})}return o}var Mr=(()=>{let t={x:0,y:52},n=25,o={x:70,y:t.y-70},r=(o.x*o.x+o.y*o.y-4900)/(2*(o.y+70)),i=r+70,s=[],a=Math.atan2(o.y-r,o.x),c=Math.atan2(o.y-r,-o.x);for(let u=0;u<=24;u++){let l=a+(c-a)*u/24;s.push({x:i*Math.cos(l),y:r+i*Math.sin(l)})}return{half:70,home:t,backstop:n,fence:s}})();var rn="#f1f5f9";function sn(e){return st(e)}function qe(e,t,n,o,r=32){let i=[];for(let s=0;s<r;s++){let a=s/r*vc;i.push({x:e+n*Math.cos(a),y:t+o*Math.sin(a)})}return i}function Ke(e,t,n,o){return[{x:e-n,y:t-o},{x:e+n,y:t-o},{x:e+n,y:t+o},{x:e-n,y:t+o}]}function kc(e){let{kind:t,cx:n,cy:o,width:r,height:i}=e,s=(e.rotation??0)*Math.PI/180,a=Math.cos(s),c=Math.sin(s),u=r/2,l=i/2,f=[],m=Ac[t],h=p=>m?p/m.width*r:0,d=p=>m?p/m.height*i:0;switch(t){case"pitch-football":{f.push({points:[{x:0,y:-l},{x:0,y:l}],closed:!1}),f.push({points:qe(0,0,h(9.15),d(9.15)),closed:!0});for(let p of[-1,1])f.push({points:Ke(p*(u-h(16.5)/2),0,h(16.5)/2,d(40.32)/2),closed:!0}),f.push({points:Ke(p*(u-h(5.5)/2),0,h(5.5)/2,d(18.32)/2),closed:!0});break}case"rink-hockey":{f.push({points:[{x:0,y:-l},{x:0,y:l}],closed:!1,ink:"#d63b3b"});for(let p of[-1,1]){f.push({points:[{x:p*h(7.5),y:-l},{x:p*h(7.5),y:l}],closed:!1,ink:"#2f6ecb"}),f.push({points:[{x:p*(u-h(4)),y:-d(11)},{x:p*(u-h(4)),y:d(11)}],closed:!1,ink:"#d63b3b"});for(let y of[-1,1])f.push({points:qe(p*h(20.5),y*d(7),h(4.5),d(4.5)),closed:!0,ink:"#2f6ecb"})}f.push({points:qe(0,0,h(4.5),d(4.5)),closed:!0,ink:"#2f6ecb"});break}case"track-athletics":{let y=l-d(1.22)*8;y>0&&f.push({points:xr(u-h(1.22)*8,y),closed:!0,fill:"#2f7d4f"});for(let g=1;g<8;g++){let M=d(1.22)*g,P=l-M;if(P<=0)break;f.push({points:xr(u-h(1.22)*g,P),closed:!0})}break}case"oval-cricket":{f.push({points:qe(0,0,h(27.4),d(27.4+20.12/2),40),closed:!0}),f.push({points:Ke(0,0,h(3.05)/2,d(20.12)/2),closed:!0,ink:"#d8cfae"});break}case"pitch-rugby":{let p=y=>({points:[{x:h(y),y:-l},{x:h(y),y:l}],closed:!1});f.push(p(0));for(let y of[-1,1]){f.push(p(y*50),p(y*28));for(let g=-35;g<35;g+=4)f.push({points:[{x:h(y*10),y:d(g)},{x:h(y*10),y:d(Math.min(35,g+2))}],closed:!1})}break}case"diamond-baseball":{let p=(C,B)=>({x:h(C),y:d(B)}),{home:y}=Mr,g=27.43,M=g/Math.SQRT2,P={x:y.x+M,y:y.y-M},w={x:y.x,y:y.y-2*M},x={x:y.x-M,y:y.y-M},b={x:y.x,y:y.y-18.44},S="#b98a59",I=_c["diamond-baseball"],R=38.94,k=[p(y.x,y.y)],L=Math.atan2(y.y-R/Math.SQRT2-b.y,R/Math.SQRT2),T=Math.PI-L;for(let C=0;C<=16;C++){let B=L-(L+Math.PI*2-T)%(Math.PI*2)*(C/16);k.push(p(b.x+29*Math.cos(B),b.y+29*Math.sin(B)))}f.push({points:k,closed:!0,fill:S,ink:S});let v={x:y.x,y:y.y-M},A=[{x:y.x,y:y.y},P,w,x].map(C=>p(v.x+(C.x-v.x)*.84,v.y+(C.y-v.y)*.84));f.push({points:A,closed:!0,fill:I,ink:I}),f.push({points:qe(h(b.x),d(b.y),h(2.74),d(2.74),20),closed:!0,fill:S,ink:S}),f.push({points:qe(h(y.x),d(y.y),h(3.96),d(3.96),20),closed:!0,fill:S,ink:S});let _=Mr.fence;f.push({points:[p(y.x,y.y),p(_[0].x,_[0].y)],closed:!1}),f.push({points:[p(y.x,y.y),p(_[_.length-1].x,_[_.length-1].y)],closed:!1});for(let C of[P,w,x])f.push({points:Ke(h(C.x),d(C.y),h(.3),d(.3)),closed:!0,fill:rn});break}case"court-basketball":{f.push({points:Ke(0,0,h(14),d(7.5)),closed:!0}),f.push({points:[{x:0,y:-d(7.5)},{x:0,y:d(7.5)}],closed:!1}),f.push({points:qe(0,0,h(1.8),d(1.8),24),closed:!0});for(let p of[-1,1]){let y=p*14,g=p*(14-5.8),M=p*(14-1.575);f.push({points:Ke(h((y+g)/2),0,h(2.9),d(2.45)),closed:!0,fill:"#2f5d8a"}),f.push({points:qe(h(g),0,h(1.8),d(1.8),24),closed:!0});let P=Math.sqrt(6.75*6.75-6.6*6.6),w=[{x:h(y),y:-d(6.6)}],x=Math.atan2(-6.6,-p*P),b=2*Math.atan2(6.6,P);for(let S=0;S<=16;S++){let I=x-p*b*(S/16);w.push({x:h(M+6.75*Math.cos(I)),y:d(6.75*Math.sin(I))})}w.push({x:h(y),y:d(6.6)}),f.push({points:w,closed:!1})}break}case"court-tennis":{f.push({points:Ke(0,0,h(11.885),d(5.485)),closed:!0,fill:"#2b5f99"});for(let p of[-1,1])f.push({points:[{x:-h(11.885),y:p*d(4.115)},{x:h(11.885),y:p*d(4.115)}],closed:!1}),f.push({points:[{x:p*h(6.4),y:-d(4.115)},{x:p*h(6.4),y:d(4.115)}],closed:!1});f.push({points:[{x:-h(6.4),y:0},{x:h(6.4),y:0}],closed:!1}),f.push({points:[{x:0,y:-d(6.4)},{x:0,y:d(6.4)}],closed:!1,ink:"#d1d5db"});break}case"ring-boxing":{f.push({points:Ke(0,0,h(3.05),d(3.05)),closed:!0});let g=[[-1,-1,"#c53030"],[1,1,"#2b6cb0"],[1,-1,"#e2e8f0"],[-1,1,"#e2e8f0"]];for(let[M,P,w]of g)f.push({points:Ke(M*h(3.05),P*d(3.05),h(.3),d(.3)),closed:!0,fill:w,ink:w});break}default:return[]}return f.map(p=>({...p,points:p.points.map(y=>Cc(y.x,y.y,a,c,n,o))}))}function Pr(e){if(e.role!=="stage"||!sn(e.stageKind))return[];let t=null;if(e.x!=null&&e.y!=null&&e.width!=null&&e.height!=null&&e.width>0&&e.height>0&&[e.x,e.y,e.width,e.height].every(Number.isFinite))t={cx:e.x+e.width/2,cy:e.y+e.height/2,width:e.width,height:e.height};else if(e.points&&e.points.length>=3&&e.points.every(n=>Number.isFinite(n.x)&&Number.isFinite(n.y))){let n=e.points.map(l=>l.x),o=e.points.map(l=>l.y),r=Math.min(...n),i=Math.max(...n),s=Math.min(...o),a=Math.max(...o),c=Math.max(1,i-r),u=Math.max(1,a-s);t={cx:r+c/2,cy:s+u/2,width:c,height:u}}return t?kc({kind:e.stageKind,...t}):[]}var Oc=/^data:image\/(?:png|jpe?g|webp|gif|avif);base64,[a-z0-9+/]+={0,2}$/i,Tc=/[\s"'<>`\\]/;function Lc(e){if(typeof e!="string"||!e||e.length>2e6||e!==e.trim())return!1;if(e.startsWith("data:"))return Oc.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 Lc(t)?t:null}var to="seatlayer.event-configuration/1";var yt=100,Bc=120,Fc=2e5,Nc=1e4,Dc=/^[a-f0-9]{64}$/,Gc=new Set(["stage","screen","barrier","camera_platform","sound_desk","rigging_truss"]);function Nt(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function at(e,t){return typeof e=="string"&&e.length>=1&&e.length<=t&&e.normalize("NFKC").trim()===e}function jc(e){return typeof e=="number"&&Number.isInteger(e)&&e>0}function Rr(e){return!Array.isArray(e)||e.length>Fc||!e.every(t=>at(t,yt))?null:[...new Set(e)].sort()}function Hc(e){return!Nt(e)||!at(e.chartId,yt)||!at(e.version,yt)||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 no(e,t,n){return typeof e=="number"&&Number.isFinite(e)&&e>=t&&e<=n}function Vc(e){return Nt(e)?e.mode==="none"||e.mode==="opaque"?e.opacity===void 0?{mode:e.mode}:null:e.mode==="partial"&&no(e.opacity,.01,.99)?{mode:"partial",opacity:e.opacity}:null:null}function Uc(e,t){if(e===void 0)return;if(!Array.isArray(e)||e.length>Nc)return null;let n=new Set(t),o=new Set,r=new Set,i=0,s=[];for(let a of e){if(!Nt(a)||!at(a.id,yt)||!at(a.objectId,yt)||!n.has(a.objectId)||!Gc.has(String(a.kind))||!no(a.heightM,.05,50)||a.baseElevationM!==void 0&&!no(a.baseElevationM,-10,100))return null;let c=Vc(a.occlusion);if(!c||o.has(a.id)||r.has(a.objectId))return null;let u=a.contentImageUrl===void 0?void 0:typeof a.contentImageUrl=="string"?Ir(a.contentImageUrl):null;if(a.contentImageUrl!==void 0&&(!u||a.kind!=="screen"||++i>1))return null;o.add(a.id),r.add(a.objectId),s.push({id:a.id,objectId:a.objectId,kind:a.kind,heightM:a.heightM,...a.baseElevationM!==void 0?{baseElevationM:a.baseElevationM}:{},occlusion:c,...u?{contentImageUrl:u}:{}})}return s.sort((a,c)=>a.id.localeCompare(c.id))}function Xc(e){let t=[];if(!Nt(e))return{issues:[{code:"invalid_export",path:"configuration",message:"Configuration must be an object"}]};e.schema!==to&&t.push({code:"unsupported_schema",path:"configuration.schema",message:`Configuration schema must be ${to}`}),at(e.id,yt)||t.push({code:"invalid_id",path:"configuration.id",message:"Configuration id must contain 1 to 100 normalized characters"}),at(e.label,Bc)||t.push({code:"invalid_label",path:"configuration.label",message:"Configuration label must contain 1 to 120 normalized characters"}),jc(e.version)||t.push({code:"invalid_version",path:"configuration.version",message:"Configuration version must be a positive integer"});let n=Hc(e.baseVenue);n||t.push({code:"invalid_base_venue",path:"configuration.baseVenue",message:"Base venue must identify one normalized chart id and exact version"});let o=Nt(e.overlay)?e.overlay:null,r=Rr(o?.objectIds),i=Rr(o?.productionKillSeatIds),s=r?Uc(o?.productionElements,r):null;return(!o||!r||!i)&&t.push({code:"invalid_overlay",path:"configuration.overlay",message:"Overlay ids must be bounded arrays of normalized stable ids"}),s===null&&t.push({code:"invalid_production_element",path:"configuration.overlay.productionElements",message:"Production elements must be unique, bounded semantics over referenced base-venue objects"}),t.length||!n||!r||!i||s===null?{issues:t}:{issues:t,value:{schema:to,id:e.id,label:e.label,version:e.version,baseVenue:n,overlay:{objectIds:r,productionKillSeatIds:i,...s!==void 0?{productionElements:s}:{}}}}}function wr(e){let t=Xc(e);return t.value?{ok:!0,value:t.value}:{ok:!1,issues:t.issues}}function Kc(e){if((e.kind==="polygon"||e.kind==="polyline"||e.kind==="line")&&e.points&&e.points.length>=2)return e.kind==="polygon"?tn(e,6):e.points;if(e.x==null||e.y==null||e.width==null||e.height==null)return null;let t=e.x,n=e.y,o=e.width,r=e.height;return[{x:t,y:n},{x:t+o,y:n},{x:t+o,y:n+r},{x:t,y:n+r}]}function Yc(e,t,n){let o=n*Math.PI/180,r=Math.cos(o),i=Math.sin(o),s=e.x-t.x,a=e.y-t.y;return{x:t.x+s*r-a*i,y:t.y+s*i+a*r}}function Er(e){let t=Kc(e);if(!t||t.length<2)return null;let n=e.rotation??0,o=Math.abs(n)<1e-6?t:t.map(c=>Yc(c,{x:t.reduce((u,l)=>u+l.x,0)/t.length,y:t.reduce((u,l)=>u+l.y,0)/t.length},n)),r=1/0,i=1/0,s=-1/0,a=-1/0;for(let c of o)r=Math.min(r,c.x),i=Math.min(i,c.y),s=Math.max(s,c.x),a=Math.max(a,c.y);return!Number.isFinite(r)||s-r<1e-6||a-i<1e-6?null:{minX:r,minY:i,maxX:s,maxY:a}}var Wc=5,zc=3,Zc=.92,$c=1.9,Qc=2,qc=.6,Jc=1,el=.06;function tl(e){return e.heightM!==void 0?e.heightM:e.stageKind==="ring-boxing"?eo:sn(e.stageKind)?el:Jc}function Ar(e){let t=1/0,n=1/0,o=-1/0,r=-1/0,i=-1/0;for(let s of Cr(e)){let a=s.baseHeightM??0;for(let c of s.objects){if(c.type!=="shape"||c.role!=="stage")continue;let u=Er(c);u&&(t=Math.min(t,u.minX),n=Math.min(n,u.minY),o=Math.max(o,u.maxX),r=Math.max(r,u.maxY),i=Math.max(i,a+tl(c)))}}return!Number.isFinite(t)||!Number.isFinite(i)?null:{minX:t,minY:n,maxX:o,maxY:r,deckTopM:i}}function nl(e,t,n,o){let r=1/0,i=1/0,s=-1/0,a=-1/0;for(let h of e)Number.isFinite(h.eyeHeightM)&&(r=Math.min(r,h.x),s=Math.max(s,h.x),i=Math.min(i,h.y),a=Math.max(a,h.y));if(!Number.isFinite(r))return null;let c=r*t,u=i*t,l=Math.max(1,Math.ceil((s-r)*t/n)+1),f=Math.max(1,Math.ceil((a-i)*t/n)+1),m=new Float64Array(l*f).fill(-1/0);for(let h of e){if(!Number.isFinite(h.eyeHeightM))continue;let d=h.eyeHeightM-je,p=Math.min(l-1,Math.max(0,Math.floor((h.x*t-c)/n))),g=Math.min(f-1,Math.max(0,Math.floor((h.y*t-u)/n)))*l+p,M=d+o;M>m[g]&&(m[g]=M)}return{cellM:n,minX:c,minY:u,cols:l,rows:f,top:m}}function ol(e,t,n){let o=Math.floor((t-e.minX)/e.cellM),r=Math.floor((n-e.minY)/e.cellM);return o<0||r<0||o>=e.cols||r>=e.rows?-1/0:e.top[r*e.cols+o]}function _r(e,t,n={}){let o=new Map;if(!t||!e.length)return o;let r=n.metresPerChartUnit??$,i=n.cellM??qc,s=n.chairBackM??Zc,a=n.selfRowSkipM??Qc,c=n.clearThreshold??.9,u=n.partialThreshold??.25,l=Math.max(1,n.columns??Wc),f=Math.max(1,n.rows??zc),m=nl(e,r,i,s);if(!m)return o;let h=(t.maxX-t.minX)*r,d=(t.maxY-t.minY)*r,p=h>=d,y=(t.minX+t.maxX)/2*r,g=(t.minY+t.maxY)/2*r,M=[];for(let w=0;w<l;w++){let x=(w+.5)/l-.5,b=p?y+x*h:y,S=p?g:g+x*d;for(let I=0;I<f;I++){let R=t.deckTopM+(f===1?0:I/(f-1)*$c);M.push({x:b,y:S,z:R})}}let P=i/2;for(let w of e){if(!Number.isFinite(w.eyeHeightM))continue;let x=w.x*r,b=w.y*r,S=w.eyeHeightM,I=0,R=1/0;for(let L of M){let T=L.x-x,v=L.y-b,A=Math.hypot(T,v);if(!(A>a)){I++;continue}let _=T/A,C=v/A,B=0;for(let O=a;O<A;O+=P){let F=ol(m,x+_*O,b+C*O);if(!(!Number.isFinite(F)||F>=S)&&F>S+(L.z-S)*O/A){B=O;break}}B?R=Math.min(R,B):I++}let k=I/M.length;k>=c||o.set(w.id,{seatId:w.id,mark:k<u?"obstructedView":"restrictedView",visibleFraction:k,totalRays:M.length,atDistanceM:Number.isFinite(R)?R:0})}return o}function vr(e,t){if(!t.size)return 0;let n=0;for(let o of e){let r=t.get(o.id);if(!r)continue;let i=o.commercial;i?.restrictedView!==void 0||i?.obstructedView!==void 0||(o.commercial={...i,[r.mark]:!0},n++)}return n}function oo(e){return e?e.accessibility?.length?e.wheelchairSpaceType&&!e.accessibility.includes("wheelchair")?["wheelchair",...e.accessibility]:e.accessibility:e.wheelchairSpaceType?["wheelchair"]:e.accessible?["wheelchair"]:[]:[]}var cn=Math.PI/180;var Dt=16;function ro(e,t,n,o){let r=n*cn,i=Math.cos(r),s=Math.sin(r);return{x:o.x+e*i-t*s,y:o.y+e*s+t*i}}function io(e){let{seatCount:t,seatSpacing:n,curve:o,rotation:r,origin:i}=e,s=[];if(e.path)return tr(e.path,t);if(t<=1)return t===1&&s.push({x:i.x,y:i.y}),s;if(o===0){for(let u=0;u<t;u++)s.push(ro(u*n,0,r,i));return s}let a=o/(t-1)*cn,c=n/(2*Math.sin(Math.abs(a)/2));for(let u=0;u<t;u++){let l=u*a,f=c*Math.sin(l),m=-c+c*Math.cos(l);s.push(ro(f,m,r,i))}return s}function so(e){let t=new Map;if(e.overrides)for(let n of e.overrides)t.set(n.index,n);return t}function rl(e,t){let n=so(e);return io(e).map((o,r)=>{let i=n.get(r),s=oo(i),a=mr(e,r,i),c={...e.commercial,...i?.commercial};return{index:r,x:o.x+(i?.dx??0),y:o.y+(i?.dy??0),label:a,displayLabel:Zn(e,r,t,i),categoryKey:i?.categoryKey??e.categoryKey,skipped:!!i?.skip,accessible:s.length>0,accessibility:s,wheelchairSpaceType:i?.wheelchairSpaceType,commercial:Object.values(c).some(u=>u!==void 0&&u!==!1&&u!=="")?c:void 0,glyph:i?.glyph,viewUrl:i?.viewFromSeatUrl??e.viewFromSeatUrl,viewMeta:i?.viewFromSeatUrl?i.viewFromSeatMeta:e.viewFromSeatMeta,labelStyle:i?.labelStyle??e.seatLabelStyle}})}function il(e){let t=[];for(let n of rl(e))n.skipped||t.push({id:`${e.id}:${n.index}`,label:n.label,displayLabel:n.displayLabel===n.label?void 0:n.displayLabel,x:n.x,y:n.y,rowId:e.id,categoryKey:n.categoryKey,accessible:n.accessible||void 0,accessibility:n.accessibility.length?n.accessibility:void 0,wheelchairSpaceType:n.wheelchairSpaceType,commercial:n.commercial,glyph:n.glyph,viewUrl:n.viewUrl,viewMeta:n.viewMeta,labelStyle:n.labelStyle});return t}function sl(e){if(e.seatCountsBySide)return{...e.seatCountsBySide};let t=e.sides&&e.sides.length?e.sides:["top","bottom"],n=["top","bottom","left","right"].filter(i=>t.includes(i)),o={top:0,bottom:0,left:0,right:0};if(!n.length)return o;let r=Math.max(0,Math.round(e.seatCount));for(let i=0;i<r;i++)o[n[i%n.length]]+=1;return o}function al(e){let t=[],n=Math.max(0,Math.round(e.seatCount));if(n===0)return t;let o=new Map((e.overrides??[]).map(l=>[l.index,l])),r=(l,f,m,h)=>{let d=o.get(l),p=oo(d),y=d?.label??hr(e,l);return{index:l,label:y,displayLabel:d?.displayLabel??dr(e,l),x:f+(d?.dx??0),y:m+(d?.dy??0),categoryKey:d?.categoryKey??e.categoryKey,skipped:!!d?.skip,accessible:p.length>0,accessibility:p,wheelchairSpaceType:d?.wheelchairSpaceType,commercial:d?.commercial,glyph:d?.glyph,viewUrl:d?.viewFromSeatUrl,viewMeta:d?.viewFromSeatUrl?d.viewFromSeatMeta:void 0,labelStyle:d?.labelStyle,...h?{side:h}:{}}};if(e.shape==="round"){let l=(e.radius??40)+Dt,f=e.rotation*cn,m=Math.max(0,Math.min(360,e.seatArc??360));if(m>=360||n===1){for(let y=0;y<n;y++){let g=f+y/n*2*Math.PI;t.push(r(y,e.center.x+l*Math.cos(g),e.center.y+l*Math.sin(g)))}return t}let h=m*cn,d=(2*Math.PI-h)/2,p=f+d;for(let y=0;y<n;y++){let g=p+y/(n-1)*h;t.push(r(y,e.center.x+l*Math.cos(g),e.center.y+l*Math.sin(g)))}return t}let i=e.width??80,s=e.height??50,a=sl(e),c=["top","bottom","left","right"],u=0;for(let l of c){let f=a[l];for(let m=0;m<f;m++){let h,d;l==="top"?(h=-i/2+(m+.5)*i/f,d=-s/2-Dt):l==="bottom"?(h=-i/2+(m+.5)*i/f,d=s/2+Dt):l==="left"?(h=-i/2-Dt,d=-s/2+(m+.5)*s/f):(h=i/2+Dt,d=-s/2+(m+.5)*s/f);let p=ro(h,d,e.rotation,e.center);t.push(r(u++,p.x,p.y,l))}}return t}function cl(e){return al(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 ll(e){return[{id:`${e.id}:0`,label:e.label,...e.displayLabel&&e.displayLabel!==e.label?{displayLabel:e.displayLabel}:{},x:e.center.x,y:e.center.y,rowId:e.id,categoryKey:e.categoryKey,kind:"booth",...e.commercial?.note?{commercial:{note:e.commercial.note}}:{}}]}function Wn(e,t){let n=!1;for(let o=0,r=t.length-1;o<t.length;r=o++){let i=t[o].x,s=t[o].y,a=t[r].x,c=t[r].y;s>e.y!=c>e.y&&e.x<(a-i)*(e.y-s)/(c-s)+i&&(n=!n)}return n}function lr(e,t){return t.some((n,o)=>{let r=t[(o+1)%t.length],i=(e.y-n.y)*(r.x-n.x)-(e.x-n.x)*(r.y-n.y);if(Math.abs(i)>1e-7)return!1;let s=(e.x-n.x)*(r.x-n.x)+(e.y-n.y)*(r.y-n.y),a=(r.x-n.x)**2+(r.y-n.y)**2;return s>=-1e-7&&s<=a+1e-7})}function Bt(e){return Array.isArray(e)?e.filter(t=>Array.isArray(t)&&t.length>=3):[]}function Pe(e,t,n){return Wn(e,t)&&!Bt(n).some(o=>Wn(e,o)||lr(e,o))}function an(e){if(!e.length)return{x:0,y:0};let t=0,n=0;for(let o of e)t+=o.x,n+=o.y;return{x:t/e.length,y:n/e.length}}function Lr(e){switch(e.type){case"row":{let t=io(e),n=so(e),o=0,r=0,i=0;for(let s=0;s<t.length;s++){let a=n.get(s);a?.skip||(o+=t[s].x+(a?.dx??0),r+=t[s].y+(a?.dy??0),i++)}return i?{x:o/i,y:r/i}:{x:e.origin.x,y:e.origin.y}}case"table":case"booth":return{x:e.center.x,y:e.center.y};case"gaArea":return an(e.points);case"section":return an(e.outline);case"text":return{x:e.position.x,y:e.position.y};case"shape":return e.points&&e.points.length?an(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 kr(e,t){return e.length===t.length&&e.every((n,o)=>n.x===t[o].x&&n.y===t[o].y)}function ul(e,t){if(e.type!=="gaArea"||!kr(e.points,t.outline))return!1;let n=Bt(e.holes),o=Bt(t.holes);return n.length===o.length&&n.every((r,i)=>kr(r,o[i]))}function fl(e,t,n=e.filter(r=>r.type==="section"),o=Lr(t)){let r="referenceInventorySource"in t?t.referenceInventorySource?.logicalSectionId:void 0;return(r?n.find(s=>(s.logicalSectionId??s.id)===r&&(ul(t,s)||Pe(o,s.outline,s.holes))):void 0)??n.find(s=>Pe(o,s.outline,s.holes))??(t.type==="row"&&ml(t)?hl(t,n):void 0)}function ml(e){return(e.overrides??[]).some(t=>t.skip===!0)}function hl(e,t){let n=io(e),o=so(e),r,i=0;for(let s of t){let a=0;for(let c=0;c<n.length;c++){let u=o.get(c);if(u?.skip)continue;let l={x:n[c].x+(u?.dx??0),y:n[c].y+(u?.dy??0)};Pe(l,s.outline,s.holes)&&a++}a>i&&(r=s,i=a)}return r}function Cr(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 Or(e,t,n,o,r,i,s,a,c){let u=[],l=e.filter(p=>p.type==="section"),f=ur(e),m=p=>!p?.eventConfigurationId||p.eventConfigurationId===o&&(p.eventConfigurationVersion===void 0||p.eventConfigurationVersion===c),h=p=>gr(p,{activeConfigurationId:o,activeConfigurationVersion:c,activeBasisSha256:r,now:a}),d=(p,y)=>h(p)?{...p,coverage:y}:void 0;for(let p of e){let y=[];if(p.type==="row"?y=il(p):p.type==="table"?y=cl(p):p.type==="booth"&&(y=ll(p)),!y.length)continue;for(let x of y)x.viewUrl&&!m(x.viewMeta)&&(x.viewUrl=void 0,x.viewMeta=void 0);if(p.type==="row"){let x=f.get(p.id);if(x){let b=new Map((p.overrides??[]).map(S=>[S.index,S]));for(let S of y){let I=Number(S.id.slice(S.id.lastIndexOf(":")+1));if(!Number.isInteger(I))continue;S.logicalRowId=x.groupId,S.logicalSeatIndex=x.adjacencyOffset+I,b.get(I)?.displayLabel||(S.displayLabel=Zn(p,I,x)),!S.viewUrl&&x.viewFromSeatUrl&&m(x.viewFromSeatMeta)&&(S.viewUrl=x.viewFromSeatUrl,S.viewMeta=x.viewFromSeatMeta);let R=b.get(I)?.confidenceEvidence;S.confidenceEvidence=d(R,"exact-seat")??d(p.confidenceEvidence,"row-representative")??d(x.confidenceEvidence,"row-representative")}}}let g=fl(e,p,l,p.type==="row"?an(y):Lr(p)),M=g?.viewFromSeatUrl,w=(g?.zone?t?.find(x=>x.id===g.zone):void 0)?.focalPoint??n;for(let x of y){if(!x.confidenceEvidence){let b=Number(x.id.slice(x.id.lastIndexOf(":")+1)),S=(p.type==="row"||p.type==="table")&&Number.isInteger(b)?p.overrides?.find(I=>I.index===b)?.confidenceEvidence:void 0;x.confidenceEvidence=d(S,"exact-seat")??(p.type==="row"?d(p.confidenceEvidence,"row-representative"):void 0)}x.confidenceEvidence??=d(g?.confidenceEvidence,"section-representative")??(s?d(s.evidence,s.coverage):void 0),!x.viewUrl&&M&&m(g?.viewFromSeatMeta)&&(x.viewUrl=M,x.viewMeta=g?.viewFromSeatMeta),!x.viewUrl&&i&&m(i.meta)&&(x.viewUrl=i.url,x.viewMeta=i.meta),g&&(x.sectionId=g.logicalSectionId??g.id),g?.zone&&(x.zoneId=g.zone),w&&(x.focalPoint={...w})}u.push(...y)}return u}function gt(e,t={}){if(e.floors?.length){let o=[];for(let r of e.floors){let i=r.focalPoint??e.focalPoint,s=r.viewFromSeatUrl?{url:r.viewFromSeatUrl,meta:r.viewFromSeatMeta}:e.viewFromSeatUrl?{url:e.viewFromSeatUrl,meta:e.viewFromSeatMeta}:void 0,a=r.confidenceEvidence?{evidence:r.confidenceEvidence,coverage:"floor-representative"}:e.confidenceEvidence?{evidence:e.confidenceEvidence,coverage:"venue-representative"}:void 0,c=Or(r.objects,e.zones,i,e.eventConfigurationId,e.confidenceBasisSha256,s,a,t.now,t.eventConfigurationVersion??e.eventConfigurationVersion);t.resolveEyeHeights!==!1&&Tr(r.objects,r.focalPoint??e.focalPoint,r.baseHeightM??0,c);for(let u of c)u.floorId=r.id;for(let u of c)o.push(u)}return o}let n=Or(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&&Tr(e.objects,e.focalPoint,t.floorBaseHeightM??0,n),dl(e,n,t)}function dl(e,t,n){return!n.deriveRestrictedView||e.derivedRestrictedView===!1||n.resolveEyeHeights===!1||vr(t,_r(t,Ar(e))),t}function Tr(e,t,n,o){let r=e.filter(f=>f.type==="section"),i=n>0||r.some(f=>f.height!==void 0||f.rake!==void 0||(f.elevation??0)>0);if(!r.length||!i||!t){for(let f of o)f.eyeHeightM=n+je;return}let s=new Array(o.length),a=new Map;for(let f of r)a.has(f.id)||a.set(f.id,f);let c=new Map,u=new Map;for(let f=0;f<o.length;f++){let m=o[f],d=(m.sectionId?a.get(m.sectionId)??r.find(y=>y.logicalSectionId===m.sectionId&&Pe({x:m.x,y:m.y},y.outline,y.holes)):void 0)??r.find(y=>Pe({x:m.x,y:m.y},y.outline,y.holes))??null;if(s[f]=d,!d)continue;c.has(d.id)||c.set(d.id,Qe(d,{floorBaseHeightM:n}));let p=u.get(d.id);p?p.push(f):u.set(d.id,[f])}let l=new Array(o.length).fill(void 0);for(let[f,m]of u){let h=c.get(f);if(!h)continue;let d=h.rake>0?Math.tan(h.rake*Math.PI/180):0,p=nn(f,o,m,t);for(let y of p.rows){let g=y.blockDepth*$*d,M=h.height+g;for(let P of y.seatIndices)l[P]=M}}for(let f=0;f<o.length;f++){let m=o[f],h=s[f];if(!h){m.eyeHeightM=n+je;continue}let d=c.get(h.id);m.eyeHeightM=(l[f]??d.height)+je}}var Fr=Ge(require("earcut"),1),ao=Ge(require("polygon-clipping"),1);function Ae(e){let t=0;for(let n=0,o=e.length;n<o;n+=1){let r=e[n],i=e[(n+1)%o];t+=r.x*i.y-i.x*r.y}return t/2}function _e(e,t,n){let o=!1;for(let r=0,i=e.length-1;r<e.length;i=r++){let s=e[r],a=e[i];s.y>n!=a.y>n&&t<(a.x-s.x)*(n-s.y)/(a.y-s.y)+s.x&&(o=!o)}return o}var E=$,pl=.002;function bl(e,t,n){let o=Math.hypot(t[0]-e[0],t[1]-e[1],t[2]-e[2]),r=Math.hypot(n[0]-t[0],n[1]-t[1],n[2]-t[2]),i=Math.hypot(e[0]-n[0],e[1]-n[1],e[2]-n[2]),s=Math.max(o,r,i);if(s<1e-9)return!0;let a=(o+r+i)/2;return 2*Math.sqrt(Math.max(0,a*(a-o)*(a-r)*(a-i)))/s<pl}var ct=class{constructor(t=16384){this.len=0;this.buf=new Float32Array(t)}push3(t,n,o){this.len+3>this.buf.length&&this.grow(this.len+3),this.buf[this.len++]=t,this.buf[this.len++]=n,this.buf[this.len++]=o}push1(t){this.len+1>this.buf.length&&this.grow(this.len+1),this.buf[this.len++]=t}grow(t){let n=this.buf.length*2;for(;n<t;)n*=2;let o=new Float32Array(n);o.set(this.buf.subarray(0,this.len)),this.buf=o}get length(){return this.len}toArray(){return this.buf.slice(0,this.len)}},fn=class{constructor(){this.pos=new ct;this.nor=new ct;this.col=new ct;this.flr=new ct;this.mat=new ct;this.currentFloor=0;this.currentMaterial=0}setFloor(t){this.currentFloor=t}setMaterial(t){this.currentMaterial=t}tri(t,n,o,r,i,s=i,a=i){bl(t,n,o)||(this.pos.push3(t[0],t[1],t[2]),this.pos.push3(n[0],n[1],n[2]),this.pos.push3(o[0],o[1],o[2]),this.nor.push3(r[0],r[1],r[2]),this.nor.push3(r[0],r[1],r[2]),this.nor.push3(r[0],r[1],r[2]),this.col.push3(i[0],i[1],i[2]),this.col.push3(s[0],s[1],s[2]),this.col.push3(a[0],a[1],a[2]),this.flr.push1(this.currentFloor),this.flr.push1(this.currentFloor),this.flr.push1(this.currentFloor),this.mat.push1(this.currentMaterial),this.mat.push1(this.currentMaterial),this.mat.push1(this.currentMaterial))}triN(t,n,o,r,i,s,a,c=a,u=a){[...t,...n,...o].every(Number.isFinite)&&(this.pos.push3(t[0],t[1],t[2]),this.pos.push3(n[0],n[1],n[2]),this.pos.push3(o[0],o[1],o[2]),this.nor.push3(r[0],r[1],r[2]),this.nor.push3(i[0],i[1],i[2]),this.nor.push3(s[0],s[1],s[2]),this.col.push3(a[0],a[1],a[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 yl(e,t,n){let o=t[0]-e[0],r=t[1]-e[1],i=t[2]-e[2],s=n[0]-e[0],a=n[1]-e[1],c=n[2]-e[2],u=r*c-i*a,l=i*s-o*c,f=o*a-r*s,m=Math.hypot(u,l,f)||1;return u/=m,l/=m,f/=m,[u,l,f]}function gl(e,t){let n=[...e],o=[];for(let s of e)o.push(s.x,s.y);let r=[];if(t){for(let s of t)if(!(s.length<3)){r.push(n.length);for(let a of s)n.push(a),o.push(a.x,a.y)}}let i=(0,Fr.default)(o,r.length?r:void 0,2);return{pts:n,tris:i}}function He(e){return Ae(e)<0?[...e].reverse():e}var xl=3;function Ml(e,t,n,o){let r=o(e),i=o(t),s=o(n),a=(h,d,p,y)=>Math.abs(o({x:(h.x+d.x)/2,y:(h.y+d.y)/2})-(p+y)/2),c=(e.x+t.x+n.x)/3,u=(e.y+t.y+n.y)/3,l=(r+i+s)/3,f=Math.max(a(e,t,r,i),a(t,n,i,s),a(n,e,s,r),Math.abs(o({x:c,y:u})-l)),m=(h,d,p)=>{let y=Math.abs(o({x:(h+c)/2,y:(d+u)/2})-(p+l)/2);y>f&&(f=y)};return m((e.x+t.x)/2,(e.y+t.y)/2,(r+i)/2),m((t.x+n.x)/2,(t.y+n.y)/2,(i+s)/2),m((n.x+e.x)/2,(n.y+e.y)/2,(s+r)/2),f}function Gt(e,t,n,o,r){if(r<=0)return Ml(e,t,n,o);let i={x:(e.x+t.x)/2,y:(e.y+t.y)/2},s={x:(t.x+n.x)/2,y:(t.y+n.y)/2},a={x:(n.x+e.x)/2,y:(n.y+e.y)/2};return Math.max(Gt(e,i,a,o,r-1),Gt(i,t,s,o,r-1),Gt(a,s,n,o,r-1),Gt(i,s,a,o,r-1))}function jt(e,t,n,o,r,i,s,a){if(s>0){let m={x:(t.x+n.x)/2,y:(t.y+n.y)/2},h={x:(n.x+o.x)/2,y:(n.y+o.y)/2},d={x:(o.x+t.x)/2,y:(o.y+t.y)/2};jt(e,t,m,d,r,i,s-1,a),jt(e,m,n,h,r,i,s-1,a),jt(e,d,h,o,r,i,s-1,a),jt(e,m,h,d,r,i,s-1,a);return}let c=[t.x*E,r(t),t.y*E],u=[n.x*E,r(n),n.y*E],l=[o.x*E,r(o),o.y*E];if(a){e.triN(c,u,l,a(t),a(n),a(o),i);return}let f=yl(c,u,l);f[1]<0&&(f=[-f[0],-f[1],-f[2]]),e.tri(c,u,l,f,i)}var Sl=8;function Br(e,t,n){if(!Number.isFinite(n))return e;let o=[],r=(i,s,a,c,u)=>{if(u>0){let l={x:(i.x+s.x)/2,y:(i.y+s.y)/2},f=t(l);if(Math.abs(f-(a+c)/2)>n){r(i,l,a,f,u-1),r(l,s,f,c,u-1);return}}o.push(i)};for(let i=0;i<e.length;i++){let s=e[i],a=e[(i+1)%e.length];r(s,a,t(s),t(a),Sl)}return o}function ln(e,t){if(e.length<3)return e;let n=[];for(let r of e){let i=n[n.length-1];i&&Math.hypot(r.x-i.x,r.y-i.y)<t||n.push(r)}for(;n.length>2&&Math.hypot(n[0].x-n[n.length-1].x,n[0].y-n[n.length-1].y)<t;)n.pop();if(n.length<3)return e;let o=[];for(let r=0;r<n.length;r++){let i=o.length?o[o.length-1]:n[(r-1+n.length)%n.length],s=n[r],a=n[(r+1)%n.length],c=a.x-i.x,u=a.y-i.y,l=Math.hypot(c,u);l>t&&Math.abs((s.x-i.x)*u-(s.y-i.y)*c)/l<t||o.push(s)}return o.length>=3?o:n}var un=.001*Oe*.1;function z(e,t,n,o,r,i,s,a,c=1/0,u){if(!t||t.length<3||(c===void 0&&(c=1/0),Math.abs(Ae(t))<1e-4))return;let l=ln(Br(ln(He(t),un),o,c),un),f=n?.map(b=>ln(Br(ln(He(b),un),o,c),un)).filter(b=>b.length>=3&&Math.abs(Ae(b))>=1e-4),{pts:m,tris:h}=gl(l,f),d=[i[0]*a.top,i[1]*a.top,i[2]*a.top],p=[i[0]*a.bottomCap,i[1]*a.bottomCap,i[2]*a.bottomCap],y=[s[0]*a.top,s[1]*a.top,s[2]*a.top],g=[s[0]*a.wallBottom,s[1]*a.wallBottom,s[2]*a.wallBottom],M=0;if(Number.isFinite(c))for(;M<xl;M++){let b=0;for(let S=0;S<h.length;S+=3){let I=Gt(m[h[S]],m[h[S+1]],m[h[S+2]],o,M);I>b&&(b=I)}if(b<=c)break}for(let b=0;b<h.length;b+=3){let S=m[h[b]],I=m[h[b+1]],R=m[h[b+2]];jt(e,S,I,R,o,d,M,u);let k=[S.x*E,r,S.y*E],L=[I.x*E,r,I.y*E],T=[R.x*E,r,R.y*E];e.tri(k,T,L,[0,-1,0],p)}let P=b=>{if(M<=0)return b;let S=1<<M,I=[];for(let R=0;R<b.length;R++){let k=b[R],L=b[(R+1)%b.length];for(let T=0;T<S;T++){let v=T/S;I.push({x:k.x+(L.x-k.x)*v,y:k.y+(L.y-k.y)*v})}}return I},w=Xn(l),x=[{ring:P(l),flip:!1}];if(f)for(let b of f)b.length>=3&&x.push({ring:P(b),flip:!0});for(let{ring:b,flip:S}of x)for(let I=0;I<b.length;I++){let R=b[I],k=b[(I+1)%b.length],L=(k.x-R.x)*E,v=(k.y-R.y)*E,A=-L,_=Math.hypot(v,A)||1;v/=_,A/=_;let C=(R.x+k.x)/2-w.x,B=(R.y+k.y)/2-w.y,O=v*C+A*B;S&&(O=-O),O<0&&(v=-v,A=-A);let F=[v,0,A],D=[R.x*E,o(R),R.y*E],j=[k.x*E,o(k),k.y*E],N=[R.x*E,r,R.y*E],X=[k.x*E,r,k.y*E];e.tri(D,j,X,F,y,y,g),e.tri(D,X,N,F,y,g,g)}}function Nr(e){let t=0;for(let c of e)t+=c.count;let n=new Float32Array(t*3),o=new Float32Array(t*3),r=new Float32Array(t*3),i=new Float32Array(t),s=new Float32Array(t),a=0;for(let c of e)n.set(c.position,a*3),o.set(c.normal,a*3),r.set(c.color,a*3),i.set(c.floor,a),s.set(c.material,a),a+=c.count;return{position:n,normal:o,color:r,floor:i,material:s,count:t}}function Le(e,t,n=2.5){if(t<=0||e.length<3)return e;let o=He(e),r=o.length,i=[];for(let a=0;a<r;a++){let c=o[a],u=o[(a+1)%r],l=u.x-c.x,f=u.y-c.y,m=Math.hypot(l,f)||1;i.push({x:f/m,y:-l/m})}let s=[];for(let a=0;a<r;a++){let c=o[a],u=i[(a-1+r)%r],l=i[a],f=u.x+l.x,m=u.y+l.y,h=Math.hypot(f,m),d=()=>{s.push([c.x+u.x*t,c.y+u.y*t]),s.push([c.x+l.x*t,c.y+l.y*t])};if(h<1e-9){d();continue}f/=h,m/=h;let p=f*u.x+m*u.y,y=1/Math.max(p,1e-6);if(!Number.isFinite(y)||y>n){d();continue}s.push([c.x+f*t*y,c.y+m*t*y])}if(s.length<3)return e;try{let a=ao.default.union([[...s,s[0]]]),c=null,u=-1/0;for(let f of a){let m=Math.abs(Ae(f[0].map(([h,d])=>({x:h,y:d}))));m>u&&(u=m,c=f[0])}if(!c)return e;let l=c.map(([f,m])=>({x:f,y:m}));if(l.length>1){let f=l[0],m=l[l.length-1];Math.abs(f.x-m.x)<1e-9&&Math.abs(f.y-m.y)<1e-9&&l.pop()}return l.length>=3?l:e}catch{return e}}function Je(e,t,n=2.5){if(e.length<3)return[];if(t<=0)return e;let o=He(e),r=o.length,i=[];for(let c=0;c<r;c++){let u=o[c],l=o[(c+1)%r],f=Math.hypot(l.x-u.x,l.y-u.y)||1;i.push({x:-(l.y-u.y)/f,y:(l.x-u.x)/f})}let s=[],a=[];for(let c=0;c<r;c++){let u=o[c],l=i[(c-1+r)%r],f=i[c],m=l.x+f.x,h=l.y+f.y,d=Math.hypot(m,h),p=d<1e-9?1/0:1/Math.max(m/d*l.x+h/d*l.y,1e-6);if(!Number.isFinite(p)||p>n){s.push({x:u.x+l.x*t,y:u.y+l.y*t},{x:u.x+f.x*t,y:u.y+f.y*t}),a.push(c,c);continue}m/=d,h/=d,s.push({x:u.x+m*t*p,y:u.y+h*t*p}),a.push(c)}for(let c=0;c<s.length;c++){let u=(c+1)%s.length,l=a[c],f=a[u];if(f!==(l+1)%r)continue;let m=o[l],h=o[f];if((s[u].x-s[c].x)*(h.x-m.x)+(s[u].y-s[c].y)*(h.y-m.y)<=0)return[]}try{let c=ao.default.intersection([[...s.map(d=>[d.x,d.y]),[s[0].x,s[0].y]]],[[...o.map(d=>[d.x,d.y]),[o[0].x,o[0].y]]]),u=null,l=0;for(let d of c){let p=Math.abs(Ae(d[0].map(([y,g])=>({x:y,y:g}))));p>l&&(l=p,u=d[0])}if(!u)return[];let f=u.map(([d,p])=>({x:d,y:p})),m=f[0],h=f[f.length-1];return f.length>1&&Math.abs(m.x-h.x)<1e-9&&Math.abs(m.y-h.y)<1e-9&&f.pop(),f.length>=3?He(f):[]}catch{return[]}}function mn(e,t,n,o,r=28){let i=[];for(let s=0;s<r;s++){let a=s/r*Math.PI*2;i.push({x:e+n*Math.cos(a),y:t+o*Math.sin(a)})}return i}function Ht(e,t,n,o){return[{x:e,y:t},{x:e+n,y:t},{x:e+n,y:t+o},{x:e,y:t+o}]}var Vt=3,lt=.38,Ut=.24;function Pl(e){if(e.length<3)return null;let t=e[0],n=e[Math.floor(e.length/2)],o=e[e.length-1],r=(n.x-t.x)*E,i=(n.y-t.y)*E,s=(o.x-t.x)*E,a=(o.y-t.y)*E,c=2*(r*a-i*s);if(Math.abs(c)<1e-7)return null;let u=r*r+i*i,l=s*s+a*a,f=(u*a-l*i)/c+t.x*E,m=(r*l-s*u)/c+t.y*E,h=Math.hypot(t.x*E-f,t.y*E-m);return h<1||h>200||!Number.isFinite(h)||e.some(d=>Math.abs(Math.hypot(d.x*E-f,d.y*E-m)-h)>.03)?null:{x:f,z:m,radius:h}}function Dr(e){let t=[],n=new Map,o=(c,u)=>`${Math.floor(c/Vt)},${Math.floor(u/Vt)}`;for(let c of e)for(let u of c.rows){for(let f of u.pts){let m=f.x*E,h=f.y*E,d=o(m,h),p=n.get(d)??[];p.push({x:m,z:h,y:u.y,floor:c.floorIndex}),n.set(d,p)}if(u.patch||u.pts.length<2)continue;let l=Pl(u.pts);for(let f of[0,u.pts.length-1]){let m=u.pts[f],h=u.pts[f===0?1:f-1],d=m.x-h.x,p=m.y-h.y,y=Math.hypot(d,p);y<1e-6||t.push({sectionId:c.sectionId,floorIndex:c.floorIndex,curve:l,row:u,point:m,x:m.x*E,z:m.y*E,dx:d/y,dz:p/y})}}let r=new Map;t.forEach((c,u)=>{let l=o(c.x,c.z),f=r.get(l)??[];f.push(u),r.set(l,f)});let i=(c,u)=>{let l=Math.floor(c/Vt),f=Math.floor(u/Vt);return[-1,0,1].flatMap(m=>[-1,0,1].map(h=>`${l+m},${f+h}`))},s=new Map;t.forEach((c,u)=>{let l=-1,f=1/0,m=!1;for(let h of i(c.x,c.z))for(let d of r.get(h)??[]){let p=t[d];if(c.sectionId===p.sectionId&&c.row.blockId===p.row.blockId||c.floorIndex!==p.floorIndex||Math.abs(c.row.y-p.row.y)>.05)continue;let y=p.x-c.x,g=p.z-c.z,M=Math.hypot(y,g);if(M<lt*2+.45||M>Vt)continue;let P=c.curve&&p.curve&&Math.hypot(c.curve.x-p.curve.x,c.curve.z-p.curve.z)<=.05&&Math.abs(c.curve.radius-p.curve.radius)<=.05,w=Math.min((y*c.dx+g*c.dz)/M,(-y*p.dx-g*p.dz)/M);(P?w<.8:w<.98)||!P&&(Math.abs(y*c.dz-g*c.dx)>.15||Math.abs(y*p.dz-g*p.dx)>.15)||(M<f-.02?(l=d,f=M,m=!1):Math.abs(M-f)<=.02&&(m=!0))}l>=0&&!m&&s.set(u,l)});let a=[];for(let[c,u]of s){if(c>=u||s.get(u)!==c)continue;let l=t[c],f=t[u],m=Math.hypot(f.x-l.x,f.z-l.z),h=(f.x-l.x)/m,d=(f.z-l.z)/m,p=!1;for(let g of i((l.x+f.x)/2,(l.z+f.z)/2))for(let M of n.get(g)??[]){if(M.floor!==l.floorIndex||Math.abs(M.y-l.row.y)>.75)continue;let P=(M.x-l.x)*h+(M.z-l.z)*d,w=Math.abs((M.x-l.x)*d-(M.z-l.z)*h);P>.01&&P<m-.01&&w<Ut+lt&&(p=!0)}if(p)continue;let y=(g,M)=>({x:(l.x+h*g-d*M)/E,y:(l.z+d*g+h*M)/E});a.push({sections:[l.sectionId,f.sectionId],blocks:[l.row.blockId,f.row.blockId],floorIndex:l.floorIndex,ends:[l.point,f.point],clearWidthM:m-2*lt,heightM:(l.row.y+f.row.y)/2,outline:[y(lt,-Ut),y(m-lt,-Ut),y(m-lt,Ut),y(lt,Ut)]})}return a}var Il=/^#?([\da-f]{3}|[\da-f]{6})$/i;function Gr(e){let t=e.replace("#","");return{r:parseInt(t.slice(0,2),16),g:parseInt(t.slice(2,4),16),b:parseInt(t.slice(4,6),16)}}function Rl(e){let t=Il.exec((e??"").trim());if(!t)return null;let n=t[1].length===3?t[1].split("").map(r=>r+r).join(""):t[1],o=parseInt(n,16);return[o>>16&255,o>>8&255,o&255]}function oe(e){let t=Rl(e);return t?[t[0]/255,t[1]/255,t[2]/255]:null}function wl(e){return .2126*e[0]+.7152*e[1]+.0722*e[2]}function re(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 Ve(e,t){let n=wl(e);return re(e,[n,n,n],t)}function jr({r:e,g:t,b:n}){let o=e/255,r=t/255,i=n/255,s=Math.max(o,r,i),a=Math.min(o,r,i),c=(s+a)/2;if(s===a)return{h:0,s:0,l:c};let u=s-a,l=c>.5?u/(2-s-a):u/(s+a),f;return s===o?f=((r-i)/u+(r<i?6:0))/6:s===r?f=((i-o)/u+2)/6:f=((o-r)/u+4)/6,{h:f,s:l,l:c}}var co=e=>e<=.04045?e/12.92:((e+.055)/1.055)**2.4,lo=e=>e<=.0031308?12.92*e:1.055*Math.max(0,e)**.4166666666666667-.055,uo=e=>Math.min(1,Math.max(0,e));function mo(e){let t=co(e[0]),n=co(e[1]),o=co(e[2]),r=Math.cbrt(.4122214708*t+.5363325363*n+.0514459929*o),i=Math.cbrt(.2119034982*t+.6806995451*n+.1073969566*o),s=Math.cbrt(.0883024619*t+.2817188376*n+.6299787005*o);return[.2104542553*r+.793617785*i-.0040720468*s,1.9779984951*r-2.428592205*i+.4505937099*s,.0259040371*r+.7827717662*i-.808675766*s]}function fo([e,t,n]){let o=(e+.3963377774*t+.2158037573*n)**3,r=(e-.1055613458*t-.0638541728*n)**3,i=(e-.0894841775*t-1.291485548*n)**3;return[uo(lo(4.0767416621*o-3.3077115913*r+.2309699292*i)),uo(lo(-1.2684380046*o+2.6097574011*r-.3413193965*i)),uo(lo(-.0041960863*o-.7034186147*r+1.707614701*i))]}var hn=e=>mo(e)[0];function Xt(e){let[,t,n]=mo(e);return Math.hypot(t,n)}function ut(e,t,n){let[,o,r]=mo(e);if(n===void 0)return fo([t,o,r]);let i=Math.hypot(o,r),s=i===0?0:n/i;return fo([t,o*s,r*s])}function dn(e){return fo([e,-.004,-.008])}var pn=["available","held","sold","selected","dimmed"];function Vr(e){let t=pn.indexOf(e);return t<0?0:t}var Ur={available:[.24,.82,.52],held:[.34,.39,.45],sold:[.34,.39,.45],selected:[.24,.74,1],dimmed:[.28,.32,.37]};var Hr={day:{ground:.9,deck:.84,fascia:.77,shell:.79,seatMin:.45,seatMax:.58,unavailable:.58,dimmed:.62,sectionDeck:.66,sectionDeckChromaShare:.8,sectionDeckChromaCap:.11,stageTop:.52,stageWall:.42},night:{ground:.26,deck:.34,fascia:.28,shell:.32,seatMin:.64,seatMax:.8,unavailable:.42,dimmed:.39,sectionDeck:.34,sectionDeckChromaShare:.45,sectionDeckChromaCap:.05,stageTop:0,stageWall:0}},bn=.012;function yn(e){return hn(e.tierTop)>.6}function xt(e){return e?Hr.day:Hr.night}var ho={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]},po={top:[.05,.06,.08],bottom:[.1,.12,.15]};function W(e,t){return[Math.min(1,e[0]*t),Math.min(1,e[1]*t),Math.min(1,e[2]*t)]}var El=.15,Al=1.6;function Xr(e){return Kn(e??1,El,Al)}var _l=.15,vl=.9,Cl=1.76;function Kr(e){return bo(e)?{zenith:[.36,.58,.84],horizon:[.82,.88,.94]}:{zenith:[.05,.08,.15],horizon:[.3,.38,.5]}}function bo(e){return!!e&&e[0]*.2126+e[1]*.7152+e[2]*.0722>.55}function kl(){return{background:{top:[...po.top],bottom:[...po.bottom]},sky:Kr(null),structure:ho,seatStates:{...Ur},seatScale:1,materials:{seat:null,shell:null,roughness:.78}}}function Ol(e){return bo(e)?{deck:"#c9ccc8",fascia:"#b4bab8",shell:"#c3c9c8",roughness:.87}:{deck:"#69747b",fascia:"#3e4d58",shell:"#526572",roughness:.87}}function Yr(e){let t=kl();e??={};let n=oe(e.background);if(n){t.background={top:W(n,vl),bottom:W(n,Cl)},t.sky=Kr(n);let a={};for(let[u,l]of Object.entries(ho))a[u]=re(l,n,_l);n[0]*.2126+n[1]*.7152+n[2]*.0722>.55&&(a.ground=W(n,.86)),t.structure=a}let o=oe(e.selectionColor)??oe(e.accent);o&&(t.seatStates={...t.seatStates,selected:o});let r=e.seatScale;typeof r=="number"&&Number.isFinite(r)&&(t.seatScale=Xr(r));let i=Object.fromEntries(Object.entries(e.venue3d??{}).filter(([,a])=>a!=null)),s={...Ol(n),...i};if(s){let a=oe(s.deck),c=oe(s.fascia);a&&(t.structure={...t.structure,tierTop:a,gaTop:a}),c&&(t.structure={...t.structure,tierWall:c,gaWall:c}),t.materials.seat=oe(s.seat),t.materials.shell=oe(s.shell),typeof s.roughness=="number"&&Number.isFinite(s.roughness)&&(t.materials.roughness=Math.min(1,Math.max(0,s.roughness)))}return Tl(t,bo(n)),t}function Tl(e,t){let n=xt(t);e.seatStates={...e.seatStates,held:dn(n.unavailable),sold:dn(n.unavailable),dimmed:dn(n.dimmed)};let o=(i,s)=>ut(i,s,Math.min(Xt(i),bn)),r=e.structure;e.structure={...r,ground:o(r.ground,n.ground),tierTop:o(r.tierTop,n.deck),tierWall:o(r.tierWall,n.fascia)},e.materials.shell&&(e.materials.shell=o(e.materials.shell,n.shell))}function Wr(e,t){let n=[];for(let o of t)n.push(...e.seatStates[o]);return n}function zr(e){let t=1/0,n=1/0,o=-1/0,r=-1/0,i=!1;for(let s of e)!Number.isFinite(s.x)||!Number.isFinite(s.y)||(i=!0,s.x<t&&(t=s.x),s.y<n&&(n=s.y),s.x>o&&(o=s.x),s.y>r&&(r=s.y));return i?{minX:t,minY:n,maxX:o,maxY:r}:null}function Mt(e,t){return e.minX<=t.maxX&&t.minX<=e.maxX&&e.minY<=t.maxY&&t.minY<=e.maxY}var yo=[{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"}],pp=new Map(yo.map(e=>[e.key,e]));var Ll={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 gn(e){let t=e?.[0];return t&&Ll[t]||"#3b82f6"}var Bl=[{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"}],bp=new Map(Bl.map(e=>[e.key,e]));var Fl=["reference-focal","bar","entrance","exit","restroom","screen","sound","concession","coat","wall","rail","suite","obstruction"],yp=new Set(Fl);var xn=["#e69f00","#56b4e9","#009e73","#f0e442","#0072b2","#d55e00","#cc79a7"],Zr="#a4508b";var Ip={facilities:Zr,"food-drink":xn[5],navigation:xn[2],accessibility:xn[4]};var Rp={minDiameterPx:12,glyphScale:.66,ringRatio:1/14,largeFromPx:24};var de=e=>{let t=Math.round(e*100)/100;return Object.is(t,-0)?"0":String(t)},Rt=e=>`${de(e[0])} ${de(e[1])}`,It=(e,t,n,o)=>[e+n*Math.cos(o*Math.PI/180),t+n*Math.sin(o*Math.PI/180)];function ci(e){let t=`M${Rt(e.from)}`;for(let n of e.segs)t+=n.arc?`A${de(n.arc.r)} ${de(n.arc.r)} 0 ${n.arc.large} ${n.arc.sweep} ${Rt(n.to)}`:`L${Rt(n.to)}`;return`${t}Z`}function pe(e){let t=[e.from,...e.segs.map(o=>o.to)],n=[];for(let o=e.segs.length-1;o>=0;o--){let r=e.segs[o].arc;n.push({to:t[o],arc:r&&{...r,sweep:r.sweep?0:1}})}return{from:t[t.length-1],segs:n}}function be(e,t,n){let o={r:n,large:0,sweep:1};return{from:[e-n,t],segs:[{to:[e+n,t],arc:o},{to:[e-n,t],arc:o}]}}function q(e,t,n,o,r){let i=Math.min(r,n/2,o/2),s={r:i,large:0,sweep:1};return i<=0?ge([[e,t],[e+n,t],[e+n,t+o],[e,t+o]]):{from:[e+i,t],segs:[{to:[e+n-i,t]},{to:[e+n,t+i],arc:s},{to:[e+n,t+o-i]},{to:[e+n-i,t+o],arc:s},{to:[e+i,t+o]},{to:[e,t+o-i],arc:s},{to:[e,t+i]},{to:[e+i,t],arc:s}]}}function ge(e){let t=0;for(let o=0;o<e.length;o++){let[r,i]=e[o],[s,a]=e[(o+1)%e.length];t+=r*a-s*i}let n=t>0?e:[...e].reverse();return{from:n[0],segs:[...n.slice(1).map(o=>({to:o})),{to:n[0]}]}}function le(e,t,n){let o=n/2,r=t[0]-e[0],i=t[1]-e[1],s=Math.hypot(r,i);if(s<1e-6)return be(e[0],e[1],o);let a=[i/s*o,-r/s*o],c={r:o,large:0,sweep:1},u=[e[0]+a[0],e[1]+a[1]];return{from:u,segs:[{to:[t[0]+a[0],t[1]+a[1]]},{to:[t[0]-a[0],t[1]-a[1]],arc:c},{to:[e[0]-a[0],e[1]-a[1]]},{to:u,arc:c}]}}function ye(e,t,n=!1){let o=[],r=n?e.length:e.length-1;for(let i=0;i<r;i++)o.push(le(e[i],e[(i+1)%e.length],t));return o}function Be(e,t,n,o,r,i){let s=i/2,a=r-o>180?1:0,c={r:s,large:0,sweep:1},u=It(e,t,n+s,o);return{from:u,segs:[{to:It(e,t,n+s,r),arc:{r:n+s,large:a,sweep:1}},{to:It(e,t,n-s,r),arc:c},{to:It(e,t,n-s,o),arc:{r:n-s,large:a,sweep:0}},{to:u,arc:c}]}}var ee=(...e)=>e.flat().map(ci).join(" "),Ee=(e,t,n)=>`M${de(e-n)} ${de(t)}a${de(n)} ${de(n)} 0 1 0 ${de(2*n)} 0a${de(n)} ${de(n)} 0 1 0 ${de(-2*n)} 0`,Ue=(e,t,n,o,r)=>ci(q(e,t,n,o,r)),Sn=e=>`M${e.map(Rt).join("L")}`,Mn=(e,t,n,o,r)=>`M${Rt(It(e,t,n,o))}A${de(n)} ${de(n)} 0 ${r-o>180?1:0} 1 ${Rt(It(e,t,n,r))}`;function St(e,t,n,o=1){let r=i=>[i[0]*o+t,i[1]*o+n];return{head:[e.head[0]*o+t,e.head[1]*o+n,e.head[2]*o],limbs:e.limbs.map(i=>i.map(r)),arcs:e.arcs?.map(([i,s,a,c,u])=>[i*o+t,s*o+n,a*o,c,u])}}function Kt(e){return[Ee(e.head[0],e.head[1],e.head[2]),...e.limbs.map(Sn),...(e.arcs??[]).map(([t,n,o,r,i])=>Mn(t,n,o,r,i))].join(" ")}function Pt(e,t=2.6){return[be(e.head[0],e.head[1],e.head[2]+1),...e.limbs.flatMap(n=>ye(n,t)),...(e.arcs??[]).map(([n,o,r,i,s])=>Be(n,o,r,i,s,t-.2))]}var ft={head:[10,4,2],limbs:[[[10,8.2],[10,14],[15.5,14],[18,19.5],[20.5,19.5]],[[10,10.6],[14.5,10.6]]],arcs:[[9.5,16,5.5,35,235]]},$r={head:[10.6,3.9,1.9],limbs:[[[9.6,7.8],[7.6,12]],[[5.4,8.2],[9.4,8.4],[12.8,10]],[[4,15.6],[7.6,12],[11,13.6],[10.6,16.4]]]},Qr={cx:12,hr:1.9,arm:5,leg:3,r:2},qr={cx:12,hr:1.9,sh:2.2,hem:6,leg:3},Jr={cx:6.2,hr:1.8,arm:3.6,leg:2.2,r:1.4},ei={cx:17.8,hr:1.8,sh:1.4,hem:4.1,leg:2.2};function ti({cx:e,hr:t,arm:n,leg:o,r}){return[Ee(e,2+t,t),`M${de(e-n+r)} 8.5H${de(e+n-r)}a${r} ${r} 0 0 1 ${r} ${r}V15H${de(e+o)}V22H${de(e-o)}V15H${de(e-n)}V${de(8.5+r)}a${r} ${r} 0 0 1 ${r} ${-r}Z`,`M${de(e)} 15V22`].join(" ")}function ni({cx:e,hr:t,arm:n,leg:o,r}){return[be(e,2+t,t+1),q(e-n-.5,7.8,2*n+1,7.7,r+.5),q(e-o-.5,13,o,9.5,1),q(e+.5,13,o,9.5,1)]}function oi({cx:e,hr:t,sh:n,hem:o,leg:r}){return[Ee(e,2+t,t),Sn([[e-n,8.5],[e+n,8.5],[e+o,16],[e+r,16],[e+r,22],[e-r,22],[e-r,16],[e-o,16]])+"Z",`M${de(e)} 16V22`].join(" ")}function ri({cx:e,hr:t,sh:n,hem:o,leg:r}){return[be(e,2+t,t+1),ge([[e-n-.6,7.8],[e+n+.6,7.8],[e+o+.9,16.8],[e-o-.9,16.8]]),q(e-r-.1,15,r-.4,7.5,.9),q(e+.5,15,r-.4,7.5,.9)]}var Nl=[[14.6,1.5],[5.2,13.6],[11,13.6],[9.4,22.5],[18.8,10.4],[13,10.4]],Dl="M8.5 3.5 4 5.5l-1.5 5 3 1 1-2v11h11v-11l1 2 3-1-1.5-5-4.5-2c-.5 1.5-1.8 2.5-3.5 2.5s-3-1-3.5-2.5Z",Gl="M12 2.5S5 9.5 5 14.5a7 7 0 0 0 14 0c0-5-7-12-7-12Z",jl="M2.5 21.5h19V3h-6v6.2H9.2v6.2H2.5Z",ii=[[9,3],[15,3],[15,9],[21,9],[21,15],[15,15],[15,21],[9,21],[9,15],[3,15],[3,9],[9,9]],Hl={from:[3.8,5.2],segs:[{to:[20.2,5.2]},{to:[22,7],arc:{r:1.8,large:0,sweep:1}},{to:[22,9.7]},{to:[22,14.3],arc:{r:2.3,large:0,sweep:0}},{to:[22,17]},{to:[20.2,18.8],arc:{r:1.8,large:0,sweep:1}},{to:[3.8,18.8]},{to:[2,17],arc:{r:1.8,large:0,sweep:1}},{to:[2,14.3]},{to:[2,9.7],arc:{r:2.3,large:0,sweep:0}},{to:[2,7]},{to:[3.8,5.2],arc:{r:1.8,large:0,sweep:1}}]},Vl={from:[12,1.6],segs:[{to:[20.4,4.9]},{to:[20.4,11.2]},{to:[12,22.4],arc:{r:13,large:0,sweep:1}},{to:[3.6,11.2],arc:{r:13,large:0,sweep:1}},{to:[3.6,4.9]},{to:[12,1.6]}]};function si(e,t,n){return{from:[e-n,t],segs:[{to:[e+n,t],arc:{r:n,large:0,sweep:1}},{to:[e-n,t]}]}}var ai={head:[13.2,4.3,2.2],limbs:[[[12.6,8.6],[11.2,15],[17.8,18.4],[9.4,18.4]],[[12.4,9.8],[16,14.4]]]},Ul=[[6,10.5],[15,10.5],[16.5,7],[18.5,5.5],[20,6.5],[21.5,8.5],[19.5,10],[18,12],[18,19],[16.5,19],[15.5,14],[9.5,14],[8.5,19],[7,19],[6.5,13]],Xl=[[5.4,9.8],[14.6,9.8],[16.1,6.4],[18.4,4.6],[20.5,5.9],[22.4,8.6],[19.9,10.6],[18.8,12.3],[18.8,19.8],[15.8,19.8],[15,14.8],[10.1,14.8],[9.2,19.8],[6.2,19.8],[5.6,13.2]],go=[{key:"restroom-men",label:"Men's restroom",group:"facilities",path:ti(Qr),solid:ee(ni(Qr))},{key:"restroom-women",label:"Women's restroom",group:"facilities",path:oi(qr),solid:ee(ri(qr))},{key:"restroom-accessible",label:"Accessible restroom",group:"facilities",path:[Ue(2.5,2.5,19,19,3.5),Kt(St(ft,4.6,4.3,.66))].join(" "),solid:ee(Pt(ft)),solidLarge:ee(q(1.5,1.5,21,21,4.5),pe(q(3.9,3.9,16.2,16.2,2.6)),Pt(St(ft,4.9,4.7,.62),2.2))},{key:"first-aid",label:"First aid",group:"facilities",path:Sn(ii)+"Z",solid:ee(ge(ii.map(([e,t])=>[e+(e-12)*.08,t+(t-12)*.08])))},{key:"coat-check",label:"Coat check",group:"facilities",path:"M10 6.5a2 2 0 1 1 2 2V10 M12 10 3.4 16.9a1.4 1.4 0 0 0 .9 2.6h15.4a1.4 1.4 0 0 0 .9-2.6Z",solid:ee(Be(12,6.2,2.2,180,450,2.3),le([12,8.4],[12,10.5],2.3),ye([[12,10.2],[3.2,18.8],[20.8,18.8]],2.8,!0))},{key:"atm",label:"ATM / cash",group:"facilities",path:[Ue(2,6,20,12,2),Ee(12,12,2.75),"M6 12h.01 M18 12h.01"].join(" "),solid:ee(q(1.5,5.5,21,13,2.4),pe(be(12,12,3.2)))},{key:"info",label:"Info point",group:"facilities",path:[Ee(12,12,9.5),"M10.8 11H12v5.8 M12 7.6h.01"].join(" "),solid:ee(be(12,4.9,2.4),q(10.3,9.2,3.4,12.3,1),q(8.2,9.2,4,3,1),q(8.2,18.5,7.6,3,1))},{key:"lost-found",label:"Lost & found",group:"facilities",path:[Ee(10.5,10.5,7.5),"M16 16l5.5 5.5","M8.4 8.4a2.1 2.1 0 1 1 3 1.9c-.6.4-.9.8-.9 1.6 M10.5 14.6h.01"].join(" "),solid:ee(Be(12,7.6,4.2,180,405,3.4),ye([[14.97,10.57],[12,13],[12,15]],3.4),be(12,20,2.1))},{key:"restrooms",label:"Toilets",group:"facilities",path:[ti(Jr),oi(ei)].join(" "),solid:ee(ni(Jr),ri(ei))},{key:"charging",label:"Charging point",group:"facilities",path:[Ue(6,2,12,20,2.5),"M13.2 6.2 9.6 12h4.8l-3.6 5.8"].join(" "),solid:ee(ge(Nl))},{key:"smoking",label:"Smoking area",group:"facilities",path:[Ue(2,14.5,14.5,4,1),"M6.5 14.5v4","M15.5 11.5c0-1.4 1.5-1.9 1.5-3.4s-1.5-2-1.5-3.4 M19 11.5c0-1.4 1.5-1.9 1.5-3.4s-1.5-2-1.5-3.4"].join(" "),solid:ee(q(1.5,14,4.2,5,1.2),q(6.8,14,10.4,5,1.2),ye([[15.9,11.4],[17.3,8.9],[15.9,6.4],[17.1,3.9]],2.2),ye([[19.6,11.4],[21,8.9],[19.6,6.4],[20.8,3.9]],2.2))},{key:"no-smoking",label:"No smoking",group:"facilities",path:[Ee(12,12,9.5),"M5.3 5.3l13.4 13.4","M5.5 10.5h13v3h-13Z"].join(" "),solid:ee(be(12,12,10.6),pe(be(12,12,8)),le([6,6],[18,18],2.8),q(5,10.4,3,3.2,.6),q(16,10.4,3,3.2,.6))},{key:"food",label:"Food",group:"food-drink",path:"M5 2.5V8a2.5 2.5 0 0 0 5 0V2.5 M7.5 2.5v19 M18.5 13.5h-2c-1.3 0-2-1-2-2.5 0-4 1.5-7 4-8.5v19",solid:ee(ye([[4.9,2.6],[4.9,8]],2.2),ye([[10.1,2.6],[10.1,8]],2.2),ye([[7.5,2.6],[7.5,8]],2.2),Be(7.5,8,2.6,0,180,2.2),le([7.5,10],[7.5,21.4],3),ge([[19.4,2.2],[19.4,14.2],[16.2,14.2],[14.1,12],[14.1,9.4],[15.2,5.8],[17.3,3.3]]),le([18,13],[18,21.4],3))},{key:"bar",label:"Bar",group:"food-drink",path:"M3.5 3.5h17L12 13Z M6.2 6.5h11.6 M12 13v7.5 M8 20.5h8",solid:ee(ge([[2.8,3],[21.2,3],[12,13.6]]),le([12,12],[12,20.6],2.8),le([7.4,21],[16.6,21],2.8))},{key:"coffee",label:"Caf\xE9 / coffee",group:"food-drink",path:"M4 9h12v4.5a5.5 5.5 0 0 1-5.5 5.5h-1A5.5 5.5 0 0 1 4 13.5Z M16 10.5h1.2a2.75 2.75 0 0 1 0 5.5H16 M8 3v3 M12 3v3 M3 21.5h14",solid:ee({from:[3.4,8.4],segs:[{to:[16.6,8.4]},{to:[16.6,13.4]},{to:[11,19.4],arc:{r:5.8,large:0,sweep:1}},{to:[9,19.4]},{to:[3.4,13.4],arc:{r:5.8,large:0,sweep:1}},{to:[3.4,8.4]}]},Be(17.2,13.25,2.5,270,450,2.4),le([7.8,2.6],[7.8,5.6],2.4),le([12.2,2.6],[12.2,5.6],2.4),le([2.6,21.6],[17.4,21.6],2.6))},{key:"water",label:"Water / drinks",group:"food-drink",path:Gl,solid:"M12 1.2S4 8.9 4 14.5a8 8 0 0 0 16 0c0-5.6-8-13.3-8-13.3Z"},{key:"merch",label:"Merch / shop",group:"food-drink",path:Dl,solid:"M8.4 2.8 3.5 5l-1.9 6 4.2 1.4.4-.8v9.4h11.6v-9.4l.4.8 4.2-1.4-1.9-6-4.9-2.2c-.4 1.5-1.8 2.6-3.6 2.6s-3.2-1.1-3.6-2.6Z"},{key:"screen",label:"Screen",group:"facilities",path:[Ue(2,3.5,20,13.5,2),"M12 17v3.5 M8 20.5h8","M10 7.8v5.9l5-2.95Z"].join(" "),solid:ee(q(1.5,3,21,14.4,2.4),pe(ge([[9.6,6.7],[16,10.2],[9.6,13.7]])),q(10.6,16.5,2.8,4,0),le([7.4,21],[16.6,21],2.8))},{key:"sound-booth",label:"Sound booth",group:"facilities",path:["M6 3v9 M6 16v5 M12 3v3 M12 10v11 M18 3v10 M18 17v4",Ee(6,14,2),Ee(12,8,2),Ee(18,15,2)].join(" "),solid:ee(le([6,2.8],[6,21.2],1.8),le([12,2.8],[12,21.2],1.8),le([18,2.8],[18,21.2],1.8),q(3.2,11.6,5.6,4.8,1.4),q(9.2,5.6,5.6,4.8,1.4),q(15.2,12.6,5.6,4.8,1.4))},{key:"entrance",label:"Entrance",group:"navigation",path:"M11 7V3.5a1 1 0 0 1 1-1h8a1 1 0 0 1 1 1v17a1 1 0 0 1-1 1h-8a1 1 0 0 1-1-1V17 M2.5 12h13.5 M12.5 8.5 16 12l-3.5 3.5",solid:ee(ye([[11,6.5],[11,2.6],[21,2.6],[21,21.4],[11,21.4],[11,17.5]],2.6),le([2.8,12],[13.5,12],3.2),ge([[12.6,7.8],[18,12],[12.6,16.2]]))},{key:"exit",label:"Exit",group:"navigation",path:"M13 7V3.5a1 1 0 0 0-1-1H4a1 1 0 0 0-1 1v17a1 1 0 0 0 1 1h8a1 1 0 0 0 1-1V17 M8 12h13.5 M18 8.5l3.5 3.5-3.5 3.5",solid:ee(ye([[13,6.5],[13,2.6],[3,2.6],[3,21.4],[13,21.4],[13,17.5]],2.6),le([7.2,12],[17,12],3.2),ge([[16.2,7.8],[21.6,12],[16.2,16.2]]))},{key:"emergency-exit",label:"Emergency exit",group:"navigation",path:[Kt(St($r,-2,1.4,1.15)),"M15.5 13h6 M19 10.5l2.5 2.5-2.5 2.5"].join(" "),solid:ee(Pt(St($r,-2,1.4,1.15),2.7),le([15.6,13],[19.5,13],2.8),ge([[18.4,9.4],[22.4,13],[18.4,16.6]]))},{key:"stairs",label:"Stairs",group:"navigation",path:jl,solid:"M1.5 22.5h21V2h-7.8v6.4H8.4v6.4H1.5Z"},{key:"elevator",label:"Elevator",group:"navigation",path:[Ue(3.5,2.5,17,19,2.5),"M8.5 9.5 12 5.5l3.5 4Z M8.5 14.5l3.5 4 3.5-4Z"].join(" "),solid:ee(ge([[12,1.6],[19.6,10.2],[4.4,10.2]]),ge([[4.4,13.8],[19.6,13.8],[12,22.4]]))},{key:"parking",label:"Parking",group:"navigation",path:[Ue(3,3,18,18,3),"M9.5 17V7h3.75a3 3 0 0 1 0 6H9.5"].join(" "),solid:"M6.5 21V3H12a5.5 5.5 0 0 1 0 11h-1.9v7Z M10.1 6.6v3.8H12a1.9 1.9 0 0 0 0-3.8Z"},{key:"wheelchair",label:"Wheelchair access",group:"accessibility",path:Kt(ft),solid:ee(Pt(ft))},{key:"hearing",label:"Hearing assistance",group:"accessibility",path:["M4 9a6 6 0 1 1 12 0c0 3-1.8 4.3-3 5.2-1.1.8-1.6 1.7-1.6 3.1a3.6 3.6 0 0 1-6.2 2.1","M7.5 9a2.5 2.5 0 0 1 5 0c0 1.2-.7 1.9-1.6 2.5","M18.5 5.5a6.5 6.5 0 0 1 0 8"].join(" "),solid:ee(Be(10,9,6,180,380,3),ye([[15.64,11.05],[12.8,14.3],[11.5,17.2]],3),Be(8.2,17.2,3.3,0,150,3),Be(10,9,2.2,180,400,2.4),Be(13.38,9.5,6.5,322,398,2.6))},{key:"box-office",label:"Box office / tickets",group:"navigation",path:"M3 7.5A1.5 1.5 0 0 1 4.5 6h15A1.5 1.5 0 0 1 21 7.5V10a2 2 0 0 0 0 4v2.5a1.5 1.5 0 0 1-1.5 1.5h-15A1.5 1.5 0 0 1 3 16.5V14a2 2 0 0 0 0-4Z M15 6v2 M15 11v2 M15 16v2",solid:ee(Hl,pe(q(14.1,7,1.8,2.2,.9)),pe(q(14.1,10.9,1.8,2.2,.9)),pe(q(14.1,14.8,1.8,2.2,.9)))},{key:"escalator",label:"Escalator",group:"navigation",path:"M2.5 17H7l9-9h5.5v4h-4l-9 9h-6Z M11 4.5h.01 M11 8.2v3.3",solid:ee(ge([[2,16.4],[6.8,16.4],[15.8,7.4],[22,7.4],[22,12.6],[17.8,12.6],[8.8,21.6],[2,21.6]]),be(11,4.3,2.3),le([11,8],[11,11],2.6))},{key:"ramp",label:"Ramp",group:"navigation",path:"M2.5 19.5h19v-10Z M4.5 13.2 14 8.2 M10.53 7.76 14 8.2l-1.6 3.11",solid:ee(ge([[1.6,20.4],[22.4,20.4],[22.4,8.6]]),le([4.2,13.4],[13.2,8.6],2.6),ge([[15.4,7.5],[13.16,11.84],[10.56,6.88]]))},{key:"taxi",label:"Taxi / rideshare",group:"navigation",path:["M9.5 2.5h5V5h-5Z M6.5 11 8 7h8l1.5 4",Ue(3.5,11,17,6,2),"M6.5 17v2.5 M17.5 17v2.5 M7 14h.01 M17 14h.01"].join(" "),solid:ee(q(9,1.8,6,3.4,.8),ge([[6,11.4],[7.6,6.4],[16.4,6.4],[18,11.4]]),q(2.8,10.6,18.4,7,2.2),pe(be(6.8,14,1.3)),pe(be(17.2,14,1.3)),q(4.8,16,3.6,5.2,1.2),q(15.6,16,3.6,5.2,1.2))},{key:"transit",label:"Bus / transit",group:"navigation",path:[Ue(4.5,2.5,15,16,3),"M4.5 10.5h15 M9 5.5h6 M7.5 18.5V21 M16.5 18.5V21 M8 14.5h.01 M16 14.5h.01"].join(" "),solid:ee(q(4,2,16,17,3.2),pe(q(6.2,5.8,11.6,5,1)),pe(be(8,14.5,1.3)),pe(be(16,14.5,1.3)),q(6,17,3.4,5,1.2),q(14.6,17,3.4,5,1.2))},{key:"bike-parking",label:"Bike parking",group:"navigation",path:[Ee(6,14.5,4),Ee(18,14.5,4),"M6 14.5 9 7.5h6.5L18 14.5 M9 7.5l2.5 7H6 M11.5 14.5l4-7 M7.5 6h3 M15.5 7.5 15 5.5h2"].join(" "),solid:ee(be(6,14.5,4.9),pe(be(6,14.5,2.7)),be(18,14.5,4.9),pe(be(18,14.5,2.7)),ye([[6,14.5],[9,7.5],[15.5,7.5],[18,14.5]],2.2),ye([[9,7.5],[11.5,14.5],[15.5,7.5]],2.2),le([6,14.5],[11.5,14.5],2.2),le([7.2,5.8],[10.6,5.8],2.2),ye([[15.4,7.3],[15,5.4],[17.2,5.4]],2.2))},{key:"meeting-point",label:"Meeting point",group:"navigation",path:["M9.5 2.5 12 5l2.5-2.5 M9.5 21.5 12 19l2.5 2.5 M2.5 9.5 5 12l-2.5 2.5 M21.5 9.5 19 12l2.5 2.5",Ee(10,9.6,1.5),Ee(14,9.6,1.5),"M7.5 15.5a2.5 2.5 0 0 1 5 0 M11.5 15.5a2.5 2.5 0 0 1 5 0"].join(" "),solid:ee(ye([[9.4,2.4],[12,5],[14.6,2.4]],2.6),ye([[9.4,21.6],[12,19],[14.6,21.6]],2.6),ye([[2.4,9.4],[5,12],[2.4,14.6]],2.6),ye([[21.6,9.4],[19,12],[21.6,14.6]],2.6),be(9.7,9.3,2.2),be(14.3,9.3,2.2),si(9.7,16,3),si(14.3,16,3))},{key:"security",label:"Security / bag check",group:"facilities",path:"M12 2.5 19.5 5.5v6c0 4.6-3.2 8.4-7.5 10-4.3-1.6-7.5-5.4-7.5-10v-6Z M8.5 12l2.5 2.5 4.5-5",solid:ee(Vl,pe(ge([[7.4,12.2],[9,10.6],[10.9,12.5],[15,8.4],[16.6,10],[10.9,15.7]])))},{key:"lockers",label:"Lockers",group:"facilities",path:[Ue(3.5,2.5,17,19,1.5),"M12 2.5v19 M6 6h3 M15 6h3 M9.5 11.5v2.5 M14.5 11.5v2.5"].join(" "),solid:ee(q(3,2,8.4,20,1.4),pe(q(5,5,4.4,1.7,.8)),pe(q(8.6,10.8,1.5,3.8,.7)),q(12.6,2,8.4,20,1.4),pe(q(14.6,5,4.4,1.7,.8)),pe(q(13.9,10.8,1.5,3.8,.7)))},{key:"baby-change",label:"Baby change",group:"facilities",path:"M10 6.5l.8-3.3a1.2 1.2 0 0 1 2.4 0l.8 3.3 M8.5 6.5h7 M9.5 6.5l-.9 2.2a3 3 0 0 0-.1.9V19a2.5 2.5 0 0 0 2.5 2.5h2a2.5 2.5 0 0 0 2.5-2.5V9.6a3 3 0 0 0-.1-.9l-.9-2.2 M8.5 12.5h3 M8.5 16h3",solid:ee(ge([[9.6,6.2],[10.6,1.8],[13.4,1.8],[14.4,6.2]]),q(7.6,5.4,8.8,2.6,1),q(7.8,7.4,8.4,15,2.6),pe(q(7.8,11.8,3.4,1.5,0)),pe(q(7.8,15.4,3.4,1.5,0)))},{key:"prayer-room",label:"Prayer room",group:"facilities",path:[Kt(ai),"M3 21.5h18"].join(" "),solid:ee(Pt(ai),q(2.4,20.2,19.2,2.6,1.3))},{key:"quiet-room",label:"Quiet room",group:"facilities",path:"M4 9h3.5l5-4v14l-5-4H4Z M15.5 9.5l5 5 M20.5 9.5l-5 5",solid:ee(ge([[2.6,8.4],[7.2,8.4],[13,3.6],[13,20.4],[7.2,15.6],[2.6,15.6]]),le([15.4,9.2],[20.8,14.8],2.8),le([20.8,9.2],[15.4,14.8],2.8))},{key:"wifi",label:"Wi-Fi",group:"facilities",path:[Mn(12,19,11.5,218,322),Mn(12,19,7.5,218,322),Mn(12,19,3.5,218,322),"M12 19h.01"].join(" "),solid:ee(Be(12,19.2,11,218,322,2.8),Be(12,19.2,6.9,218,322,2.8),be(12,19.2,2.2))},{key:"vip-lounge",label:"VIP lounge",group:"facilities",path:["M6.5 11V7a2 2 0 0 1 2-2h7a2 2 0 0 1 2 2v4","M3.5 11.5a1.5 1.5 0 0 1 3 0V14h11v-2.5a1.5 1.5 0 0 1 3 0v6h-17Z","M5.5 17.5V20 M18.5 17.5V20"].join(" "),solid:ee(q(6,4,12,8.5,2.2),q(2.4,9.6,4.6,9,2.2),q(17,9.6,4.6,9,2.2),q(6,13.2,12,5.4,.6),le([5,18],[5,20.6],2.4),le([19,18],[19,20.6],2.4))},{key:"accessible-entrance",label:"Accessible entrance",group:"accessibility",path:[Kt(St(ft,.3,5,.62)),"M12.5 3.5H20a1 1 0 0 1 1 1v15a1 1 0 0 1-1 1h-7.5"].join(" "),solid:ee(Pt(St(ft,.3,5,.62),2.2),ye([[13,2.8],[21.2,2.8],[21.2,21.2],[13,21.2]],2.6))},{key:"assistance-dog",label:"Assistance-dog area",group:"accessibility",path:[Sn(Ul)+"Z","M6 10.8 3.5 7.5","M10.5 10.5V6h4.5l1 2.5"].join(" "),solid:ee(ge(Xl),le([6.2,11],[3.2,7.2],2.4),ye([[10.5,11],[10.5,5.6],[15.2,5.6],[16.2,8.2]],2.2))}],wp=new Map(go.map(e=>[e.key,e]));var li=go;var Kl=new Map(li.map(e=>[e.key,e]));function xo(e){return e?Kl.get(e):void 0}var _p=li.map(e=>e.key);var ui=e=>Math.round(e*1e6)/1e6+0;function wt(e){let t=e.map(r=>({x:ui(r.x),y:ui(r.y)})).sort((r,i)=>r.x-i.x||r.y-i.y).filter((r,i,s)=>i===0||r.x!==s[i-1].x||r.y!==s[i-1].y);if(t.length<3)return t;let n=(r,i,s)=>{let a=i.x-r.x,c=i.y-r.y,u=s.x-r.x,l=s.y-r.y;return a*l-c*u>1e-6*Math.hypot(a,c)*Math.hypot(u,l)},o=r=>{let i=[];for(let s of r){for(;i.length>=2&&!n(i[i.length-2],i[i.length-1],s);)i.pop();i.push(s)}return i.pop(),i};return[...o(t),...o([...t].reverse())]}function Yt(e){if(e.length<3)return e.map(n=>({...n}));let t=wt(e);return t.length>=3?t:[...e].sort((n,o)=>n.x-o.x||n.y-o.y).map(n=>({...n}))}var Di=Ge(require("polygon-clipping"),1);var K={top:1,wallBottom:.58,bottomCap:.4};function mt(e,t){if(!e)return t;let n=W(Ve(e,.4),.62);return re(t,n,.22)}function fi(e,t){return e?re(t,W(Ve(e,.25),.74),.62):t}function mi(e,t){let n=xt(yn({tierTop:t}));return e?ut(e,n.sectionDeck,Math.min(n.sectionDeckChromaShare*Xt(e),n.sectionDeckChromaCap)):ut(t,n.deck,Math.min(Xt(t),bn))}function hi(e,t){let n=new Map;for(let i of e.categories??[])n.set(i.key,i.color);let o=new Map;for(let i of t){if(!i.sectionId)continue;let s=o.get(i.sectionId);s||(s=new Map,o.set(i.sectionId,s)),s.set(i.categoryKey,(s.get(i.categoryKey)??0)+1)}let r=new Map;for(let[i,s]of o){let a=0,c=0,u=0,l=0;for(let[f,m]of s){let h=oe(n.get(f));h&&(a+=h[0]*m,c+=h[1]*m,u+=h[2]*m,l+=m)}l>0&&r.set(i,[a/l,c/l,u/l])}return r}function di(e,t){return oe(e.color)??t.get(e.logicalSectionId??e.id)??null}var Io=Ge(require("polygon-clipping"),1);var Po=Ge(require("polygon-clipping"),1);var bi=[{key:"circle",label:"Standard seat",shortLabel:"Standard",useCase:"General assigned seating",group:"general",path:null,bounds:null,mark:null},{key:"theatre",label:"Theatre chair",shortLabel:"Theatre",useCase:"Auditoriums, arenas and stadium stands",group:"fixed",path:"M4.5 3.5 Q4.5 1.5 6.5 1.5 L17.5 1.5 Q19.5 1.5 19.5 3.5 L19.5 13 L4.5 13 Z M3.5 12 L20.5 12 Q22.5 12 22.5 14 L22.5 21 Q22.5 22.5 21 22.5 Q19.5 22.5 19.5 21 L19.5 17.5 L4.5 17.5 L4.5 21 Q4.5 22.5 3 22.5 Q1.5 22.5 1.5 21 L1.5 14 Q1.5 12 3.5 12 Z",bounds:{x:1.5,y:1.5,width:21,height:21},mark:{x:12,y:10,radius:6}},{key:"dining",label:"Dining chair",shortLabel:"Dining",useCase:"Banquets, restaurants and table seating",group:"flexible",path:"M7 1 Q6 1 6 2.5 L6.75 10.5 L5 10.5 Q4 10.5 4 12 L4 14 Q4 15 5.25 15 L6 15 L4 23 L7 23 L9.5 15 L14.5 15 L17 23 L20 23 L18 15 L18.75 15 Q20 15 20 14 L20 12 Q20 10.5 19 10.5 L17.25 10.5 L18 2.5 Q18 1 17 1 Z",bounds:{x:4,y:1,width:16,height:22},mark:{x:12,y:10,radius:4.5}},{key:"folding",label:"Folding chair",shortLabel:"Folding",useCase:"Concert floors, ceremonies and conferences",group:"flexible",path:"M6 2 Q5 2 5 3 L6 8 L18 8 L19 3 Q19 2 18 2 Z M5 9 L19 9 Q20 9 20 10.5 L19 13 L5 13 L4 10.5 Q4 9 5 9 Z M6 12 L9 12 L12 17 L15 12 L18 12 L14 19 L17 23 L14 23 L12 21 L10 23 L7 23 L10 19 Z",bounds:{x:4,y:2,width:16,height:21},mark:{x:12,y:5,radius:3}},{key:"armchair",label:"Premium armchair",shortLabel:"Armchair",useCase:"Boxes, lounges and club seating",group:"premium",path:"M3.5 4 Q3.5 1.5 6 1.5 L18 1.5 Q20.5 1.5 20.5 4 L20.5 13 L3.5 13 Z M1.5 12.5 Q1.5 10 3.25 10 Q5 10 5 12.5 L5 13.5 L19 13.5 L19 12.5 Q19 10 20.75 10 Q22.5 10 22.5 12.5 L22.5 19.5 Q22.5 22 20 22 L4 22 Q1.5 22 1.5 19.5 Z",bounds:{x:1.5,y:1.5,width:21,height:20.5},mark:{x:12,y:7.5,radius:5.5}},{key:"recliner",label:"Recliner",shortLabel:"Recliner",useCase:"Luxury cinemas and premium clubs",group:"premium",path:"M7 2 Q7 1 8.5 1 L15.5 1 Q17 1 17 2 L19 13 L5 13 Z M4 9 Q2 9 2 11.5 L2 16 Q2 18 4 18 L6 18 L6 15 L18 15 L18 18 L20 18 Q22 18 22 16 L22 11.5 Q22 9 20 9 Q18 9 18 11 L18 13 L6 13 L6 11 Q6 9 4 9 Z M7 17 L17 17 Q18 17 18.5 18.5 L19.5 22.5 L4.5 22.5 L5.5 18.5 Q6 17 7 17 Z",bounds:{x:2,y:1,width:20,height:21.5},mark:{x:12,y:8,radius:5}},{key:"stool",label:"Stool",shortLabel:"Stool",useCase:"Bars, high-tops and seating rails",group:"flexible",path:"M6 2.5 L18 2.5 Q22 2.5 22 6.5 L22 12 Q22 16 18 16 L6 16 Q2 16 2 12 L2 6.5 Q2 2.5 6 2.5 Z M6 15.5 L9.5 15.5 L7.5 22.5 L3 22.5 Z M14.5 15.5 L18 15.5 L20.5 22.5 L16 22.5 Z",bounds:{x:2,y:2.5,width:20,height:20},mark:{x:12,y:9.25,radius:6.5}},{key:"bench",label:"Bench place",shortLabel:"Bench",useCase:"Pews, bleachers and terraces",group:"fixed",path:"M2.5 0.5 L21.5 0.5 Q23 0.5 23 2 L23 5 Q23 6.5 21.5 6.5 L2.5 6.5 Q1 6.5 1 5 L1 2 Q1 0.5 2.5 0.5 Z M2 7.5 L22 7.5 Q23.5 7.5 23.5 9 L23.5 15.5 Q23.5 17 22 17 L18 17 L18 21.5 Q18 22.5 16.75 22.5 Q15.5 22.5 15.5 21.5 L15.5 17 L8.5 17 L8.5 21.5 Q8.5 22.5 7.25 22.5 Q6 22.5 6 21.5 L6 17 L2 17 Q0.5 17 0.5 15.5 L0.5 9 Q0.5 7.5 2 7.5 Z",bounds:{x:.5,y:.5,width:23,height:22},mark:{x:12,y:12.25,radius:4.75}}],yi=bi.map(e=>e.key),Yl=new Map(bi.map(e=>[e.key,e]));function pi(e){return typeof e=="string"&&Yl.has(e)}function gi(e,t){return pi(e)?e:pi(t?.seatGlyph)?t.seatGlyph:"circle"}var Re={pedestal:0,pad:1,back:2,arm:3,footrest:4,leg:5,body:10,head:11},Wl=.44,zl=.15,Zl=.3,$l=.24;function xi(e){return e===void 0||!Number.isFinite(e)||e<=0?$l:Math.min(Zl,Math.max(zl,e*Wl))}var Ql=.05,Mi=.45,ql=Mi+Ql,Jl=.92;var Np=[{part:Re.pedestal,min:[-.3,0,-.3],max:[.3,.36,.3]},{part:Re.pad,min:[-1,.36,-.95],max:[1,Mi,1]},{part:Re.back,min:[-1,ql,-1],max:[1,Jl,-.72]},{part:Re.arm,min:[-1,.44,-.82],max:[-.78,.65,.78]},{part:Re.arm,min:[.78,.44,-.82],max:[1,.65,.78]},{part:Re.footrest,min:[-.9,.18,.78],max:[.9,.31,1.34]},{part:Re.leg,min:[-.82,0,-.7],max:[-.62,.37,-.48]},{part:Re.leg,min:[.62,0,-.7],max:[.82,.37,-.48]},{part:Re.leg,min:[-.82,0,.48],max:[-.62,.37,.7]},{part:Re.leg,min:[.62,0,.48],max:[.82,.37,.7]}],Dp=[{part:Re.body,min:[-.52,.39,-.08],max:[-.08,.55,.82]},{part:Re.body,min:[.08,.39,-.08],max:[.52,.55,.82]},{part:Re.body,min:[-.47,.05,.58],max:[-.13,.43,.82]},{part:Re.body,min:[.13,.05,.58],max:[.47,.43,.82]},{part:Re.head,min:[-.16,1.04,-.33],max:[.16,1.1,-.13]}];function Si(e,t,n,o){let r=new Float32Array(t),i=u=>e[u*3],s=u=>e[u*3+2],a=0,c=(u,l)=>{let f=l-u;for(let m=u;m<l;m++){let[h,d]=o(m),p=h-i(m),y=d-s(m);if(f>=2){let g=Math.max(u,m-1),M=Math.min(l-1,m+1),P=i(M)-i(g),w=s(M)-s(g),x=Math.hypot(P,w);if(x>1e-6){let b=-w/x,S=P/x;b*p+S*y<0&&(b=-b,S=-S),p=b,y=S}}r[m]=p===0&&y===0?0:Math.atan2(p,y)}};for(let u=1;u<=t;u++)(u===t||n(u)!==n(a))&&(c(a,u),a=u);return r}var Pn=.22;var eu=.42;function tu(e){let t=e.length,n=new Float64Array(t);if(t<2)return n.fill(1/0),n;let o=1/0,r=1/0,i=-1/0,s=-1/0;for(let d of e)d.x<o&&(o=d.x),d.y<r&&(r=d.y),d.x>i&&(i=d.x),d.y>s&&(s=d.y);let a=Math.max(i-o,1e-6),c=Math.max(s-r,1e-6),u=Math.max(Math.sqrt(a*c/t),1e-6),l=Math.max(1,Math.ceil(a/u)+1),f=Math.max(1,Math.ceil(c/u)+1),m=new Map,h=(d,p)=>{let y=Math.min(l-1,Math.max(0,Math.floor((d-o)/u)));return Math.min(f-1,Math.max(0,Math.floor((p-r)/u)))*l+y};for(let d=0;d<t;d++){let p=h(e[d].x,e[d].y),y=m.get(p);y?y.push(d):m.set(p,[d])}for(let d=0;d<t;d++){let p=e[d],y=Math.min(l-1,Math.max(0,Math.floor((p.x-o)/u))),g=Math.min(f-1,Math.max(0,Math.floor((p.y-r)/u))),M=1/0;for(let P=1;P<=4;P++){for(let w=g-P;w<=g+P;w++)if(!(w<0||w>=f))for(let x=y-P;x<=y+P;x++){if(x<0||x>=l||P>1&&Math.abs(w-g)<P&&Math.abs(x-y)<P)continue;let b=m.get(w*l+x);if(b)for(let S of b){if(S===d)continue;let I=Math.hypot(e[S].x-p.x,e[S].y-p.y);I<M&&(M=I)}}if(Number.isFinite(M)&&M<=P*u)break}n[d]=M}return n}function nu(e){let t=e.eyeHeightM;return Number.isFinite(t)?Math.max(0,t-je):0}function Pi(e,t,n,o,r,i){let s=e.length,a=new Float32Array(s*3),c=new Float32Array(s),u=new Float32Array(s*3),l=new Float32Array(s),f=new Float32Array(s),m=new Float32Array(s),h=new Float32Array(s),d=new Float32Array(s*3),p=new Map,y=tu(e);for(let g=0;g<s;g++){let M=e[g],w=(n?.seatPitchU(g)??y[g])*E;l[g]=Number.isFinite(w)?Math.max(.06,Math.min(Pn,w*eu)):Pn,f[g]=xi(Number.isFinite(w)?w:void 0);let x=gi(M.glyph,{seatGlyph:i?.get(M.categoryKey)});m[g]=yi.indexOf(x),h[g]=M.wheelchairSpaceType==="no-seat"?0:1,a[g*3]=M.x*E,a[g*3+1]=n?n.seatDeckY(g):nu(M),a[g*3+2]=M.y*E,c[g]=Vr(t?t(M):"available");let b=oe(r?.get(M.categoryKey)??"#6e7bff")??[.43,.48,1];if(u[g*3]=b[0],u[g*3+1]=b[1],u[g*3+2]=b[2],M.accessibility?.length){let S=oe(gn(M.accessibility));S&&(d[g*3]=S[0],d[g*3+1]=S[1],d[g*3+2]=S[2])}p.set(M.id,g)}return{count:s,iPosition:a,iState:c,iCategory:u,iMaxRadius:l,iRing:d,idToIndex:p,iChairWidth:f,iGlyph:m,iPhysicalSeat:h,iFloor:o??new Float32Array(s),iSection:new Float32Array(s).fill(-1),iYaw:new Float32Array(s)}}var Ei=Ge(require("earcut"),1);var ou=.58,Ii=.01,Te=Pn*1.5*Oe,ru=.5,iu=.6;function su(e,t){let n=e.length,o=[];for(let s=0;s<n;s++){let a=e[Math.max(0,s-1)],c=e[Math.min(n-1,s+1)],u=c.x-a.x,l=c.y-a.y,f=Math.hypot(u,l);if(f<1e-9){o.push([0,0]);continue}u/=f,l/=f,o.push([-l,u])}let r=0;for(let s=0;s<n;s++)r+=(e[s].x-t.x)*o[s][0]+(e[s].y-t.y)*o[s][1];return r<0?o.map(([s,a])=>[-s,-a]):o}function au(e,t){if(e.length<2||t<=0)return[...e];let n=[...e],o=(s,a)=>{let c=a.x-s.x,u=a.y-s.y,l=Math.hypot(c,u)||1;return{x:c/l,y:u/l}},r=o(n[1],n[0]),i=o(n[n.length-2],n[n.length-1]);return n.unshift({x:n[0].x+r.x*t,y:n[0].y+r.y*t}),n.push({x:n[n.length-1].x+i.x*t,y:n[n.length-1].y+i.y*t}),n}var Ri=Math.PI/12;function cu(e){if(e.length<3)return[...e];let t=wt(e);return t.length>=3?t:[...e]}function Ai(e,t){if(!e.length||!(t>0))return[];let n=cu(e),o=(a,c,u,l)=>{let f=u-c;for(;f<0;)f+=Math.PI*2;for(;f>Math.PI*2;)f-=Math.PI*2;let m=Math.max(1,Math.ceil(f/Ri)),h=t/Math.cos(f/m/2);for(let d=0;d<=m;d++){let p=c+f*d/m;l.push({x:a.x+Math.cos(p)*h,y:a.y+Math.sin(p)*h})}};if(n.length<3){let a=0,c=0;for(let h of n)a+=h.x,c+=h.y;a/=n.length||1,c/=n.length||1;let u=0;for(let h of n)u=Math.max(u,Math.hypot(h.x-a,h.y-c));let l=[],f=Math.max(3,Math.ceil(Math.PI*2/Ri)),m=(u+t)/Math.cos(Math.PI/f);for(let h=0;h<f;h++){let d=h/f*Math.PI*2;l.push({x:a+Math.cos(d)*m,y:c+Math.sin(d)*m})}return l}let r=n.length,i=[];for(let a=0;a<r;a++){let c=n[a],u=n[(a+1)%r];i.push(Math.atan2(-(u.x-c.x),u.y-c.y))}let s=[];for(let a=0;a<r;a++)o(n[a],i[(a+r-1)%r],i[a],s);return Oi(s)}function lu(e,t,n){if(e.length===1)return Math.hypot(t-e[0].x,n-e[0].y);let o=1/0;for(let r=0;r+1<e.length;r++){let i=e[r],s=e[r+1],a=s.x-i.x,c=s.y-i.y,u=a*a+c*c,l=u>1e-12?((t-i.x)*a+(n-i.y)*c)/u:0;l<0?l=0:l>1&&(l=1);let f=Math.hypot(t-(i.x+l*a),n-(i.y+l*c));f<o&&(o=f)}return o}function In(e){let t=e.map(r=>{let i=0,s=0;for(let u of r.pts)i+=u.x,s+=u.y;let a=r.pts.length||1;i/=a,s/=a;let c=0;for(let u of r.pts){let l=Math.hypot(u.x-i,u.y-s);l>c&&(c=l)}return{cx:i,cy:s,rad:c}}),n=r=>{let i=r.length;return i<=2?[...r]:[r[Math.floor(i*.25)],r[Math.floor(i*.5)],r[Math.floor(i*.75)]]},o=[];for(let r=0;r<e.length;r++){let i=n(e[r].pts),s=[],a=1/0,c=null;for(let l of i){let f=1/0;for(let m=0;m<e.length;m++){if(m===r||Math.abs(e[m].y-e[r].y)<.001)continue;let h=t[m],d=Math.hypot(l.x-h.cx,l.y-h.cy)-h.rad;if(d>=f&&d>=a)continue;let p=lu(e[m].pts,l.x,l.y);p<f&&(f=p),e[m].depth<e[r].depth&&p<a&&(a=p,c=e[m].y)}Number.isFinite(f)&&f>0&&s.push(f)}s.sort((l,f)=>l-f);let u=s.length?s[Math.floor(s.length/2)]:1;o.push({pitch:u,belowY:c})}return o}function _i(e,t,n,o){let r=e[t],i=r.pts.length>=2?[...r.pts]:r.pts.length===1?(()=>{let l=r.pts[0],f=l.x-o.x,m=l.y-o.y,h=Math.hypot(f,m)||1;f/=h,m/=h;let d=Math.max(n[t].pitch,.001)*.5;return[{x:l.x+m*d,y:l.y-f*d},{x:l.x-m*d,y:l.y+f*d}]})():[];if(i.length<2)return null;let s=0,a=0;for(let l=1;l<i.length;l++){let f=Math.hypot(i[l].x-i[l-1].x,i[l].y-i[l-1].y);f>1e-6&&(s+=f,a++)}let c=a>0?s/a:0,u=au(i,Math.max(c*iu,Te));return{pts:u,nrm:su(u,o),front:Math.max(n[t].pitch*ou,Te),back:Math.max(n[t].pitch*ru,Te)}}var Et=1.5,vi=.3;function Mo(e,t){if(e.length<3)return e;let n=e[0],o=e[e.length-1],r=o.x-n.x,i=o.y-n.y,s=Math.hypot(r,i),a=-1,c=-1;for(let f=1;f<e.length-1;f++){let m=e[f],h=s>1e-12?Math.abs((m.x-n.x)*i-(m.y-n.y)*r)/s:Math.hypot(m.x-n.x,m.y-n.y);h>a&&(a=h,c=f)}if(a<=t||c<0)return[n,o];let u=Mo(e.slice(0,c+1),t),l=Mo(e.slice(c),t);return[...u.slice(0,-1),...l]}function Ci(e,t){if(e.length<4)return e;let n=Mo([...e,e[0]],t);return n.pop(),n.length>=3?n:e}function uu(e){let t=e.map((o,r)=>{let i=e[(r+1)%e.length];return{a:o,b:i,i:r,minX:Math.min(o.x,i.x),maxX:Math.max(o.x,i.x),minY:Math.min(o.y,i.y),maxY:Math.max(o.y,i.y)}}).sort((o,r)=>o.minX-r.minX),n=(o,r,i)=>(r.x-o.x)*(i.y-o.y)-(r.y-o.y)*(i.x-o.x);for(let o=0;o<t.length;o++){let r=t[o];for(let i=o+1;i<t.length&&t[i].minX<=r.maxX;i++){let s=t[i];if(!(Math.abs(r.i-s.i)===1||Math.abs(r.i-s.i)===e.length-1||r.maxY<s.minY||s.maxY<r.minY)&&n(r.a,r.b,s.a)*n(r.a,r.b,s.b)<=0&&n(s.a,s.b,r.a)*n(s.a,s.b,r.b)<=0)return!0}}return!1}function ki(e,t,n){if(e.length<2)return[];let o=n??In(e),r=new Map;for(let s=0;s<e.length;s++){let a=r.get(e[s].blockId);a?a.push(s):r.set(e[s].blockId,[s])}let i=[];for(let[,s]of r){let a=[];for(let M of s){let P=e[M].patch;P&&P.length>=3?i.push({outline:[...P],holes:[],topY:e[M].y}):a.push(M)}if(!a.length)continue;a.sort((M,P)=>e[M].depth-e[P].depth);let u=a.map(M=>_i(e,M,o,t)).filter(M=>M!==null);if(!u.length)continue;let l=(M,P)=>({x:M.pts[P].x-M.nrm[P][0]*(M.front+Et),y:M.pts[P].y-M.nrm[P][1]*(M.front+Et)}),f=(M,P)=>({x:M.pts[P].x+M.nrm[P][0]*(M.back+Et),y:M.pts[P].y+M.nrm[P][1]*(M.back+Et)}),m=u[0],h=u[u.length-1],d=[];for(let M=0;M<m.pts.length;M++)d.push(l(m,M));for(let M of u)d.push(f(M,M.pts.length-1));for(let M=h.pts.length-1;M>=0;M--)d.push(f(h,M));for(let M=u.length-1;M>=0;M--)d.push(l(u[M],0));let p=Oi(d),y=1/0;for(let M of a)e[M].y<y&&(y=e[M].y);if(!Number.isFinite(y))continue;if(p.length>=3&&Math.abs(Ae(p))>1e-6&&u.every(M=>{let P=M.pts[Math.floor(M.pts.length/2)];return _e(p,P.x,P.y)})&&!uu(p)){i.push({outline:Ci(p,vi),holes:[],topY:y});continue}for(let M of fu(u))i.push({outline:M,holes:[],topY:y})}return i}function fu(e){let t=[];for(let n of e){let o=[],r=[],i=n.front+Et,s=n.back+Et;for(let c=0;c<n.pts.length;c++){let u=n.pts[c],l=n.nrm[c];o.push([u.x-l[0]*i,u.y-l[1]*i]),r.push([u.x+l[0]*s,u.y+l[1]*s])}let a=[...o,...r.reverse()];a.length<3||(a.push(a[0]),t.push([a]))}if(!t.length)return[];try{let n=Po.default.union(t[0],...t.slice(1)),o=[];for(let r of n){if(!r.length||r[0].length<4)continue;let i=r[0].map(([c,u])=>({x:c,y:u})),s=i[0],a=i[i.length-1];i.length>1&&Math.abs(s.x-a.x)<1e-9&&Math.abs(s.y-a.y)<1e-9&&i.pop(),i.length>=3&&o.push(Ci(i,vi))}return o}catch{return[]}}function Oi(e){let t=[];for(let n of e){let o=t[t.length-1];o&&Math.hypot(n.x-o.x,n.y-o.y)<1e-9||t.push(n)}for(;t.length>2&&Math.hypot(t[0].x-t[t.length-1].x,t[0].y-t[t.length-1].y)<1e-9;)t.pop();return t}var So=class{constructor(t){this.minX=1/0;this.minY=1/0;this.maxX=-1/0;this.maxY=-1/0;this.rings=t;for(let n of t)for(let o of n)o.x<this.minX&&(this.minX=o.x),o.y<this.minY&&(this.minY=o.y),o.x>this.maxX&&(this.maxX=o.x),o.y>this.maxY&&(this.maxY=o.y)}containsAll(t){for(let n of t)if(n.x<this.minX||n.x>this.maxX||n.y<this.minY||n.y>this.maxY)return!1;for(let n of this.rings){let o=!0;for(let r of t)if(!_e(n,r.x,r.y)){o=!1;break}if(o)return!0}return!1}};function wi(e,t,n,o,r,i){if(o.length<3)return;if(n.containsAll(o)){let u=[0,1,0],l=o[0];for(let f=1;f+1<o.length;f++){let m=o[f],h=o[f+1];e.tri([l.x*E,r,l.y*E],[m.x*E,r,m.y*E],[h.x*E,r,h.y*E],u,i)}return}let s=o.map(u=>[u.x,u.y]);s.push(s[0]);let a;try{a=Po.default.intersection([s],t)}catch{return}let c=[0,1,0];for(let u of a){if(!u.length||u[0].length<4)continue;let l=u[0],f=[],m=[];for(let d=0;d<l.length-1;d++)f.push(l[d][0],l[d][1]),m.push([l[d][0],l[d][1]]);if(m.length<3)continue;let h=(0,Ei.default)(f,void 0,2);for(let d=0;d<h.length;d+=3){let p=m[h[d]],y=m[h[d+1]],g=m[h[d+2]];e.tri([p[0]*E,r,p[1]*E],[y[0]*E,r,y[1]*E],[g[0]*E,r,g[1]*E],c,i)}}}function Ti(e,t,n,o,r,i,s){if(t.length<2)return;let a=s??In(t),c=[0,1,0],u=i&&i.length>=3?[[...i.map(h=>[h.x,h.y]),[i[0].x,i[0].y]]]:null,l=i&&i.length>=3?new So([[...i]]):null,f=h=>{e.setMaterial(2),h(),e.setMaterial(0)},m=h=>{e.setMaterial(3),h(),e.setMaterial(0)};for(let h=0;h<t.length;h++){let d=t[h];if(d.patch&&d.patch.length>=3){let x=[...d.patch],b=a[h].belowY??o;if(m(()=>{if(u&&l)wi(e,u,l,x,d.y,r.tread);else{let S=x[0];for(let I=1;I+1<x.length;I++){let R=x[I],k=x[I+1];e.tri([S.x*E,d.y,S.y*E],[R.x*E,d.y,R.y*E],[k.x*E,d.y,k.y*E],c,r.tread)}}}),d.y>b+Ii){let S=0,I=0;for(let R of x)S+=R.x,I+=R.y;S/=x.length,I/=x.length,f(()=>{for(let R=0;R<x.length;R++){let k=x[R],L=x[(R+1)%x.length],T=L.x-k.x,v=L.y-k.y,A=Math.hypot(T,v);if(A<1e-6)continue;let _=v/A,C=-T/A;(k.x-S)*_+(k.y-I)*C<0&&(_=-_,C=-C);let B=[_,0,C],O=[k.x*E,d.y,k.y*E],F=[L.x*E,d.y,L.y*E],D=[k.x*E,b,k.y*E],j=[L.x*E,b,L.y*E];e.tri(O,F,j,B,r.riser),e.tri(O,j,D,B,r.riser)}})}continue}let p=_i(t,h,a,n);if(!p)continue;let{pts:y,nrm:g,front:M,back:P}=p,w=a[h].belowY??o;for(let x=0;x+1<y.length;x++){let b=y[x],S=y[x+1],I=g[x],R=g[x+1];if(Math.hypot(S.x-b.x,S.y-b.y)<1e-6||I[0]===0&&I[1]===0||R[0]===0&&R[1]===0)continue;let k=[(b.x-I[0]*M)*E,d.y,(b.y-I[1]*M)*E],L=[(S.x-R[0]*M)*E,d.y,(S.y-R[1]*M)*E],T=[(b.x+I[0]*P)*E,d.y,(b.y+I[1]*P)*E],v=[(S.x+R[0]*P)*E,d.y,(S.y+R[1]*P)*E];if(m(()=>{u&&l?wi(e,u,l,[{x:b.x-I[0]*M,y:b.y-I[1]*M},{x:S.x-R[0]*M,y:S.y-R[1]*M},{x:S.x+R[0]*P,y:S.y+R[1]*P},{x:b.x+I[0]*P,y:b.y+I[1]*P}],d.y,r.tread):(e.tri(k,L,v,c,r.tread),e.tri(k,v,T,c,r.tread))}),d.y>w+Ii){let A=[k[0],w,k[2]],_=[L[0],w,L[2]],C=[-I[0],0,-I[1]];f(()=>{e.tri(k,L,_,C,r.riser),e.tri(k,_,A,C,r.riser)})}}}}function mu(e,t){let n=e.eventConfigurationIds;return!n?.length||!!t&&n.includes(t)}function Li(e,t){return e.filter(n=>n.type!=="shape"||mu(n,t))}function Bi(e,t){let n=e.focalPoint??{x:0,y:0};return e.floors?.length?e.floors.map((o,r)=>({objects:Li(o.objects,t),focal:{x:(o.focalPoint??n).x,y:(o.focalPoint??n).y},baseHeightM:o.baseHeightM??0,index:r})):[{objects:Li(e.objects,t),focal:n,baseHeightM:0,index:0}]}var hu={minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};function Ye(e){return zr(e)??hu}function Fi(e,t){let n=Le(e.outline,Te),o=Ye(n),r=t.filter(s=>s!==e&&s.outline&&s.outline.length>=3&&Mt(o,Ye(s.outline)));if(!r.length)return[n];let i=s=>{let a=s.map(c=>[c.x,c.y]);return a.push(a[0]),a};try{let s=Io.default.difference([i(n)],...r.map(c=>[i(c.outline)])),a=[];for(let c of s){if(!c.length)continue;let u=c[0].map(([l,f])=>({x:l,y:f}));if(u.length>1){let l=u[0],f=u[u.length-1];Math.abs(l.x-f.x)<1e-9&&Math.abs(l.y-f.y)<1e-9&&u.pop()}u.length>=3&&a.push(u)}return a.length?a:[n]}catch{return[n]}}function Ni(e,t){if(!t.length)return e;let n=i=>{let s=i.map(a=>[a.x,a.y]);return s.push(s[0]),s},o=t.map(i=>[n(i)]),r=[];for(let i of e){let s;try{s=Io.default.intersection([n(i.outline)],o.flat())}catch{r.push(i);continue}for(let a of s){if(!a.length)continue;let c=a[0].map(([u,l])=>({x:u,y:l}));if(c.length>1){let u=c[0],l=c[c.length-1];Math.abs(u.x-l.x)<1e-9&&Math.abs(u.y-l.y)<1e-9&&c.pop()}c.length>=3&&r.push({outline:c,holes:[],topY:i.topY})}}return r.length?r:e}function du(e,t){return e===void 0||t===void 0?!0:Math.abs(e-t)<.001}var Rn=class{constructor(){this.rings=[];this.boxes=[];this.levels=[]}subtract(t,n){let o=t.map(c=>[c.x,c.y]);if(o.length<3)return[];o.push(o[0]);let r=Ye(t),i=this.rings.filter((c,u)=>Mt(r,this.boxes[u])&&du(n,this.levels[u])),s=[[o]];if(i.length)try{s=Di.default.difference([o],...i).map(u=>u.map(l=>l.map(([f,m])=>[f,m])))}catch{s=[[o]]}this.rings.push([o]),this.boxes.push(r),this.levels.push(n);let a=[];for(let c of s){if(!c.length)continue;let u=c[0].map(([l,f])=>({x:l,y:f}));if(u.length>1){let l=u[0],f=u[u.length-1];Math.abs(l.x-f.x)<1e-9&&Math.abs(l.y-f.y)<1e-9&&u.pop()}u.length>=3&&a.push(u)}return a}};function At(e,t,n=e){if(!t)return e;let o=1/0,r=-1/0,i=1/0,s=-1/0;for(let m of n)o=Math.min(o,m.x),r=Math.max(r,m.x),i=Math.min(i,m.y),s=Math.max(s,m.y);let a=(o+r)/2,c=(i+s)/2,u=t*Math.PI/180,l=Math.cos(u),f=Math.sin(u);return e.map(m=>{let h=m.x-a,d=m.y-c;return{x:a+h*l-d*f,y:c+h*f+d*l}})}function Gi(e){let t=cr(e);return!t.length||!e.points?.length?[]:t.map(n=>At(n,e.rotation,e.points))}function ie(e){let t=null;if(e.kind==="polygon"&&e.points&&e.points.length>=3)return At(tn(e,4),e.rotation,e.points);if(e.kind==="rect"&&e.width&&e.height&&(t=Ht(e.x??0,e.y??0,e.width,e.height)),e.kind==="ellipse"&&e.width&&e.height){let n=(e.x??0)+e.width/2,o=(e.y??0)+e.height/2;t=mn(n,o,e.width/2,e.height/2)}return t?At(t,e.rotation):null}function Fe(e){let t=e.role??"",o=t==="stage"?{kind:"stage",heightM:Sr(e.stageKind)}:{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}}[t]??{kind:"plate",heightM:.25};return{...o,heightM:e.heightM??o.heightM}}var pu=.08,bu=30,yu=.015;function gu(e,t){let n=!1;for(let o=0,r=t.length-1;o<t.length;r=o++){let i=t[o],s=t[r];i.y>e.y!=s.y>e.y&&e.x<(s.x-i.x)*(e.y-i.y)/(s.y-i.y)+i.x&&(n=!n)}return n}function ji(e,t){let n=ie(e)??(e.points?.length?At(e.points,e.rotation):null),o=Fe(e),i=!e.role&&o.kind==="plate"&&e.heightM===void 0&&!!n&&Math.abs(Ae(n))*$**2>=bu?yu:o.heightM;if(!n)return{topOffsetM:i,supportOffsetM:0};if(o.kind!=="plate"&&o.kind!=="stage")return{topOffsetM:i,supportOffsetM:0};let s=1/0,a=1/0,c=-1/0,u=-1/0;for(let h of n)s=Math.min(s,h.x),a=Math.min(a,h.y),c=Math.max(c,h.x),u=Math.max(u,h.y);let l=i,f=0,m=1e-6*Math.max(1,c-s,u-a);for(let h of t)c>h.minX&&s<h.maxX&&u>h.minY&&a<h.maxY&&l<=h.topOffsetM+1e-6&&(l=h.topOffsetM+pu),s>=h.minX-m&&c<=h.maxX+m&&a>=h.minY-m&&u<=h.maxY+m&&(!h.poly||n.every(y=>gu(y,h.poly)||xu(y,h.poly,m)))&&(f=Math.max(f,h.topOffsetM));return e.fill&&e.fill!=="none"&&e.fill!=="transparent"&&t.push({minX:s,minY:a,maxX:c,maxY:u,topOffsetM:l,poly:n}),{topOffsetM:l,supportOffsetM:Math.min(f,l)}}function xu(e,t,n){for(let o=0,r=t.length-1;o<t.length;r=o++){let i=t[r],s=t[o],a=s.x-i.x,c=s.y-i.y,u=a*a+c*c,l=u?Math.max(0,Math.min(1,((e.x-i.x)*a+(e.y-i.y)*c)/u)):0;if(Math.hypot(e.x-(i.x+l*a),e.y-(i.y+l*c))<=n)return!0}return!1}function et(e,t,n){return{x:e.x+(t.x-e.x)*n,y:e.y+(t.y-e.y)*n}}function ve(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 we(e,t,n){return[et(e[0],e[1],t),et(e[0],e[1],n),et(e[3],e[2],n),et(e[3],e[2],t)]}function Wt(e,t,n){return[et(e[0],e[3],t),et(e[1],e[2],t),et(e[1],e[2],n),et(e[0],e[3],n)]}function ne(e,t,n,o,r,i,s){z(e,t,s?.length?s:void 0,()=>n,o,r,i,K)}var Mu=.8,Su=.6,Pu=2;function tt(e,t){if(!t.length)return null;let n=[],o=0;for(let s of e.objects){if(s.type!=="shape"||s.role!=="wall")continue;let a=ie(s)??[],c=Hi(a)/2;!(c>0)||wu(a)/c*E>Pu||(n.push(...a),o+=c)}if(n.length<3)return null;let r=Yt(n);if(r.length<3||o<Hi(r)*Su)return null;let i=0;for(let s of t)Eu(s,r)&&(i+=1);return i>=t.length*Mu?r:null}var wn=6,Iu=5,Ru=8;function Vi(e){return Math.max(Ru,(Number.isFinite(e)?e:0)+Iu)}function _t(e){let t=0,n=0,o=0;for(let r=0;r<e.length;r++){let i=e[r],s=e[(r+1)%e.length],a=i.x*s.y-s.x*i.y;t+=a,n+=(i.x+s.x)*a,o+=(i.y+s.y)*a}if(Math.abs(t)<1e-9){let r=0,i=0;for(let s of e)r+=s.x,i+=s.y;return{x:r/Math.max(1,e.length),y:i/Math.max(1,e.length)}}return{x:n/(3*t),y:o/(3*t)}}function wu(e){let t=0;for(let n=0;n<e.length;n++){let o=e[n],r=e[(n+1)%e.length];t+=o.x*r.y-r.x*o.y}return Math.abs(t)/2}function Hi(e){let t=0;for(let n=0;n<e.length;n++){let o=e[n],r=e[(n+1)%e.length];t+=Math.hypot(r.x-o.x,r.y-o.y)}return t}function Eu(e,t){let n=!1;for(let o=0,r=t.length-1;o<t.length;r=o++){let i=t[o],s=t[r];i.y>e.y!=s.y>e.y&&e.x<(s.x-i.x)*(e.y-i.y)/(s.y-i.y)+i.x&&(n=!n)}return n}function Au(e){return{kind:"radial",rowCount:0,rows:[],nearestRow:()=>-1,depthAt:(t,n)=>Math.hypot(t-e.x,n-e.y),gradientAt:(t,n)=>{let o=t-e.x,r=n-e.y,i=Math.hypot(o,r);return i<1e-9?[0,0]:[o/i,r/i]}}}function _u(e,t){if(!e.length)return null;let n=0,o=0,r=0;for(let h of e)n+=h.x,o+=h.y,r+=Math.hypot(h.x-t.x,h.y-t.y);let i=e.length;n/=i,o/=i,r/=i;let s=e[0],a=-1;for(let h of e){let d=Math.hypot(h.x-n,h.y-o);d>a&&(a=d,s=h)}let c=s.x-n,u=s.y-o,l=Math.hypot(c,u);l>1e-9?(c/=l,u/=l):(c=1,u=0);let f=[...e].sort((h,d)=>(h.x-n)*c+(h.y-o)*u-((d.x-n)*c+(d.y-o)*u)),m=0;for(let h of f){let d=Math.hypot(h.x-n,h.y-o);d>m&&(m=d)}return{pts:f,cx:n,cy:o,radius:m,depth:r}}function Ui(e,t,n){let o=e.pts;if(o.length===1)return Math.hypot(t-o[0].x,n-o[0].y);let r=1/0;for(let i=0;i+1<o.length;i++){let s=o[i],a=o[i+1],c=a.x-s.x,u=a.y-s.y,l=c*c+u*u,f=l>1e-12?((t-s.x)*c+(n-s.y)*u)/l:0;f<0?f=0:f>1&&(f=1);let m=Math.hypot(t-(s.x+f*c),n-(s.y+f*u));m<r&&(r=m)}return r}var En=8;function vu(e,t,n){let o=new Array(En).fill(1/0),r=new Array(En).fill(-1);for(let l=0;l<e.length;l++){let f=e[l],m=Math.hypot(t-f.cx,n-f.cy)-f.radius;for(let h=0;h<En;h++)if(m<o[h]){for(let d=En-1;d>h;d--)o[d]=o[d-1],r[d]=r[d-1];o[h]=m,r[h]=l;break}}let i=new Array(3).fill(1/0),s=new Array(3).fill(-1);for(let l of r){if(l<0)continue;let f=Ui(e[l],t,n);for(let m=0;m<3;m++)if(f<i[m]){for(let h=2;h>m;h--)i[h]=i[h-1],s[h]=s[h-1];i[m]=f,s[m]=l;break}}if(s[0]<0)return 0;if(i[0]<1e-6)return e[s[0]].depth;let a=i[0]*2.2,c=0,u=0;for(let l=0;l<3;l++){let f=s[l];if(f<0||i[l]>a)continue;let m=1/(i[l]*i[l]);c+=m*e[f].depth,u+=m}return u>0?c/u:e[s[0]].depth}function Cu(e){let t=(o,r)=>vu(e,o,r),n=(o,r)=>{let i=1/0,s=-1;for(let a=0;a<e.length;a++){let c=e[a];if(Math.hypot(o-c.cx,r-c.cy)-c.radius>=i)continue;let u=Ui(c,o,r);u<i&&(i=u,s=a)}return s};return{kind:"rows",rowCount:e.length,rows:e,nearestRow:n,depthAt:t,gradientAt:(o,r)=>{let i=(t(o+.5,r)-t(o-.5,r))/1,s=(t(o,r+.5)-t(o,r-.5))/(2*.5),a=Math.hypot(i,s);return a<1e-9?[0,0]:[i/a,s/a]}}}function Xi(e,t){let n=[];for(let o of e){let r=_u(o.points,t);r&&n.push(r)}return n.length<2?Au(t):(n.sort((o,r)=>o.depth-r.depth),Cu(n))}var nt=.06,ku=.05,Yi=.05,Ki=.15,Ro=25;function Wi(e,t,n){let o=new Map,r=new Array(t.length).fill(null),i=new Float64Array(t.length),s=new Array(t.length).fill(void 0),a=new Array(t.length).fill(void 0),c=new Map,u=[],l=new Set;for(let m=0;m<e.length;m+=1){let h=e[m];for(let d of h.objects){if(d.type==="table"&&l.add(d.id),d.type!=="section"||!d.outline||d.outline.length<3)continue;let p=Le(d.outline,Te);c.set(d.id,{section:d,unit:h,frontU:1/0,hasSeats:!1,rows:new Map,seatIndices:[]}),u.push({id:d.id,floorIndex:m,box:Ye(p),section:d,unit:h,outline:p})}}let f=new Map;for(let m of u){let h=f.get(m.floorIndex);h?h.push(m):f.set(m.floorIndex,[m])}for(let m=0;m<t.length;m++){let h=t[m],d=n?f.get(n[m])??[]:u,p=h.sectionId?d.find(g=>g.id===h.sectionId)??d.find(g=>g.section.logicalSectionId===h.sectionId&&Pe({x:h.x,y:h.y},g.outline,g.section.holes)):void 0,y=p?[p]:d;for(let g of y){if(n&&g.floorIndex!==n[m]||!p&&(h.x<g.box.minX||h.x>g.box.maxX||h.y<g.box.minY||h.y>g.box.maxY||!Pe({x:h.x,y:h.y},g.outline,g.section.holes)))continue;r[m]=g.id;let M=c.get(g.id);M.hasSeats=!0;let P=h.focalPoint??g.unit.focal,w=Math.hypot(h.x-P.x,h.y-P.y);w<M.frontU&&(M.frontU=w),M.seatIndices.push(m);let x=h.rowId||`__seat-${m}`,b=M.rows.get(x);b?b.push({x:h.x,y:h.y}):M.rows.set(x,[{x:h.x,y:h.y}]);break}}for(let[m,h]of c){let d=Qe(h.section,{floorBaseHeightM:h.unit.baseHeightM}),p=h.unit.baseHeightM,y=d.rake>0?Math.tan(d.rake*Math.PI/180):0,g=d.rake<=.01&&d.height<=p+.001,M=h.section.surfaceKind,P=M==="flat"?!0:M==="rakedRows"&&d.rake>.01?!1:g,w=h.hasSeats?nn(m,t,h.seatIndices,h.unit.focal):{sectionId:m,rows:[],blockCount:0},b=w.rows.length<2?Xi([...h.rows.values()].map(O=>({points:O})),h.unit.focal):null,S=1/0;if(b){if(h.hasSeats)for(let O of h.rows.values())for(let F of O){let D=b.depthAt(F.x,F.y);D<S&&(S=D)}if(!h.hasSeats||!Number.isFinite(S)){S=1/0;for(let O of h.section.outline){let F=b.depthAt(O.x,O.y);F<S&&(S=F)}}}let I=p+ku,R=Math.max(I,d.height),k=O=>{let F=Math.max(0,O-S)*$,D=Math.min(F*y,Ro);return Math.max(I,d.height+D)},L=O=>{let F=Math.max(0,O)*$,D=Math.min(F*y,Ro);return Math.max(I,d.height+D)},T=P?[]:w.rows.map(O=>({pts:O.pts,y:L(O.blockDepth),depth:O.blockDepth,blockId:O.blockId,...l.has(O.id)?{patch:Ai(O.pts,Te)}:{}})),v=T.length?T[0].y:R,A=T.map(O=>{let F=O.patch&&O.patch.length>=3?O.patch:O.pts,D=0,j=0;for(let V of F)D+=V.x,j+=V.y;let N=F.length||1;D/=N,j/=N;let X=0;for(let V of F){let Z=Math.hypot(V.x-D,V.y-j);Z>X&&(X=Z)}return{cx:D,cy:j,rad:X}}),_=P?()=>R:T.length>=2?(O,F)=>{let D=1/0,j=v;for(let N=0;N<T.length;N++){let X=A[N];if(Math.hypot(O-X.cx,F-X.cy)-X.rad>=D)continue;let V=T[N].patch,Z=V&&V.length>=3?_e(V,O,F)?0:bt(V,O,F):bt(T[N].pts,O,F);Z<D&&(D=Z,j=T[N].y)}return j}:(O,F)=>b?k(b.depthAt(O,F)):R,C=[0,1,0],B=T.length>=2||P?()=>C:(O,F)=>{if(!b)return C;let D=b.depthAt(O,F);if(D<=S)return C;let j=(D-S)*$;if(j*y>=Ro||d.height+j*y<=I)return C;let[N,X]=b.gradientAt(O,F);if(N===0&&X===0)return C;let V=1/Math.hypot(y,1);return[-N*y*V,V,-X*y*V]};if(!P)for(let O of w.rows){let F=L(O.blockDepth);for(let D of O.seatIndices)s[D]=F}for(let O of w.rows){let F=[];for(let V=1;V<O.pts.length;V++){let Z=Math.hypot(O.pts[V].x-O.pts[V-1].x,O.pts[V].y-O.pts[V-1].y);Z>1e-6&&F.push(Z)}F.sort((V,Z)=>V-Z);let D=F.length?F[Math.floor(F.length/2)]:1/0,j=1/0,N=O.pts[Math.floor(O.pts.length/2)];if(N)for(let V of w.rows){if(V===O||V.blockId!==O.blockId)continue;let Z=bt(V.pts,N.x,N.y);Z>1e-6&&Z<j&&(j=Z)}let X=Math.min(D,Math.max(j,D*.5));if(Number.isFinite(X)&&X>0)for(let V of O.seatIndices)a[V]=X}o.set(m,{sectionId:m,deckAt:_,normalAt:B,flat:P,bottomY:p,rowLevels:T,landingY:v})}for(let m=0;m<t.length;m++){let h=r[m],d=t[m];if(h){let g=s[m];i[m]=(g??o.get(h).deckAt(d.x,d.y))+Ki;continue}let p=d.eyeHeightM,y=Number.isFinite(p)?Math.max(0,p-je):0;i[m]=d.kind==="booth"?y+nt+Ki:y}return{bySection:o,seatOwner:r,seatDeckY:m=>i[m],seatPitchU:m=>a[m]}}function vt(e,t,n){if(e.length!==4||n<=t)return null;let o=ve(e),r=Math.hypot(o[1].x-o[0].x,o[1].y-o[0].y)*E,i=Math.hypot(o[3].x-o[0].x,o[3].y-o[0].y)*E;if(r<1e-6||i<1e-6)return null;let s=Math.min(.22/r,.16),a=Math.min(.28,(n-t)*.13),c=Math.min(.065/i,.2);return{quad:o,side:s,face:c,opening:we(o,s,1-s),openingTop:n-a}}function wo(e,t,n){if(e.length!==4||n-t<=.2)return null;let o=ve(e),r=Math.hypot(o[1].x-o[0].x,o[1].y-o[0].y)*E;if(r<=1e-6)return null;let i=Math.min(.14,(n-t)*.08,r*.08),s=i/r,a=we(o,s,1-s);return{quad:o,side:s,trim:i,inner:a,panel:Wt(a,.15,.85),bottom:t+i,top:n-i}}function zi(e,t,n,o){let r=wo(e,t,n);if(!r)return;let{panel:i}=r,s=(M,P)=>({x:(M.x+P.x)/2,y:(M.y+P.y)/2}),a=s(i[0],i[1]),c=s(i[3],i[2]),u=Math.hypot(a.x-o.x,a.y-o.y)<=Math.hypot(c.x-o.x,c.y-o.y),[l,f]=u?[i[0],i[1]]:[i[3],i[2]],m=u?{x:a.x-c.x,y:a.y-c.y}:{x:c.x-a.x,y:c.y-a.y},h=Math.hypot(m.x,m.y);if(h<1e-6)return;-(f.y-l.y)*m.x+(f.x-l.x)*m.y<0&&([l,f]=[f,l]);let d=Math.min(.006,h*E*.05),p=m.x/h*d,y=m.y/h*d,g=(M,P)=>[M.x*E+p,P,M.y*E+y];return[g(l,r.bottom),g(f,r.bottom),g(l,r.top),g(f,r.top)]}var $i=Ge(require("polygon-clipping"),1);var Zi=Ge(require("polygon-clipping"),1);function We(e,t,n,o,r,i,s,a={}){let c=Ye(t),u=a.ao??K,l=r.flatMap(p=>{if(p.role!=="entrance"&&p.role!=="exit")return[];let y=ie(p);if(!y||y.length!==4||!Mt(c,Ye(y)))return[];let g=a.portalBase??n,M=vt(y,g,g+Fe(p).heightM);if(!M)return[];let P=Math.min(o,M.openingTop);return P<=n?[]:[{poly:M.opening,height:P}]});if(!l.length)return!1;let f=p=>p.map(y=>[y.x,y.y]),m=[f(t),...(a.holes??[]).map(f)],h=[n,...new Set(l.map(p=>p.height)),o].sort((p,y)=>p-y),d=[];try{for(let p=1;p<h.length;p++){let y=h[p-1],g=h[p];if(g-y<1e-6)continue;let M=l.filter(w=>w.height>y+1e-6).map(w=>[f(w.poly)]),P=M.length?Zi.default.difference(m,...M):[m];d.push({low:y,high:g,polys:P})}}catch{return!1}for(let p of d)for(let y of p.polys){let[g,...M]=y.map(w=>w.map(([x,b])=>({x,y:b}))),P=w=>u.wallBottom+(u.top-u.wallBottom)*(w-n)/(o-n);z(e,g,M,()=>p.high,p.low,i,s,{...u,top:P(p.high),wallBottom:P(p.low)})}return!0}var Eo={depthM:1.6,thicknessM:.35,minWallM:6};function An(e,t,n,o,r,i,s,a,c){let u=o-n;if(u<=0)return;let l=a&&(c??u)>=Eo.minWallM?Ou(t,a):null,f=l?o-Eo.thicknessM:o,m=f-n,h=m<1.5?[[n,f,1]]:l?[[n,n+Math.min(.9,m*.18),.82],[n+Math.min(.9,m*.18),f,1]]:[[n,n+Math.min(.9,m*.18),.82],[n+Math.min(.9,m*.18),f-.1,1],[f-.1,f,1.1]],d=p=>K.wallBottom+(K.top-K.wallBottom)*(p-n)/u;for(let[p,y,g]of h){let M={...K,top:d(y),wallBottom:d(p)},P=W(i,g),w=W(s,g);We(e,t,p,y,r,P,w,{portalBase:n,ao:M})||z(e,t,void 0,()=>y,p,P,w,M)}for(let[p,...y]of l??[])z(e,p,y.length?y:void 0,()=>o,f,W(i,1.12),W(s,.78),K)}function Ou(e,t){let n=Eo.depthM/E,o=e.map(s=>{let a=t.x-s.x,c=t.y-s.y,u=Math.hypot(a,c)||1;return{x:s.x+a/u*n,y:s.y+c/u*n}}),r=s=>{let a=s.map(c=>[c.x,c.y]);return a.push(a[0]),a},i=[[r(e)],[r(o)]];for(let s=0;s<e.length;s++){let a=(s+1)%e.length;i.push([r([e[s],e[a],o[a],o[s]])])}try{let[s,...a]=i,c=$i.default.union(s,...a);return c.length?c.map(u=>u.map(l=>l.slice(0,-1).map(([f,m])=>({x:f,y:m})))):null}catch{return null}}function Qi(e){return e.route?.stepFree===!0&&(e.kind==="line"||e.kind==="polyline")}function qi(e){let t=Number.isFinite(e)&&e>0?e:4;return[Math.max(6,t*2.6),Math.max(4,t*1.7)]}function Ji(e,t,n){let o=[];if(e.length<2||!(t>0)||!(n>=0))return o;let r=!0,i=t;for(let s=0;s<e.length-1;s+=1){let a=e[s],c=e[s+1],u=Math.hypot(c.x-a.x,c.y-a.y);if(u<1e-9)continue;let l=(c.x-a.x)/u,f=(c.y-a.y)/u,m=0;for(;m<u-1e-9;){let h=Math.min(i,u-m);r&&o.push([{x:a.x+l*m,y:a.y+f*m},{x:a.x+l*(m+h),y:a.y+f*(m+h)}]),m+=h,i-=h,i<=1e-9&&(r=!r,i=r?t:n)}}return o}function zt(e,t,n){let o=oe(t.stroke?.color),r=t.stroke?.width??0;if(!o||!Number.isFinite(r)||r<=0)return;let i=t.kind==="line"||t.kind==="polyline",s=i?At(t.points??[],t.rotation):ie(t);if(!s||s.length<2)return;let a=r*.5,c=Qi(t)?Ji(s,...qi(r)):Array.from({length:i?s.length-1:s.length},(u,l)=>[s[l],s[(l+1)%s.length]]);for(let[u,l]of c){let f=Math.hypot(l.x-u.x,l.y-u.y);if(f<1e-6)continue;let m=-(l.y-u.y)/f*a,h=(l.x-u.x)/f*a,d=[(u.x+m)*E,n,(u.y+h)*E],p=[(l.x+m)*E,n,(l.y+h)*E],y=[(l.x-m)*E,n,(l.y-h)*E],g=[(u.x-m)*E,n,(u.y-h)*E];e.tri(d,p,y,[0,1,0],o),e.tri(d,y,g,[0,1,0],o)}}function es(e){return e==="bar"||e==="concession"||e==="coat"||e==="restroom"}var Ct=(e,t,n)=>({x:e.x+(t.x-e.x)*n,y:e.y+(t.y-e.y)*n});function _n(e,t,n,o){let[r,i,s,a]=t?e:[e[3],e[2],e[1],e[0]];return[Ct(r,a,n),Ct(i,s,n),Ct(i,s,o),Ct(r,a,o)]}function ts(e,t,n,o,r,i,s,a,c=!1){if(n.length!==4||r-o<.4)return!1;let u=I=>c?Math.min(I,r):I,l=ve(n),f=Math.hypot(l[3].x-l[0].x,l[3].y-l[0].y)*E;if(f<.4)return!1;let m=Ct(l[0],l[1],.5),h=Ct(l[3],l[2],.5),d=Math.hypot(m.x-a.x,m.y-a.y)<=Math.hypot(h.x-a.x,h.y-a.y),p=re(s,[.92,.9,.86],.35),y=W(i,.72),g=r-o;if(t==="restroom"){let I=Math.min(.18,g*.08);return ne(e,l,r-I,o,s,i),ne(e,l,r,r-I,p,p),!0}let M=o+Math.min(1.1,g),P=t==="coat"?1:Math.min(.5,.75/f),w=_n(l,d,0,P);if(ne(e,w,M-.05,o,y,i),ne(e,w,M,M-.05,p,p),t==="coat"||f<1.2)return!0;if(t==="bar"){let I=_n(l,d,Math.max(P+.2,1-.45/f),1),R=u(o+Math.max(Math.min(2.2,g*2),M-o+.6));return ne(e,I,R,o,s,y),!0}let x=_n(l,d,Math.max(P+.25,.55),1),b=u(o+Math.max(2.6,M-o+1.4));if(b-.14<=M)return!0;ne(e,x,b-.14,o,s,i),ne(e,l,b,b-.14,p,y);let S=Math.min(.08,.1/Math.max(.1,Math.hypot(l[1].x-l[0].x,l[1].y-l[0].y)*E));for(let[I,R]of[[0,S],[1-S,1]])ne(e,_n(we(l,I,R),d,0,Math.min(.08,.1/f)),b-.14,M,y,y);return!0}var Tu=[.12,.38,.16],Lu=[.72,.62,.45],Bu=[.88,.93,.96],ns=[.95,.95,.94],Fu=[.66,.29,.22],Ao={length:20.12,width:3.05},Nu=.14,Du=9.76,ze=[.93,.94,.95],vn=[.1,.11,.13],Gu=[.45,.85,1.25],ju=1.45,os=.012,rs=.004,Hu=1.07,Vu=.15;function Ot(e,t,n,o,r,i){e.setMaterial(i),z(e,t,n?[n.slice().reverse()]:void 0,()=>o,o-.004,r,r,K)}var is=(e,t)=>Je(e,t/E);function ss(e,t,n){let o=t.x-e.x,r=t.y-e.y,i=Math.hypot(o,r);if(i<1e-9)return null;let s=-r/i*n,a=o/i*n;return[{x:e.x+s,y:e.y+a},{x:t.x+s,y:t.y+a},{x:t.x-s,y:t.y-a},{x:e.x-s,y:e.y-a}]}function Uu(e,t,n,o){let r=t.map(i=>[i.x*E,n,i.y*E]);e.tri(r[0],r[1],r[2],[0,1,0],o),e.tri(r[0],r[2],r[3],[0,1,0],o)}function Cn(e,t,n,o,r,i){let s=n/E,a=[{x:t.x-s,y:t.y-s},{x:t.x+s,y:t.y-s},{x:t.x+s,y:t.y+s},{x:t.x-s,y:t.y+s}];z(e,a,void 0,()=>r,o,i,W(i,.85),K)}function kt(e,t,n,o,r,i,s){let a=ss(t,n,o/E);a&&z(e,a,void 0,()=>i,r,s,W(s,.85),K)}function kn(e){let t=ve(e),n={x:(t[0].x+t[2].x)/2,y:(t[0].y+t[2].y)/2},o=Math.hypot(t[1].x-t[0].x,t[1].y-t[0].y)||1,r=Math.hypot(t[3].x-t[0].x,t[3].y-t[0].y)||1,i={x:(t[1].x-t[0].x)/o,y:(t[1].y-t[0].y)/o},s={x:(t[3].x-t[0].x)/r,y:(t[3].y-t[0].y)/r};return{at:(c,u)=>({x:n.x+(i.x*c+s.x*u)/E,y:n.y+(i.y*c+s.y*u)/E}),lengthM:o*E,widthM:r*E}}function as(e,t,n){let o=Pr(t);if(!o.length)return;let r=1/0,i=-1/0,s=1/0,a=-1/0;for(let P of t.points??[])r=Math.min(r,P.x),i=Math.max(i,P.x),s=Math.min(s,P.y),a=Math.max(a,P.y);let c=(t.rotation??0)*Math.PI/180,u=Math.cos(c),l=Math.sin(c),f=(r+i)/2,m=(s+a)/2,h=P=>c?{x:f+(P.x-f)*u-(P.y-m)*l,y:m+(P.x-f)*l+(P.y-m)*u}:P,d=Math.min(i-r,a-s)*E,p=Math.max(.04,Math.min(.3,d*.004))/E,y=0;e.setMaterial(0);for(let P of o){if(!P.fill)continue;let w=P.points.map(h);Ot(e,w,null,n+os+y*rs,oe(P.fill)??ze,0),y++}let g=o.filter(P=>!(P.fill&&P.ink===P.fill)),M=[...new Set(g.map(P=>P.ink??rn))];for(let P of M){let w=n+os+y++*rs,x=oe(P)??ze;for(let b of g){if((b.ink??rn)!==P)continue;let S=b.points.map(h),I=b.closed?S.length:S.length-1;for(let R=0;R<I;R++){let k=ss(S[R],S[(R+1)%S.length],p);k&&Uu(e,k,w,x)}}}}function cs(e,t,n,o,r){if(t.length<3)return!1;let i=o+.006,s=r??Tu;if(n==="oval-cricket"){let a=t.reduce((x,b)=>x+b.x,0)/t.length,c=t.reduce((x,b)=>x+b.y,0)/t.length,u=x=>t.map(b=>({x:a+(b.x-a)*x,y:c+(b.y-c)*x})),l=8;for(let x=0;x<l;x++){let b=u(1-x/l),S=x===l-1?null:u(1-(x+1)/l);Ot(e,b,S,i,W(s,x%2?1.04:.96),4)}let f=t[0];for(let x of t)Math.hypot(x.x-a,x.y-c)>Math.hypot(f.x-a,f.y-c)&&(f=x);let m=Math.hypot(f.x-a,f.y-c)||1,h=(f.x-a)/m,d=(f.y-c)/m,p=-d,y=h,g=Math.min(1,2*m*E*Nu/Ao.length),M=Ao.length*g/2/E,P=Ao.width*g/2/E,w=[[-M,-P],[M,-P],[M,P],[-M,P]].map(([x,b])=>({x:a+h*x+p*b,y:c+d*x+y*b}));return Ot(e,w,null,i+.004,Lu,0),e.setMaterial(0),!0}if(n==="rink-hockey"){let a=is(t,Vu);return Ot(e,a,null,i,Bu,0),e.setMaterial(0),z(e,t,[a.slice().reverse()],()=>o+Hu,o,ns,W(ns,.9),K),!0}if(n==="ring-boxing"&&t.length===4){let{at:a}=kn(t),c=[a(-3.05,-3.05),a(3.05,-3.05),a(3.05,3.05),a(-3.05,3.05)],u=[[.77,.19,.19],ze,[.17,.42,.69],ze];e.setMaterial(0),c.forEach((l,f)=>Cn(e,l,.07,o,o+ju,u[f]));for(let l of Gu)for(let f=0;f<4;f++)kt(e,c[f],c[(f+1)%4],.025,o+l-.025,o+l+.025,ze);return!0}if(n==="court-tennis"&&t.length===4){let{at:a}=kn(t);e.setMaterial(0),kt(e,a(0,-6.4),a(0,6.4),.015,o,o+.95,vn),kt(e,a(0,-6.4),a(0,6.4),.03,o+.95,o+1,ze);for(let c of[-1,1])Cn(e,a(0,c*6.4),.05,o,o+1.07,vn);return!0}if(n==="court-basketball"&&t.length===4){let{at:a,lengthM:c}=kn(t),u=Math.min(14,c/2-.5);e.setMaterial(0);for(let l of[-1,1]){let f=a(l*(u+1.2),0),m=a(l*(u-1.2),0);Cn(e,f,.12,o,o+3.4,vn),kt(e,f,m,.06,o+3.25,o+3.4,vn),kt(e,a(l*(u-1.2),-.9),a(l*(u-1.2),.9),.03,o+2.9,o+3.95,ze)}return!0}if(n==="pitch-rugby"&&t.length===4){let{at:a,lengthM:c}=kn(t),u=c*(50/120);e.setMaterial(0);for(let l of[-1,1]){for(let f of[-2.8,2.8])Cn(e,a(l*u,f),.07,o,o+12,ze);kt(e,a(l*u,-2.8),a(l*u,2.8),.06,o+2.94,o+3.06,ze)}return!0}if(n==="track-athletics"){let a=is(t,Du);return a.length<3?!1:(Ot(e,t,a,i,Fu,0),Ot(e,a,null,i,s,4),e.setMaterial(0),!0)}return!1}var ls=[.19,.4,.15],Xu=.012,Bn=2.4,Ku=1,Yu=.75,Wu=.15;function Ne(e){if(e.points&&e.points.length>=3)return e.points;let{center:t,width:n,height:o,rotation:r}=e;if(!n||!o)return null;let i=(r??0)*Math.PI/180,s=Math.cos(i),a=Math.sin(i),c=n/2,u=o/2;return[[-c,-u],[c,-u],[c,u],[-c,u]].map(([l,f])=>({x:t.x+l*s-f*a,y:t.y+l*a+f*s}))}function bs(e,t,n,o,r,i,s=!1){let a=Ne(t);if(a){if(s){let c=mt(o,r.boothTop),u=He([...a]);z(e,Le(u,zu/E),[u.slice().reverse()],()=>n+.03,n,c,W(c,.8),K);return}if(!(!t.points&&i&&$u(e,a,n,o,i))){if(!t.points&&i&&a.length===4){Zu(e,a,n,o,i);return}z(e,a,void 0,()=>n+Bn,n,mt(o,r.boothTop),r.boothWall,K)}}}var _o=1.1,us=[.9,.9,.88],zu=.1,On=[.87,.87,.85],fs=.08;function ys(e,t){let n=c=>({x:(e[c].x+e[(c+1)%4].x)/2,y:(e[c].y+e[(c+1)%4].y)/2}),o=0,r=1/0;for(let c=0;c<4;c++){let u=n(c),l=Math.hypot(u.x-t.x,u.y-t.y);l<r&&(r=l,o=c)}let i=[0,1,2,3].map(c=>e[(o+c)%4]),s=(c,u,l)=>({x:c.x+(u.x-c.x)*l,y:c.y+(u.y-c.y)*l});return{q:i,part:(c,u,l,f)=>{let m=s(i[0],i[1],c),h=s(i[0],i[1],u),d=s(i[3],i[2],c),p=s(i[3],i[2],u);return[s(m,d,l),s(h,p,l),s(h,p,f),s(m,d,f)]},depthM:Math.hypot(i[3].x-i[0].x,i[3].y-i[0].y)*E,widthM:Math.hypot(i[1].x-i[0].x,i[1].y-i[0].y)*E}}function Zu(e,t,n,o,r){let{q:i,part:s}=ys(t,r),a=o??[.35,.42,.55],c=re(a,[.78,.78,.77],.62),u=re(a,[.95,.95,.94],.45);ne(e,i,n+nt,n,c,W(c,.8)),ne(e,s(.05,.95,.72,.98),n+_o-.05,n+nt,u,W(u,.8)),ne(e,s(.03,.97,.7,1),n+_o,n+_o-.05,us,W(us,.9))}function $u(e,t,n,o,r){if(t.length!==4)return!1;let{q:i,part:s,depthM:a,widthM:c}=ys(t,r);if(a<1||c<1)return!1;let u=o??[.35,.42,.55],l=re(u,[.78,.78,.77],.62),f=n+Bn,m=fs/c,h=fs/a;ne(e,i,n+nt,n,l,W(l,.8)),ne(e,s(0,1,1-h,1),f,n+nt,On,W(On,.9));for(let[y,g]of[[0,m],[1-m,1]])ne(e,s(y,g,0,1-h),f,n+nt,On,W(On,.9));ne(e,s(m,1-m,0,Math.min(.5,.06/a)),f,f-.3,u,W(u,.85));let d=Math.min(.4,.6/c),p=Math.min(.12,.3/a);return ne(e,s(.5-d,.5+d,.72-p,.72+p),n+Ku,n+nt,re(u,[.95,.95,.94],.7),W(u,.75)),!0}function Fn(e){if(e.shape==="round"){let l=e.radius;return l?mn(e.center.x,e.center.y,l,l,24):null}let{width:t,height:n,rotation:o,center:r}=e;if(!t||!n)return null;let i=(o??0)*Math.PI/180,s=Math.cos(i),a=Math.sin(i),c=t/2,u=n/2;return[[-c,-u],[c,-u],[c,u],[-c,u]].map(([l,f])=>({x:r.x+l*s-f*a,y:r.y+l*a+f*s}))}function gs(e,t,n,o,r,i=!0){let s=Fn(t);if(!s)return;let a=s.reduce((m,h)=>m+h.x,0)/s.length,c=s.reduce((m,h)=>m+h.y,0)/s.length,u=m=>s.map(h=>({x:a+(h.x-a)*m,y:c+(h.y-c)*m})),l=i&&o?mt(o,r.tableTop):Qu,f=n+Yu;z(e,s,void 0,()=>f,n+qu,l,W(l,.86),K),z(e,u(.12),void 0,()=>f+.12,f,ms,W(ms,.8),K)}var Qu=[.93,.92,.89],ms=[.78,.66,.42],qu=.25,Zt={armM:1.1,widthM:.28,insideM:1.4,low:.043,high:.048};function Ju(e,t,n){let o=e.reduce((g,M)=>g+M.x,0)/4,r=e.reduce((g,M)=>g+M.y,0)/4,i=e[3].x-e[0].x,s=e[3].y-e[0].y,a=Math.hypot(i,s)||1;i/=a,s/=a,i*(t.x-o)+s*(t.y-r)<0&&(i=-i,s=-s);let c=-s,u=i,l=Zt.armM/E,f=Zt.widthM/E,m=a/2+Zt.insideM/E,h=n?-1:1,d=o+i*(m+(n?0:l)),p=r+s*(m+(n?0:l)),y=(g,M)=>({x:d+i*g*h+c*M,y:p+s*g*h+u*M});return[y(0,0),y(-l,l),y(-l-f,l),y(-f,0),y(-l-f,-l),y(-l,-l)]}function ef(e,t,n,o,r){let i=[.94,.95,.96];z(e,Ju(t,o,r),void 0,()=>n+Zt.high,n+Zt.low,i,i,K)}function Ln(e,t){let n=oe(e);return n?{top:W(Ve(n,.12),.95),wall:W(Ve(n,.12),.85)}:{top:t.tierTop,wall:t.tierWall}}function xs(e,t,n,o,r,i,s,a,c=[]){let u=ie(t),l=Gi(t);if(!t.role&&(!t.fill||t.fill==="none"||t.fill==="transparent")||!u){zt(e,t,n+o+Xu);return}let m=a?a.kind==="stage":t.role==="stage",h=a?a.kind==="screen":t.role==="screen",d=a?{kind:m?"stage":"solid",heightM:a.topY-a.baseY}:Fe(t),p=a?.baseY??n,y=a?.topY??n+o;if(m&&s){let T=1/0,v=-1/0,A=1/0,_=-1/0;for(let C of u)C.x<T&&(T=C.x),C.x>v&&(v=C.x),C.y<A&&(A=C.y),C.y>_&&(_=C.y);s.push({cx:(T+v)/2*E,cz:(A+_)/2*E,y,halfX:Math.max((v-T)/2*E,.5),halfZ:Math.max((_-A)/2*E,.5)})}let g=oe(t.fill),M=t.role==="wall"||t.role==="entrance"||t.role==="exit",P=M?Ln(t.fill,r).top:m&&g?re(r.stageTop,W(Ve(g,.18),.9),.9):!t.role&&g?g:mt(g,m?r.stageTop:r.decorTop),w=h?g:null,x=M?Ln(t.fill,r).wall:m?g?re(r.stageWall,W(g,.58),.82):r.stageWall:h?w?re(W(w,1.42),[.24,.46,.82],.08):[.24,.46,.82]:mt(oe(t.fill),r.decorWall),b=m&&yn(r)?xt(!0):null,S=b?ps(P,b.stageTop):P,I=b?ps(x,b.stageWall):x;if(t.role==="wall"&&!a){An(e,u,p,y,c,S,I,i),zt(e,t,y+.012);return}if(h&&u.length===4&&y-p>.2){let T=wo(u,p,y);if(!T)return;let{quad:v,side:A,trim:_,inner:C,panel:B}=T,O=[.12,.15,.18];for(let[F,D]of[[0,A],[1-A,1]])ne(e,we(v,F,D),y,p,O,O);ne(e,C,p+_,p,O,O),ne(e,C,y,y-_,O,O),ne(e,B,y-_,p+_,I,I),zt(e,t,y+.012);return}let R=g?W(Ve(g,.15),.82):I,k=g?W(Ve(g,.1),1.02):S;if(es(t.role)&&!a&&ts(e,t.role,u,p,y,R,k,i,t.heightM!==void 0))return;if((t.role==="sound"||a?.kind==="sound_desk")&&u.length===4&&y-p>.3){let T=ve(u),v=Math.hypot(T[1].x-T[0].x,T[1].y-T[0].y)*E,A=Math.min(.12,.09/Math.max(v,.001)),_=[.18,.21,.24],C=y-Math.min(.12,(y-p)*.15);for(let[B,O]of[[0,A],[1-A,1]])ne(e,we(T,B,O),C,p,_,_);ne(e,T,y,C,S,_);return}if(t.role==="rail"&&u.length===4&&y>p){let T=ve(u),v=Math.hypot(T[1].x-T[0].x,T[1].y-T[0].y)*E,A=Math.max(1,Math.min(128,Math.ceil(v/1.4))),_=Math.min(.08,.055/Math.max(.055,v)),C=[.58,.64,.66];for(let B=0;B<=A;B++){let O=B/A,F=Math.min(1-_,Math.max(0,O-_/2));ne(e,we(T,F,F+_),y,p,C,W(C,.8))}for(let B of[.52,1]){let O=p+(y-p)*B;ne(e,T,O,Math.max(p,O-.055),C,W(C,.8))}return}if(t.role==="goal"&&u.length===4){let T=ve(u),v=Math.hypot(T[1].x-T[0].x,T[1].y-T[0].y)*E,A=Math.min(.12,.1/Math.max(.1,v)),_=[.9,.94,.94];for(let[C,B]of[[0,A],[1-A,1]])ne(e,we(T,C,B),Math.max(p,y-.1),p,_,_);ne(e,T,y,Math.max(p,y-.1),_,_);return}if(d.kind==="portal"&&u.length===4){let T=vt(u,p,y);if(!T)return;let{quad:v,side:A,face:_,openingTop:C}=T;for(let[B,O,F]of[[0,_,1],[_,1-_,.67],[1-_,1,1]]){let D=Wt(v,B,O),j=W(S,F),N=W(I,F);for(let[X,V]of[[0,A],[1-A,1]])ne(e,we(D,X,V),C,p,j,N);ne(e,D,y,C,j,N)}(t.role==="entrance"||t.role==="exit")&&ef(e,v,p,i,t.role==="exit");return}if(d.kind==="suite"&&u.length===4){let T=u.map((_,C)=>{let B=u[(C+1)%4],O=(_.x+B.x)/2,F=(_.y+B.y)/2;return Math.hypot(O-i.x,F-i.y)}),v=T.indexOf(Math.min(...T)),A=[0,1,2,3].map(_=>u[(v+_)%4]);ne(e,we(A,0,.08),y,p,S,I),ne(e,we(A,.92,1),y,p,S,I),ne(e,Wt(A,.88,1),y,p,S,I),ne(e,A,y,Math.max(p,y-.18),S,I);return}if(m&&!t.stageKind?.startsWith("pitch-")&&y-p>.12){let T=y-Math.min(.06,(y-p)*.15);ne(e,u,T,p,S,I,l),ne(e,u,y,T,S,re(S,I,.2),l)}else ne(e,u,y,p,S,I,l);if((t.stageKind==="pitch-football"||t.stageKind==="pitch-rugby")&&u.length===4){e.setMaterial(4);let T=ve(u),v=re(g??ls,ls,g?.45:0);for(let A=0;A<12;A++){let _=we(T,A/12,(A+1)/12),C=W(v,A%2?1.09:.91),B=_.map(O=>[O.x*E,y+.006,O.y*E]);e.tri(B[0],B[1],B[2],[0,1,0],C),e.tri(B[0],B[2],B[3],[0,1,0],C)}}t.stageKind&&t.stageKind!=="pitch-football"&&cs(e,u,t.stageKind,y,g),m&&st(t.stageKind)&&as(e,t,y),e.setMaterial(h?1:0),zt(e,t,y+.012)}function Nn(e){let{x:t,y:n,width:o,height:r}=e;if(!o||!r)return null;let i=t+o/2,s=n+r/2,a=(e.rotation??0)*Math.PI/180,c=Math.cos(a),u=Math.sin(a),l=o/2,f=r/2;return[[-l,-f],[l,-f],[l,f],[-l,f]].map(([m,h])=>({x:i+m*c-h*u,y:s+m*u+h*c}))}function tf(e){if(!e||!e.startsWith("data:image/svg+xml"))return null;let t=e.slice(e.indexOf(",")+1);if(/;base64/i.test(e.slice(0,e.indexOf(","))))try{t=atob(t)}catch{return null}else try{t=decodeURIComponent(t)}catch{}let n=t.match(/<(?:rect|path)\b[^>]*\bfill="([^"]+)"/i);if(!n)return null;let o=n[1].trim();if(o==="none"||o==="transparent")return null;let r=o.match(/^url\(#([^)]+)\)$/);if(!r)return oe(o);let i=t.match(new RegExp(`<(?:linear|radial)Gradient\\b[^>]*\\bid="${r[1]}"[^>]*>([\\s\\S]*?)</(?:linear|radial)Gradient>`,"i"));if(!i)return null;let s=[];for(let a of i[1].matchAll(/stop-color="([^"]+)"/gi)){let c=oe(a[1].trim());c&&s.push(c)}return s.length?s.reduce((a,c,u)=>re(a,c,1/(u+1)),s[0]):null}function Ms(e,t,n,o){if(t.layer==="foreground")return;let r=Nn(t);if(!r)return;let i=n+Wu,s=mt(tf(t.href),o.decorTop),a=Math.max(0,Math.min(1,t.opacity??1));a<1&&(s=re(o.ground,s,a)),z(e,r,void 0,()=>i,n,s,re(s,o.decorWall,.5),K)}function Ss(e,t,n,o,r){if(!t.points||t.points.length<3)return;let i=fi(o,r.gaTop);z(e,t.points,t.holes,()=>n+hs,n,i,r.gaWall,K),rf(e,t.points,n+hs)}var hs=.15,Tn=[.72,.74,.76],vo=1.1,ds=.12,Co=.05,nf=.06,of=2.4;function rf(e,t,n){let o=He([...t]),r=Je(o,ds/E),i=Je(o,(ds+Co)/E);if(r.length<3||i.length<3)return;for(let a of[n+vo,n+vo*.5])z(e,r,[i.slice().reverse()],()=>a,a-Co,Tn,W(Tn,.85),K);let s=nf/2/E;for(let a=0;a<r.length;a++){let c=r[a],u=r[(a+1)%r.length],l=Math.hypot(u.x-c.x,u.y-c.y)*E,f=Math.max(1,Math.round(l/of));for(let m=0;m<f;m++){let h=m/f,d=c.x+(u.x-c.x)*h,p=c.y+(u.y-c.y)*h,y=[{x:d-s,y:p-s},{x:d+s,y:p-s},{x:d+s,y:p+s},{x:d-s,y:p+s}];z(e,y,void 0,()=>n+vo-Co,n,Tn,W(Tn,.8),K)}}}function ps(e,t){return hn(e)<t?ut(e,t):e}var ko=.6,Ps=3,sf=.25;function af(e,t){if(_e(t,e.x,e.y))return 0;let n=1/0;for(let o=0,r=t.length-1;o<t.length;r=o++){let i=t[r],s=t[o],a=s.x-i.x,c=s.y-i.y,u=a*a+c*c||1,l=Math.max(0,Math.min(1,((e.x-i.x)*a+(e.y-i.y)*c)/u));n=Math.min(n,Math.hypot(e.x-(i.x+l*a),e.y-(i.y+l*c)))}return n}function Is(e,t){let n=e.map(s=>({booth:s,ring:Ne(s)})).filter(s=>!!s.ring&&s.ring.length===4&&!s.booth.points),o=n.map(({ring:s})=>({minX:Math.min(...s.map(a=>a.x)),maxX:Math.max(...s.map(a=>a.x)),minY:Math.min(...s.map(a=>a.y)),maxY:Math.max(...s.map(a=>a.y))})),r=(Ps+ko)/E,i=new Map;return n.forEach(({booth:s,ring:a},c)=>{let u={x:a.reduce((h,d)=>h+d.x,0)/4,y:a.reduce((h,d)=>h+d.y,0)/4},l=[0,1,2,3].map(h=>{let d=a[h],p=a[(h+1)%4],y={x:(d.x+p.x)/2,y:(d.y+p.y)/2},g=y.x-u.x,M=y.y-u.y,P=Math.hypot(g,M)||1,w={x:y.x+g/P*ko/E,y:y.y+M/P*ko/E},x=Ps/E;return o.forEach((b,S)=>{S===c||w.x<b.minX-r||w.x>b.maxX+r||w.y<b.minY-r||w.y>b.maxY+r||(x=Math.min(x,af(w,n[S].ring)))}),{open:x*E,toward:{x:y.x+g/P*10/E,y:y.y+M/P*10/E},focal:Math.hypot(y.x-t.x,y.y-t.y)}}),f=Math.max(...l.map(h=>h.open)),m=l.filter(h=>h.open>=f-sf).sort((h,d)=>h.focal-d.focal)[0];i.set(s.id,m.toward)}),i}var Rs=Ge(require("polygon-clipping"),1);var cf=.45,lf=1500,uf=200;function ws(e,t){if(e.role!=="stage"||st(e.stageKind))return e;let n=ie(e);if(!n||n.length<3||Math.abs(Ae(n))*E*E>lf)return e;let o=t.filter(s=>_e(n,s.x,s.y));if(!o.length||o.length>uf)return e;let r=cf/E,i=o.map(s=>[[[s.x-r,s.y-r],[s.x+r,s.y-r],[s.x+r,s.y+r],[s.x-r,s.y+r],[s.x-r,s.y-r]]]);try{let s=Rs.default.difference([[...n.map(u=>[u.x,u.y]),[n[0].x,n[0].y]]],...i),a=null,c=0;for(let u of s){let l=u[0].slice(0,-1).map(([m,h])=>({x:m,y:h})),f=Math.abs(Ae(l));f>c&&(c=f,a=l)}return!a||a.length<3?e:{...e,kind:"polygon",points:a,rotation:0}}catch{return e}}var ff=Math.PI/180,se=96,mf=6,hf=60,df=150,Es=.2,pf=.35;function bf(e,t){let n=Math.atan2(t.x-e.x,t.y-e.y)/ff;return n<0?n+360:n}function Dn(e){if(!e.length)return NaN;let t=[...e].sort((n,o)=>n-o);return t[Math.floor(t.length/2)]}function Gn(e,t,n=2){let o=e.length,r=new Float64Array(o);for(let i=0;i<o;i++){let s=0,a=0;for(let c=-n;c<=n;c++){let u=i+c;if(t)u=(u%o+o)%o;else if(u<0||u>=o)continue;s+=e[u],a++}r[i]=s/a}return r}function As(e,t){let n=e.filter(m=>m.rows.length>=1);if(n.length<1)return null;let o=[],r=0,i=0,s=0;for(let m of n)for(let h of m.rows){for(let d of h.pts)r+=d.x,i+=d.y,s++;if(h.pts.length>=4){let d=Jn(h.pts);d&&Number.isFinite(d.cx)&&Number.isFinite(d.cy)&&o.push({x:d.cx,y:d.cy})}}if(!s)return null;let a={x:r/s,y:i/s},c=a;if(o.length>=8){let m=Dn(o.map(g=>g.x)),h=Dn(o.map(g=>g.y)),d=0;for(let g of n)for(let M of g.rows)for(let P of M.pts){let w=Math.hypot(P.x-a.x,P.y-a.y);w>d&&(d=w)}let p=0,y=d*.2;for(let g of n)for(let M of g.rows)for(let P of M.pts)Math.hypot(P.x-m,P.y-h)<y&&p++;Math.hypot(m-a.x,h-a.y)<=d&&p/s<.01&&(c={x:m,y:h})}let u=[];for(let m of n){let h={sectionId:m.sectionId,rMin:1/0,rMax:-1/0,samples:[]};for(let d of m.rows)for(let p of d.pts){let y=Math.hypot(p.x-c.x,p.y-c.y),g=Math.min(se-1,Math.floor(bf(c,p)/(360/se)));h.samples.push({r:y,bin:g,levelM:d.levelM}),y<h.rMin&&(h.rMin=y),y>h.rMax&&(h.rMax=y)}h.samples.length&&u.push(h)}if(!u.length)return null;u.sort((m,h)=>m.rMin+m.rMax-(h.rMin+h.rMax));let l=[];for(let m of u){let h=!1;for(let d of l){let p=Math.min(m.rMax,d.rMax)-Math.max(m.rMin,d.rMin),y=Math.min(m.rMax-m.rMin,d.rMax-d.rMin);if(y>1e-9&&p>=pf*y){d.members.push(m),d.rMin=Math.min(d.rMin,m.rMin),d.rMax=Math.max(d.rMax,m.rMax),h=!0;break}}h||l.push({members:[m],rMin:m.rMin,rMax:m.rMax})}let f=[];for(let m of l){let h=new Array(se).fill(null);for(let v of m.members)for(let A of v.samples){let _=h[A.bin];_||(_={samples:[]},h[A.bin]=_),_.samples.push({r:A.r,levelM:A.levelM})}let d=h.map(v=>!!v);if(!d.filter(Boolean).length)continue;let y=[],g=[];for(let v of h){if(!v)continue;let A=1/0,_=-1/0;for(let C of v.samples)C.r<A&&(A=C.r),C.r>_&&(_=C.r);y.push(A),g.push(_)}let M=Dn(y),P=Dn(g);if(!(M>=Es*P)||!(P>0))continue;let w=[...y].sort((v,A)=>v-A);if(!(w[Math.floor(w.length*.1)]>=Es*P))continue;let b=h.map(v=>{if(!v)return null;let A=[...v.samples].sort((N,X)=>N.r-X.r),_=A[0].r,C=A[A.length-1].r,B=A[0].levelM,O=-1/0;for(let N of A)N.levelM>O&&(O=N.levelM);let F=[];for(let N of A){let X={r:N.r,l:N.levelM};for(;F.length&&Math.abs(F[F.length-1].r-X.r)<1e-9;){if(F[F.length-1].l<=X.l){X.skip=!0;break}F.pop()}if(!X.skip){for(;F.length>=2;){let V=F[F.length-2],Z=F[F.length-1];if((Z.r-V.r)*(X.l-V.l)-(Z.l-V.l)*(X.r-V.r)<=0)F.pop();else break}F.push(X)}}let D=F.map(N=>N.r),j=F.map(N=>N.l);return{inner:_,outer:C,front:B,top:O,profile:{rs:D,ls:j}}}),S=d.slice();for(let v=0;v<se;v++){if(S[v])continue;let A=-1,_=-1,C=0;for(let U=1;U<=se;U++){let te=(v-U+se*2)%se;if(S[te]){A=te;break}}for(let U=1;U<=se;U++){let te=(v+U)%se;if(S[te]){_=te,C=U;break}}if(A<0||_<0)continue;let B=0;for(let U=1;U<=se;U++){let te=(v-U+se*2)%se;if(d[te]){B=U;break}}if(B-1+C>mf)continue;let F=b[A],D=b[_],j=B/(B+C),N=F.inner+(D.inner-F.inner)*j,X=F.outer+(D.outer-F.outer)*j,V=F.front+(D.front-F.front)*j,Z=F.top+(D.top-F.top)*j;b[v]={inner:N,outer:X,front:V,top:Z,profile:{rs:[N,X],ls:[V,Z]}}}for(let v=0;v<se;v++)b[v]&&(S[v]=!0);let I=360/se,R=[],k=S.filter(Boolean).length,L=[];if(k===se)L.push({start:0,len:se});else{let v=0;for(;S[v];)v=(v+1)%se;let A=-1;for(let _=0;_<=se;_++){let C=(v+_)%se,B=_<se&&S[C];if(B&&A<0)A=C;else if(!B&&A>=0){let O=(C-A+se)%se||se;L.push({start:A,len:O}),A=-1}}}for(let v of L){if(v.len*I<hf&&v.len<se)continue;let A=v.len===se,_=new Float64Array(v.len),C=new Float64Array(v.len),B=new Float64Array(v.len),O=new Float64Array(v.len),F=[];for(let U=0;U<v.len;U++){let te=b[(v.start+U)%se];_[U]=te.inner,C[U]=te.outer,B[U]=te.front,O[U]=te.top,F.push(te.profile??{rs:[te.inner,te.outer],ls:[te.front,te.top]})}let D=Gn(_,A),j=Gn(C,A),N=Gn(B,A),X=Gn(O,A);for(let U=0;U<v.len;U++)D[U]>_[U]&&(D[U]=_[U]),j[U]<C[U]&&(j[U]=C[U]),D[U]>j[U]-1e-6&&(D[U]=Math.max(0,j[U]-1e-6)),X[U]<N[U]&&(X[U]=N[U]);let V={startBin:v.start,binCount:v.len,closed:A,innerR:D,outerR:j,frontLevelM:N,topLevelM:X,profiles:F},Z=(U,te,Q)=>{let fe=F[U],ue=fe.rs,G=fe.ls;if(te<=ue[0]){G[0]>Q&&(G[0]=Q);return}if(te>=ue[ue.length-1]){G[G.length-1]>Q&&(G[G.length-1]=Q);return}for(let H=0;H+1<ue.length;H++)if(te<=ue[H+1]){G[H]>Q&&(G[H]=Q),G[H+1]>Q&&(G[H+1]=Q);return}};for(let U=0;U<v.len;U++){let te=h[(v.start+U)%se];if(te)for(let Q of te.samples){Z(U,Q.r,Q.levelM);let fe=A?(U-1+v.len)%v.len:U-1,ue=A?(U+1)%v.len:U+1;fe>=0&&Z(fe,Q.r,Q.levelM),ue<v.len&&Z(ue,Q.r,Q.levelM)}}R.push(V)}R.reduce((v,A)=>v+A.binCount*I,0)<df||f.push({arcs:R,sectionIds:m.members.map(v=>v.sectionId),innerRMedian:M,outerRMedian:P})}if(!f.length)return null;if(f.sort((m,h)=>m.innerRMedian-h.innerRMedian),t){let m=f[f.length-1].outerRMedian;if(Math.hypot(t.x-c.x,t.y-c.y)>.9*m)return null}return{centre:c,binCount:se,binStepDeg:360/se,rings:f}}function _s(e,t,n,o){let r=e.binStepDeg,i=n/r-.5-t.startBin;i=(i%e.binCount+e.binCount)%e.binCount,i>t.binCount-1&&(t.closed?i=i-t.binCount<t.binCount-i?0:t.binCount-1:i=i-(t.binCount-1)<e.binCount-i?t.binCount-1:0);let s=Math.floor(i),a=t.closed?(s+1)%t.binCount:Math.min(t.binCount-1,s+1),c=i-s,u=l=>{let f=t.profiles[l],m=f.rs,h=f.ls;if(o<=m[0])return h[0];if(o>=m[m.length-1])return h[h.length-1];for(let d=0;d+1<m.length;d++)if(o<=m[d+1]){let p=m[d+1]-m[d],y=p>1e-9?(o-m[d])/p:0;return h[d]+(h[d+1]-h[d])*y}return h[h.length-1]};return u(s)*(1-c)+u(a)*c}function Oo(e,t,n,o,r,i,s,a,c,u=[],l=r){if(t.length!==n.length||t.length<2||i-r<1.5)return;let f=(p,y,g)=>{We(e,p,y,g,u,s,a,{portalBase:l,ao:c})||z(e,p,void 0,()=>g,y,s,a,c)},m=(p,y,g)=>({x:p.x+(y.x-p.x)*g,y:p.y+(y.y-p.y)*g}),h=o?t.length:t.length-1,d=0;for(let p=0;p<h;p++){let y=(p+1)%t.length,g=Math.hypot(n[y].x-n[p].x,n[y].y-n[p].y)*$;if(g<1e-5)continue;let M=(b,S)=>[m(t[p],t[y],b),m(t[p],t[y],S),m(n[p],n[y],S),m(n[p],n[y],b)];f(M(0,1),r,r+.95),f(M(0,1),i-.22,i);let P=Math.ceil((d-.32)/6)*6,w=!1,x=!1;for(let b=P;b<d+g;b+=6){let S=Math.max(0,(b-d)/g),I=Math.min(1,(b+.32-d)/g);I<=S||(f(M(S,I),r+.95,i-.22),w||=S<1e-6,x||=I>1-1e-6)}if(!o&&(p===0&&!w||p===h-1&&!x)){let b=Math.min(1,.32/g);f(M(p===0?0:1-b,p===0?b:1),r+.95,i-.22)}d+=g}}var ot=Ge(require("polygon-clipping"),1),Qt=.65;function To(e,t){let n=1/0;for(let o of t)for(let r=0;r<o.length;r++){let i=o[r],s=o[(r+1)%o.length],a=s.x-i.x,c=s.y-i.y,u=Math.max(0,Math.min(1,((e.x-i.x)*a+(e.y-i.y)*c)/(a*a+c*c||1)));n=Math.min(n,Math.hypot(e.x-i.x-u*a,e.y-i.y-u*c))}return n}var Lo=.01;function vs(e,t,n,o,r,i,s,a=[],c=!0,u={bays:[],walls:[]}){if(o-r<=1e-5)return;let l=o-r>=3,f=l?o-Qt:r;e.setMaterial(5);let m=l?[]:a.filter(b=>{if(b.role!=="entrance"&&b.role!=="exit")return!1;let S=ie(b);if(!S)return!1;let I=vt(S,r,r+Fe(b).heightM);return I!==null&&I.openingTop<=o-.12});if((!m.length||!We(e,t,f,o,m,i,s,{holes:n,portalBase:r}))&&z(e,t,n,()=>o,f,i,s,K,void 0,()=>[0,1,0]),!l){e.setMaterial(0);return}let h=c&&u.bays.length?yf(t,n,Je(t,$t/E),u):null,d=6/E,p=.22/E,y=a.flatMap(b=>{if(b.role!=="entrance"&&b.role!=="exit")return[];let S=ie(b);return S?.length?[{minX:Math.min(...S.map(I=>I.x)),maxX:Math.max(...S.map(I=>I.x)),minY:Math.min(...S.map(I=>I.y)),maxY:Math.max(...S.map(I=>I.y))}]:[]}),g=Math.min(...t.map(b=>b.x)),M=Math.max(...t.map(b=>b.x)),P=Math.min(...t.map(b=>b.y)),w=Math.max(...t.map(b=>b.y));for(let b=g+d/2;b<M;b+=d)for(let S=P+d/2;S<w;S+=d){if(y.some(R=>b+p>=R.minX&&b-p<=R.maxX&&S+p>=R.minY&&S-p<=R.maxY))continue;let I=[{x:b-p,y:S-p},{x:b+p,y:S-p},{x:b+p,y:S+p},{x:b-p,y:S+p}];!Pe({x:b,y:S},t,n)||To({x:b,y:S},[t,...n??[]])<p*Math.SQRT2+(c?$t/E:0)||h&&To({x:b,y:S},h.flat())<p*Math.SQRT2+$t/E||z(e,I,void 0,()=>f,r,i,s,K)}if(h){for(let[b,...S]of h)z(e,b,S,()=>f,r-Lo,i,s,K);e.setMaterial(0);return}let x=Je(t,$t/E);if(c&&x.length>=3){let b=a.filter(R=>{if(R.role!=="entrance"&&R.role!=="exit")return!1;let k=ie(R);return!!k&&k.some(L=>!Pe(L,t,void 0)||To(L,[t])<=$t/E)}),S=[x.slice().reverse()],I=r-Lo;(!b.length||!We(e,t,I,f,b,i,s,{holes:S,portalBase:r+Lo}))&&z(e,t,S,()=>f,I,i,s,K)}e.setMaterial(0)}var Bo=.25,$t=Bo;function yf(e,t,n,o){if(n.length<3)return null;let r=s=>{let a=s.map(c=>[c.x,c.y]);return a.push(a[0]),a},i=s=>{let[a,...c]=s.map(u=>[r(u)]);return ot.default.union(a,...c)};try{let s=[r(e),...(t??[]).map(r)],a=ot.default.difference(s,[r(n)]),c=ot.default.intersection(s,i(o.bays));if(!c.length)return null;let u=ot.default.difference(ot.default.intersection(s,i(o.walls)),c);return ot.default.union(ot.default.difference(a,c),u).map(f=>f.map(m=>m.slice(0,-1).map(([h,d])=>({x:h,y:d}))))}catch{return null}}var gf=.02,xf=.25,Mf=1.2,Sf=.6,Pf=.45,If=2.3,Rf=Math.PI/180,Cs=.005;function Xe(e,t,n){let o=n*Rf;return{x:e.x+t*Math.sin(o),y:e.y+t*Math.cos(o)}}function wf(e,t){let n=t.rings[t.rings.length-1];if(!n)return!1;let o=n.outerRMedian*.85;for(let r of e){if(r.role!=="wall")continue;let i=r.points&&r.points.length>=2?r.points:r.x!==void 0&&r.y!==void 0&&r.width!==void 0&&r.height!==void 0?[{x:r.x,y:r.y},{x:r.x+r.width,y:r.y},{x:r.x+r.width,y:r.y+r.height},{x:r.x,y:r.y+r.height}]:[];if(i.length<2)continue;let s=0;for(let a of i)Math.hypot(a.x-t.centre.x,a.y-t.centre.y)>=o&&s++;if(s>=i.length/2)return!0}return!1}var Ef=24,Af=.01;function _f(e,t,n,o,r,i,s,a,c){let u=n.binCount,l=Ef,f=$,m=i+.02,h=i-Af,d=[];for(let A=0;A<u;A++){let _=(n.startBin+A+.5)*t.binStepDeg,C=new Float64Array(l+1);for(let B=0;B<=l;B++){let O=o[A]+(r[A]-o[A])*B/l;C[B]=Math.max(m,_s(t,n,_,O)-xf)}d.push(C)}if(c){let A=0;for(let _=0;_+1<u;_++)for(let C=0;C<l;C++){let B=Xe(t.centre,o[_]+(r[_]-o[_])*C/l,(n.startBin+_+.5)*t.binStepDeg),O=Xe(t.centre,o[_+1]+(r[_+1]-o[_+1])*(C+1)/l,(n.startBin+_+1.5)*t.binStepDeg);A=Math.max(A,Math.hypot(O.x-B.x,O.y-B.y))}for(let _=0;_<u;_++){let C=(n.startBin+_+.5)*t.binStepDeg;for(let B=0;B<=l;B++){let O=Xe(t.centre,o[_]+(r[_]-o[_])*B/l,C),F=c(O.x,O.y,A*1.01);F!==null&&(d[_][B]=Math.min(d[_][B],Math.max(h+Cs,F-Cs)))}}}let p=[s.bandTop[0]*a.top,s.bandTop[1]*a.top,s.bandTop[2]*a.top],y=[s.bandTop[0]*a.bottomCap,s.bandTop[1]*a.bottomCap,s.bandTop[2]*a.bottomCap],g=[s.bandWall[0]*a.top,s.bandWall[1]*a.top,s.bandWall[2]*a.top],M=[s.bandWall[0]*a.wallBottom,s.bandWall[1]*a.wallBottom,s.bandWall[2]*a.wallBottom],P=(A,_)=>{let C=(n.startBin+A+.5)*t.binStepDeg,B=o[A]+(r[A]-o[A])*_/l,O=Xe(t.centre,B,C);return[O.x*f,d[A][_],O.y*f]};{let A=Math.tan(12*Math.PI/180);for(let _=0;_<6;_++){let C=!1;for(let O=0;O<u;O++)for(let F=l-1;F>=0;F--)d[O][F]>d[O][F+1]&&(d[O][F]=d[O][F+1],C=!0);let B=n.closed?u:u-1;for(let O=0;O<B;O++){let F=(O+1)%u;for(let D=0;D<=l;D++){let j=d[F][D]-d[O][D];if(Math.abs(j)>1)continue;let N=o[O]+(r[O]-o[O])*D/l,X=o[F]+(r[F]-o[F])*D/l,V=Xe(t.centre,N,(n.startBin+O+.5)*t.binStepDeg),Z=Xe(t.centre,X,(n.startBin+F+.5)*t.binStepDeg),U=A*Math.hypot(Z.x-V.x,Z.y-V.y)*f;j>U?(d[F][D]=d[O][D]+U,C=!0):-j>U&&(d[O][D]=d[F][D]+U,C=!0)}}if(!C)break}}let w=1,x=(A,_)=>{for(let C=0;C<=l;C+=4)if(Math.abs(d[A][C]-d[_][C])>w)return!0;return Math.abs(d[A][l]-d[_][l])>w},b=Math.tan(38*Math.PI/180),S=A=>(r[A]-o[A])/l*f,I=(A,_)=>d[A][_+1]-d[A][_]>b*Math.max(1e-6,S(A)),R=(A,_)=>{let C=n.closed?(A-1+u)%u:Math.max(0,A-1),B=n.closed?(A+1)%u:Math.min(u-1,A+1);Math.abs(d[C][_]-d[A][_])>w&&(C=A),Math.abs(d[B][_]-d[A][_])>w&&(B=A);let O=Math.max(0,_-1),F=Math.min(l,_+1);O<_&&I(A,O)&&(O=_),F>_&&I(A,_)&&(F=_);let D=P(C,_),j=P(B,_),N=P(A,O),X=P(A,F),V=j[0]-D[0],Z=j[1]-D[1],U=j[2]-D[2],te=X[0]-N[0],Q=X[1]-N[1],fe=X[2]-N[2],ue=Z*fe-U*Q,G=U*te-V*fe,H=V*Q-Z*te,J=Math.hypot(ue,G,H);return J>1e-12?(ue/=J,G/=J,H/=J,G<0&&(ue=-ue,G=-G,H=-H),[ue,G,H]):[0,1,0]},k=(A,_,C=!1)=>{let B=C&&Math.min(A[1],_[1])-i>=3,O=[A[0],B?A[1]-Qt:h,A[2]],F=[_[0],B?_[1]-Qt:h,_[2]],D=_[0]-A[0],j=_[2]-A[2],N=Math.hypot(D,j);if(!(N>1e-12))return;let X=[j/N,0,-D/N];e.tri(A,_,F,X,g,g,M),e.tri(A,F,O,X,g,M,M)},L=.05*Oe,T=A=>r[A]-o[A]<L,v=n.closed?u:u-1;for(let A=0;A<v;A++){let _=(A+1)%u;if(T(A)||T(_))continue;if(x(A,_)){let j=(n.startBin+A+1)*t.binStepDeg,N=(Q,fe)=>{let ue=(o[A]+o[_])/2,G=(r[A]+r[_])/2,H=ue+(G-ue)*fe/l,J=Xe(t.centre,H,j);return[J.x*f,d[Q][fe],J.y*f]};for(let Q=0;Q<l;Q++){let fe=P(A,Q),ue=P(A,Q+1),G=N(A,Q),H=N(A,Q+1),J=R(A,Q),me=R(A,Q+1);e.triN(fe,G,H,J,J,me,p),e.triN(fe,H,ue,J,me,me,p);let xe=P(_,Q),Ie=P(_,Q+1),ae=N(_,Q),ce=N(_,Q+1),De=R(_,Q),Y=R(_,Q+1);e.triN(ae,xe,Ie,De,De,Y,p),e.triN(ae,Ie,ce,De,Y,Y,p);let he=N(A,Q),Me=N(A,Q+1),rt=N(_,Q+1),it=N(_,Q),Ze=Me[0]-he[0],$e=Me[2]-he[2],Lt=Math.hypot(Ze,$e);if(Lt>1e-12){let en=[$e/Lt,0,-Ze/Lt];e.tri(he,Me,rt,en,g),e.tri(he,rt,it,en,g)}}let X=P(A,0),V=P(_,0),Z=P(_,l),U=P(A,l),te=Q=>[Q[0],h,Q[2]];Math.min(X[1],V[1])-i<3&&(e.tri(te(X),te(Z),te(V),[0,-1,0],y),e.tri(te(X),te(U),te(Z),[0,-1,0],y)),k(X,V,!0),k(U,Z,!0);continue}for(let j=0;j<l;j++){let N=R(A,j),X=R(_,j),V=R(_,j+1),Z=R(A,j+1);if(I(A,j)||I(_,j)){let ue=(Me,rt)=>{let it=(n.startBin+Me+.5)*t.binStepDeg,Ze=o[Me]+(r[Me]-o[Me])*(j+.5)/l,$e=Xe(t.centre,Ze,it);return[$e.x*f,rt,$e.y*f]},G=P(A,j),H=P(_,j),J=ue(A,d[A][j]),me=ue(_,d[_][j]);e.triN(G,H,me,N,X,X,p),e.triN(G,me,J,N,X,N,p);let xe=P(_,j+1),Ie=P(A,j+1),ae=ue(A,d[A][j+1]),ce=ue(_,d[_][j+1]);e.triN(ae,ce,xe,Z,V,V,p),e.triN(ae,xe,Ie,Z,V,Z,p);let De=me[0]-J[0],Y=me[2]-J[2],he=Math.hypot(De,Y);if(he>1e-12){let Me=[-Y/he,0,De/he];e.tri(J,me,ce,Me,g),e.tri(J,ce,ae,Me,g)}continue}let U=P(A,j),te=P(_,j),Q=P(_,j+1),fe=P(A,j+1);e.triN(U,te,Q,N,X,V,p),e.triN(U,Q,fe,N,V,Z,p)}let C=P(A,0),B=P(_,0),O=P(_,l),F=P(A,l),D=j=>[j[0],h,j[2]];Math.min(C[1],B[1])-i<3&&(e.tri(D(C),D(O),D(B),[0,-1,0],y),e.tri(D(C),D(F),D(O),[0,-1,0],y)),k(C,B,!0),k(F,O,!0)}if(!n.closed)for(let A of[0,u-1])for(let _=0;_<l;_++)k(P(A,_),P(A,_+1))}function ks(e,t,n){let{bottomY:o,colors:r,ao:i}=n,s=new Float64Array(t.binCount).fill(-1/0);for(let l of t.rings)for(let f of l.arcs){let m=new Float64Array(f.binCount),h=new Float64Array(f.binCount);for(let p=0;p<f.binCount;p++){let y=(f.startBin+p)%t.binCount,g=Math.max(0,f.innerR[p]-Te);m[p]=Math.max(g,s[y]+.001),h[p]=Math.max(m[p]+.001,f.outerR[p]+Te)}let d=0;for(let p=0;p<f.binCount;p++){let y=f.topLevelM[p]-o;y>d&&(d=y)}d>=Mf&&_f(e,t,f,m,h,o,r,i,n.standTopNear);for(let p=0;p<f.binCount;p++){let y=(f.startBin+p)%t.binCount;h[p]>s[y]&&(s[y]=h[p])}}if(n.deriveShell===!1||wf(n.shapes,t))return;let a=t.rings[t.rings.length-1],c=Sf*Oe,u=Pf*Oe;for(let l of a.arcs){let f=[],m=[];for(let R=0;R<l.binCount;R++){let k=(l.startBin+R+.5)*t.binStepDeg,L=l.outerR[R]+Te+c;f.push(Xe(t.centre,L,k)),m.push(Xe(t.centre,L+u,k))}let h=-1/0;for(let R=0;R<l.binCount;R++)l.topLevelM[R]>h&&(h=l.topLevelM[R]);let d=h+If,p=l.closed?m:[...m,...f.slice().reverse()],y=l.closed?[f.slice().reverse()]:void 0,g=re(r.shellWall,[.66,.71,.72],.62),M=(R,k,L,T,v)=>{let A=Math.abs(T-h)<1e-6?T-gf:T;We(e,R,L,A,n.shapes,r.shellTop,v,{holes:k,portalBase:o,ao:i})||z(e,R,k,()=>A,L,r.shellTop,v,i)},P=Math.max(1,Math.ceil((h-o)/4.5)),w=(h-o)/P,x=new Set,b=n.tierFrontLevels??t.rings.map(R=>{let k=R.arcs.flatMap(L=>Array.from(L.frontLevelM)).filter(Number.isFinite).sort((L,T)=>L-T);return k[Math.floor(k.length/2)]});for(let R of b)Number.isFinite(R)&&R-o>=3&&R<h&&x.add(Math.max(0,Math.min(P-1,Math.floor((R-o)/w))));let S=Math.min(...b.filter(R=>Number.isFinite(R)&&R-o>=3&&R<h));for(let R=0;R<P;R++)o+(R+1)*w<=S-Qt&&Number.isFinite(S)&&x.add(R);for(let R=0;R<P;R++){let k=o+(h-o)*R/P,L=o+(h-o)*(R+1)/P;x.has(R)&&L-k>=3.2?(M(p,y,k,k+.45,g),Oo(e,f,m,l.closed,k+.45,L-.16,r.shellTop,g,i,n.shapes,o)):M(p,y,k,L-.16,g),M(p,y,L-.16,L,W(g,.62))}Oo(e,f,m,l.closed,h,d,r.shellTop,g,i,n.shapes,o);let I=8;for(let R=1;R<m.length;R++){if(I+=Math.hypot(m[R].x-m[R-1].x,m[R].y-m[R-1].y)*$,I<8)continue;I=0;let k=m[R],L=m[R-1],T=k.x-L.x,v=k.y-L.y,A=Math.max(1,Math.hypot(T,v)),_=T/A*.16*Oe,C=v/A*.16*Oe,B=Math.max(1,Math.hypot(k.x-t.centre.x,k.y-t.centre.y)),O=(k.x-t.centre.x)/B*.24*Oe,F=(k.y-t.centre.y)/B*.24*Oe,D=[{x:k.x-_,y:k.y-C},{x:k.x+_,y:k.y+C},{x:k.x+_+O,y:k.y+C+F},{x:k.x-_+O,y:k.y-C+F}];M(D,void 0,o,h,W(g,1.12))}}}var vf=2.5,Os=.65,Cf=2,kf=.03;function Of(e,t){let n=()=>{let o=t;for(;e.length>2;){let r=e[0],i=e[1],s=Math.hypot(i.x-r.x,i.y-r.y);if(s>o){e[0]={x:r.x+(i.x-r.x)/s*o,y:r.y+(i.y-r.y)/s*o};return}o-=s,e.shift()}};n(),e.reverse(),n(),e.reverse()}function Do(e,t,n){let o=new Map;for(let i of e){let s=o.get(i.blockId);(!s||i.depth<s.depth)&&o.set(i.blockId,i)}let r=[];for(let[i,s]of o){if(s.y-n<vf||s.pts.length<2)continue;let a=s.pts.map(l=>{let f=l.x-t.x,m=l.y-t.y,h=Math.max(1,Math.hypot(f,m));return{x:l.x-f/h*Os/E,y:l.y-m/h*Os/E}}),c=[],u=[a[0]];for(let l=1;l<a.length;l++){let f=a[l-1],m=a[l];Math.hypot(m.x-f.x,m.y-f.y)*E>Cf?(u.length>=2&&c.push(u),u=[m]):u.push(m)}u.length>=2&&c.push(u);for(let l of c)Of(l,kf/E);c.length&&r.push({blockId:i,y:s.y,runs:c})}return r}var Ts=.1,Tf=1.1,Lf=.22,Fo=.95,No=.05,Ls=1.8;function Bs(e,t,n,o){let r=[.72,.72,.69],i=[.48,.55,.57];for(let s of Do(t,n,o)){let a=s.y;for(let c of s.runs){let u=Ls;for(let l=1;l<c.length;l++){let f=c[l-1],m=c[l],h=m.x-f.x,d=m.y-f.y,p=Math.hypot(h,d);if(p<1e-5)continue;let y=g=>{let M=-d/p*g/E/2,P=h/p*g/E/2;return[{x:f.x+M,y:f.y+P},{x:m.x+M,y:m.y+P},{x:m.x-M,y:m.y-P},{x:f.x-M,y:f.y-P}]};if(z(e,y(Lf),void 0,()=>a+Ts,a-Tf,r,r,K),z(e,y(No),void 0,()=>a+Fo,a+Fo-No,i,i,K),u+=p*E,u>=Ls||l===c.length-1){u=0;let g=.028/E,M=[{x:f.x-g,y:f.y-g},{x:f.x+g,y:f.y-g},{x:f.x+g,y:f.y+g},{x:f.x-g,y:f.y+g}];z(e,M,void 0,()=>a+Fo-No,a+Ts,i,i,K)}}}}}var Bf=.9,Ff=1.5,Nf=.3;function Fs(e,t,n){let o=[],r=[],i=Bf/E,s=Ff/E,a=Nf/E;for(let c of e)for(let u of c.runs){if(u.length<2)continue;let l=u.slice(),f=(y,g)=>{let M=l[y],P=l[g],w=Math.hypot(M.x-P.x,M.y-P.y)||1;l[y]={x:M.x+(M.x-P.x)/w*a,y:M.y+(M.y-P.y)/w*a}};f(0,1),f(l.length-1,l.length-2);let m=l.map((y,g)=>{let M=l[Math.max(0,g-1)],P=l[Math.min(l.length-1,g+1)],w=P.x-M.x,x=P.y-M.y,b=Math.hypot(w,x)||1,S=-x/b,I=w/b;return S*(y.x-t.x)+I*(y.y-t.y)<0&&(S=-S,I=-I),{nx:S,ny:I}}),h=l.map((y,g)=>({x:y.x-m[g].nx*s,y:y.y-m[g].ny*s})),d=l.map((y,g)=>({x:y.x+m[g].nx*i,y:y.y+m[g].ny*i})),p=l.map((y,g)=>({x:y.x+m[g].nx*(i+n/E),y:y.y+m[g].ny*(i+n/E)}));o.push([...h,...d.slice().reverse()]),r.push([...d,...p.reverse()])}return{bays:o,walls:r}}var Go=.88,jn=.27,Df=1.2,Gf=.01;function Ns(e,t,n,o,r){let i=[.67,.71,.68],s=[i[0]*Go,i[1]*Go,i[2]*Go],a=c=>!!r&&r.some((u,l)=>l!==c&&u?.belowY!=null&&Math.abs(u.belowY-t[c].y)<1e-6&&t[l].blockId===t[c].blockId);for(let c=0;c<t.length;c++){let u=t[c];if(!(u.pts.length<2))for(let l of[0,u.pts.length-1]){let f=u.pts[l],m=u.pts[l===0?1:l-1],h=f.x-m.x,d=f.y-m.y,p=Math.hypot(h,d);if(p<1e-5)continue;h/=p,d/=p;let y=1/0;for(let _=0;_<n.length;_++){let C=n[_],B=n[(_+1)%n.length],O=B.x-C.x,F=B.y-C.y,D=h*F-d*O;if(Math.abs(D)<1e-8)continue;let j=C.x-f.x,N=C.y-f.y,X=(j*F-N*O)/D,V=(j*d-N*h)/D;X>0&&V>=0&&V<=1&&(y=Math.min(y,X))}let g=.3/E,M=y-.04/E;if(!Number.isFinite(y)||y*E>2||M-g<.12/E)continue;let P=!!o&&a(c),w=r?.[c]?.pitch,x=P&&w&&Number.isFinite(w)?Math.min(Df/E,Math.max(jn/E,w-jn/E-Gf/E)):jn/E,b=-d,S=h;o&&b*(o.x-f.x)+S*(o.y-f.y)<0&&(b=-b,S=-S);let I=jn/E,R=[{x:f.x+h*g+b*I,y:f.y+d*g+S*I},{x:f.x+h*M+b*I,y:f.y+d*M+S*I},{x:f.x+h*M-b*x,y:f.y+d*M-S*x},{x:f.x+h*g-b*x,y:f.y+d*g-S*x}];if(!R.every(_=>_e(n,_.x,_.y)))continue;let k=r?.[c]?.belowY,L=k==null?0:u.y-k,T=!!o&&L>.03&&L<=.65;if(T&&o){let _=(C,B)=>Math.hypot((C.x+B.x)/2-o.x,(C.y+B.y)/2-o.y);_(R[0],R[1])>_(R[3],R[2])&&(R=[R[3],R[2],R[1],R[0]])}let v=T?Math.ceil((L-1e-8)/.2):1,A=(_,C,B)=>({x:_.x+(C.x-_.x)*B,y:_.y+(C.y-_.y)*B});for(let _=0;_<v;_++){let C=_/v,B=(_+1)/v,O=[A(R[0],R[3],C),A(R[1],R[2],C),A(R[1],R[2],B),A(R[0],R[3],B)],F=u.y+.008-(T?L*(1-B):0);z(e,O,void 0,()=>F,F-(T?L/v+.1:.16),i,s,K)}}}}var jf=.02,Hf=.012,Vf=.01,Uf=.3,Xf=.5;function Kf(e,t,n){if(e.length===1)return Math.hypot(t-e[0].x,n-e[0].y);let o=1/0;for(let r=0;r+1<e.length;r++){let i=e[r],s=e[r+1],a=s.x-i.x,c=s.y-i.y,u=a*a+c*c,l=u>1e-12?((t-i.x)*a+(n-i.y)*c)/u:0;l=Math.max(0,Math.min(1,l)),o=Math.min(o,Math.hypot(t-(i.x+l*a),n-(i.y+l*c)))}return o}function Yf(e,t,n,o){let r=1/0,i=Number.NaN;for(let s=0;s<e.length;s++){let a=t[s];if(Math.hypot(n-a.cx,o-a.cy)-a.rad>=r)continue;let c=Kf(e[s].pts,n,o);c<r&&(r=c,i=e[s].y)}return i}function Ds(e,t,n,o,r,i,s){let a=o.filter(m=>m.pts.length>0);if(a.length<2||t.length<3)return;let c=a.map(m=>{let h=0,d=0;for(let y of m.pts)h+=y.x,d+=y.y;h/=m.pts.length,d/=m.pts.length;let p=0;for(let y of m.pts)p=Math.max(p,Math.hypot(y.x-h,y.y-d));return{cx:h,cy:d,rad:p}}),u=[...t],l=n.map(m=>[...m]),f=jf/E;for(let m of[u,...l])for(let h=0;h<m.length;h++){let d=m[h],p=m[(h+1)%m.length],y=p.x-d.x,g=p.y-d.y,M=Math.hypot(y,g);if(M*E<.05)continue;let P=(d.x+p.x)/2,w=(d.y+p.y)/2,x=g/M,b=-y/M;Pe({x:P+x*f,y:w+b*f},u,l)&&(x=-x,b=-b);let S=r.x-P,I=r.y-w,R=Math.hypot(S,I)||1;if((x*S+b*I)/R>Xf)continue;let k=1/0;for(let O of[.2,.5,.8]){let F=Yf(a,c,d.x+y*O-x*f*2,d.y+g*O-b*f*2);Number.isFinite(F)&&(k=Math.min(k,F))}if(!Number.isFinite(k)||k-i<Uf)continue;let L=i-Vf,T=k-Hf,v={x:(d.x-x*f)*E,z:(d.y-b*f)*E},A={x:(p.x-x*f)*E,z:(p.y-b*f)*E},_=[x,0,b],C=W(s,K.wallBottom),B=W(s,K.top);e.tri([v.x,T,v.z],[A.x,T,A.z],[A.x,L,A.z],_,B,B,C),e.tri([v.x,T,v.z],[A.x,L,A.z],[v.x,L,v.z],_,B,C,C)}}function Gs(e,t,n,o,r,i,s,a,c=!1){if(!t.outline||t.outline.length<3)return;let u=n.baseHeightM,l=n.objects.filter(M=>M.type==="shape"&&(M.role==="entrance"||M.role==="exit")),f=mi(o,a.tierTop);if(!r)return;let m=M=>r.deckAt(M.x,M.y),h=Fi(t,s),d=h[0]??t.outline;if(r.rowLevels.length>=2){let M=In(r.rowLevels),P=Ni(ki(r.rowLevels,n.focal,M),h),w=Fs(Do(r.rowLevels,n.focal,u),n.focal,Bo);for(let b of P){let S=Math.max(u,b.topY-js);for(let I of i.subtract(b.outline,S))vs(e,I,b.holes,S,u,a.tierTop,a.tierWall,l,!c,w);e.setMaterial(5),Ds(e,b.outline,b.holes,r.rowLevels,n.focal,S,a.tierWall),e.setMaterial(0)}P.length||z(e,d,t.holes,()=>r.landingY,u,f,a.tierWall,K);let x={tread:[f[0]*K.top,f[1]*K.top,f[2]*K.top],riser:[f[0]*.72,f[1]*.72,f[2]*.72]};for(let b of h.length?h:[d])Ti(e,r.rowLevels,n.focal,r.landingY,x,b,M);Bs(e,r.rowLevels,n.focal,u),Ns(e,r.rowLevels,t.outline,n.focal,M);return}let p=r.flat?1/0:Yi,y=M=>r.normalAt(M.x,M.y),g=r.flat?r.landingY:void 0;for(let M of i.subtract(d,g))z(e,M,t.holes,m,u,f,a.tierWall,K,p,y)}function Wf(e,t,n){let o=new Set;for(let s of e.objects)s.type==="section"&&o.add(s.id);let r=new Map;for(let s=0;s<t.length;s++){let a=n.seatOwner[s];if(!a||!o.has(a))continue;let c=n.bySection.get(a);if(c&&c.rowLevels.length>=2)continue;let u=t[s];if(u.kind==="booth")continue;let l=r.get(a);l||(l=new Map,r.set(a,l));let f=u.rowId||`__seat-${s}`,m=l.get(f);m||(m={pts:[],levelM:0,n:0},l.set(f,m)),m.pts.push({x:u.x,y:u.y}),m.levelM+=n.seatDeckY(s),m.n++}let i=[];for(let s of e.objects){if(s.type!=="section")continue;let a=n.bySection.get(s.id);if(a&&a.rowLevels.length>=2){let u=a.rowLevels.filter(l=>!l.patch).map(l=>({pts:l.pts,levelM:l.y}));u.length>=2&&i.push({sectionId:s.id,rows:u});continue}let c=r.get(s.id);c&&i.push({sectionId:s.id,rows:[...c.values()].map(u=>({pts:u.pts,levelM:u.levelM/u.n}))})}return i}function zf(e,t){let n=1/0;for(let o=0;o<t.length;o++){let r=t[o],i=t[(o+1)%t.length],s=i.x-r.x,a=i.y-r.y,c=Math.max(0,Math.min(1,((e.x-r.x)*s+(e.y-r.y)*a)/(s*s+a*a||1)));n=Math.min(n,Math.hypot(e.x-r.x-c*s,e.y-r.y-c*a))}return n}var js=.02;function Zf(e,t){let n=e.objects.filter(o=>o.type==="section"&&!!o.outline&&o.outline.length>=3).flatMap(o=>{let r=t.bySection.get(o.id);if(!r)return[];let i=1/0,s=-1/0,a=1/0,c=-1/0;for(let l of o.outline)l.x<i&&(i=l.x),l.x>s&&(s=l.x),l.y<a&&(a=l.y),l.y>c&&(c=l.y);let u=r.landingY;for(let l of r.rowLevels)u=Math.min(u,l.y-js);return[{outline:o.outline,holes:o.holes,surface:r,floorTop:u,minX:i,maxX:s,minY:a,maxY:c}]});return(o,r,i)=>{let s=null;for(let a of n){if(o<a.minX-i||o>a.maxX+i||r<a.minY-i||r>a.maxY+i)continue;let c={x:o,y:r};if(!Pe(c,a.outline,a.holes)&&zf(c,a.outline)>i)continue;let u=Math.min(a.surface.deckAt(o,r),a.floorTop);(s===null||u<s)&&(s=u)}return s}}var $f=3,Qf=.4;function Hs(e,t,n,o,r,i,s=!0){let a=Wf(t,n,o);if(a.length<$f)return;let c=As(a,t.focal);if(!c)return;let u=Math.max(0,...c.rings.map(l=>l.arcs.reduce((f,m)=>f+m.binCount,0)))/c.binCount;e.setMaterial(5),ks(e,c,{bottomY:t.baseHeightM,tierFrontLevels:a.map(l=>Math.min(...l.rows.map(f=>f.levelM))),colors:{bandTop:W(r.tierTop,.8),bandWall:r.tierWall,shellTop:i??W(r.tierWall,1.15),shellWall:i??r.tierWall},ao:K,shapes:t.objects.filter(l=>l.type==="shape"),deriveShell:s&&u>=Qf,standTopNear:Zf(t,o)}),e.setMaterial(0)}var Vs=4;var qf=[[/\b(wc|toilets?|restrooms?|washrooms?|lavatory|loo)\b/i,"restroom"],[/\b(bar|drinks|pub|cocktails?)\b/i,"bar"],[/\b(food|concessions?|snacks?|kiosk|caf[eé]|kitchen|catering)\b/i,"concession"],[/\b(coat ?check|cloak ?room|cloakroom|coats)\b/i,"coat"],[/\b(screen|led wall|projection|video wall)\b/i,"screen"],[/\b(sound|foh|mixing desk|control booth)\b/i,"sound"],[/\b(entrance|entry|way in|gate)\b/i,"entrance"],[/\b(exit|way out)\b/i,"exit"],[/\b(pillar|column|obstruction)\b/i,"obstruction"],[/\b(walls?|outline|boundary|perimeter)\b/i,"wall"]],Jf=1.2,em=12;function Us(e){if(e.heightM!==void 0)return!1;let t=ie(e);if(!t||t.length<3)return!1;let n=0;for(let r=0;r<t.length;r++){let i=t[r],s=t[(r+1)%t.length];n+=Math.hypot(s.x-i.x,s.y-i.y)}return n*$<em*2?!1:2*qt(t)/n*$<=Jf}function jo(e){if(!e)return null;for(let[t,n]of qf)if(t.test(e))return n;return null}var Ks="auto-rows-";function Ys(e){return e.id.startsWith(Ks)&&!e.label}var tm=1.15,nm=.09,Ws=6,om=34,rm=.35,im=6,sm=.35,am=.75,cm=12,lm=2.5,um=40,fm=[18,24],mm=[12,16],Xs=14,hm=.8,dm=.6,pm=5,bm=.3,zs=.4,Zs=2,ym=400,gm=2.6,xm=.8,Mm=4,Sm=26,Pm=.7,Im=.5,Rm=.985,wm=1.5,Em=2.2,Am=3,_m=25,vm=.985,Cm=2,km=6,Om=3,Tm=.1,Lm=1.5,Bm=1.6,Fm=6e3,Nm=.6,Dm="#c3c7cd",Ho=300,Gm=240;function jm(e,t,n,o){if(!e.fill||!/^#[0-9a-f]{6}$/i.test(e.fill))return null;let r=Uo([...t]),i=new Set;for(let l of o)i.add(Math.floor(Math.atan2(l.y-r.y,l.x-r.x)*180/Math.PI/10));if(i.size*10<Gm)return null;let{h:s,s:a,l:c}=jr(Gr(e.fill));return s<70/360||s>170/360||a<.2||c<.08||c>.75||n.some(l=>l!==e&&l.type==="shape"&&ie(l)?.some(f=>Yo(f,t)))?null:e.kind==="ellipse"?"oval-cricket":e.kind==="rect"?"pitch-football":null}var Hm="Estimated from the drawing; confirm with the venue.",Xo=e=>{if(!e.length)return null;let t=[...e].sort((o,r)=>o-r),n=Math.floor(t.length/2);return t.length%2?t[n]:(t[n-1]+t[n])/2},Uo=e=>({x:e.reduce((t,n)=>t+n.x,0)/e.length,y:e.reduce((t,n)=>t+n.y,0)/e.length}),qt=e=>{let t=0;for(let n=0;n<e.length;n++){let o=e[n],r=e[(n+1)%e.length];t+=o.x*r.y-r.x*o.y}return Math.abs(t)/2};function Vm(e){return e.height!==void 0||e.rake!==void 0||e.elevation!==void 0||e.surfaceKind!==void 0}function Ko(e){let t=new Map;for(let n of e){let o=t.get(n.rowId);o?o.push(n):t.set(n.rowId,[n])}return t}function Yo(e,t){let n=!1;for(let o=0,r=t.length-1;o<t.length;r=o++){let i=t[o],s=t[r];i.y>e.y!=s.y>e.y&&e.x<(s.x-i.x)*(e.y-i.y)/(s.y-i.y)+i.x&&(n=!n)}return n}function Wo(e,t){let n=t[0],o=1/0;for(let r=0;r<t.length;r++){let i=t[r],s=t[(r+1)%t.length],a=s.x-i.x,c=s.y-i.y,u=a*a+c*c,l=u>0?Math.max(0,Math.min(1,((e.x-i.x)*a+(e.y-i.y)*c)/u)):0,f={x:i.x+a*l,y:i.y+c*l},m=Math.hypot(e.x-f.x,e.y-f.y);m<o&&(o=m,n=f)}return n}function $s(e,t){let n=0,o=0;for(let r of e.values()){if(r.length<3)continue;let i=r[0],s=r[r.length-1],a=s.x-i.x,c=s.y-i.y,u=Math.hypot(a,c);if(u<1e-6)continue;let l={x:(i.x+s.x)/2,y:(i.y+s.y)/2},f=Wo(l,t),m=f.x-l.x,h=f.y-l.y,d=Math.hypot(m,h);d<1e-6||(o+=Math.abs((-c*m+a*h)/(u*d))*r.length,n+=r.length)}return n?o/n:0}function Um(e,t,n){let o=e.filter(p=>p.type==="shape"),r=o.find(p=>p.role==="stage");if(r){let p=ie(r);return p?{shape:r,centre:Uo(p),outline:p,inferred:!1}:null}if(!n.length)return null;let i=1/0,s=-1/0,a=1/0,c=-1/0;for(let p of n)i=Math.min(i,p.x),s=Math.max(s,p.x),a=Math.min(a,p.y),c=Math.max(c,p.y);let u=(s-i)*(c-a),l=[];for(let p of o){if(p.role)continue;let y=ie(p);if(!y)continue;let g=qt(y);if(g*$*$<6||g>u)continue;let M=Math.min(...y.map(R=>R.x)),P=Math.max(...y.map(R=>R.x)),w=Math.min(...y.map(R=>R.y)),x=Math.max(...y.map(R=>R.y)),b=0;for(let R of n)R.x>M&&R.x<P&&R.y>w&&R.y<x&&Yo(R,y)&&b++;if(b>n.length*.05)continue;let S=Uo(y),I=$s(t,y);I>=hm&&l.push({shape:p,centre:S,outline:y,score:I,area:g,box:[M,w,P,x]})}let f=(p,y)=>y!==p&&y.area>p.area&&p.box[0]>=y.box[0]-1e-6&&p.box[1]>=y.box[1]-1e-6&&p.box[2]<=y.box[2]+1e-6&&p.box[3]<=y.box[3]+1e-6,m=l.filter(p=>!l.some(y=>f(p,y))),h=Math.max(0,...m.map(p=>p.score)),d=m.filter(p=>p.score>=h-.03).sort((p,y)=>y.area-p.area)[0]??null;return d?{shape:d.shape,centre:d.centre,outline:d.outline,inferred:!0}:null}function Xm(e,t,n){if(!n||n.length<3)return Math.hypot(e.x-t.x,e.y-t.y);let o=Wo(e,n);return Math.hypot(e.x-o.x,e.y-o.y)}function Qs(e){return e.length<3?[...e].sort((t,n)=>t.x-n.x||t.y-n.y):wt(e)}function Km(e){if(!e.length||e.length>Fm)return[];let t=[...Ko(e).values()],n=t.map((a,c)=>c),o=a=>n[a]===a?a:n[a]=o(n[a]),r=Bm/$,i=t.map(a=>({minX:Math.min(...a.map(c=>c.x))-r,maxX:Math.max(...a.map(c=>c.x))+r,minY:Math.min(...a.map(c=>c.y))-r,maxY:Math.max(...a.map(c=>c.y))+r}));for(let a=0;a<t.length;a++)for(let c=a+1;c<t.length;c++){let u=i[a],l=i[c];if(u.maxX<l.minX||l.maxX<u.minX||u.maxY<l.minY||l.maxY<u.minY)continue;t[a].some(m=>t[c].some(h=>Math.hypot(m.x-h.x,m.y-h.y)<=r))&&(n[o(a)]=o(c))}let s=new Map;return t.forEach((a,c)=>{let u=o(c),l=s.get(u);l?l.push(...a):s.set(u,[...a])}),[...s.values()].filter(a=>new Set(a.map(c=>c.rowId)).size>=2)}function Ym(e,t,n){if(!t.length)return null;let o=t.filter(I=>n.tableIds.has(I.rowId)||I.kind==="booth").length>t.length/2,r=Ko(t),i=!n.outline||$s(r,n.outline)>=dm,s=0,a=0;for(let I of r.values()){if(I.length<2)continue;let R=I[0],k=I[I.length-1],L=k.x-R.x,T=k.y-R.y,v=Math.hypot(L,T);if(v<1e-6)continue;let A={x:(R.x+k.x)/2,y:(R.y+k.y)/2},_=i?n.outline?Wo(A,n.outline):n.focal:n.middle,C=-T/v,B=L/v;C*(_.x-A.x)+B*(_.y-A.y)<0&&(C=-C,B=-B),s+=C*I.length,a+=B*I.length}let c={x:t.reduce((I,R)=>I+R.x,0)/t.length,y:t.reduce((I,R)=>I+R.y,0)/t.length};if(Math.hypot(s,a)<1e-9){let I=i?n.focal:n.middle;s=I.x-c.x,a=I.y-c.y}let u=Math.hypot(s,a)||1,l={x:s/u,y:a/u},f=I=>-(I.x*l.x+I.y*l.y),m=I=>-I.x*l.y+I.y*l.x,h=1/0,d=-1/0,p=1/0,y=-1/0,g=1/0,M=new Map;for(let I of t){let R=f(I),k=m(I);h=Math.min(h,R),d=Math.max(d,R),p=Math.min(p,k),y=Math.max(y,k),i&&(g=Math.min(g,Xm(I,n.focal,n.outline)));let L=I.logicalRowId??I.rowId,T=M.get(L);T?T.push(R):M.set(L,[R])}i||(g=Math.max(0,h-f(n.middle)));let P=[...M.values()].map(I=>Xo(I)).sort((I,R)=>I-R),w=[];if(!o)for(let I of P)w.length&&I-w[w.length-1]<sm/$||w.push(I);let x=Vm(e),b=Qe(e,{floorBaseHeightM:n.baseHeightM}),S={id:e.id,section:e,authored:x,plane:n,facing:l,facesAction:i,hull:Qs(t),sample:t.filter((I,R)=>R%Math.ceil(t.length/ym)===0),frontD:h,backD:d,latMin:p,latMax:y,frontDistance:g,rowDepths:w,rowCount:w.length,level:0,height:b.height,rake:x?b.rake:0,backHeight:0};return S.backHeight=S.height+(d-h)*$*Math.tan(S.rake*Math.PI/180),S}function Wm(e,t,n,o){if(e.length<2)return 0;let r=Math.max(1,t*$),i=n+tm-o,s=0,a=0;for(let u=1;u<e.length;u++){let l=Math.max(am,(e[u]-e[u-1])*$),f=(i+nm)*(r+l)/r;s+=f-i,a+=l,i=f,r+=l}let c=Math.atan(s/a)*180/Math.PI;return Math.round(Math.max(Ws,Math.min(om,c))*10)/10}function zm(e,t,n=!1){if(!n&&e.facing.x*t.facing.x+e.facing.y*t.facing.y<bm)return null;let o=-1/0,r=1/0,i=-1/0;for(let m of t.hull){o=Math.max(o,-(m.x*e.facing.x+m.y*e.facing.y));let h=-m.x*e.facing.y+m.y*e.facing.x;r=Math.min(r,h),i=Math.max(i,h)}if(Math.min(e.latMax,i)-Math.max(e.latMin,r)<(n?1e-6:zs*(e.latMax-e.latMin)))return null;let a=Zs/$,c=new Map,u=new Map;for(let m of e.sample){let h=Math.floor((-m.x*e.facing.y+m.y*e.facing.x)/a),d=-(m.x*e.facing.x+m.y*e.facing.y);c.set(h,Math.min(c.get(h)??1/0,d))}for(let m of t.sample){let h=Math.floor((-m.x*e.facing.y+m.y*e.facing.x)/a),d=-(m.x*e.facing.x+m.y*e.facing.y);u.set(h,Math.max(u.get(h)??-1/0,d))}let l=[];for(let[m,h]of c){let d=u.get(m);d!==void 0&&l.push(h-d)}let f=l.length?Xo(l):e.frontD-o;return f<-1/$?null:f}function Zm(e,t){if(t.plane.floorIndex>=e.plane.floorIndex)return!1;let n=-1/0,o=1/0,r=1/0,i=-1/0;for(let c of t.hull){let u=-(c.x*e.facing.x+c.y*e.facing.y);n=Math.max(n,u),o=Math.min(o,u);let l=-c.x*e.facing.y+c.y*e.facing.x;r=Math.min(r,l),i=Math.max(i,l)}let s=Math.min(e.latMax,i)-Math.max(e.latMin,r),a=Math.min(e.backD,n)-Math.max(e.frontD,o);return s>zs*(e.latMax-e.latMin)&&a>1/$}function $m(e,t){let n=new Set;for(let o of e){let r=(Math.atan2(o.y-t.y,o.x-t.x)*180/Math.PI+360)%360;n.add(Math.floor(r/10))}return n.size/36}function Qm(e,t){let n=1/0,o=-1/0;for(let i of t.hull){let s=-(i.x*e.facing.x+i.y*e.facing.y);n=Math.min(n,s),o=Math.max(o,s)}let r=Math.max(0,Math.min(o-n,e.frontD-n));return t.height+r*$*Math.tan(t.rake*Math.PI/180)}function qm(e,t){if(!e.facesAction)return!1;let n={x:-e.facing.y,y:e.facing.x},o=Zs/$,r=Math.max(1,Math.ceil((e.backD-e.frontD)/o)),i={left:new Map,right:new Map};for(let a of t)if(!(a===e||a.plane.floorIndex!==e.plane.floorIndex)&&!(a.facing.x*e.facing.x+a.facing.y*e.facing.y>=Rm))for(let c of a.sample){let u=-(c.x*e.facing.x+c.y*e.facing.y);if(u<e.frontD||u>e.backD)continue;let l=-c.x*e.facing.y+c.y*e.facing.x,f=l<e.latMin?"left":l>e.latMax?"right":null;if(!f)return!1;let m=Math.min(r-1,Math.floor((u-e.frontD)/o)),h=f==="left"?e.latMin-l:l-e.latMax;h<(i[f].get(m)?.gap??1/0)&&i[f].set(m,{gap:h,other:a})}let s=a=>{let c=a==="left"?e.latMin:e.latMax,u=0;for(let[l,{other:f}]of i[a]){if((f.facing.x*n.x+f.facing.y*n.y)*(a==="left"?1:-1)<Pm)continue;let h=e.frontD+(l+.5)*o,d={x:-h*e.facing.x+c*n.x,y:-h*e.facing.y+c*n.y},p=-(d.x*f.facing.x+d.y*f.facing.y),y=-d.x*f.facing.y+d.y*f.facing.x;p<f.frontD&&y>=f.latMin&&y<=f.latMax&&u++}return u/r>=Im};return s("left")&&s("right")}function Jm(e,t){if(t.plane.floorIndex!==e.plane.floorIndex||t.facing.x*e.facing.x+t.facing.y*e.facing.y<vm)return!1;let n=1/0,o=-1/0,r=1/0;for(let a of t.hull){let c=-a.x*e.facing.y+a.y*e.facing.x;n=Math.min(n,c),o=Math.max(o,c),r=Math.min(r,-(a.x*e.facing.x+a.y*e.facing.y))}let i=(e.frontD-r)*$;if(i<-Cm||i>km)return!1;let s=Math.max(n-e.latMax,e.latMin-o);return s*$<=Om&&s*$>=-Tm}function eh(e,t=!1,n=!1,o){let r=t?mm:fm,i=new Set(n?[]:e.filter(p=>!p.authored&&qm(p,e))),s=[...e].sort((p,y)=>p.plane.floorIndex-y.plane.floorIndex||Number(i.has(y))-Number(i.has(p))||p.frontDistance-y.frontDistance);for(let p of i)o?.add(p.id);let a=(p,y,g)=>{let M=new Map,P=[],w=new Map,x=b=>{if(b.plane.floorIndex===0||b.plane.baseHeightM>0)return b.plane.baseHeightM;let S=w.get(b.plane.floorIndex-1);return S===void 0?b.plane.baseHeightM:S+Vs};for(let b of s){if(i.has(b))b.height=x(b),b.level=0,b.rake=0,b.backHeight=b.height,M.set(b.id,void 0);else if(!b.authored){let I=x(b),R;for(let A of P){if(A.plane.floorIndex>b.plane.floorIndex)continue;if(Zm(b,A)){let O=Qm(b,A)+gm;O>I&&(I=O,R=A);continue}let _=zm(b,A,i.has(A));if(_==null)continue;let C=n&&!!b.plane.stageDeck&&A.level===0&&A.plane.floorIndex===b.plane.floorIndex&&Math.max(0,_)*$<=Mm,B=i.has(A)?A.height+wm:C?A.backHeight:A.backHeight+rm+Math.min(im,Math.max(0,_)*$)*Math.tan(A.rake*Math.PI/180);B>I&&(I=B,R=A)}let k=p.get(b);k&&k.height>I+.01?(I=k.height,R=void 0):k=void 0,b.height=Math.round(Math.min(I,b.plane.baseHeightM+um)*100)/100;let L=!R&&!k&&b.height>b.plane.baseHeightM;if(b.level=R?R.level+1:k?k.level:L?1:0,b.rake=Wm(b.rowDepths,b.frontDistance,b.height,b.plane.focalHeightM),!b.facesAction&&b.rowCount<pm)b.rake=0;else if(b.level===0){let A=Math.max(1e-6,(b.backD-b.frontD)*$);b.rake=Math.min(b.rake,cm,Math.round(Math.atan(lm/A)*1800/Math.PI)/10)}else b.rowCount>=2&&(b.rake=Math.max(b.rake,r[Math.min(b.level,r.length)-1]));let T=(b.backD-b.frontD)*$,v=R&&i.has(R)||k&&g?.has(k.id);if(y!==void 0&&v&&b.rowCount>=2&&(b.rake=y),t&&T>0&&b.height+T*Math.tan(b.rake*Math.PI/180)>b.plane.baseHeightM+Xs){let A=Math.max(0,b.plane.baseHeightM+Xs-b.height);b.rake=Math.max(Ws,Math.round(Math.atan(A/T)*1800/Math.PI)/10)}n&&b.plane.stageDeck&&b.level>0&&(b.rake=Math.min(b.rake,Sm)),b.backHeight=b.height+T*Math.tan(b.rake*Math.PI/180),M.set(b.id,R?.id??(k?M.get(k.id):void 0))}let S=b.plane.floorIndex;w.set(S,Math.min(w.get(S)??1/0,b.height)),P.push(b)}return M},c=a(new Map),u=new Map,l=p=>u.get(p)?.height??p.height;for(let p=!0,y=0;p&&y<e.length;y++){p=!1;for(let g of e)if(!(g.authored||i.has(g)))for(let M of e){let P=u.get(M)??M;M===g||P.height-P.plane.baseHeightM<Lm||P.height<=l(g)+.01||Jm(g,M)&&(u.set(g,P),p=!0)}}let f=new Map(e.map(p=>[p.id,p])),m=e.filter(p=>!p.authored&&p.rowCount>=2&&i.has(f.get(c.get(p.id)??""))),h=m.length?Xo(m.map(p=>p.rake)):void 0;if(!u.size&&h===void 0)return c;let d=new Map([...new Set(u.values())].map(p=>[p,{...p}]));return a(new Map([...u].map(([p,y])=>[p,d.get(y)])),h,new Set(m.map(p=>p.id)))}var Vo=(e,t)=>!!e&&e.x===t.x&&e.y===t.y;function qs(e,t={x:0,y:-40}){let n=gt(e),o=new Map;for(let g of n){if(!g.sectionId)continue;let M=o.get(g.sectionId);M?M.push(g):o.set(g.sectionId,[g])}let r={focalInferred:!1,confident:!1,sections:[]},i=e.floors?.length?e.floors.map((g,M)=>({objects:g.objects,floorIndex:M,floorId:g.id,baseHeightM:g.baseHeightM??0,focal:g.focalPoint??e.focalPoint})):[{objects:e.objects,floorIndex:0,floorId:void 0,baseHeightM:0,focal:e.focalPoint}],s=new Set(i.flatMap(g=>g.objects.filter(M=>M.type==="table").map(M=>M.id))),a=[],c,u=new Set,l=i.map(g=>{let M=v=>!e.floors?.length||v.floorId===g.floorId,P=Km(n.filter(v=>!v.sectionId&&v.kind!=="booth"&&!s.has(v.rowId)&&M(v))),w=[];for(let v of P){let A=Le(He(Qs(v)),Nm/$);if(n.some(C=>!M(C)&&Yo(C,A)))continue;let _=`${Ks}${g.floorIndex}-${w.length}`;u.add(_),o.set(_,v),w.push({type:"section",id:_,label:"",color:Dm,outline:A})}let x=w.length?{...g,objects:[...g.objects,...w]}:g,b=new Set(x.objects.filter(v=>v.type==="section").map(v=>v.logicalSectionId??v.id)),S=[...o.entries()].filter(([v])=>b.has(v)).flatMap(([,v])=>v),I=Um(x.objects,Ko(S),S),R=x.focal;(I||x.focal&&!Vo(x.focal,t))&&(r.confident=!0),I&&(r.stage??={id:I.shape.id,inferred:I.inferred,...x.floorId?{floorId:x.floorId}:{}},(I.inferred||Vo(x.focal,t))&&(R=I.centre,r.focalInferred=!0));let k=I&&(!I.inferred||qt(I.outline)*$*$<=Ho),L=I?void 0:c,T={tableIds:s,floorIndex:x.floorIndex,floorId:x.floorId,baseHeightM:x.baseHeightM,focal:L?.focal??R,outline:I?.outline??L?.outline,focalHeightM:L?.focalHeightM??x.baseHeightM+(I&&k?Fe({...I.shape,role:"stage"}).heightM:0),stageDeck:L?.stageDeck??!!(I&&k&&qt(I.outline)*$*$<=Ho),middle:S.length?{x:S.reduce((v,A)=>v+A.x,0)/S.length,y:S.reduce((v,A)=>v+A.y,0)/S.length}:R};for(let v of x.objects){if(v.type!=="section")continue;let A=Ym(v,o.get(v.logicalSectionId??v.id)??[],T);A&&a.push(A)}return T.outline&&(c=T),Vo(x.focal,T.focal)||(r.focal??=[]).push({...x.floorId?{floorId:x.floorId}:{},point:{...T.focal}}),{unit:x,plane:T,stage:I,planeSeats:S}}),f=i.flatMap(g=>g.objects).map(g=>g.type==="shape"&&!g.role&&(jo(g.label)==="wall"||!jo(g.label)&&Us(g))?{...g,role:"wall"}:g),m=tt({objects:f},n)!==null;m&&(r.indoor=!0);let h=new Set,d=eh(a,m,$m(n,l[0]?.plane.focal??t)<xm,h),p=new Map(a.filter(g=>!g.authored).map(g=>[g.id,g])),y=l.map(({unit:g,plane:M,stage:P,planeSeats:w})=>g.objects.map(x=>{let b=x.type==="shape"&&!x.role&&x.id!==P?.shape.id?jo(x.label):null;if(x.type==="shape"&&!x.role&&x.id!==P?.shape.id&&(b==="wall"||!b&&Us(x))&&x.type==="shape"){(r.roles??=[]).push({id:x.id,...M.floorId?{floorId:M.floorId}:{},role:"wall"});let{fill:A,..._}=x;return{..._,role:"wall"}}if(b&&x.type==="shape")return(r.roles??=[]).push({id:x.id,...M.floorId?{floorId:M.floorId}:{},role:b}),{...x,role:b};let I=P?.inferred&&x.id===P.shape.id&&x.type==="shape"?jm(x,P.outline,g.objects,w):null;if(I&&x.type==="shape")return r.stage?.id===x.id&&(r.stage.field=I),{...x,role:"stage",stageKind:I};let R=x.type==="shape"&&x.id===P?.shape.id&&x.heightM===void 0&&!x.stageKind&&a.some(A=>A.plane===M&&(h.has(A.id)||A.level===0&&A.facesAction&&A.rake<=Am&&(A.frontDistance+A.backD-A.frontD)*$>=_m)),k=R?{heightM:Em}:{};if(P?.inferred&&x.id===P.shape.id&&x.type==="shape"&&qt(P.outline)*$*$<=Ho)return r.stage?.id===x.id&&(r.stage.deck=!0),{...x,role:"stage",...k};if(R&&x.type==="shape"&&x.role==="stage")return{...x,...k};let L=x.type==="section"?p.get(x.id):void 0;if(!L||x.type!=="section")return x;let T=L.rowCount>=2&&L.rake>0;u.has(L.id)?r.looseRowBlocks=(r.looseRowBlocks??0)+1:r.sections.push({id:L.id,floorId:M.floorId,surfaceKind:T?"rakedRows":"flat",height:L.height,rake:L.rake,stackedOn:d.get(L.id)});let v={status:"inferred",source:"public-2d-topology",note:Hm};return{...x,height:L.height,rake:L.rake,surfaceKind:T?"rakedRows":"flat",physical3dProvenance:{height:v,rake:v,surfaceKind:v}}}));if(e.floors?.length){let g=e.floors.map((M,P)=>({...M,objects:y[P],focalPoint:l[P].plane.focal}));return{doc:{...e,floors:g,objects:g[0].objects,focalPoint:g[0].focalPoint},report:r}}return{doc:{...e,objects:y[0],focalPoint:l[0].plane.focal},report:r}}var Js=/^[\p{L}\p{N}]{1,4}$/u,th=/^([\p{L}\p{N}]{2,})[\s\-\u2013\u2014\u00b7_./]+(.+)$/u;function ea(e,t){let n=t?.trim();if(!n)return e;let o=e.toLocaleLowerCase("en-US"),r=n.toLocaleLowerCase("en-US");if(o.startsWith(`${r} `)){let s=e.slice(n.length).trim();if(Js.test(s))return s}let i=th.exec(e);if(i){let s=i[1].toLocaleLowerCase("en-US"),a=i[2].trim();if((r.startsWith(s)||s.startsWith(r))&&Js.test(a))return a}return e}var ta={inline:"Inline booth \xB7 1 open side",corner:"Corner booth \xB7 2 open sides",peninsula:"Peninsula booth \xB7 3 open sides",island:"Island booth \xB7 4 open sides"},nh=new Map(yo.map(e=>[e.key,e.label]));function oh(e){return`picker.access.${e}`}function na(e){let t=[],n=e.boothType;n&&Object.prototype.hasOwnProperty.call(ta,n)&&t.push({key:`booth:${n}`,icon:"booth",titleKey:`picker.boothType.${n}`,titleFallback:ta[n],tone:"place"});let o=e.wheelchairSpaceType;for(let a of e.accessibility??[]){if(a==="wheelchair"&&o)continue;let c=nh.get(a);c&&t.push({key:`access:${a}`,icon:a,titleKey:oh(a),titleFallback:c,tone:"access"})}o==="no-seat"?t.push({key:"wheelchair:no-seat",icon:"wheelchair",titleKey:"picker.emptyWheelchairSpace",titleFallback:"Empty wheelchair space",tone:"access"}):o==="seat-present"&&t.push({key:"wheelchair:seat-present",icon:"wheelchair",titleKey:"picker.accessiblePhysicalSeat",titleFallback:"Accessible physical seat",tone:"access"}),e.aisle===!0&&t.push({key:"place:aisle",icon:"aisle",titleKey:"picker.aisleSeat",titleFallback:"Aisle seat",tone:"place"});let r=e.commercial;r?.restrictedView&&t.push({key:"mark:restrictedView",icon:"restrictedView",titleKey:"picker.restrictedView",titleFallback:"Restricted view",tone:"warn"}),r?.obstructedView&&t.push({key:"mark:obstructedView",icon:"obstructedView",titleKey:"picker.obstructedView",titleFallback:"Obstructed view",tone:"warn"}),r?.premium&&t.push({key:"mark:premium",icon:"premium",titleKey:"picker.premiumSeat",titleFallback:"Premium seat",tone:"premium"});let i=r?.note?.trim();if(i){let a=t.find(c=>c.tone==="warn"||c.tone==="premium");a?a.note=i:t.push({key:"note",icon:"note",titleKey:"picker.organizerNote",titleFallback:"Organizer note",tone:"note",note:i})}let s=typeof e.entrance=="string"?e.entrance.trim():"";return s&&t.push({key:"place:entrance",icon:"entrance",titleKey:"picker.entrance",titleFallback:"Entrance",tone:"place",note:s}),t}var rh=1.5,ih=30,sh=4,ah=3.6,ch=6,zo=15,lh=3,uh=1;function fh(e){return Math.max(ah,Math.min(ch,2.4+.15*e))}var Jt=Math.PI*2;function mh(e,t){let n=0,o=0;for(let f of e)n+=f.x,o+=f.y;let r=Math.atan2(o/e.length-t.y,n/e.length-t.x),i=e.map(f=>{let m=Math.atan2(f.y-t.y,f.x-t.x)-r;for(;m>Math.PI;)m-=Jt;for(;m<-Math.PI;)m+=Jt;return m+r}),s=i.map((f,m)=>m).sort((f,m)=>i[f]-i[m]),a=i[s[0]],c=i[s[s.length-1]];if(c-a>Math.PI)return null;let u=f=>Math.hypot(f.x-t.x,f.y-t.y),l=f=>{let m=e[f],h=(f+e.length-1)%e.length,d=(f+1)%e.length,p=Math.abs(i[h]-i[f])<=Math.abs(i[d]-i[f])?h:d,y=e[p];return u(m)<=u(y)?[m,y]:[y,m]};return{start:a,end:c,startEdge:l(s[0]),endEdge:l(s[s.length-1])}}function oa(e){return e.type==="shape"&&e.role==="wall"&&e.heightM===void 0}function Zo(e,t,n=()=>!0){let o=[];for(let c of e){if(!oa(c)||!n(c))continue;let u=ie(c);if(!u||u.length<3)continue;let l=mh(u,t);if(!l)return[];o.push(l)}if(o.length<2)return[];let r=e.flatMap(c=>{if(c.type!=="shape"||c.role!=="entrance"&&c.role!=="exit")return[];let u=ie(c);if(!u?.length)return[];let l=0,f=0;for(let m of u)l+=m.x,f+=m.y;return[{x:l/u.length,y:f/u.length}]}),i=c=>(c%Jt+Jt)%Jt;o.sort((c,u)=>i(c.start)-i(u.start));let s=c=>Math.hypot(c.x-t.x,c.y-t.y),a=[];for(let c=0;c<o.length;c++){let u=o[c],l=o[(c+1)%o.length],f=i(l.start-u.end);if(f<=0||f>=Math.PI/2)continue;let m=b=>i(b-u.end)<f;if(o.some(b=>b!==u&&b!==l&&(m(b.start)||m(b.end)||i(u.end-b.start)<b.end-b.start)))continue;let[d,p]=u.endEdge,[y,g]=l.startEdge,M={x:(d.x+p.x)/2,y:(d.y+p.y)/2},P={x:(y.x+g.x)/2,y:(y.y+g.y)/2},w=Math.hypot(P.x-M.x,P.y-M.y)*E;if(w<rh||w>ih||Math.abs(s(M)-s(P))*E>sh+.2*w)continue;let x={x:(M.x+P.x)/2,y:(M.y+P.y)/2};r.some(b=>m(Math.atan2(b.y-t.y,b.x-t.x))&&Math.abs(s(b)-s(x))*E<=lh)||a.push({quad:[d,p,g,y],mid:x,widthM:w,openingM:fh(w)})}return a}function ra(e,t){let n=[];for(let i of t)if(i.text?.trim())for(let s of e){let a=Math.hypot(i.position.x-s.mid.x,i.position.y-s.mid.y)*E;a<=zo&&n.push({text:i,gate:s,d:a})}n.sort((i,s)=>i.d-s.d);let o=new Map,r=new Set;for(let{text:i,gate:s}of n)o.has(i.id)||r.has(s)||(o.set(i.id,s),r.add(s));return o}function ia(e,t,n,o,r,i,s,a=()=>!0){let c=Zo(t,_t(n),a);if(!c.length)return;let u=t.find(f=>oa(f)&&a(f)),l=Ln(u?.fill,s);e.setMaterial(wn);for(let f of c)r-f.openingM<uh||An(e,f.quad,o+f.openingM,o+r,[],l.top,l.wall,i,r);e.setMaterial(0)}var hh=6,dh=2.2,Hn=.1,ph=/^(gate|entrance|entry|exit|way in|way out|door)s?$/i,bh=new Set(["stage","entrance","exit","screen","suite","obstruction","sound","bar","concession","restroom","coat"]),yh=.3,gh=1.8,xh=.9,Mh=.55,Sh=1,sa=4e3,Ph=6,aa="#d8a425",Ih="#e8c15a",$o="#1c1608";function ca(e){let t=Rh(e);if(!t)return null;let n=na(e).find(o=>o.icon===t.icon);return{...t,name:n?.titleFallback??t.icon}}function Rh(e){let t=e.accessibility;if(t?.length)return{icon:t.includes("wheelchair")?"wheelchair":t[0],color:gn(t)};let n=e.commercial;return n?.obstructedView?{icon:"obstructedView",color:aa,ink:$o}:n?.restrictedView?{icon:"restrictedView",color:aa,ink:$o}:n?.premium?{icon:"premium",color:Ih,ink:$o}:null}function wh(e,t){if(!e)return;let n,o=0;for(let[i,s]of e)s>o&&(o=s,n=i);let r=t.categories?.find(i=>i.key===n)?.color;return r&&/^#[0-9a-f]{6}$/i.test(r)?r:void 0}var Eh=6e3,Ah=.25,la=[-90,90,-135,135,-45,45];function _h(e,t,n,o){let r=e.flatMap(({id:s,a,members:c})=>{let u=(a.minX+a.maxX)/2,l=(a.minY+a.maxY)/2,f=.5*Math.hypot(a.maxX-a.minX,a.maxY-a.minY),m=1/0;for(let h of c)m=Math.min(m,Math.hypot(t[h].x-u,t[h].y-l));return c.length&&m>=f*Ah?[{id:s,cx:u,cy:l,half:f,members:c}]:[]}).sort((s,a)=>s.half-a.half),i=new Map;return r.forEach(({id:s,cx:a,cy:c,members:u},l)=>{let f=o.x-a,m=o.y-c,p=(Math.hypot(f,m)>1e-6?Math.atan2(m,f):0)+la[l%la.length]*Math.PI/180,y=Math.cos(p),g=Math.sin(p),M=-1,P=-1/0;for(let w of u){let x=(t[w].x-a)*y+(t[w].y-c)*g;x>P&&(P=x,M=w)}i.set(s,[t[M].x*E,n.seatDeckY(M),t[M].y*E])}),i}function fa(e){let{doc:t,units:n,seats:o,surfaces:r,focal:i}=e,s=t.zones??[],a=[];if(s.length){let c=new Map;for(let m of n)for(let h of m.objects)h.type==="section"&&h.zone&&c.set(h.id,h.zone);let u=new Map,l=new Map;for(let m=0;m<o.length;m++){let h=o[m],d=r.seatOwner[m],p=h.zoneId??(d?c.get(d):void 0);if(!p)continue;let y=u.get(p);y||(y={n:0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0,sumY:0},u.set(p,y));let g=l.get(p);g||l.set(p,g=[]),g.push(m),y.n++,h.x<y.minX&&(y.minX=h.x),h.y<y.minY&&(y.minY=h.y),h.x>y.maxX&&(y.maxX=h.x),h.y>y.maxY&&(y.maxY=h.y),y.sumY+=r.seatDeckY(m)}let f=_h(s.flatMap(m=>{let h=u.get(m.id);return h?[{id:m.id,a:h,members:l.get(m.id)??[]}]:[]}),o,r,i);for(let m of s){let h=u.get(m.id),d=[];for(let[p,y]of c)y===m.id&&d.push(p);if(!h||h.n===0){a.push({id:m.id,label:m.label,color:oe(m.color),sectionIds:d,seatCount:0,center:[0,0,0],radius:0,focalWorld:[(m.focalPoint??i).x*E,1.5,(m.focalPoint??i).y*E]});continue}a.push({id:m.id,label:m.label,color:oe(m.color),sectionIds:d,seatCount:h.n,...f.has(m.id)?{labelAt:f.get(m.id)}:{},center:[(h.minX+h.maxX)/2*E,h.sumY/h.n,(h.minY+h.maxY)/2*E],radius:.5*Math.hypot((h.maxX-h.minX)*E,(h.maxY-h.minY)*E)||1,focalWorld:[(m.focalPoint??i).x*E,1.5,(m.focalPoint??i).y*E]})}}return a}function ma(e){let{doc:t,units:n,seats:o,surfaces:r,seatData:i,hintedSeatFloor:s,zones:a,focal:c}=e,u=[],l=[],f=[],m=new Map;for(let h of n)for(let d of h.objects){if(d.type!=="section"||!d.zone)continue;let p=(d.displayLabel||d.label||"").trim().toLocaleLowerCase();if(!p)continue;let y=t.floors?.[h.index]?.name?.trim().toLocaleLowerCase();if(n.length>1&&y===p)continue;let g=m.get(d.zone);g||m.set(d.zone,g=new Set),g.add(p)}for(let h of a)h.seatCount!==0&&(m.get(h.id)?.has(h.label.trim().toLocaleLowerCase())||u.push({id:`zone:${h.id}`,kind:"zone",text:h.label,anchor:[(h.labelAt??h.center)[0],(h.labelAt??h.center)[1]+hh,(h.labelAt??h.center)[2]],color:t.zones?.find(d=>d.id===h.id)?.color}));{let h=new Map,d=new Map,p=new Map,y=new Map;for(let g=0;g<o.length;g++){let M=r.seatOwner[g];if(!M)continue;let P=h.get(M);P||(P={n:0,x:0,y:0,deck:0},h.set(M,P)),P.n++,P.x+=o[g].x,P.y+=o[g].y,P.deck+=r.seatDeckY(g);let w=o[g].categoryKey;if(w){let b=d.get(M);b||(b=new Map,d.set(M,b)),b.set(w,(b.get(w)??0)+1)}if(o[g].accessibility?.includes("wheelchair")){let b=p.get(M);b?b.push(g):p.set(M,[g])}let x=y.get(M);x||(x={minX:1/0,maxX:-1/0,minY:1/0,maxY:-1/0,minDeck:1/0,maxDeck:-1/0},y.set(M,x)),x.minDeck=Math.min(x.minDeck,r.seatDeckY(g)),x.maxDeck=Math.max(x.maxDeck,r.seatDeckY(g)),o[g].x<x.minX&&(x.minX=o[g].x),o[g].x>x.maxX&&(x.maxX=o[g].x),o[g].y<x.minY&&(x.minY=o[g].y),o[g].y>x.maxY&&(x.maxY=o[g].y)}for(let g of n)for(let M of g.objects){if(M.type!=="section"||Ys(M))continue;let P=h.get(M.id);if(!P||P.n===0)continue;let w=y.get(M.id),x=[P.x/P.n*E,P.deck/P.n,P.y/P.n*E],b=M.displayLabel||M.label||M.id;l.push({id:M.id,floorIndex:g.index,label:b,seatCount:P.n,center:x,radius:Math.max(1,Math.hypot(w.maxX-w.minX,w.maxY-w.minY)*.5*E),box:{min:[w.minX*E-.4,w.minDeck,w.minY*E-.4],max:[w.maxX*E+.4,w.maxDeck+1,w.maxY*E+.4]},focalWorld:[g.focal.x*E,g.baseHeightM+1.5,g.focal.y*E]});let S=t.floors?.[g.index]?.name?.trim().toLocaleLowerCase();if(!(n.length>1&&S===b.trim().toLocaleLowerCase())){let I=wh(d.get(M.id),t),R=p.get(M.id);u.push({id:`section:${M.id}`,kind:"section",text:b,anchor:[x[0],x[1]+dh,x[2]],floorIndex:g.index,...I?{tint:I}:{},...R?{wheelchairSeats:R}:{}})}}}{for(let x of n)for(let b of x.objects){if(b.type!=="gaArea")continue;let S=ht(b.points);if(!S)continue;let I=b.labelPresentation?.visible===!1?"":b.displayLabel||b.label||b.id,R=b.capacity>0?[I,b.capacity.toLocaleString()].filter(Boolean).join(" \xB7 "):I;R&&u.push({id:`ga:${b.id}`,kind:"ga",text:R,anchor:[S.x*E,x.baseHeightM+gh,S.y*E],floorIndex:x.index})}let h=new Map,d=new Map;for(let x of n)for(let b of x.objects)if(b.type==="section"&&h.set(b.id,b.displayLabel||b.label||b.id),b.type==="row"){let S=b.displayLabel?.trim()||b.segmentedRow?.displayLabel?.trim();S&&d.set(b.id,S)}let p=new Map;for(let x=0;x<o.length;x++){let b=o[x],S=Math.hypot(b.x-c.x,b.y-c.y),I=p.get(b.rowId);(!I||S>I.far)&&p.set(b.rowId,{seat:b,index:x,far:S})}for(let[x,b]of p){let S=r.seatOwner[b.index]??b.seat.sectionId,I=ua(b.seat.label,x,h.get(S??""),d.get(x));I&&u.push({id:`row:${x}`,kind:"row",text:I,anchor:[b.seat.x*E,r.seatDeckY(b.index)+xh,b.seat.y*E],floorIndex:s[b.index]})}let y=new Map;for(let x=0;x<o.length;x++){let b=o[x],S=y.get(b.rowId);S||(S={n:0,x:0,y:0,z:0,minX:1/0,maxX:-1/0,minZ:1/0,maxZ:-1/0,label:ua(b.label,b.rowId,h.get(r.seatOwner[x]??b.sectionId??""),d.get(b.rowId)),sectionId:r.seatOwner[x]??b.sectionId},y.set(b.rowId,S));let I=x*3,R=i.iPosition[I],k=i.iPosition[I+1],L=i.iPosition[I+2];S.n++,S.x+=R,S.y+=k,S.z+=L,S.minX=Math.min(S.minX,R),S.maxX=Math.max(S.maxX,R),S.minZ=Math.min(S.minZ,L),S.maxZ=Math.max(S.maxZ,L)}for(let[x,b]of y)f.push({id:x,label:b.label,sectionId:b.sectionId,seatCount:b.n,center:[b.x/b.n,b.y/b.n,b.z/b.n],radius:Math.max(.8,Math.hypot(b.maxX-b.minX,b.maxZ-b.minZ)*.5)});let g=0,M=(x,b)=>{g++,u.push({id:`access:${o[x].id}`,kind:"access",text:b.name,icon:b.icon,color:b.color,...b.ink?{ink:b.ink}:{},seatWidthM:i.iChairWidth[x]*2,anchor:[o[x].x*E,r.seatDeckY(x)+Sh,o[x].y*E],floorIndex:s[x],rowId:o[x].rowId})},P=null,w=()=>{if(P){let x=ca(o[P.seats[0]]),b=P.seats.length,S=Math.max(1,Math.round(b/Ph));for(let I=0;I<S&&g<sa;I++)M(P.seats[Math.min(b-1,Math.floor((I+.5)*b/S))],x)}P=null};for(let x=0;x<o.length&&g<sa;x++){let b=ca(o[x]);if(b&&o[x].accessibility?.length){w(),M(x,b);continue}if(!b){w();continue}P&&P.rowId===o[x].rowId&&P.icon===b.icon?P.seats.push(x):(w(),P={rowId:o[x].rowId,icon:b.icon,seats:[x]})}if(w(),o.length<=Eh)for(let x=0;x<o.length;x++){let b=o[x],S=vh(b.displayLabel||b.label);S&&u.push({id:`seat:${b.id}`,kind:"seat",seatWidthM:i.iChairWidth[x]*2,text:S,anchor:[b.x*E,r.seatDeckY(x)+Mh,b.y*E],floorIndex:s[x],rowId:b.rowId})}}for(let h of n){let d=tt(h,n.length===1?o:o.filter((g,M)=>s[M]===h.index)),p=d?ra(Zo(h.objects,_t(d)),h.objects.filter(g=>g.type==="text")):new Map,y=[...p.values()];for(let g of h.objects){let M=g.type==="text"?p.get(g.id):void 0;if(g.type==="shape"&&(g.role==="entrance"||g.role==="exit")&&ph.test(g.label?.trim()??"")){let P=ie(g),w=P?ht(P):null;if(w&&y.some(x=>Math.hypot(w.x-x.mid.x,w.y-x.mid.y)*E<=zo+x.widthM))continue}if(M&&g.type==="text")u.push({id:`text:${g.id}`,kind:"gate",text:g.text,icon:"entrance",anchor:[M.mid.x*E,h.baseHeightM+M.openingM+Hn,M.mid.y*E],color:g.color,floorIndex:h.index});else if(g.type==="shape"&&g.role&&bh.has(g.role)){let P=ie(g),w=P?ht(P):null;if(!w||!g.label||g.gate?.hideFromBuyers)continue;u.push({id:`architecture:${g.id}`,kind:g.role==="stage"?"stage":g.role==="entrance"||g.role==="exit"?"gate":"annotation",text:g.label,...g.role==="entrance"||g.role==="exit"?{icon:g.role}:{},...g.gate?.stepFree?{stepFree:!0}:{},anchor:[w.x*E,h.baseHeightM+Fe(g).heightM+Hn,w.y*E],color:g.fill,floorIndex:h.index})}else if(g.type==="text"){let P=g.semanticKind==="icon"?xo(g.iconKey)?.key:void 0,w=g.text||(P?xo(P).label:"");if(!w)continue;u.push({id:`text:${g.id}`,kind:"annotation",text:w,...P?{venueIcon:P}:{},anchor:P?[(g.position.x+g.fontSize/2)*E,h.baseHeightM+Hn,(g.position.y+g.fontSize/2)*E]:[g.position.x*E,h.baseHeightM+Hn,g.position.y*E],color:g.color,rotation:g.rotation,floorIndex:h.index})}else if(g.type==="booth"){if(g.labelPresentation?.visible===!1)continue;let P=Ne(g);if(!P)continue;let w=ht(P);if(!w)continue;u.push({id:`booth:${g.id}`,kind:"booth",text:g.displayLabel||g.label||g.id,anchor:[w.x*E,h.baseHeightM+Bn+yh,w.y*E],floorIndex:h.index})}}}return{labels:u,sections:l,rows:f}}function ha(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 vh(e){let t=e.lastIndexOf("-");return t>=0&&t<e.length-1?e.slice(t+1):e}function ua(e,t,n,o){if(o?.trim())return o.trim();let r=e?e.lastIndexOf("-"):-1,i=r>0?e.slice(0,r):t;return i&&ea(i,n)}function da(e){let{doc:t,units:n,seats:o,surfaces:r,solids:i,hintedSeatFloor:s,seatFloor:a}=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 h=Math.max(0,Math.min(n.length-1,Math.round(i.floor[m]))),d=m*3,p=u[h];p.minX=Math.min(p.minX,i.position[d]),p.minY=Math.min(p.minY,i.position[d+1]),p.minZ=Math.min(p.minZ,i.position[d+2]),p.maxX=Math.max(p.maxX,i.position[d]),p.maxY=Math.max(p.maxY,i.position[d+1]),p.maxZ=Math.max(p.maxZ,i.position[d+2])}let l=new Map;for(let m=0;m<n.length;m++)for(let h of n[m].objects)h.type==="section"&&l.set(h.id,m);let f=n.map(()=>({n:0,minX:1/0,minY:1/0,minDeck:1/0,maxX:-1/0,maxY:-1/0,maxDeck:-1/0,sumX:0,sumDeck:0,sumZ:0}));for(let m=0;m<o.length;m++){let h=r.seatOwner[m],d=(h!==null?l.get(h):void 0)??s[m];if(d===void 0)continue;let p=f[d],y=o[m];p.n++,y.x<p.minX&&(p.minX=y.x),y.y<p.minY&&(p.minY=y.y),y.x>p.maxX&&(p.maxX=y.x),y.y>p.maxY&&(p.maxY=y.y);let g=r.seatDeckY(m);p.sumX+=y.x*E,p.sumDeck+=g,p.sumZ+=y.y*E,p.minDeck=Math.min(p.minDeck,g),p.maxDeck=Math.max(p.maxDeck,g+1.6),a[m]=d}for(let m=0;m<n.length;m++){let h=f[m],d=t.floors?.[m],p=u[m],y=Math.min(h.n?h.minX*E:n[m].focal.x*E-1,Number.isFinite(p.minX)?p.minX:1/0),g=Math.max(h.n?h.maxX*E:n[m].focal.x*E+1,Number.isFinite(p.maxX)?p.maxX:-1/0),M=Math.min(h.n?h.minY*E:n[m].focal.y*E-1,Number.isFinite(p.minZ)?p.minZ:1/0),P=Math.max(h.n?h.maxY*E:n[m].focal.y*E+1,Number.isFinite(p.maxZ)?p.maxZ:-1/0),w=Math.min(h.n?Math.min(n[m].baseHeightM,h.minDeck):n[m].baseHeightM,Number.isFinite(p.minY)?p.minY:1/0),x=Math.max(h.n?Math.max(h.maxDeck,w+.5):w+.5,Number.isFinite(p.maxY)?p.maxY:-1/0),b=[h.n?h.sumX/h.n:(y+g)/2,h.n?h.sumDeck/h.n:(w+x)/2,h.n?h.sumZ/h.n:(M+P)/2],S=Math.max(1,.5*Math.hypot(g-y,x-w,P-M));c.push({index:m,id:d?.id??`floor-${m}`,label:d?.name??(n.length>1?`Floor ${m+1}`:"Venue"),seatCount:h.n,center:b,radius:S,box:{min:[y,w,M],max:[g,x,P]},focalWorld:[n[m].focal.x*E,n[m].baseHeightM+1.5,n[m].focal.y*E]})}}return c}function Qo(e,t){let n=1/0,o=1/0,r=-1/0,i=-1/0,s=(a,c)=>{a<n&&(n=a),c<o&&(o=c),a>r&&(r=a),c>i&&(i=c)};for(let a of t)s(a.x,a.y);for(let a of e)for(let c of a.objects)if(c.type==="section")for(let u of c.outline)s(u.x,u.y);else if(c.type==="shape"&&c.points)for(let u of c.points)s(u.x,u.y);else if(c.type==="gaArea")for(let u of c.points)s(u.x,u.y);else if(c.type==="booth"){let u=Ne(c);if(u)for(let l of u)s(l.x,l.y)}else if(c.type==="table"){let u=Fn(c);if(u)for(let l of u)s(l.x,l.y)}else if(c.type==="decorImage"){let u=Nn(c);if(u)for(let l of u)s(l.x,l.y)}return Number.isFinite(n)||(n=-100,o=-100,r=100,i=100),{minX:n,minY:o,maxX:r,maxY:i}}function Ma(e,t,n,o,r,i,s){if(t.length===1){let a=n.map(m=>({x:m.x,y:m.y}));for(let m of t[0].objects)m.type==="section"?a.push(...m.outline):m.type==="shape"?a.push(...ie(m)??m.points??[]):m.type==="gaArea"?a.push(...m.points):m.type==="booth"?a.push(...Ne(m)??[]):m.type==="table"?a.push(...Fn(m)??[]):m.type==="decorImage"&&a.push(...Nn(m)??[]);if(ya(e,t[0],n,i)||xa(e,t[0],n,a,i))return!1;if(s&&ba(e,t[0].baseHeightM,a,i,s))return!0;let c=Yt(a),u=(r.minX+r.maxX)/2,l=(r.minY+r.maxY)/2,f=c.length>=3?c.map(m=>{let h=m.x-u,d=m.y-l,p=Math.max(1,Math.hypot(h,d));return{x:m.x+h/p*80,y:m.y+d/p*80}}):Ht(r.minX-28,r.minY-28,r.maxX-r.minX+56,r.maxY-r.minY+56);return z(e,f,void 0,()=>-.04,-.22,i.ground,i.ground,K),!1}else{let a=t.reduce((y,g)=>g.baseHeightM<y.baseHeightM?g:y);e.setFloor(a.index);let c={...a,objects:t.flatMap(y=>y.objects)},u=n.map(y=>({x:y.x,y:y.y}));for(let y of c.objects)y.type==="section"&&u.push(...y.outline);if(ya(e,c,n,i)||xa(e,c,n,u,i))return!1;if(s&&ba(e,a.baseHeightM,u,i,s))return!0;let l=n.filter((y,g)=>o[g]===a.index),f=Qo([a],l),m=Math.hypot(f.maxX-f.minX,f.maxY-f.minY),h=Math.max(28,Math.min(80,m*.04)),d=Ht(f.minX-h,f.minY-h,f.maxX-f.minX+h*2,f.maxY-f.minY+h*2),p=a.baseHeightM-.03;return z(e,d,void 0,()=>p,p-.22,i.ground,i.ground,K),!1}}function qo(e,t,n,o){let{cx:r,cz:i,radius:s}=n,a=1/0,c=1/0,u=1/0,l=-1/0,f=-1/0,m=-1/0,h=(y,g,M)=>{a=Math.min(a,y),l=Math.max(l,y),c=Math.min(c,g),f=Math.max(f,g),u=Math.min(u,M),m=Math.max(m,M)};for(let y=0;y<e.position.length;y+=3){let g=y/3;o&&g>=o[0]&&g<o[1]||h(e.position[y],e.position[y+1],e.position[y+2])}for(let y=0;y<t.count;y++){let g=y*3,M=t.iPosition[g],P=t.iPosition[g+1],w=t.iPosition[g+2],x=Math.max(.35,t.iMaxRadius[y]??.35);h(M-x,P,w-x),h(M+x,P+1.6,w+x)}Number.isFinite(a)||(a=r-s,l=r+s,c=0,f=s*.16,u=i-s,m=i+s);let d=[(a+l)/2,(c+f)/2,(u+m)/2],p=Math.max(1,.5*Math.hypot(l-a,f-c,m-u));return{center:d,radius:p,minY:c,maxY:f}}var Ch=4096;function Sa(e,t,n=[]){let o=Math.max(1,Math.ceil(e.count/Ch)),r=Math.ceil(e.count/o),i=new Float32Array((r*2+t.length*4+n.length)*3),s=0;for(let a=0;a<e.count;a+=o){let c=e.iPosition[a*3],u=e.iPosition[a*3+1],l=e.iPosition[a*3+2];i[s++]=c,i[s++]=u,i[s++]=l,i[s++]=c,i[s++]=0,i[s++]=l}for(let[a,c,u]of n)i[s++]=a,i[s++]=c,i[s++]=u;for(let a of t)for(let[c,u]of[[-1,-1],[1,-1],[1,1],[-1,1]])i[s++]=a.cx+c*a.halfX,i[s++]=a.y,i[s++]=a.cz+u*a.halfZ;return i.subarray(0,s)}function Pa(e,t,n,o,r,i,s=[]){let a=1/0,c=1/0,u=-1/0,l=-1/0;for(let x=0;x<e.count;x++){let b=x*3,S=e.iPosition[b],I=e.iPosition[b+2];S<a&&(a=S),S>u&&(u=S),I<c&&(c=I),I>l&&(l=I)}for(let[x,,b]of s)x<a&&(a=x),x>u&&(u=x),b<c&&(c=b),b>l&&(l=b);for(let x of t)a=Math.min(a,x.cx-x.halfX),u=Math.max(u,x.cx+x.halfX),c=Math.min(c,x.cz-x.halfZ),l=Math.max(l,x.cz+x.halfZ);let f=n.minX*E,m=n.maxX*E,h=n.minY*E,d=n.maxY*E,p=f,y=m,g=h,M=d;if(Number.isFinite(a)){let x=Math.max(2,.06*Math.hypot(u-a,l-c));p=Math.max(f,a-x),y=Math.min(m,u+x),g=Math.max(h,c-x),M=Math.min(d,l+x)}let P=Math.min(0,o),w=Math.max(r,i*.05);return{min:[p,P,g],max:[y,w,M]}}var pa=12,kh=.6,Oh=40;function ba(e,t,n,o,r){let i=Yt([...n]);if(i.length<3)return!1;let s=1/0,a=1/0,c=-1/0,u=-1/0;for(let w of i)s=Math.min(s,w.x),c=Math.max(c,w.x),a=Math.min(a,w.y),u=Math.max(u,w.y);let l=Math.hypot(c-s,u-a)*E,f=Le(i,pa/E,1.2),m=Math.max(Oh,l*kh),h=Le(i,(pa+m)/E,1.2);if(f.length!==h.length)return!1;let d=re(o.ground,[.78,.76,.72],.35),p=re(o.ground,[.56,.62,.52],.3);z(e,f,void 0,()=>t-.04,t-.22,d,d,K);let y=t-.05,g=f.map(w=>[w.x*E,y,w.y*E]),M=h.map(w=>[w.x*E,y,w.y*E]),P=[0,1,0];for(let w=0;w<g.length;w++){let x=(w+1)%g.length;e.tri(g[w],M[x],M[w],P,p,r,r),e.tri(g[w],g[x],M[x],P,p,p,r)}return!0}function ya(e,t,n,o){let r=tt(t,n);if(!r)return!1;let i=t.baseHeightM,s=re(o.ground,[.62,.55,.47],.4);return z(e,r,void 0,()=>i-.04,i-.22,s,s,K),!0}var Th=3e3,Lh=20,ga=1.5,Bh=1.2,Fh=.25;function xa(e,t,n,o,r){if(!n.length||n.length>Th||o.length<3)return!1;for(let R of t.objects){if(R.type==="shape"&&on(R.stageKind))return!1;if(R.type==="section"){let{height:k}=Qe(R,{floorBaseHeightM:t.baseHeightM});if(k-t.baseHeightM>Lh)return!1}}let i=0,s=0;for(let R of o)i+=R.x,s+=R.y;i/=o.length,s/=o.length;let a=0,c=0,u=0;for(let R of o){let k=R.x-i,L=R.y-s;a+=k*k,c+=L*L,u+=k*L}let l=.5*Math.atan2(2*u,a-c),f=Math.cos(l),m=Math.sin(l),h=-m,d=f,p=1/0,y=-1/0,g=1/0,M=-1/0;for(let R of o){let k=(R.x-i)*f+(R.y-s)*m,L=(R.x-i)*h+(R.y-s)*d;p=Math.min(p,k),y=Math.max(y,k),g=Math.min(g,L),M=Math.max(M,L)}let P=R=>[[p-R,g-R],[y+R,g-R],[y+R,M+R],[p-R,M+R]].map(([k,L])=>({x:i+f*k+h*L,y:s+m*k+d*L})),w=P(ga/E),x=P((ga+Fh)/E),b=t.baseHeightM,S=re(r.ground,[.62,.55,.47],.4),I=re(r.ground,[.86,.86,.84],.55);return z(e,x,void 0,()=>b-.04,b-.22,S,S,K),z(e,x,[w.slice().reverse()],()=>b+Bh,b-.04,re(I,[1,1,1],.2),I,K),!0}function Ia(e,t,n){let o=()=>({byObjectId:new Map,elements:[]});if(!t||!e)return o();let r=wr(t);if(!r.ok||r.value.id!==e)return o();let i=new Map;for(let f of n)for(let m of f.objects)m.type==="shape"&&i.set(m.id,{shape:m,unit:f});let s=new Set,a=new Set,c=new Map((t.overlay.productionElements??[]).map(f=>{let m=f.runtimeContentImageUrl;return[f.id,typeof m=="string"&&/^(?:blob:|data:image\/|https:\/\/)/.test(m)?m:void 0]})),u=[];for(let f of r.value.overlay.productionElements??[]){let m=i.get(f.objectId),h=m?ie(m.shape):null,d=f.baseElevationM??0;if(!m||!h||h.length<3||!f.id||s.has(f.id)||a.has(f.objectId)||!Number.isFinite(f.heightM)||f.heightM<.05||f.heightM>50||!Number.isFinite(d)||d<-10||d>100)return o();s.add(f.id),a.add(f.objectId);let p=h.map(I=>I.x*E),y=h.map(I=>I.y*E),g=m.unit.baseHeightM+d,M=Math.min(...p),P=Math.max(...p),w=Math.min(...y),x=Math.max(...y),b,S=c.get(f.id)??f.contentImageUrl;if(f.kind==="screen"&&S&&(b=zi(h,g,g+f.heightM,m.unit.focal),!b))if(P-M>=x-w){let I=Math.abs(w-m.unit.focal.y*E)<=Math.abs(x-m.unit.focal.y*E)?w-.006:x+.006;b=[[M,g,I],[P,g,I],[M,g+f.heightM,I],[P,g+f.heightM,I]]}else{let I=Math.abs(M-m.unit.focal.x*E)<=Math.abs(P-m.unit.focal.x*E)?M-.006:P+.006;b=[[I,g,w],[I,g,x],[I,g+f.heightM,w],[I,g+f.heightM,x]]}u.push({id:f.id,objectId:f.objectId,kind:f.kind,floorIndex:m.unit.index,baseY:g,topY:g+f.heightM,bounds:{min:[M,g,w],max:[P,g+f.heightM,x]},occlusion:f.occlusion,...S?{contentImageUrl:S}:{},...b?{contentPlane:b}:{}})}let l=u.sort((f,m)=>f.id.localeCompare(m.id));return{byObjectId:new Map(l.map(f=>[f.objectId,f])),elements:l}}var Ra=[.13,.14,.17],Tt=[.4,.43,.47],Nh=.18,Dh=.02,Gh=2.4,jh=1500,Hh=240,Vh=.25;function wa(e,t,n,o){let r=t.stageKind??"";if(st(r)||r==="round"||!o.length)return;let i=ie(t);if(!i||i.length<3)return;let s={x:i.reduce((C,B)=>C+B.x,0)/i.length,y:i.reduce((C,B)=>C+B.y,0)/i.length},a=0,c=0,u=new Set;for(let C of o)a+=C.x,c+=C.y,u.add(Math.floor(Math.atan2(C.y-s.y,C.x-s.x)*180/Math.PI/10));let l=s.x-a/o.length,f=s.y-c/o.length,m=Math.hypot(l,f);if(m<1e-6)return;let h=o.reduce((C,B)=>C+Math.hypot(B.x-s.x,B.y-s.y),0)/o.length;if(u.size*10>Hh&&m<Vh*h)return;let d=l/m,p=f/m,y=-p,g=d,M=-1/0,P=1/0,w=1/0,x=-1/0;for(let C of i){let B=(C.x-s.x)*d+(C.y-s.y)*p,O=(C.x-s.x)*y+(C.y-s.y)*g;M=Math.max(M,B),P=Math.min(P,B),w=Math.min(w,O),x=Math.max(x,O)}let b=(x-w)*E,S=(M-P)*E;if(b<3||S<1.5||b*S>jh)return;let I=Nh/E,R=(C,B)=>({x:s.x+d*C+y*B,y:s.y+p*C+g*B}),k=(C,B,O,F)=>[R(C,O),R(C,F),R(B,F),R(B,O)],L=n+Math.max(3.5,Math.min(8,b*.35)),T=n+Math.min(Gh,L-n-1),v=.2/E,A=P+Math.min(S*.25,1.5)/E,_=Dh/E;z(e,k(M-2*I+_,M-I-_,w+I+v,x-I-v),void 0,()=>T,n,Ra,Ra,K);for(let[C,B]of[[w+I,w+I+v],[x-I-v,x-I]])z(e,k(M-2*I,M-I,C,B),void 0,()=>L+.3,n,Tt,Tt,K),z(e,k(A+v,M-2*I,C,B),void 0,()=>L+.3,L,Tt,Tt,K);z(e,k(A,A+v,w+I,x-I),void 0,()=>L+.3,L,Tt,Tt,K)}function ke(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function Ce(e){return Array.isArray(e)?e:[]}function Uh(e){let t=[e];for(;t.length;){let n=t.pop();if(Array.isArray(n)){t.push(...n);continue}if(!ke(n))continue;let o=ke(n.extensions)?n.extensions:null;if(o&&Object.prototype.hasOwnProperty.call(o,"KHR_draco_mesh_compression"))return!0;t.push(...Object.values(n))}return!1}function Vn(e,t){return!Array.isArray(e)||e.length!==t||!e.every(n=>typeof n=="number"&&Number.isFinite(n))?null:e}function Xh(){return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}function Kh(e,t){let n=new Array(16).fill(0);for(let o=0;o<4;o++)for(let r=0;r<4;r++)for(let i=0;i<4;i++)n[o*4+r]+=e[i*4+r]*t[o*4+i];return n}function Yh(e){let t=Vn(e.matrix,16);if(t)return t;if(e.matrix!==void 0)return null;let n=e.translation===void 0?[0,0,0]:Vn(e.translation,3),o=e.rotation===void 0?[0,0,0,1]:Vn(e.rotation,4),r=e.scale===void 0?[1,1,1]:Vn(e.scale,3);if(!n||!o||!r)return null;let[i,s,a,c]=o,u=Math.hypot(i,s,a,c);if(!(u>1e-8))return null;let l=i/u,f=s/u,m=a/u,h=c/u,d=l+l,p=f+f,y=m+m,g=l*d,M=l*p,P=l*y,w=f*p,x=f*y,b=m*y,S=h*d,I=h*p,R=h*y;return[(1-(w+b))*r[0],(M+R)*r[0],(P-I)*r[0],0,(M-R)*r[1],(1-(g+b))*r[1],(x+S)*r[1],0,(P+I)*r[2],(x-S)*r[2],(1-(g+w))*r[2],0,n[0],n[1],n[2],1]}function Wh(e,t,n,o){return[e[0]*t+e[4]*n+e[8]*o+e[12],e[1]*t+e[5]*n+e[9]*o+e[13],e[2]*t+e[6]*n+e[10]*o+e[14]]}function zh(e){let t=e[0],n=e[4],o=e[8],r=e[1],i=e[5],s=e[9],a=e[2],c=e[6],u=e[10],l=i*u-s*c,f=s*a-r*u,m=r*c-i*a,h=t*l+n*f+o*m;if(Math.abs(h)<1e-12)return null;let d=1/h;return[l*d,f*d,m*d,(o*c-n*u)*d,(t*u-o*a)*d,(n*a-t*c)*d,(n*s-o*i)*d,(o*r-t*s)*d,(t*i-n*r)*d]}function Ea(e,t,n,o){let r=e[0]*t+e[1]*n+e[2]*o,i=e[3]*t+e[4]*n+e[5]*o,s=e[6]*t+e[7]*n+e[8]*o,a=Math.hypot(r,i,s)||1;return r/=a,i/=a,s/=a,[r,i,s]}function Zh(e){if(e.byteLength<20||e.byteLength>8388608)return null;let t=new DataView(e.buffer,e.byteOffset,e.byteLength);if(t.getUint32(0,!0)!==1179937895||t.getUint32(4,!0)!==2||t.getUint32(8,!0)!==e.byteLength)return null;let n=12,o=null,r=null;for(;n+8<=e.byteLength;){let i=t.getUint32(n,!0),s=t.getUint32(n+4,!0);if(n+=8,i%4!==0||n+i>e.byteLength)return null;let a=e.subarray(n,n+i);if(s===1313821514&&!o)try{let c=JSON.parse(new TextDecoder().decode(a).replace(/[\u0000 ]+$/g,""));if(!ke(c))return null;o=c}catch{return null}else if(s===5130562&&!r)r=a;else return null;n+=i}return n===e.byteLength&&o&&r?{json:o,bin:r}:null}function $h(e){return e===5120||e===5121?1:e===5122||e===5123?2:e===5125||e===5126?4:0}function Qh(e){return e==="SCALAR"?1:e==="VEC2"?2:e==="VEC3"?3:e==="VEC4"?4:0}function qh(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 Jh(e){let t=e instanceof Uint8Array?e:new Uint8Array(e),n=Zh(t);if(!n)return{ok:!1,issue:"invalid_glb"};let{json:o,bin:r}=n;if(!ke(o.asset)||o.asset.version!=="2.0")return{ok:!1,issue:"unsupported_glb"};let i=Ce(o.extensionsUsed).filter(w=>typeof w=="string");if(i.includes("KHR_draco_mesh_compression")||Uh(o))return{ok:!1,issue:"draco_not_allowed"};if(i.length||Ce(o.extensionsRequired).length)return{ok:!1,issue:"unsupported_glb"};if(Ce(o.images).length||Ce(o.textures).length)return{ok:!1,issue:"external_resource"};let s=Ce(o.buffers);if(s.length!==1||!ke(s[0])||s[0].uri!==void 0||typeof s[0].byteLength!="number"||!Number.isInteger(s[0].byteLength)||s[0].byteLength<0||s[0].byteLength>r.byteLength)return{ok:!1,issue:"external_resource"};let a=Ce(o.accessors),c=Ce(o.bufferViews),u=Ce(o.meshes),l=Ce(o.nodes),f=Ce(o.scenes),m=typeof o.scene=="number"?o.scene:0;if(!ke(f[m]))return{ok:!1,issue:"unsupported_glb"};let h=new DataView(r.buffer,r.byteOffset,r.byteLength),d=(w,x,b)=>{if(typeof w!="number"||!Number.isInteger(w)||!ke(a[w]))return null;let S=a[w];if(S.type!==x||S.sparse!==void 0||S.normalized===!0||typeof S.count!="number"||!Number.isInteger(S.count)||S.count<1||typeof S.componentType!="number"||!b.includes(S.componentType)||typeof S.bufferView!="number")return null;let I=c[S.bufferView];if(!ke(I)||I.buffer!==0||typeof I.byteLength!="number"||!Number.isInteger(I.byteLength)||I.byteLength<0)return null;let R=Qh(S.type),k=$h(S.componentType),L=typeof I.byteStride=="number"?I.byteStride:R*k,T=typeof I.byteOffset=="number"?I.byteOffset:0,v=typeof S.byteOffset=="number"?S.byteOffset:0,A=T+v,_=v+(S.count-1)*L+R*k;if(!Number.isInteger(L)||!Number.isInteger(T)||!Number.isInteger(v)||L<R*k||T<0||v<0||T+I.byteLength>r.byteLength||_>I.byteLength)return null;let C=[];for(let B=0;B<S.count;B++){let O=[];for(let F=0;F<R;F++){let D=qh(h,A+B*L+F*k,S.componentType);if(!Number.isFinite(D))return null;O.push(D)}C.push(O)}return C},p=[],y=[],g=0,M=new Set,P=(w,x)=>{if(typeof w!="number"||!Number.isInteger(w)||!ke(l[w])||M.has(w))return!1;M.add(w);let b=l[w],S=Yh(b);if(!S)return!1;let I=Kh(x,S),R=zh(I);if(!R)return!1;if(b.mesh!==void 0){if(typeof b.mesh!="number")return!1;let k=u[b.mesh];if(!ke(k))return!1;for(let L of Ce(k.primitives)){if(!ke(L)||L.mode!==void 0&&L.mode!==4||!ke(L.attributes))return!1;let T=d(L.attributes.POSITION,"VEC3",[5126]),v=L.attributes.NORMAL===void 0?null:d(L.attributes.NORMAL,"VEC3",[5126]);if(!T||L.attributes.NORMAL!==void 0&&!v)return!1;let A=T.length;if(L.indices!==void 0){let C=typeof L.indices=="number"?a[L.indices]:null;A=ke(C)?C.count:void 0}if(typeof A!="number"||!Number.isInteger(A)||A%3!==0||(g+=A/3,g>1e5))return!1;let _=L.indices===void 0?T.map((C,B)=>[B]):d(L.indices,"SCALAR",[5121,5123,5125]);if(!_||_.length%3!==0||_.length!==A)return!1;for(let C=0;C<_.length;C+=3){let B=[_[C][0],_[C+1][0],_[C+2][0]];if(B.some(D=>!Number.isInteger(D)||D<0||D>=T.length))return!1;let O=B.map(D=>Wh(I,...T[D])),F=null;if(!v){let D=O[1][0]-O[0][0],j=O[1][1]-O[0][1],N=O[1][2]-O[0][2],X=O[2][0]-O[0][0],V=O[2][1]-O[0][1],Z=O[2][2]-O[0][2];F=Ea([1,0,0,0,1,0,0,0,1],j*Z-N*V,N*X-D*Z,D*V-j*X)}for(let D=0;D<3;D++)p.push(...O[D]),y.push(...v?Ea(R,...v[B[D]]):F)}}}for(let k of Ce(b.children))if(!P(k,I))return!1;return M.delete(w),!0};for(let w of Ce(f[m].nodes))if(!P(w,Xh()))return{ok:!1,issue:g>1e5?"triangle_limit":"unsupported_glb"};return!g||p.length!==g*9||y.length!==p.length?{ok:!1,issue:"unsupported_glb"}:{ok:!0,triangleCount:g,position:new Float32Array(p),normal:new Float32Array(y)}}function Aa(e){try{return Jh(e)}catch{return{ok:!1,issue:"invalid_glb"}}}function _a(e){let{doc:t}=e,n=Yr(t.theme),o=n.structure,r=Bi(t,e.eventConfigurationId??t.eventConfigurationId),i=Ia(e.eventConfigurationId,e.eventConfiguration,r),s=e.seats,a=new fn,c=null;if(e.registeredShellGlb){let G=Aa(e.registeredShellGlb);if(G.ok){let H=G.position.length/3,J=new Float32Array(G.position.length),me=n.materials.shell??o.tierWall;for(let xe=0;xe<H;xe++){let Ie=G.normal[xe*3+1],ae=Ie<-.25?.4:.62+.38*Math.max(0,Ie);J[xe*3]=me[0]*ae,J[xe*3+1]=me[1]*ae,J[xe*3+2]=me[2]*ae}c={position:G.position,normal:G.normal,color:J,floor:new Float32Array(H).fill(-2),material:new Float32Array(H),count:H}}}let u=new Map;for(let G of r)for(let H of G.objects)u.set(H.id,G.index),H.type==="section"&&u.set(H.logicalSectionId??H.id,G.index);let l=s.map(G=>u.get(G.sectionId??"")??u.get(G.rowId??"")??0),f=Qo(r,s),m=a.vertexCount,d=Ma(a,r,s,l,f,o,re(n.background.top,n.background.bottom,.5))?a.vertexCount:m,p=hi(t,s),y=new Map,g=new Map;for(let G of t.categories??[])y.set(G.key,G.color),G.seatGlyph&&g.set(G.key,G.seatGlyph);let M=[],P=Wi(r,s,l),w=new Map;s.forEach((G,H)=>{let J=P.seatDeckY(H);Number.isFinite(J)&&w.set(G.rowId,Math.min(w.get(G.rowId)??1/0,J))});let x=new Float32Array(s.length),b=[],S=new Map((t.floors??[]).map((G,H)=>[G.id,H])),I=r.map(()=>[]);for(let G of s){let H=G.floorId?S.get(G.floorId)??0:0;I[Math.min(H,I.length-1)]?.push(G)}let R=(G,H)=>{if(!H||H.length<3)return!1;let J=Math.min(...H.map(ae=>ae.x)),me=Math.max(...H.map(ae=>ae.x)),xe=Math.min(...H.map(ae=>ae.y)),Ie=Math.max(...H.map(ae=>ae.y));for(let ae=0;ae<G;ae++)for(let ce of I[ae])if(!(ce.x<J||ce.x>me||ce.y<xe||ce.y>Ie)&&Pe(ce,H,void 0))return!0;return!1},k=null,L=G=>r.length===1?s:s.filter((H,J)=>l[J]===G),T=(G,H)=>{let J=Ne(G);if(!J)return!1;let me=1/0,xe=1/0,Ie=-1/0,ae=-1/0;for(let ce of J)me=Math.min(me,ce.x),Ie=Math.max(Ie,ce.x),xe=Math.min(xe,ce.y),ae=Math.max(ae,ce.y);return s.some((ce,De)=>ce.kind!=="booth"&&(r.length===1||l[De]===H)&&ce.x>me&&ce.x<Ie&&ce.y>xe&&ce.y<ae&&_e(J,ce.x,ce.y))},v;for(let G=0;G<r.length;G++){let H=r[G];a.setFloor(G);let J=tt(H,L(G)),me=0;if(J){let Y=0;for(let he of H.objects)if(he.type==="section")for(let Me of P.bySection.get(he.id)?.rowLevels??[])Y=Math.max(Y,Me.y-H.baseHeightM);if(me=Vi(Y),!v){let he=_t(J);v={centre:[he.x*E,he.y*E]}}}let xe=new Rn,Ie=[],ae=H.objects.filter(Y=>Y.type==="shape"&&(Y.role==="entrance"||Y.role==="exit")),ce=H.objects.filter(Y=>Y.type==="section"&&!!Y.outline&&Y.outline.length>=3),De=Is(H.objects.filter(Y=>Y.type==="booth"),H.focal);for(let Y of H.objects)if(Y.type==="section"){let he=a.vertexCount;Gs(a,Y,H,di(Y,p),P.bySection.get(Y.id),xe,ce,o,G>0&&R(G,Y.outline));let Me=a.vertexCount-he;Me>0&&b.push({sectionId:Y.id,start:he,count:Me})}else if(Y.type==="shape"){let he=i.byObjectId.get(Y.id),Me=M.length,rt=J!==null&&Y.role==="wall"&&!he;a.setMaterial(rt?wn:(he?.kind??Y.role)==="screen"?1:0);let it=Y.role==="stage"&&!he?ws(Y,L(G)):rt&&Y.heightM===void 0?{...Y,heightM:me}:Y,Ze=ji(it,Ie);if(xs(a,it,H.baseHeightM+Ze.supportOffsetM,Ze.topOffsetM-Ze.supportOffsetM,o,H.focal,M,he,ae),a.setMaterial(0),Y.role==="stage"&&!he&&M.length>Me&&(k??G)===G){k=G;let $e=t.floors?.[G]?.id,Lt=r.length>1&&$e?s.filter(en=>en.floorId===$e):s;wa(a,it,M[M.length-1].y,Lt)}}else Y.type==="gaArea"?Ss(a,Y,H.baseHeightM,oe(y.get(Y.categoryKey)),o):Y.type==="booth"?bs(a,Y,H.baseHeightM,oe(y.get(Y.categoryKey)),o,De.get(Y.id)??H.focal,T(Y,G)):Y.type==="table"?gs(a,Y,Math.max(H.baseHeightM,w.get(Y.id)??H.baseHeightM),oe(Y.fill??t.theme?.decorFill??"#232c40"),o,!!(Y.fill??t.theme?.decorFill)):Y.type==="decorImage"&&Ms(a,Y,H.baseHeightM,o);J&&ia(a,H.objects,J,H.baseHeightM,me,H.focal,o,Y=>!i.byObjectId.has(Y.id)),Hs(a,H,s,P,o,n.materials.shell,!c)}let A=r.length>1?{x:r.reduce((G,H)=>G+H.focal.x,0)/r.length,y:r.reduce((G,H)=>G+H.focal.y,0)/r.length}:t.focalPoint??{x:(f.minX+f.maxX)/2,y:(f.minY+f.maxY)/2},_=Nr(c?[a.build(),c]:[a.build()]),C=Pi(s,e.initialState,P,x,y,g),B=fa({doc:t,units:r,seats:s,surfaces:P,focal:A}),{labels:O,sections:F,rows:D}=ma({doc:t,units:r,seats:s,surfaces:P,seatData:C,hintedSeatFloor:l,zones:B,focal:A}),j=new Map(F.map((G,H)=>[G.id,H]));P.seatOwner.forEach((G,H)=>{C.iSection[H]=G?j.get(G)??-1:-1});let N=da({doc:t,units:r,seats:s,surfaces:P,solids:_,hintedSeatFloor:l,seatFloor:x});ha(O,N),C.iYaw=Si(C.iPosition,s.length,G=>s[G].rowId,G=>{let H=r[x[G]]?.focal??A;return[H.x*E,H.y*E]});let X=(f.minX+f.maxX)/2*E,V=(f.minY+f.maxY)/2*E,Z=.5*Math.hypot((f.maxX-f.minX)*E,(f.maxY-f.minY)*E)||10,U=qo(_,C,{cx:X,cz:V,radius:Z},[m,d]),te=qo(_,C,{cx:X,cz:V,radius:Z}),Q=ed(r),fe=Pa(C,M,f,U.minY,U.maxY,Z,Q);return{sharedAisles:Dr(r.flatMap(G=>G.objects.flatMap(H=>{if(H.type!=="section")return[];let J=P.bySection.get(H.id);return J?[{sectionId:H.id,floorIndex:G.index,rows:J.rowLevels}]:[]}))),solids:_,sectionSolidRanges:b,seats:C,seatSectionIds:P.seatOwner,bounds:{center:[(fe.min[0]+fe.max[0])/2,(fe.min[1]+fe.max[1])/2,(fe.min[2]+fe.max[2])/2],radius:Z,groundY:0,box:fe,fitPoints:Sa(C,M,Q)},...v?{room:v}:{},...!v&&r.some(G=>G.objects.some(H=>H.type==="shape"&&on(H.stageKind)))?{outdoor:!0}:{},renderBounds:{center:U.center,radius:U.radius},clipBounds:{center:te.center,radius:te.radius},stateColorLUT:Wr(n,pn),theme:n,seatCount:s.length,focalWorld:[A.x*E,1.5,A.y*E],zones:B,stages:M,productionElements:i.elements,sections:F,rows:D,labels:O,floors:N}}function ed(e){let t=[];for(let n of e)for(let o of n.objects){let r=o.type==="gaArea"?o.points:o.type==="booth"?Ne(o):null;for(let i of r??[])t.push([i.x*E,n.baseHeightM,i.y*E])}return t}function td(e,t){let{doc:n,report:o}=qs(e),r=o.confident&&(o.sections.length>0||!!o.looseRowBlocks);if(!r&&!o.roles?.length)return null;if(!r){let c=new Map(o.roles.map(h=>[h.id,h.role])),u=h=>h.map(d=>d.type==="shape"&&c.has(d.id)?{...d,role:c.get(d.id)}:d),l=e.floors?.map(h=>({...h,objects:u(h.objects)})),f=new Float64Array(t.length).fill(Number.NaN),m=new Float64Array(t.length*2).fill(Number.NaN);return t.forEach((h,d)=>{h.eyeHeightM!==void 0&&(f[d]=h.eyeHeightM),h.focalPoint&&(m[d*2]=h.focalPoint.x,m[d*2+1]=h.focalPoint.y)}),{doc:{...e,objects:l?.[0]?.objects??u(e.objects),...l?{floors:l}:{}},report:o,eyeHeightM:f,focal:m}}let i=new Map(gt(n).map(c=>[c.id,c])),s=new Float64Array(t.length).fill(Number.NaN),a=new Float64Array(t.length*2).fill(Number.NaN);return t.forEach((c,u)=>{let l=i.get(c.id)??c;l.eyeHeightM!==void 0&&(s[u]=l.eyeHeightM),l.focalPoint&&(a[u*2]=l.focalPoint.x,a[u*2+1]=l.focalPoint.y)}),{doc:n,report:o,eyeHeightM:s,focal:a}}function nd(e,t){return e.map((n,o)=>{let r=t.eyeHeightM[o],i=t.focal[o*2],s=t.focal[o*2+1],a={...n};return Number.isNaN(r)?delete a.eyeHeightM:a.eyeHeightM=r,Number.isNaN(i)?delete a.focalPoint:a.focalPoint={x:i,y:s},a})}function va(e){let t=e.estimate===!1?null:td(e.doc,e.seats);return t?{input:{...e,doc:t.doc,seats:nd(e.seats,t)},estimate:t}:{input:e}}function od(e){return[e.solids.position,e.solids.normal,e.solids.color,e.solids.floor,e.solids.material,e.seats.iPosition,e.seats.iState,e.seats.iCategory,e.seats.iMaxRadius,e.seats.iRing,e.seats.iFloor,e.seats.iYaw,e.seats.iChairWidth,e.seats.iGlyph,e.seats.iPhysicalSeat].map(n=>n.buffer)}var Ca=self;Ca.onmessage=e=>{let t=performance.now(),n=!e.data.seats,o=e.data.seats??gt(e.data.doc),{input:r,estimate:i}=va({doc:e.data.doc,seats:o,eventConfigurationId:e.data.eventConfigurationId,eventConfiguration:e.data.eventConfiguration,registeredShellGlb:e.data.registeredShellGlb,estimate:e.data.estimate}),s=_a(r),a=od(s);i&&a.push(i.eyeHeightM.buffer,i.focal.buffer),Ca.postMessage({model:s,buildMs:performance.now()-t,...n?{seats:o}:{},...i?{estimate:i}:{}},a)};
1
+ "use strict";var nu=Object.create;var Ai=Object.defineProperty;var ou=Object.getOwnPropertyDescriptor;var ru=Object.getOwnPropertyNames;var iu=Object.getPrototypeOf,su=Object.prototype.hasOwnProperty;var au=(e,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of ru(t))!su.call(e,r)&&r!==n&&Ai(e,r,{get:()=>t[r],enumerable:!(o=ou(t,r))||o.enumerable});return e};var xt=(e,t,n)=>(n=e!=null?nu(iu(e)):{},au(t||!e||!e.__esModule?Ai(n,"default",{value:e,enumerable:!0}):n,e));var $y=Math.PI/180;function Ue(e,t){return Math.hypot(e.x-t.x,e.y-t.y)}function Qo(e,t,n){return{x:e.x+(t.x-e.x)*n,y:e.y+(t.y-e.y)*n}}function qo(e){let t=0,n=0;for(let r of e)t+=r.x,n+=r.y;let o=e.length||1;return{x:t/o,y:n/o}}function Qt(e){return e.length?qo(e):null}function Ci(e,t){let n=1-t,o=n*n*n,r=3*n*n*t,i=3*n*t*t,s=t*t*t;return{x:o*e.start.x+r*e.control1.x+i*e.control2.x+s*e.end.x,y:o*e.start.y+r*e.control1.y+i*e.control2.y+s*e.end.y}}function ki(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[Ci(e,.5)];let o=Array.from({length:n+1},(c,l)=>Ci(e,l/n)),r=new Float64Array(o.length);for(let c=1;c<o.length;c+=1){let l=o[c].x-o[c-1].x,f=o[c].y-o[c-1].y;r[c]=r[c-1]+Math.hypot(l,f)}let i=r[r.length-1];if(i<=1e-9)return Array.from({length:t},()=>({...e.start}));let s=[],a=1;for(let c=0;c<t;c+=1){let l=i*c/(t-1);for(;a<r.length-1&&r[a]<l;)a+=1;let f=r[a-1],u=r[a],m=u===f?0:(l-f)/(u-f);s.push({x:o[a-1].x+(o[a].x-o[a-1].x)*m,y:o[a-1].y+(o[a].y-o[a-1].y)*m})}return s}function Jo(e,t,n){return Math.max(t,Math.min(n,e))}function cu(e){return Jo(e,0,1)}function vi(e){let t=cu(e);return t*t*(3-2*t)}var qt=Math.PI*2;function Jt(e){return Number.isFinite(e.x)&&Number.isFinite(e.y)}function lu(e,t,n){let o=t-e;if(n){for(;o<0;)o+=qt;for(;o>=qt;)o-=qt}else{for(;o>0;)o-=qt;for(;o<=-qt;)o+=qt}return o}function Li(e){if(e.version!==1||e.closed!==!0||!Jt(e.start)||!Array.isArray(e.segments)||e.segments.length<2||e.segments.length>512)return!1;let t=e.start;for(let n of e.segments){if(!n||!Jt(n.end))return!1;if(n.kind==="line"){if(Ue(t,n.end)<=1e-9)return!1}else if(n.kind==="bezier"){if(!Jt(n.control1)||!Jt(n.control2)||Ue(t,n.end)<=1e-9)return!1}else if(n.kind==="arc"){if(!Jt(n.center)||!Number.isFinite(n.radius)||n.radius<=1e-6||Math.abs(Ue(t,n.center)-n.radius)>Math.max(1e-4,n.radius*1e-4)||Math.abs(Ue(n.end,n.center)-n.radius)>Math.max(1e-4,n.radius*1e-4)||Ue(t,n.end)<=1e-9)return!1}else return!1;t=n.end}return Ue(t,e.start)<=1e-4}function uu(e,t,n){let o=1-n;return{x:o**3*e.x+3*o**2*n*t.control1.x+3*o*n**2*t.control2.x+n**3*t.end.x,y:o**3*e.y+3*o**2*n*t.control1.y+3*o*n**2*t.control2.y+n**3*t.end.y}}function Bi(e,t=2){if(!Li(e))throw new Error("Section outline path is invalid");let n=Math.max(.25,t),o=[{...e.start}],r=e.start;for(let i of e.segments){if(i.kind==="line")o.push({...i.end});else if(i.kind==="arc"){let s=Math.atan2(r.y-i.center.y,r.x-i.center.x),a=Math.atan2(i.end.y-i.center.y,i.end.x-i.center.x),c=lu(s,a,i.clockwise),l=Math.max(2,Math.ceil(Math.abs(c)*i.radius/n));for(let f=1;f<=l;f+=1){let u=s+c*f/l;o.push({x:i.center.x+Math.cos(u)*i.radius,y:i.center.y+Math.sin(u)*i.radius})}}else{let s=Ue(r,i.control1)+Ue(i.control1,i.control2)+Ue(i.control2,i.end),a=Math.max(2,Math.ceil(s/n));for(let c=1;c<=a;c+=1)o.push(uu(r,i,c/a))}r=i.end}return Ue(o[o.length-1],o[0])<=1e-4&&o.pop(),o}var fu=45,er=150,mu=60;function hu(e){let t=fu/100;if(e<=t)return er;let n=Math.min(1,(e-t)/(1-t));return er-n*(er-mu)}var Oi=.5523;function Ti(e,t){return Math.abs(e.x-t.x)<=1e-6&&Math.abs(e.y-t.y)<=1e-6}function du(e){let t=[],n=[];for(e.forEach((o,r)=>{Jt(o)&&(t.length&&Ti(t[t.length-1],o)||(t.push({x:o.x,y:o.y}),n.push(r)))});t.length>1&&Ti(t[0],t[t.length-1]);)t.pop(),n.pop();return{points:t,sourceIndex:n}}var pu=.5,bu=4/3;function yu(e,t,n){let o=t.x-e.x,r=t.y-e.y,i=Math.hypot(o,r);if(i<=1e-9)return{kind:"line",end:{...t}};let s=-r/i,a=o/i,c=n*bu;return{kind:"bezier",control1:{x:e.x+o/3+s*c,y:e.y+r/3+a*c},control2:{x:e.x+o*2/3+s*c,y:e.y+r*2/3+a*c},end:{...t}}}function Fi(e,t){let{points:n,sourceIndex:o}=du(e),r=n.length;if(r<3)return null;let i=Math.min(100,Math.max(0,t.cornerSmoothing??0))/100,s=t.edgeCurvature,a=new Array(r).fill(0);if(s?.length)for(let w=0;w<r;w+=1){let I=s[o[w]];a[w]=Number.isFinite(I)?Math.min(100,Math.max(-100,I))/100:0}let c=a.some(w=>Math.abs(w)>1e-6);if(i<=0&&!c)return null;let l=t.wideAngleThresholdDeg??hu(i),f=[];for(let w=0;w<r;w+=1)f[w]=Ue(n[w],n[(w+1)%r]);let u=new Array(r).fill(0);for(let w=0;w<r;w+=1){let I=n[(w-1+r)%r],b=n[w],R=n[(w+1)%r],P={x:I.x-b.x,y:I.y-b.y},M={x:R.x-b.x,y:R.y-b.y},C=Math.hypot(P.x,P.y),T=Math.hypot(M.x,M.y);if(C<=1e-9||T<=1e-9)continue;let v=Math.min(1,Math.max(-1,(P.x*M.x+P.y*M.y)/(C*T))),k=Math.acos(v)*180/Math.PI;if(k<l)continue;let E=vi((k-l)/(180-l));u[w]=i*E*.5*Math.min(C,T)}for(let w=0;w<r;w+=1){let I=(w+1)%r,b=u[w]+u[I];if(b>f[w]&&b>1e-9){let R=f[w]/b;u[w]*=R,u[I]*=R}}let m=new Array(r),h=new Array(r);for(let w=0;w<r;w+=1){let I=n[(w-1+r)%r],b=n[w],R=n[(w+1)%r];if(u[w]<=1e-6){m[w]={...b},h[w]={...b};continue}let P=Ue(b,I)||1,M=Ue(b,R)||1;m[w]={x:b.x+(I.x-b.x)/P*u[w],y:b.y+(I.y-b.y)/P*u[w]},h[w]={x:b.x+(R.x-b.x)/M*u[w],y:b.y+(R.y-b.y)/M*u[w]}}if(u.every(w=>w<=1e-6)&&!c)return null;let d=[],p={...h[0]},y=p,x=(w,I)=>{if(Ue(y,w)<=1e-9)return;let b=a[I];Math.abs(b)>1e-6?d.push(yu(y,w,b*pu*f[I])):d.push({kind:"line",end:{...w}}),y=w};for(let w=1;w<=r;w+=1){let I=w%r,b=n[I];x(m[I],(w-1)%r),u[I]>1e-6&&Ue(m[I],h[I])>1e-9&&(d.push({kind:"bezier",control1:Qo(m[I],b,Oi),control2:Qo(h[I],b,Oi),end:{...h[I]}}),y=h[I])}if(!d.length)return null;let g=d[d.length-1];Ue(g.end,p)>1e-9&&(g.kind==="line"?g.end={...p}:d.push({kind:"line",end:{...p}}));let S={version:1,closed:!0,start:p,segments:d};return Li(S)?S:null}function gu(e){let t=e.points??[];if(e.kind!=="polygon"||t.length<3||!Array.isArray(e.edgeCurvature))return[];let n=t.map((o,r)=>{let i=e.edgeCurvature[r];return Number.isFinite(i)?Math.min(100,Math.max(-100,i)):0});return n.some(o=>Math.abs(o)>.5)?n:[]}function xu(e){let t=gu(e);return t.length?Fi(e.points,{edgeCurvature:t}):null}function no(e,t=2){let n=xu(e);return n?Bi(n,t):e.points??[]}function Ni(e){return e.kind==="polygon"?wn(e.holes):[]}function Gi(e){let t=new Map,n=new Map;for(let o of e){if(o.type!=="row"||!o.segmentedRow)continue;let r=n.get(o.segmentedRow.groupId)??[];r.push(o),n.set(o.segmentedRow.groupId,r)}for(let[o,r]of n){let i=r.slice().sort((m,h)=>m.segmentedRow.componentIndex-h.segmentedRow.componentIndex),s=i[0]?.segmentedRow?.componentCount??0,a=i[0]?.segmentedRow;if(!a||!(s>=2&&i.length===s&&a?.boundaryBefore==="start"&&i.every((m,h)=>m.segmentedRow?.kind==="segmented-row-v1"&&m.segmentedRow.groupId===o&&m.segmentedRow.componentCount===s&&m.segmentedRow.componentIndex===h&&m.segmentedRow.repeatLabelOnComponents===a.repeatLabelOnComponents&&(h===0?m.segmentedRow.boundaryBefore==="start":m.segmentedRow.boundaryBefore!=="start")&&m.segmentedRow.displayLabel===a.displayLabel)))continue;let l=i.reduce((m,h)=>m+h.seatCount,0),f=0,u=0;for(let m of i)m.segmentedRow.boundaryBefore==="break"&&(f+=1),t.set(m.id,{groupId:o,adjacencyOffset:f,displayOffset:u,displayLabel:a.displayLabel,totalSeats:l,canonical:i[0],viewFromSeatUrl:a.viewFromSeatUrl,viewFromSeatMeta:a.viewFromSeatMeta,confidenceEvidence:a.confidenceEvidence}),f+=m.seatCount,u+=m.seatCount}return t}var Mu="ABCDEFGHIJKLMNOPQRSTUVWXYZ";var Su="abcdefghijklmnopqrstuvwxyz";function Ru(e,t){let n=t.length,o=e+1,r="";for(;o>0;){o-=1;let i=o%n;r=t[i]+r,o=Math.floor(o/n)}return r}function _n(e,t=!1){let n=t?Su:Mu;return Ru(Math.max(0,Math.floor(e)-1),n)}var Iu=[[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 Hi(e){if(!Number.isFinite(e)||e<=0)return String(e);let t=Math.floor(e),n="";for(let[o,r]of Iu)for(;t>=o;)n+=r,t-=o;return n}function Pu(e){let t=new Array(e);return Array.from({length:e},(n,o)=>o).sort((n,o)=>Math.abs(2*n-(e-1))-Math.abs(2*o-(e-1))||n-o).forEach((n,o)=>t[n]=o),t}function nr(e,t){let n=e.seatLabelStart??1,o=e.seatNumbering?.direction??"ltr",r=e.seatNumbering?.step??1,i=e.seatNumbering?.scheme??"decimal",s=e.seatNumbering?.prefix??"",a=e.seatNumbering?.endAt,c=e.seatCount;if(i==="updown"||i==="updown-descending"){let h=Math.ceil(c/2),d=i==="updown"?t<h?n+2*t:n-1+2*(c-t):t<h?n+2*(h-1-t):n+1+2*(t-h);return`${s}${d}`}let l=i==="odd"||i==="even"?2:r,f=a!=null&&Number.isFinite(a)?a-(c-1)*l:n,u=o==="center"?Pu(c)[t]:o==="rtl"?c-1-t:t,m;switch(i){case"odd":{let h=f%2===1?f:f+1;m=String(h+u*2);break}case"even":{let h=f%2===0?f:f+1;m=String(h+u*2);break}case"roman":m=Hi(f+u*r);break;case"letters-upper":m=_n(f+u*r,!1);break;case"letters-lower":m=_n(f+u*r,!0);break;default:m=String(f+u*r);break}return`${s}${m}`}function wu(e){return{...e.canonical,seatCount:e.totalSeats,label:e.displayLabel,displayLabel:e.displayLabel}}function ji(e,t,n){return n?.label??`${e.seatLabelBase??e.label}-${nr(e,t)}`}function _u(e,t,n,o){if(o?.displayLabel)return null;if(e.seatDisplayLabelMode==="number"||!n)return{row:e.displayLabel||e.label,seat:nr(e,t)};let r=wu(n);return{row:n.displayLabel,seat:nr(r,n.displayOffset+t)}}function or(e,t,n,o){let r=_u(e,t,n,o);return r?e.seatDisplayLabelMode==="number"?r.seat:`${r.row}-${r.seat}`:o.displayLabel}function Vi(e,t){return`${e.label}-${t+1}`}function Eu(e,t,n){return e?.direction==="anticlockwise"?Math.max(0,t-1-n):n}function Au(e,t){let n=e.chairNumbering,o=n?.start??1,r=Eu(n,Math.max(0,Math.round(e.seatCount)),t);return n?.format==="letter"?_n(Math.max(1,o)+r):String(o+r)}function Ui(e,t){let n=Au(e,t);return(e.chairNumbering?.format??"table-number")==="table-number"?`${e.displayLabel??e.label}-${n}`:n}var re=.02291666666666667,ct=1/re,Cu=58,ku=Cu*re;var vu=3,Xi=0,rr=120,Ou=0,Tu=45,Lu=7,Mt=1.2;function ir(e,t,n,o){return Number.isFinite(e)?Math.max(t,Math.min(n,e)):o}function Bu(e){return!Number.isFinite(e)||!Number.isInteger(e)||e<0?0:e<=Lu?e:vu}function Lt(e,t={}){let n=ir(t.floorBaseHeightM,Xi,rr,0),o=Math.min(rr,n+Bu(e.elevation)*ku),r=e.height===void 0?o:ir(e.height,Xi,rr,o),i=ir(e.rake,Ou,Tu,0);return{height:r,rake:i}}function Ki(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 en(e,t,n){if(!e.length)return 1/0;if(e.length===1)return Math.hypot(t-e[0].x,n-e[0].y);let o=1/0;for(let r=0;r+1<e.length;r++){let i=e[r],s=e[r+1],a=s.x-i.x,c=s.y-i.y,l=a*a+c*c,f=l>1e-12?((t-i.x)*a+(n-i.y)*c)/l:0;f<0?f=0:f>1&&(f=1);let u=t-(i.x+f*a),m=n-(i.y+f*c);if(Math.abs(u)>=o||Math.abs(m)>=o)continue;let h=Math.hypot(u,m);h<o&&(o=h)}return o}function Fu(e){let t=0,n=0;for(let i of e)t+=i.x,n+=i.y;let o=e.length||1;t/=o,n/=o;let r=0;for(let i of e){let s=Math.hypot(i.x-t,i.y-n);s>r&&(r=s)}return{cx:t,cy:n,r}}function Wi(e,t){return Math.hypot(e.cx-t.cx,e.cy-t.cy)-e.r-t.r}function sr(e,t){let n=1/0;for(let o of Ki(e)){let r=en(t,o.x,o.y);r<n&&(n=r)}for(let o of Ki(t)){let r=en(e,o.x,o.y);r<n&&(n=r)}return n}function Nu(e,t){if(e.length<3)return{pts:e,seatIndices:t};let n=0,o=0;for(let f of e)n+=f.x,o+=f.y;n/=e.length,o/=e.length;let r=-1,i=e[0];for(let f of e){let u=Math.hypot(f.x-n,f.y-o);u>r&&(r=u,i=f)}let s=i.x-n,a=i.y-o,c=Math.hypot(s,a);c>1e-9?(s/=c,a/=c):(s=1,a=0);let l=e.map((f,u)=>({p:f,i:u,t:(f.x-n)*s+(f.y-o)*a})).sort((f,u)=>f.t-u.t);return{pts:l.map(f=>f.p),seatIndices:l.map(f=>t[f.i])}}function ar(e){let t=e.length;if(t<3)return null;let n=0,o=0;for(let g of e)n+=g.x,o+=g.y;n/=t,o/=t;let r=0,i=0,s=0,a=0,c=0,l=0,f=0;for(let g of e){let S=g.x-n,w=g.y-o;r+=S*S,s+=w*w,i+=S*w,a+=S*S*S,c+=w*w*w,l+=S*w*w,f+=w*S*S}let u=r*s-i*i;if(Math.abs(u)<1e-9)return null;let m=(a+l)/2,h=(c+f)/2,d=(m*s-h*i)/u,p=(h*r-m*i)/u,y=d+n,x=p+o;return!Number.isFinite(y)||!Number.isFinite(x)?null:{cx:y,cy:x}}var Du=.15,Gu=.001;function Hu(e){let t=e[0],n=e[e.length-1],o=n.x-t.x,r=n.y-t.y,i=Math.hypot(o,r);if(!(i>1e-9))return 0;let s=0;for(let a of e){let c=Math.abs((a.x-t.x)*r-(a.y-t.y)*o)/i;c>s&&(s=c)}return s/i}function ju(e){if(e.length<2)return null;let t=e.map(I=>{let b=0,R=0;for(let P of I.pts)b+=P.x,R+=P.y;return{x:b/I.pts.length,y:R/I.pts.length}}),n=0,o=0;for(let I of t)n+=I.x,o+=I.y;n/=t.length,o/=t.length;let r=0,i=0,s=0;for(let I of t){let b=I.x-n,R=I.y-o;r+=b*b,i+=b*R,s+=R*R}let a=r+s,c=r*s-i*i,l=a/2+Math.sqrt(Math.max(0,a*a/4-c)),f,u;Math.abs(i)>1e-12?(f=l-s,u=i):r>=s?(f=1,u=0):(f=0,u=1);let m=Math.hypot(f,u);if(!(m>1e-12))return null;f/=m,u/=m;let h=0,d=0,p=0;for(let I of e){if(I.pts.length<2)continue;let b=I.pts[0],R=I.pts[I.pts.length-1],P=R.x-b.x,M=R.y-b.y,C=Math.hypot(P,M);if(!(C>1e-9))continue;let T=P/C,v=M/C;h+=(T*T-v*v)*C,d+=2*T*v*C,p+=C}if(p>0&&Math.hypot(h,d)>=Uu*p){let I=Math.atan2(d,h)/2;f=-Math.sin(I),u=Math.cos(I)}let y=1/0,x=-1/0,g=[];for(let I of e){let b=1/0,R=-1/0;for(let P of I.pts){let M=P.x*f+P.y*u;M<b&&(b=M),M>R&&(R=M),M<y&&(y=M),M>x&&(x=M)}g.push(R-b)}let S=x-y;return S>1e-9?(g.sort((I,b)=>I-b),g[Math.min(g.length-1,Math.floor(g.length*.9))]/S<=Vu?{x:f,y:u}:null):null}var Vu=.35,Uu=.8;function oo(e,t,n,o){let r=new Map;for(let b of n){let R=t[b],P=R.rowId||`__seat-${b}`,M=r.get(P);M||(M={pts:[],idx:[]},r.set(P,M)),M.pts.push({x:R.x,y:R.y}),M.idx.push(b)}if(!r.size)return{sectionId:e,rows:[],blockCount:0};let i=[];for(let[b,R]of r){let P=Nu(R.pts,R.idx),M=0;for(let C of P.pts)M+=Math.hypot(C.x-o.x,C.y-o.y);i.push({id:b,pts:P.pts,seatIndices:P.seatIndices,blockId:-1,ordinal:0,blockDepth:0,focalDistance:M/P.pts.length})}let s=i.map(b=>Fu(b.pts)),a=i.length<=256?i.length*(i.length-1)/2:0,c=a?new Float64Array(a):null;c?.fill(Number.NaN);let l=c?new Map(i.map((b,R)=>[b,R])):null,f=(b,R)=>(b>R&&([b,R]=[R,b]),b*(2*i.length-b-1)/2+(R-b-1)),u=(b,R)=>{if(!c)return sr(i[b].pts,i[R].pts);let P=f(b,R),M=c[P];if(!Number.isNaN(M))return M;let C=sr(i[b].pts,i[R].pts);return c[P]=C,C},m=(b,R)=>l?u(l.get(b),l.get(R)):sr(b.pts,R.pts),h=[];for(let b=0;b<i.length;b++){let R=1/0;for(let P=0;P<i.length;P++){if(b===P||Wi(s[b],s[P])>=R)continue;let M=u(b,P);M<R&&(R=M)}Number.isFinite(R)&&h.push(R)}h.sort((b,R)=>b-R);let d=h.length?h[Math.floor(h.length/2)]:1,p=Math.max(d*1.8,1e-6),y=i.map(()=>[]);for(let b=0;b<i.length;b++)for(let R=b+1;R<i.length;R++)Wi(s[b],s[R])>p||u(b,R)<=p&&(y[b].push(R),y[R].push(b));let x=0;for(let b=0;b<i.length;b++){if(i[b].blockId!==-1)continue;let R=x++,P=[b];for(i[b].blockId=R;P.length;){let M=P.pop();for(let C of y[M])i[C].blockId===-1&&(i[C].blockId=R,P.push(C))}}let g=new Map;for(let b of i){let R=g.get(b.blockId)??[];R.push(b),g.set(b.blockId,R)}let S=[];for(let b of i){if(b.pts.length<4||Hu(b.pts)<Gu)continue;let R=ar(b.pts);R&&(!Number.isFinite(R.cx)||!Number.isFinite(R.cy)||S.push({x:R.cx,y:R.cy}))}let w=S.length>=2?(()=>{let b=S.map(M=>M.x).sort((M,C)=>M-C),R=S.map(M=>M.y).sort((M,C)=>M-C),P=Math.floor(S.length/2);return{cx:b[P],cy:R[P]}})():null;if(w){let b=v=>Math.hypot(v.x-w.cx,v.y-w.cy),R=1/0,P=-1/0,M=[];for(let v of i){let k=1/0,E=-1/0;for(let A of v.pts){let O=b(A);O<k&&(k=O),O>E&&(E=O)}M.push(E-k),k<R&&(R=k),E>P&&(P=E)}let C=P-R;M.sort((v,k)=>v-k);let T=M[Math.min(M.length-1,Math.floor(M.length*.9))];if(C>1e-9&&T/C<=Du){let v=i.map(H=>{let V=0;for(let U of H.pts)V+=b(U);return{row:H,radius:V/H.pts.length}}),k=0,E=0;for(let H of v)k+=H.radius,E+=H.row.focalDistance;k/=v.length,E/=v.length;let A=0;for(let H of v)A+=(H.radius-k)*(H.row.focalDistance-E);if(A<0)for(let H of v)H.radius=-H.radius;let F=1/0;for(let H of v)H.radius<F&&(F=H.radius);v.sort((H,V)=>H.radius-V.radius);let L=-1,B=-1/0,D=C/Math.max(1,v.length)*.5,j=[];for(let H of v)H.radius-B>D&&(L++,B=H.radius),H.row.ordinal=L,H.row.blockDepth=H.radius-F,j.push(H.row);return{sectionId:e,rows:j,blockCount:x}}}let I=[];for(let[,b]of g){let R=ju(b);if(R){let P=v=>{let k=0;for(let E of v.pts)k+=E.x*R.x+E.y*R.y;return k/v.pts.length};b.sort((v,k)=>P(v)-P(k)),b.length>=2&&b[0].focalDistance>b[b.length-1].focalDistance&&b.reverse();let M=[],C=d*.5;for(let v of b){let k=M[M.length-1];k&&Math.abs(P(v)-P(k[0]))<C?k.push(v):M.push([v])}let T=0;for(let v=0;v<M.length;v++){if(v>0){let k=1/0;for(let E of M[v-1])for(let A of M[v])k=Math.min(k,m(E,A));k=Math.min(k,Math.abs(P(M[v][0])-P(M[v-1][0]))),T+=k}for(let k of M[v])k.ordinal=v,k.blockDepth=T,I.push(k)}}else{let P=1/0;for(let M of b)M.focalDistance<P&&(P=M.focalDistance);b.sort((M,C)=>M.focalDistance-C.focalDistance);for(let M=0;M<b.length;M++)b[M].ordinal=M,b[M].blockDepth=Math.max(0,b[M].focalDistance-P),I.push(b[M])}}return{sectionId:e,rows:I,blockCount:x}}var Xu=/^\d{4}-\d{2}-\d{2}$/;function Ku(e){let t=Date.parse(e);return Number.isFinite(t)?Xu.test(e)?t+864e5:t:null}function Wu(e,t=Date.now()){if(e.validUntil===void 0){if(e.status!=="approved")return!0;let o=e.assessedAt?Date.parse(e.assessedAt):Number.NaN;return Number.isFinite(o)&&(t instanceof Date?t.getTime():t)<=o+366*864e5}let n=Ku(e.validUntil);return n===null?!1:(t instanceof Date?t.getTime():t)<n}function Yu(e,t,n){return!(e.eventConfigurationId&&e.eventConfigurationId!==t||e.eventConfigurationVersion!==void 0&&e.eventConfigurationVersion!==n)}function zu(e){return e.status!=="draft"&&e.status!=="retracted"}function Zu(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 Yi(e,t={}){return!!e&&zu(e)&&Yu(e,t.activeConfigurationId,t.activeConfigurationVersion)&&Zu(e,t.activeBasisSha256)&&Wu(e,t.now)}var $u=new Set(["pitch-football","rink-hockey","track-athletics","oval-cricket","pitch-rugby","diamond-baseball","court-basketball","court-tennis","ring-boxing","track-motorsport"]),$i=new Set(["pitch-football","track-athletics","oval-cricket","pitch-rugby","diamond-baseball"]);function ot(e){return!!e&&$u.has(e)}function ro(e){return!!e&&$i.has(e)}var Qu="open-air",qu=new Set([...$i,"court-tennis","track-motorsport",Qu]);function tn(e){return!!e&&qu.has(e)}var Ju=new Set(["court-basketball","rink-hockey","ring-boxing"]);function Qi(e){return!!e&&Ju.has(e)}var cr=1.1;function qi(e){return so(e)?e==="ring-boxing"?cr:.06:1}var ef={round:{width:6,height:6},"pitch-football":{width:105,height:68},"rink-hockey":{width:60,height:30},"track-athletics":{width:176.9,height:92.5},"oval-cricket":{width:150,height:140},"pitch-rugby":{width:120,height:70},"diamond-baseball":{width:140,height:140},"court-basketball":{width:32,height:19},"court-tennis":{width:36.57,height:18.29},"ring-boxing":{width:7.8,height:7.8},"track-motorsport":{width:300,height:15}},tf={"pitch-football":"#2f7d4f","rink-hockey":"#e8f1f8","track-athletics":"#a4472f","oval-cricket":"#3d8a53","pitch-rugby":"#2f7d4f","diamond-baseball":"#2f7d4f","court-basketball":"#c8894f","court-tennis":"#3f7a5a","ring-boxing":"#2a4d8f","track-motorsport":"#3b4048"};var Ji="proscenium";var nf=Math.PI*2;function of(e,t,n,o,r,i){return{x:r+e*n-t*o,y:i+e*o+t*n}}function zi(e,t){let n=Math.max(0,e-t),o=[],r=20;for(let i=0;i<=r;i++){let s=-Math.PI/2+i/r*Math.PI;o.push({x:n+t*Math.cos(s),y:t*Math.sin(s)})}for(let i=0;i<=r;i++){let s=Math.PI/2+i/r*Math.PI;o.push({x:-n+t*Math.cos(s),y:t*Math.sin(s)})}return o}var Zi=(()=>{let t={x:0,y:52},n=25,o={x:70,y:t.y-70},r=(o.x*o.x+o.y*o.y-4900)/(2*(o.y+70)),i=r+70,s=[],a=Math.atan2(o.y-r,o.x),c=Math.atan2(o.y-r,-o.x);for(let l=0;l<=24;l++){let f=a+(c-a)*l/24;s.push({x:i*Math.cos(f),y:r+i*Math.sin(f)})}return{half:70,home:t,backstop:n,fence:s}})();var io="#f1f5f9";function so(e){return ot(e)}function Bt(e,t,n,o,r=32){let i=[];for(let s=0;s<r;s++){let a=s/r*nf;i.push({x:e+n*Math.cos(a),y:t+o*Math.sin(a)})}return i}function St(e,t,n,o){return[{x:e-n,y:t-o},{x:e+n,y:t-o},{x:e+n,y:t+o},{x:e-n,y:t+o}]}function rf(e){let{kind:t,cx:n,cy:o,width:r,height:i}=e,s=(e.rotation??0)*Math.PI/180,a=Math.cos(s),c=Math.sin(s),l=r/2,f=i/2,u=[],m=ef[t],h=p=>m?p/m.width*r:0,d=p=>m?p/m.height*i:0;switch(t){case"pitch-football":{u.push({points:[{x:0,y:-f},{x:0,y:f}],closed:!1}),u.push({points:Bt(0,0,h(9.15),d(9.15)),closed:!0});for(let p of[-1,1])u.push({points:St(p*(l-h(16.5)/2),0,h(16.5)/2,d(40.32)/2),closed:!0}),u.push({points:St(p*(l-h(5.5)/2),0,h(5.5)/2,d(18.32)/2),closed:!0});break}case"rink-hockey":{u.push({points:[{x:0,y:-f},{x:0,y:f}],closed:!1,ink:"#d63b3b"});for(let p of[-1,1]){u.push({points:[{x:p*h(7.5),y:-f},{x:p*h(7.5),y:f}],closed:!1,ink:"#2f6ecb"}),u.push({points:[{x:p*(l-h(4)),y:-d(11)},{x:p*(l-h(4)),y:d(11)}],closed:!1,ink:"#d63b3b"});for(let y of[-1,1])u.push({points:Bt(p*h(20.5),y*d(7),h(4.5),d(4.5)),closed:!0,ink:"#2f6ecb"})}u.push({points:Bt(0,0,h(4.5),d(4.5)),closed:!0,ink:"#2f6ecb"});break}case"track-athletics":{let y=f-d(1.22)*8;y>0&&u.push({points:zi(l-h(1.22)*8,y),closed:!0,fill:"#2f7d4f"});for(let x=1;x<8;x++){let g=d(1.22)*x,S=f-g;if(S<=0)break;u.push({points:zi(l-h(1.22)*x,S),closed:!0})}break}case"oval-cricket":{u.push({points:Bt(0,0,h(27.4),d(27.4+20.12/2),40),closed:!0}),u.push({points:St(0,0,h(3.05)/2,d(20.12)/2),closed:!0,ink:"#d8cfae"});break}case"pitch-rugby":{let p=y=>({points:[{x:h(y),y:-f},{x:h(y),y:f}],closed:!1});u.push(p(0));for(let y of[-1,1]){u.push(p(y*50),p(y*28));for(let x=-35;x<35;x+=4)u.push({points:[{x:h(y*10),y:d(x)},{x:h(y*10),y:d(Math.min(35,x+2))}],closed:!1})}break}case"diamond-baseball":{let p=(O,F)=>({x:h(O),y:d(F)}),{home:y}=Zi,x=27.43,g=x/Math.SQRT2,S={x:y.x+g,y:y.y-g},w={x:y.x,y:y.y-2*g},I={x:y.x-g,y:y.y-g},b={x:y.x,y:y.y-18.44},R="#b98a59",P=tf["diamond-baseball"],M=38.94,C=[p(y.x,y.y)],T=Math.atan2(y.y-M/Math.SQRT2-b.y,M/Math.SQRT2),v=Math.PI-T;for(let O=0;O<=16;O++){let F=T-(T+Math.PI*2-v)%(Math.PI*2)*(O/16);C.push(p(b.x+29*Math.cos(F),b.y+29*Math.sin(F)))}u.push({points:C,closed:!0,fill:R,ink:R});let k={x:y.x,y:y.y-g},E=[{x:y.x,y:y.y},S,w,I].map(O=>p(k.x+(O.x-k.x)*.84,k.y+(O.y-k.y)*.84));u.push({points:E,closed:!0,fill:P,ink:P}),u.push({points:Bt(h(b.x),d(b.y),h(2.74),d(2.74),20),closed:!0,fill:R,ink:R}),u.push({points:Bt(h(y.x),d(y.y),h(3.96),d(3.96),20),closed:!0,fill:R,ink:R});let A=Zi.fence;u.push({points:[p(y.x,y.y),p(A[0].x,A[0].y)],closed:!1}),u.push({points:[p(y.x,y.y),p(A[A.length-1].x,A[A.length-1].y)],closed:!1});for(let O of[S,w,I])u.push({points:St(h(O.x),d(O.y),h(.3),d(.3)),closed:!0,fill:io});break}case"court-basketball":{u.push({points:St(0,0,h(14),d(7.5)),closed:!0}),u.push({points:[{x:0,y:-d(7.5)},{x:0,y:d(7.5)}],closed:!1}),u.push({points:Bt(0,0,h(1.8),d(1.8),24),closed:!0});for(let p of[-1,1]){let y=p*14,x=p*(14-5.8),g=p*(14-1.575);u.push({points:St(h((y+x)/2),0,h(2.9),d(2.45)),closed:!0,fill:"#2f5d8a"}),u.push({points:Bt(h(x),0,h(1.8),d(1.8),24),closed:!0});let S=Math.sqrt(6.75*6.75-6.6*6.6),w=[{x:h(y),y:-d(6.6)}],I=Math.atan2(-6.6,-p*S),b=2*Math.atan2(6.6,S);for(let R=0;R<=16;R++){let P=I-p*b*(R/16);w.push({x:h(g+6.75*Math.cos(P)),y:d(6.75*Math.sin(P))})}w.push({x:h(y),y:d(6.6)}),u.push({points:w,closed:!1})}break}case"court-tennis":{u.push({points:St(0,0,h(11.885),d(5.485)),closed:!0,fill:"#2b5f99"});for(let p of[-1,1])u.push({points:[{x:-h(11.885),y:p*d(4.115)},{x:h(11.885),y:p*d(4.115)}],closed:!1}),u.push({points:[{x:p*h(6.4),y:-d(4.115)},{x:p*h(6.4),y:d(4.115)}],closed:!1});u.push({points:[{x:-h(6.4),y:0},{x:h(6.4),y:0}],closed:!1}),u.push({points:[{x:0,y:-d(6.4)},{x:0,y:d(6.4)}],closed:!1,ink:"#d1d5db"});break}case"ring-boxing":{u.push({points:St(0,0,h(3.05),d(3.05)),closed:!0});let x=[[-1,-1,"#c53030"],[1,1,"#2b6cb0"],[1,-1,"#e2e8f0"],[-1,1,"#e2e8f0"]];for(let[g,S,w]of x)u.push({points:St(g*h(3.05),S*d(3.05),h(.3),d(.3)),closed:!0,fill:w,ink:w});break}case"track-motorsport":{for(let x of[-1,1])u.push({points:[{x:-l,y:x*d(7)},{x:l,y:x*d(7)}],closed:!1});let y=90;u.push({points:St(h(y),0,h(.6),d(7)),closed:!0,fill:"#f1f5f9"});for(let x=0;x<10;x++){let g=y-8*(x+1),S=x%2?2.6:-2.6;u.push({points:[{x:h(g),y:d(S-1.3)},{x:h(g),y:d(S+1.3)}],closed:!1})}break}default:return[]}return u.map(p=>({...p,points:p.points.map(y=>of(y.x,y.y,a,c,n,o))}))}function lr(e){if(e.role!=="stage"||!so(e.stageKind))return[];let t=null;if(e.x!=null&&e.y!=null&&e.width!=null&&e.height!=null&&e.width>0&&e.height>0&&[e.x,e.y,e.width,e.height].every(Number.isFinite))t={cx:e.x+e.width/2,cy:e.y+e.height/2,width:e.width,height:e.height};else if(e.points&&e.points.length>=3&&e.points.every(n=>Number.isFinite(n.x)&&Number.isFinite(n.y))){let n=e.points.map(f=>f.x),o=e.points.map(f=>f.y),r=Math.min(...n),i=Math.max(...n),s=Math.min(...o),a=Math.max(...o),c=Math.max(1,i-r),l=Math.max(1,a-s);t={cx:r+c/2,cy:s+l/2,width:c,height:l}}return t?rf({kind:e.stageKind,...t}):[]}var sf=/^data:image\/(?:png|jpe?g|webp|gif|avif);base64,[a-z0-9+/]+={0,2}$/i,af=/[\s"'<>`\\]/;function cf(e){if(typeof e!="string"||!e||e.length>2e6||e!==e.trim())return!1;if(e.startsWith("data:"))return sf.test(e);if(af.test(e))return!1;try{let t=new URL(e);return t.protocol==="https:"&&!t.username&&!t.password}catch{return!1}}function es(e){let t=e.trim();return cf(t)?t:null}var ur="seatlayer.event-configuration/1";var nn=100,lf=120,uf=2e5,ff=1e4,mf=/^[a-f0-9]{64}$/,hf=new Set(["stage","screen","barrier","camera_platform","sound_desk","rigging_truss"]);function En(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function Ut(e,t){return typeof e=="string"&&e.length>=1&&e.length<=t&&e.normalize("NFKC").trim()===e}function df(e){return typeof e=="number"&&Number.isInteger(e)&&e>0}function ts(e){return!Array.isArray(e)||e.length>uf||!e.every(t=>Ut(t,nn))?null:[...new Set(e)].sort()}function pf(e){return!En(e)||!Ut(e.chartId,nn)||!Ut(e.version,nn)||e.sha256!==void 0&&(typeof e.sha256!="string"||!mf.test(e.sha256))?null:{chartId:e.chartId,version:e.version,...typeof e.sha256=="string"?{sha256:e.sha256}:{}}}function fr(e,t,n){return typeof e=="number"&&Number.isFinite(e)&&e>=t&&e<=n}function bf(e){return En(e)?e.mode==="none"||e.mode==="opaque"?e.opacity===void 0?{mode:e.mode}:null:e.mode==="partial"&&fr(e.opacity,.01,.99)?{mode:"partial",opacity:e.opacity}:null:null}function yf(e,t){if(e===void 0)return;if(!Array.isArray(e)||e.length>ff)return null;let n=new Set(t),o=new Set,r=new Set,i=0,s=[];for(let a of e){if(!En(a)||!Ut(a.id,nn)||!Ut(a.objectId,nn)||!n.has(a.objectId)||!hf.has(String(a.kind))||!fr(a.heightM,.05,50)||a.baseElevationM!==void 0&&!fr(a.baseElevationM,-10,100))return null;let c=bf(a.occlusion);if(!c||o.has(a.id)||r.has(a.objectId))return null;let l=a.contentImageUrl===void 0?void 0:typeof a.contentImageUrl=="string"?es(a.contentImageUrl):null;if(a.contentImageUrl!==void 0&&(!l||a.kind!=="screen"||++i>1))return null;o.add(a.id),r.add(a.objectId),s.push({id:a.id,objectId:a.objectId,kind:a.kind,heightM:a.heightM,...a.baseElevationM!==void 0?{baseElevationM:a.baseElevationM}:{},occlusion:c,...l?{contentImageUrl:l}:{}})}return s.sort((a,c)=>a.id.localeCompare(c.id))}function gf(e){let t=[];if(!En(e))return{issues:[{code:"invalid_export",path:"configuration",message:"Configuration must be an object"}]};e.schema!==ur&&t.push({code:"unsupported_schema",path:"configuration.schema",message:`Configuration schema must be ${ur}`}),Ut(e.id,nn)||t.push({code:"invalid_id",path:"configuration.id",message:"Configuration id must contain 1 to 100 normalized characters"}),Ut(e.label,lf)||t.push({code:"invalid_label",path:"configuration.label",message:"Configuration label must contain 1 to 120 normalized characters"}),df(e.version)||t.push({code:"invalid_version",path:"configuration.version",message:"Configuration version must be a positive integer"});let n=pf(e.baseVenue);n||t.push({code:"invalid_base_venue",path:"configuration.baseVenue",message:"Base venue must identify one normalized chart id and exact version"});let o=En(e.overlay)?e.overlay:null,r=ts(o?.objectIds),i=ts(o?.productionKillSeatIds),s=r?yf(o?.productionElements,r):null;return(!o||!r||!i)&&t.push({code:"invalid_overlay",path:"configuration.overlay",message:"Overlay ids must be bounded arrays of normalized stable ids"}),s===null&&t.push({code:"invalid_production_element",path:"configuration.overlay.productionElements",message:"Production elements must be unique, bounded semantics over referenced base-venue objects"}),t.length||!n||!r||!i||s===null?{issues:t}:{issues:t,value:{schema:ur,id:e.id,label:e.label,version:e.version,baseVenue:n,overlay:{objectIds:r,productionKillSeatIds:i,...s!==void 0?{productionElements:s}:{}}}}}function ns(e){let t=gf(e);return t.value?{ok:!0,value:t.value}:{ok:!1,issues:t.issues}}function xf(e){if((e.kind==="polygon"||e.kind==="polyline"||e.kind==="line")&&e.points&&e.points.length>=2)return e.kind==="polygon"?no(e,6):e.points;if(e.x==null||e.y==null||e.width==null||e.height==null)return null;let t=e.x,n=e.y,o=e.width,r=e.height;return[{x:t,y:n},{x:t+o,y:n},{x:t+o,y:n+r},{x:t,y:n+r}]}function Mf(e,t,n){let o=n*Math.PI/180,r=Math.cos(o),i=Math.sin(o),s=e.x-t.x,a=e.y-t.y;return{x:t.x+s*r-a*i,y:t.y+s*i+a*r}}function os(e){let t=xf(e);if(!t||t.length<2)return null;let n=e.rotation??0,o=Math.abs(n)<1e-6?t:t.map(c=>Mf(c,{x:t.reduce((l,f)=>l+f.x,0)/t.length,y:t.reduce((l,f)=>l+f.y,0)/t.length},n)),r=1/0,i=1/0,s=-1/0,a=-1/0;for(let c of o)r=Math.min(r,c.x),i=Math.min(i,c.y),s=Math.max(s,c.x),a=Math.max(a,c.y);return!Number.isFinite(r)||s-r<1e-6||a-i<1e-6?null:{minX:r,minY:i,maxX:s,maxY:a}}var Sf=5,Rf=3,If=.92,Pf=1.9,wf=2,_f=.6,Ef=1,Af=.06;function Cf(e){return e.heightM!==void 0?e.heightM:e.stageKind==="ring-boxing"?cr:so(e.stageKind)?Af:Ef}function rs(e){let t=1/0,n=1/0,o=-1/0,r=-1/0,i=-1/0;for(let s of as(e)){let a=s.baseHeightM??0;for(let c of s.objects){if(c.type!=="shape"||c.role!=="stage")continue;let l=os(c);l&&(t=Math.min(t,l.minX),n=Math.min(n,l.minY),o=Math.max(o,l.maxX),r=Math.max(r,l.maxY),i=Math.max(i,a+Cf(c)))}}return!Number.isFinite(t)||!Number.isFinite(i)?null:{minX:t,minY:n,maxX:o,maxY:r,deckTopM:i}}function kf(e,t,n,o){let r=1/0,i=1/0,s=-1/0,a=-1/0;for(let h of e)Number.isFinite(h.eyeHeightM)&&(r=Math.min(r,h.x),s=Math.max(s,h.x),i=Math.min(i,h.y),a=Math.max(a,h.y));if(!Number.isFinite(r))return null;let c=r*t,l=i*t,f=Math.max(1,Math.ceil((s-r)*t/n)+1),u=Math.max(1,Math.ceil((a-i)*t/n)+1),m=new Float64Array(f*u).fill(-1/0);for(let h of e){if(!Number.isFinite(h.eyeHeightM))continue;let d=h.eyeHeightM-Mt,p=Math.min(f-1,Math.max(0,Math.floor((h.x*t-c)/n))),x=Math.min(u-1,Math.max(0,Math.floor((h.y*t-l)/n)))*f+p,g=d+o;g>m[x]&&(m[x]=g)}return{cellM:n,minX:c,minY:l,cols:f,rows:u,top:m}}function vf(e,t,n){let o=Math.floor((t-e.minX)/e.cellM),r=Math.floor((n-e.minY)/e.cellM);return o<0||r<0||o>=e.cols||r>=e.rows?-1/0:e.top[r*e.cols+o]}function is(e,t,n={}){let o=new Map;if(!t||!e.length)return o;let r=n.metresPerChartUnit??re,i=n.cellM??_f,s=n.chairBackM??If,a=n.selfRowSkipM??wf,c=n.clearThreshold??.9,l=n.partialThreshold??.25,f=Math.max(1,n.columns??Sf),u=Math.max(1,n.rows??Rf),m=kf(e,r,i,s);if(!m)return o;let h=(t.maxX-t.minX)*r,d=(t.maxY-t.minY)*r,p=h>=d,y=(t.minX+t.maxX)/2*r,x=(t.minY+t.maxY)/2*r,g=[];for(let w=0;w<f;w++){let I=(w+.5)/f-.5,b=p?y+I*h:y,R=p?x:x+I*d;for(let P=0;P<u;P++){let M=t.deckTopM+(u===1?0:P/(u-1)*Pf);g.push({x:b,y:R,z:M})}}let S=i/2;for(let w of e){if(!Number.isFinite(w.eyeHeightM))continue;let I=w.x*r,b=w.y*r,R=w.eyeHeightM,P=0,M=1/0;for(let T of g){let v=T.x-I,k=T.y-b,E=Math.hypot(v,k);if(!(E>a)){P++;continue}let A=v/E,O=k/E,F=0;for(let L=a;L<E;L+=S){let B=vf(m,I+A*L,b+O*L);if(!(!Number.isFinite(B)||B>=R)&&B>R+(T.z-R)*L/E){F=L;break}}F?M=Math.min(M,F):P++}let C=P/g.length;C>=c||o.set(w.id,{seatId:w.id,mark:C<l?"obstructedView":"restrictedView",visibleFraction:C,totalRays:g.length,atDistanceM:Number.isFinite(M)?M:0})}return o}function ss(e,t){if(!t.size)return 0;let n=0;for(let o of e){let r=t.get(o.id);if(!r)continue;let i=o.commercial;i?.restrictedView!==void 0||i?.obstructedView!==void 0||(o.commercial={...i,[r.mark]:!0},n++)}return n}function mr(e){return e?e.accessibility?.length?e.wheelchairSpaceType&&!e.accessibility.includes("wheelchair")?["wheelchair",...e.accessibility]:e.accessibility:e.wheelchairSpaceType?["wheelchair"]:e.accessible?["wheelchair"]:[]:[]}var co=Math.PI/180;var An=16;function hr(e,t,n,o){let r=n*co,i=Math.cos(r),s=Math.sin(r);return{x:o.x+e*i-t*s,y:o.y+e*s+t*i}}function dr(e){let{seatCount:t,seatSpacing:n,curve:o,rotation:r,origin:i}=e,s=[];if(e.path)return ki(e.path,t);if(t<=1)return t===1&&s.push({x:i.x,y:i.y}),s;if(o===0){for(let l=0;l<t;l++)s.push(hr(l*n,0,r,i));return s}let a=o/(t-1)*co,c=n/(2*Math.sin(Math.abs(a)/2));for(let l=0;l<t;l++){let f=l*a,u=c*Math.sin(f),m=-c+c*Math.cos(f);s.push(hr(u,m,r,i))}return s}function pr(e){let t=new Map;if(e.overrides)for(let n of e.overrides)t.set(n.index,n);return t}function Of(e,t){let n=pr(e);return dr(e).map((o,r)=>{let i=n.get(r),s=mr(i),a=ji(e,r,i),c={...e.commercial,...i?.commercial};return{index:r,x:o.x+(i?.dx??0),y:o.y+(i?.dy??0),label:a,displayLabel:or(e,r,t,i),categoryKey:i?.categoryKey??e.categoryKey,skipped:!!i?.skip,accessible:s.length>0,accessibility:s,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??e.seatLabelStyle}})}function Tf(e){let t=[];for(let n of Of(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 Lf(e){if(e.seatCountsBySide)return{...e.seatCountsBySide};let t=e.sides&&e.sides.length?e.sides:["top","bottom"],n=["top","bottom","left","right"].filter(i=>t.includes(i)),o={top:0,bottom:0,left:0,right:0};if(!n.length)return o;let r=Math.max(0,Math.round(e.seatCount));for(let i=0;i<r;i++)o[n[i%n.length]]+=1;return o}function Bf(e){let t=[],n=Math.max(0,Math.round(e.seatCount));if(n===0)return t;let o=new Map((e.overrides??[]).map(f=>[f.index,f])),r=(f,u,m,h)=>{let d=o.get(f),p=mr(d),y=d?.label??Vi(e,f);return{index:f,label:y,displayLabel:d?.displayLabel??Ui(e,f),x:u+(d?.dx??0),y:m+(d?.dy??0),categoryKey:d?.categoryKey??e.categoryKey,skipped:!!d?.skip,accessible:p.length>0,accessibility:p,wheelchairSpaceType:d?.wheelchairSpaceType,commercial:d?.commercial,glyph:d?.glyph,viewUrl:d?.viewFromSeatUrl,viewMeta:d?.viewFromSeatUrl?d.viewFromSeatMeta:void 0,labelStyle:d?.labelStyle,...h?{side:h}:{}}};if(e.shape==="round"){let f=(e.radius??40)+An,u=e.rotation*co,m=Math.max(0,Math.min(360,e.seatArc??360));if(m>=360||n===1){for(let y=0;y<n;y++){let x=u+y/n*2*Math.PI;t.push(r(y,e.center.x+f*Math.cos(x),e.center.y+f*Math.sin(x)))}return t}let h=m*co,d=(2*Math.PI-h)/2,p=u+d;for(let y=0;y<n;y++){let x=p+y/(n-1)*h;t.push(r(y,e.center.x+f*Math.cos(x),e.center.y+f*Math.sin(x)))}return t}let i=e.width??80,s=e.height??50,a=Lf(e),c=["top","bottom","left","right"],l=0;for(let f of c){let u=a[f];for(let m=0;m<u;m++){let h,d;f==="top"?(h=-i/2+(m+.5)*i/u,d=-s/2-An):f==="bottom"?(h=-i/2+(m+.5)*i/u,d=s/2+An):f==="left"?(h=-i/2-An,d=-s/2+(m+.5)*s/u):(h=i/2+An,d=-s/2+(m+.5)*s/u);let p=hr(h,d,e.rotation,e.center);t.push(r(l++,p.x,p.y,f))}}return t}function Ff(e){return Bf(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 Nf(e){return[{id:`${e.id}:0`,label:e.label,...e.displayLabel&&e.displayLabel!==e.label?{displayLabel:e.displayLabel}:{},x:e.center.x,y:e.center.y,rowId:e.id,categoryKey:e.categoryKey,kind:"booth",...e.commercial?.note?{commercial:{note:e.commercial.note}}:{}}]}function tr(e,t){let n=!1;for(let o=0,r=t.length-1;o<t.length;r=o++){let i=t[o].x,s=t[o].y,a=t[r].x,c=t[r].y;s>e.y!=c>e.y&&e.x<(a-i)*(e.y-s)/(c-s)+i&&(n=!n)}return n}function Di(e,t){return t.some((n,o)=>{let r=t[(o+1)%t.length],i=(e.y-n.y)*(r.x-n.x)-(e.x-n.x)*(r.y-n.y);if(Math.abs(i)>1e-7)return!1;let s=(e.x-n.x)*(r.x-n.x)+(e.y-n.y)*(r.y-n.y),a=(r.x-n.x)**2+(r.y-n.y)**2;return s>=-1e-7&&s<=a+1e-7})}function wn(e){return Array.isArray(e)?e.filter(t=>Array.isArray(t)&&t.length>=3):[]}function Xe(e,t,n){return tr(e,t)&&!wn(n).some(o=>tr(e,o)||Di(e,o))}function ao(e){if(!e.length)return{x:0,y:0};let t=0,n=0;for(let o of e)t+=o.x,n+=o.y;return{x:t/e.length,y:n/e.length}}function fs(e){switch(e.type){case"row":{let t=dr(e),n=pr(e),o=0,r=0,i=0;for(let s=0;s<t.length;s++){let a=n.get(s);a?.skip||(o+=t[s].x+(a?.dx??0),r+=t[s].y+(a?.dy??0),i++)}return i?{x:o/i,y:r/i}:{x:e.origin.x,y:e.origin.y}}case"table":case"booth":return{x:e.center.x,y:e.center.y};case"gaArea":return 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 cs(e,t){return e.length===t.length&&e.every((n,o)=>n.x===t[o].x&&n.y===t[o].y)}function Df(e,t){if(e.type!=="gaArea"||!cs(e.points,t.outline))return!1;let n=wn(e.holes),o=wn(t.holes);return n.length===o.length&&n.every((r,i)=>cs(r,o[i]))}function Gf(e,t,n=e.filter(r=>r.type==="section"),o=fs(t)){let r="referenceInventorySource"in t?t.referenceInventorySource?.logicalSectionId:void 0;return(r?n.find(s=>(s.logicalSectionId??s.id)===r&&(Df(t,s)||Xe(o,s.outline,s.holes))):void 0)??n.find(s=>Xe(o,s.outline,s.holes))??(t.type==="row"&&Hf(t)?jf(t,n):void 0)}function Hf(e){return(e.overrides??[]).some(t=>t.skip===!0)}function jf(e,t){let n=dr(e),o=pr(e),r,i=0;for(let s of t){let a=0;for(let c=0;c<n.length;c++){let l=o.get(c);if(l?.skip)continue;let f={x:n[c].x+(l?.dx??0),y:n[c].y+(l?.dy??0)};Xe(f,s.outline,s.holes)&&a++}a>i&&(r=s,i=a)}return r}function as(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 ls(e,t,n,o,r,i,s,a,c){let l=[],f=e.filter(p=>p.type==="section"),u=Gi(e),m=p=>!p?.eventConfigurationId||p.eventConfigurationId===o&&(p.eventConfigurationVersion===void 0||p.eventConfigurationVersion===c),h=p=>Yi(p,{activeConfigurationId:o,activeConfigurationVersion:c,activeBasisSha256:r,now:a}),d=(p,y)=>h(p)?{...p,coverage:y}:void 0;for(let p of e){let y=[];if(p.type==="row"?y=Tf(p):p.type==="table"?y=Ff(p):p.type==="booth"&&(y=Nf(p)),!y.length)continue;for(let I of y)I.viewUrl&&!m(I.viewMeta)&&(I.viewUrl=void 0,I.viewMeta=void 0);if(p.type==="row"){let I=u.get(p.id);if(I){let b=new Map((p.overrides??[]).map(R=>[R.index,R]));for(let R of y){let P=Number(R.id.slice(R.id.lastIndexOf(":")+1));if(!Number.isInteger(P))continue;R.logicalRowId=I.groupId,R.logicalSeatIndex=I.adjacencyOffset+P,b.get(P)?.displayLabel||(R.displayLabel=or(p,P,I)),!R.viewUrl&&I.viewFromSeatUrl&&m(I.viewFromSeatMeta)&&(R.viewUrl=I.viewFromSeatUrl,R.viewMeta=I.viewFromSeatMeta);let M=b.get(P)?.confidenceEvidence;R.confidenceEvidence=d(M,"exact-seat")??d(p.confidenceEvidence,"row-representative")??d(I.confidenceEvidence,"row-representative")}}}let x=Gf(e,p,f,p.type==="row"?ao(y):fs(p)),g=x?.viewFromSeatUrl,w=(x?.zone?t?.find(I=>I.id===x.zone):void 0)?.focalPoint??n;for(let I of y){if(!I.confidenceEvidence){let b=Number(I.id.slice(I.id.lastIndexOf(":")+1)),R=(p.type==="row"||p.type==="table")&&Number.isInteger(b)?p.overrides?.find(P=>P.index===b)?.confidenceEvidence:void 0;I.confidenceEvidence=d(R,"exact-seat")??(p.type==="row"?d(p.confidenceEvidence,"row-representative"):void 0)}I.confidenceEvidence??=d(x?.confidenceEvidence,"section-representative")??(s?d(s.evidence,s.coverage):void 0),!I.viewUrl&&g&&m(x?.viewFromSeatMeta)&&(I.viewUrl=g,I.viewMeta=x?.viewFromSeatMeta),!I.viewUrl&&i&&m(i.meta)&&(I.viewUrl=i.url,I.viewMeta=i.meta),x&&(I.sectionId=x.logicalSectionId??x.id),x?.zone&&(I.zoneId=x.zone),w&&(I.focalPoint={...w})}l.push(...y)}return l}function on(e,t={}){if(e.floors?.length){let o=[];for(let r of e.floors){let i=r.focalPoint??e.focalPoint,s=r.viewFromSeatUrl?{url:r.viewFromSeatUrl,meta:r.viewFromSeatMeta}:e.viewFromSeatUrl?{url:e.viewFromSeatUrl,meta:e.viewFromSeatMeta}:void 0,a=r.confidenceEvidence?{evidence:r.confidenceEvidence,coverage:"floor-representative"}:e.confidenceEvidence?{evidence:e.confidenceEvidence,coverage:"venue-representative"}:void 0,c=ls(r.objects,e.zones,i,e.eventConfigurationId,e.confidenceBasisSha256,s,a,t.now,t.eventConfigurationVersion??e.eventConfigurationVersion);t.resolveEyeHeights!==!1&&us(r.objects,r.focalPoint??e.focalPoint,r.baseHeightM??0,c);for(let l of c)l.floorId=r.id;for(let l of c)o.push(l)}return o}let n=ls(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&&us(e.objects,e.focalPoint,t.floorBaseHeightM??0,n),Vf(e,n,t)}function Vf(e,t,n){return!n.deriveRestrictedView||e.derivedRestrictedView===!1||n.resolveEyeHeights===!1||ss(t,is(t,rs(e))),t}function us(e,t,n,o){let r=e.filter(u=>u.type==="section"),i=n>0||r.some(u=>u.height!==void 0||u.rake!==void 0||(u.elevation??0)>0);if(!r.length||!i||!t){for(let u of o)u.eyeHeightM=n+Mt;return}let s=new Array(o.length),a=new Map;for(let u of r)a.has(u.id)||a.set(u.id,u);let c=new Map,l=new Map;for(let u=0;u<o.length;u++){let m=o[u],d=(m.sectionId?a.get(m.sectionId)??r.find(y=>y.logicalSectionId===m.sectionId&&Xe({x:m.x,y:m.y},y.outline,y.holes)):void 0)??r.find(y=>Xe({x:m.x,y:m.y},y.outline,y.holes))??null;if(s[u]=d,!d)continue;c.has(d.id)||c.set(d.id,Lt(d,{floorBaseHeightM:n}));let p=l.get(d.id);p?p.push(u):l.set(d.id,[u])}let f=new Array(o.length).fill(void 0);for(let[u,m]of l){let h=c.get(u);if(!h)continue;let d=h.rake>0?Math.tan(h.rake*Math.PI/180):0,p=oo(u,o,m,t);for(let y of p.rows){let x=y.blockDepth*re*d,g=h.height+x;for(let S of y.seatIndices)f[S]=g}}for(let u=0;u<o.length;u++){let m=o[u],h=s[u];if(!h){m.eyeHeightM=n+Mt;continue}let d=c.get(h.id);m.eyeHeightM=(f[u]??d.height)+Mt}}var hs=xt(require("earcut"),1),br=xt(require("polygon-clipping"),1);function rt(e){let t=0;for(let n=0,o=e.length;n<o;n+=1){let r=e[n],i=e[(n+1)%o];t+=r.x*i.y-i.x*r.y}return t/2}function Ve(e,t,n){let o=!1;for(let r=0,i=e.length-1;r<e.length;i=r++){let s=e[r],a=e[i];s.y>n!=a.y>n&&t<(a.x-s.x)*(n-s.y)/(a.y-s.y)+s.x&&(o=!o)}return o}var _=re,Uf=.002;function Xf(e,t,n){let o=Math.hypot(t[0]-e[0],t[1]-e[1],t[2]-e[2]),r=Math.hypot(n[0]-t[0],n[1]-t[1],n[2]-t[2]),i=Math.hypot(e[0]-n[0],e[1]-n[1],e[2]-n[2]),s=Math.max(o,r,i);if(s<1e-9)return!0;let a=(o+r+i)/2;return 2*Math.sqrt(Math.max(0,a*(a-o)*(a-r)*(a-i)))/s<Uf}var vn=-2,Xt=class{constructor(t=16384){this.len=0;this.buf=new Float32Array(t)}push3(t,n,o){this.len+3>this.buf.length&&this.grow(this.len+3),this.buf[this.len++]=t,this.buf[this.len++]=n,this.buf[this.len++]=o}push1(t){this.len+1>this.buf.length&&this.grow(this.len+1),this.buf[this.len++]=t}grow(t){let n=this.buf.length*2;for(;n<t;)n*=2;let o=new Float32Array(n);o.set(this.buf.subarray(0,this.len)),this.buf=o}get length(){return this.len}toArray(){return this.buf.slice(0,this.len)}},fo=class{constructor(){this.pos=new Xt;this.nor=new Xt;this.col=new Xt;this.flr=new Xt;this.mat=new Xt;this.currentFloor=0;this.currentMaterial=0}setFloor(t){this.currentFloor=t}setMaterial(t){this.currentMaterial=t}tri(t,n,o,r,i,s=i,a=i,c){if(Xf(t,n,o))return;this.pos.push3(t[0],t[1],t[2]),this.pos.push3(n[0],n[1],n[2]),this.pos.push3(o[0],o[1],o[2]),this.nor.push3(r[0],r[1],r[2]),this.nor.push3(r[0],r[1],r[2]),this.nor.push3(r[0],r[1],r[2]),this.col.push3(i[0],i[1],i[2]),this.col.push3(s[0],s[1],s[2]),this.col.push3(a[0],a[1],a[2]),this.flr.push1(this.currentFloor),this.flr.push1(this.currentFloor),this.flr.push1(this.currentFloor);let l=this.currentMaterial;this.mat.push1(c?.[0]??l),this.mat.push1(c?.[1]??l),this.mat.push1(c?.[2]??l)}triN(t,n,o,r,i,s,a,c=a,l=a){[...t,...n,...o].every(Number.isFinite)&&(this.pos.push3(t[0],t[1],t[2]),this.pos.push3(n[0],n[1],n[2]),this.pos.push3(o[0],o[1],o[2]),this.nor.push3(r[0],r[1],r[2]),this.nor.push3(i[0],i[1],i[2]),this.nor.push3(s[0],s[1],s[2]),this.col.push3(a[0],a[1],a[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 Kf(e,t,n){let o=t[0]-e[0],r=t[1]-e[1],i=t[2]-e[2],s=n[0]-e[0],a=n[1]-e[1],c=n[2]-e[2],l=r*c-i*a,f=i*s-o*c,u=o*a-r*s,m=Math.hypot(l,f,u)||1;return l/=m,f/=m,u/=m,[l,f,u]}function Wf(e,t){let n=[...e],o=[];for(let s of e)o.push(s.x,s.y);let r=[];if(t){for(let s of t)if(!(s.length<3)){r.push(n.length);for(let a of s)n.push(a),o.push(a.x,a.y)}}let i=(0,hs.default)(o,r.length?r:void 0,2);return{pts:n,tris:i}}function Rt(e){return rt(e)<0?[...e].reverse():e}var Yf=3;function zf(e,t,n,o){let r=o(e),i=o(t),s=o(n),a=(h,d,p,y)=>Math.abs(o({x:(h.x+d.x)/2,y:(h.y+d.y)/2})-(p+y)/2),c=(e.x+t.x+n.x)/3,l=(e.y+t.y+n.y)/3,f=(r+i+s)/3,u=Math.max(a(e,t,r,i),a(t,n,i,s),a(n,e,s,r),Math.abs(o({x:c,y:l})-f)),m=(h,d,p)=>{let y=Math.abs(o({x:(h+c)/2,y:(d+l)/2})-(p+f)/2);y>u&&(u=y)};return m((e.x+t.x)/2,(e.y+t.y)/2,(r+i)/2),m((t.x+n.x)/2,(t.y+n.y)/2,(i+s)/2),m((n.x+e.x)/2,(n.y+e.y)/2,(s+r)/2),u}function Cn(e,t,n,o,r){if(r<=0)return zf(e,t,n,o);let i={x:(e.x+t.x)/2,y:(e.y+t.y)/2},s={x:(t.x+n.x)/2,y:(t.y+n.y)/2},a={x:(n.x+e.x)/2,y:(n.y+e.y)/2};return Math.max(Cn(e,i,a,o,r-1),Cn(i,t,s,o,r-1),Cn(a,s,n,o,r-1),Cn(i,s,a,o,r-1))}function kn(e,t,n,o,r,i,s,a){if(s>0){let m={x:(t.x+n.x)/2,y:(t.y+n.y)/2},h={x:(n.x+o.x)/2,y:(n.y+o.y)/2},d={x:(o.x+t.x)/2,y:(o.y+t.y)/2};kn(e,t,m,d,r,i,s-1,a),kn(e,m,n,h,r,i,s-1,a),kn(e,d,h,o,r,i,s-1,a),kn(e,m,h,d,r,i,s-1,a);return}let c=[t.x*_,r(t),t.y*_],l=[n.x*_,r(n),n.y*_],f=[o.x*_,r(o),o.y*_];if(a){e.triN(c,l,f,a(t),a(n),a(o),i);return}let u=Kf(c,l,f);u[1]<0&&(u=[-u[0],-u[1],-u[2]]),e.tri(c,l,f,u,i)}var Zf=8;function ms(e,t,n){if(!Number.isFinite(n))return e;let o=[],r=(i,s,a,c,l)=>{if(l>0){let f={x:(i.x+s.x)/2,y:(i.y+s.y)/2},u=t(f);if(Math.abs(u-(a+c)/2)>n){r(i,f,a,u,l-1),r(f,s,u,c,l-1);return}}o.push(i)};for(let i=0;i<e.length;i++){let s=e[i],a=e[(i+1)%e.length];r(s,a,t(s),t(a),Zf)}return o}function lo(e,t){if(e.length<3)return e;let n=[];for(let r of e){let i=n[n.length-1];i&&Math.hypot(r.x-i.x,r.y-i.y)<t||n.push(r)}for(;n.length>2&&Math.hypot(n[0].x-n[n.length-1].x,n[0].y-n[n.length-1].y)<t;)n.pop();if(n.length<3)return e;let o=[];for(let r=0;r<n.length;r++){let i=o.length?o[o.length-1]:n[(r-1+n.length)%n.length],s=n[r],a=n[(r+1)%n.length],c=a.x-i.x,l=a.y-i.y,f=Math.hypot(c,l);f>t&&Math.abs((s.x-i.x)*l-(s.y-i.y)*c)/f<t||o.push(s)}return o.length>=3?o:n}var uo=.001*ct*.1;function Q(e,t,n,o,r,i,s,a,c=1/0,l){if(!t||t.length<3||(c===void 0&&(c=1/0),Math.abs(rt(t))<1e-4))return;let f=lo(ms(lo(Rt(t),uo),o,c),uo),u=n?.map(b=>lo(ms(lo(Rt(b),uo),o,c),uo)).filter(b=>b.length>=3&&Math.abs(rt(b))>=1e-4),{pts:m,tris:h}=Wf(f,u),d=[i[0]*a.top,i[1]*a.top,i[2]*a.top],p=[i[0]*a.bottomCap,i[1]*a.bottomCap,i[2]*a.bottomCap],y=[s[0]*a.top,s[1]*a.top,s[2]*a.top],x=[s[0]*a.wallBottom,s[1]*a.wallBottom,s[2]*a.wallBottom],g=0;if(Number.isFinite(c))for(;g<Yf;g++){let b=0;for(let R=0;R<h.length;R+=3){let P=Cn(m[h[R]],m[h[R+1]],m[h[R+2]],o,g);P>b&&(b=P)}if(b<=c)break}for(let b=0;b<h.length;b+=3){let R=m[h[b]],P=m[h[b+1]],M=m[h[b+2]];kn(e,R,P,M,o,d,g,l);let C=[R.x*_,r,R.y*_],T=[P.x*_,r,P.y*_],v=[M.x*_,r,M.y*_];e.tri(C,v,T,[0,-1,0],p)}let S=b=>{if(g<=0)return b;let R=1<<g,P=[];for(let M=0;M<b.length;M++){let C=b[M],T=b[(M+1)%b.length];for(let v=0;v<R;v++){let k=v/R;P.push({x:C.x+(T.x-C.x)*k,y:C.y+(T.y-C.y)*k})}}return P},w=qo(f),I=[{ring:S(f),flip:!1}];if(u)for(let b of u)b.length>=3&&I.push({ring:S(b),flip:!0});for(let{ring:b,flip:R}of I)for(let P=0;P<b.length;P++){let M=b[P],C=b[(P+1)%b.length],T=(C.x-M.x)*_,k=(C.y-M.y)*_,E=-T,A=Math.hypot(k,E)||1;k/=A,E/=A;let O=(M.x+C.x)/2-w.x,F=(M.y+C.y)/2-w.y,L=k*O+E*F;R&&(L=-L),L<0&&(k=-k,E=-E);let B=[k,0,E],D=[M.x*_,o(M),M.y*_],j=[C.x*_,o(C),C.y*_],H=[M.x*_,r,M.y*_],V=[C.x*_,r,C.y*_];e.tri(D,j,V,B,y,y,x),e.tri(D,V,H,B,y,x,x)}}function ds(e){let t=0;for(let c of e)t+=c.count;let n=new Float32Array(t*3),o=new Float32Array(t*3),r=new Float32Array(t*3),i=new Float32Array(t),s=new Float32Array(t),a=0;for(let c of e)n.set(c.position,a*3),o.set(c.normal,a*3),r.set(c.color,a*3),i.set(c.floor,a),s.set(c.material,a),a+=c.count;return{position:n,normal:o,color:r,floor:i,material:s,count:t}}function It(e,t,n=2.5){if(t<=0||e.length<3)return e;let o=Rt(e),r=o.length,i=[];for(let a=0;a<r;a++){let c=o[a],l=o[(a+1)%r],f=l.x-c.x,u=l.y-c.y,m=Math.hypot(f,u)||1;i.push({x:u/m,y:-f/m})}let s=[];for(let a=0;a<r;a++){let c=o[a],l=i[(a-1+r)%r],f=i[a],u=l.x+f.x,m=l.y+f.y,h=Math.hypot(u,m),d=()=>{s.push([c.x+l.x*t,c.y+l.y*t]),s.push([c.x+f.x*t,c.y+f.y*t])};if(h<1e-9){d();continue}u/=h,m/=h;let p=u*l.x+m*l.y,y=1/Math.max(p,1e-6);if(!Number.isFinite(y)||y>n){d();continue}s.push([c.x+u*t*y,c.y+m*t*y])}if(s.length<3)return e;try{let a=br.default.union([[...s,s[0]]]),c=null,l=-1/0;for(let u of a){let m=Math.abs(rt(u[0].map(([h,d])=>({x:h,y:d}))));m>l&&(l=m,c=u[0])}if(!c)return e;let f=c.map(([u,m])=>({x:u,y:m}));if(f.length>1){let u=f[0],m=f[f.length-1];Math.abs(u.x-m.x)<1e-9&&Math.abs(u.y-m.y)<1e-9&&f.pop()}return f.length>=3?f:e}catch{return e}}function lt(e,t,n=2.5){if(e.length<3)return[];if(t<=0)return e;let o=Rt(e),r=o.length,i=[];for(let c=0;c<r;c++){let l=o[c],f=o[(c+1)%r],u=Math.hypot(f.x-l.x,f.y-l.y)||1;i.push({x:-(f.y-l.y)/u,y:(f.x-l.x)/u})}let s=[],a=[];for(let c=0;c<r;c++){let l=o[c],f=i[(c-1+r)%r],u=i[c],m=f.x+u.x,h=f.y+u.y,d=Math.hypot(m,h),p=d<1e-9?1/0:1/Math.max(m/d*f.x+h/d*f.y,1e-6);if(!Number.isFinite(p)||p>n){s.push({x:l.x+f.x*t,y:l.y+f.y*t},{x:l.x+u.x*t,y:l.y+u.y*t}),a.push(c,c);continue}m/=d,h/=d,s.push({x:l.x+m*t*p,y:l.y+h*t*p}),a.push(c)}for(let c=0;c<s.length;c++){let l=(c+1)%s.length,f=a[c],u=a[l];if(u!==(f+1)%r)continue;let m=o[f],h=o[u];if((s[l].x-s[c].x)*(h.x-m.x)+(s[l].y-s[c].y)*(h.y-m.y)<=0)return[]}try{let c=br.default.intersection([[...s.map(d=>[d.x,d.y]),[s[0].x,s[0].y]]],[[...o.map(d=>[d.x,d.y]),[o[0].x,o[0].y]]]),l=null,f=0;for(let d of c){let p=Math.abs(rt(d[0].map(([y,x])=>({x:y,y:x}))));p>f&&(f=p,l=d[0])}if(!l)return[];let u=l.map(([d,p])=>({x:d,y:p})),m=u[0],h=u[u.length-1];return u.length>1&&Math.abs(m.x-h.x)<1e-9&&Math.abs(m.y-h.y)<1e-9&&u.pop(),u.length>=3?Rt(u):[]}catch{return[]}}function mo(e,t,n,o,r=28){let i=[];for(let s=0;s<r;s++){let a=s/r*Math.PI*2;i.push({x:e+n*Math.cos(a),y:t+o*Math.sin(a)})}return i}function On(e,t,n,o){return[{x:e,y:t},{x:e+n,y:t},{x:e+n,y:t+o},{x:e,y:t+o}]}var Tn=3,Kt=.38,Ln=.24;function $f(e){if(e.length<3)return null;let t=e[0],n=e[Math.floor(e.length/2)],o=e[e.length-1],r=(n.x-t.x)*_,i=(n.y-t.y)*_,s=(o.x-t.x)*_,a=(o.y-t.y)*_,c=2*(r*a-i*s);if(Math.abs(c)<1e-7)return null;let l=r*r+i*i,f=s*s+a*a,u=(l*a-f*i)/c+t.x*_,m=(r*f-s*l)/c+t.y*_,h=Math.hypot(t.x*_-u,t.y*_-m);return h<1||h>200||!Number.isFinite(h)||e.some(d=>Math.abs(Math.hypot(d.x*_-u,d.y*_-m)-h)>.03)?null:{x:u,z:m,radius:h}}function ps(e){let t=[],n=new Map,o=(c,l)=>`${Math.floor(c/Tn)},${Math.floor(l/Tn)}`;for(let c of e)for(let l of c.rows){for(let u of l.pts){let m=u.x*_,h=u.y*_,d=o(m,h),p=n.get(d)??[];p.push({x:m,z:h,y:l.y,floor:c.floorIndex}),n.set(d,p)}if(l.patch||l.pts.length<2)continue;let f=$f(l.pts);for(let u of[0,l.pts.length-1]){let m=l.pts[u],h=l.pts[u===0?1:u-1],d=m.x-h.x,p=m.y-h.y,y=Math.hypot(d,p);y<1e-6||t.push({sectionId:c.sectionId,floorIndex:c.floorIndex,curve:f,row:l,point:m,x:m.x*_,z:m.y*_,dx:d/y,dz:p/y})}}let r=new Map;t.forEach((c,l)=>{let f=o(c.x,c.z),u=r.get(f)??[];u.push(l),r.set(f,u)});let i=(c,l)=>{let f=Math.floor(c/Tn),u=Math.floor(l/Tn);return[-1,0,1].flatMap(m=>[-1,0,1].map(h=>`${f+m},${u+h}`))},s=new Map;t.forEach((c,l)=>{let f=-1,u=1/0,m=!1;for(let h of i(c.x,c.z))for(let d of r.get(h)??[]){let p=t[d];if(c.sectionId===p.sectionId&&c.row.blockId===p.row.blockId||c.floorIndex!==p.floorIndex||Math.abs(c.row.y-p.row.y)>.05)continue;let y=p.x-c.x,x=p.z-c.z,g=Math.hypot(y,x);if(g<Kt*2+.45||g>Tn)continue;let S=c.curve&&p.curve&&Math.hypot(c.curve.x-p.curve.x,c.curve.z-p.curve.z)<=.05&&Math.abs(c.curve.radius-p.curve.radius)<=.05,w=Math.min((y*c.dx+x*c.dz)/g,(-y*p.dx-x*p.dz)/g);(S?w<.8:w<.98)||!S&&(Math.abs(y*c.dz-x*c.dx)>.15||Math.abs(y*p.dz-x*p.dx)>.15)||(g<u-.02?(f=d,u=g,m=!1):Math.abs(g-u)<=.02&&(m=!0))}f>=0&&!m&&s.set(l,f)});let a=[];for(let[c,l]of s){if(c>=l||s.get(l)!==c)continue;let f=t[c],u=t[l],m=Math.hypot(u.x-f.x,u.z-f.z),h=(u.x-f.x)/m,d=(u.z-f.z)/m,p=!1;for(let x of i((f.x+u.x)/2,(f.z+u.z)/2))for(let g of n.get(x)??[]){if(g.floor!==f.floorIndex||Math.abs(g.y-f.row.y)>.75)continue;let S=(g.x-f.x)*h+(g.z-f.z)*d,w=Math.abs((g.x-f.x)*d-(g.z-f.z)*h);S>.01&&S<m-.01&&w<Ln+Kt&&(p=!0)}if(p)continue;let y=(x,g)=>({x:(f.x+h*x-d*g)/_,y:(f.z+d*x+h*g)/_});a.push({sections:[f.sectionId,u.sectionId],blocks:[f.row.blockId,u.row.blockId],floorIndex:f.floorIndex,ends:[f.point,u.point],clearWidthM:m-2*Kt,heightM:(f.row.y+u.row.y)/2,outline:[y(Kt,-Ln),y(m-Kt,-Ln),y(m-Kt,Ln),y(Kt,Ln)]})}return a}var Qf=/^#?([\da-f]{3}|[\da-f]{6})$/i;function bs(e){let t=e.replace("#","");return{r:parseInt(t.slice(0,2),16),g:parseInt(t.slice(2,4),16),b:parseInt(t.slice(4,6),16)}}function qf(e){let t=Qf.exec((e??"").trim());if(!t)return null;let n=t[1].length===3?t[1].split("").map(r=>r+r).join(""):t[1],o=parseInt(n,16);return[o>>16&255,o>>8&255,o&255]}function be(e){let t=qf(e);return t?[t[0]/255,t[1]/255,t[2]/255]:null}function Jf(e){return .2126*e[0]+.7152*e[1]+.0722*e[2]}function ce(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=Jf(e);return ce(e,[n,n,n],t)}function ys({r:e,g:t,b:n}){let o=e/255,r=t/255,i=n/255,s=Math.max(o,r,i),a=Math.min(o,r,i),c=(s+a)/2;if(s===a)return{h:0,s:0,l:c};let l=s-a,f=c>.5?l/(2-s-a):l/(s+a),u;return s===o?u=((r-i)/l+(r<i?6:0))/6:s===r?u=((i-o)/l+2)/6:u=((o-r)/l+4)/6,{h:u,s:f,l:c}}var yr=e=>e<=.04045?e/12.92:((e+.055)/1.055)**2.4,gr=e=>e<=.0031308?12.92*e:1.055*Math.max(0,e)**.4166666666666667-.055,xr=e=>Math.min(1,Math.max(0,e));function Sr(e){let t=yr(e[0]),n=yr(e[1]),o=yr(e[2]),r=Math.cbrt(.4122214708*t+.5363325363*n+.0514459929*o),i=Math.cbrt(.2119034982*t+.6806995451*n+.1073969566*o),s=Math.cbrt(.0883024619*t+.2817188376*n+.6299787005*o);return[.2104542553*r+.793617785*i-.0040720468*s,1.9779984951*r-2.428592205*i+.4505937099*s,.0259040371*r+.7827717662*i-.808675766*s]}function Mr([e,t,n]){let o=(e+.3963377774*t+.2158037573*n)**3,r=(e-.1055613458*t-.0638541728*n)**3,i=(e-.0894841775*t-1.291485548*n)**3;return[xr(gr(4.0767416621*o-3.3077115913*r+.2309699292*i)),xr(gr(-1.2684380046*o+2.6097574011*r-.3413193965*i)),xr(gr(-.0041960863*o-.7034186147*r+1.707614701*i))]}var ho=e=>Sr(e)[0];function Bn(e){let[,t,n]=Sr(e);return Math.hypot(t,n)}function Wt(e,t,n){let[,o,r]=Sr(e);if(n===void 0)return Mr([t,o,r]);let i=Math.hypot(o,r),s=i===0?0:n/i;return Mr([t,o*s,r*s])}function po(e){return Mr([e,-.004,-.008])}var bo=["available","held","sold","selected","dimmed"];function xs(e){let t=bo.indexOf(e);return t<0?0:t}var Ms={available:[.24,.82,.52],held:[.34,.39,.45],sold:[.34,.39,.45],selected:[.24,.74,1],dimmed:[.28,.32,.37]};var gs={day:{ground:.9,deck:.84,fascia:.77,shell:.79,seatMin:.45,seatMax:.58,unavailable:.58,dimmed:.62,sectionDeck:.66,sectionDeckChromaShare:.8,sectionDeckChromaCap:.11,stageTop:.52,stageWall:.42},night:{ground:.26,deck:.34,fascia:.28,shell:.32,seatMin:.64,seatMax:.8,unavailable:.42,dimmed:.39,sectionDeck:.34,sectionDeckChromaShare:.45,sectionDeckChromaCap:.05,stageTop:0,stageWall:0}},yo=.012;function Ft(e){return ho(e.tierTop)>.6}function rn(e){return e?gs.day:gs.night}var Rr={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]},Ir={top:[.05,.06,.08],bottom:[.1,.12,.15]};function W(e,t){return[Math.min(1,e[0]*t),Math.min(1,e[1]*t),Math.min(1,e[2]*t)]}var em=.15,tm=1.6;function Ss(e){return Jo(e??1,em,tm)}var Pr={key:[1,1,1],ambient:[1,1,1]};var nm=[{id:"daylight",label:"Daylight",description:"Open air by day: pale concrete under a warm sun and a blue sky.",background:"#dce3e8",materials:{deck:"#c9ccc8",fascia:"#b4bab8",shell:"#c3c9c8",roughness:.87},light:{key:[1.05,1,.93],ambient:[.95,.99,1.06]},indoor:!1},{id:"floodlit",label:"Floodlit night",description:"A night match: dark sky, hard cool-white floodlights.",background:"#0c1420",materials:{deck:"#66727c",fascia:"#3a4a58",shell:"#4c6072",roughness:.84},light:{key:[1.08,1.08,1.12],ambient:[.8,.88,1.1]},indoor:!1},{id:"evening",label:"Evening",description:"A quiet dark hall: slate structure in a cool, even light.",background:"#17232e",materials:{deck:"#69747b",fascia:"#3e4d58",shell:"#526572",roughness:.87},light:{key:[1,.99,.96],ambient:[.94,.98,1.06]},indoor:!1},{id:"arena-show",label:"Arena show",description:"House lights down for a show: deep blue room, warm light on the floor.",background:"#10121c",materials:{deck:"#626a7a",fascia:"#383f52",shell:"#484f66",roughness:.82},light:{key:[1.08,.98,.88],ambient:[.8,.84,1.16]},indoor:!0},{id:"theatre",label:"Theatre house lights",description:"A warm auditorium before curtain-up: amber light, dark warm room.",background:"#1c1512",materials:{deck:"#74685c",fascia:"#4c4038",shell:"#5c4e44",roughness:.9},light:{key:[1.14,.98,.78],ambient:[1.04,.94,.84]},indoor:!0},{id:"concert-hall",label:"Concert hall",description:"A bright hall in pale wood and cream, softly warm.",background:"#e9e2d6",materials:{deck:"#d2c8b8",fascia:"#bcb0a0",shell:"#c8beae",roughness:.8},light:{key:[1.06,1,.9],ambient:[1.02,1,.95]},indoor:!0}],om=new Map(nm.map(e=>[e.id,e])),Rs="plain",Is=3e3;function Ps(e,t){return e.openField?t?"daylight":"floodlit":e.openAir?t?"daylight":e.court?"floodlit":"evening":e.court||e.inTheRound||e.stage&&e.seatCount>Is?t?"daylight":"arena-show":e.stage?t?"concert-hall":"theatre":t?"daylight":"evening"}function ws(e){return e.openField||e.openAir?!1:e.indoorCourt?!0:e.stage&&!e.inTheRound&&!e.court&&e.standing<e.seatCount&&e.seatCount<=Is}function wr(e){return e&&om.get(e)||null}var rm=.15,im=.9,sm=1.76;function am(e,t,n){let o=e??cm,r=(i,s,a)=>[Math.min(1,i[0]*s*a[0]),Math.min(1,i[1]*s*a[1]),Math.min(1,i[2]*s*a[2])];return Fn(e)?{indoor:n,ceiling:r(o,1.02,t.light.ambient),wall:r(o,.9,t.light.ambient),lamp:r([.1,.1,.1],1,t.light.key)}:{indoor:n,ceiling:r(o,.7,t.light.ambient),wall:r(o,1.55,t.light.ambient),lamp:r([.92,.86,.74],1,t.light.key)}}var cm=[.075,.09,.115];function _s(e){return Fn(e)?{zenith:[.36,.58,.84],horizon:[.82,.88,.94]}:{zenith:[.05,.08,.15],horizon:[.3,.38,.5]}}function Fn(e){return!!e&&e[0]*.2126+e[1]*.7152+e[2]*.0722>.55}function lm(){return{background:{top:[...Ir.top],bottom:[...Ir.bottom]},sky:_s(null),structure:Rr,seatStates:{...Ms},seatScale:1,materials:{seat:null,shell:null,roughness:.78},light:{key:[...Pr.key],ambient:[...Pr.ambient]},house:null}}function um(e){return Fn(e)?{deck:"#c9ccc8",fascia:"#b4bab8",shell:"#c3c9c8",roughness:.87}:{deck:"#69747b",fascia:"#3e4d58",shell:"#526572",roughness:.87}}function Es(e,t){let n=e?.venue3d?.look;if(n===Rs)return{look:null,chosen:!0};let o=wr(n);return o?{look:o,chosen:!0}:t?{look:wr(Ps(t,Fn(be(e?.background)))),chosen:!1}:{look:null,chosen:!1}}function fm(e,t){let{look:n,chosen:o}=Es(e,t);return be(e?.background)??(o?be(n?.background):null)}function As(e,t){let n=lm();e??={};let{look:o,chosen:r}=Es(e,t);o&&(n.light={key:[...o.light.key],ambient:[...o.light.ambient]});let i=fm(e,t);if(o&&(n.house=am(i,o,r?o.indoor:!!t&&ws(t))),i){n.background={top:W(i,im),bottom:W(i,sm)},n.sky=_s(i);let f={};for(let[m,h]of Object.entries(Rr))f[m]=ce(h,i,rm);i[0]*.2126+i[1]*.7152+i[2]*.0722>.55&&(f.ground=W(i,.86)),n.structure=f}let s=be(e.selectionColor)??be(e.accent);s&&(n.seatStates={...n.seatStates,selected:s});let a=e.seatScale;typeof a=="number"&&Number.isFinite(a)&&(n.seatScale=Ss(a));let c=Object.fromEntries(Object.entries(e.venue3d??{}).filter(([f,u])=>u!=null&&f!=="look")),l={...um(i),...o?.materials,...c};if(l){let f=be(l.deck),u=be(l.fascia);f&&(n.structure={...n.structure,tierTop:f,gaTop:f}),u&&(n.structure={...n.structure,tierWall:u,gaWall:u}),n.materials.seat=be(l.seat),n.materials.shell=be(l.shell),typeof l.roughness=="number"&&Number.isFinite(l.roughness)&&(n.materials.roughness=Math.min(1,Math.max(0,l.roughness)))}return mm(n,Fn(i)),n}function mm(e,t){let n=rn(t);e.seatStates={...e.seatStates,held:po(n.unavailable),sold:po(n.unavailable),dimmed:po(n.dimmed)};let o=(i,s)=>Wt(i,s,Math.min(Bn(i),yo)),r=e.structure;e.structure={...r,ground:o(r.ground,n.ground),tierTop:o(r.tierTop,n.deck),tierWall:o(r.tierWall,n.fascia)},e.materials.shell&&(e.materials.shell=o(e.materials.shell,n.shell))}function Cs(e,t){let n=[];for(let o of t)n.push(...e.seatStates[o]);return n}function ks(e){let t=1/0,n=1/0,o=-1/0,r=-1/0,i=!1;for(let s of e)!Number.isFinite(s.x)||!Number.isFinite(s.y)||(i=!0,s.x<t&&(t=s.x),s.y<n&&(n=s.y),s.x>o&&(o=s.x),s.y>r&&(r=s.y));return i?{minX:t,minY:n,maxX:o,maxY:r}:null}function sn(e,t){return e.minX<=t.maxX&&t.minX<=e.maxX&&e.minY<=t.maxY&&t.minY<=e.maxY}var ca=xt(require("polygon-clipping"),1);var z={top:1,wallBottom:.58,bottomCap:.4};function Yt(e,t){if(!e)return t;let n=W(Pt(e,.4),.62);return ce(t,n,.22)}function vs(e,t){return e?ce(t,W(Pt(e,.25),.74),.62):t}var Nn={full:[.72,.48],value:.8,spread:.52,paleLuma:.6},_r=[.24,.46,.82];function Os(e){if(!e)return _r;let t=ce(W(e,1.42),_r,.08),n=Math.max(...t),o=n-Math.min(...t);if(n>=Nn.full[0]&&o>=Nn.full[1]||.2126*e[0]+.7152*e[1]+.0722*e[2]>=Nn.paleLuma)return t;let r=Math.max(...e),i=Math.min(...e);if(r-i<.04)return _r;let s=a=>Nn.value-Nn.spread*(1-(a-i)/(r-i));return[s(e[0]),s(e[1]),s(e[2])]}function Ts(e,t){let n=rn(Ft({tierTop:t}));return e?Wt(e,n.sectionDeck,Math.min(n.sectionDeckChromaShare*Bn(e),n.sectionDeckChromaCap)):Wt(t,n.deck,Math.min(Bn(t),yo))}function Ls(e,t){let n=new Map;for(let i of e.categories??[])n.set(i.key,i.color);let o=new Map;for(let i of t){if(!i.sectionId)continue;let s=o.get(i.sectionId);s||(s=new Map,o.set(i.sectionId,s)),s.set(i.categoryKey,(s.get(i.categoryKey)??0)+1)}let r=new Map;for(let[i,s]of o){let a=0,c=0,l=0,f=0;for(let[u,m]of s){let h=be(n.get(u));h&&(a+=h[0]*m,c+=h[1]*m,l+=h[2]*m,f+=m)}f>0&&r.set(i,[a/f,c/f,l/f])}return r}function Bs(e,t){return be(e.color)??t.get(e.logicalSectionId??e.id)??null}var Or=xt(require("polygon-clipping"),1);var vr=xt(require("polygon-clipping"),1);var Fs=e=>Math.round(e*1e6)/1e6+0;function an(e){let t=e.map(r=>({x:Fs(r.x),y:Fs(r.y)})).sort((r,i)=>r.x-i.x||r.y-i.y).filter((r,i,s)=>i===0||r.x!==s[i-1].x||r.y!==s[i-1].y);if(t.length<3)return t;let n=(r,i,s)=>{let a=i.x-r.x,c=i.y-r.y,l=s.x-r.x,f=s.y-r.y;return a*f-c*l>1e-6*Math.hypot(a,c)*Math.hypot(l,f)},o=r=>{let i=[];for(let s of r){for(;i.length>=2&&!n(i[i.length-2],i[i.length-1],s);)i.pop();i.push(s)}return i.pop(),i};return[...o(t),...o([...t].reverse())]}var Er=[{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"}],mg=new Map(Er.map(e=>[e.key,e]));var hm={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 go(e){let t=e?.[0];return t&&hm[t]||"#3b82f6"}var dm=[{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"}],hg=new Map(dm.map(e=>[e.key,e]));var pm=["reference-focal","bar","entrance","exit","restroom","screen","sound","concession","coat","wall","rail","suite","obstruction"],dg=new Set(pm);var Ds=[{key:"circle",label:"Standard seat",shortLabel:"Standard",useCase:"General assigned seating",group:"general",path:null,bounds:null,mark:null},{key:"theatre",label:"Theatre chair",shortLabel:"Theatre",useCase:"Auditoriums, arenas and stadium stands",group:"fixed",path:"M4.5 3.5 Q4.5 1.5 6.5 1.5 L17.5 1.5 Q19.5 1.5 19.5 3.5 L19.5 13 L4.5 13 Z M3.5 12 L20.5 12 Q22.5 12 22.5 14 L22.5 21 Q22.5 22.5 21 22.5 Q19.5 22.5 19.5 21 L19.5 17.5 L4.5 17.5 L4.5 21 Q4.5 22.5 3 22.5 Q1.5 22.5 1.5 21 L1.5 14 Q1.5 12 3.5 12 Z",bounds:{x:1.5,y:1.5,width:21,height:21},mark:{x:12,y:10,radius:6}},{key:"dining",label:"Dining chair",shortLabel:"Dining",useCase:"Banquets, restaurants and table seating",group:"flexible",path:"M7 1 Q6 1 6 2.5 L6.75 10.5 L5 10.5 Q4 10.5 4 12 L4 14 Q4 15 5.25 15 L6 15 L4 23 L7 23 L9.5 15 L14.5 15 L17 23 L20 23 L18 15 L18.75 15 Q20 15 20 14 L20 12 Q20 10.5 19 10.5 L17.25 10.5 L18 2.5 Q18 1 17 1 Z",bounds:{x:4,y:1,width:16,height:22},mark:{x:12,y:10,radius:4.5}},{key:"folding",label:"Folding chair",shortLabel:"Folding",useCase:"Concert floors, ceremonies and conferences",group:"flexible",path:"M6 2 Q5 2 5 3 L6 8 L18 8 L19 3 Q19 2 18 2 Z M5 9 L19 9 Q20 9 20 10.5 L19 13 L5 13 L4 10.5 Q4 9 5 9 Z M6 12 L18 12 L18.5 23 L16 23 L15.5 13 L8.5 13 L8 23 L5.5 23 Z",bounds:{x:4,y:2,width:16,height:21},mark:{x:12,y:5,radius:3}},{key:"armchair",label:"Premium armchair",shortLabel:"Armchair",useCase:"Boxes, lounges and club seating",group:"premium",path:"M3.5 4 Q3.5 1.5 6 1.5 L18 1.5 Q20.5 1.5 20.5 4 L20.5 13 L3.5 13 Z M1.5 12.5 Q1.5 10 3.25 10 Q5 10 5 12.5 L5 13.5 L19 13.5 L19 12.5 Q19 10 20.75 10 Q22.5 10 22.5 12.5 L22.5 19.5 Q22.5 22 20 22 L4 22 Q1.5 22 1.5 19.5 Z",bounds:{x:1.5,y:1.5,width:21,height:20.5},mark:{x:12,y:7.5,radius:5.5}},{key:"recliner",label:"Recliner",shortLabel:"Recliner",useCase:"Luxury cinemas and premium clubs",group:"premium",path:"M7 2 Q7 1 8.5 1 L15.5 1 Q17 1 17 2 L19 13 L5 13 Z M4 9 Q2 9 2 11.5 L2 16 Q2 18 4 18 L6 18 L6 15 L18 15 L18 18 L20 18 Q22 18 22 16 L22 11.5 Q22 9 20 9 Q18 9 18 11 L18 13 L6 13 L6 11 Q6 9 4 9 Z M7 17 L17 17 Q18 17 18.5 18.5 L19.5 22.5 L4.5 22.5 L5.5 18.5 Q6 17 7 17 Z",bounds:{x:2,y:1,width:20,height:21.5},mark:{x:12,y:8,radius:5}},{key:"stool",label:"Stool",shortLabel:"Stool",useCase:"Bars, high-tops and seating rails",group:"flexible",path:"M6 2.5 L18 2.5 Q22 2.5 22 6.5 L22 12 Q22 16 18 16 L6 16 Q2 16 2 12 L2 6.5 Q2 2.5 6 2.5 Z M6 15.5 L9.5 15.5 L7.5 22.5 L3 22.5 Z M14.5 15.5 L18 15.5 L20.5 22.5 L16 22.5 Z",bounds:{x:2,y:2.5,width:20,height:20},mark:{x:12,y:9.25,radius:6.5}},{key:"bench",label:"Bench place",shortLabel:"Bench",useCase:"Pews, bleachers and terraces",group:"fixed",path:"M2.5 0.5 L21.5 0.5 Q23 0.5 23 2 L23 5 Q23 6.5 21.5 6.5 L2.5 6.5 Q1 6.5 1 5 L1 2 Q1 0.5 2.5 0.5 Z M2 7.5 L22 7.5 Q23.5 7.5 23.5 9 L23.5 15.5 Q23.5 17 22 17 L18 17 L18 21.5 Q18 22.5 16.75 22.5 Q15.5 22.5 15.5 21.5 L15.5 17 L8.5 17 L8.5 21.5 Q8.5 22.5 7.25 22.5 Q6 22.5 6 21.5 L6 17 L2 17 Q0.5 17 0.5 15.5 L0.5 9 Q0.5 7.5 2 7.5 Z",bounds:{x:.5,y:.5,width:23,height:22},mark:{x:12,y:12.25,radius:4.75}}],Gs=Ds.map(e=>e.key),bm=new Map(Ds.map(e=>[e.key,e]));function Ns(e){return typeof e=="string"&&bm.has(e)}function Hs(e,t){return Ns(e)?e:Ns(t?.seatGlyph)?t.seatGlyph:"circle"}var it={pedestal:0,pad:1,back:2,arm:3,footrest:4,leg:5,spine:6,armrest:7},ym=.44,gm=.15,xm=.3,Mm=.24;function Vs(e){return e===void 0||!Number.isFinite(e)||e<=0?Mm:Math.min(xm,Math.max(gm,e*ym))}var Sm=.05,Us=.45,Rm=Us+Sm,Im=.92;var Pm=.28,js=.15,xg=[{part:it.pedestal,min:[-.3,0,-.3],max:[.3,.36,.3]},{part:it.pad,min:[-1,.36,-.95],max:[1,Us,1]},{part:it.back,min:[-1,Rm,-1],max:[1,Im,-.72]},{part:it.arm,min:[-1,.44,-.82],max:[-.78,.65,.78]},{part:it.arm,min:[.78,.44,-.82],max:[1,.65,.78]},{part:it.footrest,min:[-.9,.18,.78],max:[.9,.31,1.34]},{part:it.leg,min:[-.82,0,-.7],max:[-.62,.37,-.48]},{part:it.leg,min:[.62,0,-.7],max:[.82,.37,-.48]},{part:it.leg,min:[-.82,0,.48],max:[-.62,.37,.7]},{part:it.leg,min:[.62,0,.48],max:[.82,.37,.7]},{part:it.spine,min:[-.8,.3,-1],max:[.8,.6,-.9]},...[1,-1].flatMap(e=>{let t=s=>{let a=e*(js-s),c=e*(js+s);return[Math.min(a,c),Math.max(a,c)]},[n,o]=t(.09),[r,i]=t(Pm/2);return[{part:it.armrest,min:[n,0,-.5],max:[o,.6,.05],skip:[2,3]},{part:it.armrest,min:[r,.6,-.74],max:[i,.655,.58],skip:[3]}]})];var Ar=20*Math.PI/180;function Xs(e,t,n,o,r){let i=new Float32Array(t),s=u=>e[u*3],a=u=>e[u*3+2],c=Math.cos(Ar),l=0,f=(u,m)=>{let h=m-u,d=r?.(u),p=d!==void 0;for(let S=u+1;!p&&S<m-1;S++){let w=s(S)-s(S-1),I=a(S)-a(S-1),b=s(S+1)-s(S),R=a(S+1)-a(S),P=Math.hypot(w,I)*Math.hypot(b,R);P>1e-9&&(w*b+I*R)/P<c&&(p=!0)}let y=0,x=0,g=!1;if(p){if(d)[y,x]=d;else{for(let w=u;w<m;w++)y+=s(w),x+=a(w);y/=h,x/=h}let S=0;for(let w=u+1;w<m;w++)S=Math.max(S,Math.hypot(s(w)-s(w-1),a(w)-a(w-1)));g=h>=3&&Math.hypot(s(m-1)-s(u),a(m-1)-a(u))<=S*1.6}for(let S=u;S<m;S++){let[w,I]=p?[y,x]:o(S),b=w-s(S),R=I-a(S);if(h>=2&&!(d&&h<3)){let P=g?u+(S-1-u+h)%h:Math.max(u,S-1),M=g?u+(S+1-u)%h:Math.min(m-1,S+1),C=s(M)-s(P),T=a(M)-a(P),v=Math.hypot(C,T);if(v>1e-6){let k=-T/v,E=C/v;k*b+E*R<0&&(k=-k,E=-E),b=k,R=E}}i[S]=b===0&&R===0?0:Math.atan2(b,R)}};for(let u=1;u<=t;u++)(u===t||n(u)!==n(l))&&(f(l,u),l=u);return i}var xo=.22;var wm=.42,Ks=1.6;function _m(e,t){let n=new Float32Array(e.length*4),o=Math.cos(Ar),r=0;for(let i=1;i<=e.length;i++){if(i<e.length&&e[i].rowId===e[r].rowId)continue;let s=i-r>=2&&!t?.has(e[r].rowId);for(let l=r;s&&l<i;l++)e[l].kind==="booth"&&(s=!1);for(let l=r+1;s&&l<i-1;l++){let f=e[l].x-e[l-1].x,u=e[l].y-e[l-1].y,m=e[l+1].x-e[l].x,h=e[l+1].y-e[l].y,d=Math.hypot(f,u)*Math.hypot(m,h);d>1e-9&&(f*m+u*h)/d<o&&(s=!1)}let a=[];for(let l=r+1;s&&l<i;l++){let f=Math.hypot(e[l].x-e[l-1].x,e[l].y-e[l-1].y);f>1e-6&&a.push(f)}a.sort((l,f)=>l-f);let c=a.length?a[Math.floor(a.length/2)]:0;for(let l=r;c>0&&l<i;l++){let f=y=>{let x=l+y;if(x<r||x>=i)return null;let g=e[x].x-e[l].x,S=e[x].y-e[l].y,w=Math.hypot(g,S);return w>1e-6?{x:g/w,y:S/w,gap:w}:null},u=f(1),m=f(-1),h=c/2,d=u??(m?{x:-m.x,y:-m.y,gap:1/0}:null);if(!d)continue;let p=u&&u.gap<c*Ks?u.gap/2:h;if(n[l*4]=d.x*p*_,n[l*4+1]=d.y*p*_,!m||m.gap>=c*Ks){let y=m??{x:-d.x,y:-d.y};n[l*4+2]=y.x*h*_,n[l*4+3]=y.y*h*_}}r=i}return n}function Em(e){let t=e.length,n=new Float64Array(t);if(t<2)return n.fill(1/0),n;let o=1/0,r=1/0,i=-1/0,s=-1/0;for(let d of e)d.x<o&&(o=d.x),d.y<r&&(r=d.y),d.x>i&&(i=d.x),d.y>s&&(s=d.y);let a=Math.max(i-o,1e-6),c=Math.max(s-r,1e-6),l=Math.max(Math.sqrt(a*c/t),1e-6),f=Math.max(1,Math.ceil(a/l)+1),u=Math.max(1,Math.ceil(c/l)+1),m=new Map,h=(d,p)=>{let y=Math.min(f-1,Math.max(0,Math.floor((d-o)/l)));return Math.min(u-1,Math.max(0,Math.floor((p-r)/l)))*f+y};for(let d=0;d<t;d++){let p=h(e[d].x,e[d].y),y=m.get(p);y?y.push(d):m.set(p,[d])}for(let d=0;d<t;d++){let p=e[d],y=Math.min(f-1,Math.max(0,Math.floor((p.x-o)/l))),x=Math.min(u-1,Math.max(0,Math.floor((p.y-r)/l))),g=1/0;for(let S=1;S<=4;S++){for(let w=x-S;w<=x+S;w++)if(!(w<0||w>=u))for(let I=y-S;I<=y+S;I++){if(I<0||I>=f||S>1&&Math.abs(w-x)<S&&Math.abs(I-y)<S)continue;let b=m.get(w*f+I);if(b)for(let R of b){if(R===d)continue;let P=Math.hypot(e[R].x-p.x,e[R].y-p.y);P<g&&(g=P)}}if(Number.isFinite(g)&&g<=S*l)break}n[d]=g}return n}function Am(e){let t=e.eyeHeightM;return Number.isFinite(t)?Math.max(0,t-Mt):0}function Ws(e,t,n,o,r,i,s){let a=e.length,c=new Float32Array(a*3),l=new Float32Array(a),f=new Float32Array(a*3),u=new Float32Array(a),m=new Float32Array(a),h=new Float32Array(a),d=new Float32Array(a),p=new Float32Array(a*3),y=new Map,x=Em(e);for(let g=0;g<a;g++){let S=e[g],I=(n?.seatPitchU(g)??x[g])*_;u[g]=Number.isFinite(I)?Math.max(.06,Math.min(xo,I*wm)):xo,m[g]=Vs(Number.isFinite(I)?I:void 0);let b=Hs(S.glyph,{seatGlyph:i?.get(S.categoryKey)}),R=S.glyph!==void 0||i?.has(S.categoryKey);h[g]=Gs.indexOf(!R&&s?.has(S.rowId)?"dining":b),d[g]=S.wheelchairSpaceType==="no-seat"?0:1,c[g*3]=S.x*_,c[g*3+1]=n?n.seatDeckY(g):Am(S),c[g*3+2]=S.y*_,l[g]=xs(t?t(S):"available");let P=be(r?.get(S.categoryKey)??"#6e7bff")??[.43,.48,1];if(f[g*3]=P[0],f[g*3+1]=P[1],f[g*3+2]=P[2],S.accessibility?.length){let M=be(go(S.accessibility));M&&(p[g*3]=M[0],p[g*3+1]=M[1],p[g*3+2]=M[2])}y.set(S.id,g)}return{count:a,iPosition:c,iState:l,iCategory:f,iMaxRadius:u,iRing:p,idToIndex:y,iChairWidth:m,iGlyph:h,iPhysicalSeat:d,iArmrests:_m(e,s),iFloor:o??new Float32Array(a),iSection:new Float32Array(a).fill(-1),iYaw:new Float32Array(a)}}var $s=xt(require("earcut"),1);var Cm=.58,Ys=.01,ut=xo*1.5*ct,km=.5,vm=.6;function Om(e,t){let n=e.length,o=[];for(let s=0;s<n;s++){let a=e[Math.max(0,s-1)],c=e[Math.min(n-1,s+1)],l=c.x-a.x,f=c.y-a.y,u=Math.hypot(l,f);if(u<1e-9){o.push([0,0]);continue}l/=u,f/=u,o.push([-f,l])}let r=0;for(let s=0;s<n;s++)r+=(e[s].x-t.x)*o[s][0]+(e[s].y-t.y)*o[s][1];return r<0?o.map(([s,a])=>[-s,-a]):o}function Tm(e,t){if(e.length<2||t<=0)return[...e];let n=[...e],o=(s,a)=>{let c=a.x-s.x,l=a.y-s.y,f=Math.hypot(c,l)||1;return{x:c/f,y:l/f}},r=o(n[1],n[0]),i=o(n[n.length-2],n[n.length-1]);return n.unshift({x:n[0].x+r.x*t,y:n[0].y+r.y*t}),n.push({x:n[n.length-1].x+i.x*t,y:n[n.length-1].y+i.y*t}),n}var zs=Math.PI/12;function Lm(e){if(e.length<3)return[...e];let t=an(e);return t.length>=3?t:[...e]}function Qs(e,t){if(!e.length||!(t>0))return[];let n=Lm(e),o=(a,c,l,f)=>{let u=l-c;for(;u<0;)u+=Math.PI*2;for(;u>Math.PI*2;)u-=Math.PI*2;let m=Math.max(1,Math.ceil(u/zs)),h=t/Math.cos(u/m/2);for(let d=0;d<=m;d++){let p=c+u*d/m;f.push({x:a.x+Math.cos(p)*h,y:a.y+Math.sin(p)*h})}};if(n.length<3){let a=0,c=0;for(let h of n)a+=h.x,c+=h.y;a/=n.length||1,c/=n.length||1;let l=0;for(let h of n)l=Math.max(l,Math.hypot(h.x-a,h.y-c));let f=[],u=Math.max(3,Math.ceil(Math.PI*2/zs)),m=(l+t)/Math.cos(Math.PI/u);for(let h=0;h<u;h++){let d=h/u*Math.PI*2;f.push({x:a+Math.cos(d)*m,y:c+Math.sin(d)*m})}return f}let r=n.length,i=[];for(let a=0;a<r;a++){let c=n[a],l=n[(a+1)%r];i.push(Math.atan2(-(l.x-c.x),l.y-c.y))}let s=[];for(let a=0;a<r;a++)o(n[a],i[(a+r-1)%r],i[a],s);return na(s)}function Bm(e,t,n){if(e.length===1)return Math.hypot(t-e[0].x,n-e[0].y);let o=1/0;for(let r=0;r+1<e.length;r++){let i=e[r],s=e[r+1],a=s.x-i.x,c=s.y-i.y,l=a*a+c*c,f=l>1e-12?((t-i.x)*a+(n-i.y)*c)/l:0;f<0?f=0:f>1&&(f=1);let u=Math.hypot(t-(i.x+f*a),n-(i.y+f*c));u<o&&(o=u)}return o}function Mo(e){let t=e.map(r=>{let i=0,s=0;for(let l of r.pts)i+=l.x,s+=l.y;let a=r.pts.length||1;i/=a,s/=a;let c=0;for(let l of r.pts){let f=Math.hypot(l.x-i,l.y-s);f>c&&(c=f)}return{cx:i,cy:s,rad:c}}),n=r=>{let i=r.length;return i<=2?[...r]:[r[Math.floor(i*.25)],r[Math.floor(i*.5)],r[Math.floor(i*.75)]]},o=[];for(let r=0;r<e.length;r++){let i=n(e[r].pts),s=[],a=1/0,c=null;for(let f of i){let u=1/0;for(let m=0;m<e.length;m++){if(m===r||Math.abs(e[m].y-e[r].y)<.001)continue;let h=t[m],d=Math.hypot(f.x-h.cx,f.y-h.cy)-h.rad;if(d>=u&&d>=a)continue;let p=Bm(e[m].pts,f.x,f.y);p<u&&(u=p),e[m].depth<e[r].depth&&p<a&&(a=p,c=e[m].y)}Number.isFinite(u)&&u>0&&s.push(u)}s.sort((f,u)=>f-u);let l=s.length?s[Math.floor(s.length/2)]:1;o.push({pitch:l,belowY:c})}return o}function qs(e,t,n,o){let r=e[t],i=r.pts.length>=2?[...r.pts]:r.pts.length===1?(()=>{let f=r.pts[0],u=f.x-o.x,m=f.y-o.y,h=Math.hypot(u,m)||1;u/=h,m/=h;let d=Math.max(n[t].pitch,.001)*.5;return[{x:f.x+m*d,y:f.y-u*d},{x:f.x-m*d,y:f.y+u*d}]})():[];if(i.length<2)return null;let s=0,a=0;for(let f=1;f<i.length;f++){let u=Math.hypot(i[f].x-i[f-1].x,i[f].y-i[f-1].y);u>1e-6&&(s+=u,a++)}let c=a>0?s/a:0,l=Tm(i,Math.max(c*vm,ut));return{pts:l,nrm:Om(l,o),front:Math.max(n[t].pitch*Cm,ut),back:Math.max(n[t].pitch*km,ut)}}var cn=1.5,Js=.3;function Cr(e,t){if(e.length<3)return e;let n=e[0],o=e[e.length-1],r=o.x-n.x,i=o.y-n.y,s=Math.hypot(r,i),a=-1,c=-1;for(let u=1;u<e.length-1;u++){let m=e[u],h=s>1e-12?Math.abs((m.x-n.x)*i-(m.y-n.y)*r)/s:Math.hypot(m.x-n.x,m.y-n.y);h>a&&(a=h,c=u)}if(a<=t||c<0)return[n,o];let l=Cr(e.slice(0,c+1),t),f=Cr(e.slice(c),t);return[...l.slice(0,-1),...f]}function ea(e,t){if(e.length<4)return e;let n=Cr([...e,e[0]],t);return n.pop(),n.length>=3?n:e}function Fm(e){let t=e.map((o,r)=>{let i=e[(r+1)%e.length];return{a:o,b:i,i:r,minX:Math.min(o.x,i.x),maxX:Math.max(o.x,i.x),minY:Math.min(o.y,i.y),maxY:Math.max(o.y,i.y)}}).sort((o,r)=>o.minX-r.minX),n=(o,r,i)=>(r.x-o.x)*(i.y-o.y)-(r.y-o.y)*(i.x-o.x);for(let o=0;o<t.length;o++){let r=t[o];for(let i=o+1;i<t.length&&t[i].minX<=r.maxX;i++){let s=t[i];if(!(Math.abs(r.i-s.i)===1||Math.abs(r.i-s.i)===e.length-1||r.maxY<s.minY||s.maxY<r.minY)&&n(r.a,r.b,s.a)*n(r.a,r.b,s.b)<=0&&n(s.a,s.b,r.a)*n(s.a,s.b,r.b)<=0)return!0}}return!1}function ta(e,t,n){if(e.length<2)return[];let o=n??Mo(e),r=new Map;for(let s=0;s<e.length;s++){let a=r.get(e[s].blockId);a?a.push(s):r.set(e[s].blockId,[s])}let i=[];for(let[,s]of r){let a=[];for(let g of s){let S=e[g].patch;S&&S.length>=3?i.push({outline:[...S],holes:[],topY:e[g].y}):a.push(g)}if(!a.length)continue;a.sort((g,S)=>e[g].depth-e[S].depth);let l=a.map(g=>qs(e,g,o,t)).filter(g=>g!==null);if(!l.length)continue;let f=(g,S)=>({x:g.pts[S].x-g.nrm[S][0]*(g.front+cn),y:g.pts[S].y-g.nrm[S][1]*(g.front+cn)}),u=(g,S)=>({x:g.pts[S].x+g.nrm[S][0]*(g.back+cn),y:g.pts[S].y+g.nrm[S][1]*(g.back+cn)}),m=l[0],h=l[l.length-1],d=[];for(let g=0;g<m.pts.length;g++)d.push(f(m,g));for(let g of l)d.push(u(g,g.pts.length-1));for(let g=h.pts.length-1;g>=0;g--)d.push(u(h,g));for(let g=l.length-1;g>=0;g--)d.push(f(l[g],0));let p=na(d),y=1/0;for(let g of a)e[g].y<y&&(y=e[g].y);if(!Number.isFinite(y))continue;if(p.length>=3&&Math.abs(rt(p))>1e-6&&l.every(g=>{let S=g.pts[Math.floor(g.pts.length/2)];return Ve(p,S.x,S.y)})&&!Fm(p)){i.push({outline:ea(p,Js),holes:[],topY:y});continue}for(let g of Nm(l))i.push({outline:g,holes:[],topY:y})}return i}function Nm(e){let t=[];for(let n of e){let o=[],r=[],i=n.front+cn,s=n.back+cn;for(let c=0;c<n.pts.length;c++){let l=n.pts[c],f=n.nrm[c];o.push([l.x-f[0]*i,l.y-f[1]*i]),r.push([l.x+f[0]*s,l.y+f[1]*s])}let a=[...o,...r.reverse()];a.length<3||(a.push(a[0]),t.push([a]))}if(!t.length)return[];try{let n=vr.default.union(t[0],...t.slice(1)),o=[];for(let r of n){if(!r.length||r[0].length<4)continue;let i=r[0].map(([c,l])=>({x:c,y:l})),s=i[0],a=i[i.length-1];i.length>1&&Math.abs(s.x-a.x)<1e-9&&Math.abs(s.y-a.y)<1e-9&&i.pop(),i.length>=3&&o.push(ea(i,Js))}return o}catch{return[]}}function na(e){let t=[];for(let n of e){let o=t[t.length-1];o&&Math.hypot(n.x-o.x,n.y-o.y)<1e-9||t.push(n)}for(;t.length>2&&Math.hypot(t[0].x-t[t.length-1].x,t[0].y-t[t.length-1].y)<1e-9;)t.pop();return t}var kr=class{constructor(t){this.minX=1/0;this.minY=1/0;this.maxX=-1/0;this.maxY=-1/0;this.rings=t;for(let n of t)for(let o of n)o.x<this.minX&&(this.minX=o.x),o.y<this.minY&&(this.minY=o.y),o.x>this.maxX&&(this.maxX=o.x),o.y>this.maxY&&(this.maxY=o.y)}containsAll(t){for(let n of t)if(n.x<this.minX||n.x>this.maxX||n.y<this.minY||n.y>this.maxY)return!1;for(let n of this.rings){let o=!0;for(let r of t)if(!Ve(n,r.x,r.y)){o=!1;break}if(o)return!0}return!1}};function Zs(e,t,n,o,r,i){if(o.length<3)return;if(n.containsAll(o)){let l=[0,1,0],f=o[0];for(let u=1;u+1<o.length;u++){let m=o[u],h=o[u+1];e.tri([f.x*_,r,f.y*_],[m.x*_,r,m.y*_],[h.x*_,r,h.y*_],l,i)}return}let s=o.map(l=>[l.x,l.y]);s.push(s[0]);let a;try{a=vr.default.intersection([s],t)}catch{return}let c=[0,1,0];for(let l of a){if(!l.length||l[0].length<4)continue;let f=l[0],u=[],m=[];for(let d=0;d<f.length-1;d++)u.push(f[d][0],f[d][1]),m.push([f[d][0],f[d][1]]);if(m.length<3)continue;let h=(0,$s.default)(u,void 0,2);for(let d=0;d<h.length;d+=3){let p=m[h[d]],y=m[h[d+1]],x=m[h[d+2]];e.tri([p[0]*_,r,p[1]*_],[y[0]*_,r,y[1]*_],[x[0]*_,r,x[1]*_],c,i)}}}function oa(e,t,n,o,r,i,s){if(t.length<2)return;let a=s??Mo(t),c=[0,1,0],l=i&&i.length>=3?[[...i.map(h=>[h.x,h.y]),[i[0].x,i[0].y]]]:null,f=i&&i.length>=3?new kr([[...i]]):null,u=h=>{e.setMaterial(2),h(),e.setMaterial(0)},m=h=>{e.setMaterial(3),h(),e.setMaterial(0)};for(let h=0;h<t.length;h++){let d=t[h];if(d.patch&&d.patch.length>=3){let I=[...d.patch],b=a[h].belowY??o;if(m(()=>{if(l&&f)Zs(e,l,f,I,d.y,r.tread);else{let R=I[0];for(let P=1;P+1<I.length;P++){let M=I[P],C=I[P+1];e.tri([R.x*_,d.y,R.y*_],[M.x*_,d.y,M.y*_],[C.x*_,d.y,C.y*_],c,r.tread)}}}),d.y>b+Ys){let R=0,P=0;for(let M of I)R+=M.x,P+=M.y;R/=I.length,P/=I.length,u(()=>{for(let M=0;M<I.length;M++){let C=I[M],T=I[(M+1)%I.length],v=T.x-C.x,k=T.y-C.y,E=Math.hypot(v,k);if(E<1e-6)continue;let A=k/E,O=-v/E;(C.x-R)*A+(C.y-P)*O<0&&(A=-A,O=-O);let F=[A,0,O],L=[C.x*_,d.y,C.y*_],B=[T.x*_,d.y,T.y*_],D=[C.x*_,b,C.y*_],j=[T.x*_,b,T.y*_];e.tri(L,B,j,F,r.riser),e.tri(L,j,D,F,r.riser)}})}continue}let p=qs(t,h,a,n);if(!p)continue;let{pts:y,nrm:x,front:g,back:S}=p,w=a[h].belowY??o;for(let I=0;I+1<y.length;I++){let b=y[I],R=y[I+1],P=x[I],M=x[I+1];if(Math.hypot(R.x-b.x,R.y-b.y)<1e-6||P[0]===0&&P[1]===0||M[0]===0&&M[1]===0)continue;let C=[(b.x-P[0]*g)*_,d.y,(b.y-P[1]*g)*_],T=[(R.x-M[0]*g)*_,d.y,(R.y-M[1]*g)*_],v=[(b.x+P[0]*S)*_,d.y,(b.y+P[1]*S)*_],k=[(R.x+M[0]*S)*_,d.y,(R.y+M[1]*S)*_];if(m(()=>{l&&f?Zs(e,l,f,[{x:b.x-P[0]*g,y:b.y-P[1]*g},{x:R.x-M[0]*g,y:R.y-M[1]*g},{x:R.x+M[0]*S,y:R.y+M[1]*S},{x:b.x+P[0]*S,y:b.y+P[1]*S}],d.y,r.tread):(e.tri(C,T,k,c,r.tread),e.tri(C,k,v,c,r.tread))}),d.y>w+Ys){let E=[C[0],w,C[2]],A=[T[0],w,T[2]],O=[-P[0],0,-P[1]];u(()=>{e.tri(C,T,A,O,r.riser),e.tri(C,A,E,O,r.riser)})}}}}function Dm(e,t){let n=e.eventConfigurationIds;return!n?.length||!!t&&n.includes(t)}function ra(e,t){return e.filter(n=>n.type!=="shape"||Dm(n,t))}function ia(e,t){let n=e.focalPoint??{x:0,y:0};return e.floors?.length?e.floors.map((o,r)=>({objects:ra(o.objects,t),focal:{x:(o.focalPoint??n).x,y:(o.focalPoint??n).y},baseHeightM:o.baseHeightM??0,index:r})):[{objects:ra(e.objects,t),focal:n,baseHeightM:0,index:0}]}var Gm={minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};function Ct(e){return ks(e)??Gm}function sa(e,t){let n=It(e.outline,ut),o=Ct(n),r=t.filter(s=>s!==e&&s.outline&&s.outline.length>=3&&sn(o,Ct(s.outline)));if(!r.length)return[n];let i=s=>{let a=s.map(c=>[c.x,c.y]);return a.push(a[0]),a};try{let s=Or.default.difference([i(n)],...r.map(c=>[i(c.outline)])),a=[];for(let c of s){if(!c.length)continue;let l=c[0].map(([f,u])=>({x:f,y:u}));if(l.length>1){let f=l[0],u=l[l.length-1];Math.abs(f.x-u.x)<1e-9&&Math.abs(f.y-u.y)<1e-9&&l.pop()}l.length>=3&&a.push(l)}return a.length?a:[n]}catch{return[n]}}function aa(e,t){if(!t.length)return e;let n=i=>{let s=i.map(a=>[a.x,a.y]);return s.push(s[0]),s},o=t.map(i=>[n(i)]),r=[];for(let i of e){let s;try{s=Or.default.intersection([n(i.outline)],o.flat())}catch{r.push(i);continue}for(let a of s){if(!a.length)continue;let c=a[0].map(([l,f])=>({x:l,y:f}));if(c.length>1){let l=c[0],f=c[c.length-1];Math.abs(l.x-f.x)<1e-9&&Math.abs(l.y-f.y)<1e-9&&c.pop()}c.length>=3&&r.push({outline:c,holes:[],topY:i.topY})}}return r.length?r:e}function Hm(e,t){return e===void 0||t===void 0?!0:Math.abs(e-t)<.001}var So=class{constructor(){this.rings=[];this.boxes=[];this.levels=[]}subtract(t,n){let o=t.map(c=>[c.x,c.y]);if(o.length<3)return[];o.push(o[0]);let r=Ct(t),i=this.rings.filter((c,l)=>sn(r,this.boxes[l])&&Hm(n,this.levels[l])),s=[[o]];if(i.length)try{s=ca.default.difference([o],...i).map(l=>l.map(f=>f.map(([u,m])=>[u,m])))}catch{s=[[o]]}this.rings.push([o]),this.boxes.push(r),this.levels.push(n);let a=[];for(let c of s){if(!c.length)continue;let l=c[0].map(([f,u])=>({x:f,y:u}));if(l.length>1){let f=l[0],u=l[l.length-1];Math.abs(f.x-u.x)<1e-9&&Math.abs(f.y-u.y)<1e-9&&l.pop()}l.length>=3&&a.push(l)}return a}};function ln(e,t,n=e){if(!t)return e;let o=1/0,r=-1/0,i=1/0,s=-1/0;for(let m of n)o=Math.min(o,m.x),r=Math.max(r,m.x),i=Math.min(i,m.y),s=Math.max(s,m.y);let a=(o+r)/2,c=(i+s)/2,l=t*Math.PI/180,f=Math.cos(l),u=Math.sin(l);return e.map(m=>{let h=m.x-a,d=m.y-c;return{x:a+h*f-d*u,y:c+h*u+d*f}})}function la(e){let t=Ni(e);return!t.length||!e.points?.length?[]:t.map(n=>ln(n,e.rotation,e.points))}function he(e){let t=null;if(e.kind==="polygon"&&e.points&&e.points.length>=3)return ln(no(e,4),e.rotation,e.points);if(e.kind==="rect"&&e.width&&e.height&&(t=On(e.x??0,e.y??0,e.width,e.height)),e.kind==="ellipse"&&e.width&&e.height){let n=(e.x??0)+e.width/2,o=(e.y??0)+e.height/2;t=mo(n,o,e.width/2,e.height/2)}return t?ln(t,e.rotation):null}function dt(e){let t=e.role??"",o=t==="stage"?{kind:"stage",heightM:qi(e.stageKind)}:{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}}[t]??{kind:"plate",heightM:.25};return{...o,heightM:e.heightM??o.heightM}}var jm=.08,Vm=30,Um=.015;function Xm(e,t){let n=!1;for(let o=0,r=t.length-1;o<t.length;r=o++){let i=t[o],s=t[r];i.y>e.y!=s.y>e.y&&e.x<(s.x-i.x)*(e.y-i.y)/(s.y-i.y)+i.x&&(n=!n)}return n}function ua(e,t){let n=he(e)??(e.points?.length?ln(e.points,e.rotation):null),o=dt(e),i=!e.role&&o.kind==="plate"&&e.heightM===void 0&&!!n&&Math.abs(rt(n))*re**2>=Vm?Um:o.heightM;if(!n)return{topOffsetM:i,supportOffsetM:0};if(o.kind!=="plate"&&o.kind!=="stage")return{topOffsetM:i,supportOffsetM:0};let s=1/0,a=1/0,c=-1/0,l=-1/0;for(let h of n)s=Math.min(s,h.x),a=Math.min(a,h.y),c=Math.max(c,h.x),l=Math.max(l,h.y);let f=i,u=0,m=1e-6*Math.max(1,c-s,l-a);for(let h of t)c>h.minX&&s<h.maxX&&l>h.minY&&a<h.maxY&&f<=h.topOffsetM+1e-6&&(f=h.topOffsetM+jm),s>=h.minX-m&&c<=h.maxX+m&&a>=h.minY-m&&l<=h.maxY+m&&(!h.poly||n.every(y=>Xm(y,h.poly)||Km(y,h.poly,m)))&&(u=Math.max(u,h.topOffsetM));return e.fill&&e.fill!=="none"&&e.fill!=="transparent"&&t.push({minX:s,minY:a,maxX:c,maxY:l,topOffsetM:f,poly:n}),{topOffsetM:f,supportOffsetM:Math.min(u,f)}}function Km(e,t,n){for(let o=0,r=t.length-1;o<t.length;r=o++){let i=t[r],s=t[o],a=s.x-i.x,c=s.y-i.y,l=a*a+c*c,f=l?Math.max(0,Math.min(1,((e.x-i.x)*a+(e.y-i.y)*c)/l)):0;if(Math.hypot(e.x-(i.x+f*a),e.y-(i.y+f*c))<=n)return!0}return!1}function Nt(e,t,n){return{x:e.x+(t.x-e.x)*n,y:e.y+(t.y-e.y)*n}}function st(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 qe(e,t,n){return[Nt(e[0],e[1],t),Nt(e[0],e[1],n),Nt(e[3],e[2],n),Nt(e[3],e[2],t)]}function Dn(e,t,n){return[Nt(e[0],e[3],t),Nt(e[1],e[2],t),Nt(e[1],e[2],n),Nt(e[0],e[3],n)]}function ye(e,t,n,o,r,i,s){Q(e,t,s?.length?s:void 0,()=>n,o,r,i,z)}var un=12,Wm=1500,Ym=240,zm=.25;function fn(e,t){if(!t.length)return!1;let n=0,o=0,r=0,i=new Set;for(let a of t)n+=a.x,o+=a.y,r+=Math.hypot(a.x-e.x,a.y-e.y),i.add(Math.floor(Math.atan2(a.y-e.y,a.x-e.x)*180/Math.PI/10));let s=Math.hypot(e.x-n/t.length,e.y-o/t.length);return i.size*10>Ym&&s<zm*(r/t.length)}function fa(e,t,n,o){let r=1/0,i=0;for(let s=0;s<e.length;s++){let a=e[s],c=e[(s+1)%e.length],l=c.x-a.x,f=c.y-a.y,u=n*f-o*l;if(Math.abs(u)<1e-12)continue;let m=((a.x-t.x)*f-(a.y-t.y)*l)/u,h=((a.x-t.x)*o-(a.y-t.y)*n)/u;m>0&&h>=0&&h<1&&(i+=1,r=Math.min(r,m))}return i%2===1?r:0}function ma(e,t){let n=e.stageKind??"";if(ot(n)||n==="round"||!t.length)return null;let o=he(e);if(!o||o.length<3)return null;let r={x:o.reduce((b,R)=>b+R.x,0)/o.length,y:o.reduce((b,R)=>b+R.y,0)/o.length},i=0,s=0;for(let b of t)i+=b.x,s+=b.y;let a=r.x-i/t.length,c=r.y-s/t.length,l=Math.hypot(a,c);if(l<1e-6||fn(r,t))return null;let f=a/l,u=c/l,m=-u,h=f,d=-1/0,p=1/0,y=1/0,x=-1/0;for(let b of o){let R=(b.x-r.x)*f+(b.y-r.y)*u,P=(b.x-r.x)*m+(b.y-r.y)*h;d=Math.max(d,R),p=Math.min(p,R),y=Math.min(y,P),x=Math.max(x,P)}let g=(x-y)*_,S=(d-p)*_;if(g<3||S<1.5||g*S>Wm)return null;let w=(b,R)=>({x:r.x+f*b+m*R,y:r.y+u*b+h*R});return{poly:o,centre:r,ux:f,uy:u,vx:m,vy:h,back:d,front:p,left:y,right:x,widthM:g,depthM:S,at:w,box:(b,R,P,M)=>[w(b,P),w(b,M),w(R,M),w(R,P)]}}function pa(e){return e===Ji}var Zm={heightShare:.6,heightMin:4.6,heightMax:10.5,heightFloor:2.6,ceilingClear:.5,pierShare:.075,pierMin:.45,pierMax:1.2,headerShare:.17,headerMin:.7,headerMax:1.6,riseShare:.1,riseMaxShare:.2,moulding:.11,cornice:.14,plinth:.4,fold:.34,foldsMin:10,foldsMax:56,swag:2.2,swagsMin:3,swagsMax:9,dropShare:.11,dropMin:.45,dropMax:1.1,fringe:.1,board:.28,boardsMax:96,boardEdge:.04,boardLift:.02,curtainClear:.12,fringeClear:.18,valanceClear:.24,valanceFringeClear:.3,archClear:.36,mouldingClear:.44},$m=.18,Qm=.2,qm=.02,Jm=2.4,Ro=[.2,.165,.145],ha=[.12,.1,.1],Io=[.5,.055,.075],Po=[.15,.012,.028],eh=[.4,.04,.06],th=[.13,.01,.024],ft=[.8,.6,.24],mt=[.46,.33,.12],wo=[.36,.295,.225],mn=[.2,.165,.13],Tr=[1,.62,.34],nh=[.37,.25,.15],oh=[1,.87,.64];function rh(e){let t=Math.sin(e*12.9898+4.1414)*43758.5453;return t-Math.floor(t)}function da(e,t){let n=[];for(let r=0;r<e.length;r++){let i=e[r],s=e[(r+1)%e.length];i.across>t!=s.across>t&&n.push(i.along+(t-i.across)/(s.across-i.across)*(s.along-i.along))}n.sort((r,i)=>r-i);let o=[];for(let r=0;r+1<n.length;r+=2)o.push([n[r],n[r+1]]);return o}function ba(e,t,n,o={}){let{poly:r,centre:i,ux:s,uy:a,vx:c,vy:l,back:f,front:u,left:m,right:h,widthM:d,at:p,box:y}=t,x=Zm,g=$m/_,S=Qm/_,w=o.maxTopY===void 0?1/0:o.maxTopY-x.ceilingClear-n,I=Math.max(x.heightFloor,Math.min(w,Math.max(x.heightMin,Math.min(x.heightMax,d*x.heightShare)))),b=n+I,R=qm/_,P=f-2*g,M=f-g,C=m+g+S,T=h-g-S;for(let[K,oe]of[[m+g,C],[T,h-g]])Q(e,y(P,M,K,oe),void 0,()=>b,n,Ro,Ro,z);Q(e,y(P,M,C,T),void 0,()=>b,b-.3,Ro,Ro,z),Q(e,y(P+R,M-R,C,T),void 0,()=>n+Math.min(Jm,I-1),n,ha,ha,z);let v=r.map(K=>({along:(K.x-i.x)*s+(K.y-i.y)*a,across:(K.x-i.x)*c+(K.y-i.y)*l})),k=(K,oe)=>[K.x*_,oe,K.y*_],E=[0,1,0],A=n+x.boardLift,O=x.boardEdge/_,F=Math.min(x.boardsMax,Math.max(4,Math.round(d/x.board))),L=h-m-2*O,B=(u+P)/2,D=Math.max(1e-6,(P-u)/2),j=(m+h)/2,H=Math.max(1e-6,(h-m)/2),V=(K,oe,te)=>{let ge=Math.hypot((oe-B)/D,(te-j)/H);return ce(K,oh,.42*Math.pow(Math.max(0,1-ge),1.3))},U=3;for(let K=0;K<F;K++){let oe=m+O+L*K/F,te=m+O+L*(K+1)/F,ge=da(v,oe+L*1e-4),Ie=da(v,te-L*1e-4);if(!ge.length||ge.length!==Ie.length)continue;let Ce=W(nh,.84+.3*rh(K));for(let ke=0;ke<ge.length;ke++){let $e=ge[ke][0]+O,ze=Ie[ke][0]+O,Ze=Math.min(ge[ke][1]-O,P-O),Tt=Math.min(Ie[ke][1]-O,P-O);if(!(Ze<=$e||Tt<=ze))for(let At=0;At<U;At++){let Vt=At/U,Pn=(At+1)/U,to=$e+(Ze-$e)*Vt,Si=$e+(Ze-$e)*Pn,Ri=ze+(Tt-ze)*Vt,Ii=ze+(Tt-ze)*Pn,Pi=k(p(to,oe),A),ql=k(p(Si,oe),A),Jl=k(p(Ri,te),A),wi=k(p(Ii,te),A),_i=V(Ce,to,oe),eu=V(Ce,Si,oe),tu=V(Ce,Ri,te),Ei=V(Ce,Ii,te);e.tri(Pi,Jl,wi,E,_i,tu,Ei),e.tri(Pi,wi,ql,E,_i,Ei,eu)}}}let $=(T-C)*_,X=Math.max(x.pierMin,Math.min(x.pierMax,d*x.pierShare)),Y=m+g+X/_,Z=h-g-X/_,ae=(Z-Y)*_;if(ae<1||$<1)return;let me=Math.max(x.headerMin,Math.min(x.headerMax,I*x.headerShare)),le=I-me,pe=Math.min(ae*x.riseShare,le*x.riseMaxShare),ee=K=>le-pe*(1-Math.sqrt(Math.max(0,1-K*K))),q=[-s,0,-a],ie=(K,oe,te)=>k(p(P-te/_,K),n+oe),ne=(K,oe,te,ge,Ie,Ce,ke,$e,ze,Ze,Tt)=>{let At=ie(oe,ge,K),Vt=ie(te,Ie,K),Pn=ie(te,ke,K),to=ie(oe,Ce,K);e.tri(At,Vt,Pn,q,$e,ze,Tt),e.tri(At,Pn,to,q,$e,Tt,Ze)};e.setMaterial(un);let ue=Math.max(x.foldsMin,Math.min(x.foldsMax,Math.round($/x.fold))),xe=[0,.07,.22,.5,1],Re=(K,oe,te,ge)=>{let Ie=K/(ue*2)*2-1,Ce=W(K%2?te:ge,(1-.3*Ie*Ie)*(1-.42*oe)),ke=Math.pow(1-oe,5)*(1-.5*Ie*Ie);return[Math.min(1,Ce[0]*(1+1.3*ke)+Tr[0]*.06*ke),Math.min(1,Ce[1]*(1+1.3*ke)+Tr[1]*.06*ke),Math.min(1,Ce[2]*(1+1.3*ke)+Tr[2]*.06*ke)]};for(let K=0;K<ue*2;K++){let oe=C+(T-C)*K/(ue*2),te=C+(T-C)*(K+1)/(ue*2);for(let ge=0;ge+1<xe.length;ge++){let Ie=xe[ge],Ce=xe[ge+1];ne(x.curtainClear,oe,te,I*Ie,I*Ie,I*Ce,I*Ce,Re(K,Ie,Io,Po),Re(K+1,Ie,Io,Po),Re(K,Ce,Io,Po),Re(K+1,Ce,Io,Po))}}ne(x.fringeClear,Y,Z,0,0,x.fringe,x.fringe,mt,mt,ft,ft);let _e=Math.max(x.swagsMin,Math.min(x.swagsMax,Math.round(ae/x.swag))),We=Math.max(x.dropMin,Math.min(x.dropMax,I*x.dropShare)),Oe=_e*8,at=K=>{let oe=K/Oe*2-1,te=Math.sin(Math.PI*(K%8/8));return{x:Y+(Z-Y)*K/Oe,low:ee(oe)-We*(.42+.58*te),high:ee(oe)+.2,tone:.55+.45*te}};for(let K=0;K<Oe;K++){let oe=at(K),te=at(K+1),ge=(Ie,Ce)=>W(ce(th,eh,Ie),1-.3*Ce);ne(x.valanceClear,oe.x,te.x,oe.low,te.low,oe.high,te.high,ge(oe.tone,0),ge(te.tone,0),ge(oe.tone,1),ge(te.tone,1)),ne(x.valanceFringeClear,oe.x,te.x,oe.low-x.fringe*.4,te.low-x.fringe*.4,oe.low+x.fringe*.6,te.low+x.fringe*.6,mt,mt,ft,ft)}let je=K=>ce(wo,mn,Math.min(1,K/I)),Ye=m+g,N=h-g;for(let[K,oe]of[[Ye,Y],[Z,N]]){let te=W(wo,.62);ne(x.archClear,K,oe,0,0,x.plinth,x.plinth,te,te,te,te),ne(x.archClear,K,oe,x.plinth,x.plinth,I,I,je(x.plinth),je(x.plinth),je(I),je(I))}let G=28;for(let K=0;K<G;K++){let oe=K/G*2-1,te=(K+1)/G*2-1,ge=Y+(Z-Y)*K/G,Ie=Y+(Z-Y)*(K+1)/G;ne(x.archClear,ge,Ie,ee(oe),ee(te),I,I,je(ee(oe)),je(ee(te)),je(I),je(I)),ne(x.mouldingClear,ge,Ie,ee(oe),ee(te),ee(oe)+x.moulding,ee(te)+x.moulding,ft,ft,mt,mt)}let fe=x.moulding/_;ne(x.mouldingClear,Y-fe,Y,x.plinth,x.plinth,ee(-1)+x.moulding,ee(-1)+x.moulding,mt,ft,mt,ft),ne(x.mouldingClear,Z,Z+fe,x.plinth,x.plinth,ee(1)+x.moulding,ee(1)+x.moulding,ft,mt,ft,mt),ne(x.mouldingClear,Ye,N,I-x.cornice,I-x.cornice,I,I,mt,mt,ft,ft);let Te=[c,0,l],De=(K,oe,te,ge,Ie,Ce,ke,$e,ze)=>{let Ze=ie(ge,Ie,oe),Tt=ie(ge,Ie,te),At=ie(Ce,ke,oe),Vt=ie(Ce,ke,te);e.tri(Ze,At,Vt,K,$e,ze,ze),e.tri(Ze,Vt,Tt,K,$e,ze,$e)},Be=W(wo,.66),Ee=W(mn,.66);De([-Te[0],0,-Te[2]],0,x.archClear,Ye,0,Ye,I,Be,Ee),De(Te,0,x.archClear,N,0,N,I,Be,Ee),De(E,0,x.archClear,Ye,I,N,I,W(mn,.9),W(mn,.9));let Se=W(wo,.8),gt=W(mn,.8);De(Te,x.curtainClear,x.archClear,Y,0,Y,ee(-1),Se,gt),De([-Te[0],0,-Te[2]],x.curtainClear,x.archClear,Z,0,Z,ee(1),Se,gt);let J=W(mn,.62),Ae=[0,-1,0];for(let K=0;K<G;K++){let oe=K/G*2-1,te=(K+1)/G*2-1;De(Ae,x.curtainClear,x.archClear,Y+(Z-Y)*K/G,ee(oe),Y+(Z-Y)*(K+1)/G,ee(te),J,J)}e.setMaterial(0)}var ya=[.13,.14,.17],hn=[.4,.43,.47],ih=.18,sh=.02,ah=2.4,ch=[.055,.06,.075],lh=[.46,.33,.22],uh=[1,.96,.84],fh=[.98,.66,.28],mh=[.5,.31,.15],hh=[1,.87,.64],Ke={lampEvery:1.8,lampsMin:3,lampsMax:14,lampDrop:.45,lampRadius:[.11,.2],poolShare:.44,poolEdge:.9,poolStrength:.5,washByDay:.35,drapeClear:.12,glowClear:.06,coreClear:.12,poolLift:.02};function ga(e,t,n,o,r={}){let i=ma(t,o);if(!i)return null;if(pa(t.stageKind))return ba(e,i,n,r.theatre),"theatre";let{poly:s,ux:a,uy:c,vx:l,vy:f,back:u,front:m,left:h,right:d,widthM:p,depthM:y,at:x,box:g}=i,S=ih/_,w=n+Math.max(3.5,Math.min(8,p*.35)),I=n+Math.min(ah,w-n-1),b=.2/_,R=m+Math.min(y*.25,1.5)/_,P=sh/_;Q(e,g(u-2*S+P,u-S-P,h+S+b,d-S-b),void 0,()=>I,n,ya,ya,z);for(let[q,ie]of[[h+S,h+S+b],[d-S-b,d-S]])Q(e,g(u-2*S,u-S,q,ie),void 0,()=>w+.3,n,hn,hn,z),Q(e,g(R+b,u-2*S,q,ie),void 0,()=>w+.3,w,hn,hn,z);Q(e,g(R,R+b,h+S,d-S),void 0,()=>w+.3,w,hn,hn,z);let M=(q,ie)=>[q.x*_,ie,q.y*_],C=[-a,0,-c],T=h+S+b,v=d-S-b,k=u-2*S-Ke.drapeClear/_,E=w-n,A=r.night===!1?Ke.washByDay:1,O=(q,ie)=>ce(ch,lh,A*(1-q*q)*Math.pow(Math.max(0,1-ie),1.6)),F=(q,ie,ne=0)=>M(x(k-ne/_,(T+v)/2+q*(v-T)/2),n+E*ie);e.setMaterial(un);let L=8,B=5;for(let q=0;q<L;q++)for(let ie=0;ie<B;ie++){let ne=q/L*2-1,ue=(q+1)/L*2-1,xe=ie/B,Re=(ie+1)/B;e.tri(F(ne,xe),F(ue,xe),F(ue,Re),C,O(ne,xe),O(ue,xe),O(ue,Re)),e.tri(F(ne,xe),F(ue,Re),F(ne,Re),C,O(ne,xe),O(ue,Re),O(ne,Re))}let D=Math.max(Ke.lampsMin,Math.min(Ke.lampsMax,Math.round(p/Ke.lampEvery))),j=Math.max(Ke.lampRadius[0],Math.min(Ke.lampRadius[1],p*.012)),H=(v-T)*_,V=1-Ke.lampDrop/E,U=(q,ie,ne,ue,xe)=>{let _e=ie/H*2,We=ie/E;for(let Oe=0;Oe<10;Oe++){let at=2*Math.PI*Oe/10,je=2*Math.PI*(Oe+1)/10,Ye=[Math.cos(at)*_e,Math.sin(at)*We],N=[Math.cos(je)*_e,Math.sin(je)*We];e.tri(F(q,V,ne),F(q+Ye[0],V+Ye[1],ne),F(q+N[0],V+N[1],ne),C,ue,xe(Ye[0],Ye[1]),xe(N[0],N[1]))}};for(let q=0;q<D;q++){let ie=(q+.5)/D*2-1;U(ie,j*3,Ke.glowClear,ce(O(ie,V),mh,.85),(ne,ue)=>O(ie+ne,V+ue)),U(ie,j,Ke.coreClear,uh,()=>fh)}if(e.setMaterial(0),!r.night||!r.deck)return"rig";let $=r.deck,X=x((m+u-2*S)/2,(h+d)/2),Y=n+Ke.poolLift,Z=[0,1,0],ae=[{r:.4,k:.72},{r:.72,k:.28},{r:1,k:0}],me=28,le=[];for(let q=0;q<me;q++){let ie=2*Math.PI*q/me,ne=Math.cos(ie)*(u-2*S-m)*Ke.poolShare,ue=Math.sin(ie)*(d-h)*Ke.poolShare,xe=Math.hypot(ne,ue),Re=(a*ne+l*ue)/xe,_e=(c*ne+f*ue)/xe;le.push(Math.min(xe,fa(s,X,Re,_e)*Ke.poolEdge))}if(le.some(q=>!(q>0)))return"rig";let pe=(q,ie)=>{let ne=2*Math.PI*(q%me)/me,ue=Math.cos(ne)*(u-2*S-m)*Ke.poolShare,xe=Math.sin(ne)*(d-h)*Ke.poolShare,Re=Math.hypot(ue,xe),_e=le[q%me]*ie/Re;return M({x:X.x+(a*ue+l*xe)*_e,y:X.y+(c*ue+f*xe)*_e},Y)},ee=q=>ce($,hh,Ke.poolStrength*q);for(let q=0;q<me;q++){e.tri(M(X,Y),pe(q,ae[0].r),pe(q+1,ae[0].r),Z,ee(1),ee(ae[0].k),ee(ae[0].k));for(let ie=0;ie+1<ae.length;ie++){let ne=ae[ie],ue=ae[ie+1];e.tri(pe(q,ne.r),pe(q,ue.r),pe(q+1,ue.r),Z,ee(ne.k),ee(ue.k),ee(ue.k)),e.tri(pe(q,ne.r),pe(q+1,ue.r),pe(q+1,ne.r),Z,ee(ne.k),ee(ue.k),ee(ne.k))}}return"rig"}function xa(e,t){let n={openField:!1,openAir:!1,court:!1,indoorCourt:!1,inTheRound:!1,stage:!1,standing:0,seatCount:t.length};for(let o of e)for(let r of o.objects){if(r.type==="gaArea"&&(n.standing+=r.capacity),r.type!=="shape")continue;let i=r.stageKind;if(ro(i)){n.openField=!0;continue}if(tn(i)&&(n.openAir=!0),ot(i)){n.court=!0,Qi(i)&&(n.indoorCourt=!0);continue}if(r.role!=="stage")continue;if(n.stage=!0,i==="round"){n.inTheRound=!0;continue}let s=he(r);if(!s||s.length<3)continue;let a={x:s.reduce((c,l)=>c+l.x,0)/s.length,y:s.reduce((c,l)=>c+l.y,0)/s.length};fn(a,t)&&(n.inTheRound=!0)}return n}var Pa=10,zt=11,dn=[.93,.94,.95],dh=[.93,.8,.22],ph=[.82,.14,.16],bh=[.78,.1,.12],Lr=[.74,.77,.8],Br={width:7.32,height:2.44,depth:2},_o={width:1.83,height:1.22,depth:1,fromEndBoards:3.35},yh=1.5,gh=1.8,Fr=2.4,Je=(e,t)=>[e[0]-t[0],e[1]-t[1],e[2]-t[2]],Hn=(e,t)=>[e[1]*t[2]-e[2]*t[1],e[2]*t[0]-e[0]*t[2],e[0]*t[1]-e[1]*t[0]],kt=e=>{let t=Math.hypot(e[0],e[1],e[2])||1;return[e[0]/t,e[1]/t,e[2]/t]};function ht(e,t,n,o,r){let i=kt(Je(n,t)),s=kt(Hn(i,Math.abs(i[1])<.9?[0,1,0]:[1,0,0])),a=Hn(s,i),c=(l,f)=>{let u=f===0||f===3?-o:o,m=f<2?-o:o;return[l[0]+s[0]*u+a[0]*m,l[1]+s[1]*u+a[1]*m,l[2]+s[2]*u+a[2]*m]};for(let l=0;l<4;l++){let f=(l+1)%4,u=c(t,l),m=c(t,f),h=c(n,l),d=c(n,f),p=kt(Hn(Je(m,u),Je(h,u))),y=Je([(u[0]+m[0])/2,(u[1]+m[1])/2,(u[2]+m[2])/2],t);p[0]*y[0]+p[1]*y[1]+p[2]*y[2]<0&&(p=[-p[0],-p[1],-p[2]]);let x=W(r,.86+.14*Math.max(0,p[1]));e.tri(u,m,d,p,x),e.tri(u,d,h,p,x)}}function Gn(e,t,n,o,r){let i=Math.hypot(...Je(n,t)),s=Math.hypot(...Je(r,t)),a=kt(Hn(Je(n,t),Je(r,t)));e.tri(t,n,o,a,[0,0,0],[i,0,0],[i,s,0]),e.tri(t,o,r,a,[0,0,0],[i,s,0],[0,s,0])}function Dr(e,t,n,o,r,i,s,a,c){let l=(g,S)=>[g[0],g[1]+S,g[2]],f=g=>[g[0]+o[0]*i,g[1],g[2]+o[2]*i],u=l(t,r),m=l(n,r),h=f(t),d=f(n),p=f(u),y=f(m);e.setMaterial(c),ht(e,t,u,s,a),ht(e,n,m,s,a),ht(e,u,m,s,a),e.setMaterial(zt);let x=Math.min(s,.03);for(let[g,S]of[[h,p],[d,y],[u,p],[m,y],[p,y],[t,h],[n,d],[h,d]])ht(e,g,S,x,W(a,.92));e.setMaterial(Pa),Gn(e,h,d,y,p),Gn(e,u,m,y,p),Gn(e,t,h,p,u),Gn(e,n,d,y,m),e.setMaterial(0)}var Nr={height:.711,width:.2286,pitchLength:20.12},xh=[.88,.8,.6];function wa(e,t,n){if(t.length!==4)return;let o=s=>Math.hypot(t[(s+1)%4].x-t[s].x,t[(s+1)%4].y-t[s].y),r=o(0)<=o(1)?0:1,i=Math.max(o(0),o(1))*_/Nr.pitchLength;if(i>.2){e.setMaterial(zt);for(let s of[r,r+2]){let a=t[s%4],c=t[(s+1)%4],l=o(s%4)||1,f={x:(a.x+c.x)/2,y:(a.y+c.y)/2},u=(c.x-a.x)/l,m=(c.y-a.y)/l;for(let h of[-1,0,1]){let d=h*Nr.width*i/2/_,p=ve({x:f.x+u*d,y:f.y+m*d},n);ht(e,p,[p[0],p[1]+Nr.height*i,p[2]],.019*i,xh)}}e.setMaterial(0)}}var ve=(e,t)=>[e.x*_,t,e.y*_];function _a(e){if(e.length<3)return null;let t=0,n=0;for(let x of e)t+=x.x,n+=x.y;t/=e.length,n/=e.length;let o=0,r=0,i=0;for(let x of e){let g=x.x-t,S=x.y-n;o+=g*g,r+=S*S,i+=g*S}let s=.5*Math.atan2(2*i,o-r),a=Math.cos(s),c=Math.sin(s),l=1/0,f=-1/0,u=1/0,m=-1/0;for(let x of e){let g=(x.x-t)*a+(x.y-n)*c,S=-(x.x-t)*c+(x.y-n)*a;l=Math.min(l,g),f=Math.max(f,g),u=Math.min(u,S),m=Math.max(m,S)}let h=(f-l)*_,d=(m-u)*_;if(!(h>4)||!(d>2))return null;let p={a:(l+f)/2,b:(u+m)/2};return{at:(x,g)=>{let S=p.a+x/_,w=p.b+g/_;return{x:t+a*S-c*w,y:n+c*S+a*w}},lengthM:h,widthM:d}}function Ea(e,t,n,o,r,i){let s=t.map(c=>ve(c,n)),a=t.map(c=>ve(c,n+o));e.setMaterial(0);for(let c=0;c<t.length;c++)ht(e,s[c],a[c],r,i);e.setMaterial(zt);for(let c=0;c+1<t.length;c++)ht(e,a[c],a[c+1],.025,i);e.setMaterial(Pa);for(let c=0;c+1<t.length;c++)Gn(e,s[c],s[c+1],a[c+1],a[c]);e.setMaterial(0)}var Ma=[.66,.29,.22],Mh=[.87,.79,.58],Sa=[.17,.36,.63],Aa=[.56,.59,.63],Sh=[.7,.7,.68],Rh={length:176.9,trackWidth:9.76,longJump:{runway:40,runwayWidth:1.22,pit:9,pitWidth:2.75,fromKerb:3,start:-25},highJump:{matLength:3,matWidth:5,matHeight:.7,apron:15,intoBend:3.5,bar:2},cage:{radius:3.5,height:7,intoBend:10,pad:1.07,sectorDeg:34.92,sector:60,openDeg:120}};function Ca(e,t,n){let o=_a(t);if(!o)return;let{at:r,lengthM:i,widthM:s}=o,a=Rh,c=Math.min(1.2,Math.max(.5,i/a.length)),l=s/2,f=i/2-l,u=l-a.trackWidth;if(!(f>30*c)||!(u>22*c))return;let m=n+.03,h=(v,k,E=0)=>{Q(e,v,void 0,()=>m+E,m+E-.004,k,k,z)},d=(v,k,E,A)=>[r(v,E),r(k,E),r(k,A),r(v,A)];e.setMaterial(0),h(d(f-.08,f+.08,-l+.2,-u-.2),dn);let p=a.longJump,y=u-p.fromKerb*c,x=(p.start+p.runway)*c;h(d(p.start*c,x,y-p.runwayWidth*c/2,y+p.runwayWidth*c/2),Ma),h(d(x,x+p.pit*c,y-p.pitWidth*c/2,y+p.pitWidth*c/2),Mh);let g=a.highJump,S=-(f+g.intoBend*c),w=[];for(let v=0;v<=16;v++){let k=-Math.PI/2+Math.PI*v/16;w.push(r(S-.3*c+Math.cos(k)*g.apron*c,Math.sin(k)*g.apron*c))}h(w,Ma),Q(e,d(S-g.matLength*c,S,-(g.matWidth*c)/2,g.matWidth*c/2),void 0,()=>n+g.matHeight*c,n,Sa,W(Sa,.82),z),e.setMaterial(zt);let I=[-1,1].map(v=>r(S+.25*c,v*(g.bar+.1)*c));for(let v of I)ht(e,ve(v,n),ve(v,n+(g.bar+.3)*c),.02,dn);ht(e,ve(I[0],n+g.bar*c),ve(I[1],n+g.bar*c),.015,dn),e.setMaterial(0);let b=a.cage,R=f+b.intoBend*c;h(((v,k)=>Array.from({length:k},(E,A)=>{let O=2*Math.PI*A/k;return r(R+Math.cos(O)*v,Math.sin(O)*v)}))(b.pad*c,16),Sh);let M=b.sectorDeg/2*Math.PI/180;for(let v of[-1,1]){let k=b.sector*c,E=-Math.cos(M),A=v*Math.sin(M);h([r(R+A*.15,-E*.15),r(R+E*k+A*.15,A*k-E*.15),r(R+E*k-A*.15,A*k+E*.15),r(R-A*.15,E*.15)],dn,.006)}let C=b.openDeg/2*Math.PI/180,T=[];for(let v=0;v<=6;v++){let k=C+(2*Math.PI-2*C)*v/6;T.push(r(R-Math.cos(k)*b.radius*c,Math.sin(k)*b.radius*c))}Ea(e,T,n,b.height*c,.05,Aa)}var Ih=[.95,.8,.16],Ra=[.13,.17,.2],Ia=[.78,.8,.83],Ph={backY:70,backHalf:25,pole:{x:70,y:-18},net:{height:9,inset:.5,wing:15},poleHeight:12,dugout:{length:18,depth:2.4,height:1,along:.32,inset:1.9}};function ka(e,t,n,o,r,i){let s=Ph,a={x:s.pole.x-s.backHalf,y:s.pole.y-s.backY},c=Math.hypot(a.x,a.y),l=a.x/c,f=a.y/c,u=(S,w,I)=>t(S*(s.backHalf+l*w+f*I),s.backY+f*w-l*I),m=s.net,h=s.backY-m.inset,d=s.backHalf-m.inset,p=[u(-1,m.wing,m.inset)];for(let S of[-d,-d/2,d/2,d])p.push(t(S,h));p.push(u(1,m.wing,m.inset)),Ea(e,p,n,m.height*o,.05,Aa),e.setMaterial(0);for(let S of[-1,1]){let w=ve(t(S*(s.pole.x-.4),s.pole.y+.4),n);ht(e,w,[w[0],w[1]+s.poleHeight*o,w[2]],.09,Ih)}if(!i)return;let y=s.dugout,x=y.along*c-y.length/2,g=x+y.length;for(let S of[-1,1]){let w=[u(S,x,y.inset-y.depth/2),u(S,g,y.inset-y.depth/2)],I=[u(S,x,y.inset+y.depth/2),u(S,g,y.inset+y.depth/2)],b=Math.ceil(y.length),R=!0;for(let T=0;R&&T<=b;T++){let v=T/b;R=r({x:w[0].x+(w[1].x-w[0].x)*v,y:w[0].y+(w[1].y-w[0].y)*v})}if(!R)continue;let P=[w[0],w[1],I[1],I[0]];Q(e,P,void 0,()=>n+(y.height-.1)*o,n,Ra,W(Ra,.85),z);let M=(T,v)=>({x:T.x+(T.x-v.x)*.04,y:T.y+(T.y-v.y)*.04}),C=[M(w[0],I[1]),M(w[1],I[0]),M(I[1],w[0]),M(I[0],w[1])];Q(e,C,void 0,()=>n+y.height*o,n+(y.height-.14)*o,Ia,W(Ia,.9),z)}}function va(e,t,n,o,r,i){let s=t.lengthM/2,a=t.widthM/2;if(i){let c=Br.width/2*o,l=Br.depth*o;for(let f of[-1,1]){let u=t.at(f*(s+l),-c),m=t.at(f*(s+l),c);if(!r(u)||!r(m))continue;let h=ve(t.at(f*s,-c),n),d=ve(t.at(f*s,c),n),p=ve(t.at(f*(s+1),0),n),y=ve(t.at(f*s,0),n);Dr(e,h,d,kt(Je(p,y)),Br.height*o,l,.06,dn,0)}}e.setMaterial(zt);for(let c of[-1,1])for(let l of[-1,1]){if(!r(t.at(c*s,l*a)))continue;let f=ve(t.at(c*s,l*a),n),u=[f[0],f[1]+yh*o,f[2]];ht(e,f,u,.02,dh);let m=kt(Je(ve(t.at(c*(s+1),l*(a+1)),n),f)),h=[u[0]+m[0]*.4*o,u[1]-.14*o,u[2]+m[2]*.4*o],d=[u[0],u[1]-.28*o,u[2]];e.tri(u,h,d,kt(Hn(Je(h,u),Je(d,u))),ph)}e.setMaterial(0)}function Oa(e,t,n,o,r){let i=_a(t);if(!i)return;let{at:s,lengthM:a}=i,c=Math.min(1.2,Math.max(.5,a/60)),l=a/2-_o.fromEndBoards*c,f=_o.width/2*c;for(let y of[-1,1]){let x=ve(s(y*l,-f),n),g=ve(s(y*l,f),n),S=ve(s(y*(l+1),0),n),w=ve(s(y*l,0),n);Dr(e,x,g,kt(Je(S,w)),_o.height*c,_o.depth*c,.03,bh,zt)}let u=lt(t,r/2/_);if(u.length<3)return;let m=o+gh;e.setMaterial(zt);let h=Fr;for(let y=0;y<u.length;y++){let x=u[y],g=u[(y+1)%u.length],S=Math.hypot(g.x-x.x,g.y-x.y)*_,w=0;for(;h+(S-w)>=Fr;){w+=Fr-h,h=0;let I=S>0?w/S:0,b={x:x.x+(g.x-x.x)*I,y:x.y+(g.y-x.y)*I};ht(e,ve(b,o),ve(b,m),.025,Lr)}h+=S-w}let d=lt(t,(r/2-.03)/_),p=lt(t,(r/2+.03)/_);d.length>=3&&p.length>=3&&Q(e,d,[p.slice().reverse()],()=>m,m-.05,Lr,W(Lr,.9),z),e.setMaterial(0)}function Ta(e,t,n,o,r){if(t.length!==4||!(r-o>.2))return;let i=(d,p)=>({x:(d.x+p.x)/2,y:(d.y+p.y)/2}),s=d=>Math.hypot(d.x-n.x,d.y-n.y),a=s(i(t[0],t[1]))<=s(i(t[3],t[2])),[c,l,f]=a?[t[0],t[1],t[3]]:[t[3],t[2],t[0]],u=Math.hypot(f.x-c.x,f.y-c.y)*_;if(!(u>.05))return;let m=ve(c,o),h=ve(l,o);Dr(e,m,h,kt(Je(ve(f,o),m)),r-o,u,.06,dn,0)}var wh=[.12,.38,.16],_h=[.72,.62,.45],Eh=[.88,.93,.96],La=[.95,.95,.94],Ah=[.66,.29,.22],Gr={length:20.12,width:3.05},Ch=.14,kh=9.76,pt=[.93,.94,.95],Eo=[.1,.11,.13],vh=[.45,.85,1.25],Oh=1.45,Ba=.012,Fa=.004,Na=1.07,Ao=.15,Da=[.93,.76,.18],Hr={height:.2,proud:.02,buried:.03};function Zt(e,t,n,o,r,i){e.setMaterial(i),Q(e,t,n?[n.slice().reverse()]:void 0,()=>o,o-.004,r,r,z)}var pn=(e,t)=>lt(e,t/_);function Ha(e,t,n){let o=t.x-e.x,r=t.y-e.y,i=Math.hypot(o,r);if(i<1e-9)return null;let s=-r/i*n,a=o/i*n;return[{x:e.x+s,y:e.y+a},{x:t.x+s,y:t.y+a},{x:t.x-s,y:t.y-a},{x:e.x-s,y:e.y-a}]}function Th(e,t,n,o){let r=t.map(i=>[i.x*_,n,i.y*_]);e.tri(r[0],r[1],r[2],[0,1,0],o),e.tri(r[0],r[2],r[3],[0,1,0],o)}function bn(e,t,n,o,r,i){let s=n/_,a=[{x:t.x-s,y:t.y-s},{x:t.x+s,y:t.y-s},{x:t.x+s,y:t.y+s},{x:t.x-s,y:t.y+s}];Q(e,a,void 0,()=>r,o,i,W(i,.85),z)}function et(e,t,n,o,r,i,s){let a=Ha(t,n,o/_);a&&Q(e,a,void 0,()=>i,r,s,W(s,.85),z)}function Xn(e){let t=st(e),n={x:(t[0].x+t[2].x)/2,y:(t[0].y+t[2].y)/2},o=Math.hypot(t[1].x-t[0].x,t[1].y-t[0].y)||1,r=Math.hypot(t[3].x-t[0].x,t[3].y-t[0].y)||1,i={x:(t[1].x-t[0].x)/o,y:(t[1].y-t[0].y)/o},s={x:(t[3].x-t[0].x)/r,y:(t[3].y-t[0].y)/r};return{at:(c,l)=>({x:n.x+(i.x*c+s.x*l)/_,y:n.y+(i.y*c+s.y*l)/_}),lengthM:o*_,widthM:r*_}}function jr(e){let t=1/0,n=-1/0,o=1/0,r=-1/0;for(let m of e.points??[])t=Math.min(t,m.x),n=Math.max(n,m.x),o=Math.min(o,m.y),r=Math.max(r,m.y);let i=(e.rotation??0)*Math.PI/180,s=Math.cos(i),a=Math.sin(i),c=(t+n)/2,l=(o+r)/2,f=m=>i?{x:c+(m.x-c)*s-(m.y-l)*a,y:l+(m.x-c)*a+(m.y-l)*s}:m,u=(m,h,d,p)=>f({x:c+m/d*(n-t),y:l+h/p*(r-o)});return{turn:f,shortSideM:Math.min(n-t,r-o)*_,local:u,widthU:n-t}}function Lh(e){let t=lr(e).find(n=>n.closed&&!n.fill&&n.points.length===4);return t?t.points.map(jr(e).turn):null}function ja(e,t,n){let o=lr(t);if(!o.length)return;let{turn:r,shortSideM:i}=jr(t),s=Math.max(.04,Math.min(.3,i*.004))/_,a=0;e.setMaterial(0);for(let f of o){if(!f.fill)continue;let u=f.points.map(r);Zt(e,u,null,n+Ba+a*Fa,be(f.fill)??pt,0),a++}let c=o.filter(f=>!(f.fill&&f.ink===f.fill)),l=[...new Set(c.map(f=>f.ink??io))];for(let f of l){let u=n+Ba+a++*Fa,m=be(f)??pt;for(let h of c){if((h.ink??io)!==f)continue;let d=h.points.map(r),p=h.closed?d.length:d.length-1;for(let y=0;y<p;y++){let x=Ha(d[y],d[(y+1)%d.length],s);x&&Th(e,x,u,m)}}}}function Va(e,t,n,o,r,i){if(t.length<3)return!1;let s=o+.006,a=r??wh;if(n==="oval-cricket"){let c=t.reduce((b,R)=>b+R.x,0)/t.length,l=t.reduce((b,R)=>b+R.y,0)/t.length,f=b=>t.map(R=>({x:c+(R.x-c)*b,y:l+(R.y-l)*b})),u=8;for(let b=0;b<u;b++){let R=f(1-b/u),P=b===u-1?null:f(1-(b+1)/u);Zt(e,R,P,s,W(a,b%2?1.04:.96),4)}let m=t[0];for(let b of t)Math.hypot(b.x-c,b.y-l)>Math.hypot(m.x-c,m.y-l)&&(m=b);let h=Math.hypot(m.x-c,m.y-l)||1,d=(m.x-c)/h,p=(m.y-l)/h,y=-p,x=d,g=Math.min(1,2*h*_*Ch/Gr.length),S=Gr.length*g/2/_,w=Gr.width*g/2/_,I=(i&&Lh(i))??[[-S,-w],[S,-w],[S,w],[-S,w]].map(([b,R])=>({x:c+d*b+y*R,y:l+p*b+x*R}));return Zt(e,I,null,s+.004,_h,0),wa(e,I,s+.004),e.setMaterial(0),!0}if(n==="rink-hockey"){let c=pn(t,Ao);Zt(e,c,null,s,Eh,0),e.setMaterial(0),Q(e,t,[c.slice().reverse()],()=>o+Na,o,La,W(La,.9),z);let l=pn(t,Ao-Hr.buried),f=pn(t,Ao+Hr.proud);return l.length>=3&&f.length>=3&&Q(e,l,[f.slice().reverse()],()=>o+Hr.height,o,Da,W(Da,.92),z),Oa(e,t,s,o+Na,Ao),!0}if(n==="ring-boxing"&&t.length===4){let{at:c}=Xn(t),l=[c(-3.05,-3.05),c(3.05,-3.05),c(3.05,3.05),c(-3.05,3.05)],f=[[.77,.19,.19],pt,[.17,.42,.69],pt];e.setMaterial(0),l.forEach((u,m)=>bn(e,u,.07,o,o+Oh,f[m]));for(let u of vh)for(let m=0;m<4;m++)et(e,l[m],l[(m+1)%4],.025,o+u-.025,o+u+.025,pt);return!0}if(n==="court-tennis"&&t.length===4){let{at:c}=Xn(t);e.setMaterial(0),et(e,c(0,-6.4),c(0,6.4),.015,o,o+.95,Eo),et(e,c(0,-6.4),c(0,6.4),.03,o+.95,o+1,pt);for(let l of[-1,1])bn(e,c(0,l*6.4),.05,o,o+1.07,Eo);return!0}if(n==="court-basketball"&&t.length===4){let{at:c,lengthM:l}=Xn(t),f=Math.min(14,l/2-.5);e.setMaterial(0);for(let u of[-1,1]){let m=c(u*(f+1.2),0),h=c(u*(f-1.2),0);bn(e,m,.12,o,o+3.4,Eo),et(e,m,h,.06,o+3.25,o+3.4,Eo),et(e,c(u*(f-1.2),-.9),c(u*(f-1.2),.9),.03,o+2.9,o+3.95,pt)}return!0}if(n==="pitch-rugby"&&t.length===4){let{at:c,lengthM:l}=Xn(t),f=l*(50/120);e.setMaterial(0);for(let u of[-1,1]){for(let m of[-2.8,2.8])bn(e,c(u*f,m),.07,o,o+12,pt);et(e,c(u*f,-2.8),c(u*f,2.8),.06,o+2.94,o+3.06,pt)}return!0}if(n==="track-athletics"){let c=pn(t,kh);return c.length<3?!1:(Zt(e,t,c,s,Ah,0),Zt(e,c,null,s,a,4),e.setMaterial(0),Ca(e,t,o),!0)}return!1}var jn=140,Ga=1.6,Vn=[.9,.91,.93],Co=[.15,.19,.3],Un=[.14,.15,.18],Bh=[.1,.24,.18],ko=.9,Fh=6,Nh={"pitch-football":105,"pitch-rugby":120,"court-tennis":23.77,"court-basketball":32},Dh={sidelineShare:15/19,fromSideline:1.35,tableHalfLength:4.5,tableHalfDepth:.38,tableHeight:.76,benchFrom:6,benchTo:12.5,benchHalfDepth:.25,benchHeight:.45,benchBackHeight:.85},Gh=[.13,.15,.2],Hh=[.82,.84,.87];function Ua(e,t,n,o,r,i=!1,s=!1){let a=t.stageKind;if(!a||n.length<3)return;if(e.setMaterial(0),a==="diamond-baseball"){let{local:M,widthU:C}=jr(t);if(!(C>0))return;let T=M(0,0,jn,jn),v=r.filter(E=>Math.hypot(E.x-T.x,E.y-T.y)<=C),k=Math.min(1.2,Math.max(.5,C*_/jn));ka(e,(E,A)=>M(E,A,jn,jn),o,k,E=>v.every(A=>Math.hypot(A.x-E.x,A.y-E.y)*_>=Ga),!s),e.setMaterial(0);return}if(a==="oval-cricket"){let M=pn(n,2.85),C=pn(n,3.1);M.length>=3&&C.length>=3&&Zt(e,M,C,o+.03,pt,0),e.setMaterial(0);return}let c=Nh[a];if(!c||n.length!==4)return;let{at:l,lengthM:f,widthM:u}=Xn(n),m=Math.min(1.2,Math.max(.5,f/c)),h=f/2,d=u/2,p=Math.max(h,d)+14,y=l(0,0),x=r.filter(M=>Math.hypot(M.x-y.x,M.y-y.y)*_<p),g=M=>x.every(C=>Math.hypot(C.x-M.x,C.y-M.y)*_>=Ga),S=(M,C)=>{let T=Math.max(1,Math.ceil(Math.hypot(C.x-M.x,C.y-M.y)*_));for(let v=0;v<=T;v++)if(!g({x:M.x+(C.x-M.x)*(v/T),y:M.y+(C.y-M.y)*(v/T)}))return!1;return!0},w=(M,C,T,v,k)=>{let E=Math.hypot(C[0]-M[0],C[1]-M[1]),A=Math.max(1,Math.round(E/Fh));for(let O=0;O<A;O++){let F=O/A+.012,L=(O+1)/A-.012,B=l(M[0]+(C[0]-M[0])*F,M[1]+(C[1]-M[1])*F),D=l(M[0]+(C[0]-M[0])*L,M[1]+(C[1]-M[1])*L);S(B,D)&&et(e,B,D,.06,o,o+k,v&&O%2?v:T)}};if(a==="court-basketball"){let M=Dh;for(let C of[-1,1]){let T=C*(d*M.sidelineShare+M.fromSideline*m),v=T+C*M.tableHalfDepth*m,k=(F,L)=>S(l(F,T),l(L,T))&&S(l(F,v),l(L,v)),E=M.tableHalfLength*m;if(!k(-E,E))continue;let A=l(-E,T),O=l(E,T);et(e,A,O,M.tableHalfDepth*m,o,o+M.tableHeight-.04,Gh),et(e,A,O,M.tableHalfDepth*m+.04,o+M.tableHeight-.06,o+M.tableHeight,Hh);for(let F of[-1,1]){let L=F*M.benchFrom*m,B=F*M.benchTo*m;if(!k(L,B))continue;et(e,l(L,T),l(B,T),M.benchHalfDepth,o,o+M.benchHeight,Un);let D=T+C*(M.benchHalfDepth+.04);et(e,l(L,D),l(B,D),.03,o,o+M.benchBackHeight,Un)}break}return}if(a==="court-tennis"){let M=h+6.4*m,C=d+3.66*m;for(let v of[-1,1])w([v*M,-C],[v*M,C],Bh,null,1);let T=l(0,d+1.2*m);g(T)&&(bn(e,T,.3,o,o+1.5,Un),bn(e,T,.36,o+1.5,o+1.62,pt));return}va(e,{at:l,lengthM:f,widthM:u},o,m,g,a==="pitch-football"&&!i);let I=d+3.2*m,b=h+4*m,R=3*m,P=15*m;w([-h+R,I],[h-R,I],Vn,Co,ko),w([-h+R,-I],[-P,-I],Vn,Co,ko),w([P,-I],[h-R,-I],Vn,Co,ko);for(let M of[-1,1])w([M*b,-d+R],[M*b,d-R],Vn,Co,ko);for(let M of s?[]:[-1,1]){let C=M*2.5*m,T=M*10.5*m,v=-(d+4.4*m),k=l(C,v),E=l(T,v);!S(k,E)||!S(l(C,v-.75*m),l(T,v-.75*m))||(et(e,k,E,.35,o,o+.45,Un),et(e,l(C,v-.75*m),l(T,v-.75*m),.05,o,o+1.9,Un),et(e,l(C,v-.2*m),l(T,v-.2*m),.62,o+1.9,o+1.98,Vn))}}var Dt=72,jh=1.2,Vh=5,Uh=30,Xh=4;function Kh(e,t,n,o){let r=0;for(let i=0;i<e.length;i++){let s=e[i],a=e[(i+1)%e.length],c=a.x-s.x,l=a.y-s.y,f=n*l-o*c;if(Math.abs(f)<1e-12)continue;let u=((s.x-t.x)*l-(s.y-t.y)*c)/f,m=((s.x-t.x)*o-(s.y-t.y)*n)/f;u>r&&m>=-1e-9&&m<=1+1e-9&&(r=u)}return r}function Wh(e,t){if(e.length<3)return null;let n={x:e.reduce((a,c)=>a+c.x,0)/e.length,y:e.reduce((a,c)=>a+c.y,0)/e.length},o=2*Math.PI/Dt,r=new Float64Array(Dt);for(let a=0;a<Dt;a++)if(r[a]=Kh(e,n,Math.cos(a*o),Math.sin(a*o)),!(r[a]>0))return null;let i=new Float64Array(Dt).fill(1/0);for(let a of t){let c=a.x-n.x,l=a.y-n.y,f=Math.hypot(c,l),u=(Math.round(Math.atan2(l,c)/o)%Dt+Dt)%Dt;f>r[u]&&f<i[u]&&(i[u]=f)}let s=[];for(let a=0;a<Dt;a++){let l=Number.isFinite(i[a])&&i[a]-r[a]<=Uh/_?i[a]+jh/_:r[a]+Vh/_;s.push({x:n.x+Math.cos(a*o)*l,y:n.y+Math.sin(a*o)*l})}return s}function Yh(e){return ce(W(e,.84),[.33,.36,.31],.22)}function Xa(e,t,n,o,r){let i=Wh(t,o);if(!i)return;let s=n-.015;e.setMaterial(Xh);let a=Yh(r);Q(e,i,void 0,()=>s,s-.004,a,a,z),e.setMaterial(0)}function Ka(e){let t=1/0,n=1/0,o=-1/0,r=-1/0;for(let i of e)t=Math.min(t,i.x),o=Math.max(o,i.x),n=Math.min(n,i.y),r=Math.max(r,i.y);return{x:(t+o)/2,y:(n+r)/2}}function zh(e,t){let n=Ka(e),o=Ka(t);return Ve(t,n.x,n.y)||Ve(e,o.x,o.y)}function vo(e){let t=new Set;if(e.length<2)return t;let n=[...e].sort((r,i)=>r.baseHeightM-i.baseHeightM||r.index-i.index),o=[];for(let r of n){let i=[];for(let s of r.objects){if(s.type!=="shape"||s.role!=="stage")continue;let a=he(s);!a||a.length<3||(o.some(c=>zh(a,c))?t.add(s):i.push(a))}o.push(...i)}return t}var Oo=["#e69f00","#56b4e9","#009e73","#f0e442","#0072b2","#d55e00","#cc79a7"],Wa="#a4508b";var B1={facilities:Wa,"food-drink":Oo[5],navigation:Oo[2],accessibility:Oo[4]};var F1={minDiameterPx:12,glyphScale:.66,ringRatio:1/14,largeFromPx:24};var Le=e=>{let t=Math.round(e*100)/100;return Object.is(t,-0)?"0":String(t)},Mn=e=>`${Le(e[0])} ${Le(e[1])}`,xn=(e,t,n,o)=>[e+n*Math.cos(o*Math.PI/180),t+n*Math.sin(o*Math.PI/180)];function ic(e){let t=`M${Mn(e.from)}`;for(let n of e.segs)t+=n.arc?`A${Le(n.arc.r)} ${Le(n.arc.r)} 0 ${n.arc.large} ${n.arc.sweep} ${Mn(n.to)}`:`L${Mn(n.to)}`;return`${t}Z`}function Fe(e){let t=[e.from,...e.segs.map(o=>o.to)],n=[];for(let o=e.segs.length-1;o>=0;o--){let r=e.segs[o].arc;n.push({to:t[o],arc:r&&{...r,sweep:r.sweep?0:1}})}return{from:t[t.length-1],segs:n}}function Ne(e,t,n){let o={r:n,large:0,sweep:1};return{from:[e-n,t],segs:[{to:[e+n,t],arc:o},{to:[e-n,t],arc:o}]}}function se(e,t,n,o,r){let i=Math.min(r,n/2,o/2),s={r:i,large:0,sweep:1};return i<=0?He([[e,t],[e+n,t],[e+n,t+o],[e,t+o]]):{from:[e+i,t],segs:[{to:[e+n-i,t]},{to:[e+n,t+i],arc:s},{to:[e+n,t+o-i]},{to:[e+n-i,t+o],arc:s},{to:[e+i,t+o]},{to:[e,t+o-i],arc:s},{to:[e,t+i]},{to:[e+i,t],arc:s}]}}function He(e){let t=0;for(let o=0;o<e.length;o++){let[r,i]=e[o],[s,a]=e[(o+1)%e.length];t+=r*a-s*i}let n=t>0?e:[...e].reverse();return{from:n[0],segs:[...n.slice(1).map(o=>({to:o})),{to:n[0]}]}}function Pe(e,t,n){let o=n/2,r=t[0]-e[0],i=t[1]-e[1],s=Math.hypot(r,i);if(s<1e-6)return Ne(e[0],e[1],o);let a=[i/s*o,-r/s*o],c={r:o,large:0,sweep:1},l=[e[0]+a[0],e[1]+a[1]];return{from:l,segs:[{to:[t[0]+a[0],t[1]+a[1]]},{to:[t[0]-a[0],t[1]-a[1]],arc:c},{to:[e[0]-a[0],e[1]-a[1]]},{to:l,arc:c}]}}function Ge(e,t,n=!1){let o=[],r=n?e.length:e.length-1;for(let i=0;i<r;i++)o.push(Pe(e[i],e[(i+1)%e.length],t));return o}function bt(e,t,n,o,r,i){let s=i/2,a=r-o>180?1:0,c={r:s,large:0,sweep:1},l=xn(e,t,n+s,o);return{from:l,segs:[{to:xn(e,t,n+s,r),arc:{r:n+s,large:a,sweep:1}},{to:xn(e,t,n-s,r),arc:c},{to:xn(e,t,n-s,o),arc:{r:n-s,large:a,sweep:0}},{to:l,arc:c}]}}var de=(...e)=>e.flat().map(ic).join(" "),tt=(e,t,n)=>`M${Le(e-n)} ${Le(t)}a${Le(n)} ${Le(n)} 0 1 0 ${Le(2*n)} 0a${Le(n)} ${Le(n)} 0 1 0 ${Le(-2*n)} 0`,wt=(e,t,n,o,r)=>ic(se(e,t,n,o,r)),Lo=e=>`M${e.map(Mn).join("L")}`,To=(e,t,n,o,r)=>`M${Mn(xn(e,t,n,o))}A${Le(n)} ${Le(n)} 0 ${r-o>180?1:0} 1 ${Mn(xn(e,t,n,r))}`;function yn(e,t,n,o=1){let r=i=>[i[0]*o+t,i[1]*o+n];return{head:[e.head[0]*o+t,e.head[1]*o+n,e.head[2]*o],limbs:e.limbs.map(i=>i.map(r)),arcs:e.arcs?.map(([i,s,a,c,l])=>[i*o+t,s*o+n,a*o,c,l])}}function Kn(e){return[tt(e.head[0],e.head[1],e.head[2]),...e.limbs.map(Lo),...(e.arcs??[]).map(([t,n,o,r,i])=>To(t,n,o,r,i))].join(" ")}function gn(e,t=2.6){return[Ne(e.head[0],e.head[1],e.head[2]+1),...e.limbs.flatMap(n=>Ge(n,t)),...(e.arcs??[]).map(([n,o,r,i,s])=>bt(n,o,r,i,s,t-.2))]}var $t={head:[10,4,2],limbs:[[[10,8.2],[10,14],[15.5,14],[18,19.5],[20.5,19.5]],[[10,10.6],[14.5,10.6]]],arcs:[[9.5,16,5.5,35,235]]},Ya={head:[10.6,3.9,1.9],limbs:[[[9.6,7.8],[7.6,12]],[[5.4,8.2],[9.4,8.4],[12.8,10]],[[4,15.6],[7.6,12],[11,13.6],[10.6,16.4]]]},za={cx:12,hr:1.9,arm:5,leg:3,r:2},Za={cx:12,hr:1.9,sh:2.2,hem:6,leg:3},$a={cx:6.2,hr:1.8,arm:3.6,leg:2.2,r:1.4},Qa={cx:17.8,hr:1.8,sh:1.4,hem:4.1,leg:2.2};function qa({cx:e,hr:t,arm:n,leg:o,r}){return[tt(e,2+t,t),`M${Le(e-n+r)} 8.5H${Le(e+n-r)}a${r} ${r} 0 0 1 ${r} ${r}V15H${Le(e+o)}V22H${Le(e-o)}V15H${Le(e-n)}V${Le(8.5+r)}a${r} ${r} 0 0 1 ${r} ${-r}Z`,`M${Le(e)} 15V22`].join(" ")}function Ja({cx:e,hr:t,arm:n,leg:o,r}){return[Ne(e,2+t,t+1),se(e-n-.5,7.8,2*n+1,7.7,r+.5),se(e-o-.5,13,o,9.5,1),se(e+.5,13,o,9.5,1)]}function ec({cx:e,hr:t,sh:n,hem:o,leg:r}){return[tt(e,2+t,t),Lo([[e-n,8.5],[e+n,8.5],[e+o,16],[e+r,16],[e+r,22],[e-r,22],[e-r,16],[e-o,16]])+"Z",`M${Le(e)} 16V22`].join(" ")}function tc({cx:e,hr:t,sh:n,hem:o,leg:r}){return[Ne(e,2+t,t+1),He([[e-n-.6,7.8],[e+n+.6,7.8],[e+o+.9,16.8],[e-o-.9,16.8]]),se(e-r-.1,15,r-.4,7.5,.9),se(e+.5,15,r-.4,7.5,.9)]}var Zh=[[14.6,1.5],[5.2,13.6],[11,13.6],[9.4,22.5],[18.8,10.4],[13,10.4]],$h="M8.5 3.5 4 5.5l-1.5 5 3 1 1-2v11h11v-11l1 2 3-1-1.5-5-4.5-2c-.5 1.5-1.8 2.5-3.5 2.5s-3-1-3.5-2.5Z",Qh="M12 2.5S5 9.5 5 14.5a7 7 0 0 0 14 0c0-5-7-12-7-12Z",qh="M2.5 21.5h19V3h-6v6.2H9.2v6.2H2.5Z",nc=[[9,3],[15,3],[15,9],[21,9],[21,15],[15,15],[15,21],[9,21],[9,15],[3,15],[3,9],[9,9]],Jh={from:[3.8,5.2],segs:[{to:[20.2,5.2]},{to:[22,7],arc:{r:1.8,large:0,sweep:1}},{to:[22,9.7]},{to:[22,14.3],arc:{r:2.3,large:0,sweep:0}},{to:[22,17]},{to:[20.2,18.8],arc:{r:1.8,large:0,sweep:1}},{to:[3.8,18.8]},{to:[2,17],arc:{r:1.8,large:0,sweep:1}},{to:[2,14.3]},{to:[2,9.7],arc:{r:2.3,large:0,sweep:0}},{to:[2,7]},{to:[3.8,5.2],arc:{r:1.8,large:0,sweep:1}}]},ed={from:[12,1.6],segs:[{to:[20.4,4.9]},{to:[20.4,11.2]},{to:[12,22.4],arc:{r:13,large:0,sweep:1}},{to:[3.6,11.2],arc:{r:13,large:0,sweep:1}},{to:[3.6,4.9]},{to:[12,1.6]}]};function oc(e,t,n){return{from:[e-n,t],segs:[{to:[e+n,t],arc:{r:n,large:0,sweep:1}},{to:[e-n,t]}]}}var rc={head:[13.2,4.3,2.2],limbs:[[[12.6,8.6],[11.2,15],[17.8,18.4],[9.4,18.4]],[[12.4,9.8],[16,14.4]]]},td=[[6,10.5],[15,10.5],[16.5,7],[18.5,5.5],[20,6.5],[21.5,8.5],[19.5,10],[18,12],[18,19],[16.5,19],[15.5,14],[9.5,14],[8.5,19],[7,19],[6.5,13]],nd=[[5.4,9.8],[14.6,9.8],[16.1,6.4],[18.4,4.6],[20.5,5.9],[22.4,8.6],[19.9,10.6],[18.8,12.3],[18.8,19.8],[15.8,19.8],[15,14.8],[10.1,14.8],[9.2,19.8],[6.2,19.8],[5.6,13.2]],Vr=[{key:"restroom-men",label:"Men's restroom",group:"facilities",path:qa(za),solid:de(Ja(za))},{key:"restroom-women",label:"Women's restroom",group:"facilities",path:ec(Za),solid:de(tc(Za))},{key:"restroom-accessible",label:"Accessible restroom",group:"facilities",path:[wt(2.5,2.5,19,19,3.5),Kn(yn($t,4.6,4.3,.66))].join(" "),solid:de(gn($t)),solidLarge:de(se(1.5,1.5,21,21,4.5),Fe(se(3.9,3.9,16.2,16.2,2.6)),gn(yn($t,4.9,4.7,.62),2.2))},{key:"first-aid",label:"First aid",group:"facilities",path:Lo(nc)+"Z",solid:de(He(nc.map(([e,t])=>[e+(e-12)*.08,t+(t-12)*.08])))},{key:"coat-check",label:"Coat check",group:"facilities",path:"M10 6.5a2 2 0 1 1 2 2V10 M12 10 3.4 16.9a1.4 1.4 0 0 0 .9 2.6h15.4a1.4 1.4 0 0 0 .9-2.6Z",solid:de(bt(12,6.2,2.2,180,450,2.3),Pe([12,8.4],[12,10.5],2.3),Ge([[12,10.2],[3.2,18.8],[20.8,18.8]],2.8,!0))},{key:"atm",label:"ATM / cash",group:"facilities",path:[wt(2,6,20,12,2),tt(12,12,2.75),"M6 12h.01 M18 12h.01"].join(" "),solid:de(se(1.5,5.5,21,13,2.4),Fe(Ne(12,12,3.2)))},{key:"info",label:"Info point",group:"facilities",path:[tt(12,12,9.5),"M10.8 11H12v5.8 M12 7.6h.01"].join(" "),solid:de(Ne(12,4.9,2.4),se(10.3,9.2,3.4,12.3,1),se(8.2,9.2,4,3,1),se(8.2,18.5,7.6,3,1))},{key:"lost-found",label:"Lost & found",group:"facilities",path:[tt(10.5,10.5,7.5),"M16 16l5.5 5.5","M8.4 8.4a2.1 2.1 0 1 1 3 1.9c-.6.4-.9.8-.9 1.6 M10.5 14.6h.01"].join(" "),solid:de(bt(12,7.6,4.2,180,405,3.4),Ge([[14.97,10.57],[12,13],[12,15]],3.4),Ne(12,20,2.1))},{key:"restrooms",label:"Toilets",group:"facilities",path:[qa($a),ec(Qa)].join(" "),solid:de(Ja($a),tc(Qa))},{key:"charging",label:"Charging point",group:"facilities",path:[wt(6,2,12,20,2.5),"M13.2 6.2 9.6 12h4.8l-3.6 5.8"].join(" "),solid:de(He(Zh))},{key:"smoking",label:"Smoking area",group:"facilities",path:[wt(2,14.5,14.5,4,1),"M6.5 14.5v4","M15.5 11.5c0-1.4 1.5-1.9 1.5-3.4s-1.5-2-1.5-3.4 M19 11.5c0-1.4 1.5-1.9 1.5-3.4s-1.5-2-1.5-3.4"].join(" "),solid:de(se(1.5,14,4.2,5,1.2),se(6.8,14,10.4,5,1.2),Ge([[15.9,11.4],[17.3,8.9],[15.9,6.4],[17.1,3.9]],2.2),Ge([[19.6,11.4],[21,8.9],[19.6,6.4],[20.8,3.9]],2.2))},{key:"no-smoking",label:"No smoking",group:"facilities",path:[tt(12,12,9.5),"M5.3 5.3l13.4 13.4","M5.5 10.5h13v3h-13Z"].join(" "),solid:de(Ne(12,12,10.6),Fe(Ne(12,12,8)),Pe([6,6],[18,18],2.8),se(5,10.4,3,3.2,.6),se(16,10.4,3,3.2,.6))},{key:"food",label:"Food",group:"food-drink",path:"M5 2.5V8a2.5 2.5 0 0 0 5 0V2.5 M7.5 2.5v19 M18.5 13.5h-2c-1.3 0-2-1-2-2.5 0-4 1.5-7 4-8.5v19",solid:de(Ge([[4.9,2.6],[4.9,8]],2.2),Ge([[10.1,2.6],[10.1,8]],2.2),Ge([[7.5,2.6],[7.5,8]],2.2),bt(7.5,8,2.6,0,180,2.2),Pe([7.5,10],[7.5,21.4],3),He([[19.4,2.2],[19.4,14.2],[16.2,14.2],[14.1,12],[14.1,9.4],[15.2,5.8],[17.3,3.3]]),Pe([18,13],[18,21.4],3))},{key:"bar",label:"Bar",group:"food-drink",path:"M3.5 3.5h17L12 13Z M6.2 6.5h11.6 M12 13v7.5 M8 20.5h8",solid:de(He([[2.8,3],[21.2,3],[12,13.6]]),Pe([12,12],[12,20.6],2.8),Pe([7.4,21],[16.6,21],2.8))},{key:"coffee",label:"Caf\xE9 / coffee",group:"food-drink",path:"M4 9h12v4.5a5.5 5.5 0 0 1-5.5 5.5h-1A5.5 5.5 0 0 1 4 13.5Z M16 10.5h1.2a2.75 2.75 0 0 1 0 5.5H16 M8 3v3 M12 3v3 M3 21.5h14",solid:de({from:[3.4,8.4],segs:[{to:[16.6,8.4]},{to:[16.6,13.4]},{to:[11,19.4],arc:{r:5.8,large:0,sweep:1}},{to:[9,19.4]},{to:[3.4,13.4],arc:{r:5.8,large:0,sweep:1}},{to:[3.4,8.4]}]},bt(17.2,13.25,2.5,270,450,2.4),Pe([7.8,2.6],[7.8,5.6],2.4),Pe([12.2,2.6],[12.2,5.6],2.4),Pe([2.6,21.6],[17.4,21.6],2.6))},{key:"water",label:"Water / drinks",group:"food-drink",path:Qh,solid:"M12 1.2S4 8.9 4 14.5a8 8 0 0 0 16 0c0-5.6-8-13.3-8-13.3Z"},{key:"merch",label:"Merch / shop",group:"food-drink",path:$h,solid:"M8.4 2.8 3.5 5l-1.9 6 4.2 1.4.4-.8v9.4h11.6v-9.4l.4.8 4.2-1.4-1.9-6-4.9-2.2c-.4 1.5-1.8 2.6-3.6 2.6s-3.2-1.1-3.6-2.6Z"},{key:"screen",label:"Screen",group:"facilities",path:[wt(2,3.5,20,13.5,2),"M12 17v3.5 M8 20.5h8","M10 7.8v5.9l5-2.95Z"].join(" "),solid:de(se(1.5,3,21,14.4,2.4),Fe(He([[9.6,6.7],[16,10.2],[9.6,13.7]])),se(10.6,16.5,2.8,4,0),Pe([7.4,21],[16.6,21],2.8))},{key:"sound-booth",label:"Sound booth",group:"facilities",path:["M6 3v9 M6 16v5 M12 3v3 M12 10v11 M18 3v10 M18 17v4",tt(6,14,2),tt(12,8,2),tt(18,15,2)].join(" "),solid:de(Pe([6,2.8],[6,21.2],1.8),Pe([12,2.8],[12,21.2],1.8),Pe([18,2.8],[18,21.2],1.8),se(3.2,11.6,5.6,4.8,1.4),se(9.2,5.6,5.6,4.8,1.4),se(15.2,12.6,5.6,4.8,1.4))},{key:"entrance",label:"Entrance",group:"navigation",path:"M11 7V3.5a1 1 0 0 1 1-1h8a1 1 0 0 1 1 1v17a1 1 0 0 1-1 1h-8a1 1 0 0 1-1-1V17 M2.5 12h13.5 M12.5 8.5 16 12l-3.5 3.5",solid:de(Ge([[11,6.5],[11,2.6],[21,2.6],[21,21.4],[11,21.4],[11,17.5]],2.6),Pe([2.8,12],[13.5,12],3.2),He([[12.6,7.8],[18,12],[12.6,16.2]]))},{key:"exit",label:"Exit",group:"navigation",path:"M13 7V3.5a1 1 0 0 0-1-1H4a1 1 0 0 0-1 1v17a1 1 0 0 0 1 1h8a1 1 0 0 0 1-1V17 M8 12h13.5 M18 8.5l3.5 3.5-3.5 3.5",solid:de(Ge([[13,6.5],[13,2.6],[3,2.6],[3,21.4],[13,21.4],[13,17.5]],2.6),Pe([7.2,12],[17,12],3.2),He([[16.2,7.8],[21.6,12],[16.2,16.2]]))},{key:"emergency-exit",label:"Emergency exit",group:"navigation",path:[Kn(yn(Ya,-2,1.4,1.15)),"M15.5 13h6 M19 10.5l2.5 2.5-2.5 2.5"].join(" "),solid:de(gn(yn(Ya,-2,1.4,1.15),2.7),Pe([15.6,13],[19.5,13],2.8),He([[18.4,9.4],[22.4,13],[18.4,16.6]]))},{key:"stairs",label:"Stairs",group:"navigation",path:qh,solid:"M1.5 22.5h21V2h-7.8v6.4H8.4v6.4H1.5Z"},{key:"elevator",label:"Elevator",group:"navigation",path:[wt(3.5,2.5,17,19,2.5),"M8.5 9.5 12 5.5l3.5 4Z M8.5 14.5l3.5 4 3.5-4Z"].join(" "),solid:de(He([[12,1.6],[19.6,10.2],[4.4,10.2]]),He([[4.4,13.8],[19.6,13.8],[12,22.4]]))},{key:"parking",label:"Parking",group:"navigation",path:[wt(3,3,18,18,3),"M9.5 17V7h3.75a3 3 0 0 1 0 6H9.5"].join(" "),solid:"M6.5 21V3H12a5.5 5.5 0 0 1 0 11h-1.9v7Z M10.1 6.6v3.8H12a1.9 1.9 0 0 0 0-3.8Z"},{key:"wheelchair",label:"Wheelchair access",group:"accessibility",path:Kn($t),solid:de(gn($t))},{key:"hearing",label:"Hearing assistance",group:"accessibility",path:["M4 9a6 6 0 1 1 12 0c0 3-1.8 4.3-3 5.2-1.1.8-1.6 1.7-1.6 3.1a3.6 3.6 0 0 1-6.2 2.1","M7.5 9a2.5 2.5 0 0 1 5 0c0 1.2-.7 1.9-1.6 2.5","M18.5 5.5a6.5 6.5 0 0 1 0 8"].join(" "),solid:de(bt(10,9,6,180,380,3),Ge([[15.64,11.05],[12.8,14.3],[11.5,17.2]],3),bt(8.2,17.2,3.3,0,150,3),bt(10,9,2.2,180,400,2.4),bt(13.38,9.5,6.5,322,398,2.6))},{key:"box-office",label:"Box office / tickets",group:"navigation",path:"M3 7.5A1.5 1.5 0 0 1 4.5 6h15A1.5 1.5 0 0 1 21 7.5V10a2 2 0 0 0 0 4v2.5a1.5 1.5 0 0 1-1.5 1.5h-15A1.5 1.5 0 0 1 3 16.5V14a2 2 0 0 0 0-4Z M15 6v2 M15 11v2 M15 16v2",solid:de(Jh,Fe(se(14.1,7,1.8,2.2,.9)),Fe(se(14.1,10.9,1.8,2.2,.9)),Fe(se(14.1,14.8,1.8,2.2,.9)))},{key:"escalator",label:"Escalator",group:"navigation",path:"M2.5 17H7l9-9h5.5v4h-4l-9 9h-6Z M11 4.5h.01 M11 8.2v3.3",solid:de(He([[2,16.4],[6.8,16.4],[15.8,7.4],[22,7.4],[22,12.6],[17.8,12.6],[8.8,21.6],[2,21.6]]),Ne(11,4.3,2.3),Pe([11,8],[11,11],2.6))},{key:"ramp",label:"Ramp",group:"navigation",path:"M2.5 19.5h19v-10Z M4.5 13.2 14 8.2 M10.53 7.76 14 8.2l-1.6 3.11",solid:de(He([[1.6,20.4],[22.4,20.4],[22.4,8.6]]),Pe([4.2,13.4],[13.2,8.6],2.6),He([[15.4,7.5],[13.16,11.84],[10.56,6.88]]))},{key:"taxi",label:"Taxi / rideshare",group:"navigation",path:["M9.5 2.5h5V5h-5Z M6.5 11 8 7h8l1.5 4",wt(3.5,11,17,6,2),"M6.5 17v2.5 M17.5 17v2.5 M7 14h.01 M17 14h.01"].join(" "),solid:de(se(9,1.8,6,3.4,.8),He([[6,11.4],[7.6,6.4],[16.4,6.4],[18,11.4]]),se(2.8,10.6,18.4,7,2.2),Fe(Ne(6.8,14,1.3)),Fe(Ne(17.2,14,1.3)),se(4.8,16,3.6,5.2,1.2),se(15.6,16,3.6,5.2,1.2))},{key:"transit",label:"Bus / transit",group:"navigation",path:[wt(4.5,2.5,15,16,3),"M4.5 10.5h15 M9 5.5h6 M7.5 18.5V21 M16.5 18.5V21 M8 14.5h.01 M16 14.5h.01"].join(" "),solid:de(se(4,2,16,17,3.2),Fe(se(6.2,5.8,11.6,5,1)),Fe(Ne(8,14.5,1.3)),Fe(Ne(16,14.5,1.3)),se(6,17,3.4,5,1.2),se(14.6,17,3.4,5,1.2))},{key:"bike-parking",label:"Bike parking",group:"navigation",path:[tt(6,14.5,4),tt(18,14.5,4),"M6 14.5 9 7.5h6.5L18 14.5 M9 7.5l2.5 7H6 M11.5 14.5l4-7 M7.5 6h3 M15.5 7.5 15 5.5h2"].join(" "),solid:de(Ne(6,14.5,4.9),Fe(Ne(6,14.5,2.7)),Ne(18,14.5,4.9),Fe(Ne(18,14.5,2.7)),Ge([[6,14.5],[9,7.5],[15.5,7.5],[18,14.5]],2.2),Ge([[9,7.5],[11.5,14.5],[15.5,7.5]],2.2),Pe([6,14.5],[11.5,14.5],2.2),Pe([7.2,5.8],[10.6,5.8],2.2),Ge([[15.4,7.3],[15,5.4],[17.2,5.4]],2.2))},{key:"meeting-point",label:"Meeting point",group:"navigation",path:["M9.5 2.5 12 5l2.5-2.5 M9.5 21.5 12 19l2.5 2.5 M2.5 9.5 5 12l-2.5 2.5 M21.5 9.5 19 12l2.5 2.5",tt(10,9.6,1.5),tt(14,9.6,1.5),"M7.5 15.5a2.5 2.5 0 0 1 5 0 M11.5 15.5a2.5 2.5 0 0 1 5 0"].join(" "),solid:de(Ge([[9.4,2.4],[12,5],[14.6,2.4]],2.6),Ge([[9.4,21.6],[12,19],[14.6,21.6]],2.6),Ge([[2.4,9.4],[5,12],[2.4,14.6]],2.6),Ge([[21.6,9.4],[19,12],[21.6,14.6]],2.6),Ne(9.7,9.3,2.2),Ne(14.3,9.3,2.2),oc(9.7,16,3),oc(14.3,16,3))},{key:"security",label:"Security / bag check",group:"facilities",path:"M12 2.5 19.5 5.5v6c0 4.6-3.2 8.4-7.5 10-4.3-1.6-7.5-5.4-7.5-10v-6Z M8.5 12l2.5 2.5 4.5-5",solid:de(ed,Fe(He([[7.4,12.2],[9,10.6],[10.9,12.5],[15,8.4],[16.6,10],[10.9,15.7]])))},{key:"lockers",label:"Lockers",group:"facilities",path:[wt(3.5,2.5,17,19,1.5),"M12 2.5v19 M6 6h3 M15 6h3 M9.5 11.5v2.5 M14.5 11.5v2.5"].join(" "),solid:de(se(3,2,8.4,20,1.4),Fe(se(5,5,4.4,1.7,.8)),Fe(se(8.6,10.8,1.5,3.8,.7)),se(12.6,2,8.4,20,1.4),Fe(se(14.6,5,4.4,1.7,.8)),Fe(se(13.9,10.8,1.5,3.8,.7)))},{key:"baby-change",label:"Baby change",group:"facilities",path:"M10 6.5l.8-3.3a1.2 1.2 0 0 1 2.4 0l.8 3.3 M8.5 6.5h7 M9.5 6.5l-.9 2.2a3 3 0 0 0-.1.9V19a2.5 2.5 0 0 0 2.5 2.5h2a2.5 2.5 0 0 0 2.5-2.5V9.6a3 3 0 0 0-.1-.9l-.9-2.2 M8.5 12.5h3 M8.5 16h3",solid:de(He([[9.6,6.2],[10.6,1.8],[13.4,1.8],[14.4,6.2]]),se(7.6,5.4,8.8,2.6,1),se(7.8,7.4,8.4,15,2.6),Fe(se(7.8,11.8,3.4,1.5,0)),Fe(se(7.8,15.4,3.4,1.5,0)))},{key:"prayer-room",label:"Prayer room",group:"facilities",path:[Kn(rc),"M3 21.5h18"].join(" "),solid:de(gn(rc),se(2.4,20.2,19.2,2.6,1.3))},{key:"quiet-room",label:"Quiet room",group:"facilities",path:"M4 9h3.5l5-4v14l-5-4H4Z M15.5 9.5l5 5 M20.5 9.5l-5 5",solid:de(He([[2.6,8.4],[7.2,8.4],[13,3.6],[13,20.4],[7.2,15.6],[2.6,15.6]]),Pe([15.4,9.2],[20.8,14.8],2.8),Pe([20.8,9.2],[15.4,14.8],2.8))},{key:"wifi",label:"Wi-Fi",group:"facilities",path:[To(12,19,11.5,218,322),To(12,19,7.5,218,322),To(12,19,3.5,218,322),"M12 19h.01"].join(" "),solid:de(bt(12,19.2,11,218,322,2.8),bt(12,19.2,6.9,218,322,2.8),Ne(12,19.2,2.2))},{key:"vip-lounge",label:"VIP lounge",group:"facilities",path:["M6.5 11V7a2 2 0 0 1 2-2h7a2 2 0 0 1 2 2v4","M3.5 11.5a1.5 1.5 0 0 1 3 0V14h11v-2.5a1.5 1.5 0 0 1 3 0v6h-17Z","M5.5 17.5V20 M18.5 17.5V20"].join(" "),solid:de(se(6,4,12,8.5,2.2),se(2.4,9.6,4.6,9,2.2),se(17,9.6,4.6,9,2.2),se(6,13.2,12,5.4,.6),Pe([5,18],[5,20.6],2.4),Pe([19,18],[19,20.6],2.4))},{key:"accessible-entrance",label:"Accessible entrance",group:"accessibility",path:[Kn(yn($t,.3,5,.62)),"M12.5 3.5H20a1 1 0 0 1 1 1v15a1 1 0 0 1-1 1h-7.5"].join(" "),solid:de(gn(yn($t,.3,5,.62),2.2),Ge([[13,2.8],[21.2,2.8],[21.2,21.2],[13,21.2]],2.6))},{key:"assistance-dog",label:"Assistance-dog area",group:"accessibility",path:[Lo(td)+"Z","M6 10.8 3.5 7.5","M10.5 10.5V6h4.5l1 2.5"].join(" "),solid:de(He(nd),Pe([6.2,11],[3.2,7.2],2.4),Ge([[10.5,11],[10.5,5.6],[15.2,5.6],[16.2,8.2]],2.2))}],N1=new Map(Vr.map(e=>[e.key,e]));var sc=Vr;var od=new Map(sc.map(e=>[e.key,e]));function Ur(e){return e?od.get(e):void 0}var H1=sc.map(e=>e.key);function Wn(e){if(e.length<3)return e.map(n=>({...n}));let t=an(e);return t.length>=3?t:[...e].sort((n,o)=>n.x-o.x||n.y-o.y).map(n=>({...n}))}var rd=.8,id=.6,sd=2;function Gt(e,t){if(!t.length)return null;let n=[],o=0;for(let s of e.objects){if(s.type!=="shape"||s.role!=="wall")continue;let a=he(s)??[],c=ac(a)/2;!(c>0)||ld(a)/c*_>sd||(n.push(...a),o+=c)}if(n.length<3)return null;let r=Wn(n);if(r.length<3||o<ac(r)*id)return null;let i=0;for(let s of t)ud(s,r)&&(i+=1);return i>=t.length*rd?r:null}var Bo=6,ad=5,cd=8;function cc(e){return Math.max(cd,(Number.isFinite(e)?e:0)+ad)}function Sn(e){let t=0,n=0,o=0;for(let r=0;r<e.length;r++){let i=e[r],s=e[(r+1)%e.length],a=i.x*s.y-s.x*i.y;t+=a,n+=(i.x+s.x)*a,o+=(i.y+s.y)*a}if(Math.abs(t)<1e-9){let r=0,i=0;for(let s of e)r+=s.x,i+=s.y;return{x:r/Math.max(1,e.length),y:i/Math.max(1,e.length)}}return{x:n/(3*t),y:o/(3*t)}}function ld(e){let t=0;for(let n=0;n<e.length;n++){let o=e[n],r=e[(n+1)%e.length];t+=o.x*r.y-r.x*o.y}return Math.abs(t)/2}function ac(e){let t=0;for(let n=0;n<e.length;n++){let o=e[n],r=e[(n+1)%e.length];t+=Math.hypot(r.x-o.x,r.y-o.y)}return t}function ud(e,t){let n=!1;for(let o=0,r=t.length-1;o<t.length;r=o++){let i=t[o],s=t[r];i.y>e.y!=s.y>e.y&&e.x<(s.x-i.x)*(e.y-i.y)/(s.y-i.y)+i.x&&(n=!n)}return n}function lc(e,t,n,o=[],r){if(t<1)return null;let i=1/0,s=-1/0,a=1/0,c=-1/0,l=-1/0,f=(S,w)=>{S<i&&(i=S),S>s&&(s=S),w<a&&(a=w),w>c&&(c=w)};for(let S=0;S<t;S++)f(e[S*3],e[S*3+2]),e[S*3+1]>l&&(l=e[S*3+1]);for(let[S,w]of o)f(S,w);if(!Number.isFinite(i)||!Number.isFinite(l))return null;let u=(i+s)/2,m=(a+c)/2,h=Math.max(4,(s-i)/2),d=Math.max(4,(c-a)/2),p=1,y=(S,w)=>{let I=Math.hypot((S-u)/h,(w-m)/d);I>p&&(p=I)};for(let S=0;S<t;S++)y(e[S*3],e[S*3+2]);for(let[S,w]of o)y(S,w);let x=Math.min(9,Math.max(5,2*Math.max(h,d)*.1)),g=Math.max(n+8,l+x);return{centre:[u,m],radii:[h*p+6,d*p+6],floorY:n,ceilingY:r===void 0?g:Math.max(r,l+5)}}function fd(e){return{kind:"radial",rowCount:0,rows:[],nearestRow:()=>-1,depthAt:(t,n)=>Math.hypot(t-e.x,n-e.y),gradientAt:(t,n)=>{let o=t-e.x,r=n-e.y,i=Math.hypot(o,r);return i<1e-9?[0,0]:[o/i,r/i]}}}function md(e,t){if(!e.length)return null;let n=0,o=0,r=0;for(let h of e)n+=h.x,o+=h.y,r+=Math.hypot(h.x-t.x,h.y-t.y);let i=e.length;n/=i,o/=i,r/=i;let s=e[0],a=-1;for(let h of e){let d=Math.hypot(h.x-n,h.y-o);d>a&&(a=d,s=h)}let c=s.x-n,l=s.y-o,f=Math.hypot(c,l);f>1e-9?(c/=f,l/=f):(c=1,l=0);let u=[...e].sort((h,d)=>(h.x-n)*c+(h.y-o)*l-((d.x-n)*c+(d.y-o)*l)),m=0;for(let h of u){let d=Math.hypot(h.x-n,h.y-o);d>m&&(m=d)}return{pts:u,cx:n,cy:o,radius:m,depth:r}}function uc(e,t,n){let o=e.pts;if(o.length===1)return Math.hypot(t-o[0].x,n-o[0].y);let r=1/0;for(let i=0;i+1<o.length;i++){let s=o[i],a=o[i+1],c=a.x-s.x,l=a.y-s.y,f=c*c+l*l,u=f>1e-12?((t-s.x)*c+(n-s.y)*l)/f:0;u<0?u=0:u>1&&(u=1);let m=Math.hypot(t-(s.x+u*c),n-(s.y+u*l));m<r&&(r=m)}return r}var Fo=8;function hd(e,t,n){let o=new Array(Fo).fill(1/0),r=new Array(Fo).fill(-1);for(let f=0;f<e.length;f++){let u=e[f],m=Math.hypot(t-u.cx,n-u.cy)-u.radius;for(let h=0;h<Fo;h++)if(m<o[h]){for(let d=Fo-1;d>h;d--)o[d]=o[d-1],r[d]=r[d-1];o[h]=m,r[h]=f;break}}let i=new Array(3).fill(1/0),s=new Array(3).fill(-1);for(let f of r){if(f<0)continue;let u=uc(e[f],t,n);for(let m=0;m<3;m++)if(u<i[m]){for(let h=2;h>m;h--)i[h]=i[h-1],s[h]=s[h-1];i[m]=u,s[m]=f;break}}if(s[0]<0)return 0;if(i[0]<1e-6)return e[s[0]].depth;let a=i[0]*2.2,c=0,l=0;for(let f=0;f<3;f++){let u=s[f];if(u<0||i[f]>a)continue;let m=1/(i[f]*i[f]);c+=m*e[u].depth,l+=m}return l>0?c/l:e[s[0]].depth}function dd(e){let t=(o,r)=>hd(e,o,r),n=(o,r)=>{let i=1/0,s=-1;for(let a=0;a<e.length;a++){let c=e[a];if(Math.hypot(o-c.cx,r-c.cy)-c.radius>=i)continue;let l=uc(c,o,r);l<i&&(i=l,s=a)}return s};return{kind:"rows",rowCount:e.length,rows:e,nearestRow:n,depthAt:t,gradientAt:(o,r)=>{let i=(t(o+.5,r)-t(o-.5,r))/1,s=(t(o,r+.5)-t(o,r-.5))/(2*.5),a=Math.hypot(i,s);return a<1e-9?[0,0]:[i/a,s/a]}}}function fc(e,t){let n=[];for(let o of e){let r=md(o.points,t);r&&n.push(r)}return n.length<2?fd(t):(n.sort((o,r)=>o.depth-r.depth),dd(n))}var Ht=.06,pd=.05,hc=.05,mc=.15,Xr=25;function dc(e,t,n){let o=new Map,r=new Array(t.length).fill(null),i=new Float64Array(t.length),s=new Array(t.length).fill(void 0),a=new Array(t.length).fill(void 0),c=new Map,l=[],f=new Set;for(let m=0;m<e.length;m+=1){let h=e[m];for(let d of h.objects){if(d.type==="table"&&f.add(d.id),d.type!=="section"||!d.outline||d.outline.length<3)continue;let p=It(d.outline,ut);c.set(d.id,{section:d,unit:h,frontU:1/0,hasSeats:!1,rows:new Map,seatIndices:[]}),l.push({id:d.id,floorIndex:m,box:Ct(p),section:d,unit:h,outline:p})}}let u=new Map;for(let m of l){let h=u.get(m.floorIndex);h?h.push(m):u.set(m.floorIndex,[m])}for(let m=0;m<t.length;m++){let h=t[m],d=n?u.get(n[m])??[]:l,p=h.sectionId?d.find(x=>x.id===h.sectionId)??d.find(x=>x.section.logicalSectionId===h.sectionId&&Xe({x:h.x,y:h.y},x.outline,x.section.holes)):void 0,y=p?[p]:d;for(let x of y){if(n&&x.floorIndex!==n[m]||!p&&(h.x<x.box.minX||h.x>x.box.maxX||h.y<x.box.minY||h.y>x.box.maxY||!Xe({x:h.x,y:h.y},x.outline,x.section.holes)))continue;r[m]=x.id;let g=c.get(x.id);g.hasSeats=!0;let S=h.focalPoint??x.unit.focal,w=Math.hypot(h.x-S.x,h.y-S.y);w<g.frontU&&(g.frontU=w),g.seatIndices.push(m);let I=h.rowId||`__seat-${m}`,b=g.rows.get(I);b?b.push({x:h.x,y:h.y}):g.rows.set(I,[{x:h.x,y:h.y}]);break}}for(let[m,h]of c){let d=Lt(h.section,{floorBaseHeightM:h.unit.baseHeightM}),p=h.unit.baseHeightM,y=d.rake>0?Math.tan(d.rake*Math.PI/180):0,x=d.rake<=.01&&d.height<=p+.001,g=h.section.surfaceKind,S=g==="flat"?!0:g==="rakedRows"&&d.rake>.01?!1:x,w=h.hasSeats?oo(m,t,h.seatIndices,h.unit.focal):{sectionId:m,rows:[],blockCount:0},b=w.rows.length<2?fc([...h.rows.values()].map(L=>({points:L})),h.unit.focal):null,R=1/0;if(b){if(h.hasSeats)for(let L of h.rows.values())for(let B of L){let D=b.depthAt(B.x,B.y);D<R&&(R=D)}if(!h.hasSeats||!Number.isFinite(R)){R=1/0;for(let L of h.section.outline){let B=b.depthAt(L.x,L.y);B<R&&(R=B)}}}let P=p+pd,M=Math.max(P,d.height),C=L=>{let B=Math.max(0,L-R)*re,D=Math.min(B*y,Xr);return Math.max(P,d.height+D)},T=L=>{let B=Math.max(0,L)*re,D=Math.min(B*y,Xr);return Math.max(P,d.height+D)},v=S?[]:w.rows.map(L=>({pts:L.pts,y:T(L.blockDepth),depth:L.blockDepth,blockId:L.blockId,...f.has(L.id)?{patch:Qs(L.pts,ut)}:{}})),k=v.length?v[0].y:M,E=v.map(L=>{let B=L.patch&&L.patch.length>=3?L.patch:L.pts,D=0,j=0;for(let U of B)D+=U.x,j+=U.y;let H=B.length||1;D/=H,j/=H;let V=0;for(let U of B){let $=Math.hypot(U.x-D,U.y-j);$>V&&(V=$)}return{cx:D,cy:j,rad:V}}),A=S?()=>M:v.length>=2?(L,B)=>{let D=1/0,j=k;for(let H=0;H<v.length;H++){let V=E[H];if(Math.hypot(L-V.cx,B-V.cy)-V.rad>=D)continue;let U=v[H].patch,$=U&&U.length>=3?Ve(U,L,B)?0:en(U,L,B):en(v[H].pts,L,B);$<D&&(D=$,j=v[H].y)}return j}:(L,B)=>b?C(b.depthAt(L,B)):M,O=[0,1,0],F=v.length>=2||S?()=>O:(L,B)=>{if(!b)return O;let D=b.depthAt(L,B);if(D<=R)return O;let j=(D-R)*re;if(j*y>=Xr||d.height+j*y<=P)return O;let[H,V]=b.gradientAt(L,B);if(H===0&&V===0)return O;let U=1/Math.hypot(y,1);return[-H*y*U,U,-V*y*U]};if(!S)for(let L of w.rows){let B=T(L.blockDepth);for(let D of L.seatIndices)s[D]=B}for(let L of w.rows){let B=[];for(let U=1;U<L.pts.length;U++){let $=Math.hypot(L.pts[U].x-L.pts[U-1].x,L.pts[U].y-L.pts[U-1].y);$>1e-6&&B.push($)}B.sort((U,$)=>U-$);let D=B.length?B[Math.floor(B.length/2)]:1/0,j=1/0,H=L.pts[Math.floor(L.pts.length/2)];if(H)for(let U of w.rows){if(U===L||U.blockId!==L.blockId)continue;let $=en(U.pts,H.x,H.y);$>1e-6&&$<j&&(j=$)}let V=Math.min(D,Math.max(j,D*.5));if(Number.isFinite(V)&&V>0)for(let U of L.seatIndices)a[U]=V}o.set(m,{sectionId:m,deckAt:A,normalAt:F,flat:S,bottomY:p,rowLevels:v,landingY:k})}for(let m=0;m<t.length;m++){let h=r[m],d=t[m];if(h){let x=s[m];i[m]=(x??o.get(h).deckAt(d.x,d.y))+mc;continue}let p=d.eyeHeightM,y=Number.isFinite(p)?Math.max(0,p-Mt):0;i[m]=d.kind==="booth"?y+Ht+mc:y}return{bySection:o,seatOwner:r,seatDeckY:m=>i[m],seatPitchU:m=>a[m]}}function Rn(e,t,n){if(e.length!==4||n<=t)return null;let o=st(e),r=Math.hypot(o[1].x-o[0].x,o[1].y-o[0].y)*_,i=Math.hypot(o[3].x-o[0].x,o[3].y-o[0].y)*_;if(r<1e-6||i<1e-6)return null;let s=Math.min(.22/r,.16),a=Math.min(.28,(n-t)*.13),c=Math.min(.065/i,.2);return{quad:o,side:s,face:c,opening:qe(o,s,1-s),openingTop:n-a}}function Kr(e,t,n){if(e.length!==4||n-t<=.2)return null;let o=st(e),r=Math.hypot(o[1].x-o[0].x,o[1].y-o[0].y)*_;if(r<=1e-6)return null;let i=Math.min(.14,(n-t)*.08,r*.08),s=i/r,a=qe(o,s,1-s);return{quad:o,side:s,trim:i,inner:a,panel:Dn(a,.15,.85),bottom:t+i,top:n-i}}function pc(e,t,n,o){let r=Kr(e,t,n);if(!r)return;let{panel:i}=r,s=(g,S)=>({x:(g.x+S.x)/2,y:(g.y+S.y)/2}),a=s(i[0],i[1]),c=s(i[3],i[2]),l=Math.hypot(a.x-o.x,a.y-o.y)<=Math.hypot(c.x-o.x,c.y-o.y),[f,u]=l?[i[0],i[1]]:[i[3],i[2]],m=l?{x:a.x-c.x,y:a.y-c.y}:{x:c.x-a.x,y:c.y-a.y},h=Math.hypot(m.x,m.y);if(h<1e-6)return;-(u.y-f.y)*m.x+(u.x-f.x)*m.y<0&&([f,u]=[u,f]);let d=Math.min(.006,h*_*.05),p=m.x/h*d,y=m.y/h*d,x=(g,S)=>[g.x*_+p,S,g.y*_+y];return[x(f,r.bottom),x(u,r.bottom),x(f,r.top),x(u,r.top)]}var yc=xt(require("polygon-clipping"),1);var bc=xt(require("polygon-clipping"),1);function vt(e,t,n,o,r,i,s,a={}){let c=Ct(t),l=a.ao??z,f=r.flatMap(p=>{if(p.role!=="entrance"&&p.role!=="exit")return[];let y=he(p);if(!y||y.length!==4||!sn(c,Ct(y)))return[];let x=a.portalBase??n,g=Rn(y,x,x+dt(p).heightM);if(!g)return[];let S=Math.min(o,g.openingTop);return S<=n?[]:[{poly:g.opening,height:S}]});if(!f.length)return!1;let u=p=>p.map(y=>[y.x,y.y]),m=[u(t),...(a.holes??[]).map(u)],h=[n,...new Set(f.map(p=>p.height)),o].sort((p,y)=>p-y),d=[];try{for(let p=1;p<h.length;p++){let y=h[p-1],x=h[p];if(x-y<1e-6)continue;let g=f.filter(w=>w.height>y+1e-6).map(w=>[u(w.poly)]),S=g.length?bc.default.difference(m,...g):[m];d.push({low:y,high:x,polys:S})}}catch{return!1}for(let p of d)for(let y of p.polys){let[x,...g]=y.map(w=>w.map(([I,b])=>({x:I,y:b}))),S=w=>l.wallBottom+(l.top-l.wallBottom)*(w-n)/(o-n);Q(e,x,g,()=>p.high,p.low,i,s,{...l,top:S(p.high),wallBottom:S(p.low)})}return!0}var Wr={depthM:1.6,thicknessM:.35,minWallM:6};function No(e,t,n,o,r,i,s,a,c){let l=o-n;if(l<=0)return;let f=a&&(c??l)>=Wr.minWallM?bd(t,a):null,u=f?o-Wr.thicknessM:o,m=u-n,h=m<1.5?[[n,u,1]]:f?[[n,n+Math.min(.9,m*.18),.82],[n+Math.min(.9,m*.18),u,1]]:[[n,n+Math.min(.9,m*.18),.82],[n+Math.min(.9,m*.18),u-.1,1],[u-.1,u,1.1]],d=p=>z.wallBottom+(z.top-z.wallBottom)*(p-n)/l;for(let[p,y,x]of h){let g={...z,top:d(y),wallBottom:d(p)},S=W(i,x),w=W(s,x);vt(e,t,p,y,r,S,w,{portalBase:n,ao:g})||Q(e,t,void 0,()=>y,p,S,w,g)}for(let[p,...y]of f??[])Q(e,p,y.length?y:void 0,()=>o,u,W(i,1.12),W(s,.78),z)}function bd(e,t){let n=Wr.depthM/_,o=e.map(s=>{let a=t.x-s.x,c=t.y-s.y,l=Math.hypot(a,c)||1;return{x:s.x+a/l*n,y:s.y+c/l*n}}),r=s=>{let a=s.map(c=>[c.x,c.y]);return a.push(a[0]),a},i=[[r(e)],[r(o)]];for(let s=0;s<e.length;s++){let a=(s+1)%e.length;i.push([r([e[s],e[a],o[a],o[s]])])}try{let[s,...a]=i,c=yc.default.union(s,...a);return c.length?c.map(l=>l.map(f=>f.slice(0,-1).map(([u,m])=>({x:u,y:m})))):null}catch{return null}}function gc(e){return e.route?.stepFree===!0&&(e.kind==="line"||e.kind==="polyline")}function xc(e){let t=Number.isFinite(e)&&e>0?e:4;return[Math.max(6,t*2.6),Math.max(4,t*1.7)]}function Mc(e,t,n){let o=[];if(e.length<2||!(t>0)||!(n>=0))return o;let r=!0,i=t;for(let s=0;s<e.length-1;s+=1){let a=e[s],c=e[s+1],l=Math.hypot(c.x-a.x,c.y-a.y);if(l<1e-9)continue;let f=(c.x-a.x)/l,u=(c.y-a.y)/l,m=0;for(;m<l-1e-9;){let h=Math.min(i,l-m);r&&o.push([{x:a.x+f*m,y:a.y+u*m},{x:a.x+f*(m+h),y:a.y+u*(m+h)}]),m+=h,i-=h,i<=1e-9&&(r=!r,i=r?t:n)}}return o}function Yn(e,t,n){let o=be(t.stroke?.color),r=t.stroke?.width??0;if(!o||!Number.isFinite(r)||r<=0)return;let i=t.kind==="line"||t.kind==="polyline",s=i?ln(t.points??[],t.rotation):he(t);if(!s||s.length<2)return;let a=r*.5,c=gc(t)?Mc(s,...xc(r)):Array.from({length:i?s.length-1:s.length},(l,f)=>[s[f],s[(f+1)%s.length]]);for(let[l,f]of c){let u=Math.hypot(f.x-l.x,f.y-l.y);if(u<1e-6)continue;let m=-(f.y-l.y)/u*a,h=(f.x-l.x)/u*a,d=[(l.x+m)*_,n,(l.y+h)*_],p=[(f.x+m)*_,n,(f.y+h)*_],y=[(f.x-m)*_,n,(f.y-h)*_],x=[(l.x-m)*_,n,(l.y-h)*_];e.tri(d,p,y,[0,1,0],o),e.tri(d,y,x,[0,1,0],o)}}function Sc(e){return e==="bar"||e==="concession"||e==="coat"||e==="restroom"}var In=(e,t,n)=>({x:e.x+(t.x-e.x)*n,y:e.y+(t.y-e.y)*n});function Do(e,t,n,o){let[r,i,s,a]=t?e:[e[3],e[2],e[1],e[0]];return[In(r,a,n),In(i,s,n),In(i,s,o),In(r,a,o)]}function Rc(e,t,n,o,r,i,s,a,c=!1){if(n.length!==4||r-o<.4)return!1;let l=P=>c?Math.min(P,r):P,f=st(n),u=Math.hypot(f[3].x-f[0].x,f[3].y-f[0].y)*_;if(u<.4)return!1;let m=In(f[0],f[1],.5),h=In(f[3],f[2],.5),d=Math.hypot(m.x-a.x,m.y-a.y)<=Math.hypot(h.x-a.x,h.y-a.y),p=ce(s,[.92,.9,.86],.35),y=W(i,.72),x=r-o;if(t==="restroom"){let P=Math.min(.18,x*.08);return ye(e,f,r-P,o,s,i),ye(e,f,r,r-P,p,p),!0}let g=o+Math.min(1.1,x),S=t==="coat"?1:Math.min(.5,.75/u),w=Do(f,d,0,S);if(ye(e,w,g-.05,o,y,i),ye(e,w,g,g-.05,p,p),t==="coat"||u<1.2)return!0;if(t==="bar"){let P=Do(f,d,Math.max(S+.2,1-.45/u),1),M=l(o+Math.max(Math.min(2.2,x*2),g-o+.6));return ye(e,P,M,o,s,y),!0}let I=Do(f,d,Math.max(S+.25,.55),1),b=l(o+Math.max(2.6,g-o+1.4));if(b-.14<=g)return!0;ye(e,I,b-.14,o,s,i),ye(e,f,b,b-.14,p,y);let R=Math.min(.08,.1/Math.max(.1,Math.hypot(f[1].x-f[0].x,f[1].y-f[0].y)*_));for(let[P,M]of[[0,R],[1-R,1]])ye(e,Do(qe(f,P,M),d,0,Math.min(.08,.1/u)),b-.14,g,y,y);return!0}var jo=[.19,.4,.15],yd=.012,Uo=2.4,gd=1,xd=.75,Md=.15;function yt(e){if(e.points&&e.points.length>=3)return e.points;let{center:t,width:n,height:o,rotation:r}=e;if(!n||!o)return null;let i=(r??0)*Math.PI/180,s=Math.cos(i),a=Math.sin(i),c=n/2,l=o/2;return[[-c,-l],[c,-l],[c,l],[-c,l]].map(([f,u])=>({x:t.x+f*s-u*a,y:t.y+f*a+u*s}))}function Ec(e,t,n,o,r,i,s=!1){let a=yt(t);if(a){if(s){let c=Yt(o,r.boothTop),l=Rt([...a]);Q(e,It(l,Sd/_),[l.slice().reverse()],()=>n+.03,n,c,W(c,.8),z);return}if(!(!t.points&&i&&Id(e,a,n,o,i))){if(!t.points&&i&&a.length===4){Rd(e,a,n,o,i);return}Q(e,a,void 0,()=>n+Uo,n,Yt(o,r.boothTop),r.boothWall,z)}}}var Yr=1.1,Ic=[.9,.9,.88],Sd=.1,Go=[.87,.87,.85],Pc=.08;function Ac(e,t){let n=c=>({x:(e[c].x+e[(c+1)%4].x)/2,y:(e[c].y+e[(c+1)%4].y)/2}),o=0,r=1/0;for(let c=0;c<4;c++){let l=n(c),f=Math.hypot(l.x-t.x,l.y-t.y);f<r&&(r=f,o=c)}let i=[0,1,2,3].map(c=>e[(o+c)%4]),s=(c,l,f)=>({x:c.x+(l.x-c.x)*f,y:c.y+(l.y-c.y)*f});return{q:i,part:(c,l,f,u)=>{let m=s(i[0],i[1],c),h=s(i[0],i[1],l),d=s(i[3],i[2],c),p=s(i[3],i[2],l);return[s(m,d,f),s(h,p,f),s(h,p,u),s(m,d,u)]},depthM:Math.hypot(i[3].x-i[0].x,i[3].y-i[0].y)*_,widthM:Math.hypot(i[1].x-i[0].x,i[1].y-i[0].y)*_}}function Rd(e,t,n,o,r){let{q:i,part:s}=Ac(t,r),a=o??[.35,.42,.55],c=ce(a,[.78,.78,.77],.62),l=ce(a,[.95,.95,.94],.45);ye(e,i,n+Ht,n,c,W(c,.8)),ye(e,s(.05,.95,.72,.98),n+Yr-.05,n+Ht,l,W(l,.8)),ye(e,s(.03,.97,.7,1),n+Yr,n+Yr-.05,Ic,W(Ic,.9))}function Id(e,t,n,o,r){if(t.length!==4)return!1;let{q:i,part:s,depthM:a,widthM:c}=Ac(t,r);if(a<1||c<1)return!1;let l=o??[.35,.42,.55],f=ce(l,[.78,.78,.77],.62),u=n+Uo,m=Pc/c,h=Pc/a;ye(e,i,n+Ht,n,f,W(f,.8)),ye(e,s(0,1,1-h,1),u,n+Ht,Go,W(Go,.9));for(let[y,x]of[[0,m],[1-m,1]])ye(e,s(y,x,0,1-h),u,n+Ht,Go,W(Go,.9));ye(e,s(m,1-m,0,Math.min(.5,.06/a)),u,u-.3,l,W(l,.85));let d=Math.min(.4,.6/c),p=Math.min(.12,.3/a);return ye(e,s(.5-d,.5+d,.72-p,.72+p),n+gd,n+Ht,ce(l,[.95,.95,.94],.7),W(l,.75)),!0}function Xo(e){if(e.shape==="round"){let f=e.radius;return f?mo(e.center.x,e.center.y,f,f,24):null}let{width:t,height:n,rotation:o,center:r}=e;if(!t||!n)return null;let i=(o??0)*Math.PI/180,s=Math.cos(i),a=Math.sin(i),c=t/2,l=n/2;return[[-c,-l],[c,-l],[c,l],[-c,l]].map(([f,u])=>({x:r.x+f*s-u*a,y:r.y+f*a+u*s}))}function Cc(e,t,n,o,r,i=!0){let s=Xo(t);if(!s)return;let a=s.reduce((d,p)=>d+p.x,0)/s.length,c=s.reduce((d,p)=>d+p.y,0)/s.length,l=d=>s.map(p=>({x:a+(p.x-a)*d,y:c+(p.y-c)*d})),f=Ft(r)?1:_d,u=i&&o?Yt(o,r.tableTop):W(Pd,f),m=W(wd,f),h=n+xd;Q(e,s,void 0,()=>h,n+Ed,u,W(u,.86),z),Q(e,l(.12),void 0,()=>h+.12,h,m,W(m,.8),z)}var Pd=[.93,.92,.89],wd=[.78,.66,.42],_d=.62,Ed=.25,zn={armM:1.1,widthM:.28,insideM:1.4,low:.043,high:.048};function Ad(e,t,n){let o=e.reduce((x,g)=>x+g.x,0)/4,r=e.reduce((x,g)=>x+g.y,0)/4,i=e[3].x-e[0].x,s=e[3].y-e[0].y,a=Math.hypot(i,s)||1;i/=a,s/=a,i*(t.x-o)+s*(t.y-r)<0&&(i=-i,s=-s);let c=-s,l=i,f=zn.armM/_,u=zn.widthM/_,m=a/2+zn.insideM/_,h=n?-1:1,d=o+i*(m+(n?0:f)),p=r+s*(m+(n?0:f)),y=(x,g)=>({x:d+i*x*h+c*g,y:p+s*x*h+l*g});return[y(0,0),y(-f,f),y(-f-u,f),y(-u,0),y(-f-u,-f),y(-f,-f)]}function Cd(e,t,n,o,r){let i=[.94,.95,.96];Q(e,Ad(t,o,r),void 0,()=>n+zn.high,n+zn.low,i,i,z)}function Vo(e,t){let n=be(e);return n?{top:W(Pt(n,.12),.95),wall:W(Pt(n,.12),.85)}:{top:t.tierTop,wall:t.tierWall}}function kc(e,t,n,o,r,i,s,a,c=[]){let l=he(t),f=la(t);if(!t.role&&(!t.fill||t.fill==="none"||t.fill==="transparent")||!l){Yn(e,t,n+o+yd);return}let m=a?a.kind==="stage":t.role==="stage",h=a?a.kind==="screen":t.role==="screen",d=a?{kind:m?"stage":"solid",heightM:a.topY-a.baseY}:dt(t),p=a?.baseY??n,y=a?.topY??n+o,x=null;if(m&&s){let k=1/0,E=-1/0,A=1/0,O=-1/0;for(let F of l)F.x<k&&(k=F.x),F.x>E&&(E=F.x),F.y<A&&(A=F.y),F.y>O&&(O=F.y);x={cx:(k+E)/2*_,cz:(A+O)/2*_,y,halfX:Math.max((E-k)/2*_,.5),halfZ:Math.max((O-A)/2*_,.5)},s.push(x)}let g=be(t.fill),S=t.role==="wall"||t.role==="entrance"||t.role==="exit",w=S?Vo(t.fill,r).top:m&&g?ce(r.stageTop,W(Pt(g,.18),.9),.9):!t.role&&g?g:Yt(g,m?r.stageTop:r.decorTop),b=S?Vo(t.fill,r).wall:m?g?ce(r.stageWall,W(g,.58),.82):r.stageWall:h?Os(h?g:null):Yt(be(t.fill),r.decorWall),R=m&&Ft(r)?rn(!0):null,P=R?_c(w,R.stageTop):w,M=R?_c(b,R.stageWall):b;if(x&&(x.top=P),t.role==="wall"&&!a){No(e,l,p,y,c,P,M,i),Yn(e,t,y+.012);return}if(h&&l.length===4&&y-p>.2){let k=Kr(l,p,y);if(!k)return;let{quad:E,side:A,trim:O,inner:F,panel:L}=k,B=[.12,.15,.18];for(let[D,j]of[[0,A],[1-A,1]])ye(e,qe(E,D,j),y,p,B,B);ye(e,F,p+O,p,B,B),ye(e,F,y,y-O,B,B),ye(e,L,y-O,p+O,M,M),Yn(e,t,y+.012);return}let C=g?W(Pt(g,.15),.82):M,T=g?W(Pt(g,.1),1.02):P;if(Sc(t.role)&&!a&&Rc(e,t.role,l,p,y,C,T,i,t.heightM!==void 0))return;if((t.role==="sound"||a?.kind==="sound_desk")&&l.length===4&&y-p>.3){let k=st(l),E=Math.hypot(k[1].x-k[0].x,k[1].y-k[0].y)*_,A=Math.min(.12,.09/Math.max(E,.001)),O=[.18,.21,.24],F=y-Math.min(.12,(y-p)*.15);for(let[L,B]of[[0,A],[1-A,1]])ye(e,qe(k,L,B),F,p,O,O);ye(e,k,y,F,P,O);return}if(t.role==="rail"&&l.length===4&&y>p){let k=st(l),E=Math.hypot(k[1].x-k[0].x,k[1].y-k[0].y)*_,A=Math.max(1,Math.min(128,Math.ceil(E/1.4))),O=Math.min(.08,.055/Math.max(.055,E)),F=[.58,.64,.66];for(let L=0;L<=A;L++){let B=L/A,D=Math.min(1-O,Math.max(0,B-O/2));ye(e,qe(k,D,D+O),y,p,F,W(F,.8))}for(let L of[.52,1]){let B=p+(y-p)*L;ye(e,k,B,Math.max(p,B-.055),F,W(F,.8))}return}if(t.role==="goal"&&l.length===4){Ta(e,st(l),i,p,y),e.setMaterial(0);return}if(d.kind==="portal"&&l.length===4){let k=Rn(l,p,y);if(!k)return;let{quad:E,side:A,face:O,openingTop:F}=k;for(let[L,B,D]of[[0,O,1],[O,1-O,.67],[1-O,1,1]]){let j=Dn(E,L,B),H=W(P,D),V=W(M,D);for(let[U,$]of[[0,A],[1-A,1]])ye(e,qe(j,U,$),F,p,H,V);ye(e,j,y,F,H,V)}(t.role==="entrance"||t.role==="exit")&&Cd(e,E,p,i,t.role==="exit");return}if(d.kind==="suite"&&l.length===4){let k=l.map((O,F)=>{let L=l[(F+1)%4],B=(O.x+L.x)/2,D=(O.y+L.y)/2;return Math.hypot(B-i.x,D-i.y)}),E=k.indexOf(Math.min(...k)),A=[0,1,2,3].map(O=>l[(E+O)%4]);ye(e,qe(A,0,.08),y,p,P,M),ye(e,qe(A,.92,1),y,p,P,M),ye(e,Dn(A,.88,1),y,p,P,M),ye(e,A,y,Math.max(p,y-.18),P,M);return}if(m&&!t.stageKind?.startsWith("pitch-")&&y-p>.12){let k=y-Math.min(.06,(y-p)*.15);ye(e,l,k,p,P,M,f),ye(e,l,y,k,P,ce(P,M,.2),f)}else ye(e,l,y,p,P,M,f);if((t.stageKind==="pitch-football"||t.stageKind==="pitch-rugby")&&l.length===4){e.setMaterial(4);let k=st(l),E=ce(g??jo,jo,g?.45:0);for(let A=0;A<12;A++){let O=qe(k,A/12,(A+1)/12),F=W(E,A%2?1.09:.91),L=O.map(B=>[B.x*_,y+.006,B.y*_]);e.tri(L[0],L[1],L[2],[0,1,0],F),e.tri(L[0],L[2],L[3],[0,1,0],F)}}t.stageKind&&t.stageKind!=="pitch-football"&&Va(e,l,t.stageKind,y,g,t),m&&ot(t.stageKind)&&ja(e,t,y),e.setMaterial(h?1:0),Yn(e,t,y+.012)}function Ko(e){let{x:t,y:n,width:o,height:r}=e;if(!o||!r)return null;let i=t+o/2,s=n+r/2,a=(e.rotation??0)*Math.PI/180,c=Math.cos(a),l=Math.sin(a),f=o/2,u=r/2;return[[-f,-u],[f,-u],[f,u],[-f,u]].map(([m,h])=>({x:i+m*c-h*l,y:s+m*l+h*c}))}function kd(e){if(!e||!e.startsWith("data:image/svg+xml"))return null;let t=e.slice(e.indexOf(",")+1);if(/;base64/i.test(e.slice(0,e.indexOf(","))))try{t=atob(t)}catch{return null}else try{t=decodeURIComponent(t)}catch{}let n=t.match(/<(?:rect|path)\b[^>]*\bfill="([^"]+)"/i);if(!n)return null;let o=n[1].trim();if(o==="none"||o==="transparent")return null;let r=o.match(/^url\(#([^)]+)\)$/);if(!r)return be(o);let i=t.match(new RegExp(`<(?:linear|radial)Gradient\\b[^>]*\\bid="${r[1]}"[^>]*>([\\s\\S]*?)</(?:linear|radial)Gradient>`,"i"));if(!i)return null;let s=[];for(let a of i[1].matchAll(/stop-color="([^"]+)"/gi)){let c=be(a[1].trim());c&&s.push(c)}return s.length?s.reduce((a,c,l)=>ce(a,c,1/(l+1)),s[0]):null}function vc(e,t,n,o){if(t.layer==="foreground")return;let r=Ko(t);if(!r)return;let i=n+Md,s=Yt(kd(t.href),o.decorTop),a=Math.max(0,Math.min(1,t.opacity??1));a<1&&(s=ce(o.ground,s,a)),Q(e,r,void 0,()=>i,n,s,ce(s,o.decorWall,.5),z)}function Oc(e,t,n,o,r){if(!t.points||t.points.length<3)return;let i=vs(o,r.gaTop);e.setMaterial(vd),Q(e,t.points,t.holes,()=>n+Zn,n,i,r.gaWall,z),e.setMaterial(0),Ld(e,t.points,n+Zn)}var vd=13,Zn=.15,Ho=[.72,.74,.76],zr=1.1,wc=.12,Zr=.05,Od=.06,Td=2.4;function Ld(e,t,n){let o=Rt([...t]),r=lt(o,wc/_),i=lt(o,(wc+Zr)/_);if(r.length<3||i.length<3)return;for(let a of[n+zr,n+zr*.5])Q(e,r,[i.slice().reverse()],()=>a,a-Zr,Ho,W(Ho,.85),z);let s=Od/2/_;for(let a=0;a<r.length;a++){let c=r[a],l=r[(a+1)%r.length],f=Math.hypot(l.x-c.x,l.y-c.y)*_,u=Math.max(1,Math.round(f/Td));for(let m=0;m<u;m++){let h=m/u,d=c.x+(l.x-c.x)*h,p=c.y+(l.y-c.y)*h,y=[{x:d-s,y:p-s},{x:d+s,y:p-s},{x:d+s,y:p+s},{x:d-s,y:p+s}];Q(e,y,void 0,()=>n+zr-Zr,n,Ho,W(Ho,.8),z)}}}function _c(e,t){return ho(e)<t?Wt(e,t):e}var we={stepM:.79,spacingM:.45,tries:8,edgeM:.35,heightM:[1.5,1.78],capDesktop:6e3,capSmall:2e3,smallCeiling:3e4,maxCellsPerArea:6e4,maxCellsPerVenue:24e4,behind:{levelM:.6,clearM:6,fullM:14,from:.3,sideM:4},clothes:8,skins:4,hairs:5};function Nc(e,t,n=!0){if(!n)return 0;let o=t<=we.smallCeiling?we.capSmall:we.capDesktop;return Math.max(0,Math.min(o,Math.floor(t-e)))}function Dc(){let e=globalThis;return(e.navigator?.hardwareConcurrency??8)<=4||(e.navigator?.deviceMemory??8)<=4||(e.matchMedia?.("(pointer: coarse)").matches??!1)?we.smallCeiling:we.smallCeiling*2}var Tc=[[1,0],[.92388,.382683],[.707107,.707107],[.382683,.92388],[0,1],[-.382683,.92388],[-.707107,.707107],[-.92388,.382683],[-1,0],[-.92388,-.382683],[-.707107,-.707107],[-.382683,-.92388],[0,-1],[.382683,-.92388],[.707107,-.707107],[.92388,-.382683]],Bd=[[.939693,-.34202],[.954588,-.29793],[.967415,-.253195],[.978148,-.207912],[.986762,-.162178],[.993238,-.116093],[.997564,-.069756],[.999729,-.023269],[.999729,.023269],[.997564,.069756],[.993238,.116093],[.986762,.162178],[.978148,.207912],[.967415,.253195],[.954588,.29793],[.939693,.34202]];function Ot(e,t,n,o){let r=Math.imul(e|0,2654435761)^Math.imul(t|0,2246822519)^Math.imul(n|0,3266489917)^Math.imul(o|0,668265263);return r^=r>>>15,r=Math.imul(r,739982445),r^=r>>>12,r=Math.imul(r,695872825),r^=r>>>15,r>>>0}var Wo=e=>e/4294967296;function Lc(e,t,n){let o=!1;for(let r=0,i=e.length-1;r<e.length;i=r++){let s=e[r],a=e[i];s.y>n!=a.y>n&&t<(a.x-s.x)*(n-s.y)/(a.y-s.y)+s.x&&(o=!o)}return o}function Bc(e,t,n){let o=1/0;for(let r=0,i=e.length-1;r<e.length;i=r++){let s=e[r],a=e[i],c=a.x-s.x,l=a.y-s.y,f=c*c+l*l,u=f>0?Math.max(0,Math.min(1,((t-s.x)*c+(n-s.y)*l)/f)):0,m=t-(s.x+c*u),h=n-(s.y+l*u);o=Math.min(o,m*m+h*h)}return o}var Gc=(e,t)=>(e+32768)*65536+(t+32768);function Fd(e,t){let n=e.focal;if(!n)return null;let o=Math.sqrt(we.behind.fullM*we.behind.fullM+we.behind.sideM*we.behind.sideM)/_,r=1/0,i=1/0,s=-1/0,a=-1/0;for(let u of e.points)r=Math.min(r,u.x),s=Math.max(s,u.x),i=Math.min(i,u.y),a=Math.max(a,u.y);let c=4/_,l=new Map,f=[];for(let u of t){if(u.floorIndex!==e.floorIndex||u.x<r-o||u.x>s+o||u.y<i-o||u.y>a+o||Math.abs(u.deckY-e.floorY)>we.behind.levelM)continue;let m=n.x-u.x,h=n.y-u.y,d=Math.sqrt(m*m+h*h);if(!(d>0))continue;let p=Gc(Math.floor(u.x/c),Math.floor(u.y/c)),y=l.get(p);y||l.set(p,y=[]),y.push(f.length),f.push(u.x,u.y,m/d,h/d)}return f.length?{cell:c,cells:l,data:f}:null}function Nd(e,t,n){let{clearM:o,fullM:r,from:i,sideM:s}=we.behind,a=Math.floor(t/e.cell),c=Math.floor(n/e.cell),l=1;for(let f=c-4;f<=c+4;f++)for(let u=a-4;u<=a+4;u++){let m=e.cells.get(Gc(u,f));if(m)for(let h of m){let d=(t-e.data[h])*_,p=(n-e.data[h+1])*_,y=e.data[h+2],x=e.data[h+3],g=d*y+p*x;if(!(g<=0||g>=r)&&!(Math.abs(d*x-p*y)>s)){if(g<o)return 0;l=Math.min(l,i+(1-i)*(g-o)/(r-o))}}}return l}function Fc(e,t,n,o,r){return(Math.ceil(t/r)-Math.floor(e/r)+1)*(Math.ceil(o/r)-Math.floor(n/r)+1)}function Dd(e,t,n,o,r){let i=we.stepM/_,s=Fc(e,t,n,o,i);if(s<=r)return i;let a=i*Math.sqrt(s/r);for(let c=0;c<400&&Fc(e,t,n,o,a)>r;c++)a*=1.05;return a}function Gd(e,t,n,o){if(e.points.length<3||!(e.capacity>0))return[];let r=we.edgeM/_,i=r*r,s=1/0,a=1/0,c=-1/0,l=-1/0;for(let I of e.points)s=Math.min(s,I.x),c=Math.max(c,I.x),a=Math.min(a,I.y),l=Math.max(l,I.y);if(!Number.isFinite(s+c+a+l))return[];let f=Dd(s,c,a,l,o),u=Fd(e,n),m=[],h=we.spacingM/_,d=h*h,p=Math.floor(a/f),y=Math.ceil(l/f),x=Math.floor(s/f),g=Math.ceil(c/f),S=g-x+1,w=new Int32Array(S*(y-p+1)).fill(-1);for(let I=p;I<=y;I++)for(let b=x;b<=g;b++)for(let R=0;R<we.tries;R++){let P=(b+Wo(Ot(b,I,t,10+R*2)))*f,M=(I+Wo(Ot(b,I,t,11+R*2)))*f;if(!Lc(e.points,P,M)||Bc(e.points,P,M)<i||e.holes?.some(v=>v.length>=3&&(Lc(v,P,M)||Bc(v,P,M)<i)))continue;let C=!0;for(let v=-1;v<=0&&C;v++)for(let k=-1;k<=1&&C&&!(v===0&&k>=0);k++){let E=b+k-x,A=I+v-p;if(E<0||E>=S||A<0)continue;let O=w[A*S+E];if(O<0)continue;let F=m[O].x-P,L=m[O].y-M;F*F+L*L<d&&(C=!1)}if(!C)continue;let T=u?Nd(u,P,M):1;if(T<=0||T<1&&Wo(Ot(b,I,t,3))>=T)break;w[(I-p)*S+(b-x)]=m.length,m.push({x:P,y:M,i:b,j:I,order:Ot(b,I,t,4),thinned:T<1});break}return m}function Hd(e,t,n=we.capDesktop){if(!(n>0)||!e.length)return null;let o=Math.max(64,Math.min(we.maxCellsPerArea,Math.floor(we.maxCellsPerVenue/e.length))),r=e.map((m,h)=>{let d=Gd(m,h,t,o);return d.sort((p,y)=>p.order-y.order||p.j-y.j||p.i-y.i),d.slice(0,Math.min(d.length,Math.floor(m.capacity)))}),i=r.reduce((m,h)=>m+h.length,0);if(!i)return null;let s=i>n?r.map(m=>m.slice(0,Math.floor(m.length*n/i))):r,a=s.reduce((m,h)=>m+h.length,0);if(!a)return null;let c={count:a,iPosition:new Float32Array(a*3),iFacing:new Float32Array(a*2),iHeight:new Float32Array(a),iTone:new Float32Array(a),iFloor:new Float32Array(a)},[l,f]=we.heightM,u=0;return s.forEach((m,h)=>{let d=e[h];for(let p of m){c.iPosition[u*3]=p.x*_,c.iPosition[u*3+1]=d.floorY,c.iPosition[u*3+2]=p.y*_;let y=Wo(Ot(p.i,p.j,h,5));c.iHeight[u]=l+y*(f-l)*(p.thinned?.5:1),c.iTone[u]=Ot(p.i,p.j,h,9)%we.hairs*(we.clothes*we.skins)+Ot(p.i,p.j,h,6)%we.clothes*we.skins+Ot(p.i,p.j,h,7)%we.skins,c.iFloor[u]=d.floorIndex;let x=Ot(p.i,p.j,h,8)&15,g=Tc[x][0],S=Tc[x][1];if(d.focal){let w=d.focal.x-p.x,I=d.focal.y-p.y,b=Math.sqrt(w*w+I*I);if(b>0){let[R,P]=Bd[x];g=(w*R-I*P)/b,S=(w*P+I*R)/b}}c.iFacing[u*2]=g,c.iFacing[u*2+1]=S,u++}}),c}function Hc(e,t,n){try{return Hd(e,t,n)}catch{return null}}var $r=.6,jc=3,jd=.25,Vd=6;function Ud(e,t,n,o){let r=1/0;for(let i=0,s=o.length-1;i<o.length;s=i++){let a=o[s],c=o[i],l=c.x-a.x,f=c.y-a.y,u=t*f-n*l;if(Math.abs(u)<1e-12)continue;let m=((a.x-e.x)*f-(a.y-e.y)*l)/u,h=((a.x-e.x)*n-(a.y-e.y)*t)/u;m>1e-9&&h>=-1e-9&&h<=1+1e-9&&(r=Math.min(r,m))}return r}function Xd(e,t){if(Ve(t,e.x,e.y))return 0;let n=1/0;for(let o=0,r=t.length-1;o<t.length;r=o++){let i=t[r],s=t[o],a=s.x-i.x,c=s.y-i.y,l=a*a+c*c||1,f=Math.max(0,Math.min(1,((e.x-i.x)*a+(e.y-i.y)*c)/l));n=Math.min(n,Math.hypot(e.x-(i.x+f*a),e.y-(i.y+f*c)))}return n}function Vc(e,t){return new Map([...Kd(e,t)].map(([n,o])=>[n,o.toward]))}function Kd(e,t){let n=e.map(s=>({booth:s,ring:yt(s)})).filter(s=>!!s.ring&&s.ring.length===4&&!s.booth.points),o=n.map(({ring:s})=>({minX:Math.min(...s.map(a=>a.x)),maxX:Math.max(...s.map(a=>a.x)),minY:Math.min(...s.map(a=>a.y)),maxY:Math.max(...s.map(a=>a.y))})),r=(jc+$r)/_,i=new Map;return n.forEach(({booth:s,ring:a},c)=>{let l={x:a.reduce((d,p)=>d+p.x,0)/4,y:a.reduce((d,p)=>d+p.y,0)/4},f=[0,1,2,3].map(d=>{let p=a[d],y=a[(d+1)%4],x={x:(p.x+y.x)/2,y:(p.y+y.y)/2},g=x.x-l.x,S=x.y-l.y,w=Math.hypot(g,S)||1,I={x:x.x+g/w*$r/_,y:x.y+S/w*$r/_},b=jc/_;return o.forEach((R,P)=>{P===c||I.x<R.minX-r||I.x>R.maxX+r||I.y<R.minY-r||I.y>R.maxY+r||(b=Math.min(b,Xd(I,n[P].ring)))}),{open:b*_,toward:{x:x.x+g/w*10/_,y:x.y+S/w*10/_},focal:Math.hypot(x.x-t.x,x.y-t.y),normal:{x:g/w,y:S/w},halfDepthM:w*_,halfWidthM:Math.hypot(y.x-p.x,y.y-p.y)*_/2,mid:x}}),u=Math.max(...f.map(d=>d.open)),m=f.filter(d=>d.open>=u-jd).sort((d,p)=>d.focal-p.focal)[0],h=Vd/_;n.forEach((d,p)=>{p!==c&&(h=Math.min(h,Ud(m.mid,m.normal.x,m.normal.y,d.ring)))}),i.set(s.id,{toward:m.toward,normal:m.normal,halfDepthM:m.halfDepthM,halfWidthM:m.halfWidthM,aisleM:h*_})}),i}var Uc=xt(require("polygon-clipping"),1);var Wd=.45,Yd=1500,zd=200;function Xc(e,t){if(e.role!=="stage"||ot(e.stageKind))return e;let n=he(e);if(!n||n.length<3||Math.abs(rt(n))*_*_>Yd)return e;let o=t.filter(s=>Ve(n,s.x,s.y));if(!o.length||o.length>zd)return e;let r=Wd/_,i=o.map(s=>[[[s.x-r,s.y-r],[s.x+r,s.y-r],[s.x+r,s.y+r],[s.x-r,s.y+r],[s.x-r,s.y-r]]]);try{let s=Uc.default.difference([[...n.map(l=>[l.x,l.y]),[n[0].x,n[0].y]]],...i),a=null,c=0;for(let l of s){let f=l[0].slice(0,-1).map(([m,h])=>({x:m,y:h})),u=Math.abs(rt(f));u>c&&(c=u,a=f)}return!a||a.length<3?e:{...e,kind:"polygon",points:a,rotation:0}}catch{return e}}var Zd=Math.PI/180,Me=96,$d=6,Qd=60,qd=150,Kc=.2,Jd=.35;function ep(e,t){let n=Math.atan2(t.x-e.x,t.y-e.y)/Zd;return n<0?n+360:n}function Yo(e){if(!e.length)return NaN;let t=[...e].sort((n,o)=>n-o);return t[Math.floor(t.length/2)]}function zo(e,t,n=2){let o=e.length,r=new Float64Array(o);for(let i=0;i<o;i++){let s=0,a=0;for(let c=-n;c<=n;c++){let l=i+c;if(t)l=(l%o+o)%o;else if(l<0||l>=o)continue;s+=e[l],a++}r[i]=s/a}return r}function Wc(e,t){let n=e.filter(m=>m.rows.length>=1);if(n.length<1)return null;let o=[],r=0,i=0,s=0;for(let m of n)for(let h of m.rows){for(let d of h.pts)r+=d.x,i+=d.y,s++;if(h.pts.length>=4){let d=ar(h.pts);d&&Number.isFinite(d.cx)&&Number.isFinite(d.cy)&&o.push({x:d.cx,y:d.cy})}}if(!s)return null;let a={x:r/s,y:i/s},c=a;if(o.length>=8){let m=Yo(o.map(x=>x.x)),h=Yo(o.map(x=>x.y)),d=0;for(let x of n)for(let g of x.rows)for(let S of g.pts){let w=Math.hypot(S.x-a.x,S.y-a.y);w>d&&(d=w)}let p=0,y=d*.2;for(let x of n)for(let g of x.rows)for(let S of g.pts)Math.hypot(S.x-m,S.y-h)<y&&p++;Math.hypot(m-a.x,h-a.y)<=d&&p/s<.01&&(c={x:m,y:h})}let l=[];for(let m of n){let h={sectionId:m.sectionId,rMin:1/0,rMax:-1/0,samples:[]};for(let d of m.rows)for(let p of d.pts){let y=Math.hypot(p.x-c.x,p.y-c.y),x=Math.min(Me-1,Math.floor(ep(c,p)/(360/Me)));h.samples.push({r:y,bin:x,levelM:d.levelM}),y<h.rMin&&(h.rMin=y),y>h.rMax&&(h.rMax=y)}h.samples.length&&l.push(h)}if(!l.length)return null;l.sort((m,h)=>m.rMin+m.rMax-(h.rMin+h.rMax));let f=[];for(let m of l){let h=!1;for(let d of f){let p=Math.min(m.rMax,d.rMax)-Math.max(m.rMin,d.rMin),y=Math.min(m.rMax-m.rMin,d.rMax-d.rMin);if(y>1e-9&&p>=Jd*y){d.members.push(m),d.rMin=Math.min(d.rMin,m.rMin),d.rMax=Math.max(d.rMax,m.rMax),h=!0;break}}h||f.push({members:[m],rMin:m.rMin,rMax:m.rMax})}let u=[];for(let m of f){let h=new Array(Me).fill(null);for(let k of m.members)for(let E of k.samples){let A=h[E.bin];A||(A={samples:[]},h[E.bin]=A),A.samples.push({r:E.r,levelM:E.levelM})}let d=h.map(k=>!!k);if(!d.filter(Boolean).length)continue;let y=[],x=[];for(let k of h){if(!k)continue;let E=1/0,A=-1/0;for(let O of k.samples)O.r<E&&(E=O.r),O.r>A&&(A=O.r);y.push(E),x.push(A)}let g=Yo(y),S=Yo(x);if(!(g>=Kc*S)||!(S>0))continue;let w=[...y].sort((k,E)=>k-E);if(!(w[Math.floor(w.length*.1)]>=Kc*S))continue;let b=h.map(k=>{if(!k)return null;let E=[...k.samples].sort((H,V)=>H.r-V.r),A=E[0].r,O=E[E.length-1].r,F=E[0].levelM,L=-1/0;for(let H of E)H.levelM>L&&(L=H.levelM);let B=[];for(let H of E){let V={r:H.r,l:H.levelM};for(;B.length&&Math.abs(B[B.length-1].r-V.r)<1e-9;){if(B[B.length-1].l<=V.l){V.skip=!0;break}B.pop()}if(!V.skip){for(;B.length>=2;){let U=B[B.length-2],$=B[B.length-1];if(($.r-U.r)*(V.l-U.l)-($.l-U.l)*(V.r-U.r)<=0)B.pop();else break}B.push(V)}}let D=B.map(H=>H.r),j=B.map(H=>H.l);return{inner:A,outer:O,front:F,top:L,profile:{rs:D,ls:j}}}),R=d.slice();for(let k=0;k<Me;k++){if(R[k])continue;let E=-1,A=-1,O=0;for(let X=1;X<=Me;X++){let Y=(k-X+Me*2)%Me;if(R[Y]){E=Y;break}}for(let X=1;X<=Me;X++){let Y=(k+X)%Me;if(R[Y]){A=Y,O=X;break}}if(E<0||A<0)continue;let F=0;for(let X=1;X<=Me;X++){let Y=(k-X+Me*2)%Me;if(d[Y]){F=X;break}}if(F-1+O>$d)continue;let B=b[E],D=b[A],j=F/(F+O),H=B.inner+(D.inner-B.inner)*j,V=B.outer+(D.outer-B.outer)*j,U=B.front+(D.front-B.front)*j,$=B.top+(D.top-B.top)*j;b[k]={inner:H,outer:V,front:U,top:$,profile:{rs:[H,V],ls:[U,$]}}}for(let k=0;k<Me;k++)b[k]&&(R[k]=!0);let P=360/Me,M=[],C=R.filter(Boolean).length,T=[];if(C===Me)T.push({start:0,len:Me});else{let k=0;for(;R[k];)k=(k+1)%Me;let E=-1;for(let A=0;A<=Me;A++){let O=(k+A)%Me,F=A<Me&&R[O];if(F&&E<0)E=O;else if(!F&&E>=0){let L=(O-E+Me)%Me||Me;T.push({start:E,len:L}),E=-1}}}for(let k of T){if(k.len*P<Qd&&k.len<Me)continue;let E=k.len===Me,A=new Float64Array(k.len),O=new Float64Array(k.len),F=new Float64Array(k.len),L=new Float64Array(k.len),B=[];for(let X=0;X<k.len;X++){let Y=b[(k.start+X)%Me];A[X]=Y.inner,O[X]=Y.outer,F[X]=Y.front,L[X]=Y.top,B.push(Y.profile??{rs:[Y.inner,Y.outer],ls:[Y.front,Y.top]})}let D=zo(A,E),j=zo(O,E),H=zo(F,E),V=zo(L,E);for(let X=0;X<k.len;X++)D[X]>A[X]&&(D[X]=A[X]),j[X]<O[X]&&(j[X]=O[X]),D[X]>j[X]-1e-6&&(D[X]=Math.max(0,j[X]-1e-6)),V[X]<H[X]&&(V[X]=H[X]);let U={startBin:k.start,binCount:k.len,closed:E,innerR:D,outerR:j,frontLevelM:H,topLevelM:V,profiles:B},$=(X,Y,Z)=>{let ae=B[X],me=ae.rs,le=ae.ls;if(Y<=me[0]){le[0]>Z&&(le[0]=Z);return}if(Y>=me[me.length-1]){le[le.length-1]>Z&&(le[le.length-1]=Z);return}for(let pe=0;pe+1<me.length;pe++)if(Y<=me[pe+1]){le[pe]>Z&&(le[pe]=Z),le[pe+1]>Z&&(le[pe+1]=Z);return}};for(let X=0;X<k.len;X++){let Y=h[(k.start+X)%Me];if(Y)for(let Z of Y.samples){$(X,Z.r,Z.levelM);let ae=E?(X-1+k.len)%k.len:X-1,me=E?(X+1)%k.len:X+1;ae>=0&&$(ae,Z.r,Z.levelM),me<k.len&&$(me,Z.r,Z.levelM)}}M.push(U)}M.reduce((k,E)=>k+E.binCount*P,0)<qd||u.push({arcs:M,sectionIds:m.members.map(k=>k.sectionId),innerRMedian:g,outerRMedian:S})}if(!u.length)return null;if(u.sort((m,h)=>m.innerRMedian-h.innerRMedian),t){let m=u[u.length-1].outerRMedian;if(Math.hypot(t.x-c.x,t.y-c.y)>.9*m)return null}return{centre:c,binCount:Me,binStepDeg:360/Me,rings:u}}function Yc(e,t,n,o){let r=e.binStepDeg,i=n/r-.5-t.startBin;i=(i%e.binCount+e.binCount)%e.binCount,i>t.binCount-1&&(t.closed?i=i-t.binCount<t.binCount-i?0:t.binCount-1:i=i-(t.binCount-1)<e.binCount-i?t.binCount-1:0);let s=Math.floor(i),a=t.closed?(s+1)%t.binCount:Math.min(t.binCount-1,s+1),c=i-s,l=f=>{let u=t.profiles[f],m=u.rs,h=u.ls;if(o<=m[0])return h[0];if(o>=m[m.length-1])return h[h.length-1];for(let d=0;d+1<m.length;d++)if(o<=m[d+1]){let p=m[d+1]-m[d],y=p>1e-9?(o-m[d])/p:0;return h[d]+(h[d+1]-h[d])*y}return h[h.length-1]};return l(s)*(1-c)+l(a)*c}function Qr(e,t,n,o,r,i,s,a,c,l=[],f=r){if(t.length!==n.length||t.length<2||i-r<1.5)return;let u=(p,y,x)=>{vt(e,p,y,x,l,s,a,{portalBase:f,ao:c})||Q(e,p,void 0,()=>x,y,s,a,c)},m=(p,y,x)=>({x:p.x+(y.x-p.x)*x,y:p.y+(y.y-p.y)*x}),h=o?t.length:t.length-1,d=0;for(let p=0;p<h;p++){let y=(p+1)%t.length,x=Math.hypot(n[y].x-n[p].x,n[y].y-n[p].y)*re;if(x<1e-5)continue;let g=(b,R)=>[m(t[p],t[y],b),m(t[p],t[y],R),m(n[p],n[y],R),m(n[p],n[y],b)];u(g(0,1),r,r+.95),u(g(0,1),i-.22,i);let S=Math.ceil((d-.32)/6)*6,w=!1,I=!1;for(let b=S;b<d+x;b+=6){let R=Math.max(0,(b-d)/x),P=Math.min(1,(b+.32-d)/x);P<=R||(u(g(R,P),r+.95,i-.22),w||=R<1e-6,I||=P>1-1e-6)}if(!o&&(p===0&&!w||p===h-1&&!I)){let b=Math.min(1,.32/x);u(g(p===0?0:1-b,p===0?b:1),r+.95,i-.22)}d+=x}}var jt=xt(require("polygon-clipping"),1),Qn=.65;function qr(e,t){let n=1/0;for(let o of t)for(let r=0;r<o.length;r++){let i=o[r],s=o[(r+1)%o.length],a=s.x-i.x,c=s.y-i.y,l=Math.max(0,Math.min(1,((e.x-i.x)*a+(e.y-i.y)*c)/(a*a+c*c||1)));n=Math.min(n,Math.hypot(e.x-i.x-l*a,e.y-i.y-l*c))}return n}var Jr=.01;function zc(e,t,n,o,r,i,s,a=[],c=!0,l={bays:[],walls:[]}){if(o-r<=1e-5)return;let f=o-r>=3,u=f?o-Qn:r;e.setMaterial(5);let m=f?[]:a.filter(b=>{if(b.role!=="entrance"&&b.role!=="exit")return!1;let R=he(b);if(!R)return!1;let P=Rn(R,r,r+dt(b).heightM);return P!==null&&P.openingTop<=o-.12});if((!m.length||!vt(e,t,u,o,m,i,s,{holes:n,portalBase:r}))&&Q(e,t,n,()=>o,u,i,s,z,void 0,()=>[0,1,0]),!f){e.setMaterial(0);return}let h=c&&l.bays.length?tp(t,n,lt(t,$n/_),l):null,d=6/_,p=.22/_,y=a.flatMap(b=>{if(b.role!=="entrance"&&b.role!=="exit")return[];let R=he(b);return R?.length?[{minX:Math.min(...R.map(P=>P.x)),maxX:Math.max(...R.map(P=>P.x)),minY:Math.min(...R.map(P=>P.y)),maxY:Math.max(...R.map(P=>P.y))}]:[]}),x=Math.min(...t.map(b=>b.x)),g=Math.max(...t.map(b=>b.x)),S=Math.min(...t.map(b=>b.y)),w=Math.max(...t.map(b=>b.y));for(let b=x+d/2;b<g;b+=d)for(let R=S+d/2;R<w;R+=d){if(y.some(M=>b+p>=M.minX&&b-p<=M.maxX&&R+p>=M.minY&&R-p<=M.maxY))continue;let P=[{x:b-p,y:R-p},{x:b+p,y:R-p},{x:b+p,y:R+p},{x:b-p,y:R+p}];!Xe({x:b,y:R},t,n)||qr({x:b,y:R},[t,...n??[]])<p*Math.SQRT2+(c?$n/_:0)||h&&qr({x:b,y:R},h.flat())<p*Math.SQRT2+$n/_||Q(e,P,void 0,()=>u,r,i,s,z)}if(h){for(let[b,...R]of h)Q(e,b,R,()=>u,r-Jr,i,s,z);e.setMaterial(0);return}let I=lt(t,$n/_);if(c&&I.length>=3){let b=a.filter(M=>{if(M.role!=="entrance"&&M.role!=="exit")return!1;let C=he(M);return!!C&&C.some(T=>!Xe(T,t,void 0)||qr(T,[t])<=$n/_)}),R=[I.slice().reverse()],P=r-Jr;(!b.length||!vt(e,t,P,u,b,i,s,{holes:R,portalBase:r+Jr}))&&Q(e,t,R,()=>u,P,i,s,z)}e.setMaterial(0)}var ei=.25,$n=ei;function tp(e,t,n,o){if(n.length<3)return null;let r=s=>{let a=s.map(c=>[c.x,c.y]);return a.push(a[0]),a},i=s=>{let[a,...c]=s.map(l=>[r(l)]);return jt.default.union(a,...c)};try{let s=[r(e),...(t??[]).map(r)],a=jt.default.difference(s,[r(n)]),c=jt.default.intersection(s,i(o.bays));if(!c.length)return null;let l=jt.default.difference(jt.default.intersection(s,i(o.walls)),c);return jt.default.union(jt.default.difference(a,c),l).map(u=>u.map(m=>m.slice(0,-1).map(([h,d])=>({x:h,y:d}))))}catch{return null}}var np=.02,op=.25,rp=1.2,ip=.6,sp=.45,ap=2.3,cp=Math.PI/180,Zc=.005;function _t(e,t,n){let o=n*cp;return{x:e.x+t*Math.sin(o),y:e.y+t*Math.cos(o)}}function lp(e,t){let n=t.rings[t.rings.length-1];if(!n)return!1;let o=n.outerRMedian*.85;for(let r of e){if(r.role!=="wall")continue;let i=r.points&&r.points.length>=2?r.points:r.x!==void 0&&r.y!==void 0&&r.width!==void 0&&r.height!==void 0?[{x:r.x,y:r.y},{x:r.x+r.width,y:r.y},{x:r.x+r.width,y:r.y+r.height},{x:r.x,y:r.y+r.height}]:[];if(i.length<2)continue;let s=0;for(let a of i)Math.hypot(a.x-t.centre.x,a.y-t.centre.y)>=o&&s++;if(s>=i.length/2)return!0}return!1}var up=24,fp=.01;function mp(e,t,n,o,r,i,s,a,c){let l=n.binCount,f=up,u=re,m=i+.02,h=i-fp,d=[];for(let E=0;E<l;E++){let A=(n.startBin+E+.5)*t.binStepDeg,O=new Float64Array(f+1);for(let F=0;F<=f;F++){let L=o[E]+(r[E]-o[E])*F/f;O[F]=Math.max(m,Yc(t,n,A,L)-op)}d.push(O)}if(c){let E=0;for(let A=0;A+1<l;A++)for(let O=0;O<f;O++){let F=_t(t.centre,o[A]+(r[A]-o[A])*O/f,(n.startBin+A+.5)*t.binStepDeg),L=_t(t.centre,o[A+1]+(r[A+1]-o[A+1])*(O+1)/f,(n.startBin+A+1.5)*t.binStepDeg);E=Math.max(E,Math.hypot(L.x-F.x,L.y-F.y))}for(let A=0;A<l;A++){let O=(n.startBin+A+.5)*t.binStepDeg;for(let F=0;F<=f;F++){let L=_t(t.centre,o[A]+(r[A]-o[A])*F/f,O),B=c(L.x,L.y,E*1.01);B!==null&&(d[A][F]=Math.min(d[A][F],Math.max(h+Zc,B-Zc)))}}}let p=[s.bandTop[0]*a.top,s.bandTop[1]*a.top,s.bandTop[2]*a.top],y=[s.bandTop[0]*a.bottomCap,s.bandTop[1]*a.bottomCap,s.bandTop[2]*a.bottomCap],x=[s.bandWall[0]*a.top,s.bandWall[1]*a.top,s.bandWall[2]*a.top],g=[s.bandWall[0]*a.wallBottom,s.bandWall[1]*a.wallBottom,s.bandWall[2]*a.wallBottom],S=(E,A)=>{let O=(n.startBin+E+.5)*t.binStepDeg,F=o[E]+(r[E]-o[E])*A/f,L=_t(t.centre,F,O);return[L.x*u,d[E][A],L.y*u]};{let E=Math.tan(12*Math.PI/180);for(let A=0;A<6;A++){let O=!1;for(let L=0;L<l;L++)for(let B=f-1;B>=0;B--)d[L][B]>d[L][B+1]&&(d[L][B]=d[L][B+1],O=!0);let F=n.closed?l:l-1;for(let L=0;L<F;L++){let B=(L+1)%l;for(let D=0;D<=f;D++){let j=d[B][D]-d[L][D];if(Math.abs(j)>1)continue;let H=o[L]+(r[L]-o[L])*D/f,V=o[B]+(r[B]-o[B])*D/f,U=_t(t.centre,H,(n.startBin+L+.5)*t.binStepDeg),$=_t(t.centre,V,(n.startBin+B+.5)*t.binStepDeg),X=E*Math.hypot($.x-U.x,$.y-U.y)*u;j>X?(d[B][D]=d[L][D]+X,O=!0):-j>X&&(d[L][D]=d[B][D]+X,O=!0)}}if(!O)break}}let w=1,I=(E,A)=>{for(let O=0;O<=f;O+=4)if(Math.abs(d[E][O]-d[A][O])>w)return!0;return Math.abs(d[E][f]-d[A][f])>w},b=Math.tan(38*Math.PI/180),R=E=>(r[E]-o[E])/f*u,P=(E,A)=>d[E][A+1]-d[E][A]>b*Math.max(1e-6,R(E)),M=(E,A)=>{let O=n.closed?(E-1+l)%l:Math.max(0,E-1),F=n.closed?(E+1)%l:Math.min(l-1,E+1);Math.abs(d[O][A]-d[E][A])>w&&(O=E),Math.abs(d[F][A]-d[E][A])>w&&(F=E);let L=Math.max(0,A-1),B=Math.min(f,A+1);L<A&&P(E,L)&&(L=A),B>A&&P(E,A)&&(B=A);let D=S(O,A),j=S(F,A),H=S(E,L),V=S(E,B),U=j[0]-D[0],$=j[1]-D[1],X=j[2]-D[2],Y=V[0]-H[0],Z=V[1]-H[1],ae=V[2]-H[2],me=$*ae-X*Z,le=X*Y-U*ae,pe=U*Z-$*Y,ee=Math.hypot(me,le,pe);return ee>1e-12?(me/=ee,le/=ee,pe/=ee,le<0&&(me=-me,le=-le,pe=-pe),[me,le,pe]):[0,1,0]},C=(E,A,O=!1)=>{let F=O&&Math.min(E[1],A[1])-i>=3,L=[E[0],F?E[1]-Qn:h,E[2]],B=[A[0],F?A[1]-Qn:h,A[2]],D=A[0]-E[0],j=A[2]-E[2],H=Math.hypot(D,j);if(!(H>1e-12))return;let V=[j/H,0,-D/H];e.tri(E,A,B,V,x,x,g),e.tri(E,B,L,V,x,g,g)},T=.05*ct,v=E=>r[E]-o[E]<T,k=n.closed?l:l-1;for(let E=0;E<k;E++){let A=(E+1)%l;if(v(E)||v(A))continue;if(I(E,A)){let j=(n.startBin+E+1)*t.binStepDeg,H=(Z,ae)=>{let me=(o[E]+o[A])/2,le=(r[E]+r[A])/2,pe=me+(le-me)*ae/f,ee=_t(t.centre,pe,j);return[ee.x*u,d[Z][ae],ee.y*u]};for(let Z=0;Z<f;Z++){let ae=S(E,Z),me=S(E,Z+1),le=H(E,Z),pe=H(E,Z+1),ee=M(E,Z),q=M(E,Z+1);e.triN(ae,le,pe,ee,ee,q,p),e.triN(ae,pe,me,ee,q,q,p);let ie=S(A,Z),ne=S(A,Z+1),ue=H(A,Z),xe=H(A,Z+1),Re=M(A,Z),_e=M(A,Z+1);e.triN(ue,ie,ne,Re,Re,_e,p),e.triN(ue,ne,xe,Re,_e,_e,p);let We=H(E,Z),Oe=H(E,Z+1),at=H(A,Z+1),je=H(A,Z),Ye=Oe[0]-We[0],N=Oe[2]-We[2],G=Math.hypot(Ye,N);if(G>1e-12){let fe=[N/G,0,-Ye/G];e.tri(We,Oe,at,fe,x),e.tri(We,at,je,fe,x)}}let V=S(E,0),U=S(A,0),$=S(A,f),X=S(E,f),Y=Z=>[Z[0],h,Z[2]];Math.min(V[1],U[1])-i<3&&(e.tri(Y(V),Y($),Y(U),[0,-1,0],y),e.tri(Y(V),Y(X),Y($),[0,-1,0],y)),C(V,U,!0),C(X,$,!0);continue}for(let j=0;j<f;j++){let H=M(E,j),V=M(A,j),U=M(A,j+1),$=M(E,j+1);if(P(E,j)||P(A,j)){let me=(Oe,at)=>{let je=(n.startBin+Oe+.5)*t.binStepDeg,Ye=o[Oe]+(r[Oe]-o[Oe])*(j+.5)/f,N=_t(t.centre,Ye,je);return[N.x*u,at,N.y*u]},le=S(E,j),pe=S(A,j),ee=me(E,d[E][j]),q=me(A,d[A][j]);e.triN(le,pe,q,H,V,V,p),e.triN(le,q,ee,H,V,H,p);let ie=S(A,j+1),ne=S(E,j+1),ue=me(E,d[E][j+1]),xe=me(A,d[A][j+1]);e.triN(ue,xe,ie,$,U,U,p),e.triN(ue,ie,ne,$,U,$,p);let Re=q[0]-ee[0],_e=q[2]-ee[2],We=Math.hypot(Re,_e);if(We>1e-12){let Oe=[-_e/We,0,Re/We];e.tri(ee,q,xe,Oe,x),e.tri(ee,xe,ue,Oe,x)}continue}let X=S(E,j),Y=S(A,j),Z=S(A,j+1),ae=S(E,j+1);e.triN(X,Y,Z,H,V,U,p),e.triN(X,Z,ae,H,U,$,p)}let O=S(E,0),F=S(A,0),L=S(A,f),B=S(E,f),D=j=>[j[0],h,j[2]];Math.min(O[1],F[1])-i<3&&(e.tri(D(O),D(L),D(F),[0,-1,0],y),e.tri(D(O),D(B),D(L),[0,-1,0],y)),C(O,F,!0),C(B,L,!0)}if(!n.closed)for(let E of[0,l-1])for(let A=0;A<f;A++)C(S(E,A),S(E,A+1))}function $c(e,t,n){let{bottomY:o,colors:r,ao:i}=n,s=new Float64Array(t.binCount).fill(-1/0);for(let f of t.rings)for(let u of f.arcs){let m=new Float64Array(u.binCount),h=new Float64Array(u.binCount);for(let p=0;p<u.binCount;p++){let y=(u.startBin+p)%t.binCount,x=Math.max(0,u.innerR[p]-ut);m[p]=Math.max(x,s[y]+.001),h[p]=Math.max(m[p]+.001,u.outerR[p]+ut)}let d=0;for(let p=0;p<u.binCount;p++){let y=u.topLevelM[p]-o;y>d&&(d=y)}d>=rp&&mp(e,t,u,m,h,o,r,i,n.standTopNear);for(let p=0;p<u.binCount;p++){let y=(u.startBin+p)%t.binCount;h[p]>s[y]&&(s[y]=h[p])}}if(n.deriveShell===!1||lp(n.shapes,t))return;let a=t.rings[t.rings.length-1],c=ip*ct,l=sp*ct;for(let f of a.arcs){let u=[],m=[];for(let M=0;M<f.binCount;M++){let C=(f.startBin+M+.5)*t.binStepDeg,T=f.outerR[M]+ut+c;u.push(_t(t.centre,T,C)),m.push(_t(t.centre,T+l,C))}let h=-1/0;for(let M=0;M<f.binCount;M++)f.topLevelM[M]>h&&(h=f.topLevelM[M]);let d=h+ap,p=f.closed?m:[...m,...u.slice().reverse()],y=f.closed?[u.slice().reverse()]:void 0,x=ce(r.shellWall,[.66,.71,.72],.62),g=(M,C,T,v,k)=>{let E=Math.abs(v-h)<1e-6?v-np:v;vt(e,M,T,E,n.shapes,r.shellTop,k,{holes:C,portalBase:o,ao:i})||Q(e,M,C,()=>E,T,r.shellTop,k,i)},S=Math.max(1,Math.ceil((h-o)/4.5)),w=(h-o)/S,I=new Set,b=n.tierFrontLevels??t.rings.map(M=>{let C=M.arcs.flatMap(T=>Array.from(T.frontLevelM)).filter(Number.isFinite).sort((T,v)=>T-v);return C[Math.floor(C.length/2)]});for(let M of b)Number.isFinite(M)&&M-o>=3&&M<h&&I.add(Math.max(0,Math.min(S-1,Math.floor((M-o)/w))));let R=Math.min(...b.filter(M=>Number.isFinite(M)&&M-o>=3&&M<h));for(let M=0;M<S;M++)o+(M+1)*w<=R-Qn&&Number.isFinite(R)&&I.add(M);for(let M=0;M<S;M++){let C=o+(h-o)*M/S,T=o+(h-o)*(M+1)/S;I.has(M)&&T-C>=3.2?(g(p,y,C,C+.45,x),Qr(e,u,m,f.closed,C+.45,T-.16,r.shellTop,x,i,n.shapes,o)):g(p,y,C,T-.16,x),g(p,y,T-.16,T,W(x,.62))}Qr(e,u,m,f.closed,h,d,r.shellTop,x,i,n.shapes,o);let P=8;for(let M=1;M<m.length;M++){if(P+=Math.hypot(m[M].x-m[M-1].x,m[M].y-m[M-1].y)*re,P<8)continue;P=0;let C=m[M],T=m[M-1],v=C.x-T.x,k=C.y-T.y,E=Math.max(1,Math.hypot(v,k)),A=v/E*.16*ct,O=k/E*.16*ct,F=Math.max(1,Math.hypot(C.x-t.centre.x,C.y-t.centre.y)),L=(C.x-t.centre.x)/F*.24*ct,B=(C.y-t.centre.y)/F*.24*ct,D=[{x:C.x-A,y:C.y-O},{x:C.x+A,y:C.y+O},{x:C.x+A+L,y:C.y+O+B},{x:C.x-A+L,y:C.y-O+B}];g(D,void 0,o,h,W(x,1.12))}}}var hp=2.5,Qc=.65,dp=2,pp=.03;function bp(e,t){let n=()=>{let o=t;for(;e.length>2;){let r=e[0],i=e[1],s=Math.hypot(i.x-r.x,i.y-r.y);if(s>o){e[0]={x:r.x+(i.x-r.x)/s*o,y:r.y+(i.y-r.y)/s*o};return}o-=s,e.shift()}};n(),e.reverse(),n(),e.reverse()}function oi(e,t,n){let o=new Map;for(let i of e){let s=o.get(i.blockId);(!s||i.depth<s.depth)&&o.set(i.blockId,i)}let r=[];for(let[i,s]of o){if(s.y-n<hp||s.pts.length<2)continue;let a=s.pts.map(f=>{let u=f.x-t.x,m=f.y-t.y,h=Math.max(1,Math.hypot(u,m));return{x:f.x-u/h*Qc/_,y:f.y-m/h*Qc/_}}),c=[],l=[a[0]];for(let f=1;f<a.length;f++){let u=a[f-1],m=a[f];Math.hypot(m.x-u.x,m.y-u.y)*_>dp?(l.length>=2&&c.push(l),l=[m]):l.push(m)}l.length>=2&&c.push(l);for(let f of c)bp(f,pp/_);c.length&&r.push({blockId:i,y:s.y,runs:c})}return r}var qc=.1,yp=1.1,gp=.22,ti=.95,ni=.05,Jc=1.8;function el(e,t,n,o){let r=[.72,.72,.69],i=[.48,.55,.57];for(let s of oi(t,n,o)){let a=s.y;for(let c of s.runs){let l=Jc;for(let f=1;f<c.length;f++){let u=c[f-1],m=c[f],h=m.x-u.x,d=m.y-u.y,p=Math.hypot(h,d);if(p<1e-5)continue;let y=x=>{let g=-d/p*x/_/2,S=h/p*x/_/2;return[{x:u.x+g,y:u.y+S},{x:m.x+g,y:m.y+S},{x:m.x-g,y:m.y-S},{x:u.x-g,y:u.y-S}]};if(Q(e,y(gp),void 0,()=>a+qc,a-yp,r,r,z),Q(e,y(ni),void 0,()=>a+ti,a+ti-ni,i,i,z),l+=p*_,l>=Jc||f===c.length-1){l=0;let x=.028/_,g=[{x:u.x-x,y:u.y-x},{x:u.x+x,y:u.y-x},{x:u.x+x,y:u.y+x},{x:u.x-x,y:u.y+x}];Q(e,g,void 0,()=>a+ti-ni,a+qc,i,i,z)}}}}}var xp=.9,Mp=1.5,Sp=.3;function tl(e,t,n){let o=[],r=[],i=xp/_,s=Mp/_,a=Sp/_;for(let c of e)for(let l of c.runs){if(l.length<2)continue;let f=l.slice(),u=(y,x)=>{let g=f[y],S=f[x],w=Math.hypot(g.x-S.x,g.y-S.y)||1;f[y]={x:g.x+(g.x-S.x)/w*a,y:g.y+(g.y-S.y)/w*a}};u(0,1),u(f.length-1,f.length-2);let m=f.map((y,x)=>{let g=f[Math.max(0,x-1)],S=f[Math.min(f.length-1,x+1)],w=S.x-g.x,I=S.y-g.y,b=Math.hypot(w,I)||1,R=-I/b,P=w/b;return R*(y.x-t.x)+P*(y.y-t.y)<0&&(R=-R,P=-P),{nx:R,ny:P}}),h=f.map((y,x)=>({x:y.x-m[x].nx*s,y:y.y-m[x].ny*s})),d=f.map((y,x)=>({x:y.x+m[x].nx*i,y:y.y+m[x].ny*i})),p=f.map((y,x)=>({x:y.x+m[x].nx*(i+n/_),y:y.y+m[x].ny*(i+n/_)}));o.push([...h,...d.slice().reverse()]),r.push([...d,...p.reverse()])}return{bays:o,walls:r}}var ri=.88,Zo=.27,Rp=1.2,Ip=.01,Pp=7,wp=.05,_p=.25;function nl(e,t,n,o,r){let i=[.67,.71,.68],s=[i[0]*ri,i[1]*ri,i[2]*ri],a=c=>!!r&&r.some((l,f)=>f!==c&&l?.belowY!=null&&Math.abs(l.belowY-t[c].y)<1e-6&&t[f].blockId===t[c].blockId);for(let c=0;c<t.length;c++){let l=t[c];if(!(l.pts.length<2))for(let f of[0,l.pts.length-1]){let u=l.pts[f],m=l.pts[f===0?1:f-1],h=u.x-m.x,d=u.y-m.y,p=Math.hypot(h,d);if(p<1e-5)continue;h/=p,d/=p;let y=1/0;for(let A=0;A<n.length;A++){let O=n[A],F=n[(A+1)%n.length],L=F.x-O.x,B=F.y-O.y,D=h*B-d*L;if(Math.abs(D)<1e-8)continue;let j=O.x-u.x,H=O.y-u.y,V=(j*B-H*L)/D,U=(j*d-H*h)/D;V>0&&U>=0&&U<=1&&(y=Math.min(y,V))}let x=.3/_,g=y-.04/_;if(!Number.isFinite(y)||y*_>2||g-x<.12/_)continue;let S=!!o&&a(c),w=r?.[c]?.pitch,I=S&&w&&Number.isFinite(w)?Math.min(Rp/_,Math.max(Zo/_,w-Zo/_-Ip/_)):Zo/_,b=-d,R=h;o&&b*(o.x-u.x)+R*(o.y-u.y)<0&&(b=-b,R=-R);let P=Zo/_,M=[{x:u.x+h*x+b*P,y:u.y+d*x+R*P},{x:u.x+h*g+b*P,y:u.y+d*g+R*P},{x:u.x+h*g-b*I,y:u.y+d*g-R*I},{x:u.x+h*x-b*I,y:u.y+d*x-R*I}];if(!M.every(A=>Ve(n,A.x,A.y)))continue;let C=r?.[c]?.belowY,T=C==null?0:l.y-C,v=!!o&&T>.03&&T<=.65;if(v&&o){let A=(O,F)=>Math.hypot((O.x+F.x)/2-o.x,(O.y+F.y)/2-o.y);A(M[0],M[1])>A(M[3],M[2])&&(M=[M[3],M[2],M[1],M[0]])}let k=v?Math.ceil((T-1e-8)/.2):1,E=(A,O,F)=>({x:A.x+(O.x-A.x)*F,y:A.y+(O.y-A.y)*F});for(let A=0;A<k;A++){let O=A/k,F=(A+1)/k,L=[E(M[0],M[3],O),E(M[1],M[2],O),E(M[1],M[2],F),E(M[0],M[3],F)],B=l.y+.008-(v?T*(1-F):0);if(Q(e,L,void 0,()=>B,B-(v?T/k+.1:.16),i,s,z),!v)continue;let D=Math.hypot(L[3].x-L[0].x,L[3].y-L[0].y)*_;if(D<1e-4)continue;let j=Math.min(wp/D,_p),H=E(L[0],L[3],j),V=E(L[1],L[2],j),U=X=>[X.x*_,B+.004,X.y*_],$=[.8,.67,.3];e.setMaterial(Pp),e.tri(U(L[0]),U(L[1]),U(V),[0,1,0],$),e.tri(U(L[0]),U(V),U(H),[0,1,0],$),e.setMaterial(0)}}}}var Ep=.02,Ap=.012,Cp=.01,kp=.3,vp=.5;function Op(e,t,n){if(e.length===1)return Math.hypot(t-e[0].x,n-e[0].y);let o=1/0;for(let r=0;r+1<e.length;r++){let i=e[r],s=e[r+1],a=s.x-i.x,c=s.y-i.y,l=a*a+c*c,f=l>1e-12?((t-i.x)*a+(n-i.y)*c)/l:0;f=Math.max(0,Math.min(1,f)),o=Math.min(o,Math.hypot(t-(i.x+f*a),n-(i.y+f*c)))}return o}function Tp(e,t,n,o){let r=1/0,i=Number.NaN;for(let s=0;s<e.length;s++){let a=t[s];if(Math.hypot(n-a.cx,o-a.cy)-a.rad>=r)continue;let c=Op(e[s].pts,n,o);c<r&&(r=c,i=e[s].y)}return i}function ol(e,t,n,o,r,i,s){let a=o.filter(m=>m.pts.length>0);if(a.length<2||t.length<3)return;let c=a.map(m=>{let h=0,d=0;for(let y of m.pts)h+=y.x,d+=y.y;h/=m.pts.length,d/=m.pts.length;let p=0;for(let y of m.pts)p=Math.max(p,Math.hypot(y.x-h,y.y-d));return{cx:h,cy:d,rad:p}}),l=[...t],f=n.map(m=>[...m]),u=Ep/_;for(let m of[l,...f])for(let h=0;h<m.length;h++){let d=m[h],p=m[(h+1)%m.length],y=p.x-d.x,x=p.y-d.y,g=Math.hypot(y,x);if(g*_<.05)continue;let S=(d.x+p.x)/2,w=(d.y+p.y)/2,I=x/g,b=-y/g;Xe({x:S+I*u,y:w+b*u},l,f)&&(I=-I,b=-b);let R=r.x-S,P=r.y-w,M=Math.hypot(R,P)||1;if((I*R+b*P)/M>vp)continue;let C=1/0;for(let L of[.2,.5,.8]){let B=Tp(a,c,d.x+y*L-I*u*2,d.y+x*L-b*u*2);Number.isFinite(B)&&(C=Math.min(C,B))}if(!Number.isFinite(C)||C-i<kp)continue;let T=i-Cp,v=C-Ap,k={x:(d.x-I*u)*_,z:(d.y-b*u)*_},E={x:(p.x-I*u)*_,z:(p.y-b*u)*_},A=[I,0,b],O=W(s,z.wallBottom),F=W(s,z.top);e.tri([k.x,v,k.z],[E.x,v,E.z],[E.x,T,E.z],A,F,F,O),e.tri([k.x,v,k.z],[E.x,T,E.z],[k.x,T,k.z],A,F,O,O)}}function rl(e,t,n,o,r,i,s,a,c=!1){if(!t.outline||t.outline.length<3)return;let l=n.baseHeightM,f=n.objects.filter(g=>g.type==="shape"&&(g.role==="entrance"||g.role==="exit")),u=Ts(o,a.tierTop);if(!r)return;let m=g=>r.deckAt(g.x,g.y),h=sa(t,s),d=h[0]??t.outline;if(r.rowLevels.length>=2){let g=Mo(r.rowLevels),S=aa(ta(r.rowLevels,n.focal,g),h),w=tl(oi(r.rowLevels,n.focal,l),n.focal,ei);for(let b of S){let R=Math.max(l,b.topY-il);for(let P of i.subtract(b.outline,R))zc(e,P,b.holes,R,l,a.tierTop,a.tierWall,f,!c,w);e.setMaterial(5),ol(e,b.outline,b.holes,r.rowLevels,n.focal,R,a.tierWall),e.setMaterial(0)}S.length||Q(e,d,t.holes,()=>r.landingY,l,u,a.tierWall,z);let I={tread:[u[0]*z.top,u[1]*z.top,u[2]*z.top],riser:[u[0]*.72,u[1]*.72,u[2]*.72]};for(let b of h.length?h:[d])oa(e,r.rowLevels,n.focal,r.landingY,I,b,g);el(e,r.rowLevels,n.focal,l),nl(e,r.rowLevels,t.outline,n.focal,g);return}let p=r.flat?1/0:hc,y=g=>r.normalAt(g.x,g.y),x=r.flat?r.landingY:void 0;for(let g of i.subtract(d,x))Q(e,g,t.holes,m,l,u,a.tierWall,z,p,y)}function Lp(e,t,n){let o=new Set;for(let s of e.objects)s.type==="section"&&o.add(s.id);let r=new Map;for(let s=0;s<t.length;s++){let a=n.seatOwner[s];if(!a||!o.has(a))continue;let c=n.bySection.get(a);if(c&&c.rowLevels.length>=2)continue;let l=t[s];if(l.kind==="booth")continue;let f=r.get(a);f||(f=new Map,r.set(a,f));let u=l.rowId||`__seat-${s}`,m=f.get(u);m||(m={pts:[],levelM:0,n:0},f.set(u,m)),m.pts.push({x:l.x,y:l.y}),m.levelM+=n.seatDeckY(s),m.n++}let i=[];for(let s of e.objects){if(s.type!=="section")continue;let a=n.bySection.get(s.id);if(a&&a.rowLevels.length>=2){let l=a.rowLevels.filter(f=>!f.patch).map(f=>({pts:f.pts,levelM:f.y}));l.length>=2&&i.push({sectionId:s.id,rows:l});continue}let c=r.get(s.id);c&&i.push({sectionId:s.id,rows:[...c.values()].map(l=>({pts:l.pts,levelM:l.levelM/l.n}))})}return i}function Bp(e,t){let n=1/0;for(let o=0;o<t.length;o++){let r=t[o],i=t[(o+1)%t.length],s=i.x-r.x,a=i.y-r.y,c=Math.max(0,Math.min(1,((e.x-r.x)*s+(e.y-r.y)*a)/(s*s+a*a||1)));n=Math.min(n,Math.hypot(e.x-r.x-c*s,e.y-r.y-c*a))}return n}var il=.02;function Fp(e,t){let n=e.objects.filter(o=>o.type==="section"&&!!o.outline&&o.outline.length>=3).flatMap(o=>{let r=t.bySection.get(o.id);if(!r)return[];let i=1/0,s=-1/0,a=1/0,c=-1/0;for(let f of o.outline)f.x<i&&(i=f.x),f.x>s&&(s=f.x),f.y<a&&(a=f.y),f.y>c&&(c=f.y);let l=r.landingY;for(let f of r.rowLevels)l=Math.min(l,f.y-il);return[{outline:o.outline,holes:o.holes,surface:r,floorTop:l,minX:i,maxX:s,minY:a,maxY:c}]});return(o,r,i)=>{let s=null;for(let a of n){if(o<a.minX-i||o>a.maxX+i||r<a.minY-i||r>a.maxY+i)continue;let c={x:o,y:r};if(!Xe(c,a.outline,a.holes)&&Bp(c,a.outline)>i)continue;let l=Math.min(a.surface.deckAt(o,r),a.floorTop);(s===null||l<s)&&(s=l)}return s}}var Np=3,Dp=.4;function sl(e,t,n,o,r,i,s=!0){let a=Lp(t,n,o);if(a.length<Np)return;let c=Wc(a,t.focal);if(!c)return;let l=Math.max(0,...c.rings.map(f=>f.arcs.reduce((u,m)=>u+m.binCount,0)))/c.binCount;e.setMaterial(5),$c(e,c,{bottomY:t.baseHeightM,tierFrontLevels:a.map(f=>Math.min(...f.rows.map(u=>u.levelM))),colors:{bandTop:W(r.tierTop,.8),bandWall:r.tierWall,shellTop:i??W(r.tierWall,1.15),shellWall:i??r.tierWall},ao:z,shapes:t.objects.filter(f=>f.type==="shape"),deriveShell:s&&l>=Dp,standTopNear:Fp(t,o)}),e.setMaterial(0)}var al=4;var Gp=[[/\b(wc|toilets?|restrooms?|washrooms?|lavatory|loo)\b/i,"restroom"],[/\b(bar|drinks|pub|cocktails?)\b/i,"bar"],[/\b(food|concessions?|snacks?|kiosk|caf[eé]|kitchen|catering)\b/i,"concession"],[/\b(coat ?check|cloak ?room|cloakroom|coats)\b/i,"coat"],[/\b(screen|led wall|projection|video wall)\b/i,"screen"],[/\b(sound|foh|mixing desk|control booth)\b/i,"sound"],[/\b(entrance|entry|way in|gate)\b/i,"entrance"],[/\b(exit|way out)\b/i,"exit"],[/\b(pillar|column|obstruction)\b/i,"obstruction"],[/\b(walls?|outline|boundary|perimeter)\b/i,"wall"]],Hp=1.2,jp=12;function cl(e){if(e.heightM!==void 0)return!1;let t=he(e);if(!t||t.length<3)return!1;let n=0;for(let r=0;r<t.length;r++){let i=t[r],s=t[(r+1)%t.length];n+=Math.hypot(s.x-i.x,s.y-i.y)}return n*re<jp*2?!1:2*qn(t)/n*re<=Hp}function ii(e){if(!e)return null;for(let[t,n]of Gp)if(t.test(e))return n;return null}var ul="auto-rows-";function fl(e){return e.id.startsWith(ul)&&!e.label}var Vp=1.15,Up=.09,ml=6,Xp=34,Kp=.35,Wp=6,Yp=.35,zp=.75,Zp=12,$p=2.5,Qp=40,qp=[18,24],Jp=[12,16],ll=14,eb=.8,tb=.6,nb=5,ob=.3,hl=.4,dl=2,rb=400,ib=2.6,sb=.8,ab=4,cb=26,lb=.7,ub=.5,fb=.985,mb=1.5,hb=2.2,db=3,pb=25,bb=.985,yb=2,gb=6,xb=3,Mb=.1,Sb=1.5,Rb=1.6,Ib=6e3,Pb=.6,wb="#c3c7cd",si=300,_b=240;function Eb(e,t,n,o){if(!e.fill||!/^#[0-9a-f]{6}$/i.test(e.fill))return null;let r=ci([...t]),i=new Set;for(let f of o)i.add(Math.floor(Math.atan2(f.y-r.y,f.x-r.x)*180/Math.PI/10));if(i.size*10<_b)return null;let{h:s,s:a,l:c}=ys(bs(e.fill));return s<70/360||s>170/360||a<.2||c<.08||c>.75||n.some(f=>f!==e&&f.type==="shape"&&he(f)?.some(u=>fi(u,t)))?null:e.kind==="ellipse"?"oval-cricket":e.kind==="rect"?"pitch-football":null}var Ab="Estimated from the drawing; confirm with the venue.",li=e=>{if(!e.length)return null;let t=[...e].sort((o,r)=>o-r),n=Math.floor(t.length/2);return t.length%2?t[n]:(t[n-1]+t[n])/2},ci=e=>({x:e.reduce((t,n)=>t+n.x,0)/e.length,y:e.reduce((t,n)=>t+n.y,0)/e.length}),qn=e=>{let t=0;for(let n=0;n<e.length;n++){let o=e[n],r=e[(n+1)%e.length];t+=o.x*r.y-r.x*o.y}return Math.abs(t)/2};function Cb(e){return e.height!==void 0||e.rake!==void 0||e.elevation!==void 0||e.surfaceKind!==void 0}function ui(e){let t=new Map;for(let n of e){let o=t.get(n.rowId);o?o.push(n):t.set(n.rowId,[n])}return t}function fi(e,t){let n=!1;for(let o=0,r=t.length-1;o<t.length;r=o++){let i=t[o],s=t[r];i.y>e.y!=s.y>e.y&&e.x<(s.x-i.x)*(e.y-i.y)/(s.y-i.y)+i.x&&(n=!n)}return n}function mi(e,t){let n=t[0],o=1/0;for(let r=0;r<t.length;r++){let i=t[r],s=t[(r+1)%t.length],a=s.x-i.x,c=s.y-i.y,l=a*a+c*c,f=l>0?Math.max(0,Math.min(1,((e.x-i.x)*a+(e.y-i.y)*c)/l)):0,u={x:i.x+a*f,y:i.y+c*f},m=Math.hypot(e.x-u.x,e.y-u.y);m<o&&(o=m,n=u)}return n}function pl(e,t){let n=0,o=0;for(let r of e.values()){if(r.length<3)continue;let i=r[0],s=r[r.length-1],a=s.x-i.x,c=s.y-i.y,l=Math.hypot(a,c);if(l<1e-6)continue;let f={x:(i.x+s.x)/2,y:(i.y+s.y)/2},u=mi(f,t),m=u.x-f.x,h=u.y-f.y,d=Math.hypot(m,h);d<1e-6||(o+=Math.abs((-c*m+a*h)/(l*d))*r.length,n+=r.length)}return n?o/n:0}function kb(e,t,n){let o=e.filter(p=>p.type==="shape"),r=o.find(p=>p.role==="stage");if(r){let p=he(r);return p?{shape:r,centre:ci(p),outline:p,inferred:!1}:null}if(!n.length)return null;let i=1/0,s=-1/0,a=1/0,c=-1/0;for(let p of n)i=Math.min(i,p.x),s=Math.max(s,p.x),a=Math.min(a,p.y),c=Math.max(c,p.y);let l=(s-i)*(c-a),f=[];for(let p of o){if(p.role)continue;let y=he(p);if(!y)continue;let x=qn(y);if(x*re*re<6||x>l)continue;let g=Math.min(...y.map(M=>M.x)),S=Math.max(...y.map(M=>M.x)),w=Math.min(...y.map(M=>M.y)),I=Math.max(...y.map(M=>M.y)),b=0;for(let M of n)M.x>g&&M.x<S&&M.y>w&&M.y<I&&fi(M,y)&&b++;if(b>n.length*.05)continue;let R=ci(y),P=pl(t,y);P>=eb&&f.push({shape:p,centre:R,outline:y,score:P,area:x,box:[g,w,S,I]})}let u=(p,y)=>y!==p&&y.area>p.area&&p.box[0]>=y.box[0]-1e-6&&p.box[1]>=y.box[1]-1e-6&&p.box[2]<=y.box[2]+1e-6&&p.box[3]<=y.box[3]+1e-6,m=f.filter(p=>!f.some(y=>u(p,y))),h=Math.max(0,...m.map(p=>p.score)),d=m.filter(p=>p.score>=h-.03).sort((p,y)=>y.area-p.area)[0]??null;return d?{shape:d.shape,centre:d.centre,outline:d.outline,inferred:!0}:null}function vb(e,t,n){if(!n||n.length<3)return Math.hypot(e.x-t.x,e.y-t.y);let o=mi(e,n);return Math.hypot(e.x-o.x,e.y-o.y)}function bl(e){return e.length<3?[...e].sort((t,n)=>t.x-n.x||t.y-n.y):an(e)}function Ob(e){if(!e.length||e.length>Ib)return[];let t=[...ui(e).values()],n=t.map((a,c)=>c),o=a=>n[a]===a?a:n[a]=o(n[a]),r=Rb/re,i=t.map(a=>({minX:Math.min(...a.map(c=>c.x))-r,maxX:Math.max(...a.map(c=>c.x))+r,minY:Math.min(...a.map(c=>c.y))-r,maxY:Math.max(...a.map(c=>c.y))+r}));for(let a=0;a<t.length;a++)for(let c=a+1;c<t.length;c++){let l=i[a],f=i[c];if(l.maxX<f.minX||f.maxX<l.minX||l.maxY<f.minY||f.maxY<l.minY)continue;t[a].some(m=>t[c].some(h=>Math.hypot(m.x-h.x,m.y-h.y)<=r))&&(n[o(a)]=o(c))}let s=new Map;return t.forEach((a,c)=>{let l=o(c),f=s.get(l);f?f.push(...a):s.set(l,[...a])}),[...s.values()].filter(a=>new Set(a.map(c=>c.rowId)).size>=2)}function Tb(e,t,n){if(!t.length)return null;let o=t.filter(P=>n.tableIds.has(P.rowId)||P.kind==="booth").length>t.length/2,r=ui(t),i=!n.outline||pl(r,n.outline)>=tb,s=0,a=0;for(let P of r.values()){if(P.length<2)continue;let M=P[0],C=P[P.length-1],T=C.x-M.x,v=C.y-M.y,k=Math.hypot(T,v);if(k<1e-6)continue;let E={x:(M.x+C.x)/2,y:(M.y+C.y)/2},A=i?n.outline?mi(E,n.outline):n.focal:n.middle,O=-v/k,F=T/k;O*(A.x-E.x)+F*(A.y-E.y)<0&&(O=-O,F=-F),s+=O*P.length,a+=F*P.length}let c={x:t.reduce((P,M)=>P+M.x,0)/t.length,y:t.reduce((P,M)=>P+M.y,0)/t.length};if(Math.hypot(s,a)<1e-9){let P=i?n.focal:n.middle;s=P.x-c.x,a=P.y-c.y}let l=Math.hypot(s,a)||1,f={x:s/l,y:a/l},u=P=>-(P.x*f.x+P.y*f.y),m=P=>-P.x*f.y+P.y*f.x,h=1/0,d=-1/0,p=1/0,y=-1/0,x=1/0,g=new Map;for(let P of t){let M=u(P),C=m(P);h=Math.min(h,M),d=Math.max(d,M),p=Math.min(p,C),y=Math.max(y,C),i&&(x=Math.min(x,vb(P,n.focal,n.outline)));let T=P.logicalRowId??P.rowId,v=g.get(T);v?v.push(M):g.set(T,[M])}i||(x=Math.max(0,h-u(n.middle)));let S=[...g.values()].map(P=>li(P)).sort((P,M)=>P-M),w=[];if(!o)for(let P of S)w.length&&P-w[w.length-1]<Yp/re||w.push(P);let I=Cb(e),b=Lt(e,{floorBaseHeightM:n.baseHeightM}),R={id:e.id,section:e,authored:I,plane:n,facing:f,facesAction:i,hull:bl(t),sample:t.filter((P,M)=>M%Math.ceil(t.length/rb)===0),frontD:h,backD:d,latMin:p,latMax:y,frontDistance:x,rowDepths:w,rowCount:w.length,level:0,height:b.height,rake:I?b.rake:0,backHeight:0};return R.backHeight=R.height+(d-h)*re*Math.tan(R.rake*Math.PI/180),R}function Lb(e,t,n,o){if(e.length<2)return 0;let r=Math.max(1,t*re),i=n+Vp-o,s=0,a=0;for(let l=1;l<e.length;l++){let f=Math.max(zp,(e[l]-e[l-1])*re),u=(i+Up)*(r+f)/r;s+=u-i,a+=f,i=u,r+=f}let c=Math.atan(s/a)*180/Math.PI;return Math.round(Math.max(ml,Math.min(Xp,c))*10)/10}function Bb(e,t,n=!1){if(!n&&e.facing.x*t.facing.x+e.facing.y*t.facing.y<ob)return null;let o=-1/0,r=1/0,i=-1/0;for(let m of t.hull){o=Math.max(o,-(m.x*e.facing.x+m.y*e.facing.y));let h=-m.x*e.facing.y+m.y*e.facing.x;r=Math.min(r,h),i=Math.max(i,h)}if(Math.min(e.latMax,i)-Math.max(e.latMin,r)<(n?1e-6:hl*(e.latMax-e.latMin)))return null;let a=dl/re,c=new Map,l=new Map;for(let m of e.sample){let h=Math.floor((-m.x*e.facing.y+m.y*e.facing.x)/a),d=-(m.x*e.facing.x+m.y*e.facing.y);c.set(h,Math.min(c.get(h)??1/0,d))}for(let m of t.sample){let h=Math.floor((-m.x*e.facing.y+m.y*e.facing.x)/a),d=-(m.x*e.facing.x+m.y*e.facing.y);l.set(h,Math.max(l.get(h)??-1/0,d))}let f=[];for(let[m,h]of c){let d=l.get(m);d!==void 0&&f.push(h-d)}let u=f.length?li(f):e.frontD-o;return u<-1/re?null:u}function Fb(e,t){if(t.plane.floorIndex>=e.plane.floorIndex)return!1;let n=-1/0,o=1/0,r=1/0,i=-1/0;for(let c of t.hull){let l=-(c.x*e.facing.x+c.y*e.facing.y);n=Math.max(n,l),o=Math.min(o,l);let f=-c.x*e.facing.y+c.y*e.facing.x;r=Math.min(r,f),i=Math.max(i,f)}let s=Math.min(e.latMax,i)-Math.max(e.latMin,r),a=Math.min(e.backD,n)-Math.max(e.frontD,o);return s>hl*(e.latMax-e.latMin)&&a>1/re}function Nb(e,t){let n=new Set;for(let o of e){let r=(Math.atan2(o.y-t.y,o.x-t.x)*180/Math.PI+360)%360;n.add(Math.floor(r/10))}return n.size/36}function Db(e,t){let n=1/0,o=-1/0;for(let i of t.hull){let s=-(i.x*e.facing.x+i.y*e.facing.y);n=Math.min(n,s),o=Math.max(o,s)}let r=Math.max(0,Math.min(o-n,e.frontD-n));return t.height+r*re*Math.tan(t.rake*Math.PI/180)}function Gb(e,t){if(!e.facesAction)return!1;let n={x:-e.facing.y,y:e.facing.x},o=dl/re,r=Math.max(1,Math.ceil((e.backD-e.frontD)/o)),i={left:new Map,right:new Map};for(let a of t)if(!(a===e||a.plane.floorIndex!==e.plane.floorIndex)&&!(a.facing.x*e.facing.x+a.facing.y*e.facing.y>=fb))for(let c of a.sample){let l=-(c.x*e.facing.x+c.y*e.facing.y);if(l<e.frontD||l>e.backD)continue;let f=-c.x*e.facing.y+c.y*e.facing.x,u=f<e.latMin?"left":f>e.latMax?"right":null;if(!u)return!1;let m=Math.min(r-1,Math.floor((l-e.frontD)/o)),h=u==="left"?e.latMin-f:f-e.latMax;h<(i[u].get(m)?.gap??1/0)&&i[u].set(m,{gap:h,other:a})}let s=a=>{let c=a==="left"?e.latMin:e.latMax,l=0;for(let[f,{other:u}]of i[a]){if((u.facing.x*n.x+u.facing.y*n.y)*(a==="left"?1:-1)<lb)continue;let h=e.frontD+(f+.5)*o,d={x:-h*e.facing.x+c*n.x,y:-h*e.facing.y+c*n.y},p=-(d.x*u.facing.x+d.y*u.facing.y),y=-d.x*u.facing.y+d.y*u.facing.x;p<u.frontD&&y>=u.latMin&&y<=u.latMax&&l++}return l/r>=ub};return s("left")&&s("right")}function Hb(e,t){if(t.plane.floorIndex!==e.plane.floorIndex||t.facing.x*e.facing.x+t.facing.y*e.facing.y<bb)return!1;let n=1/0,o=-1/0,r=1/0;for(let a of t.hull){let c=-a.x*e.facing.y+a.y*e.facing.x;n=Math.min(n,c),o=Math.max(o,c),r=Math.min(r,-(a.x*e.facing.x+a.y*e.facing.y))}let i=(e.frontD-r)*re;if(i<-yb||i>gb)return!1;let s=Math.max(n-e.latMax,e.latMin-o);return s*re<=xb&&s*re>=-Mb}function jb(e,t=!1,n=!1,o){let r=t?Jp:qp,i=new Set(n?[]:e.filter(p=>!p.authored&&Gb(p,e))),s=[...e].sort((p,y)=>p.plane.floorIndex-y.plane.floorIndex||Number(i.has(y))-Number(i.has(p))||p.frontDistance-y.frontDistance);for(let p of i)o?.add(p.id);let a=(p,y,x)=>{let g=new Map,S=[],w=new Map,I=b=>{if(b.plane.floorIndex===0||b.plane.baseHeightM>0)return b.plane.baseHeightM;let R=w.get(b.plane.floorIndex-1);return R===void 0?b.plane.baseHeightM:R+al};for(let b of s){if(i.has(b))b.height=I(b),b.level=0,b.rake=0,b.backHeight=b.height,g.set(b.id,void 0);else if(!b.authored){let P=I(b),M;for(let E of S){if(E.plane.floorIndex>b.plane.floorIndex)continue;if(Fb(b,E)){let L=Db(b,E)+ib;L>P&&(P=L,M=E);continue}let A=Bb(b,E,i.has(E));if(A==null)continue;let O=n&&!!b.plane.stageDeck&&E.level===0&&E.plane.floorIndex===b.plane.floorIndex&&Math.max(0,A)*re<=ab,F=i.has(E)?E.height+mb:O?E.backHeight:E.backHeight+Kp+Math.min(Wp,Math.max(0,A)*re)*Math.tan(E.rake*Math.PI/180);F>P&&(P=F,M=E)}let C=p.get(b);C&&C.height>P+.01?(P=C.height,M=void 0):C=void 0,b.height=Math.round(Math.min(P,b.plane.baseHeightM+Qp)*100)/100;let T=!M&&!C&&b.height>b.plane.baseHeightM;if(b.level=M?M.level+1:C?C.level:T?1:0,b.rake=Lb(b.rowDepths,b.frontDistance,b.height,b.plane.focalHeightM),!b.facesAction&&b.rowCount<nb)b.rake=0;else if(b.level===0){let E=Math.max(1e-6,(b.backD-b.frontD)*re);b.rake=Math.min(b.rake,Zp,Math.round(Math.atan($p/E)*1800/Math.PI)/10)}else b.rowCount>=2&&(b.rake=Math.max(b.rake,r[Math.min(b.level,r.length)-1]));let v=(b.backD-b.frontD)*re,k=M&&i.has(M)||C&&x?.has(C.id);if(y!==void 0&&k&&b.rowCount>=2&&(b.rake=y),t&&v>0&&b.height+v*Math.tan(b.rake*Math.PI/180)>b.plane.baseHeightM+ll){let E=Math.max(0,b.plane.baseHeightM+ll-b.height);b.rake=Math.max(ml,Math.round(Math.atan(E/v)*1800/Math.PI)/10)}n&&b.plane.stageDeck&&b.level>0&&(b.rake=Math.min(b.rake,cb)),b.backHeight=b.height+v*Math.tan(b.rake*Math.PI/180),g.set(b.id,M?.id??(C?g.get(C.id):void 0))}let R=b.plane.floorIndex;w.set(R,Math.min(w.get(R)??1/0,b.height)),S.push(b)}return g},c=a(new Map),l=new Map,f=p=>l.get(p)?.height??p.height;for(let p=!0,y=0;p&&y<e.length;y++){p=!1;for(let x of e)if(!(x.authored||i.has(x)))for(let g of e){let S=l.get(g)??g;g===x||S.height-S.plane.baseHeightM<Sb||S.height<=f(x)+.01||Hb(x,g)&&(l.set(x,S),p=!0)}}let u=new Map(e.map(p=>[p.id,p])),m=e.filter(p=>!p.authored&&p.rowCount>=2&&i.has(u.get(c.get(p.id)??""))),h=m.length?li(m.map(p=>p.rake)):void 0;if(!l.size&&h===void 0)return c;let d=new Map([...new Set(l.values())].map(p=>[p,{...p}]));return a(new Map([...l].map(([p,y])=>[p,d.get(y)])),h,new Set(m.map(p=>p.id)))}var ai=(e,t)=>!!e&&e.x===t.x&&e.y===t.y;function yl(e,t={x:0,y:-40}){let n=on(e),o=new Map;for(let x of n){if(!x.sectionId)continue;let g=o.get(x.sectionId);g?g.push(x):o.set(x.sectionId,[x])}let r={focalInferred:!1,confident:!1,sections:[]},i=e.floors?.length?e.floors.map((x,g)=>({objects:x.objects,floorIndex:g,floorId:x.id,baseHeightM:x.baseHeightM??0,focal:x.focalPoint??e.focalPoint})):[{objects:e.objects,floorIndex:0,floorId:void 0,baseHeightM:0,focal:e.focalPoint}],s=new Set(i.flatMap(x=>x.objects.filter(g=>g.type==="table").map(g=>g.id))),a=[],c,l=new Set,f=i.map(x=>{let g=k=>!e.floors?.length||k.floorId===x.floorId,S=Ob(n.filter(k=>!k.sectionId&&k.kind!=="booth"&&!s.has(k.rowId)&&g(k))),w=[];for(let k of S){let E=It(Rt(bl(k)),Pb/re);if(n.some(O=>!g(O)&&fi(O,E)))continue;let A=`${ul}${x.floorIndex}-${w.length}`;l.add(A),o.set(A,k),w.push({type:"section",id:A,label:"",color:wb,outline:E})}let I=w.length?{...x,objects:[...x.objects,...w]}:x,b=new Set(I.objects.filter(k=>k.type==="section").map(k=>k.logicalSectionId??k.id)),R=[...o.entries()].filter(([k])=>b.has(k)).flatMap(([,k])=>k),P=kb(I.objects,ui(R),R),M=I.focal;(P||I.focal&&!ai(I.focal,t))&&(r.confident=!0),P&&(r.stage??={id:P.shape.id,inferred:P.inferred,...I.floorId?{floorId:I.floorId}:{}},(P.inferred||ai(I.focal,t))&&(M=P.centre,r.focalInferred=!0));let C=P&&(!P.inferred||qn(P.outline)*re*re<=si),T=P?void 0:c,v={tableIds:s,floorIndex:I.floorIndex,floorId:I.floorId,baseHeightM:I.baseHeightM,focal:T?.focal??M,outline:P?.outline??T?.outline,focalHeightM:T?.focalHeightM??I.baseHeightM+(P&&C?dt({...P.shape,role:"stage"}).heightM:0),stageDeck:T?.stageDeck??!!(P&&C&&qn(P.outline)*re*re<=si),middle:R.length?{x:R.reduce((k,E)=>k+E.x,0)/R.length,y:R.reduce((k,E)=>k+E.y,0)/R.length}:M};for(let k of I.objects){if(k.type!=="section")continue;let E=Tb(k,o.get(k.logicalSectionId??k.id)??[],v);E&&a.push(E)}return v.outline&&(c=v),ai(I.focal,v.focal)||(r.focal??=[]).push({...I.floorId?{floorId:I.floorId}:{},point:{...v.focal}}),{unit:I,plane:v,stage:P,planeSeats:R}}),u=i.flatMap(x=>x.objects).map(x=>x.type==="shape"&&!x.role&&(ii(x.label)==="wall"||!ii(x.label)&&cl(x))?{...x,role:"wall"}:x),m=Gt({objects:u},n)!==null;m&&(r.indoor=!0);let h=new Set,d=jb(a,m,Nb(n,f[0]?.plane.focal??t)<sb,h),p=new Map(a.filter(x=>!x.authored).map(x=>[x.id,x])),y=f.map(({unit:x,plane:g,stage:S,planeSeats:w})=>x.objects.map(I=>{let b=I.type==="shape"&&!I.role&&I.id!==S?.shape.id?ii(I.label):null;if(I.type==="shape"&&!I.role&&I.id!==S?.shape.id&&(b==="wall"||!b&&cl(I))&&I.type==="shape"){(r.roles??=[]).push({id:I.id,...g.floorId?{floorId:g.floorId}:{},role:"wall"});let{fill:E,...A}=I;return{...A,role:"wall"}}if(b&&I.type==="shape")return(r.roles??=[]).push({id:I.id,...g.floorId?{floorId:g.floorId}:{},role:b}),{...I,role:b};let P=S?.inferred&&I.id===S.shape.id&&I.type==="shape"?Eb(I,S.outline,x.objects,w):null;if(P&&I.type==="shape")return r.stage?.id===I.id&&(r.stage.field=P),{...I,role:"stage",stageKind:P};let M=I.type==="shape"&&I.id===S?.shape.id&&I.heightM===void 0&&!I.stageKind&&a.some(E=>E.plane===g&&(h.has(E.id)||E.level===0&&E.facesAction&&E.rake<=db&&(E.frontDistance+E.backD-E.frontD)*re>=pb)),C=M?{heightM:hb}:{};if(S?.inferred&&I.id===S.shape.id&&I.type==="shape"&&qn(S.outline)*re*re<=si)return r.stage?.id===I.id&&(r.stage.deck=!0),{...I,role:"stage",...C};if(M&&I.type==="shape"&&I.role==="stage")return{...I,...C};let T=I.type==="section"?p.get(I.id):void 0;if(!T||I.type!=="section")return I;let v=T.rowCount>=2&&T.rake>0;l.has(T.id)?r.looseRowBlocks=(r.looseRowBlocks??0)+1:r.sections.push({id:T.id,floorId:g.floorId,surfaceKind:v?"rakedRows":"flat",height:T.height,rake:T.rake,stackedOn:d.get(T.id)});let k={status:"inferred",source:"public-2d-topology",note:Ab};return{...I,height:T.height,rake:T.rake,surfaceKind:v?"rakedRows":"flat",physical3dProvenance:{height:k,rake:k,surfaceKind:k}}}));if(e.floors?.length){let x=e.floors.map((g,S)=>({...g,objects:y[S],focalPoint:f[S].plane.focal}));return{doc:{...e,floors:x,objects:x[0].objects,focalPoint:x[0].focalPoint},report:r}}return{doc:{...e,objects:y[0],focalPoint:f[0].plane.focal},report:r}}var gl=/^[\p{L}\p{N}]{1,4}$/u,Vb=/^([\p{L}\p{N}]{2,})[\s\-\u2013\u2014\u00b7_./]+(.+)$/u;function xl(e,t){let n=t?.trim();if(!n)return e;let o=e.toLocaleLowerCase("en-US"),r=n.toLocaleLowerCase("en-US");if(o.startsWith(`${r} `)){let s=e.slice(n.length).trim();if(gl.test(s))return s}let i=Vb.exec(e);if(i){let s=i[1].toLocaleLowerCase("en-US"),a=i[2].trim();if((r.startsWith(s)||s.startsWith(r))&&gl.test(a))return a}return e}var Ml={inline:"Inline booth \xB7 1 open side",corner:"Corner booth \xB7 2 open sides",peninsula:"Peninsula booth \xB7 3 open sides",island:"Island booth \xB7 4 open sides"},Ub=new Map(Er.map(e=>[e.key,e.label]));function Xb(e){return`picker.access.${e}`}function Sl(e){let t=[],n=e.boothType;n&&Object.prototype.hasOwnProperty.call(Ml,n)&&t.push({key:`booth:${n}`,icon:"booth",titleKey:`picker.boothType.${n}`,titleFallback:Ml[n],tone:"place"});let o=e.wheelchairSpaceType;for(let a of e.accessibility??[]){if(a==="wheelchair"&&o)continue;let c=Ub.get(a);c&&t.push({key:`access:${a}`,icon:a,titleKey:Xb(a),titleFallback:c,tone:"access"})}o==="no-seat"?t.push({key:"wheelchair:no-seat",icon:"wheelchair",titleKey:"picker.emptyWheelchairSpace",titleFallback:"Empty wheelchair space",tone:"access"}):o==="seat-present"&&t.push({key:"wheelchair:seat-present",icon:"wheelchair",titleKey:"picker.accessiblePhysicalSeat",titleFallback:"Accessible physical seat",tone:"access"}),e.aisle===!0&&t.push({key:"place:aisle",icon:"aisle",titleKey:"picker.aisleSeat",titleFallback:"Aisle seat",tone:"place"});let r=e.commercial;r?.restrictedView&&t.push({key:"mark:restrictedView",icon:"restrictedView",titleKey:"picker.restrictedView",titleFallback:"Restricted view",tone:"warn"}),r?.obstructedView&&t.push({key:"mark:obstructedView",icon:"obstructedView",titleKey:"picker.obstructedView",titleFallback:"Obstructed view",tone:"warn"}),r?.premium&&t.push({key:"mark:premium",icon:"premium",titleKey:"picker.premiumSeat",titleFallback:"Premium seat",tone:"premium"});let i=r?.note?.trim();if(i){let a=t.find(c=>c.tone==="warn"||c.tone==="premium");a?a.note=i:t.push({key:"note",icon:"note",titleKey:"picker.organizerNote",titleFallback:"Organizer note",tone:"note",note:i})}let s=typeof e.entrance=="string"?e.entrance.trim():"";return s&&t.push({key:"place:entrance",icon:"entrance",titleKey:"picker.entrance",titleFallback:"Entrance",tone:"place",note:s}),t}var Kb=1.5,Wb=30,Yb=4,zb=3.6,Zb=6,hi=15,$b=3,Qb=1;function qb(e){return Math.max(zb,Math.min(Zb,2.4+.15*e))}var Jn=Math.PI*2;function Jb(e,t){let n=0,o=0;for(let u of e)n+=u.x,o+=u.y;let r=Math.atan2(o/e.length-t.y,n/e.length-t.x),i=e.map(u=>{let m=Math.atan2(u.y-t.y,u.x-t.x)-r;for(;m>Math.PI;)m-=Jn;for(;m<-Math.PI;)m+=Jn;return m+r}),s=i.map((u,m)=>m).sort((u,m)=>i[u]-i[m]),a=i[s[0]],c=i[s[s.length-1]];if(c-a>Math.PI)return null;let l=u=>Math.hypot(u.x-t.x,u.y-t.y),f=u=>{let m=e[u],h=(u+e.length-1)%e.length,d=(u+1)%e.length,p=Math.abs(i[h]-i[u])<=Math.abs(i[d]-i[u])?h:d,y=e[p];return l(m)<=l(y)?[m,y]:[y,m]};return{start:a,end:c,startEdge:f(s[0]),endEdge:f(s[s.length-1])}}function Rl(e){return e.type==="shape"&&e.role==="wall"&&e.heightM===void 0}function di(e,t,n=()=>!0){let o=[];for(let c of e){if(!Rl(c)||!n(c))continue;let l=he(c);if(!l||l.length<3)continue;let f=Jb(l,t);if(!f)return[];o.push(f)}if(o.length<2)return[];let r=e.flatMap(c=>{if(c.type!=="shape"||c.role!=="entrance"&&c.role!=="exit")return[];let l=he(c);if(!l?.length)return[];let f=0,u=0;for(let m of l)f+=m.x,u+=m.y;return[{x:f/l.length,y:u/l.length}]}),i=c=>(c%Jn+Jn)%Jn;o.sort((c,l)=>i(c.start)-i(l.start));let s=c=>Math.hypot(c.x-t.x,c.y-t.y),a=[];for(let c=0;c<o.length;c++){let l=o[c],f=o[(c+1)%o.length],u=i(f.start-l.end);if(u<=0||u>=Math.PI/2)continue;let m=b=>i(b-l.end)<u;if(o.some(b=>b!==l&&b!==f&&(m(b.start)||m(b.end)||i(l.end-b.start)<b.end-b.start)))continue;let[d,p]=l.endEdge,[y,x]=f.startEdge,g={x:(d.x+p.x)/2,y:(d.y+p.y)/2},S={x:(y.x+x.x)/2,y:(y.y+x.y)/2},w=Math.hypot(S.x-g.x,S.y-g.y)*_;if(w<Kb||w>Wb||Math.abs(s(g)-s(S))*_>Yb+.2*w)continue;let I={x:(g.x+S.x)/2,y:(g.y+S.y)/2};r.some(b=>m(Math.atan2(b.y-t.y,b.x-t.x))&&Math.abs(s(b)-s(I))*_<=$b)||a.push({quad:[d,p,x,y],mid:I,widthM:w,openingM:qb(w)})}return a}function Il(e,t){let n=[];for(let i of t)if(i.text?.trim())for(let s of e){let a=Math.hypot(i.position.x-s.mid.x,i.position.y-s.mid.y)*_;a<=hi&&n.push({text:i,gate:s,d:a})}n.sort((i,s)=>i.d-s.d);let o=new Map,r=new Set;for(let{text:i,gate:s}of n)o.has(i.id)||r.has(s)||(o.set(i.id,s),r.add(s));return o}function Pl(e,t,n,o,r,i,s,a=()=>!0){let c=di(t,Sn(n),a);if(!c.length)return;let l=t.find(u=>Rl(u)&&a(u)),f=Vo(l?.fill,s);e.setMaterial(Bo);for(let u of c)r-u.openingM<Qb||No(e,u.quad,o+u.openingM,o+r,[],f.top,f.wall,i,r);e.setMaterial(0)}var ey=6,ty=2.2,$o=.1,ny=/^(gate|entrance|entry|exit|way in|way out|door)s?$/i,oy=new Set(["stage","entrance","exit","screen","suite","obstruction","sound","bar","concession","restroom","coat"]),ry=.3,iy=1.8,sy=.9,ay=.55,cy=1,wl=4e3,ly=6,_l="#d8a425",uy="#e8c15a",pi="#1c1608";function El(e){let t=fy(e);if(!t)return null;let n=Sl(e).find(o=>o.icon===t.icon);return{...t,name:n?.titleFallback??t.icon}}function fy(e){let t=e.accessibility;if(t?.length)return{icon:t.includes("wheelchair")?"wheelchair":t[0],color:go(t)};let n=e.commercial;return n?.obstructedView?{icon:"obstructedView",color:_l,ink:pi}:n?.restrictedView?{icon:"restrictedView",color:_l,ink:pi}:n?.premium?{icon:"premium",color:uy,ink:pi}:null}function my(e,t){if(!e)return;let n,o=0;for(let[i,s]of e)s>o&&(o=s,n=i);let r=t.categories?.find(i=>i.key===n)?.color;return r&&/^#[0-9a-f]{6}$/i.test(r)?r:void 0}var hy=6e3,dy=.25,Al=[-90,90,-135,135,-45,45];function py(e,t,n,o){let r=e.flatMap(({id:s,a,members:c})=>{let l=(a.minX+a.maxX)/2,f=(a.minY+a.maxY)/2,u=.5*Math.hypot(a.maxX-a.minX,a.maxY-a.minY),m=1/0;for(let h of c)m=Math.min(m,Math.hypot(t[h].x-l,t[h].y-f));return c.length&&m>=u*dy?[{id:s,cx:l,cy:f,half:u,members:c}]:[]}).sort((s,a)=>s.half-a.half),i=new Map;return r.forEach(({id:s,cx:a,cy:c,members:l},f)=>{let u=o.x-a,m=o.y-c,p=(Math.hypot(u,m)>1e-6?Math.atan2(m,u):0)+Al[f%Al.length]*Math.PI/180,y=Math.cos(p),x=Math.sin(p),g=-1,S=-1/0;for(let w of l){let I=(t[w].x-a)*y+(t[w].y-c)*x;I>S&&(S=I,g=w)}i.set(s,[t[g].x*_,n.seatDeckY(g),t[g].y*_])}),i}function kl(e){let{doc:t,units:n,seats:o,surfaces:r,focal:i}=e,s=t.zones??[],a=[];if(s.length){let c=new Map;for(let m of n)for(let h of m.objects)h.type==="section"&&h.zone&&c.set(h.id,h.zone);let l=new Map,f=new Map;for(let m=0;m<o.length;m++){let h=o[m],d=r.seatOwner[m],p=h.zoneId??(d?c.get(d):void 0);if(!p)continue;let y=l.get(p);y||(y={n:0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0,sumY:0},l.set(p,y));let x=f.get(p);x||f.set(p,x=[]),x.push(m),y.n++,h.x<y.minX&&(y.minX=h.x),h.y<y.minY&&(y.minY=h.y),h.x>y.maxX&&(y.maxX=h.x),h.y>y.maxY&&(y.maxY=h.y),y.sumY+=r.seatDeckY(m)}let u=py(s.flatMap(m=>{let h=l.get(m.id);return h?[{id:m.id,a:h,members:f.get(m.id)??[]}]:[]}),o,r,i);for(let m of s){let h=l.get(m.id),d=[];for(let[p,y]of c)y===m.id&&d.push(p);if(!h||h.n===0){a.push({id:m.id,label:m.label,color:be(m.color),sectionIds:d,seatCount:0,center:[0,0,0],radius:0,focalWorld:[(m.focalPoint??i).x*_,1.5,(m.focalPoint??i).y*_]});continue}a.push({id:m.id,label:m.label,color:be(m.color),sectionIds:d,seatCount:h.n,...u.has(m.id)?{labelAt:u.get(m.id)}:{},center:[(h.minX+h.maxX)/2*_,h.sumY/h.n,(h.minY+h.maxY)/2*_],radius:.5*Math.hypot((h.maxX-h.minX)*_,(h.maxY-h.minY)*_)||1,focalWorld:[(m.focalPoint??i).x*_,1.5,(m.focalPoint??i).y*_]})}}return a}function vl(e){let{doc:t,units:n,seats:o,surfaces:r,seatData:i,hintedSeatFloor:s,zones:a,focal:c}=e,l=[],f=[],u=[],m=new Map;for(let d of n)for(let p of d.objects){if(p.type!=="section"||!p.zone)continue;let y=(p.displayLabel||p.label||"").trim().toLocaleLowerCase();if(!y)continue;let x=t.floors?.[d.index]?.name?.trim().toLocaleLowerCase();if(n.length>1&&x===y)continue;let g=m.get(p.zone);g||m.set(p.zone,g=new Set),g.add(y)}for(let d of a)d.seatCount!==0&&(m.get(d.id)?.has(d.label.trim().toLocaleLowerCase())||l.push({id:`zone:${d.id}`,kind:"zone",text:d.label,anchor:[(d.labelAt??d.center)[0],(d.labelAt??d.center)[1]+ey,(d.labelAt??d.center)[2]],color:t.zones?.find(p=>p.id===d.id)?.color}));{let d=new Map,p=new Map,y=new Map,x=new Map;for(let g=0;g<o.length;g++){let S=r.seatOwner[g];if(!S)continue;let w=d.get(S);w||(w={n:0,x:0,y:0,deck:0},d.set(S,w)),w.n++,w.x+=o[g].x,w.y+=o[g].y,w.deck+=r.seatDeckY(g);let I=o[g].categoryKey;if(I){let R=p.get(S);R||(R=new Map,p.set(S,R)),R.set(I,(R.get(I)??0)+1)}if(o[g].accessibility?.includes("wheelchair")){let R=y.get(S);R?R.push(g):y.set(S,[g])}let b=x.get(S);b||(b={minX:1/0,maxX:-1/0,minY:1/0,maxY:-1/0,minDeck:1/0,maxDeck:-1/0},x.set(S,b)),b.minDeck=Math.min(b.minDeck,r.seatDeckY(g)),b.maxDeck=Math.max(b.maxDeck,r.seatDeckY(g)),o[g].x<b.minX&&(b.minX=o[g].x),o[g].x>b.maxX&&(b.maxX=o[g].x),o[g].y<b.minY&&(b.minY=o[g].y),o[g].y>b.maxY&&(b.maxY=o[g].y)}for(let g of n)for(let S of g.objects){if(S.type!=="section"||fl(S))continue;let w=d.get(S.id);if(!w||w.n===0)continue;let I=x.get(S.id),b=[w.x/w.n*_,w.deck/w.n,w.y/w.n*_],R=S.displayLabel||S.label||S.id;f.push({id:S.id,floorIndex:g.index,label:R,seatCount:w.n,center:b,radius:Math.max(1,Math.hypot(I.maxX-I.minX,I.maxY-I.minY)*.5*_),box:{min:[I.minX*_-.4,I.minDeck,I.minY*_-.4],max:[I.maxX*_+.4,I.maxDeck+1,I.maxY*_+.4]},focalWorld:[g.focal.x*_,g.baseHeightM+1.5,g.focal.y*_]});let P=t.floors?.[g.index]?.name?.trim().toLocaleLowerCase();if(!(n.length>1&&P===R.trim().toLocaleLowerCase())){let M=my(p.get(S.id),t),C=y.get(S.id);l.push({id:`section:${S.id}`,kind:"section",text:R,anchor:[b[0],b[1]+ty,b[2]],floorIndex:g.index,...M?{tint:M}:{},...C?{wheelchairSeats:C}:{}})}}}{for(let b of n)for(let R of b.objects){if(R.type!=="gaArea")continue;let P=Qt(R.points);if(!P)continue;let M=R.labelPresentation?.visible===!1?"":R.displayLabel||R.label||R.id,C=R.capacity>0?[M,R.capacity.toLocaleString()].filter(Boolean).join(" \xB7 "):M;C&&l.push({id:`ga:${R.id}`,kind:"ga",text:C,areaName:M,anchor:[P.x*_,b.baseHeightM+iy,P.y*_],floorIndex:b.index})}let d=new Map,p=new Map;for(let b of n)for(let R of b.objects)if(R.type==="section"&&d.set(R.id,R.displayLabel||R.label||R.id),R.type==="row"){let P=R.displayLabel?.trim()||R.segmentedRow?.displayLabel?.trim();P&&p.set(R.id,P)}let y=new Map;for(let b=0;b<o.length;b++){let R=o[b],P=Math.hypot(R.x-c.x,R.y-c.y),M=y.get(R.rowId);(!M||P>M.far)&&y.set(R.rowId,{seat:R,index:b,far:P})}for(let[b,R]of y){let P=r.seatOwner[R.index]??R.seat.sectionId,M=Cl(R.seat.label,b,d.get(P??""),p.get(b));M&&l.push({id:`row:${b}`,kind:"row",text:M,anchor:[R.seat.x*_,r.seatDeckY(R.index)+sy,R.seat.y*_],floorIndex:s[R.index]})}let x=new Map;for(let b=0;b<o.length;b++){let R=o[b],P=x.get(R.rowId);P||(P={n:0,x:0,y:0,z:0,minX:1/0,maxX:-1/0,minZ:1/0,maxZ:-1/0,label:Cl(R.label,R.rowId,d.get(r.seatOwner[b]??R.sectionId??""),p.get(R.rowId)),sectionId:r.seatOwner[b]??R.sectionId},x.set(R.rowId,P));let M=b*3,C=i.iPosition[M],T=i.iPosition[M+1],v=i.iPosition[M+2];P.n++,P.x+=C,P.y+=T,P.z+=v,P.minX=Math.min(P.minX,C),P.maxX=Math.max(P.maxX,C),P.minZ=Math.min(P.minZ,v),P.maxZ=Math.max(P.maxZ,v)}for(let[b,R]of x)u.push({id:b,label:R.label,sectionId:R.sectionId,seatCount:R.n,center:[R.x/R.n,R.y/R.n,R.z/R.n],radius:Math.max(.8,Math.hypot(R.maxX-R.minX,R.maxZ-R.minZ)*.5)});let g=0,S=(b,R)=>{g++,l.push({id:`access:${o[b].id}`,kind:"access",text:R.name,icon:R.icon,color:R.color,...R.ink?{ink:R.ink}:{},seatWidthM:i.iChairWidth[b]*2,anchor:[o[b].x*_,r.seatDeckY(b)+cy,o[b].y*_],floorIndex:s[b],rowId:o[b].rowId})},w=null,I=()=>{if(w){let b=El(o[w.seats[0]]),R=w.seats.length,P=Math.max(1,Math.round(R/ly));for(let M=0;M<P&&g<wl;M++)S(w.seats[Math.min(R-1,Math.floor((M+.5)*R/P))],b)}w=null};for(let b=0;b<o.length&&g<wl;b++){let R=El(o[b]);if(R&&o[b].accessibility?.length){I(),S(b,R);continue}if(!R){I();continue}w&&w.rowId===o[b].rowId&&w.icon===R.icon?w.seats.push(b):(I(),w={rowId:o[b].rowId,icon:R.icon,seats:[b]})}if(I(),o.length<=hy)for(let b=0;b<o.length;b++){let R=o[b],P=by(R.displayLabel||R.label);P&&l.push({id:`seat:${R.id}`,kind:"seat",seatWidthM:i.iChairWidth[b]*2,text:P,anchor:[R.x*_,r.seatDeckY(b)+ay,R.y*_],floorIndex:s[b],rowId:R.rowId})}}let h=vo(n);for(let d of n){let p=Gt(d,n.length===1?o:o.filter((g,S)=>s[S]===d.index)),y=p?Il(di(d.objects,Sn(p)),d.objects.filter(g=>g.type==="text")):new Map,x=[...y.values()];for(let g of d.objects){let S=g.type==="text"?y.get(g.id):void 0;if(g.type==="shape"&&(g.role==="entrance"||g.role==="exit")&&ny.test(g.label?.trim()??"")){let w=he(g),I=w?Qt(w):null;if(I&&x.some(b=>Math.hypot(I.x-b.mid.x,I.y-b.mid.y)*_<=hi+b.widthM))continue}if(S&&g.type==="text")l.push({id:`text:${g.id}`,kind:"gate",text:g.text,icon:"entrance",anchor:[S.mid.x*_,d.baseHeightM+S.openingM+$o,S.mid.y*_],color:g.color,floorIndex:d.index});else if(g.type==="shape"&&g.role&&oy.has(g.role)){if(h.has(g))continue;let w=he(g),I=w?Qt(w):null;if(!I||!g.label||g.gate?.hideFromBuyers)continue;l.push({id:`architecture:${g.id}`,kind:g.role==="stage"?"stage":g.role==="entrance"||g.role==="exit"?"gate":"annotation",text:g.label,...g.role==="entrance"||g.role==="exit"?{icon:g.role}:{},...g.gate?.stepFree?{stepFree:!0}:{},anchor:[I.x*_,d.baseHeightM+dt(g).heightM+$o,I.y*_],color:g.fill,floorIndex:d.index})}else if(g.type==="text"){let w=g.semanticKind==="icon"?Ur(g.iconKey)?.key:void 0,I=g.text||(w?Ur(w).label:"");if(!I)continue;l.push({id:`text:${g.id}`,kind:"annotation",text:I,...w?{venueIcon:w}:{},anchor:w?[(g.position.x+g.fontSize/2)*_,d.baseHeightM+$o,(g.position.y+g.fontSize/2)*_]:[g.position.x*_,d.baseHeightM+$o,g.position.y*_],color:g.color,rotation:g.rotation,floorIndex:d.index})}else if(g.type==="booth"){if(g.labelPresentation?.visible===!1)continue;let w=yt(g);if(!w)continue;let I=Qt(w);if(!I)continue;l.push({id:`booth:${g.id}`,kind:"booth",text:g.displayLabel||g.label||g.id,anchor:[I.x*_,d.baseHeightM+Uo+ry,I.y*_],floorIndex:d.index})}}}return{labels:l,sections:f,rows:u}}function Ol(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 by(e){let t=e.lastIndexOf("-");return t>=0&&t<e.length-1?e.slice(t+1):e}function Cl(e,t,n,o){if(o?.trim())return o.trim();let r=e?e.lastIndexOf("-"):-1,i=r>0?e.slice(0,r):t;return i&&xl(i,n)}function Tl(e){let{doc:t,units:n,seats:o,surfaces:r,solids:i,hintedSeatFloor:s,seatFloor:a}=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 m=0;m<i.floor.length;m+=1){let h=Math.max(0,Math.min(n.length-1,Math.round(i.floor[m]))),d=m*3,p=l[h];p.minX=Math.min(p.minX,i.position[d]),p.minY=Math.min(p.minY,i.position[d+1]),p.minZ=Math.min(p.minZ,i.position[d+2]),p.maxX=Math.max(p.maxX,i.position[d]),p.maxY=Math.max(p.maxY,i.position[d+1]),p.maxZ=Math.max(p.maxZ,i.position[d+2])}let f=new Map;for(let m=0;m<n.length;m++)for(let h of n[m].objects)h.type==="section"&&f.set(h.id,m);let u=n.map(()=>({n:0,minX:1/0,minY:1/0,minDeck:1/0,maxX:-1/0,maxY:-1/0,maxDeck:-1/0,sumX:0,sumDeck:0,sumZ:0}));for(let m=0;m<o.length;m++){let h=r.seatOwner[m],d=(h!==null?f.get(h):void 0)??s[m];if(d===void 0)continue;let p=u[d],y=o[m];p.n++,y.x<p.minX&&(p.minX=y.x),y.y<p.minY&&(p.minY=y.y),y.x>p.maxX&&(p.maxX=y.x),y.y>p.maxY&&(p.maxY=y.y);let x=r.seatDeckY(m);p.sumX+=y.x*_,p.sumDeck+=x,p.sumZ+=y.y*_,p.minDeck=Math.min(p.minDeck,x),p.maxDeck=Math.max(p.maxDeck,x+1.6),a[m]=d}for(let m=0;m<n.length;m++){let h=u[m],d=t.floors?.[m],p=l[m],y=Math.min(h.n?h.minX*_:n[m].focal.x*_-1,Number.isFinite(p.minX)?p.minX:1/0),x=Math.max(h.n?h.maxX*_:n[m].focal.x*_+1,Number.isFinite(p.maxX)?p.maxX:-1/0),g=Math.min(h.n?h.minY*_:n[m].focal.y*_-1,Number.isFinite(p.minZ)?p.minZ:1/0),S=Math.max(h.n?h.maxY*_:n[m].focal.y*_+1,Number.isFinite(p.maxZ)?p.maxZ:-1/0),w=Math.min(h.n?Math.min(n[m].baseHeightM,h.minDeck):n[m].baseHeightM,Number.isFinite(p.minY)?p.minY:1/0),I=Math.max(h.n?Math.max(h.maxDeck,w+.5):w+.5,Number.isFinite(p.maxY)?p.maxY:-1/0),b=[h.n?h.sumX/h.n:(y+x)/2,h.n?h.sumDeck/h.n:(w+I)/2,h.n?h.sumZ/h.n:(g+S)/2],R=Math.max(1,.5*Math.hypot(x-y,I-w,S-g));c.push({index:m,id:d?.id??`floor-${m}`,label:d?.name??(n.length>1?`Floor ${m+1}`:"Venue"),seatCount:h.n,center:b,radius:R,box:{min:[y,w,g],max:[x,I,S]},focalWorld:[n[m].focal.x*_,n[m].baseHeightM+1.5,n[m].focal.y*_]})}}return c}function xi(e,t){let n=1/0,o=1/0,r=-1/0,i=-1/0,s=(a,c)=>{a<n&&(n=a),c<o&&(o=c),a>r&&(r=a),c>i&&(i=c)};for(let a of t)s(a.x,a.y);for(let a of e)for(let c of a.objects)if(c.type==="section")for(let l of c.outline)s(l.x,l.y);else if(c.type==="shape"&&c.points)for(let l of c.points)s(l.x,l.y);else if(c.type==="gaArea")for(let l of c.points)s(l.x,l.y);else if(c.type==="booth"){let l=yt(c);if(l)for(let f of l)s(f.x,f.y)}else if(c.type==="table"){let l=Xo(c);if(l)for(let f of l)s(f.x,f.y)}else if(c.type==="decorImage"){let l=Ko(c);if(l)for(let f of l)s(f.x,f.y)}return Number.isFinite(n)||(n=-100,o=-100,r=100,i=100),{minX:n,minY:o,maxX:r,maxY:i}}function Hl(e,t,n,o,r,i){if(t.length===1){let s=n.map(u=>({x:u.x,y:u.y}));for(let u of t[0].objects)u.type==="section"?s.push(...u.outline):u.type==="shape"?s.push(...he(u)??u.points??[]):u.type==="gaArea"?s.push(...u.points):u.type==="booth"?s.push(...yt(u)??[]):u.type==="table"?s.push(...Xo(u)??[]):u.type==="decorImage"&&s.push(...Ko(u)??[]);if(Nl(e,t[0],n,i)||Gl(e,t[0],n,s,i))return!1;if(Fl(e,t[0].baseHeightM,s,i))return!0;let a=Wn(s),c=(r.minX+r.maxX)/2,l=(r.minY+r.maxY)/2,f=a.length>=3?a.map(u=>{let m=u.x-c,h=u.y-l,d=Math.max(1,Math.hypot(m,h));return{x:u.x+m/d*80,y:u.y+h/d*80}}):On(r.minX-28,r.minY-28,r.maxX-r.minX+56,r.maxY-r.minY+56);return Q(e,f,void 0,()=>-.04,-.22,i.ground,i.ground,z),!1}else{let s=t.reduce((p,y)=>y.baseHeightM<p.baseHeightM?y:p);e.setFloor(vn);let a={...s,objects:t.flatMap(p=>p.objects)},c=n.map(p=>({x:p.x,y:p.y}));for(let p of a.objects)p.type==="section"&&c.push(...p.outline);if(Nl(e,a,n,i)||Gl(e,a,n,c,i))return!1;if(Fl(e,s.baseHeightM,c,i))return!0;let l=n.filter((p,y)=>o[y]===s.index),f=xi([s],l),u=Math.hypot(f.maxX-f.minX,f.maxY-f.minY),m=Math.max(28,Math.min(80,u*.04)),h=On(f.minX-m,f.minY-m,f.maxX-f.minX+m*2,f.maxY-f.minY+m*2),d=s.baseHeightM-.03;return Q(e,h,void 0,()=>d,d-.22,i.ground,i.ground,z),!1}}function Mi(e,t,n,o){let{cx:r,cz:i,radius:s}=n,a=1/0,c=1/0,l=1/0,f=-1/0,u=-1/0,m=-1/0,h=(y,x,g)=>{a=Math.min(a,y),f=Math.max(f,y),c=Math.min(c,x),u=Math.max(u,x),l=Math.min(l,g),m=Math.max(m,g)};for(let y=0;y<e.position.length;y+=3){let x=y/3;o&&x>=o[0]&&x<o[1]||h(e.position[y],e.position[y+1],e.position[y+2])}for(let y=0;y<t.count;y++){let x=y*3,g=t.iPosition[x],S=t.iPosition[x+1],w=t.iPosition[x+2],I=Math.max(.35,t.iMaxRadius[y]??.35);h(g-I,S,w-I),h(g+I,S+1.6,w+I)}Number.isFinite(a)||(a=r-s,f=r+s,c=0,u=s*.16,l=i-s,m=i+s);let d=[(a+f)/2,(c+u)/2,(l+m)/2],p=Math.max(1,.5*Math.hypot(f-a,u-c,m-l));return{center:d,radius:p,minY:c,maxY:u}}var yy=4096;function jl(e,t,n=[]){let o=Math.max(1,Math.ceil(e.count/yy)),r=Math.ceil(e.count/o),i=new Float32Array((r*2+t.length*4+n.length)*3),s=0;for(let a=0;a<e.count;a+=o){let c=e.iPosition[a*3],l=e.iPosition[a*3+1],f=e.iPosition[a*3+2];i[s++]=c,i[s++]=l,i[s++]=f,i[s++]=c,i[s++]=0,i[s++]=f}for(let[a,c,l]of n)i[s++]=a,i[s++]=c,i[s++]=l;for(let a of t)for(let[c,l]of[[-1,-1],[1,-1],[1,1],[-1,1]])i[s++]=a.cx+c*a.halfX,i[s++]=a.y,i[s++]=a.cz+l*a.halfZ;return i.subarray(0,s)}function Vl(e,t,n,o,r,i,s=[]){let a=1/0,c=1/0,l=-1/0,f=-1/0;for(let I=0;I<e.count;I++){let b=I*3,R=e.iPosition[b],P=e.iPosition[b+2];R<a&&(a=R),R>l&&(l=R),P<c&&(c=P),P>f&&(f=P)}for(let[I,,b]of s)I<a&&(a=I),I>l&&(l=I),b<c&&(c=b),b>f&&(f=b);for(let I of t)a=Math.min(a,I.cx-I.halfX),l=Math.max(l,I.cx+I.halfX),c=Math.min(c,I.cz-I.halfZ),f=Math.max(f,I.cz+I.halfZ);let u=n.minX*_,m=n.maxX*_,h=n.minY*_,d=n.maxY*_,p=u,y=m,x=h,g=d;if(Number.isFinite(a)){let I=Math.max(2,.06*Math.hypot(l-a,f-c));p=Math.max(u,a-I),y=Math.min(m,l+I),x=Math.max(h,c-I),g=Math.min(d,f+I)}let S=Math.min(0,o),w=Math.max(r,i*.05);return{min:[p,S,x],max:[y,w,g]}}var bi=12,gy=.5,xy=6,yi=.8,Ll=5,My=.6,Sy=40,gi=0,Bl=8;function Fl(e,t,n,o){let r=Wn([...n]);if(r.length<3)return!1;let i=1/0,s=1/0,a=-1/0,c=-1/0;for(let I of r)i=Math.min(i,I.x),a=Math.max(a,I.x),s=Math.min(s,I.y),c=Math.max(c,I.y);let l=Math.hypot(a-i,c-s)*_,f=Math.max(Sy,l*My),u=I=>It(r,I/_,1.2),m=u(gy),h=[m,u(xy),u(bi),u(bi+Ll),u(bi+Ll+f)];if(h.some(I=>I.length!==m.length))return!1;let d=ce(o.ground,[.78,.76,.72],.35),p=ce(o.ground,[.56,.62,.52],.3),y=[d[0]*yi,d[1]*yi,d[2]*yi],x=t-.04;e.setMaterial(gi),Q(e,m,void 0,()=>x,t-.22,y,y,z);let g=[0,1,0],S=(I,b,R,P,M)=>{let C=I.map(E=>[E.x*_,x,E.y*_]),T=b.map(E=>[E.x*_,x,E.y*_]),[v,k]=M;for(let E=0;E<C.length;E++){let A=(E+1)%C.length;e.tri(C[E],T[A],T[E],g,R,P,P,[v,k,k]),e.tri(C[E],C[A],T[A],g,R,R,P,[v,v,k])}},w=[gi,gi];return S(h[0],h[1],y,d,w),S(h[1],h[2],d,d,w),S(h[2],h[3],d,p,w),S(h[3],h[4],p,p,[Bl,Bl+1]),e.setMaterial(0),!0}function Nl(e,t,n,o){let r=Gt(t,n);if(!r)return!1;let i=t.baseHeightM,s=ce(o.ground,[.62,.55,.47],.4);return Q(e,r,void 0,()=>i-.04,i-.22,s,s,z),!0}var Ry=3e3,Iy=20,Dl=1.5,Py=1.2,wy=.25;function Gl(e,t,n,o,r){if(!n.length||n.length>Ry||o.length<3)return!1;for(let M of t.objects){if(M.type==="shape"&&tn(M.stageKind))return!1;if(M.type==="section"){let{height:C}=Lt(M,{floorBaseHeightM:t.baseHeightM});if(C-t.baseHeightM>Iy)return!1}}let i=0,s=0;for(let M of o)i+=M.x,s+=M.y;i/=o.length,s/=o.length;let a=0,c=0,l=0;for(let M of o){let C=M.x-i,T=M.y-s;a+=C*C,c+=T*T,l+=C*T}let f=.5*Math.atan2(2*l,a-c),u=Math.cos(f),m=Math.sin(f),h=-m,d=u,p=1/0,y=-1/0,x=1/0,g=-1/0;for(let M of o){let C=(M.x-i)*u+(M.y-s)*m,T=(M.x-i)*h+(M.y-s)*d;p=Math.min(p,C),y=Math.max(y,C),x=Math.min(x,T),g=Math.max(g,T)}let S=M=>[[p-M,x-M],[y+M,x-M],[y+M,g+M],[p-M,g+M]].map(([C,T])=>({x:i+u*C+h*T,y:s+m*C+d*T})),w=S(Dl/_),I=S((Dl+wy)/_),b=t.baseHeightM,R=ce(r.ground,[.62,.55,.47],.4),P=ce(r.ground,[.86,.86,.84],.55);return Q(e,I,void 0,()=>b-.04,b-.22,R,R,z),Q(e,I,[w.slice().reverse()],()=>b+Py,b-.04,ce(P,[1,1,1],.2),P,z),!0}function Ul(e,t,n){let o=()=>({byObjectId:new Map,elements:[]});if(!t||!e)return o();let r=ns(t);if(!r.ok||r.value.id!==e)return o();let i=new Map;for(let u of n)for(let m of u.objects)m.type==="shape"&&i.set(m.id,{shape:m,unit:u});let s=new Set,a=new Set,c=new Map((t.overlay.productionElements??[]).map(u=>{let m=u.runtimeContentImageUrl;return[u.id,typeof m=="string"&&/^(?:blob:|data:image\/|https:\/\/)/.test(m)?m:void 0]})),l=[];for(let u of r.value.overlay.productionElements??[]){let m=i.get(u.objectId),h=m?he(m.shape):null,d=u.baseElevationM??0;if(!m||!h||h.length<3||!u.id||s.has(u.id)||a.has(u.objectId)||!Number.isFinite(u.heightM)||u.heightM<.05||u.heightM>50||!Number.isFinite(d)||d<-10||d>100)return o();s.add(u.id),a.add(u.objectId);let p=h.map(P=>P.x*_),y=h.map(P=>P.y*_),x=m.unit.baseHeightM+d,g=Math.min(...p),S=Math.max(...p),w=Math.min(...y),I=Math.max(...y),b,R=c.get(u.id)??u.contentImageUrl;if(u.kind==="screen"&&R&&(b=pc(h,x,x+u.heightM,m.unit.focal),!b))if(S-g>=I-w){let P=Math.abs(w-m.unit.focal.y*_)<=Math.abs(I-m.unit.focal.y*_)?w-.006:I+.006;b=[[g,x,P],[S,x,P],[g,x+u.heightM,P],[S,x+u.heightM,P]]}else{let P=Math.abs(g-m.unit.focal.x*_)<=Math.abs(S-m.unit.focal.x*_)?g-.006:S+.006;b=[[P,x,w],[P,x,I],[P,x+u.heightM,w],[P,x+u.heightM,I]]}l.push({id:u.id,objectId:u.objectId,kind:u.kind,floorIndex:m.unit.index,baseY:x,topY:x+u.heightM,bounds:{min:[g,x,w],max:[S,x+u.heightM,I]},occlusion:u.occlusion,...R?{contentImageUrl:R}:{},...b?{contentPlane:b}:{}})}let f=l.sort((u,m)=>u.id.localeCompare(m.id));return{byObjectId:new Map(f.map(u=>[u.objectId,u])),elements:f}}var _y=[1,.87,.64],Ey=[1,.96,.84],Xl=[.98,.66,.28],Et={poolEdge:{stage:.88,ring:.74},poolStrength:.6,poolLift:{stage:.02,ring:.006},lamps:{stage:8,ring:4},lampOut:.7,lampHeightM:[6,12],lampRadiusM:[.16,.28],minSpanM:3};function Ay(e,t){let n=e.stageKind;if(n==="ring-boxing")return"ring";if(ot(n)||!t.length)return null;if(n==="round")return"stage";let o=he(e);return!o||o.length<3?null:fn(Kl(o),t)?"stage":null}function Cy(e,t,n,o){let r=1/0;for(let i=0;i<e.length;i++){let s=e[i],a=e[(i+1)%e.length],c=a.x-s.x,l=a.y-s.y,f=n*l-o*c;if(Math.abs(f)<1e-12)continue;let u=((s.x-t.x)*l-(s.y-t.y)*c)/f,m=((s.x-t.x)*o-(s.y-t.y)*n)/f;u>1e-9&&m>=-1e-9&&m<=1+1e-9&&(r=Math.min(r,u))}return Number.isFinite(r)?r:0}function Kl(e){return{x:e.reduce((t,n)=>t+n.x,0)/e.length,y:e.reduce((t,n)=>t+n.y,0)/e.length}}function Wl(e,t,n,o,r={}){if(!r.night||!r.deck)return!1;let i=Ay(t,o);if(!i)return!1;let s=he(t);if(!s||s.length<3)return!1;let a=Kl(s);if(!Ve(s,a.x,a.y))return!1;let c=28,l=[];for(let M=0;M<c;M++){let C=2*Math.PI*M/c;l.push(Cy(s,a,Math.cos(C),Math.sin(C))*Et.poolEdge[i])}if(l.some(M=>!(M>0)))return!1;let f=Math.min(...l)*_;if(f*2<Et.minSpanM*Et.poolEdge[i])return!1;let u=r.deck,m=n+Et.poolLift[i],h=[0,1,0],d=(M,C)=>{let T=2*Math.PI*(M%c)/c,v=l[M%c]*C;return[(a.x+Math.cos(T)*v)*_,m,(a.y+Math.sin(T)*v)*_]},p=[a.x*_,m,a.y*_],y=M=>ce(u,_y,Et.poolStrength*M),x=[{r:.4,k:.72},{r:.72,k:.28},{r:1,k:0}];e.setMaterial(0);for(let M=0;M<c;M++){e.tri(p,d(M+1,x[0].r),d(M,x[0].r),h,y(1),y(x[0].k),y(x[0].k));for(let C=0;C+1<x.length;C++){let T=x[C],v=x[C+1];e.tri(d(M,T.r),d(M+1,v.r),d(M,v.r),h,y(T.k),y(v.k),y(v.k)),e.tri(d(M,T.r),d(M+1,T.r),d(M+1,v.r),h,y(T.k),y(T.k),y(v.k))}}let[g,S]=Et.lampHeightM,w=n+Math.max(g,Math.min(S,f*1.6)),I=Math.max(Et.lampRadiusM[0],Math.min(Et.lampRadiusM[1],f*.05)),b=[0,-1,0],R=Et.lamps[i],P=10;e.setMaterial(un);for(let M=0;M<R;M++){let C=2*Math.PI*(M+.5)/R,T=f*Et.lampOut,v=a.x*_+Math.cos(C)*T,k=a.y*_+Math.sin(C)*T;for(let E=0;E<P;E++){let A=2*Math.PI*E/P,O=2*Math.PI*(E+1)/P;e.tri([v,w,k],[v+Math.cos(A)*I,w,k+Math.sin(A)*I],[v+Math.cos(O)*I,w,k+Math.sin(O)*I],b,Ey,Xl,Xl)}}return e.setMaterial(0),!0}function ky(e){let t=Math.min(1,Math.max(0,e));return t<=.0031308?t*12.92:1.055*Math.pow(t,1/2.4)-.055}function Qe(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function nt(e){return Array.isArray(e)?e:[]}function vy(e){let t=[e];for(;t.length;){let n=t.pop();if(Array.isArray(n)){t.push(...n);continue}if(!Qe(n))continue;let o=Qe(n.extensions)?n.extensions:null;if(o&&Object.prototype.hasOwnProperty.call(o,"KHR_draco_mesh_compression"))return!0;t.push(...Object.values(n))}return!1}function eo(e,t){return!Array.isArray(e)||e.length!==t||!e.every(n=>typeof n=="number"&&Number.isFinite(n))?null:e}function Oy(){return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}function Ty(e,t){let n=new Array(16).fill(0);for(let o=0;o<4;o++)for(let r=0;r<4;r++)for(let i=0;i<4;i++)n[o*4+r]+=e[i*4+r]*t[o*4+i];return n}function Ly(e){let t=eo(e.matrix,16);if(t)return t;if(e.matrix!==void 0)return null;let n=e.translation===void 0?[0,0,0]:eo(e.translation,3),o=e.rotation===void 0?[0,0,0,1]:eo(e.rotation,4),r=e.scale===void 0?[1,1,1]:eo(e.scale,3);if(!n||!o||!r)return null;let[i,s,a,c]=o,l=Math.hypot(i,s,a,c);if(!(l>1e-8))return null;let f=i/l,u=s/l,m=a/l,h=c/l,d=f+f,p=u+u,y=m+m,x=f*d,g=f*p,S=f*y,w=u*p,I=u*y,b=m*y,R=h*d,P=h*p,M=h*y;return[(1-(w+b))*r[0],(g+M)*r[0],(S-P)*r[0],0,(g-M)*r[1],(1-(x+b))*r[1],(I+R)*r[1],0,(S+P)*r[2],(I-R)*r[2],(1-(x+w))*r[2],0,n[0],n[1],n[2],1]}function By(e,t,n,o){return[e[0]*t+e[4]*n+e[8]*o+e[12],e[1]*t+e[5]*n+e[9]*o+e[13],e[2]*t+e[6]*n+e[10]*o+e[14]]}function Fy(e){let t=e[0],n=e[4],o=e[8],r=e[1],i=e[5],s=e[9],a=e[2],c=e[6],l=e[10],f=i*l-s*c,u=s*a-r*l,m=r*c-i*a,h=t*f+n*u+o*m;if(Math.abs(h)<1e-12)return null;let d=1/h;return[f*d,u*d,m*d,(o*c-n*l)*d,(t*l-o*a)*d,(n*a-t*c)*d,(n*s-o*i)*d,(o*r-t*s)*d,(t*i-n*r)*d]}function Yl(e,t,n,o){let r=e[0]*t+e[1]*n+e[2]*o,i=e[3]*t+e[4]*n+e[5]*o,s=e[6]*t+e[7]*n+e[8]*o,a=Math.hypot(r,i,s)||1;return r/=a,i/=a,s/=a,[r,i,s]}function Ny(e){if(e.byteLength<20||e.byteLength>8388608)return null;let t=new DataView(e.buffer,e.byteOffset,e.byteLength);if(t.getUint32(0,!0)!==1179937895||t.getUint32(4,!0)!==2||t.getUint32(8,!0)!==e.byteLength)return null;let n=12,o=null,r=null;for(;n+8<=e.byteLength;){let i=t.getUint32(n,!0),s=t.getUint32(n+4,!0);if(n+=8,i%4!==0||n+i>e.byteLength)return null;let a=e.subarray(n,n+i);if(s===1313821514&&!o)try{let c=JSON.parse(new TextDecoder().decode(a).replace(/[\u0000 ]+$/g,""));if(!Qe(c))return null;o=c}catch{return null}else if(s===5130562&&!r)r=a;else return null;n+=i}return n===e.byteLength&&o&&r?{json:o,bin:r}:null}function Dy(e){return e===5120||e===5121?1:e===5122||e===5123?2:e===5125||e===5126?4:0}function Gy(e){return e==="SCALAR"?1:e==="VEC2"?2:e==="VEC3"?3:e==="VEC4"?4:0}function Hy(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 jy(e){let t=e instanceof Uint8Array?e:new Uint8Array(e),n=Ny(t);if(!n)return{ok:!1,issue:"invalid_glb"};let{json:o,bin:r}=n;if(!Qe(o.asset)||o.asset.version!=="2.0")return{ok:!1,issue:"unsupported_glb"};let i=nt(o.extensionsUsed).filter(P=>typeof P=="string");if(i.includes("KHR_draco_mesh_compression")||vy(o))return{ok:!1,issue:"draco_not_allowed"};if(i.length||nt(o.extensionsRequired).length)return{ok:!1,issue:"unsupported_glb"};if(nt(o.images).length||nt(o.textures).length)return{ok:!1,issue:"external_resource"};let s=nt(o.buffers);if(s.length!==1||!Qe(s[0])||s[0].uri!==void 0||typeof s[0].byteLength!="number"||!Number.isInteger(s[0].byteLength)||s[0].byteLength<0||s[0].byteLength>r.byteLength)return{ok:!1,issue:"external_resource"};let a=nt(o.accessors),c=nt(o.bufferViews),l=nt(o.meshes),f=nt(o.nodes),u=nt(o.scenes),m=typeof o.scene=="number"?o.scene:0;if(!Qe(u[m]))return{ok:!1,issue:"unsupported_glb"};let h=new DataView(r.buffer,r.byteOffset,r.byteLength),d=(P,M,C,T=!1)=>{if(typeof P!="number"||!Number.isInteger(P)||!Qe(a[P]))return null;let v=a[P],k=typeof M=="string"?v.type===M:M.includes(v.type),E=v.componentType!==5126,A=T&&E?v.normalized===!0:v.normalized!==!0;if(!k||v.sparse!==void 0||!A||typeof v.count!="number"||!Number.isInteger(v.count)||v.count<1||typeof v.componentType!="number"||!C.includes(v.componentType)||typeof v.bufferView!="number")return null;let O=c[v.bufferView];if(!Qe(O)||O.buffer!==0||typeof O.byteLength!="number"||!Number.isInteger(O.byteLength)||O.byteLength<0)return null;let F=Gy(v.type),L=Dy(v.componentType),B=typeof O.byteStride=="number"?O.byteStride:F*L,D=typeof O.byteOffset=="number"?O.byteOffset:0,j=typeof v.byteOffset=="number"?v.byteOffset:0,H=D+j,V=j+(v.count-1)*B+F*L;if(!Number.isInteger(B)||!Number.isInteger(D)||!Number.isInteger(j)||B<F*L||D<0||j<0||D+O.byteLength>r.byteLength||V>O.byteLength)return null;let U=[];for(let $=0;$<v.count;$++){let X=[];for(let Y=0;Y<F;Y++){let Z=Hy(h,H+$*B+Y*L,v.componentType);if(!Number.isFinite(Z))return null;X.push(Z)}U.push(X)}return U},p=[],y=[],x=[],g=!1,S=nt(o.materials),w=P=>{if(P===void 0)return null;if(typeof P!="number"||!Number.isInteger(P)||!Qe(S[P]))return!1;let M=S[P].pbrMetallicRoughness;if(M===void 0)return null;if(!Qe(M))return!1;if(M.baseColorFactor===void 0)return null;let C=eo(M.baseColorFactor,4);return!C||C.some(T=>T<0||T>1)?!1:[C[0],C[1],C[2]]},I=0,b=new Set,R=(P,M)=>{if(typeof P!="number"||!Number.isInteger(P)||!Qe(f[P])||b.has(P))return!1;b.add(P);let C=f[P],T=Ly(C);if(!T)return!1;let v=Ty(M,T),k=Fy(v);if(!k)return!1;if(C.mesh!==void 0){if(typeof C.mesh!="number")return!1;let E=l[C.mesh];if(!Qe(E))return!1;for(let A of nt(E.primitives)){if(!Qe(A)||A.mode!==void 0&&A.mode!==4||!Qe(A.attributes))return!1;let O=d(A.attributes.POSITION,"VEC3",[5126]),F=A.attributes.NORMAL===void 0?null:d(A.attributes.NORMAL,"VEC3",[5126]);if(!O||A.attributes.NORMAL!==void 0&&!F)return!1;let L=w(A.material);if(L===!1)return!1;let B=A.attributes.COLOR_0===void 0?null:d(A.attributes.COLOR_0,["VEC3","VEC4"],[5126,5121,5123],!0);if(A.attributes.COLOR_0!==void 0&&(!B||B.length!==O.length))return!1;let D=B?a[A.attributes.COLOR_0]:null,j=!D||D.componentType===5126?1:D.componentType===5121?1/255:1/65535,H=L!==null||B!==null;H&&(g=!0);let V=O.length;if(A.indices!==void 0){let $=typeof A.indices=="number"?a[A.indices]:null;V=Qe($)?$.count:void 0}if(typeof V!="number"||!Number.isInteger(V)||V%3!==0||(I+=V/3,I>1e5))return!1;let U=A.indices===void 0?O.map(($,X)=>[X]):d(A.indices,"SCALAR",[5121,5123,5125]);if(!U||U.length%3!==0||U.length!==V)return!1;for(let $=0;$<U.length;$+=3){let X=[U[$][0],U[$+1][0],U[$+2][0]];if(X.some(ae=>!Number.isInteger(ae)||ae<0||ae>=O.length))return!1;let Y=X.map(ae=>By(v,...O[ae])),Z=null;if(!F){let ae=Y[1][0]-Y[0][0],me=Y[1][1]-Y[0][1],le=Y[1][2]-Y[0][2],pe=Y[2][0]-Y[0][0],ee=Y[2][1]-Y[0][1],q=Y[2][2]-Y[0][2];Z=Yl([1,0,0,0,1,0,0,0,1],me*q-le*ee,le*pe-ae*q,ae*ee-me*pe)}for(let ae=0;ae<3;ae++){if(p.push(...Y[ae]),y.push(...F?Yl(k,...F[X[ae]]):Z),!H){x.push(-1,-1,-1);continue}let me=B?B[X[ae]]:null;for(let le=0;le<3;le++)x.push(ky((L?L[le]:1)*(me?me[le]*j:1)))}}}}for(let E of nt(C.children))if(!R(E,v))return!1;return b.delete(P),!0};for(let P of nt(u[m].nodes))if(!R(P,Oy()))return{ok:!1,issue:I>1e5?"triangle_limit":"unsupported_glb"};return!I||p.length!==I*9||y.length!==p.length?{ok:!1,issue:"unsupported_glb"}:{ok:!0,triangleCount:I,position:new Float32Array(p),normal:new Float32Array(y),color:g?new Float32Array(x):null}}function zl(e){try{return jy(e)}catch{return{ok:!1,issue:"invalid_glb"}}}function Zl(e){let{doc:t}=e,n=ia(t,e.eventConfigurationId??t.eventConfigurationId),o=As(t.theme,xa(n,e.seats)),r=o.structure,i=Ul(e.eventConfigurationId,e.eventConfiguration,n),s=e.seats,a=new fo,c=null;if(e.registeredShellGlb){let N=zl(e.registeredShellGlb);if(N.ok){let G=N.position.length/3,fe=new Float32Array(N.position.length),Te=o.materials.shell??r.tierWall,De=N.color;for(let Be=0;Be<G;Be++){let Ee=N.normal[Be*3+1],Se=Ee<-.25?.4:.62+.38*Math.max(0,Ee),gt=!!De&&De[Be*3]!==-1;fe[Be*3]=(gt?De[Be*3]:Te[0])*Se,fe[Be*3+1]=(gt?De[Be*3+1]:Te[1])*Se,fe[Be*3+2]=(gt?De[Be*3+2]:Te[2])*Se}c={position:N.position,normal:N.normal,color:fe,floor:new Float32Array(G).fill(vn),material:new Float32Array(G),count:G}}}let l=new Map;for(let N of n)for(let G of N.objects)l.set(G.id,N.index),G.type==="section"&&l.set(G.logicalSectionId??G.id,N.index);let f=s.map(N=>l.get(N.sectionId??"")??l.get(N.rowId??"")??0),u=xi(n,s),m=a.vertexCount,d=Hl(a,n,s,f,u,r)?a.vertexCount:m,p=Ls(t,s),y=new Map,x=new Map;for(let N of t.categories??[])y.set(N.key,N.color),N.seatGlyph&&x.set(N.key,N.seatGlyph);let g=[],S=dc(n,s,f),w=new Map;s.forEach((N,G)=>{let fe=S.seatDeckY(G);Number.isFinite(fe)&&w.set(N.rowId,Math.min(w.get(N.rowId)??1/0,fe))});let I=new Float32Array(s.length),b=[],R=[],P=new Map((t.floors??[]).map((N,G)=>[N.id,G])),M=n.map(()=>[]);for(let N of s){let G=N.floorId?P.get(N.floorId)??0:0;M[Math.min(G,M.length-1)]?.push(N)}let C=(N,G)=>{if(!G||G.length<3)return!1;let fe=Math.min(...G.map(Ee=>Ee.x)),Te=Math.max(...G.map(Ee=>Ee.x)),De=Math.min(...G.map(Ee=>Ee.y)),Be=Math.max(...G.map(Ee=>Ee.y));for(let Ee=0;Ee<N;Ee++)for(let Se of M[Ee])if(!(Se.x<fe||Se.x>Te||Se.y<De||Se.y>Be)&&Xe(Se,G,void 0))return!0;return!1},T=vo(n),v=null,k=-1/0;s.forEach((N,G)=>{let fe=S.seatDeckY(G);Number.isFinite(fe)&&fe>k&&(k=fe)});let E=!1,A=N=>n.length===1?s:s.filter((G,fe)=>f[fe]===N),O=(N,G)=>{let fe=yt(N);if(!fe)return!1;let Te=1/0,De=1/0,Be=-1/0,Ee=-1/0;for(let Se of fe)Te=Math.min(Te,Se.x),Be=Math.max(Be,Se.x),De=Math.min(De,Se.y),Ee=Math.max(Ee,Se.y);return s.some((Se,gt)=>Se.kind!=="booth"&&(n.length===1||f[gt]===G)&&Se.x>Te&&Se.x<Be&&Se.y>De&&Se.y<Ee&&Ve(fe,Se.x,Se.y))},F,L=[],B;for(let N=0;N<n.length;N++){let G=n[N];a.setFloor(N);let fe=Gt(G,A(N)),Te=0;if(fe){let J=0;for(let Ae of G.objects)if(Ae.type==="section")for(let K of S.bySection.get(Ae.id)?.rowLevels??[])J=Math.max(J,K.y-G.baseHeightM);Te=cc(J);for(let Ae of fe)L.push([Ae.x*_,Ae.y*_]);if(B=Math.max(B??-1/0,G.baseHeightM+Te),!F){let Ae=Sn(fe);F={centre:[Ae.x*_,Ae.y*_]}}}let De=new So,Be=[],Ee=G.objects.filter(J=>J.type==="shape"&&(J.role==="entrance"||J.role==="exit")),Se=G.objects.filter(J=>J.type==="section"&&!!J.outline&&J.outline.length>=3),gt=Vc(G.objects.filter(J=>J.type==="booth"),G.focal);for(let J of G.objects)if(J.type==="section"){let Ae=a.vertexCount;rl(a,J,G,Bs(J,p),S.bySection.get(J.id),De,Se,r,N>0&&C(N,J.outline));let K=a.vertexCount-Ae;K>0&&b.push({sectionId:J.id,start:Ae,count:K})}else if(J.type==="shape"){let Ae=i.byObjectId.get(J.id);if(T.has(J)&&!Ae)continue;let K=g.length,oe=fe!==null&&J.role==="wall"&&!Ae;a.setMaterial(oe?Bo:(Ae?.kind??J.role)==="screen"?1:0);let te=J.role==="stage"&&!Ae?Xc(J,A(N)):oe&&J.heightM===void 0?{...J,heightM:Te}:J,ge=ua(te,Be),Ie=n.length>1&&J.role==="stage";if(Ie&&a.setFloor(vn),kc(a,te,G.baseHeightM+ge.supportOffsetM,ge.topOffsetM-ge.supportOffsetM,r,G.focal,g,Ae,Ee),a.setMaterial(0),J.role==="stage"&&!Ae&&g.length>K&&(v??N)===N){v=N;let Ce=t.floors?.[N]?.id,ke=n.length>1&&Ce?s.filter(Ze=>Ze.floorId===Ce):s,$e=ga(a,te,g[g.length-1].y,ke,{deck:g[g.length-1].top,night:!Ft(r),theatre:{maxTopY:fe?G.baseHeightM+Te:Math.max((n[0]?.baseHeightM??0)+8,k+5)}});$e==="theatre"&&(E=!0),$e===null&&Wl(a,te,g[g.length-1].y,ke,{deck:g[g.length-1].top,night:!Ft(r)});let ze=ot(te.stageKind)?he(te):null;ze&&Ua(a,te,ze,g[g.length-1].y,ke,G.objects.some(Ze=>Ze.type==="shape"&&Ze.role==="goal"),G.objects.some(Ze=>Ze.type==="shape"&&Ze.role==="dugout")),ze&&ro(te.stageKind)&&Xa(a,ze,g[g.length-1].y,ke,jo),a.setMaterial(0)}Ie&&a.setFloor(N)}else if(J.type==="gaArea"){let Ae=a.vertexCount;Oc(a,J,G.baseHeightM,be(y.get(J.categoryKey)),r);let K=a.vertexCount-Ae;K>0&&R.push({sectionId:J.id,start:Ae,count:K})}else J.type==="booth"?Ec(a,J,G.baseHeightM,be(y.get(J.categoryKey)),r,gt.get(J.id)??G.focal,O(J,N)):J.type==="table"?Cc(a,J,Math.max(G.baseHeightM,w.get(J.id)??G.baseHeightM),be(J.fill??t.theme?.decorFill??"#232c40"),r,!!(J.fill??t.theme?.decorFill)):J.type==="decorImage"&&vc(a,J,G.baseHeightM,r);fe&&Pl(a,G.objects,fe,G.baseHeightM,Te,G.focal,r,J=>!i.byObjectId.has(J.id)),sl(a,G,s,S,r,o.materials.shell,!c)}let D=n.length>1?{x:n.reduce((N,G)=>N+G.focal.x,0)/n.length,y:n.reduce((N,G)=>N+G.focal.y,0)/n.length}:t.focalPoint??{x:(u.minX+u.maxX)/2,y:(u.minY+u.maxY)/2},j=ds(c?[a.build(),c]:[a.build()]),H=new Map;for(let N of n)for(let G of N.objects)G.type==="table"&&H.set(G.id,G.center);let V=Ws(s,e.initialState,S,I,y,x,new Set(H.keys())),U=kl({doc:t,units:n,seats:s,surfaces:S,focal:D}),{labels:$,sections:X,rows:Y}=vl({doc:t,units:n,seats:s,surfaces:S,seatData:V,hintedSeatFloor:f,zones:U,focal:D}),Z=new Map(X.map((N,G)=>[N.id,G]));S.seatOwner.forEach((N,G)=>{V.iSection[G]=N?Z.get(N)??-1:-1});let ae=Tl({doc:t,units:n,seats:s,surfaces:S,solids:j,hintedSeatFloor:f,seatFloor:I});Ol($,ae),V.iYaw=Xs(V.iPosition,s.length,N=>s[N].rowId,N=>{let G=n[I[N]]?.focal??D;return[G.x*_,G.y*_]},N=>{let G=H.get(s[N].rowId);return G?[G.x*_,G.y*_]:void 0});let me=!!t.focalPoint||n.some(N=>N.objects.some(G=>G.type==="shape"&&G.role==="stage")),le=n.flatMap((N,G)=>N.objects.flatMap(fe=>fe.type==="gaArea"&&fe.points?.length>=3?[{points:fe.points,holes:fe.holes,capacity:fe.capacity,floorY:N.baseHeightM+Zn,floorIndex:G,focal:me?N.focal:null}]:[])),pe=n.flatMap(N=>N.objects.flatMap(G=>G.type==="gaArea"&&G.points?.length>=3?[{id:G.id,points:G.points,...G.holes?.length?{holes:G.holes}:{},floorY:N.baseHeightM+Zn,floorIndex:N.index}]:[])),ee=le.length?Hc(le,s.flatMap((N,G)=>N.kind==="booth"||H.has(N.rowId)?[]:[{x:N.x,y:N.y,deckY:S.seatDeckY(G),floorIndex:n.length>1?f[G]:0}]),Math.min(e.crowdFigures??Number.POSITIVE_INFINITY,Nc(s.length,e.crowdSeatCeiling??Dc()))):null,q=(u.minX+u.maxX)/2*_,ie=(u.minY+u.maxY)/2*_,ne=.5*Math.hypot((u.maxX-u.minX)*_,(u.maxY-u.minY)*_)||10,ue=Mi(j,V,{cx:q,cz:ie,radius:ne},[m,d]),xe=Mi(j,V,{cx:q,cz:ie,radius:ne}),Re=Ky(n),_e=Vl(V,g,u,ue.minY,ue.maxY,ne,Re),We=!F&&n.some(N=>N.objects.some(G=>G.type==="shape"&&tn(G.stageKind))),Oe=!!o.house&&!We&&!c&&(!!F||o.house.indoor),at=g.flatMap(N=>[[N.cx-N.halfX,N.cz-N.halfZ],[N.cx+N.halfX,N.cz-N.halfZ],[N.cx+N.halfX,N.cz+N.halfZ],[N.cx-N.halfX,N.cz+N.halfZ]]),je=Oe?lc(V.iPosition,s.length,n[0]?.baseHeightM??0,[...at,...L],B):null;return{sharedAisles:ps(n.flatMap(N=>N.objects.flatMap(G=>{if(G.type!=="section")return[];let fe=S.bySection.get(G.id);return fe?[{sectionId:G.id,floorIndex:N.index,rows:fe.rowLevels}]:[]}))),solids:j,sectionSolidRanges:b,seats:V,...ee?{crowd:ee}:{},...pe.length?{areas:pe}:{},...R.length?{areaSolidRanges:R}:{},seatSectionIds:S.seatOwner,bounds:{center:[(_e.min[0]+_e.max[0])/2,(_e.min[1]+_e.max[1])/2,(_e.min[2]+_e.max[2])/2],radius:ne,groundY:0,box:_e,fitPoints:jl(V,g,Re)},...F?{room:F}:{},...We?{outdoor:!0}:{},...je?{house:E?{...je,theatre:!0}:je}:{},renderBounds:{center:ue.center,radius:ue.radius},clipBounds:{center:xe.center,radius:xe.radius},stateColorLUT:Cs(o,bo),theme:o,seatCount:s.length,focalWorld:[D.x*_,1.5,D.y*_],zones:U,stages:g,productionElements:i.elements,sections:X,rows:Y,labels:$,floors:ae}}function Ky(e){let t=[];for(let n of e)for(let o of n.objects){let r=o.type==="gaArea"?o.points:o.type==="booth"?yt(o):null;for(let i of r??[])t.push([i.x*_,n.baseHeightM,i.y*_])}return t}function Wy(e,t){let{doc:n,report:o}=yl(e),r=o.confident&&(o.sections.length>0||!!o.looseRowBlocks);if(!r&&!o.roles?.length)return null;if(!r){let c=new Map(o.roles.map(h=>[h.id,h.role])),l=h=>h.map(d=>d.type==="shape"&&c.has(d.id)?{...d,role:c.get(d.id)}:d),f=e.floors?.map(h=>({...h,objects:l(h.objects)})),u=new Float64Array(t.length).fill(Number.NaN),m=new Float64Array(t.length*2).fill(Number.NaN);return t.forEach((h,d)=>{h.eyeHeightM!==void 0&&(u[d]=h.eyeHeightM),h.focalPoint&&(m[d*2]=h.focalPoint.x,m[d*2+1]=h.focalPoint.y)}),{doc:{...e,objects:f?.[0]?.objects??l(e.objects),...f?{floors:f}:{}},report:o,eyeHeightM:u,focal:m}}let i=new Map(on(n).map(c=>[c.id,c])),s=new Float64Array(t.length).fill(Number.NaN),a=new Float64Array(t.length*2).fill(Number.NaN);return t.forEach((c,l)=>{let f=i.get(c.id)??c;f.eyeHeightM!==void 0&&(s[l]=f.eyeHeightM),f.focalPoint&&(a[l*2]=f.focalPoint.x,a[l*2+1]=f.focalPoint.y)}),{doc:n,report:o,eyeHeightM:s,focal:a}}function Yy(e,t){return e.map((n,o)=>{let r=t.eyeHeightM[o],i=t.focal[o*2],s=t.focal[o*2+1],a={...n};return Number.isNaN(r)?delete a.eyeHeightM:a.eyeHeightM=r,Number.isNaN(i)?delete a.focalPoint:a.focalPoint={x:i,y:s},a})}function $l(e){let t=e.estimate===!1?null:Wy(e.doc,e.seats);return t?{input:{...e,doc:t.doc,seats:Yy(e.seats,t)},estimate:t}:{input:e}}function zy(e){return[e.solids.position,e.solids.normal,e.solids.color,e.solids.floor,e.solids.material,e.seats.iPosition,e.seats.iState,e.seats.iCategory,e.seats.iMaxRadius,e.seats.iRing,e.seats.iFloor,e.seats.iYaw,e.seats.iChairWidth,e.seats.iGlyph,e.seats.iPhysicalSeat,e.seats.iArmrests,...e.crowd?[e.crowd.iPosition,e.crowd.iFacing,e.crowd.iHeight,e.crowd.iTone,e.crowd.iFloor]:[]].map(n=>n.buffer)}var Ql=self;Ql.onmessage=e=>{let t=performance.now(),n=!e.data.seats,o=e.data.seats??on(e.data.doc),{input:r,estimate:i}=$l({doc:e.data.doc,seats:o,eventConfigurationId:e.data.eventConfigurationId,eventConfiguration:e.data.eventConfiguration,registeredShellGlb:e.data.registeredShellGlb,estimate:e.data.estimate,crowdFigures:e.data.crowdFigures,crowdSeatCeiling:e.data.crowdSeatCeiling}),s=Zl(r),a=zy(s);i&&a.push(i.eyeHeightM.buffer,i.focal.buffer),Ql.postMessage({model:s,buildMs:performance.now()-t,...n?{seats:o}:{},...i?{estimate:i}:{}},a)};