@seatlayer/core 0.100.0 → 0.102.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 (175) hide show
  1. package/dist/ar-TGXEBJUB.js +1 -0
  2. package/dist/be-JIDOHWF6.js +1 -0
  3. package/dist/bg-ODVJNCC2.js +1 -0
  4. package/dist/ca-3I7TMWYU.js +1 -0
  5. package/dist/{categoryInventory-DuOez0-4.d.cts → categoryInventory-7gSFTu0l.d.cts} +1 -1
  6. package/dist/{categoryInventory-DdJdJ4Og.d.ts → categoryInventory-hJxuFF9L.d.ts} +1 -1
  7. package/dist/chunk-254ABRJF.js +1 -0
  8. package/dist/{chunk-VWT44HBR.js → chunk-4DYJCT62.js} +1 -1
  9. package/dist/chunk-4R6TXHY2.js +1 -0
  10. package/dist/{chunk-D723OZEY.js → chunk-66T4EAUA.js} +1 -1
  11. package/dist/{chunk-GLGXP5I7.js → chunk-AFJWTB7L.js} +1 -1
  12. package/dist/chunk-COECA63Q.js +1 -0
  13. package/dist/chunk-EIV3CAGV.js +1 -0
  14. package/dist/chunk-FOIYJ5NT.js +1 -0
  15. package/dist/chunk-FUFRWRPM.js +1 -0
  16. package/dist/{chunk-KFVUBZMK.js → chunk-GPZFVQXV.js} +1 -1
  17. package/dist/{chunk-L34T3APU.js → chunk-GTRYL7YV.js} +1 -1
  18. package/dist/chunk-JRZHC75P.js +1 -0
  19. package/dist/chunk-KTMZ3QAO.js +1 -0
  20. package/dist/chunk-PHV2U54Y.js +1 -0
  21. package/dist/chunk-TAMY7HTV.js +1 -0
  22. package/dist/chunk-UEDS3HJ3.js +1 -0
  23. package/dist/{chunk-P4J57TK6.js → chunk-YPVYZYMH.js} +1 -1
  24. package/dist/chunk-ZS5YFXSE.js +1 -0
  25. package/dist/core/chart-ops/index.cjs +1 -1
  26. package/dist/core/chart-ops/index.d.cts +30 -9
  27. package/dist/core/chart-ops/index.d.ts +30 -9
  28. package/dist/core/chart-ops/index.js +1 -1
  29. package/dist/core/inventory/index.cjs +1 -1
  30. package/dist/core/inventory/index.d.cts +72 -5
  31. package/dist/core/inventory/index.d.ts +72 -5
  32. package/dist/core/inventory/index.js +1 -1
  33. package/dist/core/layout/index.cjs +1 -1
  34. package/dist/core/layout/index.d.cts +63 -6
  35. package/dist/core/layout/index.d.ts +63 -6
  36. package/dist/core/layout/index.js +1 -1
  37. package/dist/core/quality/index.cjs +1 -1
  38. package/dist/core/quality/index.d.cts +18 -4
  39. package/dist/core/quality/index.d.ts +18 -4
  40. package/dist/core/quality/index.js +1 -1
  41. package/dist/core/render-assets/index.cjs +1 -1
  42. package/dist/core/render-assets/index.d.cts +2 -2
  43. package/dist/core/render-assets/index.d.ts +2 -2
  44. package/dist/core/render-assets/index.js +1 -1
  45. package/dist/core/seatConfidence.d.cts +1 -1
  46. package/dist/core/seatConfidence.d.ts +1 -1
  47. package/dist/core/sections/index.cjs +1 -1
  48. package/dist/core/sections/index.d.cts +5 -5
  49. package/dist/core/sections/index.d.ts +5 -5
  50. package/dist/core/sections/index.js +1 -1
  51. package/dist/cs-XXB624Z3.js +1 -0
  52. package/dist/cy-W2QNU2GO.js +1 -0
  53. package/dist/da-Q47YPK2E.js +1 -0
  54. package/dist/de-TS3DPLM5.js +1 -0
  55. package/dist/{el-ZPFVDCWA.js → el-3JQUH6DB.js} +1 -1
  56. package/dist/es-GP7VOX7S.js +1 -0
  57. package/dist/et-A22OMZ6V.js +1 -0
  58. package/dist/{eventConfigurations-DYn5XP3J.d.cts → eventConfigurations-BHIfPJJJ.d.cts} +1 -1
  59. package/dist/{eventConfigurations-BISNREZL.d.ts → eventConfigurations-I5UBS6r9.d.ts} +1 -1
  60. package/dist/fa-5MS3C6YX.js +1 -0
  61. package/dist/fi-OJLAOJO2.js +1 -0
  62. package/dist/fr-7ATOYJCF.js +1 -0
  63. package/dist/he-37LKRY5W.js +1 -0
  64. package/dist/hi-YXZ5EWK7.js +1 -0
  65. package/dist/hr-QFOPGLMR.js +1 -0
  66. package/dist/hu-RHRBK46E.js +1 -0
  67. package/dist/id-A5Q3MLSX.js +1 -0
  68. package/dist/index.cjs +1 -1
  69. package/dist/index.d.cts +58 -17
  70. package/dist/index.d.ts +58 -17
  71. package/dist/index.js +1 -1
  72. package/dist/it-KG53QPQF.js +1 -0
  73. package/dist/ja-CC6EPUSN.js +1 -0
  74. package/dist/ko-7H4RGYFK.js +1 -0
  75. package/dist/ku-HFYWPSS4.js +1 -0
  76. package/dist/{labeling-CzuSxAkr.d.ts → labeling-2A31f781.d.cts} +11 -3
  77. package/dist/{labeling-owTTG6e0.d.cts → labeling-CDKZ9TO1.d.ts} +11 -3
  78. package/dist/localeLoaders-4YMC7FIZ.js +1 -0
  79. package/dist/lt-HQXE7W47.js +1 -0
  80. package/dist/lv-AN25XXPB.js +1 -0
  81. package/dist/ms-CWAYSF6E.js +1 -0
  82. package/dist/nl-63QBRZSZ.js +1 -0
  83. package/dist/no-RAPQMKWU.js +1 -0
  84. package/dist/pl-ILSTD4ZV.js +1 -0
  85. package/dist/pt-WF3US5D7.js +1 -0
  86. package/dist/{renderedQuality-BZycehrC.d.cts → renderedQuality-CwZ8hY-5.d.cts} +1 -1
  87. package/dist/{renderedQuality-DPElQ3-x.d.ts → renderedQuality-wDIiUId3.d.ts} +1 -1
  88. package/dist/{renderer-DnsIDiWN.d.cts → renderer-CdJx5l3B.d.ts} +12 -3
  89. package/dist/{renderer-DPKIlnuF.d.ts → renderer-D6ggv3bV.d.cts} +12 -3
  90. package/dist/ro-XR3HT6DE.js +1 -0
  91. package/dist/ru-TLJEWDPA.js +1 -0
  92. package/dist/{seatTypeIcons-dy3XQVWN.d.ts → seatTypeIcons-DMJX4rVN.d.cts} +2 -2
  93. package/dist/{seatTypeIcons-QwEebl3k.d.cts → seatTypeIcons-UpUTD8Xf.d.ts} +2 -2
  94. package/dist/{sections-DSIfnBJY.d.cts → sections-CempT5a0.d.cts} +5 -2
  95. package/dist/{sections-C8VTe6BN.d.ts → sections-lpdfwSdO.d.ts} +5 -2
  96. package/dist/{segmentedRowModel-CDvvJJ4-.d.cts → segmentedRowModel-Ddx5ol8T.d.cts} +1 -1
  97. package/dist/{segmentedRowModel-I8eYUQft.d.ts → segmentedRowModel-HwY4XuYa.d.ts} +1 -1
  98. package/dist/sk-OJC2EL3Z.js +1 -0
  99. package/dist/sl-7RGTVXCV.js +1 -0
  100. package/dist/sr-NHDJ54BS.js +1 -0
  101. package/dist/sv-ZODCCBCU.js +1 -0
  102. package/dist/{tableSizing-x8ADFtKS.d.cts → tableSizing-BJqAuJDg.d.cts} +3 -3
  103. package/dist/{tableSizing-0PwrOWi5.d.ts → tableSizing-C0zx97eg.d.ts} +3 -3
  104. package/dist/th-VCZA4MP5.js +1 -0
  105. package/dist/{ticketRestrictions-C8H-XJha.d.ts → ticketRestrictions-AU8UUmdL.d.ts} +39 -3
  106. package/dist/{ticketRestrictions-O-fv0Os6.d.cts → ticketRestrictions-DDQHiKF-.d.cts} +39 -3
  107. package/dist/tr-ROKZO3HC.js +1 -0
  108. package/dist/{types-DWx32xXH.d.cts → types-DL7qIUrD.d.cts} +85 -2
  109. package/dist/{types-DWx32xXH.d.ts → types-DL7qIUrD.d.ts} +85 -2
  110. package/dist/uk-LP2DPUHC.js +1 -0
  111. package/dist/vi-JDK3JRJR.js +1 -0
  112. package/dist/view3d/crossfade/panorama.d.cts +1 -1
  113. package/dist/view3d/crossfade/panorama.d.ts +1 -1
  114. package/dist/view3d/index.cjs +102 -60
  115. package/dist/view3d/index.d.cts +26 -5
  116. package/dist/view3d/index.d.ts +26 -5
  117. package/dist/view3d/index.js +100 -58
  118. package/dist/view3d/scene/scene.worker.cjs +1 -1
  119. package/dist/view3d/scene/scene.worker.js +1 -1
  120. package/dist/zh-Hans-P3GB3FAZ.js +1 -0
  121. package/dist/zh-Hant-YU4OKSFZ.js +1 -0
  122. package/package.json +1 -1
  123. package/dist/ar-Q44JP5JY.js +0 -1
  124. package/dist/be-CGFFSIQL.js +0 -1
  125. package/dist/bg-WOYK6OLH.js +0 -1
  126. package/dist/ca-77ZVI3X5.js +0 -1
  127. package/dist/chunk-23OTKCJU.js +0 -1
  128. package/dist/chunk-5BMXWOE7.js +0 -1
  129. package/dist/chunk-5ITK5236.js +0 -1
  130. package/dist/chunk-COOPHSHM.js +0 -1
  131. package/dist/chunk-CTIGUXXK.js +0 -1
  132. package/dist/chunk-HO4MFTVX.js +0 -1
  133. package/dist/chunk-HYEZPOZU.js +0 -1
  134. package/dist/chunk-N4J4CT6P.js +0 -1
  135. package/dist/chunk-QJXSZT3H.js +0 -1
  136. package/dist/chunk-UIMDB6GZ.js +0 -1
  137. package/dist/chunk-UISTXRO5.js +0 -1
  138. package/dist/cs-OSBZYCSR.js +0 -1
  139. package/dist/cy-ZCOJW2WH.js +0 -1
  140. package/dist/da-2PDK6JTR.js +0 -1
  141. package/dist/de-R5LLVFUU.js +0 -1
  142. package/dist/es-7YASJP32.js +0 -1
  143. package/dist/et-J4TV6KQL.js +0 -1
  144. package/dist/fa-4TEO7UGM.js +0 -1
  145. package/dist/fi-GIUDDKMH.js +0 -1
  146. package/dist/fr-J5J2XJLA.js +0 -1
  147. package/dist/he-OCEHSVUJ.js +0 -1
  148. package/dist/hi-EK5CTBW5.js +0 -1
  149. package/dist/hr-SLDTQOYC.js +0 -1
  150. package/dist/hu-2QNE77NO.js +0 -1
  151. package/dist/id-LGDAFQJK.js +0 -1
  152. package/dist/it-DT4Y3IYB.js +0 -1
  153. package/dist/ja-D5EY2XCQ.js +0 -1
  154. package/dist/ko-DD2NV45Q.js +0 -1
  155. package/dist/ku-KZCMVLBE.js +0 -1
  156. package/dist/localeLoaders-GGAKX22E.js +0 -1
  157. package/dist/lt-QWGTJ47Y.js +0 -1
  158. package/dist/lv-LYAIG3VK.js +0 -1
  159. package/dist/ms-XTF4KNGD.js +0 -1
  160. package/dist/nl-QEXY6XHS.js +0 -1
  161. package/dist/no-HCOXN2CN.js +0 -1
  162. package/dist/pl-BWY53TSD.js +0 -1
  163. package/dist/pt-2UJUBCPL.js +0 -1
  164. package/dist/ro-GGXOLTED.js +0 -1
  165. package/dist/ru-ZTFK3WCU.js +0 -1
  166. package/dist/sk-KU543Y2U.js +0 -1
  167. package/dist/sl-FT576R7A.js +0 -1
  168. package/dist/sr-WE3J46JE.js +0 -1
  169. package/dist/sv-YEAOPSEB.js +0 -1
  170. package/dist/th-BEBRDHJA.js +0 -1
  171. package/dist/tr-LOAHUPSH.js +0 -1
  172. package/dist/uk-2GMICSHN.js +0 -1
  173. package/dist/vi-TC5B6AUR.js +0 -1
  174. package/dist/zh-Hans-TSZWTZQY.js +0 -1
  175. package/dist/zh-Hant-TLB4FZYM.js +0 -1
@@ -1 +0,0 @@
1
- import{a as ke,c as Fe,d as Le}from"./chunk-L34T3APU.js";import{a as Te}from"./chunk-QJXSZT3H.js";import{v as ve}from"./chunk-VWT44HBR.js";import{a as Oe,c as zt,d as dt,f as pt,i as Ce}from"./chunk-D723OZEY.js";import{h as pn}from"./chunk-HYEZPOZU.js";import{e as Ee,l as Be}from"./chunk-4N5CHKHD.js";import{B as Pe,C as nn,Ma as wt,Va as Mn,ba as q,ca as Mt,j as Me,la as xn,na as Wt,oa as bn,qa as Se,sa as Yt,ta as gn,ua as Ie,wa as Hn,xa as Re,ya as _e}from"./chunk-UISTXRO5.js";import{A as St,D as we,b as Ae,d as ot,y as et}from"./chunk-JBOTRSMY.js";import Hr from"earcut";import Ne from"polygon-clipping";var S=q,Xr=.002;function jr(t,n,e){let r=Math.hypot(n[0]-t[0],n[1]-t[1],n[2]-t[2]),o=Math.hypot(e[0]-n[0],e[1]-n[1],e[2]-n[2]),a=Math.hypot(t[0]-e[0],t[1]-e[1],t[2]-e[2]),i=Math.max(r,o,a);if(i<1e-9)return!0;let s=(r+o+a)/2;return 2*Math.sqrt(Math.max(0,s*(s-r)*(s-o)*(s-a)))/i<Xr}var Ht=class{constructor(n=16384){this.len=0;this.buf=new Float32Array(n)}push3(n,e,r){this.len+3>this.buf.length&&this.grow(this.len+3),this.buf[this.len++]=n,this.buf[this.len++]=e,this.buf[this.len++]=r}push1(n){this.len+1>this.buf.length&&this.grow(this.len+1),this.buf[this.len++]=n}grow(n){let e=this.buf.length*2;for(;e<n;)e*=2;let r=new Float32Array(e);r.set(this.buf.subarray(0,this.len)),this.buf=r}get length(){return this.len}toArray(){return this.buf.slice(0,this.len)}},In=class{constructor(){this.pos=new Ht;this.nor=new Ht;this.col=new Ht;this.flr=new Ht;this.mat=new Ht;this.currentFloor=0;this.currentMaterial=0}setFloor(n){this.currentFloor=n}setMaterial(n){this.currentMaterial=n}tri(n,e,r,o,a,i=a,s=a){jr(n,e,r)||(this.pos.push3(n[0],n[1],n[2]),this.pos.push3(e[0],e[1],e[2]),this.pos.push3(r[0],r[1],r[2]),this.nor.push3(o[0],o[1],o[2]),this.nor.push3(o[0],o[1],o[2]),this.nor.push3(o[0],o[1],o[2]),this.col.push3(a[0],a[1],a[2]),this.col.push3(i[0],i[1],i[2]),this.col.push3(s[0],s[1],s[2]),this.flr.push1(this.currentFloor),this.flr.push1(this.currentFloor),this.flr.push1(this.currentFloor),this.mat.push1(this.currentMaterial),this.mat.push1(this.currentMaterial),this.mat.push1(this.currentMaterial))}triN(n,e,r,o,a,i,s,l=s,u=s){[...n,...e,...r].every(Number.isFinite)&&(this.pos.push3(n[0],n[1],n[2]),this.pos.push3(e[0],e[1],e[2]),this.pos.push3(r[0],r[1],r[2]),this.nor.push3(o[0],o[1],o[2]),this.nor.push3(a[0],a[1],a[2]),this.nor.push3(i[0],i[1],i[2]),this.col.push3(s[0],s[1],s[2]),this.col.push3(l[0],l[1],l[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 Ur(t,n,e){let r=n[0]-t[0],o=n[1]-t[1],a=n[2]-t[2],i=e[0]-t[0],s=e[1]-t[1],l=e[2]-t[2],u=o*l-a*s,c=a*i-r*l,f=r*s-o*i,m=Math.hypot(u,c,f)||1;return u/=m,c/=m,f/=m,[u,c,f]}function Wr(t,n){let e=[...t],r=[];for(let i of t)r.push(i.x,i.y);let o=[];if(n){for(let i of n)if(!(i.length<3)){o.push(e.length);for(let s of i)e.push(s),r.push(s.x,s.y)}}let a=Hr(r,o.length?o:void 0,2);return{pts:e,tris:a}}function Et(t){return dt(t)<0?[...t].reverse():t}var Yr=3;function zr(t,n,e,r){let o=r(t),a=r(n),i=r(e),s=(d,y,h,x)=>Math.abs(r({x:(d.x+y.x)/2,y:(d.y+y.y)/2})-(h+x)/2),l=(t.x+n.x+e.x)/3,u=(t.y+n.y+e.y)/3,c=(o+a+i)/3,f=Math.max(s(t,n,o,a),s(n,e,a,i),s(e,t,i,o),Math.abs(r({x:l,y:u})-c)),m=(d,y,h)=>{let x=Math.abs(r({x:(d+l)/2,y:(y+u)/2})-(h+c)/2);x>f&&(f=x)};return m((t.x+n.x)/2,(t.y+n.y)/2,(o+a)/2),m((n.x+e.x)/2,(n.y+e.y)/2,(a+i)/2),m((e.x+t.x)/2,(e.y+t.y)/2,(i+o)/2),f}function en(t,n,e,r,o){if(o<=0)return zr(t,n,e,r);let a={x:(t.x+n.x)/2,y:(t.y+n.y)/2},i={x:(n.x+e.x)/2,y:(n.y+e.y)/2},s={x:(e.x+t.x)/2,y:(e.y+t.y)/2};return Math.max(en(t,a,s,r,o-1),en(a,n,i,r,o-1),en(s,i,e,r,o-1),en(a,i,s,r,o-1))}function on(t,n,e,r,o,a,i,s){if(i>0){let m={x:(n.x+e.x)/2,y:(n.y+e.y)/2},d={x:(e.x+r.x)/2,y:(e.y+r.y)/2},y={x:(r.x+n.x)/2,y:(r.y+n.y)/2};on(t,n,m,y,o,a,i-1,s),on(t,m,e,d,o,a,i-1,s),on(t,y,d,r,o,a,i-1,s),on(t,m,d,y,o,a,i-1,s);return}let l=[n.x*S,o(n),n.y*S],u=[e.x*S,o(e),e.y*S],c=[r.x*S,o(r),r.y*S];if(s){t.triN(l,u,c,s(n),s(e),s(r),a);return}let f=Ur(l,u,c);f[1]<0&&(f=[-f[0],-f[1],-f[2]]),t.tri(l,u,c,f,a)}var Kr=8;function De(t,n,e){if(!Number.isFinite(e))return t;let r=[],o=(a,i,s,l,u)=>{if(u>0){let c={x:(a.x+i.x)/2,y:(a.y+i.y)/2},f=n(c);if(Math.abs(f-(s+l)/2)>e){o(a,c,s,f,u-1),o(c,i,f,l,u-1);return}}r.push(a)};for(let a=0;a<t.length;a++){let i=t[a],s=t[(a+1)%t.length];o(i,s,n(i),n(s),Kr)}return r}function Pn(t,n){if(t.length<3)return t;let e=[];for(let o of t){let a=e[e.length-1];a&&Math.hypot(o.x-a.x,o.y-a.y)<n||e.push(o)}for(;e.length>2&&Math.hypot(e[0].x-e[e.length-1].x,e[0].y-e[e.length-1].y)<n;)e.pop();if(e.length<3)return t;let r=[];for(let o=0;o<e.length;o++){let a=r.length?r[r.length-1]:e[(o-1+e.length)%e.length],i=e[o],s=e[(o+1)%e.length],l=s.x-a.x,u=s.y-a.y,c=Math.hypot(l,u);c>n&&Math.abs((i.x-a.x)*u-(i.y-a.y)*l)/c<n||r.push(i)}return r.length>=3?r:e}var Sn=.001*Mt*.1;function V(t,n,e,r,o,a,i,s,l=1/0,u){if(!n||n.length<3||(l===void 0&&(l=1/0),Math.abs(dt(n))<1e-4))return;let c=Pn(De(Pn(Et(n),Sn),r,l),Sn),f=e?.map(p=>Pn(De(Pn(Et(p),Sn),r,l),Sn)).filter(p=>p.length>=3&&Math.abs(dt(p))>=1e-4),{pts:m,tris:d}=Wr(c,f),y=[a[0]*s.top,a[1]*s.top,a[2]*s.top],h=[a[0]*s.bottomCap,a[1]*s.bottomCap,a[2]*s.bottomCap],x=[i[0]*s.top,i[1]*s.top,i[2]*s.top],g=[i[0]*s.wallBottom,i[1]*s.wallBottom,i[2]*s.wallBottom],b=0;if(Number.isFinite(l))for(;b<Yr;b++){let p=0;for(let _=0;_<d.length;_+=3){let M=en(m[d[_]],m[d[_+1]],m[d[_+2]],r,b);M>p&&(p=M)}if(p<=l)break}for(let p=0;p<d.length;p+=3){let _=m[d[p]],M=m[d[p+1]],R=m[d[p+2]];on(t,_,M,R,r,y,b,u);let E=[_.x*S,o,_.y*S],C=[M.x*S,o,M.y*S],v=[R.x*S,o,R.y*S];t.tri(E,v,C,[0,-1,0],h)}let I=p=>{if(b<=0)return p;let _=1<<b,M=[];for(let R=0;R<p.length;R++){let E=p[R],C=p[(R+1)%p.length];for(let v=0;v<_;v++){let k=v/_;M.push({x:E.x+(C.x-E.x)*k,y:E.y+(C.y-E.y)*k})}}return M},w=Pe(c),P=[{ring:I(c),flip:!1}];if(f)for(let p of f)p.length>=3&&P.push({ring:I(p),flip:!0});for(let{ring:p,flip:_}of P)for(let M=0;M<p.length;M++){let R=p[M],E=p[(M+1)%p.length],C=(E.x-R.x)*S,k=(E.y-R.y)*S,A=-C,B=Math.hypot(k,A)||1;k/=B,A/=B;let T=(R.x+E.x)/2-w.x,F=(R.y+E.y)/2-w.y,O=k*T+A*F;_&&(O=-O),O<0&&(k=-k,A=-A);let L=[k,0,A],D=[R.x*S,r(R),R.y*S],G=[E.x*S,r(E),E.y*S],j=[R.x*S,o,R.y*S],U=[E.x*S,o,E.y*S];t.tri(D,G,U,L,x,x,g),t.tri(D,U,j,L,x,g,g)}}function Ge(t){let n=0;for(let l of t)n+=l.count;let e=new Float32Array(n*3),r=new Float32Array(n*3),o=new Float32Array(n*3),a=new Float32Array(n),i=new Float32Array(n),s=0;for(let l of t)e.set(l.position,s*3),r.set(l.normal,s*3),o.set(l.color,s*3),a.set(l.floor,s),i.set(l.material,s),s+=l.count;return{position:e,normal:r,color:o,floor:a,material:i,count:n}}function It(t,n,e=2.5){if(n<=0||t.length<3)return t;let r=Et(t),o=r.length,a=[];for(let s=0;s<o;s++){let l=r[s],u=r[(s+1)%o],c=u.x-l.x,f=u.y-l.y,m=Math.hypot(c,f)||1;a.push({x:f/m,y:-c/m})}let i=[];for(let s=0;s<o;s++){let l=r[s],u=a[(s-1+o)%o],c=a[s],f=u.x+c.x,m=u.y+c.y,d=Math.hypot(f,m),y=()=>{i.push([l.x+u.x*n,l.y+u.y*n]),i.push([l.x+c.x*n,l.y+c.y*n])};if(d<1e-9){y();continue}f/=d,m/=d;let h=f*u.x+m*u.y,x=1/Math.max(h,1e-6);if(!Number.isFinite(x)||x>e){y();continue}i.push([l.x+f*n*x,l.y+m*n*x])}if(i.length<3)return t;try{let s=Ne.union([[...i,i[0]]]),l=null,u=-1/0;for(let f of s){let m=Math.abs(dt(f[0].map(([d,y])=>({x:d,y}))));m>u&&(u=m,l=f[0])}if(!l)return t;let c=l.map(([f,m])=>({x:f,y:m}));if(c.length>1){let f=c[0],m=c[c.length-1];Math.abs(f.x-m.x)<1e-9&&Math.abs(f.y-m.y)<1e-9&&c.pop()}return c.length>=3?c:t}catch{return t}}function Lt(t,n,e=2.5){if(t.length<3)return[];if(n<=0)return t;let r=Et(t),o=r.length,a=[];for(let l=0;l<o;l++){let u=r[l],c=r[(l+1)%o],f=Math.hypot(c.x-u.x,c.y-u.y)||1;a.push({x:-(c.y-u.y)/f,y:(c.x-u.x)/f})}let i=[],s=[];for(let l=0;l<o;l++){let u=r[l],c=a[(l-1+o)%o],f=a[l],m=c.x+f.x,d=c.y+f.y,y=Math.hypot(m,d),h=y<1e-9?1/0:1/Math.max(m/y*c.x+d/y*c.y,1e-6);if(!Number.isFinite(h)||h>e){i.push({x:u.x+c.x*n,y:u.y+c.y*n},{x:u.x+f.x*n,y:u.y+f.y*n}),s.push(l,l);continue}m/=y,d/=y,i.push({x:u.x+m*n*h,y:u.y+d*n*h}),s.push(l)}for(let l=0;l<i.length;l++){let u=(l+1)%i.length,c=s[l],f=s[u];if(f!==(c+1)%o)continue;let m=r[c],d=r[f];if((i[u].x-i[l].x)*(d.x-m.x)+(i[u].y-i[l].y)*(d.y-m.y)<=0)return[]}try{let l=Ne.intersection([[...i.map(y=>[y.x,y.y]),[i[0].x,i[0].y]]],[[...r.map(y=>[y.x,y.y]),[r[0].x,r[0].y]]]),u=null,c=0;for(let y of l){let h=Math.abs(dt(y[0].map(([x,g])=>({x,y:g}))));h>c&&(c=h,u=y[0])}if(!u)return[];let f=u.map(([y,h])=>({x:y,y:h})),m=f[0],d=f[f.length-1];return f.length>1&&Math.abs(m.x-d.x)<1e-9&&Math.abs(m.y-d.y)<1e-9&&f.pop(),f.length>=3?Et(f):[]}catch{return[]}}function Rn(t,n,e,r,o=28){let a=[];for(let i=0;i<o;i++){let s=i/o*Math.PI*2;a.push({x:t+e*Math.cos(s),y:n+r*Math.sin(s)})}return a}function rn(t,n,e,r){return[{x:t,y:n},{x:t+e,y:n},{x:t+e,y:n+r},{x:t,y:n+r}]}var sn=["available","held","sold","selected","dimmed"];function Xn(t){let n=sn.indexOf(t);return n<0?0:n}var He={available:[.24,.82,.52],held:[.34,.39,.45],sold:[.34,.39,.45],selected:[.24,.74,1],dimmed:[.28,.32,.37]};function Qc(t){let n=.2126*t[0]+.7152*t[1]+.0722*t[2],e=.78,r=.86;return[(n+(t[0]-n)*e)*r,(n+(t[1]-n)*e)*r,(n+(t[2]-n)*e)*r]}var jn={ground:[.07,.085,.11],tierTop:[.24,.28,.34],tierWall:[.17,.2,.25],stageTop:[.94,.7,.38],stageWall:[.48,.33,.18],decorTop:[.22,.25,.29],decorWall:[.15,.17,.2],gaTop:[.24,.28,.33],gaWall:[.16,.19,.23],boothTop:[.3,.33,.38],boothWall:[.2,.23,.27],tableTop:[.38,.34,.29],tableWall:[.24,.21,.18]},Un={top:[.05,.06,.08],bottom:[.1,.12,.15]};function Z(t,n){return[Math.min(1,t[0]*n),Math.min(1,t[1]*n),Math.min(1,t[2]*n)]}var lt={pedestal:0,pad:1,back:2,arm:3,footrest:4,leg:5,body:10,head:11},Vr=.44,Zr=.15,qr=.3,$r=.24;function je(t){return t===void 0||!Number.isFinite(t)||t<=0?$r:Math.min(qr,Math.max(Zr,t*Vr))}var tl=.21,Qr=.05,Wn=.45,Jr=Wn+Qr,ti=.92,Xe=.66,ni=1.205,ei=-.23,oi=.38,ri=[{part:lt.pedestal,min:[-.3,0,-.3],max:[.3,.36,.3]},{part:lt.pad,min:[-1,.36,-.95],max:[1,Wn,1]},{part:lt.back,min:[-1,Jr,-1],max:[1,ti,-.72]},{part:lt.arm,min:[-1,.44,-.82],max:[-.78,.65,.78]},{part:lt.arm,min:[.78,.44,-.82],max:[1,.65,.78]},{part:lt.footrest,min:[-.9,.18,.78],max:[.9,.31,1.34]},{part:lt.leg,min:[-.82,0,-.7],max:[-.62,.37,-.48]},{part:lt.leg,min:[.62,0,-.7],max:[.82,.37,-.48]},{part:lt.leg,min:[-.82,0,.48],max:[-.62,.37,.7]},{part:lt.leg,min:[.62,0,.48],max:[.82,.37,.7]}],ii=[{part:lt.body,min:[-.52,.39,-.08],max:[-.08,.55,.82]},{part:lt.body,min:[.08,.39,-.08],max:[.52,.55,.82]},{part:lt.body,min:[-.47,.05,.58],max:[-.13,.43,.82]},{part:lt.body,min:[.13,.05,.58],max:[.47,.43,.82]},{part:lt.head,min:[-.16,1.04,-.33],max:[.16,1.1,-.13]}],si=[{n:[1,0,0],c:[[1,0,0],[1,1,0],[1,1,1],[1,0,1]]},{n:[-1,0,0],c:[[0,0,1],[0,1,1],[0,1,0],[0,0,0]]},{n:[0,1,0],c:[[0,1,0],[0,1,1],[1,1,1],[1,1,0]]},{n:[0,-1,0],c:[[0,0,1],[0,0,0],[1,0,0],[1,0,1]]},{n:[0,0,1],c:[[0,0,1],[1,0,1],[1,1,1],[0,1,1]]},{n:[0,0,-1],c:[[1,0,0],[0,0,0],[0,1,0],[1,1,0]]}];function nl(){let t=[],n=[],e=[],r=[],o=(T,F,O)=>{let L=e.length,[D,G,j]=T,U=[G[0]-D[0],G[1]-D[1],G[2]-D[2]],X=[j[0]-D[0],j[1]-D[1],j[2]-D[2]],W=U[1]*X[2]-U[2]*X[1],$=U[2]*X[0]-U[0]*X[2],tt=U[0]*X[1]-U[1]*X[0],Q=Math.hypot(W,$,tt);Q>1e-9?(W/=Q,$/=Q,tt/=Q):[W,$,tt]=F,W*F[0]+$*F[1]+tt*F[2]<0&&(W=-W,$=-$,tt=-tt);for(let st of T)t.push(...st),n.push(W,$,tt),e.push(O);r.push(L,L+1,L+2,L,L+2,L+3)},a=T=>{for(let F of si){let O=F.c.map(L=>L.map((D,G)=>D?T.max[G]:T.min[G]));o(O,F.n,T.part)}},i=(T,F)=>{let[O,L,D]=F?[0,1,2]:[0,2,1],G=T.min[O],j=T.max[O],U=T.min[L],X=T.max[L],W=(j-G)*.1,$=(X-U)*.1,tt=F?[[G+W,U],[j-W,U],[j,U+$],[j*.94,X-(X-U)*.23],[j*Xe,X],[G*Xe,X],[G*.94,X-(X-U)*.23],[G,U+$]]:[[G+W,U],[j-W,U],[j,U+$],[j,X-$],[j-W,X],[G+W,X],[G,X-$],[G,U+$]],Q=(nt,N,H)=>{let K=[0,0,0];return K[O]=nt,K[L]=N,K[D]=H,K},st=[T.min[D],T.max[D]].map(nt=>tt.map(([N,H])=>Q(N,H,nt)));for(let nt=0;nt<tt.length;nt++){let N=(nt+1)%tt.length,H=[0,0,0];H[O]=(tt[nt][0]+tt[N][0])/2-(G+j)/2,H[L]=(tt[nt][1]+tt[N][1])/2-(U+X)/2,o([st[0][nt],st[0][N],st[1][N],st[1][nt]],H,T.part)}for(let nt=0;nt<2;nt++){let N=[0,0,0];N[D]=nt?1:-1;let H=st[nt];for(let K=1;K<H.length-1;K++){let at=e.length;for(let ft of[H[0],H[K],H[K+1]])t.push(...ft),n.push(...N),e.push(T.part);r.push(at,at+1,at+2)}}};for(let T of ri)T.part===lt.pad||T.part===lt.back?i(T,T.part===lt.back):a(T);for(let T of ii)a(T);let s=Wn,l=1.08,u=.47,c=.69,f=-.55,m=.08,d=-.48,y=.01,h=[-u,s,f],x=[u,s,f],g=[-u,s,m],b=[u,s,m],I=[-c,l,d],w=[c,l,d],P=[-c,l,y],p=[c,l,y];o([x,w,p,b],[1,0,0],lt.body),o([g,P,I,h],[-1,0,0],lt.body),o([P,p,w,I],[0,1,0],lt.body),o([h,x,b,g],[0,-1,0],lt.body),o([b,p,P,g],[0,0,1],lt.body),o([h,I,w,x],[0,0,-1],lt.body);let _=10,M=8,R=[0,ni,ei],E=[.42,.115,oi],C=e.length;for(let T=0;T<=M;T++){let F=Math.PI*T/M,O=Math.cos(F),L=Math.sin(F);for(let D=0;D<=_;D++){let G=Math.PI*2*D/_,j=L*Math.cos(G),U=L*Math.sin(G);t.push(R[0]+E[0]*j,R[1]+E[1]*O,R[2]+E[2]*U);let X=j/E[0],W=O/E[1],$=U/E[2],tt=Math.hypot(X,W,$)||1;X/=tt,W/=tt,$/=tt,n.push(X,W,$),e.push(lt.head)}}for(let T=0;T<M;T++)for(let F=0;F<_;F++){let O=C+T*(_+1)+F,L=O+_+1;r.push(O,L,O+1,O+1,L,L+1)}let v=new Float32Array(t),k=new Float32Array(n),A=new Float32Array(e),B=new Uint16Array(r);return{position:v,normal:k,part:A,index:B,vertexCount:e.length,indexCount:r.length}}function Ue(t,n,e,r){let o=new Float32Array(n),a=u=>t[u*3],i=u=>t[u*3+2],s=0,l=(u,c)=>{let f=c-u;for(let m=u;m<c;m++){let[d,y]=r(m),h=d-a(m),x=y-i(m);if(f>=2){let g=Math.max(u,m-1),b=Math.min(c-1,m+1),I=a(b)-a(g),w=i(b)-i(g),P=Math.hypot(I,w);if(P>1e-6){let p=-w/P,_=I/P;p*h+_*x<0&&(p=-p,_=-_),h=p,x=_}}o[m]=h===0&&x===0?0:Math.atan2(h,x)}};for(let u=1;u<=n;u++)(u===n||e(u)!==e(s))&&(l(s,u),s=u);return o}var _n=.22;function ul(t,n){let e=sn[t];if(e!=="sold"&&e!=="held")return-1;let r=(n+1)*2654435761;return r^=r>>>15,r=Math.imul(r,2246822519),r^=r>>>13,(r>>>0)%1e5/1e5}var ai=.42;function ci(t){let n=t.length,e=new Float64Array(n);if(n<2)return e.fill(1/0),e;let r=1/0,o=1/0,a=-1/0,i=-1/0;for(let y of t)y.x<r&&(r=y.x),y.y<o&&(o=y.y),y.x>a&&(a=y.x),y.y>i&&(i=y.y);let s=Math.max(a-r,1e-6),l=Math.max(i-o,1e-6),u=Math.max(Math.sqrt(s*l/n),1e-6),c=Math.max(1,Math.ceil(s/u)+1),f=Math.max(1,Math.ceil(l/u)+1),m=new Map,d=(y,h)=>{let x=Math.min(c-1,Math.max(0,Math.floor((y-r)/u)));return Math.min(f-1,Math.max(0,Math.floor((h-o)/u)))*c+x};for(let y=0;y<n;y++){let h=d(t[y].x,t[y].y),x=m.get(h);x?x.push(y):m.set(h,[y])}for(let y=0;y<n;y++){let h=t[y],x=Math.min(c-1,Math.max(0,Math.floor((h.x-r)/u))),g=Math.min(f-1,Math.max(0,Math.floor((h.y-o)/u))),b=1/0;for(let I=1;I<=4;I++){for(let w=g-I;w<=g+I;w++)if(!(w<0||w>=f))for(let P=x-I;P<=x+I;P++){if(P<0||P>=c||I>1&&Math.abs(w-g)<I&&Math.abs(P-x)<I)continue;let p=m.get(w*c+P);if(p)for(let _ of p){if(_===y)continue;let M=Math.hypot(t[_].x-h.x,t[_].y-h.y);M<b&&(b=M)}}if(Number.isFinite(b)&&b<=I*u)break}e[y]=b}return e}function li(t){let n=t.eyeHeightM;return Number.isFinite(n)?Math.max(0,n-xn):0}function We(t,n,e,r,o,a){let i=t.length,s=new Float32Array(i*3),l=new Float32Array(i),u=new Float32Array(i*3),c=new Float32Array(i),f=new Float32Array(i),m=new Float32Array(i),d=new Float32Array(i),y=new Float32Array(i*3),h=new Map,x=ci(t);for(let g=0;g<i;g++){let b=t[g],w=(e?.seatPitchU(g)??x[g])*S;c[g]=Number.isFinite(w)?Math.max(.06,Math.min(_n,w*ai)):_n,f[g]=je(Number.isFinite(w)?w:void 0);let P=Be(b.glyph,{seatGlyph:a?.get(b.categoryKey)});m[g]=Ee.indexOf(P),d[g]=b.wheelchairSpaceType==="no-seat"?0:1,s[g*3]=b.x*S,s[g*3+1]=e?e.seatDeckY(g):li(b),s[g*3+2]=b.y*S,l[g]=Xn(n?n(b):"available");let p=ot(o?.get(b.categoryKey)??"#6e7bff")??[.43,.48,1];if(u[g*3]=p[0],u[g*3+1]=p[1],u[g*3+2]=p[2],b.accessibility?.length){let _=ot(pn(b.accessibility));_&&(y[g*3]=_[0],y[g*3+1]=_[1],y[g*3+2]=_[2])}h.set(b.id,g)}return{count:i,iPosition:s,iState:l,iCategory:u,iMaxRadius:c,iRing:y,idToIndex:h,iChairWidth:f,iGlyph:m,iPhysicalSeat:d,iFloor:r??new Float32Array(i),iSection:new Float32Array(i).fill(-1),iYaw:new Float32Array(i)}}var ui=64;function fl(t,n){let e=[];for(let i of n){let s=t.idToIndex.get(i.seatId);if(s===void 0)continue;let l=Xn(i.state);t.iState[s]!==l&&(t.iState[s]=l,e.push(s))}if(!e.length)return[];e.sort((i,s)=>i-s);let r=[],o=e[0],a=e[0];for(let i=1;i<e.length;i++){let s=e[i];if(s!==a){if(s<=a+ui){a=s;continue}r.push({start:o,length:a-o+1}),o=s,a=s}}return r.push({start:o,length:a-o+1}),r}import Ii from"polygon-clipping";var Y={top:1,wallBottom:.58,bottomCap:.4};function Xt(t,n){if(!t)return n;let e=Z(St(t,.4),.62);return et(n,e,.22)}function Ye(t,n){return t?et(n,Z(St(t,.25),.74),.62):n}function ze(t,n){return t?et(n,Z(St(t,.08),.9),.82):n}function Ke(t,n){let e=new Map;for(let a of t.categories??[])e.set(a.key,a.color);let r=new Map;for(let a of n){if(!a.sectionId)continue;let i=r.get(a.sectionId);i||(i=new Map,r.set(a.sectionId,i)),i.set(a.categoryKey,(i.get(a.categoryKey)??0)+1)}let o=new Map;for(let[a,i]of r){let s=0,l=0,u=0,c=0;for(let[f,m]of i){let d=ot(e.get(f));d&&(s+=d[0]*m,l+=d[1]*m,u+=d[2]*m,c+=m)}c>0&&o.set(a,[s/c,l/c,u/c])}return o}function Ve(t,n){return ot(t.color)??n.get(t.logicalSectionId??t.id)??null}import ao from"polygon-clipping";import Qe from"polygon-clipping";import fi from"earcut";var mi=.58,Ze=.01,Pt=_n*1.5*Mt,hi=.5,yi=.6;function di(t,n){let e=t.length,r=[];for(let i=0;i<e;i++){let s=t[Math.max(0,i-1)],l=t[Math.min(e-1,i+1)],u=l.x-s.x,c=l.y-s.y,f=Math.hypot(u,c);if(f<1e-9){r.push([0,0]);continue}u/=f,c/=f,r.push([-c,u])}let o=0;for(let i=0;i<e;i++)o+=(t[i].x-n.x)*r[i][0]+(t[i].y-n.y)*r[i][1];return o<0?r.map(([i,s])=>[-i,-s]):r}function pi(t,n){if(t.length<2||n<=0)return[...t];let e=[...t],r=(i,s)=>{let l=s.x-i.x,u=s.y-i.y,c=Math.hypot(l,u)||1;return{x:l/c,y:u/c}},o=r(e[1],e[0]),a=r(e[e.length-2],e[e.length-1]);return e.unshift({x:e[0].x+o.x*n,y:e[0].y+o.y*n}),e.push({x:e[e.length-1].x+a.x*n,y:e[e.length-1].y+a.y*n}),e}var qe=Math.PI/12;function xi(t){if(t.length<3)return[...t];let n=[...t].sort((a,i)=>a.x-i.x||a.y-i.y),e=(a,i,s)=>(i.x-a.x)*(s.y-a.y)-(i.y-a.y)*(s.x-a.x),r=a=>{let i=[];for(let s of a){for(;i.length>=2&&e(i[i.length-2],i[i.length-1],s)<=0;)i.pop();i.push(s)}return i.pop(),i},o=[...r(n),...r([...n].reverse())];return o.length>=3?o:[...t]}function Je(t,n){if(!t.length||!(n>0))return[];let e=xi(t),r=(s,l,u,c)=>{let f=u-l;for(;f<0;)f+=Math.PI*2;for(;f>Math.PI*2;)f-=Math.PI*2;let m=Math.max(1,Math.ceil(f/qe)),d=n/Math.cos(f/m/2);for(let y=0;y<=m;y++){let h=l+f*y/m;c.push({x:s.x+Math.cos(h)*d,y:s.y+Math.sin(h)*d})}};if(e.length<3){let s=0,l=0;for(let d of e)s+=d.x,l+=d.y;s/=e.length||1,l/=e.length||1;let u=0;for(let d of e)u=Math.max(u,Math.hypot(d.x-s,d.y-l));let c=[],f=Math.max(3,Math.ceil(Math.PI*2/qe)),m=(u+n)/Math.cos(Math.PI/f);for(let d=0;d<f;d++){let y=d/f*Math.PI*2;c.push({x:s+Math.cos(y)*m,y:l+Math.sin(y)*m})}return c}let o=e.length,a=[];for(let s=0;s<o;s++){let l=e[s],u=e[(s+1)%o];a.push(Math.atan2(-(u.x-l.x),u.y-l.y))}let i=[];for(let s=0;s<o;s++)r(e[s],a[(s+o-1)%o],a[s],i);return ro(i)}function bi(t,n,e){if(t.length===1)return Math.hypot(n-t[0].x,e-t[0].y);let r=1/0;for(let o=0;o+1<t.length;o++){let a=t[o],i=t[o+1],s=i.x-a.x,l=i.y-a.y,u=s*s+l*l,c=u>1e-12?((n-a.x)*s+(e-a.y)*l)/u:0;c<0?c=0:c>1&&(c=1);let f=Math.hypot(n-(a.x+c*s),e-(a.y+c*l));f<r&&(r=f)}return r}function An(t){let n=t.map(o=>{let a=0,i=0;for(let u of o.pts)a+=u.x,i+=u.y;let s=o.pts.length||1;a/=s,i/=s;let l=0;for(let u of o.pts){let c=Math.hypot(u.x-a,u.y-i);c>l&&(l=c)}return{cx:a,cy:i,rad:l}}),e=o=>{let a=o.length;return a<=2?[...o]:[o[Math.floor(a*.25)],o[Math.floor(a*.5)],o[Math.floor(a*.75)]]},r=[];for(let o=0;o<t.length;o++){let a=e(t[o].pts),i=[],s=1/0,l=null;for(let c of a){let f=1/0;for(let m=0;m<t.length;m++){if(m===o||Math.abs(t[m].y-t[o].y)<.001)continue;let d=n[m],y=Math.hypot(c.x-d.cx,c.y-d.cy)-d.rad;if(y>=f&&y>=s)continue;let h=bi(t[m].pts,c.x,c.y);h<f&&(f=h),t[m].depth<t[o].depth&&h<s&&(s=h,l=t[m].y)}Number.isFinite(f)&&f>0&&i.push(f)}i.sort((c,f)=>c-f);let u=i.length?i[Math.floor(i.length/2)]:1;r.push({pitch:u,belowY:l})}return r}function to(t,n,e,r){let o=t[n],a=o.pts.length>=2?[...o.pts]:o.pts.length===1?(()=>{let c=o.pts[0],f=c.x-r.x,m=c.y-r.y,d=Math.hypot(f,m)||1;f/=d,m/=d;let y=Math.max(e[n].pitch,.001)*.5;return[{x:c.x+m*y,y:c.y-f*y},{x:c.x-m*y,y:c.y+f*y}]})():[];if(a.length<2)return null;let i=0,s=0;for(let c=1;c<a.length;c++){let f=Math.hypot(a[c].x-a[c-1].x,a[c].y-a[c-1].y);f>1e-6&&(i+=f,s++)}let l=s>0?i/s:0,u=pi(a,Math.max(l*yi,Pt));return{pts:u,nrm:di(u,r),front:Math.max(e[n].pitch*mi,Pt),back:Math.max(e[n].pitch*hi,Pt)}}var Kt=1.5,no=.3;function Yn(t,n){if(t.length<3)return t;let e=t[0],r=t[t.length-1],o=r.x-e.x,a=r.y-e.y,i=Math.hypot(o,a),s=-1,l=-1;for(let f=1;f<t.length-1;f++){let m=t[f],d=i>1e-12?Math.abs((m.x-e.x)*a-(m.y-e.y)*o)/i:Math.hypot(m.x-e.x,m.y-e.y);d>s&&(s=d,l=f)}if(s<=n||l<0)return[e,r];let u=Yn(t.slice(0,l+1),n),c=Yn(t.slice(l),n);return[...u.slice(0,-1),...c]}function eo(t,n){if(t.length<4)return t;let e=Yn([...t,t[0]],n);return e.pop(),e.length>=3?e:t}function gi(t){let n=t.map((r,o)=>{let a=t[(o+1)%t.length];return{a:r,b:a,i:o,minX:Math.min(r.x,a.x),maxX:Math.max(r.x,a.x),minY:Math.min(r.y,a.y),maxY:Math.max(r.y,a.y)}}).sort((r,o)=>r.minX-o.minX),e=(r,o,a)=>(o.x-r.x)*(a.y-r.y)-(o.y-r.y)*(a.x-r.x);for(let r=0;r<n.length;r++){let o=n[r];for(let a=r+1;a<n.length&&n[a].minX<=o.maxX;a++){let i=n[a];if(!(Math.abs(o.i-i.i)===1||Math.abs(o.i-i.i)===t.length-1||o.maxY<i.minY||i.maxY<o.minY)&&e(o.a,o.b,i.a)*e(o.a,o.b,i.b)<=0&&e(i.a,i.b,o.a)*e(i.a,i.b,o.b)<=0)return!0}}return!1}function oo(t,n,e){if(t.length<2)return[];let r=e??An(t),o=new Map;for(let i=0;i<t.length;i++){let s=o.get(t[i].blockId);s?s.push(i):o.set(t[i].blockId,[i])}let a=[];for(let[,i]of o){let s=[];for(let b of i){let I=t[b].patch;I&&I.length>=3?a.push({outline:[...I],holes:[],topY:t[b].y}):s.push(b)}if(!s.length)continue;s.sort((b,I)=>t[b].depth-t[I].depth);let u=s.map(b=>to(t,b,r,n)).filter(b=>b!==null);if(!u.length)continue;let c=(b,I)=>({x:b.pts[I].x-b.nrm[I][0]*(b.front+Kt),y:b.pts[I].y-b.nrm[I][1]*(b.front+Kt)}),f=(b,I)=>({x:b.pts[I].x+b.nrm[I][0]*(b.back+Kt),y:b.pts[I].y+b.nrm[I][1]*(b.back+Kt)}),m=u[0],d=u[u.length-1],y=[];for(let b=0;b<m.pts.length;b++)y.push(c(m,b));for(let b of u)y.push(f(b,b.pts.length-1));for(let b=d.pts.length-1;b>=0;b--)y.push(f(d,b));for(let b=u.length-1;b>=0;b--)y.push(c(u[b],0));let h=ro(y),x=1/0;for(let b of s)t[b].y<x&&(x=t[b].y);if(!Number.isFinite(x))continue;if(h.length>=3&&Math.abs(dt(h))>1e-6&&u.every(b=>{let I=b.pts[Math.floor(b.pts.length/2)];return pt(h,I.x,I.y)})&&!gi(h)){a.push({outline:eo(h,no),holes:[],topY:x});continue}for(let b of Mi(u))a.push({outline:b,holes:[],topY:x})}return a}function Mi(t){let n=[];for(let e of t){let r=[],o=[],a=e.front+Kt,i=e.back+Kt;for(let l=0;l<e.pts.length;l++){let u=e.pts[l],c=e.nrm[l];r.push([u.x-c[0]*a,u.y-c[1]*a]),o.push([u.x+c[0]*i,u.y+c[1]*i])}let s=[...r,...o.reverse()];s.length<3||(s.push(s[0]),n.push([s]))}if(!n.length)return[];try{let e=Qe.union(n[0],...n.slice(1)),r=[];for(let o of e){if(!o.length||o[0].length<4)continue;let a=o[0].map(([l,u])=>({x:l,y:u})),i=a[0],s=a[a.length-1];a.length>1&&Math.abs(i.x-s.x)<1e-9&&Math.abs(i.y-s.y)<1e-9&&a.pop(),a.length>=3&&r.push(eo(a,no))}return r}catch{return[]}}function ro(t){let n=[];for(let e of t){let r=n[n.length-1];r&&Math.hypot(e.x-r.x,e.y-r.y)<1e-9||n.push(e)}for(;n.length>2&&Math.hypot(n[0].x-n[n.length-1].x,n[0].y-n[n.length-1].y)<1e-9;)n.pop();return n}var zn=class{constructor(n){this.minX=1/0;this.minY=1/0;this.maxX=-1/0;this.maxY=-1/0;this.rings=n;for(let e of n)for(let r of e)r.x<this.minX&&(this.minX=r.x),r.y<this.minY&&(this.minY=r.y),r.x>this.maxX&&(this.maxX=r.x),r.y>this.maxY&&(this.maxY=r.y)}containsAll(n){for(let e of n)if(e.x<this.minX||e.x>this.maxX||e.y<this.minY||e.y>this.maxY)return!1;for(let e of this.rings){let r=!0;for(let o of n)if(!pt(e,o.x,o.y)){r=!1;break}if(r)return!0}return!1}};function $e(t,n,e,r,o,a){if(r.length<3)return;if(e.containsAll(r)){let u=[0,1,0],c=r[0];for(let f=1;f+1<r.length;f++){let m=r[f],d=r[f+1];t.tri([c.x*S,o,c.y*S],[m.x*S,o,m.y*S],[d.x*S,o,d.y*S],u,a)}return}let i=r.map(u=>[u.x,u.y]);i.push(i[0]);let s;try{s=Qe.intersection([i],n)}catch{return}let l=[0,1,0];for(let u of s){if(!u.length||u[0].length<4)continue;let c=u[0],f=[],m=[];for(let y=0;y<c.length-1;y++)f.push(c[y][0],c[y][1]),m.push([c[y][0],c[y][1]]);if(m.length<3)continue;let d=fi(f,void 0,2);for(let y=0;y<d.length;y+=3){let h=m[d[y]],x=m[d[y+1]],g=m[d[y+2]];t.tri([h[0]*S,o,h[1]*S],[x[0]*S,o,x[1]*S],[g[0]*S,o,g[1]*S],l,a)}}}function io(t,n,e,r,o,a,i){if(n.length<2)return;let s=i??An(n),l=[0,1,0],u=a&&a.length>=3?[[...a.map(d=>[d.x,d.y]),[a[0].x,a[0].y]]]:null,c=a&&a.length>=3?new zn([[...a]]):null,f=d=>{t.setMaterial(2),d(),t.setMaterial(0)},m=d=>{t.setMaterial(3),d(),t.setMaterial(0)};for(let d=0;d<n.length;d++){let y=n[d];if(y.patch&&y.patch.length>=3){let P=[...y.patch],p=s[d].belowY??r;if(m(()=>{if(u&&c)$e(t,u,c,P,y.y,o.tread);else{let _=P[0];for(let M=1;M+1<P.length;M++){let R=P[M],E=P[M+1];t.tri([_.x*S,y.y,_.y*S],[R.x*S,y.y,R.y*S],[E.x*S,y.y,E.y*S],l,o.tread)}}}),y.y>p+Ze){let _=0,M=0;for(let R of P)_+=R.x,M+=R.y;_/=P.length,M/=P.length,f(()=>{for(let R=0;R<P.length;R++){let E=P[R],C=P[(R+1)%P.length],v=C.x-E.x,k=C.y-E.y,A=Math.hypot(v,k);if(A<1e-6)continue;let B=k/A,T=-v/A;(E.x-_)*B+(E.y-M)*T<0&&(B=-B,T=-T);let F=[B,0,T],O=[E.x*S,y.y,E.y*S],L=[C.x*S,y.y,C.y*S],D=[E.x*S,p,E.y*S],G=[C.x*S,p,C.y*S];t.tri(O,L,G,F,o.riser),t.tri(O,G,D,F,o.riser)}})}continue}let h=to(n,d,s,e);if(!h)continue;let{pts:x,nrm:g,front:b,back:I}=h,w=s[d].belowY??r;for(let P=0;P+1<x.length;P++){let p=x[P],_=x[P+1],M=g[P],R=g[P+1];if(Math.hypot(_.x-p.x,_.y-p.y)<1e-6||M[0]===0&&M[1]===0||R[0]===0&&R[1]===0)continue;let E=[(p.x-M[0]*b)*S,y.y,(p.y-M[1]*b)*S],C=[(_.x-R[0]*b)*S,y.y,(_.y-R[1]*b)*S],v=[(p.x+M[0]*I)*S,y.y,(p.y+M[1]*I)*S],k=[(_.x+R[0]*I)*S,y.y,(_.y+R[1]*I)*S];if(m(()=>{u&&c?$e(t,u,c,[{x:p.x-M[0]*b,y:p.y-M[1]*b},{x:_.x-R[0]*b,y:_.y-R[1]*b},{x:_.x+R[0]*I,y:_.y+R[1]*I},{x:p.x+M[0]*I,y:p.y+M[1]*I}],y.y,o.tread):(t.tri(E,C,k,l,o.tread),t.tri(E,k,v,l,o.tread))}),y.y>w+Ze){let A=[E[0],w,E[2]],B=[C[0],w,C[2]],T=[-M[0],0,-M[1]];f(()=>{t.tri(E,C,B,T,o.riser),t.tri(E,B,A,T,o.riser)})}}}}function Pi(t,n){let e=t.eventConfigurationIds;return!e?.length||!!n&&e.includes(n)}function so(t,n){return t.filter(e=>e.type!=="shape"||Pi(e,n))}function co(t,n){let e=t.focalPoint??{x:0,y:0};return t.floors?.length?t.floors.map((r,o)=>({objects:so(r.objects,n),focal:{x:(r.focalPoint??e).x,y:(r.focalPoint??e).y},baseHeightM:r.baseHeightM??0,index:o})):[{objects:so(t.objects,n),focal:e,baseHeightM:0,index:0}]}var Si={minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};function Tt(t){return Oe(t)??Si}function lo(t,n){let e=It(t.outline,Pt),r=Tt(e),o=n.filter(i=>i!==t&&i.outline&&i.outline.length>=3&&zt(r,Tt(i.outline)));if(!o.length)return[e];let a=i=>{let s=i.map(l=>[l.x,l.y]);return s.push(s[0]),s};try{let i=ao.difference([a(e)],...o.map(l=>[a(l.outline)])),s=[];for(let l of i){if(!l.length)continue;let u=l[0].map(([c,f])=>({x:c,y:f}));if(u.length>1){let c=u[0],f=u[u.length-1];Math.abs(c.x-f.x)<1e-9&&Math.abs(c.y-f.y)<1e-9&&u.pop()}u.length>=3&&s.push(u)}return s.length?s:[e]}catch{return[e]}}function uo(t,n){if(!n.length)return t;let e=a=>{let i=a.map(s=>[s.x,s.y]);return i.push(i[0]),i},r=n.map(a=>[e(a)]),o=[];for(let a of t){let i;try{i=ao.intersection([e(a.outline)],r.flat())}catch{o.push(a);continue}for(let s of i){if(!s.length)continue;let l=s[0].map(([u,c])=>({x:u,y:c}));if(l.length>1){let u=l[0],c=l[l.length-1];Math.abs(u.x-c.x)<1e-9&&Math.abs(u.y-c.y)<1e-9&&l.pop()}l.length>=3&&o.push({outline:l,holes:[],topY:a.topY})}}return o.length?o:t}function Ri(t,n){return t===void 0||n===void 0?!0:Math.abs(t-n)<.001}var wn=class{constructor(){this.rings=[];this.boxes=[];this.levels=[]}subtract(n,e){let r=n.map(l=>[l.x,l.y]);if(r.length<3)return[];r.push(r[0]);let o=Tt(n),a=this.rings.filter((l,u)=>zt(o,this.boxes[u])&&Ri(e,this.levels[u])),i=[[r]];if(a.length)try{i=Ii.difference([r],...a).map(u=>u.map(c=>c.map(([f,m])=>[f,m])))}catch{i=[[r]]}this.rings.push([r]),this.boxes.push(o),this.levels.push(e);let s=[];for(let l of i){if(!l.length)continue;let u=l[0].map(([c,f])=>({x:c,y:f}));if(u.length>1){let c=u[0],f=u[u.length-1];Math.abs(c.x-f.x)<1e-9&&Math.abs(c.y-f.y)<1e-9&&u.pop()}u.length>=3&&s.push(u)}return s}};function En(t,n){if(!n)return t;let e=1/0,r=-1/0,o=1/0,a=-1/0;for(let f of t)e=Math.min(e,f.x),r=Math.max(r,f.x),o=Math.min(o,f.y),a=Math.max(a,f.y);let i=(e+r)/2,s=(o+a)/2,l=n*Math.PI/180,u=Math.cos(l),c=Math.sin(l);return t.map(f=>{let m=f.x-i,d=f.y-s;return{x:i+m*u-d*c,y:s+m*c+d*u}})}function it(t){let n=null;if(t.kind==="polygon"&&t.points&&t.points.length>=3&&(n=t.points),t.kind==="rect"&&t.width&&t.height&&(n=rn(t.x??0,t.y??0,t.width,t.height)),t.kind==="ellipse"&&t.width&&t.height){let e=(t.x??0)+t.width/2,r=(t.y??0)+t.height/2;n=Rn(e,r,t.width/2,t.height/2)}return n?En(n,t.rotation):null}function Rt(t){let n=t.role??"",e={stage:{kind:"stage",heightM:1},entrance:{kind:"portal",heightM:2.7},exit:{kind:"portal",heightM:2.7},screen:{kind:"solid",heightM:6},wall:{kind:"solid",heightM:2.8},rail:{kind:"solid",heightM:1.1},suite:{kind:"suite",heightM:3},obstruction:{kind:"solid",heightM:4.5},sound:{kind:"solid",heightM:1.45},restroom:{kind:"solid",heightM:2.4},bar:{kind:"solid",heightM:1.1},concession:{kind:"solid",heightM:1.1},coat:{kind:"solid",heightM:1.1},goal:{kind:"portal",heightM:1.8}},r=n==="stage"&&Re(t.stageKind)?{kind:"stage",heightM:t.stageKind==="ring-boxing"?Ie:.06}:e[n]??{kind:"plate",heightM:.25};return{...r,heightM:t.heightM??r.heightM}}var _i=.08,Ai=30,wi=.015;function Ei(t,n){let e=!1;for(let r=0,o=n.length-1;r<n.length;o=r++){let a=n[r],i=n[o];a.y>t.y!=i.y>t.y&&t.x<(i.x-a.x)*(t.y-a.y)/(i.y-a.y)+a.x&&(e=!e)}return e}function fo(t,n){let e=it(t)??(t.points?.length?En(t.points,t.rotation):null),r=Rt(t),a=!t.role&&r.kind==="plate"&&t.heightM===void 0&&!!e&&Math.abs(dt(e))*q**2>=Ai?wi:r.heightM;if(!e)return{topOffsetM:a,supportOffsetM:0};if(r.kind!=="plate"&&r.kind!=="stage")return{topOffsetM:a,supportOffsetM:0};let i=1/0,s=1/0,l=-1/0,u=-1/0;for(let d of e)i=Math.min(i,d.x),s=Math.min(s,d.y),l=Math.max(l,d.x),u=Math.max(u,d.y);let c=a,f=0,m=1e-6*Math.max(1,l-i,u-s);for(let d of n)l>d.minX&&i<d.maxX&&u>d.minY&&s<d.maxY&&c<=d.topOffsetM+1e-6&&(c=d.topOffsetM+_i),i>=d.minX-m&&l<=d.maxX+m&&s>=d.minY-m&&u<=d.maxY+m&&(!d.poly||e.every(x=>Ei(x,d.poly)||Bi(x,d.poly,m)))&&(f=Math.max(f,d.topOffsetM));return t.fill&&t.fill!=="none"&&t.fill!=="transparent"&&n.push({minX:i,minY:s,maxX:l,maxY:u,topOffsetM:c,poly:e}),{topOffsetM:c,supportOffsetM:Math.min(f,c)}}function Bi(t,n,e){for(let r=0,o=n.length-1;r<n.length;o=r++){let a=n[o],i=n[r],s=i.x-a.x,l=i.y-a.y,u=s*s+l*l,c=u?Math.max(0,Math.min(1,((t.x-a.x)*s+(t.y-a.y)*l)/u)):0;if(Math.hypot(t.x-(a.x+c*s),t.y-(a.y+c*l))<=e)return!0}return!1}function vt(t,n,e){return{x:t.x+(n.x-t.x)*e,y:t.y+(n.y-t.y)*e}}function xt(t){if(t.length!==4)return t;let n=Math.hypot(t[1].x-t[0].x,t[1].y-t[0].y),e=Math.hypot(t[2].x-t[1].x,t[2].y-t[1].y);return n>=e?t:[t[1],t[2],t[3],t[0]]}function yt(t,n,e){return[vt(t[0],t[1],n),vt(t[0],t[1],e),vt(t[3],t[2],e),vt(t[3],t[2],n)]}function an(t,n,e){return[vt(t[0],t[3],n),vt(t[1],t[2],n),vt(t[1],t[2],e),vt(t[0],t[3],e)]}function J(t,n,e,r,o,a){V(t,n,void 0,()=>e,r,o,a,Y)}function cn(t){if(t.length<3)return t.map(a=>({...a}));let n=[...t].sort((a,i)=>a.x-i.x||a.y-i.y),e=(a,i,s)=>(i.x-a.x)*(s.y-a.y)-(i.y-a.y)*(s.x-a.x),r=a=>{let i=[];for(let s of a){for(;i.length>=2&&e(i[i.length-2],i[i.length-1],s)<=0;)i.pop();i.push(s)}return i.pop(),i},o=[...r(n),...r([...n].reverse())];return o.length>=3?o.map(a=>({...a})):n.map(a=>({...a}))}var Ti=.8,Oi=.6,Ci=2;function Vt(t,n){if(!n.length)return null;let e=[],r=0;for(let i of t.objects){if(i.type!=="shape"||i.role!=="wall")continue;let s=it(i)??[],l=mo(s)/2;!(l>0)||Li(s)/l*S>Ci||(e.push(...s),r+=l)}if(e.length<3)return null;let o=cn(e);if(o.length<3||r<mo(o)*Oi)return null;let a=0;for(let i of n)vi(i,o)&&(a+=1);return a>=n.length*Ti?o:null}var ho=6,ki=5,Fi=8;function yo(t){return Math.max(Fi,(Number.isFinite(t)?t:0)+ki)}function po(t){let n=0,e=0,r=0;for(let o=0;o<t.length;o++){let a=t[o],i=t[(o+1)%t.length],s=a.x*i.y-i.x*a.y;n+=s,e+=(a.x+i.x)*s,r+=(a.y+i.y)*s}if(Math.abs(n)<1e-9){let o=0,a=0;for(let i of t)o+=i.x,a+=i.y;return{x:o/Math.max(1,t.length),y:a/Math.max(1,t.length)}}return{x:e/(3*n),y:r/(3*n)}}function Li(t){let n=0;for(let e=0;e<t.length;e++){let r=t[e],o=t[(e+1)%t.length];n+=r.x*o.y-o.x*r.y}return Math.abs(n)/2}function mo(t){let n=0;for(let e=0;e<t.length;e++){let r=t[e],o=t[(e+1)%t.length];n+=Math.hypot(o.x-r.x,o.y-r.y)}return n}function vi(t,n){let e=!1;for(let r=0,o=n.length-1;r<n.length;o=r++){let a=n[r],i=n[o];a.y>t.y!=i.y>t.y&&t.x<(i.x-a.x)*(t.y-a.y)/(i.y-a.y)+a.x&&(e=!e)}return e}var Di=[[/\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"]],Ni=1.2,Gi=12;function xo(t){if(t.heightM!==void 0)return!1;let n=it(t);if(!n||n.length<3)return!1;let e=0;for(let o=0;o<n.length;o++){let a=n[o],i=n[(o+1)%n.length];e+=Math.hypot(i.x-a.x,i.y-a.y)}return e*q<Gi*2?!1:2*ln(n)/e*q<=Ni}function Kn(t){if(!t)return null;for(let[n,e]of Di)if(n.test(t))return e;return null}var go="auto-rows-";function Mo(t){return t.id.startsWith(go)&&!t.label}var Hi=1.15,Xi=.09,Po=6,ji=34,Ui=.35,Wi=6,Yi=.35,zi=.75,Ki=12,Vi=2.5,Zi=40,qi=[18,24],$i=[12,16],bo=14,Qi=.8,Ji=.6,ts=5,ns=.3,So=.4,Io=2,es=400,os=2.6,rs=.8,is=4,ss=26,as=.7,cs=.5,ls=.985,us=1.5,fs=1.8,ms=3,hs=25,ys=.985,ds=2,ps=6,xs=3,bs=.1,gs=1.5,Ms=1.6,Ps=6e3,Ss=.6,Is="#c3c7cd",Vn=300,Rs=240;function _s(t,n,e,r){if(!t.fill||!/^#[0-9a-f]{6}$/i.test(t.fill))return null;let o=qn([...n]),a=new Set;for(let c of r)a.add(Math.floor(Math.atan2(c.y-o.y,c.x-o.x)*180/Math.PI/10));if(a.size*10<Rs)return null;let{h:i,s,l}=we(Ae(t.fill));return i<70/360||i>170/360||s<.2||l<.08||l>.75||e.some(c=>c!==t&&c.type==="shape"&&it(c)?.some(f=>Jn(f,n)))?null:t.kind==="ellipse"?"oval-cricket":t.kind==="rect"?"pitch-football":null}var As="Estimated from the drawing; confirm with the venue.",$n=t=>{if(!t.length)return null;let n=[...t].sort((r,o)=>r-o),e=Math.floor(n.length/2);return n.length%2?n[e]:(n[e-1]+n[e])/2},qn=t=>({x:t.reduce((n,e)=>n+e.x,0)/t.length,y:t.reduce((n,e)=>n+e.y,0)/t.length}),ln=t=>{let n=0;for(let e=0;e<t.length;e++){let r=t[e],o=t[(e+1)%t.length];n+=r.x*o.y-o.x*r.y}return Math.abs(n)/2};function ws(t){return t.height!==void 0||t.rake!==void 0||t.elevation!==void 0||t.surfaceKind!==void 0}function Qn(t){let n=new Map;for(let e of t){let r=n.get(e.rowId);r?r.push(e):n.set(e.rowId,[e])}return n}function Jn(t,n){let e=!1;for(let r=0,o=n.length-1;r<n.length;o=r++){let a=n[r],i=n[o];a.y>t.y!=i.y>t.y&&t.x<(i.x-a.x)*(t.y-a.y)/(i.y-a.y)+a.x&&(e=!e)}return e}function te(t,n){let e=n[0],r=1/0;for(let o=0;o<n.length;o++){let a=n[o],i=n[(o+1)%n.length],s=i.x-a.x,l=i.y-a.y,u=s*s+l*l,c=u>0?Math.max(0,Math.min(1,((t.x-a.x)*s+(t.y-a.y)*l)/u)):0,f={x:a.x+s*c,y:a.y+l*c},m=Math.hypot(t.x-f.x,t.y-f.y);m<r&&(r=m,e=f)}return e}function Ro(t,n){let e=0,r=0;for(let o of t.values()){if(o.length<3)continue;let a=o[0],i=o[o.length-1],s=i.x-a.x,l=i.y-a.y,u=Math.hypot(s,l);if(u<1e-6)continue;let c={x:(a.x+i.x)/2,y:(a.y+i.y)/2},f=te(c,n),m=f.x-c.x,d=f.y-c.y,y=Math.hypot(m,d);y<1e-6||(r+=Math.abs((-l*m+s*d)/(u*y))*o.length,e+=o.length)}return e?r/e:0}function Es(t,n,e){let r=t.filter(h=>h.type==="shape"),o=r.find(h=>h.role==="stage");if(o){let h=it(o);return h?{shape:o,centre:qn(h),outline:h,inferred:!1}:null}if(!e.length)return null;let a=1/0,i=-1/0,s=1/0,l=-1/0;for(let h of e)a=Math.min(a,h.x),i=Math.max(i,h.x),s=Math.min(s,h.y),l=Math.max(l,h.y);let u=(i-a)*(l-s),c=[];for(let h of r){if(h.role)continue;let x=it(h);if(!x)continue;let g=ln(x);if(g*q*q<6||g>u)continue;let b=Math.min(...x.map(R=>R.x)),I=Math.max(...x.map(R=>R.x)),w=Math.min(...x.map(R=>R.y)),P=Math.max(...x.map(R=>R.y)),p=0;for(let R of e)R.x>b&&R.x<I&&R.y>w&&R.y<P&&Jn(R,x)&&p++;if(p>e.length*.05)continue;let _=qn(x),M=Ro(n,x);M>=Qi&&c.push({shape:h,centre:_,outline:x,score:M,area:g,box:[b,w,I,P]})}let f=(h,x)=>x!==h&&x.area>h.area&&h.box[0]>=x.box[0]-1e-6&&h.box[1]>=x.box[1]-1e-6&&h.box[2]<=x.box[2]+1e-6&&h.box[3]<=x.box[3]+1e-6,m=c.filter(h=>!c.some(x=>f(h,x))),d=Math.max(0,...m.map(h=>h.score)),y=m.filter(h=>h.score>=d-.03).sort((h,x)=>x.area-h.area)[0]??null;return y?{shape:y.shape,centre:y.centre,outline:y.outline,inferred:!0}:null}function Bs(t,n,e){if(!e||e.length<3)return Math.hypot(t.x-n.x,t.y-n.y);let r=te(t,e);return Math.hypot(t.x-r.x,t.y-r.y)}function _o(t){let n=[...t].sort((a,i)=>a.x-i.x||a.y-i.y);if(n.length<3)return n;let e=(a,i,s)=>(i.x-a.x)*(s.y-a.y)-(i.y-a.y)*(s.x-a.x),r=[];for(let a of n){for(;r.length>=2&&e(r[r.length-2],r[r.length-1],a)<=0;)r.pop();r.push(a)}let o=[];for(let a=n.length-1;a>=0;a--){let i=n[a];for(;o.length>=2&&e(o[o.length-2],o[o.length-1],i)<=0;)o.pop();o.push(i)}return[...r.slice(0,-1),...o.slice(0,-1)]}function Ts(t){if(!t.length||t.length>Ps)return[];let n=[...Qn(t).values()],e=n.map((s,l)=>l),r=s=>e[s]===s?s:e[s]=r(e[s]),o=Ms/q,a=n.map(s=>({minX:Math.min(...s.map(l=>l.x))-o,maxX:Math.max(...s.map(l=>l.x))+o,minY:Math.min(...s.map(l=>l.y))-o,maxY:Math.max(...s.map(l=>l.y))+o}));for(let s=0;s<n.length;s++)for(let l=s+1;l<n.length;l++){let u=a[s],c=a[l];if(u.maxX<c.minX||c.maxX<u.minX||u.maxY<c.minY||c.maxY<u.minY)continue;n[s].some(m=>n[l].some(d=>Math.hypot(m.x-d.x,m.y-d.y)<=o))&&(e[r(s)]=r(l))}let i=new Map;return n.forEach((s,l)=>{let u=r(l),c=i.get(u);c?c.push(...s):i.set(u,[...s])}),[...i.values()].filter(s=>new Set(s.map(l=>l.rowId)).size>=2)}function Os(t,n,e){if(!n.length)return null;let r=n.filter(M=>e.tableIds.has(M.rowId)||M.kind==="booth").length>n.length/2,o=Qn(n),a=!e.outline||Ro(o,e.outline)>=Ji,i=0,s=0;for(let M of o.values()){if(M.length<2)continue;let R=M[0],E=M[M.length-1],C=E.x-R.x,v=E.y-R.y,k=Math.hypot(C,v);if(k<1e-6)continue;let A={x:(R.x+E.x)/2,y:(R.y+E.y)/2},B=a?e.outline?te(A,e.outline):e.focal:e.middle,T=-v/k,F=C/k;T*(B.x-A.x)+F*(B.y-A.y)<0&&(T=-T,F=-F),i+=T*M.length,s+=F*M.length}let l={x:n.reduce((M,R)=>M+R.x,0)/n.length,y:n.reduce((M,R)=>M+R.y,0)/n.length};if(Math.hypot(i,s)<1e-9){let M=a?e.focal:e.middle;i=M.x-l.x,s=M.y-l.y}let u=Math.hypot(i,s)||1,c={x:i/u,y:s/u},f=M=>-(M.x*c.x+M.y*c.y),m=M=>-M.x*c.y+M.y*c.x,d=1/0,y=-1/0,h=1/0,x=-1/0,g=1/0,b=new Map;for(let M of n){let R=f(M),E=m(M);d=Math.min(d,R),y=Math.max(y,R),h=Math.min(h,E),x=Math.max(x,E),a&&(g=Math.min(g,Bs(M,e.focal,e.outline)));let C=M.logicalRowId??M.rowId,v=b.get(C);v?v.push(R):b.set(C,[R])}a||(g=Math.max(0,d-f(e.middle)));let I=[...b.values()].map(M=>$n(M)).sort((M,R)=>M-R),w=[];if(!r)for(let M of I)w.length&&M-w[w.length-1]<Yi/q||w.push(M);let P=ws(t),p=Wt(t,{floorBaseHeightM:e.baseHeightM}),_={id:t.id,section:t,authored:P,plane:e,facing:c,facesAction:a,hull:_o(n),sample:n.filter((M,R)=>R%Math.ceil(n.length/es)===0),frontD:d,backD:y,latMin:h,latMax:x,frontDistance:g,rowDepths:w,rowCount:w.length,level:0,height:p.height,rake:P?p.rake:0,backHeight:0};return _.backHeight=_.height+(y-d)*q*Math.tan(_.rake*Math.PI/180),_}function Cs(t,n,e,r){if(t.length<2)return 0;let o=Math.max(1,n*q),a=e+Hi-r,i=0,s=0;for(let u=1;u<t.length;u++){let c=Math.max(zi,(t[u]-t[u-1])*q),f=(a+Xi)*(o+c)/o;i+=f-a,s+=c,a=f,o+=c}let l=Math.atan(i/s)*180/Math.PI;return Math.round(Math.max(Po,Math.min(ji,l))*10)/10}function ks(t,n,e=!1){if(!e&&t.facing.x*n.facing.x+t.facing.y*n.facing.y<ns)return null;let r=-1/0,o=1/0,a=-1/0;for(let m of n.hull){r=Math.max(r,-(m.x*t.facing.x+m.y*t.facing.y));let d=-m.x*t.facing.y+m.y*t.facing.x;o=Math.min(o,d),a=Math.max(a,d)}if(Math.min(t.latMax,a)-Math.max(t.latMin,o)<(e?1e-6:So*(t.latMax-t.latMin)))return null;let s=Io/q,l=new Map,u=new Map;for(let m of t.sample){let d=Math.floor((-m.x*t.facing.y+m.y*t.facing.x)/s),y=-(m.x*t.facing.x+m.y*t.facing.y);l.set(d,Math.min(l.get(d)??1/0,y))}for(let m of n.sample){let d=Math.floor((-m.x*t.facing.y+m.y*t.facing.x)/s),y=-(m.x*t.facing.x+m.y*t.facing.y);u.set(d,Math.max(u.get(d)??-1/0,y))}let c=[];for(let[m,d]of l){let y=u.get(m);y!==void 0&&c.push(d-y)}let f=c.length?$n(c):t.frontD-r;return f<-1/q?null:f}function Fs(t,n){if(n.plane.floorIndex>=t.plane.floorIndex)return!1;let e=-1/0,r=1/0,o=1/0,a=-1/0;for(let l of n.hull){let u=-(l.x*t.facing.x+l.y*t.facing.y);e=Math.max(e,u),r=Math.min(r,u);let c=-l.x*t.facing.y+l.y*t.facing.x;o=Math.min(o,c),a=Math.max(a,c)}let i=Math.min(t.latMax,a)-Math.max(t.latMin,o),s=Math.min(t.backD,e)-Math.max(t.frontD,r);return i>So*(t.latMax-t.latMin)&&s>1/q}function Ls(t,n){let e=new Set;for(let r of t){let o=(Math.atan2(r.y-n.y,r.x-n.x)*180/Math.PI+360)%360;e.add(Math.floor(o/10))}return e.size/36}function vs(t,n){let e=1/0,r=-1/0;for(let a of n.hull){let i=-(a.x*t.facing.x+a.y*t.facing.y);e=Math.min(e,i),r=Math.max(r,i)}let o=Math.max(0,Math.min(r-e,t.frontD-e));return n.height+o*q*Math.tan(n.rake*Math.PI/180)}function Ds(t,n){if(!t.facesAction)return!1;let e={x:-t.facing.y,y:t.facing.x},r=Io/q,o=Math.max(1,Math.ceil((t.backD-t.frontD)/r)),a={left:new Map,right:new Map};for(let s of n)if(!(s===t||s.plane.floorIndex!==t.plane.floorIndex)&&!(s.facing.x*t.facing.x+s.facing.y*t.facing.y>=ls))for(let l of s.sample){let u=-(l.x*t.facing.x+l.y*t.facing.y);if(u<t.frontD||u>t.backD)continue;let c=-l.x*t.facing.y+l.y*t.facing.x,f=c<t.latMin?"left":c>t.latMax?"right":null;if(!f)return!1;let m=Math.min(o-1,Math.floor((u-t.frontD)/r)),d=f==="left"?t.latMin-c:c-t.latMax;d<(a[f].get(m)?.gap??1/0)&&a[f].set(m,{gap:d,other:s})}let i=s=>{let l=s==="left"?t.latMin:t.latMax,u=0;for(let[c,{other:f}]of a[s]){if((f.facing.x*e.x+f.facing.y*e.y)*(s==="left"?1:-1)<as)continue;let d=t.frontD+(c+.5)*r,y={x:-d*t.facing.x+l*e.x,y:-d*t.facing.y+l*e.y},h=-(y.x*f.facing.x+y.y*f.facing.y),x=-y.x*f.facing.y+y.y*f.facing.x;h<f.frontD&&x>=f.latMin&&x<=f.latMax&&u++}return u/o>=cs};return i("left")&&i("right")}function Ns(t,n){if(n.plane.floorIndex!==t.plane.floorIndex||n.facing.x*t.facing.x+n.facing.y*t.facing.y<ys)return!1;let e=1/0,r=-1/0,o=1/0;for(let s of n.hull){let l=-s.x*t.facing.y+s.y*t.facing.x;e=Math.min(e,l),r=Math.max(r,l),o=Math.min(o,-(s.x*t.facing.x+s.y*t.facing.y))}let a=(t.frontD-o)*q;if(a<-ds||a>ps)return!1;let i=Math.max(e-t.latMax,t.latMin-r);return i*q<=xs&&i*q>=-bs}function Gs(t,n=!1,e=!1,r){let o=n?$i:qi,a=new Set(e?[]:t.filter(h=>!h.authored&&Ds(h,t))),i=[...t].sort((h,x)=>h.plane.floorIndex-x.plane.floorIndex||Number(a.has(x))-Number(a.has(h))||h.frontDistance-x.frontDistance);for(let h of a)r?.add(h.id);let s=(h,x,g)=>{let b=new Map,I=[],w=new Map,P=p=>{if(p.plane.floorIndex===0||p.plane.baseHeightM>0)return p.plane.baseHeightM;let _=w.get(p.plane.floorIndex-1);return _===void 0?p.plane.baseHeightM:_+ve};for(let p of i){if(a.has(p))p.height=P(p),p.level=0,p.rake=0,p.backHeight=p.height,b.set(p.id,void 0);else if(!p.authored){let M=P(p),R;for(let A of I){if(A.plane.floorIndex>p.plane.floorIndex)continue;if(Fs(p,A)){let O=vs(p,A)+os;O>M&&(M=O,R=A);continue}let B=ks(p,A,a.has(A));if(B==null)continue;let T=e&&!!p.plane.stageDeck&&A.level===0&&A.plane.floorIndex===p.plane.floorIndex&&Math.max(0,B)*q<=is,F=a.has(A)?A.height+us:T?A.backHeight:A.backHeight+Ui+Math.min(Wi,Math.max(0,B)*q)*Math.tan(A.rake*Math.PI/180);F>M&&(M=F,R=A)}let E=h.get(p);E&&E.height>M+.01?(M=E.height,R=void 0):E=void 0,p.height=Math.round(Math.min(M,p.plane.baseHeightM+Zi)*100)/100;let C=!R&&!E&&p.height>p.plane.baseHeightM;if(p.level=R?R.level+1:E?E.level:C?1:0,p.rake=Cs(p.rowDepths,p.frontDistance,p.height,p.plane.focalHeightM),!p.facesAction&&p.rowCount<ts)p.rake=0;else if(p.level===0){let A=Math.max(1e-6,(p.backD-p.frontD)*q);p.rake=Math.min(p.rake,Ki,Math.round(Math.atan(Vi/A)*1800/Math.PI)/10)}else p.rowCount>=2&&(p.rake=Math.max(p.rake,o[Math.min(p.level,o.length)-1]));let v=(p.backD-p.frontD)*q,k=R&&a.has(R)||E&&g?.has(E.id);if(x!==void 0&&k&&p.rowCount>=2&&(p.rake=x),n&&v>0&&p.height+v*Math.tan(p.rake*Math.PI/180)>p.plane.baseHeightM+bo){let A=Math.max(0,p.plane.baseHeightM+bo-p.height);p.rake=Math.max(Po,Math.round(Math.atan(A/v)*1800/Math.PI)/10)}e&&p.plane.stageDeck&&p.level>0&&(p.rake=Math.min(p.rake,ss)),p.backHeight=p.height+v*Math.tan(p.rake*Math.PI/180),b.set(p.id,R?.id??(E?b.get(E.id):void 0))}let _=p.plane.floorIndex;w.set(_,Math.min(w.get(_)??1/0,p.height)),I.push(p)}return b},l=s(new Map),u=new Map,c=h=>u.get(h)?.height??h.height;for(let h=!0,x=0;h&&x<t.length;x++){h=!1;for(let g of t)if(!(g.authored||a.has(g)))for(let b of t){let I=u.get(b)??b;b===g||I.height-I.plane.baseHeightM<gs||I.height<=c(g)+.01||Ns(g,b)&&(u.set(g,I),h=!0)}}let f=new Map(t.map(h=>[h.id,h])),m=t.filter(h=>!h.authored&&h.rowCount>=2&&a.has(f.get(l.get(h.id)??""))),d=m.length?$n(m.map(h=>h.rake)):void 0;if(!u.size&&d===void 0)return l;let y=new Map([...new Set(u.values())].map(h=>[h,{...h}]));return s(new Map([...u].map(([h,x])=>[h,y.get(x)])),d,new Set(m.map(h=>h.id)))}var Zn=(t,n)=>!!t&&t.x===n.x&&t.y===n.y;function Ao(t,n={x:0,y:-40}){let e=Mn(t),r=new Map;for(let g of e){if(!g.sectionId)continue;let b=r.get(g.sectionId);b?b.push(g):r.set(g.sectionId,[g])}let o={focalInferred:!1,confident:!1,sections:[]},a=t.floors?.length?t.floors.map((g,b)=>({objects:g.objects,floorIndex:b,floorId:g.id,baseHeightM:g.baseHeightM??0,focal:g.focalPoint??t.focalPoint})):[{objects:t.objects,floorIndex:0,floorId:void 0,baseHeightM:0,focal:t.focalPoint}],i=new Set(a.flatMap(g=>g.objects.filter(b=>b.type==="table").map(b=>b.id))),s=[],l,u=new Set,c=a.map(g=>{let b=k=>!t.floors?.length||k.floorId===g.floorId,I=Ts(e.filter(k=>!k.sectionId&&k.kind!=="booth"&&!i.has(k.rowId)&&b(k))),w=[];for(let k of I){let A=It(Et(_o(k)),Ss/q);if(e.some(T=>!b(T)&&Jn(T,A)))continue;let B=`${go}${g.floorIndex}-${w.length}`;u.add(B),r.set(B,k),w.push({type:"section",id:B,label:"",color:Is,outline:A})}let P=w.length?{...g,objects:[...g.objects,...w]}:g,p=new Set(P.objects.filter(k=>k.type==="section").map(k=>k.logicalSectionId??k.id)),_=[...r.entries()].filter(([k])=>p.has(k)).flatMap(([,k])=>k),M=Es(P.objects,Qn(_),_),R=P.focal;(M||P.focal&&!Zn(P.focal,n))&&(o.confident=!0),M&&(o.stage??={id:M.shape.id,inferred:M.inferred,...P.floorId?{floorId:P.floorId}:{}},(M.inferred||Zn(P.focal,n))&&(R=M.centre,o.focalInferred=!0));let E=M&&(!M.inferred||ln(M.outline)*q*q<=Vn),C=M?void 0:l,v={tableIds:i,floorIndex:P.floorIndex,floorId:P.floorId,baseHeightM:P.baseHeightM,focal:C?.focal??R,outline:M?.outline??C?.outline,focalHeightM:C?.focalHeightM??P.baseHeightM+(M&&E?Rt({...M.shape,role:"stage"}).heightM:0),stageDeck:C?.stageDeck??!!(M&&E&&ln(M.outline)*q*q<=Vn),middle:_.length?{x:_.reduce((k,A)=>k+A.x,0)/_.length,y:_.reduce((k,A)=>k+A.y,0)/_.length}:R};for(let k of P.objects){if(k.type!=="section")continue;let A=Os(k,r.get(k.logicalSectionId??k.id)??[],v);A&&s.push(A)}return v.outline&&(l=v),Zn(P.focal,v.focal)||(o.focal??=[]).push({...P.floorId?{floorId:P.floorId}:{},point:{...v.focal}}),{unit:P,plane:v,stage:M,planeSeats:_}}),f=a.flatMap(g=>g.objects).map(g=>g.type==="shape"&&!g.role&&(Kn(g.label)==="wall"||!Kn(g.label)&&xo(g))?{...g,role:"wall"}:g),m=Vt({objects:f},e)!==null;m&&(o.indoor=!0);let d=new Set,y=Gs(s,m,Ls(e,c[0]?.plane.focal??n)<rs,d),h=new Map(s.filter(g=>!g.authored).map(g=>[g.id,g])),x=c.map(({unit:g,plane:b,stage:I,planeSeats:w})=>g.objects.map(P=>{let p=P.type==="shape"&&!P.role&&P.id!==I?.shape.id?Kn(P.label):null;if(P.type==="shape"&&!P.role&&P.id!==I?.shape.id&&(p==="wall"||!p&&xo(P))&&P.type==="shape"){(o.roles??=[]).push({id:P.id,...b.floorId?{floorId:b.floorId}:{},role:"wall"});let{fill:A,...B}=P;return{...B,role:"wall"}}if(p&&P.type==="shape")return(o.roles??=[]).push({id:P.id,...b.floorId?{floorId:b.floorId}:{},role:p}),{...P,role:p};let M=I?.inferred&&P.id===I.shape.id&&P.type==="shape"?_s(P,I.outline,g.objects,w):null;if(M&&P.type==="shape")return o.stage?.id===P.id&&(o.stage.field=M),{...P,role:"stage",stageKind:M};let R=P.type==="shape"&&P.id===I?.shape.id&&P.heightM===void 0&&!P.stageKind&&s.some(A=>A.plane===b&&(d.has(A.id)||A.level===0&&A.facesAction&&A.rake<=ms&&(A.frontDistance+A.backD-A.frontD)*q>=hs)),E=R?{heightM:fs}:{};if(I?.inferred&&P.id===I.shape.id&&P.type==="shape"&&ln(I.outline)*q*q<=Vn)return o.stage?.id===P.id&&(o.stage.deck=!0),{...P,role:"stage",...E};if(R&&P.type==="shape"&&P.role==="stage")return{...P,...E};let C=P.type==="section"?h.get(P.id):void 0;if(!C||P.type!=="section")return P;let v=C.rowCount>=2&&C.rake>0;u.has(C.id)?o.looseRowBlocks=(o.looseRowBlocks??0)+1:o.sections.push({id:C.id,floorId:b.floorId,surfaceKind:v?"rakedRows":"flat",height:C.height,rake:C.rake,stackedOn:y.get(C.id)});let k={status:"inferred",source:"public-2d-topology",note:As};return{...P,height:C.height,rake:C.rake,surfaceKind:v?"rakedRows":"flat",physical3dProvenance:{height:k,rake:k,surfaceKind:k}}}));if(t.floors?.length){let g=t.floors.map((b,I)=>({...b,objects:x[I],focalPoint:c[I].plane.focal}));return{doc:{...t,floors:g,objects:g[0].objects,focalPoint:g[0].focalPoint},report:o}}return{doc:{...t,objects:x[0],focalPoint:c[0].plane.focal},report:o}}function $l(t,n,e){return e<0?n>1?t.filter(r=>r.kind==="floor"):[...t]:t.filter(r=>r.floorIndex===void 0||r.floorIndex===e)}function Ql(t,n){let e=[...t].sort((o,a)=>o.screen.y-a.screen.y),r=[];for(let o of e){let a=r.find(i=>i.some(s=>Math.abs(s.screen.x-o.screen.x)<104&&Math.abs(s.screen.y-o.screen.y)<34));a?a.push(o):r.push([o])}return r.flatMap(o=>o.length<2?o:o.map((a,i)=>({...a,screen:{...a.screen,x:Math.max(54,Math.min(n-54,a.screen.x+(i-(o.length-1)/2)*104))}})))}var Hs=1.15,Xs=2.75,js=4.5,Us=.85,Ws=.5,Ys=.26;function Jl(t,n,e){let r=Math.max(1e-6,n),o=t/r,a=e?.hasZoneLabels??!0,i=new Set(["stage"]);return o>=.75&&i.add("floor"),o>=Hs&&i.add("zone"),o<=(a?Xs:js)&&(i.add("section"),i.add("ga")),o<=Us&&(i.add("annotation"),i.add("booth")),o<=Ws&&i.add("row"),o<=Ys&&i.add("seat"),i}function tu(t,n,e,r,o,a=6){let i=a+n,s=r-a-n,l=a+e,u=o-a-e;return{...t,x:i>s?r/2:Math.max(i,Math.min(s,t.x)),y:l>u?o/2:Math.max(l,Math.min(u,t.y))}}function nu(t,n,e,r){let o=t,a=n[0],i=n[1],s=n[2],l=o[0]*a+o[4]*i+o[8]*s+o[12],u=o[1]*a+o[5]*i+o[9]*s+o[13],c=o[2]*a+o[6]*i+o[10]*s+o[14],f=o[3]*a+o[7]*i+o[11]*s+o[15];if(!(f>1e-6))return{x:0,y:0,depth:1/0,visible:!1};let m=l/f,d=u/f,y=c/f,h=m>=-1.05&&m<=1.05&&d>=-1.05&&d<=1.05&&y<=1;return{x:(m*.5+.5)*e,y:(1-(d*.5+.5))*r,depth:y,visible:h}}function eu(t,n,e=n){let r=[],o=[...t].sort((a,i)=>a.screen.depth-i.screen.depth);for(let a of o){let i=!1;for(let s of r)if(ne(a,s,n,e)){i=!0;break}i||r.push(a)}return r}var zs=6;function ne(t,n,e,r){let o=Math.abs(t.screen.x-n.screen.x),a=Math.abs(t.screen.y-n.screen.y),i=t.halfWidth!=null&&n.halfWidth!=null?Math.max(e,t.halfWidth+n.halfWidth+zs):e;return o<i&&a<r}function ou(t,n,e){return t.length*n*.58+(e?14:0)}var Ks={row:8,seat:14};function ru(t){return t<480?{row:5,seat:8}:t<768?{row:6,seat:10}:Ks}function iu(t,n,e,r){let o=Math.max(1,Math.min(e,r)*.5),a=Math.min(2,Math.hypot(t.x-e/2,t.y-r/2)/o);return n*(1+1.5*a)}function su(t,n,e,r,o=[]){let a=[...t].sort((s,l)=>(l.priority??0)-(s.priority??0)||s.focus-l.focus),i=[];for(let s of a){if(i.length>=r)break;let l=!1;for(let u of o)if(ne(s,u,n,e)){l=!0;break}if(!l){for(let u of i)if(ne(s,u,n,e)){l=!0;break}}l||i.push(s)}return i}function au(t,n,e,r){let o=t[3]*n[0]+t[7]*n[1]+t[11]*n[2]+t[15];return o<=0||!(e>0)?0:e*Math.hypot(t[0],t[4],t[8])*r/(2*o)}function Zt(t,n,e){if(t.length!==4||e<=n)return null;let r=xt(t),o=Math.hypot(r[1].x-r[0].x,r[1].y-r[0].y)*S,a=Math.hypot(r[3].x-r[0].x,r[3].y-r[0].y)*S;if(o<1e-6||a<1e-6)return null;let i=Math.min(.22/o,.16),s=Math.min(.28,(e-n)*.13),l=Math.min(.065/a,.2);return{quad:r,side:i,face:l,opening:yt(r,i,1-i),openingTop:e-s}}function ee(t,n,e){if(t.length!==4||e-n<=.2)return null;let r=xt(t),o=Math.hypot(r[1].x-r[0].x,r[1].y-r[0].y)*S;if(o<=1e-6)return null;let a=Math.min(.14,(e-n)*.08,o*.08),i=a/o,s=yt(r,i,1-i);return{quad:r,side:i,trim:a,inner:s,panel:an(s,.15,.85),bottom:n+a,top:e-a}}function wo(t,n,e,r){let o=ee(t,n,e);if(!o)return;let{panel:a}=o,i=(b,I)=>({x:(b.x+I.x)/2,y:(b.y+I.y)/2}),s=i(a[0],a[1]),l=i(a[3],a[2]),u=Math.hypot(s.x-r.x,s.y-r.y)<=Math.hypot(l.x-r.x,l.y-r.y),[c,f]=u?[a[0],a[1]]:[a[3],a[2]],m=u?{x:s.x-l.x,y:s.y-l.y}:{x:l.x-s.x,y:l.y-s.y},d=Math.hypot(m.x,m.y);if(d<1e-6)return;-(f.y-c.y)*m.x+(f.x-c.x)*m.y<0&&([c,f]=[f,c]);let y=Math.min(.006,d*S*.05),h=m.x/d*y,x=m.y/d*y,g=(b,I)=>[b.x*S+h,I,b.y*S+x];return[g(c,o.bottom),g(f,o.bottom),g(c,o.top),g(f,o.top)]}import Vs from"polygon-clipping";function Ot(t,n,e,r,o,a,i,s={}){let l=Tt(n),u=s.ao??Y,c=o.flatMap(h=>{if(h.role!=="entrance"&&h.role!=="exit")return[];let x=it(h);if(!x||x.length!==4||!zt(l,Tt(x)))return[];let g=s.portalBase??e,b=Zt(x,g,g+Rt(h).heightM);if(!b)return[];let I=Math.min(r,b.openingTop);return I<=e?[]:[{poly:b.opening,height:I}]});if(!c.length)return!1;let f=h=>h.map(x=>[x.x,x.y]),m=[f(n),...(s.holes??[]).map(f)],d=[e,...new Set(c.map(h=>h.height)),r].sort((h,x)=>h-x),y=[];try{for(let h=1;h<d.length;h++){let x=d[h-1],g=d[h];if(g-x<1e-6)continue;let b=c.filter(w=>w.height>x+1e-6).map(w=>[f(w.poly)]),I=b.length?Vs.difference(m,...b):[m];y.push({low:x,high:g,polys:I})}}catch{return!1}for(let h of y)for(let x of h.polys){let[g,...b]=x.map(w=>w.map(([P,p])=>({x:P,y:p}))),I=w=>u.wallBottom+(u.top-u.wallBottom)*(w-e)/(r-e);V(t,g,b,()=>h.high,h.low,a,i,{...u,top:I(h.high),wallBottom:I(h.low)})}return!0}function Eo(t,n,e,r,o,a,i){let s=r-e;if(s<=0)return;let l=s<1.5?[[e,r,1]]:[[e,e+Math.min(.9,s*.18),.82],[e+Math.min(.9,s*.18),r-.1,1],[r-.1,r,1.1]],u=c=>Y.wallBottom+(Y.top-Y.wallBottom)*(c-e)/s;for(let[c,f,m]of l){let d={...Y,top:u(f),wallBottom:u(c)},y=Z(a,m),h=Z(i,m);Ot(t,n,c,f,o,y,h,{portalBase:e,ao:d})||V(t,n,void 0,()=>f,c,y,h,d)}}function un(t,n,e){let r=ot(n.stroke?.color),o=n.stroke?.width??0;if(!r||!Number.isFinite(o)||o<=0)return;let a=n.kind==="line"||n.kind==="polyline",i=a?En(n.points??[],n.rotation):it(n);if(!i||i.length<2)return;let s=a?i.length-1:i.length,l=o*.5;for(let u=0;u<s;u++){let c=i[u],f=i[(u+1)%i.length],m=Math.hypot(f.x-c.x,f.y-c.y);if(m<1e-6)continue;let d=-(f.y-c.y)/m*l,y=(f.x-c.x)/m*l,h=[(c.x+d)*S,e,(c.y+y)*S],x=[(f.x+d)*S,e,(f.y+y)*S],g=[(f.x-d)*S,e,(f.y-y)*S],b=[(c.x-d)*S,e,(c.y-y)*S];t.tri(h,x,g,[0,1,0],r),t.tri(h,g,b,[0,1,0],r)}}function Bo(t){return t==="bar"||t==="concession"||t==="coat"||t==="restroom"}var qt=(t,n,e)=>({x:t.x+(n.x-t.x)*e,y:t.y+(n.y-t.y)*e});function Bn(t,n,e,r){let[o,a,i,s]=n?t:[t[3],t[2],t[1],t[0]];return[qt(o,s,e),qt(a,i,e),qt(a,i,r),qt(o,s,r)]}function To(t,n,e,r,o,a,i,s,l=!1){if(e.length!==4||o-r<.4)return!1;let u=M=>l?Math.min(M,o):M,c=xt(e),f=Math.hypot(c[3].x-c[0].x,c[3].y-c[0].y)*S;if(f<.4)return!1;let m=qt(c[0],c[1],.5),d=qt(c[3],c[2],.5),y=Math.hypot(m.x-s.x,m.y-s.y)<=Math.hypot(d.x-s.x,d.y-s.y),h=et(i,[.92,.9,.86],.35),x=Z(a,.72),g=o-r;if(n==="restroom"){let M=Math.min(.18,g*.08);return J(t,c,o-M,r,i,a),J(t,c,o,o-M,h,h),!0}let b=r+Math.min(1.1,g),I=n==="coat"?1:Math.min(.5,.75/f),w=Bn(c,y,0,I);if(J(t,w,b-.05,r,x,a),J(t,w,b,b-.05,h,h),n==="coat"||f<1.2)return!0;if(n==="bar"){let M=Bn(c,y,Math.max(I+.2,1-.45/f),1),R=u(r+Math.max(Math.min(2.2,g*2),b-r+.6));return J(t,M,R,r,i,x),!0}let P=Bn(c,y,Math.max(I+.25,.55),1),p=u(r+Math.max(2.6,b-r+1.4));if(p-.14<=b)return!0;J(t,P,p-.14,r,i,a),J(t,c,p,p-.14,h,x);let _=Math.min(.08,.1/Math.max(.1,Math.hypot(c[1].x-c[0].x,c[1].y-c[0].y)*S));for(let[M,R]of[[0,_],[1-_,1]])J(t,Bn(yt(c,M,R),y,0,Math.min(.08,.1/f)),p-.14,b,x,x);return!0}var Dt=.06,Zs=.05,Co=.05,Oo=.15,oe=25;function ko(t,n,e){let r=new Map,o=new Array(n.length).fill(null),a=new Float64Array(n.length),i=new Array(n.length).fill(void 0),s=new Array(n.length).fill(void 0),l=new Map,u=[],c=new Set;for(let m=0;m<t.length;m+=1){let d=t[m];for(let y of d.objects){if(y.type==="table"&&c.add(y.id),y.type!=="section"||!y.outline||y.outline.length<3)continue;let h=It(y.outline,Pt);l.set(y.id,{section:y,unit:d,frontU:1/0,hasSeats:!1,rows:new Map,seatIndices:[]}),u.push({id:y.id,floorIndex:m,box:Tt(h),section:y,unit:d,outline:h})}}let f=new Map;for(let m of u){let d=f.get(m.floorIndex);d?d.push(m):f.set(m.floorIndex,[m])}for(let m=0;m<n.length;m++){let d=n[m],y=e?f.get(e[m])??[]:u,h=d.sectionId?y.find(g=>g.id===d.sectionId)??y.find(g=>g.section.logicalSectionId===d.sectionId&&wt({x:d.x,y:d.y},g.outline,g.section.holes)):void 0,x=h?[h]:y;for(let g of x){if(e&&g.floorIndex!==e[m]||!h&&(d.x<g.box.minX||d.x>g.box.maxX||d.y<g.box.minY||d.y>g.box.maxY||!wt({x:d.x,y:d.y},g.outline,g.section.holes)))continue;o[m]=g.id;let b=l.get(g.id);b.hasSeats=!0;let I=d.focalPoint??g.unit.focal,w=Math.hypot(d.x-I.x,d.y-I.y);w<b.frontU&&(b.frontU=w),b.seatIndices.push(m);let P=d.rowId||`__seat-${m}`,p=b.rows.get(P);p?p.push({x:d.x,y:d.y}):b.rows.set(P,[{x:d.x,y:d.y}]);break}}for(let[m,d]of l){let y=Wt(d.section,{floorBaseHeightM:d.unit.baseHeightM}),h=d.unit.baseHeightM,x=y.rake>0?Math.tan(y.rake*Math.PI/180):0,g=y.rake<=.01&&y.height<=h+.001,b=d.section.surfaceKind,I=b==="flat"?!0:b==="rakedRows"&&y.rake>.01?!1:g,w=d.hasSeats?Se(m,n,d.seatIndices,d.unit.focal):{sectionId:m,rows:[],blockCount:0},p=w.rows.length<2?ke([...d.rows.values()].map(O=>({points:O})),d.unit.focal):null,_=1/0;if(p){if(d.hasSeats)for(let O of d.rows.values())for(let L of O){let D=p.depthAt(L.x,L.y);D<_&&(_=D)}if(!d.hasSeats||!Number.isFinite(_)){_=1/0;for(let O of d.section.outline){let L=p.depthAt(O.x,O.y);L<_&&(_=L)}}}let M=h+Zs,R=Math.max(M,y.height),E=O=>{let L=Math.max(0,O-_)*q,D=Math.min(L*x,oe);return Math.max(M,y.height+D)},C=O=>{let L=Math.max(0,O)*q,D=Math.min(L*x,oe);return Math.max(M,y.height+D)},v=I?[]:w.rows.map(O=>({pts:O.pts,y:C(O.blockDepth),depth:O.blockDepth,blockId:O.blockId,...c.has(O.id)?{patch:Je(O.pts,Pt)}:{}})),k=v.length?v[0].y:R,A=v.map(O=>{let L=O.patch&&O.patch.length>=3?O.patch:O.pts,D=0,G=0;for(let X of L)D+=X.x,G+=X.y;let j=L.length||1;D/=j,G/=j;let U=0;for(let X of L){let W=Math.hypot(X.x-D,X.y-G);W>U&&(U=W)}return{cx:D,cy:G,rad:U}}),B=I?()=>R:v.length>=2?(O,L)=>{let D=1/0,G=k;for(let j=0;j<v.length;j++){let U=A[j];if(Math.hypot(O-U.cx,L-U.cy)-U.rad>=D)continue;let X=v[j].patch,W=X&&X.length>=3?pt(X,O,L)?0:bn(X,O,L):bn(v[j].pts,O,L);W<D&&(D=W,G=v[j].y)}return G}:(O,L)=>p?E(p.depthAt(O,L)):R,T=[0,1,0],F=v.length>=2||I?()=>T:(O,L)=>{if(!p)return T;let D=p.depthAt(O,L);if(D<=_)return T;let G=(D-_)*q;if(G*x>=oe||y.height+G*x<=M)return T;let[j,U]=p.gradientAt(O,L);if(j===0&&U===0)return T;let X=1/Math.hypot(x,1);return[-j*x*X,X,-U*x*X]};if(!I)for(let O of w.rows){let L=C(O.blockDepth);for(let D of O.seatIndices)i[D]=L}for(let O of w.rows){let L=[];for(let X=1;X<O.pts.length;X++){let W=Math.hypot(O.pts[X].x-O.pts[X-1].x,O.pts[X].y-O.pts[X-1].y);W>1e-6&&L.push(W)}L.sort((X,W)=>X-W);let D=L.length?L[Math.floor(L.length/2)]:1/0,G=1/0,j=O.pts[Math.floor(O.pts.length/2)];if(j)for(let X of w.rows){if(X===O||X.blockId!==O.blockId)continue;let W=bn(X.pts,j.x,j.y);W>1e-6&&W<G&&(G=W)}let U=Math.min(D,Math.max(G,D*.5));if(Number.isFinite(U)&&U>0)for(let X of O.seatIndices)s[X]=U}r.set(m,{sectionId:m,deckAt:B,normalAt:F,flat:I,bottomY:h,rowLevels:v,landingY:k})}for(let m=0;m<n.length;m++){let d=o[m],y=n[m];if(d){let g=i[m];a[m]=(g??r.get(d).deckAt(y.x,y.y))+Oo;continue}let h=y.eyeHeightM,x=Number.isFinite(h)?Math.max(0,h-xn):0;a[m]=y.kind==="booth"?x+Dt+Oo:x}return{bySection:r,seatOwner:o,seatDeckY:m=>a[m],seatPitchU:m=>s[m]}}var qs=[.12,.38,.16],$s=[.72,.62,.45],Qs=[.88,.93,.96],Fo=[.95,.95,.94],Js=[.66,.29,.22],re={length:20.12,width:3.05},ta=.14,na=9.76,Ct=[.93,.94,.95],Tn=[.1,.11,.13],ea=[.45,.85,1.25],oa=1.45,Lo=.012,vo=.004,ra=1.07,ia=.15;function Qt(t,n,e,r,o,a){t.setMaterial(a),V(t,n,e?[e.slice().reverse()]:void 0,()=>r,r-.004,o,o,Y)}var Do=(t,n)=>Lt(t,n/S);function No(t,n,e){let r=n.x-t.x,o=n.y-t.y,a=Math.hypot(r,o);if(a<1e-9)return null;let i=-o/a*e,s=r/a*e;return[{x:t.x+i,y:t.y+s},{x:n.x+i,y:n.y+s},{x:n.x-i,y:n.y-s},{x:t.x-i,y:t.y-s}]}function sa(t,n,e,r){let o=n.map(a=>[a.x*S,e,a.y*S]);t.tri(o[0],o[1],o[2],[0,1,0],r),t.tri(o[0],o[2],o[3],[0,1,0],r)}function On(t,n,e,r,o,a){let i=e/S,s=[{x:n.x-i,y:n.y-i},{x:n.x+i,y:n.y-i},{x:n.x+i,y:n.y+i},{x:n.x-i,y:n.y+i}];V(t,s,void 0,()=>o,r,a,Z(a,.85),Y)}function $t(t,n,e,r,o,a,i){let s=No(n,e,r/S);s&&V(t,s,void 0,()=>a,o,i,Z(i,.85),Y)}function Cn(t){let n=xt(t),e={x:(n[0].x+n[2].x)/2,y:(n[0].y+n[2].y)/2},r=Math.hypot(n[1].x-n[0].x,n[1].y-n[0].y)||1,o=Math.hypot(n[3].x-n[0].x,n[3].y-n[0].y)||1,a={x:(n[1].x-n[0].x)/r,y:(n[1].y-n[0].y)/r},i={x:(n[3].x-n[0].x)/o,y:(n[3].y-n[0].y)/o};return{at:(l,u)=>({x:e.x+(a.x*l+i.x*u)/S,y:e.y+(a.y*l+i.y*u)/S}),lengthM:r*S,widthM:o*S}}function Go(t,n,e){let r=_e(n);if(!r.length)return;let o=1/0,a=-1/0,i=1/0,s=-1/0;for(let I of n.points??[])o=Math.min(o,I.x),a=Math.max(a,I.x),i=Math.min(i,I.y),s=Math.max(s,I.y);let l=(n.rotation??0)*Math.PI/180,u=Math.cos(l),c=Math.sin(l),f=(o+a)/2,m=(i+s)/2,d=I=>l?{x:f+(I.x-f)*u-(I.y-m)*c,y:m+(I.x-f)*c+(I.y-m)*u}:I,y=Math.min(a-o,s-i)*S,h=Math.max(.04,Math.min(.3,y*.004))/S,x=0;t.setMaterial(0);for(let I of r){if(!I.fill)continue;let w=I.points.map(d);Qt(t,w,null,e+Lo+x*vo,ot(I.fill)??Ct,0),x++}let g=r.filter(I=>!(I.fill&&I.ink===I.fill)),b=[...new Set(g.map(I=>I.ink??Hn))];for(let I of b){let w=e+Lo+x++*vo,P=ot(I)??Ct;for(let p of g){if((p.ink??Hn)!==I)continue;let _=p.points.map(d),M=p.closed?_.length:_.length-1;for(let R=0;R<M;R++){let E=No(_[R],_[(R+1)%_.length],h);E&&sa(t,E,w,P)}}}}function Ho(t,n,e,r,o){if(n.length<3)return!1;let a=r+.006,i=o??qs;if(e==="oval-cricket"){let s=n.reduce((P,p)=>P+p.x,0)/n.length,l=n.reduce((P,p)=>P+p.y,0)/n.length,u=P=>n.map(p=>({x:s+(p.x-s)*P,y:l+(p.y-l)*P})),c=8;for(let P=0;P<c;P++){let p=u(1-P/c),_=P===c-1?null:u(1-(P+1)/c);Qt(t,p,_,a,Z(i,P%2?1.04:.96),4)}let f=n[0];for(let P of n)Math.hypot(P.x-s,P.y-l)>Math.hypot(f.x-s,f.y-l)&&(f=P);let m=Math.hypot(f.x-s,f.y-l)||1,d=(f.x-s)/m,y=(f.y-l)/m,h=-y,x=d,g=Math.min(1,2*m*S*ta/re.length),b=re.length*g/2/S,I=re.width*g/2/S,w=[[-b,-I],[b,-I],[b,I],[-b,I]].map(([P,p])=>({x:s+d*P+h*p,y:l+y*P+x*p}));return Qt(t,w,null,a+.004,$s,0),t.setMaterial(0),!0}if(e==="rink-hockey"){let s=Do(n,ia);return Qt(t,s,null,a,Qs,0),t.setMaterial(0),V(t,n,[s.slice().reverse()],()=>r+ra,r,Fo,Z(Fo,.9),Y),!0}if(e==="ring-boxing"&&n.length===4){let{at:s}=Cn(n),l=[s(-3.05,-3.05),s(3.05,-3.05),s(3.05,3.05),s(-3.05,3.05)],u=[[.77,.19,.19],Ct,[.17,.42,.69],Ct];t.setMaterial(0),l.forEach((c,f)=>On(t,c,.07,r,r+oa,u[f]));for(let c of ea)for(let f=0;f<4;f++)$t(t,l[f],l[(f+1)%4],.025,r+c-.025,r+c+.025,Ct);return!0}if(e==="court-tennis"&&n.length===4){let{at:s}=Cn(n);t.setMaterial(0),$t(t,s(0,-6.4),s(0,6.4),.015,r,r+.95,Tn),$t(t,s(0,-6.4),s(0,6.4),.03,r+.95,r+1,Ct);for(let l of[-1,1])On(t,s(0,l*6.4),.05,r,r+1.07,Tn);return!0}if(e==="court-basketball"&&n.length===4){let{at:s,lengthM:l}=Cn(n),u=Math.min(14,l/2-.5);t.setMaterial(0);for(let c of[-1,1]){let f=s(c*(u+1.2),0),m=s(c*(u-1.2),0);On(t,f,.12,r,r+3.4,Tn),$t(t,f,m,.06,r+3.25,r+3.4,Tn),$t(t,s(c*(u-1.2),-.9),s(c*(u-1.2),.9),.03,r+2.9,r+3.95,Ct)}return!0}if(e==="pitch-rugby"&&n.length===4){let{at:s,lengthM:l}=Cn(n),u=l*(50/120);t.setMaterial(0);for(let c of[-1,1]){for(let f of[-2.8,2.8])On(t,s(c*u,f),.07,r,r+12,Ct);$t(t,s(c*u,-2.8),s(c*u,2.8),.06,r+2.94,r+3.06,Ct)}return!0}if(e==="track-athletics"){let s=Do(n,na);return s.length<3?!1:(Qt(t,n,s,a,Js,0),Qt(t,s,null,a,i,4),t.setMaterial(0),!0)}return!1}var Xo=[.19,.4,.15],aa=.012,Ln=2.4,ca=1,la=.75,ua=.15;function _t(t){if(t.points&&t.points.length>=3)return t.points;let{center:n,width:e,height:r,rotation:o}=t;if(!e||!r)return null;let a=(o??0)*Math.PI/180,i=Math.cos(a),s=Math.sin(a),l=e/2,u=r/2;return[[-l,-u],[l,-u],[l,u],[-l,u]].map(([c,f])=>({x:n.x+c*i-f*s,y:n.y+c*s+f*i}))}function Ko(t,n,e,r,o,a,i=!1){let s=_t(n);if(s){if(i){let l=Xt(r,o.boothTop),u=Et([...s]);V(t,It(u,fa/S),[u.slice().reverse()],()=>e+.03,e,l,Z(l,.8),Y);return}if(!(!n.points&&a&&ha(t,s,e,r,a))){if(!n.points&&a&&s.length===4){ma(t,s,e,r,a);return}V(t,s,void 0,()=>e+Ln,e,Xt(r,o.boothTop),o.boothWall,Y)}}}var ie=1.1,jo=[.9,.9,.88],fa=.1,kn=[.87,.87,.85],Uo=.08;function Vo(t,n){let e=l=>({x:(t[l].x+t[(l+1)%4].x)/2,y:(t[l].y+t[(l+1)%4].y)/2}),r=0,o=1/0;for(let l=0;l<4;l++){let u=e(l),c=Math.hypot(u.x-n.x,u.y-n.y);c<o&&(o=c,r=l)}let a=[0,1,2,3].map(l=>t[(r+l)%4]),i=(l,u,c)=>({x:l.x+(u.x-l.x)*c,y:l.y+(u.y-l.y)*c});return{q:a,part:(l,u,c,f)=>{let m=i(a[0],a[1],l),d=i(a[0],a[1],u),y=i(a[3],a[2],l),h=i(a[3],a[2],u);return[i(m,y,c),i(d,h,c),i(d,h,f),i(m,y,f)]},depthM:Math.hypot(a[3].x-a[0].x,a[3].y-a[0].y)*S,widthM:Math.hypot(a[1].x-a[0].x,a[1].y-a[0].y)*S}}function ma(t,n,e,r,o){let{q:a,part:i}=Vo(n,o),s=r??[.35,.42,.55],l=et(s,[.78,.78,.77],.62),u=et(s,[.95,.95,.94],.45);J(t,a,e+Dt,e,l,Z(l,.8)),J(t,i(.05,.95,.72,.98),e+ie-.05,e+Dt,u,Z(u,.8)),J(t,i(.03,.97,.7,1),e+ie,e+ie-.05,jo,Z(jo,.9))}function ha(t,n,e,r,o){if(n.length!==4)return!1;let{q:a,part:i,depthM:s,widthM:l}=Vo(n,o);if(s<1||l<1)return!1;let u=r??[.35,.42,.55],c=et(u,[.78,.78,.77],.62),f=e+Ln,m=Uo/l,d=Uo/s;J(t,a,e+Dt,e,c,Z(c,.8)),J(t,i(0,1,1-d,1),f,e+Dt,kn,Z(kn,.9));for(let[x,g]of[[0,m],[1-m,1]])J(t,i(x,g,0,1-d),f,e+Dt,kn,Z(kn,.9));J(t,i(m,1-m,0,Math.min(.5,.06/s)),f,f-.3,u,Z(u,.85));let y=Math.min(.4,.6/l),h=Math.min(.12,.3/s);return J(t,i(.5-y,.5+y,.72-h,.72+h),e+ca,e+Dt,et(u,[.95,.95,.94],.7),Z(u,.75)),!0}function vn(t){if(t.shape==="round"){let c=t.radius;return c?Rn(t.center.x,t.center.y,c,c,24):null}let{width:n,height:e,rotation:r,center:o}=t;if(!n||!e)return null;let a=(r??0)*Math.PI/180,i=Math.cos(a),s=Math.sin(a),l=n/2,u=e/2;return[[-l,-u],[l,-u],[l,u],[-l,u]].map(([c,f])=>({x:o.x+c*i-f*s,y:o.y+c*s+f*i}))}function Zo(t,n,e,r,o,a=!0){let i=vn(n);if(!i)return;let s=i.reduce((m,d)=>m+d.x,0)/i.length,l=i.reduce((m,d)=>m+d.y,0)/i.length,u=m=>i.map(d=>({x:s+(d.x-s)*m,y:l+(d.y-l)*m})),c=a&&r?Xt(r,o.tableTop):ya,f=e+la;V(t,i,void 0,()=>f,e+da,c,Z(c,.86),Y),V(t,u(.12),void 0,()=>f+.12,f,Wo,Z(Wo,.8),Y)}var ya=[.93,.92,.89],Wo=[.78,.66,.42],da=.25;function qo(t,n,e,r,o,a,i,s,l=[]){let u=it(n);if(!n.role&&(!n.fill||n.fill==="none"||n.fill==="transparent")||!u){un(t,n,e+r+aa);return}let f=s?s.kind==="stage":n.role==="stage",m=s?s.kind==="screen":n.role==="screen",d=s?{kind:f?"stage":"solid",heightM:s.topY-s.baseY}:Rt(n),y=s?.baseY??e,h=s?.topY??e+r;if(f&&i){let M=1/0,R=-1/0,E=1/0,C=-1/0;for(let v of u)v.x<M&&(M=v.x),v.x>R&&(R=v.x),v.y<E&&(E=v.y),v.y>C&&(C=v.y);i.push({cx:(M+R)/2*S,cz:(E+C)/2*S,y:h,halfX:Math.max((R-M)/2*S,.5),halfZ:Math.max((C-E)/2*S,.5)})}let x=ot(n.fill),g=n.role==="wall"||n.role==="entrance"||n.role==="exit",b=g?x?Z(St(x,.12),.95):o.tierTop:f&&x?et(o.stageTop,Z(St(x,.18),.9),.9):!n.role&&x?x:Xt(x,f?o.stageTop:o.decorTop),I=m?x:null,w=g?x?Z(St(x,.12),.85):o.tierWall:f?x?et(o.stageWall,Z(x,.58),.82):o.stageWall:m?I?et(Z(I,1.42),[.24,.46,.82],.08):[.24,.46,.82]:Xt(ot(n.fill),o.decorWall);if(n.role==="wall"&&!s){Eo(t,u,y,h,l,b,w),un(t,n,h+.012);return}if(m&&u.length===4&&h-y>.2){let M=ee(u,y,h);if(!M)return;let{quad:R,side:E,trim:C,inner:v,panel:k}=M,A=[.12,.15,.18];for(let[B,T]of[[0,E],[1-E,1]])J(t,yt(R,B,T),h,y,A,A);J(t,v,y+C,y,A,A),J(t,v,h,h-C,A,A),J(t,k,h-C,y+C,w,w),un(t,n,h+.012);return}let P=x?Z(St(x,.15),.82):w,p=x?Z(St(x,.1),1.02):b;if(Bo(n.role)&&!s&&To(t,n.role,u,y,h,P,p,a,n.heightM!==void 0))return;if((n.role==="sound"||s?.kind==="sound_desk")&&u.length===4&&h-y>.3){let M=xt(u),R=Math.hypot(M[1].x-M[0].x,M[1].y-M[0].y)*S,E=Math.min(.12,.09/Math.max(R,.001)),C=[.18,.21,.24],v=h-Math.min(.12,(h-y)*.15);for(let[k,A]of[[0,E],[1-E,1]])J(t,yt(M,k,A),v,y,C,C);J(t,M,h,v,b,C);return}if(n.role==="rail"&&u.length===4&&h>y){let M=xt(u),R=Math.hypot(M[1].x-M[0].x,M[1].y-M[0].y)*S,E=Math.max(1,Math.min(128,Math.ceil(R/1.4))),C=Math.min(.08,.055/Math.max(.055,R)),v=[.58,.64,.66];for(let k=0;k<=E;k++){let A=k/E,B=Math.min(1-C,Math.max(0,A-C/2));J(t,yt(M,B,B+C),h,y,v,Z(v,.8))}for(let k of[.52,1]){let A=y+(h-y)*k;J(t,M,A,Math.max(y,A-.055),v,Z(v,.8))}return}if(n.role==="goal"&&u.length===4){let M=xt(u),R=Math.hypot(M[1].x-M[0].x,M[1].y-M[0].y)*S,E=Math.min(.12,.1/Math.max(.1,R)),C=[.9,.94,.94];for(let[v,k]of[[0,E],[1-E,1]])J(t,yt(M,v,k),Math.max(y,h-.1),y,C,C);J(t,M,h,Math.max(y,h-.1),C,C);return}if(d.kind==="portal"&&u.length===4){let M=Zt(u,y,h);if(!M)return;let{quad:R,side:E,face:C,openingTop:v}=M;for(let[k,A,B]of[[0,C,1],[C,1-C,.67],[1-C,1,1]]){let T=an(R,k,A),F=Z(b,B),O=Z(w,B);for(let[L,D]of[[0,E],[1-E,1]])J(t,yt(T,L,D),v,y,F,O);J(t,T,h,v,F,O)}return}if(d.kind==="suite"&&u.length===4){let M=u.map((C,v)=>{let k=u[(v+1)%4],A=(C.x+k.x)/2,B=(C.y+k.y)/2;return Math.hypot(A-a.x,B-a.y)}),R=M.indexOf(Math.min(...M)),E=[0,1,2,3].map(C=>u[(R+C)%4]);J(t,yt(E,0,.08),h,y,b,w),J(t,yt(E,.92,1),h,y,b,w),J(t,an(E,.88,1),h,y,b,w),J(t,E,h,Math.max(y,h-.18),b,w);return}if(f&&!n.stageKind?.startsWith("pitch-")&&h-y>.12){let M=h-Math.min(.06,(h-y)*.15);J(t,u,M,y,b,w),J(t,u,h,M,b,et(b,w,.2))}else J(t,u,h,y,b,w);if((n.stageKind==="pitch-football"||n.stageKind==="pitch-rugby")&&u.length===4){t.setMaterial(4);let M=xt(u),R=et(x??Xo,Xo,x?.45:0);for(let E=0;E<12;E++){let C=yt(M,E/12,(E+1)/12),v=Z(R,E%2?1.09:.91),k=C.map(A=>[A.x*S,h+.006,A.y*S]);t.tri(k[0],k[1],k[2],[0,1,0],v),t.tri(k[0],k[2],k[3],[0,1,0],v)}}n.stageKind&&n.stageKind!=="pitch-football"&&Ho(t,u,n.stageKind,h,x),f&&Yt(n.stageKind)&&Go(t,n,h),t.setMaterial(m?1:0),un(t,n,h+.012)}function Dn(t){let{x:n,y:e,width:r,height:o}=t;if(!r||!o)return null;let a=n+r/2,i=e+o/2,s=(t.rotation??0)*Math.PI/180,l=Math.cos(s),u=Math.sin(s),c=r/2,f=o/2;return[[-c,-f],[c,-f],[c,f],[-c,f]].map(([m,d])=>({x:a+m*l-d*u,y:i+m*u+d*l}))}function pa(t){if(!t||!t.startsWith("data:image/svg+xml"))return null;let n=t.slice(t.indexOf(",")+1);if(/;base64/i.test(t.slice(0,t.indexOf(","))))try{n=atob(n)}catch{return null}else try{n=decodeURIComponent(n)}catch{}let e=n.match(/<(?:rect|path)\b[^>]*\bfill="([^"]+)"/i);if(!e)return null;let r=e[1].trim();if(r==="none"||r==="transparent")return null;let o=r.match(/^url\(#([^)]+)\)$/);if(!o)return ot(r);let a=n.match(new RegExp(`<(?:linear|radial)Gradient\\b[^>]*\\bid="${o[1]}"[^>]*>([\\s\\S]*?)</(?:linear|radial)Gradient>`,"i"));if(!a)return null;let i=[];for(let s of a[1].matchAll(/stop-color="([^"]+)"/gi)){let l=ot(s[1].trim());l&&i.push(l)}return i.length?i.reduce((s,l,u)=>et(s,l,1/(u+1)),i[0]):null}function $o(t,n,e,r){if(n.layer==="foreground")return;let o=Dn(n);if(!o)return;let a=e+ua,i=Xt(pa(n.href),r.decorTop),s=Math.max(0,Math.min(1,n.opacity??1));s<1&&(i=et(r.ground,i,s)),V(t,o,void 0,()=>a,e,i,et(i,r.decorWall,.5),Y)}function Qo(t,n,e,r,o){if(!n.points||n.points.length<3)return;let a=Ye(r,o.gaTop);V(t,n.points,n.holes,()=>e+Yo,e,a,o.gaWall,Y),ga(t,n.points,e+Yo)}var Yo=.15,Fn=[.72,.74,.76],se=1.1,zo=.12,ae=.05,xa=.06,ba=2.4;function ga(t,n,e){let r=Et([...n]),o=Lt(r,zo/S),a=Lt(r,(zo+ae)/S);if(o.length<3||a.length<3)return;for(let s of[e+se,e+se*.5])V(t,o,[a.slice().reverse()],()=>s,s-ae,Fn,Z(Fn,.85),Y);let i=xa/2/S;for(let s=0;s<o.length;s++){let l=o[s],u=o[(s+1)%o.length],c=Math.hypot(u.x-l.x,u.y-l.y)*S,f=Math.max(1,Math.round(c/ba));for(let m=0;m<f;m++){let d=m/f,y=l.x+(u.x-l.x)*d,h=l.y+(u.y-l.y)*d,x=[{x:y-i,y:h-i},{x:y+i,y:h-i},{x:y+i,y:h+i},{x:y-i,y:h+i}];V(t,x,void 0,()=>e+se-ae,e,Fn,Z(Fn,.8),Y)}}}var Ma=6,Pa=2.2,Jo=.1,Sa=new Set(["stage","entrance","exit","screen","suite","obstruction","sound","bar","concession","restroom","coat"]),Ia=.3,Ra=1.8,_a=.9,Aa=.55,wa=1,tr=4e3,Ea=6,nr="#d8a425",Ba="#e8c15a",ce="#1c1608";function er(t){let n=t.accessibility;if(n?.length)return{icon:n.includes("wheelchair")?"wheelchair":n[0],color:pn(n)};let e=t.commercial;return e?.obstructedView?{icon:"obstructedView",color:nr,ink:ce}:e?.restrictedView?{icon:"restrictedView",color:nr,ink:ce}:e?.premium?{icon:"premium",color:Ba,ink:ce}:null}var Ta=6e3;function rr(t){let{doc:n,units:e,seats:r,surfaces:o,focal:a}=t,i=n.zones??[],s=[];if(i.length){let l=new Map;for(let c of e)for(let f of c.objects)f.type==="section"&&f.zone&&l.set(f.id,f.zone);let u=new Map;for(let c=0;c<r.length;c++){let f=r[c],m=o.seatOwner[c],d=f.zoneId??(m?l.get(m):void 0);if(!d)continue;let y=u.get(d);y||(y={n:0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0,sumY:0},u.set(d,y)),y.n++,f.x<y.minX&&(y.minX=f.x),f.y<y.minY&&(y.minY=f.y),f.x>y.maxX&&(y.maxX=f.x),f.y>y.maxY&&(y.maxY=f.y),y.sumY+=o.seatDeckY(c)}for(let c of i){let f=u.get(c.id),m=[];for(let[d,y]of l)y===c.id&&m.push(d);if(!f||f.n===0){s.push({id:c.id,label:c.label,color:ot(c.color),sectionIds:m,seatCount:0,center:[0,0,0],radius:0,focalWorld:[(c.focalPoint??a).x*S,1.5,(c.focalPoint??a).y*S]});continue}s.push({id:c.id,label:c.label,color:ot(c.color),sectionIds:m,seatCount:f.n,center:[(f.minX+f.maxX)/2*S,f.sumY/f.n,(f.minY+f.maxY)/2*S],radius:.5*Math.hypot((f.maxX-f.minX)*S,(f.maxY-f.minY)*S)||1,focalWorld:[(c.focalPoint??a).x*S,1.5,(c.focalPoint??a).y*S]})}}return s}function ir(t){let{doc:n,units:e,seats:r,surfaces:o,seatData:a,hintedSeatFloor:i,zones:s,focal:l}=t,u=[],c=[],f=[],m=new Map;for(let d of e)for(let y of d.objects){if(y.type!=="section"||!y.zone)continue;let h=(y.displayLabel||y.label||"").trim().toLocaleLowerCase();if(!h)continue;let x=n.floors?.[d.index]?.name?.trim().toLocaleLowerCase();if(e.length>1&&x===h)continue;let g=m.get(y.zone);g||m.set(y.zone,g=new Set),g.add(h)}for(let d of s)d.seatCount!==0&&(m.get(d.id)?.has(d.label.trim().toLocaleLowerCase())||u.push({id:`zone:${d.id}`,kind:"zone",text:d.label,anchor:[d.center[0],d.center[1]+Ma,d.center[2]],color:n.zones?.find(y=>y.id===d.id)?.color}));{let d=new Map,y=new Map;for(let h=0;h<r.length;h++){let x=o.seatOwner[h];if(!x)continue;let g=d.get(x);g||(g={n:0,x:0,y:0,deck:0},d.set(x,g)),g.n++,g.x+=r[h].x,g.y+=r[h].y,g.deck+=o.seatDeckY(h);let b=y.get(x);b||(b={minX:1/0,maxX:-1/0,minY:1/0,maxY:-1/0,minDeck:1/0,maxDeck:-1/0},y.set(x,b)),b.minDeck=Math.min(b.minDeck,o.seatDeckY(h)),b.maxDeck=Math.max(b.maxDeck,o.seatDeckY(h)),r[h].x<b.minX&&(b.minX=r[h].x),r[h].x>b.maxX&&(b.maxX=r[h].x),r[h].y<b.minY&&(b.minY=r[h].y),r[h].y>b.maxY&&(b.maxY=r[h].y)}for(let h of e)for(let x of h.objects){if(x.type!=="section"||Mo(x))continue;let g=d.get(x.id);if(!g||g.n===0)continue;let b=y.get(x.id),I=[g.x/g.n*S,g.deck/g.n,g.y/g.n*S],w=x.displayLabel||x.label||x.id;c.push({id:x.id,floorIndex:h.index,label:w,seatCount:g.n,center:I,radius:Math.max(1,Math.hypot(b.maxX-b.minX,b.maxY-b.minY)*.5*S),box:{min:[b.minX*S-.4,b.minDeck,b.minY*S-.4],max:[b.maxX*S+.4,b.maxDeck+1,b.maxY*S+.4]},focalWorld:[h.focal.x*S,h.baseHeightM+1.5,h.focal.y*S]});let P=n.floors?.[h.index]?.name?.trim().toLocaleLowerCase();e.length>1&&P===w.trim().toLocaleLowerCase()||u.push({id:`section:${x.id}`,kind:"section",text:w,anchor:[I[0],I[1]+Pa,I[2]],floorIndex:h.index})}}{for(let P of e)for(let p of P.objects){if(p.type!=="gaArea")continue;let _=nn(p.points);if(!_)continue;let M=p.displayLabel||p.label||p.id;u.push({id:`ga:${p.id}`,kind:"ga",text:p.capacity>0?`${M} \xB7 ${p.capacity.toLocaleString()}`:M,anchor:[_.x*S,P.baseHeightM+Ra,_.y*S],floorIndex:P.index})}let d=new Map,y=new Map;for(let P of e)for(let p of P.objects)if(p.type==="section"&&d.set(p.id,p.displayLabel||p.label||p.id),p.type==="row"){let _=p.displayLabel?.trim()||p.segmentedRow?.displayLabel?.trim();_&&y.set(p.id,_)}let h=new Map;for(let P=0;P<r.length;P++){let p=r[P],_=Math.hypot(p.x-l.x,p.y-l.y),M=h.get(p.rowId);(!M||_>M.far)&&h.set(p.rowId,{seat:p,index:P,far:_})}for(let[P,p]of h){let _=o.seatOwner[p.index]??p.seat.sectionId,M=or(p.seat.label,P,d.get(_??""),y.get(P));M&&u.push({id:`row:${P}`,kind:"row",text:M,anchor:[p.seat.x*S,o.seatDeckY(p.index)+_a,p.seat.y*S],floorIndex:i[p.index]})}let x=new Map;for(let P=0;P<r.length;P++){let p=r[P],_=x.get(p.rowId);_||(_={n:0,x:0,y:0,z:0,minX:1/0,maxX:-1/0,minZ:1/0,maxZ:-1/0,label:or(p.label,p.rowId,d.get(o.seatOwner[P]??p.sectionId??""),y.get(p.rowId)),sectionId:o.seatOwner[P]??p.sectionId},x.set(p.rowId,_));let M=P*3,R=a.iPosition[M],E=a.iPosition[M+1],C=a.iPosition[M+2];_.n++,_.x+=R,_.y+=E,_.z+=C,_.minX=Math.min(_.minX,R),_.maxX=Math.max(_.maxX,R),_.minZ=Math.min(_.minZ,C),_.maxZ=Math.max(_.maxZ,C)}for(let[P,p]of x)f.push({id:P,label:p.label,sectionId:p.sectionId,seatCount:p.n,center:[p.x/p.n,p.y/p.n,p.z/p.n],radius:Math.max(.8,Math.hypot(p.maxX-p.minX,p.maxZ-p.minZ)*.5)});let g=0,b=(P,p)=>{g++,u.push({id:`access:${r[P].id}`,kind:"access",text:"",icon:p.icon,color:p.color,...p.ink?{ink:p.ink}:{},seatWidthM:a.iChairWidth[P]*2,anchor:[r[P].x*S,o.seatDeckY(P)+wa,r[P].y*S],floorIndex:i[P],rowId:r[P].rowId})},I=null,w=()=>{if(I){let P=er(r[I.seats[0]]),p=I.seats.length,_=Math.max(1,Math.round(p/Ea));for(let M=0;M<_&&g<tr;M++)b(I.seats[Math.min(p-1,Math.floor((M+.5)*p/_))],P)}I=null};for(let P=0;P<r.length&&g<tr;P++){let p=er(r[P]);if(p&&r[P].accessibility?.length){w(),b(P,p);continue}if(!p){w();continue}I&&I.rowId===r[P].rowId&&I.icon===p.icon?I.seats.push(P):(w(),I={rowId:r[P].rowId,icon:p.icon,seats:[P]})}if(w(),r.length<=Ta)for(let P=0;P<r.length;P++){let p=r[P],_=Oa(p.displayLabel||p.label);_&&u.push({id:`seat:${p.id}`,kind:"seat",seatWidthM:a.iChairWidth[P]*2,text:_,anchor:[p.x*S,o.seatDeckY(P)+Aa,p.y*S],floorIndex:i[P],rowId:p.rowId})}}for(let d of e)for(let y of d.objects)if(y.type==="shape"&&y.role&&Sa.has(y.role)){let h=it(y),x=h?nn(h):null;if(!x||!y.label)continue;u.push({id:`architecture:${y.id}`,kind:y.role==="stage"?"stage":"annotation",text:y.label,anchor:[x.x*S,d.baseHeightM+Rt(y).heightM+Jo,x.y*S],color:y.fill,floorIndex:d.index})}else if(y.type==="text"){if(!y.text)continue;u.push({id:`text:${y.id}`,kind:"annotation",text:y.text,anchor:[y.position.x*S,d.baseHeightM+Jo,y.position.y*S],color:y.color,rotation:y.rotation,floorIndex:d.index})}else if(y.type==="booth"){let h=_t(y);if(!h)continue;let x=nn(h);if(!x)continue;u.push({id:`booth:${y.id}`,kind:"booth",text:y.displayLabel||y.label||y.id,anchor:[x.x*S,d.baseHeightM+Ln+Ia,x.y*S],floorIndex:d.index})}return{labels:u,sections:c,rows:f}}function sr(t,n){if(n.length>1)for(let e of n)t.push({id:`floor:${e.id}`,kind:"floor",text:e.label,anchor:[e.center[0],e.box.max[1]+1.2,e.center[2]],floorIndex:e.index})}function Oa(t){let n=t.lastIndexOf("-");return n>=0&&n<t.length-1?t.slice(n+1):t}function or(t,n,e,r){if(r?.trim())return r.trim();let o=t?t.lastIndexOf("-"):-1,a=o>0?t.slice(0,o):n;return a&&Te(a,e)}var fn=3,jt=.38,mn=.24;function Ca(t){if(t.length<3)return null;let n=t[0],e=t[Math.floor(t.length/2)],r=t[t.length-1],o=(e.x-n.x)*S,a=(e.y-n.y)*S,i=(r.x-n.x)*S,s=(r.y-n.y)*S,l=2*(o*s-a*i);if(Math.abs(l)<1e-7)return null;let u=o*o+a*a,c=i*i+s*s,f=(u*s-c*a)/l+n.x*S,m=(o*c-i*u)/l+n.y*S,d=Math.hypot(n.x*S-f,n.y*S-m);return d<1||d>200||!Number.isFinite(d)||t.some(y=>Math.abs(Math.hypot(y.x*S-f,y.y*S-m)-d)>.03)?null:{x:f,z:m,radius:d}}function ar(t){let n=[],e=new Map,r=(l,u)=>`${Math.floor(l/fn)},${Math.floor(u/fn)}`;for(let l of t)for(let u of l.rows){for(let f of u.pts){let m=f.x*S,d=f.y*S,y=r(m,d),h=e.get(y)??[];h.push({x:m,z:d,y:u.y,floor:l.floorIndex}),e.set(y,h)}if(u.patch||u.pts.length<2)continue;let c=Ca(u.pts);for(let f of[0,u.pts.length-1]){let m=u.pts[f],d=u.pts[f===0?1:f-1],y=m.x-d.x,h=m.y-d.y,x=Math.hypot(y,h);x<1e-6||n.push({sectionId:l.sectionId,floorIndex:l.floorIndex,curve:c,row:u,point:m,x:m.x*S,z:m.y*S,dx:y/x,dz:h/x})}}let o=new Map;n.forEach((l,u)=>{let c=r(l.x,l.z),f=o.get(c)??[];f.push(u),o.set(c,f)});let a=(l,u)=>{let c=Math.floor(l/fn),f=Math.floor(u/fn);return[-1,0,1].flatMap(m=>[-1,0,1].map(d=>`${c+m},${f+d}`))},i=new Map;n.forEach((l,u)=>{let c=-1,f=1/0,m=!1;for(let d of a(l.x,l.z))for(let y of o.get(d)??[]){let h=n[y];if(l.sectionId===h.sectionId&&l.row.blockId===h.row.blockId||l.floorIndex!==h.floorIndex||Math.abs(l.row.y-h.row.y)>.05)continue;let x=h.x-l.x,g=h.z-l.z,b=Math.hypot(x,g);if(b<jt*2+.45||b>fn)continue;let I=l.curve&&h.curve&&Math.hypot(l.curve.x-h.curve.x,l.curve.z-h.curve.z)<=.05&&Math.abs(l.curve.radius-h.curve.radius)<=.05,w=Math.min((x*l.dx+g*l.dz)/b,(-x*h.dx-g*h.dz)/b);(I?w<.8:w<.98)||!I&&(Math.abs(x*l.dz-g*l.dx)>.15||Math.abs(x*h.dz-g*h.dx)>.15)||(b<f-.02?(c=y,f=b,m=!1):Math.abs(b-f)<=.02&&(m=!0))}c>=0&&!m&&i.set(u,c)});let s=[];for(let[l,u]of i){if(l>=u||i.get(u)!==l)continue;let c=n[l],f=n[u],m=Math.hypot(f.x-c.x,f.z-c.z),d=(f.x-c.x)/m,y=(f.z-c.z)/m,h=!1;for(let g of a((c.x+f.x)/2,(c.z+f.z)/2))for(let b of e.get(g)??[]){if(b.floor!==c.floorIndex||Math.abs(b.y-c.row.y)>.75)continue;let I=(b.x-c.x)*d+(b.z-c.z)*y,w=Math.abs((b.x-c.x)*y-(b.z-c.z)*d);I>.01&&I<m-.01&&w<mn+jt&&(h=!0)}if(h)continue;let x=(g,b)=>({x:(c.x+d*g-y*b)/S,y:(c.z+y*g+d*b)/S});s.push({sections:[c.sectionId,f.sectionId],blocks:[c.row.blockId,f.row.blockId],floorIndex:c.floorIndex,ends:[c.point,f.point],clearWidthM:m-2*jt,heightM:(c.row.y+f.row.y)/2,outline:[x(jt,-mn),x(m-jt,-mn),x(m-jt,mn),x(jt,mn)]})}return s}var ka=.15,Fa=.9,La=1.76;function cr(t){return!!t&&t[0]*.2126+t[1]*.7152+t[2]*.0722>.55?{zenith:[.36,.58,.84],horizon:[.82,.88,.94]}:{zenith:[.05,.08,.15],horizon:[.3,.38,.5]}}function va(){return{background:{top:[...Un.top],bottom:[...Un.bottom]},sky:cr(null),structure:jn,seatStates:{...He},seatScale:1,materials:{seat:null,shell:null,roughness:.78}}}function Da(t){return!!t&&t[0]*.2126+t[1]*.7152+t[2]*.0722>.55?{deck:"#c9ccc8",fascia:"#b4bab8",shell:"#c3c9c8",roughness:.87}:{deck:"#69747b",fascia:"#3e4d58",shell:"#526572",roughness:.87}}function lr(t){let n=va();t??={};let e=ot(t.background);if(e){n.background={top:Z(e,Fa),bottom:Z(e,La)},n.sky=cr(e);let s={};for(let[u,c]of Object.entries(jn))s[u]=et(c,e,ka);e[0]*.2126+e[1]*.7152+e[2]*.0722>.55&&(s.ground=Z(e,.86)),n.structure=s}let r=ot(t.selectionColor)??ot(t.accent);r&&(n.seatStates={...n.seatStates,selected:r});let o=t.seatScale;typeof o=="number"&&Number.isFinite(o)&&(n.seatScale=Ce(o));let a=Object.fromEntries(Object.entries(t.venue3d??{}).filter(([,s])=>s!=null)),i={...Da(e),...a};if(i){let s=ot(i.deck),l=ot(i.fascia);s&&(n.structure={...n.structure,tierTop:s,gaTop:s}),l&&(n.structure={...n.structure,tierWall:l,gaWall:l}),n.materials.seat=ot(i.seat),n.materials.shell=ot(i.shell),typeof i.roughness=="number"&&Number.isFinite(i.roughness)&&(n.materials.roughness=Math.min(1,Math.max(0,i.roughness)))}return n}function ur(t,n){let e=[];for(let r of n)e.push(...t.seatStates[r]);return e}var le=.6,fr=3,Na=.25;function Ga(t,n){if(pt(n,t.x,t.y))return 0;let e=1/0;for(let r=0,o=n.length-1;r<n.length;o=r++){let a=n[o],i=n[r],s=i.x-a.x,l=i.y-a.y,u=s*s+l*l||1,c=Math.max(0,Math.min(1,((t.x-a.x)*s+(t.y-a.y)*l)/u));e=Math.min(e,Math.hypot(t.x-(a.x+c*s),t.y-(a.y+c*l)))}return e}function mr(t,n){let e=t.map(i=>({booth:i,ring:_t(i)})).filter(i=>!!i.ring&&i.ring.length===4&&!i.booth.points),r=e.map(({ring:i})=>({minX:Math.min(...i.map(s=>s.x)),maxX:Math.max(...i.map(s=>s.x)),minY:Math.min(...i.map(s=>s.y)),maxY:Math.max(...i.map(s=>s.y))})),o=(fr+le)/S,a=new Map;return e.forEach(({booth:i,ring:s},l)=>{let u={x:s.reduce((d,y)=>d+y.x,0)/4,y:s.reduce((d,y)=>d+y.y,0)/4},c=[0,1,2,3].map(d=>{let y=s[d],h=s[(d+1)%4],x={x:(y.x+h.x)/2,y:(y.y+h.y)/2},g=x.x-u.x,b=x.y-u.y,I=Math.hypot(g,b)||1,w={x:x.x+g/I*le/S,y:x.y+b/I*le/S},P=fr/S;return r.forEach((p,_)=>{_===l||w.x<p.minX-o||w.x>p.maxX+o||w.y<p.minY-o||w.y>p.maxY+o||(P=Math.min(P,Ga(w,e[_].ring)))}),{open:P*S,toward:{x:x.x+g/I*10/S,y:x.y+b/I*10/S},focal:Math.hypot(x.x-n.x,x.y-n.y)}}),f=Math.max(...c.map(d=>d.open)),m=c.filter(d=>d.open>=f-Na).sort((d,y)=>d.focal-y.focal)[0];a.set(i.id,m.toward)}),a}import Ha from"polygon-clipping";var Xa=.45,ja=1500,Ua=200;function hr(t,n){if(t.role!=="stage"||Yt(t.stageKind))return t;let e=it(t);if(!e||e.length<3||Math.abs(dt(e))*S*S>ja)return t;let r=n.filter(i=>pt(e,i.x,i.y));if(!r.length||r.length>Ua)return t;let o=Xa/S,a=r.map(i=>[[[i.x-o,i.y-o],[i.x+o,i.y-o],[i.x+o,i.y+o],[i.x-o,i.y+o],[i.x-o,i.y-o]]]);try{let i=Ha.difference([[...e.map(u=>[u.x,u.y]),[e[0].x,e[0].y]]],...a),s=null,l=0;for(let u of i){let c=u[0].slice(0,-1).map(([m,d])=>({x:m,y:d})),f=Math.abs(dt(c));f>l&&(l=f,s=c)}return!s||s.length<3?t:{...t,kind:"polygon",points:s,rotation:0}}catch{return t}}function ue(t,n,e,r,o,a,i,s,l,u=[],c=o){if(n.length!==e.length||n.length<2||a-o<1.5)return;let f=(h,x,g)=>{Ot(t,h,x,g,u,i,s,{portalBase:c,ao:l})||V(t,h,void 0,()=>g,x,i,s,l)},m=(h,x,g)=>({x:h.x+(x.x-h.x)*g,y:h.y+(x.y-h.y)*g}),d=r?n.length:n.length-1,y=0;for(let h=0;h<d;h++){let x=(h+1)%n.length,g=Math.hypot(e[x].x-e[h].x,e[x].y-e[h].y)*q;if(g<1e-5)continue;let b=(p,_)=>[m(n[h],n[x],p),m(n[h],n[x],_),m(e[h],e[x],_),m(e[h],e[x],p)];f(b(0,1),o,o+.95),f(b(0,1),a-.22,a);let I=Math.ceil((y-.32)/6)*6,w=!1,P=!1;for(let p=I;p<y+g;p+=6){let _=Math.max(0,(p-y)/g),M=Math.min(1,(p+.32-y)/g);M<=_||(f(b(_,M),o+.95,a-.22),w||=_<1e-6,P||=M>1-1e-6)}if(!r&&(h===0&&!w||h===d-1&&!P)){let p=Math.min(1,.32/g);f(b(h===0?0:1-p,h===0?p:1),o+.95,a-.22)}y+=g}}import Ut from"polygon-clipping";var yn=.65;function fe(t,n){let e=1/0;for(let r of n)for(let o=0;o<r.length;o++){let a=r[o],i=r[(o+1)%r.length],s=i.x-a.x,l=i.y-a.y,u=Math.max(0,Math.min(1,((t.x-a.x)*s+(t.y-a.y)*l)/(s*s+l*l||1)));e=Math.min(e,Math.hypot(t.x-a.x-u*s,t.y-a.y-u*l))}return e}var me=.01;function yr(t,n,e,r,o,a,i,s=[],l=!0,u={bays:[],walls:[]}){if(r-o<=1e-5)return;let c=r-o>=3,f=c?r-yn:o;t.setMaterial(5);let m=c?[]:s.filter(p=>{if(p.role!=="entrance"&&p.role!=="exit")return!1;let _=it(p);if(!_)return!1;let M=Zt(_,o,o+Rt(p).heightM);return M!==null&&M.openingTop<=r-.12});if((!m.length||!Ot(t,n,f,r,m,a,i,{holes:e,portalBase:o}))&&V(t,n,e,()=>r,f,a,i,Y,void 0,()=>[0,1,0]),!c){t.setMaterial(0);return}let d=l&&u.bays.length?Wa(n,e,Lt(n,hn/S),u):null,y=6/S,h=.22/S,x=s.flatMap(p=>{if(p.role!=="entrance"&&p.role!=="exit")return[];let _=it(p);return _?.length?[{minX:Math.min(..._.map(M=>M.x)),maxX:Math.max(..._.map(M=>M.x)),minY:Math.min(..._.map(M=>M.y)),maxY:Math.max(..._.map(M=>M.y))}]:[]}),g=Math.min(...n.map(p=>p.x)),b=Math.max(...n.map(p=>p.x)),I=Math.min(...n.map(p=>p.y)),w=Math.max(...n.map(p=>p.y));for(let p=g+y/2;p<b;p+=y)for(let _=I+y/2;_<w;_+=y){if(x.some(R=>p+h>=R.minX&&p-h<=R.maxX&&_+h>=R.minY&&_-h<=R.maxY))continue;let M=[{x:p-h,y:_-h},{x:p+h,y:_-h},{x:p+h,y:_+h},{x:p-h,y:_+h}];!wt({x:p,y:_},n,e)||fe({x:p,y:_},[n,...e??[]])<h*Math.SQRT2+(l?hn/S:0)||d&&fe({x:p,y:_},d.flat())<h*Math.SQRT2+hn/S||V(t,M,void 0,()=>f,o,a,i,Y)}if(d){for(let[p,..._]of d)V(t,p,_,()=>f,o-me,a,i,Y);t.setMaterial(0);return}let P=Lt(n,hn/S);if(l&&P.length>=3){let p=s.filter(R=>{if(R.role!=="entrance"&&R.role!=="exit")return!1;let E=it(R);return!!E&&E.some(C=>!wt(C,n,void 0)||fe(C,[n])<=hn/S)}),_=[P.slice().reverse()],M=o-me;(!p.length||!Ot(t,n,M,f,p,a,i,{holes:_,portalBase:o+me}))&&V(t,n,_,()=>f,M,a,i,Y)}t.setMaterial(0)}var he=.25,hn=he;function Wa(t,n,e,r){if(e.length<3)return null;let o=i=>{let s=i.map(l=>[l.x,l.y]);return s.push(s[0]),s},a=i=>{let[s,...l]=i.map(u=>[o(u)]);return Ut.union(s,...l)};try{let i=[o(t),...(n??[]).map(o)],s=Ut.difference(i,[o(e)]),l=Ut.intersection(i,a(r.bays));if(!l.length)return null;let u=Ut.difference(Ut.intersection(i,a(r.walls)),l);return Ut.union(Ut.difference(s,l),u).map(f=>f.map(m=>m.slice(0,-1).map(([d,y])=>({x:d,y}))))}catch{return null}}var Ya=.02,za=.25,Ka=1.2,Va=.6,Za=.45,qa=2.3,$a=Math.PI/180,dr=.005;function Bt(t,n,e){let r=e*$a;return{x:t.x+n*Math.sin(r),y:t.y+n*Math.cos(r)}}function Qa(t,n){let e=n.rings[n.rings.length-1];if(!e)return!1;let r=e.outerRMedian*.85;for(let o of t){if(o.role!=="wall")continue;let a=o.points&&o.points.length>=2?o.points:o.x!==void 0&&o.y!==void 0&&o.width!==void 0&&o.height!==void 0?[{x:o.x,y:o.y},{x:o.x+o.width,y:o.y},{x:o.x+o.width,y:o.y+o.height},{x:o.x,y:o.y+o.height}]:[];if(a.length<2)continue;let i=0;for(let s of a)Math.hypot(s.x-n.centre.x,s.y-n.centre.y)>=r&&i++;if(i>=a.length/2)return!0}return!1}var Ja=24,tc=.01;function nc(t,n,e,r,o,a,i,s,l){let u=e.binCount,c=Ja,f=q,m=a+.02,d=a-tc,y=[];for(let A=0;A<u;A++){let B=(e.startBin+A+.5)*n.binStepDeg,T=new Float64Array(c+1);for(let F=0;F<=c;F++){let O=r[A]+(o[A]-r[A])*F/c;T[F]=Math.max(m,Le(n,e,B,O)-za)}y.push(T)}if(l){let A=0;for(let B=0;B+1<u;B++)for(let T=0;T<c;T++){let F=Bt(n.centre,r[B]+(o[B]-r[B])*T/c,(e.startBin+B+.5)*n.binStepDeg),O=Bt(n.centre,r[B+1]+(o[B+1]-r[B+1])*(T+1)/c,(e.startBin+B+1.5)*n.binStepDeg);A=Math.max(A,Math.hypot(O.x-F.x,O.y-F.y))}for(let B=0;B<u;B++){let T=(e.startBin+B+.5)*n.binStepDeg;for(let F=0;F<=c;F++){let O=Bt(n.centre,r[B]+(o[B]-r[B])*F/c,T),L=l(O.x,O.y,A*1.01);L!==null&&(y[B][F]=Math.min(y[B][F],Math.max(d+dr,L-dr)))}}}let h=[i.bandTop[0]*s.top,i.bandTop[1]*s.top,i.bandTop[2]*s.top],x=[i.bandTop[0]*s.bottomCap,i.bandTop[1]*s.bottomCap,i.bandTop[2]*s.bottomCap],g=[i.bandWall[0]*s.top,i.bandWall[1]*s.top,i.bandWall[2]*s.top],b=[i.bandWall[0]*s.wallBottom,i.bandWall[1]*s.wallBottom,i.bandWall[2]*s.wallBottom],I=(A,B)=>{let T=(e.startBin+A+.5)*n.binStepDeg,F=r[A]+(o[A]-r[A])*B/c,O=Bt(n.centre,F,T);return[O.x*f,y[A][B],O.y*f]};{let A=Math.tan(12*Math.PI/180);for(let B=0;B<6;B++){let T=!1;for(let O=0;O<u;O++)for(let L=c-1;L>=0;L--)y[O][L]>y[O][L+1]&&(y[O][L]=y[O][L+1],T=!0);let F=e.closed?u:u-1;for(let O=0;O<F;O++){let L=(O+1)%u;for(let D=0;D<=c;D++){let G=y[L][D]-y[O][D];if(Math.abs(G)>1)continue;let j=r[O]+(o[O]-r[O])*D/c,U=r[L]+(o[L]-r[L])*D/c,X=Bt(n.centre,j,(e.startBin+O+.5)*n.binStepDeg),W=Bt(n.centre,U,(e.startBin+L+.5)*n.binStepDeg),$=A*Math.hypot(W.x-X.x,W.y-X.y)*f;G>$?(y[L][D]=y[O][D]+$,T=!0):-G>$&&(y[O][D]=y[L][D]+$,T=!0)}}if(!T)break}}let w=1,P=(A,B)=>{for(let T=0;T<=c;T+=4)if(Math.abs(y[A][T]-y[B][T])>w)return!0;return Math.abs(y[A][c]-y[B][c])>w},p=Math.tan(38*Math.PI/180),_=A=>(o[A]-r[A])/c*f,M=(A,B)=>y[A][B+1]-y[A][B]>p*Math.max(1e-6,_(A)),R=(A,B)=>{let T=e.closed?(A-1+u)%u:Math.max(0,A-1),F=e.closed?(A+1)%u:Math.min(u-1,A+1);Math.abs(y[T][B]-y[A][B])>w&&(T=A),Math.abs(y[F][B]-y[A][B])>w&&(F=A);let O=Math.max(0,B-1),L=Math.min(c,B+1);O<B&&M(A,O)&&(O=B),L>B&&M(A,B)&&(L=B);let D=I(T,B),G=I(F,B),j=I(A,O),U=I(A,L),X=G[0]-D[0],W=G[1]-D[1],$=G[2]-D[2],tt=U[0]-j[0],Q=U[1]-j[1],st=U[2]-j[2],nt=W*st-$*Q,N=$*tt-X*st,H=X*Q-W*tt,K=Math.hypot(nt,N,H);return K>1e-12?(nt/=K,N/=K,H/=K,N<0&&(nt=-nt,N=-N,H=-H),[nt,N,H]):[0,1,0]},E=(A,B,T=!1)=>{let F=T&&Math.min(A[1],B[1])-a>=3,O=[A[0],F?A[1]-yn:d,A[2]],L=[B[0],F?B[1]-yn:d,B[2]],D=B[0]-A[0],G=B[2]-A[2],j=Math.hypot(D,G);if(!(j>1e-12))return;let U=[G/j,0,-D/j];t.tri(A,B,L,U,g,g,b),t.tri(A,L,O,U,g,b,b)},C=.05*Mt,v=A=>o[A]-r[A]<C,k=e.closed?u:u-1;for(let A=0;A<k;A++){let B=(A+1)%u;if(v(A)||v(B))continue;if(P(A,B)){let G=(e.startBin+A+1)*n.binStepDeg,j=(Q,st)=>{let nt=(r[A]+r[B])/2,N=(o[A]+o[B])/2,H=nt+(N-nt)*st/c,K=Bt(n.centre,H,G);return[K.x*f,y[Q][st],K.y*f]};for(let Q=0;Q<c;Q++){let st=I(A,Q),nt=I(A,Q+1),N=j(A,Q),H=j(A,Q+1),K=R(A,Q),at=R(A,Q+1);t.triN(st,N,H,K,K,at,h),t.triN(st,H,nt,K,at,at,h);let ft=I(B,Q),ht=I(B,Q+1),rt=j(B,Q),ct=j(B,Q+1),At=R(B,Q),z=R(B,Q+1);t.triN(rt,ft,ht,At,At,z,h),t.triN(rt,ht,ct,At,z,z,h);let ut=j(A,Q),mt=j(A,Q+1),Nt=j(B,Q+1),Gt=j(B,Q),kt=mt[0]-ut[0],Ft=mt[2]-ut[2],tn=Math.hypot(kt,Ft);if(tn>1e-12){let dn=[Ft/tn,0,-kt/tn];t.tri(ut,mt,Nt,dn,g),t.tri(ut,Nt,Gt,dn,g)}}let U=I(A,0),X=I(B,0),W=I(B,c),$=I(A,c),tt=Q=>[Q[0],d,Q[2]];Math.min(U[1],X[1])-a<3&&(t.tri(tt(U),tt(W),tt(X),[0,-1,0],x),t.tri(tt(U),tt($),tt(W),[0,-1,0],x)),E(U,X,!0),E($,W,!0);continue}for(let G=0;G<c;G++){let j=R(A,G),U=R(B,G),X=R(B,G+1),W=R(A,G+1);if(M(A,G)||M(B,G)){let nt=(mt,Nt)=>{let Gt=(e.startBin+mt+.5)*n.binStepDeg,kt=r[mt]+(o[mt]-r[mt])*(G+.5)/c,Ft=Bt(n.centre,kt,Gt);return[Ft.x*f,Nt,Ft.y*f]},N=I(A,G),H=I(B,G),K=nt(A,y[A][G]),at=nt(B,y[B][G]);t.triN(N,H,at,j,U,U,h),t.triN(N,at,K,j,U,j,h);let ft=I(B,G+1),ht=I(A,G+1),rt=nt(A,y[A][G+1]),ct=nt(B,y[B][G+1]);t.triN(rt,ct,ft,W,X,X,h),t.triN(rt,ft,ht,W,X,W,h);let At=at[0]-K[0],z=at[2]-K[2],ut=Math.hypot(At,z);if(ut>1e-12){let mt=[-z/ut,0,At/ut];t.tri(K,at,ct,mt,g),t.tri(K,ct,rt,mt,g)}continue}let $=I(A,G),tt=I(B,G),Q=I(B,G+1),st=I(A,G+1);t.triN($,tt,Q,j,U,X,h),t.triN($,Q,st,j,X,W,h)}let T=I(A,0),F=I(B,0),O=I(B,c),L=I(A,c),D=G=>[G[0],d,G[2]];Math.min(T[1],F[1])-a<3&&(t.tri(D(T),D(O),D(F),[0,-1,0],x),t.tri(D(T),D(L),D(O),[0,-1,0],x)),E(T,F,!0),E(L,O,!0)}if(!e.closed)for(let A of[0,u-1])for(let B=0;B<c;B++)E(I(A,B),I(A,B+1))}function pr(t,n,e){let{bottomY:r,colors:o,ao:a}=e,i=new Float64Array(n.binCount).fill(-1/0);for(let c of n.rings)for(let f of c.arcs){let m=new Float64Array(f.binCount),d=new Float64Array(f.binCount);for(let h=0;h<f.binCount;h++){let x=(f.startBin+h)%n.binCount,g=Math.max(0,f.innerR[h]-Pt);m[h]=Math.max(g,i[x]+.001),d[h]=Math.max(m[h]+.001,f.outerR[h]+Pt)}let y=0;for(let h=0;h<f.binCount;h++){let x=f.topLevelM[h]-r;x>y&&(y=x)}y>=Ka&&nc(t,n,f,m,d,r,o,a,e.standTopNear);for(let h=0;h<f.binCount;h++){let x=(f.startBin+h)%n.binCount;d[h]>i[x]&&(i[x]=d[h])}}if(e.deriveShell===!1||Qa(e.shapes,n))return;let s=n.rings[n.rings.length-1],l=Va*Mt,u=Za*Mt;for(let c of s.arcs){let f=[],m=[];for(let R=0;R<c.binCount;R++){let E=(c.startBin+R+.5)*n.binStepDeg,C=c.outerR[R]+Pt+l;f.push(Bt(n.centre,C,E)),m.push(Bt(n.centre,C+u,E))}let d=-1/0;for(let R=0;R<c.binCount;R++)c.topLevelM[R]>d&&(d=c.topLevelM[R]);let y=d+qa,h=c.closed?m:[...m,...f.slice().reverse()],x=c.closed?[f.slice().reverse()]:void 0,g=et(o.shellWall,[.66,.71,.72],.62),b=(R,E,C,v,k)=>{let A=Math.abs(v-d)<1e-6?v-Ya:v;Ot(t,R,C,A,e.shapes,o.shellTop,k,{holes:E,portalBase:r,ao:a})||V(t,R,E,()=>A,C,o.shellTop,k,a)},I=Math.max(1,Math.ceil((d-r)/4.5)),w=(d-r)/I,P=new Set,p=e.tierFrontLevels??n.rings.map(R=>{let E=R.arcs.flatMap(C=>Array.from(C.frontLevelM)).filter(Number.isFinite).sort((C,v)=>C-v);return E[Math.floor(E.length/2)]});for(let R of p)Number.isFinite(R)&&R-r>=3&&R<d&&P.add(Math.max(0,Math.min(I-1,Math.floor((R-r)/w))));let _=Math.min(...p.filter(R=>Number.isFinite(R)&&R-r>=3&&R<d));for(let R=0;R<I;R++)r+(R+1)*w<=_-yn&&Number.isFinite(_)&&P.add(R);for(let R=0;R<I;R++){let E=r+(d-r)*R/I,C=r+(d-r)*(R+1)/I;P.has(R)&&C-E>=3.2?(b(h,x,E,E+.45,g),ue(t,f,m,c.closed,E+.45,C-.16,o.shellTop,g,a,e.shapes,r)):b(h,x,E,C-.16,g),b(h,x,C-.16,C,Z(g,.62))}ue(t,f,m,c.closed,d,y,o.shellTop,g,a,e.shapes,r);let M=8;for(let R=1;R<m.length;R++){if(M+=Math.hypot(m[R].x-m[R-1].x,m[R].y-m[R-1].y)*q,M<8)continue;M=0;let E=m[R],C=m[R-1],v=E.x-C.x,k=E.y-C.y,A=Math.max(1,Math.hypot(v,k)),B=v/A*.16*Mt,T=k/A*.16*Mt,F=Math.max(1,Math.hypot(E.x-n.centre.x,E.y-n.centre.y)),O=(E.x-n.centre.x)/F*.24*Mt,L=(E.y-n.centre.y)/F*.24*Mt,D=[{x:E.x-B,y:E.y-T},{x:E.x+B,y:E.y+T},{x:E.x+B+O,y:E.y+T+L},{x:E.x-B+O,y:E.y-T+L}];b(D,void 0,r,d,Z(g,1.12))}}}var ec=2.5,xr=.65,oc=2,rc=.03;function ic(t,n){let e=()=>{let r=n;for(;t.length>2;){let o=t[0],a=t[1],i=Math.hypot(a.x-o.x,a.y-o.y);if(i>r){t[0]={x:o.x+(a.x-o.x)/i*r,y:o.y+(a.y-o.y)/i*r};return}r-=i,t.shift()}};e(),t.reverse(),e(),t.reverse()}function pe(t,n,e){let r=new Map;for(let a of t){let i=r.get(a.blockId);(!i||a.depth<i.depth)&&r.set(a.blockId,a)}let o=[];for(let[a,i]of r){if(i.y-e<ec||i.pts.length<2)continue;let s=i.pts.map(c=>{let f=c.x-n.x,m=c.y-n.y,d=Math.max(1,Math.hypot(f,m));return{x:c.x-f/d*xr/S,y:c.y-m/d*xr/S}}),l=[],u=[s[0]];for(let c=1;c<s.length;c++){let f=s[c-1],m=s[c];Math.hypot(m.x-f.x,m.y-f.y)*S>oc?(u.length>=2&&l.push(u),u=[m]):u.push(m)}u.length>=2&&l.push(u);for(let c of l)ic(c,rc/S);l.length&&o.push({blockId:a,y:i.y,runs:l})}return o}var br=.1,sc=1.1,ac=.22,ye=.95,de=.05,gr=1.8;function Mr(t,n,e,r){let o=[.72,.72,.69],a=[.48,.55,.57];for(let i of pe(n,e,r)){let s=i.y;for(let l of i.runs){let u=gr;for(let c=1;c<l.length;c++){let f=l[c-1],m=l[c],d=m.x-f.x,y=m.y-f.y,h=Math.hypot(d,y);if(h<1e-5)continue;let x=g=>{let b=-y/h*g/S/2,I=d/h*g/S/2;return[{x:f.x+b,y:f.y+I},{x:m.x+b,y:m.y+I},{x:m.x-b,y:m.y-I},{x:f.x-b,y:f.y-I}]};if(V(t,x(ac),void 0,()=>s+br,s-sc,o,o,Y),V(t,x(de),void 0,()=>s+ye,s+ye-de,a,a,Y),u+=h*S,u>=gr||c===l.length-1){u=0;let g=.028/S,b=[{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}];V(t,b,void 0,()=>s+ye-de,s+br,a,a,Y)}}}}}var cc=.9,lc=1.5,uc=.3;function Pr(t,n,e){let r=[],o=[],a=cc/S,i=lc/S,s=uc/S;for(let l of t)for(let u of l.runs){if(u.length<2)continue;let c=u.slice(),f=(x,g)=>{let b=c[x],I=c[g],w=Math.hypot(b.x-I.x,b.y-I.y)||1;c[x]={x:b.x+(b.x-I.x)/w*s,y:b.y+(b.y-I.y)/w*s}};f(0,1),f(c.length-1,c.length-2);let m=c.map((x,g)=>{let b=c[Math.max(0,g-1)],I=c[Math.min(c.length-1,g+1)],w=I.x-b.x,P=I.y-b.y,p=Math.hypot(w,P)||1,_=-P/p,M=w/p;return _*(x.x-n.x)+M*(x.y-n.y)<0&&(_=-_,M=-M),{nx:_,ny:M}}),d=c.map((x,g)=>({x:x.x-m[g].nx*i,y:x.y-m[g].ny*i})),y=c.map((x,g)=>({x:x.x+m[g].nx*a,y:x.y+m[g].ny*a})),h=c.map((x,g)=>({x:x.x+m[g].nx*(a+e/S),y:x.y+m[g].ny*(a+e/S)}));r.push([...d,...y.slice().reverse()]),o.push([...y,...h.reverse()])}return{bays:r,walls:o}}var xe=.88,Nn=.27,fc=1.2,mc=.01;function Sr(t,n,e,r,o){let a=[.67,.71,.68],i=[a[0]*xe,a[1]*xe,a[2]*xe],s=l=>!!o&&o.some((u,c)=>c!==l&&u?.belowY!=null&&Math.abs(u.belowY-n[l].y)<1e-6&&n[c].blockId===n[l].blockId);for(let l=0;l<n.length;l++){let u=n[l];if(!(u.pts.length<2))for(let c of[0,u.pts.length-1]){let f=u.pts[c],m=u.pts[c===0?1:c-1],d=f.x-m.x,y=f.y-m.y,h=Math.hypot(d,y);if(h<1e-5)continue;d/=h,y/=h;let x=1/0;for(let B=0;B<e.length;B++){let T=e[B],F=e[(B+1)%e.length],O=F.x-T.x,L=F.y-T.y,D=d*L-y*O;if(Math.abs(D)<1e-8)continue;let G=T.x-f.x,j=T.y-f.y,U=(G*L-j*O)/D,X=(G*y-j*d)/D;U>0&&X>=0&&X<=1&&(x=Math.min(x,U))}let g=.3/S,b=x-.04/S;if(!Number.isFinite(x)||x*S>2||b-g<.12/S)continue;let I=!!r&&s(l),w=o?.[l]?.pitch,P=I&&w&&Number.isFinite(w)?Math.min(fc/S,Math.max(Nn/S,w-Nn/S-mc/S)):Nn/S,p=-y,_=d;r&&p*(r.x-f.x)+_*(r.y-f.y)<0&&(p=-p,_=-_);let M=Nn/S,R=[{x:f.x+d*g+p*M,y:f.y+y*g+_*M},{x:f.x+d*b+p*M,y:f.y+y*b+_*M},{x:f.x+d*b-p*P,y:f.y+y*b-_*P},{x:f.x+d*g-p*P,y:f.y+y*g-_*P}];if(!R.every(B=>pt(e,B.x,B.y)))continue;let E=o?.[l]?.belowY,C=E==null?0:u.y-E,v=!!r&&C>.03&&C<=.65;if(v&&r){let B=(T,F)=>Math.hypot((T.x+F.x)/2-r.x,(T.y+F.y)/2-r.y);B(R[0],R[1])>B(R[3],R[2])&&(R=[R[3],R[2],R[1],R[0]])}let k=v?Math.ceil((C-1e-8)/.2):1,A=(B,T,F)=>({x:B.x+(T.x-B.x)*F,y:B.y+(T.y-B.y)*F});for(let B=0;B<k;B++){let T=B/k,F=(B+1)/k,O=[A(R[0],R[3],T),A(R[1],R[2],T),A(R[1],R[2],F),A(R[0],R[3],F)],L=u.y+.008-(v?C*(1-F):0);V(t,O,void 0,()=>L,L-(v?C/k+.1:.16),a,i,Y)}}}}function Ir(t,n,e,r,o,a,i,s,l=!1){if(!n.outline||n.outline.length<3)return;let u=e.baseHeightM,c=e.objects.filter(b=>b.type==="shape"&&(b.role==="entrance"||b.role==="exit")),f=ze(r,s.tierTop);if(!o)return;let m=b=>o.deckAt(b.x,b.y),d=lo(n,i),y=d[0]??n.outline;if(o.rowLevels.length>=2){let b=An(o.rowLevels),I=uo(oo(o.rowLevels,e.focal,b),d),w=Pr(pe(o.rowLevels,e.focal,u),e.focal,he);for(let p of I){let _=Math.max(u,p.topY-Rr);for(let M of a.subtract(p.outline,_))yr(t,M,p.holes,_,u,s.tierTop,s.tierWall,c,!l,w)}I.length||V(t,y,n.holes,()=>o.landingY,u,f,s.tierWall,Y);let P={tread:[f[0]*Y.top,f[1]*Y.top,f[2]*Y.top],riser:[f[0]*.72,f[1]*.72,f[2]*.72]};for(let p of d.length?d:[y])io(t,o.rowLevels,e.focal,o.landingY,P,p,b);Mr(t,o.rowLevels,e.focal,u),Sr(t,o.rowLevels,n.outline,e.focal,b);return}let h=o.flat?1/0:Co,x=b=>o.normalAt(b.x,b.y),g=o.flat?o.landingY:void 0;for(let b of a.subtract(y,g))V(t,b,n.holes,m,u,f,s.tierWall,Y,h,x)}function hc(t,n,e){let r=new Set;for(let i of t.objects)i.type==="section"&&r.add(i.id);let o=new Map;for(let i=0;i<n.length;i++){let s=e.seatOwner[i];if(!s||!r.has(s))continue;let l=e.bySection.get(s);if(l&&l.rowLevels.length>=2)continue;let u=n[i];if(u.kind==="booth")continue;let c=o.get(s);c||(c=new Map,o.set(s,c));let f=u.rowId||`__seat-${i}`,m=c.get(f);m||(m={pts:[],levelM:0,n:0},c.set(f,m)),m.pts.push({x:u.x,y:u.y}),m.levelM+=e.seatDeckY(i),m.n++}let a=[];for(let i of t.objects){if(i.type!=="section")continue;let s=e.bySection.get(i.id);if(s&&s.rowLevels.length>=2){let u=s.rowLevels.filter(c=>!c.patch).map(c=>({pts:c.pts,levelM:c.y}));u.length>=2&&a.push({sectionId:i.id,rows:u});continue}let l=o.get(i.id);l&&a.push({sectionId:i.id,rows:[...l.values()].map(u=>({pts:u.pts,levelM:u.levelM/u.n}))})}return a}function yc(t,n){let e=1/0;for(let r=0;r<n.length;r++){let o=n[r],a=n[(r+1)%n.length],i=a.x-o.x,s=a.y-o.y,l=Math.max(0,Math.min(1,((t.x-o.x)*i+(t.y-o.y)*s)/(i*i+s*s||1)));e=Math.min(e,Math.hypot(t.x-o.x-l*i,t.y-o.y-l*s))}return e}var Rr=.02;function dc(t,n){let e=t.objects.filter(r=>r.type==="section"&&!!r.outline&&r.outline.length>=3).flatMap(r=>{let o=n.bySection.get(r.id);if(!o)return[];let a=1/0,i=-1/0,s=1/0,l=-1/0;for(let c of r.outline)c.x<a&&(a=c.x),c.x>i&&(i=c.x),c.y<s&&(s=c.y),c.y>l&&(l=c.y);let u=o.landingY;for(let c of o.rowLevels)u=Math.min(u,c.y-Rr);return[{outline:r.outline,holes:r.holes,surface:o,floorTop:u,minX:a,maxX:i,minY:s,maxY:l}]});return(r,o,a)=>{let i=null;for(let s of e){if(r<s.minX-a||r>s.maxX+a||o<s.minY-a||o>s.maxY+a)continue;let l={x:r,y:o};if(!wt(l,s.outline,s.holes)&&yc(l,s.outline)>a)continue;let u=Math.min(s.surface.deckAt(r,o),s.floorTop);(i===null||u<i)&&(i=u)}return i}}var pc=3,xc=.4;function _r(t,n,e,r,o,a,i=!0){let s=hc(n,e,r);if(s.length<pc)return;let l=Fe(s,n.focal);if(!l)return;let u=Math.max(0,...l.rings.map(c=>c.arcs.reduce((f,m)=>f+m.binCount,0)))/l.binCount;t.setMaterial(5),pr(t,l,{bottomY:n.baseHeightM,tierFrontLevels:s.map(c=>Math.min(...c.rows.map(f=>f.levelM))),colors:{bandTop:Z(o.tierTop,.8),bandWall:o.tierWall,shellTop:a??Z(o.tierWall,1.15),shellWall:a??o.tierWall},ao:Y,shapes:n.objects.filter(c=>c.type==="shape"),deriveShell:i&&u>=xc,standTopNear:dc(n,r)}),t.setMaterial(0)}function Ar(t){let{doc:n,units:e,seats:r,surfaces:o,solids:a,hintedSeatFloor:i,seatFloor:s}=t,l=[];{let u=e.map(()=>({minX:1/0,minY:1/0,minZ:1/0,maxX:-1/0,maxY:-1/0,maxZ:-1/0}));for(let m=0;m<a.floor.length;m+=1){let d=Math.max(0,Math.min(e.length-1,Math.round(a.floor[m]))),y=m*3,h=u[d];h.minX=Math.min(h.minX,a.position[y]),h.minY=Math.min(h.minY,a.position[y+1]),h.minZ=Math.min(h.minZ,a.position[y+2]),h.maxX=Math.max(h.maxX,a.position[y]),h.maxY=Math.max(h.maxY,a.position[y+1]),h.maxZ=Math.max(h.maxZ,a.position[y+2])}let c=new Map;for(let m=0;m<e.length;m++)for(let d of e[m].objects)d.type==="section"&&c.set(d.id,m);let f=e.map(()=>({n:0,minX:1/0,minY:1/0,minDeck:1/0,maxX:-1/0,maxY:-1/0,maxDeck:-1/0,sumX:0,sumDeck:0,sumZ:0}));for(let m=0;m<r.length;m++){let d=o.seatOwner[m],y=(d!==null?c.get(d):void 0)??i[m];if(y===void 0)continue;let h=f[y],x=r[m];h.n++,x.x<h.minX&&(h.minX=x.x),x.y<h.minY&&(h.minY=x.y),x.x>h.maxX&&(h.maxX=x.x),x.y>h.maxY&&(h.maxY=x.y);let g=o.seatDeckY(m);h.sumX+=x.x*S,h.sumDeck+=g,h.sumZ+=x.y*S,h.minDeck=Math.min(h.minDeck,g),h.maxDeck=Math.max(h.maxDeck,g+1.6),s[m]=y}for(let m=0;m<e.length;m++){let d=f[m],y=n.floors?.[m],h=u[m],x=Math.min(d.n?d.minX*S:e[m].focal.x*S-1,Number.isFinite(h.minX)?h.minX:1/0),g=Math.max(d.n?d.maxX*S:e[m].focal.x*S+1,Number.isFinite(h.maxX)?h.maxX:-1/0),b=Math.min(d.n?d.minY*S:e[m].focal.y*S-1,Number.isFinite(h.minZ)?h.minZ:1/0),I=Math.max(d.n?d.maxY*S:e[m].focal.y*S+1,Number.isFinite(h.maxZ)?h.maxZ:-1/0),w=Math.min(d.n?Math.min(e[m].baseHeightM,d.minDeck):e[m].baseHeightM,Number.isFinite(h.minY)?h.minY:1/0),P=Math.max(d.n?Math.max(d.maxDeck,w+.5):w+.5,Number.isFinite(h.maxY)?h.maxY:-1/0),p=[d.n?d.sumX/d.n:(x+g)/2,d.n?d.sumDeck/d.n:(w+P)/2,d.n?d.sumZ/d.n:(b+I)/2],_=Math.max(1,.5*Math.hypot(g-x,P-w,I-b));l.push({index:m,id:y?.id??`floor-${m}`,label:y?.name??(e.length>1?`Floor ${m+1}`:"Venue"),seatCount:d.n,center:p,radius:_,box:{min:[x,w,b],max:[g,P,I]},focalWorld:[e[m].focal.x*S,e[m].baseHeightM+1.5,e[m].focal.y*S]})}}return l}function be(t,n){let e=1/0,r=1/0,o=-1/0,a=-1/0,i=(s,l)=>{s<e&&(e=s),l<r&&(r=l),s>o&&(o=s),l>a&&(a=l)};for(let s of n)i(s.x,s.y);for(let s of t)for(let l of s.objects)if(l.type==="section")for(let u of l.outline)i(u.x,u.y);else if(l.type==="shape"&&l.points)for(let u of l.points)i(u.x,u.y);else if(l.type==="gaArea")for(let u of l.points)i(u.x,u.y);else if(l.type==="booth"){let u=_t(l);if(u)for(let c of u)i(c.x,c.y)}else if(l.type==="table"){let u=vn(l);if(u)for(let c of u)i(c.x,c.y)}else if(l.type==="decorImage"){let u=Dn(l);if(u)for(let c of u)i(c.x,c.y)}return Number.isFinite(e)||(e=-100,r=-100,o=100,a=100),{minX:e,minY:r,maxX:o,maxY:a}}function Cr(t,n,e,r,o,a,i){if(n.length===1){let s=e.map(m=>({x:m.x,y:m.y}));for(let m of n[0].objects)m.type==="section"?s.push(...m.outline):m.type==="shape"?s.push(...it(m)??m.points??[]):m.type==="gaArea"?s.push(...m.points):m.type==="booth"?s.push(..._t(m)??[]):m.type==="table"?s.push(...vn(m)??[]):m.type==="decorImage"&&s.push(...Dn(m)??[]);if(Br(t,n[0],e,a)||Or(t,n[0],e,s,a))return!1;if(i&&Er(t,n[0].baseHeightM,s,a,i))return!0;let l=cn(s),u=(o.minX+o.maxX)/2,c=(o.minY+o.maxY)/2,f=l.length>=3?l.map(m=>{let d=m.x-u,y=m.y-c,h=Math.max(1,Math.hypot(d,y));return{x:m.x+d/h*80,y:m.y+y/h*80}}):rn(o.minX-28,o.minY-28,o.maxX-o.minX+56,o.maxY-o.minY+56);return V(t,f,void 0,()=>-.04,-.22,a.ground,a.ground,Y),!1}else{let s=n.reduce((x,g)=>g.baseHeightM<x.baseHeightM?g:x);t.setFloor(s.index);let l={...s,objects:n.flatMap(x=>x.objects)},u=e.map(x=>({x:x.x,y:x.y}));for(let x of l.objects)x.type==="section"&&u.push(...x.outline);if(Br(t,l,e,a)||Or(t,l,e,u,a))return!1;if(i&&Er(t,s.baseHeightM,u,a,i))return!0;let c=e.filter((x,g)=>r[g]===s.index),f=be([s],c),m=Math.hypot(f.maxX-f.minX,f.maxY-f.minY),d=Math.max(28,Math.min(80,m*.04)),y=rn(f.minX-d,f.minY-d,f.maxX-f.minX+d*2,f.maxY-f.minY+d*2),h=s.baseHeightM-.03;return V(t,y,void 0,()=>h,h-.22,a.ground,a.ground,Y),!1}}function ge(t,n,e,r){let{cx:o,cz:a,radius:i}=e,s=1/0,l=1/0,u=1/0,c=-1/0,f=-1/0,m=-1/0,d=(x,g,b)=>{s=Math.min(s,x),c=Math.max(c,x),l=Math.min(l,g),f=Math.max(f,g),u=Math.min(u,b),m=Math.max(m,b)};for(let x=0;x<t.position.length;x+=3){let g=x/3;r&&g>=r[0]&&g<r[1]||d(t.position[x],t.position[x+1],t.position[x+2])}for(let x=0;x<n.count;x++){let g=x*3,b=n.iPosition[g],I=n.iPosition[g+1],w=n.iPosition[g+2],P=Math.max(.35,n.iMaxRadius[x]??.35);d(b-P,I,w-P),d(b+P,I+1.6,w+P)}Number.isFinite(s)||(s=o-i,c=o+i,l=0,f=i*.16,u=a-i,m=a+i);let y=[(s+c)/2,(l+f)/2,(u+m)/2],h=Math.max(1,.5*Math.hypot(c-s,f-l,m-u));return{center:y,radius:h,minY:l,maxY:f}}var bc=4096;function kr(t,n,e=[]){let r=Math.max(1,Math.ceil(t.count/bc)),o=Math.ceil(t.count/r),a=new Float32Array((o*2+n.length*4+e.length)*3),i=0;for(let s=0;s<t.count;s+=r){let l=t.iPosition[s*3],u=t.iPosition[s*3+1],c=t.iPosition[s*3+2];a[i++]=l,a[i++]=u,a[i++]=c,a[i++]=l,a[i++]=0,a[i++]=c}for(let[s,l,u]of e)a[i++]=s,a[i++]=l,a[i++]=u;for(let s of n)for(let[l,u]of[[-1,-1],[1,-1],[1,1],[-1,1]])a[i++]=s.cx+l*s.halfX,a[i++]=s.y,a[i++]=s.cz+u*s.halfZ;return a.subarray(0,i)}function Fr(t,n,e,r,o,a,i=[]){let s=1/0,l=1/0,u=-1/0,c=-1/0;for(let P=0;P<t.count;P++){let p=P*3,_=t.iPosition[p],M=t.iPosition[p+2];_<s&&(s=_),_>u&&(u=_),M<l&&(l=M),M>c&&(c=M)}for(let[P,,p]of i)P<s&&(s=P),P>u&&(u=P),p<l&&(l=p),p>c&&(c=p);for(let P of n)s=Math.min(s,P.cx-P.halfX),u=Math.max(u,P.cx+P.halfX),l=Math.min(l,P.cz-P.halfZ),c=Math.max(c,P.cz+P.halfZ);let f=e.minX*S,m=e.maxX*S,d=e.minY*S,y=e.maxY*S,h=f,x=m,g=d,b=y;if(Number.isFinite(s)){let P=Math.max(2,.06*Math.hypot(u-s,c-l));h=Math.max(f,s-P),x=Math.min(m,u+P),g=Math.max(d,l-P),b=Math.min(y,c+P)}let I=Math.min(0,r),w=Math.max(o,a*.05);return{min:[h,I,g],max:[x,w,b]}}var wr=12,gc=.6,Mc=40;function Er(t,n,e,r,o){let a=cn([...e]);if(a.length<3)return!1;let i=1/0,s=1/0,l=-1/0,u=-1/0;for(let w of a)i=Math.min(i,w.x),l=Math.max(l,w.x),s=Math.min(s,w.y),u=Math.max(u,w.y);let c=Math.hypot(l-i,u-s)*S,f=It(a,wr/S,1.2),m=Math.max(Mc,c*gc),d=It(a,(wr+m)/S,1.2);if(f.length!==d.length)return!1;let y=et(r.ground,[.78,.76,.72],.35),h=et(r.ground,[.56,.62,.52],.3);V(t,f,void 0,()=>n-.04,n-.22,y,y,Y);let x=n-.05,g=f.map(w=>[w.x*S,x,w.y*S]),b=d.map(w=>[w.x*S,x,w.y*S]),I=[0,1,0];for(let w=0;w<g.length;w++){let P=(w+1)%g.length;t.tri(g[w],b[P],b[w],I,h,o,o),t.tri(g[w],g[P],b[P],I,h,h,o)}return!0}function Br(t,n,e,r){let o=Vt(n,e);if(!o)return!1;let a=n.baseHeightM,i=et(r.ground,[.62,.55,.47],.4);return V(t,o,void 0,()=>a-.04,a-.22,i,i,Y),!0}var Pc=3e3,Sc=20,Tr=1.5,Ic=1.2,Rc=.25;function Or(t,n,e,r,o){if(!e.length||e.length>Pc||r.length<3)return!1;for(let R of n.objects){if(R.type==="shape"&&gn(R.stageKind))return!1;if(R.type==="section"){let{height:E}=Wt(R,{floorBaseHeightM:n.baseHeightM});if(E-n.baseHeightM>Sc)return!1}}let a=0,i=0;for(let R of r)a+=R.x,i+=R.y;a/=r.length,i/=r.length;let s=0,l=0,u=0;for(let R of r){let E=R.x-a,C=R.y-i;s+=E*E,l+=C*C,u+=E*C}let c=.5*Math.atan2(2*u,s-l),f=Math.cos(c),m=Math.sin(c),d=-m,y=f,h=1/0,x=-1/0,g=1/0,b=-1/0;for(let R of r){let E=(R.x-a)*f+(R.y-i)*m,C=(R.x-a)*d+(R.y-i)*y;h=Math.min(h,E),x=Math.max(x,E),g=Math.min(g,C),b=Math.max(b,C)}let I=R=>[[h-R,g-R],[x+R,g-R],[x+R,b+R],[h-R,b+R]].map(([E,C])=>({x:a+f*E+d*C,y:i+m*E+y*C})),w=I(Tr/S),P=I((Tr+Rc)/S),p=n.baseHeightM,_=et(o.ground,[.62,.55,.47],.4),M=et(o.ground,[.86,.86,.84],.55);return V(t,P,void 0,()=>p-.04,p-.22,_,_,Y),V(t,P,[w.slice().reverse()],()=>p+Ic,p-.04,et(M,[1,1,1],.2),M,Y),!0}function Lr(t,n,e){let r=()=>({byObjectId:new Map,elements:[]});if(!n||!t)return r();let o=Me(n);if(!o.ok||o.value.id!==t)return r();let a=new Map;for(let f of e)for(let m of f.objects)m.type==="shape"&&a.set(m.id,{shape:m,unit:f});let i=new Set,s=new Set,l=new Map((n.overlay.productionElements??[]).map(f=>{let m=f.runtimeContentImageUrl;return[f.id,typeof m=="string"&&/^(?:blob:|data:image\/|https:\/\/)/.test(m)?m:void 0]})),u=[];for(let f of o.value.overlay.productionElements??[]){let m=a.get(f.objectId),d=m?it(m.shape):null,y=f.baseElevationM??0;if(!m||!d||d.length<3||!f.id||i.has(f.id)||s.has(f.objectId)||!Number.isFinite(f.heightM)||f.heightM<.05||f.heightM>50||!Number.isFinite(y)||y<-10||y>100)return r();i.add(f.id),s.add(f.objectId);let h=d.map(M=>M.x*S),x=d.map(M=>M.y*S),g=m.unit.baseHeightM+y,b=Math.min(...h),I=Math.max(...h),w=Math.min(...x),P=Math.max(...x),p,_=l.get(f.id)??f.contentImageUrl;if(f.kind==="screen"&&_&&(p=wo(d,g,g+f.heightM,m.unit.focal),!p))if(I-b>=P-w){let M=Math.abs(w-m.unit.focal.y*S)<=Math.abs(P-m.unit.focal.y*S)?w-.006:P+.006;p=[[b,g,M],[I,g,M],[b,g+f.heightM,M],[I,g+f.heightM,M]]}else{let M=Math.abs(b-m.unit.focal.x*S)<=Math.abs(I-m.unit.focal.x*S)?b-.006:I+.006;p=[[M,g,w],[M,g,P],[M,g+f.heightM,w],[M,g+f.heightM,P]]}u.push({id:f.id,objectId:f.objectId,kind:f.kind,floorIndex:m.unit.index,baseY:g,topY:g+f.heightM,bounds:{min:[b,g,w],max:[I,g+f.heightM,P]},occlusion:f.occlusion,..._?{contentImageUrl:_}:{},...p?{contentPlane:p}:{}})}let c=u.sort((f,m)=>f.id.localeCompare(m.id));return{byObjectId:new Map(c.map(f=>[f.objectId,f])),elements:c}}var vr=[.13,.14,.17],Jt=[.4,.43,.47],_c=.18,Ac=.02,wc=2.4,Ec=1500,Bc=240,Tc=.25;function Dr(t,n,e,r){let o=n.stageKind??"";if(Yt(o)||o==="round"||!r.length)return;let a=it(n);if(!a||a.length<3)return;let i={x:a.reduce((T,F)=>T+F.x,0)/a.length,y:a.reduce((T,F)=>T+F.y,0)/a.length},s=0,l=0,u=new Set;for(let T of r)s+=T.x,l+=T.y,u.add(Math.floor(Math.atan2(T.y-i.y,T.x-i.x)*180/Math.PI/10));let c=i.x-s/r.length,f=i.y-l/r.length,m=Math.hypot(c,f);if(m<1e-6)return;let d=r.reduce((T,F)=>T+Math.hypot(F.x-i.x,F.y-i.y),0)/r.length;if(u.size*10>Bc&&m<Tc*d)return;let y=c/m,h=f/m,x=-h,g=y,b=-1/0,I=1/0,w=1/0,P=-1/0;for(let T of a){let F=(T.x-i.x)*y+(T.y-i.y)*h,O=(T.x-i.x)*x+(T.y-i.y)*g;b=Math.max(b,F),I=Math.min(I,F),w=Math.min(w,O),P=Math.max(P,O)}let p=(P-w)*S,_=(b-I)*S;if(p<3||_<1.5||p*_>Ec)return;let M=_c/S,R=(T,F)=>({x:i.x+y*T+x*F,y:i.y+h*T+g*F}),E=(T,F,O,L)=>[R(T,O),R(T,L),R(F,L),R(F,O)],C=e+Math.max(3.5,Math.min(8,p*.35)),v=e+Math.min(wc,C-e-1),k=.2/S,A=I+Math.min(_*.25,1.5)/S,B=Ac/S;V(t,E(b-2*M+B,b-M-B,w+M+k,P-M-k),void 0,()=>v,e,vr,vr,Y);for(let[T,F]of[[w+M,w+M+k],[P-M-k,P-M]])V(t,E(b-2*M,b-M,T,F),void 0,()=>C+.3,e,Jt,Jt,Y),V(t,E(A+k,b-2*M,T,F),void 0,()=>C+.3,C,Jt,Jt,Y);V(t,E(A,A+k,w+M,P-M),void 0,()=>C+.3,C,Jt,Jt,Y)}function gt(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}function bt(t){return Array.isArray(t)?t:[]}function Oc(t){let n=[t];for(;n.length;){let e=n.pop();if(Array.isArray(e)){n.push(...e);continue}if(!gt(e))continue;let r=gt(e.extensions)?e.extensions:null;if(r&&Object.prototype.hasOwnProperty.call(r,"KHR_draco_mesh_compression"))return!0;n.push(...Object.values(e))}return!1}function Gn(t,n){return!Array.isArray(t)||t.length!==n||!t.every(e=>typeof e=="number"&&Number.isFinite(e))?null:t}function Cc(){return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}function kc(t,n){let e=new Array(16).fill(0);for(let r=0;r<4;r++)for(let o=0;o<4;o++)for(let a=0;a<4;a++)e[r*4+o]+=t[a*4+o]*n[r*4+a];return e}function Fc(t){let n=Gn(t.matrix,16);if(n)return n;if(t.matrix!==void 0)return null;let e=t.translation===void 0?[0,0,0]:Gn(t.translation,3),r=t.rotation===void 0?[0,0,0,1]:Gn(t.rotation,4),o=t.scale===void 0?[1,1,1]:Gn(t.scale,3);if(!e||!r||!o)return null;let[a,i,s,l]=r,u=Math.hypot(a,i,s,l);if(!(u>1e-8))return null;let c=a/u,f=i/u,m=s/u,d=l/u,y=c+c,h=f+f,x=m+m,g=c*y,b=c*h,I=c*x,w=f*h,P=f*x,p=m*x,_=d*y,M=d*h,R=d*x;return[(1-(w+p))*o[0],(b+R)*o[0],(I-M)*o[0],0,(b-R)*o[1],(1-(g+p))*o[1],(P+_)*o[1],0,(I+M)*o[2],(P-_)*o[2],(1-(g+w))*o[2],0,e[0],e[1],e[2],1]}function Lc(t,n,e,r){return[t[0]*n+t[4]*e+t[8]*r+t[12],t[1]*n+t[5]*e+t[9]*r+t[13],t[2]*n+t[6]*e+t[10]*r+t[14]]}function vc(t){let n=t[0],e=t[4],r=t[8],o=t[1],a=t[5],i=t[9],s=t[2],l=t[6],u=t[10],c=a*u-i*l,f=i*s-o*u,m=o*l-a*s,d=n*c+e*f+r*m;if(Math.abs(d)<1e-12)return null;let y=1/d;return[c*y,f*y,m*y,(r*l-e*u)*y,(n*u-r*s)*y,(e*s-n*l)*y,(e*i-r*a)*y,(r*o-n*i)*y,(n*a-e*o)*y]}function Nr(t,n,e,r){let o=t[0]*n+t[1]*e+t[2]*r,a=t[3]*n+t[4]*e+t[5]*r,i=t[6]*n+t[7]*e+t[8]*r,s=Math.hypot(o,a,i)||1;return o/=s,a/=s,i/=s,[o,a,i]}function Dc(t){if(t.byteLength<20||t.byteLength>8388608)return null;let n=new DataView(t.buffer,t.byteOffset,t.byteLength);if(n.getUint32(0,!0)!==1179937895||n.getUint32(4,!0)!==2||n.getUint32(8,!0)!==t.byteLength)return null;let e=12,r=null,o=null;for(;e+8<=t.byteLength;){let a=n.getUint32(e,!0),i=n.getUint32(e+4,!0);if(e+=8,a%4!==0||e+a>t.byteLength)return null;let s=t.subarray(e,e+a);if(i===1313821514&&!r)try{let l=JSON.parse(new TextDecoder().decode(s).replace(/[\u0000 ]+$/g,""));if(!gt(l))return null;r=l}catch{return null}else if(i===5130562&&!o)o=s;else return null;e+=a}return e===t.byteLength&&r&&o?{json:r,bin:o}:null}function Nc(t){return t===5120||t===5121?1:t===5122||t===5123?2:t===5125||t===5126?4:0}function Gc(t){return t==="SCALAR"?1:t==="VEC2"?2:t==="VEC3"?3:t==="VEC4"?4:0}function Hc(t,n,e){return e===5120?t.getInt8(n):e===5121?t.getUint8(n):e===5122?t.getInt16(n,!0):e===5123?t.getUint16(n,!0):e===5125?t.getUint32(n,!0):t.getFloat32(n,!0)}function Xc(t){let n=t instanceof Uint8Array?t:new Uint8Array(t),e=Dc(n);if(!e)return{ok:!1,issue:"invalid_glb"};let{json:r,bin:o}=e;if(!gt(r.asset)||r.asset.version!=="2.0")return{ok:!1,issue:"unsupported_glb"};let a=bt(r.extensionsUsed).filter(w=>typeof w=="string");if(a.includes("KHR_draco_mesh_compression")||Oc(r))return{ok:!1,issue:"draco_not_allowed"};if(a.length||bt(r.extensionsRequired).length)return{ok:!1,issue:"unsupported_glb"};if(bt(r.images).length||bt(r.textures).length)return{ok:!1,issue:"external_resource"};let i=bt(r.buffers);if(i.length!==1||!gt(i[0])||i[0].uri!==void 0||typeof i[0].byteLength!="number"||!Number.isInteger(i[0].byteLength)||i[0].byteLength<0||i[0].byteLength>o.byteLength)return{ok:!1,issue:"external_resource"};let s=bt(r.accessors),l=bt(r.bufferViews),u=bt(r.meshes),c=bt(r.nodes),f=bt(r.scenes),m=typeof r.scene=="number"?r.scene:0;if(!gt(f[m]))return{ok:!1,issue:"unsupported_glb"};let d=new DataView(o.buffer,o.byteOffset,o.byteLength),y=(w,P,p)=>{if(typeof w!="number"||!Number.isInteger(w)||!gt(s[w]))return null;let _=s[w];if(_.type!==P||_.sparse!==void 0||_.normalized===!0||typeof _.count!="number"||!Number.isInteger(_.count)||_.count<1||typeof _.componentType!="number"||!p.includes(_.componentType)||typeof _.bufferView!="number")return null;let M=l[_.bufferView];if(!gt(M)||M.buffer!==0||typeof M.byteLength!="number"||!Number.isInteger(M.byteLength)||M.byteLength<0)return null;let R=Gc(_.type),E=Nc(_.componentType),C=typeof M.byteStride=="number"?M.byteStride:R*E,v=typeof M.byteOffset=="number"?M.byteOffset:0,k=typeof _.byteOffset=="number"?_.byteOffset:0,A=v+k,B=k+(_.count-1)*C+R*E;if(!Number.isInteger(C)||!Number.isInteger(v)||!Number.isInteger(k)||C<R*E||v<0||k<0||v+M.byteLength>o.byteLength||B>M.byteLength)return null;let T=[];for(let F=0;F<_.count;F++){let O=[];for(let L=0;L<R;L++){let D=Hc(d,A+F*C+L*E,_.componentType);if(!Number.isFinite(D))return null;O.push(D)}T.push(O)}return T},h=[],x=[],g=0,b=new Set,I=(w,P)=>{if(typeof w!="number"||!Number.isInteger(w)||!gt(c[w])||b.has(w))return!1;b.add(w);let p=c[w],_=Fc(p);if(!_)return!1;let M=kc(P,_),R=vc(M);if(!R)return!1;if(p.mesh!==void 0){if(typeof p.mesh!="number")return!1;let E=u[p.mesh];if(!gt(E))return!1;for(let C of bt(E.primitives)){if(!gt(C)||C.mode!==void 0&&C.mode!==4||!gt(C.attributes))return!1;let v=y(C.attributes.POSITION,"VEC3",[5126]),k=C.attributes.NORMAL===void 0?null:y(C.attributes.NORMAL,"VEC3",[5126]);if(!v||C.attributes.NORMAL!==void 0&&!k)return!1;let A=v.length;if(C.indices!==void 0){let T=typeof C.indices=="number"?s[C.indices]:null;A=gt(T)?T.count:void 0}if(typeof A!="number"||!Number.isInteger(A)||A%3!==0||(g+=A/3,g>1e5))return!1;let B=C.indices===void 0?v.map((T,F)=>[F]):y(C.indices,"SCALAR",[5121,5123,5125]);if(!B||B.length%3!==0||B.length!==A)return!1;for(let T=0;T<B.length;T+=3){let F=[B[T][0],B[T+1][0],B[T+2][0]];if(F.some(D=>!Number.isInteger(D)||D<0||D>=v.length))return!1;let O=F.map(D=>Lc(M,...v[D])),L=null;if(!k){let D=O[1][0]-O[0][0],G=O[1][1]-O[0][1],j=O[1][2]-O[0][2],U=O[2][0]-O[0][0],X=O[2][1]-O[0][1],W=O[2][2]-O[0][2];L=Nr([1,0,0,0,1,0,0,0,1],G*W-j*X,j*U-D*W,D*X-G*U)}for(let D=0;D<3;D++)h.push(...O[D]),x.push(...k?Nr(R,...k[F[D]]):L)}}}for(let E of bt(p.children))if(!I(E,M))return!1;return b.delete(w),!0};for(let w of bt(f[m].nodes))if(!I(w,Cc()))return{ok:!1,issue:g>1e5?"triangle_limit":"unsupported_glb"};return!g||h.length!==g*9||x.length!==h.length?{ok:!1,issue:"unsupported_glb"}:{ok:!0,triangleCount:g,position:new Float32Array(h),normal:new Float32Array(x)}}function Gr(t){try{return Xc(t)}catch{return{ok:!1,issue:"invalid_glb"}}}function Sh(t){let{doc:n}=t,e=lr(n.theme),r=e.structure,o=co(n,t.eventConfigurationId??n.eventConfigurationId),a=Lr(t.eventConfigurationId,t.eventConfiguration,o),i=t.seats,s=new In,l=null;if(t.registeredShellGlb){let N=Gr(t.registeredShellGlb);if(N.ok){let H=N.position.length/3,K=new Float32Array(N.position.length),at=e.materials.shell??r.tierWall;for(let ft=0;ft<H;ft++){let ht=N.normal[ft*3+1],rt=ht<-.25?.4:.62+.38*Math.max(0,ht);K[ft*3]=at[0]*rt,K[ft*3+1]=at[1]*rt,K[ft*3+2]=at[2]*rt}l={position:N.position,normal:N.normal,color:K,floor:new Float32Array(H).fill(-2),material:new Float32Array(H),count:H}}}let u=new Map;for(let N of o)for(let H of N.objects)u.set(H.id,N.index),H.type==="section"&&u.set(H.logicalSectionId??H.id,N.index);let c=i.map(N=>u.get(N.sectionId??"")??u.get(N.rowId??"")??0),f=be(o,i),m=s.vertexCount,y=Cr(s,o,i,c,f,r,et(e.background.top,e.background.bottom,.5))?s.vertexCount:m,h=Ke(n,i),x=new Map,g=new Map;for(let N of n.categories??[])x.set(N.key,N.color),N.seatGlyph&&g.set(N.key,N.seatGlyph);let b=[],I=ko(o,i,c),w=new Map;i.forEach((N,H)=>{let K=I.seatDeckY(H);Number.isFinite(K)&&w.set(N.rowId,Math.min(w.get(N.rowId)??1/0,K))});let P=new Float32Array(i.length),p=[],_=new Map((n.floors??[]).map((N,H)=>[N.id,H])),M=o.map(()=>[]);for(let N of i){let H=N.floorId?_.get(N.floorId)??0:0;M[Math.min(H,M.length-1)]?.push(N)}let R=(N,H)=>{if(!H||H.length<3)return!1;let K=Math.min(...H.map(rt=>rt.x)),at=Math.max(...H.map(rt=>rt.x)),ft=Math.min(...H.map(rt=>rt.y)),ht=Math.max(...H.map(rt=>rt.y));for(let rt=0;rt<N;rt++)for(let ct of M[rt])if(!(ct.x<K||ct.x>at||ct.y<ft||ct.y>ht)&&wt(ct,H,void 0))return!0;return!1},E=null,C=N=>o.length===1?i:i.filter((H,K)=>c[K]===N),v=(N,H)=>{let K=_t(N);if(!K)return!1;let at=1/0,ft=1/0,ht=-1/0,rt=-1/0;for(let ct of K)at=Math.min(at,ct.x),ht=Math.max(ht,ct.x),ft=Math.min(ft,ct.y),rt=Math.max(rt,ct.y);return i.some((ct,At)=>ct.kind!=="booth"&&(o.length===1||c[At]===H)&&ct.x>at&&ct.x<ht&&ct.y>ft&&ct.y<rt&&pt(K,ct.x,ct.y))},k;for(let N=0;N<o.length;N++){let H=o[N];s.setFloor(N);let K=Vt(H,C(N)),at=0;if(K){let z=0;for(let ut of H.objects)if(ut.type==="section")for(let mt of I.bySection.get(ut.id)?.rowLevels??[])z=Math.max(z,mt.y-H.baseHeightM);if(at=yo(z),!k){let ut=po(K);k={centre:[ut.x*S,ut.y*S]}}}let ft=new wn,ht=[],rt=H.objects.filter(z=>z.type==="shape"&&(z.role==="entrance"||z.role==="exit")),ct=H.objects.filter(z=>z.type==="section"&&!!z.outline&&z.outline.length>=3),At=mr(H.objects.filter(z=>z.type==="booth"),H.focal);for(let z of H.objects)if(z.type==="section"){let ut=s.vertexCount;Ir(s,z,H,Ve(z,h),I.bySection.get(z.id),ft,ct,r,N>0&&R(N,z.outline));let mt=s.vertexCount-ut;mt>0&&p.push({sectionId:z.id,start:ut,count:mt})}else if(z.type==="shape"){let ut=a.byObjectId.get(z.id),mt=b.length,Nt=K!==null&&z.role==="wall"&&!ut;s.setMaterial(Nt?ho:(ut?.kind??z.role)==="screen"?1:0);let Gt=z.role==="stage"&&!ut?hr(z,C(N)):Nt&&z.heightM===void 0?{...z,heightM:at}:z,kt=fo(Gt,ht);if(qo(s,Gt,H.baseHeightM+kt.supportOffsetM,kt.topOffsetM-kt.supportOffsetM,r,H.focal,b,ut,rt),s.setMaterial(0),z.role==="stage"&&!ut&&b.length>mt&&(E??N)===N){E=N;let Ft=n.floors?.[N]?.id,tn=o.length>1&&Ft?i.filter(dn=>dn.floorId===Ft):i;Dr(s,Gt,b[b.length-1].y,tn)}}else z.type==="gaArea"?Qo(s,z,H.baseHeightM,ot(x.get(z.categoryKey)),r):z.type==="booth"?Ko(s,z,H.baseHeightM,ot(x.get(z.categoryKey)),r,At.get(z.id)??H.focal,v(z,N)):z.type==="table"?Zo(s,z,Math.max(H.baseHeightM,w.get(z.id)??H.baseHeightM),ot(z.fill??n.theme?.decorFill??"#232c40"),r,!!(z.fill??n.theme?.decorFill)):z.type==="decorImage"&&$o(s,z,H.baseHeightM,r);_r(s,H,i,I,r,e.materials.shell,!l)}let A=o.length>1?{x:o.reduce((N,H)=>N+H.focal.x,0)/o.length,y:o.reduce((N,H)=>N+H.focal.y,0)/o.length}:n.focalPoint??{x:(f.minX+f.maxX)/2,y:(f.minY+f.maxY)/2},B=Ge(l?[s.build(),l]:[s.build()]),T=We(i,t.initialState,I,P,x,g),F=rr({doc:n,units:o,seats:i,surfaces:I,focal:A}),{labels:O,sections:L,rows:D}=ir({doc:n,units:o,seats:i,surfaces:I,seatData:T,hintedSeatFloor:c,zones:F,focal:A}),G=new Map(L.map((N,H)=>[N.id,H]));I.seatOwner.forEach((N,H)=>{T.iSection[H]=N?G.get(N)??-1:-1});let j=Ar({doc:n,units:o,seats:i,surfaces:I,solids:B,hintedSeatFloor:c,seatFloor:P});sr(O,j),T.iYaw=Ue(T.iPosition,i.length,N=>i[N].rowId,N=>{let H=o[P[N]]?.focal??A;return[H.x*S,H.y*S]});let U=(f.minX+f.maxX)/2*S,X=(f.minY+f.maxY)/2*S,W=.5*Math.hypot((f.maxX-f.minX)*S,(f.maxY-f.minY)*S)||10,$=ge(B,T,{cx:U,cz:X,radius:W},[m,y]),tt=ge(B,T,{cx:U,cz:X,radius:W}),Q=jc(o),st=Fr(T,b,f,$.minY,$.maxY,W,Q);return{sharedAisles:ar(o.flatMap(N=>N.objects.flatMap(H=>{if(H.type!=="section")return[];let K=I.bySection.get(H.id);return K?[{sectionId:H.id,floorIndex:N.index,rows:K.rowLevels}]:[]}))),solids:B,sectionSolidRanges:p,seats:T,seatSectionIds:I.seatOwner,bounds:{center:[(st.min[0]+st.max[0])/2,(st.min[1]+st.max[1])/2,(st.min[2]+st.max[2])/2],radius:W,groundY:0,box:st,fitPoints:kr(T,b,Q)},...k?{room:k}:{},...!k&&o.some(N=>N.objects.some(H=>H.type==="shape"&&gn(H.stageKind)))?{outdoor:!0}:{},renderBounds:{center:$.center,radius:$.radius},clipBounds:{center:tt.center,radius:tt.radius},stateColorLUT:ur(e,sn),theme:e,seatCount:i.length,focalWorld:[A.x*S,1.5,A.y*S],zones:F,stages:b,productionElements:a.elements,sections:L,rows:D,labels:O,floors:j}}function jc(t){let n=[];for(let e of t)for(let r of e.objects){let o=r.type==="gaArea"?r.points:r.type==="booth"?_t(r):null;for(let a of o??[])n.push([a.x*S,e.baseHeightM,a.y*S])}return n}function Uc(t,n){let{doc:e,report:r}=Ao(t),o=r.confident&&(r.sections.length>0||!!r.looseRowBlocks);if(!o&&!r.roles?.length)return null;if(!o){let l=new Map(r.roles.map(d=>[d.id,d.role])),u=d=>d.map(y=>y.type==="shape"&&l.has(y.id)?{...y,role:l.get(y.id)}:y),c=t.floors?.map(d=>({...d,objects:u(d.objects)})),f=new Float64Array(n.length).fill(Number.NaN),m=new Float64Array(n.length*2).fill(Number.NaN);return n.forEach((d,y)=>{d.eyeHeightM!==void 0&&(f[y]=d.eyeHeightM),d.focalPoint&&(m[y*2]=d.focalPoint.x,m[y*2+1]=d.focalPoint.y)}),{doc:{...t,objects:c?.[0]?.objects??u(t.objects),...c?{floors:c}:{}},report:r,eyeHeightM:f,focal:m}}let a=new Map(Mn(e).map(l=>[l.id,l])),i=new Float64Array(n.length).fill(Number.NaN),s=new Float64Array(n.length*2).fill(Number.NaN);return n.forEach((l,u)=>{let c=a.get(l.id)??l;c.eyeHeightM!==void 0&&(i[u]=c.eyeHeightM),c.focalPoint&&(s[u*2]=c.focalPoint.x,s[u*2+1]=c.focalPoint.y)}),{doc:e,report:r,eyeHeightM:i,focal:s}}function Wc(t,n){return t.map((e,r)=>{let o=n.eyeHeightM[r],a=n.focal[r*2],i=n.focal[r*2+1],s={...e};return Number.isNaN(o)?delete s.eyeHeightM:s.eyeHeightM=o,Number.isNaN(a)?delete s.focalPoint:s.focalPoint={x:a,y:i},s})}function Ah(t){let n=t.estimate===!1?null:Uc(t.doc,t.seats);return n?{input:{...t,doc:n.doc,seats:Wc(t.seats,n)},estimate:n}:{input:t}}export{tl as a,Jr as b,ti as c,Xe as d,ni as e,nl as f,sn as g,Xn as h,Qc as i,Un as j,S as k,_n as l,ul as m,fl as n,Ao as o,$l as p,Ql as q,Jl as r,tu as s,nu as t,eu as u,ne as v,ou as w,ru as x,iu as y,su as z,au as A,Oa as B,Sh as C,Uc as D,Wc as E,Ah as F};
@@ -1 +0,0 @@
1
- import{Ia as B,Sa as M,Va as K}from"./chunk-UISTXRO5.js";function S(t){let n=Number(t.slice(t.lastIndexOf(":")+1));return Number.isFinite(n)?n:-1}function te(t,n,i){let e=new Map;for(let a of t){if(a.kind==="booth")continue;let r=e.get(a.rowId);r?r.push(a):e.set(a.rowId,[a])}let u=a=>i.has(a.id)||n(a.id)!=="free",s=[];for(let a of e.values())if(!(a.length<3)){a.sort((r,l)=>S(r.id)-S(l.id));for(let r=1;r<a.length-1;r++){let l=a[r];if(u(l))continue;let g=a[r-1],m=a[r+1];S(l.id)-S(g.id)!==1||S(m.id)-S(l.id)!==1||!u(g)||!u(m)||!i.has(g.id)&&!i.has(m.id)||s.push(l)}}return s}function $(t){return Array.isArray(t.objects)}function j(t,n){if(n.seatsByLabel)return n.seatsByLabel;if(!$(t))throw new Error("ticketRestrictions: a categories-only chart document requires options.seatsByLabel");return new Map(K(t,{resolveEyeHeights:!1}).map(i=>[i.label,i]))}function H(t){return{code:"ticket_option_not_applicable",labels:t,message:"That ticket choice is not available for the selected seat."}}function R(t,n){let i=t.applicability;return i?!(i.seatLabels?.length&&!i.seatLabels.includes(n.label)||i.accessibility?.length&&!i.accessibility.some(e=>n.accessibility?.includes(e))):!0}function oe(t,n){return(t.categories.find(i=>i.key===n.categoryKey)?.tiers??[]).filter(i=>R(i,n))}function F(t,n,i){let e=t.categories.find(s=>s.key===n.categoryKey)?.tiers;if(!e?.length)return{kind:"none"};let u=i==null?e.find(s=>R(s,n)):e.find(s=>s.id===i&&R(s,n));return u?{kind:"resolved",tier:u}:{kind:"invalid"}}function Y(t,n){return(t.logicalRowId??t.rowId)===(n.logicalRowId??n.rowId)}function L(t){if(Number.isInteger(t.logicalSeatIndex))return t.logicalSeatIndex;let n=t.id.slice(t.id.lastIndexOf(":")+1),i=Number(n);return Number.isInteger(i)?i:void 0}function J(t,n){if(!Y(t,n))return!1;let i=L(t),e=L(n);return i!=null&&e!=null&&Math.abs(i-e)===1}function Q(t,n,i={}){if(!n.length)return null;let e=j(t,i),u=n.flatMap(r=>{let l=e.get(r.label);return l?[{selection:r,seat:l}]:[]}),s=u.map(({seat:r})=>r).filter(r=>r.accessibility?.includes("wheelchair")),a=[];for(let{selection:r,seat:l}of u){let g=F(t,l,r.tierId),m=g.kind==="resolved"?g.tier:void 0;(l.accessibility?.includes("companion")||m?.restriction==="companion")&&!s.some(h=>h.id!==l.id&&J(l,h))&&a.push(l.label)}return a.length?{code:"companion_pair_required",labels:a,message:"Select the adjacent wheelchair place with each companion ticket."}:null}function re(t,n,i={}){if(!n.length)return null;let e=j(t,i),u=new Set(t.categories.filter(r=>r.notForSale).map(r=>r.key)),s=[],a=[];for(let r of n){let l=e.get(r.label);if(!l)continue;if(u.has(l.categoryKey)){s.push(l.label);continue}F(t,l,r.tierId).kind==="invalid"&&a.push(l.label)}return s.length?{code:"not_for_sale",labels:s,message:"These seats are not for sale."}:a.length?H(a):Q(t,n,{seatsByLabel:e})}function D(t,n){if(Number.isInteger(t.logicalSeatIndex))return t.logicalSeatIndex;let i=t.id.lastIndexOf(":");if(i<0)return n;let e=Number(t.id.slice(i+1));return Number.isFinite(e)?e:n}function T(t,n){let i=t.x-n.x,e=t.y-n.y;return i*i+e*e}function E(t){let n=0,i=0;for(let e of t)n+=e.x,i+=e.y;return{x:n/t.length,y:i/t.length}}function q(t,n){return t.find(i=>i.focalPoint)?.focalPoint??n}function P(t){return t.commercial?.premium===!0}function X(t,n,i){let e=Math.floor(i.qty);if(!Number.isFinite(e)||e<=0)return{labels:[],reason:"sold_out"};let{categoryKey:u,zoneId:s,focal:a,preferPremium:r,preferNearest:l,preferredRowIds:g,accessibility:m,requireContiguous:d}=i,h=new Map,w=[];if(t.forEach((o,c)=>{let p=n.has(o.label)&&(!u||o.categoryKey===u)&&(!s||o.zoneId===s)&&(!m||m.some(I=>o.accessibility?.includes(I))),y=o.logicalRowId??o.rowId,b=h.get(y);b||(b=[],h.set(y,b)),b.push({seat:o,index:D(o,c),elig:p}),p&&w.push(o)}),w.length===0)return{labels:[],reason:"sold_out"};let O=new Map([...h].map(([o,c])=>[o,E(c.map(p=>p.seat))])),A=(g??[]).map(o=>O.get(o)).filter(o=>!!o),_=o=>{let c=O.get(o);return!c||!A.length?0:Math.min(...A.map(p=>T(c,p)))},f=null,z=o=>{if(!f)return!0;if(r&&o.nonPremium!==f.nonPremium)return o.nonPremium<f.nonPremium;if(l&&o.rowD2!==f.rowD2)return o.rowD2<f.rowD2;if(l&&o.d2!==f.d2)return o.d2<f.d2;if(o.orphan!==f.orphan)return o.orphan<f.orphan;if(o.d2!==f.d2)return o.d2<f.d2;let c=o.rowId.localeCompare(f.rowId);return c!==0?c<0:o.startIndex<f.startIndex};for(let[o,c]of h){let p=[...c].sort((b,I)=>b.index-I.index),y=0;for(;y<p.length;){if(!p[y].elig){y++;continue}let b=y;for(;b<p.length&&p[b].elig&&(b===y||p[b].index===p[b-1].index+1);)b++;let I=b-y;for(let x=0;x+e<=I;x++){let G=x,U=I-(x+e),V=G===1||U===1?1:0,k=p.slice(y+x,y+x+e).map(C=>C.seat),N={labels:k.map(C=>C.label),seats:k,rowId:o,startIndex:p[y+x].index,orphan:V,nonPremium:r?k.reduce((C,W)=>C+(P(W)?0:1),0):0,rowD2:_(o),d2:T(E(k),l?a:q(k,a))};z(N)&&(f=N)}y=b}}return f?{labels:f.labels}:d?{labels:[],reason:w.length?"not_enough_together":"sold_out"}:w.length<e?{labels:[],reason:"not_enough_together"}:{labels:w.map((o,c)=>({seat:o,i:c,rowD2:_(o.logicalRowId??o.rowId),d2:T(o,l?a:o.focalPoint??a)})).sort((o,c)=>{if(r){let y=P(o.seat)?0:1,b=P(c.seat)?0:1;if(y!==b)return y-b}if(l&&o.rowD2!==c.rowD2)return o.rowD2-c.rowD2;if(o.d2!==c.d2)return o.d2-c.d2;let p=(o.seat.logicalRowId??o.seat.rowId).localeCompare(c.seat.logicalRowId??c.seat.rowId);return p!==0?p:D(o.seat,o.i)-D(c.seat,c.i)}).slice(0,e).map(o=>o.seat.label)}}function le(t,n,i,e){let u=Math.floor(e.qty),s=X(t,i,e),r=n.filter(d=>d.bookingMode==="whole"&&d.capacity===u&&i.has(d.label)&&(!e.categoryKey||d.categoryKey===e.categoryKey)&&(!e.zoneId||d.zoneId===e.zoneId)&&!e.accessibility).map(d=>({table:d,d2:T(d.center,e.preferNearest?e.focal:d.focalPoint??e.focal)})).sort((d,h)=>d.d2-h.d2||d.table.label.localeCompare(h.table.label))[0];if(!r)return s;if(!s.labels.length)return{labels:[r.table.label]};let l=new Map(t.map(d=>[d.label,d])),g=s.labels.map(d=>l.get(d)).filter(d=>!!d),m=g.length?T(E(g),q(g,e.focal)):Number.POSITIVE_INFINITY;return r.d2<m?{labels:[r.table.label]}:s}var v=class extends Error{constructor(i,e){super(e);this.objectId=i;this.name="GroupedTableProjectionError"}};function Z(t){let n=t.minOccupancy,i=t.maxOccupancy;if(!Number.isInteger(n)||!Number.isInteger(i)||n<1||i<n||i>t.seatCount)throw new v(t.id,`Table "${t.label}" has invalid variable-occupancy bounds`);return{min:n,max:i}}function de(t,n){if(n!==2)return[];let i=[];for(let e of M(t)){if(e.type!=="table"||!e.bookAsWhole&&!e.variableOccupancy)continue;if(e.bookAsWhole&&e.variableOccupancy)throw new v(e.id,`Table "${e.label}" cannot be whole-table and variable-occupancy inventory`);if(!Number.isInteger(e.seatCount)||e.seatCount<1||!e.label.trim())throw new v(e.id,"Grouped tables require a label and at least one chair");let u=e.variableOccupancy?"variable":"whole",s=u==="variable"?Z(e):{min:e.seatCount,max:e.seatCount};i.push({objectId:e.id,label:e.label,...e.displayLabel?{displayLabel:e.displayLabel}:{},...e.displayType?{displayType:e.displayType}:{},categoryKey:e.categoryKey,mode:u,capacity:e.seatCount,minOccupancy:s.min,maxOccupancy:s.max,chairs:B(e)})}return i}export{te as a,$ as b,H as c,R as d,oe as e,F as f,Q as g,re as h,X as i,le as j,v as k,de as l};
@@ -1 +0,0 @@
1
- import{Ea as h,Ia as m,Ja as y,Pa as b,Qa as S,Sa as f}from"./chunk-UISTXRO5.js";var g="__sl_ga__";function M(t){return t.startsWith(g)}var C=g,p=1e5;function L(t,e){return`${C}${encodeURIComponent(t)}__${e+1}`}function w(t){let e=t.inventorySegments;if(e===void 0)return!0;if(!Array.isArray(e)||e.length<1||e.length>256)return!1;let n=0,r=new Map;for(let o of e){if(!o||typeof o.sourceAreaId!="string"||!o.sourceAreaId.trim()||o.sourceAreaId.length>160||!Number.isInteger(o.startIndex)||o.startIndex<0||!Number.isInteger(o.count)||o.count<1||o.startIndex+o.count>p||(n+=o.count,n>p))return!1;let c=r.get(o.sourceAreaId)??[],i=o.startIndex+o.count;if(c.some(s=>o.startIndex<s.end&&i>s.start))return!1;c.push({start:o.startIndex,end:i}),r.set(o.sourceAreaId,c)}return n===t.capacity}function j(t){let e=Math.min(p,Math.max(0,Math.floor(t.capacity)));return t.inventorySegments===void 0?e?[{sourceAreaId:t.id,startIndex:0,count:e}]:[]:w(t)?t.inventorySegments.map(n=>({...n})):[]}function A(t){return j(t).flatMap(e=>Array.from({length:e.count},(n,r)=>L(e.sourceAreaId,e.startIndex+r)))}function H(t,e){if(t.inventorySegments===void 0||e===t.capacity)return t.inventorySegments;if(e<t.capacity)return;let n=j(t);if(!n.length)return;let r=e-t.capacity;if(!r)return n;let c=n.filter(s=>s.sourceAreaId===t.id).reduce((s,a)=>Math.max(s,a.startIndex+a.count),0),i=n[n.length-1];if(i?.sourceAreaId===t.id&&i.startIndex+i.count===c)i.count+=r;else{if(n.length>=256)return;n.push({sourceAreaId:t.id,startIndex:c,count:r})}return n}function X(t){return f(t).filter(e=>e.type==="gaArea")}var I="__ungrouped__";function E(t){return t.type==="row"?h(t).map(e=>e.label):t.type==="table"?m(t).map(e=>e.label):t.type==="booth"?y(t).map(e=>e.label):t.type==="gaArea"?A(t):[]}function x(t){return t.type==="row"||t.type==="table"||t.type==="booth"||t.type==="gaArea"}function G(t){return t.displayLabel||t.label||"Section"}function O(t){let e=new Map;for(let n of f(t)){if(n.type!=="section")continue;let r=n.logicalSectionId??n.id;e.has(r)||e.set(r,{id:r,label:G(n),zone:n.zone})}return e}function K(t){let e=new Map;for(let[n,r]of O(t))e.set(n,r.label);return e}function N(t){let e=new Map;for(let n of S(t)){let r=n.objects.filter(o=>o.type==="section");if(r.length)for(let o of n.objects){if(!x(o))continue;let c=b(n.objects,o,r);c&&e.set(o.id,c.logicalSectionId??c.id)}}return e}function _(t,e){let n=f(t),r=n.filter(s=>s.type==="section"),o=new Map;for(let[s,a]of O(t))o.set(s,{id:s,label:a.label,zone:a.zone,seatCount:0,objectIds:[],seatLabels:[]});let c={id:I,label:"Other seats",seatCount:0,objectIds:[],seatLabels:[]},i=new Map;for(let s of n){if(!x(s))continue;let a=E(s);if(a.length===0)continue;let u;if(e)u=e.get(s.id);else{let d=b(n,s,r);u=d?d.logicalSectionId??d.id:void 0}let l=u?o.get(u):c;l.seatCount+=a.length,l.objectIds.push(s.id),l.seatLabels.push(...a),i.set(s.id,l.id)}return{sections:[...o.values()],ungrouped:c.objectIds.length?c:null,objectToSection:i}}function Q(t){return _(t,null)}function R(t){return _(t,N(t))}function v(t,e){return e.has(t.id)||!!t.logicalSectionId&&e.has(t.logicalSectionId)||!!t.zone&&e.has(t.zone)}function D(t,e){let n=new Set;if(!e.size)return n;let{sections:r,ungrouped:o,objectToSection:c}=R(t),i=new Set,s=new Map(r.map(u=>[u.id,u.zone]));for(let u of r){let l=s.get(u.id);(e.has(u.id)||l&&e.has(l))&&i.add(u.id)}let a=!!o&&e.has(I);for(let[u,l]of c)(i.has(l)||a&&l===I)&&n.add(u);return n}function Z(t,e){if(!e.size)return t;let n=D(t,e),r=e instanceof Set?e:new Set(e),o=i=>!(n.has(i.id)||i.type==="section"&&v(i,r));if(t.floors&&t.floors.length){let i=!1,s=t.floors.map(a=>{let u=a.objects.filter(o);return u.length!==a.objects.length&&(i=!0),u.length===a.objects.length?a:{...a,objects:u}});return i?{...t,floors:s,objects:s[0].objects}:t}let c=t.objects.filter(o);return c.length===t.objects.length?t:{...t,objects:c}}export{g as a,M as b,p as c,L as d,w as e,j as f,A as g,H as h,X as i,I as j,O as k,K as l,N as m,Q as n,R as o,v as p,D as q,Z as r};
@@ -1 +0,0 @@
1
- import{c as b,k as y,n as f,t as g}from"./chunk-JBOTRSMY.js";var j=["horizontal","vertical","auto"],A=72;function N(e,t){return e==="vertical"?!0:e==="auto"?!!t&&t.height>t.width:!1}var W="seatmap.chart";var I=[{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"}],w=new Map(I.map(e=>[e.key,e]));function X(e){return w.get(e)}var R={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 v(e){let t=e?.[0];return t&&R[t]||"#3b82f6"}var k=[{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"}],M=new Map(k.map(e=>[e.key,e]));function q(e){return M.get(e)}var Q=8,J=24,E=["reference-focal","bar","entrance","exit","restroom","screen","sound","concession","coat","wall","rail","suite","obstruction"],T=new Set(E);function $(e){switch(e.type){case"row":case"table":case"gaArea":case"booth":case"section":return"interactive";case"decorImage":return e.layer==="foreground"?"foreground":"background";case"shape":return e.role&&T.has(e.role)?"surroundings":"background";case"text":return"background";default:return"interactive"}}var ae=7,se=10,L=10,P=.39,O=.8,_=.62;function ce(e){let t=Math.min(Math.abs(e.width),Math.abs(e.height));if(!(t>0))return L;let n=Math.max(1,e.text.length),r=Math.abs(e.width)*O/(n*_);return Math.max(L,Math.min(t*P,r))}var le=15,de=11,ue=.85,B=12,d=4.5,be=3,F=3,o="#000000",a="#ffffff",D=24,z=18.67;function ge(e,t=400){return e>=D||t>=700&&e>=z?F:d}function me(e,t){return e*t>=B}var pe=24,x={wheelchair:"M7.8 4.5a2.2 2.2 0 1 0 4.4 0a2.2 2.2 0 1 0 -4.4 0zM8 7L10.5 7L10.5 15L8 15ZM8 12.5L18 12.5L18 15L8 15ZM16 15L18 15L18 18L16 18ZM5.5 16a5.5 5.5 0 1 0 11 0a5.5 5.5 0 1 0 -11 0zM8 16a3 3 0 1 1 6 0a3 3 0 1 1 -6 0z",companion:"M5.5 6.5a3 3 0 1 0 6 0a3 3 0 1 0 -6 0zM4.5 18.5L6 11.5L11 11.5L12.5 18.5ZM12.5 7.5a3 3 0 1 0 6 0a3 3 0 1 0 -6 0zM11.5 19L13 12.5L18 12.5L19.5 19Z","semi-ambulatory":"M8.3 3.8a2.2 2.2 0 1 0 4.4 0a2.2 2.2 0 1 0 -4.4 0zM9 6.2L12 6.6L11 13.5L8.6 13L9 6.2ZM8.6 13L11 13L9.5 21L7 21ZM10.4 13L12.6 13L13.6 21L11.2 21ZM11.2 7.2L14 8L14.6 9.6L11.9 8.9ZM14.4 6.8L15.9 6.8L16.4 21L14.8 21Z","designated-aisle":"M3 5L6 5L6 14L3 14ZM3 12L13 12L13 15L3 15ZM5 15L7 15L7 20L5 20ZM11 15L13 15L13 20L11 20ZM13 7L20 7L17 4L19 4L23 8.5L19 13L17 13L20 10L13 10Z","step-free":"M4 4.5a2.2 2.2 0 1 0 4.4 0a2.2 2.2 0 1 0 -4.4 0zM4.4 7L7.5 7L7.5 13L11 15L9.5 17L5 14L4.4 7ZM2 19L8 19L17 10L22 10L22 13L18 13L10 21L2 21Z",hearing:"M15.5 3.5C9 2.2 5.5 6 5.5 11.5C5.5 16 8 19.5 10.5 21C13.2 22.6 16.4 20.8 15.4 18C14.8 16.4 12.9 16.1 13 14C13.1 11.9 15.8 11.4 15.8 8.5C15.8 5.4 13 4 15.5 3.5Z",cart:"M5.5 6L18.5 6a2.5 2.5 0 0 1 2.5 2.5L21 15.5a2.5 2.5 0 0 1 -2.5 2.5L11 18L7 20.5L7.5 18L5.5 18a2.5 2.5 0 0 1 -2.5 -2.5L3 8.5a2.5 2.5 0 0 1 2.5 -2.5zM6.5 11L17.5 11L17.5 12.6L6.5 12.6zM6.5 14L17.5 14L17.5 15.6L6.5 15.6z","sign-language":"M7 11L17 11L17 18a2 2 0 0 1 -2 2L9 20a2 2 0 0 1 -2 -2zM7.6 5L9.4 5L9.4 12L7.6 12zM9.9 3.5L11.7 3.5L11.7 12L9.9 12zM12.3 3.5L14.1 3.5L14.1 12L12.3 12zM14.6 5L16.4 5L16.4 12L14.6 12zM7.2 12.5L5 10.2L6.4 8.9L8.6 11.2Z","low-vision":"M2.5 12C6 6 18 6 21.5 12C18 18 6 18 2.5 12ZM9 12a3 3 0 1 0 6 0a3 3 0 1 0 -6 0zM17.5 3L19 3L19 6L17.5 6ZM19 4L22 4L22 5.5L19 5.5Z","sensory-friendly":"M4 11C4 5 7 2.5 12 2.5S20 5 20 11L17 11C17 7 15.5 5.5 12 5.5S7 7 7 11ZM3 10L8 10L8 19L5 19a2 2 0 0 1 -2 -2ZM16 10L21 10L21 17a2 2 0 0 1 -2 2L16 19ZM9 12L15 12L15 14L9 14ZM10 16L14 16L14 18L10 18Z","plus-size":"M9.4 4.3a2.6 2.6 0 1 0 5.2 0a2.6 2.6 0 1 0 -5.2 0zM5 20L4 13C4 10.5 7 9.5 12 9.5C17 9.5 20 10.5 20 13L19 20Z","lift-armrest":"M5 6L8 6L8 19L5 19zM5 16L18 16L18 19L5 19zM8 12L17 12L17 14.5L8 14.5zM14 7L16 7L16 12L14 12zM12 7L18 7L15 3Z"},Se=x.wheelchair;function ye(e){if(!e?.length)return null;let t=e.includes("wheelchair")?"wheelchair":e[0];return x[t]??null}function fe(e,t){return t.colorblind?G(t.canvasBackground):v(e)}function ve(e){return/-(\d{1,5})$/.exec(e)?.[1]??e}var s=f;function Le(e,t,n){let r=b(e),c=b(t);if(!r||!c)return t;let i=Math.max(0,Math.min(1,n));return`#${r.map((l,m)=>Math.round(l*i+c[m]*(1-i))).map(l=>l.toString(16).padStart(2,"0")).join("")}`}var he=3;function xe(e){let t=s(a,e)??0,n=s(o,e)??0;return t>=d?a:n>=d&&g(e)||g(e)?o:a}function G(e){return g(e)?o:a}function C(e,t,n=d){let r=s(t,e);if(r!=null&&r>=n)return t;let c=s(o,e)??0,i=s(a,e)??0;return c===0&&i===0?t:c>=i?o:a}function Ce(e,t,n,r=d){return t??C(e,n,r)}var V=3;function Ae(e){let t=s("#ffffff",e);if(t!=null&&t>=V)return"#ffffff";let n=s(o,e)??0,r=s(a,e)??0;return n===0&&r===0?"#ffffff":n>=r?o:a}var h=/^#[0-9a-f]{6}$/i;function H(e){let t=b(e);return t!=null&&y(t)>.5}var Z="#e5e7eb",K="#273142";function Ie(e){return H(e)?Z:K}function we(e,t,n=d){let r=h.test(e.trim()),c=e.trim().toLowerCase(),i=0,u=0,l=null;for(let p of t){if(!r||!h.test(p.trim()))continue;i+=1;let S=C(p,e,n);S.toLowerCase()!==c&&(u+=1,l=S)}return{total:i,overridden:u,status:i===0?"none":u===0?"applies":u===i?"overridden":"mixed",overrideInk:l}}export{j as a,A as b,N as c,W as d,I as e,X as f,R as g,v as h,k as i,q as j,Q as k,J as l,E as m,$ as n,ae as o,se as p,L as q,P as r,ce as s,le as t,de as u,ue as v,B as w,d as x,be as y,F as z,o as A,a as B,ge as C,me as D,pe as E,x as F,Se as G,ye as H,fe as I,ve as J,s as K,Le as L,he as M,xe as N,G as O,C as P,Ce as Q,Ae as R,H as S,Z as T,K as U,Ie as V,we as W};
@@ -1 +0,0 @@
1
- import{M as o}from"./chunk-UISTXRO5.js";var u=36,c=160;function A(r,n=360){let t=o(Math.round(Number.isFinite(r)?r:1),1,40),i=o(Number.isFinite(n)?n:360,120,360);return Math.round(o(t*4*(360/i),u,c))}export{u as a,c as b,A as c};
@@ -1 +0,0 @@
1
- var c=/^[\p{L}\p{N}]{1,4}$/u,a=/^([\p{L}\p{N}]{2,})[\s\-\u2013\u2014\u00b7_./]+(.+)$/u;function p(t,i){let o=i?.trim();if(!o)return t;let u=t.toLocaleLowerCase("en-US"),s=o.toLocaleLowerCase("en-US");if(u.startsWith(`${s} `)){let e=t.slice(o.length).trim();if(c.test(e))return e}let n=a.exec(t);if(n){let e=n[1].toLocaleLowerCase("en-US"),r=n[2].trim();if((s.startsWith(e)||e.startsWith(s))&&c.test(r))return r}return t}export{p as a};
@@ -1 +0,0 @@
1
- import{g as D}from"./chunk-23OTKCJU.js";import{B as v,Ca as w,Ea as C,Fa as S,Ha as j,Ia as A,M}from"./chunk-UISTXRO5.js";function g(a){return a.floors?.length?a.floors.flatMap(o=>o.objects):a.objects}function K(a){return g(a).reduce((o,n)=>n.type==="row"?o+w(n):n.type==="table"?o+j(n):n.type==="gaArea"?o+Math.max(0,Math.floor(n.capacity)):n.type==="booth"?o+1:o,0)}function Q(a){let o={};for(let e of a.categories??[])o[e.key]=0;let n=(e,c)=>{c>0&&(o[e]=(o[e]??0)+c)};for(let e of g(a))if(e.type==="row")for(let c of C(e))n(c.categoryKey,1);else if(e.type==="table")if(e.bookAsWhole||e.variableOccupancy)n(e.categoryKey,Math.max(0,Math.round(e.seatCount)));else for(let c of A(e))n(c.categoryKey,1);else e.type==="gaArea"?n(e.categoryKey,Math.max(0,Math.floor(e.capacity))):e.type==="booth"&&n(e.categoryKey,1);return o}function P(a){if(!a.template)return null;let o=g(a),n=o.filter(s=>s.type==="row"||s.type==="table"||s.type==="gaArea");if(!n.length)return null;let c=o.filter(s=>s.type==="booth").length+n.reduce((s,l)=>s+(l.type==="table"?2:1),0),y=K(a),h=Math.max(c+1,Math.min(5e4,y*4)),d=[.5,1,1.5,2].map(s=>M(Math.round(y*s),c,h));return{family:a.template.family,display:a.template.family.replace(/-/g," ").replace(/\b\w/g,s=>s.toUpperCase()),min:c,max:h,presets:["S","M","L","XL"].map((s,l)=>({size:s,seats:d[l]}))}}function O(a){let o=C(a);return o.length?v(o):{...a.origin}}function U(a,o){let n=P(a);if(!n)return structuredClone(a);let e=structuredClone(a),c=g(e),y=c.filter(t=>t.type==="row"||t.type==="table"||t.type==="gaArea"),h=c.filter(t=>t.type==="booth").length,d=Math.max(n.min,Math.min(n.max,Math.round(o))),s=d-h,l=y.map((t,r)=>{let u=t.type==="gaArea"?Math.max(0,Math.floor(t.capacity)):t.seatCount,p=t.type==="table"?2:1;return{object:t,index:r,current:u,minimum:p,value:p,fraction:0}}),R=l.reduce((t,r)=>t+r.minimum,0),b=Math.max(0,s-R),z=l.reduce((t,r)=>t+Math.max(1,r.current-r.minimum),0);for(let t of l){let r=b*Math.max(1,t.current-t.minimum)/z,u=Math.floor(r);t.value+=u,t.fraction=r-u}b=s-l.reduce((t,r)=>t+r.value,0),l.sort((t,r)=>r.fraction-t.fraction||t.index-r.index);for(let t=0;t<b;t++)l[t%l.length].value++;l.sort((t,r)=>t.index-r.index);for(let t of l)if(t.object.type==="row"){let r=O(t.object);t.object.seatCount=t.value;let u=O(t.object);t.object.origin.x+=r.x-u.x,t.object.origin.y+=r.y-u.y}else if(t.object.type==="table"){let r=t.object;if(r.seatCountsBySide){let u=["top","bottom","left","right"],p=S(r),B=u.reduce((i,f)=>i+p[f],0)||1,m=u.map((i,f)=>{let x=t.value*p[i]/B;return{side:i,index:f,value:Math.floor(x),fraction:x-Math.floor(x)}}),L=t.value-m.reduce((i,f)=>i+f.value,0);m.sort((i,f)=>f.fraction-i.fraction||i.index-f.index);for(let i=0;i<L;i++)m[i%m.length].value+=1;m.sort((i,f)=>i.index-f.index),r.seatCountsBySide={top:m[0].value,bottom:m[1].value,left:m[2].value,right:m[3].value},r.sides=u.filter(i=>r.seatCountsBySide[i]>0)}r.seatCount=t.value,r.overrides&&(r.overrides=r.overrides.filter(u=>u.index<t.value),r.overrides.length||delete r.overrides)}else t.object.capacity=t.value;return e.floors?.length&&(e.objects=e.floors[0].objects),e.template={family:e.template.family,targetSeats:d},e=D(e).doc,e.template={family:a.template.family,targetSeats:K(e)},e}export{K as a,Q as b,P as c,U as d};
@@ -1 +0,0 @@
1
- import{h as Ie,i as ce}from"./chunk-5ITK5236.js";import{c as Pe}from"./chunk-CRCGO52K.js";var Wn=2e6,Mt=/^data:image\/(?:png|jpe?g|webp|gif|avif);base64,[a-z0-9+/]+={0,2}$/i,St=/[\s"'<>`\\]/;function vt(e){if(typeof e!="string"||!e||e.length>2e6||e!==e.trim())return!1;if(e.startsWith("data:"))return Mt.test(e);if(St.test(e))return!1;try{let t=new URL(e);return t.protocol==="https:"&&!t.username&&!t.password}catch{return!1}}function Ce(e){let t=e.trim();return vt(t)?t:null}var wt=2e5,qn=1e5,Et="large_venue_inventory";function Qn(e){return e?.includes(Et)?2e5:1e5}var Z="seatlayer.event-configuration/1",le="seatlayer.event-configuration-export/1",K=100,It=120,Pt=2e5,Ct=1e4,ke=/^[a-f0-9]{64}$/,_t=new Set(["stage","screen","barrier","camera_platform","sound_desk","rigging_truss"]);function Y(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function H(e,t){return typeof e=="string"&&e.length>=1&&e.length<=t&&e.normalize("NFKC").trim()===e}function Re(e){return typeof e=="number"&&Number.isInteger(e)&&e>0}function _e(e){return!Array.isArray(e)||e.length>Pt||!e.every(t=>H(t,K))?null:[...new Set(e)].sort()}function Te(e){return!Y(e)||!H(e.chartId,K)||!H(e.version,K)||e.sha256!==void 0&&(typeof e.sha256!="string"||!ke.test(e.sha256))?null:{chartId:e.chartId,version:e.version,...typeof e.sha256=="string"?{sha256:e.sha256}:{}}}function ue(e,t,n){return typeof e=="number"&&Number.isFinite(e)&&e>=t&&e<=n}function kt(e){return Y(e)?e.mode==="none"||e.mode==="opaque"?e.opacity===void 0?{mode:e.mode}:null:e.mode==="partial"&&ue(e.opacity,.01,.99)?{mode:"partial",opacity:e.opacity}:null:null}function Rt(e,t){if(e===void 0)return;if(!Array.isArray(e)||e.length>Ct)return null;let n=new Set(t),i=new Set,o=new Set,r=0,s=[];for(let l of e){if(!Y(l)||!H(l.id,K)||!H(l.objectId,K)||!n.has(l.objectId)||!_t.has(String(l.kind))||!ue(l.heightM,.05,50)||l.baseElevationM!==void 0&&!ue(l.baseElevationM,-10,100))return null;let m=kt(l.occlusion);if(!m||i.has(l.id)||o.has(l.objectId))return null;let a=l.contentImageUrl===void 0?void 0:typeof l.contentImageUrl=="string"?Ce(l.contentImageUrl):null;if(l.contentImageUrl!==void 0&&(!a||l.kind!=="screen"||++r>1))return null;i.add(l.id),o.add(l.objectId),s.push({id:l.id,objectId:l.objectId,kind:l.kind,heightM:l.heightM,...l.baseElevationM!==void 0?{baseElevationM:l.baseElevationM}:{},occlusion:m,...a?{contentImageUrl:a}:{}})}return s.sort((l,m)=>l.id.localeCompare(m.id))}function Oe(e){let t=[];if(!Y(e))return{issues:[{code:"invalid_export",path:"configuration",message:"Configuration must be an object"}]};e.schema!==Z&&t.push({code:"unsupported_schema",path:"configuration.schema",message:`Configuration schema must be ${Z}`}),H(e.id,K)||t.push({code:"invalid_id",path:"configuration.id",message:"Configuration id must contain 1 to 100 normalized characters"}),H(e.label,It)||t.push({code:"invalid_label",path:"configuration.label",message:"Configuration label must contain 1 to 120 normalized characters"}),Re(e.version)||t.push({code:"invalid_version",path:"configuration.version",message:"Configuration version must be a positive integer"});let n=Te(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 i=Y(e.overlay)?e.overlay:null,o=_e(i?.objectIds),r=_e(i?.productionKillSeatIds),s=o?Rt(i?.productionElements,o):null;return(!i||!o||!r)&&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||!o||!r||s===null?{issues:t}:{issues:t,value:{schema:Z,id:e.id,label:e.label,version:e.version,baseVenue:n,overlay:{objectIds:o,productionKillSeatIds:r,...s!==void 0?{productionElements:s}:{}}}}}function eo(e){let t=Oe(e);return t.value?{ok:!0,value:t.value}:{ok:!1,issues:t.issues}}function to(e){if(!Y(e))return{ok:!1,issues:[{code:"invalid_export",path:"",message:"Export must be an object"}]};let t=[];e.schema!==le&&t.push({code:"unsupported_schema",path:"schema",message:`Export schema must be ${le}`}),(typeof e.contentSha256!="string"||!ke.test(e.contentSha256))&&t.push({code:"invalid_checksum",path:"contentSha256",message:"Export checksum must be a lowercase SHA-256 digest"});let n=Oe(e.configuration);return t.push(...n.issues),t.length||!n.value||typeof e.contentSha256!="string"?{ok:!1,issues:t}:{ok:!0,value:{schema:le,configuration:n.value,contentSha256:e.contentSha256}}}function no(e){return JSON.stringify({schema:Z,id:e.id,label:e.label,version:e.version,baseVenue:{chartId:e.baseVenue.chartId,version:e.baseVenue.version,...e.baseVenue.sha256?{sha256:e.baseVenue.sha256}:{}},overlay:{objectIds:[...new Set(e.overlay.objectIds)].sort(),productionKillSeatIds:[...new Set(e.overlay.productionKillSeatIds)].sort(),...e.overlay.productionElements!==void 0?{productionElements:[...e.overlay.productionElements].sort((t,n)=>t.id.localeCompare(n.id)).map(t=>({id:t.id,objectId:t.objectId,kind:t.kind,heightM:t.heightM,...t.baseElevationM!==void 0?{baseElevationM:t.baseElevationM}:{},occlusion:t.occlusion,...t.contentImageUrl?{contentImageUrl:t.contentImageUrl}:{}}))}:{}}})}function oo(e,t){let n=[];e.baseVenue.chartId!==t.chartId&&n.push({code:"base_venue_mismatch",message:"Configuration belongs to a different base venue"}),e.baseVenue.version!==t.version&&n.push({code:"base_venue_version_mismatch",message:"Configuration was authored against a different venue version"}),e.baseVenue.sha256&&!t.sha256?n.push({code:"base_venue_checksum_missing",message:"Venue checksum is required for this configuration"}):e.baseVenue.sha256&&e.baseVenue.sha256!==t.sha256&&n.push({code:"base_venue_checksum_mismatch",message:"Venue bytes do not match the configuration base"});let i=new Set(t.objectIds);for(let r of e.overlay.objectIds)i.has(r)||n.push({code:"overlay_object_missing",message:`Production object ${r} is missing from the base venue`,targetId:r});if(t.objectTypes)for(let r of e.overlay.productionElements??[])t.objectTypes.get(r.objectId)!=="shape"&&n.push({code:"production_element_not_shape",message:`Production element ${r.id} must reference base-venue shape geometry`,targetId:r.objectId});let o=new Set(t.seatIds);for(let r of e.overlay.productionKillSeatIds)o.has(r)||n.push({code:"production_kill_seat_missing",message:`Production-kill seat ${r} is missing from the base venue`,targetId:r});return{compatible:n.length===0,issues:n}}var Tt={draft:new Set(["review","archived"]),review:new Set(["draft","approved","archived"]),approved:new Set(["published","archived"]),published:new Set(["archived"]),archived:new Set};function io(e,t){return e===t||Tt[e].has(t)}function ro(e,t,n){return!Re(n)||n>=t.version?null:e.find(i=>i.id===t.id&&i.version===n&&i.status==="published")??null}function Ot(e){return e.floors?.length?e.floors.flatMap(t=>t.objects):e.objects}function de(e,t,n){if(!(!e||typeof e!="object")){if(Array.isArray(e)){for(let i of e)de(i,t,n);return}for(let[i,o]of Object.entries(e)){if(i==="eventConfigurationId"){H(o,K)?t.add(o):o!==void 0&&n.add(String(o));continue}if(i==="eventConfigurationIds"){if(!Array.isArray(o))n.add(String(o));else for(let r of o)H(r,K)?t.add(r):n.add(String(r));continue}de(o,t,n)}}}function so(e,t){let n=Te(t);if(!n)return{ok:!1,invalidIds:["baseVenue"]};let i=new Set,o=new Set;if(de(e,i,o),o.size)return{ok:!1,invalidIds:[...o].sort()};let r=Ot(e);return{ok:!0,configurations:[...i].sort().map(s=>({schema:Z,id:s,label:s,version:1,baseVenue:n,overlay:{objectIds:r.filter(l=>l.type==="shape"&&l.eventConfigurationIds?.includes(s)).map(l=>l.id).sort(),productionKillSeatIds:[]}}))}}var co=40,lo=1200,uo=.8,fo=3,ho=-2,mo=20,po=.1,bo=40,yo=40,Ae=e=>Math.max(1,e.fontSize*.6+(e.letterSpacing??0));function At(e,t){let n=e.text.split(/\r?\n/);if(!e.width)return Math.max(1,n.length);let i=Math.max(1,Math.floor(t/Ae(e))),o=0;for(let r of n){if(!r.length){o+=1;continue}let s=0;for(let l of r.split(/\s+/)){let m=l.length;s&&s+1+m<=i?s+=1+m:(o+=Math.max(1,Math.ceil(m/i)),s=m%i)}}return Math.max(1,o)}function Ne(e){let t=e.background?.padding??0,n=e.text.split(/\r?\n/),i=Math.max(1,...n.map(l=>l.length))*Ae(e),o=e.width??i+t*2,r=Math.max(1,o-t*2),s=At(e,r);return{width:o,height:s*e.fontSize*(e.lineHeight??1.2)+t*2,lineCount:s,padding:t}}var Nt=Math.PI/180;function T(e,t){return Math.hypot(e.x-t.x,e.y-t.y)}function jt(e,t,n){let i=Math.cos(n),o=Math.sin(n),r=e.x-t.x,s=e.y-t.y;return{x:t.x+r*i-s*o,y:t.y+r*o+s*i}}function xo(e,t){return jt(e,{x:0,y:0},t*Nt)}function L(e,t,n){return{x:e.x+(t.x-e.x)*n,y:e.y+(t.y-e.y)*n}}function Lt(e){let t=0,n=0;for(let o of e)t+=o.x,n+=o.y;let i=e.length||1;return{x:t/i,y:n/i}}function Mo(e){return e.length?Lt(e):null}function fe(e,t){let n=1-t,i=n*n*n,o=3*n*n*t,r=3*n*t*t,s=t*t*t;return{x:i*e.start.x+o*e.control1.x+r*e.control2.x+s*e.end.x,y:i*e.start.y+o*e.control1.y+r*e.control2.y+s*e.end.y}}function wo(e,t,n){let i={x:(e.x+t.x)/2,y:(e.y+t.y)/2},o={x:(n.x-i.x)*4/3,y:(n.y-i.y)*4/3};return{start:{...e},control1:{x:e.x+(t.x-e.x)/3+o.x,y:e.y+(t.y-e.y)/3+o.y},control2:{x:e.x+(t.x-e.x)*2/3+o.x,y:e.y+(t.y-e.y)*2/3+o.y},end:{...t}}}function Fe(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[fe(e,.5)];let i=Array.from({length:n+1},(m,a)=>fe(e,a/n)),o=new Float64Array(i.length);for(let m=1;m<i.length;m+=1){let a=i[m].x-i[m-1].x,c=i[m].y-i[m-1].y;o[m]=o[m-1]+Math.hypot(a,c)}let r=o[o.length-1];if(r<=1e-9)return Array.from({length:t},()=>({...e.start}));let s=[],l=1;for(let m=0;m<t;m+=1){let a=r*m/(t-1);for(;l<o.length-1&&o[l]<a;)l+=1;let c=o[l-1],u=o[l],h=u===c?0:(a-c)/(u-c);s.push({x:i[l-1].x+(i[l].x-i[l-1].x)*h,y:i[l-1].y+(i[l].y-i[l-1].y)*h})}return s}function F(e,t){return{x:e.x+t.x,y:e.y+t.y}}function ee(e,t){return{x:e.x-t.x,y:e.y-t.y}}function D(e,t){return{x:e.x*t,y:e.y*t}}function oe(e,t=13){return Array.from({length:t},(n,i)=>fe(e,i/(t-1)))}function je(e,t){let n=Math.max(0,Math.min(1,t))*(e.length-1),i=Math.min(e.length-2,Math.floor(n));return L(e[i],e[i+1],n-i)}function Le(e,t,n){let i=Math.max(0,Math.min(1,t)),o=Math.max(i,Math.min(1,n)),r=[je(e,i)];for(let s=1;s<e.length-1;s+=1){let l=s/(e.length-1);l>i+1e-9&&l<o-1e-9&&r.push(e[s])}return r.push(je(e,o)),r}function De(e,t){let n=[[0,1],[1,2],[2,3],[3,0]],i=0,o=Number.POSITIVE_INFINITY;n.forEach(([h,d],b)=>{let f=T(L(e[h],e[d],.5),t);f<o&&(o=f,i=b)});let r=e[i],s=e[(i+1)%4],l=e[(i+2)%4],m=e[(i+3)%4],a=L(r,s,.5),c=ee(t,a),u=Math.max(1e-9,Math.hypot(c.x,c.y));return{p0:r,p1:s,p2:l,p3:m,normal:D(c,1/u),depth:(T(r,m)+T(s,l))/2}}function Ve(e){let{p0:t,p1:n,p2:i,p3:o,normal:r,depth:s}=e,l=ee(n,t),m=ee(i,o),a=s*.22,c=s*.12;return{nearPath:{start:t,control1:F(F(t,D(l,1/3)),D(r,a)),control2:F(F(t,D(l,2/3)),D(r,a)),end:n},farPath:{start:i,control1:F(F(o,D(m,2/3)),D(r,c)),control2:F(F(o,D(m,1/3)),D(r,c)),end:o}}}function Eo(e,t,n){if(e.length!==4)throw new Error("A section shell requires four mapped bounds corners");let i=e.reduce((b,f)=>F(b,f),{x:0,y:0});i.x/=4,i.y/=4;let o=T(e[0],e[1]),r=T(e[0],e[3]),s=n==="auto"?o>r*1.25&&T(i,t)>r?"bezier":"tapered":n;if(s==="rectangle")return{mode:s,outline:e.map(b=>({...b}))};let l=De(e,t),{p0:m,p1:a,p2:c,p3:u}=l;if(s==="tapered")return{mode:s,outline:[F(m,D(ee(a,m),.14)),F(m,D(ee(a,m),1-.14)),c,u]};let{nearPath:h,farPath:d}=Ve(l);return{mode:s,outline:[...oe(h),...oe(d).slice(1)]}}function Io(e,t,n,i){if(e.length!==4)throw new Error("Aisle generation requires four mapped bounds corners");if(!Number.isInteger(n)||n<0||n>3)throw new Error("Aisle count must be an integer from 0 to 3");if(n===0)return[];let o=De(e,t),{p0:r,p1:s,p2:l,p3:m}=o,a=i==="bezier"?Ve(o):null,c=a?oe(a.nearPath):null,u=a?oe(a.farPath).reverse():null,h=Math.min(.055,.18/(n+1));return Array.from({length:n},(d,b)=>{let f=(b+1)/(n+1),g=f-h/2,w=f+h/2;return c&&u?[...Le(c,g,w),...Le(u,g,w).reverse()]:[L(r,s,g),L(r,s,w),L(m,l,w),L(m,l,g)]})}function Ft(e,t,n){let i=n.x-t.x,o=n.y-t.y,r=i*i+o*o,s=r?Math.max(0,Math.min(1,((e.x-t.x)*i+(e.y-t.y)*o)/r)):0;return Math.hypot(e.x-(t.x+s*i),e.y-(t.y+s*o))}function Dt(e,t){let n=1/0;for(let i of t)if(!(i.length<2))for(let o=0,r=i.length-1;o<i.length;r=o++){let s=Ft(e,i[r],i[o]);s<n&&(n=s)}return n}function He(e,t){let n=!1;for(let i=0,o=t.length-1;i<t.length;o=i++){let r=t[i].x,s=t[i].y,l=t[o].x,m=t[o].y;s>e.y!=m>e.y&&e.x<(l-r)*(e.y-s)/(m-s)+r&&(n=!n)}return n}function Ke(e){return Array.isArray(e)?e.filter(t=>Array.isArray(t)&&t.length>=3):[]}function Vt(e,t,n){let i=He(e,t)&&!n.some(r=>He(e,r)),o=Dt(e,[t,...n]);return i?o:-o}function z(e,t,n,i,o){let r=Vt({x:e,y:t},i,o);return{x:e,y:t,h:n,d:r,max:r+n*Math.SQRT2}}var he=class{constructor(){this.items=[]}get size(){return this.items.length}push(t){let n=this.items;n.push(t);let i=n.length-1;for(;i>0;){let o=i-1>>1;if(n[o].max>=n[i].max)break;[n[o],n[i]]=[n[i],n[o]],i=o}}pop(){let t=this.items,n=t[0],i=t.pop();if(t.length&&i){t[0]=i;let o=0;for(;;){let r=o*2+1,s=r+1,l=o;if(r<t.length&&t[r].max>t[l].max&&(l=r),s<t.length&&t[s].max>t[l].max&&(l=s),l===o)break;[t[l],t[o]]=[t[o],t[l]],o=l}}return n}};function Ue(e){if(e.length<3)return 0;let t=0;for(let n=0,i=e.length-1;n<e.length;i=n++)t+=(e[i].x+e[n].x)*(e[i].y-e[n].y);return Math.abs(t)/2}function Co(e,t){return Math.max(0,Ue(e)-Ke(t).reduce((n,i)=>n+Ue(i),0))}function Ge(e,t){let n=Ke(t);if(!e.length)return{point:{x:0,y:0},radius:0};if(e.length<3){let f=e.reduce((w,E)=>w+E.x,0)/e.length,g=e.reduce((w,E)=>w+E.y,0)/e.length;return{point:{x:f,y:g},radius:0}}let i=1/0,o=1/0,r=-1/0,s=-1/0;for(let f of e)f.x<i&&(i=f.x),f.y<o&&(o=f.y),f.x>r&&(r=f.x),f.y>s&&(s=f.y);let l=r-i,m=s-o,a=Math.min(l,m);if(!(a>0))return{point:{x:(i+r)/2,y:(o+s)/2},radius:0};let c=Math.max(l,m)/150,u=new he,h=a/2;for(let f=i;f<r;f+=a)for(let g=o;g<s;g+=a)u.push(z(f+h,g+h,h,e,n));let d=z(i+l/2,o+m/2,0,e,n),b=0;for(;u.size;){let f=u.pop();if(!f)break;f.d>d.d&&(d=f),!(f.max-d.d<=c)&&(b>=4e3||(b+=1,h=f.h/2,u.push(z(f.x-h,f.y-h,h,e,n)),u.push(z(f.x+h,f.y-h,h,e,n)),u.push(z(f.x-h,f.y+h,h,e,n)),u.push(z(f.x+h,f.y+h,h,e,n))))}return{point:{x:d.x,y:d.y},radius:Math.max(0,d.d)}}function Ht(e,t,n){return Math.max(t,Math.min(n,e))}function ko(e,t,n){return e<t?t:e>n?n:e}function Ut(e){return Ht(e,0,1)}function Xe(e){let t=Ut(e);return t*t*(3-2*t)}var W=Math.PI*2;function $(e){return Number.isFinite(e.x)&&Number.isFinite(e.y)}function Kt(e,t,n){let i=t-e;if(n){for(;i<0;)i+=W;for(;i>=W;)i-=W}else{for(;i>0;)i-=W;for(;i<=-W;)i+=W}return i}function Ao(e){return e.end}function ze(e){if(e.version!==1||e.closed!==!0||!$(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||!$(n.end))return!1;if(n.kind==="line"){if(T(t,n.end)<=1e-9)return!1}else if(n.kind==="bezier"){if(!$(n.control1)||!$(n.control2)||T(t,n.end)<=1e-9)return!1}else if(n.kind==="arc"){if(!$(n.center)||!Number.isFinite(n.radius)||n.radius<=1e-6||Math.abs(T(t,n.center)-n.radius)>Math.max(1e-4,n.radius*1e-4)||Math.abs(T(n.end,n.center)-n.radius)>Math.max(1e-4,n.radius*1e-4)||T(t,n.end)<=1e-9)return!1}else return!1;t=n.end}return T(t,e.start)<=1e-4}function Gt(e,t,n){let i=1-n;return{x:i**3*e.x+3*i**2*n*t.control1.x+3*i*n**2*t.control2.x+n**3*t.end.x,y:i**3*e.y+3*i**2*n*t.control1.y+3*i*n**2*t.control2.y+n**3*t.end.y}}function No(e,t=2){if(!ze(e))throw new Error("Section outline path is invalid");let n=Math.max(.25,t),i=[{...e.start}],o=e.start;for(let r of e.segments){if(r.kind==="line")i.push({...r.end});else if(r.kind==="arc"){let s=Math.atan2(o.y-r.center.y,o.x-r.center.x),l=Math.atan2(r.end.y-r.center.y,r.end.x-r.center.x),m=Kt(s,l,r.clockwise),a=Math.max(2,Math.ceil(Math.abs(m)*r.radius/n));for(let c=1;c<=a;c+=1){let u=s+m*c/a;i.push({x:r.center.x+Math.cos(u)*r.radius,y:r.center.y+Math.sin(u)*r.radius})}}else{let s=T(o,r.control1)+T(r.control1,r.control2)+T(r.control2,r.end),l=Math.max(2,Math.ceil(s/n));for(let m=1;m<=l;m+=1)i.push(Gt(o,r,m/l))}o=r.end}return T(i[i.length-1],i[0])<=1e-4&&i.pop(),i}function We(e,t,n){return Xt(e,o=>({x:o.x+t,y:o.y+n}))}function Xt(e,t,n=1,i=!1){return{...e,start:t(e.start),segments:e.segments.map(o=>o.kind==="line"?{...o,end:t(o.end)}:o.kind==="arc"?{...o,center:t(o.center),radius:o.radius*Math.abs(n),clockwise:i?!o.clockwise:o.clockwise,end:t(o.end)}:{...o,control1:t(o.control1),control2:t(o.control2),end:t(o.end)})}}var Bt=45,me=150,Yt=60;function zt(e){let t=Bt/100;if(e<=t)return me;let n=Math.min(1,(e-t)/(1-t));return me-n*(me-Yt)}var Be=.5523;function Ye(e,t){return Math.abs(e.x-t.x)<=1e-6&&Math.abs(e.y-t.y)<=1e-6}function Wt(e){let t=[],n=[];for(e.forEach((i,o)=>{$(i)&&(t.length&&Ye(t[t.length-1],i)||(t.push({x:i.x,y:i.y}),n.push(o)))});t.length>1&&Ye(t[0],t[t.length-1]);)t.pop(),n.pop();return{points:t,sourceIndex:n}}function jo(e,t,n){return Jt(e,{cornerSmoothing:t,...n})}var $t=.5,qt=4/3;function Qt(e,t,n){let i=t.x-e.x,o=t.y-e.y,r=Math.hypot(i,o);if(r<=1e-9)return{kind:"line",end:{...t}};let s=-o/r,l=i/r,m=n*qt;return{kind:"bezier",control1:{x:e.x+i/3+s*m,y:e.y+o/3+l*m},control2:{x:e.x+i*2/3+s*m,y:e.y+o*2/3+l*m},end:{...t}}}function Jt(e,t){let{points:n,sourceIndex:i}=Wt(e),o=n.length;if(o<3)return null;let r=Math.min(100,Math.max(0,t.cornerSmoothing??0))/100,s=t.edgeCurvature,l=new Array(o).fill(0);if(s?.length)for(let x=0;x<o;x+=1){let M=s[i[x]];l[x]=Number.isFinite(M)?Math.min(100,Math.max(-100,M))/100:0}let m=l.some(x=>Math.abs(x)>1e-6);if(r<=0&&!m)return null;let a=t.wideAngleThresholdDeg??zt(r),c=[];for(let x=0;x<o;x+=1)c[x]=T(n[x],n[(x+1)%o]);let u=new Array(o).fill(0);for(let x=0;x<o;x+=1){let M=n[(x-1+o)%o],p=n[x],y=n[(x+1)%o],v={x:M.x-p.x,y:M.y-p.y},S={x:y.x-p.x,y:y.y-p.y},C=Math.hypot(v.x,v.y),O=Math.hypot(S.x,S.y);if(C<=1e-9||O<=1e-9)continue;let I=Math.min(1,Math.max(-1,(v.x*S.x+v.y*S.y)/(C*O))),_=Math.acos(I)*180/Math.PI;if(_<a)continue;let k=Xe((_-a)/(180-a));u[x]=r*k*.5*Math.min(C,O)}for(let x=0;x<o;x+=1){let M=(x+1)%o,p=u[x]+u[M];if(p>c[x]&&p>1e-9){let y=c[x]/p;u[x]*=y,u[M]*=y}}let h=new Array(o),d=new Array(o);for(let x=0;x<o;x+=1){let M=n[(x-1+o)%o],p=n[x],y=n[(x+1)%o];if(u[x]<=1e-6){h[x]={...p},d[x]={...p};continue}let v=T(p,M)||1,S=T(p,y)||1;h[x]={x:p.x+(M.x-p.x)/v*u[x],y:p.y+(M.y-p.y)/v*u[x]},d[x]={x:p.x+(y.x-p.x)/S*u[x],y:p.y+(y.y-p.y)/S*u[x]}}if(u.every(x=>x<=1e-6)&&!m)return null;let b=[],f={...d[0]},g=f,w=(x,M)=>{if(T(g,x)<=1e-9)return;let p=l[M];Math.abs(p)>1e-6?b.push(Qt(g,x,p*$t*c[M])):b.push({kind:"line",end:{...x}}),g=x};for(let x=1;x<=o;x+=1){let M=x%o,p=n[M];w(h[M],(x-1)%o),u[M]>1e-6&&T(h[M],d[M])>1e-9&&(b.push({kind:"bezier",control1:L(h[M],p,Be),control2:L(d[M],p,Be),end:{...d[M]}}),g=d[M])}if(!b.length)return null;let E=b[b.length-1];T(E.end,f)>1e-9&&(E.kind==="line"?E.end={...f}:b.push({kind:"line",end:{...f}}));let P={version:1,closed:!0,start:f,segments:b};return ze(P)?P:null}function Lo(e){let t=[],n=e.start;for(let o of e.segments)t.push(n),n=o.end;let i=[];for(let o=e.segments.length-1;o>=0;o-=1){let r=e.segments[o],s=t[o];r.kind==="line"?i.push({kind:"line",end:{...s}}):r.kind==="arc"?i.push({kind:"arc",center:{...r.center},radius:r.radius,clockwise:!r.clockwise,end:{...s}}):i.push({kind:"bezier",control1:{...r.control2},control2:{...r.control1},end:{...s}})}return{version:1,closed:!0,start:{...e.start},segments:i}}function Do(e,t,n){let i=[];for(let o=0;o<e.length-1;o+=1){let r=e[o],s=e[o+1],l=Math.hypot(s.x-r.x,s.y-r.y);if(l<=0)continue;let m=Math.max(1,Math.round(l/n)),a=l/m,c=Math.atan2(s.y-r.y,s.x-r.x),u=o===0,d=(o>0?t[o-1]:void 0)==="break"?2:1,b=u?{...r}:{x:r.x+Math.cos(c)*a*d,y:r.y+Math.sin(c)*a*d},f=u?m+1:Math.max(1,m-(d-1));i.push({origin:b,rotation:c*180/Math.PI,seatCount:f,seatSpacing:a})}return i}function Vo(e){let t=e.rotation*Math.PI/180,n={x:Math.cos(t),y:Math.sin(t)};return Array.from({length:e.seatCount},(i,o)=>({x:e.origin.x+n.x*o*e.seatSpacing,y:e.origin.y+n.y*o*e.seatSpacing}))}function Ho(e){return e.reduce((t,n)=>t+n.seatCount,0)}function $e(e){let t=new Map,n=new Map;for(let i of e){if(i.type!=="row"||!i.segmentedRow)continue;let o=n.get(i.segmentedRow.groupId)??[];o.push(i),n.set(i.segmentedRow.groupId,o)}for(let[i,o]of n){let r=o.slice().sort((h,d)=>h.segmentedRow.componentIndex-d.segmentedRow.componentIndex),s=r[0]?.segmentedRow?.componentCount??0,l=r[0]?.segmentedRow;if(!l||!(s>=2&&r.length===s&&l?.boundaryBefore==="start"&&r.every((h,d)=>h.segmentedRow?.kind==="segmented-row-v1"&&h.segmentedRow.groupId===i&&h.segmentedRow.componentCount===s&&h.segmentedRow.componentIndex===d&&h.segmentedRow.repeatLabelOnComponents===l.repeatLabelOnComponents&&(d===0?h.segmentedRow.boundaryBefore==="start":h.segmentedRow.boundaryBefore!=="start")&&h.segmentedRow.displayLabel===l.displayLabel)))continue;let a=r.reduce((h,d)=>h+d.seatCount,0),c=0,u=0;for(let h of r)h.segmentedRow.boundaryBefore==="break"&&(c+=1),t.set(h.id,{groupId:i,adjacencyOffset:c,displayOffset:u,displayLabel:l.displayLabel,totalSeats:a,canonical:r[0],viewFromSeatUrl:l.viewFromSeatUrl,viewFromSeatMeta:l.viewFromSeatMeta,confidenceEvidence:l.confidenceEvidence}),c+=h.seatCount,u+=h.seatCount}return t}var q=.02291666666666667,Ko=1/q,Zt=58,en=Zt*q,qe=0,Je=3,Qe=0,pe=120,tn=0,nn=45,on=7,Q=1.2;function be(e,t,n,i){return Number.isFinite(e)?Math.max(t,Math.min(n,e)):i}function Go(e){return Number.isFinite(e)?Math.max(qe,Math.min(Je,Math.round(e))):qe}function rn(e){return!Number.isFinite(e)||!Number.isInteger(e)||e<0?0:e<=on?e:Je}function Ze(e,t={}){let n=be(t.floorBaseHeightM,Qe,pe,0),i=Math.min(pe,n+rn(e.elevation)*en),o=e.height===void 0?i:be(e.height,Qe,pe,i),r=be(e.rake,tn,nn,0);return{height:o,rake:r}}function et(e){let t=e.length;return t<=3?[...e]:[e[Math.floor(t*.25)],e[Math.floor(t*.5)],e[Math.floor(t*.75)]]}function tt(e,t,n){if(!e.length)return 1/0;if(e.length===1)return Math.hypot(t-e[0].x,n-e[0].y);let i=1/0;for(let o=0;o+1<e.length;o++){let r=e[o],s=e[o+1],l=s.x-r.x,m=s.y-r.y,a=l*l+m*m,c=a>1e-12?((t-r.x)*l+(n-r.y)*m)/a:0;c<0?c=0:c>1&&(c=1);let u=t-(r.x+c*l),h=n-(r.y+c*m);if(Math.abs(u)>=i||Math.abs(h)>=i)continue;let d=Math.hypot(u,h);d<i&&(i=d)}return i}function sn(e){let t=0,n=0;for(let r of e)t+=r.x,n+=r.y;let i=e.length||1;t/=i,n/=i;let o=0;for(let r of e){let s=Math.hypot(r.x-t,r.y-n);s>o&&(o=s)}return{cx:t,cy:n,r:o}}function nt(e,t){return Math.hypot(e.cx-t.cx,e.cy-t.cy)-e.r-t.r}function ye(e,t){let n=1/0;for(let i of et(e)){let o=tt(t,i.x,i.y);o<n&&(n=o)}for(let i of et(t)){let o=tt(e,i.x,i.y);o<n&&(n=o)}return n}function an(e,t){if(e.length<3)return{pts:e,seatIndices:t};let n=0,i=0;for(let c of e)n+=c.x,i+=c.y;n/=e.length,i/=e.length;let o=-1,r=e[0];for(let c of e){let u=Math.hypot(c.x-n,c.y-i);u>o&&(o=u,r=c)}let s=r.x-n,l=r.y-i,m=Math.hypot(s,l);m>1e-9?(s/=m,l/=m):(s=1,l=0);let a=e.map((c,u)=>({p:c,i:u,t:(c.x-n)*s+(c.y-i)*l})).sort((c,u)=>c.t-u.t);return{pts:a.map(c=>c.p),seatIndices:a.map(c=>t[c.i])}}function cn(e){let t=e.length;if(t<3)return null;let n=0,i=0;for(let E of e)n+=E.x,i+=E.y;n/=t,i/=t;let o=0,r=0,s=0,l=0,m=0,a=0,c=0;for(let E of e){let P=E.x-n,x=E.y-i;o+=P*P,s+=x*x,r+=P*x,l+=P*P*P,m+=x*x*x,a+=P*x*x,c+=x*P*P}let u=o*s-r*r;if(Math.abs(u)<1e-9)return null;let h=(l+a)/2,d=(m+c)/2,b=(h*s-d*r)/u,f=(d*o-h*r)/u,g=b+n,w=f+i;return!Number.isFinite(g)||!Number.isFinite(w)?null:{cx:g,cy:w}}var ln=.15;function un(e){if(e.length<2)return null;let t=e.map(M=>{let p=0,y=0;for(let v of M.pts)p+=v.x,y+=v.y;return{x:p/M.pts.length,y:y/M.pts.length}}),n=0,i=0;for(let M of t)n+=M.x,i+=M.y;n/=t.length,i/=t.length;let o=0,r=0,s=0;for(let M of t){let p=M.x-n,y=M.y-i;o+=p*p,r+=p*y,s+=y*y}let l=o+s,m=o*s-r*r,a=l/2+Math.sqrt(Math.max(0,l*l/4-m)),c,u;Math.abs(r)>1e-12?(c=a-s,u=r):o>=s?(c=1,u=0):(c=0,u=1);let h=Math.hypot(c,u);if(!(h>1e-12))return null;c/=h,u/=h;let d=0,b=0,f=0;for(let M of e){if(M.pts.length<2)continue;let p=M.pts[0],y=M.pts[M.pts.length-1],v=y.x-p.x,S=y.y-p.y,C=Math.hypot(v,S);if(!(C>1e-9))continue;let O=v/C,I=S/C;d+=(O*O-I*I)*C,b+=2*O*I*C,f+=C}if(f>0&&Math.hypot(d,b)>=fn*f){let M=Math.atan2(b,d)/2,p=Math.cos(M),y=Math.sin(M);Math.abs(c*p+u*y)>hn&&(c=-y,u=p)}let g=1/0,w=-1/0,E=[];for(let M of e){let p=1/0,y=-1/0;for(let v of M.pts){let S=v.x*c+v.y*u;S<p&&(p=S),S>y&&(y=S),S<g&&(g=S),S>w&&(w=S)}E.push(y-p)}let P=w-g;return P>1e-9?(E.sort((M,p)=>M-p),E[Math.min(E.length-1,Math.floor(E.length*.9))]/P<=dn?{x:c,y:u}:null):null}var dn=.35,fn=.8,hn=.7;function ot(e,t,n,i){let o=new Map;for(let p of n){let y=t[p],v=y.rowId||`__seat-${p}`,S=o.get(v);S||(S={pts:[],idx:[]},o.set(v,S)),S.pts.push({x:y.x,y:y.y}),S.idx.push(p)}if(!o.size)return{sectionId:e,rows:[],blockCount:0};let r=[];for(let[p,y]of o){let v=an(y.pts,y.idx),S=0;for(let C of v.pts)S+=Math.hypot(C.x-i.x,C.y-i.y);r.push({id:p,pts:v.pts,seatIndices:v.seatIndices,blockId:-1,ordinal:0,blockDepth:0,focalDistance:S/v.pts.length})}let s=r.map(p=>sn(p.pts)),l=r.length<=256?r.length*(r.length-1)/2:0,m=l?new Float64Array(l):null;m?.fill(Number.NaN);let a=m?new Map(r.map((p,y)=>[p,y])):null,c=(p,y)=>(p>y&&([p,y]=[y,p]),p*(2*r.length-p-1)/2+(y-p-1)),u=(p,y)=>{if(!m)return ye(r[p].pts,r[y].pts);let v=c(p,y),S=m[v];if(!Number.isNaN(S))return S;let C=ye(r[p].pts,r[y].pts);return m[v]=C,C},h=(p,y)=>a?u(a.get(p),a.get(y)):ye(p.pts,y.pts),d=[];for(let p=0;p<r.length;p++){let y=1/0;for(let v=0;v<r.length;v++){if(p===v||nt(s[p],s[v])>=y)continue;let S=u(p,v);S<y&&(y=S)}Number.isFinite(y)&&d.push(y)}d.sort((p,y)=>p-y);let b=d.length?d[Math.floor(d.length/2)]:1,f=Math.max(b*1.8,1e-6),g=r.map(()=>[]);for(let p=0;p<r.length;p++)for(let y=p+1;y<r.length;y++)nt(s[p],s[y])>f||u(p,y)<=f&&(g[p].push(y),g[y].push(p));let w=0;for(let p=0;p<r.length;p++){if(r[p].blockId!==-1)continue;let y=w++,v=[p];for(r[p].blockId=y;v.length;){let S=v.pop();for(let C of g[S])r[C].blockId===-1&&(r[C].blockId=y,v.push(C))}}let E=new Map;for(let p of r){let y=E.get(p.blockId)??[];y.push(p),E.set(p.blockId,y)}let P=[];for(let p of r){if(p.pts.length<4)continue;let y=cn(p.pts);y&&(!Number.isFinite(y.cx)||!Number.isFinite(y.cy)||P.push({x:y.cx,y:y.cy}))}let x=P.length>=2?(()=>{let p=P.map(S=>S.x).sort((S,C)=>S-C),y=P.map(S=>S.y).sort((S,C)=>S-C),v=Math.floor(P.length/2);return{cx:p[v],cy:y[v]}})():null;if(x){let p=I=>Math.hypot(I.x-x.cx,I.y-x.cy),y=1/0,v=-1/0,S=[];for(let I of r){let _=1/0,k=-1/0;for(let N of I.pts){let A=p(N);A<_&&(_=A),A>k&&(k=A)}S.push(k-_),_<y&&(y=_),k>v&&(v=k)}let C=v-y;S.sort((I,_)=>I-_);let O=S[Math.min(S.length-1,Math.floor(S.length*.9))];if(C>1e-9&&O/C<=ln){let I=r.map(R=>{let ne=0;for(let xt of R.pts)ne+=p(xt);return{row:R,radius:ne/R.pts.length}}),_=0,k=0;for(let R of I)_+=R.radius,k+=R.row.focalDistance;_/=I.length,k/=I.length;let N=0;for(let R of I)N+=(R.radius-_)*(R.row.focalDistance-k);if(N<0)for(let R of I)R.radius=-R.radius;let j=1/0;for(let R of I)R.radius<j&&(j=R.radius);I.sort((R,ne)=>R.radius-ne.radius);let V=-1,B=-1/0,gt=C/Math.max(1,I.length)*.5,Ee=[];for(let R of I)R.radius-B>gt&&(V++,B=R.radius),R.row.ordinal=V,R.row.blockDepth=R.radius-j,Ee.push(R.row);return{sectionId:e,rows:Ee,blockCount:w}}}let M=[];for(let[,p]of E){let y=un(p);if(y){let v=I=>{let _=0;for(let k of I.pts)_+=k.x*y.x+k.y*y.y;return _/I.pts.length};p.sort((I,_)=>v(I)-v(_)),p.length>=2&&p[0].focalDistance>p[p.length-1].focalDistance&&p.reverse();let S=[],C=b*.5;for(let I of p){let _=S[S.length-1];_&&Math.abs(v(I)-v(_[0]))<C?_.push(I):S.push([I])}let O=0;for(let I=0;I<S.length;I++){if(I>0){let _=1/0;for(let k of S[I-1])for(let N of S[I])_=Math.min(_,h(k,N));O+=_}for(let _ of S[I])_.ordinal=I,_.blockDepth=O,M.push(_)}}else{let v=1/0;for(let S of p)S.focalDistance<v&&(v=S.focalDistance);p.sort((S,C)=>S.focalDistance-C.focalDistance);for(let S=0;S<p.length;S++)p[S].ordinal=S,p[S].blockDepth=Math.max(0,p[S].focalDistance-v),M.push(p[S])}}return{sectionId:e,rows:M,blockCount:w}}var Yo=[{key:"rect",label:"Flat stage",blurb:"Classic proscenium box."},{key:"rounded",label:"Rounded",blurb:"Softened corners."},{key:"arc",label:"Curved front",blurb:"Front edge bows toward the audience."},{key:"thrust",label:"Thrust (T)",blurb:"Central tongue projects into the crowd."},{key:"runway",label:"Runway",blurb:"Long catwalk into the audience."},{key:"round",label:"In the round",blurb:"Central platform, audience all around."},{key:"pitch-football",label:"Football pitch",blurb:"105 \xD7 68 m pitch with centre circle and penalty boxes."},{key:"rink-hockey",label:"Hockey rink",blurb:"60 \xD7 30 m ice rink with blue lines and faceoff circles."},{key:"track-athletics",label:"Athletics track",blurb:"400 m track: two straights, two semicircles, eight lanes."},{key:"oval-cricket",label:"Cricket oval",blurb:"~150 \xD7 140 m oval with boundary rope and pitch strip."},{key:"pitch-rugby",label:"Rugby pitch",blurb:"100 \xD7 70 m field of play with in-goal areas, 22 m and 10 m lines."},{key:"diamond-baseball",label:"Baseball field",blurb:"Diamond, infield, mound and foul lines out to 99 m poles."},{key:"court-basketball",label:"Basketball court",blurb:"28 \xD7 15 m court with keys and three-point lines."},{key:"court-tennis",label:"Tennis court",blurb:"23.77 \xD7 10.97 m doubles court with run-off and net."},{key:"ring-boxing",label:"Boxing ring",blurb:"Raised ring, 6.1 m inside the ropes, coloured corners."}],mn=new Set(["pitch-football","rink-hockey","track-athletics","oval-cricket","pitch-rugby","diamond-baseball","court-basketball","court-tennis","ring-boxing"]),pn=new Set(["pitch-football","track-athletics","oval-cricket","pitch-rugby","diamond-baseball"]);function bn(e){return!!e&&mn.has(e)}function zo(e){return!!e&&pn.has(e)}var it=1.1,yn={"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}},gn={"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 rt=Math.PI*2;function st(e,t,n,i,o,r){return{x:o+e*n-t*i,y:r+e*i+t*n}}function Wo(e){let{kind:t,cx:n,cy:i,width:o,height:r}=e,s=(e.rotation??0)*Math.PI/180,l=Math.cos(s),m=Math.sin(s),a=o/2,c=r/2,u=[],h=(d,b)=>{u.push({x:d,y:b})};switch(t){case"rect":{h(-a,-c),h(a,-c),h(a,c),h(-a,c);break}case"rounded":{let d=Math.min(o,r)*.18,b=5,f=(g,w,E)=>{for(let P=0;P<=b;P++){let x=E+P/b*(Math.PI/2);h(g+d*Math.cos(x),w+d*Math.sin(x))}};f(a-d,-c+d,-Math.PI/2),f(a-d,c-d,0),f(-a+d,c-d,Math.PI/2),f(-a+d,-c+d,Math.PI);break}case"arc":{let d=r*.45;h(-a,-c),h(a,-c);let b=24;for(let f=0;f<=b;f++){let g=f/b,w=a-g*o,E=c+d*(1-Math.pow(2*w/o,2));h(w,E)}break}case"thrust":{let d=o*.18,b=r*1.1;h(-a,-c),h(a,-c),h(a,c),h(d,c),h(d,c+b),h(-d,c+b),h(-d,c),h(-a,c);break}case"runway":{let d=o*.1,b=r*3;h(-a,-c),h(a,-c),h(a,c),h(d,c),h(d,c+b),h(-d,c+b),h(-d,c),h(-a,c);break}case"round":case"oval-cricket":{for(let b=0;b<40;b++){let f=b/40*rt;h(a*Math.cos(f),c*Math.sin(f))}break}case"pitch-football":case"pitch-rugby":case"court-basketball":case"court-tennis":case"ring-boxing":{h(-a,-c),h(a,-c),h(a,c),h(-a,c);break}case"diamond-baseball":{for(let d of Mn(a,c))h(d.x,d.y);break}case"rink-hockey":{for(let d of xn(a,c,a*(8.5/60),c*(8.5/30)))h(d.x,d.y);break}case"track-athletics":{for(let d of ge(a,c))h(d.x,d.y);break}}return u.map(d=>st(d.x,d.y,l,m,n,i))}function xn(e,t,n,i){let o=[],s=(l,m,a)=>{for(let c=0;c<=8;c++){let u=a+c/8*(Math.PI/2);o.push({x:l+n*Math.cos(u),y:m+i*Math.sin(u)})}};return s(e-n,-t+i,-Math.PI/2),s(e-n,t-i,0),s(-e+n,t-i,Math.PI/2),s(-e+n,-t+i,Math.PI),o}function ge(e,t){let n=Math.max(0,e-t),i=[],o=20;for(let r=0;r<=o;r++){let s=-Math.PI/2+r/o*Math.PI;i.push({x:n+t*Math.cos(s),y:t*Math.sin(s)})}for(let r=0;r<=o;r++){let s=Math.PI/2+r/o*Math.PI;i.push({x:-n+t*Math.cos(s),y:t*Math.sin(s)})}return i}var X=(()=>{let t={x:0,y:52},n=25,i={x:70,y:t.y-70},o=(i.x*i.x+i.y*i.y-4900)/(2*(i.y+70)),r=o+70,s=[],l=Math.atan2(i.y-o,i.x),m=Math.atan2(i.y-o,-i.x);for(let a=0;a<=24;a++){let c=l+(m-l)*a/24;s.push({x:r*Math.cos(c),y:o+r*Math.sin(c)})}return{half:70,home:t,backstop:n,fence:s}})();function Mn(e,t){let n=e/X.half,i=t/X.half;return[{x:-X.backstop*n,y:t},{x:X.backstop*n,y:t},...X.fence.map(o=>({x:o.x*n,y:o.y*i}))]}var Sn="#f1f5f9";function xe(e){return bn(e)}function G(e,t,n,i,o=32){let r=[];for(let s=0;s<o;s++){let l=s/o*rt;r.push({x:e+n*Math.cos(l),y:t+i*Math.sin(l)})}return r}function U(e,t,n,i){return[{x:e-n,y:t-i},{x:e+n,y:t-i},{x:e+n,y:t+i},{x:e-n,y:t+i}]}function vn(e){let{kind:t,cx:n,cy:i,width:o,height:r}=e,s=(e.rotation??0)*Math.PI/180,l=Math.cos(s),m=Math.sin(s),a=o/2,c=r/2,u=[],h=yn[t],d=f=>h?f/h.width*o:0,b=f=>h?f/h.height*r:0;switch(t){case"pitch-football":{u.push({points:[{x:0,y:-c},{x:0,y:c}],closed:!1}),u.push({points:G(0,0,d(9.15),b(9.15)),closed:!0});for(let f of[-1,1])u.push({points:U(f*(a-d(16.5)/2),0,d(16.5)/2,b(40.32)/2),closed:!0}),u.push({points:U(f*(a-d(5.5)/2),0,d(5.5)/2,b(18.32)/2),closed:!0});break}case"rink-hockey":{u.push({points:[{x:0,y:-c},{x:0,y:c}],closed:!1,ink:"#d63b3b"});for(let f of[-1,1]){u.push({points:[{x:f*d(7.5),y:-c},{x:f*d(7.5),y:c}],closed:!1,ink:"#2f6ecb"}),u.push({points:[{x:f*(a-d(4)),y:-b(11)},{x:f*(a-d(4)),y:b(11)}],closed:!1,ink:"#d63b3b"});for(let g of[-1,1])u.push({points:G(f*d(20.5),g*b(7),d(4.5),b(4.5)),closed:!0,ink:"#2f6ecb"})}u.push({points:G(0,0,d(4.5),b(4.5)),closed:!0,ink:"#2f6ecb"});break}case"track-athletics":{let g=c-b(1.22)*8;g>0&&u.push({points:ge(a-d(1.22)*8,g),closed:!0,fill:"#2f7d4f"});for(let w=1;w<8;w++){let E=b(1.22)*w,P=c-E;if(P<=0)break;u.push({points:ge(a-d(1.22)*w,P),closed:!0})}break}case"oval-cricket":{u.push({points:G(0,0,d(27.4),b(27.4+20.12/2),40),closed:!0}),u.push({points:U(0,0,d(3.05)/2,b(20.12)/2),closed:!0,ink:"#d8cfae"});break}case"pitch-rugby":{let f=g=>({points:[{x:d(g),y:-c},{x:d(g),y:c}],closed:!1});u.push(f(0));for(let g of[-1,1]){u.push(f(g*50),f(g*28));for(let w=-35;w<35;w+=4)u.push({points:[{x:d(g*10),y:b(w)},{x:d(g*10),y:b(Math.min(35,w+2))}],closed:!1})}break}case"diamond-baseball":{let f=(A,j)=>({x:d(A),y:b(j)}),{home:g}=X,w=27.43,E=w/Math.SQRT2,P={x:g.x+E,y:g.y-E},x={x:g.x,y:g.y-2*E},M={x:g.x-E,y:g.y-E},p={x:g.x,y:g.y-18.44},y="#b98a59",v=gn["diamond-baseball"],S=38.94,C=[f(g.x,g.y)],O=Math.atan2(g.y-S/Math.SQRT2-p.y,S/Math.SQRT2),I=Math.PI-O;for(let A=0;A<=16;A++){let j=O-(O+Math.PI*2-I)%(Math.PI*2)*(A/16);C.push(f(p.x+29*Math.cos(j),p.y+29*Math.sin(j)))}u.push({points:C,closed:!0,fill:y,ink:y});let _={x:g.x,y:g.y-E},k=[{x:g.x,y:g.y},P,x,M].map(A=>f(_.x+(A.x-_.x)*.84,_.y+(A.y-_.y)*.84));u.push({points:k,closed:!0,fill:v,ink:v}),u.push({points:G(d(p.x),b(p.y),d(2.74),b(2.74),20),closed:!0,fill:y,ink:y}),u.push({points:G(d(g.x),b(g.y),d(3.96),b(3.96),20),closed:!0,fill:y,ink:y});let N=X.fence;u.push({points:[f(g.x,g.y),f(N[0].x,N[0].y)],closed:!1}),u.push({points:[f(g.x,g.y),f(N[N.length-1].x,N[N.length-1].y)],closed:!1});for(let A of[P,x,M])u.push({points:U(d(A.x),b(A.y),d(.3),b(.3)),closed:!0,fill:Sn});break}case"court-basketball":{u.push({points:U(0,0,d(14),b(7.5)),closed:!0}),u.push({points:[{x:0,y:-b(7.5)},{x:0,y:b(7.5)}],closed:!1}),u.push({points:G(0,0,d(1.8),b(1.8),24),closed:!0});for(let f of[-1,1]){let g=f*14,w=f*(14-5.8),E=f*(14-1.575);u.push({points:U(d((g+w)/2),0,d(2.9),b(2.45)),closed:!0,fill:"#2f5d8a"}),u.push({points:G(d(w),0,d(1.8),b(1.8),24),closed:!0});let P=Math.sqrt(6.75*6.75-6.6*6.6),x=[{x:d(g),y:-b(6.6)}],M=Math.atan2(-6.6,-f*P),p=2*Math.atan2(6.6,P);for(let y=0;y<=16;y++){let v=M-f*p*(y/16);x.push({x:d(E+6.75*Math.cos(v)),y:b(6.75*Math.sin(v))})}x.push({x:d(g),y:b(6.6)}),u.push({points:x,closed:!1})}break}case"court-tennis":{u.push({points:U(0,0,d(11.885),b(5.485)),closed:!0,fill:"#2b5f99"});for(let f of[-1,1])u.push({points:[{x:-d(11.885),y:f*b(4.115)},{x:d(11.885),y:f*b(4.115)}],closed:!1}),u.push({points:[{x:f*d(6.4),y:-b(4.115)},{x:f*d(6.4),y:b(4.115)}],closed:!1});u.push({points:[{x:-d(6.4),y:0},{x:d(6.4),y:0}],closed:!1}),u.push({points:[{x:0,y:-b(6.4)},{x:0,y:b(6.4)}],closed:!1,ink:"#d1d5db"});break}case"ring-boxing":{u.push({points:U(0,0,d(3.05),b(3.05)),closed:!0});let w=[[-1,-1,"#c53030"],[1,1,"#2b6cb0"],[1,-1,"#e2e8f0"],[-1,1,"#e2e8f0"]];for(let[E,P,x]of w)u.push({points:U(E*d(3.05),P*b(3.05),d(.3),b(.3)),closed:!0,fill:x,ink:x});break}default:return[]}return u.map(f=>({...f,points:f.points.map(g=>st(g.x,g.y,l,m,n,i))}))}function $o(e){if(e.role!=="stage"||!xe(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(c=>c.x),i=e.points.map(c=>c.y),o=Math.min(...n),r=Math.max(...n),s=Math.min(...i),l=Math.max(...i),m=Math.max(1,r-o),a=Math.max(1,l-s);t={cx:o+m/2,cy:s+a/2,width:m,height:a}}return t?vn({kind:e.stageKind,...t}):[]}function wn(e){if((e.kind==="polygon"||e.kind==="polyline"||e.kind==="line")&&e.points&&e.points.length>=2)return e.points;if(e.x==null||e.y==null||e.width==null||e.height==null)return null;let t=e.x,n=e.y,i=e.width,o=e.height;return[{x:t,y:n},{x:t+i,y:n},{x:t+i,y:n+o},{x:t,y:n+o}]}function En(e,t,n){let i=n*Math.PI/180,o=Math.cos(i),r=Math.sin(i),s=e.x-t.x,l=e.y-t.y;return{x:t.x+s*o-l*r,y:t.y+s*r+l*o}}function at(e){let t=wn(e);if(!t||t.length<2)return null;let n=e.rotation??0,i=Math.abs(n)<1e-6?t:t.map(m=>En(m,{x:t.reduce((a,c)=>a+c.x,0)/t.length,y:t.reduce((a,c)=>a+c.y,0)/t.length},n)),o=1/0,r=1/0,s=-1/0,l=-1/0;for(let m of i)o=Math.min(o,m.x),r=Math.min(r,m.y),s=Math.max(s,m.x),l=Math.max(l,m.y);return!Number.isFinite(o)||s-o<1e-6||l-r<1e-6?null:{minX:o,minY:r,maxX:s,maxY:l}}var In=5,Pn=3,Cn=.92,_n=1.9,kn=2,Rn=.6,Tn=1,On=.06;function An(e){return e.heightM!==void 0?e.heightM:e.stageKind==="ring-boxing"?it:xe(e.stageKind)?On:Tn}function ct(e){let t=1/0,n=1/0,i=-1/0,o=-1/0,r=-1/0;for(let s of Me(e)){let l=s.baseHeightM??0;for(let m of s.objects){if(m.type!=="shape"||m.role!=="stage")continue;let a=at(m);a&&(t=Math.min(t,a.minX),n=Math.min(n,a.minY),i=Math.max(i,a.maxX),o=Math.max(o,a.maxY),r=Math.max(r,l+An(m)))}}return!Number.isFinite(t)||!Number.isFinite(r)?null:{minX:t,minY:n,maxX:i,maxY:o,deckTopM:r}}function Nn(e,t,n,i){let o=1/0,r=1/0,s=-1/0,l=-1/0;for(let d of e)Number.isFinite(d.eyeHeightM)&&(o=Math.min(o,d.x),s=Math.max(s,d.x),r=Math.min(r,d.y),l=Math.max(l,d.y));if(!Number.isFinite(o))return null;let m=o*t,a=r*t,c=Math.max(1,Math.ceil((s-o)*t/n)+1),u=Math.max(1,Math.ceil((l-r)*t/n)+1),h=new Float64Array(c*u).fill(-1/0);for(let d of e){if(!Number.isFinite(d.eyeHeightM))continue;let b=d.eyeHeightM-Q,f=Math.min(c-1,Math.max(0,Math.floor((d.x*t-m)/n))),w=Math.min(u-1,Math.max(0,Math.floor((d.y*t-a)/n)))*c+f,E=b+i;E>h[w]&&(h[w]=E)}return{cellM:n,minX:m,minY:a,cols:c,rows:u,top:h}}function jn(e,t,n){let i=Math.floor((t-e.minX)/e.cellM),o=Math.floor((n-e.minY)/e.cellM);return i<0||o<0||i>=e.cols||o>=e.rows?-1/0:e.top[o*e.cols+i]}function lt(e,t,n={}){let i=new Map;if(!t||!e.length)return i;let o=n.metresPerChartUnit??q,r=n.cellM??Rn,s=n.chairBackM??Cn,l=n.selfRowSkipM??kn,m=n.clearThreshold??.9,a=n.partialThreshold??.25,c=Math.max(1,n.columns??In),u=Math.max(1,n.rows??Pn),h=Nn(e,o,r,s);if(!h)return i;let d=(t.maxX-t.minX)*o,b=(t.maxY-t.minY)*o,f=d>=b,g=(t.minX+t.maxX)/2*o,w=(t.minY+t.maxY)/2*o,E=[];for(let x=0;x<c;x++){let M=(x+.5)/c-.5,p=f?g+M*d:g,y=f?w:w+M*b;for(let v=0;v<u;v++){let S=t.deckTopM+(u===1?0:v/(u-1)*_n);E.push({x:p,y,z:S})}}let P=r/2;for(let x of e){if(!Number.isFinite(x.eyeHeightM))continue;let M=x.x*o,p=x.y*o,y=x.eyeHeightM,v=0,S=1/0;for(let O of E){let I=O.x-M,_=O.y-p,k=Math.hypot(I,_);if(!(k>l)){v++;continue}let N=I/k,A=_/k,j=0;for(let V=l;V<k;V+=P){let B=jn(h,M+N*V,p+A*V);if(!(!Number.isFinite(B)||B>=y)&&B>y+(O.z-y)*V/k){j=V;break}}j?S=Math.min(S,j):v++}let C=v/E.length;C>=m||i.set(x.id,{seatId:x.id,mark:C<a?"obstructedView":"restrictedView",visibleFraction:C,totalRays:E.length,atDistanceM:Number.isFinite(S)?S:0})}return i}function ut(e,t){if(!t.size)return 0;let n=0;for(let i of e){let o=t.get(i.id);if(!o)continue;let r=i.commercial;r?.restrictedView!==void 0||r?.obstructedView!==void 0||(i.commercial={...r,[o.mark]:!0},n++)}return n}function Se(e){return e?e.accessibility?.length?e.wheelchairSpaceType&&!e.accessibility.includes("wheelchair")?["wheelchair",...e.accessibility]:e.accessibility:e.wheelchairSpaceType?["wheelchair"]:e.accessible?["wheelchair"]:[]:[]}var se=Math.PI/180,Ln=9,J=16;function ve(e,t,n,i){let o=n*se,r=Math.cos(o),s=Math.sin(o);return{x:i.x+e*r-t*s,y:i.y+e*s+t*r}}function we(e){let{seatCount:t,seatSpacing:n,curve:i,rotation:o,origin:r}=e,s=[];if(e.path)return Fe(e.path,t);if(t<=1)return t===1&&s.push({x:r.x,y:r.y}),s;if(i===0){for(let a=0;a<t;a++)s.push(ve(a*n,0,o,r));return s}let l=i/(t-1)*se,m=n/(2*Math.sin(Math.abs(l)/2));for(let a=0;a<t;a++){let c=a*l,u=m*Math.sin(c),h=-m+m*Math.cos(c);s.push(ve(u,h,o,r))}return s}function pt(e){let t=new Map;if(e.overrides)for(let n of e.overrides)t.set(n.index,n);return t}function yi(e){let t=new Set((e.overrides??[]).filter(n=>n.skip&&Number.isInteger(n.index)&&n.index>=0&&n.index<e.seatCount).map(n=>n.index));return Math.max(0,e.seatCount-t.size)}function Fn(e,t){let n=pt(e);return we(e).map((i,o)=>{let r=n.get(o),s=Se(r),l=Ie(e,o,r),m={...e.commercial,...r?.commercial};return{index:o,x:i.x+(r?.dx??0),y:i.y+(r?.dy??0),label:l,displayLabel:ce(e,o,t,r),categoryKey:r?.categoryKey??e.categoryKey,skipped:!!r?.skip,accessible:s.length>0,accessibility:s,wheelchairSpaceType:r?.wheelchairSpaceType,commercial:Object.values(m).some(a=>a!==void 0&&a!==!1&&a!=="")?m:void 0,glyph:r?.glyph,viewUrl:r?.viewFromSeatUrl??e.viewFromSeatUrl,viewMeta:r?.viewFromSeatUrl?r.viewFromSeatMeta:e.viewFromSeatMeta,labelStyle:r?.labelStyle??e.seatLabelStyle}})}function Dn(e){let t=[];for(let n of Fn(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 Vn(e){if(e.seatCountsBySide)return{...e.seatCountsBySide};let t=e.sides&&e.sides.length?e.sides:["top","bottom"],n=["top","bottom","left","right"].filter(r=>t.includes(r)),i={top:0,bottom:0,left:0,right:0};if(!n.length)return i;let o=Math.max(0,Math.round(e.seatCount));for(let r=0;r<o;r++)i[n[r%n.length]]+=1;return i}function bt(e){let t=[],n=Math.max(0,Math.round(e.seatCount));if(n===0)return t;let i=new Map((e.overrides??[]).map(c=>[c.index,c])),o=(c,u,h,d)=>{let b=i.get(c),f=Se(b),g=b?.label??`${e.label}-${c+1}`,w=e.displayLabel??e.label;return{index:c,label:g,displayLabel:b?.displayLabel??`${w}-${c+1}`,x:u+(b?.dx??0),y:h+(b?.dy??0),categoryKey:b?.categoryKey??e.categoryKey,skipped:!!b?.skip,accessible:f.length>0,accessibility:f,wheelchairSpaceType:b?.wheelchairSpaceType,commercial:b?.commercial,glyph:b?.glyph,viewUrl:b?.viewFromSeatUrl,viewMeta:b?.viewFromSeatUrl?b.viewFromSeatMeta:void 0,labelStyle:b?.labelStyle,...d?{side:d}:{}}};if(e.shape==="round"){let c=(e.radius??40)+J,u=e.rotation*se,h=Math.max(0,Math.min(360,e.seatArc??360));if(h>=360||n===1){for(let g=0;g<n;g++){let w=u+g/n*2*Math.PI;t.push(o(g,e.center.x+c*Math.cos(w),e.center.y+c*Math.sin(w)))}return t}let d=h*se,b=(2*Math.PI-d)/2,f=u+b;for(let g=0;g<n;g++){let w=f+g/(n-1)*d;t.push(o(g,e.center.x+c*Math.cos(w),e.center.y+c*Math.sin(w)))}return t}let r=e.width??80,s=e.height??50,l=Vn(e),m=["top","bottom","left","right"],a=0;for(let c of m){let u=l[c];for(let h=0;h<u;h++){let d,b;c==="top"?(d=-r/2+(h+.5)*r/u,b=-s/2-J):c==="bottom"?(d=-r/2+(h+.5)*r/u,b=s/2+J):c==="left"?(d=-r/2-J,b=-s/2+(h+.5)*s/u):(d=r/2+J,b=-s/2+(h+.5)*s/u);let f=ve(d,b,e.rotation,e.center);t.push(o(a++,f.x,f.y,c))}}return t}function gi(e){return e.bookAsWhole||e.variableOccupancy?Math.max(0,Math.round(e.seatCount)):bt(e).filter(t=>!t.skipped).length}function Hn(e){return bt(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 Un(e){return[{id:`${e.id}:0`,label:e.label,...e.displayLabel&&e.displayLabel!==e.label?{displayLabel:e.displayLabel}:{},x:e.center.x,y:e.center.y,rowId:e.id,categoryKey:e.categoryKey,kind:"booth"}]}function dt(e,t){let n=!1;for(let i=0,o=t.length-1;i<t.length;o=i++){let r=t[i].x,s=t[i].y,l=t[o].x,m=t[o].y;s>e.y!=m>e.y&&e.x<(l-r)*(e.y-s)/(m-s)+r&&(n=!n)}return n}function Kn(e,t){return t.some((n,i)=>{let o=t[(i+1)%t.length],r=(e.y-n.y)*(o.x-n.x)-(e.x-n.x)*(o.y-n.y);if(Math.abs(r)>1e-7)return!1;let s=(e.x-n.x)*(o.x-n.x)+(e.y-n.y)*(o.y-n.y),l=(o.x-n.x)**2+(o.y-n.y)**2;return s>=-1e-7&&s<=l+1e-7})}function te(e){return Array.isArray(e)?e.filter(t=>Array.isArray(t)&&t.length>=3):[]}function ae(e,t,n){return dt(e,t)&&!te(n).some(i=>dt(e,i)||Kn(e,i))}function xi(e,t){return Ge(e,t).point}function re(e){if(!e.length)return{x:0,y:0};let t=0,n=0;for(let i of e)t+=i.x,n+=i.y;return{x:t/e.length,y:n/e.length}}function yt(e){switch(e.type){case"row":{let t=we(e),n=pt(e),i=0,o=0,r=0;for(let s=0;s<t.length;s++){let l=n.get(s);l?.skip||(i+=t[s].x+(l?.dx??0),o+=t[s].y+(l?.dy??0),r++)}return r?{x:i/r,y:o/r}:{x:e.origin.x,y:e.origin.y}}case"table":case"booth":return{x:e.center.x,y:e.center.y};case"gaArea":return re(e.points);case"section":return re(e.outline);case"text":return{x:e.position.x,y:e.position.y};case"shape":return e.points&&e.points.length?re(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 ft(e,t){return e.length===t.length&&e.every((n,i)=>n.x===t[i].x&&n.y===t[i].y)}function Gn(e,t){if(e.type!=="gaArea"||!ft(e.points,t.outline))return!1;let n=te(e.holes),i=te(t.holes);return n.length===i.length&&n.every((o,r)=>ft(o,i[r]))}function Xn(e,t,n=e.filter(o=>o.type==="section"),i=yt(t)){let o="referenceInventorySource"in t?t.referenceInventorySource?.logicalSectionId:void 0;return(o?n.find(s=>(s.logicalSectionId??s.id)===o&&(Gn(t,s)||ae(i,s.outline,s.holes))):void 0)??n.find(s=>ae(i,s.outline,s.holes))}function Me(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 Mi(e,t){let n=Me(e);return(t?n.find(i=>i.id===t):n[0])?.objects??[]}function Bn(e){return e.floors&&e.floors.length?e.floors.flatMap(t=>t.objects):e.objects}function Yn(e,t,n){let i=r=>({x:r.x+t,y:r.y+n}),o=r=>r.map(i);switch(e.type){case"row":return{...e,origin:i(e.origin)};case"table":case"booth":return{...e,center:i(e.center)};case"gaArea":return{...e,points:o(e.points),...e.holes?{holes:te(e.holes).map(o)}:{}};case"section":return{...e,outline:o(e.outline),...e.outlinePath?{outlinePath:We(e.outlinePath,t,n)}:{},...e.holes?{holes:te(e.holes).map(o)}:{}};case"text":return{...e,position:i(e.position)};case"shape":return{...e,...e.points?{points:o(e.points)}:{},...e.x!=null?{x:e.x+t}:{},...e.y!=null?{y:e.y+n}:{}};case"decorImage":return{...e,x:e.x+t,y:e.y+n}}}function Si(e,t=900){if(!e.floors||e.floors.length<2)return e;let n=[];return e.floors.forEach((i,o)=>{let r=-o*t;for(let s of i.objects)n.push(r===0?s:Yn(s,0,r))}),{...e,objects:n,floors:void 0}}function ht(e,t,n,i,o,r,s,l,m){let a=[],c=e.filter(f=>f.type==="section"),u=$e(e),h=f=>!f?.eventConfigurationId||f.eventConfigurationId===i&&(f.eventConfigurationVersion===void 0||f.eventConfigurationVersion===m),d=f=>Pe(f,{activeConfigurationId:i,activeConfigurationVersion:m,activeBasisSha256:o,now:l}),b=(f,g)=>d(f)?{...f,coverage:g}:void 0;for(let f of e){let g=[];if(f.type==="row"?g=Dn(f):f.type==="table"?g=Hn(f):f.type==="booth"&&(g=Un(f)),!g.length)continue;for(let M of g)M.viewUrl&&!h(M.viewMeta)&&(M.viewUrl=void 0,M.viewMeta=void 0);if(f.type==="row"){let M=u.get(f.id);if(M){let p=new Map((f.overrides??[]).map(y=>[y.index,y]));for(let y of g){let v=Number(y.id.slice(y.id.lastIndexOf(":")+1));if(!Number.isInteger(v))continue;y.logicalRowId=M.groupId,y.logicalSeatIndex=M.adjacencyOffset+v,p.get(v)?.displayLabel||(y.displayLabel=ce(f,v,M)),!y.viewUrl&&M.viewFromSeatUrl&&h(M.viewFromSeatMeta)&&(y.viewUrl=M.viewFromSeatUrl,y.viewMeta=M.viewFromSeatMeta);let S=p.get(v)?.confidenceEvidence;y.confidenceEvidence=b(S,"exact-seat")??b(f.confidenceEvidence,"row-representative")??b(M.confidenceEvidence,"row-representative")}}}let w=Xn(e,f,c,f.type==="row"?re(g):yt(f)),E=w?.viewFromSeatUrl,x=(w?.zone?t?.find(M=>M.id===w.zone):void 0)?.focalPoint??n;for(let M of g){if(!M.confidenceEvidence){let p=Number(M.id.slice(M.id.lastIndexOf(":")+1)),y=(f.type==="row"||f.type==="table")&&Number.isInteger(p)?f.overrides?.find(v=>v.index===p)?.confidenceEvidence:void 0;M.confidenceEvidence=b(y,"exact-seat")??(f.type==="row"?b(f.confidenceEvidence,"row-representative"):void 0)}M.confidenceEvidence??=b(w?.confidenceEvidence,"section-representative")??(s?b(s.evidence,s.coverage):void 0),!M.viewUrl&&E&&h(w?.viewFromSeatMeta)&&(M.viewUrl=E,M.viewMeta=w?.viewFromSeatMeta),!M.viewUrl&&r&&h(r.meta)&&(M.viewUrl=r.url,M.viewMeta=r.meta),w&&(M.sectionId=w.logicalSectionId??w.id),w?.zone&&(M.zoneId=w.zone),x&&(M.focalPoint={...x})}a.push(...g)}return a}function vi(e,t={}){if(e.floors?.length){let i=[];for(let o of e.floors){let r=o.focalPoint??e.focalPoint,s=o.viewFromSeatUrl?{url:o.viewFromSeatUrl,meta:o.viewFromSeatMeta}:e.viewFromSeatUrl?{url:e.viewFromSeatUrl,meta:e.viewFromSeatMeta}:void 0,l=o.confidenceEvidence?{evidence:o.confidenceEvidence,coverage:"floor-representative"}:e.confidenceEvidence?{evidence:e.confidenceEvidence,coverage:"venue-representative"}:void 0,m=ht(o.objects,e.zones,r,e.eventConfigurationId,e.confidenceBasisSha256,s,l,t.now,t.eventConfigurationVersion??e.eventConfigurationVersion);t.resolveEyeHeights!==!1&&mt(o.objects,o.focalPoint??e.focalPoint,o.baseHeightM??0,m);for(let a of m)a.floorId=o.id;for(let a of m)i.push(a)}return i}let n=ht(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&&mt(e.objects,e.focalPoint,t.floorBaseHeightM??0,n),zn(e,n,t)}function zn(e,t,n){return!n.deriveRestrictedView||e.derivedRestrictedView===!1||n.resolveEyeHeights===!1||ut(t,lt(t,ct(e))),t}function mt(e,t,n,i){let o=e.filter(u=>u.type==="section"),r=n>0||o.some(u=>u.height!==void 0||u.rake!==void 0||(u.elevation??0)>0);if(!o.length||!r||!t){for(let u of i)u.eyeHeightM=n+Q;return}let s=new Array(i.length),l=new Map;for(let u of o)l.has(u.id)||l.set(u.id,u);let m=new Map,a=new Map;for(let u=0;u<i.length;u++){let h=i[u],b=(h.sectionId?l.get(h.sectionId)??o.find(g=>g.logicalSectionId===h.sectionId&&ae({x:h.x,y:h.y},g.outline,g.holes)):void 0)??o.find(g=>ae({x:h.x,y:h.y},g.outline,g.holes))??null;if(s[u]=b,!b)continue;m.has(b.id)||m.set(b.id,Ze(b,{floorBaseHeightM:n}));let f=a.get(b.id);f?f.push(u):a.set(b.id,[u])}let c=new Array(i.length).fill(void 0);for(let[u,h]of a){let d=m.get(u);if(!d)continue;let b=d.rake>0?Math.tan(d.rake*Math.PI/180):0,f=ot(u,i,h,t);for(let g of f.rows){let w=g.blockDepth*q*b,E=d.height+w;for(let P of g.seatIndices)c[P]=E}}for(let u=0;u<i.length;u++){let h=i[u],d=s[u];if(!d){h.eyeHeightM=n+Q;continue}let b=m.get(d.id);h.eyeHeightM=(c[u]??b.height)+Q}}var ie=40;function wi(e,t){let n=t?.freeText==="exclude",i=1/0,o=1/0,r=-1/0,s=-1/0,l=(a,c)=>{a<i&&(i=a),c<o&&(o=c),a>r&&(r=a),c>s&&(s=c)},m=a=>{if(Array.isArray(a))for(let c of a)!c||typeof c!="object"||l(c.x,c.y)};for(let a of Bn(e))if(a.type==="row"){let c=new Map((a.overrides??[]).map(u=>[u.index,u]));we(a).forEach((u,h)=>{let d=c.get(h);d?.skip||l(u.x+(d?.dx??0),u.y+(d?.dy??0))})}else if(a.type==="gaArea")m(a.points);else if(a.type==="section")m(a.outline);else if(a.type==="decorImage")l(a.x,a.y),l(a.x+a.width,a.y+a.height);else if(a.type==="shape")a.points&&a.points.length?m(a.points):a.x!=null&&a.y!=null&&a.width!=null&&a.height!=null&&(l(a.x,a.y),l(a.x+a.width,a.y+a.height));else if(a.type==="table"){let c=J+Ln,u=a.shape==="round"?(a.radius??40)+c:Math.max((a.width??80)/2,(a.height??50)/2)+c;l(a.center.x-u,a.center.y-u),l(a.center.x+u,a.center.y+u)}else if(a.type==="booth"){let c=Math.max(a.width,a.height)/2;l(a.center.x-c,a.center.y-c),l(a.center.x+c,a.center.y+c)}else if(a.type==="text"){if(n)continue;let c=Ne(a);l(a.position.x,a.position.y),l(a.position.x+c.width,a.position.y+c.height)}for(let a of[e.referenceImage,e.backgroundImage]){if(!a)continue;let{center:c,width:u}=a;if(!c||!Number.isFinite(c.x)||!Number.isFinite(c.y)||!Number.isFinite(u))continue;let h=u*3/4;l(c.x-u/2,c.y-h/2),l(c.x+u/2,c.y+h/2)}if(!isFinite(i)){let a=e.focalPoint??{x:0,y:0};return{x:a.x-200,y:a.y-200,width:400,height:400}}return{x:i-ie,y:o-ie,width:r-i+ie*2,height:s-o+ie*2}}export{Wn as a,vt as b,Ce as c,wt as d,qn as e,Et as f,Qn as g,Z as h,le as i,eo as j,to as k,no as l,oo as m,io as n,ro as o,so as p,co as q,lo as r,uo as s,fo as t,ho as u,mo as v,po as w,bo as x,yo as y,Ne as z,xo as A,Lt as B,Mo as C,fe as D,wo as E,Fe as F,Eo as G,Io as H,Dt as I,Ue as J,Co as K,Ge as L,Ht as M,ko as N,Ao as O,ze as P,No as Q,We as R,Xt as S,Bt as T,zt as U,jo as V,$t as W,Jt as X,Lo as Y,Do as Z,Vo as _,Ho as $,$e as aa,q as ba,Ko as ca,en as da,qe as ea,Je as fa,Qe as ga,pe as ha,tn as ia,nn as ja,on as ka,Q as la,Go as ma,Ze as na,tt as oa,cn as pa,ot as qa,Yo as ra,bn as sa,zo as ta,it as ua,Wo as va,Sn as wa,xe as xa,$o as ya,Se as za,J as Aa,we as Ba,yi as Ca,Fn as Da,Dn as Ea,Vn as Fa,bt as Ga,gi as Ha,Hn as Ia,Un as Ja,dt as Ka,te as La,ae as Ma,xi as Na,yt as Oa,Xn as Pa,Me as Qa,Mi as Ra,Bn as Sa,Yn as Ta,Si as Ua,vi as Va,wi as Wa};