@seatlayer/core 0.89.2 → 0.90.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/dist/{chunk-A4GTB3SG.js → chunk-52CBK5HX.js} +1 -1
  2. package/dist/{chunk-R7TV7RYQ.js → chunk-77QFA3F4.js} +1 -1
  3. package/dist/{chunk-FVTW2IBN.js → chunk-EH47GKSO.js} +1 -1
  4. package/dist/{chunk-PMBS3VZM.js → chunk-FMPQZEXD.js} +1 -1
  5. package/dist/{chunk-66Q5LOBH.js → chunk-GISLORLL.js} +1 -1
  6. package/dist/{chunk-BCMCXHLH.js → chunk-K4TZQOTG.js} +1 -1
  7. package/dist/{chunk-WAGKI44J.js → chunk-OYKT5CCU.js} +1 -1
  8. package/dist/chunk-W4RS6OW7.js +1 -0
  9. package/dist/{chunk-PI3UH2EN.js → chunk-YAWJTFYK.js} +1 -1
  10. package/dist/core/chart-ops/index.cjs +1 -1
  11. package/dist/core/chart-ops/index.js +1 -1
  12. package/dist/core/inventory/index.cjs +1 -1
  13. package/dist/core/inventory/index.d.cts +2 -2
  14. package/dist/core/inventory/index.d.ts +2 -2
  15. package/dist/core/inventory/index.js +1 -1
  16. package/dist/core/layout/index.cjs +1 -1
  17. package/dist/core/layout/index.d.cts +2 -2
  18. package/dist/core/layout/index.d.ts +2 -2
  19. package/dist/core/layout/index.js +1 -1
  20. package/dist/core/quality/index.d.cts +2 -2
  21. package/dist/core/quality/index.d.ts +2 -2
  22. package/dist/core/sections/index.cjs +1 -1
  23. package/dist/core/sections/index.d.cts +1 -1
  24. package/dist/core/sections/index.d.ts +1 -1
  25. package/dist/core/sections/index.js +1 -1
  26. package/dist/index.cjs +1 -1
  27. package/dist/index.d.cts +18 -8
  28. package/dist/index.d.ts +18 -8
  29. package/dist/index.js +1 -1
  30. package/dist/{renderedQuality-CrlBXHzi.d.ts → renderedQuality-CHm4mIjB.d.ts} +1 -1
  31. package/dist/{renderedQuality-CeSE6pEM.d.cts → renderedQuality-x1_lUJYV.d.cts} +1 -1
  32. package/dist/{renderer-B1mEhbA7.d.cts → renderer-DLTYfHV2.d.cts} +6 -2
  33. package/dist/{renderer-BwZhXv8G.d.ts → renderer-DN1yCX7-.d.ts} +6 -2
  34. package/dist/{tableSizing-wnW3HNga.d.cts → tableSizing-f-hh6kCg.d.cts} +2 -2
  35. package/dist/{tableSizing-DyS3UAha.d.ts → tableSizing-oDI0D8c2.d.ts} +2 -2
  36. package/dist/{ticketRestrictions-DuYWl2uy.d.ts → ticketRestrictions-BXtFOUqJ.d.ts} +1 -1
  37. package/dist/{ticketRestrictions-BTTN-LzH.d.cts → ticketRestrictions-Bc08-Hip.d.cts} +1 -1
  38. package/dist/view3d/index.cjs +12 -12
  39. package/dist/view3d/index.d.cts +1 -1
  40. package/dist/view3d/index.d.ts +1 -1
  41. package/dist/view3d/index.js +1 -1
  42. package/dist/view3d/scene/scene.worker.cjs +1 -1
  43. package/dist/view3d/scene/scene.worker.js +1 -1
  44. package/package.json +1 -1
  45. package/dist/chunk-E7TOTX6I.js +0 -1
@@ -1 +1 @@
1
- import{a as Pn,c as In,d as wn}from"./chunk-FVTW2IBN.js";import{a as gn}from"./chunk-QJXSZT3H.js";import{a as Mn,c as Nt,d as ft,f as It,i as An}from"./chunk-R7TV7RYQ.js";import{f as hn}from"./chunk-4I2VWFJY.js";import{e as Sn,k as Rn}from"./chunk-UL5OIGIF.js";import{Ea as qt,Z as ut,_ as lt,f as bn,ha as Gt,ja as dn,ka as Dt,ma as yn,qa as xn,x as pn,y as At}from"./chunk-E7TOTX6I.js";import{A as Pt,d as H,y as nt}from"./chunk-JBOTRSMY.js";import Ae from"earcut";import Pe from"polygon-clipping";var g=ut,Ie=.002;function we(t,n,e){let r=Math.hypot(n[0]-t[0],n[1]-t[1],n[2]-t[2]),o=Math.hypot(e[0]-n[0],e[1]-n[1],e[2]-n[2]),a=Math.hypot(t[0]-e[0],t[1]-e[1],t[2]-e[2]),i=Math.max(r,o,a);if(i<1e-9)return!0;let s=(r+o+a)/2;return 2*Math.sqrt(Math.max(0,s*(s-r)*(s-o)*(s-a)))/i<Ie}var ht=class{constructor(n=16384){this.len=0;this.buf=new Float32Array(n)}push3(n,e,r){this.len+3>this.buf.length&&this.grow(this.len+3),this.buf[this.len++]=n,this.buf[this.len++]=e,this.buf[this.len++]=r}push1(n){this.len+1>this.buf.length&&this.grow(this.len+1),this.buf[this.len++]=n}grow(n){let e=this.buf.length*2;for(;e<n;)e*=2;let r=new Float32Array(e);r.set(this.buf.subarray(0,this.len)),this.buf=r}get length(){return this.len}toArray(){return this.buf.slice(0,this.len)}},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,r,o,a,i=a,s=a){we(n,e,r)||(this.pos.push3(n[0],n[1],n[2]),this.pos.push3(e[0],e[1],e[2]),this.pos.push3(r[0],r[1],r[2]),this.nor.push3(o[0],o[1],o[2]),this.nor.push3(o[0],o[1],o[2]),this.nor.push3(o[0],o[1],o[2]),this.col.push3(a[0],a[1],a[2]),this.col.push3(i[0],i[1],i[2]),this.col.push3(s[0],s[1],s[2]),this.flr.push1(this.currentFloor),this.flr.push1(this.currentFloor),this.flr.push1(this.currentFloor),this.mat.push1(this.currentMaterial),this.mat.push1(this.currentMaterial),this.mat.push1(this.currentMaterial))}triN(n,e,r,o,a,i,s,l=s,c=s){[...n,...e,...r].every(Number.isFinite)&&(this.pos.push3(n[0],n[1],n[2]),this.pos.push3(e[0],e[1],e[2]),this.pos.push3(r[0],r[1],r[2]),this.nor.push3(o[0],o[1],o[2]),this.nor.push3(a[0],a[1],a[2]),this.nor.push3(i[0],i[1],i[2]),this.col.push3(s[0],s[1],s[2]),this.col.push3(l[0],l[1],l[2]),this.col.push3(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 _e(t,n,e){let r=n[0]-t[0],o=n[1]-t[1],a=n[2]-t[2],i=e[0]-t[0],s=e[1]-t[1],l=e[2]-t[2],c=o*l-a*s,f=a*i-r*l,m=r*s-o*i,u=Math.hypot(c,f,m)||1;return c/=u,f/=u,m/=u,[c,f,m]}function Te(t,n){let e=[...t],r=[];for(let i of t)r.push(i.x,i.y);let o=[];if(n){for(let i of n)if(!(i.length<3)){o.push(e.length);for(let s of i)e.push(s),r.push(s.x,s.y)}}let a=Ae(r,o.length?o:void 0,2);return{pts:e,tris:a}}function Jt(t){return ft(t)<0?[...t].reverse():t}var Be=3;function Ee(t,n,e,r){let o=r(t),a=r(n),i=r(e),s=(h,b,p,d)=>Math.abs(r({x:(h.x+b.x)/2,y:(h.y+b.y)/2})-(p+d)/2),l=(t.x+n.x+e.x)/3,c=(t.y+n.y+e.y)/3,f=(o+a+i)/3,m=Math.max(s(t,n,o,a),s(n,e,a,i),s(e,t,i,o),Math.abs(r({x:l,y:c})-f)),u=(h,b,p)=>{let d=Math.abs(r({x:(h+l)/2,y:(b+c)/2})-(p+f)/2);d>m&&(m=d)};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+i)/2),u((e.x+t.x)/2,(e.y+t.y)/2,(i+o)/2),m}function wt(t,n,e,r,o){if(o<=0)return Ee(t,n,e,r);let a={x:(t.x+n.x)/2,y:(t.y+n.y)/2},i={x:(n.x+e.x)/2,y:(n.y+e.y)/2},s={x:(e.x+t.x)/2,y:(e.y+t.y)/2};return Math.max(wt(t,a,s,r,o-1),wt(a,n,i,r,o-1),wt(s,i,e,r,o-1),wt(a,i,s,r,o-1))}function _t(t,n,e,r,o,a,i,s){if(i>0){let u={x:(n.x+e.x)/2,y:(n.y+e.y)/2},h={x:(e.x+r.x)/2,y:(e.y+r.y)/2},b={x:(r.x+n.x)/2,y:(r.y+n.y)/2};_t(t,n,u,b,o,a,i-1,s),_t(t,u,e,h,o,a,i-1,s),_t(t,b,h,r,o,a,i-1,s),_t(t,u,h,b,o,a,i-1,s);return}let l=[n.x*g,o(n),n.y*g],c=[e.x*g,o(e),e.y*g],f=[r.x*g,o(r),r.y*g];if(s){t.triN(l,c,f,s(n),s(e),s(r),a);return}let m=_e(l,c,f);m[1]<0&&(m=[-m[0],-m[1],-m[2]]),t.tri(l,c,f,m,a)}var Ce=8;function _n(t,n,e){if(!Number.isFinite(e))return t;let r=[],o=(a,i,s,l,c)=>{if(c>0){let f={x:(a.x+i.x)/2,y:(a.y+i.y)/2},m=n(f);if(Math.abs(m-(s+l)/2)>e){o(a,f,s,m,c-1),o(f,i,m,l,c-1);return}}r.push(a)};for(let a=0;a<t.length;a++){let i=t[a],s=t[(a+1)%t.length];o(i,s,n(i),n(s),Ce)}return r}function Xt(t,n){if(t.length<3)return t;let e=[];for(let o of t){let a=e[e.length-1];a&&Math.hypot(o.x-a.x,o.y-a.y)<n||e.push(o)}for(;e.length>2&&Math.hypot(e[0].x-e[e.length-1].x,e[0].y-e[e.length-1].y)<n;)e.pop();if(e.length<3)return t;let r=[];for(let o=0;o<e.length;o++){let a=r.length?r[r.length-1]:e[(o-1+e.length)%e.length],i=e[o],s=e[(o+1)%e.length],l=s.x-a.x,c=s.y-a.y,f=Math.hypot(l,c);f>n&&Math.abs((i.x-a.x)*c-(i.y-a.y)*l)/f<n||r.push(i)}return r.length>=3?r:e}var Ut=.001*lt*.1;function K(t,n,e,r,o,a,i,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=Xt(_n(Xt(Jt(n),Ut),r,l),Ut),m=e?.map(M=>Xt(_n(Xt(Jt(M),Ut),r,l),Ut)).filter(M=>M.length>=3&&Math.abs(ft(M))>=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],d=[i[0]*s.top,i[1]*s.top,i[2]*s.top],y=[i[0]*s.wallBottom,i[1]*s.wallBottom,i[2]*s.wallBottom],x=0;if(Number.isFinite(l))for(;x<Be;x++){let M=0;for(let I=0;I<h.length;I+=3){let B=wt(u[h[I]],u[h[I+1]],u[h[I+2]],r,x);B>M&&(M=B)}if(M<=l)break}for(let M=0;M<h.length;M+=3){let I=u[h[M]],B=u[h[M+1]],k=u[h[M+2]];_t(t,I,B,k,r,b,x,c);let D=[I.x*g,o,I.y*g],U=[B.x*g,o,B.y*g],S=[k.x*g,o,k.y*g];t.tri(D,S,U,[0,-1,0],p)}let w=M=>{if(x<=0)return M;let I=1<<x,B=[];for(let k=0;k<M.length;k++){let D=M[k],U=M[(k+1)%M.length];for(let S=0;S<I;S++){let _=S/I;B.push({x:D.x+(U.x-D.x)*_,y:D.y+(U.y-D.y)*_})}}return B},A=pn(f),E=[{ring:w(f),flip:!1}];if(m)for(let M of m)M.length>=3&&E.push({ring:w(M),flip:!0});for(let{ring:M,flip:I}of E)for(let B=0;B<M.length;B++){let k=M[B],D=M[(B+1)%M.length],U=(D.x-k.x)*g,_=(D.y-k.y)*g,N=-U,O=Math.hypot(_,N)||1;_/=O,N/=O;let P=(k.x+D.x)/2-A.x,F=(k.y+D.y)/2-A.y,R=_*P+N*F;I&&(R=-R),R<0&&(_=-_,N=-N);let T=[_,0,N],C=[k.x*g,r(k),k.y*g],v=[D.x*g,r(D),D.y*g],G=[k.x*g,o,k.y*g],X=[D.x*g,o,D.y*g];t.tri(C,v,X,T,d,d,y),t.tri(C,X,G,T,d,y,y)}}function Tn(t){let n=0;for(let l of t)n+=l.count;let e=new Float32Array(n*3),r=new Float32Array(n*3),o=new Float32Array(n*3),a=new Float32Array(n),i=new Float32Array(n),s=0;for(let l of t)e.set(l.position,s*3),r.set(l.normal,s*3),o.set(l.color,s*3),a.set(l.floor,s),i.set(l.material,s),s+=l.count;return{position:e,normal:r,color:o,floor:a,material:i,count:n}}function jt(t,n,e=2.5){if(n<=0||t.length<3)return t;let r=Jt(t),o=r.length,a=[];for(let s=0;s<o;s++){let l=r[s],c=r[(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 i=[];for(let s=0;s<o;s++){let l=r[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=()=>{i.push([l.x+c.x*n,l.y+c.y*n]),i.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,d=1/Math.max(p,1e-6);if(!Number.isFinite(d)||d>e){b();continue}i.push([l.x+m*n*d,l.y+u*n*d])}if(i.length<3)return t;try{let s=Pe.union([[...i,i[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,r,o=28){let a=[];for(let i=0;i<o;i++){let s=i/o*Math.PI*2;a.push({x:t+e*Math.cos(s),y:n+r*Math.sin(s)})}return a}function Tt(t,n,e,r){return[{x:t,y:n},{x:t+e,y:n},{x:t+e,y:n+r},{x:t,y:n+r}]}var Bt=["available","held","sold","selected","dimmed"];function Qt(t){let n=Bt.indexOf(t);return n<0?0:n}var Bn={available:[.24,.82,.52],held:[.95,.66,.22],sold:[.34,.39,.45],selected:[.24,.74,1],dimmed:[.28,.32,.37]};function mr(t){let n=.2126*t[0]+.7152*t[1]+.0722*t[2],e=.42,r=.62;return[(n+(t[0]-n)*e)*r,(n+(t[1]-n)*e)*r,(n+(t[2]-n)*e)*r]}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},Fe=.44,ve=.15,ke=.3,Oe=.24;function En(t){return t===void 0||!Number.isFinite(t)||t<=0?Oe:Math.min(ke,Math.max(ve,t*Fe))}var hr=.21,Le=.05,en=.45,Ge=en+Le,De=.92,Ne=1.205,Xe=-.23,Ue=.38,Ye=[{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,Ge,-1],max:[1,De,-.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]}],je=[{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]}],He=[{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 br(){let t=[],n=[],e=[],r=[],o=(O,P,F)=>{let R=e.length,[T,C,v]=O,G=[C[0]-T[0],C[1]-T[1],C[2]-T[2]],X=[v[0]-T[0],v[1]-T[1],v[2]-T[2]],L=G[1]*X[2]-G[2]*X[1],Y=G[2]*X[0]-G[0]*X[2],j=G[0]*X[1]-G[1]*X[0],$=Math.hypot(L,Y,j);$>1e-9?(L/=$,Y/=$,j/=$):[L,Y,j]=P,L*P[0]+Y*P[1]+j*P[2]<0&&(L=-L,Y=-Y,j=-j);for(let z of O)t.push(...z),n.push(L,Y,j),e.push(F);r.push(R,R+1,R+2,R,R+2,R+3)},a=O=>{for(let P of He){let F=P.c.map(R=>R.map((T,C)=>T?O.max[C]:O.min[C]));o(F,P.n,O.part)}};for(let O of Ye)a(O);for(let O of je)a(O);let i=en,s=1.08,l=.47,c=.69,f=-.55,m=.08,u=-.48,h=.01,b=[-l,i,f],p=[l,i,f],d=[-l,i,m],y=[l,i,m],x=[-c,s,u],w=[c,s,u],A=[-c,s,h],E=[c,s,h];o([p,w,E,y],[1,0,0],V.body),o([d,A,x,b],[-1,0,0],V.body),o([A,E,w,x],[0,1,0],V.body),o([b,p,y,d],[0,-1,0],V.body),o([y,E,A,d],[0,0,1],V.body),o([b,x,w,p],[0,0,-1],V.body);let M=10,I=8,B=[0,Ne,Xe],k=[.42,.115,Ue],D=e.length;for(let O=0;O<=I;O++){let P=Math.PI*O/I,F=Math.cos(P),R=Math.sin(P);for(let T=0;T<=M;T++){let C=Math.PI*2*T/M,v=R*Math.cos(C),G=R*Math.sin(C);t.push(B[0]+k[0]*v,B[1]+k[1]*F,B[2]+k[2]*G);let X=v/k[0],L=F/k[1],Y=G/k[2],j=Math.hypot(X,L,Y)||1;X/=j,L/=j,Y/=j,n.push(X,L,Y),e.push(V.head)}}for(let O=0;O<I;O++)for(let P=0;P<M;P++){let F=D+O*(M+1)+P,R=F+M+1;r.push(F,R,F+1,F+1,R,R+1)}let U=new Float32Array(t),S=new Float32Array(n),_=new Float32Array(e),N=new Uint16Array(r);return{position:U,normal:S,part:_,index:N,vertexCount:e.length,indexCount:r.length}}function Cn(t,n,e,r){let o=new Float32Array(n),a=c=>t[c*3],i=c=>t[c*3+2],s=0,l=(c,f)=>{let m=f-c;for(let u=c;u<f;u++){let[h,b]=r(u),p=h-a(u),d=b-i(u);if(m>=2){let y=Math.max(c,u-1),x=Math.min(f-1,u+1),w=a(x)-a(y),A=i(x)-i(y),E=Math.hypot(w,A);if(E>1e-6){let M=-A/E,I=w/E;M*p+I*d<0&&(M=-M,I=-I),p=M,d=I}}o[u]=p===0&&d===0?0:Math.atan2(p,d)}};for(let c=1;c<=n;c++)(c===n||e(c)!==e(s))&&(l(s,c),s=c);return o}var Vt=.22;function Ar(t,n){let e=Bt[t];if(e!=="sold"&&e!=="held")return-1;let r=(n+1)*2654435761;return r^=r>>>15,r=Math.imul(r,2246822519),r^=r>>>13,(r>>>0)%1e5/1e5}var Ve=.42;function We(t){let n=t.length,e=new Float64Array(n);if(n<2)return e.fill(1/0),e;let r=1/0,o=1/0,a=-1/0,i=-1/0;for(let b of t)b.x<r&&(r=b.x),b.y<o&&(o=b.y),b.x>a&&(a=b.x),b.y>i&&(i=b.y);let s=Math.max(a-r,1e-6),l=Math.max(i-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 d=Math.min(f-1,Math.max(0,Math.floor((b-r)/c)));return Math.min(m-1,Math.max(0,Math.floor((p-o)/c)))*f+d};for(let b=0;b<n;b++){let p=h(t[b].x,t[b].y),d=u.get(p);d?d.push(b):u.set(p,[b])}for(let b=0;b<n;b++){let p=t[b],d=Math.min(f-1,Math.max(0,Math.floor((p.x-r)/c))),y=Math.min(m-1,Math.max(0,Math.floor((p.y-o)/c))),x=1/0;for(let w=1;w<=4;w++){for(let A=y-w;A<=y+w;A++)if(!(A<0||A>=m))for(let E=d-w;E<=d+w;E++){if(E<0||E>=f||w>1&&Math.abs(A-y)<w&&Math.abs(E-d)<w)continue;let M=u.get(A*f+E);if(M)for(let I of M){if(I===b)continue;let B=Math.hypot(t[I].x-p.x,t[I].y-p.y);B<x&&(x=B)}}if(Number.isFinite(x)&&x<=w*c)break}e[b]=x}return e}function ze(t){let n=t.eyeHeightM;return Number.isFinite(n)?Math.max(0,n-Gt):0}function Fn(t,n,e,r,o,a){let i=t.length,s=new Float32Array(i*3),l=new Float32Array(i),c=new Float32Array(i*3),f=new Float32Array(i),m=new Float32Array(i),u=new Float32Array(i),h=new Float32Array(i),b=new Float32Array(i*3),p=new Map,d=We(t);for(let y=0;y<i;y++){let x=t[y],A=(e?.seatPitchU(y)??d[y])*g;f[y]=Number.isFinite(A)?Math.max(.06,Math.min(Vt,A*Ve)):Vt,m[y]=En(Number.isFinite(A)?A:void 0);let E=Rn(x.glyph,{seatGlyph:a?.get(x.categoryKey)});u[y]=Sn.indexOf(E),h[y]=x.wheelchairSpaceType==="no-seat"?0:1,s[y*3]=x.x*g,s[y*3+1]=e?e.seatDeckY(y):ze(x),s[y*3+2]=x.y*g,l[y]=Qt(n?n(x):"available");let M=H(o?.get(x.categoryKey)??"#6e7bff")??[.43,.48,1];if(c[y*3]=M[0],c[y*3+1]=M[1],c[y*3+2]=M[2],x.accessibility?.length){let I=H(hn(x.accessibility));I&&(b[y*3]=I[0],b[y*3+1]=I[1],b[y*3+2]=I[2])}p.set(x.id,y)}return{count:i,iPosition:s,iState:l,iCategory:c,iMaxRadius:f,iRing:b,idToIndex:p,iChairWidth:m,iGlyph:u,iPhysicalSeat:h,iFloor:r??new Float32Array(i),iYaw:new Float32Array(i)}}var Ze=64;function Pr(t,n){let e=[];for(let i of n){let s=t.idToIndex.get(i.seatId);if(s===void 0)continue;let l=Qt(i.state);t.iState[s]!==l&&(t.iState[s]=l,e.push(s))}if(!e.length)return[];e.sort((i,s)=>i-s);let r=[],o=e[0],a=e[0];for(let i=1;i<e.length;i++){let s=e[i];if(s!==a){if(s<=a+Ze){a=s;continue}r.push({start:o,length:a-o+1}),o=s,a=s}}return r.push({start:o,length:a-o+1}),r}function _r(t,n,e){return e<0?n>1?t.filter(r=>r.kind==="floor"):[...t]:t.filter(r=>r.floorIndex===void 0||r.floorIndex===e)}function Tr(t,n){let e=[...t].sort((o,a)=>o.screen.y-a.screen.y),r=[];for(let o of e){let a=r.find(i=>i.some(s=>Math.abs(s.screen.x-o.screen.x)<104&&Math.abs(s.screen.y-o.screen.y)<34));a?a.push(o):r.push([o])}return r.flatMap(o=>o.length<2?o:o.map((a,i)=>({...a,screen:{...a.screen,x:Math.max(54,Math.min(n-54,a.screen.x+(i-(o.length-1)/2)*104))}})))}var Ke=1.15,$e=2.75,qe=4.5,Je=.85,Qe=.5,to=.26;function Br(t,n,e){let r=Math.max(1e-6,n),o=t/r,a=e?.hasZoneLabels??!0,i=new Set;return o>=.75&&i.add("floor"),o>=Ke&&i.add("zone"),o<=(a?$e:qe)&&(i.add("section"),i.add("ga")),o<=Je&&(i.add("annotation"),i.add("booth")),o<=Qe&&i.add("row"),o<=to&&i.add("seat"),i}function Er(t,n,e,r,o,a=6){let i=a+n,s=r-a-n,l=a+e,c=o-a-e;return{...t,x:i>s?r/2:Math.max(i,Math.min(s,t.x)),y:l>c?o/2:Math.max(l,Math.min(c,t.y))}}function Cr(t,n,e,r){let o=t,a=n[0],i=n[1],s=n[2],l=o[0]*a+o[4]*i+o[8]*s+o[12],c=o[1]*a+o[5]*i+o[9]*s+o[13],f=o[2]*a+o[6]*i+o[10]*s+o[14],m=o[3]*a+o[7]*i+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))*r,depth:b,visible:p}}function Fr(t,n,e=n){let r=[],o=[...t].sort((a,i)=>a.screen.depth-i.screen.depth);for(let a of o){let i=!1;for(let s of r)if(on(a,s,n,e)){i=!0;break}i||r.push(a)}return r}var no=6;function on(t,n,e,r){let o=Math.abs(t.screen.x-n.screen.x),a=Math.abs(t.screen.y-n.screen.y),i=t.halfWidth!=null&&n.halfWidth!=null?Math.max(e,t.halfWidth+n.halfWidth+no):e;return o<i&&a<r}function vr(t,n,e){return t.length*n*.58+(e?14:0)}var eo={row:8,seat:14};function kr(t){return t<480?{row:5,seat:8}:t<768?{row:6,seat:10}:eo}function Or(t,n,e,r){let o=Math.max(1,Math.min(e,r)*.5),a=Math.min(2,Math.hypot(t.x-e/2,t.y-r/2)/o);return n*(1+1.5*a)}function Lr(t,n,e,r,o=[]){let a=[...t].sort((s,l)=>(l.priority??0)-(s.priority??0)||s.focus-l.focus),i=[];for(let s of a){if(i.length>=r)break;let l=!1;for(let c of o)if(on(s,c,n,e)){l=!0;break}if(!l){for(let c of i)if(on(s,c,n,e)){l=!0;break}}l||i.push(s)}return i}import bo from"polygon-clipping";var W={top:1,wallBottom:.5,bottomCap:.4};function st(t,n){if(!t)return n;let e=et(Pt(t,.4),.62);return nt(n,e,.72)}function vn(t,n){let e=new Map;for(let a of t.categories??[])e.set(a.key,a.color);let r=new Map;for(let a of n){if(!a.sectionId)continue;let i=r.get(a.sectionId);i||(i=new Map,r.set(a.sectionId,i)),i.set(a.categoryKey,(i.get(a.categoryKey)??0)+1)}let o=new Map;for(let[a,i]of r){let s=0,l=0,c=0,f=0;for(let[m,u]of i){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 kn(t,n){return H(t.color)??n.get(t.logicalSectionId??t.id)??null}import zn from"polygon-clipping";import Dn from"polygon-clipping";import oo from"earcut";var ro=.58,On=.01,ot=Vt*1.5*lt,io=.5,so=.6;function ao(t,n){let e=t.length,r=[];for(let i=0;i<e;i++){let s=t[Math.max(0,i-1)],l=t[Math.min(e-1,i+1)],c=l.x-s.x,f=l.y-s.y,m=Math.hypot(c,f);if(m<1e-9){r.push([0,0]);continue}c/=m,f/=m,r.push([-f,c])}let o=0;for(let i=0;i<e;i++)o+=(t[i].x-n.x)*r[i][0]+(t[i].y-n.y)*r[i][1];return o<0?r.map(([i,s])=>[-i,-s]):r}function co(t,n){if(t.length<2||n<=0)return[...t];let e=[...t],r=(i,s)=>{let l=s.x-i.x,c=s.y-i.y,f=Math.hypot(l,c)||1;return{x:l/f,y:c/f}},o=r(e[1],e[0]),a=r(e[e.length-2],e[e.length-1]);return e.unshift({x:e[0].x+o.x*n,y:e[0].y+o.y*n}),e.push({x:e[e.length-1].x+a.x*n,y:e[e.length-1].y+a.y*n}),e}var Ln=Math.PI/12;function uo(t){if(t.length<3)return[...t];let n=[...t].sort((a,i)=>a.x-i.x||a.y-i.y),e=(a,i,s)=>(i.x-a.x)*(s.y-a.y)-(i.y-a.y)*(s.x-a.x),r=a=>{let i=[];for(let s of a){for(;i.length>=2&&e(i[i.length-2],i[i.length-1],s)<=0;)i.pop();i.push(s)}return i.pop(),i},o=[...r(n),...r([...n].reverse())];return o.length>=3?o:[...t]}function Nn(t,n){if(!t.length||!(n>0))return[];let e=uo(t),r=(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/Ln)),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/Ln)),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 i=[];for(let s=0;s<o;s++)r(e[s],a[(s+o-1)%o],a[s],i);return Hn(i)}function lo(t,n,e){if(t.length===1)return Math.hypot(n-t[0].x,e-t[0].y);let r=1/0;for(let o=0;o+1<t.length;o++){let a=t[o],i=t[o+1],s=i.x-a.x,l=i.y-a.y,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<r&&(r=m)}return r}function Wt(t){let n=t.map(o=>{let a=0,i=0;for(let c of o.pts)a+=c.x,i+=c.y;let s=o.pts.length||1;a/=s,i/=s;let l=0;for(let c of o.pts){let f=Math.hypot(c.x-a,c.y-i);f>l&&(l=f)}return{cx:a,cy:i,rad:l}}),e=o=>{let a=o.length;return a<=2?[...o]:[o[Math.floor(a*.25)],o[Math.floor(a*.5)],o[Math.floor(a*.75)]]},r=[];for(let o=0;o<t.length;o++){let a=e(t[o].pts),i=[],s=1/0,l=null;for(let 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=lo(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&&i.push(m)}i.sort((f,m)=>f-m);let c=i.length?i[Math.floor(i.length/2)]:1;r.push({pitch:c,belowY:l})}return r}function Xn(t,n,e,r){let o=t[n],a=o.pts.length>=2?[...o.pts]:o.pts.length===1?(()=>{let f=o.pts[0],m=f.x-r.x,u=f.y-r.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 i=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&&(i+=m,s++)}let l=s>0?i/s:0,c=co(a,Math.max(l*so,ot));return{pts:c,nrm:ao(c,r),front:Math.max(e[n].pitch*ro,ot),back:Math.max(e[n].pitch*io,ot)}}var gt=1.5,Un=.3;function rn(t,n){if(t.length<3)return t;let e=t[0],r=t[t.length-1],o=r.x-e.x,a=r.y-e.y,i=Math.hypot(o,a),s=-1,l=-1;for(let m=1;m<t.length-1;m++){let u=t[m],h=i>1e-12?Math.abs((u.x-e.x)*a-(u.y-e.y)*o)/i:Math.hypot(u.x-e.x,u.y-e.y);h>s&&(s=h,l=m)}if(s<=n||l<0)return[e,r];let c=rn(t.slice(0,l+1),n),f=rn(t.slice(l),n);return[...c.slice(0,-1),...f]}function Yn(t,n){if(t.length<4)return t;let e=rn([...t,t[0]],n);return e.pop(),e.length>=3?e:t}function jn(t,n,e){if(t.length<2)return[];let r=e??Wt(t),o=new Map;for(let i=0;i<t.length;i++){let s=o.get(t[i].blockId);s?s.push(i):o.set(t[i].blockId,[i])}let a=[];for(let[,i]of o){let s=[];for(let x of i){let w=t[x].patch;w&&w.length>=3?a.push({outline:[...w],holes:[],topY:t[x].y}):s.push(x)}if(!s.length)continue;s.sort((x,w)=>t[x].depth-t[w].depth);let c=s.map(x=>Xn(t,x,r,n)).filter(x=>x!==null);if(!c.length)continue;let f=(x,w)=>({x:x.pts[w].x-x.nrm[w][0]*(x.front+gt),y:x.pts[w].y-x.nrm[w][1]*(x.front+gt)}),m=(x,w)=>({x:x.pts[w].x+x.nrm[w][0]*(x.back+gt),y:x.pts[w].y+x.nrm[w][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=Hn(b),d=1/0;for(let x of s)t[x].y<d&&(d=t[x].y);if(!Number.isFinite(d))continue;if(p.length>=3&&Math.abs(ft(p))>1e-6&&c.every(x=>{let w=x.pts[Math.floor(x.pts.length/2)];return It(p,w.x,w.y)})){a.push({outline:Yn(p,Un),holes:[],topY:d});continue}for(let x of mo(c))a.push({outline:x,holes:[],topY:d})}return a}function mo(t){let n=[];for(let e of t){let r=[],o=[],a=e.front+gt,i=e.back+gt;for(let l=0;l<e.pts.length;l++){let c=e.pts[l],f=e.nrm[l];r.push([c.x-f[0]*a,c.y-f[1]*a]),o.push([c.x+f[0]*i,c.y+f[1]*i])}let s=[...r,...o.reverse()];s.length<3||(s.push(s[0]),n.push([s]))}if(!n.length)return[];try{let e=Dn.union(n[0],...n.slice(1)),r=[];for(let o of e){if(!o.length||o[0].length<4)continue;let a=o[0].map(([l,c])=>({x:l,y:c})),i=a[0],s=a[a.length-1];a.length>1&&Math.abs(i.x-s.x)<1e-9&&Math.abs(i.y-s.y)<1e-9&&a.pop(),a.length>=3&&r.push(Yn(a,Un))}return r}catch{return[]}}function Hn(t){let n=[];for(let e of t){let r=n[n.length-1];r&&Math.hypot(e.x-r.x,e.y-r.y)<1e-9||n.push(e)}for(;n.length>2&&Math.hypot(n[0].x-n[n.length-1].x,n[0].y-n[n.length-1].y)<1e-9;)n.pop();return n}var 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 r of e)r.x<this.minX&&(this.minX=r.x),r.y<this.minY&&(this.minY=r.y),r.x>this.maxX&&(this.maxX=r.x),r.y>this.maxY&&(this.maxY=r.y)}containsAll(n){for(let e of n)if(e.x<this.minX||e.x>this.maxX||e.y<this.minY||e.y>this.maxY)return!1;for(let e of this.rings){let r=!0;for(let o of n)if(!It(e,o.x,o.y)){r=!1;break}if(r)return!0}return!1}};function Gn(t,n,e,r,o,a){if(r.length<3)return;if(e.containsAll(r)){let c=[0,1,0],f=r[0];for(let m=1;m+1<r.length;m++){let u=r[m],h=r[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 i=r.map(c=>[c.x,c.y]);i.push(i[0]);let s;try{s=Dn.intersection([i],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=oo(m,void 0,2);for(let b=0;b<h.length;b+=3){let p=u[h[b]],d=u[h[b+1]],y=u[h[b+2]];t.tri([p[0]*g,o,p[1]*g],[d[0]*g,o,d[1]*g],[y[0]*g,o,y[1]*g],l,a)}}}function Vn(t,n,e,r,o,a,i){if(n.length<2)return;let s=i??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 E=[...b.patch],M=s[h].belowY??r;if(u(()=>{if(c&&f)Gn(t,c,f,E,b.y,o.tread);else{let I=E[0];for(let B=1;B+1<E.length;B++){let k=E[B],D=E[B+1];t.tri([I.x*g,b.y,I.y*g],[k.x*g,b.y,k.y*g],[D.x*g,b.y,D.y*g],l,o.tread)}}}),b.y>M+On){let I=0,B=0;for(let k of E)I+=k.x,B+=k.y;I/=E.length,B/=E.length,m(()=>{for(let k=0;k<E.length;k++){let D=E[k],U=E[(k+1)%E.length],S=U.x-D.x,_=U.y-D.y,N=Math.hypot(S,_);if(N<1e-6)continue;let O=_/N,P=-S/N;(D.x-I)*O+(D.y-B)*P<0&&(O=-O,P=-P);let F=[O,0,P],R=[D.x*g,b.y,D.y*g],T=[U.x*g,b.y,U.y*g],C=[D.x*g,M,D.y*g],v=[U.x*g,M,U.y*g];t.tri(R,T,v,F,o.riser),t.tri(R,v,C,F,o.riser)}})}continue}let p=Xn(n,h,s,e);if(!p)continue;let{pts:d,nrm:y,front:x,back:w}=p,A=s[h].belowY??r;for(let E=0;E+1<d.length;E++){let M=d[E],I=d[E+1],B=y[E],k=y[E+1];if(Math.hypot(I.x-M.x,I.y-M.y)<1e-6||B[0]===0&&B[1]===0||k[0]===0&&k[1]===0)continue;let D=[(M.x-B[0]*x)*g,b.y,(M.y-B[1]*x)*g],U=[(I.x-k[0]*x)*g,b.y,(I.y-k[1]*x)*g],S=[(M.x+B[0]*w)*g,b.y,(M.y+B[1]*w)*g],_=[(I.x+k[0]*w)*g,b.y,(I.y+k[1]*w)*g];if(u(()=>{c&&f?Gn(t,c,f,[{x:M.x-B[0]*x,y:M.y-B[1]*x},{x:I.x-k[0]*x,y:I.y-k[1]*x},{x:I.x+k[0]*w,y:I.y+k[1]*w},{x:M.x+B[0]*w,y:M.y+B[1]*w}],b.y,o.tread):(t.tri(D,U,_,l,o.tread),t.tri(D,_,S,l,o.tread))}),b.y>A+On){let N=[D[0],A,D[2]],O=[U[0],A,U[2]],P=[-B[0],0,-B[1]];m(()=>{t.tri(D,U,O,P,o.riser),t.tri(D,O,N,P,o.riser)})}}}}function fo(t,n){let e=t.eventConfigurationIds;return!e?.length||!!n&&e.includes(n)}function Wn(t,n){return t.filter(e=>e.type!=="shape"||fo(e,n))}function Zn(t,n){let e=t.focalPoint??{x:0,y:0};return t.floors?.length?t.floors.map((r,o)=>({objects:Wn(r.objects,n),focal:{x:(r.focalPoint??e).x,y:(r.focalPoint??e).y},baseHeightM:r.baseHeightM??0,index:o})):[{objects:Wn(t.objects,n),focal:e,baseHeightM:0,index:0}]}var ho={minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};function Mt(t){return Mn(t)??ho}function Kn(t,n){let e=jt(t.outline,ot),r=Mt(e),o=n.filter(i=>i!==t&&i.outline&&i.outline.length>=3&&Nt(r,Mt(i.outline)));if(!o.length)return[e];let a=i=>{let s=i.map(l=>[l.x,l.y]);return s.push(s[0]),s};try{let i=zn.difference([a(e)],...o.map(l=>[a(l.outline)])),s=[];for(let l of i){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 $n(t,n){if(!n.length)return t;let e=a=>{let i=a.map(s=>[s.x,s.y]);return i.push(i[0]),i},r=n.map(a=>[e(a)]),o=[];for(let a of t){let i;try{i=zn.intersection([e(a.outline)],r.flat())}catch{o.push(a);continue}for(let s of i){if(!s.length)continue;let l=s[0].map(([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}function po(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 r=n.map(l=>[l.x,l.y]);if(r.length<3)return[];r.push(r[0]);let o=Mt(n),a=this.rings.filter((l,c)=>Nt(o,this.boxes[c])&&po(e,this.levels[c])),i=[[r]];if(a.length)try{i=bo.difference([r],...a).map(c=>c.map(f=>f.map(([m,u])=>[m,u])))}catch{i=[[r]]}this.rings.push([r]),this.boxes.push(o),this.levels.push(e);let s=[];for(let l of i){if(!l.length)continue;let 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 yo(t,n){if(!n)return t;let e=1/0,r=-1/0,o=1/0,a=-1/0;for(let m of t)e=Math.min(e,m.x),r=Math.max(r,m.x),o=Math.min(o,m.y),a=Math.max(a,m.y);let i=(e+r)/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-i,h=m.y-s;return{x:i+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=Tt(t.x??0,t.y??0,t.width,t.height)),t.kind==="ellipse"&&t.width&&t.height){let e=(t.x??0)+t.width/2,r=(t.y??0)+t.height/2;n=Ht(e,r,t.width/2,t.height/2)}return n?yo(n,t.rotation):null}function Et(t){let n=t.role??"",e={stage:{kind:"stage",heightM:1},entrance:{kind:"portal",heightM:2.7},exit:{kind:"portal",heightM:2.7},screen:{kind:"solid",heightM:6},wall:{kind:"solid",heightM:2.8},rail:{kind:"solid",heightM:1.1},suite:{kind:"suite",heightM:3},obstruction:{kind:"solid",heightM:4.5},sound:{kind:"solid",heightM:1.45},restroom:{kind:"solid",heightM:2.4},bar:{kind:"solid",heightM:1.1},concession:{kind:"solid",heightM:1.1},coat:{kind:"solid",heightM:1.1},goal:{kind:"portal",heightM:1.8}},r=n==="stage"&&xn(t.stageKind)?{kind:"stage",heightM:.06}:e[n]??{kind:"plate",heightM:.25};return{...r,heightM:t.heightM??r.heightM}}var xo=.08;function qn(t,n){let e=bt(t),r=Et(t),o=r.heightM;if(!e||r.kind!=="plate"&&r.kind!=="stage")return o;let a=1/0,i=1/0,s=-1/0,l=-1/0;for(let f of e)a=Math.min(a,f.x),i=Math.min(i,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&&i<f.maxY&&c<=f.topOffsetM+1e-6&&(c=f.topOffsetM+xo);return n.push({minX:a,minY:i,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 Jn(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 Ct(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 Qn(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,r,o,a){K(t,n,void 0,()=>e,r,o,a,W)}var an=2.4,go=.75,Mo=.15;function Ft(t){if(t.points&&t.points.length>=3)return t.points;let{center:n,width:e,height:r,rotation:o}=t;if(!e||!r)return null;let a=(o??0)*Math.PI/180,i=Math.cos(a),s=Math.sin(a),l=e/2,c=r/2;return[[-l,-c],[l,-c],[l,c],[-l,c]].map(([f,m])=>({x:n.x+f*i-m*s,y:n.y+f*s+m*i}))}function te(t,n,e,r,o){let a=Ft(n);a&&K(t,a,void 0,()=>e+an,e,st(r,o.boothTop),o.boothWall,W)}function cn(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:r,center:o}=t;if(!n||!e)return null;let a=(r??0)*Math.PI/180,i=Math.cos(a),s=Math.sin(a),l=n/2,c=e/2;return[[-l,-c],[l,-c],[l,c],[-l,c]].map(([f,m])=>({x:o.x+f*i-m*s,y:o.y+f*s+m*i}))}function ne(t,n,e,r,o){let a=cn(n);a&&K(t,a,void 0,()=>e+go,e,st(r,o.tableTop),o.tableWall,W)}function ee(t,n,e,r,o,a,i,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}:Et(n),u=s?.baseY??e,h=s?.topY??e+r;if(c&&i){let x=1/0,w=-1/0,A=1/0,E=-1/0;for(let M of l)M.x<x&&(x=M.x),M.x>w&&(w=M.x),M.y<A&&(A=M.y),M.y>E&&(E=M.y);i.push({cx:(x+w)/2*g,cz:(A+E)/2*g,y:h,halfX:Math.max((w-x)/2*g,.5),halfZ:Math.max((E-A)/2*g,.5)})}let b=H(n.fill),p=c&&b?nt(o.stageTop,et(Pt(b,.18),.9),.9):st(b,c?o.stageTop:o.decorTop),d=f?b:null,y=c?b?nt(o.stageWall,et(b,.58),.82):o.stageWall:f?d?nt(et(d,1.42),[.24,.46,.82],.08):[.24,.46,.82]:st(H(n.fill),o.decorWall);if(m.kind==="portal"&&l.length===4){let x=Jn(l);at(t,Ct(x,0,.16),h,u,p,y),at(t,Ct(x,.84,1),h,u,p,y),at(t,x,h,Math.max(u,h-.35),p,y);return}if(m.kind==="suite"&&l.length===4){let x=l.map((E,M)=>{let I=l[(M+1)%4],B=(E.x+I.x)/2,k=(E.y+I.y)/2;return Math.hypot(B-a.x,k-a.y)}),w=x.indexOf(Math.min(...x)),A=[0,1,2,3].map(E=>l[(w+E)%4]);at(t,Ct(A,0,.08),h,u,p,y),at(t,Ct(A,.92,1),h,u,p,y),at(t,Qn(A,.88,1),h,u,p,y),at(t,A,h,Math.max(u,h-.18),p,y);return}at(t,l,h,u,p,y)}function un(t){let{x:n,y:e,width:r,height:o}=t;if(!r||!o)return null;let a=n+r/2,i=e+o/2,s=(t.rotation??0)*Math.PI/180,l=Math.cos(s),c=Math.sin(s),f=r/2,m=o/2;return[[-f,-m],[f,-m],[f,m],[-f,m]].map(([u,h])=>({x:a+u*l-h*c,y:i+u*c+h*l}))}function So(t){if(!t||!t.startsWith("data:image/svg+xml"))return null;let n=t.slice(t.indexOf(",")+1);if(/;base64/i.test(t.slice(0,t.indexOf(","))))try{n=atob(n)}catch{return null}else try{n=decodeURIComponent(n)}catch{}let e=n.match(/<(?:rect|path)\b[^>]*\bfill="([^"]+)"/i);if(!e)return null;let r=e[1].trim();if(r==="none"||r==="transparent")return null;let o=r.match(/^url\(#([^)]+)\)$/);if(!o)return H(r);let a=n.match(new RegExp(`<(?:linear|radial)Gradient\\b[^>]*\\bid="${o[1]}"[^>]*>([\\s\\S]*?)</(?:linear|radial)Gradient>`,"i"));if(!a)return null;let i=[];for(let s of a[1].matchAll(/stop-color="([^"]+)"/gi)){let l=H(s[1].trim());l&&i.push(l)}return i.length?i.reduce((s,l,c)=>nt(s,l,1/(c+1)),i[0]):null}function oe(t,n,e,r){if(n.layer==="foreground")return;let o=un(n);if(!o)return;let a=e+Mo,i=st(So(n.href),r.decorTop),s=Math.max(0,Math.min(1,n.opacity??1));s<1&&(i=nt(r.ground,i,s)),K(t,o,void 0,()=>a,e,i,nt(i,r.decorWall,.5),W)}function re(t,n,e,r,o){if(!n.points||n.points.length<3)return;let a=st(r,o.gaTop);K(t,n.points,n.holes,()=>e+.15,e,a,o.gaWall,W)}var Ro=6,Ao=2.2,ie=.1,Po=.3,Io=1.8,wo=.9,_o=.55,To=6e3;function se(t){let{doc:n,units:e,seats:r,surfaces:o,focal:a}=t,i=n.zones??[],s=[];if(i.length){let l=new Map;for(let 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<r.length;f++){let m=r[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 i){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 ae(t){let{doc:n,units:e,seats:r,surfaces:o,seatData:a,hintedSeatFloor:i,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]+Ro,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<r.length;b++){let p=o.seatOwner[b];if(!p)continue;let d=u.get(p);d||(d={n:0,x:0,y:0,deck:0},u.set(p,d)),d.n++,d.x+=r[b].x,d.y+=r[b].y,d.deck+=o.seatDeckY(b);let y=h.get(p);y||(y={minX:1/0,maxX:-1/0,minY:1/0,maxY:-1/0},h.set(p,y)),r[b].x<y.minX&&(y.minX=r[b].x),r[b].x>y.maxX&&(y.maxX=r[b].x),r[b].y<y.minY&&(y.minY=r[b].y),r[b].y>y.maxY&&(y.maxY=r[b].y)}for(let b of e)for(let p of b.objects){if(p.type!=="section")continue;let d=u.get(p.id);if(!d||d.n===0)continue;let y=h.get(p.id),x=[d.x/d.n*g,d.deck/d.n,d.y/d.n*g],w=p.displayLabel||p.label||p.id;f.push({id:p.id,floorIndex:b.index,label:w,seatCount:d.n,center:x,radius:Math.max(1,Math.hypot(y.maxX-y.minX,y.maxY-y.minY)*.5*g),focalWorld:[b.focal.x*g,b.baseHeightM+1.5,b.focal.y*g]});let A=n.floors?.[b.index]?.name?.trim().toLocaleLowerCase();e.length>1&&A===w.trim().toLocaleLowerCase()||c.push({id:`section:${p.id}`,kind:"section",text:w,anchor:[x[0],x[1]+Ao,x[2]],floorIndex:b.index})}}{for(let p of e)for(let d of p.objects){if(d.type!=="gaArea")continue;let y=At(d.points);if(!y)continue;let x=d.displayLabel||d.label||d.id;c.push({id:`ga:${d.id}`,kind:"ga",text:d.capacity>0?`${x} \xB7 ${d.capacity.toLocaleString()}`:x,anchor:[y.x*g,p.baseHeightM+Io,y.y*g],floorIndex:p.index})}let u=new Map;for(let p of e)for(let d of p.objects)d.type==="section"&&u.set(d.id,d.displayLabel||d.label||d.id);let h=new Map;for(let p=0;p<r.length;p++){let d=r[p],y=Math.hypot(d.x-l.x,d.y-l.y),x=h.get(d.rowId);(!x||y>x.far)&&h.set(d.rowId,{seat:d,index:p,far:y})}for(let[p,d]of h){let y=Eo(d.seat.label,p,u.get(d.seat.sectionId??""));y&&c.push({id:`row:${p}`,kind:"row",text:y,anchor:[d.seat.x*g,o.seatDeckY(d.index)+wo,d.seat.y*g],floorIndex:i[d.index]})}let b=new Map;for(let p=0;p<r.length;p++){let d=r[p],y=d.label?d.label.lastIndexOf("-"):-1,x=b.get(d.rowId);x||(x={n:0,x:0,y:0,z:0,minX:1/0,maxX:-1/0,minZ:1/0,maxZ:-1/0,label:y>0?d.label.slice(0,y):d.rowId,sectionId:d.sectionId},b.set(d.rowId,x));let w=p*3,A=a.iPosition[w],E=a.iPosition[w+1],M=a.iPosition[w+2];x.n++,x.x+=A,x.y+=E,x.z+=M,x.minX=Math.min(x.minX,A),x.maxX=Math.max(x.maxX,A),x.minZ=Math.min(x.minZ,M),x.maxZ=Math.max(x.maxZ,M)}for(let[p,d]of b)m.push({id:p,label:d.label,sectionId:d.sectionId,seatCount:d.n,center:[d.x/d.n,d.y/d.n,d.z/d.n],radius:Math.max(.8,Math.hypot(d.maxX-d.minX,d.maxZ-d.minZ)*.5)});if(r.length<=To)for(let p=0;p<r.length;p++){let d=r[p],y=Bo(d.displayLabel||d.label);y&&c.push({id:`seat:${d.id}`,kind:"seat",text:y,anchor:[d.x*g,o.seatDeckY(p)+_o,d.y*g],floorIndex:i[p]})}}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?At(b):null;if(!p||!h.label)continue;c.push({id:`architecture:${h.id}`,kind:"annotation",text:h.label,anchor:[p.x*g,u.baseHeightM+Et(h).heightM+ie,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+ie,h.position.y*g],color:h.color,rotation:h.rotation,floorIndex:u.index})}else if(h.type==="booth"){let b=Ft(h);if(!b)continue;let p=At(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+an+Po,p.y*g],floorIndex:u.index})}return{labels:c,sections:f,rows:m}}function ce(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 Bo(t){let n=t.lastIndexOf("-");return n>=0&&n<t.length-1?t.slice(n+1):t}function Eo(t,n,e){let r=t?t.lastIndexOf("-"):-1,o=r>0?t.slice(0,r):n;return o&&gn(o,e)}var Co=.15,Fo=.9,vo=1.76;function ko(){return{background:{top:[...nn.top],bottom:[...nn.bottom]},structure:tn,seatStates:{...Bn},seatScale:1,materials:{seat:null,shell:null,roughness:.78}}}function ue(t){let n=ko();if(!t)return n;let e=H(t.background);if(e){n.background={top:et(e,Fo),bottom:et(e,vo)};let i={};for(let[s,l]of Object.entries(tn))i[s]=nt(l,e,Co);n.structure=i}let r=H(t.selectionColor)??H(t.accent);r&&(n.seatStates={...n.seatStates,selected:r});let o=t.seatScale;typeof o=="number"&&Number.isFinite(o)&&(n.seatScale=An(o));let a=t.venue3d;if(a){let i=H(a.deck),s=H(a.fascia);i&&(n.structure={...n.structure,tierTop:i,gaTop:i}),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 le(t,n){let e=[];for(let r of n)e.push(...t.seatStates[r]);return e}var Oo=.05,me=.05,Lo=.15,ln=25;function fe(t,n,e){let r=new Map,o=new Array(n.length).fill(null),a=new Float64Array(n.length),i=new Array(n.length).fill(void 0),s=new Array(n.length).fill(void 0),l=new Map,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(y=>y.id===h.sectionId)??b.find(y=>y.section.logicalSectionId===h.sectionId&&qt({x:h.x,y:h.y},y.outline,y.section.holes)):void 0,d=p?[p]:b;for(let y of d){if(e&&y.floorIndex!==e[u]||!p&&(h.x<y.box.minX||h.x>y.box.maxX||h.y<y.box.minY||h.y>y.box.maxY||!qt({x:h.x,y:h.y},y.outline,y.section.holes)))continue;o[u]=y.id;let x=l.get(y.id);x.hasSeats=!0;let w=h.focalPoint??y.unit.focal,A=Math.hypot(h.x-w.x,h.y-w.y);A<x.frontU&&(x.frontU=A),x.seatIndices.push(u);let E=h.rowId||`__seat-${u}`,M=x.rows.get(E);M?M.push({x:h.x,y:h.y}):x.rows.set(E,[{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,d=b.rake>0?Math.tan(b.rake*Math.PI/180):0,y=b.rake<=.01&&b.height<=p+.001,x=h.section.surfaceKind,w=x==="flat"?!0:x==="rakedRows"&&b.rake>.01?!1:y,A=h.hasSeats?yn(u,n,h.seatIndices,h.unit.focal):{sectionId:u,rows:[],blockCount:0},M=A.rows.length<2?Pn([...h.rows.values()].map(R=>({points:R})),h.unit.focal):null,I=1/0;if(M){if(h.hasSeats)for(let R of h.rows.values())for(let T of R){let C=M.depthAt(T.x,T.y);C<I&&(I=C)}if(!h.hasSeats||!Number.isFinite(I)){I=1/0;for(let R of h.section.outline){let T=M.depthAt(R.x,R.y);T<I&&(I=T)}}}let B=p+Oo,k=Math.max(B,b.height),D=R=>{let T=Math.max(0,R-I)*ut,C=Math.min(T*d,ln);return Math.max(B,b.height+C)},U=R=>{let T=Math.max(0,R)*ut,C=Math.min(T*d,ln);return Math.max(B,b.height+C)},S=w?[]:A.rows.map(R=>({pts:R.pts,y:U(R.blockDepth),depth:R.blockDepth,blockId:R.blockId,...f.has(R.id)?{patch:Nn(R.pts,ot)}:{}})),_=S.length?S[0].y:k,N=S.map(R=>{let T=R.patch&&R.patch.length>=3?R.patch:R.pts,C=0,v=0;for(let L of T)C+=L.x,v+=L.y;let G=T.length||1;C/=G,v/=G;let X=0;for(let L of T){let Y=Math.hypot(L.x-C,L.y-v);Y>X&&(X=Y)}return{cx:C,cy:v,rad:X}}),O=w?()=>k:S.length>=2?(R,T)=>{let C=1/0,v=_;for(let G=0;G<S.length;G++){let X=N[G];if(Math.hypot(R-X.cx,T-X.cy)-X.rad>=C)continue;let L=S[G].patch,Y=L&&L.length>=3?It(L,R,T)?0:Dt(L,R,T):Dt(S[G].pts,R,T);Y<C&&(C=Y,v=S[G].y)}return v}:(R,T)=>M?D(M.depthAt(R,T)):k,P=[0,1,0],F=S.length>=2||w?()=>P:(R,T)=>{if(!M)return P;let C=M.depthAt(R,T);if(C<=I)return P;let v=(C-I)*ut;if(v*d>=ln||b.height+v*d<=B)return P;let[G,X]=M.gradientAt(R,T);if(G===0&&X===0)return P;let L=1/Math.hypot(d,1);return[-G*d*L,L,-X*d*L]};if(!w)for(let R of A.rows){let T=U(R.blockDepth);for(let C of R.seatIndices)i[C]=T}for(let R of A.rows){let T=[];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&&T.push(Y)}T.sort((L,Y)=>L-Y);let C=T.length?T[Math.floor(T.length/2)]:1/0,v=1/0,G=R.pts[Math.floor(R.pts.length/2)];if(G)for(let L of A.rows){if(L===R||L.blockId!==R.blockId)continue;let Y=Dt(L.pts,G.x,G.y);Y>1e-6&&Y<v&&(v=Y)}let X=Math.min(C,Math.max(v,C*.5));if(Number.isFinite(X)&&X>0)for(let L of R.seatIndices)s[L]=X}r.set(u,{sectionId:u,deckAt:O,normalAt:F,flat:w,bottomY:p,rowLevels:S,landingY:_})}for(let u=0;u<n.length;u++){let h=o[u],b=n[u];if(h){let d=i[u];a[u]=(d??r.get(h).deckAt(b.x,b.y))+Lo;continue}let p=b.eyeHeightM;a[u]=Number.isFinite(p)?Math.max(0,p-Gt):0}return{bySection:r,seatOwner:o,seatDeckY:u=>a[u],seatPitchU:u=>s[u]}}var Go=.25,Do=1.2,No=.6,Xo=.45,Uo=2.3,Yo=Math.PI/180;function pt(t,n,e){let r=e*Yo;return{x:t.x+n*Math.sin(r),y:t.y+n*Math.cos(r)}}function jo(t,n){let e=n.rings[n.rings.length-1];if(!e)return!1;let r=e.outerRMedian*.85;for(let o of t){if(o.role!=="wall")continue;let a=o.points&&o.points.length>=2?o.points:o.x!==void 0&&o.y!==void 0&&o.width!==void 0&&o.height!==void 0?[{x:o.x,y:o.y},{x:o.x+o.width,y:o.y},{x:o.x+o.width,y:o.y+o.height},{x:o.x,y:o.y+o.height}]:[];if(a.length<2)continue;let i=0;for(let s of a)Math.hypot(s.x-n.centre.x,s.y-n.centre.y)>=r&&i++;if(i>=a.length/2)return!0}return!1}var Ho=24;function Vo(t,n,e,r,o,a,i,s){let l=e.binCount,c=Ho,f=ut,m=a+.02,u=[];for(let S=0;S<l;S++){let _=(e.startBin+S+.5)*n.binStepDeg,N=new Float64Array(c+1);for(let O=0;O<=c;O++){let P=r[S]+(o[S]-r[S])*O/c;N[O]=Math.max(m,wn(n,e,_,P)-Go)}u.push(N)}let h=[i.bandTop[0]*s.top,i.bandTop[1]*s.top,i.bandTop[2]*s.top],b=[i.bandTop[0]*s.bottomCap,i.bandTop[1]*s.bottomCap,i.bandTop[2]*s.bottomCap],p=[i.bandWall[0]*s.top,i.bandWall[1]*s.top,i.bandWall[2]*s.top],d=[i.bandWall[0]*s.wallBottom,i.bandWall[1]*s.wallBottom,i.bandWall[2]*s.wallBottom],y=(S,_)=>{let N=(e.startBin+S+.5)*n.binStepDeg,O=r[S]+(o[S]-r[S])*_/c,P=pt(n.centre,O,N);return[P.x*f,u[S][_],P.y*f]};{let S=Math.tan(12*Math.PI/180);for(let _=0;_<6;_++){let N=!1;for(let P=0;P<l;P++)for(let F=c-1;F>=0;F--)u[P][F]>u[P][F+1]&&(u[P][F]=u[P][F+1],N=!0);let O=e.closed?l:l-1;for(let P=0;P<O;P++){let F=(P+1)%l;for(let R=0;R<=c;R++){let T=u[F][R]-u[P][R];if(Math.abs(T)>1)continue;let C=r[P]+(o[P]-r[P])*R/c,v=r[F]+(o[F]-r[F])*R/c,G=pt(n.centre,C,(e.startBin+P+.5)*n.binStepDeg),X=pt(n.centre,v,(e.startBin+F+.5)*n.binStepDeg),L=S*Math.hypot(X.x-G.x,X.y-G.y)*f;T>L?(u[F][R]=u[P][R]+L,N=!0):-T>L&&(u[P][R]=u[F][R]+L,N=!0)}}if(!N)break}}let x=1,w=(S,_)=>{for(let N=0;N<=c;N+=4)if(Math.abs(u[S][N]-u[_][N])>x)return!0;return Math.abs(u[S][c]-u[_][c])>x},A=Math.tan(38*Math.PI/180),E=S=>(o[S]-r[S])/c*f,M=(S,_)=>u[S][_+1]-u[S][_]>A*Math.max(1e-6,E(S)),I=(S,_)=>{let N=e.closed?(S-1+l)%l:Math.max(0,S-1),O=e.closed?(S+1)%l:Math.min(l-1,S+1);Math.abs(u[N][_]-u[S][_])>x&&(N=S),Math.abs(u[O][_]-u[S][_])>x&&(O=S);let P=Math.max(0,_-1),F=Math.min(c,_+1);P<_&&M(S,P)&&(P=_),F>_&&M(S,_)&&(F=_);let R=y(N,_),T=y(O,_),C=y(S,P),v=y(S,F),G=T[0]-R[0],X=T[1]-R[1],L=T[2]-R[2],Y=v[0]-C[0],j=v[1]-C[1],$=v[2]-C[2],z=X*$-L*j,q=L*Y-G*$,tt=G*j-X*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]},B=(S,_)=>{let N=[S[0],a,S[2]],O=[_[0],a,_[2]],P=_[0]-S[0],F=_[2]-S[2],R=Math.hypot(P,F);if(!(R>1e-12))return;let T=[F/R,0,-P/R];t.tri(S,_,O,T,p,p,d),t.tri(S,O,N,T,p,d,d)},k=.05*lt,D=S=>o[S]-r[S]<k,U=e.closed?l:l-1;for(let S=0;S<U;S++){let _=(S+1)%l;if(D(S)||D(_))continue;if(w(S,_)){let T=(e.startBin+S+1)*n.binStepDeg,C=(j,$)=>{let z=(r[S]+r[_])/2,q=(o[S]+o[_])/2,tt=z+(q-z)*$/c,Z=pt(n.centre,tt,T);return[Z.x*f,u[j][$],Z.y*f]};for(let j=0;j<c;j++){let $=y(S,j),z=y(S,j+1),q=C(S,j),tt=C(S,j+1),Z=I(S,j),it=I(S,j+1);t.triN($,q,tt,Z,Z,it,h),t.triN($,tt,z,Z,it,it,h);let vt=y(_,j),kt=y(_,j+1),dt=C(_,j),St=C(_,j+1),yt=I(_,j),xt=I(_,j+1);t.triN(dt,vt,kt,yt,yt,xt,h),t.triN(dt,kt,St,yt,xt,xt,h);let ct=C(S,j),rt=C(S,j+1),Ot=C(_,j+1),Kt=C(_,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 v=y(S,0),G=y(_,0),X=y(_,c),L=y(S,c),Y=j=>[j[0],a,j[2]];t.tri(Y(v),Y(X),Y(G),[0,-1,0],b),t.tri(Y(v),Y(L),Y(X),[0,-1,0],b),B(v,G),B(L,X);continue}for(let T=0;T<c;T++){let C=I(S,T),v=I(_,T),G=I(_,T+1),X=I(S,T+1);if(M(S,T)||M(_,T)){let z=(rt,Ot)=>{let Kt=(e.startBin+rt+.5)*n.binStepDeg,Lt=r[rt]+(o[rt]-r[rt])*(T+.5)/c,Rt=pt(n.centre,Lt,Kt);return[Rt.x*f,Ot,Rt.y*f]},q=y(S,T),tt=y(_,T),Z=z(S,u[S][T]),it=z(_,u[_][T]);t.triN(q,tt,it,C,v,v,h),t.triN(q,it,Z,C,v,C,h);let vt=y(_,T+1),kt=y(S,T+1),dt=z(S,u[S][T+1]),St=z(_,u[_][T+1]);t.triN(dt,St,vt,X,G,G,h),t.triN(dt,vt,kt,X,G,X,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=y(S,T),Y=y(_,T),j=y(_,T+1),$=y(S,T+1);t.triN(L,Y,j,C,v,G,h),t.triN(L,j,$,C,G,X,h)}let N=y(S,0),O=y(_,0),P=y(_,c),F=y(S,c),R=T=>[T[0],a,T[2]];t.tri(R(N),R(P),R(O),[0,-1,0],b),t.tri(R(N),R(F),R(P),[0,-1,0],b),B(N,O),B(F,P)}if(!e.closed)for(let S of[0,l-1])for(let _=0;_<c;_++)B(y(S,_),y(S,_+1))}function he(t,n,e){let{bottomY:r,colors:o,ao:a}=e,i=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 d=(m.startBin+p)%n.binCount,y=Math.max(0,m.innerR[p]-ot);u[p]=Math.max(y,i[d]+.001),h[p]=Math.max(u[p]+.001,m.outerR[p]+ot)}let b=0;for(let p=0;p<m.binCount;p++){let d=m.topLevelM[p]-r;d>b&&(b=d)}b>=Do&&Vo(t,n,m,u,h,r,o,a);for(let p=0;p<m.binCount;p++){let d=(m.startBin+p)%n.binCount;h[p]>i[d]&&(i[d]=h[p])}}if(e.deriveShell===!1||jo(e.shapes,n))return;let s=n.rings[n.rings.length-1],l=No*lt,c=Xo*lt;for(let f of s.arcs){let m=[],u=[];for(let p=0;p<f.binCount;p++){let d=(f.startBin+p+.5)*n.binStepDeg,y=f.outerR[p]+ot+l;m.push(pt(n.centre,y,d)),u.push(pt(n.centre,y+c,d))}let h=-1/0;for(let p=0;p<f.binCount;p++)f.topLevelM[p]>h&&(h=f.topLevelM[p]);let b=()=>h+Uo;f.closed?K(t,u,[m.slice().reverse()],b,r,o.shellTop,o.shellWall,a):K(t,[...u,...m.slice().reverse()],void 0,b,r,o.shellTop,o.shellWall,a)}}function be(t,n,e,r,o,a,i,s){if(!n.outline||n.outline.length<3)return;let l=e.baseHeightM,c=st(r,s.tierTop);if(!o)return;let f=d=>o.deckAt(d.x,d.y),m=Kn(n,i),u=m[0]??n.outline;if(o.rowLevels.length>=2){let d=Wt(o.rowLevels),y=$n(jn(o.rowLevels,e.focal,d),m),x=()=>[0,1,0];for(let A of y){let E=Math.max(l,A.topY-.02);for(let M of a.subtract(A.outline,E))K(t,M,A.holes,()=>E,l,c,s.tierWall,W,void 0,x)}y.length||K(t,u,n.holes,()=>o.landingY,l,c,s.tierWall,W);let w={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 A of m.length?m:[u])Vn(t,o.rowLevels,e.focal,o.landingY,w,A,d);return}let h=o.flat?1/0:me,b=d=>o.normalAt(d.x,d.y),p=o.flat?o.landingY:void 0;for(let d of a.subtract(u,p))K(t,d,n.holes,f,l,c,s.tierWall,W,h,b)}function Wo(t,n,e){let r=new Set;for(let i of t.objects)i.type==="section"&&r.add(i.id);let o=new Map;for(let i=0;i<n.length;i++){let s=e.seatOwner[i];if(!s||!r.has(s))continue;let l=e.bySection.get(s);if(l&&l.rowLevels.length>=2)continue;let c=n[i],f=o.get(s);f||(f=new Map,o.set(s,f));let m=c.rowId||`__seat-${i}`,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(i),u.n++}let a=[];for(let i of t.objects){if(i.type!=="section")continue;let s=e.bySection.get(i.id);if(s&&s.rowLevels.length>=2){let c=s.rowLevels.filter(f=>!f.patch).map(f=>({pts:f.pts,levelM:f.y}));c.length>=2&&a.push({sectionId:i.id,rows:c});continue}let l=o.get(i.id);l&&a.push({sectionId:i.id,rows:[...l.values()].map(c=>({pts:c.pts,levelM:c.levelM/c.n}))})}return a}function pe(t,n,e,r,o,a,i=!0){let s=Wo(n,e,r);if(!s.length)return;let l=In(s,n.focal);l&&(t.setMaterial(0),he(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:i}))}function de(t){let{doc:n,units:e,seats:r,surfaces:o,solids:a,hintedSeatFloor:i,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<r.length;u++){let h=o.seatOwner[u],b=(h!==null?f.get(h):void 0)??i[u];if(b===void 0)continue;let p=m[b],d=r[u];p.n++,d.x<p.minX&&(p.minX=d.x),d.y<p.minY&&(p.minY=d.y),d.x>p.maxX&&(p.maxX=d.x),d.y>p.maxY&&(p.maxY=d.y);let y=o.seatDeckY(u);p.sumX+=d.x*g,p.sumDeck+=y,p.sumZ+=d.y*g,p.minDeck=Math.min(p.minDeck,y),p.maxDeck=Math.max(p.maxDeck,y+1.6),s[u]=b}for(let u=0;u<e.length;u++){let h=m[u],b=n.floors?.[u],p=c[u],d=Math.min(h.n?h.minX*g:e[u].focal.x*g-1,Number.isFinite(p.minX)?p.minX:1/0),y=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),w=Math.max(h.n?h.maxY*g:e[u].focal.y*g+1,Number.isFinite(p.maxZ)?p.maxZ:-1/0),A=Math.min(h.n?Math.min(e[u].baseHeightM,h.minDeck):e[u].baseHeightM,Number.isFinite(p.minY)?p.minY:1/0),E=Math.max(h.n?Math.max(h.maxDeck,A+.5):A+.5,Number.isFinite(p.maxY)?p.maxY:-1/0),M=[h.n?h.sumX/h.n:(d+y)/2,h.n?h.sumDeck/h.n:(A+E)/2,h.n?h.sumZ/h.n:(x+w)/2],I=Math.max(1,.5*Math.hypot(y-d,E-A,w-x));l.push({index:u,id:b?.id??`floor-${u}`,label:b?.name??(e.length>1?`Floor ${u+1}`:"Venue"),seatCount:h.n,center:M,radius:I,box:{min:[d,A,x],max:[y,E,w]},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,r=1/0,o=-1/0,a=-1/0,i=(s,l)=>{s<e&&(e=s),l<r&&(r=l),s>o&&(o=s),l>a&&(a=l)};for(let s of n)i(s.x,s.y);for(let s of t)for(let l of s.objects)if(l.type==="section")for(let c of l.outline)i(c.x,c.y);else if(l.type==="shape"&&l.points)for(let c of l.points)i(c.x,c.y);else if(l.type==="gaArea")for(let c of l.points)i(c.x,c.y);else if(l.type==="booth"){let c=Ft(l);if(c)for(let f of c)i(f.x,f.y)}else if(l.type==="table"){let c=cn(l);if(c)for(let f of c)i(f.x,f.y)}else if(l.type==="decorImage"){let c=un(l);if(c)for(let f of c)i(f.x,f.y)}return Number.isFinite(e)||(e=-100,r=-100,o=100,a=100),{minX:e,minY:r,maxX:o,maxY:a}}function ye(t,n,e,r,o,a){if(n.length===1){let i=Math.max(60,(o.maxX-o.minX+o.maxY-o.minY)*.06),s=Tt(o.minX-i,o.minY-i,o.maxX-o.minX+i*2,o.maxY-o.minY+i*2);K(t,s,void 0,()=>0,-.4,a.ground,a.ground,W)}else{let i=n.reduce((h,b)=>b.baseHeightM<h.baseHeightM?b:h);t.setFloor(i.index);let s=e.filter((h,b)=>r[b]===i.index),l=mn([i],s),c=Math.hypot(l.maxX-l.minX,l.maxY-l.minY),f=Math.max(28,Math.min(80,c*.04)),m=Tt(l.minX-f,l.minY-f,l.maxX-l.minX+f*2,l.maxY-l.minY+f*2),u=i.baseHeightM-.03;K(t,m,void 0,()=>u,u-.22,a.ground,a.ground,W)}}function xe(t,n,e){let{cx:r,cz:o,radius:a}=e,i=1/0,s=1/0,l=1/0,c=-1/0,f=-1/0,m=-1/0,u=(p,d,y)=>{i=Math.min(i,p),c=Math.max(c,p),s=Math.min(s,d),f=Math.max(f,d),l=Math.min(l,y),m=Math.max(m,y)};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 d=p*3,y=n.iPosition[d],x=n.iPosition[d+1],w=n.iPosition[d+2],A=Math.max(.35,n.iMaxRadius[p]??.35);u(y-A,x,w-A),u(y+A,x+1.6,w+A)}Number.isFinite(i)||(i=r-a,c=r+a,s=0,f=a*.16,l=o-a,m=o+a);let h=[(i+c)/2,(s+f)/2,(l+m)/2],b=Math.max(1,.5*Math.hypot(c-i,f-s,m-l));return{center:h,radius:b,minY:s,maxY:f}}function ge(t,n,e,r,o,a){let i=1/0,s=1/0,l=-1/0,c=-1/0;for(let A=0;A<t.count;A++){let E=A*3,M=t.iPosition[E],I=t.iPosition[E+2];M<i&&(i=M),M>l&&(l=M),I<s&&(s=I),I>c&&(c=I)}for(let A of n)i=Math.min(i,A.cx-A.halfX),l=Math.max(l,A.cx+A.halfX),s=Math.min(s,A.cz-A.halfZ),c=Math.max(c,A.cz+A.halfZ);let f=e.minX*g,m=e.maxX*g,u=e.minY*g,h=e.maxY*g,b=f,p=m,d=u,y=h;if(Number.isFinite(i)){let A=Math.max(2,.06*Math.hypot(l-i,c-s));b=Math.max(f,i-A),p=Math.min(m,l+A),d=Math.max(u,s-A),y=Math.min(h,c+A)}let x=Math.min(0,r),w=Math.max(o,a*.05);return{min:[b,x,d],max:[p,w,y]}}function Me(t,n,e){let r=()=>({byObjectId:new Map,elements:[]});if(!n||!t)return r();let o=bn(n);if(!o.ok||o.value.id!==t)return r();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 i=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||i.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 r();i.add(m.id),s.add(m.objectId);let p=h.map(B=>B.x*g),d=h.map(B=>B.y*g),y=u.unit.baseHeightM+b,x=Math.min(...p),w=Math.max(...p),A=Math.min(...d),E=Math.max(...d),M,I=l.get(m.id)??m.contentImageUrl;if(m.kind==="screen"&&I)if(w-x>=E-A){let B=Math.abs(A-u.unit.focal.y*g)<=Math.abs(E-u.unit.focal.y*g)?A-.006:E+.006;M=[[x,y,B],[w,y,B],[x,y+m.heightM,B],[w,y+m.heightM,B]]}else{let B=Math.abs(x-u.unit.focal.x*g)<=Math.abs(w-u.unit.focal.x*g)?x-.006:w+.006;M=[[B,y,A],[B,y,E],[B,y+m.heightM,A],[B,y+m.heightM,E]]}c.push({id:m.id,objectId:m.objectId,kind:m.kind,floorIndex:u.unit.index,baseY:y,topY:y+m.heightM,bounds:{min:[x,y,A],max:[w,y+m.heightM,E]},occlusion:m.occlusion,...I?{contentImageUrl:I}:{},...M?{contentPlane:M}:{}})}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 zo(t){let n=[t];for(;n.length;){let e=n.pop();if(Array.isArray(e)){n.push(...e);continue}if(!Q(e))continue;let r=Q(e.extensions)?e.extensions:null;if(r&&Object.prototype.hasOwnProperty.call(r,"KHR_draco_mesh_compression"))return!0;n.push(...Object.values(e))}return!1}function Zt(t,n){return!Array.isArray(t)||t.length!==n||!t.every(e=>typeof e=="number"&&Number.isFinite(e))?null:t}function Zo(){return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}function Ko(t,n){let e=new Array(16).fill(0);for(let r=0;r<4;r++)for(let o=0;o<4;o++)for(let a=0;a<4;a++)e[r*4+o]+=t[a*4+o]*n[r*4+a];return e}function $o(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),r=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||!r||!o)return null;let[a,i,s,l]=r,c=Math.hypot(a,i,s,l);if(!(c>1e-8))return null;let f=a/c,m=i/c,u=s/c,h=l/c,b=f+f,p=m+m,d=u+u,y=f*b,x=f*p,w=f*d,A=m*p,E=m*d,M=u*d,I=h*b,B=h*p,k=h*d;return[(1-(A+M))*o[0],(x+k)*o[0],(w-B)*o[0],0,(x-k)*o[1],(1-(y+M))*o[1],(E+I)*o[1],0,(w+B)*o[2],(E-I)*o[2],(1-(y+A))*o[2],0,e[0],e[1],e[2],1]}function qo(t,n,e,r){return[t[0]*n+t[4]*e+t[8]*r+t[12],t[1]*n+t[5]*e+t[9]*r+t[13],t[2]*n+t[6]*e+t[10]*r+t[14]]}function Jo(t){let n=t[0],e=t[4],r=t[8],o=t[1],a=t[5],i=t[9],s=t[2],l=t[6],c=t[10],f=a*c-i*l,m=i*s-o*c,u=o*l-a*s,h=n*f+e*m+r*u;if(Math.abs(h)<1e-12)return null;let b=1/h;return[f*b,m*b,u*b,(r*l-e*c)*b,(n*c-r*s)*b,(e*s-n*l)*b,(e*i-r*a)*b,(r*o-n*i)*b,(n*a-e*o)*b]}function Se(t,n,e,r){let o=t[0]*n+t[1]*e+t[2]*r,a=t[3]*n+t[4]*e+t[5]*r,i=t[6]*n+t[7]*e+t[8]*r,s=Math.hypot(o,a,i)||1;return o/=s,a/=s,i/=s,[o,a,i]}function Qo(t){if(t.byteLength<20||t.byteLength>8388608)return null;let n=new DataView(t.buffer,t.byteOffset,t.byteLength);if(n.getUint32(0,!0)!==1179937895||n.getUint32(4,!0)!==2||n.getUint32(8,!0)!==t.byteLength)return null;let e=12,r=null,o=null;for(;e+8<=t.byteLength;){let a=n.getUint32(e,!0),i=n.getUint32(e+4,!0);if(e+=8,a%4!==0||e+a>t.byteLength)return null;let s=t.subarray(e,e+a);if(i===1313821514&&!r)try{let l=JSON.parse(new TextDecoder().decode(s).replace(/[\u0000 ]+$/g,""));if(!Q(l))return null;r=l}catch{return null}else if(i===5130562&&!o)o=s;else return null;e+=a}return e===t.byteLength&&r&&o?{json:r,bin:o}:null}function tr(t){return t===5120||t===5121?1:t===5122||t===5123?2:t===5125||t===5126?4:0}function nr(t){return t==="SCALAR"?1:t==="VEC2"?2:t==="VEC3"?3:t==="VEC4"?4:0}function er(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 or(t){let n=t instanceof Uint8Array?t:new Uint8Array(t),e=Qo(n);if(!e)return{ok:!1,issue:"invalid_glb"};let{json:r,bin:o}=e;if(!Q(r.asset)||r.asset.version!=="2.0")return{ok:!1,issue:"unsupported_glb"};let a=J(r.extensionsUsed).filter(A=>typeof A=="string");if(a.includes("KHR_draco_mesh_compression")||zo(r))return{ok:!1,issue:"draco_not_allowed"};if(a.length||J(r.extensionsRequired).length)return{ok:!1,issue:"unsupported_glb"};if(J(r.images).length||J(r.textures).length)return{ok:!1,issue:"external_resource"};let i=J(r.buffers);if(i.length!==1||!Q(i[0])||i[0].uri!==void 0||typeof i[0].byteLength!="number"||!Number.isInteger(i[0].byteLength)||i[0].byteLength<0||i[0].byteLength>o.byteLength)return{ok:!1,issue:"external_resource"};let s=J(r.accessors),l=J(r.bufferViews),c=J(r.meshes),f=J(r.nodes),m=J(r.scenes),u=typeof r.scene=="number"?r.scene:0;if(!Q(m[u]))return{ok:!1,issue:"unsupported_glb"};let h=new DataView(o.buffer,o.byteOffset,o.byteLength),b=(A,E,M)=>{if(typeof A!="number"||!Number.isInteger(A)||!Q(s[A]))return null;let I=s[A];if(I.type!==E||I.sparse!==void 0||I.normalized===!0||typeof I.count!="number"||!Number.isInteger(I.count)||I.count<1||typeof I.componentType!="number"||!M.includes(I.componentType)||typeof I.bufferView!="number")return null;let B=l[I.bufferView];if(!Q(B)||B.buffer!==0||typeof B.byteLength!="number"||!Number.isInteger(B.byteLength)||B.byteLength<0)return null;let k=nr(I.type),D=tr(I.componentType),U=typeof B.byteStride=="number"?B.byteStride:k*D,S=typeof B.byteOffset=="number"?B.byteOffset:0,_=typeof I.byteOffset=="number"?I.byteOffset:0,N=S+_,O=_+(I.count-1)*U+k*D;if(!Number.isInteger(U)||!Number.isInteger(S)||!Number.isInteger(_)||U<k*D||S<0||_<0||S+B.byteLength>o.byteLength||O>B.byteLength)return null;let P=[];for(let F=0;F<I.count;F++){let R=[];for(let T=0;T<k;T++){let C=er(h,N+F*U+T*D,I.componentType);if(!Number.isFinite(C))return null;R.push(C)}P.push(R)}return P},p=[],d=[],y=0,x=new Set,w=(A,E)=>{if(typeof A!="number"||!Number.isInteger(A)||!Q(f[A])||x.has(A))return!1;x.add(A);let M=f[A],I=$o(M);if(!I)return!1;let B=Ko(E,I),k=Jo(B);if(!k)return!1;if(M.mesh!==void 0){if(typeof M.mesh!="number")return!1;let D=c[M.mesh];if(!Q(D))return!1;for(let U of J(D.primitives)){if(!Q(U)||U.mode!==void 0&&U.mode!==4||!Q(U.attributes))return!1;let S=b(U.attributes.POSITION,"VEC3",[5126]),_=U.attributes.NORMAL===void 0?null:b(U.attributes.NORMAL,"VEC3",[5126]);if(!S||U.attributes.NORMAL!==void 0&&!_)return!1;let N=S.length;if(U.indices!==void 0){let P=typeof U.indices=="number"?s[U.indices]:null;N=Q(P)?P.count:void 0}if(typeof N!="number"||!Number.isInteger(N)||N%3!==0||(y+=N/3,y>1e5))return!1;let O=U.indices===void 0?S.map((P,F)=>[F]):b(U.indices,"SCALAR",[5121,5123,5125]);if(!O||O.length%3!==0||O.length!==N)return!1;for(let P=0;P<O.length;P+=3){let F=[O[P][0],O[P+1][0],O[P+2][0]];if(F.some(C=>!Number.isInteger(C)||C<0||C>=S.length))return!1;let R=F.map(C=>qo(B,...S[C])),T=null;if(!_){let C=R[1][0]-R[0][0],v=R[1][1]-R[0][1],G=R[1][2]-R[0][2],X=R[2][0]-R[0][0],L=R[2][1]-R[0][1],Y=R[2][2]-R[0][2];T=Se([1,0,0,0,1,0,0,0,1],v*Y-G*L,G*X-C*Y,C*L-v*X)}for(let C=0;C<3;C++)p.push(...R[C]),d.push(..._?Se(k,..._[F[C]]):T)}}}for(let D of J(M.children))if(!w(D,B))return!1;return x.delete(A),!0};for(let A of J(m[u].nodes))if(!w(A,Zo()))return{ok:!1,issue:y>1e5?"triangle_limit":"unsupported_glb"};return!y||p.length!==y*9||d.length!==p.length?{ok:!1,issue:"unsupported_glb"}:{ok:!0,triangleCount:y,position:new Float32Array(p),normal:new Float32Array(d)}}function Re(t){try{return or(t)}catch{return{ok:!1,issue:"invalid_glb"}}}function As(t){let{doc:n}=t,e=ue(n.theme),r=e.structure,o=Zn(n,t.eventConfigurationId??n.eventConfigurationId),a=Me(t.eventConfigurationId,t.eventConfiguration,o),i=t.seats,s=new Yt,l=null;if(t.registeredShellGlb){let P=Re(t.registeredShellGlb);if(P.ok){let F=P.position.length/3,R=new Float32Array(P.position.length),T=e.materials.shell??r.tierWall;for(let C=0;C<F;C++){let v=P.normal[C*3+1],G=v<-.25?.4:.62+.38*Math.max(0,v);R[C*3]=T[0]*G,R[C*3+1]=T[1]*G,R[C*3+2]=T[2]*G}l={position:P.position,normal:P.normal,color:R,floor:new Float32Array(F).fill(-2),material:new Float32Array(F),count:F}}}let c=new Map;for(let P of o)for(let F of P.objects)c.set(F.id,P.index),F.type==="section"&&c.set(F.logicalSectionId??F.id,P.index);let f=i.map(P=>c.get(P.sectionId??"")??c.get(P.rowId??"")??0),m=mn(o,i);ye(s,o,i,f,m,r);let u=vn(n,i),h=new Map,b=new Map;for(let P of n.categories??[])h.set(P.key,P.color),P.seatGlyph&&b.set(P.key,P.seatGlyph);let p=[],d=fe(o,i,f),y=new Float32Array(i.length),x=[];for(let P=0;P<o.length;P++){let F=o[P];s.setFloor(P);let R=new zt,T=[],C=F.objects.filter(v=>v.type==="section"&&!!v.outline&&v.outline.length>=3);for(let v of F.objects)if(v.type==="section"){let G=s.vertexCount;be(s,v,F,kn(v,u),d.bySection.get(v.id),R,C,r);let X=s.vertexCount-G;X>0&&x.push({sectionId:v.id,start:G,count:X})}else if(v.type==="shape"){let G=a.byObjectId.get(v.id);s.setMaterial((G?.kind??v.role)==="screen"?1:0),ee(s,v,F.baseHeightM,qn(v,T),r,F.focal,p,G),s.setMaterial(0)}else v.type==="gaArea"?re(s,v,F.baseHeightM,H(h.get(v.categoryKey)),r):v.type==="booth"?te(s,v,F.baseHeightM,H(h.get(v.categoryKey)),r):v.type==="table"?ne(s,v,F.baseHeightM,H(v.fill??n.theme?.decorFill??"#232c40"),r):v.type==="decorImage"&&oe(s,v,F.baseHeightM,r);pe(s,F,i,d,r,e.materials.shell,!l)}let w=o.length>1?{x:o.reduce((P,F)=>P+F.focal.x,0)/o.length,y:o.reduce((P,F)=>P+F.focal.y,0)/o.length}:n.focalPoint??{x:(m.minX+m.maxX)/2,y:(m.minY+m.maxY)/2},A=Tn(l?[s.build(),l]:[s.build()]),E=Fn(i,t.initialState,d,y,h,b),M=se({doc:n,units:o,seats:i,surfaces:d,focal:w}),{labels:I,sections:B,rows:k}=ae({doc:n,units:o,seats:i,surfaces:d,seatData:E,hintedSeatFloor:f,zones:M,focal:w}),D=de({doc:n,units:o,seats:i,surfaces:d,solids:A,hintedSeatFloor:f,seatFloor:y});ce(I,D),E.iYaw=Cn(E.iPosition,i.length,P=>i[P].rowId,P=>{let F=o[y[P]]?.focal??w;return[F.x*g,F.y*g]});let U=(m.minX+m.maxX)/2*g,S=(m.minY+m.maxY)/2*g,_=.5*Math.hypot((m.maxX-m.minX)*g,(m.maxY-m.minY)*g)||10,N=xe(A,E,{cx:U,cz:S,radius:_}),O=ge(E,p,m,N.minY,N.maxY,_);return{solids:A,sectionSolidRanges:x,seats:E,bounds:{center:[(O.min[0]+O.max[0])/2,(O.min[1]+O.max[1])/2,(O.min[2]+O.max[2])/2],radius:_,groundY:0,box:O},renderBounds:{center:N.center,radius:N.radius},stateColorLUT:le(e,Bt),theme:e,seatCount:i.length,focalWorld:[w.x*g,1.5,w.y*g],zones:M,stages:p,productionElements:a.elements,sections:B,rows:k,labels:I,floors:D}}export{Bt as a,Qt as b,mr as c,nn as d,g as e,hr as f,Ge as g,Ne as h,br as i,Vt as j,Ar as k,Pr as l,_r as m,Tr as n,Br as o,Er as p,Cr as q,Fr as r,vr as s,kr as t,Or as u,Lr as v,Bo as w,As as x};
1
+ import{a as Pn,c as In,d as wn}from"./chunk-EH47GKSO.js";import{a as gn}from"./chunk-QJXSZT3H.js";import{a as Mn,c as Nt,d as ft,f as It,i as An}from"./chunk-77QFA3F4.js";import{f as hn}from"./chunk-4I2VWFJY.js";import{e as Sn,k as Rn}from"./chunk-UL5OIGIF.js";import{Ea as qt,Z as ut,_ as lt,f as bn,ha as Gt,ja as dn,ka as Dt,ma as yn,qa as xn,x as pn,y as At}from"./chunk-W4RS6OW7.js";import{A as Pt,d as H,y as nt}from"./chunk-JBOTRSMY.js";import Ae from"earcut";import Pe from"polygon-clipping";var g=ut,Ie=.002;function we(t,n,e){let r=Math.hypot(n[0]-t[0],n[1]-t[1],n[2]-t[2]),o=Math.hypot(e[0]-n[0],e[1]-n[1],e[2]-n[2]),a=Math.hypot(t[0]-e[0],t[1]-e[1],t[2]-e[2]),i=Math.max(r,o,a);if(i<1e-9)return!0;let s=(r+o+a)/2;return 2*Math.sqrt(Math.max(0,s*(s-r)*(s-o)*(s-a)))/i<Ie}var ht=class{constructor(n=16384){this.len=0;this.buf=new Float32Array(n)}push3(n,e,r){this.len+3>this.buf.length&&this.grow(this.len+3),this.buf[this.len++]=n,this.buf[this.len++]=e,this.buf[this.len++]=r}push1(n){this.len+1>this.buf.length&&this.grow(this.len+1),this.buf[this.len++]=n}grow(n){let e=this.buf.length*2;for(;e<n;)e*=2;let r=new Float32Array(e);r.set(this.buf.subarray(0,this.len)),this.buf=r}get length(){return this.len}toArray(){return this.buf.slice(0,this.len)}},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,r,o,a,i=a,s=a){we(n,e,r)||(this.pos.push3(n[0],n[1],n[2]),this.pos.push3(e[0],e[1],e[2]),this.pos.push3(r[0],r[1],r[2]),this.nor.push3(o[0],o[1],o[2]),this.nor.push3(o[0],o[1],o[2]),this.nor.push3(o[0],o[1],o[2]),this.col.push3(a[0],a[1],a[2]),this.col.push3(i[0],i[1],i[2]),this.col.push3(s[0],s[1],s[2]),this.flr.push1(this.currentFloor),this.flr.push1(this.currentFloor),this.flr.push1(this.currentFloor),this.mat.push1(this.currentMaterial),this.mat.push1(this.currentMaterial),this.mat.push1(this.currentMaterial))}triN(n,e,r,o,a,i,s,l=s,c=s){[...n,...e,...r].every(Number.isFinite)&&(this.pos.push3(n[0],n[1],n[2]),this.pos.push3(e[0],e[1],e[2]),this.pos.push3(r[0],r[1],r[2]),this.nor.push3(o[0],o[1],o[2]),this.nor.push3(a[0],a[1],a[2]),this.nor.push3(i[0],i[1],i[2]),this.col.push3(s[0],s[1],s[2]),this.col.push3(l[0],l[1],l[2]),this.col.push3(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 _e(t,n,e){let r=n[0]-t[0],o=n[1]-t[1],a=n[2]-t[2],i=e[0]-t[0],s=e[1]-t[1],l=e[2]-t[2],c=o*l-a*s,f=a*i-r*l,m=r*s-o*i,u=Math.hypot(c,f,m)||1;return c/=u,f/=u,m/=u,[c,f,m]}function Te(t,n){let e=[...t],r=[];for(let i of t)r.push(i.x,i.y);let o=[];if(n){for(let i of n)if(!(i.length<3)){o.push(e.length);for(let s of i)e.push(s),r.push(s.x,s.y)}}let a=Ae(r,o.length?o:void 0,2);return{pts:e,tris:a}}function Jt(t){return ft(t)<0?[...t].reverse():t}var Be=3;function Ee(t,n,e,r){let o=r(t),a=r(n),i=r(e),s=(h,b,p,d)=>Math.abs(r({x:(h.x+b.x)/2,y:(h.y+b.y)/2})-(p+d)/2),l=(t.x+n.x+e.x)/3,c=(t.y+n.y+e.y)/3,f=(o+a+i)/3,m=Math.max(s(t,n,o,a),s(n,e,a,i),s(e,t,i,o),Math.abs(r({x:l,y:c})-f)),u=(h,b,p)=>{let d=Math.abs(r({x:(h+l)/2,y:(b+c)/2})-(p+f)/2);d>m&&(m=d)};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+i)/2),u((e.x+t.x)/2,(e.y+t.y)/2,(i+o)/2),m}function wt(t,n,e,r,o){if(o<=0)return Ee(t,n,e,r);let a={x:(t.x+n.x)/2,y:(t.y+n.y)/2},i={x:(n.x+e.x)/2,y:(n.y+e.y)/2},s={x:(e.x+t.x)/2,y:(e.y+t.y)/2};return Math.max(wt(t,a,s,r,o-1),wt(a,n,i,r,o-1),wt(s,i,e,r,o-1),wt(a,i,s,r,o-1))}function _t(t,n,e,r,o,a,i,s){if(i>0){let u={x:(n.x+e.x)/2,y:(n.y+e.y)/2},h={x:(e.x+r.x)/2,y:(e.y+r.y)/2},b={x:(r.x+n.x)/2,y:(r.y+n.y)/2};_t(t,n,u,b,o,a,i-1,s),_t(t,u,e,h,o,a,i-1,s),_t(t,b,h,r,o,a,i-1,s),_t(t,u,h,b,o,a,i-1,s);return}let l=[n.x*g,o(n),n.y*g],c=[e.x*g,o(e),e.y*g],f=[r.x*g,o(r),r.y*g];if(s){t.triN(l,c,f,s(n),s(e),s(r),a);return}let m=_e(l,c,f);m[1]<0&&(m=[-m[0],-m[1],-m[2]]),t.tri(l,c,f,m,a)}var Ce=8;function _n(t,n,e){if(!Number.isFinite(e))return t;let r=[],o=(a,i,s,l,c)=>{if(c>0){let f={x:(a.x+i.x)/2,y:(a.y+i.y)/2},m=n(f);if(Math.abs(m-(s+l)/2)>e){o(a,f,s,m,c-1),o(f,i,m,l,c-1);return}}r.push(a)};for(let a=0;a<t.length;a++){let i=t[a],s=t[(a+1)%t.length];o(i,s,n(i),n(s),Ce)}return r}function Xt(t,n){if(t.length<3)return t;let e=[];for(let o of t){let a=e[e.length-1];a&&Math.hypot(o.x-a.x,o.y-a.y)<n||e.push(o)}for(;e.length>2&&Math.hypot(e[0].x-e[e.length-1].x,e[0].y-e[e.length-1].y)<n;)e.pop();if(e.length<3)return t;let r=[];for(let o=0;o<e.length;o++){let a=r.length?r[r.length-1]:e[(o-1+e.length)%e.length],i=e[o],s=e[(o+1)%e.length],l=s.x-a.x,c=s.y-a.y,f=Math.hypot(l,c);f>n&&Math.abs((i.x-a.x)*c-(i.y-a.y)*l)/f<n||r.push(i)}return r.length>=3?r:e}var Ut=.001*lt*.1;function K(t,n,e,r,o,a,i,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=Xt(_n(Xt(Jt(n),Ut),r,l),Ut),m=e?.map(M=>Xt(_n(Xt(Jt(M),Ut),r,l),Ut)).filter(M=>M.length>=3&&Math.abs(ft(M))>=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],d=[i[0]*s.top,i[1]*s.top,i[2]*s.top],y=[i[0]*s.wallBottom,i[1]*s.wallBottom,i[2]*s.wallBottom],x=0;if(Number.isFinite(l))for(;x<Be;x++){let M=0;for(let I=0;I<h.length;I+=3){let B=wt(u[h[I]],u[h[I+1]],u[h[I+2]],r,x);B>M&&(M=B)}if(M<=l)break}for(let M=0;M<h.length;M+=3){let I=u[h[M]],B=u[h[M+1]],k=u[h[M+2]];_t(t,I,B,k,r,b,x,c);let D=[I.x*g,o,I.y*g],U=[B.x*g,o,B.y*g],S=[k.x*g,o,k.y*g];t.tri(D,S,U,[0,-1,0],p)}let w=M=>{if(x<=0)return M;let I=1<<x,B=[];for(let k=0;k<M.length;k++){let D=M[k],U=M[(k+1)%M.length];for(let S=0;S<I;S++){let _=S/I;B.push({x:D.x+(U.x-D.x)*_,y:D.y+(U.y-D.y)*_})}}return B},A=pn(f),E=[{ring:w(f),flip:!1}];if(m)for(let M of m)M.length>=3&&E.push({ring:w(M),flip:!0});for(let{ring:M,flip:I}of E)for(let B=0;B<M.length;B++){let k=M[B],D=M[(B+1)%M.length],U=(D.x-k.x)*g,_=(D.y-k.y)*g,N=-U,O=Math.hypot(_,N)||1;_/=O,N/=O;let P=(k.x+D.x)/2-A.x,F=(k.y+D.y)/2-A.y,R=_*P+N*F;I&&(R=-R),R<0&&(_=-_,N=-N);let T=[_,0,N],C=[k.x*g,r(k),k.y*g],v=[D.x*g,r(D),D.y*g],G=[k.x*g,o,k.y*g],X=[D.x*g,o,D.y*g];t.tri(C,v,X,T,d,d,y),t.tri(C,X,G,T,d,y,y)}}function Tn(t){let n=0;for(let l of t)n+=l.count;let e=new Float32Array(n*3),r=new Float32Array(n*3),o=new Float32Array(n*3),a=new Float32Array(n),i=new Float32Array(n),s=0;for(let l of t)e.set(l.position,s*3),r.set(l.normal,s*3),o.set(l.color,s*3),a.set(l.floor,s),i.set(l.material,s),s+=l.count;return{position:e,normal:r,color:o,floor:a,material:i,count:n}}function jt(t,n,e=2.5){if(n<=0||t.length<3)return t;let r=Jt(t),o=r.length,a=[];for(let s=0;s<o;s++){let l=r[s],c=r[(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 i=[];for(let s=0;s<o;s++){let l=r[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=()=>{i.push([l.x+c.x*n,l.y+c.y*n]),i.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,d=1/Math.max(p,1e-6);if(!Number.isFinite(d)||d>e){b();continue}i.push([l.x+m*n*d,l.y+u*n*d])}if(i.length<3)return t;try{let s=Pe.union([[...i,i[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,r,o=28){let a=[];for(let i=0;i<o;i++){let s=i/o*Math.PI*2;a.push({x:t+e*Math.cos(s),y:n+r*Math.sin(s)})}return a}function Tt(t,n,e,r){return[{x:t,y:n},{x:t+e,y:n},{x:t+e,y:n+r},{x:t,y:n+r}]}var Bt=["available","held","sold","selected","dimmed"];function Qt(t){let n=Bt.indexOf(t);return n<0?0:n}var Bn={available:[.24,.82,.52],held:[.95,.66,.22],sold:[.34,.39,.45],selected:[.24,.74,1],dimmed:[.28,.32,.37]};function mr(t){let n=.2126*t[0]+.7152*t[1]+.0722*t[2],e=.42,r=.62;return[(n+(t[0]-n)*e)*r,(n+(t[1]-n)*e)*r,(n+(t[2]-n)*e)*r]}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},Fe=.44,ve=.15,ke=.3,Oe=.24;function En(t){return t===void 0||!Number.isFinite(t)||t<=0?Oe:Math.min(ke,Math.max(ve,t*Fe))}var hr=.21,Le=.05,en=.45,Ge=en+Le,De=.92,Ne=1.205,Xe=-.23,Ue=.38,Ye=[{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,Ge,-1],max:[1,De,-.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]}],je=[{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]}],He=[{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 br(){let t=[],n=[],e=[],r=[],o=(O,P,F)=>{let R=e.length,[T,C,v]=O,G=[C[0]-T[0],C[1]-T[1],C[2]-T[2]],X=[v[0]-T[0],v[1]-T[1],v[2]-T[2]],L=G[1]*X[2]-G[2]*X[1],Y=G[2]*X[0]-G[0]*X[2],j=G[0]*X[1]-G[1]*X[0],$=Math.hypot(L,Y,j);$>1e-9?(L/=$,Y/=$,j/=$):[L,Y,j]=P,L*P[0]+Y*P[1]+j*P[2]<0&&(L=-L,Y=-Y,j=-j);for(let z of O)t.push(...z),n.push(L,Y,j),e.push(F);r.push(R,R+1,R+2,R,R+2,R+3)},a=O=>{for(let P of He){let F=P.c.map(R=>R.map((T,C)=>T?O.max[C]:O.min[C]));o(F,P.n,O.part)}};for(let O of Ye)a(O);for(let O of je)a(O);let i=en,s=1.08,l=.47,c=.69,f=-.55,m=.08,u=-.48,h=.01,b=[-l,i,f],p=[l,i,f],d=[-l,i,m],y=[l,i,m],x=[-c,s,u],w=[c,s,u],A=[-c,s,h],E=[c,s,h];o([p,w,E,y],[1,0,0],V.body),o([d,A,x,b],[-1,0,0],V.body),o([A,E,w,x],[0,1,0],V.body),o([b,p,y,d],[0,-1,0],V.body),o([y,E,A,d],[0,0,1],V.body),o([b,x,w,p],[0,0,-1],V.body);let M=10,I=8,B=[0,Ne,Xe],k=[.42,.115,Ue],D=e.length;for(let O=0;O<=I;O++){let P=Math.PI*O/I,F=Math.cos(P),R=Math.sin(P);for(let T=0;T<=M;T++){let C=Math.PI*2*T/M,v=R*Math.cos(C),G=R*Math.sin(C);t.push(B[0]+k[0]*v,B[1]+k[1]*F,B[2]+k[2]*G);let X=v/k[0],L=F/k[1],Y=G/k[2],j=Math.hypot(X,L,Y)||1;X/=j,L/=j,Y/=j,n.push(X,L,Y),e.push(V.head)}}for(let O=0;O<I;O++)for(let P=0;P<M;P++){let F=D+O*(M+1)+P,R=F+M+1;r.push(F,R,F+1,F+1,R,R+1)}let U=new Float32Array(t),S=new Float32Array(n),_=new Float32Array(e),N=new Uint16Array(r);return{position:U,normal:S,part:_,index:N,vertexCount:e.length,indexCount:r.length}}function Cn(t,n,e,r){let o=new Float32Array(n),a=c=>t[c*3],i=c=>t[c*3+2],s=0,l=(c,f)=>{let m=f-c;for(let u=c;u<f;u++){let[h,b]=r(u),p=h-a(u),d=b-i(u);if(m>=2){let y=Math.max(c,u-1),x=Math.min(f-1,u+1),w=a(x)-a(y),A=i(x)-i(y),E=Math.hypot(w,A);if(E>1e-6){let M=-A/E,I=w/E;M*p+I*d<0&&(M=-M,I=-I),p=M,d=I}}o[u]=p===0&&d===0?0:Math.atan2(p,d)}};for(let c=1;c<=n;c++)(c===n||e(c)!==e(s))&&(l(s,c),s=c);return o}var Vt=.22;function Ar(t,n){let e=Bt[t];if(e!=="sold"&&e!=="held")return-1;let r=(n+1)*2654435761;return r^=r>>>15,r=Math.imul(r,2246822519),r^=r>>>13,(r>>>0)%1e5/1e5}var Ve=.42;function We(t){let n=t.length,e=new Float64Array(n);if(n<2)return e.fill(1/0),e;let r=1/0,o=1/0,a=-1/0,i=-1/0;for(let b of t)b.x<r&&(r=b.x),b.y<o&&(o=b.y),b.x>a&&(a=b.x),b.y>i&&(i=b.y);let s=Math.max(a-r,1e-6),l=Math.max(i-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 d=Math.min(f-1,Math.max(0,Math.floor((b-r)/c)));return Math.min(m-1,Math.max(0,Math.floor((p-o)/c)))*f+d};for(let b=0;b<n;b++){let p=h(t[b].x,t[b].y),d=u.get(p);d?d.push(b):u.set(p,[b])}for(let b=0;b<n;b++){let p=t[b],d=Math.min(f-1,Math.max(0,Math.floor((p.x-r)/c))),y=Math.min(m-1,Math.max(0,Math.floor((p.y-o)/c))),x=1/0;for(let w=1;w<=4;w++){for(let A=y-w;A<=y+w;A++)if(!(A<0||A>=m))for(let E=d-w;E<=d+w;E++){if(E<0||E>=f||w>1&&Math.abs(A-y)<w&&Math.abs(E-d)<w)continue;let M=u.get(A*f+E);if(M)for(let I of M){if(I===b)continue;let B=Math.hypot(t[I].x-p.x,t[I].y-p.y);B<x&&(x=B)}}if(Number.isFinite(x)&&x<=w*c)break}e[b]=x}return e}function ze(t){let n=t.eyeHeightM;return Number.isFinite(n)?Math.max(0,n-Gt):0}function Fn(t,n,e,r,o,a){let i=t.length,s=new Float32Array(i*3),l=new Float32Array(i),c=new Float32Array(i*3),f=new Float32Array(i),m=new Float32Array(i),u=new Float32Array(i),h=new Float32Array(i),b=new Float32Array(i*3),p=new Map,d=We(t);for(let y=0;y<i;y++){let x=t[y],A=(e?.seatPitchU(y)??d[y])*g;f[y]=Number.isFinite(A)?Math.max(.06,Math.min(Vt,A*Ve)):Vt,m[y]=En(Number.isFinite(A)?A:void 0);let E=Rn(x.glyph,{seatGlyph:a?.get(x.categoryKey)});u[y]=Sn.indexOf(E),h[y]=x.wheelchairSpaceType==="no-seat"?0:1,s[y*3]=x.x*g,s[y*3+1]=e?e.seatDeckY(y):ze(x),s[y*3+2]=x.y*g,l[y]=Qt(n?n(x):"available");let M=H(o?.get(x.categoryKey)??"#6e7bff")??[.43,.48,1];if(c[y*3]=M[0],c[y*3+1]=M[1],c[y*3+2]=M[2],x.accessibility?.length){let I=H(hn(x.accessibility));I&&(b[y*3]=I[0],b[y*3+1]=I[1],b[y*3+2]=I[2])}p.set(x.id,y)}return{count:i,iPosition:s,iState:l,iCategory:c,iMaxRadius:f,iRing:b,idToIndex:p,iChairWidth:m,iGlyph:u,iPhysicalSeat:h,iFloor:r??new Float32Array(i),iYaw:new Float32Array(i)}}var Ze=64;function Pr(t,n){let e=[];for(let i of n){let s=t.idToIndex.get(i.seatId);if(s===void 0)continue;let l=Qt(i.state);t.iState[s]!==l&&(t.iState[s]=l,e.push(s))}if(!e.length)return[];e.sort((i,s)=>i-s);let r=[],o=e[0],a=e[0];for(let i=1;i<e.length;i++){let s=e[i];if(s!==a){if(s<=a+Ze){a=s;continue}r.push({start:o,length:a-o+1}),o=s,a=s}}return r.push({start:o,length:a-o+1}),r}function _r(t,n,e){return e<0?n>1?t.filter(r=>r.kind==="floor"):[...t]:t.filter(r=>r.floorIndex===void 0||r.floorIndex===e)}function Tr(t,n){let e=[...t].sort((o,a)=>o.screen.y-a.screen.y),r=[];for(let o of e){let a=r.find(i=>i.some(s=>Math.abs(s.screen.x-o.screen.x)<104&&Math.abs(s.screen.y-o.screen.y)<34));a?a.push(o):r.push([o])}return r.flatMap(o=>o.length<2?o:o.map((a,i)=>({...a,screen:{...a.screen,x:Math.max(54,Math.min(n-54,a.screen.x+(i-(o.length-1)/2)*104))}})))}var Ke=1.15,$e=2.75,qe=4.5,Je=.85,Qe=.5,to=.26;function Br(t,n,e){let r=Math.max(1e-6,n),o=t/r,a=e?.hasZoneLabels??!0,i=new Set;return o>=.75&&i.add("floor"),o>=Ke&&i.add("zone"),o<=(a?$e:qe)&&(i.add("section"),i.add("ga")),o<=Je&&(i.add("annotation"),i.add("booth")),o<=Qe&&i.add("row"),o<=to&&i.add("seat"),i}function Er(t,n,e,r,o,a=6){let i=a+n,s=r-a-n,l=a+e,c=o-a-e;return{...t,x:i>s?r/2:Math.max(i,Math.min(s,t.x)),y:l>c?o/2:Math.max(l,Math.min(c,t.y))}}function Cr(t,n,e,r){let o=t,a=n[0],i=n[1],s=n[2],l=o[0]*a+o[4]*i+o[8]*s+o[12],c=o[1]*a+o[5]*i+o[9]*s+o[13],f=o[2]*a+o[6]*i+o[10]*s+o[14],m=o[3]*a+o[7]*i+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))*r,depth:b,visible:p}}function Fr(t,n,e=n){let r=[],o=[...t].sort((a,i)=>a.screen.depth-i.screen.depth);for(let a of o){let i=!1;for(let s of r)if(on(a,s,n,e)){i=!0;break}i||r.push(a)}return r}var no=6;function on(t,n,e,r){let o=Math.abs(t.screen.x-n.screen.x),a=Math.abs(t.screen.y-n.screen.y),i=t.halfWidth!=null&&n.halfWidth!=null?Math.max(e,t.halfWidth+n.halfWidth+no):e;return o<i&&a<r}function vr(t,n,e){return t.length*n*.58+(e?14:0)}var eo={row:8,seat:14};function kr(t){return t<480?{row:5,seat:8}:t<768?{row:6,seat:10}:eo}function Or(t,n,e,r){let o=Math.max(1,Math.min(e,r)*.5),a=Math.min(2,Math.hypot(t.x-e/2,t.y-r/2)/o);return n*(1+1.5*a)}function Lr(t,n,e,r,o=[]){let a=[...t].sort((s,l)=>(l.priority??0)-(s.priority??0)||s.focus-l.focus),i=[];for(let s of a){if(i.length>=r)break;let l=!1;for(let c of o)if(on(s,c,n,e)){l=!0;break}if(!l){for(let c of i)if(on(s,c,n,e)){l=!0;break}}l||i.push(s)}return i}import bo from"polygon-clipping";var W={top:1,wallBottom:.5,bottomCap:.4};function st(t,n){if(!t)return n;let e=et(Pt(t,.4),.62);return nt(n,e,.72)}function vn(t,n){let e=new Map;for(let a of t.categories??[])e.set(a.key,a.color);let r=new Map;for(let a of n){if(!a.sectionId)continue;let i=r.get(a.sectionId);i||(i=new Map,r.set(a.sectionId,i)),i.set(a.categoryKey,(i.get(a.categoryKey)??0)+1)}let o=new Map;for(let[a,i]of r){let s=0,l=0,c=0,f=0;for(let[m,u]of i){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 kn(t,n){return H(t.color)??n.get(t.logicalSectionId??t.id)??null}import zn from"polygon-clipping";import Dn from"polygon-clipping";import oo from"earcut";var ro=.58,On=.01,ot=Vt*1.5*lt,io=.5,so=.6;function ao(t,n){let e=t.length,r=[];for(let i=0;i<e;i++){let s=t[Math.max(0,i-1)],l=t[Math.min(e-1,i+1)],c=l.x-s.x,f=l.y-s.y,m=Math.hypot(c,f);if(m<1e-9){r.push([0,0]);continue}c/=m,f/=m,r.push([-f,c])}let o=0;for(let i=0;i<e;i++)o+=(t[i].x-n.x)*r[i][0]+(t[i].y-n.y)*r[i][1];return o<0?r.map(([i,s])=>[-i,-s]):r}function co(t,n){if(t.length<2||n<=0)return[...t];let e=[...t],r=(i,s)=>{let l=s.x-i.x,c=s.y-i.y,f=Math.hypot(l,c)||1;return{x:l/f,y:c/f}},o=r(e[1],e[0]),a=r(e[e.length-2],e[e.length-1]);return e.unshift({x:e[0].x+o.x*n,y:e[0].y+o.y*n}),e.push({x:e[e.length-1].x+a.x*n,y:e[e.length-1].y+a.y*n}),e}var Ln=Math.PI/12;function uo(t){if(t.length<3)return[...t];let n=[...t].sort((a,i)=>a.x-i.x||a.y-i.y),e=(a,i,s)=>(i.x-a.x)*(s.y-a.y)-(i.y-a.y)*(s.x-a.x),r=a=>{let i=[];for(let s of a){for(;i.length>=2&&e(i[i.length-2],i[i.length-1],s)<=0;)i.pop();i.push(s)}return i.pop(),i},o=[...r(n),...r([...n].reverse())];return o.length>=3?o:[...t]}function Nn(t,n){if(!t.length||!(n>0))return[];let e=uo(t),r=(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/Ln)),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/Ln)),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 i=[];for(let s=0;s<o;s++)r(e[s],a[(s+o-1)%o],a[s],i);return Hn(i)}function lo(t,n,e){if(t.length===1)return Math.hypot(n-t[0].x,e-t[0].y);let r=1/0;for(let o=0;o+1<t.length;o++){let a=t[o],i=t[o+1],s=i.x-a.x,l=i.y-a.y,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<r&&(r=m)}return r}function Wt(t){let n=t.map(o=>{let a=0,i=0;for(let c of o.pts)a+=c.x,i+=c.y;let s=o.pts.length||1;a/=s,i/=s;let l=0;for(let c of o.pts){let f=Math.hypot(c.x-a,c.y-i);f>l&&(l=f)}return{cx:a,cy:i,rad:l}}),e=o=>{let a=o.length;return a<=2?[...o]:[o[Math.floor(a*.25)],o[Math.floor(a*.5)],o[Math.floor(a*.75)]]},r=[];for(let o=0;o<t.length;o++){let a=e(t[o].pts),i=[],s=1/0,l=null;for(let 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=lo(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&&i.push(m)}i.sort((f,m)=>f-m);let c=i.length?i[Math.floor(i.length/2)]:1;r.push({pitch:c,belowY:l})}return r}function Xn(t,n,e,r){let o=t[n],a=o.pts.length>=2?[...o.pts]:o.pts.length===1?(()=>{let f=o.pts[0],m=f.x-r.x,u=f.y-r.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 i=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&&(i+=m,s++)}let l=s>0?i/s:0,c=co(a,Math.max(l*so,ot));return{pts:c,nrm:ao(c,r),front:Math.max(e[n].pitch*ro,ot),back:Math.max(e[n].pitch*io,ot)}}var gt=1.5,Un=.3;function rn(t,n){if(t.length<3)return t;let e=t[0],r=t[t.length-1],o=r.x-e.x,a=r.y-e.y,i=Math.hypot(o,a),s=-1,l=-1;for(let m=1;m<t.length-1;m++){let u=t[m],h=i>1e-12?Math.abs((u.x-e.x)*a-(u.y-e.y)*o)/i:Math.hypot(u.x-e.x,u.y-e.y);h>s&&(s=h,l=m)}if(s<=n||l<0)return[e,r];let c=rn(t.slice(0,l+1),n),f=rn(t.slice(l),n);return[...c.slice(0,-1),...f]}function Yn(t,n){if(t.length<4)return t;let e=rn([...t,t[0]],n);return e.pop(),e.length>=3?e:t}function jn(t,n,e){if(t.length<2)return[];let r=e??Wt(t),o=new Map;for(let i=0;i<t.length;i++){let s=o.get(t[i].blockId);s?s.push(i):o.set(t[i].blockId,[i])}let a=[];for(let[,i]of o){let s=[];for(let x of i){let w=t[x].patch;w&&w.length>=3?a.push({outline:[...w],holes:[],topY:t[x].y}):s.push(x)}if(!s.length)continue;s.sort((x,w)=>t[x].depth-t[w].depth);let c=s.map(x=>Xn(t,x,r,n)).filter(x=>x!==null);if(!c.length)continue;let f=(x,w)=>({x:x.pts[w].x-x.nrm[w][0]*(x.front+gt),y:x.pts[w].y-x.nrm[w][1]*(x.front+gt)}),m=(x,w)=>({x:x.pts[w].x+x.nrm[w][0]*(x.back+gt),y:x.pts[w].y+x.nrm[w][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=Hn(b),d=1/0;for(let x of s)t[x].y<d&&(d=t[x].y);if(!Number.isFinite(d))continue;if(p.length>=3&&Math.abs(ft(p))>1e-6&&c.every(x=>{let w=x.pts[Math.floor(x.pts.length/2)];return It(p,w.x,w.y)})){a.push({outline:Yn(p,Un),holes:[],topY:d});continue}for(let x of mo(c))a.push({outline:x,holes:[],topY:d})}return a}function mo(t){let n=[];for(let e of t){let r=[],o=[],a=e.front+gt,i=e.back+gt;for(let l=0;l<e.pts.length;l++){let c=e.pts[l],f=e.nrm[l];r.push([c.x-f[0]*a,c.y-f[1]*a]),o.push([c.x+f[0]*i,c.y+f[1]*i])}let s=[...r,...o.reverse()];s.length<3||(s.push(s[0]),n.push([s]))}if(!n.length)return[];try{let e=Dn.union(n[0],...n.slice(1)),r=[];for(let o of e){if(!o.length||o[0].length<4)continue;let a=o[0].map(([l,c])=>({x:l,y:c})),i=a[0],s=a[a.length-1];a.length>1&&Math.abs(i.x-s.x)<1e-9&&Math.abs(i.y-s.y)<1e-9&&a.pop(),a.length>=3&&r.push(Yn(a,Un))}return r}catch{return[]}}function Hn(t){let n=[];for(let e of t){let r=n[n.length-1];r&&Math.hypot(e.x-r.x,e.y-r.y)<1e-9||n.push(e)}for(;n.length>2&&Math.hypot(n[0].x-n[n.length-1].x,n[0].y-n[n.length-1].y)<1e-9;)n.pop();return n}var 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 r of e)r.x<this.minX&&(this.minX=r.x),r.y<this.minY&&(this.minY=r.y),r.x>this.maxX&&(this.maxX=r.x),r.y>this.maxY&&(this.maxY=r.y)}containsAll(n){for(let e of n)if(e.x<this.minX||e.x>this.maxX||e.y<this.minY||e.y>this.maxY)return!1;for(let e of this.rings){let r=!0;for(let o of n)if(!It(e,o.x,o.y)){r=!1;break}if(r)return!0}return!1}};function Gn(t,n,e,r,o,a){if(r.length<3)return;if(e.containsAll(r)){let c=[0,1,0],f=r[0];for(let m=1;m+1<r.length;m++){let u=r[m],h=r[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 i=r.map(c=>[c.x,c.y]);i.push(i[0]);let s;try{s=Dn.intersection([i],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=oo(m,void 0,2);for(let b=0;b<h.length;b+=3){let p=u[h[b]],d=u[h[b+1]],y=u[h[b+2]];t.tri([p[0]*g,o,p[1]*g],[d[0]*g,o,d[1]*g],[y[0]*g,o,y[1]*g],l,a)}}}function Vn(t,n,e,r,o,a,i){if(n.length<2)return;let s=i??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 E=[...b.patch],M=s[h].belowY??r;if(u(()=>{if(c&&f)Gn(t,c,f,E,b.y,o.tread);else{let I=E[0];for(let B=1;B+1<E.length;B++){let k=E[B],D=E[B+1];t.tri([I.x*g,b.y,I.y*g],[k.x*g,b.y,k.y*g],[D.x*g,b.y,D.y*g],l,o.tread)}}}),b.y>M+On){let I=0,B=0;for(let k of E)I+=k.x,B+=k.y;I/=E.length,B/=E.length,m(()=>{for(let k=0;k<E.length;k++){let D=E[k],U=E[(k+1)%E.length],S=U.x-D.x,_=U.y-D.y,N=Math.hypot(S,_);if(N<1e-6)continue;let O=_/N,P=-S/N;(D.x-I)*O+(D.y-B)*P<0&&(O=-O,P=-P);let F=[O,0,P],R=[D.x*g,b.y,D.y*g],T=[U.x*g,b.y,U.y*g],C=[D.x*g,M,D.y*g],v=[U.x*g,M,U.y*g];t.tri(R,T,v,F,o.riser),t.tri(R,v,C,F,o.riser)}})}continue}let p=Xn(n,h,s,e);if(!p)continue;let{pts:d,nrm:y,front:x,back:w}=p,A=s[h].belowY??r;for(let E=0;E+1<d.length;E++){let M=d[E],I=d[E+1],B=y[E],k=y[E+1];if(Math.hypot(I.x-M.x,I.y-M.y)<1e-6||B[0]===0&&B[1]===0||k[0]===0&&k[1]===0)continue;let D=[(M.x-B[0]*x)*g,b.y,(M.y-B[1]*x)*g],U=[(I.x-k[0]*x)*g,b.y,(I.y-k[1]*x)*g],S=[(M.x+B[0]*w)*g,b.y,(M.y+B[1]*w)*g],_=[(I.x+k[0]*w)*g,b.y,(I.y+k[1]*w)*g];if(u(()=>{c&&f?Gn(t,c,f,[{x:M.x-B[0]*x,y:M.y-B[1]*x},{x:I.x-k[0]*x,y:I.y-k[1]*x},{x:I.x+k[0]*w,y:I.y+k[1]*w},{x:M.x+B[0]*w,y:M.y+B[1]*w}],b.y,o.tread):(t.tri(D,U,_,l,o.tread),t.tri(D,_,S,l,o.tread))}),b.y>A+On){let N=[D[0],A,D[2]],O=[U[0],A,U[2]],P=[-B[0],0,-B[1]];m(()=>{t.tri(D,U,O,P,o.riser),t.tri(D,O,N,P,o.riser)})}}}}function fo(t,n){let e=t.eventConfigurationIds;return!e?.length||!!n&&e.includes(n)}function Wn(t,n){return t.filter(e=>e.type!=="shape"||fo(e,n))}function Zn(t,n){let e=t.focalPoint??{x:0,y:0};return t.floors?.length?t.floors.map((r,o)=>({objects:Wn(r.objects,n),focal:{x:(r.focalPoint??e).x,y:(r.focalPoint??e).y},baseHeightM:r.baseHeightM??0,index:o})):[{objects:Wn(t.objects,n),focal:e,baseHeightM:0,index:0}]}var ho={minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};function Mt(t){return Mn(t)??ho}function Kn(t,n){let e=jt(t.outline,ot),r=Mt(e),o=n.filter(i=>i!==t&&i.outline&&i.outline.length>=3&&Nt(r,Mt(i.outline)));if(!o.length)return[e];let a=i=>{let s=i.map(l=>[l.x,l.y]);return s.push(s[0]),s};try{let i=zn.difference([a(e)],...o.map(l=>[a(l.outline)])),s=[];for(let l of i){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 $n(t,n){if(!n.length)return t;let e=a=>{let i=a.map(s=>[s.x,s.y]);return i.push(i[0]),i},r=n.map(a=>[e(a)]),o=[];for(let a of t){let i;try{i=zn.intersection([e(a.outline)],r.flat())}catch{o.push(a);continue}for(let s of i){if(!s.length)continue;let l=s[0].map(([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}function po(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 r=n.map(l=>[l.x,l.y]);if(r.length<3)return[];r.push(r[0]);let o=Mt(n),a=this.rings.filter((l,c)=>Nt(o,this.boxes[c])&&po(e,this.levels[c])),i=[[r]];if(a.length)try{i=bo.difference([r],...a).map(c=>c.map(f=>f.map(([m,u])=>[m,u])))}catch{i=[[r]]}this.rings.push([r]),this.boxes.push(o),this.levels.push(e);let s=[];for(let l of i){if(!l.length)continue;let 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 yo(t,n){if(!n)return t;let e=1/0,r=-1/0,o=1/0,a=-1/0;for(let m of t)e=Math.min(e,m.x),r=Math.max(r,m.x),o=Math.min(o,m.y),a=Math.max(a,m.y);let i=(e+r)/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-i,h=m.y-s;return{x:i+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=Tt(t.x??0,t.y??0,t.width,t.height)),t.kind==="ellipse"&&t.width&&t.height){let e=(t.x??0)+t.width/2,r=(t.y??0)+t.height/2;n=Ht(e,r,t.width/2,t.height/2)}return n?yo(n,t.rotation):null}function Et(t){let n=t.role??"",e={stage:{kind:"stage",heightM:1},entrance:{kind:"portal",heightM:2.7},exit:{kind:"portal",heightM:2.7},screen:{kind:"solid",heightM:6},wall:{kind:"solid",heightM:2.8},rail:{kind:"solid",heightM:1.1},suite:{kind:"suite",heightM:3},obstruction:{kind:"solid",heightM:4.5},sound:{kind:"solid",heightM:1.45},restroom:{kind:"solid",heightM:2.4},bar:{kind:"solid",heightM:1.1},concession:{kind:"solid",heightM:1.1},coat:{kind:"solid",heightM:1.1},goal:{kind:"portal",heightM:1.8}},r=n==="stage"&&xn(t.stageKind)?{kind:"stage",heightM:.06}:e[n]??{kind:"plate",heightM:.25};return{...r,heightM:t.heightM??r.heightM}}var xo=.08;function qn(t,n){let e=bt(t),r=Et(t),o=r.heightM;if(!e||r.kind!=="plate"&&r.kind!=="stage")return o;let a=1/0,i=1/0,s=-1/0,l=-1/0;for(let f of e)a=Math.min(a,f.x),i=Math.min(i,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&&i<f.maxY&&c<=f.topOffsetM+1e-6&&(c=f.topOffsetM+xo);return n.push({minX:a,minY:i,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 Jn(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 Ct(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 Qn(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,r,o,a){K(t,n,void 0,()=>e,r,o,a,W)}var an=2.4,go=.75,Mo=.15;function Ft(t){if(t.points&&t.points.length>=3)return t.points;let{center:n,width:e,height:r,rotation:o}=t;if(!e||!r)return null;let a=(o??0)*Math.PI/180,i=Math.cos(a),s=Math.sin(a),l=e/2,c=r/2;return[[-l,-c],[l,-c],[l,c],[-l,c]].map(([f,m])=>({x:n.x+f*i-m*s,y:n.y+f*s+m*i}))}function te(t,n,e,r,o){let a=Ft(n);a&&K(t,a,void 0,()=>e+an,e,st(r,o.boothTop),o.boothWall,W)}function cn(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:r,center:o}=t;if(!n||!e)return null;let a=(r??0)*Math.PI/180,i=Math.cos(a),s=Math.sin(a),l=n/2,c=e/2;return[[-l,-c],[l,-c],[l,c],[-l,c]].map(([f,m])=>({x:o.x+f*i-m*s,y:o.y+f*s+m*i}))}function ne(t,n,e,r,o){let a=cn(n);a&&K(t,a,void 0,()=>e+go,e,st(r,o.tableTop),o.tableWall,W)}function ee(t,n,e,r,o,a,i,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}:Et(n),u=s?.baseY??e,h=s?.topY??e+r;if(c&&i){let x=1/0,w=-1/0,A=1/0,E=-1/0;for(let M of l)M.x<x&&(x=M.x),M.x>w&&(w=M.x),M.y<A&&(A=M.y),M.y>E&&(E=M.y);i.push({cx:(x+w)/2*g,cz:(A+E)/2*g,y:h,halfX:Math.max((w-x)/2*g,.5),halfZ:Math.max((E-A)/2*g,.5)})}let b=H(n.fill),p=c&&b?nt(o.stageTop,et(Pt(b,.18),.9),.9):st(b,c?o.stageTop:o.decorTop),d=f?b:null,y=c?b?nt(o.stageWall,et(b,.58),.82):o.stageWall:f?d?nt(et(d,1.42),[.24,.46,.82],.08):[.24,.46,.82]:st(H(n.fill),o.decorWall);if(m.kind==="portal"&&l.length===4){let x=Jn(l);at(t,Ct(x,0,.16),h,u,p,y),at(t,Ct(x,.84,1),h,u,p,y),at(t,x,h,Math.max(u,h-.35),p,y);return}if(m.kind==="suite"&&l.length===4){let x=l.map((E,M)=>{let I=l[(M+1)%4],B=(E.x+I.x)/2,k=(E.y+I.y)/2;return Math.hypot(B-a.x,k-a.y)}),w=x.indexOf(Math.min(...x)),A=[0,1,2,3].map(E=>l[(w+E)%4]);at(t,Ct(A,0,.08),h,u,p,y),at(t,Ct(A,.92,1),h,u,p,y),at(t,Qn(A,.88,1),h,u,p,y),at(t,A,h,Math.max(u,h-.18),p,y);return}at(t,l,h,u,p,y)}function un(t){let{x:n,y:e,width:r,height:o}=t;if(!r||!o)return null;let a=n+r/2,i=e+o/2,s=(t.rotation??0)*Math.PI/180,l=Math.cos(s),c=Math.sin(s),f=r/2,m=o/2;return[[-f,-m],[f,-m],[f,m],[-f,m]].map(([u,h])=>({x:a+u*l-h*c,y:i+u*c+h*l}))}function So(t){if(!t||!t.startsWith("data:image/svg+xml"))return null;let n=t.slice(t.indexOf(",")+1);if(/;base64/i.test(t.slice(0,t.indexOf(","))))try{n=atob(n)}catch{return null}else try{n=decodeURIComponent(n)}catch{}let e=n.match(/<(?:rect|path)\b[^>]*\bfill="([^"]+)"/i);if(!e)return null;let r=e[1].trim();if(r==="none"||r==="transparent")return null;let o=r.match(/^url\(#([^)]+)\)$/);if(!o)return H(r);let a=n.match(new RegExp(`<(?:linear|radial)Gradient\\b[^>]*\\bid="${o[1]}"[^>]*>([\\s\\S]*?)</(?:linear|radial)Gradient>`,"i"));if(!a)return null;let i=[];for(let s of a[1].matchAll(/stop-color="([^"]+)"/gi)){let l=H(s[1].trim());l&&i.push(l)}return i.length?i.reduce((s,l,c)=>nt(s,l,1/(c+1)),i[0]):null}function oe(t,n,e,r){if(n.layer==="foreground")return;let o=un(n);if(!o)return;let a=e+Mo,i=st(So(n.href),r.decorTop),s=Math.max(0,Math.min(1,n.opacity??1));s<1&&(i=nt(r.ground,i,s)),K(t,o,void 0,()=>a,e,i,nt(i,r.decorWall,.5),W)}function re(t,n,e,r,o){if(!n.points||n.points.length<3)return;let a=st(r,o.gaTop);K(t,n.points,n.holes,()=>e+.15,e,a,o.gaWall,W)}var Ro=6,Ao=2.2,ie=.1,Po=.3,Io=1.8,wo=.9,_o=.55,To=6e3;function se(t){let{doc:n,units:e,seats:r,surfaces:o,focal:a}=t,i=n.zones??[],s=[];if(i.length){let l=new Map;for(let 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<r.length;f++){let m=r[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 i){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 ae(t){let{doc:n,units:e,seats:r,surfaces:o,seatData:a,hintedSeatFloor:i,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]+Ro,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<r.length;b++){let p=o.seatOwner[b];if(!p)continue;let d=u.get(p);d||(d={n:0,x:0,y:0,deck:0},u.set(p,d)),d.n++,d.x+=r[b].x,d.y+=r[b].y,d.deck+=o.seatDeckY(b);let y=h.get(p);y||(y={minX:1/0,maxX:-1/0,minY:1/0,maxY:-1/0},h.set(p,y)),r[b].x<y.minX&&(y.minX=r[b].x),r[b].x>y.maxX&&(y.maxX=r[b].x),r[b].y<y.minY&&(y.minY=r[b].y),r[b].y>y.maxY&&(y.maxY=r[b].y)}for(let b of e)for(let p of b.objects){if(p.type!=="section")continue;let d=u.get(p.id);if(!d||d.n===0)continue;let y=h.get(p.id),x=[d.x/d.n*g,d.deck/d.n,d.y/d.n*g],w=p.displayLabel||p.label||p.id;f.push({id:p.id,floorIndex:b.index,label:w,seatCount:d.n,center:x,radius:Math.max(1,Math.hypot(y.maxX-y.minX,y.maxY-y.minY)*.5*g),focalWorld:[b.focal.x*g,b.baseHeightM+1.5,b.focal.y*g]});let A=n.floors?.[b.index]?.name?.trim().toLocaleLowerCase();e.length>1&&A===w.trim().toLocaleLowerCase()||c.push({id:`section:${p.id}`,kind:"section",text:w,anchor:[x[0],x[1]+Ao,x[2]],floorIndex:b.index})}}{for(let p of e)for(let d of p.objects){if(d.type!=="gaArea")continue;let y=At(d.points);if(!y)continue;let x=d.displayLabel||d.label||d.id;c.push({id:`ga:${d.id}`,kind:"ga",text:d.capacity>0?`${x} \xB7 ${d.capacity.toLocaleString()}`:x,anchor:[y.x*g,p.baseHeightM+Io,y.y*g],floorIndex:p.index})}let u=new Map;for(let p of e)for(let d of p.objects)d.type==="section"&&u.set(d.id,d.displayLabel||d.label||d.id);let h=new Map;for(let p=0;p<r.length;p++){let d=r[p],y=Math.hypot(d.x-l.x,d.y-l.y),x=h.get(d.rowId);(!x||y>x.far)&&h.set(d.rowId,{seat:d,index:p,far:y})}for(let[p,d]of h){let y=Eo(d.seat.label,p,u.get(d.seat.sectionId??""));y&&c.push({id:`row:${p}`,kind:"row",text:y,anchor:[d.seat.x*g,o.seatDeckY(d.index)+wo,d.seat.y*g],floorIndex:i[d.index]})}let b=new Map;for(let p=0;p<r.length;p++){let d=r[p],y=d.label?d.label.lastIndexOf("-"):-1,x=b.get(d.rowId);x||(x={n:0,x:0,y:0,z:0,minX:1/0,maxX:-1/0,minZ:1/0,maxZ:-1/0,label:y>0?d.label.slice(0,y):d.rowId,sectionId:d.sectionId},b.set(d.rowId,x));let w=p*3,A=a.iPosition[w],E=a.iPosition[w+1],M=a.iPosition[w+2];x.n++,x.x+=A,x.y+=E,x.z+=M,x.minX=Math.min(x.minX,A),x.maxX=Math.max(x.maxX,A),x.minZ=Math.min(x.minZ,M),x.maxZ=Math.max(x.maxZ,M)}for(let[p,d]of b)m.push({id:p,label:d.label,sectionId:d.sectionId,seatCount:d.n,center:[d.x/d.n,d.y/d.n,d.z/d.n],radius:Math.max(.8,Math.hypot(d.maxX-d.minX,d.maxZ-d.minZ)*.5)});if(r.length<=To)for(let p=0;p<r.length;p++){let d=r[p],y=Bo(d.displayLabel||d.label);y&&c.push({id:`seat:${d.id}`,kind:"seat",text:y,anchor:[d.x*g,o.seatDeckY(p)+_o,d.y*g],floorIndex:i[p]})}}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?At(b):null;if(!p||!h.label)continue;c.push({id:`architecture:${h.id}`,kind:"annotation",text:h.label,anchor:[p.x*g,u.baseHeightM+Et(h).heightM+ie,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+ie,h.position.y*g],color:h.color,rotation:h.rotation,floorIndex:u.index})}else if(h.type==="booth"){let b=Ft(h);if(!b)continue;let p=At(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+an+Po,p.y*g],floorIndex:u.index})}return{labels:c,sections:f,rows:m}}function ce(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 Bo(t){let n=t.lastIndexOf("-");return n>=0&&n<t.length-1?t.slice(n+1):t}function Eo(t,n,e){let r=t?t.lastIndexOf("-"):-1,o=r>0?t.slice(0,r):n;return o&&gn(o,e)}var Co=.15,Fo=.9,vo=1.76;function ko(){return{background:{top:[...nn.top],bottom:[...nn.bottom]},structure:tn,seatStates:{...Bn},seatScale:1,materials:{seat:null,shell:null,roughness:.78}}}function ue(t){let n=ko();if(!t)return n;let e=H(t.background);if(e){n.background={top:et(e,Fo),bottom:et(e,vo)};let i={};for(let[s,l]of Object.entries(tn))i[s]=nt(l,e,Co);n.structure=i}let r=H(t.selectionColor)??H(t.accent);r&&(n.seatStates={...n.seatStates,selected:r});let o=t.seatScale;typeof o=="number"&&Number.isFinite(o)&&(n.seatScale=An(o));let a=t.venue3d;if(a){let i=H(a.deck),s=H(a.fascia);i&&(n.structure={...n.structure,tierTop:i,gaTop:i}),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 le(t,n){let e=[];for(let r of n)e.push(...t.seatStates[r]);return e}var Oo=.05,me=.05,Lo=.15,ln=25;function fe(t,n,e){let r=new Map,o=new Array(n.length).fill(null),a=new Float64Array(n.length),i=new Array(n.length).fill(void 0),s=new Array(n.length).fill(void 0),l=new Map,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(y=>y.id===h.sectionId)??b.find(y=>y.section.logicalSectionId===h.sectionId&&qt({x:h.x,y:h.y},y.outline,y.section.holes)):void 0,d=p?[p]:b;for(let y of d){if(e&&y.floorIndex!==e[u]||!p&&(h.x<y.box.minX||h.x>y.box.maxX||h.y<y.box.minY||h.y>y.box.maxY||!qt({x:h.x,y:h.y},y.outline,y.section.holes)))continue;o[u]=y.id;let x=l.get(y.id);x.hasSeats=!0;let w=h.focalPoint??y.unit.focal,A=Math.hypot(h.x-w.x,h.y-w.y);A<x.frontU&&(x.frontU=A),x.seatIndices.push(u);let E=h.rowId||`__seat-${u}`,M=x.rows.get(E);M?M.push({x:h.x,y:h.y}):x.rows.set(E,[{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,d=b.rake>0?Math.tan(b.rake*Math.PI/180):0,y=b.rake<=.01&&b.height<=p+.001,x=h.section.surfaceKind,w=x==="flat"?!0:x==="rakedRows"&&b.rake>.01?!1:y,A=h.hasSeats?yn(u,n,h.seatIndices,h.unit.focal):{sectionId:u,rows:[],blockCount:0},M=A.rows.length<2?Pn([...h.rows.values()].map(R=>({points:R})),h.unit.focal):null,I=1/0;if(M){if(h.hasSeats)for(let R of h.rows.values())for(let T of R){let C=M.depthAt(T.x,T.y);C<I&&(I=C)}if(!h.hasSeats||!Number.isFinite(I)){I=1/0;for(let R of h.section.outline){let T=M.depthAt(R.x,R.y);T<I&&(I=T)}}}let B=p+Oo,k=Math.max(B,b.height),D=R=>{let T=Math.max(0,R-I)*ut,C=Math.min(T*d,ln);return Math.max(B,b.height+C)},U=R=>{let T=Math.max(0,R)*ut,C=Math.min(T*d,ln);return Math.max(B,b.height+C)},S=w?[]:A.rows.map(R=>({pts:R.pts,y:U(R.blockDepth),depth:R.blockDepth,blockId:R.blockId,...f.has(R.id)?{patch:Nn(R.pts,ot)}:{}})),_=S.length?S[0].y:k,N=S.map(R=>{let T=R.patch&&R.patch.length>=3?R.patch:R.pts,C=0,v=0;for(let L of T)C+=L.x,v+=L.y;let G=T.length||1;C/=G,v/=G;let X=0;for(let L of T){let Y=Math.hypot(L.x-C,L.y-v);Y>X&&(X=Y)}return{cx:C,cy:v,rad:X}}),O=w?()=>k:S.length>=2?(R,T)=>{let C=1/0,v=_;for(let G=0;G<S.length;G++){let X=N[G];if(Math.hypot(R-X.cx,T-X.cy)-X.rad>=C)continue;let L=S[G].patch,Y=L&&L.length>=3?It(L,R,T)?0:Dt(L,R,T):Dt(S[G].pts,R,T);Y<C&&(C=Y,v=S[G].y)}return v}:(R,T)=>M?D(M.depthAt(R,T)):k,P=[0,1,0],F=S.length>=2||w?()=>P:(R,T)=>{if(!M)return P;let C=M.depthAt(R,T);if(C<=I)return P;let v=(C-I)*ut;if(v*d>=ln||b.height+v*d<=B)return P;let[G,X]=M.gradientAt(R,T);if(G===0&&X===0)return P;let L=1/Math.hypot(d,1);return[-G*d*L,L,-X*d*L]};if(!w)for(let R of A.rows){let T=U(R.blockDepth);for(let C of R.seatIndices)i[C]=T}for(let R of A.rows){let T=[];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&&T.push(Y)}T.sort((L,Y)=>L-Y);let C=T.length?T[Math.floor(T.length/2)]:1/0,v=1/0,G=R.pts[Math.floor(R.pts.length/2)];if(G)for(let L of A.rows){if(L===R||L.blockId!==R.blockId)continue;let Y=Dt(L.pts,G.x,G.y);Y>1e-6&&Y<v&&(v=Y)}let X=Math.min(C,Math.max(v,C*.5));if(Number.isFinite(X)&&X>0)for(let L of R.seatIndices)s[L]=X}r.set(u,{sectionId:u,deckAt:O,normalAt:F,flat:w,bottomY:p,rowLevels:S,landingY:_})}for(let u=0;u<n.length;u++){let h=o[u],b=n[u];if(h){let d=i[u];a[u]=(d??r.get(h).deckAt(b.x,b.y))+Lo;continue}let p=b.eyeHeightM;a[u]=Number.isFinite(p)?Math.max(0,p-Gt):0}return{bySection:r,seatOwner:o,seatDeckY:u=>a[u],seatPitchU:u=>s[u]}}var Go=.25,Do=1.2,No=.6,Xo=.45,Uo=2.3,Yo=Math.PI/180;function pt(t,n,e){let r=e*Yo;return{x:t.x+n*Math.sin(r),y:t.y+n*Math.cos(r)}}function jo(t,n){let e=n.rings[n.rings.length-1];if(!e)return!1;let r=e.outerRMedian*.85;for(let o of t){if(o.role!=="wall")continue;let a=o.points&&o.points.length>=2?o.points:o.x!==void 0&&o.y!==void 0&&o.width!==void 0&&o.height!==void 0?[{x:o.x,y:o.y},{x:o.x+o.width,y:o.y},{x:o.x+o.width,y:o.y+o.height},{x:o.x,y:o.y+o.height}]:[];if(a.length<2)continue;let i=0;for(let s of a)Math.hypot(s.x-n.centre.x,s.y-n.centre.y)>=r&&i++;if(i>=a.length/2)return!0}return!1}var Ho=24;function Vo(t,n,e,r,o,a,i,s){let l=e.binCount,c=Ho,f=ut,m=a+.02,u=[];for(let S=0;S<l;S++){let _=(e.startBin+S+.5)*n.binStepDeg,N=new Float64Array(c+1);for(let O=0;O<=c;O++){let P=r[S]+(o[S]-r[S])*O/c;N[O]=Math.max(m,wn(n,e,_,P)-Go)}u.push(N)}let h=[i.bandTop[0]*s.top,i.bandTop[1]*s.top,i.bandTop[2]*s.top],b=[i.bandTop[0]*s.bottomCap,i.bandTop[1]*s.bottomCap,i.bandTop[2]*s.bottomCap],p=[i.bandWall[0]*s.top,i.bandWall[1]*s.top,i.bandWall[2]*s.top],d=[i.bandWall[0]*s.wallBottom,i.bandWall[1]*s.wallBottom,i.bandWall[2]*s.wallBottom],y=(S,_)=>{let N=(e.startBin+S+.5)*n.binStepDeg,O=r[S]+(o[S]-r[S])*_/c,P=pt(n.centre,O,N);return[P.x*f,u[S][_],P.y*f]};{let S=Math.tan(12*Math.PI/180);for(let _=0;_<6;_++){let N=!1;for(let P=0;P<l;P++)for(let F=c-1;F>=0;F--)u[P][F]>u[P][F+1]&&(u[P][F]=u[P][F+1],N=!0);let O=e.closed?l:l-1;for(let P=0;P<O;P++){let F=(P+1)%l;for(let R=0;R<=c;R++){let T=u[F][R]-u[P][R];if(Math.abs(T)>1)continue;let C=r[P]+(o[P]-r[P])*R/c,v=r[F]+(o[F]-r[F])*R/c,G=pt(n.centre,C,(e.startBin+P+.5)*n.binStepDeg),X=pt(n.centre,v,(e.startBin+F+.5)*n.binStepDeg),L=S*Math.hypot(X.x-G.x,X.y-G.y)*f;T>L?(u[F][R]=u[P][R]+L,N=!0):-T>L&&(u[P][R]=u[F][R]+L,N=!0)}}if(!N)break}}let x=1,w=(S,_)=>{for(let N=0;N<=c;N+=4)if(Math.abs(u[S][N]-u[_][N])>x)return!0;return Math.abs(u[S][c]-u[_][c])>x},A=Math.tan(38*Math.PI/180),E=S=>(o[S]-r[S])/c*f,M=(S,_)=>u[S][_+1]-u[S][_]>A*Math.max(1e-6,E(S)),I=(S,_)=>{let N=e.closed?(S-1+l)%l:Math.max(0,S-1),O=e.closed?(S+1)%l:Math.min(l-1,S+1);Math.abs(u[N][_]-u[S][_])>x&&(N=S),Math.abs(u[O][_]-u[S][_])>x&&(O=S);let P=Math.max(0,_-1),F=Math.min(c,_+1);P<_&&M(S,P)&&(P=_),F>_&&M(S,_)&&(F=_);let R=y(N,_),T=y(O,_),C=y(S,P),v=y(S,F),G=T[0]-R[0],X=T[1]-R[1],L=T[2]-R[2],Y=v[0]-C[0],j=v[1]-C[1],$=v[2]-C[2],z=X*$-L*j,q=L*Y-G*$,tt=G*j-X*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]},B=(S,_)=>{let N=[S[0],a,S[2]],O=[_[0],a,_[2]],P=_[0]-S[0],F=_[2]-S[2],R=Math.hypot(P,F);if(!(R>1e-12))return;let T=[F/R,0,-P/R];t.tri(S,_,O,T,p,p,d),t.tri(S,O,N,T,p,d,d)},k=.05*lt,D=S=>o[S]-r[S]<k,U=e.closed?l:l-1;for(let S=0;S<U;S++){let _=(S+1)%l;if(D(S)||D(_))continue;if(w(S,_)){let T=(e.startBin+S+1)*n.binStepDeg,C=(j,$)=>{let z=(r[S]+r[_])/2,q=(o[S]+o[_])/2,tt=z+(q-z)*$/c,Z=pt(n.centre,tt,T);return[Z.x*f,u[j][$],Z.y*f]};for(let j=0;j<c;j++){let $=y(S,j),z=y(S,j+1),q=C(S,j),tt=C(S,j+1),Z=I(S,j),it=I(S,j+1);t.triN($,q,tt,Z,Z,it,h),t.triN($,tt,z,Z,it,it,h);let vt=y(_,j),kt=y(_,j+1),dt=C(_,j),St=C(_,j+1),yt=I(_,j),xt=I(_,j+1);t.triN(dt,vt,kt,yt,yt,xt,h),t.triN(dt,kt,St,yt,xt,xt,h);let ct=C(S,j),rt=C(S,j+1),Ot=C(_,j+1),Kt=C(_,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 v=y(S,0),G=y(_,0),X=y(_,c),L=y(S,c),Y=j=>[j[0],a,j[2]];t.tri(Y(v),Y(X),Y(G),[0,-1,0],b),t.tri(Y(v),Y(L),Y(X),[0,-1,0],b),B(v,G),B(L,X);continue}for(let T=0;T<c;T++){let C=I(S,T),v=I(_,T),G=I(_,T+1),X=I(S,T+1);if(M(S,T)||M(_,T)){let z=(rt,Ot)=>{let Kt=(e.startBin+rt+.5)*n.binStepDeg,Lt=r[rt]+(o[rt]-r[rt])*(T+.5)/c,Rt=pt(n.centre,Lt,Kt);return[Rt.x*f,Ot,Rt.y*f]},q=y(S,T),tt=y(_,T),Z=z(S,u[S][T]),it=z(_,u[_][T]);t.triN(q,tt,it,C,v,v,h),t.triN(q,it,Z,C,v,C,h);let vt=y(_,T+1),kt=y(S,T+1),dt=z(S,u[S][T+1]),St=z(_,u[_][T+1]);t.triN(dt,St,vt,X,G,G,h),t.triN(dt,vt,kt,X,G,X,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=y(S,T),Y=y(_,T),j=y(_,T+1),$=y(S,T+1);t.triN(L,Y,j,C,v,G,h),t.triN(L,j,$,C,G,X,h)}let N=y(S,0),O=y(_,0),P=y(_,c),F=y(S,c),R=T=>[T[0],a,T[2]];t.tri(R(N),R(P),R(O),[0,-1,0],b),t.tri(R(N),R(F),R(P),[0,-1,0],b),B(N,O),B(F,P)}if(!e.closed)for(let S of[0,l-1])for(let _=0;_<c;_++)B(y(S,_),y(S,_+1))}function he(t,n,e){let{bottomY:r,colors:o,ao:a}=e,i=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 d=(m.startBin+p)%n.binCount,y=Math.max(0,m.innerR[p]-ot);u[p]=Math.max(y,i[d]+.001),h[p]=Math.max(u[p]+.001,m.outerR[p]+ot)}let b=0;for(let p=0;p<m.binCount;p++){let d=m.topLevelM[p]-r;d>b&&(b=d)}b>=Do&&Vo(t,n,m,u,h,r,o,a);for(let p=0;p<m.binCount;p++){let d=(m.startBin+p)%n.binCount;h[p]>i[d]&&(i[d]=h[p])}}if(e.deriveShell===!1||jo(e.shapes,n))return;let s=n.rings[n.rings.length-1],l=No*lt,c=Xo*lt;for(let f of s.arcs){let m=[],u=[];for(let p=0;p<f.binCount;p++){let d=(f.startBin+p+.5)*n.binStepDeg,y=f.outerR[p]+ot+l;m.push(pt(n.centre,y,d)),u.push(pt(n.centre,y+c,d))}let h=-1/0;for(let p=0;p<f.binCount;p++)f.topLevelM[p]>h&&(h=f.topLevelM[p]);let b=()=>h+Uo;f.closed?K(t,u,[m.slice().reverse()],b,r,o.shellTop,o.shellWall,a):K(t,[...u,...m.slice().reverse()],void 0,b,r,o.shellTop,o.shellWall,a)}}function be(t,n,e,r,o,a,i,s){if(!n.outline||n.outline.length<3)return;let l=e.baseHeightM,c=st(r,s.tierTop);if(!o)return;let f=d=>o.deckAt(d.x,d.y),m=Kn(n,i),u=m[0]??n.outline;if(o.rowLevels.length>=2){let d=Wt(o.rowLevels),y=$n(jn(o.rowLevels,e.focal,d),m),x=()=>[0,1,0];for(let A of y){let E=Math.max(l,A.topY-.02);for(let M of a.subtract(A.outline,E))K(t,M,A.holes,()=>E,l,c,s.tierWall,W,void 0,x)}y.length||K(t,u,n.holes,()=>o.landingY,l,c,s.tierWall,W);let w={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 A of m.length?m:[u])Vn(t,o.rowLevels,e.focal,o.landingY,w,A,d);return}let h=o.flat?1/0:me,b=d=>o.normalAt(d.x,d.y),p=o.flat?o.landingY:void 0;for(let d of a.subtract(u,p))K(t,d,n.holes,f,l,c,s.tierWall,W,h,b)}function Wo(t,n,e){let r=new Set;for(let i of t.objects)i.type==="section"&&r.add(i.id);let o=new Map;for(let i=0;i<n.length;i++){let s=e.seatOwner[i];if(!s||!r.has(s))continue;let l=e.bySection.get(s);if(l&&l.rowLevels.length>=2)continue;let c=n[i],f=o.get(s);f||(f=new Map,o.set(s,f));let m=c.rowId||`__seat-${i}`,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(i),u.n++}let a=[];for(let i of t.objects){if(i.type!=="section")continue;let s=e.bySection.get(i.id);if(s&&s.rowLevels.length>=2){let c=s.rowLevels.filter(f=>!f.patch).map(f=>({pts:f.pts,levelM:f.y}));c.length>=2&&a.push({sectionId:i.id,rows:c});continue}let l=o.get(i.id);l&&a.push({sectionId:i.id,rows:[...l.values()].map(c=>({pts:c.pts,levelM:c.levelM/c.n}))})}return a}function pe(t,n,e,r,o,a,i=!0){let s=Wo(n,e,r);if(!s.length)return;let l=In(s,n.focal);l&&(t.setMaterial(0),he(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:i}))}function de(t){let{doc:n,units:e,seats:r,surfaces:o,solids:a,hintedSeatFloor:i,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<r.length;u++){let h=o.seatOwner[u],b=(h!==null?f.get(h):void 0)??i[u];if(b===void 0)continue;let p=m[b],d=r[u];p.n++,d.x<p.minX&&(p.minX=d.x),d.y<p.minY&&(p.minY=d.y),d.x>p.maxX&&(p.maxX=d.x),d.y>p.maxY&&(p.maxY=d.y);let y=o.seatDeckY(u);p.sumX+=d.x*g,p.sumDeck+=y,p.sumZ+=d.y*g,p.minDeck=Math.min(p.minDeck,y),p.maxDeck=Math.max(p.maxDeck,y+1.6),s[u]=b}for(let u=0;u<e.length;u++){let h=m[u],b=n.floors?.[u],p=c[u],d=Math.min(h.n?h.minX*g:e[u].focal.x*g-1,Number.isFinite(p.minX)?p.minX:1/0),y=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),w=Math.max(h.n?h.maxY*g:e[u].focal.y*g+1,Number.isFinite(p.maxZ)?p.maxZ:-1/0),A=Math.min(h.n?Math.min(e[u].baseHeightM,h.minDeck):e[u].baseHeightM,Number.isFinite(p.minY)?p.minY:1/0),E=Math.max(h.n?Math.max(h.maxDeck,A+.5):A+.5,Number.isFinite(p.maxY)?p.maxY:-1/0),M=[h.n?h.sumX/h.n:(d+y)/2,h.n?h.sumDeck/h.n:(A+E)/2,h.n?h.sumZ/h.n:(x+w)/2],I=Math.max(1,.5*Math.hypot(y-d,E-A,w-x));l.push({index:u,id:b?.id??`floor-${u}`,label:b?.name??(e.length>1?`Floor ${u+1}`:"Venue"),seatCount:h.n,center:M,radius:I,box:{min:[d,A,x],max:[y,E,w]},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,r=1/0,o=-1/0,a=-1/0,i=(s,l)=>{s<e&&(e=s),l<r&&(r=l),s>o&&(o=s),l>a&&(a=l)};for(let s of n)i(s.x,s.y);for(let s of t)for(let l of s.objects)if(l.type==="section")for(let c of l.outline)i(c.x,c.y);else if(l.type==="shape"&&l.points)for(let c of l.points)i(c.x,c.y);else if(l.type==="gaArea")for(let c of l.points)i(c.x,c.y);else if(l.type==="booth"){let c=Ft(l);if(c)for(let f of c)i(f.x,f.y)}else if(l.type==="table"){let c=cn(l);if(c)for(let f of c)i(f.x,f.y)}else if(l.type==="decorImage"){let c=un(l);if(c)for(let f of c)i(f.x,f.y)}return Number.isFinite(e)||(e=-100,r=-100,o=100,a=100),{minX:e,minY:r,maxX:o,maxY:a}}function ye(t,n,e,r,o,a){if(n.length===1){let i=Math.max(60,(o.maxX-o.minX+o.maxY-o.minY)*.06),s=Tt(o.minX-i,o.minY-i,o.maxX-o.minX+i*2,o.maxY-o.minY+i*2);K(t,s,void 0,()=>0,-.4,a.ground,a.ground,W)}else{let i=n.reduce((h,b)=>b.baseHeightM<h.baseHeightM?b:h);t.setFloor(i.index);let s=e.filter((h,b)=>r[b]===i.index),l=mn([i],s),c=Math.hypot(l.maxX-l.minX,l.maxY-l.minY),f=Math.max(28,Math.min(80,c*.04)),m=Tt(l.minX-f,l.minY-f,l.maxX-l.minX+f*2,l.maxY-l.minY+f*2),u=i.baseHeightM-.03;K(t,m,void 0,()=>u,u-.22,a.ground,a.ground,W)}}function xe(t,n,e){let{cx:r,cz:o,radius:a}=e,i=1/0,s=1/0,l=1/0,c=-1/0,f=-1/0,m=-1/0,u=(p,d,y)=>{i=Math.min(i,p),c=Math.max(c,p),s=Math.min(s,d),f=Math.max(f,d),l=Math.min(l,y),m=Math.max(m,y)};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 d=p*3,y=n.iPosition[d],x=n.iPosition[d+1],w=n.iPosition[d+2],A=Math.max(.35,n.iMaxRadius[p]??.35);u(y-A,x,w-A),u(y+A,x+1.6,w+A)}Number.isFinite(i)||(i=r-a,c=r+a,s=0,f=a*.16,l=o-a,m=o+a);let h=[(i+c)/2,(s+f)/2,(l+m)/2],b=Math.max(1,.5*Math.hypot(c-i,f-s,m-l));return{center:h,radius:b,minY:s,maxY:f}}function ge(t,n,e,r,o,a){let i=1/0,s=1/0,l=-1/0,c=-1/0;for(let A=0;A<t.count;A++){let E=A*3,M=t.iPosition[E],I=t.iPosition[E+2];M<i&&(i=M),M>l&&(l=M),I<s&&(s=I),I>c&&(c=I)}for(let A of n)i=Math.min(i,A.cx-A.halfX),l=Math.max(l,A.cx+A.halfX),s=Math.min(s,A.cz-A.halfZ),c=Math.max(c,A.cz+A.halfZ);let f=e.minX*g,m=e.maxX*g,u=e.minY*g,h=e.maxY*g,b=f,p=m,d=u,y=h;if(Number.isFinite(i)){let A=Math.max(2,.06*Math.hypot(l-i,c-s));b=Math.max(f,i-A),p=Math.min(m,l+A),d=Math.max(u,s-A),y=Math.min(h,c+A)}let x=Math.min(0,r),w=Math.max(o,a*.05);return{min:[b,x,d],max:[p,w,y]}}function Me(t,n,e){let r=()=>({byObjectId:new Map,elements:[]});if(!n||!t)return r();let o=bn(n);if(!o.ok||o.value.id!==t)return r();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 i=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||i.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 r();i.add(m.id),s.add(m.objectId);let p=h.map(B=>B.x*g),d=h.map(B=>B.y*g),y=u.unit.baseHeightM+b,x=Math.min(...p),w=Math.max(...p),A=Math.min(...d),E=Math.max(...d),M,I=l.get(m.id)??m.contentImageUrl;if(m.kind==="screen"&&I)if(w-x>=E-A){let B=Math.abs(A-u.unit.focal.y*g)<=Math.abs(E-u.unit.focal.y*g)?A-.006:E+.006;M=[[x,y,B],[w,y,B],[x,y+m.heightM,B],[w,y+m.heightM,B]]}else{let B=Math.abs(x-u.unit.focal.x*g)<=Math.abs(w-u.unit.focal.x*g)?x-.006:w+.006;M=[[B,y,A],[B,y,E],[B,y+m.heightM,A],[B,y+m.heightM,E]]}c.push({id:m.id,objectId:m.objectId,kind:m.kind,floorIndex:u.unit.index,baseY:y,topY:y+m.heightM,bounds:{min:[x,y,A],max:[w,y+m.heightM,E]},occlusion:m.occlusion,...I?{contentImageUrl:I}:{},...M?{contentPlane:M}:{}})}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 zo(t){let n=[t];for(;n.length;){let e=n.pop();if(Array.isArray(e)){n.push(...e);continue}if(!Q(e))continue;let r=Q(e.extensions)?e.extensions:null;if(r&&Object.prototype.hasOwnProperty.call(r,"KHR_draco_mesh_compression"))return!0;n.push(...Object.values(e))}return!1}function Zt(t,n){return!Array.isArray(t)||t.length!==n||!t.every(e=>typeof e=="number"&&Number.isFinite(e))?null:t}function Zo(){return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}function Ko(t,n){let e=new Array(16).fill(0);for(let r=0;r<4;r++)for(let o=0;o<4;o++)for(let a=0;a<4;a++)e[r*4+o]+=t[a*4+o]*n[r*4+a];return e}function $o(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),r=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||!r||!o)return null;let[a,i,s,l]=r,c=Math.hypot(a,i,s,l);if(!(c>1e-8))return null;let f=a/c,m=i/c,u=s/c,h=l/c,b=f+f,p=m+m,d=u+u,y=f*b,x=f*p,w=f*d,A=m*p,E=m*d,M=u*d,I=h*b,B=h*p,k=h*d;return[(1-(A+M))*o[0],(x+k)*o[0],(w-B)*o[0],0,(x-k)*o[1],(1-(y+M))*o[1],(E+I)*o[1],0,(w+B)*o[2],(E-I)*o[2],(1-(y+A))*o[2],0,e[0],e[1],e[2],1]}function qo(t,n,e,r){return[t[0]*n+t[4]*e+t[8]*r+t[12],t[1]*n+t[5]*e+t[9]*r+t[13],t[2]*n+t[6]*e+t[10]*r+t[14]]}function Jo(t){let n=t[0],e=t[4],r=t[8],o=t[1],a=t[5],i=t[9],s=t[2],l=t[6],c=t[10],f=a*c-i*l,m=i*s-o*c,u=o*l-a*s,h=n*f+e*m+r*u;if(Math.abs(h)<1e-12)return null;let b=1/h;return[f*b,m*b,u*b,(r*l-e*c)*b,(n*c-r*s)*b,(e*s-n*l)*b,(e*i-r*a)*b,(r*o-n*i)*b,(n*a-e*o)*b]}function Se(t,n,e,r){let o=t[0]*n+t[1]*e+t[2]*r,a=t[3]*n+t[4]*e+t[5]*r,i=t[6]*n+t[7]*e+t[8]*r,s=Math.hypot(o,a,i)||1;return o/=s,a/=s,i/=s,[o,a,i]}function Qo(t){if(t.byteLength<20||t.byteLength>8388608)return null;let n=new DataView(t.buffer,t.byteOffset,t.byteLength);if(n.getUint32(0,!0)!==1179937895||n.getUint32(4,!0)!==2||n.getUint32(8,!0)!==t.byteLength)return null;let e=12,r=null,o=null;for(;e+8<=t.byteLength;){let a=n.getUint32(e,!0),i=n.getUint32(e+4,!0);if(e+=8,a%4!==0||e+a>t.byteLength)return null;let s=t.subarray(e,e+a);if(i===1313821514&&!r)try{let l=JSON.parse(new TextDecoder().decode(s).replace(/[\u0000 ]+$/g,""));if(!Q(l))return null;r=l}catch{return null}else if(i===5130562&&!o)o=s;else return null;e+=a}return e===t.byteLength&&r&&o?{json:r,bin:o}:null}function tr(t){return t===5120||t===5121?1:t===5122||t===5123?2:t===5125||t===5126?4:0}function nr(t){return t==="SCALAR"?1:t==="VEC2"?2:t==="VEC3"?3:t==="VEC4"?4:0}function er(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 or(t){let n=t instanceof Uint8Array?t:new Uint8Array(t),e=Qo(n);if(!e)return{ok:!1,issue:"invalid_glb"};let{json:r,bin:o}=e;if(!Q(r.asset)||r.asset.version!=="2.0")return{ok:!1,issue:"unsupported_glb"};let a=J(r.extensionsUsed).filter(A=>typeof A=="string");if(a.includes("KHR_draco_mesh_compression")||zo(r))return{ok:!1,issue:"draco_not_allowed"};if(a.length||J(r.extensionsRequired).length)return{ok:!1,issue:"unsupported_glb"};if(J(r.images).length||J(r.textures).length)return{ok:!1,issue:"external_resource"};let i=J(r.buffers);if(i.length!==1||!Q(i[0])||i[0].uri!==void 0||typeof i[0].byteLength!="number"||!Number.isInteger(i[0].byteLength)||i[0].byteLength<0||i[0].byteLength>o.byteLength)return{ok:!1,issue:"external_resource"};let s=J(r.accessors),l=J(r.bufferViews),c=J(r.meshes),f=J(r.nodes),m=J(r.scenes),u=typeof r.scene=="number"?r.scene:0;if(!Q(m[u]))return{ok:!1,issue:"unsupported_glb"};let h=new DataView(o.buffer,o.byteOffset,o.byteLength),b=(A,E,M)=>{if(typeof A!="number"||!Number.isInteger(A)||!Q(s[A]))return null;let I=s[A];if(I.type!==E||I.sparse!==void 0||I.normalized===!0||typeof I.count!="number"||!Number.isInteger(I.count)||I.count<1||typeof I.componentType!="number"||!M.includes(I.componentType)||typeof I.bufferView!="number")return null;let B=l[I.bufferView];if(!Q(B)||B.buffer!==0||typeof B.byteLength!="number"||!Number.isInteger(B.byteLength)||B.byteLength<0)return null;let k=nr(I.type),D=tr(I.componentType),U=typeof B.byteStride=="number"?B.byteStride:k*D,S=typeof B.byteOffset=="number"?B.byteOffset:0,_=typeof I.byteOffset=="number"?I.byteOffset:0,N=S+_,O=_+(I.count-1)*U+k*D;if(!Number.isInteger(U)||!Number.isInteger(S)||!Number.isInteger(_)||U<k*D||S<0||_<0||S+B.byteLength>o.byteLength||O>B.byteLength)return null;let P=[];for(let F=0;F<I.count;F++){let R=[];for(let T=0;T<k;T++){let C=er(h,N+F*U+T*D,I.componentType);if(!Number.isFinite(C))return null;R.push(C)}P.push(R)}return P},p=[],d=[],y=0,x=new Set,w=(A,E)=>{if(typeof A!="number"||!Number.isInteger(A)||!Q(f[A])||x.has(A))return!1;x.add(A);let M=f[A],I=$o(M);if(!I)return!1;let B=Ko(E,I),k=Jo(B);if(!k)return!1;if(M.mesh!==void 0){if(typeof M.mesh!="number")return!1;let D=c[M.mesh];if(!Q(D))return!1;for(let U of J(D.primitives)){if(!Q(U)||U.mode!==void 0&&U.mode!==4||!Q(U.attributes))return!1;let S=b(U.attributes.POSITION,"VEC3",[5126]),_=U.attributes.NORMAL===void 0?null:b(U.attributes.NORMAL,"VEC3",[5126]);if(!S||U.attributes.NORMAL!==void 0&&!_)return!1;let N=S.length;if(U.indices!==void 0){let P=typeof U.indices=="number"?s[U.indices]:null;N=Q(P)?P.count:void 0}if(typeof N!="number"||!Number.isInteger(N)||N%3!==0||(y+=N/3,y>1e5))return!1;let O=U.indices===void 0?S.map((P,F)=>[F]):b(U.indices,"SCALAR",[5121,5123,5125]);if(!O||O.length%3!==0||O.length!==N)return!1;for(let P=0;P<O.length;P+=3){let F=[O[P][0],O[P+1][0],O[P+2][0]];if(F.some(C=>!Number.isInteger(C)||C<0||C>=S.length))return!1;let R=F.map(C=>qo(B,...S[C])),T=null;if(!_){let C=R[1][0]-R[0][0],v=R[1][1]-R[0][1],G=R[1][2]-R[0][2],X=R[2][0]-R[0][0],L=R[2][1]-R[0][1],Y=R[2][2]-R[0][2];T=Se([1,0,0,0,1,0,0,0,1],v*Y-G*L,G*X-C*Y,C*L-v*X)}for(let C=0;C<3;C++)p.push(...R[C]),d.push(..._?Se(k,..._[F[C]]):T)}}}for(let D of J(M.children))if(!w(D,B))return!1;return x.delete(A),!0};for(let A of J(m[u].nodes))if(!w(A,Zo()))return{ok:!1,issue:y>1e5?"triangle_limit":"unsupported_glb"};return!y||p.length!==y*9||d.length!==p.length?{ok:!1,issue:"unsupported_glb"}:{ok:!0,triangleCount:y,position:new Float32Array(p),normal:new Float32Array(d)}}function Re(t){try{return or(t)}catch{return{ok:!1,issue:"invalid_glb"}}}function As(t){let{doc:n}=t,e=ue(n.theme),r=e.structure,o=Zn(n,t.eventConfigurationId??n.eventConfigurationId),a=Me(t.eventConfigurationId,t.eventConfiguration,o),i=t.seats,s=new Yt,l=null;if(t.registeredShellGlb){let P=Re(t.registeredShellGlb);if(P.ok){let F=P.position.length/3,R=new Float32Array(P.position.length),T=e.materials.shell??r.tierWall;for(let C=0;C<F;C++){let v=P.normal[C*3+1],G=v<-.25?.4:.62+.38*Math.max(0,v);R[C*3]=T[0]*G,R[C*3+1]=T[1]*G,R[C*3+2]=T[2]*G}l={position:P.position,normal:P.normal,color:R,floor:new Float32Array(F).fill(-2),material:new Float32Array(F),count:F}}}let c=new Map;for(let P of o)for(let F of P.objects)c.set(F.id,P.index),F.type==="section"&&c.set(F.logicalSectionId??F.id,P.index);let f=i.map(P=>c.get(P.sectionId??"")??c.get(P.rowId??"")??0),m=mn(o,i);ye(s,o,i,f,m,r);let u=vn(n,i),h=new Map,b=new Map;for(let P of n.categories??[])h.set(P.key,P.color),P.seatGlyph&&b.set(P.key,P.seatGlyph);let p=[],d=fe(o,i,f),y=new Float32Array(i.length),x=[];for(let P=0;P<o.length;P++){let F=o[P];s.setFloor(P);let R=new zt,T=[],C=F.objects.filter(v=>v.type==="section"&&!!v.outline&&v.outline.length>=3);for(let v of F.objects)if(v.type==="section"){let G=s.vertexCount;be(s,v,F,kn(v,u),d.bySection.get(v.id),R,C,r);let X=s.vertexCount-G;X>0&&x.push({sectionId:v.id,start:G,count:X})}else if(v.type==="shape"){let G=a.byObjectId.get(v.id);s.setMaterial((G?.kind??v.role)==="screen"?1:0),ee(s,v,F.baseHeightM,qn(v,T),r,F.focal,p,G),s.setMaterial(0)}else v.type==="gaArea"?re(s,v,F.baseHeightM,H(h.get(v.categoryKey)),r):v.type==="booth"?te(s,v,F.baseHeightM,H(h.get(v.categoryKey)),r):v.type==="table"?ne(s,v,F.baseHeightM,H(v.fill??n.theme?.decorFill??"#232c40"),r):v.type==="decorImage"&&oe(s,v,F.baseHeightM,r);pe(s,F,i,d,r,e.materials.shell,!l)}let w=o.length>1?{x:o.reduce((P,F)=>P+F.focal.x,0)/o.length,y:o.reduce((P,F)=>P+F.focal.y,0)/o.length}:n.focalPoint??{x:(m.minX+m.maxX)/2,y:(m.minY+m.maxY)/2},A=Tn(l?[s.build(),l]:[s.build()]),E=Fn(i,t.initialState,d,y,h,b),M=se({doc:n,units:o,seats:i,surfaces:d,focal:w}),{labels:I,sections:B,rows:k}=ae({doc:n,units:o,seats:i,surfaces:d,seatData:E,hintedSeatFloor:f,zones:M,focal:w}),D=de({doc:n,units:o,seats:i,surfaces:d,solids:A,hintedSeatFloor:f,seatFloor:y});ce(I,D),E.iYaw=Cn(E.iPosition,i.length,P=>i[P].rowId,P=>{let F=o[y[P]]?.focal??w;return[F.x*g,F.y*g]});let U=(m.minX+m.maxX)/2*g,S=(m.minY+m.maxY)/2*g,_=.5*Math.hypot((m.maxX-m.minX)*g,(m.maxY-m.minY)*g)||10,N=xe(A,E,{cx:U,cz:S,radius:_}),O=ge(E,p,m,N.minY,N.maxY,_);return{solids:A,sectionSolidRanges:x,seats:E,bounds:{center:[(O.min[0]+O.max[0])/2,(O.min[1]+O.max[1])/2,(O.min[2]+O.max[2])/2],radius:_,groundY:0,box:O},renderBounds:{center:N.center,radius:N.radius},stateColorLUT:le(e,Bt),theme:e,seatCount:i.length,focalWorld:[w.x*g,1.5,w.y*g],zones:M,stages:p,productionElements:a.elements,sections:B,rows:k,labels:I,floors:D}}export{Bt as a,Qt as b,mr as c,nn as d,g as e,hr as f,Ge as g,Ne as h,br as i,Vt as j,Ar as k,Pr as l,_r as m,Tr as n,Br as o,Er as p,Cr as q,Fr as r,vr as s,kr as t,Or as u,Lr as v,Bo as w,As as x};
@@ -1 +1 @@
1
- import{l as E}from"./chunk-5BMXWOE7.js";import{J as v,La as _,Oa as R}from"./chunk-E7TOTX6I.js";var T=.08,Y=.045;function L(t){return`__floor__:${encodeURIComponent(t)}`}function X(t,e,o){return{...t,objects:e,floors:void 0,...o?{focalPoint:o}:{},referenceImage:void 0,backgroundImage:void 0}}function j(t,e,o){let s=t.focalPoint??e.focalPoint;return s?s.x:o.x+o.width/2}function Q(t){let e=t.floors??[];if(!e.length)return[];let o=e.map(n=>R(X(t,n.objects,n.focalPoint),{freeText:"exclude"})),a=Math.max(1,...o.map(n=>n.width))*T,r=0;return e.map((n,c)=>{let h=o[c],u=r-(h.y+h.height);return r-=h.height+a,{floorId:n.id,label:n.name??n.id,level:c,levelBadge:c===0?"G":String(c),translation:{x:-j(n,t,h),y:u},bounds:h}})}function z(t,e,o,s){let a=e==="name"?t.label:t.levelBadge;if(!a)return[];let r=Math.max(1,o*Y),n=t.bounds.x+t.translation.x,c=t.bounds.y+t.translation.y+r*.4,h=`floor-level-${t.floorId}`,u={type:"text",id:`${h}-text`,text:a,position:{x:n,y:c},fontSize:r,rotation:0,color:s,bold:!0};if(e==="name")return[u];let x=r*.95;return[{type:"shape",id:`${h}-badge`,kind:"ellipse",x:n-x*.35,y:c-x*.3,width:x*2,height:x*2,fill:"transparent",stroke:{color:s,width:Math.max(1,r*.09)},opacity:.8},u]}function V(t,e={}){let o=t.floors;if(!o||o.length<2)return t;let s=Q(t),a=[];o.forEach((u,x)=>{let{x:y,y:S}=s[x].translation;for(let I of u.objects)x>0&&I.type==="shape"&&I.role==="stage"||a.push(_(I,y,S))});let r={...t,objects:a,floors:void 0},n=R(r,{freeText:"exclude"}),c=Math.max(1,n.width,n.height),h=t.theme?.textColor??"#94a3b8";for(let u of s)a.push(...z(u,e.labelStyle??"number",c,h));return{...r,objects:a,referenceImage:void 0,backgroundImage:void 0}}function W(t){if(!t.floors||t.floors.length<2)return t;let e=!t.zones?.length,o=new Set,s=t.floors.flatMap(r=>r.objects.flatMap(n=>{if(n.type==="shape"&&n.role==="stage"){let c=JSON.stringify([n.kind,n.x,n.y,n.width,n.height,n.points,n.rotation??0,n.label,n.heightM,n.eventConfigurationIds]);if(o.has(c))return[];o.add(c)}return e&&n.type==="section"?[{...n,zone:L(r.id)}]:[n]})),a=e?t.floors.map(r=>({id:L(r.id),label:r.name,focalPoint:{...r.focalPoint}})):t.zones;return{...t,objects:s,zones:a,floors:void 0,referenceImage:void 0,backgroundImage:E(t)}}function N(t){let e=t.floors;if(!e?.length)return null;let o=e.find(r=>r.objects.some(n=>n.type==="shape"&&n.role==="stage"));if(o)return o.id;let s=e[0],a=-1;for(let r of e){let n=R(X(t,r.objects,r.focalPoint),{freeText:"exclude"}),c=n.width*n.height;c>a&&(a=c,s=r)}return s.id}var U=640;function tt(t,e){return(t.floors?.length??0)<2?null:t.floorOverview==="combined"||!Number.isFinite(e)||e<=0||e>=U?"all":N(t)}var Z=9;function $(t){if(t.kind==="circle")return{hx:t.r,hy:t.r};let e=t.width/2,o=t.height/2,s=t.rotation??0;if(!s)return{hx:e,hy:o};let a=s*Math.PI/180,r=Math.abs(Math.cos(a)),n=Math.abs(Math.sin(a));return{hx:e*r+o*n,hy:e*n+o*r}}function q(t,e,o){let s=e-t.seat.x,a=o-t.seat.y;if(t.shape.kind==="circle")return s*s+a*a<=t.shape.r*t.shape.r;let r=t.shape.rotation??0,n=s,c=a;if(r){let h=-r*Math.PI/180,u=Math.cos(h),x=Math.sin(h);n=s*u-a*x,c=s*x+a*u}return Math.abs(n)<=t.shape.width/2&&Math.abs(c)<=t.shape.height/2}function G(t,e,o,s,a){if(t.shape.kind==="circle"){let f=Math.min(Math.max(t.seat.x,e),s),m=Math.min(Math.max(t.seat.y,o),a),d=t.seat.x-f,p=t.seat.y-m;return d*d+p*p<=t.shape.r*t.shape.r}let r=t.shape.rotation??0;if(!r)return t.seat.x-t.hx<=s&&t.seat.x+t.hx>=e&&t.seat.y-t.hy<=a&&t.seat.y+t.hy>=o;let n=r*Math.PI/180,c=Math.cos(n),h=Math.sin(n),u=t.shape.width/2,x=t.shape.height/2,y=[[-u,-x],[u,-x],[u,x],[-u,x]].map(([f,m])=>[t.seat.x+f*c-m*h,t.seat.y+f*h+m*c]),S=[[e,o],[s,o],[s,a],[e,a]],I=[[1,0],[0,1],[c,h],[-h,c]];for(let[f,m]of I){let d=1/0,p=-1/0;for(let[P,O]of y){let i=P*f+O*m;i<d&&(d=i),i>p&&(p=i)}let M=1/0,w=-1/0;for(let[P,O]of S){let i=P*f+O*m;i<M&&(M=i),i>w&&(w=i)}if(p<M||w<d)return!1}return!0}function ot(t,e={}){let o=e.seatRadius??Z,s=t.length,a=new Array(s),r=1/0,n=1/0,c=-1/0,h=-1/0,u=0;for(let i=0;i<s;i++){let l=t[i],D=e.shapeOf?.(l)??{kind:"circle",r:o},{hx:g,hy:b}=$(D);a[i]={seat:l,shape:D,hx:g,hy:b},l.x-g<r&&(r=l.x-g),l.y-b<n&&(n=l.y-b),l.x+g>c&&(c=l.x+g),l.y+b>h&&(h=l.y+b),g>u&&(u=g),b>u&&(u=b)}s===0&&(r=0,n=0,c=0,h=0);let x=u>0?u*4:1,y=Math.max(c-r,0),S=Math.max(h-n,0),I=Math.max(64,e.maxCells??s*4),f=x,m=Math.max(1,Math.ceil(y/f)||1),d=Math.max(1,Math.ceil(S/f)||1);for(;m*d>I&&(m>1||d>1);)f*=2,m=Math.max(1,Math.ceil(y/f)||1),d=Math.max(1,Math.ceil(S/f)||1);let p=m*d,M=new Int32Array(p+1),w=0;for(let i=0;i<s;i++){let l=a[i],D=v(Math.floor((l.seat.x-l.hx-r)/f),0,m-1),g=v(Math.floor((l.seat.x+l.hx-r)/f),0,m-1),b=v(Math.floor((l.seat.y-l.hy-n)/f),0,d-1),F=v(Math.floor((l.seat.y+l.hy-n)/f),0,d-1);for(let A=b;A<=F;A++)for(let C=D;C<=g;C++)M[A*m+C+1]++,w++}for(let i=0;i<p;i++)M[i+1]+=M[i];let P=new Int32Array(w),O=M.slice(0,p);for(let i=0;i<s;i++){let l=a[i],D=v(Math.floor((l.seat.x-l.hx-r)/f),0,m-1),g=v(Math.floor((l.seat.x+l.hx-r)/f),0,m-1),b=v(Math.floor((l.seat.y-l.hy-n)/f),0,d-1),F=v(Math.floor((l.seat.y+l.hy-n)/f),0,d-1);for(let A=b;A<=F;A++)for(let C=D;C<=g;C++){let k=A*m+C;P[O[k]++]=i}}return{seats:t,entries:a,minX:r,minY:n,cell:f,cols:m,rows:d,cellStart:M,items:P,stamp:new Int32Array(s),epoch:0}}function rt(t,e,o={}){let{cols:s,rows:a,cell:r,minX:n,minY:c,cellStart:h,items:u,entries:x}=t,y=Math.floor((e.x-n)/r),S=Math.floor((e.y-c)/r);if(y<0||S<0||y>=s||S>=a)return null;let I=S*s+y,f=h[I+1],m=-1,d=1/0;for(let p=h[I];p<f;p++){let M=u[p],w=x[M];if(o.filter&&!o.filter(w.seat.id,w.seat)||!q(w,e.x,e.y))continue;let P=e.x-w.seat.x,O=e.y-w.seat.y,i=P*P+O*O;(i<d||i===d&&M<m)&&(d=i,m=M)}return m<0?null:x[m].seat.id}function st(t,e,o,s={}){if(!(o>0))return null;let{cols:a,rows:r,cell:n,minX:c,minY:h,cellStart:u,items:x,entries:y}=t,S=Math.max(0,Math.floor((e.x-o-c)/n)),I=Math.min(a-1,Math.floor((e.x+o-c)/n)),f=Math.max(0,Math.floor((e.y-o-h)/n)),m=Math.min(r-1,Math.floor((e.y+o-h)/n));if(S>I||f>m)return null;let d=-1,p=o*o,M=t.stamp,w=++t.epoch;for(let P=f;P<=m;P++){let O=P*a;for(let i=S;i<=I;i++){let l=O+i,D=u[l+1];for(let g=u[l];g<D;g++){let b=x[g];if(M[b]===w)continue;M[b]=w;let F=y[b];if(s.filter&&!s.filter(F.seat.id,F.seat))continue;let A=e.x-F.seat.x,C=e.y-F.seat.y,k=A*A+C*C;(k<p||k===p&&b<d)&&(p=k,d=b)}}}return d<0?null:y[d].seat.id}function at(t,e,o={}){let s=Math.min(e.x,e.x+e.width),a=Math.max(e.x,e.x+e.width),r=Math.min(e.y,e.y+e.height),n=Math.max(e.y,e.y+e.height),c=o.mode??"center",{cols:h,rows:u,cell:x,minX:y,minY:S,cellStart:I,items:f,entries:m}=t,d=Math.max(0,Math.floor((s-y)/x)),p=Math.min(h-1,Math.floor((a-y)/x)),M=Math.max(0,Math.floor((r-S)/x)),w=Math.min(u-1,Math.floor((n-S)/x));if(d>p||M>w)return[];let P=[],O=t.stamp,i=++t.epoch;for(let l=M;l<=w;l++){let D=l*h;for(let g=d;g<=p;g++){let b=D+g,F=I[b+1];for(let A=I[b];A<F;A++){let C=f[A];if(O[C]===i)continue;O[C]=i;let k=m[C];if(o.filter&&!o.filter(k.seat.id,k.seat))continue;(c==="center"?k.seat.x>=s&&k.seat.x<=a&&k.seat.y>=r&&k.seat.y<=n:G(k,s,r,a,n))&&P.push(C)}}}return P.sort((l,D)=>l-D),P.map(l=>m[l].seat.id)}function ct(t){let e=t.cols*t.rows,o=0,s=0;for(let r=0;r<e;r++){let n=t.cellStart[r+1]-t.cellStart[r];n>0&&o++,n>s&&(s=n)}let a=t.items.length;return{cell:t.cell,cols:t.cols,rows:t.rows,cells:e,occupiedCells:o,refs:a,maxPerCell:s,meanPerOccupiedCell:o?a/o:0}}function lt(t,e=0){let o=Math.max(1,t.width,t.height),s={x:t.x+t.width/2,y:t.y+t.height/2},a=o*1.55,r=Math.max(o*.82,Math.max(0,e)+o*.45);return{target:s,distance:a,height:r,focalLength:Math.hypot(a,r),yawRad:-8*Math.PI/180}}function B(t,e,o=0){let s=e.x-t.target.x,a=e.y-t.target.y,r=Math.cos(t.yawRad),n=Math.sin(t.yawRad),c=s*r-a*n,u=s*n+a*r-t.distance,x=o-t.height,y=Math.hypot(t.distance,t.height),S=(-t.distance*u-t.height*x)/y,I=(-t.height*u+t.distance*x)/y,f=Math.max(y*.08,S),m=t.focalLength/f;return{x:t.target.x+c*m,y:t.target.y-I*m,depth:f,scale:m}}function ht(t,e){return{x:t.a*e.x+t.c*e.y+t.e,y:t.b*e.x+t.d*e.y+t.f}}function ut(t){let e=t.a*t.d-t.b*t.c;if(!Number.isFinite(e)||Math.abs(e)<1e-9)throw new Error("perspective projection produced a singular affine");let o=t.d/e,s=-t.b/e,a=-t.c/e,r=t.a/e;return{a:o,b:s,c:a,d:r,e:-(o*t.e+a*t.f),f:-(s*t.e+r*t.f)}}function mt(t,e){return{a:t.a*e.a+t.c*e.b,b:t.b*e.a+t.d*e.b,c:t.a*e.c+t.c*e.d,d:t.b*e.c+t.d*e.d,e:t.a*e.e+t.c*e.f+t.e,f:t.b*e.e+t.d*e.f+t.f}}function xt(t,e,o=()=>0){let s=B(t,e,o(e)),a={x:e.x+1,y:e.y},r={x:e.x,y:e.y+1},n=B(t,a,o(a)),c=B(t,r,o(r)),h=n.x-s.x,u=n.y-s.y,x=c.x-s.x,y=c.y-s.y;return{a:h,b:u,c:x,d:y,e:s.x-h*e.x-x*e.y,f:s.y-u*e.x-y*e.y}}function ft(t){let e=Math.hypot(t.a,t.b),o=t.a*t.d-t.b*t.c;return{rotationDeg:Math.atan2(t.b,t.a)*180/Math.PI,scaleX:e,scaleY:o/Math.max(e,1e-9),skewX:(t.a*t.c+t.b*t.d)/Math.max(o,1e-9)}}export{T as a,L as b,Q as c,V as d,W as e,N as f,U as g,tt as h,Z as i,ot as j,rt as k,st as l,at as m,ct as n,lt as o,B as p,ht as q,ut as r,mt as s,xt as t,ft as u};
1
+ import{l as E}from"./chunk-5BMXWOE7.js";import{J as v,La as _,Oa as R}from"./chunk-W4RS6OW7.js";var T=.08,Y=.045;function L(t){return`__floor__:${encodeURIComponent(t)}`}function X(t,e,o){return{...t,objects:e,floors:void 0,...o?{focalPoint:o}:{},referenceImage:void 0,backgroundImage:void 0}}function j(t,e,o){let s=t.focalPoint??e.focalPoint;return s?s.x:o.x+o.width/2}function Q(t){let e=t.floors??[];if(!e.length)return[];let o=e.map(n=>R(X(t,n.objects,n.focalPoint),{freeText:"exclude"})),a=Math.max(1,...o.map(n=>n.width))*T,r=0;return e.map((n,c)=>{let h=o[c],u=r-(h.y+h.height);return r-=h.height+a,{floorId:n.id,label:n.name??n.id,level:c,levelBadge:c===0?"G":String(c),translation:{x:-j(n,t,h),y:u},bounds:h}})}function z(t,e,o,s){let a=e==="name"?t.label:t.levelBadge;if(!a)return[];let r=Math.max(1,o*Y),n=t.bounds.x+t.translation.x,c=t.bounds.y+t.translation.y+r*.4,h=`floor-level-${t.floorId}`,u={type:"text",id:`${h}-text`,text:a,position:{x:n,y:c},fontSize:r,rotation:0,color:s,bold:!0};if(e==="name")return[u];let x=r*.95;return[{type:"shape",id:`${h}-badge`,kind:"ellipse",x:n-x*.35,y:c-x*.3,width:x*2,height:x*2,fill:"transparent",stroke:{color:s,width:Math.max(1,r*.09)},opacity:.8},u]}function V(t,e={}){let o=t.floors;if(!o||o.length<2)return t;let s=Q(t),a=[];o.forEach((u,x)=>{let{x:y,y:S}=s[x].translation;for(let I of u.objects)x>0&&I.type==="shape"&&I.role==="stage"||a.push(_(I,y,S))});let r={...t,objects:a,floors:void 0},n=R(r,{freeText:"exclude"}),c=Math.max(1,n.width,n.height),h=t.theme?.textColor??"#94a3b8";for(let u of s)a.push(...z(u,e.labelStyle??"number",c,h));return{...r,objects:a,referenceImage:void 0,backgroundImage:void 0}}function W(t){if(!t.floors||t.floors.length<2)return t;let e=!t.zones?.length,o=new Set,s=t.floors.flatMap(r=>r.objects.flatMap(n=>{if(n.type==="shape"&&n.role==="stage"){let c=JSON.stringify([n.kind,n.x,n.y,n.width,n.height,n.points,n.rotation??0,n.label,n.heightM,n.eventConfigurationIds]);if(o.has(c))return[];o.add(c)}return e&&n.type==="section"?[{...n,zone:L(r.id)}]:[n]})),a=e?t.floors.map(r=>({id:L(r.id),label:r.name,focalPoint:{...r.focalPoint}})):t.zones;return{...t,objects:s,zones:a,floors:void 0,referenceImage:void 0,backgroundImage:E(t)}}function N(t){let e=t.floors;if(!e?.length)return null;let o=e.find(r=>r.objects.some(n=>n.type==="shape"&&n.role==="stage"));if(o)return o.id;let s=e[0],a=-1;for(let r of e){let n=R(X(t,r.objects,r.focalPoint),{freeText:"exclude"}),c=n.width*n.height;c>a&&(a=c,s=r)}return s.id}var U=640;function tt(t,e){return(t.floors?.length??0)<2?null:t.floorOverview==="combined"||!Number.isFinite(e)||e<=0||e>=U?"all":N(t)}var Z=9;function $(t){if(t.kind==="circle")return{hx:t.r,hy:t.r};let e=t.width/2,o=t.height/2,s=t.rotation??0;if(!s)return{hx:e,hy:o};let a=s*Math.PI/180,r=Math.abs(Math.cos(a)),n=Math.abs(Math.sin(a));return{hx:e*r+o*n,hy:e*n+o*r}}function q(t,e,o){let s=e-t.seat.x,a=o-t.seat.y;if(t.shape.kind==="circle")return s*s+a*a<=t.shape.r*t.shape.r;let r=t.shape.rotation??0,n=s,c=a;if(r){let h=-r*Math.PI/180,u=Math.cos(h),x=Math.sin(h);n=s*u-a*x,c=s*x+a*u}return Math.abs(n)<=t.shape.width/2&&Math.abs(c)<=t.shape.height/2}function G(t,e,o,s,a){if(t.shape.kind==="circle"){let f=Math.min(Math.max(t.seat.x,e),s),m=Math.min(Math.max(t.seat.y,o),a),d=t.seat.x-f,p=t.seat.y-m;return d*d+p*p<=t.shape.r*t.shape.r}let r=t.shape.rotation??0;if(!r)return t.seat.x-t.hx<=s&&t.seat.x+t.hx>=e&&t.seat.y-t.hy<=a&&t.seat.y+t.hy>=o;let n=r*Math.PI/180,c=Math.cos(n),h=Math.sin(n),u=t.shape.width/2,x=t.shape.height/2,y=[[-u,-x],[u,-x],[u,x],[-u,x]].map(([f,m])=>[t.seat.x+f*c-m*h,t.seat.y+f*h+m*c]),S=[[e,o],[s,o],[s,a],[e,a]],I=[[1,0],[0,1],[c,h],[-h,c]];for(let[f,m]of I){let d=1/0,p=-1/0;for(let[P,O]of y){let i=P*f+O*m;i<d&&(d=i),i>p&&(p=i)}let M=1/0,w=-1/0;for(let[P,O]of S){let i=P*f+O*m;i<M&&(M=i),i>w&&(w=i)}if(p<M||w<d)return!1}return!0}function ot(t,e={}){let o=e.seatRadius??Z,s=t.length,a=new Array(s),r=1/0,n=1/0,c=-1/0,h=-1/0,u=0;for(let i=0;i<s;i++){let l=t[i],D=e.shapeOf?.(l)??{kind:"circle",r:o},{hx:g,hy:b}=$(D);a[i]={seat:l,shape:D,hx:g,hy:b},l.x-g<r&&(r=l.x-g),l.y-b<n&&(n=l.y-b),l.x+g>c&&(c=l.x+g),l.y+b>h&&(h=l.y+b),g>u&&(u=g),b>u&&(u=b)}s===0&&(r=0,n=0,c=0,h=0);let x=u>0?u*4:1,y=Math.max(c-r,0),S=Math.max(h-n,0),I=Math.max(64,e.maxCells??s*4),f=x,m=Math.max(1,Math.ceil(y/f)||1),d=Math.max(1,Math.ceil(S/f)||1);for(;m*d>I&&(m>1||d>1);)f*=2,m=Math.max(1,Math.ceil(y/f)||1),d=Math.max(1,Math.ceil(S/f)||1);let p=m*d,M=new Int32Array(p+1),w=0;for(let i=0;i<s;i++){let l=a[i],D=v(Math.floor((l.seat.x-l.hx-r)/f),0,m-1),g=v(Math.floor((l.seat.x+l.hx-r)/f),0,m-1),b=v(Math.floor((l.seat.y-l.hy-n)/f),0,d-1),F=v(Math.floor((l.seat.y+l.hy-n)/f),0,d-1);for(let A=b;A<=F;A++)for(let C=D;C<=g;C++)M[A*m+C+1]++,w++}for(let i=0;i<p;i++)M[i+1]+=M[i];let P=new Int32Array(w),O=M.slice(0,p);for(let i=0;i<s;i++){let l=a[i],D=v(Math.floor((l.seat.x-l.hx-r)/f),0,m-1),g=v(Math.floor((l.seat.x+l.hx-r)/f),0,m-1),b=v(Math.floor((l.seat.y-l.hy-n)/f),0,d-1),F=v(Math.floor((l.seat.y+l.hy-n)/f),0,d-1);for(let A=b;A<=F;A++)for(let C=D;C<=g;C++){let k=A*m+C;P[O[k]++]=i}}return{seats:t,entries:a,minX:r,minY:n,cell:f,cols:m,rows:d,cellStart:M,items:P,stamp:new Int32Array(s),epoch:0}}function rt(t,e,o={}){let{cols:s,rows:a,cell:r,minX:n,minY:c,cellStart:h,items:u,entries:x}=t,y=Math.floor((e.x-n)/r),S=Math.floor((e.y-c)/r);if(y<0||S<0||y>=s||S>=a)return null;let I=S*s+y,f=h[I+1],m=-1,d=1/0;for(let p=h[I];p<f;p++){let M=u[p],w=x[M];if(o.filter&&!o.filter(w.seat.id,w.seat)||!q(w,e.x,e.y))continue;let P=e.x-w.seat.x,O=e.y-w.seat.y,i=P*P+O*O;(i<d||i===d&&M<m)&&(d=i,m=M)}return m<0?null:x[m].seat.id}function st(t,e,o,s={}){if(!(o>0))return null;let{cols:a,rows:r,cell:n,minX:c,minY:h,cellStart:u,items:x,entries:y}=t,S=Math.max(0,Math.floor((e.x-o-c)/n)),I=Math.min(a-1,Math.floor((e.x+o-c)/n)),f=Math.max(0,Math.floor((e.y-o-h)/n)),m=Math.min(r-1,Math.floor((e.y+o-h)/n));if(S>I||f>m)return null;let d=-1,p=o*o,M=t.stamp,w=++t.epoch;for(let P=f;P<=m;P++){let O=P*a;for(let i=S;i<=I;i++){let l=O+i,D=u[l+1];for(let g=u[l];g<D;g++){let b=x[g];if(M[b]===w)continue;M[b]=w;let F=y[b];if(s.filter&&!s.filter(F.seat.id,F.seat))continue;let A=e.x-F.seat.x,C=e.y-F.seat.y,k=A*A+C*C;(k<p||k===p&&b<d)&&(p=k,d=b)}}}return d<0?null:y[d].seat.id}function at(t,e,o={}){let s=Math.min(e.x,e.x+e.width),a=Math.max(e.x,e.x+e.width),r=Math.min(e.y,e.y+e.height),n=Math.max(e.y,e.y+e.height),c=o.mode??"center",{cols:h,rows:u,cell:x,minX:y,minY:S,cellStart:I,items:f,entries:m}=t,d=Math.max(0,Math.floor((s-y)/x)),p=Math.min(h-1,Math.floor((a-y)/x)),M=Math.max(0,Math.floor((r-S)/x)),w=Math.min(u-1,Math.floor((n-S)/x));if(d>p||M>w)return[];let P=[],O=t.stamp,i=++t.epoch;for(let l=M;l<=w;l++){let D=l*h;for(let g=d;g<=p;g++){let b=D+g,F=I[b+1];for(let A=I[b];A<F;A++){let C=f[A];if(O[C]===i)continue;O[C]=i;let k=m[C];if(o.filter&&!o.filter(k.seat.id,k.seat))continue;(c==="center"?k.seat.x>=s&&k.seat.x<=a&&k.seat.y>=r&&k.seat.y<=n:G(k,s,r,a,n))&&P.push(C)}}}return P.sort((l,D)=>l-D),P.map(l=>m[l].seat.id)}function ct(t){let e=t.cols*t.rows,o=0,s=0;for(let r=0;r<e;r++){let n=t.cellStart[r+1]-t.cellStart[r];n>0&&o++,n>s&&(s=n)}let a=t.items.length;return{cell:t.cell,cols:t.cols,rows:t.rows,cells:e,occupiedCells:o,refs:a,maxPerCell:s,meanPerOccupiedCell:o?a/o:0}}function lt(t,e=0){let o=Math.max(1,t.width,t.height),s={x:t.x+t.width/2,y:t.y+t.height/2},a=o*1.55,r=Math.max(o*.82,Math.max(0,e)+o*.45);return{target:s,distance:a,height:r,focalLength:Math.hypot(a,r),yawRad:-8*Math.PI/180}}function B(t,e,o=0){let s=e.x-t.target.x,a=e.y-t.target.y,r=Math.cos(t.yawRad),n=Math.sin(t.yawRad),c=s*r-a*n,u=s*n+a*r-t.distance,x=o-t.height,y=Math.hypot(t.distance,t.height),S=(-t.distance*u-t.height*x)/y,I=(-t.height*u+t.distance*x)/y,f=Math.max(y*.08,S),m=t.focalLength/f;return{x:t.target.x+c*m,y:t.target.y-I*m,depth:f,scale:m}}function ht(t,e){return{x:t.a*e.x+t.c*e.y+t.e,y:t.b*e.x+t.d*e.y+t.f}}function ut(t){let e=t.a*t.d-t.b*t.c;if(!Number.isFinite(e)||Math.abs(e)<1e-9)throw new Error("perspective projection produced a singular affine");let o=t.d/e,s=-t.b/e,a=-t.c/e,r=t.a/e;return{a:o,b:s,c:a,d:r,e:-(o*t.e+a*t.f),f:-(s*t.e+r*t.f)}}function mt(t,e){return{a:t.a*e.a+t.c*e.b,b:t.b*e.a+t.d*e.b,c:t.a*e.c+t.c*e.d,d:t.b*e.c+t.d*e.d,e:t.a*e.e+t.c*e.f+t.e,f:t.b*e.e+t.d*e.f+t.f}}function xt(t,e,o=()=>0){let s=B(t,e,o(e)),a={x:e.x+1,y:e.y},r={x:e.x,y:e.y+1},n=B(t,a,o(a)),c=B(t,r,o(r)),h=n.x-s.x,u=n.y-s.y,x=c.x-s.x,y=c.y-s.y;return{a:h,b:u,c:x,d:y,e:s.x-h*e.x-x*e.y,f:s.y-u*e.x-y*e.y}}function ft(t){let e=Math.hypot(t.a,t.b),o=t.a*t.d-t.b*t.c;return{rotationDeg:Math.atan2(t.b,t.a)*180/Math.PI,scaleX:e,scaleY:o/Math.max(e,1e-9),skewX:(t.a*t.c+t.b*t.d)/Math.max(o,1e-9)}}export{T as a,L as b,Q as c,V as d,W as e,N as f,U as g,tt as h,Z as i,ot as j,rt as k,st as l,at as m,ct as n,lt as o,B as p,ht as q,ut as r,mt as s,xt as t,ft as u};
@@ -1 +1 @@
1
- import{Ba as I,Ca as h,Ha as m,Ka as d,xa as p}from"./chunk-E7TOTX6I.js";var f="__sl_ga__";function j(t){return t.startsWith(f)}var S=f,g=1e5,N=1e5;function x(t,e){return`${S}${encodeURIComponent(t)}__${e+1}`}function _(t){let e=t.inventorySegments;if(e===void 0)return!0;if(!Array.isArray(e)||e.length<1||e.length>256)return!1;let r=0,i=new Map;for(let o of e){if(!o||typeof o.sourceAreaId!="string"||!o.sourceAreaId.trim()||o.sourceAreaId.length>160||!Number.isInteger(o.startIndex)||o.startIndex<0||!Number.isInteger(o.count)||o.count<1||o.startIndex+o.count>g||(r+=o.count,r>g))return!1;let u=i.get(o.sourceAreaId)??[],n=o.startIndex+o.count;if(u.some(s=>o.startIndex<s.end&&n>s.start))return!1;u.push({start:o.startIndex,end:n}),i.set(o.sourceAreaId,u)}return r===t.capacity}function A(t){let e=Math.min(g,Math.max(0,Math.floor(t.capacity)));return t.inventorySegments===void 0?e?[{sourceAreaId:t.id,startIndex:0,count:e}]:[]:_(t)?t.inventorySegments.map(r=>({...r})):[]}function y(t){return A(t).flatMap(e=>Array.from({length:e.count},(r,i)=>x(e.sourceAreaId,e.startIndex+i)))}function E(t,e){if(t.inventorySegments===void 0||e===t.capacity)return t.inventorySegments;if(e<t.capacity)return;let r=A(t);if(!r.length)return;let i=e-t.capacity;if(!i)return r;let u=r.filter(s=>s.sourceAreaId===t.id).reduce((s,a)=>Math.max(s,a.startIndex+a.count),0),n=r[r.length-1];if(n?.sourceAreaId===t.id&&n.startIndex+n.count===u)n.count+=i;else{if(r.length>=256)return;r.push({sourceAreaId:t.id,startIndex:u,count:i})}return r}function T(t){return d(t).filter(e=>e.type==="gaArea")}var b="__ungrouped__";function O(t){return t.type==="row"?p(t).map(e=>e.label):t.type==="table"?I(t).map(e=>e.label):t.type==="booth"?h(t).map(e=>e.label):t.type==="gaArea"?y(t):[]}function G(t){return t.type==="row"||t.type==="table"||t.type==="booth"||t.type==="gaArea"}function C(t){let e=d(t),r=e.filter(n=>n.type==="section"),i=new Map;for(let n of r){let s=n.logicalSectionId??n.id;i.get(s)||i.set(s,{id:s,label:n.displayLabel||n.label||"Section",zone:n.zone,seatCount:0,objectIds:[],seatLabels:[]})}let o={id:b,label:"Other seats",seatCount:0,objectIds:[],seatLabels:[]},u=new Map;for(let n of e){if(!G(n))continue;let s=O(n);if(s.length===0)continue;let a=m(e,n),c=a?i.get(a.logicalSectionId??a.id):o;c.seatCount+=s.length,c.objectIds.push(n.id),c.seatLabels.push(...s),u.set(n.id,c.id)}return{sections:[...i.values()],ungrouped:o.objectIds.length?o:null,objectToSection:u}}function w(t,e){return e.has(t.id)||!!t.logicalSectionId&&e.has(t.logicalSectionId)||!!t.zone&&e.has(t.zone)}function v(t,e){let r=new Set;if(!e.size)return r;let{sections:i,ungrouped:o,objectToSection:u}=C(t),n=new Set,s=new Map(i.map(c=>[c.id,c.zone]));for(let c of i){let l=s.get(c.id);(e.has(c.id)||l&&e.has(l))&&n.add(c.id)}let a=!!o&&e.has(b);for(let[c,l]of u)(n.has(l)||a&&l===b)&&r.add(c);return r}function X(t,e){if(!e.size)return t;let r=v(t,e),i=e instanceof Set?e:new Set(e),o=n=>!(r.has(n.id)||n.type==="section"&&w(n,i));if(t.floors&&t.floors.length){let n=!1,s=t.floors.map(a=>{let c=a.objects.filter(o);return c.length!==a.objects.length&&(n=!0),c.length===a.objects.length?a:{...a,objects:c}});return n?{...t,floors:s,objects:s[0].objects}:t}let u=t.objects.filter(o);return u.length===t.objects.length?t:{...t,objects:u}}export{f as a,j as b,g as c,N as d,x as e,_ as f,A as g,y as h,E as i,T as j,b as k,C as l,w as m,v as n,X as o};
1
+ import{Ba as I,Ca as h,Ha as m,Ka as d,xa as p}from"./chunk-W4RS6OW7.js";var f="__sl_ga__";function j(t){return t.startsWith(f)}var S=f,g=1e5,N=1e5;function x(t,e){return`${S}${encodeURIComponent(t)}__${e+1}`}function _(t){let e=t.inventorySegments;if(e===void 0)return!0;if(!Array.isArray(e)||e.length<1||e.length>256)return!1;let r=0,i=new Map;for(let o of e){if(!o||typeof o.sourceAreaId!="string"||!o.sourceAreaId.trim()||o.sourceAreaId.length>160||!Number.isInteger(o.startIndex)||o.startIndex<0||!Number.isInteger(o.count)||o.count<1||o.startIndex+o.count>g||(r+=o.count,r>g))return!1;let u=i.get(o.sourceAreaId)??[],n=o.startIndex+o.count;if(u.some(s=>o.startIndex<s.end&&n>s.start))return!1;u.push({start:o.startIndex,end:n}),i.set(o.sourceAreaId,u)}return r===t.capacity}function A(t){let e=Math.min(g,Math.max(0,Math.floor(t.capacity)));return t.inventorySegments===void 0?e?[{sourceAreaId:t.id,startIndex:0,count:e}]:[]:_(t)?t.inventorySegments.map(r=>({...r})):[]}function y(t){return A(t).flatMap(e=>Array.from({length:e.count},(r,i)=>x(e.sourceAreaId,e.startIndex+i)))}function E(t,e){if(t.inventorySegments===void 0||e===t.capacity)return t.inventorySegments;if(e<t.capacity)return;let r=A(t);if(!r.length)return;let i=e-t.capacity;if(!i)return r;let u=r.filter(s=>s.sourceAreaId===t.id).reduce((s,a)=>Math.max(s,a.startIndex+a.count),0),n=r[r.length-1];if(n?.sourceAreaId===t.id&&n.startIndex+n.count===u)n.count+=i;else{if(r.length>=256)return;r.push({sourceAreaId:t.id,startIndex:u,count:i})}return r}function T(t){return d(t).filter(e=>e.type==="gaArea")}var b="__ungrouped__";function O(t){return t.type==="row"?p(t).map(e=>e.label):t.type==="table"?I(t).map(e=>e.label):t.type==="booth"?h(t).map(e=>e.label):t.type==="gaArea"?y(t):[]}function G(t){return t.type==="row"||t.type==="table"||t.type==="booth"||t.type==="gaArea"}function C(t){let e=d(t),r=e.filter(n=>n.type==="section"),i=new Map;for(let n of r){let s=n.logicalSectionId??n.id;i.get(s)||i.set(s,{id:s,label:n.displayLabel||n.label||"Section",zone:n.zone,seatCount:0,objectIds:[],seatLabels:[]})}let o={id:b,label:"Other seats",seatCount:0,objectIds:[],seatLabels:[]},u=new Map;for(let n of e){if(!G(n))continue;let s=O(n);if(s.length===0)continue;let a=m(e,n,r),c=a?i.get(a.logicalSectionId??a.id):o;c.seatCount+=s.length,c.objectIds.push(n.id),c.seatLabels.push(...s),u.set(n.id,c.id)}return{sections:[...i.values()],ungrouped:o.objectIds.length?o:null,objectToSection:u}}function w(t,e){return e.has(t.id)||!!t.logicalSectionId&&e.has(t.logicalSectionId)||!!t.zone&&e.has(t.zone)}function v(t,e){let r=new Set;if(!e.size)return r;let{sections:i,ungrouped:o,objectToSection:u}=C(t),n=new Set,s=new Map(i.map(c=>[c.id,c.zone]));for(let c of i){let l=s.get(c.id);(e.has(c.id)||l&&e.has(l))&&n.add(c.id)}let a=!!o&&e.has(b);for(let[c,l]of u)(n.has(l)||a&&l===b)&&r.add(c);return r}function X(t,e){if(!e.size)return t;let r=v(t,e),i=e instanceof Set?e:new Set(e),o=n=>!(r.has(n.id)||n.type==="section"&&w(n,i));if(t.floors&&t.floors.length){let n=!1,s=t.floors.map(a=>{let c=a.objects.filter(o);return c.length!==a.objects.length&&(n=!0),c.length===a.objects.length?a:{...a,objects:c}});return n?{...t,floors:s,objects:s[0].objects}:t}let u=t.objects.filter(o);return u.length===t.objects.length?t:{...t,objects:u}}export{f as a,j as b,g as c,N as d,x as e,_ as f,A as g,y as h,E as i,T as j,b as k,C as l,w as m,v as n,X as o};
@@ -1 +1 @@
1
- import{I as o}from"./chunk-E7TOTX6I.js";var u=36,c=160;function A(r,n=360){let t=o(Math.round(Number.isFinite(r)?r:1),1,40),i=o(Number.isFinite(n)?n:360,120,360);return Math.round(o(t*4*(360/i),u,c))}export{u as a,c as b,A as c};
1
+ import{I as o}from"./chunk-W4RS6OW7.js";var u=36,c=160;function A(r,n=360){let t=o(Math.round(Number.isFinite(r)?r:1),1,40),i=o(Number.isFinite(n)?n:360,120,360);return Math.round(o(t*4*(360/i),u,c))}export{u as a,c as b,A as c};
@@ -0,0 +1 @@
1
+ import{h as xe,i as oe}from"./chunk-5ITK5236.js";import{c as Se}from"./chunk-CRCGO52K.js";var kn=2e6,dt=/^data:image\/(?:png|jpe?g|webp|gif|avif);base64,[a-z0-9+/]+={0,2}$/i,ft=/[\s"'<>`\\]/;function ht(e){if(typeof e!="string"||!e||e.length>2e6||e!==e.trim())return!1;if(e.startsWith("data:"))return dt.test(e);if(ft.test(e))return!1;try{let t=new URL(e);return t.protocol==="https:"&&!t.username&&!t.password}catch{return!1}}function Me(e){let t=e.trim();return ht(t)?t:null}var Y="seatlayer.event-configuration/1",ie="seatlayer.event-configuration-export/1",D=100,mt=120,pt=1e5,bt=1e4,we=/^[a-f0-9]{64}$/,yt=new Set(["stage","screen","barrier","camera_platform","sound_desk","rigging_truss"]);function V(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function j(e,t){return typeof e=="string"&&e.length>=1&&e.length<=t&&e.normalize("NFKC").trim()===e}function Ee(e){return typeof e=="number"&&Number.isInteger(e)&&e>0}function ve(e){return!Array.isArray(e)||e.length>pt||!e.every(t=>j(t,D))?null:[...new Set(e)].sort()}function Ie(e){return!V(e)||!j(e.chartId,D)||!j(e.version,D)||e.sha256!==void 0&&(typeof e.sha256!="string"||!we.test(e.sha256))?null:{chartId:e.chartId,version:e.version,...typeof e.sha256=="string"?{sha256:e.sha256}:{}}}function re(e,t,n){return typeof e=="number"&&Number.isFinite(e)&&e>=t&&e<=n}function gt(e){return V(e)?e.mode==="none"||e.mode==="opaque"?e.opacity===void 0?{mode:e.mode}:null:e.mode==="partial"&&re(e.opacity,.01,.99)?{mode:"partial",opacity:e.opacity}:null:null}function xt(e,t){if(e===void 0)return;if(!Array.isArray(e)||e.length>bt)return null;let n=new Set(t),i=new Set,o=new Set,r=0,s=[];for(let c of e){if(!V(c)||!j(c.id,D)||!j(c.objectId,D)||!n.has(c.objectId)||!yt.has(String(c.kind))||!re(c.heightM,.05,50)||c.baseElevationM!==void 0&&!re(c.baseElevationM,-10,100))return null;let a=gt(c.occlusion);if(!a||i.has(c.id)||o.has(c.objectId))return null;let u=c.contentImageUrl===void 0?void 0:typeof c.contentImageUrl=="string"?Me(c.contentImageUrl):null;if(c.contentImageUrl!==void 0&&(!u||c.kind!=="screen"||++r>1))return null;i.add(c.id),o.add(c.objectId),s.push({id:c.id,objectId:c.objectId,kind:c.kind,heightM:c.heightM,...c.baseElevationM!==void 0?{baseElevationM:c.baseElevationM}:{},occlusion:a,...u?{contentImageUrl:u}:{}})}return s.sort((c,a)=>c.id.localeCompare(a.id))}function Pe(e){let t=[];if(!V(e))return{issues:[{code:"invalid_export",path:"configuration",message:"Configuration must be an object"}]};e.schema!==Y&&t.push({code:"unsupported_schema",path:"configuration.schema",message:`Configuration schema must be ${Y}`}),j(e.id,D)||t.push({code:"invalid_id",path:"configuration.id",message:"Configuration id must contain 1 to 100 normalized characters"}),j(e.label,mt)||t.push({code:"invalid_label",path:"configuration.label",message:"Configuration label must contain 1 to 120 normalized characters"}),Ee(e.version)||t.push({code:"invalid_version",path:"configuration.version",message:"Configuration version must be a positive integer"});let n=Ie(e.baseVenue);n||t.push({code:"invalid_base_venue",path:"configuration.baseVenue",message:"Base venue must identify one normalized chart id and exact version"});let i=V(e.overlay)?e.overlay:null,o=ve(i?.objectIds),r=ve(i?.productionKillSeatIds),s=o?xt(i?.productionElements,o):null;return(!i||!o||!r)&&t.push({code:"invalid_overlay",path:"configuration.overlay",message:"Overlay ids must be bounded arrays of normalized stable ids"}),s===null&&t.push({code:"invalid_production_element",path:"configuration.overlay.productionElements",message:"Production elements must be unique, bounded semantics over referenced base-venue objects"}),t.length||!n||!o||!r||s===null?{issues:t}:{issues:t,value:{schema:Y,id:e.id,label:e.label,version:e.version,baseVenue:n,overlay:{objectIds:o,productionKillSeatIds:r,...s!==void 0?{productionElements:s}:{}}}}}function On(e){let t=Pe(e);return t.value?{ok:!0,value:t.value}:{ok:!1,issues:t.issues}}function An(e){if(!V(e))return{ok:!1,issues:[{code:"invalid_export",path:"",message:"Export must be an object"}]};let t=[];e.schema!==ie&&t.push({code:"unsupported_schema",path:"schema",message:`Export schema must be ${ie}`}),(typeof e.contentSha256!="string"||!we.test(e.contentSha256))&&t.push({code:"invalid_checksum",path:"contentSha256",message:"Export checksum must be a lowercase SHA-256 digest"});let n=Pe(e.configuration);return t.push(...n.issues),t.length||!n.value||typeof e.contentSha256!="string"?{ok:!1,issues:t}:{ok:!0,value:{schema:ie,configuration:n.value,contentSha256:e.contentSha256}}}function jn(e){return JSON.stringify({schema:Y,id:e.id,label:e.label,version:e.version,baseVenue:{chartId:e.baseVenue.chartId,version:e.baseVenue.version,...e.baseVenue.sha256?{sha256:e.baseVenue.sha256}:{}},overlay:{objectIds:[...new Set(e.overlay.objectIds)].sort(),productionKillSeatIds:[...new Set(e.overlay.productionKillSeatIds)].sort(),...e.overlay.productionElements!==void 0?{productionElements:[...e.overlay.productionElements].sort((t,n)=>t.id.localeCompare(n.id)).map(t=>({id:t.id,objectId:t.objectId,kind:t.kind,heightM:t.heightM,...t.baseElevationM!==void 0?{baseElevationM:t.baseElevationM}:{},occlusion:t.occlusion,...t.contentImageUrl?{contentImageUrl:t.contentImageUrl}:{}}))}:{}}})}function Ln(e,t){let n=[];e.baseVenue.chartId!==t.chartId&&n.push({code:"base_venue_mismatch",message:"Configuration belongs to a different base venue"}),e.baseVenue.version!==t.version&&n.push({code:"base_venue_version_mismatch",message:"Configuration was authored against a different venue version"}),e.baseVenue.sha256&&!t.sha256?n.push({code:"base_venue_checksum_missing",message:"Venue checksum is required for this configuration"}):e.baseVenue.sha256&&e.baseVenue.sha256!==t.sha256&&n.push({code:"base_venue_checksum_mismatch",message:"Venue bytes do not match the configuration base"});let i=new Set(t.objectIds);for(let r of e.overlay.objectIds)i.has(r)||n.push({code:"overlay_object_missing",message:`Production object ${r} is missing from the base venue`,targetId:r});if(t.objectTypes)for(let r of e.overlay.productionElements??[])t.objectTypes.get(r.objectId)!=="shape"&&n.push({code:"production_element_not_shape",message:`Production element ${r.id} must reference base-venue shape geometry`,targetId:r.objectId});let o=new Set(t.seatIds);for(let r of e.overlay.productionKillSeatIds)o.has(r)||n.push({code:"production_kill_seat_missing",message:`Production-kill seat ${r} is missing from the base venue`,targetId:r});return{compatible:n.length===0,issues:n}}var St={draft:new Set(["review","archived"]),review:new Set(["draft","approved","archived"]),approved:new Set(["published","archived"]),published:new Set(["archived"]),archived:new Set};function Nn(e,t){return e===t||St[e].has(t)}function Fn(e,t,n){return!Ee(n)||n>=t.version?null:e.find(i=>i.id===t.id&&i.version===n&&i.status==="published")??null}function Mt(e){return e.floors?.length?e.floors.flatMap(t=>t.objects):e.objects}function se(e,t,n){if(!(!e||typeof e!="object")){if(Array.isArray(e)){for(let i of e)se(i,t,n);return}for(let[i,o]of Object.entries(e)){if(i==="eventConfigurationId"){j(o,D)?t.add(o):o!==void 0&&n.add(String(o));continue}if(i==="eventConfigurationIds"){if(!Array.isArray(o))n.add(String(o));else for(let r of o)j(r,D)?t.add(r):n.add(String(r));continue}se(o,t,n)}}}function Dn(e,t){let n=Ie(t);if(!n)return{ok:!1,invalidIds:["baseVenue"]};let i=new Set,o=new Set;if(se(e,i,o),o.size)return{ok:!1,invalidIds:[...o].sort()};let r=Mt(e);return{ok:!0,configurations:[...i].sort().map(s=>({schema:Y,id:s,label:s,version:1,baseVenue:n,overlay:{objectIds:r.filter(c=>c.type==="shape"&&c.eventConfigurationIds?.includes(s)).map(c=>c.id).sort(),productionKillSeatIds:[]}}))}}var Vn=40,Un=1200,Kn=.8,Xn=3,Gn=-2,Bn=20,zn=.1,Yn=40,Wn=40,Ce=e=>Math.max(1,e.fontSize*.6+(e.letterSpacing??0));function vt(e,t){let n=e.text.split(/\r?\n/);if(!e.width)return Math.max(1,n.length);let i=Math.max(1,Math.floor(t/Ce(e))),o=0;for(let r of n){if(!r.length){o+=1;continue}let s=0;for(let c of r.split(/\s+/)){let a=c.length;s&&s+1+a<=i?s+=1+a:(o+=Math.max(1,Math.ceil(a/i)),s=a%i)}}return Math.max(1,o)}function _e(e){let t=e.background?.padding??0,n=e.text.split(/\r?\n/),i=Math.max(1,...n.map(c=>c.length))*Ce(e),o=e.width??i+t*2,r=Math.max(1,o-t*2),s=vt(e,r);return{width:o,height:s*e.fontSize*(e.lineHeight??1.2)+t*2,lineCount:s,padding:t}}var wt=Math.PI/180;function P(e,t){return Math.hypot(e.x-t.x,e.y-t.y)}function Et(e,t,n){let i=Math.cos(n),o=Math.sin(n),r=e.x-t.x,s=e.y-t.y;return{x:t.x+r*i-s*o,y:t.y+r*o+s*i}}function qn(e,t){return Et(e,{x:0,y:0},t*wt)}function R(e,t,n){return{x:e.x+(t.x-e.x)*n,y:e.y+(t.y-e.y)*n}}function It(e){let t=0,n=0;for(let o of e)t+=o.x,n+=o.y;let i=e.length||1;return{x:t/i,y:n/i}}function Jn(e){return e.length?It(e):null}function ae(e,t){let n=1-t,i=n*n*n,o=3*n*n*t,r=3*n*t*t,s=t*t*t;return{x:i*e.start.x+o*e.control1.x+r*e.control2.x+s*e.end.x,y:i*e.start.y+o*e.control1.y+r*e.control2.y+s*e.end.y}}function eo(e,t,n){let i={x:(e.x+t.x)/2,y:(e.y+t.y)/2},o={x:(n.x-i.x)*4/3,y:(n.y-i.y)*4/3};return{start:{...e},control1:{x:e.x+(t.x-e.x)/3+o.x,y:e.y+(t.y-e.y)/3+o.y},control2:{x:e.x+(t.x-e.x)*2/3+o.x,y:e.y+(t.y-e.y)*2/3+o.y},end:{...t}}}function Te(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[ae(e,.5)];let i=Array.from({length:n+1},(a,u)=>ae(e,u/n)),o=new Float64Array(i.length);for(let a=1;a<i.length;a+=1){let u=i[a].x-i[a-1].x,l=i[a].y-i[a-1].y;o[a]=o[a-1]+Math.hypot(u,l)}let r=o[o.length-1];if(r<=1e-9)return Array.from({length:t},()=>({...e.start}));let s=[],c=1;for(let a=0;a<t;a+=1){let u=r*a/(t-1);for(;c<o.length-1&&o[c]<u;)c+=1;let l=o[c-1],d=o[c],f=d===l?0:(u-l)/(d-l);s.push({x:i[c-1].x+(i[c].x-i[c-1].x)*f,y:i[c-1].y+(i[c].y-i[c-1].y)*f})}return s}function T(e,t){return{x:e.x+t.x,y:e.y+t.y}}function W(e,t){return{x:e.x-t.x,y:e.y-t.y}}function O(e,t){return{x:e.x*t,y:e.y*t}}function q(e,t=13){return Array.from({length:t},(n,i)=>ae(e,i/(t-1)))}function ke(e,t){let n=Math.max(0,Math.min(1,t))*(e.length-1),i=Math.min(e.length-2,Math.floor(n));return R(e[i],e[i+1],n-i)}function Re(e,t,n){let i=Math.max(0,Math.min(1,t)),o=Math.max(i,Math.min(1,n)),r=[ke(e,i)];for(let s=1;s<e.length-1;s+=1){let c=s/(e.length-1);c>i+1e-9&&c<o-1e-9&&r.push(e[s])}return r.push(ke(e,o)),r}function Oe(e,t){let n=[[0,1],[1,2],[2,3],[3,0]],i=0,o=Number.POSITIVE_INFINITY;n.forEach(([f,p],y)=>{let h=P(R(e[f],e[p],.5),t);h<o&&(o=h,i=y)});let r=e[i],s=e[(i+1)%4],c=e[(i+2)%4],a=e[(i+3)%4],u=R(r,s,.5),l=W(t,u),d=Math.max(1e-9,Math.hypot(l.x,l.y));return{p0:r,p1:s,p2:c,p3:a,normal:O(l,1/d),depth:(P(r,a)+P(s,c))/2}}function Ae(e){let{p0:t,p1:n,p2:i,p3:o,normal:r,depth:s}=e,c=W(n,t),a=W(i,o),u=s*.22,l=s*.12;return{nearPath:{start:t,control1:T(T(t,O(c,1/3)),O(r,u)),control2:T(T(t,O(c,2/3)),O(r,u)),end:n},farPath:{start:i,control1:T(T(o,O(a,2/3)),O(r,l)),control2:T(T(o,O(a,1/3)),O(r,l)),end:o}}}function to(e,t,n){if(e.length!==4)throw new Error("A section shell requires four mapped bounds corners");let i=e.reduce((y,h)=>T(y,h),{x:0,y:0});i.x/=4,i.y/=4;let o=P(e[0],e[1]),r=P(e[0],e[3]),s=n==="auto"?o>r*1.25&&P(i,t)>r?"bezier":"tapered":n;if(s==="rectangle")return{mode:s,outline:e.map(y=>({...y}))};let c=Oe(e,t),{p0:a,p1:u,p2:l,p3:d}=c;if(s==="tapered")return{mode:s,outline:[T(a,O(W(u,a),.14)),T(a,O(W(u,a),1-.14)),l,d]};let{nearPath:f,farPath:p}=Ae(c);return{mode:s,outline:[...q(f),...q(p).slice(1)]}}function no(e,t,n,i){if(e.length!==4)throw new Error("Aisle generation requires four mapped bounds corners");if(!Number.isInteger(n)||n<0||n>3)throw new Error("Aisle count must be an integer from 0 to 3");if(n===0)return[];let o=Oe(e,t),{p0:r,p1:s,p2:c,p3:a}=o,u=i==="bezier"?Ae(o):null,l=u?q(u.nearPath):null,d=u?q(u.farPath).reverse():null,f=Math.min(.055,.18/(n+1));return Array.from({length:n},(p,y)=>{let h=(y+1)/(n+1),m=h-f/2,g=h+f/2;return l&&d?[...Re(l,m,g),...Re(d,m,g).reverse()]:[R(r,s,m),R(r,s,g),R(a,c,g),R(a,c,m)]})}function Pt(e,t,n){let i=n.x-t.x,o=n.y-t.y,r=i*i+o*o,s=r?Math.max(0,Math.min(1,((e.x-t.x)*i+(e.y-t.y)*o)/r)):0;return Math.hypot(e.x-(t.x+s*i),e.y-(t.y+s*o))}function Ct(e,t){let n=1/0;for(let i of t)if(!(i.length<2))for(let o=0,r=i.length-1;o<i.length;r=o++){let s=Pt(e,i[r],i[o]);s<n&&(n=s)}return n}function je(e,t){let n=!1;for(let i=0,o=t.length-1;i<t.length;o=i++){let r=t[i].x,s=t[i].y,c=t[o].x,a=t[o].y;s>e.y!=a>e.y&&e.x<(c-r)*(e.y-s)/(a-s)+r&&(n=!n)}return n}function _t(e,t,n){let i=je(e,t)&&!n.some(r=>je(e,r)),o=Ct(e,[t,...n]);return i?o:-o}function U(e,t,n,i,o){let r=_t({x:e,y:t},i,o);return{x:e,y:t,h:n,d:r,max:r+n*Math.SQRT2}}var ce=class{constructor(){this.items=[]}get size(){return this.items.length}push(t){let n=this.items;n.push(t);let i=n.length-1;for(;i>0;){let o=i-1>>1;if(n[o].max>=n[i].max)break;[n[o],n[i]]=[n[i],n[o]],i=o}}pop(){let t=this.items,n=t[0],i=t.pop();if(t.length&&i){t[0]=i;let o=0;for(;;){let r=o*2+1,s=r+1,c=o;if(r<t.length&&t[r].max>t[c].max&&(c=r),s<t.length&&t[s].max>t[c].max&&(c=s),c===o)break;[t[c],t[o]]=[t[o],t[c]],o=c}}return n}};function Le(e){if(e.length<3)return 0;let t=0;for(let n=0,i=e.length-1;n<e.length;i=n++)t+=(e[i].x+e[n].x)*(e[i].y-e[n].y);return Math.abs(t)/2}function io(e,t){return Math.max(0,Le(e)-(t??[]).reduce((n,i)=>n+Le(i),0))}function Ne(e,t){let n=t??[];if(!e.length)return{point:{x:0,y:0},radius:0};if(e.length<3){let h=e.reduce((g,S)=>g+S.x,0)/e.length,m=e.reduce((g,S)=>g+S.y,0)/e.length;return{point:{x:h,y:m},radius:0}}let i=1/0,o=1/0,r=-1/0,s=-1/0;for(let h of e)h.x<i&&(i=h.x),h.y<o&&(o=h.y),h.x>r&&(r=h.x),h.y>s&&(s=h.y);let c=r-i,a=s-o,u=Math.min(c,a);if(!(u>0))return{point:{x:(i+r)/2,y:(o+s)/2},radius:0};let l=Math.max(c,a)/150,d=new ce,f=u/2;for(let h=i;h<r;h+=u)for(let m=o;m<s;m+=u)d.push(U(h+f,m+f,f,e,n));let p=U(i+c/2,o+a/2,0,e,n),y=0;for(;d.size;){let h=d.pop();if(!h)break;h.d>p.d&&(p=h),!(h.max-p.d<=l)&&(y>=4e3||(y+=1,f=h.h/2,d.push(U(h.x-f,h.y-f,f,e,n)),d.push(U(h.x+f,h.y-f,f,e,n)),d.push(U(h.x-f,h.y+f,f,e,n)),d.push(U(h.x+f,h.y+f,f,e,n))))}return{point:{x:p.x,y:p.y},radius:Math.max(0,p.d)}}function kt(e,t,n){return Math.max(t,Math.min(n,e))}function so(e,t,n){return e<t?t:e>n?n:e}function Rt(e){return kt(e,0,1)}function Fe(e){let t=Rt(e);return t*t*(3-2*t)}var K=Math.PI*2;function X(e){return Number.isFinite(e.x)&&Number.isFinite(e.y)}function Tt(e,t,n){let i=t-e;if(n){for(;i<0;)i+=K;for(;i>=K;)i-=K}else{for(;i>0;)i-=K;for(;i<=-K;)i+=K}return i}function uo(e){return e.end}function Ve(e){if(e.version!==1||e.closed!==!0||!X(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||!X(n.end))return!1;if(n.kind==="line"){if(P(t,n.end)<=1e-9)return!1}else if(n.kind==="bezier"){if(!X(n.control1)||!X(n.control2)||P(t,n.end)<=1e-9)return!1}else if(n.kind==="arc"){if(!X(n.center)||!Number.isFinite(n.radius)||n.radius<=1e-6||Math.abs(P(t,n.center)-n.radius)>Math.max(1e-4,n.radius*1e-4)||Math.abs(P(n.end,n.center)-n.radius)>Math.max(1e-4,n.radius*1e-4)||P(t,n.end)<=1e-9)return!1}else return!1;t=n.end}return P(t,e.start)<=1e-4}function Ot(e,t,n){let i=1-n;return{x:i**3*e.x+3*i**2*n*t.control1.x+3*i*n**2*t.control2.x+n**3*t.end.x,y:i**3*e.y+3*i**2*n*t.control1.y+3*i*n**2*t.control2.y+n**3*t.end.y}}function fo(e,t=2){if(!Ve(e))throw new Error("Section outline path is invalid");let n=Math.max(.25,t),i=[{...e.start}],o=e.start;for(let r of e.segments){if(r.kind==="line")i.push({...r.end});else if(r.kind==="arc"){let s=Math.atan2(o.y-r.center.y,o.x-r.center.x),c=Math.atan2(r.end.y-r.center.y,r.end.x-r.center.x),a=Tt(s,c,r.clockwise),u=Math.max(2,Math.ceil(Math.abs(a)*r.radius/n));for(let l=1;l<=u;l+=1){let d=s+a*l/u;i.push({x:r.center.x+Math.cos(d)*r.radius,y:r.center.y+Math.sin(d)*r.radius})}}else{let s=P(o,r.control1)+P(r.control1,r.control2)+P(r.control2,r.end),c=Math.max(2,Math.ceil(s/n));for(let a=1;a<=c;a+=1)i.push(Ot(o,r,a/c))}o=r.end}return P(i[i.length-1],i[0])<=1e-4&&i.pop(),i}function Ue(e,t,n){return At(e,o=>({x:o.x+t,y:o.y+n}))}function At(e,t,n=1,i=!1){return{...e,start:t(e.start),segments:e.segments.map(o=>o.kind==="line"?{...o,end:t(o.end)}:o.kind==="arc"?{...o,center:t(o.center),radius:o.radius*Math.abs(n),clockwise:i?!o.clockwise:o.clockwise,end:t(o.end)}:{...o,control1:t(o.control1),control2:t(o.control2),end:t(o.end)})}}var jt=45,le=150,Lt=60;function Nt(e){let t=jt/100;if(e<=t)return le;let n=Math.min(1,(e-t)/(1-t));return le-n*(le-Lt)}var De=.5523;function He(e,t){return Math.abs(e.x-t.x)<=1e-6&&Math.abs(e.y-t.y)<=1e-6}function Ft(e){let t=[],n=[];for(e.forEach((i,o)=>{X(i)&&(t.length&&He(t[t.length-1],i)||(t.push({x:i.x,y:i.y}),n.push(o)))});t.length>1&&He(t[0],t[t.length-1]);)t.pop(),n.pop();return{points:t,sourceIndex:n}}function ho(e,t,n){return Ut(e,{cornerSmoothing:t,...n})}var Dt=.5,Ht=4/3;function Vt(e,t,n){let i=t.x-e.x,o=t.y-e.y,r=Math.hypot(i,o);if(r<=1e-9)return{kind:"line",end:{...t}};let s=-o/r,c=i/r,a=n*Ht;return{kind:"bezier",control1:{x:e.x+i/3+s*a,y:e.y+o/3+c*a},control2:{x:e.x+i*2/3+s*a,y:e.y+o*2/3+c*a},end:{...t}}}function Ut(e,t){let{points:n,sourceIndex:i}=Ft(e),o=n.length;if(o<3)return null;let r=Math.min(100,Math.max(0,t.cornerSmoothing??0))/100,s=t.edgeCurvature,c=new Array(o).fill(0);if(s?.length)for(let b=0;b<o;b+=1){let M=s[i[b]];c[b]=Number.isFinite(M)?Math.min(100,Math.max(-100,M))/100:0}let a=c.some(b=>Math.abs(b)>1e-6);if(r<=0&&!a)return null;let u=t.wideAngleThresholdDeg??Nt(r),l=[];for(let b=0;b<o;b+=1)l[b]=P(n[b],n[(b+1)%o]);let d=new Array(o).fill(0);for(let b=0;b<o;b+=1){let M=n[(b-1+o)%o],v=n[b],w=n[(b+1)%o],E={x:M.x-v.x,y:M.y-v.y},C={x:w.x-v.x,y:w.y-v.y},_=Math.hypot(E.x,E.y),k=Math.hypot(C.x,C.y);if(_<=1e-9||k<=1e-9)continue;let H=Math.min(1,Math.max(-1,(E.x*C.x+E.y*C.y)/(_*k))),L=Math.acos(H)*180/Math.PI;if(L<u)continue;let A=Fe((L-u)/(180-u));d[b]=r*A*.5*Math.min(_,k)}for(let b=0;b<o;b+=1){let M=(b+1)%o,v=d[b]+d[M];if(v>l[b]&&v>1e-9){let w=l[b]/v;d[b]*=w,d[M]*=w}}let f=new Array(o),p=new Array(o);for(let b=0;b<o;b+=1){let M=n[(b-1+o)%o],v=n[b],w=n[(b+1)%o];if(d[b]<=1e-6){f[b]={...v},p[b]={...v};continue}let E=P(v,M)||1,C=P(v,w)||1;f[b]={x:v.x+(M.x-v.x)/E*d[b],y:v.y+(M.y-v.y)/E*d[b]},p[b]={x:v.x+(w.x-v.x)/C*d[b],y:v.y+(w.y-v.y)/C*d[b]}}if(d.every(b=>b<=1e-6)&&!a)return null;let y=[],h={...p[0]},m=h,g=(b,M)=>{if(P(m,b)<=1e-9)return;let v=c[M];Math.abs(v)>1e-6?y.push(Vt(m,b,v*Dt*l[M])):y.push({kind:"line",end:{...b}}),m=b};for(let b=1;b<=o;b+=1){let M=b%o,v=n[M];g(f[M],(b-1)%o),d[M]>1e-6&&P(f[M],p[M])>1e-9&&(y.push({kind:"bezier",control1:R(f[M],v,De),control2:R(p[M],v,De),end:{...p[M]}}),m=p[M])}if(!y.length)return null;let S=y[y.length-1];P(S.end,h)>1e-9&&(S.kind==="line"?S.end={...h}:y.push({kind:"line",end:{...h}}));let x={version:1,closed:!0,start:h,segments:y};return Ve(x)?x:null}function mo(e){let t=[],n=e.start;for(let o of e.segments)t.push(n),n=o.end;let i=[];for(let o=e.segments.length-1;o>=0;o-=1){let r=e.segments[o],s=t[o];r.kind==="line"?i.push({kind:"line",end:{...s}}):r.kind==="arc"?i.push({kind:"arc",center:{...r.center},radius:r.radius,clockwise:!r.clockwise,end:{...s}}):i.push({kind:"bezier",control1:{...r.control2},control2:{...r.control1},end:{...s}})}return{version:1,closed:!0,start:{...e.start},segments:i}}function bo(e,t,n){let i=[];for(let o=0;o<e.length-1;o+=1){let r=e[o],s=e[o+1],c=Math.hypot(s.x-r.x,s.y-r.y);if(c<=0)continue;let a=Math.max(1,Math.round(c/n)),u=c/a,l=Math.atan2(s.y-r.y,s.x-r.x),d=o===0,p=(o>0?t[o-1]:void 0)==="break"?2:1,y=d?{...r}:{x:r.x+Math.cos(l)*u*p,y:r.y+Math.sin(l)*u*p},h=d?a+1:Math.max(1,a-(p-1));i.push({origin:y,rotation:l*180/Math.PI,seatCount:h,seatSpacing:u})}return i}function yo(e){let t=e.rotation*Math.PI/180,n={x:Math.cos(t),y:Math.sin(t)};return Array.from({length:e.seatCount},(i,o)=>({x:e.origin.x+n.x*o*e.seatSpacing,y:e.origin.y+n.y*o*e.seatSpacing}))}function go(e){return e.reduce((t,n)=>t+n.seatCount,0)}function Ke(e){let t=new Map,n=new Map;for(let i of e){if(i.type!=="row"||!i.segmentedRow)continue;let o=n.get(i.segmentedRow.groupId)??[];o.push(i),n.set(i.segmentedRow.groupId,o)}for(let[i,o]of n){let r=o.slice().sort((f,p)=>f.segmentedRow.componentIndex-p.segmentedRow.componentIndex),s=r[0]?.segmentedRow?.componentCount??0,c=r[0]?.segmentedRow;if(!c||!(s>=2&&r.length===s&&c?.boundaryBefore==="start"&&r.every((f,p)=>f.segmentedRow?.kind==="segmented-row-v1"&&f.segmentedRow.groupId===i&&f.segmentedRow.componentCount===s&&f.segmentedRow.componentIndex===p&&f.segmentedRow.repeatLabelOnComponents===c.repeatLabelOnComponents&&(p===0?f.segmentedRow.boundaryBefore==="start":f.segmentedRow.boundaryBefore!=="start")&&f.segmentedRow.displayLabel===c.displayLabel)))continue;let u=r.reduce((f,p)=>f+p.seatCount,0),l=0,d=0;for(let f of r)f.segmentedRow.boundaryBefore==="break"&&(l+=1),t.set(f.id,{groupId:i,adjacencyOffset:l,displayOffset:d,displayLabel:c.displayLabel,totalSeats:u,canonical:r[0],viewFromSeatUrl:c.viewFromSeatUrl,viewFromSeatMeta:c.viewFromSeatMeta,confidenceEvidence:c.confidenceEvidence}),l+=f.seatCount,d+=f.seatCount}return t}var G=.02291666666666667,So=1/G,Kt=58,Xt=Kt*G,Xe=0,Be=3,Ge=0,ue=120,Gt=0,Bt=45,zt=7,B=1.2;function de(e,t,n,i){return Number.isFinite(e)?Math.max(t,Math.min(n,e)):i}function Mo(e){return Number.isFinite(e)?Math.max(Xe,Math.min(Be,Math.round(e))):Xe}function Yt(e){return!Number.isFinite(e)||!Number.isInteger(e)||e<0?0:e<=zt?e:Be}function ze(e,t={}){let n=de(t.floorBaseHeightM,Ge,ue,0),i=Math.min(ue,n+Yt(e.elevation)*Xt),o=e.height===void 0?i:de(e.height,Ge,ue,i),r=de(e.rake,Gt,Bt,0);return{height:o,rake:r}}function Ye(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 We(e,t,n){if(!e.length)return 1/0;if(e.length===1)return Math.hypot(t-e[0].x,n-e[0].y);let i=1/0;for(let o=0;o+1<e.length;o++){let r=e[o],s=e[o+1],c=s.x-r.x,a=s.y-r.y,u=c*c+a*a,l=u>1e-12?((t-r.x)*c+(n-r.y)*a)/u:0;l<0?l=0:l>1&&(l=1);let d=Math.hypot(t-(r.x+l*c),n-(r.y+l*a));d<i&&(i=d)}return i}function Wt(e){let t=0,n=0;for(let r of e)t+=r.x,n+=r.y;let i=e.length||1;t/=i,n/=i;let o=0;for(let r of e){let s=Math.hypot(r.x-t,r.y-n);s>o&&(o=s)}return{cx:t,cy:n,r:o}}function $e(e,t){return Math.hypot(e.cx-t.cx,e.cy-t.cy)-e.r-t.r}function fe(e,t){let n=1/0;for(let i of Ye(e)){let o=We(t,i.x,i.y);o<n&&(n=o)}for(let i of Ye(t)){let o=We(e,i.x,i.y);o<n&&(n=o)}return n}function $t(e,t){if(e.length<3)return{pts:e,seatIndices:t};let n=0,i=0;for(let l of e)n+=l.x,i+=l.y;n/=e.length,i/=e.length;let o=-1,r=e[0];for(let l of e){let d=Math.hypot(l.x-n,l.y-i);d>o&&(o=d,r=l)}let s=r.x-n,c=r.y-i,a=Math.hypot(s,c);a>1e-9?(s/=a,c/=a):(s=1,c=0);let u=e.map((l,d)=>({p:l,i:d,t:(l.x-n)*s+(l.y-i)*c})).sort((l,d)=>l.t-d.t);return{pts:u.map(l=>l.p),seatIndices:u.map(l=>t[l.i])}}function qt(e){let t=e.length;if(t<3)return null;let n=0,i=0;for(let S of e)n+=S.x,i+=S.y;n/=t,i/=t;let o=0,r=0,s=0,c=0,a=0,u=0,l=0;for(let S of e){let x=S.x-n,b=S.y-i;o+=x*x,s+=b*b,r+=x*b,c+=x*x*x,a+=b*b*b,u+=x*b*b,l+=b*x*x}let d=o*s-r*r;if(Math.abs(d)<1e-9)return null;let f=(c+u)/2,p=(a+l)/2,y=(f*s-p*r)/d,h=(p*o-f*r)/d,m=y+n,g=h+i;return!Number.isFinite(m)||!Number.isFinite(g)?null:{cx:m,cy:g}}var Jt=.15;function Zt(e){if(e.length<2)return null;let t=e.map(S=>{let x=0,b=0;for(let M of S.pts)x+=M.x,b+=M.y;return{x:x/S.pts.length,y:b/S.pts.length}}),n=0,i=0;for(let S of t)n+=S.x,i+=S.y;n/=t.length,i/=t.length;let o=0,r=0,s=0;for(let S of t){let x=S.x-n,b=S.y-i;o+=x*x,r+=x*b,s+=b*b}let c=o+s,a=o*s-r*r,u=c/2+Math.sqrt(Math.max(0,c*c/4-a)),l,d;Math.abs(r)>1e-12?(l=u-s,d=r):o>=s?(l=1,d=0):(l=0,d=1);let f=Math.hypot(l,d);if(!(f>1e-12))return null;l/=f,d/=f;let p=1/0,y=-1/0,h=[];for(let S of e){let x=1/0,b=-1/0;for(let M of S.pts){let v=M.x*l+M.y*d;v<x&&(x=v),v>b&&(b=v),v<p&&(p=v),v>y&&(y=v)}h.push(b-x)}let m=y-p;return m>1e-9?(h.sort((S,x)=>S-x),h[Math.min(h.length-1,Math.floor(h.length*.9))]/m<=Qt?{x:l,y:d}:null):null}var Qt=.35;function qe(e,t,n,i){let o=new Map;for(let m of n){let g=t[m],S=g.rowId||`__seat-${m}`,x=o.get(S);x||(x={pts:[],idx:[]},o.set(S,x)),x.pts.push({x:g.x,y:g.y}),x.idx.push(m)}if(!o.size)return{sectionId:e,rows:[],blockCount:0};let r=[];for(let[m,g]of o){let S=$t(g.pts,g.idx),x=0;for(let b of S.pts)x+=Math.hypot(b.x-i.x,b.y-i.y);r.push({id:m,pts:S.pts,seatIndices:S.seatIndices,blockId:-1,ordinal:0,blockDepth:0,focalDistance:x/S.pts.length})}let s=r.map(m=>Wt(m.pts)),c=[];for(let m=0;m<r.length;m++){let g=1/0;for(let S=0;S<r.length;S++){if(m===S||$e(s[m],s[S])>=g)continue;let x=fe(r[m].pts,r[S].pts);x<g&&(g=x)}Number.isFinite(g)&&c.push(g)}c.sort((m,g)=>m-g);let a=c.length?c[Math.floor(c.length/2)]:1,u=Math.max(a*1.8,1e-6),l=r.map(()=>[]);for(let m=0;m<r.length;m++)for(let g=m+1;g<r.length;g++)$e(s[m],s[g])>u||fe(r[m].pts,r[g].pts)<=u&&(l[m].push(g),l[g].push(m));let d=0;for(let m=0;m<r.length;m++){if(r[m].blockId!==-1)continue;let g=d++,S=[m];for(r[m].blockId=g;S.length;){let x=S.pop();for(let b of l[x])r[b].blockId===-1&&(r[b].blockId=g,S.push(b))}}let f=new Map;for(let m of r){let g=f.get(m.blockId)??[];g.push(m),f.set(m.blockId,g)}let p=[];for(let m of r){if(m.pts.length<4)continue;let g=qt(m.pts);g&&(!Number.isFinite(g.cx)||!Number.isFinite(g.cy)||p.push({x:g.cx,y:g.cy}))}let y=p.length>=2?(()=>{let m=p.map(x=>x.x).sort((x,b)=>x-b),g=p.map(x=>x.y).sort((x,b)=>x-b),S=Math.floor(p.length/2);return{cx:m[S],cy:g[S]}})():null;if(y){let m=v=>Math.hypot(v.x-y.cx,v.y-y.cy),g=1/0,S=-1/0,x=[];for(let v of r){let w=1/0,E=-1/0;for(let C of v.pts){let _=m(C);_<w&&(w=_),_>E&&(E=_)}x.push(E-w),w<g&&(g=w),E>S&&(S=E)}let b=S-g;x.sort((v,w)=>v-w);let M=x[Math.min(x.length-1,Math.floor(x.length*.9))];if(b>1e-9&&M/b<=Jt){let v=r.map(I=>{let N=0;for(let F of I.pts)N+=m(F);return{row:I,radius:N/I.pts.length}}),w=0,E=0;for(let I of v)w+=I.radius,E+=I.row.focalDistance;w/=v.length,E/=v.length;let C=0;for(let I of v)C+=(I.radius-w)*(I.row.focalDistance-E);if(C<0)for(let I of v)I.radius=-I.radius;let k=1/0;for(let I of v)I.radius<k&&(k=I.radius);v.sort((I,N)=>I.radius-N.radius);let H=-1,L=-1/0,A=b/Math.max(1,v.length)*.5,$=[];for(let I of v)I.radius-L>A&&(H++,L=I.radius),I.row.ordinal=H,I.row.blockDepth=I.radius-k,$.push(I.row);return{sectionId:e,rows:$,blockCount:d}}}let h=[];for(let[,m]of f){let g=Zt(m);if(g){let S=b=>{let M=0;for(let v of b.pts)M+=v.x*g.x+v.y*g.y;return M/b.pts.length};m.sort((b,M)=>S(b)-S(M)),m.length>=2&&m[0].focalDistance>m[m.length-1].focalDistance&&m.reverse();let x=0;for(let b=0;b<m.length;b++)b>0&&(x+=fe(m[b-1].pts,m[b].pts)),m[b].ordinal=b,m[b].blockDepth=x,h.push(m[b])}else{let S=1/0;for(let x of m)x.focalDistance<S&&(S=x.focalDistance);m.sort((x,b)=>x.focalDistance-b.focalDistance);for(let x=0;x<m.length;x++)m[x].ordinal=x,m[x].blockDepth=Math.max(0,m[x].focalDistance-S),h.push(m[x])}}return{sectionId:e,rows:h,blockCount:d}}var Eo=[{key:"rect",label:"Flat stage",blurb:"Classic proscenium box."},{key:"rounded",label:"Rounded",blurb:"Softened corners."},{key:"arc",label:"Curved front",blurb:"Front edge bows toward the audience."},{key:"thrust",label:"Thrust (T)",blurb:"Central tongue projects into the crowd."},{key:"runway",label:"Runway",blurb:"Long catwalk into the audience."},{key:"round",label:"In the round",blurb:"Central platform, audience all around."},{key:"pitch-football",label:"Football pitch",blurb:"105 \xD7 68 m pitch with centre circle and penalty boxes."},{key:"rink-hockey",label:"Hockey rink",blurb:"60 \xD7 30 m ice rink with blue lines and faceoff circles."},{key:"track-athletics",label:"Athletics track",blurb:"400 m track: two straights, two semicircles, eight lanes."},{key:"oval-cricket",label:"Cricket oval",blurb:"~150 \xD7 140 m oval with boundary rope and pitch strip."}],en={"pitch-football":{width:105,height:68},"rink-hockey":{width:60,height:30},"track-athletics":{width:176.9,height:92.5},"oval-cricket":{width:150,height:140}};var Je=Math.PI*2;function Ze(e,t,n,i,o,r){return{x:o+e*n-t*i,y:r+e*i+t*n}}function Io(e){let{kind:t,cx:n,cy:i,width:o,height:r}=e,s=(e.rotation??0)*Math.PI/180,c=Math.cos(s),a=Math.sin(s),u=o/2,l=r/2,d=[],f=(p,y)=>{d.push({x:p,y})};switch(t){case"rect":{f(-u,-l),f(u,-l),f(u,l),f(-u,l);break}case"rounded":{let p=Math.min(o,r)*.18,y=5,h=(m,g,S)=>{for(let x=0;x<=y;x++){let b=S+x/y*(Math.PI/2);f(m+p*Math.cos(b),g+p*Math.sin(b))}};h(u-p,-l+p,-Math.PI/2),h(u-p,l-p,0),h(-u+p,l-p,Math.PI/2),h(-u+p,-l+p,Math.PI);break}case"arc":{let p=r*.45;f(-u,-l),f(u,-l);let y=24;for(let h=0;h<=y;h++){let m=h/y,g=u-m*o,S=l+p*(1-Math.pow(2*g/o,2));f(g,S)}break}case"thrust":{let p=o*.18,y=r*1.1;f(-u,-l),f(u,-l),f(u,l),f(p,l),f(p,l+y),f(-p,l+y),f(-p,l),f(-u,l);break}case"runway":{let p=o*.1,y=r*3;f(-u,-l),f(u,-l),f(u,l),f(p,l),f(p,l+y),f(-p,l+y),f(-p,l),f(-u,l);break}case"round":case"oval-cricket":{for(let y=0;y<40;y++){let h=y/40*Je;f(u*Math.cos(h),l*Math.sin(h))}break}case"pitch-football":{f(-u,-l),f(u,-l),f(u,l),f(-u,l);break}case"rink-hockey":{for(let p of tn(u,l,u*(8.5/60),l*(8.5/30)))f(p.x,p.y);break}case"track-athletics":{for(let p of me(u,l))f(p.x,p.y);break}}return d.map(p=>Ze(p.x,p.y,c,a,n,i))}function tn(e,t,n,i){let o=[],s=(c,a,u)=>{for(let l=0;l<=8;l++){let d=u+l/8*(Math.PI/2);o.push({x:c+n*Math.cos(d),y:a+i*Math.sin(d)})}};return s(e-n,-t+i,-Math.PI/2),s(e-n,t-i,0),s(-e+n,t-i,Math.PI/2),s(-e+n,-t+i,Math.PI),o}function me(e,t){let n=Math.max(0,e-t),i=[],o=20;for(let r=0;r<=o;r++){let s=-Math.PI/2+r/o*Math.PI;i.push({x:n+t*Math.cos(s),y:t*Math.sin(s)})}for(let r=0;r<=o;r++){let s=Math.PI/2+r/o*Math.PI;i.push({x:-n+t*Math.cos(s),y:t*Math.sin(s)})}return i}var Po="#f1f5f9";function pe(e){return e==="pitch-football"||e==="rink-hockey"||e==="track-athletics"||e==="oval-cricket"}function J(e,t,n,i,o=32){let r=[];for(let s=0;s<o;s++){let c=s/o*Je;r.push({x:e+n*Math.cos(c),y:t+i*Math.sin(c)})}return r}function he(e,t,n,i){return[{x:e-n,y:t-i},{x:e+n,y:t-i},{x:e+n,y:t+i},{x:e-n,y:t+i}]}function nn(e){let{kind:t,cx:n,cy:i,width:o,height:r}=e,s=(e.rotation??0)*Math.PI/180,c=Math.cos(s),a=Math.sin(s),u=o/2,l=r/2,d=[],f=en[t],p=h=>f?h/f.width*o:0,y=h=>f?h/f.height*r:0;switch(t){case"pitch-football":{d.push({points:[{x:0,y:-l},{x:0,y:l}],closed:!1}),d.push({points:J(0,0,p(9.15),y(9.15)),closed:!0});for(let h of[-1,1])d.push({points:he(h*(u-p(16.5)/2),0,p(16.5)/2,y(40.32)/2),closed:!0}),d.push({points:he(h*(u-p(5.5)/2),0,p(5.5)/2,y(18.32)/2),closed:!0});break}case"rink-hockey":{d.push({points:[{x:0,y:-l},{x:0,y:l}],closed:!1,ink:"#d63b3b"});for(let h of[-1,1]){d.push({points:[{x:h*p(7.5),y:-l},{x:h*p(7.5),y:l}],closed:!1,ink:"#2f6ecb"}),d.push({points:[{x:h*(u-p(4)),y:-y(11)},{x:h*(u-p(4)),y:y(11)}],closed:!1,ink:"#d63b3b"});for(let m of[-1,1])d.push({points:J(h*p(20.5),m*y(7),p(4.5),y(4.5)),closed:!0,ink:"#2f6ecb"})}d.push({points:J(0,0,p(4.5),y(4.5)),closed:!0,ink:"#2f6ecb"});break}case"track-athletics":{let m=l-y(1.22)*8;m>0&&d.push({points:me(u-p(1.22)*8,m),closed:!0,fill:"#2f7d4f"});for(let g=1;g<8;g++){let S=y(1.22)*g,x=l-S;if(x<=0)break;d.push({points:me(u-p(1.22)*g,x),closed:!0})}break}case"oval-cricket":{d.push({points:J(0,0,p(27.4),y(27.4+20.12/2),40),closed:!0}),d.push({points:he(0,0,p(3.05)/2,y(20.12)/2),closed:!0,ink:"#d8cfae"});break}default:return[]}return d.map(h=>({...h,points:h.points.map(m=>Ze(m.x,m.y,c,a,n,i))}))}function Co(e){if(e.role!=="stage"||!pe(e.stageKind))return[];let t=null;if(e.x!=null&&e.y!=null&&e.width!=null&&e.height!=null&&e.width>0&&e.height>0&&[e.x,e.y,e.width,e.height].every(Number.isFinite))t={cx:e.x+e.width/2,cy:e.y+e.height/2,width:e.width,height:e.height};else if(e.points&&e.points.length>=3&&e.points.every(n=>Number.isFinite(n.x)&&Number.isFinite(n.y))){let n=e.points.map(l=>l.x),i=e.points.map(l=>l.y),o=Math.min(...n),r=Math.max(...n),s=Math.min(...i),c=Math.max(...i),a=Math.max(1,r-o),u=Math.max(1,c-s);t={cx:o+a/2,cy:s+u/2,width:a,height:u}}return t?nn({kind:e.stageKind,...t}):[]}function on(e){if((e.kind==="polygon"||e.kind==="polyline"||e.kind==="line")&&e.points&&e.points.length>=2)return e.points;if(e.x==null||e.y==null||e.width==null||e.height==null)return null;let t=e.x,n=e.y,i=e.width,o=e.height;return[{x:t,y:n},{x:t+i,y:n},{x:t+i,y:n+o},{x:t,y:n+o}]}function rn(e,t,n){let i=n*Math.PI/180,o=Math.cos(i),r=Math.sin(i),s=e.x-t.x,c=e.y-t.y;return{x:t.x+s*o-c*r,y:t.y+s*r+c*o}}function Qe(e){let t=on(e);if(!t||t.length<2)return null;let n=e.rotation??0,i=Math.abs(n)<1e-6?t:t.map(a=>rn(a,{x:t.reduce((u,l)=>u+l.x,0)/t.length,y:t.reduce((u,l)=>u+l.y,0)/t.length},n)),o=1/0,r=1/0,s=-1/0,c=-1/0;for(let a of i)o=Math.min(o,a.x),r=Math.min(r,a.y),s=Math.max(s,a.x),c=Math.max(c,a.y);return!Number.isFinite(o)||s-o<1e-6||c-r<1e-6?null:{minX:o,minY:r,maxX:s,maxY:c}}var sn=5,an=3,cn=.92,ln=1.9,un=2,dn=.6,fn=1,hn=.06;function mn(e){return e.heightM!==void 0?e.heightM:pe(e.stageKind)?hn:fn}function et(e){let t=1/0,n=1/0,i=-1/0,o=-1/0,r=-1/0;for(let s of be(e)){let c=s.baseHeightM??0;for(let a of s.objects){if(a.type!=="shape"||a.role!=="stage")continue;let u=Qe(a);u&&(t=Math.min(t,u.minX),n=Math.min(n,u.minY),i=Math.max(i,u.maxX),o=Math.max(o,u.maxY),r=Math.max(r,c+mn(a)))}}return!Number.isFinite(t)||!Number.isFinite(r)?null:{minX:t,minY:n,maxX:i,maxY:o,deckTopM:r}}function pn(e,t,n,i){let o=1/0,r=1/0,s=-1/0,c=-1/0;for(let p of e)Number.isFinite(p.eyeHeightM)&&(o=Math.min(o,p.x),s=Math.max(s,p.x),r=Math.min(r,p.y),c=Math.max(c,p.y));if(!Number.isFinite(o))return null;let a=o*t,u=r*t,l=Math.max(1,Math.ceil((s-o)*t/n)+1),d=Math.max(1,Math.ceil((c-r)*t/n)+1),f=new Float64Array(l*d).fill(-1/0);for(let p of e){if(!Number.isFinite(p.eyeHeightM))continue;let y=p.eyeHeightM-B,h=Math.min(l-1,Math.max(0,Math.floor((p.x*t-a)/n))),g=Math.min(d-1,Math.max(0,Math.floor((p.y*t-u)/n)))*l+h,S=y+i;S>f[g]&&(f[g]=S)}return{cellM:n,minX:a,minY:u,cols:l,rows:d,top:f}}function bn(e,t,n){let i=Math.floor((t-e.minX)/e.cellM),o=Math.floor((n-e.minY)/e.cellM);return i<0||o<0||i>=e.cols||o>=e.rows?-1/0:e.top[o*e.cols+i]}function tt(e,t,n={}){let i=new Map;if(!t||!e.length)return i;let o=n.metresPerChartUnit??G,r=n.cellM??dn,s=n.chairBackM??cn,c=n.selfRowSkipM??un,a=n.clearThreshold??.9,u=n.partialThreshold??.25,l=Math.max(1,n.columns??sn),d=Math.max(1,n.rows??an),f=pn(e,o,r,s);if(!f)return i;let p=(t.maxX-t.minX)*o,y=(t.maxY-t.minY)*o,h=p>=y,m=(t.minX+t.maxX)/2*o,g=(t.minY+t.maxY)/2*o,S=[];for(let b=0;b<l;b++){let M=(b+.5)/l-.5,v=h?m+M*p:m,w=h?g:g+M*y;for(let E=0;E<d;E++){let C=t.deckTopM+(d===1?0:E/(d-1)*ln);S.push({x:v,y:w,z:C})}}let x=r/2;for(let b of e){if(!Number.isFinite(b.eyeHeightM))continue;let M=b.x*o,v=b.y*o,w=b.eyeHeightM,E=0,C=1/0;for(let k of S){let H=k.x-M,L=k.y-v,A=Math.hypot(H,L);if(!(A>c)){E++;continue}let $=H/A,I=L/A,N=0;for(let F=c;F<A;F+=x){let ne=bn(f,M+$*F,v+I*F);if(!(!Number.isFinite(ne)||ne>=w)&&ne>w+(k.z-w)*F/A){N=F;break}}N?C=Math.min(C,N):E++}let _=E/S.length;_>=a||i.set(b.id,{seatId:b.id,mark:_<u?"obstructedView":"restrictedView",visibleFraction:_,totalRays:S.length,atDistanceM:Number.isFinite(C)?C:0})}return i}function nt(e,t){if(!t.size)return 0;let n=0;for(let i of e){let o=t.get(i.id);if(!o)continue;let r=i.commercial;r?.restrictedView!==void 0||r?.obstructedView!==void 0||(i.commercial={...r,[o.mark]:!0},n++)}return n}function ye(e){return e?e.accessibility?.length?e.wheelchairSpaceType&&!e.accessibility.includes("wheelchair")?["wheelchair",...e.accessibility]:e.accessibility:e.wheelchairSpaceType?["wheelchair"]:e.accessible?["wheelchair"]:[]:[]}var ee=Math.PI/180,yn=9,z=16;function ge(e,t,n,i){let o=n*ee,r=Math.cos(o),s=Math.sin(o);return{x:i.x+e*r-t*s,y:i.y+e*s+t*r}}function at(e){let{seatCount:t,seatSpacing:n,curve:i,rotation:o,origin:r}=e,s=[];if(e.path)return Te(e.path,t);if(t<=1)return t===1&&s.push({x:r.x,y:r.y}),s;if(i===0){for(let u=0;u<t;u++)s.push(ge(u*n,0,o,r));return s}let c=i/(t-1)*ee,a=n/(2*Math.sin(Math.abs(c)/2));for(let u=0;u<t;u++){let l=u*c,d=a*Math.sin(l),f=-a+a*Math.cos(l);s.push(ge(d,f,o,r))}return s}function gn(e){let t=new Map;if(e.overrides)for(let n of e.overrides)t.set(n.index,n);return t}function $o(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 xn(e,t){let n=gn(e);return at(e).map((i,o)=>{let r=n.get(o),s=ye(r),c=xe(e,o,r),a={...e.commercial,...r?.commercial};return{index:o,x:i.x+(r?.dx??0),y:i.y+(r?.dy??0),label:c,displayLabel:oe(e,o,t,r),categoryKey:r?.categoryKey??e.categoryKey,skipped:!!r?.skip,accessible:s.length>0,accessibility:s,wheelchairSpaceType:r?.wheelchairSpaceType,commercial:Object.values(a).some(u=>u!==void 0&&u!==!1&&u!=="")?a:void 0,glyph:r?.glyph,viewUrl:r?.viewFromSeatUrl??e.viewFromSeatUrl,viewMeta:r?.viewFromSeatUrl?r.viewFromSeatMeta:e.viewFromSeatMeta,labelStyle:r?.labelStyle??e.seatLabelStyle}})}function ct(e){let t=[];for(let n of xn(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 Sn(e){if(e.seatCountsBySide)return{...e.seatCountsBySide};let t=e.sides&&e.sides.length?e.sides:["top","bottom"],n=["top","bottom","left","right"].filter(r=>t.includes(r)),i={top:0,bottom:0,left:0,right:0};if(!n.length)return i;let o=Math.max(0,Math.round(e.seatCount));for(let r=0;r<o;r++)i[n[r%n.length]]+=1;return i}function lt(e){let t=[],n=Math.max(0,Math.round(e.seatCount));if(n===0)return t;let i=new Map((e.overrides??[]).map(l=>[l.index,l])),o=(l,d,f,p)=>{let y=i.get(l),h=ye(y),m=y?.label??`${e.label}-${l+1}`,g=e.displayLabel??e.label;return{index:l,label:m,displayLabel:y?.displayLabel??`${g}-${l+1}`,x:d+(y?.dx??0),y:f+(y?.dy??0),categoryKey:y?.categoryKey??e.categoryKey,skipped:!!y?.skip,accessible:h.length>0,accessibility:h,wheelchairSpaceType:y?.wheelchairSpaceType,commercial:y?.commercial,glyph:y?.glyph,viewUrl:y?.viewFromSeatUrl,viewMeta:y?.viewFromSeatUrl?y.viewFromSeatMeta:void 0,labelStyle:y?.labelStyle,...p?{side:p}:{}}};if(e.shape==="round"){let l=(e.radius??40)+z,d=e.rotation*ee,f=Math.max(0,Math.min(360,e.seatArc??360));if(f>=360||n===1){for(let m=0;m<n;m++){let g=d+m/n*2*Math.PI;t.push(o(m,e.center.x+l*Math.cos(g),e.center.y+l*Math.sin(g)))}return t}let p=f*ee,y=(2*Math.PI-p)/2,h=d+y;for(let m=0;m<n;m++){let g=h+m/(n-1)*p;t.push(o(m,e.center.x+l*Math.cos(g),e.center.y+l*Math.sin(g)))}return t}let r=e.width??80,s=e.height??50,c=Sn(e),a=["top","bottom","left","right"],u=0;for(let l of a){let d=c[l];for(let f=0;f<d;f++){let p,y;l==="top"?(p=-r/2+(f+.5)*r/d,y=-s/2-z):l==="bottom"?(p=-r/2+(f+.5)*r/d,y=s/2+z):l==="left"?(p=-r/2-z,y=-s/2+(f+.5)*s/d):(p=r/2+z,y=-s/2+(f+.5)*s/d);let h=ge(p,y,e.rotation,e.center);t.push(o(u++,h.x,h.y,l))}}return t}function qo(e){return e.bookAsWhole||e.variableOccupancy?Math.max(0,Math.round(e.seatCount)):lt(e).filter(t=>!t.skipped).length}function Mn(e){return lt(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 vn(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 ot(e,t){let n=!1;for(let i=0,o=t.length-1;i<t.length;o=i++){let r=t[i].x,s=t[i].y,c=t[o].x,a=t[o].y;s>e.y!=a>e.y&&e.x<(c-r)*(e.y-s)/(a-s)+r&&(n=!n)}return n}function wn(e,t){return t.some((n,i)=>{let o=t[(i+1)%t.length],r=(e.y-n.y)*(o.x-n.x)-(e.x-n.x)*(o.y-n.y);if(Math.abs(r)>1e-7)return!1;let s=(e.x-n.x)*(o.x-n.x)+(e.y-n.y)*(o.y-n.y),c=(o.x-n.x)**2+(o.y-n.y)**2;return s>=-1e-7&&s<=c+1e-7})}function te(e,t,n){return ot(e,t)&&!(n??[]).some(i=>ot(e,i)||wn(e,i))}function Jo(e,t){return Ne(e,t).point}function Q(e){if(!e.length)return{x:0,y:0};let t=0,n=0;for(let i of e)t+=i.x,n+=i.y;return{x:t/e.length,y:n/e.length}}function ut(e){switch(e.type){case"row":{let t=ct(e);if(!t.length)return{x:e.origin.x,y:e.origin.y};let n=0,i=0;for(let o of t)n+=o.x,i+=o.y;return{x:n/t.length,y:i/t.length}}case"table":case"booth":return{x:e.center.x,y:e.center.y};case"gaArea":return Q(e.points);case"section":return Q(e.outline);case"text":return{x:e.position.x,y:e.position.y};case"shape":return e.points&&e.points.length?Q(e.points):e.x!=null&&e.y!=null&&e.width!=null&&e.height!=null?{x:e.x+e.width/2,y:e.y+e.height/2}:{x:e.x??0,y:e.y??0};case"decorImage":return{x:e.x+e.width/2,y:e.y+e.height/2}}}function it(e,t){return e.length===t.length&&e.every((n,i)=>n.x===t[i].x&&n.y===t[i].y)}function En(e,t){if(e.type!=="gaArea"||!it(e.points,t.outline))return!1;let n=e.holes??[],i=t.holes??[];return n.length===i.length&&n.every((o,r)=>it(o,i[r]))}function In(e,t,n=e.filter(o=>o.type==="section"),i=ut(t)){let o="referenceInventorySource"in t?t.referenceInventorySource?.logicalSectionId:void 0;return(o?n.find(s=>(s.logicalSectionId??s.id)===o&&(En(t,s)||te(i,s.outline,s.holes))):void 0)??n.find(s=>te(i,s.outline,s.holes))}function be(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 Zo(e,t){let n=be(e);return(t?n.find(i=>i.id===t):n[0])?.objects??[]}function Pn(e){return e.floors&&e.floors.length?e.floors.flatMap(t=>t.objects):e.objects}function Cn(e,t,n){let i=r=>({x:r.x+t,y:r.y+n}),o=r=>r.map(i);switch(e.type){case"row":return{...e,origin:i(e.origin)};case"table":case"booth":return{...e,center:i(e.center)};case"gaArea":return{...e,points:o(e.points),...e.holes?{holes:e.holes.map(o)}:{}};case"section":return{...e,outline:o(e.outline),...e.outlinePath?{outlinePath:Ue(e.outlinePath,t,n)}:{},...e.holes?{holes:e.holes.map(o)}:{}};case"text":return{...e,position:i(e.position)};case"shape":return{...e,...e.points?{points:o(e.points)}:{},...e.x!=null?{x:e.x+t}:{},...e.y!=null?{y:e.y+n}:{}};case"decorImage":return{...e,x:e.x+t,y:e.y+n}}}function Qo(e,t=900){if(!e.floors||e.floors.length<2)return e;let n=[];return e.floors.forEach((i,o)=>{let r=-o*t;for(let s of i.objects)n.push(r===0?s:Cn(s,0,r))}),{...e,objects:n,floors:void 0}}function rt(e,t,n,i,o,r,s,c,a){let u=[],l=e.filter(h=>h.type==="section"),d=Ke(e),f=h=>!h?.eventConfigurationId||h.eventConfigurationId===i&&(h.eventConfigurationVersion===void 0||h.eventConfigurationVersion===a),p=h=>Se(h,{activeConfigurationId:i,activeConfigurationVersion:a,activeBasisSha256:o,now:c}),y=(h,m)=>p(h)?{...h,coverage:m}:void 0;for(let h of e){let m=[];if(h.type==="row"?m=ct(h):h.type==="table"?m=Mn(h):h.type==="booth"&&(m=vn(h)),!m.length)continue;for(let M of m)M.viewUrl&&!f(M.viewMeta)&&(M.viewUrl=void 0,M.viewMeta=void 0);if(h.type==="row"){let M=d.get(h.id);if(M){let v=new Map((h.overrides??[]).map(w=>[w.index,w]));for(let w of m){let E=Number(w.id.slice(w.id.lastIndexOf(":")+1));if(!Number.isInteger(E))continue;w.logicalRowId=M.groupId,w.logicalSeatIndex=M.adjacencyOffset+E,v.get(E)?.displayLabel||(w.displayLabel=oe(h,E,M)),!w.viewUrl&&M.viewFromSeatUrl&&f(M.viewFromSeatMeta)&&(w.viewUrl=M.viewFromSeatUrl,w.viewMeta=M.viewFromSeatMeta);let C=v.get(E)?.confidenceEvidence;w.confidenceEvidence=y(C,"exact-seat")??y(h.confidenceEvidence,"row-representative")??y(M.confidenceEvidence,"row-representative")}}}let g=In(e,h,l,h.type==="row"?Q(m):ut(h)),S=g?.viewFromSeatUrl,b=(g?.zone?t?.find(M=>M.id===g.zone):void 0)?.focalPoint??n;for(let M of m){if(!M.confidenceEvidence){let v=Number(M.id.slice(M.id.lastIndexOf(":")+1)),w=(h.type==="row"||h.type==="table")&&Number.isInteger(v)?h.overrides?.find(E=>E.index===v)?.confidenceEvidence:void 0;M.confidenceEvidence=y(w,"exact-seat")??(h.type==="row"?y(h.confidenceEvidence,"row-representative"):void 0)}M.confidenceEvidence??=y(g?.confidenceEvidence,"section-representative")??(s?y(s.evidence,s.coverage):void 0),!M.viewUrl&&S&&f(g?.viewFromSeatMeta)&&(M.viewUrl=S,M.viewMeta=g?.viewFromSeatMeta),!M.viewUrl&&r&&f(r.meta)&&(M.viewUrl=r.url,M.viewMeta=r.meta),g&&(M.sectionId=g.logicalSectionId??g.id),g?.zone&&(M.zoneId=g.zone),b&&(M.focalPoint={...b})}u.push(...m)}return u}function ei(e,t={}){if(e.floors?.length){let i=[];for(let o of e.floors){let r=o.focalPoint??e.focalPoint,s=o.viewFromSeatUrl?{url:o.viewFromSeatUrl,meta:o.viewFromSeatMeta}:e.viewFromSeatUrl?{url:e.viewFromSeatUrl,meta:e.viewFromSeatMeta}:void 0,c=o.confidenceEvidence?{evidence:o.confidenceEvidence,coverage:"floor-representative"}:e.confidenceEvidence?{evidence:e.confidenceEvidence,coverage:"venue-representative"}:void 0,a=rt(o.objects,e.zones,r,e.eventConfigurationId,e.confidenceBasisSha256,s,c,t.now,t.eventConfigurationVersion??e.eventConfigurationVersion);t.resolveEyeHeights!==!1&&st(o.objects,o.focalPoint??e.focalPoint,o.baseHeightM??0,a);for(let u of a)u.floorId=o.id;i.push(...a)}return i}let n=rt(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&&st(e.objects,e.focalPoint,t.floorBaseHeightM??0,n),_n(e,n,t)}function _n(e,t,n){return!n.deriveRestrictedView||e.derivedRestrictedView===!1||n.resolveEyeHeights===!1||nt(t,tt(t,et(e))),t}function st(e,t,n,i){let o=e.filter(d=>d.type==="section"),r=n>0||o.some(d=>d.height!==void 0||d.rake!==void 0||(d.elevation??0)>0);if(!o.length||!r||!t){for(let d of i)d.eyeHeightM=n+B;return}let s=new Array(i.length),c=new Map;for(let d of o)c.has(d.id)||c.set(d.id,d);let a=new Map,u=new Map;for(let d=0;d<i.length;d++){let f=i[d],y=(f.sectionId?c.get(f.sectionId)??o.find(m=>m.logicalSectionId===f.sectionId&&te({x:f.x,y:f.y},m.outline,m.holes)):void 0)??o.find(m=>te({x:f.x,y:f.y},m.outline,m.holes))??null;if(s[d]=y,!y)continue;a.has(y.id)||a.set(y.id,ze(y,{floorBaseHeightM:n}));let h=u.get(y.id);h?h.push(d):u.set(y.id,[d])}let l=new Array(i.length).fill(void 0);for(let[d,f]of u){let p=a.get(d);if(!p)continue;let y=p.rake>0?Math.tan(p.rake*Math.PI/180):0,h=qe(d,i,f,t);for(let m of h.rows){let g=m.blockDepth*G*y,S=p.height+g;for(let x of m.seatIndices)l[x]=S}}for(let d=0;d<i.length;d++){let f=i[d],p=s[d];if(!p){f.eyeHeightM=n+B;continue}let y=a.get(p.id);f.eyeHeightM=(l[d]??y.height)+B}}var Z=40;function ti(e,t){let n=t?.freeText==="exclude",i=1/0,o=1/0,r=-1/0,s=-1/0,c=(a,u)=>{a<i&&(i=a),u<o&&(o=u),a>r&&(r=a),u>s&&(s=u)};for(let a of Pn(e))if(a.type==="row"){let u=new Map((a.overrides??[]).map(l=>[l.index,l]));at(a).forEach((l,d)=>{let f=u.get(d);f?.skip||c(l.x+(f?.dx??0),l.y+(f?.dy??0))})}else if(a.type==="gaArea")for(let u of a.points)c(u.x,u.y);else if(a.type==="section")for(let u of a.outline)c(u.x,u.y);else if(a.type==="decorImage")c(a.x,a.y),c(a.x+a.width,a.y+a.height);else if(a.type==="shape")if(a.points&&a.points.length)for(let u of a.points)c(u.x,u.y);else a.x!=null&&a.y!=null&&a.width!=null&&a.height!=null&&(c(a.x,a.y),c(a.x+a.width,a.y+a.height));else if(a.type==="table"){let u=z+yn,l=a.shape==="round"?(a.radius??40)+u:Math.max((a.width??80)/2,(a.height??50)/2)+u;c(a.center.x-l,a.center.y-l),c(a.center.x+l,a.center.y+l)}else if(a.type==="booth"){let u=Math.max(a.width,a.height)/2;c(a.center.x-u,a.center.y-u),c(a.center.x+u,a.center.y+u)}else if(a.type==="text"){if(n)continue;let u=_e(a);c(a.position.x,a.position.y),c(a.position.x+u.width,a.position.y+u.height)}for(let a of[e.referenceImage,e.backgroundImage]){if(!a)continue;let{center:u,width:l}=a,d=l*3/4;c(u.x-l/2,u.y-d/2),c(u.x+l/2,u.y+d/2)}if(!isFinite(i)){let a=e.focalPoint??{x:0,y:0};return{x:a.x-200,y:a.y-200,width:400,height:400}}return{x:i-Z,y:o-Z,width:r-i+Z*2,height:s-o+Z*2}}export{kn as a,ht as b,Me as c,Y as d,ie as e,On as f,An as g,jn as h,Ln as i,Nn as j,Fn as k,Dn as l,Vn as m,Un as n,Kn as o,Xn as p,Gn as q,Bn as r,zn as s,Yn as t,Wn as u,_e as v,qn as w,It as x,Jn as y,ae as z,eo as A,Te as B,to as C,no as D,Ct as E,Le as F,io as G,Ne as H,kt as I,so as J,uo as K,Ve as L,fo as M,Ue as N,At as O,jt as P,Nt as Q,ho as R,Dt as S,Ut as T,mo as U,bo as V,yo as W,go as X,Ke as Y,G as Z,So as _,Xt as $,Xe as aa,Be as ba,Ge as ca,ue as da,Gt as ea,Bt as fa,zt as ga,B as ha,Mo as ia,ze as ja,We as ka,qt as la,qe as ma,Eo as na,Io as oa,Po as pa,pe as qa,Co as ra,ye as sa,z as ta,at as ua,$o as va,xn as wa,ct as xa,Sn as ya,lt as za,qo as Aa,Mn as Ba,vn as Ca,ot as Da,te as Ea,Jo as Fa,ut as Ga,In as Ha,be as Ia,Zo as Ja,Pn as Ka,Cn as La,Qo as Ma,ei as Na,ti as Oa};
@@ -1 +1 @@
1
- import{Ba as B,Ka as M,Na as K}from"./chunk-E7TOTX6I.js";function S(t){let n=Number(t.slice(t.lastIndexOf(":")+1));return Number.isFinite(n)?n:-1}function te(t,n,i){let e=new Map;for(let a of t){if(a.kind==="booth")continue;let r=e.get(a.rowId);r?r.push(a):e.set(a.rowId,[a])}let u=a=>i.has(a.id)||n(a.id)!=="free",s=[];for(let a of e.values())if(!(a.length<3)){a.sort((r,l)=>S(r.id)-S(l.id));for(let r=1;r<a.length-1;r++){let l=a[r];if(u(l))continue;let g=a[r-1],m=a[r+1];S(l.id)-S(g.id)!==1||S(m.id)-S(l.id)!==1||!u(g)||!u(m)||!i.has(g.id)&&!i.has(m.id)||s.push(l)}}return s}function $(t){return Array.isArray(t.objects)}function j(t,n){if(n.seatsByLabel)return n.seatsByLabel;if(!$(t))throw new Error("ticketRestrictions: a categories-only chart document requires options.seatsByLabel");return new Map(K(t,{resolveEyeHeights:!1}).map(i=>[i.label,i]))}function H(t){return{code:"ticket_option_not_applicable",labels:t,message:"That ticket choice is not available for the selected seat."}}function R(t,n){let i=t.applicability;return i?!(i.seatLabels?.length&&!i.seatLabels.includes(n.label)||i.accessibility?.length&&!i.accessibility.some(e=>n.accessibility?.includes(e))):!0}function oe(t,n){return(t.categories.find(i=>i.key===n.categoryKey)?.tiers??[]).filter(i=>R(i,n))}function F(t,n,i){let e=t.categories.find(s=>s.key===n.categoryKey)?.tiers;if(!e?.length)return{kind:"none"};let u=i==null?e.find(s=>R(s,n)):e.find(s=>s.id===i&&R(s,n));return u?{kind:"resolved",tier:u}:{kind:"invalid"}}function Y(t,n){return(t.logicalRowId??t.rowId)===(n.logicalRowId??n.rowId)}function L(t){if(Number.isInteger(t.logicalSeatIndex))return t.logicalSeatIndex;let n=t.id.slice(t.id.lastIndexOf(":")+1),i=Number(n);return Number.isInteger(i)?i:void 0}function J(t,n){if(!Y(t,n))return!1;let i=L(t),e=L(n);return i!=null&&e!=null&&Math.abs(i-e)===1}function Q(t,n,i={}){if(!n.length)return null;let e=j(t,i),u=n.flatMap(r=>{let l=e.get(r.label);return l?[{selection:r,seat:l}]:[]}),s=u.map(({seat:r})=>r).filter(r=>r.accessibility?.includes("wheelchair")),a=[];for(let{selection:r,seat:l}of u){let g=F(t,l,r.tierId),m=g.kind==="resolved"?g.tier:void 0;(l.accessibility?.includes("companion")||m?.restriction==="companion")&&!s.some(h=>h.id!==l.id&&J(l,h))&&a.push(l.label)}return a.length?{code:"companion_pair_required",labels:a,message:"Select the adjacent wheelchair place with each companion ticket."}:null}function re(t,n,i={}){if(!n.length)return null;let e=j(t,i),u=new Set(t.categories.filter(r=>r.notForSale).map(r=>r.key)),s=[],a=[];for(let r of n){let l=e.get(r.label);if(!l)continue;if(u.has(l.categoryKey)){s.push(l.label);continue}F(t,l,r.tierId).kind==="invalid"&&a.push(l.label)}return s.length?{code:"not_for_sale",labels:s,message:"These seats are not for sale."}:a.length?H(a):Q(t,n,{seatsByLabel:e})}function D(t,n){if(Number.isInteger(t.logicalSeatIndex))return t.logicalSeatIndex;let i=t.id.lastIndexOf(":");if(i<0)return n;let e=Number(t.id.slice(i+1));return Number.isFinite(e)?e:n}function T(t,n){let i=t.x-n.x,e=t.y-n.y;return i*i+e*e}function E(t){let n=0,i=0;for(let e of t)n+=e.x,i+=e.y;return{x:n/t.length,y:i/t.length}}function q(t,n){return t.find(i=>i.focalPoint)?.focalPoint??n}function P(t){return t.commercial?.premium===!0}function X(t,n,i){let e=Math.floor(i.qty);if(!Number.isFinite(e)||e<=0)return{labels:[],reason:"sold_out"};let{categoryKey:u,zoneId:s,focal:a,preferPremium:r,preferNearest:l,preferredRowIds:g,accessibility:m,requireContiguous:d}=i,h=new Map,w=[];if(t.forEach((o,c)=>{let p=n.has(o.label)&&(!u||o.categoryKey===u)&&(!s||o.zoneId===s)&&(!m||m.some(I=>o.accessibility?.includes(I))),y=o.logicalRowId??o.rowId,b=h.get(y);b||(b=[],h.set(y,b)),b.push({seat:o,index:D(o,c),elig:p}),p&&w.push(o)}),w.length===0)return{labels:[],reason:"sold_out"};let O=new Map([...h].map(([o,c])=>[o,E(c.map(p=>p.seat))])),A=(g??[]).map(o=>O.get(o)).filter(o=>!!o),_=o=>{let c=O.get(o);return!c||!A.length?0:Math.min(...A.map(p=>T(c,p)))},f=null,z=o=>{if(!f)return!0;if(r&&o.nonPremium!==f.nonPremium)return o.nonPremium<f.nonPremium;if(l&&o.rowD2!==f.rowD2)return o.rowD2<f.rowD2;if(l&&o.d2!==f.d2)return o.d2<f.d2;if(o.orphan!==f.orphan)return o.orphan<f.orphan;if(o.d2!==f.d2)return o.d2<f.d2;let c=o.rowId.localeCompare(f.rowId);return c!==0?c<0:o.startIndex<f.startIndex};for(let[o,c]of h){let p=[...c].sort((b,I)=>b.index-I.index),y=0;for(;y<p.length;){if(!p[y].elig){y++;continue}let b=y;for(;b<p.length&&p[b].elig&&(b===y||p[b].index===p[b-1].index+1);)b++;let I=b-y;for(let x=0;x+e<=I;x++){let G=x,U=I-(x+e),V=G===1||U===1?1:0,k=p.slice(y+x,y+x+e).map(C=>C.seat),N={labels:k.map(C=>C.label),seats:k,rowId:o,startIndex:p[y+x].index,orphan:V,nonPremium:r?k.reduce((C,W)=>C+(P(W)?0:1),0):0,rowD2:_(o),d2:T(E(k),l?a:q(k,a))};z(N)&&(f=N)}y=b}}return f?{labels:f.labels}:d?{labels:[],reason:w.length?"not_enough_together":"sold_out"}:w.length<e?{labels:[],reason:"not_enough_together"}:{labels:w.map((o,c)=>({seat:o,i:c,rowD2:_(o.logicalRowId??o.rowId),d2:T(o,l?a:o.focalPoint??a)})).sort((o,c)=>{if(r){let y=P(o.seat)?0:1,b=P(c.seat)?0:1;if(y!==b)return y-b}if(l&&o.rowD2!==c.rowD2)return o.rowD2-c.rowD2;if(o.d2!==c.d2)return o.d2-c.d2;let p=(o.seat.logicalRowId??o.seat.rowId).localeCompare(c.seat.logicalRowId??c.seat.rowId);return p!==0?p:D(o.seat,o.i)-D(c.seat,c.i)}).slice(0,e).map(o=>o.seat.label)}}function le(t,n,i,e){let u=Math.floor(e.qty),s=X(t,i,e),r=n.filter(d=>d.bookingMode==="whole"&&d.capacity===u&&i.has(d.label)&&(!e.categoryKey||d.categoryKey===e.categoryKey)&&(!e.zoneId||d.zoneId===e.zoneId)&&!e.accessibility).map(d=>({table:d,d2:T(d.center,e.preferNearest?e.focal:d.focalPoint??e.focal)})).sort((d,h)=>d.d2-h.d2||d.table.label.localeCompare(h.table.label))[0];if(!r)return s;if(!s.labels.length)return{labels:[r.table.label]};let l=new Map(t.map(d=>[d.label,d])),g=s.labels.map(d=>l.get(d)).filter(d=>!!d),m=g.length?T(E(g),q(g,e.focal)):Number.POSITIVE_INFINITY;return r.d2<m?{labels:[r.table.label]}:s}var v=class extends Error{constructor(i,e){super(e);this.objectId=i;this.name="GroupedTableProjectionError"}};function Z(t){let n=t.minOccupancy,i=t.maxOccupancy;if(!Number.isInteger(n)||!Number.isInteger(i)||n<1||i<n||i>t.seatCount)throw new v(t.id,`Table "${t.label}" has invalid variable-occupancy bounds`);return{min:n,max:i}}function de(t,n){if(n!==2)return[];let i=[];for(let e of M(t)){if(e.type!=="table"||!e.bookAsWhole&&!e.variableOccupancy)continue;if(e.bookAsWhole&&e.variableOccupancy)throw new v(e.id,`Table "${e.label}" cannot be whole-table and variable-occupancy inventory`);if(!Number.isInteger(e.seatCount)||e.seatCount<1||!e.label.trim())throw new v(e.id,"Grouped tables require a label and at least one chair");let u=e.variableOccupancy?"variable":"whole",s=u==="variable"?Z(e):{min:e.seatCount,max:e.seatCount};i.push({objectId:e.id,label:e.label,...e.displayLabel?{displayLabel:e.displayLabel}:{},...e.displayType?{displayType:e.displayType}:{},categoryKey:e.categoryKey,mode:u,capacity:e.seatCount,minOccupancy:s.min,maxOccupancy:s.max,chairs:B(e)})}return i}export{te as a,$ as b,H as c,R as d,oe as e,F as f,Q as g,re as h,X as i,le as j,v as k,de as l};
1
+ import{Ba as B,Ka as M,Na as K}from"./chunk-W4RS6OW7.js";function S(t){let n=Number(t.slice(t.lastIndexOf(":")+1));return Number.isFinite(n)?n:-1}function te(t,n,i){let e=new Map;for(let a of t){if(a.kind==="booth")continue;let r=e.get(a.rowId);r?r.push(a):e.set(a.rowId,[a])}let u=a=>i.has(a.id)||n(a.id)!=="free",s=[];for(let a of e.values())if(!(a.length<3)){a.sort((r,l)=>S(r.id)-S(l.id));for(let r=1;r<a.length-1;r++){let l=a[r];if(u(l))continue;let g=a[r-1],m=a[r+1];S(l.id)-S(g.id)!==1||S(m.id)-S(l.id)!==1||!u(g)||!u(m)||!i.has(g.id)&&!i.has(m.id)||s.push(l)}}return s}function $(t){return Array.isArray(t.objects)}function j(t,n){if(n.seatsByLabel)return n.seatsByLabel;if(!$(t))throw new Error("ticketRestrictions: a categories-only chart document requires options.seatsByLabel");return new Map(K(t,{resolveEyeHeights:!1}).map(i=>[i.label,i]))}function H(t){return{code:"ticket_option_not_applicable",labels:t,message:"That ticket choice is not available for the selected seat."}}function R(t,n){let i=t.applicability;return i?!(i.seatLabels?.length&&!i.seatLabels.includes(n.label)||i.accessibility?.length&&!i.accessibility.some(e=>n.accessibility?.includes(e))):!0}function oe(t,n){return(t.categories.find(i=>i.key===n.categoryKey)?.tiers??[]).filter(i=>R(i,n))}function F(t,n,i){let e=t.categories.find(s=>s.key===n.categoryKey)?.tiers;if(!e?.length)return{kind:"none"};let u=i==null?e.find(s=>R(s,n)):e.find(s=>s.id===i&&R(s,n));return u?{kind:"resolved",tier:u}:{kind:"invalid"}}function Y(t,n){return(t.logicalRowId??t.rowId)===(n.logicalRowId??n.rowId)}function L(t){if(Number.isInteger(t.logicalSeatIndex))return t.logicalSeatIndex;let n=t.id.slice(t.id.lastIndexOf(":")+1),i=Number(n);return Number.isInteger(i)?i:void 0}function J(t,n){if(!Y(t,n))return!1;let i=L(t),e=L(n);return i!=null&&e!=null&&Math.abs(i-e)===1}function Q(t,n,i={}){if(!n.length)return null;let e=j(t,i),u=n.flatMap(r=>{let l=e.get(r.label);return l?[{selection:r,seat:l}]:[]}),s=u.map(({seat:r})=>r).filter(r=>r.accessibility?.includes("wheelchair")),a=[];for(let{selection:r,seat:l}of u){let g=F(t,l,r.tierId),m=g.kind==="resolved"?g.tier:void 0;(l.accessibility?.includes("companion")||m?.restriction==="companion")&&!s.some(h=>h.id!==l.id&&J(l,h))&&a.push(l.label)}return a.length?{code:"companion_pair_required",labels:a,message:"Select the adjacent wheelchair place with each companion ticket."}:null}function re(t,n,i={}){if(!n.length)return null;let e=j(t,i),u=new Set(t.categories.filter(r=>r.notForSale).map(r=>r.key)),s=[],a=[];for(let r of n){let l=e.get(r.label);if(!l)continue;if(u.has(l.categoryKey)){s.push(l.label);continue}F(t,l,r.tierId).kind==="invalid"&&a.push(l.label)}return s.length?{code:"not_for_sale",labels:s,message:"These seats are not for sale."}:a.length?H(a):Q(t,n,{seatsByLabel:e})}function D(t,n){if(Number.isInteger(t.logicalSeatIndex))return t.logicalSeatIndex;let i=t.id.lastIndexOf(":");if(i<0)return n;let e=Number(t.id.slice(i+1));return Number.isFinite(e)?e:n}function T(t,n){let i=t.x-n.x,e=t.y-n.y;return i*i+e*e}function E(t){let n=0,i=0;for(let e of t)n+=e.x,i+=e.y;return{x:n/t.length,y:i/t.length}}function q(t,n){return t.find(i=>i.focalPoint)?.focalPoint??n}function P(t){return t.commercial?.premium===!0}function X(t,n,i){let e=Math.floor(i.qty);if(!Number.isFinite(e)||e<=0)return{labels:[],reason:"sold_out"};let{categoryKey:u,zoneId:s,focal:a,preferPremium:r,preferNearest:l,preferredRowIds:g,accessibility:m,requireContiguous:d}=i,h=new Map,w=[];if(t.forEach((o,c)=>{let p=n.has(o.label)&&(!u||o.categoryKey===u)&&(!s||o.zoneId===s)&&(!m||m.some(I=>o.accessibility?.includes(I))),y=o.logicalRowId??o.rowId,b=h.get(y);b||(b=[],h.set(y,b)),b.push({seat:o,index:D(o,c),elig:p}),p&&w.push(o)}),w.length===0)return{labels:[],reason:"sold_out"};let O=new Map([...h].map(([o,c])=>[o,E(c.map(p=>p.seat))])),A=(g??[]).map(o=>O.get(o)).filter(o=>!!o),_=o=>{let c=O.get(o);return!c||!A.length?0:Math.min(...A.map(p=>T(c,p)))},f=null,z=o=>{if(!f)return!0;if(r&&o.nonPremium!==f.nonPremium)return o.nonPremium<f.nonPremium;if(l&&o.rowD2!==f.rowD2)return o.rowD2<f.rowD2;if(l&&o.d2!==f.d2)return o.d2<f.d2;if(o.orphan!==f.orphan)return o.orphan<f.orphan;if(o.d2!==f.d2)return o.d2<f.d2;let c=o.rowId.localeCompare(f.rowId);return c!==0?c<0:o.startIndex<f.startIndex};for(let[o,c]of h){let p=[...c].sort((b,I)=>b.index-I.index),y=0;for(;y<p.length;){if(!p[y].elig){y++;continue}let b=y;for(;b<p.length&&p[b].elig&&(b===y||p[b].index===p[b-1].index+1);)b++;let I=b-y;for(let x=0;x+e<=I;x++){let G=x,U=I-(x+e),V=G===1||U===1?1:0,k=p.slice(y+x,y+x+e).map(C=>C.seat),N={labels:k.map(C=>C.label),seats:k,rowId:o,startIndex:p[y+x].index,orphan:V,nonPremium:r?k.reduce((C,W)=>C+(P(W)?0:1),0):0,rowD2:_(o),d2:T(E(k),l?a:q(k,a))};z(N)&&(f=N)}y=b}}return f?{labels:f.labels}:d?{labels:[],reason:w.length?"not_enough_together":"sold_out"}:w.length<e?{labels:[],reason:"not_enough_together"}:{labels:w.map((o,c)=>({seat:o,i:c,rowD2:_(o.logicalRowId??o.rowId),d2:T(o,l?a:o.focalPoint??a)})).sort((o,c)=>{if(r){let y=P(o.seat)?0:1,b=P(c.seat)?0:1;if(y!==b)return y-b}if(l&&o.rowD2!==c.rowD2)return o.rowD2-c.rowD2;if(o.d2!==c.d2)return o.d2-c.d2;let p=(o.seat.logicalRowId??o.seat.rowId).localeCompare(c.seat.logicalRowId??c.seat.rowId);return p!==0?p:D(o.seat,o.i)-D(c.seat,c.i)}).slice(0,e).map(o=>o.seat.label)}}function le(t,n,i,e){let u=Math.floor(e.qty),s=X(t,i,e),r=n.filter(d=>d.bookingMode==="whole"&&d.capacity===u&&i.has(d.label)&&(!e.categoryKey||d.categoryKey===e.categoryKey)&&(!e.zoneId||d.zoneId===e.zoneId)&&!e.accessibility).map(d=>({table:d,d2:T(d.center,e.preferNearest?e.focal:d.focalPoint??e.focal)})).sort((d,h)=>d.d2-h.d2||d.table.label.localeCompare(h.table.label))[0];if(!r)return s;if(!s.labels.length)return{labels:[r.table.label]};let l=new Map(t.map(d=>[d.label,d])),g=s.labels.map(d=>l.get(d)).filter(d=>!!d),m=g.length?T(E(g),q(g,e.focal)):Number.POSITIVE_INFINITY;return r.d2<m?{labels:[r.table.label]}:s}var v=class extends Error{constructor(i,e){super(e);this.objectId=i;this.name="GroupedTableProjectionError"}};function Z(t){let n=t.minOccupancy,i=t.maxOccupancy;if(!Number.isInteger(n)||!Number.isInteger(i)||n<1||i<n||i>t.seatCount)throw new v(t.id,`Table "${t.label}" has invalid variable-occupancy bounds`);return{min:n,max:i}}function de(t,n){if(n!==2)return[];let i=[];for(let e of M(t)){if(e.type!=="table"||!e.bookAsWhole&&!e.variableOccupancy)continue;if(e.bookAsWhole&&e.variableOccupancy)throw new v(e.id,`Table "${e.label}" cannot be whole-table and variable-occupancy inventory`);if(!Number.isInteger(e.seatCount)||e.seatCount<1||!e.label.trim())throw new v(e.id,"Grouped tables require a label and at least one chair");let u=e.variableOccupancy?"variable":"whole",s=u==="variable"?Z(e):{min:e.seatCount,max:e.seatCount};i.push({objectId:e.id,label:e.label,...e.displayLabel?{displayLabel:e.displayLabel}:{},...e.displayType?{displayType:e.displayType}:{},categoryKey:e.categoryKey,mode:u,capacity:e.seatCount,minOccupancy:s.min,maxOccupancy:s.max,chairs:B(e)})}return i}export{te as a,$ as b,H as c,R as d,oe as e,F as f,Q as g,re as h,X as i,le as j,v as k,de as l};