@seatlayer/core 0.110.0 → 0.111.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ar-IOQUWTKM.js +1 -0
- package/dist/be-XLR5WTXS.js +1 -0
- package/dist/bg-AVCWLASZ.js +1 -0
- package/dist/ca-TKG35ICB.js +1 -0
- package/dist/{categoryInventory-BfvwE3nC.d.cts → categoryInventory-BE1AThTx.d.cts} +1 -1
- package/dist/{categoryInventory-ClZ-68jI.d.ts → categoryInventory-DxciZQK_.d.ts} +1 -1
- package/dist/{chunk-ZYQXT5JP.js → chunk-5FIX35HN.js} +1 -1
- package/dist/{chunk-2JFCDE27.js → chunk-5GHPGPWE.js} +1 -1
- package/dist/{chunk-MRLWH6RC.js → chunk-AZWAP4OE.js} +1 -1
- package/dist/chunk-BXQQKDIX.js +1 -0
- package/dist/{chunk-OJSGMXJS.js → chunk-FZ74MVKY.js} +1 -1
- package/dist/chunk-JQBJZMLG.js +1 -0
- package/dist/{chunk-UUIZHJYL.js → chunk-MN4M5QZ4.js} +1 -1
- package/dist/chunk-N6K5NQYG.js +1 -0
- package/dist/{chunk-6VOUTNRV.js → chunk-NQLQNJV2.js} +1 -1
- package/dist/{chunk-BNLANXXZ.js → chunk-NXS6JFBI.js} +1 -1
- package/dist/{chunk-WUNZCUE6.js → chunk-XWTAFHYQ.js} +1 -1
- package/dist/{chunk-FBXZWNND.js → chunk-Z6YGWTT3.js} +1 -1
- package/dist/core/chart-ops/index.cjs +1 -1
- package/dist/core/chart-ops/index.d.cts +7 -5
- package/dist/core/chart-ops/index.d.ts +7 -5
- package/dist/core/chart-ops/index.js +1 -1
- package/dist/core/inventory/index.cjs +1 -1
- package/dist/core/inventory/index.d.cts +4 -4
- package/dist/core/inventory/index.d.ts +4 -4
- package/dist/core/inventory/index.js +1 -1
- package/dist/core/layout/index.cjs +1 -1
- package/dist/core/layout/index.d.cts +5 -5
- package/dist/core/layout/index.d.ts +5 -5
- package/dist/core/layout/index.js +1 -1
- package/dist/core/quality/index.cjs +1 -1
- package/dist/core/quality/index.d.cts +3 -3
- package/dist/core/quality/index.d.ts +3 -3
- package/dist/core/render-assets/index.cjs +1 -1
- package/dist/core/render-assets/index.d.cts +2 -2
- package/dist/core/render-assets/index.d.ts +2 -2
- package/dist/core/render-assets/index.js +1 -1
- package/dist/core/seatConfidence.d.cts +1 -1
- package/dist/core/seatConfidence.d.ts +1 -1
- package/dist/core/sections/index.d.cts +5 -5
- package/dist/core/sections/index.d.ts +5 -5
- package/dist/core/sections/index.js +1 -1
- package/dist/cs-JRLKXXM5.js +1 -0
- package/dist/cy-W3CYXTOV.js +1 -0
- package/dist/da-HG4PFYWH.js +1 -0
- package/dist/de-KOM2AXXJ.js +1 -0
- package/dist/el-NBRQ66EQ.js +1 -0
- package/dist/es-AVEG4ZNM.js +1 -0
- package/dist/et-33PIOTI4.js +1 -0
- package/dist/{eventConfigurations-DsW5Mj2e.d.ts → eventConfigurations-Cdt-e0uD.d.ts} +1 -1
- package/dist/{eventConfigurations-dmn9FClw.d.cts → eventConfigurations-D0us5j0K.d.cts} +1 -1
- package/dist/fa-CDV2VTXV.js +1 -0
- package/dist/fi-TKATIOE6.js +1 -0
- package/dist/fr-TMDNSR5N.js +1 -0
- package/dist/he-4G7OVLJX.js +1 -0
- package/dist/hi-XKXNYPYF.js +1 -0
- package/dist/hr-BX444QNM.js +1 -0
- package/dist/hu-FM46JMDP.js +1 -0
- package/dist/id-CBVTYGFP.js +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +46 -38
- package/dist/index.d.ts +46 -38
- package/dist/index.js +1 -1
- package/dist/it-ZOFOAG6E.js +1 -0
- package/dist/ja-NKEBMXTO.js +1 -0
- package/dist/ko-RUCELYV7.js +1 -0
- package/dist/ku-KKYBDVSA.js +1 -0
- package/dist/{labeling-Bn41ByDd.d.ts → labeling-DXgkxMoi.d.ts} +1 -1
- package/dist/{labeling-BmEjVxFt.d.cts → labeling-eYKVPLMb.d.cts} +1 -1
- package/dist/localeLoaders-YQXZZVNH.js +1 -0
- package/dist/lt-3CJ37W7A.js +1 -0
- package/dist/lv-H37RDMRX.js +1 -0
- package/dist/ms-E5RVBRE6.js +1 -0
- package/dist/nl-QHEOTQ7U.js +1 -0
- package/dist/no-43HJQ5MK.js +1 -0
- package/dist/pl-4LKJHMFJ.js +1 -0
- package/dist/pt-LSSE5QHE.js +1 -0
- package/dist/{renderedQuality-MDkNe8GA.d.ts → renderedQuality-Dzo2_8f4.d.ts} +1 -1
- package/dist/{renderedQuality-Bt2d0uq1.d.cts → renderedQuality-Frgw6jdx.d.cts} +1 -1
- package/dist/{renderer-DH0yI32q.d.cts → renderer-DM2sv1un.d.cts} +1 -1
- package/dist/{renderer-BJrpMV6U.d.ts → renderer-DuieD7jP.d.ts} +1 -1
- package/dist/ro-U2QASPIY.js +1 -0
- package/dist/ru-PTMWREXY.js +1 -0
- package/dist/{seatTypeIcons-CG_Uzpaw.d.ts → seatTypeIcons-Bz0OJtEi.d.ts} +1 -1
- package/dist/{seatTypeIcons-Ck7oEFei.d.cts → seatTypeIcons-Cm8tjLYl.d.cts} +1 -1
- package/dist/{sections-C-UAqr1x.d.ts → sections-Bf_DV0oG.d.ts} +1 -1
- package/dist/{sections-C8HApYxd.d.cts → sections-PbQiqN0i.d.cts} +1 -1
- package/dist/{segmentedRowModel-DR1w9M13.d.ts → segmentedRowModel-CO7DD803.d.ts} +1 -1
- package/dist/{segmentedRowModel-CeoMsBnt.d.cts → segmentedRowModel-Co9LqS4i.d.cts} +1 -1
- package/dist/sk-AY2N2ORA.js +1 -0
- package/dist/sl-5MQJVNB7.js +1 -0
- package/dist/sr-25FTJPUA.js +1 -0
- package/dist/{stage-CKb7aNoH.d.cts → stage-BtqKu5aX.d.cts} +1 -1
- package/dist/{stage-CKb7aNoH.d.ts → stage-BtqKu5aX.d.ts} +1 -1
- package/dist/sv-7VQX4BFH.js +1 -0
- package/dist/{tableSizing-RRmpxOXl.d.ts → tableSizing-BDePQyPD.d.ts} +3 -3
- package/dist/{tableSizing-Bz-hxLza.d.cts → tableSizing-C6EjKNnk.d.cts} +3 -3
- package/dist/th-E53HQMDC.js +1 -0
- package/dist/{ticketRestrictions-lq4dH4k6.d.cts → ticketRestrictions-CgYwHQOf.d.cts} +2 -2
- package/dist/{ticketRestrictions-C7KUrulv.d.ts → ticketRestrictions-D5wgOq4P.d.ts} +2 -2
- package/dist/tr-IIR6E7OD.js +1 -0
- package/dist/{types-DM-OneoD.d.ts → types-CGOr0BpE.d.cts} +40 -16
- package/dist/{types-DM-OneoD.d.cts → types-CGOr0BpE.d.ts} +40 -16
- package/dist/uk-HBINQ4XE.js +1 -0
- package/dist/vi-TX6I5RWN.js +1 -0
- package/dist/view3d/crossfade/panorama.d.cts +1 -1
- package/dist/view3d/crossfade/panorama.d.ts +1 -1
- package/dist/view3d/index.cjs +531 -172
- package/dist/view3d/index.d.cts +350 -73
- package/dist/view3d/index.d.ts +350 -73
- package/dist/view3d/index.js +529 -170
- package/dist/view3d/scene/scene.worker.cjs +1 -1
- package/dist/view3d/scene/scene.worker.js +1 -1
- package/dist/zh-Hans-7QNBTEYC.js +1 -0
- package/dist/zh-Hant-6KK3D42X.js +1 -0
- package/package.json +1 -1
- package/dist/ar-O3RHQRH3.js +0 -1
- package/dist/be-SXFCG3F5.js +0 -1
- package/dist/bg-W7YBNYB2.js +0 -1
- package/dist/ca-FA7WHACR.js +0 -1
- package/dist/chunk-4N5CHKHD.js +0 -1
- package/dist/chunk-4QQG5EEP.js +0 -1
- package/dist/chunk-YE4NP3XB.js +0 -1
- package/dist/cs-RR3VIKRC.js +0 -1
- package/dist/cy-U4JJ5C47.js +0 -1
- package/dist/da-ATULGB2M.js +0 -1
- package/dist/de-VB543CPC.js +0 -1
- package/dist/el-7Y2KXU6N.js +0 -1
- package/dist/es-GUV5XIYC.js +0 -1
- package/dist/et-SZ6I4Z44.js +0 -1
- package/dist/fa-FM6ELEN7.js +0 -1
- package/dist/fi-6QQ2M5JI.js +0 -1
- package/dist/fr-2SEQSVLR.js +0 -1
- package/dist/he-V3EVB7IW.js +0 -1
- package/dist/hi-I4QIBK5Q.js +0 -1
- package/dist/hr-I5DNEVUU.js +0 -1
- package/dist/hu-KTFWBQMF.js +0 -1
- package/dist/id-RZWUH426.js +0 -1
- package/dist/it-CNQP36V4.js +0 -1
- package/dist/ja-JQZOYIHI.js +0 -1
- package/dist/ko-6YCWWHFQ.js +0 -1
- package/dist/ku-33PM4OWG.js +0 -1
- package/dist/localeLoaders-VFQOZMUH.js +0 -1
- package/dist/lt-24JO2B7V.js +0 -1
- package/dist/lv-HTSDEEAB.js +0 -1
- package/dist/ms-PUEZJJ3R.js +0 -1
- package/dist/nl-NQPDRSCW.js +0 -1
- package/dist/no-3N3MUMSA.js +0 -1
- package/dist/pl-YHBEO6ZF.js +0 -1
- package/dist/pt-5RPESNZB.js +0 -1
- package/dist/ro-XDFXIMHX.js +0 -1
- package/dist/ru-BIIALOM5.js +0 -1
- package/dist/sk-LHSFRUFT.js +0 -1
- package/dist/sl-MPE5TPI3.js +0 -1
- package/dist/sr-T3N67KTP.js +0 -1
- package/dist/sv-LJWWYUIY.js +0 -1
- package/dist/th-E5POGG37.js +0 -1
- package/dist/tr-2DCWQ2CY.js +0 -1
- package/dist/uk-C3VJP6EA.js +0 -1
- package/dist/vi-XVMTKCOL.js +0 -1
- package/dist/zh-Hans-RG4CQGBY.js +0 -1
- package/dist/zh-Hant-YHNTYPFS.js +0 -1
package/dist/chunk-4QQG5EEP.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as lo,c as uo,d as fo}from"./chunk-2JFCDE27.js";import{b as Qe,c as oo,d as so,e as ao,h as co}from"./chunk-PBXGWYB4.js";import{a as $t,w as mo}from"./chunk-6VOUTNRV.js";import{a as ro,c as qt,d as pt,f as xt,i as io}from"./chunk-FBXZWNND.js";import{e as no,l as eo}from"./chunk-4N5CHKHD.js";import{n as re}from"./chunk-GUNNA5LB.js";import{h as In}from"./chunk-URW7MSCJ.js";import{Aa as Zt,Ba as En,C as ze,Ca as qe,D as Kt,Ga as oe,Ia as $e,Xa as St,ca as Ke,da as Ve,eb as wn,j as Ye,ka as $,la as Rt,ua as _n,va as Vt,wa as An,ya as Ze}from"./chunk-YE4NP3XB.js";import{A as Et,D as to,b as Je,d as it,y as at}from"./chunk-JBOTRSMY.js";var ie=t=>t<=.04045?t/12.92:((t+.055)/1.055)**2.4,se=t=>t<=.0031308?12.92*t:1.055*Math.max(0,t)**.4166666666666667-.055,ae=t=>Math.min(1,Math.max(0,t));function Tn(t){let n=ie(t[0]),e=ie(t[1]),r=ie(t[2]),o=Math.cbrt(.4122214708*n+.5363325363*e+.0514459929*r),a=Math.cbrt(.2119034982*n+.6806995451*e+.1073969566*r),i=Math.cbrt(.0883024619*n+.2817188376*e+.6299787005*r);return[.2104542553*o+.793617785*a-.0040720468*i,1.9779984951*o-2.428592205*a+.4505937099*i,.0259040371*o+.7827717662*a-.808675766*i]}function Bn([t,n,e]){let r=(t+.3963377774*n+.2158037573*e)**3,o=(t-.1055613458*n-.0638541728*e)**3,a=(t-.0894841775*n-1.291485548*e)**3;return[ae(se(4.0767416621*r-3.3077115913*o+.2309699292*a)),ae(se(-1.2684380046*r+2.6097574011*o-.3413193965*a)),ae(se(-.0041960863*r-.7034186147*o+1.707614701*a))]}var On=t=>Tn(t)[0];function cn(t){let[,n,e]=Tn(t);return Math.hypot(n,e)}function Xt(t,n,e){let[,r,o]=Tn(t);if(e===void 0)return Bn([n,r,o]);let a=Math.hypot(r,o),i=a===0?0:e/a;return Bn([n,r*i,o*i])}function ho(t,n,e){let[r,o,a]=Tn(t);return r>=n&&r<=e?t:Bn([Math.min(e,Math.max(n,r)),o,a])}function Cn(t){return Bn([t,-.004,-.008])}var ln=["available","held","sold","selected","dimmed"];function ce(t){let n=ln.indexOf(t);return n<0?0:n}var po={available:[.24,.82,.52],held:[.34,.39,.45],sold:[.34,.39,.45],selected:[.24,.74,1],dimmed:[.28,.32,.37]};function Ri(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 yo={day:{ground:.9,deck:.84,fascia:.77,shell:.79,seatMin:.45,seatMax:.58,unavailable:.58,dimmed:.62,sectionDeck:.66,sectionDeckChromaShare:.8,sectionDeckChromaCap:.11,stageTop:.52,stageWall:.42},night:{ground:.26,deck:.34,fascia:.28,shell:.32,seatMin:.64,seatMax:.8,unavailable:.42,dimmed:.39,sectionDeck:.34,sectionDeckChromaShare:.45,sectionDeckChromaCap:.05,stageTop:0,stageWall:0}},kn=.012;function Fn(t){return On(t.tierTop)>.6}function jt(t){return t?yo.day:yo.night}function eu(t,n){let e=jt(n);return ho(Ri(t),e.seatMin,e.seatMax)}var le={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]},ue={top:[.05,.06,.08],bottom:[.1,.12,.15]};function V(t,n){return[Math.min(1,t[0]*n),Math.min(1,t[1]*n),Math.min(1,t[2]*n)]}import Si from"earcut";import bo from"polygon-clipping";var S=$,Pi=.002;function Ii(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<Pi}var Ut=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)}},Nn=class{constructor(){this.pos=new Ut;this.nor=new Ut;this.col=new Ut;this.flr=new Ut;this.mat=new Ut;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){Ii(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,c=s,l=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(c[0],c[1],c[2]),this.col.push3(l[0],l[1],l[2]),this.flr.push1(this.currentFloor),this.flr.push1(this.currentFloor),this.flr.push1(this.currentFloor),this.mat.push1(this.currentMaterial),this.mat.push1(this.currentMaterial),this.mat.push1(this.currentMaterial))}get vertexCount(){return this.pos.length/3}build(){return{position:this.pos.toArray(),normal:this.nor.toArray(),color:this.col.toArray(),floor:this.flr.toArray(),material:this.mat.toArray(),count:this.pos.length/3}}};function _i(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],c=e[2]-t[2],l=o*c-a*s,u=a*i-r*c,f=r*s-o*i,m=Math.hypot(l,u,f)||1;return l/=m,u/=m,f/=m,[l,u,f]}function Ai(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=Si(r,o.length?o:void 0,2);return{pts:e,tris:a}}function wt(t){return pt(t)<0?[...t].reverse():t}var Ei=3;function wi(t,n,e,r){let o=r(t),a=r(n),i=r(e),s=(h,d,y,b)=>Math.abs(r({x:(h.x+d.x)/2,y:(h.y+d.y)/2})-(y+b)/2),c=(t.x+n.x+e.x)/3,l=(t.y+n.y+e.y)/3,u=(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:c,y:l})-u)),m=(h,d,y)=>{let b=Math.abs(r({x:(h+c)/2,y:(d+l)/2})-(y+u)/2);b>f&&(f=b)};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 un(t,n,e,r,o){if(o<=0)return wi(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(un(t,a,s,r,o-1),un(a,n,i,r,o-1),un(s,i,e,r,o-1),un(a,i,s,r,o-1))}function fn(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},h={x:(e.x+r.x)/2,y:(e.y+r.y)/2},d={x:(r.x+n.x)/2,y:(r.y+n.y)/2};fn(t,n,m,d,o,a,i-1,s),fn(t,m,e,h,o,a,i-1,s),fn(t,d,h,r,o,a,i-1,s),fn(t,m,h,d,o,a,i-1,s);return}let c=[n.x*S,o(n),n.y*S],l=[e.x*S,o(e),e.y*S],u=[r.x*S,o(r),r.y*S];if(s){t.triN(c,l,u,s(n),s(e),s(r),a);return}let f=_i(c,l,u);f[1]<0&&(f=[-f[0],-f[1],-f[2]]),t.tri(c,l,u,f,a)}var Bi=8;function xo(t,n,e){if(!Number.isFinite(e))return t;let r=[],o=(a,i,s,c,l)=>{if(l>0){let u={x:(a.x+i.x)/2,y:(a.y+i.y)/2},f=n(u);if(Math.abs(f-(s+c)/2)>e){o(a,u,s,f,l-1),o(u,i,f,c,l-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),Bi)}return r}function Ln(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],c=s.x-a.x,l=s.y-a.y,u=Math.hypot(c,l);u>n&&Math.abs((i.x-a.x)*l-(i.y-a.y)*c)/u<n||r.push(i)}return r.length>=3?r:e}var vn=.001*Rt*.1;function Z(t,n,e,r,o,a,i,s,c=1/0,l){if(!n||n.length<3||(c===void 0&&(c=1/0),Math.abs(pt(n))<1e-4))return;let u=Ln(xo(Ln(wt(n),vn),r,c),vn),f=e?.map(x=>Ln(xo(Ln(wt(x),vn),r,c),vn)).filter(x=>x.length>=3&&Math.abs(pt(x))>=1e-4),{pts:m,tris:h}=Ai(u,f),d=[a[0]*s.top,a[1]*s.top,a[2]*s.top],y=[a[0]*s.bottomCap,a[1]*s.bottomCap,a[2]*s.bottomCap],b=[i[0]*s.top,i[1]*s.top,i[2]*s.top],p=[i[0]*s.wallBottom,i[1]*s.wallBottom,i[2]*s.wallBottom],g=0;if(Number.isFinite(c))for(;g<Ei;g++){let x=0;for(let I=0;I<h.length;I+=3){let P=un(m[h[I]],m[h[I+1]],m[h[I+2]],r,g);P>x&&(x=P)}if(x<=c)break}for(let x=0;x<h.length;x+=3){let I=m[h[x]],P=m[h[x+1]],_=m[h[x+2]];fn(t,I,P,_,r,d,g,l);let O=[I.x*S,o,I.y*S],C=[P.x*S,o,P.y*S],F=[_.x*S,o,_.y*S];t.tri(O,F,C,[0,-1,0],y)}let R=x=>{if(g<=0)return x;let I=1<<g,P=[];for(let _=0;_<x.length;_++){let O=x[_],C=x[(_+1)%x.length];for(let F=0;F<I;F++){let k=F/I;P.push({x:O.x+(C.x-O.x)*k,y:O.y+(C.y-O.y)*k})}}return P},A=ze(u),M=[{ring:R(u),flip:!1}];if(f)for(let x of f)x.length>=3&&M.push({ring:R(x),flip:!0});for(let{ring:x,flip:I}of M)for(let P=0;P<x.length;P++){let _=x[P],O=x[(P+1)%x.length],C=(O.x-_.x)*S,k=(O.y-_.y)*S,E=-C,w=Math.hypot(k,E)||1;k/=w,E/=w;let B=(_.x+O.x)/2-A.x,L=(_.y+O.y)/2-A.y,T=k*B+E*L;I&&(T=-T),T<0&&(k=-k,E=-E);let v=[k,0,E],H=[_.x*S,r(_),_.y*S],j=[O.x*S,r(O),O.y*S],D=[_.x*S,o,_.y*S],U=[O.x*S,o,O.y*S];t.tri(H,j,U,v,b,b,p),t.tri(H,U,D,v,b,p,p)}}function go(t){let n=0;for(let c of t)n+=c.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 c of t)e.set(c.position,s*3),r.set(c.normal,s*3),o.set(c.color,s*3),a.set(c.floor,s),i.set(c.material,s),s+=c.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=wt(t),o=r.length,a=[];for(let s=0;s<o;s++){let c=r[s],l=r[(s+1)%o],u=l.x-c.x,f=l.y-c.y,m=Math.hypot(u,f)||1;a.push({x:f/m,y:-u/m})}let i=[];for(let s=0;s<o;s++){let c=r[s],l=a[(s-1+o)%o],u=a[s],f=l.x+u.x,m=l.y+u.y,h=Math.hypot(f,m),d=()=>{i.push([c.x+l.x*n,c.y+l.y*n]),i.push([c.x+u.x*n,c.y+u.y*n])};if(h<1e-9){d();continue}f/=h,m/=h;let y=f*l.x+m*l.y,b=1/Math.max(y,1e-6);if(!Number.isFinite(b)||b>e){d();continue}i.push([c.x+f*n*b,c.y+m*n*b])}if(i.length<3)return t;try{let s=bo.union([[...i,i[0]]]),c=null,l=-1/0;for(let f of s){let m=Math.abs(pt(f[0].map(([h,d])=>({x:h,y:d}))));m>l&&(l=m,c=f[0])}if(!c)return t;let u=c.map(([f,m])=>({x:f,y:m}));if(u.length>1){let f=u[0],m=u[u.length-1];Math.abs(f.x-m.x)<1e-9&&Math.abs(f.y-m.y)<1e-9&&u.pop()}return u.length>=3?u:t}catch{return t}}function Lt(t,n,e=2.5){if(t.length<3)return[];if(n<=0)return t;let r=wt(t),o=r.length,a=[];for(let c=0;c<o;c++){let l=r[c],u=r[(c+1)%o],f=Math.hypot(u.x-l.x,u.y-l.y)||1;a.push({x:-(u.y-l.y)/f,y:(u.x-l.x)/f})}let i=[],s=[];for(let c=0;c<o;c++){let l=r[c],u=a[(c-1+o)%o],f=a[c],m=u.x+f.x,h=u.y+f.y,d=Math.hypot(m,h),y=d<1e-9?1/0:1/Math.max(m/d*u.x+h/d*u.y,1e-6);if(!Number.isFinite(y)||y>e){i.push({x:l.x+u.x*n,y:l.y+u.y*n},{x:l.x+f.x*n,y:l.y+f.y*n}),s.push(c,c);continue}m/=d,h/=d,i.push({x:l.x+m*n*y,y:l.y+h*n*y}),s.push(c)}for(let c=0;c<i.length;c++){let l=(c+1)%i.length,u=s[c],f=s[l];if(f!==(u+1)%o)continue;let m=r[u],h=r[f];if((i[l].x-i[c].x)*(h.x-m.x)+(i[l].y-i[c].y)*(h.y-m.y)<=0)return[]}try{let c=bo.intersection([[...i.map(d=>[d.x,d.y]),[i[0].x,i[0].y]]],[[...r.map(d=>[d.x,d.y]),[r[0].x,r[0].y]]]),l=null,u=0;for(let d of c){let y=Math.abs(pt(d[0].map(([b,p])=>({x:b,y:p}))));y>u&&(u=y,l=d[0])}if(!l)return[];let f=l.map(([d,y])=>({x:d,y})),m=f[0],h=f[f.length-1];return f.length>1&&Math.abs(m.x-h.x)<1e-9&&Math.abs(m.y-h.y)<1e-9&&f.pop(),f.length>=3?wt(f):[]}catch{return[]}}function Gn(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 mn(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 ut={pedestal:0,pad:1,back:2,arm:3,footrest:4,leg:5,body:10,head:11},Ti=.44,Oi=.15,Ci=.3,ki=.24;function Ro(t){return t===void 0||!Number.isFinite(t)||t<=0?ki:Math.min(Ci,Math.max(Oi,t*Ti))}var uu=.21,Fi=.05,fe=.45,Li=fe+Fi,vi=.92,Mo=.66,Ni=1.205,Gi=-.23,Di=.38,Hi=[{part:ut.pedestal,min:[-.3,0,-.3],max:[.3,.36,.3]},{part:ut.pad,min:[-1,.36,-.95],max:[1,fe,1]},{part:ut.back,min:[-1,Li,-1],max:[1,vi,-.72]},{part:ut.arm,min:[-1,.44,-.82],max:[-.78,.65,.78]},{part:ut.arm,min:[.78,.44,-.82],max:[1,.65,.78]},{part:ut.footrest,min:[-.9,.18,.78],max:[.9,.31,1.34]},{part:ut.leg,min:[-.82,0,-.7],max:[-.62,.37,-.48]},{part:ut.leg,min:[.62,0,-.7],max:[.82,.37,-.48]},{part:ut.leg,min:[-.82,0,.48],max:[-.62,.37,.7]},{part:ut.leg,min:[.62,0,.48],max:[.82,.37,.7]}],Xi=[{part:ut.body,min:[-.52,.39,-.08],max:[-.08,.55,.82]},{part:ut.body,min:[.08,.39,-.08],max:[.52,.55,.82]},{part:ut.body,min:[-.47,.05,.58],max:[-.13,.43,.82]},{part:ut.body,min:[.13,.05,.58],max:[.47,.43,.82]},{part:ut.head,min:[-.16,1.04,-.33],max:[.16,1.1,-.13]}],ji=[{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 fu(){let t=[],n=[],e=[],r=[],o=(D,U,X)=>{let Y=e.length,[nt,rt,q]=D,Q=[rt[0]-nt[0],rt[1]-nt[1],rt[2]-nt[2]],J=[q[0]-nt[0],q[1]-nt[1],q[2]-nt[2]],N=Q[1]*J[2]-Q[2]*J[1],G=Q[2]*J[0]-Q[0]*J[2],W=Q[0]*J[1]-Q[1]*J[0],lt=Math.hypot(N,G,W);lt>1e-9?(N/=lt,G/=lt,W/=lt):[N,G,W]=U,N*U[0]+G*U[1]+W*U[2]<0&&(N=-N,G=-G,W=-W);for(let ft of D)t.push(...ft),n.push(N,G,W),e.push(X);r.push(Y,Y+1,Y+2,Y,Y+2,Y+3)},a=D=>{for(let U of ji){let X=U.c.map(Y=>Y.map((nt,rt)=>nt?D.max[rt]:D.min[rt]));o(X,U.n,D.part)}},i=(D,U)=>{let[X,Y,nt]=U?[0,1,2]:[0,2,1],rt=D.min[X],q=D.max[X],Q=D.min[Y],J=D.max[Y],N=(q-rt)*.1,G=(J-Q)*.1,W=U?[[rt+N,Q],[q-N,Q],[q,Q+G],[q*.94,J-(J-Q)*.23],[q*Mo,J],[rt*Mo,J],[rt*.94,J-(J-Q)*.23],[rt,Q+G]]:[[rt+N,Q],[q-N,Q],[q,Q+G],[q,J-G],[q-N,J],[rt+N,J],[rt,J-G],[rt,Q+G]],lt=(st,tt,et)=>{let ht=[0,0,0];return ht[X]=st,ht[Y]=tt,ht[nt]=et,ht},ft=[D.min[nt],D.max[nt]].map(st=>W.map(([tt,et])=>lt(tt,et,st)));for(let st=0;st<W.length;st++){let tt=(st+1)%W.length,et=[0,0,0];et[X]=(W[st][0]+W[tt][0])/2-(rt+q)/2,et[Y]=(W[st][1]+W[tt][1])/2-(Q+J)/2,o([ft[0][st],ft[0][tt],ft[1][tt],ft[1][st]],et,D.part)}for(let st=0;st<2;st++){let tt=[0,0,0];tt[nt]=st?1:-1;let et=ft[st];for(let ht=1;ht<et.length-1;ht++){let z=e.length;for(let mt of[et[0],et[ht],et[ht+1]])t.push(...mt),n.push(...tt),e.push(D.part);r.push(z,z+1,z+2)}}};for(let D of Hi)D.part===ut.pad||D.part===ut.back?i(D,D.part===ut.back):a(D);for(let D of Xi)a(D);let s=fe,c=1.08,l=.47,u=.69,f=-.55,m=.08,h=-.48,d=.01,y=[-l,s,f],b=[l,s,f],p=[-l,s,m],g=[l,s,m],R=[-u,c,h],A=[u,c,h],M=[-u,c,d],x=[u,c,d];o([b,A,x,g],[1,0,0],ut.body),o([p,M,R,y],[-1,0,0],ut.body),o([y,b,g,p],[0,-1,0],ut.body);let I=c+.07,P=.24,_=[-P,I,h],O=[P,I,h],C=[-P,I,d],F=[P,I,d];o([M,C,_,R],[-.5,1,0],ut.body),o([C,F,O,_],[0,1,0],ut.body),o([F,x,A,O],[.5,1,0],ut.body),o([g,x,M,p],[0,0,1],ut.body),o([x,F,C,M],[0,0,1],ut.body),o([y,R,A,b],[0,0,-1],ut.body),o([R,_,O,A],[0,0,-1],ut.body);let k=10,E=8,w=[0,Ni,Gi],B=[.32,.115,Di],L=e.length;for(let D=0;D<=E;D++){let U=Math.PI*D/E,X=Math.cos(U),Y=Math.sin(U);for(let nt=0;nt<=k;nt++){let rt=Math.PI*2*nt/k,q=Y*Math.cos(rt),Q=Y*Math.sin(rt);t.push(w[0]+B[0]*q,w[1]+B[1]*X,w[2]+B[2]*Q);let J=q/B[0],N=X/B[1],G=Q/B[2],W=Math.hypot(J,N,G)||1;J/=W,N/=W,G/=W,n.push(J,N,G),e.push(ut.head)}}for(let D=0;D<E;D++)for(let U=0;U<k;U++){let X=L+D*(k+1)+U,Y=X+k+1;r.push(X,Y,X+1,X+1,Y,Y+1)}let T=new Float32Array(t),v=new Float32Array(n),H=new Float32Array(e),j=new Uint16Array(r);return{position:T,normal:v,part:H,index:j,vertexCount:e.length,indexCount:r.length}}function So(t,n,e,r){let o=new Float32Array(n),a=l=>t[l*3],i=l=>t[l*3+2],s=0,c=(l,u)=>{let f=u-l;for(let m=l;m<u;m++){let[h,d]=r(m),y=h-a(m),b=d-i(m);if(f>=2){let p=Math.max(l,m-1),g=Math.min(u-1,m+1),R=a(g)-a(p),A=i(g)-i(p),M=Math.hypot(R,A);if(M>1e-6){let x=-A/M,I=R/M;x*y+I*b<0&&(x=-x,I=-I),y=x,b=I}}o[m]=y===0&&b===0?0:Math.atan2(y,b)}};for(let l=1;l<=n;l++)(l===n||e(l)!==e(s))&&(c(s,l),s=l);return o}var Dn=.22;function Mu(t,n){let e=ln[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 Ui=.42;function Wi(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 d of t)d.x<r&&(r=d.x),d.y<o&&(o=d.y),d.x>a&&(a=d.x),d.y>i&&(i=d.y);let s=Math.max(a-r,1e-6),c=Math.max(i-o,1e-6),l=Math.max(Math.sqrt(s*c/n),1e-6),u=Math.max(1,Math.ceil(s/l)+1),f=Math.max(1,Math.ceil(c/l)+1),m=new Map,h=(d,y)=>{let b=Math.min(u-1,Math.max(0,Math.floor((d-r)/l)));return Math.min(f-1,Math.max(0,Math.floor((y-o)/l)))*u+b};for(let d=0;d<n;d++){let y=h(t[d].x,t[d].y),b=m.get(y);b?b.push(d):m.set(y,[d])}for(let d=0;d<n;d++){let y=t[d],b=Math.min(u-1,Math.max(0,Math.floor((y.x-r)/l))),p=Math.min(f-1,Math.max(0,Math.floor((y.y-o)/l))),g=1/0;for(let R=1;R<=4;R++){for(let A=p-R;A<=p+R;A++)if(!(A<0||A>=f))for(let M=b-R;M<=b+R;M++){if(M<0||M>=u||R>1&&Math.abs(A-p)<R&&Math.abs(M-b)<R)continue;let x=m.get(A*u+M);if(x)for(let I of x){if(I===d)continue;let P=Math.hypot(t[I].x-y.x,t[I].y-y.y);P<g&&(g=P)}}if(Number.isFinite(g)&&g<=R*l)break}e[d]=g}return e}function Yi(t){let n=t.eyeHeightM;return Number.isFinite(n)?Math.max(0,n-_n):0}function Po(t,n,e,r,o,a){let i=t.length,s=new Float32Array(i*3),c=new Float32Array(i),l=new Float32Array(i*3),u=new Float32Array(i),f=new Float32Array(i),m=new Float32Array(i),h=new Float32Array(i),d=new Float32Array(i*3),y=new Map,b=Wi(t);for(let p=0;p<i;p++){let g=t[p],A=(e?.seatPitchU(p)??b[p])*S;u[p]=Number.isFinite(A)?Math.max(.06,Math.min(Dn,A*Ui)):Dn,f[p]=Ro(Number.isFinite(A)?A:void 0);let M=eo(g.glyph,{seatGlyph:a?.get(g.categoryKey)});m[p]=no.indexOf(M),h[p]=g.wheelchairSpaceType==="no-seat"?0:1,s[p*3]=g.x*S,s[p*3+1]=e?e.seatDeckY(p):Yi(g),s[p*3+2]=g.y*S,c[p]=ce(n?n(g):"available");let x=it(o?.get(g.categoryKey)??"#6e7bff")??[.43,.48,1];if(l[p*3]=x[0],l[p*3+1]=x[1],l[p*3+2]=x[2],g.accessibility?.length){let I=it(In(g.accessibility));I&&(d[p*3]=I[0],d[p*3+1]=I[1],d[p*3+2]=I[2])}y.set(g.id,p)}return{count:i,iPosition:s,iState:c,iCategory:l,iMaxRadius:u,iRing:d,idToIndex:y,iChairWidth:f,iGlyph:m,iPhysicalSeat:h,iFloor:r??new Float32Array(i),iSection:new Float32Array(i).fill(-1),iYaw:new Float32Array(i)}}var zi=64;function Ru(t,n){let e=[];for(let i of n){let s=t.idToIndex.get(i.seatId);if(s===void 0)continue;let c=ce(i.state);t.iState[s]!==c&&(t.iState[s]=c,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+zi){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 is from"polygon-clipping";var K={top:1,wallBottom:.58,bottomCap:.4};function Wt(t,n){if(!t)return n;let e=V(Et(t,.4),.62);return at(n,e,.22)}function Io(t,n){return t?at(n,V(Et(t,.25),.74),.62):n}function _o(t,n){let e=jt(Fn({tierTop:n}));return t?Xt(t,e.sectionDeck,Math.min(e.sectionDeckChromaShare*cn(t),e.sectionDeckChromaCap)):Xt(n,e.deck,Math.min(cn(n),kn))}function Ao(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,c=0,l=0,u=0;for(let[f,m]of i){let h=it(e.get(f));h&&(s+=h[0]*m,c+=h[1]*m,l+=h[2]*m,u+=m)}u>0&&o.set(a,[s/u,c/u,l/u])}return o}function Eo(t,n){return it(t.color)??n.get(t.logicalSectionId??t.id)??null}import Ho from"polygon-clipping";import Oo from"polygon-clipping";import Ki from"earcut";var Vi=.58,wo=.01,Pt=Dn*1.5*Rt,Zi=.5,qi=.6;function $i(t,n){let e=t.length,r=[];for(let i=0;i<e;i++){let s=t[Math.max(0,i-1)],c=t[Math.min(e-1,i+1)],l=c.x-s.x,u=c.y-s.y,f=Math.hypot(l,u);if(f<1e-9){r.push([0,0]);continue}l/=f,u/=f,r.push([-u,l])}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 Qi(t,n){if(t.length<2||n<=0)return[...t];let e=[...t],r=(i,s)=>{let c=s.x-i.x,l=s.y-i.y,u=Math.hypot(c,l)||1;return{x:c/u,y:l/u}},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 Bo=Math.PI/12;function Ji(t){if(t.length<3)return[...t];let n=$t(t);return n.length>=3?n:[...t]}function Co(t,n){if(!t.length||!(n>0))return[];let e=Ji(t),r=(s,c,l,u)=>{let f=l-c;for(;f<0;)f+=Math.PI*2;for(;f>Math.PI*2;)f-=Math.PI*2;let m=Math.max(1,Math.ceil(f/Bo)),h=n/Math.cos(f/m/2);for(let d=0;d<=m;d++){let y=c+f*d/m;u.push({x:s.x+Math.cos(y)*h,y:s.y+Math.sin(y)*h})}};if(e.length<3){let s=0,c=0;for(let h of e)s+=h.x,c+=h.y;s/=e.length||1,c/=e.length||1;let l=0;for(let h of e)l=Math.max(l,Math.hypot(h.x-s,h.y-c));let u=[],f=Math.max(3,Math.ceil(Math.PI*2/Bo)),m=(l+n)/Math.cos(Math.PI/f);for(let h=0;h<f;h++){let d=h/f*Math.PI*2;u.push({x:s+Math.cos(d)*m,y:c+Math.sin(d)*m})}return u}let o=e.length,a=[];for(let s=0;s<o;s++){let c=e[s],l=e[(s+1)%o];a.push(Math.atan2(-(l.x-c.x),l.y-c.y))}let i=[];for(let s=0;s<o;s++)r(e[s],a[(s+o-1)%o],a[s],i);return No(i)}function ts(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,c=i.y-a.y,l=s*s+c*c,u=l>1e-12?((n-a.x)*s+(e-a.y)*c)/l:0;u<0?u=0:u>1&&(u=1);let f=Math.hypot(n-(a.x+u*s),e-(a.y+u*c));f<r&&(r=f)}return r}function Hn(t){let n=t.map(o=>{let a=0,i=0;for(let l of o.pts)a+=l.x,i+=l.y;let s=o.pts.length||1;a/=s,i/=s;let c=0;for(let l of o.pts){let u=Math.hypot(l.x-a,l.y-i);u>c&&(c=u)}return{cx:a,cy:i,rad:c}}),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,c=null;for(let u 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 h=n[m],d=Math.hypot(u.x-h.cx,u.y-h.cy)-h.rad;if(d>=f&&d>=s)continue;let y=ts(t[m].pts,u.x,u.y);y<f&&(f=y),t[m].depth<t[o].depth&&y<s&&(s=y,c=t[m].y)}Number.isFinite(f)&&f>0&&i.push(f)}i.sort((u,f)=>u-f);let l=i.length?i[Math.floor(i.length/2)]:1;r.push({pitch:l,belowY:c})}return r}function ko(t,n,e,r){let o=t[n],a=o.pts.length>=2?[...o.pts]:o.pts.length===1?(()=>{let u=o.pts[0],f=u.x-r.x,m=u.y-r.y,h=Math.hypot(f,m)||1;f/=h,m/=h;let d=Math.max(e[n].pitch,.001)*.5;return[{x:u.x+m*d,y:u.y-f*d},{x:u.x-m*d,y:u.y+f*d}]})():[];if(a.length<2)return null;let i=0,s=0;for(let u=1;u<a.length;u++){let f=Math.hypot(a[u].x-a[u-1].x,a[u].y-a[u-1].y);f>1e-6&&(i+=f,s++)}let c=s>0?i/s:0,l=Qi(a,Math.max(c*qi,Pt));return{pts:l,nrm:$i(l,r),front:Math.max(e[n].pitch*Vi,Pt),back:Math.max(e[n].pitch*Zi,Pt)}}var Qt=1.5,Fo=.3;function me(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,c=-1;for(let f=1;f<t.length-1;f++){let m=t[f],h=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);h>s&&(s=h,c=f)}if(s<=n||c<0)return[e,r];let l=me(t.slice(0,c+1),n),u=me(t.slice(c),n);return[...l.slice(0,-1),...u]}function Lo(t,n){if(t.length<4)return t;let e=me([...t,t[0]],n);return e.pop(),e.length>=3?e:t}function ns(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 vo(t,n,e){if(t.length<2)return[];let r=e??Hn(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 g of i){let R=t[g].patch;R&&R.length>=3?a.push({outline:[...R],holes:[],topY:t[g].y}):s.push(g)}if(!s.length)continue;s.sort((g,R)=>t[g].depth-t[R].depth);let l=s.map(g=>ko(t,g,r,n)).filter(g=>g!==null);if(!l.length)continue;let u=(g,R)=>({x:g.pts[R].x-g.nrm[R][0]*(g.front+Qt),y:g.pts[R].y-g.nrm[R][1]*(g.front+Qt)}),f=(g,R)=>({x:g.pts[R].x+g.nrm[R][0]*(g.back+Qt),y:g.pts[R].y+g.nrm[R][1]*(g.back+Qt)}),m=l[0],h=l[l.length-1],d=[];for(let g=0;g<m.pts.length;g++)d.push(u(m,g));for(let g of l)d.push(f(g,g.pts.length-1));for(let g=h.pts.length-1;g>=0;g--)d.push(f(h,g));for(let g=l.length-1;g>=0;g--)d.push(u(l[g],0));let y=No(d),b=1/0;for(let g of s)t[g].y<b&&(b=t[g].y);if(!Number.isFinite(b))continue;if(y.length>=3&&Math.abs(pt(y))>1e-6&&l.every(g=>{let R=g.pts[Math.floor(g.pts.length/2)];return xt(y,R.x,R.y)})&&!ns(y)){a.push({outline:Lo(y,Fo),holes:[],topY:b});continue}for(let g of es(l))a.push({outline:g,holes:[],topY:b})}return a}function es(t){let n=[];for(let e of t){let r=[],o=[],a=e.front+Qt,i=e.back+Qt;for(let c=0;c<e.pts.length;c++){let l=e.pts[c],u=e.nrm[c];r.push([l.x-u[0]*a,l.y-u[1]*a]),o.push([l.x+u[0]*i,l.y+u[1]*i])}let s=[...r,...o.reverse()];s.length<3||(s.push(s[0]),n.push([s]))}if(!n.length)return[];try{let e=Oo.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(([c,l])=>({x:c,y:l})),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(Lo(a,Fo))}return r}catch{return[]}}function No(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 he=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(!xt(e,o.x,o.y)){r=!1;break}if(r)return!0}return!1}};function To(t,n,e,r,o,a){if(r.length<3)return;if(e.containsAll(r)){let l=[0,1,0],u=r[0];for(let f=1;f+1<r.length;f++){let m=r[f],h=r[f+1];t.tri([u.x*S,o,u.y*S],[m.x*S,o,m.y*S],[h.x*S,o,h.y*S],l,a)}return}let i=r.map(l=>[l.x,l.y]);i.push(i[0]);let s;try{s=Oo.intersection([i],n)}catch{return}let c=[0,1,0];for(let l of s){if(!l.length||l[0].length<4)continue;let u=l[0],f=[],m=[];for(let d=0;d<u.length-1;d++)f.push(u[d][0],u[d][1]),m.push([u[d][0],u[d][1]]);if(m.length<3)continue;let h=Ki(f,void 0,2);for(let d=0;d<h.length;d+=3){let y=m[h[d]],b=m[h[d+1]],p=m[h[d+2]];t.tri([y[0]*S,o,y[1]*S],[b[0]*S,o,b[1]*S],[p[0]*S,o,p[1]*S],c,a)}}}function Go(t,n,e,r,o,a,i){if(n.length<2)return;let s=i??Hn(n),c=[0,1,0],l=a&&a.length>=3?[[...a.map(h=>[h.x,h.y]),[a[0].x,a[0].y]]]:null,u=a&&a.length>=3?new he([[...a]]):null,f=h=>{t.setMaterial(2),h(),t.setMaterial(0)},m=h=>{t.setMaterial(3),h(),t.setMaterial(0)};for(let h=0;h<n.length;h++){let d=n[h];if(d.patch&&d.patch.length>=3){let M=[...d.patch],x=s[h].belowY??r;if(m(()=>{if(l&&u)To(t,l,u,M,d.y,o.tread);else{let I=M[0];for(let P=1;P+1<M.length;P++){let _=M[P],O=M[P+1];t.tri([I.x*S,d.y,I.y*S],[_.x*S,d.y,_.y*S],[O.x*S,d.y,O.y*S],c,o.tread)}}}),d.y>x+wo){let I=0,P=0;for(let _ of M)I+=_.x,P+=_.y;I/=M.length,P/=M.length,f(()=>{for(let _=0;_<M.length;_++){let O=M[_],C=M[(_+1)%M.length],F=C.x-O.x,k=C.y-O.y,E=Math.hypot(F,k);if(E<1e-6)continue;let w=k/E,B=-F/E;(O.x-I)*w+(O.y-P)*B<0&&(w=-w,B=-B);let L=[w,0,B],T=[O.x*S,d.y,O.y*S],v=[C.x*S,d.y,C.y*S],H=[O.x*S,x,O.y*S],j=[C.x*S,x,C.y*S];t.tri(T,v,j,L,o.riser),t.tri(T,j,H,L,o.riser)}})}continue}let y=ko(n,h,s,e);if(!y)continue;let{pts:b,nrm:p,front:g,back:R}=y,A=s[h].belowY??r;for(let M=0;M+1<b.length;M++){let x=b[M],I=b[M+1],P=p[M],_=p[M+1];if(Math.hypot(I.x-x.x,I.y-x.y)<1e-6||P[0]===0&&P[1]===0||_[0]===0&&_[1]===0)continue;let O=[(x.x-P[0]*g)*S,d.y,(x.y-P[1]*g)*S],C=[(I.x-_[0]*g)*S,d.y,(I.y-_[1]*g)*S],F=[(x.x+P[0]*R)*S,d.y,(x.y+P[1]*R)*S],k=[(I.x+_[0]*R)*S,d.y,(I.y+_[1]*R)*S];if(m(()=>{l&&u?To(t,l,u,[{x:x.x-P[0]*g,y:x.y-P[1]*g},{x:I.x-_[0]*g,y:I.y-_[1]*g},{x:I.x+_[0]*R,y:I.y+_[1]*R},{x:x.x+P[0]*R,y:x.y+P[1]*R}],d.y,o.tread):(t.tri(O,C,k,c,o.tread),t.tri(O,k,F,c,o.tread))}),d.y>A+wo){let E=[O[0],A,O[2]],w=[C[0],A,C[2]],B=[-P[0],0,-P[1]];f(()=>{t.tri(O,C,w,B,o.riser),t.tri(O,w,E,B,o.riser)})}}}}function os(t,n){let e=t.eventConfigurationIds;return!e?.length||!!n&&e.includes(n)}function Do(t,n){return t.filter(e=>e.type!=="shape"||os(e,n))}function Xo(t,n){let e=t.focalPoint??{x:0,y:0};return t.floors?.length?t.floors.map((r,o)=>({objects:Do(r.objects,n),focal:{x:(r.focalPoint??e).x,y:(r.focalPoint??e).y},baseHeightM:r.baseHeightM??0,index:o})):[{objects:Do(t.objects,n),focal:e,baseHeightM:0,index:0}]}var rs={minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};function Tt(t){return ro(t)??rs}function jo(t,n){let e=It(t.outline,Pt),r=Tt(e),o=n.filter(i=>i!==t&&i.outline&&i.outline.length>=3&&qt(r,Tt(i.outline)));if(!o.length)return[e];let a=i=>{let s=i.map(c=>[c.x,c.y]);return s.push(s[0]),s};try{let i=Ho.difference([a(e)],...o.map(c=>[a(c.outline)])),s=[];for(let c of i){if(!c.length)continue;let l=c[0].map(([u,f])=>({x:u,y:f}));if(l.length>1){let u=l[0],f=l[l.length-1];Math.abs(u.x-f.x)<1e-9&&Math.abs(u.y-f.y)<1e-9&&l.pop()}l.length>=3&&s.push(l)}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=Ho.intersection([e(a.outline)],r.flat())}catch{o.push(a);continue}for(let s of i){if(!s.length)continue;let c=s[0].map(([l,u])=>({x:l,y:u}));if(c.length>1){let l=c[0],u=c[c.length-1];Math.abs(l.x-u.x)<1e-9&&Math.abs(l.y-u.y)<1e-9&&c.pop()}c.length>=3&&o.push({outline:c,holes:[],topY:a.topY})}}return o.length?o:t}function ss(t,n){return t===void 0||n===void 0?!0:Math.abs(t-n)<.001}var Xn=class{constructor(){this.rings=[];this.boxes=[];this.levels=[]}subtract(n,e){let r=n.map(c=>[c.x,c.y]);if(r.length<3)return[];r.push(r[0]);let o=Tt(n),a=this.rings.filter((c,l)=>qt(o,this.boxes[l])&&ss(e,this.levels[l])),i=[[r]];if(a.length)try{i=is.difference([r],...a).map(l=>l.map(u=>u.map(([f,m])=>[f,m])))}catch{i=[[r]]}this.rings.push([r]),this.boxes.push(o),this.levels.push(e);let s=[];for(let c of i){if(!c.length)continue;let l=c[0].map(([u,f])=>({x:u,y:f}));if(l.length>1){let u=l[0],f=l[l.length-1];Math.abs(u.x-f.x)<1e-9&&Math.abs(u.y-f.y)<1e-9&&l.pop()}l.length>=3&&s.push(l)}return s}};function Jt(t,n,e=t){if(!n)return t;let r=1/0,o=-1/0,a=1/0,i=-1/0;for(let m of e)r=Math.min(r,m.x),o=Math.max(o,m.x),a=Math.min(a,m.y),i=Math.max(i,m.y);let s=(r+o)/2,c=(a+i)/2,l=n*Math.PI/180,u=Math.cos(l),f=Math.sin(l);return t.map(m=>{let h=m.x-s,d=m.y-c;return{x:s+h*u-d*f,y:c+h*f+d*u}})}function Wo(t){let n=Ve(t);return!n.length||!t.points?.length?[]:n.map(e=>Jt(e,t.rotation,t.points))}function ct(t){let n=null;if(t.kind==="polygon"&&t.points&&t.points.length>=3)return Jt(Ke(t,4),t.rotation,t.points);if(t.kind==="rect"&&t.width&&t.height&&(n=mn(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=Gn(e,r,t.width/2,t.height/2)}return n?Jt(n,t.rotation):null}function _t(t){let n=t.role??"",r=n==="stage"?{kind:"stage",heightM:qe(t.stageKind)}:{stage:{kind:"stage",heightM:1},entrance:{kind:"portal",heightM:2.7},exit:{kind:"portal",heightM:2.7},screen:{kind:"solid",heightM:6},wall:{kind:"solid",heightM:2.8},rail:{kind:"solid",heightM:1.1},suite:{kind:"suite",heightM:3},obstruction:{kind:"solid",heightM:4.5},sound:{kind:"solid",heightM:1.45},restroom:{kind:"solid",heightM:2.4},bar:{kind:"solid",heightM:1.1},concession:{kind:"solid",heightM:1.1},coat:{kind:"solid",heightM:1.1},goal:{kind:"portal",heightM:1.8}}[n]??{kind:"plate",heightM:.25};return{...r,heightM:t.heightM??r.heightM}}var as=.08,cs=30,ls=.015;function us(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 Yo(t,n){let e=ct(t)??(t.points?.length?Jt(t.points,t.rotation):null),r=_t(t),a=!t.role&&r.kind==="plate"&&t.heightM===void 0&&!!e&&Math.abs(pt(e))*$**2>=cs?ls: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,c=-1/0,l=-1/0;for(let h of e)i=Math.min(i,h.x),s=Math.min(s,h.y),c=Math.max(c,h.x),l=Math.max(l,h.y);let u=a,f=0,m=1e-6*Math.max(1,c-i,l-s);for(let h of n)c>h.minX&&i<h.maxX&&l>h.minY&&s<h.maxY&&u<=h.topOffsetM+1e-6&&(u=h.topOffsetM+as),i>=h.minX-m&&c<=h.maxX+m&&s>=h.minY-m&&l<=h.maxY+m&&(!h.poly||e.every(b=>us(b,h.poly)||fs(b,h.poly,m)))&&(f=Math.max(f,h.topOffsetM));return t.fill&&t.fill!=="none"&&t.fill!=="transparent"&&n.push({minX:i,minY:s,maxX:c,maxY:l,topOffsetM:u,poly:e}),{topOffsetM:u,supportOffsetM:Math.min(f,u)}}function fs(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,c=i.y-a.y,l=s*s+c*c,u=l?Math.max(0,Math.min(1,((t.x-a.x)*s+(t.y-a.y)*c)/l)):0;if(Math.hypot(t.x-(a.x+u*s),t.y-(a.y+u*c))<=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 bt(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 dt(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 hn(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 ot(t,n,e,r,o,a,i){Z(t,n,i?.length?i:void 0,()=>e,r,o,a,K)}function yn(t){if(t.length<3)return t.map(e=>({...e}));let n=$t(t);return n.length>=3?n:[...t].sort((e,r)=>e.x-r.x||e.y-r.y).map(e=>({...e}))}var ms=.8,hs=.6,ys=2;function Nt(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=ct(i)??[],c=zo(s)/2;!(c>0)||xs(s)/c*S>ys||(e.push(...s),r+=c)}if(e.length<3)return null;let o=yn(e);if(o.length<3||r<zo(o)*hs)return null;let a=0;for(let i of n)bs(i,o)&&(a+=1);return a>=n.length*ms?o:null}var jn=6,ds=5,ps=8;function Ko(t){return Math.max(ps,(Number.isFinite(t)?t:0)+ds)}function tn(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 xs(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 zo(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 bs(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 gs=[[/\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"]],Ms=1.2,Rs=12;function Vo(t){if(t.heightM!==void 0)return!1;let n=ct(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*$<Rs*2?!1:2*dn(n)/e*$<=Ms}function ye(t){if(!t)return null;for(let[n,e]of gs)if(n.test(t))return e;return null}var qo="auto-rows-";function $o(t){return t.id.startsWith(qo)&&!t.label}var Ss=1.15,Ps=.09,Qo=6,Is=34,_s=.35,As=6,Es=.35,ws=.75,Bs=12,Ts=2.5,Os=40,Cs=[18,24],ks=[12,16],Zo=14,Fs=.8,Ls=.6,vs=5,Ns=.3,Jo=.4,tr=2,Gs=400,Ds=2.6,Hs=.8,Xs=4,js=26,Us=.7,Ws=.5,Ys=.985,zs=1.5,Ks=2.2,Vs=3,Zs=25,qs=.985,$s=2,Qs=6,Js=3,ta=.1,na=1.5,ea=1.6,oa=6e3,ra=.6,ia="#c3c7cd",de=300,sa=240;function aa(t,n,e,r){if(!t.fill||!/^#[0-9a-f]{6}$/i.test(t.fill))return null;let o=xe([...n]),a=new Set;for(let u of r)a.add(Math.floor(Math.atan2(u.y-o.y,u.x-o.x)*180/Math.PI/10));if(a.size*10<sa)return null;let{h:i,s,l:c}=to(Je(t.fill));return i<70/360||i>170/360||s<.2||c<.08||c>.75||e.some(u=>u!==t&&u.type==="shape"&&ct(u)?.some(f=>Me(f,n)))?null:t.kind==="ellipse"?"oval-cricket":t.kind==="rect"?"pitch-football":null}var ca="Estimated from the drawing; confirm with the venue.",be=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},xe=t=>({x:t.reduce((n,e)=>n+e.x,0)/t.length,y:t.reduce((n,e)=>n+e.y,0)/t.length}),dn=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 la(t){return t.height!==void 0||t.rake!==void 0||t.elevation!==void 0||t.surfaceKind!==void 0}function ge(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 Me(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 Re(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,c=i.y-a.y,l=s*s+c*c,u=l>0?Math.max(0,Math.min(1,((t.x-a.x)*s+(t.y-a.y)*c)/l)):0,f={x:a.x+s*u,y:a.y+c*u},m=Math.hypot(t.x-f.x,t.y-f.y);m<r&&(r=m,e=f)}return e}function nr(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,c=i.y-a.y,l=Math.hypot(s,c);if(l<1e-6)continue;let u={x:(a.x+i.x)/2,y:(a.y+i.y)/2},f=Re(u,n),m=f.x-u.x,h=f.y-u.y,d=Math.hypot(m,h);d<1e-6||(r+=Math.abs((-c*m+s*h)/(l*d))*o.length,e+=o.length)}return e?r/e:0}function ua(t,n,e){let r=t.filter(y=>y.type==="shape"),o=r.find(y=>y.role==="stage");if(o){let y=ct(o);return y?{shape:o,centre:xe(y),outline:y,inferred:!1}:null}if(!e.length)return null;let a=1/0,i=-1/0,s=1/0,c=-1/0;for(let y of e)a=Math.min(a,y.x),i=Math.max(i,y.x),s=Math.min(s,y.y),c=Math.max(c,y.y);let l=(i-a)*(c-s),u=[];for(let y of r){if(y.role)continue;let b=ct(y);if(!b)continue;let p=dn(b);if(p*$*$<6||p>l)continue;let g=Math.min(...b.map(_=>_.x)),R=Math.max(...b.map(_=>_.x)),A=Math.min(...b.map(_=>_.y)),M=Math.max(...b.map(_=>_.y)),x=0;for(let _ of e)_.x>g&&_.x<R&&_.y>A&&_.y<M&&Me(_,b)&&x++;if(x>e.length*.05)continue;let I=xe(b),P=nr(n,b);P>=Fs&&u.push({shape:y,centre:I,outline:b,score:P,area:p,box:[g,A,R,M]})}let f=(y,b)=>b!==y&&b.area>y.area&&y.box[0]>=b.box[0]-1e-6&&y.box[1]>=b.box[1]-1e-6&&y.box[2]<=b.box[2]+1e-6&&y.box[3]<=b.box[3]+1e-6,m=u.filter(y=>!u.some(b=>f(y,b))),h=Math.max(0,...m.map(y=>y.score)),d=m.filter(y=>y.score>=h-.03).sort((y,b)=>b.area-y.area)[0]??null;return d?{shape:d.shape,centre:d.centre,outline:d.outline,inferred:!0}:null}function fa(t,n,e){if(!e||e.length<3)return Math.hypot(t.x-n.x,t.y-n.y);let r=Re(t,e);return Math.hypot(t.x-r.x,t.y-r.y)}function er(t){return t.length<3?[...t].sort((n,e)=>n.x-e.x||n.y-e.y):$t(t)}function ma(t){if(!t.length||t.length>oa)return[];let n=[...ge(t).values()],e=n.map((s,c)=>c),r=s=>e[s]===s?s:e[s]=r(e[s]),o=ea/$,a=n.map(s=>({minX:Math.min(...s.map(c=>c.x))-o,maxX:Math.max(...s.map(c=>c.x))+o,minY:Math.min(...s.map(c=>c.y))-o,maxY:Math.max(...s.map(c=>c.y))+o}));for(let s=0;s<n.length;s++)for(let c=s+1;c<n.length;c++){let l=a[s],u=a[c];if(l.maxX<u.minX||u.maxX<l.minX||l.maxY<u.minY||u.maxY<l.minY)continue;n[s].some(m=>n[c].some(h=>Math.hypot(m.x-h.x,m.y-h.y)<=o))&&(e[r(s)]=r(c))}let i=new Map;return n.forEach((s,c)=>{let l=r(c),u=i.get(l);u?u.push(...s):i.set(l,[...s])}),[...i.values()].filter(s=>new Set(s.map(c=>c.rowId)).size>=2)}function ha(t,n,e){if(!n.length)return null;let r=n.filter(P=>e.tableIds.has(P.rowId)||P.kind==="booth").length>n.length/2,o=ge(n),a=!e.outline||nr(o,e.outline)>=Ls,i=0,s=0;for(let P of o.values()){if(P.length<2)continue;let _=P[0],O=P[P.length-1],C=O.x-_.x,F=O.y-_.y,k=Math.hypot(C,F);if(k<1e-6)continue;let E={x:(_.x+O.x)/2,y:(_.y+O.y)/2},w=a?e.outline?Re(E,e.outline):e.focal:e.middle,B=-F/k,L=C/k;B*(w.x-E.x)+L*(w.y-E.y)<0&&(B=-B,L=-L),i+=B*P.length,s+=L*P.length}let c={x:n.reduce((P,_)=>P+_.x,0)/n.length,y:n.reduce((P,_)=>P+_.y,0)/n.length};if(Math.hypot(i,s)<1e-9){let P=a?e.focal:e.middle;i=P.x-c.x,s=P.y-c.y}let l=Math.hypot(i,s)||1,u={x:i/l,y:s/l},f=P=>-(P.x*u.x+P.y*u.y),m=P=>-P.x*u.y+P.y*u.x,h=1/0,d=-1/0,y=1/0,b=-1/0,p=1/0,g=new Map;for(let P of n){let _=f(P),O=m(P);h=Math.min(h,_),d=Math.max(d,_),y=Math.min(y,O),b=Math.max(b,O),a&&(p=Math.min(p,fa(P,e.focal,e.outline)));let C=P.logicalRowId??P.rowId,F=g.get(C);F?F.push(_):g.set(C,[_])}a||(p=Math.max(0,h-f(e.middle)));let R=[...g.values()].map(P=>be(P)).sort((P,_)=>P-_),A=[];if(!r)for(let P of R)A.length&&P-A[A.length-1]<Es/$||A.push(P);let M=la(t),x=Vt(t,{floorBaseHeightM:e.baseHeightM}),I={id:t.id,section:t,authored:M,plane:e,facing:u,facesAction:a,hull:er(n),sample:n.filter((P,_)=>_%Math.ceil(n.length/Gs)===0),frontD:h,backD:d,latMin:y,latMax:b,frontDistance:p,rowDepths:A,rowCount:A.length,level:0,height:x.height,rake:M?x.rake:0,backHeight:0};return I.backHeight=I.height+(d-h)*$*Math.tan(I.rake*Math.PI/180),I}function ya(t,n,e,r){if(t.length<2)return 0;let o=Math.max(1,n*$),a=e+Ss-r,i=0,s=0;for(let l=1;l<t.length;l++){let u=Math.max(ws,(t[l]-t[l-1])*$),f=(a+Ps)*(o+u)/o;i+=f-a,s+=u,a=f,o+=u}let c=Math.atan(i/s)*180/Math.PI;return Math.round(Math.max(Qo,Math.min(Is,c))*10)/10}function da(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 h=-m.x*t.facing.y+m.y*t.facing.x;o=Math.min(o,h),a=Math.max(a,h)}if(Math.min(t.latMax,a)-Math.max(t.latMin,o)<(e?1e-6:Jo*(t.latMax-t.latMin)))return null;let s=tr/$,c=new Map,l=new Map;for(let m of t.sample){let h=Math.floor((-m.x*t.facing.y+m.y*t.facing.x)/s),d=-(m.x*t.facing.x+m.y*t.facing.y);c.set(h,Math.min(c.get(h)??1/0,d))}for(let m of n.sample){let h=Math.floor((-m.x*t.facing.y+m.y*t.facing.x)/s),d=-(m.x*t.facing.x+m.y*t.facing.y);l.set(h,Math.max(l.get(h)??-1/0,d))}let u=[];for(let[m,h]of c){let d=l.get(m);d!==void 0&&u.push(h-d)}let f=u.length?be(u):t.frontD-r;return f<-1/$?null:f}function pa(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 c of n.hull){let l=-(c.x*t.facing.x+c.y*t.facing.y);e=Math.max(e,l),r=Math.min(r,l);let u=-c.x*t.facing.y+c.y*t.facing.x;o=Math.min(o,u),a=Math.max(a,u)}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>Jo*(t.latMax-t.latMin)&&s>1/$}function xa(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 ba(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*$*Math.tan(n.rake*Math.PI/180)}function ga(t,n){if(!t.facesAction)return!1;let e={x:-t.facing.y,y:t.facing.x},r=tr/$,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>=Ys))for(let c of s.sample){let l=-(c.x*t.facing.x+c.y*t.facing.y);if(l<t.frontD||l>t.backD)continue;let u=-c.x*t.facing.y+c.y*t.facing.x,f=u<t.latMin?"left":u>t.latMax?"right":null;if(!f)return!1;let m=Math.min(o-1,Math.floor((l-t.frontD)/r)),h=f==="left"?t.latMin-u:u-t.latMax;h<(a[f].get(m)?.gap??1/0)&&a[f].set(m,{gap:h,other:s})}let i=s=>{let c=s==="left"?t.latMin:t.latMax,l=0;for(let[u,{other:f}]of a[s]){if((f.facing.x*e.x+f.facing.y*e.y)*(s==="left"?1:-1)<Us)continue;let h=t.frontD+(u+.5)*r,d={x:-h*t.facing.x+c*e.x,y:-h*t.facing.y+c*e.y},y=-(d.x*f.facing.x+d.y*f.facing.y),b=-d.x*f.facing.y+d.y*f.facing.x;y<f.frontD&&b>=f.latMin&&b<=f.latMax&&l++}return l/o>=Ws};return i("left")&&i("right")}function Ma(t,n){if(n.plane.floorIndex!==t.plane.floorIndex||n.facing.x*t.facing.x+n.facing.y*t.facing.y<qs)return!1;let e=1/0,r=-1/0,o=1/0;for(let s of n.hull){let c=-s.x*t.facing.y+s.y*t.facing.x;e=Math.min(e,c),r=Math.max(r,c),o=Math.min(o,-(s.x*t.facing.x+s.y*t.facing.y))}let a=(t.frontD-o)*$;if(a<-$s||a>Qs)return!1;let i=Math.max(e-t.latMax,t.latMin-r);return i*$<=Js&&i*$>=-ta}function Ra(t,n=!1,e=!1,r){let o=n?ks:Cs,a=new Set(e?[]:t.filter(y=>!y.authored&&ga(y,t))),i=[...t].sort((y,b)=>y.plane.floorIndex-b.plane.floorIndex||Number(a.has(b))-Number(a.has(y))||y.frontDistance-b.frontDistance);for(let y of a)r?.add(y.id);let s=(y,b,p)=>{let g=new Map,R=[],A=new Map,M=x=>{if(x.plane.floorIndex===0||x.plane.baseHeightM>0)return x.plane.baseHeightM;let I=A.get(x.plane.floorIndex-1);return I===void 0?x.plane.baseHeightM:I+mo};for(let x of i){if(a.has(x))x.height=M(x),x.level=0,x.rake=0,x.backHeight=x.height,g.set(x.id,void 0);else if(!x.authored){let P=M(x),_;for(let E of R){if(E.plane.floorIndex>x.plane.floorIndex)continue;if(pa(x,E)){let T=ba(x,E)+Ds;T>P&&(P=T,_=E);continue}let w=da(x,E,a.has(E));if(w==null)continue;let B=e&&!!x.plane.stageDeck&&E.level===0&&E.plane.floorIndex===x.plane.floorIndex&&Math.max(0,w)*$<=Xs,L=a.has(E)?E.height+zs:B?E.backHeight:E.backHeight+_s+Math.min(As,Math.max(0,w)*$)*Math.tan(E.rake*Math.PI/180);L>P&&(P=L,_=E)}let O=y.get(x);O&&O.height>P+.01?(P=O.height,_=void 0):O=void 0,x.height=Math.round(Math.min(P,x.plane.baseHeightM+Os)*100)/100;let C=!_&&!O&&x.height>x.plane.baseHeightM;if(x.level=_?_.level+1:O?O.level:C?1:0,x.rake=ya(x.rowDepths,x.frontDistance,x.height,x.plane.focalHeightM),!x.facesAction&&x.rowCount<vs)x.rake=0;else if(x.level===0){let E=Math.max(1e-6,(x.backD-x.frontD)*$);x.rake=Math.min(x.rake,Bs,Math.round(Math.atan(Ts/E)*1800/Math.PI)/10)}else x.rowCount>=2&&(x.rake=Math.max(x.rake,o[Math.min(x.level,o.length)-1]));let F=(x.backD-x.frontD)*$,k=_&&a.has(_)||O&&p?.has(O.id);if(b!==void 0&&k&&x.rowCount>=2&&(x.rake=b),n&&F>0&&x.height+F*Math.tan(x.rake*Math.PI/180)>x.plane.baseHeightM+Zo){let E=Math.max(0,x.plane.baseHeightM+Zo-x.height);x.rake=Math.max(Qo,Math.round(Math.atan(E/F)*1800/Math.PI)/10)}e&&x.plane.stageDeck&&x.level>0&&(x.rake=Math.min(x.rake,js)),x.backHeight=x.height+F*Math.tan(x.rake*Math.PI/180),g.set(x.id,_?.id??(O?g.get(O.id):void 0))}let I=x.plane.floorIndex;A.set(I,Math.min(A.get(I)??1/0,x.height)),R.push(x)}return g},c=s(new Map),l=new Map,u=y=>l.get(y)?.height??y.height;for(let y=!0,b=0;y&&b<t.length;b++){y=!1;for(let p of t)if(!(p.authored||a.has(p)))for(let g of t){let R=l.get(g)??g;g===p||R.height-R.plane.baseHeightM<na||R.height<=u(p)+.01||Ma(p,g)&&(l.set(p,R),y=!0)}}let f=new Map(t.map(y=>[y.id,y])),m=t.filter(y=>!y.authored&&y.rowCount>=2&&a.has(f.get(c.get(y.id)??""))),h=m.length?be(m.map(y=>y.rake)):void 0;if(!l.size&&h===void 0)return c;let d=new Map([...new Set(l.values())].map(y=>[y,{...y}]));return s(new Map([...l].map(([y,b])=>[y,d.get(b)])),h,new Set(m.map(y=>y.id)))}var pe=(t,n)=>!!t&&t.x===n.x&&t.y===n.y;function or(t,n={x:0,y:-40}){let e=wn(t),r=new Map;for(let p of e){if(!p.sectionId)continue;let g=r.get(p.sectionId);g?g.push(p):r.set(p.sectionId,[p])}let o={focalInferred:!1,confident:!1,sections:[]},a=t.floors?.length?t.floors.map((p,g)=>({objects:p.objects,floorIndex:g,floorId:p.id,baseHeightM:p.baseHeightM??0,focal:p.focalPoint??t.focalPoint})):[{objects:t.objects,floorIndex:0,floorId:void 0,baseHeightM:0,focal:t.focalPoint}],i=new Set(a.flatMap(p=>p.objects.filter(g=>g.type==="table").map(g=>g.id))),s=[],c,l=new Set,u=a.map(p=>{let g=k=>!t.floors?.length||k.floorId===p.floorId,R=ma(e.filter(k=>!k.sectionId&&k.kind!=="booth"&&!i.has(k.rowId)&&g(k))),A=[];for(let k of R){let E=It(wt(er(k)),ra/$);if(e.some(B=>!g(B)&&Me(B,E)))continue;let w=`${qo}${p.floorIndex}-${A.length}`;l.add(w),r.set(w,k),A.push({type:"section",id:w,label:"",color:ia,outline:E})}let M=A.length?{...p,objects:[...p.objects,...A]}:p,x=new Set(M.objects.filter(k=>k.type==="section").map(k=>k.logicalSectionId??k.id)),I=[...r.entries()].filter(([k])=>x.has(k)).flatMap(([,k])=>k),P=ua(M.objects,ge(I),I),_=M.focal;(P||M.focal&&!pe(M.focal,n))&&(o.confident=!0),P&&(o.stage??={id:P.shape.id,inferred:P.inferred,...M.floorId?{floorId:M.floorId}:{}},(P.inferred||pe(M.focal,n))&&(_=P.centre,o.focalInferred=!0));let O=P&&(!P.inferred||dn(P.outline)*$*$<=de),C=P?void 0:c,F={tableIds:i,floorIndex:M.floorIndex,floorId:M.floorId,baseHeightM:M.baseHeightM,focal:C?.focal??_,outline:P?.outline??C?.outline,focalHeightM:C?.focalHeightM??M.baseHeightM+(P&&O?_t({...P.shape,role:"stage"}).heightM:0),stageDeck:C?.stageDeck??!!(P&&O&&dn(P.outline)*$*$<=de),middle:I.length?{x:I.reduce((k,E)=>k+E.x,0)/I.length,y:I.reduce((k,E)=>k+E.y,0)/I.length}:_};for(let k of M.objects){if(k.type!=="section")continue;let E=ha(k,r.get(k.logicalSectionId??k.id)??[],F);E&&s.push(E)}return F.outline&&(c=F),pe(M.focal,F.focal)||(o.focal??=[]).push({...M.floorId?{floorId:M.floorId}:{},point:{...F.focal}}),{unit:M,plane:F,stage:P,planeSeats:I}}),f=a.flatMap(p=>p.objects).map(p=>p.type==="shape"&&!p.role&&(ye(p.label)==="wall"||!ye(p.label)&&Vo(p))?{...p,role:"wall"}:p),m=Nt({objects:f},e)!==null;m&&(o.indoor=!0);let h=new Set,d=Ra(s,m,xa(e,u[0]?.plane.focal??n)<Hs,h),y=new Map(s.filter(p=>!p.authored).map(p=>[p.id,p])),b=u.map(({unit:p,plane:g,stage:R,planeSeats:A})=>p.objects.map(M=>{let x=M.type==="shape"&&!M.role&&M.id!==R?.shape.id?ye(M.label):null;if(M.type==="shape"&&!M.role&&M.id!==R?.shape.id&&(x==="wall"||!x&&Vo(M))&&M.type==="shape"){(o.roles??=[]).push({id:M.id,...g.floorId?{floorId:g.floorId}:{},role:"wall"});let{fill:E,...w}=M;return{...w,role:"wall"}}if(x&&M.type==="shape")return(o.roles??=[]).push({id:M.id,...g.floorId?{floorId:g.floorId}:{},role:x}),{...M,role:x};let P=R?.inferred&&M.id===R.shape.id&&M.type==="shape"?aa(M,R.outline,p.objects,A):null;if(P&&M.type==="shape")return o.stage?.id===M.id&&(o.stage.field=P),{...M,role:"stage",stageKind:P};let _=M.type==="shape"&&M.id===R?.shape.id&&M.heightM===void 0&&!M.stageKind&&s.some(E=>E.plane===g&&(h.has(E.id)||E.level===0&&E.facesAction&&E.rake<=Vs&&(E.frontDistance+E.backD-E.frontD)*$>=Zs)),O=_?{heightM:Ks}:{};if(R?.inferred&&M.id===R.shape.id&&M.type==="shape"&&dn(R.outline)*$*$<=de)return o.stage?.id===M.id&&(o.stage.deck=!0),{...M,role:"stage",...O};if(_&&M.type==="shape"&&M.role==="stage")return{...M,...O};let C=M.type==="section"?y.get(M.id):void 0;if(!C||M.type!=="section")return M;let F=C.rowCount>=2&&C.rake>0;l.has(C.id)?o.looseRowBlocks=(o.looseRowBlocks??0)+1:o.sections.push({id:C.id,floorId:g.floorId,surfaceKind:F?"rakedRows":"flat",height:C.height,rake:C.rake,stackedOn:d.get(C.id)});let k={status:"inferred",source:"public-2d-topology",note:ca};return{...M,height:C.height,rake:C.rake,surfaceKind:F?"rakedRows":"flat",physical3dProvenance:{height:k,rake:k,surfaceKind:k}}}));if(t.floors?.length){let p=t.floors.map((g,R)=>({...g,objects:b[R],focalPoint:u[R].plane.focal}));return{doc:{...t,floors:p,objects:p[0].objects,focalPoint:p[0].focalPoint},report:o}}return{doc:{...t,objects:b[0],focalPoint:u[0].plane.focal},report:o}}function hf(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 yf(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 Sa=1.15,Pa=2.75,Ia=4.5,_a=.85,Aa=.5,Ea=.26;function df(t,n,e){let r=Math.max(1e-6,n),o=t/r,a=e?.hasZoneLabels??!0,i=new Set(["stage","gate"]);return o>=.75&&i.add("floor"),o>=Sa&&i.add("zone"),o<=(a?Pa:Ia)&&(i.add("section"),i.add("ga")),o<=_a&&(i.add("annotation"),i.add("booth")),o<=Aa&&i.add("row"),o<=Ea&&i.add("seat"),i}function pf(t,n,e,r,o,a=6){let i=a+n,s=r-a-n,c=a+e,l=o-a-e;return{...t,x:i>s?r/2:Math.max(i,Math.min(s,t.x)),y:c>l?o/2:Math.max(c,Math.min(l,t.y))}}function xf(t,n,e,r){let o=t,a=n[0],i=n[1],s=n[2],c=o[0]*a+o[4]*i+o[8]*s+o[12],l=o[1]*a+o[5]*i+o[9]*s+o[13],u=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=c/f,h=l/f,d=u/f,y=m>=-1.05&&m<=1.05&&h>=-1.05&&h<=1.05&&d<=1;return{x:(m*.5+.5)*e,y:(1-(h*.5+.5))*r,depth:d,visible:y}}function bf(t,n,e=n,r=()=>0){let o=[],a=[...t].sort((i,s)=>r(s)-r(i)||i.screen.depth-s.screen.depth);for(let i of a){let s=!1;for(let c of o)if(Se(i,c,n,e)){s=!0;break}s||o.push(i)}return o}var wa=6;function Se(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+wa):e;return o<i&&a<r}function gf(t,n,e){return t.length*n*.58+(e?14:0)}var Ba={row:8,seat:14};function Mf(t){return t<480?{row:5,seat:8}:t<768?{row:6,seat:10}:Ba}function Rf(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 Sf(t,n,e,r,o=[]){let a=[...t].sort((s,c)=>(c.priority??0)-(s.priority??0)||s.focus-c.focus),i=[];for(let s of a){if(i.length>=r)break;let c=!1;for(let l of o)if(Se(s,l,n,e)){c=!0;break}if(!c){for(let l of i)if(Se(s,l,n,e)){c=!0;break}}c||i.push(s)}return i}function Pf(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 nn(t,n,e){if(t.length!==4||e<=n)return null;let r=bt(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),c=Math.min(.065/a,.2);return{quad:r,side:i,face:c,opening:dt(r,i,1-i),openingTop:e-s}}function Pe(t,n,e){if(t.length!==4||e-n<=.2)return null;let r=bt(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=dt(r,i,1-i);return{quad:r,side:i,trim:a,inner:s,panel:hn(s,.15,.85),bottom:n+a,top:e-a}}function rr(t,n,e,r){let o=Pe(t,n,e);if(!o)return;let{panel:a}=o,i=(g,R)=>({x:(g.x+R.x)/2,y:(g.y+R.y)/2}),s=i(a[0],a[1]),c=i(a[3],a[2]),l=Math.hypot(s.x-r.x,s.y-r.y)<=Math.hypot(c.x-r.x,c.y-r.y),[u,f]=l?[a[0],a[1]]:[a[3],a[2]],m=l?{x:s.x-c.x,y:s.y-c.y}:{x:c.x-s.x,y:c.y-s.y},h=Math.hypot(m.x,m.y);if(h<1e-6)return;-(f.y-u.y)*m.x+(f.x-u.x)*m.y<0&&([u,f]=[f,u]);let d=Math.min(.006,h*S*.05),y=m.x/h*d,b=m.y/h*d,p=(g,R)=>[g.x*S+y,R,g.y*S+b];return[p(u,o.bottom),p(f,o.bottom),p(u,o.top),p(f,o.top)]}import Oa from"polygon-clipping";import Ta from"polygon-clipping";function Ot(t,n,e,r,o,a,i,s={}){let c=Tt(n),l=s.ao??K,u=o.flatMap(y=>{if(y.role!=="entrance"&&y.role!=="exit")return[];let b=ct(y);if(!b||b.length!==4||!qt(c,Tt(b)))return[];let p=s.portalBase??e,g=nn(b,p,p+_t(y).heightM);if(!g)return[];let R=Math.min(r,g.openingTop);return R<=e?[]:[{poly:g.opening,height:R}]});if(!u.length)return!1;let f=y=>y.map(b=>[b.x,b.y]),m=[f(n),...(s.holes??[]).map(f)],h=[e,...new Set(u.map(y=>y.height)),r].sort((y,b)=>y-b),d=[];try{for(let y=1;y<h.length;y++){let b=h[y-1],p=h[y];if(p-b<1e-6)continue;let g=u.filter(A=>A.height>b+1e-6).map(A=>[f(A.poly)]),R=g.length?Ta.difference(m,...g):[m];d.push({low:b,high:p,polys:R})}}catch{return!1}for(let y of d)for(let b of y.polys){let[p,...g]=b.map(A=>A.map(([M,x])=>({x:M,y:x}))),R=A=>l.wallBottom+(l.top-l.wallBottom)*(A-e)/(r-e);Z(t,p,g,()=>y.high,y.low,a,i,{...l,top:R(y.high),wallBottom:R(y.low)})}return!0}var Ie={depthM:1.6,thicknessM:.35,minWallM:6};function Un(t,n,e,r,o,a,i,s,c){let l=r-e;if(l<=0)return;let u=s&&(c??l)>=Ie.minWallM?Ca(n,s):null,f=u?r-Ie.thicknessM:r,m=f-e,h=m<1.5?[[e,f,1]]:u?[[e,e+Math.min(.9,m*.18),.82],[e+Math.min(.9,m*.18),f,1]]:[[e,e+Math.min(.9,m*.18),.82],[e+Math.min(.9,m*.18),f-.1,1],[f-.1,f,1.1]],d=y=>K.wallBottom+(K.top-K.wallBottom)*(y-e)/l;for(let[y,b,p]of h){let g={...K,top:d(b),wallBottom:d(y)},R=V(a,p),A=V(i,p);Ot(t,n,y,b,o,R,A,{portalBase:e,ao:g})||Z(t,n,void 0,()=>b,y,R,A,g)}for(let[y,...b]of u??[])Z(t,y,b.length?b:void 0,()=>r,f,V(a,1.12),V(i,.78),K)}function Ca(t,n){let e=Ie.depthM/S,r=t.map(i=>{let s=n.x-i.x,c=n.y-i.y,l=Math.hypot(s,c)||1;return{x:i.x+s/l*e,y:i.y+c/l*e}}),o=i=>{let s=i.map(c=>[c.x,c.y]);return s.push(s[0]),s},a=[[o(t)],[o(r)]];for(let i=0;i<t.length;i++){let s=(i+1)%t.length;a.push([o([t[i],t[s],r[s],r[i]])])}try{let[i,...s]=a,c=Oa.union(i,...s);return c.length?c.map(l=>l.map(u=>u.slice(0,-1).map(([f,m])=>({x:f,y:m})))):null}catch{return null}}function pn(t,n,e){let r=it(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?Jt(n.points??[],n.rotation):ct(n);if(!i||i.length<2)return;let s=o*.5,c=so(n)?co(i,...ao(o)):Array.from({length:a?i.length-1:i.length},(l,u)=>[i[u],i[(u+1)%i.length]]);for(let[l,u]of c){let f=Math.hypot(u.x-l.x,u.y-l.y);if(f<1e-6)continue;let m=-(u.y-l.y)/f*s,h=(u.x-l.x)/f*s,d=[(l.x+m)*S,e,(l.y+h)*S],y=[(u.x+m)*S,e,(u.y+h)*S],b=[(u.x-m)*S,e,(u.y-h)*S],p=[(l.x-m)*S,e,(l.y-h)*S];t.tri(d,y,b,[0,1,0],r),t.tri(d,b,p,[0,1,0],r)}}function ir(t){return t==="bar"||t==="concession"||t==="coat"||t==="restroom"}var en=(t,n,e)=>({x:t.x+(n.x-t.x)*e,y:t.y+(n.y-t.y)*e});function Wn(t,n,e,r){let[o,a,i,s]=n?t:[t[3],t[2],t[1],t[0]];return[en(o,s,e),en(a,i,e),en(a,i,r),en(o,s,r)]}function sr(t,n,e,r,o,a,i,s,c=!1){if(e.length!==4||o-r<.4)return!1;let l=P=>c?Math.min(P,o):P,u=bt(e),f=Math.hypot(u[3].x-u[0].x,u[3].y-u[0].y)*S;if(f<.4)return!1;let m=en(u[0],u[1],.5),h=en(u[3],u[2],.5),d=Math.hypot(m.x-s.x,m.y-s.y)<=Math.hypot(h.x-s.x,h.y-s.y),y=at(i,[.92,.9,.86],.35),b=V(a,.72),p=o-r;if(n==="restroom"){let P=Math.min(.18,p*.08);return ot(t,u,o-P,r,i,a),ot(t,u,o,o-P,y,y),!0}let g=r+Math.min(1.1,p),R=n==="coat"?1:Math.min(.5,.75/f),A=Wn(u,d,0,R);if(ot(t,A,g-.05,r,b,a),ot(t,A,g,g-.05,y,y),n==="coat"||f<1.2)return!0;if(n==="bar"){let P=Wn(u,d,Math.max(R+.2,1-.45/f),1),_=l(r+Math.max(Math.min(2.2,p*2),g-r+.6));return ot(t,P,_,r,i,b),!0}let M=Wn(u,d,Math.max(R+.25,.55),1),x=l(r+Math.max(2.6,g-r+1.4));if(x-.14<=g)return!0;ot(t,M,x-.14,r,i,a),ot(t,u,x,x-.14,y,b);let I=Math.min(.08,.1/Math.max(.1,Math.hypot(u[1].x-u[0].x,u[1].y-u[0].y)*S));for(let[P,_]of[[0,I],[1-I,1]])ot(t,Wn(dt(u,P,_),d,0,Math.min(.08,.1/f)),x-.14,g,b,b);return!0}var Gt=.06,ka=.05,cr=.05,ar=.15,_e=25;function lr(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),c=new Map,l=[],u=new Set;for(let m=0;m<t.length;m+=1){let h=t[m];for(let d of h.objects){if(d.type==="table"&&u.add(d.id),d.type!=="section"||!d.outline||d.outline.length<3)continue;let y=It(d.outline,Pt);c.set(d.id,{section:d,unit:h,frontU:1/0,hasSeats:!1,rows:new Map,seatIndices:[]}),l.push({id:d.id,floorIndex:m,box:Tt(y),section:d,unit:h,outline:y})}}let f=new Map;for(let m of l){let h=f.get(m.floorIndex);h?h.push(m):f.set(m.floorIndex,[m])}for(let m=0;m<n.length;m++){let h=n[m],d=e?f.get(e[m])??[]:l,y=h.sectionId?d.find(p=>p.id===h.sectionId)??d.find(p=>p.section.logicalSectionId===h.sectionId&&St({x:h.x,y:h.y},p.outline,p.section.holes)):void 0,b=y?[y]:d;for(let p of b){if(e&&p.floorIndex!==e[m]||!y&&(h.x<p.box.minX||h.x>p.box.maxX||h.y<p.box.minY||h.y>p.box.maxY||!St({x:h.x,y:h.y},p.outline,p.section.holes)))continue;o[m]=p.id;let g=c.get(p.id);g.hasSeats=!0;let R=h.focalPoint??p.unit.focal,A=Math.hypot(h.x-R.x,h.y-R.y);A<g.frontU&&(g.frontU=A),g.seatIndices.push(m);let M=h.rowId||`__seat-${m}`,x=g.rows.get(M);x?x.push({x:h.x,y:h.y}):g.rows.set(M,[{x:h.x,y:h.y}]);break}}for(let[m,h]of c){let d=Vt(h.section,{floorBaseHeightM:h.unit.baseHeightM}),y=h.unit.baseHeightM,b=d.rake>0?Math.tan(d.rake*Math.PI/180):0,p=d.rake<=.01&&d.height<=y+.001,g=h.section.surfaceKind,R=g==="flat"?!0:g==="rakedRows"&&d.rake>.01?!1:p,A=h.hasSeats?Ze(m,n,h.seatIndices,h.unit.focal):{sectionId:m,rows:[],blockCount:0},x=A.rows.length<2?lo([...h.rows.values()].map(T=>({points:T})),h.unit.focal):null,I=1/0;if(x){if(h.hasSeats)for(let T of h.rows.values())for(let v of T){let H=x.depthAt(v.x,v.y);H<I&&(I=H)}if(!h.hasSeats||!Number.isFinite(I)){I=1/0;for(let T of h.section.outline){let v=x.depthAt(T.x,T.y);v<I&&(I=v)}}}let P=y+ka,_=Math.max(P,d.height),O=T=>{let v=Math.max(0,T-I)*$,H=Math.min(v*b,_e);return Math.max(P,d.height+H)},C=T=>{let v=Math.max(0,T)*$,H=Math.min(v*b,_e);return Math.max(P,d.height+H)},F=R?[]:A.rows.map(T=>({pts:T.pts,y:C(T.blockDepth),depth:T.blockDepth,blockId:T.blockId,...u.has(T.id)?{patch:Co(T.pts,Pt)}:{}})),k=F.length?F[0].y:_,E=F.map(T=>{let v=T.patch&&T.patch.length>=3?T.patch:T.pts,H=0,j=0;for(let X of v)H+=X.x,j+=X.y;let D=v.length||1;H/=D,j/=D;let U=0;for(let X of v){let Y=Math.hypot(X.x-H,X.y-j);Y>U&&(U=Y)}return{cx:H,cy:j,rad:U}}),w=R?()=>_:F.length>=2?(T,v)=>{let H=1/0,j=k;for(let D=0;D<F.length;D++){let U=E[D];if(Math.hypot(T-U.cx,v-U.cy)-U.rad>=H)continue;let X=F[D].patch,Y=X&&X.length>=3?xt(X,T,v)?0:An(X,T,v):An(F[D].pts,T,v);Y<H&&(H=Y,j=F[D].y)}return j}:(T,v)=>x?O(x.depthAt(T,v)):_,B=[0,1,0],L=F.length>=2||R?()=>B:(T,v)=>{if(!x)return B;let H=x.depthAt(T,v);if(H<=I)return B;let j=(H-I)*$;if(j*b>=_e||d.height+j*b<=P)return B;let[D,U]=x.gradientAt(T,v);if(D===0&&U===0)return B;let X=1/Math.hypot(b,1);return[-D*b*X,X,-U*b*X]};if(!R)for(let T of A.rows){let v=C(T.blockDepth);for(let H of T.seatIndices)i[H]=v}for(let T of A.rows){let v=[];for(let X=1;X<T.pts.length;X++){let Y=Math.hypot(T.pts[X].x-T.pts[X-1].x,T.pts[X].y-T.pts[X-1].y);Y>1e-6&&v.push(Y)}v.sort((X,Y)=>X-Y);let H=v.length?v[Math.floor(v.length/2)]:1/0,j=1/0,D=T.pts[Math.floor(T.pts.length/2)];if(D)for(let X of A.rows){if(X===T||X.blockId!==T.blockId)continue;let Y=An(X.pts,D.x,D.y);Y>1e-6&&Y<j&&(j=Y)}let U=Math.min(H,Math.max(j,H*.5));if(Number.isFinite(U)&&U>0)for(let X of T.seatIndices)s[X]=U}r.set(m,{sectionId:m,deckAt:w,normalAt:L,flat:R,bottomY:y,rowLevels:F,landingY:k})}for(let m=0;m<n.length;m++){let h=o[m],d=n[m];if(h){let p=i[m];a[m]=(p??r.get(h).deckAt(d.x,d.y))+ar;continue}let y=d.eyeHeightM,b=Number.isFinite(y)?Math.max(0,y-_n):0;a[m]=d.kind==="booth"?b+Gt+ar:b}return{bySection:r,seatOwner:o,seatDeckY:m=>a[m],seatPitchU:m=>s[m]}}var Fa=[.12,.38,.16],La=[.72,.62,.45],va=[.88,.93,.96],ur=[.95,.95,.94],Na=[.66,.29,.22],Ae={length:20.12,width:3.05},Ga=.14,Da=9.76,Ct=[.93,.94,.95],Yn=[.1,.11,.13],Ha=[.45,.85,1.25],Xa=1.45,fr=.012,mr=.004,ja=1.07,Ua=.15;function rn(t,n,e,r,o,a){t.setMaterial(a),Z(t,n,e?[e.slice().reverse()]:void 0,()=>r,r-.004,o,o,K)}var hr=(t,n)=>Lt(t,n/S);function yr(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 Wa(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 zn(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}];Z(t,s,void 0,()=>o,r,a,V(a,.85),K)}function on(t,n,e,r,o,a,i){let s=yr(n,e,r/S);s&&Z(t,s,void 0,()=>a,o,i,V(i,.85),K)}function Kn(t){let n=bt(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:(c,l)=>({x:e.x+(a.x*c+i.x*l)/S,y:e.y+(a.y*c+i.y*l)/S}),lengthM:r*S,widthM:o*S}}function dr(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 R of n.points??[])o=Math.min(o,R.x),a=Math.max(a,R.x),i=Math.min(i,R.y),s=Math.max(s,R.y);let c=(n.rotation??0)*Math.PI/180,l=Math.cos(c),u=Math.sin(c),f=(o+a)/2,m=(i+s)/2,h=R=>c?{x:f+(R.x-f)*l-(R.y-m)*u,y:m+(R.x-f)*u+(R.y-m)*l}:R,d=Math.min(a-o,s-i)*S,y=Math.max(.04,Math.min(.3,d*.004))/S,b=0;t.setMaterial(0);for(let R of r){if(!R.fill)continue;let A=R.points.map(h);rn(t,A,null,e+fr+b*mr,it(R.fill)??Ct,0),b++}let p=r.filter(R=>!(R.fill&&R.ink===R.fill)),g=[...new Set(p.map(R=>R.ink??oe))];for(let R of g){let A=e+fr+b++*mr,M=it(R)??Ct;for(let x of p){if((x.ink??oe)!==R)continue;let I=x.points.map(h),P=x.closed?I.length:I.length-1;for(let _=0;_<P;_++){let O=yr(I[_],I[(_+1)%I.length],y);O&&Wa(t,O,A,M)}}}}function pr(t,n,e,r,o){if(n.length<3)return!1;let a=r+.006,i=o??Fa;if(e==="oval-cricket"){let s=n.reduce((M,x)=>M+x.x,0)/n.length,c=n.reduce((M,x)=>M+x.y,0)/n.length,l=M=>n.map(x=>({x:s+(x.x-s)*M,y:c+(x.y-c)*M})),u=8;for(let M=0;M<u;M++){let x=l(1-M/u),I=M===u-1?null:l(1-(M+1)/u);rn(t,x,I,a,V(i,M%2?1.04:.96),4)}let f=n[0];for(let M of n)Math.hypot(M.x-s,M.y-c)>Math.hypot(f.x-s,f.y-c)&&(f=M);let m=Math.hypot(f.x-s,f.y-c)||1,h=(f.x-s)/m,d=(f.y-c)/m,y=-d,b=h,p=Math.min(1,2*m*S*Ga/Ae.length),g=Ae.length*p/2/S,R=Ae.width*p/2/S,A=[[-g,-R],[g,-R],[g,R],[-g,R]].map(([M,x])=>({x:s+h*M+y*x,y:c+d*M+b*x}));return rn(t,A,null,a+.004,La,0),t.setMaterial(0),!0}if(e==="rink-hockey"){let s=hr(n,Ua);return rn(t,s,null,a,va,0),t.setMaterial(0),Z(t,n,[s.slice().reverse()],()=>r+ja,r,ur,V(ur,.9),K),!0}if(e==="ring-boxing"&&n.length===4){let{at:s}=Kn(n),c=[s(-3.05,-3.05),s(3.05,-3.05),s(3.05,3.05),s(-3.05,3.05)],l=[[.77,.19,.19],Ct,[.17,.42,.69],Ct];t.setMaterial(0),c.forEach((u,f)=>zn(t,u,.07,r,r+Xa,l[f]));for(let u of Ha)for(let f=0;f<4;f++)on(t,c[f],c[(f+1)%4],.025,r+u-.025,r+u+.025,Ct);return!0}if(e==="court-tennis"&&n.length===4){let{at:s}=Kn(n);t.setMaterial(0),on(t,s(0,-6.4),s(0,6.4),.015,r,r+.95,Yn),on(t,s(0,-6.4),s(0,6.4),.03,r+.95,r+1,Ct);for(let c of[-1,1])zn(t,s(0,c*6.4),.05,r,r+1.07,Yn);return!0}if(e==="court-basketball"&&n.length===4){let{at:s,lengthM:c}=Kn(n),l=Math.min(14,c/2-.5);t.setMaterial(0);for(let u of[-1,1]){let f=s(u*(l+1.2),0),m=s(u*(l-1.2),0);zn(t,f,.12,r,r+3.4,Yn),on(t,f,m,.06,r+3.25,r+3.4,Yn),on(t,s(u*(l-1.2),-.9),s(u*(l-1.2),.9),.03,r+2.9,r+3.95,Ct)}return!0}if(e==="pitch-rugby"&&n.length===4){let{at:s,lengthM:c}=Kn(n),l=c*(50/120);t.setMaterial(0);for(let u of[-1,1]){for(let f of[-2.8,2.8])zn(t,s(u*l,f),.07,r,r+12,Ct);on(t,s(u*l,-2.8),s(u*l,2.8),.06,r+2.94,r+3.06,Ct)}return!0}if(e==="track-athletics"){let s=hr(n,Da);return s.length<3?!1:(rn(t,n,s,a,Na,0),rn(t,s,null,a,i,4),t.setMaterial(0),!0)}return!1}var xr=[.19,.4,.15],Ya=.012,$n=2.4,za=1,Ka=.75,Va=.15;function At(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),c=e/2,l=r/2;return[[-c,-l],[c,-l],[c,l],[-c,l]].map(([u,f])=>({x:n.x+u*i-f*s,y:n.y+u*s+f*i}))}function Ir(t,n,e,r,o,a,i=!1){let s=At(n);if(s){if(i){let c=Wt(r,o.boothTop),l=wt([...s]);Z(t,It(l,Za/S),[l.slice().reverse()],()=>e+.03,e,c,V(c,.8),K);return}if(!(!n.points&&a&&$a(t,s,e,r,a))){if(!n.points&&a&&s.length===4){qa(t,s,e,r,a);return}Z(t,s,void 0,()=>e+$n,e,Wt(r,o.boothTop),o.boothWall,K)}}}var Ee=1.1,br=[.9,.9,.88],Za=.1,Vn=[.87,.87,.85],gr=.08;function _r(t,n){let e=c=>({x:(t[c].x+t[(c+1)%4].x)/2,y:(t[c].y+t[(c+1)%4].y)/2}),r=0,o=1/0;for(let c=0;c<4;c++){let l=e(c),u=Math.hypot(l.x-n.x,l.y-n.y);u<o&&(o=u,r=c)}let a=[0,1,2,3].map(c=>t[(r+c)%4]),i=(c,l,u)=>({x:c.x+(l.x-c.x)*u,y:c.y+(l.y-c.y)*u});return{q:a,part:(c,l,u,f)=>{let m=i(a[0],a[1],c),h=i(a[0],a[1],l),d=i(a[3],a[2],c),y=i(a[3],a[2],l);return[i(m,d,u),i(h,y,u),i(h,y,f),i(m,d,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 qa(t,n,e,r,o){let{q:a,part:i}=_r(n,o),s=r??[.35,.42,.55],c=at(s,[.78,.78,.77],.62),l=at(s,[.95,.95,.94],.45);ot(t,a,e+Gt,e,c,V(c,.8)),ot(t,i(.05,.95,.72,.98),e+Ee-.05,e+Gt,l,V(l,.8)),ot(t,i(.03,.97,.7,1),e+Ee,e+Ee-.05,br,V(br,.9))}function $a(t,n,e,r,o){if(n.length!==4)return!1;let{q:a,part:i,depthM:s,widthM:c}=_r(n,o);if(s<1||c<1)return!1;let l=r??[.35,.42,.55],u=at(l,[.78,.78,.77],.62),f=e+$n,m=gr/c,h=gr/s;ot(t,a,e+Gt,e,u,V(u,.8)),ot(t,i(0,1,1-h,1),f,e+Gt,Vn,V(Vn,.9));for(let[b,p]of[[0,m],[1-m,1]])ot(t,i(b,p,0,1-h),f,e+Gt,Vn,V(Vn,.9));ot(t,i(m,1-m,0,Math.min(.5,.06/s)),f,f-.3,l,V(l,.85));let d=Math.min(.4,.6/c),y=Math.min(.12,.3/s);return ot(t,i(.5-d,.5+d,.72-y,.72+y),e+za,e+Gt,at(l,[.95,.95,.94],.7),V(l,.75)),!0}function Qn(t){if(t.shape==="round"){let u=t.radius;return u?Gn(t.center.x,t.center.y,u,u,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),c=n/2,l=e/2;return[[-c,-l],[c,-l],[c,l],[-c,l]].map(([u,f])=>({x:o.x+u*i-f*s,y:o.y+u*s+f*i}))}function Ar(t,n,e,r,o,a=!0){let i=Qn(n);if(!i)return;let s=i.reduce((m,h)=>m+h.x,0)/i.length,c=i.reduce((m,h)=>m+h.y,0)/i.length,l=m=>i.map(h=>({x:s+(h.x-s)*m,y:c+(h.y-c)*m})),u=a&&r?Wt(r,o.tableTop):Qa,f=e+Ka;Z(t,i,void 0,()=>f,e+Ja,u,V(u,.86),K),Z(t,l(.12),void 0,()=>f+.12,f,Mr,V(Mr,.8),K)}var Qa=[.93,.92,.89],Mr=[.78,.66,.42],Ja=.25,xn={armM:1.1,widthM:.28,insideM:1.4,low:.043,high:.048};function tc(t,n,e){let r=t.reduce((p,g)=>p+g.x,0)/4,o=t.reduce((p,g)=>p+g.y,0)/4,a=t[3].x-t[0].x,i=t[3].y-t[0].y,s=Math.hypot(a,i)||1;a/=s,i/=s,a*(n.x-r)+i*(n.y-o)<0&&(a=-a,i=-i);let c=-i,l=a,u=xn.armM/S,f=xn.widthM/S,m=s/2+xn.insideM/S,h=e?-1:1,d=r+a*(m+(e?0:u)),y=o+i*(m+(e?0:u)),b=(p,g)=>({x:d+a*p*h+c*g,y:y+i*p*h+l*g});return[b(0,0),b(-u,u),b(-u-f,u),b(-f,0),b(-u-f,-u),b(-u,-u)]}function nc(t,n,e,r,o){let a=[.94,.95,.96];Z(t,tc(n,r,o),void 0,()=>e+xn.high,e+xn.low,a,a,K)}function qn(t,n){let e=it(t);return e?{top:V(Et(e,.12),.95),wall:V(Et(e,.12),.85)}:{top:n.tierTop,wall:n.tierWall}}function Er(t,n,e,r,o,a,i,s,c=[]){let l=ct(n),u=Wo(n);if(!n.role&&(!n.fill||n.fill==="none"||n.fill==="transparent")||!l){pn(t,n,e+r+Ya);return}let m=s?s.kind==="stage":n.role==="stage",h=s?s.kind==="screen":n.role==="screen",d=s?{kind:m?"stage":"solid",heightM:s.topY-s.baseY}:_t(n),y=s?.baseY??e,b=s?.topY??e+r;if(m&&i){let F=1/0,k=-1/0,E=1/0,w=-1/0;for(let B of l)B.x<F&&(F=B.x),B.x>k&&(k=B.x),B.y<E&&(E=B.y),B.y>w&&(w=B.y);i.push({cx:(F+k)/2*S,cz:(E+w)/2*S,y:b,halfX:Math.max((k-F)/2*S,.5),halfZ:Math.max((w-E)/2*S,.5)})}let p=it(n.fill),g=n.role==="wall"||n.role==="entrance"||n.role==="exit",R=g?qn(n.fill,o).top:m&&p?at(o.stageTop,V(Et(p,.18),.9),.9):!n.role&&p?p:Wt(p,m?o.stageTop:o.decorTop),A=h?p:null,M=g?qn(n.fill,o).wall:m?p?at(o.stageWall,V(p,.58),.82):o.stageWall:h?A?at(V(A,1.42),[.24,.46,.82],.08):[.24,.46,.82]:Wt(it(n.fill),o.decorWall),x=m&&Fn(o)?jt(!0):null,I=x?Pr(R,x.stageTop):R,P=x?Pr(M,x.stageWall):M;if(n.role==="wall"&&!s){Un(t,l,y,b,c,I,P,a),pn(t,n,b+.012);return}if(h&&l.length===4&&b-y>.2){let F=Pe(l,y,b);if(!F)return;let{quad:k,side:E,trim:w,inner:B,panel:L}=F,T=[.12,.15,.18];for(let[v,H]of[[0,E],[1-E,1]])ot(t,dt(k,v,H),b,y,T,T);ot(t,B,y+w,y,T,T),ot(t,B,b,b-w,T,T),ot(t,L,b-w,y+w,P,P),pn(t,n,b+.012);return}let _=p?V(Et(p,.15),.82):P,O=p?V(Et(p,.1),1.02):I;if(ir(n.role)&&!s&&sr(t,n.role,l,y,b,_,O,a,n.heightM!==void 0))return;if((n.role==="sound"||s?.kind==="sound_desk")&&l.length===4&&b-y>.3){let F=bt(l),k=Math.hypot(F[1].x-F[0].x,F[1].y-F[0].y)*S,E=Math.min(.12,.09/Math.max(k,.001)),w=[.18,.21,.24],B=b-Math.min(.12,(b-y)*.15);for(let[L,T]of[[0,E],[1-E,1]])ot(t,dt(F,L,T),B,y,w,w);ot(t,F,b,B,I,w);return}if(n.role==="rail"&&l.length===4&&b>y){let F=bt(l),k=Math.hypot(F[1].x-F[0].x,F[1].y-F[0].y)*S,E=Math.max(1,Math.min(128,Math.ceil(k/1.4))),w=Math.min(.08,.055/Math.max(.055,k)),B=[.58,.64,.66];for(let L=0;L<=E;L++){let T=L/E,v=Math.min(1-w,Math.max(0,T-w/2));ot(t,dt(F,v,v+w),b,y,B,V(B,.8))}for(let L of[.52,1]){let T=y+(b-y)*L;ot(t,F,T,Math.max(y,T-.055),B,V(B,.8))}return}if(n.role==="goal"&&l.length===4){let F=bt(l),k=Math.hypot(F[1].x-F[0].x,F[1].y-F[0].y)*S,E=Math.min(.12,.1/Math.max(.1,k)),w=[.9,.94,.94];for(let[B,L]of[[0,E],[1-E,1]])ot(t,dt(F,B,L),Math.max(y,b-.1),y,w,w);ot(t,F,b,Math.max(y,b-.1),w,w);return}if(d.kind==="portal"&&l.length===4){let F=nn(l,y,b);if(!F)return;let{quad:k,side:E,face:w,openingTop:B}=F;for(let[L,T,v]of[[0,w,1],[w,1-w,.67],[1-w,1,1]]){let H=hn(k,L,T),j=V(I,v),D=V(P,v);for(let[U,X]of[[0,E],[1-E,1]])ot(t,dt(H,U,X),B,y,j,D);ot(t,H,b,B,j,D)}(n.role==="entrance"||n.role==="exit")&&nc(t,k,y,a,n.role==="exit");return}if(d.kind==="suite"&&l.length===4){let F=l.map((w,B)=>{let L=l[(B+1)%4],T=(w.x+L.x)/2,v=(w.y+L.y)/2;return Math.hypot(T-a.x,v-a.y)}),k=F.indexOf(Math.min(...F)),E=[0,1,2,3].map(w=>l[(k+w)%4]);ot(t,dt(E,0,.08),b,y,I,P),ot(t,dt(E,.92,1),b,y,I,P),ot(t,hn(E,.88,1),b,y,I,P),ot(t,E,b,Math.max(y,b-.18),I,P);return}if(m&&!n.stageKind?.startsWith("pitch-")&&b-y>.12){let F=b-Math.min(.06,(b-y)*.15);ot(t,l,F,y,I,P,u),ot(t,l,b,F,I,at(I,P,.2),u)}else ot(t,l,b,y,I,P,u);if((n.stageKind==="pitch-football"||n.stageKind==="pitch-rugby")&&l.length===4){t.setMaterial(4);let F=bt(l),k=at(p??xr,xr,p?.45:0);for(let E=0;E<12;E++){let w=dt(F,E/12,(E+1)/12),B=V(k,E%2?1.09:.91),L=w.map(T=>[T.x*S,b+.006,T.y*S]);t.tri(L[0],L[1],L[2],[0,1,0],B),t.tri(L[0],L[2],L[3],[0,1,0],B)}}n.stageKind&&n.stageKind!=="pitch-football"&&pr(t,l,n.stageKind,b,p),m&&Zt(n.stageKind)&&dr(t,n,b),t.setMaterial(h?1:0),pn(t,n,b+.012)}function Jn(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,c=Math.cos(s),l=Math.sin(s),u=r/2,f=o/2;return[[-u,-f],[u,-f],[u,f],[-u,f]].map(([m,h])=>({x:a+m*c-h*l,y:i+m*l+h*c}))}function ec(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 it(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 c=it(s[1].trim());c&&i.push(c)}return i.length?i.reduce((s,c,l)=>at(s,c,1/(l+1)),i[0]):null}function wr(t,n,e,r){if(n.layer==="foreground")return;let o=Jn(n);if(!o)return;let a=e+Va,i=Wt(ec(n.href),r.decorTop),s=Math.max(0,Math.min(1,n.opacity??1));s<1&&(i=at(r.ground,i,s)),Z(t,o,void 0,()=>a,e,i,at(i,r.decorWall,.5),K)}function Br(t,n,e,r,o){if(!n.points||n.points.length<3)return;let a=Io(r,o.gaTop);Z(t,n.points,n.holes,()=>e+Rr,e,a,o.gaWall,K),ic(t,n.points,e+Rr)}var Rr=.15,Zn=[.72,.74,.76],we=1.1,Sr=.12,Be=.05,oc=.06,rc=2.4;function ic(t,n,e){let r=wt([...n]),o=Lt(r,Sr/S),a=Lt(r,(Sr+Be)/S);if(o.length<3||a.length<3)return;for(let s of[e+we,e+we*.5])Z(t,o,[a.slice().reverse()],()=>s,s-Be,Zn,V(Zn,.85),K);let i=oc/2/S;for(let s=0;s<o.length;s++){let c=o[s],l=o[(s+1)%o.length],u=Math.hypot(l.x-c.x,l.y-c.y)*S,f=Math.max(1,Math.round(u/rc));for(let m=0;m<f;m++){let h=m/f,d=c.x+(l.x-c.x)*h,y=c.y+(l.y-c.y)*h,b=[{x:d-i,y:y-i},{x:d+i,y:y-i},{x:d+i,y:y+i},{x:d-i,y:y+i}];Z(t,b,void 0,()=>e+we-Be,e,Zn,V(Zn,.8),K)}}}function Pr(t,n){return On(t)<n?Xt(t,n):t}var sc=1.5,ac=30,cc=4,lc=3.6,uc=6,Te=15,fc=3,mc=1;function hc(t){return Math.max(lc,Math.min(uc,2.4+.15*t))}var bn=Math.PI*2;function yc(t,n){let e=0,r=0;for(let f of t)e+=f.x,r+=f.y;let o=Math.atan2(r/t.length-n.y,e/t.length-n.x),a=t.map(f=>{let m=Math.atan2(f.y-n.y,f.x-n.x)-o;for(;m>Math.PI;)m-=bn;for(;m<-Math.PI;)m+=bn;return m+o}),i=a.map((f,m)=>m).sort((f,m)=>a[f]-a[m]),s=a[i[0]],c=a[i[i.length-1]];if(c-s>Math.PI)return null;let l=f=>Math.hypot(f.x-n.x,f.y-n.y),u=f=>{let m=t[f],h=(f+t.length-1)%t.length,d=(f+1)%t.length,y=Math.abs(a[h]-a[f])<=Math.abs(a[d]-a[f])?h:d,b=t[y];return l(m)<=l(b)?[m,b]:[b,m]};return{start:s,end:c,startEdge:u(i[0]),endEdge:u(i[i.length-1])}}function Tr(t){return t.type==="shape"&&t.role==="wall"&&t.heightM===void 0}function Oe(t,n,e=()=>!0){let r=[];for(let c of t){if(!Tr(c)||!e(c))continue;let l=ct(c);if(!l||l.length<3)continue;let u=yc(l,n);if(!u)return[];r.push(u)}if(r.length<2)return[];let o=t.flatMap(c=>{if(c.type!=="shape"||c.role!=="entrance"&&c.role!=="exit")return[];let l=ct(c);if(!l?.length)return[];let u=0,f=0;for(let m of l)u+=m.x,f+=m.y;return[{x:u/l.length,y:f/l.length}]}),a=c=>(c%bn+bn)%bn;r.sort((c,l)=>a(c.start)-a(l.start));let i=c=>Math.hypot(c.x-n.x,c.y-n.y),s=[];for(let c=0;c<r.length;c++){let l=r[c],u=r[(c+1)%r.length],f=a(u.start-l.end);if(f<=0||f>=Math.PI/2)continue;let m=x=>a(x-l.end)<f;if(r.some(x=>x!==l&&x!==u&&(m(x.start)||m(x.end)||a(l.end-x.start)<x.end-x.start)))continue;let[d,y]=l.endEdge,[b,p]=u.startEdge,g={x:(d.x+y.x)/2,y:(d.y+y.y)/2},R={x:(b.x+p.x)/2,y:(b.y+p.y)/2},A=Math.hypot(R.x-g.x,R.y-g.y)*S;if(A<sc||A>ac||Math.abs(i(g)-i(R))*S>cc+.2*A)continue;let M={x:(g.x+R.x)/2,y:(g.y+R.y)/2};o.some(x=>m(Math.atan2(x.y-n.y,x.x-n.x))&&Math.abs(i(x)-i(M))*S<=fc)||s.push({quad:[d,y,p,b],mid:M,widthM:A,openingM:hc(A)})}return s}function Or(t,n){let e=[];for(let a of n)if(a.text?.trim())for(let i of t){let s=Math.hypot(a.position.x-i.mid.x,a.position.y-i.mid.y)*S;s<=Te&&e.push({text:a,gate:i,d:s})}e.sort((a,i)=>a.d-i.d);let r=new Map,o=new Set;for(let{text:a,gate:i}of e)r.has(a.id)||o.has(i)||(r.set(a.id,i),o.add(i));return r}function Cr(t,n,e,r,o,a,i,s=()=>!0){let c=Oe(n,tn(e),s);if(!c.length)return;let l=n.find(f=>Tr(f)&&s(f)),u=qn(l?.fill,i);t.setMaterial(jn);for(let f of c)o-f.openingM<mc||Un(t,f.quad,r+f.openingM,r+o,[],u.top,u.wall,a,o);t.setMaterial(0)}var dc=6,pc=2.2,te=.1,xc=/^(gate|entrance|entry|exit|way in|way out|door)s?$/i,bc=new Set(["stage","entrance","exit","screen","suite","obstruction","sound","bar","concession","restroom","coat"]),gc=.3,Mc=1.8,Rc=.9,Sc=.55,Pc=1,kr=4e3,Ic=6,Fr="#d8a425",_c="#e8c15a",Ce="#1c1608";function Lr(t){let n=Ac(t);if(!n)return null;let e=Qe(t).find(r=>r.icon===n.icon);return{...n,name:e?.titleFallback??n.icon}}function Ac(t){let n=t.accessibility;if(n?.length)return{icon:n.includes("wheelchair")?"wheelchair":n[0],color:In(n)};let e=t.commercial;return e?.obstructedView?{icon:"obstructedView",color:Fr,ink:Ce}:e?.restrictedView?{icon:"restrictedView",color:Fr,ink:Ce}:e?.premium?{icon:"premium",color:_c,ink:Ce}:null}function Ec(t,n){if(!t)return;let e,r=0;for(let[a,i]of t)i>r&&(r=i,e=a);let o=n.categories?.find(a=>a.key===e)?.color;return o&&/^#[0-9a-f]{6}$/i.test(o)?o:void 0}var wc=6e3,Bc=.25,vr=[-90,90,-135,135,-45,45];function Tc(t,n,e,r){let o=t.flatMap(({id:i,a:s,members:c})=>{let l=(s.minX+s.maxX)/2,u=(s.minY+s.maxY)/2,f=.5*Math.hypot(s.maxX-s.minX,s.maxY-s.minY),m=1/0;for(let h of c)m=Math.min(m,Math.hypot(n[h].x-l,n[h].y-u));return c.length&&m>=f*Bc?[{id:i,cx:l,cy:u,half:f,members:c}]:[]}).sort((i,s)=>i.half-s.half),a=new Map;return o.forEach(({id:i,cx:s,cy:c,members:l},u)=>{let f=r.x-s,m=r.y-c,y=(Math.hypot(f,m)>1e-6?Math.atan2(m,f):0)+vr[u%vr.length]*Math.PI/180,b=Math.cos(y),p=Math.sin(y),g=-1,R=-1/0;for(let A of l){let M=(n[A].x-s)*b+(n[A].y-c)*p;M>R&&(R=M,g=A)}a.set(i,[n[g].x*S,e.seatDeckY(g),n[g].y*S])}),a}function Gr(t){let{doc:n,units:e,seats:r,surfaces:o,focal:a}=t,i=n.zones??[],s=[];if(i.length){let c=new Map;for(let m of e)for(let h of m.objects)h.type==="section"&&h.zone&&c.set(h.id,h.zone);let l=new Map,u=new Map;for(let m=0;m<r.length;m++){let h=r[m],d=o.seatOwner[m],y=h.zoneId??(d?c.get(d):void 0);if(!y)continue;let b=l.get(y);b||(b={n:0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0,sumY:0},l.set(y,b));let p=u.get(y);p||u.set(y,p=[]),p.push(m),b.n++,h.x<b.minX&&(b.minX=h.x),h.y<b.minY&&(b.minY=h.y),h.x>b.maxX&&(b.maxX=h.x),h.y>b.maxY&&(b.maxY=h.y),b.sumY+=o.seatDeckY(m)}let f=Tc(i.flatMap(m=>{let h=l.get(m.id);return h?[{id:m.id,a:h,members:u.get(m.id)??[]}]:[]}),r,o,a);for(let m of i){let h=l.get(m.id),d=[];for(let[y,b]of c)b===m.id&&d.push(y);if(!h||h.n===0){s.push({id:m.id,label:m.label,color:it(m.color),sectionIds:d,seatCount:0,center:[0,0,0],radius:0,focalWorld:[(m.focalPoint??a).x*S,1.5,(m.focalPoint??a).y*S]});continue}s.push({id:m.id,label:m.label,color:it(m.color),sectionIds:d,seatCount:h.n,...f.has(m.id)?{labelAt:f.get(m.id)}:{},center:[(h.minX+h.maxX)/2*S,h.sumY/h.n,(h.minY+h.maxY)/2*S],radius:.5*Math.hypot((h.maxX-h.minX)*S,(h.maxY-h.minY)*S)||1,focalWorld:[(m.focalPoint??a).x*S,1.5,(m.focalPoint??a).y*S]})}}return s}function Dr(t){let{doc:n,units:e,seats:r,surfaces:o,seatData:a,hintedSeatFloor:i,zones:s,focal:c}=t,l=[],u=[],f=[],m=new Map;for(let h of e)for(let d of h.objects){if(d.type!=="section"||!d.zone)continue;let y=(d.displayLabel||d.label||"").trim().toLocaleLowerCase();if(!y)continue;let b=n.floors?.[h.index]?.name?.trim().toLocaleLowerCase();if(e.length>1&&b===y)continue;let p=m.get(d.zone);p||m.set(d.zone,p=new Set),p.add(y)}for(let h of s)h.seatCount!==0&&(m.get(h.id)?.has(h.label.trim().toLocaleLowerCase())||l.push({id:`zone:${h.id}`,kind:"zone",text:h.label,anchor:[(h.labelAt??h.center)[0],(h.labelAt??h.center)[1]+dc,(h.labelAt??h.center)[2]],color:n.zones?.find(d=>d.id===h.id)?.color}));{let h=new Map,d=new Map,y=new Map,b=new Map;for(let p=0;p<r.length;p++){let g=o.seatOwner[p];if(!g)continue;let R=h.get(g);R||(R={n:0,x:0,y:0,deck:0},h.set(g,R)),R.n++,R.x+=r[p].x,R.y+=r[p].y,R.deck+=o.seatDeckY(p);let A=r[p].categoryKey;if(A){let x=d.get(g);x||(x=new Map,d.set(g,x)),x.set(A,(x.get(A)??0)+1)}if(r[p].accessibility?.includes("wheelchair")){let x=y.get(g);x?x.push(p):y.set(g,[p])}let M=b.get(g);M||(M={minX:1/0,maxX:-1/0,minY:1/0,maxY:-1/0,minDeck:1/0,maxDeck:-1/0},b.set(g,M)),M.minDeck=Math.min(M.minDeck,o.seatDeckY(p)),M.maxDeck=Math.max(M.maxDeck,o.seatDeckY(p)),r[p].x<M.minX&&(M.minX=r[p].x),r[p].x>M.maxX&&(M.maxX=r[p].x),r[p].y<M.minY&&(M.minY=r[p].y),r[p].y>M.maxY&&(M.maxY=r[p].y)}for(let p of e)for(let g of p.objects){if(g.type!=="section"||$o(g))continue;let R=h.get(g.id);if(!R||R.n===0)continue;let A=b.get(g.id),M=[R.x/R.n*S,R.deck/R.n,R.y/R.n*S],x=g.displayLabel||g.label||g.id;u.push({id:g.id,floorIndex:p.index,label:x,seatCount:R.n,center:M,radius:Math.max(1,Math.hypot(A.maxX-A.minX,A.maxY-A.minY)*.5*S),box:{min:[A.minX*S-.4,A.minDeck,A.minY*S-.4],max:[A.maxX*S+.4,A.maxDeck+1,A.maxY*S+.4]},focalWorld:[p.focal.x*S,p.baseHeightM+1.5,p.focal.y*S]});let I=n.floors?.[p.index]?.name?.trim().toLocaleLowerCase();if(!(e.length>1&&I===x.trim().toLocaleLowerCase())){let P=Ec(d.get(g.id),n),_=y.get(g.id);l.push({id:`section:${g.id}`,kind:"section",text:x,anchor:[M[0],M[1]+pc,M[2]],floorIndex:p.index,...P?{tint:P}:{},..._?{wheelchairSeats:_}:{}})}}}{for(let M of e)for(let x of M.objects){if(x.type!=="gaArea")continue;let I=Kt(x.points);if(!I)continue;let P=x.labelPresentation?.visible===!1?"":x.displayLabel||x.label||x.id,_=x.capacity>0?[P,x.capacity.toLocaleString()].filter(Boolean).join(" \xB7 "):P;_&&l.push({id:`ga:${x.id}`,kind:"ga",text:_,anchor:[I.x*S,M.baseHeightM+Mc,I.y*S],floorIndex:M.index})}let h=new Map,d=new Map;for(let M of e)for(let x of M.objects)if(x.type==="section"&&h.set(x.id,x.displayLabel||x.label||x.id),x.type==="row"){let I=x.displayLabel?.trim()||x.segmentedRow?.displayLabel?.trim();I&&d.set(x.id,I)}let y=new Map;for(let M=0;M<r.length;M++){let x=r[M],I=Math.hypot(x.x-c.x,x.y-c.y),P=y.get(x.rowId);(!P||I>P.far)&&y.set(x.rowId,{seat:x,index:M,far:I})}for(let[M,x]of y){let I=o.seatOwner[x.index]??x.seat.sectionId,P=Nr(x.seat.label,M,h.get(I??""),d.get(M));P&&l.push({id:`row:${M}`,kind:"row",text:P,anchor:[x.seat.x*S,o.seatDeckY(x.index)+Rc,x.seat.y*S],floorIndex:i[x.index]})}let b=new Map;for(let M=0;M<r.length;M++){let x=r[M],I=b.get(x.rowId);I||(I={n:0,x:0,y:0,z:0,minX:1/0,maxX:-1/0,minZ:1/0,maxZ:-1/0,label:Nr(x.label,x.rowId,h.get(o.seatOwner[M]??x.sectionId??""),d.get(x.rowId)),sectionId:o.seatOwner[M]??x.sectionId},b.set(x.rowId,I));let P=M*3,_=a.iPosition[P],O=a.iPosition[P+1],C=a.iPosition[P+2];I.n++,I.x+=_,I.y+=O,I.z+=C,I.minX=Math.min(I.minX,_),I.maxX=Math.max(I.maxX,_),I.minZ=Math.min(I.minZ,C),I.maxZ=Math.max(I.maxZ,C)}for(let[M,x]of b)f.push({id:M,label:x.label,sectionId:x.sectionId,seatCount:x.n,center:[x.x/x.n,x.y/x.n,x.z/x.n],radius:Math.max(.8,Math.hypot(x.maxX-x.minX,x.maxZ-x.minZ)*.5)});let p=0,g=(M,x)=>{p++,l.push({id:`access:${r[M].id}`,kind:"access",text:x.name,icon:x.icon,color:x.color,...x.ink?{ink:x.ink}:{},seatWidthM:a.iChairWidth[M]*2,anchor:[r[M].x*S,o.seatDeckY(M)+Pc,r[M].y*S],floorIndex:i[M],rowId:r[M].rowId})},R=null,A=()=>{if(R){let M=Lr(r[R.seats[0]]),x=R.seats.length,I=Math.max(1,Math.round(x/Ic));for(let P=0;P<I&&p<kr;P++)g(R.seats[Math.min(x-1,Math.floor((P+.5)*x/I))],M)}R=null};for(let M=0;M<r.length&&p<kr;M++){let x=Lr(r[M]);if(x&&r[M].accessibility?.length){A(),g(M,x);continue}if(!x){A();continue}R&&R.rowId===r[M].rowId&&R.icon===x.icon?R.seats.push(M):(A(),R={rowId:r[M].rowId,icon:x.icon,seats:[M]})}if(A(),r.length<=wc)for(let M=0;M<r.length;M++){let x=r[M],I=Oc(x.displayLabel||x.label);I&&l.push({id:`seat:${x.id}`,kind:"seat",seatWidthM:a.iChairWidth[M]*2,text:I,anchor:[x.x*S,o.seatDeckY(M)+Sc,x.y*S],floorIndex:i[M],rowId:x.rowId})}}for(let h of e){let d=Nt(h,e.length===1?r:r.filter((p,g)=>i[g]===h.index)),y=d?Or(Oe(h.objects,tn(d)),h.objects.filter(p=>p.type==="text")):new Map,b=[...y.values()];for(let p of h.objects){let g=p.type==="text"?y.get(p.id):void 0;if(p.type==="shape"&&(p.role==="entrance"||p.role==="exit")&&xc.test(p.label?.trim()??"")){let R=ct(p),A=R?Kt(R):null;if(A&&b.some(M=>Math.hypot(A.x-M.mid.x,A.y-M.mid.y)*S<=Te+M.widthM))continue}if(g&&p.type==="text")l.push({id:`text:${p.id}`,kind:"gate",text:p.text,icon:"entrance",anchor:[g.mid.x*S,h.baseHeightM+g.openingM+te,g.mid.y*S],color:p.color,floorIndex:h.index});else if(p.type==="shape"&&p.role&&bc.has(p.role)){let R=ct(p),A=R?Kt(R):null;if(!A||!p.label||p.gate?.hideFromBuyers)continue;l.push({id:`architecture:${p.id}`,kind:p.role==="stage"?"stage":p.role==="entrance"||p.role==="exit"?"gate":"annotation",text:p.label,...p.role==="entrance"||p.role==="exit"?{icon:p.role}:{},...p.gate?.stepFree?{stepFree:!0}:{},anchor:[A.x*S,h.baseHeightM+_t(p).heightM+te,A.y*S],color:p.fill,floorIndex:h.index})}else if(p.type==="text"){let R=p.semanticKind==="icon"?re(p.iconKey)?.key:void 0,A=p.text||(R?re(R).label:"");if(!A)continue;l.push({id:`text:${p.id}`,kind:"annotation",text:A,...R?{venueIcon:R}:{},anchor:R?[(p.position.x+p.fontSize/2)*S,h.baseHeightM+te,(p.position.y+p.fontSize/2)*S]:[p.position.x*S,h.baseHeightM+te,p.position.y*S],color:p.color,rotation:p.rotation,floorIndex:h.index})}else if(p.type==="booth"){if(p.labelPresentation?.visible===!1)continue;let R=At(p);if(!R)continue;let A=Kt(R);if(!A)continue;l.push({id:`booth:${p.id}`,kind:"booth",text:p.displayLabel||p.label||p.id,anchor:[A.x*S,h.baseHeightM+$n+gc,A.y*S],floorIndex:h.index})}}}return{labels:l,sections:u,rows:f}}function Hr(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 Oc(t){let n=t.lastIndexOf("-");return n>=0&&n<t.length-1?t.slice(n+1):t}function Nr(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&&oo(a,e)}var gn=3,Yt=.38,Mn=.24;function Cc(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,c=2*(o*s-a*i);if(Math.abs(c)<1e-7)return null;let l=o*o+a*a,u=i*i+s*s,f=(l*s-u*a)/c+n.x*S,m=(o*u-i*l)/c+n.y*S,h=Math.hypot(n.x*S-f,n.y*S-m);return h<1||h>200||!Number.isFinite(h)||t.some(d=>Math.abs(Math.hypot(d.x*S-f,d.y*S-m)-h)>.03)?null:{x:f,z:m,radius:h}}function Xr(t){let n=[],e=new Map,r=(c,l)=>`${Math.floor(c/gn)},${Math.floor(l/gn)}`;for(let c of t)for(let l of c.rows){for(let f of l.pts){let m=f.x*S,h=f.y*S,d=r(m,h),y=e.get(d)??[];y.push({x:m,z:h,y:l.y,floor:c.floorIndex}),e.set(d,y)}if(l.patch||l.pts.length<2)continue;let u=Cc(l.pts);for(let f of[0,l.pts.length-1]){let m=l.pts[f],h=l.pts[f===0?1:f-1],d=m.x-h.x,y=m.y-h.y,b=Math.hypot(d,y);b<1e-6||n.push({sectionId:c.sectionId,floorIndex:c.floorIndex,curve:u,row:l,point:m,x:m.x*S,z:m.y*S,dx:d/b,dz:y/b})}}let o=new Map;n.forEach((c,l)=>{let u=r(c.x,c.z),f=o.get(u)??[];f.push(l),o.set(u,f)});let a=(c,l)=>{let u=Math.floor(c/gn),f=Math.floor(l/gn);return[-1,0,1].flatMap(m=>[-1,0,1].map(h=>`${u+m},${f+h}`))},i=new Map;n.forEach((c,l)=>{let u=-1,f=1/0,m=!1;for(let h of a(c.x,c.z))for(let d of o.get(h)??[]){let y=n[d];if(c.sectionId===y.sectionId&&c.row.blockId===y.row.blockId||c.floorIndex!==y.floorIndex||Math.abs(c.row.y-y.row.y)>.05)continue;let b=y.x-c.x,p=y.z-c.z,g=Math.hypot(b,p);if(g<Yt*2+.45||g>gn)continue;let R=c.curve&&y.curve&&Math.hypot(c.curve.x-y.curve.x,c.curve.z-y.curve.z)<=.05&&Math.abs(c.curve.radius-y.curve.radius)<=.05,A=Math.min((b*c.dx+p*c.dz)/g,(-b*y.dx-p*y.dz)/g);(R?A<.8:A<.98)||!R&&(Math.abs(b*c.dz-p*c.dx)>.15||Math.abs(b*y.dz-p*y.dx)>.15)||(g<f-.02?(u=d,f=g,m=!1):Math.abs(g-f)<=.02&&(m=!0))}u>=0&&!m&&i.set(l,u)});let s=[];for(let[c,l]of i){if(c>=l||i.get(l)!==c)continue;let u=n[c],f=n[l],m=Math.hypot(f.x-u.x,f.z-u.z),h=(f.x-u.x)/m,d=(f.z-u.z)/m,y=!1;for(let p of a((u.x+f.x)/2,(u.z+f.z)/2))for(let g of e.get(p)??[]){if(g.floor!==u.floorIndex||Math.abs(g.y-u.row.y)>.75)continue;let R=(g.x-u.x)*h+(g.z-u.z)*d,A=Math.abs((g.x-u.x)*d-(g.z-u.z)*h);R>.01&&R<m-.01&&A<Mn+Yt&&(y=!0)}if(y)continue;let b=(p,g)=>({x:(u.x+h*p-d*g)/S,y:(u.z+d*p+h*g)/S});s.push({sections:[u.sectionId,f.sectionId],blocks:[u.row.blockId,f.row.blockId],floorIndex:u.floorIndex,ends:[u.point,f.point],clearWidthM:m-2*Yt,heightM:(u.row.y+f.row.y)/2,outline:[b(Yt,-Mn),b(m-Yt,-Mn),b(m-Yt,Mn),b(Yt,Mn)]})}return s}var kc=.15,Fc=.9,Lc=1.76;function jr(t){return ke(t)?{zenith:[.36,.58,.84],horizon:[.82,.88,.94]}:{zenith:[.05,.08,.15],horizon:[.3,.38,.5]}}function ke(t){return!!t&&t[0]*.2126+t[1]*.7152+t[2]*.0722>.55}function vc(){return{background:{top:[...ue.top],bottom:[...ue.bottom]},sky:jr(null),structure:le,seatStates:{...po},seatScale:1,materials:{seat:null,shell:null,roughness:.78}}}function Nc(t){return ke(t)?{deck:"#c9ccc8",fascia:"#b4bab8",shell:"#c3c9c8",roughness:.87}:{deck:"#69747b",fascia:"#3e4d58",shell:"#526572",roughness:.87}}function Ur(t){let n=vc();t??={};let e=it(t.background);if(e){n.background={top:V(e,Fc),bottom:V(e,Lc)},n.sky=jr(e);let s={};for(let[l,u]of Object.entries(le))s[l]=at(u,e,kc);e[0]*.2126+e[1]*.7152+e[2]*.0722>.55&&(s.ground=V(e,.86)),n.structure=s}let r=it(t.selectionColor)??it(t.accent);r&&(n.seatStates={...n.seatStates,selected:r});let o=t.seatScale;typeof o=="number"&&Number.isFinite(o)&&(n.seatScale=io(o));let a=Object.fromEntries(Object.entries(t.venue3d??{}).filter(([,s])=>s!=null)),i={...Nc(e),...a};if(i){let s=it(i.deck),c=it(i.fascia);s&&(n.structure={...n.structure,tierTop:s,gaTop:s}),c&&(n.structure={...n.structure,tierWall:c,gaWall:c}),n.materials.seat=it(i.seat),n.materials.shell=it(i.shell),typeof i.roughness=="number"&&Number.isFinite(i.roughness)&&(n.materials.roughness=Math.min(1,Math.max(0,i.roughness)))}return Gc(n,ke(e)),n}function Gc(t,n){let e=jt(n);t.seatStates={...t.seatStates,held:Cn(e.unavailable),sold:Cn(e.unavailable),dimmed:Cn(e.dimmed)};let r=(a,i)=>Xt(a,i,Math.min(cn(a),kn)),o=t.structure;t.structure={...o,ground:r(o.ground,e.ground),tierTop:r(o.tierTop,e.deck),tierWall:r(o.tierWall,e.fascia)},t.materials.shell&&(t.materials.shell=r(t.materials.shell,e.shell))}function Wr(t,n){let e=[];for(let r of n)e.push(...t.seatStates[r]);return e}var Fe=.6,Yr=3,Dc=.25;function Hc(t,n){if(xt(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,c=i.y-a.y,l=s*s+c*c||1,u=Math.max(0,Math.min(1,((t.x-a.x)*s+(t.y-a.y)*c)/l));e=Math.min(e,Math.hypot(t.x-(a.x+u*s),t.y-(a.y+u*c)))}return e}function zr(t,n){let e=t.map(i=>({booth:i,ring:At(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=(Yr+Fe)/S,a=new Map;return e.forEach(({booth:i,ring:s},c)=>{let l={x:s.reduce((h,d)=>h+d.x,0)/4,y:s.reduce((h,d)=>h+d.y,0)/4},u=[0,1,2,3].map(h=>{let d=s[h],y=s[(h+1)%4],b={x:(d.x+y.x)/2,y:(d.y+y.y)/2},p=b.x-l.x,g=b.y-l.y,R=Math.hypot(p,g)||1,A={x:b.x+p/R*Fe/S,y:b.y+g/R*Fe/S},M=Yr/S;return r.forEach((x,I)=>{I===c||A.x<x.minX-o||A.x>x.maxX+o||A.y<x.minY-o||A.y>x.maxY+o||(M=Math.min(M,Hc(A,e[I].ring)))}),{open:M*S,toward:{x:b.x+p/R*10/S,y:b.y+g/R*10/S},focal:Math.hypot(b.x-n.x,b.y-n.y)}}),f=Math.max(...u.map(h=>h.open)),m=u.filter(h=>h.open>=f-Dc).sort((h,d)=>h.focal-d.focal)[0];a.set(i.id,m.toward)}),a}import Xc from"polygon-clipping";var jc=.45,Uc=1500,Wc=200;function Kr(t,n){if(t.role!=="stage"||Zt(t.stageKind))return t;let e=ct(t);if(!e||e.length<3||Math.abs(pt(e))*S*S>Uc)return t;let r=n.filter(i=>xt(e,i.x,i.y));if(!r.length||r.length>Wc)return t;let o=jc/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=Xc.difference([[...e.map(l=>[l.x,l.y]),[e[0].x,e[0].y]]],...a),s=null,c=0;for(let l of i){let u=l[0].slice(0,-1).map(([m,h])=>({x:m,y:h})),f=Math.abs(pt(u));f>c&&(c=f,s=u)}return!s||s.length<3?t:{...t,kind:"polygon",points:s,rotation:0}}catch{return t}}function Le(t,n,e,r,o,a,i,s,c,l=[],u=o){if(n.length!==e.length||n.length<2||a-o<1.5)return;let f=(y,b,p)=>{Ot(t,y,b,p,l,i,s,{portalBase:u,ao:c})||Z(t,y,void 0,()=>p,b,i,s,c)},m=(y,b,p)=>({x:y.x+(b.x-y.x)*p,y:y.y+(b.y-y.y)*p}),h=r?n.length:n.length-1,d=0;for(let y=0;y<h;y++){let b=(y+1)%n.length,p=Math.hypot(e[b].x-e[y].x,e[b].y-e[y].y)*$;if(p<1e-5)continue;let g=(x,I)=>[m(n[y],n[b],x),m(n[y],n[b],I),m(e[y],e[b],I),m(e[y],e[b],x)];f(g(0,1),o,o+.95),f(g(0,1),a-.22,a);let R=Math.ceil((d-.32)/6)*6,A=!1,M=!1;for(let x=R;x<d+p;x+=6){let I=Math.max(0,(x-d)/p),P=Math.min(1,(x+.32-d)/p);P<=I||(f(g(I,P),o+.95,a-.22),A||=I<1e-6,M||=P>1-1e-6)}if(!r&&(y===0&&!A||y===h-1&&!M)){let x=Math.min(1,.32/p);f(g(y===0?0:1-x,y===0?x:1),o+.95,a-.22)}d+=p}}import zt from"polygon-clipping";var Sn=.65;function ve(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,c=i.y-a.y,l=Math.max(0,Math.min(1,((t.x-a.x)*s+(t.y-a.y)*c)/(s*s+c*c||1)));e=Math.min(e,Math.hypot(t.x-a.x-l*s,t.y-a.y-l*c))}return e}var Ne=.01;function Vr(t,n,e,r,o,a,i,s=[],c=!0,l={bays:[],walls:[]}){if(r-o<=1e-5)return;let u=r-o>=3,f=u?r-Sn:o;t.setMaterial(5);let m=u?[]:s.filter(x=>{if(x.role!=="entrance"&&x.role!=="exit")return!1;let I=ct(x);if(!I)return!1;let P=nn(I,o,o+_t(x).heightM);return P!==null&&P.openingTop<=r-.12});if((!m.length||!Ot(t,n,f,r,m,a,i,{holes:e,portalBase:o}))&&Z(t,n,e,()=>r,f,a,i,K,void 0,()=>[0,1,0]),!u){t.setMaterial(0);return}let h=c&&l.bays.length?Yc(n,e,Lt(n,Rn/S),l):null,d=6/S,y=.22/S,b=s.flatMap(x=>{if(x.role!=="entrance"&&x.role!=="exit")return[];let I=ct(x);return I?.length?[{minX:Math.min(...I.map(P=>P.x)),maxX:Math.max(...I.map(P=>P.x)),minY:Math.min(...I.map(P=>P.y)),maxY:Math.max(...I.map(P=>P.y))}]:[]}),p=Math.min(...n.map(x=>x.x)),g=Math.max(...n.map(x=>x.x)),R=Math.min(...n.map(x=>x.y)),A=Math.max(...n.map(x=>x.y));for(let x=p+d/2;x<g;x+=d)for(let I=R+d/2;I<A;I+=d){if(b.some(_=>x+y>=_.minX&&x-y<=_.maxX&&I+y>=_.minY&&I-y<=_.maxY))continue;let P=[{x:x-y,y:I-y},{x:x+y,y:I-y},{x:x+y,y:I+y},{x:x-y,y:I+y}];!St({x,y:I},n,e)||ve({x,y:I},[n,...e??[]])<y*Math.SQRT2+(c?Rn/S:0)||h&&ve({x,y:I},h.flat())<y*Math.SQRT2+Rn/S||Z(t,P,void 0,()=>f,o,a,i,K)}if(h){for(let[x,...I]of h)Z(t,x,I,()=>f,o-Ne,a,i,K);t.setMaterial(0);return}let M=Lt(n,Rn/S);if(c&&M.length>=3){let x=s.filter(_=>{if(_.role!=="entrance"&&_.role!=="exit")return!1;let O=ct(_);return!!O&&O.some(C=>!St(C,n,void 0)||ve(C,[n])<=Rn/S)}),I=[M.slice().reverse()],P=o-Ne;(!x.length||!Ot(t,n,P,f,x,a,i,{holes:I,portalBase:o+Ne}))&&Z(t,n,I,()=>f,P,a,i,K)}t.setMaterial(0)}var Ge=.25,Rn=Ge;function Yc(t,n,e,r){if(e.length<3)return null;let o=i=>{let s=i.map(c=>[c.x,c.y]);return s.push(s[0]),s},a=i=>{let[s,...c]=i.map(l=>[o(l)]);return zt.union(s,...c)};try{let i=[o(t),...(n??[]).map(o)],s=zt.difference(i,[o(e)]),c=zt.intersection(i,a(r.bays));if(!c.length)return null;let l=zt.difference(zt.intersection(i,a(r.walls)),c);return zt.union(zt.difference(s,c),l).map(f=>f.map(m=>m.slice(0,-1).map(([h,d])=>({x:h,y:d}))))}catch{return null}}var zc=.02,Kc=.25,Vc=1.2,Zc=.6,qc=.45,$c=2.3,Qc=Math.PI/180,Zr=.005;function Bt(t,n,e){let r=e*Qc;return{x:t.x+n*Math.sin(r),y:t.y+n*Math.cos(r)}}function Jc(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 tl=24,nl=.01;function el(t,n,e,r,o,a,i,s,c){let l=e.binCount,u=tl,f=$,m=a+.02,h=a-nl,d=[];for(let E=0;E<l;E++){let w=(e.startBin+E+.5)*n.binStepDeg,B=new Float64Array(u+1);for(let L=0;L<=u;L++){let T=r[E]+(o[E]-r[E])*L/u;B[L]=Math.max(m,fo(n,e,w,T)-Kc)}d.push(B)}if(c){let E=0;for(let w=0;w+1<l;w++)for(let B=0;B<u;B++){let L=Bt(n.centre,r[w]+(o[w]-r[w])*B/u,(e.startBin+w+.5)*n.binStepDeg),T=Bt(n.centre,r[w+1]+(o[w+1]-r[w+1])*(B+1)/u,(e.startBin+w+1.5)*n.binStepDeg);E=Math.max(E,Math.hypot(T.x-L.x,T.y-L.y))}for(let w=0;w<l;w++){let B=(e.startBin+w+.5)*n.binStepDeg;for(let L=0;L<=u;L++){let T=Bt(n.centre,r[w]+(o[w]-r[w])*L/u,B),v=c(T.x,T.y,E*1.01);v!==null&&(d[w][L]=Math.min(d[w][L],Math.max(h+Zr,v-Zr)))}}}let y=[i.bandTop[0]*s.top,i.bandTop[1]*s.top,i.bandTop[2]*s.top],b=[i.bandTop[0]*s.bottomCap,i.bandTop[1]*s.bottomCap,i.bandTop[2]*s.bottomCap],p=[i.bandWall[0]*s.top,i.bandWall[1]*s.top,i.bandWall[2]*s.top],g=[i.bandWall[0]*s.wallBottom,i.bandWall[1]*s.wallBottom,i.bandWall[2]*s.wallBottom],R=(E,w)=>{let B=(e.startBin+E+.5)*n.binStepDeg,L=r[E]+(o[E]-r[E])*w/u,T=Bt(n.centre,L,B);return[T.x*f,d[E][w],T.y*f]};{let E=Math.tan(12*Math.PI/180);for(let w=0;w<6;w++){let B=!1;for(let T=0;T<l;T++)for(let v=u-1;v>=0;v--)d[T][v]>d[T][v+1]&&(d[T][v]=d[T][v+1],B=!0);let L=e.closed?l:l-1;for(let T=0;T<L;T++){let v=(T+1)%l;for(let H=0;H<=u;H++){let j=d[v][H]-d[T][H];if(Math.abs(j)>1)continue;let D=r[T]+(o[T]-r[T])*H/u,U=r[v]+(o[v]-r[v])*H/u,X=Bt(n.centre,D,(e.startBin+T+.5)*n.binStepDeg),Y=Bt(n.centre,U,(e.startBin+v+.5)*n.binStepDeg),nt=E*Math.hypot(Y.x-X.x,Y.y-X.y)*f;j>nt?(d[v][H]=d[T][H]+nt,B=!0):-j>nt&&(d[T][H]=d[v][H]+nt,B=!0)}}if(!B)break}}let A=1,M=(E,w)=>{for(let B=0;B<=u;B+=4)if(Math.abs(d[E][B]-d[w][B])>A)return!0;return Math.abs(d[E][u]-d[w][u])>A},x=Math.tan(38*Math.PI/180),I=E=>(o[E]-r[E])/u*f,P=(E,w)=>d[E][w+1]-d[E][w]>x*Math.max(1e-6,I(E)),_=(E,w)=>{let B=e.closed?(E-1+l)%l:Math.max(0,E-1),L=e.closed?(E+1)%l:Math.min(l-1,E+1);Math.abs(d[B][w]-d[E][w])>A&&(B=E),Math.abs(d[L][w]-d[E][w])>A&&(L=E);let T=Math.max(0,w-1),v=Math.min(u,w+1);T<w&&P(E,T)&&(T=w),v>w&&P(E,w)&&(v=w);let H=R(B,w),j=R(L,w),D=R(E,T),U=R(E,v),X=j[0]-H[0],Y=j[1]-H[1],nt=j[2]-H[2],rt=U[0]-D[0],q=U[1]-D[1],Q=U[2]-D[2],J=Y*Q-nt*q,N=nt*rt-X*Q,G=X*q-Y*rt,W=Math.hypot(J,N,G);return W>1e-12?(J/=W,N/=W,G/=W,N<0&&(J=-J,N=-N,G=-G),[J,N,G]):[0,1,0]},O=(E,w,B=!1)=>{let L=B&&Math.min(E[1],w[1])-a>=3,T=[E[0],L?E[1]-Sn:h,E[2]],v=[w[0],L?w[1]-Sn:h,w[2]],H=w[0]-E[0],j=w[2]-E[2],D=Math.hypot(H,j);if(!(D>1e-12))return;let U=[j/D,0,-H/D];t.tri(E,w,v,U,p,p,g),t.tri(E,v,T,U,p,g,g)},C=.05*Rt,F=E=>o[E]-r[E]<C,k=e.closed?l:l-1;for(let E=0;E<k;E++){let w=(E+1)%l;if(F(E)||F(w))continue;if(M(E,w)){let j=(e.startBin+E+1)*n.binStepDeg,D=(q,Q)=>{let J=(r[E]+r[w])/2,N=(o[E]+o[w])/2,G=J+(N-J)*Q/u,W=Bt(n.centre,G,j);return[W.x*f,d[q][Q],W.y*f]};for(let q=0;q<u;q++){let Q=R(E,q),J=R(E,q+1),N=D(E,q),G=D(E,q+1),W=_(E,q),lt=_(E,q+1);t.triN(Q,N,G,W,W,lt,y),t.triN(Q,G,J,W,lt,lt,y);let ft=R(w,q),st=R(w,q+1),tt=D(w,q),et=D(w,q+1),ht=_(w,q),z=_(w,q+1);t.triN(tt,ft,st,ht,ht,z,y),t.triN(tt,st,et,ht,z,z,y);let mt=D(E,q),yt=D(E,q+1),Dt=D(w,q+1),Ht=D(w,q),kt=yt[0]-mt[0],Ft=yt[2]-mt[2],an=Math.hypot(kt,Ft);if(an>1e-12){let Pn=[Ft/an,0,-kt/an];t.tri(mt,yt,Dt,Pn,p),t.tri(mt,Dt,Ht,Pn,p)}}let U=R(E,0),X=R(w,0),Y=R(w,u),nt=R(E,u),rt=q=>[q[0],h,q[2]];Math.min(U[1],X[1])-a<3&&(t.tri(rt(U),rt(Y),rt(X),[0,-1,0],b),t.tri(rt(U),rt(nt),rt(Y),[0,-1,0],b)),O(U,X,!0),O(nt,Y,!0);continue}for(let j=0;j<u;j++){let D=_(E,j),U=_(w,j),X=_(w,j+1),Y=_(E,j+1);if(P(E,j)||P(w,j)){let J=(yt,Dt)=>{let Ht=(e.startBin+yt+.5)*n.binStepDeg,kt=r[yt]+(o[yt]-r[yt])*(j+.5)/u,Ft=Bt(n.centre,kt,Ht);return[Ft.x*f,Dt,Ft.y*f]},N=R(E,j),G=R(w,j),W=J(E,d[E][j]),lt=J(w,d[w][j]);t.triN(N,G,lt,D,U,U,y),t.triN(N,lt,W,D,U,D,y);let ft=R(w,j+1),st=R(E,j+1),tt=J(E,d[E][j+1]),et=J(w,d[w][j+1]);t.triN(tt,et,ft,Y,X,X,y),t.triN(tt,ft,st,Y,X,Y,y);let ht=lt[0]-W[0],z=lt[2]-W[2],mt=Math.hypot(ht,z);if(mt>1e-12){let yt=[-z/mt,0,ht/mt];t.tri(W,lt,et,yt,p),t.tri(W,et,tt,yt,p)}continue}let nt=R(E,j),rt=R(w,j),q=R(w,j+1),Q=R(E,j+1);t.triN(nt,rt,q,D,U,X,y),t.triN(nt,q,Q,D,X,Y,y)}let B=R(E,0),L=R(w,0),T=R(w,u),v=R(E,u),H=j=>[j[0],h,j[2]];Math.min(B[1],L[1])-a<3&&(t.tri(H(B),H(T),H(L),[0,-1,0],b),t.tri(H(B),H(v),H(T),[0,-1,0],b)),O(B,L,!0),O(v,T,!0)}if(!e.closed)for(let E of[0,l-1])for(let w=0;w<u;w++)O(R(E,w),R(E,w+1))}function qr(t,n,e){let{bottomY:r,colors:o,ao:a}=e,i=new Float64Array(n.binCount).fill(-1/0);for(let u of n.rings)for(let f of u.arcs){let m=new Float64Array(f.binCount),h=new Float64Array(f.binCount);for(let y=0;y<f.binCount;y++){let b=(f.startBin+y)%n.binCount,p=Math.max(0,f.innerR[y]-Pt);m[y]=Math.max(p,i[b]+.001),h[y]=Math.max(m[y]+.001,f.outerR[y]+Pt)}let d=0;for(let y=0;y<f.binCount;y++){let b=f.topLevelM[y]-r;b>d&&(d=b)}d>=Vc&&el(t,n,f,m,h,r,o,a,e.standTopNear);for(let y=0;y<f.binCount;y++){let b=(f.startBin+y)%n.binCount;h[y]>i[b]&&(i[b]=h[y])}}if(e.deriveShell===!1||Jc(e.shapes,n))return;let s=n.rings[n.rings.length-1],c=Zc*Rt,l=qc*Rt;for(let u of s.arcs){let f=[],m=[];for(let _=0;_<u.binCount;_++){let O=(u.startBin+_+.5)*n.binStepDeg,C=u.outerR[_]+Pt+c;f.push(Bt(n.centre,C,O)),m.push(Bt(n.centre,C+l,O))}let h=-1/0;for(let _=0;_<u.binCount;_++)u.topLevelM[_]>h&&(h=u.topLevelM[_]);let d=h+$c,y=u.closed?m:[...m,...f.slice().reverse()],b=u.closed?[f.slice().reverse()]:void 0,p=at(o.shellWall,[.66,.71,.72],.62),g=(_,O,C,F,k)=>{let E=Math.abs(F-h)<1e-6?F-zc:F;Ot(t,_,C,E,e.shapes,o.shellTop,k,{holes:O,portalBase:r,ao:a})||Z(t,_,O,()=>E,C,o.shellTop,k,a)},R=Math.max(1,Math.ceil((h-r)/4.5)),A=(h-r)/R,M=new Set,x=e.tierFrontLevels??n.rings.map(_=>{let O=_.arcs.flatMap(C=>Array.from(C.frontLevelM)).filter(Number.isFinite).sort((C,F)=>C-F);return O[Math.floor(O.length/2)]});for(let _ of x)Number.isFinite(_)&&_-r>=3&&_<h&&M.add(Math.max(0,Math.min(R-1,Math.floor((_-r)/A))));let I=Math.min(...x.filter(_=>Number.isFinite(_)&&_-r>=3&&_<h));for(let _=0;_<R;_++)r+(_+1)*A<=I-Sn&&Number.isFinite(I)&&M.add(_);for(let _=0;_<R;_++){let O=r+(h-r)*_/R,C=r+(h-r)*(_+1)/R;M.has(_)&&C-O>=3.2?(g(y,b,O,O+.45,p),Le(t,f,m,u.closed,O+.45,C-.16,o.shellTop,p,a,e.shapes,r)):g(y,b,O,C-.16,p),g(y,b,C-.16,C,V(p,.62))}Le(t,f,m,u.closed,h,d,o.shellTop,p,a,e.shapes,r);let P=8;for(let _=1;_<m.length;_++){if(P+=Math.hypot(m[_].x-m[_-1].x,m[_].y-m[_-1].y)*$,P<8)continue;P=0;let O=m[_],C=m[_-1],F=O.x-C.x,k=O.y-C.y,E=Math.max(1,Math.hypot(F,k)),w=F/E*.16*Rt,B=k/E*.16*Rt,L=Math.max(1,Math.hypot(O.x-n.centre.x,O.y-n.centre.y)),T=(O.x-n.centre.x)/L*.24*Rt,v=(O.y-n.centre.y)/L*.24*Rt,H=[{x:O.x-w,y:O.y-B},{x:O.x+w,y:O.y+B},{x:O.x+w+T,y:O.y+B+v},{x:O.x-w+T,y:O.y-B+v}];g(H,void 0,r,h,V(p,1.12))}}}var ol=2.5,$r=.65,rl=2,il=.03;function sl(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 Xe(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<ol||i.pts.length<2)continue;let s=i.pts.map(u=>{let f=u.x-n.x,m=u.y-n.y,h=Math.max(1,Math.hypot(f,m));return{x:u.x-f/h*$r/S,y:u.y-m/h*$r/S}}),c=[],l=[s[0]];for(let u=1;u<s.length;u++){let f=s[u-1],m=s[u];Math.hypot(m.x-f.x,m.y-f.y)*S>rl?(l.length>=2&&c.push(l),l=[m]):l.push(m)}l.length>=2&&c.push(l);for(let u of c)sl(u,il/S);c.length&&o.push({blockId:a,y:i.y,runs:c})}return o}var Qr=.1,al=1.1,cl=.22,De=.95,He=.05,Jr=1.8;function ti(t,n,e,r){let o=[.72,.72,.69],a=[.48,.55,.57];for(let i of Xe(n,e,r)){let s=i.y;for(let c of i.runs){let l=Jr;for(let u=1;u<c.length;u++){let f=c[u-1],m=c[u],h=m.x-f.x,d=m.y-f.y,y=Math.hypot(h,d);if(y<1e-5)continue;let b=p=>{let g=-d/y*p/S/2,R=h/y*p/S/2;return[{x:f.x+g,y:f.y+R},{x:m.x+g,y:m.y+R},{x:m.x-g,y:m.y-R},{x:f.x-g,y:f.y-R}]};if(Z(t,b(cl),void 0,()=>s+Qr,s-al,o,o,K),Z(t,b(He),void 0,()=>s+De,s+De-He,a,a,K),l+=y*S,l>=Jr||u===c.length-1){l=0;let p=.028/S,g=[{x:f.x-p,y:f.y-p},{x:f.x+p,y:f.y-p},{x:f.x+p,y:f.y+p},{x:f.x-p,y:f.y+p}];Z(t,g,void 0,()=>s+De-He,s+Qr,a,a,K)}}}}}var ll=.9,ul=1.5,fl=.3;function ni(t,n,e){let r=[],o=[],a=ll/S,i=ul/S,s=fl/S;for(let c of t)for(let l of c.runs){if(l.length<2)continue;let u=l.slice(),f=(b,p)=>{let g=u[b],R=u[p],A=Math.hypot(g.x-R.x,g.y-R.y)||1;u[b]={x:g.x+(g.x-R.x)/A*s,y:g.y+(g.y-R.y)/A*s}};f(0,1),f(u.length-1,u.length-2);let m=u.map((b,p)=>{let g=u[Math.max(0,p-1)],R=u[Math.min(u.length-1,p+1)],A=R.x-g.x,M=R.y-g.y,x=Math.hypot(A,M)||1,I=-M/x,P=A/x;return I*(b.x-n.x)+P*(b.y-n.y)<0&&(I=-I,P=-P),{nx:I,ny:P}}),h=u.map((b,p)=>({x:b.x-m[p].nx*i,y:b.y-m[p].ny*i})),d=u.map((b,p)=>({x:b.x+m[p].nx*a,y:b.y+m[p].ny*a})),y=u.map((b,p)=>({x:b.x+m[p].nx*(a+e/S),y:b.y+m[p].ny*(a+e/S)}));r.push([...h,...d.slice().reverse()]),o.push([...d,...y.reverse()])}return{bays:r,walls:o}}var je=.88,ne=.27,ml=1.2,hl=.01;function ei(t,n,e,r,o){let a=[.67,.71,.68],i=[a[0]*je,a[1]*je,a[2]*je],s=c=>!!o&&o.some((l,u)=>u!==c&&l?.belowY!=null&&Math.abs(l.belowY-n[c].y)<1e-6&&n[u].blockId===n[c].blockId);for(let c=0;c<n.length;c++){let l=n[c];if(!(l.pts.length<2))for(let u of[0,l.pts.length-1]){let f=l.pts[u],m=l.pts[u===0?1:u-1],h=f.x-m.x,d=f.y-m.y,y=Math.hypot(h,d);if(y<1e-5)continue;h/=y,d/=y;let b=1/0;for(let w=0;w<e.length;w++){let B=e[w],L=e[(w+1)%e.length],T=L.x-B.x,v=L.y-B.y,H=h*v-d*T;if(Math.abs(H)<1e-8)continue;let j=B.x-f.x,D=B.y-f.y,U=(j*v-D*T)/H,X=(j*d-D*h)/H;U>0&&X>=0&&X<=1&&(b=Math.min(b,U))}let p=.3/S,g=b-.04/S;if(!Number.isFinite(b)||b*S>2||g-p<.12/S)continue;let R=!!r&&s(c),A=o?.[c]?.pitch,M=R&&A&&Number.isFinite(A)?Math.min(ml/S,Math.max(ne/S,A-ne/S-hl/S)):ne/S,x=-d,I=h;r&&x*(r.x-f.x)+I*(r.y-f.y)<0&&(x=-x,I=-I);let P=ne/S,_=[{x:f.x+h*p+x*P,y:f.y+d*p+I*P},{x:f.x+h*g+x*P,y:f.y+d*g+I*P},{x:f.x+h*g-x*M,y:f.y+d*g-I*M},{x:f.x+h*p-x*M,y:f.y+d*p-I*M}];if(!_.every(w=>xt(e,w.x,w.y)))continue;let O=o?.[c]?.belowY,C=O==null?0:l.y-O,F=!!r&&C>.03&&C<=.65;if(F&&r){let w=(B,L)=>Math.hypot((B.x+L.x)/2-r.x,(B.y+L.y)/2-r.y);w(_[0],_[1])>w(_[3],_[2])&&(_=[_[3],_[2],_[1],_[0]])}let k=F?Math.ceil((C-1e-8)/.2):1,E=(w,B,L)=>({x:w.x+(B.x-w.x)*L,y:w.y+(B.y-w.y)*L});for(let w=0;w<k;w++){let B=w/k,L=(w+1)/k,T=[E(_[0],_[3],B),E(_[1],_[2],B),E(_[1],_[2],L),E(_[0],_[3],L)],v=l.y+.008-(F?C*(1-L):0);Z(t,T,void 0,()=>v,v-(F?C/k+.1:.16),a,i,K)}}}}var yl=.02,dl=.012,pl=.01,xl=.3,bl=.5;function gl(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,c=i.y-a.y,l=s*s+c*c,u=l>1e-12?((n-a.x)*s+(e-a.y)*c)/l:0;u=Math.max(0,Math.min(1,u)),r=Math.min(r,Math.hypot(n-(a.x+u*s),e-(a.y+u*c)))}return r}function Ml(t,n,e,r){let o=1/0,a=Number.NaN;for(let i=0;i<t.length;i++){let s=n[i];if(Math.hypot(e-s.cx,r-s.cy)-s.rad>=o)continue;let c=gl(t[i].pts,e,r);c<o&&(o=c,a=t[i].y)}return a}function oi(t,n,e,r,o,a,i){let s=r.filter(m=>m.pts.length>0);if(s.length<2||n.length<3)return;let c=s.map(m=>{let h=0,d=0;for(let b of m.pts)h+=b.x,d+=b.y;h/=m.pts.length,d/=m.pts.length;let y=0;for(let b of m.pts)y=Math.max(y,Math.hypot(b.x-h,b.y-d));return{cx:h,cy:d,rad:y}}),l=[...n],u=e.map(m=>[...m]),f=yl/S;for(let m of[l,...u])for(let h=0;h<m.length;h++){let d=m[h],y=m[(h+1)%m.length],b=y.x-d.x,p=y.y-d.y,g=Math.hypot(b,p);if(g*S<.05)continue;let R=(d.x+y.x)/2,A=(d.y+y.y)/2,M=p/g,x=-b/g;St({x:R+M*f,y:A+x*f},l,u)&&(M=-M,x=-x);let I=o.x-R,P=o.y-A,_=Math.hypot(I,P)||1;if((M*I+x*P)/_>bl)continue;let O=1/0;for(let T of[.2,.5,.8]){let v=Ml(s,c,d.x+b*T-M*f*2,d.y+p*T-x*f*2);Number.isFinite(v)&&(O=Math.min(O,v))}if(!Number.isFinite(O)||O-a<xl)continue;let C=a-pl,F=O-dl,k={x:(d.x-M*f)*S,z:(d.y-x*f)*S},E={x:(y.x-M*f)*S,z:(y.y-x*f)*S},w=[M,0,x],B=V(i,K.wallBottom),L=V(i,K.top);t.tri([k.x,F,k.z],[E.x,F,E.z],[E.x,C,E.z],w,L,L,B),t.tri([k.x,F,k.z],[E.x,C,E.z],[k.x,C,k.z],w,L,B,B)}}function ri(t,n,e,r,o,a,i,s,c=!1){if(!n.outline||n.outline.length<3)return;let l=e.baseHeightM,u=e.objects.filter(g=>g.type==="shape"&&(g.role==="entrance"||g.role==="exit")),f=_o(r,s.tierTop);if(!o)return;let m=g=>o.deckAt(g.x,g.y),h=jo(n,i),d=h[0]??n.outline;if(o.rowLevels.length>=2){let g=Hn(o.rowLevels),R=Uo(vo(o.rowLevels,e.focal,g),h),A=ni(Xe(o.rowLevels,e.focal,l),e.focal,Ge);for(let x of R){let I=Math.max(l,x.topY-ii);for(let P of a.subtract(x.outline,I))Vr(t,P,x.holes,I,l,s.tierTop,s.tierWall,u,!c,A);t.setMaterial(5),oi(t,x.outline,x.holes,o.rowLevels,e.focal,I,s.tierWall),t.setMaterial(0)}R.length||Z(t,d,n.holes,()=>o.landingY,l,f,s.tierWall,K);let M={tread:[f[0]*K.top,f[1]*K.top,f[2]*K.top],riser:[f[0]*.72,f[1]*.72,f[2]*.72]};for(let x of h.length?h:[d])Go(t,o.rowLevels,e.focal,o.landingY,M,x,g);ti(t,o.rowLevels,e.focal,l),ei(t,o.rowLevels,n.outline,e.focal,g);return}let y=o.flat?1/0:cr,b=g=>o.normalAt(g.x,g.y),p=o.flat?o.landingY:void 0;for(let g of a.subtract(d,p))Z(t,g,n.holes,m,l,f,s.tierWall,K,y,b)}function Rl(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 c=e.bySection.get(s);if(c&&c.rowLevels.length>=2)continue;let l=n[i];if(l.kind==="booth")continue;let u=o.get(s);u||(u=new Map,o.set(s,u));let f=l.rowId||`__seat-${i}`,m=u.get(f);m||(m={pts:[],levelM:0,n:0},u.set(f,m)),m.pts.push({x:l.x,y:l.y}),m.levelM+=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 l=s.rowLevels.filter(u=>!u.patch).map(u=>({pts:u.pts,levelM:u.y}));l.length>=2&&a.push({sectionId:i.id,rows:l});continue}let c=o.get(i.id);c&&a.push({sectionId:i.id,rows:[...c.values()].map(l=>({pts:l.pts,levelM:l.levelM/l.n}))})}return a}function Sl(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,c=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-c*i,t.y-o.y-c*s))}return e}var ii=.02;function Pl(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,c=-1/0;for(let u of r.outline)u.x<a&&(a=u.x),u.x>i&&(i=u.x),u.y<s&&(s=u.y),u.y>c&&(c=u.y);let l=o.landingY;for(let u of o.rowLevels)l=Math.min(l,u.y-ii);return[{outline:r.outline,holes:r.holes,surface:o,floorTop:l,minX:a,maxX:i,minY:s,maxY:c}]});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 c={x:r,y:o};if(!St(c,s.outline,s.holes)&&Sl(c,s.outline)>a)continue;let l=Math.min(s.surface.deckAt(r,o),s.floorTop);(i===null||l<i)&&(i=l)}return i}}var Il=3,_l=.4;function si(t,n,e,r,o,a,i=!0){let s=Rl(n,e,r);if(s.length<Il)return;let c=uo(s,n.focal);if(!c)return;let l=Math.max(0,...c.rings.map(u=>u.arcs.reduce((f,m)=>f+m.binCount,0)))/c.binCount;t.setMaterial(5),qr(t,c,{bottomY:n.baseHeightM,tierFrontLevels:s.map(u=>Math.min(...u.rows.map(f=>f.levelM))),colors:{bandTop:V(o.tierTop,.8),bandWall:o.tierWall,shellTop:a??V(o.tierWall,1.15),shellWall:a??o.tierWall},ao:K,shapes:n.objects.filter(u=>u.type==="shape"),deriveShell:i&&l>=_l,standTopNear:Pl(n,r)}),t.setMaterial(0)}function ai(t){let{doc:n,units:e,seats:r,surfaces:o,solids:a,hintedSeatFloor:i,seatFloor:s}=t,c=[];{let l=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 h=Math.max(0,Math.min(e.length-1,Math.round(a.floor[m]))),d=m*3,y=l[h];y.minX=Math.min(y.minX,a.position[d]),y.minY=Math.min(y.minY,a.position[d+1]),y.minZ=Math.min(y.minZ,a.position[d+2]),y.maxX=Math.max(y.maxX,a.position[d]),y.maxY=Math.max(y.maxY,a.position[d+1]),y.maxZ=Math.max(y.maxZ,a.position[d+2])}let u=new Map;for(let m=0;m<e.length;m++)for(let h of e[m].objects)h.type==="section"&&u.set(h.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 h=o.seatOwner[m],d=(h!==null?u.get(h):void 0)??i[m];if(d===void 0)continue;let y=f[d],b=r[m];y.n++,b.x<y.minX&&(y.minX=b.x),b.y<y.minY&&(y.minY=b.y),b.x>y.maxX&&(y.maxX=b.x),b.y>y.maxY&&(y.maxY=b.y);let p=o.seatDeckY(m);y.sumX+=b.x*S,y.sumDeck+=p,y.sumZ+=b.y*S,y.minDeck=Math.min(y.minDeck,p),y.maxDeck=Math.max(y.maxDeck,p+1.6),s[m]=d}for(let m=0;m<e.length;m++){let h=f[m],d=n.floors?.[m],y=l[m],b=Math.min(h.n?h.minX*S:e[m].focal.x*S-1,Number.isFinite(y.minX)?y.minX:1/0),p=Math.max(h.n?h.maxX*S:e[m].focal.x*S+1,Number.isFinite(y.maxX)?y.maxX:-1/0),g=Math.min(h.n?h.minY*S:e[m].focal.y*S-1,Number.isFinite(y.minZ)?y.minZ:1/0),R=Math.max(h.n?h.maxY*S:e[m].focal.y*S+1,Number.isFinite(y.maxZ)?y.maxZ:-1/0),A=Math.min(h.n?Math.min(e[m].baseHeightM,h.minDeck):e[m].baseHeightM,Number.isFinite(y.minY)?y.minY:1/0),M=Math.max(h.n?Math.max(h.maxDeck,A+.5):A+.5,Number.isFinite(y.maxY)?y.maxY:-1/0),x=[h.n?h.sumX/h.n:(b+p)/2,h.n?h.sumDeck/h.n:(A+M)/2,h.n?h.sumZ/h.n:(g+R)/2],I=Math.max(1,.5*Math.hypot(p-b,M-A,R-g));c.push({index:m,id:d?.id??`floor-${m}`,label:d?.name??(e.length>1?`Floor ${m+1}`:"Venue"),seatCount:h.n,center:x,radius:I,box:{min:[b,A,g],max:[p,M,R]},focalWorld:[e[m].focal.x*S,e[m].baseHeightM+1.5,e[m].focal.y*S]})}}return c}function Ue(t,n){let e=1/0,r=1/0,o=-1/0,a=-1/0,i=(s,c)=>{s<e&&(e=s),c<r&&(r=c),s>o&&(o=s),c>a&&(a=c)};for(let s of n)i(s.x,s.y);for(let s of t)for(let c of s.objects)if(c.type==="section")for(let l of c.outline)i(l.x,l.y);else if(c.type==="shape"&&c.points)for(let l of c.points)i(l.x,l.y);else if(c.type==="gaArea")for(let l of c.points)i(l.x,l.y);else if(c.type==="booth"){let l=At(c);if(l)for(let u of l)i(u.x,u.y)}else if(c.type==="table"){let l=Qn(c);if(l)for(let u of l)i(u.x,u.y)}else if(c.type==="decorImage"){let l=Jn(c);if(l)for(let u of l)i(u.x,u.y)}return Number.isFinite(e)||(e=-100,r=-100,o=100,a=100),{minX:e,minY:r,maxX:o,maxY:a}}function hi(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(...ct(m)??m.points??[]):m.type==="gaArea"?s.push(...m.points):m.type==="booth"?s.push(...At(m)??[]):m.type==="table"?s.push(...Qn(m)??[]):m.type==="decorImage"&&s.push(...Jn(m)??[]);if(ui(t,n[0],e,a)||mi(t,n[0],e,s,a))return!1;if(i&&li(t,n[0].baseHeightM,s,a,i))return!0;let c=yn(s),l=(o.minX+o.maxX)/2,u=(o.minY+o.maxY)/2,f=c.length>=3?c.map(m=>{let h=m.x-l,d=m.y-u,y=Math.max(1,Math.hypot(h,d));return{x:m.x+h/y*80,y:m.y+d/y*80}}):mn(o.minX-28,o.minY-28,o.maxX-o.minX+56,o.maxY-o.minY+56);return Z(t,f,void 0,()=>-.04,-.22,a.ground,a.ground,K),!1}else{let s=n.reduce((b,p)=>p.baseHeightM<b.baseHeightM?p:b);t.setFloor(s.index);let c={...s,objects:n.flatMap(b=>b.objects)},l=e.map(b=>({x:b.x,y:b.y}));for(let b of c.objects)b.type==="section"&&l.push(...b.outline);if(ui(t,c,e,a)||mi(t,c,e,l,a))return!1;if(i&&li(t,s.baseHeightM,l,a,i))return!0;let u=e.filter((b,p)=>r[p]===s.index),f=Ue([s],u),m=Math.hypot(f.maxX-f.minX,f.maxY-f.minY),h=Math.max(28,Math.min(80,m*.04)),d=mn(f.minX-h,f.minY-h,f.maxX-f.minX+h*2,f.maxY-f.minY+h*2),y=s.baseHeightM-.03;return Z(t,d,void 0,()=>y,y-.22,a.ground,a.ground,K),!1}}function We(t,n,e,r){let{cx:o,cz:a,radius:i}=e,s=1/0,c=1/0,l=1/0,u=-1/0,f=-1/0,m=-1/0,h=(b,p,g)=>{s=Math.min(s,b),u=Math.max(u,b),c=Math.min(c,p),f=Math.max(f,p),l=Math.min(l,g),m=Math.max(m,g)};for(let b=0;b<t.position.length;b+=3){let p=b/3;r&&p>=r[0]&&p<r[1]||h(t.position[b],t.position[b+1],t.position[b+2])}for(let b=0;b<n.count;b++){let p=b*3,g=n.iPosition[p],R=n.iPosition[p+1],A=n.iPosition[p+2],M=Math.max(.35,n.iMaxRadius[b]??.35);h(g-M,R,A-M),h(g+M,R+1.6,A+M)}Number.isFinite(s)||(s=o-i,u=o+i,c=0,f=i*.16,l=a-i,m=a+i);let d=[(s+u)/2,(c+f)/2,(l+m)/2],y=Math.max(1,.5*Math.hypot(u-s,f-c,m-l));return{center:d,radius:y,minY:c,maxY:f}}var Al=4096;function yi(t,n,e=[]){let r=Math.max(1,Math.ceil(t.count/Al)),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 c=t.iPosition[s*3],l=t.iPosition[s*3+1],u=t.iPosition[s*3+2];a[i++]=c,a[i++]=l,a[i++]=u,a[i++]=c,a[i++]=0,a[i++]=u}for(let[s,c,l]of e)a[i++]=s,a[i++]=c,a[i++]=l;for(let s of n)for(let[c,l]of[[-1,-1],[1,-1],[1,1],[-1,1]])a[i++]=s.cx+c*s.halfX,a[i++]=s.y,a[i++]=s.cz+l*s.halfZ;return a.subarray(0,i)}function di(t,n,e,r,o,a,i=[]){let s=1/0,c=1/0,l=-1/0,u=-1/0;for(let M=0;M<t.count;M++){let x=M*3,I=t.iPosition[x],P=t.iPosition[x+2];I<s&&(s=I),I>l&&(l=I),P<c&&(c=P),P>u&&(u=P)}for(let[M,,x]of i)M<s&&(s=M),M>l&&(l=M),x<c&&(c=x),x>u&&(u=x);for(let M of n)s=Math.min(s,M.cx-M.halfX),l=Math.max(l,M.cx+M.halfX),c=Math.min(c,M.cz-M.halfZ),u=Math.max(u,M.cz+M.halfZ);let f=e.minX*S,m=e.maxX*S,h=e.minY*S,d=e.maxY*S,y=f,b=m,p=h,g=d;if(Number.isFinite(s)){let M=Math.max(2,.06*Math.hypot(l-s,u-c));y=Math.max(f,s-M),b=Math.min(m,l+M),p=Math.max(h,c-M),g=Math.min(d,u+M)}let R=Math.min(0,r),A=Math.max(o,a*.05);return{min:[y,R,p],max:[b,A,g]}}var ci=12,El=.6,wl=40;function li(t,n,e,r,o){let a=yn([...e]);if(a.length<3)return!1;let i=1/0,s=1/0,c=-1/0,l=-1/0;for(let A of a)i=Math.min(i,A.x),c=Math.max(c,A.x),s=Math.min(s,A.y),l=Math.max(l,A.y);let u=Math.hypot(c-i,l-s)*S,f=It(a,ci/S,1.2),m=Math.max(wl,u*El),h=It(a,(ci+m)/S,1.2);if(f.length!==h.length)return!1;let d=at(r.ground,[.78,.76,.72],.35),y=at(r.ground,[.56,.62,.52],.3);Z(t,f,void 0,()=>n-.04,n-.22,d,d,K);let b=n-.05,p=f.map(A=>[A.x*S,b,A.y*S]),g=h.map(A=>[A.x*S,b,A.y*S]),R=[0,1,0];for(let A=0;A<p.length;A++){let M=(A+1)%p.length;t.tri(p[A],g[M],g[A],R,y,o,o),t.tri(p[A],p[M],g[M],R,y,y,o)}return!0}function ui(t,n,e,r){let o=Nt(n,e);if(!o)return!1;let a=n.baseHeightM,i=at(r.ground,[.62,.55,.47],.4);return Z(t,o,void 0,()=>a-.04,a-.22,i,i,K),!0}var Bl=3e3,Tl=20,fi=1.5,Ol=1.2,Cl=.25;function mi(t,n,e,r,o){if(!e.length||e.length>Bl||r.length<3)return!1;for(let _ of n.objects){if(_.type==="shape"&&En(_.stageKind))return!1;if(_.type==="section"){let{height:O}=Vt(_,{floorBaseHeightM:n.baseHeightM});if(O-n.baseHeightM>Tl)return!1}}let a=0,i=0;for(let _ of r)a+=_.x,i+=_.y;a/=r.length,i/=r.length;let s=0,c=0,l=0;for(let _ of r){let O=_.x-a,C=_.y-i;s+=O*O,c+=C*C,l+=O*C}let u=.5*Math.atan2(2*l,s-c),f=Math.cos(u),m=Math.sin(u),h=-m,d=f,y=1/0,b=-1/0,p=1/0,g=-1/0;for(let _ of r){let O=(_.x-a)*f+(_.y-i)*m,C=(_.x-a)*h+(_.y-i)*d;y=Math.min(y,O),b=Math.max(b,O),p=Math.min(p,C),g=Math.max(g,C)}let R=_=>[[y-_,p-_],[b+_,p-_],[b+_,g+_],[y-_,g+_]].map(([O,C])=>({x:a+f*O+h*C,y:i+m*O+d*C})),A=R(fi/S),M=R((fi+Cl)/S),x=n.baseHeightM,I=at(o.ground,[.62,.55,.47],.4),P=at(o.ground,[.86,.86,.84],.55);return Z(t,M,void 0,()=>x-.04,x-.22,I,I,K),Z(t,M,[A.slice().reverse()],()=>x+Ol,x-.04,at(P,[1,1,1],.2),P,K),!0}function pi(t,n,e){let r=()=>({byObjectId:new Map,elements:[]});if(!n||!t)return r();let o=Ye(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,c=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]})),l=[];for(let f of o.value.overlay.productionElements??[]){let m=a.get(f.objectId),h=m?ct(m.shape):null,d=f.baseElevationM??0;if(!m||!h||h.length<3||!f.id||i.has(f.id)||s.has(f.objectId)||!Number.isFinite(f.heightM)||f.heightM<.05||f.heightM>50||!Number.isFinite(d)||d<-10||d>100)return r();i.add(f.id),s.add(f.objectId);let y=h.map(P=>P.x*S),b=h.map(P=>P.y*S),p=m.unit.baseHeightM+d,g=Math.min(...y),R=Math.max(...y),A=Math.min(...b),M=Math.max(...b),x,I=c.get(f.id)??f.contentImageUrl;if(f.kind==="screen"&&I&&(x=rr(h,p,p+f.heightM,m.unit.focal),!x))if(R-g>=M-A){let P=Math.abs(A-m.unit.focal.y*S)<=Math.abs(M-m.unit.focal.y*S)?A-.006:M+.006;x=[[g,p,P],[R,p,P],[g,p+f.heightM,P],[R,p+f.heightM,P]]}else{let P=Math.abs(g-m.unit.focal.x*S)<=Math.abs(R-m.unit.focal.x*S)?g-.006:R+.006;x=[[P,p,A],[P,p,M],[P,p+f.heightM,A],[P,p+f.heightM,M]]}l.push({id:f.id,objectId:f.objectId,kind:f.kind,floorIndex:m.unit.index,baseY:p,topY:p+f.heightM,bounds:{min:[g,p,A],max:[R,p+f.heightM,M]},occlusion:f.occlusion,...I?{contentImageUrl:I}:{},...x?{contentPlane:x}:{}})}let u=l.sort((f,m)=>f.id.localeCompare(m.id));return{byObjectId:new Map(u.map(f=>[f.objectId,f])),elements:u}}var xi=[.13,.14,.17],sn=[.4,.43,.47],kl=.18,Fl=.02,Ll=2.4,vl=1500,Nl=240,Gl=.25;function bi(t,n,e,r){let o=n.stageKind??"";if(Zt(o)||o==="round"||!r.length)return;let a=ct(n);if(!a||a.length<3)return;let i={x:a.reduce((B,L)=>B+L.x,0)/a.length,y:a.reduce((B,L)=>B+L.y,0)/a.length},s=0,c=0,l=new Set;for(let B of r)s+=B.x,c+=B.y,l.add(Math.floor(Math.atan2(B.y-i.y,B.x-i.x)*180/Math.PI/10));let u=i.x-s/r.length,f=i.y-c/r.length,m=Math.hypot(u,f);if(m<1e-6)return;let h=r.reduce((B,L)=>B+Math.hypot(L.x-i.x,L.y-i.y),0)/r.length;if(l.size*10>Nl&&m<Gl*h)return;let d=u/m,y=f/m,b=-y,p=d,g=-1/0,R=1/0,A=1/0,M=-1/0;for(let B of a){let L=(B.x-i.x)*d+(B.y-i.y)*y,T=(B.x-i.x)*b+(B.y-i.y)*p;g=Math.max(g,L),R=Math.min(R,L),A=Math.min(A,T),M=Math.max(M,T)}let x=(M-A)*S,I=(g-R)*S;if(x<3||I<1.5||x*I>vl)return;let P=kl/S,_=(B,L)=>({x:i.x+d*B+b*L,y:i.y+y*B+p*L}),O=(B,L,T,v)=>[_(B,T),_(B,v),_(L,v),_(L,T)],C=e+Math.max(3.5,Math.min(8,x*.35)),F=e+Math.min(Ll,C-e-1),k=.2/S,E=R+Math.min(I*.25,1.5)/S,w=Fl/S;Z(t,O(g-2*P+w,g-P-w,A+P+k,M-P-k),void 0,()=>F,e,xi,xi,K);for(let[B,L]of[[A+P,A+P+k],[M-P-k,M-P]])Z(t,O(g-2*P,g-P,B,L),void 0,()=>C+.3,e,sn,sn,K),Z(t,O(E+k,g-2*P,B,L),void 0,()=>C+.3,C,sn,sn,K);Z(t,O(E,E+k,A+P,M-P),void 0,()=>C+.3,C,sn,sn,K)}function Mt(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}function gt(t){return Array.isArray(t)?t:[]}function Dl(t){let n=[t];for(;n.length;){let e=n.pop();if(Array.isArray(e)){n.push(...e);continue}if(!Mt(e))continue;let r=Mt(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 ee(t,n){return!Array.isArray(t)||t.length!==n||!t.every(e=>typeof e=="number"&&Number.isFinite(e))?null:t}function Hl(){return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}function Xl(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 jl(t){let n=ee(t.matrix,16);if(n)return n;if(t.matrix!==void 0)return null;let e=t.translation===void 0?[0,0,0]:ee(t.translation,3),r=t.rotation===void 0?[0,0,0,1]:ee(t.rotation,4),o=t.scale===void 0?[1,1,1]:ee(t.scale,3);if(!e||!r||!o)return null;let[a,i,s,c]=r,l=Math.hypot(a,i,s,c);if(!(l>1e-8))return null;let u=a/l,f=i/l,m=s/l,h=c/l,d=u+u,y=f+f,b=m+m,p=u*d,g=u*y,R=u*b,A=f*y,M=f*b,x=m*b,I=h*d,P=h*y,_=h*b;return[(1-(A+x))*o[0],(g+_)*o[0],(R-P)*o[0],0,(g-_)*o[1],(1-(p+x))*o[1],(M+I)*o[1],0,(R+P)*o[2],(M-I)*o[2],(1-(p+A))*o[2],0,e[0],e[1],e[2],1]}function Ul(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 Wl(t){let n=t[0],e=t[4],r=t[8],o=t[1],a=t[5],i=t[9],s=t[2],c=t[6],l=t[10],u=a*l-i*c,f=i*s-o*l,m=o*c-a*s,h=n*u+e*f+r*m;if(Math.abs(h)<1e-12)return null;let d=1/h;return[u*d,f*d,m*d,(r*c-e*l)*d,(n*l-r*s)*d,(e*s-n*c)*d,(e*i-r*a)*d,(r*o-n*i)*d,(n*a-e*o)*d]}function gi(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 Yl(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 c=JSON.parse(new TextDecoder().decode(s).replace(/[\u0000 ]+$/g,""));if(!Mt(c))return null;r=c}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 zl(t){return t===5120||t===5121?1:t===5122||t===5123?2:t===5125||t===5126?4:0}function Kl(t){return t==="SCALAR"?1:t==="VEC2"?2:t==="VEC3"?3:t==="VEC4"?4:0}function Vl(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 Zl(t){let n=t instanceof Uint8Array?t:new Uint8Array(t),e=Yl(n);if(!e)return{ok:!1,issue:"invalid_glb"};let{json:r,bin:o}=e;if(!Mt(r.asset)||r.asset.version!=="2.0")return{ok:!1,issue:"unsupported_glb"};let a=gt(r.extensionsUsed).filter(A=>typeof A=="string");if(a.includes("KHR_draco_mesh_compression")||Dl(r))return{ok:!1,issue:"draco_not_allowed"};if(a.length||gt(r.extensionsRequired).length)return{ok:!1,issue:"unsupported_glb"};if(gt(r.images).length||gt(r.textures).length)return{ok:!1,issue:"external_resource"};let i=gt(r.buffers);if(i.length!==1||!Mt(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=gt(r.accessors),c=gt(r.bufferViews),l=gt(r.meshes),u=gt(r.nodes),f=gt(r.scenes),m=typeof r.scene=="number"?r.scene:0;if(!Mt(f[m]))return{ok:!1,issue:"unsupported_glb"};let h=new DataView(o.buffer,o.byteOffset,o.byteLength),d=(A,M,x)=>{if(typeof A!="number"||!Number.isInteger(A)||!Mt(s[A]))return null;let I=s[A];if(I.type!==M||I.sparse!==void 0||I.normalized===!0||typeof I.count!="number"||!Number.isInteger(I.count)||I.count<1||typeof I.componentType!="number"||!x.includes(I.componentType)||typeof I.bufferView!="number")return null;let P=c[I.bufferView];if(!Mt(P)||P.buffer!==0||typeof P.byteLength!="number"||!Number.isInteger(P.byteLength)||P.byteLength<0)return null;let _=Kl(I.type),O=zl(I.componentType),C=typeof P.byteStride=="number"?P.byteStride:_*O,F=typeof P.byteOffset=="number"?P.byteOffset:0,k=typeof I.byteOffset=="number"?I.byteOffset:0,E=F+k,w=k+(I.count-1)*C+_*O;if(!Number.isInteger(C)||!Number.isInteger(F)||!Number.isInteger(k)||C<_*O||F<0||k<0||F+P.byteLength>o.byteLength||w>P.byteLength)return null;let B=[];for(let L=0;L<I.count;L++){let T=[];for(let v=0;v<_;v++){let H=Vl(h,E+L*C+v*O,I.componentType);if(!Number.isFinite(H))return null;T.push(H)}B.push(T)}return B},y=[],b=[],p=0,g=new Set,R=(A,M)=>{if(typeof A!="number"||!Number.isInteger(A)||!Mt(u[A])||g.has(A))return!1;g.add(A);let x=u[A],I=jl(x);if(!I)return!1;let P=Xl(M,I),_=Wl(P);if(!_)return!1;if(x.mesh!==void 0){if(typeof x.mesh!="number")return!1;let O=l[x.mesh];if(!Mt(O))return!1;for(let C of gt(O.primitives)){if(!Mt(C)||C.mode!==void 0&&C.mode!==4||!Mt(C.attributes))return!1;let F=d(C.attributes.POSITION,"VEC3",[5126]),k=C.attributes.NORMAL===void 0?null:d(C.attributes.NORMAL,"VEC3",[5126]);if(!F||C.attributes.NORMAL!==void 0&&!k)return!1;let E=F.length;if(C.indices!==void 0){let B=typeof C.indices=="number"?s[C.indices]:null;E=Mt(B)?B.count:void 0}if(typeof E!="number"||!Number.isInteger(E)||E%3!==0||(p+=E/3,p>1e5))return!1;let w=C.indices===void 0?F.map((B,L)=>[L]):d(C.indices,"SCALAR",[5121,5123,5125]);if(!w||w.length%3!==0||w.length!==E)return!1;for(let B=0;B<w.length;B+=3){let L=[w[B][0],w[B+1][0],w[B+2][0]];if(L.some(H=>!Number.isInteger(H)||H<0||H>=F.length))return!1;let T=L.map(H=>Ul(P,...F[H])),v=null;if(!k){let H=T[1][0]-T[0][0],j=T[1][1]-T[0][1],D=T[1][2]-T[0][2],U=T[2][0]-T[0][0],X=T[2][1]-T[0][1],Y=T[2][2]-T[0][2];v=gi([1,0,0,0,1,0,0,0,1],j*Y-D*X,D*U-H*Y,H*X-j*U)}for(let H=0;H<3;H++)y.push(...T[H]),b.push(...k?gi(_,...k[L[H]]):v)}}}for(let O of gt(x.children))if(!R(O,P))return!1;return g.delete(A),!0};for(let A of gt(f[m].nodes))if(!R(A,Hl()))return{ok:!1,issue:p>1e5?"triangle_limit":"unsupported_glb"};return!p||y.length!==p*9||b.length!==y.length?{ok:!1,issue:"unsupported_glb"}:{ok:!0,triangleCount:p,position:new Float32Array(y),normal:new Float32Array(b)}}function Mi(t){try{return Zl(t)}catch{return{ok:!1,issue:"invalid_glb"}}}function rd(t){let{doc:n}=t,e=Ur(n.theme),r=e.structure,o=Xo(n,t.eventConfigurationId??n.eventConfigurationId),a=pi(t.eventConfigurationId,t.eventConfiguration,o),i=t.seats,s=new Nn,c=null;if(t.registeredShellGlb){let N=Mi(t.registeredShellGlb);if(N.ok){let G=N.position.length/3,W=new Float32Array(N.position.length),lt=e.materials.shell??r.tierWall;for(let ft=0;ft<G;ft++){let st=N.normal[ft*3+1],tt=st<-.25?.4:.62+.38*Math.max(0,st);W[ft*3]=lt[0]*tt,W[ft*3+1]=lt[1]*tt,W[ft*3+2]=lt[2]*tt}c={position:N.position,normal:N.normal,color:W,floor:new Float32Array(G).fill(-2),material:new Float32Array(G),count:G}}}let l=new Map;for(let N of o)for(let G of N.objects)l.set(G.id,N.index),G.type==="section"&&l.set(G.logicalSectionId??G.id,N.index);let u=i.map(N=>l.get(N.sectionId??"")??l.get(N.rowId??"")??0),f=Ue(o,i),m=s.vertexCount,d=hi(s,o,i,u,f,r,at(e.background.top,e.background.bottom,.5))?s.vertexCount:m,y=Ao(n,i),b=new Map,p=new Map;for(let N of n.categories??[])b.set(N.key,N.color),N.seatGlyph&&p.set(N.key,N.seatGlyph);let g=[],R=lr(o,i,u),A=new Map;i.forEach((N,G)=>{let W=R.seatDeckY(G);Number.isFinite(W)&&A.set(N.rowId,Math.min(A.get(N.rowId)??1/0,W))});let M=new Float32Array(i.length),x=[],I=new Map((n.floors??[]).map((N,G)=>[N.id,G])),P=o.map(()=>[]);for(let N of i){let G=N.floorId?I.get(N.floorId)??0:0;P[Math.min(G,P.length-1)]?.push(N)}let _=(N,G)=>{if(!G||G.length<3)return!1;let W=Math.min(...G.map(tt=>tt.x)),lt=Math.max(...G.map(tt=>tt.x)),ft=Math.min(...G.map(tt=>tt.y)),st=Math.max(...G.map(tt=>tt.y));for(let tt=0;tt<N;tt++)for(let et of P[tt])if(!(et.x<W||et.x>lt||et.y<ft||et.y>st)&&St(et,G,void 0))return!0;return!1},O=null,C=N=>o.length===1?i:i.filter((G,W)=>u[W]===N),F=(N,G)=>{let W=At(N);if(!W)return!1;let lt=1/0,ft=1/0,st=-1/0,tt=-1/0;for(let et of W)lt=Math.min(lt,et.x),st=Math.max(st,et.x),ft=Math.min(ft,et.y),tt=Math.max(tt,et.y);return i.some((et,ht)=>et.kind!=="booth"&&(o.length===1||u[ht]===G)&&et.x>lt&&et.x<st&&et.y>ft&&et.y<tt&&xt(W,et.x,et.y))},k;for(let N=0;N<o.length;N++){let G=o[N];s.setFloor(N);let W=Nt(G,C(N)),lt=0;if(W){let z=0;for(let mt of G.objects)if(mt.type==="section")for(let yt of R.bySection.get(mt.id)?.rowLevels??[])z=Math.max(z,yt.y-G.baseHeightM);if(lt=Ko(z),!k){let mt=tn(W);k={centre:[mt.x*S,mt.y*S]}}}let ft=new Xn,st=[],tt=G.objects.filter(z=>z.type==="shape"&&(z.role==="entrance"||z.role==="exit")),et=G.objects.filter(z=>z.type==="section"&&!!z.outline&&z.outline.length>=3),ht=zr(G.objects.filter(z=>z.type==="booth"),G.focal);for(let z of G.objects)if(z.type==="section"){let mt=s.vertexCount;ri(s,z,G,Eo(z,y),R.bySection.get(z.id),ft,et,r,N>0&&_(N,z.outline));let yt=s.vertexCount-mt;yt>0&&x.push({sectionId:z.id,start:mt,count:yt})}else if(z.type==="shape"){let mt=a.byObjectId.get(z.id),yt=g.length,Dt=W!==null&&z.role==="wall"&&!mt;s.setMaterial(Dt?jn:(mt?.kind??z.role)==="screen"?1:0);let Ht=z.role==="stage"&&!mt?Kr(z,C(N)):Dt&&z.heightM===void 0?{...z,heightM:lt}:z,kt=Yo(Ht,st);if(Er(s,Ht,G.baseHeightM+kt.supportOffsetM,kt.topOffsetM-kt.supportOffsetM,r,G.focal,g,mt,tt),s.setMaterial(0),z.role==="stage"&&!mt&&g.length>yt&&(O??N)===N){O=N;let Ft=n.floors?.[N]?.id,an=o.length>1&&Ft?i.filter(Pn=>Pn.floorId===Ft):i;bi(s,Ht,g[g.length-1].y,an)}}else z.type==="gaArea"?Br(s,z,G.baseHeightM,it(b.get(z.categoryKey)),r):z.type==="booth"?Ir(s,z,G.baseHeightM,it(b.get(z.categoryKey)),r,ht.get(z.id)??G.focal,F(z,N)):z.type==="table"?Ar(s,z,Math.max(G.baseHeightM,A.get(z.id)??G.baseHeightM),it(z.fill??n.theme?.decorFill??"#232c40"),r,!!(z.fill??n.theme?.decorFill)):z.type==="decorImage"&&wr(s,z,G.baseHeightM,r);W&&Cr(s,G.objects,W,G.baseHeightM,lt,G.focal,r,z=>!a.byObjectId.has(z.id)),si(s,G,i,R,r,e.materials.shell,!c)}let E=o.length>1?{x:o.reduce((N,G)=>N+G.focal.x,0)/o.length,y:o.reduce((N,G)=>N+G.focal.y,0)/o.length}:n.focalPoint??{x:(f.minX+f.maxX)/2,y:(f.minY+f.maxY)/2},w=go(c?[s.build(),c]:[s.build()]),B=Po(i,t.initialState,R,M,b,p),L=Gr({doc:n,units:o,seats:i,surfaces:R,focal:E}),{labels:T,sections:v,rows:H}=Dr({doc:n,units:o,seats:i,surfaces:R,seatData:B,hintedSeatFloor:u,zones:L,focal:E}),j=new Map(v.map((N,G)=>[N.id,G]));R.seatOwner.forEach((N,G)=>{B.iSection[G]=N?j.get(N)??-1:-1});let D=ai({doc:n,units:o,seats:i,surfaces:R,solids:w,hintedSeatFloor:u,seatFloor:M});Hr(T,D),B.iYaw=So(B.iPosition,i.length,N=>i[N].rowId,N=>{let G=o[M[N]]?.focal??E;return[G.x*S,G.y*S]});let U=(f.minX+f.maxX)/2*S,X=(f.minY+f.maxY)/2*S,Y=.5*Math.hypot((f.maxX-f.minX)*S,(f.maxY-f.minY)*S)||10,nt=We(w,B,{cx:U,cz:X,radius:Y},[m,d]),rt=We(w,B,{cx:U,cz:X,radius:Y}),q=ql(o),Q=di(B,g,f,nt.minY,nt.maxY,Y,q);return{sharedAisles:Xr(o.flatMap(N=>N.objects.flatMap(G=>{if(G.type!=="section")return[];let W=R.bySection.get(G.id);return W?[{sectionId:G.id,floorIndex:N.index,rows:W.rowLevels}]:[]}))),solids:w,sectionSolidRanges:x,seats:B,seatSectionIds:R.seatOwner,bounds:{center:[(Q.min[0]+Q.max[0])/2,(Q.min[1]+Q.max[1])/2,(Q.min[2]+Q.max[2])/2],radius:Y,groundY:0,box:Q,fitPoints:yi(B,g,q)},...k?{room:k}:{},...!k&&o.some(N=>N.objects.some(G=>G.type==="shape"&&En(G.stageKind)))?{outdoor:!0}:{},renderBounds:{center:nt.center,radius:nt.radius},clipBounds:{center:rt.center,radius:rt.radius},stateColorLUT:Wr(e,ln),theme:e,seatCount:i.length,focalWorld:[E.x*S,1.5,E.y*S],zones:L,stages:g,productionElements:a.elements,sections:v,rows:H,labels:T,floors:D}}function ql(t){let n=[];for(let e of t)for(let r of e.objects){let o=r.type==="gaArea"?r.points:r.type==="booth"?At(r):null;for(let a of o??[])n.push([a.x*S,e.baseHeightM,a.y*S])}return n}function $l(t,n){let{doc:e,report:r}=or(t),o=r.confident&&(r.sections.length>0||!!r.looseRowBlocks);if(!o&&!r.roles?.length)return null;if(!o){let c=new Map(r.roles.map(h=>[h.id,h.role])),l=h=>h.map(d=>d.type==="shape"&&c.has(d.id)?{...d,role:c.get(d.id)}:d),u=t.floors?.map(h=>({...h,objects:l(h.objects)})),f=new Float64Array(n.length).fill(Number.NaN),m=new Float64Array(n.length*2).fill(Number.NaN);return n.forEach((h,d)=>{h.eyeHeightM!==void 0&&(f[d]=h.eyeHeightM),h.focalPoint&&(m[d*2]=h.focalPoint.x,m[d*2+1]=h.focalPoint.y)}),{doc:{...t,objects:u?.[0]?.objects??l(t.objects),...u?{floors:u}:{}},report:r,eyeHeightM:f,focal:m}}let a=new Map(wn(e).map(c=>[c.id,c])),i=new Float64Array(n.length).fill(Number.NaN),s=new Float64Array(n.length*2).fill(Number.NaN);return n.forEach((c,l)=>{let u=a.get(c.id)??c;u.eyeHeightM!==void 0&&(i[l]=u.eyeHeightM),u.focalPoint&&(s[l*2]=u.focalPoint.x,s[l*2+1]=u.focalPoint.y)}),{doc:e,report:r,eyeHeightM:i,focal:s}}function Ql(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 cd(t){let n=t.estimate===!1?null:$l(t.doc,t.seats);return n?{input:{...t,doc:n.doc,seats:Ql(t.seats,n)},estimate:n}:{input:t}}export{uu as a,Li as b,vi as c,Mo as d,Ni as e,fu as f,ln as g,ce as h,Fn as i,eu as j,ue as k,S as l,Dn as m,Mu as n,Ru as o,or as p,hf as q,yf as r,df as s,pf as t,xf as u,bf as v,Se as w,gf as x,Mf as y,Rf as z,Sf as A,Pf as B,Oc as C,rd as D,$l as E,Ql as F,cd as G};
|
package/dist/chunk-YE4NP3XB.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{h as Ne,j as me,n as Le,p as je}from"./chunk-S3VH7IDA.js";import{c as Fe}from"./chunk-CRCGO52K.js";var ho=2e6,Tt=/^data:image\/(?:png|jpe?g|webp|gif|avif);base64,[a-z0-9+/]+={0,2}$/i,At=/[\s"'<>`\\]/;function Nt(e){if(typeof e!="string"||!e||e.length>2e6||e!==e.trim())return!1;if(e.startsWith("data:"))return Tt.test(e);if(At.test(e))return!1;try{let t=new URL(e);return t.protocol==="https:"&&!t.username&&!t.password}catch{return!1}}function De(e){let t=e.trim();return Nt(t)?t:null}var Lt=2e5,po=1e5,jt="large_venue_inventory";function yo(e){return e?.includes(jt)?2e5:1e5}var te="seatlayer.event-configuration/1",pe="seatlayer.event-configuration-export/1",G=100,Ft=120,Dt=2e5,Vt=1e4,He=/^[a-f0-9]{64}$/,Ht=new Set(["stage","screen","barrier","camera_platform","sound_desk","rigging_truss"]);function z(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 Ue(e){return typeof e=="number"&&Number.isInteger(e)&&e>0}function Ve(e){return!Array.isArray(e)||e.length>Dt||!e.every(t=>H(t,G))?null:[...new Set(e)].sort()}function Ge(e){return!z(e)||!H(e.chartId,G)||!H(e.version,G)||e.sha256!==void 0&&(typeof e.sha256!="string"||!He.test(e.sha256))?null:{chartId:e.chartId,version:e.version,...typeof e.sha256=="string"?{sha256:e.sha256}:{}}}function ye(e,t,n){return typeof e=="number"&&Number.isFinite(e)&&e>=t&&e<=n}function Ut(e){return z(e)?e.mode==="none"||e.mode==="opaque"?e.opacity===void 0?{mode:e.mode}:null:e.mode==="partial"&&ye(e.opacity,.01,.99)?{mode:"partial",opacity:e.opacity}:null:null}function Gt(e,t){if(e===void 0)return;if(!Array.isArray(e)||e.length>Vt)return null;let n=new Set(t),i=new Set,o=new Set,r=0,s=[];for(let l of e){if(!z(l)||!H(l.id,G)||!H(l.objectId,G)||!n.has(l.objectId)||!Ht.has(String(l.kind))||!ye(l.heightM,.05,50)||l.baseElevationM!==void 0&&!ye(l.baseElevationM,-10,100))return null;let h=Ut(l.occlusion);if(!h||i.has(l.id)||o.has(l.objectId))return null;let a=l.contentImageUrl===void 0?void 0:typeof l.contentImageUrl=="string"?De(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:h,...a?{contentImageUrl:a}:{}})}return s.sort((l,h)=>l.id.localeCompare(h.id))}function Xe(e){let t=[];if(!z(e))return{issues:[{code:"invalid_export",path:"configuration",message:"Configuration must be an object"}]};e.schema!==te&&t.push({code:"unsupported_schema",path:"configuration.schema",message:`Configuration schema must be ${te}`}),H(e.id,G)||t.push({code:"invalid_id",path:"configuration.id",message:"Configuration id must contain 1 to 100 normalized characters"}),H(e.label,Ft)||t.push({code:"invalid_label",path:"configuration.label",message:"Configuration label must contain 1 to 120 normalized characters"}),Ue(e.version)||t.push({code:"invalid_version",path:"configuration.version",message:"Configuration version must be a positive integer"});let n=Ge(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=z(e.overlay)?e.overlay:null,o=Ve(i?.objectIds),r=Ve(i?.productionKillSeatIds),s=o?Gt(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:te,id:e.id,label:e.label,version:e.version,baseVenue:n,overlay:{objectIds:o,productionKillSeatIds:r,...s!==void 0?{productionElements:s}:{}}}}}function xo(e){let t=Xe(e);return t.value?{ok:!0,value:t.value}:{ok:!1,issues:t.issues}}function So(e){if(!z(e))return{ok:!1,issues:[{code:"invalid_export",path:"",message:"Export must be an object"}]};let t=[];e.schema!==pe&&t.push({code:"unsupported_schema",path:"schema",message:`Export schema must be ${pe}`}),(typeof e.contentSha256!="string"||!He.test(e.contentSha256))&&t.push({code:"invalid_checksum",path:"contentSha256",message:"Export checksum must be a lowercase SHA-256 digest"});let n=Xe(e.configuration);return t.push(...n.issues),t.length||!n.value||typeof e.contentSha256!="string"?{ok:!1,issues:t}:{ok:!0,value:{schema:pe,configuration:n.value,contentSha256:e.contentSha256}}}function Mo(e){return JSON.stringify({schema:te,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 Po(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 Xt={draft:new Set(["review","archived"]),review:new Set(["draft","approved","archived"]),approved:new Set(["published","archived"]),published:new Set(["archived"]),archived:new Set};function vo(e,t){return e===t||Xt[e].has(t)}function Eo(e,t,n){return!Ue(n)||n>=t.version?null:e.find(i=>i.id===t.id&&i.version===n&&i.status==="published")??null}function Kt(e){return e.floors?.length?e.floors.flatMap(t=>t.objects):e.objects}function be(e,t,n){if(!(!e||typeof e!="object")){if(Array.isArray(e)){for(let i of e)be(i,t,n);return}for(let[i,o]of Object.entries(e)){if(i==="eventConfigurationId"){H(o,G)?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,G)?t.add(r):n.add(String(r));continue}be(o,t,n)}}}function Io(e,t){let n=Ge(t);if(!n)return{ok:!1,invalidIds:["baseVenue"]};let i=new Set,o=new Set;if(be(e,i,o),o.size)return{ok:!1,invalidIds:[...o].sort()};let r=Kt(e);return{ok:!0,configurations:[...i].sort().map(s=>({schema:te,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,_o=1200,Oo=.8,ko=3,Ro=-2,To=20,Ao=.1,No=40,Lo=40,Ke=e=>Math.max(1,e.fontSize*.6+(e.letterSpacing??0));function Bt(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/Ke(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 h=l.length;s&&s+1+h<=i?s+=1+h:(o+=Math.max(1,Math.ceil(h/i)),s=h%i)}}return Math.max(1,o)}function Be(e){let t=e.background?.padding??0,n=e.text.split(/\r?\n/),i=Math.max(1,...n.map(l=>l.length))*Ke(e),o=e.width??i+t*2,r=Math.max(1,o-t*2),s=Bt(e,r);return{width:o,height:s*e.fontSize*(e.lineHeight??1.2)+t*2,lineCount:s,padding:t}}var Ye=Math.PI/180;function R(e,t){return Math.hypot(e.x-t.x,e.y-t.y)}function ze(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 Fo(e,t,n){return n?ze(e,t,n*Ye):e}function Do(e,t){return ze(e,{x:0,y:0},t*Ye)}function j(e,t,n){return{x:e.x+(t.x-e.x)*n,y:e.y+(t.y-e.y)*n}}function Yt(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 Vo(e){return e.length?Yt(e):null}function ge(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 Go(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 qe(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[ge(e,.5)];let i=Array.from({length:n+1},(h,a)=>ge(e,a/n)),o=new Float64Array(i.length);for(let h=1;h<i.length;h+=1){let a=i[h].x-i[h-1].x,c=i[h].y-i[h-1].y;o[h]=o[h-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 h=0;h<t;h+=1){let a=r*h/(t-1);for(;l<o.length-1&&o[l]<a;)l+=1;let c=o[l-1],u=o[l],m=u===c?0:(a-c)/(u-c);s.push({x:i[l-1].x+(i[l].x-i[l-1].x)*m,y:i[l-1].y+(i[l].y-i[l-1].y)*m})}return s}function F(e,t){return{x:e.x+t.x,y:e.y+t.y}}function ne(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 ae(e,t=13){return Array.from({length:t},(n,i)=>ge(e,i/(t-1)))}function We(e,t){let n=Math.max(0,Math.min(1,t))*(e.length-1),i=Math.min(e.length-2,Math.floor(n));return j(e[i],e[i+1],n-i)}function $e(e,t,n){let i=Math.max(0,Math.min(1,t)),o=Math.max(i,Math.min(1,n)),r=[We(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(We(e,o)),r}function Qe(e,t){let n=[[0,1],[1,2],[2,3],[3,0]],i=0,o=Number.POSITIVE_INFINITY;n.forEach(([m,d],p)=>{let f=R(j(e[m],e[d],.5),t);f<o&&(o=f,i=p)});let r=e[i],s=e[(i+1)%4],l=e[(i+2)%4],h=e[(i+3)%4],a=j(r,s,.5),c=ne(t,a),u=Math.max(1e-9,Math.hypot(c.x,c.y));return{p0:r,p1:s,p2:l,p3:h,normal:D(c,1/u),depth:(R(r,h)+R(s,l))/2}}function Je(e){let{p0:t,p1:n,p2:i,p3:o,normal:r,depth:s}=e,l=ne(n,t),h=ne(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(h,2/3)),D(r,c)),control2:F(F(o,D(h,1/3)),D(r,c)),end:o}}}function Xo(e,t,n){if(e.length!==4)throw new Error("A section shell requires four mapped bounds corners");let i=e.reduce((p,f)=>F(p,f),{x:0,y:0});i.x/=4,i.y/=4;let o=R(e[0],e[1]),r=R(e[0],e[3]),s=n==="auto"?o>r*1.25&&R(i,t)>r?"bezier":"tapered":n;if(s==="rectangle")return{mode:s,outline:e.map(p=>({...p}))};let l=Qe(e,t),{p0:h,p1:a,p2:c,p3:u}=l;if(s==="tapered")return{mode:s,outline:[F(h,D(ne(a,h),.14)),F(h,D(ne(a,h),1-.14)),c,u]};let{nearPath:m,farPath:d}=Je(l);return{mode:s,outline:[...ae(m),...ae(d).slice(1)]}}function Ko(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=Qe(e,t),{p0:r,p1:s,p2:l,p3:h}=o,a=i==="bezier"?Je(o):null,c=a?ae(a.nearPath):null,u=a?ae(a.farPath).reverse():null,m=Math.min(.055,.18/(n+1));return Array.from({length:n},(d,p)=>{let f=(p+1)/(n+1),g=f-m/2,v=f+m/2;return c&&u?[...$e(c,g,v),...$e(u,g,v).reverse()]:[j(r,s,g),j(r,s,v),j(h,l,v),j(h,l,g)]})}function zt(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 Wt(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=zt(e,i[r],i[o]);s<n&&(n=s)}return n}function Ze(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,h=t[o].y;s>e.y!=h>e.y&&e.x<(l-r)*(e.y-s)/(h-s)+r&&(n=!n)}return n}function tt(e){return Array.isArray(e)?e.filter(t=>Array.isArray(t)&&t.length>=3):[]}function $t(e,t,n){let i=Ze(e,t)&&!n.some(r=>Ze(e,r)),o=Wt(e,[t,...n]);return i?o:-o}function W(e,t,n,i,o){let r=$t({x:e,y:t},i,o);return{x:e,y:t,h:n,d:r,max:r+n*Math.SQRT2}}var xe=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 et(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 Yo(e,t){return Math.max(0,et(e)-tt(t).reduce((n,i)=>n+et(i),0))}function nt(e,t){let n=tt(t);if(!e.length)return{point:{x:0,y:0},radius:0};if(e.length<3){let f=e.reduce((v,E)=>v+E.x,0)/e.length,g=e.reduce((v,E)=>v+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,h=s-o,a=Math.min(l,h);if(!(a>0))return{point:{x:(i+r)/2,y:(o+s)/2},radius:0};let c=Math.max(l,h)/150,u=new xe,m=a/2;for(let f=i;f<r;f+=a)for(let g=o;g<s;g+=a)u.push(W(f+m,g+m,m,e,n));let d=W(i+l/2,o+h/2,0,e,n),p=0;for(;u.size;){let f=u.pop();if(!f)break;f.d>d.d&&(d=f),!(f.max-d.d<=c)&&(p>=4e3||(p+=1,m=f.h/2,u.push(W(f.x-m,f.y-m,m,e,n)),u.push(W(f.x+m,f.y-m,m,e,n)),u.push(W(f.x-m,f.y+m,m,e,n)),u.push(W(f.x+m,f.y+m,m,e,n))))}return{point:{x:d.x,y:d.y},radius:Math.max(0,d.d)}}function qt(e,t,n){return Math.max(t,Math.min(n,e))}function Wo(e,t,n){return e<t?t:e>n?n:e}function Qt(e){return qt(e,0,1)}function ot(e){let t=Qt(e);return t*t*(3-2*t)}var $=Math.PI*2;function q(e){return Number.isFinite(e.x)&&Number.isFinite(e.y)}function Jt(e,t,n){let i=t-e;if(n){for(;i<0;)i+=$;for(;i>=$;)i-=$}else{for(;i>0;)i-=$;for(;i<=-$;)i+=$}return i}function Jo(e){return e.end}function st(e){if(e.version!==1||e.closed!==!0||!q(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||!q(n.end))return!1;if(n.kind==="line"){if(R(t,n.end)<=1e-9)return!1}else if(n.kind==="bezier"){if(!q(n.control1)||!q(n.control2)||R(t,n.end)<=1e-9)return!1}else if(n.kind==="arc"){if(!q(n.center)||!Number.isFinite(n.radius)||n.radius<=1e-6||Math.abs(R(t,n.center)-n.radius)>Math.max(1e-4,n.radius*1e-4)||Math.abs(R(n.end,n.center)-n.radius)>Math.max(1e-4,n.radius*1e-4)||R(t,n.end)<=1e-9)return!1}else return!1;t=n.end}return R(t,e.start)<=1e-4}function Zt(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 at(e,t=2){if(!st(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),h=Jt(s,l,r.clockwise),a=Math.max(2,Math.ceil(Math.abs(h)*r.radius/n));for(let c=1;c<=a;c+=1){let u=s+h*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=R(o,r.control1)+R(r.control1,r.control2)+R(r.control2,r.end),l=Math.max(2,Math.ceil(s/n));for(let h=1;h<=l;h+=1)i.push(Zt(o,r,h/l))}o=r.end}return R(i[i.length-1],i[0])<=1e-4&&i.pop(),i}function ct(e,t,n){return en(e,o=>({x:o.x+t,y:o.y+n}))}function en(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)})}}function Zo(e){return e.map(t=>t===0?0:-t)}var tn=45,Se=150,nn=60;function on(e){let t=tn/100;if(e<=t)return Se;let n=Math.min(1,(e-t)/(1-t));return Se-n*(Se-nn)}var it=.5523;function rt(e,t){return Math.abs(e.x-t.x)<=1e-6&&Math.abs(e.y-t.y)<=1e-6}function rn(e){let t=[],n=[];for(e.forEach((i,o)=>{q(i)&&(t.length&&rt(t[t.length-1],i)||(t.push({x:i.x,y:i.y}),n.push(o)))});t.length>1&&rt(t[0],t[t.length-1]);)t.pop(),n.pop();return{points:t,sourceIndex:n}}function ei(e,t,n){return Me(e,{cornerSmoothing:t,...n})}var sn=.5,an=4/3;function cn(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,h=n*an;return{kind:"bezier",control1:{x:e.x+i/3+s*h,y:e.y+o/3+l*h},control2:{x:e.x+i*2/3+s*h,y:e.y+o*2/3+l*h},end:{...t}}}function Me(e,t){let{points:n,sourceIndex:i}=rn(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 S=s[i[x]];l[x]=Number.isFinite(S)?Math.min(100,Math.max(-100,S))/100:0}let h=l.some(x=>Math.abs(x)>1e-6);if(r<=0&&!h)return null;let a=t.wideAngleThresholdDeg??on(r),c=[];for(let x=0;x<o;x+=1)c[x]=R(n[x],n[(x+1)%o]);let u=new Array(o).fill(0);for(let x=0;x<o;x+=1){let S=n[(x-1+o)%o],y=n[x],b=n[(x+1)%o],P={x:S.x-y.x,y:S.y-y.y},M={x:b.x-y.x,y:b.y-y.y},_=Math.hypot(P.x,P.y),T=Math.hypot(M.x,M.y);if(_<=1e-9||T<=1e-9)continue;let I=Math.min(1,Math.max(-1,(P.x*M.x+P.y*M.y)/(_*T))),C=Math.acos(I)*180/Math.PI;if(C<a)continue;let O=ot((C-a)/(180-a));u[x]=r*O*.5*Math.min(_,T)}for(let x=0;x<o;x+=1){let S=(x+1)%o,y=u[x]+u[S];if(y>c[x]&&y>1e-9){let b=c[x]/y;u[x]*=b,u[S]*=b}}let m=new Array(o),d=new Array(o);for(let x=0;x<o;x+=1){let S=n[(x-1+o)%o],y=n[x],b=n[(x+1)%o];if(u[x]<=1e-6){m[x]={...y},d[x]={...y};continue}let P=R(y,S)||1,M=R(y,b)||1;m[x]={x:y.x+(S.x-y.x)/P*u[x],y:y.y+(S.y-y.y)/P*u[x]},d[x]={x:y.x+(b.x-y.x)/M*u[x],y:y.y+(b.y-y.y)/M*u[x]}}if(u.every(x=>x<=1e-6)&&!h)return null;let p=[],f={...d[0]},g=f,v=(x,S)=>{if(R(g,x)<=1e-9)return;let y=l[S];Math.abs(y)>1e-6?p.push(cn(g,x,y*sn*c[S])):p.push({kind:"line",end:{...x}}),g=x};for(let x=1;x<=o;x+=1){let S=x%o,y=n[S];v(m[S],(x-1)%o),u[S]>1e-6&&R(m[S],d[S])>1e-9&&(p.push({kind:"bezier",control1:j(m[S],y,it),control2:j(d[S],y,it),end:{...d[S]}}),g=d[S])}if(!p.length)return null;let E=p[p.length-1];R(E.end,f)>1e-9&&(E.kind==="line"?E.end={...f}:p.push({kind:"line",end:{...f}}));let w={version:1,closed:!0,start:f,segments:p};return st(w)?w:null}function ti(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 oi(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 h=Math.max(1,Math.round(l/n)),a=l/h,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,p=u?{...r}:{x:r.x+Math.cos(c)*a*d,y:r.y+Math.sin(c)*a*d},f=u?h+1:Math.max(1,h-(d-1));i.push({origin:p,rotation:c*180/Math.PI,seatCount:f,seatSpacing:a})}return i}function ii(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 ri(e){return e.reduce((t,n)=>t+n.seatCount,0)}function lt(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((m,d)=>m.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((m,d)=>m.segmentedRow?.kind==="segmented-row-v1"&&m.segmentedRow.groupId===i&&m.segmentedRow.componentCount===s&&m.segmentedRow.componentIndex===d&&m.segmentedRow.repeatLabelOnComponents===l.repeatLabelOnComponents&&(d===0?m.segmentedRow.boundaryBefore==="start":m.segmentedRow.boundaryBefore!=="start")&&m.segmentedRow.displayLabel===l.displayLabel)))continue;let a=r.reduce((m,d)=>m+d.seatCount,0),c=0,u=0;for(let m of r)m.segmentedRow.boundaryBefore==="break"&&(c+=1),t.set(m.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+=m.seatCount,u+=m.seatCount}return t}var Q=.02291666666666667,Ee=1/Q,ln=58,un=ln*Q,ai=0,dn=3,ut=0,Pe=120,fn=0,hn=45,mn=7,J=1.2;function ve(e,t,n,i){return Number.isFinite(e)?Math.max(t,Math.min(n,e)):i}function pn(e){return!Number.isFinite(e)||!Number.isInteger(e)||e<0?0:e<=mn?e:dn}function dt(e,t={}){let n=ve(t.floorBaseHeightM,ut,Pe,0),i=Math.min(Pe,n+pn(e.elevation)*un),o=e.height===void 0?i:ve(e.height,ut,Pe,i),r=ve(e.rake,fn,hn,0);return{height:o,rake:r}}function ft(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 ht(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,h=s.y-r.y,a=l*l+h*h,c=a>1e-12?((t-r.x)*l+(n-r.y)*h)/a:0;c<0?c=0:c>1&&(c=1);let u=t-(r.x+c*l),m=n-(r.y+c*h);if(Math.abs(u)>=i||Math.abs(m)>=i)continue;let d=Math.hypot(u,m);d<i&&(i=d)}return i}function yn(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 mt(e,t){return Math.hypot(e.cx-t.cx,e.cy-t.cy)-e.r-t.r}function Ie(e,t){let n=1/0;for(let i of ft(e)){let o=ht(t,i.x,i.y);o<n&&(n=o)}for(let i of ft(t)){let o=ht(e,i.x,i.y);o<n&&(n=o)}return n}function bn(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,h=Math.hypot(s,l);h>1e-9?(s/=h,l/=h):(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 gn(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,h=0,a=0,c=0;for(let E of e){let w=E.x-n,x=E.y-i;o+=w*w,s+=x*x,r+=w*x,l+=w*w*w,h+=x*x*x,a+=w*x*x,c+=x*w*w}let u=o*s-r*r;if(Math.abs(u)<1e-9)return null;let m=(l+a)/2,d=(h+c)/2,p=(m*s-d*r)/u,f=(d*o-m*r)/u,g=p+n,v=f+i;return!Number.isFinite(g)||!Number.isFinite(v)?null:{cx:g,cy:v}}var xn=.15,Sn=.001;function Mn(e){let t=e[0],n=e[e.length-1],i=n.x-t.x,o=n.y-t.y,r=Math.hypot(i,o);if(!(r>1e-9))return 0;let s=0;for(let l of e){let h=Math.abs((l.x-t.x)*o-(l.y-t.y)*i)/r;h>s&&(s=h)}return s/r}function Pn(e){if(e.length<2)return null;let t=e.map(S=>{let y=0,b=0;for(let P of S.pts)y+=P.x,b+=P.y;return{x:y/S.pts.length,y:b/S.pts.length}}),n=0,i=0;for(let S of t)n+=S.x,i+=S.y;n/=t.length,i/=t.length;let o=0,r=0,s=0;for(let S of t){let y=S.x-n,b=S.y-i;o+=y*y,r+=y*b,s+=b*b}let l=o+s,h=o*s-r*r,a=l/2+Math.sqrt(Math.max(0,l*l/4-h)),c,u;Math.abs(r)>1e-12?(c=a-s,u=r):o>=s?(c=1,u=0):(c=0,u=1);let m=Math.hypot(c,u);if(!(m>1e-12))return null;c/=m,u/=m;let d=0,p=0,f=0;for(let S of e){if(S.pts.length<2)continue;let y=S.pts[0],b=S.pts[S.pts.length-1],P=b.x-y.x,M=b.y-y.y,_=Math.hypot(P,M);if(!(_>1e-9))continue;let T=P/_,I=M/_;d+=(T*T-I*I)*_,p+=2*T*I*_,f+=_}if(f>0&&Math.hypot(d,p)>=En*f){let S=Math.atan2(p,d)/2;c=-Math.sin(S),u=Math.cos(S)}let g=1/0,v=-1/0,E=[];for(let S of e){let y=1/0,b=-1/0;for(let P of S.pts){let M=P.x*c+P.y*u;M<y&&(y=M),M>b&&(b=M),M<g&&(g=M),M>v&&(v=M)}E.push(b-y)}let w=v-g;return w>1e-9?(E.sort((S,y)=>S-y),E[Math.min(E.length-1,Math.floor(E.length*.9))]/w<=vn?{x:c,y:u}:null):null}var vn=.35,En=.8;function pt(e,t,n,i){let o=new Map;for(let y of n){let b=t[y],P=b.rowId||`__seat-${y}`,M=o.get(P);M||(M={pts:[],idx:[]},o.set(P,M)),M.pts.push({x:b.x,y:b.y}),M.idx.push(y)}if(!o.size)return{sectionId:e,rows:[],blockCount:0};let r=[];for(let[y,b]of o){let P=bn(b.pts,b.idx),M=0;for(let _ of P.pts)M+=Math.hypot(_.x-i.x,_.y-i.y);r.push({id:y,pts:P.pts,seatIndices:P.seatIndices,blockId:-1,ordinal:0,blockDepth:0,focalDistance:M/P.pts.length})}let s=r.map(y=>yn(y.pts)),l=r.length<=256?r.length*(r.length-1)/2:0,h=l?new Float64Array(l):null;h?.fill(Number.NaN);let a=h?new Map(r.map((y,b)=>[y,b])):null,c=(y,b)=>(y>b&&([y,b]=[b,y]),y*(2*r.length-y-1)/2+(b-y-1)),u=(y,b)=>{if(!h)return Ie(r[y].pts,r[b].pts);let P=c(y,b),M=h[P];if(!Number.isNaN(M))return M;let _=Ie(r[y].pts,r[b].pts);return h[P]=_,_},m=(y,b)=>a?u(a.get(y),a.get(b)):Ie(y.pts,b.pts),d=[];for(let y=0;y<r.length;y++){let b=1/0;for(let P=0;P<r.length;P++){if(y===P||mt(s[y],s[P])>=b)continue;let M=u(y,P);M<b&&(b=M)}Number.isFinite(b)&&d.push(b)}d.sort((y,b)=>y-b);let p=d.length?d[Math.floor(d.length/2)]:1,f=Math.max(p*1.8,1e-6),g=r.map(()=>[]);for(let y=0;y<r.length;y++)for(let b=y+1;b<r.length;b++)mt(s[y],s[b])>f||u(y,b)<=f&&(g[y].push(b),g[b].push(y));let v=0;for(let y=0;y<r.length;y++){if(r[y].blockId!==-1)continue;let b=v++,P=[y];for(r[y].blockId=b;P.length;){let M=P.pop();for(let _ of g[M])r[_].blockId===-1&&(r[_].blockId=b,P.push(_))}}let E=new Map;for(let y of r){let b=E.get(y.blockId)??[];b.push(y),E.set(y.blockId,b)}let w=[];for(let y of r){if(y.pts.length<4||Mn(y.pts)<Sn)continue;let b=gn(y.pts);b&&(!Number.isFinite(b.cx)||!Number.isFinite(b.cy)||w.push({x:b.cx,y:b.cy}))}let x=w.length>=2?(()=>{let y=w.map(M=>M.x).sort((M,_)=>M-_),b=w.map(M=>M.y).sort((M,_)=>M-_),P=Math.floor(w.length/2);return{cx:y[P],cy:b[P]}})():null;if(x){let y=I=>Math.hypot(I.x-x.cx,I.y-x.cy),b=1/0,P=-1/0,M=[];for(let I of r){let C=1/0,O=-1/0;for(let N of I.pts){let A=y(N);A<C&&(C=A),A>O&&(O=A)}M.push(O-C),C<b&&(b=C),O>P&&(P=O)}let _=P-b;M.sort((I,C)=>I-C);let T=M[Math.min(M.length-1,Math.floor(M.length*.9))];if(_>1e-9&&T/_<=xn){let I=r.map(k=>{let se=0;for(let Rt of k.pts)se+=y(Rt);return{row:k,radius:se/k.pts.length}}),C=0,O=0;for(let k of I)C+=k.radius,O+=k.row.focalDistance;C/=I.length,O/=I.length;let N=0;for(let k of I)N+=(k.radius-C)*(k.row.focalDistance-O);if(N<0)for(let k of I)k.radius=-k.radius;let L=1/0;for(let k of I)k.radius<L&&(L=k.radius);I.sort((k,se)=>k.radius-se.radius);let V=-1,Y=-1/0,kt=_/Math.max(1,I.length)*.5,Ae=[];for(let k of I)k.radius-Y>kt&&(V++,Y=k.radius),k.row.ordinal=V,k.row.blockDepth=k.radius-L,Ae.push(k.row);return{sectionId:e,rows:Ae,blockCount:v}}}let S=[];for(let[,y]of E){let b=Pn(y);if(b){let P=I=>{let C=0;for(let O of I.pts)C+=O.x*b.x+O.y*b.y;return C/I.pts.length};y.sort((I,C)=>P(I)-P(C)),y.length>=2&&y[0].focalDistance>y[y.length-1].focalDistance&&y.reverse();let M=[],_=p*.5;for(let I of y){let C=M[M.length-1];C&&Math.abs(P(I)-P(C[0]))<_?C.push(I):M.push([I])}let T=0;for(let I=0;I<M.length;I++){if(I>0){let C=1/0;for(let O of M[I-1])for(let N of M[I])C=Math.min(C,m(O,N));C=Math.min(C,Math.abs(P(M[I][0])-P(M[I-1][0]))),T+=C}for(let C of M[I])C.ordinal=I,C.blockDepth=T,S.push(C)}}else{let P=1/0;for(let M of y)M.focalDistance<P&&(P=M.focalDistance);y.sort((M,_)=>M.focalDistance-_.focalDistance);for(let M=0;M<y.length;M++)y[M].ordinal=M,y[M].blockDepth=Math.max(0,y[M].focalDistance-P),S.push(y[M])}}return{sectionId:e,rows:S,blockCount:v}}function In(e,t){return Math.abs(e.x-t.x)<=1e-7&&Math.abs(e.y-t.y)<=1e-7}function oe(e,t,n){return(t.x-e.x)*(n.y-e.y)-(t.y-e.y)*(n.x-e.x)}function ce(e,t,n){let i=oe(t,n,e);return Math.abs(i)>1e-7?!1:e.x>=Math.min(t.x,n.x)-1e-7&&e.x<=Math.max(t.x,n.x)+1e-7&&e.y>=Math.min(t.y,n.y)-1e-7&&e.y<=Math.max(t.y,n.y)+1e-7}function wn(e,t,n,i){let o=oe(e,t,n),r=oe(e,t,i),s=oe(n,i,e),l=oe(n,i,t);return(o>1e-7&&r<-1e-7||o<-1e-7&&r>1e-7)&&(s>1e-7&&l<-1e-7||s<-1e-7&&l>1e-7)?!0:Math.abs(o)<=1e-7&&ce(n,e,t)||Math.abs(r)<=1e-7&&ce(i,e,t)||Math.abs(s)<=1e-7&&ce(e,n,i)||Math.abs(l)<=1e-7&&ce(t,n,i)}function Cn(e){return e.reduce((t,n,i)=>{let o=e[(i+1)%e.length];return t+n.x*o.y-o.x*n.y},0)}function _n(e){for(let t=0;t<e.length;t+=1){let n=(t+1)%e.length;for(let i=t+1;i<e.length;i+=1){let o=(i+1)%e.length;if(!(t===i||n===i||o===t)&&wn(e[t],e[n],e[i],e[o]))return!0}}return!1}function ui(e){return e.length<3?{ok:!1,code:"too_few_vertices",message:"Add at least three vertices to create a polygon."}:e.length>256?{ok:!1,code:"too_many_vertices",message:"A polygon can contain at most 256 vertices."}:e.some(t=>!Number.isFinite(t.x)||!Number.isFinite(t.y)||Math.abs(t.x)>1e7||Math.abs(t.y)>1e7)?{ok:!1,code:"invalid_coordinate",message:"Every polygon vertex must use a finite coordinate inside the safe chart range."}:e.some((t,n)=>In(t,e[(n+1)%e.length]))?{ok:!1,code:"duplicate_vertex",message:"Move or remove duplicate neighbouring vertices."}:Math.abs(Cn(e))<2?{ok:!1,code:"degenerate_polygon",message:"The polygon needs a visible enclosed area."}:_n(e)?{ok:!1,code:"self_intersection",message:"Polygon edges cannot cross or touch each other."}:{ok:!0}}var mi=64;function On(e){let t=e.points??[];if(e.kind!=="polygon"||t.length<3||!Array.isArray(e.edgeCurvature))return[];let n=t.map((i,o)=>{let r=e.edgeCurvature[o];return Number.isFinite(r)?Math.min(100,Math.max(-100,r)):0});return n.some(i=>Math.abs(i)>.5)?n:[]}function kn(e){let t=On(e);return t.length?Me(e.points,{edgeCurvature:t}):null}function ie(e,t=2){let n=kn(e);return n?at(n,t):e.points??[]}function pi(e){return e.kind==="polygon"?X(e.holes):[]}function yi(e,t){let n=ie(e);return n.length<3||t.length<3||!t.flatMap((o,r)=>{let s=t[(r+1)%t.length];return[o,{x:(o.x+s.x)/2,y:(o.y+s.y)/2}]}).every(o=>Z(o,n)||we(o,n))?!1:!t.some((o,r)=>{let s=t[(r+1)%t.length];return n.some((l,h)=>yt(o,s,l,n[(h+1)%n.length]))})}function yt(e,t,n,i){let o=(a,c,u)=>(c.x-a.x)*(u.y-a.y)-(c.y-a.y)*(u.x-a.x),r=o(e,t,n),s=o(e,t,i),l=o(n,i,e),h=o(n,i,t);return r*s<-1e-9&&l*h<-1e-9}function bi(e,t){return Z(e[0],t)||Z(t[0],e)?!0:e.some((n,i)=>{let o=e[(i+1)%e.length];return t.some((r,s)=>yt(n,o,r,t[(s+1)%t.length]))})}var Si=[{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."}],Rn=new Set(["pitch-football","rink-hockey","track-athletics","oval-cricket","pitch-rugby","diamond-baseball","court-basketball","court-tennis","ring-boxing"]),Tn=new Set(["pitch-football","track-athletics","oval-cricket","pitch-rugby","diamond-baseball"]);function An(e){return!!e&&Rn.has(e)}function Mi(e){return!!e&&Tn.has(e)}var _e=1.1;function Pi(e){return le(e)?e==="ring-boxing"?_e:.06:1}var bt={round:{width:6,height:6},"pitch-football":{width:105,height:68},"rink-hockey":{width:60,height:30},"track-athletics":{width:176.9,height:92.5},"oval-cricket":{width:150,height:140},"pitch-rugby":{width:120,height:70},"diamond-baseball":{width:140,height:140},"court-basketball":{width:32,height:19},"court-tennis":{width:36.57,height:18.29},"ring-boxing":{width:7.8,height:7.8}},gt={"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"};function vi(e){let t=bt[e];return t?{width:t.width*Ee,height:t.height*Ee}:{width:300,height:70}}var Nn="#232c40",xt=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 Ln(e){let{kind:t,cx:n,cy:i,width:o,height:r}=e,s=(e.rotation??0)*Math.PI/180,l=Math.cos(s),h=Math.sin(s),a=o/2,c=r/2,u=[],m=(d,p)=>{u.push({x:d,y:p})};switch(t){case"rect":{m(-a,-c),m(a,-c),m(a,c),m(-a,c);break}case"rounded":{let d=Math.min(o,r)*.18,p=5,f=(g,v,E)=>{for(let w=0;w<=p;w++){let x=E+w/p*(Math.PI/2);m(g+d*Math.cos(x),v+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;m(-a,-c),m(a,-c);let p=24;for(let f=0;f<=p;f++){let g=f/p,v=a-g*o,E=c+d*(1-Math.pow(2*v/o,2));m(v,E)}break}case"thrust":{let d=o*.18,p=r*1.1;m(-a,-c),m(a,-c),m(a,c),m(d,c),m(d,c+p),m(-d,c+p),m(-d,c),m(-a,c);break}case"runway":{let d=o*.1,p=r*3;m(-a,-c),m(a,-c),m(a,c),m(d,c),m(d,c+p),m(-d,c+p),m(-d,c),m(-a,c);break}case"round":case"oval-cricket":{for(let p=0;p<40;p++){let f=p/40*xt;m(a*Math.cos(f),c*Math.sin(f))}break}case"pitch-football":case"pitch-rugby":case"court-basketball":case"court-tennis":case"ring-boxing":{m(-a,-c),m(a,-c),m(a,c),m(-a,c);break}case"diamond-baseball":{for(let d of Fn(a,c))m(d.x,d.y);break}case"rink-hockey":{for(let d of jn(a,c,a*(8.5/60),c*(8.5/30)))m(d.x,d.y);break}case"track-athletics":{for(let d of Ce(a,c))m(d.x,d.y);break}}return u.map(d=>St(d.x,d.y,l,h,n,i))}function Ei(e,t="stage"){return{type:"shape",id:t,kind:"polygon",points:Ln(e),fill:e.fill??gt[e.kind]??Nn,label:e.label??"STAGE",role:"stage",stageKind:e.kind}}function jn(e,t,n,i){let o=[],s=(l,h,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:h+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 Ce(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 B=(()=>{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),h=Math.atan2(i.y-o,-i.x);for(let a=0;a<=24;a++){let c=l+(h-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 Fn(e,t){let n=e/B.half,i=t/B.half;return[{x:-B.backstop*n,y:t},{x:B.backstop*n,y:t},...B.fence.map(o=>({x:o.x*n,y:o.y*i}))]}var Dn="#f1f5f9";function Ii(e){switch(e){case"pitch-football":return"PITCH";case"rink-hockey":return"RINK";case"track-athletics":return"TRACK";case"oval-cricket":return"OVAL";case"pitch-rugby":return"PITCH";case"diamond-baseball":return"FIELD";case"court-basketball":case"court-tennis":return"COURT";case"ring-boxing":return"RING";default:return"STAGE"}}function le(e){return An(e)}function K(e,t,n,i,o=32){let r=[];for(let s=0;s<o;s++){let l=s/o*xt;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),h=Math.sin(s),a=o/2,c=r/2,u=[],m=bt[t],d=f=>m?f/m.width*o:0,p=f=>m?f/m.height*r:0;switch(t){case"pitch-football":{u.push({points:[{x:0,y:-c},{x:0,y:c}],closed:!1}),u.push({points:K(0,0,d(9.15),p(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,p(40.32)/2),closed:!0}),u.push({points:U(f*(a-d(5.5)/2),0,d(5.5)/2,p(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:-p(11)},{x:f*(a-d(4)),y:p(11)}],closed:!1,ink:"#d63b3b"});for(let g of[-1,1])u.push({points:K(f*d(20.5),g*p(7),d(4.5),p(4.5)),closed:!0,ink:"#2f6ecb"})}u.push({points:K(0,0,d(4.5),p(4.5)),closed:!0,ink:"#2f6ecb"});break}case"track-athletics":{let g=c-p(1.22)*8;g>0&&u.push({points:Ce(a-d(1.22)*8,g),closed:!0,fill:"#2f7d4f"});for(let v=1;v<8;v++){let E=p(1.22)*v,w=c-E;if(w<=0)break;u.push({points:Ce(a-d(1.22)*v,w),closed:!0})}break}case"oval-cricket":{u.push({points:K(0,0,d(27.4),p(27.4+20.12/2),40),closed:!0}),u.push({points:U(0,0,d(3.05)/2,p(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 v=-35;v<35;v+=4)u.push({points:[{x:d(g*10),y:p(v)},{x:d(g*10),y:p(Math.min(35,v+2))}],closed:!1})}break}case"diamond-baseball":{let f=(A,L)=>({x:d(A),y:p(L)}),{home:g}=B,v=27.43,E=v/Math.SQRT2,w={x:g.x+E,y:g.y-E},x={x:g.x,y:g.y-2*E},S={x:g.x-E,y:g.y-E},y={x:g.x,y:g.y-18.44},b="#b98a59",P=gt["diamond-baseball"],M=38.94,_=[f(g.x,g.y)],T=Math.atan2(g.y-M/Math.SQRT2-y.y,M/Math.SQRT2),I=Math.PI-T;for(let A=0;A<=16;A++){let L=T-(T+Math.PI*2-I)%(Math.PI*2)*(A/16);_.push(f(y.x+29*Math.cos(L),y.y+29*Math.sin(L)))}u.push({points:_,closed:!0,fill:b,ink:b});let C={x:g.x,y:g.y-E},O=[{x:g.x,y:g.y},w,x,S].map(A=>f(C.x+(A.x-C.x)*.84,C.y+(A.y-C.y)*.84));u.push({points:O,closed:!0,fill:P,ink:P}),u.push({points:K(d(y.x),p(y.y),d(2.74),p(2.74),20),closed:!0,fill:b,ink:b}),u.push({points:K(d(g.x),p(g.y),d(3.96),p(3.96),20),closed:!0,fill:b,ink:b});let N=B.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[w,x,S])u.push({points:U(d(A.x),p(A.y),d(.3),p(.3)),closed:!0,fill:Dn});break}case"court-basketball":{u.push({points:U(0,0,d(14),p(7.5)),closed:!0}),u.push({points:[{x:0,y:-p(7.5)},{x:0,y:p(7.5)}],closed:!1}),u.push({points:K(0,0,d(1.8),p(1.8),24),closed:!0});for(let f of[-1,1]){let g=f*14,v=f*(14-5.8),E=f*(14-1.575);u.push({points:U(d((g+v)/2),0,d(2.9),p(2.45)),closed:!0,fill:"#2f5d8a"}),u.push({points:K(d(v),0,d(1.8),p(1.8),24),closed:!0});let w=Math.sqrt(6.75*6.75-6.6*6.6),x=[{x:d(g),y:-p(6.6)}],S=Math.atan2(-6.6,-f*w),y=2*Math.atan2(6.6,w);for(let b=0;b<=16;b++){let P=S-f*y*(b/16);x.push({x:d(E+6.75*Math.cos(P)),y:p(6.75*Math.sin(P))})}x.push({x:d(g),y:p(6.6)}),u.push({points:x,closed:!1})}break}case"court-tennis":{u.push({points:U(0,0,d(11.885),p(5.485)),closed:!0,fill:"#2b5f99"});for(let f of[-1,1])u.push({points:[{x:-d(11.885),y:f*p(4.115)},{x:d(11.885),y:f*p(4.115)}],closed:!1}),u.push({points:[{x:f*d(6.4),y:-p(4.115)},{x:f*d(6.4),y:p(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:-p(6.4)},{x:0,y:p(6.4)}],closed:!1,ink:"#d1d5db"});break}case"ring-boxing":{u.push({points:U(0,0,d(3.05),p(3.05)),closed:!0});let v=[[-1,-1,"#c53030"],[1,1,"#2b6cb0"],[1,-1,"#e2e8f0"],[-1,1,"#e2e8f0"]];for(let[E,w,x]of v)u.push({points:U(E*d(3.05),w*p(3.05),d(.3),p(.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,h,n,i))}))}function wi(e){if(e.role!=="stage"||!le(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),h=Math.max(1,r-o),a=Math.max(1,l-s);t={cx:o+h/2,cy:s+a/2,width:h,height:a}}return t?Vn({kind:e.stageKind,...t}):[]}function Hn(e){if((e.kind==="polygon"||e.kind==="polyline"||e.kind==="line")&&e.points&&e.points.length>=2)return e.kind==="polygon"?ie(e,6):e.points;if(e.x==null||e.y==null||e.width==null||e.height==null)return null;let t=e.x,n=e.y,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 Un(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 Mt(e){let t=Hn(e);if(!t||t.length<2)return null;let n=e.rotation??0,i=Math.abs(n)<1e-6?t:t.map(h=>Un(h,{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 h of i)o=Math.min(o,h.x),r=Math.min(r,h.y),s=Math.max(s,h.x),l=Math.max(l,h.y);return!Number.isFinite(o)||s-o<1e-6||l-r<1e-6?null:{minX:o,minY:r,maxX:s,maxY:l}}var Gn=5,Xn=3,Kn=.92,Bn=1.9,Yn=2,zn=.6,Wn=1,$n=.06;function qn(e){return e.heightM!==void 0?e.heightM:e.stageKind==="ring-boxing"?_e:le(e.stageKind)?$n:Wn}function Pt(e){let t=1/0,n=1/0,i=-1/0,o=-1/0,r=-1/0;for(let s of Oe(e)){let l=s.baseHeightM??0;for(let h of s.objects){if(h.type!=="shape"||h.role!=="stage")continue;let a=Mt(h);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+qn(h)))}}return!Number.isFinite(t)||!Number.isFinite(r)?null:{minX:t,minY:n,maxX:i,maxY:o,deckTopM:r}}function Qn(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 h=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),m=new Float64Array(c*u).fill(-1/0);for(let d of e){if(!Number.isFinite(d.eyeHeightM))continue;let p=d.eyeHeightM-J,f=Math.min(c-1,Math.max(0,Math.floor((d.x*t-h)/n))),v=Math.min(u-1,Math.max(0,Math.floor((d.y*t-a)/n)))*c+f,E=p+i;E>m[v]&&(m[v]=E)}return{cellM:n,minX:h,minY:a,cols:c,rows:u,top:m}}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 vt(e,t,n={}){let i=new Map;if(!t||!e.length)return i;let o=n.metresPerChartUnit??Q,r=n.cellM??zn,s=n.chairBackM??Kn,l=n.selfRowSkipM??Yn,h=n.clearThreshold??.9,a=n.partialThreshold??.25,c=Math.max(1,n.columns??Gn),u=Math.max(1,n.rows??Xn),m=Qn(e,o,r,s);if(!m)return i;let d=(t.maxX-t.minX)*o,p=(t.maxY-t.minY)*o,f=d>=p,g=(t.minX+t.maxX)/2*o,v=(t.minY+t.maxY)/2*o,E=[];for(let x=0;x<c;x++){let S=(x+.5)/c-.5,y=f?g+S*d:g,b=f?v:v+S*p;for(let P=0;P<u;P++){let M=t.deckTopM+(u===1?0:P/(u-1)*Bn);E.push({x:y,y:b,z:M})}}let w=r/2;for(let x of e){if(!Number.isFinite(x.eyeHeightM))continue;let S=x.x*o,y=x.y*o,b=x.eyeHeightM,P=0,M=1/0;for(let T of E){let I=T.x-S,C=T.y-y,O=Math.hypot(I,C);if(!(O>l)){P++;continue}let N=I/O,A=C/O,L=0;for(let V=l;V<O;V+=w){let Y=Jn(m,S+N*V,y+A*V);if(!(!Number.isFinite(Y)||Y>=b)&&Y>b+(T.z-b)*V/O){L=V;break}}L?M=Math.min(M,L):P++}let _=P/E.length;_>=h||i.set(x.id,{seatId:x.id,mark:_<a?"obstructedView":"restrictedView",visibleFraction:_,totalRays:E.length,atDistanceM:Number.isFinite(M)?M:0})}return i}function Et(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 ke(e){return e?e.accessibility?.length?e.wheelchairSpaceType&&!e.accessibility.includes("wheelchair")?["wheelchair",...e.accessibility]:e.accessibility:e.wheelchairSpaceType?["wheelchair"]:e.accessible?["wheelchair"]:[]:[]}var fe=Math.PI/180,Zn=9,ee=16;function Re(e,t,n,i){let o=n*fe,r=Math.cos(o),s=Math.sin(o);return{x:i.x+e*r-t*s,y:i.y+e*s+t*r}}function he(e){let{seatCount:t,seatSpacing:n,curve:i,rotation:o,origin:r}=e,s=[];if(e.path)return qe(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(Re(a*n,0,o,r));return s}let l=i/(t-1)*fe,h=n/(2*Math.sin(Math.abs(l)/2));for(let a=0;a<t;a++){let c=a*l,u=h*Math.sin(c),m=-h+h*Math.cos(c);s.push(Re(u,m,o,r))}return s}function Te(e){let t=new Map;if(e.overrides)for(let n of e.overrides)t.set(n.index,n);return t}function Qi(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 eo(e,t){let n=Te(e);return he(e).map((i,o)=>{let r=n.get(o),s=ke(r),l=Ne(e,o,r),h={...e.commercial,...r?.commercial};return{index:o,x:i.x+(r?.dx??0),y:i.y+(r?.dy??0),label:l,displayLabel:me(e,o,t,r),categoryKey:r?.categoryKey??e.categoryKey,skipped:!!r?.skip,accessible:s.length>0,accessibility:s,wheelchairSpaceType:r?.wheelchairSpaceType,commercial:Object.values(h).some(a=>a!==void 0&&a!==!1&&a!=="")?h:void 0,glyph:r?.glyph,viewUrl:r?.viewFromSeatUrl??e.viewFromSeatUrl,viewMeta:r?.viewFromSeatUrl?r.viewFromSeatMeta:e.viewFromSeatMeta,labelStyle:r?.labelStyle??e.seatLabelStyle}})}function to(e){let t=[];for(let n of eo(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 no(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 _t(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,m,d)=>{let p=i.get(c),f=ke(p),g=p?.label??Le(e,c);return{index:c,label:g,displayLabel:p?.displayLabel??je(e,c),x:u+(p?.dx??0),y:m+(p?.dy??0),categoryKey:p?.categoryKey??e.categoryKey,skipped:!!p?.skip,accessible:f.length>0,accessibility:f,wheelchairSpaceType:p?.wheelchairSpaceType,commercial:p?.commercial,glyph:p?.glyph,viewUrl:p?.viewFromSeatUrl,viewMeta:p?.viewFromSeatUrl?p.viewFromSeatMeta:void 0,labelStyle:p?.labelStyle,...d?{side:d}:{}}};if(e.shape==="round"){let c=(e.radius??40)+ee,u=e.rotation*fe,m=Math.max(0,Math.min(360,e.seatArc??360));if(m>=360||n===1){for(let g=0;g<n;g++){let v=u+g/n*2*Math.PI;t.push(o(g,e.center.x+c*Math.cos(v),e.center.y+c*Math.sin(v)))}return t}let d=m*fe,p=(2*Math.PI-d)/2,f=u+p;for(let g=0;g<n;g++){let v=f+g/(n-1)*d;t.push(o(g,e.center.x+c*Math.cos(v),e.center.y+c*Math.sin(v)))}return t}let r=e.width??80,s=e.height??50,l=no(e),h=["top","bottom","left","right"],a=0;for(let c of h){let u=l[c];for(let m=0;m<u;m++){let d,p;c==="top"?(d=-r/2+(m+.5)*r/u,p=-s/2-ee):c==="bottom"?(d=-r/2+(m+.5)*r/u,p=s/2+ee):c==="left"?(d=-r/2-ee,p=-s/2+(m+.5)*s/u):(d=r/2+ee,p=-s/2+(m+.5)*s/u);let f=Re(d,p,e.rotation,e.center);t.push(o(a++,f.x,f.y,c))}}return t}function Ji(e){return e.bookAsWhole||e.variableOccupancy?Math.max(0,Math.round(e.seatCount)):_t(e).filter(t=>!t.skipped).length}function oo(e){return _t(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 io(e){return[{id:`${e.id}:0`,label:e.label,...e.displayLabel&&e.displayLabel!==e.label?{displayLabel:e.displayLabel}:{},x:e.center.x,y:e.center.y,rowId:e.id,categoryKey:e.categoryKey,kind:"booth",...e.commercial?.note?{commercial:{note:e.commercial.note}}:{}}]}function Z(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,h=t[o].y;s>e.y!=h>e.y&&e.x<(l-r)*(e.y-s)/(h-s)+r&&(n=!n)}return n}function we(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 X(e){return Array.isArray(e)?e.filter(t=>Array.isArray(t)&&t.length>=3):[]}function re(e,t,n){return Z(e,t)&&!X(n).some(i=>Z(e,i)||we(e,i))}function Zi(e,t){return nt(e,t).point}function de(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 Ot(e){switch(e.type){case"row":{let t=he(e),n=Te(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 de(e.points);case"section":return de(e.outline);case"text":return{x:e.position.x,y:e.position.y};case"shape":return e.points&&e.points.length?de(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 It(e,t){return e.length===t.length&&e.every((n,i)=>n.x===t[i].x&&n.y===t[i].y)}function ro(e,t){if(e.type!=="gaArea"||!It(e.points,t.outline))return!1;let n=X(e.holes),i=X(t.holes);return n.length===i.length&&n.every((o,r)=>It(o,i[r]))}function so(e,t,n=e.filter(o=>o.type==="section"),i=Ot(t)){let o="referenceInventorySource"in t?t.referenceInventorySource?.logicalSectionId:void 0;return(o?n.find(s=>(s.logicalSectionId??s.id)===o&&(ro(t,s)||re(i,s.outline,s.holes))):void 0)??n.find(s=>re(i,s.outline,s.holes))??(t.type==="row"&&ao(t)?co(t,n):void 0)}function ao(e){return(e.overrides??[]).some(t=>t.skip===!0)}function co(e,t){let n=he(e),i=Te(e),o,r=0;for(let s of t){let l=0;for(let h=0;h<n.length;h++){let a=i.get(h);if(a?.skip)continue;let c={x:n[h].x+(a?.dx??0),y:n[h].y+(a?.dy??0)};re(c,s.outline,s.holes)&&l++}l>r&&(o=s,r=l)}return o}function Oe(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 er(e,t){let n=Oe(e);return(t?n.find(i=>i.id===t):n[0])?.objects??[]}function lo(e){return e.floors&&e.floors.length?e.floors.flatMap(t=>t.objects):e.objects}function uo(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:X(e.holes).map(o)}:{}};case"section":return{...e,outline:o(e.outline),...e.outlinePath?{outlinePath:ct(e.outlinePath,t,n)}:{},...e.holes?{holes:X(e.holes).map(o)}:{}};case"text":return{...e,position:i(e.position)};case"shape":return{...e,...e.points?{points:o(e.points)}:{},...e.holes?{holes:X(e.holes).map(o)}:{},...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 tr(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:uo(s,0,r))}),{...e,objects:n,floors:void 0}}function wt(e,t,n,i,o,r,s,l,h){let a=[],c=e.filter(f=>f.type==="section"),u=lt(e),m=f=>!f?.eventConfigurationId||f.eventConfigurationId===i&&(f.eventConfigurationVersion===void 0||f.eventConfigurationVersion===h),d=f=>Fe(f,{activeConfigurationId:i,activeConfigurationVersion:h,activeBasisSha256:o,now:l}),p=(f,g)=>d(f)?{...f,coverage:g}:void 0;for(let f of e){let g=[];if(f.type==="row"?g=to(f):f.type==="table"?g=oo(f):f.type==="booth"&&(g=io(f)),!g.length)continue;for(let S of g)S.viewUrl&&!m(S.viewMeta)&&(S.viewUrl=void 0,S.viewMeta=void 0);if(f.type==="row"){let S=u.get(f.id);if(S){let y=new Map((f.overrides??[]).map(b=>[b.index,b]));for(let b of g){let P=Number(b.id.slice(b.id.lastIndexOf(":")+1));if(!Number.isInteger(P))continue;b.logicalRowId=S.groupId,b.logicalSeatIndex=S.adjacencyOffset+P,y.get(P)?.displayLabel||(b.displayLabel=me(f,P,S)),!b.viewUrl&&S.viewFromSeatUrl&&m(S.viewFromSeatMeta)&&(b.viewUrl=S.viewFromSeatUrl,b.viewMeta=S.viewFromSeatMeta);let M=y.get(P)?.confidenceEvidence;b.confidenceEvidence=p(M,"exact-seat")??p(f.confidenceEvidence,"row-representative")??p(S.confidenceEvidence,"row-representative")}}}let v=so(e,f,c,f.type==="row"?de(g):Ot(f)),E=v?.viewFromSeatUrl,x=(v?.zone?t?.find(S=>S.id===v.zone):void 0)?.focalPoint??n;for(let S of g){if(!S.confidenceEvidence){let y=Number(S.id.slice(S.id.lastIndexOf(":")+1)),b=(f.type==="row"||f.type==="table")&&Number.isInteger(y)?f.overrides?.find(P=>P.index===y)?.confidenceEvidence:void 0;S.confidenceEvidence=p(b,"exact-seat")??(f.type==="row"?p(f.confidenceEvidence,"row-representative"):void 0)}S.confidenceEvidence??=p(v?.confidenceEvidence,"section-representative")??(s?p(s.evidence,s.coverage):void 0),!S.viewUrl&&E&&m(v?.viewFromSeatMeta)&&(S.viewUrl=E,S.viewMeta=v?.viewFromSeatMeta),!S.viewUrl&&r&&m(r.meta)&&(S.viewUrl=r.url,S.viewMeta=r.meta),v&&(S.sectionId=v.logicalSectionId??v.id),v?.zone&&(S.zoneId=v.zone),x&&(S.focalPoint={...x})}a.push(...g)}return a}function nr(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,h=wt(o.objects,e.zones,r,e.eventConfigurationId,e.confidenceBasisSha256,s,l,t.now,t.eventConfigurationVersion??e.eventConfigurationVersion);t.resolveEyeHeights!==!1&&Ct(o.objects,o.focalPoint??e.focalPoint,o.baseHeightM??0,h);for(let a of h)a.floorId=o.id;for(let a of h)i.push(a)}return i}let n=wt(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&&Ct(e.objects,e.focalPoint,t.floorBaseHeightM??0,n),fo(e,n,t)}function fo(e,t,n){return!n.deriveRestrictedView||e.derivedRestrictedView===!1||n.resolveEyeHeights===!1||Et(t,vt(t,Pt(e))),t}function Ct(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+J;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 h=new Map,a=new Map;for(let u=0;u<i.length;u++){let m=i[u],p=(m.sectionId?l.get(m.sectionId)??o.find(g=>g.logicalSectionId===m.sectionId&&re({x:m.x,y:m.y},g.outline,g.holes)):void 0)??o.find(g=>re({x:m.x,y:m.y},g.outline,g.holes))??null;if(s[u]=p,!p)continue;h.has(p.id)||h.set(p.id,dt(p,{floorBaseHeightM:n}));let f=a.get(p.id);f?f.push(u):a.set(p.id,[u])}let c=new Array(i.length).fill(void 0);for(let[u,m]of a){let d=h.get(u);if(!d)continue;let p=d.rake>0?Math.tan(d.rake*Math.PI/180):0,f=pt(u,i,m,t);for(let g of f.rows){let v=g.blockDepth*Q*p,E=d.height+v;for(let w of g.seatIndices)c[w]=E}}for(let u=0;u<i.length;u++){let m=i[u],d=s[u];if(!d){m.eyeHeightM=n+J;continue}let p=h.get(d.id);m.eyeHeightM=(c[u]??p.height)+J}}var ue=40;function or(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)},h=a=>{if(Array.isArray(a))for(let c of a)!c||typeof c!="object"||l(c.x,c.y)};for(let a of lo(e))if(a.type==="row"){let c=new Map((a.overrides??[]).map(u=>[u.index,u]));he(a).forEach((u,m)=>{let d=c.get(m);d?.skip||l(u.x+(d?.dx??0),u.y+(d?.dy??0))})}else if(a.type==="gaArea")h(a.points);else if(a.type==="section")h(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?h(ie(a)):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=ee+Zn,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=Be(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 m=u*3/4;l(c.x-u/2,c.y-m/2),l(c.x+u/2,c.y+m/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-ue,y:o-ue,width:r-i+ue*2,height:s-o+ue*2}}export{ho as a,Nt as b,De as c,Lt as d,po as e,jt as f,yo as g,te as h,pe as i,xo as j,So as k,Mo as l,Po as m,vo as n,Eo as o,Io as p,Co as q,_o as r,Oo as s,ko as t,Ro as u,To as v,Ao as w,No as x,Lo as y,Be as z,Fo as A,Do as B,Yt as C,Vo as D,ge as E,Go as F,qe as G,Xo as H,Ko as I,Wt as J,et as K,Yo as L,nt as M,qt as N,Wo as O,Jo as P,st as Q,at as R,ct as S,en as T,Zo as U,tn as V,on as W,ei as X,sn as Y,Me as Z,ti as _,ui as $,mi as aa,kn as ba,ie as ca,pi as da,yi as ea,bi as fa,oi as ga,ii as ha,ri as ia,lt as ja,Q as ka,Ee as la,un as ma,ai as na,dn as oa,ut as pa,Pe as qa,fn as ra,hn as sa,mn as ta,J as ua,dt as va,ht as wa,gn as xa,pt as ya,Si as za,An as Aa,Mi as Ba,Pi as Ca,vi as Da,Ln as Ea,Ei as Fa,Dn as Ga,Ii as Ha,wi as Ia,ke as Ja,ee as Ka,he as La,Qi as Ma,eo as Na,to as Oa,no as Pa,_t as Qa,Ji as Ra,oo as Sa,io as Ta,Z as Ua,we as Va,X as Wa,re as Xa,Zi as Ya,Ot as Za,so as _a,Oe as $a,er as ab,lo as bb,uo as cb,tr as db,nr as eb,or as fb};
|