@seatlayer/core 0.107.0 → 0.108.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 (114) hide show
  1. package/dist/ar-4XB54QTY.js +1 -0
  2. package/dist/be-KLZHDRIH.js +1 -0
  3. package/dist/bg-XMPNFAE4.js +1 -0
  4. package/dist/ca-WYT6ZG2G.js +1 -0
  5. package/dist/{chunk-YPGONGDK.js → chunk-2BF6BWPQ.js} +1 -1
  6. package/dist/{chunk-45W3GKPP.js → chunk-2JFCDE27.js} +1 -1
  7. package/dist/chunk-AMCYMFES.js +1 -0
  8. package/dist/{chunk-T7DQX3MB.js → chunk-FBXZWNND.js} +1 -1
  9. package/dist/{chunk-QXJEN5LV.js → chunk-GN7YFZEE.js} +1 -1
  10. package/dist/{chunk-BBPJXOTD.js → chunk-JJQHRGLB.js} +1 -1
  11. package/dist/{chunk-RI4LNRP4.js → chunk-MRLWH6RC.js} +1 -1
  12. package/dist/{chunk-N562FZPD.js → chunk-UUIZHJYL.js} +1 -1
  13. package/dist/{chunk-VBNOTYBG.js → chunk-WRAPI4MD.js} +1 -1
  14. package/dist/chunk-YE4NP3XB.js +1 -0
  15. package/dist/{chunk-74TZDIMP.js → chunk-ZYQXT5JP.js} +1 -1
  16. package/dist/core/chart-ops/index.cjs +1 -1
  17. package/dist/core/chart-ops/index.d.cts +2 -0
  18. package/dist/core/chart-ops/index.d.ts +2 -0
  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/render-assets/index.js +1 -1
  25. package/dist/core/sections/index.cjs +1 -1
  26. package/dist/core/sections/index.js +1 -1
  27. package/dist/cs-VI6ZFW3W.js +1 -0
  28. package/dist/cy-SSKV6GSC.js +1 -0
  29. package/dist/da-JTUYTKF7.js +1 -0
  30. package/dist/de-PTLT7LEG.js +1 -0
  31. package/dist/el-ITGBSCWL.js +1 -0
  32. package/dist/es-KUQQWYJ5.js +1 -0
  33. package/dist/et-MZFLMK6L.js +1 -0
  34. package/dist/fa-A7LBVFTD.js +1 -0
  35. package/dist/fi-OYLJTXQY.js +1 -0
  36. package/dist/fr-L33SPCCR.js +1 -0
  37. package/dist/he-QSX5SF57.js +1 -0
  38. package/dist/hi-5DKU347L.js +1 -0
  39. package/dist/hr-7SY5XRY6.js +1 -0
  40. package/dist/hu-AQB3JN6P.js +1 -0
  41. package/dist/id-4TY5ZAHI.js +1 -0
  42. package/dist/index.cjs +1 -1
  43. package/dist/index.js +1 -1
  44. package/dist/it-IUWZG4Z6.js +1 -0
  45. package/dist/ja-4PMRPBSH.js +1 -0
  46. package/dist/ko-H5D35A6L.js +1 -0
  47. package/dist/ku-7Y7VDNCB.js +1 -0
  48. package/dist/localeLoaders-KSTMCSWV.js +1 -0
  49. package/dist/lt-ZES4SCGW.js +1 -0
  50. package/dist/{lv-3ZE6IM47.js → lv-LXAQ22CA.js} +1 -1
  51. package/dist/{ms-LF5QQTFJ.js → ms-VPTERFXE.js} +1 -1
  52. package/dist/{nl-D4FX7T7U.js → nl-O7UK52HY.js} +1 -1
  53. package/dist/no-L7OELSHF.js +1 -0
  54. package/dist/pl-XNMMBKRN.js +1 -0
  55. package/dist/pt-YRDKXE7N.js +1 -0
  56. package/dist/ro-EZU7TACJ.js +1 -0
  57. package/dist/ru-7RNK67OV.js +1 -0
  58. package/dist/sk-GA3IE3XR.js +1 -0
  59. package/dist/sl-W37U4474.js +1 -0
  60. package/dist/sr-7SZMN6JH.js +1 -0
  61. package/dist/sv-JSKU4AOJ.js +1 -0
  62. package/dist/th-TUL4LIOY.js +1 -0
  63. package/dist/tr-4DTHZSPV.js +1 -0
  64. package/dist/uk-QWTYZDPU.js +1 -0
  65. package/dist/vi-ZWTCP44F.js +1 -0
  66. package/dist/view3d/index.cjs +32 -32
  67. package/dist/view3d/index.js +4 -4
  68. package/dist/view3d/scene/scene.worker.cjs +1 -1
  69. package/dist/view3d/scene/scene.worker.js +1 -1
  70. package/dist/zh-Hans-B4CBZXWY.js +1 -0
  71. package/dist/zh-Hant-WMYDTUYW.js +1 -0
  72. package/package.json +1 -1
  73. package/dist/ar-D6ASWQBI.js +0 -1
  74. package/dist/be-T23MSCFC.js +0 -1
  75. package/dist/bg-2MMSY43I.js +0 -1
  76. package/dist/ca-HSW3LSXH.js +0 -1
  77. package/dist/chunk-227OYVC4.js +0 -1
  78. package/dist/chunk-J33DNOMI.js +0 -1
  79. package/dist/cs-W36YX555.js +0 -1
  80. package/dist/cy-6264NCZV.js +0 -1
  81. package/dist/da-QPYLJUH7.js +0 -1
  82. package/dist/de-Q5VU4NBN.js +0 -1
  83. package/dist/el-HYLFHJC3.js +0 -1
  84. package/dist/es-N35HVHMD.js +0 -1
  85. package/dist/et-HQUPUM5Y.js +0 -1
  86. package/dist/fa-JL3HW42Q.js +0 -1
  87. package/dist/fi-ZFWROLPU.js +0 -1
  88. package/dist/fr-6EKBGKIT.js +0 -1
  89. package/dist/he-KSOTIRJW.js +0 -1
  90. package/dist/hi-72CF2RXB.js +0 -1
  91. package/dist/hr-2CRBTSQT.js +0 -1
  92. package/dist/hu-Y33MEJPT.js +0 -1
  93. package/dist/id-UW2QRTC3.js +0 -1
  94. package/dist/it-XFIJHKQA.js +0 -1
  95. package/dist/ja-LHVHSM5J.js +0 -1
  96. package/dist/ko-MCXETVAQ.js +0 -1
  97. package/dist/ku-MNPV6BJJ.js +0 -1
  98. package/dist/localeLoaders-UTZMQJQF.js +0 -1
  99. package/dist/lt-OVUV42OZ.js +0 -1
  100. package/dist/no-JLXHCMSU.js +0 -1
  101. package/dist/pl-TR5U2EPQ.js +0 -1
  102. package/dist/pt-HRM4OUMU.js +0 -1
  103. package/dist/ro-UFIOIOVH.js +0 -1
  104. package/dist/ru-VMRD53B7.js +0 -1
  105. package/dist/sk-4DALII6N.js +0 -1
  106. package/dist/sl-CDZGH6C6.js +0 -1
  107. package/dist/sr-KMFWIJPY.js +0 -1
  108. package/dist/sv-2JROBNJB.js +0 -1
  109. package/dist/th-MF3TSZDL.js +0 -1
  110. package/dist/tr-76YSRBN3.js +0 -1
  111. package/dist/uk-JQKEV42K.js +0 -1
  112. package/dist/vi-KRM5S2Q7.js +0 -1
  113. package/dist/zh-Hans-FEUYIOYS.js +0 -1
  114. package/dist/zh-Hant-PK2XOE2G.js +0 -1
@@ -1 +1 @@
1
- "use strict";var va=Object.create;var $o=Object.defineProperty;var Ca=Object.getOwnPropertyDescriptor;var ka=Object.getOwnPropertyNames;var Oa=Object.getPrototypeOf,Ta=Object.prototype.hasOwnProperty;var La=(e,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of ka(t))!Ta.call(e,r)&&r!==n&&$o(e,r,{get:()=>t[r],enumerable:!(o=Ca(t,r))||o.enumerable});return e};var Ge=(e,t,n)=>(n=e!=null?va(Oa(e)):{},La(t||!e||!e.__esModule?$o(n,"default",{value:e,enumerable:!0}):n,e));var Jh=Math.PI/180;function Se(e,t){return Math.hypot(e.x-t.x,e.y-t.y)}function Vn(e,t,n){return{x:e.x+(t.x-e.x)*n,y:e.y+(t.y-e.y)*n}}function Un(e){let t=0,n=0;for(let r of e)t+=r.x,n+=r.y;let o=e.length||1;return{x:t/o,y:n/o}}function ht(e){return e.length?Un(e):null}function Qo(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 qo(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[Qo(e,.5)];let o=Array.from({length:n+1},(c,u)=>Qo(e,u/n)),r=new Float64Array(o.length);for(let c=1;c<o.length;c+=1){let u=o[c].x-o[c-1].x,l=o[c].y-o[c-1].y;r[c]=r[c-1]+Math.hypot(u,l)}let i=r[r.length-1];if(i<=1e-9)return Array.from({length:t},()=>({...e.start}));let s=[],a=1;for(let c=0;c<t;c+=1){let u=i*c/(t-1);for(;a<r.length-1&&r[a]<u;)a+=1;let l=r[a-1],f=r[a],m=f===l?0:(u-l)/(f-l);s.push({x:o[a-1].x+(o[a].x-o[a-1].x)*m,y:o[a-1].y+(o[a].y-o[a-1].y)*m})}return s}function Xn(e,t,n){return Math.max(t,Math.min(n,e))}function Ba(e){return Xn(e,0,1)}function Jo(e){let t=Ba(e);return t*t*(3-2*t)}var dt=Math.PI*2;function pt(e){return Number.isFinite(e.x)&&Number.isFinite(e.y)}function Fa(e,t,n){let o=t-e;if(n){for(;o<0;)o+=dt;for(;o>=dt;)o-=dt}else{for(;o>0;)o-=dt;for(;o<=-dt;)o+=dt}return o}function nr(e){if(e.version!==1||e.closed!==!0||!pt(e.start)||!Array.isArray(e.segments)||e.segments.length<2||e.segments.length>512)return!1;let t=e.start;for(let n of e.segments){if(!n||!pt(n.end))return!1;if(n.kind==="line"){if(Se(t,n.end)<=1e-9)return!1}else if(n.kind==="bezier"){if(!pt(n.control1)||!pt(n.control2)||Se(t,n.end)<=1e-9)return!1}else if(n.kind==="arc"){if(!pt(n.center)||!Number.isFinite(n.radius)||n.radius<=1e-6||Math.abs(Se(t,n.center)-n.radius)>Math.max(1e-4,n.radius*1e-4)||Math.abs(Se(n.end,n.center)-n.radius)>Math.max(1e-4,n.radius*1e-4)||Se(t,n.end)<=1e-9)return!1}else return!1;t=n.end}return Se(t,e.start)<=1e-4}function Na(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 or(e,t=2){if(!nr(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=Fa(s,a,i.clockwise),u=Math.max(2,Math.ceil(Math.abs(c)*i.radius/n));for(let l=1;l<=u;l+=1){let f=s+c*l/u;o.push({x:i.center.x+Math.cos(f)*i.radius,y:i.center.y+Math.sin(f)*i.radius})}}else{let s=Se(r,i.control1)+Se(i.control1,i.control2)+Se(i.control2,i.end),a=Math.max(2,Math.ceil(s/n));for(let c=1;c<=a;c+=1)o.push(Na(r,i,c/a))}r=i.end}return Se(o[o.length-1],o[0])<=1e-4&&o.pop(),o}var Da=45,Kn=150,Ga=60;function ja(e){let t=Da/100;if(e<=t)return Kn;let n=Math.min(1,(e-t)/(1-t));return Kn-n*(Kn-Ga)}var er=.5523;function tr(e,t){return Math.abs(e.x-t.x)<=1e-6&&Math.abs(e.y-t.y)<=1e-6}function Ha(e){let t=[],n=[];for(e.forEach((o,r)=>{pt(o)&&(t.length&&tr(t[t.length-1],o)||(t.push({x:o.x,y:o.y}),n.push(r)))});t.length>1&&tr(t[0],t[t.length-1]);)t.pop(),n.pop();return{points:t,sourceIndex:n}}var Va=.5,Ua=4/3;function Xa(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*Ua;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 rr(e,t){let{points:n,sourceIndex:o}=Ha(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 R=0;R<r;R+=1){let x=s[o[R]];a[R]=Number.isFinite(x)?Math.min(100,Math.max(-100,x))/100:0}let c=a.some(R=>Math.abs(R)>1e-6);if(i<=0&&!c)return null;let u=t.wideAngleThresholdDeg??ja(i),l=[];for(let R=0;R<r;R+=1)l[R]=Se(n[R],n[(R+1)%r]);let f=new Array(r).fill(0);for(let R=0;R<r;R+=1){let x=n[(R-1+r)%r],b=n[R],S=n[(R+1)%r],I={x:x.x-b.x,y:x.y-b.y},w={x:S.x-b.x,y:S.y-b.y},k=Math.hypot(I.x,I.y),L=Math.hypot(w.x,w.y);if(k<=1e-9||L<=1e-9)continue;let T=Math.min(1,Math.max(-1,(I.x*w.x+I.y*w.y)/(k*L))),v=Math.acos(T)*180/Math.PI;if(v<u)continue;let A=Jo((v-u)/(180-u));f[R]=i*A*.5*Math.min(k,L)}for(let R=0;R<r;R+=1){let x=(R+1)%r,b=f[R]+f[x];if(b>l[R]&&b>1e-9){let S=l[R]/b;f[R]*=S,f[x]*=S}}let m=new Array(r),h=new Array(r);for(let R=0;R<r;R+=1){let x=n[(R-1+r)%r],b=n[R],S=n[(R+1)%r];if(f[R]<=1e-6){m[R]={...b},h[R]={...b};continue}let I=Se(b,x)||1,w=Se(b,S)||1;m[R]={x:b.x+(x.x-b.x)/I*f[R],y:b.y+(x.y-b.y)/I*f[R]},h[R]={x:b.x+(S.x-b.x)/w*f[R],y:b.y+(S.y-b.y)/w*f[R]}}if(f.every(R=>R<=1e-6)&&!c)return null;let d=[],p={...h[0]},y=p,g=(R,x)=>{if(Se(y,R)<=1e-9)return;let b=a[x];Math.abs(b)>1e-6?d.push(Xa(y,R,b*Va*l[x])):d.push({kind:"line",end:{...R}}),y=R};for(let R=1;R<=r;R+=1){let x=R%r,b=n[x];g(m[x],(R-1)%r),f[x]>1e-6&&Se(m[x],h[x])>1e-9&&(d.push({kind:"bezier",control1:Vn(m[x],b,er),control2:Vn(h[x],b,er),end:{...h[x]}}),y=h[x])}if(!d.length)return null;let M=d[d.length-1];Se(M.end,p)>1e-9&&(M.kind==="line"?M.end={...p}:d.push({kind:"line",end:{...p}}));let P={version:1,closed:!0,start:p,segments:d};return nr(P)?P:null}function Ka(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 Ya(e){let t=Ka(e);return t.length?rr(e.points,{edgeCurvature:t}):null}function en(e,t=2){let n=Ya(e);return n?or(n,t):e.points??[]}function ir(e){return e.kind==="polygon"?Lt(e.holes):[]}function ar(e){let t=new Map,n=new Map;for(let o of e){if(o.type!=="row"||!o.segmentedRow)continue;let r=n.get(o.segmentedRow.groupId)??[];r.push(o),n.set(o.segmentedRow.groupId,r)}for(let[o,r]of n){let i=r.slice().sort((m,h)=>m.segmentedRow.componentIndex-h.segmentedRow.componentIndex),s=i[0]?.segmentedRow?.componentCount??0,a=i[0]?.segmentedRow;if(!a||!(s>=2&&i.length===s&&a?.boundaryBefore==="start"&&i.every((m,h)=>m.segmentedRow?.kind==="segmented-row-v1"&&m.segmentedRow.groupId===o&&m.segmentedRow.componentCount===s&&m.segmentedRow.componentIndex===h&&m.segmentedRow.repeatLabelOnComponents===a.repeatLabelOnComponents&&(h===0?m.segmentedRow.boundaryBefore==="start":m.segmentedRow.boundaryBefore!=="start")&&m.segmentedRow.displayLabel===a.displayLabel)))continue;let u=i.reduce((m,h)=>m+h.seatCount,0),l=0,f=0;for(let m of i)m.segmentedRow.boundaryBefore==="break"&&(l+=1),t.set(m.id,{groupId:o,adjacencyOffset:l,displayOffset:f,displayLabel:a.displayLabel,totalSeats:u,canonical:i[0],viewFromSeatUrl:a.viewFromSeatUrl,viewFromSeatMeta:a.viewFromSeatMeta,confidenceEvidence:a.confidenceEvidence}),l+=m.seatCount,f+=m.seatCount}return t}var Wa="ABCDEFGHIJKLMNOPQRSTUVWXYZ";var za="abcdefghijklmnopqrstuvwxyz";function Za(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 Bt(e,t=!1){let n=t?za:Wa;return Za(Math.max(0,Math.floor(e)-1),n)}var $a=[[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 cr(e){if(!Number.isFinite(e)||e<=0)return String(e);let t=Math.floor(e),n="";for(let[o,r]of $a)for(;t>=o;)n+=r,t-=o;return n}function Qa(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 Wn(e,t){let n=e.seatLabelStart??1,o=e.seatNumbering?.direction??"ltr",r=e.seatNumbering?.step??1,i=e.seatNumbering?.scheme??"decimal",s=e.seatNumbering?.prefix??"",a=e.seatNumbering?.endAt,c=e.seatCount;if(i==="updown"||i==="updown-descending"){let h=Math.ceil(c/2),d=i==="updown"?t<h?n+2*t:n-1+2*(c-t):t<h?n+2*(h-1-t):n+1+2*(t-h);return`${s}${d}`}let u=i==="odd"||i==="even"?2:r,l=a!=null&&Number.isFinite(a)?a-(c-1)*u:n,f=o==="center"?Qa(c)[t]:o==="rtl"?c-1-t:t,m;switch(i){case"odd":{let h=l%2===1?l:l+1;m=String(h+f*2);break}case"even":{let h=l%2===0?l:l+1;m=String(h+f*2);break}case"roman":m=cr(l+f*r);break;case"letters-upper":m=Bt(l+f*r,!1);break;case"letters-lower":m=Bt(l+f*r,!0);break;default:m=String(l+f*r);break}return`${s}${m}`}function qa(e){return{...e.canonical,seatCount:e.totalSeats,label:e.displayLabel,displayLabel:e.displayLabel}}function lr(e,t,n){return n?.label??`${e.seatLabelBase??e.label}-${Wn(e,t)}`}function Ja(e,t,n,o){if(o?.displayLabel)return null;if(e.seatDisplayLabelMode==="number"||!n)return{row:e.displayLabel||e.label,seat:Wn(e,t)};let r=qa(n);return{row:n.displayLabel,seat:Wn(r,n.displayOffset+t)}}function zn(e,t,n,o){let r=Ja(e,t,n,o);return r?e.seatDisplayLabelMode==="number"?r.seat:`${r.row}-${r.seat}`:o.displayLabel}function ur(e,t){return`${e.label}-${t+1}`}function ec(e,t,n){return e?.direction==="anticlockwise"?Math.max(0,t-1-n):n}function tc(e,t){let n=e.chairNumbering,o=n?.start??1,r=ec(n,Math.max(0,Math.round(e.seatCount)),t);return n?.format==="letter"?Bt(Math.max(1,o)+r):String(o+r)}function fr(e,t){let n=tc(e,t);return(e.chairNumbering?.format??"table-number")==="table-number"?`${e.displayLabel??e.label}-${n}`:n}var $=.02291666666666667,Oe=1/$,nc=58,oc=nc*$;var rc=3,mr=0,Zn=120,ic=0,sc=45,ac=7,je=1.2;function $n(e,t,n,o){return Number.isFinite(e)?Math.max(t,Math.min(n,e)):o}function cc(e){return!Number.isFinite(e)||!Number.isInteger(e)||e<0?0:e<=ac?e:rc}function Qe(e,t={}){let n=$n(t.floorBaseHeightM,mr,Zn,0),o=Math.min(Zn,n+cc(e.elevation)*oc),r=e.height===void 0?o:$n(e.height,mr,Zn,o),i=$n(e.rake,ic,sc,0);return{height:r,rake:i}}function hr(e){let t=e.length;return t<=3?[...e]:[e[Math.floor(t*.25)],e[Math.floor(t*.5)],e[Math.floor(t*.75)]]}function bt(e,t,n){if(!e.length)return 1/0;if(e.length===1)return Math.hypot(t-e[0].x,n-e[0].y);let o=1/0;for(let r=0;r+1<e.length;r++){let i=e[r],s=e[r+1],a=s.x-i.x,c=s.y-i.y,u=a*a+c*c,l=u>1e-12?((t-i.x)*a+(n-i.y)*c)/u:0;l<0?l=0:l>1&&(l=1);let f=t-(i.x+l*a),m=n-(i.y+l*c);if(Math.abs(f)>=o||Math.abs(m)>=o)continue;let h=Math.hypot(f,m);h<o&&(o=h)}return o}function lc(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 dr(e,t){return Math.hypot(e.cx-t.cx,e.cy-t.cy)-e.r-t.r}function Qn(e,t){let n=1/0;for(let o of hr(e)){let r=bt(t,o.x,o.y);r<n&&(n=r)}for(let o of hr(t)){let r=bt(e,o.x,o.y);r<n&&(n=r)}return n}function uc(e,t){if(e.length<3)return{pts:e,seatIndices:t};let n=0,o=0;for(let l of e)n+=l.x,o+=l.y;n/=e.length,o/=e.length;let r=-1,i=e[0];for(let l of e){let f=Math.hypot(l.x-n,l.y-o);f>r&&(r=f,i=l)}let s=i.x-n,a=i.y-o,c=Math.hypot(s,a);c>1e-9?(s/=c,a/=c):(s=1,a=0);let u=e.map((l,f)=>({p:l,i:f,t:(l.x-n)*s+(l.y-o)*a})).sort((l,f)=>l.t-f.t);return{pts:u.map(l=>l.p),seatIndices:u.map(l=>t[l.i])}}function qn(e){let t=e.length;if(t<3)return null;let n=0,o=0;for(let M of e)n+=M.x,o+=M.y;n/=t,o/=t;let r=0,i=0,s=0,a=0,c=0,u=0,l=0;for(let M of e){let P=M.x-n,R=M.y-o;r+=P*P,s+=R*R,i+=P*R,a+=P*P*P,c+=R*R*R,u+=P*R*R,l+=R*P*P}let f=r*s-i*i;if(Math.abs(f)<1e-9)return null;let m=(a+u)/2,h=(c+l)/2,d=(m*s-h*i)/f,p=(h*r-m*i)/f,y=d+n,g=p+o;return!Number.isFinite(y)||!Number.isFinite(g)?null:{cx:y,cy:g}}var fc=.15;function mc(e){if(e.length<2)return null;let t=e.map(x=>{let b=0,S=0;for(let I of x.pts)b+=I.x,S+=I.y;return{x:b/x.pts.length,y:S/x.pts.length}}),n=0,o=0;for(let x of t)n+=x.x,o+=x.y;n/=t.length,o/=t.length;let r=0,i=0,s=0;for(let x of t){let b=x.x-n,S=x.y-o;r+=b*b,i+=b*S,s+=S*S}let a=r+s,c=r*s-i*i,u=a/2+Math.sqrt(Math.max(0,a*a/4-c)),l,f;Math.abs(i)>1e-12?(l=u-s,f=i):r>=s?(l=1,f=0):(l=0,f=1);let m=Math.hypot(l,f);if(!(m>1e-12))return null;l/=m,f/=m;let h=0,d=0,p=0;for(let x of e){if(x.pts.length<2)continue;let b=x.pts[0],S=x.pts[x.pts.length-1],I=S.x-b.x,w=S.y-b.y,k=Math.hypot(I,w);if(!(k>1e-9))continue;let L=I/k,T=w/k;h+=(L*L-T*T)*k,d+=2*L*T*k,p+=k}if(p>0&&Math.hypot(h,d)>=dc*p){let x=Math.atan2(d,h)/2;l=-Math.sin(x),f=Math.cos(x)}let y=1/0,g=-1/0,M=[];for(let x of e){let b=1/0,S=-1/0;for(let I of x.pts){let w=I.x*l+I.y*f;w<b&&(b=w),w>S&&(S=w),w<y&&(y=w),w>g&&(g=w)}M.push(S-b)}let P=g-y;return P>1e-9?(M.sort((x,b)=>x-b),M[Math.min(M.length-1,Math.floor(M.length*.9))]/P<=hc?{x:l,y:f}:null):null}var hc=.35,dc=.8;function tn(e,t,n,o){let r=new Map;for(let b of n){let S=t[b],I=S.rowId||`__seat-${b}`,w=r.get(I);w||(w={pts:[],idx:[]},r.set(I,w)),w.pts.push({x:S.x,y:S.y}),w.idx.push(b)}if(!r.size)return{sectionId:e,rows:[],blockCount:0};let i=[];for(let[b,S]of r){let I=uc(S.pts,S.idx),w=0;for(let k of I.pts)w+=Math.hypot(k.x-o.x,k.y-o.y);i.push({id:b,pts:I.pts,seatIndices:I.seatIndices,blockId:-1,ordinal:0,blockDepth:0,focalDistance:w/I.pts.length})}let s=i.map(b=>lc(b.pts)),a=i.length<=256?i.length*(i.length-1)/2:0,c=a?new Float64Array(a):null;c?.fill(Number.NaN);let u=c?new Map(i.map((b,S)=>[b,S])):null,l=(b,S)=>(b>S&&([b,S]=[S,b]),b*(2*i.length-b-1)/2+(S-b-1)),f=(b,S)=>{if(!c)return Qn(i[b].pts,i[S].pts);let I=l(b,S),w=c[I];if(!Number.isNaN(w))return w;let k=Qn(i[b].pts,i[S].pts);return c[I]=k,k},m=(b,S)=>u?f(u.get(b),u.get(S)):Qn(b.pts,S.pts),h=[];for(let b=0;b<i.length;b++){let S=1/0;for(let I=0;I<i.length;I++){if(b===I||dr(s[b],s[I])>=S)continue;let w=f(b,I);w<S&&(S=w)}Number.isFinite(S)&&h.push(S)}h.sort((b,S)=>b-S);let d=h.length?h[Math.floor(h.length/2)]:1,p=Math.max(d*1.8,1e-6),y=i.map(()=>[]);for(let b=0;b<i.length;b++)for(let S=b+1;S<i.length;S++)dr(s[b],s[S])>p||f(b,S)<=p&&(y[b].push(S),y[S].push(b));let g=0;for(let b=0;b<i.length;b++){if(i[b].blockId!==-1)continue;let S=g++,I=[b];for(i[b].blockId=S;I.length;){let w=I.pop();for(let k of y[w])i[k].blockId===-1&&(i[k].blockId=S,I.push(k))}}let M=new Map;for(let b of i){let S=M.get(b.blockId)??[];S.push(b),M.set(b.blockId,S)}let P=[];for(let b of i){if(b.pts.length<4)continue;let S=qn(b.pts);S&&(!Number.isFinite(S.cx)||!Number.isFinite(S.cy)||P.push({x:S.cx,y:S.cy}))}let R=P.length>=2?(()=>{let b=P.map(w=>w.x).sort((w,k)=>w-k),S=P.map(w=>w.y).sort((w,k)=>w-k),I=Math.floor(P.length/2);return{cx:b[I],cy:S[I]}})():null;if(R){let b=T=>Math.hypot(T.x-R.cx,T.y-R.cy),S=1/0,I=-1/0,w=[];for(let T of i){let v=1/0,A=-1/0;for(let _ of T.pts){let C=b(_);C<v&&(v=C),C>A&&(A=C)}w.push(A-v),v<S&&(S=v),A>I&&(I=A)}let k=I-S;w.sort((T,v)=>T-v);let L=w[Math.min(w.length-1,Math.floor(w.length*.9))];if(k>1e-9&&L/k<=fc){let T=i.map(N=>{let X=0;for(let V of N.pts)X+=b(V);return{row:N,radius:X/N.pts.length}}),v=0,A=0;for(let N of T)v+=N.radius,A+=N.row.focalDistance;v/=T.length,A/=T.length;let _=0;for(let N of T)_+=(N.radius-v)*(N.row.focalDistance-A);if(_<0)for(let N of T)N.radius=-N.radius;let B=1/0;for(let N of T)N.radius<B&&(B=N.radius);T.sort((N,X)=>N.radius-X.radius);let O=-1,F=-1/0,D=k/Math.max(1,T.length)*.5,j=[];for(let N of T)N.radius-F>D&&(O++,F=N.radius),N.row.ordinal=O,N.row.blockDepth=N.radius-B,j.push(N.row);return{sectionId:e,rows:j,blockCount:g}}}let x=[];for(let[,b]of M){let S=mc(b);if(S){let I=T=>{let v=0;for(let A of T.pts)v+=A.x*S.x+A.y*S.y;return v/T.pts.length};b.sort((T,v)=>I(T)-I(v)),b.length>=2&&b[0].focalDistance>b[b.length-1].focalDistance&&b.reverse();let w=[],k=d*.5;for(let T of b){let v=w[w.length-1];v&&Math.abs(I(T)-I(v[0]))<k?v.push(T):w.push([T])}let L=0;for(let T=0;T<w.length;T++){if(T>0){let v=1/0;for(let A of w[T-1])for(let _ of w[T])v=Math.min(v,m(A,_));L+=v}for(let v of w[T])v.ordinal=T,v.blockDepth=L,x.push(v)}}else{let I=1/0;for(let w of b)w.focalDistance<I&&(I=w.focalDistance);b.sort((w,k)=>w.focalDistance-k.focalDistance);for(let w=0;w<b.length;w++)b[w].ordinal=w,b[w].blockDepth=Math.max(0,b[w].focalDistance-I),x.push(b[w])}}return{sectionId:e,rows:x,blockCount:g}}var pc=/^\d{4}-\d{2}-\d{2}$/;function bc(e){let t=Date.parse(e);return Number.isFinite(t)?pc.test(e)?t+864e5:t:null}function yc(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=bc(e.validUntil);return n===null?!1:(t instanceof Date?t.getTime():t)<n}function gc(e,t,n){return!(e.eventConfigurationId&&e.eventConfigurationId!==t||e.eventConfigurationVersion!==void 0&&e.eventConfigurationVersion!==n)}function xc(e){return e.status!=="draft"&&e.status!=="retracted"}function Mc(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 pr(e,t={}){return!!e&&xc(e)&&gc(e,t.activeConfigurationId,t.activeConfigurationVersion)&&Mc(e,t.activeBasisSha256)&&yc(e,t.now)}var Sc=new Set(["pitch-football","rink-hockey","track-athletics","oval-cricket","pitch-rugby","diamond-baseball","court-basketball","court-tennis","ring-boxing"]),Pc=new Set(["pitch-football","track-athletics","oval-cricket","pitch-rugby","diamond-baseball"]);function st(e){return!!e&&Sc.has(e)}function nn(e){return!!e&&Pc.has(e)}var Jn=1.1;function gr(e){return rn(e)?e==="ring-boxing"?Jn:.06:1}var Ic={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}},Rc={"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 wc=Math.PI*2;function Ec(e,t,n,o,r,i){return{x:r+e*n-t*o,y:i+e*o+t*n}}function br(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 yr=(()=>{let t={x:0,y:52},n=25,o={x:70,y:t.y-70},r=(o.x*o.x+o.y*o.y-4900)/(2*(o.y+70)),i=r+70,s=[],a=Math.atan2(o.y-r,o.x),c=Math.atan2(o.y-r,-o.x);for(let u=0;u<=24;u++){let l=a+(c-a)*u/24;s.push({x:i*Math.cos(l),y:r+i*Math.sin(l)})}return{half:70,home:t,backstop:n,fence:s}})();var on="#f1f5f9";function rn(e){return st(e)}function qe(e,t,n,o,r=32){let i=[];for(let s=0;s<r;s++){let a=s/r*wc;i.push({x:e+n*Math.cos(a),y:t+o*Math.sin(a)})}return i}function Ke(e,t,n,o){return[{x:e-n,y:t-o},{x:e+n,y:t-o},{x:e+n,y:t+o},{x:e-n,y:t+o}]}function Ac(e){let{kind:t,cx:n,cy:o,width:r,height:i}=e,s=(e.rotation??0)*Math.PI/180,a=Math.cos(s),c=Math.sin(s),u=r/2,l=i/2,f=[],m=Ic[t],h=p=>m?p/m.width*r:0,d=p=>m?p/m.height*i:0;switch(t){case"pitch-football":{f.push({points:[{x:0,y:-l},{x:0,y:l}],closed:!1}),f.push({points:qe(0,0,h(9.15),d(9.15)),closed:!0});for(let p of[-1,1])f.push({points:Ke(p*(u-h(16.5)/2),0,h(16.5)/2,d(40.32)/2),closed:!0}),f.push({points:Ke(p*(u-h(5.5)/2),0,h(5.5)/2,d(18.32)/2),closed:!0});break}case"rink-hockey":{f.push({points:[{x:0,y:-l},{x:0,y:l}],closed:!1,ink:"#d63b3b"});for(let p of[-1,1]){f.push({points:[{x:p*h(7.5),y:-l},{x:p*h(7.5),y:l}],closed:!1,ink:"#2f6ecb"}),f.push({points:[{x:p*(u-h(4)),y:-d(11)},{x:p*(u-h(4)),y:d(11)}],closed:!1,ink:"#d63b3b"});for(let y of[-1,1])f.push({points:qe(p*h(20.5),y*d(7),h(4.5),d(4.5)),closed:!0,ink:"#2f6ecb"})}f.push({points:qe(0,0,h(4.5),d(4.5)),closed:!0,ink:"#2f6ecb"});break}case"track-athletics":{let y=l-d(1.22)*8;y>0&&f.push({points:br(u-h(1.22)*8,y),closed:!0,fill:"#2f7d4f"});for(let g=1;g<8;g++){let M=d(1.22)*g,P=l-M;if(P<=0)break;f.push({points:br(u-h(1.22)*g,P),closed:!0})}break}case"oval-cricket":{f.push({points:qe(0,0,h(27.4),d(27.4+20.12/2),40),closed:!0}),f.push({points:Ke(0,0,h(3.05)/2,d(20.12)/2),closed:!0,ink:"#d8cfae"});break}case"pitch-rugby":{let p=y=>({points:[{x:h(y),y:-l},{x:h(y),y:l}],closed:!1});f.push(p(0));for(let y of[-1,1]){f.push(p(y*50),p(y*28));for(let g=-35;g<35;g+=4)f.push({points:[{x:h(y*10),y:d(g)},{x:h(y*10),y:d(Math.min(35,g+2))}],closed:!1})}break}case"diamond-baseball":{let p=(C,B)=>({x:h(C),y:d(B)}),{home:y}=yr,g=27.43,M=g/Math.SQRT2,P={x:y.x+M,y:y.y-M},R={x:y.x,y:y.y-2*M},x={x:y.x-M,y:y.y-M},b={x:y.x,y:y.y-18.44},S="#b98a59",I=Rc["diamond-baseball"],w=38.94,k=[p(y.x,y.y)],L=Math.atan2(y.y-w/Math.SQRT2-b.y,w/Math.SQRT2),T=Math.PI-L;for(let C=0;C<=16;C++){let B=L-(L+Math.PI*2-T)%(Math.PI*2)*(C/16);k.push(p(b.x+29*Math.cos(B),b.y+29*Math.sin(B)))}f.push({points:k,closed:!0,fill:S,ink:S});let v={x:y.x,y:y.y-M},A=[{x:y.x,y:y.y},P,R,x].map(C=>p(v.x+(C.x-v.x)*.84,v.y+(C.y-v.y)*.84));f.push({points:A,closed:!0,fill:I,ink:I}),f.push({points:qe(h(b.x),d(b.y),h(2.74),d(2.74),20),closed:!0,fill:S,ink:S}),f.push({points:qe(h(y.x),d(y.y),h(3.96),d(3.96),20),closed:!0,fill:S,ink:S});let _=yr.fence;f.push({points:[p(y.x,y.y),p(_[0].x,_[0].y)],closed:!1}),f.push({points:[p(y.x,y.y),p(_[_.length-1].x,_[_.length-1].y)],closed:!1});for(let C of[P,R,x])f.push({points:Ke(h(C.x),d(C.y),h(.3),d(.3)),closed:!0,fill:on});break}case"court-basketball":{f.push({points:Ke(0,0,h(14),d(7.5)),closed:!0}),f.push({points:[{x:0,y:-d(7.5)},{x:0,y:d(7.5)}],closed:!1}),f.push({points:qe(0,0,h(1.8),d(1.8),24),closed:!0});for(let p of[-1,1]){let y=p*14,g=p*(14-5.8),M=p*(14-1.575);f.push({points:Ke(h((y+g)/2),0,h(2.9),d(2.45)),closed:!0,fill:"#2f5d8a"}),f.push({points:qe(h(g),0,h(1.8),d(1.8),24),closed:!0});let P=Math.sqrt(6.75*6.75-6.6*6.6),R=[{x:h(y),y:-d(6.6)}],x=Math.atan2(-6.6,-p*P),b=2*Math.atan2(6.6,P);for(let S=0;S<=16;S++){let I=x-p*b*(S/16);R.push({x:h(M+6.75*Math.cos(I)),y:d(6.75*Math.sin(I))})}R.push({x:h(y),y:d(6.6)}),f.push({points:R,closed:!1})}break}case"court-tennis":{f.push({points:Ke(0,0,h(11.885),d(5.485)),closed:!0,fill:"#2b5f99"});for(let p of[-1,1])f.push({points:[{x:-h(11.885),y:p*d(4.115)},{x:h(11.885),y:p*d(4.115)}],closed:!1}),f.push({points:[{x:p*h(6.4),y:-d(4.115)},{x:p*h(6.4),y:d(4.115)}],closed:!1});f.push({points:[{x:-h(6.4),y:0},{x:h(6.4),y:0}],closed:!1}),f.push({points:[{x:0,y:-d(6.4)},{x:0,y:d(6.4)}],closed:!1,ink:"#d1d5db"});break}case"ring-boxing":{f.push({points:Ke(0,0,h(3.05),d(3.05)),closed:!0});let g=[[-1,-1,"#c53030"],[1,1,"#2b6cb0"],[1,-1,"#e2e8f0"],[-1,1,"#e2e8f0"]];for(let[M,P,R]of g)f.push({points:Ke(M*h(3.05),P*d(3.05),h(.3),d(.3)),closed:!0,fill:R,ink:R});break}default:return[]}return f.map(p=>({...p,points:p.points.map(y=>Ec(y.x,y.y,a,c,n,o))}))}function xr(e){if(e.role!=="stage"||!rn(e.stageKind))return[];let t=null;if(e.x!=null&&e.y!=null&&e.width!=null&&e.height!=null&&e.width>0&&e.height>0&&[e.x,e.y,e.width,e.height].every(Number.isFinite))t={cx:e.x+e.width/2,cy:e.y+e.height/2,width:e.width,height:e.height};else if(e.points&&e.points.length>=3&&e.points.every(n=>Number.isFinite(n.x)&&Number.isFinite(n.y))){let n=e.points.map(l=>l.x),o=e.points.map(l=>l.y),r=Math.min(...n),i=Math.max(...n),s=Math.min(...o),a=Math.max(...o),c=Math.max(1,i-r),u=Math.max(1,a-s);t={cx:r+c/2,cy:s+u/2,width:c,height:u}}return t?Ac({kind:e.stageKind,...t}):[]}var _c=/^data:image\/(?:png|jpe?g|webp|gif|avif);base64,[a-z0-9+/]+={0,2}$/i,vc=/[\s"'<>`\\]/;function Cc(e){if(typeof e!="string"||!e||e.length>2e6||e!==e.trim())return!1;if(e.startsWith("data:"))return _c.test(e);if(vc.test(e))return!1;try{let t=new URL(e);return t.protocol==="https:"&&!t.username&&!t.password}catch{return!1}}function Mr(e){let t=e.trim();return Cc(t)?t:null}var eo="seatlayer.event-configuration/1";var yt=100,kc=120,Oc=2e5,Tc=1e4,Lc=/^[a-f0-9]{64}$/,Bc=new Set(["stage","screen","barrier","camera_platform","sound_desk","rigging_truss"]);function Ft(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function at(e,t){return typeof e=="string"&&e.length>=1&&e.length<=t&&e.normalize("NFKC").trim()===e}function Fc(e){return typeof e=="number"&&Number.isInteger(e)&&e>0}function Sr(e){return!Array.isArray(e)||e.length>Oc||!e.every(t=>at(t,yt))?null:[...new Set(e)].sort()}function Nc(e){return!Ft(e)||!at(e.chartId,yt)||!at(e.version,yt)||e.sha256!==void 0&&(typeof e.sha256!="string"||!Lc.test(e.sha256))?null:{chartId:e.chartId,version:e.version,...typeof e.sha256=="string"?{sha256:e.sha256}:{}}}function to(e,t,n){return typeof e=="number"&&Number.isFinite(e)&&e>=t&&e<=n}function Dc(e){return Ft(e)?e.mode==="none"||e.mode==="opaque"?e.opacity===void 0?{mode:e.mode}:null:e.mode==="partial"&&to(e.opacity,.01,.99)?{mode:"partial",opacity:e.opacity}:null:null}function Gc(e,t){if(e===void 0)return;if(!Array.isArray(e)||e.length>Tc)return null;let n=new Set(t),o=new Set,r=new Set,i=0,s=[];for(let a of e){if(!Ft(a)||!at(a.id,yt)||!at(a.objectId,yt)||!n.has(a.objectId)||!Bc.has(String(a.kind))||!to(a.heightM,.05,50)||a.baseElevationM!==void 0&&!to(a.baseElevationM,-10,100))return null;let c=Dc(a.occlusion);if(!c||o.has(a.id)||r.has(a.objectId))return null;let u=a.contentImageUrl===void 0?void 0:typeof a.contentImageUrl=="string"?Mr(a.contentImageUrl):null;if(a.contentImageUrl!==void 0&&(!u||a.kind!=="screen"||++i>1))return null;o.add(a.id),r.add(a.objectId),s.push({id:a.id,objectId:a.objectId,kind:a.kind,heightM:a.heightM,...a.baseElevationM!==void 0?{baseElevationM:a.baseElevationM}:{},occlusion:c,...u?{contentImageUrl:u}:{}})}return s.sort((a,c)=>a.id.localeCompare(c.id))}function jc(e){let t=[];if(!Ft(e))return{issues:[{code:"invalid_export",path:"configuration",message:"Configuration must be an object"}]};e.schema!==eo&&t.push({code:"unsupported_schema",path:"configuration.schema",message:`Configuration schema must be ${eo}`}),at(e.id,yt)||t.push({code:"invalid_id",path:"configuration.id",message:"Configuration id must contain 1 to 100 normalized characters"}),at(e.label,kc)||t.push({code:"invalid_label",path:"configuration.label",message:"Configuration label must contain 1 to 120 normalized characters"}),Fc(e.version)||t.push({code:"invalid_version",path:"configuration.version",message:"Configuration version must be a positive integer"});let n=Nc(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=Ft(e.overlay)?e.overlay:null,r=Sr(o?.objectIds),i=Sr(o?.productionKillSeatIds),s=r?Gc(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:eo,id:e.id,label:e.label,version:e.version,baseVenue:n,overlay:{objectIds:r,productionKillSeatIds:i,...s!==void 0?{productionElements:s}:{}}}}}function Pr(e){let t=jc(e);return t.value?{ok:!0,value:t.value}:{ok:!1,issues:t.issues}}function Hc(e){if((e.kind==="polygon"||e.kind==="polyline"||e.kind==="line")&&e.points&&e.points.length>=2)return e.kind==="polygon"?en(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 Vc(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 Ir(e){let t=Hc(e);if(!t||t.length<2)return null;let n=e.rotation??0,o=Math.abs(n)<1e-6?t:t.map(c=>Vc(c,{x:t.reduce((u,l)=>u+l.x,0)/t.length,y:t.reduce((u,l)=>u+l.y,0)/t.length},n)),r=1/0,i=1/0,s=-1/0,a=-1/0;for(let c of o)r=Math.min(r,c.x),i=Math.min(i,c.y),s=Math.max(s,c.x),a=Math.max(a,c.y);return!Number.isFinite(r)||s-r<1e-6||a-i<1e-6?null:{minX:r,minY:i,maxX:s,maxY:a}}var Uc=5,Xc=3,Kc=.92,Yc=1.9,Wc=2,zc=.6,Zc=1,$c=.06;function Qc(e){return e.heightM!==void 0?e.heightM:e.stageKind==="ring-boxing"?Jn:rn(e.stageKind)?$c:Zc}function Rr(e){let t=1/0,n=1/0,o=-1/0,r=-1/0,i=-1/0;for(let s of Ar(e)){let a=s.baseHeightM??0;for(let c of s.objects){if(c.type!=="shape"||c.role!=="stage")continue;let u=Ir(c);u&&(t=Math.min(t,u.minX),n=Math.min(n,u.minY),o=Math.max(o,u.maxX),r=Math.max(r,u.maxY),i=Math.max(i,a+Qc(c)))}}return!Number.isFinite(t)||!Number.isFinite(i)?null:{minX:t,minY:n,maxX:o,maxY:r,deckTopM:i}}function qc(e,t,n,o){let r=1/0,i=1/0,s=-1/0,a=-1/0;for(let h of e)Number.isFinite(h.eyeHeightM)&&(r=Math.min(r,h.x),s=Math.max(s,h.x),i=Math.min(i,h.y),a=Math.max(a,h.y));if(!Number.isFinite(r))return null;let c=r*t,u=i*t,l=Math.max(1,Math.ceil((s-r)*t/n)+1),f=Math.max(1,Math.ceil((a-i)*t/n)+1),m=new Float64Array(l*f).fill(-1/0);for(let h of e){if(!Number.isFinite(h.eyeHeightM))continue;let d=h.eyeHeightM-je,p=Math.min(l-1,Math.max(0,Math.floor((h.x*t-c)/n))),g=Math.min(f-1,Math.max(0,Math.floor((h.y*t-u)/n)))*l+p,M=d+o;M>m[g]&&(m[g]=M)}return{cellM:n,minX:c,minY:u,cols:l,rows:f,top:m}}function Jc(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 wr(e,t,n={}){let o=new Map;if(!t||!e.length)return o;let r=n.metresPerChartUnit??$,i=n.cellM??zc,s=n.chairBackM??Kc,a=n.selfRowSkipM??Wc,c=n.clearThreshold??.9,u=n.partialThreshold??.25,l=Math.max(1,n.columns??Uc),f=Math.max(1,n.rows??Xc),m=qc(e,r,i,s);if(!m)return o;let h=(t.maxX-t.minX)*r,d=(t.maxY-t.minY)*r,p=h>=d,y=(t.minX+t.maxX)/2*r,g=(t.minY+t.maxY)/2*r,M=[];for(let R=0;R<l;R++){let x=(R+.5)/l-.5,b=p?y+x*h:y,S=p?g:g+x*d;for(let I=0;I<f;I++){let w=t.deckTopM+(f===1?0:I/(f-1)*Yc);M.push({x:b,y:S,z:w})}}let P=i/2;for(let R of e){if(!Number.isFinite(R.eyeHeightM))continue;let x=R.x*r,b=R.y*r,S=R.eyeHeightM,I=0,w=1/0;for(let L of M){let T=L.x-x,v=L.y-b,A=Math.hypot(T,v);if(!(A>a)){I++;continue}let _=T/A,C=v/A,B=0;for(let O=a;O<A;O+=P){let F=Jc(m,x+_*O,b+C*O);if(!(!Number.isFinite(F)||F>=S)&&F>S+(L.z-S)*O/A){B=O;break}}B?w=Math.min(w,B):I++}let k=I/M.length;k>=c||o.set(R.id,{seatId:R.id,mark:k<u?"obstructedView":"restrictedView",visibleFraction:k,totalRays:M.length,atDistanceM:Number.isFinite(w)?w:0})}return o}function Er(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 no(e){return e?e.accessibility?.length?e.wheelchairSpaceType&&!e.accessibility.includes("wheelchair")?["wheelchair",...e.accessibility]:e.accessibility:e.wheelchairSpaceType?["wheelchair"]:e.accessible?["wheelchair"]:[]:[]}var an=Math.PI/180;var Nt=16;function oo(e,t,n,o){let r=n*an,i=Math.cos(r),s=Math.sin(r);return{x:o.x+e*i-t*s,y:o.y+e*s+t*i}}function kr(e){let{seatCount:t,seatSpacing:n,curve:o,rotation:r,origin:i}=e,s=[];if(e.path)return qo(e.path,t);if(t<=1)return t===1&&s.push({x:i.x,y:i.y}),s;if(o===0){for(let u=0;u<t;u++)s.push(oo(u*n,0,r,i));return s}let a=o/(t-1)*an,c=n/(2*Math.sin(Math.abs(a)/2));for(let u=0;u<t;u++){let l=u*a,f=c*Math.sin(l),m=-c+c*Math.cos(l);s.push(oo(f,m,r,i))}return s}function Or(e){let t=new Map;if(e.overrides)for(let n of e.overrides)t.set(n.index,n);return t}function el(e,t){let n=Or(e);return kr(e).map((o,r)=>{let i=n.get(r),s=no(i),a=lr(e,r,i),c={...e.commercial,...i?.commercial};return{index:r,x:o.x+(i?.dx??0),y:o.y+(i?.dy??0),label:a,displayLabel:zn(e,r,t,i),categoryKey:i?.categoryKey??e.categoryKey,skipped:!!i?.skip,accessible:s.length>0,accessibility:s,wheelchairSpaceType:i?.wheelchairSpaceType,commercial:Object.values(c).some(u=>u!==void 0&&u!==!1&&u!=="")?c:void 0,glyph:i?.glyph,viewUrl:i?.viewFromSeatUrl??e.viewFromSeatUrl,viewMeta:i?.viewFromSeatUrl?i.viewFromSeatMeta:e.viewFromSeatMeta,labelStyle:i?.labelStyle??e.seatLabelStyle}})}function tl(e){let t=[];for(let n of el(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 nl(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 ol(e){let t=[],n=Math.max(0,Math.round(e.seatCount));if(n===0)return t;let o=new Map((e.overrides??[]).map(l=>[l.index,l])),r=(l,f,m,h)=>{let d=o.get(l),p=no(d),y=d?.label??ur(e,l);return{index:l,label:y,displayLabel:d?.displayLabel??fr(e,l),x:f+(d?.dx??0),y:m+(d?.dy??0),categoryKey:d?.categoryKey??e.categoryKey,skipped:!!d?.skip,accessible:p.length>0,accessibility:p,wheelchairSpaceType:d?.wheelchairSpaceType,commercial:d?.commercial,glyph:d?.glyph,viewUrl:d?.viewFromSeatUrl,viewMeta:d?.viewFromSeatUrl?d.viewFromSeatMeta:void 0,labelStyle:d?.labelStyle,...h?{side:h}:{}}};if(e.shape==="round"){let l=(e.radius??40)+Nt,f=e.rotation*an,m=Math.max(0,Math.min(360,e.seatArc??360));if(m>=360||n===1){for(let y=0;y<n;y++){let g=f+y/n*2*Math.PI;t.push(r(y,e.center.x+l*Math.cos(g),e.center.y+l*Math.sin(g)))}return t}let h=m*an,d=(2*Math.PI-h)/2,p=f+d;for(let y=0;y<n;y++){let g=p+y/(n-1)*h;t.push(r(y,e.center.x+l*Math.cos(g),e.center.y+l*Math.sin(g)))}return t}let i=e.width??80,s=e.height??50,a=nl(e),c=["top","bottom","left","right"],u=0;for(let l of c){let f=a[l];for(let m=0;m<f;m++){let h,d;l==="top"?(h=-i/2+(m+.5)*i/f,d=-s/2-Nt):l==="bottom"?(h=-i/2+(m+.5)*i/f,d=s/2+Nt):l==="left"?(h=-i/2-Nt,d=-s/2+(m+.5)*s/f):(h=i/2+Nt,d=-s/2+(m+.5)*s/f);let p=oo(h,d,e.rotation,e.center);t.push(r(u++,p.x,p.y,l))}}return t}function rl(e){return ol(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 il(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 Yn(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 sr(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 Lt(e){return Array.isArray(e)?e.filter(t=>Array.isArray(t)&&t.length>=3):[]}function Pe(e,t,n){return Yn(e,t)&&!Lt(n).some(o=>Yn(e,o)||sr(e,o))}function sn(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 Tr(e){switch(e.type){case"row":{let t=kr(e),n=Or(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 sn(e.points);case"section":return sn(e.outline);case"text":return{x:e.position.x,y:e.position.y};case"shape":return e.points&&e.points.length?sn(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 _r(e,t){return e.length===t.length&&e.every((n,o)=>n.x===t[o].x&&n.y===t[o].y)}function sl(e,t){if(e.type!=="gaArea"||!_r(e.points,t.outline))return!1;let n=Lt(e.holes),o=Lt(t.holes);return n.length===o.length&&n.every((r,i)=>_r(r,o[i]))}function al(e,t,n=e.filter(r=>r.type==="section"),o=Tr(t)){let r="referenceInventorySource"in t?t.referenceInventorySource?.logicalSectionId:void 0;return(r?n.find(s=>(s.logicalSectionId??s.id)===r&&(sl(t,s)||Pe(o,s.outline,s.holes))):void 0)??n.find(s=>Pe(o,s.outline,s.holes))}function Ar(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 vr(e,t,n,o,r,i,s,a,c){let u=[],l=e.filter(p=>p.type==="section"),f=ar(e),m=p=>!p?.eventConfigurationId||p.eventConfigurationId===o&&(p.eventConfigurationVersion===void 0||p.eventConfigurationVersion===c),h=p=>pr(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=tl(p):p.type==="table"?y=rl(p):p.type==="booth"&&(y=il(p)),!y.length)continue;for(let x of y)x.viewUrl&&!m(x.viewMeta)&&(x.viewUrl=void 0,x.viewMeta=void 0);if(p.type==="row"){let x=f.get(p.id);if(x){let b=new Map((p.overrides??[]).map(S=>[S.index,S]));for(let S of y){let I=Number(S.id.slice(S.id.lastIndexOf(":")+1));if(!Number.isInteger(I))continue;S.logicalRowId=x.groupId,S.logicalSeatIndex=x.adjacencyOffset+I,b.get(I)?.displayLabel||(S.displayLabel=zn(p,I,x)),!S.viewUrl&&x.viewFromSeatUrl&&m(x.viewFromSeatMeta)&&(S.viewUrl=x.viewFromSeatUrl,S.viewMeta=x.viewFromSeatMeta);let w=b.get(I)?.confidenceEvidence;S.confidenceEvidence=d(w,"exact-seat")??d(p.confidenceEvidence,"row-representative")??d(x.confidenceEvidence,"row-representative")}}}let g=al(e,p,l,p.type==="row"?sn(y):Tr(p)),M=g?.viewFromSeatUrl,R=(g?.zone?t?.find(x=>x.id===g.zone):void 0)?.focalPoint??n;for(let x of y){if(!x.confidenceEvidence){let b=Number(x.id.slice(x.id.lastIndexOf(":")+1)),S=(p.type==="row"||p.type==="table")&&Number.isInteger(b)?p.overrides?.find(I=>I.index===b)?.confidenceEvidence:void 0;x.confidenceEvidence=d(S,"exact-seat")??(p.type==="row"?d(p.confidenceEvidence,"row-representative"):void 0)}x.confidenceEvidence??=d(g?.confidenceEvidence,"section-representative")??(s?d(s.evidence,s.coverage):void 0),!x.viewUrl&&M&&m(g?.viewFromSeatMeta)&&(x.viewUrl=M,x.viewMeta=g?.viewFromSeatMeta),!x.viewUrl&&i&&m(i.meta)&&(x.viewUrl=i.url,x.viewMeta=i.meta),g&&(x.sectionId=g.logicalSectionId??g.id),g?.zone&&(x.zoneId=g.zone),R&&(x.focalPoint={...R})}u.push(...y)}return u}function gt(e,t={}){if(e.floors?.length){let o=[];for(let r of e.floors){let i=r.focalPoint??e.focalPoint,s=r.viewFromSeatUrl?{url:r.viewFromSeatUrl,meta:r.viewFromSeatMeta}:e.viewFromSeatUrl?{url:e.viewFromSeatUrl,meta:e.viewFromSeatMeta}:void 0,a=r.confidenceEvidence?{evidence:r.confidenceEvidence,coverage:"floor-representative"}:e.confidenceEvidence?{evidence:e.confidenceEvidence,coverage:"venue-representative"}:void 0,c=vr(r.objects,e.zones,i,e.eventConfigurationId,e.confidenceBasisSha256,s,a,t.now,t.eventConfigurationVersion??e.eventConfigurationVersion);t.resolveEyeHeights!==!1&&Cr(r.objects,r.focalPoint??e.focalPoint,r.baseHeightM??0,c);for(let u of c)u.floorId=r.id;for(let u of c)o.push(u)}return o}let n=vr(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&&Cr(e.objects,e.focalPoint,t.floorBaseHeightM??0,n),cl(e,n,t)}function cl(e,t,n){return!n.deriveRestrictedView||e.derivedRestrictedView===!1||n.resolveEyeHeights===!1||Er(t,wr(t,Rr(e))),t}function Cr(e,t,n,o){let r=e.filter(f=>f.type==="section"),i=n>0||r.some(f=>f.height!==void 0||f.rake!==void 0||(f.elevation??0)>0);if(!r.length||!i||!t){for(let f of o)f.eyeHeightM=n+je;return}let s=new Array(o.length),a=new Map;for(let f of r)a.has(f.id)||a.set(f.id,f);let c=new Map,u=new Map;for(let f=0;f<o.length;f++){let m=o[f],d=(m.sectionId?a.get(m.sectionId)??r.find(y=>y.logicalSectionId===m.sectionId&&Pe({x:m.x,y:m.y},y.outline,y.holes)):void 0)??r.find(y=>Pe({x:m.x,y:m.y},y.outline,y.holes))??null;if(s[f]=d,!d)continue;c.has(d.id)||c.set(d.id,Qe(d,{floorBaseHeightM:n}));let p=u.get(d.id);p?p.push(f):u.set(d.id,[f])}let l=new Array(o.length).fill(void 0);for(let[f,m]of u){let h=c.get(f);if(!h)continue;let d=h.rake>0?Math.tan(h.rake*Math.PI/180):0,p=tn(f,o,m,t);for(let y of p.rows){let g=y.blockDepth*$*d,M=h.height+g;for(let P of y.seatIndices)l[P]=M}}for(let f=0;f<o.length;f++){let m=o[f],h=s[f];if(!h){m.eyeHeightM=n+je;continue}let d=c.get(h.id);m.eyeHeightM=(l[f]??d.height)+je}}var Br=Ge(require("earcut"),1),ro=Ge(require("polygon-clipping"),1);function Ae(e){let t=0;for(let n=0,o=e.length;n<o;n+=1){let r=e[n],i=e[(n+1)%o];t+=r.x*i.y-i.x*r.y}return t/2}function _e(e,t,n){let o=!1;for(let r=0,i=e.length-1;r<e.length;i=r++){let s=e[r],a=e[i];s.y>n!=a.y>n&&t<(a.x-s.x)*(n-s.y)/(a.y-s.y)+s.x&&(o=!o)}return o}var E=$,ll=.002;function ul(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<ll}var ct=class{constructor(t=16384){this.len=0;this.buf=new Float32Array(t)}push3(t,n,o){this.len+3>this.buf.length&&this.grow(this.len+3),this.buf[this.len++]=t,this.buf[this.len++]=n,this.buf[this.len++]=o}push1(t){this.len+1>this.buf.length&&this.grow(this.len+1),this.buf[this.len++]=t}grow(t){let n=this.buf.length*2;for(;n<t;)n*=2;let o=new Float32Array(n);o.set(this.buf.subarray(0,this.len)),this.buf=o}get length(){return this.len}toArray(){return this.buf.slice(0,this.len)}},un=class{constructor(){this.pos=new ct;this.nor=new ct;this.col=new ct;this.flr=new ct;this.mat=new ct;this.currentFloor=0;this.currentMaterial=0}setFloor(t){this.currentFloor=t}setMaterial(t){this.currentMaterial=t}tri(t,n,o,r,i,s=i,a=i){ul(t,n,o)||(this.pos.push3(t[0],t[1],t[2]),this.pos.push3(n[0],n[1],n[2]),this.pos.push3(o[0],o[1],o[2]),this.nor.push3(r[0],r[1],r[2]),this.nor.push3(r[0],r[1],r[2]),this.nor.push3(r[0],r[1],r[2]),this.col.push3(i[0],i[1],i[2]),this.col.push3(s[0],s[1],s[2]),this.col.push3(a[0],a[1],a[2]),this.flr.push1(this.currentFloor),this.flr.push1(this.currentFloor),this.flr.push1(this.currentFloor),this.mat.push1(this.currentMaterial),this.mat.push1(this.currentMaterial),this.mat.push1(this.currentMaterial))}triN(t,n,o,r,i,s,a,c=a,u=a){[...t,...n,...o].every(Number.isFinite)&&(this.pos.push3(t[0],t[1],t[2]),this.pos.push3(n[0],n[1],n[2]),this.pos.push3(o[0],o[1],o[2]),this.nor.push3(r[0],r[1],r[2]),this.nor.push3(i[0],i[1],i[2]),this.nor.push3(s[0],s[1],s[2]),this.col.push3(a[0],a[1],a[2]),this.col.push3(c[0],c[1],c[2]),this.col.push3(u[0],u[1],u[2]),this.flr.push1(this.currentFloor),this.flr.push1(this.currentFloor),this.flr.push1(this.currentFloor),this.mat.push1(this.currentMaterial),this.mat.push1(this.currentMaterial),this.mat.push1(this.currentMaterial))}get vertexCount(){return this.pos.length/3}build(){return{position:this.pos.toArray(),normal:this.nor.toArray(),color:this.col.toArray(),floor:this.flr.toArray(),material:this.mat.toArray(),count:this.pos.length/3}}};function fl(e,t,n){let o=t[0]-e[0],r=t[1]-e[1],i=t[2]-e[2],s=n[0]-e[0],a=n[1]-e[1],c=n[2]-e[2],u=r*c-i*a,l=i*s-o*c,f=o*a-r*s,m=Math.hypot(u,l,f)||1;return u/=m,l/=m,f/=m,[u,l,f]}function ml(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,Br.default)(o,r.length?r:void 0,2);return{pts:n,tris:i}}function He(e){return Ae(e)<0?[...e].reverse():e}var hl=3;function dl(e,t,n,o){let r=o(e),i=o(t),s=o(n),a=(h,d,p,y)=>Math.abs(o({x:(h.x+d.x)/2,y:(h.y+d.y)/2})-(p+y)/2),c=(e.x+t.x+n.x)/3,u=(e.y+t.y+n.y)/3,l=(r+i+s)/3,f=Math.max(a(e,t,r,i),a(t,n,i,s),a(n,e,s,r),Math.abs(o({x:c,y:u})-l)),m=(h,d,p)=>{let y=Math.abs(o({x:(h+c)/2,y:(d+u)/2})-(p+l)/2);y>f&&(f=y)};return m((e.x+t.x)/2,(e.y+t.y)/2,(r+i)/2),m((t.x+n.x)/2,(t.y+n.y)/2,(i+s)/2),m((n.x+e.x)/2,(n.y+e.y)/2,(s+r)/2),f}function Dt(e,t,n,o,r){if(r<=0)return dl(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(Dt(e,i,a,o,r-1),Dt(i,t,s,o,r-1),Dt(a,s,n,o,r-1),Dt(i,s,a,o,r-1))}function Gt(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};Gt(e,t,m,d,r,i,s-1,a),Gt(e,m,n,h,r,i,s-1,a),Gt(e,d,h,o,r,i,s-1,a),Gt(e,m,h,d,r,i,s-1,a);return}let c=[t.x*E,r(t),t.y*E],u=[n.x*E,r(n),n.y*E],l=[o.x*E,r(o),o.y*E];if(a){e.triN(c,u,l,a(t),a(n),a(o),i);return}let f=fl(c,u,l);f[1]<0&&(f=[-f[0],-f[1],-f[2]]),e.tri(c,u,l,f,i)}var pl=8;function Lr(e,t,n){if(!Number.isFinite(n))return e;let o=[],r=(i,s,a,c,u)=>{if(u>0){let l={x:(i.x+s.x)/2,y:(i.y+s.y)/2},f=t(l);if(Math.abs(f-(a+c)/2)>n){r(i,l,a,f,u-1),r(l,s,f,c,u-1);return}}o.push(i)};for(let i=0;i<e.length;i++){let s=e[i],a=e[(i+1)%e.length];r(s,a,t(s),t(a),pl)}return o}function cn(e,t){if(e.length<3)return e;let n=[];for(let r of e){let i=n[n.length-1];i&&Math.hypot(r.x-i.x,r.y-i.y)<t||n.push(r)}for(;n.length>2&&Math.hypot(n[0].x-n[n.length-1].x,n[0].y-n[n.length-1].y)<t;)n.pop();if(n.length<3)return e;let o=[];for(let r=0;r<n.length;r++){let i=o.length?o[o.length-1]:n[(r-1+n.length)%n.length],s=n[r],a=n[(r+1)%n.length],c=a.x-i.x,u=a.y-i.y,l=Math.hypot(c,u);l>t&&Math.abs((s.x-i.x)*u-(s.y-i.y)*c)/l<t||o.push(s)}return o.length>=3?o:n}var ln=.001*Oe*.1;function z(e,t,n,o,r,i,s,a,c=1/0,u){if(!t||t.length<3||(c===void 0&&(c=1/0),Math.abs(Ae(t))<1e-4))return;let l=cn(Lr(cn(He(t),ln),o,c),ln),f=n?.map(b=>cn(Lr(cn(He(b),ln),o,c),ln)).filter(b=>b.length>=3&&Math.abs(Ae(b))>=1e-4),{pts:m,tris:h}=ml(l,f),d=[i[0]*a.top,i[1]*a.top,i[2]*a.top],p=[i[0]*a.bottomCap,i[1]*a.bottomCap,i[2]*a.bottomCap],y=[s[0]*a.top,s[1]*a.top,s[2]*a.top],g=[s[0]*a.wallBottom,s[1]*a.wallBottom,s[2]*a.wallBottom],M=0;if(Number.isFinite(c))for(;M<hl;M++){let b=0;for(let S=0;S<h.length;S+=3){let I=Dt(m[h[S]],m[h[S+1]],m[h[S+2]],o,M);I>b&&(b=I)}if(b<=c)break}for(let b=0;b<h.length;b+=3){let S=m[h[b]],I=m[h[b+1]],w=m[h[b+2]];Gt(e,S,I,w,o,d,M,u);let k=[S.x*E,r,S.y*E],L=[I.x*E,r,I.y*E],T=[w.x*E,r,w.y*E];e.tri(k,T,L,[0,-1,0],p)}let P=b=>{if(M<=0)return b;let S=1<<M,I=[];for(let w=0;w<b.length;w++){let k=b[w],L=b[(w+1)%b.length];for(let T=0;T<S;T++){let v=T/S;I.push({x:k.x+(L.x-k.x)*v,y:k.y+(L.y-k.y)*v})}}return I},R=Un(l),x=[{ring:P(l),flip:!1}];if(f)for(let b of f)b.length>=3&&x.push({ring:P(b),flip:!0});for(let{ring:b,flip:S}of x)for(let I=0;I<b.length;I++){let w=b[I],k=b[(I+1)%b.length],L=(k.x-w.x)*E,v=(k.y-w.y)*E,A=-L,_=Math.hypot(v,A)||1;v/=_,A/=_;let C=(w.x+k.x)/2-R.x,B=(w.y+k.y)/2-R.y,O=v*C+A*B;S&&(O=-O),O<0&&(v=-v,A=-A);let F=[v,0,A],D=[w.x*E,o(w),w.y*E],j=[k.x*E,o(k),k.y*E],N=[w.x*E,r,w.y*E],X=[k.x*E,r,k.y*E];e.tri(D,j,X,F,y,y,g),e.tri(D,X,N,F,y,g,g)}}function Fr(e){let t=0;for(let c of e)t+=c.count;let n=new Float32Array(t*3),o=new Float32Array(t*3),r=new Float32Array(t*3),i=new Float32Array(t),s=new Float32Array(t),a=0;for(let c of e)n.set(c.position,a*3),o.set(c.normal,a*3),r.set(c.color,a*3),i.set(c.floor,a),s.set(c.material,a),a+=c.count;return{position:n,normal:o,color:r,floor:i,material:s,count:t}}function Le(e,t,n=2.5){if(t<=0||e.length<3)return e;let o=He(e),r=o.length,i=[];for(let a=0;a<r;a++){let c=o[a],u=o[(a+1)%r],l=u.x-c.x,f=u.y-c.y,m=Math.hypot(l,f)||1;i.push({x:f/m,y:-l/m})}let s=[];for(let a=0;a<r;a++){let c=o[a],u=i[(a-1+r)%r],l=i[a],f=u.x+l.x,m=u.y+l.y,h=Math.hypot(f,m),d=()=>{s.push([c.x+u.x*t,c.y+u.y*t]),s.push([c.x+l.x*t,c.y+l.y*t])};if(h<1e-9){d();continue}f/=h,m/=h;let p=f*u.x+m*u.y,y=1/Math.max(p,1e-6);if(!Number.isFinite(y)||y>n){d();continue}s.push([c.x+f*t*y,c.y+m*t*y])}if(s.length<3)return e;try{let a=ro.default.union([[...s,s[0]]]),c=null,u=-1/0;for(let f of a){let m=Math.abs(Ae(f[0].map(([h,d])=>({x:h,y:d}))));m>u&&(u=m,c=f[0])}if(!c)return e;let l=c.map(([f,m])=>({x:f,y:m}));if(l.length>1){let f=l[0],m=l[l.length-1];Math.abs(f.x-m.x)<1e-9&&Math.abs(f.y-m.y)<1e-9&&l.pop()}return l.length>=3?l:e}catch{return e}}function Je(e,t,n=2.5){if(e.length<3)return[];if(t<=0)return e;let o=He(e),r=o.length,i=[];for(let c=0;c<r;c++){let u=o[c],l=o[(c+1)%r],f=Math.hypot(l.x-u.x,l.y-u.y)||1;i.push({x:-(l.y-u.y)/f,y:(l.x-u.x)/f})}let s=[],a=[];for(let c=0;c<r;c++){let u=o[c],l=i[(c-1+r)%r],f=i[c],m=l.x+f.x,h=l.y+f.y,d=Math.hypot(m,h),p=d<1e-9?1/0:1/Math.max(m/d*l.x+h/d*l.y,1e-6);if(!Number.isFinite(p)||p>n){s.push({x:u.x+l.x*t,y:u.y+l.y*t},{x:u.x+f.x*t,y:u.y+f.y*t}),a.push(c,c);continue}m/=d,h/=d,s.push({x:u.x+m*t*p,y:u.y+h*t*p}),a.push(c)}for(let c=0;c<s.length;c++){let u=(c+1)%s.length,l=a[c],f=a[u];if(f!==(l+1)%r)continue;let m=o[l],h=o[f];if((s[u].x-s[c].x)*(h.x-m.x)+(s[u].y-s[c].y)*(h.y-m.y)<=0)return[]}try{let c=ro.default.intersection([[...s.map(d=>[d.x,d.y]),[s[0].x,s[0].y]]],[[...o.map(d=>[d.x,d.y]),[o[0].x,o[0].y]]]),u=null,l=0;for(let d of c){let p=Math.abs(Ae(d[0].map(([y,g])=>({x:y,y:g}))));p>l&&(l=p,u=d[0])}if(!u)return[];let f=u.map(([d,p])=>({x:d,y:p})),m=f[0],h=f[f.length-1];return f.length>1&&Math.abs(m.x-h.x)<1e-9&&Math.abs(m.y-h.y)<1e-9&&f.pop(),f.length>=3?He(f):[]}catch{return[]}}function 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 jt(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 Ht=3,lt=.38,Vt=.24;function bl(e){if(e.length<3)return null;let t=e[0],n=e[Math.floor(e.length/2)],o=e[e.length-1],r=(n.x-t.x)*E,i=(n.y-t.y)*E,s=(o.x-t.x)*E,a=(o.y-t.y)*E,c=2*(r*a-i*s);if(Math.abs(c)<1e-7)return null;let u=r*r+i*i,l=s*s+a*a,f=(u*a-l*i)/c+t.x*E,m=(r*l-s*u)/c+t.y*E,h=Math.hypot(t.x*E-f,t.y*E-m);return h<1||h>200||!Number.isFinite(h)||e.some(d=>Math.abs(Math.hypot(d.x*E-f,d.y*E-m)-h)>.03)?null:{x:f,z:m,radius:h}}function Nr(e){let t=[],n=new Map,o=(c,u)=>`${Math.floor(c/Ht)},${Math.floor(u/Ht)}`;for(let c of e)for(let u of c.rows){for(let f of u.pts){let m=f.x*E,h=f.y*E,d=o(m,h),p=n.get(d)??[];p.push({x:m,z:h,y:u.y,floor:c.floorIndex}),n.set(d,p)}if(u.patch||u.pts.length<2)continue;let l=bl(u.pts);for(let f of[0,u.pts.length-1]){let m=u.pts[f],h=u.pts[f===0?1:f-1],d=m.x-h.x,p=m.y-h.y,y=Math.hypot(d,p);y<1e-6||t.push({sectionId:c.sectionId,floorIndex:c.floorIndex,curve:l,row:u,point:m,x:m.x*E,z:m.y*E,dx:d/y,dz:p/y})}}let r=new Map;t.forEach((c,u)=>{let l=o(c.x,c.z),f=r.get(l)??[];f.push(u),r.set(l,f)});let i=(c,u)=>{let l=Math.floor(c/Ht),f=Math.floor(u/Ht);return[-1,0,1].flatMap(m=>[-1,0,1].map(h=>`${l+m},${f+h}`))},s=new Map;t.forEach((c,u)=>{let l=-1,f=1/0,m=!1;for(let h of i(c.x,c.z))for(let d of r.get(h)??[]){let p=t[d];if(c.sectionId===p.sectionId&&c.row.blockId===p.row.blockId||c.floorIndex!==p.floorIndex||Math.abs(c.row.y-p.row.y)>.05)continue;let y=p.x-c.x,g=p.z-c.z,M=Math.hypot(y,g);if(M<lt*2+.45||M>Ht)continue;let P=c.curve&&p.curve&&Math.hypot(c.curve.x-p.curve.x,c.curve.z-p.curve.z)<=.05&&Math.abs(c.curve.radius-p.curve.radius)<=.05,R=Math.min((y*c.dx+g*c.dz)/M,(-y*p.dx-g*p.dz)/M);(P?R<.8:R<.98)||!P&&(Math.abs(y*c.dz-g*c.dx)>.15||Math.abs(y*p.dz-g*p.dx)>.15)||(M<f-.02?(l=d,f=M,m=!1):Math.abs(M-f)<=.02&&(m=!0))}l>=0&&!m&&s.set(u,l)});let a=[];for(let[c,u]of s){if(c>=u||s.get(u)!==c)continue;let l=t[c],f=t[u],m=Math.hypot(f.x-l.x,f.z-l.z),h=(f.x-l.x)/m,d=(f.z-l.z)/m,p=!1;for(let g of i((l.x+f.x)/2,(l.z+f.z)/2))for(let M of n.get(g)??[]){if(M.floor!==l.floorIndex||Math.abs(M.y-l.row.y)>.75)continue;let P=(M.x-l.x)*h+(M.z-l.z)*d,R=Math.abs((M.x-l.x)*d-(M.z-l.z)*h);P>.01&&P<m-.01&&R<Vt+lt&&(p=!0)}if(p)continue;let y=(g,M)=>({x:(l.x+h*g-d*M)/E,y:(l.z+d*g+h*M)/E});a.push({sections:[l.sectionId,f.sectionId],blocks:[l.row.blockId,f.row.blockId],floorIndex:l.floorIndex,ends:[l.point,f.point],clearWidthM:m-2*lt,heightM:(l.row.y+f.row.y)/2,outline:[y(lt,-Vt),y(m-lt,-Vt),y(m-lt,Vt),y(lt,Vt)]})}return a}var yl=/^#?([\da-f]{3}|[\da-f]{6})$/i;function Dr(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 gl(e){let t=yl.exec((e??"").trim());if(!t)return null;let n=t[1].length===3?t[1].split("").map(r=>r+r).join(""):t[1],o=parseInt(n,16);return[o>>16&255,o>>8&255,o&255]}function oe(e){let t=gl(e);return t?[t[0]/255,t[1]/255,t[2]/255]:null}function xl(e){return .2126*e[0]+.7152*e[1]+.0722*e[2]}function re(e,t,n){return[e[0]+(t[0]-e[0])*n,e[1]+(t[1]-e[1])*n,e[2]+(t[2]-e[2])*n]}function Ve(e,t){let n=xl(e);return re(e,[n,n,n],t)}function Gr({r:e,g:t,b:n}){let o=e/255,r=t/255,i=n/255,s=Math.max(o,r,i),a=Math.min(o,r,i),c=(s+a)/2;if(s===a)return{h:0,s:0,l:c};let u=s-a,l=c>.5?u/(2-s-a):u/(s+a),f;return s===o?f=((r-i)/u+(r<i?6:0))/6:s===r?f=((i-o)/u+2)/6:f=((o-r)/u+4)/6,{h:f,s:l,l:c}}var io=e=>e<=.04045?e/12.92:((e+.055)/1.055)**2.4,so=e=>e<=.0031308?12.92*e:1.055*Math.max(0,e)**.4166666666666667-.055,ao=e=>Math.min(1,Math.max(0,e));function lo(e){let t=io(e[0]),n=io(e[1]),o=io(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 co([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[ao(so(4.0767416621*o-3.3077115913*r+.2309699292*i)),ao(so(-1.2684380046*o+2.6097574011*r-.3413193965*i)),ao(so(-.0041960863*o-.7034186147*r+1.707614701*i))]}var mn=e=>lo(e)[0];function Ut(e){let[,t,n]=lo(e);return Math.hypot(t,n)}function ut(e,t,n){let[,o,r]=lo(e);if(n===void 0)return co([t,o,r]);let i=Math.hypot(o,r),s=i===0?0:n/i;return co([t,o*s,r*s])}function hn(e){return co([e,-.004,-.008])}var dn=["available","held","sold","selected","dimmed"];function Hr(e){let t=dn.indexOf(e);return t<0?0:t}var Vr={available:[.24,.82,.52],held:[.34,.39,.45],sold:[.34,.39,.45],selected:[.24,.74,1],dimmed:[.28,.32,.37]};var jr={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}},pn=.012;function bn(e){return mn(e.tierTop)>.6}function xt(e){return e?jr.day:jr.night}var uo={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]},fo={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 Ml=.15,Sl=1.6;function Ur(e){return Xn(e??1,Ml,Sl)}var Pl=.15,Il=.9,Rl=1.76;function Xr(e){return mo(e)?{zenith:[.36,.58,.84],horizon:[.82,.88,.94]}:{zenith:[.05,.08,.15],horizon:[.3,.38,.5]}}function mo(e){return!!e&&e[0]*.2126+e[1]*.7152+e[2]*.0722>.55}function wl(){return{background:{top:[...fo.top],bottom:[...fo.bottom]},sky:Xr(null),structure:uo,seatStates:{...Vr},seatScale:1,materials:{seat:null,shell:null,roughness:.78}}}function El(e){return mo(e)?{deck:"#c9ccc8",fascia:"#b4bab8",shell:"#c3c9c8",roughness:.87}:{deck:"#69747b",fascia:"#3e4d58",shell:"#526572",roughness:.87}}function Kr(e){let t=wl();e??={};let n=oe(e.background);if(n){t.background={top:W(n,Il),bottom:W(n,Rl)},t.sky=Xr(n);let a={};for(let[u,l]of Object.entries(uo))a[u]=re(l,n,Pl);n[0]*.2126+n[1]*.7152+n[2]*.0722>.55&&(a.ground=W(n,.86)),t.structure=a}let o=oe(e.selectionColor)??oe(e.accent);o&&(t.seatStates={...t.seatStates,selected:o});let r=e.seatScale;typeof r=="number"&&Number.isFinite(r)&&(t.seatScale=Ur(r));let i=Object.fromEntries(Object.entries(e.venue3d??{}).filter(([,a])=>a!=null)),s={...El(n),...i};if(s){let a=oe(s.deck),c=oe(s.fascia);a&&(t.structure={...t.structure,tierTop:a,gaTop:a}),c&&(t.structure={...t.structure,tierWall:c,gaWall:c}),t.materials.seat=oe(s.seat),t.materials.shell=oe(s.shell),typeof s.roughness=="number"&&Number.isFinite(s.roughness)&&(t.materials.roughness=Math.min(1,Math.max(0,s.roughness)))}return Al(t,mo(n)),t}function Al(e,t){let n=xt(t);e.seatStates={...e.seatStates,held:hn(n.unavailable),sold:hn(n.unavailable),dimmed:hn(n.dimmed)};let o=(i,s)=>ut(i,s,Math.min(Ut(i),pn)),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 Yr(e,t){let n=[];for(let o of t)n.push(...e.seatStates[o]);return n}function Wr(e){let t=1/0,n=1/0,o=-1/0,r=-1/0,i=!1;for(let s of e)!Number.isFinite(s.x)||!Number.isFinite(s.y)||(i=!0,s.x<t&&(t=s.x),s.y<n&&(n=s.y),s.x>o&&(o=s.x),s.y>r&&(r=s.y));return i?{minX:t,minY:n,maxX:o,maxY:r}:null}function Mt(e,t){return e.minX<=t.maxX&&t.minX<=e.maxX&&e.minY<=t.maxY&&t.minY<=e.maxY}var ho=[{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"}],lp=new Map(ho.map(e=>[e.key,e]));var _l={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 yn(e){let t=e?.[0];return t&&_l[t]||"#3b82f6"}var vl=[{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"}],up=new Map(vl.map(e=>[e.key,e]));var Cl=["reference-focal","bar","entrance","exit","restroom","screen","sound","concession","coat","wall","rail","suite","obstruction"],fp=new Set(Cl);var gn=["#e69f00","#56b4e9","#009e73","#f0e442","#0072b2","#d55e00","#cc79a7"],zr="#a4508b";var yp={facilities:zr,"food-drink":gn[5],navigation:gn[2],accessibility:gn[4]};var gp={minDiameterPx:12,glyphScale:.66,ringRatio:1/14,largeFromPx:24};var de=e=>{let t=Math.round(e*100)/100;return Object.is(t,-0)?"0":String(t)},Rt=e=>`${de(e[0])} ${de(e[1])}`,It=(e,t,n,o)=>[e+n*Math.cos(o*Math.PI/180),t+n*Math.sin(o*Math.PI/180)];function ai(e){let t=`M${Rt(e.from)}`;for(let n of e.segs)t+=n.arc?`A${de(n.arc.r)} ${de(n.arc.r)} 0 ${n.arc.large} ${n.arc.sweep} ${Rt(n.to)}`:`L${Rt(n.to)}`;return`${t}Z`}function pe(e){let t=[e.from,...e.segs.map(o=>o.to)],n=[];for(let o=e.segs.length-1;o>=0;o--){let r=e.segs[o].arc;n.push({to:t[o],arc:r&&{...r,sweep:r.sweep?0:1}})}return{from:t[t.length-1],segs:n}}function be(e,t,n){let o={r:n,large:0,sweep:1};return{from:[e-n,t],segs:[{to:[e+n,t],arc:o},{to:[e-n,t],arc:o}]}}function q(e,t,n,o,r){let i=Math.min(r,n/2,o/2),s={r:i,large:0,sweep:1};return i<=0?ge([[e,t],[e+n,t],[e+n,t+o],[e,t+o]]):{from:[e+i,t],segs:[{to:[e+n-i,t]},{to:[e+n,t+i],arc:s},{to:[e+n,t+o-i]},{to:[e+n-i,t+o],arc:s},{to:[e+i,t+o]},{to:[e,t+o-i],arc:s},{to:[e,t+i]},{to:[e+i,t],arc:s}]}}function ge(e){let t=0;for(let o=0;o<e.length;o++){let[r,i]=e[o],[s,a]=e[(o+1)%e.length];t+=r*a-s*i}let n=t>0?e:[...e].reverse();return{from:n[0],segs:[...n.slice(1).map(o=>({to:o})),{to:n[0]}]}}function le(e,t,n){let o=n/2,r=t[0]-e[0],i=t[1]-e[1],s=Math.hypot(r,i);if(s<1e-6)return be(e[0],e[1],o);let a=[i/s*o,-r/s*o],c={r:o,large:0,sweep:1},u=[e[0]+a[0],e[1]+a[1]];return{from:u,segs:[{to:[t[0]+a[0],t[1]+a[1]]},{to:[t[0]-a[0],t[1]-a[1]],arc:c},{to:[e[0]-a[0],e[1]-a[1]]},{to:u,arc:c}]}}function ye(e,t,n=!1){let o=[],r=n?e.length:e.length-1;for(let i=0;i<r;i++)o.push(le(e[i],e[(i+1)%e.length],t));return o}function Be(e,t,n,o,r,i){let s=i/2,a=r-o>180?1:0,c={r:s,large:0,sweep:1},u=It(e,t,n+s,o);return{from:u,segs:[{to:It(e,t,n+s,r),arc:{r:n+s,large:a,sweep:1}},{to:It(e,t,n-s,r),arc:c},{to:It(e,t,n-s,o),arc:{r:n-s,large:a,sweep:0}},{to:u,arc:c}]}}var ee=(...e)=>e.flat().map(ai).join(" "),Ee=(e,t,n)=>`M${de(e-n)} ${de(t)}a${de(n)} ${de(n)} 0 1 0 ${de(2*n)} 0a${de(n)} ${de(n)} 0 1 0 ${de(-2*n)} 0`,Ue=(e,t,n,o,r)=>ai(q(e,t,n,o,r)),Mn=e=>`M${e.map(Rt).join("L")}`,xn=(e,t,n,o,r)=>`M${Rt(It(e,t,n,o))}A${de(n)} ${de(n)} 0 ${r-o>180?1:0} 1 ${Rt(It(e,t,n,r))}`;function St(e,t,n,o=1){let r=i=>[i[0]*o+t,i[1]*o+n];return{head:[e.head[0]*o+t,e.head[1]*o+n,e.head[2]*o],limbs:e.limbs.map(i=>i.map(r)),arcs:e.arcs?.map(([i,s,a,c,u])=>[i*o+t,s*o+n,a*o,c,u])}}function Xt(e){return[Ee(e.head[0],e.head[1],e.head[2]),...e.limbs.map(Mn),...(e.arcs??[]).map(([t,n,o,r,i])=>xn(t,n,o,r,i))].join(" ")}function Pt(e,t=2.6){return[be(e.head[0],e.head[1],e.head[2]+1),...e.limbs.flatMap(n=>ye(n,t)),...(e.arcs??[]).map(([n,o,r,i,s])=>Be(n,o,r,i,s,t-.2))]}var ft={head:[10,4,2],limbs:[[[10,8.2],[10,14],[15.5,14],[18,19.5],[20.5,19.5]],[[10,10.6],[14.5,10.6]]],arcs:[[9.5,16,5.5,35,235]]},Zr={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]]]},$r={cx:12,hr:1.9,arm:5,leg:3,r:2},Qr={cx:12,hr:1.9,sh:2.2,hem:6,leg:3},qr={cx:6.2,hr:1.8,arm:3.6,leg:2.2,r:1.4},Jr={cx:17.8,hr:1.8,sh:1.4,hem:4.1,leg:2.2};function ei({cx:e,hr:t,arm:n,leg:o,r}){return[Ee(e,2+t,t),`M${de(e-n+r)} 8.5H${de(e+n-r)}a${r} ${r} 0 0 1 ${r} ${r}V15H${de(e+o)}V22H${de(e-o)}V15H${de(e-n)}V${de(8.5+r)}a${r} ${r} 0 0 1 ${r} ${-r}Z`,`M${de(e)} 15V22`].join(" ")}function ti({cx:e,hr:t,arm:n,leg:o,r}){return[be(e,2+t,t+1),q(e-n-.5,7.8,2*n+1,7.7,r+.5),q(e-o-.5,13,o,9.5,1),q(e+.5,13,o,9.5,1)]}function ni({cx:e,hr:t,sh:n,hem:o,leg:r}){return[Ee(e,2+t,t),Mn([[e-n,8.5],[e+n,8.5],[e+o,16],[e+r,16],[e+r,22],[e-r,22],[e-r,16],[e-o,16]])+"Z",`M${de(e)} 16V22`].join(" ")}function oi({cx:e,hr:t,sh:n,hem:o,leg:r}){return[be(e,2+t,t+1),ge([[e-n-.6,7.8],[e+n+.6,7.8],[e+o+.9,16.8],[e-o-.9,16.8]]),q(e-r-.1,15,r-.4,7.5,.9),q(e+.5,15,r-.4,7.5,.9)]}var kl=[[14.6,1.5],[5.2,13.6],[11,13.6],[9.4,22.5],[18.8,10.4],[13,10.4]],Ol="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",Tl="M12 2.5S5 9.5 5 14.5a7 7 0 0 0 14 0c0-5-7-12-7-12Z",Ll="M2.5 21.5h19V3h-6v6.2H9.2v6.2H2.5Z",ri=[[9,3],[15,3],[15,9],[21,9],[21,15],[15,15],[15,21],[9,21],[9,15],[3,15],[3,9],[9,9]],Bl={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}}]},Fl={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 ii(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 si={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]]]},Nl=[[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]],Dl=[[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]],po=[{key:"restroom-men",label:"Men's restroom",group:"facilities",path:ei($r),solid:ee(ti($r))},{key:"restroom-women",label:"Women's restroom",group:"facilities",path:ni(Qr),solid:ee(oi(Qr))},{key:"restroom-accessible",label:"Accessible restroom",group:"facilities",path:[Ue(2.5,2.5,19,19,3.5),Xt(St(ft,4.6,4.3,.66))].join(" "),solid:ee(Pt(ft)),solidLarge:ee(q(1.5,1.5,21,21,4.5),pe(q(3.9,3.9,16.2,16.2,2.6)),Pt(St(ft,4.9,4.7,.62),2.2))},{key:"first-aid",label:"First aid",group:"facilities",path:Mn(ri)+"Z",solid:ee(ge(ri.map(([e,t])=>[e+(e-12)*.08,t+(t-12)*.08])))},{key:"coat-check",label:"Coat check",group:"facilities",path:"M10 6.5a2 2 0 1 1 2 2V10 M12 10 3.4 16.9a1.4 1.4 0 0 0 .9 2.6h15.4a1.4 1.4 0 0 0 .9-2.6Z",solid:ee(Be(12,6.2,2.2,180,450,2.3),le([12,8.4],[12,10.5],2.3),ye([[12,10.2],[3.2,18.8],[20.8,18.8]],2.8,!0))},{key:"atm",label:"ATM / cash",group:"facilities",path:[Ue(2,6,20,12,2),Ee(12,12,2.75),"M6 12h.01 M18 12h.01"].join(" "),solid:ee(q(1.5,5.5,21,13,2.4),pe(be(12,12,3.2)))},{key:"info",label:"Info point",group:"facilities",path:[Ee(12,12,9.5),"M10.8 11H12v5.8 M12 7.6h.01"].join(" "),solid:ee(be(12,4.9,2.4),q(10.3,9.2,3.4,12.3,1),q(8.2,9.2,4,3,1),q(8.2,18.5,7.6,3,1))},{key:"lost-found",label:"Lost & found",group:"facilities",path:[Ee(10.5,10.5,7.5),"M16 16l5.5 5.5","M8.4 8.4a2.1 2.1 0 1 1 3 1.9c-.6.4-.9.8-.9 1.6 M10.5 14.6h.01"].join(" "),solid:ee(Be(12,7.6,4.2,180,405,3.4),ye([[14.97,10.57],[12,13],[12,15]],3.4),be(12,20,2.1))},{key:"restrooms",label:"Toilets",group:"facilities",path:[ei(qr),ni(Jr)].join(" "),solid:ee(ti(qr),oi(Jr))},{key:"charging",label:"Charging point",group:"facilities",path:[Ue(6,2,12,20,2.5),"M13.2 6.2 9.6 12h4.8l-3.6 5.8"].join(" "),solid:ee(ge(kl))},{key:"smoking",label:"Smoking area",group:"facilities",path:[Ue(2,14.5,14.5,4,1),"M6.5 14.5v4","M15.5 11.5c0-1.4 1.5-1.9 1.5-3.4s-1.5-2-1.5-3.4 M19 11.5c0-1.4 1.5-1.9 1.5-3.4s-1.5-2-1.5-3.4"].join(" "),solid:ee(q(1.5,14,4.2,5,1.2),q(6.8,14,10.4,5,1.2),ye([[15.9,11.4],[17.3,8.9],[15.9,6.4],[17.1,3.9]],2.2),ye([[19.6,11.4],[21,8.9],[19.6,6.4],[20.8,3.9]],2.2))},{key:"no-smoking",label:"No smoking",group:"facilities",path:[Ee(12,12,9.5),"M5.3 5.3l13.4 13.4","M5.5 10.5h13v3h-13Z"].join(" "),solid:ee(be(12,12,10.6),pe(be(12,12,8)),le([6,6],[18,18],2.8),q(5,10.4,3,3.2,.6),q(16,10.4,3,3.2,.6))},{key:"food",label:"Food",group:"food-drink",path:"M5 2.5V8a2.5 2.5 0 0 0 5 0V2.5 M7.5 2.5v19 M18.5 13.5h-2c-1.3 0-2-1-2-2.5 0-4 1.5-7 4-8.5v19",solid:ee(ye([[4.9,2.6],[4.9,8]],2.2),ye([[10.1,2.6],[10.1,8]],2.2),ye([[7.5,2.6],[7.5,8]],2.2),Be(7.5,8,2.6,0,180,2.2),le([7.5,10],[7.5,21.4],3),ge([[19.4,2.2],[19.4,14.2],[16.2,14.2],[14.1,12],[14.1,9.4],[15.2,5.8],[17.3,3.3]]),le([18,13],[18,21.4],3))},{key:"bar",label:"Bar",group:"food-drink",path:"M3.5 3.5h17L12 13Z M6.2 6.5h11.6 M12 13v7.5 M8 20.5h8",solid:ee(ge([[2.8,3],[21.2,3],[12,13.6]]),le([12,12],[12,20.6],2.8),le([7.4,21],[16.6,21],2.8))},{key:"coffee",label:"Caf\xE9 / coffee",group:"food-drink",path:"M4 9h12v4.5a5.5 5.5 0 0 1-5.5 5.5h-1A5.5 5.5 0 0 1 4 13.5Z M16 10.5h1.2a2.75 2.75 0 0 1 0 5.5H16 M8 3v3 M12 3v3 M3 21.5h14",solid:ee({from:[3.4,8.4],segs:[{to:[16.6,8.4]},{to:[16.6,13.4]},{to:[11,19.4],arc:{r:5.8,large:0,sweep:1}},{to:[9,19.4]},{to:[3.4,13.4],arc:{r:5.8,large:0,sweep:1}},{to:[3.4,8.4]}]},Be(17.2,13.25,2.5,270,450,2.4),le([7.8,2.6],[7.8,5.6],2.4),le([12.2,2.6],[12.2,5.6],2.4),le([2.6,21.6],[17.4,21.6],2.6))},{key:"water",label:"Water / drinks",group:"food-drink",path:Tl,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:Ol,solid:"M8.4 2.8 3.5 5l-1.9 6 4.2 1.4.4-.8v9.4h11.6v-9.4l.4.8 4.2-1.4-1.9-6-4.9-2.2c-.4 1.5-1.8 2.6-3.6 2.6s-3.2-1.1-3.6-2.6Z"},{key:"screen",label:"Screen",group:"facilities",path:[Ue(2,3.5,20,13.5,2),"M12 17v3.5 M8 20.5h8","M10 7.8v5.9l5-2.95Z"].join(" "),solid:ee(q(1.5,3,21,14.4,2.4),pe(ge([[9.6,6.7],[16,10.2],[9.6,13.7]])),q(10.6,16.5,2.8,4,0),le([7.4,21],[16.6,21],2.8))},{key:"sound-booth",label:"Sound booth",group:"facilities",path:["M6 3v9 M6 16v5 M12 3v3 M12 10v11 M18 3v10 M18 17v4",Ee(6,14,2),Ee(12,8,2),Ee(18,15,2)].join(" "),solid:ee(le([6,2.8],[6,21.2],1.8),le([12,2.8],[12,21.2],1.8),le([18,2.8],[18,21.2],1.8),q(3.2,11.6,5.6,4.8,1.4),q(9.2,5.6,5.6,4.8,1.4),q(15.2,12.6,5.6,4.8,1.4))},{key:"entrance",label:"Entrance",group:"navigation",path:"M11 7V3.5a1 1 0 0 1 1-1h8a1 1 0 0 1 1 1v17a1 1 0 0 1-1 1h-8a1 1 0 0 1-1-1V17 M2.5 12h13.5 M12.5 8.5 16 12l-3.5 3.5",solid:ee(ye([[11,6.5],[11,2.6],[21,2.6],[21,21.4],[11,21.4],[11,17.5]],2.6),le([2.8,12],[13.5,12],3.2),ge([[12.6,7.8],[18,12],[12.6,16.2]]))},{key:"exit",label:"Exit",group:"navigation",path:"M13 7V3.5a1 1 0 0 0-1-1H4a1 1 0 0 0-1 1v17a1 1 0 0 0 1 1h8a1 1 0 0 0 1-1V17 M8 12h13.5 M18 8.5l3.5 3.5-3.5 3.5",solid:ee(ye([[13,6.5],[13,2.6],[3,2.6],[3,21.4],[13,21.4],[13,17.5]],2.6),le([7.2,12],[17,12],3.2),ge([[16.2,7.8],[21.6,12],[16.2,16.2]]))},{key:"emergency-exit",label:"Emergency exit",group:"navigation",path:[Xt(St(Zr,-2,1.4,1.15)),"M15.5 13h6 M19 10.5l2.5 2.5-2.5 2.5"].join(" "),solid:ee(Pt(St(Zr,-2,1.4,1.15),2.7),le([15.6,13],[19.5,13],2.8),ge([[18.4,9.4],[22.4,13],[18.4,16.6]]))},{key:"stairs",label:"Stairs",group:"navigation",path:Ll,solid:"M1.5 22.5h21V2h-7.8v6.4H8.4v6.4H1.5Z"},{key:"elevator",label:"Elevator",group:"navigation",path:[Ue(3.5,2.5,17,19,2.5),"M8.5 9.5 12 5.5l3.5 4Z M8.5 14.5l3.5 4 3.5-4Z"].join(" "),solid:ee(ge([[12,1.6],[19.6,10.2],[4.4,10.2]]),ge([[4.4,13.8],[19.6,13.8],[12,22.4]]))},{key:"parking",label:"Parking",group:"navigation",path:[Ue(3,3,18,18,3),"M9.5 17V7h3.75a3 3 0 0 1 0 6H9.5"].join(" "),solid:"M6.5 21V3H12a5.5 5.5 0 0 1 0 11h-1.9v7Z M10.1 6.6v3.8H12a1.9 1.9 0 0 0 0-3.8Z"},{key:"wheelchair",label:"Wheelchair access",group:"accessibility",path:Xt(ft),solid:ee(Pt(ft))},{key:"hearing",label:"Hearing assistance",group:"accessibility",path:["M4 9a6 6 0 1 1 12 0c0 3-1.8 4.3-3 5.2-1.1.8-1.6 1.7-1.6 3.1a3.6 3.6 0 0 1-6.2 2.1","M7.5 9a2.5 2.5 0 0 1 5 0c0 1.2-.7 1.9-1.6 2.5","M18.5 5.5a6.5 6.5 0 0 1 0 8"].join(" "),solid:ee(Be(10,9,6,180,380,3),ye([[15.64,11.05],[12.8,14.3],[11.5,17.2]],3),Be(8.2,17.2,3.3,0,150,3),Be(10,9,2.2,180,400,2.4),Be(13.38,9.5,6.5,322,398,2.6))},{key:"box-office",label:"Box office / tickets",group:"navigation",path:"M3 7.5A1.5 1.5 0 0 1 4.5 6h15A1.5 1.5 0 0 1 21 7.5V10a2 2 0 0 0 0 4v2.5a1.5 1.5 0 0 1-1.5 1.5h-15A1.5 1.5 0 0 1 3 16.5V14a2 2 0 0 0 0-4Z M15 6v2 M15 11v2 M15 16v2",solid:ee(Bl,pe(q(14.1,7,1.8,2.2,.9)),pe(q(14.1,10.9,1.8,2.2,.9)),pe(q(14.1,14.8,1.8,2.2,.9)))},{key:"escalator",label:"Escalator",group:"navigation",path:"M2.5 17H7l9-9h5.5v4h-4l-9 9h-6Z M11 4.5h.01 M11 8.2v3.3",solid:ee(ge([[2,16.4],[6.8,16.4],[15.8,7.4],[22,7.4],[22,12.6],[17.8,12.6],[8.8,21.6],[2,21.6]]),be(11,4.3,2.3),le([11,8],[11,11],2.6))},{key:"ramp",label:"Ramp",group:"navigation",path:"M2.5 19.5h19v-10Z M4.5 13.2 14 8.2 M10.53 7.76 14 8.2l-1.6 3.11",solid:ee(ge([[1.6,20.4],[22.4,20.4],[22.4,8.6]]),le([4.2,13.4],[13.2,8.6],2.6),ge([[15.4,7.5],[13.16,11.84],[10.56,6.88]]))},{key:"taxi",label:"Taxi / rideshare",group:"navigation",path:["M9.5 2.5h5V5h-5Z M6.5 11 8 7h8l1.5 4",Ue(3.5,11,17,6,2),"M6.5 17v2.5 M17.5 17v2.5 M7 14h.01 M17 14h.01"].join(" "),solid:ee(q(9,1.8,6,3.4,.8),ge([[6,11.4],[7.6,6.4],[16.4,6.4],[18,11.4]]),q(2.8,10.6,18.4,7,2.2),pe(be(6.8,14,1.3)),pe(be(17.2,14,1.3)),q(4.8,16,3.6,5.2,1.2),q(15.6,16,3.6,5.2,1.2))},{key:"transit",label:"Bus / transit",group:"navigation",path:[Ue(4.5,2.5,15,16,3),"M4.5 10.5h15 M9 5.5h6 M7.5 18.5V21 M16.5 18.5V21 M8 14.5h.01 M16 14.5h.01"].join(" "),solid:ee(q(4,2,16,17,3.2),pe(q(6.2,5.8,11.6,5,1)),pe(be(8,14.5,1.3)),pe(be(16,14.5,1.3)),q(6,17,3.4,5,1.2),q(14.6,17,3.4,5,1.2))},{key:"bike-parking",label:"Bike parking",group:"navigation",path:[Ee(6,14.5,4),Ee(18,14.5,4),"M6 14.5 9 7.5h6.5L18 14.5 M9 7.5l2.5 7H6 M11.5 14.5l4-7 M7.5 6h3 M15.5 7.5 15 5.5h2"].join(" "),solid:ee(be(6,14.5,4.9),pe(be(6,14.5,2.7)),be(18,14.5,4.9),pe(be(18,14.5,2.7)),ye([[6,14.5],[9,7.5],[15.5,7.5],[18,14.5]],2.2),ye([[9,7.5],[11.5,14.5],[15.5,7.5]],2.2),le([6,14.5],[11.5,14.5],2.2),le([7.2,5.8],[10.6,5.8],2.2),ye([[15.4,7.3],[15,5.4],[17.2,5.4]],2.2))},{key:"meeting-point",label:"Meeting point",group:"navigation",path:["M9.5 2.5 12 5l2.5-2.5 M9.5 21.5 12 19l2.5 2.5 M2.5 9.5 5 12l-2.5 2.5 M21.5 9.5 19 12l2.5 2.5",Ee(10,9.6,1.5),Ee(14,9.6,1.5),"M7.5 15.5a2.5 2.5 0 0 1 5 0 M11.5 15.5a2.5 2.5 0 0 1 5 0"].join(" "),solid:ee(ye([[9.4,2.4],[12,5],[14.6,2.4]],2.6),ye([[9.4,21.6],[12,19],[14.6,21.6]],2.6),ye([[2.4,9.4],[5,12],[2.4,14.6]],2.6),ye([[21.6,9.4],[19,12],[21.6,14.6]],2.6),be(9.7,9.3,2.2),be(14.3,9.3,2.2),ii(9.7,16,3),ii(14.3,16,3))},{key:"security",label:"Security / bag check",group:"facilities",path:"M12 2.5 19.5 5.5v6c0 4.6-3.2 8.4-7.5 10-4.3-1.6-7.5-5.4-7.5-10v-6Z M8.5 12l2.5 2.5 4.5-5",solid:ee(Fl,pe(ge([[7.4,12.2],[9,10.6],[10.9,12.5],[15,8.4],[16.6,10],[10.9,15.7]])))},{key:"lockers",label:"Lockers",group:"facilities",path:[Ue(3.5,2.5,17,19,1.5),"M12 2.5v19 M6 6h3 M15 6h3 M9.5 11.5v2.5 M14.5 11.5v2.5"].join(" "),solid:ee(q(3,2,8.4,20,1.4),pe(q(5,5,4.4,1.7,.8)),pe(q(8.6,10.8,1.5,3.8,.7)),q(12.6,2,8.4,20,1.4),pe(q(14.6,5,4.4,1.7,.8)),pe(q(13.9,10.8,1.5,3.8,.7)))},{key:"baby-change",label:"Baby change",group:"facilities",path:"M10 6.5l.8-3.3a1.2 1.2 0 0 1 2.4 0l.8 3.3 M8.5 6.5h7 M9.5 6.5l-.9 2.2a3 3 0 0 0-.1.9V19a2.5 2.5 0 0 0 2.5 2.5h2a2.5 2.5 0 0 0 2.5-2.5V9.6a3 3 0 0 0-.1-.9l-.9-2.2 M8.5 12.5h3 M8.5 16h3",solid:ee(ge([[9.6,6.2],[10.6,1.8],[13.4,1.8],[14.4,6.2]]),q(7.6,5.4,8.8,2.6,1),q(7.8,7.4,8.4,15,2.6),pe(q(7.8,11.8,3.4,1.5,0)),pe(q(7.8,15.4,3.4,1.5,0)))},{key:"prayer-room",label:"Prayer room",group:"facilities",path:[Xt(si),"M3 21.5h18"].join(" "),solid:ee(Pt(si),q(2.4,20.2,19.2,2.6,1.3))},{key:"quiet-room",label:"Quiet room",group:"facilities",path:"M4 9h3.5l5-4v14l-5-4H4Z M15.5 9.5l5 5 M20.5 9.5l-5 5",solid:ee(ge([[2.6,8.4],[7.2,8.4],[13,3.6],[13,20.4],[7.2,15.6],[2.6,15.6]]),le([15.4,9.2],[20.8,14.8],2.8),le([20.8,9.2],[15.4,14.8],2.8))},{key:"wifi",label:"Wi-Fi",group:"facilities",path:[xn(12,19,11.5,218,322),xn(12,19,7.5,218,322),xn(12,19,3.5,218,322),"M12 19h.01"].join(" "),solid:ee(Be(12,19.2,11,218,322,2.8),Be(12,19.2,6.9,218,322,2.8),be(12,19.2,2.2))},{key:"vip-lounge",label:"VIP lounge",group:"facilities",path:["M6.5 11V7a2 2 0 0 1 2-2h7a2 2 0 0 1 2 2v4","M3.5 11.5a1.5 1.5 0 0 1 3 0V14h11v-2.5a1.5 1.5 0 0 1 3 0v6h-17Z","M5.5 17.5V20 M18.5 17.5V20"].join(" "),solid:ee(q(6,4,12,8.5,2.2),q(2.4,9.6,4.6,9,2.2),q(17,9.6,4.6,9,2.2),q(6,13.2,12,5.4,.6),le([5,18],[5,20.6],2.4),le([19,18],[19,20.6],2.4))},{key:"accessible-entrance",label:"Accessible entrance",group:"accessibility",path:[Xt(St(ft,.3,5,.62)),"M12.5 3.5H20a1 1 0 0 1 1 1v15a1 1 0 0 1-1 1h-7.5"].join(" "),solid:ee(Pt(St(ft,.3,5,.62),2.2),ye([[13,2.8],[21.2,2.8],[21.2,21.2],[13,21.2]],2.6))},{key:"assistance-dog",label:"Assistance-dog area",group:"accessibility",path:[Mn(Nl)+"Z","M6 10.8 3.5 7.5","M10.5 10.5V6h4.5l1 2.5"].join(" "),solid:ee(ge(Dl),le([6.2,11],[3.2,7.2],2.4),ye([[10.5,11],[10.5,5.6],[15.2,5.6],[16.2,8.2]],2.2))}],xp=new Map(po.map(e=>[e.key,e]));var ci=po;var Gl=new Map(ci.map(e=>[e.key,e]));function bo(e){return e?Gl.get(e):void 0}var Pp=ci.map(e=>e.key);function Kt(e){if(e.length<3)return e.map(i=>({...i}));let t=[...e].sort((i,s)=>i.x-s.x||i.y-s.y),n=(i,s,a)=>(s.x-i.x)*(a.y-i.y)-(s.y-i.y)*(a.x-i.x),o=i=>{let s=[];for(let a of i){for(;s.length>=2&&n(s[s.length-2],s[s.length-1],a)<=0;)s.pop();s.push(a)}return s.pop(),s},r=[...o(t),...o([...t].reverse())];return r.length>=3?r.map(i=>({...i})):t.map(i=>({...i}))}var Fi=Ge(require("polygon-clipping"),1);var K={top:1,wallBottom:.58,bottomCap:.4};function mt(e,t){if(!e)return t;let n=W(Ve(e,.4),.62);return re(t,n,.22)}function li(e,t){return e?re(t,W(Ve(e,.25),.74),.62):t}function ui(e,t){let n=xt(bn({tierTop:t}));return e?ut(e,n.sectionDeck,Math.min(n.sectionDeckChromaShare*Ut(e),n.sectionDeckChromaCap)):ut(t,n.deck,Math.min(Ut(t),pn))}function fi(e,t){let n=new Map;for(let i of e.categories??[])n.set(i.key,i.color);let o=new Map;for(let i of t){if(!i.sectionId)continue;let s=o.get(i.sectionId);s||(s=new Map,o.set(i.sectionId,s)),s.set(i.categoryKey,(s.get(i.categoryKey)??0)+1)}let r=new Map;for(let[i,s]of o){let a=0,c=0,u=0,l=0;for(let[f,m]of s){let h=oe(n.get(f));h&&(a+=h[0]*m,c+=h[1]*m,u+=h[2]*m,l+=m)}l>0&&r.set(i,[a/l,c/l,u/l])}return r}function mi(e,t){return oe(e.color)??t.get(e.logicalSectionId??e.id)??null}var Mo=Ge(require("polygon-clipping"),1);var xo=Ge(require("polygon-clipping"),1);var di=[{key:"circle",label:"Standard seat",shortLabel:"Standard",useCase:"General assigned seating",group:"general",path:null,bounds:null,mark:null},{key:"theatre",label:"Theatre chair",shortLabel:"Theatre",useCase:"Auditoriums, arenas and stadium stands",group:"fixed",path:"M4.5 3.5 Q4.5 1.5 6.5 1.5 L17.5 1.5 Q19.5 1.5 19.5 3.5 L19.5 13 L4.5 13 Z M3.5 12 L20.5 12 Q22.5 12 22.5 14 L22.5 21 Q22.5 22.5 21 22.5 Q19.5 22.5 19.5 21 L19.5 17.5 L4.5 17.5 L4.5 21 Q4.5 22.5 3 22.5 Q1.5 22.5 1.5 21 L1.5 14 Q1.5 12 3.5 12 Z",bounds:{x:1.5,y:1.5,width:21,height:21},mark:{x:12,y:10,radius:6}},{key:"dining",label:"Dining chair",shortLabel:"Dining",useCase:"Banquets, restaurants and table seating",group:"flexible",path:"M7 1 Q6 1 6 2.5 L6.75 10.5 L5 10.5 Q4 10.5 4 12 L4 14 Q4 15 5.25 15 L6 15 L4 23 L7 23 L9.5 15 L14.5 15 L17 23 L20 23 L18 15 L18.75 15 Q20 15 20 14 L20 12 Q20 10.5 19 10.5 L17.25 10.5 L18 2.5 Q18 1 17 1 Z",bounds:{x:4,y:1,width:16,height:22},mark:{x:12,y:10,radius:4.5}},{key:"folding",label:"Folding chair",shortLabel:"Folding",useCase:"Concert floors, ceremonies and conferences",group:"flexible",path:"M6 2 Q5 2 5 3 L6 8 L18 8 L19 3 Q19 2 18 2 Z M5 9 L19 9 Q20 9 20 10.5 L19 13 L5 13 L4 10.5 Q4 9 5 9 Z M6 12 L9 12 L12 17 L15 12 L18 12 L14 19 L17 23 L14 23 L12 21 L10 23 L7 23 L10 19 Z",bounds:{x:4,y:2,width:16,height:21},mark:{x:12,y:5,radius:3}},{key:"armchair",label:"Premium armchair",shortLabel:"Armchair",useCase:"Boxes, lounges and club seating",group:"premium",path:"M3.5 4 Q3.5 1.5 6 1.5 L18 1.5 Q20.5 1.5 20.5 4 L20.5 13 L3.5 13 Z M1.5 12.5 Q1.5 10 3.25 10 Q5 10 5 12.5 L5 13.5 L19 13.5 L19 12.5 Q19 10 20.75 10 Q22.5 10 22.5 12.5 L22.5 19.5 Q22.5 22 20 22 L4 22 Q1.5 22 1.5 19.5 Z",bounds:{x:1.5,y:1.5,width:21,height:20.5},mark:{x:12,y:7.5,radius:5.5}},{key:"recliner",label:"Recliner",shortLabel:"Recliner",useCase:"Luxury cinemas and premium clubs",group:"premium",path:"M7 2 Q7 1 8.5 1 L15.5 1 Q17 1 17 2 L19 13 L5 13 Z M4 9 Q2 9 2 11.5 L2 16 Q2 18 4 18 L6 18 L6 15 L18 15 L18 18 L20 18 Q22 18 22 16 L22 11.5 Q22 9 20 9 Q18 9 18 11 L18 13 L6 13 L6 11 Q6 9 4 9 Z M7 17 L17 17 Q18 17 18.5 18.5 L19.5 22.5 L4.5 22.5 L5.5 18.5 Q6 17 7 17 Z",bounds:{x:2,y:1,width:20,height:21.5},mark:{x:12,y:8,radius:5}},{key:"stool",label:"Stool",shortLabel:"Stool",useCase:"Bars, high-tops and seating rails",group:"flexible",path:"M6 2.5 L18 2.5 Q22 2.5 22 6.5 L22 12 Q22 16 18 16 L6 16 Q2 16 2 12 L2 6.5 Q2 2.5 6 2.5 Z M6 15.5 L9.5 15.5 L7.5 22.5 L3 22.5 Z M14.5 15.5 L18 15.5 L20.5 22.5 L16 22.5 Z",bounds:{x:2,y:2.5,width:20,height:20},mark:{x:12,y:9.25,radius:6.5}},{key:"bench",label:"Bench place",shortLabel:"Bench",useCase:"Pews, bleachers and terraces",group:"fixed",path:"M2.5 0.5 L21.5 0.5 Q23 0.5 23 2 L23 5 Q23 6.5 21.5 6.5 L2.5 6.5 Q1 6.5 1 5 L1 2 Q1 0.5 2.5 0.5 Z M2 7.5 L22 7.5 Q23.5 7.5 23.5 9 L23.5 15.5 Q23.5 17 22 17 L18 17 L18 21.5 Q18 22.5 16.75 22.5 Q15.5 22.5 15.5 21.5 L15.5 17 L8.5 17 L8.5 21.5 Q8.5 22.5 7.25 22.5 Q6 22.5 6 21.5 L6 17 L2 17 Q0.5 17 0.5 15.5 L0.5 9 Q0.5 7.5 2 7.5 Z",bounds:{x:.5,y:.5,width:23,height:22},mark:{x:12,y:12.25,radius:4.75}}],pi=di.map(e=>e.key),jl=new Map(di.map(e=>[e.key,e]));function hi(e){return typeof e=="string"&&jl.has(e)}function bi(e,t){return hi(e)?e:hi(t?.seatGlyph)?t.seatGlyph:"circle"}var Re={pedestal:0,pad:1,back:2,arm:3,footrest:4,leg:5,body:10,head:11},Hl=.44,Vl=.15,Ul=.3,Xl=.24;function yi(e){return e===void 0||!Number.isFinite(e)||e<=0?Xl:Math.min(Ul,Math.max(Vl,e*Hl))}var Kl=.05,gi=.45,Yl=gi+Kl,Wl=.92;var vp=[{part:Re.pedestal,min:[-.3,0,-.3],max:[.3,.36,.3]},{part:Re.pad,min:[-1,.36,-.95],max:[1,gi,1]},{part:Re.back,min:[-1,Yl,-1],max:[1,Wl,-.72]},{part:Re.arm,min:[-1,.44,-.82],max:[-.78,.65,.78]},{part:Re.arm,min:[.78,.44,-.82],max:[1,.65,.78]},{part:Re.footrest,min:[-.9,.18,.78],max:[.9,.31,1.34]},{part:Re.leg,min:[-.82,0,-.7],max:[-.62,.37,-.48]},{part:Re.leg,min:[.62,0,-.7],max:[.82,.37,-.48]},{part:Re.leg,min:[-.82,0,.48],max:[-.62,.37,.7]},{part:Re.leg,min:[.62,0,.48],max:[.82,.37,.7]}],Cp=[{part:Re.body,min:[-.52,.39,-.08],max:[-.08,.55,.82]},{part:Re.body,min:[.08,.39,-.08],max:[.52,.55,.82]},{part:Re.body,min:[-.47,.05,.58],max:[-.13,.43,.82]},{part:Re.body,min:[.13,.05,.58],max:[.47,.43,.82]},{part:Re.head,min:[-.16,1.04,-.33],max:[.16,1.1,-.13]}];function xi(e,t,n,o){let r=new Float32Array(t),i=u=>e[u*3],s=u=>e[u*3+2],a=0,c=(u,l)=>{let f=l-u;for(let m=u;m<l;m++){let[h,d]=o(m),p=h-i(m),y=d-s(m);if(f>=2){let g=Math.max(u,m-1),M=Math.min(l-1,m+1),P=i(M)-i(g),R=s(M)-s(g),x=Math.hypot(P,R);if(x>1e-6){let b=-R/x,S=P/x;b*p+S*y<0&&(b=-b,S=-S),p=b,y=S}}r[m]=p===0&&y===0?0:Math.atan2(p,y)}};for(let u=1;u<=t;u++)(u===t||n(u)!==n(a))&&(c(a,u),a=u);return r}var Sn=.22;var zl=.42;function Zl(e){let t=e.length,n=new Float64Array(t);if(t<2)return n.fill(1/0),n;let o=1/0,r=1/0,i=-1/0,s=-1/0;for(let d of e)d.x<o&&(o=d.x),d.y<r&&(r=d.y),d.x>i&&(i=d.x),d.y>s&&(s=d.y);let a=Math.max(i-o,1e-6),c=Math.max(s-r,1e-6),u=Math.max(Math.sqrt(a*c/t),1e-6),l=Math.max(1,Math.ceil(a/u)+1),f=Math.max(1,Math.ceil(c/u)+1),m=new Map,h=(d,p)=>{let y=Math.min(l-1,Math.max(0,Math.floor((d-o)/u)));return Math.min(f-1,Math.max(0,Math.floor((p-r)/u)))*l+y};for(let d=0;d<t;d++){let p=h(e[d].x,e[d].y),y=m.get(p);y?y.push(d):m.set(p,[d])}for(let d=0;d<t;d++){let p=e[d],y=Math.min(l-1,Math.max(0,Math.floor((p.x-o)/u))),g=Math.min(f-1,Math.max(0,Math.floor((p.y-r)/u))),M=1/0;for(let P=1;P<=4;P++){for(let R=g-P;R<=g+P;R++)if(!(R<0||R>=f))for(let x=y-P;x<=y+P;x++){if(x<0||x>=l||P>1&&Math.abs(R-g)<P&&Math.abs(x-y)<P)continue;let b=m.get(R*l+x);if(b)for(let S of b){if(S===d)continue;let I=Math.hypot(e[S].x-p.x,e[S].y-p.y);I<M&&(M=I)}}if(Number.isFinite(M)&&M<=P*u)break}n[d]=M}return n}function $l(e){let t=e.eyeHeightM;return Number.isFinite(t)?Math.max(0,t-je):0}function Mi(e,t,n,o,r,i){let s=e.length,a=new Float32Array(s*3),c=new Float32Array(s),u=new Float32Array(s*3),l=new Float32Array(s),f=new Float32Array(s),m=new Float32Array(s),h=new Float32Array(s),d=new Float32Array(s*3),p=new Map,y=Zl(e);for(let g=0;g<s;g++){let M=e[g],R=(n?.seatPitchU(g)??y[g])*E;l[g]=Number.isFinite(R)?Math.max(.06,Math.min(Sn,R*zl)):Sn,f[g]=yi(Number.isFinite(R)?R:void 0);let x=bi(M.glyph,{seatGlyph:i?.get(M.categoryKey)});m[g]=pi.indexOf(x),h[g]=M.wheelchairSpaceType==="no-seat"?0:1,a[g*3]=M.x*E,a[g*3+1]=n?n.seatDeckY(g):$l(M),a[g*3+2]=M.y*E,c[g]=Hr(t?t(M):"available");let b=oe(r?.get(M.categoryKey)??"#6e7bff")??[.43,.48,1];if(u[g*3]=b[0],u[g*3+1]=b[1],u[g*3+2]=b[2],M.accessibility?.length){let S=oe(yn(M.accessibility));S&&(d[g*3]=S[0],d[g*3+1]=S[1],d[g*3+2]=S[2])}p.set(M.id,g)}return{count:s,iPosition:a,iState:c,iCategory:u,iMaxRadius:l,iRing:d,idToIndex:p,iChairWidth:f,iGlyph:m,iPhysicalSeat:h,iFloor:o??new Float32Array(s),iSection:new Float32Array(s).fill(-1),iYaw:new Float32Array(s)}}var Ri=Ge(require("earcut"),1);var Ql=.58,Si=.01,Te=Sn*1.5*Oe,ql=.5,Jl=.6;function eu(e,t){let n=e.length,o=[];for(let s=0;s<n;s++){let a=e[Math.max(0,s-1)],c=e[Math.min(n-1,s+1)],u=c.x-a.x,l=c.y-a.y,f=Math.hypot(u,l);if(f<1e-9){o.push([0,0]);continue}u/=f,l/=f,o.push([-l,u])}let r=0;for(let s=0;s<n;s++)r+=(e[s].x-t.x)*o[s][0]+(e[s].y-t.y)*o[s][1];return r<0?o.map(([s,a])=>[-s,-a]):o}function tu(e,t){if(e.length<2||t<=0)return[...e];let n=[...e],o=(s,a)=>{let c=a.x-s.x,u=a.y-s.y,l=Math.hypot(c,u)||1;return{x:c/l,y:u/l}},r=o(n[1],n[0]),i=o(n[n.length-2],n[n.length-1]);return n.unshift({x:n[0].x+r.x*t,y:n[0].y+r.y*t}),n.push({x:n[n.length-1].x+i.x*t,y:n[n.length-1].y+i.y*t}),n}var Pi=Math.PI/12;function nu(e){if(e.length<3)return[...e];let t=[...e].sort((i,s)=>i.x-s.x||i.y-s.y),n=(i,s,a)=>(s.x-i.x)*(a.y-i.y)-(s.y-i.y)*(a.x-i.x),o=i=>{let s=[];for(let a of i){for(;s.length>=2&&n(s[s.length-2],s[s.length-1],a)<=0;)s.pop();s.push(a)}return s.pop(),s},r=[...o(t),...o([...t].reverse())];return r.length>=3?r:[...e]}function wi(e,t){if(!e.length||!(t>0))return[];let n=nu(e),o=(a,c,u,l)=>{let f=u-c;for(;f<0;)f+=Math.PI*2;for(;f>Math.PI*2;)f-=Math.PI*2;let m=Math.max(1,Math.ceil(f/Pi)),h=t/Math.cos(f/m/2);for(let d=0;d<=m;d++){let p=c+f*d/m;l.push({x:a.x+Math.cos(p)*h,y:a.y+Math.sin(p)*h})}};if(n.length<3){let a=0,c=0;for(let h of n)a+=h.x,c+=h.y;a/=n.length||1,c/=n.length||1;let u=0;for(let h of n)u=Math.max(u,Math.hypot(h.x-a,h.y-c));let l=[],f=Math.max(3,Math.ceil(Math.PI*2/Pi)),m=(u+t)/Math.cos(Math.PI/f);for(let h=0;h<f;h++){let d=h/f*Math.PI*2;l.push({x:a+Math.cos(d)*m,y:c+Math.sin(d)*m})}return l}let r=n.length,i=[];for(let a=0;a<r;a++){let c=n[a],u=n[(a+1)%r];i.push(Math.atan2(-(u.x-c.x),u.y-c.y))}let s=[];for(let a=0;a<r;a++)o(n[a],i[(a+r-1)%r],i[a],s);return Ci(s)}function ou(e,t,n){if(e.length===1)return Math.hypot(t-e[0].x,n-e[0].y);let o=1/0;for(let r=0;r+1<e.length;r++){let i=e[r],s=e[r+1],a=s.x-i.x,c=s.y-i.y,u=a*a+c*c,l=u>1e-12?((t-i.x)*a+(n-i.y)*c)/u:0;l<0?l=0:l>1&&(l=1);let f=Math.hypot(t-(i.x+l*a),n-(i.y+l*c));f<o&&(o=f)}return o}function Pn(e){let t=e.map(r=>{let i=0,s=0;for(let u of r.pts)i+=u.x,s+=u.y;let a=r.pts.length||1;i/=a,s/=a;let c=0;for(let u of r.pts){let l=Math.hypot(u.x-i,u.y-s);l>c&&(c=l)}return{cx:i,cy:s,rad:c}}),n=r=>{let i=r.length;return i<=2?[...r]:[r[Math.floor(i*.25)],r[Math.floor(i*.5)],r[Math.floor(i*.75)]]},o=[];for(let r=0;r<e.length;r++){let i=n(e[r].pts),s=[],a=1/0,c=null;for(let l of i){let f=1/0;for(let m=0;m<e.length;m++){if(m===r||Math.abs(e[m].y-e[r].y)<.001)continue;let h=t[m],d=Math.hypot(l.x-h.cx,l.y-h.cy)-h.rad;if(d>=f&&d>=a)continue;let p=ou(e[m].pts,l.x,l.y);p<f&&(f=p),e[m].depth<e[r].depth&&p<a&&(a=p,c=e[m].y)}Number.isFinite(f)&&f>0&&s.push(f)}s.sort((l,f)=>l-f);let u=s.length?s[Math.floor(s.length/2)]:1;o.push({pitch:u,belowY:c})}return o}function Ei(e,t,n,o){let r=e[t],i=r.pts.length>=2?[...r.pts]:r.pts.length===1?(()=>{let l=r.pts[0],f=l.x-o.x,m=l.y-o.y,h=Math.hypot(f,m)||1;f/=h,m/=h;let d=Math.max(n[t].pitch,.001)*.5;return[{x:l.x+m*d,y:l.y-f*d},{x:l.x-m*d,y:l.y+f*d}]})():[];if(i.length<2)return null;let s=0,a=0;for(let l=1;l<i.length;l++){let f=Math.hypot(i[l].x-i[l-1].x,i[l].y-i[l-1].y);f>1e-6&&(s+=f,a++)}let c=a>0?s/a:0,u=tu(i,Math.max(c*Jl,Te));return{pts:u,nrm:eu(u,o),front:Math.max(n[t].pitch*Ql,Te),back:Math.max(n[t].pitch*ql,Te)}}var wt=1.5,Ai=.3;function yo(e,t){if(e.length<3)return e;let n=e[0],o=e[e.length-1],r=o.x-n.x,i=o.y-n.y,s=Math.hypot(r,i),a=-1,c=-1;for(let f=1;f<e.length-1;f++){let m=e[f],h=s>1e-12?Math.abs((m.x-n.x)*i-(m.y-n.y)*r)/s:Math.hypot(m.x-n.x,m.y-n.y);h>a&&(a=h,c=f)}if(a<=t||c<0)return[n,o];let u=yo(e.slice(0,c+1),t),l=yo(e.slice(c),t);return[...u.slice(0,-1),...l]}function _i(e,t){if(e.length<4)return e;let n=yo([...e,e[0]],t);return n.pop(),n.length>=3?n:e}function ru(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 vi(e,t,n){if(e.length<2)return[];let o=n??Pn(e),r=new Map;for(let s=0;s<e.length;s++){let a=r.get(e[s].blockId);a?a.push(s):r.set(e[s].blockId,[s])}let i=[];for(let[,s]of r){let a=[];for(let M of s){let P=e[M].patch;P&&P.length>=3?i.push({outline:[...P],holes:[],topY:e[M].y}):a.push(M)}if(!a.length)continue;a.sort((M,P)=>e[M].depth-e[P].depth);let u=a.map(M=>Ei(e,M,o,t)).filter(M=>M!==null);if(!u.length)continue;let l=(M,P)=>({x:M.pts[P].x-M.nrm[P][0]*(M.front+wt),y:M.pts[P].y-M.nrm[P][1]*(M.front+wt)}),f=(M,P)=>({x:M.pts[P].x+M.nrm[P][0]*(M.back+wt),y:M.pts[P].y+M.nrm[P][1]*(M.back+wt)}),m=u[0],h=u[u.length-1],d=[];for(let M=0;M<m.pts.length;M++)d.push(l(m,M));for(let M of u)d.push(f(M,M.pts.length-1));for(let M=h.pts.length-1;M>=0;M--)d.push(f(h,M));for(let M=u.length-1;M>=0;M--)d.push(l(u[M],0));let p=Ci(d),y=1/0;for(let M of a)e[M].y<y&&(y=e[M].y);if(!Number.isFinite(y))continue;if(p.length>=3&&Math.abs(Ae(p))>1e-6&&u.every(M=>{let P=M.pts[Math.floor(M.pts.length/2)];return _e(p,P.x,P.y)})&&!ru(p)){i.push({outline:_i(p,Ai),holes:[],topY:y});continue}for(let M of iu(u))i.push({outline:M,holes:[],topY:y})}return i}function iu(e){let t=[];for(let n of e){let o=[],r=[],i=n.front+wt,s=n.back+wt;for(let c=0;c<n.pts.length;c++){let u=n.pts[c],l=n.nrm[c];o.push([u.x-l[0]*i,u.y-l[1]*i]),r.push([u.x+l[0]*s,u.y+l[1]*s])}let a=[...o,...r.reverse()];a.length<3||(a.push(a[0]),t.push([a]))}if(!t.length)return[];try{let n=xo.default.union(t[0],...t.slice(1)),o=[];for(let r of n){if(!r.length||r[0].length<4)continue;let i=r[0].map(([c,u])=>({x:c,y:u})),s=i[0],a=i[i.length-1];i.length>1&&Math.abs(s.x-a.x)<1e-9&&Math.abs(s.y-a.y)<1e-9&&i.pop(),i.length>=3&&o.push(_i(i,Ai))}return o}catch{return[]}}function Ci(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 go=class{constructor(t){this.minX=1/0;this.minY=1/0;this.maxX=-1/0;this.maxY=-1/0;this.rings=t;for(let n of t)for(let o of n)o.x<this.minX&&(this.minX=o.x),o.y<this.minY&&(this.minY=o.y),o.x>this.maxX&&(this.maxX=o.x),o.y>this.maxY&&(this.maxY=o.y)}containsAll(t){for(let n of t)if(n.x<this.minX||n.x>this.maxX||n.y<this.minY||n.y>this.maxY)return!1;for(let n of this.rings){let o=!0;for(let r of t)if(!_e(n,r.x,r.y)){o=!1;break}if(o)return!0}return!1}};function Ii(e,t,n,o,r,i){if(o.length<3)return;if(n.containsAll(o)){let u=[0,1,0],l=o[0];for(let f=1;f+1<o.length;f++){let m=o[f],h=o[f+1];e.tri([l.x*E,r,l.y*E],[m.x*E,r,m.y*E],[h.x*E,r,h.y*E],u,i)}return}let s=o.map(u=>[u.x,u.y]);s.push(s[0]);let a;try{a=xo.default.intersection([s],t)}catch{return}let c=[0,1,0];for(let u of a){if(!u.length||u[0].length<4)continue;let l=u[0],f=[],m=[];for(let d=0;d<l.length-1;d++)f.push(l[d][0],l[d][1]),m.push([l[d][0],l[d][1]]);if(m.length<3)continue;let h=(0,Ri.default)(f,void 0,2);for(let d=0;d<h.length;d+=3){let p=m[h[d]],y=m[h[d+1]],g=m[h[d+2]];e.tri([p[0]*E,r,p[1]*E],[y[0]*E,r,y[1]*E],[g[0]*E,r,g[1]*E],c,i)}}}function ki(e,t,n,o,r,i,s){if(t.length<2)return;let a=s??Pn(t),c=[0,1,0],u=i&&i.length>=3?[[...i.map(h=>[h.x,h.y]),[i[0].x,i[0].y]]]:null,l=i&&i.length>=3?new go([[...i]]):null,f=h=>{e.setMaterial(2),h(),e.setMaterial(0)},m=h=>{e.setMaterial(3),h(),e.setMaterial(0)};for(let h=0;h<t.length;h++){let d=t[h];if(d.patch&&d.patch.length>=3){let x=[...d.patch],b=a[h].belowY??o;if(m(()=>{if(u&&l)Ii(e,u,l,x,d.y,r.tread);else{let S=x[0];for(let I=1;I+1<x.length;I++){let w=x[I],k=x[I+1];e.tri([S.x*E,d.y,S.y*E],[w.x*E,d.y,w.y*E],[k.x*E,d.y,k.y*E],c,r.tread)}}}),d.y>b+Si){let S=0,I=0;for(let w of x)S+=w.x,I+=w.y;S/=x.length,I/=x.length,f(()=>{for(let w=0;w<x.length;w++){let k=x[w],L=x[(w+1)%x.length],T=L.x-k.x,v=L.y-k.y,A=Math.hypot(T,v);if(A<1e-6)continue;let _=v/A,C=-T/A;(k.x-S)*_+(k.y-I)*C<0&&(_=-_,C=-C);let B=[_,0,C],O=[k.x*E,d.y,k.y*E],F=[L.x*E,d.y,L.y*E],D=[k.x*E,b,k.y*E],j=[L.x*E,b,L.y*E];e.tri(O,F,j,B,r.riser),e.tri(O,j,D,B,r.riser)}})}continue}let p=Ei(t,h,a,n);if(!p)continue;let{pts:y,nrm:g,front:M,back:P}=p,R=a[h].belowY??o;for(let x=0;x+1<y.length;x++){let b=y[x],S=y[x+1],I=g[x],w=g[x+1];if(Math.hypot(S.x-b.x,S.y-b.y)<1e-6||I[0]===0&&I[1]===0||w[0]===0&&w[1]===0)continue;let k=[(b.x-I[0]*M)*E,d.y,(b.y-I[1]*M)*E],L=[(S.x-w[0]*M)*E,d.y,(S.y-w[1]*M)*E],T=[(b.x+I[0]*P)*E,d.y,(b.y+I[1]*P)*E],v=[(S.x+w[0]*P)*E,d.y,(S.y+w[1]*P)*E];if(m(()=>{u&&l?Ii(e,u,l,[{x:b.x-I[0]*M,y:b.y-I[1]*M},{x:S.x-w[0]*M,y:S.y-w[1]*M},{x:S.x+w[0]*P,y:S.y+w[1]*P},{x:b.x+I[0]*P,y:b.y+I[1]*P}],d.y,r.tread):(e.tri(k,L,v,c,r.tread),e.tri(k,v,T,c,r.tread))}),d.y>R+Si){let A=[k[0],R,k[2]],_=[L[0],R,L[2]],C=[-I[0],0,-I[1]];f(()=>{e.tri(k,L,_,C,r.riser),e.tri(k,_,A,C,r.riser)})}}}}function su(e,t){let n=e.eventConfigurationIds;return!n?.length||!!t&&n.includes(t)}function Oi(e,t){return e.filter(n=>n.type!=="shape"||su(n,t))}function Ti(e,t){let n=e.focalPoint??{x:0,y:0};return e.floors?.length?e.floors.map((o,r)=>({objects:Oi(o.objects,t),focal:{x:(o.focalPoint??n).x,y:(o.focalPoint??n).y},baseHeightM:o.baseHeightM??0,index:r})):[{objects:Oi(e.objects,t),focal:n,baseHeightM:0,index:0}]}var au={minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};function Ye(e){return Wr(e)??au}function Li(e,t){let n=Le(e.outline,Te),o=Ye(n),r=t.filter(s=>s!==e&&s.outline&&s.outline.length>=3&&Mt(o,Ye(s.outline)));if(!r.length)return[n];let i=s=>{let a=s.map(c=>[c.x,c.y]);return a.push(a[0]),a};try{let s=Mo.default.difference([i(n)],...r.map(c=>[i(c.outline)])),a=[];for(let c of s){if(!c.length)continue;let u=c[0].map(([l,f])=>({x:l,y:f}));if(u.length>1){let l=u[0],f=u[u.length-1];Math.abs(l.x-f.x)<1e-9&&Math.abs(l.y-f.y)<1e-9&&u.pop()}u.length>=3&&a.push(u)}return a.length?a:[n]}catch{return[n]}}function Bi(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=Mo.default.intersection([n(i.outline)],o.flat())}catch{r.push(i);continue}for(let a of s){if(!a.length)continue;let c=a[0].map(([u,l])=>({x:u,y:l}));if(c.length>1){let u=c[0],l=c[c.length-1];Math.abs(u.x-l.x)<1e-9&&Math.abs(u.y-l.y)<1e-9&&c.pop()}c.length>=3&&r.push({outline:c,holes:[],topY:i.topY})}}return r.length?r:e}function cu(e,t){return e===void 0||t===void 0?!0:Math.abs(e-t)<.001}var In=class{constructor(){this.rings=[];this.boxes=[];this.levels=[]}subtract(t,n){let o=t.map(c=>[c.x,c.y]);if(o.length<3)return[];o.push(o[0]);let r=Ye(t),i=this.rings.filter((c,u)=>Mt(r,this.boxes[u])&&cu(n,this.levels[u])),s=[[o]];if(i.length)try{s=Fi.default.difference([o],...i).map(u=>u.map(l=>l.map(([f,m])=>[f,m])))}catch{s=[[o]]}this.rings.push([o]),this.boxes.push(r),this.levels.push(n);let a=[];for(let c of s){if(!c.length)continue;let u=c[0].map(([l,f])=>({x:l,y:f}));if(u.length>1){let l=u[0],f=u[u.length-1];Math.abs(l.x-f.x)<1e-9&&Math.abs(l.y-f.y)<1e-9&&u.pop()}u.length>=3&&a.push(u)}return a}};function Et(e,t,n=e){if(!t)return e;let o=1/0,r=-1/0,i=1/0,s=-1/0;for(let m of n)o=Math.min(o,m.x),r=Math.max(r,m.x),i=Math.min(i,m.y),s=Math.max(s,m.y);let a=(o+r)/2,c=(i+s)/2,u=t*Math.PI/180,l=Math.cos(u),f=Math.sin(u);return e.map(m=>{let h=m.x-a,d=m.y-c;return{x:a+h*l-d*f,y:c+h*f+d*l}})}function Ni(e){let t=ir(e);return!t.length||!e.points?.length?[]:t.map(n=>Et(n,e.rotation,e.points))}function ie(e){let t=null;if(e.kind==="polygon"&&e.points&&e.points.length>=3)return Et(en(e,4),e.rotation,e.points);if(e.kind==="rect"&&e.width&&e.height&&(t=jt(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?Et(t,e.rotation):null}function Fe(e){let t=e.role??"",o=t==="stage"?{kind:"stage",heightM:gr(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 lu=.08,uu=30,fu=.015;function mu(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 Di(e,t){let n=ie(e)??(e.points?.length?Et(e.points,e.rotation):null),o=Fe(e),i=!e.role&&o.kind==="plate"&&e.heightM===void 0&&!!n&&Math.abs(Ae(n))*$**2>=uu?fu:o.heightM;if(!n)return{topOffsetM:i,supportOffsetM:0};if(o.kind!=="plate"&&o.kind!=="stage")return{topOffsetM:i,supportOffsetM:0};let s=1/0,a=1/0,c=-1/0,u=-1/0;for(let h of n)s=Math.min(s,h.x),a=Math.min(a,h.y),c=Math.max(c,h.x),u=Math.max(u,h.y);let l=i,f=0,m=1e-6*Math.max(1,c-s,u-a);for(let h of t)c>h.minX&&s<h.maxX&&u>h.minY&&a<h.maxY&&l<=h.topOffsetM+1e-6&&(l=h.topOffsetM+lu),s>=h.minX-m&&c<=h.maxX+m&&a>=h.minY-m&&u<=h.maxY+m&&(!h.poly||n.every(y=>mu(y,h.poly)||hu(y,h.poly,m)))&&(f=Math.max(f,h.topOffsetM));return e.fill&&e.fill!=="none"&&e.fill!=="transparent"&&t.push({minX:s,minY:a,maxX:c,maxY:u,topOffsetM:l,poly:n}),{topOffsetM:l,supportOffsetM:Math.min(f,l)}}function hu(e,t,n){for(let o=0,r=t.length-1;o<t.length;r=o++){let i=t[r],s=t[o],a=s.x-i.x,c=s.y-i.y,u=a*a+c*c,l=u?Math.max(0,Math.min(1,((e.x-i.x)*a+(e.y-i.y)*c)/u)):0;if(Math.hypot(e.x-(i.x+l*a),e.y-(i.y+l*c))<=n)return!0}return!1}function et(e,t,n){return{x:e.x+(t.x-e.x)*n,y:e.y+(t.y-e.y)*n}}function ve(e){if(e.length!==4)return e;let t=Math.hypot(e[1].x-e[0].x,e[1].y-e[0].y),n=Math.hypot(e[2].x-e[1].x,e[2].y-e[1].y);return t>=n?e:[e[1],e[2],e[3],e[0]]}function we(e,t,n){return[et(e[0],e[1],t),et(e[0],e[1],n),et(e[3],e[2],n),et(e[3],e[2],t)]}function Yt(e,t,n){return[et(e[0],e[3],t),et(e[1],e[2],t),et(e[1],e[2],n),et(e[0],e[3],n)]}function ne(e,t,n,o,r,i,s){z(e,t,s?.length?s:void 0,()=>n,o,r,i,K)}var du=.8,pu=.6,bu=2;function tt(e,t){if(!t.length)return null;let n=[],o=0;for(let s of e.objects){if(s.type!=="shape"||s.role!=="wall")continue;let a=ie(s)??[],c=Gi(a)/2;!(c>0)||xu(a)/c*E>bu||(n.push(...a),o+=c)}if(n.length<3)return null;let r=Kt(n);if(r.length<3||o<Gi(r)*pu)return null;let i=0;for(let s of t)Mu(s,r)&&(i+=1);return i>=t.length*du?r:null}var Rn=6,yu=5,gu=8;function ji(e){return Math.max(gu,(Number.isFinite(e)?e:0)+yu)}function At(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 xu(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 Gi(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 Mu(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 Su(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 Pu(e,t){if(!e.length)return null;let n=0,o=0,r=0;for(let h of e)n+=h.x,o+=h.y,r+=Math.hypot(h.x-t.x,h.y-t.y);let i=e.length;n/=i,o/=i,r/=i;let s=e[0],a=-1;for(let h of e){let d=Math.hypot(h.x-n,h.y-o);d>a&&(a=d,s=h)}let c=s.x-n,u=s.y-o,l=Math.hypot(c,u);l>1e-9?(c/=l,u/=l):(c=1,u=0);let f=[...e].sort((h,d)=>(h.x-n)*c+(h.y-o)*u-((d.x-n)*c+(d.y-o)*u)),m=0;for(let h of f){let d=Math.hypot(h.x-n,h.y-o);d>m&&(m=d)}return{pts:f,cx:n,cy:o,radius:m,depth:r}}function Hi(e,t,n){let o=e.pts;if(o.length===1)return Math.hypot(t-o[0].x,n-o[0].y);let r=1/0;for(let i=0;i+1<o.length;i++){let s=o[i],a=o[i+1],c=a.x-s.x,u=a.y-s.y,l=c*c+u*u,f=l>1e-12?((t-s.x)*c+(n-s.y)*u)/l:0;f<0?f=0:f>1&&(f=1);let m=Math.hypot(t-(s.x+f*c),n-(s.y+f*u));m<r&&(r=m)}return r}var wn=8;function Iu(e,t,n){let o=new Array(wn).fill(1/0),r=new Array(wn).fill(-1);for(let l=0;l<e.length;l++){let f=e[l],m=Math.hypot(t-f.cx,n-f.cy)-f.radius;for(let h=0;h<wn;h++)if(m<o[h]){for(let d=wn-1;d>h;d--)o[d]=o[d-1],r[d]=r[d-1];o[h]=m,r[h]=l;break}}let i=new Array(3).fill(1/0),s=new Array(3).fill(-1);for(let l of r){if(l<0)continue;let f=Hi(e[l],t,n);for(let m=0;m<3;m++)if(f<i[m]){for(let h=2;h>m;h--)i[h]=i[h-1],s[h]=s[h-1];i[m]=f,s[m]=l;break}}if(s[0]<0)return 0;if(i[0]<1e-6)return e[s[0]].depth;let a=i[0]*2.2,c=0,u=0;for(let l=0;l<3;l++){let f=s[l];if(f<0||i[l]>a)continue;let m=1/(i[l]*i[l]);c+=m*e[f].depth,u+=m}return u>0?c/u:e[s[0]].depth}function Ru(e){let t=(o,r)=>Iu(e,o,r),n=(o,r)=>{let i=1/0,s=-1;for(let a=0;a<e.length;a++){let c=e[a];if(Math.hypot(o-c.cx,r-c.cy)-c.radius>=i)continue;let u=Hi(c,o,r);u<i&&(i=u,s=a)}return s};return{kind:"rows",rowCount:e.length,rows:e,nearestRow:n,depthAt:t,gradientAt:(o,r)=>{let i=(t(o+.5,r)-t(o-.5,r))/1,s=(t(o,r+.5)-t(o,r-.5))/(2*.5),a=Math.hypot(i,s);return a<1e-9?[0,0]:[i/a,s/a]}}}function Vi(e,t){let n=[];for(let o of e){let r=Pu(o.points,t);r&&n.push(r)}return n.length<2?Su(t):(n.sort((o,r)=>o.depth-r.depth),Ru(n))}var nt=.06,wu=.05,Xi=.05,Ui=.15,So=25;function Ki(e,t,n){let o=new Map,r=new Array(t.length).fill(null),i=new Float64Array(t.length),s=new Array(t.length).fill(void 0),a=new Array(t.length).fill(void 0),c=new Map,u=[],l=new Set;for(let m=0;m<e.length;m+=1){let h=e[m];for(let d of h.objects){if(d.type==="table"&&l.add(d.id),d.type!=="section"||!d.outline||d.outline.length<3)continue;let p=Le(d.outline,Te);c.set(d.id,{section:d,unit:h,frontU:1/0,hasSeats:!1,rows:new Map,seatIndices:[]}),u.push({id:d.id,floorIndex:m,box:Ye(p),section:d,unit:h,outline:p})}}let f=new Map;for(let m of u){let h=f.get(m.floorIndex);h?h.push(m):f.set(m.floorIndex,[m])}for(let m=0;m<t.length;m++){let h=t[m],d=n?f.get(n[m])??[]:u,p=h.sectionId?d.find(g=>g.id===h.sectionId)??d.find(g=>g.section.logicalSectionId===h.sectionId&&Pe({x:h.x,y:h.y},g.outline,g.section.holes)):void 0,y=p?[p]:d;for(let g of y){if(n&&g.floorIndex!==n[m]||!p&&(h.x<g.box.minX||h.x>g.box.maxX||h.y<g.box.minY||h.y>g.box.maxY||!Pe({x:h.x,y:h.y},g.outline,g.section.holes)))continue;r[m]=g.id;let M=c.get(g.id);M.hasSeats=!0;let P=h.focalPoint??g.unit.focal,R=Math.hypot(h.x-P.x,h.y-P.y);R<M.frontU&&(M.frontU=R),M.seatIndices.push(m);let x=h.rowId||`__seat-${m}`,b=M.rows.get(x);b?b.push({x:h.x,y:h.y}):M.rows.set(x,[{x:h.x,y:h.y}]);break}}for(let[m,h]of c){let d=Qe(h.section,{floorBaseHeightM:h.unit.baseHeightM}),p=h.unit.baseHeightM,y=d.rake>0?Math.tan(d.rake*Math.PI/180):0,g=d.rake<=.01&&d.height<=p+.001,M=h.section.surfaceKind,P=M==="flat"?!0:M==="rakedRows"&&d.rake>.01?!1:g,R=h.hasSeats?tn(m,t,h.seatIndices,h.unit.focal):{sectionId:m,rows:[],blockCount:0},b=R.rows.length<2?Vi([...h.rows.values()].map(O=>({points:O})),h.unit.focal):null,S=1/0;if(b){if(h.hasSeats)for(let O of h.rows.values())for(let F of O){let D=b.depthAt(F.x,F.y);D<S&&(S=D)}if(!h.hasSeats||!Number.isFinite(S)){S=1/0;for(let O of h.section.outline){let F=b.depthAt(O.x,O.y);F<S&&(S=F)}}}let I=p+wu,w=Math.max(I,d.height),k=O=>{let F=Math.max(0,O-S)*$,D=Math.min(F*y,So);return Math.max(I,d.height+D)},L=O=>{let F=Math.max(0,O)*$,D=Math.min(F*y,So);return Math.max(I,d.height+D)},T=P?[]:R.rows.map(O=>({pts:O.pts,y:L(O.blockDepth),depth:O.blockDepth,blockId:O.blockId,...l.has(O.id)?{patch:wi(O.pts,Te)}:{}})),v=T.length?T[0].y:w,A=T.map(O=>{let F=O.patch&&O.patch.length>=3?O.patch:O.pts,D=0,j=0;for(let V of F)D+=V.x,j+=V.y;let N=F.length||1;D/=N,j/=N;let X=0;for(let V of F){let Z=Math.hypot(V.x-D,V.y-j);Z>X&&(X=Z)}return{cx:D,cy:j,rad:X}}),_=P?()=>w:T.length>=2?(O,F)=>{let D=1/0,j=v;for(let N=0;N<T.length;N++){let X=A[N];if(Math.hypot(O-X.cx,F-X.cy)-X.rad>=D)continue;let V=T[N].patch,Z=V&&V.length>=3?_e(V,O,F)?0:bt(V,O,F):bt(T[N].pts,O,F);Z<D&&(D=Z,j=T[N].y)}return j}:(O,F)=>b?k(b.depthAt(O,F)):w,C=[0,1,0],B=T.length>=2||P?()=>C:(O,F)=>{if(!b)return C;let D=b.depthAt(O,F);if(D<=S)return C;let j=(D-S)*$;if(j*y>=So||d.height+j*y<=I)return C;let[N,X]=b.gradientAt(O,F);if(N===0&&X===0)return C;let V=1/Math.hypot(y,1);return[-N*y*V,V,-X*y*V]};if(!P)for(let O of R.rows){let F=L(O.blockDepth);for(let D of O.seatIndices)s[D]=F}for(let O of R.rows){let F=[];for(let V=1;V<O.pts.length;V++){let Z=Math.hypot(O.pts[V].x-O.pts[V-1].x,O.pts[V].y-O.pts[V-1].y);Z>1e-6&&F.push(Z)}F.sort((V,Z)=>V-Z);let D=F.length?F[Math.floor(F.length/2)]:1/0,j=1/0,N=O.pts[Math.floor(O.pts.length/2)];if(N)for(let V of R.rows){if(V===O||V.blockId!==O.blockId)continue;let Z=bt(V.pts,N.x,N.y);Z>1e-6&&Z<j&&(j=Z)}let X=Math.min(D,Math.max(j,D*.5));if(Number.isFinite(X)&&X>0)for(let V of O.seatIndices)a[V]=X}o.set(m,{sectionId:m,deckAt:_,normalAt:B,flat:P,bottomY:p,rowLevels:T,landingY:v})}for(let m=0;m<t.length;m++){let h=r[m],d=t[m];if(h){let g=s[m];i[m]=(g??o.get(h).deckAt(d.x,d.y))+Ui;continue}let p=d.eyeHeightM,y=Number.isFinite(p)?Math.max(0,p-je):0;i[m]=d.kind==="booth"?y+nt+Ui:y}return{bySection:o,seatOwner:r,seatDeckY:m=>i[m],seatPitchU:m=>a[m]}}function _t(e,t,n){if(e.length!==4||n<=t)return null;let o=ve(e),r=Math.hypot(o[1].x-o[0].x,o[1].y-o[0].y)*E,i=Math.hypot(o[3].x-o[0].x,o[3].y-o[0].y)*E;if(r<1e-6||i<1e-6)return null;let s=Math.min(.22/r,.16),a=Math.min(.28,(n-t)*.13),c=Math.min(.065/i,.2);return{quad:o,side:s,face:c,opening:we(o,s,1-s),openingTop:n-a}}function Po(e,t,n){if(e.length!==4||n-t<=.2)return null;let o=ve(e),r=Math.hypot(o[1].x-o[0].x,o[1].y-o[0].y)*E;if(r<=1e-6)return null;let i=Math.min(.14,(n-t)*.08,r*.08),s=i/r,a=we(o,s,1-s);return{quad:o,side:s,trim:i,inner:a,panel:Yt(a,.15,.85),bottom:t+i,top:n-i}}function Yi(e,t,n,o){let r=Po(e,t,n);if(!r)return;let{panel:i}=r,s=(M,P)=>({x:(M.x+P.x)/2,y:(M.y+P.y)/2}),a=s(i[0],i[1]),c=s(i[3],i[2]),u=Math.hypot(a.x-o.x,a.y-o.y)<=Math.hypot(c.x-o.x,c.y-o.y),[l,f]=u?[i[0],i[1]]:[i[3],i[2]],m=u?{x:a.x-c.x,y:a.y-c.y}:{x:c.x-a.x,y:c.y-a.y},h=Math.hypot(m.x,m.y);if(h<1e-6)return;-(f.y-l.y)*m.x+(f.x-l.x)*m.y<0&&([l,f]=[f,l]);let d=Math.min(.006,h*E*.05),p=m.x/h*d,y=m.y/h*d,g=(M,P)=>[M.x*E+p,P,M.y*E+y];return[g(l,r.bottom),g(f,r.bottom),g(l,r.top),g(f,r.top)]}var zi=Ge(require("polygon-clipping"),1);var Wi=Ge(require("polygon-clipping"),1);function We(e,t,n,o,r,i,s,a={}){let c=Ye(t),u=a.ao??K,l=r.flatMap(p=>{if(p.role!=="entrance"&&p.role!=="exit")return[];let y=ie(p);if(!y||y.length!==4||!Mt(c,Ye(y)))return[];let g=a.portalBase??n,M=_t(y,g,g+Fe(p).heightM);if(!M)return[];let P=Math.min(o,M.openingTop);return P<=n?[]:[{poly:M.opening,height:P}]});if(!l.length)return!1;let f=p=>p.map(y=>[y.x,y.y]),m=[f(t),...(a.holes??[]).map(f)],h=[n,...new Set(l.map(p=>p.height)),o].sort((p,y)=>p-y),d=[];try{for(let p=1;p<h.length;p++){let y=h[p-1],g=h[p];if(g-y<1e-6)continue;let M=l.filter(R=>R.height>y+1e-6).map(R=>[f(R.poly)]),P=M.length?Wi.default.difference(m,...M):[m];d.push({low:y,high:g,polys:P})}}catch{return!1}for(let p of d)for(let y of p.polys){let[g,...M]=y.map(R=>R.map(([x,b])=>({x,y:b}))),P=R=>u.wallBottom+(u.top-u.wallBottom)*(R-n)/(o-n);z(e,g,M,()=>p.high,p.low,i,s,{...u,top:P(p.high),wallBottom:P(p.low)})}return!0}var Io={depthM:1.6,thicknessM:.35,minWallM:6};function En(e,t,n,o,r,i,s,a,c){let u=o-n;if(u<=0)return;let l=a&&(c??u)>=Io.minWallM?Eu(t,a):null,f=l?o-Io.thicknessM:o,m=f-n,h=m<1.5?[[n,f,1]]:l?[[n,n+Math.min(.9,m*.18),.82],[n+Math.min(.9,m*.18),f,1]]:[[n,n+Math.min(.9,m*.18),.82],[n+Math.min(.9,m*.18),f-.1,1],[f-.1,f,1.1]],d=p=>K.wallBottom+(K.top-K.wallBottom)*(p-n)/u;for(let[p,y,g]of h){let M={...K,top:d(y),wallBottom:d(p)},P=W(i,g),R=W(s,g);We(e,t,p,y,r,P,R,{portalBase:n,ao:M})||z(e,t,void 0,()=>y,p,P,R,M)}for(let[p,...y]of l??[])z(e,p,y.length?y:void 0,()=>o,f,W(i,1.12),W(s,.78),K)}function Eu(e,t){let n=Io.depthM/E,o=e.map(s=>{let a=t.x-s.x,c=t.y-s.y,u=Math.hypot(a,c)||1;return{x:s.x+a/u*n,y:s.y+c/u*n}}),r=s=>{let a=s.map(c=>[c.x,c.y]);return a.push(a[0]),a},i=[[r(e)],[r(o)]];for(let s=0;s<e.length;s++){let a=(s+1)%e.length;i.push([r([e[s],e[a],o[a],o[s]])])}try{let[s,...a]=i,c=zi.default.union(s,...a);return c.length?c.map(u=>u.map(l=>l.slice(0,-1).map(([f,m])=>({x:f,y:m})))):null}catch{return null}}function Zi(e){return e.route?.stepFree===!0&&(e.kind==="line"||e.kind==="polyline")}function $i(e){let t=Number.isFinite(e)&&e>0?e:4;return[Math.max(6,t*2.6),Math.max(4,t*1.7)]}function Qi(e,t,n){let o=[];if(e.length<2||!(t>0)||!(n>=0))return o;let r=!0,i=t;for(let s=0;s<e.length-1;s+=1){let a=e[s],c=e[s+1],u=Math.hypot(c.x-a.x,c.y-a.y);if(u<1e-9)continue;let l=(c.x-a.x)/u,f=(c.y-a.y)/u,m=0;for(;m<u-1e-9;){let h=Math.min(i,u-m);r&&o.push([{x:a.x+l*m,y:a.y+f*m},{x:a.x+l*(m+h),y:a.y+f*(m+h)}]),m+=h,i-=h,i<=1e-9&&(r=!r,i=r?t:n)}}return o}function Wt(e,t,n){let o=oe(t.stroke?.color),r=t.stroke?.width??0;if(!o||!Number.isFinite(r)||r<=0)return;let i=t.kind==="line"||t.kind==="polyline",s=i?Et(t.points??[],t.rotation):ie(t);if(!s||s.length<2)return;let a=r*.5,c=Zi(t)?Qi(s,...$i(r)):Array.from({length:i?s.length-1:s.length},(u,l)=>[s[l],s[(l+1)%s.length]]);for(let[u,l]of c){let f=Math.hypot(l.x-u.x,l.y-u.y);if(f<1e-6)continue;let m=-(l.y-u.y)/f*a,h=(l.x-u.x)/f*a,d=[(u.x+m)*E,n,(u.y+h)*E],p=[(l.x+m)*E,n,(l.y+h)*E],y=[(l.x-m)*E,n,(l.y-h)*E],g=[(u.x-m)*E,n,(u.y-h)*E];e.tri(d,p,y,[0,1,0],o),e.tri(d,y,g,[0,1,0],o)}}function qi(e){return e==="bar"||e==="concession"||e==="coat"||e==="restroom"}var vt=(e,t,n)=>({x:e.x+(t.x-e.x)*n,y:e.y+(t.y-e.y)*n});function An(e,t,n,o){let[r,i,s,a]=t?e:[e[3],e[2],e[1],e[0]];return[vt(r,a,n),vt(i,s,n),vt(i,s,o),vt(r,a,o)]}function Ji(e,t,n,o,r,i,s,a,c=!1){if(n.length!==4||r-o<.4)return!1;let u=I=>c?Math.min(I,r):I,l=ve(n),f=Math.hypot(l[3].x-l[0].x,l[3].y-l[0].y)*E;if(f<.4)return!1;let m=vt(l[0],l[1],.5),h=vt(l[3],l[2],.5),d=Math.hypot(m.x-a.x,m.y-a.y)<=Math.hypot(h.x-a.x,h.y-a.y),p=re(s,[.92,.9,.86],.35),y=W(i,.72),g=r-o;if(t==="restroom"){let I=Math.min(.18,g*.08);return ne(e,l,r-I,o,s,i),ne(e,l,r,r-I,p,p),!0}let M=o+Math.min(1.1,g),P=t==="coat"?1:Math.min(.5,.75/f),R=An(l,d,0,P);if(ne(e,R,M-.05,o,y,i),ne(e,R,M,M-.05,p,p),t==="coat"||f<1.2)return!0;if(t==="bar"){let I=An(l,d,Math.max(P+.2,1-.45/f),1),w=u(o+Math.max(Math.min(2.2,g*2),M-o+.6));return ne(e,I,w,o,s,y),!0}let x=An(l,d,Math.max(P+.25,.55),1),b=u(o+Math.max(2.6,M-o+1.4));if(b-.14<=M)return!0;ne(e,x,b-.14,o,s,i),ne(e,l,b,b-.14,p,y);let S=Math.min(.08,.1/Math.max(.1,Math.hypot(l[1].x-l[0].x,l[1].y-l[0].y)*E));for(let[I,w]of[[0,S],[1-S,1]])ne(e,An(we(l,I,w),d,0,Math.min(.08,.1/f)),b-.14,M,y,y);return!0}var Au=[.12,.38,.16],_u=[.72,.62,.45],vu=[.88,.93,.96],es=[.95,.95,.94],Cu=[.66,.29,.22],Ro={length:20.12,width:3.05},ku=.14,Ou=9.76,ze=[.93,.94,.95],_n=[.1,.11,.13],Tu=[.45,.85,1.25],Lu=1.45,ts=.012,ns=.004,Bu=1.07,Fu=.15;function kt(e,t,n,o,r,i){e.setMaterial(i),z(e,t,n?[n.slice().reverse()]:void 0,()=>o,o-.004,r,r,K)}var os=(e,t)=>Je(e,t/E);function rs(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 Nu(e,t,n,o){let r=t.map(i=>[i.x*E,n,i.y*E]);e.tri(r[0],r[1],r[2],[0,1,0],o),e.tri(r[0],r[2],r[3],[0,1,0],o)}function vn(e,t,n,o,r,i){let s=n/E,a=[{x:t.x-s,y:t.y-s},{x:t.x+s,y:t.y-s},{x:t.x+s,y:t.y+s},{x:t.x-s,y:t.y+s}];z(e,a,void 0,()=>r,o,i,W(i,.85),K)}function Ct(e,t,n,o,r,i,s){let a=rs(t,n,o/E);a&&z(e,a,void 0,()=>i,r,s,W(s,.85),K)}function Cn(e){let t=ve(e),n={x:(t[0].x+t[2].x)/2,y:(t[0].y+t[2].y)/2},o=Math.hypot(t[1].x-t[0].x,t[1].y-t[0].y)||1,r=Math.hypot(t[3].x-t[0].x,t[3].y-t[0].y)||1,i={x:(t[1].x-t[0].x)/o,y:(t[1].y-t[0].y)/o},s={x:(t[3].x-t[0].x)/r,y:(t[3].y-t[0].y)/r};return{at:(c,u)=>({x:n.x+(i.x*c+s.x*u)/E,y:n.y+(i.y*c+s.y*u)/E}),lengthM:o*E,widthM:r*E}}function is(e,t,n){let o=xr(t);if(!o.length)return;let r=1/0,i=-1/0,s=1/0,a=-1/0;for(let P of t.points??[])r=Math.min(r,P.x),i=Math.max(i,P.x),s=Math.min(s,P.y),a=Math.max(a,P.y);let c=(t.rotation??0)*Math.PI/180,u=Math.cos(c),l=Math.sin(c),f=(r+i)/2,m=(s+a)/2,h=P=>c?{x:f+(P.x-f)*u-(P.y-m)*l,y:m+(P.x-f)*l+(P.y-m)*u}:P,d=Math.min(i-r,a-s)*E,p=Math.max(.04,Math.min(.3,d*.004))/E,y=0;e.setMaterial(0);for(let P of o){if(!P.fill)continue;let R=P.points.map(h);kt(e,R,null,n+ts+y*ns,oe(P.fill)??ze,0),y++}let g=o.filter(P=>!(P.fill&&P.ink===P.fill)),M=[...new Set(g.map(P=>P.ink??on))];for(let P of M){let R=n+ts+y++*ns,x=oe(P)??ze;for(let b of g){if((b.ink??on)!==P)continue;let S=b.points.map(h),I=b.closed?S.length:S.length-1;for(let w=0;w<I;w++){let k=rs(S[w],S[(w+1)%S.length],p);k&&Nu(e,k,R,x)}}}}function ss(e,t,n,o,r){if(t.length<3)return!1;let i=o+.006,s=r??Au;if(n==="oval-cricket"){let a=t.reduce((x,b)=>x+b.x,0)/t.length,c=t.reduce((x,b)=>x+b.y,0)/t.length,u=x=>t.map(b=>({x:a+(b.x-a)*x,y:c+(b.y-c)*x})),l=8;for(let x=0;x<l;x++){let b=u(1-x/l),S=x===l-1?null:u(1-(x+1)/l);kt(e,b,S,i,W(s,x%2?1.04:.96),4)}let f=t[0];for(let x of t)Math.hypot(x.x-a,x.y-c)>Math.hypot(f.x-a,f.y-c)&&(f=x);let m=Math.hypot(f.x-a,f.y-c)||1,h=(f.x-a)/m,d=(f.y-c)/m,p=-d,y=h,g=Math.min(1,2*m*E*ku/Ro.length),M=Ro.length*g/2/E,P=Ro.width*g/2/E,R=[[-M,-P],[M,-P],[M,P],[-M,P]].map(([x,b])=>({x:a+h*x+p*b,y:c+d*x+y*b}));return kt(e,R,null,i+.004,_u,0),e.setMaterial(0),!0}if(n==="rink-hockey"){let a=os(t,Fu);return kt(e,a,null,i,vu,0),e.setMaterial(0),z(e,t,[a.slice().reverse()],()=>o+Bu,o,es,W(es,.9),K),!0}if(n==="ring-boxing"&&t.length===4){let{at:a}=Cn(t),c=[a(-3.05,-3.05),a(3.05,-3.05),a(3.05,3.05),a(-3.05,3.05)],u=[[.77,.19,.19],ze,[.17,.42,.69],ze];e.setMaterial(0),c.forEach((l,f)=>vn(e,l,.07,o,o+Lu,u[f]));for(let l of Tu)for(let f=0;f<4;f++)Ct(e,c[f],c[(f+1)%4],.025,o+l-.025,o+l+.025,ze);return!0}if(n==="court-tennis"&&t.length===4){let{at:a}=Cn(t);e.setMaterial(0),Ct(e,a(0,-6.4),a(0,6.4),.015,o,o+.95,_n),Ct(e,a(0,-6.4),a(0,6.4),.03,o+.95,o+1,ze);for(let c of[-1,1])vn(e,a(0,c*6.4),.05,o,o+1.07,_n);return!0}if(n==="court-basketball"&&t.length===4){let{at:a,lengthM:c}=Cn(t),u=Math.min(14,c/2-.5);e.setMaterial(0);for(let l of[-1,1]){let f=a(l*(u+1.2),0),m=a(l*(u-1.2),0);vn(e,f,.12,o,o+3.4,_n),Ct(e,f,m,.06,o+3.25,o+3.4,_n),Ct(e,a(l*(u-1.2),-.9),a(l*(u-1.2),.9),.03,o+2.9,o+3.95,ze)}return!0}if(n==="pitch-rugby"&&t.length===4){let{at:a,lengthM:c}=Cn(t),u=c*(50/120);e.setMaterial(0);for(let l of[-1,1]){for(let f of[-2.8,2.8])vn(e,a(l*u,f),.07,o,o+12,ze);Ct(e,a(l*u,-2.8),a(l*u,2.8),.06,o+2.94,o+3.06,ze)}return!0}if(n==="track-athletics"){let a=os(t,Ou);return a.length<3?!1:(kt(e,t,a,i,Cu,0),kt(e,a,null,i,s,4),e.setMaterial(0),!0)}return!1}var as=[.19,.4,.15],Du=.012,Ln=2.4,Gu=1,ju=.75,Hu=.15;function Ne(e){if(e.points&&e.points.length>=3)return e.points;let{center:t,width:n,height:o,rotation:r}=e;if(!n||!o)return null;let i=(r??0)*Math.PI/180,s=Math.cos(i),a=Math.sin(i),c=n/2,u=o/2;return[[-c,-u],[c,-u],[c,u],[-c,u]].map(([l,f])=>({x:t.x+l*s-f*a,y:t.y+l*a+f*s}))}function ds(e,t,n,o,r,i,s=!1){let a=Ne(t);if(a){if(s){let c=mt(o,r.boothTop),u=He([...a]);z(e,Le(u,Vu/E),[u.slice().reverse()],()=>n+.03,n,c,W(c,.8),K);return}if(!(!t.points&&i&&Xu(e,a,n,o,i))){if(!t.points&&i&&a.length===4){Uu(e,a,n,o,i);return}z(e,a,void 0,()=>n+Ln,n,mt(o,r.boothTop),r.boothWall,K)}}}var wo=1.1,cs=[.9,.9,.88],Vu=.1,kn=[.87,.87,.85],ls=.08;function ps(e,t){let n=c=>({x:(e[c].x+e[(c+1)%4].x)/2,y:(e[c].y+e[(c+1)%4].y)/2}),o=0,r=1/0;for(let c=0;c<4;c++){let u=n(c),l=Math.hypot(u.x-t.x,u.y-t.y);l<r&&(r=l,o=c)}let i=[0,1,2,3].map(c=>e[(o+c)%4]),s=(c,u,l)=>({x:c.x+(u.x-c.x)*l,y:c.y+(u.y-c.y)*l});return{q:i,part:(c,u,l,f)=>{let m=s(i[0],i[1],c),h=s(i[0],i[1],u),d=s(i[3],i[2],c),p=s(i[3],i[2],u);return[s(m,d,l),s(h,p,l),s(h,p,f),s(m,d,f)]},depthM:Math.hypot(i[3].x-i[0].x,i[3].y-i[0].y)*E,widthM:Math.hypot(i[1].x-i[0].x,i[1].y-i[0].y)*E}}function Uu(e,t,n,o,r){let{q:i,part:s}=ps(t,r),a=o??[.35,.42,.55],c=re(a,[.78,.78,.77],.62),u=re(a,[.95,.95,.94],.45);ne(e,i,n+nt,n,c,W(c,.8)),ne(e,s(.05,.95,.72,.98),n+wo-.05,n+nt,u,W(u,.8)),ne(e,s(.03,.97,.7,1),n+wo,n+wo-.05,cs,W(cs,.9))}function Xu(e,t,n,o,r){if(t.length!==4)return!1;let{q:i,part:s,depthM:a,widthM:c}=ps(t,r);if(a<1||c<1)return!1;let u=o??[.35,.42,.55],l=re(u,[.78,.78,.77],.62),f=n+Ln,m=ls/c,h=ls/a;ne(e,i,n+nt,n,l,W(l,.8)),ne(e,s(0,1,1-h,1),f,n+nt,kn,W(kn,.9));for(let[y,g]of[[0,m],[1-m,1]])ne(e,s(y,g,0,1-h),f,n+nt,kn,W(kn,.9));ne(e,s(m,1-m,0,Math.min(.5,.06/a)),f,f-.3,u,W(u,.85));let d=Math.min(.4,.6/c),p=Math.min(.12,.3/a);return ne(e,s(.5-d,.5+d,.72-p,.72+p),n+Gu,n+nt,re(u,[.95,.95,.94],.7),W(u,.75)),!0}function Bn(e){if(e.shape==="round"){let l=e.radius;return l?fn(e.center.x,e.center.y,l,l,24):null}let{width:t,height:n,rotation:o,center:r}=e;if(!t||!n)return null;let i=(o??0)*Math.PI/180,s=Math.cos(i),a=Math.sin(i),c=t/2,u=n/2;return[[-c,-u],[c,-u],[c,u],[-c,u]].map(([l,f])=>({x:r.x+l*s-f*a,y:r.y+l*a+f*s}))}function bs(e,t,n,o,r,i=!0){let s=Bn(t);if(!s)return;let a=s.reduce((m,h)=>m+h.x,0)/s.length,c=s.reduce((m,h)=>m+h.y,0)/s.length,u=m=>s.map(h=>({x:a+(h.x-a)*m,y:c+(h.y-c)*m})),l=i&&o?mt(o,r.tableTop):Ku,f=n+ju;z(e,s,void 0,()=>f,n+Yu,l,W(l,.86),K),z(e,u(.12),void 0,()=>f+.12,f,us,W(us,.8),K)}var Ku=[.93,.92,.89],us=[.78,.66,.42],Yu=.25,zt={armM:1.1,widthM:.28,insideM:1.4,low:.043,high:.048};function Wu(e,t,n){let o=e.reduce((g,M)=>g+M.x,0)/4,r=e.reduce((g,M)=>g+M.y,0)/4,i=e[3].x-e[0].x,s=e[3].y-e[0].y,a=Math.hypot(i,s)||1;i/=a,s/=a,i*(t.x-o)+s*(t.y-r)<0&&(i=-i,s=-s);let c=-s,u=i,l=zt.armM/E,f=zt.widthM/E,m=a/2+zt.insideM/E,h=n?-1:1,d=o+i*(m+(n?0:l)),p=r+s*(m+(n?0:l)),y=(g,M)=>({x:d+i*g*h+c*M,y:p+s*g*h+u*M});return[y(0,0),y(-l,l),y(-l-f,l),y(-f,0),y(-l-f,-l),y(-l,-l)]}function zu(e,t,n,o,r){let i=[.94,.95,.96];z(e,Wu(t,o,r),void 0,()=>n+zt.high,n+zt.low,i,i,K)}function Tn(e,t){let n=oe(e);return n?{top:W(Ve(n,.12),.95),wall:W(Ve(n,.12),.85)}:{top:t.tierTop,wall:t.tierWall}}function ys(e,t,n,o,r,i,s,a,c=[]){let u=ie(t),l=Ni(t);if(!t.role&&(!t.fill||t.fill==="none"||t.fill==="transparent")||!u){Wt(e,t,n+o+Du);return}let m=a?a.kind==="stage":t.role==="stage",h=a?a.kind==="screen":t.role==="screen",d=a?{kind:m?"stage":"solid",heightM:a.topY-a.baseY}:Fe(t),p=a?.baseY??n,y=a?.topY??n+o;if(m&&s){let T=1/0,v=-1/0,A=1/0,_=-1/0;for(let C of u)C.x<T&&(T=C.x),C.x>v&&(v=C.x),C.y<A&&(A=C.y),C.y>_&&(_=C.y);s.push({cx:(T+v)/2*E,cz:(A+_)/2*E,y,halfX:Math.max((v-T)/2*E,.5),halfZ:Math.max((_-A)/2*E,.5)})}let g=oe(t.fill),M=t.role==="wall"||t.role==="entrance"||t.role==="exit",P=M?Tn(t.fill,r).top:m&&g?re(r.stageTop,W(Ve(g,.18),.9),.9):!t.role&&g?g:mt(g,m?r.stageTop:r.decorTop),R=h?g:null,x=M?Tn(t.fill,r).wall:m?g?re(r.stageWall,W(g,.58),.82):r.stageWall:h?R?re(W(R,1.42),[.24,.46,.82],.08):[.24,.46,.82]:mt(oe(t.fill),r.decorWall),b=m&&bn(r)?xt(!0):null,S=b?hs(P,b.stageTop):P,I=b?hs(x,b.stageWall):x;if(t.role==="wall"&&!a){En(e,u,p,y,c,S,I,i),Wt(e,t,y+.012);return}if(h&&u.length===4&&y-p>.2){let T=Po(u,p,y);if(!T)return;let{quad:v,side:A,trim:_,inner:C,panel:B}=T,O=[.12,.15,.18];for(let[F,D]of[[0,A],[1-A,1]])ne(e,we(v,F,D),y,p,O,O);ne(e,C,p+_,p,O,O),ne(e,C,y,y-_,O,O),ne(e,B,y-_,p+_,I,I),Wt(e,t,y+.012);return}let w=g?W(Ve(g,.15),.82):I,k=g?W(Ve(g,.1),1.02):S;if(qi(t.role)&&!a&&Ji(e,t.role,u,p,y,w,k,i,t.heightM!==void 0))return;if((t.role==="sound"||a?.kind==="sound_desk")&&u.length===4&&y-p>.3){let T=ve(u),v=Math.hypot(T[1].x-T[0].x,T[1].y-T[0].y)*E,A=Math.min(.12,.09/Math.max(v,.001)),_=[.18,.21,.24],C=y-Math.min(.12,(y-p)*.15);for(let[B,O]of[[0,A],[1-A,1]])ne(e,we(T,B,O),C,p,_,_);ne(e,T,y,C,S,_);return}if(t.role==="rail"&&u.length===4&&y>p){let T=ve(u),v=Math.hypot(T[1].x-T[0].x,T[1].y-T[0].y)*E,A=Math.max(1,Math.min(128,Math.ceil(v/1.4))),_=Math.min(.08,.055/Math.max(.055,v)),C=[.58,.64,.66];for(let B=0;B<=A;B++){let O=B/A,F=Math.min(1-_,Math.max(0,O-_/2));ne(e,we(T,F,F+_),y,p,C,W(C,.8))}for(let B of[.52,1]){let O=p+(y-p)*B;ne(e,T,O,Math.max(p,O-.055),C,W(C,.8))}return}if(t.role==="goal"&&u.length===4){let T=ve(u),v=Math.hypot(T[1].x-T[0].x,T[1].y-T[0].y)*E,A=Math.min(.12,.1/Math.max(.1,v)),_=[.9,.94,.94];for(let[C,B]of[[0,A],[1-A,1]])ne(e,we(T,C,B),Math.max(p,y-.1),p,_,_);ne(e,T,y,Math.max(p,y-.1),_,_);return}if(d.kind==="portal"&&u.length===4){let T=_t(u,p,y);if(!T)return;let{quad:v,side:A,face:_,openingTop:C}=T;for(let[B,O,F]of[[0,_,1],[_,1-_,.67],[1-_,1,1]]){let D=Yt(v,B,O),j=W(S,F),N=W(I,F);for(let[X,V]of[[0,A],[1-A,1]])ne(e,we(D,X,V),C,p,j,N);ne(e,D,y,C,j,N)}(t.role==="entrance"||t.role==="exit")&&zu(e,v,p,i,t.role==="exit");return}if(d.kind==="suite"&&u.length===4){let T=u.map((_,C)=>{let B=u[(C+1)%4],O=(_.x+B.x)/2,F=(_.y+B.y)/2;return Math.hypot(O-i.x,F-i.y)}),v=T.indexOf(Math.min(...T)),A=[0,1,2,3].map(_=>u[(v+_)%4]);ne(e,we(A,0,.08),y,p,S,I),ne(e,we(A,.92,1),y,p,S,I),ne(e,Yt(A,.88,1),y,p,S,I),ne(e,A,y,Math.max(p,y-.18),S,I);return}if(m&&!t.stageKind?.startsWith("pitch-")&&y-p>.12){let T=y-Math.min(.06,(y-p)*.15);ne(e,u,T,p,S,I,l),ne(e,u,y,T,S,re(S,I,.2),l)}else ne(e,u,y,p,S,I,l);if((t.stageKind==="pitch-football"||t.stageKind==="pitch-rugby")&&u.length===4){e.setMaterial(4);let T=ve(u),v=re(g??as,as,g?.45:0);for(let A=0;A<12;A++){let _=we(T,A/12,(A+1)/12),C=W(v,A%2?1.09:.91),B=_.map(O=>[O.x*E,y+.006,O.y*E]);e.tri(B[0],B[1],B[2],[0,1,0],C),e.tri(B[0],B[2],B[3],[0,1,0],C)}}t.stageKind&&t.stageKind!=="pitch-football"&&ss(e,u,t.stageKind,y,g),m&&st(t.stageKind)&&is(e,t,y),e.setMaterial(h?1:0),Wt(e,t,y+.012)}function Fn(e){let{x:t,y:n,width:o,height:r}=e;if(!o||!r)return null;let i=t+o/2,s=n+r/2,a=(e.rotation??0)*Math.PI/180,c=Math.cos(a),u=Math.sin(a),l=o/2,f=r/2;return[[-l,-f],[l,-f],[l,f],[-l,f]].map(([m,h])=>({x:i+m*c-h*u,y:s+m*u+h*c}))}function Zu(e){if(!e||!e.startsWith("data:image/svg+xml"))return null;let t=e.slice(e.indexOf(",")+1);if(/;base64/i.test(e.slice(0,e.indexOf(","))))try{t=atob(t)}catch{return null}else try{t=decodeURIComponent(t)}catch{}let n=t.match(/<(?:rect|path)\b[^>]*\bfill="([^"]+)"/i);if(!n)return null;let o=n[1].trim();if(o==="none"||o==="transparent")return null;let r=o.match(/^url\(#([^)]+)\)$/);if(!r)return oe(o);let i=t.match(new RegExp(`<(?:linear|radial)Gradient\\b[^>]*\\bid="${r[1]}"[^>]*>([\\s\\S]*?)</(?:linear|radial)Gradient>`,"i"));if(!i)return null;let s=[];for(let a of i[1].matchAll(/stop-color="([^"]+)"/gi)){let c=oe(a[1].trim());c&&s.push(c)}return s.length?s.reduce((a,c,u)=>re(a,c,1/(u+1)),s[0]):null}function gs(e,t,n,o){if(t.layer==="foreground")return;let r=Fn(t);if(!r)return;let i=n+Hu,s=mt(Zu(t.href),o.decorTop),a=Math.max(0,Math.min(1,t.opacity??1));a<1&&(s=re(o.ground,s,a)),z(e,r,void 0,()=>i,n,s,re(s,o.decorWall,.5),K)}function xs(e,t,n,o,r){if(!t.points||t.points.length<3)return;let i=li(o,r.gaTop);z(e,t.points,t.holes,()=>n+fs,n,i,r.gaWall,K),qu(e,t.points,n+fs)}var fs=.15,On=[.72,.74,.76],Eo=1.1,ms=.12,Ao=.05,$u=.06,Qu=2.4;function qu(e,t,n){let o=He([...t]),r=Je(o,ms/E),i=Je(o,(ms+Ao)/E);if(r.length<3||i.length<3)return;for(let a of[n+Eo,n+Eo*.5])z(e,r,[i.slice().reverse()],()=>a,a-Ao,On,W(On,.85),K);let s=$u/2/E;for(let a=0;a<r.length;a++){let c=r[a],u=r[(a+1)%r.length],l=Math.hypot(u.x-c.x,u.y-c.y)*E,f=Math.max(1,Math.round(l/Qu));for(let m=0;m<f;m++){let h=m/f,d=c.x+(u.x-c.x)*h,p=c.y+(u.y-c.y)*h,y=[{x:d-s,y:p-s},{x:d+s,y:p-s},{x:d+s,y:p+s},{x:d-s,y:p+s}];z(e,y,void 0,()=>n+Eo-Ao,n,On,W(On,.8),K)}}}function hs(e,t){return mn(e)<t?ut(e,t):e}var _o=.6,Ms=3,Ju=.25;function ef(e,t){if(_e(t,e.x,e.y))return 0;let n=1/0;for(let o=0,r=t.length-1;o<t.length;r=o++){let i=t[r],s=t[o],a=s.x-i.x,c=s.y-i.y,u=a*a+c*c||1,l=Math.max(0,Math.min(1,((e.x-i.x)*a+(e.y-i.y)*c)/u));n=Math.min(n,Math.hypot(e.x-(i.x+l*a),e.y-(i.y+l*c)))}return n}function Ss(e,t){let n=e.map(s=>({booth:s,ring:Ne(s)})).filter(s=>!!s.ring&&s.ring.length===4&&!s.booth.points),o=n.map(({ring:s})=>({minX:Math.min(...s.map(a=>a.x)),maxX:Math.max(...s.map(a=>a.x)),minY:Math.min(...s.map(a=>a.y)),maxY:Math.max(...s.map(a=>a.y))})),r=(Ms+_o)/E,i=new Map;return n.forEach(({booth:s,ring:a},c)=>{let u={x:a.reduce((h,d)=>h+d.x,0)/4,y:a.reduce((h,d)=>h+d.y,0)/4},l=[0,1,2,3].map(h=>{let d=a[h],p=a[(h+1)%4],y={x:(d.x+p.x)/2,y:(d.y+p.y)/2},g=y.x-u.x,M=y.y-u.y,P=Math.hypot(g,M)||1,R={x:y.x+g/P*_o/E,y:y.y+M/P*_o/E},x=Ms/E;return o.forEach((b,S)=>{S===c||R.x<b.minX-r||R.x>b.maxX+r||R.y<b.minY-r||R.y>b.maxY+r||(x=Math.min(x,ef(R,n[S].ring)))}),{open:x*E,toward:{x:y.x+g/P*10/E,y:y.y+M/P*10/E},focal:Math.hypot(y.x-t.x,y.y-t.y)}}),f=Math.max(...l.map(h=>h.open)),m=l.filter(h=>h.open>=f-Ju).sort((h,d)=>h.focal-d.focal)[0];i.set(s.id,m.toward)}),i}var Ps=Ge(require("polygon-clipping"),1);var tf=.45,nf=1500,of=200;function Is(e,t){if(e.role!=="stage"||st(e.stageKind))return e;let n=ie(e);if(!n||n.length<3||Math.abs(Ae(n))*E*E>nf)return e;let o=t.filter(s=>_e(n,s.x,s.y));if(!o.length||o.length>of)return e;let r=tf/E,i=o.map(s=>[[[s.x-r,s.y-r],[s.x+r,s.y-r],[s.x+r,s.y+r],[s.x-r,s.y+r],[s.x-r,s.y-r]]]);try{let s=Ps.default.difference([[...n.map(u=>[u.x,u.y]),[n[0].x,n[0].y]]],...i),a=null,c=0;for(let u of s){let l=u[0].slice(0,-1).map(([m,h])=>({x:m,y:h})),f=Math.abs(Ae(l));f>c&&(c=f,a=l)}return!a||a.length<3?e:{...e,kind:"polygon",points:a,rotation:0}}catch{return e}}var rf=Math.PI/180,se=96,sf=6,af=60,cf=150,Rs=.2,lf=.35;function uf(e,t){let n=Math.atan2(t.x-e.x,t.y-e.y)/rf;return n<0?n+360:n}function Nn(e){if(!e.length)return NaN;let t=[...e].sort((n,o)=>n-o);return t[Math.floor(t.length/2)]}function Dn(e,t,n=2){let o=e.length,r=new Float64Array(o);for(let i=0;i<o;i++){let s=0,a=0;for(let c=-n;c<=n;c++){let u=i+c;if(t)u=(u%o+o)%o;else if(u<0||u>=o)continue;s+=e[u],a++}r[i]=s/a}return r}function ws(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=qn(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=Nn(o.map(g=>g.x)),h=Nn(o.map(g=>g.y)),d=0;for(let g of n)for(let M of g.rows)for(let P of M.pts){let R=Math.hypot(P.x-a.x,P.y-a.y);R>d&&(d=R)}let p=0,y=d*.2;for(let g of n)for(let M of g.rows)for(let P of M.pts)Math.hypot(P.x-m,P.y-h)<y&&p++;Math.hypot(m-a.x,h-a.y)<=d&&p/s<.01&&(c={x:m,y:h})}let u=[];for(let m of n){let h={sectionId:m.sectionId,rMin:1/0,rMax:-1/0,samples:[]};for(let d of m.rows)for(let p of d.pts){let y=Math.hypot(p.x-c.x,p.y-c.y),g=Math.min(se-1,Math.floor(uf(c,p)/(360/se)));h.samples.push({r:y,bin:g,levelM:d.levelM}),y<h.rMin&&(h.rMin=y),y>h.rMax&&(h.rMax=y)}h.samples.length&&u.push(h)}if(!u.length)return null;u.sort((m,h)=>m.rMin+m.rMax-(h.rMin+h.rMax));let l=[];for(let m of u){let h=!1;for(let d of l){let p=Math.min(m.rMax,d.rMax)-Math.max(m.rMin,d.rMin),y=Math.min(m.rMax-m.rMin,d.rMax-d.rMin);if(y>1e-9&&p>=lf*y){d.members.push(m),d.rMin=Math.min(d.rMin,m.rMin),d.rMax=Math.max(d.rMax,m.rMax),h=!0;break}}h||l.push({members:[m],rMin:m.rMin,rMax:m.rMax})}let f=[];for(let m of l){let h=new Array(se).fill(null);for(let v of m.members)for(let A of v.samples){let _=h[A.bin];_||(_={samples:[]},h[A.bin]=_),_.samples.push({r:A.r,levelM:A.levelM})}let d=h.map(v=>!!v);if(!d.filter(Boolean).length)continue;let y=[],g=[];for(let v of h){if(!v)continue;let A=1/0,_=-1/0;for(let C of v.samples)C.r<A&&(A=C.r),C.r>_&&(_=C.r);y.push(A),g.push(_)}let M=Nn(y),P=Nn(g);if(!(M>=Rs*P)||!(P>0))continue;let R=[...y].sort((v,A)=>v-A);if(!(R[Math.floor(R.length*.1)]>=Rs*P))continue;let b=h.map(v=>{if(!v)return null;let A=[...v.samples].sort((N,X)=>N.r-X.r),_=A[0].r,C=A[A.length-1].r,B=A[0].levelM,O=-1/0;for(let N of A)N.levelM>O&&(O=N.levelM);let F=[];for(let N of A){let X={r:N.r,l:N.levelM};for(;F.length&&Math.abs(F[F.length-1].r-X.r)<1e-9;){if(F[F.length-1].l<=X.l){X.skip=!0;break}F.pop()}if(!X.skip){for(;F.length>=2;){let V=F[F.length-2],Z=F[F.length-1];if((Z.r-V.r)*(X.l-V.l)-(Z.l-V.l)*(X.r-V.r)<=0)F.pop();else break}F.push(X)}}let D=F.map(N=>N.r),j=F.map(N=>N.l);return{inner:_,outer:C,front:B,top:O,profile:{rs:D,ls:j}}}),S=d.slice();for(let v=0;v<se;v++){if(S[v])continue;let A=-1,_=-1,C=0;for(let U=1;U<=se;U++){let te=(v-U+se*2)%se;if(S[te]){A=te;break}}for(let U=1;U<=se;U++){let te=(v+U)%se;if(S[te]){_=te,C=U;break}}if(A<0||_<0)continue;let B=0;for(let U=1;U<=se;U++){let te=(v-U+se*2)%se;if(d[te]){B=U;break}}if(B-1+C>sf)continue;let F=b[A],D=b[_],j=B/(B+C),N=F.inner+(D.inner-F.inner)*j,X=F.outer+(D.outer-F.outer)*j,V=F.front+(D.front-F.front)*j,Z=F.top+(D.top-F.top)*j;b[v]={inner:N,outer:X,front:V,top:Z,profile:{rs:[N,X],ls:[V,Z]}}}for(let v=0;v<se;v++)b[v]&&(S[v]=!0);let I=360/se,w=[],k=S.filter(Boolean).length,L=[];if(k===se)L.push({start:0,len:se});else{let v=0;for(;S[v];)v=(v+1)%se;let A=-1;for(let _=0;_<=se;_++){let C=(v+_)%se,B=_<se&&S[C];if(B&&A<0)A=C;else if(!B&&A>=0){let O=(C-A+se)%se||se;L.push({start:A,len:O}),A=-1}}}for(let v of L){if(v.len*I<af&&v.len<se)continue;let A=v.len===se,_=new Float64Array(v.len),C=new Float64Array(v.len),B=new Float64Array(v.len),O=new Float64Array(v.len),F=[];for(let U=0;U<v.len;U++){let te=b[(v.start+U)%se];_[U]=te.inner,C[U]=te.outer,B[U]=te.front,O[U]=te.top,F.push(te.profile??{rs:[te.inner,te.outer],ls:[te.front,te.top]})}let D=Dn(_,A),j=Dn(C,A),N=Dn(B,A),X=Dn(O,A);for(let U=0;U<v.len;U++)D[U]>_[U]&&(D[U]=_[U]),j[U]<C[U]&&(j[U]=C[U]),D[U]>j[U]-1e-6&&(D[U]=Math.max(0,j[U]-1e-6)),X[U]<N[U]&&(X[U]=N[U]);let V={startBin:v.start,binCount:v.len,closed:A,innerR:D,outerR:j,frontLevelM:N,topLevelM:X,profiles:F},Z=(U,te,Q)=>{let fe=F[U],ue=fe.rs,G=fe.ls;if(te<=ue[0]){G[0]>Q&&(G[0]=Q);return}if(te>=ue[ue.length-1]){G[G.length-1]>Q&&(G[G.length-1]=Q);return}for(let H=0;H+1<ue.length;H++)if(te<=ue[H+1]){G[H]>Q&&(G[H]=Q),G[H+1]>Q&&(G[H+1]=Q);return}};for(let U=0;U<v.len;U++){let te=h[(v.start+U)%se];if(te)for(let Q of te.samples){Z(U,Q.r,Q.levelM);let fe=A?(U-1+v.len)%v.len:U-1,ue=A?(U+1)%v.len:U+1;fe>=0&&Z(fe,Q.r,Q.levelM),ue<v.len&&Z(ue,Q.r,Q.levelM)}}w.push(V)}w.reduce((v,A)=>v+A.binCount*I,0)<cf||f.push({arcs:w,sectionIds:m.members.map(v=>v.sectionId),innerRMedian:M,outerRMedian:P})}if(!f.length)return null;if(f.sort((m,h)=>m.innerRMedian-h.innerRMedian),t){let m=f[f.length-1].outerRMedian;if(Math.hypot(t.x-c.x,t.y-c.y)>.9*m)return null}return{centre:c,binCount:se,binStepDeg:360/se,rings:f}}function Es(e,t,n,o){let r=e.binStepDeg,i=n/r-.5-t.startBin;i=(i%e.binCount+e.binCount)%e.binCount,i>t.binCount-1&&(t.closed?i=i-t.binCount<t.binCount-i?0:t.binCount-1:i=i-(t.binCount-1)<e.binCount-i?t.binCount-1:0);let s=Math.floor(i),a=t.closed?(s+1)%t.binCount:Math.min(t.binCount-1,s+1),c=i-s,u=l=>{let f=t.profiles[l],m=f.rs,h=f.ls;if(o<=m[0])return h[0];if(o>=m[m.length-1])return h[h.length-1];for(let d=0;d+1<m.length;d++)if(o<=m[d+1]){let p=m[d+1]-m[d],y=p>1e-9?(o-m[d])/p:0;return h[d]+(h[d+1]-h[d])*y}return h[h.length-1]};return u(s)*(1-c)+u(a)*c}function vo(e,t,n,o,r,i,s,a,c,u=[],l=r){if(t.length!==n.length||t.length<2||i-r<1.5)return;let f=(p,y,g)=>{We(e,p,y,g,u,s,a,{portalBase:l,ao:c})||z(e,p,void 0,()=>g,y,s,a,c)},m=(p,y,g)=>({x:p.x+(y.x-p.x)*g,y:p.y+(y.y-p.y)*g}),h=o?t.length:t.length-1,d=0;for(let p=0;p<h;p++){let y=(p+1)%t.length,g=Math.hypot(n[y].x-n[p].x,n[y].y-n[p].y)*$;if(g<1e-5)continue;let M=(b,S)=>[m(t[p],t[y],b),m(t[p],t[y],S),m(n[p],n[y],S),m(n[p],n[y],b)];f(M(0,1),r,r+.95),f(M(0,1),i-.22,i);let P=Math.ceil((d-.32)/6)*6,R=!1,x=!1;for(let b=P;b<d+g;b+=6){let S=Math.max(0,(b-d)/g),I=Math.min(1,(b+.32-d)/g);I<=S||(f(M(S,I),r+.95,i-.22),R||=S<1e-6,x||=I>1-1e-6)}if(!o&&(p===0&&!R||p===h-1&&!x)){let b=Math.min(1,.32/g);f(M(p===0?0:1-b,p===0?b:1),r+.95,i-.22)}d+=g}}var ot=Ge(require("polygon-clipping"),1),$t=.65;function Co(e,t){let n=1/0;for(let o of t)for(let r=0;r<o.length;r++){let i=o[r],s=o[(r+1)%o.length],a=s.x-i.x,c=s.y-i.y,u=Math.max(0,Math.min(1,((e.x-i.x)*a+(e.y-i.y)*c)/(a*a+c*c||1)));n=Math.min(n,Math.hypot(e.x-i.x-u*a,e.y-i.y-u*c))}return n}var ko=.01;function As(e,t,n,o,r,i,s,a=[],c=!0,u={bays:[],walls:[]}){if(o-r<=1e-5)return;let l=o-r>=3,f=l?o-$t:r;e.setMaterial(5);let m=l?[]:a.filter(b=>{if(b.role!=="entrance"&&b.role!=="exit")return!1;let S=ie(b);if(!S)return!1;let I=_t(S,r,r+Fe(b).heightM);return I!==null&&I.openingTop<=o-.12});if((!m.length||!We(e,t,f,o,m,i,s,{holes:n,portalBase:r}))&&z(e,t,n,()=>o,f,i,s,K,void 0,()=>[0,1,0]),!l){e.setMaterial(0);return}let h=c&&u.bays.length?ff(t,n,Je(t,Zt/E),u):null,d=6/E,p=.22/E,y=a.flatMap(b=>{if(b.role!=="entrance"&&b.role!=="exit")return[];let S=ie(b);return S?.length?[{minX:Math.min(...S.map(I=>I.x)),maxX:Math.max(...S.map(I=>I.x)),minY:Math.min(...S.map(I=>I.y)),maxY:Math.max(...S.map(I=>I.y))}]:[]}),g=Math.min(...t.map(b=>b.x)),M=Math.max(...t.map(b=>b.x)),P=Math.min(...t.map(b=>b.y)),R=Math.max(...t.map(b=>b.y));for(let b=g+d/2;b<M;b+=d)for(let S=P+d/2;S<R;S+=d){if(y.some(w=>b+p>=w.minX&&b-p<=w.maxX&&S+p>=w.minY&&S-p<=w.maxY))continue;let I=[{x:b-p,y:S-p},{x:b+p,y:S-p},{x:b+p,y:S+p},{x:b-p,y:S+p}];!Pe({x:b,y:S},t,n)||Co({x:b,y:S},[t,...n??[]])<p*Math.SQRT2+(c?Zt/E:0)||h&&Co({x:b,y:S},h.flat())<p*Math.SQRT2+Zt/E||z(e,I,void 0,()=>f,r,i,s,K)}if(h){for(let[b,...S]of h)z(e,b,S,()=>f,r-ko,i,s,K);e.setMaterial(0);return}let x=Je(t,Zt/E);if(c&&x.length>=3){let b=a.filter(w=>{if(w.role!=="entrance"&&w.role!=="exit")return!1;let k=ie(w);return!!k&&k.some(L=>!Pe(L,t,void 0)||Co(L,[t])<=Zt/E)}),S=[x.slice().reverse()],I=r-ko;(!b.length||!We(e,t,I,f,b,i,s,{holes:S,portalBase:r+ko}))&&z(e,t,S,()=>f,I,i,s,K)}e.setMaterial(0)}var Oo=.25,Zt=Oo;function ff(e,t,n,o){if(n.length<3)return null;let r=s=>{let a=s.map(c=>[c.x,c.y]);return a.push(a[0]),a},i=s=>{let[a,...c]=s.map(u=>[r(u)]);return ot.default.union(a,...c)};try{let s=[r(e),...(t??[]).map(r)],a=ot.default.difference(s,[r(n)]),c=ot.default.intersection(s,i(o.bays));if(!c.length)return null;let u=ot.default.difference(ot.default.intersection(s,i(o.walls)),c);return ot.default.union(ot.default.difference(a,c),u).map(f=>f.map(m=>m.slice(0,-1).map(([h,d])=>({x:h,y:d}))))}catch{return null}}var mf=.02,hf=.25,df=1.2,pf=.6,bf=.45,yf=2.3,gf=Math.PI/180,_s=.005;function Xe(e,t,n){let o=n*gf;return{x:e.x+t*Math.sin(o),y:e.y+t*Math.cos(o)}}function xf(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 Mf=24,Sf=.01;function Pf(e,t,n,o,r,i,s,a,c){let u=n.binCount,l=Mf,f=$,m=i+.02,h=i-Sf,d=[];for(let A=0;A<u;A++){let _=(n.startBin+A+.5)*t.binStepDeg,C=new Float64Array(l+1);for(let B=0;B<=l;B++){let O=o[A]+(r[A]-o[A])*B/l;C[B]=Math.max(m,Es(t,n,_,O)-hf)}d.push(C)}if(c){let A=0;for(let _=0;_+1<u;_++)for(let C=0;C<l;C++){let B=Xe(t.centre,o[_]+(r[_]-o[_])*C/l,(n.startBin+_+.5)*t.binStepDeg),O=Xe(t.centre,o[_+1]+(r[_+1]-o[_+1])*(C+1)/l,(n.startBin+_+1.5)*t.binStepDeg);A=Math.max(A,Math.hypot(O.x-B.x,O.y-B.y))}for(let _=0;_<u;_++){let C=(n.startBin+_+.5)*t.binStepDeg;for(let B=0;B<=l;B++){let O=Xe(t.centre,o[_]+(r[_]-o[_])*B/l,C),F=c(O.x,O.y,A*1.01);F!==null&&(d[_][B]=Math.min(d[_][B],Math.max(h+_s,F-_s)))}}}let p=[s.bandTop[0]*a.top,s.bandTop[1]*a.top,s.bandTop[2]*a.top],y=[s.bandTop[0]*a.bottomCap,s.bandTop[1]*a.bottomCap,s.bandTop[2]*a.bottomCap],g=[s.bandWall[0]*a.top,s.bandWall[1]*a.top,s.bandWall[2]*a.top],M=[s.bandWall[0]*a.wallBottom,s.bandWall[1]*a.wallBottom,s.bandWall[2]*a.wallBottom],P=(A,_)=>{let C=(n.startBin+A+.5)*t.binStepDeg,B=o[A]+(r[A]-o[A])*_/l,O=Xe(t.centre,B,C);return[O.x*f,d[A][_],O.y*f]};{let A=Math.tan(12*Math.PI/180);for(let _=0;_<6;_++){let C=!1;for(let O=0;O<u;O++)for(let F=l-1;F>=0;F--)d[O][F]>d[O][F+1]&&(d[O][F]=d[O][F+1],C=!0);let B=n.closed?u:u-1;for(let O=0;O<B;O++){let F=(O+1)%u;for(let D=0;D<=l;D++){let j=d[F][D]-d[O][D];if(Math.abs(j)>1)continue;let N=o[O]+(r[O]-o[O])*D/l,X=o[F]+(r[F]-o[F])*D/l,V=Xe(t.centre,N,(n.startBin+O+.5)*t.binStepDeg),Z=Xe(t.centre,X,(n.startBin+F+.5)*t.binStepDeg),U=A*Math.hypot(Z.x-V.x,Z.y-V.y)*f;j>U?(d[F][D]=d[O][D]+U,C=!0):-j>U&&(d[O][D]=d[F][D]+U,C=!0)}}if(!C)break}}let R=1,x=(A,_)=>{for(let C=0;C<=l;C+=4)if(Math.abs(d[A][C]-d[_][C])>R)return!0;return Math.abs(d[A][l]-d[_][l])>R},b=Math.tan(38*Math.PI/180),S=A=>(r[A]-o[A])/l*f,I=(A,_)=>d[A][_+1]-d[A][_]>b*Math.max(1e-6,S(A)),w=(A,_)=>{let C=n.closed?(A-1+u)%u:Math.max(0,A-1),B=n.closed?(A+1)%u:Math.min(u-1,A+1);Math.abs(d[C][_]-d[A][_])>R&&(C=A),Math.abs(d[B][_]-d[A][_])>R&&(B=A);let O=Math.max(0,_-1),F=Math.min(l,_+1);O<_&&I(A,O)&&(O=_),F>_&&I(A,_)&&(F=_);let D=P(C,_),j=P(B,_),N=P(A,O),X=P(A,F),V=j[0]-D[0],Z=j[1]-D[1],U=j[2]-D[2],te=X[0]-N[0],Q=X[1]-N[1],fe=X[2]-N[2],ue=Z*fe-U*Q,G=U*te-V*fe,H=V*Q-Z*te,J=Math.hypot(ue,G,H);return J>1e-12?(ue/=J,G/=J,H/=J,G<0&&(ue=-ue,G=-G,H=-H),[ue,G,H]):[0,1,0]},k=(A,_,C=!1)=>{let B=C&&Math.min(A[1],_[1])-i>=3,O=[A[0],B?A[1]-$t:h,A[2]],F=[_[0],B?_[1]-$t:h,_[2]],D=_[0]-A[0],j=_[2]-A[2],N=Math.hypot(D,j);if(!(N>1e-12))return;let X=[j/N,0,-D/N];e.tri(A,_,F,X,g,g,M),e.tri(A,F,O,X,g,M,M)},L=.05*Oe,T=A=>r[A]-o[A]<L,v=n.closed?u:u-1;for(let A=0;A<v;A++){let _=(A+1)%u;if(T(A)||T(_))continue;if(x(A,_)){let j=(n.startBin+A+1)*t.binStepDeg,N=(Q,fe)=>{let ue=(o[A]+o[_])/2,G=(r[A]+r[_])/2,H=ue+(G-ue)*fe/l,J=Xe(t.centre,H,j);return[J.x*f,d[Q][fe],J.y*f]};for(let Q=0;Q<l;Q++){let fe=P(A,Q),ue=P(A,Q+1),G=N(A,Q),H=N(A,Q+1),J=w(A,Q),me=w(A,Q+1);e.triN(fe,G,H,J,J,me,p),e.triN(fe,H,ue,J,me,me,p);let xe=P(_,Q),Ie=P(_,Q+1),ae=N(_,Q),ce=N(_,Q+1),De=w(_,Q),Y=w(_,Q+1);e.triN(ae,xe,Ie,De,De,Y,p),e.triN(ae,Ie,ce,De,Y,Y,p);let he=N(A,Q),Me=N(A,Q+1),rt=N(_,Q+1),it=N(_,Q),Ze=Me[0]-he[0],$e=Me[2]-he[2],Tt=Math.hypot(Ze,$e);if(Tt>1e-12){let Jt=[$e/Tt,0,-Ze/Tt];e.tri(he,Me,rt,Jt,g),e.tri(he,rt,it,Jt,g)}}let X=P(A,0),V=P(_,0),Z=P(_,l),U=P(A,l),te=Q=>[Q[0],h,Q[2]];Math.min(X[1],V[1])-i<3&&(e.tri(te(X),te(Z),te(V),[0,-1,0],y),e.tri(te(X),te(U),te(Z),[0,-1,0],y)),k(X,V,!0),k(U,Z,!0);continue}for(let j=0;j<l;j++){let N=w(A,j),X=w(_,j),V=w(_,j+1),Z=w(A,j+1);if(I(A,j)||I(_,j)){let ue=(Me,rt)=>{let it=(n.startBin+Me+.5)*t.binStepDeg,Ze=o[Me]+(r[Me]-o[Me])*(j+.5)/l,$e=Xe(t.centre,Ze,it);return[$e.x*f,rt,$e.y*f]},G=P(A,j),H=P(_,j),J=ue(A,d[A][j]),me=ue(_,d[_][j]);e.triN(G,H,me,N,X,X,p),e.triN(G,me,J,N,X,N,p);let xe=P(_,j+1),Ie=P(A,j+1),ae=ue(A,d[A][j+1]),ce=ue(_,d[_][j+1]);e.triN(ae,ce,xe,Z,V,V,p),e.triN(ae,xe,Ie,Z,V,Z,p);let De=me[0]-J[0],Y=me[2]-J[2],he=Math.hypot(De,Y);if(he>1e-12){let Me=[-Y/he,0,De/he];e.tri(J,me,ce,Me,g),e.tri(J,ce,ae,Me,g)}continue}let U=P(A,j),te=P(_,j),Q=P(_,j+1),fe=P(A,j+1);e.triN(U,te,Q,N,X,V,p),e.triN(U,Q,fe,N,V,Z,p)}let C=P(A,0),B=P(_,0),O=P(_,l),F=P(A,l),D=j=>[j[0],h,j[2]];Math.min(C[1],B[1])-i<3&&(e.tri(D(C),D(O),D(B),[0,-1,0],y),e.tri(D(C),D(F),D(O),[0,-1,0],y)),k(C,B,!0),k(F,O,!0)}if(!n.closed)for(let A of[0,u-1])for(let _=0;_<l;_++)k(P(A,_),P(A,_+1))}function vs(e,t,n){let{bottomY:o,colors:r,ao:i}=n,s=new Float64Array(t.binCount).fill(-1/0);for(let l of t.rings)for(let f of l.arcs){let m=new Float64Array(f.binCount),h=new Float64Array(f.binCount);for(let p=0;p<f.binCount;p++){let y=(f.startBin+p)%t.binCount,g=Math.max(0,f.innerR[p]-Te);m[p]=Math.max(g,s[y]+.001),h[p]=Math.max(m[p]+.001,f.outerR[p]+Te)}let d=0;for(let p=0;p<f.binCount;p++){let y=f.topLevelM[p]-o;y>d&&(d=y)}d>=df&&Pf(e,t,f,m,h,o,r,i,n.standTopNear);for(let p=0;p<f.binCount;p++){let y=(f.startBin+p)%t.binCount;h[p]>s[y]&&(s[y]=h[p])}}if(n.deriveShell===!1||xf(n.shapes,t))return;let a=t.rings[t.rings.length-1],c=pf*Oe,u=bf*Oe;for(let l of a.arcs){let f=[],m=[];for(let w=0;w<l.binCount;w++){let k=(l.startBin+w+.5)*t.binStepDeg,L=l.outerR[w]+Te+c;f.push(Xe(t.centre,L,k)),m.push(Xe(t.centre,L+u,k))}let h=-1/0;for(let w=0;w<l.binCount;w++)l.topLevelM[w]>h&&(h=l.topLevelM[w]);let d=h+yf,p=l.closed?m:[...m,...f.slice().reverse()],y=l.closed?[f.slice().reverse()]:void 0,g=re(r.shellWall,[.66,.71,.72],.62),M=(w,k,L,T,v)=>{let A=Math.abs(T-h)<1e-6?T-mf:T;We(e,w,L,A,n.shapes,r.shellTop,v,{holes:k,portalBase:o,ao:i})||z(e,w,k,()=>A,L,r.shellTop,v,i)},P=Math.max(1,Math.ceil((h-o)/4.5)),R=(h-o)/P,x=new Set,b=n.tierFrontLevels??t.rings.map(w=>{let k=w.arcs.flatMap(L=>Array.from(L.frontLevelM)).filter(Number.isFinite).sort((L,T)=>L-T);return k[Math.floor(k.length/2)]});for(let w of b)Number.isFinite(w)&&w-o>=3&&w<h&&x.add(Math.max(0,Math.min(P-1,Math.floor((w-o)/R))));let S=Math.min(...b.filter(w=>Number.isFinite(w)&&w-o>=3&&w<h));for(let w=0;w<P;w++)o+(w+1)*R<=S-$t&&Number.isFinite(S)&&x.add(w);for(let w=0;w<P;w++){let k=o+(h-o)*w/P,L=o+(h-o)*(w+1)/P;x.has(w)&&L-k>=3.2?(M(p,y,k,k+.45,g),vo(e,f,m,l.closed,k+.45,L-.16,r.shellTop,g,i,n.shapes,o)):M(p,y,k,L-.16,g),M(p,y,L-.16,L,W(g,.62))}vo(e,f,m,l.closed,h,d,r.shellTop,g,i,n.shapes,o);let I=8;for(let w=1;w<m.length;w++){if(I+=Math.hypot(m[w].x-m[w-1].x,m[w].y-m[w-1].y)*$,I<8)continue;I=0;let k=m[w],L=m[w-1],T=k.x-L.x,v=k.y-L.y,A=Math.max(1,Math.hypot(T,v)),_=T/A*.16*Oe,C=v/A*.16*Oe,B=Math.max(1,Math.hypot(k.x-t.centre.x,k.y-t.centre.y)),O=(k.x-t.centre.x)/B*.24*Oe,F=(k.y-t.centre.y)/B*.24*Oe,D=[{x:k.x-_,y:k.y-C},{x:k.x+_,y:k.y+C},{x:k.x+_+O,y:k.y+C+F},{x:k.x-_+O,y:k.y-C+F}];M(D,void 0,o,h,W(g,1.12))}}}var If=2.5,Cs=.65,Rf=2,wf=.03;function Ef(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 Bo(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<If||s.pts.length<2)continue;let a=s.pts.map(l=>{let f=l.x-t.x,m=l.y-t.y,h=Math.max(1,Math.hypot(f,m));return{x:l.x-f/h*Cs/E,y:l.y-m/h*Cs/E}}),c=[],u=[a[0]];for(let l=1;l<a.length;l++){let f=a[l-1],m=a[l];Math.hypot(m.x-f.x,m.y-f.y)*E>Rf?(u.length>=2&&c.push(u),u=[m]):u.push(m)}u.length>=2&&c.push(u);for(let l of c)Ef(l,wf/E);c.length&&r.push({blockId:i,y:s.y,runs:c})}return r}var ks=.1,Af=1.1,_f=.22,To=.95,Lo=.05,Os=1.8;function Ts(e,t,n,o){let r=[.72,.72,.69],i=[.48,.55,.57];for(let s of Bo(t,n,o)){let a=s.y;for(let c of s.runs){let u=Os;for(let l=1;l<c.length;l++){let f=c[l-1],m=c[l],h=m.x-f.x,d=m.y-f.y,p=Math.hypot(h,d);if(p<1e-5)continue;let y=g=>{let M=-d/p*g/E/2,P=h/p*g/E/2;return[{x:f.x+M,y:f.y+P},{x:m.x+M,y:m.y+P},{x:m.x-M,y:m.y-P},{x:f.x-M,y:f.y-P}]};if(z(e,y(_f),void 0,()=>a+ks,a-Af,r,r,K),z(e,y(Lo),void 0,()=>a+To,a+To-Lo,i,i,K),u+=p*E,u>=Os||l===c.length-1){u=0;let g=.028/E,M=[{x:f.x-g,y:f.y-g},{x:f.x+g,y:f.y-g},{x:f.x+g,y:f.y+g},{x:f.x-g,y:f.y+g}];z(e,M,void 0,()=>a+To-Lo,a+ks,i,i,K)}}}}}var vf=.9,Cf=1.5,kf=.3;function Ls(e,t,n){let o=[],r=[],i=vf/E,s=Cf/E,a=kf/E;for(let c of e)for(let u of c.runs){if(u.length<2)continue;let l=u.slice(),f=(y,g)=>{let M=l[y],P=l[g],R=Math.hypot(M.x-P.x,M.y-P.y)||1;l[y]={x:M.x+(M.x-P.x)/R*a,y:M.y+(M.y-P.y)/R*a}};f(0,1),f(l.length-1,l.length-2);let m=l.map((y,g)=>{let M=l[Math.max(0,g-1)],P=l[Math.min(l.length-1,g+1)],R=P.x-M.x,x=P.y-M.y,b=Math.hypot(R,x)||1,S=-x/b,I=R/b;return S*(y.x-t.x)+I*(y.y-t.y)<0&&(S=-S,I=-I),{nx:S,ny:I}}),h=l.map((y,g)=>({x:y.x-m[g].nx*s,y:y.y-m[g].ny*s})),d=l.map((y,g)=>({x:y.x+m[g].nx*i,y:y.y+m[g].ny*i})),p=l.map((y,g)=>({x:y.x+m[g].nx*(i+n/E),y:y.y+m[g].ny*(i+n/E)}));o.push([...h,...d.slice().reverse()]),r.push([...d,...p.reverse()])}return{bays:o,walls:r}}var Fo=.88,Gn=.27,Of=1.2,Tf=.01;function Bs(e,t,n,o,r){let i=[.67,.71,.68],s=[i[0]*Fo,i[1]*Fo,i[2]*Fo],a=c=>!!r&&r.some((u,l)=>l!==c&&u?.belowY!=null&&Math.abs(u.belowY-t[c].y)<1e-6&&t[l].blockId===t[c].blockId);for(let c=0;c<t.length;c++){let u=t[c];if(!(u.pts.length<2))for(let l of[0,u.pts.length-1]){let f=u.pts[l],m=u.pts[l===0?1:l-1],h=f.x-m.x,d=f.y-m.y,p=Math.hypot(h,d);if(p<1e-5)continue;h/=p,d/=p;let y=1/0;for(let _=0;_<n.length;_++){let C=n[_],B=n[(_+1)%n.length],O=B.x-C.x,F=B.y-C.y,D=h*F-d*O;if(Math.abs(D)<1e-8)continue;let j=C.x-f.x,N=C.y-f.y,X=(j*F-N*O)/D,V=(j*d-N*h)/D;X>0&&V>=0&&V<=1&&(y=Math.min(y,X))}let g=.3/E,M=y-.04/E;if(!Number.isFinite(y)||y*E>2||M-g<.12/E)continue;let P=!!o&&a(c),R=r?.[c]?.pitch,x=P&&R&&Number.isFinite(R)?Math.min(Of/E,Math.max(Gn/E,R-Gn/E-Tf/E)):Gn/E,b=-d,S=h;o&&b*(o.x-f.x)+S*(o.y-f.y)<0&&(b=-b,S=-S);let I=Gn/E,w=[{x:f.x+h*g+b*I,y:f.y+d*g+S*I},{x:f.x+h*M+b*I,y:f.y+d*M+S*I},{x:f.x+h*M-b*x,y:f.y+d*M-S*x},{x:f.x+h*g-b*x,y:f.y+d*g-S*x}];if(!w.every(_=>_e(n,_.x,_.y)))continue;let k=r?.[c]?.belowY,L=k==null?0:u.y-k,T=!!o&&L>.03&&L<=.65;if(T&&o){let _=(C,B)=>Math.hypot((C.x+B.x)/2-o.x,(C.y+B.y)/2-o.y);_(w[0],w[1])>_(w[3],w[2])&&(w=[w[3],w[2],w[1],w[0]])}let v=T?Math.ceil((L-1e-8)/.2):1,A=(_,C,B)=>({x:_.x+(C.x-_.x)*B,y:_.y+(C.y-_.y)*B});for(let _=0;_<v;_++){let C=_/v,B=(_+1)/v,O=[A(w[0],w[3],C),A(w[1],w[2],C),A(w[1],w[2],B),A(w[0],w[3],B)],F=u.y+.008-(T?L*(1-B):0);z(e,O,void 0,()=>F,F-(T?L/v+.1:.16),i,s,K)}}}}var Lf=.02,Bf=.012,Ff=.01,Nf=.3,Df=.5;function Gf(e,t,n){if(e.length===1)return Math.hypot(t-e[0].x,n-e[0].y);let o=1/0;for(let r=0;r+1<e.length;r++){let i=e[r],s=e[r+1],a=s.x-i.x,c=s.y-i.y,u=a*a+c*c,l=u>1e-12?((t-i.x)*a+(n-i.y)*c)/u:0;l=Math.max(0,Math.min(1,l)),o=Math.min(o,Math.hypot(t-(i.x+l*a),n-(i.y+l*c)))}return o}function jf(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=Gf(e[s].pts,n,o);c<r&&(r=c,i=e[s].y)}return i}function Fs(e,t,n,o,r,i,s){let a=o.filter(m=>m.pts.length>0);if(a.length<2||t.length<3)return;let c=a.map(m=>{let h=0,d=0;for(let y of m.pts)h+=y.x,d+=y.y;h/=m.pts.length,d/=m.pts.length;let p=0;for(let y of m.pts)p=Math.max(p,Math.hypot(y.x-h,y.y-d));return{cx:h,cy:d,rad:p}}),u=[...t],l=n.map(m=>[...m]),f=Lf/E;for(let m of[u,...l])for(let h=0;h<m.length;h++){let d=m[h],p=m[(h+1)%m.length],y=p.x-d.x,g=p.y-d.y,M=Math.hypot(y,g);if(M*E<.05)continue;let P=(d.x+p.x)/2,R=(d.y+p.y)/2,x=g/M,b=-y/M;Pe({x:P+x*f,y:R+b*f},u,l)&&(x=-x,b=-b);let S=r.x-P,I=r.y-R,w=Math.hypot(S,I)||1;if((x*S+b*I)/w>Df)continue;let k=1/0;for(let O of[.2,.5,.8]){let F=jf(a,c,d.x+y*O-x*f*2,d.y+g*O-b*f*2);Number.isFinite(F)&&(k=Math.min(k,F))}if(!Number.isFinite(k)||k-i<Nf)continue;let L=i-Ff,T=k-Bf,v={x:(d.x-x*f)*E,z:(d.y-b*f)*E},A={x:(p.x-x*f)*E,z:(p.y-b*f)*E},_=[x,0,b],C=W(s,K.wallBottom),B=W(s,K.top);e.tri([v.x,T,v.z],[A.x,T,A.z],[A.x,L,A.z],_,B,B,C),e.tri([v.x,T,v.z],[A.x,L,A.z],[v.x,L,v.z],_,B,C,C)}}function Ns(e,t,n,o,r,i,s,a,c=!1){if(!t.outline||t.outline.length<3)return;let u=n.baseHeightM,l=n.objects.filter(M=>M.type==="shape"&&(M.role==="entrance"||M.role==="exit")),f=ui(o,a.tierTop);if(!r)return;let m=M=>r.deckAt(M.x,M.y),h=Li(t,s),d=h[0]??t.outline;if(r.rowLevels.length>=2){let M=Pn(r.rowLevels),P=Bi(vi(r.rowLevels,n.focal,M),h),R=Ls(Bo(r.rowLevels,n.focal,u),n.focal,Oo);for(let b of P){let S=Math.max(u,b.topY-Ds);for(let I of i.subtract(b.outline,S))As(e,I,b.holes,S,u,a.tierTop,a.tierWall,l,!c,R);e.setMaterial(5),Fs(e,b.outline,b.holes,r.rowLevels,n.focal,S,a.tierWall),e.setMaterial(0)}P.length||z(e,d,t.holes,()=>r.landingY,u,f,a.tierWall,K);let x={tread:[f[0]*K.top,f[1]*K.top,f[2]*K.top],riser:[f[0]*.72,f[1]*.72,f[2]*.72]};for(let b of h.length?h:[d])ki(e,r.rowLevels,n.focal,r.landingY,x,b,M);Ts(e,r.rowLevels,n.focal,u),Bs(e,r.rowLevels,t.outline,n.focal,M);return}let p=r.flat?1/0:Xi,y=M=>r.normalAt(M.x,M.y),g=r.flat?r.landingY:void 0;for(let M of i.subtract(d,g))z(e,M,t.holes,m,u,f,a.tierWall,K,p,y)}function Hf(e,t,n){let o=new Set;for(let s of e.objects)s.type==="section"&&o.add(s.id);let r=new Map;for(let s=0;s<t.length;s++){let a=n.seatOwner[s];if(!a||!o.has(a))continue;let c=n.bySection.get(a);if(c&&c.rowLevels.length>=2)continue;let u=t[s];if(u.kind==="booth")continue;let l=r.get(a);l||(l=new Map,r.set(a,l));let f=u.rowId||`__seat-${s}`,m=l.get(f);m||(m={pts:[],levelM:0,n:0},l.set(f,m)),m.pts.push({x:u.x,y:u.y}),m.levelM+=n.seatDeckY(s),m.n++}let i=[];for(let s of e.objects){if(s.type!=="section")continue;let a=n.bySection.get(s.id);if(a&&a.rowLevels.length>=2){let u=a.rowLevels.filter(l=>!l.patch).map(l=>({pts:l.pts,levelM:l.y}));u.length>=2&&i.push({sectionId:s.id,rows:u});continue}let c=r.get(s.id);c&&i.push({sectionId:s.id,rows:[...c.values()].map(u=>({pts:u.pts,levelM:u.levelM/u.n}))})}return i}function Vf(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 Ds=.02;function Uf(e,t){let n=e.objects.filter(o=>o.type==="section"&&!!o.outline&&o.outline.length>=3).flatMap(o=>{let r=t.bySection.get(o.id);if(!r)return[];let i=1/0,s=-1/0,a=1/0,c=-1/0;for(let l of o.outline)l.x<i&&(i=l.x),l.x>s&&(s=l.x),l.y<a&&(a=l.y),l.y>c&&(c=l.y);let u=r.landingY;for(let l of r.rowLevels)u=Math.min(u,l.y-Ds);return[{outline:o.outline,holes:o.holes,surface:r,floorTop:u,minX:i,maxX:s,minY:a,maxY:c}]});return(o,r,i)=>{let s=null;for(let a of n){if(o<a.minX-i||o>a.maxX+i||r<a.minY-i||r>a.maxY+i)continue;let c={x:o,y:r};if(!Pe(c,a.outline,a.holes)&&Vf(c,a.outline)>i)continue;let u=Math.min(a.surface.deckAt(o,r),a.floorTop);(s===null||u<s)&&(s=u)}return s}}var Xf=3,Kf=.4;function Gs(e,t,n,o,r,i,s=!0){let a=Hf(t,n,o);if(a.length<Xf)return;let c=ws(a,t.focal);if(!c)return;let u=Math.max(0,...c.rings.map(l=>l.arcs.reduce((f,m)=>f+m.binCount,0)))/c.binCount;e.setMaterial(5),vs(e,c,{bottomY:t.baseHeightM,tierFrontLevels:a.map(l=>Math.min(...l.rows.map(f=>f.levelM))),colors:{bandTop:W(r.tierTop,.8),bandWall:r.tierWall,shellTop:i??W(r.tierWall,1.15),shellWall:i??r.tierWall},ao:K,shapes:t.objects.filter(l=>l.type==="shape"),deriveShell:s&&u>=Kf,standTopNear:Uf(t,o)}),e.setMaterial(0)}var js=4;var Yf=[[/\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"]],Wf=1.2,zf=12;function Hs(e){if(e.heightM!==void 0)return!1;let t=ie(e);if(!t||t.length<3)return!1;let n=0;for(let r=0;r<t.length;r++){let i=t[r],s=t[(r+1)%t.length];n+=Math.hypot(s.x-i.x,s.y-i.y)}return n*$<zf*2?!1:2*Qt(t)/n*$<=Wf}function No(e){if(!e)return null;for(let[t,n]of Yf)if(t.test(e))return n;return null}var Us="auto-rows-";function Xs(e){return e.id.startsWith(Us)&&!e.label}var Zf=1.15,$f=.09,Ks=6,Qf=34,qf=.35,Jf=6,em=.35,tm=.75,nm=12,om=2.5,rm=40,im=[18,24],sm=[12,16],Vs=14,am=.8,cm=.6,lm=5,um=.3,Ys=.4,Ws=2,fm=400,mm=2.6,hm=.8,dm=4,pm=26,bm=.7,ym=.5,gm=.985,xm=1.5,Mm=2.2,Sm=3,Pm=25,Im=.985,Rm=2,wm=6,Em=3,Am=.1,_m=1.5,vm=1.6,Cm=6e3,km=.6,Om="#c3c7cd",Do=300,Tm=240;function Lm(e,t,n,o){if(!e.fill||!/^#[0-9a-f]{6}$/i.test(e.fill))return null;let r=jo([...t]),i=new Set;for(let l of o)i.add(Math.floor(Math.atan2(l.y-r.y,l.x-r.x)*180/Math.PI/10));if(i.size*10<Tm)return null;let{h:s,s:a,l:c}=Gr(Dr(e.fill));return s<70/360||s>170/360||a<.2||c<.08||c>.75||n.some(l=>l!==e&&l.type==="shape"&&ie(l)?.some(f=>Uo(f,t)))?null:e.kind==="ellipse"?"oval-cricket":e.kind==="rect"?"pitch-football":null}var Bm="Estimated from the drawing; confirm with the venue.",Ho=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},jo=e=>({x:e.reduce((t,n)=>t+n.x,0)/e.length,y:e.reduce((t,n)=>t+n.y,0)/e.length}),Qt=e=>{let t=0;for(let n=0;n<e.length;n++){let o=e[n],r=e[(n+1)%e.length];t+=o.x*r.y-r.x*o.y}return Math.abs(t)/2};function Fm(e){return e.height!==void 0||e.rake!==void 0||e.elevation!==void 0||e.surfaceKind!==void 0}function Vo(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 Uo(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 Xo(e,t){let n=t[0],o=1/0;for(let r=0;r<t.length;r++){let i=t[r],s=t[(r+1)%t.length],a=s.x-i.x,c=s.y-i.y,u=a*a+c*c,l=u>0?Math.max(0,Math.min(1,((e.x-i.x)*a+(e.y-i.y)*c)/u)):0,f={x:i.x+a*l,y:i.y+c*l},m=Math.hypot(e.x-f.x,e.y-f.y);m<o&&(o=m,n=f)}return n}function zs(e,t){let n=0,o=0;for(let r of e.values()){if(r.length<3)continue;let i=r[0],s=r[r.length-1],a=s.x-i.x,c=s.y-i.y,u=Math.hypot(a,c);if(u<1e-6)continue;let l={x:(i.x+s.x)/2,y:(i.y+s.y)/2},f=Xo(l,t),m=f.x-l.x,h=f.y-l.y,d=Math.hypot(m,h);d<1e-6||(o+=Math.abs((-c*m+a*h)/(u*d))*r.length,n+=r.length)}return n?o/n:0}function Nm(e,t,n){let o=e.filter(p=>p.type==="shape"),r=o.find(p=>p.role==="stage");if(r){let p=ie(r);return p?{shape:r,centre:jo(p),outline:p,inferred:!1}:null}if(!n.length)return null;let i=1/0,s=-1/0,a=1/0,c=-1/0;for(let p of n)i=Math.min(i,p.x),s=Math.max(s,p.x),a=Math.min(a,p.y),c=Math.max(c,p.y);let u=(s-i)*(c-a),l=[];for(let p of o){if(p.role)continue;let y=ie(p);if(!y)continue;let g=Qt(y);if(g*$*$<6||g>u)continue;let M=Math.min(...y.map(w=>w.x)),P=Math.max(...y.map(w=>w.x)),R=Math.min(...y.map(w=>w.y)),x=Math.max(...y.map(w=>w.y)),b=0;for(let w of n)w.x>M&&w.x<P&&w.y>R&&w.y<x&&Uo(w,y)&&b++;if(b>n.length*.05)continue;let S=jo(y),I=zs(t,y);I>=am&&l.push({shape:p,centre:S,outline:y,score:I,area:g,box:[M,R,P,x]})}let f=(p,y)=>y!==p&&y.area>p.area&&p.box[0]>=y.box[0]-1e-6&&p.box[1]>=y.box[1]-1e-6&&p.box[2]<=y.box[2]+1e-6&&p.box[3]<=y.box[3]+1e-6,m=l.filter(p=>!l.some(y=>f(p,y))),h=Math.max(0,...m.map(p=>p.score)),d=m.filter(p=>p.score>=h-.03).sort((p,y)=>y.area-p.area)[0]??null;return d?{shape:d.shape,centre:d.centre,outline:d.outline,inferred:!0}:null}function Dm(e,t,n){if(!n||n.length<3)return Math.hypot(e.x-t.x,e.y-t.y);let o=Xo(e,n);return Math.hypot(e.x-o.x,e.y-o.y)}function Zs(e){let t=[...e].sort((i,s)=>i.x-s.x||i.y-s.y);if(t.length<3)return t;let n=(i,s,a)=>(s.x-i.x)*(a.y-i.y)-(s.y-i.y)*(a.x-i.x),o=[];for(let i of t){for(;o.length>=2&&n(o[o.length-2],o[o.length-1],i)<=0;)o.pop();o.push(i)}let r=[];for(let i=t.length-1;i>=0;i--){let s=t[i];for(;r.length>=2&&n(r[r.length-2],r[r.length-1],s)<=0;)r.pop();r.push(s)}return[...o.slice(0,-1),...r.slice(0,-1)]}function Gm(e){if(!e.length||e.length>Cm)return[];let t=[...Vo(e).values()],n=t.map((a,c)=>c),o=a=>n[a]===a?a:n[a]=o(n[a]),r=vm/$,i=t.map(a=>({minX:Math.min(...a.map(c=>c.x))-r,maxX:Math.max(...a.map(c=>c.x))+r,minY:Math.min(...a.map(c=>c.y))-r,maxY:Math.max(...a.map(c=>c.y))+r}));for(let a=0;a<t.length;a++)for(let c=a+1;c<t.length;c++){let u=i[a],l=i[c];if(u.maxX<l.minX||l.maxX<u.minX||u.maxY<l.minY||l.maxY<u.minY)continue;t[a].some(m=>t[c].some(h=>Math.hypot(m.x-h.x,m.y-h.y)<=r))&&(n[o(a)]=o(c))}let s=new Map;return t.forEach((a,c)=>{let u=o(c),l=s.get(u);l?l.push(...a):s.set(u,[...a])}),[...s.values()].filter(a=>new Set(a.map(c=>c.rowId)).size>=2)}function jm(e,t,n){if(!t.length)return null;let o=t.filter(I=>n.tableIds.has(I.rowId)||I.kind==="booth").length>t.length/2,r=Vo(t),i=!n.outline||zs(r,n.outline)>=cm,s=0,a=0;for(let I of r.values()){if(I.length<2)continue;let w=I[0],k=I[I.length-1],L=k.x-w.x,T=k.y-w.y,v=Math.hypot(L,T);if(v<1e-6)continue;let A={x:(w.x+k.x)/2,y:(w.y+k.y)/2},_=i?n.outline?Xo(A,n.outline):n.focal:n.middle,C=-T/v,B=L/v;C*(_.x-A.x)+B*(_.y-A.y)<0&&(C=-C,B=-B),s+=C*I.length,a+=B*I.length}let c={x:t.reduce((I,w)=>I+w.x,0)/t.length,y:t.reduce((I,w)=>I+w.y,0)/t.length};if(Math.hypot(s,a)<1e-9){let I=i?n.focal:n.middle;s=I.x-c.x,a=I.y-c.y}let u=Math.hypot(s,a)||1,l={x:s/u,y:a/u},f=I=>-(I.x*l.x+I.y*l.y),m=I=>-I.x*l.y+I.y*l.x,h=1/0,d=-1/0,p=1/0,y=-1/0,g=1/0,M=new Map;for(let I of t){let w=f(I),k=m(I);h=Math.min(h,w),d=Math.max(d,w),p=Math.min(p,k),y=Math.max(y,k),i&&(g=Math.min(g,Dm(I,n.focal,n.outline)));let L=I.logicalRowId??I.rowId,T=M.get(L);T?T.push(w):M.set(L,[w])}i||(g=Math.max(0,h-f(n.middle)));let P=[...M.values()].map(I=>Ho(I)).sort((I,w)=>I-w),R=[];if(!o)for(let I of P)R.length&&I-R[R.length-1]<em/$||R.push(I);let x=Fm(e),b=Qe(e,{floorBaseHeightM:n.baseHeightM}),S={id:e.id,section:e,authored:x,plane:n,facing:l,facesAction:i,hull:Zs(t),sample:t.filter((I,w)=>w%Math.ceil(t.length/fm)===0),frontD:h,backD:d,latMin:p,latMax:y,frontDistance:g,rowDepths:R,rowCount:R.length,level:0,height:b.height,rake:x?b.rake:0,backHeight:0};return S.backHeight=S.height+(d-h)*$*Math.tan(S.rake*Math.PI/180),S}function Hm(e,t,n,o){if(e.length<2)return 0;let r=Math.max(1,t*$),i=n+Zf-o,s=0,a=0;for(let u=1;u<e.length;u++){let l=Math.max(tm,(e[u]-e[u-1])*$),f=(i+$f)*(r+l)/r;s+=f-i,a+=l,i=f,r+=l}let c=Math.atan(s/a)*180/Math.PI;return Math.round(Math.max(Ks,Math.min(Qf,c))*10)/10}function Vm(e,t,n=!1){if(!n&&e.facing.x*t.facing.x+e.facing.y*t.facing.y<um)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:Ys*(e.latMax-e.latMin)))return null;let a=Ws/$,c=new Map,u=new Map;for(let m of e.sample){let h=Math.floor((-m.x*e.facing.y+m.y*e.facing.x)/a),d=-(m.x*e.facing.x+m.y*e.facing.y);c.set(h,Math.min(c.get(h)??1/0,d))}for(let m of t.sample){let h=Math.floor((-m.x*e.facing.y+m.y*e.facing.x)/a),d=-(m.x*e.facing.x+m.y*e.facing.y);u.set(h,Math.max(u.get(h)??-1/0,d))}let l=[];for(let[m,h]of c){let d=u.get(m);d!==void 0&&l.push(h-d)}let f=l.length?Ho(l):e.frontD-o;return f<-1/$?null:f}function Um(e,t){if(t.plane.floorIndex>=e.plane.floorIndex)return!1;let n=-1/0,o=1/0,r=1/0,i=-1/0;for(let c of t.hull){let u=-(c.x*e.facing.x+c.y*e.facing.y);n=Math.max(n,u),o=Math.min(o,u);let l=-c.x*e.facing.y+c.y*e.facing.x;r=Math.min(r,l),i=Math.max(i,l)}let s=Math.min(e.latMax,i)-Math.max(e.latMin,r),a=Math.min(e.backD,n)-Math.max(e.frontD,o);return s>Ys*(e.latMax-e.latMin)&&a>1/$}function Xm(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 Km(e,t){let n=1/0,o=-1/0;for(let i of t.hull){let s=-(i.x*e.facing.x+i.y*e.facing.y);n=Math.min(n,s),o=Math.max(o,s)}let r=Math.max(0,Math.min(o-n,e.frontD-n));return t.height+r*$*Math.tan(t.rake*Math.PI/180)}function Ym(e,t){if(!e.facesAction)return!1;let n={x:-e.facing.y,y:e.facing.x},o=Ws/$,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>=gm))for(let c of a.sample){let u=-(c.x*e.facing.x+c.y*e.facing.y);if(u<e.frontD||u>e.backD)continue;let l=-c.x*e.facing.y+c.y*e.facing.x,f=l<e.latMin?"left":l>e.latMax?"right":null;if(!f)return!1;let m=Math.min(r-1,Math.floor((u-e.frontD)/o)),h=f==="left"?e.latMin-l:l-e.latMax;h<(i[f].get(m)?.gap??1/0)&&i[f].set(m,{gap:h,other:a})}let s=a=>{let c=a==="left"?e.latMin:e.latMax,u=0;for(let[l,{other:f}]of i[a]){if((f.facing.x*n.x+f.facing.y*n.y)*(a==="left"?1:-1)<bm)continue;let h=e.frontD+(l+.5)*o,d={x:-h*e.facing.x+c*n.x,y:-h*e.facing.y+c*n.y},p=-(d.x*f.facing.x+d.y*f.facing.y),y=-d.x*f.facing.y+d.y*f.facing.x;p<f.frontD&&y>=f.latMin&&y<=f.latMax&&u++}return u/r>=ym};return s("left")&&s("right")}function Wm(e,t){if(t.plane.floorIndex!==e.plane.floorIndex||t.facing.x*e.facing.x+t.facing.y*e.facing.y<Im)return!1;let n=1/0,o=-1/0,r=1/0;for(let a of t.hull){let c=-a.x*e.facing.y+a.y*e.facing.x;n=Math.min(n,c),o=Math.max(o,c),r=Math.min(r,-(a.x*e.facing.x+a.y*e.facing.y))}let i=(e.frontD-r)*$;if(i<-Rm||i>wm)return!1;let s=Math.max(n-e.latMax,e.latMin-o);return s*$<=Em&&s*$>=-Am}function zm(e,t=!1,n=!1,o){let r=t?sm:im,i=new Set(n?[]:e.filter(p=>!p.authored&&Ym(p,e))),s=[...e].sort((p,y)=>p.plane.floorIndex-y.plane.floorIndex||Number(i.has(y))-Number(i.has(p))||p.frontDistance-y.frontDistance);for(let p of i)o?.add(p.id);let a=(p,y,g)=>{let M=new Map,P=[],R=new Map,x=b=>{if(b.plane.floorIndex===0||b.plane.baseHeightM>0)return b.plane.baseHeightM;let S=R.get(b.plane.floorIndex-1);return S===void 0?b.plane.baseHeightM:S+js};for(let b of s){if(i.has(b))b.height=x(b),b.level=0,b.rake=0,b.backHeight=b.height,M.set(b.id,void 0);else if(!b.authored){let I=x(b),w;for(let A of P){if(A.plane.floorIndex>b.plane.floorIndex)continue;if(Um(b,A)){let O=Km(b,A)+mm;O>I&&(I=O,w=A);continue}let _=Vm(b,A,i.has(A));if(_==null)continue;let C=n&&!!b.plane.stageDeck&&A.level===0&&A.plane.floorIndex===b.plane.floorIndex&&Math.max(0,_)*$<=dm,B=i.has(A)?A.height+xm:C?A.backHeight:A.backHeight+qf+Math.min(Jf,Math.max(0,_)*$)*Math.tan(A.rake*Math.PI/180);B>I&&(I=B,w=A)}let k=p.get(b);k&&k.height>I+.01?(I=k.height,w=void 0):k=void 0,b.height=Math.round(Math.min(I,b.plane.baseHeightM+rm)*100)/100;let L=!w&&!k&&b.height>b.plane.baseHeightM;if(b.level=w?w.level+1:k?k.level:L?1:0,b.rake=Hm(b.rowDepths,b.frontDistance,b.height,b.plane.focalHeightM),!b.facesAction&&b.rowCount<lm)b.rake=0;else if(b.level===0){let A=Math.max(1e-6,(b.backD-b.frontD)*$);b.rake=Math.min(b.rake,nm,Math.round(Math.atan(om/A)*1800/Math.PI)/10)}else b.rowCount>=2&&(b.rake=Math.max(b.rake,r[Math.min(b.level,r.length)-1]));let T=(b.backD-b.frontD)*$,v=w&&i.has(w)||k&&g?.has(k.id);if(y!==void 0&&v&&b.rowCount>=2&&(b.rake=y),t&&T>0&&b.height+T*Math.tan(b.rake*Math.PI/180)>b.plane.baseHeightM+Vs){let A=Math.max(0,b.plane.baseHeightM+Vs-b.height);b.rake=Math.max(Ks,Math.round(Math.atan(A/T)*1800/Math.PI)/10)}n&&b.plane.stageDeck&&b.level>0&&(b.rake=Math.min(b.rake,pm)),b.backHeight=b.height+T*Math.tan(b.rake*Math.PI/180),M.set(b.id,w?.id??(k?M.get(k.id):void 0))}let S=b.plane.floorIndex;R.set(S,Math.min(R.get(S)??1/0,b.height)),P.push(b)}return M},c=a(new Map),u=new Map,l=p=>u.get(p)?.height??p.height;for(let p=!0,y=0;p&&y<e.length;y++){p=!1;for(let g of e)if(!(g.authored||i.has(g)))for(let M of e){let P=u.get(M)??M;M===g||P.height-P.plane.baseHeightM<_m||P.height<=l(g)+.01||Wm(g,M)&&(u.set(g,P),p=!0)}}let f=new Map(e.map(p=>[p.id,p])),m=e.filter(p=>!p.authored&&p.rowCount>=2&&i.has(f.get(c.get(p.id)??""))),h=m.length?Ho(m.map(p=>p.rake)):void 0;if(!u.size&&h===void 0)return c;let d=new Map([...new Set(u.values())].map(p=>[p,{...p}]));return a(new Map([...u].map(([p,y])=>[p,d.get(y)])),h,new Set(m.map(p=>p.id)))}var Go=(e,t)=>!!e&&e.x===t.x&&e.y===t.y;function $s(e,t={x:0,y:-40}){let n=gt(e),o=new Map;for(let g of n){if(!g.sectionId)continue;let M=o.get(g.sectionId);M?M.push(g):o.set(g.sectionId,[g])}let r={focalInferred:!1,confident:!1,sections:[]},i=e.floors?.length?e.floors.map((g,M)=>({objects:g.objects,floorIndex:M,floorId:g.id,baseHeightM:g.baseHeightM??0,focal:g.focalPoint??e.focalPoint})):[{objects:e.objects,floorIndex:0,floorId:void 0,baseHeightM:0,focal:e.focalPoint}],s=new Set(i.flatMap(g=>g.objects.filter(M=>M.type==="table").map(M=>M.id))),a=[],c,u=new Set,l=i.map(g=>{let M=v=>!e.floors?.length||v.floorId===g.floorId,P=Gm(n.filter(v=>!v.sectionId&&v.kind!=="booth"&&!s.has(v.rowId)&&M(v))),R=[];for(let v of P){let A=Le(He(Zs(v)),km/$);if(n.some(C=>!M(C)&&Uo(C,A)))continue;let _=`${Us}${g.floorIndex}-${R.length}`;u.add(_),o.set(_,v),R.push({type:"section",id:_,label:"",color:Om,outline:A})}let x=R.length?{...g,objects:[...g.objects,...R]}:g,b=new Set(x.objects.filter(v=>v.type==="section").map(v=>v.logicalSectionId??v.id)),S=[...o.entries()].filter(([v])=>b.has(v)).flatMap(([,v])=>v),I=Nm(x.objects,Vo(S),S),w=x.focal;(I||x.focal&&!Go(x.focal,t))&&(r.confident=!0),I&&(r.stage??={id:I.shape.id,inferred:I.inferred,...x.floorId?{floorId:x.floorId}:{}},(I.inferred||Go(x.focal,t))&&(w=I.centre,r.focalInferred=!0));let k=I&&(!I.inferred||Qt(I.outline)*$*$<=Do),L=I?void 0:c,T={tableIds:s,floorIndex:x.floorIndex,floorId:x.floorId,baseHeightM:x.baseHeightM,focal:L?.focal??w,outline:I?.outline??L?.outline,focalHeightM:L?.focalHeightM??x.baseHeightM+(I&&k?Fe({...I.shape,role:"stage"}).heightM:0),stageDeck:L?.stageDeck??!!(I&&k&&Qt(I.outline)*$*$<=Do),middle:S.length?{x:S.reduce((v,A)=>v+A.x,0)/S.length,y:S.reduce((v,A)=>v+A.y,0)/S.length}:w};for(let v of x.objects){if(v.type!=="section")continue;let A=jm(v,o.get(v.logicalSectionId??v.id)??[],T);A&&a.push(A)}return T.outline&&(c=T),Go(x.focal,T.focal)||(r.focal??=[]).push({...x.floorId?{floorId:x.floorId}:{},point:{...T.focal}}),{unit:x,plane:T,stage:I,planeSeats:S}}),f=i.flatMap(g=>g.objects).map(g=>g.type==="shape"&&!g.role&&(No(g.label)==="wall"||!No(g.label)&&Hs(g))?{...g,role:"wall"}:g),m=tt({objects:f},n)!==null;m&&(r.indoor=!0);let h=new Set,d=zm(a,m,Xm(n,l[0]?.plane.focal??t)<hm,h),p=new Map(a.filter(g=>!g.authored).map(g=>[g.id,g])),y=l.map(({unit:g,plane:M,stage:P,planeSeats:R})=>g.objects.map(x=>{let b=x.type==="shape"&&!x.role&&x.id!==P?.shape.id?No(x.label):null;if(x.type==="shape"&&!x.role&&x.id!==P?.shape.id&&(b==="wall"||!b&&Hs(x))&&x.type==="shape"){(r.roles??=[]).push({id:x.id,...M.floorId?{floorId:M.floorId}:{},role:"wall"});let{fill:A,..._}=x;return{..._,role:"wall"}}if(b&&x.type==="shape")return(r.roles??=[]).push({id:x.id,...M.floorId?{floorId:M.floorId}:{},role:b}),{...x,role:b};let I=P?.inferred&&x.id===P.shape.id&&x.type==="shape"?Lm(x,P.outline,g.objects,R):null;if(I&&x.type==="shape")return r.stage?.id===x.id&&(r.stage.field=I),{...x,role:"stage",stageKind:I};let w=x.type==="shape"&&x.id===P?.shape.id&&x.heightM===void 0&&!x.stageKind&&a.some(A=>A.plane===M&&(h.has(A.id)||A.level===0&&A.facesAction&&A.rake<=Sm&&(A.frontDistance+A.backD-A.frontD)*$>=Pm)),k=w?{heightM:Mm}:{};if(P?.inferred&&x.id===P.shape.id&&x.type==="shape"&&Qt(P.outline)*$*$<=Do)return r.stage?.id===x.id&&(r.stage.deck=!0),{...x,role:"stage",...k};if(w&&x.type==="shape"&&x.role==="stage")return{...x,...k};let L=x.type==="section"?p.get(x.id):void 0;if(!L||x.type!=="section")return x;let T=L.rowCount>=2&&L.rake>0;u.has(L.id)?r.looseRowBlocks=(r.looseRowBlocks??0)+1:r.sections.push({id:L.id,floorId:M.floorId,surfaceKind:T?"rakedRows":"flat",height:L.height,rake:L.rake,stackedOn:d.get(L.id)});let v={status:"inferred",source:"public-2d-topology",note:Bm};return{...x,height:L.height,rake:L.rake,surfaceKind:T?"rakedRows":"flat",physical3dProvenance:{height:v,rake:v,surfaceKind:v}}}));if(e.floors?.length){let g=e.floors.map((M,P)=>({...M,objects:y[P],focalPoint:l[P].plane.focal}));return{doc:{...e,floors:g,objects:g[0].objects,focalPoint:g[0].focalPoint},report:r}}return{doc:{...e,objects:y[0],focalPoint:l[0].plane.focal},report:r}}var Qs=/^[\p{L}\p{N}]{1,4}$/u,Zm=/^([\p{L}\p{N}]{2,})[\s\-\u2013\u2014\u00b7_./]+(.+)$/u;function qs(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(Qs.test(s))return s}let i=Zm.exec(e);if(i){let s=i[1].toLocaleLowerCase("en-US"),a=i[2].trim();if((r.startsWith(s)||s.startsWith(r))&&Qs.test(a))return a}return e}var Js={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"},$m=new Map(ho.map(e=>[e.key,e.label]));function Qm(e){return`picker.access.${e}`}function ea(e){let t=[],n=e.boothType;n&&Object.prototype.hasOwnProperty.call(Js,n)&&t.push({key:`booth:${n}`,icon:"booth",titleKey:`picker.boothType.${n}`,titleFallback:Js[n],tone:"place"});let o=e.wheelchairSpaceType;for(let a of e.accessibility??[]){if(a==="wheelchair"&&o)continue;let c=$m.get(a);c&&t.push({key:`access:${a}`,icon:a,titleKey:Qm(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 qm=1.5,Jm=30,eh=4,th=3.6,nh=6,Ko=15,oh=3,rh=1;function ih(e){return Math.max(th,Math.min(nh,2.4+.15*e))}var qt=Math.PI*2;function sh(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-=qt;for(;m<-Math.PI;)m+=qt;return m+r}),s=i.map((f,m)=>m).sort((f,m)=>i[f]-i[m]),a=i[s[0]],c=i[s[s.length-1]];if(c-a>Math.PI)return null;let u=f=>Math.hypot(f.x-t.x,f.y-t.y),l=f=>{let m=e[f],h=(f+e.length-1)%e.length,d=(f+1)%e.length,p=Math.abs(i[h]-i[f])<=Math.abs(i[d]-i[f])?h:d,y=e[p];return u(m)<=u(y)?[m,y]:[y,m]};return{start:a,end:c,startEdge:l(s[0]),endEdge:l(s[s.length-1])}}function ta(e){return e.type==="shape"&&e.role==="wall"&&e.heightM===void 0}function Yo(e,t,n=()=>!0){let o=[];for(let c of e){if(!ta(c)||!n(c))continue;let u=ie(c);if(!u||u.length<3)continue;let l=sh(u,t);if(!l)return[];o.push(l)}if(o.length<2)return[];let r=e.flatMap(c=>{if(c.type!=="shape"||c.role!=="entrance"&&c.role!=="exit")return[];let u=ie(c);if(!u?.length)return[];let l=0,f=0;for(let m of u)l+=m.x,f+=m.y;return[{x:l/u.length,y:f/u.length}]}),i=c=>(c%qt+qt)%qt;o.sort((c,u)=>i(c.start)-i(u.start));let s=c=>Math.hypot(c.x-t.x,c.y-t.y),a=[];for(let c=0;c<o.length;c++){let u=o[c],l=o[(c+1)%o.length],f=i(l.start-u.end);if(f<=0||f>=Math.PI/2)continue;let m=b=>i(b-u.end)<f;if(o.some(b=>b!==u&&b!==l&&(m(b.start)||m(b.end)||i(u.end-b.start)<b.end-b.start)))continue;let[d,p]=u.endEdge,[y,g]=l.startEdge,M={x:(d.x+p.x)/2,y:(d.y+p.y)/2},P={x:(y.x+g.x)/2,y:(y.y+g.y)/2},R=Math.hypot(P.x-M.x,P.y-M.y)*E;if(R<qm||R>Jm||Math.abs(s(M)-s(P))*E>eh+.2*R)continue;let x={x:(M.x+P.x)/2,y:(M.y+P.y)/2};r.some(b=>m(Math.atan2(b.y-t.y,b.x-t.x))&&Math.abs(s(b)-s(x))*E<=oh)||a.push({quad:[d,p,g,y],mid:x,widthM:R,openingM:ih(R)})}return a}function na(e,t){let n=[];for(let i of t)if(i.text?.trim())for(let s of e){let a=Math.hypot(i.position.x-s.mid.x,i.position.y-s.mid.y)*E;a<=Ko&&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 oa(e,t,n,o,r,i,s,a=()=>!0){let c=Yo(t,At(n),a);if(!c.length)return;let u=t.find(f=>ta(f)&&a(f)),l=Tn(u?.fill,s);e.setMaterial(Rn);for(let f of c)r-f.openingM<rh||En(e,f.quad,o+f.openingM,o+r,[],l.top,l.wall,i,r);e.setMaterial(0)}var ah=6,ch=2.2,jn=.1,lh=/^(gate|entrance|entry|exit|way in|way out|door)s?$/i,uh=new Set(["stage","entrance","exit","screen","suite","obstruction","sound","bar","concession","restroom","coat"]),fh=.3,mh=1.8,hh=.9,dh=.55,ph=1,ra=4e3,bh=6,ia="#d8a425",yh="#e8c15a",Wo="#1c1608";function sa(e){let t=gh(e);if(!t)return null;let n=ea(e).find(o=>o.icon===t.icon);return{...t,name:n?.titleFallback??t.icon}}function gh(e){let t=e.accessibility;if(t?.length)return{icon:t.includes("wheelchair")?"wheelchair":t[0],color:yn(t)};let n=e.commercial;return n?.obstructedView?{icon:"obstructedView",color:ia,ink:Wo}:n?.restrictedView?{icon:"restrictedView",color:ia,ink:Wo}:n?.premium?{icon:"premium",color:yh,ink:Wo}:null}function xh(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 Mh=6e3,Sh=.25,aa=[-90,90,-135,135,-45,45];function Ph(e,t,n,o){let r=e.flatMap(({id:s,a,members:c})=>{let u=(a.minX+a.maxX)/2,l=(a.minY+a.maxY)/2,f=.5*Math.hypot(a.maxX-a.minX,a.maxY-a.minY),m=1/0;for(let h of c)m=Math.min(m,Math.hypot(t[h].x-u,t[h].y-l));return c.length&&m>=f*Sh?[{id:s,cx:u,cy:l,half:f,members:c}]:[]}).sort((s,a)=>s.half-a.half),i=new Map;return r.forEach(({id:s,cx:a,cy:c,members:u},l)=>{let f=o.x-a,m=o.y-c,p=(Math.hypot(f,m)>1e-6?Math.atan2(m,f):0)+aa[l%aa.length]*Math.PI/180,y=Math.cos(p),g=Math.sin(p),M=-1,P=-1/0;for(let R of u){let x=(t[R].x-a)*y+(t[R].y-c)*g;x>P&&(P=x,M=R)}i.set(s,[t[M].x*E,n.seatDeckY(M),t[M].y*E])}),i}function la(e){let{doc:t,units:n,seats:o,surfaces:r,focal:i}=e,s=t.zones??[],a=[];if(s.length){let c=new Map;for(let m of n)for(let h of m.objects)h.type==="section"&&h.zone&&c.set(h.id,h.zone);let u=new Map,l=new Map;for(let m=0;m<o.length;m++){let h=o[m],d=r.seatOwner[m],p=h.zoneId??(d?c.get(d):void 0);if(!p)continue;let y=u.get(p);y||(y={n:0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0,sumY:0},u.set(p,y));let g=l.get(p);g||l.set(p,g=[]),g.push(m),y.n++,h.x<y.minX&&(y.minX=h.x),h.y<y.minY&&(y.minY=h.y),h.x>y.maxX&&(y.maxX=h.x),h.y>y.maxY&&(y.maxY=h.y),y.sumY+=r.seatDeckY(m)}let f=Ph(s.flatMap(m=>{let h=u.get(m.id);return h?[{id:m.id,a:h,members:l.get(m.id)??[]}]:[]}),o,r,i);for(let m of s){let h=u.get(m.id),d=[];for(let[p,y]of c)y===m.id&&d.push(p);if(!h||h.n===0){a.push({id:m.id,label:m.label,color:oe(m.color),sectionIds:d,seatCount:0,center:[0,0,0],radius:0,focalWorld:[(m.focalPoint??i).x*E,1.5,(m.focalPoint??i).y*E]});continue}a.push({id:m.id,label:m.label,color:oe(m.color),sectionIds:d,seatCount:h.n,...f.has(m.id)?{labelAt:f.get(m.id)}:{},center:[(h.minX+h.maxX)/2*E,h.sumY/h.n,(h.minY+h.maxY)/2*E],radius:.5*Math.hypot((h.maxX-h.minX)*E,(h.maxY-h.minY)*E)||1,focalWorld:[(m.focalPoint??i).x*E,1.5,(m.focalPoint??i).y*E]})}}return a}function ua(e){let{doc:t,units:n,seats:o,surfaces:r,seatData:i,hintedSeatFloor:s,zones:a,focal:c}=e,u=[],l=[],f=[],m=new Map;for(let h of n)for(let d of h.objects){if(d.type!=="section"||!d.zone)continue;let p=(d.displayLabel||d.label||"").trim().toLocaleLowerCase();if(!p)continue;let y=t.floors?.[h.index]?.name?.trim().toLocaleLowerCase();if(n.length>1&&y===p)continue;let g=m.get(d.zone);g||m.set(d.zone,g=new Set),g.add(p)}for(let h of a)h.seatCount!==0&&(m.get(h.id)?.has(h.label.trim().toLocaleLowerCase())||u.push({id:`zone:${h.id}`,kind:"zone",text:h.label,anchor:[(h.labelAt??h.center)[0],(h.labelAt??h.center)[1]+ah,(h.labelAt??h.center)[2]],color:t.zones?.find(d=>d.id===h.id)?.color}));{let h=new Map,d=new Map,p=new Map,y=new Map;for(let g=0;g<o.length;g++){let M=r.seatOwner[g];if(!M)continue;let P=h.get(M);P||(P={n:0,x:0,y:0,deck:0},h.set(M,P)),P.n++,P.x+=o[g].x,P.y+=o[g].y,P.deck+=r.seatDeckY(g);let R=o[g].categoryKey;if(R){let b=d.get(M);b||(b=new Map,d.set(M,b)),b.set(R,(b.get(R)??0)+1)}if(o[g].accessibility?.includes("wheelchair")){let b=p.get(M);b?b.push(g):p.set(M,[g])}let x=y.get(M);x||(x={minX:1/0,maxX:-1/0,minY:1/0,maxY:-1/0,minDeck:1/0,maxDeck:-1/0},y.set(M,x)),x.minDeck=Math.min(x.minDeck,r.seatDeckY(g)),x.maxDeck=Math.max(x.maxDeck,r.seatDeckY(g)),o[g].x<x.minX&&(x.minX=o[g].x),o[g].x>x.maxX&&(x.maxX=o[g].x),o[g].y<x.minY&&(x.minY=o[g].y),o[g].y>x.maxY&&(x.maxY=o[g].y)}for(let g of n)for(let M of g.objects){if(M.type!=="section"||Xs(M))continue;let P=h.get(M.id);if(!P||P.n===0)continue;let R=y.get(M.id),x=[P.x/P.n*E,P.deck/P.n,P.y/P.n*E],b=M.displayLabel||M.label||M.id;l.push({id:M.id,floorIndex:g.index,label:b,seatCount:P.n,center:x,radius:Math.max(1,Math.hypot(R.maxX-R.minX,R.maxY-R.minY)*.5*E),box:{min:[R.minX*E-.4,R.minDeck,R.minY*E-.4],max:[R.maxX*E+.4,R.maxDeck+1,R.maxY*E+.4]},focalWorld:[g.focal.x*E,g.baseHeightM+1.5,g.focal.y*E]});let S=t.floors?.[g.index]?.name?.trim().toLocaleLowerCase();if(!(n.length>1&&S===b.trim().toLocaleLowerCase())){let I=xh(d.get(M.id),t),w=p.get(M.id);u.push({id:`section:${M.id}`,kind:"section",text:b,anchor:[x[0],x[1]+ch,x[2]],floorIndex:g.index,...I?{tint:I}:{},...w?{wheelchairSeats:w}:{}})}}}{for(let x of n)for(let b of x.objects){if(b.type!=="gaArea")continue;let S=ht(b.points);if(!S)continue;let I=b.labelPresentation?.visible===!1?"":b.displayLabel||b.label||b.id,w=b.capacity>0?[I,b.capacity.toLocaleString()].filter(Boolean).join(" \xB7 "):I;w&&u.push({id:`ga:${b.id}`,kind:"ga",text:w,anchor:[S.x*E,x.baseHeightM+mh,S.y*E],floorIndex:x.index})}let h=new Map,d=new Map;for(let x of n)for(let b of x.objects)if(b.type==="section"&&h.set(b.id,b.displayLabel||b.label||b.id),b.type==="row"){let S=b.displayLabel?.trim()||b.segmentedRow?.displayLabel?.trim();S&&d.set(b.id,S)}let p=new Map;for(let x=0;x<o.length;x++){let b=o[x],S=Math.hypot(b.x-c.x,b.y-c.y),I=p.get(b.rowId);(!I||S>I.far)&&p.set(b.rowId,{seat:b,index:x,far:S})}for(let[x,b]of p){let S=r.seatOwner[b.index]??b.seat.sectionId,I=ca(b.seat.label,x,h.get(S??""),d.get(x));I&&u.push({id:`row:${x}`,kind:"row",text:I,anchor:[b.seat.x*E,r.seatDeckY(b.index)+hh,b.seat.y*E],floorIndex:s[b.index]})}let y=new Map;for(let x=0;x<o.length;x++){let b=o[x],S=y.get(b.rowId);S||(S={n:0,x:0,y:0,z:0,minX:1/0,maxX:-1/0,minZ:1/0,maxZ:-1/0,label:ca(b.label,b.rowId,h.get(r.seatOwner[x]??b.sectionId??""),d.get(b.rowId)),sectionId:r.seatOwner[x]??b.sectionId},y.set(b.rowId,S));let I=x*3,w=i.iPosition[I],k=i.iPosition[I+1],L=i.iPosition[I+2];S.n++,S.x+=w,S.y+=k,S.z+=L,S.minX=Math.min(S.minX,w),S.maxX=Math.max(S.maxX,w),S.minZ=Math.min(S.minZ,L),S.maxZ=Math.max(S.maxZ,L)}for(let[x,b]of y)f.push({id:x,label:b.label,sectionId:b.sectionId,seatCount:b.n,center:[b.x/b.n,b.y/b.n,b.z/b.n],radius:Math.max(.8,Math.hypot(b.maxX-b.minX,b.maxZ-b.minZ)*.5)});let g=0,M=(x,b)=>{g++,u.push({id:`access:${o[x].id}`,kind:"access",text:b.name,icon:b.icon,color:b.color,...b.ink?{ink:b.ink}:{},seatWidthM:i.iChairWidth[x]*2,anchor:[o[x].x*E,r.seatDeckY(x)+ph,o[x].y*E],floorIndex:s[x],rowId:o[x].rowId})},P=null,R=()=>{if(P){let x=sa(o[P.seats[0]]),b=P.seats.length,S=Math.max(1,Math.round(b/bh));for(let I=0;I<S&&g<ra;I++)M(P.seats[Math.min(b-1,Math.floor((I+.5)*b/S))],x)}P=null};for(let x=0;x<o.length&&g<ra;x++){let b=sa(o[x]);if(b&&o[x].accessibility?.length){R(),M(x,b);continue}if(!b){R();continue}P&&P.rowId===o[x].rowId&&P.icon===b.icon?P.seats.push(x):(R(),P={rowId:o[x].rowId,icon:b.icon,seats:[x]})}if(R(),o.length<=Mh)for(let x=0;x<o.length;x++){let b=o[x],S=Ih(b.displayLabel||b.label);S&&u.push({id:`seat:${b.id}`,kind:"seat",seatWidthM:i.iChairWidth[x]*2,text:S,anchor:[b.x*E,r.seatDeckY(x)+dh,b.y*E],floorIndex:s[x],rowId:b.rowId})}}for(let h of n){let d=tt(h,n.length===1?o:o.filter((g,M)=>s[M]===h.index)),p=d?na(Yo(h.objects,At(d)),h.objects.filter(g=>g.type==="text")):new Map,y=[...p.values()];for(let g of h.objects){let M=g.type==="text"?p.get(g.id):void 0;if(g.type==="shape"&&(g.role==="entrance"||g.role==="exit")&&lh.test(g.label?.trim()??"")){let P=ie(g),R=P?ht(P):null;if(R&&y.some(x=>Math.hypot(R.x-x.mid.x,R.y-x.mid.y)*E<=Ko+x.widthM))continue}if(M&&g.type==="text")u.push({id:`text:${g.id}`,kind:"gate",text:g.text,icon:"entrance",anchor:[M.mid.x*E,h.baseHeightM+M.openingM+jn,M.mid.y*E],color:g.color,floorIndex:h.index});else if(g.type==="shape"&&g.role&&uh.has(g.role)){let P=ie(g),R=P?ht(P):null;if(!R||!g.label||g.gate?.hideFromBuyers)continue;u.push({id:`architecture:${g.id}`,kind:g.role==="stage"?"stage":g.role==="entrance"||g.role==="exit"?"gate":"annotation",text:g.label,...g.role==="entrance"||g.role==="exit"?{icon:g.role}:{},...g.gate?.stepFree?{stepFree:!0}:{},anchor:[R.x*E,h.baseHeightM+Fe(g).heightM+jn,R.y*E],color:g.fill,floorIndex:h.index})}else if(g.type==="text"){let P=g.semanticKind==="icon"?bo(g.iconKey)?.key:void 0,R=g.text||(P?bo(P).label:"");if(!R)continue;u.push({id:`text:${g.id}`,kind:"annotation",text:R,...P?{venueIcon:P}:{},anchor:P?[(g.position.x+g.fontSize/2)*E,h.baseHeightM+jn,(g.position.y+g.fontSize/2)*E]:[g.position.x*E,h.baseHeightM+jn,g.position.y*E],color:g.color,rotation:g.rotation,floorIndex:h.index})}else if(g.type==="booth"){if(g.labelPresentation?.visible===!1)continue;let P=Ne(g);if(!P)continue;let R=ht(P);if(!R)continue;u.push({id:`booth:${g.id}`,kind:"booth",text:g.displayLabel||g.label||g.id,anchor:[R.x*E,h.baseHeightM+Ln+fh,R.y*E],floorIndex:h.index})}}}return{labels:u,sections:l,rows:f}}function fa(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 Ih(e){let t=e.lastIndexOf("-");return t>=0&&t<e.length-1?e.slice(t+1):e}function ca(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&&qs(i,n)}function ma(e){let{doc:t,units:n,seats:o,surfaces:r,solids:i,hintedSeatFloor:s,seatFloor:a}=e,c=[];{let u=n.map(()=>({minX:1/0,minY:1/0,minZ:1/0,maxX:-1/0,maxY:-1/0,maxZ:-1/0}));for(let m=0;m<i.floor.length;m+=1){let h=Math.max(0,Math.min(n.length-1,Math.round(i.floor[m]))),d=m*3,p=u[h];p.minX=Math.min(p.minX,i.position[d]),p.minY=Math.min(p.minY,i.position[d+1]),p.minZ=Math.min(p.minZ,i.position[d+2]),p.maxX=Math.max(p.maxX,i.position[d]),p.maxY=Math.max(p.maxY,i.position[d+1]),p.maxZ=Math.max(p.maxZ,i.position[d+2])}let l=new Map;for(let m=0;m<n.length;m++)for(let h of n[m].objects)h.type==="section"&&l.set(h.id,m);let f=n.map(()=>({n:0,minX:1/0,minY:1/0,minDeck:1/0,maxX:-1/0,maxY:-1/0,maxDeck:-1/0,sumX:0,sumDeck:0,sumZ:0}));for(let m=0;m<o.length;m++){let h=r.seatOwner[m],d=(h!==null?l.get(h):void 0)??s[m];if(d===void 0)continue;let p=f[d],y=o[m];p.n++,y.x<p.minX&&(p.minX=y.x),y.y<p.minY&&(p.minY=y.y),y.x>p.maxX&&(p.maxX=y.x),y.y>p.maxY&&(p.maxY=y.y);let g=r.seatDeckY(m);p.sumX+=y.x*E,p.sumDeck+=g,p.sumZ+=y.y*E,p.minDeck=Math.min(p.minDeck,g),p.maxDeck=Math.max(p.maxDeck,g+1.6),a[m]=d}for(let m=0;m<n.length;m++){let h=f[m],d=t.floors?.[m],p=u[m],y=Math.min(h.n?h.minX*E:n[m].focal.x*E-1,Number.isFinite(p.minX)?p.minX:1/0),g=Math.max(h.n?h.maxX*E:n[m].focal.x*E+1,Number.isFinite(p.maxX)?p.maxX:-1/0),M=Math.min(h.n?h.minY*E:n[m].focal.y*E-1,Number.isFinite(p.minZ)?p.minZ:1/0),P=Math.max(h.n?h.maxY*E:n[m].focal.y*E+1,Number.isFinite(p.maxZ)?p.maxZ:-1/0),R=Math.min(h.n?Math.min(n[m].baseHeightM,h.minDeck):n[m].baseHeightM,Number.isFinite(p.minY)?p.minY:1/0),x=Math.max(h.n?Math.max(h.maxDeck,R+.5):R+.5,Number.isFinite(p.maxY)?p.maxY:-1/0),b=[h.n?h.sumX/h.n:(y+g)/2,h.n?h.sumDeck/h.n:(R+x)/2,h.n?h.sumZ/h.n:(M+P)/2],S=Math.max(1,.5*Math.hypot(g-y,x-R,P-M));c.push({index:m,id:d?.id??`floor-${m}`,label:d?.name??(n.length>1?`Floor ${m+1}`:"Venue"),seatCount:h.n,center:b,radius:S,box:{min:[y,R,M],max:[g,x,P]},focalWorld:[n[m].focal.x*E,n[m].baseHeightM+1.5,n[m].focal.y*E]})}}return c}function zo(e,t){let n=1/0,o=1/0,r=-1/0,i=-1/0,s=(a,c)=>{a<n&&(n=a),c<o&&(o=c),a>r&&(r=a),c>i&&(i=c)};for(let a of t)s(a.x,a.y);for(let a of e)for(let c of a.objects)if(c.type==="section")for(let u of c.outline)s(u.x,u.y);else if(c.type==="shape"&&c.points)for(let u of c.points)s(u.x,u.y);else if(c.type==="gaArea")for(let u of c.points)s(u.x,u.y);else if(c.type==="booth"){let u=Ne(c);if(u)for(let l of u)s(l.x,l.y)}else if(c.type==="table"){let u=Bn(c);if(u)for(let l of u)s(l.x,l.y)}else if(c.type==="decorImage"){let u=Fn(c);if(u)for(let l of u)s(l.x,l.y)}return Number.isFinite(n)||(n=-100,o=-100,r=100,i=100),{minX:n,minY:o,maxX:r,maxY:i}}function ga(e,t,n,o,r,i,s){if(t.length===1){let a=n.map(m=>({x:m.x,y:m.y}));for(let m of t[0].objects)m.type==="section"?a.push(...m.outline):m.type==="shape"?a.push(...ie(m)??m.points??[]):m.type==="gaArea"?a.push(...m.points):m.type==="booth"?a.push(...Ne(m)??[]):m.type==="table"?a.push(...Bn(m)??[]):m.type==="decorImage"&&a.push(...Fn(m)??[]);if(pa(e,t[0],n,i)||ya(e,t[0],n,a,i))return!1;if(s&&da(e,t[0].baseHeightM,a,i,s))return!0;let c=Kt(a),u=(r.minX+r.maxX)/2,l=(r.minY+r.maxY)/2,f=c.length>=3?c.map(m=>{let h=m.x-u,d=m.y-l,p=Math.max(1,Math.hypot(h,d));return{x:m.x+h/p*80,y:m.y+d/p*80}}):jt(r.minX-28,r.minY-28,r.maxX-r.minX+56,r.maxY-r.minY+56);return z(e,f,void 0,()=>-.04,-.22,i.ground,i.ground,K),!1}else{let a=t.reduce((y,g)=>g.baseHeightM<y.baseHeightM?g:y);e.setFloor(a.index);let c={...a,objects:t.flatMap(y=>y.objects)},u=n.map(y=>({x:y.x,y:y.y}));for(let y of c.objects)y.type==="section"&&u.push(...y.outline);if(pa(e,c,n,i)||ya(e,c,n,u,i))return!1;if(s&&da(e,a.baseHeightM,u,i,s))return!0;let l=n.filter((y,g)=>o[g]===a.index),f=zo([a],l),m=Math.hypot(f.maxX-f.minX,f.maxY-f.minY),h=Math.max(28,Math.min(80,m*.04)),d=jt(f.minX-h,f.minY-h,f.maxX-f.minX+h*2,f.maxY-f.minY+h*2),p=a.baseHeightM-.03;return z(e,d,void 0,()=>p,p-.22,i.ground,i.ground,K),!1}}function Zo(e,t,n,o){let{cx:r,cz:i,radius:s}=n,a=1/0,c=1/0,u=1/0,l=-1/0,f=-1/0,m=-1/0,h=(y,g,M)=>{a=Math.min(a,y),l=Math.max(l,y),c=Math.min(c,g),f=Math.max(f,g),u=Math.min(u,M),m=Math.max(m,M)};for(let y=0;y<e.position.length;y+=3){let g=y/3;o&&g>=o[0]&&g<o[1]||h(e.position[y],e.position[y+1],e.position[y+2])}for(let y=0;y<t.count;y++){let g=y*3,M=t.iPosition[g],P=t.iPosition[g+1],R=t.iPosition[g+2],x=Math.max(.35,t.iMaxRadius[y]??.35);h(M-x,P,R-x),h(M+x,P+1.6,R+x)}Number.isFinite(a)||(a=r-s,l=r+s,c=0,f=s*.16,u=i-s,m=i+s);let d=[(a+l)/2,(c+f)/2,(u+m)/2],p=Math.max(1,.5*Math.hypot(l-a,f-c,m-u));return{center:d,radius:p,minY:c,maxY:f}}var Rh=4096;function xa(e,t,n=[]){let o=Math.max(1,Math.ceil(e.count/Rh)),r=Math.ceil(e.count/o),i=new Float32Array((r*2+t.length*4+n.length)*3),s=0;for(let a=0;a<e.count;a+=o){let c=e.iPosition[a*3],u=e.iPosition[a*3+1],l=e.iPosition[a*3+2];i[s++]=c,i[s++]=u,i[s++]=l,i[s++]=c,i[s++]=0,i[s++]=l}for(let[a,c,u]of n)i[s++]=a,i[s++]=c,i[s++]=u;for(let a of t)for(let[c,u]of[[-1,-1],[1,-1],[1,1],[-1,1]])i[s++]=a.cx+c*a.halfX,i[s++]=a.y,i[s++]=a.cz+u*a.halfZ;return i.subarray(0,s)}function Ma(e,t,n,o,r,i,s=[]){let a=1/0,c=1/0,u=-1/0,l=-1/0;for(let x=0;x<e.count;x++){let b=x*3,S=e.iPosition[b],I=e.iPosition[b+2];S<a&&(a=S),S>u&&(u=S),I<c&&(c=I),I>l&&(l=I)}for(let[x,,b]of s)x<a&&(a=x),x>u&&(u=x),b<c&&(c=b),b>l&&(l=b);for(let x of t)a=Math.min(a,x.cx-x.halfX),u=Math.max(u,x.cx+x.halfX),c=Math.min(c,x.cz-x.halfZ),l=Math.max(l,x.cz+x.halfZ);let f=n.minX*E,m=n.maxX*E,h=n.minY*E,d=n.maxY*E,p=f,y=m,g=h,M=d;if(Number.isFinite(a)){let x=Math.max(2,.06*Math.hypot(u-a,l-c));p=Math.max(f,a-x),y=Math.min(m,u+x),g=Math.max(h,c-x),M=Math.min(d,l+x)}let P=Math.min(0,o),R=Math.max(r,i*.05);return{min:[p,P,g],max:[y,R,M]}}var ha=12,wh=.6,Eh=40;function da(e,t,n,o,r){let i=Kt([...n]);if(i.length<3)return!1;let s=1/0,a=1/0,c=-1/0,u=-1/0;for(let R of i)s=Math.min(s,R.x),c=Math.max(c,R.x),a=Math.min(a,R.y),u=Math.max(u,R.y);let l=Math.hypot(c-s,u-a)*E,f=Le(i,ha/E,1.2),m=Math.max(Eh,l*wh),h=Le(i,(ha+m)/E,1.2);if(f.length!==h.length)return!1;let d=re(o.ground,[.78,.76,.72],.35),p=re(o.ground,[.56,.62,.52],.3);z(e,f,void 0,()=>t-.04,t-.22,d,d,K);let y=t-.05,g=f.map(R=>[R.x*E,y,R.y*E]),M=h.map(R=>[R.x*E,y,R.y*E]),P=[0,1,0];for(let R=0;R<g.length;R++){let x=(R+1)%g.length;e.tri(g[R],M[x],M[R],P,p,r,r),e.tri(g[R],g[x],M[x],P,p,p,r)}return!0}function pa(e,t,n,o){let r=tt(t,n);if(!r)return!1;let i=t.baseHeightM,s=re(o.ground,[.62,.55,.47],.4);return z(e,r,void 0,()=>i-.04,i-.22,s,s,K),!0}var Ah=3e3,_h=20,ba=1.5,vh=1.2,Ch=.25;function ya(e,t,n,o,r){if(!n.length||n.length>Ah||o.length<3)return!1;for(let w of t.objects){if(w.type==="shape"&&nn(w.stageKind))return!1;if(w.type==="section"){let{height:k}=Qe(w,{floorBaseHeightM:t.baseHeightM});if(k-t.baseHeightM>_h)return!1}}let i=0,s=0;for(let w of o)i+=w.x,s+=w.y;i/=o.length,s/=o.length;let a=0,c=0,u=0;for(let w of o){let k=w.x-i,L=w.y-s;a+=k*k,c+=L*L,u+=k*L}let l=.5*Math.atan2(2*u,a-c),f=Math.cos(l),m=Math.sin(l),h=-m,d=f,p=1/0,y=-1/0,g=1/0,M=-1/0;for(let w of o){let k=(w.x-i)*f+(w.y-s)*m,L=(w.x-i)*h+(w.y-s)*d;p=Math.min(p,k),y=Math.max(y,k),g=Math.min(g,L),M=Math.max(M,L)}let P=w=>[[p-w,g-w],[y+w,g-w],[y+w,M+w],[p-w,M+w]].map(([k,L])=>({x:i+f*k+h*L,y:s+m*k+d*L})),R=P(ba/E),x=P((ba+Ch)/E),b=t.baseHeightM,S=re(r.ground,[.62,.55,.47],.4),I=re(r.ground,[.86,.86,.84],.55);return z(e,x,void 0,()=>b-.04,b-.22,S,S,K),z(e,x,[R.slice().reverse()],()=>b+vh,b-.04,re(I,[1,1,1],.2),I,K),!0}function Sa(e,t,n){let o=()=>({byObjectId:new Map,elements:[]});if(!t||!e)return o();let r=Pr(t);if(!r.ok||r.value.id!==e)return o();let i=new Map;for(let f of n)for(let m of f.objects)m.type==="shape"&&i.set(m.id,{shape:m,unit:f});let s=new Set,a=new Set,c=new Map((t.overlay.productionElements??[]).map(f=>{let m=f.runtimeContentImageUrl;return[f.id,typeof m=="string"&&/^(?:blob:|data:image\/|https:\/\/)/.test(m)?m:void 0]})),u=[];for(let f of r.value.overlay.productionElements??[]){let m=i.get(f.objectId),h=m?ie(m.shape):null,d=f.baseElevationM??0;if(!m||!h||h.length<3||!f.id||s.has(f.id)||a.has(f.objectId)||!Number.isFinite(f.heightM)||f.heightM<.05||f.heightM>50||!Number.isFinite(d)||d<-10||d>100)return o();s.add(f.id),a.add(f.objectId);let p=h.map(I=>I.x*E),y=h.map(I=>I.y*E),g=m.unit.baseHeightM+d,M=Math.min(...p),P=Math.max(...p),R=Math.min(...y),x=Math.max(...y),b,S=c.get(f.id)??f.contentImageUrl;if(f.kind==="screen"&&S&&(b=Yi(h,g,g+f.heightM,m.unit.focal),!b))if(P-M>=x-R){let I=Math.abs(R-m.unit.focal.y*E)<=Math.abs(x-m.unit.focal.y*E)?R-.006:x+.006;b=[[M,g,I],[P,g,I],[M,g+f.heightM,I],[P,g+f.heightM,I]]}else{let I=Math.abs(M-m.unit.focal.x*E)<=Math.abs(P-m.unit.focal.x*E)?M-.006:P+.006;b=[[I,g,R],[I,g,x],[I,g+f.heightM,R],[I,g+f.heightM,x]]}u.push({id:f.id,objectId:f.objectId,kind:f.kind,floorIndex:m.unit.index,baseY:g,topY:g+f.heightM,bounds:{min:[M,g,R],max:[P,g+f.heightM,x]},occlusion:f.occlusion,...S?{contentImageUrl:S}:{},...b?{contentPlane:b}:{}})}let l=u.sort((f,m)=>f.id.localeCompare(m.id));return{byObjectId:new Map(l.map(f=>[f.objectId,f])),elements:l}}var Pa=[.13,.14,.17],Ot=[.4,.43,.47],kh=.18,Oh=.02,Th=2.4,Lh=1500,Bh=240,Fh=.25;function Ia(e,t,n,o){let r=t.stageKind??"";if(st(r)||r==="round"||!o.length)return;let i=ie(t);if(!i||i.length<3)return;let s={x:i.reduce((C,B)=>C+B.x,0)/i.length,y:i.reduce((C,B)=>C+B.y,0)/i.length},a=0,c=0,u=new Set;for(let C of o)a+=C.x,c+=C.y,u.add(Math.floor(Math.atan2(C.y-s.y,C.x-s.x)*180/Math.PI/10));let l=s.x-a/o.length,f=s.y-c/o.length,m=Math.hypot(l,f);if(m<1e-6)return;let h=o.reduce((C,B)=>C+Math.hypot(B.x-s.x,B.y-s.y),0)/o.length;if(u.size*10>Bh&&m<Fh*h)return;let d=l/m,p=f/m,y=-p,g=d,M=-1/0,P=1/0,R=1/0,x=-1/0;for(let C of i){let B=(C.x-s.x)*d+(C.y-s.y)*p,O=(C.x-s.x)*y+(C.y-s.y)*g;M=Math.max(M,B),P=Math.min(P,B),R=Math.min(R,O),x=Math.max(x,O)}let b=(x-R)*E,S=(M-P)*E;if(b<3||S<1.5||b*S>Lh)return;let I=kh/E,w=(C,B)=>({x:s.x+d*C+y*B,y:s.y+p*C+g*B}),k=(C,B,O,F)=>[w(C,O),w(C,F),w(B,F),w(B,O)],L=n+Math.max(3.5,Math.min(8,b*.35)),T=n+Math.min(Th,L-n-1),v=.2/E,A=P+Math.min(S*.25,1.5)/E,_=Oh/E;z(e,k(M-2*I+_,M-I-_,R+I+v,x-I-v),void 0,()=>T,n,Pa,Pa,K);for(let[C,B]of[[R+I,R+I+v],[x-I-v,x-I]])z(e,k(M-2*I,M-I,C,B),void 0,()=>L+.3,n,Ot,Ot,K),z(e,k(A+v,M-2*I,C,B),void 0,()=>L+.3,L,Ot,Ot,K);z(e,k(A,A+v,R+I,x-I),void 0,()=>L+.3,L,Ot,Ot,K)}function ke(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function Ce(e){return Array.isArray(e)?e:[]}function Nh(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 Hn(e,t){return!Array.isArray(e)||e.length!==t||!e.every(n=>typeof n=="number"&&Number.isFinite(n))?null:e}function Dh(){return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}function Gh(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 jh(e){let t=Hn(e.matrix,16);if(t)return t;if(e.matrix!==void 0)return null;let n=e.translation===void 0?[0,0,0]:Hn(e.translation,3),o=e.rotation===void 0?[0,0,0,1]:Hn(e.rotation,4),r=e.scale===void 0?[1,1,1]:Hn(e.scale,3);if(!n||!o||!r)return null;let[i,s,a,c]=o,u=Math.hypot(i,s,a,c);if(!(u>1e-8))return null;let l=i/u,f=s/u,m=a/u,h=c/u,d=l+l,p=f+f,y=m+m,g=l*d,M=l*p,P=l*y,R=f*p,x=f*y,b=m*y,S=h*d,I=h*p,w=h*y;return[(1-(R+b))*r[0],(M+w)*r[0],(P-I)*r[0],0,(M-w)*r[1],(1-(g+b))*r[1],(x+S)*r[1],0,(P+I)*r[2],(x-S)*r[2],(1-(g+R))*r[2],0,n[0],n[1],n[2],1]}function Hh(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 Vh(e){let t=e[0],n=e[4],o=e[8],r=e[1],i=e[5],s=e[9],a=e[2],c=e[6],u=e[10],l=i*u-s*c,f=s*a-r*u,m=r*c-i*a,h=t*l+n*f+o*m;if(Math.abs(h)<1e-12)return null;let d=1/h;return[l*d,f*d,m*d,(o*c-n*u)*d,(t*u-o*a)*d,(n*a-t*c)*d,(n*s-o*i)*d,(o*r-t*s)*d,(t*i-n*r)*d]}function Ra(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 Uh(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 Xh(e){return e===5120||e===5121?1:e===5122||e===5123?2:e===5125||e===5126?4:0}function Kh(e){return e==="SCALAR"?1:e==="VEC2"?2:e==="VEC3"?3:e==="VEC4"?4:0}function Yh(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 Wh(e){let t=e instanceof Uint8Array?e:new Uint8Array(e),n=Uh(t);if(!n)return{ok:!1,issue:"invalid_glb"};let{json:o,bin:r}=n;if(!ke(o.asset)||o.asset.version!=="2.0")return{ok:!1,issue:"unsupported_glb"};let i=Ce(o.extensionsUsed).filter(R=>typeof R=="string");if(i.includes("KHR_draco_mesh_compression")||Nh(o))return{ok:!1,issue:"draco_not_allowed"};if(i.length||Ce(o.extensionsRequired).length)return{ok:!1,issue:"unsupported_glb"};if(Ce(o.images).length||Ce(o.textures).length)return{ok:!1,issue:"external_resource"};let s=Ce(o.buffers);if(s.length!==1||!ke(s[0])||s[0].uri!==void 0||typeof s[0].byteLength!="number"||!Number.isInteger(s[0].byteLength)||s[0].byteLength<0||s[0].byteLength>r.byteLength)return{ok:!1,issue:"external_resource"};let a=Ce(o.accessors),c=Ce(o.bufferViews),u=Ce(o.meshes),l=Ce(o.nodes),f=Ce(o.scenes),m=typeof o.scene=="number"?o.scene:0;if(!ke(f[m]))return{ok:!1,issue:"unsupported_glb"};let h=new DataView(r.buffer,r.byteOffset,r.byteLength),d=(R,x,b)=>{if(typeof R!="number"||!Number.isInteger(R)||!ke(a[R]))return null;let S=a[R];if(S.type!==x||S.sparse!==void 0||S.normalized===!0||typeof S.count!="number"||!Number.isInteger(S.count)||S.count<1||typeof S.componentType!="number"||!b.includes(S.componentType)||typeof S.bufferView!="number")return null;let I=c[S.bufferView];if(!ke(I)||I.buffer!==0||typeof I.byteLength!="number"||!Number.isInteger(I.byteLength)||I.byteLength<0)return null;let w=Kh(S.type),k=Xh(S.componentType),L=typeof I.byteStride=="number"?I.byteStride:w*k,T=typeof I.byteOffset=="number"?I.byteOffset:0,v=typeof S.byteOffset=="number"?S.byteOffset:0,A=T+v,_=v+(S.count-1)*L+w*k;if(!Number.isInteger(L)||!Number.isInteger(T)||!Number.isInteger(v)||L<w*k||T<0||v<0||T+I.byteLength>r.byteLength||_>I.byteLength)return null;let C=[];for(let B=0;B<S.count;B++){let O=[];for(let F=0;F<w;F++){let D=Yh(h,A+B*L+F*k,S.componentType);if(!Number.isFinite(D))return null;O.push(D)}C.push(O)}return C},p=[],y=[],g=0,M=new Set,P=(R,x)=>{if(typeof R!="number"||!Number.isInteger(R)||!ke(l[R])||M.has(R))return!1;M.add(R);let b=l[R],S=jh(b);if(!S)return!1;let I=Gh(x,S),w=Vh(I);if(!w)return!1;if(b.mesh!==void 0){if(typeof b.mesh!="number")return!1;let k=u[b.mesh];if(!ke(k))return!1;for(let L of Ce(k.primitives)){if(!ke(L)||L.mode!==void 0&&L.mode!==4||!ke(L.attributes))return!1;let T=d(L.attributes.POSITION,"VEC3",[5126]),v=L.attributes.NORMAL===void 0?null:d(L.attributes.NORMAL,"VEC3",[5126]);if(!T||L.attributes.NORMAL!==void 0&&!v)return!1;let A=T.length;if(L.indices!==void 0){let C=typeof L.indices=="number"?a[L.indices]:null;A=ke(C)?C.count:void 0}if(typeof A!="number"||!Number.isInteger(A)||A%3!==0||(g+=A/3,g>1e5))return!1;let _=L.indices===void 0?T.map((C,B)=>[B]):d(L.indices,"SCALAR",[5121,5123,5125]);if(!_||_.length%3!==0||_.length!==A)return!1;for(let C=0;C<_.length;C+=3){let B=[_[C][0],_[C+1][0],_[C+2][0]];if(B.some(D=>!Number.isInteger(D)||D<0||D>=T.length))return!1;let O=B.map(D=>Hh(I,...T[D])),F=null;if(!v){let D=O[1][0]-O[0][0],j=O[1][1]-O[0][1],N=O[1][2]-O[0][2],X=O[2][0]-O[0][0],V=O[2][1]-O[0][1],Z=O[2][2]-O[0][2];F=Ra([1,0,0,0,1,0,0,0,1],j*Z-N*V,N*X-D*Z,D*V-j*X)}for(let D=0;D<3;D++)p.push(...O[D]),y.push(...v?Ra(w,...v[B[D]]):F)}}}for(let k of Ce(b.children))if(!P(k,I))return!1;return M.delete(R),!0};for(let R of Ce(f[m].nodes))if(!P(R,Dh()))return{ok:!1,issue:g>1e5?"triangle_limit":"unsupported_glb"};return!g||p.length!==g*9||y.length!==p.length?{ok:!1,issue:"unsupported_glb"}:{ok:!0,triangleCount:g,position:new Float32Array(p),normal:new Float32Array(y)}}function wa(e){try{return Wh(e)}catch{return{ok:!1,issue:"invalid_glb"}}}function Ea(e){let{doc:t}=e,n=Kr(t.theme),o=n.structure,r=Ti(t,e.eventConfigurationId??t.eventConfigurationId),i=Sa(e.eventConfigurationId,e.eventConfiguration,r),s=e.seats,a=new un,c=null;if(e.registeredShellGlb){let G=wa(e.registeredShellGlb);if(G.ok){let H=G.position.length/3,J=new Float32Array(G.position.length),me=n.materials.shell??o.tierWall;for(let xe=0;xe<H;xe++){let Ie=G.normal[xe*3+1],ae=Ie<-.25?.4:.62+.38*Math.max(0,Ie);J[xe*3]=me[0]*ae,J[xe*3+1]=me[1]*ae,J[xe*3+2]=me[2]*ae}c={position:G.position,normal:G.normal,color:J,floor:new Float32Array(H).fill(-2),material:new Float32Array(H),count:H}}}let u=new Map;for(let G of r)for(let H of G.objects)u.set(H.id,G.index),H.type==="section"&&u.set(H.logicalSectionId??H.id,G.index);let l=s.map(G=>u.get(G.sectionId??"")??u.get(G.rowId??"")??0),f=zo(r,s),m=a.vertexCount,d=ga(a,r,s,l,f,o,re(n.background.top,n.background.bottom,.5))?a.vertexCount:m,p=fi(t,s),y=new Map,g=new Map;for(let G of t.categories??[])y.set(G.key,G.color),G.seatGlyph&&g.set(G.key,G.seatGlyph);let M=[],P=Ki(r,s,l),R=new Map;s.forEach((G,H)=>{let J=P.seatDeckY(H);Number.isFinite(J)&&R.set(G.rowId,Math.min(R.get(G.rowId)??1/0,J))});let x=new Float32Array(s.length),b=[],S=new Map((t.floors??[]).map((G,H)=>[G.id,H])),I=r.map(()=>[]);for(let G of s){let H=G.floorId?S.get(G.floorId)??0:0;I[Math.min(H,I.length-1)]?.push(G)}let w=(G,H)=>{if(!H||H.length<3)return!1;let J=Math.min(...H.map(ae=>ae.x)),me=Math.max(...H.map(ae=>ae.x)),xe=Math.min(...H.map(ae=>ae.y)),Ie=Math.max(...H.map(ae=>ae.y));for(let ae=0;ae<G;ae++)for(let ce of I[ae])if(!(ce.x<J||ce.x>me||ce.y<xe||ce.y>Ie)&&Pe(ce,H,void 0))return!0;return!1},k=null,L=G=>r.length===1?s:s.filter((H,J)=>l[J]===G),T=(G,H)=>{let J=Ne(G);if(!J)return!1;let me=1/0,xe=1/0,Ie=-1/0,ae=-1/0;for(let ce of J)me=Math.min(me,ce.x),Ie=Math.max(Ie,ce.x),xe=Math.min(xe,ce.y),ae=Math.max(ae,ce.y);return s.some((ce,De)=>ce.kind!=="booth"&&(r.length===1||l[De]===H)&&ce.x>me&&ce.x<Ie&&ce.y>xe&&ce.y<ae&&_e(J,ce.x,ce.y))},v;for(let G=0;G<r.length;G++){let H=r[G];a.setFloor(G);let J=tt(H,L(G)),me=0;if(J){let Y=0;for(let he of H.objects)if(he.type==="section")for(let Me of P.bySection.get(he.id)?.rowLevels??[])Y=Math.max(Y,Me.y-H.baseHeightM);if(me=ji(Y),!v){let he=At(J);v={centre:[he.x*E,he.y*E]}}}let xe=new In,Ie=[],ae=H.objects.filter(Y=>Y.type==="shape"&&(Y.role==="entrance"||Y.role==="exit")),ce=H.objects.filter(Y=>Y.type==="section"&&!!Y.outline&&Y.outline.length>=3),De=Ss(H.objects.filter(Y=>Y.type==="booth"),H.focal);for(let Y of H.objects)if(Y.type==="section"){let he=a.vertexCount;Ns(a,Y,H,mi(Y,p),P.bySection.get(Y.id),xe,ce,o,G>0&&w(G,Y.outline));let Me=a.vertexCount-he;Me>0&&b.push({sectionId:Y.id,start:he,count:Me})}else if(Y.type==="shape"){let he=i.byObjectId.get(Y.id),Me=M.length,rt=J!==null&&Y.role==="wall"&&!he;a.setMaterial(rt?Rn:(he?.kind??Y.role)==="screen"?1:0);let it=Y.role==="stage"&&!he?Is(Y,L(G)):rt&&Y.heightM===void 0?{...Y,heightM:me}:Y,Ze=Di(it,Ie);if(ys(a,it,H.baseHeightM+Ze.supportOffsetM,Ze.topOffsetM-Ze.supportOffsetM,o,H.focal,M,he,ae),a.setMaterial(0),Y.role==="stage"&&!he&&M.length>Me&&(k??G)===G){k=G;let $e=t.floors?.[G]?.id,Tt=r.length>1&&$e?s.filter(Jt=>Jt.floorId===$e):s;Ia(a,it,M[M.length-1].y,Tt)}}else Y.type==="gaArea"?xs(a,Y,H.baseHeightM,oe(y.get(Y.categoryKey)),o):Y.type==="booth"?ds(a,Y,H.baseHeightM,oe(y.get(Y.categoryKey)),o,De.get(Y.id)??H.focal,T(Y,G)):Y.type==="table"?bs(a,Y,Math.max(H.baseHeightM,R.get(Y.id)??H.baseHeightM),oe(Y.fill??t.theme?.decorFill??"#232c40"),o,!!(Y.fill??t.theme?.decorFill)):Y.type==="decorImage"&&gs(a,Y,H.baseHeightM,o);J&&oa(a,H.objects,J,H.baseHeightM,me,H.focal,o,Y=>!i.byObjectId.has(Y.id)),Gs(a,H,s,P,o,n.materials.shell,!c)}let A=r.length>1?{x:r.reduce((G,H)=>G+H.focal.x,0)/r.length,y:r.reduce((G,H)=>G+H.focal.y,0)/r.length}:t.focalPoint??{x:(f.minX+f.maxX)/2,y:(f.minY+f.maxY)/2},_=Fr(c?[a.build(),c]:[a.build()]),C=Mi(s,e.initialState,P,x,y,g),B=la({doc:t,units:r,seats:s,surfaces:P,focal:A}),{labels:O,sections:F,rows:D}=ua({doc:t,units:r,seats:s,surfaces:P,seatData:C,hintedSeatFloor:l,zones:B,focal:A}),j=new Map(F.map((G,H)=>[G.id,H]));P.seatOwner.forEach((G,H)=>{C.iSection[H]=G?j.get(G)??-1:-1});let N=ma({doc:t,units:r,seats:s,surfaces:P,solids:_,hintedSeatFloor:l,seatFloor:x});fa(O,N),C.iYaw=xi(C.iPosition,s.length,G=>s[G].rowId,G=>{let H=r[x[G]]?.focal??A;return[H.x*E,H.y*E]});let X=(f.minX+f.maxX)/2*E,V=(f.minY+f.maxY)/2*E,Z=.5*Math.hypot((f.maxX-f.minX)*E,(f.maxY-f.minY)*E)||10,U=Zo(_,C,{cx:X,cz:V,radius:Z},[m,d]),te=Zo(_,C,{cx:X,cz:V,radius:Z}),Q=zh(r),fe=Ma(C,M,f,U.minY,U.maxY,Z,Q);return{sharedAisles:Nr(r.flatMap(G=>G.objects.flatMap(H=>{if(H.type!=="section")return[];let J=P.bySection.get(H.id);return J?[{sectionId:H.id,floorIndex:G.index,rows:J.rowLevels}]:[]}))),solids:_,sectionSolidRanges:b,seats:C,seatSectionIds:P.seatOwner,bounds:{center:[(fe.min[0]+fe.max[0])/2,(fe.min[1]+fe.max[1])/2,(fe.min[2]+fe.max[2])/2],radius:Z,groundY:0,box:fe,fitPoints:xa(C,M,Q)},...v?{room:v}:{},...!v&&r.some(G=>G.objects.some(H=>H.type==="shape"&&nn(H.stageKind)))?{outdoor:!0}:{},renderBounds:{center:U.center,radius:U.radius},clipBounds:{center:te.center,radius:te.radius},stateColorLUT:Yr(n,dn),theme:n,seatCount:s.length,focalWorld:[A.x*E,1.5,A.y*E],zones:B,stages:M,productionElements:i.elements,sections:F,rows:D,labels:O,floors:N}}function zh(e){let t=[];for(let n of e)for(let o of n.objects){let r=o.type==="gaArea"?o.points:o.type==="booth"?Ne(o):null;for(let i of r??[])t.push([i.x*E,n.baseHeightM,i.y*E])}return t}function Zh(e,t){let{doc:n,report:o}=$s(e),r=o.confident&&(o.sections.length>0||!!o.looseRowBlocks);if(!r&&!o.roles?.length)return null;if(!r){let c=new Map(o.roles.map(h=>[h.id,h.role])),u=h=>h.map(d=>d.type==="shape"&&c.has(d.id)?{...d,role:c.get(d.id)}:d),l=e.floors?.map(h=>({...h,objects:u(h.objects)})),f=new Float64Array(t.length).fill(Number.NaN),m=new Float64Array(t.length*2).fill(Number.NaN);return t.forEach((h,d)=>{h.eyeHeightM!==void 0&&(f[d]=h.eyeHeightM),h.focalPoint&&(m[d*2]=h.focalPoint.x,m[d*2+1]=h.focalPoint.y)}),{doc:{...e,objects:l?.[0]?.objects??u(e.objects),...l?{floors:l}:{}},report:o,eyeHeightM:f,focal:m}}let i=new Map(gt(n).map(c=>[c.id,c])),s=new Float64Array(t.length).fill(Number.NaN),a=new Float64Array(t.length*2).fill(Number.NaN);return t.forEach((c,u)=>{let l=i.get(c.id)??c;l.eyeHeightM!==void 0&&(s[u]=l.eyeHeightM),l.focalPoint&&(a[u*2]=l.focalPoint.x,a[u*2+1]=l.focalPoint.y)}),{doc:n,report:o,eyeHeightM:s,focal:a}}function $h(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 Aa(e){let t=e.estimate===!1?null:Zh(e.doc,e.seats);return t?{input:{...e,doc:t.doc,seats:$h(e.seats,t)},estimate:t}:{input:e}}function Qh(e){return[e.solids.position,e.solids.normal,e.solids.color,e.solids.floor,e.solids.material,e.seats.iPosition,e.seats.iState,e.seats.iCategory,e.seats.iMaxRadius,e.seats.iRing,e.seats.iFloor,e.seats.iYaw,e.seats.iChairWidth,e.seats.iGlyph,e.seats.iPhysicalSeat].map(n=>n.buffer)}var _a=self;_a.onmessage=e=>{let t=performance.now(),n=!e.data.seats,o=e.data.seats??gt(e.data.doc),{input:r,estimate:i}=Aa({doc:e.data.doc,seats:o,eventConfigurationId:e.data.eventConfigurationId,eventConfiguration:e.data.eventConfiguration,registeredShellGlb:e.data.registeredShellGlb,estimate:e.data.estimate}),s=Ea(r),a=Qh(s);i&&a.push(i.eyeHeightM.buffer,i.focal.buffer),_a.postMessage({model:s,buildMs:performance.now()-t,...n?{seats:o}:{},...i?{estimate:i}:{}},a)};
1
+ "use strict";var va=Object.create;var qo=Object.defineProperty;var Ca=Object.getOwnPropertyDescriptor;var ka=Object.getOwnPropertyNames;var Oa=Object.getPrototypeOf,Ta=Object.prototype.hasOwnProperty;var La=(e,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of ka(t))!Ta.call(e,r)&&r!==n&&qo(e,r,{get:()=>t[r],enumerable:!(o=Ca(t,r))||o.enumerable});return e};var Ge=(e,t,n)=>(n=e!=null?va(Oa(e)):{},La(t||!e||!e.__esModule?qo(n,"default",{value:e,enumerable:!0}):n,e));var od=Math.PI/180;function Se(e,t){return Math.hypot(e.x-t.x,e.y-t.y)}function Vn(e,t,n){return{x:e.x+(t.x-e.x)*n,y:e.y+(t.y-e.y)*n}}function Un(e){let t=0,n=0;for(let r of e)t+=r.x,n+=r.y;let o=e.length||1;return{x:t/o,y:n/o}}function ht(e){return e.length?Un(e):null}function Jo(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 er(e,t,n=192){if(!Number.isInteger(t)||t<1)throw new Error("Path point count must be a positive integer");if(t===1)return[Jo(e,.5)];let o=Array.from({length:n+1},(c,u)=>Jo(e,u/n)),r=new Float64Array(o.length);for(let c=1;c<o.length;c+=1){let u=o[c].x-o[c-1].x,l=o[c].y-o[c-1].y;r[c]=r[c-1]+Math.hypot(u,l)}let i=r[r.length-1];if(i<=1e-9)return Array.from({length:t},()=>({...e.start}));let s=[],a=1;for(let c=0;c<t;c+=1){let u=i*c/(t-1);for(;a<r.length-1&&r[a]<u;)a+=1;let l=r[a-1],f=r[a],m=f===l?0:(u-l)/(f-l);s.push({x:o[a-1].x+(o[a].x-o[a-1].x)*m,y:o[a-1].y+(o[a].y-o[a-1].y)*m})}return s}function Xn(e,t,n){return Math.max(t,Math.min(n,e))}function Ba(e){return Xn(e,0,1)}function tr(e){let t=Ba(e);return t*t*(3-2*t)}var dt=Math.PI*2;function pt(e){return Number.isFinite(e.x)&&Number.isFinite(e.y)}function Fa(e,t,n){let o=t-e;if(n){for(;o<0;)o+=dt;for(;o>=dt;)o-=dt}else{for(;o>0;)o-=dt;for(;o<=-dt;)o+=dt}return o}function rr(e){if(e.version!==1||e.closed!==!0||!pt(e.start)||!Array.isArray(e.segments)||e.segments.length<2||e.segments.length>512)return!1;let t=e.start;for(let n of e.segments){if(!n||!pt(n.end))return!1;if(n.kind==="line"){if(Se(t,n.end)<=1e-9)return!1}else if(n.kind==="bezier"){if(!pt(n.control1)||!pt(n.control2)||Se(t,n.end)<=1e-9)return!1}else if(n.kind==="arc"){if(!pt(n.center)||!Number.isFinite(n.radius)||n.radius<=1e-6||Math.abs(Se(t,n.center)-n.radius)>Math.max(1e-4,n.radius*1e-4)||Math.abs(Se(n.end,n.center)-n.radius)>Math.max(1e-4,n.radius*1e-4)||Se(t,n.end)<=1e-9)return!1}else return!1;t=n.end}return Se(t,e.start)<=1e-4}function Na(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 ir(e,t=2){if(!rr(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=Fa(s,a,i.clockwise),u=Math.max(2,Math.ceil(Math.abs(c)*i.radius/n));for(let l=1;l<=u;l+=1){let f=s+c*l/u;o.push({x:i.center.x+Math.cos(f)*i.radius,y:i.center.y+Math.sin(f)*i.radius})}}else{let s=Se(r,i.control1)+Se(i.control1,i.control2)+Se(i.control2,i.end),a=Math.max(2,Math.ceil(s/n));for(let c=1;c<=a;c+=1)o.push(Na(r,i,c/a))}r=i.end}return Se(o[o.length-1],o[0])<=1e-4&&o.pop(),o}var Da=45,Kn=150,Ga=60;function ja(e){let t=Da/100;if(e<=t)return Kn;let n=Math.min(1,(e-t)/(1-t));return Kn-n*(Kn-Ga)}var nr=.5523;function or(e,t){return Math.abs(e.x-t.x)<=1e-6&&Math.abs(e.y-t.y)<=1e-6}function Ha(e){let t=[],n=[];for(e.forEach((o,r)=>{pt(o)&&(t.length&&or(t[t.length-1],o)||(t.push({x:o.x,y:o.y}),n.push(r)))});t.length>1&&or(t[0],t[t.length-1]);)t.pop(),n.pop();return{points:t,sourceIndex:n}}var Va=.5,Ua=4/3;function Xa(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*Ua;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 sr(e,t){let{points:n,sourceIndex:o}=Ha(e),r=n.length;if(r<3)return null;let i=Math.min(100,Math.max(0,t.cornerSmoothing??0))/100,s=t.edgeCurvature,a=new Array(r).fill(0);if(s?.length)for(let w=0;w<r;w+=1){let x=s[o[w]];a[w]=Number.isFinite(x)?Math.min(100,Math.max(-100,x))/100:0}let c=a.some(w=>Math.abs(w)>1e-6);if(i<=0&&!c)return null;let u=t.wideAngleThresholdDeg??ja(i),l=[];for(let w=0;w<r;w+=1)l[w]=Se(n[w],n[(w+1)%r]);let f=new Array(r).fill(0);for(let w=0;w<r;w+=1){let x=n[(w-1+r)%r],b=n[w],S=n[(w+1)%r],I={x:x.x-b.x,y:x.y-b.y},R={x:S.x-b.x,y:S.y-b.y},k=Math.hypot(I.x,I.y),L=Math.hypot(R.x,R.y);if(k<=1e-9||L<=1e-9)continue;let T=Math.min(1,Math.max(-1,(I.x*R.x+I.y*R.y)/(k*L))),v=Math.acos(T)*180/Math.PI;if(v<u)continue;let A=tr((v-u)/(180-u));f[w]=i*A*.5*Math.min(k,L)}for(let w=0;w<r;w+=1){let x=(w+1)%r,b=f[w]+f[x];if(b>l[w]&&b>1e-9){let S=l[w]/b;f[w]*=S,f[x]*=S}}let m=new Array(r),h=new Array(r);for(let w=0;w<r;w+=1){let x=n[(w-1+r)%r],b=n[w],S=n[(w+1)%r];if(f[w]<=1e-6){m[w]={...b},h[w]={...b};continue}let I=Se(b,x)||1,R=Se(b,S)||1;m[w]={x:b.x+(x.x-b.x)/I*f[w],y:b.y+(x.y-b.y)/I*f[w]},h[w]={x:b.x+(S.x-b.x)/R*f[w],y:b.y+(S.y-b.y)/R*f[w]}}if(f.every(w=>w<=1e-6)&&!c)return null;let d=[],p={...h[0]},y=p,g=(w,x)=>{if(Se(y,w)<=1e-9)return;let b=a[x];Math.abs(b)>1e-6?d.push(Xa(y,w,b*Va*l[x])):d.push({kind:"line",end:{...w}}),y=w};for(let w=1;w<=r;w+=1){let x=w%r,b=n[x];g(m[x],(w-1)%r),f[x]>1e-6&&Se(m[x],h[x])>1e-9&&(d.push({kind:"bezier",control1:Vn(m[x],b,nr),control2:Vn(h[x],b,nr),end:{...h[x]}}),y=h[x])}if(!d.length)return null;let M=d[d.length-1];Se(M.end,p)>1e-9&&(M.kind==="line"?M.end={...p}:d.push({kind:"line",end:{...p}}));let P={version:1,closed:!0,start:p,segments:d};return rr(P)?P:null}function Ka(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 Ya(e){let t=Ka(e);return t.length?sr(e.points,{edgeCurvature:t}):null}function en(e,t=2){let n=Ya(e);return n?ir(n,t):e.points??[]}function ar(e){return e.kind==="polygon"?Lt(e.holes):[]}function lr(e){let t=new Map,n=new Map;for(let o of e){if(o.type!=="row"||!o.segmentedRow)continue;let r=n.get(o.segmentedRow.groupId)??[];r.push(o),n.set(o.segmentedRow.groupId,r)}for(let[o,r]of n){let i=r.slice().sort((m,h)=>m.segmentedRow.componentIndex-h.segmentedRow.componentIndex),s=i[0]?.segmentedRow?.componentCount??0,a=i[0]?.segmentedRow;if(!a||!(s>=2&&i.length===s&&a?.boundaryBefore==="start"&&i.every((m,h)=>m.segmentedRow?.kind==="segmented-row-v1"&&m.segmentedRow.groupId===o&&m.segmentedRow.componentCount===s&&m.segmentedRow.componentIndex===h&&m.segmentedRow.repeatLabelOnComponents===a.repeatLabelOnComponents&&(h===0?m.segmentedRow.boundaryBefore==="start":m.segmentedRow.boundaryBefore!=="start")&&m.segmentedRow.displayLabel===a.displayLabel)))continue;let u=i.reduce((m,h)=>m+h.seatCount,0),l=0,f=0;for(let m of i)m.segmentedRow.boundaryBefore==="break"&&(l+=1),t.set(m.id,{groupId:o,adjacencyOffset:l,displayOffset:f,displayLabel:a.displayLabel,totalSeats:u,canonical:i[0],viewFromSeatUrl:a.viewFromSeatUrl,viewFromSeatMeta:a.viewFromSeatMeta,confidenceEvidence:a.confidenceEvidence}),l+=m.seatCount,f+=m.seatCount}return t}var Wa="ABCDEFGHIJKLMNOPQRSTUVWXYZ";var za="abcdefghijklmnopqrstuvwxyz";function Za(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 Bt(e,t=!1){let n=t?za:Wa;return Za(Math.max(0,Math.floor(e)-1),n)}var $a=[[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 ur(e){if(!Number.isFinite(e)||e<=0)return String(e);let t=Math.floor(e),n="";for(let[o,r]of $a)for(;t>=o;)n+=r,t-=o;return n}function Qa(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 Wn(e,t){let n=e.seatLabelStart??1,o=e.seatNumbering?.direction??"ltr",r=e.seatNumbering?.step??1,i=e.seatNumbering?.scheme??"decimal",s=e.seatNumbering?.prefix??"",a=e.seatNumbering?.endAt,c=e.seatCount;if(i==="updown"||i==="updown-descending"){let h=Math.ceil(c/2),d=i==="updown"?t<h?n+2*t:n-1+2*(c-t):t<h?n+2*(h-1-t):n+1+2*(t-h);return`${s}${d}`}let u=i==="odd"||i==="even"?2:r,l=a!=null&&Number.isFinite(a)?a-(c-1)*u:n,f=o==="center"?Qa(c)[t]:o==="rtl"?c-1-t:t,m;switch(i){case"odd":{let h=l%2===1?l:l+1;m=String(h+f*2);break}case"even":{let h=l%2===0?l:l+1;m=String(h+f*2);break}case"roman":m=ur(l+f*r);break;case"letters-upper":m=Bt(l+f*r,!1);break;case"letters-lower":m=Bt(l+f*r,!0);break;default:m=String(l+f*r);break}return`${s}${m}`}function qa(e){return{...e.canonical,seatCount:e.totalSeats,label:e.displayLabel,displayLabel:e.displayLabel}}function fr(e,t,n){return n?.label??`${e.seatLabelBase??e.label}-${Wn(e,t)}`}function Ja(e,t,n,o){if(o?.displayLabel)return null;if(e.seatDisplayLabelMode==="number"||!n)return{row:e.displayLabel||e.label,seat:Wn(e,t)};let r=qa(n);return{row:n.displayLabel,seat:Wn(r,n.displayOffset+t)}}function zn(e,t,n,o){let r=Ja(e,t,n,o);return r?e.seatDisplayLabelMode==="number"?r.seat:`${r.row}-${r.seat}`:o.displayLabel}function mr(e,t){return`${e.label}-${t+1}`}function ec(e,t,n){return e?.direction==="anticlockwise"?Math.max(0,t-1-n):n}function tc(e,t){let n=e.chairNumbering,o=n?.start??1,r=ec(n,Math.max(0,Math.round(e.seatCount)),t);return n?.format==="letter"?Bt(Math.max(1,o)+r):String(o+r)}function hr(e,t){let n=tc(e,t);return(e.chairNumbering?.format??"table-number")==="table-number"?`${e.displayLabel??e.label}-${n}`:n}var $=.02291666666666667,Oe=1/$,nc=58,oc=nc*$;var rc=3,dr=0,Zn=120,ic=0,sc=45,ac=7,je=1.2;function $n(e,t,n,o){return Number.isFinite(e)?Math.max(t,Math.min(n,e)):o}function cc(e){return!Number.isFinite(e)||!Number.isInteger(e)||e<0?0:e<=ac?e:rc}function Qe(e,t={}){let n=$n(t.floorBaseHeightM,dr,Zn,0),o=Math.min(Zn,n+cc(e.elevation)*oc),r=e.height===void 0?o:$n(e.height,dr,Zn,o),i=$n(e.rake,ic,sc,0);return{height:r,rake:i}}function pr(e){let t=e.length;return t<=3?[...e]:[e[Math.floor(t*.25)],e[Math.floor(t*.5)],e[Math.floor(t*.75)]]}function bt(e,t,n){if(!e.length)return 1/0;if(e.length===1)return Math.hypot(t-e[0].x,n-e[0].y);let o=1/0;for(let r=0;r+1<e.length;r++){let i=e[r],s=e[r+1],a=s.x-i.x,c=s.y-i.y,u=a*a+c*c,l=u>1e-12?((t-i.x)*a+(n-i.y)*c)/u:0;l<0?l=0:l>1&&(l=1);let f=t-(i.x+l*a),m=n-(i.y+l*c);if(Math.abs(f)>=o||Math.abs(m)>=o)continue;let h=Math.hypot(f,m);h<o&&(o=h)}return o}function lc(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 br(e,t){return Math.hypot(e.cx-t.cx,e.cy-t.cy)-e.r-t.r}function Qn(e,t){let n=1/0;for(let o of pr(e)){let r=bt(t,o.x,o.y);r<n&&(n=r)}for(let o of pr(t)){let r=bt(e,o.x,o.y);r<n&&(n=r)}return n}function uc(e,t){if(e.length<3)return{pts:e,seatIndices:t};let n=0,o=0;for(let l of e)n+=l.x,o+=l.y;n/=e.length,o/=e.length;let r=-1,i=e[0];for(let l of e){let f=Math.hypot(l.x-n,l.y-o);f>r&&(r=f,i=l)}let s=i.x-n,a=i.y-o,c=Math.hypot(s,a);c>1e-9?(s/=c,a/=c):(s=1,a=0);let u=e.map((l,f)=>({p:l,i:f,t:(l.x-n)*s+(l.y-o)*a})).sort((l,f)=>l.t-f.t);return{pts:u.map(l=>l.p),seatIndices:u.map(l=>t[l.i])}}function qn(e){let t=e.length;if(t<3)return null;let n=0,o=0;for(let M of e)n+=M.x,o+=M.y;n/=t,o/=t;let r=0,i=0,s=0,a=0,c=0,u=0,l=0;for(let M of e){let P=M.x-n,w=M.y-o;r+=P*P,s+=w*w,i+=P*w,a+=P*P*P,c+=w*w*w,u+=P*w*w,l+=w*P*P}let f=r*s-i*i;if(Math.abs(f)<1e-9)return null;let m=(a+u)/2,h=(c+l)/2,d=(m*s-h*i)/f,p=(h*r-m*i)/f,y=d+n,g=p+o;return!Number.isFinite(y)||!Number.isFinite(g)?null:{cx:y,cy:g}}var fc=.15,mc=.001;function hc(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 dc(e){if(e.length<2)return null;let t=e.map(x=>{let b=0,S=0;for(let I of x.pts)b+=I.x,S+=I.y;return{x:b/x.pts.length,y:S/x.pts.length}}),n=0,o=0;for(let x of t)n+=x.x,o+=x.y;n/=t.length,o/=t.length;let r=0,i=0,s=0;for(let x of t){let b=x.x-n,S=x.y-o;r+=b*b,i+=b*S,s+=S*S}let a=r+s,c=r*s-i*i,u=a/2+Math.sqrt(Math.max(0,a*a/4-c)),l,f;Math.abs(i)>1e-12?(l=u-s,f=i):r>=s?(l=1,f=0):(l=0,f=1);let m=Math.hypot(l,f);if(!(m>1e-12))return null;l/=m,f/=m;let h=0,d=0,p=0;for(let x of e){if(x.pts.length<2)continue;let b=x.pts[0],S=x.pts[x.pts.length-1],I=S.x-b.x,R=S.y-b.y,k=Math.hypot(I,R);if(!(k>1e-9))continue;let L=I/k,T=R/k;h+=(L*L-T*T)*k,d+=2*L*T*k,p+=k}if(p>0&&Math.hypot(h,d)>=bc*p){let x=Math.atan2(d,h)/2;l=-Math.sin(x),f=Math.cos(x)}let y=1/0,g=-1/0,M=[];for(let x of e){let b=1/0,S=-1/0;for(let I of x.pts){let R=I.x*l+I.y*f;R<b&&(b=R),R>S&&(S=R),R<y&&(y=R),R>g&&(g=R)}M.push(S-b)}let P=g-y;return P>1e-9?(M.sort((x,b)=>x-b),M[Math.min(M.length-1,Math.floor(M.length*.9))]/P<=pc?{x:l,y:f}:null):null}var pc=.35,bc=.8;function tn(e,t,n,o){let r=new Map;for(let b of n){let S=t[b],I=S.rowId||`__seat-${b}`,R=r.get(I);R||(R={pts:[],idx:[]},r.set(I,R)),R.pts.push({x:S.x,y:S.y}),R.idx.push(b)}if(!r.size)return{sectionId:e,rows:[],blockCount:0};let i=[];for(let[b,S]of r){let I=uc(S.pts,S.idx),R=0;for(let k of I.pts)R+=Math.hypot(k.x-o.x,k.y-o.y);i.push({id:b,pts:I.pts,seatIndices:I.seatIndices,blockId:-1,ordinal:0,blockDepth:0,focalDistance:R/I.pts.length})}let s=i.map(b=>lc(b.pts)),a=i.length<=256?i.length*(i.length-1)/2:0,c=a?new Float64Array(a):null;c?.fill(Number.NaN);let u=c?new Map(i.map((b,S)=>[b,S])):null,l=(b,S)=>(b>S&&([b,S]=[S,b]),b*(2*i.length-b-1)/2+(S-b-1)),f=(b,S)=>{if(!c)return Qn(i[b].pts,i[S].pts);let I=l(b,S),R=c[I];if(!Number.isNaN(R))return R;let k=Qn(i[b].pts,i[S].pts);return c[I]=k,k},m=(b,S)=>u?f(u.get(b),u.get(S)):Qn(b.pts,S.pts),h=[];for(let b=0;b<i.length;b++){let S=1/0;for(let I=0;I<i.length;I++){if(b===I||br(s[b],s[I])>=S)continue;let R=f(b,I);R<S&&(S=R)}Number.isFinite(S)&&h.push(S)}h.sort((b,S)=>b-S);let d=h.length?h[Math.floor(h.length/2)]:1,p=Math.max(d*1.8,1e-6),y=i.map(()=>[]);for(let b=0;b<i.length;b++)for(let S=b+1;S<i.length;S++)br(s[b],s[S])>p||f(b,S)<=p&&(y[b].push(S),y[S].push(b));let g=0;for(let b=0;b<i.length;b++){if(i[b].blockId!==-1)continue;let S=g++,I=[b];for(i[b].blockId=S;I.length;){let R=I.pop();for(let k of y[R])i[k].blockId===-1&&(i[k].blockId=S,I.push(k))}}let M=new Map;for(let b of i){let S=M.get(b.blockId)??[];S.push(b),M.set(b.blockId,S)}let P=[];for(let b of i){if(b.pts.length<4||hc(b.pts)<mc)continue;let S=qn(b.pts);S&&(!Number.isFinite(S.cx)||!Number.isFinite(S.cy)||P.push({x:S.cx,y:S.cy}))}let w=P.length>=2?(()=>{let b=P.map(R=>R.x).sort((R,k)=>R-k),S=P.map(R=>R.y).sort((R,k)=>R-k),I=Math.floor(P.length/2);return{cx:b[I],cy:S[I]}})():null;if(w){let b=T=>Math.hypot(T.x-w.cx,T.y-w.cy),S=1/0,I=-1/0,R=[];for(let T of i){let v=1/0,A=-1/0;for(let _ of T.pts){let C=b(_);C<v&&(v=C),C>A&&(A=C)}R.push(A-v),v<S&&(S=v),A>I&&(I=A)}let k=I-S;R.sort((T,v)=>T-v);let L=R[Math.min(R.length-1,Math.floor(R.length*.9))];if(k>1e-9&&L/k<=fc){let T=i.map(N=>{let X=0;for(let V of N.pts)X+=b(V);return{row:N,radius:X/N.pts.length}}),v=0,A=0;for(let N of T)v+=N.radius,A+=N.row.focalDistance;v/=T.length,A/=T.length;let _=0;for(let N of T)_+=(N.radius-v)*(N.row.focalDistance-A);if(_<0)for(let N of T)N.radius=-N.radius;let B=1/0;for(let N of T)N.radius<B&&(B=N.radius);T.sort((N,X)=>N.radius-X.radius);let O=-1,F=-1/0,D=k/Math.max(1,T.length)*.5,j=[];for(let N of T)N.radius-F>D&&(O++,F=N.radius),N.row.ordinal=O,N.row.blockDepth=N.radius-B,j.push(N.row);return{sectionId:e,rows:j,blockCount:g}}}let x=[];for(let[,b]of M){let S=dc(b);if(S){let I=T=>{let v=0;for(let A of T.pts)v+=A.x*S.x+A.y*S.y;return v/T.pts.length};b.sort((T,v)=>I(T)-I(v)),b.length>=2&&b[0].focalDistance>b[b.length-1].focalDistance&&b.reverse();let R=[],k=d*.5;for(let T of b){let v=R[R.length-1];v&&Math.abs(I(T)-I(v[0]))<k?v.push(T):R.push([T])}let L=0;for(let T=0;T<R.length;T++){if(T>0){let v=1/0;for(let A of R[T-1])for(let _ of R[T])v=Math.min(v,m(A,_));v=Math.min(v,Math.abs(I(R[T][0])-I(R[T-1][0]))),L+=v}for(let v of R[T])v.ordinal=T,v.blockDepth=L,x.push(v)}}else{let I=1/0;for(let R of b)R.focalDistance<I&&(I=R.focalDistance);b.sort((R,k)=>R.focalDistance-k.focalDistance);for(let R=0;R<b.length;R++)b[R].ordinal=R,b[R].blockDepth=Math.max(0,b[R].focalDistance-I),x.push(b[R])}}return{sectionId:e,rows:x,blockCount:g}}var yc=/^\d{4}-\d{2}-\d{2}$/;function gc(e){let t=Date.parse(e);return Number.isFinite(t)?yc.test(e)?t+864e5:t:null}function xc(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=gc(e.validUntil);return n===null?!1:(t instanceof Date?t.getTime():t)<n}function Mc(e,t,n){return!(e.eventConfigurationId&&e.eventConfigurationId!==t||e.eventConfigurationVersion!==void 0&&e.eventConfigurationVersion!==n)}function Sc(e){return e.status!=="draft"&&e.status!=="retracted"}function Pc(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 yr(e,t={}){return!!e&&Sc(e)&&Mc(e,t.activeConfigurationId,t.activeConfigurationVersion)&&Pc(e,t.activeBasisSha256)&&xc(e,t.now)}var Ic=new Set(["pitch-football","rink-hockey","track-athletics","oval-cricket","pitch-rugby","diamond-baseball","court-basketball","court-tennis","ring-boxing"]),Rc=new Set(["pitch-football","track-athletics","oval-cricket","pitch-rugby","diamond-baseball"]);function st(e){return!!e&&Ic.has(e)}function nn(e){return!!e&&Rc.has(e)}var Jn=1.1;function Mr(e){return rn(e)?e==="ring-boxing"?Jn:.06:1}var wc={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}},Ec={"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 Ac=Math.PI*2;function _c(e,t,n,o,r,i){return{x:r+e*n-t*o,y:i+e*o+t*n}}function gr(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 xr=(()=>{let t={x:0,y:52},n=25,o={x:70,y:t.y-70},r=(o.x*o.x+o.y*o.y-4900)/(2*(o.y+70)),i=r+70,s=[],a=Math.atan2(o.y-r,o.x),c=Math.atan2(o.y-r,-o.x);for(let u=0;u<=24;u++){let l=a+(c-a)*u/24;s.push({x:i*Math.cos(l),y:r+i*Math.sin(l)})}return{half:70,home:t,backstop:n,fence:s}})();var on="#f1f5f9";function rn(e){return st(e)}function qe(e,t,n,o,r=32){let i=[];for(let s=0;s<r;s++){let a=s/r*Ac;i.push({x:e+n*Math.cos(a),y:t+o*Math.sin(a)})}return i}function Ke(e,t,n,o){return[{x:e-n,y:t-o},{x:e+n,y:t-o},{x:e+n,y:t+o},{x:e-n,y:t+o}]}function vc(e){let{kind:t,cx:n,cy:o,width:r,height:i}=e,s=(e.rotation??0)*Math.PI/180,a=Math.cos(s),c=Math.sin(s),u=r/2,l=i/2,f=[],m=wc[t],h=p=>m?p/m.width*r:0,d=p=>m?p/m.height*i:0;switch(t){case"pitch-football":{f.push({points:[{x:0,y:-l},{x:0,y:l}],closed:!1}),f.push({points:qe(0,0,h(9.15),d(9.15)),closed:!0});for(let p of[-1,1])f.push({points:Ke(p*(u-h(16.5)/2),0,h(16.5)/2,d(40.32)/2),closed:!0}),f.push({points:Ke(p*(u-h(5.5)/2),0,h(5.5)/2,d(18.32)/2),closed:!0});break}case"rink-hockey":{f.push({points:[{x:0,y:-l},{x:0,y:l}],closed:!1,ink:"#d63b3b"});for(let p of[-1,1]){f.push({points:[{x:p*h(7.5),y:-l},{x:p*h(7.5),y:l}],closed:!1,ink:"#2f6ecb"}),f.push({points:[{x:p*(u-h(4)),y:-d(11)},{x:p*(u-h(4)),y:d(11)}],closed:!1,ink:"#d63b3b"});for(let y of[-1,1])f.push({points:qe(p*h(20.5),y*d(7),h(4.5),d(4.5)),closed:!0,ink:"#2f6ecb"})}f.push({points:qe(0,0,h(4.5),d(4.5)),closed:!0,ink:"#2f6ecb"});break}case"track-athletics":{let y=l-d(1.22)*8;y>0&&f.push({points:gr(u-h(1.22)*8,y),closed:!0,fill:"#2f7d4f"});for(let g=1;g<8;g++){let M=d(1.22)*g,P=l-M;if(P<=0)break;f.push({points:gr(u-h(1.22)*g,P),closed:!0})}break}case"oval-cricket":{f.push({points:qe(0,0,h(27.4),d(27.4+20.12/2),40),closed:!0}),f.push({points:Ke(0,0,h(3.05)/2,d(20.12)/2),closed:!0,ink:"#d8cfae"});break}case"pitch-rugby":{let p=y=>({points:[{x:h(y),y:-l},{x:h(y),y:l}],closed:!1});f.push(p(0));for(let y of[-1,1]){f.push(p(y*50),p(y*28));for(let g=-35;g<35;g+=4)f.push({points:[{x:h(y*10),y:d(g)},{x:h(y*10),y:d(Math.min(35,g+2))}],closed:!1})}break}case"diamond-baseball":{let p=(C,B)=>({x:h(C),y:d(B)}),{home:y}=xr,g=27.43,M=g/Math.SQRT2,P={x:y.x+M,y:y.y-M},w={x:y.x,y:y.y-2*M},x={x:y.x-M,y:y.y-M},b={x:y.x,y:y.y-18.44},S="#b98a59",I=Ec["diamond-baseball"],R=38.94,k=[p(y.x,y.y)],L=Math.atan2(y.y-R/Math.SQRT2-b.y,R/Math.SQRT2),T=Math.PI-L;for(let C=0;C<=16;C++){let B=L-(L+Math.PI*2-T)%(Math.PI*2)*(C/16);k.push(p(b.x+29*Math.cos(B),b.y+29*Math.sin(B)))}f.push({points:k,closed:!0,fill:S,ink:S});let v={x:y.x,y:y.y-M},A=[{x:y.x,y:y.y},P,w,x].map(C=>p(v.x+(C.x-v.x)*.84,v.y+(C.y-v.y)*.84));f.push({points:A,closed:!0,fill:I,ink:I}),f.push({points:qe(h(b.x),d(b.y),h(2.74),d(2.74),20),closed:!0,fill:S,ink:S}),f.push({points:qe(h(y.x),d(y.y),h(3.96),d(3.96),20),closed:!0,fill:S,ink:S});let _=xr.fence;f.push({points:[p(y.x,y.y),p(_[0].x,_[0].y)],closed:!1}),f.push({points:[p(y.x,y.y),p(_[_.length-1].x,_[_.length-1].y)],closed:!1});for(let C of[P,w,x])f.push({points:Ke(h(C.x),d(C.y),h(.3),d(.3)),closed:!0,fill:on});break}case"court-basketball":{f.push({points:Ke(0,0,h(14),d(7.5)),closed:!0}),f.push({points:[{x:0,y:-d(7.5)},{x:0,y:d(7.5)}],closed:!1}),f.push({points:qe(0,0,h(1.8),d(1.8),24),closed:!0});for(let p of[-1,1]){let y=p*14,g=p*(14-5.8),M=p*(14-1.575);f.push({points:Ke(h((y+g)/2),0,h(2.9),d(2.45)),closed:!0,fill:"#2f5d8a"}),f.push({points:qe(h(g),0,h(1.8),d(1.8),24),closed:!0});let P=Math.sqrt(6.75*6.75-6.6*6.6),w=[{x:h(y),y:-d(6.6)}],x=Math.atan2(-6.6,-p*P),b=2*Math.atan2(6.6,P);for(let S=0;S<=16;S++){let I=x-p*b*(S/16);w.push({x:h(M+6.75*Math.cos(I)),y:d(6.75*Math.sin(I))})}w.push({x:h(y),y:d(6.6)}),f.push({points:w,closed:!1})}break}case"court-tennis":{f.push({points:Ke(0,0,h(11.885),d(5.485)),closed:!0,fill:"#2b5f99"});for(let p of[-1,1])f.push({points:[{x:-h(11.885),y:p*d(4.115)},{x:h(11.885),y:p*d(4.115)}],closed:!1}),f.push({points:[{x:p*h(6.4),y:-d(4.115)},{x:p*h(6.4),y:d(4.115)}],closed:!1});f.push({points:[{x:-h(6.4),y:0},{x:h(6.4),y:0}],closed:!1}),f.push({points:[{x:0,y:-d(6.4)},{x:0,y:d(6.4)}],closed:!1,ink:"#d1d5db"});break}case"ring-boxing":{f.push({points:Ke(0,0,h(3.05),d(3.05)),closed:!0});let g=[[-1,-1,"#c53030"],[1,1,"#2b6cb0"],[1,-1,"#e2e8f0"],[-1,1,"#e2e8f0"]];for(let[M,P,w]of g)f.push({points:Ke(M*h(3.05),P*d(3.05),h(.3),d(.3)),closed:!0,fill:w,ink:w});break}default:return[]}return f.map(p=>({...p,points:p.points.map(y=>_c(y.x,y.y,a,c,n,o))}))}function Sr(e){if(e.role!=="stage"||!rn(e.stageKind))return[];let t=null;if(e.x!=null&&e.y!=null&&e.width!=null&&e.height!=null&&e.width>0&&e.height>0&&[e.x,e.y,e.width,e.height].every(Number.isFinite))t={cx:e.x+e.width/2,cy:e.y+e.height/2,width:e.width,height:e.height};else if(e.points&&e.points.length>=3&&e.points.every(n=>Number.isFinite(n.x)&&Number.isFinite(n.y))){let n=e.points.map(l=>l.x),o=e.points.map(l=>l.y),r=Math.min(...n),i=Math.max(...n),s=Math.min(...o),a=Math.max(...o),c=Math.max(1,i-r),u=Math.max(1,a-s);t={cx:r+c/2,cy:s+u/2,width:c,height:u}}return t?vc({kind:e.stageKind,...t}):[]}var Cc=/^data:image\/(?:png|jpe?g|webp|gif|avif);base64,[a-z0-9+/]+={0,2}$/i,kc=/[\s"'<>`\\]/;function Oc(e){if(typeof e!="string"||!e||e.length>2e6||e!==e.trim())return!1;if(e.startsWith("data:"))return Cc.test(e);if(kc.test(e))return!1;try{let t=new URL(e);return t.protocol==="https:"&&!t.username&&!t.password}catch{return!1}}function Pr(e){let t=e.trim();return Oc(t)?t:null}var eo="seatlayer.event-configuration/1";var yt=100,Tc=120,Lc=2e5,Bc=1e4,Fc=/^[a-f0-9]{64}$/,Nc=new Set(["stage","screen","barrier","camera_platform","sound_desk","rigging_truss"]);function Ft(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function at(e,t){return typeof e=="string"&&e.length>=1&&e.length<=t&&e.normalize("NFKC").trim()===e}function Dc(e){return typeof e=="number"&&Number.isInteger(e)&&e>0}function Ir(e){return!Array.isArray(e)||e.length>Lc||!e.every(t=>at(t,yt))?null:[...new Set(e)].sort()}function Gc(e){return!Ft(e)||!at(e.chartId,yt)||!at(e.version,yt)||e.sha256!==void 0&&(typeof e.sha256!="string"||!Fc.test(e.sha256))?null:{chartId:e.chartId,version:e.version,...typeof e.sha256=="string"?{sha256:e.sha256}:{}}}function to(e,t,n){return typeof e=="number"&&Number.isFinite(e)&&e>=t&&e<=n}function jc(e){return Ft(e)?e.mode==="none"||e.mode==="opaque"?e.opacity===void 0?{mode:e.mode}:null:e.mode==="partial"&&to(e.opacity,.01,.99)?{mode:"partial",opacity:e.opacity}:null:null}function Hc(e,t){if(e===void 0)return;if(!Array.isArray(e)||e.length>Bc)return null;let n=new Set(t),o=new Set,r=new Set,i=0,s=[];for(let a of e){if(!Ft(a)||!at(a.id,yt)||!at(a.objectId,yt)||!n.has(a.objectId)||!Nc.has(String(a.kind))||!to(a.heightM,.05,50)||a.baseElevationM!==void 0&&!to(a.baseElevationM,-10,100))return null;let c=jc(a.occlusion);if(!c||o.has(a.id)||r.has(a.objectId))return null;let u=a.contentImageUrl===void 0?void 0:typeof a.contentImageUrl=="string"?Pr(a.contentImageUrl):null;if(a.contentImageUrl!==void 0&&(!u||a.kind!=="screen"||++i>1))return null;o.add(a.id),r.add(a.objectId),s.push({id:a.id,objectId:a.objectId,kind:a.kind,heightM:a.heightM,...a.baseElevationM!==void 0?{baseElevationM:a.baseElevationM}:{},occlusion:c,...u?{contentImageUrl:u}:{}})}return s.sort((a,c)=>a.id.localeCompare(c.id))}function Vc(e){let t=[];if(!Ft(e))return{issues:[{code:"invalid_export",path:"configuration",message:"Configuration must be an object"}]};e.schema!==eo&&t.push({code:"unsupported_schema",path:"configuration.schema",message:`Configuration schema must be ${eo}`}),at(e.id,yt)||t.push({code:"invalid_id",path:"configuration.id",message:"Configuration id must contain 1 to 100 normalized characters"}),at(e.label,Tc)||t.push({code:"invalid_label",path:"configuration.label",message:"Configuration label must contain 1 to 120 normalized characters"}),Dc(e.version)||t.push({code:"invalid_version",path:"configuration.version",message:"Configuration version must be a positive integer"});let n=Gc(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=Ft(e.overlay)?e.overlay:null,r=Ir(o?.objectIds),i=Ir(o?.productionKillSeatIds),s=r?Hc(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:eo,id:e.id,label:e.label,version:e.version,baseVenue:n,overlay:{objectIds:r,productionKillSeatIds:i,...s!==void 0?{productionElements:s}:{}}}}}function Rr(e){let t=Vc(e);return t.value?{ok:!0,value:t.value}:{ok:!1,issues:t.issues}}function Uc(e){if((e.kind==="polygon"||e.kind==="polyline"||e.kind==="line")&&e.points&&e.points.length>=2)return e.kind==="polygon"?en(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 Xc(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 wr(e){let t=Uc(e);if(!t||t.length<2)return null;let n=e.rotation??0,o=Math.abs(n)<1e-6?t:t.map(c=>Xc(c,{x:t.reduce((u,l)=>u+l.x,0)/t.length,y:t.reduce((u,l)=>u+l.y,0)/t.length},n)),r=1/0,i=1/0,s=-1/0,a=-1/0;for(let c of o)r=Math.min(r,c.x),i=Math.min(i,c.y),s=Math.max(s,c.x),a=Math.max(a,c.y);return!Number.isFinite(r)||s-r<1e-6||a-i<1e-6?null:{minX:r,minY:i,maxX:s,maxY:a}}var Kc=5,Yc=3,Wc=.92,zc=1.9,Zc=2,$c=.6,Qc=1,qc=.06;function Jc(e){return e.heightM!==void 0?e.heightM:e.stageKind==="ring-boxing"?Jn:rn(e.stageKind)?qc:Qc}function Er(e){let t=1/0,n=1/0,o=-1/0,r=-1/0,i=-1/0;for(let s of vr(e)){let a=s.baseHeightM??0;for(let c of s.objects){if(c.type!=="shape"||c.role!=="stage")continue;let u=wr(c);u&&(t=Math.min(t,u.minX),n=Math.min(n,u.minY),o=Math.max(o,u.maxX),r=Math.max(r,u.maxY),i=Math.max(i,a+Jc(c)))}}return!Number.isFinite(t)||!Number.isFinite(i)?null:{minX:t,minY:n,maxX:o,maxY:r,deckTopM:i}}function el(e,t,n,o){let r=1/0,i=1/0,s=-1/0,a=-1/0;for(let h of e)Number.isFinite(h.eyeHeightM)&&(r=Math.min(r,h.x),s=Math.max(s,h.x),i=Math.min(i,h.y),a=Math.max(a,h.y));if(!Number.isFinite(r))return null;let c=r*t,u=i*t,l=Math.max(1,Math.ceil((s-r)*t/n)+1),f=Math.max(1,Math.ceil((a-i)*t/n)+1),m=new Float64Array(l*f).fill(-1/0);for(let h of e){if(!Number.isFinite(h.eyeHeightM))continue;let d=h.eyeHeightM-je,p=Math.min(l-1,Math.max(0,Math.floor((h.x*t-c)/n))),g=Math.min(f-1,Math.max(0,Math.floor((h.y*t-u)/n)))*l+p,M=d+o;M>m[g]&&(m[g]=M)}return{cellM:n,minX:c,minY:u,cols:l,rows:f,top:m}}function tl(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 Ar(e,t,n={}){let o=new Map;if(!t||!e.length)return o;let r=n.metresPerChartUnit??$,i=n.cellM??$c,s=n.chairBackM??Wc,a=n.selfRowSkipM??Zc,c=n.clearThreshold??.9,u=n.partialThreshold??.25,l=Math.max(1,n.columns??Kc),f=Math.max(1,n.rows??Yc),m=el(e,r,i,s);if(!m)return o;let h=(t.maxX-t.minX)*r,d=(t.maxY-t.minY)*r,p=h>=d,y=(t.minX+t.maxX)/2*r,g=(t.minY+t.maxY)/2*r,M=[];for(let w=0;w<l;w++){let x=(w+.5)/l-.5,b=p?y+x*h:y,S=p?g:g+x*d;for(let I=0;I<f;I++){let R=t.deckTopM+(f===1?0:I/(f-1)*zc);M.push({x:b,y:S,z:R})}}let P=i/2;for(let w of e){if(!Number.isFinite(w.eyeHeightM))continue;let x=w.x*r,b=w.y*r,S=w.eyeHeightM,I=0,R=1/0;for(let L of M){let T=L.x-x,v=L.y-b,A=Math.hypot(T,v);if(!(A>a)){I++;continue}let _=T/A,C=v/A,B=0;for(let O=a;O<A;O+=P){let F=tl(m,x+_*O,b+C*O);if(!(!Number.isFinite(F)||F>=S)&&F>S+(L.z-S)*O/A){B=O;break}}B?R=Math.min(R,B):I++}let k=I/M.length;k>=c||o.set(w.id,{seatId:w.id,mark:k<u?"obstructedView":"restrictedView",visibleFraction:k,totalRays:M.length,atDistanceM:Number.isFinite(R)?R:0})}return o}function _r(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 no(e){return e?e.accessibility?.length?e.wheelchairSpaceType&&!e.accessibility.includes("wheelchair")?["wheelchair",...e.accessibility]:e.accessibility:e.wheelchairSpaceType?["wheelchair"]:e.accessible?["wheelchair"]:[]:[]}var an=Math.PI/180;var Nt=16;function oo(e,t,n,o){let r=n*an,i=Math.cos(r),s=Math.sin(r);return{x:o.x+e*i-t*s,y:o.y+e*s+t*i}}function ro(e){let{seatCount:t,seatSpacing:n,curve:o,rotation:r,origin:i}=e,s=[];if(e.path)return er(e.path,t);if(t<=1)return t===1&&s.push({x:i.x,y:i.y}),s;if(o===0){for(let u=0;u<t;u++)s.push(oo(u*n,0,r,i));return s}let a=o/(t-1)*an,c=n/(2*Math.sin(Math.abs(a)/2));for(let u=0;u<t;u++){let l=u*a,f=c*Math.sin(l),m=-c+c*Math.cos(l);s.push(oo(f,m,r,i))}return s}function io(e){let t=new Map;if(e.overrides)for(let n of e.overrides)t.set(n.index,n);return t}function nl(e,t){let n=io(e);return ro(e).map((o,r)=>{let i=n.get(r),s=no(i),a=fr(e,r,i),c={...e.commercial,...i?.commercial};return{index:r,x:o.x+(i?.dx??0),y:o.y+(i?.dy??0),label:a,displayLabel:zn(e,r,t,i),categoryKey:i?.categoryKey??e.categoryKey,skipped:!!i?.skip,accessible:s.length>0,accessibility:s,wheelchairSpaceType:i?.wheelchairSpaceType,commercial:Object.values(c).some(u=>u!==void 0&&u!==!1&&u!=="")?c:void 0,glyph:i?.glyph,viewUrl:i?.viewFromSeatUrl??e.viewFromSeatUrl,viewMeta:i?.viewFromSeatUrl?i.viewFromSeatMeta:e.viewFromSeatMeta,labelStyle:i?.labelStyle??e.seatLabelStyle}})}function ol(e){let t=[];for(let n of nl(e))n.skipped||t.push({id:`${e.id}:${n.index}`,label:n.label,displayLabel:n.displayLabel===n.label?void 0:n.displayLabel,x:n.x,y:n.y,rowId:e.id,categoryKey:n.categoryKey,accessible:n.accessible||void 0,accessibility:n.accessibility.length?n.accessibility:void 0,wheelchairSpaceType:n.wheelchairSpaceType,commercial:n.commercial,glyph:n.glyph,viewUrl:n.viewUrl,viewMeta:n.viewMeta,labelStyle:n.labelStyle});return t}function rl(e){if(e.seatCountsBySide)return{...e.seatCountsBySide};let t=e.sides&&e.sides.length?e.sides:["top","bottom"],n=["top","bottom","left","right"].filter(i=>t.includes(i)),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 il(e){let t=[],n=Math.max(0,Math.round(e.seatCount));if(n===0)return t;let o=new Map((e.overrides??[]).map(l=>[l.index,l])),r=(l,f,m,h)=>{let d=o.get(l),p=no(d),y=d?.label??mr(e,l);return{index:l,label:y,displayLabel:d?.displayLabel??hr(e,l),x:f+(d?.dx??0),y:m+(d?.dy??0),categoryKey:d?.categoryKey??e.categoryKey,skipped:!!d?.skip,accessible:p.length>0,accessibility:p,wheelchairSpaceType:d?.wheelchairSpaceType,commercial:d?.commercial,glyph:d?.glyph,viewUrl:d?.viewFromSeatUrl,viewMeta:d?.viewFromSeatUrl?d.viewFromSeatMeta:void 0,labelStyle:d?.labelStyle,...h?{side:h}:{}}};if(e.shape==="round"){let l=(e.radius??40)+Nt,f=e.rotation*an,m=Math.max(0,Math.min(360,e.seatArc??360));if(m>=360||n===1){for(let y=0;y<n;y++){let g=f+y/n*2*Math.PI;t.push(r(y,e.center.x+l*Math.cos(g),e.center.y+l*Math.sin(g)))}return t}let h=m*an,d=(2*Math.PI-h)/2,p=f+d;for(let y=0;y<n;y++){let g=p+y/(n-1)*h;t.push(r(y,e.center.x+l*Math.cos(g),e.center.y+l*Math.sin(g)))}return t}let i=e.width??80,s=e.height??50,a=rl(e),c=["top","bottom","left","right"],u=0;for(let l of c){let f=a[l];for(let m=0;m<f;m++){let h,d;l==="top"?(h=-i/2+(m+.5)*i/f,d=-s/2-Nt):l==="bottom"?(h=-i/2+(m+.5)*i/f,d=s/2+Nt):l==="left"?(h=-i/2-Nt,d=-s/2+(m+.5)*s/f):(h=i/2+Nt,d=-s/2+(m+.5)*s/f);let p=oo(h,d,e.rotation,e.center);t.push(r(u++,p.x,p.y,l))}}return t}function sl(e){return il(e).filter(t=>!t.skipped).map(t=>({id:`${e.id}:${t.index}`,label:t.label,...t.displayLabel!==t.label?{displayLabel:t.displayLabel}:{},x:t.x,y:t.y,rowId:e.id,categoryKey:t.categoryKey,...t.accessible?{accessible:!0}:{},...t.accessibility.length?{accessibility:t.accessibility}:{},...t.wheelchairSpaceType?{wheelchairSpaceType:t.wheelchairSpaceType}:{},...t.commercial?{commercial:t.commercial}:{},...t.glyph?{glyph:t.glyph}:{},...t.viewUrl?{viewUrl:t.viewUrl}:{},...t.viewUrl&&t.viewMeta?{viewMeta:t.viewMeta}:{},...t.labelStyle?{labelStyle:t.labelStyle}:{}}))}function al(e){return[{id:`${e.id}:0`,label:e.label,...e.displayLabel&&e.displayLabel!==e.label?{displayLabel:e.displayLabel}:{},x:e.center.x,y:e.center.y,rowId:e.id,categoryKey:e.categoryKey,kind:"booth",...e.commercial?.note?{commercial:{note:e.commercial.note}}:{}}]}function Yn(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 cr(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 Lt(e){return Array.isArray(e)?e.filter(t=>Array.isArray(t)&&t.length>=3):[]}function Pe(e,t,n){return Yn(e,t)&&!Lt(n).some(o=>Yn(e,o)||cr(e,o))}function sn(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 Tr(e){switch(e.type){case"row":{let t=ro(e),n=io(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 sn(e.points);case"section":return sn(e.outline);case"text":return{x:e.position.x,y:e.position.y};case"shape":return e.points&&e.points.length?sn(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 Cr(e,t){return e.length===t.length&&e.every((n,o)=>n.x===t[o].x&&n.y===t[o].y)}function cl(e,t){if(e.type!=="gaArea"||!Cr(e.points,t.outline))return!1;let n=Lt(e.holes),o=Lt(t.holes);return n.length===o.length&&n.every((r,i)=>Cr(r,o[i]))}function ll(e,t,n=e.filter(r=>r.type==="section"),o=Tr(t)){let r="referenceInventorySource"in t?t.referenceInventorySource?.logicalSectionId:void 0;return(r?n.find(s=>(s.logicalSectionId??s.id)===r&&(cl(t,s)||Pe(o,s.outline,s.holes))):void 0)??n.find(s=>Pe(o,s.outline,s.holes))??(t.type==="row"&&ul(t)?fl(t,n):void 0)}function ul(e){return(e.overrides??[]).some(t=>t.skip===!0)}function fl(e,t){let n=ro(e),o=io(e),r,i=0;for(let s of t){let a=0;for(let c=0;c<n.length;c++){let u=o.get(c);if(u?.skip)continue;let l={x:n[c].x+(u?.dx??0),y:n[c].y+(u?.dy??0)};Pe(l,s.outline,s.holes)&&a++}a>i&&(r=s,i=a)}return r}function vr(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 kr(e,t,n,o,r,i,s,a,c){let u=[],l=e.filter(p=>p.type==="section"),f=lr(e),m=p=>!p?.eventConfigurationId||p.eventConfigurationId===o&&(p.eventConfigurationVersion===void 0||p.eventConfigurationVersion===c),h=p=>yr(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=ol(p):p.type==="table"?y=sl(p):p.type==="booth"&&(y=al(p)),!y.length)continue;for(let x of y)x.viewUrl&&!m(x.viewMeta)&&(x.viewUrl=void 0,x.viewMeta=void 0);if(p.type==="row"){let x=f.get(p.id);if(x){let b=new Map((p.overrides??[]).map(S=>[S.index,S]));for(let S of y){let I=Number(S.id.slice(S.id.lastIndexOf(":")+1));if(!Number.isInteger(I))continue;S.logicalRowId=x.groupId,S.logicalSeatIndex=x.adjacencyOffset+I,b.get(I)?.displayLabel||(S.displayLabel=zn(p,I,x)),!S.viewUrl&&x.viewFromSeatUrl&&m(x.viewFromSeatMeta)&&(S.viewUrl=x.viewFromSeatUrl,S.viewMeta=x.viewFromSeatMeta);let R=b.get(I)?.confidenceEvidence;S.confidenceEvidence=d(R,"exact-seat")??d(p.confidenceEvidence,"row-representative")??d(x.confidenceEvidence,"row-representative")}}}let g=ll(e,p,l,p.type==="row"?sn(y):Tr(p)),M=g?.viewFromSeatUrl,w=(g?.zone?t?.find(x=>x.id===g.zone):void 0)?.focalPoint??n;for(let x of y){if(!x.confidenceEvidence){let b=Number(x.id.slice(x.id.lastIndexOf(":")+1)),S=(p.type==="row"||p.type==="table")&&Number.isInteger(b)?p.overrides?.find(I=>I.index===b)?.confidenceEvidence:void 0;x.confidenceEvidence=d(S,"exact-seat")??(p.type==="row"?d(p.confidenceEvidence,"row-representative"):void 0)}x.confidenceEvidence??=d(g?.confidenceEvidence,"section-representative")??(s?d(s.evidence,s.coverage):void 0),!x.viewUrl&&M&&m(g?.viewFromSeatMeta)&&(x.viewUrl=M,x.viewMeta=g?.viewFromSeatMeta),!x.viewUrl&&i&&m(i.meta)&&(x.viewUrl=i.url,x.viewMeta=i.meta),g&&(x.sectionId=g.logicalSectionId??g.id),g?.zone&&(x.zoneId=g.zone),w&&(x.focalPoint={...w})}u.push(...y)}return u}function gt(e,t={}){if(e.floors?.length){let o=[];for(let r of e.floors){let i=r.focalPoint??e.focalPoint,s=r.viewFromSeatUrl?{url:r.viewFromSeatUrl,meta:r.viewFromSeatMeta}:e.viewFromSeatUrl?{url:e.viewFromSeatUrl,meta:e.viewFromSeatMeta}:void 0,a=r.confidenceEvidence?{evidence:r.confidenceEvidence,coverage:"floor-representative"}:e.confidenceEvidence?{evidence:e.confidenceEvidence,coverage:"venue-representative"}:void 0,c=kr(r.objects,e.zones,i,e.eventConfigurationId,e.confidenceBasisSha256,s,a,t.now,t.eventConfigurationVersion??e.eventConfigurationVersion);t.resolveEyeHeights!==!1&&Or(r.objects,r.focalPoint??e.focalPoint,r.baseHeightM??0,c);for(let u of c)u.floorId=r.id;for(let u of c)o.push(u)}return o}let n=kr(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&&Or(e.objects,e.focalPoint,t.floorBaseHeightM??0,n),ml(e,n,t)}function ml(e,t,n){return!n.deriveRestrictedView||e.derivedRestrictedView===!1||n.resolveEyeHeights===!1||_r(t,Ar(t,Er(e))),t}function Or(e,t,n,o){let r=e.filter(f=>f.type==="section"),i=n>0||r.some(f=>f.height!==void 0||f.rake!==void 0||(f.elevation??0)>0);if(!r.length||!i||!t){for(let f of o)f.eyeHeightM=n+je;return}let s=new Array(o.length),a=new Map;for(let f of r)a.has(f.id)||a.set(f.id,f);let c=new Map,u=new Map;for(let f=0;f<o.length;f++){let m=o[f],d=(m.sectionId?a.get(m.sectionId)??r.find(y=>y.logicalSectionId===m.sectionId&&Pe({x:m.x,y:m.y},y.outline,y.holes)):void 0)??r.find(y=>Pe({x:m.x,y:m.y},y.outline,y.holes))??null;if(s[f]=d,!d)continue;c.has(d.id)||c.set(d.id,Qe(d,{floorBaseHeightM:n}));let p=u.get(d.id);p?p.push(f):u.set(d.id,[f])}let l=new Array(o.length).fill(void 0);for(let[f,m]of u){let h=c.get(f);if(!h)continue;let d=h.rake>0?Math.tan(h.rake*Math.PI/180):0,p=tn(f,o,m,t);for(let y of p.rows){let g=y.blockDepth*$*d,M=h.height+g;for(let P of y.seatIndices)l[P]=M}}for(let f=0;f<o.length;f++){let m=o[f],h=s[f];if(!h){m.eyeHeightM=n+je;continue}let d=c.get(h.id);m.eyeHeightM=(l[f]??d.height)+je}}var Br=Ge(require("earcut"),1),so=Ge(require("polygon-clipping"),1);function Ae(e){let t=0;for(let n=0,o=e.length;n<o;n+=1){let r=e[n],i=e[(n+1)%o];t+=r.x*i.y-i.x*r.y}return t/2}function _e(e,t,n){let o=!1;for(let r=0,i=e.length-1;r<e.length;i=r++){let s=e[r],a=e[i];s.y>n!=a.y>n&&t<(a.x-s.x)*(n-s.y)/(a.y-s.y)+s.x&&(o=!o)}return o}var E=$,hl=.002;function dl(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<hl}var ct=class{constructor(t=16384){this.len=0;this.buf=new Float32Array(t)}push3(t,n,o){this.len+3>this.buf.length&&this.grow(this.len+3),this.buf[this.len++]=t,this.buf[this.len++]=n,this.buf[this.len++]=o}push1(t){this.len+1>this.buf.length&&this.grow(this.len+1),this.buf[this.len++]=t}grow(t){let n=this.buf.length*2;for(;n<t;)n*=2;let o=new Float32Array(n);o.set(this.buf.subarray(0,this.len)),this.buf=o}get length(){return this.len}toArray(){return this.buf.slice(0,this.len)}},un=class{constructor(){this.pos=new ct;this.nor=new ct;this.col=new ct;this.flr=new ct;this.mat=new ct;this.currentFloor=0;this.currentMaterial=0}setFloor(t){this.currentFloor=t}setMaterial(t){this.currentMaterial=t}tri(t,n,o,r,i,s=i,a=i){dl(t,n,o)||(this.pos.push3(t[0],t[1],t[2]),this.pos.push3(n[0],n[1],n[2]),this.pos.push3(o[0],o[1],o[2]),this.nor.push3(r[0],r[1],r[2]),this.nor.push3(r[0],r[1],r[2]),this.nor.push3(r[0],r[1],r[2]),this.col.push3(i[0],i[1],i[2]),this.col.push3(s[0],s[1],s[2]),this.col.push3(a[0],a[1],a[2]),this.flr.push1(this.currentFloor),this.flr.push1(this.currentFloor),this.flr.push1(this.currentFloor),this.mat.push1(this.currentMaterial),this.mat.push1(this.currentMaterial),this.mat.push1(this.currentMaterial))}triN(t,n,o,r,i,s,a,c=a,u=a){[...t,...n,...o].every(Number.isFinite)&&(this.pos.push3(t[0],t[1],t[2]),this.pos.push3(n[0],n[1],n[2]),this.pos.push3(o[0],o[1],o[2]),this.nor.push3(r[0],r[1],r[2]),this.nor.push3(i[0],i[1],i[2]),this.nor.push3(s[0],s[1],s[2]),this.col.push3(a[0],a[1],a[2]),this.col.push3(c[0],c[1],c[2]),this.col.push3(u[0],u[1],u[2]),this.flr.push1(this.currentFloor),this.flr.push1(this.currentFloor),this.flr.push1(this.currentFloor),this.mat.push1(this.currentMaterial),this.mat.push1(this.currentMaterial),this.mat.push1(this.currentMaterial))}get vertexCount(){return this.pos.length/3}build(){return{position:this.pos.toArray(),normal:this.nor.toArray(),color:this.col.toArray(),floor:this.flr.toArray(),material:this.mat.toArray(),count:this.pos.length/3}}};function pl(e,t,n){let o=t[0]-e[0],r=t[1]-e[1],i=t[2]-e[2],s=n[0]-e[0],a=n[1]-e[1],c=n[2]-e[2],u=r*c-i*a,l=i*s-o*c,f=o*a-r*s,m=Math.hypot(u,l,f)||1;return u/=m,l/=m,f/=m,[u,l,f]}function bl(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,Br.default)(o,r.length?r:void 0,2);return{pts:n,tris:i}}function He(e){return Ae(e)<0?[...e].reverse():e}var yl=3;function gl(e,t,n,o){let r=o(e),i=o(t),s=o(n),a=(h,d,p,y)=>Math.abs(o({x:(h.x+d.x)/2,y:(h.y+d.y)/2})-(p+y)/2),c=(e.x+t.x+n.x)/3,u=(e.y+t.y+n.y)/3,l=(r+i+s)/3,f=Math.max(a(e,t,r,i),a(t,n,i,s),a(n,e,s,r),Math.abs(o({x:c,y:u})-l)),m=(h,d,p)=>{let y=Math.abs(o({x:(h+c)/2,y:(d+u)/2})-(p+l)/2);y>f&&(f=y)};return m((e.x+t.x)/2,(e.y+t.y)/2,(r+i)/2),m((t.x+n.x)/2,(t.y+n.y)/2,(i+s)/2),m((n.x+e.x)/2,(n.y+e.y)/2,(s+r)/2),f}function Dt(e,t,n,o,r){if(r<=0)return gl(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(Dt(e,i,a,o,r-1),Dt(i,t,s,o,r-1),Dt(a,s,n,o,r-1),Dt(i,s,a,o,r-1))}function Gt(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};Gt(e,t,m,d,r,i,s-1,a),Gt(e,m,n,h,r,i,s-1,a),Gt(e,d,h,o,r,i,s-1,a),Gt(e,m,h,d,r,i,s-1,a);return}let c=[t.x*E,r(t),t.y*E],u=[n.x*E,r(n),n.y*E],l=[o.x*E,r(o),o.y*E];if(a){e.triN(c,u,l,a(t),a(n),a(o),i);return}let f=pl(c,u,l);f[1]<0&&(f=[-f[0],-f[1],-f[2]]),e.tri(c,u,l,f,i)}var xl=8;function Lr(e,t,n){if(!Number.isFinite(n))return e;let o=[],r=(i,s,a,c,u)=>{if(u>0){let l={x:(i.x+s.x)/2,y:(i.y+s.y)/2},f=t(l);if(Math.abs(f-(a+c)/2)>n){r(i,l,a,f,u-1),r(l,s,f,c,u-1);return}}o.push(i)};for(let i=0;i<e.length;i++){let s=e[i],a=e[(i+1)%e.length];r(s,a,t(s),t(a),xl)}return o}function cn(e,t){if(e.length<3)return e;let n=[];for(let r of e){let i=n[n.length-1];i&&Math.hypot(r.x-i.x,r.y-i.y)<t||n.push(r)}for(;n.length>2&&Math.hypot(n[0].x-n[n.length-1].x,n[0].y-n[n.length-1].y)<t;)n.pop();if(n.length<3)return e;let o=[];for(let r=0;r<n.length;r++){let i=o.length?o[o.length-1]:n[(r-1+n.length)%n.length],s=n[r],a=n[(r+1)%n.length],c=a.x-i.x,u=a.y-i.y,l=Math.hypot(c,u);l>t&&Math.abs((s.x-i.x)*u-(s.y-i.y)*c)/l<t||o.push(s)}return o.length>=3?o:n}var ln=.001*Oe*.1;function z(e,t,n,o,r,i,s,a,c=1/0,u){if(!t||t.length<3||(c===void 0&&(c=1/0),Math.abs(Ae(t))<1e-4))return;let l=cn(Lr(cn(He(t),ln),o,c),ln),f=n?.map(b=>cn(Lr(cn(He(b),ln),o,c),ln)).filter(b=>b.length>=3&&Math.abs(Ae(b))>=1e-4),{pts:m,tris:h}=bl(l,f),d=[i[0]*a.top,i[1]*a.top,i[2]*a.top],p=[i[0]*a.bottomCap,i[1]*a.bottomCap,i[2]*a.bottomCap],y=[s[0]*a.top,s[1]*a.top,s[2]*a.top],g=[s[0]*a.wallBottom,s[1]*a.wallBottom,s[2]*a.wallBottom],M=0;if(Number.isFinite(c))for(;M<yl;M++){let b=0;for(let S=0;S<h.length;S+=3){let I=Dt(m[h[S]],m[h[S+1]],m[h[S+2]],o,M);I>b&&(b=I)}if(b<=c)break}for(let b=0;b<h.length;b+=3){let S=m[h[b]],I=m[h[b+1]],R=m[h[b+2]];Gt(e,S,I,R,o,d,M,u);let k=[S.x*E,r,S.y*E],L=[I.x*E,r,I.y*E],T=[R.x*E,r,R.y*E];e.tri(k,T,L,[0,-1,0],p)}let P=b=>{if(M<=0)return b;let S=1<<M,I=[];for(let R=0;R<b.length;R++){let k=b[R],L=b[(R+1)%b.length];for(let T=0;T<S;T++){let v=T/S;I.push({x:k.x+(L.x-k.x)*v,y:k.y+(L.y-k.y)*v})}}return I},w=Un(l),x=[{ring:P(l),flip:!1}];if(f)for(let b of f)b.length>=3&&x.push({ring:P(b),flip:!0});for(let{ring:b,flip:S}of x)for(let I=0;I<b.length;I++){let R=b[I],k=b[(I+1)%b.length],L=(k.x-R.x)*E,v=(k.y-R.y)*E,A=-L,_=Math.hypot(v,A)||1;v/=_,A/=_;let C=(R.x+k.x)/2-w.x,B=(R.y+k.y)/2-w.y,O=v*C+A*B;S&&(O=-O),O<0&&(v=-v,A=-A);let F=[v,0,A],D=[R.x*E,o(R),R.y*E],j=[k.x*E,o(k),k.y*E],N=[R.x*E,r,R.y*E],X=[k.x*E,r,k.y*E];e.tri(D,j,X,F,y,y,g),e.tri(D,X,N,F,y,g,g)}}function Fr(e){let t=0;for(let c of e)t+=c.count;let n=new Float32Array(t*3),o=new Float32Array(t*3),r=new Float32Array(t*3),i=new Float32Array(t),s=new Float32Array(t),a=0;for(let c of e)n.set(c.position,a*3),o.set(c.normal,a*3),r.set(c.color,a*3),i.set(c.floor,a),s.set(c.material,a),a+=c.count;return{position:n,normal:o,color:r,floor:i,material:s,count:t}}function Le(e,t,n=2.5){if(t<=0||e.length<3)return e;let o=He(e),r=o.length,i=[];for(let a=0;a<r;a++){let c=o[a],u=o[(a+1)%r],l=u.x-c.x,f=u.y-c.y,m=Math.hypot(l,f)||1;i.push({x:f/m,y:-l/m})}let s=[];for(let a=0;a<r;a++){let c=o[a],u=i[(a-1+r)%r],l=i[a],f=u.x+l.x,m=u.y+l.y,h=Math.hypot(f,m),d=()=>{s.push([c.x+u.x*t,c.y+u.y*t]),s.push([c.x+l.x*t,c.y+l.y*t])};if(h<1e-9){d();continue}f/=h,m/=h;let p=f*u.x+m*u.y,y=1/Math.max(p,1e-6);if(!Number.isFinite(y)||y>n){d();continue}s.push([c.x+f*t*y,c.y+m*t*y])}if(s.length<3)return e;try{let a=so.default.union([[...s,s[0]]]),c=null,u=-1/0;for(let f of a){let m=Math.abs(Ae(f[0].map(([h,d])=>({x:h,y:d}))));m>u&&(u=m,c=f[0])}if(!c)return e;let l=c.map(([f,m])=>({x:f,y:m}));if(l.length>1){let f=l[0],m=l[l.length-1];Math.abs(f.x-m.x)<1e-9&&Math.abs(f.y-m.y)<1e-9&&l.pop()}return l.length>=3?l:e}catch{return e}}function Je(e,t,n=2.5){if(e.length<3)return[];if(t<=0)return e;let o=He(e),r=o.length,i=[];for(let c=0;c<r;c++){let u=o[c],l=o[(c+1)%r],f=Math.hypot(l.x-u.x,l.y-u.y)||1;i.push({x:-(l.y-u.y)/f,y:(l.x-u.x)/f})}let s=[],a=[];for(let c=0;c<r;c++){let u=o[c],l=i[(c-1+r)%r],f=i[c],m=l.x+f.x,h=l.y+f.y,d=Math.hypot(m,h),p=d<1e-9?1/0:1/Math.max(m/d*l.x+h/d*l.y,1e-6);if(!Number.isFinite(p)||p>n){s.push({x:u.x+l.x*t,y:u.y+l.y*t},{x:u.x+f.x*t,y:u.y+f.y*t}),a.push(c,c);continue}m/=d,h/=d,s.push({x:u.x+m*t*p,y:u.y+h*t*p}),a.push(c)}for(let c=0;c<s.length;c++){let u=(c+1)%s.length,l=a[c],f=a[u];if(f!==(l+1)%r)continue;let m=o[l],h=o[f];if((s[u].x-s[c].x)*(h.x-m.x)+(s[u].y-s[c].y)*(h.y-m.y)<=0)return[]}try{let c=so.default.intersection([[...s.map(d=>[d.x,d.y]),[s[0].x,s[0].y]]],[[...o.map(d=>[d.x,d.y]),[o[0].x,o[0].y]]]),u=null,l=0;for(let d of c){let p=Math.abs(Ae(d[0].map(([y,g])=>({x:y,y:g}))));p>l&&(l=p,u=d[0])}if(!u)return[];let f=u.map(([d,p])=>({x:d,y:p})),m=f[0],h=f[f.length-1];return f.length>1&&Math.abs(m.x-h.x)<1e-9&&Math.abs(m.y-h.y)<1e-9&&f.pop(),f.length>=3?He(f):[]}catch{return[]}}function 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 jt(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 Ht=3,lt=.38,Vt=.24;function Ml(e){if(e.length<3)return null;let t=e[0],n=e[Math.floor(e.length/2)],o=e[e.length-1],r=(n.x-t.x)*E,i=(n.y-t.y)*E,s=(o.x-t.x)*E,a=(o.y-t.y)*E,c=2*(r*a-i*s);if(Math.abs(c)<1e-7)return null;let u=r*r+i*i,l=s*s+a*a,f=(u*a-l*i)/c+t.x*E,m=(r*l-s*u)/c+t.y*E,h=Math.hypot(t.x*E-f,t.y*E-m);return h<1||h>200||!Number.isFinite(h)||e.some(d=>Math.abs(Math.hypot(d.x*E-f,d.y*E-m)-h)>.03)?null:{x:f,z:m,radius:h}}function Nr(e){let t=[],n=new Map,o=(c,u)=>`${Math.floor(c/Ht)},${Math.floor(u/Ht)}`;for(let c of e)for(let u of c.rows){for(let f of u.pts){let m=f.x*E,h=f.y*E,d=o(m,h),p=n.get(d)??[];p.push({x:m,z:h,y:u.y,floor:c.floorIndex}),n.set(d,p)}if(u.patch||u.pts.length<2)continue;let l=Ml(u.pts);for(let f of[0,u.pts.length-1]){let m=u.pts[f],h=u.pts[f===0?1:f-1],d=m.x-h.x,p=m.y-h.y,y=Math.hypot(d,p);y<1e-6||t.push({sectionId:c.sectionId,floorIndex:c.floorIndex,curve:l,row:u,point:m,x:m.x*E,z:m.y*E,dx:d/y,dz:p/y})}}let r=new Map;t.forEach((c,u)=>{let l=o(c.x,c.z),f=r.get(l)??[];f.push(u),r.set(l,f)});let i=(c,u)=>{let l=Math.floor(c/Ht),f=Math.floor(u/Ht);return[-1,0,1].flatMap(m=>[-1,0,1].map(h=>`${l+m},${f+h}`))},s=new Map;t.forEach((c,u)=>{let l=-1,f=1/0,m=!1;for(let h of i(c.x,c.z))for(let d of r.get(h)??[]){let p=t[d];if(c.sectionId===p.sectionId&&c.row.blockId===p.row.blockId||c.floorIndex!==p.floorIndex||Math.abs(c.row.y-p.row.y)>.05)continue;let y=p.x-c.x,g=p.z-c.z,M=Math.hypot(y,g);if(M<lt*2+.45||M>Ht)continue;let P=c.curve&&p.curve&&Math.hypot(c.curve.x-p.curve.x,c.curve.z-p.curve.z)<=.05&&Math.abs(c.curve.radius-p.curve.radius)<=.05,w=Math.min((y*c.dx+g*c.dz)/M,(-y*p.dx-g*p.dz)/M);(P?w<.8:w<.98)||!P&&(Math.abs(y*c.dz-g*c.dx)>.15||Math.abs(y*p.dz-g*p.dx)>.15)||(M<f-.02?(l=d,f=M,m=!1):Math.abs(M-f)<=.02&&(m=!0))}l>=0&&!m&&s.set(u,l)});let a=[];for(let[c,u]of s){if(c>=u||s.get(u)!==c)continue;let l=t[c],f=t[u],m=Math.hypot(f.x-l.x,f.z-l.z),h=(f.x-l.x)/m,d=(f.z-l.z)/m,p=!1;for(let g of i((l.x+f.x)/2,(l.z+f.z)/2))for(let M of n.get(g)??[]){if(M.floor!==l.floorIndex||Math.abs(M.y-l.row.y)>.75)continue;let P=(M.x-l.x)*h+(M.z-l.z)*d,w=Math.abs((M.x-l.x)*d-(M.z-l.z)*h);P>.01&&P<m-.01&&w<Vt+lt&&(p=!0)}if(p)continue;let y=(g,M)=>({x:(l.x+h*g-d*M)/E,y:(l.z+d*g+h*M)/E});a.push({sections:[l.sectionId,f.sectionId],blocks:[l.row.blockId,f.row.blockId],floorIndex:l.floorIndex,ends:[l.point,f.point],clearWidthM:m-2*lt,heightM:(l.row.y+f.row.y)/2,outline:[y(lt,-Vt),y(m-lt,-Vt),y(m-lt,Vt),y(lt,Vt)]})}return a}var Sl=/^#?([\da-f]{3}|[\da-f]{6})$/i;function Dr(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 Pl(e){let t=Sl.exec((e??"").trim());if(!t)return null;let n=t[1].length===3?t[1].split("").map(r=>r+r).join(""):t[1],o=parseInt(n,16);return[o>>16&255,o>>8&255,o&255]}function oe(e){let t=Pl(e);return t?[t[0]/255,t[1]/255,t[2]/255]:null}function Il(e){return .2126*e[0]+.7152*e[1]+.0722*e[2]}function re(e,t,n){return[e[0]+(t[0]-e[0])*n,e[1]+(t[1]-e[1])*n,e[2]+(t[2]-e[2])*n]}function Ve(e,t){let n=Il(e);return re(e,[n,n,n],t)}function Gr({r:e,g:t,b:n}){let o=e/255,r=t/255,i=n/255,s=Math.max(o,r,i),a=Math.min(o,r,i),c=(s+a)/2;if(s===a)return{h:0,s:0,l:c};let u=s-a,l=c>.5?u/(2-s-a):u/(s+a),f;return s===o?f=((r-i)/u+(r<i?6:0))/6:s===r?f=((i-o)/u+2)/6:f=((o-r)/u+4)/6,{h:f,s:l,l:c}}var ao=e=>e<=.04045?e/12.92:((e+.055)/1.055)**2.4,co=e=>e<=.0031308?12.92*e:1.055*Math.max(0,e)**.4166666666666667-.055,lo=e=>Math.min(1,Math.max(0,e));function fo(e){let t=ao(e[0]),n=ao(e[1]),o=ao(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 uo([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[lo(co(4.0767416621*o-3.3077115913*r+.2309699292*i)),lo(co(-1.2684380046*o+2.6097574011*r-.3413193965*i)),lo(co(-.0041960863*o-.7034186147*r+1.707614701*i))]}var mn=e=>fo(e)[0];function Ut(e){let[,t,n]=fo(e);return Math.hypot(t,n)}function ut(e,t,n){let[,o,r]=fo(e);if(n===void 0)return uo([t,o,r]);let i=Math.hypot(o,r),s=i===0?0:n/i;return uo([t,o*s,r*s])}function hn(e){return uo([e,-.004,-.008])}var dn=["available","held","sold","selected","dimmed"];function Hr(e){let t=dn.indexOf(e);return t<0?0:t}var Vr={available:[.24,.82,.52],held:[.34,.39,.45],sold:[.34,.39,.45],selected:[.24,.74,1],dimmed:[.28,.32,.37]};var jr={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}},pn=.012;function bn(e){return mn(e.tierTop)>.6}function xt(e){return e?jr.day:jr.night}var mo={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]},ho={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 Rl=.15,wl=1.6;function Ur(e){return Xn(e??1,Rl,wl)}var El=.15,Al=.9,_l=1.76;function Xr(e){return po(e)?{zenith:[.36,.58,.84],horizon:[.82,.88,.94]}:{zenith:[.05,.08,.15],horizon:[.3,.38,.5]}}function po(e){return!!e&&e[0]*.2126+e[1]*.7152+e[2]*.0722>.55}function vl(){return{background:{top:[...ho.top],bottom:[...ho.bottom]},sky:Xr(null),structure:mo,seatStates:{...Vr},seatScale:1,materials:{seat:null,shell:null,roughness:.78}}}function Cl(e){return po(e)?{deck:"#c9ccc8",fascia:"#b4bab8",shell:"#c3c9c8",roughness:.87}:{deck:"#69747b",fascia:"#3e4d58",shell:"#526572",roughness:.87}}function Kr(e){let t=vl();e??={};let n=oe(e.background);if(n){t.background={top:W(n,Al),bottom:W(n,_l)},t.sky=Xr(n);let a={};for(let[u,l]of Object.entries(mo))a[u]=re(l,n,El);n[0]*.2126+n[1]*.7152+n[2]*.0722>.55&&(a.ground=W(n,.86)),t.structure=a}let o=oe(e.selectionColor)??oe(e.accent);o&&(t.seatStates={...t.seatStates,selected:o});let r=e.seatScale;typeof r=="number"&&Number.isFinite(r)&&(t.seatScale=Ur(r));let i=Object.fromEntries(Object.entries(e.venue3d??{}).filter(([,a])=>a!=null)),s={...Cl(n),...i};if(s){let a=oe(s.deck),c=oe(s.fascia);a&&(t.structure={...t.structure,tierTop:a,gaTop:a}),c&&(t.structure={...t.structure,tierWall:c,gaWall:c}),t.materials.seat=oe(s.seat),t.materials.shell=oe(s.shell),typeof s.roughness=="number"&&Number.isFinite(s.roughness)&&(t.materials.roughness=Math.min(1,Math.max(0,s.roughness)))}return kl(t,po(n)),t}function kl(e,t){let n=xt(t);e.seatStates={...e.seatStates,held:hn(n.unavailable),sold:hn(n.unavailable),dimmed:hn(n.dimmed)};let o=(i,s)=>ut(i,s,Math.min(Ut(i),pn)),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 Yr(e,t){let n=[];for(let o of t)n.push(...e.seatStates[o]);return n}function Wr(e){let t=1/0,n=1/0,o=-1/0,r=-1/0,i=!1;for(let s of e)!Number.isFinite(s.x)||!Number.isFinite(s.y)||(i=!0,s.x<t&&(t=s.x),s.y<n&&(n=s.y),s.x>o&&(o=s.x),s.y>r&&(r=s.y));return i?{minX:t,minY:n,maxX:o,maxY:r}:null}function Mt(e,t){return e.minX<=t.maxX&&t.minX<=e.maxX&&e.minY<=t.maxY&&t.minY<=e.maxY}var bo=[{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"}],hp=new Map(bo.map(e=>[e.key,e]));var Ol={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 yn(e){let t=e?.[0];return t&&Ol[t]||"#3b82f6"}var Tl=[{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"}],dp=new Map(Tl.map(e=>[e.key,e]));var Ll=["reference-focal","bar","entrance","exit","restroom","screen","sound","concession","coat","wall","rail","suite","obstruction"],pp=new Set(Ll);var gn=["#e69f00","#56b4e9","#009e73","#f0e442","#0072b2","#d55e00","#cc79a7"],zr="#a4508b";var Sp={facilities:zr,"food-drink":gn[5],navigation:gn[2],accessibility:gn[4]};var Pp={minDiameterPx:12,glyphScale:.66,ringRatio:1/14,largeFromPx:24};var de=e=>{let t=Math.round(e*100)/100;return Object.is(t,-0)?"0":String(t)},Rt=e=>`${de(e[0])} ${de(e[1])}`,It=(e,t,n,o)=>[e+n*Math.cos(o*Math.PI/180),t+n*Math.sin(o*Math.PI/180)];function ai(e){let t=`M${Rt(e.from)}`;for(let n of e.segs)t+=n.arc?`A${de(n.arc.r)} ${de(n.arc.r)} 0 ${n.arc.large} ${n.arc.sweep} ${Rt(n.to)}`:`L${Rt(n.to)}`;return`${t}Z`}function pe(e){let t=[e.from,...e.segs.map(o=>o.to)],n=[];for(let o=e.segs.length-1;o>=0;o--){let r=e.segs[o].arc;n.push({to:t[o],arc:r&&{...r,sweep:r.sweep?0:1}})}return{from:t[t.length-1],segs:n}}function be(e,t,n){let o={r:n,large:0,sweep:1};return{from:[e-n,t],segs:[{to:[e+n,t],arc:o},{to:[e-n,t],arc:o}]}}function q(e,t,n,o,r){let i=Math.min(r,n/2,o/2),s={r:i,large:0,sweep:1};return i<=0?ge([[e,t],[e+n,t],[e+n,t+o],[e,t+o]]):{from:[e+i,t],segs:[{to:[e+n-i,t]},{to:[e+n,t+i],arc:s},{to:[e+n,t+o-i]},{to:[e+n-i,t+o],arc:s},{to:[e+i,t+o]},{to:[e,t+o-i],arc:s},{to:[e,t+i]},{to:[e+i,t],arc:s}]}}function ge(e){let t=0;for(let o=0;o<e.length;o++){let[r,i]=e[o],[s,a]=e[(o+1)%e.length];t+=r*a-s*i}let n=t>0?e:[...e].reverse();return{from:n[0],segs:[...n.slice(1).map(o=>({to:o})),{to:n[0]}]}}function le(e,t,n){let o=n/2,r=t[0]-e[0],i=t[1]-e[1],s=Math.hypot(r,i);if(s<1e-6)return be(e[0],e[1],o);let a=[i/s*o,-r/s*o],c={r:o,large:0,sweep:1},u=[e[0]+a[0],e[1]+a[1]];return{from:u,segs:[{to:[t[0]+a[0],t[1]+a[1]]},{to:[t[0]-a[0],t[1]-a[1]],arc:c},{to:[e[0]-a[0],e[1]-a[1]]},{to:u,arc:c}]}}function ye(e,t,n=!1){let o=[],r=n?e.length:e.length-1;for(let i=0;i<r;i++)o.push(le(e[i],e[(i+1)%e.length],t));return o}function Be(e,t,n,o,r,i){let s=i/2,a=r-o>180?1:0,c={r:s,large:0,sweep:1},u=It(e,t,n+s,o);return{from:u,segs:[{to:It(e,t,n+s,r),arc:{r:n+s,large:a,sweep:1}},{to:It(e,t,n-s,r),arc:c},{to:It(e,t,n-s,o),arc:{r:n-s,large:a,sweep:0}},{to:u,arc:c}]}}var ee=(...e)=>e.flat().map(ai).join(" "),Ee=(e,t,n)=>`M${de(e-n)} ${de(t)}a${de(n)} ${de(n)} 0 1 0 ${de(2*n)} 0a${de(n)} ${de(n)} 0 1 0 ${de(-2*n)} 0`,Ue=(e,t,n,o,r)=>ai(q(e,t,n,o,r)),Mn=e=>`M${e.map(Rt).join("L")}`,xn=(e,t,n,o,r)=>`M${Rt(It(e,t,n,o))}A${de(n)} ${de(n)} 0 ${r-o>180?1:0} 1 ${Rt(It(e,t,n,r))}`;function St(e,t,n,o=1){let r=i=>[i[0]*o+t,i[1]*o+n];return{head:[e.head[0]*o+t,e.head[1]*o+n,e.head[2]*o],limbs:e.limbs.map(i=>i.map(r)),arcs:e.arcs?.map(([i,s,a,c,u])=>[i*o+t,s*o+n,a*o,c,u])}}function Xt(e){return[Ee(e.head[0],e.head[1],e.head[2]),...e.limbs.map(Mn),...(e.arcs??[]).map(([t,n,o,r,i])=>xn(t,n,o,r,i))].join(" ")}function Pt(e,t=2.6){return[be(e.head[0],e.head[1],e.head[2]+1),...e.limbs.flatMap(n=>ye(n,t)),...(e.arcs??[]).map(([n,o,r,i,s])=>Be(n,o,r,i,s,t-.2))]}var ft={head:[10,4,2],limbs:[[[10,8.2],[10,14],[15.5,14],[18,19.5],[20.5,19.5]],[[10,10.6],[14.5,10.6]]],arcs:[[9.5,16,5.5,35,235]]},Zr={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]]]},$r={cx:12,hr:1.9,arm:5,leg:3,r:2},Qr={cx:12,hr:1.9,sh:2.2,hem:6,leg:3},qr={cx:6.2,hr:1.8,arm:3.6,leg:2.2,r:1.4},Jr={cx:17.8,hr:1.8,sh:1.4,hem:4.1,leg:2.2};function ei({cx:e,hr:t,arm:n,leg:o,r}){return[Ee(e,2+t,t),`M${de(e-n+r)} 8.5H${de(e+n-r)}a${r} ${r} 0 0 1 ${r} ${r}V15H${de(e+o)}V22H${de(e-o)}V15H${de(e-n)}V${de(8.5+r)}a${r} ${r} 0 0 1 ${r} ${-r}Z`,`M${de(e)} 15V22`].join(" ")}function ti({cx:e,hr:t,arm:n,leg:o,r}){return[be(e,2+t,t+1),q(e-n-.5,7.8,2*n+1,7.7,r+.5),q(e-o-.5,13,o,9.5,1),q(e+.5,13,o,9.5,1)]}function ni({cx:e,hr:t,sh:n,hem:o,leg:r}){return[Ee(e,2+t,t),Mn([[e-n,8.5],[e+n,8.5],[e+o,16],[e+r,16],[e+r,22],[e-r,22],[e-r,16],[e-o,16]])+"Z",`M${de(e)} 16V22`].join(" ")}function oi({cx:e,hr:t,sh:n,hem:o,leg:r}){return[be(e,2+t,t+1),ge([[e-n-.6,7.8],[e+n+.6,7.8],[e+o+.9,16.8],[e-o-.9,16.8]]),q(e-r-.1,15,r-.4,7.5,.9),q(e+.5,15,r-.4,7.5,.9)]}var Bl=[[14.6,1.5],[5.2,13.6],[11,13.6],[9.4,22.5],[18.8,10.4],[13,10.4]],Fl="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",Nl="M12 2.5S5 9.5 5 14.5a7 7 0 0 0 14 0c0-5-7-12-7-12Z",Dl="M2.5 21.5h19V3h-6v6.2H9.2v6.2H2.5Z",ri=[[9,3],[15,3],[15,9],[21,9],[21,15],[15,15],[15,21],[9,21],[9,15],[3,15],[3,9],[9,9]],Gl={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}}]},jl={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 ii(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 si={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]]]},Hl=[[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]],Vl=[[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]],yo=[{key:"restroom-men",label:"Men's restroom",group:"facilities",path:ei($r),solid:ee(ti($r))},{key:"restroom-women",label:"Women's restroom",group:"facilities",path:ni(Qr),solid:ee(oi(Qr))},{key:"restroom-accessible",label:"Accessible restroom",group:"facilities",path:[Ue(2.5,2.5,19,19,3.5),Xt(St(ft,4.6,4.3,.66))].join(" "),solid:ee(Pt(ft)),solidLarge:ee(q(1.5,1.5,21,21,4.5),pe(q(3.9,3.9,16.2,16.2,2.6)),Pt(St(ft,4.9,4.7,.62),2.2))},{key:"first-aid",label:"First aid",group:"facilities",path:Mn(ri)+"Z",solid:ee(ge(ri.map(([e,t])=>[e+(e-12)*.08,t+(t-12)*.08])))},{key:"coat-check",label:"Coat check",group:"facilities",path:"M10 6.5a2 2 0 1 1 2 2V10 M12 10 3.4 16.9a1.4 1.4 0 0 0 .9 2.6h15.4a1.4 1.4 0 0 0 .9-2.6Z",solid:ee(Be(12,6.2,2.2,180,450,2.3),le([12,8.4],[12,10.5],2.3),ye([[12,10.2],[3.2,18.8],[20.8,18.8]],2.8,!0))},{key:"atm",label:"ATM / cash",group:"facilities",path:[Ue(2,6,20,12,2),Ee(12,12,2.75),"M6 12h.01 M18 12h.01"].join(" "),solid:ee(q(1.5,5.5,21,13,2.4),pe(be(12,12,3.2)))},{key:"info",label:"Info point",group:"facilities",path:[Ee(12,12,9.5),"M10.8 11H12v5.8 M12 7.6h.01"].join(" "),solid:ee(be(12,4.9,2.4),q(10.3,9.2,3.4,12.3,1),q(8.2,9.2,4,3,1),q(8.2,18.5,7.6,3,1))},{key:"lost-found",label:"Lost & found",group:"facilities",path:[Ee(10.5,10.5,7.5),"M16 16l5.5 5.5","M8.4 8.4a2.1 2.1 0 1 1 3 1.9c-.6.4-.9.8-.9 1.6 M10.5 14.6h.01"].join(" "),solid:ee(Be(12,7.6,4.2,180,405,3.4),ye([[14.97,10.57],[12,13],[12,15]],3.4),be(12,20,2.1))},{key:"restrooms",label:"Toilets",group:"facilities",path:[ei(qr),ni(Jr)].join(" "),solid:ee(ti(qr),oi(Jr))},{key:"charging",label:"Charging point",group:"facilities",path:[Ue(6,2,12,20,2.5),"M13.2 6.2 9.6 12h4.8l-3.6 5.8"].join(" "),solid:ee(ge(Bl))},{key:"smoking",label:"Smoking area",group:"facilities",path:[Ue(2,14.5,14.5,4,1),"M6.5 14.5v4","M15.5 11.5c0-1.4 1.5-1.9 1.5-3.4s-1.5-2-1.5-3.4 M19 11.5c0-1.4 1.5-1.9 1.5-3.4s-1.5-2-1.5-3.4"].join(" "),solid:ee(q(1.5,14,4.2,5,1.2),q(6.8,14,10.4,5,1.2),ye([[15.9,11.4],[17.3,8.9],[15.9,6.4],[17.1,3.9]],2.2),ye([[19.6,11.4],[21,8.9],[19.6,6.4],[20.8,3.9]],2.2))},{key:"no-smoking",label:"No smoking",group:"facilities",path:[Ee(12,12,9.5),"M5.3 5.3l13.4 13.4","M5.5 10.5h13v3h-13Z"].join(" "),solid:ee(be(12,12,10.6),pe(be(12,12,8)),le([6,6],[18,18],2.8),q(5,10.4,3,3.2,.6),q(16,10.4,3,3.2,.6))},{key:"food",label:"Food",group:"food-drink",path:"M5 2.5V8a2.5 2.5 0 0 0 5 0V2.5 M7.5 2.5v19 M18.5 13.5h-2c-1.3 0-2-1-2-2.5 0-4 1.5-7 4-8.5v19",solid:ee(ye([[4.9,2.6],[4.9,8]],2.2),ye([[10.1,2.6],[10.1,8]],2.2),ye([[7.5,2.6],[7.5,8]],2.2),Be(7.5,8,2.6,0,180,2.2),le([7.5,10],[7.5,21.4],3),ge([[19.4,2.2],[19.4,14.2],[16.2,14.2],[14.1,12],[14.1,9.4],[15.2,5.8],[17.3,3.3]]),le([18,13],[18,21.4],3))},{key:"bar",label:"Bar",group:"food-drink",path:"M3.5 3.5h17L12 13Z M6.2 6.5h11.6 M12 13v7.5 M8 20.5h8",solid:ee(ge([[2.8,3],[21.2,3],[12,13.6]]),le([12,12],[12,20.6],2.8),le([7.4,21],[16.6,21],2.8))},{key:"coffee",label:"Caf\xE9 / coffee",group:"food-drink",path:"M4 9h12v4.5a5.5 5.5 0 0 1-5.5 5.5h-1A5.5 5.5 0 0 1 4 13.5Z M16 10.5h1.2a2.75 2.75 0 0 1 0 5.5H16 M8 3v3 M12 3v3 M3 21.5h14",solid:ee({from:[3.4,8.4],segs:[{to:[16.6,8.4]},{to:[16.6,13.4]},{to:[11,19.4],arc:{r:5.8,large:0,sweep:1}},{to:[9,19.4]},{to:[3.4,13.4],arc:{r:5.8,large:0,sweep:1}},{to:[3.4,8.4]}]},Be(17.2,13.25,2.5,270,450,2.4),le([7.8,2.6],[7.8,5.6],2.4),le([12.2,2.6],[12.2,5.6],2.4),le([2.6,21.6],[17.4,21.6],2.6))},{key:"water",label:"Water / drinks",group:"food-drink",path:Nl,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:Fl,solid:"M8.4 2.8 3.5 5l-1.9 6 4.2 1.4.4-.8v9.4h11.6v-9.4l.4.8 4.2-1.4-1.9-6-4.9-2.2c-.4 1.5-1.8 2.6-3.6 2.6s-3.2-1.1-3.6-2.6Z"},{key:"screen",label:"Screen",group:"facilities",path:[Ue(2,3.5,20,13.5,2),"M12 17v3.5 M8 20.5h8","M10 7.8v5.9l5-2.95Z"].join(" "),solid:ee(q(1.5,3,21,14.4,2.4),pe(ge([[9.6,6.7],[16,10.2],[9.6,13.7]])),q(10.6,16.5,2.8,4,0),le([7.4,21],[16.6,21],2.8))},{key:"sound-booth",label:"Sound booth",group:"facilities",path:["M6 3v9 M6 16v5 M12 3v3 M12 10v11 M18 3v10 M18 17v4",Ee(6,14,2),Ee(12,8,2),Ee(18,15,2)].join(" "),solid:ee(le([6,2.8],[6,21.2],1.8),le([12,2.8],[12,21.2],1.8),le([18,2.8],[18,21.2],1.8),q(3.2,11.6,5.6,4.8,1.4),q(9.2,5.6,5.6,4.8,1.4),q(15.2,12.6,5.6,4.8,1.4))},{key:"entrance",label:"Entrance",group:"navigation",path:"M11 7V3.5a1 1 0 0 1 1-1h8a1 1 0 0 1 1 1v17a1 1 0 0 1-1 1h-8a1 1 0 0 1-1-1V17 M2.5 12h13.5 M12.5 8.5 16 12l-3.5 3.5",solid:ee(ye([[11,6.5],[11,2.6],[21,2.6],[21,21.4],[11,21.4],[11,17.5]],2.6),le([2.8,12],[13.5,12],3.2),ge([[12.6,7.8],[18,12],[12.6,16.2]]))},{key:"exit",label:"Exit",group:"navigation",path:"M13 7V3.5a1 1 0 0 0-1-1H4a1 1 0 0 0-1 1v17a1 1 0 0 0 1 1h8a1 1 0 0 0 1-1V17 M8 12h13.5 M18 8.5l3.5 3.5-3.5 3.5",solid:ee(ye([[13,6.5],[13,2.6],[3,2.6],[3,21.4],[13,21.4],[13,17.5]],2.6),le([7.2,12],[17,12],3.2),ge([[16.2,7.8],[21.6,12],[16.2,16.2]]))},{key:"emergency-exit",label:"Emergency exit",group:"navigation",path:[Xt(St(Zr,-2,1.4,1.15)),"M15.5 13h6 M19 10.5l2.5 2.5-2.5 2.5"].join(" "),solid:ee(Pt(St(Zr,-2,1.4,1.15),2.7),le([15.6,13],[19.5,13],2.8),ge([[18.4,9.4],[22.4,13],[18.4,16.6]]))},{key:"stairs",label:"Stairs",group:"navigation",path:Dl,solid:"M1.5 22.5h21V2h-7.8v6.4H8.4v6.4H1.5Z"},{key:"elevator",label:"Elevator",group:"navigation",path:[Ue(3.5,2.5,17,19,2.5),"M8.5 9.5 12 5.5l3.5 4Z M8.5 14.5l3.5 4 3.5-4Z"].join(" "),solid:ee(ge([[12,1.6],[19.6,10.2],[4.4,10.2]]),ge([[4.4,13.8],[19.6,13.8],[12,22.4]]))},{key:"parking",label:"Parking",group:"navigation",path:[Ue(3,3,18,18,3),"M9.5 17V7h3.75a3 3 0 0 1 0 6H9.5"].join(" "),solid:"M6.5 21V3H12a5.5 5.5 0 0 1 0 11h-1.9v7Z M10.1 6.6v3.8H12a1.9 1.9 0 0 0 0-3.8Z"},{key:"wheelchair",label:"Wheelchair access",group:"accessibility",path:Xt(ft),solid:ee(Pt(ft))},{key:"hearing",label:"Hearing assistance",group:"accessibility",path:["M4 9a6 6 0 1 1 12 0c0 3-1.8 4.3-3 5.2-1.1.8-1.6 1.7-1.6 3.1a3.6 3.6 0 0 1-6.2 2.1","M7.5 9a2.5 2.5 0 0 1 5 0c0 1.2-.7 1.9-1.6 2.5","M18.5 5.5a6.5 6.5 0 0 1 0 8"].join(" "),solid:ee(Be(10,9,6,180,380,3),ye([[15.64,11.05],[12.8,14.3],[11.5,17.2]],3),Be(8.2,17.2,3.3,0,150,3),Be(10,9,2.2,180,400,2.4),Be(13.38,9.5,6.5,322,398,2.6))},{key:"box-office",label:"Box office / tickets",group:"navigation",path:"M3 7.5A1.5 1.5 0 0 1 4.5 6h15A1.5 1.5 0 0 1 21 7.5V10a2 2 0 0 0 0 4v2.5a1.5 1.5 0 0 1-1.5 1.5h-15A1.5 1.5 0 0 1 3 16.5V14a2 2 0 0 0 0-4Z M15 6v2 M15 11v2 M15 16v2",solid:ee(Gl,pe(q(14.1,7,1.8,2.2,.9)),pe(q(14.1,10.9,1.8,2.2,.9)),pe(q(14.1,14.8,1.8,2.2,.9)))},{key:"escalator",label:"Escalator",group:"navigation",path:"M2.5 17H7l9-9h5.5v4h-4l-9 9h-6Z M11 4.5h.01 M11 8.2v3.3",solid:ee(ge([[2,16.4],[6.8,16.4],[15.8,7.4],[22,7.4],[22,12.6],[17.8,12.6],[8.8,21.6],[2,21.6]]),be(11,4.3,2.3),le([11,8],[11,11],2.6))},{key:"ramp",label:"Ramp",group:"navigation",path:"M2.5 19.5h19v-10Z M4.5 13.2 14 8.2 M10.53 7.76 14 8.2l-1.6 3.11",solid:ee(ge([[1.6,20.4],[22.4,20.4],[22.4,8.6]]),le([4.2,13.4],[13.2,8.6],2.6),ge([[15.4,7.5],[13.16,11.84],[10.56,6.88]]))},{key:"taxi",label:"Taxi / rideshare",group:"navigation",path:["M9.5 2.5h5V5h-5Z M6.5 11 8 7h8l1.5 4",Ue(3.5,11,17,6,2),"M6.5 17v2.5 M17.5 17v2.5 M7 14h.01 M17 14h.01"].join(" "),solid:ee(q(9,1.8,6,3.4,.8),ge([[6,11.4],[7.6,6.4],[16.4,6.4],[18,11.4]]),q(2.8,10.6,18.4,7,2.2),pe(be(6.8,14,1.3)),pe(be(17.2,14,1.3)),q(4.8,16,3.6,5.2,1.2),q(15.6,16,3.6,5.2,1.2))},{key:"transit",label:"Bus / transit",group:"navigation",path:[Ue(4.5,2.5,15,16,3),"M4.5 10.5h15 M9 5.5h6 M7.5 18.5V21 M16.5 18.5V21 M8 14.5h.01 M16 14.5h.01"].join(" "),solid:ee(q(4,2,16,17,3.2),pe(q(6.2,5.8,11.6,5,1)),pe(be(8,14.5,1.3)),pe(be(16,14.5,1.3)),q(6,17,3.4,5,1.2),q(14.6,17,3.4,5,1.2))},{key:"bike-parking",label:"Bike parking",group:"navigation",path:[Ee(6,14.5,4),Ee(18,14.5,4),"M6 14.5 9 7.5h6.5L18 14.5 M9 7.5l2.5 7H6 M11.5 14.5l4-7 M7.5 6h3 M15.5 7.5 15 5.5h2"].join(" "),solid:ee(be(6,14.5,4.9),pe(be(6,14.5,2.7)),be(18,14.5,4.9),pe(be(18,14.5,2.7)),ye([[6,14.5],[9,7.5],[15.5,7.5],[18,14.5]],2.2),ye([[9,7.5],[11.5,14.5],[15.5,7.5]],2.2),le([6,14.5],[11.5,14.5],2.2),le([7.2,5.8],[10.6,5.8],2.2),ye([[15.4,7.3],[15,5.4],[17.2,5.4]],2.2))},{key:"meeting-point",label:"Meeting point",group:"navigation",path:["M9.5 2.5 12 5l2.5-2.5 M9.5 21.5 12 19l2.5 2.5 M2.5 9.5 5 12l-2.5 2.5 M21.5 9.5 19 12l2.5 2.5",Ee(10,9.6,1.5),Ee(14,9.6,1.5),"M7.5 15.5a2.5 2.5 0 0 1 5 0 M11.5 15.5a2.5 2.5 0 0 1 5 0"].join(" "),solid:ee(ye([[9.4,2.4],[12,5],[14.6,2.4]],2.6),ye([[9.4,21.6],[12,19],[14.6,21.6]],2.6),ye([[2.4,9.4],[5,12],[2.4,14.6]],2.6),ye([[21.6,9.4],[19,12],[21.6,14.6]],2.6),be(9.7,9.3,2.2),be(14.3,9.3,2.2),ii(9.7,16,3),ii(14.3,16,3))},{key:"security",label:"Security / bag check",group:"facilities",path:"M12 2.5 19.5 5.5v6c0 4.6-3.2 8.4-7.5 10-4.3-1.6-7.5-5.4-7.5-10v-6Z M8.5 12l2.5 2.5 4.5-5",solid:ee(jl,pe(ge([[7.4,12.2],[9,10.6],[10.9,12.5],[15,8.4],[16.6,10],[10.9,15.7]])))},{key:"lockers",label:"Lockers",group:"facilities",path:[Ue(3.5,2.5,17,19,1.5),"M12 2.5v19 M6 6h3 M15 6h3 M9.5 11.5v2.5 M14.5 11.5v2.5"].join(" "),solid:ee(q(3,2,8.4,20,1.4),pe(q(5,5,4.4,1.7,.8)),pe(q(8.6,10.8,1.5,3.8,.7)),q(12.6,2,8.4,20,1.4),pe(q(14.6,5,4.4,1.7,.8)),pe(q(13.9,10.8,1.5,3.8,.7)))},{key:"baby-change",label:"Baby change",group:"facilities",path:"M10 6.5l.8-3.3a1.2 1.2 0 0 1 2.4 0l.8 3.3 M8.5 6.5h7 M9.5 6.5l-.9 2.2a3 3 0 0 0-.1.9V19a2.5 2.5 0 0 0 2.5 2.5h2a2.5 2.5 0 0 0 2.5-2.5V9.6a3 3 0 0 0-.1-.9l-.9-2.2 M8.5 12.5h3 M8.5 16h3",solid:ee(ge([[9.6,6.2],[10.6,1.8],[13.4,1.8],[14.4,6.2]]),q(7.6,5.4,8.8,2.6,1),q(7.8,7.4,8.4,15,2.6),pe(q(7.8,11.8,3.4,1.5,0)),pe(q(7.8,15.4,3.4,1.5,0)))},{key:"prayer-room",label:"Prayer room",group:"facilities",path:[Xt(si),"M3 21.5h18"].join(" "),solid:ee(Pt(si),q(2.4,20.2,19.2,2.6,1.3))},{key:"quiet-room",label:"Quiet room",group:"facilities",path:"M4 9h3.5l5-4v14l-5-4H4Z M15.5 9.5l5 5 M20.5 9.5l-5 5",solid:ee(ge([[2.6,8.4],[7.2,8.4],[13,3.6],[13,20.4],[7.2,15.6],[2.6,15.6]]),le([15.4,9.2],[20.8,14.8],2.8),le([20.8,9.2],[15.4,14.8],2.8))},{key:"wifi",label:"Wi-Fi",group:"facilities",path:[xn(12,19,11.5,218,322),xn(12,19,7.5,218,322),xn(12,19,3.5,218,322),"M12 19h.01"].join(" "),solid:ee(Be(12,19.2,11,218,322,2.8),Be(12,19.2,6.9,218,322,2.8),be(12,19.2,2.2))},{key:"vip-lounge",label:"VIP lounge",group:"facilities",path:["M6.5 11V7a2 2 0 0 1 2-2h7a2 2 0 0 1 2 2v4","M3.5 11.5a1.5 1.5 0 0 1 3 0V14h11v-2.5a1.5 1.5 0 0 1 3 0v6h-17Z","M5.5 17.5V20 M18.5 17.5V20"].join(" "),solid:ee(q(6,4,12,8.5,2.2),q(2.4,9.6,4.6,9,2.2),q(17,9.6,4.6,9,2.2),q(6,13.2,12,5.4,.6),le([5,18],[5,20.6],2.4),le([19,18],[19,20.6],2.4))},{key:"accessible-entrance",label:"Accessible entrance",group:"accessibility",path:[Xt(St(ft,.3,5,.62)),"M12.5 3.5H20a1 1 0 0 1 1 1v15a1 1 0 0 1-1 1h-7.5"].join(" "),solid:ee(Pt(St(ft,.3,5,.62),2.2),ye([[13,2.8],[21.2,2.8],[21.2,21.2],[13,21.2]],2.6))},{key:"assistance-dog",label:"Assistance-dog area",group:"accessibility",path:[Mn(Hl)+"Z","M6 10.8 3.5 7.5","M10.5 10.5V6h4.5l1 2.5"].join(" "),solid:ee(ge(Vl),le([6.2,11],[3.2,7.2],2.4),ye([[10.5,11],[10.5,5.6],[15.2,5.6],[16.2,8.2]],2.2))}],Ip=new Map(yo.map(e=>[e.key,e]));var ci=yo;var Ul=new Map(ci.map(e=>[e.key,e]));function go(e){return e?Ul.get(e):void 0}var Ep=ci.map(e=>e.key);function Kt(e){if(e.length<3)return e.map(i=>({...i}));let t=[...e].sort((i,s)=>i.x-s.x||i.y-s.y),n=(i,s,a)=>(s.x-i.x)*(a.y-i.y)-(s.y-i.y)*(a.x-i.x),o=i=>{let s=[];for(let a of i){for(;s.length>=2&&n(s[s.length-2],s[s.length-1],a)<=0;)s.pop();s.push(a)}return s.pop(),s},r=[...o(t),...o([...t].reverse())];return r.length>=3?r.map(i=>({...i})):t.map(i=>({...i}))}var Fi=Ge(require("polygon-clipping"),1);var K={top:1,wallBottom:.58,bottomCap:.4};function mt(e,t){if(!e)return t;let n=W(Ve(e,.4),.62);return re(t,n,.22)}function li(e,t){return e?re(t,W(Ve(e,.25),.74),.62):t}function ui(e,t){let n=xt(bn({tierTop:t}));return e?ut(e,n.sectionDeck,Math.min(n.sectionDeckChromaShare*Ut(e),n.sectionDeckChromaCap)):ut(t,n.deck,Math.min(Ut(t),pn))}function fi(e,t){let n=new Map;for(let i of e.categories??[])n.set(i.key,i.color);let o=new Map;for(let i of t){if(!i.sectionId)continue;let s=o.get(i.sectionId);s||(s=new Map,o.set(i.sectionId,s)),s.set(i.categoryKey,(s.get(i.categoryKey)??0)+1)}let r=new Map;for(let[i,s]of o){let a=0,c=0,u=0,l=0;for(let[f,m]of s){let h=oe(n.get(f));h&&(a+=h[0]*m,c+=h[1]*m,u+=h[2]*m,l+=m)}l>0&&r.set(i,[a/l,c/l,u/l])}return r}function mi(e,t){return oe(e.color)??t.get(e.logicalSectionId??e.id)??null}var Po=Ge(require("polygon-clipping"),1);var So=Ge(require("polygon-clipping"),1);var di=[{key:"circle",label:"Standard seat",shortLabel:"Standard",useCase:"General assigned seating",group:"general",path:null,bounds:null,mark:null},{key:"theatre",label:"Theatre chair",shortLabel:"Theatre",useCase:"Auditoriums, arenas and stadium stands",group:"fixed",path:"M4.5 3.5 Q4.5 1.5 6.5 1.5 L17.5 1.5 Q19.5 1.5 19.5 3.5 L19.5 13 L4.5 13 Z M3.5 12 L20.5 12 Q22.5 12 22.5 14 L22.5 21 Q22.5 22.5 21 22.5 Q19.5 22.5 19.5 21 L19.5 17.5 L4.5 17.5 L4.5 21 Q4.5 22.5 3 22.5 Q1.5 22.5 1.5 21 L1.5 14 Q1.5 12 3.5 12 Z",bounds:{x:1.5,y:1.5,width:21,height:21},mark:{x:12,y:10,radius:6}},{key:"dining",label:"Dining chair",shortLabel:"Dining",useCase:"Banquets, restaurants and table seating",group:"flexible",path:"M7 1 Q6 1 6 2.5 L6.75 10.5 L5 10.5 Q4 10.5 4 12 L4 14 Q4 15 5.25 15 L6 15 L4 23 L7 23 L9.5 15 L14.5 15 L17 23 L20 23 L18 15 L18.75 15 Q20 15 20 14 L20 12 Q20 10.5 19 10.5 L17.25 10.5 L18 2.5 Q18 1 17 1 Z",bounds:{x:4,y:1,width:16,height:22},mark:{x:12,y:10,radius:4.5}},{key:"folding",label:"Folding chair",shortLabel:"Folding",useCase:"Concert floors, ceremonies and conferences",group:"flexible",path:"M6 2 Q5 2 5 3 L6 8 L18 8 L19 3 Q19 2 18 2 Z M5 9 L19 9 Q20 9 20 10.5 L19 13 L5 13 L4 10.5 Q4 9 5 9 Z M6 12 L9 12 L12 17 L15 12 L18 12 L14 19 L17 23 L14 23 L12 21 L10 23 L7 23 L10 19 Z",bounds:{x:4,y:2,width:16,height:21},mark:{x:12,y:5,radius:3}},{key:"armchair",label:"Premium armchair",shortLabel:"Armchair",useCase:"Boxes, lounges and club seating",group:"premium",path:"M3.5 4 Q3.5 1.5 6 1.5 L18 1.5 Q20.5 1.5 20.5 4 L20.5 13 L3.5 13 Z M1.5 12.5 Q1.5 10 3.25 10 Q5 10 5 12.5 L5 13.5 L19 13.5 L19 12.5 Q19 10 20.75 10 Q22.5 10 22.5 12.5 L22.5 19.5 Q22.5 22 20 22 L4 22 Q1.5 22 1.5 19.5 Z",bounds:{x:1.5,y:1.5,width:21,height:20.5},mark:{x:12,y:7.5,radius:5.5}},{key:"recliner",label:"Recliner",shortLabel:"Recliner",useCase:"Luxury cinemas and premium clubs",group:"premium",path:"M7 2 Q7 1 8.5 1 L15.5 1 Q17 1 17 2 L19 13 L5 13 Z M4 9 Q2 9 2 11.5 L2 16 Q2 18 4 18 L6 18 L6 15 L18 15 L18 18 L20 18 Q22 18 22 16 L22 11.5 Q22 9 20 9 Q18 9 18 11 L18 13 L6 13 L6 11 Q6 9 4 9 Z M7 17 L17 17 Q18 17 18.5 18.5 L19.5 22.5 L4.5 22.5 L5.5 18.5 Q6 17 7 17 Z",bounds:{x:2,y:1,width:20,height:21.5},mark:{x:12,y:8,radius:5}},{key:"stool",label:"Stool",shortLabel:"Stool",useCase:"Bars, high-tops and seating rails",group:"flexible",path:"M6 2.5 L18 2.5 Q22 2.5 22 6.5 L22 12 Q22 16 18 16 L6 16 Q2 16 2 12 L2 6.5 Q2 2.5 6 2.5 Z M6 15.5 L9.5 15.5 L7.5 22.5 L3 22.5 Z M14.5 15.5 L18 15.5 L20.5 22.5 L16 22.5 Z",bounds:{x:2,y:2.5,width:20,height:20},mark:{x:12,y:9.25,radius:6.5}},{key:"bench",label:"Bench place",shortLabel:"Bench",useCase:"Pews, bleachers and terraces",group:"fixed",path:"M2.5 0.5 L21.5 0.5 Q23 0.5 23 2 L23 5 Q23 6.5 21.5 6.5 L2.5 6.5 Q1 6.5 1 5 L1 2 Q1 0.5 2.5 0.5 Z M2 7.5 L22 7.5 Q23.5 7.5 23.5 9 L23.5 15.5 Q23.5 17 22 17 L18 17 L18 21.5 Q18 22.5 16.75 22.5 Q15.5 22.5 15.5 21.5 L15.5 17 L8.5 17 L8.5 21.5 Q8.5 22.5 7.25 22.5 Q6 22.5 6 21.5 L6 17 L2 17 Q0.5 17 0.5 15.5 L0.5 9 Q0.5 7.5 2 7.5 Z",bounds:{x:.5,y:.5,width:23,height:22},mark:{x:12,y:12.25,radius:4.75}}],pi=di.map(e=>e.key),Xl=new Map(di.map(e=>[e.key,e]));function hi(e){return typeof e=="string"&&Xl.has(e)}function bi(e,t){return hi(e)?e:hi(t?.seatGlyph)?t.seatGlyph:"circle"}var Re={pedestal:0,pad:1,back:2,arm:3,footrest:4,leg:5,body:10,head:11},Kl=.44,Yl=.15,Wl=.3,zl=.24;function yi(e){return e===void 0||!Number.isFinite(e)||e<=0?zl:Math.min(Wl,Math.max(Yl,e*Kl))}var Zl=.05,gi=.45,$l=gi+Zl,Ql=.92;var Tp=[{part:Re.pedestal,min:[-.3,0,-.3],max:[.3,.36,.3]},{part:Re.pad,min:[-1,.36,-.95],max:[1,gi,1]},{part:Re.back,min:[-1,$l,-1],max:[1,Ql,-.72]},{part:Re.arm,min:[-1,.44,-.82],max:[-.78,.65,.78]},{part:Re.arm,min:[.78,.44,-.82],max:[1,.65,.78]},{part:Re.footrest,min:[-.9,.18,.78],max:[.9,.31,1.34]},{part:Re.leg,min:[-.82,0,-.7],max:[-.62,.37,-.48]},{part:Re.leg,min:[.62,0,-.7],max:[.82,.37,-.48]},{part:Re.leg,min:[-.82,0,.48],max:[-.62,.37,.7]},{part:Re.leg,min:[.62,0,.48],max:[.82,.37,.7]}],Lp=[{part:Re.body,min:[-.52,.39,-.08],max:[-.08,.55,.82]},{part:Re.body,min:[.08,.39,-.08],max:[.52,.55,.82]},{part:Re.body,min:[-.47,.05,.58],max:[-.13,.43,.82]},{part:Re.body,min:[.13,.05,.58],max:[.47,.43,.82]},{part:Re.head,min:[-.16,1.04,-.33],max:[.16,1.1,-.13]}];function xi(e,t,n,o){let r=new Float32Array(t),i=u=>e[u*3],s=u=>e[u*3+2],a=0,c=(u,l)=>{let f=l-u;for(let m=u;m<l;m++){let[h,d]=o(m),p=h-i(m),y=d-s(m);if(f>=2){let g=Math.max(u,m-1),M=Math.min(l-1,m+1),P=i(M)-i(g),w=s(M)-s(g),x=Math.hypot(P,w);if(x>1e-6){let b=-w/x,S=P/x;b*p+S*y<0&&(b=-b,S=-S),p=b,y=S}}r[m]=p===0&&y===0?0:Math.atan2(p,y)}};for(let u=1;u<=t;u++)(u===t||n(u)!==n(a))&&(c(a,u),a=u);return r}var Sn=.22;var ql=.42;function Jl(e){let t=e.length,n=new Float64Array(t);if(t<2)return n.fill(1/0),n;let o=1/0,r=1/0,i=-1/0,s=-1/0;for(let d of e)d.x<o&&(o=d.x),d.y<r&&(r=d.y),d.x>i&&(i=d.x),d.y>s&&(s=d.y);let a=Math.max(i-o,1e-6),c=Math.max(s-r,1e-6),u=Math.max(Math.sqrt(a*c/t),1e-6),l=Math.max(1,Math.ceil(a/u)+1),f=Math.max(1,Math.ceil(c/u)+1),m=new Map,h=(d,p)=>{let y=Math.min(l-1,Math.max(0,Math.floor((d-o)/u)));return Math.min(f-1,Math.max(0,Math.floor((p-r)/u)))*l+y};for(let d=0;d<t;d++){let p=h(e[d].x,e[d].y),y=m.get(p);y?y.push(d):m.set(p,[d])}for(let d=0;d<t;d++){let p=e[d],y=Math.min(l-1,Math.max(0,Math.floor((p.x-o)/u))),g=Math.min(f-1,Math.max(0,Math.floor((p.y-r)/u))),M=1/0;for(let P=1;P<=4;P++){for(let w=g-P;w<=g+P;w++)if(!(w<0||w>=f))for(let x=y-P;x<=y+P;x++){if(x<0||x>=l||P>1&&Math.abs(w-g)<P&&Math.abs(x-y)<P)continue;let b=m.get(w*l+x);if(b)for(let S of b){if(S===d)continue;let I=Math.hypot(e[S].x-p.x,e[S].y-p.y);I<M&&(M=I)}}if(Number.isFinite(M)&&M<=P*u)break}n[d]=M}return n}function eu(e){let t=e.eyeHeightM;return Number.isFinite(t)?Math.max(0,t-je):0}function Mi(e,t,n,o,r,i){let s=e.length,a=new Float32Array(s*3),c=new Float32Array(s),u=new Float32Array(s*3),l=new Float32Array(s),f=new Float32Array(s),m=new Float32Array(s),h=new Float32Array(s),d=new Float32Array(s*3),p=new Map,y=Jl(e);for(let g=0;g<s;g++){let M=e[g],w=(n?.seatPitchU(g)??y[g])*E;l[g]=Number.isFinite(w)?Math.max(.06,Math.min(Sn,w*ql)):Sn,f[g]=yi(Number.isFinite(w)?w:void 0);let x=bi(M.glyph,{seatGlyph:i?.get(M.categoryKey)});m[g]=pi.indexOf(x),h[g]=M.wheelchairSpaceType==="no-seat"?0:1,a[g*3]=M.x*E,a[g*3+1]=n?n.seatDeckY(g):eu(M),a[g*3+2]=M.y*E,c[g]=Hr(t?t(M):"available");let b=oe(r?.get(M.categoryKey)??"#6e7bff")??[.43,.48,1];if(u[g*3]=b[0],u[g*3+1]=b[1],u[g*3+2]=b[2],M.accessibility?.length){let S=oe(yn(M.accessibility));S&&(d[g*3]=S[0],d[g*3+1]=S[1],d[g*3+2]=S[2])}p.set(M.id,g)}return{count:s,iPosition:a,iState:c,iCategory:u,iMaxRadius:l,iRing:d,idToIndex:p,iChairWidth:f,iGlyph:m,iPhysicalSeat:h,iFloor:o??new Float32Array(s),iSection:new Float32Array(s).fill(-1),iYaw:new Float32Array(s)}}var Ri=Ge(require("earcut"),1);var tu=.58,Si=.01,Te=Sn*1.5*Oe,nu=.5,ou=.6;function ru(e,t){let n=e.length,o=[];for(let s=0;s<n;s++){let a=e[Math.max(0,s-1)],c=e[Math.min(n-1,s+1)],u=c.x-a.x,l=c.y-a.y,f=Math.hypot(u,l);if(f<1e-9){o.push([0,0]);continue}u/=f,l/=f,o.push([-l,u])}let r=0;for(let s=0;s<n;s++)r+=(e[s].x-t.x)*o[s][0]+(e[s].y-t.y)*o[s][1];return r<0?o.map(([s,a])=>[-s,-a]):o}function iu(e,t){if(e.length<2||t<=0)return[...e];let n=[...e],o=(s,a)=>{let c=a.x-s.x,u=a.y-s.y,l=Math.hypot(c,u)||1;return{x:c/l,y:u/l}},r=o(n[1],n[0]),i=o(n[n.length-2],n[n.length-1]);return n.unshift({x:n[0].x+r.x*t,y:n[0].y+r.y*t}),n.push({x:n[n.length-1].x+i.x*t,y:n[n.length-1].y+i.y*t}),n}var Pi=Math.PI/12;function su(e){if(e.length<3)return[...e];let t=[...e].sort((i,s)=>i.x-s.x||i.y-s.y),n=(i,s,a)=>(s.x-i.x)*(a.y-i.y)-(s.y-i.y)*(a.x-i.x),o=i=>{let s=[];for(let a of i){for(;s.length>=2&&n(s[s.length-2],s[s.length-1],a)<=0;)s.pop();s.push(a)}return s.pop(),s},r=[...o(t),...o([...t].reverse())];return r.length>=3?r:[...e]}function wi(e,t){if(!e.length||!(t>0))return[];let n=su(e),o=(a,c,u,l)=>{let f=u-c;for(;f<0;)f+=Math.PI*2;for(;f>Math.PI*2;)f-=Math.PI*2;let m=Math.max(1,Math.ceil(f/Pi)),h=t/Math.cos(f/m/2);for(let d=0;d<=m;d++){let p=c+f*d/m;l.push({x:a.x+Math.cos(p)*h,y:a.y+Math.sin(p)*h})}};if(n.length<3){let a=0,c=0;for(let h of n)a+=h.x,c+=h.y;a/=n.length||1,c/=n.length||1;let u=0;for(let h of n)u=Math.max(u,Math.hypot(h.x-a,h.y-c));let l=[],f=Math.max(3,Math.ceil(Math.PI*2/Pi)),m=(u+t)/Math.cos(Math.PI/f);for(let h=0;h<f;h++){let d=h/f*Math.PI*2;l.push({x:a+Math.cos(d)*m,y:c+Math.sin(d)*m})}return l}let r=n.length,i=[];for(let a=0;a<r;a++){let c=n[a],u=n[(a+1)%r];i.push(Math.atan2(-(u.x-c.x),u.y-c.y))}let s=[];for(let a=0;a<r;a++)o(n[a],i[(a+r-1)%r],i[a],s);return Ci(s)}function au(e,t,n){if(e.length===1)return Math.hypot(t-e[0].x,n-e[0].y);let o=1/0;for(let r=0;r+1<e.length;r++){let i=e[r],s=e[r+1],a=s.x-i.x,c=s.y-i.y,u=a*a+c*c,l=u>1e-12?((t-i.x)*a+(n-i.y)*c)/u:0;l<0?l=0:l>1&&(l=1);let f=Math.hypot(t-(i.x+l*a),n-(i.y+l*c));f<o&&(o=f)}return o}function Pn(e){let t=e.map(r=>{let i=0,s=0;for(let u of r.pts)i+=u.x,s+=u.y;let a=r.pts.length||1;i/=a,s/=a;let c=0;for(let u of r.pts){let l=Math.hypot(u.x-i,u.y-s);l>c&&(c=l)}return{cx:i,cy:s,rad:c}}),n=r=>{let i=r.length;return i<=2?[...r]:[r[Math.floor(i*.25)],r[Math.floor(i*.5)],r[Math.floor(i*.75)]]},o=[];for(let r=0;r<e.length;r++){let i=n(e[r].pts),s=[],a=1/0,c=null;for(let l of i){let f=1/0;for(let m=0;m<e.length;m++){if(m===r||Math.abs(e[m].y-e[r].y)<.001)continue;let h=t[m],d=Math.hypot(l.x-h.cx,l.y-h.cy)-h.rad;if(d>=f&&d>=a)continue;let p=au(e[m].pts,l.x,l.y);p<f&&(f=p),e[m].depth<e[r].depth&&p<a&&(a=p,c=e[m].y)}Number.isFinite(f)&&f>0&&s.push(f)}s.sort((l,f)=>l-f);let u=s.length?s[Math.floor(s.length/2)]:1;o.push({pitch:u,belowY:c})}return o}function Ei(e,t,n,o){let r=e[t],i=r.pts.length>=2?[...r.pts]:r.pts.length===1?(()=>{let l=r.pts[0],f=l.x-o.x,m=l.y-o.y,h=Math.hypot(f,m)||1;f/=h,m/=h;let d=Math.max(n[t].pitch,.001)*.5;return[{x:l.x+m*d,y:l.y-f*d},{x:l.x-m*d,y:l.y+f*d}]})():[];if(i.length<2)return null;let s=0,a=0;for(let l=1;l<i.length;l++){let f=Math.hypot(i[l].x-i[l-1].x,i[l].y-i[l-1].y);f>1e-6&&(s+=f,a++)}let c=a>0?s/a:0,u=iu(i,Math.max(c*ou,Te));return{pts:u,nrm:ru(u,o),front:Math.max(n[t].pitch*tu,Te),back:Math.max(n[t].pitch*nu,Te)}}var wt=1.5,Ai=.3;function xo(e,t){if(e.length<3)return e;let n=e[0],o=e[e.length-1],r=o.x-n.x,i=o.y-n.y,s=Math.hypot(r,i),a=-1,c=-1;for(let f=1;f<e.length-1;f++){let m=e[f],h=s>1e-12?Math.abs((m.x-n.x)*i-(m.y-n.y)*r)/s:Math.hypot(m.x-n.x,m.y-n.y);h>a&&(a=h,c=f)}if(a<=t||c<0)return[n,o];let u=xo(e.slice(0,c+1),t),l=xo(e.slice(c),t);return[...u.slice(0,-1),...l]}function _i(e,t){if(e.length<4)return e;let n=xo([...e,e[0]],t);return n.pop(),n.length>=3?n:e}function cu(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 vi(e,t,n){if(e.length<2)return[];let o=n??Pn(e),r=new Map;for(let s=0;s<e.length;s++){let a=r.get(e[s].blockId);a?a.push(s):r.set(e[s].blockId,[s])}let i=[];for(let[,s]of r){let a=[];for(let M of s){let P=e[M].patch;P&&P.length>=3?i.push({outline:[...P],holes:[],topY:e[M].y}):a.push(M)}if(!a.length)continue;a.sort((M,P)=>e[M].depth-e[P].depth);let u=a.map(M=>Ei(e,M,o,t)).filter(M=>M!==null);if(!u.length)continue;let l=(M,P)=>({x:M.pts[P].x-M.nrm[P][0]*(M.front+wt),y:M.pts[P].y-M.nrm[P][1]*(M.front+wt)}),f=(M,P)=>({x:M.pts[P].x+M.nrm[P][0]*(M.back+wt),y:M.pts[P].y+M.nrm[P][1]*(M.back+wt)}),m=u[0],h=u[u.length-1],d=[];for(let M=0;M<m.pts.length;M++)d.push(l(m,M));for(let M of u)d.push(f(M,M.pts.length-1));for(let M=h.pts.length-1;M>=0;M--)d.push(f(h,M));for(let M=u.length-1;M>=0;M--)d.push(l(u[M],0));let p=Ci(d),y=1/0;for(let M of a)e[M].y<y&&(y=e[M].y);if(!Number.isFinite(y))continue;if(p.length>=3&&Math.abs(Ae(p))>1e-6&&u.every(M=>{let P=M.pts[Math.floor(M.pts.length/2)];return _e(p,P.x,P.y)})&&!cu(p)){i.push({outline:_i(p,Ai),holes:[],topY:y});continue}for(let M of lu(u))i.push({outline:M,holes:[],topY:y})}return i}function lu(e){let t=[];for(let n of e){let o=[],r=[],i=n.front+wt,s=n.back+wt;for(let c=0;c<n.pts.length;c++){let u=n.pts[c],l=n.nrm[c];o.push([u.x-l[0]*i,u.y-l[1]*i]),r.push([u.x+l[0]*s,u.y+l[1]*s])}let a=[...o,...r.reverse()];a.length<3||(a.push(a[0]),t.push([a]))}if(!t.length)return[];try{let n=So.default.union(t[0],...t.slice(1)),o=[];for(let r of n){if(!r.length||r[0].length<4)continue;let i=r[0].map(([c,u])=>({x:c,y:u})),s=i[0],a=i[i.length-1];i.length>1&&Math.abs(s.x-a.x)<1e-9&&Math.abs(s.y-a.y)<1e-9&&i.pop(),i.length>=3&&o.push(_i(i,Ai))}return o}catch{return[]}}function Ci(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 Mo=class{constructor(t){this.minX=1/0;this.minY=1/0;this.maxX=-1/0;this.maxY=-1/0;this.rings=t;for(let n of t)for(let o of n)o.x<this.minX&&(this.minX=o.x),o.y<this.minY&&(this.minY=o.y),o.x>this.maxX&&(this.maxX=o.x),o.y>this.maxY&&(this.maxY=o.y)}containsAll(t){for(let n of t)if(n.x<this.minX||n.x>this.maxX||n.y<this.minY||n.y>this.maxY)return!1;for(let n of this.rings){let o=!0;for(let r of t)if(!_e(n,r.x,r.y)){o=!1;break}if(o)return!0}return!1}};function Ii(e,t,n,o,r,i){if(o.length<3)return;if(n.containsAll(o)){let u=[0,1,0],l=o[0];for(let f=1;f+1<o.length;f++){let m=o[f],h=o[f+1];e.tri([l.x*E,r,l.y*E],[m.x*E,r,m.y*E],[h.x*E,r,h.y*E],u,i)}return}let s=o.map(u=>[u.x,u.y]);s.push(s[0]);let a;try{a=So.default.intersection([s],t)}catch{return}let c=[0,1,0];for(let u of a){if(!u.length||u[0].length<4)continue;let l=u[0],f=[],m=[];for(let d=0;d<l.length-1;d++)f.push(l[d][0],l[d][1]),m.push([l[d][0],l[d][1]]);if(m.length<3)continue;let h=(0,Ri.default)(f,void 0,2);for(let d=0;d<h.length;d+=3){let p=m[h[d]],y=m[h[d+1]],g=m[h[d+2]];e.tri([p[0]*E,r,p[1]*E],[y[0]*E,r,y[1]*E],[g[0]*E,r,g[1]*E],c,i)}}}function ki(e,t,n,o,r,i,s){if(t.length<2)return;let a=s??Pn(t),c=[0,1,0],u=i&&i.length>=3?[[...i.map(h=>[h.x,h.y]),[i[0].x,i[0].y]]]:null,l=i&&i.length>=3?new Mo([[...i]]):null,f=h=>{e.setMaterial(2),h(),e.setMaterial(0)},m=h=>{e.setMaterial(3),h(),e.setMaterial(0)};for(let h=0;h<t.length;h++){let d=t[h];if(d.patch&&d.patch.length>=3){let x=[...d.patch],b=a[h].belowY??o;if(m(()=>{if(u&&l)Ii(e,u,l,x,d.y,r.tread);else{let S=x[0];for(let I=1;I+1<x.length;I++){let R=x[I],k=x[I+1];e.tri([S.x*E,d.y,S.y*E],[R.x*E,d.y,R.y*E],[k.x*E,d.y,k.y*E],c,r.tread)}}}),d.y>b+Si){let S=0,I=0;for(let R of x)S+=R.x,I+=R.y;S/=x.length,I/=x.length,f(()=>{for(let R=0;R<x.length;R++){let k=x[R],L=x[(R+1)%x.length],T=L.x-k.x,v=L.y-k.y,A=Math.hypot(T,v);if(A<1e-6)continue;let _=v/A,C=-T/A;(k.x-S)*_+(k.y-I)*C<0&&(_=-_,C=-C);let B=[_,0,C],O=[k.x*E,d.y,k.y*E],F=[L.x*E,d.y,L.y*E],D=[k.x*E,b,k.y*E],j=[L.x*E,b,L.y*E];e.tri(O,F,j,B,r.riser),e.tri(O,j,D,B,r.riser)}})}continue}let p=Ei(t,h,a,n);if(!p)continue;let{pts:y,nrm:g,front:M,back:P}=p,w=a[h].belowY??o;for(let x=0;x+1<y.length;x++){let b=y[x],S=y[x+1],I=g[x],R=g[x+1];if(Math.hypot(S.x-b.x,S.y-b.y)<1e-6||I[0]===0&&I[1]===0||R[0]===0&&R[1]===0)continue;let k=[(b.x-I[0]*M)*E,d.y,(b.y-I[1]*M)*E],L=[(S.x-R[0]*M)*E,d.y,(S.y-R[1]*M)*E],T=[(b.x+I[0]*P)*E,d.y,(b.y+I[1]*P)*E],v=[(S.x+R[0]*P)*E,d.y,(S.y+R[1]*P)*E];if(m(()=>{u&&l?Ii(e,u,l,[{x:b.x-I[0]*M,y:b.y-I[1]*M},{x:S.x-R[0]*M,y:S.y-R[1]*M},{x:S.x+R[0]*P,y:S.y+R[1]*P},{x:b.x+I[0]*P,y:b.y+I[1]*P}],d.y,r.tread):(e.tri(k,L,v,c,r.tread),e.tri(k,v,T,c,r.tread))}),d.y>w+Si){let A=[k[0],w,k[2]],_=[L[0],w,L[2]],C=[-I[0],0,-I[1]];f(()=>{e.tri(k,L,_,C,r.riser),e.tri(k,_,A,C,r.riser)})}}}}function uu(e,t){let n=e.eventConfigurationIds;return!n?.length||!!t&&n.includes(t)}function Oi(e,t){return e.filter(n=>n.type!=="shape"||uu(n,t))}function Ti(e,t){let n=e.focalPoint??{x:0,y:0};return e.floors?.length?e.floors.map((o,r)=>({objects:Oi(o.objects,t),focal:{x:(o.focalPoint??n).x,y:(o.focalPoint??n).y},baseHeightM:o.baseHeightM??0,index:r})):[{objects:Oi(e.objects,t),focal:n,baseHeightM:0,index:0}]}var fu={minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};function Ye(e){return Wr(e)??fu}function Li(e,t){let n=Le(e.outline,Te),o=Ye(n),r=t.filter(s=>s!==e&&s.outline&&s.outline.length>=3&&Mt(o,Ye(s.outline)));if(!r.length)return[n];let i=s=>{let a=s.map(c=>[c.x,c.y]);return a.push(a[0]),a};try{let s=Po.default.difference([i(n)],...r.map(c=>[i(c.outline)])),a=[];for(let c of s){if(!c.length)continue;let u=c[0].map(([l,f])=>({x:l,y:f}));if(u.length>1){let l=u[0],f=u[u.length-1];Math.abs(l.x-f.x)<1e-9&&Math.abs(l.y-f.y)<1e-9&&u.pop()}u.length>=3&&a.push(u)}return a.length?a:[n]}catch{return[n]}}function Bi(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=Po.default.intersection([n(i.outline)],o.flat())}catch{r.push(i);continue}for(let a of s){if(!a.length)continue;let c=a[0].map(([u,l])=>({x:u,y:l}));if(c.length>1){let u=c[0],l=c[c.length-1];Math.abs(u.x-l.x)<1e-9&&Math.abs(u.y-l.y)<1e-9&&c.pop()}c.length>=3&&r.push({outline:c,holes:[],topY:i.topY})}}return r.length?r:e}function mu(e,t){return e===void 0||t===void 0?!0:Math.abs(e-t)<.001}var In=class{constructor(){this.rings=[];this.boxes=[];this.levels=[]}subtract(t,n){let o=t.map(c=>[c.x,c.y]);if(o.length<3)return[];o.push(o[0]);let r=Ye(t),i=this.rings.filter((c,u)=>Mt(r,this.boxes[u])&&mu(n,this.levels[u])),s=[[o]];if(i.length)try{s=Fi.default.difference([o],...i).map(u=>u.map(l=>l.map(([f,m])=>[f,m])))}catch{s=[[o]]}this.rings.push([o]),this.boxes.push(r),this.levels.push(n);let a=[];for(let c of s){if(!c.length)continue;let u=c[0].map(([l,f])=>({x:l,y:f}));if(u.length>1){let l=u[0],f=u[u.length-1];Math.abs(l.x-f.x)<1e-9&&Math.abs(l.y-f.y)<1e-9&&u.pop()}u.length>=3&&a.push(u)}return a}};function Et(e,t,n=e){if(!t)return e;let o=1/0,r=-1/0,i=1/0,s=-1/0;for(let m of n)o=Math.min(o,m.x),r=Math.max(r,m.x),i=Math.min(i,m.y),s=Math.max(s,m.y);let a=(o+r)/2,c=(i+s)/2,u=t*Math.PI/180,l=Math.cos(u),f=Math.sin(u);return e.map(m=>{let h=m.x-a,d=m.y-c;return{x:a+h*l-d*f,y:c+h*f+d*l}})}function Ni(e){let t=ar(e);return!t.length||!e.points?.length?[]:t.map(n=>Et(n,e.rotation,e.points))}function ie(e){let t=null;if(e.kind==="polygon"&&e.points&&e.points.length>=3)return Et(en(e,4),e.rotation,e.points);if(e.kind==="rect"&&e.width&&e.height&&(t=jt(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?Et(t,e.rotation):null}function Fe(e){let t=e.role??"",o=t==="stage"?{kind:"stage",heightM:Mr(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 hu=.08,du=30,pu=.015;function bu(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 Di(e,t){let n=ie(e)??(e.points?.length?Et(e.points,e.rotation):null),o=Fe(e),i=!e.role&&o.kind==="plate"&&e.heightM===void 0&&!!n&&Math.abs(Ae(n))*$**2>=du?pu:o.heightM;if(!n)return{topOffsetM:i,supportOffsetM:0};if(o.kind!=="plate"&&o.kind!=="stage")return{topOffsetM:i,supportOffsetM:0};let s=1/0,a=1/0,c=-1/0,u=-1/0;for(let h of n)s=Math.min(s,h.x),a=Math.min(a,h.y),c=Math.max(c,h.x),u=Math.max(u,h.y);let l=i,f=0,m=1e-6*Math.max(1,c-s,u-a);for(let h of t)c>h.minX&&s<h.maxX&&u>h.minY&&a<h.maxY&&l<=h.topOffsetM+1e-6&&(l=h.topOffsetM+hu),s>=h.minX-m&&c<=h.maxX+m&&a>=h.minY-m&&u<=h.maxY+m&&(!h.poly||n.every(y=>bu(y,h.poly)||yu(y,h.poly,m)))&&(f=Math.max(f,h.topOffsetM));return e.fill&&e.fill!=="none"&&e.fill!=="transparent"&&t.push({minX:s,minY:a,maxX:c,maxY:u,topOffsetM:l,poly:n}),{topOffsetM:l,supportOffsetM:Math.min(f,l)}}function yu(e,t,n){for(let o=0,r=t.length-1;o<t.length;r=o++){let i=t[r],s=t[o],a=s.x-i.x,c=s.y-i.y,u=a*a+c*c,l=u?Math.max(0,Math.min(1,((e.x-i.x)*a+(e.y-i.y)*c)/u)):0;if(Math.hypot(e.x-(i.x+l*a),e.y-(i.y+l*c))<=n)return!0}return!1}function et(e,t,n){return{x:e.x+(t.x-e.x)*n,y:e.y+(t.y-e.y)*n}}function ve(e){if(e.length!==4)return e;let t=Math.hypot(e[1].x-e[0].x,e[1].y-e[0].y),n=Math.hypot(e[2].x-e[1].x,e[2].y-e[1].y);return t>=n?e:[e[1],e[2],e[3],e[0]]}function we(e,t,n){return[et(e[0],e[1],t),et(e[0],e[1],n),et(e[3],e[2],n),et(e[3],e[2],t)]}function Yt(e,t,n){return[et(e[0],e[3],t),et(e[1],e[2],t),et(e[1],e[2],n),et(e[0],e[3],n)]}function ne(e,t,n,o,r,i,s){z(e,t,s?.length?s:void 0,()=>n,o,r,i,K)}var gu=.8,xu=.6,Mu=2;function tt(e,t){if(!t.length)return null;let n=[],o=0;for(let s of e.objects){if(s.type!=="shape"||s.role!=="wall")continue;let a=ie(s)??[],c=Gi(a)/2;!(c>0)||Iu(a)/c*E>Mu||(n.push(...a),o+=c)}if(n.length<3)return null;let r=Kt(n);if(r.length<3||o<Gi(r)*xu)return null;let i=0;for(let s of t)Ru(s,r)&&(i+=1);return i>=t.length*gu?r:null}var Rn=6,Su=5,Pu=8;function ji(e){return Math.max(Pu,(Number.isFinite(e)?e:0)+Su)}function At(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 Iu(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 Gi(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 Ru(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 wu(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 Eu(e,t){if(!e.length)return null;let n=0,o=0,r=0;for(let h of e)n+=h.x,o+=h.y,r+=Math.hypot(h.x-t.x,h.y-t.y);let i=e.length;n/=i,o/=i,r/=i;let s=e[0],a=-1;for(let h of e){let d=Math.hypot(h.x-n,h.y-o);d>a&&(a=d,s=h)}let c=s.x-n,u=s.y-o,l=Math.hypot(c,u);l>1e-9?(c/=l,u/=l):(c=1,u=0);let f=[...e].sort((h,d)=>(h.x-n)*c+(h.y-o)*u-((d.x-n)*c+(d.y-o)*u)),m=0;for(let h of f){let d=Math.hypot(h.x-n,h.y-o);d>m&&(m=d)}return{pts:f,cx:n,cy:o,radius:m,depth:r}}function Hi(e,t,n){let o=e.pts;if(o.length===1)return Math.hypot(t-o[0].x,n-o[0].y);let r=1/0;for(let i=0;i+1<o.length;i++){let s=o[i],a=o[i+1],c=a.x-s.x,u=a.y-s.y,l=c*c+u*u,f=l>1e-12?((t-s.x)*c+(n-s.y)*u)/l:0;f<0?f=0:f>1&&(f=1);let m=Math.hypot(t-(s.x+f*c),n-(s.y+f*u));m<r&&(r=m)}return r}var wn=8;function Au(e,t,n){let o=new Array(wn).fill(1/0),r=new Array(wn).fill(-1);for(let l=0;l<e.length;l++){let f=e[l],m=Math.hypot(t-f.cx,n-f.cy)-f.radius;for(let h=0;h<wn;h++)if(m<o[h]){for(let d=wn-1;d>h;d--)o[d]=o[d-1],r[d]=r[d-1];o[h]=m,r[h]=l;break}}let i=new Array(3).fill(1/0),s=new Array(3).fill(-1);for(let l of r){if(l<0)continue;let f=Hi(e[l],t,n);for(let m=0;m<3;m++)if(f<i[m]){for(let h=2;h>m;h--)i[h]=i[h-1],s[h]=s[h-1];i[m]=f,s[m]=l;break}}if(s[0]<0)return 0;if(i[0]<1e-6)return e[s[0]].depth;let a=i[0]*2.2,c=0,u=0;for(let l=0;l<3;l++){let f=s[l];if(f<0||i[l]>a)continue;let m=1/(i[l]*i[l]);c+=m*e[f].depth,u+=m}return u>0?c/u:e[s[0]].depth}function _u(e){let t=(o,r)=>Au(e,o,r),n=(o,r)=>{let i=1/0,s=-1;for(let a=0;a<e.length;a++){let c=e[a];if(Math.hypot(o-c.cx,r-c.cy)-c.radius>=i)continue;let u=Hi(c,o,r);u<i&&(i=u,s=a)}return s};return{kind:"rows",rowCount:e.length,rows:e,nearestRow:n,depthAt:t,gradientAt:(o,r)=>{let i=(t(o+.5,r)-t(o-.5,r))/1,s=(t(o,r+.5)-t(o,r-.5))/(2*.5),a=Math.hypot(i,s);return a<1e-9?[0,0]:[i/a,s/a]}}}function Vi(e,t){let n=[];for(let o of e){let r=Eu(o.points,t);r&&n.push(r)}return n.length<2?wu(t):(n.sort((o,r)=>o.depth-r.depth),_u(n))}var nt=.06,vu=.05,Xi=.05,Ui=.15,Io=25;function Ki(e,t,n){let o=new Map,r=new Array(t.length).fill(null),i=new Float64Array(t.length),s=new Array(t.length).fill(void 0),a=new Array(t.length).fill(void 0),c=new Map,u=[],l=new Set;for(let m=0;m<e.length;m+=1){let h=e[m];for(let d of h.objects){if(d.type==="table"&&l.add(d.id),d.type!=="section"||!d.outline||d.outline.length<3)continue;let p=Le(d.outline,Te);c.set(d.id,{section:d,unit:h,frontU:1/0,hasSeats:!1,rows:new Map,seatIndices:[]}),u.push({id:d.id,floorIndex:m,box:Ye(p),section:d,unit:h,outline:p})}}let f=new Map;for(let m of u){let h=f.get(m.floorIndex);h?h.push(m):f.set(m.floorIndex,[m])}for(let m=0;m<t.length;m++){let h=t[m],d=n?f.get(n[m])??[]:u,p=h.sectionId?d.find(g=>g.id===h.sectionId)??d.find(g=>g.section.logicalSectionId===h.sectionId&&Pe({x:h.x,y:h.y},g.outline,g.section.holes)):void 0,y=p?[p]:d;for(let g of y){if(n&&g.floorIndex!==n[m]||!p&&(h.x<g.box.minX||h.x>g.box.maxX||h.y<g.box.minY||h.y>g.box.maxY||!Pe({x:h.x,y:h.y},g.outline,g.section.holes)))continue;r[m]=g.id;let M=c.get(g.id);M.hasSeats=!0;let P=h.focalPoint??g.unit.focal,w=Math.hypot(h.x-P.x,h.y-P.y);w<M.frontU&&(M.frontU=w),M.seatIndices.push(m);let x=h.rowId||`__seat-${m}`,b=M.rows.get(x);b?b.push({x:h.x,y:h.y}):M.rows.set(x,[{x:h.x,y:h.y}]);break}}for(let[m,h]of c){let d=Qe(h.section,{floorBaseHeightM:h.unit.baseHeightM}),p=h.unit.baseHeightM,y=d.rake>0?Math.tan(d.rake*Math.PI/180):0,g=d.rake<=.01&&d.height<=p+.001,M=h.section.surfaceKind,P=M==="flat"?!0:M==="rakedRows"&&d.rake>.01?!1:g,w=h.hasSeats?tn(m,t,h.seatIndices,h.unit.focal):{sectionId:m,rows:[],blockCount:0},b=w.rows.length<2?Vi([...h.rows.values()].map(O=>({points:O})),h.unit.focal):null,S=1/0;if(b){if(h.hasSeats)for(let O of h.rows.values())for(let F of O){let D=b.depthAt(F.x,F.y);D<S&&(S=D)}if(!h.hasSeats||!Number.isFinite(S)){S=1/0;for(let O of h.section.outline){let F=b.depthAt(O.x,O.y);F<S&&(S=F)}}}let I=p+vu,R=Math.max(I,d.height),k=O=>{let F=Math.max(0,O-S)*$,D=Math.min(F*y,Io);return Math.max(I,d.height+D)},L=O=>{let F=Math.max(0,O)*$,D=Math.min(F*y,Io);return Math.max(I,d.height+D)},T=P?[]:w.rows.map(O=>({pts:O.pts,y:L(O.blockDepth),depth:O.blockDepth,blockId:O.blockId,...l.has(O.id)?{patch:wi(O.pts,Te)}:{}})),v=T.length?T[0].y:R,A=T.map(O=>{let F=O.patch&&O.patch.length>=3?O.patch:O.pts,D=0,j=0;for(let V of F)D+=V.x,j+=V.y;let N=F.length||1;D/=N,j/=N;let X=0;for(let V of F){let Z=Math.hypot(V.x-D,V.y-j);Z>X&&(X=Z)}return{cx:D,cy:j,rad:X}}),_=P?()=>R:T.length>=2?(O,F)=>{let D=1/0,j=v;for(let N=0;N<T.length;N++){let X=A[N];if(Math.hypot(O-X.cx,F-X.cy)-X.rad>=D)continue;let V=T[N].patch,Z=V&&V.length>=3?_e(V,O,F)?0:bt(V,O,F):bt(T[N].pts,O,F);Z<D&&(D=Z,j=T[N].y)}return j}:(O,F)=>b?k(b.depthAt(O,F)):R,C=[0,1,0],B=T.length>=2||P?()=>C:(O,F)=>{if(!b)return C;let D=b.depthAt(O,F);if(D<=S)return C;let j=(D-S)*$;if(j*y>=Io||d.height+j*y<=I)return C;let[N,X]=b.gradientAt(O,F);if(N===0&&X===0)return C;let V=1/Math.hypot(y,1);return[-N*y*V,V,-X*y*V]};if(!P)for(let O of w.rows){let F=L(O.blockDepth);for(let D of O.seatIndices)s[D]=F}for(let O of w.rows){let F=[];for(let V=1;V<O.pts.length;V++){let Z=Math.hypot(O.pts[V].x-O.pts[V-1].x,O.pts[V].y-O.pts[V-1].y);Z>1e-6&&F.push(Z)}F.sort((V,Z)=>V-Z);let D=F.length?F[Math.floor(F.length/2)]:1/0,j=1/0,N=O.pts[Math.floor(O.pts.length/2)];if(N)for(let V of w.rows){if(V===O||V.blockId!==O.blockId)continue;let Z=bt(V.pts,N.x,N.y);Z>1e-6&&Z<j&&(j=Z)}let X=Math.min(D,Math.max(j,D*.5));if(Number.isFinite(X)&&X>0)for(let V of O.seatIndices)a[V]=X}o.set(m,{sectionId:m,deckAt:_,normalAt:B,flat:P,bottomY:p,rowLevels:T,landingY:v})}for(let m=0;m<t.length;m++){let h=r[m],d=t[m];if(h){let g=s[m];i[m]=(g??o.get(h).deckAt(d.x,d.y))+Ui;continue}let p=d.eyeHeightM,y=Number.isFinite(p)?Math.max(0,p-je):0;i[m]=d.kind==="booth"?y+nt+Ui:y}return{bySection:o,seatOwner:r,seatDeckY:m=>i[m],seatPitchU:m=>a[m]}}function _t(e,t,n){if(e.length!==4||n<=t)return null;let o=ve(e),r=Math.hypot(o[1].x-o[0].x,o[1].y-o[0].y)*E,i=Math.hypot(o[3].x-o[0].x,o[3].y-o[0].y)*E;if(r<1e-6||i<1e-6)return null;let s=Math.min(.22/r,.16),a=Math.min(.28,(n-t)*.13),c=Math.min(.065/i,.2);return{quad:o,side:s,face:c,opening:we(o,s,1-s),openingTop:n-a}}function Ro(e,t,n){if(e.length!==4||n-t<=.2)return null;let o=ve(e),r=Math.hypot(o[1].x-o[0].x,o[1].y-o[0].y)*E;if(r<=1e-6)return null;let i=Math.min(.14,(n-t)*.08,r*.08),s=i/r,a=we(o,s,1-s);return{quad:o,side:s,trim:i,inner:a,panel:Yt(a,.15,.85),bottom:t+i,top:n-i}}function Yi(e,t,n,o){let r=Ro(e,t,n);if(!r)return;let{panel:i}=r,s=(M,P)=>({x:(M.x+P.x)/2,y:(M.y+P.y)/2}),a=s(i[0],i[1]),c=s(i[3],i[2]),u=Math.hypot(a.x-o.x,a.y-o.y)<=Math.hypot(c.x-o.x,c.y-o.y),[l,f]=u?[i[0],i[1]]:[i[3],i[2]],m=u?{x:a.x-c.x,y:a.y-c.y}:{x:c.x-a.x,y:c.y-a.y},h=Math.hypot(m.x,m.y);if(h<1e-6)return;-(f.y-l.y)*m.x+(f.x-l.x)*m.y<0&&([l,f]=[f,l]);let d=Math.min(.006,h*E*.05),p=m.x/h*d,y=m.y/h*d,g=(M,P)=>[M.x*E+p,P,M.y*E+y];return[g(l,r.bottom),g(f,r.bottom),g(l,r.top),g(f,r.top)]}var zi=Ge(require("polygon-clipping"),1);var Wi=Ge(require("polygon-clipping"),1);function We(e,t,n,o,r,i,s,a={}){let c=Ye(t),u=a.ao??K,l=r.flatMap(p=>{if(p.role!=="entrance"&&p.role!=="exit")return[];let y=ie(p);if(!y||y.length!==4||!Mt(c,Ye(y)))return[];let g=a.portalBase??n,M=_t(y,g,g+Fe(p).heightM);if(!M)return[];let P=Math.min(o,M.openingTop);return P<=n?[]:[{poly:M.opening,height:P}]});if(!l.length)return!1;let f=p=>p.map(y=>[y.x,y.y]),m=[f(t),...(a.holes??[]).map(f)],h=[n,...new Set(l.map(p=>p.height)),o].sort((p,y)=>p-y),d=[];try{for(let p=1;p<h.length;p++){let y=h[p-1],g=h[p];if(g-y<1e-6)continue;let M=l.filter(w=>w.height>y+1e-6).map(w=>[f(w.poly)]),P=M.length?Wi.default.difference(m,...M):[m];d.push({low:y,high:g,polys:P})}}catch{return!1}for(let p of d)for(let y of p.polys){let[g,...M]=y.map(w=>w.map(([x,b])=>({x,y:b}))),P=w=>u.wallBottom+(u.top-u.wallBottom)*(w-n)/(o-n);z(e,g,M,()=>p.high,p.low,i,s,{...u,top:P(p.high),wallBottom:P(p.low)})}return!0}var wo={depthM:1.6,thicknessM:.35,minWallM:6};function En(e,t,n,o,r,i,s,a,c){let u=o-n;if(u<=0)return;let l=a&&(c??u)>=wo.minWallM?Cu(t,a):null,f=l?o-wo.thicknessM:o,m=f-n,h=m<1.5?[[n,f,1]]:l?[[n,n+Math.min(.9,m*.18),.82],[n+Math.min(.9,m*.18),f,1]]:[[n,n+Math.min(.9,m*.18),.82],[n+Math.min(.9,m*.18),f-.1,1],[f-.1,f,1.1]],d=p=>K.wallBottom+(K.top-K.wallBottom)*(p-n)/u;for(let[p,y,g]of h){let M={...K,top:d(y),wallBottom:d(p)},P=W(i,g),w=W(s,g);We(e,t,p,y,r,P,w,{portalBase:n,ao:M})||z(e,t,void 0,()=>y,p,P,w,M)}for(let[p,...y]of l??[])z(e,p,y.length?y:void 0,()=>o,f,W(i,1.12),W(s,.78),K)}function Cu(e,t){let n=wo.depthM/E,o=e.map(s=>{let a=t.x-s.x,c=t.y-s.y,u=Math.hypot(a,c)||1;return{x:s.x+a/u*n,y:s.y+c/u*n}}),r=s=>{let a=s.map(c=>[c.x,c.y]);return a.push(a[0]),a},i=[[r(e)],[r(o)]];for(let s=0;s<e.length;s++){let a=(s+1)%e.length;i.push([r([e[s],e[a],o[a],o[s]])])}try{let[s,...a]=i,c=zi.default.union(s,...a);return c.length?c.map(u=>u.map(l=>l.slice(0,-1).map(([f,m])=>({x:f,y:m})))):null}catch{return null}}function Zi(e){return e.route?.stepFree===!0&&(e.kind==="line"||e.kind==="polyline")}function $i(e){let t=Number.isFinite(e)&&e>0?e:4;return[Math.max(6,t*2.6),Math.max(4,t*1.7)]}function Qi(e,t,n){let o=[];if(e.length<2||!(t>0)||!(n>=0))return o;let r=!0,i=t;for(let s=0;s<e.length-1;s+=1){let a=e[s],c=e[s+1],u=Math.hypot(c.x-a.x,c.y-a.y);if(u<1e-9)continue;let l=(c.x-a.x)/u,f=(c.y-a.y)/u,m=0;for(;m<u-1e-9;){let h=Math.min(i,u-m);r&&o.push([{x:a.x+l*m,y:a.y+f*m},{x:a.x+l*(m+h),y:a.y+f*(m+h)}]),m+=h,i-=h,i<=1e-9&&(r=!r,i=r?t:n)}}return o}function Wt(e,t,n){let o=oe(t.stroke?.color),r=t.stroke?.width??0;if(!o||!Number.isFinite(r)||r<=0)return;let i=t.kind==="line"||t.kind==="polyline",s=i?Et(t.points??[],t.rotation):ie(t);if(!s||s.length<2)return;let a=r*.5,c=Zi(t)?Qi(s,...$i(r)):Array.from({length:i?s.length-1:s.length},(u,l)=>[s[l],s[(l+1)%s.length]]);for(let[u,l]of c){let f=Math.hypot(l.x-u.x,l.y-u.y);if(f<1e-6)continue;let m=-(l.y-u.y)/f*a,h=(l.x-u.x)/f*a,d=[(u.x+m)*E,n,(u.y+h)*E],p=[(l.x+m)*E,n,(l.y+h)*E],y=[(l.x-m)*E,n,(l.y-h)*E],g=[(u.x-m)*E,n,(u.y-h)*E];e.tri(d,p,y,[0,1,0],o),e.tri(d,y,g,[0,1,0],o)}}function qi(e){return e==="bar"||e==="concession"||e==="coat"||e==="restroom"}var vt=(e,t,n)=>({x:e.x+(t.x-e.x)*n,y:e.y+(t.y-e.y)*n});function An(e,t,n,o){let[r,i,s,a]=t?e:[e[3],e[2],e[1],e[0]];return[vt(r,a,n),vt(i,s,n),vt(i,s,o),vt(r,a,o)]}function Ji(e,t,n,o,r,i,s,a,c=!1){if(n.length!==4||r-o<.4)return!1;let u=I=>c?Math.min(I,r):I,l=ve(n),f=Math.hypot(l[3].x-l[0].x,l[3].y-l[0].y)*E;if(f<.4)return!1;let m=vt(l[0],l[1],.5),h=vt(l[3],l[2],.5),d=Math.hypot(m.x-a.x,m.y-a.y)<=Math.hypot(h.x-a.x,h.y-a.y),p=re(s,[.92,.9,.86],.35),y=W(i,.72),g=r-o;if(t==="restroom"){let I=Math.min(.18,g*.08);return ne(e,l,r-I,o,s,i),ne(e,l,r,r-I,p,p),!0}let M=o+Math.min(1.1,g),P=t==="coat"?1:Math.min(.5,.75/f),w=An(l,d,0,P);if(ne(e,w,M-.05,o,y,i),ne(e,w,M,M-.05,p,p),t==="coat"||f<1.2)return!0;if(t==="bar"){let I=An(l,d,Math.max(P+.2,1-.45/f),1),R=u(o+Math.max(Math.min(2.2,g*2),M-o+.6));return ne(e,I,R,o,s,y),!0}let x=An(l,d,Math.max(P+.25,.55),1),b=u(o+Math.max(2.6,M-o+1.4));if(b-.14<=M)return!0;ne(e,x,b-.14,o,s,i),ne(e,l,b,b-.14,p,y);let S=Math.min(.08,.1/Math.max(.1,Math.hypot(l[1].x-l[0].x,l[1].y-l[0].y)*E));for(let[I,R]of[[0,S],[1-S,1]])ne(e,An(we(l,I,R),d,0,Math.min(.08,.1/f)),b-.14,M,y,y);return!0}var ku=[.12,.38,.16],Ou=[.72,.62,.45],Tu=[.88,.93,.96],es=[.95,.95,.94],Lu=[.66,.29,.22],Eo={length:20.12,width:3.05},Bu=.14,Fu=9.76,ze=[.93,.94,.95],_n=[.1,.11,.13],Nu=[.45,.85,1.25],Du=1.45,ts=.012,ns=.004,Gu=1.07,ju=.15;function kt(e,t,n,o,r,i){e.setMaterial(i),z(e,t,n?[n.slice().reverse()]:void 0,()=>o,o-.004,r,r,K)}var os=(e,t)=>Je(e,t/E);function rs(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 Hu(e,t,n,o){let r=t.map(i=>[i.x*E,n,i.y*E]);e.tri(r[0],r[1],r[2],[0,1,0],o),e.tri(r[0],r[2],r[3],[0,1,0],o)}function vn(e,t,n,o,r,i){let s=n/E,a=[{x:t.x-s,y:t.y-s},{x:t.x+s,y:t.y-s},{x:t.x+s,y:t.y+s},{x:t.x-s,y:t.y+s}];z(e,a,void 0,()=>r,o,i,W(i,.85),K)}function Ct(e,t,n,o,r,i,s){let a=rs(t,n,o/E);a&&z(e,a,void 0,()=>i,r,s,W(s,.85),K)}function Cn(e){let t=ve(e),n={x:(t[0].x+t[2].x)/2,y:(t[0].y+t[2].y)/2},o=Math.hypot(t[1].x-t[0].x,t[1].y-t[0].y)||1,r=Math.hypot(t[3].x-t[0].x,t[3].y-t[0].y)||1,i={x:(t[1].x-t[0].x)/o,y:(t[1].y-t[0].y)/o},s={x:(t[3].x-t[0].x)/r,y:(t[3].y-t[0].y)/r};return{at:(c,u)=>({x:n.x+(i.x*c+s.x*u)/E,y:n.y+(i.y*c+s.y*u)/E}),lengthM:o*E,widthM:r*E}}function is(e,t,n){let o=Sr(t);if(!o.length)return;let r=1/0,i=-1/0,s=1/0,a=-1/0;for(let P of t.points??[])r=Math.min(r,P.x),i=Math.max(i,P.x),s=Math.min(s,P.y),a=Math.max(a,P.y);let c=(t.rotation??0)*Math.PI/180,u=Math.cos(c),l=Math.sin(c),f=(r+i)/2,m=(s+a)/2,h=P=>c?{x:f+(P.x-f)*u-(P.y-m)*l,y:m+(P.x-f)*l+(P.y-m)*u}:P,d=Math.min(i-r,a-s)*E,p=Math.max(.04,Math.min(.3,d*.004))/E,y=0;e.setMaterial(0);for(let P of o){if(!P.fill)continue;let w=P.points.map(h);kt(e,w,null,n+ts+y*ns,oe(P.fill)??ze,0),y++}let g=o.filter(P=>!(P.fill&&P.ink===P.fill)),M=[...new Set(g.map(P=>P.ink??on))];for(let P of M){let w=n+ts+y++*ns,x=oe(P)??ze;for(let b of g){if((b.ink??on)!==P)continue;let S=b.points.map(h),I=b.closed?S.length:S.length-1;for(let R=0;R<I;R++){let k=rs(S[R],S[(R+1)%S.length],p);k&&Hu(e,k,w,x)}}}}function ss(e,t,n,o,r){if(t.length<3)return!1;let i=o+.006,s=r??ku;if(n==="oval-cricket"){let a=t.reduce((x,b)=>x+b.x,0)/t.length,c=t.reduce((x,b)=>x+b.y,0)/t.length,u=x=>t.map(b=>({x:a+(b.x-a)*x,y:c+(b.y-c)*x})),l=8;for(let x=0;x<l;x++){let b=u(1-x/l),S=x===l-1?null:u(1-(x+1)/l);kt(e,b,S,i,W(s,x%2?1.04:.96),4)}let f=t[0];for(let x of t)Math.hypot(x.x-a,x.y-c)>Math.hypot(f.x-a,f.y-c)&&(f=x);let m=Math.hypot(f.x-a,f.y-c)||1,h=(f.x-a)/m,d=(f.y-c)/m,p=-d,y=h,g=Math.min(1,2*m*E*Bu/Eo.length),M=Eo.length*g/2/E,P=Eo.width*g/2/E,w=[[-M,-P],[M,-P],[M,P],[-M,P]].map(([x,b])=>({x:a+h*x+p*b,y:c+d*x+y*b}));return kt(e,w,null,i+.004,Ou,0),e.setMaterial(0),!0}if(n==="rink-hockey"){let a=os(t,ju);return kt(e,a,null,i,Tu,0),e.setMaterial(0),z(e,t,[a.slice().reverse()],()=>o+Gu,o,es,W(es,.9),K),!0}if(n==="ring-boxing"&&t.length===4){let{at:a}=Cn(t),c=[a(-3.05,-3.05),a(3.05,-3.05),a(3.05,3.05),a(-3.05,3.05)],u=[[.77,.19,.19],ze,[.17,.42,.69],ze];e.setMaterial(0),c.forEach((l,f)=>vn(e,l,.07,o,o+Du,u[f]));for(let l of Nu)for(let f=0;f<4;f++)Ct(e,c[f],c[(f+1)%4],.025,o+l-.025,o+l+.025,ze);return!0}if(n==="court-tennis"&&t.length===4){let{at:a}=Cn(t);e.setMaterial(0),Ct(e,a(0,-6.4),a(0,6.4),.015,o,o+.95,_n),Ct(e,a(0,-6.4),a(0,6.4),.03,o+.95,o+1,ze);for(let c of[-1,1])vn(e,a(0,c*6.4),.05,o,o+1.07,_n);return!0}if(n==="court-basketball"&&t.length===4){let{at:a,lengthM:c}=Cn(t),u=Math.min(14,c/2-.5);e.setMaterial(0);for(let l of[-1,1]){let f=a(l*(u+1.2),0),m=a(l*(u-1.2),0);vn(e,f,.12,o,o+3.4,_n),Ct(e,f,m,.06,o+3.25,o+3.4,_n),Ct(e,a(l*(u-1.2),-.9),a(l*(u-1.2),.9),.03,o+2.9,o+3.95,ze)}return!0}if(n==="pitch-rugby"&&t.length===4){let{at:a,lengthM:c}=Cn(t),u=c*(50/120);e.setMaterial(0);for(let l of[-1,1]){for(let f of[-2.8,2.8])vn(e,a(l*u,f),.07,o,o+12,ze);Ct(e,a(l*u,-2.8),a(l*u,2.8),.06,o+2.94,o+3.06,ze)}return!0}if(n==="track-athletics"){let a=os(t,Fu);return a.length<3?!1:(kt(e,t,a,i,Lu,0),kt(e,a,null,i,s,4),e.setMaterial(0),!0)}return!1}var as=[.19,.4,.15],Vu=.012,Ln=2.4,Uu=1,Xu=.75,Ku=.15;function Ne(e){if(e.points&&e.points.length>=3)return e.points;let{center:t,width:n,height:o,rotation:r}=e;if(!n||!o)return null;let i=(r??0)*Math.PI/180,s=Math.cos(i),a=Math.sin(i),c=n/2,u=o/2;return[[-c,-u],[c,-u],[c,u],[-c,u]].map(([l,f])=>({x:t.x+l*s-f*a,y:t.y+l*a+f*s}))}function ds(e,t,n,o,r,i,s=!1){let a=Ne(t);if(a){if(s){let c=mt(o,r.boothTop),u=He([...a]);z(e,Le(u,Yu/E),[u.slice().reverse()],()=>n+.03,n,c,W(c,.8),K);return}if(!(!t.points&&i&&zu(e,a,n,o,i))){if(!t.points&&i&&a.length===4){Wu(e,a,n,o,i);return}z(e,a,void 0,()=>n+Ln,n,mt(o,r.boothTop),r.boothWall,K)}}}var Ao=1.1,cs=[.9,.9,.88],Yu=.1,kn=[.87,.87,.85],ls=.08;function ps(e,t){let n=c=>({x:(e[c].x+e[(c+1)%4].x)/2,y:(e[c].y+e[(c+1)%4].y)/2}),o=0,r=1/0;for(let c=0;c<4;c++){let u=n(c),l=Math.hypot(u.x-t.x,u.y-t.y);l<r&&(r=l,o=c)}let i=[0,1,2,3].map(c=>e[(o+c)%4]),s=(c,u,l)=>({x:c.x+(u.x-c.x)*l,y:c.y+(u.y-c.y)*l});return{q:i,part:(c,u,l,f)=>{let m=s(i[0],i[1],c),h=s(i[0],i[1],u),d=s(i[3],i[2],c),p=s(i[3],i[2],u);return[s(m,d,l),s(h,p,l),s(h,p,f),s(m,d,f)]},depthM:Math.hypot(i[3].x-i[0].x,i[3].y-i[0].y)*E,widthM:Math.hypot(i[1].x-i[0].x,i[1].y-i[0].y)*E}}function Wu(e,t,n,o,r){let{q:i,part:s}=ps(t,r),a=o??[.35,.42,.55],c=re(a,[.78,.78,.77],.62),u=re(a,[.95,.95,.94],.45);ne(e,i,n+nt,n,c,W(c,.8)),ne(e,s(.05,.95,.72,.98),n+Ao-.05,n+nt,u,W(u,.8)),ne(e,s(.03,.97,.7,1),n+Ao,n+Ao-.05,cs,W(cs,.9))}function zu(e,t,n,o,r){if(t.length!==4)return!1;let{q:i,part:s,depthM:a,widthM:c}=ps(t,r);if(a<1||c<1)return!1;let u=o??[.35,.42,.55],l=re(u,[.78,.78,.77],.62),f=n+Ln,m=ls/c,h=ls/a;ne(e,i,n+nt,n,l,W(l,.8)),ne(e,s(0,1,1-h,1),f,n+nt,kn,W(kn,.9));for(let[y,g]of[[0,m],[1-m,1]])ne(e,s(y,g,0,1-h),f,n+nt,kn,W(kn,.9));ne(e,s(m,1-m,0,Math.min(.5,.06/a)),f,f-.3,u,W(u,.85));let d=Math.min(.4,.6/c),p=Math.min(.12,.3/a);return ne(e,s(.5-d,.5+d,.72-p,.72+p),n+Uu,n+nt,re(u,[.95,.95,.94],.7),W(u,.75)),!0}function Bn(e){if(e.shape==="round"){let l=e.radius;return l?fn(e.center.x,e.center.y,l,l,24):null}let{width:t,height:n,rotation:o,center:r}=e;if(!t||!n)return null;let i=(o??0)*Math.PI/180,s=Math.cos(i),a=Math.sin(i),c=t/2,u=n/2;return[[-c,-u],[c,-u],[c,u],[-c,u]].map(([l,f])=>({x:r.x+l*s-f*a,y:r.y+l*a+f*s}))}function bs(e,t,n,o,r,i=!0){let s=Bn(t);if(!s)return;let a=s.reduce((m,h)=>m+h.x,0)/s.length,c=s.reduce((m,h)=>m+h.y,0)/s.length,u=m=>s.map(h=>({x:a+(h.x-a)*m,y:c+(h.y-c)*m})),l=i&&o?mt(o,r.tableTop):Zu,f=n+Xu;z(e,s,void 0,()=>f,n+$u,l,W(l,.86),K),z(e,u(.12),void 0,()=>f+.12,f,us,W(us,.8),K)}var Zu=[.93,.92,.89],us=[.78,.66,.42],$u=.25,zt={armM:1.1,widthM:.28,insideM:1.4,low:.043,high:.048};function Qu(e,t,n){let o=e.reduce((g,M)=>g+M.x,0)/4,r=e.reduce((g,M)=>g+M.y,0)/4,i=e[3].x-e[0].x,s=e[3].y-e[0].y,a=Math.hypot(i,s)||1;i/=a,s/=a,i*(t.x-o)+s*(t.y-r)<0&&(i=-i,s=-s);let c=-s,u=i,l=zt.armM/E,f=zt.widthM/E,m=a/2+zt.insideM/E,h=n?-1:1,d=o+i*(m+(n?0:l)),p=r+s*(m+(n?0:l)),y=(g,M)=>({x:d+i*g*h+c*M,y:p+s*g*h+u*M});return[y(0,0),y(-l,l),y(-l-f,l),y(-f,0),y(-l-f,-l),y(-l,-l)]}function qu(e,t,n,o,r){let i=[.94,.95,.96];z(e,Qu(t,o,r),void 0,()=>n+zt.high,n+zt.low,i,i,K)}function Tn(e,t){let n=oe(e);return n?{top:W(Ve(n,.12),.95),wall:W(Ve(n,.12),.85)}:{top:t.tierTop,wall:t.tierWall}}function ys(e,t,n,o,r,i,s,a,c=[]){let u=ie(t),l=Ni(t);if(!t.role&&(!t.fill||t.fill==="none"||t.fill==="transparent")||!u){Wt(e,t,n+o+Vu);return}let m=a?a.kind==="stage":t.role==="stage",h=a?a.kind==="screen":t.role==="screen",d=a?{kind:m?"stage":"solid",heightM:a.topY-a.baseY}:Fe(t),p=a?.baseY??n,y=a?.topY??n+o;if(m&&s){let T=1/0,v=-1/0,A=1/0,_=-1/0;for(let C of u)C.x<T&&(T=C.x),C.x>v&&(v=C.x),C.y<A&&(A=C.y),C.y>_&&(_=C.y);s.push({cx:(T+v)/2*E,cz:(A+_)/2*E,y,halfX:Math.max((v-T)/2*E,.5),halfZ:Math.max((_-A)/2*E,.5)})}let g=oe(t.fill),M=t.role==="wall"||t.role==="entrance"||t.role==="exit",P=M?Tn(t.fill,r).top:m&&g?re(r.stageTop,W(Ve(g,.18),.9),.9):!t.role&&g?g:mt(g,m?r.stageTop:r.decorTop),w=h?g:null,x=M?Tn(t.fill,r).wall:m?g?re(r.stageWall,W(g,.58),.82):r.stageWall:h?w?re(W(w,1.42),[.24,.46,.82],.08):[.24,.46,.82]:mt(oe(t.fill),r.decorWall),b=m&&bn(r)?xt(!0):null,S=b?hs(P,b.stageTop):P,I=b?hs(x,b.stageWall):x;if(t.role==="wall"&&!a){En(e,u,p,y,c,S,I,i),Wt(e,t,y+.012);return}if(h&&u.length===4&&y-p>.2){let T=Ro(u,p,y);if(!T)return;let{quad:v,side:A,trim:_,inner:C,panel:B}=T,O=[.12,.15,.18];for(let[F,D]of[[0,A],[1-A,1]])ne(e,we(v,F,D),y,p,O,O);ne(e,C,p+_,p,O,O),ne(e,C,y,y-_,O,O),ne(e,B,y-_,p+_,I,I),Wt(e,t,y+.012);return}let R=g?W(Ve(g,.15),.82):I,k=g?W(Ve(g,.1),1.02):S;if(qi(t.role)&&!a&&Ji(e,t.role,u,p,y,R,k,i,t.heightM!==void 0))return;if((t.role==="sound"||a?.kind==="sound_desk")&&u.length===4&&y-p>.3){let T=ve(u),v=Math.hypot(T[1].x-T[0].x,T[1].y-T[0].y)*E,A=Math.min(.12,.09/Math.max(v,.001)),_=[.18,.21,.24],C=y-Math.min(.12,(y-p)*.15);for(let[B,O]of[[0,A],[1-A,1]])ne(e,we(T,B,O),C,p,_,_);ne(e,T,y,C,S,_);return}if(t.role==="rail"&&u.length===4&&y>p){let T=ve(u),v=Math.hypot(T[1].x-T[0].x,T[1].y-T[0].y)*E,A=Math.max(1,Math.min(128,Math.ceil(v/1.4))),_=Math.min(.08,.055/Math.max(.055,v)),C=[.58,.64,.66];for(let B=0;B<=A;B++){let O=B/A,F=Math.min(1-_,Math.max(0,O-_/2));ne(e,we(T,F,F+_),y,p,C,W(C,.8))}for(let B of[.52,1]){let O=p+(y-p)*B;ne(e,T,O,Math.max(p,O-.055),C,W(C,.8))}return}if(t.role==="goal"&&u.length===4){let T=ve(u),v=Math.hypot(T[1].x-T[0].x,T[1].y-T[0].y)*E,A=Math.min(.12,.1/Math.max(.1,v)),_=[.9,.94,.94];for(let[C,B]of[[0,A],[1-A,1]])ne(e,we(T,C,B),Math.max(p,y-.1),p,_,_);ne(e,T,y,Math.max(p,y-.1),_,_);return}if(d.kind==="portal"&&u.length===4){let T=_t(u,p,y);if(!T)return;let{quad:v,side:A,face:_,openingTop:C}=T;for(let[B,O,F]of[[0,_,1],[_,1-_,.67],[1-_,1,1]]){let D=Yt(v,B,O),j=W(S,F),N=W(I,F);for(let[X,V]of[[0,A],[1-A,1]])ne(e,we(D,X,V),C,p,j,N);ne(e,D,y,C,j,N)}(t.role==="entrance"||t.role==="exit")&&qu(e,v,p,i,t.role==="exit");return}if(d.kind==="suite"&&u.length===4){let T=u.map((_,C)=>{let B=u[(C+1)%4],O=(_.x+B.x)/2,F=(_.y+B.y)/2;return Math.hypot(O-i.x,F-i.y)}),v=T.indexOf(Math.min(...T)),A=[0,1,2,3].map(_=>u[(v+_)%4]);ne(e,we(A,0,.08),y,p,S,I),ne(e,we(A,.92,1),y,p,S,I),ne(e,Yt(A,.88,1),y,p,S,I),ne(e,A,y,Math.max(p,y-.18),S,I);return}if(m&&!t.stageKind?.startsWith("pitch-")&&y-p>.12){let T=y-Math.min(.06,(y-p)*.15);ne(e,u,T,p,S,I,l),ne(e,u,y,T,S,re(S,I,.2),l)}else ne(e,u,y,p,S,I,l);if((t.stageKind==="pitch-football"||t.stageKind==="pitch-rugby")&&u.length===4){e.setMaterial(4);let T=ve(u),v=re(g??as,as,g?.45:0);for(let A=0;A<12;A++){let _=we(T,A/12,(A+1)/12),C=W(v,A%2?1.09:.91),B=_.map(O=>[O.x*E,y+.006,O.y*E]);e.tri(B[0],B[1],B[2],[0,1,0],C),e.tri(B[0],B[2],B[3],[0,1,0],C)}}t.stageKind&&t.stageKind!=="pitch-football"&&ss(e,u,t.stageKind,y,g),m&&st(t.stageKind)&&is(e,t,y),e.setMaterial(h?1:0),Wt(e,t,y+.012)}function Fn(e){let{x:t,y:n,width:o,height:r}=e;if(!o||!r)return null;let i=t+o/2,s=n+r/2,a=(e.rotation??0)*Math.PI/180,c=Math.cos(a),u=Math.sin(a),l=o/2,f=r/2;return[[-l,-f],[l,-f],[l,f],[-l,f]].map(([m,h])=>({x:i+m*c-h*u,y:s+m*u+h*c}))}function Ju(e){if(!e||!e.startsWith("data:image/svg+xml"))return null;let t=e.slice(e.indexOf(",")+1);if(/;base64/i.test(e.slice(0,e.indexOf(","))))try{t=atob(t)}catch{return null}else try{t=decodeURIComponent(t)}catch{}let n=t.match(/<(?:rect|path)\b[^>]*\bfill="([^"]+)"/i);if(!n)return null;let o=n[1].trim();if(o==="none"||o==="transparent")return null;let r=o.match(/^url\(#([^)]+)\)$/);if(!r)return oe(o);let i=t.match(new RegExp(`<(?:linear|radial)Gradient\\b[^>]*\\bid="${r[1]}"[^>]*>([\\s\\S]*?)</(?:linear|radial)Gradient>`,"i"));if(!i)return null;let s=[];for(let a of i[1].matchAll(/stop-color="([^"]+)"/gi)){let c=oe(a[1].trim());c&&s.push(c)}return s.length?s.reduce((a,c,u)=>re(a,c,1/(u+1)),s[0]):null}function gs(e,t,n,o){if(t.layer==="foreground")return;let r=Fn(t);if(!r)return;let i=n+Ku,s=mt(Ju(t.href),o.decorTop),a=Math.max(0,Math.min(1,t.opacity??1));a<1&&(s=re(o.ground,s,a)),z(e,r,void 0,()=>i,n,s,re(s,o.decorWall,.5),K)}function xs(e,t,n,o,r){if(!t.points||t.points.length<3)return;let i=li(o,r.gaTop);z(e,t.points,t.holes,()=>n+fs,n,i,r.gaWall,K),nf(e,t.points,n+fs)}var fs=.15,On=[.72,.74,.76],_o=1.1,ms=.12,vo=.05,ef=.06,tf=2.4;function nf(e,t,n){let o=He([...t]),r=Je(o,ms/E),i=Je(o,(ms+vo)/E);if(r.length<3||i.length<3)return;for(let a of[n+_o,n+_o*.5])z(e,r,[i.slice().reverse()],()=>a,a-vo,On,W(On,.85),K);let s=ef/2/E;for(let a=0;a<r.length;a++){let c=r[a],u=r[(a+1)%r.length],l=Math.hypot(u.x-c.x,u.y-c.y)*E,f=Math.max(1,Math.round(l/tf));for(let m=0;m<f;m++){let h=m/f,d=c.x+(u.x-c.x)*h,p=c.y+(u.y-c.y)*h,y=[{x:d-s,y:p-s},{x:d+s,y:p-s},{x:d+s,y:p+s},{x:d-s,y:p+s}];z(e,y,void 0,()=>n+_o-vo,n,On,W(On,.8),K)}}}function hs(e,t){return mn(e)<t?ut(e,t):e}var Co=.6,Ms=3,of=.25;function rf(e,t){if(_e(t,e.x,e.y))return 0;let n=1/0;for(let o=0,r=t.length-1;o<t.length;r=o++){let i=t[r],s=t[o],a=s.x-i.x,c=s.y-i.y,u=a*a+c*c||1,l=Math.max(0,Math.min(1,((e.x-i.x)*a+(e.y-i.y)*c)/u));n=Math.min(n,Math.hypot(e.x-(i.x+l*a),e.y-(i.y+l*c)))}return n}function Ss(e,t){let n=e.map(s=>({booth:s,ring:Ne(s)})).filter(s=>!!s.ring&&s.ring.length===4&&!s.booth.points),o=n.map(({ring:s})=>({minX:Math.min(...s.map(a=>a.x)),maxX:Math.max(...s.map(a=>a.x)),minY:Math.min(...s.map(a=>a.y)),maxY:Math.max(...s.map(a=>a.y))})),r=(Ms+Co)/E,i=new Map;return n.forEach(({booth:s,ring:a},c)=>{let u={x:a.reduce((h,d)=>h+d.x,0)/4,y:a.reduce((h,d)=>h+d.y,0)/4},l=[0,1,2,3].map(h=>{let d=a[h],p=a[(h+1)%4],y={x:(d.x+p.x)/2,y:(d.y+p.y)/2},g=y.x-u.x,M=y.y-u.y,P=Math.hypot(g,M)||1,w={x:y.x+g/P*Co/E,y:y.y+M/P*Co/E},x=Ms/E;return o.forEach((b,S)=>{S===c||w.x<b.minX-r||w.x>b.maxX+r||w.y<b.minY-r||w.y>b.maxY+r||(x=Math.min(x,rf(w,n[S].ring)))}),{open:x*E,toward:{x:y.x+g/P*10/E,y:y.y+M/P*10/E},focal:Math.hypot(y.x-t.x,y.y-t.y)}}),f=Math.max(...l.map(h=>h.open)),m=l.filter(h=>h.open>=f-of).sort((h,d)=>h.focal-d.focal)[0];i.set(s.id,m.toward)}),i}var Ps=Ge(require("polygon-clipping"),1);var sf=.45,af=1500,cf=200;function Is(e,t){if(e.role!=="stage"||st(e.stageKind))return e;let n=ie(e);if(!n||n.length<3||Math.abs(Ae(n))*E*E>af)return e;let o=t.filter(s=>_e(n,s.x,s.y));if(!o.length||o.length>cf)return e;let r=sf/E,i=o.map(s=>[[[s.x-r,s.y-r],[s.x+r,s.y-r],[s.x+r,s.y+r],[s.x-r,s.y+r],[s.x-r,s.y-r]]]);try{let s=Ps.default.difference([[...n.map(u=>[u.x,u.y]),[n[0].x,n[0].y]]],...i),a=null,c=0;for(let u of s){let l=u[0].slice(0,-1).map(([m,h])=>({x:m,y:h})),f=Math.abs(Ae(l));f>c&&(c=f,a=l)}return!a||a.length<3?e:{...e,kind:"polygon",points:a,rotation:0}}catch{return e}}var lf=Math.PI/180,se=96,uf=6,ff=60,mf=150,Rs=.2,hf=.35;function df(e,t){let n=Math.atan2(t.x-e.x,t.y-e.y)/lf;return n<0?n+360:n}function Nn(e){if(!e.length)return NaN;let t=[...e].sort((n,o)=>n-o);return t[Math.floor(t.length/2)]}function Dn(e,t,n=2){let o=e.length,r=new Float64Array(o);for(let i=0;i<o;i++){let s=0,a=0;for(let c=-n;c<=n;c++){let u=i+c;if(t)u=(u%o+o)%o;else if(u<0||u>=o)continue;s+=e[u],a++}r[i]=s/a}return r}function ws(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=qn(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=Nn(o.map(g=>g.x)),h=Nn(o.map(g=>g.y)),d=0;for(let g of n)for(let M of g.rows)for(let P of M.pts){let w=Math.hypot(P.x-a.x,P.y-a.y);w>d&&(d=w)}let p=0,y=d*.2;for(let g of n)for(let M of g.rows)for(let P of M.pts)Math.hypot(P.x-m,P.y-h)<y&&p++;Math.hypot(m-a.x,h-a.y)<=d&&p/s<.01&&(c={x:m,y:h})}let u=[];for(let m of n){let h={sectionId:m.sectionId,rMin:1/0,rMax:-1/0,samples:[]};for(let d of m.rows)for(let p of d.pts){let y=Math.hypot(p.x-c.x,p.y-c.y),g=Math.min(se-1,Math.floor(df(c,p)/(360/se)));h.samples.push({r:y,bin:g,levelM:d.levelM}),y<h.rMin&&(h.rMin=y),y>h.rMax&&(h.rMax=y)}h.samples.length&&u.push(h)}if(!u.length)return null;u.sort((m,h)=>m.rMin+m.rMax-(h.rMin+h.rMax));let l=[];for(let m of u){let h=!1;for(let d of l){let p=Math.min(m.rMax,d.rMax)-Math.max(m.rMin,d.rMin),y=Math.min(m.rMax-m.rMin,d.rMax-d.rMin);if(y>1e-9&&p>=hf*y){d.members.push(m),d.rMin=Math.min(d.rMin,m.rMin),d.rMax=Math.max(d.rMax,m.rMax),h=!0;break}}h||l.push({members:[m],rMin:m.rMin,rMax:m.rMax})}let f=[];for(let m of l){let h=new Array(se).fill(null);for(let v of m.members)for(let A of v.samples){let _=h[A.bin];_||(_={samples:[]},h[A.bin]=_),_.samples.push({r:A.r,levelM:A.levelM})}let d=h.map(v=>!!v);if(!d.filter(Boolean).length)continue;let y=[],g=[];for(let v of h){if(!v)continue;let A=1/0,_=-1/0;for(let C of v.samples)C.r<A&&(A=C.r),C.r>_&&(_=C.r);y.push(A),g.push(_)}let M=Nn(y),P=Nn(g);if(!(M>=Rs*P)||!(P>0))continue;let w=[...y].sort((v,A)=>v-A);if(!(w[Math.floor(w.length*.1)]>=Rs*P))continue;let b=h.map(v=>{if(!v)return null;let A=[...v.samples].sort((N,X)=>N.r-X.r),_=A[0].r,C=A[A.length-1].r,B=A[0].levelM,O=-1/0;for(let N of A)N.levelM>O&&(O=N.levelM);let F=[];for(let N of A){let X={r:N.r,l:N.levelM};for(;F.length&&Math.abs(F[F.length-1].r-X.r)<1e-9;){if(F[F.length-1].l<=X.l){X.skip=!0;break}F.pop()}if(!X.skip){for(;F.length>=2;){let V=F[F.length-2],Z=F[F.length-1];if((Z.r-V.r)*(X.l-V.l)-(Z.l-V.l)*(X.r-V.r)<=0)F.pop();else break}F.push(X)}}let D=F.map(N=>N.r),j=F.map(N=>N.l);return{inner:_,outer:C,front:B,top:O,profile:{rs:D,ls:j}}}),S=d.slice();for(let v=0;v<se;v++){if(S[v])continue;let A=-1,_=-1,C=0;for(let U=1;U<=se;U++){let te=(v-U+se*2)%se;if(S[te]){A=te;break}}for(let U=1;U<=se;U++){let te=(v+U)%se;if(S[te]){_=te,C=U;break}}if(A<0||_<0)continue;let B=0;for(let U=1;U<=se;U++){let te=(v-U+se*2)%se;if(d[te]){B=U;break}}if(B-1+C>uf)continue;let F=b[A],D=b[_],j=B/(B+C),N=F.inner+(D.inner-F.inner)*j,X=F.outer+(D.outer-F.outer)*j,V=F.front+(D.front-F.front)*j,Z=F.top+(D.top-F.top)*j;b[v]={inner:N,outer:X,front:V,top:Z,profile:{rs:[N,X],ls:[V,Z]}}}for(let v=0;v<se;v++)b[v]&&(S[v]=!0);let I=360/se,R=[],k=S.filter(Boolean).length,L=[];if(k===se)L.push({start:0,len:se});else{let v=0;for(;S[v];)v=(v+1)%se;let A=-1;for(let _=0;_<=se;_++){let C=(v+_)%se,B=_<se&&S[C];if(B&&A<0)A=C;else if(!B&&A>=0){let O=(C-A+se)%se||se;L.push({start:A,len:O}),A=-1}}}for(let v of L){if(v.len*I<ff&&v.len<se)continue;let A=v.len===se,_=new Float64Array(v.len),C=new Float64Array(v.len),B=new Float64Array(v.len),O=new Float64Array(v.len),F=[];for(let U=0;U<v.len;U++){let te=b[(v.start+U)%se];_[U]=te.inner,C[U]=te.outer,B[U]=te.front,O[U]=te.top,F.push(te.profile??{rs:[te.inner,te.outer],ls:[te.front,te.top]})}let D=Dn(_,A),j=Dn(C,A),N=Dn(B,A),X=Dn(O,A);for(let U=0;U<v.len;U++)D[U]>_[U]&&(D[U]=_[U]),j[U]<C[U]&&(j[U]=C[U]),D[U]>j[U]-1e-6&&(D[U]=Math.max(0,j[U]-1e-6)),X[U]<N[U]&&(X[U]=N[U]);let V={startBin:v.start,binCount:v.len,closed:A,innerR:D,outerR:j,frontLevelM:N,topLevelM:X,profiles:F},Z=(U,te,Q)=>{let fe=F[U],ue=fe.rs,G=fe.ls;if(te<=ue[0]){G[0]>Q&&(G[0]=Q);return}if(te>=ue[ue.length-1]){G[G.length-1]>Q&&(G[G.length-1]=Q);return}for(let H=0;H+1<ue.length;H++)if(te<=ue[H+1]){G[H]>Q&&(G[H]=Q),G[H+1]>Q&&(G[H+1]=Q);return}};for(let U=0;U<v.len;U++){let te=h[(v.start+U)%se];if(te)for(let Q of te.samples){Z(U,Q.r,Q.levelM);let fe=A?(U-1+v.len)%v.len:U-1,ue=A?(U+1)%v.len:U+1;fe>=0&&Z(fe,Q.r,Q.levelM),ue<v.len&&Z(ue,Q.r,Q.levelM)}}R.push(V)}R.reduce((v,A)=>v+A.binCount*I,0)<mf||f.push({arcs:R,sectionIds:m.members.map(v=>v.sectionId),innerRMedian:M,outerRMedian:P})}if(!f.length)return null;if(f.sort((m,h)=>m.innerRMedian-h.innerRMedian),t){let m=f[f.length-1].outerRMedian;if(Math.hypot(t.x-c.x,t.y-c.y)>.9*m)return null}return{centre:c,binCount:se,binStepDeg:360/se,rings:f}}function Es(e,t,n,o){let r=e.binStepDeg,i=n/r-.5-t.startBin;i=(i%e.binCount+e.binCount)%e.binCount,i>t.binCount-1&&(t.closed?i=i-t.binCount<t.binCount-i?0:t.binCount-1:i=i-(t.binCount-1)<e.binCount-i?t.binCount-1:0);let s=Math.floor(i),a=t.closed?(s+1)%t.binCount:Math.min(t.binCount-1,s+1),c=i-s,u=l=>{let f=t.profiles[l],m=f.rs,h=f.ls;if(o<=m[0])return h[0];if(o>=m[m.length-1])return h[h.length-1];for(let d=0;d+1<m.length;d++)if(o<=m[d+1]){let p=m[d+1]-m[d],y=p>1e-9?(o-m[d])/p:0;return h[d]+(h[d+1]-h[d])*y}return h[h.length-1]};return u(s)*(1-c)+u(a)*c}function ko(e,t,n,o,r,i,s,a,c,u=[],l=r){if(t.length!==n.length||t.length<2||i-r<1.5)return;let f=(p,y,g)=>{We(e,p,y,g,u,s,a,{portalBase:l,ao:c})||z(e,p,void 0,()=>g,y,s,a,c)},m=(p,y,g)=>({x:p.x+(y.x-p.x)*g,y:p.y+(y.y-p.y)*g}),h=o?t.length:t.length-1,d=0;for(let p=0;p<h;p++){let y=(p+1)%t.length,g=Math.hypot(n[y].x-n[p].x,n[y].y-n[p].y)*$;if(g<1e-5)continue;let M=(b,S)=>[m(t[p],t[y],b),m(t[p],t[y],S),m(n[p],n[y],S),m(n[p],n[y],b)];f(M(0,1),r,r+.95),f(M(0,1),i-.22,i);let P=Math.ceil((d-.32)/6)*6,w=!1,x=!1;for(let b=P;b<d+g;b+=6){let S=Math.max(0,(b-d)/g),I=Math.min(1,(b+.32-d)/g);I<=S||(f(M(S,I),r+.95,i-.22),w||=S<1e-6,x||=I>1-1e-6)}if(!o&&(p===0&&!w||p===h-1&&!x)){let b=Math.min(1,.32/g);f(M(p===0?0:1-b,p===0?b:1),r+.95,i-.22)}d+=g}}var ot=Ge(require("polygon-clipping"),1),$t=.65;function Oo(e,t){let n=1/0;for(let o of t)for(let r=0;r<o.length;r++){let i=o[r],s=o[(r+1)%o.length],a=s.x-i.x,c=s.y-i.y,u=Math.max(0,Math.min(1,((e.x-i.x)*a+(e.y-i.y)*c)/(a*a+c*c||1)));n=Math.min(n,Math.hypot(e.x-i.x-u*a,e.y-i.y-u*c))}return n}var To=.01;function As(e,t,n,o,r,i,s,a=[],c=!0,u={bays:[],walls:[]}){if(o-r<=1e-5)return;let l=o-r>=3,f=l?o-$t:r;e.setMaterial(5);let m=l?[]:a.filter(b=>{if(b.role!=="entrance"&&b.role!=="exit")return!1;let S=ie(b);if(!S)return!1;let I=_t(S,r,r+Fe(b).heightM);return I!==null&&I.openingTop<=o-.12});if((!m.length||!We(e,t,f,o,m,i,s,{holes:n,portalBase:r}))&&z(e,t,n,()=>o,f,i,s,K,void 0,()=>[0,1,0]),!l){e.setMaterial(0);return}let h=c&&u.bays.length?pf(t,n,Je(t,Zt/E),u):null,d=6/E,p=.22/E,y=a.flatMap(b=>{if(b.role!=="entrance"&&b.role!=="exit")return[];let S=ie(b);return S?.length?[{minX:Math.min(...S.map(I=>I.x)),maxX:Math.max(...S.map(I=>I.x)),minY:Math.min(...S.map(I=>I.y)),maxY:Math.max(...S.map(I=>I.y))}]:[]}),g=Math.min(...t.map(b=>b.x)),M=Math.max(...t.map(b=>b.x)),P=Math.min(...t.map(b=>b.y)),w=Math.max(...t.map(b=>b.y));for(let b=g+d/2;b<M;b+=d)for(let S=P+d/2;S<w;S+=d){if(y.some(R=>b+p>=R.minX&&b-p<=R.maxX&&S+p>=R.minY&&S-p<=R.maxY))continue;let I=[{x:b-p,y:S-p},{x:b+p,y:S-p},{x:b+p,y:S+p},{x:b-p,y:S+p}];!Pe({x:b,y:S},t,n)||Oo({x:b,y:S},[t,...n??[]])<p*Math.SQRT2+(c?Zt/E:0)||h&&Oo({x:b,y:S},h.flat())<p*Math.SQRT2+Zt/E||z(e,I,void 0,()=>f,r,i,s,K)}if(h){for(let[b,...S]of h)z(e,b,S,()=>f,r-To,i,s,K);e.setMaterial(0);return}let x=Je(t,Zt/E);if(c&&x.length>=3){let b=a.filter(R=>{if(R.role!=="entrance"&&R.role!=="exit")return!1;let k=ie(R);return!!k&&k.some(L=>!Pe(L,t,void 0)||Oo(L,[t])<=Zt/E)}),S=[x.slice().reverse()],I=r-To;(!b.length||!We(e,t,I,f,b,i,s,{holes:S,portalBase:r+To}))&&z(e,t,S,()=>f,I,i,s,K)}e.setMaterial(0)}var Lo=.25,Zt=Lo;function pf(e,t,n,o){if(n.length<3)return null;let r=s=>{let a=s.map(c=>[c.x,c.y]);return a.push(a[0]),a},i=s=>{let[a,...c]=s.map(u=>[r(u)]);return ot.default.union(a,...c)};try{let s=[r(e),...(t??[]).map(r)],a=ot.default.difference(s,[r(n)]),c=ot.default.intersection(s,i(o.bays));if(!c.length)return null;let u=ot.default.difference(ot.default.intersection(s,i(o.walls)),c);return ot.default.union(ot.default.difference(a,c),u).map(f=>f.map(m=>m.slice(0,-1).map(([h,d])=>({x:h,y:d}))))}catch{return null}}var bf=.02,yf=.25,gf=1.2,xf=.6,Mf=.45,Sf=2.3,Pf=Math.PI/180,_s=.005;function Xe(e,t,n){let o=n*Pf;return{x:e.x+t*Math.sin(o),y:e.y+t*Math.cos(o)}}function If(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 Rf=24,wf=.01;function Ef(e,t,n,o,r,i,s,a,c){let u=n.binCount,l=Rf,f=$,m=i+.02,h=i-wf,d=[];for(let A=0;A<u;A++){let _=(n.startBin+A+.5)*t.binStepDeg,C=new Float64Array(l+1);for(let B=0;B<=l;B++){let O=o[A]+(r[A]-o[A])*B/l;C[B]=Math.max(m,Es(t,n,_,O)-yf)}d.push(C)}if(c){let A=0;for(let _=0;_+1<u;_++)for(let C=0;C<l;C++){let B=Xe(t.centre,o[_]+(r[_]-o[_])*C/l,(n.startBin+_+.5)*t.binStepDeg),O=Xe(t.centre,o[_+1]+(r[_+1]-o[_+1])*(C+1)/l,(n.startBin+_+1.5)*t.binStepDeg);A=Math.max(A,Math.hypot(O.x-B.x,O.y-B.y))}for(let _=0;_<u;_++){let C=(n.startBin+_+.5)*t.binStepDeg;for(let B=0;B<=l;B++){let O=Xe(t.centre,o[_]+(r[_]-o[_])*B/l,C),F=c(O.x,O.y,A*1.01);F!==null&&(d[_][B]=Math.min(d[_][B],Math.max(h+_s,F-_s)))}}}let p=[s.bandTop[0]*a.top,s.bandTop[1]*a.top,s.bandTop[2]*a.top],y=[s.bandTop[0]*a.bottomCap,s.bandTop[1]*a.bottomCap,s.bandTop[2]*a.bottomCap],g=[s.bandWall[0]*a.top,s.bandWall[1]*a.top,s.bandWall[2]*a.top],M=[s.bandWall[0]*a.wallBottom,s.bandWall[1]*a.wallBottom,s.bandWall[2]*a.wallBottom],P=(A,_)=>{let C=(n.startBin+A+.5)*t.binStepDeg,B=o[A]+(r[A]-o[A])*_/l,O=Xe(t.centre,B,C);return[O.x*f,d[A][_],O.y*f]};{let A=Math.tan(12*Math.PI/180);for(let _=0;_<6;_++){let C=!1;for(let O=0;O<u;O++)for(let F=l-1;F>=0;F--)d[O][F]>d[O][F+1]&&(d[O][F]=d[O][F+1],C=!0);let B=n.closed?u:u-1;for(let O=0;O<B;O++){let F=(O+1)%u;for(let D=0;D<=l;D++){let j=d[F][D]-d[O][D];if(Math.abs(j)>1)continue;let N=o[O]+(r[O]-o[O])*D/l,X=o[F]+(r[F]-o[F])*D/l,V=Xe(t.centre,N,(n.startBin+O+.5)*t.binStepDeg),Z=Xe(t.centre,X,(n.startBin+F+.5)*t.binStepDeg),U=A*Math.hypot(Z.x-V.x,Z.y-V.y)*f;j>U?(d[F][D]=d[O][D]+U,C=!0):-j>U&&(d[O][D]=d[F][D]+U,C=!0)}}if(!C)break}}let w=1,x=(A,_)=>{for(let C=0;C<=l;C+=4)if(Math.abs(d[A][C]-d[_][C])>w)return!0;return Math.abs(d[A][l]-d[_][l])>w},b=Math.tan(38*Math.PI/180),S=A=>(r[A]-o[A])/l*f,I=(A,_)=>d[A][_+1]-d[A][_]>b*Math.max(1e-6,S(A)),R=(A,_)=>{let C=n.closed?(A-1+u)%u:Math.max(0,A-1),B=n.closed?(A+1)%u:Math.min(u-1,A+1);Math.abs(d[C][_]-d[A][_])>w&&(C=A),Math.abs(d[B][_]-d[A][_])>w&&(B=A);let O=Math.max(0,_-1),F=Math.min(l,_+1);O<_&&I(A,O)&&(O=_),F>_&&I(A,_)&&(F=_);let D=P(C,_),j=P(B,_),N=P(A,O),X=P(A,F),V=j[0]-D[0],Z=j[1]-D[1],U=j[2]-D[2],te=X[0]-N[0],Q=X[1]-N[1],fe=X[2]-N[2],ue=Z*fe-U*Q,G=U*te-V*fe,H=V*Q-Z*te,J=Math.hypot(ue,G,H);return J>1e-12?(ue/=J,G/=J,H/=J,G<0&&(ue=-ue,G=-G,H=-H),[ue,G,H]):[0,1,0]},k=(A,_,C=!1)=>{let B=C&&Math.min(A[1],_[1])-i>=3,O=[A[0],B?A[1]-$t:h,A[2]],F=[_[0],B?_[1]-$t:h,_[2]],D=_[0]-A[0],j=_[2]-A[2],N=Math.hypot(D,j);if(!(N>1e-12))return;let X=[j/N,0,-D/N];e.tri(A,_,F,X,g,g,M),e.tri(A,F,O,X,g,M,M)},L=.05*Oe,T=A=>r[A]-o[A]<L,v=n.closed?u:u-1;for(let A=0;A<v;A++){let _=(A+1)%u;if(T(A)||T(_))continue;if(x(A,_)){let j=(n.startBin+A+1)*t.binStepDeg,N=(Q,fe)=>{let ue=(o[A]+o[_])/2,G=(r[A]+r[_])/2,H=ue+(G-ue)*fe/l,J=Xe(t.centre,H,j);return[J.x*f,d[Q][fe],J.y*f]};for(let Q=0;Q<l;Q++){let fe=P(A,Q),ue=P(A,Q+1),G=N(A,Q),H=N(A,Q+1),J=R(A,Q),me=R(A,Q+1);e.triN(fe,G,H,J,J,me,p),e.triN(fe,H,ue,J,me,me,p);let xe=P(_,Q),Ie=P(_,Q+1),ae=N(_,Q),ce=N(_,Q+1),De=R(_,Q),Y=R(_,Q+1);e.triN(ae,xe,Ie,De,De,Y,p),e.triN(ae,Ie,ce,De,Y,Y,p);let he=N(A,Q),Me=N(A,Q+1),rt=N(_,Q+1),it=N(_,Q),Ze=Me[0]-he[0],$e=Me[2]-he[2],Tt=Math.hypot(Ze,$e);if(Tt>1e-12){let Jt=[$e/Tt,0,-Ze/Tt];e.tri(he,Me,rt,Jt,g),e.tri(he,rt,it,Jt,g)}}let X=P(A,0),V=P(_,0),Z=P(_,l),U=P(A,l),te=Q=>[Q[0],h,Q[2]];Math.min(X[1],V[1])-i<3&&(e.tri(te(X),te(Z),te(V),[0,-1,0],y),e.tri(te(X),te(U),te(Z),[0,-1,0],y)),k(X,V,!0),k(U,Z,!0);continue}for(let j=0;j<l;j++){let N=R(A,j),X=R(_,j),V=R(_,j+1),Z=R(A,j+1);if(I(A,j)||I(_,j)){let ue=(Me,rt)=>{let it=(n.startBin+Me+.5)*t.binStepDeg,Ze=o[Me]+(r[Me]-o[Me])*(j+.5)/l,$e=Xe(t.centre,Ze,it);return[$e.x*f,rt,$e.y*f]},G=P(A,j),H=P(_,j),J=ue(A,d[A][j]),me=ue(_,d[_][j]);e.triN(G,H,me,N,X,X,p),e.triN(G,me,J,N,X,N,p);let xe=P(_,j+1),Ie=P(A,j+1),ae=ue(A,d[A][j+1]),ce=ue(_,d[_][j+1]);e.triN(ae,ce,xe,Z,V,V,p),e.triN(ae,xe,Ie,Z,V,Z,p);let De=me[0]-J[0],Y=me[2]-J[2],he=Math.hypot(De,Y);if(he>1e-12){let Me=[-Y/he,0,De/he];e.tri(J,me,ce,Me,g),e.tri(J,ce,ae,Me,g)}continue}let U=P(A,j),te=P(_,j),Q=P(_,j+1),fe=P(A,j+1);e.triN(U,te,Q,N,X,V,p),e.triN(U,Q,fe,N,V,Z,p)}let C=P(A,0),B=P(_,0),O=P(_,l),F=P(A,l),D=j=>[j[0],h,j[2]];Math.min(C[1],B[1])-i<3&&(e.tri(D(C),D(O),D(B),[0,-1,0],y),e.tri(D(C),D(F),D(O),[0,-1,0],y)),k(C,B,!0),k(F,O,!0)}if(!n.closed)for(let A of[0,u-1])for(let _=0;_<l;_++)k(P(A,_),P(A,_+1))}function vs(e,t,n){let{bottomY:o,colors:r,ao:i}=n,s=new Float64Array(t.binCount).fill(-1/0);for(let l of t.rings)for(let f of l.arcs){let m=new Float64Array(f.binCount),h=new Float64Array(f.binCount);for(let p=0;p<f.binCount;p++){let y=(f.startBin+p)%t.binCount,g=Math.max(0,f.innerR[p]-Te);m[p]=Math.max(g,s[y]+.001),h[p]=Math.max(m[p]+.001,f.outerR[p]+Te)}let d=0;for(let p=0;p<f.binCount;p++){let y=f.topLevelM[p]-o;y>d&&(d=y)}d>=gf&&Ef(e,t,f,m,h,o,r,i,n.standTopNear);for(let p=0;p<f.binCount;p++){let y=(f.startBin+p)%t.binCount;h[p]>s[y]&&(s[y]=h[p])}}if(n.deriveShell===!1||If(n.shapes,t))return;let a=t.rings[t.rings.length-1],c=xf*Oe,u=Mf*Oe;for(let l of a.arcs){let f=[],m=[];for(let R=0;R<l.binCount;R++){let k=(l.startBin+R+.5)*t.binStepDeg,L=l.outerR[R]+Te+c;f.push(Xe(t.centre,L,k)),m.push(Xe(t.centre,L+u,k))}let h=-1/0;for(let R=0;R<l.binCount;R++)l.topLevelM[R]>h&&(h=l.topLevelM[R]);let d=h+Sf,p=l.closed?m:[...m,...f.slice().reverse()],y=l.closed?[f.slice().reverse()]:void 0,g=re(r.shellWall,[.66,.71,.72],.62),M=(R,k,L,T,v)=>{let A=Math.abs(T-h)<1e-6?T-bf:T;We(e,R,L,A,n.shapes,r.shellTop,v,{holes:k,portalBase:o,ao:i})||z(e,R,k,()=>A,L,r.shellTop,v,i)},P=Math.max(1,Math.ceil((h-o)/4.5)),w=(h-o)/P,x=new Set,b=n.tierFrontLevels??t.rings.map(R=>{let k=R.arcs.flatMap(L=>Array.from(L.frontLevelM)).filter(Number.isFinite).sort((L,T)=>L-T);return k[Math.floor(k.length/2)]});for(let R of b)Number.isFinite(R)&&R-o>=3&&R<h&&x.add(Math.max(0,Math.min(P-1,Math.floor((R-o)/w))));let S=Math.min(...b.filter(R=>Number.isFinite(R)&&R-o>=3&&R<h));for(let R=0;R<P;R++)o+(R+1)*w<=S-$t&&Number.isFinite(S)&&x.add(R);for(let R=0;R<P;R++){let k=o+(h-o)*R/P,L=o+(h-o)*(R+1)/P;x.has(R)&&L-k>=3.2?(M(p,y,k,k+.45,g),ko(e,f,m,l.closed,k+.45,L-.16,r.shellTop,g,i,n.shapes,o)):M(p,y,k,L-.16,g),M(p,y,L-.16,L,W(g,.62))}ko(e,f,m,l.closed,h,d,r.shellTop,g,i,n.shapes,o);let I=8;for(let R=1;R<m.length;R++){if(I+=Math.hypot(m[R].x-m[R-1].x,m[R].y-m[R-1].y)*$,I<8)continue;I=0;let k=m[R],L=m[R-1],T=k.x-L.x,v=k.y-L.y,A=Math.max(1,Math.hypot(T,v)),_=T/A*.16*Oe,C=v/A*.16*Oe,B=Math.max(1,Math.hypot(k.x-t.centre.x,k.y-t.centre.y)),O=(k.x-t.centre.x)/B*.24*Oe,F=(k.y-t.centre.y)/B*.24*Oe,D=[{x:k.x-_,y:k.y-C},{x:k.x+_,y:k.y+C},{x:k.x+_+O,y:k.y+C+F},{x:k.x-_+O,y:k.y-C+F}];M(D,void 0,o,h,W(g,1.12))}}}var Af=2.5,Cs=.65,_f=2,vf=.03;function Cf(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 No(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<Af||s.pts.length<2)continue;let a=s.pts.map(l=>{let f=l.x-t.x,m=l.y-t.y,h=Math.max(1,Math.hypot(f,m));return{x:l.x-f/h*Cs/E,y:l.y-m/h*Cs/E}}),c=[],u=[a[0]];for(let l=1;l<a.length;l++){let f=a[l-1],m=a[l];Math.hypot(m.x-f.x,m.y-f.y)*E>_f?(u.length>=2&&c.push(u),u=[m]):u.push(m)}u.length>=2&&c.push(u);for(let l of c)Cf(l,vf/E);c.length&&r.push({blockId:i,y:s.y,runs:c})}return r}var ks=.1,kf=1.1,Of=.22,Bo=.95,Fo=.05,Os=1.8;function Ts(e,t,n,o){let r=[.72,.72,.69],i=[.48,.55,.57];for(let s of No(t,n,o)){let a=s.y;for(let c of s.runs){let u=Os;for(let l=1;l<c.length;l++){let f=c[l-1],m=c[l],h=m.x-f.x,d=m.y-f.y,p=Math.hypot(h,d);if(p<1e-5)continue;let y=g=>{let M=-d/p*g/E/2,P=h/p*g/E/2;return[{x:f.x+M,y:f.y+P},{x:m.x+M,y:m.y+P},{x:m.x-M,y:m.y-P},{x:f.x-M,y:f.y-P}]};if(z(e,y(Of),void 0,()=>a+ks,a-kf,r,r,K),z(e,y(Fo),void 0,()=>a+Bo,a+Bo-Fo,i,i,K),u+=p*E,u>=Os||l===c.length-1){u=0;let g=.028/E,M=[{x:f.x-g,y:f.y-g},{x:f.x+g,y:f.y-g},{x:f.x+g,y:f.y+g},{x:f.x-g,y:f.y+g}];z(e,M,void 0,()=>a+Bo-Fo,a+ks,i,i,K)}}}}}var Tf=.9,Lf=1.5,Bf=.3;function Ls(e,t,n){let o=[],r=[],i=Tf/E,s=Lf/E,a=Bf/E;for(let c of e)for(let u of c.runs){if(u.length<2)continue;let l=u.slice(),f=(y,g)=>{let M=l[y],P=l[g],w=Math.hypot(M.x-P.x,M.y-P.y)||1;l[y]={x:M.x+(M.x-P.x)/w*a,y:M.y+(M.y-P.y)/w*a}};f(0,1),f(l.length-1,l.length-2);let m=l.map((y,g)=>{let M=l[Math.max(0,g-1)],P=l[Math.min(l.length-1,g+1)],w=P.x-M.x,x=P.y-M.y,b=Math.hypot(w,x)||1,S=-x/b,I=w/b;return S*(y.x-t.x)+I*(y.y-t.y)<0&&(S=-S,I=-I),{nx:S,ny:I}}),h=l.map((y,g)=>({x:y.x-m[g].nx*s,y:y.y-m[g].ny*s})),d=l.map((y,g)=>({x:y.x+m[g].nx*i,y:y.y+m[g].ny*i})),p=l.map((y,g)=>({x:y.x+m[g].nx*(i+n/E),y:y.y+m[g].ny*(i+n/E)}));o.push([...h,...d.slice().reverse()]),r.push([...d,...p.reverse()])}return{bays:o,walls:r}}var Do=.88,Gn=.27,Ff=1.2,Nf=.01;function Bs(e,t,n,o,r){let i=[.67,.71,.68],s=[i[0]*Do,i[1]*Do,i[2]*Do],a=c=>!!r&&r.some((u,l)=>l!==c&&u?.belowY!=null&&Math.abs(u.belowY-t[c].y)<1e-6&&t[l].blockId===t[c].blockId);for(let c=0;c<t.length;c++){let u=t[c];if(!(u.pts.length<2))for(let l of[0,u.pts.length-1]){let f=u.pts[l],m=u.pts[l===0?1:l-1],h=f.x-m.x,d=f.y-m.y,p=Math.hypot(h,d);if(p<1e-5)continue;h/=p,d/=p;let y=1/0;for(let _=0;_<n.length;_++){let C=n[_],B=n[(_+1)%n.length],O=B.x-C.x,F=B.y-C.y,D=h*F-d*O;if(Math.abs(D)<1e-8)continue;let j=C.x-f.x,N=C.y-f.y,X=(j*F-N*O)/D,V=(j*d-N*h)/D;X>0&&V>=0&&V<=1&&(y=Math.min(y,X))}let g=.3/E,M=y-.04/E;if(!Number.isFinite(y)||y*E>2||M-g<.12/E)continue;let P=!!o&&a(c),w=r?.[c]?.pitch,x=P&&w&&Number.isFinite(w)?Math.min(Ff/E,Math.max(Gn/E,w-Gn/E-Nf/E)):Gn/E,b=-d,S=h;o&&b*(o.x-f.x)+S*(o.y-f.y)<0&&(b=-b,S=-S);let I=Gn/E,R=[{x:f.x+h*g+b*I,y:f.y+d*g+S*I},{x:f.x+h*M+b*I,y:f.y+d*M+S*I},{x:f.x+h*M-b*x,y:f.y+d*M-S*x},{x:f.x+h*g-b*x,y:f.y+d*g-S*x}];if(!R.every(_=>_e(n,_.x,_.y)))continue;let k=r?.[c]?.belowY,L=k==null?0:u.y-k,T=!!o&&L>.03&&L<=.65;if(T&&o){let _=(C,B)=>Math.hypot((C.x+B.x)/2-o.x,(C.y+B.y)/2-o.y);_(R[0],R[1])>_(R[3],R[2])&&(R=[R[3],R[2],R[1],R[0]])}let v=T?Math.ceil((L-1e-8)/.2):1,A=(_,C,B)=>({x:_.x+(C.x-_.x)*B,y:_.y+(C.y-_.y)*B});for(let _=0;_<v;_++){let C=_/v,B=(_+1)/v,O=[A(R[0],R[3],C),A(R[1],R[2],C),A(R[1],R[2],B),A(R[0],R[3],B)],F=u.y+.008-(T?L*(1-B):0);z(e,O,void 0,()=>F,F-(T?L/v+.1:.16),i,s,K)}}}}var Df=.02,Gf=.012,jf=.01,Hf=.3,Vf=.5;function Uf(e,t,n){if(e.length===1)return Math.hypot(t-e[0].x,n-e[0].y);let o=1/0;for(let r=0;r+1<e.length;r++){let i=e[r],s=e[r+1],a=s.x-i.x,c=s.y-i.y,u=a*a+c*c,l=u>1e-12?((t-i.x)*a+(n-i.y)*c)/u:0;l=Math.max(0,Math.min(1,l)),o=Math.min(o,Math.hypot(t-(i.x+l*a),n-(i.y+l*c)))}return o}function Xf(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=Uf(e[s].pts,n,o);c<r&&(r=c,i=e[s].y)}return i}function Fs(e,t,n,o,r,i,s){let a=o.filter(m=>m.pts.length>0);if(a.length<2||t.length<3)return;let c=a.map(m=>{let h=0,d=0;for(let y of m.pts)h+=y.x,d+=y.y;h/=m.pts.length,d/=m.pts.length;let p=0;for(let y of m.pts)p=Math.max(p,Math.hypot(y.x-h,y.y-d));return{cx:h,cy:d,rad:p}}),u=[...t],l=n.map(m=>[...m]),f=Df/E;for(let m of[u,...l])for(let h=0;h<m.length;h++){let d=m[h],p=m[(h+1)%m.length],y=p.x-d.x,g=p.y-d.y,M=Math.hypot(y,g);if(M*E<.05)continue;let P=(d.x+p.x)/2,w=(d.y+p.y)/2,x=g/M,b=-y/M;Pe({x:P+x*f,y:w+b*f},u,l)&&(x=-x,b=-b);let S=r.x-P,I=r.y-w,R=Math.hypot(S,I)||1;if((x*S+b*I)/R>Vf)continue;let k=1/0;for(let O of[.2,.5,.8]){let F=Xf(a,c,d.x+y*O-x*f*2,d.y+g*O-b*f*2);Number.isFinite(F)&&(k=Math.min(k,F))}if(!Number.isFinite(k)||k-i<Hf)continue;let L=i-jf,T=k-Gf,v={x:(d.x-x*f)*E,z:(d.y-b*f)*E},A={x:(p.x-x*f)*E,z:(p.y-b*f)*E},_=[x,0,b],C=W(s,K.wallBottom),B=W(s,K.top);e.tri([v.x,T,v.z],[A.x,T,A.z],[A.x,L,A.z],_,B,B,C),e.tri([v.x,T,v.z],[A.x,L,A.z],[v.x,L,v.z],_,B,C,C)}}function Ns(e,t,n,o,r,i,s,a,c=!1){if(!t.outline||t.outline.length<3)return;let u=n.baseHeightM,l=n.objects.filter(M=>M.type==="shape"&&(M.role==="entrance"||M.role==="exit")),f=ui(o,a.tierTop);if(!r)return;let m=M=>r.deckAt(M.x,M.y),h=Li(t,s),d=h[0]??t.outline;if(r.rowLevels.length>=2){let M=Pn(r.rowLevels),P=Bi(vi(r.rowLevels,n.focal,M),h),w=Ls(No(r.rowLevels,n.focal,u),n.focal,Lo);for(let b of P){let S=Math.max(u,b.topY-Ds);for(let I of i.subtract(b.outline,S))As(e,I,b.holes,S,u,a.tierTop,a.tierWall,l,!c,w);e.setMaterial(5),Fs(e,b.outline,b.holes,r.rowLevels,n.focal,S,a.tierWall),e.setMaterial(0)}P.length||z(e,d,t.holes,()=>r.landingY,u,f,a.tierWall,K);let x={tread:[f[0]*K.top,f[1]*K.top,f[2]*K.top],riser:[f[0]*.72,f[1]*.72,f[2]*.72]};for(let b of h.length?h:[d])ki(e,r.rowLevels,n.focal,r.landingY,x,b,M);Ts(e,r.rowLevels,n.focal,u),Bs(e,r.rowLevels,t.outline,n.focal,M);return}let p=r.flat?1/0:Xi,y=M=>r.normalAt(M.x,M.y),g=r.flat?r.landingY:void 0;for(let M of i.subtract(d,g))z(e,M,t.holes,m,u,f,a.tierWall,K,p,y)}function Kf(e,t,n){let o=new Set;for(let s of e.objects)s.type==="section"&&o.add(s.id);let r=new Map;for(let s=0;s<t.length;s++){let a=n.seatOwner[s];if(!a||!o.has(a))continue;let c=n.bySection.get(a);if(c&&c.rowLevels.length>=2)continue;let u=t[s];if(u.kind==="booth")continue;let l=r.get(a);l||(l=new Map,r.set(a,l));let f=u.rowId||`__seat-${s}`,m=l.get(f);m||(m={pts:[],levelM:0,n:0},l.set(f,m)),m.pts.push({x:u.x,y:u.y}),m.levelM+=n.seatDeckY(s),m.n++}let i=[];for(let s of e.objects){if(s.type!=="section")continue;let a=n.bySection.get(s.id);if(a&&a.rowLevels.length>=2){let u=a.rowLevels.filter(l=>!l.patch).map(l=>({pts:l.pts,levelM:l.y}));u.length>=2&&i.push({sectionId:s.id,rows:u});continue}let c=r.get(s.id);c&&i.push({sectionId:s.id,rows:[...c.values()].map(u=>({pts:u.pts,levelM:u.levelM/u.n}))})}return i}function Yf(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 Ds=.02;function Wf(e,t){let n=e.objects.filter(o=>o.type==="section"&&!!o.outline&&o.outline.length>=3).flatMap(o=>{let r=t.bySection.get(o.id);if(!r)return[];let i=1/0,s=-1/0,a=1/0,c=-1/0;for(let l of o.outline)l.x<i&&(i=l.x),l.x>s&&(s=l.x),l.y<a&&(a=l.y),l.y>c&&(c=l.y);let u=r.landingY;for(let l of r.rowLevels)u=Math.min(u,l.y-Ds);return[{outline:o.outline,holes:o.holes,surface:r,floorTop:u,minX:i,maxX:s,minY:a,maxY:c}]});return(o,r,i)=>{let s=null;for(let a of n){if(o<a.minX-i||o>a.maxX+i||r<a.minY-i||r>a.maxY+i)continue;let c={x:o,y:r};if(!Pe(c,a.outline,a.holes)&&Yf(c,a.outline)>i)continue;let u=Math.min(a.surface.deckAt(o,r),a.floorTop);(s===null||u<s)&&(s=u)}return s}}var zf=3,Zf=.4;function Gs(e,t,n,o,r,i,s=!0){let a=Kf(t,n,o);if(a.length<zf)return;let c=ws(a,t.focal);if(!c)return;let u=Math.max(0,...c.rings.map(l=>l.arcs.reduce((f,m)=>f+m.binCount,0)))/c.binCount;e.setMaterial(5),vs(e,c,{bottomY:t.baseHeightM,tierFrontLevels:a.map(l=>Math.min(...l.rows.map(f=>f.levelM))),colors:{bandTop:W(r.tierTop,.8),bandWall:r.tierWall,shellTop:i??W(r.tierWall,1.15),shellWall:i??r.tierWall},ao:K,shapes:t.objects.filter(l=>l.type==="shape"),deriveShell:s&&u>=Zf,standTopNear:Wf(t,o)}),e.setMaterial(0)}var js=4;var $f=[[/\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"]],Qf=1.2,qf=12;function Hs(e){if(e.heightM!==void 0)return!1;let t=ie(e);if(!t||t.length<3)return!1;let n=0;for(let r=0;r<t.length;r++){let i=t[r],s=t[(r+1)%t.length];n+=Math.hypot(s.x-i.x,s.y-i.y)}return n*$<qf*2?!1:2*Qt(t)/n*$<=Qf}function Go(e){if(!e)return null;for(let[t,n]of $f)if(t.test(e))return n;return null}var Us="auto-rows-";function Xs(e){return e.id.startsWith(Us)&&!e.label}var Jf=1.15,em=.09,Ks=6,tm=34,nm=.35,om=6,rm=.35,im=.75,sm=12,am=2.5,cm=40,lm=[18,24],um=[12,16],Vs=14,fm=.8,mm=.6,hm=5,dm=.3,Ys=.4,Ws=2,pm=400,bm=2.6,ym=.8,gm=4,xm=26,Mm=.7,Sm=.5,Pm=.985,Im=1.5,Rm=2.2,wm=3,Em=25,Am=.985,_m=2,vm=6,Cm=3,km=.1,Om=1.5,Tm=1.6,Lm=6e3,Bm=.6,Fm="#c3c7cd",jo=300,Nm=240;function Dm(e,t,n,o){if(!e.fill||!/^#[0-9a-f]{6}$/i.test(e.fill))return null;let r=Vo([...t]),i=new Set;for(let l of o)i.add(Math.floor(Math.atan2(l.y-r.y,l.x-r.x)*180/Math.PI/10));if(i.size*10<Nm)return null;let{h:s,s:a,l:c}=Gr(Dr(e.fill));return s<70/360||s>170/360||a<.2||c<.08||c>.75||n.some(l=>l!==e&&l.type==="shape"&&ie(l)?.some(f=>Ko(f,t)))?null:e.kind==="ellipse"?"oval-cricket":e.kind==="rect"?"pitch-football":null}var Gm="Estimated from the drawing; confirm with the venue.",Uo=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},Vo=e=>({x:e.reduce((t,n)=>t+n.x,0)/e.length,y:e.reduce((t,n)=>t+n.y,0)/e.length}),Qt=e=>{let t=0;for(let n=0;n<e.length;n++){let o=e[n],r=e[(n+1)%e.length];t+=o.x*r.y-r.x*o.y}return Math.abs(t)/2};function jm(e){return e.height!==void 0||e.rake!==void 0||e.elevation!==void 0||e.surfaceKind!==void 0}function Xo(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 Ko(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 Yo(e,t){let n=t[0],o=1/0;for(let r=0;r<t.length;r++){let i=t[r],s=t[(r+1)%t.length],a=s.x-i.x,c=s.y-i.y,u=a*a+c*c,l=u>0?Math.max(0,Math.min(1,((e.x-i.x)*a+(e.y-i.y)*c)/u)):0,f={x:i.x+a*l,y:i.y+c*l},m=Math.hypot(e.x-f.x,e.y-f.y);m<o&&(o=m,n=f)}return n}function zs(e,t){let n=0,o=0;for(let r of e.values()){if(r.length<3)continue;let i=r[0],s=r[r.length-1],a=s.x-i.x,c=s.y-i.y,u=Math.hypot(a,c);if(u<1e-6)continue;let l={x:(i.x+s.x)/2,y:(i.y+s.y)/2},f=Yo(l,t),m=f.x-l.x,h=f.y-l.y,d=Math.hypot(m,h);d<1e-6||(o+=Math.abs((-c*m+a*h)/(u*d))*r.length,n+=r.length)}return n?o/n:0}function Hm(e,t,n){let o=e.filter(p=>p.type==="shape"),r=o.find(p=>p.role==="stage");if(r){let p=ie(r);return p?{shape:r,centre:Vo(p),outline:p,inferred:!1}:null}if(!n.length)return null;let i=1/0,s=-1/0,a=1/0,c=-1/0;for(let p of n)i=Math.min(i,p.x),s=Math.max(s,p.x),a=Math.min(a,p.y),c=Math.max(c,p.y);let u=(s-i)*(c-a),l=[];for(let p of o){if(p.role)continue;let y=ie(p);if(!y)continue;let g=Qt(y);if(g*$*$<6||g>u)continue;let M=Math.min(...y.map(R=>R.x)),P=Math.max(...y.map(R=>R.x)),w=Math.min(...y.map(R=>R.y)),x=Math.max(...y.map(R=>R.y)),b=0;for(let R of n)R.x>M&&R.x<P&&R.y>w&&R.y<x&&Ko(R,y)&&b++;if(b>n.length*.05)continue;let S=Vo(y),I=zs(t,y);I>=fm&&l.push({shape:p,centre:S,outline:y,score:I,area:g,box:[M,w,P,x]})}let f=(p,y)=>y!==p&&y.area>p.area&&p.box[0]>=y.box[0]-1e-6&&p.box[1]>=y.box[1]-1e-6&&p.box[2]<=y.box[2]+1e-6&&p.box[3]<=y.box[3]+1e-6,m=l.filter(p=>!l.some(y=>f(p,y))),h=Math.max(0,...m.map(p=>p.score)),d=m.filter(p=>p.score>=h-.03).sort((p,y)=>y.area-p.area)[0]??null;return d?{shape:d.shape,centre:d.centre,outline:d.outline,inferred:!0}:null}function Vm(e,t,n){if(!n||n.length<3)return Math.hypot(e.x-t.x,e.y-t.y);let o=Yo(e,n);return Math.hypot(e.x-o.x,e.y-o.y)}function Zs(e){let t=[...e].sort((i,s)=>i.x-s.x||i.y-s.y);if(t.length<3)return t;let n=(i,s,a)=>(s.x-i.x)*(a.y-i.y)-(s.y-i.y)*(a.x-i.x),o=[];for(let i of t){for(;o.length>=2&&n(o[o.length-2],o[o.length-1],i)<=0;)o.pop();o.push(i)}let r=[];for(let i=t.length-1;i>=0;i--){let s=t[i];for(;r.length>=2&&n(r[r.length-2],r[r.length-1],s)<=0;)r.pop();r.push(s)}return[...o.slice(0,-1),...r.slice(0,-1)]}function Um(e){if(!e.length||e.length>Lm)return[];let t=[...Xo(e).values()],n=t.map((a,c)=>c),o=a=>n[a]===a?a:n[a]=o(n[a]),r=Tm/$,i=t.map(a=>({minX:Math.min(...a.map(c=>c.x))-r,maxX:Math.max(...a.map(c=>c.x))+r,minY:Math.min(...a.map(c=>c.y))-r,maxY:Math.max(...a.map(c=>c.y))+r}));for(let a=0;a<t.length;a++)for(let c=a+1;c<t.length;c++){let u=i[a],l=i[c];if(u.maxX<l.minX||l.maxX<u.minX||u.maxY<l.minY||l.maxY<u.minY)continue;t[a].some(m=>t[c].some(h=>Math.hypot(m.x-h.x,m.y-h.y)<=r))&&(n[o(a)]=o(c))}let s=new Map;return t.forEach((a,c)=>{let u=o(c),l=s.get(u);l?l.push(...a):s.set(u,[...a])}),[...s.values()].filter(a=>new Set(a.map(c=>c.rowId)).size>=2)}function Xm(e,t,n){if(!t.length)return null;let o=t.filter(I=>n.tableIds.has(I.rowId)||I.kind==="booth").length>t.length/2,r=Xo(t),i=!n.outline||zs(r,n.outline)>=mm,s=0,a=0;for(let I of r.values()){if(I.length<2)continue;let R=I[0],k=I[I.length-1],L=k.x-R.x,T=k.y-R.y,v=Math.hypot(L,T);if(v<1e-6)continue;let A={x:(R.x+k.x)/2,y:(R.y+k.y)/2},_=i?n.outline?Yo(A,n.outline):n.focal:n.middle,C=-T/v,B=L/v;C*(_.x-A.x)+B*(_.y-A.y)<0&&(C=-C,B=-B),s+=C*I.length,a+=B*I.length}let c={x:t.reduce((I,R)=>I+R.x,0)/t.length,y:t.reduce((I,R)=>I+R.y,0)/t.length};if(Math.hypot(s,a)<1e-9){let I=i?n.focal:n.middle;s=I.x-c.x,a=I.y-c.y}let u=Math.hypot(s,a)||1,l={x:s/u,y:a/u},f=I=>-(I.x*l.x+I.y*l.y),m=I=>-I.x*l.y+I.y*l.x,h=1/0,d=-1/0,p=1/0,y=-1/0,g=1/0,M=new Map;for(let I of t){let R=f(I),k=m(I);h=Math.min(h,R),d=Math.max(d,R),p=Math.min(p,k),y=Math.max(y,k),i&&(g=Math.min(g,Vm(I,n.focal,n.outline)));let L=I.logicalRowId??I.rowId,T=M.get(L);T?T.push(R):M.set(L,[R])}i||(g=Math.max(0,h-f(n.middle)));let P=[...M.values()].map(I=>Uo(I)).sort((I,R)=>I-R),w=[];if(!o)for(let I of P)w.length&&I-w[w.length-1]<rm/$||w.push(I);let x=jm(e),b=Qe(e,{floorBaseHeightM:n.baseHeightM}),S={id:e.id,section:e,authored:x,plane:n,facing:l,facesAction:i,hull:Zs(t),sample:t.filter((I,R)=>R%Math.ceil(t.length/pm)===0),frontD:h,backD:d,latMin:p,latMax:y,frontDistance:g,rowDepths:w,rowCount:w.length,level:0,height:b.height,rake:x?b.rake:0,backHeight:0};return S.backHeight=S.height+(d-h)*$*Math.tan(S.rake*Math.PI/180),S}function Km(e,t,n,o){if(e.length<2)return 0;let r=Math.max(1,t*$),i=n+Jf-o,s=0,a=0;for(let u=1;u<e.length;u++){let l=Math.max(im,(e[u]-e[u-1])*$),f=(i+em)*(r+l)/r;s+=f-i,a+=l,i=f,r+=l}let c=Math.atan(s/a)*180/Math.PI;return Math.round(Math.max(Ks,Math.min(tm,c))*10)/10}function Ym(e,t,n=!1){if(!n&&e.facing.x*t.facing.x+e.facing.y*t.facing.y<dm)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:Ys*(e.latMax-e.latMin)))return null;let a=Ws/$,c=new Map,u=new Map;for(let m of e.sample){let h=Math.floor((-m.x*e.facing.y+m.y*e.facing.x)/a),d=-(m.x*e.facing.x+m.y*e.facing.y);c.set(h,Math.min(c.get(h)??1/0,d))}for(let m of t.sample){let h=Math.floor((-m.x*e.facing.y+m.y*e.facing.x)/a),d=-(m.x*e.facing.x+m.y*e.facing.y);u.set(h,Math.max(u.get(h)??-1/0,d))}let l=[];for(let[m,h]of c){let d=u.get(m);d!==void 0&&l.push(h-d)}let f=l.length?Uo(l):e.frontD-o;return f<-1/$?null:f}function Wm(e,t){if(t.plane.floorIndex>=e.plane.floorIndex)return!1;let n=-1/0,o=1/0,r=1/0,i=-1/0;for(let c of t.hull){let u=-(c.x*e.facing.x+c.y*e.facing.y);n=Math.max(n,u),o=Math.min(o,u);let l=-c.x*e.facing.y+c.y*e.facing.x;r=Math.min(r,l),i=Math.max(i,l)}let s=Math.min(e.latMax,i)-Math.max(e.latMin,r),a=Math.min(e.backD,n)-Math.max(e.frontD,o);return s>Ys*(e.latMax-e.latMin)&&a>1/$}function zm(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 Zm(e,t){let n=1/0,o=-1/0;for(let i of t.hull){let s=-(i.x*e.facing.x+i.y*e.facing.y);n=Math.min(n,s),o=Math.max(o,s)}let r=Math.max(0,Math.min(o-n,e.frontD-n));return t.height+r*$*Math.tan(t.rake*Math.PI/180)}function $m(e,t){if(!e.facesAction)return!1;let n={x:-e.facing.y,y:e.facing.x},o=Ws/$,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>=Pm))for(let c of a.sample){let u=-(c.x*e.facing.x+c.y*e.facing.y);if(u<e.frontD||u>e.backD)continue;let l=-c.x*e.facing.y+c.y*e.facing.x,f=l<e.latMin?"left":l>e.latMax?"right":null;if(!f)return!1;let m=Math.min(r-1,Math.floor((u-e.frontD)/o)),h=f==="left"?e.latMin-l:l-e.latMax;h<(i[f].get(m)?.gap??1/0)&&i[f].set(m,{gap:h,other:a})}let s=a=>{let c=a==="left"?e.latMin:e.latMax,u=0;for(let[l,{other:f}]of i[a]){if((f.facing.x*n.x+f.facing.y*n.y)*(a==="left"?1:-1)<Mm)continue;let h=e.frontD+(l+.5)*o,d={x:-h*e.facing.x+c*n.x,y:-h*e.facing.y+c*n.y},p=-(d.x*f.facing.x+d.y*f.facing.y),y=-d.x*f.facing.y+d.y*f.facing.x;p<f.frontD&&y>=f.latMin&&y<=f.latMax&&u++}return u/r>=Sm};return s("left")&&s("right")}function Qm(e,t){if(t.plane.floorIndex!==e.plane.floorIndex||t.facing.x*e.facing.x+t.facing.y*e.facing.y<Am)return!1;let n=1/0,o=-1/0,r=1/0;for(let a of t.hull){let c=-a.x*e.facing.y+a.y*e.facing.x;n=Math.min(n,c),o=Math.max(o,c),r=Math.min(r,-(a.x*e.facing.x+a.y*e.facing.y))}let i=(e.frontD-r)*$;if(i<-_m||i>vm)return!1;let s=Math.max(n-e.latMax,e.latMin-o);return s*$<=Cm&&s*$>=-km}function qm(e,t=!1,n=!1,o){let r=t?um:lm,i=new Set(n?[]:e.filter(p=>!p.authored&&$m(p,e))),s=[...e].sort((p,y)=>p.plane.floorIndex-y.plane.floorIndex||Number(i.has(y))-Number(i.has(p))||p.frontDistance-y.frontDistance);for(let p of i)o?.add(p.id);let a=(p,y,g)=>{let M=new Map,P=[],w=new Map,x=b=>{if(b.plane.floorIndex===0||b.plane.baseHeightM>0)return b.plane.baseHeightM;let S=w.get(b.plane.floorIndex-1);return S===void 0?b.plane.baseHeightM:S+js};for(let b of s){if(i.has(b))b.height=x(b),b.level=0,b.rake=0,b.backHeight=b.height,M.set(b.id,void 0);else if(!b.authored){let I=x(b),R;for(let A of P){if(A.plane.floorIndex>b.plane.floorIndex)continue;if(Wm(b,A)){let O=Zm(b,A)+bm;O>I&&(I=O,R=A);continue}let _=Ym(b,A,i.has(A));if(_==null)continue;let C=n&&!!b.plane.stageDeck&&A.level===0&&A.plane.floorIndex===b.plane.floorIndex&&Math.max(0,_)*$<=gm,B=i.has(A)?A.height+Im:C?A.backHeight:A.backHeight+nm+Math.min(om,Math.max(0,_)*$)*Math.tan(A.rake*Math.PI/180);B>I&&(I=B,R=A)}let k=p.get(b);k&&k.height>I+.01?(I=k.height,R=void 0):k=void 0,b.height=Math.round(Math.min(I,b.plane.baseHeightM+cm)*100)/100;let L=!R&&!k&&b.height>b.plane.baseHeightM;if(b.level=R?R.level+1:k?k.level:L?1:0,b.rake=Km(b.rowDepths,b.frontDistance,b.height,b.plane.focalHeightM),!b.facesAction&&b.rowCount<hm)b.rake=0;else if(b.level===0){let A=Math.max(1e-6,(b.backD-b.frontD)*$);b.rake=Math.min(b.rake,sm,Math.round(Math.atan(am/A)*1800/Math.PI)/10)}else b.rowCount>=2&&(b.rake=Math.max(b.rake,r[Math.min(b.level,r.length)-1]));let T=(b.backD-b.frontD)*$,v=R&&i.has(R)||k&&g?.has(k.id);if(y!==void 0&&v&&b.rowCount>=2&&(b.rake=y),t&&T>0&&b.height+T*Math.tan(b.rake*Math.PI/180)>b.plane.baseHeightM+Vs){let A=Math.max(0,b.plane.baseHeightM+Vs-b.height);b.rake=Math.max(Ks,Math.round(Math.atan(A/T)*1800/Math.PI)/10)}n&&b.plane.stageDeck&&b.level>0&&(b.rake=Math.min(b.rake,xm)),b.backHeight=b.height+T*Math.tan(b.rake*Math.PI/180),M.set(b.id,R?.id??(k?M.get(k.id):void 0))}let S=b.plane.floorIndex;w.set(S,Math.min(w.get(S)??1/0,b.height)),P.push(b)}return M},c=a(new Map),u=new Map,l=p=>u.get(p)?.height??p.height;for(let p=!0,y=0;p&&y<e.length;y++){p=!1;for(let g of e)if(!(g.authored||i.has(g)))for(let M of e){let P=u.get(M)??M;M===g||P.height-P.plane.baseHeightM<Om||P.height<=l(g)+.01||Qm(g,M)&&(u.set(g,P),p=!0)}}let f=new Map(e.map(p=>[p.id,p])),m=e.filter(p=>!p.authored&&p.rowCount>=2&&i.has(f.get(c.get(p.id)??""))),h=m.length?Uo(m.map(p=>p.rake)):void 0;if(!u.size&&h===void 0)return c;let d=new Map([...new Set(u.values())].map(p=>[p,{...p}]));return a(new Map([...u].map(([p,y])=>[p,d.get(y)])),h,new Set(m.map(p=>p.id)))}var Ho=(e,t)=>!!e&&e.x===t.x&&e.y===t.y;function $s(e,t={x:0,y:-40}){let n=gt(e),o=new Map;for(let g of n){if(!g.sectionId)continue;let M=o.get(g.sectionId);M?M.push(g):o.set(g.sectionId,[g])}let r={focalInferred:!1,confident:!1,sections:[]},i=e.floors?.length?e.floors.map((g,M)=>({objects:g.objects,floorIndex:M,floorId:g.id,baseHeightM:g.baseHeightM??0,focal:g.focalPoint??e.focalPoint})):[{objects:e.objects,floorIndex:0,floorId:void 0,baseHeightM:0,focal:e.focalPoint}],s=new Set(i.flatMap(g=>g.objects.filter(M=>M.type==="table").map(M=>M.id))),a=[],c,u=new Set,l=i.map(g=>{let M=v=>!e.floors?.length||v.floorId===g.floorId,P=Um(n.filter(v=>!v.sectionId&&v.kind!=="booth"&&!s.has(v.rowId)&&M(v))),w=[];for(let v of P){let A=Le(He(Zs(v)),Bm/$);if(n.some(C=>!M(C)&&Ko(C,A)))continue;let _=`${Us}${g.floorIndex}-${w.length}`;u.add(_),o.set(_,v),w.push({type:"section",id:_,label:"",color:Fm,outline:A})}let x=w.length?{...g,objects:[...g.objects,...w]}:g,b=new Set(x.objects.filter(v=>v.type==="section").map(v=>v.logicalSectionId??v.id)),S=[...o.entries()].filter(([v])=>b.has(v)).flatMap(([,v])=>v),I=Hm(x.objects,Xo(S),S),R=x.focal;(I||x.focal&&!Ho(x.focal,t))&&(r.confident=!0),I&&(r.stage??={id:I.shape.id,inferred:I.inferred,...x.floorId?{floorId:x.floorId}:{}},(I.inferred||Ho(x.focal,t))&&(R=I.centre,r.focalInferred=!0));let k=I&&(!I.inferred||Qt(I.outline)*$*$<=jo),L=I?void 0:c,T={tableIds:s,floorIndex:x.floorIndex,floorId:x.floorId,baseHeightM:x.baseHeightM,focal:L?.focal??R,outline:I?.outline??L?.outline,focalHeightM:L?.focalHeightM??x.baseHeightM+(I&&k?Fe({...I.shape,role:"stage"}).heightM:0),stageDeck:L?.stageDeck??!!(I&&k&&Qt(I.outline)*$*$<=jo),middle:S.length?{x:S.reduce((v,A)=>v+A.x,0)/S.length,y:S.reduce((v,A)=>v+A.y,0)/S.length}:R};for(let v of x.objects){if(v.type!=="section")continue;let A=Xm(v,o.get(v.logicalSectionId??v.id)??[],T);A&&a.push(A)}return T.outline&&(c=T),Ho(x.focal,T.focal)||(r.focal??=[]).push({...x.floorId?{floorId:x.floorId}:{},point:{...T.focal}}),{unit:x,plane:T,stage:I,planeSeats:S}}),f=i.flatMap(g=>g.objects).map(g=>g.type==="shape"&&!g.role&&(Go(g.label)==="wall"||!Go(g.label)&&Hs(g))?{...g,role:"wall"}:g),m=tt({objects:f},n)!==null;m&&(r.indoor=!0);let h=new Set,d=qm(a,m,zm(n,l[0]?.plane.focal??t)<ym,h),p=new Map(a.filter(g=>!g.authored).map(g=>[g.id,g])),y=l.map(({unit:g,plane:M,stage:P,planeSeats:w})=>g.objects.map(x=>{let b=x.type==="shape"&&!x.role&&x.id!==P?.shape.id?Go(x.label):null;if(x.type==="shape"&&!x.role&&x.id!==P?.shape.id&&(b==="wall"||!b&&Hs(x))&&x.type==="shape"){(r.roles??=[]).push({id:x.id,...M.floorId?{floorId:M.floorId}:{},role:"wall"});let{fill:A,..._}=x;return{..._,role:"wall"}}if(b&&x.type==="shape")return(r.roles??=[]).push({id:x.id,...M.floorId?{floorId:M.floorId}:{},role:b}),{...x,role:b};let I=P?.inferred&&x.id===P.shape.id&&x.type==="shape"?Dm(x,P.outline,g.objects,w):null;if(I&&x.type==="shape")return r.stage?.id===x.id&&(r.stage.field=I),{...x,role:"stage",stageKind:I};let R=x.type==="shape"&&x.id===P?.shape.id&&x.heightM===void 0&&!x.stageKind&&a.some(A=>A.plane===M&&(h.has(A.id)||A.level===0&&A.facesAction&&A.rake<=wm&&(A.frontDistance+A.backD-A.frontD)*$>=Em)),k=R?{heightM:Rm}:{};if(P?.inferred&&x.id===P.shape.id&&x.type==="shape"&&Qt(P.outline)*$*$<=jo)return r.stage?.id===x.id&&(r.stage.deck=!0),{...x,role:"stage",...k};if(R&&x.type==="shape"&&x.role==="stage")return{...x,...k};let L=x.type==="section"?p.get(x.id):void 0;if(!L||x.type!=="section")return x;let T=L.rowCount>=2&&L.rake>0;u.has(L.id)?r.looseRowBlocks=(r.looseRowBlocks??0)+1:r.sections.push({id:L.id,floorId:M.floorId,surfaceKind:T?"rakedRows":"flat",height:L.height,rake:L.rake,stackedOn:d.get(L.id)});let v={status:"inferred",source:"public-2d-topology",note:Gm};return{...x,height:L.height,rake:L.rake,surfaceKind:T?"rakedRows":"flat",physical3dProvenance:{height:v,rake:v,surfaceKind:v}}}));if(e.floors?.length){let g=e.floors.map((M,P)=>({...M,objects:y[P],focalPoint:l[P].plane.focal}));return{doc:{...e,floors:g,objects:g[0].objects,focalPoint:g[0].focalPoint},report:r}}return{doc:{...e,objects:y[0],focalPoint:l[0].plane.focal},report:r}}var Qs=/^[\p{L}\p{N}]{1,4}$/u,Jm=/^([\p{L}\p{N}]{2,})[\s\-\u2013\u2014\u00b7_./]+(.+)$/u;function qs(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(Qs.test(s))return s}let i=Jm.exec(e);if(i){let s=i[1].toLocaleLowerCase("en-US"),a=i[2].trim();if((r.startsWith(s)||s.startsWith(r))&&Qs.test(a))return a}return e}var Js={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"},eh=new Map(bo.map(e=>[e.key,e.label]));function th(e){return`picker.access.${e}`}function ea(e){let t=[],n=e.boothType;n&&Object.prototype.hasOwnProperty.call(Js,n)&&t.push({key:`booth:${n}`,icon:"booth",titleKey:`picker.boothType.${n}`,titleFallback:Js[n],tone:"place"});let o=e.wheelchairSpaceType;for(let a of e.accessibility??[]){if(a==="wheelchair"&&o)continue;let c=eh.get(a);c&&t.push({key:`access:${a}`,icon:a,titleKey:th(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 nh=1.5,oh=30,rh=4,ih=3.6,sh=6,Wo=15,ah=3,ch=1;function lh(e){return Math.max(ih,Math.min(sh,2.4+.15*e))}var qt=Math.PI*2;function uh(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-=qt;for(;m<-Math.PI;)m+=qt;return m+r}),s=i.map((f,m)=>m).sort((f,m)=>i[f]-i[m]),a=i[s[0]],c=i[s[s.length-1]];if(c-a>Math.PI)return null;let u=f=>Math.hypot(f.x-t.x,f.y-t.y),l=f=>{let m=e[f],h=(f+e.length-1)%e.length,d=(f+1)%e.length,p=Math.abs(i[h]-i[f])<=Math.abs(i[d]-i[f])?h:d,y=e[p];return u(m)<=u(y)?[m,y]:[y,m]};return{start:a,end:c,startEdge:l(s[0]),endEdge:l(s[s.length-1])}}function ta(e){return e.type==="shape"&&e.role==="wall"&&e.heightM===void 0}function zo(e,t,n=()=>!0){let o=[];for(let c of e){if(!ta(c)||!n(c))continue;let u=ie(c);if(!u||u.length<3)continue;let l=uh(u,t);if(!l)return[];o.push(l)}if(o.length<2)return[];let r=e.flatMap(c=>{if(c.type!=="shape"||c.role!=="entrance"&&c.role!=="exit")return[];let u=ie(c);if(!u?.length)return[];let l=0,f=0;for(let m of u)l+=m.x,f+=m.y;return[{x:l/u.length,y:f/u.length}]}),i=c=>(c%qt+qt)%qt;o.sort((c,u)=>i(c.start)-i(u.start));let s=c=>Math.hypot(c.x-t.x,c.y-t.y),a=[];for(let c=0;c<o.length;c++){let u=o[c],l=o[(c+1)%o.length],f=i(l.start-u.end);if(f<=0||f>=Math.PI/2)continue;let m=b=>i(b-u.end)<f;if(o.some(b=>b!==u&&b!==l&&(m(b.start)||m(b.end)||i(u.end-b.start)<b.end-b.start)))continue;let[d,p]=u.endEdge,[y,g]=l.startEdge,M={x:(d.x+p.x)/2,y:(d.y+p.y)/2},P={x:(y.x+g.x)/2,y:(y.y+g.y)/2},w=Math.hypot(P.x-M.x,P.y-M.y)*E;if(w<nh||w>oh||Math.abs(s(M)-s(P))*E>rh+.2*w)continue;let x={x:(M.x+P.x)/2,y:(M.y+P.y)/2};r.some(b=>m(Math.atan2(b.y-t.y,b.x-t.x))&&Math.abs(s(b)-s(x))*E<=ah)||a.push({quad:[d,p,g,y],mid:x,widthM:w,openingM:lh(w)})}return a}function na(e,t){let n=[];for(let i of t)if(i.text?.trim())for(let s of e){let a=Math.hypot(i.position.x-s.mid.x,i.position.y-s.mid.y)*E;a<=Wo&&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 oa(e,t,n,o,r,i,s,a=()=>!0){let c=zo(t,At(n),a);if(!c.length)return;let u=t.find(f=>ta(f)&&a(f)),l=Tn(u?.fill,s);e.setMaterial(Rn);for(let f of c)r-f.openingM<ch||En(e,f.quad,o+f.openingM,o+r,[],l.top,l.wall,i,r);e.setMaterial(0)}var fh=6,mh=2.2,jn=.1,hh=/^(gate|entrance|entry|exit|way in|way out|door)s?$/i,dh=new Set(["stage","entrance","exit","screen","suite","obstruction","sound","bar","concession","restroom","coat"]),ph=.3,bh=1.8,yh=.9,gh=.55,xh=1,ra=4e3,Mh=6,ia="#d8a425",Sh="#e8c15a",Zo="#1c1608";function sa(e){let t=Ph(e);if(!t)return null;let n=ea(e).find(o=>o.icon===t.icon);return{...t,name:n?.titleFallback??t.icon}}function Ph(e){let t=e.accessibility;if(t?.length)return{icon:t.includes("wheelchair")?"wheelchair":t[0],color:yn(t)};let n=e.commercial;return n?.obstructedView?{icon:"obstructedView",color:ia,ink:Zo}:n?.restrictedView?{icon:"restrictedView",color:ia,ink:Zo}:n?.premium?{icon:"premium",color:Sh,ink:Zo}:null}function Ih(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 Rh=6e3,wh=.25,aa=[-90,90,-135,135,-45,45];function Eh(e,t,n,o){let r=e.flatMap(({id:s,a,members:c})=>{let u=(a.minX+a.maxX)/2,l=(a.minY+a.maxY)/2,f=.5*Math.hypot(a.maxX-a.minX,a.maxY-a.minY),m=1/0;for(let h of c)m=Math.min(m,Math.hypot(t[h].x-u,t[h].y-l));return c.length&&m>=f*wh?[{id:s,cx:u,cy:l,half:f,members:c}]:[]}).sort((s,a)=>s.half-a.half),i=new Map;return r.forEach(({id:s,cx:a,cy:c,members:u},l)=>{let f=o.x-a,m=o.y-c,p=(Math.hypot(f,m)>1e-6?Math.atan2(m,f):0)+aa[l%aa.length]*Math.PI/180,y=Math.cos(p),g=Math.sin(p),M=-1,P=-1/0;for(let w of u){let x=(t[w].x-a)*y+(t[w].y-c)*g;x>P&&(P=x,M=w)}i.set(s,[t[M].x*E,n.seatDeckY(M),t[M].y*E])}),i}function la(e){let{doc:t,units:n,seats:o,surfaces:r,focal:i}=e,s=t.zones??[],a=[];if(s.length){let c=new Map;for(let m of n)for(let h of m.objects)h.type==="section"&&h.zone&&c.set(h.id,h.zone);let u=new Map,l=new Map;for(let m=0;m<o.length;m++){let h=o[m],d=r.seatOwner[m],p=h.zoneId??(d?c.get(d):void 0);if(!p)continue;let y=u.get(p);y||(y={n:0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0,sumY:0},u.set(p,y));let g=l.get(p);g||l.set(p,g=[]),g.push(m),y.n++,h.x<y.minX&&(y.minX=h.x),h.y<y.minY&&(y.minY=h.y),h.x>y.maxX&&(y.maxX=h.x),h.y>y.maxY&&(y.maxY=h.y),y.sumY+=r.seatDeckY(m)}let f=Eh(s.flatMap(m=>{let h=u.get(m.id);return h?[{id:m.id,a:h,members:l.get(m.id)??[]}]:[]}),o,r,i);for(let m of s){let h=u.get(m.id),d=[];for(let[p,y]of c)y===m.id&&d.push(p);if(!h||h.n===0){a.push({id:m.id,label:m.label,color:oe(m.color),sectionIds:d,seatCount:0,center:[0,0,0],radius:0,focalWorld:[(m.focalPoint??i).x*E,1.5,(m.focalPoint??i).y*E]});continue}a.push({id:m.id,label:m.label,color:oe(m.color),sectionIds:d,seatCount:h.n,...f.has(m.id)?{labelAt:f.get(m.id)}:{},center:[(h.minX+h.maxX)/2*E,h.sumY/h.n,(h.minY+h.maxY)/2*E],radius:.5*Math.hypot((h.maxX-h.minX)*E,(h.maxY-h.minY)*E)||1,focalWorld:[(m.focalPoint??i).x*E,1.5,(m.focalPoint??i).y*E]})}}return a}function ua(e){let{doc:t,units:n,seats:o,surfaces:r,seatData:i,hintedSeatFloor:s,zones:a,focal:c}=e,u=[],l=[],f=[],m=new Map;for(let h of n)for(let d of h.objects){if(d.type!=="section"||!d.zone)continue;let p=(d.displayLabel||d.label||"").trim().toLocaleLowerCase();if(!p)continue;let y=t.floors?.[h.index]?.name?.trim().toLocaleLowerCase();if(n.length>1&&y===p)continue;let g=m.get(d.zone);g||m.set(d.zone,g=new Set),g.add(p)}for(let h of a)h.seatCount!==0&&(m.get(h.id)?.has(h.label.trim().toLocaleLowerCase())||u.push({id:`zone:${h.id}`,kind:"zone",text:h.label,anchor:[(h.labelAt??h.center)[0],(h.labelAt??h.center)[1]+fh,(h.labelAt??h.center)[2]],color:t.zones?.find(d=>d.id===h.id)?.color}));{let h=new Map,d=new Map,p=new Map,y=new Map;for(let g=0;g<o.length;g++){let M=r.seatOwner[g];if(!M)continue;let P=h.get(M);P||(P={n:0,x:0,y:0,deck:0},h.set(M,P)),P.n++,P.x+=o[g].x,P.y+=o[g].y,P.deck+=r.seatDeckY(g);let w=o[g].categoryKey;if(w){let b=d.get(M);b||(b=new Map,d.set(M,b)),b.set(w,(b.get(w)??0)+1)}if(o[g].accessibility?.includes("wheelchair")){let b=p.get(M);b?b.push(g):p.set(M,[g])}let x=y.get(M);x||(x={minX:1/0,maxX:-1/0,minY:1/0,maxY:-1/0,minDeck:1/0,maxDeck:-1/0},y.set(M,x)),x.minDeck=Math.min(x.minDeck,r.seatDeckY(g)),x.maxDeck=Math.max(x.maxDeck,r.seatDeckY(g)),o[g].x<x.minX&&(x.minX=o[g].x),o[g].x>x.maxX&&(x.maxX=o[g].x),o[g].y<x.minY&&(x.minY=o[g].y),o[g].y>x.maxY&&(x.maxY=o[g].y)}for(let g of n)for(let M of g.objects){if(M.type!=="section"||Xs(M))continue;let P=h.get(M.id);if(!P||P.n===0)continue;let w=y.get(M.id),x=[P.x/P.n*E,P.deck/P.n,P.y/P.n*E],b=M.displayLabel||M.label||M.id;l.push({id:M.id,floorIndex:g.index,label:b,seatCount:P.n,center:x,radius:Math.max(1,Math.hypot(w.maxX-w.minX,w.maxY-w.minY)*.5*E),box:{min:[w.minX*E-.4,w.minDeck,w.minY*E-.4],max:[w.maxX*E+.4,w.maxDeck+1,w.maxY*E+.4]},focalWorld:[g.focal.x*E,g.baseHeightM+1.5,g.focal.y*E]});let S=t.floors?.[g.index]?.name?.trim().toLocaleLowerCase();if(!(n.length>1&&S===b.trim().toLocaleLowerCase())){let I=Ih(d.get(M.id),t),R=p.get(M.id);u.push({id:`section:${M.id}`,kind:"section",text:b,anchor:[x[0],x[1]+mh,x[2]],floorIndex:g.index,...I?{tint:I}:{},...R?{wheelchairSeats:R}:{}})}}}{for(let x of n)for(let b of x.objects){if(b.type!=="gaArea")continue;let S=ht(b.points);if(!S)continue;let I=b.labelPresentation?.visible===!1?"":b.displayLabel||b.label||b.id,R=b.capacity>0?[I,b.capacity.toLocaleString()].filter(Boolean).join(" \xB7 "):I;R&&u.push({id:`ga:${b.id}`,kind:"ga",text:R,anchor:[S.x*E,x.baseHeightM+bh,S.y*E],floorIndex:x.index})}let h=new Map,d=new Map;for(let x of n)for(let b of x.objects)if(b.type==="section"&&h.set(b.id,b.displayLabel||b.label||b.id),b.type==="row"){let S=b.displayLabel?.trim()||b.segmentedRow?.displayLabel?.trim();S&&d.set(b.id,S)}let p=new Map;for(let x=0;x<o.length;x++){let b=o[x],S=Math.hypot(b.x-c.x,b.y-c.y),I=p.get(b.rowId);(!I||S>I.far)&&p.set(b.rowId,{seat:b,index:x,far:S})}for(let[x,b]of p){let S=r.seatOwner[b.index]??b.seat.sectionId,I=ca(b.seat.label,x,h.get(S??""),d.get(x));I&&u.push({id:`row:${x}`,kind:"row",text:I,anchor:[b.seat.x*E,r.seatDeckY(b.index)+yh,b.seat.y*E],floorIndex:s[b.index]})}let y=new Map;for(let x=0;x<o.length;x++){let b=o[x],S=y.get(b.rowId);S||(S={n:0,x:0,y:0,z:0,minX:1/0,maxX:-1/0,minZ:1/0,maxZ:-1/0,label:ca(b.label,b.rowId,h.get(r.seatOwner[x]??b.sectionId??""),d.get(b.rowId)),sectionId:r.seatOwner[x]??b.sectionId},y.set(b.rowId,S));let I=x*3,R=i.iPosition[I],k=i.iPosition[I+1],L=i.iPosition[I+2];S.n++,S.x+=R,S.y+=k,S.z+=L,S.minX=Math.min(S.minX,R),S.maxX=Math.max(S.maxX,R),S.minZ=Math.min(S.minZ,L),S.maxZ=Math.max(S.maxZ,L)}for(let[x,b]of y)f.push({id:x,label:b.label,sectionId:b.sectionId,seatCount:b.n,center:[b.x/b.n,b.y/b.n,b.z/b.n],radius:Math.max(.8,Math.hypot(b.maxX-b.minX,b.maxZ-b.minZ)*.5)});let g=0,M=(x,b)=>{g++,u.push({id:`access:${o[x].id}`,kind:"access",text:b.name,icon:b.icon,color:b.color,...b.ink?{ink:b.ink}:{},seatWidthM:i.iChairWidth[x]*2,anchor:[o[x].x*E,r.seatDeckY(x)+xh,o[x].y*E],floorIndex:s[x],rowId:o[x].rowId})},P=null,w=()=>{if(P){let x=sa(o[P.seats[0]]),b=P.seats.length,S=Math.max(1,Math.round(b/Mh));for(let I=0;I<S&&g<ra;I++)M(P.seats[Math.min(b-1,Math.floor((I+.5)*b/S))],x)}P=null};for(let x=0;x<o.length&&g<ra;x++){let b=sa(o[x]);if(b&&o[x].accessibility?.length){w(),M(x,b);continue}if(!b){w();continue}P&&P.rowId===o[x].rowId&&P.icon===b.icon?P.seats.push(x):(w(),P={rowId:o[x].rowId,icon:b.icon,seats:[x]})}if(w(),o.length<=Rh)for(let x=0;x<o.length;x++){let b=o[x],S=Ah(b.displayLabel||b.label);S&&u.push({id:`seat:${b.id}`,kind:"seat",seatWidthM:i.iChairWidth[x]*2,text:S,anchor:[b.x*E,r.seatDeckY(x)+gh,b.y*E],floorIndex:s[x],rowId:b.rowId})}}for(let h of n){let d=tt(h,n.length===1?o:o.filter((g,M)=>s[M]===h.index)),p=d?na(zo(h.objects,At(d)),h.objects.filter(g=>g.type==="text")):new Map,y=[...p.values()];for(let g of h.objects){let M=g.type==="text"?p.get(g.id):void 0;if(g.type==="shape"&&(g.role==="entrance"||g.role==="exit")&&hh.test(g.label?.trim()??"")){let P=ie(g),w=P?ht(P):null;if(w&&y.some(x=>Math.hypot(w.x-x.mid.x,w.y-x.mid.y)*E<=Wo+x.widthM))continue}if(M&&g.type==="text")u.push({id:`text:${g.id}`,kind:"gate",text:g.text,icon:"entrance",anchor:[M.mid.x*E,h.baseHeightM+M.openingM+jn,M.mid.y*E],color:g.color,floorIndex:h.index});else if(g.type==="shape"&&g.role&&dh.has(g.role)){let P=ie(g),w=P?ht(P):null;if(!w||!g.label||g.gate?.hideFromBuyers)continue;u.push({id:`architecture:${g.id}`,kind:g.role==="stage"?"stage":g.role==="entrance"||g.role==="exit"?"gate":"annotation",text:g.label,...g.role==="entrance"||g.role==="exit"?{icon:g.role}:{},...g.gate?.stepFree?{stepFree:!0}:{},anchor:[w.x*E,h.baseHeightM+Fe(g).heightM+jn,w.y*E],color:g.fill,floorIndex:h.index})}else if(g.type==="text"){let P=g.semanticKind==="icon"?go(g.iconKey)?.key:void 0,w=g.text||(P?go(P).label:"");if(!w)continue;u.push({id:`text:${g.id}`,kind:"annotation",text:w,...P?{venueIcon:P}:{},anchor:P?[(g.position.x+g.fontSize/2)*E,h.baseHeightM+jn,(g.position.y+g.fontSize/2)*E]:[g.position.x*E,h.baseHeightM+jn,g.position.y*E],color:g.color,rotation:g.rotation,floorIndex:h.index})}else if(g.type==="booth"){if(g.labelPresentation?.visible===!1)continue;let P=Ne(g);if(!P)continue;let w=ht(P);if(!w)continue;u.push({id:`booth:${g.id}`,kind:"booth",text:g.displayLabel||g.label||g.id,anchor:[w.x*E,h.baseHeightM+Ln+ph,w.y*E],floorIndex:h.index})}}}return{labels:u,sections:l,rows:f}}function fa(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 Ah(e){let t=e.lastIndexOf("-");return t>=0&&t<e.length-1?e.slice(t+1):e}function ca(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&&qs(i,n)}function ma(e){let{doc:t,units:n,seats:o,surfaces:r,solids:i,hintedSeatFloor:s,seatFloor:a}=e,c=[];{let u=n.map(()=>({minX:1/0,minY:1/0,minZ:1/0,maxX:-1/0,maxY:-1/0,maxZ:-1/0}));for(let m=0;m<i.floor.length;m+=1){let h=Math.max(0,Math.min(n.length-1,Math.round(i.floor[m]))),d=m*3,p=u[h];p.minX=Math.min(p.minX,i.position[d]),p.minY=Math.min(p.minY,i.position[d+1]),p.minZ=Math.min(p.minZ,i.position[d+2]),p.maxX=Math.max(p.maxX,i.position[d]),p.maxY=Math.max(p.maxY,i.position[d+1]),p.maxZ=Math.max(p.maxZ,i.position[d+2])}let l=new Map;for(let m=0;m<n.length;m++)for(let h of n[m].objects)h.type==="section"&&l.set(h.id,m);let f=n.map(()=>({n:0,minX:1/0,minY:1/0,minDeck:1/0,maxX:-1/0,maxY:-1/0,maxDeck:-1/0,sumX:0,sumDeck:0,sumZ:0}));for(let m=0;m<o.length;m++){let h=r.seatOwner[m],d=(h!==null?l.get(h):void 0)??s[m];if(d===void 0)continue;let p=f[d],y=o[m];p.n++,y.x<p.minX&&(p.minX=y.x),y.y<p.minY&&(p.minY=y.y),y.x>p.maxX&&(p.maxX=y.x),y.y>p.maxY&&(p.maxY=y.y);let g=r.seatDeckY(m);p.sumX+=y.x*E,p.sumDeck+=g,p.sumZ+=y.y*E,p.minDeck=Math.min(p.minDeck,g),p.maxDeck=Math.max(p.maxDeck,g+1.6),a[m]=d}for(let m=0;m<n.length;m++){let h=f[m],d=t.floors?.[m],p=u[m],y=Math.min(h.n?h.minX*E:n[m].focal.x*E-1,Number.isFinite(p.minX)?p.minX:1/0),g=Math.max(h.n?h.maxX*E:n[m].focal.x*E+1,Number.isFinite(p.maxX)?p.maxX:-1/0),M=Math.min(h.n?h.minY*E:n[m].focal.y*E-1,Number.isFinite(p.minZ)?p.minZ:1/0),P=Math.max(h.n?h.maxY*E:n[m].focal.y*E+1,Number.isFinite(p.maxZ)?p.maxZ:-1/0),w=Math.min(h.n?Math.min(n[m].baseHeightM,h.minDeck):n[m].baseHeightM,Number.isFinite(p.minY)?p.minY:1/0),x=Math.max(h.n?Math.max(h.maxDeck,w+.5):w+.5,Number.isFinite(p.maxY)?p.maxY:-1/0),b=[h.n?h.sumX/h.n:(y+g)/2,h.n?h.sumDeck/h.n:(w+x)/2,h.n?h.sumZ/h.n:(M+P)/2],S=Math.max(1,.5*Math.hypot(g-y,x-w,P-M));c.push({index:m,id:d?.id??`floor-${m}`,label:d?.name??(n.length>1?`Floor ${m+1}`:"Venue"),seatCount:h.n,center:b,radius:S,box:{min:[y,w,M],max:[g,x,P]},focalWorld:[n[m].focal.x*E,n[m].baseHeightM+1.5,n[m].focal.y*E]})}}return c}function $o(e,t){let n=1/0,o=1/0,r=-1/0,i=-1/0,s=(a,c)=>{a<n&&(n=a),c<o&&(o=c),a>r&&(r=a),c>i&&(i=c)};for(let a of t)s(a.x,a.y);for(let a of e)for(let c of a.objects)if(c.type==="section")for(let u of c.outline)s(u.x,u.y);else if(c.type==="shape"&&c.points)for(let u of c.points)s(u.x,u.y);else if(c.type==="gaArea")for(let u of c.points)s(u.x,u.y);else if(c.type==="booth"){let u=Ne(c);if(u)for(let l of u)s(l.x,l.y)}else if(c.type==="table"){let u=Bn(c);if(u)for(let l of u)s(l.x,l.y)}else if(c.type==="decorImage"){let u=Fn(c);if(u)for(let l of u)s(l.x,l.y)}return Number.isFinite(n)||(n=-100,o=-100,r=100,i=100),{minX:n,minY:o,maxX:r,maxY:i}}function ga(e,t,n,o,r,i,s){if(t.length===1){let a=n.map(m=>({x:m.x,y:m.y}));for(let m of t[0].objects)m.type==="section"?a.push(...m.outline):m.type==="shape"?a.push(...ie(m)??m.points??[]):m.type==="gaArea"?a.push(...m.points):m.type==="booth"?a.push(...Ne(m)??[]):m.type==="table"?a.push(...Bn(m)??[]):m.type==="decorImage"&&a.push(...Fn(m)??[]);if(pa(e,t[0],n,i)||ya(e,t[0],n,a,i))return!1;if(s&&da(e,t[0].baseHeightM,a,i,s))return!0;let c=Kt(a),u=(r.minX+r.maxX)/2,l=(r.minY+r.maxY)/2,f=c.length>=3?c.map(m=>{let h=m.x-u,d=m.y-l,p=Math.max(1,Math.hypot(h,d));return{x:m.x+h/p*80,y:m.y+d/p*80}}):jt(r.minX-28,r.minY-28,r.maxX-r.minX+56,r.maxY-r.minY+56);return z(e,f,void 0,()=>-.04,-.22,i.ground,i.ground,K),!1}else{let a=t.reduce((y,g)=>g.baseHeightM<y.baseHeightM?g:y);e.setFloor(a.index);let c={...a,objects:t.flatMap(y=>y.objects)},u=n.map(y=>({x:y.x,y:y.y}));for(let y of c.objects)y.type==="section"&&u.push(...y.outline);if(pa(e,c,n,i)||ya(e,c,n,u,i))return!1;if(s&&da(e,a.baseHeightM,u,i,s))return!0;let l=n.filter((y,g)=>o[g]===a.index),f=$o([a],l),m=Math.hypot(f.maxX-f.minX,f.maxY-f.minY),h=Math.max(28,Math.min(80,m*.04)),d=jt(f.minX-h,f.minY-h,f.maxX-f.minX+h*2,f.maxY-f.minY+h*2),p=a.baseHeightM-.03;return z(e,d,void 0,()=>p,p-.22,i.ground,i.ground,K),!1}}function Qo(e,t,n,o){let{cx:r,cz:i,radius:s}=n,a=1/0,c=1/0,u=1/0,l=-1/0,f=-1/0,m=-1/0,h=(y,g,M)=>{a=Math.min(a,y),l=Math.max(l,y),c=Math.min(c,g),f=Math.max(f,g),u=Math.min(u,M),m=Math.max(m,M)};for(let y=0;y<e.position.length;y+=3){let g=y/3;o&&g>=o[0]&&g<o[1]||h(e.position[y],e.position[y+1],e.position[y+2])}for(let y=0;y<t.count;y++){let g=y*3,M=t.iPosition[g],P=t.iPosition[g+1],w=t.iPosition[g+2],x=Math.max(.35,t.iMaxRadius[y]??.35);h(M-x,P,w-x),h(M+x,P+1.6,w+x)}Number.isFinite(a)||(a=r-s,l=r+s,c=0,f=s*.16,u=i-s,m=i+s);let d=[(a+l)/2,(c+f)/2,(u+m)/2],p=Math.max(1,.5*Math.hypot(l-a,f-c,m-u));return{center:d,radius:p,minY:c,maxY:f}}var _h=4096;function xa(e,t,n=[]){let o=Math.max(1,Math.ceil(e.count/_h)),r=Math.ceil(e.count/o),i=new Float32Array((r*2+t.length*4+n.length)*3),s=0;for(let a=0;a<e.count;a+=o){let c=e.iPosition[a*3],u=e.iPosition[a*3+1],l=e.iPosition[a*3+2];i[s++]=c,i[s++]=u,i[s++]=l,i[s++]=c,i[s++]=0,i[s++]=l}for(let[a,c,u]of n)i[s++]=a,i[s++]=c,i[s++]=u;for(let a of t)for(let[c,u]of[[-1,-1],[1,-1],[1,1],[-1,1]])i[s++]=a.cx+c*a.halfX,i[s++]=a.y,i[s++]=a.cz+u*a.halfZ;return i.subarray(0,s)}function Ma(e,t,n,o,r,i,s=[]){let a=1/0,c=1/0,u=-1/0,l=-1/0;for(let x=0;x<e.count;x++){let b=x*3,S=e.iPosition[b],I=e.iPosition[b+2];S<a&&(a=S),S>u&&(u=S),I<c&&(c=I),I>l&&(l=I)}for(let[x,,b]of s)x<a&&(a=x),x>u&&(u=x),b<c&&(c=b),b>l&&(l=b);for(let x of t)a=Math.min(a,x.cx-x.halfX),u=Math.max(u,x.cx+x.halfX),c=Math.min(c,x.cz-x.halfZ),l=Math.max(l,x.cz+x.halfZ);let f=n.minX*E,m=n.maxX*E,h=n.minY*E,d=n.maxY*E,p=f,y=m,g=h,M=d;if(Number.isFinite(a)){let x=Math.max(2,.06*Math.hypot(u-a,l-c));p=Math.max(f,a-x),y=Math.min(m,u+x),g=Math.max(h,c-x),M=Math.min(d,l+x)}let P=Math.min(0,o),w=Math.max(r,i*.05);return{min:[p,P,g],max:[y,w,M]}}var ha=12,vh=.6,Ch=40;function da(e,t,n,o,r){let i=Kt([...n]);if(i.length<3)return!1;let s=1/0,a=1/0,c=-1/0,u=-1/0;for(let w of i)s=Math.min(s,w.x),c=Math.max(c,w.x),a=Math.min(a,w.y),u=Math.max(u,w.y);let l=Math.hypot(c-s,u-a)*E,f=Le(i,ha/E,1.2),m=Math.max(Ch,l*vh),h=Le(i,(ha+m)/E,1.2);if(f.length!==h.length)return!1;let d=re(o.ground,[.78,.76,.72],.35),p=re(o.ground,[.56,.62,.52],.3);z(e,f,void 0,()=>t-.04,t-.22,d,d,K);let y=t-.05,g=f.map(w=>[w.x*E,y,w.y*E]),M=h.map(w=>[w.x*E,y,w.y*E]),P=[0,1,0];for(let w=0;w<g.length;w++){let x=(w+1)%g.length;e.tri(g[w],M[x],M[w],P,p,r,r),e.tri(g[w],g[x],M[x],P,p,p,r)}return!0}function pa(e,t,n,o){let r=tt(t,n);if(!r)return!1;let i=t.baseHeightM,s=re(o.ground,[.62,.55,.47],.4);return z(e,r,void 0,()=>i-.04,i-.22,s,s,K),!0}var kh=3e3,Oh=20,ba=1.5,Th=1.2,Lh=.25;function ya(e,t,n,o,r){if(!n.length||n.length>kh||o.length<3)return!1;for(let R of t.objects){if(R.type==="shape"&&nn(R.stageKind))return!1;if(R.type==="section"){let{height:k}=Qe(R,{floorBaseHeightM:t.baseHeightM});if(k-t.baseHeightM>Oh)return!1}}let i=0,s=0;for(let R of o)i+=R.x,s+=R.y;i/=o.length,s/=o.length;let a=0,c=0,u=0;for(let R of o){let k=R.x-i,L=R.y-s;a+=k*k,c+=L*L,u+=k*L}let l=.5*Math.atan2(2*u,a-c),f=Math.cos(l),m=Math.sin(l),h=-m,d=f,p=1/0,y=-1/0,g=1/0,M=-1/0;for(let R of o){let k=(R.x-i)*f+(R.y-s)*m,L=(R.x-i)*h+(R.y-s)*d;p=Math.min(p,k),y=Math.max(y,k),g=Math.min(g,L),M=Math.max(M,L)}let P=R=>[[p-R,g-R],[y+R,g-R],[y+R,M+R],[p-R,M+R]].map(([k,L])=>({x:i+f*k+h*L,y:s+m*k+d*L})),w=P(ba/E),x=P((ba+Lh)/E),b=t.baseHeightM,S=re(r.ground,[.62,.55,.47],.4),I=re(r.ground,[.86,.86,.84],.55);return z(e,x,void 0,()=>b-.04,b-.22,S,S,K),z(e,x,[w.slice().reverse()],()=>b+Th,b-.04,re(I,[1,1,1],.2),I,K),!0}function Sa(e,t,n){let o=()=>({byObjectId:new Map,elements:[]});if(!t||!e)return o();let r=Rr(t);if(!r.ok||r.value.id!==e)return o();let i=new Map;for(let f of n)for(let m of f.objects)m.type==="shape"&&i.set(m.id,{shape:m,unit:f});let s=new Set,a=new Set,c=new Map((t.overlay.productionElements??[]).map(f=>{let m=f.runtimeContentImageUrl;return[f.id,typeof m=="string"&&/^(?:blob:|data:image\/|https:\/\/)/.test(m)?m:void 0]})),u=[];for(let f of r.value.overlay.productionElements??[]){let m=i.get(f.objectId),h=m?ie(m.shape):null,d=f.baseElevationM??0;if(!m||!h||h.length<3||!f.id||s.has(f.id)||a.has(f.objectId)||!Number.isFinite(f.heightM)||f.heightM<.05||f.heightM>50||!Number.isFinite(d)||d<-10||d>100)return o();s.add(f.id),a.add(f.objectId);let p=h.map(I=>I.x*E),y=h.map(I=>I.y*E),g=m.unit.baseHeightM+d,M=Math.min(...p),P=Math.max(...p),w=Math.min(...y),x=Math.max(...y),b,S=c.get(f.id)??f.contentImageUrl;if(f.kind==="screen"&&S&&(b=Yi(h,g,g+f.heightM,m.unit.focal),!b))if(P-M>=x-w){let I=Math.abs(w-m.unit.focal.y*E)<=Math.abs(x-m.unit.focal.y*E)?w-.006:x+.006;b=[[M,g,I],[P,g,I],[M,g+f.heightM,I],[P,g+f.heightM,I]]}else{let I=Math.abs(M-m.unit.focal.x*E)<=Math.abs(P-m.unit.focal.x*E)?M-.006:P+.006;b=[[I,g,w],[I,g,x],[I,g+f.heightM,w],[I,g+f.heightM,x]]}u.push({id:f.id,objectId:f.objectId,kind:f.kind,floorIndex:m.unit.index,baseY:g,topY:g+f.heightM,bounds:{min:[M,g,w],max:[P,g+f.heightM,x]},occlusion:f.occlusion,...S?{contentImageUrl:S}:{},...b?{contentPlane:b}:{}})}let l=u.sort((f,m)=>f.id.localeCompare(m.id));return{byObjectId:new Map(l.map(f=>[f.objectId,f])),elements:l}}var Pa=[.13,.14,.17],Ot=[.4,.43,.47],Bh=.18,Fh=.02,Nh=2.4,Dh=1500,Gh=240,jh=.25;function Ia(e,t,n,o){let r=t.stageKind??"";if(st(r)||r==="round"||!o.length)return;let i=ie(t);if(!i||i.length<3)return;let s={x:i.reduce((C,B)=>C+B.x,0)/i.length,y:i.reduce((C,B)=>C+B.y,0)/i.length},a=0,c=0,u=new Set;for(let C of o)a+=C.x,c+=C.y,u.add(Math.floor(Math.atan2(C.y-s.y,C.x-s.x)*180/Math.PI/10));let l=s.x-a/o.length,f=s.y-c/o.length,m=Math.hypot(l,f);if(m<1e-6)return;let h=o.reduce((C,B)=>C+Math.hypot(B.x-s.x,B.y-s.y),0)/o.length;if(u.size*10>Gh&&m<jh*h)return;let d=l/m,p=f/m,y=-p,g=d,M=-1/0,P=1/0,w=1/0,x=-1/0;for(let C of i){let B=(C.x-s.x)*d+(C.y-s.y)*p,O=(C.x-s.x)*y+(C.y-s.y)*g;M=Math.max(M,B),P=Math.min(P,B),w=Math.min(w,O),x=Math.max(x,O)}let b=(x-w)*E,S=(M-P)*E;if(b<3||S<1.5||b*S>Dh)return;let I=Bh/E,R=(C,B)=>({x:s.x+d*C+y*B,y:s.y+p*C+g*B}),k=(C,B,O,F)=>[R(C,O),R(C,F),R(B,F),R(B,O)],L=n+Math.max(3.5,Math.min(8,b*.35)),T=n+Math.min(Nh,L-n-1),v=.2/E,A=P+Math.min(S*.25,1.5)/E,_=Fh/E;z(e,k(M-2*I+_,M-I-_,w+I+v,x-I-v),void 0,()=>T,n,Pa,Pa,K);for(let[C,B]of[[w+I,w+I+v],[x-I-v,x-I]])z(e,k(M-2*I,M-I,C,B),void 0,()=>L+.3,n,Ot,Ot,K),z(e,k(A+v,M-2*I,C,B),void 0,()=>L+.3,L,Ot,Ot,K);z(e,k(A,A+v,w+I,x-I),void 0,()=>L+.3,L,Ot,Ot,K)}function ke(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function Ce(e){return Array.isArray(e)?e:[]}function Hh(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 Hn(e,t){return!Array.isArray(e)||e.length!==t||!e.every(n=>typeof n=="number"&&Number.isFinite(n))?null:e}function Vh(){return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}function Uh(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 Xh(e){let t=Hn(e.matrix,16);if(t)return t;if(e.matrix!==void 0)return null;let n=e.translation===void 0?[0,0,0]:Hn(e.translation,3),o=e.rotation===void 0?[0,0,0,1]:Hn(e.rotation,4),r=e.scale===void 0?[1,1,1]:Hn(e.scale,3);if(!n||!o||!r)return null;let[i,s,a,c]=o,u=Math.hypot(i,s,a,c);if(!(u>1e-8))return null;let l=i/u,f=s/u,m=a/u,h=c/u,d=l+l,p=f+f,y=m+m,g=l*d,M=l*p,P=l*y,w=f*p,x=f*y,b=m*y,S=h*d,I=h*p,R=h*y;return[(1-(w+b))*r[0],(M+R)*r[0],(P-I)*r[0],0,(M-R)*r[1],(1-(g+b))*r[1],(x+S)*r[1],0,(P+I)*r[2],(x-S)*r[2],(1-(g+w))*r[2],0,n[0],n[1],n[2],1]}function Kh(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 Yh(e){let t=e[0],n=e[4],o=e[8],r=e[1],i=e[5],s=e[9],a=e[2],c=e[6],u=e[10],l=i*u-s*c,f=s*a-r*u,m=r*c-i*a,h=t*l+n*f+o*m;if(Math.abs(h)<1e-12)return null;let d=1/h;return[l*d,f*d,m*d,(o*c-n*u)*d,(t*u-o*a)*d,(n*a-t*c)*d,(n*s-o*i)*d,(o*r-t*s)*d,(t*i-n*r)*d]}function Ra(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 Wh(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 zh(e){return e===5120||e===5121?1:e===5122||e===5123?2:e===5125||e===5126?4:0}function Zh(e){return e==="SCALAR"?1:e==="VEC2"?2:e==="VEC3"?3:e==="VEC4"?4:0}function $h(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 Qh(e){let t=e instanceof Uint8Array?e:new Uint8Array(e),n=Wh(t);if(!n)return{ok:!1,issue:"invalid_glb"};let{json:o,bin:r}=n;if(!ke(o.asset)||o.asset.version!=="2.0")return{ok:!1,issue:"unsupported_glb"};let i=Ce(o.extensionsUsed).filter(w=>typeof w=="string");if(i.includes("KHR_draco_mesh_compression")||Hh(o))return{ok:!1,issue:"draco_not_allowed"};if(i.length||Ce(o.extensionsRequired).length)return{ok:!1,issue:"unsupported_glb"};if(Ce(o.images).length||Ce(o.textures).length)return{ok:!1,issue:"external_resource"};let s=Ce(o.buffers);if(s.length!==1||!ke(s[0])||s[0].uri!==void 0||typeof s[0].byteLength!="number"||!Number.isInteger(s[0].byteLength)||s[0].byteLength<0||s[0].byteLength>r.byteLength)return{ok:!1,issue:"external_resource"};let a=Ce(o.accessors),c=Ce(o.bufferViews),u=Ce(o.meshes),l=Ce(o.nodes),f=Ce(o.scenes),m=typeof o.scene=="number"?o.scene:0;if(!ke(f[m]))return{ok:!1,issue:"unsupported_glb"};let h=new DataView(r.buffer,r.byteOffset,r.byteLength),d=(w,x,b)=>{if(typeof w!="number"||!Number.isInteger(w)||!ke(a[w]))return null;let S=a[w];if(S.type!==x||S.sparse!==void 0||S.normalized===!0||typeof S.count!="number"||!Number.isInteger(S.count)||S.count<1||typeof S.componentType!="number"||!b.includes(S.componentType)||typeof S.bufferView!="number")return null;let I=c[S.bufferView];if(!ke(I)||I.buffer!==0||typeof I.byteLength!="number"||!Number.isInteger(I.byteLength)||I.byteLength<0)return null;let R=Zh(S.type),k=zh(S.componentType),L=typeof I.byteStride=="number"?I.byteStride:R*k,T=typeof I.byteOffset=="number"?I.byteOffset:0,v=typeof S.byteOffset=="number"?S.byteOffset:0,A=T+v,_=v+(S.count-1)*L+R*k;if(!Number.isInteger(L)||!Number.isInteger(T)||!Number.isInteger(v)||L<R*k||T<0||v<0||T+I.byteLength>r.byteLength||_>I.byteLength)return null;let C=[];for(let B=0;B<S.count;B++){let O=[];for(let F=0;F<R;F++){let D=$h(h,A+B*L+F*k,S.componentType);if(!Number.isFinite(D))return null;O.push(D)}C.push(O)}return C},p=[],y=[],g=0,M=new Set,P=(w,x)=>{if(typeof w!="number"||!Number.isInteger(w)||!ke(l[w])||M.has(w))return!1;M.add(w);let b=l[w],S=Xh(b);if(!S)return!1;let I=Uh(x,S),R=Yh(I);if(!R)return!1;if(b.mesh!==void 0){if(typeof b.mesh!="number")return!1;let k=u[b.mesh];if(!ke(k))return!1;for(let L of Ce(k.primitives)){if(!ke(L)||L.mode!==void 0&&L.mode!==4||!ke(L.attributes))return!1;let T=d(L.attributes.POSITION,"VEC3",[5126]),v=L.attributes.NORMAL===void 0?null:d(L.attributes.NORMAL,"VEC3",[5126]);if(!T||L.attributes.NORMAL!==void 0&&!v)return!1;let A=T.length;if(L.indices!==void 0){let C=typeof L.indices=="number"?a[L.indices]:null;A=ke(C)?C.count:void 0}if(typeof A!="number"||!Number.isInteger(A)||A%3!==0||(g+=A/3,g>1e5))return!1;let _=L.indices===void 0?T.map((C,B)=>[B]):d(L.indices,"SCALAR",[5121,5123,5125]);if(!_||_.length%3!==0||_.length!==A)return!1;for(let C=0;C<_.length;C+=3){let B=[_[C][0],_[C+1][0],_[C+2][0]];if(B.some(D=>!Number.isInteger(D)||D<0||D>=T.length))return!1;let O=B.map(D=>Kh(I,...T[D])),F=null;if(!v){let D=O[1][0]-O[0][0],j=O[1][1]-O[0][1],N=O[1][2]-O[0][2],X=O[2][0]-O[0][0],V=O[2][1]-O[0][1],Z=O[2][2]-O[0][2];F=Ra([1,0,0,0,1,0,0,0,1],j*Z-N*V,N*X-D*Z,D*V-j*X)}for(let D=0;D<3;D++)p.push(...O[D]),y.push(...v?Ra(R,...v[B[D]]):F)}}}for(let k of Ce(b.children))if(!P(k,I))return!1;return M.delete(w),!0};for(let w of Ce(f[m].nodes))if(!P(w,Vh()))return{ok:!1,issue:g>1e5?"triangle_limit":"unsupported_glb"};return!g||p.length!==g*9||y.length!==p.length?{ok:!1,issue:"unsupported_glb"}:{ok:!0,triangleCount:g,position:new Float32Array(p),normal:new Float32Array(y)}}function wa(e){try{return Qh(e)}catch{return{ok:!1,issue:"invalid_glb"}}}function Ea(e){let{doc:t}=e,n=Kr(t.theme),o=n.structure,r=Ti(t,e.eventConfigurationId??t.eventConfigurationId),i=Sa(e.eventConfigurationId,e.eventConfiguration,r),s=e.seats,a=new un,c=null;if(e.registeredShellGlb){let G=wa(e.registeredShellGlb);if(G.ok){let H=G.position.length/3,J=new Float32Array(G.position.length),me=n.materials.shell??o.tierWall;for(let xe=0;xe<H;xe++){let Ie=G.normal[xe*3+1],ae=Ie<-.25?.4:.62+.38*Math.max(0,Ie);J[xe*3]=me[0]*ae,J[xe*3+1]=me[1]*ae,J[xe*3+2]=me[2]*ae}c={position:G.position,normal:G.normal,color:J,floor:new Float32Array(H).fill(-2),material:new Float32Array(H),count:H}}}let u=new Map;for(let G of r)for(let H of G.objects)u.set(H.id,G.index),H.type==="section"&&u.set(H.logicalSectionId??H.id,G.index);let l=s.map(G=>u.get(G.sectionId??"")??u.get(G.rowId??"")??0),f=$o(r,s),m=a.vertexCount,d=ga(a,r,s,l,f,o,re(n.background.top,n.background.bottom,.5))?a.vertexCount:m,p=fi(t,s),y=new Map,g=new Map;for(let G of t.categories??[])y.set(G.key,G.color),G.seatGlyph&&g.set(G.key,G.seatGlyph);let M=[],P=Ki(r,s,l),w=new Map;s.forEach((G,H)=>{let J=P.seatDeckY(H);Number.isFinite(J)&&w.set(G.rowId,Math.min(w.get(G.rowId)??1/0,J))});let x=new Float32Array(s.length),b=[],S=new Map((t.floors??[]).map((G,H)=>[G.id,H])),I=r.map(()=>[]);for(let G of s){let H=G.floorId?S.get(G.floorId)??0:0;I[Math.min(H,I.length-1)]?.push(G)}let R=(G,H)=>{if(!H||H.length<3)return!1;let J=Math.min(...H.map(ae=>ae.x)),me=Math.max(...H.map(ae=>ae.x)),xe=Math.min(...H.map(ae=>ae.y)),Ie=Math.max(...H.map(ae=>ae.y));for(let ae=0;ae<G;ae++)for(let ce of I[ae])if(!(ce.x<J||ce.x>me||ce.y<xe||ce.y>Ie)&&Pe(ce,H,void 0))return!0;return!1},k=null,L=G=>r.length===1?s:s.filter((H,J)=>l[J]===G),T=(G,H)=>{let J=Ne(G);if(!J)return!1;let me=1/0,xe=1/0,Ie=-1/0,ae=-1/0;for(let ce of J)me=Math.min(me,ce.x),Ie=Math.max(Ie,ce.x),xe=Math.min(xe,ce.y),ae=Math.max(ae,ce.y);return s.some((ce,De)=>ce.kind!=="booth"&&(r.length===1||l[De]===H)&&ce.x>me&&ce.x<Ie&&ce.y>xe&&ce.y<ae&&_e(J,ce.x,ce.y))},v;for(let G=0;G<r.length;G++){let H=r[G];a.setFloor(G);let J=tt(H,L(G)),me=0;if(J){let Y=0;for(let he of H.objects)if(he.type==="section")for(let Me of P.bySection.get(he.id)?.rowLevels??[])Y=Math.max(Y,Me.y-H.baseHeightM);if(me=ji(Y),!v){let he=At(J);v={centre:[he.x*E,he.y*E]}}}let xe=new In,Ie=[],ae=H.objects.filter(Y=>Y.type==="shape"&&(Y.role==="entrance"||Y.role==="exit")),ce=H.objects.filter(Y=>Y.type==="section"&&!!Y.outline&&Y.outline.length>=3),De=Ss(H.objects.filter(Y=>Y.type==="booth"),H.focal);for(let Y of H.objects)if(Y.type==="section"){let he=a.vertexCount;Ns(a,Y,H,mi(Y,p),P.bySection.get(Y.id),xe,ce,o,G>0&&R(G,Y.outline));let Me=a.vertexCount-he;Me>0&&b.push({sectionId:Y.id,start:he,count:Me})}else if(Y.type==="shape"){let he=i.byObjectId.get(Y.id),Me=M.length,rt=J!==null&&Y.role==="wall"&&!he;a.setMaterial(rt?Rn:(he?.kind??Y.role)==="screen"?1:0);let it=Y.role==="stage"&&!he?Is(Y,L(G)):rt&&Y.heightM===void 0?{...Y,heightM:me}:Y,Ze=Di(it,Ie);if(ys(a,it,H.baseHeightM+Ze.supportOffsetM,Ze.topOffsetM-Ze.supportOffsetM,o,H.focal,M,he,ae),a.setMaterial(0),Y.role==="stage"&&!he&&M.length>Me&&(k??G)===G){k=G;let $e=t.floors?.[G]?.id,Tt=r.length>1&&$e?s.filter(Jt=>Jt.floorId===$e):s;Ia(a,it,M[M.length-1].y,Tt)}}else Y.type==="gaArea"?xs(a,Y,H.baseHeightM,oe(y.get(Y.categoryKey)),o):Y.type==="booth"?ds(a,Y,H.baseHeightM,oe(y.get(Y.categoryKey)),o,De.get(Y.id)??H.focal,T(Y,G)):Y.type==="table"?bs(a,Y,Math.max(H.baseHeightM,w.get(Y.id)??H.baseHeightM),oe(Y.fill??t.theme?.decorFill??"#232c40"),o,!!(Y.fill??t.theme?.decorFill)):Y.type==="decorImage"&&gs(a,Y,H.baseHeightM,o);J&&oa(a,H.objects,J,H.baseHeightM,me,H.focal,o,Y=>!i.byObjectId.has(Y.id)),Gs(a,H,s,P,o,n.materials.shell,!c)}let A=r.length>1?{x:r.reduce((G,H)=>G+H.focal.x,0)/r.length,y:r.reduce((G,H)=>G+H.focal.y,0)/r.length}:t.focalPoint??{x:(f.minX+f.maxX)/2,y:(f.minY+f.maxY)/2},_=Fr(c?[a.build(),c]:[a.build()]),C=Mi(s,e.initialState,P,x,y,g),B=la({doc:t,units:r,seats:s,surfaces:P,focal:A}),{labels:O,sections:F,rows:D}=ua({doc:t,units:r,seats:s,surfaces:P,seatData:C,hintedSeatFloor:l,zones:B,focal:A}),j=new Map(F.map((G,H)=>[G.id,H]));P.seatOwner.forEach((G,H)=>{C.iSection[H]=G?j.get(G)??-1:-1});let N=ma({doc:t,units:r,seats:s,surfaces:P,solids:_,hintedSeatFloor:l,seatFloor:x});fa(O,N),C.iYaw=xi(C.iPosition,s.length,G=>s[G].rowId,G=>{let H=r[x[G]]?.focal??A;return[H.x*E,H.y*E]});let X=(f.minX+f.maxX)/2*E,V=(f.minY+f.maxY)/2*E,Z=.5*Math.hypot((f.maxX-f.minX)*E,(f.maxY-f.minY)*E)||10,U=Qo(_,C,{cx:X,cz:V,radius:Z},[m,d]),te=Qo(_,C,{cx:X,cz:V,radius:Z}),Q=qh(r),fe=Ma(C,M,f,U.minY,U.maxY,Z,Q);return{sharedAisles:Nr(r.flatMap(G=>G.objects.flatMap(H=>{if(H.type!=="section")return[];let J=P.bySection.get(H.id);return J?[{sectionId:H.id,floorIndex:G.index,rows:J.rowLevels}]:[]}))),solids:_,sectionSolidRanges:b,seats:C,seatSectionIds:P.seatOwner,bounds:{center:[(fe.min[0]+fe.max[0])/2,(fe.min[1]+fe.max[1])/2,(fe.min[2]+fe.max[2])/2],radius:Z,groundY:0,box:fe,fitPoints:xa(C,M,Q)},...v?{room:v}:{},...!v&&r.some(G=>G.objects.some(H=>H.type==="shape"&&nn(H.stageKind)))?{outdoor:!0}:{},renderBounds:{center:U.center,radius:U.radius},clipBounds:{center:te.center,radius:te.radius},stateColorLUT:Yr(n,dn),theme:n,seatCount:s.length,focalWorld:[A.x*E,1.5,A.y*E],zones:B,stages:M,productionElements:i.elements,sections:F,rows:D,labels:O,floors:N}}function qh(e){let t=[];for(let n of e)for(let o of n.objects){let r=o.type==="gaArea"?o.points:o.type==="booth"?Ne(o):null;for(let i of r??[])t.push([i.x*E,n.baseHeightM,i.y*E])}return t}function Jh(e,t){let{doc:n,report:o}=$s(e),r=o.confident&&(o.sections.length>0||!!o.looseRowBlocks);if(!r&&!o.roles?.length)return null;if(!r){let c=new Map(o.roles.map(h=>[h.id,h.role])),u=h=>h.map(d=>d.type==="shape"&&c.has(d.id)?{...d,role:c.get(d.id)}:d),l=e.floors?.map(h=>({...h,objects:u(h.objects)})),f=new Float64Array(t.length).fill(Number.NaN),m=new Float64Array(t.length*2).fill(Number.NaN);return t.forEach((h,d)=>{h.eyeHeightM!==void 0&&(f[d]=h.eyeHeightM),h.focalPoint&&(m[d*2]=h.focalPoint.x,m[d*2+1]=h.focalPoint.y)}),{doc:{...e,objects:l?.[0]?.objects??u(e.objects),...l?{floors:l}:{}},report:o,eyeHeightM:f,focal:m}}let i=new Map(gt(n).map(c=>[c.id,c])),s=new Float64Array(t.length).fill(Number.NaN),a=new Float64Array(t.length*2).fill(Number.NaN);return t.forEach((c,u)=>{let l=i.get(c.id)??c;l.eyeHeightM!==void 0&&(s[u]=l.eyeHeightM),l.focalPoint&&(a[u*2]=l.focalPoint.x,a[u*2+1]=l.focalPoint.y)}),{doc:n,report:o,eyeHeightM:s,focal:a}}function ed(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 Aa(e){let t=e.estimate===!1?null:Jh(e.doc,e.seats);return t?{input:{...e,doc:t.doc,seats:ed(e.seats,t)},estimate:t}:{input:e}}function td(e){return[e.solids.position,e.solids.normal,e.solids.color,e.solids.floor,e.solids.material,e.seats.iPosition,e.seats.iState,e.seats.iCategory,e.seats.iMaxRadius,e.seats.iRing,e.seats.iFloor,e.seats.iYaw,e.seats.iChairWidth,e.seats.iGlyph,e.seats.iPhysicalSeat].map(n=>n.buffer)}var _a=self;_a.onmessage=e=>{let t=performance.now(),n=!e.data.seats,o=e.data.seats??gt(e.data.doc),{input:r,estimate:i}=Aa({doc:e.data.doc,seats:o,eventConfigurationId:e.data.eventConfigurationId,eventConfiguration:e.data.eventConfiguration,registeredShellGlb:e.data.registeredShellGlb,estimate:e.data.estimate}),s=Ea(r),a=td(s);i&&a.push(i.eyeHeightM.buffer,i.focal.buffer),_a.postMessage({model:s,buildMs:performance.now()-t,...n?{seats:o}:{},...i?{estimate:i}:{}},a)};