@seatlayer/core 0.110.1 → 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 (121) 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/{chunk-5IADCFUU.js → chunk-5FIX35HN.js} +1 -1
  6. package/dist/{chunk-6CBJBESS.js → chunk-5GHPGPWE.js} +1 -1
  7. package/dist/{chunk-GWGWNBGU.js → chunk-AZWAP4OE.js} +1 -1
  8. package/dist/chunk-BXQQKDIX.js +1 -0
  9. package/dist/{chunk-NVAF2E7Q.js → chunk-FZ74MVKY.js} +1 -1
  10. package/dist/{chunk-GVVZR3YS.js → chunk-MN4M5QZ4.js} +1 -1
  11. package/dist/chunk-N6K5NQYG.js +1 -0
  12. package/dist/{chunk-2VYFNNYC.js → chunk-NQLQNJV2.js} +1 -1
  13. package/dist/{chunk-ZY6WTPTI.js → chunk-NXS6JFBI.js} +1 -1
  14. package/dist/{chunk-DLHW3UDD.js → chunk-XWTAFHYQ.js} +1 -1
  15. package/dist/{chunk-YRDOE3N7.js → chunk-Z6YGWTT3.js} +1 -1
  16. package/dist/core/chart-ops/index.cjs +1 -1
  17. package/dist/core/chart-ops/index.d.cts +1 -1
  18. package/dist/core/chart-ops/index.d.ts +1 -1
  19. package/dist/core/chart-ops/index.js +1 -1
  20. package/dist/core/inventory/index.cjs +1 -1
  21. package/dist/core/inventory/index.js +1 -1
  22. package/dist/core/layout/index.cjs +1 -1
  23. package/dist/core/layout/index.js +1 -1
  24. package/dist/core/sections/index.js +1 -1
  25. package/dist/cs-JRLKXXM5.js +1 -0
  26. package/dist/cy-W3CYXTOV.js +1 -0
  27. package/dist/da-HG4PFYWH.js +1 -0
  28. package/dist/de-KOM2AXXJ.js +1 -0
  29. package/dist/el-NBRQ66EQ.js +1 -0
  30. package/dist/es-AVEG4ZNM.js +1 -0
  31. package/dist/et-33PIOTI4.js +1 -0
  32. package/dist/fa-CDV2VTXV.js +1 -0
  33. package/dist/fi-TKATIOE6.js +1 -0
  34. package/dist/fr-TMDNSR5N.js +1 -0
  35. package/dist/he-4G7OVLJX.js +1 -0
  36. package/dist/hi-XKXNYPYF.js +1 -0
  37. package/dist/hr-BX444QNM.js +1 -0
  38. package/dist/hu-FM46JMDP.js +1 -0
  39. package/dist/id-CBVTYGFP.js +1 -0
  40. package/dist/index.cjs +1 -1
  41. package/dist/index.d.cts +33 -25
  42. package/dist/index.d.ts +33 -25
  43. package/dist/index.js +1 -1
  44. package/dist/it-ZOFOAG6E.js +1 -0
  45. package/dist/ja-NKEBMXTO.js +1 -0
  46. package/dist/ko-RUCELYV7.js +1 -0
  47. package/dist/ku-KKYBDVSA.js +1 -0
  48. package/dist/localeLoaders-YQXZZVNH.js +1 -0
  49. package/dist/lt-3CJ37W7A.js +1 -0
  50. package/dist/lv-H37RDMRX.js +1 -0
  51. package/dist/ms-E5RVBRE6.js +1 -0
  52. package/dist/nl-QHEOTQ7U.js +1 -0
  53. package/dist/no-43HJQ5MK.js +1 -0
  54. package/dist/pl-4LKJHMFJ.js +1 -0
  55. package/dist/pt-LSSE5QHE.js +1 -0
  56. package/dist/ro-U2QASPIY.js +1 -0
  57. package/dist/ru-PTMWREXY.js +1 -0
  58. package/dist/sk-AY2N2ORA.js +1 -0
  59. package/dist/sl-5MQJVNB7.js +1 -0
  60. package/dist/sr-25FTJPUA.js +1 -0
  61. package/dist/{stage-CKb7aNoH.d.cts → stage-BtqKu5aX.d.cts} +1 -1
  62. package/dist/{stage-CKb7aNoH.d.ts → stage-BtqKu5aX.d.ts} +1 -1
  63. package/dist/sv-7VQX4BFH.js +1 -0
  64. package/dist/th-E53HQMDC.js +1 -0
  65. package/dist/tr-IIR6E7OD.js +1 -0
  66. package/dist/uk-HBINQ4XE.js +1 -0
  67. package/dist/vi-TX6I5RWN.js +1 -0
  68. package/dist/view3d/index.cjs +195 -77
  69. package/dist/view3d/index.d.cts +259 -78
  70. package/dist/view3d/index.d.ts +259 -78
  71. package/dist/view3d/index.js +193 -75
  72. package/dist/view3d/scene/scene.worker.cjs +1 -1
  73. package/dist/view3d/scene/scene.worker.js +1 -1
  74. package/dist/zh-Hans-7QNBTEYC.js +1 -0
  75. package/dist/zh-Hant-6KK3D42X.js +1 -0
  76. package/package.json +1 -1
  77. package/dist/ar-C5PA2DVE.js +0 -1
  78. package/dist/be-TMKSMYPN.js +0 -1
  79. package/dist/bg-V6HTEDUB.js +0 -1
  80. package/dist/ca-CTZMHWW4.js +0 -1
  81. package/dist/chunk-3V32MDJI.js +0 -1
  82. package/dist/chunk-4AGC7B64.js +0 -1
  83. package/dist/cs-FUDGOUFL.js +0 -1
  84. package/dist/cy-5RRARIAP.js +0 -1
  85. package/dist/da-PONPPWKY.js +0 -1
  86. package/dist/de-PKG7AAB5.js +0 -1
  87. package/dist/el-H7OFU4QQ.js +0 -1
  88. package/dist/es-QSW5IZ6U.js +0 -1
  89. package/dist/et-GTMPSS72.js +0 -1
  90. package/dist/fa-SGLTFGJF.js +0 -1
  91. package/dist/fi-7YTEAVDM.js +0 -1
  92. package/dist/fr-ECCQ24MZ.js +0 -1
  93. package/dist/he-YHMMDOX7.js +0 -1
  94. package/dist/hi-GRAQX2E6.js +0 -1
  95. package/dist/hr-MN33LRIJ.js +0 -1
  96. package/dist/hu-NW3SMQVM.js +0 -1
  97. package/dist/id-3OPRAUF7.js +0 -1
  98. package/dist/it-RYM74YWO.js +0 -1
  99. package/dist/ja-4NI6DG5D.js +0 -1
  100. package/dist/ko-C4F6UEMK.js +0 -1
  101. package/dist/ku-DMSBMWTC.js +0 -1
  102. package/dist/localeLoaders-G3GCGLPW.js +0 -1
  103. package/dist/lt-3EXKKZFG.js +0 -1
  104. package/dist/lv-4EWNRDCG.js +0 -1
  105. package/dist/ms-7LJBSAEJ.js +0 -1
  106. package/dist/nl-GWTIWXRW.js +0 -1
  107. package/dist/no-T3FW2WLX.js +0 -1
  108. package/dist/pl-OG5OBRHR.js +0 -1
  109. package/dist/pt-YQ6VES5R.js +0 -1
  110. package/dist/ro-VK5MASYF.js +0 -1
  111. package/dist/ru-YU5CYR6T.js +0 -1
  112. package/dist/sk-CE7PXAYL.js +0 -1
  113. package/dist/sl-EYUPV4BG.js +0 -1
  114. package/dist/sr-PPXCN4IK.js +0 -1
  115. package/dist/sv-WR2BJBCJ.js +0 -1
  116. package/dist/th-JUB2DODR.js +0 -1
  117. package/dist/tr-GFHA7FT6.js +0 -1
  118. package/dist/uk-3FTS2SRK.js +0 -1
  119. package/dist/vi-7OTXPOQV.js +0 -1
  120. package/dist/zh-Hans-FD4XNYUA.js +0 -1
  121. package/dist/zh-Hant-7TXVJKJQ.js +0 -1
@@ -1 +1 @@
1
- "use strict";var zc=Object.create;var Ur=Object.defineProperty;var Zc=Object.getOwnPropertyDescriptor;var $c=Object.getOwnPropertyNames;var Qc=Object.getPrototypeOf,qc=Object.prototype.hasOwnProperty;var Jc=(e,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of $c(t))!qc.call(e,r)&&r!==n&&Ur(e,r,{get:()=>t[r],enumerable:!(o=Zc(t,r))||o.enumerable});return e};var et=(e,t,n)=>(n=e!=null?zc(Qc(e)):{},Jc(t||!e||!e.__esModule?Ur(n,"default",{value:e,enumerable:!0}):n,e));var yb=Math.PI/180;function we(e,t){return Math.hypot(e.x-t.x,e.y-t.y)}function xo(e,t,n){return{x:e.x+(t.x-e.x)*n,y:e.y+(t.y-e.y)*n}}function Mo(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 kt(e){return e.length?Mo(e):null}function Xr(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 Kr(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[Xr(e,.5)];let o=Array.from({length:n+1},(c,l)=>Xr(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,u=o[c].y-o[c-1].y;r[c]=r[c-1]+Math.hypot(l,u)}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 u=r[a-1],f=r[a],m=f===u?0:(l-u)/(f-u);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 So(e,t,n){return Math.max(t,Math.min(n,e))}function el(e){return So(e,0,1)}function Wr(e){let t=el(e);return t*t*(3-2*t)}var Ot=Math.PI*2;function Lt(e){return Number.isFinite(e.x)&&Number.isFinite(e.y)}function tl(e,t,n){let o=t-e;if(n){for(;o<0;)o+=Ot;for(;o>=Ot;)o-=Ot}else{for(;o>0;)o-=Ot;for(;o<=-Ot;)o+=Ot}return o}function Zr(e){if(e.version!==1||e.closed!==!0||!Lt(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||!Lt(n.end))return!1;if(n.kind==="line"){if(we(t,n.end)<=1e-9)return!1}else if(n.kind==="bezier"){if(!Lt(n.control1)||!Lt(n.control2)||we(t,n.end)<=1e-9)return!1}else if(n.kind==="arc"){if(!Lt(n.center)||!Number.isFinite(n.radius)||n.radius<=1e-6||Math.abs(we(t,n.center)-n.radius)>Math.max(1e-4,n.radius*1e-4)||Math.abs(we(n.end,n.center)-n.radius)>Math.max(1e-4,n.radius*1e-4)||we(t,n.end)<=1e-9)return!1}else return!1;t=n.end}return we(t,e.start)<=1e-4}function nl(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 $r(e,t=2){if(!Zr(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=tl(s,a,i.clockwise),l=Math.max(2,Math.ceil(Math.abs(c)*i.radius/n));for(let u=1;u<=l;u+=1){let f=s+c*u/l;o.push({x:i.center.x+Math.cos(f)*i.radius,y:i.center.y+Math.sin(f)*i.radius})}}else{let s=we(r,i.control1)+we(i.control1,i.control2)+we(i.control2,i.end),a=Math.max(2,Math.ceil(s/n));for(let c=1;c<=a;c+=1)o.push(nl(r,i,c/a))}r=i.end}return we(o[o.length-1],o[0])<=1e-4&&o.pop(),o}var ol=45,Ro=150,rl=60;function il(e){let t=ol/100;if(e<=t)return Ro;let n=Math.min(1,(e-t)/(1-t));return Ro-n*(Ro-rl)}var Yr=.5523;function zr(e,t){return Math.abs(e.x-t.x)<=1e-6&&Math.abs(e.y-t.y)<=1e-6}function sl(e){let t=[],n=[];for(e.forEach((o,r)=>{Lt(o)&&(t.length&&zr(t[t.length-1],o)||(t.push({x:o.x,y:o.y}),n.push(r)))});t.length>1&&zr(t[0],t[t.length-1]);)t.pop(),n.pop();return{points:t,sourceIndex:n}}var al=.5,cl=4/3;function ll(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*cl;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 Qr(e,t){let{points:n,sourceIndex:o}=sl(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 _=0;_<r;_+=1){let I=s[o[_]];a[_]=Number.isFinite(I)?Math.min(100,Math.max(-100,I))/100:0}let c=a.some(_=>Math.abs(_)>1e-6);if(i<=0&&!c)return null;let l=t.wideAngleThresholdDeg??il(i),u=[];for(let _=0;_<r;_+=1)u[_]=we(n[_],n[(_+1)%r]);let f=new Array(r).fill(0);for(let _=0;_<r;_+=1){let I=n[(_-1+r)%r],y=n[_],x=n[(_+1)%r],P={x:I.x-y.x,y:I.y-y.y},R={x:x.x-y.x,y:x.y-y.y},v=Math.hypot(P.x,P.y),T=Math.hypot(R.x,R.y);if(v<=1e-9||T<=1e-9)continue;let k=Math.min(1,Math.max(-1,(P.x*R.x+P.y*R.y)/(v*T))),C=Math.acos(k)*180/Math.PI;if(C<l)continue;let E=Wr((C-l)/(180-l));f[_]=i*E*.5*Math.min(v,T)}for(let _=0;_<r;_+=1){let I=(_+1)%r,y=f[_]+f[I];if(y>u[_]&&y>1e-9){let x=u[_]/y;f[_]*=x,f[I]*=x}}let m=new Array(r),h=new Array(r);for(let _=0;_<r;_+=1){let I=n[(_-1+r)%r],y=n[_],x=n[(_+1)%r];if(f[_]<=1e-6){m[_]={...y},h[_]={...y};continue}let P=we(y,I)||1,R=we(y,x)||1;m[_]={x:y.x+(I.x-y.x)/P*f[_],y:y.y+(I.y-y.y)/P*f[_]},h[_]={x:y.x+(x.x-y.x)/R*f[_],y:y.y+(x.y-y.y)/R*f[_]}}if(f.every(_=>_<=1e-6)&&!c)return null;let d=[],p={...h[0]},b=p,M=(_,I)=>{if(we(b,_)<=1e-9)return;let y=a[I];Math.abs(y)>1e-6?d.push(ll(b,_,y*al*u[I])):d.push({kind:"line",end:{..._}}),b=_};for(let _=1;_<=r;_+=1){let I=_%r,y=n[I];M(m[I],(_-1)%r),f[I]>1e-6&&we(m[I],h[I])>1e-9&&(d.push({kind:"bezier",control1:xo(m[I],y,Yr),control2:xo(h[I],y,Yr),end:{...h[I]}}),b=h[I])}if(!d.length)return null;let g=d[d.length-1];we(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 Zr(S)?S:null}function ul(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 fl(e){let t=ul(e);return t.length?Qr(e.points,{edgeCurvature:t}):null}function An(e,t=2){let n=fl(e);return n?$r(n,t):e.points??[]}function qr(e){return e.kind==="polygon"?Jt(e.holes):[]}function ei(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),u=0,f=0;for(let m of i)m.segmentedRow.boundaryBefore==="break"&&(u+=1),t.set(m.id,{groupId:o,adjacencyOffset:u,displayOffset:f,displayLabel:a.displayLabel,totalSeats:l,canonical:i[0],viewFromSeatUrl:a.viewFromSeatUrl,viewFromSeatMeta:a.viewFromSeatMeta,confidenceEvidence:a.confidenceEvidence}),u+=m.seatCount,f+=m.seatCount}return t}var ml="ABCDEFGHIJKLMNOPQRSTUVWXYZ";var hl="abcdefghijklmnopqrstuvwxyz";function dl(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 en(e,t=!1){let n=t?hl:ml;return dl(Math.max(0,Math.floor(e)-1),n)}var pl=[[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 ti(e){if(!Number.isFinite(e)||e<=0)return String(e);let t=Math.floor(e),n="";for(let[o,r]of pl)for(;t>=o;)n+=r,t-=o;return n}function bl(e){let t=new Array(e);return Array.from({length:e},(n,o)=>o).sort((n,o)=>Math.abs(2*n-(e-1))-Math.abs(2*o-(e-1))||n-o).forEach((n,o)=>t[n]=o),t}function Po(e,t){let n=e.seatLabelStart??1,o=e.seatNumbering?.direction??"ltr",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,u=a!=null&&Number.isFinite(a)?a-(c-1)*l:n,f=o==="center"?bl(c)[t]:o==="rtl"?c-1-t:t,m;switch(i){case"odd":{let h=u%2===1?u:u+1;m=String(h+f*2);break}case"even":{let h=u%2===0?u:u+1;m=String(h+f*2);break}case"roman":m=ti(u+f*r);break;case"letters-upper":m=en(u+f*r,!1);break;case"letters-lower":m=en(u+f*r,!0);break;default:m=String(u+f*r);break}return`${s}${m}`}function yl(e){return{...e.canonical,seatCount:e.totalSeats,label:e.displayLabel,displayLabel:e.displayLabel}}function ni(e,t,n){return n?.label??`${e.seatLabelBase??e.label}-${Po(e,t)}`}function gl(e,t,n,o){if(o?.displayLabel)return null;if(e.seatDisplayLabelMode==="number"||!n)return{row:e.displayLabel||e.label,seat:Po(e,t)};let r=yl(n);return{row:n.displayLabel,seat:Po(r,n.displayOffset+t)}}function _o(e,t,n,o){let r=gl(e,t,n,o);return r?e.seatDisplayLabelMode==="number"?r.seat:`${r.row}-${r.seat}`:o.displayLabel}function oi(e,t){return`${e.label}-${t+1}`}function xl(e,t,n){return e?.direction==="anticlockwise"?Math.max(0,t-1-n):n}function Ml(e,t){let n=e.chairNumbering,o=n?.start??1,r=xl(n,Math.max(0,Math.round(e.seatCount)),t);return n?.format==="letter"?en(Math.max(1,o)+r):String(o+r)}function ri(e,t){let n=Ml(e,t);return(e.chairNumbering?.format??"table-number")==="table-number"?`${e.displayLabel??e.label}-${n}`:n}var ee=.02291666666666667,Ke=1/ee,Sl=58,Rl=Sl*ee;var Il=3,ii=0,wo=120,Pl=0,_l=45,wl=7,tt=1.2;function Eo(e,t,n,o){return Number.isFinite(e)?Math.max(t,Math.min(n,e)):o}function El(e){return!Number.isFinite(e)||!Number.isInteger(e)||e<0?0:e<=wl?e:Il}function mt(e,t={}){let n=Eo(t.floorBaseHeightM,ii,wo,0),o=Math.min(wo,n+El(e.elevation)*Rl),r=e.height===void 0?o:Eo(e.height,ii,wo,o),i=Eo(e.rake,Pl,_l,0);return{height:r,rake:i}}function si(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 Tt(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,u=l>1e-12?((t-i.x)*a+(n-i.y)*c)/l:0;u<0?u=0:u>1&&(u=1);let f=t-(i.x+u*a),m=n-(i.y+u*c);if(Math.abs(f)>=o||Math.abs(m)>=o)continue;let h=Math.hypot(f,m);h<o&&(o=h)}return o}function Al(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 ai(e,t){return Math.hypot(e.cx-t.cx,e.cy-t.cy)-e.r-t.r}function Ao(e,t){let n=1/0;for(let o of si(e)){let r=Tt(t,o.x,o.y);r<n&&(n=r)}for(let o of si(t)){let r=Tt(e,o.x,o.y);r<n&&(n=r)}return n}function Cl(e,t){if(e.length<3)return{pts:e,seatIndices:t};let n=0,o=0;for(let u of e)n+=u.x,o+=u.y;n/=e.length,o/=e.length;let r=-1,i=e[0];for(let u of e){let f=Math.hypot(u.x-n,u.y-o);f>r&&(r=f,i=u)}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((u,f)=>({p:u,i:f,t:(u.x-n)*s+(u.y-o)*a})).sort((u,f)=>u.t-f.t);return{pts:l.map(u=>u.p),seatIndices:l.map(u=>t[u.i])}}function Co(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,u=0;for(let g of e){let S=g.x-n,_=g.y-o;r+=S*S,s+=_*_,i+=S*_,a+=S*S*S,c+=_*_*_,l+=S*_*_,u+=_*S*S}let f=r*s-i*i;if(Math.abs(f)<1e-9)return null;let m=(a+l)/2,h=(c+u)/2,d=(m*s-h*i)/f,p=(h*r-m*i)/f,b=d+n,M=p+o;return!Number.isFinite(b)||!Number.isFinite(M)?null:{cx:b,cy:M}}var vl=.15,kl=.001;function Ol(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 Ll(e){if(e.length<2)return null;let t=e.map(I=>{let y=0,x=0;for(let P of I.pts)y+=P.x,x+=P.y;return{x:y/I.pts.length,y:x/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 y=I.x-n,x=I.y-o;r+=y*y,i+=y*x,s+=x*x}let a=r+s,c=r*s-i*i,l=a/2+Math.sqrt(Math.max(0,a*a/4-c)),u,f;Math.abs(i)>1e-12?(u=l-s,f=i):r>=s?(u=1,f=0):(u=0,f=1);let m=Math.hypot(u,f);if(!(m>1e-12))return null;u/=m,f/=m;let h=0,d=0,p=0;for(let I of e){if(I.pts.length<2)continue;let y=I.pts[0],x=I.pts[I.pts.length-1],P=x.x-y.x,R=x.y-y.y,v=Math.hypot(P,R);if(!(v>1e-9))continue;let T=P/v,k=R/v;h+=(T*T-k*k)*v,d+=2*T*k*v,p+=v}if(p>0&&Math.hypot(h,d)>=Bl*p){let I=Math.atan2(d,h)/2;u=-Math.sin(I),f=Math.cos(I)}let b=1/0,M=-1/0,g=[];for(let I of e){let y=1/0,x=-1/0;for(let P of I.pts){let R=P.x*u+P.y*f;R<y&&(y=R),R>x&&(x=R),R<b&&(b=R),R>M&&(M=R)}g.push(x-y)}let S=M-b;return S>1e-9?(g.sort((I,y)=>I-y),g[Math.min(g.length-1,Math.floor(g.length*.9))]/S<=Tl?{x:u,y:f}:null):null}var Tl=.35,Bl=.8;function Cn(e,t,n,o){let r=new Map;for(let y of n){let x=t[y],P=x.rowId||`__seat-${y}`,R=r.get(P);R||(R={pts:[],idx:[]},r.set(P,R)),R.pts.push({x:x.x,y:x.y}),R.idx.push(y)}if(!r.size)return{sectionId:e,rows:[],blockCount:0};let i=[];for(let[y,x]of r){let P=Cl(x.pts,x.idx),R=0;for(let v of P.pts)R+=Math.hypot(v.x-o.x,v.y-o.y);i.push({id:y,pts:P.pts,seatIndices:P.seatIndices,blockId:-1,ordinal:0,blockDepth:0,focalDistance:R/P.pts.length})}let s=i.map(y=>Al(y.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((y,x)=>[y,x])):null,u=(y,x)=>(y>x&&([y,x]=[x,y]),y*(2*i.length-y-1)/2+(x-y-1)),f=(y,x)=>{if(!c)return Ao(i[y].pts,i[x].pts);let P=u(y,x),R=c[P];if(!Number.isNaN(R))return R;let v=Ao(i[y].pts,i[x].pts);return c[P]=v,v},m=(y,x)=>l?f(l.get(y),l.get(x)):Ao(y.pts,x.pts),h=[];for(let y=0;y<i.length;y++){let x=1/0;for(let P=0;P<i.length;P++){if(y===P||ai(s[y],s[P])>=x)continue;let R=f(y,P);R<x&&(x=R)}Number.isFinite(x)&&h.push(x)}h.sort((y,x)=>y-x);let d=h.length?h[Math.floor(h.length/2)]:1,p=Math.max(d*1.8,1e-6),b=i.map(()=>[]);for(let y=0;y<i.length;y++)for(let x=y+1;x<i.length;x++)ai(s[y],s[x])>p||f(y,x)<=p&&(b[y].push(x),b[x].push(y));let M=0;for(let y=0;y<i.length;y++){if(i[y].blockId!==-1)continue;let x=M++,P=[y];for(i[y].blockId=x;P.length;){let R=P.pop();for(let v of b[R])i[v].blockId===-1&&(i[v].blockId=x,P.push(v))}}let g=new Map;for(let y of i){let x=g.get(y.blockId)??[];x.push(y),g.set(y.blockId,x)}let S=[];for(let y of i){if(y.pts.length<4||Ol(y.pts)<kl)continue;let x=Co(y.pts);x&&(!Number.isFinite(x.cx)||!Number.isFinite(x.cy)||S.push({x:x.cx,y:x.cy}))}let _=S.length>=2?(()=>{let y=S.map(R=>R.x).sort((R,v)=>R-v),x=S.map(R=>R.y).sort((R,v)=>R-v),P=Math.floor(S.length/2);return{cx:y[P],cy:x[P]}})():null;if(_){let y=k=>Math.hypot(k.x-_.cx,k.y-_.cy),x=1/0,P=-1/0,R=[];for(let k of i){let C=1/0,E=-1/0;for(let A of k.pts){let O=y(A);O<C&&(C=O),O>E&&(E=O)}R.push(E-C),C<x&&(x=C),E>P&&(P=E)}let v=P-x;R.sort((k,C)=>k-C);let T=R[Math.min(R.length-1,Math.floor(R.length*.9))];if(v>1e-9&&T/v<=vl){let k=i.map(G=>{let V=0;for(let U of G.pts)V+=y(U);return{row:G,radius:V/G.pts.length}}),C=0,E=0;for(let G of k)C+=G.radius,E+=G.row.focalDistance;C/=k.length,E/=k.length;let A=0;for(let G of k)A+=(G.radius-C)*(G.row.focalDistance-E);if(A<0)for(let G of k)G.radius=-G.radius;let F=1/0;for(let G of k)G.radius<F&&(F=G.radius);k.sort((G,V)=>G.radius-V.radius);let L=-1,B=-1/0,D=v/Math.max(1,k.length)*.5,j=[];for(let G of k)G.radius-B>D&&(L++,B=G.radius),G.row.ordinal=L,G.row.blockDepth=G.radius-F,j.push(G.row);return{sectionId:e,rows:j,blockCount:M}}}let I=[];for(let[,y]of g){let x=Ll(y);if(x){let P=k=>{let C=0;for(let E of k.pts)C+=E.x*x.x+E.y*x.y;return C/k.pts.length};y.sort((k,C)=>P(k)-P(C)),y.length>=2&&y[0].focalDistance>y[y.length-1].focalDistance&&y.reverse();let R=[],v=d*.5;for(let k of y){let C=R[R.length-1];C&&Math.abs(P(k)-P(C[0]))<v?C.push(k):R.push([k])}let T=0;for(let k=0;k<R.length;k++){if(k>0){let C=1/0;for(let E of R[k-1])for(let A of R[k])C=Math.min(C,m(E,A));C=Math.min(C,Math.abs(P(R[k][0])-P(R[k-1][0]))),T+=C}for(let C of R[k])C.ordinal=k,C.blockDepth=T,I.push(C)}}else{let P=1/0;for(let R of y)R.focalDistance<P&&(P=R.focalDistance);y.sort((R,v)=>R.focalDistance-v.focalDistance);for(let R=0;R<y.length;R++)y[R].ordinal=R,y[R].blockDepth=Math.max(0,y[R].focalDistance-P),I.push(y[R])}}return{sectionId:e,rows:I,blockCount:M}}var Nl=/^\d{4}-\d{2}-\d{2}$/;function Fl(e){let t=Date.parse(e);return Number.isFinite(t)?Nl.test(e)?t+864e5:t:null}function Dl(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=Fl(e.validUntil);return n===null?!1:(t instanceof Date?t.getTime():t)<n}function Gl(e,t,n){return!(e.eventConfigurationId&&e.eventConfigurationId!==t||e.eventConfigurationVersion!==void 0&&e.eventConfigurationVersion!==n)}function Hl(e){return e.status!=="draft"&&e.status!=="retracted"}function jl(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 ci(e,t={}){return!!e&&Hl(e)&&Gl(e,t.activeConfigurationId,t.activeConfigurationVersion)&&jl(e,t.activeBasisSha256)&&Dl(e,t.now)}var Vl=new Set(["pitch-football","rink-hockey","track-athletics","oval-cricket","pitch-rugby","diamond-baseball","court-basketball","court-tennis","ring-boxing"]),Ul=new Set(["pitch-football","track-athletics","oval-cricket","pitch-rugby","diamond-baseball"]);function Ze(e){return!!e&&Vl.has(e)}function St(e){return!!e&&Ul.has(e)}var Xl=new Set(["court-basketball","rink-hockey","ring-boxing"]);function fi(e){return!!e&&Xl.has(e)}var vo=1.1;function mi(e){return kn(e)?e==="ring-boxing"?vo:.06:1}var Kl={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}},Wl={"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 Yl=Math.PI*2;function zl(e,t,n,o,r,i){return{x:r+e*n-t*o,y:i+e*o+t*n}}function li(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 ui=(()=>{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 u=a+(c-a)*l/24;s.push({x:i*Math.cos(u),y:r+i*Math.sin(u)})}return{half:70,home:t,backstop:n,fence:s}})();var vn="#f1f5f9";function kn(e){return Ze(e)}function ht(e,t,n,o,r=32){let i=[];for(let s=0;s<r;s++){let a=s/r*Yl;i.push({x:e+n*Math.cos(a),y:t+o*Math.sin(a)})}return i}function ct(e,t,n,o){return[{x:e-n,y:t-o},{x:e+n,y:t-o},{x:e+n,y:t+o},{x:e-n,y:t+o}]}function Zl(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,u=i/2,f=[],m=Kl[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:-u},{x:0,y:u}],closed:!1}),f.push({points:ht(0,0,h(9.15),d(9.15)),closed:!0});for(let p of[-1,1])f.push({points:ct(p*(l-h(16.5)/2),0,h(16.5)/2,d(40.32)/2),closed:!0}),f.push({points:ct(p*(l-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:-u},{x:0,y:u}],closed:!1,ink:"#d63b3b"});for(let p of[-1,1]){f.push({points:[{x:p*h(7.5),y:-u},{x:p*h(7.5),y:u}],closed:!1,ink:"#2f6ecb"}),f.push({points:[{x:p*(l-h(4)),y:-d(11)},{x:p*(l-h(4)),y:d(11)}],closed:!1,ink:"#d63b3b"});for(let b of[-1,1])f.push({points:ht(p*h(20.5),b*d(7),h(4.5),d(4.5)),closed:!0,ink:"#2f6ecb"})}f.push({points:ht(0,0,h(4.5),d(4.5)),closed:!0,ink:"#2f6ecb"});break}case"track-athletics":{let b=u-d(1.22)*8;b>0&&f.push({points:li(l-h(1.22)*8,b),closed:!0,fill:"#2f7d4f"});for(let M=1;M<8;M++){let g=d(1.22)*M,S=u-g;if(S<=0)break;f.push({points:li(l-h(1.22)*M,S),closed:!0})}break}case"oval-cricket":{f.push({points:ht(0,0,h(27.4),d(27.4+20.12/2),40),closed:!0}),f.push({points:ct(0,0,h(3.05)/2,d(20.12)/2),closed:!0,ink:"#d8cfae"});break}case"pitch-rugby":{let p=b=>({points:[{x:h(b),y:-u},{x:h(b),y:u}],closed:!1});f.push(p(0));for(let b of[-1,1]){f.push(p(b*50),p(b*28));for(let M=-35;M<35;M+=4)f.push({points:[{x:h(b*10),y:d(M)},{x:h(b*10),y:d(Math.min(35,M+2))}],closed:!1})}break}case"diamond-baseball":{let p=(O,F)=>({x:h(O),y:d(F)}),{home:b}=ui,M=27.43,g=M/Math.SQRT2,S={x:b.x+g,y:b.y-g},_={x:b.x,y:b.y-2*g},I={x:b.x-g,y:b.y-g},y={x:b.x,y:b.y-18.44},x="#b98a59",P=Wl["diamond-baseball"],R=38.94,v=[p(b.x,b.y)],T=Math.atan2(b.y-R/Math.SQRT2-y.y,R/Math.SQRT2),k=Math.PI-T;for(let O=0;O<=16;O++){let F=T-(T+Math.PI*2-k)%(Math.PI*2)*(O/16);v.push(p(y.x+29*Math.cos(F),y.y+29*Math.sin(F)))}f.push({points:v,closed:!0,fill:x,ink:x});let C={x:b.x,y:b.y-g},E=[{x:b.x,y:b.y},S,_,I].map(O=>p(C.x+(O.x-C.x)*.84,C.y+(O.y-C.y)*.84));f.push({points:E,closed:!0,fill:P,ink:P}),f.push({points:ht(h(y.x),d(y.y),h(2.74),d(2.74),20),closed:!0,fill:x,ink:x}),f.push({points:ht(h(b.x),d(b.y),h(3.96),d(3.96),20),closed:!0,fill:x,ink:x});let A=ui.fence;f.push({points:[p(b.x,b.y),p(A[0].x,A[0].y)],closed:!1}),f.push({points:[p(b.x,b.y),p(A[A.length-1].x,A[A.length-1].y)],closed:!1});for(let O of[S,_,I])f.push({points:ct(h(O.x),d(O.y),h(.3),d(.3)),closed:!0,fill:vn});break}case"court-basketball":{f.push({points:ct(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:ht(0,0,h(1.8),d(1.8),24),closed:!0});for(let p of[-1,1]){let b=p*14,M=p*(14-5.8),g=p*(14-1.575);f.push({points:ct(h((b+M)/2),0,h(2.9),d(2.45)),closed:!0,fill:"#2f5d8a"}),f.push({points:ht(h(M),0,h(1.8),d(1.8),24),closed:!0});let S=Math.sqrt(6.75*6.75-6.6*6.6),_=[{x:h(b),y:-d(6.6)}],I=Math.atan2(-6.6,-p*S),y=2*Math.atan2(6.6,S);for(let x=0;x<=16;x++){let P=I-p*y*(x/16);_.push({x:h(g+6.75*Math.cos(P)),y:d(6.75*Math.sin(P))})}_.push({x:h(b),y:d(6.6)}),f.push({points:_,closed:!1})}break}case"court-tennis":{f.push({points:ct(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:ct(0,0,h(3.05),d(3.05)),closed:!0});let M=[[-1,-1,"#c53030"],[1,1,"#2b6cb0"],[1,-1,"#e2e8f0"],[-1,1,"#e2e8f0"]];for(let[g,S,_]of M)f.push({points:ct(g*h(3.05),S*d(3.05),h(.3),d(.3)),closed:!0,fill:_,ink:_});break}default:return[]}return f.map(p=>({...p,points:p.points.map(b=>zl(b.x,b.y,a,c,n,o))}))}function ko(e){if(e.role!=="stage"||!kn(e.stageKind))return[];let t=null;if(e.x!=null&&e.y!=null&&e.width!=null&&e.height!=null&&e.width>0&&e.height>0&&[e.x,e.y,e.width,e.height].every(Number.isFinite))t={cx:e.x+e.width/2,cy:e.y+e.height/2,width:e.width,height:e.height};else if(e.points&&e.points.length>=3&&e.points.every(n=>Number.isFinite(n.x)&&Number.isFinite(n.y))){let n=e.points.map(u=>u.x),o=e.points.map(u=>u.y),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?Zl({kind:e.stageKind,...t}):[]}var $l=/^data:image\/(?:png|jpe?g|webp|gif|avif);base64,[a-z0-9+/]+={0,2}$/i,Ql=/[\s"'<>`\\]/;function ql(e){if(typeof e!="string"||!e||e.length>2e6||e!==e.trim())return!1;if(e.startsWith("data:"))return $l.test(e);if(Ql.test(e))return!1;try{let t=new URL(e);return t.protocol==="https:"&&!t.username&&!t.password}catch{return!1}}function hi(e){let t=e.trim();return ql(t)?t:null}var Oo="seatlayer.event-configuration/1";var Bt=100,Jl=120,eu=2e5,tu=1e4,nu=/^[a-f0-9]{64}$/,ou=new Set(["stage","screen","barrier","camera_platform","sound_desk","rigging_truss"]);function tn(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function Rt(e,t){return typeof e=="string"&&e.length>=1&&e.length<=t&&e.normalize("NFKC").trim()===e}function ru(e){return typeof e=="number"&&Number.isInteger(e)&&e>0}function di(e){return!Array.isArray(e)||e.length>eu||!e.every(t=>Rt(t,Bt))?null:[...new Set(e)].sort()}function iu(e){return!tn(e)||!Rt(e.chartId,Bt)||!Rt(e.version,Bt)||e.sha256!==void 0&&(typeof e.sha256!="string"||!nu.test(e.sha256))?null:{chartId:e.chartId,version:e.version,...typeof e.sha256=="string"?{sha256:e.sha256}:{}}}function Lo(e,t,n){return typeof e=="number"&&Number.isFinite(e)&&e>=t&&e<=n}function su(e){return tn(e)?e.mode==="none"||e.mode==="opaque"?e.opacity===void 0?{mode:e.mode}:null:e.mode==="partial"&&Lo(e.opacity,.01,.99)?{mode:"partial",opacity:e.opacity}:null:null}function au(e,t){if(e===void 0)return;if(!Array.isArray(e)||e.length>tu)return null;let n=new Set(t),o=new Set,r=new Set,i=0,s=[];for(let a of e){if(!tn(a)||!Rt(a.id,Bt)||!Rt(a.objectId,Bt)||!n.has(a.objectId)||!ou.has(String(a.kind))||!Lo(a.heightM,.05,50)||a.baseElevationM!==void 0&&!Lo(a.baseElevationM,-10,100))return null;let c=su(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"?hi(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 cu(e){let t=[];if(!tn(e))return{issues:[{code:"invalid_export",path:"configuration",message:"Configuration must be an object"}]};e.schema!==Oo&&t.push({code:"unsupported_schema",path:"configuration.schema",message:`Configuration schema must be ${Oo}`}),Rt(e.id,Bt)||t.push({code:"invalid_id",path:"configuration.id",message:"Configuration id must contain 1 to 100 normalized characters"}),Rt(e.label,Jl)||t.push({code:"invalid_label",path:"configuration.label",message:"Configuration label must contain 1 to 120 normalized characters"}),ru(e.version)||t.push({code:"invalid_version",path:"configuration.version",message:"Configuration version must be a positive integer"});let n=iu(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=tn(e.overlay)?e.overlay:null,r=di(o?.objectIds),i=di(o?.productionKillSeatIds),s=r?au(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:Oo,id:e.id,label:e.label,version:e.version,baseVenue:n,overlay:{objectIds:r,productionKillSeatIds:i,...s!==void 0?{productionElements:s}:{}}}}}function pi(e){let t=cu(e);return t.value?{ok:!0,value:t.value}:{ok:!1,issues:t.issues}}function lu(e){if((e.kind==="polygon"||e.kind==="polyline"||e.kind==="line")&&e.points&&e.points.length>=2)return e.kind==="polygon"?An(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 uu(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 bi(e){let t=lu(e);if(!t||t.length<2)return null;let n=e.rotation??0,o=Math.abs(n)<1e-6?t:t.map(c=>uu(c,{x:t.reduce((l,u)=>l+u.x,0)/t.length,y:t.reduce((l,u)=>l+u.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 fu=5,mu=3,hu=.92,du=1.9,pu=2,bu=.6,yu=1,gu=.06;function xu(e){return e.heightM!==void 0?e.heightM:e.stageKind==="ring-boxing"?vo:kn(e.stageKind)?gu:yu}function yi(e){let t=1/0,n=1/0,o=-1/0,r=-1/0,i=-1/0;for(let s of Mi(e)){let a=s.baseHeightM??0;for(let c of s.objects){if(c.type!=="shape"||c.role!=="stage")continue;let l=bi(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+xu(c)))}}return!Number.isFinite(t)||!Number.isFinite(i)?null:{minX:t,minY:n,maxX:o,maxY:r,deckTopM:i}}function Mu(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,u=Math.max(1,Math.ceil((s-r)*t/n)+1),f=Math.max(1,Math.ceil((a-i)*t/n)+1),m=new Float64Array(u*f).fill(-1/0);for(let h of e){if(!Number.isFinite(h.eyeHeightM))continue;let d=h.eyeHeightM-tt,p=Math.min(u-1,Math.max(0,Math.floor((h.x*t-c)/n))),M=Math.min(f-1,Math.max(0,Math.floor((h.y*t-l)/n)))*u+p,g=d+o;g>m[M]&&(m[M]=g)}return{cellM:n,minX:c,minY:l,cols:u,rows:f,top:m}}function Su(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 gi(e,t,n={}){let o=new Map;if(!t||!e.length)return o;let r=n.metresPerChartUnit??ee,i=n.cellM??bu,s=n.chairBackM??hu,a=n.selfRowSkipM??pu,c=n.clearThreshold??.9,l=n.partialThreshold??.25,u=Math.max(1,n.columns??fu),f=Math.max(1,n.rows??mu),m=Mu(e,r,i,s);if(!m)return o;let h=(t.maxX-t.minX)*r,d=(t.maxY-t.minY)*r,p=h>=d,b=(t.minX+t.maxX)/2*r,M=(t.minY+t.maxY)/2*r,g=[];for(let _=0;_<u;_++){let I=(_+.5)/u-.5,y=p?b+I*h:b,x=p?M:M+I*d;for(let P=0;P<f;P++){let R=t.deckTopM+(f===1?0:P/(f-1)*du);g.push({x:y,y:x,z:R})}}let S=i/2;for(let _ of e){if(!Number.isFinite(_.eyeHeightM))continue;let I=_.x*r,y=_.y*r,x=_.eyeHeightM,P=0,R=1/0;for(let T of g){let k=T.x-I,C=T.y-y,E=Math.hypot(k,C);if(!(E>a)){P++;continue}let A=k/E,O=C/E,F=0;for(let L=a;L<E;L+=S){let B=Su(m,I+A*L,y+O*L);if(!(!Number.isFinite(B)||B>=x)&&B>x+(T.z-x)*L/E){F=L;break}}F?R=Math.min(R,F):P++}let v=P/g.length;v>=c||o.set(_.id,{seatId:_.id,mark:v<l?"obstructedView":"restrictedView",visibleFraction:v,totalRays:g.length,atDistanceM:Number.isFinite(R)?R:0})}return o}function xi(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 To(e){return e?e.accessibility?.length?e.wheelchairSpaceType&&!e.accessibility.includes("wheelchair")?["wheelchair",...e.accessibility]:e.accessibility:e.wheelchairSpaceType?["wheelchair"]:e.accessible?["wheelchair"]:[]:[]}var Ln=Math.PI/180;var nn=16;function Bo(e,t,n,o){let r=n*Ln,i=Math.cos(r),s=Math.sin(r);return{x:o.x+e*i-t*s,y:o.y+e*s+t*i}}function No(e){let{seatCount:t,seatSpacing:n,curve:o,rotation:r,origin:i}=e,s=[];if(e.path)return Kr(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(Bo(l*n,0,r,i));return s}let a=o/(t-1)*Ln,c=n/(2*Math.sin(Math.abs(a)/2));for(let l=0;l<t;l++){let u=l*a,f=c*Math.sin(u),m=-c+c*Math.cos(u);s.push(Bo(f,m,r,i))}return s}function Fo(e){let t=new Map;if(e.overrides)for(let n of e.overrides)t.set(n.index,n);return t}function Ru(e,t){let n=Fo(e);return No(e).map((o,r)=>{let i=n.get(r),s=To(i),a=ni(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:_o(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 Iu(e){let t=[];for(let n of Ru(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 Pu(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 _u(e){let t=[],n=Math.max(0,Math.round(e.seatCount));if(n===0)return t;let o=new Map((e.overrides??[]).map(u=>[u.index,u])),r=(u,f,m,h)=>{let d=o.get(u),p=To(d),b=d?.label??oi(e,u);return{index:u,label:b,displayLabel:d?.displayLabel??ri(e,u),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 u=(e.radius??40)+nn,f=e.rotation*Ln,m=Math.max(0,Math.min(360,e.seatArc??360));if(m>=360||n===1){for(let b=0;b<n;b++){let M=f+b/n*2*Math.PI;t.push(r(b,e.center.x+u*Math.cos(M),e.center.y+u*Math.sin(M)))}return t}let h=m*Ln,d=(2*Math.PI-h)/2,p=f+d;for(let b=0;b<n;b++){let M=p+b/(n-1)*h;t.push(r(b,e.center.x+u*Math.cos(M),e.center.y+u*Math.sin(M)))}return t}let i=e.width??80,s=e.height??50,a=Pu(e),c=["top","bottom","left","right"],l=0;for(let u of c){let f=a[u];for(let m=0;m<f;m++){let h,d;u==="top"?(h=-i/2+(m+.5)*i/f,d=-s/2-nn):u==="bottom"?(h=-i/2+(m+.5)*i/f,d=s/2+nn):u==="left"?(h=-i/2-nn,d=-s/2+(m+.5)*s/f):(h=i/2+nn,d=-s/2+(m+.5)*s/f);let p=Bo(h,d,e.rotation,e.center);t.push(r(l++,p.x,p.y,u))}}return t}function wu(e){return _u(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 Eu(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 Io(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 Jr(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 Jt(e){return Array.isArray(e)?e.filter(t=>Array.isArray(t)&&t.length>=3):[]}function Ee(e,t,n){return Io(e,t)&&!Jt(n).some(o=>Io(e,o)||Jr(e,o))}function On(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 Pi(e){switch(e.type){case"row":{let t=No(e),n=Fo(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 On(e.points);case"section":return On(e.outline);case"text":return{x:e.position.x,y:e.position.y};case"shape":return e.points&&e.points.length?On(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 Si(e,t){return e.length===t.length&&e.every((n,o)=>n.x===t[o].x&&n.y===t[o].y)}function Au(e,t){if(e.type!=="gaArea"||!Si(e.points,t.outline))return!1;let n=Jt(e.holes),o=Jt(t.holes);return n.length===o.length&&n.every((r,i)=>Si(r,o[i]))}function Cu(e,t,n=e.filter(r=>r.type==="section"),o=Pi(t)){let r="referenceInventorySource"in t?t.referenceInventorySource?.logicalSectionId:void 0;return(r?n.find(s=>(s.logicalSectionId??s.id)===r&&(Au(t,s)||Ee(o,s.outline,s.holes))):void 0)??n.find(s=>Ee(o,s.outline,s.holes))??(t.type==="row"&&vu(t)?ku(t,n):void 0)}function vu(e){return(e.overrides??[]).some(t=>t.skip===!0)}function ku(e,t){let n=No(e),o=Fo(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 u={x:n[c].x+(l?.dx??0),y:n[c].y+(l?.dy??0)};Ee(u,s.outline,s.holes)&&a++}a>i&&(r=s,i=a)}return r}function Mi(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 Ri(e,t,n,o,r,i,s,a,c){let l=[],u=e.filter(p=>p.type==="section"),f=ei(e),m=p=>!p?.eventConfigurationId||p.eventConfigurationId===o&&(p.eventConfigurationVersion===void 0||p.eventConfigurationVersion===c),h=p=>ci(p,{activeConfigurationId:o,activeConfigurationVersion:c,activeBasisSha256:r,now:a}),d=(p,b)=>h(p)?{...p,coverage:b}:void 0;for(let p of e){let b=[];if(p.type==="row"?b=Iu(p):p.type==="table"?b=wu(p):p.type==="booth"&&(b=Eu(p)),!b.length)continue;for(let I of b)I.viewUrl&&!m(I.viewMeta)&&(I.viewUrl=void 0,I.viewMeta=void 0);if(p.type==="row"){let I=f.get(p.id);if(I){let y=new Map((p.overrides??[]).map(x=>[x.index,x]));for(let x of b){let P=Number(x.id.slice(x.id.lastIndexOf(":")+1));if(!Number.isInteger(P))continue;x.logicalRowId=I.groupId,x.logicalSeatIndex=I.adjacencyOffset+P,y.get(P)?.displayLabel||(x.displayLabel=_o(p,P,I)),!x.viewUrl&&I.viewFromSeatUrl&&m(I.viewFromSeatMeta)&&(x.viewUrl=I.viewFromSeatUrl,x.viewMeta=I.viewFromSeatMeta);let R=y.get(P)?.confidenceEvidence;x.confidenceEvidence=d(R,"exact-seat")??d(p.confidenceEvidence,"row-representative")??d(I.confidenceEvidence,"row-representative")}}}let M=Cu(e,p,u,p.type==="row"?On(b):Pi(p)),g=M?.viewFromSeatUrl,_=(M?.zone?t?.find(I=>I.id===M.zone):void 0)?.focalPoint??n;for(let I of b){if(!I.confidenceEvidence){let y=Number(I.id.slice(I.id.lastIndexOf(":")+1)),x=(p.type==="row"||p.type==="table")&&Number.isInteger(y)?p.overrides?.find(P=>P.index===y)?.confidenceEvidence:void 0;I.confidenceEvidence=d(x,"exact-seat")??(p.type==="row"?d(p.confidenceEvidence,"row-representative"):void 0)}I.confidenceEvidence??=d(M?.confidenceEvidence,"section-representative")??(s?d(s.evidence,s.coverage):void 0),!I.viewUrl&&g&&m(M?.viewFromSeatMeta)&&(I.viewUrl=g,I.viewMeta=M?.viewFromSeatMeta),!I.viewUrl&&i&&m(i.meta)&&(I.viewUrl=i.url,I.viewMeta=i.meta),M&&(I.sectionId=M.logicalSectionId??M.id),M?.zone&&(I.zoneId=M.zone),_&&(I.focalPoint={..._})}l.push(...b)}return l}function Nt(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=Ri(r.objects,e.zones,i,e.eventConfigurationId,e.confidenceBasisSha256,s,a,t.now,t.eventConfigurationVersion??e.eventConfigurationVersion);t.resolveEyeHeights!==!1&&Ii(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=Ri(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&&Ii(e.objects,e.focalPoint,t.floorBaseHeightM??0,n),Ou(e,n,t)}function Ou(e,t,n){return!n.deriveRestrictedView||e.derivedRestrictedView===!1||n.resolveEyeHeights===!1||xi(t,gi(t,yi(e))),t}function Ii(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+tt;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,l=new Map;for(let f=0;f<o.length;f++){let m=o[f],d=(m.sectionId?a.get(m.sectionId)??r.find(b=>b.logicalSectionId===m.sectionId&&Ee({x:m.x,y:m.y},b.outline,b.holes)):void 0)??r.find(b=>Ee({x:m.x,y:m.y},b.outline,b.holes))??null;if(s[f]=d,!d)continue;c.has(d.id)||c.set(d.id,mt(d,{floorBaseHeightM:n}));let p=l.get(d.id);p?p.push(f):l.set(d.id,[f])}let u=new Array(o.length).fill(void 0);for(let[f,m]of l){let h=c.get(f);if(!h)continue;let d=h.rake>0?Math.tan(h.rake*Math.PI/180):0,p=Cn(f,o,m,t);for(let b of p.rows){let M=b.blockDepth*ee*d,g=h.height+M;for(let S of b.seatIndices)u[S]=g}}for(let f=0;f<o.length;f++){let m=o[f],h=s[f];if(!h){m.eyeHeightM=n+tt;continue}let d=c.get(h.id);m.eyeHeightM=(u[f]??d.height)+tt}}var wi=et(require("earcut"),1),Do=et(require("polygon-clipping"),1);function je(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 Ce(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 w=ee,Lu=.002;function Tu(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<Lu}var It=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)}},Nn=class{constructor(){this.pos=new It;this.nor=new It;this.col=new It;this.flr=new It;this.mat=new It;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(Tu(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 Bu(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,u=i*s-o*c,f=o*a-r*s,m=Math.hypot(l,u,f)||1;return l/=m,u/=m,f/=m,[l,u,f]}function Nu(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,wi.default)(o,r.length?r:void 0,2);return{pts:n,tris:i}}function nt(e){return je(e)<0?[...e].reverse():e}var Fu=3;function Du(e,t,n,o){let r=o(e),i=o(t),s=o(n),a=(h,d,p,b)=>Math.abs(o({x:(h.x+d.x)/2,y:(h.y+d.y)/2})-(p+b)/2),c=(e.x+t.x+n.x)/3,l=(e.y+t.y+n.y)/3,u=(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:l})-u)),m=(h,d,p)=>{let b=Math.abs(o({x:(h+c)/2,y:(d+l)/2})-(p+u)/2);b>f&&(f=b)};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 on(e,t,n,o,r){if(r<=0)return Du(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(on(e,i,a,o,r-1),on(i,t,s,o,r-1),on(a,s,n,o,r-1),on(i,s,a,o,r-1))}function rn(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};rn(e,t,m,d,r,i,s-1,a),rn(e,m,n,h,r,i,s-1,a),rn(e,d,h,o,r,i,s-1,a),rn(e,m,h,d,r,i,s-1,a);return}let c=[t.x*w,r(t),t.y*w],l=[n.x*w,r(n),n.y*w],u=[o.x*w,r(o),o.y*w];if(a){e.triN(c,l,u,a(t),a(n),a(o),i);return}let f=Bu(c,l,u);f[1]<0&&(f=[-f[0],-f[1],-f[2]]),e.tri(c,l,u,f,i)}var Gu=8;function _i(e,t,n){if(!Number.isFinite(n))return e;let o=[],r=(i,s,a,c,l)=>{if(l>0){let u={x:(i.x+s.x)/2,y:(i.y+s.y)/2},f=t(u);if(Math.abs(f-(a+c)/2)>n){r(i,u,a,f,l-1),r(u,s,f,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),Gu)}return o}function Tn(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,u=Math.hypot(c,l);u>t&&Math.abs((s.x-i.x)*l-(s.y-i.y)*c)/u<t||o.push(s)}return o.length>=3?o:n}var Bn=.001*Ke*.1;function $(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(je(t))<1e-4))return;let u=Tn(_i(Tn(nt(t),Bn),o,c),Bn),f=n?.map(y=>Tn(_i(Tn(nt(y),Bn),o,c),Bn)).filter(y=>y.length>=3&&Math.abs(je(y))>=1e-4),{pts:m,tris:h}=Nu(u,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],b=[s[0]*a.top,s[1]*a.top,s[2]*a.top],M=[s[0]*a.wallBottom,s[1]*a.wallBottom,s[2]*a.wallBottom],g=0;if(Number.isFinite(c))for(;g<Fu;g++){let y=0;for(let x=0;x<h.length;x+=3){let P=on(m[h[x]],m[h[x+1]],m[h[x+2]],o,g);P>y&&(y=P)}if(y<=c)break}for(let y=0;y<h.length;y+=3){let x=m[h[y]],P=m[h[y+1]],R=m[h[y+2]];rn(e,x,P,R,o,d,g,l);let v=[x.x*w,r,x.y*w],T=[P.x*w,r,P.y*w],k=[R.x*w,r,R.y*w];e.tri(v,k,T,[0,-1,0],p)}let S=y=>{if(g<=0)return y;let x=1<<g,P=[];for(let R=0;R<y.length;R++){let v=y[R],T=y[(R+1)%y.length];for(let k=0;k<x;k++){let C=k/x;P.push({x:v.x+(T.x-v.x)*C,y:v.y+(T.y-v.y)*C})}}return P},_=Mo(u),I=[{ring:S(u),flip:!1}];if(f)for(let y of f)y.length>=3&&I.push({ring:S(y),flip:!0});for(let{ring:y,flip:x}of I)for(let P=0;P<y.length;P++){let R=y[P],v=y[(P+1)%y.length],T=(v.x-R.x)*w,C=(v.y-R.y)*w,E=-T,A=Math.hypot(C,E)||1;C/=A,E/=A;let O=(R.x+v.x)/2-_.x,F=(R.y+v.y)/2-_.y,L=C*O+E*F;x&&(L=-L),L<0&&(C=-C,E=-E);let B=[C,0,E],D=[R.x*w,o(R),R.y*w],j=[v.x*w,o(v),v.y*w],G=[R.x*w,r,R.y*w],V=[v.x*w,r,v.y*w];e.tri(D,j,V,B,b,b,M),e.tri(D,V,G,B,b,M,M)}}function Ei(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 ot(e,t,n=2.5){if(t<=0||e.length<3)return e;let o=nt(e),r=o.length,i=[];for(let a=0;a<r;a++){let c=o[a],l=o[(a+1)%r],u=l.x-c.x,f=l.y-c.y,m=Math.hypot(u,f)||1;i.push({x:f/m,y:-u/m})}let s=[];for(let a=0;a<r;a++){let c=o[a],l=i[(a-1+r)%r],u=i[a],f=l.x+u.x,m=l.y+u.y,h=Math.hypot(f,m),d=()=>{s.push([c.x+l.x*t,c.y+l.y*t]),s.push([c.x+u.x*t,c.y+u.y*t])};if(h<1e-9){d();continue}f/=h,m/=h;let p=f*l.x+m*l.y,b=1/Math.max(p,1e-6);if(!Number.isFinite(b)||b>n){d();continue}s.push([c.x+f*t*b,c.y+m*t*b])}if(s.length<3)return e;try{let a=Do.default.union([[...s,s[0]]]),c=null,l=-1/0;for(let f of a){let m=Math.abs(je(f[0].map(([h,d])=>({x:h,y:d}))));m>l&&(l=m,c=f[0])}if(!c)return e;let u=c.map(([f,m])=>({x:f,y:m}));if(u.length>1){let f=u[0],m=u[u.length-1];Math.abs(f.x-m.x)<1e-9&&Math.abs(f.y-m.y)<1e-9&&u.pop()}return u.length>=3?u:e}catch{return e}}function We(e,t,n=2.5){if(e.length<3)return[];if(t<=0)return e;let o=nt(e),r=o.length,i=[];for(let c=0;c<r;c++){let l=o[c],u=o[(c+1)%r],f=Math.hypot(u.x-l.x,u.y-l.y)||1;i.push({x:-(u.y-l.y)/f,y:(u.x-l.x)/f})}let s=[],a=[];for(let c=0;c<r;c++){let l=o[c],u=i[(c-1+r)%r],f=i[c],m=u.x+f.x,h=u.y+f.y,d=Math.hypot(m,h),p=d<1e-9?1/0:1/Math.max(m/d*u.x+h/d*u.y,1e-6);if(!Number.isFinite(p)||p>n){s.push({x:l.x+u.x*t,y:l.y+u.y*t},{x:l.x+f.x*t,y:l.y+f.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,u=a[c],f=a[l];if(f!==(u+1)%r)continue;let m=o[u],h=o[f];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=Do.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,u=0;for(let d of c){let p=Math.abs(je(d[0].map(([b,M])=>({x:b,y:M}))));p>u&&(u=p,l=d[0])}if(!l)return[];let f=l.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?nt(f):[]}catch{return[]}}function Fn(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 sn(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 an=3,Pt=.38,cn=.24;function Hu(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)*w,i=(n.y-t.y)*w,s=(o.x-t.x)*w,a=(o.y-t.y)*w,c=2*(r*a-i*s);if(Math.abs(c)<1e-7)return null;let l=r*r+i*i,u=s*s+a*a,f=(l*a-u*i)/c+t.x*w,m=(r*u-s*l)/c+t.y*w,h=Math.hypot(t.x*w-f,t.y*w-m);return h<1||h>200||!Number.isFinite(h)||e.some(d=>Math.abs(Math.hypot(d.x*w-f,d.y*w-m)-h)>.03)?null:{x:f,z:m,radius:h}}function Ai(e){let t=[],n=new Map,o=(c,l)=>`${Math.floor(c/an)},${Math.floor(l/an)}`;for(let c of e)for(let l of c.rows){for(let f of l.pts){let m=f.x*w,h=f.y*w,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 u=Hu(l.pts);for(let f of[0,l.pts.length-1]){let m=l.pts[f],h=l.pts[f===0?1:f-1],d=m.x-h.x,p=m.y-h.y,b=Math.hypot(d,p);b<1e-6||t.push({sectionId:c.sectionId,floorIndex:c.floorIndex,curve:u,row:l,point:m,x:m.x*w,z:m.y*w,dx:d/b,dz:p/b})}}let r=new Map;t.forEach((c,l)=>{let u=o(c.x,c.z),f=r.get(u)??[];f.push(l),r.set(u,f)});let i=(c,l)=>{let u=Math.floor(c/an),f=Math.floor(l/an);return[-1,0,1].flatMap(m=>[-1,0,1].map(h=>`${u+m},${f+h}`))},s=new Map;t.forEach((c,l)=>{let u=-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 b=p.x-c.x,M=p.z-c.z,g=Math.hypot(b,M);if(g<Pt*2+.45||g>an)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,_=Math.min((b*c.dx+M*c.dz)/g,(-b*p.dx-M*p.dz)/g);(S?_<.8:_<.98)||!S&&(Math.abs(b*c.dz-M*c.dx)>.15||Math.abs(b*p.dz-M*p.dx)>.15)||(g<f-.02?(u=d,f=g,m=!1):Math.abs(g-f)<=.02&&(m=!0))}u>=0&&!m&&s.set(l,u)});let a=[];for(let[c,l]of s){if(c>=l||s.get(l)!==c)continue;let u=t[c],f=t[l],m=Math.hypot(f.x-u.x,f.z-u.z),h=(f.x-u.x)/m,d=(f.z-u.z)/m,p=!1;for(let M of i((u.x+f.x)/2,(u.z+f.z)/2))for(let g of n.get(M)??[]){if(g.floor!==u.floorIndex||Math.abs(g.y-u.row.y)>.75)continue;let S=(g.x-u.x)*h+(g.z-u.z)*d,_=Math.abs((g.x-u.x)*d-(g.z-u.z)*h);S>.01&&S<m-.01&&_<cn+Pt&&(p=!0)}if(p)continue;let b=(M,g)=>({x:(u.x+h*M-d*g)/w,y:(u.z+d*M+h*g)/w});a.push({sections:[u.sectionId,f.sectionId],blocks:[u.row.blockId,f.row.blockId],floorIndex:u.floorIndex,ends:[u.point,f.point],clearWidthM:m-2*Pt,heightM:(u.row.y+f.row.y)/2,outline:[b(Pt,-cn),b(m-Pt,-cn),b(m-Pt,cn),b(Pt,cn)]})}return a}var ju=/^#?([\da-f]{3}|[\da-f]{6})$/i;function Ci(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 Vu(e){let t=ju.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 me(e){let t=Vu(e);return t?[t[0]/255,t[1]/255,t[2]/255]:null}function Uu(e){return .2126*e[0]+.7152*e[1]+.0722*e[2]}function fe(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 rt(e,t){let n=Uu(e);return fe(e,[n,n,n],t)}function vi({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,u=c>.5?l/(2-s-a):l/(s+a),f;return s===o?f=((r-i)/l+(r<i?6:0))/6:s===r?f=((i-o)/l+2)/6:f=((o-r)/l+4)/6,{h:f,s:u,l:c}}var Go=e=>e<=.04045?e/12.92:((e+.055)/1.055)**2.4,Ho=e=>e<=.0031308?12.92*e:1.055*Math.max(0,e)**.4166666666666667-.055,jo=e=>Math.min(1,Math.max(0,e));function Uo(e){let t=Go(e[0]),n=Go(e[1]),o=Go(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 Vo([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[jo(Ho(4.0767416621*o-3.3077115913*r+.2309699292*i)),jo(Ho(-1.2684380046*o+2.6097574011*r-.3413193965*i)),jo(Ho(-.0041960863*o-.7034186147*r+1.707614701*i))]}var Dn=e=>Uo(e)[0];function ln(e){let[,t,n]=Uo(e);return Math.hypot(t,n)}function _t(e,t,n){let[,o,r]=Uo(e);if(n===void 0)return Vo([t,o,r]);let i=Math.hypot(o,r),s=i===0?0:n/i;return Vo([t,o*s,r*s])}function Gn(e){return Vo([e,-.004,-.008])}var Hn=["available","held","sold","selected","dimmed"];function Oi(e){let t=Hn.indexOf(e);return t<0?0:t}var Li={available:[.24,.82,.52],held:[.34,.39,.45],sold:[.34,.39,.45],selected:[.24,.74,1],dimmed:[.28,.32,.37]};var ki={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}},jn=.012;function wt(e){return Dn(e.tierTop)>.6}function Ft(e){return e?ki.day:ki.night}var Xo={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]},Ko={top:[.05,.06,.08],bottom:[.1,.12,.15]};function Y(e,t){return[Math.min(1,e[0]*t),Math.min(1,e[1]*t),Math.min(1,e[2]*t)]}var Xu=.15,Ku=1.6;function Ti(e){return So(e??1,Xu,Ku)}var Wo={key:[1,1,1],ambient:[1,1,1]};var Wu=[{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}],Yu=new Map(Wu.map(e=>[e.id,e])),Bi="plain",Ni=3e3;function Fi(e,t){return e.openField?t?"daylight":"floodlit":e.court||e.inTheRound||e.stage&&e.seatCount>Ni?t?"daylight":"arena-show":e.stage?t?"concert-hall":"theatre":t?"daylight":"evening"}function Di(e){return e.openField?!1:e.indoorCourt?!0:e.stage&&!e.inTheRound&&!e.court&&e.standing<e.seatCount&&e.seatCount<=Ni}function Yo(e){return e&&Yu.get(e)||null}var zu=.15,Zu=.9,$u=1.76;function Qu(e,t,n){let o=e??qu,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 un(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 qu=[.075,.09,.115];function Gi(e){return un(e)?{zenith:[.36,.58,.84],horizon:[.82,.88,.94]}:{zenith:[.05,.08,.15],horizon:[.3,.38,.5]}}function un(e){return!!e&&e[0]*.2126+e[1]*.7152+e[2]*.0722>.55}function Ju(){return{background:{top:[...Ko.top],bottom:[...Ko.bottom]},sky:Gi(null),structure:Xo,seatStates:{...Li},seatScale:1,materials:{seat:null,shell:null,roughness:.78},light:{key:[...Wo.key],ambient:[...Wo.ambient]},house:null}}function ef(e){return un(e)?{deck:"#c9ccc8",fascia:"#b4bab8",shell:"#c3c9c8",roughness:.87}:{deck:"#69747b",fascia:"#3e4d58",shell:"#526572",roughness:.87}}function Hi(e,t){let n=e?.venue3d?.look;if(n===Bi)return{look:null,chosen:!0};let o=Yo(n);return o?{look:o,chosen:!0}:t?{look:Yo(Fi(t,un(me(e?.background)))),chosen:!1}:{look:null,chosen:!1}}function tf(e,t){let{look:n,chosen:o}=Hi(e,t);return me(e?.background)??(o?me(n?.background):null)}function ji(e,t){let n=Ju();e??={};let{look:o,chosen:r}=Hi(e,t);o&&(n.light={key:[...o.light.key],ambient:[...o.light.ambient]});let i=tf(e,t);if(o&&(n.house=Qu(i,o,r?o.indoor:!!t&&Di(t))),i){n.background={top:Y(i,Zu),bottom:Y(i,$u)},n.sky=Gi(i);let u={};for(let[m,h]of Object.entries(Xo))u[m]=fe(h,i,zu);i[0]*.2126+i[1]*.7152+i[2]*.0722>.55&&(u.ground=Y(i,.86)),n.structure=u}let s=me(e.selectionColor)??me(e.accent);s&&(n.seatStates={...n.seatStates,selected:s});let a=e.seatScale;typeof a=="number"&&Number.isFinite(a)&&(n.seatScale=Ti(a));let c=Object.fromEntries(Object.entries(e.venue3d??{}).filter(([u,f])=>f!=null&&u!=="look")),l={...ef(i),...o?.materials,...c};if(l){let u=me(l.deck),f=me(l.fascia);u&&(n.structure={...n.structure,tierTop:u,gaTop:u}),f&&(n.structure={...n.structure,tierWall:f,gaWall:f}),n.materials.seat=me(l.seat),n.materials.shell=me(l.shell),typeof l.roughness=="number"&&Number.isFinite(l.roughness)&&(n.materials.roughness=Math.min(1,Math.max(0,l.roughness)))}return nf(n,un(i)),n}function nf(e,t){let n=Ft(t);e.seatStates={...e.seatStates,held:Gn(n.unavailable),sold:Gn(n.unavailable),dimmed:Gn(n.dimmed)};let o=(i,s)=>_t(i,s,Math.min(ln(i),jn)),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 Vi(e,t){let n=[];for(let o of t)n.push(...e.seatStates[o]);return n}function Ui(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 Dt(e,t){return e.minX<=t.maxX&&t.minX<=e.maxX&&e.minY<=t.maxY&&t.minY<=e.maxY}var Ms=et(require("polygon-clipping"),1);var W={top:1,wallBottom:.58,bottomCap:.4};function Et(e,t){if(!e)return t;let n=Y(rt(e,.4),.62);return fe(t,n,.22)}function Xi(e,t){return e?fe(t,Y(rt(e,.25),.74),.62):t}function Ki(e,t){let n=Ft(wt({tierTop:t}));return e?_t(e,n.sectionDeck,Math.min(n.sectionDeckChromaShare*ln(e),n.sectionDeckChromaCap)):_t(t,n.deck,Math.min(ln(t),jn))}function Wi(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,u=0;for(let[f,m]of s){let h=me(n.get(f));h&&(a+=h[0]*m,c+=h[1]*m,l+=h[2]*m,u+=m)}u>0&&r.set(i,[a/u,c/u,l/u])}return r}function Yi(e,t){return me(e.color)??t.get(e.logicalSectionId??e.id)??null}var Jo=et(require("polygon-clipping"),1);var qo=et(require("polygon-clipping"),1);var zi=e=>Math.round(e*1e6)/1e6+0;function Gt(e){let t=e.map(r=>({x:zi(r.x),y:zi(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,u=s.y-r.y;return a*u-c*l>1e-6*Math.hypot(a,c)*Math.hypot(l,u)},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 zo=[{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"}],Ly=new Map(zo.map(e=>[e.key,e]));var of={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 Vn(e){let t=e?.[0];return t&&of[t]||"#3b82f6"}var rf=[{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"}],Ty=new Map(rf.map(e=>[e.key,e]));var sf=["reference-focal","bar","entrance","exit","restroom","screen","sound","concession","coat","wall","rail","suite","obstruction"],By=new Set(sf);var $i=[{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}}],Qi=$i.map(e=>e.key),af=new Map($i.map(e=>[e.key,e]));function Zi(e){return typeof e=="string"&&af.has(e)}function qi(e,t){return Zi(e)?e:Zi(t?.seatGlyph)?t.seatGlyph:"circle"}var Ve={pedestal:0,pad:1,back:2,arm:3,footrest:4,leg:5,spine:6,armrest:7},cf=.44,lf=.15,uf=.3,ff=.24;function es(e){return e===void 0||!Number.isFinite(e)||e<=0?ff:Math.min(uf,Math.max(lf,e*cf))}var mf=.05,ts=.45,hf=ts+mf,df=.92;var pf=.28,Ji=.15,Hy=[{part:Ve.pedestal,min:[-.3,0,-.3],max:[.3,.36,.3]},{part:Ve.pad,min:[-1,.36,-.95],max:[1,ts,1]},{part:Ve.back,min:[-1,hf,-1],max:[1,df,-.72]},{part:Ve.arm,min:[-1,.44,-.82],max:[-.78,.65,.78]},{part:Ve.arm,min:[.78,.44,-.82],max:[1,.65,.78]},{part:Ve.footrest,min:[-.9,.18,.78],max:[.9,.31,1.34]},{part:Ve.leg,min:[-.82,0,-.7],max:[-.62,.37,-.48]},{part:Ve.leg,min:[.62,0,-.7],max:[.82,.37,-.48]},{part:Ve.leg,min:[-.82,0,.48],max:[-.62,.37,.7]},{part:Ve.leg,min:[.62,0,.48],max:[.82,.37,.7]},{part:Ve.spine,min:[-.8,.3,-1],max:[.8,.6,-.9]},...[1,-1].flatMap(e=>{let t=s=>{let a=e*(Ji-s),c=e*(Ji+s);return[Math.min(a,c),Math.max(a,c)]},[n,o]=t(.09),[r,i]=t(pf/2);return[{part:Ve.armrest,min:[n,0,-.5],max:[o,.6,.05],skip:[2,3]},{part:Ve.armrest,min:[r,.6,-.74],max:[i,.655,.58],skip:[3]}]})];var Zo=20*Math.PI/180;function ns(e,t,n,o,r){let i=new Float32Array(t),s=f=>e[f*3],a=f=>e[f*3+2],c=Math.cos(Zo),l=0,u=(f,m)=>{let h=m-f,d=r?.(f),p=d!==void 0;for(let S=f+1;!p&&S<m-1;S++){let _=s(S)-s(S-1),I=a(S)-a(S-1),y=s(S+1)-s(S),x=a(S+1)-a(S),P=Math.hypot(_,I)*Math.hypot(y,x);P>1e-9&&(_*y+I*x)/P<c&&(p=!0)}let b=0,M=0,g=!1;if(p){if(d)[b,M]=d;else{for(let _=f;_<m;_++)b+=s(_),M+=a(_);b/=h,M/=h}let S=0;for(let _=f+1;_<m;_++)S=Math.max(S,Math.hypot(s(_)-s(_-1),a(_)-a(_-1)));g=h>=3&&Math.hypot(s(m-1)-s(f),a(m-1)-a(f))<=S*1.6}for(let S=f;S<m;S++){let[_,I]=p?[b,M]:o(S),y=_-s(S),x=I-a(S);if(h>=2&&!(d&&h<3)){let P=g?f+(S-1-f+h)%h:Math.max(f,S-1),R=g?f+(S+1-f)%h:Math.min(m-1,S+1),v=s(R)-s(P),T=a(R)-a(P),k=Math.hypot(v,T);if(k>1e-6){let C=-T/k,E=v/k;C*y+E*x<0&&(C=-C,E=-E),y=C,x=E}}i[S]=y===0&&x===0?0:Math.atan2(y,x)}};for(let f=1;f<=t;f++)(f===t||n(f)!==n(l))&&(u(l,f),l=f);return i}var Un=.22;var bf=.42,os=1.6;function yf(e,t){let n=new Float32Array(e.length*4),o=Math.cos(Zo),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 u=e[l].x-e[l-1].x,f=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(u,f)*Math.hypot(m,h);d>1e-9&&(u*m+f*h)/d<o&&(s=!1)}let a=[];for(let l=r+1;s&&l<i;l++){let u=Math.hypot(e[l].x-e[l-1].x,e[l].y-e[l-1].y);u>1e-6&&a.push(u)}a.sort((l,u)=>l-u);let c=a.length?a[Math.floor(a.length/2)]:0;for(let l=r;c>0&&l<i;l++){let u=b=>{let M=l+b;if(M<r||M>=i)return null;let g=e[M].x-e[l].x,S=e[M].y-e[l].y,_=Math.hypot(g,S);return _>1e-6?{x:g/_,y:S/_,gap:_}:null},f=u(1),m=u(-1),h=c/2,d=f??(m?{x:-m.x,y:-m.y,gap:1/0}:null);if(!d)continue;let p=f&&f.gap<c*os?f.gap/2:h;if(n[l*4]=d.x*p*w,n[l*4+1]=d.y*p*w,!m||m.gap>=c*os){let b=m??{x:-d.x,y:-d.y};n[l*4+2]=b.x*h*w,n[l*4+3]=b.y*h*w}}r=i}return n}function gf(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),u=Math.max(1,Math.ceil(a/l)+1),f=Math.max(1,Math.ceil(c/l)+1),m=new Map,h=(d,p)=>{let b=Math.min(u-1,Math.max(0,Math.floor((d-o)/l)));return Math.min(f-1,Math.max(0,Math.floor((p-r)/l)))*u+b};for(let d=0;d<t;d++){let p=h(e[d].x,e[d].y),b=m.get(p);b?b.push(d):m.set(p,[d])}for(let d=0;d<t;d++){let p=e[d],b=Math.min(u-1,Math.max(0,Math.floor((p.x-o)/l))),M=Math.min(f-1,Math.max(0,Math.floor((p.y-r)/l))),g=1/0;for(let S=1;S<=4;S++){for(let _=M-S;_<=M+S;_++)if(!(_<0||_>=f))for(let I=b-S;I<=b+S;I++){if(I<0||I>=u||S>1&&Math.abs(_-M)<S&&Math.abs(I-b)<S)continue;let y=m.get(_*u+I);if(y)for(let x of y){if(x===d)continue;let P=Math.hypot(e[x].x-p.x,e[x].y-p.y);P<g&&(g=P)}}if(Number.isFinite(g)&&g<=S*l)break}n[d]=g}return n}function xf(e){let t=e.eyeHeightM;return Number.isFinite(t)?Math.max(0,t-tt):0}function rs(e,t,n,o,r,i,s){let a=e.length,c=new Float32Array(a*3),l=new Float32Array(a),u=new Float32Array(a*3),f=new Float32Array(a),m=new Float32Array(a),h=new Float32Array(a),d=new Float32Array(a),p=new Float32Array(a*3),b=new Map,M=gf(e);for(let g=0;g<a;g++){let S=e[g],I=(n?.seatPitchU(g)??M[g])*w;f[g]=Number.isFinite(I)?Math.max(.06,Math.min(Un,I*bf)):Un,m[g]=es(Number.isFinite(I)?I:void 0);let y=qi(S.glyph,{seatGlyph:i?.get(S.categoryKey)}),x=S.glyph!==void 0||i?.has(S.categoryKey);h[g]=Qi.indexOf(!x&&s?.has(S.rowId)?"dining":y),d[g]=S.wheelchairSpaceType==="no-seat"?0:1,c[g*3]=S.x*w,c[g*3+1]=n?n.seatDeckY(g):xf(S),c[g*3+2]=S.y*w,l[g]=Oi(t?t(S):"available");let P=me(r?.get(S.categoryKey)??"#6e7bff")??[.43,.48,1];if(u[g*3]=P[0],u[g*3+1]=P[1],u[g*3+2]=P[2],S.accessibility?.length){let R=me(Vn(S.accessibility));R&&(p[g*3]=R[0],p[g*3+1]=R[1],p[g*3+2]=R[2])}b.set(S.id,g)}return{count:a,iPosition:c,iState:l,iCategory:u,iMaxRadius:f,iRing:p,idToIndex:b,iChairWidth:m,iGlyph:h,iPhysicalSeat:d,iArmrests:yf(e,s),iFloor:o??new Float32Array(a),iSection:new Float32Array(a).fill(-1),iYaw:new Float32Array(a)}}var cs=et(require("earcut"),1);var Mf=.58,is=.01,Ye=Un*1.5*Ke,Sf=.5,Rf=.6;function If(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,u=c.y-a.y,f=Math.hypot(l,u);if(f<1e-9){o.push([0,0]);continue}l/=f,u/=f,o.push([-u,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 Pf(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,u=Math.hypot(c,l)||1;return{x:c/u,y:l/u}},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 ss=Math.PI/12;function _f(e){if(e.length<3)return[...e];let t=Gt(e);return t.length>=3?t:[...e]}function ls(e,t){if(!e.length||!(t>0))return[];let n=_f(e),o=(a,c,l,u)=>{let f=l-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/ss)),h=t/Math.cos(f/m/2);for(let d=0;d<=m;d++){let p=c+f*d/m;u.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 u=[],f=Math.max(3,Math.ceil(Math.PI*2/ss)),m=(l+t)/Math.cos(Math.PI/f);for(let h=0;h<f;h++){let d=h/f*Math.PI*2;u.push({x:a+Math.cos(d)*m,y:c+Math.sin(d)*m})}return u}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 ds(s)}function wf(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,u=l>1e-12?((t-i.x)*a+(n-i.y)*c)/l:0;u<0?u=0:u>1&&(u=1);let f=Math.hypot(t-(i.x+u*a),n-(i.y+u*c));f<o&&(o=f)}return o}function Xn(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 u=Math.hypot(l.x-i,l.y-s);u>c&&(c=u)}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 u 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(u.x-h.cx,u.y-h.cy)-h.rad;if(d>=f&&d>=a)continue;let p=wf(e[m].pts,u.x,u.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((u,f)=>u-f);let l=s.length?s[Math.floor(s.length/2)]:1;o.push({pitch:l,belowY:c})}return o}function us(e,t,n,o){let r=e[t],i=r.pts.length>=2?[...r.pts]:r.pts.length===1?(()=>{let u=r.pts[0],f=u.x-o.x,m=u.y-o.y,h=Math.hypot(f,m)||1;f/=h,m/=h;let d=Math.max(n[t].pitch,.001)*.5;return[{x:u.x+m*d,y:u.y-f*d},{x:u.x-m*d,y:u.y+f*d}]})():[];if(i.length<2)return null;let s=0,a=0;for(let u=1;u<i.length;u++){let f=Math.hypot(i[u].x-i[u-1].x,i[u].y-i[u-1].y);f>1e-6&&(s+=f,a++)}let c=a>0?s/a:0,l=Pf(i,Math.max(c*Rf,Ye));return{pts:l,nrm:If(l,o),front:Math.max(n[t].pitch*Mf,Ye),back:Math.max(n[t].pitch*Sf,Ye)}}var Ht=1.5,fs=.3;function $o(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 l=$o(e.slice(0,c+1),t),u=$o(e.slice(c),t);return[...l.slice(0,-1),...u]}function ms(e,t){if(e.length<4)return e;let n=$o([...e,e[0]],t);return n.pop(),n.length>=3?n:e}function Ef(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 hs(e,t,n){if(e.length<2)return[];let o=n??Xn(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=>us(e,g,o,t)).filter(g=>g!==null);if(!l.length)continue;let u=(g,S)=>({x:g.pts[S].x-g.nrm[S][0]*(g.front+Ht),y:g.pts[S].y-g.nrm[S][1]*(g.front+Ht)}),f=(g,S)=>({x:g.pts[S].x+g.nrm[S][0]*(g.back+Ht),y:g.pts[S].y+g.nrm[S][1]*(g.back+Ht)}),m=l[0],h=l[l.length-1],d=[];for(let g=0;g<m.pts.length;g++)d.push(u(m,g));for(let g of l)d.push(f(g,g.pts.length-1));for(let g=h.pts.length-1;g>=0;g--)d.push(f(h,g));for(let g=l.length-1;g>=0;g--)d.push(u(l[g],0));let p=ds(d),b=1/0;for(let g of a)e[g].y<b&&(b=e[g].y);if(!Number.isFinite(b))continue;if(p.length>=3&&Math.abs(je(p))>1e-6&&l.every(g=>{let S=g.pts[Math.floor(g.pts.length/2)];return Ce(p,S.x,S.y)})&&!Ef(p)){i.push({outline:ms(p,fs),holes:[],topY:b});continue}for(let g of Af(l))i.push({outline:g,holes:[],topY:b})}return i}function Af(e){let t=[];for(let n of e){let o=[],r=[],i=n.front+Ht,s=n.back+Ht;for(let c=0;c<n.pts.length;c++){let l=n.pts[c],u=n.nrm[c];o.push([l.x-u[0]*i,l.y-u[1]*i]),r.push([l.x+u[0]*s,l.y+u[1]*s])}let a=[...o,...r.reverse()];a.length<3||(a.push(a[0]),t.push([a]))}if(!t.length)return[];try{let n=qo.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(ms(i,fs))}return o}catch{return[]}}function ds(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 Qo=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(!Ce(n,r.x,r.y)){o=!1;break}if(o)return!0}return!1}};function as(e,t,n,o,r,i){if(o.length<3)return;if(n.containsAll(o)){let l=[0,1,0],u=o[0];for(let f=1;f+1<o.length;f++){let m=o[f],h=o[f+1];e.tri([u.x*w,r,u.y*w],[m.x*w,r,m.y*w],[h.x*w,r,h.y*w],l,i)}return}let s=o.map(l=>[l.x,l.y]);s.push(s[0]);let a;try{a=qo.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 u=l[0],f=[],m=[];for(let d=0;d<u.length-1;d++)f.push(u[d][0],u[d][1]),m.push([u[d][0],u[d][1]]);if(m.length<3)continue;let h=(0,cs.default)(f,void 0,2);for(let d=0;d<h.length;d+=3){let p=m[h[d]],b=m[h[d+1]],M=m[h[d+2]];e.tri([p[0]*w,r,p[1]*w],[b[0]*w,r,b[1]*w],[M[0]*w,r,M[1]*w],c,i)}}}function ps(e,t,n,o,r,i,s){if(t.length<2)return;let a=s??Xn(t),c=[0,1,0],l=i&&i.length>=3?[[...i.map(h=>[h.x,h.y]),[i[0].x,i[0].y]]]:null,u=i&&i.length>=3?new Qo([[...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 I=[...d.patch],y=a[h].belowY??o;if(m(()=>{if(l&&u)as(e,l,u,I,d.y,r.tread);else{let x=I[0];for(let P=1;P+1<I.length;P++){let R=I[P],v=I[P+1];e.tri([x.x*w,d.y,x.y*w],[R.x*w,d.y,R.y*w],[v.x*w,d.y,v.y*w],c,r.tread)}}}),d.y>y+is){let x=0,P=0;for(let R of I)x+=R.x,P+=R.y;x/=I.length,P/=I.length,f(()=>{for(let R=0;R<I.length;R++){let v=I[R],T=I[(R+1)%I.length],k=T.x-v.x,C=T.y-v.y,E=Math.hypot(k,C);if(E<1e-6)continue;let A=C/E,O=-k/E;(v.x-x)*A+(v.y-P)*O<0&&(A=-A,O=-O);let F=[A,0,O],L=[v.x*w,d.y,v.y*w],B=[T.x*w,d.y,T.y*w],D=[v.x*w,y,v.y*w],j=[T.x*w,y,T.y*w];e.tri(L,B,j,F,r.riser),e.tri(L,j,D,F,r.riser)}})}continue}let p=us(t,h,a,n);if(!p)continue;let{pts:b,nrm:M,front:g,back:S}=p,_=a[h].belowY??o;for(let I=0;I+1<b.length;I++){let y=b[I],x=b[I+1],P=M[I],R=M[I+1];if(Math.hypot(x.x-y.x,x.y-y.y)<1e-6||P[0]===0&&P[1]===0||R[0]===0&&R[1]===0)continue;let v=[(y.x-P[0]*g)*w,d.y,(y.y-P[1]*g)*w],T=[(x.x-R[0]*g)*w,d.y,(x.y-R[1]*g)*w],k=[(y.x+P[0]*S)*w,d.y,(y.y+P[1]*S)*w],C=[(x.x+R[0]*S)*w,d.y,(x.y+R[1]*S)*w];if(m(()=>{l&&u?as(e,l,u,[{x:y.x-P[0]*g,y:y.y-P[1]*g},{x:x.x-R[0]*g,y:x.y-R[1]*g},{x:x.x+R[0]*S,y:x.y+R[1]*S},{x:y.x+P[0]*S,y:y.y+P[1]*S}],d.y,r.tread):(e.tri(v,T,C,c,r.tread),e.tri(v,C,k,c,r.tread))}),d.y>_+is){let E=[v[0],_,v[2]],A=[T[0],_,T[2]],O=[-P[0],0,-P[1]];f(()=>{e.tri(v,T,A,O,r.riser),e.tri(v,A,E,O,r.riser)})}}}}function Cf(e,t){let n=e.eventConfigurationIds;return!n?.length||!!t&&n.includes(t)}function bs(e,t){return e.filter(n=>n.type!=="shape"||Cf(n,t))}function ys(e,t){let n=e.focalPoint??{x:0,y:0};return e.floors?.length?e.floors.map((o,r)=>({objects:bs(o.objects,t),focal:{x:(o.focalPoint??n).x,y:(o.focalPoint??n).y},baseHeightM:o.baseHeightM??0,index:r})):[{objects:bs(e.objects,t),focal:n,baseHeightM:0,index:0}]}var vf={minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};function lt(e){return Ui(e)??vf}function gs(e,t){let n=ot(e.outline,Ye),o=lt(n),r=t.filter(s=>s!==e&&s.outline&&s.outline.length>=3&&Dt(o,lt(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=Jo.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(([u,f])=>({x:u,y:f}));if(l.length>1){let u=l[0],f=l[l.length-1];Math.abs(u.x-f.x)<1e-9&&Math.abs(u.y-f.y)<1e-9&&l.pop()}l.length>=3&&a.push(l)}return a.length?a:[n]}catch{return[n]}}function xs(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=Jo.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,u])=>({x:l,y:u}));if(c.length>1){let l=c[0],u=c[c.length-1];Math.abs(l.x-u.x)<1e-9&&Math.abs(l.y-u.y)<1e-9&&c.pop()}c.length>=3&&r.push({outline:c,holes:[],topY:i.topY})}}return r.length?r:e}function kf(e,t){return e===void 0||t===void 0?!0:Math.abs(e-t)<.001}var Kn=class{constructor(){this.rings=[];this.boxes=[];this.levels=[]}subtract(t,n){let o=t.map(c=>[c.x,c.y]);if(o.length<3)return[];o.push(o[0]);let r=lt(t),i=this.rings.filter((c,l)=>Dt(r,this.boxes[l])&&kf(n,this.levels[l])),s=[[o]];if(i.length)try{s=Ms.default.difference([o],...i).map(l=>l.map(u=>u.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 l=c[0].map(([u,f])=>({x:u,y:f}));if(l.length>1){let u=l[0],f=l[l.length-1];Math.abs(u.x-f.x)<1e-9&&Math.abs(u.y-f.y)<1e-9&&l.pop()}l.length>=3&&a.push(l)}return a}};function jt(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,u=Math.cos(l),f=Math.sin(l);return e.map(m=>{let h=m.x-a,d=m.y-c;return{x:a+h*u-d*f,y:c+h*f+d*u}})}function Ss(e){let t=qr(e);return!t.length||!e.points?.length?[]:t.map(n=>jt(n,e.rotation,e.points))}function ce(e){let t=null;if(e.kind==="polygon"&&e.points&&e.points.length>=3)return jt(An(e,4),e.rotation,e.points);if(e.kind==="rect"&&e.width&&e.height&&(t=sn(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=Fn(n,o,e.width/2,e.height/2)}return t?jt(t,e.rotation):null}function $e(e){let t=e.role??"",o=t==="stage"?{kind:"stage",heightM:mi(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 Of=.08,Lf=30,Tf=.015;function Bf(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 Rs(e,t){let n=ce(e)??(e.points?.length?jt(e.points,e.rotation):null),o=$e(e),i=!e.role&&o.kind==="plate"&&e.heightM===void 0&&!!n&&Math.abs(je(n))*ee**2>=Lf?Tf: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 u=i,f=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&&u<=h.topOffsetM+1e-6&&(u=h.topOffsetM+Of),s>=h.minX-m&&c<=h.maxX+m&&a>=h.minY-m&&l<=h.maxY+m&&(!h.poly||n.every(b=>Bf(b,h.poly)||Nf(b,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:l,topOffsetM:u,poly:n}),{topOffsetM:u,supportOffsetM:Math.min(f,u)}}function Nf(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,u=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+u*a),e.y-(i.y+u*c))<=n)return!0}return!1}function dt(e,t,n){return{x:e.x+(t.x-e.x)*n,y:e.y+(t.y-e.y)*n}}function Ue(e){if(e.length!==4)return e;let t=Math.hypot(e[1].x-e[0].x,e[1].y-e[0].y),n=Math.hypot(e[2].x-e[1].x,e[2].y-e[1].y);return t>=n?e:[e[1],e[2],e[3],e[0]]}function Te(e,t,n){return[dt(e[0],e[1],t),dt(e[0],e[1],n),dt(e[3],e[2],n),dt(e[3],e[2],t)]}function fn(e,t,n){return[dt(e[0],e[3],t),dt(e[1],e[2],t),dt(e[1],e[2],n),dt(e[0],e[3],n)]}function he(e,t,n,o,r,i,s){$(e,t,s?.length?s:void 0,()=>n,o,r,i,W)}var Is=[.13,.14,.17],Vt=[.4,.43,.47],Ff=.18,Df=.02,Gf=2.4,Hf=1500,jf=240,Vf=.25,Uf=12,Xf=[.055,.06,.075],Kf=[.46,.33,.22],Wf=[1,.96,.84],Yf=[.98,.66,.28],zf=[.5,.31,.15],Zf=[1,.87,.64],Ae={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 $f(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,u=c.y-a.y,f=n*u-o*l;if(Math.abs(f)<1e-12)continue;let m=((a.x-t.x)*u-(a.y-t.y)*l)/f,h=((a.x-t.x)*o-(a.y-t.y)*n)/f;m>0&&h>=0&&h<1&&(i+=1,r=Math.min(r,m))}return i%2===1?r:0}function er(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>jf&&s<Vf*(r/t.length)}function Ps(e,t,n,o,r={}){let i=t.stageKind??"";if(Ze(i)||i==="round"||!o.length)return;let s=ce(t);if(!s||s.length<3)return;let a={x:s.reduce((N,K)=>N+K.x,0)/s.length,y:s.reduce((N,K)=>N+K.y,0)/s.length},c=0,l=0;for(let N of o)c+=N.x,l+=N.y;let u=a.x-c/o.length,f=a.y-l/o.length,m=Math.hypot(u,f);if(m<1e-6||er(a,o))return;let h=u/m,d=f/m,p=-d,b=h,M=-1/0,g=1/0,S=1/0,_=-1/0;for(let N of s){let K=(N.x-a.x)*h+(N.y-a.y)*d,Z=(N.x-a.x)*p+(N.y-a.y)*b;M=Math.max(M,K),g=Math.min(g,K),S=Math.min(S,Z),_=Math.max(_,Z)}let I=(_-S)*w,y=(M-g)*w;if(I<3||y<1.5||I*y>Hf)return;let x=Ff/w,P=(N,K)=>({x:a.x+h*N+p*K,y:a.y+d*N+b*K}),R=(N,K,Z,te)=>[P(N,Z),P(N,te),P(K,te),P(K,Z)],v=n+Math.max(3.5,Math.min(8,I*.35)),T=n+Math.min(Gf,v-n-1),k=.2/w,C=g+Math.min(y*.25,1.5)/w,E=Df/w;$(e,R(M-2*x+E,M-x-E,S+x+k,_-x-k),void 0,()=>T,n,Is,Is,W);for(let[N,K]of[[S+x,S+x+k],[_-x-k,_-x]])$(e,R(M-2*x,M-x,N,K),void 0,()=>v+.3,n,Vt,Vt,W),$(e,R(C+k,M-2*x,N,K),void 0,()=>v+.3,v,Vt,Vt,W);$(e,R(C,C+k,S+x,_-x),void 0,()=>v+.3,v,Vt,Vt,W);let A=(N,K)=>[N.x*w,K,N.y*w],O=[-h,0,-d],F=S+x+k,L=_-x-k,B=M-2*x-Ae.drapeClear/w,D=v-n,j=r.night===!1?Ae.washByDay:1,G=(N,K)=>fe(Xf,Kf,j*(1-N*N)*Math.pow(1-K,1.6)),V=(N,K,Z=0)=>A(P(B-Z/w,(F+L)/2+N*(L-F)/2),n+D*K);e.setMaterial(Uf);let U=8,z=5;for(let N=0;N<U;N++)for(let K=0;K<z;K++){let Z=N/U*2-1,te=(N+1)/U*2-1,re=K/z,ue=(K+1)/z;e.tri(V(Z,re),V(te,re),V(te,ue),O,G(Z,re),G(te,re),G(te,ue)),e.tri(V(Z,re),V(te,ue),V(Z,ue),O,G(Z,re),G(te,ue),G(Z,ue))}let X=Math.max(Ae.lampsMin,Math.min(Ae.lampsMax,Math.round(I/Ae.lampEvery))),Q=Math.max(Ae.lampRadius[0],Math.min(Ae.lampRadius[1],I*.012)),q=(L-F)*w,oe=1-Ae.lampDrop/D,se=(N,K,Z,te,re)=>{let ae=K/q*2,Le=K/D;for(let J=0;J<10;J++){let Me=2*Math.PI*J/10,at=2*Math.PI*(J+1)/10,xt=[Math.cos(Me)*ae,Math.sin(Me)*Le],Xe=[Math.cos(at)*ae,Math.sin(at)*Le];e.tri(V(N,oe,Z),V(N+xt[0],oe+xt[1],Z),V(N+Xe[0],oe+Xe[1],Z),O,te,re(xt[0],xt[1]),re(Xe[0],Xe[1]))}};for(let N=0;N<X;N++){let K=(N+.5)/X*2-1;se(K,Q*3,Ae.glowClear,fe(G(K,oe),zf,.85),(Z,te)=>G(K+Z,oe+te)),se(K,Q,Ae.coreClear,Wf,()=>Yf)}if(e.setMaterial(0),!r.night||!r.deck)return;let le=r.deck,de=P((g+M-2*x)/2,(S+_)/2),pe=n+Ae.poolLift,_e=[0,1,0],Oe=[{r:.4,k:.72},{r:.72,k:.28},{r:1,k:0}],Ge=28,He=[];for(let N=0;N<Ge;N++){let K=2*Math.PI*N/Ge,Z=Math.cos(K)*(M-2*x-g)*Ae.poolShare,te=Math.sin(K)*(_-S)*Ae.poolShare,re=Math.hypot(Z,te),ue=(h*Z+p*te)/re,ae=(d*Z+b*te)/re;He.push(Math.min(re,$f(s,de,ue,ae)*Ae.poolEdge))}if(He.some(N=>!(N>0)))return;let ve=(N,K)=>{let Z=2*Math.PI*(N%Ge)/Ge,te=Math.cos(Z)*(M-2*x-g)*Ae.poolShare,re=Math.sin(Z)*(_-S)*Ae.poolShare,ue=Math.hypot(te,re),ae=He[N%Ge]*K/ue;return A({x:de.x+(h*te+p*re)*ae,y:de.y+(d*te+b*re)*ae},pe)},H=N=>fe(le,Zf,Ae.poolStrength*N);for(let N=0;N<Ge;N++){e.tri(A(de,pe),ve(N,Oe[0].r),ve(N+1,Oe[0].r),_e,H(1),H(Oe[0].k),H(Oe[0].k));for(let K=0;K+1<Oe.length;K++){let Z=Oe[K],te=Oe[K+1];e.tri(ve(N,Z.r),ve(N,te.r),ve(N+1,te.r),_e,H(Z.k),H(te.k),H(te.k)),e.tri(ve(N,Z.r),ve(N+1,te.r),ve(N+1,Z.r),_e,H(Z.k),H(te.k),H(Z.k))}}}function _s(e,t){let n={openField:!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(St(i)){n.openField=!0;continue}if(Ze(i)){n.court=!0,fi(i)&&(n.indoorCourt=!0);continue}if(r.role!=="stage")continue;if(n.stage=!0,i==="round"){n.inTheRound=!0;continue}let s=ce(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};er(a,t)&&(n.inTheRound=!0)}return n}var vs=10,At=11,Ut=[.93,.94,.95],Qf=[.93,.8,.22],qf=[.82,.14,.16],Jf=[.78,.1,.12],tr=[.74,.77,.8],nr={width:7.32,height:2.44,depth:2},Wn={width:1.83,height:1.22,depth:1,fromEndBoards:3.35},em=1.5,tm=1.8,or=2.4,Be=(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]],ut=e=>{let t=Math.hypot(e[0],e[1],e[2])||1;return[e[0]/t,e[1]/t,e[2]/t]};function ze(e,t,n,o,r){let i=ut(Be(n,t)),s=ut(hn(i,Math.abs(i[1])<.9?[0,1,0]:[1,0,0])),a=hn(s,i),c=(l,u)=>{let f=u===0||u===3?-o:o,m=u<2?-o:o;return[l[0]+s[0]*f+a[0]*m,l[1]+s[1]*f+a[1]*m,l[2]+s[2]*f+a[2]*m]};for(let l=0;l<4;l++){let u=(l+1)%4,f=c(t,l),m=c(t,u),h=c(n,l),d=c(n,u),p=ut(hn(Be(m,f),Be(h,f))),b=Be([(f[0]+m[0])/2,(f[1]+m[1])/2,(f[2]+m[2])/2],t);p[0]*b[0]+p[1]*b[1]+p[2]*b[2]<0&&(p=[-p[0],-p[1],-p[2]]);let M=Y(r,.86+.14*Math.max(0,p[1]));e.tri(f,m,d,p,M),e.tri(f,d,h,p,M)}}function mn(e,t,n,o,r){let i=Math.hypot(...Be(n,t)),s=Math.hypot(...Be(r,t)),a=ut(hn(Be(n,t),Be(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 ir(e,t,n,o,r,i,s,a,c){let l=(g,S)=>[g[0],g[1]+S,g[2]],u=g=>[g[0]+o[0]*i,g[1],g[2]+o[2]*i],f=l(t,r),m=l(n,r),h=u(t),d=u(n),p=u(f),b=u(m);e.setMaterial(c),ze(e,t,f,s,a),ze(e,n,m,s,a),ze(e,f,m,s,a),e.setMaterial(At);let M=Math.min(s,.03);for(let[g,S]of[[h,p],[d,b],[f,p],[m,b],[p,b],[t,h],[n,d],[h,d]])ze(e,g,S,M,Y(a,.92));e.setMaterial(vs),mn(e,h,d,b,p),mn(e,f,m,b,p),mn(e,t,h,p,f),mn(e,n,d,b,m),e.setMaterial(0)}var rr={height:.711,width:.2286,pitchLength:20.12},nm=[.88,.8,.6];function ks(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))*w/rr.pitchLength;if(i>.2){e.setMaterial(At);for(let s of[r,r+2]){let a=t[s%4],c=t[(s+1)%4],l=o(s%4)||1,u={x:(a.x+c.x)/2,y:(a.y+c.y)/2},f=(c.x-a.x)/l,m=(c.y-a.y)/l;for(let h of[-1,0,1]){let d=h*rr.width*i/2/w,p=ge({x:u.x+f*d,y:u.y+m*d},n);ze(e,p,[p[0],p[1]+rr.height*i,p[2]],.019*i,nm)}}e.setMaterial(0)}}var ge=(e,t)=>[e.x*w,t,e.y*w];function Os(e){if(e.length<3)return null;let t=0,n=0;for(let M of e)t+=M.x,n+=M.y;t/=e.length,n/=e.length;let o=0,r=0,i=0;for(let M of e){let g=M.x-t,S=M.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,u=-1/0,f=1/0,m=-1/0;for(let M of e){let g=(M.x-t)*a+(M.y-n)*c,S=-(M.x-t)*c+(M.y-n)*a;l=Math.min(l,g),u=Math.max(u,g),f=Math.min(f,S),m=Math.max(m,S)}let h=(u-l)*w,d=(m-f)*w;if(!(h>4)||!(d>2))return null;let p={a:(l+u)/2,b:(f+m)/2};return{at:(M,g)=>{let S=p.a+M/w,_=p.b+g/w;return{x:t+a*S-c*_,y:n+c*S+a*_}},lengthM:h,widthM:d}}function Ls(e,t,n,o,r,i){let s=t.map(c=>ge(c,n)),a=t.map(c=>ge(c,n+o));e.setMaterial(0);for(let c=0;c<t.length;c++)ze(e,s[c],a[c],r,i);e.setMaterial(At);for(let c=0;c+1<t.length;c++)ze(e,a[c],a[c+1],.025,i);e.setMaterial(vs);for(let c=0;c+1<t.length;c++)mn(e,s[c],s[c+1],a[c+1],a[c]);e.setMaterial(0)}var ws=[.66,.29,.22],om=[.87,.79,.58],Es=[.17,.36,.63],Ts=[.56,.59,.63],rm=[.7,.7,.68],im={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 Bs(e,t,n){let o=Os(t);if(!o)return;let{at:r,lengthM:i,widthM:s}=o,a=im,c=Math.min(1.2,Math.max(.5,i/a.length)),l=s/2,u=i/2-l,f=l-a.trackWidth;if(!(u>30*c)||!(f>22*c))return;let m=n+.03,h=(k,C,E=0)=>{$(e,k,void 0,()=>m+E,m+E-.004,C,C,W)},d=(k,C,E,A)=>[r(k,E),r(C,E),r(C,A),r(k,A)];e.setMaterial(0),h(d(u-.08,u+.08,-l+.2,-f-.2),Ut);let p=a.longJump,b=f-p.fromKerb*c,M=(p.start+p.runway)*c;h(d(p.start*c,M,b-p.runwayWidth*c/2,b+p.runwayWidth*c/2),ws),h(d(M,M+p.pit*c,b-p.pitWidth*c/2,b+p.pitWidth*c/2),om);let g=a.highJump,S=-(u+g.intoBend*c),_=[];for(let k=0;k<=16;k++){let C=-Math.PI/2+Math.PI*k/16;_.push(r(S-.3*c+Math.cos(C)*g.apron*c,Math.sin(C)*g.apron*c))}h(_,ws),$(e,d(S-g.matLength*c,S,-(g.matWidth*c)/2,g.matWidth*c/2),void 0,()=>n+g.matHeight*c,n,Es,Y(Es,.82),W),e.setMaterial(At);let I=[-1,1].map(k=>r(S+.25*c,k*(g.bar+.1)*c));for(let k of I)ze(e,ge(k,n),ge(k,n+(g.bar+.3)*c),.02,Ut);ze(e,ge(I[0],n+g.bar*c),ge(I[1],n+g.bar*c),.015,Ut),e.setMaterial(0);let y=a.cage,x=u+y.intoBend*c;h(((k,C)=>Array.from({length:C},(E,A)=>{let O=2*Math.PI*A/C;return r(x+Math.cos(O)*k,Math.sin(O)*k)}))(y.pad*c,16),rm);let R=y.sectorDeg/2*Math.PI/180;for(let k of[-1,1]){let C=y.sector*c,E=-Math.cos(R),A=k*Math.sin(R);h([r(x+A*.15,-E*.15),r(x+E*C+A*.15,A*C-E*.15),r(x+E*C-A*.15,A*C+E*.15),r(x-A*.15,E*.15)],Ut,.006)}let v=y.openDeg/2*Math.PI/180,T=[];for(let k=0;k<=6;k++){let C=v+(2*Math.PI-2*v)*k/6;T.push(r(x-Math.cos(C)*y.radius*c,Math.sin(C)*y.radius*c))}Ls(e,T,n,y.height*c,.05,Ts)}var sm=[.95,.8,.16],As=[.13,.17,.2],Cs=[.78,.8,.83],am={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 Ns(e,t,n,o,r,i){let s=am,a={x:s.pole.x-s.backHalf,y:s.pole.y-s.backY},c=Math.hypot(a.x,a.y),l=a.x/c,u=a.y/c,f=(S,_,I)=>t(S*(s.backHalf+l*_+u*I),s.backY+u*_-l*I),m=s.net,h=s.backY-m.inset,d=s.backHalf-m.inset,p=[f(-1,m.wing,m.inset)];for(let S of[-d,-d/2,d/2,d])p.push(t(S,h));p.push(f(1,m.wing,m.inset)),Ls(e,p,n,m.height*o,.05,Ts),e.setMaterial(0);for(let S of[-1,1]){let _=ge(t(S*(s.pole.x-.4),s.pole.y+.4),n);ze(e,_,[_[0],_[1]+s.poleHeight*o,_[2]],.09,sm)}if(!i)return;let b=s.dugout,M=b.along*c-b.length/2,g=M+b.length;for(let S of[-1,1]){let _=[f(S,M,b.inset-b.depth/2),f(S,g,b.inset-b.depth/2)],I=[f(S,M,b.inset+b.depth/2),f(S,g,b.inset+b.depth/2)],y=Math.ceil(b.length),x=!0;for(let T=0;x&&T<=y;T++){let k=T/y;x=r({x:_[0].x+(_[1].x-_[0].x)*k,y:_[0].y+(_[1].y-_[0].y)*k})}if(!x)continue;let P=[_[0],_[1],I[1],I[0]];$(e,P,void 0,()=>n+(b.height-.1)*o,n,As,Y(As,.85),W);let R=(T,k)=>({x:T.x+(T.x-k.x)*.04,y:T.y+(T.y-k.y)*.04}),v=[R(_[0],I[1]),R(_[1],I[0]),R(I[1],_[0]),R(I[0],_[1])];$(e,v,void 0,()=>n+b.height*o,n+(b.height-.14)*o,Cs,Y(Cs,.9),W)}}function Fs(e,t,n,o,r,i){let s=t.lengthM/2,a=t.widthM/2;if(i){let c=nr.width/2*o,l=nr.depth*o;for(let u of[-1,1]){let f=t.at(u*(s+l),-c),m=t.at(u*(s+l),c);if(!r(f)||!r(m))continue;let h=ge(t.at(u*s,-c),n),d=ge(t.at(u*s,c),n),p=ge(t.at(u*(s+1),0),n),b=ge(t.at(u*s,0),n);ir(e,h,d,ut(Be(p,b)),nr.height*o,l,.06,Ut,0)}}e.setMaterial(At);for(let c of[-1,1])for(let l of[-1,1]){if(!r(t.at(c*s,l*a)))continue;let u=ge(t.at(c*s,l*a),n),f=[u[0],u[1]+em*o,u[2]];ze(e,u,f,.02,Qf);let m=ut(Be(ge(t.at(c*(s+1),l*(a+1)),n),u)),h=[f[0]+m[0]*.4*o,f[1]-.14*o,f[2]+m[2]*.4*o],d=[f[0],f[1]-.28*o,f[2]];e.tri(f,h,d,ut(hn(Be(h,f),Be(d,f))),qf)}e.setMaterial(0)}function Ds(e,t,n,o,r){let i=Os(t);if(!i)return;let{at:s,lengthM:a}=i,c=Math.min(1.2,Math.max(.5,a/60)),l=a/2-Wn.fromEndBoards*c,u=Wn.width/2*c;for(let b of[-1,1]){let M=ge(s(b*l,-u),n),g=ge(s(b*l,u),n),S=ge(s(b*(l+1),0),n),_=ge(s(b*l,0),n);ir(e,M,g,ut(Be(S,_)),Wn.height*c,Wn.depth*c,.03,Jf,At)}let f=We(t,r/2/w);if(f.length<3)return;let m=o+tm;e.setMaterial(At);let h=or;for(let b=0;b<f.length;b++){let M=f[b],g=f[(b+1)%f.length],S=Math.hypot(g.x-M.x,g.y-M.y)*w,_=0;for(;h+(S-_)>=or;){_+=or-h,h=0;let I=S>0?_/S:0,y={x:M.x+(g.x-M.x)*I,y:M.y+(g.y-M.y)*I};ze(e,ge(y,o),ge(y,m),.025,tr)}h+=S-_}let d=We(t,(r/2-.03)/w),p=We(t,(r/2+.03)/w);d.length>=3&&p.length>=3&&$(e,d,[p.slice().reverse()],()=>m,m-.05,tr,Y(tr,.9),W),e.setMaterial(0)}function Gs(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,u]=a?[t[0],t[1],t[3]]:[t[3],t[2],t[0]],f=Math.hypot(u.x-c.x,u.y-c.y)*w;if(!(f>.05))return;let m=ge(c,o),h=ge(l,o);ir(e,m,h,ut(Be(ge(u,o),m)),r-o,f,.06,Ut,0)}var cm=[.12,.38,.16],lm=[.72,.62,.45],um=[.88,.93,.96],Hs=[.95,.95,.94],fm=[.66,.29,.22],sr={length:20.12,width:3.05},mm=.14,hm=9.76,Qe=[.93,.94,.95],Yn=[.1,.11,.13],dm=[.45,.85,1.25],pm=1.45,js=.012,Vs=.004,Us=1.07,zn=.15,Xs=[.93,.76,.18],ar={height:.2,proud:.02,buried:.03};function Ct(e,t,n,o,r,i){e.setMaterial(i),$(e,t,n?[n.slice().reverse()]:void 0,()=>o,o-.004,r,r,W)}var Xt=(e,t)=>We(e,t/w);function Ws(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 bm(e,t,n,o){let r=t.map(i=>[i.x*w,n,i.y*w]);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 Kt(e,t,n,o,r,i){let s=n/w,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}];$(e,a,void 0,()=>r,o,i,Y(i,.85),W)}function Ne(e,t,n,o,r,i,s){let a=Ws(t,n,o/w);a&&$(e,a,void 0,()=>i,r,s,Y(s,.85),W)}function yn(e){let t=Ue(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)/w,y:n.y+(i.y*c+s.y*l)/w}),lengthM:o*w,widthM:r*w}}function cr(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,u=m=>i?{x:c+(m.x-c)*s-(m.y-l)*a,y:l+(m.x-c)*a+(m.y-l)*s}:m,f=(m,h,d,p)=>u({x:c+m/d*(n-t),y:l+h/p*(r-o)});return{turn:u,shortSideM:Math.min(n-t,r-o)*w,local:f,widthU:n-t}}function ym(e){let t=ko(e).find(n=>n.closed&&!n.fill&&n.points.length===4);return t?t.points.map(cr(e).turn):null}function Ys(e,t,n){let o=ko(t);if(!o.length)return;let{turn:r,shortSideM:i}=cr(t),s=Math.max(.04,Math.min(.3,i*.004))/w,a=0;e.setMaterial(0);for(let u of o){if(!u.fill)continue;let f=u.points.map(r);Ct(e,f,null,n+js+a*Vs,me(u.fill)??Qe,0),a++}let c=o.filter(u=>!(u.fill&&u.ink===u.fill)),l=[...new Set(c.map(u=>u.ink??vn))];for(let u of l){let f=n+js+a++*Vs,m=me(u)??Qe;for(let h of c){if((h.ink??vn)!==u)continue;let d=h.points.map(r),p=h.closed?d.length:d.length-1;for(let b=0;b<p;b++){let M=Ws(d[b],d[(b+1)%d.length],s);M&&bm(e,M,f,m)}}}}function zs(e,t,n,o,r,i){if(t.length<3)return!1;let s=o+.006,a=r??cm;if(n==="oval-cricket"){let c=t.reduce((y,x)=>y+x.x,0)/t.length,l=t.reduce((y,x)=>y+x.y,0)/t.length,u=y=>t.map(x=>({x:c+(x.x-c)*y,y:l+(x.y-l)*y})),f=8;for(let y=0;y<f;y++){let x=u(1-y/f),P=y===f-1?null:u(1-(y+1)/f);Ct(e,x,P,s,Y(a,y%2?1.04:.96),4)}let m=t[0];for(let y of t)Math.hypot(y.x-c,y.y-l)>Math.hypot(m.x-c,m.y-l)&&(m=y);let h=Math.hypot(m.x-c,m.y-l)||1,d=(m.x-c)/h,p=(m.y-l)/h,b=-p,M=d,g=Math.min(1,2*h*w*mm/sr.length),S=sr.length*g/2/w,_=sr.width*g/2/w,I=(i&&ym(i))??[[-S,-_],[S,-_],[S,_],[-S,_]].map(([y,x])=>({x:c+d*y+b*x,y:l+p*y+M*x}));return Ct(e,I,null,s+.004,lm,0),ks(e,I,s+.004),e.setMaterial(0),!0}if(n==="rink-hockey"){let c=Xt(t,zn);Ct(e,c,null,s,um,0),e.setMaterial(0),$(e,t,[c.slice().reverse()],()=>o+Us,o,Hs,Y(Hs,.9),W);let l=Xt(t,zn-ar.buried),u=Xt(t,zn+ar.proud);return l.length>=3&&u.length>=3&&$(e,l,[u.slice().reverse()],()=>o+ar.height,o,Xs,Y(Xs,.92),W),Ds(e,t,s,o+Us,zn),!0}if(n==="ring-boxing"&&t.length===4){let{at:c}=yn(t),l=[c(-3.05,-3.05),c(3.05,-3.05),c(3.05,3.05),c(-3.05,3.05)],u=[[.77,.19,.19],Qe,[.17,.42,.69],Qe];e.setMaterial(0),l.forEach((f,m)=>Kt(e,f,.07,o,o+pm,u[m]));for(let f of dm)for(let m=0;m<4;m++)Ne(e,l[m],l[(m+1)%4],.025,o+f-.025,o+f+.025,Qe);return!0}if(n==="court-tennis"&&t.length===4){let{at:c}=yn(t);e.setMaterial(0),Ne(e,c(0,-6.4),c(0,6.4),.015,o,o+.95,Yn),Ne(e,c(0,-6.4),c(0,6.4),.03,o+.95,o+1,Qe);for(let l of[-1,1])Kt(e,c(0,l*6.4),.05,o,o+1.07,Yn);return!0}if(n==="court-basketball"&&t.length===4){let{at:c,lengthM:l}=yn(t),u=Math.min(14,l/2-.5);e.setMaterial(0);for(let f of[-1,1]){let m=c(f*(u+1.2),0),h=c(f*(u-1.2),0);Kt(e,m,.12,o,o+3.4,Yn),Ne(e,m,h,.06,o+3.25,o+3.4,Yn),Ne(e,c(f*(u-1.2),-.9),c(f*(u-1.2),.9),.03,o+2.9,o+3.95,Qe)}return!0}if(n==="pitch-rugby"&&t.length===4){let{at:c,lengthM:l}=yn(t),u=l*(50/120);e.setMaterial(0);for(let f of[-1,1]){for(let m of[-2.8,2.8])Kt(e,c(f*u,m),.07,o,o+12,Qe);Ne(e,c(f*u,-2.8),c(f*u,2.8),.06,o+2.94,o+3.06,Qe)}return!0}if(n==="track-athletics"){let c=Xt(t,hm);return c.length<3?!1:(Ct(e,t,c,s,fm,0),Ct(e,c,null,s,a,4),e.setMaterial(0),Bs(e,t,o),!0)}return!1}var dn=140,Ks=1.6,pn=[.9,.91,.93],Zn=[.15,.19,.3],bn=[.14,.15,.18],gm=[.1,.24,.18],$n=.9,xm=6,Mm={"pitch-football":105,"pitch-rugby":120,"court-tennis":23.77,"court-basketball":32},Sm={sidelineShare:15/19,fromSideline:1.35,tableHalfLength:4.5,tableHalfDepth:.38,tableHeight:.76,benchFrom:6,benchTo:12.5,benchHalfDepth:.25,benchHeight:.45,benchBackHeight:.85},Rm=[.13,.15,.2],Im=[.82,.84,.87];function Zs(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:R,widthU:v}=cr(t);if(!(v>0))return;let T=R(0,0,dn,dn),k=r.filter(E=>Math.hypot(E.x-T.x,E.y-T.y)<=v),C=Math.min(1.2,Math.max(.5,v*w/dn));Ns(e,(E,A)=>R(E,A,dn,dn),o,C,E=>k.every(A=>Math.hypot(A.x-E.x,A.y-E.y)*w>=Ks),!s),e.setMaterial(0);return}if(a==="oval-cricket"){let R=Xt(n,2.85),v=Xt(n,3.1);R.length>=3&&v.length>=3&&Ct(e,R,v,o+.03,Qe,0),e.setMaterial(0);return}let c=Mm[a];if(!c||n.length!==4)return;let{at:l,lengthM:u,widthM:f}=yn(n),m=Math.min(1.2,Math.max(.5,u/c)),h=u/2,d=f/2,p=Math.max(h,d)+14,b=l(0,0),M=r.filter(R=>Math.hypot(R.x-b.x,R.y-b.y)*w<p),g=R=>M.every(v=>Math.hypot(v.x-R.x,v.y-R.y)*w>=Ks),S=(R,v)=>{let T=Math.max(1,Math.ceil(Math.hypot(v.x-R.x,v.y-R.y)*w));for(let k=0;k<=T;k++)if(!g({x:R.x+(v.x-R.x)*(k/T),y:R.y+(v.y-R.y)*(k/T)}))return!1;return!0},_=(R,v,T,k,C)=>{let E=Math.hypot(v[0]-R[0],v[1]-R[1]),A=Math.max(1,Math.round(E/xm));for(let O=0;O<A;O++){let F=O/A+.012,L=(O+1)/A-.012,B=l(R[0]+(v[0]-R[0])*F,R[1]+(v[1]-R[1])*F),D=l(R[0]+(v[0]-R[0])*L,R[1]+(v[1]-R[1])*L);S(B,D)&&Ne(e,B,D,.06,o,o+C,k&&O%2?k:T)}};if(a==="court-basketball"){let R=Sm;for(let v of[-1,1]){let T=v*(d*R.sidelineShare+R.fromSideline*m),k=T+v*R.tableHalfDepth*m,C=(F,L)=>S(l(F,T),l(L,T))&&S(l(F,k),l(L,k)),E=R.tableHalfLength*m;if(!C(-E,E))continue;let A=l(-E,T),O=l(E,T);Ne(e,A,O,R.tableHalfDepth*m,o,o+R.tableHeight-.04,Rm),Ne(e,A,O,R.tableHalfDepth*m+.04,o+R.tableHeight-.06,o+R.tableHeight,Im);for(let F of[-1,1]){let L=F*R.benchFrom*m,B=F*R.benchTo*m;if(!C(L,B))continue;Ne(e,l(L,T),l(B,T),R.benchHalfDepth,o,o+R.benchHeight,bn);let D=T+v*(R.benchHalfDepth+.04);Ne(e,l(L,D),l(B,D),.03,o,o+R.benchBackHeight,bn)}break}return}if(a==="court-tennis"){let R=h+6.4*m,v=d+3.66*m;for(let k of[-1,1])_([k*R,-v],[k*R,v],gm,null,1);let T=l(0,d+1.2*m);g(T)&&(Kt(e,T,.3,o,o+1.5,bn),Kt(e,T,.36,o+1.5,o+1.62,Qe));return}Fs(e,{at:l,lengthM:u,widthM:f},o,m,g,a==="pitch-football"&&!i);let I=d+3.2*m,y=h+4*m,x=3*m,P=15*m;_([-h+x,I],[h-x,I],pn,Zn,$n),_([-h+x,-I],[-P,-I],pn,Zn,$n),_([P,-I],[h-x,-I],pn,Zn,$n);for(let R of[-1,1])_([R*y,-d+x],[R*y,d-x],pn,Zn,$n);for(let R of s?[]:[-1,1]){let v=R*2.5*m,T=R*10.5*m,k=-(d+4.4*m),C=l(v,k),E=l(T,k);!S(C,E)||!S(l(v,k-.75*m),l(T,k-.75*m))||(Ne(e,C,E,.35,o,o+.45,bn),Ne(e,l(v,k-.75*m),l(T,k-.75*m),.05,o,o+1.9,bn),Ne(e,l(v,k-.2*m),l(T,k-.2*m),.62,o+1.9,o+1.98,pn))}}var pt=72,Pm=1.2,_m=5,wm=30,Em=4;function Am(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,u=n*l-o*c;if(Math.abs(u)<1e-12)continue;let f=((s.x-t.x)*l-(s.y-t.y)*c)/u,m=((s.x-t.x)*o-(s.y-t.y)*n)/u;f>r&&m>=-1e-9&&m<=1+1e-9&&(r=f)}return r}function Cm(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/pt,r=new Float64Array(pt);for(let a=0;a<pt;a++)if(r[a]=Am(e,n,Math.cos(a*o),Math.sin(a*o)),!(r[a]>0))return null;let i=new Float64Array(pt).fill(1/0);for(let a of t){let c=a.x-n.x,l=a.y-n.y,u=Math.hypot(c,l),f=(Math.round(Math.atan2(l,c)/o)%pt+pt)%pt;u>r[f]&&u<i[f]&&(i[f]=u)}let s=[];for(let a=0;a<pt;a++){let l=Number.isFinite(i[a])&&i[a]-r[a]<=wm/w?i[a]+Pm/w:r[a]+_m/w;s.push({x:n.x+Math.cos(a*o)*l,y:n.y+Math.sin(a*o)*l})}return s}function vm(e){return fe(Y(e,.84),[.33,.36,.31],.22)}function $s(e,t,n,o,r){let i=Cm(t,o);if(!i)return;let s=n-.015;e.setMaterial(Em);let a=vm(r);$(e,i,void 0,()=>s,s-.004,a,a,W),e.setMaterial(0)}function Qs(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 km(e,t){let n=Qs(e),o=Qs(t);return Ce(t,n.x,n.y)||Ce(e,o.x,o.y)}function Qn(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=ce(s);!a||a.length<3||(o.some(c=>km(a,c))?t.add(s):i.push(a))}o.push(...i)}return t}var qn=["#e69f00","#56b4e9","#009e73","#f0e442","#0072b2","#d55e00","#cc79a7"],qs="#a4508b";var W0={facilities:qs,"food-drink":qn[5],navigation:qn[2],accessibility:qn[4]};var Y0={minDiameterPx:12,glyphScale:.66,ringRatio:1/14,largeFromPx:24};var xe=e=>{let t=Math.round(e*100)/100;return Object.is(t,-0)?"0":String(t)},Zt=e=>`${xe(e[0])} ${xe(e[1])}`,zt=(e,t,n,o)=>[e+n*Math.cos(o*Math.PI/180),t+n*Math.sin(o*Math.PI/180)];function fa(e){let t=`M${Zt(e.from)}`;for(let n of e.segs)t+=n.arc?`A${xe(n.arc.r)} ${xe(n.arc.r)} 0 ${n.arc.large} ${n.arc.sweep} ${Zt(n.to)}`:`L${Zt(n.to)}`;return`${t}Z`}function Se(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 Re(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 ne(e,t,n,o,r){let i=Math.min(r,n/2,o/2),s={r:i,large:0,sweep:1};return i<=0?Pe([[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 Pe(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 ye(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 Re(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 Ie(e,t,n=!1){let o=[],r=n?e.length:e.length-1;for(let i=0;i<r;i++)o.push(ye(e[i],e[(i+1)%e.length],t));return o}function qe(e,t,n,o,r,i){let s=i/2,a=r-o>180?1:0,c={r:s,large:0,sweep:1},l=zt(e,t,n+s,o);return{from:l,segs:[{to:zt(e,t,n+s,r),arc:{r:n+s,large:a,sweep:1}},{to:zt(e,t,n-s,r),arc:c},{to:zt(e,t,n-s,o),arc:{r:n-s,large:a,sweep:0}},{to:l,arc:c}]}}var ie=(...e)=>e.flat().map(fa).join(" "),Fe=(e,t,n)=>`M${xe(e-n)} ${xe(t)}a${xe(n)} ${xe(n)} 0 1 0 ${xe(2*n)} 0a${xe(n)} ${xe(n)} 0 1 0 ${xe(-2*n)} 0`,it=(e,t,n,o,r)=>fa(ne(e,t,n,o,r)),eo=e=>`M${e.map(Zt).join("L")}`,Jn=(e,t,n,o,r)=>`M${Zt(zt(e,t,n,o))}A${xe(n)} ${xe(n)} 0 ${r-o>180?1:0} 1 ${Zt(zt(e,t,n,r))}`;function Wt(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 gn(e){return[Fe(e.head[0],e.head[1],e.head[2]),...e.limbs.map(eo),...(e.arcs??[]).map(([t,n,o,r,i])=>Jn(t,n,o,r,i))].join(" ")}function Yt(e,t=2.6){return[Re(e.head[0],e.head[1],e.head[2]+1),...e.limbs.flatMap(n=>Ie(n,t)),...(e.arcs??[]).map(([n,o,r,i,s])=>qe(n,o,r,i,s,t-.2))]}var vt={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]]},Js={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]]]},ea={cx:12,hr:1.9,arm:5,leg:3,r:2},ta={cx:12,hr:1.9,sh:2.2,hem:6,leg:3},na={cx:6.2,hr:1.8,arm:3.6,leg:2.2,r:1.4},oa={cx:17.8,hr:1.8,sh:1.4,hem:4.1,leg:2.2};function ra({cx:e,hr:t,arm:n,leg:o,r}){return[Fe(e,2+t,t),`M${xe(e-n+r)} 8.5H${xe(e+n-r)}a${r} ${r} 0 0 1 ${r} ${r}V15H${xe(e+o)}V22H${xe(e-o)}V15H${xe(e-n)}V${xe(8.5+r)}a${r} ${r} 0 0 1 ${r} ${-r}Z`,`M${xe(e)} 15V22`].join(" ")}function ia({cx:e,hr:t,arm:n,leg:o,r}){return[Re(e,2+t,t+1),ne(e-n-.5,7.8,2*n+1,7.7,r+.5),ne(e-o-.5,13,o,9.5,1),ne(e+.5,13,o,9.5,1)]}function sa({cx:e,hr:t,sh:n,hem:o,leg:r}){return[Fe(e,2+t,t),eo([[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${xe(e)} 16V22`].join(" ")}function aa({cx:e,hr:t,sh:n,hem:o,leg:r}){return[Re(e,2+t,t+1),Pe([[e-n-.6,7.8],[e+n+.6,7.8],[e+o+.9,16.8],[e-o-.9,16.8]]),ne(e-r-.1,15,r-.4,7.5,.9),ne(e+.5,15,r-.4,7.5,.9)]}var Om=[[14.6,1.5],[5.2,13.6],[11,13.6],[9.4,22.5],[18.8,10.4],[13,10.4]],Lm="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",Tm="M12 2.5S5 9.5 5 14.5a7 7 0 0 0 14 0c0-5-7-12-7-12Z",Bm="M2.5 21.5h19V3h-6v6.2H9.2v6.2H2.5Z",ca=[[9,3],[15,3],[15,9],[21,9],[21,15],[15,15],[15,21],[9,21],[9,15],[3,15],[3,9],[9,9]],Nm={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}}]},Fm={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 la(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 ua={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]]]},Dm=[[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]],Gm=[[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]],lr=[{key:"restroom-men",label:"Men's restroom",group:"facilities",path:ra(ea),solid:ie(ia(ea))},{key:"restroom-women",label:"Women's restroom",group:"facilities",path:sa(ta),solid:ie(aa(ta))},{key:"restroom-accessible",label:"Accessible restroom",group:"facilities",path:[it(2.5,2.5,19,19,3.5),gn(Wt(vt,4.6,4.3,.66))].join(" "),solid:ie(Yt(vt)),solidLarge:ie(ne(1.5,1.5,21,21,4.5),Se(ne(3.9,3.9,16.2,16.2,2.6)),Yt(Wt(vt,4.9,4.7,.62),2.2))},{key:"first-aid",label:"First aid",group:"facilities",path:eo(ca)+"Z",solid:ie(Pe(ca.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:ie(qe(12,6.2,2.2,180,450,2.3),ye([12,8.4],[12,10.5],2.3),Ie([[12,10.2],[3.2,18.8],[20.8,18.8]],2.8,!0))},{key:"atm",label:"ATM / cash",group:"facilities",path:[it(2,6,20,12,2),Fe(12,12,2.75),"M6 12h.01 M18 12h.01"].join(" "),solid:ie(ne(1.5,5.5,21,13,2.4),Se(Re(12,12,3.2)))},{key:"info",label:"Info point",group:"facilities",path:[Fe(12,12,9.5),"M10.8 11H12v5.8 M12 7.6h.01"].join(" "),solid:ie(Re(12,4.9,2.4),ne(10.3,9.2,3.4,12.3,1),ne(8.2,9.2,4,3,1),ne(8.2,18.5,7.6,3,1))},{key:"lost-found",label:"Lost & found",group:"facilities",path:[Fe(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:ie(qe(12,7.6,4.2,180,405,3.4),Ie([[14.97,10.57],[12,13],[12,15]],3.4),Re(12,20,2.1))},{key:"restrooms",label:"Toilets",group:"facilities",path:[ra(na),sa(oa)].join(" "),solid:ie(ia(na),aa(oa))},{key:"charging",label:"Charging point",group:"facilities",path:[it(6,2,12,20,2.5),"M13.2 6.2 9.6 12h4.8l-3.6 5.8"].join(" "),solid:ie(Pe(Om))},{key:"smoking",label:"Smoking area",group:"facilities",path:[it(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:ie(ne(1.5,14,4.2,5,1.2),ne(6.8,14,10.4,5,1.2),Ie([[15.9,11.4],[17.3,8.9],[15.9,6.4],[17.1,3.9]],2.2),Ie([[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:[Fe(12,12,9.5),"M5.3 5.3l13.4 13.4","M5.5 10.5h13v3h-13Z"].join(" "),solid:ie(Re(12,12,10.6),Se(Re(12,12,8)),ye([6,6],[18,18],2.8),ne(5,10.4,3,3.2,.6),ne(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:ie(Ie([[4.9,2.6],[4.9,8]],2.2),Ie([[10.1,2.6],[10.1,8]],2.2),Ie([[7.5,2.6],[7.5,8]],2.2),qe(7.5,8,2.6,0,180,2.2),ye([7.5,10],[7.5,21.4],3),Pe([[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]]),ye([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:ie(Pe([[2.8,3],[21.2,3],[12,13.6]]),ye([12,12],[12,20.6],2.8),ye([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:ie({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]}]},qe(17.2,13.25,2.5,270,450,2.4),ye([7.8,2.6],[7.8,5.6],2.4),ye([12.2,2.6],[12.2,5.6],2.4),ye([2.6,21.6],[17.4,21.6],2.6))},{key:"water",label:"Water / drinks",group:"food-drink",path:Tm,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:Lm,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:[it(2,3.5,20,13.5,2),"M12 17v3.5 M8 20.5h8","M10 7.8v5.9l5-2.95Z"].join(" "),solid:ie(ne(1.5,3,21,14.4,2.4),Se(Pe([[9.6,6.7],[16,10.2],[9.6,13.7]])),ne(10.6,16.5,2.8,4,0),ye([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",Fe(6,14,2),Fe(12,8,2),Fe(18,15,2)].join(" "),solid:ie(ye([6,2.8],[6,21.2],1.8),ye([12,2.8],[12,21.2],1.8),ye([18,2.8],[18,21.2],1.8),ne(3.2,11.6,5.6,4.8,1.4),ne(9.2,5.6,5.6,4.8,1.4),ne(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:ie(Ie([[11,6.5],[11,2.6],[21,2.6],[21,21.4],[11,21.4],[11,17.5]],2.6),ye([2.8,12],[13.5,12],3.2),Pe([[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:ie(Ie([[13,6.5],[13,2.6],[3,2.6],[3,21.4],[13,21.4],[13,17.5]],2.6),ye([7.2,12],[17,12],3.2),Pe([[16.2,7.8],[21.6,12],[16.2,16.2]]))},{key:"emergency-exit",label:"Emergency exit",group:"navigation",path:[gn(Wt(Js,-2,1.4,1.15)),"M15.5 13h6 M19 10.5l2.5 2.5-2.5 2.5"].join(" "),solid:ie(Yt(Wt(Js,-2,1.4,1.15),2.7),ye([15.6,13],[19.5,13],2.8),Pe([[18.4,9.4],[22.4,13],[18.4,16.6]]))},{key:"stairs",label:"Stairs",group:"navigation",path:Bm,solid:"M1.5 22.5h21V2h-7.8v6.4H8.4v6.4H1.5Z"},{key:"elevator",label:"Elevator",group:"navigation",path:[it(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:ie(Pe([[12,1.6],[19.6,10.2],[4.4,10.2]]),Pe([[4.4,13.8],[19.6,13.8],[12,22.4]]))},{key:"parking",label:"Parking",group:"navigation",path:[it(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:gn(vt),solid:ie(Yt(vt))},{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:ie(qe(10,9,6,180,380,3),Ie([[15.64,11.05],[12.8,14.3],[11.5,17.2]],3),qe(8.2,17.2,3.3,0,150,3),qe(10,9,2.2,180,400,2.4),qe(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:ie(Nm,Se(ne(14.1,7,1.8,2.2,.9)),Se(ne(14.1,10.9,1.8,2.2,.9)),Se(ne(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:ie(Pe([[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]]),Re(11,4.3,2.3),ye([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:ie(Pe([[1.6,20.4],[22.4,20.4],[22.4,8.6]]),ye([4.2,13.4],[13.2,8.6],2.6),Pe([[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",it(3.5,11,17,6,2),"M6.5 17v2.5 M17.5 17v2.5 M7 14h.01 M17 14h.01"].join(" "),solid:ie(ne(9,1.8,6,3.4,.8),Pe([[6,11.4],[7.6,6.4],[16.4,6.4],[18,11.4]]),ne(2.8,10.6,18.4,7,2.2),Se(Re(6.8,14,1.3)),Se(Re(17.2,14,1.3)),ne(4.8,16,3.6,5.2,1.2),ne(15.6,16,3.6,5.2,1.2))},{key:"transit",label:"Bus / transit",group:"navigation",path:[it(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:ie(ne(4,2,16,17,3.2),Se(ne(6.2,5.8,11.6,5,1)),Se(Re(8,14.5,1.3)),Se(Re(16,14.5,1.3)),ne(6,17,3.4,5,1.2),ne(14.6,17,3.4,5,1.2))},{key:"bike-parking",label:"Bike parking",group:"navigation",path:[Fe(6,14.5,4),Fe(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:ie(Re(6,14.5,4.9),Se(Re(6,14.5,2.7)),Re(18,14.5,4.9),Se(Re(18,14.5,2.7)),Ie([[6,14.5],[9,7.5],[15.5,7.5],[18,14.5]],2.2),Ie([[9,7.5],[11.5,14.5],[15.5,7.5]],2.2),ye([6,14.5],[11.5,14.5],2.2),ye([7.2,5.8],[10.6,5.8],2.2),Ie([[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",Fe(10,9.6,1.5),Fe(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:ie(Ie([[9.4,2.4],[12,5],[14.6,2.4]],2.6),Ie([[9.4,21.6],[12,19],[14.6,21.6]],2.6),Ie([[2.4,9.4],[5,12],[2.4,14.6]],2.6),Ie([[21.6,9.4],[19,12],[21.6,14.6]],2.6),Re(9.7,9.3,2.2),Re(14.3,9.3,2.2),la(9.7,16,3),la(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:ie(Fm,Se(Pe([[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:[it(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:ie(ne(3,2,8.4,20,1.4),Se(ne(5,5,4.4,1.7,.8)),Se(ne(8.6,10.8,1.5,3.8,.7)),ne(12.6,2,8.4,20,1.4),Se(ne(14.6,5,4.4,1.7,.8)),Se(ne(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:ie(Pe([[9.6,6.2],[10.6,1.8],[13.4,1.8],[14.4,6.2]]),ne(7.6,5.4,8.8,2.6,1),ne(7.8,7.4,8.4,15,2.6),Se(ne(7.8,11.8,3.4,1.5,0)),Se(ne(7.8,15.4,3.4,1.5,0)))},{key:"prayer-room",label:"Prayer room",group:"facilities",path:[gn(ua),"M3 21.5h18"].join(" "),solid:ie(Yt(ua),ne(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:ie(Pe([[2.6,8.4],[7.2,8.4],[13,3.6],[13,20.4],[7.2,15.6],[2.6,15.6]]),ye([15.4,9.2],[20.8,14.8],2.8),ye([20.8,9.2],[15.4,14.8],2.8))},{key:"wifi",label:"Wi-Fi",group:"facilities",path:[Jn(12,19,11.5,218,322),Jn(12,19,7.5,218,322),Jn(12,19,3.5,218,322),"M12 19h.01"].join(" "),solid:ie(qe(12,19.2,11,218,322,2.8),qe(12,19.2,6.9,218,322,2.8),Re(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:ie(ne(6,4,12,8.5,2.2),ne(2.4,9.6,4.6,9,2.2),ne(17,9.6,4.6,9,2.2),ne(6,13.2,12,5.4,.6),ye([5,18],[5,20.6],2.4),ye([19,18],[19,20.6],2.4))},{key:"accessible-entrance",label:"Accessible entrance",group:"accessibility",path:[gn(Wt(vt,.3,5,.62)),"M12.5 3.5H20a1 1 0 0 1 1 1v15a1 1 0 0 1-1 1h-7.5"].join(" "),solid:ie(Yt(Wt(vt,.3,5,.62),2.2),Ie([[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:[eo(Dm)+"Z","M6 10.8 3.5 7.5","M10.5 10.5V6h4.5l1 2.5"].join(" "),solid:ie(Pe(Gm),ye([6.2,11],[3.2,7.2],2.4),Ie([[10.5,11],[10.5,5.6],[15.2,5.6],[16.2,8.2]],2.2))}],z0=new Map(lr.map(e=>[e.key,e]));var ma=lr;var Hm=new Map(ma.map(e=>[e.key,e]));function ur(e){return e?Hm.get(e):void 0}var Q0=ma.map(e=>e.key);function xn(e){if(e.length<3)return e.map(n=>({...n}));let t=Gt(e);return t.length>=3?t:[...e].sort((n,o)=>n.x-o.x||n.y-o.y).map(n=>({...n}))}var jm=.8,Vm=.6,Um=2;function bt(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=ce(s)??[],c=ha(a)/2;!(c>0)||Wm(a)/c*w>Um||(n.push(...a),o+=c)}if(n.length<3)return null;let r=xn(n);if(r.length<3||o<ha(r)*Vm)return null;let i=0;for(let s of t)Ym(s,r)&&(i+=1);return i>=t.length*jm?r:null}var to=6,Xm=5,Km=8;function da(e){return Math.max(Km,(Number.isFinite(e)?e:0)+Xm)}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 Wm(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 ha(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 Ym(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 pa(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,u=(S,_)=>{S<i&&(i=S),S>s&&(s=S),_<a&&(a=_),_>c&&(c=_)};for(let S=0;S<t;S++)u(e[S*3],e[S*3+2]),e[S*3+1]>l&&(l=e[S*3+1]);for(let[S,_]of o)u(S,_);if(!Number.isFinite(i)||!Number.isFinite(l))return null;let f=(i+s)/2,m=(a+c)/2,h=Math.max(4,(s-i)/2),d=Math.max(4,(c-a)/2),p=1,b=(S,_)=>{let I=Math.hypot((S-f)/h,(_-m)/d);I>p&&(p=I)};for(let S=0;S<t;S++)b(e[S*3],e[S*3+2]);for(let[S,_]of o)b(S,_);let M=Math.min(9,Math.max(5,2*Math.max(h,d)*.1)),g=Math.max(n+8,l+M);return{centre:[f,m],radii:[h*p+6,d*p+6],floorY:n,ceilingY:r===void 0?g:Math.max(r,l+5)}}function zm(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 Zm(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,u=Math.hypot(c,l);u>1e-9?(c/=u,l/=u):(c=1,l=0);let f=[...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 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 ba(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,u=c*c+l*l,f=u>1e-12?((t-s.x)*c+(n-s.y)*l)/u:0;f<0?f=0:f>1&&(f=1);let m=Math.hypot(t-(s.x+f*c),n-(s.y+f*l));m<r&&(r=m)}return r}var no=8;function $m(e,t,n){let o=new Array(no).fill(1/0),r=new Array(no).fill(-1);for(let u=0;u<e.length;u++){let f=e[u],m=Math.hypot(t-f.cx,n-f.cy)-f.radius;for(let h=0;h<no;h++)if(m<o[h]){for(let d=no-1;d>h;d--)o[d]=o[d-1],r[d]=r[d-1];o[h]=m,r[h]=u;break}}let i=new Array(3).fill(1/0),s=new Array(3).fill(-1);for(let u of r){if(u<0)continue;let f=ba(e[u],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]=u;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 u=0;u<3;u++){let f=s[u];if(f<0||i[u]>a)continue;let m=1/(i[u]*i[u]);c+=m*e[f].depth,l+=m}return l>0?c/l:e[s[0]].depth}function Qm(e){let t=(o,r)=>$m(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=ba(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 ya(e,t){let n=[];for(let o of e){let r=Zm(o.points,t);r&&n.push(r)}return n.length<2?zm(t):(n.sort((o,r)=>o.depth-r.depth),Qm(n))}var yt=.06,qm=.05,xa=.05,ga=.15,fr=25;function Ma(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=[],u=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"&&u.add(d.id),d.type!=="section"||!d.outline||d.outline.length<3)continue;let p=ot(d.outline,Ye);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:lt(p),section:d,unit:h,outline:p})}}let f=new Map;for(let m of l){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])??[]:l,p=h.sectionId?d.find(M=>M.id===h.sectionId)??d.find(M=>M.section.logicalSectionId===h.sectionId&&Ee({x:h.x,y:h.y},M.outline,M.section.holes)):void 0,b=p?[p]:d;for(let M of b){if(n&&M.floorIndex!==n[m]||!p&&(h.x<M.box.minX||h.x>M.box.maxX||h.y<M.box.minY||h.y>M.box.maxY||!Ee({x:h.x,y:h.y},M.outline,M.section.holes)))continue;r[m]=M.id;let g=c.get(M.id);g.hasSeats=!0;let S=h.focalPoint??M.unit.focal,_=Math.hypot(h.x-S.x,h.y-S.y);_<g.frontU&&(g.frontU=_),g.seatIndices.push(m);let I=h.rowId||`__seat-${m}`,y=g.rows.get(I);y?y.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=mt(h.section,{floorBaseHeightM:h.unit.baseHeightM}),p=h.unit.baseHeightM,b=d.rake>0?Math.tan(d.rake*Math.PI/180):0,M=d.rake<=.01&&d.height<=p+.001,g=h.section.surfaceKind,S=g==="flat"?!0:g==="rakedRows"&&d.rake>.01?!1:M,_=h.hasSeats?Cn(m,t,h.seatIndices,h.unit.focal):{sectionId:m,rows:[],blockCount:0},y=_.rows.length<2?ya([...h.rows.values()].map(L=>({points:L})),h.unit.focal):null,x=1/0;if(y){if(h.hasSeats)for(let L of h.rows.values())for(let B of L){let D=y.depthAt(B.x,B.y);D<x&&(x=D)}if(!h.hasSeats||!Number.isFinite(x)){x=1/0;for(let L of h.section.outline){let B=y.depthAt(L.x,L.y);B<x&&(x=B)}}}let P=p+qm,R=Math.max(P,d.height),v=L=>{let B=Math.max(0,L-x)*ee,D=Math.min(B*b,fr);return Math.max(P,d.height+D)},T=L=>{let B=Math.max(0,L)*ee,D=Math.min(B*b,fr);return Math.max(P,d.height+D)},k=S?[]:_.rows.map(L=>({pts:L.pts,y:T(L.blockDepth),depth:L.blockDepth,blockId:L.blockId,...u.has(L.id)?{patch:ls(L.pts,Ye)}:{}})),C=k.length?k[0].y:R,E=k.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 G=B.length||1;D/=G,j/=G;let V=0;for(let U of B){let z=Math.hypot(U.x-D,U.y-j);z>V&&(V=z)}return{cx:D,cy:j,rad:V}}),A=S?()=>R:k.length>=2?(L,B)=>{let D=1/0,j=C;for(let G=0;G<k.length;G++){let V=E[G];if(Math.hypot(L-V.cx,B-V.cy)-V.rad>=D)continue;let U=k[G].patch,z=U&&U.length>=3?Ce(U,L,B)?0:Tt(U,L,B):Tt(k[G].pts,L,B);z<D&&(D=z,j=k[G].y)}return j}:(L,B)=>y?v(y.depthAt(L,B)):R,O=[0,1,0],F=k.length>=2||S?()=>O:(L,B)=>{if(!y)return O;let D=y.depthAt(L,B);if(D<=x)return O;let j=(D-x)*ee;if(j*b>=fr||d.height+j*b<=P)return O;let[G,V]=y.gradientAt(L,B);if(G===0&&V===0)return O;let U=1/Math.hypot(b,1);return[-G*b*U,U,-V*b*U]};if(!S)for(let L of _.rows){let B=T(L.blockDepth);for(let D of L.seatIndices)s[D]=B}for(let L of _.rows){let B=[];for(let U=1;U<L.pts.length;U++){let z=Math.hypot(L.pts[U].x-L.pts[U-1].x,L.pts[U].y-L.pts[U-1].y);z>1e-6&&B.push(z)}B.sort((U,z)=>U-z);let D=B.length?B[Math.floor(B.length/2)]:1/0,j=1/0,G=L.pts[Math.floor(L.pts.length/2)];if(G)for(let U of _.rows){if(U===L||U.blockId!==L.blockId)continue;let z=Tt(U.pts,G.x,G.y);z>1e-6&&z<j&&(j=z)}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:k,landingY:C})}for(let m=0;m<t.length;m++){let h=r[m],d=t[m];if(h){let M=s[m];i[m]=(M??o.get(h).deckAt(d.x,d.y))+ga;continue}let p=d.eyeHeightM,b=Number.isFinite(p)?Math.max(0,p-tt):0;i[m]=d.kind==="booth"?b+yt+ga:b}return{bySection:o,seatOwner:r,seatDeckY:m=>i[m],seatPitchU:m=>a[m]}}function Qt(e,t,n){if(e.length!==4||n<=t)return null;let o=Ue(e),r=Math.hypot(o[1].x-o[0].x,o[1].y-o[0].y)*w,i=Math.hypot(o[3].x-o[0].x,o[3].y-o[0].y)*w;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:Te(o,s,1-s),openingTop:n-a}}function mr(e,t,n){if(e.length!==4||n-t<=.2)return null;let o=Ue(e),r=Math.hypot(o[1].x-o[0].x,o[1].y-o[0].y)*w;if(r<=1e-6)return null;let i=Math.min(.14,(n-t)*.08,r*.08),s=i/r,a=Te(o,s,1-s);return{quad:o,side:s,trim:i,inner:a,panel:fn(a,.15,.85),bottom:t+i,top:n-i}}function Sa(e,t,n,o){let r=mr(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),[u,f]=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;-(f.y-u.y)*m.x+(f.x-u.x)*m.y<0&&([u,f]=[f,u]);let d=Math.min(.006,h*w*.05),p=m.x/h*d,b=m.y/h*d,M=(g,S)=>[g.x*w+p,S,g.y*w+b];return[M(u,r.bottom),M(f,r.bottom),M(u,r.top),M(f,r.top)]}var Ia=et(require("polygon-clipping"),1);var Ra=et(require("polygon-clipping"),1);function ft(e,t,n,o,r,i,s,a={}){let c=lt(t),l=a.ao??W,u=r.flatMap(p=>{if(p.role!=="entrance"&&p.role!=="exit")return[];let b=ce(p);if(!b||b.length!==4||!Dt(c,lt(b)))return[];let M=a.portalBase??n,g=Qt(b,M,M+$e(p).heightM);if(!g)return[];let S=Math.min(o,g.openingTop);return S<=n?[]:[{poly:g.opening,height:S}]});if(!u.length)return!1;let f=p=>p.map(b=>[b.x,b.y]),m=[f(t),...(a.holes??[]).map(f)],h=[n,...new Set(u.map(p=>p.height)),o].sort((p,b)=>p-b),d=[];try{for(let p=1;p<h.length;p++){let b=h[p-1],M=h[p];if(M-b<1e-6)continue;let g=u.filter(_=>_.height>b+1e-6).map(_=>[f(_.poly)]),S=g.length?Ra.default.difference(m,...g):[m];d.push({low:b,high:M,polys:S})}}catch{return!1}for(let p of d)for(let b of p.polys){let[M,...g]=b.map(_=>_.map(([I,y])=>({x:I,y}))),S=_=>l.wallBottom+(l.top-l.wallBottom)*(_-n)/(o-n);$(e,M,g,()=>p.high,p.low,i,s,{...l,top:S(p.high),wallBottom:S(p.low)})}return!0}var hr={depthM:1.6,thicknessM:.35,minWallM:6};function oo(e,t,n,o,r,i,s,a,c){let l=o-n;if(l<=0)return;let u=a&&(c??l)>=hr.minWallM?Jm(t,a):null,f=u?o-hr.thicknessM:o,m=f-n,h=m<1.5?[[n,f,1]]:u?[[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=>W.wallBottom+(W.top-W.wallBottom)*(p-n)/l;for(let[p,b,M]of h){let g={...W,top:d(b),wallBottom:d(p)},S=Y(i,M),_=Y(s,M);ft(e,t,p,b,r,S,_,{portalBase:n,ao:g})||$(e,t,void 0,()=>b,p,S,_,g)}for(let[p,...b]of u??[])$(e,p,b.length?b:void 0,()=>o,f,Y(i,1.12),Y(s,.78),W)}function Jm(e,t){let n=hr.depthM/w,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=Ia.default.union(s,...a);return c.length?c.map(l=>l.map(u=>u.slice(0,-1).map(([f,m])=>({x:f,y:m})))):null}catch{return null}}function Pa(e){return e.route?.stepFree===!0&&(e.kind==="line"||e.kind==="polyline")}function _a(e){let t=Number.isFinite(e)&&e>0?e:4;return[Math.max(6,t*2.6),Math.max(4,t*1.7)]}function wa(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 u=(c.x-a.x)/l,f=(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+u*m,y:a.y+f*m},{x:a.x+u*(m+h),y:a.y+f*(m+h)}]),m+=h,i-=h,i<=1e-9&&(r=!r,i=r?t:n)}}return o}function Mn(e,t,n){let o=me(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?jt(t.points??[],t.rotation):ce(t);if(!s||s.length<2)return;let a=r*.5,c=Pa(t)?wa(s,..._a(r)):Array.from({length:i?s.length-1:s.length},(l,u)=>[s[u],s[(u+1)%s.length]]);for(let[l,u]of c){let f=Math.hypot(u.x-l.x,u.y-l.y);if(f<1e-6)continue;let m=-(u.y-l.y)/f*a,h=(u.x-l.x)/f*a,d=[(l.x+m)*w,n,(l.y+h)*w],p=[(u.x+m)*w,n,(u.y+h)*w],b=[(u.x-m)*w,n,(u.y-h)*w],M=[(l.x-m)*w,n,(l.y-h)*w];e.tri(d,p,b,[0,1,0],o),e.tri(d,b,M,[0,1,0],o)}}function Ea(e){return e==="bar"||e==="concession"||e==="coat"||e==="restroom"}var qt=(e,t,n)=>({x:e.x+(t.x-e.x)*n,y:e.y+(t.y-e.y)*n});function ro(e,t,n,o){let[r,i,s,a]=t?e:[e[3],e[2],e[1],e[0]];return[qt(r,a,n),qt(i,s,n),qt(i,s,o),qt(r,a,o)]}function Aa(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,u=Ue(n),f=Math.hypot(u[3].x-u[0].x,u[3].y-u[0].y)*w;if(f<.4)return!1;let m=qt(u[0],u[1],.5),h=qt(u[3],u[2],.5),d=Math.hypot(m.x-a.x,m.y-a.y)<=Math.hypot(h.x-a.x,h.y-a.y),p=fe(s,[.92,.9,.86],.35),b=Y(i,.72),M=r-o;if(t==="restroom"){let P=Math.min(.18,M*.08);return he(e,u,r-P,o,s,i),he(e,u,r,r-P,p,p),!0}let g=o+Math.min(1.1,M),S=t==="coat"?1:Math.min(.5,.75/f),_=ro(u,d,0,S);if(he(e,_,g-.05,o,b,i),he(e,_,g,g-.05,p,p),t==="coat"||f<1.2)return!0;if(t==="bar"){let P=ro(u,d,Math.max(S+.2,1-.45/f),1),R=l(o+Math.max(Math.min(2.2,M*2),g-o+.6));return he(e,P,R,o,s,b),!0}let I=ro(u,d,Math.max(S+.25,.55),1),y=l(o+Math.max(2.6,g-o+1.4));if(y-.14<=g)return!0;he(e,I,y-.14,o,s,i),he(e,u,y,y-.14,p,b);let x=Math.min(.08,.1/Math.max(.1,Math.hypot(u[1].x-u[0].x,u[1].y-u[0].y)*w));for(let[P,R]of[[0,x],[1-x,1]])he(e,ro(Te(u,P,R),d,0,Math.min(.08,.1/f)),y-.14,g,b,b);return!0}var ao=[.19,.4,.15],eh=.012,lo=2.4,th=1,nh=.75,oh=.15;function Je(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(([u,f])=>({x:t.x+u*s-f*a,y:t.y+u*a+f*s}))}function Ta(e,t,n,o,r,i,s=!1){let a=Je(t);if(a){if(s){let c=Et(o,r.boothTop),l=nt([...a]);$(e,ot(l,rh/w),[l.slice().reverse()],()=>n+.03,n,c,Y(c,.8),W);return}if(!(!t.points&&i&&sh(e,a,n,o,i))){if(!t.points&&i&&a.length===4){ih(e,a,n,o,i);return}$(e,a,void 0,()=>n+lo,n,Et(o,r.boothTop),r.boothWall,W)}}}var dr=1.1,Ca=[.9,.9,.88],rh=.1,io=[.87,.87,.85],va=.08;function Ba(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),u=Math.hypot(l.x-t.x,l.y-t.y);u<r&&(r=u,o=c)}let i=[0,1,2,3].map(c=>e[(o+c)%4]),s=(c,l,u)=>({x:c.x+(l.x-c.x)*u,y:c.y+(l.y-c.y)*u});return{q:i,part:(c,l,u,f)=>{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,u),s(h,p,u),s(h,p,f),s(m,d,f)]},depthM:Math.hypot(i[3].x-i[0].x,i[3].y-i[0].y)*w,widthM:Math.hypot(i[1].x-i[0].x,i[1].y-i[0].y)*w}}function ih(e,t,n,o,r){let{q:i,part:s}=Ba(t,r),a=o??[.35,.42,.55],c=fe(a,[.78,.78,.77],.62),l=fe(a,[.95,.95,.94],.45);he(e,i,n+yt,n,c,Y(c,.8)),he(e,s(.05,.95,.72,.98),n+dr-.05,n+yt,l,Y(l,.8)),he(e,s(.03,.97,.7,1),n+dr,n+dr-.05,Ca,Y(Ca,.9))}function sh(e,t,n,o,r){if(t.length!==4)return!1;let{q:i,part:s,depthM:a,widthM:c}=Ba(t,r);if(a<1||c<1)return!1;let l=o??[.35,.42,.55],u=fe(l,[.78,.78,.77],.62),f=n+lo,m=va/c,h=va/a;he(e,i,n+yt,n,u,Y(u,.8)),he(e,s(0,1,1-h,1),f,n+yt,io,Y(io,.9));for(let[b,M]of[[0,m],[1-m,1]])he(e,s(b,M,0,1-h),f,n+yt,io,Y(io,.9));he(e,s(m,1-m,0,Math.min(.5,.06/a)),f,f-.3,l,Y(l,.85));let d=Math.min(.4,.6/c),p=Math.min(.12,.3/a);return he(e,s(.5-d,.5+d,.72-p,.72+p),n+th,n+yt,fe(l,[.95,.95,.94],.7),Y(l,.75)),!0}function uo(e){if(e.shape==="round"){let u=e.radius;return u?Fn(e.center.x,e.center.y,u,u,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(([u,f])=>({x:r.x+u*s-f*a,y:r.y+u*a+f*s}))}function Na(e,t,n,o,r,i=!0){let s=uo(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})),u=wt(r)?1:lh,f=i&&o?Et(o,r.tableTop):Y(ah,u),m=Y(ch,u),h=n+nh;$(e,s,void 0,()=>h,n+uh,f,Y(f,.86),W),$(e,l(.12),void 0,()=>h+.12,h,m,Y(m,.8),W)}var ah=[.93,.92,.89],ch=[.78,.66,.42],lh=.62,uh=.25,Sn={armM:1.1,widthM:.28,insideM:1.4,low:.043,high:.048};function fh(e,t,n){let o=e.reduce((M,g)=>M+g.x,0)/4,r=e.reduce((M,g)=>M+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,u=Sn.armM/w,f=Sn.widthM/w,m=a/2+Sn.insideM/w,h=n?-1:1,d=o+i*(m+(n?0:u)),p=r+s*(m+(n?0:u)),b=(M,g)=>({x:d+i*M*h+c*g,y:p+s*M*h+l*g});return[b(0,0),b(-u,u),b(-u-f,u),b(-f,0),b(-u-f,-u),b(-u,-u)]}function mh(e,t,n,o,r){let i=[.94,.95,.96];$(e,fh(t,o,r),void 0,()=>n+Sn.high,n+Sn.low,i,i,W)}function co(e,t){let n=me(e);return n?{top:Y(rt(n,.12),.95),wall:Y(rt(n,.12),.85)}:{top:t.tierTop,wall:t.tierWall}}function Fa(e,t,n,o,r,i,s,a,c=[]){let l=ce(t),u=Ss(t);if(!t.role&&(!t.fill||t.fill==="none"||t.fill==="transparent")||!l){Mn(e,t,n+o+eh);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}:$e(t),p=a?.baseY??n,b=a?.topY??n+o,M=null;if(m&&s){let C=1/0,E=-1/0,A=1/0,O=-1/0;for(let F of l)F.x<C&&(C=F.x),F.x>E&&(E=F.x),F.y<A&&(A=F.y),F.y>O&&(O=F.y);M={cx:(C+E)/2*w,cz:(A+O)/2*w,y:b,halfX:Math.max((E-C)/2*w,.5),halfZ:Math.max((O-A)/2*w,.5)},s.push(M)}let g=me(t.fill),S=t.role==="wall"||t.role==="entrance"||t.role==="exit",_=S?co(t.fill,r).top:m&&g?fe(r.stageTop,Y(rt(g,.18),.9),.9):!t.role&&g?g:Et(g,m?r.stageTop:r.decorTop),I=h?g:null,y=S?co(t.fill,r).wall:m?g?fe(r.stageWall,Y(g,.58),.82):r.stageWall:h?I?fe(Y(I,1.42),[.24,.46,.82],.08):[.24,.46,.82]:Et(me(t.fill),r.decorWall),x=m&&wt(r)?Ft(!0):null,P=x?La(_,x.stageTop):_,R=x?La(y,x.stageWall):y;if(M&&(M.top=P),t.role==="wall"&&!a){oo(e,l,p,b,c,P,R,i),Mn(e,t,b+.012);return}if(h&&l.length===4&&b-p>.2){let C=mr(l,p,b);if(!C)return;let{quad:E,side:A,trim:O,inner:F,panel:L}=C,B=[.12,.15,.18];for(let[D,j]of[[0,A],[1-A,1]])he(e,Te(E,D,j),b,p,B,B);he(e,F,p+O,p,B,B),he(e,F,b,b-O,B,B),he(e,L,b-O,p+O,R,R),Mn(e,t,b+.012);return}let v=g?Y(rt(g,.15),.82):R,T=g?Y(rt(g,.1),1.02):P;if(Ea(t.role)&&!a&&Aa(e,t.role,l,p,b,v,T,i,t.heightM!==void 0))return;if((t.role==="sound"||a?.kind==="sound_desk")&&l.length===4&&b-p>.3){let C=Ue(l),E=Math.hypot(C[1].x-C[0].x,C[1].y-C[0].y)*w,A=Math.min(.12,.09/Math.max(E,.001)),O=[.18,.21,.24],F=b-Math.min(.12,(b-p)*.15);for(let[L,B]of[[0,A],[1-A,1]])he(e,Te(C,L,B),F,p,O,O);he(e,C,b,F,P,O);return}if(t.role==="rail"&&l.length===4&&b>p){let C=Ue(l),E=Math.hypot(C[1].x-C[0].x,C[1].y-C[0].y)*w,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));he(e,Te(C,D,D+O),b,p,F,Y(F,.8))}for(let L of[.52,1]){let B=p+(b-p)*L;he(e,C,B,Math.max(p,B-.055),F,Y(F,.8))}return}if(t.role==="goal"&&l.length===4){Gs(e,Ue(l),i,p,b),e.setMaterial(0);return}if(d.kind==="portal"&&l.length===4){let C=Qt(l,p,b);if(!C)return;let{quad:E,side:A,face:O,openingTop:F}=C;for(let[L,B,D]of[[0,O,1],[O,1-O,.67],[1-O,1,1]]){let j=fn(E,L,B),G=Y(P,D),V=Y(R,D);for(let[U,z]of[[0,A],[1-A,1]])he(e,Te(j,U,z),F,p,G,V);he(e,j,b,F,G,V)}(t.role==="entrance"||t.role==="exit")&&mh(e,E,p,i,t.role==="exit");return}if(d.kind==="suite"&&l.length===4){let C=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=C.indexOf(Math.min(...C)),A=[0,1,2,3].map(O=>l[(E+O)%4]);he(e,Te(A,0,.08),b,p,P,R),he(e,Te(A,.92,1),b,p,P,R),he(e,fn(A,.88,1),b,p,P,R),he(e,A,b,Math.max(p,b-.18),P,R);return}if(m&&!t.stageKind?.startsWith("pitch-")&&b-p>.12){let C=b-Math.min(.06,(b-p)*.15);he(e,l,C,p,P,R,u),he(e,l,b,C,P,fe(P,R,.2),u)}else he(e,l,b,p,P,R,u);if((t.stageKind==="pitch-football"||t.stageKind==="pitch-rugby")&&l.length===4){e.setMaterial(4);let C=Ue(l),E=fe(g??ao,ao,g?.45:0);for(let A=0;A<12;A++){let O=Te(C,A/12,(A+1)/12),F=Y(E,A%2?1.09:.91),L=O.map(B=>[B.x*w,b+.006,B.y*w]);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"&&zs(e,l,t.stageKind,b,g,t),m&&Ze(t.stageKind)&&Ys(e,t,b),e.setMaterial(h?1:0),Mn(e,t,b+.012)}function fo(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),u=o/2,f=r/2;return[[-u,-f],[u,-f],[u,f],[-u,f]].map(([m,h])=>({x:i+m*c-h*l,y:s+m*l+h*c}))}function hh(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 me(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=me(a[1].trim());c&&s.push(c)}return s.length?s.reduce((a,c,l)=>fe(a,c,1/(l+1)),s[0]):null}function Da(e,t,n,o){if(t.layer==="foreground")return;let r=fo(t);if(!r)return;let i=n+oh,s=Et(hh(t.href),o.decorTop),a=Math.max(0,Math.min(1,t.opacity??1));a<1&&(s=fe(o.ground,s,a)),$(e,r,void 0,()=>i,n,s,fe(s,o.decorWall,.5),W)}function Ga(e,t,n,o,r){if(!t.points||t.points.length<3)return;let i=Xi(o,r.gaTop);$(e,t.points,t.holes,()=>n+ka,n,i,r.gaWall,W),bh(e,t.points,n+ka)}var ka=.15,so=[.72,.74,.76],pr=1.1,Oa=.12,br=.05,dh=.06,ph=2.4;function bh(e,t,n){let o=nt([...t]),r=We(o,Oa/w),i=We(o,(Oa+br)/w);if(r.length<3||i.length<3)return;for(let a of[n+pr,n+pr*.5])$(e,r,[i.slice().reverse()],()=>a,a-br,so,Y(so,.85),W);let s=dh/2/w;for(let a=0;a<r.length;a++){let c=r[a],l=r[(a+1)%r.length],u=Math.hypot(l.x-c.x,l.y-c.y)*w,f=Math.max(1,Math.round(u/ph));for(let m=0;m<f;m++){let h=m/f,d=c.x+(l.x-c.x)*h,p=c.y+(l.y-c.y)*h,b=[{x:d-s,y:p-s},{x:d+s,y:p-s},{x:d+s,y:p+s},{x:d-s,y:p+s}];$(e,b,void 0,()=>n+pr-br,n,so,Y(so,.8),W)}}}function La(e,t){return Dn(e)<t?_t(e,t):e}var yr=.6,Ha=3,yh=.25;function gh(e,t){if(Ce(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,u=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+u*a),e.y-(i.y+u*c)))}return n}function ja(e,t){let n=e.map(s=>({booth:s,ring:Je(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=(Ha+yr)/w,i=new Map;return n.forEach(({booth:s,ring:a},c)=>{let l={x:a.reduce((h,d)=>h+d.x,0)/4,y:a.reduce((h,d)=>h+d.y,0)/4},u=[0,1,2,3].map(h=>{let d=a[h],p=a[(h+1)%4],b={x:(d.x+p.x)/2,y:(d.y+p.y)/2},M=b.x-l.x,g=b.y-l.y,S=Math.hypot(M,g)||1,_={x:b.x+M/S*yr/w,y:b.y+g/S*yr/w},I=Ha/w;return o.forEach((y,x)=>{x===c||_.x<y.minX-r||_.x>y.maxX+r||_.y<y.minY-r||_.y>y.maxY+r||(I=Math.min(I,gh(_,n[x].ring)))}),{open:I*w,toward:{x:b.x+M/S*10/w,y:b.y+g/S*10/w},focal:Math.hypot(b.x-t.x,b.y-t.y)}}),f=Math.max(...u.map(h=>h.open)),m=u.filter(h=>h.open>=f-yh).sort((h,d)=>h.focal-d.focal)[0];i.set(s.id,m.toward)}),i}var Va=et(require("polygon-clipping"),1);var xh=.45,Mh=1500,Sh=200;function Ua(e,t){if(e.role!=="stage"||Ze(e.stageKind))return e;let n=ce(e);if(!n||n.length<3||Math.abs(je(n))*w*w>Mh)return e;let o=t.filter(s=>Ce(n,s.x,s.y));if(!o.length||o.length>Sh)return e;let r=xh/w,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=Va.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 u=l[0].slice(0,-1).map(([m,h])=>({x:m,y:h})),f=Math.abs(je(u));f>c&&(c=f,a=u)}return!a||a.length<3?e:{...e,kind:"polygon",points:a,rotation:0}}catch{return e}}var Rh=Math.PI/180,be=96,Ih=6,Ph=60,_h=150,Xa=.2,wh=.35;function Eh(e,t){let n=Math.atan2(t.x-e.x,t.y-e.y)/Rh;return n<0?n+360:n}function mo(e){if(!e.length)return NaN;let t=[...e].sort((n,o)=>n-o);return t[Math.floor(t.length/2)]}function ho(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 Ka(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=Co(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=mo(o.map(M=>M.x)),h=mo(o.map(M=>M.y)),d=0;for(let M of n)for(let g of M.rows)for(let S of g.pts){let _=Math.hypot(S.x-a.x,S.y-a.y);_>d&&(d=_)}let p=0,b=d*.2;for(let M of n)for(let g of M.rows)for(let S of g.pts)Math.hypot(S.x-m,S.y-h)<b&&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 b=Math.hypot(p.x-c.x,p.y-c.y),M=Math.min(be-1,Math.floor(Eh(c,p)/(360/be)));h.samples.push({r:b,bin:M,levelM:d.levelM}),b<h.rMin&&(h.rMin=b),b>h.rMax&&(h.rMax=b)}h.samples.length&&l.push(h)}if(!l.length)return null;l.sort((m,h)=>m.rMin+m.rMax-(h.rMin+h.rMax));let u=[];for(let m of l){let h=!1;for(let d of u){let p=Math.min(m.rMax,d.rMax)-Math.max(m.rMin,d.rMin),b=Math.min(m.rMax-m.rMin,d.rMax-d.rMin);if(b>1e-9&&p>=wh*b){d.members.push(m),d.rMin=Math.min(d.rMin,m.rMin),d.rMax=Math.max(d.rMax,m.rMax),h=!0;break}}h||u.push({members:[m],rMin:m.rMin,rMax:m.rMax})}let f=[];for(let m of u){let h=new Array(be).fill(null);for(let C of m.members)for(let E of C.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(C=>!!C);if(!d.filter(Boolean).length)continue;let b=[],M=[];for(let C of h){if(!C)continue;let E=1/0,A=-1/0;for(let O of C.samples)O.r<E&&(E=O.r),O.r>A&&(A=O.r);b.push(E),M.push(A)}let g=mo(b),S=mo(M);if(!(g>=Xa*S)||!(S>0))continue;let _=[...b].sort((C,E)=>C-E);if(!(_[Math.floor(_.length*.1)]>=Xa*S))continue;let y=h.map(C=>{if(!C)return null;let E=[...C.samples].sort((G,V)=>G.r-V.r),A=E[0].r,O=E[E.length-1].r,F=E[0].levelM,L=-1/0;for(let G of E)G.levelM>L&&(L=G.levelM);let B=[];for(let G of E){let V={r:G.r,l:G.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],z=B[B.length-1];if((z.r-U.r)*(V.l-U.l)-(z.l-U.l)*(V.r-U.r)<=0)B.pop();else break}B.push(V)}}let D=B.map(G=>G.r),j=B.map(G=>G.l);return{inner:A,outer:O,front:F,top:L,profile:{rs:D,ls:j}}}),x=d.slice();for(let C=0;C<be;C++){if(x[C])continue;let E=-1,A=-1,O=0;for(let X=1;X<=be;X++){let Q=(C-X+be*2)%be;if(x[Q]){E=Q;break}}for(let X=1;X<=be;X++){let Q=(C+X)%be;if(x[Q]){A=Q,O=X;break}}if(E<0||A<0)continue;let F=0;for(let X=1;X<=be;X++){let Q=(C-X+be*2)%be;if(d[Q]){F=X;break}}if(F-1+O>Ih)continue;let B=y[E],D=y[A],j=F/(F+O),G=B.inner+(D.inner-B.inner)*j,V=B.outer+(D.outer-B.outer)*j,U=B.front+(D.front-B.front)*j,z=B.top+(D.top-B.top)*j;y[C]={inner:G,outer:V,front:U,top:z,profile:{rs:[G,V],ls:[U,z]}}}for(let C=0;C<be;C++)y[C]&&(x[C]=!0);let P=360/be,R=[],v=x.filter(Boolean).length,T=[];if(v===be)T.push({start:0,len:be});else{let C=0;for(;x[C];)C=(C+1)%be;let E=-1;for(let A=0;A<=be;A++){let O=(C+A)%be,F=A<be&&x[O];if(F&&E<0)E=O;else if(!F&&E>=0){let L=(O-E+be)%be||be;T.push({start:E,len:L}),E=-1}}}for(let C of T){if(C.len*P<Ph&&C.len<be)continue;let E=C.len===be,A=new Float64Array(C.len),O=new Float64Array(C.len),F=new Float64Array(C.len),L=new Float64Array(C.len),B=[];for(let X=0;X<C.len;X++){let Q=y[(C.start+X)%be];A[X]=Q.inner,O[X]=Q.outer,F[X]=Q.front,L[X]=Q.top,B.push(Q.profile??{rs:[Q.inner,Q.outer],ls:[Q.front,Q.top]})}let D=ho(A,E),j=ho(O,E),G=ho(F,E),V=ho(L,E);for(let X=0;X<C.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]<G[X]&&(V[X]=G[X]);let U={startBin:C.start,binCount:C.len,closed:E,innerR:D,outerR:j,frontLevelM:G,topLevelM:V,profiles:B},z=(X,Q,q)=>{let oe=B[X],se=oe.rs,le=oe.ls;if(Q<=se[0]){le[0]>q&&(le[0]=q);return}if(Q>=se[se.length-1]){le[le.length-1]>q&&(le[le.length-1]=q);return}for(let de=0;de+1<se.length;de++)if(Q<=se[de+1]){le[de]>q&&(le[de]=q),le[de+1]>q&&(le[de+1]=q);return}};for(let X=0;X<C.len;X++){let Q=h[(C.start+X)%be];if(Q)for(let q of Q.samples){z(X,q.r,q.levelM);let oe=E?(X-1+C.len)%C.len:X-1,se=E?(X+1)%C.len:X+1;oe>=0&&z(oe,q.r,q.levelM),se<C.len&&z(se,q.r,q.levelM)}}R.push(U)}R.reduce((C,E)=>C+E.binCount*P,0)<_h||f.push({arcs:R,sectionIds:m.members.map(C=>C.sectionId),innerRMedian:g,outerRMedian:S})}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:be,binStepDeg:360/be,rings:f}}function Wa(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=u=>{let f=t.profiles[u],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],b=p>1e-9?(o-m[d])/p:0;return h[d]+(h[d+1]-h[d])*b}return h[h.length-1]};return l(s)*(1-c)+l(a)*c}function gr(e,t,n,o,r,i,s,a,c,l=[],u=r){if(t.length!==n.length||t.length<2||i-r<1.5)return;let f=(p,b,M)=>{ft(e,p,b,M,l,s,a,{portalBase:u,ao:c})||$(e,p,void 0,()=>M,b,s,a,c)},m=(p,b,M)=>({x:p.x+(b.x-p.x)*M,y:p.y+(b.y-p.y)*M}),h=o?t.length:t.length-1,d=0;for(let p=0;p<h;p++){let b=(p+1)%t.length,M=Math.hypot(n[b].x-n[p].x,n[b].y-n[p].y)*ee;if(M<1e-5)continue;let g=(y,x)=>[m(t[p],t[b],y),m(t[p],t[b],x),m(n[p],n[b],x),m(n[p],n[b],y)];f(g(0,1),r,r+.95),f(g(0,1),i-.22,i);let S=Math.ceil((d-.32)/6)*6,_=!1,I=!1;for(let y=S;y<d+M;y+=6){let x=Math.max(0,(y-d)/M),P=Math.min(1,(y+.32-d)/M);P<=x||(f(g(x,P),r+.95,i-.22),_||=x<1e-6,I||=P>1-1e-6)}if(!o&&(p===0&&!_||p===h-1&&!I)){let y=Math.min(1,.32/M);f(g(p===0?0:1-y,p===0?y:1),r+.95,i-.22)}d+=M}}var gt=et(require("polygon-clipping"),1),In=.65;function xr(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 Mr=.01;function Ya(e,t,n,o,r,i,s,a=[],c=!0,l={bays:[],walls:[]}){if(o-r<=1e-5)return;let u=o-r>=3,f=u?o-In:r;e.setMaterial(5);let m=u?[]:a.filter(y=>{if(y.role!=="entrance"&&y.role!=="exit")return!1;let x=ce(y);if(!x)return!1;let P=Qt(x,r,r+$e(y).heightM);return P!==null&&P.openingTop<=o-.12});if((!m.length||!ft(e,t,f,o,m,i,s,{holes:n,portalBase:r}))&&$(e,t,n,()=>o,f,i,s,W,void 0,()=>[0,1,0]),!u){e.setMaterial(0);return}let h=c&&l.bays.length?Ah(t,n,We(t,Rn/w),l):null,d=6/w,p=.22/w,b=a.flatMap(y=>{if(y.role!=="entrance"&&y.role!=="exit")return[];let x=ce(y);return x?.length?[{minX:Math.min(...x.map(P=>P.x)),maxX:Math.max(...x.map(P=>P.x)),minY:Math.min(...x.map(P=>P.y)),maxY:Math.max(...x.map(P=>P.y))}]:[]}),M=Math.min(...t.map(y=>y.x)),g=Math.max(...t.map(y=>y.x)),S=Math.min(...t.map(y=>y.y)),_=Math.max(...t.map(y=>y.y));for(let y=M+d/2;y<g;y+=d)for(let x=S+d/2;x<_;x+=d){if(b.some(R=>y+p>=R.minX&&y-p<=R.maxX&&x+p>=R.minY&&x-p<=R.maxY))continue;let P=[{x:y-p,y:x-p},{x:y+p,y:x-p},{x:y+p,y:x+p},{x:y-p,y:x+p}];!Ee({x:y,y:x},t,n)||xr({x:y,y:x},[t,...n??[]])<p*Math.SQRT2+(c?Rn/w:0)||h&&xr({x:y,y:x},h.flat())<p*Math.SQRT2+Rn/w||$(e,P,void 0,()=>f,r,i,s,W)}if(h){for(let[y,...x]of h)$(e,y,x,()=>f,r-Mr,i,s,W);e.setMaterial(0);return}let I=We(t,Rn/w);if(c&&I.length>=3){let y=a.filter(R=>{if(R.role!=="entrance"&&R.role!=="exit")return!1;let v=ce(R);return!!v&&v.some(T=>!Ee(T,t,void 0)||xr(T,[t])<=Rn/w)}),x=[I.slice().reverse()],P=r-Mr;(!y.length||!ft(e,t,P,f,y,i,s,{holes:x,portalBase:r+Mr}))&&$(e,t,x,()=>f,P,i,s,W)}e.setMaterial(0)}var Sr=.25,Rn=Sr;function Ah(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 gt.default.union(a,...c)};try{let s=[r(e),...(t??[]).map(r)],a=gt.default.difference(s,[r(n)]),c=gt.default.intersection(s,i(o.bays));if(!c.length)return null;let l=gt.default.difference(gt.default.intersection(s,i(o.walls)),c);return gt.default.union(gt.default.difference(a,c),l).map(f=>f.map(m=>m.slice(0,-1).map(([h,d])=>({x:h,y:d}))))}catch{return null}}var Ch=.02,vh=.25,kh=1.2,Oh=.6,Lh=.45,Th=2.3,Bh=Math.PI/180,za=.005;function st(e,t,n){let o=n*Bh;return{x:e.x+t*Math.sin(o),y:e.y+t*Math.cos(o)}}function Nh(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 Fh=24,Dh=.01;function Gh(e,t,n,o,r,i,s,a,c){let l=n.binCount,u=Fh,f=ee,m=i+.02,h=i-Dh,d=[];for(let E=0;E<l;E++){let A=(n.startBin+E+.5)*t.binStepDeg,O=new Float64Array(u+1);for(let F=0;F<=u;F++){let L=o[E]+(r[E]-o[E])*F/u;O[F]=Math.max(m,Wa(t,n,A,L)-vh)}d.push(O)}if(c){let E=0;for(let A=0;A+1<l;A++)for(let O=0;O<u;O++){let F=st(t.centre,o[A]+(r[A]-o[A])*O/u,(n.startBin+A+.5)*t.binStepDeg),L=st(t.centre,o[A+1]+(r[A+1]-o[A+1])*(O+1)/u,(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<=u;F++){let L=st(t.centre,o[A]+(r[A]-o[A])*F/u,O),B=c(L.x,L.y,E*1.01);B!==null&&(d[A][F]=Math.min(d[A][F],Math.max(h+za,B-za)))}}}let p=[s.bandTop[0]*a.top,s.bandTop[1]*a.top,s.bandTop[2]*a.top],b=[s.bandTop[0]*a.bottomCap,s.bandTop[1]*a.bottomCap,s.bandTop[2]*a.bottomCap],M=[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/u,L=st(t.centre,F,O);return[L.x*f,d[E][A],L.y*f]};{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=u-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<=u;D++){let j=d[B][D]-d[L][D];if(Math.abs(j)>1)continue;let G=o[L]+(r[L]-o[L])*D/u,V=o[B]+(r[B]-o[B])*D/u,U=st(t.centre,G,(n.startBin+L+.5)*t.binStepDeg),z=st(t.centre,V,(n.startBin+B+.5)*t.binStepDeg),X=E*Math.hypot(z.x-U.x,z.y-U.y)*f;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 _=1,I=(E,A)=>{for(let O=0;O<=u;O+=4)if(Math.abs(d[E][O]-d[A][O])>_)return!0;return Math.abs(d[E][u]-d[A][u])>_},y=Math.tan(38*Math.PI/180),x=E=>(r[E]-o[E])/u*f,P=(E,A)=>d[E][A+1]-d[E][A]>y*Math.max(1e-6,x(E)),R=(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])>_&&(O=E),Math.abs(d[F][A]-d[E][A])>_&&(F=E);let L=Math.max(0,A-1),B=Math.min(u,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),G=S(E,L),V=S(E,B),U=j[0]-D[0],z=j[1]-D[1],X=j[2]-D[2],Q=V[0]-G[0],q=V[1]-G[1],oe=V[2]-G[2],se=z*oe-X*q,le=X*Q-U*oe,de=U*q-z*Q,pe=Math.hypot(se,le,de);return pe>1e-12?(se/=pe,le/=pe,de/=pe,le<0&&(se=-se,le=-le,de=-de),[se,le,de]):[0,1,0]},v=(E,A,O=!1)=>{let F=O&&Math.min(E[1],A[1])-i>=3,L=[E[0],F?E[1]-In:h,E[2]],B=[A[0],F?A[1]-In:h,A[2]],D=A[0]-E[0],j=A[2]-E[2],G=Math.hypot(D,j);if(!(G>1e-12))return;let V=[j/G,0,-D/G];e.tri(E,A,B,V,M,M,g),e.tri(E,B,L,V,M,g,g)},T=.05*Ke,k=E=>r[E]-o[E]<T,C=n.closed?l:l-1;for(let E=0;E<C;E++){let A=(E+1)%l;if(k(E)||k(A))continue;if(I(E,A)){let j=(n.startBin+E+1)*t.binStepDeg,G=(q,oe)=>{let se=(o[E]+o[A])/2,le=(r[E]+r[A])/2,de=se+(le-se)*oe/u,pe=st(t.centre,de,j);return[pe.x*f,d[q][oe],pe.y*f]};for(let q=0;q<u;q++){let oe=S(E,q),se=S(E,q+1),le=G(E,q),de=G(E,q+1),pe=R(E,q),_e=R(E,q+1);e.triN(oe,le,de,pe,pe,_e,p),e.triN(oe,de,se,pe,_e,_e,p);let Oe=S(A,q),Ge=S(A,q+1),He=G(A,q),ve=G(A,q+1),H=R(A,q),N=R(A,q+1);e.triN(He,Oe,Ge,H,H,N,p),e.triN(He,Ge,ve,H,N,N,p);let K=G(E,q),Z=G(E,q+1),te=G(A,q+1),re=G(A,q),ue=Z[0]-K[0],ae=Z[2]-K[2],Le=Math.hypot(ue,ae);if(Le>1e-12){let J=[ae/Le,0,-ue/Le];e.tri(K,Z,te,J,M),e.tri(K,te,re,J,M)}}let V=S(E,0),U=S(A,0),z=S(A,u),X=S(E,u),Q=q=>[q[0],h,q[2]];Math.min(V[1],U[1])-i<3&&(e.tri(Q(V),Q(z),Q(U),[0,-1,0],b),e.tri(Q(V),Q(X),Q(z),[0,-1,0],b)),v(V,U,!0),v(X,z,!0);continue}for(let j=0;j<u;j++){let G=R(E,j),V=R(A,j),U=R(A,j+1),z=R(E,j+1);if(P(E,j)||P(A,j)){let se=(Z,te)=>{let re=(n.startBin+Z+.5)*t.binStepDeg,ue=o[Z]+(r[Z]-o[Z])*(j+.5)/u,ae=st(t.centre,ue,re);return[ae.x*f,te,ae.y*f]},le=S(E,j),de=S(A,j),pe=se(E,d[E][j]),_e=se(A,d[A][j]);e.triN(le,de,_e,G,V,V,p),e.triN(le,_e,pe,G,V,G,p);let Oe=S(A,j+1),Ge=S(E,j+1),He=se(E,d[E][j+1]),ve=se(A,d[A][j+1]);e.triN(He,ve,Oe,z,U,U,p),e.triN(He,Oe,Ge,z,U,z,p);let H=_e[0]-pe[0],N=_e[2]-pe[2],K=Math.hypot(H,N);if(K>1e-12){let Z=[-N/K,0,H/K];e.tri(pe,_e,ve,Z,M),e.tri(pe,ve,He,Z,M)}continue}let X=S(E,j),Q=S(A,j),q=S(A,j+1),oe=S(E,j+1);e.triN(X,Q,q,G,V,U,p),e.triN(X,q,oe,G,U,z,p)}let O=S(E,0),F=S(A,0),L=S(A,u),B=S(E,u),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],b),e.tri(D(O),D(B),D(L),[0,-1,0],b)),v(O,F,!0),v(B,L,!0)}if(!n.closed)for(let E of[0,l-1])for(let A=0;A<u;A++)v(S(E,A),S(E,A+1))}function Za(e,t,n){let{bottomY:o,colors:r,ao:i}=n,s=new Float64Array(t.binCount).fill(-1/0);for(let u of t.rings)for(let f of u.arcs){let m=new Float64Array(f.binCount),h=new Float64Array(f.binCount);for(let p=0;p<f.binCount;p++){let b=(f.startBin+p)%t.binCount,M=Math.max(0,f.innerR[p]-Ye);m[p]=Math.max(M,s[b]+.001),h[p]=Math.max(m[p]+.001,f.outerR[p]+Ye)}let d=0;for(let p=0;p<f.binCount;p++){let b=f.topLevelM[p]-o;b>d&&(d=b)}d>=kh&&Gh(e,t,f,m,h,o,r,i,n.standTopNear);for(let p=0;p<f.binCount;p++){let b=(f.startBin+p)%t.binCount;h[p]>s[b]&&(s[b]=h[p])}}if(n.deriveShell===!1||Nh(n.shapes,t))return;let a=t.rings[t.rings.length-1],c=Oh*Ke,l=Lh*Ke;for(let u of a.arcs){let f=[],m=[];for(let R=0;R<u.binCount;R++){let v=(u.startBin+R+.5)*t.binStepDeg,T=u.outerR[R]+Ye+c;f.push(st(t.centre,T,v)),m.push(st(t.centre,T+l,v))}let h=-1/0;for(let R=0;R<u.binCount;R++)u.topLevelM[R]>h&&(h=u.topLevelM[R]);let d=h+Th,p=u.closed?m:[...m,...f.slice().reverse()],b=u.closed?[f.slice().reverse()]:void 0,M=fe(r.shellWall,[.66,.71,.72],.62),g=(R,v,T,k,C)=>{let E=Math.abs(k-h)<1e-6?k-Ch:k;ft(e,R,T,E,n.shapes,r.shellTop,C,{holes:v,portalBase:o,ao:i})||$(e,R,v,()=>E,T,r.shellTop,C,i)},S=Math.max(1,Math.ceil((h-o)/4.5)),_=(h-o)/S,I=new Set,y=n.tierFrontLevels??t.rings.map(R=>{let v=R.arcs.flatMap(T=>Array.from(T.frontLevelM)).filter(Number.isFinite).sort((T,k)=>T-k);return v[Math.floor(v.length/2)]});for(let R of y)Number.isFinite(R)&&R-o>=3&&R<h&&I.add(Math.max(0,Math.min(S-1,Math.floor((R-o)/_))));let x=Math.min(...y.filter(R=>Number.isFinite(R)&&R-o>=3&&R<h));for(let R=0;R<S;R++)o+(R+1)*_<=x-In&&Number.isFinite(x)&&I.add(R);for(let R=0;R<S;R++){let v=o+(h-o)*R/S,T=o+(h-o)*(R+1)/S;I.has(R)&&T-v>=3.2?(g(p,b,v,v+.45,M),gr(e,f,m,u.closed,v+.45,T-.16,r.shellTop,M,i,n.shapes,o)):g(p,b,v,T-.16,M),g(p,b,T-.16,T,Y(M,.62))}gr(e,f,m,u.closed,h,d,r.shellTop,M,i,n.shapes,o);let P=8;for(let R=1;R<m.length;R++){if(P+=Math.hypot(m[R].x-m[R-1].x,m[R].y-m[R-1].y)*ee,P<8)continue;P=0;let v=m[R],T=m[R-1],k=v.x-T.x,C=v.y-T.y,E=Math.max(1,Math.hypot(k,C)),A=k/E*.16*Ke,O=C/E*.16*Ke,F=Math.max(1,Math.hypot(v.x-t.centre.x,v.y-t.centre.y)),L=(v.x-t.centre.x)/F*.24*Ke,B=(v.y-t.centre.y)/F*.24*Ke,D=[{x:v.x-A,y:v.y-O},{x:v.x+A,y:v.y+O},{x:v.x+A+L,y:v.y+O+B},{x:v.x-A+L,y:v.y-O+B}];g(D,void 0,o,h,Y(M,1.12))}}}var Hh=2.5,$a=.65,jh=2,Vh=.03;function Uh(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 Pr(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<Hh||s.pts.length<2)continue;let a=s.pts.map(u=>{let f=u.x-t.x,m=u.y-t.y,h=Math.max(1,Math.hypot(f,m));return{x:u.x-f/h*$a/w,y:u.y-m/h*$a/w}}),c=[],l=[a[0]];for(let u=1;u<a.length;u++){let f=a[u-1],m=a[u];Math.hypot(m.x-f.x,m.y-f.y)*w>jh?(l.length>=2&&c.push(l),l=[m]):l.push(m)}l.length>=2&&c.push(l);for(let u of c)Uh(u,Vh/w);c.length&&r.push({blockId:i,y:s.y,runs:c})}return r}var Qa=.1,Xh=1.1,Kh=.22,Rr=.95,Ir=.05,qa=1.8;function Ja(e,t,n,o){let r=[.72,.72,.69],i=[.48,.55,.57];for(let s of Pr(t,n,o)){let a=s.y;for(let c of s.runs){let l=qa;for(let u=1;u<c.length;u++){let f=c[u-1],m=c[u],h=m.x-f.x,d=m.y-f.y,p=Math.hypot(h,d);if(p<1e-5)continue;let b=M=>{let g=-d/p*M/w/2,S=h/p*M/w/2;return[{x:f.x+g,y:f.y+S},{x:m.x+g,y:m.y+S},{x:m.x-g,y:m.y-S},{x:f.x-g,y:f.y-S}]};if($(e,b(Kh),void 0,()=>a+Qa,a-Xh,r,r,W),$(e,b(Ir),void 0,()=>a+Rr,a+Rr-Ir,i,i,W),l+=p*w,l>=qa||u===c.length-1){l=0;let M=.028/w,g=[{x:f.x-M,y:f.y-M},{x:f.x+M,y:f.y-M},{x:f.x+M,y:f.y+M},{x:f.x-M,y:f.y+M}];$(e,g,void 0,()=>a+Rr-Ir,a+Qa,i,i,W)}}}}}var Wh=.9,Yh=1.5,zh=.3;function ec(e,t,n){let o=[],r=[],i=Wh/w,s=Yh/w,a=zh/w;for(let c of e)for(let l of c.runs){if(l.length<2)continue;let u=l.slice(),f=(b,M)=>{let g=u[b],S=u[M],_=Math.hypot(g.x-S.x,g.y-S.y)||1;u[b]={x:g.x+(g.x-S.x)/_*a,y:g.y+(g.y-S.y)/_*a}};f(0,1),f(u.length-1,u.length-2);let m=u.map((b,M)=>{let g=u[Math.max(0,M-1)],S=u[Math.min(u.length-1,M+1)],_=S.x-g.x,I=S.y-g.y,y=Math.hypot(_,I)||1,x=-I/y,P=_/y;return x*(b.x-t.x)+P*(b.y-t.y)<0&&(x=-x,P=-P),{nx:x,ny:P}}),h=u.map((b,M)=>({x:b.x-m[M].nx*s,y:b.y-m[M].ny*s})),d=u.map((b,M)=>({x:b.x+m[M].nx*i,y:b.y+m[M].ny*i})),p=u.map((b,M)=>({x:b.x+m[M].nx*(i+n/w),y:b.y+m[M].ny*(i+n/w)}));o.push([...h,...d.slice().reverse()]),r.push([...d,...p.reverse()])}return{bays:o,walls:r}}var _r=.88,po=.27,Zh=1.2,$h=.01,Qh=7,qh=.05,Jh=.25;function tc(e,t,n,o,r){let i=[.67,.71,.68],s=[i[0]*_r,i[1]*_r,i[2]*_r],a=c=>!!r&&r.some((l,u)=>u!==c&&l?.belowY!=null&&Math.abs(l.belowY-t[c].y)<1e-6&&t[u].blockId===t[c].blockId);for(let c=0;c<t.length;c++){let l=t[c];if(!(l.pts.length<2))for(let u of[0,l.pts.length-1]){let f=l.pts[u],m=l.pts[u===0?1:u-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 b=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-f.x,G=O.y-f.y,V=(j*B-G*L)/D,U=(j*d-G*h)/D;V>0&&U>=0&&U<=1&&(b=Math.min(b,V))}let M=.3/w,g=b-.04/w;if(!Number.isFinite(b)||b*w>2||g-M<.12/w)continue;let S=!!o&&a(c),_=r?.[c]?.pitch,I=S&&_&&Number.isFinite(_)?Math.min(Zh/w,Math.max(po/w,_-po/w-$h/w)):po/w,y=-d,x=h;o&&y*(o.x-f.x)+x*(o.y-f.y)<0&&(y=-y,x=-x);let P=po/w,R=[{x:f.x+h*M+y*P,y:f.y+d*M+x*P},{x:f.x+h*g+y*P,y:f.y+d*g+x*P},{x:f.x+h*g-y*I,y:f.y+d*g-x*I},{x:f.x+h*M-y*I,y:f.y+d*M-x*I}];if(!R.every(A=>Ce(n,A.x,A.y)))continue;let v=r?.[c]?.belowY,T=v==null?0:l.y-v,k=!!o&&T>.03&&T<=.65;if(k&&o){let A=(O,F)=>Math.hypot((O.x+F.x)/2-o.x,(O.y+F.y)/2-o.y);A(R[0],R[1])>A(R[3],R[2])&&(R=[R[3],R[2],R[1],R[0]])}let C=k?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<C;A++){let O=A/C,F=(A+1)/C,L=[E(R[0],R[3],O),E(R[1],R[2],O),E(R[1],R[2],F),E(R[0],R[3],F)],B=l.y+.008-(k?T*(1-F):0);if($(e,L,void 0,()=>B,B-(k?T/C+.1:.16),i,s,W),!k)continue;let D=Math.hypot(L[3].x-L[0].x,L[3].y-L[0].y)*w;if(D<1e-4)continue;let j=Math.min(qh/D,Jh),G=E(L[0],L[3],j),V=E(L[1],L[2],j),U=X=>[X.x*w,B+.004,X.y*w],z=[.8,.67,.3];e.setMaterial(Qh),e.tri(U(L[0]),U(L[1]),U(V),[0,1,0],z),e.tri(U(L[0]),U(V),U(G),[0,1,0],z),e.setMaterial(0)}}}}var ed=.02,td=.012,nd=.01,od=.3,rd=.5;function id(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,u=l>1e-12?((t-i.x)*a+(n-i.y)*c)/l:0;u=Math.max(0,Math.min(1,u)),o=Math.min(o,Math.hypot(t-(i.x+u*a),n-(i.y+u*c)))}return o}function sd(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=id(e[s].pts,n,o);c<r&&(r=c,i=e[s].y)}return i}function nc(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 b of m.pts)h+=b.x,d+=b.y;h/=m.pts.length,d/=m.pts.length;let p=0;for(let b of m.pts)p=Math.max(p,Math.hypot(b.x-h,b.y-d));return{cx:h,cy:d,rad:p}}),l=[...t],u=n.map(m=>[...m]),f=ed/w;for(let m of[l,...u])for(let h=0;h<m.length;h++){let d=m[h],p=m[(h+1)%m.length],b=p.x-d.x,M=p.y-d.y,g=Math.hypot(b,M);if(g*w<.05)continue;let S=(d.x+p.x)/2,_=(d.y+p.y)/2,I=M/g,y=-b/g;Ee({x:S+I*f,y:_+y*f},l,u)&&(I=-I,y=-y);let x=r.x-S,P=r.y-_,R=Math.hypot(x,P)||1;if((I*x+y*P)/R>rd)continue;let v=1/0;for(let L of[.2,.5,.8]){let B=sd(a,c,d.x+b*L-I*f*2,d.y+M*L-y*f*2);Number.isFinite(B)&&(v=Math.min(v,B))}if(!Number.isFinite(v)||v-i<od)continue;let T=i-nd,k=v-td,C={x:(d.x-I*f)*w,z:(d.y-y*f)*w},E={x:(p.x-I*f)*w,z:(p.y-y*f)*w},A=[I,0,y],O=Y(s,W.wallBottom),F=Y(s,W.top);e.tri([C.x,k,C.z],[E.x,k,E.z],[E.x,T,E.z],A,F,F,O),e.tri([C.x,k,C.z],[E.x,T,E.z],[C.x,T,C.z],A,F,O,O)}}function oc(e,t,n,o,r,i,s,a,c=!1){if(!t.outline||t.outline.length<3)return;let l=n.baseHeightM,u=n.objects.filter(g=>g.type==="shape"&&(g.role==="entrance"||g.role==="exit")),f=Ki(o,a.tierTop);if(!r)return;let m=g=>r.deckAt(g.x,g.y),h=gs(t,s),d=h[0]??t.outline;if(r.rowLevels.length>=2){let g=Xn(r.rowLevels),S=xs(hs(r.rowLevels,n.focal,g),h),_=ec(Pr(r.rowLevels,n.focal,l),n.focal,Sr);for(let y of S){let x=Math.max(l,y.topY-rc);for(let P of i.subtract(y.outline,x))Ya(e,P,y.holes,x,l,a.tierTop,a.tierWall,u,!c,_);e.setMaterial(5),nc(e,y.outline,y.holes,r.rowLevels,n.focal,x,a.tierWall),e.setMaterial(0)}S.length||$(e,d,t.holes,()=>r.landingY,l,f,a.tierWall,W);let I={tread:[f[0]*W.top,f[1]*W.top,f[2]*W.top],riser:[f[0]*.72,f[1]*.72,f[2]*.72]};for(let y of h.length?h:[d])ps(e,r.rowLevels,n.focal,r.landingY,I,y,g);Ja(e,r.rowLevels,n.focal,l),tc(e,r.rowLevels,t.outline,n.focal,g);return}let p=r.flat?1/0:xa,b=g=>r.normalAt(g.x,g.y),M=r.flat?r.landingY:void 0;for(let g of i.subtract(d,M))$(e,g,t.holes,m,l,f,a.tierWall,W,p,b)}function ad(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 u=r.get(a);u||(u=new Map,r.set(a,u));let f=l.rowId||`__seat-${s}`,m=u.get(f);m||(m={pts:[],levelM:0,n:0},u.set(f,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(u=>!u.patch).map(u=>({pts:u.pts,levelM:u.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 cd(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 rc=.02;function ld(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 u of o.outline)u.x<i&&(i=u.x),u.x>s&&(s=u.x),u.y<a&&(a=u.y),u.y>c&&(c=u.y);let l=r.landingY;for(let u of r.rowLevels)l=Math.min(l,u.y-rc);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(!Ee(c,a.outline,a.holes)&&cd(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 ud=3,fd=.4;function ic(e,t,n,o,r,i,s=!0){let a=ad(t,n,o);if(a.length<ud)return;let c=Ka(a,t.focal);if(!c)return;let l=Math.max(0,...c.rings.map(u=>u.arcs.reduce((f,m)=>f+m.binCount,0)))/c.binCount;e.setMaterial(5),Za(e,c,{bottomY:t.baseHeightM,tierFrontLevels:a.map(u=>Math.min(...u.rows.map(f=>f.levelM))),colors:{bandTop:Y(r.tierTop,.8),bandWall:r.tierWall,shellTop:i??Y(r.tierWall,1.15),shellWall:i??r.tierWall},ao:W,shapes:t.objects.filter(u=>u.type==="shape"),deriveShell:s&&l>=fd,standTopNear:ld(t,o)}),e.setMaterial(0)}var sc=4;var md=[[/\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"]],hd=1.2,dd=12;function ac(e){if(e.heightM!==void 0)return!1;let t=ce(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*ee<dd*2?!1:2*Pn(t)/n*ee<=hd}function wr(e){if(!e)return null;for(let[t,n]of md)if(t.test(e))return n;return null}var lc="auto-rows-";function uc(e){return e.id.startsWith(lc)&&!e.label}var pd=1.15,bd=.09,fc=6,yd=34,gd=.35,xd=6,Md=.35,Sd=.75,Rd=12,Id=2.5,Pd=40,_d=[18,24],wd=[12,16],cc=14,Ed=.8,Ad=.6,Cd=5,vd=.3,mc=.4,hc=2,kd=400,Od=2.6,Ld=.8,Td=4,Bd=26,Nd=.7,Fd=.5,Dd=.985,Gd=1.5,Hd=2.2,jd=3,Vd=25,Ud=.985,Xd=2,Kd=6,Wd=3,Yd=.1,zd=1.5,Zd=1.6,$d=6e3,Qd=.6,qd="#c3c7cd",Er=300,Jd=240;function ep(e,t,n,o){if(!e.fill||!/^#[0-9a-f]{6}$/i.test(e.fill))return null;let r=Cr([...t]),i=new Set;for(let u of o)i.add(Math.floor(Math.atan2(u.y-r.y,u.x-r.x)*180/Math.PI/10));if(i.size*10<Jd)return null;let{h:s,s:a,l:c}=vi(Ci(e.fill));return s<70/360||s>170/360||a<.2||c<.08||c>.75||n.some(u=>u!==e&&u.type==="shape"&&ce(u)?.some(f=>Or(f,t)))?null:e.kind==="ellipse"?"oval-cricket":e.kind==="rect"?"pitch-football":null}var tp="Estimated from the drawing; confirm with the venue.",vr=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},Cr=e=>({x:e.reduce((t,n)=>t+n.x,0)/e.length,y:e.reduce((t,n)=>t+n.y,0)/e.length}),Pn=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 np(e){return e.height!==void 0||e.rake!==void 0||e.elevation!==void 0||e.surfaceKind!==void 0}function kr(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 Or(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 Lr(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,u=l>0?Math.max(0,Math.min(1,((e.x-i.x)*a+(e.y-i.y)*c)/l)):0,f={x:i.x+a*u,y:i.y+c*u},m=Math.hypot(e.x-f.x,e.y-f.y);m<o&&(o=m,n=f)}return n}function dc(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 u={x:(i.x+s.x)/2,y:(i.y+s.y)/2},f=Lr(u,t),m=f.x-u.x,h=f.y-u.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 op(e,t,n){let o=e.filter(p=>p.type==="shape"),r=o.find(p=>p.role==="stage");if(r){let p=ce(r);return p?{shape:r,centre:Cr(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),u=[];for(let p of o){if(p.role)continue;let b=ce(p);if(!b)continue;let M=Pn(b);if(M*ee*ee<6||M>l)continue;let g=Math.min(...b.map(R=>R.x)),S=Math.max(...b.map(R=>R.x)),_=Math.min(...b.map(R=>R.y)),I=Math.max(...b.map(R=>R.y)),y=0;for(let R of n)R.x>g&&R.x<S&&R.y>_&&R.y<I&&Or(R,b)&&y++;if(y>n.length*.05)continue;let x=Cr(b),P=dc(t,b);P>=Ed&&u.push({shape:p,centre:x,outline:b,score:P,area:M,box:[g,_,S,I]})}let f=(p,b)=>b!==p&&b.area>p.area&&p.box[0]>=b.box[0]-1e-6&&p.box[1]>=b.box[1]-1e-6&&p.box[2]<=b.box[2]+1e-6&&p.box[3]<=b.box[3]+1e-6,m=u.filter(p=>!u.some(b=>f(p,b))),h=Math.max(0,...m.map(p=>p.score)),d=m.filter(p=>p.score>=h-.03).sort((p,b)=>b.area-p.area)[0]??null;return d?{shape:d.shape,centre:d.centre,outline:d.outline,inferred:!0}:null}function rp(e,t,n){if(!n||n.length<3)return Math.hypot(e.x-t.x,e.y-t.y);let o=Lr(e,n);return Math.hypot(e.x-o.x,e.y-o.y)}function pc(e){return e.length<3?[...e].sort((t,n)=>t.x-n.x||t.y-n.y):Gt(e)}function ip(e){if(!e.length||e.length>$d)return[];let t=[...kr(e).values()],n=t.map((a,c)=>c),o=a=>n[a]===a?a:n[a]=o(n[a]),r=Zd/ee,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],u=i[c];if(l.maxX<u.minX||u.maxX<l.minX||l.maxY<u.minY||u.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),u=s.get(l);u?u.push(...a):s.set(l,[...a])}),[...s.values()].filter(a=>new Set(a.map(c=>c.rowId)).size>=2)}function sp(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=kr(t),i=!n.outline||dc(r,n.outline)>=Ad,s=0,a=0;for(let P of r.values()){if(P.length<2)continue;let R=P[0],v=P[P.length-1],T=v.x-R.x,k=v.y-R.y,C=Math.hypot(T,k);if(C<1e-6)continue;let E={x:(R.x+v.x)/2,y:(R.y+v.y)/2},A=i?n.outline?Lr(E,n.outline):n.focal:n.middle,O=-k/C,F=T/C;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,R)=>P+R.x,0)/t.length,y:t.reduce((P,R)=>P+R.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,u={x:s/l,y:a/l},f=P=>-(P.x*u.x+P.y*u.y),m=P=>-P.x*u.y+P.y*u.x,h=1/0,d=-1/0,p=1/0,b=-1/0,M=1/0,g=new Map;for(let P of t){let R=f(P),v=m(P);h=Math.min(h,R),d=Math.max(d,R),p=Math.min(p,v),b=Math.max(b,v),i&&(M=Math.min(M,rp(P,n.focal,n.outline)));let T=P.logicalRowId??P.rowId,k=g.get(T);k?k.push(R):g.set(T,[R])}i||(M=Math.max(0,h-f(n.middle)));let S=[...g.values()].map(P=>vr(P)).sort((P,R)=>P-R),_=[];if(!o)for(let P of S)_.length&&P-_[_.length-1]<Md/ee||_.push(P);let I=np(e),y=mt(e,{floorBaseHeightM:n.baseHeightM}),x={id:e.id,section:e,authored:I,plane:n,facing:u,facesAction:i,hull:pc(t),sample:t.filter((P,R)=>R%Math.ceil(t.length/kd)===0),frontD:h,backD:d,latMin:p,latMax:b,frontDistance:M,rowDepths:_,rowCount:_.length,level:0,height:y.height,rake:I?y.rake:0,backHeight:0};return x.backHeight=x.height+(d-h)*ee*Math.tan(x.rake*Math.PI/180),x}function ap(e,t,n,o){if(e.length<2)return 0;let r=Math.max(1,t*ee),i=n+pd-o,s=0,a=0;for(let l=1;l<e.length;l++){let u=Math.max(Sd,(e[l]-e[l-1])*ee),f=(i+bd)*(r+u)/r;s+=f-i,a+=u,i=f,r+=u}let c=Math.atan(s/a)*180/Math.PI;return Math.round(Math.max(fc,Math.min(yd,c))*10)/10}function cp(e,t,n=!1){if(!n&&e.facing.x*t.facing.x+e.facing.y*t.facing.y<vd)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:mc*(e.latMax-e.latMin)))return null;let a=hc/ee,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 u=[];for(let[m,h]of c){let d=l.get(m);d!==void 0&&u.push(h-d)}let f=u.length?vr(u):e.frontD-o;return f<-1/ee?null:f}function lp(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 u=-c.x*e.facing.y+c.y*e.facing.x;r=Math.min(r,u),i=Math.max(i,u)}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>mc*(e.latMax-e.latMin)&&a>1/ee}function up(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 fp(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*ee*Math.tan(t.rake*Math.PI/180)}function mp(e,t){if(!e.facesAction)return!1;let n={x:-e.facing.y,y:e.facing.x},o=hc/ee,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>=Dd))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 u=-c.x*e.facing.y+c.y*e.facing.x,f=u<e.latMin?"left":u>e.latMax?"right":null;if(!f)return!1;let m=Math.min(r-1,Math.floor((l-e.frontD)/o)),h=f==="left"?e.latMin-u:u-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,l=0;for(let[u,{other:f}]of i[a]){if((f.facing.x*n.x+f.facing.y*n.y)*(a==="left"?1:-1)<Nd)continue;let h=e.frontD+(u+.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),b=-d.x*f.facing.y+d.y*f.facing.x;p<f.frontD&&b>=f.latMin&&b<=f.latMax&&l++}return l/r>=Fd};return s("left")&&s("right")}function hp(e,t){if(t.plane.floorIndex!==e.plane.floorIndex||t.facing.x*e.facing.x+t.facing.y*e.facing.y<Ud)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)*ee;if(i<-Xd||i>Kd)return!1;let s=Math.max(n-e.latMax,e.latMin-o);return s*ee<=Wd&&s*ee>=-Yd}function dp(e,t=!1,n=!1,o){let r=t?wd:_d,i=new Set(n?[]:e.filter(p=>!p.authored&&mp(p,e))),s=[...e].sort((p,b)=>p.plane.floorIndex-b.plane.floorIndex||Number(i.has(b))-Number(i.has(p))||p.frontDistance-b.frontDistance);for(let p of i)o?.add(p.id);let a=(p,b,M)=>{let g=new Map,S=[],_=new Map,I=y=>{if(y.plane.floorIndex===0||y.plane.baseHeightM>0)return y.plane.baseHeightM;let x=_.get(y.plane.floorIndex-1);return x===void 0?y.plane.baseHeightM:x+sc};for(let y of s){if(i.has(y))y.height=I(y),y.level=0,y.rake=0,y.backHeight=y.height,g.set(y.id,void 0);else if(!y.authored){let P=I(y),R;for(let E of S){if(E.plane.floorIndex>y.plane.floorIndex)continue;if(lp(y,E)){let L=fp(y,E)+Od;L>P&&(P=L,R=E);continue}let A=cp(y,E,i.has(E));if(A==null)continue;let O=n&&!!y.plane.stageDeck&&E.level===0&&E.plane.floorIndex===y.plane.floorIndex&&Math.max(0,A)*ee<=Td,F=i.has(E)?E.height+Gd:O?E.backHeight:E.backHeight+gd+Math.min(xd,Math.max(0,A)*ee)*Math.tan(E.rake*Math.PI/180);F>P&&(P=F,R=E)}let v=p.get(y);v&&v.height>P+.01?(P=v.height,R=void 0):v=void 0,y.height=Math.round(Math.min(P,y.plane.baseHeightM+Pd)*100)/100;let T=!R&&!v&&y.height>y.plane.baseHeightM;if(y.level=R?R.level+1:v?v.level:T?1:0,y.rake=ap(y.rowDepths,y.frontDistance,y.height,y.plane.focalHeightM),!y.facesAction&&y.rowCount<Cd)y.rake=0;else if(y.level===0){let E=Math.max(1e-6,(y.backD-y.frontD)*ee);y.rake=Math.min(y.rake,Rd,Math.round(Math.atan(Id/E)*1800/Math.PI)/10)}else y.rowCount>=2&&(y.rake=Math.max(y.rake,r[Math.min(y.level,r.length)-1]));let k=(y.backD-y.frontD)*ee,C=R&&i.has(R)||v&&M?.has(v.id);if(b!==void 0&&C&&y.rowCount>=2&&(y.rake=b),t&&k>0&&y.height+k*Math.tan(y.rake*Math.PI/180)>y.plane.baseHeightM+cc){let E=Math.max(0,y.plane.baseHeightM+cc-y.height);y.rake=Math.max(fc,Math.round(Math.atan(E/k)*1800/Math.PI)/10)}n&&y.plane.stageDeck&&y.level>0&&(y.rake=Math.min(y.rake,Bd)),y.backHeight=y.height+k*Math.tan(y.rake*Math.PI/180),g.set(y.id,R?.id??(v?g.get(v.id):void 0))}let x=y.plane.floorIndex;_.set(x,Math.min(_.get(x)??1/0,y.height)),S.push(y)}return g},c=a(new Map),l=new Map,u=p=>l.get(p)?.height??p.height;for(let p=!0,b=0;p&&b<e.length;b++){p=!1;for(let M of e)if(!(M.authored||i.has(M)))for(let g of e){let S=l.get(g)??g;g===M||S.height-S.plane.baseHeightM<zd||S.height<=u(M)+.01||hp(M,g)&&(l.set(M,S),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?vr(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,b])=>[p,d.get(b)])),h,new Set(m.map(p=>p.id)))}var Ar=(e,t)=>!!e&&e.x===t.x&&e.y===t.y;function bc(e,t={x:0,y:-40}){let n=Nt(e),o=new Map;for(let M of n){if(!M.sectionId)continue;let g=o.get(M.sectionId);g?g.push(M):o.set(M.sectionId,[M])}let r={focalInferred:!1,confident:!1,sections:[]},i=e.floors?.length?e.floors.map((M,g)=>({objects:M.objects,floorIndex:g,floorId:M.id,baseHeightM:M.baseHeightM??0,focal:M.focalPoint??e.focalPoint})):[{objects:e.objects,floorIndex:0,floorId:void 0,baseHeightM:0,focal:e.focalPoint}],s=new Set(i.flatMap(M=>M.objects.filter(g=>g.type==="table").map(g=>g.id))),a=[],c,l=new Set,u=i.map(M=>{let g=C=>!e.floors?.length||C.floorId===M.floorId,S=ip(n.filter(C=>!C.sectionId&&C.kind!=="booth"&&!s.has(C.rowId)&&g(C))),_=[];for(let C of S){let E=ot(nt(pc(C)),Qd/ee);if(n.some(O=>!g(O)&&Or(O,E)))continue;let A=`${lc}${M.floorIndex}-${_.length}`;l.add(A),o.set(A,C),_.push({type:"section",id:A,label:"",color:qd,outline:E})}let I=_.length?{...M,objects:[...M.objects,..._]}:M,y=new Set(I.objects.filter(C=>C.type==="section").map(C=>C.logicalSectionId??C.id)),x=[...o.entries()].filter(([C])=>y.has(C)).flatMap(([,C])=>C),P=op(I.objects,kr(x),x),R=I.focal;(P||I.focal&&!Ar(I.focal,t))&&(r.confident=!0),P&&(r.stage??={id:P.shape.id,inferred:P.inferred,...I.floorId?{floorId:I.floorId}:{}},(P.inferred||Ar(I.focal,t))&&(R=P.centre,r.focalInferred=!0));let v=P&&(!P.inferred||Pn(P.outline)*ee*ee<=Er),T=P?void 0:c,k={tableIds:s,floorIndex:I.floorIndex,floorId:I.floorId,baseHeightM:I.baseHeightM,focal:T?.focal??R,outline:P?.outline??T?.outline,focalHeightM:T?.focalHeightM??I.baseHeightM+(P&&v?$e({...P.shape,role:"stage"}).heightM:0),stageDeck:T?.stageDeck??!!(P&&v&&Pn(P.outline)*ee*ee<=Er),middle:x.length?{x:x.reduce((C,E)=>C+E.x,0)/x.length,y:x.reduce((C,E)=>C+E.y,0)/x.length}:R};for(let C of I.objects){if(C.type!=="section")continue;let E=sp(C,o.get(C.logicalSectionId??C.id)??[],k);E&&a.push(E)}return k.outline&&(c=k),Ar(I.focal,k.focal)||(r.focal??=[]).push({...I.floorId?{floorId:I.floorId}:{},point:{...k.focal}}),{unit:I,plane:k,stage:P,planeSeats:x}}),f=i.flatMap(M=>M.objects).map(M=>M.type==="shape"&&!M.role&&(wr(M.label)==="wall"||!wr(M.label)&&ac(M))?{...M,role:"wall"}:M),m=bt({objects:f},n)!==null;m&&(r.indoor=!0);let h=new Set,d=dp(a,m,up(n,u[0]?.plane.focal??t)<Ld,h),p=new Map(a.filter(M=>!M.authored).map(M=>[M.id,M])),b=u.map(({unit:M,plane:g,stage:S,planeSeats:_})=>M.objects.map(I=>{let y=I.type==="shape"&&!I.role&&I.id!==S?.shape.id?wr(I.label):null;if(I.type==="shape"&&!I.role&&I.id!==S?.shape.id&&(y==="wall"||!y&&ac(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(y&&I.type==="shape")return(r.roles??=[]).push({id:I.id,...g.floorId?{floorId:g.floorId}:{},role:y}),{...I,role:y};let P=S?.inferred&&I.id===S.shape.id&&I.type==="shape"?ep(I,S.outline,M.objects,_):null;if(P&&I.type==="shape")return r.stage?.id===I.id&&(r.stage.field=P),{...I,role:"stage",stageKind:P};let R=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<=jd&&(E.frontDistance+E.backD-E.frontD)*ee>=Vd)),v=R?{heightM:Hd}:{};if(S?.inferred&&I.id===S.shape.id&&I.type==="shape"&&Pn(S.outline)*ee*ee<=Er)return r.stage?.id===I.id&&(r.stage.deck=!0),{...I,role:"stage",...v};if(R&&I.type==="shape"&&I.role==="stage")return{...I,...v};let T=I.type==="section"?p.get(I.id):void 0;if(!T||I.type!=="section")return I;let k=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:k?"rakedRows":"flat",height:T.height,rake:T.rake,stackedOn:d.get(T.id)});let C={status:"inferred",source:"public-2d-topology",note:tp};return{...I,height:T.height,rake:T.rake,surfaceKind:k?"rakedRows":"flat",physical3dProvenance:{height:C,rake:C,surfaceKind:C}}}));if(e.floors?.length){let M=e.floors.map((g,S)=>({...g,objects:b[S],focalPoint:u[S].plane.focal}));return{doc:{...e,floors:M,objects:M[0].objects,focalPoint:M[0].focalPoint},report:r}}return{doc:{...e,objects:b[0],focalPoint:u[0].plane.focal},report:r}}var yc=/^[\p{L}\p{N}]{1,4}$/u,pp=/^([\p{L}\p{N}]{2,})[\s\-\u2013\u2014\u00b7_./]+(.+)$/u;function gc(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(yc.test(s))return s}let i=pp.exec(e);if(i){let s=i[1].toLocaleLowerCase("en-US"),a=i[2].trim();if((r.startsWith(s)||s.startsWith(r))&&yc.test(a))return a}return e}var xc={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"},bp=new Map(zo.map(e=>[e.key,e.label]));function yp(e){return`picker.access.${e}`}function Mc(e){let t=[],n=e.boothType;n&&Object.prototype.hasOwnProperty.call(xc,n)&&t.push({key:`booth:${n}`,icon:"booth",titleKey:`picker.boothType.${n}`,titleFallback:xc[n],tone:"place"});let o=e.wheelchairSpaceType;for(let a of e.accessibility??[]){if(a==="wheelchair"&&o)continue;let c=bp.get(a);c&&t.push({key:`access:${a}`,icon:a,titleKey:yp(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 gp=1.5,xp=30,Mp=4,Sp=3.6,Rp=6,Tr=15,Ip=3,Pp=1;function _p(e){return Math.max(Sp,Math.min(Rp,2.4+.15*e))}var _n=Math.PI*2;function wp(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-=_n;for(;m<-Math.PI;)m+=_n;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 l=f=>Math.hypot(f.x-t.x,f.y-t.y),u=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,b=e[p];return l(m)<=l(b)?[m,b]:[b,m]};return{start:a,end:c,startEdge:u(s[0]),endEdge:u(s[s.length-1])}}function Sc(e){return e.type==="shape"&&e.role==="wall"&&e.heightM===void 0}function Br(e,t,n=()=>!0){let o=[];for(let c of e){if(!Sc(c)||!n(c))continue;let l=ce(c);if(!l||l.length<3)continue;let u=wp(l,t);if(!u)return[];o.push(u)}if(o.length<2)return[];let r=e.flatMap(c=>{if(c.type!=="shape"||c.role!=="entrance"&&c.role!=="exit")return[];let l=ce(c);if(!l?.length)return[];let u=0,f=0;for(let m of l)u+=m.x,f+=m.y;return[{x:u/l.length,y:f/l.length}]}),i=c=>(c%_n+_n)%_n;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],u=o[(c+1)%o.length],f=i(u.start-l.end);if(f<=0||f>=Math.PI/2)continue;let m=y=>i(y-l.end)<f;if(o.some(y=>y!==l&&y!==u&&(m(y.start)||m(y.end)||i(l.end-y.start)<y.end-y.start)))continue;let[d,p]=l.endEdge,[b,M]=u.startEdge,g={x:(d.x+p.x)/2,y:(d.y+p.y)/2},S={x:(b.x+M.x)/2,y:(b.y+M.y)/2},_=Math.hypot(S.x-g.x,S.y-g.y)*w;if(_<gp||_>xp||Math.abs(s(g)-s(S))*w>Mp+.2*_)continue;let I={x:(g.x+S.x)/2,y:(g.y+S.y)/2};r.some(y=>m(Math.atan2(y.y-t.y,y.x-t.x))&&Math.abs(s(y)-s(I))*w<=Ip)||a.push({quad:[d,p,M,b],mid:I,widthM:_,openingM:_p(_)})}return a}function Rc(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)*w;a<=Tr&&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 Ic(e,t,n,o,r,i,s,a=()=>!0){let c=Br(t,$t(n),a);if(!c.length)return;let l=t.find(f=>Sc(f)&&a(f)),u=co(l?.fill,s);e.setMaterial(to);for(let f of c)r-f.openingM<Pp||oo(e,f.quad,o+f.openingM,o+r,[],u.top,u.wall,i,r);e.setMaterial(0)}var Ep=6,Ap=2.2,bo=.1,Cp=/^(gate|entrance|entry|exit|way in|way out|door)s?$/i,vp=new Set(["stage","entrance","exit","screen","suite","obstruction","sound","bar","concession","restroom","coat"]),kp=.3,Op=1.8,Lp=.9,Tp=.55,Bp=1,Pc=4e3,Np=6,_c="#d8a425",Fp="#e8c15a",Nr="#1c1608";function wc(e){let t=Dp(e);if(!t)return null;let n=Mc(e).find(o=>o.icon===t.icon);return{...t,name:n?.titleFallback??t.icon}}function Dp(e){let t=e.accessibility;if(t?.length)return{icon:t.includes("wheelchair")?"wheelchair":t[0],color:Vn(t)};let n=e.commercial;return n?.obstructedView?{icon:"obstructedView",color:_c,ink:Nr}:n?.restrictedView?{icon:"restrictedView",color:_c,ink:Nr}:n?.premium?{icon:"premium",color:Fp,ink:Nr}:null}function Gp(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 Hp=6e3,jp=.25,Ec=[-90,90,-135,135,-45,45];function Vp(e,t,n,o){let r=e.flatMap(({id:s,a,members:c})=>{let l=(a.minX+a.maxX)/2,u=(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-l,t[h].y-u));return c.length&&m>=f*jp?[{id:s,cx:l,cy:u,half:f,members:c}]:[]}).sort((s,a)=>s.half-a.half),i=new Map;return r.forEach(({id:s,cx:a,cy:c,members:l},u)=>{let f=o.x-a,m=o.y-c,p=(Math.hypot(f,m)>1e-6?Math.atan2(m,f):0)+Ec[u%Ec.length]*Math.PI/180,b=Math.cos(p),M=Math.sin(p),g=-1,S=-1/0;for(let _ of l){let I=(t[_].x-a)*b+(t[_].y-c)*M;I>S&&(S=I,g=_)}i.set(s,[t[g].x*w,n.seatDeckY(g),t[g].y*w])}),i}function Cc(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,u=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 b=l.get(p);b||(b={n:0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0,sumY:0},l.set(p,b));let M=u.get(p);M||u.set(p,M=[]),M.push(m),b.n++,h.x<b.minX&&(b.minX=h.x),h.y<b.minY&&(b.minY=h.y),h.x>b.maxX&&(b.maxX=h.x),h.y>b.maxY&&(b.maxY=h.y),b.sumY+=r.seatDeckY(m)}let f=Vp(s.flatMap(m=>{let h=l.get(m.id);return h?[{id:m.id,a:h,members:u.get(m.id)??[]}]:[]}),o,r,i);for(let m of s){let h=l.get(m.id),d=[];for(let[p,b]of c)b===m.id&&d.push(p);if(!h||h.n===0){a.push({id:m.id,label:m.label,color:me(m.color),sectionIds:d,seatCount:0,center:[0,0,0],radius:0,focalWorld:[(m.focalPoint??i).x*w,1.5,(m.focalPoint??i).y*w]});continue}a.push({id:m.id,label:m.label,color:me(m.color),sectionIds:d,seatCount:h.n,...f.has(m.id)?{labelAt:f.get(m.id)}:{},center:[(h.minX+h.maxX)/2*w,h.sumY/h.n,(h.minY+h.maxY)/2*w],radius:.5*Math.hypot((h.maxX-h.minX)*w,(h.maxY-h.minY)*w)||1,focalWorld:[(m.focalPoint??i).x*w,1.5,(m.focalPoint??i).y*w]})}}return a}function vc(e){let{doc:t,units:n,seats:o,surfaces:r,seatData:i,hintedSeatFloor:s,zones:a,focal:c}=e,l=[],u=[],f=[],m=new Map;for(let d of n)for(let p of d.objects){if(p.type!=="section"||!p.zone)continue;let b=(p.displayLabel||p.label||"").trim().toLocaleLowerCase();if(!b)continue;let M=t.floors?.[d.index]?.name?.trim().toLocaleLowerCase();if(n.length>1&&M===b)continue;let g=m.get(p.zone);g||m.set(p.zone,g=new Set),g.add(b)}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]+Ep,(d.labelAt??d.center)[2]],color:t.zones?.find(p=>p.id===d.id)?.color}));{let d=new Map,p=new Map,b=new Map,M=new Map;for(let g=0;g<o.length;g++){let S=r.seatOwner[g];if(!S)continue;let _=d.get(S);_||(_={n:0,x:0,y:0,deck:0},d.set(S,_)),_.n++,_.x+=o[g].x,_.y+=o[g].y,_.deck+=r.seatDeckY(g);let I=o[g].categoryKey;if(I){let x=p.get(S);x||(x=new Map,p.set(S,x)),x.set(I,(x.get(I)??0)+1)}if(o[g].accessibility?.includes("wheelchair")){let x=b.get(S);x?x.push(g):b.set(S,[g])}let y=M.get(S);y||(y={minX:1/0,maxX:-1/0,minY:1/0,maxY:-1/0,minDeck:1/0,maxDeck:-1/0},M.set(S,y)),y.minDeck=Math.min(y.minDeck,r.seatDeckY(g)),y.maxDeck=Math.max(y.maxDeck,r.seatDeckY(g)),o[g].x<y.minX&&(y.minX=o[g].x),o[g].x>y.maxX&&(y.maxX=o[g].x),o[g].y<y.minY&&(y.minY=o[g].y),o[g].y>y.maxY&&(y.maxY=o[g].y)}for(let g of n)for(let S of g.objects){if(S.type!=="section"||uc(S))continue;let _=d.get(S.id);if(!_||_.n===0)continue;let I=M.get(S.id),y=[_.x/_.n*w,_.deck/_.n,_.y/_.n*w],x=S.displayLabel||S.label||S.id;u.push({id:S.id,floorIndex:g.index,label:x,seatCount:_.n,center:y,radius:Math.max(1,Math.hypot(I.maxX-I.minX,I.maxY-I.minY)*.5*w),box:{min:[I.minX*w-.4,I.minDeck,I.minY*w-.4],max:[I.maxX*w+.4,I.maxDeck+1,I.maxY*w+.4]},focalWorld:[g.focal.x*w,g.baseHeightM+1.5,g.focal.y*w]});let P=t.floors?.[g.index]?.name?.trim().toLocaleLowerCase();if(!(n.length>1&&P===x.trim().toLocaleLowerCase())){let R=Gp(p.get(S.id),t),v=b.get(S.id);l.push({id:`section:${S.id}`,kind:"section",text:x,anchor:[y[0],y[1]+Ap,y[2]],floorIndex:g.index,...R?{tint:R}:{},...v?{wheelchairSeats:v}:{}})}}}{for(let y of n)for(let x of y.objects){if(x.type!=="gaArea")continue;let P=kt(x.points);if(!P)continue;let R=x.labelPresentation?.visible===!1?"":x.displayLabel||x.label||x.id,v=x.capacity>0?[R,x.capacity.toLocaleString()].filter(Boolean).join(" \xB7 "):R;v&&l.push({id:`ga:${x.id}`,kind:"ga",text:v,anchor:[P.x*w,y.baseHeightM+Op,P.y*w],floorIndex:y.index})}let d=new Map,p=new Map;for(let y of n)for(let x of y.objects)if(x.type==="section"&&d.set(x.id,x.displayLabel||x.label||x.id),x.type==="row"){let P=x.displayLabel?.trim()||x.segmentedRow?.displayLabel?.trim();P&&p.set(x.id,P)}let b=new Map;for(let y=0;y<o.length;y++){let x=o[y],P=Math.hypot(x.x-c.x,x.y-c.y),R=b.get(x.rowId);(!R||P>R.far)&&b.set(x.rowId,{seat:x,index:y,far:P})}for(let[y,x]of b){let P=r.seatOwner[x.index]??x.seat.sectionId,R=Ac(x.seat.label,y,d.get(P??""),p.get(y));R&&l.push({id:`row:${y}`,kind:"row",text:R,anchor:[x.seat.x*w,r.seatDeckY(x.index)+Lp,x.seat.y*w],floorIndex:s[x.index]})}let M=new Map;for(let y=0;y<o.length;y++){let x=o[y],P=M.get(x.rowId);P||(P={n:0,x:0,y:0,z:0,minX:1/0,maxX:-1/0,minZ:1/0,maxZ:-1/0,label:Ac(x.label,x.rowId,d.get(r.seatOwner[y]??x.sectionId??""),p.get(x.rowId)),sectionId:r.seatOwner[y]??x.sectionId},M.set(x.rowId,P));let R=y*3,v=i.iPosition[R],T=i.iPosition[R+1],k=i.iPosition[R+2];P.n++,P.x+=v,P.y+=T,P.z+=k,P.minX=Math.min(P.minX,v),P.maxX=Math.max(P.maxX,v),P.minZ=Math.min(P.minZ,k),P.maxZ=Math.max(P.maxZ,k)}for(let[y,x]of M)f.push({id:y,label:x.label,sectionId:x.sectionId,seatCount:x.n,center:[x.x/x.n,x.y/x.n,x.z/x.n],radius:Math.max(.8,Math.hypot(x.maxX-x.minX,x.maxZ-x.minZ)*.5)});let g=0,S=(y,x)=>{g++,l.push({id:`access:${o[y].id}`,kind:"access",text:x.name,icon:x.icon,color:x.color,...x.ink?{ink:x.ink}:{},seatWidthM:i.iChairWidth[y]*2,anchor:[o[y].x*w,r.seatDeckY(y)+Bp,o[y].y*w],floorIndex:s[y],rowId:o[y].rowId})},_=null,I=()=>{if(_){let y=wc(o[_.seats[0]]),x=_.seats.length,P=Math.max(1,Math.round(x/Np));for(let R=0;R<P&&g<Pc;R++)S(_.seats[Math.min(x-1,Math.floor((R+.5)*x/P))],y)}_=null};for(let y=0;y<o.length&&g<Pc;y++){let x=wc(o[y]);if(x&&o[y].accessibility?.length){I(),S(y,x);continue}if(!x){I();continue}_&&_.rowId===o[y].rowId&&_.icon===x.icon?_.seats.push(y):(I(),_={rowId:o[y].rowId,icon:x.icon,seats:[y]})}if(I(),o.length<=Hp)for(let y=0;y<o.length;y++){let x=o[y],P=Up(x.displayLabel||x.label);P&&l.push({id:`seat:${x.id}`,kind:"seat",seatWidthM:i.iChairWidth[y]*2,text:P,anchor:[x.x*w,r.seatDeckY(y)+Tp,x.y*w],floorIndex:s[y],rowId:x.rowId})}}let h=Qn(n);for(let d of n){let p=bt(d,n.length===1?o:o.filter((g,S)=>s[S]===d.index)),b=p?Rc(Br(d.objects,$t(p)),d.objects.filter(g=>g.type==="text")):new Map,M=[...b.values()];for(let g of d.objects){let S=g.type==="text"?b.get(g.id):void 0;if(g.type==="shape"&&(g.role==="entrance"||g.role==="exit")&&Cp.test(g.label?.trim()??"")){let _=ce(g),I=_?kt(_):null;if(I&&M.some(y=>Math.hypot(I.x-y.mid.x,I.y-y.mid.y)*w<=Tr+y.widthM))continue}if(S&&g.type==="text")l.push({id:`text:${g.id}`,kind:"gate",text:g.text,icon:"entrance",anchor:[S.mid.x*w,d.baseHeightM+S.openingM+bo,S.mid.y*w],color:g.color,floorIndex:d.index});else if(g.type==="shape"&&g.role&&vp.has(g.role)){if(h.has(g))continue;let _=ce(g),I=_?kt(_):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*w,d.baseHeightM+$e(g).heightM+bo,I.y*w],color:g.fill,floorIndex:d.index})}else if(g.type==="text"){let _=g.semanticKind==="icon"?ur(g.iconKey)?.key:void 0,I=g.text||(_?ur(_).label:"");if(!I)continue;l.push({id:`text:${g.id}`,kind:"annotation",text:I,..._?{venueIcon:_}:{},anchor:_?[(g.position.x+g.fontSize/2)*w,d.baseHeightM+bo,(g.position.y+g.fontSize/2)*w]:[g.position.x*w,d.baseHeightM+bo,g.position.y*w],color:g.color,rotation:g.rotation,floorIndex:d.index})}else if(g.type==="booth"){if(g.labelPresentation?.visible===!1)continue;let _=Je(g);if(!_)continue;let I=kt(_);if(!I)continue;l.push({id:`booth:${g.id}`,kind:"booth",text:g.displayLabel||g.label||g.id,anchor:[I.x*w,d.baseHeightM+lo+kp,I.y*w],floorIndex:d.index})}}}return{labels:l,sections:u,rows:f}}function kc(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 Up(e){let t=e.lastIndexOf("-");return t>=0&&t<e.length-1?e.slice(t+1):e}function Ac(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&&gc(i,n)}function Oc(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 u=new Map;for(let m=0;m<n.length;m++)for(let h of n[m].objects)h.type==="section"&&u.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?u.get(h):void 0)??s[m];if(d===void 0)continue;let p=f[d],b=o[m];p.n++,b.x<p.minX&&(p.minX=b.x),b.y<p.minY&&(p.minY=b.y),b.x>p.maxX&&(p.maxX=b.x),b.y>p.maxY&&(p.maxY=b.y);let M=r.seatDeckY(m);p.sumX+=b.x*w,p.sumDeck+=M,p.sumZ+=b.y*w,p.minDeck=Math.min(p.minDeck,M),p.maxDeck=Math.max(p.maxDeck,M+1.6),a[m]=d}for(let m=0;m<n.length;m++){let h=f[m],d=t.floors?.[m],p=l[m],b=Math.min(h.n?h.minX*w:n[m].focal.x*w-1,Number.isFinite(p.minX)?p.minX:1/0),M=Math.max(h.n?h.maxX*w:n[m].focal.x*w+1,Number.isFinite(p.maxX)?p.maxX:-1/0),g=Math.min(h.n?h.minY*w:n[m].focal.y*w-1,Number.isFinite(p.minZ)?p.minZ:1/0),S=Math.max(h.n?h.maxY*w:n[m].focal.y*w+1,Number.isFinite(p.maxZ)?p.maxZ:-1/0),_=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,_+.5):_+.5,Number.isFinite(p.maxY)?p.maxY:-1/0),y=[h.n?h.sumX/h.n:(b+M)/2,h.n?h.sumDeck/h.n:(_+I)/2,h.n?h.sumZ/h.n:(g+S)/2],x=Math.max(1,.5*Math.hypot(M-b,I-_,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:y,radius:x,box:{min:[b,_,g],max:[M,I,S]},focalWorld:[n[m].focal.x*w,n[m].baseHeightM+1.5,n[m].focal.y*w]})}}return c}function Hr(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=Je(c);if(l)for(let u of l)s(u.x,u.y)}else if(c.type==="table"){let l=uo(c);if(l)for(let u of l)s(u.x,u.y)}else if(c.type==="decorImage"){let l=fo(c);if(l)for(let u of l)s(u.x,u.y)}return Number.isFinite(n)||(n=-100,o=-100,r=100,i=100),{minX:n,minY:o,maxX:r,maxY:i}}function Gc(e,t,n,o,r,i){if(t.length===1){let s=n.map(f=>({x:f.x,y:f.y}));for(let f of t[0].objects)f.type==="section"?s.push(...f.outline):f.type==="shape"?s.push(...ce(f)??f.points??[]):f.type==="gaArea"?s.push(...f.points):f.type==="booth"?s.push(...Je(f)??[]):f.type==="table"?s.push(...uo(f)??[]):f.type==="decorImage"&&s.push(...fo(f)??[]);if(Nc(e,t[0],n,i)||Dc(e,t[0],n,s,i))return!1;if(Bc(e,t[0].baseHeightM,s,i))return!0;let a=xn(s),c=(r.minX+r.maxX)/2,l=(r.minY+r.maxY)/2,u=a.length>=3?a.map(f=>{let m=f.x-c,h=f.y-l,d=Math.max(1,Math.hypot(m,h));return{x:f.x+m/d*80,y:f.y+h/d*80}}):sn(r.minX-28,r.minY-28,r.maxX-r.minX+56,r.maxY-r.minY+56);return $(e,u,void 0,()=>-.04,-.22,i.ground,i.ground,W),!1}else{let s=t.reduce((p,b)=>b.baseHeightM<p.baseHeightM?b:p);e.setFloor(s.index);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(Nc(e,a,n,i)||Dc(e,a,n,c,i))return!1;if(Bc(e,s.baseHeightM,c,i))return!0;let l=n.filter((p,b)=>o[b]===s.index),u=Hr([s],l),f=Math.hypot(u.maxX-u.minX,u.maxY-u.minY),m=Math.max(28,Math.min(80,f*.04)),h=sn(u.minX-m,u.minY-m,u.maxX-u.minX+m*2,u.maxY-u.minY+m*2),d=s.baseHeightM-.03;return $(e,h,void 0,()=>d,d-.22,i.ground,i.ground,W),!1}}function jr(e,t,n,o){let{cx:r,cz:i,radius:s}=n,a=1/0,c=1/0,l=1/0,u=-1/0,f=-1/0,m=-1/0,h=(b,M,g)=>{a=Math.min(a,b),u=Math.max(u,b),c=Math.min(c,M),f=Math.max(f,M),l=Math.min(l,g),m=Math.max(m,g)};for(let b=0;b<e.position.length;b+=3){let M=b/3;o&&M>=o[0]&&M<o[1]||h(e.position[b],e.position[b+1],e.position[b+2])}for(let b=0;b<t.count;b++){let M=b*3,g=t.iPosition[M],S=t.iPosition[M+1],_=t.iPosition[M+2],I=Math.max(.35,t.iMaxRadius[b]??.35);h(g-I,S,_-I),h(g+I,S+1.6,_+I)}Number.isFinite(a)||(a=r-s,u=r+s,c=0,f=s*.16,l=i-s,m=i+s);let d=[(a+u)/2,(c+f)/2,(l+m)/2],p=Math.max(1,.5*Math.hypot(u-a,f-c,m-l));return{center:d,radius:p,minY:c,maxY:f}}var Xp=4096;function Hc(e,t,n=[]){let o=Math.max(1,Math.ceil(e.count/Xp)),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],u=e.iPosition[a*3+2];i[s++]=c,i[s++]=l,i[s++]=u,i[s++]=c,i[s++]=0,i[s++]=u}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 jc(e,t,n,o,r,i,s=[]){let a=1/0,c=1/0,l=-1/0,u=-1/0;for(let I=0;I<e.count;I++){let y=I*3,x=e.iPosition[y],P=e.iPosition[y+2];x<a&&(a=x),x>l&&(l=x),P<c&&(c=P),P>u&&(u=P)}for(let[I,,y]of s)I<a&&(a=I),I>l&&(l=I),y<c&&(c=y),y>u&&(u=y);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),u=Math.max(u,I.cz+I.halfZ);let f=n.minX*w,m=n.maxX*w,h=n.minY*w,d=n.maxY*w,p=f,b=m,M=h,g=d;if(Number.isFinite(a)){let I=Math.max(2,.06*Math.hypot(l-a,u-c));p=Math.max(f,a-I),b=Math.min(m,l+I),M=Math.max(h,c-I),g=Math.min(d,u+I)}let S=Math.min(0,o),_=Math.max(r,i*.05);return{min:[p,S,M],max:[b,_,g]}}var Fr=12,Kp=.5,Wp=6,Dr=.8,Lc=5,Yp=.6,zp=40,Gr=0,Tc=8;function Bc(e,t,n,o){let r=xn([...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)*w,u=Math.max(zp,l*Yp),f=I=>ot(r,I/w,1.2),m=f(Kp),h=[m,f(Wp),f(Fr),f(Fr+Lc),f(Fr+Lc+u)];if(h.some(I=>I.length!==m.length))return!1;let d=fe(o.ground,[.78,.76,.72],.35),p=fe(o.ground,[.56,.62,.52],.3),b=[d[0]*Dr,d[1]*Dr,d[2]*Dr],M=t-.04;e.setMaterial(Gr),$(e,m,void 0,()=>M,t-.22,b,b,W);let g=[0,1,0],S=(I,y,x,P,R)=>{let v=I.map(E=>[E.x*w,M,E.y*w]),T=y.map(E=>[E.x*w,M,E.y*w]),[k,C]=R;for(let E=0;E<v.length;E++){let A=(E+1)%v.length;e.tri(v[E],T[A],T[E],g,x,P,P,[k,C,C]),e.tri(v[E],v[A],T[A],g,x,x,P,[k,k,C])}},_=[Gr,Gr];return S(h[0],h[1],b,d,_),S(h[1],h[2],d,d,_),S(h[2],h[3],d,p,_),S(h[3],h[4],p,p,[Tc,Tc+1]),e.setMaterial(0),!0}function Nc(e,t,n,o){let r=bt(t,n);if(!r)return!1;let i=t.baseHeightM,s=fe(o.ground,[.62,.55,.47],.4);return $(e,r,void 0,()=>i-.04,i-.22,s,s,W),!0}var Zp=3e3,$p=20,Fc=1.5,Qp=1.2,qp=.25;function Dc(e,t,n,o,r){if(!n.length||n.length>Zp||o.length<3)return!1;for(let R of t.objects){if(R.type==="shape"&&St(R.stageKind))return!1;if(R.type==="section"){let{height:v}=mt(R,{floorBaseHeightM:t.baseHeightM});if(v-t.baseHeightM>$p)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,l=0;for(let R of o){let v=R.x-i,T=R.y-s;a+=v*v,c+=T*T,l+=v*T}let u=.5*Math.atan2(2*l,a-c),f=Math.cos(u),m=Math.sin(u),h=-m,d=f,p=1/0,b=-1/0,M=1/0,g=-1/0;for(let R of o){let v=(R.x-i)*f+(R.y-s)*m,T=(R.x-i)*h+(R.y-s)*d;p=Math.min(p,v),b=Math.max(b,v),M=Math.min(M,T),g=Math.max(g,T)}let S=R=>[[p-R,M-R],[b+R,M-R],[b+R,g+R],[p-R,g+R]].map(([v,T])=>({x:i+f*v+h*T,y:s+m*v+d*T})),_=S(Fc/w),I=S((Fc+qp)/w),y=t.baseHeightM,x=fe(r.ground,[.62,.55,.47],.4),P=fe(r.ground,[.86,.86,.84],.55);return $(e,I,void 0,()=>y-.04,y-.22,x,x,W),$(e,I,[_.slice().reverse()],()=>y+Qp,y-.04,fe(P,[1,1,1],.2),P,W),!0}function Vc(e,t,n){let o=()=>({byObjectId:new Map,elements:[]});if(!t||!e)return o();let r=pi(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]})),l=[];for(let f of r.value.overlay.productionElements??[]){let m=i.get(f.objectId),h=m?ce(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(P=>P.x*w),b=h.map(P=>P.y*w),M=m.unit.baseHeightM+d,g=Math.min(...p),S=Math.max(...p),_=Math.min(...b),I=Math.max(...b),y,x=c.get(f.id)??f.contentImageUrl;if(f.kind==="screen"&&x&&(y=Sa(h,M,M+f.heightM,m.unit.focal),!y))if(S-g>=I-_){let P=Math.abs(_-m.unit.focal.y*w)<=Math.abs(I-m.unit.focal.y*w)?_-.006:I+.006;y=[[g,M,P],[S,M,P],[g,M+f.heightM,P],[S,M+f.heightM,P]]}else{let P=Math.abs(g-m.unit.focal.x*w)<=Math.abs(S-m.unit.focal.x*w)?g-.006:S+.006;y=[[P,M,_],[P,M,I],[P,M+f.heightM,_],[P,M+f.heightM,I]]}l.push({id:f.id,objectId:f.objectId,kind:f.kind,floorIndex:m.unit.index,baseY:M,topY:M+f.heightM,bounds:{min:[g,M,_],max:[S,M+f.heightM,I]},occlusion:f.occlusion,...x?{contentImageUrl:x}:{},...y?{contentPlane:y}:{}})}let u=l.sort((f,m)=>f.id.localeCompare(m.id));return{byObjectId:new Map(u.map(f=>[f.objectId,f])),elements:u}}function Jp(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 ke(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function De(e){return Array.isArray(e)?e:[]}function eb(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 wn(e,t){return!Array.isArray(e)||e.length!==t||!e.every(n=>typeof n=="number"&&Number.isFinite(n))?null:e}function tb(){return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}function nb(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 ob(e){let t=wn(e.matrix,16);if(t)return t;if(e.matrix!==void 0)return null;let n=e.translation===void 0?[0,0,0]:wn(e.translation,3),o=e.rotation===void 0?[0,0,0,1]:wn(e.rotation,4),r=e.scale===void 0?[1,1,1]:wn(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 u=i/l,f=s/l,m=a/l,h=c/l,d=u+u,p=f+f,b=m+m,M=u*d,g=u*p,S=u*b,_=f*p,I=f*b,y=m*b,x=h*d,P=h*p,R=h*b;return[(1-(_+y))*r[0],(g+R)*r[0],(S-P)*r[0],0,(g-R)*r[1],(1-(M+y))*r[1],(I+x)*r[1],0,(S+P)*r[2],(I-x)*r[2],(1-(M+_))*r[2],0,n[0],n[1],n[2],1]}function rb(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 ib(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],u=i*l-s*c,f=s*a-r*l,m=r*c-i*a,h=t*u+n*f+o*m;if(Math.abs(h)<1e-12)return null;let d=1/h;return[u*d,f*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 Uc(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 sb(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 ab(e){return e===5120||e===5121?1:e===5122||e===5123?2:e===5125||e===5126?4:0}function cb(e){return e==="SCALAR"?1:e==="VEC2"?2:e==="VEC3"?3:e==="VEC4"?4:0}function lb(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 ub(e){let t=e instanceof Uint8Array?e:new Uint8Array(e),n=sb(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=De(o.extensionsUsed).filter(P=>typeof P=="string");if(i.includes("KHR_draco_mesh_compression")||eb(o))return{ok:!1,issue:"draco_not_allowed"};if(i.length||De(o.extensionsRequired).length)return{ok:!1,issue:"unsupported_glb"};if(De(o.images).length||De(o.textures).length)return{ok:!1,issue:"external_resource"};let s=De(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=De(o.accessors),c=De(o.bufferViews),l=De(o.meshes),u=De(o.nodes),f=De(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=(P,R,v,T=!1)=>{if(typeof P!="number"||!Number.isInteger(P)||!ke(a[P]))return null;let k=a[P],C=typeof R=="string"?k.type===R:R.includes(k.type),E=k.componentType!==5126,A=T&&E?k.normalized===!0:k.normalized!==!0;if(!C||k.sparse!==void 0||!A||typeof k.count!="number"||!Number.isInteger(k.count)||k.count<1||typeof k.componentType!="number"||!v.includes(k.componentType)||typeof k.bufferView!="number")return null;let O=c[k.bufferView];if(!ke(O)||O.buffer!==0||typeof O.byteLength!="number"||!Number.isInteger(O.byteLength)||O.byteLength<0)return null;let F=cb(k.type),L=ab(k.componentType),B=typeof O.byteStride=="number"?O.byteStride:F*L,D=typeof O.byteOffset=="number"?O.byteOffset:0,j=typeof k.byteOffset=="number"?k.byteOffset:0,G=D+j,V=j+(k.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 z=0;z<k.count;z++){let X=[];for(let Q=0;Q<F;Q++){let q=lb(h,G+z*B+Q*L,k.componentType);if(!Number.isFinite(q))return null;X.push(q)}U.push(X)}return U},p=[],b=[],M=[],g=!1,S=De(o.materials),_=P=>{if(P===void 0)return null;if(typeof P!="number"||!Number.isInteger(P)||!ke(S[P]))return!1;let R=S[P].pbrMetallicRoughness;if(R===void 0)return null;if(!ke(R))return!1;if(R.baseColorFactor===void 0)return null;let v=wn(R.baseColorFactor,4);return!v||v.some(T=>T<0||T>1)?!1:[v[0],v[1],v[2]]},I=0,y=new Set,x=(P,R)=>{if(typeof P!="number"||!Number.isInteger(P)||!ke(u[P])||y.has(P))return!1;y.add(P);let v=u[P],T=ob(v);if(!T)return!1;let k=nb(R,T),C=ib(k);if(!C)return!1;if(v.mesh!==void 0){if(typeof v.mesh!="number")return!1;let E=l[v.mesh];if(!ke(E))return!1;for(let A of De(E.primitives)){if(!ke(A)||A.mode!==void 0&&A.mode!==4||!ke(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=_(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,G=L!==null||B!==null;G&&(g=!0);let V=O.length;if(A.indices!==void 0){let z=typeof A.indices=="number"?a[A.indices]:null;V=ke(z)?z.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((z,X)=>[X]):d(A.indices,"SCALAR",[5121,5123,5125]);if(!U||U.length%3!==0||U.length!==V)return!1;for(let z=0;z<U.length;z+=3){let X=[U[z][0],U[z+1][0],U[z+2][0]];if(X.some(oe=>!Number.isInteger(oe)||oe<0||oe>=O.length))return!1;let Q=X.map(oe=>rb(k,...O[oe])),q=null;if(!F){let oe=Q[1][0]-Q[0][0],se=Q[1][1]-Q[0][1],le=Q[1][2]-Q[0][2],de=Q[2][0]-Q[0][0],pe=Q[2][1]-Q[0][1],_e=Q[2][2]-Q[0][2];q=Uc([1,0,0,0,1,0,0,0,1],se*_e-le*pe,le*de-oe*_e,oe*pe-se*de)}for(let oe=0;oe<3;oe++){if(p.push(...Q[oe]),b.push(...F?Uc(C,...F[X[oe]]):q),!G){M.push(-1,-1,-1);continue}let se=B?B[X[oe]]:null;for(let le=0;le<3;le++)M.push(Jp((L?L[le]:1)*(se?se[le]*j:1)))}}}}for(let E of De(v.children))if(!x(E,k))return!1;return y.delete(P),!0};for(let P of De(f[m].nodes))if(!x(P,tb()))return{ok:!1,issue:I>1e5?"triangle_limit":"unsupported_glb"};return!I||p.length!==I*9||b.length!==p.length?{ok:!1,issue:"unsupported_glb"}:{ok:!0,triangleCount:I,position:new Float32Array(p),normal:new Float32Array(b),color:g?new Float32Array(M):null}}function Xc(e){try{return ub(e)}catch{return{ok:!1,issue:"invalid_glb"}}}function Kc(e){let{doc:t}=e,n=ys(t,e.eventConfigurationId??t.eventConfigurationId),o=ji(t.theme,_s(n,e.seats)),r=o.structure,i=Vc(e.eventConfigurationId,e.eventConfiguration,n),s=e.seats,a=new Nn,c=null;if(e.registeredShellGlb){let H=Xc(e.registeredShellGlb);if(H.ok){let N=H.position.length/3,K=new Float32Array(H.position.length),Z=o.materials.shell??r.tierWall,te=H.color;for(let re=0;re<N;re++){let ue=H.normal[re*3+1],ae=ue<-.25?.4:.62+.38*Math.max(0,ue),Le=!!te&&te[re*3]!==-1;K[re*3]=(Le?te[re*3]:Z[0])*ae,K[re*3+1]=(Le?te[re*3+1]:Z[1])*ae,K[re*3+2]=(Le?te[re*3+2]:Z[2])*ae}c={position:H.position,normal:H.normal,color:K,floor:new Float32Array(N).fill(-2),material:new Float32Array(N),count:N}}}let l=new Map;for(let H of n)for(let N of H.objects)l.set(N.id,H.index),N.type==="section"&&l.set(N.logicalSectionId??N.id,H.index);let u=s.map(H=>l.get(H.sectionId??"")??l.get(H.rowId??"")??0),f=Hr(n,s),m=a.vertexCount,d=Gc(a,n,s,u,f,r)?a.vertexCount:m,p=Wi(t,s),b=new Map,M=new Map;for(let H of t.categories??[])b.set(H.key,H.color),H.seatGlyph&&M.set(H.key,H.seatGlyph);let g=[],S=Ma(n,s,u),_=new Map;s.forEach((H,N)=>{let K=S.seatDeckY(N);Number.isFinite(K)&&_.set(H.rowId,Math.min(_.get(H.rowId)??1/0,K))});let I=new Float32Array(s.length),y=[],x=new Map((t.floors??[]).map((H,N)=>[H.id,N])),P=n.map(()=>[]);for(let H of s){let N=H.floorId?x.get(H.floorId)??0:0;P[Math.min(N,P.length-1)]?.push(H)}let R=(H,N)=>{if(!N||N.length<3)return!1;let K=Math.min(...N.map(ue=>ue.x)),Z=Math.max(...N.map(ue=>ue.x)),te=Math.min(...N.map(ue=>ue.y)),re=Math.max(...N.map(ue=>ue.y));for(let ue=0;ue<H;ue++)for(let ae of P[ue])if(!(ae.x<K||ae.x>Z||ae.y<te||ae.y>re)&&Ee(ae,N,void 0))return!0;return!1},v=Qn(n),T=null,k=H=>n.length===1?s:s.filter((N,K)=>u[K]===H),C=(H,N)=>{let K=Je(H);if(!K)return!1;let Z=1/0,te=1/0,re=-1/0,ue=-1/0;for(let ae of K)Z=Math.min(Z,ae.x),re=Math.max(re,ae.x),te=Math.min(te,ae.y),ue=Math.max(ue,ae.y);return s.some((ae,Le)=>ae.kind!=="booth"&&(n.length===1||u[Le]===N)&&ae.x>Z&&ae.x<re&&ae.y>te&&ae.y<ue&&Ce(K,ae.x,ae.y))},E,A=[],O;for(let H=0;H<n.length;H++){let N=n[H];a.setFloor(H);let K=bt(N,k(H)),Z=0;if(K){let J=0;for(let Me of N.objects)if(Me.type==="section")for(let at of S.bySection.get(Me.id)?.rowLevels??[])J=Math.max(J,at.y-N.baseHeightM);Z=da(J);for(let Me of K)A.push([Me.x*w,Me.y*w]);if(O=Math.max(O??-1/0,N.baseHeightM+Z),!E){let Me=$t(K);E={centre:[Me.x*w,Me.y*w]}}}let te=new Kn,re=[],ue=N.objects.filter(J=>J.type==="shape"&&(J.role==="entrance"||J.role==="exit")),ae=N.objects.filter(J=>J.type==="section"&&!!J.outline&&J.outline.length>=3),Le=ja(N.objects.filter(J=>J.type==="booth"),N.focal);for(let J of N.objects)if(J.type==="section"){let Me=a.vertexCount;oc(a,J,N,Yi(J,p),S.bySection.get(J.id),te,ae,r,H>0&&R(H,J.outline));let at=a.vertexCount-Me;at>0&&y.push({sectionId:J.id,start:Me,count:at})}else if(J.type==="shape"){let Me=i.byObjectId.get(J.id);if(v.has(J)&&!Me)continue;let at=g.length,xt=K!==null&&J.role==="wall"&&!Me;a.setMaterial(xt?to:(Me?.kind??J.role)==="screen"?1:0);let Xe=J.role==="stage"&&!Me?Ua(J,k(H)):xt&&J.heightM===void 0?{...J,heightM:Z}:J,yo=Rs(Xe,re);if(Fa(a,Xe,N.baseHeightM+yo.supportOffsetM,yo.topOffsetM-yo.supportOffsetM,r,N.focal,g,Me,ue),a.setMaterial(0),J.role==="stage"&&!Me&&g.length>at&&(T??H)===H){T=H;let Vr=t.floors?.[H]?.id,go=n.length>1&&Vr?s.filter(Mt=>Mt.floorId===Vr):s;Ps(a,Xe,g[g.length-1].y,go,{deck:g[g.length-1].top,night:!wt(r)});let En=Ze(Xe.stageKind)?ce(Xe):null;En&&Zs(a,Xe,En,g[g.length-1].y,go,N.objects.some(Mt=>Mt.type==="shape"&&Mt.role==="goal"),N.objects.some(Mt=>Mt.type==="shape"&&Mt.role==="dugout")),En&&St(Xe.stageKind)&&$s(a,En,g[g.length-1].y,go,ao),a.setMaterial(0)}}else J.type==="gaArea"?Ga(a,J,N.baseHeightM,me(b.get(J.categoryKey)),r):J.type==="booth"?Ta(a,J,N.baseHeightM,me(b.get(J.categoryKey)),r,Le.get(J.id)??N.focal,C(J,H)):J.type==="table"?Na(a,J,Math.max(N.baseHeightM,_.get(J.id)??N.baseHeightM),me(J.fill??t.theme?.decorFill??"#232c40"),r,!!(J.fill??t.theme?.decorFill)):J.type==="decorImage"&&Da(a,J,N.baseHeightM,r);K&&Ic(a,N.objects,K,N.baseHeightM,Z,N.focal,r,J=>!i.byObjectId.has(J.id)),ic(a,N,s,S,r,o.materials.shell,!c)}let F=n.length>1?{x:n.reduce((H,N)=>H+N.focal.x,0)/n.length,y:n.reduce((H,N)=>H+N.focal.y,0)/n.length}:t.focalPoint??{x:(f.minX+f.maxX)/2,y:(f.minY+f.maxY)/2},L=Ei(c?[a.build(),c]:[a.build()]),B=new Map;for(let H of n)for(let N of H.objects)N.type==="table"&&B.set(N.id,N.center);let D=rs(s,e.initialState,S,I,b,M,new Set(B.keys())),j=Cc({doc:t,units:n,seats:s,surfaces:S,focal:F}),{labels:G,sections:V,rows:U}=vc({doc:t,units:n,seats:s,surfaces:S,seatData:D,hintedSeatFloor:u,zones:j,focal:F}),z=new Map(V.map((H,N)=>[H.id,N]));S.seatOwner.forEach((H,N)=>{D.iSection[N]=H?z.get(H)??-1:-1});let X=Oc({doc:t,units:n,seats:s,surfaces:S,solids:L,hintedSeatFloor:u,seatFloor:I});kc(G,X),D.iYaw=ns(D.iPosition,s.length,H=>s[H].rowId,H=>{let N=n[I[H]]?.focal??F;return[N.x*w,N.y*w]},H=>{let N=B.get(s[H].rowId);return N?[N.x*w,N.y*w]:void 0});let Q=(f.minX+f.maxX)/2*w,q=(f.minY+f.maxY)/2*w,oe=.5*Math.hypot((f.maxX-f.minX)*w,(f.maxY-f.minY)*w)||10,se=jr(L,D,{cx:Q,cz:q,radius:oe},[m,d]),le=jr(L,D,{cx:Q,cz:q,radius:oe}),de=mb(n),pe=jc(D,g,f,se.minY,se.maxY,oe,de),_e=!E&&n.some(H=>H.objects.some(N=>N.type==="shape"&&St(N.stageKind))),Oe=!!o.house&&!_e&&!c&&(!!E||o.house.indoor),Ge=g.flatMap(H=>[[H.cx-H.halfX,H.cz-H.halfZ],[H.cx+H.halfX,H.cz-H.halfZ],[H.cx+H.halfX,H.cz+H.halfZ],[H.cx-H.halfX,H.cz+H.halfZ]]),He=Oe?pa(D.iPosition,s.length,n[0]?.baseHeightM??0,[...Ge,...A],O):null;return{sharedAisles:Ai(n.flatMap(H=>H.objects.flatMap(N=>{if(N.type!=="section")return[];let K=S.bySection.get(N.id);return K?[{sectionId:N.id,floorIndex:H.index,rows:K.rowLevels}]:[]}))),solids:L,sectionSolidRanges:y,seats:D,seatSectionIds:S.seatOwner,bounds:{center:[(pe.min[0]+pe.max[0])/2,(pe.min[1]+pe.max[1])/2,(pe.min[2]+pe.max[2])/2],radius:oe,groundY:0,box:pe,fitPoints:Hc(D,g,de)},...E?{room:E}:{},..._e?{outdoor:!0}:{},...He?{house:He}:{},renderBounds:{center:se.center,radius:se.radius},clipBounds:{center:le.center,radius:le.radius},stateColorLUT:Vi(o,Hn),theme:o,seatCount:s.length,focalWorld:[F.x*w,1.5,F.y*w],zones:j,stages:g,productionElements:i.elements,sections:V,rows:U,labels:G,floors:X}}function mb(e){let t=[];for(let n of e)for(let o of n.objects){let r=o.type==="gaArea"?o.points:o.type==="booth"?Je(o):null;for(let i of r??[])t.push([i.x*w,n.baseHeightM,i.y*w])}return t}function hb(e,t){let{doc:n,report:o}=bc(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),u=e.floors?.map(h=>({...h,objects:l(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:u?.[0]?.objects??l(e.objects),...u?{floors:u}:{}},report:o,eyeHeightM:f,focal:m}}let i=new Map(Nt(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 u=i.get(c.id)??c;u.eyeHeightM!==void 0&&(s[l]=u.eyeHeightM),u.focalPoint&&(a[l*2]=u.focalPoint.x,a[l*2+1]=u.focalPoint.y)}),{doc:n,report:o,eyeHeightM:s,focal:a}}function db(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 Wc(e){let t=e.estimate===!1?null:hb(e.doc,e.seats);return t?{input:{...e,doc:t.doc,seats:db(e.seats,t)},estimate:t}:{input:e}}function pb(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].map(n=>n.buffer)}var Yc=self;Yc.onmessage=e=>{let t=performance.now(),n=!e.data.seats,o=e.data.seats??Nt(e.data.doc),{input:r,estimate:i}=Wc({doc:e.data.doc,seats:o,eventConfigurationId:e.data.eventConfigurationId,eventConfiguration:e.data.eventConfiguration,registeredShellGlb:e.data.registeredShellGlb,estimate:e.data.estimate}),s=Kc(r),a=pb(s);i&&a.push(i.eyeHeightM.buffer,i.focal.buffer),Yc.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)};