@seatlayer/core 0.72.1 → 0.73.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/{categoryInventory-Bt-0psga.d.ts → categoryInventory-Bcmnr6ZH.d.ts} +1 -1
- package/dist/{categoryInventory-BU1j8Q70.d.cts → categoryInventory-DueSAIBX.d.cts} +1 -1
- package/dist/{chunk-O5UWBFUT.js → chunk-3L4M7L5I.js} +1 -1
- package/dist/chunk-5JB4VW6B.js +1 -0
- package/dist/{chunk-YW2WGLRM.js → chunk-BAWUBGWY.js} +1 -1
- package/dist/{chunk-5U25QLSS.js → chunk-HDY2MYYH.js} +1 -1
- package/dist/chunk-JLYR66MT.js +1 -0
- package/dist/{chunk-KCFEFP6H.js → chunk-KN7GLEAI.js} +1 -1
- package/dist/{chunk-KPSJDH3N.js → chunk-N5NRM4NW.js} +1 -1
- package/dist/chunk-QLDV5ZGA.js +1 -0
- package/dist/{chunk-AM2LRFAY.js → chunk-UX67GDLV.js} +1 -1
- package/dist/{chunk-ALE2T36W.js → chunk-YFV4DSSX.js} +1 -1
- package/dist/{chunk-NKYPEBW3.js → chunk-ZMYRXJOA.js} +1 -1
- package/dist/core/chart-ops/index.cjs +1 -1
- package/dist/core/chart-ops/index.d.cts +11 -4
- package/dist/core/chart-ops/index.d.ts +11 -4
- package/dist/core/chart-ops/index.js +1 -1
- package/dist/core/inventory/index.cjs +1 -1
- package/dist/core/inventory/index.d.cts +11 -4
- package/dist/core/inventory/index.d.ts +11 -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/quality/index.js +1 -1
- package/dist/core/render-assets/index.cjs +1 -1
- package/dist/core/render-assets/index.d.cts +1 -1
- package/dist/core/render-assets/index.d.ts +1 -1
- 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.cjs +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/{eventConfigurations-DfVUGyCg.d.ts → eventConfigurations-C7YAqkFR.d.ts} +1 -1
- package/dist/{eventConfigurations-3uSorYVC.d.cts → eventConfigurations-DwXdrjqj.d.cts} +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +102 -13
- package/dist/index.d.ts +102 -13
- package/dist/index.js +1 -1
- package/dist/{labeling-BiWB-8aq.d.ts → labeling-BUCj-kHU.d.ts} +1 -1
- package/dist/{labeling-9RWWmJhZ.d.cts → labeling-iugoy25P.d.cts} +1 -1
- package/dist/{layout-B6iOoPOv.d.cts → layout-DPJX6D9k.d.cts} +3 -3
- package/dist/{layout-B7URbtDR.d.ts → layout-Dv3R0Mpw.d.ts} +3 -3
- package/dist/{renderedQuality-C5dQiq97.d.ts → renderedQuality-CSHrmnHf.d.cts} +10 -2
- package/dist/{renderedQuality-BZsq3wDe.d.cts → renderedQuality-CfonzUpl.d.ts} +10 -2
- package/dist/{renderer-6sFRupj0.d.ts → renderer-C5avrVLy.d.ts} +11 -2
- package/dist/{renderer-CBOo1OZk.d.cts → renderer-Dn4Plcv9.d.cts} +11 -2
- package/dist/{sections-DU6YDYoZ.d.cts → sections-DhJ7TukF.d.cts} +1 -1
- package/dist/{sections-Cn_sk1Sx.d.ts → sections-uV7vqDHj.d.ts} +1 -1
- package/dist/{segmentedRowModel-CKmyHvKv.d.cts → segmentedRowModel-DWOjcPrU.d.cts} +1 -1
- package/dist/{segmentedRowModel-DbP7pWUk.d.ts → segmentedRowModel-DgSEzAYd.d.ts} +1 -1
- package/dist/{ticketRestrictions-CvS2oQ8v.d.ts → ticketRestrictions-DIh61MqE.d.ts} +2 -2
- package/dist/{ticketRestrictions-DkenahW2.d.cts → ticketRestrictions-JT87K45q.d.cts} +2 -2
- package/dist/{types-D6-wLa-m.d.cts → types-Dx4jA8aI.d.cts} +22 -4
- package/dist/{types-D6-wLa-m.d.ts → types-Dx4jA8aI.d.ts} +22 -4
- package/dist/view3d/crossfade/panorama.d.cts +1 -1
- package/dist/view3d/crossfade/panorama.d.ts +1 -1
- package/dist/view3d/index.cjs +1 -1
- package/dist/view3d/index.d.cts +3 -3
- package/dist/view3d/index.d.ts +3 -3
- package/dist/view3d/index.js +1 -1
- package/dist/view3d/scene/scene.worker.cjs +1 -1
- package/dist/view3d/scene/scene.worker.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-4F7VBQCF.js +0 -1
- package/dist/chunk-HXYWP6NX.js +0 -1
- package/dist/chunk-XLGYWT5G.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as Pn,c as An,d as In}from"./chunk-KPSJDH3N.js";import{c as bn}from"./chunk-ALE2T36W.js";import{d as Rn}from"./chunk-BLPBTW6I.js";import{e as gn,k as Mn}from"./chunk-UL5OIGIF.js";import{f as hn,p as xn,r as Xt,s as ft,u as It,x as Sn}from"./chunk-YW2WGLRM.js";import{W as ut,X as lt,ea as Gt,ga as dn,ha as Dt,ja as yn,l as pn,m as Pt,va as qt}from"./chunk-KCFEFP6H.js";import{A as At,d as H,y as nt}from"./chunk-JBOTRSMY.js";import Re from"earcut";import Pe from"polygon-clipping";var g=ut,Ae=.002;function Ie(t,n,e){let i=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]),r=Math.max(i,o,a);if(r<1e-9)return!0;let s=(i+o+a)/2;return 2*Math.sqrt(Math.max(0,s*(s-i)*(s-o)*(s-a)))/r<Ae}var ht=class{constructor(n=16384){this.len=0;this.buf=new Float32Array(n)}push3(n,e,i){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++]=i}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 i=new Float32Array(e);i.set(this.buf.subarray(0,this.len)),this.buf=i}get length(){return this.len}toArray(){return this.buf.slice(0,this.len)}},Yt=class{constructor(){this.pos=new ht;this.nor=new ht;this.col=new ht;this.flr=new ht;this.mat=new ht;this.currentFloor=0;this.currentMaterial=0}setFloor(n){this.currentFloor=n}setMaterial(n){this.currentMaterial=n}tri(n,e,i,o,a,r=a,s=a){Ie(n,e,i)||(this.pos.push3(n[0],n[1],n[2]),this.pos.push3(e[0],e[1],e[2]),this.pos.push3(i[0],i[1],i[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(r[0],r[1],r[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,i,o,a,r,s,l=s,c=s){[...n,...e,...i].every(Number.isFinite)&&(this.pos.push3(n[0],n[1],n[2]),this.pos.push3(e[0],e[1],e[2]),this.pos.push3(i[0],i[1],i[2]),this.nor.push3(o[0],o[1],o[2]),this.nor.push3(a[0],a[1],a[2]),this.nor.push3(r[0],r[1],r[2]),this.col.push3(s[0],s[1],s[2]),this.col.push3(l[0],l[1],l[2]),this.col.push3(c[0],c[1],c[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 we(t,n,e){let i=n[0]-t[0],o=n[1]-t[1],a=n[2]-t[2],r=e[0]-t[0],s=e[1]-t[1],l=e[2]-t[2],c=o*l-a*s,f=a*r-i*l,m=i*s-o*r,u=Math.hypot(c,f,m)||1;return c/=u,f/=u,m/=u,[c,f,m]}function Te(t,n){let e=[...t],i=[];for(let r of t)i.push(r.x,r.y);let o=[];if(n){for(let r of n)if(!(r.length<3)){o.push(e.length);for(let s of r)e.push(s),i.push(s.x,s.y)}}let a=Re(i,o.length?o:void 0,2);return{pts:e,tris:a}}function Jt(t){return ft(t)<0?[...t].reverse():t}var _e=3;function Be(t,n,e,i){let o=i(t),a=i(n),r=i(e),s=(h,b,p,y)=>Math.abs(i({x:(h.x+b.x)/2,y:(h.y+b.y)/2})-(p+y)/2),l=(t.x+n.x+e.x)/3,c=(t.y+n.y+e.y)/3,f=(o+a+r)/3,m=Math.max(s(t,n,o,a),s(n,e,a,r),s(e,t,r,o),Math.abs(i({x:l,y:c})-f)),u=(h,b,p)=>{let y=Math.abs(i({x:(h+l)/2,y:(b+c)/2})-(p+f)/2);y>m&&(m=y)};return u((t.x+n.x)/2,(t.y+n.y)/2,(o+a)/2),u((n.x+e.x)/2,(n.y+e.y)/2,(a+r)/2),u((e.x+t.x)/2,(e.y+t.y)/2,(r+o)/2),m}function wt(t,n,e,i,o){if(o<=0)return Be(t,n,e,i);let a={x:(t.x+n.x)/2,y:(t.y+n.y)/2},r={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(wt(t,a,s,i,o-1),wt(a,n,r,i,o-1),wt(s,r,e,i,o-1),wt(a,r,s,i,o-1))}function Tt(t,n,e,i,o,a,r,s){if(r>0){let u={x:(n.x+e.x)/2,y:(n.y+e.y)/2},h={x:(e.x+i.x)/2,y:(e.y+i.y)/2},b={x:(i.x+n.x)/2,y:(i.y+n.y)/2};Tt(t,n,u,b,o,a,r-1,s),Tt(t,u,e,h,o,a,r-1,s),Tt(t,b,h,i,o,a,r-1,s),Tt(t,u,h,b,o,a,r-1,s);return}let l=[n.x*g,o(n),n.y*g],c=[e.x*g,o(e),e.y*g],f=[i.x*g,o(i),i.y*g];if(s){t.triN(l,c,f,s(n),s(e),s(i),a);return}let m=we(l,c,f);m[1]<0&&(m=[-m[0],-m[1],-m[2]]),t.tri(l,c,f,m,a)}var Fe=8;function wn(t,n,e){if(!Number.isFinite(e))return t;let i=[],o=(a,r,s,l,c)=>{if(c>0){let f={x:(a.x+r.x)/2,y:(a.y+r.y)/2},m=n(f);if(Math.abs(m-(s+l)/2)>e){o(a,f,s,m,c-1),o(f,r,m,l,c-1);return}}i.push(a)};for(let a=0;a<t.length;a++){let r=t[a],s=t[(a+1)%t.length];o(r,s,n(r),n(s),Fe)}return i}function Nt(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 i=[];for(let o=0;o<e.length;o++){let a=i.length?i[i.length-1]:e[(o-1+e.length)%e.length],r=e[o],s=e[(o+1)%e.length],l=s.x-a.x,c=s.y-a.y,f=Math.hypot(l,c);f>n&&Math.abs((r.x-a.x)*c-(r.y-a.y)*l)/f<n||i.push(r)}return i.length>=3?i:e}var Ut=.001*lt*.1;function K(t,n,e,i,o,a,r,s,l=1/0,c){if(!n||n.length<3||(l===void 0&&(l=1/0),Math.abs(ft(n))<1e-4))return;let f=Nt(wn(Nt(Jt(n),Ut),i,l),Ut),m=e?.map(P=>Nt(wn(Nt(Jt(P),Ut),i,l),Ut)).filter(P=>P.length>=3&&Math.abs(ft(P))>=1e-4),{pts:u,tris:h}=Te(f,m),b=[a[0]*s.top,a[1]*s.top,a[2]*s.top],p=[a[0]*s.bottomCap,a[1]*s.bottomCap,a[2]*s.bottomCap],y=[r[0]*s.top,r[1]*s.top,r[2]*s.top],d=[r[0]*s.wallBottom,r[1]*s.wallBottom,r[2]*s.wallBottom],x=0;if(Number.isFinite(l))for(;x<_e;x++){let P=0;for(let A=0;A<h.length;A+=3){let E=wt(u[h[A]],u[h[A+1]],u[h[A+2]],i,x);E>P&&(P=E)}if(P<=l)break}for(let P=0;P<h.length;P+=3){let A=u[h[P]],E=u[h[P+1]],v=u[h[P+2]];Tt(t,A,E,v,i,b,x,c);let G=[A.x*g,o,A.y*g],X=[E.x*g,o,E.y*g],M=[v.x*g,o,v.y*g];t.tri(G,M,X,[0,-1,0],p)}let T=P=>{if(x<=0)return P;let A=1<<x,E=[];for(let v=0;v<P.length;v++){let G=P[v],X=P[(v+1)%P.length];for(let M=0;M<A;M++){let B=M/A;E.push({x:G.x+(X.x-G.x)*B,y:G.y+(X.y-G.y)*B})}}return E},S=pn(f),C=[{ring:T(f),flip:!1}];if(m)for(let P of m)P.length>=3&&C.push({ring:T(P),flip:!0});for(let{ring:P,flip:A}of C)for(let E=0;E<P.length;E++){let v=P[E],G=P[(E+1)%P.length],X=(G.x-v.x)*g,B=(G.y-v.y)*g,O=-X,F=Math.hypot(B,O)||1;B/=F,O/=F;let I=(v.x+G.x)/2-S.x,k=(v.y+G.y)/2-S.y,R=B*I+O*k;A&&(R=-R),R<0&&(B=-B,O=-O);let _=[B,0,O],w=[v.x*g,i(v),v.y*g],D=[G.x*g,i(G),G.y*g],N=[v.x*g,o,v.y*g],U=[G.x*g,o,G.y*g];t.tri(w,D,U,_,y,y,d),t.tri(w,U,N,_,y,d,d)}}function Tn(t){let n=0;for(let l of t)n+=l.count;let e=new Float32Array(n*3),i=new Float32Array(n*3),o=new Float32Array(n*3),a=new Float32Array(n),r=new Float32Array(n),s=0;for(let l of t)e.set(l.position,s*3),i.set(l.normal,s*3),o.set(l.color,s*3),a.set(l.floor,s),r.set(l.material,s),s+=l.count;return{position:e,normal:i,color:o,floor:a,material:r,count:n}}function jt(t,n,e=2.5){if(n<=0||t.length<3)return t;let i=Jt(t),o=i.length,a=[];for(let s=0;s<o;s++){let l=i[s],c=i[(s+1)%o],f=c.x-l.x,m=c.y-l.y,u=Math.hypot(f,m)||1;a.push({x:m/u,y:-f/u})}let r=[];for(let s=0;s<o;s++){let l=i[s],c=a[(s-1+o)%o],f=a[s],m=c.x+f.x,u=c.y+f.y,h=Math.hypot(m,u),b=()=>{r.push([l.x+c.x*n,l.y+c.y*n]),r.push([l.x+f.x*n,l.y+f.y*n])};if(h<1e-9){b();continue}m/=h,u/=h;let p=m*c.x+u*c.y,y=1/Math.max(p,1e-6);if(!Number.isFinite(y)||y>e){b();continue}r.push([l.x+m*n*y,l.y+u*n*y])}if(r.length<3)return t;try{let s=Pe.union([[...r,r[0]]]),l=null,c=-1/0;for(let m of s){let u=Math.abs(ft(m[0].map(([h,b])=>({x:h,y:b}))));u>c&&(c=u,l=m[0])}if(!l)return t;let f=l.map(([m,u])=>({x:m,y:u}));if(f.length>1){let m=f[0],u=f[f.length-1];Math.abs(m.x-u.x)<1e-9&&Math.abs(m.y-u.y)<1e-9&&f.pop()}return f.length>=3?f:t}catch{return t}}function Ht(t,n,e,i,o=28){let a=[];for(let r=0;r<o;r++){let s=r/o*Math.PI*2;a.push({x:t+e*Math.cos(s),y:n+i*Math.sin(s)})}return a}function _t(t,n,e,i){return[{x:t,y:n},{x:t+e,y:n},{x:t+e,y:n+i},{x:t,y:n+i}]}var Bt=["available","held","sold","selected","dimmed"];function Qt(t){let n=Bt.indexOf(t);return n<0?0:n}var _n={available:[.24,.82,.52],held:[.95,.66,.22],sold:[.34,.39,.45],selected:[.24,.74,1],dimmed:[.28,.32,.37]};function rr(t){let n=.2126*t[0]+.7152*t[1]+.0722*t[2],e=.42,i=.62;return[(n+(t[0]-n)*e)*i,(n+(t[1]-n)*e)*i,(n+(t[2]-n)*e)*i]}var tn={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]},nn={top:[.05,.06,.08],bottom:[.1,.12,.15]};function et(t,n){return[Math.min(1,t[0]*n),Math.min(1,t[1]*n),Math.min(1,t[2]*n)]}var V={pedestal:0,pad:1,back:2,arm:3,footrest:4,leg:5,body:10,head:11},Ee=.44,Ce=.15,ve=.3,ke=.24;function Bn(t){return t===void 0||!Number.isFinite(t)||t<=0?ke:Math.min(ve,Math.max(Ce,t*Ee))}var sr=.21,Oe=.05,en=.45,Le=en+Oe,Ge=[{part:V.pedestal,min:[-.3,0,-.3],max:[.3,.36,.3]},{part:V.pad,min:[-1,.36,-.95],max:[1,en,1]},{part:V.back,min:[-1,Le,-1],max:[1,.92,-.72]},{part:V.arm,min:[-1,.44,-.82],max:[-.78,.65,.78]},{part:V.arm,min:[.78,.44,-.82],max:[1,.65,.78]},{part:V.footrest,min:[-.9,.18,.78],max:[.9,.31,1.34]},{part:V.leg,min:[-.82,0,-.7],max:[-.62,.37,-.48]},{part:V.leg,min:[.62,0,-.7],max:[.82,.37,-.48]},{part:V.leg,min:[-.82,0,.48],max:[-.62,.37,.7]},{part:V.leg,min:[.62,0,.48],max:[.82,.37,.7]}],De=[{part:V.body,min:[-.52,.39,-.08],max:[-.08,.55,.82]},{part:V.body,min:[.08,.39,-.08],max:[.52,.55,.82]},{part:V.body,min:[-.47,.05,.58],max:[-.13,.43,.82]},{part:V.body,min:[.13,.05,.58],max:[.47,.43,.82]},{part:V.head,min:[-.16,1.04,-.33],max:[.16,1.1,-.13]}],Xe=[{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 ar(){let t=[],n=[],e=[],i=[],o=(F,I,k)=>{let R=e.length,[_,w,D]=F,N=[w[0]-_[0],w[1]-_[1],w[2]-_[2]],U=[D[0]-_[0],D[1]-_[1],D[2]-_[2]],L=N[1]*U[2]-N[2]*U[1],Y=N[2]*U[0]-N[0]*U[2],j=N[0]*U[1]-N[1]*U[0],$=Math.hypot(L,Y,j);$>1e-9?(L/=$,Y/=$,j/=$):[L,Y,j]=I,L*I[0]+Y*I[1]+j*I[2]<0&&(L=-L,Y=-Y,j=-j);for(let z of F)t.push(...z),n.push(L,Y,j),e.push(k);i.push(R,R+1,R+2,R,R+2,R+3)},a=F=>{for(let I of Xe){let k=I.c.map(R=>R.map((_,w)=>_?F.max[w]:F.min[w]));o(k,I.n,F.part)}};for(let F of Ge)a(F);for(let F of De)a(F);let r=en,s=1.08,l=.47,c=.69,f=-.55,m=.08,u=-.48,h=.01,b=[-l,r,f],p=[l,r,f],y=[-l,r,m],d=[l,r,m],x=[-c,s,u],T=[c,s,u],S=[-c,s,h],C=[c,s,h];o([p,T,C,d],[1,0,0],V.body),o([y,S,x,b],[-1,0,0],V.body),o([S,C,T,x],[0,1,0],V.body),o([b,p,d,y],[0,-1,0],V.body),o([d,C,S,y],[0,0,1],V.body),o([b,x,T,p],[0,0,-1],V.body);let P=10,A=8,E=[0,1.205,-.23],v=[.42,.115,.38],G=e.length;for(let F=0;F<=A;F++){let I=Math.PI*F/A,k=Math.cos(I),R=Math.sin(I);for(let _=0;_<=P;_++){let w=Math.PI*2*_/P,D=R*Math.cos(w),N=R*Math.sin(w);t.push(E[0]+v[0]*D,E[1]+v[1]*k,E[2]+v[2]*N);let U=D/v[0],L=k/v[1],Y=N/v[2],j=Math.hypot(U,L,Y)||1;U/=j,L/=j,Y/=j,n.push(U,L,Y),e.push(V.head)}}for(let F=0;F<A;F++)for(let I=0;I<P;I++){let k=G+F*(P+1)+I,R=k+P+1;i.push(k,R,k+1,k+1,R,R+1)}let X=new Float32Array(t),M=new Float32Array(n),B=new Float32Array(e),O=new Uint16Array(i);return{position:X,normal:M,part:B,index:O,vertexCount:e.length,indexCount:i.length}}function Fn(t,n,e,i){let o=new Float32Array(n),a=c=>t[c*3],r=c=>t[c*3+2],s=0,l=(c,f)=>{let m=f-c;for(let u=c;u<f;u++){let[h,b]=i(u),p=h-a(u),y=b-r(u);if(m>=2){let d=Math.max(c,u-1),x=Math.min(f-1,u+1),T=a(x)-a(d),S=r(x)-r(d),C=Math.hypot(T,S);if(C>1e-6){let P=-S/C,A=T/C;P*p+A*y<0&&(P=-P,A=-A),p=P,y=A}}o[u]=p===0&&y===0?0:Math.atan2(p,y)}};for(let c=1;c<=n;c++)(c===n||e(c)!==e(s))&&(l(s,c),s=c);return o}var Vt=.22;function dr(t,n){let e=Bt[t];if(e!=="sold"&&e!=="held")return-1;let i=(n+1)*2654435761;return i^=i>>>15,i=Math.imul(i,2246822519),i^=i>>>13,(i>>>0)%1e5/1e5}var Ne=.42;function Ue(t){let n=t.length,e=new Float64Array(n);if(n<2)return e.fill(1/0),e;let i=1/0,o=1/0,a=-1/0,r=-1/0;for(let b of t)b.x<i&&(i=b.x),b.y<o&&(o=b.y),b.x>a&&(a=b.x),b.y>r&&(r=b.y);let s=Math.max(a-i,1e-6),l=Math.max(r-o,1e-6),c=Math.max(Math.sqrt(s*l/n),1e-6),f=Math.max(1,Math.ceil(s/c)+1),m=Math.max(1,Math.ceil(l/c)+1),u=new Map,h=(b,p)=>{let y=Math.min(f-1,Math.max(0,Math.floor((b-i)/c)));return Math.min(m-1,Math.max(0,Math.floor((p-o)/c)))*f+y};for(let b=0;b<n;b++){let p=h(t[b].x,t[b].y),y=u.get(p);y?y.push(b):u.set(p,[b])}for(let b=0;b<n;b++){let p=t[b],y=Math.min(f-1,Math.max(0,Math.floor((p.x-i)/c))),d=Math.min(m-1,Math.max(0,Math.floor((p.y-o)/c))),x=1/0;for(let T=1;T<=4;T++){for(let S=d-T;S<=d+T;S++)if(!(S<0||S>=m))for(let C=y-T;C<=y+T;C++){if(C<0||C>=f||T>1&&Math.abs(S-d)<T&&Math.abs(C-y)<T)continue;let P=u.get(S*f+C);if(P)for(let A of P){if(A===b)continue;let E=Math.hypot(t[A].x-p.x,t[A].y-p.y);E<x&&(x=E)}}if(Number.isFinite(x)&&x<=T*c)break}e[b]=x}return e}function Ye(t){let n=t.eyeHeightM;return Number.isFinite(n)?Math.max(0,n-Gt):0}function En(t,n,e,i,o,a){let r=t.length,s=new Float32Array(r*3),l=new Float32Array(r),c=new Float32Array(r*3),f=new Float32Array(r),m=new Float32Array(r),u=new Float32Array(r),h=new Float32Array(r),b=new Float32Array(r*3),p=new Map,y=Ue(t);for(let d=0;d<r;d++){let x=t[d],S=(e?.seatPitchU(d)??y[d])*g;f[d]=Number.isFinite(S)?Math.max(.06,Math.min(Vt,S*Ne)):Vt,m[d]=Bn(Number.isFinite(S)?S:void 0);let C=Mn(x.glyph,{seatGlyph:a?.get(x.categoryKey)});u[d]=gn.indexOf(C),h[d]=x.wheelchairSpaceType==="no-seat"?0:1,s[d*3]=x.x*g,s[d*3+1]=e?e.seatDeckY(d):Ye(x),s[d*3+2]=x.y*g,l[d]=Qt(n?n(x):"available");let P=H(o?.get(x.categoryKey)??"#6e7bff")??[.43,.48,1];if(c[d*3]=P[0],c[d*3+1]=P[1],c[d*3+2]=P[2],x.accessibility?.length){let A=H(hn(x.accessibility));A&&(b[d*3]=A[0],b[d*3+1]=A[1],b[d*3+2]=A[2])}p.set(x.id,d)}return{count:r,iPosition:s,iState:l,iCategory:c,iMaxRadius:f,iRing:b,idToIndex:p,iChairWidth:m,iGlyph:u,iPhysicalSeat:h,iFloor:i??new Float32Array(r),iYaw:new Float32Array(r)}}var je=64;function yr(t,n){let e=[];for(let r of n){let s=t.idToIndex.get(r.seatId);if(s===void 0)continue;let l=Qt(r.state);t.iState[s]!==l&&(t.iState[s]=l,e.push(s))}if(!e.length)return[];e.sort((r,s)=>r-s);let i=[],o=e[0],a=e[0];for(let r=1;r<e.length;r++){let s=e[r];if(s!==a){if(s<=a+je){a=s;continue}i.push({start:o,length:a-o+1}),o=s,a=s}}return i.push({start:o,length:a-o+1}),i}function Mr(t,n,e){return e<0?n>1?t.filter(i=>i.kind==="floor"):[...t]:t.filter(i=>i.floorIndex===void 0||i.floorIndex===e)}function Sr(t,n){let e=[...t].sort((o,a)=>o.screen.y-a.screen.y),i=[];for(let o of e){let a=i.find(r=>r.some(s=>Math.abs(s.screen.x-o.screen.x)<104&&Math.abs(s.screen.y-o.screen.y)<34));a?a.push(o):i.push([o])}return i.flatMap(o=>o.length<2?o:o.map((a,r)=>({...a,screen:{...a.screen,x:Math.max(54,Math.min(n-54,a.screen.x+(r-(o.length-1)/2)*104))}})))}var He=1.15,Ve=2.75,We=4.5,ze=.85,Ze=.5,Ke=.26;function Rr(t,n,e){let i=Math.max(1e-6,n),o=t/i,a=e?.hasZoneLabels??!0,r=new Set;return o>=.75&&r.add("floor"),o>=He&&r.add("zone"),o<=(a?Ve:We)&&(r.add("section"),r.add("ga")),o<=ze&&(r.add("annotation"),r.add("booth")),o<=Ze&&r.add("row"),o<=Ke&&r.add("seat"),r}function Pr(t,n,e,i,o,a=6){let r=a+n,s=i-a-n,l=a+e,c=o-a-e;return{...t,x:r>s?i/2:Math.max(r,Math.min(s,t.x)),y:l>c?o/2:Math.max(l,Math.min(c,t.y))}}function Ar(t,n,e,i){let o=t,a=n[0],r=n[1],s=n[2],l=o[0]*a+o[4]*r+o[8]*s+o[12],c=o[1]*a+o[5]*r+o[9]*s+o[13],f=o[2]*a+o[6]*r+o[10]*s+o[14],m=o[3]*a+o[7]*r+o[11]*s+o[15];if(!(m>1e-6))return{x:0,y:0,depth:1/0,visible:!1};let u=l/m,h=c/m,b=f/m,p=u>=-1.05&&u<=1.05&&h>=-1.05&&h<=1.05&&b<=1;return{x:(u*.5+.5)*e,y:(1-(h*.5+.5))*i,depth:b,visible:p}}function Ir(t,n,e=n){let i=[],o=[...t].sort((a,r)=>a.screen.depth-r.screen.depth);for(let a of o){let r=!1;for(let s of i)if(on(a,s,n,e)){r=!0;break}r||i.push(a)}return i}var $e=6;function on(t,n,e,i){let o=Math.abs(t.screen.x-n.screen.x),a=Math.abs(t.screen.y-n.screen.y),r=t.halfWidth!=null&&n.halfWidth!=null?Math.max(e,t.halfWidth+n.halfWidth+$e):e;return o<r&&a<i}function wr(t,n,e){return t.length*n*.58+(e?14:0)}var qe={row:8,seat:14};function Tr(t){return t<480?{row:5,seat:8}:t<768?{row:6,seat:10}:qe}function _r(t,n,e,i){let o=Math.max(1,Math.min(e,i)*.5),a=Math.min(2,Math.hypot(t.x-e/2,t.y-i/2)/o);return n*(1+1.5*a)}function Br(t,n,e,i,o=[]){let a=[...t].sort((s,l)=>(l.priority??0)-(s.priority??0)||s.focus-l.focus),r=[];for(let s of a){if(r.length>=i)break;let l=!1;for(let c of o)if(on(s,c,n,e)){l=!0;break}if(!l){for(let c of r)if(on(s,c,n,e)){l=!0;break}}l||r.push(s)}return r}var Je=.15,Qe=.9,to=1.76;function no(){return{background:{top:[...nn.top],bottom:[...nn.bottom]},structure:tn,seatStates:{..._n},seatScale:1,materials:{seat:null,shell:null,roughness:.78}}}function Cn(t){let n=no();if(!t)return n;let e=H(t.background);if(e){n.background={top:et(e,Qe),bottom:et(e,to)};let r={};for(let[s,l]of Object.entries(tn))r[s]=nt(l,e,Je);n.structure=r}let i=H(t.selectionColor)??H(t.accent);i&&(n.seatStates={...n.seatStates,selected:i});let o=t.seatScale;typeof o=="number"&&Number.isFinite(o)&&(n.seatScale=Sn(o));let a=t.venue3d;if(a){let r=H(a.deck),s=H(a.fascia);r&&(n.structure={...n.structure,tierTop:r,gaTop:r}),s&&(n.structure={...n.structure,tierWall:s,gaWall:s}),n.materials.seat=H(a.seat),n.materials.shell=H(a.shell),typeof a.roughness=="number"&&Number.isFinite(a.roughness)&&(n.materials.roughness=Math.min(1,Math.max(0,a.roughness)))}return n}function vn(t,n){let e=[];for(let i of n)e.push(...t.seatStates[i]);return e}import Gn from"polygon-clipping";import eo from"earcut";var oo=.58,kn=.01,ot=Vt*1.5*lt,ro=.5,io=.6;function so(t,n){let e=t.length,i=[];for(let r=0;r<e;r++){let s=t[Math.max(0,r-1)],l=t[Math.min(e-1,r+1)],c=l.x-s.x,f=l.y-s.y,m=Math.hypot(c,f);if(m<1e-9){i.push([0,0]);continue}c/=m,f/=m,i.push([-f,c])}let o=0;for(let r=0;r<e;r++)o+=(t[r].x-n.x)*i[r][0]+(t[r].y-n.y)*i[r][1];return o<0?i.map(([r,s])=>[-r,-s]):i}function ao(t,n){if(t.length<2||n<=0)return[...t];let e=[...t],i=(r,s)=>{let l=s.x-r.x,c=s.y-r.y,f=Math.hypot(l,c)||1;return{x:l/f,y:c/f}},o=i(e[1],e[0]),a=i(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 On=Math.PI/12;function co(t){if(t.length<3)return[...t];let n=[...t].sort((a,r)=>a.x-r.x||a.y-r.y),e=(a,r,s)=>(r.x-a.x)*(s.y-a.y)-(r.y-a.y)*(s.x-a.x),i=a=>{let r=[];for(let s of a){for(;r.length>=2&&e(r[r.length-2],r[r.length-1],s)<=0;)r.pop();r.push(s)}return r.pop(),r},o=[...i(n),...i([...n].reverse())];return o.length>=3?o:[...t]}function Dn(t,n){if(!t.length||!(n>0))return[];let e=co(t),i=(s,l,c,f)=>{let m=c-l;for(;m<0;)m+=Math.PI*2;for(;m>Math.PI*2;)m-=Math.PI*2;let u=Math.max(1,Math.ceil(m/On)),h=n/Math.cos(m/u/2);for(let b=0;b<=u;b++){let p=l+m*b/u;f.push({x:s.x+Math.cos(p)*h,y:s.y+Math.sin(p)*h})}};if(e.length<3){let s=0,l=0;for(let h of e)s+=h.x,l+=h.y;s/=e.length||1,l/=e.length||1;let c=0;for(let h of e)c=Math.max(c,Math.hypot(h.x-s,h.y-l));let f=[],m=Math.max(3,Math.ceil(Math.PI*2/On)),u=(c+n)/Math.cos(Math.PI/m);for(let h=0;h<m;h++){let b=h/m*Math.PI*2;f.push({x:s+Math.cos(b)*u,y:l+Math.sin(b)*u})}return f}let o=e.length,a=[];for(let s=0;s<o;s++){let l=e[s],c=e[(s+1)%o];a.push(Math.atan2(-(c.x-l.x),c.y-l.y))}let r=[];for(let s=0;s<o;s++)i(e[s],a[(s+o-1)%o],a[s],r);return jn(r)}function uo(t,n,e){if(t.length===1)return Math.hypot(n-t[0].x,e-t[0].y);let i=1/0;for(let o=0;o+1<t.length;o++){let a=t[o],r=t[o+1],s=r.x-a.x,l=r.y-a.y,c=s*s+l*l,f=c>1e-12?((n-a.x)*s+(e-a.y)*l)/c:0;f<0?f=0:f>1&&(f=1);let m=Math.hypot(n-(a.x+f*s),e-(a.y+f*l));m<i&&(i=m)}return i}function Wt(t){let n=t.map(o=>{let a=0,r=0;for(let c of o.pts)a+=c.x,r+=c.y;let s=o.pts.length||1;a/=s,r/=s;let l=0;for(let c of o.pts){let f=Math.hypot(c.x-a,c.y-r);f>l&&(l=f)}return{cx:a,cy:r,rad:l}}),e=o=>{let a=o.length;return a<=2?[...o]:[o[Math.floor(a*.25)],o[Math.floor(a*.5)],o[Math.floor(a*.75)]]},i=[];for(let o=0;o<t.length;o++){let a=e(t[o].pts),r=[],s=1/0,l=null;for(let f of a){let m=1/0;for(let u=0;u<t.length;u++){if(u===o||Math.abs(t[u].y-t[o].y)<.001)continue;let h=n[u],b=Math.hypot(f.x-h.cx,f.y-h.cy)-h.rad;if(b>=m&&b>=s)continue;let p=uo(t[u].pts,f.x,f.y);p<m&&(m=p),t[u].depth<t[o].depth&&p<s&&(s=p,l=t[u].y)}Number.isFinite(m)&&m>0&&r.push(m)}r.sort((f,m)=>f-m);let c=r.length?r[Math.floor(r.length/2)]:1;i.push({pitch:c,belowY:l})}return i}function Xn(t,n,e,i){let o=t[n],a=o.pts.length>=2?[...o.pts]:o.pts.length===1?(()=>{let f=o.pts[0],m=f.x-i.x,u=f.y-i.y,h=Math.hypot(m,u)||1;m/=h,u/=h;let b=Math.max(e[n].pitch,.001)*.5;return[{x:f.x+u*b,y:f.y-m*b},{x:f.x-u*b,y:f.y+m*b}]})():[];if(a.length<2)return null;let r=0,s=0;for(let f=1;f<a.length;f++){let m=Math.hypot(a[f].x-a[f-1].x,a[f].y-a[f-1].y);m>1e-6&&(r+=m,s++)}let l=s>0?r/s:0,c=ao(a,Math.max(l*io,ot));return{pts:c,nrm:so(c,i),front:Math.max(e[n].pitch*oo,ot),back:Math.max(e[n].pitch*ro,ot)}}var gt=1.5,Nn=.3;function rn(t,n){if(t.length<3)return t;let e=t[0],i=t[t.length-1],o=i.x-e.x,a=i.y-e.y,r=Math.hypot(o,a),s=-1,l=-1;for(let m=1;m<t.length-1;m++){let u=t[m],h=r>1e-12?Math.abs((u.x-e.x)*a-(u.y-e.y)*o)/r:Math.hypot(u.x-e.x,u.y-e.y);h>s&&(s=h,l=m)}if(s<=n||l<0)return[e,i];let c=rn(t.slice(0,l+1),n),f=rn(t.slice(l),n);return[...c.slice(0,-1),...f]}function Un(t,n){if(t.length<4)return t;let e=rn([...t,t[0]],n);return e.pop(),e.length>=3?e:t}function Yn(t,n,e){if(t.length<2)return[];let i=e??Wt(t),o=new Map;for(let r=0;r<t.length;r++){let s=o.get(t[r].blockId);s?s.push(r):o.set(t[r].blockId,[r])}let a=[];for(let[,r]of o){let s=[];for(let x of r){let T=t[x].patch;T&&T.length>=3?a.push({outline:[...T],holes:[],topY:t[x].y}):s.push(x)}if(!s.length)continue;s.sort((x,T)=>t[x].depth-t[T].depth);let c=s.map(x=>Xn(t,x,i,n)).filter(x=>x!==null);if(!c.length)continue;let f=(x,T)=>({x:x.pts[T].x-x.nrm[T][0]*(x.front+gt),y:x.pts[T].y-x.nrm[T][1]*(x.front+gt)}),m=(x,T)=>({x:x.pts[T].x+x.nrm[T][0]*(x.back+gt),y:x.pts[T].y+x.nrm[T][1]*(x.back+gt)}),u=c[0],h=c[c.length-1],b=[];for(let x=0;x<u.pts.length;x++)b.push(f(u,x));for(let x of c)b.push(m(x,x.pts.length-1));for(let x=h.pts.length-1;x>=0;x--)b.push(m(h,x));for(let x=c.length-1;x>=0;x--)b.push(f(c[x],0));let p=jn(b),y=1/0;for(let x of s)t[x].y<y&&(y=t[x].y);if(!Number.isFinite(y))continue;if(p.length>=3&&Math.abs(ft(p))>1e-6&&c.every(x=>{let T=x.pts[Math.floor(x.pts.length/2)];return It(p,T.x,T.y)})){a.push({outline:Un(p,Nn),holes:[],topY:y});continue}for(let x of lo(c))a.push({outline:x,holes:[],topY:y})}return a}function lo(t){let n=[];for(let e of t){let i=[],o=[],a=e.front+gt,r=e.back+gt;for(let l=0;l<e.pts.length;l++){let c=e.pts[l],f=e.nrm[l];i.push([c.x-f[0]*a,c.y-f[1]*a]),o.push([c.x+f[0]*r,c.y+f[1]*r])}let s=[...i,...o.reverse()];s.length<3||(s.push(s[0]),n.push([s]))}if(!n.length)return[];try{let e=Gn.union(n[0],...n.slice(1)),i=[];for(let o of e){if(!o.length||o[0].length<4)continue;let a=o[0].map(([l,c])=>({x:l,y:c})),r=a[0],s=a[a.length-1];a.length>1&&Math.abs(r.x-s.x)<1e-9&&Math.abs(r.y-s.y)<1e-9&&a.pop(),a.length>=3&&i.push(Un(a,Nn))}return i}catch{return[]}}function jn(t){let n=[];for(let e of t){let i=n[n.length-1];i&&Math.hypot(e.x-i.x,e.y-i.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 sn=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 i of e)i.x<this.minX&&(this.minX=i.x),i.y<this.minY&&(this.minY=i.y),i.x>this.maxX&&(this.maxX=i.x),i.y>this.maxY&&(this.maxY=i.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 i=!0;for(let o of n)if(!It(e,o.x,o.y)){i=!1;break}if(i)return!0}return!1}};function Ln(t,n,e,i,o,a){if(i.length<3)return;if(e.containsAll(i)){let c=[0,1,0],f=i[0];for(let m=1;m+1<i.length;m++){let u=i[m],h=i[m+1];t.tri([f.x*g,o,f.y*g],[u.x*g,o,u.y*g],[h.x*g,o,h.y*g],c,a)}return}let r=i.map(c=>[c.x,c.y]);r.push(r[0]);let s;try{s=Gn.intersection([r],n)}catch{return}let l=[0,1,0];for(let c of s){if(!c.length||c[0].length<4)continue;let f=c[0],m=[],u=[];for(let b=0;b<f.length-1;b++)m.push(f[b][0],f[b][1]),u.push([f[b][0],f[b][1]]);if(u.length<3)continue;let h=eo(m,void 0,2);for(let b=0;b<h.length;b+=3){let p=u[h[b]],y=u[h[b+1]],d=u[h[b+2]];t.tri([p[0]*g,o,p[1]*g],[y[0]*g,o,y[1]*g],[d[0]*g,o,d[1]*g],l,a)}}}function Hn(t,n,e,i,o,a,r){if(n.length<2)return;let s=r??Wt(n),l=[0,1,0],c=a&&a.length>=3?[[...a.map(h=>[h.x,h.y]),[a[0].x,a[0].y]]]:null,f=a&&a.length>=3?new sn([[...a]]):null,m=h=>{t.setMaterial(2),h(),t.setMaterial(0)},u=h=>{t.setMaterial(3),h(),t.setMaterial(0)};for(let h=0;h<n.length;h++){let b=n[h];if(b.patch&&b.patch.length>=3){let C=[...b.patch],P=s[h].belowY??i;if(u(()=>{if(c&&f)Ln(t,c,f,C,b.y,o.tread);else{let A=C[0];for(let E=1;E+1<C.length;E++){let v=C[E],G=C[E+1];t.tri([A.x*g,b.y,A.y*g],[v.x*g,b.y,v.y*g],[G.x*g,b.y,G.y*g],l,o.tread)}}}),b.y>P+kn){let A=0,E=0;for(let v of C)A+=v.x,E+=v.y;A/=C.length,E/=C.length,m(()=>{for(let v=0;v<C.length;v++){let G=C[v],X=C[(v+1)%C.length],M=X.x-G.x,B=X.y-G.y,O=Math.hypot(M,B);if(O<1e-6)continue;let F=B/O,I=-M/O;(G.x-A)*F+(G.y-E)*I<0&&(F=-F,I=-I);let k=[F,0,I],R=[G.x*g,b.y,G.y*g],_=[X.x*g,b.y,X.y*g],w=[G.x*g,P,G.y*g],D=[X.x*g,P,X.y*g];t.tri(R,_,D,k,o.riser),t.tri(R,D,w,k,o.riser)}})}continue}let p=Xn(n,h,s,e);if(!p)continue;let{pts:y,nrm:d,front:x,back:T}=p,S=s[h].belowY??i;for(let C=0;C+1<y.length;C++){let P=y[C],A=y[C+1],E=d[C],v=d[C+1];if(Math.hypot(A.x-P.x,A.y-P.y)<1e-6||E[0]===0&&E[1]===0||v[0]===0&&v[1]===0)continue;let G=[(P.x-E[0]*x)*g,b.y,(P.y-E[1]*x)*g],X=[(A.x-v[0]*x)*g,b.y,(A.y-v[1]*x)*g],M=[(P.x+E[0]*T)*g,b.y,(P.y+E[1]*T)*g],B=[(A.x+v[0]*T)*g,b.y,(A.y+v[1]*T)*g];if(u(()=>{c&&f?Ln(t,c,f,[{x:P.x-E[0]*x,y:P.y-E[1]*x},{x:A.x-v[0]*x,y:A.y-v[1]*x},{x:A.x+v[0]*T,y:A.y+v[1]*T},{x:P.x+E[0]*T,y:P.y+E[1]*T}],b.y,o.tread):(t.tri(G,X,B,l,o.tread),t.tri(G,B,M,l,o.tread))}),b.y>S+kn){let O=[G[0],S,G[2]],F=[X[0],S,X[2]],I=[-E[0],0,-E[1]];m(()=>{t.tri(G,X,F,I,o.riser),t.tri(G,F,O,I,o.riser)})}}}}import Wn from"polygon-clipping";function mo(t,n){let e=t.eventConfigurationIds;return!e?.length||!!n&&e.includes(n)}function Vn(t,n){return t.filter(e=>e.type!=="shape"||mo(e,n))}function zn(t,n){let e=t.focalPoint??{x:0,y:0};return t.floors?.length?t.floors.map((i,o)=>({objects:Vn(i.objects,n),focal:{x:(i.focalPoint??e).x,y:(i.focalPoint??e).y},baseHeightM:i.baseHeightM??0,index:o})):[{objects:Vn(t.objects,n),focal:e,baseHeightM:0,index:0}]}var fo={minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};function Mt(t){return xn(t)??fo}function Zn(t,n){let e=jt(t.outline,ot),i=Mt(e),o=n.filter(r=>r!==t&&r.outline&&r.outline.length>=3&&Xt(i,Mt(r.outline)));if(!o.length)return[e];let a=r=>{let s=r.map(l=>[l.x,l.y]);return s.push(s[0]),s};try{let r=Wn.difference([a(e)],...o.map(l=>[a(l.outline)])),s=[];for(let l of r){if(!l.length)continue;let c=l[0].map(([f,m])=>({x:f,y:m}));if(c.length>1){let f=c[0],m=c[c.length-1];Math.abs(f.x-m.x)<1e-9&&Math.abs(f.y-m.y)<1e-9&&c.pop()}c.length>=3&&s.push(c)}return s.length?s:[e]}catch{return[e]}}function Kn(t,n){if(!n.length)return t;let e=a=>{let r=a.map(s=>[s.x,s.y]);return r.push(r[0]),r},i=n.map(a=>[e(a)]),o=[];for(let a of t){let r;try{r=Wn.intersection([e(a.outline)],i.flat())}catch{o.push(a);continue}for(let s of r){if(!s.length)continue;let l=s[0].map(([c,f])=>({x:c,y:f}));if(l.length>1){let c=l[0],f=l[l.length-1];Math.abs(c.x-f.x)<1e-9&&Math.abs(c.y-f.y)<1e-9&&l.pop()}l.length>=3&&o.push({outline:l,holes:[],topY:a.topY})}}return o.length?o:t}var ho=.05,$n=.05,bo=.15,an=25;function qn(t,n,e){let i=new Map,o=new Array(n.length).fill(null),a=new Float64Array(n.length),r=new Array(n.length).fill(void 0),s=new Array(n.length).fill(void 0),l=new Map,c=[],f=new Set;for(let u=0;u<t.length;u+=1){let h=t[u];for(let b of h.objects){if(b.type==="table"&&f.add(b.id),b.type!=="section"||!b.outline||b.outline.length<3)continue;let p=jt(b.outline,ot);l.set(b.id,{section:b,unit:h,frontU:1/0,hasSeats:!1,rows:new Map,seatIndices:[]}),c.push({id:b.id,floorIndex:u,box:Mt(p),section:b,unit:h,outline:p})}}let m=new Map;for(let u of c){let h=m.get(u.floorIndex);h?h.push(u):m.set(u.floorIndex,[u])}for(let u=0;u<n.length;u++){let h=n[u],b=e?m.get(e[u])??[]:c,p=h.sectionId?b.find(d=>d.id===h.sectionId)??b.find(d=>d.section.logicalSectionId===h.sectionId&&qt({x:h.x,y:h.y},d.outline,d.section.holes)):void 0,y=p?[p]:b;for(let d of y){if(e&&d.floorIndex!==e[u]||!p&&(h.x<d.box.minX||h.x>d.box.maxX||h.y<d.box.minY||h.y>d.box.maxY||!qt({x:h.x,y:h.y},d.outline,d.section.holes)))continue;o[u]=d.id;let x=l.get(d.id);x.hasSeats=!0;let T=h.focalPoint??d.unit.focal,S=Math.hypot(h.x-T.x,h.y-T.y);S<x.frontU&&(x.frontU=S),x.seatIndices.push(u);let C=h.rowId||`__seat-${u}`,P=x.rows.get(C);P?P.push({x:h.x,y:h.y}):x.rows.set(C,[{x:h.x,y:h.y}]);break}}for(let[u,h]of l){let b=dn(h.section,{floorBaseHeightM:h.unit.baseHeightM}),p=h.unit.baseHeightM,y=b.rake>0?Math.tan(b.rake*Math.PI/180):0,d=b.rake<=.01&&b.height<=p+.001,x=h.section.surfaceKind,T=x==="flat"?!0:x==="rakedRows"&&b.rake>.01?!1:d,S=h.hasSeats?yn(u,n,h.seatIndices,h.unit.focal):{sectionId:u,rows:[],blockCount:0},P=S.rows.length<2?Pn([...h.rows.values()].map(R=>({points:R})),h.unit.focal):null,A=1/0;if(P){if(h.hasSeats)for(let R of h.rows.values())for(let _ of R){let w=P.depthAt(_.x,_.y);w<A&&(A=w)}if(!h.hasSeats||!Number.isFinite(A)){A=1/0;for(let R of h.section.outline){let _=P.depthAt(R.x,R.y);_<A&&(A=_)}}}let E=p+ho,v=Math.max(E,b.height),G=R=>{let _=Math.max(0,R-A)*ut,w=Math.min(_*y,an);return Math.max(E,b.height+w)},X=R=>{let _=Math.max(0,R)*ut,w=Math.min(_*y,an);return Math.max(E,b.height+w)},M=T?[]:S.rows.map(R=>({pts:R.pts,y:X(R.blockDepth),depth:R.blockDepth,blockId:R.blockId,...f.has(R.id)?{patch:Dn(R.pts,ot)}:{}})),B=M.length?M[0].y:v,O=M.map(R=>{let _=R.patch&&R.patch.length>=3?R.patch:R.pts,w=0,D=0;for(let L of _)w+=L.x,D+=L.y;let N=_.length||1;w/=N,D/=N;let U=0;for(let L of _){let Y=Math.hypot(L.x-w,L.y-D);Y>U&&(U=Y)}return{cx:w,cy:D,rad:U}}),F=T?()=>v:M.length>=2?(R,_)=>{let w=1/0,D=B;for(let N=0;N<M.length;N++){let U=O[N];if(Math.hypot(R-U.cx,_-U.cy)-U.rad>=w)continue;let L=M[N].patch,Y=L&&L.length>=3?It(L,R,_)?0:Dt(L,R,_):Dt(M[N].pts,R,_);Y<w&&(w=Y,D=M[N].y)}return D}:(R,_)=>P?G(P.depthAt(R,_)):v,I=[0,1,0],k=M.length>=2||T?()=>I:(R,_)=>{if(!P)return I;let w=P.depthAt(R,_);if(w<=A)return I;let D=(w-A)*ut;if(D*y>=an||b.height+D*y<=E)return I;let[N,U]=P.gradientAt(R,_);if(N===0&&U===0)return I;let L=1/Math.hypot(y,1);return[-N*y*L,L,-U*y*L]};if(!T)for(let R of S.rows){let _=X(R.blockDepth);for(let w of R.seatIndices)r[w]=_}for(let R of S.rows){let _=[];for(let L=1;L<R.pts.length;L++){let Y=Math.hypot(R.pts[L].x-R.pts[L-1].x,R.pts[L].y-R.pts[L-1].y);Y>1e-6&&_.push(Y)}_.sort((L,Y)=>L-Y);let w=_.length?_[Math.floor(_.length/2)]:1/0,D=1/0,N=R.pts[Math.floor(R.pts.length/2)];if(N)for(let L of S.rows){if(L===R||L.blockId!==R.blockId)continue;let Y=Dt(L.pts,N.x,N.y);Y>1e-6&&Y<D&&(D=Y)}let U=Math.min(w,Math.max(D,w*.5));if(Number.isFinite(U)&&U>0)for(let L of R.seatIndices)s[L]=U}i.set(u,{sectionId:u,deckAt:F,normalAt:k,flat:T,bottomY:p,rowLevels:M,landingY:B})}for(let u=0;u<n.length;u++){let h=o[u],b=n[u];if(h){let y=r[u];a[u]=(y??i.get(h).deckAt(b.x,b.y))+bo;continue}let p=b.eyeHeightM;a[u]=Number.isFinite(p)?Math.max(0,p-Gt):0}return{bySection:i,seatOwner:o,seatDeckY:u=>a[u],seatPitchU:u=>s[u]}}var W={top:1,wallBottom:.5,bottomCap:.4};function st(t,n){if(!t)return n;let e=et(At(t,.4),.62);return nt(n,e,.72)}function Jn(t,n){let e=new Map;for(let a of t.categories??[])e.set(a.key,a.color);let i=new Map;for(let a of n){if(!a.sectionId)continue;let r=i.get(a.sectionId);r||(r=new Map,i.set(a.sectionId,r)),r.set(a.categoryKey,(r.get(a.categoryKey)??0)+1)}let o=new Map;for(let[a,r]of i){let s=0,l=0,c=0,f=0;for(let[m,u]of r){let h=H(e.get(m));h&&(s+=h[0]*u,l+=h[1]*u,c+=h[2]*u,f+=u)}f>0&&o.set(a,[s/f,l/f,c/f])}return o}function Qn(t,n){return H(t.color)??n.get(t.logicalSectionId??t.id)??null}import po from"polygon-clipping";function yo(t,n){return t===void 0||n===void 0?!0:Math.abs(t-n)<.001}var zt=class{constructor(){this.rings=[];this.boxes=[];this.levels=[]}subtract(n,e){let i=n.map(l=>[l.x,l.y]);if(i.length<3)return[];i.push(i[0]);let o=Mt(n),a=this.rings.filter((l,c)=>Xt(o,this.boxes[c])&&yo(e,this.levels[c])),r=[[i]];if(a.length)try{r=po.difference([i],...a).map(c=>c.map(f=>f.map(([m,u])=>[m,u])))}catch{r=[[i]]}this.rings.push([i]),this.boxes.push(o),this.levels.push(e);let s=[];for(let l of r){if(!l.length)continue;let c=l[0].map(([f,m])=>({x:f,y:m}));if(c.length>1){let f=c[0],m=c[c.length-1];Math.abs(f.x-m.x)<1e-9&&Math.abs(f.y-m.y)<1e-9&&c.pop()}c.length>=3&&s.push(c)}return s}};function xo(t,n){if(!n)return t;let e=1/0,i=-1/0,o=1/0,a=-1/0;for(let m of t)e=Math.min(e,m.x),i=Math.max(i,m.x),o=Math.min(o,m.y),a=Math.max(a,m.y);let r=(e+i)/2,s=(o+a)/2,l=n*Math.PI/180,c=Math.cos(l),f=Math.sin(l);return t.map(m=>{let u=m.x-r,h=m.y-s;return{x:r+u*c-h*f,y:s+u*f+h*c}})}function bt(t){let n=null;if(t.kind==="polygon"&&t.points&&t.points.length>=3&&(n=t.points),t.kind==="rect"&&t.width&&t.height&&(n=_t(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,i=(t.y??0)+t.height/2;n=Ht(e,i,t.width/2,t.height/2)}return n?xo(n,t.rotation):null}function Ft(t){let n=t.role??"",e={stage:{kind:"stage",heightM:1},entrance:{kind:"portal",heightM:2.7},exit:{kind:"portal",heightM:2.7},screen:{kind:"solid",heightM:6},wall:{kind:"solid",heightM:2.8},rail:{kind:"solid",heightM:1.1},suite:{kind:"suite",heightM:3},obstruction:{kind:"solid",heightM:4.5},sound:{kind:"solid",heightM:1.45},restroom:{kind:"solid",heightM:2.4},bar:{kind:"solid",heightM:1.1},concession:{kind:"solid",heightM:1.1},coat:{kind:"solid",heightM:1.1},goal:{kind:"portal",heightM:1.8}},i=n==="stage"&&Rn(t.stageKind)?{kind:"stage",heightM:.06}:e[n]??{kind:"plate",heightM:.25};return{...i,heightM:t.heightM??i.heightM}}var go=.08;function te(t,n){let e=bt(t),i=Ft(t),o=i.heightM;if(!e||i.kind!=="plate"&&i.kind!=="stage")return o;let a=1/0,r=1/0,s=-1/0,l=-1/0;for(let f of e)a=Math.min(a,f.x),r=Math.min(r,f.y),s=Math.max(s,f.x),l=Math.max(l,f.y);let c=o;for(let f of n)s>f.minX&&a<f.maxX&&l>f.minY&&r<f.maxY&&c<=f.topOffsetM+1e-6&&(c=f.topOffsetM+go);return n.push({minX:a,minY:r,maxX:s,maxY:l,topOffsetM:c}),c}function mt(t,n,e){return{x:t.x+(n.x-t.x)*e,y:t.y+(n.y-t.y)*e}}function ne(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 Et(t,n,e){return[mt(t[0],t[1],n),mt(t[0],t[1],e),mt(t[3],t[2],e),mt(t[3],t[2],n)]}function ee(t,n,e){return[mt(t[0],t[3],n),mt(t[1],t[2],n),mt(t[1],t[2],e),mt(t[0],t[3],e)]}function at(t,n,e,i,o,a){K(t,n,void 0,()=>e,i,o,a,W)}var cn=2.4,Mo=.75,So=.15;function Ct(t){if(t.points&&t.points.length>=3)return t.points;let{center:n,width:e,height:i,rotation:o}=t;if(!e||!i)return null;let a=(o??0)*Math.PI/180,r=Math.cos(a),s=Math.sin(a),l=e/2,c=i/2;return[[-l,-c],[l,-c],[l,c],[-l,c]].map(([f,m])=>({x:n.x+f*r-m*s,y:n.y+f*s+m*r}))}function oe(t,n,e,i,o){let a=Ct(n);a&&K(t,a,void 0,()=>e+cn,e,st(i,o.boothTop),o.boothWall,W)}function un(t){if(t.shape==="round"){let f=t.radius;return f?Ht(t.center.x,t.center.y,f,f,24):null}let{width:n,height:e,rotation:i,center:o}=t;if(!n||!e)return null;let a=(i??0)*Math.PI/180,r=Math.cos(a),s=Math.sin(a),l=n/2,c=e/2;return[[-l,-c],[l,-c],[l,c],[-l,c]].map(([f,m])=>({x:o.x+f*r-m*s,y:o.y+f*s+m*r}))}function re(t,n,e,i,o){let a=un(n);a&&K(t,a,void 0,()=>e+Mo,e,st(i,o.tableTop),o.tableWall,W)}function ie(t,n,e,i,o,a,r,s){let l=bt(n);if(!l)return;let c=s?s.kind==="stage":n.role==="stage",f=s?s.kind==="screen":n.role==="screen",m=s?{kind:c?"stage":"solid",heightM:s.topY-s.baseY}:Ft(n),u=s?.baseY??e,h=s?.topY??e+i;if(c&&r){let x=1/0,T=-1/0,S=1/0,C=-1/0;for(let P of l)P.x<x&&(x=P.x),P.x>T&&(T=P.x),P.y<S&&(S=P.y),P.y>C&&(C=P.y);r.push({cx:(x+T)/2*g,cz:(S+C)/2*g,y:h,halfX:Math.max((T-x)/2*g,.5),halfZ:Math.max((C-S)/2*g,.5)})}let b=H(n.fill),p=c&&b?nt(o.stageTop,et(At(b,.18),.9),.9):st(b,c?o.stageTop:o.decorTop),y=f?b:null,d=c?b?nt(o.stageWall,et(b,.58),.82):o.stageWall:f?y?nt(et(y,1.42),[.24,.46,.82],.08):[.24,.46,.82]:st(H(n.fill),o.decorWall);if(m.kind==="portal"&&l.length===4){let x=ne(l);at(t,Et(x,0,.16),h,u,p,d),at(t,Et(x,.84,1),h,u,p,d),at(t,x,h,Math.max(u,h-.35),p,d);return}if(m.kind==="suite"&&l.length===4){let x=l.map((C,P)=>{let A=l[(P+1)%4],E=(C.x+A.x)/2,v=(C.y+A.y)/2;return Math.hypot(E-a.x,v-a.y)}),T=x.indexOf(Math.min(...x)),S=[0,1,2,3].map(C=>l[(T+C)%4]);at(t,Et(S,0,.08),h,u,p,d),at(t,Et(S,.92,1),h,u,p,d),at(t,ee(S,.88,1),h,u,p,d),at(t,S,h,Math.max(u,h-.18),p,d);return}at(t,l,h,u,p,d)}function ln(t){let{x:n,y:e,width:i,height:o}=t;if(!i||!o)return null;let a=n+i/2,r=e+o/2,s=(t.rotation??0)*Math.PI/180,l=Math.cos(s),c=Math.sin(s),f=i/2,m=o/2;return[[-f,-m],[f,-m],[f,m],[-f,m]].map(([u,h])=>({x:a+u*l-h*c,y:r+u*c+h*l}))}function Ro(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 i=e[1].trim();if(i==="none"||i==="transparent")return null;let o=i.match(/^url\(#([^)]+)\)$/);if(!o)return H(i);let a=n.match(new RegExp(`<(?:linear|radial)Gradient\\b[^>]*\\bid="${o[1]}"[^>]*>([\\s\\S]*?)</(?:linear|radial)Gradient>`,"i"));if(!a)return null;let r=[];for(let s of a[1].matchAll(/stop-color="([^"]+)"/gi)){let l=H(s[1].trim());l&&r.push(l)}return r.length?r.reduce((s,l,c)=>nt(s,l,1/(c+1)),r[0]):null}function se(t,n,e,i){if(n.layer==="foreground")return;let o=ln(n);if(!o)return;let a=e+So,r=st(Ro(n.href),i.decorTop),s=Math.max(0,Math.min(1,n.opacity??1));s<1&&(r=nt(i.ground,r,s)),K(t,o,void 0,()=>a,e,r,nt(r,i.decorWall,.5),W)}function ae(t,n,e,i,o){if(!n.points||n.points.length<3)return;let a=st(i,o.gaTop);K(t,n.points,n.holes,()=>e+.15,e,a,o.gaWall,W)}var Po=.25,Ao=1.2,Io=.6,wo=.45,To=2.3,_o=Math.PI/180;function pt(t,n,e){let i=e*_o;return{x:t.x+n*Math.sin(i),y:t.y+n*Math.cos(i)}}function Bo(t,n){let e=n.rings[n.rings.length-1];if(!e)return!1;let i=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 r=0;for(let s of a)Math.hypot(s.x-n.centre.x,s.y-n.centre.y)>=i&&r++;if(r>=a.length/2)return!0}return!1}var Fo=24;function Eo(t,n,e,i,o,a,r,s){let l=e.binCount,c=Fo,f=ut,m=a+.02,u=[];for(let M=0;M<l;M++){let B=(e.startBin+M+.5)*n.binStepDeg,O=new Float64Array(c+1);for(let F=0;F<=c;F++){let I=i[M]+(o[M]-i[M])*F/c;O[F]=Math.max(m,In(n,e,B,I)-Po)}u.push(O)}let h=[r.bandTop[0]*s.top,r.bandTop[1]*s.top,r.bandTop[2]*s.top],b=[r.bandTop[0]*s.bottomCap,r.bandTop[1]*s.bottomCap,r.bandTop[2]*s.bottomCap],p=[r.bandWall[0]*s.top,r.bandWall[1]*s.top,r.bandWall[2]*s.top],y=[r.bandWall[0]*s.wallBottom,r.bandWall[1]*s.wallBottom,r.bandWall[2]*s.wallBottom],d=(M,B)=>{let O=(e.startBin+M+.5)*n.binStepDeg,F=i[M]+(o[M]-i[M])*B/c,I=pt(n.centre,F,O);return[I.x*f,u[M][B],I.y*f]};{let M=Math.tan(12*Math.PI/180);for(let B=0;B<6;B++){let O=!1;for(let I=0;I<l;I++)for(let k=c-1;k>=0;k--)u[I][k]>u[I][k+1]&&(u[I][k]=u[I][k+1],O=!0);let F=e.closed?l:l-1;for(let I=0;I<F;I++){let k=(I+1)%l;for(let R=0;R<=c;R++){let _=u[k][R]-u[I][R];if(Math.abs(_)>1)continue;let w=i[I]+(o[I]-i[I])*R/c,D=i[k]+(o[k]-i[k])*R/c,N=pt(n.centre,w,(e.startBin+I+.5)*n.binStepDeg),U=pt(n.centre,D,(e.startBin+k+.5)*n.binStepDeg),L=M*Math.hypot(U.x-N.x,U.y-N.y)*f;_>L?(u[k][R]=u[I][R]+L,O=!0):-_>L&&(u[I][R]=u[k][R]+L,O=!0)}}if(!O)break}}let x=1,T=(M,B)=>{for(let O=0;O<=c;O+=4)if(Math.abs(u[M][O]-u[B][O])>x)return!0;return Math.abs(u[M][c]-u[B][c])>x},S=Math.tan(38*Math.PI/180),C=M=>(o[M]-i[M])/c*f,P=(M,B)=>u[M][B+1]-u[M][B]>S*Math.max(1e-6,C(M)),A=(M,B)=>{let O=e.closed?(M-1+l)%l:Math.max(0,M-1),F=e.closed?(M+1)%l:Math.min(l-1,M+1);Math.abs(u[O][B]-u[M][B])>x&&(O=M),Math.abs(u[F][B]-u[M][B])>x&&(F=M);let I=Math.max(0,B-1),k=Math.min(c,B+1);I<B&&P(M,I)&&(I=B),k>B&&P(M,B)&&(k=B);let R=d(O,B),_=d(F,B),w=d(M,I),D=d(M,k),N=_[0]-R[0],U=_[1]-R[1],L=_[2]-R[2],Y=D[0]-w[0],j=D[1]-w[1],$=D[2]-w[2],z=U*$-L*j,q=L*Y-N*$,tt=N*j-U*Y,Z=Math.hypot(z,q,tt);return Z>1e-12?(z/=Z,q/=Z,tt/=Z,q<0&&(z=-z,q=-q,tt=-tt),[z,q,tt]):[0,1,0]},E=(M,B)=>{let O=[M[0],a,M[2]],F=[B[0],a,B[2]],I=B[0]-M[0],k=B[2]-M[2],R=Math.hypot(I,k);if(!(R>1e-12))return;let _=[k/R,0,-I/R];t.tri(M,B,F,_,p,p,y),t.tri(M,F,O,_,p,y,y)},v=.05*lt,G=M=>o[M]-i[M]<v,X=e.closed?l:l-1;for(let M=0;M<X;M++){let B=(M+1)%l;if(G(M)||G(B))continue;if(T(M,B)){let _=(e.startBin+M+1)*n.binStepDeg,w=(j,$)=>{let z=(i[M]+i[B])/2,q=(o[M]+o[B])/2,tt=z+(q-z)*$/c,Z=pt(n.centre,tt,_);return[Z.x*f,u[j][$],Z.y*f]};for(let j=0;j<c;j++){let $=d(M,j),z=d(M,j+1),q=w(M,j),tt=w(M,j+1),Z=A(M,j),it=A(M,j+1);t.triN($,q,tt,Z,Z,it,h),t.triN($,tt,z,Z,it,it,h);let vt=d(B,j),kt=d(B,j+1),dt=w(B,j),St=w(B,j+1),yt=A(B,j),xt=A(B,j+1);t.triN(dt,vt,kt,yt,yt,xt,h),t.triN(dt,kt,St,yt,xt,xt,h);let ct=w(M,j),rt=w(M,j+1),Ot=w(B,j+1),Kt=w(B,j),Lt=rt[0]-ct[0],Rt=rt[2]-ct[2],$t=Math.hypot(Lt,Rt);if($t>1e-12){let fn=[Rt/$t,0,-Lt/$t];t.tri(ct,rt,Ot,fn,p),t.tri(ct,Ot,Kt,fn,p)}}let D=d(M,0),N=d(B,0),U=d(B,c),L=d(M,c),Y=j=>[j[0],a,j[2]];t.tri(Y(D),Y(U),Y(N),[0,-1,0],b),t.tri(Y(D),Y(L),Y(U),[0,-1,0],b),E(D,N),E(L,U);continue}for(let _=0;_<c;_++){let w=A(M,_),D=A(B,_),N=A(B,_+1),U=A(M,_+1);if(P(M,_)||P(B,_)){let z=(rt,Ot)=>{let Kt=(e.startBin+rt+.5)*n.binStepDeg,Lt=i[rt]+(o[rt]-i[rt])*(_+.5)/c,Rt=pt(n.centre,Lt,Kt);return[Rt.x*f,Ot,Rt.y*f]},q=d(M,_),tt=d(B,_),Z=z(M,u[M][_]),it=z(B,u[B][_]);t.triN(q,tt,it,w,D,D,h),t.triN(q,it,Z,w,D,w,h);let vt=d(B,_+1),kt=d(M,_+1),dt=z(M,u[M][_+1]),St=z(B,u[B][_+1]);t.triN(dt,St,vt,U,N,N,h),t.triN(dt,vt,kt,U,N,U,h);let yt=it[0]-Z[0],xt=it[2]-Z[2],ct=Math.hypot(yt,xt);if(ct>1e-12){let rt=[-xt/ct,0,yt/ct];t.tri(Z,it,St,rt,p),t.tri(Z,St,dt,rt,p)}continue}let L=d(M,_),Y=d(B,_),j=d(B,_+1),$=d(M,_+1);t.triN(L,Y,j,w,D,N,h),t.triN(L,j,$,w,N,U,h)}let O=d(M,0),F=d(B,0),I=d(B,c),k=d(M,c),R=_=>[_[0],a,_[2]];t.tri(R(O),R(I),R(F),[0,-1,0],b),t.tri(R(O),R(k),R(I),[0,-1,0],b),E(O,F),E(k,I)}if(!e.closed)for(let M of[0,l-1])for(let B=0;B<c;B++)E(d(M,B),d(M,B+1))}function ce(t,n,e){let{bottomY:i,colors:o,ao:a}=e,r=new Float64Array(n.binCount).fill(-1/0);for(let f of n.rings)for(let m of f.arcs){let u=new Float64Array(m.binCount),h=new Float64Array(m.binCount);for(let p=0;p<m.binCount;p++){let y=(m.startBin+p)%n.binCount,d=Math.max(0,m.innerR[p]-ot);u[p]=Math.max(d,r[y]+.001),h[p]=Math.max(u[p]+.001,m.outerR[p]+ot)}let b=0;for(let p=0;p<m.binCount;p++){let y=m.topLevelM[p]-i;y>b&&(b=y)}b>=Ao&&Eo(t,n,m,u,h,i,o,a);for(let p=0;p<m.binCount;p++){let y=(m.startBin+p)%n.binCount;h[p]>r[y]&&(r[y]=h[p])}}if(e.deriveShell===!1||Bo(e.shapes,n))return;let s=n.rings[n.rings.length-1],l=Io*lt,c=wo*lt;for(let f of s.arcs){let m=[],u=[];for(let p=0;p<f.binCount;p++){let y=(f.startBin+p+.5)*n.binStepDeg,d=f.outerR[p]+ot+l;m.push(pt(n.centre,d,y)),u.push(pt(n.centre,d+c,y))}let h=-1/0;for(let p=0;p<f.binCount;p++)f.topLevelM[p]>h&&(h=f.topLevelM[p]);let b=()=>h+To;f.closed?K(t,u,[m.slice().reverse()],b,i,o.shellTop,o.shellWall,a):K(t,[...u,...m.slice().reverse()],void 0,b,i,o.shellTop,o.shellWall,a)}}function ue(t,n,e,i,o,a,r,s){if(!n.outline||n.outline.length<3)return;let l=e.baseHeightM,c=st(i,s.tierTop);if(!o)return;let f=y=>o.deckAt(y.x,y.y),m=Zn(n,r),u=m[0]??n.outline;if(o.rowLevels.length>=2){let y=Wt(o.rowLevels),d=Kn(Yn(o.rowLevels,e.focal,y),m),x=()=>[0,1,0];for(let S of d){let C=Math.max(l,S.topY-.02);for(let P of a.subtract(S.outline,C))K(t,P,S.holes,()=>C,l,c,s.tierWall,W,void 0,x)}d.length||K(t,u,n.holes,()=>o.landingY,l,c,s.tierWall,W);let T={tread:[c[0]*W.top,c[1]*W.top,c[2]*W.top],riser:[c[0]*.72,c[1]*.72,c[2]*.72]};for(let S of m.length?m:[u])Hn(t,o.rowLevels,e.focal,o.landingY,T,S,y);return}let h=o.flat?1/0:$n,b=y=>o.normalAt(y.x,y.y),p=o.flat?o.landingY:void 0;for(let y of a.subtract(u,p))K(t,y,n.holes,f,l,c,s.tierWall,W,h,b)}function Co(t,n,e){let i=new Set;for(let r of t.objects)r.type==="section"&&i.add(r.id);let o=new Map;for(let r=0;r<n.length;r++){let s=e.seatOwner[r];if(!s||!i.has(s))continue;let l=e.bySection.get(s);if(l&&l.rowLevels.length>=2)continue;let c=n[r],f=o.get(s);f||(f=new Map,o.set(s,f));let m=c.rowId||`__seat-${r}`,u=f.get(m);u||(u={pts:[],levelM:0,n:0},f.set(m,u)),u.pts.push({x:c.x,y:c.y}),u.levelM+=e.seatDeckY(r),u.n++}let a=[];for(let r of t.objects){if(r.type!=="section")continue;let s=e.bySection.get(r.id);if(s&&s.rowLevels.length>=2){let c=s.rowLevels.filter(f=>!f.patch).map(f=>({pts:f.pts,levelM:f.y}));c.length>=2&&a.push({sectionId:r.id,rows:c});continue}let l=o.get(r.id);l&&a.push({sectionId:r.id,rows:[...l.values()].map(c=>({pts:c.pts,levelM:c.levelM/c.n}))})}return a}function le(t,n,e,i,o,a,r=!0){let s=Co(n,e,i);if(!s.length)return;let l=An(s,n.focal);l&&(t.setMaterial(0),ce(t,l,{bottomY:n.baseHeightM,colors:{bandTop:et(o.tierTop,.8),bandWall:o.tierWall,shellTop:a??et(o.tierWall,1.15),shellWall:a??o.tierWall},ao:W,shapes:n.objects.filter(c=>c.type==="shape"),deriveShell:r}))}var vo=6,ko=2.2,me=.1,Oo=.3,Lo=1.8,Go=.9,Do=.55,Xo=6e3;function fe(t){let{doc:n,units:e,seats:i,surfaces:o,focal:a}=t,r=n.zones??[],s=[];if(r.length){let l=new Map;for(let f of e)for(let m of f.objects)m.type==="section"&&m.zone&&l.set(m.id,m.zone);let c=new Map;for(let f=0;f<i.length;f++){let m=i[f],u=o.seatOwner[f],h=m.zoneId??(u?l.get(u):void 0);if(!h)continue;let b=c.get(h);b||(b={n:0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0,sumY:0},c.set(h,b)),b.n++,m.x<b.minX&&(b.minX=m.x),m.y<b.minY&&(b.minY=m.y),m.x>b.maxX&&(b.maxX=m.x),m.y>b.maxY&&(b.maxY=m.y),b.sumY+=o.seatDeckY(f)}for(let f of r){let m=c.get(f.id),u=[];for(let[h,b]of l)b===f.id&&u.push(h);if(!m||m.n===0){s.push({id:f.id,label:f.label,color:H(f.color),sectionIds:u,seatCount:0,center:[0,0,0],radius:0,focalWorld:[(f.focalPoint??a).x*g,1.5,(f.focalPoint??a).y*g]});continue}s.push({id:f.id,label:f.label,color:H(f.color),sectionIds:u,seatCount:m.n,center:[(m.minX+m.maxX)/2*g,m.sumY/m.n,(m.minY+m.maxY)/2*g],radius:.5*Math.hypot((m.maxX-m.minX)*g,(m.maxY-m.minY)*g)||1,focalWorld:[(f.focalPoint??a).x*g,1.5,(f.focalPoint??a).y*g]})}}return s}function he(t){let{doc:n,units:e,seats:i,surfaces:o,seatData:a,hintedSeatFloor:r,zones:s,focal:l}=t,c=[],f=[],m=[];for(let u of s)u.seatCount!==0&&c.push({id:`zone:${u.id}`,kind:"zone",text:u.label,anchor:[u.center[0],u.center[1]+vo,u.center[2]],color:n.zones?.find(h=>h.id===u.id)?.color});{let u=new Map,h=new Map;for(let b=0;b<i.length;b++){let p=o.seatOwner[b];if(!p)continue;let y=u.get(p);y||(y={n:0,x:0,y:0,deck:0},u.set(p,y)),y.n++,y.x+=i[b].x,y.y+=i[b].y,y.deck+=o.seatDeckY(b);let d=h.get(p);d||(d={minX:1/0,maxX:-1/0,minY:1/0,maxY:-1/0},h.set(p,d)),i[b].x<d.minX&&(d.minX=i[b].x),i[b].x>d.maxX&&(d.maxX=i[b].x),i[b].y<d.minY&&(d.minY=i[b].y),i[b].y>d.maxY&&(d.maxY=i[b].y)}for(let b of e)for(let p of b.objects){if(p.type!=="section")continue;let y=u.get(p.id);if(!y||y.n===0)continue;let d=h.get(p.id),x=[y.x/y.n*g,y.deck/y.n,y.y/y.n*g],T=p.displayLabel||p.label||p.id;f.push({id:p.id,floorIndex:b.index,label:T,seatCount:y.n,center:x,radius:Math.max(1,Math.hypot(d.maxX-d.minX,d.maxY-d.minY)*.5*g),focalWorld:[b.focal.x*g,b.baseHeightM+1.5,b.focal.y*g]});let S=n.floors?.[b.index]?.name?.trim().toLocaleLowerCase();e.length>1&&S===T.trim().toLocaleLowerCase()||c.push({id:`section:${p.id}`,kind:"section",text:T,anchor:[x[0],x[1]+ko,x[2]],floorIndex:b.index})}}{for(let b of e)for(let p of b.objects){if(p.type!=="gaArea")continue;let y=Pt(p.points);if(!y)continue;let d=p.displayLabel||p.label||p.id;c.push({id:`ga:${p.id}`,kind:"ga",text:p.capacity>0?`${d} \xB7 ${p.capacity.toLocaleString()}`:d,anchor:[y.x*g,b.baseHeightM+Lo,y.y*g],floorIndex:b.index})}let u=new Map;for(let b=0;b<i.length;b++){let p=i[b],y=Math.hypot(p.x-l.x,p.y-l.y),d=u.get(p.rowId);(!d||y>d.far)&&u.set(p.rowId,{seat:p,index:b,far:y})}for(let[b,p]of u){let y=p.seat.label?p.seat.label.lastIndexOf("-"):-1,d=y>0?p.seat.label.slice(0,y):b;d&&c.push({id:`row:${b}`,kind:"row",text:d,anchor:[p.seat.x*g,o.seatDeckY(p.index)+Go,p.seat.y*g],floorIndex:r[p.index]})}let h=new Map;for(let b=0;b<i.length;b++){let p=i[b],y=p.label?p.label.lastIndexOf("-"):-1,d=h.get(p.rowId);d||(d={n:0,x:0,y:0,z:0,minX:1/0,maxX:-1/0,minZ:1/0,maxZ:-1/0,label:y>0?p.label.slice(0,y):p.rowId,sectionId:p.sectionId},h.set(p.rowId,d));let x=b*3,T=a.iPosition[x],S=a.iPosition[x+1],C=a.iPosition[x+2];d.n++,d.x+=T,d.y+=S,d.z+=C,d.minX=Math.min(d.minX,T),d.maxX=Math.max(d.maxX,T),d.minZ=Math.min(d.minZ,C),d.maxZ=Math.max(d.maxZ,C)}for(let[b,p]of h)m.push({id:b,label:p.label,sectionId:p.sectionId,seatCount:p.n,center:[p.x/p.n,p.y/p.n,p.z/p.n],radius:Math.max(.8,Math.hypot(p.maxX-p.minX,p.maxZ-p.minZ)*.5)});if(i.length<=Xo)for(let b=0;b<i.length;b++){let p=i[b],y=p.displayLabel||p.label;y&&c.push({id:`seat:${p.id}`,kind:"seat",text:y,anchor:[p.x*g,o.seatDeckY(b)+Do,p.y*g],floorIndex:r[b]})}}for(let u of e)for(let h of u.objects)if(h.type==="shape"&&h.role&&["entrance","exit","screen","suite","obstruction"].includes(h.role)){let b=bt(h),p=b?Pt(b):null;if(!p||!h.label)continue;c.push({id:`architecture:${h.id}`,kind:"annotation",text:h.label,anchor:[p.x*g,u.baseHeightM+Ft(h).heightM+me,p.y*g],color:h.fill,floorIndex:u.index})}else if(h.type==="text"){if(!h.text)continue;c.push({id:`text:${h.id}`,kind:"annotation",text:h.text,anchor:[h.position.x*g,u.baseHeightM+me,h.position.y*g],color:h.color,rotation:h.rotation,floorIndex:u.index})}else if(h.type==="booth"){let b=Ct(h);if(!b)continue;let p=Pt(b);if(!p)continue;c.push({id:`booth:${h.id}`,kind:"booth",text:h.displayLabel||h.label||h.id,anchor:[p.x*g,u.baseHeightM+cn+Oo,p.y*g],floorIndex:u.index})}return{labels:c,sections:f,rows:m}}function be(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 pe(t){let{doc:n,units:e,seats:i,surfaces:o,solids:a,hintedSeatFloor:r,seatFloor:s}=t,l=[];{let c=e.map(()=>({minX:1/0,minY:1/0,minZ:1/0,maxX:-1/0,maxY:-1/0,maxZ:-1/0}));for(let u=0;u<a.floor.length;u+=1){let h=Math.max(0,Math.min(e.length-1,Math.round(a.floor[u]))),b=u*3,p=c[h];p.minX=Math.min(p.minX,a.position[b]),p.minY=Math.min(p.minY,a.position[b+1]),p.minZ=Math.min(p.minZ,a.position[b+2]),p.maxX=Math.max(p.maxX,a.position[b]),p.maxY=Math.max(p.maxY,a.position[b+1]),p.maxZ=Math.max(p.maxZ,a.position[b+2])}let f=new Map;for(let u=0;u<e.length;u++)for(let h of e[u].objects)h.type==="section"&&f.set(h.id,u);let m=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 u=0;u<i.length;u++){let h=o.seatOwner[u],b=(h!==null?f.get(h):void 0)??r[u];if(b===void 0)continue;let p=m[b],y=i[u];p.n++,y.x<p.minX&&(p.minX=y.x),y.y<p.minY&&(p.minY=y.y),y.x>p.maxX&&(p.maxX=y.x),y.y>p.maxY&&(p.maxY=y.y);let d=o.seatDeckY(u);p.sumX+=y.x*g,p.sumDeck+=d,p.sumZ+=y.y*g,p.minDeck=Math.min(p.minDeck,d),p.maxDeck=Math.max(p.maxDeck,d+1.6),s[u]=b}for(let u=0;u<e.length;u++){let h=m[u],b=n.floors?.[u],p=c[u],y=Math.min(h.n?h.minX*g:e[u].focal.x*g-1,Number.isFinite(p.minX)?p.minX:1/0),d=Math.max(h.n?h.maxX*g:e[u].focal.x*g+1,Number.isFinite(p.maxX)?p.maxX:-1/0),x=Math.min(h.n?h.minY*g:e[u].focal.y*g-1,Number.isFinite(p.minZ)?p.minZ:1/0),T=Math.max(h.n?h.maxY*g:e[u].focal.y*g+1,Number.isFinite(p.maxZ)?p.maxZ:-1/0),S=Math.min(h.n?Math.min(e[u].baseHeightM,h.minDeck):e[u].baseHeightM,Number.isFinite(p.minY)?p.minY:1/0),C=Math.max(h.n?Math.max(h.maxDeck,S+.5):S+.5,Number.isFinite(p.maxY)?p.maxY:-1/0),P=[h.n?h.sumX/h.n:(y+d)/2,h.n?h.sumDeck/h.n:(S+C)/2,h.n?h.sumZ/h.n:(x+T)/2],A=Math.max(1,.5*Math.hypot(d-y,C-S,T-x));l.push({index:u,id:b?.id??`floor-${u}`,label:b?.name??(e.length>1?`Floor ${u+1}`:"Venue"),seatCount:h.n,center:P,radius:A,box:{min:[y,S,x],max:[d,C,T]},focalWorld:[e[u].focal.x*g,e[u].baseHeightM+1.5,e[u].focal.y*g]})}}return l}function mn(t,n){let e=1/0,i=1/0,o=-1/0,a=-1/0,r=(s,l)=>{s<e&&(e=s),l<i&&(i=l),s>o&&(o=s),l>a&&(a=l)};for(let s of n)r(s.x,s.y);for(let s of t)for(let l of s.objects)if(l.type==="section")for(let c of l.outline)r(c.x,c.y);else if(l.type==="shape"&&l.points)for(let c of l.points)r(c.x,c.y);else if(l.type==="gaArea")for(let c of l.points)r(c.x,c.y);else if(l.type==="booth"){let c=Ct(l);if(c)for(let f of c)r(f.x,f.y)}else if(l.type==="table"){let c=un(l);if(c)for(let f of c)r(f.x,f.y)}else if(l.type==="decorImage"){let c=ln(l);if(c)for(let f of c)r(f.x,f.y)}return Number.isFinite(e)||(e=-100,i=-100,o=100,a=100),{minX:e,minY:i,maxX:o,maxY:a}}function de(t,n,e,i,o,a){if(n.length===1){let r=Math.max(60,(o.maxX-o.minX+o.maxY-o.minY)*.06),s=_t(o.minX-r,o.minY-r,o.maxX-o.minX+r*2,o.maxY-o.minY+r*2);K(t,s,void 0,()=>0,-.4,a.ground,a.ground,W)}else{let r=n.reduce((h,b)=>b.baseHeightM<h.baseHeightM?b:h);t.setFloor(r.index);let s=e.filter((h,b)=>i[b]===r.index),l=mn([r],s),c=Math.hypot(l.maxX-l.minX,l.maxY-l.minY),f=Math.max(28,Math.min(80,c*.04)),m=_t(l.minX-f,l.minY-f,l.maxX-l.minX+f*2,l.maxY-l.minY+f*2),u=r.baseHeightM-.03;K(t,m,void 0,()=>u,u-.22,a.ground,a.ground,W)}}function ye(t,n,e){let{cx:i,cz:o,radius:a}=e,r=1/0,s=1/0,l=1/0,c=-1/0,f=-1/0,m=-1/0,u=(p,y,d)=>{r=Math.min(r,p),c=Math.max(c,p),s=Math.min(s,y),f=Math.max(f,y),l=Math.min(l,d),m=Math.max(m,d)};for(let p=0;p<t.position.length;p+=3)u(t.position[p],t.position[p+1],t.position[p+2]);for(let p=0;p<n.count;p++){let y=p*3,d=n.iPosition[y],x=n.iPosition[y+1],T=n.iPosition[y+2],S=Math.max(.35,n.iMaxRadius[p]??.35);u(d-S,x,T-S),u(d+S,x+1.6,T+S)}Number.isFinite(r)||(r=i-a,c=i+a,s=0,f=a*.16,l=o-a,m=o+a);let h=[(r+c)/2,(s+f)/2,(l+m)/2],b=Math.max(1,.5*Math.hypot(c-r,f-s,m-l));return{center:h,radius:b,minY:s,maxY:f}}function xe(t,n,e,i,o,a){let r=1/0,s=1/0,l=-1/0,c=-1/0;for(let S=0;S<t.count;S++){let C=S*3,P=t.iPosition[C],A=t.iPosition[C+2];P<r&&(r=P),P>l&&(l=P),A<s&&(s=A),A>c&&(c=A)}for(let S of n)r=Math.min(r,S.cx-S.halfX),l=Math.max(l,S.cx+S.halfX),s=Math.min(s,S.cz-S.halfZ),c=Math.max(c,S.cz+S.halfZ);let f=e.minX*g,m=e.maxX*g,u=e.minY*g,h=e.maxY*g,b=f,p=m,y=u,d=h;if(Number.isFinite(r)){let S=Math.max(2,.06*Math.hypot(l-r,c-s));b=Math.max(f,r-S),p=Math.min(m,l+S),y=Math.max(u,s-S),d=Math.min(h,c+S)}let x=Math.min(0,i),T=Math.max(o,a*.05);return{min:[b,x,y],max:[p,T,d]}}function ge(t,n,e){let i=()=>({byObjectId:new Map,elements:[]});if(!n||!t)return i();let o=bn(n);if(!o.ok||o.value.id!==t)return i();let a=new Map;for(let m of e)for(let u of m.objects)u.type==="shape"&&a.set(u.id,{shape:u,unit:m});let r=new Set,s=new Set,l=new Map((n.overlay.productionElements??[]).map(m=>{let u=m.runtimeContentImageUrl;return[m.id,typeof u=="string"&&/^(?:blob:|data:image\/|https:\/\/)/.test(u)?u:void 0]})),c=[];for(let m of o.value.overlay.productionElements??[]){let u=a.get(m.objectId),h=u?bt(u.shape):null,b=m.baseElevationM??0;if(!u||!h||h.length<3||!m.id||r.has(m.id)||s.has(m.objectId)||!Number.isFinite(m.heightM)||m.heightM<.05||m.heightM>50||!Number.isFinite(b)||b<-10||b>100)return i();r.add(m.id),s.add(m.objectId);let p=h.map(E=>E.x*g),y=h.map(E=>E.y*g),d=u.unit.baseHeightM+b,x=Math.min(...p),T=Math.max(...p),S=Math.min(...y),C=Math.max(...y),P,A=l.get(m.id)??m.contentImageUrl;if(m.kind==="screen"&&A)if(T-x>=C-S){let E=Math.abs(S-u.unit.focal.y*g)<=Math.abs(C-u.unit.focal.y*g)?S-.006:C+.006;P=[[x,d,E],[T,d,E],[x,d+m.heightM,E],[T,d+m.heightM,E]]}else{let E=Math.abs(x-u.unit.focal.x*g)<=Math.abs(T-u.unit.focal.x*g)?x-.006:T+.006;P=[[E,d,S],[E,d,C],[E,d+m.heightM,S],[E,d+m.heightM,C]]}c.push({id:m.id,objectId:m.objectId,kind:m.kind,floorIndex:u.unit.index,baseY:d,topY:d+m.heightM,bounds:{min:[x,d,S],max:[T,d+m.heightM,C]},occlusion:m.occlusion,...A?{contentImageUrl:A}:{},...P?{contentPlane:P}:{}})}let f=c.sort((m,u)=>m.id.localeCompare(u.id));return{byObjectId:new Map(f.map(m=>[m.objectId,m])),elements:f}}function Q(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}function J(t){return Array.isArray(t)?t:[]}function No(t){let n=[t];for(;n.length;){let e=n.pop();if(Array.isArray(e)){n.push(...e);continue}if(!Q(e))continue;let i=Q(e.extensions)?e.extensions:null;if(i&&Object.prototype.hasOwnProperty.call(i,"KHR_draco_mesh_compression"))return!0;n.push(...Object.values(e))}return!1}function Zt(t,n){return!Array.isArray(t)||t.length!==n||!t.every(e=>typeof e=="number"&&Number.isFinite(e))?null:t}function Uo(){return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}function Yo(t,n){let e=new Array(16).fill(0);for(let i=0;i<4;i++)for(let o=0;o<4;o++)for(let a=0;a<4;a++)e[i*4+o]+=t[a*4+o]*n[i*4+a];return e}function jo(t){let n=Zt(t.matrix,16);if(n)return n;if(t.matrix!==void 0)return null;let e=t.translation===void 0?[0,0,0]:Zt(t.translation,3),i=t.rotation===void 0?[0,0,0,1]:Zt(t.rotation,4),o=t.scale===void 0?[1,1,1]:Zt(t.scale,3);if(!e||!i||!o)return null;let[a,r,s,l]=i,c=Math.hypot(a,r,s,l);if(!(c>1e-8))return null;let f=a/c,m=r/c,u=s/c,h=l/c,b=f+f,p=m+m,y=u+u,d=f*b,x=f*p,T=f*y,S=m*p,C=m*y,P=u*y,A=h*b,E=h*p,v=h*y;return[(1-(S+P))*o[0],(x+v)*o[0],(T-E)*o[0],0,(x-v)*o[1],(1-(d+P))*o[1],(C+A)*o[1],0,(T+E)*o[2],(C-A)*o[2],(1-(d+S))*o[2],0,e[0],e[1],e[2],1]}function Ho(t,n,e,i){return[t[0]*n+t[4]*e+t[8]*i+t[12],t[1]*n+t[5]*e+t[9]*i+t[13],t[2]*n+t[6]*e+t[10]*i+t[14]]}function Vo(t){let n=t[0],e=t[4],i=t[8],o=t[1],a=t[5],r=t[9],s=t[2],l=t[6],c=t[10],f=a*c-r*l,m=r*s-o*c,u=o*l-a*s,h=n*f+e*m+i*u;if(Math.abs(h)<1e-12)return null;let b=1/h;return[f*b,m*b,u*b,(i*l-e*c)*b,(n*c-i*s)*b,(e*s-n*l)*b,(e*r-i*a)*b,(i*o-n*r)*b,(n*a-e*o)*b]}function Me(t,n,e,i){let o=t[0]*n+t[1]*e+t[2]*i,a=t[3]*n+t[4]*e+t[5]*i,r=t[6]*n+t[7]*e+t[8]*i,s=Math.hypot(o,a,r)||1;return o/=s,a/=s,r/=s,[o,a,r]}function Wo(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,i=null,o=null;for(;e+8<=t.byteLength;){let a=n.getUint32(e,!0),r=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(r===1313821514&&!i)try{let l=JSON.parse(new TextDecoder().decode(s).replace(/[\u0000 ]+$/g,""));if(!Q(l))return null;i=l}catch{return null}else if(r===5130562&&!o)o=s;else return null;e+=a}return e===t.byteLength&&i&&o?{json:i,bin:o}:null}function zo(t){return t===5120||t===5121?1:t===5122||t===5123?2:t===5125||t===5126?4:0}function Zo(t){return t==="SCALAR"?1:t==="VEC2"?2:t==="VEC3"?3:t==="VEC4"?4:0}function Ko(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 $o(t){let n=t instanceof Uint8Array?t:new Uint8Array(t),e=Wo(n);if(!e)return{ok:!1,issue:"invalid_glb"};let{json:i,bin:o}=e;if(!Q(i.asset)||i.asset.version!=="2.0")return{ok:!1,issue:"unsupported_glb"};let a=J(i.extensionsUsed).filter(S=>typeof S=="string");if(a.includes("KHR_draco_mesh_compression")||No(i))return{ok:!1,issue:"draco_not_allowed"};if(a.length||J(i.extensionsRequired).length)return{ok:!1,issue:"unsupported_glb"};if(J(i.images).length||J(i.textures).length)return{ok:!1,issue:"external_resource"};let r=J(i.buffers);if(r.length!==1||!Q(r[0])||r[0].uri!==void 0||typeof r[0].byteLength!="number"||!Number.isInteger(r[0].byteLength)||r[0].byteLength<0||r[0].byteLength>o.byteLength)return{ok:!1,issue:"external_resource"};let s=J(i.accessors),l=J(i.bufferViews),c=J(i.meshes),f=J(i.nodes),m=J(i.scenes),u=typeof i.scene=="number"?i.scene:0;if(!Q(m[u]))return{ok:!1,issue:"unsupported_glb"};let h=new DataView(o.buffer,o.byteOffset,o.byteLength),b=(S,C,P)=>{if(typeof S!="number"||!Number.isInteger(S)||!Q(s[S]))return null;let A=s[S];if(A.type!==C||A.sparse!==void 0||A.normalized===!0||typeof A.count!="number"||!Number.isInteger(A.count)||A.count<1||typeof A.componentType!="number"||!P.includes(A.componentType)||typeof A.bufferView!="number")return null;let E=l[A.bufferView];if(!Q(E)||E.buffer!==0||typeof E.byteLength!="number"||!Number.isInteger(E.byteLength)||E.byteLength<0)return null;let v=Zo(A.type),G=zo(A.componentType),X=typeof E.byteStride=="number"?E.byteStride:v*G,M=typeof E.byteOffset=="number"?E.byteOffset:0,B=typeof A.byteOffset=="number"?A.byteOffset:0,O=M+B,F=B+(A.count-1)*X+v*G;if(!Number.isInteger(X)||!Number.isInteger(M)||!Number.isInteger(B)||X<v*G||M<0||B<0||M+E.byteLength>o.byteLength||F>E.byteLength)return null;let I=[];for(let k=0;k<A.count;k++){let R=[];for(let _=0;_<v;_++){let w=Ko(h,O+k*X+_*G,A.componentType);if(!Number.isFinite(w))return null;R.push(w)}I.push(R)}return I},p=[],y=[],d=0,x=new Set,T=(S,C)=>{if(typeof S!="number"||!Number.isInteger(S)||!Q(f[S])||x.has(S))return!1;x.add(S);let P=f[S],A=jo(P);if(!A)return!1;let E=Yo(C,A),v=Vo(E);if(!v)return!1;if(P.mesh!==void 0){if(typeof P.mesh!="number")return!1;let G=c[P.mesh];if(!Q(G))return!1;for(let X of J(G.primitives)){if(!Q(X)||X.mode!==void 0&&X.mode!==4||!Q(X.attributes))return!1;let M=b(X.attributes.POSITION,"VEC3",[5126]),B=X.attributes.NORMAL===void 0?null:b(X.attributes.NORMAL,"VEC3",[5126]);if(!M||X.attributes.NORMAL!==void 0&&!B)return!1;let O=M.length;if(X.indices!==void 0){let I=typeof X.indices=="number"?s[X.indices]:null;O=Q(I)?I.count:void 0}if(typeof O!="number"||!Number.isInteger(O)||O%3!==0||(d+=O/3,d>1e5))return!1;let F=X.indices===void 0?M.map((I,k)=>[k]):b(X.indices,"SCALAR",[5121,5123,5125]);if(!F||F.length%3!==0||F.length!==O)return!1;for(let I=0;I<F.length;I+=3){let k=[F[I][0],F[I+1][0],F[I+2][0]];if(k.some(w=>!Number.isInteger(w)||w<0||w>=M.length))return!1;let R=k.map(w=>Ho(E,...M[w])),_=null;if(!B){let w=R[1][0]-R[0][0],D=R[1][1]-R[0][1],N=R[1][2]-R[0][2],U=R[2][0]-R[0][0],L=R[2][1]-R[0][1],Y=R[2][2]-R[0][2];_=Me([1,0,0,0,1,0,0,0,1],D*Y-N*L,N*U-w*Y,w*L-D*U)}for(let w=0;w<3;w++)p.push(...R[w]),y.push(...B?Me(v,...B[k[w]]):_)}}}for(let G of J(P.children))if(!T(G,E))return!1;return x.delete(S),!0};for(let S of J(m[u].nodes))if(!T(S,Uo()))return{ok:!1,issue:d>1e5?"triangle_limit":"unsupported_glb"};return!d||p.length!==d*9||y.length!==p.length?{ok:!1,issue:"unsupported_glb"}:{ok:!0,triangleCount:d,position:new Float32Array(p),normal:new Float32Array(y)}}function Se(t){try{return $o(t)}catch{return{ok:!1,issue:"invalid_glb"}}}function ps(t){let{doc:n}=t,e=Cn(n.theme),i=e.structure,o=zn(n,t.eventConfigurationId??n.eventConfigurationId),a=ge(t.eventConfigurationId,t.eventConfiguration,o),r=t.seats,s=new Yt,l=null;if(t.registeredShellGlb){let F=Se(t.registeredShellGlb);if(F.ok){let I=F.position.length/3,k=new Float32Array(F.position.length),R=e.materials.shell??i.tierWall;for(let _=0;_<I;_++){let w=F.normal[_*3+1],D=w<-.25?.4:.62+.38*Math.max(0,w);k[_*3]=R[0]*D,k[_*3+1]=R[1]*D,k[_*3+2]=R[2]*D}l={position:F.position,normal:F.normal,color:k,floor:new Float32Array(I).fill(-2),material:new Float32Array(I),count:I}}}let c=new Map;for(let F of o)for(let I of F.objects)c.set(I.id,F.index),I.type==="section"&&c.set(I.logicalSectionId??I.id,F.index);let f=r.map(F=>c.get(F.sectionId??"")??c.get(F.rowId??"")??0),m=mn(o,r);de(s,o,r,f,m,i);let u=Jn(n,r),h=new Map,b=new Map;for(let F of n.categories??[])h.set(F.key,F.color),F.seatGlyph&&b.set(F.key,F.seatGlyph);let p=[],y=qn(o,r,f),d=new Float32Array(r.length);for(let F=0;F<o.length;F++){let I=o[F];s.setFloor(F);let k=new zt,R=[],_=I.objects.filter(w=>w.type==="section"&&!!w.outline&&w.outline.length>=3);for(let w of I.objects)if(w.type==="section")ue(s,w,I,Qn(w,u),y.bySection.get(w.id),k,_,i);else if(w.type==="shape"){let D=a.byObjectId.get(w.id);s.setMaterial((D?.kind??w.role)==="screen"?1:0),ie(s,w,I.baseHeightM,te(w,R),i,I.focal,p,D),s.setMaterial(0)}else w.type==="gaArea"?ae(s,w,I.baseHeightM,H(h.get(w.categoryKey)),i):w.type==="booth"?oe(s,w,I.baseHeightM,H(h.get(w.categoryKey)),i):w.type==="table"?re(s,w,I.baseHeightM,H(h.get(w.categoryKey)),i):w.type==="decorImage"&&se(s,w,I.baseHeightM,i);le(s,I,r,y,i,e.materials.shell,!l)}let x=o.length>1?{x:o.reduce((F,I)=>F+I.focal.x,0)/o.length,y:o.reduce((F,I)=>F+I.focal.y,0)/o.length}:n.focalPoint??{x:(m.minX+m.maxX)/2,y:(m.minY+m.maxY)/2},T=Tn(l?[s.build(),l]:[s.build()]),S=En(r,t.initialState,y,d,h,b),C=fe({doc:n,units:o,seats:r,surfaces:y,focal:x}),{labels:P,sections:A,rows:E}=he({doc:n,units:o,seats:r,surfaces:y,seatData:S,hintedSeatFloor:f,zones:C,focal:x}),v=pe({doc:n,units:o,seats:r,surfaces:y,solids:T,hintedSeatFloor:f,seatFloor:d});be(P,v),S.iYaw=Fn(S.iPosition,r.length,F=>r[F].rowId,F=>{let I=o[d[F]]?.focal??x;return[I.x*g,I.y*g]});let G=(m.minX+m.maxX)/2*g,X=(m.minY+m.maxY)/2*g,M=.5*Math.hypot((m.maxX-m.minX)*g,(m.maxY-m.minY)*g)||10,B=ye(T,S,{cx:G,cz:X,radius:M}),O=xe(S,p,m,B.minY,B.maxY,M);return{solids:T,seats:S,bounds:{center:[(O.min[0]+O.max[0])/2,(O.min[1]+O.max[1])/2,(O.min[2]+O.max[2])/2],radius:M,groundY:0,box:O},renderBounds:{center:B.center,radius:B.radius},stateColorLUT:vn(e,Bt),theme:e,seatCount:r.length,focalWorld:[x.x*g,1.5,x.y*g],zones:C,stages:p,productionElements:a.elements,sections:A,rows:E,labels:P,floors:v}}export{Bt as a,Qt as b,rr as c,nn as d,g as e,sr as f,Le as g,ar as h,Vt as i,dr as j,yr as k,Mr as l,Sr as m,Rr as n,Pr as o,Ar as p,Ir as q,wr as r,Tr as s,_r as t,Br as u,ps as v};
|
|
1
|
+
import{a as Pn,c as An,d as In}from"./chunk-N5NRM4NW.js";import{c as bn}from"./chunk-YFV4DSSX.js";import{d as Rn}from"./chunk-BLPBTW6I.js";import{e as gn,k as Mn}from"./chunk-UL5OIGIF.js";import{f as hn,p as xn,r as Xt,s as ft,u as It,x as Sn}from"./chunk-BAWUBGWY.js";import{W as ut,X as lt,ea as Gt,ga as dn,ha as Dt,ja as yn,l as pn,m as Pt,va as qt}from"./chunk-KN7GLEAI.js";import{A as At,d as H,y as nt}from"./chunk-JBOTRSMY.js";import Re from"earcut";import Pe from"polygon-clipping";var g=ut,Ae=.002;function Ie(t,n,e){let i=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]),r=Math.max(i,o,a);if(r<1e-9)return!0;let s=(i+o+a)/2;return 2*Math.sqrt(Math.max(0,s*(s-i)*(s-o)*(s-a)))/r<Ae}var ht=class{constructor(n=16384){this.len=0;this.buf=new Float32Array(n)}push3(n,e,i){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++]=i}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 i=new Float32Array(e);i.set(this.buf.subarray(0,this.len)),this.buf=i}get length(){return this.len}toArray(){return this.buf.slice(0,this.len)}},Yt=class{constructor(){this.pos=new ht;this.nor=new ht;this.col=new ht;this.flr=new ht;this.mat=new ht;this.currentFloor=0;this.currentMaterial=0}setFloor(n){this.currentFloor=n}setMaterial(n){this.currentMaterial=n}tri(n,e,i,o,a,r=a,s=a){Ie(n,e,i)||(this.pos.push3(n[0],n[1],n[2]),this.pos.push3(e[0],e[1],e[2]),this.pos.push3(i[0],i[1],i[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(r[0],r[1],r[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,i,o,a,r,s,l=s,c=s){[...n,...e,...i].every(Number.isFinite)&&(this.pos.push3(n[0],n[1],n[2]),this.pos.push3(e[0],e[1],e[2]),this.pos.push3(i[0],i[1],i[2]),this.nor.push3(o[0],o[1],o[2]),this.nor.push3(a[0],a[1],a[2]),this.nor.push3(r[0],r[1],r[2]),this.col.push3(s[0],s[1],s[2]),this.col.push3(l[0],l[1],l[2]),this.col.push3(c[0],c[1],c[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 we(t,n,e){let i=n[0]-t[0],o=n[1]-t[1],a=n[2]-t[2],r=e[0]-t[0],s=e[1]-t[1],l=e[2]-t[2],c=o*l-a*s,f=a*r-i*l,m=i*s-o*r,u=Math.hypot(c,f,m)||1;return c/=u,f/=u,m/=u,[c,f,m]}function Te(t,n){let e=[...t],i=[];for(let r of t)i.push(r.x,r.y);let o=[];if(n){for(let r of n)if(!(r.length<3)){o.push(e.length);for(let s of r)e.push(s),i.push(s.x,s.y)}}let a=Re(i,o.length?o:void 0,2);return{pts:e,tris:a}}function Jt(t){return ft(t)<0?[...t].reverse():t}var _e=3;function Be(t,n,e,i){let o=i(t),a=i(n),r=i(e),s=(h,b,p,y)=>Math.abs(i({x:(h.x+b.x)/2,y:(h.y+b.y)/2})-(p+y)/2),l=(t.x+n.x+e.x)/3,c=(t.y+n.y+e.y)/3,f=(o+a+r)/3,m=Math.max(s(t,n,o,a),s(n,e,a,r),s(e,t,r,o),Math.abs(i({x:l,y:c})-f)),u=(h,b,p)=>{let y=Math.abs(i({x:(h+l)/2,y:(b+c)/2})-(p+f)/2);y>m&&(m=y)};return u((t.x+n.x)/2,(t.y+n.y)/2,(o+a)/2),u((n.x+e.x)/2,(n.y+e.y)/2,(a+r)/2),u((e.x+t.x)/2,(e.y+t.y)/2,(r+o)/2),m}function wt(t,n,e,i,o){if(o<=0)return Be(t,n,e,i);let a={x:(t.x+n.x)/2,y:(t.y+n.y)/2},r={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(wt(t,a,s,i,o-1),wt(a,n,r,i,o-1),wt(s,r,e,i,o-1),wt(a,r,s,i,o-1))}function Tt(t,n,e,i,o,a,r,s){if(r>0){let u={x:(n.x+e.x)/2,y:(n.y+e.y)/2},h={x:(e.x+i.x)/2,y:(e.y+i.y)/2},b={x:(i.x+n.x)/2,y:(i.y+n.y)/2};Tt(t,n,u,b,o,a,r-1,s),Tt(t,u,e,h,o,a,r-1,s),Tt(t,b,h,i,o,a,r-1,s),Tt(t,u,h,b,o,a,r-1,s);return}let l=[n.x*g,o(n),n.y*g],c=[e.x*g,o(e),e.y*g],f=[i.x*g,o(i),i.y*g];if(s){t.triN(l,c,f,s(n),s(e),s(i),a);return}let m=we(l,c,f);m[1]<0&&(m=[-m[0],-m[1],-m[2]]),t.tri(l,c,f,m,a)}var Fe=8;function wn(t,n,e){if(!Number.isFinite(e))return t;let i=[],o=(a,r,s,l,c)=>{if(c>0){let f={x:(a.x+r.x)/2,y:(a.y+r.y)/2},m=n(f);if(Math.abs(m-(s+l)/2)>e){o(a,f,s,m,c-1),o(f,r,m,l,c-1);return}}i.push(a)};for(let a=0;a<t.length;a++){let r=t[a],s=t[(a+1)%t.length];o(r,s,n(r),n(s),Fe)}return i}function Nt(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 i=[];for(let o=0;o<e.length;o++){let a=i.length?i[i.length-1]:e[(o-1+e.length)%e.length],r=e[o],s=e[(o+1)%e.length],l=s.x-a.x,c=s.y-a.y,f=Math.hypot(l,c);f>n&&Math.abs((r.x-a.x)*c-(r.y-a.y)*l)/f<n||i.push(r)}return i.length>=3?i:e}var Ut=.001*lt*.1;function K(t,n,e,i,o,a,r,s,l=1/0,c){if(!n||n.length<3||(l===void 0&&(l=1/0),Math.abs(ft(n))<1e-4))return;let f=Nt(wn(Nt(Jt(n),Ut),i,l),Ut),m=e?.map(P=>Nt(wn(Nt(Jt(P),Ut),i,l),Ut)).filter(P=>P.length>=3&&Math.abs(ft(P))>=1e-4),{pts:u,tris:h}=Te(f,m),b=[a[0]*s.top,a[1]*s.top,a[2]*s.top],p=[a[0]*s.bottomCap,a[1]*s.bottomCap,a[2]*s.bottomCap],y=[r[0]*s.top,r[1]*s.top,r[2]*s.top],d=[r[0]*s.wallBottom,r[1]*s.wallBottom,r[2]*s.wallBottom],x=0;if(Number.isFinite(l))for(;x<_e;x++){let P=0;for(let A=0;A<h.length;A+=3){let E=wt(u[h[A]],u[h[A+1]],u[h[A+2]],i,x);E>P&&(P=E)}if(P<=l)break}for(let P=0;P<h.length;P+=3){let A=u[h[P]],E=u[h[P+1]],v=u[h[P+2]];Tt(t,A,E,v,i,b,x,c);let G=[A.x*g,o,A.y*g],X=[E.x*g,o,E.y*g],M=[v.x*g,o,v.y*g];t.tri(G,M,X,[0,-1,0],p)}let T=P=>{if(x<=0)return P;let A=1<<x,E=[];for(let v=0;v<P.length;v++){let G=P[v],X=P[(v+1)%P.length];for(let M=0;M<A;M++){let B=M/A;E.push({x:G.x+(X.x-G.x)*B,y:G.y+(X.y-G.y)*B})}}return E},S=pn(f),C=[{ring:T(f),flip:!1}];if(m)for(let P of m)P.length>=3&&C.push({ring:T(P),flip:!0});for(let{ring:P,flip:A}of C)for(let E=0;E<P.length;E++){let v=P[E],G=P[(E+1)%P.length],X=(G.x-v.x)*g,B=(G.y-v.y)*g,O=-X,F=Math.hypot(B,O)||1;B/=F,O/=F;let I=(v.x+G.x)/2-S.x,k=(v.y+G.y)/2-S.y,R=B*I+O*k;A&&(R=-R),R<0&&(B=-B,O=-O);let _=[B,0,O],w=[v.x*g,i(v),v.y*g],D=[G.x*g,i(G),G.y*g],N=[v.x*g,o,v.y*g],U=[G.x*g,o,G.y*g];t.tri(w,D,U,_,y,y,d),t.tri(w,U,N,_,y,d,d)}}function Tn(t){let n=0;for(let l of t)n+=l.count;let e=new Float32Array(n*3),i=new Float32Array(n*3),o=new Float32Array(n*3),a=new Float32Array(n),r=new Float32Array(n),s=0;for(let l of t)e.set(l.position,s*3),i.set(l.normal,s*3),o.set(l.color,s*3),a.set(l.floor,s),r.set(l.material,s),s+=l.count;return{position:e,normal:i,color:o,floor:a,material:r,count:n}}function jt(t,n,e=2.5){if(n<=0||t.length<3)return t;let i=Jt(t),o=i.length,a=[];for(let s=0;s<o;s++){let l=i[s],c=i[(s+1)%o],f=c.x-l.x,m=c.y-l.y,u=Math.hypot(f,m)||1;a.push({x:m/u,y:-f/u})}let r=[];for(let s=0;s<o;s++){let l=i[s],c=a[(s-1+o)%o],f=a[s],m=c.x+f.x,u=c.y+f.y,h=Math.hypot(m,u),b=()=>{r.push([l.x+c.x*n,l.y+c.y*n]),r.push([l.x+f.x*n,l.y+f.y*n])};if(h<1e-9){b();continue}m/=h,u/=h;let p=m*c.x+u*c.y,y=1/Math.max(p,1e-6);if(!Number.isFinite(y)||y>e){b();continue}r.push([l.x+m*n*y,l.y+u*n*y])}if(r.length<3)return t;try{let s=Pe.union([[...r,r[0]]]),l=null,c=-1/0;for(let m of s){let u=Math.abs(ft(m[0].map(([h,b])=>({x:h,y:b}))));u>c&&(c=u,l=m[0])}if(!l)return t;let f=l.map(([m,u])=>({x:m,y:u}));if(f.length>1){let m=f[0],u=f[f.length-1];Math.abs(m.x-u.x)<1e-9&&Math.abs(m.y-u.y)<1e-9&&f.pop()}return f.length>=3?f:t}catch{return t}}function Ht(t,n,e,i,o=28){let a=[];for(let r=0;r<o;r++){let s=r/o*Math.PI*2;a.push({x:t+e*Math.cos(s),y:n+i*Math.sin(s)})}return a}function _t(t,n,e,i){return[{x:t,y:n},{x:t+e,y:n},{x:t+e,y:n+i},{x:t,y:n+i}]}var Bt=["available","held","sold","selected","dimmed"];function Qt(t){let n=Bt.indexOf(t);return n<0?0:n}var _n={available:[.24,.82,.52],held:[.95,.66,.22],sold:[.34,.39,.45],selected:[.24,.74,1],dimmed:[.28,.32,.37]};function rr(t){let n=.2126*t[0]+.7152*t[1]+.0722*t[2],e=.42,i=.62;return[(n+(t[0]-n)*e)*i,(n+(t[1]-n)*e)*i,(n+(t[2]-n)*e)*i]}var tn={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]},nn={top:[.05,.06,.08],bottom:[.1,.12,.15]};function et(t,n){return[Math.min(1,t[0]*n),Math.min(1,t[1]*n),Math.min(1,t[2]*n)]}var V={pedestal:0,pad:1,back:2,arm:3,footrest:4,leg:5,body:10,head:11},Ee=.44,Ce=.15,ve=.3,ke=.24;function Bn(t){return t===void 0||!Number.isFinite(t)||t<=0?ke:Math.min(ve,Math.max(Ce,t*Ee))}var sr=.21,Oe=.05,en=.45,Le=en+Oe,Ge=[{part:V.pedestal,min:[-.3,0,-.3],max:[.3,.36,.3]},{part:V.pad,min:[-1,.36,-.95],max:[1,en,1]},{part:V.back,min:[-1,Le,-1],max:[1,.92,-.72]},{part:V.arm,min:[-1,.44,-.82],max:[-.78,.65,.78]},{part:V.arm,min:[.78,.44,-.82],max:[1,.65,.78]},{part:V.footrest,min:[-.9,.18,.78],max:[.9,.31,1.34]},{part:V.leg,min:[-.82,0,-.7],max:[-.62,.37,-.48]},{part:V.leg,min:[.62,0,-.7],max:[.82,.37,-.48]},{part:V.leg,min:[-.82,0,.48],max:[-.62,.37,.7]},{part:V.leg,min:[.62,0,.48],max:[.82,.37,.7]}],De=[{part:V.body,min:[-.52,.39,-.08],max:[-.08,.55,.82]},{part:V.body,min:[.08,.39,-.08],max:[.52,.55,.82]},{part:V.body,min:[-.47,.05,.58],max:[-.13,.43,.82]},{part:V.body,min:[.13,.05,.58],max:[.47,.43,.82]},{part:V.head,min:[-.16,1.04,-.33],max:[.16,1.1,-.13]}],Xe=[{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 ar(){let t=[],n=[],e=[],i=[],o=(F,I,k)=>{let R=e.length,[_,w,D]=F,N=[w[0]-_[0],w[1]-_[1],w[2]-_[2]],U=[D[0]-_[0],D[1]-_[1],D[2]-_[2]],L=N[1]*U[2]-N[2]*U[1],Y=N[2]*U[0]-N[0]*U[2],j=N[0]*U[1]-N[1]*U[0],$=Math.hypot(L,Y,j);$>1e-9?(L/=$,Y/=$,j/=$):[L,Y,j]=I,L*I[0]+Y*I[1]+j*I[2]<0&&(L=-L,Y=-Y,j=-j);for(let z of F)t.push(...z),n.push(L,Y,j),e.push(k);i.push(R,R+1,R+2,R,R+2,R+3)},a=F=>{for(let I of Xe){let k=I.c.map(R=>R.map((_,w)=>_?F.max[w]:F.min[w]));o(k,I.n,F.part)}};for(let F of Ge)a(F);for(let F of De)a(F);let r=en,s=1.08,l=.47,c=.69,f=-.55,m=.08,u=-.48,h=.01,b=[-l,r,f],p=[l,r,f],y=[-l,r,m],d=[l,r,m],x=[-c,s,u],T=[c,s,u],S=[-c,s,h],C=[c,s,h];o([p,T,C,d],[1,0,0],V.body),o([y,S,x,b],[-1,0,0],V.body),o([S,C,T,x],[0,1,0],V.body),o([b,p,d,y],[0,-1,0],V.body),o([d,C,S,y],[0,0,1],V.body),o([b,x,T,p],[0,0,-1],V.body);let P=10,A=8,E=[0,1.205,-.23],v=[.42,.115,.38],G=e.length;for(let F=0;F<=A;F++){let I=Math.PI*F/A,k=Math.cos(I),R=Math.sin(I);for(let _=0;_<=P;_++){let w=Math.PI*2*_/P,D=R*Math.cos(w),N=R*Math.sin(w);t.push(E[0]+v[0]*D,E[1]+v[1]*k,E[2]+v[2]*N);let U=D/v[0],L=k/v[1],Y=N/v[2],j=Math.hypot(U,L,Y)||1;U/=j,L/=j,Y/=j,n.push(U,L,Y),e.push(V.head)}}for(let F=0;F<A;F++)for(let I=0;I<P;I++){let k=G+F*(P+1)+I,R=k+P+1;i.push(k,R,k+1,k+1,R,R+1)}let X=new Float32Array(t),M=new Float32Array(n),B=new Float32Array(e),O=new Uint16Array(i);return{position:X,normal:M,part:B,index:O,vertexCount:e.length,indexCount:i.length}}function Fn(t,n,e,i){let o=new Float32Array(n),a=c=>t[c*3],r=c=>t[c*3+2],s=0,l=(c,f)=>{let m=f-c;for(let u=c;u<f;u++){let[h,b]=i(u),p=h-a(u),y=b-r(u);if(m>=2){let d=Math.max(c,u-1),x=Math.min(f-1,u+1),T=a(x)-a(d),S=r(x)-r(d),C=Math.hypot(T,S);if(C>1e-6){let P=-S/C,A=T/C;P*p+A*y<0&&(P=-P,A=-A),p=P,y=A}}o[u]=p===0&&y===0?0:Math.atan2(p,y)}};for(let c=1;c<=n;c++)(c===n||e(c)!==e(s))&&(l(s,c),s=c);return o}var Vt=.22;function dr(t,n){let e=Bt[t];if(e!=="sold"&&e!=="held")return-1;let i=(n+1)*2654435761;return i^=i>>>15,i=Math.imul(i,2246822519),i^=i>>>13,(i>>>0)%1e5/1e5}var Ne=.42;function Ue(t){let n=t.length,e=new Float64Array(n);if(n<2)return e.fill(1/0),e;let i=1/0,o=1/0,a=-1/0,r=-1/0;for(let b of t)b.x<i&&(i=b.x),b.y<o&&(o=b.y),b.x>a&&(a=b.x),b.y>r&&(r=b.y);let s=Math.max(a-i,1e-6),l=Math.max(r-o,1e-6),c=Math.max(Math.sqrt(s*l/n),1e-6),f=Math.max(1,Math.ceil(s/c)+1),m=Math.max(1,Math.ceil(l/c)+1),u=new Map,h=(b,p)=>{let y=Math.min(f-1,Math.max(0,Math.floor((b-i)/c)));return Math.min(m-1,Math.max(0,Math.floor((p-o)/c)))*f+y};for(let b=0;b<n;b++){let p=h(t[b].x,t[b].y),y=u.get(p);y?y.push(b):u.set(p,[b])}for(let b=0;b<n;b++){let p=t[b],y=Math.min(f-1,Math.max(0,Math.floor((p.x-i)/c))),d=Math.min(m-1,Math.max(0,Math.floor((p.y-o)/c))),x=1/0;for(let T=1;T<=4;T++){for(let S=d-T;S<=d+T;S++)if(!(S<0||S>=m))for(let C=y-T;C<=y+T;C++){if(C<0||C>=f||T>1&&Math.abs(S-d)<T&&Math.abs(C-y)<T)continue;let P=u.get(S*f+C);if(P)for(let A of P){if(A===b)continue;let E=Math.hypot(t[A].x-p.x,t[A].y-p.y);E<x&&(x=E)}}if(Number.isFinite(x)&&x<=T*c)break}e[b]=x}return e}function Ye(t){let n=t.eyeHeightM;return Number.isFinite(n)?Math.max(0,n-Gt):0}function En(t,n,e,i,o,a){let r=t.length,s=new Float32Array(r*3),l=new Float32Array(r),c=new Float32Array(r*3),f=new Float32Array(r),m=new Float32Array(r),u=new Float32Array(r),h=new Float32Array(r),b=new Float32Array(r*3),p=new Map,y=Ue(t);for(let d=0;d<r;d++){let x=t[d],S=(e?.seatPitchU(d)??y[d])*g;f[d]=Number.isFinite(S)?Math.max(.06,Math.min(Vt,S*Ne)):Vt,m[d]=Bn(Number.isFinite(S)?S:void 0);let C=Mn(x.glyph,{seatGlyph:a?.get(x.categoryKey)});u[d]=gn.indexOf(C),h[d]=x.wheelchairSpaceType==="no-seat"?0:1,s[d*3]=x.x*g,s[d*3+1]=e?e.seatDeckY(d):Ye(x),s[d*3+2]=x.y*g,l[d]=Qt(n?n(x):"available");let P=H(o?.get(x.categoryKey)??"#6e7bff")??[.43,.48,1];if(c[d*3]=P[0],c[d*3+1]=P[1],c[d*3+2]=P[2],x.accessibility?.length){let A=H(hn(x.accessibility));A&&(b[d*3]=A[0],b[d*3+1]=A[1],b[d*3+2]=A[2])}p.set(x.id,d)}return{count:r,iPosition:s,iState:l,iCategory:c,iMaxRadius:f,iRing:b,idToIndex:p,iChairWidth:m,iGlyph:u,iPhysicalSeat:h,iFloor:i??new Float32Array(r),iYaw:new Float32Array(r)}}var je=64;function yr(t,n){let e=[];for(let r of n){let s=t.idToIndex.get(r.seatId);if(s===void 0)continue;let l=Qt(r.state);t.iState[s]!==l&&(t.iState[s]=l,e.push(s))}if(!e.length)return[];e.sort((r,s)=>r-s);let i=[],o=e[0],a=e[0];for(let r=1;r<e.length;r++){let s=e[r];if(s!==a){if(s<=a+je){a=s;continue}i.push({start:o,length:a-o+1}),o=s,a=s}}return i.push({start:o,length:a-o+1}),i}function Mr(t,n,e){return e<0?n>1?t.filter(i=>i.kind==="floor"):[...t]:t.filter(i=>i.floorIndex===void 0||i.floorIndex===e)}function Sr(t,n){let e=[...t].sort((o,a)=>o.screen.y-a.screen.y),i=[];for(let o of e){let a=i.find(r=>r.some(s=>Math.abs(s.screen.x-o.screen.x)<104&&Math.abs(s.screen.y-o.screen.y)<34));a?a.push(o):i.push([o])}return i.flatMap(o=>o.length<2?o:o.map((a,r)=>({...a,screen:{...a.screen,x:Math.max(54,Math.min(n-54,a.screen.x+(r-(o.length-1)/2)*104))}})))}var He=1.15,Ve=2.75,We=4.5,ze=.85,Ze=.5,Ke=.26;function Rr(t,n,e){let i=Math.max(1e-6,n),o=t/i,a=e?.hasZoneLabels??!0,r=new Set;return o>=.75&&r.add("floor"),o>=He&&r.add("zone"),o<=(a?Ve:We)&&(r.add("section"),r.add("ga")),o<=ze&&(r.add("annotation"),r.add("booth")),o<=Ze&&r.add("row"),o<=Ke&&r.add("seat"),r}function Pr(t,n,e,i,o,a=6){let r=a+n,s=i-a-n,l=a+e,c=o-a-e;return{...t,x:r>s?i/2:Math.max(r,Math.min(s,t.x)),y:l>c?o/2:Math.max(l,Math.min(c,t.y))}}function Ar(t,n,e,i){let o=t,a=n[0],r=n[1],s=n[2],l=o[0]*a+o[4]*r+o[8]*s+o[12],c=o[1]*a+o[5]*r+o[9]*s+o[13],f=o[2]*a+o[6]*r+o[10]*s+o[14],m=o[3]*a+o[7]*r+o[11]*s+o[15];if(!(m>1e-6))return{x:0,y:0,depth:1/0,visible:!1};let u=l/m,h=c/m,b=f/m,p=u>=-1.05&&u<=1.05&&h>=-1.05&&h<=1.05&&b<=1;return{x:(u*.5+.5)*e,y:(1-(h*.5+.5))*i,depth:b,visible:p}}function Ir(t,n,e=n){let i=[],o=[...t].sort((a,r)=>a.screen.depth-r.screen.depth);for(let a of o){let r=!1;for(let s of i)if(on(a,s,n,e)){r=!0;break}r||i.push(a)}return i}var $e=6;function on(t,n,e,i){let o=Math.abs(t.screen.x-n.screen.x),a=Math.abs(t.screen.y-n.screen.y),r=t.halfWidth!=null&&n.halfWidth!=null?Math.max(e,t.halfWidth+n.halfWidth+$e):e;return o<r&&a<i}function wr(t,n,e){return t.length*n*.58+(e?14:0)}var qe={row:8,seat:14};function Tr(t){return t<480?{row:5,seat:8}:t<768?{row:6,seat:10}:qe}function _r(t,n,e,i){let o=Math.max(1,Math.min(e,i)*.5),a=Math.min(2,Math.hypot(t.x-e/2,t.y-i/2)/o);return n*(1+1.5*a)}function Br(t,n,e,i,o=[]){let a=[...t].sort((s,l)=>(l.priority??0)-(s.priority??0)||s.focus-l.focus),r=[];for(let s of a){if(r.length>=i)break;let l=!1;for(let c of o)if(on(s,c,n,e)){l=!0;break}if(!l){for(let c of r)if(on(s,c,n,e)){l=!0;break}}l||r.push(s)}return r}var Je=.15,Qe=.9,to=1.76;function no(){return{background:{top:[...nn.top],bottom:[...nn.bottom]},structure:tn,seatStates:{..._n},seatScale:1,materials:{seat:null,shell:null,roughness:.78}}}function Cn(t){let n=no();if(!t)return n;let e=H(t.background);if(e){n.background={top:et(e,Qe),bottom:et(e,to)};let r={};for(let[s,l]of Object.entries(tn))r[s]=nt(l,e,Je);n.structure=r}let i=H(t.selectionColor)??H(t.accent);i&&(n.seatStates={...n.seatStates,selected:i});let o=t.seatScale;typeof o=="number"&&Number.isFinite(o)&&(n.seatScale=Sn(o));let a=t.venue3d;if(a){let r=H(a.deck),s=H(a.fascia);r&&(n.structure={...n.structure,tierTop:r,gaTop:r}),s&&(n.structure={...n.structure,tierWall:s,gaWall:s}),n.materials.seat=H(a.seat),n.materials.shell=H(a.shell),typeof a.roughness=="number"&&Number.isFinite(a.roughness)&&(n.materials.roughness=Math.min(1,Math.max(0,a.roughness)))}return n}function vn(t,n){let e=[];for(let i of n)e.push(...t.seatStates[i]);return e}import Gn from"polygon-clipping";import eo from"earcut";var oo=.58,kn=.01,ot=Vt*1.5*lt,ro=.5,io=.6;function so(t,n){let e=t.length,i=[];for(let r=0;r<e;r++){let s=t[Math.max(0,r-1)],l=t[Math.min(e-1,r+1)],c=l.x-s.x,f=l.y-s.y,m=Math.hypot(c,f);if(m<1e-9){i.push([0,0]);continue}c/=m,f/=m,i.push([-f,c])}let o=0;for(let r=0;r<e;r++)o+=(t[r].x-n.x)*i[r][0]+(t[r].y-n.y)*i[r][1];return o<0?i.map(([r,s])=>[-r,-s]):i}function ao(t,n){if(t.length<2||n<=0)return[...t];let e=[...t],i=(r,s)=>{let l=s.x-r.x,c=s.y-r.y,f=Math.hypot(l,c)||1;return{x:l/f,y:c/f}},o=i(e[1],e[0]),a=i(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 On=Math.PI/12;function co(t){if(t.length<3)return[...t];let n=[...t].sort((a,r)=>a.x-r.x||a.y-r.y),e=(a,r,s)=>(r.x-a.x)*(s.y-a.y)-(r.y-a.y)*(s.x-a.x),i=a=>{let r=[];for(let s of a){for(;r.length>=2&&e(r[r.length-2],r[r.length-1],s)<=0;)r.pop();r.push(s)}return r.pop(),r},o=[...i(n),...i([...n].reverse())];return o.length>=3?o:[...t]}function Dn(t,n){if(!t.length||!(n>0))return[];let e=co(t),i=(s,l,c,f)=>{let m=c-l;for(;m<0;)m+=Math.PI*2;for(;m>Math.PI*2;)m-=Math.PI*2;let u=Math.max(1,Math.ceil(m/On)),h=n/Math.cos(m/u/2);for(let b=0;b<=u;b++){let p=l+m*b/u;f.push({x:s.x+Math.cos(p)*h,y:s.y+Math.sin(p)*h})}};if(e.length<3){let s=0,l=0;for(let h of e)s+=h.x,l+=h.y;s/=e.length||1,l/=e.length||1;let c=0;for(let h of e)c=Math.max(c,Math.hypot(h.x-s,h.y-l));let f=[],m=Math.max(3,Math.ceil(Math.PI*2/On)),u=(c+n)/Math.cos(Math.PI/m);for(let h=0;h<m;h++){let b=h/m*Math.PI*2;f.push({x:s+Math.cos(b)*u,y:l+Math.sin(b)*u})}return f}let o=e.length,a=[];for(let s=0;s<o;s++){let l=e[s],c=e[(s+1)%o];a.push(Math.atan2(-(c.x-l.x),c.y-l.y))}let r=[];for(let s=0;s<o;s++)i(e[s],a[(s+o-1)%o],a[s],r);return jn(r)}function uo(t,n,e){if(t.length===1)return Math.hypot(n-t[0].x,e-t[0].y);let i=1/0;for(let o=0;o+1<t.length;o++){let a=t[o],r=t[o+1],s=r.x-a.x,l=r.y-a.y,c=s*s+l*l,f=c>1e-12?((n-a.x)*s+(e-a.y)*l)/c:0;f<0?f=0:f>1&&(f=1);let m=Math.hypot(n-(a.x+f*s),e-(a.y+f*l));m<i&&(i=m)}return i}function Wt(t){let n=t.map(o=>{let a=0,r=0;for(let c of o.pts)a+=c.x,r+=c.y;let s=o.pts.length||1;a/=s,r/=s;let l=0;for(let c of o.pts){let f=Math.hypot(c.x-a,c.y-r);f>l&&(l=f)}return{cx:a,cy:r,rad:l}}),e=o=>{let a=o.length;return a<=2?[...o]:[o[Math.floor(a*.25)],o[Math.floor(a*.5)],o[Math.floor(a*.75)]]},i=[];for(let o=0;o<t.length;o++){let a=e(t[o].pts),r=[],s=1/0,l=null;for(let f of a){let m=1/0;for(let u=0;u<t.length;u++){if(u===o||Math.abs(t[u].y-t[o].y)<.001)continue;let h=n[u],b=Math.hypot(f.x-h.cx,f.y-h.cy)-h.rad;if(b>=m&&b>=s)continue;let p=uo(t[u].pts,f.x,f.y);p<m&&(m=p),t[u].depth<t[o].depth&&p<s&&(s=p,l=t[u].y)}Number.isFinite(m)&&m>0&&r.push(m)}r.sort((f,m)=>f-m);let c=r.length?r[Math.floor(r.length/2)]:1;i.push({pitch:c,belowY:l})}return i}function Xn(t,n,e,i){let o=t[n],a=o.pts.length>=2?[...o.pts]:o.pts.length===1?(()=>{let f=o.pts[0],m=f.x-i.x,u=f.y-i.y,h=Math.hypot(m,u)||1;m/=h,u/=h;let b=Math.max(e[n].pitch,.001)*.5;return[{x:f.x+u*b,y:f.y-m*b},{x:f.x-u*b,y:f.y+m*b}]})():[];if(a.length<2)return null;let r=0,s=0;for(let f=1;f<a.length;f++){let m=Math.hypot(a[f].x-a[f-1].x,a[f].y-a[f-1].y);m>1e-6&&(r+=m,s++)}let l=s>0?r/s:0,c=ao(a,Math.max(l*io,ot));return{pts:c,nrm:so(c,i),front:Math.max(e[n].pitch*oo,ot),back:Math.max(e[n].pitch*ro,ot)}}var gt=1.5,Nn=.3;function rn(t,n){if(t.length<3)return t;let e=t[0],i=t[t.length-1],o=i.x-e.x,a=i.y-e.y,r=Math.hypot(o,a),s=-1,l=-1;for(let m=1;m<t.length-1;m++){let u=t[m],h=r>1e-12?Math.abs((u.x-e.x)*a-(u.y-e.y)*o)/r:Math.hypot(u.x-e.x,u.y-e.y);h>s&&(s=h,l=m)}if(s<=n||l<0)return[e,i];let c=rn(t.slice(0,l+1),n),f=rn(t.slice(l),n);return[...c.slice(0,-1),...f]}function Un(t,n){if(t.length<4)return t;let e=rn([...t,t[0]],n);return e.pop(),e.length>=3?e:t}function Yn(t,n,e){if(t.length<2)return[];let i=e??Wt(t),o=new Map;for(let r=0;r<t.length;r++){let s=o.get(t[r].blockId);s?s.push(r):o.set(t[r].blockId,[r])}let a=[];for(let[,r]of o){let s=[];for(let x of r){let T=t[x].patch;T&&T.length>=3?a.push({outline:[...T],holes:[],topY:t[x].y}):s.push(x)}if(!s.length)continue;s.sort((x,T)=>t[x].depth-t[T].depth);let c=s.map(x=>Xn(t,x,i,n)).filter(x=>x!==null);if(!c.length)continue;let f=(x,T)=>({x:x.pts[T].x-x.nrm[T][0]*(x.front+gt),y:x.pts[T].y-x.nrm[T][1]*(x.front+gt)}),m=(x,T)=>({x:x.pts[T].x+x.nrm[T][0]*(x.back+gt),y:x.pts[T].y+x.nrm[T][1]*(x.back+gt)}),u=c[0],h=c[c.length-1],b=[];for(let x=0;x<u.pts.length;x++)b.push(f(u,x));for(let x of c)b.push(m(x,x.pts.length-1));for(let x=h.pts.length-1;x>=0;x--)b.push(m(h,x));for(let x=c.length-1;x>=0;x--)b.push(f(c[x],0));let p=jn(b),y=1/0;for(let x of s)t[x].y<y&&(y=t[x].y);if(!Number.isFinite(y))continue;if(p.length>=3&&Math.abs(ft(p))>1e-6&&c.every(x=>{let T=x.pts[Math.floor(x.pts.length/2)];return It(p,T.x,T.y)})){a.push({outline:Un(p,Nn),holes:[],topY:y});continue}for(let x of lo(c))a.push({outline:x,holes:[],topY:y})}return a}function lo(t){let n=[];for(let e of t){let i=[],o=[],a=e.front+gt,r=e.back+gt;for(let l=0;l<e.pts.length;l++){let c=e.pts[l],f=e.nrm[l];i.push([c.x-f[0]*a,c.y-f[1]*a]),o.push([c.x+f[0]*r,c.y+f[1]*r])}let s=[...i,...o.reverse()];s.length<3||(s.push(s[0]),n.push([s]))}if(!n.length)return[];try{let e=Gn.union(n[0],...n.slice(1)),i=[];for(let o of e){if(!o.length||o[0].length<4)continue;let a=o[0].map(([l,c])=>({x:l,y:c})),r=a[0],s=a[a.length-1];a.length>1&&Math.abs(r.x-s.x)<1e-9&&Math.abs(r.y-s.y)<1e-9&&a.pop(),a.length>=3&&i.push(Un(a,Nn))}return i}catch{return[]}}function jn(t){let n=[];for(let e of t){let i=n[n.length-1];i&&Math.hypot(e.x-i.x,e.y-i.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 sn=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 i of e)i.x<this.minX&&(this.minX=i.x),i.y<this.minY&&(this.minY=i.y),i.x>this.maxX&&(this.maxX=i.x),i.y>this.maxY&&(this.maxY=i.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 i=!0;for(let o of n)if(!It(e,o.x,o.y)){i=!1;break}if(i)return!0}return!1}};function Ln(t,n,e,i,o,a){if(i.length<3)return;if(e.containsAll(i)){let c=[0,1,0],f=i[0];for(let m=1;m+1<i.length;m++){let u=i[m],h=i[m+1];t.tri([f.x*g,o,f.y*g],[u.x*g,o,u.y*g],[h.x*g,o,h.y*g],c,a)}return}let r=i.map(c=>[c.x,c.y]);r.push(r[0]);let s;try{s=Gn.intersection([r],n)}catch{return}let l=[0,1,0];for(let c of s){if(!c.length||c[0].length<4)continue;let f=c[0],m=[],u=[];for(let b=0;b<f.length-1;b++)m.push(f[b][0],f[b][1]),u.push([f[b][0],f[b][1]]);if(u.length<3)continue;let h=eo(m,void 0,2);for(let b=0;b<h.length;b+=3){let p=u[h[b]],y=u[h[b+1]],d=u[h[b+2]];t.tri([p[0]*g,o,p[1]*g],[y[0]*g,o,y[1]*g],[d[0]*g,o,d[1]*g],l,a)}}}function Hn(t,n,e,i,o,a,r){if(n.length<2)return;let s=r??Wt(n),l=[0,1,0],c=a&&a.length>=3?[[...a.map(h=>[h.x,h.y]),[a[0].x,a[0].y]]]:null,f=a&&a.length>=3?new sn([[...a]]):null,m=h=>{t.setMaterial(2),h(),t.setMaterial(0)},u=h=>{t.setMaterial(3),h(),t.setMaterial(0)};for(let h=0;h<n.length;h++){let b=n[h];if(b.patch&&b.patch.length>=3){let C=[...b.patch],P=s[h].belowY??i;if(u(()=>{if(c&&f)Ln(t,c,f,C,b.y,o.tread);else{let A=C[0];for(let E=1;E+1<C.length;E++){let v=C[E],G=C[E+1];t.tri([A.x*g,b.y,A.y*g],[v.x*g,b.y,v.y*g],[G.x*g,b.y,G.y*g],l,o.tread)}}}),b.y>P+kn){let A=0,E=0;for(let v of C)A+=v.x,E+=v.y;A/=C.length,E/=C.length,m(()=>{for(let v=0;v<C.length;v++){let G=C[v],X=C[(v+1)%C.length],M=X.x-G.x,B=X.y-G.y,O=Math.hypot(M,B);if(O<1e-6)continue;let F=B/O,I=-M/O;(G.x-A)*F+(G.y-E)*I<0&&(F=-F,I=-I);let k=[F,0,I],R=[G.x*g,b.y,G.y*g],_=[X.x*g,b.y,X.y*g],w=[G.x*g,P,G.y*g],D=[X.x*g,P,X.y*g];t.tri(R,_,D,k,o.riser),t.tri(R,D,w,k,o.riser)}})}continue}let p=Xn(n,h,s,e);if(!p)continue;let{pts:y,nrm:d,front:x,back:T}=p,S=s[h].belowY??i;for(let C=0;C+1<y.length;C++){let P=y[C],A=y[C+1],E=d[C],v=d[C+1];if(Math.hypot(A.x-P.x,A.y-P.y)<1e-6||E[0]===0&&E[1]===0||v[0]===0&&v[1]===0)continue;let G=[(P.x-E[0]*x)*g,b.y,(P.y-E[1]*x)*g],X=[(A.x-v[0]*x)*g,b.y,(A.y-v[1]*x)*g],M=[(P.x+E[0]*T)*g,b.y,(P.y+E[1]*T)*g],B=[(A.x+v[0]*T)*g,b.y,(A.y+v[1]*T)*g];if(u(()=>{c&&f?Ln(t,c,f,[{x:P.x-E[0]*x,y:P.y-E[1]*x},{x:A.x-v[0]*x,y:A.y-v[1]*x},{x:A.x+v[0]*T,y:A.y+v[1]*T},{x:P.x+E[0]*T,y:P.y+E[1]*T}],b.y,o.tread):(t.tri(G,X,B,l,o.tread),t.tri(G,B,M,l,o.tread))}),b.y>S+kn){let O=[G[0],S,G[2]],F=[X[0],S,X[2]],I=[-E[0],0,-E[1]];m(()=>{t.tri(G,X,F,I,o.riser),t.tri(G,F,O,I,o.riser)})}}}}import Wn from"polygon-clipping";function mo(t,n){let e=t.eventConfigurationIds;return!e?.length||!!n&&e.includes(n)}function Vn(t,n){return t.filter(e=>e.type!=="shape"||mo(e,n))}function zn(t,n){let e=t.focalPoint??{x:0,y:0};return t.floors?.length?t.floors.map((i,o)=>({objects:Vn(i.objects,n),focal:{x:(i.focalPoint??e).x,y:(i.focalPoint??e).y},baseHeightM:i.baseHeightM??0,index:o})):[{objects:Vn(t.objects,n),focal:e,baseHeightM:0,index:0}]}var fo={minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};function Mt(t){return xn(t)??fo}function Zn(t,n){let e=jt(t.outline,ot),i=Mt(e),o=n.filter(r=>r!==t&&r.outline&&r.outline.length>=3&&Xt(i,Mt(r.outline)));if(!o.length)return[e];let a=r=>{let s=r.map(l=>[l.x,l.y]);return s.push(s[0]),s};try{let r=Wn.difference([a(e)],...o.map(l=>[a(l.outline)])),s=[];for(let l of r){if(!l.length)continue;let c=l[0].map(([f,m])=>({x:f,y:m}));if(c.length>1){let f=c[0],m=c[c.length-1];Math.abs(f.x-m.x)<1e-9&&Math.abs(f.y-m.y)<1e-9&&c.pop()}c.length>=3&&s.push(c)}return s.length?s:[e]}catch{return[e]}}function Kn(t,n){if(!n.length)return t;let e=a=>{let r=a.map(s=>[s.x,s.y]);return r.push(r[0]),r},i=n.map(a=>[e(a)]),o=[];for(let a of t){let r;try{r=Wn.intersection([e(a.outline)],i.flat())}catch{o.push(a);continue}for(let s of r){if(!s.length)continue;let l=s[0].map(([c,f])=>({x:c,y:f}));if(l.length>1){let c=l[0],f=l[l.length-1];Math.abs(c.x-f.x)<1e-9&&Math.abs(c.y-f.y)<1e-9&&l.pop()}l.length>=3&&o.push({outline:l,holes:[],topY:a.topY})}}return o.length?o:t}var ho=.05,$n=.05,bo=.15,an=25;function qn(t,n,e){let i=new Map,o=new Array(n.length).fill(null),a=new Float64Array(n.length),r=new Array(n.length).fill(void 0),s=new Array(n.length).fill(void 0),l=new Map,c=[],f=new Set;for(let u=0;u<t.length;u+=1){let h=t[u];for(let b of h.objects){if(b.type==="table"&&f.add(b.id),b.type!=="section"||!b.outline||b.outline.length<3)continue;let p=jt(b.outline,ot);l.set(b.id,{section:b,unit:h,frontU:1/0,hasSeats:!1,rows:new Map,seatIndices:[]}),c.push({id:b.id,floorIndex:u,box:Mt(p),section:b,unit:h,outline:p})}}let m=new Map;for(let u of c){let h=m.get(u.floorIndex);h?h.push(u):m.set(u.floorIndex,[u])}for(let u=0;u<n.length;u++){let h=n[u],b=e?m.get(e[u])??[]:c,p=h.sectionId?b.find(d=>d.id===h.sectionId)??b.find(d=>d.section.logicalSectionId===h.sectionId&&qt({x:h.x,y:h.y},d.outline,d.section.holes)):void 0,y=p?[p]:b;for(let d of y){if(e&&d.floorIndex!==e[u]||!p&&(h.x<d.box.minX||h.x>d.box.maxX||h.y<d.box.minY||h.y>d.box.maxY||!qt({x:h.x,y:h.y},d.outline,d.section.holes)))continue;o[u]=d.id;let x=l.get(d.id);x.hasSeats=!0;let T=h.focalPoint??d.unit.focal,S=Math.hypot(h.x-T.x,h.y-T.y);S<x.frontU&&(x.frontU=S),x.seatIndices.push(u);let C=h.rowId||`__seat-${u}`,P=x.rows.get(C);P?P.push({x:h.x,y:h.y}):x.rows.set(C,[{x:h.x,y:h.y}]);break}}for(let[u,h]of l){let b=dn(h.section,{floorBaseHeightM:h.unit.baseHeightM}),p=h.unit.baseHeightM,y=b.rake>0?Math.tan(b.rake*Math.PI/180):0,d=b.rake<=.01&&b.height<=p+.001,x=h.section.surfaceKind,T=x==="flat"?!0:x==="rakedRows"&&b.rake>.01?!1:d,S=h.hasSeats?yn(u,n,h.seatIndices,h.unit.focal):{sectionId:u,rows:[],blockCount:0},P=S.rows.length<2?Pn([...h.rows.values()].map(R=>({points:R})),h.unit.focal):null,A=1/0;if(P){if(h.hasSeats)for(let R of h.rows.values())for(let _ of R){let w=P.depthAt(_.x,_.y);w<A&&(A=w)}if(!h.hasSeats||!Number.isFinite(A)){A=1/0;for(let R of h.section.outline){let _=P.depthAt(R.x,R.y);_<A&&(A=_)}}}let E=p+ho,v=Math.max(E,b.height),G=R=>{let _=Math.max(0,R-A)*ut,w=Math.min(_*y,an);return Math.max(E,b.height+w)},X=R=>{let _=Math.max(0,R)*ut,w=Math.min(_*y,an);return Math.max(E,b.height+w)},M=T?[]:S.rows.map(R=>({pts:R.pts,y:X(R.blockDepth),depth:R.blockDepth,blockId:R.blockId,...f.has(R.id)?{patch:Dn(R.pts,ot)}:{}})),B=M.length?M[0].y:v,O=M.map(R=>{let _=R.patch&&R.patch.length>=3?R.patch:R.pts,w=0,D=0;for(let L of _)w+=L.x,D+=L.y;let N=_.length||1;w/=N,D/=N;let U=0;for(let L of _){let Y=Math.hypot(L.x-w,L.y-D);Y>U&&(U=Y)}return{cx:w,cy:D,rad:U}}),F=T?()=>v:M.length>=2?(R,_)=>{let w=1/0,D=B;for(let N=0;N<M.length;N++){let U=O[N];if(Math.hypot(R-U.cx,_-U.cy)-U.rad>=w)continue;let L=M[N].patch,Y=L&&L.length>=3?It(L,R,_)?0:Dt(L,R,_):Dt(M[N].pts,R,_);Y<w&&(w=Y,D=M[N].y)}return D}:(R,_)=>P?G(P.depthAt(R,_)):v,I=[0,1,0],k=M.length>=2||T?()=>I:(R,_)=>{if(!P)return I;let w=P.depthAt(R,_);if(w<=A)return I;let D=(w-A)*ut;if(D*y>=an||b.height+D*y<=E)return I;let[N,U]=P.gradientAt(R,_);if(N===0&&U===0)return I;let L=1/Math.hypot(y,1);return[-N*y*L,L,-U*y*L]};if(!T)for(let R of S.rows){let _=X(R.blockDepth);for(let w of R.seatIndices)r[w]=_}for(let R of S.rows){let _=[];for(let L=1;L<R.pts.length;L++){let Y=Math.hypot(R.pts[L].x-R.pts[L-1].x,R.pts[L].y-R.pts[L-1].y);Y>1e-6&&_.push(Y)}_.sort((L,Y)=>L-Y);let w=_.length?_[Math.floor(_.length/2)]:1/0,D=1/0,N=R.pts[Math.floor(R.pts.length/2)];if(N)for(let L of S.rows){if(L===R||L.blockId!==R.blockId)continue;let Y=Dt(L.pts,N.x,N.y);Y>1e-6&&Y<D&&(D=Y)}let U=Math.min(w,Math.max(D,w*.5));if(Number.isFinite(U)&&U>0)for(let L of R.seatIndices)s[L]=U}i.set(u,{sectionId:u,deckAt:F,normalAt:k,flat:T,bottomY:p,rowLevels:M,landingY:B})}for(let u=0;u<n.length;u++){let h=o[u],b=n[u];if(h){let y=r[u];a[u]=(y??i.get(h).deckAt(b.x,b.y))+bo;continue}let p=b.eyeHeightM;a[u]=Number.isFinite(p)?Math.max(0,p-Gt):0}return{bySection:i,seatOwner:o,seatDeckY:u=>a[u],seatPitchU:u=>s[u]}}var W={top:1,wallBottom:.5,bottomCap:.4};function st(t,n){if(!t)return n;let e=et(At(t,.4),.62);return nt(n,e,.72)}function Jn(t,n){let e=new Map;for(let a of t.categories??[])e.set(a.key,a.color);let i=new Map;for(let a of n){if(!a.sectionId)continue;let r=i.get(a.sectionId);r||(r=new Map,i.set(a.sectionId,r)),r.set(a.categoryKey,(r.get(a.categoryKey)??0)+1)}let o=new Map;for(let[a,r]of i){let s=0,l=0,c=0,f=0;for(let[m,u]of r){let h=H(e.get(m));h&&(s+=h[0]*u,l+=h[1]*u,c+=h[2]*u,f+=u)}f>0&&o.set(a,[s/f,l/f,c/f])}return o}function Qn(t,n){return H(t.color)??n.get(t.logicalSectionId??t.id)??null}import po from"polygon-clipping";function yo(t,n){return t===void 0||n===void 0?!0:Math.abs(t-n)<.001}var zt=class{constructor(){this.rings=[];this.boxes=[];this.levels=[]}subtract(n,e){let i=n.map(l=>[l.x,l.y]);if(i.length<3)return[];i.push(i[0]);let o=Mt(n),a=this.rings.filter((l,c)=>Xt(o,this.boxes[c])&&yo(e,this.levels[c])),r=[[i]];if(a.length)try{r=po.difference([i],...a).map(c=>c.map(f=>f.map(([m,u])=>[m,u])))}catch{r=[[i]]}this.rings.push([i]),this.boxes.push(o),this.levels.push(e);let s=[];for(let l of r){if(!l.length)continue;let c=l[0].map(([f,m])=>({x:f,y:m}));if(c.length>1){let f=c[0],m=c[c.length-1];Math.abs(f.x-m.x)<1e-9&&Math.abs(f.y-m.y)<1e-9&&c.pop()}c.length>=3&&s.push(c)}return s}};function xo(t,n){if(!n)return t;let e=1/0,i=-1/0,o=1/0,a=-1/0;for(let m of t)e=Math.min(e,m.x),i=Math.max(i,m.x),o=Math.min(o,m.y),a=Math.max(a,m.y);let r=(e+i)/2,s=(o+a)/2,l=n*Math.PI/180,c=Math.cos(l),f=Math.sin(l);return t.map(m=>{let u=m.x-r,h=m.y-s;return{x:r+u*c-h*f,y:s+u*f+h*c}})}function bt(t){let n=null;if(t.kind==="polygon"&&t.points&&t.points.length>=3&&(n=t.points),t.kind==="rect"&&t.width&&t.height&&(n=_t(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,i=(t.y??0)+t.height/2;n=Ht(e,i,t.width/2,t.height/2)}return n?xo(n,t.rotation):null}function Ft(t){let n=t.role??"",e={stage:{kind:"stage",heightM:1},entrance:{kind:"portal",heightM:2.7},exit:{kind:"portal",heightM:2.7},screen:{kind:"solid",heightM:6},wall:{kind:"solid",heightM:2.8},rail:{kind:"solid",heightM:1.1},suite:{kind:"suite",heightM:3},obstruction:{kind:"solid",heightM:4.5},sound:{kind:"solid",heightM:1.45},restroom:{kind:"solid",heightM:2.4},bar:{kind:"solid",heightM:1.1},concession:{kind:"solid",heightM:1.1},coat:{kind:"solid",heightM:1.1},goal:{kind:"portal",heightM:1.8}},i=n==="stage"&&Rn(t.stageKind)?{kind:"stage",heightM:.06}:e[n]??{kind:"plate",heightM:.25};return{...i,heightM:t.heightM??i.heightM}}var go=.08;function te(t,n){let e=bt(t),i=Ft(t),o=i.heightM;if(!e||i.kind!=="plate"&&i.kind!=="stage")return o;let a=1/0,r=1/0,s=-1/0,l=-1/0;for(let f of e)a=Math.min(a,f.x),r=Math.min(r,f.y),s=Math.max(s,f.x),l=Math.max(l,f.y);let c=o;for(let f of n)s>f.minX&&a<f.maxX&&l>f.minY&&r<f.maxY&&c<=f.topOffsetM+1e-6&&(c=f.topOffsetM+go);return n.push({minX:a,minY:r,maxX:s,maxY:l,topOffsetM:c}),c}function mt(t,n,e){return{x:t.x+(n.x-t.x)*e,y:t.y+(n.y-t.y)*e}}function ne(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 Et(t,n,e){return[mt(t[0],t[1],n),mt(t[0],t[1],e),mt(t[3],t[2],e),mt(t[3],t[2],n)]}function ee(t,n,e){return[mt(t[0],t[3],n),mt(t[1],t[2],n),mt(t[1],t[2],e),mt(t[0],t[3],e)]}function at(t,n,e,i,o,a){K(t,n,void 0,()=>e,i,o,a,W)}var cn=2.4,Mo=.75,So=.15;function Ct(t){if(t.points&&t.points.length>=3)return t.points;let{center:n,width:e,height:i,rotation:o}=t;if(!e||!i)return null;let a=(o??0)*Math.PI/180,r=Math.cos(a),s=Math.sin(a),l=e/2,c=i/2;return[[-l,-c],[l,-c],[l,c],[-l,c]].map(([f,m])=>({x:n.x+f*r-m*s,y:n.y+f*s+m*r}))}function oe(t,n,e,i,o){let a=Ct(n);a&&K(t,a,void 0,()=>e+cn,e,st(i,o.boothTop),o.boothWall,W)}function un(t){if(t.shape==="round"){let f=t.radius;return f?Ht(t.center.x,t.center.y,f,f,24):null}let{width:n,height:e,rotation:i,center:o}=t;if(!n||!e)return null;let a=(i??0)*Math.PI/180,r=Math.cos(a),s=Math.sin(a),l=n/2,c=e/2;return[[-l,-c],[l,-c],[l,c],[-l,c]].map(([f,m])=>({x:o.x+f*r-m*s,y:o.y+f*s+m*r}))}function re(t,n,e,i,o){let a=un(n);a&&K(t,a,void 0,()=>e+Mo,e,st(i,o.tableTop),o.tableWall,W)}function ie(t,n,e,i,o,a,r,s){let l=bt(n);if(!l)return;let c=s?s.kind==="stage":n.role==="stage",f=s?s.kind==="screen":n.role==="screen",m=s?{kind:c?"stage":"solid",heightM:s.topY-s.baseY}:Ft(n),u=s?.baseY??e,h=s?.topY??e+i;if(c&&r){let x=1/0,T=-1/0,S=1/0,C=-1/0;for(let P of l)P.x<x&&(x=P.x),P.x>T&&(T=P.x),P.y<S&&(S=P.y),P.y>C&&(C=P.y);r.push({cx:(x+T)/2*g,cz:(S+C)/2*g,y:h,halfX:Math.max((T-x)/2*g,.5),halfZ:Math.max((C-S)/2*g,.5)})}let b=H(n.fill),p=c&&b?nt(o.stageTop,et(At(b,.18),.9),.9):st(b,c?o.stageTop:o.decorTop),y=f?b:null,d=c?b?nt(o.stageWall,et(b,.58),.82):o.stageWall:f?y?nt(et(y,1.42),[.24,.46,.82],.08):[.24,.46,.82]:st(H(n.fill),o.decorWall);if(m.kind==="portal"&&l.length===4){let x=ne(l);at(t,Et(x,0,.16),h,u,p,d),at(t,Et(x,.84,1),h,u,p,d),at(t,x,h,Math.max(u,h-.35),p,d);return}if(m.kind==="suite"&&l.length===4){let x=l.map((C,P)=>{let A=l[(P+1)%4],E=(C.x+A.x)/2,v=(C.y+A.y)/2;return Math.hypot(E-a.x,v-a.y)}),T=x.indexOf(Math.min(...x)),S=[0,1,2,3].map(C=>l[(T+C)%4]);at(t,Et(S,0,.08),h,u,p,d),at(t,Et(S,.92,1),h,u,p,d),at(t,ee(S,.88,1),h,u,p,d),at(t,S,h,Math.max(u,h-.18),p,d);return}at(t,l,h,u,p,d)}function ln(t){let{x:n,y:e,width:i,height:o}=t;if(!i||!o)return null;let a=n+i/2,r=e+o/2,s=(t.rotation??0)*Math.PI/180,l=Math.cos(s),c=Math.sin(s),f=i/2,m=o/2;return[[-f,-m],[f,-m],[f,m],[-f,m]].map(([u,h])=>({x:a+u*l-h*c,y:r+u*c+h*l}))}function Ro(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 i=e[1].trim();if(i==="none"||i==="transparent")return null;let o=i.match(/^url\(#([^)]+)\)$/);if(!o)return H(i);let a=n.match(new RegExp(`<(?:linear|radial)Gradient\\b[^>]*\\bid="${o[1]}"[^>]*>([\\s\\S]*?)</(?:linear|radial)Gradient>`,"i"));if(!a)return null;let r=[];for(let s of a[1].matchAll(/stop-color="([^"]+)"/gi)){let l=H(s[1].trim());l&&r.push(l)}return r.length?r.reduce((s,l,c)=>nt(s,l,1/(c+1)),r[0]):null}function se(t,n,e,i){if(n.layer==="foreground")return;let o=ln(n);if(!o)return;let a=e+So,r=st(Ro(n.href),i.decorTop),s=Math.max(0,Math.min(1,n.opacity??1));s<1&&(r=nt(i.ground,r,s)),K(t,o,void 0,()=>a,e,r,nt(r,i.decorWall,.5),W)}function ae(t,n,e,i,o){if(!n.points||n.points.length<3)return;let a=st(i,o.gaTop);K(t,n.points,n.holes,()=>e+.15,e,a,o.gaWall,W)}var Po=.25,Ao=1.2,Io=.6,wo=.45,To=2.3,_o=Math.PI/180;function pt(t,n,e){let i=e*_o;return{x:t.x+n*Math.sin(i),y:t.y+n*Math.cos(i)}}function Bo(t,n){let e=n.rings[n.rings.length-1];if(!e)return!1;let i=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 r=0;for(let s of a)Math.hypot(s.x-n.centre.x,s.y-n.centre.y)>=i&&r++;if(r>=a.length/2)return!0}return!1}var Fo=24;function Eo(t,n,e,i,o,a,r,s){let l=e.binCount,c=Fo,f=ut,m=a+.02,u=[];for(let M=0;M<l;M++){let B=(e.startBin+M+.5)*n.binStepDeg,O=new Float64Array(c+1);for(let F=0;F<=c;F++){let I=i[M]+(o[M]-i[M])*F/c;O[F]=Math.max(m,In(n,e,B,I)-Po)}u.push(O)}let h=[r.bandTop[0]*s.top,r.bandTop[1]*s.top,r.bandTop[2]*s.top],b=[r.bandTop[0]*s.bottomCap,r.bandTop[1]*s.bottomCap,r.bandTop[2]*s.bottomCap],p=[r.bandWall[0]*s.top,r.bandWall[1]*s.top,r.bandWall[2]*s.top],y=[r.bandWall[0]*s.wallBottom,r.bandWall[1]*s.wallBottom,r.bandWall[2]*s.wallBottom],d=(M,B)=>{let O=(e.startBin+M+.5)*n.binStepDeg,F=i[M]+(o[M]-i[M])*B/c,I=pt(n.centre,F,O);return[I.x*f,u[M][B],I.y*f]};{let M=Math.tan(12*Math.PI/180);for(let B=0;B<6;B++){let O=!1;for(let I=0;I<l;I++)for(let k=c-1;k>=0;k--)u[I][k]>u[I][k+1]&&(u[I][k]=u[I][k+1],O=!0);let F=e.closed?l:l-1;for(let I=0;I<F;I++){let k=(I+1)%l;for(let R=0;R<=c;R++){let _=u[k][R]-u[I][R];if(Math.abs(_)>1)continue;let w=i[I]+(o[I]-i[I])*R/c,D=i[k]+(o[k]-i[k])*R/c,N=pt(n.centre,w,(e.startBin+I+.5)*n.binStepDeg),U=pt(n.centre,D,(e.startBin+k+.5)*n.binStepDeg),L=M*Math.hypot(U.x-N.x,U.y-N.y)*f;_>L?(u[k][R]=u[I][R]+L,O=!0):-_>L&&(u[I][R]=u[k][R]+L,O=!0)}}if(!O)break}}let x=1,T=(M,B)=>{for(let O=0;O<=c;O+=4)if(Math.abs(u[M][O]-u[B][O])>x)return!0;return Math.abs(u[M][c]-u[B][c])>x},S=Math.tan(38*Math.PI/180),C=M=>(o[M]-i[M])/c*f,P=(M,B)=>u[M][B+1]-u[M][B]>S*Math.max(1e-6,C(M)),A=(M,B)=>{let O=e.closed?(M-1+l)%l:Math.max(0,M-1),F=e.closed?(M+1)%l:Math.min(l-1,M+1);Math.abs(u[O][B]-u[M][B])>x&&(O=M),Math.abs(u[F][B]-u[M][B])>x&&(F=M);let I=Math.max(0,B-1),k=Math.min(c,B+1);I<B&&P(M,I)&&(I=B),k>B&&P(M,B)&&(k=B);let R=d(O,B),_=d(F,B),w=d(M,I),D=d(M,k),N=_[0]-R[0],U=_[1]-R[1],L=_[2]-R[2],Y=D[0]-w[0],j=D[1]-w[1],$=D[2]-w[2],z=U*$-L*j,q=L*Y-N*$,tt=N*j-U*Y,Z=Math.hypot(z,q,tt);return Z>1e-12?(z/=Z,q/=Z,tt/=Z,q<0&&(z=-z,q=-q,tt=-tt),[z,q,tt]):[0,1,0]},E=(M,B)=>{let O=[M[0],a,M[2]],F=[B[0],a,B[2]],I=B[0]-M[0],k=B[2]-M[2],R=Math.hypot(I,k);if(!(R>1e-12))return;let _=[k/R,0,-I/R];t.tri(M,B,F,_,p,p,y),t.tri(M,F,O,_,p,y,y)},v=.05*lt,G=M=>o[M]-i[M]<v,X=e.closed?l:l-1;for(let M=0;M<X;M++){let B=(M+1)%l;if(G(M)||G(B))continue;if(T(M,B)){let _=(e.startBin+M+1)*n.binStepDeg,w=(j,$)=>{let z=(i[M]+i[B])/2,q=(o[M]+o[B])/2,tt=z+(q-z)*$/c,Z=pt(n.centre,tt,_);return[Z.x*f,u[j][$],Z.y*f]};for(let j=0;j<c;j++){let $=d(M,j),z=d(M,j+1),q=w(M,j),tt=w(M,j+1),Z=A(M,j),it=A(M,j+1);t.triN($,q,tt,Z,Z,it,h),t.triN($,tt,z,Z,it,it,h);let vt=d(B,j),kt=d(B,j+1),dt=w(B,j),St=w(B,j+1),yt=A(B,j),xt=A(B,j+1);t.triN(dt,vt,kt,yt,yt,xt,h),t.triN(dt,kt,St,yt,xt,xt,h);let ct=w(M,j),rt=w(M,j+1),Ot=w(B,j+1),Kt=w(B,j),Lt=rt[0]-ct[0],Rt=rt[2]-ct[2],$t=Math.hypot(Lt,Rt);if($t>1e-12){let fn=[Rt/$t,0,-Lt/$t];t.tri(ct,rt,Ot,fn,p),t.tri(ct,Ot,Kt,fn,p)}}let D=d(M,0),N=d(B,0),U=d(B,c),L=d(M,c),Y=j=>[j[0],a,j[2]];t.tri(Y(D),Y(U),Y(N),[0,-1,0],b),t.tri(Y(D),Y(L),Y(U),[0,-1,0],b),E(D,N),E(L,U);continue}for(let _=0;_<c;_++){let w=A(M,_),D=A(B,_),N=A(B,_+1),U=A(M,_+1);if(P(M,_)||P(B,_)){let z=(rt,Ot)=>{let Kt=(e.startBin+rt+.5)*n.binStepDeg,Lt=i[rt]+(o[rt]-i[rt])*(_+.5)/c,Rt=pt(n.centre,Lt,Kt);return[Rt.x*f,Ot,Rt.y*f]},q=d(M,_),tt=d(B,_),Z=z(M,u[M][_]),it=z(B,u[B][_]);t.triN(q,tt,it,w,D,D,h),t.triN(q,it,Z,w,D,w,h);let vt=d(B,_+1),kt=d(M,_+1),dt=z(M,u[M][_+1]),St=z(B,u[B][_+1]);t.triN(dt,St,vt,U,N,N,h),t.triN(dt,vt,kt,U,N,U,h);let yt=it[0]-Z[0],xt=it[2]-Z[2],ct=Math.hypot(yt,xt);if(ct>1e-12){let rt=[-xt/ct,0,yt/ct];t.tri(Z,it,St,rt,p),t.tri(Z,St,dt,rt,p)}continue}let L=d(M,_),Y=d(B,_),j=d(B,_+1),$=d(M,_+1);t.triN(L,Y,j,w,D,N,h),t.triN(L,j,$,w,N,U,h)}let O=d(M,0),F=d(B,0),I=d(B,c),k=d(M,c),R=_=>[_[0],a,_[2]];t.tri(R(O),R(I),R(F),[0,-1,0],b),t.tri(R(O),R(k),R(I),[0,-1,0],b),E(O,F),E(k,I)}if(!e.closed)for(let M of[0,l-1])for(let B=0;B<c;B++)E(d(M,B),d(M,B+1))}function ce(t,n,e){let{bottomY:i,colors:o,ao:a}=e,r=new Float64Array(n.binCount).fill(-1/0);for(let f of n.rings)for(let m of f.arcs){let u=new Float64Array(m.binCount),h=new Float64Array(m.binCount);for(let p=0;p<m.binCount;p++){let y=(m.startBin+p)%n.binCount,d=Math.max(0,m.innerR[p]-ot);u[p]=Math.max(d,r[y]+.001),h[p]=Math.max(u[p]+.001,m.outerR[p]+ot)}let b=0;for(let p=0;p<m.binCount;p++){let y=m.topLevelM[p]-i;y>b&&(b=y)}b>=Ao&&Eo(t,n,m,u,h,i,o,a);for(let p=0;p<m.binCount;p++){let y=(m.startBin+p)%n.binCount;h[p]>r[y]&&(r[y]=h[p])}}if(e.deriveShell===!1||Bo(e.shapes,n))return;let s=n.rings[n.rings.length-1],l=Io*lt,c=wo*lt;for(let f of s.arcs){let m=[],u=[];for(let p=0;p<f.binCount;p++){let y=(f.startBin+p+.5)*n.binStepDeg,d=f.outerR[p]+ot+l;m.push(pt(n.centre,d,y)),u.push(pt(n.centre,d+c,y))}let h=-1/0;for(let p=0;p<f.binCount;p++)f.topLevelM[p]>h&&(h=f.topLevelM[p]);let b=()=>h+To;f.closed?K(t,u,[m.slice().reverse()],b,i,o.shellTop,o.shellWall,a):K(t,[...u,...m.slice().reverse()],void 0,b,i,o.shellTop,o.shellWall,a)}}function ue(t,n,e,i,o,a,r,s){if(!n.outline||n.outline.length<3)return;let l=e.baseHeightM,c=st(i,s.tierTop);if(!o)return;let f=y=>o.deckAt(y.x,y.y),m=Zn(n,r),u=m[0]??n.outline;if(o.rowLevels.length>=2){let y=Wt(o.rowLevels),d=Kn(Yn(o.rowLevels,e.focal,y),m),x=()=>[0,1,0];for(let S of d){let C=Math.max(l,S.topY-.02);for(let P of a.subtract(S.outline,C))K(t,P,S.holes,()=>C,l,c,s.tierWall,W,void 0,x)}d.length||K(t,u,n.holes,()=>o.landingY,l,c,s.tierWall,W);let T={tread:[c[0]*W.top,c[1]*W.top,c[2]*W.top],riser:[c[0]*.72,c[1]*.72,c[2]*.72]};for(let S of m.length?m:[u])Hn(t,o.rowLevels,e.focal,o.landingY,T,S,y);return}let h=o.flat?1/0:$n,b=y=>o.normalAt(y.x,y.y),p=o.flat?o.landingY:void 0;for(let y of a.subtract(u,p))K(t,y,n.holes,f,l,c,s.tierWall,W,h,b)}function Co(t,n,e){let i=new Set;for(let r of t.objects)r.type==="section"&&i.add(r.id);let o=new Map;for(let r=0;r<n.length;r++){let s=e.seatOwner[r];if(!s||!i.has(s))continue;let l=e.bySection.get(s);if(l&&l.rowLevels.length>=2)continue;let c=n[r],f=o.get(s);f||(f=new Map,o.set(s,f));let m=c.rowId||`__seat-${r}`,u=f.get(m);u||(u={pts:[],levelM:0,n:0},f.set(m,u)),u.pts.push({x:c.x,y:c.y}),u.levelM+=e.seatDeckY(r),u.n++}let a=[];for(let r of t.objects){if(r.type!=="section")continue;let s=e.bySection.get(r.id);if(s&&s.rowLevels.length>=2){let c=s.rowLevels.filter(f=>!f.patch).map(f=>({pts:f.pts,levelM:f.y}));c.length>=2&&a.push({sectionId:r.id,rows:c});continue}let l=o.get(r.id);l&&a.push({sectionId:r.id,rows:[...l.values()].map(c=>({pts:c.pts,levelM:c.levelM/c.n}))})}return a}function le(t,n,e,i,o,a,r=!0){let s=Co(n,e,i);if(!s.length)return;let l=An(s,n.focal);l&&(t.setMaterial(0),ce(t,l,{bottomY:n.baseHeightM,colors:{bandTop:et(o.tierTop,.8),bandWall:o.tierWall,shellTop:a??et(o.tierWall,1.15),shellWall:a??o.tierWall},ao:W,shapes:n.objects.filter(c=>c.type==="shape"),deriveShell:r}))}var vo=6,ko=2.2,me=.1,Oo=.3,Lo=1.8,Go=.9,Do=.55,Xo=6e3;function fe(t){let{doc:n,units:e,seats:i,surfaces:o,focal:a}=t,r=n.zones??[],s=[];if(r.length){let l=new Map;for(let f of e)for(let m of f.objects)m.type==="section"&&m.zone&&l.set(m.id,m.zone);let c=new Map;for(let f=0;f<i.length;f++){let m=i[f],u=o.seatOwner[f],h=m.zoneId??(u?l.get(u):void 0);if(!h)continue;let b=c.get(h);b||(b={n:0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0,sumY:0},c.set(h,b)),b.n++,m.x<b.minX&&(b.minX=m.x),m.y<b.minY&&(b.minY=m.y),m.x>b.maxX&&(b.maxX=m.x),m.y>b.maxY&&(b.maxY=m.y),b.sumY+=o.seatDeckY(f)}for(let f of r){let m=c.get(f.id),u=[];for(let[h,b]of l)b===f.id&&u.push(h);if(!m||m.n===0){s.push({id:f.id,label:f.label,color:H(f.color),sectionIds:u,seatCount:0,center:[0,0,0],radius:0,focalWorld:[(f.focalPoint??a).x*g,1.5,(f.focalPoint??a).y*g]});continue}s.push({id:f.id,label:f.label,color:H(f.color),sectionIds:u,seatCount:m.n,center:[(m.minX+m.maxX)/2*g,m.sumY/m.n,(m.minY+m.maxY)/2*g],radius:.5*Math.hypot((m.maxX-m.minX)*g,(m.maxY-m.minY)*g)||1,focalWorld:[(f.focalPoint??a).x*g,1.5,(f.focalPoint??a).y*g]})}}return s}function he(t){let{doc:n,units:e,seats:i,surfaces:o,seatData:a,hintedSeatFloor:r,zones:s,focal:l}=t,c=[],f=[],m=[];for(let u of s)u.seatCount!==0&&c.push({id:`zone:${u.id}`,kind:"zone",text:u.label,anchor:[u.center[0],u.center[1]+vo,u.center[2]],color:n.zones?.find(h=>h.id===u.id)?.color});{let u=new Map,h=new Map;for(let b=0;b<i.length;b++){let p=o.seatOwner[b];if(!p)continue;let y=u.get(p);y||(y={n:0,x:0,y:0,deck:0},u.set(p,y)),y.n++,y.x+=i[b].x,y.y+=i[b].y,y.deck+=o.seatDeckY(b);let d=h.get(p);d||(d={minX:1/0,maxX:-1/0,minY:1/0,maxY:-1/0},h.set(p,d)),i[b].x<d.minX&&(d.minX=i[b].x),i[b].x>d.maxX&&(d.maxX=i[b].x),i[b].y<d.minY&&(d.minY=i[b].y),i[b].y>d.maxY&&(d.maxY=i[b].y)}for(let b of e)for(let p of b.objects){if(p.type!=="section")continue;let y=u.get(p.id);if(!y||y.n===0)continue;let d=h.get(p.id),x=[y.x/y.n*g,y.deck/y.n,y.y/y.n*g],T=p.displayLabel||p.label||p.id;f.push({id:p.id,floorIndex:b.index,label:T,seatCount:y.n,center:x,radius:Math.max(1,Math.hypot(d.maxX-d.minX,d.maxY-d.minY)*.5*g),focalWorld:[b.focal.x*g,b.baseHeightM+1.5,b.focal.y*g]});let S=n.floors?.[b.index]?.name?.trim().toLocaleLowerCase();e.length>1&&S===T.trim().toLocaleLowerCase()||c.push({id:`section:${p.id}`,kind:"section",text:T,anchor:[x[0],x[1]+ko,x[2]],floorIndex:b.index})}}{for(let b of e)for(let p of b.objects){if(p.type!=="gaArea")continue;let y=Pt(p.points);if(!y)continue;let d=p.displayLabel||p.label||p.id;c.push({id:`ga:${p.id}`,kind:"ga",text:p.capacity>0?`${d} \xB7 ${p.capacity.toLocaleString()}`:d,anchor:[y.x*g,b.baseHeightM+Lo,y.y*g],floorIndex:b.index})}let u=new Map;for(let b=0;b<i.length;b++){let p=i[b],y=Math.hypot(p.x-l.x,p.y-l.y),d=u.get(p.rowId);(!d||y>d.far)&&u.set(p.rowId,{seat:p,index:b,far:y})}for(let[b,p]of u){let y=p.seat.label?p.seat.label.lastIndexOf("-"):-1,d=y>0?p.seat.label.slice(0,y):b;d&&c.push({id:`row:${b}`,kind:"row",text:d,anchor:[p.seat.x*g,o.seatDeckY(p.index)+Go,p.seat.y*g],floorIndex:r[p.index]})}let h=new Map;for(let b=0;b<i.length;b++){let p=i[b],y=p.label?p.label.lastIndexOf("-"):-1,d=h.get(p.rowId);d||(d={n:0,x:0,y:0,z:0,minX:1/0,maxX:-1/0,minZ:1/0,maxZ:-1/0,label:y>0?p.label.slice(0,y):p.rowId,sectionId:p.sectionId},h.set(p.rowId,d));let x=b*3,T=a.iPosition[x],S=a.iPosition[x+1],C=a.iPosition[x+2];d.n++,d.x+=T,d.y+=S,d.z+=C,d.minX=Math.min(d.minX,T),d.maxX=Math.max(d.maxX,T),d.minZ=Math.min(d.minZ,C),d.maxZ=Math.max(d.maxZ,C)}for(let[b,p]of h)m.push({id:b,label:p.label,sectionId:p.sectionId,seatCount:p.n,center:[p.x/p.n,p.y/p.n,p.z/p.n],radius:Math.max(.8,Math.hypot(p.maxX-p.minX,p.maxZ-p.minZ)*.5)});if(i.length<=Xo)for(let b=0;b<i.length;b++){let p=i[b],y=p.displayLabel||p.label;y&&c.push({id:`seat:${p.id}`,kind:"seat",text:y,anchor:[p.x*g,o.seatDeckY(b)+Do,p.y*g],floorIndex:r[b]})}}for(let u of e)for(let h of u.objects)if(h.type==="shape"&&h.role&&["entrance","exit","screen","suite","obstruction"].includes(h.role)){let b=bt(h),p=b?Pt(b):null;if(!p||!h.label)continue;c.push({id:`architecture:${h.id}`,kind:"annotation",text:h.label,anchor:[p.x*g,u.baseHeightM+Ft(h).heightM+me,p.y*g],color:h.fill,floorIndex:u.index})}else if(h.type==="text"){if(!h.text)continue;c.push({id:`text:${h.id}`,kind:"annotation",text:h.text,anchor:[h.position.x*g,u.baseHeightM+me,h.position.y*g],color:h.color,rotation:h.rotation,floorIndex:u.index})}else if(h.type==="booth"){let b=Ct(h);if(!b)continue;let p=Pt(b);if(!p)continue;c.push({id:`booth:${h.id}`,kind:"booth",text:h.displayLabel||h.label||h.id,anchor:[p.x*g,u.baseHeightM+cn+Oo,p.y*g],floorIndex:u.index})}return{labels:c,sections:f,rows:m}}function be(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 pe(t){let{doc:n,units:e,seats:i,surfaces:o,solids:a,hintedSeatFloor:r,seatFloor:s}=t,l=[];{let c=e.map(()=>({minX:1/0,minY:1/0,minZ:1/0,maxX:-1/0,maxY:-1/0,maxZ:-1/0}));for(let u=0;u<a.floor.length;u+=1){let h=Math.max(0,Math.min(e.length-1,Math.round(a.floor[u]))),b=u*3,p=c[h];p.minX=Math.min(p.minX,a.position[b]),p.minY=Math.min(p.minY,a.position[b+1]),p.minZ=Math.min(p.minZ,a.position[b+2]),p.maxX=Math.max(p.maxX,a.position[b]),p.maxY=Math.max(p.maxY,a.position[b+1]),p.maxZ=Math.max(p.maxZ,a.position[b+2])}let f=new Map;for(let u=0;u<e.length;u++)for(let h of e[u].objects)h.type==="section"&&f.set(h.id,u);let m=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 u=0;u<i.length;u++){let h=o.seatOwner[u],b=(h!==null?f.get(h):void 0)??r[u];if(b===void 0)continue;let p=m[b],y=i[u];p.n++,y.x<p.minX&&(p.minX=y.x),y.y<p.minY&&(p.minY=y.y),y.x>p.maxX&&(p.maxX=y.x),y.y>p.maxY&&(p.maxY=y.y);let d=o.seatDeckY(u);p.sumX+=y.x*g,p.sumDeck+=d,p.sumZ+=y.y*g,p.minDeck=Math.min(p.minDeck,d),p.maxDeck=Math.max(p.maxDeck,d+1.6),s[u]=b}for(let u=0;u<e.length;u++){let h=m[u],b=n.floors?.[u],p=c[u],y=Math.min(h.n?h.minX*g:e[u].focal.x*g-1,Number.isFinite(p.minX)?p.minX:1/0),d=Math.max(h.n?h.maxX*g:e[u].focal.x*g+1,Number.isFinite(p.maxX)?p.maxX:-1/0),x=Math.min(h.n?h.minY*g:e[u].focal.y*g-1,Number.isFinite(p.minZ)?p.minZ:1/0),T=Math.max(h.n?h.maxY*g:e[u].focal.y*g+1,Number.isFinite(p.maxZ)?p.maxZ:-1/0),S=Math.min(h.n?Math.min(e[u].baseHeightM,h.minDeck):e[u].baseHeightM,Number.isFinite(p.minY)?p.minY:1/0),C=Math.max(h.n?Math.max(h.maxDeck,S+.5):S+.5,Number.isFinite(p.maxY)?p.maxY:-1/0),P=[h.n?h.sumX/h.n:(y+d)/2,h.n?h.sumDeck/h.n:(S+C)/2,h.n?h.sumZ/h.n:(x+T)/2],A=Math.max(1,.5*Math.hypot(d-y,C-S,T-x));l.push({index:u,id:b?.id??`floor-${u}`,label:b?.name??(e.length>1?`Floor ${u+1}`:"Venue"),seatCount:h.n,center:P,radius:A,box:{min:[y,S,x],max:[d,C,T]},focalWorld:[e[u].focal.x*g,e[u].baseHeightM+1.5,e[u].focal.y*g]})}}return l}function mn(t,n){let e=1/0,i=1/0,o=-1/0,a=-1/0,r=(s,l)=>{s<e&&(e=s),l<i&&(i=l),s>o&&(o=s),l>a&&(a=l)};for(let s of n)r(s.x,s.y);for(let s of t)for(let l of s.objects)if(l.type==="section")for(let c of l.outline)r(c.x,c.y);else if(l.type==="shape"&&l.points)for(let c of l.points)r(c.x,c.y);else if(l.type==="gaArea")for(let c of l.points)r(c.x,c.y);else if(l.type==="booth"){let c=Ct(l);if(c)for(let f of c)r(f.x,f.y)}else if(l.type==="table"){let c=un(l);if(c)for(let f of c)r(f.x,f.y)}else if(l.type==="decorImage"){let c=ln(l);if(c)for(let f of c)r(f.x,f.y)}return Number.isFinite(e)||(e=-100,i=-100,o=100,a=100),{minX:e,minY:i,maxX:o,maxY:a}}function de(t,n,e,i,o,a){if(n.length===1){let r=Math.max(60,(o.maxX-o.minX+o.maxY-o.minY)*.06),s=_t(o.minX-r,o.minY-r,o.maxX-o.minX+r*2,o.maxY-o.minY+r*2);K(t,s,void 0,()=>0,-.4,a.ground,a.ground,W)}else{let r=n.reduce((h,b)=>b.baseHeightM<h.baseHeightM?b:h);t.setFloor(r.index);let s=e.filter((h,b)=>i[b]===r.index),l=mn([r],s),c=Math.hypot(l.maxX-l.minX,l.maxY-l.minY),f=Math.max(28,Math.min(80,c*.04)),m=_t(l.minX-f,l.minY-f,l.maxX-l.minX+f*2,l.maxY-l.minY+f*2),u=r.baseHeightM-.03;K(t,m,void 0,()=>u,u-.22,a.ground,a.ground,W)}}function ye(t,n,e){let{cx:i,cz:o,radius:a}=e,r=1/0,s=1/0,l=1/0,c=-1/0,f=-1/0,m=-1/0,u=(p,y,d)=>{r=Math.min(r,p),c=Math.max(c,p),s=Math.min(s,y),f=Math.max(f,y),l=Math.min(l,d),m=Math.max(m,d)};for(let p=0;p<t.position.length;p+=3)u(t.position[p],t.position[p+1],t.position[p+2]);for(let p=0;p<n.count;p++){let y=p*3,d=n.iPosition[y],x=n.iPosition[y+1],T=n.iPosition[y+2],S=Math.max(.35,n.iMaxRadius[p]??.35);u(d-S,x,T-S),u(d+S,x+1.6,T+S)}Number.isFinite(r)||(r=i-a,c=i+a,s=0,f=a*.16,l=o-a,m=o+a);let h=[(r+c)/2,(s+f)/2,(l+m)/2],b=Math.max(1,.5*Math.hypot(c-r,f-s,m-l));return{center:h,radius:b,minY:s,maxY:f}}function xe(t,n,e,i,o,a){let r=1/0,s=1/0,l=-1/0,c=-1/0;for(let S=0;S<t.count;S++){let C=S*3,P=t.iPosition[C],A=t.iPosition[C+2];P<r&&(r=P),P>l&&(l=P),A<s&&(s=A),A>c&&(c=A)}for(let S of n)r=Math.min(r,S.cx-S.halfX),l=Math.max(l,S.cx+S.halfX),s=Math.min(s,S.cz-S.halfZ),c=Math.max(c,S.cz+S.halfZ);let f=e.minX*g,m=e.maxX*g,u=e.minY*g,h=e.maxY*g,b=f,p=m,y=u,d=h;if(Number.isFinite(r)){let S=Math.max(2,.06*Math.hypot(l-r,c-s));b=Math.max(f,r-S),p=Math.min(m,l+S),y=Math.max(u,s-S),d=Math.min(h,c+S)}let x=Math.min(0,i),T=Math.max(o,a*.05);return{min:[b,x,y],max:[p,T,d]}}function ge(t,n,e){let i=()=>({byObjectId:new Map,elements:[]});if(!n||!t)return i();let o=bn(n);if(!o.ok||o.value.id!==t)return i();let a=new Map;for(let m of e)for(let u of m.objects)u.type==="shape"&&a.set(u.id,{shape:u,unit:m});let r=new Set,s=new Set,l=new Map((n.overlay.productionElements??[]).map(m=>{let u=m.runtimeContentImageUrl;return[m.id,typeof u=="string"&&/^(?:blob:|data:image\/|https:\/\/)/.test(u)?u:void 0]})),c=[];for(let m of o.value.overlay.productionElements??[]){let u=a.get(m.objectId),h=u?bt(u.shape):null,b=m.baseElevationM??0;if(!u||!h||h.length<3||!m.id||r.has(m.id)||s.has(m.objectId)||!Number.isFinite(m.heightM)||m.heightM<.05||m.heightM>50||!Number.isFinite(b)||b<-10||b>100)return i();r.add(m.id),s.add(m.objectId);let p=h.map(E=>E.x*g),y=h.map(E=>E.y*g),d=u.unit.baseHeightM+b,x=Math.min(...p),T=Math.max(...p),S=Math.min(...y),C=Math.max(...y),P,A=l.get(m.id)??m.contentImageUrl;if(m.kind==="screen"&&A)if(T-x>=C-S){let E=Math.abs(S-u.unit.focal.y*g)<=Math.abs(C-u.unit.focal.y*g)?S-.006:C+.006;P=[[x,d,E],[T,d,E],[x,d+m.heightM,E],[T,d+m.heightM,E]]}else{let E=Math.abs(x-u.unit.focal.x*g)<=Math.abs(T-u.unit.focal.x*g)?x-.006:T+.006;P=[[E,d,S],[E,d,C],[E,d+m.heightM,S],[E,d+m.heightM,C]]}c.push({id:m.id,objectId:m.objectId,kind:m.kind,floorIndex:u.unit.index,baseY:d,topY:d+m.heightM,bounds:{min:[x,d,S],max:[T,d+m.heightM,C]},occlusion:m.occlusion,...A?{contentImageUrl:A}:{},...P?{contentPlane:P}:{}})}let f=c.sort((m,u)=>m.id.localeCompare(u.id));return{byObjectId:new Map(f.map(m=>[m.objectId,m])),elements:f}}function Q(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}function J(t){return Array.isArray(t)?t:[]}function No(t){let n=[t];for(;n.length;){let e=n.pop();if(Array.isArray(e)){n.push(...e);continue}if(!Q(e))continue;let i=Q(e.extensions)?e.extensions:null;if(i&&Object.prototype.hasOwnProperty.call(i,"KHR_draco_mesh_compression"))return!0;n.push(...Object.values(e))}return!1}function Zt(t,n){return!Array.isArray(t)||t.length!==n||!t.every(e=>typeof e=="number"&&Number.isFinite(e))?null:t}function Uo(){return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}function Yo(t,n){let e=new Array(16).fill(0);for(let i=0;i<4;i++)for(let o=0;o<4;o++)for(let a=0;a<4;a++)e[i*4+o]+=t[a*4+o]*n[i*4+a];return e}function jo(t){let n=Zt(t.matrix,16);if(n)return n;if(t.matrix!==void 0)return null;let e=t.translation===void 0?[0,0,0]:Zt(t.translation,3),i=t.rotation===void 0?[0,0,0,1]:Zt(t.rotation,4),o=t.scale===void 0?[1,1,1]:Zt(t.scale,3);if(!e||!i||!o)return null;let[a,r,s,l]=i,c=Math.hypot(a,r,s,l);if(!(c>1e-8))return null;let f=a/c,m=r/c,u=s/c,h=l/c,b=f+f,p=m+m,y=u+u,d=f*b,x=f*p,T=f*y,S=m*p,C=m*y,P=u*y,A=h*b,E=h*p,v=h*y;return[(1-(S+P))*o[0],(x+v)*o[0],(T-E)*o[0],0,(x-v)*o[1],(1-(d+P))*o[1],(C+A)*o[1],0,(T+E)*o[2],(C-A)*o[2],(1-(d+S))*o[2],0,e[0],e[1],e[2],1]}function Ho(t,n,e,i){return[t[0]*n+t[4]*e+t[8]*i+t[12],t[1]*n+t[5]*e+t[9]*i+t[13],t[2]*n+t[6]*e+t[10]*i+t[14]]}function Vo(t){let n=t[0],e=t[4],i=t[8],o=t[1],a=t[5],r=t[9],s=t[2],l=t[6],c=t[10],f=a*c-r*l,m=r*s-o*c,u=o*l-a*s,h=n*f+e*m+i*u;if(Math.abs(h)<1e-12)return null;let b=1/h;return[f*b,m*b,u*b,(i*l-e*c)*b,(n*c-i*s)*b,(e*s-n*l)*b,(e*r-i*a)*b,(i*o-n*r)*b,(n*a-e*o)*b]}function Me(t,n,e,i){let o=t[0]*n+t[1]*e+t[2]*i,a=t[3]*n+t[4]*e+t[5]*i,r=t[6]*n+t[7]*e+t[8]*i,s=Math.hypot(o,a,r)||1;return o/=s,a/=s,r/=s,[o,a,r]}function Wo(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,i=null,o=null;for(;e+8<=t.byteLength;){let a=n.getUint32(e,!0),r=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(r===1313821514&&!i)try{let l=JSON.parse(new TextDecoder().decode(s).replace(/[\u0000 ]+$/g,""));if(!Q(l))return null;i=l}catch{return null}else if(r===5130562&&!o)o=s;else return null;e+=a}return e===t.byteLength&&i&&o?{json:i,bin:o}:null}function zo(t){return t===5120||t===5121?1:t===5122||t===5123?2:t===5125||t===5126?4:0}function Zo(t){return t==="SCALAR"?1:t==="VEC2"?2:t==="VEC3"?3:t==="VEC4"?4:0}function Ko(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 $o(t){let n=t instanceof Uint8Array?t:new Uint8Array(t),e=Wo(n);if(!e)return{ok:!1,issue:"invalid_glb"};let{json:i,bin:o}=e;if(!Q(i.asset)||i.asset.version!=="2.0")return{ok:!1,issue:"unsupported_glb"};let a=J(i.extensionsUsed).filter(S=>typeof S=="string");if(a.includes("KHR_draco_mesh_compression")||No(i))return{ok:!1,issue:"draco_not_allowed"};if(a.length||J(i.extensionsRequired).length)return{ok:!1,issue:"unsupported_glb"};if(J(i.images).length||J(i.textures).length)return{ok:!1,issue:"external_resource"};let r=J(i.buffers);if(r.length!==1||!Q(r[0])||r[0].uri!==void 0||typeof r[0].byteLength!="number"||!Number.isInteger(r[0].byteLength)||r[0].byteLength<0||r[0].byteLength>o.byteLength)return{ok:!1,issue:"external_resource"};let s=J(i.accessors),l=J(i.bufferViews),c=J(i.meshes),f=J(i.nodes),m=J(i.scenes),u=typeof i.scene=="number"?i.scene:0;if(!Q(m[u]))return{ok:!1,issue:"unsupported_glb"};let h=new DataView(o.buffer,o.byteOffset,o.byteLength),b=(S,C,P)=>{if(typeof S!="number"||!Number.isInteger(S)||!Q(s[S]))return null;let A=s[S];if(A.type!==C||A.sparse!==void 0||A.normalized===!0||typeof A.count!="number"||!Number.isInteger(A.count)||A.count<1||typeof A.componentType!="number"||!P.includes(A.componentType)||typeof A.bufferView!="number")return null;let E=l[A.bufferView];if(!Q(E)||E.buffer!==0||typeof E.byteLength!="number"||!Number.isInteger(E.byteLength)||E.byteLength<0)return null;let v=Zo(A.type),G=zo(A.componentType),X=typeof E.byteStride=="number"?E.byteStride:v*G,M=typeof E.byteOffset=="number"?E.byteOffset:0,B=typeof A.byteOffset=="number"?A.byteOffset:0,O=M+B,F=B+(A.count-1)*X+v*G;if(!Number.isInteger(X)||!Number.isInteger(M)||!Number.isInteger(B)||X<v*G||M<0||B<0||M+E.byteLength>o.byteLength||F>E.byteLength)return null;let I=[];for(let k=0;k<A.count;k++){let R=[];for(let _=0;_<v;_++){let w=Ko(h,O+k*X+_*G,A.componentType);if(!Number.isFinite(w))return null;R.push(w)}I.push(R)}return I},p=[],y=[],d=0,x=new Set,T=(S,C)=>{if(typeof S!="number"||!Number.isInteger(S)||!Q(f[S])||x.has(S))return!1;x.add(S);let P=f[S],A=jo(P);if(!A)return!1;let E=Yo(C,A),v=Vo(E);if(!v)return!1;if(P.mesh!==void 0){if(typeof P.mesh!="number")return!1;let G=c[P.mesh];if(!Q(G))return!1;for(let X of J(G.primitives)){if(!Q(X)||X.mode!==void 0&&X.mode!==4||!Q(X.attributes))return!1;let M=b(X.attributes.POSITION,"VEC3",[5126]),B=X.attributes.NORMAL===void 0?null:b(X.attributes.NORMAL,"VEC3",[5126]);if(!M||X.attributes.NORMAL!==void 0&&!B)return!1;let O=M.length;if(X.indices!==void 0){let I=typeof X.indices=="number"?s[X.indices]:null;O=Q(I)?I.count:void 0}if(typeof O!="number"||!Number.isInteger(O)||O%3!==0||(d+=O/3,d>1e5))return!1;let F=X.indices===void 0?M.map((I,k)=>[k]):b(X.indices,"SCALAR",[5121,5123,5125]);if(!F||F.length%3!==0||F.length!==O)return!1;for(let I=0;I<F.length;I+=3){let k=[F[I][0],F[I+1][0],F[I+2][0]];if(k.some(w=>!Number.isInteger(w)||w<0||w>=M.length))return!1;let R=k.map(w=>Ho(E,...M[w])),_=null;if(!B){let w=R[1][0]-R[0][0],D=R[1][1]-R[0][1],N=R[1][2]-R[0][2],U=R[2][0]-R[0][0],L=R[2][1]-R[0][1],Y=R[2][2]-R[0][2];_=Me([1,0,0,0,1,0,0,0,1],D*Y-N*L,N*U-w*Y,w*L-D*U)}for(let w=0;w<3;w++)p.push(...R[w]),y.push(...B?Me(v,...B[k[w]]):_)}}}for(let G of J(P.children))if(!T(G,E))return!1;return x.delete(S),!0};for(let S of J(m[u].nodes))if(!T(S,Uo()))return{ok:!1,issue:d>1e5?"triangle_limit":"unsupported_glb"};return!d||p.length!==d*9||y.length!==p.length?{ok:!1,issue:"unsupported_glb"}:{ok:!0,triangleCount:d,position:new Float32Array(p),normal:new Float32Array(y)}}function Se(t){try{return $o(t)}catch{return{ok:!1,issue:"invalid_glb"}}}function ps(t){let{doc:n}=t,e=Cn(n.theme),i=e.structure,o=zn(n,t.eventConfigurationId??n.eventConfigurationId),a=ge(t.eventConfigurationId,t.eventConfiguration,o),r=t.seats,s=new Yt,l=null;if(t.registeredShellGlb){let F=Se(t.registeredShellGlb);if(F.ok){let I=F.position.length/3,k=new Float32Array(F.position.length),R=e.materials.shell??i.tierWall;for(let _=0;_<I;_++){let w=F.normal[_*3+1],D=w<-.25?.4:.62+.38*Math.max(0,w);k[_*3]=R[0]*D,k[_*3+1]=R[1]*D,k[_*3+2]=R[2]*D}l={position:F.position,normal:F.normal,color:k,floor:new Float32Array(I).fill(-2),material:new Float32Array(I),count:I}}}let c=new Map;for(let F of o)for(let I of F.objects)c.set(I.id,F.index),I.type==="section"&&c.set(I.logicalSectionId??I.id,F.index);let f=r.map(F=>c.get(F.sectionId??"")??c.get(F.rowId??"")??0),m=mn(o,r);de(s,o,r,f,m,i);let u=Jn(n,r),h=new Map,b=new Map;for(let F of n.categories??[])h.set(F.key,F.color),F.seatGlyph&&b.set(F.key,F.seatGlyph);let p=[],y=qn(o,r,f),d=new Float32Array(r.length);for(let F=0;F<o.length;F++){let I=o[F];s.setFloor(F);let k=new zt,R=[],_=I.objects.filter(w=>w.type==="section"&&!!w.outline&&w.outline.length>=3);for(let w of I.objects)if(w.type==="section")ue(s,w,I,Qn(w,u),y.bySection.get(w.id),k,_,i);else if(w.type==="shape"){let D=a.byObjectId.get(w.id);s.setMaterial((D?.kind??w.role)==="screen"?1:0),ie(s,w,I.baseHeightM,te(w,R),i,I.focal,p,D),s.setMaterial(0)}else w.type==="gaArea"?ae(s,w,I.baseHeightM,H(h.get(w.categoryKey)),i):w.type==="booth"?oe(s,w,I.baseHeightM,H(h.get(w.categoryKey)),i):w.type==="table"?re(s,w,I.baseHeightM,H(h.get(w.categoryKey)),i):w.type==="decorImage"&&se(s,w,I.baseHeightM,i);le(s,I,r,y,i,e.materials.shell,!l)}let x=o.length>1?{x:o.reduce((F,I)=>F+I.focal.x,0)/o.length,y:o.reduce((F,I)=>F+I.focal.y,0)/o.length}:n.focalPoint??{x:(m.minX+m.maxX)/2,y:(m.minY+m.maxY)/2},T=Tn(l?[s.build(),l]:[s.build()]),S=En(r,t.initialState,y,d,h,b),C=fe({doc:n,units:o,seats:r,surfaces:y,focal:x}),{labels:P,sections:A,rows:E}=he({doc:n,units:o,seats:r,surfaces:y,seatData:S,hintedSeatFloor:f,zones:C,focal:x}),v=pe({doc:n,units:o,seats:r,surfaces:y,solids:T,hintedSeatFloor:f,seatFloor:d});be(P,v),S.iYaw=Fn(S.iPosition,r.length,F=>r[F].rowId,F=>{let I=o[d[F]]?.focal??x;return[I.x*g,I.y*g]});let G=(m.minX+m.maxX)/2*g,X=(m.minY+m.maxY)/2*g,M=.5*Math.hypot((m.maxX-m.minX)*g,(m.maxY-m.minY)*g)||10,B=ye(T,S,{cx:G,cz:X,radius:M}),O=xe(S,p,m,B.minY,B.maxY,M);return{solids:T,seats:S,bounds:{center:[(O.min[0]+O.max[0])/2,(O.min[1]+O.max[1])/2,(O.min[2]+O.max[2])/2],radius:M,groundY:0,box:O},renderBounds:{center:B.center,radius:B.radius},stateColorLUT:vn(e,Bt),theme:e,seatCount:r.length,focalWorld:[x.x*g,1.5,x.y*g],zones:C,stages:p,productionElements:a.elements,sections:A,rows:E,labels:P,floors:v}}export{Bt as a,Qt as b,rr as c,nn as d,g as e,sr as f,Le as g,ar as h,Vt as i,dr as j,yr as k,Mr as l,Sr as m,Rr as n,Pr as o,Ar as p,Ir as q,wr as r,Tr as s,_r as t,Br as u,ps as v};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Ba as O,Ea as v,sa as A}from"./chunk-KN7GLEAI.js";function I(t){let n=Number(t.slice(t.lastIndexOf(":")+1));return Number.isFinite(n)?n:-1}function $(t,n,i){let e=new Map;for(let o of t){if(o.kind==="booth")continue;let a=e.get(o.rowId);a?a.push(o):e.set(o.rowId,[o])}let c=o=>i.has(o.id)||n(o.id)!=="free",l=[];for(let o of e.values())if(!(o.length<3)){o.sort((a,b)=>I(a.id)-I(b.id));for(let a=1;a<o.length-1;a++){let b=o[a];if(c(b))continue;let y=o[a-1],m=o[a+1];I(b.id)-I(y.id)!==1||I(m.id)-I(b.id)!==1||!c(y)||!c(m)||!i.has(y.id)&&!i.has(m.id)||l.push(b)}}return l}function D(t){return{code:"ticket_option_not_applicable",labels:t,message:"That ticket choice is not available for the selected seat."}}function C(t,n){let i=t.applicability;return i?!(i.seatLabels?.length&&!i.seatLabels.includes(n.label)||i.accessibility?.length&&!i.accessibility.some(e=>n.accessibility?.includes(e))):!0}function Q(t,n){return(t.categories.find(i=>i.key===n.categoryKey)?.tiers??[]).filter(i=>C(i,n))}function M(t,n,i){let e=t.categories.find(l=>l.key===n.categoryKey)?.tiers;if(!e?.length)return{kind:"none"};let c=i==null?e.find(l=>C(l,n)):e.find(l=>l.id===i&&C(l,n));return c?{kind:"resolved",tier:c}:{kind:"invalid"}}function z(t,n){return(t.logicalRowId??t.rowId)===(n.logicalRowId??n.rowId)}function N(t){if(Number.isInteger(t.logicalSeatIndex))return t.logicalSeatIndex;let n=t.id.slice(t.id.lastIndexOf(":")+1),i=Number(n);return Number.isInteger(i)?i:void 0}function G(t,n){if(!z(t,n))return!1;let i=N(t),e=N(n);return i!=null&&e!=null&&Math.abs(i-e)===1}function U(t,n){if(!n.length)return null;let i=new Map(v(t,{resolveEyeHeights:!1}).map(o=>[o.label,o])),e=n.flatMap(o=>{let a=i.get(o.label);return a?[{selection:o,seat:a}]:[]}),c=e.map(({seat:o})=>o).filter(o=>o.accessibility?.includes("wheelchair")),l=[];for(let{selection:o,seat:a}of e){let b=M(t,a,o.tierId),y=b.kind==="resolved"?b.tier:void 0;(a.accessibility?.includes("companion")||y?.restriction==="companion")&&!c.some(s=>s.id!==a.id&&G(a,s))&&l.push(a.label)}return l.length?{code:"companion_pair_required",labels:l,message:"Select the adjacent wheelchair place with each companion ticket."}:null}function X(t,n){if(!n.length)return null;let i=new Map(v(t,{resolveEyeHeights:!1}).map(o=>[o.label,o])),e=new Set(t.categories.filter(o=>o.notForSale).map(o=>o.key)),c=[],l=[];for(let o of n){let a=i.get(o.label);if(!a)continue;if(e.has(a.categoryKey)){c.push(a.label);continue}M(t,a,o.tierId).kind==="invalid"&&l.push(a.label)}return c.length?{code:"not_for_sale",labels:c,message:"These seats are not for sale."}:l.length?D(l):U(t,n)}function E(t,n){if(Number.isInteger(t.logicalSeatIndex))return t.logicalSeatIndex;let i=t.id.lastIndexOf(":");if(i<0)return n;let e=Number(t.id.slice(i+1));return Number.isFinite(e)?e:n}function w(t,n){let i=t.x-n.x,e=t.y-n.y;return i*i+e*e}function R(t){let n=0,i=0;for(let e of t)n+=e.x,i+=e.y;return{x:n/t.length,y:i/t.length}}function K(t,n){return t.find(i=>i.focalPoint)?.focalPoint??n}function P(t){return t.commercial?.premium===!0}function V(t,n,i){let e=Math.floor(i.qty);if(!Number.isFinite(e)||e<=0)return{labels:[],reason:"sold_out"};let{categoryKey:c,zoneId:l,focal:o,preferPremium:a,accessibility:b,requireContiguous:y}=i,m=new Map,s=[];if(t.forEach((r,u)=>{let g=n.has(r.label)&&(!c||r.categoryKey===c)&&(!l||r.zoneId===l)&&(!b||b.some(h=>r.accessibility?.includes(h))),p=r.logicalRowId??r.rowId,d=m.get(p);d||(d=[],m.set(p,d)),d.push({seat:r,index:E(r,u),elig:g}),g&&s.push(r)}),s.length===0)return{labels:[],reason:"sold_out"};let f=null,B=r=>{if(!f)return!0;if(a&&r.nonPremium!==f.nonPremium)return r.nonPremium<f.nonPremium;if(r.orphan!==f.orphan)return r.orphan<f.orphan;if(r.d2!==f.d2)return r.d2<f.d2;let u=r.rowId.localeCompare(f.rowId);return u!==0?u<0:r.startIndex<f.startIndex};for(let[r,u]of m){let g=[...u].sort((d,h)=>d.index-h.index),p=0;for(;p<g.length;){if(!g[p].elig){p++;continue}let d=p;for(;d<g.length&&g[d].elig&&(d===p||g[d].index===g[d-1].index+1);)d++;let h=d-p;for(let x=0;x+e<=h;x++){let j=x,F=h-(x+e),L=j===1||F===1?1:0,S=g.slice(p+x,p+x+e).map(T=>T.seat),_={labels:S.map(T=>T.label),seats:S,rowId:r,startIndex:g[p+x].index,orphan:L,nonPremium:a?S.reduce((T,q)=>T+(P(q)?0:1),0):0,d2:w(R(S),K(S,o))};B(_)&&(f=_)}p=d}}return f?{labels:f.labels}:y?{labels:[],reason:s.length?"not_enough_together":"sold_out"}:s.length<e?{labels:[],reason:"not_enough_together"}:{labels:s.map((r,u)=>({seat:r,i:u,d2:w(r,r.focalPoint??o)})).sort((r,u)=>{if(a){let p=P(r.seat)?0:1,d=P(u.seat)?0:1;if(p!==d)return p-d}if(r.d2!==u.d2)return r.d2-u.d2;let g=(r.seat.logicalRowId??r.seat.rowId).localeCompare(u.seat.logicalRowId??u.seat.rowId);return g!==0?g:E(r.seat,r.i)-E(u.seat,u.i)}).slice(0,e).map(r=>r.seat.label)}}function ee(t,n,i,e){let c=Math.floor(e.qty),l=V(t,i,e),a=n.filter(s=>s.bookingMode==="whole"&&s.capacity===c&&i.has(s.label)&&(!e.categoryKey||s.categoryKey===e.categoryKey)&&(!e.zoneId||s.zoneId===e.zoneId)&&!e.accessibility).map(s=>({table:s,d2:w(s.center,s.focalPoint??e.focal)})).sort((s,f)=>s.d2-f.d2||s.table.label.localeCompare(f.table.label))[0];if(!a)return l;if(!l.labels.length)return{labels:[a.table.label]};let b=new Map(t.map(s=>[s.label,s])),y=l.labels.map(s=>b.get(s)).filter(s=>!!s),m=y.length?w(R(y),K(y,e.focal)):Number.POSITIVE_INFINITY;return a.d2<m?{labels:[a.table.label]}:l}var k=class extends Error{constructor(i,e){super(e);this.objectId=i;this.name="GroupedTableProjectionError"}};function H(t){let n=t.minOccupancy,i=t.maxOccupancy;if(!Number.isInteger(n)||!Number.isInteger(i)||n<1||i<n||i>t.seatCount)throw new k(t.id,`Table "${t.label}" has invalid variable-occupancy bounds`);return{min:n,max:i}}function ie(t,n){if(n!==2)return[];let i=[];for(let e of O(t)){if(e.type!=="table"||!e.bookAsWhole&&!e.variableOccupancy)continue;if(e.bookAsWhole&&e.variableOccupancy)throw new k(e.id,`Table "${e.label}" cannot be whole-table and variable-occupancy inventory`);if(!Number.isInteger(e.seatCount)||e.seatCount<1||!e.label.trim())throw new k(e.id,"Grouped tables require a label and at least one chair");let c=e.variableOccupancy?"variable":"whole",l=c==="variable"?H(e):{min:e.seatCount,max:e.seatCount};i.push({objectId:e.id,label:e.label,...e.displayLabel?{displayLabel:e.displayLabel}:{},...e.displayType?{displayType:e.displayType}:{},categoryKey:e.categoryKey,mode:c,capacity:e.seatCount,minOccupancy:l.min,maxOccupancy:l.max,chairs:A(e)})}return i}export{$ as a,D as b,C as c,Q as d,M as e,U as f,X as g,V as h,ee as i,k as j,ie as k};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as se}from"./chunk-CRCGO52K.js";var Bt=40,Gt=1200,Xt=.8,zt=3,Kt=-2,Vt=20,$t=.1,Wt=40,Yt=40,ce=e=>Math.max(1,e.fontSize*.6+(e.letterSpacing??0));function ze(e,t){let n=e.text.split(/\r?\n/);if(!e.width)return Math.max(1,n.length);let o=Math.max(1,Math.floor(t/ce(e))),r=0;for(let i of n){if(!i.length){r+=1;continue}let c=0;for(let u of i.split(/\s+/)){let s=u.length;c&&c+1+s<=o?c+=1+s:(r+=Math.max(1,Math.ceil(s/o)),c=s%o)}}return Math.max(1,r)}function ae(e){let t=e.background?.padding??0,n=e.text.split(/\r?\n/),o=Math.max(1,...n.map(u=>u.length))*ce(e),r=e.width??o+t*2,i=Math.max(1,r-t*2),c=ze(e,i);return{width:r,height:c*e.fontSize*(e.lineHeight??1.2)+t*2,lineCount:c,padding:t}}var Ke=Math.PI/180;function I(e,t){return Math.hypot(e.x-t.x,e.y-t.y)}function Ve(e,t,n){let o=Math.cos(n),r=Math.sin(n),i=e.x-t.x,c=e.y-t.y;return{x:t.x+i*o-c*r,y:t.y+i*r+c*o}}function Jt(e,t){return Ve(e,{x:0,y:0},t*Ke)}function O(e,t,n){return{x:e.x+(t.x-e.x)*n,y:e.y+(t.y-e.y)*n}}function $e(e){let t=0,n=0;for(let r of e)t+=r.x,n+=r.y;let o=e.length||1;return{x:t/o,y:n/o}}function Qt(e){return e.length?$e(e):null}function W(e,t){let n=1-t,o=n*n*n,r=3*n*n*t,i=3*n*t*t,c=t*t*t;return{x:o*e.start.x+r*e.control1.x+i*e.control2.x+c*e.end.x,y:o*e.start.y+r*e.control1.y+i*e.control2.y+c*e.end.y}}function tn(e,t,n){let o={x:(e.x+t.x)/2,y:(e.y+t.y)/2},r={x:(n.x-o.x)*4/3,y:(n.y-o.y)*4/3};return{start:{...e},control1:{x:e.x+(t.x-e.x)/3+r.x,y:e.y+(t.y-e.y)/3+r.y},control2:{x:e.x+(t.x-e.x)*2/3+r.x,y:e.y+(t.y-e.y)*2/3+r.y},end:{...t}}}function fe(e,t,n=192){if(!Number.isInteger(t)||t<1)throw new Error("Path point count must be a positive integer");if(t===1)return[W(e,.5)];let o=Array.from({length:n+1},(s,d)=>W(e,d/n)),r=new Float64Array(o.length);for(let s=1;s<o.length;s+=1){let d=o[s].x-o[s-1].x,a=o[s].y-o[s-1].y;r[s]=r[s-1]+Math.hypot(d,a)}let i=r[r.length-1];if(i<=1e-9)return Array.from({length:t},()=>({...e.start}));let c=[],u=1;for(let s=0;s<t;s+=1){let d=i*s/(t-1);for(;u<r.length-1&&r[u]<d;)u+=1;let a=r[u-1],h=r[u],m=h===a?0:(d-a)/(h-a);c.push({x:o[u-1].x+(o[u].x-o[u-1].x)*m,y:o[u-1].y+(o[u].y-o[u-1].y)*m})}return c}function T(e,t){return{x:e.x+t.x,y:e.y+t.y}}function F(e,t){return{x:e.x-t.x,y:e.y-t.y}}function R(e,t){return{x:e.x*t,y:e.y*t}}function B(e,t=13){return Array.from({length:t},(n,o)=>W(e,o/(t-1)))}function le(e,t){let n=Math.max(0,Math.min(1,t))*(e.length-1),o=Math.min(e.length-2,Math.floor(n));return O(e[o],e[o+1],n-o)}function ue(e,t,n){let o=Math.max(0,Math.min(1,t)),r=Math.max(o,Math.min(1,n)),i=[le(e,o)];for(let c=1;c<e.length-1;c+=1){let u=c/(e.length-1);u>o+1e-9&&u<r-1e-9&&i.push(e[c])}return i.push(le(e,r)),i}function de(e,t){let n=[[0,1],[1,2],[2,3],[3,0]],o=0,r=Number.POSITIVE_INFINITY;n.forEach(([m,b],p)=>{let y=I(O(e[m],e[b],.5),t);y<r&&(r=y,o=p)});let i=e[o],c=e[(o+1)%4],u=e[(o+2)%4],s=e[(o+3)%4],d=O(i,c,.5),a=F(t,d),h=Math.max(1e-9,Math.hypot(a.x,a.y));return{p0:i,p1:c,p2:u,p3:s,normal:R(a,1/h),depth:(I(i,s)+I(c,u))/2}}function he(e){let{p0:t,p1:n,p2:o,p3:r,normal:i,depth:c}=e,u=F(n,t),s=F(o,r),d=c*.22,a=c*.12;return{nearPath:{start:t,control1:T(T(t,R(u,1/3)),R(i,d)),control2:T(T(t,R(u,2/3)),R(i,d)),end:n},farPath:{start:o,control1:T(T(r,R(s,2/3)),R(i,a)),control2:T(T(r,R(s,1/3)),R(i,a)),end:r}}}function nn(e,t,n){if(e.length!==4)throw new Error("A section shell requires four mapped bounds corners");let o=e.reduce((p,y)=>T(p,y),{x:0,y:0});o.x/=4,o.y/=4;let r=I(e[0],e[1]),i=I(e[0],e[3]),c=n==="auto"?r>i*1.25&&I(o,t)>i?"bezier":"tapered":n;if(c==="rectangle")return{mode:c,outline:e.map(p=>({...p}))};let u=de(e,t),{p0:s,p1:d,p2:a,p3:h}=u;if(c==="tapered")return{mode:c,outline:[T(s,R(F(d,s),.14)),T(s,R(F(d,s),1-.14)),a,h]};let{nearPath:m,farPath:b}=he(u);return{mode:c,outline:[...B(m),...B(b).slice(1)]}}function on(e,t,n,o){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 r=de(e,t),{p0:i,p1:c,p2:u,p3:s}=r,d=o==="bezier"?he(r):null,a=d?B(d.nearPath):null,h=d?B(d.farPath).reverse():null,m=Math.min(.055,.18/(n+1));return Array.from({length:n},(b,p)=>{let y=(p+1)/(n+1),f=y-m/2,g=y+m/2;return a&&h?[...ue(a,f,g),...ue(h,f,g).reverse()]:[O(i,c,f),O(i,c,g),O(s,u,g),O(s,u,f)]})}function We(e,t,n){let o=n.x-t.x,r=n.y-t.y,i=o*o+r*r,c=i?Math.max(0,Math.min(1,((e.x-t.x)*o+(e.y-t.y)*r)/i)):0;return Math.hypot(e.x-(t.x+c*o),e.y-(t.y+c*r))}function Ye(e,t){let n=1/0;for(let o of t)if(!(o.length<2))for(let r=0,i=o.length-1;r<o.length;i=r++){let c=We(e,o[i],o[r]);c<n&&(n=c)}return n}function me(e,t){let n=!1;for(let o=0,r=t.length-1;o<t.length;r=o++){let i=t[o].x,c=t[o].y,u=t[r].x,s=t[r].y;c>e.y!=s>e.y&&e.x<(u-i)*(e.y-c)/(s-c)+i&&(n=!n)}return n}function qe(e,t,n){let o=me(e,t)&&!n.some(i=>me(e,i)),r=Ye(e,[t,...n]);return o?r:-r}function L(e,t,n,o,r){let i=qe({x:e,y:t},o,r);return{x:e,y:t,h:n,d:i,max:i+n*Math.SQRT2}}var Y=class{constructor(){this.items=[]}get size(){return this.items.length}push(t){let n=this.items;n.push(t);let o=n.length-1;for(;o>0;){let r=o-1>>1;if(n[r].max>=n[o].max)break;[n[r],n[o]]=[n[o],n[r]],o=r}}pop(){let t=this.items,n=t[0],o=t.pop();if(t.length&&o){t[0]=o;let r=0;for(;;){let i=r*2+1,c=i+1,u=r;if(i<t.length&&t[i].max>t[u].max&&(u=i),c<t.length&&t[c].max>t[u].max&&(u=c),u===r)break;[t[u],t[r]]=[t[r],t[u]],r=u}}return n}};function pe(e){if(e.length<3)return 0;let t=0;for(let n=0,o=e.length-1;n<e.length;o=n++)t+=(e[o].x+e[n].x)*(e[o].y-e[n].y);return Math.abs(t)/2}function sn(e,t){return Math.max(0,pe(e)-(t??[]).reduce((n,o)=>n+pe(o),0))}function ye(e,t){let n=t??[];if(!e.length)return{point:{x:0,y:0},radius:0};if(e.length<3){let y=e.reduce((g,w)=>g+w.x,0)/e.length,f=e.reduce((g,w)=>g+w.y,0)/e.length;return{point:{x:y,y:f},radius:0}}let o=1/0,r=1/0,i=-1/0,c=-1/0;for(let y of e)y.x<o&&(o=y.x),y.y<r&&(r=y.y),y.x>i&&(i=y.x),y.y>c&&(c=y.y);let u=i-o,s=c-r,d=Math.min(u,s);if(!(d>0))return{point:{x:(o+i)/2,y:(r+c)/2},radius:0};let a=Math.max(u,s)/150,h=new Y,m=d/2;for(let y=o;y<i;y+=d)for(let f=r;f<c;f+=d)h.push(L(y+m,f+m,m,e,n));let b=L(o+u/2,r+s/2,0,e,n),p=0;for(;h.size;){let y=h.pop();if(!y)break;y.d>b.d&&(b=y),!(y.max-b.d<=a)&&(p>=4e3||(p+=1,m=y.h/2,h.push(L(y.x-m,y.y-m,m,e,n)),h.push(L(y.x+m,y.y-m,m,e,n)),h.push(L(y.x-m,y.y+m,m,e,n)),h.push(L(y.x+m,y.y+m,m,e,n))))}return{point:{x:b.x,y:b.y},radius:Math.max(0,b.d)}}function Je(e,t,n){return Math.max(t,Math.min(n,e))}function an(e,t,n){return e<t?t:e>n?n:e}function Qe(e){return Je(e,0,1)}function be(e){let t=Qe(e);return t*t*(3-2*t)}var k=Math.PI*2;function j(e){return Number.isFinite(e.x)&&Number.isFinite(e.y)}function Ze(e,t,n){let o=t-e;if(n){for(;o<0;)o+=k;for(;o>=k;)o-=k}else{for(;o>0;)o-=k;for(;o<=-k;)o+=k}return o}function dn(e){return e.end}function Se(e){if(e.version!==1||e.closed!==!0||!j(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||!j(n.end))return!1;if(n.kind==="line"){if(I(t,n.end)<=1e-9)return!1}else if(n.kind==="bezier"){if(!j(n.control1)||!j(n.control2)||I(t,n.end)<=1e-9)return!1}else if(n.kind==="arc"){if(!j(n.center)||!Number.isFinite(n.radius)||n.radius<=1e-6||Math.abs(I(t,n.center)-n.radius)>Math.max(1e-4,n.radius*1e-4)||Math.abs(I(n.end,n.center)-n.radius)>Math.max(1e-4,n.radius*1e-4)||I(t,n.end)<=1e-9)return!1}else return!1;t=n.end}return I(t,e.start)<=1e-4}function et(e,t,n){let o=1-n;return{x:o**3*e.x+3*o**2*n*t.control1.x+3*o*n**2*t.control2.x+n**3*t.end.x,y:o**3*e.y+3*o**2*n*t.control1.y+3*o*n**2*t.control2.y+n**3*t.end.y}}function hn(e,t=2){if(!Se(e))throw new Error("Section outline path is invalid");let n=Math.max(.25,t),o=[{...e.start}],r=e.start;for(let i of e.segments){if(i.kind==="line")o.push({...i.end});else if(i.kind==="arc"){let c=Math.atan2(r.y-i.center.y,r.x-i.center.x),u=Math.atan2(i.end.y-i.center.y,i.end.x-i.center.x),s=Ze(c,u,i.clockwise),d=Math.max(2,Math.ceil(Math.abs(s)*i.radius/n));for(let a=1;a<=d;a+=1){let h=c+s*a/d;o.push({x:i.center.x+Math.cos(h)*i.radius,y:i.center.y+Math.sin(h)*i.radius})}}else{let c=I(r,i.control1)+I(i.control1,i.control2)+I(i.control2,i.end),u=Math.max(2,Math.ceil(c/n));for(let s=1;s<=u;s+=1)o.push(et(r,i,s/u))}r=i.end}return I(o[o.length-1],o[0])<=1e-4&&o.pop(),o}function we(e,t,n){return tt(e,r=>({x:r.x+t,y:r.y+n}))}function tt(e,t,n=1,o=!1){return{...e,start:t(e.start),segments:e.segments.map(r=>r.kind==="line"?{...r,end:t(r.end)}:r.kind==="arc"?{...r,center:t(r.center),radius:r.radius*Math.abs(n),clockwise:o?!r.clockwise:r.clockwise,end:t(r.end)}:{...r,control1:t(r.control1),control2:t(r.control2),end:t(r.end)})}}var nt=45,q=150,ot=60;function rt(e){let t=nt/100;if(e<=t)return q;let n=Math.min(1,(e-t)/(1-t));return q-n*(q-ot)}var xe=.5523;function ge(e,t){return Math.abs(e.x-t.x)<=1e-6&&Math.abs(e.y-t.y)<=1e-6}function it(e){let t=[],n=[];for(e.forEach((o,r)=>{j(o)&&(t.length&&ge(t[t.length-1],o)||(t.push({x:o.x,y:o.y}),n.push(r)))});t.length>1&&ge(t[0],t[t.length-1]);)t.pop(),n.pop();return{points:t,sourceIndex:n}}function mn(e,t,n){return lt(e,{cornerSmoothing:t,...n})}var st=.5,ct=4/3;function at(e,t,n){let o=t.x-e.x,r=t.y-e.y,i=Math.hypot(o,r);if(i<=1e-9)return{kind:"line",end:{...t}};let c=-r/i,u=o/i,s=n*ct;return{kind:"bezier",control1:{x:e.x+o/3+c*s,y:e.y+r/3+u*s},control2:{x:e.x+o*2/3+c*s,y:e.y+r*2/3+u*s},end:{...t}}}function lt(e,t){let{points:n,sourceIndex:o}=it(e),r=n.length;if(r<3)return null;let i=Math.min(100,Math.max(0,t.cornerSmoothing??0))/100,c=t.edgeCurvature,u=new Array(r).fill(0);if(c?.length)for(let l=0;l<r;l+=1){let P=c[o[l]];u[l]=Number.isFinite(P)?Math.min(100,Math.max(-100,P))/100:0}let s=u.some(l=>Math.abs(l)>1e-6);if(i<=0&&!s)return null;let d=t.wideAngleThresholdDeg??rt(i),a=[];for(let l=0;l<r;l+=1)a[l]=I(n[l],n[(l+1)%r]);let h=new Array(r).fill(0);for(let l=0;l<r;l+=1){let P=n[(l-1+r)%r],S=n[l],M=n[(l+1)%r],E={x:P.x-S.x,y:P.y-S.y},C={x:M.x-S.x,y:M.y-S.y},A=Math.hypot(E.x,E.y),_=Math.hypot(C.x,C.y);if(A<=1e-9||_<=1e-9)continue;let H=Math.min(1,Math.max(-1,(E.x*C.x+E.y*C.y)/(A*_))),D=Math.acos(H)*180/Math.PI;if(D<d)continue;let $=be((D-d)/(180-d));h[l]=i*$*.5*Math.min(A,_)}for(let l=0;l<r;l+=1){let P=(l+1)%r,S=h[l]+h[P];if(S>a[l]&&S>1e-9){let M=a[l]/S;h[l]*=M,h[P]*=M}}let m=new Array(r),b=new Array(r);for(let l=0;l<r;l+=1){let P=n[(l-1+r)%r],S=n[l],M=n[(l+1)%r];if(h[l]<=1e-6){m[l]={...S},b[l]={...S};continue}let E=I(S,P)||1,C=I(S,M)||1;m[l]={x:S.x+(P.x-S.x)/E*h[l],y:S.y+(P.y-S.y)/E*h[l]},b[l]={x:S.x+(M.x-S.x)/C*h[l],y:S.y+(M.y-S.y)/C*h[l]}}if(h.every(l=>l<=1e-6)&&!s)return null;let p=[],y={...b[0]},f=y,g=(l,P)=>{if(I(f,l)<=1e-9)return;let S=u[P];Math.abs(S)>1e-6?p.push(at(f,l,S*st*a[P])):p.push({kind:"line",end:{...l}}),f=l};for(let l=1;l<=r;l+=1){let P=l%r,S=n[P];g(m[P],(l-1)%r),h[P]>1e-6&&I(m[P],b[P])>1e-9&&(p.push({kind:"bezier",control1:O(m[P],S,xe),control2:O(b[P],S,xe),end:{...b[P]}}),f=b[P])}if(!p.length)return null;let w=p[p.length-1];I(w.end,y)>1e-9&&(w.kind==="line"?w.end={...y}:p.push({kind:"line",end:{...y}}));let x={version:1,closed:!0,start:y,segments:p};return Se(x)?x:null}function pn(e){let t=[],n=e.start;for(let r of e.segments)t.push(n),n=r.end;let o=[];for(let r=e.segments.length-1;r>=0;r-=1){let i=e.segments[r],c=t[r];i.kind==="line"?o.push({kind:"line",end:{...c}}):i.kind==="arc"?o.push({kind:"arc",center:{...i.center},radius:i.radius,clockwise:!i.clockwise,end:{...c}}):o.push({kind:"bezier",control1:{...i.control2},control2:{...i.control1},end:{...c}})}return{version:1,closed:!0,start:{...e.start},segments:o}}function bn(e,t,n){let o=[];for(let r=0;r<e.length-1;r+=1){let i=e[r],c=e[r+1],u=Math.hypot(c.x-i.x,c.y-i.y);if(u<=0)continue;let s=Math.max(1,Math.round(u/n)),d=u/s,a=Math.atan2(c.y-i.y,c.x-i.x),h=r===0,b=(r>0?t[r-1]:void 0)==="break"?2:1,p=h?{...i}:{x:i.x+Math.cos(a)*d*b,y:i.y+Math.sin(a)*d*b},y=h?s+1:Math.max(1,s-(b-1));o.push({origin:p,rotation:a*180/Math.PI,seatCount:y,seatSpacing:d})}return o}function xn(e){let t=e.rotation*Math.PI/180,n={x:Math.cos(t),y:Math.sin(t)};return Array.from({length:e.seatCount},(o,r)=>({x:e.origin.x+n.x*r*e.seatSpacing,y:e.origin.y+n.y*r*e.seatSpacing}))}function gn(e){return e.reduce((t,n)=>t+n.seatCount,0)}function Pe(e){let t=new Map,n=new Map;for(let o of e){if(o.type!=="row"||!o.segmentedRow)continue;let r=n.get(o.segmentedRow.groupId)??[];r.push(o),n.set(o.segmentedRow.groupId,r)}for(let[o,r]of n){let i=r.slice().sort((m,b)=>m.segmentedRow.componentIndex-b.segmentedRow.componentIndex),c=i[0]?.segmentedRow?.componentCount??0,u=i[0]?.segmentedRow;if(!u||!(c>=2&&i.length===c&&u?.boundaryBefore==="start"&&i.every((m,b)=>m.segmentedRow?.kind==="segmented-row-v1"&&m.segmentedRow.groupId===o&&m.segmentedRow.componentCount===c&&m.segmentedRow.componentIndex===b&&m.segmentedRow.repeatLabelOnComponents===u.repeatLabelOnComponents&&(b===0?m.segmentedRow.boundaryBefore==="start":m.segmentedRow.boundaryBefore!=="start")&&m.segmentedRow.displayLabel===u.displayLabel)))continue;let d=i.reduce((m,b)=>m+b.seatCount,0),a=0,h=0;for(let m of i)m.segmentedRow.boundaryBefore==="break"&&(a+=1),t.set(m.id,{groupId:o,adjacencyOffset:a,displayOffset:h,displayLabel:u.displayLabel,totalSeats:d,canonical:i[0],viewFromSeatUrl:u.viewFromSeatUrl,viewFromSeatMeta:u.viewFromSeatMeta,confidenceEvidence:u.confidenceEvidence}),a+=m.seatCount,h+=m.seatCount}return t}var Me="ABCDEFGHIJKLMNOPQRSTUVWXYZ",ut="ABCDEFGHJKLMNPQRSTUVWXYZ",ft="abcdefghijklmnopqrstuvwxyz";function ve(e,t){let n=t.length,o=e+1,r="";for(;o>0;){o-=1;let i=o%n;r=t[i]+r,o=Math.floor(o/n)}return r}function dt(e,t){let n=t.startAt-1,o=e+n;if(t.scheme==="numbers")return String(o+1);let r=t.skipAmbiguous?ut:Me;return ve(o,r)}function J(e,t=!1){let n=t?ft:Me;return ve(Math.max(0,Math.floor(e)-1),n)}var ht=[[1e3,"M"],[900,"CM"],[500,"D"],[400,"CD"],[100,"C"],[90,"XC"],[50,"L"],[40,"XL"],[10,"X"],[9,"IX"],[5,"V"],[4,"IV"],[1,"I"]];function Ie(e){if(!Number.isFinite(e)||e<=0)return String(e);let t=Math.floor(e),n="";for(let[o,r]of ht)for(;t>=o;)n+=r,t-=o;return n}function wn(e,t){let n=e.length;return e.map((o,r)=>{let i=t.reverse?n-1-r:r;return{...o,label:dt(i,t)}})}function mt(e){let t=new Array(e);return Array.from({length:e},(n,o)=>o).sort((n,o)=>Math.abs(2*n-(e-1))-Math.abs(2*o-(e-1))||n-o).forEach((n,o)=>t[n]=o),t}function Q(e,t){let n=e.seatLabelStart??1,o=e.seatNumbering?.direction??"ltr",r=e.seatNumbering?.step??1,i=e.seatNumbering?.scheme??"decimal",c=e.seatNumbering?.prefix??"",u=e.seatNumbering?.endAt,s=e.seatCount;if(i==="updown"||i==="updown-descending"){let b=Math.ceil(s/2),p=i==="updown"?t<b?n+2*t:n-1+2*(s-t):t<b?n+2*(b-1-t):n+1+2*(t-b);return`${c}${p}`}let d=i==="odd"||i==="even"?2:r,a=u!=null&&Number.isFinite(u)?u-(s-1)*d:n,h=o==="center"?mt(s)[t]:o==="rtl"?s-1-t:t,m;switch(i){case"odd":{let b=a%2===1?a:a+1;m=String(b+h*2);break}case"even":{let b=a%2===0?a:a+1;m=String(b+h*2);break}case"roman":m=Ie(a+h*r);break;case"letters-upper":m=J(a+h*r,!1);break;case"letters-lower":m=J(a+h*r,!0);break;default:m=String(a+h*r);break}return`${c}${m}`}function pt(e){return{...e.canonical,seatCount:e.totalSeats,label:e.displayLabel,displayLabel:e.displayLabel}}function Ee(e,t,n){return n?.label??`${e.label}-${Q(e,t)}`}function Z(e,t,n,o){if(o?.displayLabel)return o.displayLabel;if(!n)return`${e.displayLabel??e.label}-${Q(e,t)}`;let r=pt(n),i=n.displayOffset+t;return`${n.displayLabel}-${Q(r,i)}`}var G=.02291666666666667,In=1/G,yt=58,bt=yt*G,Ce=0,Te=3,Oe=0,ee=120,xt=0,gt=45,St=7,X=1.2;function te(e,t,n,o){return Number.isFinite(e)?Math.max(t,Math.min(n,e)):o}function En(e){return Number.isFinite(e)?Math.max(Ce,Math.min(Te,Math.round(e))):Ce}function wt(e){return!Number.isFinite(e)||!Number.isInteger(e)||e<0?0:e<=St?e:Te}function Re(e,t={}){let n=te(t.floorBaseHeightM,Oe,ee,0),o=Math.min(ee,n+wt(e.elevation)*bt),r=e.height===void 0?o:te(e.height,Oe,ee,o),i=te(e.rake,xt,gt,0);return{height:r,rake:i}}function Ae(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 _e(e,t,n){if(!e.length)return 1/0;if(e.length===1)return Math.hypot(t-e[0].x,n-e[0].y);let o=1/0;for(let r=0;r+1<e.length;r++){let i=e[r],c=e[r+1],u=c.x-i.x,s=c.y-i.y,d=u*u+s*s,a=d>1e-12?((t-i.x)*u+(n-i.y)*s)/d:0;a<0?a=0:a>1&&(a=1);let h=Math.hypot(t-(i.x+a*u),n-(i.y+a*s));h<o&&(o=h)}return o}function Pt(e){let t=0,n=0;for(let i of e)t+=i.x,n+=i.y;let o=e.length||1;t/=o,n/=o;let r=0;for(let i of e){let c=Math.hypot(i.x-t,i.y-n);c>r&&(r=c)}return{cx:t,cy:n,r}}function Le(e,t){return Math.hypot(e.cx-t.cx,e.cy-t.cy)-e.r-t.r}function ne(e,t){let n=1/0;for(let o of Ae(e)){let r=_e(t,o.x,o.y);r<n&&(n=r)}for(let o of Ae(t)){let r=_e(e,o.x,o.y);r<n&&(n=r)}return n}function Mt(e,t){if(e.length<3)return{pts:e,seatIndices:t};let n=0,o=0;for(let a of e)n+=a.x,o+=a.y;n/=e.length,o/=e.length;let r=-1,i=e[0];for(let a of e){let h=Math.hypot(a.x-n,a.y-o);h>r&&(r=h,i=a)}let c=i.x-n,u=i.y-o,s=Math.hypot(c,u);s>1e-9?(c/=s,u/=s):(c=1,u=0);let d=e.map((a,h)=>({p:a,i:h,t:(a.x-n)*c+(a.y-o)*u})).sort((a,h)=>a.t-h.t);return{pts:d.map(a=>a.p),seatIndices:d.map(a=>t[a.i])}}function vt(e){let t=e.length;if(t<3)return null;let n=0,o=0;for(let w of e)n+=w.x,o+=w.y;n/=t,o/=t;let r=0,i=0,c=0,u=0,s=0,d=0,a=0;for(let w of e){let x=w.x-n,l=w.y-o;r+=x*x,c+=l*l,i+=x*l,u+=x*x*x,s+=l*l*l,d+=x*l*l,a+=l*x*x}let h=r*c-i*i;if(Math.abs(h)<1e-9)return null;let m=(u+d)/2,b=(s+a)/2,p=(m*c-b*i)/h,y=(b*r-m*i)/h,f=p+n,g=y+o;return!Number.isFinite(f)||!Number.isFinite(g)?null:{cx:f,cy:g}}var It=.15;function Et(e){if(e.length<2)return null;let t=e.map(w=>{let x=0,l=0;for(let P of w.pts)x+=P.x,l+=P.y;return{x:x/w.pts.length,y:l/w.pts.length}}),n=0,o=0;for(let w of t)n+=w.x,o+=w.y;n/=t.length,o/=t.length;let r=0,i=0,c=0;for(let w of t){let x=w.x-n,l=w.y-o;r+=x*x,i+=x*l,c+=l*l}let u=r+c,s=r*c-i*i,d=u/2+Math.sqrt(Math.max(0,u*u/4-s)),a,h;Math.abs(i)>1e-12?(a=d-c,h=i):r>=c?(a=1,h=0):(a=0,h=1);let m=Math.hypot(a,h);if(!(m>1e-12))return null;a/=m,h/=m;let b=1/0,p=-1/0,y=[];for(let w of e){let x=1/0,l=-1/0;for(let P of w.pts){let S=P.x*a+P.y*h;S<x&&(x=S),S>l&&(l=S),S<b&&(b=S),S>p&&(p=S)}y.push(l-x)}let f=p-b;return f>1e-9?(y.sort((w,x)=>w-x),y[Math.min(y.length-1,Math.floor(y.length*.9))]/f<=Ct?{x:a,y:h}:null):null}var Ct=.35;function ke(e,t,n,o){let r=new Map;for(let f of n){let g=t[f],w=g.rowId||`__seat-${f}`,x=r.get(w);x||(x={pts:[],idx:[]},r.set(w,x)),x.pts.push({x:g.x,y:g.y}),x.idx.push(f)}if(!r.size)return{sectionId:e,rows:[],blockCount:0};let i=[];for(let[f,g]of r){let w=Mt(g.pts,g.idx),x=0;for(let l of w.pts)x+=Math.hypot(l.x-o.x,l.y-o.y);i.push({id:f,pts:w.pts,seatIndices:w.seatIndices,blockId:-1,ordinal:0,blockDepth:0,focalDistance:x/w.pts.length})}let c=i.map(f=>Pt(f.pts)),u=[];for(let f=0;f<i.length;f++){let g=1/0;for(let w=0;w<i.length;w++){if(f===w||Le(c[f],c[w])>=g)continue;let x=ne(i[f].pts,i[w].pts);x<g&&(g=x)}Number.isFinite(g)&&u.push(g)}u.sort((f,g)=>f-g);let s=u.length?u[Math.floor(u.length/2)]:1,d=Math.max(s*1.8,1e-6),a=i.map(()=>[]);for(let f=0;f<i.length;f++)for(let g=f+1;g<i.length;g++)Le(c[f],c[g])>d||ne(i[f].pts,i[g].pts)<=d&&(a[f].push(g),a[g].push(f));let h=0;for(let f=0;f<i.length;f++){if(i[f].blockId!==-1)continue;let g=h++,w=[f];for(i[f].blockId=g;w.length;){let x=w.pop();for(let l of a[x])i[l].blockId===-1&&(i[l].blockId=g,w.push(l))}}let m=new Map;for(let f of i){let g=m.get(f.blockId)??[];g.push(f),m.set(f.blockId,g)}let b=[];for(let f of i){if(f.pts.length<4)continue;let g=vt(f.pts);g&&(!Number.isFinite(g.cx)||!Number.isFinite(g.cy)||b.push({x:g.cx,y:g.cy}))}let p=b.length>=2?(()=>{let f=b.map(x=>x.x).sort((x,l)=>x-l),g=b.map(x=>x.y).sort((x,l)=>x-l),w=Math.floor(b.length/2);return{cx:f[w],cy:g[w]}})():null;if(p){let f=S=>Math.hypot(S.x-p.cx,S.y-p.cy),g=1/0,w=-1/0,x=[];for(let S of i){let M=1/0,E=-1/0;for(let C of S.pts){let A=f(C);A<M&&(M=A),A>E&&(E=A)}x.push(E-M),M<g&&(g=M),E>w&&(w=E)}let l=w-g;x.sort((S,M)=>S-M);let P=x[Math.min(x.length-1,Math.floor(x.length*.9))];if(l>1e-9&&P/l<=It){let S=i.map(v=>{let U=0;for(let Xe of v.pts)U+=f(Xe);return{row:v,radius:U/v.pts.length}}),M=0,E=0;for(let v of S)M+=v.radius,E+=v.row.focalDistance;M/=S.length,E/=S.length;let C=0;for(let v of S)C+=(v.radius-M)*(v.row.focalDistance-E);if(C<0)for(let v of S)v.radius=-v.radius;let _=1/0;for(let v of S)v.radius<_&&(_=v.radius);S.sort((v,U)=>v.radius-U.radius);let H=-1,D=-1/0,$=l/Math.max(1,S.length)*.5,ie=[];for(let v of S)v.radius-D>$&&(H++,D=v.radius),v.row.ordinal=H,v.row.blockDepth=v.radius-_,ie.push(v.row);return{sectionId:e,rows:ie,blockCount:h}}}let y=[];for(let[,f]of m){let g=Et(f);if(g){let w=l=>{let P=0;for(let S of l.pts)P+=S.x*g.x+S.y*g.y;return P/l.pts.length};f.sort((l,P)=>w(l)-w(P)),f.length>=2&&f[0].focalDistance>f[f.length-1].focalDistance&&f.reverse();let x=0;for(let l=0;l<f.length;l++)l>0&&(x+=ne(f[l-1].pts,f[l].pts)),f[l].ordinal=l,f[l].blockDepth=x,y.push(f[l])}else{let w=1/0;for(let x of f)x.focalDistance<w&&(w=x.focalDistance);f.sort((x,l)=>x.focalDistance-l.focalDistance);for(let x=0;x<f.length;x++)f[x].ordinal=x,f[x].blockDepth=Math.max(0,f[x].focalDistance-w),y.push(f[x])}}return{sectionId:e,rows:y,blockCount:h}}function He(e){return e?e.accessibility&&e.accessibility.length?e.wheelchairSpaceType&&!e.accessibility.includes("wheelchair")?["wheelchair",...e.accessibility]:e.accessibility:e.wheelchairSpaceType?["wheelchair"]:e.accessible?["wheelchair"]:[]:[]}var K=Math.PI/180,Ot=9,N=16;function re(e,t,n,o){let r=n*K,i=Math.cos(r),c=Math.sin(r);return{x:o.x+e*i-t*c,y:o.y+e*c+t*i}}function Ue(e){let{seatCount:t,seatSpacing:n,curve:o,rotation:r,origin:i}=e,c=[];if(e.path)return fe(e.path,t);if(t<=1)return t===1&&c.push({x:i.x,y:i.y}),c;if(o===0){for(let d=0;d<t;d++)c.push(re(d*n,0,r,i));return c}let u=o/(t-1)*K,s=n/(2*Math.sin(Math.abs(u)/2));for(let d=0;d<t;d++){let a=d*u,h=s*Math.sin(a),m=-s+s*Math.cos(a);c.push(re(h,m,r,i))}return c}function Tt(e){let t=new Map;if(e.overrides)for(let n of e.overrides)t.set(n.index,n);return t}function Fn(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 Rt(e,t){let n=Tt(e);return Ue(e).map((o,r)=>{let i=n.get(r),c=He(i),u=Ee(e,r,i),s={...e.commercial,...i?.commercial};return{index:r,x:o.x+(i?.dx??0),y:o.y+(i?.dy??0),label:u,displayLabel:Z(e,r,t,i),categoryKey:i?.categoryKey??e.categoryKey,skipped:!!i?.skip,accessible:c.length>0,accessibility:c,wheelchairSpaceType:i?.wheelchairSpaceType,commercial:Object.values(s).some(d=>d!==void 0&&d!==!1&&d!=="")?s:void 0,glyph:i?.glyph,viewUrl:i?.viewFromSeatUrl??e.viewFromSeatUrl,viewMeta:i?.viewFromSeatUrl?i.viewFromSeatMeta:e.viewFromSeatMeta,labelStyle:i?.labelStyle}})}function Be(e){let t=[];for(let n of Rt(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 At(e){if(e.seatCountsBySide)return{...e.seatCountsBySide};let t=e.sides&&e.sides.length?e.sides:["top","bottom"],n=["top","bottom","left","right"].filter(i=>t.includes(i)),o={top:0,bottom:0,left:0,right:0};if(!n.length)return o;let r=Math.max(0,Math.round(e.seatCount));for(let i=0;i<r;i++)o[n[i%n.length]]+=1;return o}function Ge(e){let t=[],n=Math.max(0,Math.round(e.seatCount));if(n===0)return t;let o=new Map((e.overrides??[]).map(a=>[a.index,a])),r=(a,h,m,b)=>{let p=o.get(a),y=He(p),f=p?.label??`${e.label}-${a+1}`,g=e.displayLabel??e.label;return{index:a,label:f,displayLabel:p?.displayLabel??`${g}-${a+1}`,x:h+(p?.dx??0),y:m+(p?.dy??0),categoryKey:p?.categoryKey??e.categoryKey,skipped:!!p?.skip,accessible:y.length>0,accessibility:y,wheelchairSpaceType:p?.wheelchairSpaceType,commercial:p?.commercial,glyph:p?.glyph,viewUrl:p?.viewFromSeatUrl,viewMeta:p?.viewFromSeatUrl?p.viewFromSeatMeta:void 0,labelStyle:p?.labelStyle,...b?{side:b}:{}}};if(e.shape==="round"){let a=(e.radius??40)+N,h=e.rotation*K,m=Math.max(0,Math.min(360,e.seatArc??360));if(m>=360||n===1){for(let f=0;f<n;f++){let g=h+f/n*2*Math.PI;t.push(r(f,e.center.x+a*Math.cos(g),e.center.y+a*Math.sin(g)))}return t}let b=m*K,p=(2*Math.PI-b)/2,y=h+p;for(let f=0;f<n;f++){let g=y+f/(n-1)*b;t.push(r(f,e.center.x+a*Math.cos(g),e.center.y+a*Math.sin(g)))}return t}let i=e.width??80,c=e.height??50,u=At(e),s=["top","bottom","left","right"],d=0;for(let a of s){let h=u[a];for(let m=0;m<h;m++){let b,p;a==="top"?(b=-i/2+(m+.5)*i/h,p=-c/2-N):a==="bottom"?(b=-i/2+(m+.5)*i/h,p=c/2+N):a==="left"?(b=-i/2-N,p=-c/2+(m+.5)*c/h):(b=i/2+N,p=-c/2+(m+.5)*c/h);let y=re(b,p,e.rotation,e.center);t.push(r(d++,y.x,y.y,a))}}return t}function Hn(e){return e.bookAsWhole||e.variableOccupancy?Math.max(0,Math.round(e.seatCount)):Ge(e).filter(t=>!t.skipped).length}function _t(e){return Ge(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 Lt(e){return[{id:`${e.id}:0`,label:e.label,...e.displayLabel&&e.displayLabel!==e.label?{displayLabel:e.displayLabel}:{},x:e.center.x,y:e.center.y,rowId:e.id,categoryKey:e.categoryKey,kind:"booth"}]}function je(e,t){let n=!1;for(let o=0,r=t.length-1;o<t.length;r=o++){let i=t[o].x,c=t[o].y,u=t[r].x,s=t[r].y;c>e.y!=s>e.y&&e.x<(u-i)*(e.y-c)/(s-c)+i&&(n=!n)}return n}function kt(e,t){return t.some((n,o)=>{let r=t[(o+1)%t.length],i=(e.y-n.y)*(r.x-n.x)-(e.x-n.x)*(r.y-n.y);if(Math.abs(i)>1e-7)return!1;let c=(e.x-n.x)*(r.x-n.x)+(e.y-n.y)*(r.y-n.y),u=(r.x-n.x)**2+(r.y-n.y)**2;return c>=-1e-7&&c<=u+1e-7})}function V(e,t,n){return je(e,t)&&!(n??[]).some(o=>je(e,o)||kt(e,o))}function Un(e,t){return ye(e,t).point}function oe(e){if(!e.length)return{x:0,y:0};let t=0,n=0;for(let o of e)t+=o.x,n+=o.y;return{x:t/e.length,y:n/e.length}}function jt(e){switch(e.type){case"row":{let t=Be(e);if(!t.length)return{x:e.origin.x,y:e.origin.y};let n=0,o=0;for(let r of t)n+=r.x,o+=r.y;return{x:n/t.length,y:o/t.length}}case"table":case"booth":return{x:e.center.x,y:e.center.y};case"gaArea":return oe(e.points);case"section":return oe(e.outline);case"text":return{x:e.position.x,y:e.position.y};case"shape":return e.points&&e.points.length?oe(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 Ne(e,t){return e.length===t.length&&e.every((n,o)=>n.x===t[o].x&&n.y===t[o].y)}function Nt(e,t){if(e.type!=="gaArea"||!Ne(e.points,t.outline))return!1;let n=e.holes??[],o=t.holes??[];return n.length===o.length&&n.every((r,i)=>Ne(r,o[i]))}function Dt(e,t){let n=e.filter(c=>c.type==="section"),o="referenceInventorySource"in t?t.referenceInventorySource?.logicalSectionId:void 0,r=jt(t);return(o?n.find(c=>(c.logicalSectionId??c.id)===o&&(Nt(t,c)||V(r,c.outline,c.holes))):void 0)??n.find(c=>V(r,c.outline,c.holes))}function Ft(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 Bn(e,t){let n=Ft(e);return(t?n.find(o=>o.id===t):n[0])?.objects??[]}function Ht(e){return e.floors&&e.floors.length?e.floors.flatMap(t=>t.objects):e.objects}function Ut(e,t,n){let o=i=>({x:i.x+t,y:i.y+n}),r=i=>i.map(o);switch(e.type){case"row":return{...e,origin:o(e.origin)};case"table":case"booth":return{...e,center:o(e.center)};case"gaArea":return{...e,points:r(e.points),...e.holes?{holes:e.holes.map(r)}:{}};case"section":return{...e,outline:r(e.outline),...e.outlinePath?{outlinePath:we(e.outlinePath,t,n)}:{},...e.holes?{holes:e.holes.map(r)}:{}};case"text":return{...e,position:o(e.position)};case"shape":return{...e,...e.points?{points:r(e.points)}:{},...e.x!=null?{x:e.x+t}:{},...e.y!=null?{y:e.y+n}:{}};case"decorImage":return{...e,x:e.x+t,y:e.y+n}}}function Gn(e,t=900){if(!e.floors||e.floors.length<2)return e;let n=[];return e.floors.forEach((o,r)=>{let i=-r*t;for(let c of o.objects)n.push(i===0?c:Ut(c,0,i))}),{...e,objects:n,floors:void 0}}function De(e,t,n,o,r,i,c,u,s){let d=[],a=Pe(e),h=p=>!p?.eventConfigurationId||p.eventConfigurationId===o&&(p.eventConfigurationVersion===void 0||p.eventConfigurationVersion===s),m=p=>se(p,{activeConfigurationId:o,activeConfigurationVersion:s,activeBasisSha256:r,now:u}),b=(p,y)=>m(p)?{...p,coverage:y}:void 0;for(let p of e){let y=[];if(p.type==="row"?y=Be(p):p.type==="table"?y=_t(p):p.type==="booth"&&(y=Lt(p)),!y.length)continue;for(let l of y)l.viewUrl&&!h(l.viewMeta)&&(l.viewUrl=void 0,l.viewMeta=void 0);if(p.type==="row"){let l=a.get(p.id);if(l){let P=new Map((p.overrides??[]).map(S=>[S.index,S]));for(let S of y){let M=Number(S.id.slice(S.id.lastIndexOf(":")+1));if(!Number.isInteger(M))continue;S.logicalRowId=l.groupId,S.logicalSeatIndex=l.adjacencyOffset+M,P.get(M)?.displayLabel||(S.displayLabel=Z(p,M,l)),!S.viewUrl&&l.viewFromSeatUrl&&h(l.viewFromSeatMeta)&&(S.viewUrl=l.viewFromSeatUrl,S.viewMeta=l.viewFromSeatMeta);let E=P.get(M)?.confidenceEvidence;S.confidenceEvidence=b(E,"exact-seat")??b(p.confidenceEvidence,"row-representative")??b(l.confidenceEvidence,"row-representative")}}}let f=Dt(e,p),g=f?.viewFromSeatUrl,x=(f?.zone?t?.find(l=>l.id===f.zone):void 0)?.focalPoint??n;for(let l of y){if(!l.confidenceEvidence){let P=Number(l.id.slice(l.id.lastIndexOf(":")+1)),S=(p.type==="row"||p.type==="table")&&Number.isInteger(P)?p.overrides?.find(M=>M.index===P)?.confidenceEvidence:void 0;l.confidenceEvidence=b(S,"exact-seat")??(p.type==="row"?b(p.confidenceEvidence,"row-representative"):void 0)}l.confidenceEvidence??=b(f?.confidenceEvidence,"section-representative")??(c?b(c.evidence,c.coverage):void 0),!l.viewUrl&&g&&h(f?.viewFromSeatMeta)&&(l.viewUrl=g,l.viewMeta=f?.viewFromSeatMeta),!l.viewUrl&&i&&h(i.meta)&&(l.viewUrl=i.url,l.viewMeta=i.meta),f&&(l.sectionId=f.logicalSectionId??f.id),f?.zone&&(l.zoneId=f.zone),x&&(l.focalPoint={...x})}d.push(...y)}return d}function Xn(e,t={}){if(e.floors?.length){let o=[];for(let r of e.floors){let i=r.focalPoint??e.focalPoint,c=r.viewFromSeatUrl?{url:r.viewFromSeatUrl,meta:r.viewFromSeatMeta}:e.viewFromSeatUrl?{url:e.viewFromSeatUrl,meta:e.viewFromSeatMeta}:void 0,u=r.confidenceEvidence?{evidence:r.confidenceEvidence,coverage:"floor-representative"}:e.confidenceEvidence?{evidence:e.confidenceEvidence,coverage:"venue-representative"}:void 0,s=De(r.objects,e.zones,i,e.eventConfigurationId,e.confidenceBasisSha256,c,u,t.now,t.eventConfigurationVersion??e.eventConfigurationVersion);t.resolveEyeHeights!==!1&&Fe(r.objects,r.focalPoint??e.focalPoint,r.baseHeightM??0,s);for(let d of s)d.floorId=r.id;o.push(...s)}return o}let n=De(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&&Fe(e.objects,e.focalPoint,t.floorBaseHeightM??0,n),n}function Fe(e,t,n,o){let r=e.filter(a=>a.type==="section"),i=n>0||r.some(a=>a.height!==void 0||a.rake!==void 0||(a.elevation??0)>0);if(!r.length||!i||!t){for(let a of o)a.eyeHeightM=n+X;return}let c=new Array(o.length),u=new Map,s=new Map;for(let a=0;a<o.length;a++){let h=o[a],b=(h.sectionId?r.find(y=>y.id===h.sectionId)??r.find(y=>y.logicalSectionId===h.sectionId&&V({x:h.x,y:h.y},y.outline,y.holes)):void 0)??r.find(y=>V({x:h.x,y:h.y},y.outline,y.holes))??null;if(c[a]=b,!b)continue;u.has(b.id)||u.set(b.id,Re(b,{floorBaseHeightM:n}));let p=s.get(b.id);p?p.push(a):s.set(b.id,[a])}let d=new Array(o.length).fill(void 0);for(let[a,h]of s){let m=u.get(a);if(!m)continue;let b=m.rake>0?Math.tan(m.rake*Math.PI/180):0,p=ke(a,o,h,t);for(let y of p.rows){let f=y.blockDepth*G*b,g=m.height+f;for(let w of y.seatIndices)d[w]=g}}for(let a=0;a<o.length;a++){let h=o[a],m=c[a];if(!m){h.eyeHeightM=n+X;continue}let b=u.get(m.id);h.eyeHeightM=(d[a]??b.height)+X}}var z=40;function zn(e,t){let n=t?.freeText==="exclude",o=1/0,r=1/0,i=-1/0,c=-1/0,u=(s,d)=>{s<o&&(o=s),d<r&&(r=d),s>i&&(i=s),d>c&&(c=d)};for(let s of Ht(e))if(s.type==="row"){let d=new Map((s.overrides??[]).map(a=>[a.index,a]));Ue(s).forEach((a,h)=>{let m=d.get(h);m?.skip||u(a.x+(m?.dx??0),a.y+(m?.dy??0))})}else if(s.type==="gaArea")for(let d of s.points)u(d.x,d.y);else if(s.type==="section")for(let d of s.outline)u(d.x,d.y);else if(s.type==="decorImage")u(s.x,s.y),u(s.x+s.width,s.y+s.height);else if(s.type==="shape")if(s.points&&s.points.length)for(let d of s.points)u(d.x,d.y);else s.x!=null&&s.y!=null&&s.width!=null&&s.height!=null&&(u(s.x,s.y),u(s.x+s.width,s.y+s.height));else if(s.type==="table"){let d=N+Ot,a=s.shape==="round"?(s.radius??40)+d:Math.max((s.width??80)/2,(s.height??50)/2)+d;u(s.center.x-a,s.center.y-a),u(s.center.x+a,s.center.y+a)}else if(s.type==="booth"){let d=Math.max(s.width,s.height)/2;u(s.center.x-d,s.center.y-d),u(s.center.x+d,s.center.y+d)}else if(s.type==="text"){if(n)continue;let d=ae(s);u(s.position.x,s.position.y),u(s.position.x+d.width,s.position.y+d.height)}for(let s of[e.referenceImage,e.backgroundImage]){if(!s)continue;let{center:d,width:a}=s,h=a*3/4;u(d.x-a/2,d.y-h/2),u(d.x+a/2,d.y+h/2)}if(!isFinite(o)){let s=e.focalPoint??{x:0,y:0};return{x:s.x-200,y:s.y-200,width:400,height:400}}return{x:o-z,y:r-z,width:i-o+z*2,height:c-r+z*2}}export{Bt as a,Gt as b,Xt as c,zt as d,Kt as e,Vt as f,$t as g,Wt as h,Yt as i,ae as j,Jt as k,$e as l,Qt as m,W as n,tn as o,fe as p,nn as q,on as r,Ye as s,pe as t,sn as u,ye as v,Je as w,an as x,dn as y,Se as z,hn as A,we as B,tt as C,nt as D,rt as E,mn as F,st as G,lt as H,pn as I,bn as J,xn as K,gn as L,Pe as M,ve as N,dt as O,J as P,Ie as Q,wn as R,Q as S,pt as T,Ee as U,Z as V,G as W,In as X,bt as Y,Ce as Z,Te as _,Oe as $,ee as aa,xt as ba,gt as ca,St as da,X as ea,En as fa,Re as ga,_e as ha,vt as ia,ke as ja,N as ka,Ue as la,Fn as ma,Rt as na,Be as oa,At as pa,Ge as qa,Hn as ra,_t as sa,Lt as ta,je as ua,V as va,Un as wa,jt as xa,Dt as ya,Ft as za,Bn as Aa,Ht as Ba,Ut as Ca,Gn as Da,Xn as Ea,zn as Fa};
|
|
1
|
+
import{c as se}from"./chunk-CRCGO52K.js";var Bt=40,Gt=1200,Xt=.8,zt=3,Kt=-2,Vt=20,$t=.1,Wt=40,Yt=40,ce=e=>Math.max(1,e.fontSize*.6+(e.letterSpacing??0));function ze(e,t){let n=e.text.split(/\r?\n/);if(!e.width)return Math.max(1,n.length);let o=Math.max(1,Math.floor(t/ce(e))),r=0;for(let i of n){if(!i.length){r+=1;continue}let c=0;for(let u of i.split(/\s+/)){let s=u.length;c&&c+1+s<=o?c+=1+s:(r+=Math.max(1,Math.ceil(s/o)),c=s%o)}}return Math.max(1,r)}function ae(e){let t=e.background?.padding??0,n=e.text.split(/\r?\n/),o=Math.max(1,...n.map(u=>u.length))*ce(e),r=e.width??o+t*2,i=Math.max(1,r-t*2),c=ze(e,i);return{width:r,height:c*e.fontSize*(e.lineHeight??1.2)+t*2,lineCount:c,padding:t}}var Ke=Math.PI/180;function I(e,t){return Math.hypot(e.x-t.x,e.y-t.y)}function Ve(e,t,n){let o=Math.cos(n),r=Math.sin(n),i=e.x-t.x,c=e.y-t.y;return{x:t.x+i*o-c*r,y:t.y+i*r+c*o}}function Jt(e,t){return Ve(e,{x:0,y:0},t*Ke)}function O(e,t,n){return{x:e.x+(t.x-e.x)*n,y:e.y+(t.y-e.y)*n}}function $e(e){let t=0,n=0;for(let r of e)t+=r.x,n+=r.y;let o=e.length||1;return{x:t/o,y:n/o}}function Qt(e){return e.length?$e(e):null}function W(e,t){let n=1-t,o=n*n*n,r=3*n*n*t,i=3*n*t*t,c=t*t*t;return{x:o*e.start.x+r*e.control1.x+i*e.control2.x+c*e.end.x,y:o*e.start.y+r*e.control1.y+i*e.control2.y+c*e.end.y}}function tn(e,t,n){let o={x:(e.x+t.x)/2,y:(e.y+t.y)/2},r={x:(n.x-o.x)*4/3,y:(n.y-o.y)*4/3};return{start:{...e},control1:{x:e.x+(t.x-e.x)/3+r.x,y:e.y+(t.y-e.y)/3+r.y},control2:{x:e.x+(t.x-e.x)*2/3+r.x,y:e.y+(t.y-e.y)*2/3+r.y},end:{...t}}}function fe(e,t,n=192){if(!Number.isInteger(t)||t<1)throw new Error("Path point count must be a positive integer");if(t===1)return[W(e,.5)];let o=Array.from({length:n+1},(s,d)=>W(e,d/n)),r=new Float64Array(o.length);for(let s=1;s<o.length;s+=1){let d=o[s].x-o[s-1].x,a=o[s].y-o[s-1].y;r[s]=r[s-1]+Math.hypot(d,a)}let i=r[r.length-1];if(i<=1e-9)return Array.from({length:t},()=>({...e.start}));let c=[],u=1;for(let s=0;s<t;s+=1){let d=i*s/(t-1);for(;u<r.length-1&&r[u]<d;)u+=1;let a=r[u-1],h=r[u],m=h===a?0:(d-a)/(h-a);c.push({x:o[u-1].x+(o[u].x-o[u-1].x)*m,y:o[u-1].y+(o[u].y-o[u-1].y)*m})}return c}function T(e,t){return{x:e.x+t.x,y:e.y+t.y}}function F(e,t){return{x:e.x-t.x,y:e.y-t.y}}function R(e,t){return{x:e.x*t,y:e.y*t}}function B(e,t=13){return Array.from({length:t},(n,o)=>W(e,o/(t-1)))}function le(e,t){let n=Math.max(0,Math.min(1,t))*(e.length-1),o=Math.min(e.length-2,Math.floor(n));return O(e[o],e[o+1],n-o)}function ue(e,t,n){let o=Math.max(0,Math.min(1,t)),r=Math.max(o,Math.min(1,n)),i=[le(e,o)];for(let c=1;c<e.length-1;c+=1){let u=c/(e.length-1);u>o+1e-9&&u<r-1e-9&&i.push(e[c])}return i.push(le(e,r)),i}function de(e,t){let n=[[0,1],[1,2],[2,3],[3,0]],o=0,r=Number.POSITIVE_INFINITY;n.forEach(([m,b],p)=>{let y=I(O(e[m],e[b],.5),t);y<r&&(r=y,o=p)});let i=e[o],c=e[(o+1)%4],u=e[(o+2)%4],s=e[(o+3)%4],d=O(i,c,.5),a=F(t,d),h=Math.max(1e-9,Math.hypot(a.x,a.y));return{p0:i,p1:c,p2:u,p3:s,normal:R(a,1/h),depth:(I(i,s)+I(c,u))/2}}function he(e){let{p0:t,p1:n,p2:o,p3:r,normal:i,depth:c}=e,u=F(n,t),s=F(o,r),d=c*.22,a=c*.12;return{nearPath:{start:t,control1:T(T(t,R(u,1/3)),R(i,d)),control2:T(T(t,R(u,2/3)),R(i,d)),end:n},farPath:{start:o,control1:T(T(r,R(s,2/3)),R(i,a)),control2:T(T(r,R(s,1/3)),R(i,a)),end:r}}}function nn(e,t,n){if(e.length!==4)throw new Error("A section shell requires four mapped bounds corners");let o=e.reduce((p,y)=>T(p,y),{x:0,y:0});o.x/=4,o.y/=4;let r=I(e[0],e[1]),i=I(e[0],e[3]),c=n==="auto"?r>i*1.25&&I(o,t)>i?"bezier":"tapered":n;if(c==="rectangle")return{mode:c,outline:e.map(p=>({...p}))};let u=de(e,t),{p0:s,p1:d,p2:a,p3:h}=u;if(c==="tapered")return{mode:c,outline:[T(s,R(F(d,s),.14)),T(s,R(F(d,s),1-.14)),a,h]};let{nearPath:m,farPath:b}=he(u);return{mode:c,outline:[...B(m),...B(b).slice(1)]}}function on(e,t,n,o){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 r=de(e,t),{p0:i,p1:c,p2:u,p3:s}=r,d=o==="bezier"?he(r):null,a=d?B(d.nearPath):null,h=d?B(d.farPath).reverse():null,m=Math.min(.055,.18/(n+1));return Array.from({length:n},(b,p)=>{let y=(p+1)/(n+1),f=y-m/2,g=y+m/2;return a&&h?[...ue(a,f,g),...ue(h,f,g).reverse()]:[O(i,c,f),O(i,c,g),O(s,u,g),O(s,u,f)]})}function We(e,t,n){let o=n.x-t.x,r=n.y-t.y,i=o*o+r*r,c=i?Math.max(0,Math.min(1,((e.x-t.x)*o+(e.y-t.y)*r)/i)):0;return Math.hypot(e.x-(t.x+c*o),e.y-(t.y+c*r))}function Ye(e,t){let n=1/0;for(let o of t)if(!(o.length<2))for(let r=0,i=o.length-1;r<o.length;i=r++){let c=We(e,o[i],o[r]);c<n&&(n=c)}return n}function me(e,t){let n=!1;for(let o=0,r=t.length-1;o<t.length;r=o++){let i=t[o].x,c=t[o].y,u=t[r].x,s=t[r].y;c>e.y!=s>e.y&&e.x<(u-i)*(e.y-c)/(s-c)+i&&(n=!n)}return n}function qe(e,t,n){let o=me(e,t)&&!n.some(i=>me(e,i)),r=Ye(e,[t,...n]);return o?r:-r}function L(e,t,n,o,r){let i=qe({x:e,y:t},o,r);return{x:e,y:t,h:n,d:i,max:i+n*Math.SQRT2}}var Y=class{constructor(){this.items=[]}get size(){return this.items.length}push(t){let n=this.items;n.push(t);let o=n.length-1;for(;o>0;){let r=o-1>>1;if(n[r].max>=n[o].max)break;[n[r],n[o]]=[n[o],n[r]],o=r}}pop(){let t=this.items,n=t[0],o=t.pop();if(t.length&&o){t[0]=o;let r=0;for(;;){let i=r*2+1,c=i+1,u=r;if(i<t.length&&t[i].max>t[u].max&&(u=i),c<t.length&&t[c].max>t[u].max&&(u=c),u===r)break;[t[u],t[r]]=[t[r],t[u]],r=u}}return n}};function pe(e){if(e.length<3)return 0;let t=0;for(let n=0,o=e.length-1;n<e.length;o=n++)t+=(e[o].x+e[n].x)*(e[o].y-e[n].y);return Math.abs(t)/2}function sn(e,t){return Math.max(0,pe(e)-(t??[]).reduce((n,o)=>n+pe(o),0))}function ye(e,t){let n=t??[];if(!e.length)return{point:{x:0,y:0},radius:0};if(e.length<3){let y=e.reduce((g,w)=>g+w.x,0)/e.length,f=e.reduce((g,w)=>g+w.y,0)/e.length;return{point:{x:y,y:f},radius:0}}let o=1/0,r=1/0,i=-1/0,c=-1/0;for(let y of e)y.x<o&&(o=y.x),y.y<r&&(r=y.y),y.x>i&&(i=y.x),y.y>c&&(c=y.y);let u=i-o,s=c-r,d=Math.min(u,s);if(!(d>0))return{point:{x:(o+i)/2,y:(r+c)/2},radius:0};let a=Math.max(u,s)/150,h=new Y,m=d/2;for(let y=o;y<i;y+=d)for(let f=r;f<c;f+=d)h.push(L(y+m,f+m,m,e,n));let b=L(o+u/2,r+s/2,0,e,n),p=0;for(;h.size;){let y=h.pop();if(!y)break;y.d>b.d&&(b=y),!(y.max-b.d<=a)&&(p>=4e3||(p+=1,m=y.h/2,h.push(L(y.x-m,y.y-m,m,e,n)),h.push(L(y.x+m,y.y-m,m,e,n)),h.push(L(y.x-m,y.y+m,m,e,n)),h.push(L(y.x+m,y.y+m,m,e,n))))}return{point:{x:b.x,y:b.y},radius:Math.max(0,b.d)}}function Je(e,t,n){return Math.max(t,Math.min(n,e))}function an(e,t,n){return e<t?t:e>n?n:e}function Qe(e){return Je(e,0,1)}function be(e){let t=Qe(e);return t*t*(3-2*t)}var k=Math.PI*2;function j(e){return Number.isFinite(e.x)&&Number.isFinite(e.y)}function Ze(e,t,n){let o=t-e;if(n){for(;o<0;)o+=k;for(;o>=k;)o-=k}else{for(;o>0;)o-=k;for(;o<=-k;)o+=k}return o}function dn(e){return e.end}function Se(e){if(e.version!==1||e.closed!==!0||!j(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||!j(n.end))return!1;if(n.kind==="line"){if(I(t,n.end)<=1e-9)return!1}else if(n.kind==="bezier"){if(!j(n.control1)||!j(n.control2)||I(t,n.end)<=1e-9)return!1}else if(n.kind==="arc"){if(!j(n.center)||!Number.isFinite(n.radius)||n.radius<=1e-6||Math.abs(I(t,n.center)-n.radius)>Math.max(1e-4,n.radius*1e-4)||Math.abs(I(n.end,n.center)-n.radius)>Math.max(1e-4,n.radius*1e-4)||I(t,n.end)<=1e-9)return!1}else return!1;t=n.end}return I(t,e.start)<=1e-4}function et(e,t,n){let o=1-n;return{x:o**3*e.x+3*o**2*n*t.control1.x+3*o*n**2*t.control2.x+n**3*t.end.x,y:o**3*e.y+3*o**2*n*t.control1.y+3*o*n**2*t.control2.y+n**3*t.end.y}}function hn(e,t=2){if(!Se(e))throw new Error("Section outline path is invalid");let n=Math.max(.25,t),o=[{...e.start}],r=e.start;for(let i of e.segments){if(i.kind==="line")o.push({...i.end});else if(i.kind==="arc"){let c=Math.atan2(r.y-i.center.y,r.x-i.center.x),u=Math.atan2(i.end.y-i.center.y,i.end.x-i.center.x),s=Ze(c,u,i.clockwise),d=Math.max(2,Math.ceil(Math.abs(s)*i.radius/n));for(let a=1;a<=d;a+=1){let h=c+s*a/d;o.push({x:i.center.x+Math.cos(h)*i.radius,y:i.center.y+Math.sin(h)*i.radius})}}else{let c=I(r,i.control1)+I(i.control1,i.control2)+I(i.control2,i.end),u=Math.max(2,Math.ceil(c/n));for(let s=1;s<=u;s+=1)o.push(et(r,i,s/u))}r=i.end}return I(o[o.length-1],o[0])<=1e-4&&o.pop(),o}function we(e,t,n){return tt(e,r=>({x:r.x+t,y:r.y+n}))}function tt(e,t,n=1,o=!1){return{...e,start:t(e.start),segments:e.segments.map(r=>r.kind==="line"?{...r,end:t(r.end)}:r.kind==="arc"?{...r,center:t(r.center),radius:r.radius*Math.abs(n),clockwise:o?!r.clockwise:r.clockwise,end:t(r.end)}:{...r,control1:t(r.control1),control2:t(r.control2),end:t(r.end)})}}var nt=45,q=150,ot=60;function rt(e){let t=nt/100;if(e<=t)return q;let n=Math.min(1,(e-t)/(1-t));return q-n*(q-ot)}var xe=.5523;function ge(e,t){return Math.abs(e.x-t.x)<=1e-6&&Math.abs(e.y-t.y)<=1e-6}function it(e){let t=[],n=[];for(e.forEach((o,r)=>{j(o)&&(t.length&&ge(t[t.length-1],o)||(t.push({x:o.x,y:o.y}),n.push(r)))});t.length>1&&ge(t[0],t[t.length-1]);)t.pop(),n.pop();return{points:t,sourceIndex:n}}function mn(e,t,n){return lt(e,{cornerSmoothing:t,...n})}var st=.5,ct=4/3;function at(e,t,n){let o=t.x-e.x,r=t.y-e.y,i=Math.hypot(o,r);if(i<=1e-9)return{kind:"line",end:{...t}};let c=-r/i,u=o/i,s=n*ct;return{kind:"bezier",control1:{x:e.x+o/3+c*s,y:e.y+r/3+u*s},control2:{x:e.x+o*2/3+c*s,y:e.y+r*2/3+u*s},end:{...t}}}function lt(e,t){let{points:n,sourceIndex:o}=it(e),r=n.length;if(r<3)return null;let i=Math.min(100,Math.max(0,t.cornerSmoothing??0))/100,c=t.edgeCurvature,u=new Array(r).fill(0);if(c?.length)for(let l=0;l<r;l+=1){let P=c[o[l]];u[l]=Number.isFinite(P)?Math.min(100,Math.max(-100,P))/100:0}let s=u.some(l=>Math.abs(l)>1e-6);if(i<=0&&!s)return null;let d=t.wideAngleThresholdDeg??rt(i),a=[];for(let l=0;l<r;l+=1)a[l]=I(n[l],n[(l+1)%r]);let h=new Array(r).fill(0);for(let l=0;l<r;l+=1){let P=n[(l-1+r)%r],S=n[l],M=n[(l+1)%r],E={x:P.x-S.x,y:P.y-S.y},C={x:M.x-S.x,y:M.y-S.y},A=Math.hypot(E.x,E.y),_=Math.hypot(C.x,C.y);if(A<=1e-9||_<=1e-9)continue;let H=Math.min(1,Math.max(-1,(E.x*C.x+E.y*C.y)/(A*_))),D=Math.acos(H)*180/Math.PI;if(D<d)continue;let $=be((D-d)/(180-d));h[l]=i*$*.5*Math.min(A,_)}for(let l=0;l<r;l+=1){let P=(l+1)%r,S=h[l]+h[P];if(S>a[l]&&S>1e-9){let M=a[l]/S;h[l]*=M,h[P]*=M}}let m=new Array(r),b=new Array(r);for(let l=0;l<r;l+=1){let P=n[(l-1+r)%r],S=n[l],M=n[(l+1)%r];if(h[l]<=1e-6){m[l]={...S},b[l]={...S};continue}let E=I(S,P)||1,C=I(S,M)||1;m[l]={x:S.x+(P.x-S.x)/E*h[l],y:S.y+(P.y-S.y)/E*h[l]},b[l]={x:S.x+(M.x-S.x)/C*h[l],y:S.y+(M.y-S.y)/C*h[l]}}if(h.every(l=>l<=1e-6)&&!s)return null;let p=[],y={...b[0]},f=y,g=(l,P)=>{if(I(f,l)<=1e-9)return;let S=u[P];Math.abs(S)>1e-6?p.push(at(f,l,S*st*a[P])):p.push({kind:"line",end:{...l}}),f=l};for(let l=1;l<=r;l+=1){let P=l%r,S=n[P];g(m[P],(l-1)%r),h[P]>1e-6&&I(m[P],b[P])>1e-9&&(p.push({kind:"bezier",control1:O(m[P],S,xe),control2:O(b[P],S,xe),end:{...b[P]}}),f=b[P])}if(!p.length)return null;let w=p[p.length-1];I(w.end,y)>1e-9&&(w.kind==="line"?w.end={...y}:p.push({kind:"line",end:{...y}}));let x={version:1,closed:!0,start:y,segments:p};return Se(x)?x:null}function pn(e){let t=[],n=e.start;for(let r of e.segments)t.push(n),n=r.end;let o=[];for(let r=e.segments.length-1;r>=0;r-=1){let i=e.segments[r],c=t[r];i.kind==="line"?o.push({kind:"line",end:{...c}}):i.kind==="arc"?o.push({kind:"arc",center:{...i.center},radius:i.radius,clockwise:!i.clockwise,end:{...c}}):o.push({kind:"bezier",control1:{...i.control2},control2:{...i.control1},end:{...c}})}return{version:1,closed:!0,start:{...e.start},segments:o}}function bn(e,t,n){let o=[];for(let r=0;r<e.length-1;r+=1){let i=e[r],c=e[r+1],u=Math.hypot(c.x-i.x,c.y-i.y);if(u<=0)continue;let s=Math.max(1,Math.round(u/n)),d=u/s,a=Math.atan2(c.y-i.y,c.x-i.x),h=r===0,b=(r>0?t[r-1]:void 0)==="break"?2:1,p=h?{...i}:{x:i.x+Math.cos(a)*d*b,y:i.y+Math.sin(a)*d*b},y=h?s+1:Math.max(1,s-(b-1));o.push({origin:p,rotation:a*180/Math.PI,seatCount:y,seatSpacing:d})}return o}function xn(e){let t=e.rotation*Math.PI/180,n={x:Math.cos(t),y:Math.sin(t)};return Array.from({length:e.seatCount},(o,r)=>({x:e.origin.x+n.x*r*e.seatSpacing,y:e.origin.y+n.y*r*e.seatSpacing}))}function gn(e){return e.reduce((t,n)=>t+n.seatCount,0)}function Pe(e){let t=new Map,n=new Map;for(let o of e){if(o.type!=="row"||!o.segmentedRow)continue;let r=n.get(o.segmentedRow.groupId)??[];r.push(o),n.set(o.segmentedRow.groupId,r)}for(let[o,r]of n){let i=r.slice().sort((m,b)=>m.segmentedRow.componentIndex-b.segmentedRow.componentIndex),c=i[0]?.segmentedRow?.componentCount??0,u=i[0]?.segmentedRow;if(!u||!(c>=2&&i.length===c&&u?.boundaryBefore==="start"&&i.every((m,b)=>m.segmentedRow?.kind==="segmented-row-v1"&&m.segmentedRow.groupId===o&&m.segmentedRow.componentCount===c&&m.segmentedRow.componentIndex===b&&m.segmentedRow.repeatLabelOnComponents===u.repeatLabelOnComponents&&(b===0?m.segmentedRow.boundaryBefore==="start":m.segmentedRow.boundaryBefore!=="start")&&m.segmentedRow.displayLabel===u.displayLabel)))continue;let d=i.reduce((m,b)=>m+b.seatCount,0),a=0,h=0;for(let m of i)m.segmentedRow.boundaryBefore==="break"&&(a+=1),t.set(m.id,{groupId:o,adjacencyOffset:a,displayOffset:h,displayLabel:u.displayLabel,totalSeats:d,canonical:i[0],viewFromSeatUrl:u.viewFromSeatUrl,viewFromSeatMeta:u.viewFromSeatMeta,confidenceEvidence:u.confidenceEvidence}),a+=m.seatCount,h+=m.seatCount}return t}var Me="ABCDEFGHIJKLMNOPQRSTUVWXYZ",ut="ABCDEFGHJKLMNPQRSTUVWXYZ",ft="abcdefghijklmnopqrstuvwxyz";function ve(e,t){let n=t.length,o=e+1,r="";for(;o>0;){o-=1;let i=o%n;r=t[i]+r,o=Math.floor(o/n)}return r}function dt(e,t){let n=t.startAt-1,o=e+n;if(t.scheme==="numbers")return String(o+1);let r=t.skipAmbiguous?ut:Me;return ve(o,r)}function J(e,t=!1){let n=t?ft:Me;return ve(Math.max(0,Math.floor(e)-1),n)}var ht=[[1e3,"M"],[900,"CM"],[500,"D"],[400,"CD"],[100,"C"],[90,"XC"],[50,"L"],[40,"XL"],[10,"X"],[9,"IX"],[5,"V"],[4,"IV"],[1,"I"]];function Ie(e){if(!Number.isFinite(e)||e<=0)return String(e);let t=Math.floor(e),n="";for(let[o,r]of ht)for(;t>=o;)n+=r,t-=o;return n}function wn(e,t){let n=e.length;return e.map((o,r)=>{let i=t.reverse?n-1-r:r;return{...o,label:dt(i,t)}})}function mt(e){let t=new Array(e);return Array.from({length:e},(n,o)=>o).sort((n,o)=>Math.abs(2*n-(e-1))-Math.abs(2*o-(e-1))||n-o).forEach((n,o)=>t[n]=o),t}function Q(e,t){let n=e.seatLabelStart??1,o=e.seatNumbering?.direction??"ltr",r=e.seatNumbering?.step??1,i=e.seatNumbering?.scheme??"decimal",c=e.seatNumbering?.prefix??"",u=e.seatNumbering?.endAt,s=e.seatCount;if(i==="updown"||i==="updown-descending"){let b=Math.ceil(s/2),p=i==="updown"?t<b?n+2*t:n-1+2*(s-t):t<b?n+2*(b-1-t):n+1+2*(t-b);return`${c}${p}`}let d=i==="odd"||i==="even"?2:r,a=u!=null&&Number.isFinite(u)?u-(s-1)*d:n,h=o==="center"?mt(s)[t]:o==="rtl"?s-1-t:t,m;switch(i){case"odd":{let b=a%2===1?a:a+1;m=String(b+h*2);break}case"even":{let b=a%2===0?a:a+1;m=String(b+h*2);break}case"roman":m=Ie(a+h*r);break;case"letters-upper":m=J(a+h*r,!1);break;case"letters-lower":m=J(a+h*r,!0);break;default:m=String(a+h*r);break}return`${c}${m}`}function pt(e){return{...e.canonical,seatCount:e.totalSeats,label:e.displayLabel,displayLabel:e.displayLabel}}function Ee(e,t,n){return n?.label??`${e.label}-${Q(e,t)}`}function Z(e,t,n,o){if(o?.displayLabel)return o.displayLabel;if(!n)return`${e.displayLabel||e.label}-${Q(e,t)}`;let r=pt(n),i=n.displayOffset+t;return`${n.displayLabel}-${Q(r,i)}`}var G=.02291666666666667,In=1/G,yt=58,bt=yt*G,Ce=0,Te=3,Oe=0,ee=120,xt=0,gt=45,St=7,X=1.2;function te(e,t,n,o){return Number.isFinite(e)?Math.max(t,Math.min(n,e)):o}function En(e){return Number.isFinite(e)?Math.max(Ce,Math.min(Te,Math.round(e))):Ce}function wt(e){return!Number.isFinite(e)||!Number.isInteger(e)||e<0?0:e<=St?e:Te}function Re(e,t={}){let n=te(t.floorBaseHeightM,Oe,ee,0),o=Math.min(ee,n+wt(e.elevation)*bt),r=e.height===void 0?o:te(e.height,Oe,ee,o),i=te(e.rake,xt,gt,0);return{height:r,rake:i}}function Ae(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 _e(e,t,n){if(!e.length)return 1/0;if(e.length===1)return Math.hypot(t-e[0].x,n-e[0].y);let o=1/0;for(let r=0;r+1<e.length;r++){let i=e[r],c=e[r+1],u=c.x-i.x,s=c.y-i.y,d=u*u+s*s,a=d>1e-12?((t-i.x)*u+(n-i.y)*s)/d:0;a<0?a=0:a>1&&(a=1);let h=Math.hypot(t-(i.x+a*u),n-(i.y+a*s));h<o&&(o=h)}return o}function Pt(e){let t=0,n=0;for(let i of e)t+=i.x,n+=i.y;let o=e.length||1;t/=o,n/=o;let r=0;for(let i of e){let c=Math.hypot(i.x-t,i.y-n);c>r&&(r=c)}return{cx:t,cy:n,r}}function Le(e,t){return Math.hypot(e.cx-t.cx,e.cy-t.cy)-e.r-t.r}function ne(e,t){let n=1/0;for(let o of Ae(e)){let r=_e(t,o.x,o.y);r<n&&(n=r)}for(let o of Ae(t)){let r=_e(e,o.x,o.y);r<n&&(n=r)}return n}function Mt(e,t){if(e.length<3)return{pts:e,seatIndices:t};let n=0,o=0;for(let a of e)n+=a.x,o+=a.y;n/=e.length,o/=e.length;let r=-1,i=e[0];for(let a of e){let h=Math.hypot(a.x-n,a.y-o);h>r&&(r=h,i=a)}let c=i.x-n,u=i.y-o,s=Math.hypot(c,u);s>1e-9?(c/=s,u/=s):(c=1,u=0);let d=e.map((a,h)=>({p:a,i:h,t:(a.x-n)*c+(a.y-o)*u})).sort((a,h)=>a.t-h.t);return{pts:d.map(a=>a.p),seatIndices:d.map(a=>t[a.i])}}function vt(e){let t=e.length;if(t<3)return null;let n=0,o=0;for(let w of e)n+=w.x,o+=w.y;n/=t,o/=t;let r=0,i=0,c=0,u=0,s=0,d=0,a=0;for(let w of e){let x=w.x-n,l=w.y-o;r+=x*x,c+=l*l,i+=x*l,u+=x*x*x,s+=l*l*l,d+=x*l*l,a+=l*x*x}let h=r*c-i*i;if(Math.abs(h)<1e-9)return null;let m=(u+d)/2,b=(s+a)/2,p=(m*c-b*i)/h,y=(b*r-m*i)/h,f=p+n,g=y+o;return!Number.isFinite(f)||!Number.isFinite(g)?null:{cx:f,cy:g}}var It=.15;function Et(e){if(e.length<2)return null;let t=e.map(w=>{let x=0,l=0;for(let P of w.pts)x+=P.x,l+=P.y;return{x:x/w.pts.length,y:l/w.pts.length}}),n=0,o=0;for(let w of t)n+=w.x,o+=w.y;n/=t.length,o/=t.length;let r=0,i=0,c=0;for(let w of t){let x=w.x-n,l=w.y-o;r+=x*x,i+=x*l,c+=l*l}let u=r+c,s=r*c-i*i,d=u/2+Math.sqrt(Math.max(0,u*u/4-s)),a,h;Math.abs(i)>1e-12?(a=d-c,h=i):r>=c?(a=1,h=0):(a=0,h=1);let m=Math.hypot(a,h);if(!(m>1e-12))return null;a/=m,h/=m;let b=1/0,p=-1/0,y=[];for(let w of e){let x=1/0,l=-1/0;for(let P of w.pts){let S=P.x*a+P.y*h;S<x&&(x=S),S>l&&(l=S),S<b&&(b=S),S>p&&(p=S)}y.push(l-x)}let f=p-b;return f>1e-9?(y.sort((w,x)=>w-x),y[Math.min(y.length-1,Math.floor(y.length*.9))]/f<=Ct?{x:a,y:h}:null):null}var Ct=.35;function ke(e,t,n,o){let r=new Map;for(let f of n){let g=t[f],w=g.rowId||`__seat-${f}`,x=r.get(w);x||(x={pts:[],idx:[]},r.set(w,x)),x.pts.push({x:g.x,y:g.y}),x.idx.push(f)}if(!r.size)return{sectionId:e,rows:[],blockCount:0};let i=[];for(let[f,g]of r){let w=Mt(g.pts,g.idx),x=0;for(let l of w.pts)x+=Math.hypot(l.x-o.x,l.y-o.y);i.push({id:f,pts:w.pts,seatIndices:w.seatIndices,blockId:-1,ordinal:0,blockDepth:0,focalDistance:x/w.pts.length})}let c=i.map(f=>Pt(f.pts)),u=[];for(let f=0;f<i.length;f++){let g=1/0;for(let w=0;w<i.length;w++){if(f===w||Le(c[f],c[w])>=g)continue;let x=ne(i[f].pts,i[w].pts);x<g&&(g=x)}Number.isFinite(g)&&u.push(g)}u.sort((f,g)=>f-g);let s=u.length?u[Math.floor(u.length/2)]:1,d=Math.max(s*1.8,1e-6),a=i.map(()=>[]);for(let f=0;f<i.length;f++)for(let g=f+1;g<i.length;g++)Le(c[f],c[g])>d||ne(i[f].pts,i[g].pts)<=d&&(a[f].push(g),a[g].push(f));let h=0;for(let f=0;f<i.length;f++){if(i[f].blockId!==-1)continue;let g=h++,w=[f];for(i[f].blockId=g;w.length;){let x=w.pop();for(let l of a[x])i[l].blockId===-1&&(i[l].blockId=g,w.push(l))}}let m=new Map;for(let f of i){let g=m.get(f.blockId)??[];g.push(f),m.set(f.blockId,g)}let b=[];for(let f of i){if(f.pts.length<4)continue;let g=vt(f.pts);g&&(!Number.isFinite(g.cx)||!Number.isFinite(g.cy)||b.push({x:g.cx,y:g.cy}))}let p=b.length>=2?(()=>{let f=b.map(x=>x.x).sort((x,l)=>x-l),g=b.map(x=>x.y).sort((x,l)=>x-l),w=Math.floor(b.length/2);return{cx:f[w],cy:g[w]}})():null;if(p){let f=S=>Math.hypot(S.x-p.cx,S.y-p.cy),g=1/0,w=-1/0,x=[];for(let S of i){let M=1/0,E=-1/0;for(let C of S.pts){let A=f(C);A<M&&(M=A),A>E&&(E=A)}x.push(E-M),M<g&&(g=M),E>w&&(w=E)}let l=w-g;x.sort((S,M)=>S-M);let P=x[Math.min(x.length-1,Math.floor(x.length*.9))];if(l>1e-9&&P/l<=It){let S=i.map(v=>{let U=0;for(let Xe of v.pts)U+=f(Xe);return{row:v,radius:U/v.pts.length}}),M=0,E=0;for(let v of S)M+=v.radius,E+=v.row.focalDistance;M/=S.length,E/=S.length;let C=0;for(let v of S)C+=(v.radius-M)*(v.row.focalDistance-E);if(C<0)for(let v of S)v.radius=-v.radius;let _=1/0;for(let v of S)v.radius<_&&(_=v.radius);S.sort((v,U)=>v.radius-U.radius);let H=-1,D=-1/0,$=l/Math.max(1,S.length)*.5,ie=[];for(let v of S)v.radius-D>$&&(H++,D=v.radius),v.row.ordinal=H,v.row.blockDepth=v.radius-_,ie.push(v.row);return{sectionId:e,rows:ie,blockCount:h}}}let y=[];for(let[,f]of m){let g=Et(f);if(g){let w=l=>{let P=0;for(let S of l.pts)P+=S.x*g.x+S.y*g.y;return P/l.pts.length};f.sort((l,P)=>w(l)-w(P)),f.length>=2&&f[0].focalDistance>f[f.length-1].focalDistance&&f.reverse();let x=0;for(let l=0;l<f.length;l++)l>0&&(x+=ne(f[l-1].pts,f[l].pts)),f[l].ordinal=l,f[l].blockDepth=x,y.push(f[l])}else{let w=1/0;for(let x of f)x.focalDistance<w&&(w=x.focalDistance);f.sort((x,l)=>x.focalDistance-l.focalDistance);for(let x=0;x<f.length;x++)f[x].ordinal=x,f[x].blockDepth=Math.max(0,f[x].focalDistance-w),y.push(f[x])}}return{sectionId:e,rows:y,blockCount:h}}function He(e){return e?e.accessibility&&e.accessibility.length?e.wheelchairSpaceType&&!e.accessibility.includes("wheelchair")?["wheelchair",...e.accessibility]:e.accessibility:e.wheelchairSpaceType?["wheelchair"]:e.accessible?["wheelchair"]:[]:[]}var K=Math.PI/180,Ot=9,N=16;function re(e,t,n,o){let r=n*K,i=Math.cos(r),c=Math.sin(r);return{x:o.x+e*i-t*c,y:o.y+e*c+t*i}}function Ue(e){let{seatCount:t,seatSpacing:n,curve:o,rotation:r,origin:i}=e,c=[];if(e.path)return fe(e.path,t);if(t<=1)return t===1&&c.push({x:i.x,y:i.y}),c;if(o===0){for(let d=0;d<t;d++)c.push(re(d*n,0,r,i));return c}let u=o/(t-1)*K,s=n/(2*Math.sin(Math.abs(u)/2));for(let d=0;d<t;d++){let a=d*u,h=s*Math.sin(a),m=-s+s*Math.cos(a);c.push(re(h,m,r,i))}return c}function Tt(e){let t=new Map;if(e.overrides)for(let n of e.overrides)t.set(n.index,n);return t}function Fn(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 Rt(e,t){let n=Tt(e);return Ue(e).map((o,r)=>{let i=n.get(r),c=He(i),u=Ee(e,r,i),s={...e.commercial,...i?.commercial};return{index:r,x:o.x+(i?.dx??0),y:o.y+(i?.dy??0),label:u,displayLabel:Z(e,r,t,i),categoryKey:i?.categoryKey??e.categoryKey,skipped:!!i?.skip,accessible:c.length>0,accessibility:c,wheelchairSpaceType:i?.wheelchairSpaceType,commercial:Object.values(s).some(d=>d!==void 0&&d!==!1&&d!=="")?s:void 0,glyph:i?.glyph,viewUrl:i?.viewFromSeatUrl??e.viewFromSeatUrl,viewMeta:i?.viewFromSeatUrl?i.viewFromSeatMeta:e.viewFromSeatMeta,labelStyle:i?.labelStyle}})}function Be(e){let t=[];for(let n of Rt(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 At(e){if(e.seatCountsBySide)return{...e.seatCountsBySide};let t=e.sides&&e.sides.length?e.sides:["top","bottom"],n=["top","bottom","left","right"].filter(i=>t.includes(i)),o={top:0,bottom:0,left:0,right:0};if(!n.length)return o;let r=Math.max(0,Math.round(e.seatCount));for(let i=0;i<r;i++)o[n[i%n.length]]+=1;return o}function Ge(e){let t=[],n=Math.max(0,Math.round(e.seatCount));if(n===0)return t;let o=new Map((e.overrides??[]).map(a=>[a.index,a])),r=(a,h,m,b)=>{let p=o.get(a),y=He(p),f=p?.label??`${e.label}-${a+1}`,g=e.displayLabel??e.label;return{index:a,label:f,displayLabel:p?.displayLabel??`${g}-${a+1}`,x:h+(p?.dx??0),y:m+(p?.dy??0),categoryKey:p?.categoryKey??e.categoryKey,skipped:!!p?.skip,accessible:y.length>0,accessibility:y,wheelchairSpaceType:p?.wheelchairSpaceType,commercial:p?.commercial,glyph:p?.glyph,viewUrl:p?.viewFromSeatUrl,viewMeta:p?.viewFromSeatUrl?p.viewFromSeatMeta:void 0,labelStyle:p?.labelStyle,...b?{side:b}:{}}};if(e.shape==="round"){let a=(e.radius??40)+N,h=e.rotation*K,m=Math.max(0,Math.min(360,e.seatArc??360));if(m>=360||n===1){for(let f=0;f<n;f++){let g=h+f/n*2*Math.PI;t.push(r(f,e.center.x+a*Math.cos(g),e.center.y+a*Math.sin(g)))}return t}let b=m*K,p=(2*Math.PI-b)/2,y=h+p;for(let f=0;f<n;f++){let g=y+f/(n-1)*b;t.push(r(f,e.center.x+a*Math.cos(g),e.center.y+a*Math.sin(g)))}return t}let i=e.width??80,c=e.height??50,u=At(e),s=["top","bottom","left","right"],d=0;for(let a of s){let h=u[a];for(let m=0;m<h;m++){let b,p;a==="top"?(b=-i/2+(m+.5)*i/h,p=-c/2-N):a==="bottom"?(b=-i/2+(m+.5)*i/h,p=c/2+N):a==="left"?(b=-i/2-N,p=-c/2+(m+.5)*c/h):(b=i/2+N,p=-c/2+(m+.5)*c/h);let y=re(b,p,e.rotation,e.center);t.push(r(d++,y.x,y.y,a))}}return t}function Hn(e){return e.bookAsWhole||e.variableOccupancy?Math.max(0,Math.round(e.seatCount)):Ge(e).filter(t=>!t.skipped).length}function _t(e){return Ge(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 Lt(e){return[{id:`${e.id}:0`,label:e.label,...e.displayLabel&&e.displayLabel!==e.label?{displayLabel:e.displayLabel}:{},x:e.center.x,y:e.center.y,rowId:e.id,categoryKey:e.categoryKey,kind:"booth"}]}function je(e,t){let n=!1;for(let o=0,r=t.length-1;o<t.length;r=o++){let i=t[o].x,c=t[o].y,u=t[r].x,s=t[r].y;c>e.y!=s>e.y&&e.x<(u-i)*(e.y-c)/(s-c)+i&&(n=!n)}return n}function kt(e,t){return t.some((n,o)=>{let r=t[(o+1)%t.length],i=(e.y-n.y)*(r.x-n.x)-(e.x-n.x)*(r.y-n.y);if(Math.abs(i)>1e-7)return!1;let c=(e.x-n.x)*(r.x-n.x)+(e.y-n.y)*(r.y-n.y),u=(r.x-n.x)**2+(r.y-n.y)**2;return c>=-1e-7&&c<=u+1e-7})}function V(e,t,n){return je(e,t)&&!(n??[]).some(o=>je(e,o)||kt(e,o))}function Un(e,t){return ye(e,t).point}function oe(e){if(!e.length)return{x:0,y:0};let t=0,n=0;for(let o of e)t+=o.x,n+=o.y;return{x:t/e.length,y:n/e.length}}function jt(e){switch(e.type){case"row":{let t=Be(e);if(!t.length)return{x:e.origin.x,y:e.origin.y};let n=0,o=0;for(let r of t)n+=r.x,o+=r.y;return{x:n/t.length,y:o/t.length}}case"table":case"booth":return{x:e.center.x,y:e.center.y};case"gaArea":return oe(e.points);case"section":return oe(e.outline);case"text":return{x:e.position.x,y:e.position.y};case"shape":return e.points&&e.points.length?oe(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 Ne(e,t){return e.length===t.length&&e.every((n,o)=>n.x===t[o].x&&n.y===t[o].y)}function Nt(e,t){if(e.type!=="gaArea"||!Ne(e.points,t.outline))return!1;let n=e.holes??[],o=t.holes??[];return n.length===o.length&&n.every((r,i)=>Ne(r,o[i]))}function Dt(e,t){let n=e.filter(c=>c.type==="section"),o="referenceInventorySource"in t?t.referenceInventorySource?.logicalSectionId:void 0,r=jt(t);return(o?n.find(c=>(c.logicalSectionId??c.id)===o&&(Nt(t,c)||V(r,c.outline,c.holes))):void 0)??n.find(c=>V(r,c.outline,c.holes))}function Ft(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 Bn(e,t){let n=Ft(e);return(t?n.find(o=>o.id===t):n[0])?.objects??[]}function Ht(e){return e.floors&&e.floors.length?e.floors.flatMap(t=>t.objects):e.objects}function Ut(e,t,n){let o=i=>({x:i.x+t,y:i.y+n}),r=i=>i.map(o);switch(e.type){case"row":return{...e,origin:o(e.origin)};case"table":case"booth":return{...e,center:o(e.center)};case"gaArea":return{...e,points:r(e.points),...e.holes?{holes:e.holes.map(r)}:{}};case"section":return{...e,outline:r(e.outline),...e.outlinePath?{outlinePath:we(e.outlinePath,t,n)}:{},...e.holes?{holes:e.holes.map(r)}:{}};case"text":return{...e,position:o(e.position)};case"shape":return{...e,...e.points?{points:r(e.points)}:{},...e.x!=null?{x:e.x+t}:{},...e.y!=null?{y:e.y+n}:{}};case"decorImage":return{...e,x:e.x+t,y:e.y+n}}}function Gn(e,t=900){if(!e.floors||e.floors.length<2)return e;let n=[];return e.floors.forEach((o,r)=>{let i=-r*t;for(let c of o.objects)n.push(i===0?c:Ut(c,0,i))}),{...e,objects:n,floors:void 0}}function De(e,t,n,o,r,i,c,u,s){let d=[],a=Pe(e),h=p=>!p?.eventConfigurationId||p.eventConfigurationId===o&&(p.eventConfigurationVersion===void 0||p.eventConfigurationVersion===s),m=p=>se(p,{activeConfigurationId:o,activeConfigurationVersion:s,activeBasisSha256:r,now:u}),b=(p,y)=>m(p)?{...p,coverage:y}:void 0;for(let p of e){let y=[];if(p.type==="row"?y=Be(p):p.type==="table"?y=_t(p):p.type==="booth"&&(y=Lt(p)),!y.length)continue;for(let l of y)l.viewUrl&&!h(l.viewMeta)&&(l.viewUrl=void 0,l.viewMeta=void 0);if(p.type==="row"){let l=a.get(p.id);if(l){let P=new Map((p.overrides??[]).map(S=>[S.index,S]));for(let S of y){let M=Number(S.id.slice(S.id.lastIndexOf(":")+1));if(!Number.isInteger(M))continue;S.logicalRowId=l.groupId,S.logicalSeatIndex=l.adjacencyOffset+M,P.get(M)?.displayLabel||(S.displayLabel=Z(p,M,l)),!S.viewUrl&&l.viewFromSeatUrl&&h(l.viewFromSeatMeta)&&(S.viewUrl=l.viewFromSeatUrl,S.viewMeta=l.viewFromSeatMeta);let E=P.get(M)?.confidenceEvidence;S.confidenceEvidence=b(E,"exact-seat")??b(p.confidenceEvidence,"row-representative")??b(l.confidenceEvidence,"row-representative")}}}let f=Dt(e,p),g=f?.viewFromSeatUrl,x=(f?.zone?t?.find(l=>l.id===f.zone):void 0)?.focalPoint??n;for(let l of y){if(!l.confidenceEvidence){let P=Number(l.id.slice(l.id.lastIndexOf(":")+1)),S=(p.type==="row"||p.type==="table")&&Number.isInteger(P)?p.overrides?.find(M=>M.index===P)?.confidenceEvidence:void 0;l.confidenceEvidence=b(S,"exact-seat")??(p.type==="row"?b(p.confidenceEvidence,"row-representative"):void 0)}l.confidenceEvidence??=b(f?.confidenceEvidence,"section-representative")??(c?b(c.evidence,c.coverage):void 0),!l.viewUrl&&g&&h(f?.viewFromSeatMeta)&&(l.viewUrl=g,l.viewMeta=f?.viewFromSeatMeta),!l.viewUrl&&i&&h(i.meta)&&(l.viewUrl=i.url,l.viewMeta=i.meta),f&&(l.sectionId=f.logicalSectionId??f.id),f?.zone&&(l.zoneId=f.zone),x&&(l.focalPoint={...x})}d.push(...y)}return d}function Xn(e,t={}){if(e.floors?.length){let o=[];for(let r of e.floors){let i=r.focalPoint??e.focalPoint,c=r.viewFromSeatUrl?{url:r.viewFromSeatUrl,meta:r.viewFromSeatMeta}:e.viewFromSeatUrl?{url:e.viewFromSeatUrl,meta:e.viewFromSeatMeta}:void 0,u=r.confidenceEvidence?{evidence:r.confidenceEvidence,coverage:"floor-representative"}:e.confidenceEvidence?{evidence:e.confidenceEvidence,coverage:"venue-representative"}:void 0,s=De(r.objects,e.zones,i,e.eventConfigurationId,e.confidenceBasisSha256,c,u,t.now,t.eventConfigurationVersion??e.eventConfigurationVersion);t.resolveEyeHeights!==!1&&Fe(r.objects,r.focalPoint??e.focalPoint,r.baseHeightM??0,s);for(let d of s)d.floorId=r.id;o.push(...s)}return o}let n=De(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&&Fe(e.objects,e.focalPoint,t.floorBaseHeightM??0,n),n}function Fe(e,t,n,o){let r=e.filter(a=>a.type==="section"),i=n>0||r.some(a=>a.height!==void 0||a.rake!==void 0||(a.elevation??0)>0);if(!r.length||!i||!t){for(let a of o)a.eyeHeightM=n+X;return}let c=new Array(o.length),u=new Map,s=new Map;for(let a=0;a<o.length;a++){let h=o[a],b=(h.sectionId?r.find(y=>y.id===h.sectionId)??r.find(y=>y.logicalSectionId===h.sectionId&&V({x:h.x,y:h.y},y.outline,y.holes)):void 0)??r.find(y=>V({x:h.x,y:h.y},y.outline,y.holes))??null;if(c[a]=b,!b)continue;u.has(b.id)||u.set(b.id,Re(b,{floorBaseHeightM:n}));let p=s.get(b.id);p?p.push(a):s.set(b.id,[a])}let d=new Array(o.length).fill(void 0);for(let[a,h]of s){let m=u.get(a);if(!m)continue;let b=m.rake>0?Math.tan(m.rake*Math.PI/180):0,p=ke(a,o,h,t);for(let y of p.rows){let f=y.blockDepth*G*b,g=m.height+f;for(let w of y.seatIndices)d[w]=g}}for(let a=0;a<o.length;a++){let h=o[a],m=c[a];if(!m){h.eyeHeightM=n+X;continue}let b=u.get(m.id);h.eyeHeightM=(d[a]??b.height)+X}}var z=40;function zn(e,t){let n=t?.freeText==="exclude",o=1/0,r=1/0,i=-1/0,c=-1/0,u=(s,d)=>{s<o&&(o=s),d<r&&(r=d),s>i&&(i=s),d>c&&(c=d)};for(let s of Ht(e))if(s.type==="row"){let d=new Map((s.overrides??[]).map(a=>[a.index,a]));Ue(s).forEach((a,h)=>{let m=d.get(h);m?.skip||u(a.x+(m?.dx??0),a.y+(m?.dy??0))})}else if(s.type==="gaArea")for(let d of s.points)u(d.x,d.y);else if(s.type==="section")for(let d of s.outline)u(d.x,d.y);else if(s.type==="decorImage")u(s.x,s.y),u(s.x+s.width,s.y+s.height);else if(s.type==="shape")if(s.points&&s.points.length)for(let d of s.points)u(d.x,d.y);else s.x!=null&&s.y!=null&&s.width!=null&&s.height!=null&&(u(s.x,s.y),u(s.x+s.width,s.y+s.height));else if(s.type==="table"){let d=N+Ot,a=s.shape==="round"?(s.radius??40)+d:Math.max((s.width??80)/2,(s.height??50)/2)+d;u(s.center.x-a,s.center.y-a),u(s.center.x+a,s.center.y+a)}else if(s.type==="booth"){let d=Math.max(s.width,s.height)/2;u(s.center.x-d,s.center.y-d),u(s.center.x+d,s.center.y+d)}else if(s.type==="text"){if(n)continue;let d=ae(s);u(s.position.x,s.position.y),u(s.position.x+d.width,s.position.y+d.height)}for(let s of[e.referenceImage,e.backgroundImage]){if(!s)continue;let{center:d,width:a}=s,h=a*3/4;u(d.x-a/2,d.y-h/2),u(d.x+a/2,d.y+h/2)}if(!isFinite(o)){let s=e.focalPoint??{x:0,y:0};return{x:s.x-200,y:s.y-200,width:400,height:400}}return{x:o-z,y:r-z,width:i-o+z*2,height:c-r+z*2}}export{Bt as a,Gt as b,Xt as c,zt as d,Kt as e,Vt as f,$t as g,Wt as h,Yt as i,ae as j,Jt as k,$e as l,Qt as m,W as n,tn as o,fe as p,nn as q,on as r,Ye as s,pe as t,sn as u,ye as v,Je as w,an as x,dn as y,Se as z,hn as A,we as B,tt as C,nt as D,rt as E,mn as F,st as G,lt as H,pn as I,bn as J,xn as K,gn as L,Pe as M,ve as N,dt as O,J as P,Ie as Q,wn as R,Q as S,pt as T,Ee as U,Z as V,G as W,In as X,bt as Y,Ce as Z,Te as _,Oe as $,ee as aa,xt as ba,gt as ca,St as da,X as ea,En as fa,Re as ga,_e as ha,vt as ia,ke as ja,N as ka,Ue as la,Fn as ma,Rt as na,Be as oa,At as pa,Ge as qa,Hn as ra,_t as sa,Lt as ta,je as ua,V as va,Un as wa,jt as xa,Dt as ya,Ft as za,Bn as Aa,Ht as Ba,Ut as Ca,Gn as Da,Xn as Ea,zn as Fa};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{ia as Y}from"./chunk-
|
|
1
|
+
import{ia as Y}from"./chunk-KN7GLEAI.js";function nn(c){return{kind:"radial",rowCount:0,rows:[],nearestRow:()=>-1,depthAt:(l,a)=>Math.hypot(l-c.x,a-c.y),gradientAt:(l,a)=>{let e=l-c.x,f=a-c.y,i=Math.hypot(e,f);return i<1e-9?[0,0]:[e/i,f/i]}}}function tn(c,l){if(!c.length)return null;let a=0,e=0,f=0;for(let n of c)a+=n.x,e+=n.y,f+=Math.hypot(n.x-l.x,n.y-l.y);let i=c.length;a/=i,e/=i,f/=i;let u=c[0],R=-1;for(let n of c){let o=Math.hypot(n.x-a,n.y-e);o>R&&(R=o,u=n)}let b=u.x-a,m=u.y-e,d=Math.hypot(b,m);d>1e-9?(b/=d,m/=d):(b=1,m=0);let y=[...c].sort((n,o)=>(n.x-a)*b+(n.y-e)*m-((o.x-a)*b+(o.y-e)*m)),t=0;for(let n of y){let o=Math.hypot(n.x-a,n.y-e);o>t&&(t=o)}return{pts:y,cx:a,cy:e,radius:t,depth:f}}function Z(c,l,a){let e=c.pts;if(e.length===1)return Math.hypot(l-e[0].x,a-e[0].y);let f=1/0;for(let i=0;i+1<e.length;i++){let u=e[i],R=e[i+1],b=R.x-u.x,m=R.y-u.y,d=b*b+m*m,y=d>1e-12?((l-u.x)*b+(a-u.y)*m)/d:0;y<0?y=0:y>1&&(y=1);let t=Math.hypot(l-(u.x+y*b),a-(u.y+y*m));t<f&&(f=t)}return f}var U=8;function en(c,l,a){let e=new Array(U).fill(1/0),f=new Array(U).fill(-1);for(let d=0;d<c.length;d++){let y=c[d],t=Math.hypot(l-y.cx,a-y.cy)-y.radius;for(let n=0;n<U;n++)if(t<e[n]){for(let o=U-1;o>n;o--)e[o]=e[o-1],f[o]=f[o-1];e[n]=t,f[n]=d;break}}let i=new Array(3).fill(1/0),u=new Array(3).fill(-1);for(let d of f){if(d<0)continue;let y=Z(c[d],l,a);for(let t=0;t<3;t++)if(y<i[t]){for(let n=2;n>t;n--)i[n]=i[n-1],u[n]=u[n-1];i[t]=y,u[t]=d;break}}if(u[0]<0)return 0;if(i[0]<1e-6)return c[u[0]].depth;let R=i[0]*2.2,b=0,m=0;for(let d=0;d<3;d++){let y=u[d];if(y<0||i[d]>R)continue;let t=1/(i[d]*i[d]);b+=t*c[y].depth,m+=t}return m>0?b/m:c[u[0]].depth}function on(c){let l=(e,f)=>en(c,e,f),a=(e,f)=>{let i=1/0,u=-1;for(let R=0;R<c.length;R++){let b=c[R];if(Math.hypot(e-b.cx,f-b.cy)-b.radius>=i)continue;let m=Z(b,e,f);m<i&&(i=m,u=R)}return u};return{kind:"rows",rowCount:c.length,rows:c,nearestRow:a,depthAt:l,gradientAt:(e,f)=>{let i=(l(e+.5,f)-l(e-.5,f))/1,u=(l(e,f+.5)-l(e,f-.5))/(2*.5),R=Math.hypot(i,u);return R<1e-9?[0,0]:[i/R,u/R]}}}function bn(c,l){let a=[];for(let e of c){let f=tn(e.points,l);f&&a.push(f)}return a.length<2?nn(l):(a.sort((e,f)=>e.depth-f.depth),on(a))}var rn=Math.PI/180,h=96,sn=6,ln=60,cn=150,$=.2,an=.35;function fn(c,l){let a=Math.atan2(l.x-c.x,l.y-c.y)/rn;return a<0?a+360:a}function z(c){if(!c.length)return NaN;let l=[...c].sort((a,e)=>a-e);return l[Math.floor(l.length/2)]}function J(c,l,a=2){let e=c.length,f=new Float64Array(e);for(let i=0;i<e;i++){let u=0,R=0;for(let b=-a;b<=a;b++){let m=i+b;if(l)m=(m%e+e)%e;else if(m<0||m>=e)continue;u+=c[m],R++}f[i]=u/R}return f}function hn(c,l){let a=c.filter(t=>t.rows.length>=1);if(a.length<1)return null;let e=[],f=0,i=0,u=0;for(let t of a)for(let n of t.rows){for(let o of n.pts)f+=o.x,i+=o.y,u++;if(n.pts.length>=4){let o=Y(n.pts);o&&Number.isFinite(o.cx)&&Number.isFinite(o.cy)&&e.push({x:o.cx,y:o.cy})}}if(!u)return null;let R={x:f/u,y:i/u},b=R;if(e.length>=8){let t=z(e.map(D=>D.x)),n=z(e.map(D=>D.y)),o=0;for(let D of a)for(let j of D.rows)for(let F of j.pts){let W=Math.hypot(F.x-R.x,F.y-R.y);W>o&&(o=W)}let B=0,S=o*.2;for(let D of a)for(let j of D.rows)for(let F of j.pts)Math.hypot(F.x-t,F.y-n)<S&&B++;Math.hypot(t-R.x,n-R.y)<=o&&B/u<.01&&(b={x:t,y:n})}let m=[];for(let t of a){let n={sectionId:t.sectionId,rMin:1/0,rMax:-1/0,samples:[]};for(let o of t.rows)for(let B of o.pts){let S=Math.hypot(B.x-b.x,B.y-b.y),D=Math.min(h-1,Math.floor(fn(b,B)/(360/h)));n.samples.push({r:S,bin:D,levelM:o.levelM}),S<n.rMin&&(n.rMin=S),S>n.rMax&&(n.rMax=S)}n.samples.length&&m.push(n)}if(!m.length)return null;m.sort((t,n)=>t.rMin+t.rMax-(n.rMin+n.rMax));let d=[];for(let t of m){let n=!1;for(let o of d){let B=Math.min(t.rMax,o.rMax)-Math.max(t.rMin,o.rMin),S=Math.min(t.rMax-t.rMin,o.rMax-o.rMin);if(S>1e-9&&B>=an*S){o.members.push(t),o.rMin=Math.min(o.rMin,t.rMin),o.rMax=Math.max(o.rMax,t.rMax),n=!0;break}}n||d.push({members:[t],rMin:t.rMin,rMax:t.rMax})}let y=[];for(let t of d){let n=new Array(h).fill(null);for(let r of t.members)for(let p of r.samples){let x=n[p.bin];x||(x={samples:[]},n[p.bin]=x),x.samples.push({r:p.r,levelM:p.levelM})}let o=n.map(r=>!!r);if(!o.filter(Boolean).length)continue;let S=[],D=[];for(let r of n){if(!r)continue;let p=1/0,x=-1/0;for(let A of r.samples)A.r<p&&(p=A.r),A.r>x&&(x=A.r);S.push(p),D.push(x)}let j=z(S),F=z(D);if(!(j>=$*F)||!(F>0))continue;let W=[...S].sort((r,p)=>r-p);if(!(W[Math.floor(W.length*.1)]>=$*F))continue;let V=n.map(r=>{if(!r)return null;let p=[...r.samples].sort((w,k)=>w.r-k.r),x=p[0].r,A=p[p.length-1].r,P=p[0].levelM,N=-1/0;for(let w of p)w.levelM>N&&(N=w.levelM);let M=[];for(let w of p){let k={r:w.r,l:w.levelM};for(;M.length&&Math.abs(M[M.length-1].r-k.r)<1e-9;){if(M[M.length-1].l<=k.l){k.skip=!0;break}M.pop()}if(!k.skip){for(;M.length>=2;){let L=M[M.length-2],v=M[M.length-1];if((v.r-L.r)*(k.l-L.l)-(v.l-L.l)*(k.r-L.r)<=0)M.pop();else break}M.push(k)}}let C=M.map(w=>w.r),_=M.map(w=>w.l);return{inner:x,outer:A,front:P,top:N,profile:{rs:C,ls:_}}}),O=o.slice();for(let r=0;r<h;r++){if(O[r])continue;let p=-1,x=-1,A=0;for(let s=1;s<=h;s++){let g=(r-s+h*2)%h;if(O[g]){p=g;break}}for(let s=1;s<=h;s++){let g=(r+s)%h;if(O[g]){x=g,A=s;break}}if(p<0||x<0)continue;let P=0;for(let s=1;s<=h;s++){let g=(r-s+h*2)%h;if(o[g]){P=s;break}}if(P-1+A>sn)continue;let M=V[p],C=V[x],_=P/(P+A),w=M.inner+(C.inner-M.inner)*_,k=M.outer+(C.outer-M.outer)*_,L=M.front+(C.front-M.front)*_,v=M.top+(C.top-M.top)*_;V[r]={inner:w,outer:k,front:L,top:v,profile:{rs:[w,k],ls:[L,v]}}}for(let r=0;r<h;r++)V[r]&&(O[r]=!0);let X=360/h,K=[],q=O.filter(Boolean).length,Q=[];if(q===h)Q.push({start:0,len:h});else{let r=0;for(;O[r];)r=(r+1)%h;let p=-1;for(let x=0;x<=h;x++){let A=(r+x)%h,P=x<h&&O[A];if(P&&p<0)p=A;else if(!P&&p>=0){let N=(A-p+h)%h||h;Q.push({start:p,len:N}),p=-1}}}for(let r of Q){if(r.len*X<ln&&r.len<h)continue;let p=r.len===h,x=new Float64Array(r.len),A=new Float64Array(r.len),P=new Float64Array(r.len),N=new Float64Array(r.len),M=[];for(let s=0;s<r.len;s++){let g=V[(r.start+s)%h];x[s]=g.inner,A[s]=g.outer,P[s]=g.front,N[s]=g.top,M.push(g.profile??{rs:[g.inner,g.outer],ls:[g.front,g.top]})}let C=J(x,p),_=J(A,p),w=J(P,p),k=J(N,p);for(let s=0;s<r.len;s++)C[s]>x[s]&&(C[s]=x[s]),_[s]<A[s]&&(_[s]=A[s]),C[s]>_[s]-1e-6&&(C[s]=Math.max(0,_[s]-1e-6)),k[s]<w[s]&&(k[s]=w[s]);let L={startBin:r.start,binCount:r.len,closed:p,innerR:C,outerR:_,frontLevelM:w,topLevelM:k,profiles:M},v=(s,g,I)=>{let H=M[s],T=H.rs,E=H.ls;if(g<=T[0]){E[0]>I&&(E[0]=I);return}if(g>=T[T.length-1]){E[E.length-1]>I&&(E[E.length-1]=I);return}for(let G=0;G+1<T.length;G++)if(g<=T[G+1]){E[G]>I&&(E[G]=I),E[G+1]>I&&(E[G+1]=I);return}};for(let s=0;s<r.len;s++){let g=n[(r.start+s)%h];if(g)for(let I of g.samples){v(s,I.r,I.levelM);let H=p?(s-1+r.len)%r.len:s-1,T=p?(s+1)%r.len:s+1;H>=0&&v(H,I.r,I.levelM),T<r.len&&v(T,I.r,I.levelM)}}K.push(L)}K.reduce((r,p)=>r+p.binCount*X,0)<cn||y.push({arcs:K,sectionIds:t.members.map(r=>r.sectionId),innerRMedian:j,outerRMedian:F})}if(!y.length)return null;if(y.sort((t,n)=>t.innerRMedian-n.innerRMedian),l){let t=y[y.length-1].outerRMedian;if(Math.hypot(l.x-b.x,l.y-b.y)>.9*t)return null}return{centre:b,binCount:h,binStepDeg:360/h,rings:y}}function dn(c,l,a,e){let f=c.binStepDeg,i=a/f-.5-l.startBin;i=(i%c.binCount+c.binCount)%c.binCount,i>l.binCount-1&&(l.closed?i=i-l.binCount<l.binCount-i?0:l.binCount-1:i=i-(l.binCount-1)<c.binCount-i?l.binCount-1:0);let u=Math.floor(i),R=l.closed?(u+1)%l.binCount:Math.min(l.binCount-1,u+1),b=i-u,m=d=>{let y=l.profiles[d],t=y.rs,n=y.ls;if(e<=t[0])return n[0];if(e>=t[t.length-1])return n[n.length-1];for(let o=0;o+1<t.length;o++)if(e<=t[o+1]){let B=t[o+1]-t[o],S=B>1e-9?(e-t[o])/B:0;return n[o]+(n[o+1]-n[o])*S}return n[n.length-1]};return m(u)*(1-b)+m(R)*b}export{bn as a,fn as b,hn as c,dn as d};
|