@seatlayer/core 0.75.1 → 0.75.2

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 (70) hide show
  1. package/dist/{categoryInventory-DFp26meo.d.cts → categoryInventory-CBuJy9KM.d.cts} +1 -1
  2. package/dist/{categoryInventory-C5I2U-EM.d.ts → categoryInventory-Cy5pQ0KW.d.ts} +1 -1
  3. package/dist/chunk-24O23MNB.js +1 -0
  4. package/dist/chunk-BT2KJXQC.js +1 -0
  5. package/dist/{chunk-3L4M7L5I.js → chunk-BXU5D2Q5.js} +1 -1
  6. package/dist/chunk-FGMGDTMR.js +1 -0
  7. package/dist/{chunk-KHFCTR3V.js → chunk-JQL77POQ.js} +1 -1
  8. package/dist/{chunk-UVAV3E7K.js → chunk-NQZAZFAC.js} +1 -1
  9. package/dist/{chunk-OGIAQX62.js → chunk-O5UH442K.js} +1 -1
  10. package/dist/{chunk-TN6DFYEV.js → chunk-PRED5KHO.js} +1 -1
  11. package/dist/{chunk-N3DPHRJ3.js → chunk-Q3U3F4YJ.js} +1 -1
  12. package/dist/{chunk-YACNGDTE.js → chunk-WXGW2SYC.js} +1 -1
  13. package/dist/{chunk-FMZ6HLDH.js → chunk-XD2P4ZS4.js} +1 -1
  14. package/dist/core/chart-ops/index.cjs +1 -1
  15. package/dist/core/chart-ops/index.d.cts +7 -5
  16. package/dist/core/chart-ops/index.d.ts +7 -5
  17. package/dist/core/chart-ops/index.js +1 -1
  18. package/dist/core/inventory/index.cjs +1 -1
  19. package/dist/core/inventory/index.d.cts +4 -4
  20. package/dist/core/inventory/index.d.ts +4 -4
  21. package/dist/core/inventory/index.js +1 -1
  22. package/dist/core/layout/index.cjs +1 -1
  23. package/dist/core/layout/index.d.cts +5 -5
  24. package/dist/core/layout/index.d.ts +5 -5
  25. package/dist/core/layout/index.js +1 -1
  26. package/dist/core/quality/index.cjs +1 -1
  27. package/dist/core/quality/index.d.cts +18 -14
  28. package/dist/core/quality/index.d.ts +18 -14
  29. package/dist/core/quality/index.js +1 -1
  30. package/dist/core/render-assets/index.d.cts +1 -1
  31. package/dist/core/render-assets/index.d.ts +1 -1
  32. package/dist/core/seatConfidence.d.cts +1 -1
  33. package/dist/core/seatConfidence.d.ts +1 -1
  34. package/dist/core/sections/index.cjs +1 -1
  35. package/dist/core/sections/index.d.cts +5 -5
  36. package/dist/core/sections/index.d.ts +5 -5
  37. package/dist/core/sections/index.js +1 -1
  38. package/dist/{eventConfigurations-DAaOaKJK.d.cts → eventConfigurations-CqfrYWAb.d.cts} +1 -1
  39. package/dist/{eventConfigurations-BQGuLLv0.d.ts → eventConfigurations-Dhauc9V3.d.ts} +1 -1
  40. package/dist/index.cjs +1 -1
  41. package/dist/index.d.cts +16 -16
  42. package/dist/index.d.ts +16 -16
  43. package/dist/index.js +1 -1
  44. package/dist/{labeling-BZp91HiS.d.cts → labeling-B1xsmowB.d.cts} +1 -1
  45. package/dist/{labeling-Duul2sao.d.ts → labeling-BwPEI5JN.d.ts} +1 -1
  46. package/dist/{renderedQuality-CEPse8ir.d.cts → renderedQuality-1E9KuJvY.d.cts} +1 -1
  47. package/dist/{renderedQuality-BYhJ3Cer.d.ts → renderedQuality-ChAZNV2N.d.ts} +1 -1
  48. package/dist/{renderer-Cv_gzYvT.d.cts → renderer-BRmVrITG.d.cts} +1 -1
  49. package/dist/{renderer-BlLKrW-U.d.ts → renderer-q7viZLGZ.d.ts} +1 -1
  50. package/dist/{sections-DIVvr8QN.d.ts → sections-ByTMouG8.d.ts} +1 -1
  51. package/dist/{sections-CRSGPI3T.d.cts → sections-CA-bBex5.d.cts} +1 -1
  52. package/dist/{segmentedRowModel-CvyOS6Bx.d.cts → segmentedRowModel-C7XOEjHk.d.cts} +1 -1
  53. package/dist/{segmentedRowModel-CD-YT9bT.d.ts → segmentedRowModel-DcvJVKLD.d.ts} +1 -1
  54. package/dist/{layout-Gkx3fo5_.d.cts → tableSizing-BdCyNeqX.d.cts} +14 -4
  55. package/dist/{layout-DGbWo5fV.d.ts → tableSizing-D8e8QAJ-.d.ts} +14 -4
  56. package/dist/{ticketRestrictions-C31mrE97.d.cts → ticketRestrictions-CPZglNvw.d.cts} +2 -2
  57. package/dist/{ticketRestrictions-DXO2eckD.d.ts → ticketRestrictions-CorjMY49.d.ts} +2 -2
  58. package/dist/{types-BVRza86Q.d.ts → types-CqaNLbU6.d.cts} +10 -4
  59. package/dist/{types-BVRza86Q.d.cts → types-CqaNLbU6.d.ts} +10 -4
  60. package/dist/view3d/crossfade/panorama.d.cts +1 -1
  61. package/dist/view3d/crossfade/panorama.d.ts +1 -1
  62. package/dist/view3d/index.cjs +6 -6
  63. package/dist/view3d/index.d.cts +3 -3
  64. package/dist/view3d/index.d.ts +3 -3
  65. package/dist/view3d/index.js +1 -1
  66. package/dist/view3d/scene/scene.worker.cjs +1 -1
  67. package/dist/view3d/scene/scene.worker.js +1 -1
  68. package/package.json +1 -1
  69. package/dist/chunk-QUOAQQMP.js +0 -1
  70. package/dist/chunk-X2GZ5O7C.js +0 -1
@@ -1 +1 @@
1
- import{a as An,c as Pn,d as In}from"./chunk-TN6DFYEV.js";import{f as hn,m as gn,o as Nt,p as ft,r as It,u as Rn}from"./chunk-YACNGDTE.js";import{e as Mn,k as Sn}from"./chunk-UL5OIGIF.js";import{Ma as qt,f as bn,ga as ut,ha as lt,qa as Gt,sa as dn,ta as Dt,va as yn,x as pn,y as At,za as xn}from"./chunk-QUOAQQMP.js";import{A as Pt,d as H,y as nt}from"./chunk-JBOTRSMY.js";import Re from"earcut";import Ae from"polygon-clipping";var g=ut,Pe=.002;function Ie(t,n,e){let i=Math.hypot(n[0]-t[0],n[1]-t[1],n[2]-t[2]),o=Math.hypot(e[0]-n[0],e[1]-n[1],e[2]-n[2]),a=Math.hypot(t[0]-e[0],t[1]-e[1],t[2]-e[2]),r=Math.max(i,o,a);if(r<1e-9)return!0;let s=(i+o+a)/2;return 2*Math.sqrt(Math.max(0,s*(s-i)*(s-o)*(s-a)))/r<Pe}var ht=class{constructor(n=16384){this.len=0;this.buf=new Float32Array(n)}push3(n,e,i){this.len+3>this.buf.length&&this.grow(this.len+3),this.buf[this.len++]=n,this.buf[this.len++]=e,this.buf[this.len++]=i}push1(n){this.len+1>this.buf.length&&this.grow(this.len+1),this.buf[this.len++]=n}grow(n){let e=this.buf.length*2;for(;e<n;)e*=2;let i=new Float32Array(e);i.set(this.buf.subarray(0,this.len)),this.buf=i}get length(){return this.len}toArray(){return this.buf.slice(0,this.len)}},Yt=class{constructor(){this.pos=new ht;this.nor=new ht;this.col=new ht;this.flr=new ht;this.mat=new ht;this.currentFloor=0;this.currentMaterial=0}setFloor(n){this.currentFloor=n}setMaterial(n){this.currentMaterial=n}tri(n,e,i,o,a,r=a,s=a){Ie(n,e,i)||(this.pos.push3(n[0],n[1],n[2]),this.pos.push3(e[0],e[1],e[2]),this.pos.push3(i[0],i[1],i[2]),this.nor.push3(o[0],o[1],o[2]),this.nor.push3(o[0],o[1],o[2]),this.nor.push3(o[0],o[1],o[2]),this.col.push3(a[0],a[1],a[2]),this.col.push3(r[0],r[1],r[2]),this.col.push3(s[0],s[1],s[2]),this.flr.push1(this.currentFloor),this.flr.push1(this.currentFloor),this.flr.push1(this.currentFloor),this.mat.push1(this.currentMaterial),this.mat.push1(this.currentMaterial),this.mat.push1(this.currentMaterial))}triN(n,e,i,o,a,r,s,l=s,c=s){[...n,...e,...i].every(Number.isFinite)&&(this.pos.push3(n[0],n[1],n[2]),this.pos.push3(e[0],e[1],e[2]),this.pos.push3(i[0],i[1],i[2]),this.nor.push3(o[0],o[1],o[2]),this.nor.push3(a[0],a[1],a[2]),this.nor.push3(r[0],r[1],r[2]),this.col.push3(s[0],s[1],s[2]),this.col.push3(l[0],l[1],l[2]),this.col.push3(c[0],c[1],c[2]),this.flr.push1(this.currentFloor),this.flr.push1(this.currentFloor),this.flr.push1(this.currentFloor),this.mat.push1(this.currentMaterial),this.mat.push1(this.currentMaterial),this.mat.push1(this.currentMaterial))}get vertexCount(){return this.pos.length/3}build(){return{position:this.pos.toArray(),normal:this.nor.toArray(),color:this.col.toArray(),floor:this.flr.toArray(),material:this.mat.toArray(),count:this.pos.length/3}}};function we(t,n,e){let i=n[0]-t[0],o=n[1]-t[1],a=n[2]-t[2],r=e[0]-t[0],s=e[1]-t[1],l=e[2]-t[2],c=o*l-a*s,f=a*r-i*l,m=i*s-o*r,u=Math.hypot(c,f,m)||1;return c/=u,f/=u,m/=u,[c,f,m]}function _e(t,n){let e=[...t],i=[];for(let r of t)i.push(r.x,r.y);let o=[];if(n){for(let r of n)if(!(r.length<3)){o.push(e.length);for(let s of r)e.push(s),i.push(s.x,s.y)}}let a=Re(i,o.length?o:void 0,2);return{pts:e,tris:a}}function Jt(t){return ft(t)<0?[...t].reverse():t}var Te=3;function Be(t,n,e,i){let o=i(t),a=i(n),r=i(e),s=(h,b,p,y)=>Math.abs(i({x:(h.x+b.x)/2,y:(h.y+b.y)/2})-(p+y)/2),l=(t.x+n.x+e.x)/3,c=(t.y+n.y+e.y)/3,f=(o+a+r)/3,m=Math.max(s(t,n,o,a),s(n,e,a,r),s(e,t,r,o),Math.abs(i({x:l,y:c})-f)),u=(h,b,p)=>{let y=Math.abs(i({x:(h+l)/2,y:(b+c)/2})-(p+f)/2);y>m&&(m=y)};return u((t.x+n.x)/2,(t.y+n.y)/2,(o+a)/2),u((n.x+e.x)/2,(n.y+e.y)/2,(a+r)/2),u((e.x+t.x)/2,(e.y+t.y)/2,(r+o)/2),m}function wt(t,n,e,i,o){if(o<=0)return Be(t,n,e,i);let a={x:(t.x+n.x)/2,y:(t.y+n.y)/2},r={x:(n.x+e.x)/2,y:(n.y+e.y)/2},s={x:(e.x+t.x)/2,y:(e.y+t.y)/2};return Math.max(wt(t,a,s,i,o-1),wt(a,n,r,i,o-1),wt(s,r,e,i,o-1),wt(a,r,s,i,o-1))}function _t(t,n,e,i,o,a,r,s){if(r>0){let u={x:(n.x+e.x)/2,y:(n.y+e.y)/2},h={x:(e.x+i.x)/2,y:(e.y+i.y)/2},b={x:(i.x+n.x)/2,y:(i.y+n.y)/2};_t(t,n,u,b,o,a,r-1,s),_t(t,u,e,h,o,a,r-1,s),_t(t,b,h,i,o,a,r-1,s),_t(t,u,h,b,o,a,r-1,s);return}let l=[n.x*g,o(n),n.y*g],c=[e.x*g,o(e),e.y*g],f=[i.x*g,o(i),i.y*g];if(s){t.triN(l,c,f,s(n),s(e),s(i),a);return}let m=we(l,c,f);m[1]<0&&(m=[-m[0],-m[1],-m[2]]),t.tri(l,c,f,m,a)}var Ee=8;function wn(t,n,e){if(!Number.isFinite(e))return t;let i=[],o=(a,r,s,l,c)=>{if(c>0){let f={x:(a.x+r.x)/2,y:(a.y+r.y)/2},m=n(f);if(Math.abs(m-(s+l)/2)>e){o(a,f,s,m,c-1),o(f,r,m,l,c-1);return}}i.push(a)};for(let a=0;a<t.length;a++){let r=t[a],s=t[(a+1)%t.length];o(r,s,n(r),n(s),Ee)}return i}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 i=[];for(let o=0;o<e.length;o++){let a=i.length?i[i.length-1]:e[(o-1+e.length)%e.length],r=e[o],s=e[(o+1)%e.length],l=s.x-a.x,c=s.y-a.y,f=Math.hypot(l,c);f>n&&Math.abs((r.x-a.x)*c-(r.y-a.y)*l)/f<n||i.push(r)}return i.length>=3?i:e}var Ut=.001*lt*.1;function K(t,n,e,i,o,a,r,s,l=1/0,c){if(!n||n.length<3||(l===void 0&&(l=1/0),Math.abs(ft(n))<1e-4))return;let f=Xt(wn(Xt(Jt(n),Ut),i,l),Ut),m=e?.map(R=>Xt(wn(Xt(Jt(R),Ut),i,l),Ut)).filter(R=>R.length>=3&&Math.abs(ft(R))>=1e-4),{pts:u,tris:h}=_e(f,m),b=[a[0]*s.top,a[1]*s.top,a[2]*s.top],p=[a[0]*s.bottomCap,a[1]*s.bottomCap,a[2]*s.bottomCap],y=[r[0]*s.top,r[1]*s.top,r[2]*s.top],d=[r[0]*s.wallBottom,r[1]*s.wallBottom,r[2]*s.wallBottom],x=0;if(Number.isFinite(l))for(;x<Te;x++){let R=0;for(let I=0;I<h.length;I+=3){let B=wt(u[h[I]],u[h[I+1]],u[h[I+2]],i,x);B>R&&(R=B)}if(R<=l)break}for(let R=0;R<h.length;R+=3){let I=u[h[R]],B=u[h[R+1]],k=u[h[R+2]];_t(t,I,B,k,i,b,x,c);let D=[I.x*g,o,I.y*g],U=[B.x*g,o,B.y*g],M=[k.x*g,o,k.y*g];t.tri(D,M,U,[0,-1,0],p)}let w=R=>{if(x<=0)return R;let I=1<<x,B=[];for(let k=0;k<R.length;k++){let D=R[k],U=R[(k+1)%R.length];for(let M=0;M<I;M++){let _=M/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 R of m)R.length>=3&&E.push({ring:w(R),flip:!0});for(let{ring:R,flip:I}of E)for(let B=0;B<R.length;B++){let k=R[B],D=R[(B+1)%R.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,S=_*P+N*F;I&&(S=-S),S<0&&(_=-_,N=-N);let T=[_,0,N],C=[k.x*g,i(k),k.y*g],v=[D.x*g,i(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,y,y,d),t.tri(C,X,G,T,y,d,d)}}function _n(t){let n=0;for(let l of t)n+=l.count;let e=new Float32Array(n*3),i=new Float32Array(n*3),o=new Float32Array(n*3),a=new Float32Array(n),r=new Float32Array(n),s=0;for(let l of t)e.set(l.position,s*3),i.set(l.normal,s*3),o.set(l.color,s*3),a.set(l.floor,s),r.set(l.material,s),s+=l.count;return{position:e,normal:i,color:o,floor:a,material:r,count:n}}function jt(t,n,e=2.5){if(n<=0||t.length<3)return t;let i=Jt(t),o=i.length,a=[];for(let s=0;s<o;s++){let l=i[s],c=i[(s+1)%o],f=c.x-l.x,m=c.y-l.y,u=Math.hypot(f,m)||1;a.push({x:m/u,y:-f/u})}let r=[];for(let s=0;s<o;s++){let l=i[s],c=a[(s-1+o)%o],f=a[s],m=c.x+f.x,u=c.y+f.y,h=Math.hypot(m,u),b=()=>{r.push([l.x+c.x*n,l.y+c.y*n]),r.push([l.x+f.x*n,l.y+f.y*n])};if(h<1e-9){b();continue}m/=h,u/=h;let p=m*c.x+u*c.y,y=1/Math.max(p,1e-6);if(!Number.isFinite(y)||y>e){b();continue}r.push([l.x+m*n*y,l.y+u*n*y])}if(r.length<3)return t;try{let s=Ae.union([[...r,r[0]]]),l=null,c=-1/0;for(let m of s){let u=Math.abs(ft(m[0].map(([h,b])=>({x:h,y:b}))));u>c&&(c=u,l=m[0])}if(!l)return t;let f=l.map(([m,u])=>({x:m,y:u}));if(f.length>1){let m=f[0],u=f[f.length-1];Math.abs(m.x-u.x)<1e-9&&Math.abs(m.y-u.y)<1e-9&&f.pop()}return f.length>=3?f:t}catch{return t}}function Ht(t,n,e,i,o=28){let a=[];for(let r=0;r<o;r++){let s=r/o*Math.PI*2;a.push({x:t+e*Math.cos(s),y:n+i*Math.sin(s)})}return a}function Tt(t,n,e,i){return[{x:t,y:n},{x:t+e,y:n},{x:t+e,y:n+i},{x:t,y:n+i}]}var Bt=["available","held","sold","selected","dimmed"];function Qt(t){let n=Bt.indexOf(t);return n<0?0:n}var Tn={available:[.24,.82,.52],held:[.95,.66,.22],sold:[.34,.39,.45],selected:[.24,.74,1],dimmed:[.28,.32,.37]};function cr(t){let n=.2126*t[0]+.7152*t[1]+.0722*t[2],e=.42,i=.62;return[(n+(t[0]-n)*e)*i,(n+(t[1]-n)*e)*i,(n+(t[2]-n)*e)*i]}var tn={ground:[.07,.085,.11],tierTop:[.24,.28,.34],tierWall:[.17,.2,.25],stageTop:[.94,.7,.38],stageWall:[.48,.33,.18],decorTop:[.22,.25,.29],decorWall:[.15,.17,.2],gaTop:[.24,.28,.33],gaWall:[.16,.19,.23],boothTop:[.3,.33,.38],boothWall:[.2,.23,.27],tableTop:[.38,.34,.29],tableWall:[.24,.21,.18]},nn={top:[.05,.06,.08],bottom:[.1,.12,.15]};function et(t,n){return[Math.min(1,t[0]*n),Math.min(1,t[1]*n),Math.min(1,t[2]*n)]}var V={pedestal:0,pad:1,back:2,arm:3,footrest:4,leg:5,body:10,head:11},Ce=.44,Fe=.15,ve=.3,ke=.24;function Bn(t){return t===void 0||!Number.isFinite(t)||t<=0?ke:Math.min(ve,Math.max(Fe,t*Ce))}var lr=.21,Oe=.05,en=.45,Le=en+Oe,Ge=.92,De=1.205,Ne=-.23,Xe=.38,Ue=[{part:V.pedestal,min:[-.3,0,-.3],max:[.3,.36,.3]},{part:V.pad,min:[-1,.36,-.95],max:[1,en,1]},{part:V.back,min:[-1,Le,-1],max:[1,Ge,-.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]}],Ye=[{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]}],je=[{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 mr(){let t=[],n=[],e=[],i=[],o=(O,P,F)=>{let S=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);i.push(S,S+1,S+2,S,S+2,S+3)},a=O=>{for(let P of je){let F=P.c.map(S=>S.map((T,C)=>T?O.max[C]:O.min[C]));o(F,P.n,O.part)}};for(let O of Ue)a(O);for(let O of Ye)a(O);let r=en,s=1.08,l=.47,c=.69,f=-.55,m=.08,u=-.48,h=.01,b=[-l,r,f],p=[l,r,f],y=[-l,r,m],d=[l,r,m],x=[-c,s,u],w=[c,s,u],A=[-c,s,h],E=[c,s,h];o([p,w,E,d],[1,0,0],V.body),o([y,A,x,b],[-1,0,0],V.body),o([A,E,w,x],[0,1,0],V.body),o([b,p,d,y],[0,-1,0],V.body),o([d,E,A,y],[0,0,1],V.body),o([b,x,w,p],[0,0,-1],V.body);let R=10,I=8,B=[0,De,Ne],k=[.42,.115,Xe],D=e.length;for(let O=0;O<=I;O++){let P=Math.PI*O/I,F=Math.cos(P),S=Math.sin(P);for(let T=0;T<=R;T++){let C=Math.PI*2*T/R,v=S*Math.cos(C),G=S*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<R;P++){let F=D+O*(R+1)+P,S=F+R+1;i.push(F,S,F+1,F+1,S,S+1)}let U=new Float32Array(t),M=new Float32Array(n),_=new Float32Array(e),N=new Uint16Array(i);return{position:U,normal:M,part:_,index:N,vertexCount:e.length,indexCount:i.length}}function En(t,n,e,i){let o=new Float32Array(n),a=c=>t[c*3],r=c=>t[c*3+2],s=0,l=(c,f)=>{let m=f-c;for(let u=c;u<f;u++){let[h,b]=i(u),p=h-a(u),y=b-r(u);if(m>=2){let d=Math.max(c,u-1),x=Math.min(f-1,u+1),w=a(x)-a(d),A=r(x)-r(d),E=Math.hypot(w,A);if(E>1e-6){let R=-A/E,I=w/E;R*p+I*y<0&&(R=-R,I=-I),p=R,y=I}}o[u]=p===0&&y===0?0:Math.atan2(p,y)}};for(let c=1;c<=n;c++)(c===n||e(c)!==e(s))&&(l(s,c),s=c);return o}var Vt=.22;function Mr(t,n){let e=Bt[t];if(e!=="sold"&&e!=="held")return-1;let i=(n+1)*2654435761;return i^=i>>>15,i=Math.imul(i,2246822519),i^=i>>>13,(i>>>0)%1e5/1e5}var He=.42;function Ve(t){let n=t.length,e=new Float64Array(n);if(n<2)return e.fill(1/0),e;let i=1/0,o=1/0,a=-1/0,r=-1/0;for(let b of t)b.x<i&&(i=b.x),b.y<o&&(o=b.y),b.x>a&&(a=b.x),b.y>r&&(r=b.y);let s=Math.max(a-i,1e-6),l=Math.max(r-o,1e-6),c=Math.max(Math.sqrt(s*l/n),1e-6),f=Math.max(1,Math.ceil(s/c)+1),m=Math.max(1,Math.ceil(l/c)+1),u=new Map,h=(b,p)=>{let y=Math.min(f-1,Math.max(0,Math.floor((b-i)/c)));return Math.min(m-1,Math.max(0,Math.floor((p-o)/c)))*f+y};for(let b=0;b<n;b++){let p=h(t[b].x,t[b].y),y=u.get(p);y?y.push(b):u.set(p,[b])}for(let b=0;b<n;b++){let p=t[b],y=Math.min(f-1,Math.max(0,Math.floor((p.x-i)/c))),d=Math.min(m-1,Math.max(0,Math.floor((p.y-o)/c))),x=1/0;for(let w=1;w<=4;w++){for(let A=d-w;A<=d+w;A++)if(!(A<0||A>=m))for(let E=y-w;E<=y+w;E++){if(E<0||E>=f||w>1&&Math.abs(A-d)<w&&Math.abs(E-y)<w)continue;let R=u.get(A*f+E);if(R)for(let I of R){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 We(t){let n=t.eyeHeightM;return Number.isFinite(n)?Math.max(0,n-Gt):0}function Cn(t,n,e,i,o,a){let r=t.length,s=new Float32Array(r*3),l=new Float32Array(r),c=new Float32Array(r*3),f=new Float32Array(r),m=new Float32Array(r),u=new Float32Array(r),h=new Float32Array(r),b=new Float32Array(r*3),p=new Map,y=Ve(t);for(let d=0;d<r;d++){let x=t[d],A=(e?.seatPitchU(d)??y[d])*g;f[d]=Number.isFinite(A)?Math.max(.06,Math.min(Vt,A*He)):Vt,m[d]=Bn(Number.isFinite(A)?A:void 0);let E=Sn(x.glyph,{seatGlyph:a?.get(x.categoryKey)});u[d]=Mn.indexOf(E),h[d]=x.wheelchairSpaceType==="no-seat"?0:1,s[d*3]=x.x*g,s[d*3+1]=e?e.seatDeckY(d):We(x),s[d*3+2]=x.y*g,l[d]=Qt(n?n(x):"available");let R=H(o?.get(x.categoryKey)??"#6e7bff")??[.43,.48,1];if(c[d*3]=R[0],c[d*3+1]=R[1],c[d*3+2]=R[2],x.accessibility?.length){let I=H(hn(x.accessibility));I&&(b[d*3]=I[0],b[d*3+1]=I[1],b[d*3+2]=I[2])}p.set(x.id,d)}return{count:r,iPosition:s,iState:l,iCategory:c,iMaxRadius:f,iRing:b,idToIndex:p,iChairWidth:m,iGlyph:u,iPhysicalSeat:h,iFloor:i??new Float32Array(r),iYaw:new Float32Array(r)}}var ze=64;function Sr(t,n){let e=[];for(let r of n){let s=t.idToIndex.get(r.seatId);if(s===void 0)continue;let l=Qt(r.state);t.iState[s]!==l&&(t.iState[s]=l,e.push(s))}if(!e.length)return[];e.sort((r,s)=>r-s);let i=[],o=e[0],a=e[0];for(let r=1;r<e.length;r++){let s=e[r];if(s!==a){if(s<=a+ze){a=s;continue}i.push({start:o,length:a-o+1}),o=s,a=s}}return i.push({start:o,length:a-o+1}),i}function Pr(t,n,e){return e<0?n>1?t.filter(i=>i.kind==="floor"):[...t]:t.filter(i=>i.floorIndex===void 0||i.floorIndex===e)}function Ir(t,n){let e=[...t].sort((o,a)=>o.screen.y-a.screen.y),i=[];for(let o of e){let a=i.find(r=>r.some(s=>Math.abs(s.screen.x-o.screen.x)<104&&Math.abs(s.screen.y-o.screen.y)<34));a?a.push(o):i.push([o])}return i.flatMap(o=>o.length<2?o:o.map((a,r)=>({...a,screen:{...a.screen,x:Math.max(54,Math.min(n-54,a.screen.x+(r-(o.length-1)/2)*104))}})))}var Ze=1.15,Ke=2.75,$e=4.5,qe=.85,Je=.5,Qe=.26;function wr(t,n,e){let i=Math.max(1e-6,n),o=t/i,a=e?.hasZoneLabels??!0,r=new Set;return o>=.75&&r.add("floor"),o>=Ze&&r.add("zone"),o<=(a?Ke:$e)&&(r.add("section"),r.add("ga")),o<=qe&&(r.add("annotation"),r.add("booth")),o<=Je&&r.add("row"),o<=Qe&&r.add("seat"),r}function _r(t,n,e,i,o,a=6){let r=a+n,s=i-a-n,l=a+e,c=o-a-e;return{...t,x:r>s?i/2:Math.max(r,Math.min(s,t.x)),y:l>c?o/2:Math.max(l,Math.min(c,t.y))}}function Tr(t,n,e,i){let o=t,a=n[0],r=n[1],s=n[2],l=o[0]*a+o[4]*r+o[8]*s+o[12],c=o[1]*a+o[5]*r+o[9]*s+o[13],f=o[2]*a+o[6]*r+o[10]*s+o[14],m=o[3]*a+o[7]*r+o[11]*s+o[15];if(!(m>1e-6))return{x:0,y:0,depth:1/0,visible:!1};let u=l/m,h=c/m,b=f/m,p=u>=-1.05&&u<=1.05&&h>=-1.05&&h<=1.05&&b<=1;return{x:(u*.5+.5)*e,y:(1-(h*.5+.5))*i,depth:b,visible:p}}function Br(t,n,e=n){let i=[],o=[...t].sort((a,r)=>a.screen.depth-r.screen.depth);for(let a of o){let r=!1;for(let s of i)if(on(a,s,n,e)){r=!0;break}r||i.push(a)}return i}var to=6;function on(t,n,e,i){let o=Math.abs(t.screen.x-n.screen.x),a=Math.abs(t.screen.y-n.screen.y),r=t.halfWidth!=null&&n.halfWidth!=null?Math.max(e,t.halfWidth+n.halfWidth+to):e;return o<r&&a<i}function Er(t,n,e){return t.length*n*.58+(e?14:0)}var no={row:8,seat:14};function Cr(t){return t<480?{row:5,seat:8}:t<768?{row:6,seat:10}:no}function Fr(t,n,e,i){let o=Math.max(1,Math.min(e,i)*.5),a=Math.min(2,Math.hypot(t.x-e/2,t.y-i/2)/o);return n*(1+1.5*a)}function vr(t,n,e,i,o=[]){let a=[...t].sort((s,l)=>(l.priority??0)-(s.priority??0)||s.focus-l.focus),r=[];for(let s of a){if(r.length>=i)break;let l=!1;for(let c of o)if(on(s,c,n,e)){l=!0;break}if(!l){for(let c of r)if(on(s,c,n,e)){l=!0;break}}l||r.push(s)}return r}var eo=.15,oo=.9,ro=1.76;function io(){return{background:{top:[...nn.top],bottom:[...nn.bottom]},structure:tn,seatStates:{...Tn},seatScale:1,materials:{seat:null,shell:null,roughness:.78}}}function Fn(t){let n=io();if(!t)return n;let e=H(t.background);if(e){n.background={top:et(e,oo),bottom:et(e,ro)};let r={};for(let[s,l]of Object.entries(tn))r[s]=nt(l,e,eo);n.structure=r}let i=H(t.selectionColor)??H(t.accent);i&&(n.seatStates={...n.seatStates,selected:i});let o=t.seatScale;typeof o=="number"&&Number.isFinite(o)&&(n.seatScale=Rn(o));let a=t.venue3d;if(a){let r=H(a.deck),s=H(a.fascia);r&&(n.structure={...n.structure,tierTop:r,gaTop:r}),s&&(n.structure={...n.structure,tierWall:s,gaWall:s}),n.materials.seat=H(a.seat),n.materials.shell=H(a.shell),typeof a.roughness=="number"&&Number.isFinite(a.roughness)&&(n.materials.roughness=Math.min(1,Math.max(0,a.roughness)))}return n}function vn(t,n){let e=[];for(let i of n)e.push(...t.seatStates[i]);return e}import Gn from"polygon-clipping";import so from"earcut";var ao=.58,kn=.01,ot=Vt*1.5*lt,co=.5,uo=.6;function lo(t,n){let e=t.length,i=[];for(let r=0;r<e;r++){let s=t[Math.max(0,r-1)],l=t[Math.min(e-1,r+1)],c=l.x-s.x,f=l.y-s.y,m=Math.hypot(c,f);if(m<1e-9){i.push([0,0]);continue}c/=m,f/=m,i.push([-f,c])}let o=0;for(let r=0;r<e;r++)o+=(t[r].x-n.x)*i[r][0]+(t[r].y-n.y)*i[r][1];return o<0?i.map(([r,s])=>[-r,-s]):i}function mo(t,n){if(t.length<2||n<=0)return[...t];let e=[...t],i=(r,s)=>{let l=s.x-r.x,c=s.y-r.y,f=Math.hypot(l,c)||1;return{x:l/f,y:c/f}},o=i(e[1],e[0]),a=i(e[e.length-2],e[e.length-1]);return e.unshift({x:e[0].x+o.x*n,y:e[0].y+o.y*n}),e.push({x:e[e.length-1].x+a.x*n,y:e[e.length-1].y+a.y*n}),e}var On=Math.PI/12;function fo(t){if(t.length<3)return[...t];let n=[...t].sort((a,r)=>a.x-r.x||a.y-r.y),e=(a,r,s)=>(r.x-a.x)*(s.y-a.y)-(r.y-a.y)*(s.x-a.x),i=a=>{let r=[];for(let s of a){for(;r.length>=2&&e(r[r.length-2],r[r.length-1],s)<=0;)r.pop();r.push(s)}return r.pop(),r},o=[...i(n),...i([...n].reverse())];return o.length>=3?o:[...t]}function Dn(t,n){if(!t.length||!(n>0))return[];let e=fo(t),i=(s,l,c,f)=>{let m=c-l;for(;m<0;)m+=Math.PI*2;for(;m>Math.PI*2;)m-=Math.PI*2;let u=Math.max(1,Math.ceil(m/On)),h=n/Math.cos(m/u/2);for(let b=0;b<=u;b++){let p=l+m*b/u;f.push({x:s.x+Math.cos(p)*h,y:s.y+Math.sin(p)*h})}};if(e.length<3){let s=0,l=0;for(let h of e)s+=h.x,l+=h.y;s/=e.length||1,l/=e.length||1;let c=0;for(let h of e)c=Math.max(c,Math.hypot(h.x-s,h.y-l));let f=[],m=Math.max(3,Math.ceil(Math.PI*2/On)),u=(c+n)/Math.cos(Math.PI/m);for(let h=0;h<m;h++){let b=h/m*Math.PI*2;f.push({x:s+Math.cos(b)*u,y:l+Math.sin(b)*u})}return f}let o=e.length,a=[];for(let s=0;s<o;s++){let l=e[s],c=e[(s+1)%o];a.push(Math.atan2(-(c.x-l.x),c.y-l.y))}let r=[];for(let s=0;s<o;s++)i(e[s],a[(s+o-1)%o],a[s],r);return jn(r)}function ho(t,n,e){if(t.length===1)return Math.hypot(n-t[0].x,e-t[0].y);let i=1/0;for(let o=0;o+1<t.length;o++){let a=t[o],r=t[o+1],s=r.x-a.x,l=r.y-a.y,c=s*s+l*l,f=c>1e-12?((n-a.x)*s+(e-a.y)*l)/c:0;f<0?f=0:f>1&&(f=1);let m=Math.hypot(n-(a.x+f*s),e-(a.y+f*l));m<i&&(i=m)}return i}function Wt(t){let n=t.map(o=>{let a=0,r=0;for(let c of o.pts)a+=c.x,r+=c.y;let s=o.pts.length||1;a/=s,r/=s;let l=0;for(let c of o.pts){let f=Math.hypot(c.x-a,c.y-r);f>l&&(l=f)}return{cx:a,cy:r,rad:l}}),e=o=>{let a=o.length;return a<=2?[...o]:[o[Math.floor(a*.25)],o[Math.floor(a*.5)],o[Math.floor(a*.75)]]},i=[];for(let o=0;o<t.length;o++){let a=e(t[o].pts),r=[],s=1/0,l=null;for(let f of a){let m=1/0;for(let u=0;u<t.length;u++){if(u===o||Math.abs(t[u].y-t[o].y)<.001)continue;let h=n[u],b=Math.hypot(f.x-h.cx,f.y-h.cy)-h.rad;if(b>=m&&b>=s)continue;let p=ho(t[u].pts,f.x,f.y);p<m&&(m=p),t[u].depth<t[o].depth&&p<s&&(s=p,l=t[u].y)}Number.isFinite(m)&&m>0&&r.push(m)}r.sort((f,m)=>f-m);let c=r.length?r[Math.floor(r.length/2)]:1;i.push({pitch:c,belowY:l})}return i}function Nn(t,n,e,i){let o=t[n],a=o.pts.length>=2?[...o.pts]:o.pts.length===1?(()=>{let f=o.pts[0],m=f.x-i.x,u=f.y-i.y,h=Math.hypot(m,u)||1;m/=h,u/=h;let b=Math.max(e[n].pitch,.001)*.5;return[{x:f.x+u*b,y:f.y-m*b},{x:f.x-u*b,y:f.y+m*b}]})():[];if(a.length<2)return null;let r=0,s=0;for(let f=1;f<a.length;f++){let m=Math.hypot(a[f].x-a[f-1].x,a[f].y-a[f-1].y);m>1e-6&&(r+=m,s++)}let l=s>0?r/s:0,c=mo(a,Math.max(l*uo,ot));return{pts:c,nrm:lo(c,i),front:Math.max(e[n].pitch*ao,ot),back:Math.max(e[n].pitch*co,ot)}}var gt=1.5,Xn=.3;function rn(t,n){if(t.length<3)return t;let e=t[0],i=t[t.length-1],o=i.x-e.x,a=i.y-e.y,r=Math.hypot(o,a),s=-1,l=-1;for(let m=1;m<t.length-1;m++){let u=t[m],h=r>1e-12?Math.abs((u.x-e.x)*a-(u.y-e.y)*o)/r:Math.hypot(u.x-e.x,u.y-e.y);h>s&&(s=h,l=m)}if(s<=n||l<0)return[e,i];let c=rn(t.slice(0,l+1),n),f=rn(t.slice(l),n);return[...c.slice(0,-1),...f]}function Un(t,n){if(t.length<4)return t;let e=rn([...t,t[0]],n);return e.pop(),e.length>=3?e:t}function Yn(t,n,e){if(t.length<2)return[];let i=e??Wt(t),o=new Map;for(let r=0;r<t.length;r++){let s=o.get(t[r].blockId);s?s.push(r):o.set(t[r].blockId,[r])}let a=[];for(let[,r]of o){let s=[];for(let x of r){let 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=>Nn(t,x,i,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=jn(b),y=1/0;for(let x of s)t[x].y<y&&(y=t[x].y);if(!Number.isFinite(y))continue;if(p.length>=3&&Math.abs(ft(p))>1e-6&&c.every(x=>{let w=x.pts[Math.floor(x.pts.length/2)];return It(p,w.x,w.y)})){a.push({outline:Un(p,Xn),holes:[],topY:y});continue}for(let x of bo(c))a.push({outline:x,holes:[],topY:y})}return a}function bo(t){let n=[];for(let e of t){let i=[],o=[],a=e.front+gt,r=e.back+gt;for(let l=0;l<e.pts.length;l++){let c=e.pts[l],f=e.nrm[l];i.push([c.x-f[0]*a,c.y-f[1]*a]),o.push([c.x+f[0]*r,c.y+f[1]*r])}let s=[...i,...o.reverse()];s.length<3||(s.push(s[0]),n.push([s]))}if(!n.length)return[];try{let e=Gn.union(n[0],...n.slice(1)),i=[];for(let o of e){if(!o.length||o[0].length<4)continue;let a=o[0].map(([l,c])=>({x:l,y:c})),r=a[0],s=a[a.length-1];a.length>1&&Math.abs(r.x-s.x)<1e-9&&Math.abs(r.y-s.y)<1e-9&&a.pop(),a.length>=3&&i.push(Un(a,Xn))}return i}catch{return[]}}function jn(t){let n=[];for(let e of t){let i=n[n.length-1];i&&Math.hypot(e.x-i.x,e.y-i.y)<1e-9||n.push(e)}for(;n.length>2&&Math.hypot(n[0].x-n[n.length-1].x,n[0].y-n[n.length-1].y)<1e-9;)n.pop();return n}var sn=class{constructor(n){this.minX=1/0;this.minY=1/0;this.maxX=-1/0;this.maxY=-1/0;this.rings=n;for(let e of n)for(let i of e)i.x<this.minX&&(this.minX=i.x),i.y<this.minY&&(this.minY=i.y),i.x>this.maxX&&(this.maxX=i.x),i.y>this.maxY&&(this.maxY=i.y)}containsAll(n){for(let e of n)if(e.x<this.minX||e.x>this.maxX||e.y<this.minY||e.y>this.maxY)return!1;for(let e of this.rings){let i=!0;for(let o of n)if(!It(e,o.x,o.y)){i=!1;break}if(i)return!0}return!1}};function Ln(t,n,e,i,o,a){if(i.length<3)return;if(e.containsAll(i)){let c=[0,1,0],f=i[0];for(let m=1;m+1<i.length;m++){let u=i[m],h=i[m+1];t.tri([f.x*g,o,f.y*g],[u.x*g,o,u.y*g],[h.x*g,o,h.y*g],c,a)}return}let r=i.map(c=>[c.x,c.y]);r.push(r[0]);let s;try{s=Gn.intersection([r],n)}catch{return}let l=[0,1,0];for(let c of s){if(!c.length||c[0].length<4)continue;let f=c[0],m=[],u=[];for(let b=0;b<f.length-1;b++)m.push(f[b][0],f[b][1]),u.push([f[b][0],f[b][1]]);if(u.length<3)continue;let h=so(m,void 0,2);for(let b=0;b<h.length;b+=3){let p=u[h[b]],y=u[h[b+1]],d=u[h[b+2]];t.tri([p[0]*g,o,p[1]*g],[y[0]*g,o,y[1]*g],[d[0]*g,o,d[1]*g],l,a)}}}function Hn(t,n,e,i,o,a,r){if(n.length<2)return;let s=r??Wt(n),l=[0,1,0],c=a&&a.length>=3?[[...a.map(h=>[h.x,h.y]),[a[0].x,a[0].y]]]:null,f=a&&a.length>=3?new sn([[...a]]):null,m=h=>{t.setMaterial(2),h(),t.setMaterial(0)},u=h=>{t.setMaterial(3),h(),t.setMaterial(0)};for(let h=0;h<n.length;h++){let b=n[h];if(b.patch&&b.patch.length>=3){let E=[...b.patch],R=s[h].belowY??i;if(u(()=>{if(c&&f)Ln(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>R+kn){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],M=U.x-D.x,_=U.y-D.y,N=Math.hypot(M,_);if(N<1e-6)continue;let O=_/N,P=-M/N;(D.x-I)*O+(D.y-B)*P<0&&(O=-O,P=-P);let F=[O,0,P],S=[D.x*g,b.y,D.y*g],T=[U.x*g,b.y,U.y*g],C=[D.x*g,R,D.y*g],v=[U.x*g,R,U.y*g];t.tri(S,T,v,F,o.riser),t.tri(S,v,C,F,o.riser)}})}continue}let p=Nn(n,h,s,e);if(!p)continue;let{pts:y,nrm:d,front:x,back:w}=p,A=s[h].belowY??i;for(let E=0;E+1<y.length;E++){let R=y[E],I=y[E+1],B=d[E],k=d[E+1];if(Math.hypot(I.x-R.x,I.y-R.y)<1e-6||B[0]===0&&B[1]===0||k[0]===0&&k[1]===0)continue;let D=[(R.x-B[0]*x)*g,b.y,(R.y-B[1]*x)*g],U=[(I.x-k[0]*x)*g,b.y,(I.y-k[1]*x)*g],M=[(R.x+B[0]*w)*g,b.y,(R.y+B[1]*w)*g],_=[(I.x+k[0]*w)*g,b.y,(I.y+k[1]*w)*g];if(u(()=>{c&&f?Ln(t,c,f,[{x:R.x-B[0]*x,y:R.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:R.x+B[0]*w,y:R.y+B[1]*w}],b.y,o.tread):(t.tri(D,U,_,l,o.tread),t.tri(D,_,M,l,o.tread))}),b.y>A+kn){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)})}}}}import Wn from"polygon-clipping";function po(t,n){let e=t.eventConfigurationIds;return!e?.length||!!n&&e.includes(n)}function Vn(t,n){return t.filter(e=>e.type!=="shape"||po(e,n))}function zn(t,n){let e=t.focalPoint??{x:0,y:0};return t.floors?.length?t.floors.map((i,o)=>({objects:Vn(i.objects,n),focal:{x:(i.focalPoint??e).x,y:(i.focalPoint??e).y},baseHeightM:i.baseHeightM??0,index:o})):[{objects:Vn(t.objects,n),focal:e,baseHeightM:0,index:0}]}var yo={minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};function Mt(t){return gn(t)??yo}function Zn(t,n){let e=jt(t.outline,ot),i=Mt(e),o=n.filter(r=>r!==t&&r.outline&&r.outline.length>=3&&Nt(i,Mt(r.outline)));if(!o.length)return[e];let a=r=>{let s=r.map(l=>[l.x,l.y]);return s.push(s[0]),s};try{let r=Wn.difference([a(e)],...o.map(l=>[a(l.outline)])),s=[];for(let l of r){if(!l.length)continue;let c=l[0].map(([f,m])=>({x:f,y:m}));if(c.length>1){let f=c[0],m=c[c.length-1];Math.abs(f.x-m.x)<1e-9&&Math.abs(f.y-m.y)<1e-9&&c.pop()}c.length>=3&&s.push(c)}return s.length?s:[e]}catch{return[e]}}function Kn(t,n){if(!n.length)return t;let e=a=>{let r=a.map(s=>[s.x,s.y]);return r.push(r[0]),r},i=n.map(a=>[e(a)]),o=[];for(let a of t){let r;try{r=Wn.intersection([e(a.outline)],i.flat())}catch{o.push(a);continue}for(let s of r){if(!s.length)continue;let l=s[0].map(([c,f])=>({x:c,y:f}));if(l.length>1){let c=l[0],f=l[l.length-1];Math.abs(c.x-f.x)<1e-9&&Math.abs(c.y-f.y)<1e-9&&l.pop()}l.length>=3&&o.push({outline:l,holes:[],topY:a.topY})}}return o.length?o:t}var xo=.05,$n=.05,go=.15,an=25;function qn(t,n,e){let i=new Map,o=new Array(n.length).fill(null),a=new Float64Array(n.length),r=new Array(n.length).fill(void 0),s=new Array(n.length).fill(void 0),l=new Map,c=[],f=new Set;for(let u=0;u<t.length;u+=1){let h=t[u];for(let b of h.objects){if(b.type==="table"&&f.add(b.id),b.type!=="section"||!b.outline||b.outline.length<3)continue;let p=jt(b.outline,ot);l.set(b.id,{section:b,unit:h,frontU:1/0,hasSeats:!1,rows:new Map,seatIndices:[]}),c.push({id:b.id,floorIndex:u,box:Mt(p),section:b,unit:h,outline:p})}}let m=new Map;for(let u of c){let h=m.get(u.floorIndex);h?h.push(u):m.set(u.floorIndex,[u])}for(let u=0;u<n.length;u++){let h=n[u],b=e?m.get(e[u])??[]:c,p=h.sectionId?b.find(d=>d.id===h.sectionId)??b.find(d=>d.section.logicalSectionId===h.sectionId&&qt({x:h.x,y:h.y},d.outline,d.section.holes)):void 0,y=p?[p]:b;for(let d of y){if(e&&d.floorIndex!==e[u]||!p&&(h.x<d.box.minX||h.x>d.box.maxX||h.y<d.box.minY||h.y>d.box.maxY||!qt({x:h.x,y:h.y},d.outline,d.section.holes)))continue;o[u]=d.id;let x=l.get(d.id);x.hasSeats=!0;let w=h.focalPoint??d.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}`,R=x.rows.get(E);R?R.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,y=b.rake>0?Math.tan(b.rake*Math.PI/180):0,d=b.rake<=.01&&b.height<=p+.001,x=h.section.surfaceKind,w=x==="flat"?!0:x==="rakedRows"&&b.rake>.01?!1:d,A=h.hasSeats?yn(u,n,h.seatIndices,h.unit.focal):{sectionId:u,rows:[],blockCount:0},R=A.rows.length<2?An([...h.rows.values()].map(S=>({points:S})),h.unit.focal):null,I=1/0;if(R){if(h.hasSeats)for(let S of h.rows.values())for(let T of S){let C=R.depthAt(T.x,T.y);C<I&&(I=C)}if(!h.hasSeats||!Number.isFinite(I)){I=1/0;for(let S of h.section.outline){let T=R.depthAt(S.x,S.y);T<I&&(I=T)}}}let B=p+xo,k=Math.max(B,b.height),D=S=>{let T=Math.max(0,S-I)*ut,C=Math.min(T*y,an);return Math.max(B,b.height+C)},U=S=>{let T=Math.max(0,S)*ut,C=Math.min(T*y,an);return Math.max(B,b.height+C)},M=w?[]:A.rows.map(S=>({pts:S.pts,y:U(S.blockDepth),depth:S.blockDepth,blockId:S.blockId,...f.has(S.id)?{patch:Dn(S.pts,ot)}:{}})),_=M.length?M[0].y:k,N=M.map(S=>{let T=S.patch&&S.patch.length>=3?S.patch:S.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:M.length>=2?(S,T)=>{let C=1/0,v=_;for(let G=0;G<M.length;G++){let X=N[G];if(Math.hypot(S-X.cx,T-X.cy)-X.rad>=C)continue;let L=M[G].patch,Y=L&&L.length>=3?It(L,S,T)?0:Dt(L,S,T):Dt(M[G].pts,S,T);Y<C&&(C=Y,v=M[G].y)}return v}:(S,T)=>R?D(R.depthAt(S,T)):k,P=[0,1,0],F=M.length>=2||w?()=>P:(S,T)=>{if(!R)return P;let C=R.depthAt(S,T);if(C<=I)return P;let v=(C-I)*ut;if(v*y>=an||b.height+v*y<=B)return P;let[G,X]=R.gradientAt(S,T);if(G===0&&X===0)return P;let L=1/Math.hypot(y,1);return[-G*y*L,L,-X*y*L]};if(!w)for(let S of A.rows){let T=U(S.blockDepth);for(let C of S.seatIndices)r[C]=T}for(let S of A.rows){let T=[];for(let L=1;L<S.pts.length;L++){let Y=Math.hypot(S.pts[L].x-S.pts[L-1].x,S.pts[L].y-S.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=S.pts[Math.floor(S.pts.length/2)];if(G)for(let L of A.rows){if(L===S||L.blockId!==S.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 S.seatIndices)s[L]=X}i.set(u,{sectionId:u,deckAt:O,normalAt:F,flat:w,bottomY:p,rowLevels:M,landingY:_})}for(let u=0;u<n.length;u++){let h=o[u],b=n[u];if(h){let y=r[u];a[u]=(y??i.get(h).deckAt(b.x,b.y))+go;continue}let p=b.eyeHeightM;a[u]=Number.isFinite(p)?Math.max(0,p-Gt):0}return{bySection:i,seatOwner:o,seatDeckY:u=>a[u],seatPitchU:u=>s[u]}}var W={top:1,wallBottom:.5,bottomCap:.4};function st(t,n){if(!t)return n;let e=et(Pt(t,.4),.62);return nt(n,e,.72)}function Jn(t,n){let e=new Map;for(let a of t.categories??[])e.set(a.key,a.color);let i=new Map;for(let a of n){if(!a.sectionId)continue;let r=i.get(a.sectionId);r||(r=new Map,i.set(a.sectionId,r)),r.set(a.categoryKey,(r.get(a.categoryKey)??0)+1)}let o=new Map;for(let[a,r]of i){let s=0,l=0,c=0,f=0;for(let[m,u]of r){let h=H(e.get(m));h&&(s+=h[0]*u,l+=h[1]*u,c+=h[2]*u,f+=u)}f>0&&o.set(a,[s/f,l/f,c/f])}return o}function Qn(t,n){return H(t.color)??n.get(t.logicalSectionId??t.id)??null}import Mo from"polygon-clipping";function So(t,n){return t===void 0||n===void 0?!0:Math.abs(t-n)<.001}var zt=class{constructor(){this.rings=[];this.boxes=[];this.levels=[]}subtract(n,e){let i=n.map(l=>[l.x,l.y]);if(i.length<3)return[];i.push(i[0]);let o=Mt(n),a=this.rings.filter((l,c)=>Nt(o,this.boxes[c])&&So(e,this.levels[c])),r=[[i]];if(a.length)try{r=Mo.difference([i],...a).map(c=>c.map(f=>f.map(([m,u])=>[m,u])))}catch{r=[[i]]}this.rings.push([i]),this.boxes.push(o),this.levels.push(e);let s=[];for(let l of r){if(!l.length)continue;let c=l[0].map(([f,m])=>({x:f,y:m}));if(c.length>1){let f=c[0],m=c[c.length-1];Math.abs(f.x-m.x)<1e-9&&Math.abs(f.y-m.y)<1e-9&&c.pop()}c.length>=3&&s.push(c)}return s}};function Ro(t,n){if(!n)return t;let e=1/0,i=-1/0,o=1/0,a=-1/0;for(let m of t)e=Math.min(e,m.x),i=Math.max(i,m.x),o=Math.min(o,m.y),a=Math.max(a,m.y);let r=(e+i)/2,s=(o+a)/2,l=n*Math.PI/180,c=Math.cos(l),f=Math.sin(l);return t.map(m=>{let u=m.x-r,h=m.y-s;return{x:r+u*c-h*f,y:s+u*f+h*c}})}function bt(t){let n=null;if(t.kind==="polygon"&&t.points&&t.points.length>=3&&(n=t.points),t.kind==="rect"&&t.width&&t.height&&(n=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,i=(t.y??0)+t.height/2;n=Ht(e,i,t.width/2,t.height/2)}return n?Ro(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}},i=n==="stage"&&xn(t.stageKind)?{kind:"stage",heightM:.06}:e[n]??{kind:"plate",heightM:.25};return{...i,heightM:t.heightM??i.heightM}}var Ao=.08;function te(t,n){let e=bt(t),i=Et(t),o=i.heightM;if(!e||i.kind!=="plate"&&i.kind!=="stage")return o;let a=1/0,r=1/0,s=-1/0,l=-1/0;for(let f of e)a=Math.min(a,f.x),r=Math.min(r,f.y),s=Math.max(s,f.x),l=Math.max(l,f.y);let c=o;for(let f of n)s>f.minX&&a<f.maxX&&l>f.minY&&r<f.maxY&&c<=f.topOffsetM+1e-6&&(c=f.topOffsetM+Ao);return n.push({minX:a,minY:r,maxX:s,maxY:l,topOffsetM:c}),c}function mt(t,n,e){return{x:t.x+(n.x-t.x)*e,y:t.y+(n.y-t.y)*e}}function ne(t){if(t.length!==4)return t;let n=Math.hypot(t[1].x-t[0].x,t[1].y-t[0].y),e=Math.hypot(t[2].x-t[1].x,t[2].y-t[1].y);return n>=e?t:[t[1],t[2],t[3],t[0]]}function 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 ee(t,n,e){return[mt(t[0],t[3],n),mt(t[1],t[2],n),mt(t[1],t[2],e),mt(t[0],t[3],e)]}function at(t,n,e,i,o,a){K(t,n,void 0,()=>e,i,o,a,W)}var cn=2.4,Po=.75,Io=.15;function Ft(t){if(t.points&&t.points.length>=3)return t.points;let{center:n,width:e,height:i,rotation:o}=t;if(!e||!i)return null;let a=(o??0)*Math.PI/180,r=Math.cos(a),s=Math.sin(a),l=e/2,c=i/2;return[[-l,-c],[l,-c],[l,c],[-l,c]].map(([f,m])=>({x:n.x+f*r-m*s,y:n.y+f*s+m*r}))}function oe(t,n,e,i,o){let a=Ft(n);a&&K(t,a,void 0,()=>e+cn,e,st(i,o.boothTop),o.boothWall,W)}function un(t){if(t.shape==="round"){let f=t.radius;return f?Ht(t.center.x,t.center.y,f,f,24):null}let{width:n,height:e,rotation:i,center:o}=t;if(!n||!e)return null;let a=(i??0)*Math.PI/180,r=Math.cos(a),s=Math.sin(a),l=n/2,c=e/2;return[[-l,-c],[l,-c],[l,c],[-l,c]].map(([f,m])=>({x:o.x+f*r-m*s,y:o.y+f*s+m*r}))}function re(t,n,e,i,o){let a=un(n);a&&K(t,a,void 0,()=>e+Po,e,st(i,o.tableTop),o.tableWall,W)}function ie(t,n,e,i,o,a,r,s){let l=bt(n);if(!l)return;let c=s?s.kind==="stage":n.role==="stage",f=s?s.kind==="screen":n.role==="screen",m=s?{kind:c?"stage":"solid",heightM:s.topY-s.baseY}:Et(n),u=s?.baseY??e,h=s?.topY??e+i;if(c&&r){let x=1/0,w=-1/0,A=1/0,E=-1/0;for(let R of l)R.x<x&&(x=R.x),R.x>w&&(w=R.x),R.y<A&&(A=R.y),R.y>E&&(E=R.y);r.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),y=f?b:null,d=c?b?nt(o.stageWall,et(b,.58),.82):o.stageWall:f?y?nt(et(y,1.42),[.24,.46,.82],.08):[.24,.46,.82]:st(H(n.fill),o.decorWall);if(m.kind==="portal"&&l.length===4){let x=ne(l);at(t,Ct(x,0,.16),h,u,p,d),at(t,Ct(x,.84,1),h,u,p,d),at(t,x,h,Math.max(u,h-.35),p,d);return}if(m.kind==="suite"&&l.length===4){let x=l.map((E,R)=>{let I=l[(R+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,d),at(t,Ct(A,.92,1),h,u,p,d),at(t,ee(A,.88,1),h,u,p,d),at(t,A,h,Math.max(u,h-.18),p,d);return}at(t,l,h,u,p,d)}function ln(t){let{x:n,y:e,width:i,height:o}=t;if(!i||!o)return null;let a=n+i/2,r=e+o/2,s=(t.rotation??0)*Math.PI/180,l=Math.cos(s),c=Math.sin(s),f=i/2,m=o/2;return[[-f,-m],[f,-m],[f,m],[-f,m]].map(([u,h])=>({x:a+u*l-h*c,y:r+u*c+h*l}))}function wo(t){if(!t||!t.startsWith("data:image/svg+xml"))return null;let n=t.slice(t.indexOf(",")+1);if(/;base64/i.test(t.slice(0,t.indexOf(","))))try{n=atob(n)}catch{return null}else try{n=decodeURIComponent(n)}catch{}let e=n.match(/<(?:rect|path)\b[^>]*\bfill="([^"]+)"/i);if(!e)return null;let i=e[1].trim();if(i==="none"||i==="transparent")return null;let o=i.match(/^url\(#([^)]+)\)$/);if(!o)return H(i);let a=n.match(new RegExp(`<(?:linear|radial)Gradient\\b[^>]*\\bid="${o[1]}"[^>]*>([\\s\\S]*?)</(?:linear|radial)Gradient>`,"i"));if(!a)return null;let r=[];for(let s of a[1].matchAll(/stop-color="([^"]+)"/gi)){let l=H(s[1].trim());l&&r.push(l)}return r.length?r.reduce((s,l,c)=>nt(s,l,1/(c+1)),r[0]):null}function se(t,n,e,i){if(n.layer==="foreground")return;let o=ln(n);if(!o)return;let a=e+Io,r=st(wo(n.href),i.decorTop),s=Math.max(0,Math.min(1,n.opacity??1));s<1&&(r=nt(i.ground,r,s)),K(t,o,void 0,()=>a,e,r,nt(r,i.decorWall,.5),W)}function ae(t,n,e,i,o){if(!n.points||n.points.length<3)return;let a=st(i,o.gaTop);K(t,n.points,n.holes,()=>e+.15,e,a,o.gaWall,W)}var _o=.25,To=1.2,Bo=.6,Eo=.45,Co=2.3,Fo=Math.PI/180;function pt(t,n,e){let i=e*Fo;return{x:t.x+n*Math.sin(i),y:t.y+n*Math.cos(i)}}function vo(t,n){let e=n.rings[n.rings.length-1];if(!e)return!1;let i=e.outerRMedian*.85;for(let o of t){if(o.role!=="wall")continue;let a=o.points&&o.points.length>=2?o.points:o.x!==void 0&&o.y!==void 0&&o.width!==void 0&&o.height!==void 0?[{x:o.x,y:o.y},{x:o.x+o.width,y:o.y},{x:o.x+o.width,y:o.y+o.height},{x:o.x,y:o.y+o.height}]:[];if(a.length<2)continue;let r=0;for(let s of a)Math.hypot(s.x-n.centre.x,s.y-n.centre.y)>=i&&r++;if(r>=a.length/2)return!0}return!1}var ko=24;function Oo(t,n,e,i,o,a,r,s){let l=e.binCount,c=ko,f=ut,m=a+.02,u=[];for(let M=0;M<l;M++){let _=(e.startBin+M+.5)*n.binStepDeg,N=new Float64Array(c+1);for(let O=0;O<=c;O++){let P=i[M]+(o[M]-i[M])*O/c;N[O]=Math.max(m,In(n,e,_,P)-_o)}u.push(N)}let h=[r.bandTop[0]*s.top,r.bandTop[1]*s.top,r.bandTop[2]*s.top],b=[r.bandTop[0]*s.bottomCap,r.bandTop[1]*s.bottomCap,r.bandTop[2]*s.bottomCap],p=[r.bandWall[0]*s.top,r.bandWall[1]*s.top,r.bandWall[2]*s.top],y=[r.bandWall[0]*s.wallBottom,r.bandWall[1]*s.wallBottom,r.bandWall[2]*s.wallBottom],d=(M,_)=>{let N=(e.startBin+M+.5)*n.binStepDeg,O=i[M]+(o[M]-i[M])*_/c,P=pt(n.centre,O,N);return[P.x*f,u[M][_],P.y*f]};{let M=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 S=0;S<=c;S++){let T=u[F][S]-u[P][S];if(Math.abs(T)>1)continue;let C=i[P]+(o[P]-i[P])*S/c,v=i[F]+(o[F]-i[F])*S/c,G=pt(n.centre,C,(e.startBin+P+.5)*n.binStepDeg),X=pt(n.centre,v,(e.startBin+F+.5)*n.binStepDeg),L=M*Math.hypot(X.x-G.x,X.y-G.y)*f;T>L?(u[F][S]=u[P][S]+L,N=!0):-T>L&&(u[P][S]=u[F][S]+L,N=!0)}}if(!N)break}}let x=1,w=(M,_)=>{for(let N=0;N<=c;N+=4)if(Math.abs(u[M][N]-u[_][N])>x)return!0;return Math.abs(u[M][c]-u[_][c])>x},A=Math.tan(38*Math.PI/180),E=M=>(o[M]-i[M])/c*f,R=(M,_)=>u[M][_+1]-u[M][_]>A*Math.max(1e-6,E(M)),I=(M,_)=>{let N=e.closed?(M-1+l)%l:Math.max(0,M-1),O=e.closed?(M+1)%l:Math.min(l-1,M+1);Math.abs(u[N][_]-u[M][_])>x&&(N=M),Math.abs(u[O][_]-u[M][_])>x&&(O=M);let P=Math.max(0,_-1),F=Math.min(c,_+1);P<_&&R(M,P)&&(P=_),F>_&&R(M,_)&&(F=_);let S=d(N,_),T=d(O,_),C=d(M,P),v=d(M,F),G=T[0]-S[0],X=T[1]-S[1],L=T[2]-S[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=(M,_)=>{let N=[M[0],a,M[2]],O=[_[0],a,_[2]],P=_[0]-M[0],F=_[2]-M[2],S=Math.hypot(P,F);if(!(S>1e-12))return;let T=[F/S,0,-P/S];t.tri(M,_,O,T,p,p,y),t.tri(M,O,N,T,p,y,y)},k=.05*lt,D=M=>o[M]-i[M]<k,U=e.closed?l:l-1;for(let M=0;M<U;M++){let _=(M+1)%l;if(D(M)||D(_))continue;if(w(M,_)){let T=(e.startBin+M+1)*n.binStepDeg,C=(j,$)=>{let z=(i[M]+i[_])/2,q=(o[M]+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 $=d(M,j),z=d(M,j+1),q=C(M,j),tt=C(M,j+1),Z=I(M,j),it=I(M,j+1);t.triN($,q,tt,Z,Z,it,h),t.triN($,tt,z,Z,it,it,h);let vt=d(_,j),kt=d(_,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(M,j),rt=C(M,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=d(M,0),G=d(_,0),X=d(_,c),L=d(M,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(M,T),v=I(_,T),G=I(_,T+1),X=I(M,T+1);if(R(M,T)||R(_,T)){let z=(rt,Ot)=>{let Kt=(e.startBin+rt+.5)*n.binStepDeg,Lt=i[rt]+(o[rt]-i[rt])*(T+.5)/c,Rt=pt(n.centre,Lt,Kt);return[Rt.x*f,Ot,Rt.y*f]},q=d(M,T),tt=d(_,T),Z=z(M,u[M][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=d(_,T+1),kt=d(M,T+1),dt=z(M,u[M][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=d(M,T),Y=d(_,T),j=d(_,T+1),$=d(M,T+1);t.triN(L,Y,j,C,v,G,h),t.triN(L,j,$,C,G,X,h)}let N=d(M,0),O=d(_,0),P=d(_,c),F=d(M,c),S=T=>[T[0],a,T[2]];t.tri(S(N),S(P),S(O),[0,-1,0],b),t.tri(S(N),S(F),S(P),[0,-1,0],b),B(N,O),B(F,P)}if(!e.closed)for(let M of[0,l-1])for(let _=0;_<c;_++)B(d(M,_),d(M,_+1))}function ce(t,n,e){let{bottomY:i,colors:o,ao:a}=e,r=new Float64Array(n.binCount).fill(-1/0);for(let f of n.rings)for(let m of f.arcs){let u=new Float64Array(m.binCount),h=new Float64Array(m.binCount);for(let p=0;p<m.binCount;p++){let y=(m.startBin+p)%n.binCount,d=Math.max(0,m.innerR[p]-ot);u[p]=Math.max(d,r[y]+.001),h[p]=Math.max(u[p]+.001,m.outerR[p]+ot)}let b=0;for(let p=0;p<m.binCount;p++){let y=m.topLevelM[p]-i;y>b&&(b=y)}b>=To&&Oo(t,n,m,u,h,i,o,a);for(let p=0;p<m.binCount;p++){let y=(m.startBin+p)%n.binCount;h[p]>r[y]&&(r[y]=h[p])}}if(e.deriveShell===!1||vo(e.shapes,n))return;let s=n.rings[n.rings.length-1],l=Bo*lt,c=Eo*lt;for(let f of s.arcs){let m=[],u=[];for(let p=0;p<f.binCount;p++){let y=(f.startBin+p+.5)*n.binStepDeg,d=f.outerR[p]+ot+l;m.push(pt(n.centre,d,y)),u.push(pt(n.centre,d+c,y))}let h=-1/0;for(let p=0;p<f.binCount;p++)f.topLevelM[p]>h&&(h=f.topLevelM[p]);let b=()=>h+Co;f.closed?K(t,u,[m.slice().reverse()],b,i,o.shellTop,o.shellWall,a):K(t,[...u,...m.slice().reverse()],void 0,b,i,o.shellTop,o.shellWall,a)}}function ue(t,n,e,i,o,a,r,s){if(!n.outline||n.outline.length<3)return;let l=e.baseHeightM,c=st(i,s.tierTop);if(!o)return;let f=y=>o.deckAt(y.x,y.y),m=Zn(n,r),u=m[0]??n.outline;if(o.rowLevels.length>=2){let y=Wt(o.rowLevels),d=Kn(Yn(o.rowLevels,e.focal,y),m),x=()=>[0,1,0];for(let A of d){let E=Math.max(l,A.topY-.02);for(let R of a.subtract(A.outline,E))K(t,R,A.holes,()=>E,l,c,s.tierWall,W,void 0,x)}d.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])Hn(t,o.rowLevels,e.focal,o.landingY,w,A,y);return}let h=o.flat?1/0:$n,b=y=>o.normalAt(y.x,y.y),p=o.flat?o.landingY:void 0;for(let y of a.subtract(u,p))K(t,y,n.holes,f,l,c,s.tierWall,W,h,b)}function Lo(t,n,e){let i=new Set;for(let r of t.objects)r.type==="section"&&i.add(r.id);let o=new Map;for(let r=0;r<n.length;r++){let s=e.seatOwner[r];if(!s||!i.has(s))continue;let l=e.bySection.get(s);if(l&&l.rowLevels.length>=2)continue;let c=n[r],f=o.get(s);f||(f=new Map,o.set(s,f));let m=c.rowId||`__seat-${r}`,u=f.get(m);u||(u={pts:[],levelM:0,n:0},f.set(m,u)),u.pts.push({x:c.x,y:c.y}),u.levelM+=e.seatDeckY(r),u.n++}let a=[];for(let r of t.objects){if(r.type!=="section")continue;let s=e.bySection.get(r.id);if(s&&s.rowLevels.length>=2){let c=s.rowLevels.filter(f=>!f.patch).map(f=>({pts:f.pts,levelM:f.y}));c.length>=2&&a.push({sectionId:r.id,rows:c});continue}let l=o.get(r.id);l&&a.push({sectionId:r.id,rows:[...l.values()].map(c=>({pts:c.pts,levelM:c.levelM/c.n}))})}return a}function le(t,n,e,i,o,a,r=!0){let s=Lo(n,e,i);if(!s.length)return;let l=Pn(s,n.focal);l&&(t.setMaterial(0),ce(t,l,{bottomY:n.baseHeightM,colors:{bandTop:et(o.tierTop,.8),bandWall:o.tierWall,shellTop:a??et(o.tierWall,1.15),shellWall:a??o.tierWall},ao:W,shapes:n.objects.filter(c=>c.type==="shape"),deriveShell:r}))}var Go=6,Do=2.2,me=.1,No=.3,Xo=1.8,Uo=.9,Yo=.55,jo=6e3;function fe(t){let{doc:n,units:e,seats:i,surfaces:o,focal:a}=t,r=n.zones??[],s=[];if(r.length){let l=new Map;for(let f of e)for(let m of f.objects)m.type==="section"&&m.zone&&l.set(m.id,m.zone);let c=new Map;for(let f=0;f<i.length;f++){let m=i[f],u=o.seatOwner[f],h=m.zoneId??(u?l.get(u):void 0);if(!h)continue;let b=c.get(h);b||(b={n:0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0,sumY:0},c.set(h,b)),b.n++,m.x<b.minX&&(b.minX=m.x),m.y<b.minY&&(b.minY=m.y),m.x>b.maxX&&(b.maxX=m.x),m.y>b.maxY&&(b.maxY=m.y),b.sumY+=o.seatDeckY(f)}for(let f of r){let m=c.get(f.id),u=[];for(let[h,b]of l)b===f.id&&u.push(h);if(!m||m.n===0){s.push({id:f.id,label:f.label,color:H(f.color),sectionIds:u,seatCount:0,center:[0,0,0],radius:0,focalWorld:[(f.focalPoint??a).x*g,1.5,(f.focalPoint??a).y*g]});continue}s.push({id:f.id,label:f.label,color:H(f.color),sectionIds:u,seatCount:m.n,center:[(m.minX+m.maxX)/2*g,m.sumY/m.n,(m.minY+m.maxY)/2*g],radius:.5*Math.hypot((m.maxX-m.minX)*g,(m.maxY-m.minY)*g)||1,focalWorld:[(f.focalPoint??a).x*g,1.5,(f.focalPoint??a).y*g]})}}return s}function he(t){let{doc:n,units:e,seats:i,surfaces:o,seatData:a,hintedSeatFloor:r,zones:s,focal:l}=t,c=[],f=[],m=[];for(let u of s)u.seatCount!==0&&c.push({id:`zone:${u.id}`,kind:"zone",text:u.label,anchor:[u.center[0],u.center[1]+Go,u.center[2]],color:n.zones?.find(h=>h.id===u.id)?.color});{let u=new Map,h=new Map;for(let b=0;b<i.length;b++){let p=o.seatOwner[b];if(!p)continue;let y=u.get(p);y||(y={n:0,x:0,y:0,deck:0},u.set(p,y)),y.n++,y.x+=i[b].x,y.y+=i[b].y,y.deck+=o.seatDeckY(b);let d=h.get(p);d||(d={minX:1/0,maxX:-1/0,minY:1/0,maxY:-1/0},h.set(p,d)),i[b].x<d.minX&&(d.minX=i[b].x),i[b].x>d.maxX&&(d.maxX=i[b].x),i[b].y<d.minY&&(d.minY=i[b].y),i[b].y>d.maxY&&(d.maxY=i[b].y)}for(let b of e)for(let p of b.objects){if(p.type!=="section")continue;let y=u.get(p.id);if(!y||y.n===0)continue;let d=h.get(p.id),x=[y.x/y.n*g,y.deck/y.n,y.y/y.n*g],w=p.displayLabel||p.label||p.id;f.push({id:p.id,floorIndex:b.index,label:w,seatCount:y.n,center:x,radius:Math.max(1,Math.hypot(d.maxX-d.minX,d.maxY-d.minY)*.5*g),focalWorld:[b.focal.x*g,b.baseHeightM+1.5,b.focal.y*g]});let 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]+Do,x[2]],floorIndex:b.index})}}{for(let b of e)for(let p of b.objects){if(p.type!=="gaArea")continue;let y=At(p.points);if(!y)continue;let d=p.displayLabel||p.label||p.id;c.push({id:`ga:${p.id}`,kind:"ga",text:p.capacity>0?`${d} \xB7 ${p.capacity.toLocaleString()}`:d,anchor:[y.x*g,b.baseHeightM+Xo,y.y*g],floorIndex:b.index})}let u=new Map;for(let b=0;b<i.length;b++){let p=i[b],y=Math.hypot(p.x-l.x,p.y-l.y),d=u.get(p.rowId);(!d||y>d.far)&&u.set(p.rowId,{seat:p,index:b,far:y})}for(let[b,p]of u){let y=p.seat.label?p.seat.label.lastIndexOf("-"):-1,d=y>0?p.seat.label.slice(0,y):b;d&&c.push({id:`row:${b}`,kind:"row",text:d,anchor:[p.seat.x*g,o.seatDeckY(p.index)+Uo,p.seat.y*g],floorIndex:r[p.index]})}let h=new Map;for(let b=0;b<i.length;b++){let p=i[b],y=p.label?p.label.lastIndexOf("-"):-1,d=h.get(p.rowId);d||(d={n:0,x:0,y:0,z:0,minX:1/0,maxX:-1/0,minZ:1/0,maxZ:-1/0,label:y>0?p.label.slice(0,y):p.rowId,sectionId:p.sectionId},h.set(p.rowId,d));let x=b*3,w=a.iPosition[x],A=a.iPosition[x+1],E=a.iPosition[x+2];d.n++,d.x+=w,d.y+=A,d.z+=E,d.minX=Math.min(d.minX,w),d.maxX=Math.max(d.maxX,w),d.minZ=Math.min(d.minZ,E),d.maxZ=Math.max(d.maxZ,E)}for(let[b,p]of h)m.push({id:b,label:p.label,sectionId:p.sectionId,seatCount:p.n,center:[p.x/p.n,p.y/p.n,p.z/p.n],radius:Math.max(.8,Math.hypot(p.maxX-p.minX,p.maxZ-p.minZ)*.5)});if(i.length<=jo)for(let b=0;b<i.length;b++){let p=i[b],y=p.displayLabel||p.label;y&&c.push({id:`seat:${p.id}`,kind:"seat",text:y,anchor:[p.x*g,o.seatDeckY(b)+Yo,p.y*g],floorIndex:r[b]})}}for(let u of e)for(let h of u.objects)if(h.type==="shape"&&h.role&&["entrance","exit","screen","suite","obstruction"].includes(h.role)){let b=bt(h),p=b?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+me,p.y*g],color:h.fill,floorIndex:u.index})}else if(h.type==="text"){if(!h.text)continue;c.push({id:`text:${h.id}`,kind:"annotation",text:h.text,anchor:[h.position.x*g,u.baseHeightM+me,h.position.y*g],color:h.color,rotation:h.rotation,floorIndex:u.index})}else if(h.type==="booth"){let b=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+cn+No,p.y*g],floorIndex:u.index})}return{labels:c,sections:f,rows:m}}function be(t,n){if(n.length>1)for(let e of n)t.push({id:`floor:${e.id}`,kind:"floor",text:e.label,anchor:[e.center[0],e.box.max[1]+1.2,e.center[2]],floorIndex:e.index})}function pe(t){let{doc:n,units:e,seats:i,surfaces:o,solids:a,hintedSeatFloor:r,seatFloor:s}=t,l=[];{let c=e.map(()=>({minX:1/0,minY:1/0,minZ:1/0,maxX:-1/0,maxY:-1/0,maxZ:-1/0}));for(let u=0;u<a.floor.length;u+=1){let h=Math.max(0,Math.min(e.length-1,Math.round(a.floor[u]))),b=u*3,p=c[h];p.minX=Math.min(p.minX,a.position[b]),p.minY=Math.min(p.minY,a.position[b+1]),p.minZ=Math.min(p.minZ,a.position[b+2]),p.maxX=Math.max(p.maxX,a.position[b]),p.maxY=Math.max(p.maxY,a.position[b+1]),p.maxZ=Math.max(p.maxZ,a.position[b+2])}let f=new Map;for(let u=0;u<e.length;u++)for(let h of e[u].objects)h.type==="section"&&f.set(h.id,u);let m=e.map(()=>({n:0,minX:1/0,minY:1/0,minDeck:1/0,maxX:-1/0,maxY:-1/0,maxDeck:-1/0,sumX:0,sumDeck:0,sumZ:0}));for(let u=0;u<i.length;u++){let h=o.seatOwner[u],b=(h!==null?f.get(h):void 0)??r[u];if(b===void 0)continue;let p=m[b],y=i[u];p.n++,y.x<p.minX&&(p.minX=y.x),y.y<p.minY&&(p.minY=y.y),y.x>p.maxX&&(p.maxX=y.x),y.y>p.maxY&&(p.maxY=y.y);let d=o.seatDeckY(u);p.sumX+=y.x*g,p.sumDeck+=d,p.sumZ+=y.y*g,p.minDeck=Math.min(p.minDeck,d),p.maxDeck=Math.max(p.maxDeck,d+1.6),s[u]=b}for(let u=0;u<e.length;u++){let h=m[u],b=n.floors?.[u],p=c[u],y=Math.min(h.n?h.minX*g:e[u].focal.x*g-1,Number.isFinite(p.minX)?p.minX:1/0),d=Math.max(h.n?h.maxX*g:e[u].focal.x*g+1,Number.isFinite(p.maxX)?p.maxX:-1/0),x=Math.min(h.n?h.minY*g:e[u].focal.y*g-1,Number.isFinite(p.minZ)?p.minZ:1/0),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),R=[h.n?h.sumX/h.n:(y+d)/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(d-y,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:R,radius:I,box:{min:[y,A,x],max:[d,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,i=1/0,o=-1/0,a=-1/0,r=(s,l)=>{s<e&&(e=s),l<i&&(i=l),s>o&&(o=s),l>a&&(a=l)};for(let s of n)r(s.x,s.y);for(let s of t)for(let l of s.objects)if(l.type==="section")for(let c of l.outline)r(c.x,c.y);else if(l.type==="shape"&&l.points)for(let c of l.points)r(c.x,c.y);else if(l.type==="gaArea")for(let c of l.points)r(c.x,c.y);else if(l.type==="booth"){let c=Ft(l);if(c)for(let f of c)r(f.x,f.y)}else if(l.type==="table"){let c=un(l);if(c)for(let f of c)r(f.x,f.y)}else if(l.type==="decorImage"){let c=ln(l);if(c)for(let f of c)r(f.x,f.y)}return Number.isFinite(e)||(e=-100,i=-100,o=100,a=100),{minX:e,minY:i,maxX:o,maxY:a}}function de(t,n,e,i,o,a){if(n.length===1){let r=Math.max(60,(o.maxX-o.minX+o.maxY-o.minY)*.06),s=Tt(o.minX-r,o.minY-r,o.maxX-o.minX+r*2,o.maxY-o.minY+r*2);K(t,s,void 0,()=>0,-.4,a.ground,a.ground,W)}else{let r=n.reduce((h,b)=>b.baseHeightM<h.baseHeightM?b:h);t.setFloor(r.index);let s=e.filter((h,b)=>i[b]===r.index),l=mn([r],s),c=Math.hypot(l.maxX-l.minX,l.maxY-l.minY),f=Math.max(28,Math.min(80,c*.04)),m=Tt(l.minX-f,l.minY-f,l.maxX-l.minX+f*2,l.maxY-l.minY+f*2),u=r.baseHeightM-.03;K(t,m,void 0,()=>u,u-.22,a.ground,a.ground,W)}}function ye(t,n,e){let{cx:i,cz:o,radius:a}=e,r=1/0,s=1/0,l=1/0,c=-1/0,f=-1/0,m=-1/0,u=(p,y,d)=>{r=Math.min(r,p),c=Math.max(c,p),s=Math.min(s,y),f=Math.max(f,y),l=Math.min(l,d),m=Math.max(m,d)};for(let p=0;p<t.position.length;p+=3)u(t.position[p],t.position[p+1],t.position[p+2]);for(let p=0;p<n.count;p++){let y=p*3,d=n.iPosition[y],x=n.iPosition[y+1],w=n.iPosition[y+2],A=Math.max(.35,n.iMaxRadius[p]??.35);u(d-A,x,w-A),u(d+A,x+1.6,w+A)}Number.isFinite(r)||(r=i-a,c=i+a,s=0,f=a*.16,l=o-a,m=o+a);let h=[(r+c)/2,(s+f)/2,(l+m)/2],b=Math.max(1,.5*Math.hypot(c-r,f-s,m-l));return{center:h,radius:b,minY:s,maxY:f}}function xe(t,n,e,i,o,a){let r=1/0,s=1/0,l=-1/0,c=-1/0;for(let A=0;A<t.count;A++){let E=A*3,R=t.iPosition[E],I=t.iPosition[E+2];R<r&&(r=R),R>l&&(l=R),I<s&&(s=I),I>c&&(c=I)}for(let A of n)r=Math.min(r,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,y=u,d=h;if(Number.isFinite(r)){let A=Math.max(2,.06*Math.hypot(l-r,c-s));b=Math.max(f,r-A),p=Math.min(m,l+A),y=Math.max(u,s-A),d=Math.min(h,c+A)}let x=Math.min(0,i),w=Math.max(o,a*.05);return{min:[b,x,y],max:[p,w,d]}}function ge(t,n,e){let i=()=>({byObjectId:new Map,elements:[]});if(!n||!t)return i();let o=bn(n);if(!o.ok||o.value.id!==t)return i();let a=new Map;for(let m of e)for(let u of m.objects)u.type==="shape"&&a.set(u.id,{shape:u,unit:m});let r=new Set,s=new Set,l=new Map((n.overlay.productionElements??[]).map(m=>{let u=m.runtimeContentImageUrl;return[m.id,typeof u=="string"&&/^(?:blob:|data:image\/|https:\/\/)/.test(u)?u:void 0]})),c=[];for(let m of o.value.overlay.productionElements??[]){let u=a.get(m.objectId),h=u?bt(u.shape):null,b=m.baseElevationM??0;if(!u||!h||h.length<3||!m.id||r.has(m.id)||s.has(m.objectId)||!Number.isFinite(m.heightM)||m.heightM<.05||m.heightM>50||!Number.isFinite(b)||b<-10||b>100)return i();r.add(m.id),s.add(m.objectId);let p=h.map(B=>B.x*g),y=h.map(B=>B.y*g),d=u.unit.baseHeightM+b,x=Math.min(...p),w=Math.max(...p),A=Math.min(...y),E=Math.max(...y),R,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;R=[[x,d,B],[w,d,B],[x,d+m.heightM,B],[w,d+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;R=[[B,d,A],[B,d,E],[B,d+m.heightM,A],[B,d+m.heightM,E]]}c.push({id:m.id,objectId:m.objectId,kind:m.kind,floorIndex:u.unit.index,baseY:d,topY:d+m.heightM,bounds:{min:[x,d,A],max:[w,d+m.heightM,E]},occlusion:m.occlusion,...I?{contentImageUrl:I}:{},...R?{contentPlane:R}:{}})}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 Ho(t){let n=[t];for(;n.length;){let e=n.pop();if(Array.isArray(e)){n.push(...e);continue}if(!Q(e))continue;let i=Q(e.extensions)?e.extensions:null;if(i&&Object.prototype.hasOwnProperty.call(i,"KHR_draco_mesh_compression"))return!0;n.push(...Object.values(e))}return!1}function Zt(t,n){return!Array.isArray(t)||t.length!==n||!t.every(e=>typeof e=="number"&&Number.isFinite(e))?null:t}function Vo(){return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}function Wo(t,n){let e=new Array(16).fill(0);for(let i=0;i<4;i++)for(let o=0;o<4;o++)for(let a=0;a<4;a++)e[i*4+o]+=t[a*4+o]*n[i*4+a];return e}function zo(t){let n=Zt(t.matrix,16);if(n)return n;if(t.matrix!==void 0)return null;let e=t.translation===void 0?[0,0,0]:Zt(t.translation,3),i=t.rotation===void 0?[0,0,0,1]:Zt(t.rotation,4),o=t.scale===void 0?[1,1,1]:Zt(t.scale,3);if(!e||!i||!o)return null;let[a,r,s,l]=i,c=Math.hypot(a,r,s,l);if(!(c>1e-8))return null;let f=a/c,m=r/c,u=s/c,h=l/c,b=f+f,p=m+m,y=u+u,d=f*b,x=f*p,w=f*y,A=m*p,E=m*y,R=u*y,I=h*b,B=h*p,k=h*y;return[(1-(A+R))*o[0],(x+k)*o[0],(w-B)*o[0],0,(x-k)*o[1],(1-(d+R))*o[1],(E+I)*o[1],0,(w+B)*o[2],(E-I)*o[2],(1-(d+A))*o[2],0,e[0],e[1],e[2],1]}function Zo(t,n,e,i){return[t[0]*n+t[4]*e+t[8]*i+t[12],t[1]*n+t[5]*e+t[9]*i+t[13],t[2]*n+t[6]*e+t[10]*i+t[14]]}function Ko(t){let n=t[0],e=t[4],i=t[8],o=t[1],a=t[5],r=t[9],s=t[2],l=t[6],c=t[10],f=a*c-r*l,m=r*s-o*c,u=o*l-a*s,h=n*f+e*m+i*u;if(Math.abs(h)<1e-12)return null;let b=1/h;return[f*b,m*b,u*b,(i*l-e*c)*b,(n*c-i*s)*b,(e*s-n*l)*b,(e*r-i*a)*b,(i*o-n*r)*b,(n*a-e*o)*b]}function Me(t,n,e,i){let o=t[0]*n+t[1]*e+t[2]*i,a=t[3]*n+t[4]*e+t[5]*i,r=t[6]*n+t[7]*e+t[8]*i,s=Math.hypot(o,a,r)||1;return o/=s,a/=s,r/=s,[o,a,r]}function $o(t){if(t.byteLength<20||t.byteLength>8388608)return null;let n=new DataView(t.buffer,t.byteOffset,t.byteLength);if(n.getUint32(0,!0)!==1179937895||n.getUint32(4,!0)!==2||n.getUint32(8,!0)!==t.byteLength)return null;let e=12,i=null,o=null;for(;e+8<=t.byteLength;){let a=n.getUint32(e,!0),r=n.getUint32(e+4,!0);if(e+=8,a%4!==0||e+a>t.byteLength)return null;let s=t.subarray(e,e+a);if(r===1313821514&&!i)try{let l=JSON.parse(new TextDecoder().decode(s).replace(/[\u0000 ]+$/g,""));if(!Q(l))return null;i=l}catch{return null}else if(r===5130562&&!o)o=s;else return null;e+=a}return e===t.byteLength&&i&&o?{json:i,bin:o}:null}function qo(t){return t===5120||t===5121?1:t===5122||t===5123?2:t===5125||t===5126?4:0}function Jo(t){return t==="SCALAR"?1:t==="VEC2"?2:t==="VEC3"?3:t==="VEC4"?4:0}function Qo(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 tr(t){let n=t instanceof Uint8Array?t:new Uint8Array(t),e=$o(n);if(!e)return{ok:!1,issue:"invalid_glb"};let{json:i,bin:o}=e;if(!Q(i.asset)||i.asset.version!=="2.0")return{ok:!1,issue:"unsupported_glb"};let a=J(i.extensionsUsed).filter(A=>typeof A=="string");if(a.includes("KHR_draco_mesh_compression")||Ho(i))return{ok:!1,issue:"draco_not_allowed"};if(a.length||J(i.extensionsRequired).length)return{ok:!1,issue:"unsupported_glb"};if(J(i.images).length||J(i.textures).length)return{ok:!1,issue:"external_resource"};let r=J(i.buffers);if(r.length!==1||!Q(r[0])||r[0].uri!==void 0||typeof r[0].byteLength!="number"||!Number.isInteger(r[0].byteLength)||r[0].byteLength<0||r[0].byteLength>o.byteLength)return{ok:!1,issue:"external_resource"};let s=J(i.accessors),l=J(i.bufferViews),c=J(i.meshes),f=J(i.nodes),m=J(i.scenes),u=typeof i.scene=="number"?i.scene:0;if(!Q(m[u]))return{ok:!1,issue:"unsupported_glb"};let h=new DataView(o.buffer,o.byteOffset,o.byteLength),b=(A,E,R)=>{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"||!R.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=Jo(I.type),D=qo(I.componentType),U=typeof B.byteStride=="number"?B.byteStride:k*D,M=typeof B.byteOffset=="number"?B.byteOffset:0,_=typeof I.byteOffset=="number"?I.byteOffset:0,N=M+_,O=_+(I.count-1)*U+k*D;if(!Number.isInteger(U)||!Number.isInteger(M)||!Number.isInteger(_)||U<k*D||M<0||_<0||M+B.byteLength>o.byteLength||O>B.byteLength)return null;let P=[];for(let F=0;F<I.count;F++){let S=[];for(let T=0;T<k;T++){let C=Qo(h,N+F*U+T*D,I.componentType);if(!Number.isFinite(C))return null;S.push(C)}P.push(S)}return P},p=[],y=[],d=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 R=f[A],I=zo(R);if(!I)return!1;let B=Wo(E,I),k=Ko(B);if(!k)return!1;if(R.mesh!==void 0){if(typeof R.mesh!="number")return!1;let D=c[R.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 M=b(U.attributes.POSITION,"VEC3",[5126]),_=U.attributes.NORMAL===void 0?null:b(U.attributes.NORMAL,"VEC3",[5126]);if(!M||U.attributes.NORMAL!==void 0&&!_)return!1;let N=M.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||(d+=N/3,d>1e5))return!1;let O=U.indices===void 0?M.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>=M.length))return!1;let S=F.map(C=>Zo(B,...M[C])),T=null;if(!_){let C=S[1][0]-S[0][0],v=S[1][1]-S[0][1],G=S[1][2]-S[0][2],X=S[2][0]-S[0][0],L=S[2][1]-S[0][1],Y=S[2][2]-S[0][2];T=Me([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(...S[C]),y.push(..._?Me(k,..._[F[C]]):T)}}}for(let D of J(R.children))if(!w(D,B))return!1;return x.delete(A),!0};for(let A of J(m[u].nodes))if(!w(A,Vo()))return{ok:!1,issue:d>1e5?"triangle_limit":"unsupported_glb"};return!d||p.length!==d*9||y.length!==p.length?{ok:!1,issue:"unsupported_glb"}:{ok:!0,triangleCount:d,position:new Float32Array(p),normal:new Float32Array(y)}}function Se(t){try{return tr(t)}catch{return{ok:!1,issue:"invalid_glb"}}}function gs(t){let{doc:n}=t,e=Fn(n.theme),i=e.structure,o=zn(n,t.eventConfigurationId??n.eventConfigurationId),a=ge(t.eventConfigurationId,t.eventConfiguration,o),r=t.seats,s=new Yt,l=null;if(t.registeredShellGlb){let P=Se(t.registeredShellGlb);if(P.ok){let F=P.position.length/3,S=new Float32Array(P.position.length),T=e.materials.shell??i.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);S[C*3]=T[0]*G,S[C*3+1]=T[1]*G,S[C*3+2]=T[2]*G}l={position:P.position,normal:P.normal,color:S,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=r.map(P=>c.get(P.sectionId??"")??c.get(P.rowId??"")??0),m=mn(o,r);de(s,o,r,f,m,i);let u=Jn(n,r),h=new Map,b=new Map;for(let P of n.categories??[])h.set(P.key,P.color),P.seatGlyph&&b.set(P.key,P.seatGlyph);let p=[],y=qn(o,r,f),d=new Float32Array(r.length),x=[];for(let P=0;P<o.length;P++){let F=o[P];s.setFloor(P);let S=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;ue(s,v,F,Qn(v,u),y.bySection.get(v.id),S,C,i);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),ie(s,v,F.baseHeightM,te(v,T),i,F.focal,p,G),s.setMaterial(0)}else v.type==="gaArea"?ae(s,v,F.baseHeightM,H(h.get(v.categoryKey)),i):v.type==="booth"?oe(s,v,F.baseHeightM,H(h.get(v.categoryKey)),i):v.type==="table"?re(s,v,F.baseHeightM,H(h.get(v.categoryKey)),i):v.type==="decorImage"&&se(s,v,F.baseHeightM,i);le(s,F,r,y,i,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=_n(l?[s.build(),l]:[s.build()]),E=Cn(r,t.initialState,y,d,h,b),R=fe({doc:n,units:o,seats:r,surfaces:y,focal:w}),{labels:I,sections:B,rows:k}=he({doc:n,units:o,seats:r,surfaces:y,seatData:E,hintedSeatFloor:f,zones:R,focal:w}),D=pe({doc:n,units:o,seats:r,surfaces:y,solids:A,hintedSeatFloor:f,seatFloor:d});be(I,D),E.iYaw=En(E.iPosition,r.length,P=>r[P].rowId,P=>{let F=o[d[P]]?.focal??w;return[F.x*g,F.y*g]});let U=(m.minX+m.maxX)/2*g,M=(m.minY+m.maxY)/2*g,_=.5*Math.hypot((m.maxX-m.minX)*g,(m.maxY-m.minY)*g)||10,N=ye(A,E,{cx:U,cz:M,radius:_}),O=xe(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:vn(e,Bt),theme:e,seatCount:r.length,focalWorld:[w.x*g,1.5,w.y*g],zones:R,stages:p,productionElements:a.elements,sections:B,rows:k,labels:I,floors:D}}export{Bt as a,Qt as b,cr as c,nn as d,g as e,lr as f,Le as g,De as h,mr as i,Vt as j,Mr as k,Sr as l,Pr as m,Ir as n,wr as o,_r as p,Tr as q,Br as r,Er as s,Cr as t,Fr as u,vr as v,gs as w};
1
+ import{a as An,c as Pn,d as In}from"./chunk-PRED5KHO.js";import{f as hn,m as gn,o as Nt,p as ft,r as It,u as Rn}from"./chunk-WXGW2SYC.js";import{e as Mn,k as Sn}from"./chunk-UL5OIGIF.js";import{Na as qt,f as bn,ga as ut,ha as lt,qa as Gt,sa as dn,ta as Dt,va as yn,x as pn,y as At,za as xn}from"./chunk-24O23MNB.js";import{A as Pt,d as H,y as nt}from"./chunk-JBOTRSMY.js";import Re from"earcut";import Ae from"polygon-clipping";var g=ut,Pe=.002;function Ie(t,n,e){let i=Math.hypot(n[0]-t[0],n[1]-t[1],n[2]-t[2]),o=Math.hypot(e[0]-n[0],e[1]-n[1],e[2]-n[2]),a=Math.hypot(t[0]-e[0],t[1]-e[1],t[2]-e[2]),r=Math.max(i,o,a);if(r<1e-9)return!0;let s=(i+o+a)/2;return 2*Math.sqrt(Math.max(0,s*(s-i)*(s-o)*(s-a)))/r<Pe}var ht=class{constructor(n=16384){this.len=0;this.buf=new Float32Array(n)}push3(n,e,i){this.len+3>this.buf.length&&this.grow(this.len+3),this.buf[this.len++]=n,this.buf[this.len++]=e,this.buf[this.len++]=i}push1(n){this.len+1>this.buf.length&&this.grow(this.len+1),this.buf[this.len++]=n}grow(n){let e=this.buf.length*2;for(;e<n;)e*=2;let i=new Float32Array(e);i.set(this.buf.subarray(0,this.len)),this.buf=i}get length(){return this.len}toArray(){return this.buf.slice(0,this.len)}},Yt=class{constructor(){this.pos=new ht;this.nor=new ht;this.col=new ht;this.flr=new ht;this.mat=new ht;this.currentFloor=0;this.currentMaterial=0}setFloor(n){this.currentFloor=n}setMaterial(n){this.currentMaterial=n}tri(n,e,i,o,a,r=a,s=a){Ie(n,e,i)||(this.pos.push3(n[0],n[1],n[2]),this.pos.push3(e[0],e[1],e[2]),this.pos.push3(i[0],i[1],i[2]),this.nor.push3(o[0],o[1],o[2]),this.nor.push3(o[0],o[1],o[2]),this.nor.push3(o[0],o[1],o[2]),this.col.push3(a[0],a[1],a[2]),this.col.push3(r[0],r[1],r[2]),this.col.push3(s[0],s[1],s[2]),this.flr.push1(this.currentFloor),this.flr.push1(this.currentFloor),this.flr.push1(this.currentFloor),this.mat.push1(this.currentMaterial),this.mat.push1(this.currentMaterial),this.mat.push1(this.currentMaterial))}triN(n,e,i,o,a,r,s,l=s,c=s){[...n,...e,...i].every(Number.isFinite)&&(this.pos.push3(n[0],n[1],n[2]),this.pos.push3(e[0],e[1],e[2]),this.pos.push3(i[0],i[1],i[2]),this.nor.push3(o[0],o[1],o[2]),this.nor.push3(a[0],a[1],a[2]),this.nor.push3(r[0],r[1],r[2]),this.col.push3(s[0],s[1],s[2]),this.col.push3(l[0],l[1],l[2]),this.col.push3(c[0],c[1],c[2]),this.flr.push1(this.currentFloor),this.flr.push1(this.currentFloor),this.flr.push1(this.currentFloor),this.mat.push1(this.currentMaterial),this.mat.push1(this.currentMaterial),this.mat.push1(this.currentMaterial))}get vertexCount(){return this.pos.length/3}build(){return{position:this.pos.toArray(),normal:this.nor.toArray(),color:this.col.toArray(),floor:this.flr.toArray(),material:this.mat.toArray(),count:this.pos.length/3}}};function we(t,n,e){let i=n[0]-t[0],o=n[1]-t[1],a=n[2]-t[2],r=e[0]-t[0],s=e[1]-t[1],l=e[2]-t[2],c=o*l-a*s,f=a*r-i*l,m=i*s-o*r,u=Math.hypot(c,f,m)||1;return c/=u,f/=u,m/=u,[c,f,m]}function _e(t,n){let e=[...t],i=[];for(let r of t)i.push(r.x,r.y);let o=[];if(n){for(let r of n)if(!(r.length<3)){o.push(e.length);for(let s of r)e.push(s),i.push(s.x,s.y)}}let a=Re(i,o.length?o:void 0,2);return{pts:e,tris:a}}function Jt(t){return ft(t)<0?[...t].reverse():t}var Te=3;function Be(t,n,e,i){let o=i(t),a=i(n),r=i(e),s=(h,b,p,y)=>Math.abs(i({x:(h.x+b.x)/2,y:(h.y+b.y)/2})-(p+y)/2),l=(t.x+n.x+e.x)/3,c=(t.y+n.y+e.y)/3,f=(o+a+r)/3,m=Math.max(s(t,n,o,a),s(n,e,a,r),s(e,t,r,o),Math.abs(i({x:l,y:c})-f)),u=(h,b,p)=>{let y=Math.abs(i({x:(h+l)/2,y:(b+c)/2})-(p+f)/2);y>m&&(m=y)};return u((t.x+n.x)/2,(t.y+n.y)/2,(o+a)/2),u((n.x+e.x)/2,(n.y+e.y)/2,(a+r)/2),u((e.x+t.x)/2,(e.y+t.y)/2,(r+o)/2),m}function wt(t,n,e,i,o){if(o<=0)return Be(t,n,e,i);let a={x:(t.x+n.x)/2,y:(t.y+n.y)/2},r={x:(n.x+e.x)/2,y:(n.y+e.y)/2},s={x:(e.x+t.x)/2,y:(e.y+t.y)/2};return Math.max(wt(t,a,s,i,o-1),wt(a,n,r,i,o-1),wt(s,r,e,i,o-1),wt(a,r,s,i,o-1))}function _t(t,n,e,i,o,a,r,s){if(r>0){let u={x:(n.x+e.x)/2,y:(n.y+e.y)/2},h={x:(e.x+i.x)/2,y:(e.y+i.y)/2},b={x:(i.x+n.x)/2,y:(i.y+n.y)/2};_t(t,n,u,b,o,a,r-1,s),_t(t,u,e,h,o,a,r-1,s),_t(t,b,h,i,o,a,r-1,s),_t(t,u,h,b,o,a,r-1,s);return}let l=[n.x*g,o(n),n.y*g],c=[e.x*g,o(e),e.y*g],f=[i.x*g,o(i),i.y*g];if(s){t.triN(l,c,f,s(n),s(e),s(i),a);return}let m=we(l,c,f);m[1]<0&&(m=[-m[0],-m[1],-m[2]]),t.tri(l,c,f,m,a)}var Ee=8;function wn(t,n,e){if(!Number.isFinite(e))return t;let i=[],o=(a,r,s,l,c)=>{if(c>0){let f={x:(a.x+r.x)/2,y:(a.y+r.y)/2},m=n(f);if(Math.abs(m-(s+l)/2)>e){o(a,f,s,m,c-1),o(f,r,m,l,c-1);return}}i.push(a)};for(let a=0;a<t.length;a++){let r=t[a],s=t[(a+1)%t.length];o(r,s,n(r),n(s),Ee)}return i}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 i=[];for(let o=0;o<e.length;o++){let a=i.length?i[i.length-1]:e[(o-1+e.length)%e.length],r=e[o],s=e[(o+1)%e.length],l=s.x-a.x,c=s.y-a.y,f=Math.hypot(l,c);f>n&&Math.abs((r.x-a.x)*c-(r.y-a.y)*l)/f<n||i.push(r)}return i.length>=3?i:e}var Ut=.001*lt*.1;function K(t,n,e,i,o,a,r,s,l=1/0,c){if(!n||n.length<3||(l===void 0&&(l=1/0),Math.abs(ft(n))<1e-4))return;let f=Xt(wn(Xt(Jt(n),Ut),i,l),Ut),m=e?.map(R=>Xt(wn(Xt(Jt(R),Ut),i,l),Ut)).filter(R=>R.length>=3&&Math.abs(ft(R))>=1e-4),{pts:u,tris:h}=_e(f,m),b=[a[0]*s.top,a[1]*s.top,a[2]*s.top],p=[a[0]*s.bottomCap,a[1]*s.bottomCap,a[2]*s.bottomCap],y=[r[0]*s.top,r[1]*s.top,r[2]*s.top],d=[r[0]*s.wallBottom,r[1]*s.wallBottom,r[2]*s.wallBottom],x=0;if(Number.isFinite(l))for(;x<Te;x++){let R=0;for(let I=0;I<h.length;I+=3){let B=wt(u[h[I]],u[h[I+1]],u[h[I+2]],i,x);B>R&&(R=B)}if(R<=l)break}for(let R=0;R<h.length;R+=3){let I=u[h[R]],B=u[h[R+1]],k=u[h[R+2]];_t(t,I,B,k,i,b,x,c);let D=[I.x*g,o,I.y*g],U=[B.x*g,o,B.y*g],M=[k.x*g,o,k.y*g];t.tri(D,M,U,[0,-1,0],p)}let w=R=>{if(x<=0)return R;let I=1<<x,B=[];for(let k=0;k<R.length;k++){let D=R[k],U=R[(k+1)%R.length];for(let M=0;M<I;M++){let _=M/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 R of m)R.length>=3&&E.push({ring:w(R),flip:!0});for(let{ring:R,flip:I}of E)for(let B=0;B<R.length;B++){let k=R[B],D=R[(B+1)%R.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,S=_*P+N*F;I&&(S=-S),S<0&&(_=-_,N=-N);let T=[_,0,N],C=[k.x*g,i(k),k.y*g],v=[D.x*g,i(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,y,y,d),t.tri(C,X,G,T,y,d,d)}}function _n(t){let n=0;for(let l of t)n+=l.count;let e=new Float32Array(n*3),i=new Float32Array(n*3),o=new Float32Array(n*3),a=new Float32Array(n),r=new Float32Array(n),s=0;for(let l of t)e.set(l.position,s*3),i.set(l.normal,s*3),o.set(l.color,s*3),a.set(l.floor,s),r.set(l.material,s),s+=l.count;return{position:e,normal:i,color:o,floor:a,material:r,count:n}}function jt(t,n,e=2.5){if(n<=0||t.length<3)return t;let i=Jt(t),o=i.length,a=[];for(let s=0;s<o;s++){let l=i[s],c=i[(s+1)%o],f=c.x-l.x,m=c.y-l.y,u=Math.hypot(f,m)||1;a.push({x:m/u,y:-f/u})}let r=[];for(let s=0;s<o;s++){let l=i[s],c=a[(s-1+o)%o],f=a[s],m=c.x+f.x,u=c.y+f.y,h=Math.hypot(m,u),b=()=>{r.push([l.x+c.x*n,l.y+c.y*n]),r.push([l.x+f.x*n,l.y+f.y*n])};if(h<1e-9){b();continue}m/=h,u/=h;let p=m*c.x+u*c.y,y=1/Math.max(p,1e-6);if(!Number.isFinite(y)||y>e){b();continue}r.push([l.x+m*n*y,l.y+u*n*y])}if(r.length<3)return t;try{let s=Ae.union([[...r,r[0]]]),l=null,c=-1/0;for(let m of s){let u=Math.abs(ft(m[0].map(([h,b])=>({x:h,y:b}))));u>c&&(c=u,l=m[0])}if(!l)return t;let f=l.map(([m,u])=>({x:m,y:u}));if(f.length>1){let m=f[0],u=f[f.length-1];Math.abs(m.x-u.x)<1e-9&&Math.abs(m.y-u.y)<1e-9&&f.pop()}return f.length>=3?f:t}catch{return t}}function Ht(t,n,e,i,o=28){let a=[];for(let r=0;r<o;r++){let s=r/o*Math.PI*2;a.push({x:t+e*Math.cos(s),y:n+i*Math.sin(s)})}return a}function Tt(t,n,e,i){return[{x:t,y:n},{x:t+e,y:n},{x:t+e,y:n+i},{x:t,y:n+i}]}var Bt=["available","held","sold","selected","dimmed"];function Qt(t){let n=Bt.indexOf(t);return n<0?0:n}var Tn={available:[.24,.82,.52],held:[.95,.66,.22],sold:[.34,.39,.45],selected:[.24,.74,1],dimmed:[.28,.32,.37]};function cr(t){let n=.2126*t[0]+.7152*t[1]+.0722*t[2],e=.42,i=.62;return[(n+(t[0]-n)*e)*i,(n+(t[1]-n)*e)*i,(n+(t[2]-n)*e)*i]}var tn={ground:[.07,.085,.11],tierTop:[.24,.28,.34],tierWall:[.17,.2,.25],stageTop:[.94,.7,.38],stageWall:[.48,.33,.18],decorTop:[.22,.25,.29],decorWall:[.15,.17,.2],gaTop:[.24,.28,.33],gaWall:[.16,.19,.23],boothTop:[.3,.33,.38],boothWall:[.2,.23,.27],tableTop:[.38,.34,.29],tableWall:[.24,.21,.18]},nn={top:[.05,.06,.08],bottom:[.1,.12,.15]};function et(t,n){return[Math.min(1,t[0]*n),Math.min(1,t[1]*n),Math.min(1,t[2]*n)]}var V={pedestal:0,pad:1,back:2,arm:3,footrest:4,leg:5,body:10,head:11},Ce=.44,Fe=.15,ve=.3,ke=.24;function Bn(t){return t===void 0||!Number.isFinite(t)||t<=0?ke:Math.min(ve,Math.max(Fe,t*Ce))}var lr=.21,Oe=.05,en=.45,Le=en+Oe,Ge=.92,De=1.205,Ne=-.23,Xe=.38,Ue=[{part:V.pedestal,min:[-.3,0,-.3],max:[.3,.36,.3]},{part:V.pad,min:[-1,.36,-.95],max:[1,en,1]},{part:V.back,min:[-1,Le,-1],max:[1,Ge,-.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]}],Ye=[{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]}],je=[{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 mr(){let t=[],n=[],e=[],i=[],o=(O,P,F)=>{let S=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);i.push(S,S+1,S+2,S,S+2,S+3)},a=O=>{for(let P of je){let F=P.c.map(S=>S.map((T,C)=>T?O.max[C]:O.min[C]));o(F,P.n,O.part)}};for(let O of Ue)a(O);for(let O of Ye)a(O);let r=en,s=1.08,l=.47,c=.69,f=-.55,m=.08,u=-.48,h=.01,b=[-l,r,f],p=[l,r,f],y=[-l,r,m],d=[l,r,m],x=[-c,s,u],w=[c,s,u],A=[-c,s,h],E=[c,s,h];o([p,w,E,d],[1,0,0],V.body),o([y,A,x,b],[-1,0,0],V.body),o([A,E,w,x],[0,1,0],V.body),o([b,p,d,y],[0,-1,0],V.body),o([d,E,A,y],[0,0,1],V.body),o([b,x,w,p],[0,0,-1],V.body);let R=10,I=8,B=[0,De,Ne],k=[.42,.115,Xe],D=e.length;for(let O=0;O<=I;O++){let P=Math.PI*O/I,F=Math.cos(P),S=Math.sin(P);for(let T=0;T<=R;T++){let C=Math.PI*2*T/R,v=S*Math.cos(C),G=S*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<R;P++){let F=D+O*(R+1)+P,S=F+R+1;i.push(F,S,F+1,F+1,S,S+1)}let U=new Float32Array(t),M=new Float32Array(n),_=new Float32Array(e),N=new Uint16Array(i);return{position:U,normal:M,part:_,index:N,vertexCount:e.length,indexCount:i.length}}function En(t,n,e,i){let o=new Float32Array(n),a=c=>t[c*3],r=c=>t[c*3+2],s=0,l=(c,f)=>{let m=f-c;for(let u=c;u<f;u++){let[h,b]=i(u),p=h-a(u),y=b-r(u);if(m>=2){let d=Math.max(c,u-1),x=Math.min(f-1,u+1),w=a(x)-a(d),A=r(x)-r(d),E=Math.hypot(w,A);if(E>1e-6){let R=-A/E,I=w/E;R*p+I*y<0&&(R=-R,I=-I),p=R,y=I}}o[u]=p===0&&y===0?0:Math.atan2(p,y)}};for(let c=1;c<=n;c++)(c===n||e(c)!==e(s))&&(l(s,c),s=c);return o}var Vt=.22;function Mr(t,n){let e=Bt[t];if(e!=="sold"&&e!=="held")return-1;let i=(n+1)*2654435761;return i^=i>>>15,i=Math.imul(i,2246822519),i^=i>>>13,(i>>>0)%1e5/1e5}var He=.42;function Ve(t){let n=t.length,e=new Float64Array(n);if(n<2)return e.fill(1/0),e;let i=1/0,o=1/0,a=-1/0,r=-1/0;for(let b of t)b.x<i&&(i=b.x),b.y<o&&(o=b.y),b.x>a&&(a=b.x),b.y>r&&(r=b.y);let s=Math.max(a-i,1e-6),l=Math.max(r-o,1e-6),c=Math.max(Math.sqrt(s*l/n),1e-6),f=Math.max(1,Math.ceil(s/c)+1),m=Math.max(1,Math.ceil(l/c)+1),u=new Map,h=(b,p)=>{let y=Math.min(f-1,Math.max(0,Math.floor((b-i)/c)));return Math.min(m-1,Math.max(0,Math.floor((p-o)/c)))*f+y};for(let b=0;b<n;b++){let p=h(t[b].x,t[b].y),y=u.get(p);y?y.push(b):u.set(p,[b])}for(let b=0;b<n;b++){let p=t[b],y=Math.min(f-1,Math.max(0,Math.floor((p.x-i)/c))),d=Math.min(m-1,Math.max(0,Math.floor((p.y-o)/c))),x=1/0;for(let w=1;w<=4;w++){for(let A=d-w;A<=d+w;A++)if(!(A<0||A>=m))for(let E=y-w;E<=y+w;E++){if(E<0||E>=f||w>1&&Math.abs(A-d)<w&&Math.abs(E-y)<w)continue;let R=u.get(A*f+E);if(R)for(let I of R){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 We(t){let n=t.eyeHeightM;return Number.isFinite(n)?Math.max(0,n-Gt):0}function Cn(t,n,e,i,o,a){let r=t.length,s=new Float32Array(r*3),l=new Float32Array(r),c=new Float32Array(r*3),f=new Float32Array(r),m=new Float32Array(r),u=new Float32Array(r),h=new Float32Array(r),b=new Float32Array(r*3),p=new Map,y=Ve(t);for(let d=0;d<r;d++){let x=t[d],A=(e?.seatPitchU(d)??y[d])*g;f[d]=Number.isFinite(A)?Math.max(.06,Math.min(Vt,A*He)):Vt,m[d]=Bn(Number.isFinite(A)?A:void 0);let E=Sn(x.glyph,{seatGlyph:a?.get(x.categoryKey)});u[d]=Mn.indexOf(E),h[d]=x.wheelchairSpaceType==="no-seat"?0:1,s[d*3]=x.x*g,s[d*3+1]=e?e.seatDeckY(d):We(x),s[d*3+2]=x.y*g,l[d]=Qt(n?n(x):"available");let R=H(o?.get(x.categoryKey)??"#6e7bff")??[.43,.48,1];if(c[d*3]=R[0],c[d*3+1]=R[1],c[d*3+2]=R[2],x.accessibility?.length){let I=H(hn(x.accessibility));I&&(b[d*3]=I[0],b[d*3+1]=I[1],b[d*3+2]=I[2])}p.set(x.id,d)}return{count:r,iPosition:s,iState:l,iCategory:c,iMaxRadius:f,iRing:b,idToIndex:p,iChairWidth:m,iGlyph:u,iPhysicalSeat:h,iFloor:i??new Float32Array(r),iYaw:new Float32Array(r)}}var ze=64;function Sr(t,n){let e=[];for(let r of n){let s=t.idToIndex.get(r.seatId);if(s===void 0)continue;let l=Qt(r.state);t.iState[s]!==l&&(t.iState[s]=l,e.push(s))}if(!e.length)return[];e.sort((r,s)=>r-s);let i=[],o=e[0],a=e[0];for(let r=1;r<e.length;r++){let s=e[r];if(s!==a){if(s<=a+ze){a=s;continue}i.push({start:o,length:a-o+1}),o=s,a=s}}return i.push({start:o,length:a-o+1}),i}function Pr(t,n,e){return e<0?n>1?t.filter(i=>i.kind==="floor"):[...t]:t.filter(i=>i.floorIndex===void 0||i.floorIndex===e)}function Ir(t,n){let e=[...t].sort((o,a)=>o.screen.y-a.screen.y),i=[];for(let o of e){let a=i.find(r=>r.some(s=>Math.abs(s.screen.x-o.screen.x)<104&&Math.abs(s.screen.y-o.screen.y)<34));a?a.push(o):i.push([o])}return i.flatMap(o=>o.length<2?o:o.map((a,r)=>({...a,screen:{...a.screen,x:Math.max(54,Math.min(n-54,a.screen.x+(r-(o.length-1)/2)*104))}})))}var Ze=1.15,Ke=2.75,$e=4.5,qe=.85,Je=.5,Qe=.26;function wr(t,n,e){let i=Math.max(1e-6,n),o=t/i,a=e?.hasZoneLabels??!0,r=new Set;return o>=.75&&r.add("floor"),o>=Ze&&r.add("zone"),o<=(a?Ke:$e)&&(r.add("section"),r.add("ga")),o<=qe&&(r.add("annotation"),r.add("booth")),o<=Je&&r.add("row"),o<=Qe&&r.add("seat"),r}function _r(t,n,e,i,o,a=6){let r=a+n,s=i-a-n,l=a+e,c=o-a-e;return{...t,x:r>s?i/2:Math.max(r,Math.min(s,t.x)),y:l>c?o/2:Math.max(l,Math.min(c,t.y))}}function Tr(t,n,e,i){let o=t,a=n[0],r=n[1],s=n[2],l=o[0]*a+o[4]*r+o[8]*s+o[12],c=o[1]*a+o[5]*r+o[9]*s+o[13],f=o[2]*a+o[6]*r+o[10]*s+o[14],m=o[3]*a+o[7]*r+o[11]*s+o[15];if(!(m>1e-6))return{x:0,y:0,depth:1/0,visible:!1};let u=l/m,h=c/m,b=f/m,p=u>=-1.05&&u<=1.05&&h>=-1.05&&h<=1.05&&b<=1;return{x:(u*.5+.5)*e,y:(1-(h*.5+.5))*i,depth:b,visible:p}}function Br(t,n,e=n){let i=[],o=[...t].sort((a,r)=>a.screen.depth-r.screen.depth);for(let a of o){let r=!1;for(let s of i)if(on(a,s,n,e)){r=!0;break}r||i.push(a)}return i}var to=6;function on(t,n,e,i){let o=Math.abs(t.screen.x-n.screen.x),a=Math.abs(t.screen.y-n.screen.y),r=t.halfWidth!=null&&n.halfWidth!=null?Math.max(e,t.halfWidth+n.halfWidth+to):e;return o<r&&a<i}function Er(t,n,e){return t.length*n*.58+(e?14:0)}var no={row:8,seat:14};function Cr(t){return t<480?{row:5,seat:8}:t<768?{row:6,seat:10}:no}function Fr(t,n,e,i){let o=Math.max(1,Math.min(e,i)*.5),a=Math.min(2,Math.hypot(t.x-e/2,t.y-i/2)/o);return n*(1+1.5*a)}function vr(t,n,e,i,o=[]){let a=[...t].sort((s,l)=>(l.priority??0)-(s.priority??0)||s.focus-l.focus),r=[];for(let s of a){if(r.length>=i)break;let l=!1;for(let c of o)if(on(s,c,n,e)){l=!0;break}if(!l){for(let c of r)if(on(s,c,n,e)){l=!0;break}}l||r.push(s)}return r}var eo=.15,oo=.9,ro=1.76;function io(){return{background:{top:[...nn.top],bottom:[...nn.bottom]},structure:tn,seatStates:{...Tn},seatScale:1,materials:{seat:null,shell:null,roughness:.78}}}function Fn(t){let n=io();if(!t)return n;let e=H(t.background);if(e){n.background={top:et(e,oo),bottom:et(e,ro)};let r={};for(let[s,l]of Object.entries(tn))r[s]=nt(l,e,eo);n.structure=r}let i=H(t.selectionColor)??H(t.accent);i&&(n.seatStates={...n.seatStates,selected:i});let o=t.seatScale;typeof o=="number"&&Number.isFinite(o)&&(n.seatScale=Rn(o));let a=t.venue3d;if(a){let r=H(a.deck),s=H(a.fascia);r&&(n.structure={...n.structure,tierTop:r,gaTop:r}),s&&(n.structure={...n.structure,tierWall:s,gaWall:s}),n.materials.seat=H(a.seat),n.materials.shell=H(a.shell),typeof a.roughness=="number"&&Number.isFinite(a.roughness)&&(n.materials.roughness=Math.min(1,Math.max(0,a.roughness)))}return n}function vn(t,n){let e=[];for(let i of n)e.push(...t.seatStates[i]);return e}import Gn from"polygon-clipping";import so from"earcut";var ao=.58,kn=.01,ot=Vt*1.5*lt,co=.5,uo=.6;function lo(t,n){let e=t.length,i=[];for(let r=0;r<e;r++){let s=t[Math.max(0,r-1)],l=t[Math.min(e-1,r+1)],c=l.x-s.x,f=l.y-s.y,m=Math.hypot(c,f);if(m<1e-9){i.push([0,0]);continue}c/=m,f/=m,i.push([-f,c])}let o=0;for(let r=0;r<e;r++)o+=(t[r].x-n.x)*i[r][0]+(t[r].y-n.y)*i[r][1];return o<0?i.map(([r,s])=>[-r,-s]):i}function mo(t,n){if(t.length<2||n<=0)return[...t];let e=[...t],i=(r,s)=>{let l=s.x-r.x,c=s.y-r.y,f=Math.hypot(l,c)||1;return{x:l/f,y:c/f}},o=i(e[1],e[0]),a=i(e[e.length-2],e[e.length-1]);return e.unshift({x:e[0].x+o.x*n,y:e[0].y+o.y*n}),e.push({x:e[e.length-1].x+a.x*n,y:e[e.length-1].y+a.y*n}),e}var On=Math.PI/12;function fo(t){if(t.length<3)return[...t];let n=[...t].sort((a,r)=>a.x-r.x||a.y-r.y),e=(a,r,s)=>(r.x-a.x)*(s.y-a.y)-(r.y-a.y)*(s.x-a.x),i=a=>{let r=[];for(let s of a){for(;r.length>=2&&e(r[r.length-2],r[r.length-1],s)<=0;)r.pop();r.push(s)}return r.pop(),r},o=[...i(n),...i([...n].reverse())];return o.length>=3?o:[...t]}function Dn(t,n){if(!t.length||!(n>0))return[];let e=fo(t),i=(s,l,c,f)=>{let m=c-l;for(;m<0;)m+=Math.PI*2;for(;m>Math.PI*2;)m-=Math.PI*2;let u=Math.max(1,Math.ceil(m/On)),h=n/Math.cos(m/u/2);for(let b=0;b<=u;b++){let p=l+m*b/u;f.push({x:s.x+Math.cos(p)*h,y:s.y+Math.sin(p)*h})}};if(e.length<3){let s=0,l=0;for(let h of e)s+=h.x,l+=h.y;s/=e.length||1,l/=e.length||1;let c=0;for(let h of e)c=Math.max(c,Math.hypot(h.x-s,h.y-l));let f=[],m=Math.max(3,Math.ceil(Math.PI*2/On)),u=(c+n)/Math.cos(Math.PI/m);for(let h=0;h<m;h++){let b=h/m*Math.PI*2;f.push({x:s+Math.cos(b)*u,y:l+Math.sin(b)*u})}return f}let o=e.length,a=[];for(let s=0;s<o;s++){let l=e[s],c=e[(s+1)%o];a.push(Math.atan2(-(c.x-l.x),c.y-l.y))}let r=[];for(let s=0;s<o;s++)i(e[s],a[(s+o-1)%o],a[s],r);return jn(r)}function ho(t,n,e){if(t.length===1)return Math.hypot(n-t[0].x,e-t[0].y);let i=1/0;for(let o=0;o+1<t.length;o++){let a=t[o],r=t[o+1],s=r.x-a.x,l=r.y-a.y,c=s*s+l*l,f=c>1e-12?((n-a.x)*s+(e-a.y)*l)/c:0;f<0?f=0:f>1&&(f=1);let m=Math.hypot(n-(a.x+f*s),e-(a.y+f*l));m<i&&(i=m)}return i}function Wt(t){let n=t.map(o=>{let a=0,r=0;for(let c of o.pts)a+=c.x,r+=c.y;let s=o.pts.length||1;a/=s,r/=s;let l=0;for(let c of o.pts){let f=Math.hypot(c.x-a,c.y-r);f>l&&(l=f)}return{cx:a,cy:r,rad:l}}),e=o=>{let a=o.length;return a<=2?[...o]:[o[Math.floor(a*.25)],o[Math.floor(a*.5)],o[Math.floor(a*.75)]]},i=[];for(let o=0;o<t.length;o++){let a=e(t[o].pts),r=[],s=1/0,l=null;for(let f of a){let m=1/0;for(let u=0;u<t.length;u++){if(u===o||Math.abs(t[u].y-t[o].y)<.001)continue;let h=n[u],b=Math.hypot(f.x-h.cx,f.y-h.cy)-h.rad;if(b>=m&&b>=s)continue;let p=ho(t[u].pts,f.x,f.y);p<m&&(m=p),t[u].depth<t[o].depth&&p<s&&(s=p,l=t[u].y)}Number.isFinite(m)&&m>0&&r.push(m)}r.sort((f,m)=>f-m);let c=r.length?r[Math.floor(r.length/2)]:1;i.push({pitch:c,belowY:l})}return i}function Nn(t,n,e,i){let o=t[n],a=o.pts.length>=2?[...o.pts]:o.pts.length===1?(()=>{let f=o.pts[0],m=f.x-i.x,u=f.y-i.y,h=Math.hypot(m,u)||1;m/=h,u/=h;let b=Math.max(e[n].pitch,.001)*.5;return[{x:f.x+u*b,y:f.y-m*b},{x:f.x-u*b,y:f.y+m*b}]})():[];if(a.length<2)return null;let r=0,s=0;for(let f=1;f<a.length;f++){let m=Math.hypot(a[f].x-a[f-1].x,a[f].y-a[f-1].y);m>1e-6&&(r+=m,s++)}let l=s>0?r/s:0,c=mo(a,Math.max(l*uo,ot));return{pts:c,nrm:lo(c,i),front:Math.max(e[n].pitch*ao,ot),back:Math.max(e[n].pitch*co,ot)}}var gt=1.5,Xn=.3;function rn(t,n){if(t.length<3)return t;let e=t[0],i=t[t.length-1],o=i.x-e.x,a=i.y-e.y,r=Math.hypot(o,a),s=-1,l=-1;for(let m=1;m<t.length-1;m++){let u=t[m],h=r>1e-12?Math.abs((u.x-e.x)*a-(u.y-e.y)*o)/r:Math.hypot(u.x-e.x,u.y-e.y);h>s&&(s=h,l=m)}if(s<=n||l<0)return[e,i];let c=rn(t.slice(0,l+1),n),f=rn(t.slice(l),n);return[...c.slice(0,-1),...f]}function Un(t,n){if(t.length<4)return t;let e=rn([...t,t[0]],n);return e.pop(),e.length>=3?e:t}function Yn(t,n,e){if(t.length<2)return[];let i=e??Wt(t),o=new Map;for(let r=0;r<t.length;r++){let s=o.get(t[r].blockId);s?s.push(r):o.set(t[r].blockId,[r])}let a=[];for(let[,r]of o){let s=[];for(let x of r){let 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=>Nn(t,x,i,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=jn(b),y=1/0;for(let x of s)t[x].y<y&&(y=t[x].y);if(!Number.isFinite(y))continue;if(p.length>=3&&Math.abs(ft(p))>1e-6&&c.every(x=>{let w=x.pts[Math.floor(x.pts.length/2)];return It(p,w.x,w.y)})){a.push({outline:Un(p,Xn),holes:[],topY:y});continue}for(let x of bo(c))a.push({outline:x,holes:[],topY:y})}return a}function bo(t){let n=[];for(let e of t){let i=[],o=[],a=e.front+gt,r=e.back+gt;for(let l=0;l<e.pts.length;l++){let c=e.pts[l],f=e.nrm[l];i.push([c.x-f[0]*a,c.y-f[1]*a]),o.push([c.x+f[0]*r,c.y+f[1]*r])}let s=[...i,...o.reverse()];s.length<3||(s.push(s[0]),n.push([s]))}if(!n.length)return[];try{let e=Gn.union(n[0],...n.slice(1)),i=[];for(let o of e){if(!o.length||o[0].length<4)continue;let a=o[0].map(([l,c])=>({x:l,y:c})),r=a[0],s=a[a.length-1];a.length>1&&Math.abs(r.x-s.x)<1e-9&&Math.abs(r.y-s.y)<1e-9&&a.pop(),a.length>=3&&i.push(Un(a,Xn))}return i}catch{return[]}}function jn(t){let n=[];for(let e of t){let i=n[n.length-1];i&&Math.hypot(e.x-i.x,e.y-i.y)<1e-9||n.push(e)}for(;n.length>2&&Math.hypot(n[0].x-n[n.length-1].x,n[0].y-n[n.length-1].y)<1e-9;)n.pop();return n}var sn=class{constructor(n){this.minX=1/0;this.minY=1/0;this.maxX=-1/0;this.maxY=-1/0;this.rings=n;for(let e of n)for(let i of e)i.x<this.minX&&(this.minX=i.x),i.y<this.minY&&(this.minY=i.y),i.x>this.maxX&&(this.maxX=i.x),i.y>this.maxY&&(this.maxY=i.y)}containsAll(n){for(let e of n)if(e.x<this.minX||e.x>this.maxX||e.y<this.minY||e.y>this.maxY)return!1;for(let e of this.rings){let i=!0;for(let o of n)if(!It(e,o.x,o.y)){i=!1;break}if(i)return!0}return!1}};function Ln(t,n,e,i,o,a){if(i.length<3)return;if(e.containsAll(i)){let c=[0,1,0],f=i[0];for(let m=1;m+1<i.length;m++){let u=i[m],h=i[m+1];t.tri([f.x*g,o,f.y*g],[u.x*g,o,u.y*g],[h.x*g,o,h.y*g],c,a)}return}let r=i.map(c=>[c.x,c.y]);r.push(r[0]);let s;try{s=Gn.intersection([r],n)}catch{return}let l=[0,1,0];for(let c of s){if(!c.length||c[0].length<4)continue;let f=c[0],m=[],u=[];for(let b=0;b<f.length-1;b++)m.push(f[b][0],f[b][1]),u.push([f[b][0],f[b][1]]);if(u.length<3)continue;let h=so(m,void 0,2);for(let b=0;b<h.length;b+=3){let p=u[h[b]],y=u[h[b+1]],d=u[h[b+2]];t.tri([p[0]*g,o,p[1]*g],[y[0]*g,o,y[1]*g],[d[0]*g,o,d[1]*g],l,a)}}}function Hn(t,n,e,i,o,a,r){if(n.length<2)return;let s=r??Wt(n),l=[0,1,0],c=a&&a.length>=3?[[...a.map(h=>[h.x,h.y]),[a[0].x,a[0].y]]]:null,f=a&&a.length>=3?new sn([[...a]]):null,m=h=>{t.setMaterial(2),h(),t.setMaterial(0)},u=h=>{t.setMaterial(3),h(),t.setMaterial(0)};for(let h=0;h<n.length;h++){let b=n[h];if(b.patch&&b.patch.length>=3){let E=[...b.patch],R=s[h].belowY??i;if(u(()=>{if(c&&f)Ln(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>R+kn){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],M=U.x-D.x,_=U.y-D.y,N=Math.hypot(M,_);if(N<1e-6)continue;let O=_/N,P=-M/N;(D.x-I)*O+(D.y-B)*P<0&&(O=-O,P=-P);let F=[O,0,P],S=[D.x*g,b.y,D.y*g],T=[U.x*g,b.y,U.y*g],C=[D.x*g,R,D.y*g],v=[U.x*g,R,U.y*g];t.tri(S,T,v,F,o.riser),t.tri(S,v,C,F,o.riser)}})}continue}let p=Nn(n,h,s,e);if(!p)continue;let{pts:y,nrm:d,front:x,back:w}=p,A=s[h].belowY??i;for(let E=0;E+1<y.length;E++){let R=y[E],I=y[E+1],B=d[E],k=d[E+1];if(Math.hypot(I.x-R.x,I.y-R.y)<1e-6||B[0]===0&&B[1]===0||k[0]===0&&k[1]===0)continue;let D=[(R.x-B[0]*x)*g,b.y,(R.y-B[1]*x)*g],U=[(I.x-k[0]*x)*g,b.y,(I.y-k[1]*x)*g],M=[(R.x+B[0]*w)*g,b.y,(R.y+B[1]*w)*g],_=[(I.x+k[0]*w)*g,b.y,(I.y+k[1]*w)*g];if(u(()=>{c&&f?Ln(t,c,f,[{x:R.x-B[0]*x,y:R.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:R.x+B[0]*w,y:R.y+B[1]*w}],b.y,o.tread):(t.tri(D,U,_,l,o.tread),t.tri(D,_,M,l,o.tread))}),b.y>A+kn){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)})}}}}import Wn from"polygon-clipping";function po(t,n){let e=t.eventConfigurationIds;return!e?.length||!!n&&e.includes(n)}function Vn(t,n){return t.filter(e=>e.type!=="shape"||po(e,n))}function zn(t,n){let e=t.focalPoint??{x:0,y:0};return t.floors?.length?t.floors.map((i,o)=>({objects:Vn(i.objects,n),focal:{x:(i.focalPoint??e).x,y:(i.focalPoint??e).y},baseHeightM:i.baseHeightM??0,index:o})):[{objects:Vn(t.objects,n),focal:e,baseHeightM:0,index:0}]}var yo={minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};function Mt(t){return gn(t)??yo}function Zn(t,n){let e=jt(t.outline,ot),i=Mt(e),o=n.filter(r=>r!==t&&r.outline&&r.outline.length>=3&&Nt(i,Mt(r.outline)));if(!o.length)return[e];let a=r=>{let s=r.map(l=>[l.x,l.y]);return s.push(s[0]),s};try{let r=Wn.difference([a(e)],...o.map(l=>[a(l.outline)])),s=[];for(let l of r){if(!l.length)continue;let c=l[0].map(([f,m])=>({x:f,y:m}));if(c.length>1){let f=c[0],m=c[c.length-1];Math.abs(f.x-m.x)<1e-9&&Math.abs(f.y-m.y)<1e-9&&c.pop()}c.length>=3&&s.push(c)}return s.length?s:[e]}catch{return[e]}}function Kn(t,n){if(!n.length)return t;let e=a=>{let r=a.map(s=>[s.x,s.y]);return r.push(r[0]),r},i=n.map(a=>[e(a)]),o=[];for(let a of t){let r;try{r=Wn.intersection([e(a.outline)],i.flat())}catch{o.push(a);continue}for(let s of r){if(!s.length)continue;let l=s[0].map(([c,f])=>({x:c,y:f}));if(l.length>1){let c=l[0],f=l[l.length-1];Math.abs(c.x-f.x)<1e-9&&Math.abs(c.y-f.y)<1e-9&&l.pop()}l.length>=3&&o.push({outline:l,holes:[],topY:a.topY})}}return o.length?o:t}var xo=.05,$n=.05,go=.15,an=25;function qn(t,n,e){let i=new Map,o=new Array(n.length).fill(null),a=new Float64Array(n.length),r=new Array(n.length).fill(void 0),s=new Array(n.length).fill(void 0),l=new Map,c=[],f=new Set;for(let u=0;u<t.length;u+=1){let h=t[u];for(let b of h.objects){if(b.type==="table"&&f.add(b.id),b.type!=="section"||!b.outline||b.outline.length<3)continue;let p=jt(b.outline,ot);l.set(b.id,{section:b,unit:h,frontU:1/0,hasSeats:!1,rows:new Map,seatIndices:[]}),c.push({id:b.id,floorIndex:u,box:Mt(p),section:b,unit:h,outline:p})}}let m=new Map;for(let u of c){let h=m.get(u.floorIndex);h?h.push(u):m.set(u.floorIndex,[u])}for(let u=0;u<n.length;u++){let h=n[u],b=e?m.get(e[u])??[]:c,p=h.sectionId?b.find(d=>d.id===h.sectionId)??b.find(d=>d.section.logicalSectionId===h.sectionId&&qt({x:h.x,y:h.y},d.outline,d.section.holes)):void 0,y=p?[p]:b;for(let d of y){if(e&&d.floorIndex!==e[u]||!p&&(h.x<d.box.minX||h.x>d.box.maxX||h.y<d.box.minY||h.y>d.box.maxY||!qt({x:h.x,y:h.y},d.outline,d.section.holes)))continue;o[u]=d.id;let x=l.get(d.id);x.hasSeats=!0;let w=h.focalPoint??d.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}`,R=x.rows.get(E);R?R.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,y=b.rake>0?Math.tan(b.rake*Math.PI/180):0,d=b.rake<=.01&&b.height<=p+.001,x=h.section.surfaceKind,w=x==="flat"?!0:x==="rakedRows"&&b.rake>.01?!1:d,A=h.hasSeats?yn(u,n,h.seatIndices,h.unit.focal):{sectionId:u,rows:[],blockCount:0},R=A.rows.length<2?An([...h.rows.values()].map(S=>({points:S})),h.unit.focal):null,I=1/0;if(R){if(h.hasSeats)for(let S of h.rows.values())for(let T of S){let C=R.depthAt(T.x,T.y);C<I&&(I=C)}if(!h.hasSeats||!Number.isFinite(I)){I=1/0;for(let S of h.section.outline){let T=R.depthAt(S.x,S.y);T<I&&(I=T)}}}let B=p+xo,k=Math.max(B,b.height),D=S=>{let T=Math.max(0,S-I)*ut,C=Math.min(T*y,an);return Math.max(B,b.height+C)},U=S=>{let T=Math.max(0,S)*ut,C=Math.min(T*y,an);return Math.max(B,b.height+C)},M=w?[]:A.rows.map(S=>({pts:S.pts,y:U(S.blockDepth),depth:S.blockDepth,blockId:S.blockId,...f.has(S.id)?{patch:Dn(S.pts,ot)}:{}})),_=M.length?M[0].y:k,N=M.map(S=>{let T=S.patch&&S.patch.length>=3?S.patch:S.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:M.length>=2?(S,T)=>{let C=1/0,v=_;for(let G=0;G<M.length;G++){let X=N[G];if(Math.hypot(S-X.cx,T-X.cy)-X.rad>=C)continue;let L=M[G].patch,Y=L&&L.length>=3?It(L,S,T)?0:Dt(L,S,T):Dt(M[G].pts,S,T);Y<C&&(C=Y,v=M[G].y)}return v}:(S,T)=>R?D(R.depthAt(S,T)):k,P=[0,1,0],F=M.length>=2||w?()=>P:(S,T)=>{if(!R)return P;let C=R.depthAt(S,T);if(C<=I)return P;let v=(C-I)*ut;if(v*y>=an||b.height+v*y<=B)return P;let[G,X]=R.gradientAt(S,T);if(G===0&&X===0)return P;let L=1/Math.hypot(y,1);return[-G*y*L,L,-X*y*L]};if(!w)for(let S of A.rows){let T=U(S.blockDepth);for(let C of S.seatIndices)r[C]=T}for(let S of A.rows){let T=[];for(let L=1;L<S.pts.length;L++){let Y=Math.hypot(S.pts[L].x-S.pts[L-1].x,S.pts[L].y-S.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=S.pts[Math.floor(S.pts.length/2)];if(G)for(let L of A.rows){if(L===S||L.blockId!==S.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 S.seatIndices)s[L]=X}i.set(u,{sectionId:u,deckAt:O,normalAt:F,flat:w,bottomY:p,rowLevels:M,landingY:_})}for(let u=0;u<n.length;u++){let h=o[u],b=n[u];if(h){let y=r[u];a[u]=(y??i.get(h).deckAt(b.x,b.y))+go;continue}let p=b.eyeHeightM;a[u]=Number.isFinite(p)?Math.max(0,p-Gt):0}return{bySection:i,seatOwner:o,seatDeckY:u=>a[u],seatPitchU:u=>s[u]}}var W={top:1,wallBottom:.5,bottomCap:.4};function st(t,n){if(!t)return n;let e=et(Pt(t,.4),.62);return nt(n,e,.72)}function Jn(t,n){let e=new Map;for(let a of t.categories??[])e.set(a.key,a.color);let i=new Map;for(let a of n){if(!a.sectionId)continue;let r=i.get(a.sectionId);r||(r=new Map,i.set(a.sectionId,r)),r.set(a.categoryKey,(r.get(a.categoryKey)??0)+1)}let o=new Map;for(let[a,r]of i){let s=0,l=0,c=0,f=0;for(let[m,u]of r){let h=H(e.get(m));h&&(s+=h[0]*u,l+=h[1]*u,c+=h[2]*u,f+=u)}f>0&&o.set(a,[s/f,l/f,c/f])}return o}function Qn(t,n){return H(t.color)??n.get(t.logicalSectionId??t.id)??null}import Mo from"polygon-clipping";function So(t,n){return t===void 0||n===void 0?!0:Math.abs(t-n)<.001}var zt=class{constructor(){this.rings=[];this.boxes=[];this.levels=[]}subtract(n,e){let i=n.map(l=>[l.x,l.y]);if(i.length<3)return[];i.push(i[0]);let o=Mt(n),a=this.rings.filter((l,c)=>Nt(o,this.boxes[c])&&So(e,this.levels[c])),r=[[i]];if(a.length)try{r=Mo.difference([i],...a).map(c=>c.map(f=>f.map(([m,u])=>[m,u])))}catch{r=[[i]]}this.rings.push([i]),this.boxes.push(o),this.levels.push(e);let s=[];for(let l of r){if(!l.length)continue;let c=l[0].map(([f,m])=>({x:f,y:m}));if(c.length>1){let f=c[0],m=c[c.length-1];Math.abs(f.x-m.x)<1e-9&&Math.abs(f.y-m.y)<1e-9&&c.pop()}c.length>=3&&s.push(c)}return s}};function Ro(t,n){if(!n)return t;let e=1/0,i=-1/0,o=1/0,a=-1/0;for(let m of t)e=Math.min(e,m.x),i=Math.max(i,m.x),o=Math.min(o,m.y),a=Math.max(a,m.y);let r=(e+i)/2,s=(o+a)/2,l=n*Math.PI/180,c=Math.cos(l),f=Math.sin(l);return t.map(m=>{let u=m.x-r,h=m.y-s;return{x:r+u*c-h*f,y:s+u*f+h*c}})}function bt(t){let n=null;if(t.kind==="polygon"&&t.points&&t.points.length>=3&&(n=t.points),t.kind==="rect"&&t.width&&t.height&&(n=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,i=(t.y??0)+t.height/2;n=Ht(e,i,t.width/2,t.height/2)}return n?Ro(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}},i=n==="stage"&&xn(t.stageKind)?{kind:"stage",heightM:.06}:e[n]??{kind:"plate",heightM:.25};return{...i,heightM:t.heightM??i.heightM}}var Ao=.08;function te(t,n){let e=bt(t),i=Et(t),o=i.heightM;if(!e||i.kind!=="plate"&&i.kind!=="stage")return o;let a=1/0,r=1/0,s=-1/0,l=-1/0;for(let f of e)a=Math.min(a,f.x),r=Math.min(r,f.y),s=Math.max(s,f.x),l=Math.max(l,f.y);let c=o;for(let f of n)s>f.minX&&a<f.maxX&&l>f.minY&&r<f.maxY&&c<=f.topOffsetM+1e-6&&(c=f.topOffsetM+Ao);return n.push({minX:a,minY:r,maxX:s,maxY:l,topOffsetM:c}),c}function mt(t,n,e){return{x:t.x+(n.x-t.x)*e,y:t.y+(n.y-t.y)*e}}function ne(t){if(t.length!==4)return t;let n=Math.hypot(t[1].x-t[0].x,t[1].y-t[0].y),e=Math.hypot(t[2].x-t[1].x,t[2].y-t[1].y);return n>=e?t:[t[1],t[2],t[3],t[0]]}function 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 ee(t,n,e){return[mt(t[0],t[3],n),mt(t[1],t[2],n),mt(t[1],t[2],e),mt(t[0],t[3],e)]}function at(t,n,e,i,o,a){K(t,n,void 0,()=>e,i,o,a,W)}var cn=2.4,Po=.75,Io=.15;function Ft(t){if(t.points&&t.points.length>=3)return t.points;let{center:n,width:e,height:i,rotation:o}=t;if(!e||!i)return null;let a=(o??0)*Math.PI/180,r=Math.cos(a),s=Math.sin(a),l=e/2,c=i/2;return[[-l,-c],[l,-c],[l,c],[-l,c]].map(([f,m])=>({x:n.x+f*r-m*s,y:n.y+f*s+m*r}))}function oe(t,n,e,i,o){let a=Ft(n);a&&K(t,a,void 0,()=>e+cn,e,st(i,o.boothTop),o.boothWall,W)}function un(t){if(t.shape==="round"){let f=t.radius;return f?Ht(t.center.x,t.center.y,f,f,24):null}let{width:n,height:e,rotation:i,center:o}=t;if(!n||!e)return null;let a=(i??0)*Math.PI/180,r=Math.cos(a),s=Math.sin(a),l=n/2,c=e/2;return[[-l,-c],[l,-c],[l,c],[-l,c]].map(([f,m])=>({x:o.x+f*r-m*s,y:o.y+f*s+m*r}))}function re(t,n,e,i,o){let a=un(n);a&&K(t,a,void 0,()=>e+Po,e,st(i,o.tableTop),o.tableWall,W)}function ie(t,n,e,i,o,a,r,s){let l=bt(n);if(!l)return;let c=s?s.kind==="stage":n.role==="stage",f=s?s.kind==="screen":n.role==="screen",m=s?{kind:c?"stage":"solid",heightM:s.topY-s.baseY}:Et(n),u=s?.baseY??e,h=s?.topY??e+i;if(c&&r){let x=1/0,w=-1/0,A=1/0,E=-1/0;for(let R of l)R.x<x&&(x=R.x),R.x>w&&(w=R.x),R.y<A&&(A=R.y),R.y>E&&(E=R.y);r.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),y=f?b:null,d=c?b?nt(o.stageWall,et(b,.58),.82):o.stageWall:f?y?nt(et(y,1.42),[.24,.46,.82],.08):[.24,.46,.82]:st(H(n.fill),o.decorWall);if(m.kind==="portal"&&l.length===4){let x=ne(l);at(t,Ct(x,0,.16),h,u,p,d),at(t,Ct(x,.84,1),h,u,p,d),at(t,x,h,Math.max(u,h-.35),p,d);return}if(m.kind==="suite"&&l.length===4){let x=l.map((E,R)=>{let I=l[(R+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,d),at(t,Ct(A,.92,1),h,u,p,d),at(t,ee(A,.88,1),h,u,p,d),at(t,A,h,Math.max(u,h-.18),p,d);return}at(t,l,h,u,p,d)}function ln(t){let{x:n,y:e,width:i,height:o}=t;if(!i||!o)return null;let a=n+i/2,r=e+o/2,s=(t.rotation??0)*Math.PI/180,l=Math.cos(s),c=Math.sin(s),f=i/2,m=o/2;return[[-f,-m],[f,-m],[f,m],[-f,m]].map(([u,h])=>({x:a+u*l-h*c,y:r+u*c+h*l}))}function wo(t){if(!t||!t.startsWith("data:image/svg+xml"))return null;let n=t.slice(t.indexOf(",")+1);if(/;base64/i.test(t.slice(0,t.indexOf(","))))try{n=atob(n)}catch{return null}else try{n=decodeURIComponent(n)}catch{}let e=n.match(/<(?:rect|path)\b[^>]*\bfill="([^"]+)"/i);if(!e)return null;let i=e[1].trim();if(i==="none"||i==="transparent")return null;let o=i.match(/^url\(#([^)]+)\)$/);if(!o)return H(i);let a=n.match(new RegExp(`<(?:linear|radial)Gradient\\b[^>]*\\bid="${o[1]}"[^>]*>([\\s\\S]*?)</(?:linear|radial)Gradient>`,"i"));if(!a)return null;let r=[];for(let s of a[1].matchAll(/stop-color="([^"]+)"/gi)){let l=H(s[1].trim());l&&r.push(l)}return r.length?r.reduce((s,l,c)=>nt(s,l,1/(c+1)),r[0]):null}function se(t,n,e,i){if(n.layer==="foreground")return;let o=ln(n);if(!o)return;let a=e+Io,r=st(wo(n.href),i.decorTop),s=Math.max(0,Math.min(1,n.opacity??1));s<1&&(r=nt(i.ground,r,s)),K(t,o,void 0,()=>a,e,r,nt(r,i.decorWall,.5),W)}function ae(t,n,e,i,o){if(!n.points||n.points.length<3)return;let a=st(i,o.gaTop);K(t,n.points,n.holes,()=>e+.15,e,a,o.gaWall,W)}var _o=.25,To=1.2,Bo=.6,Eo=.45,Co=2.3,Fo=Math.PI/180;function pt(t,n,e){let i=e*Fo;return{x:t.x+n*Math.sin(i),y:t.y+n*Math.cos(i)}}function vo(t,n){let e=n.rings[n.rings.length-1];if(!e)return!1;let i=e.outerRMedian*.85;for(let o of t){if(o.role!=="wall")continue;let a=o.points&&o.points.length>=2?o.points:o.x!==void 0&&o.y!==void 0&&o.width!==void 0&&o.height!==void 0?[{x:o.x,y:o.y},{x:o.x+o.width,y:o.y},{x:o.x+o.width,y:o.y+o.height},{x:o.x,y:o.y+o.height}]:[];if(a.length<2)continue;let r=0;for(let s of a)Math.hypot(s.x-n.centre.x,s.y-n.centre.y)>=i&&r++;if(r>=a.length/2)return!0}return!1}var ko=24;function Oo(t,n,e,i,o,a,r,s){let l=e.binCount,c=ko,f=ut,m=a+.02,u=[];for(let M=0;M<l;M++){let _=(e.startBin+M+.5)*n.binStepDeg,N=new Float64Array(c+1);for(let O=0;O<=c;O++){let P=i[M]+(o[M]-i[M])*O/c;N[O]=Math.max(m,In(n,e,_,P)-_o)}u.push(N)}let h=[r.bandTop[0]*s.top,r.bandTop[1]*s.top,r.bandTop[2]*s.top],b=[r.bandTop[0]*s.bottomCap,r.bandTop[1]*s.bottomCap,r.bandTop[2]*s.bottomCap],p=[r.bandWall[0]*s.top,r.bandWall[1]*s.top,r.bandWall[2]*s.top],y=[r.bandWall[0]*s.wallBottom,r.bandWall[1]*s.wallBottom,r.bandWall[2]*s.wallBottom],d=(M,_)=>{let N=(e.startBin+M+.5)*n.binStepDeg,O=i[M]+(o[M]-i[M])*_/c,P=pt(n.centre,O,N);return[P.x*f,u[M][_],P.y*f]};{let M=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 S=0;S<=c;S++){let T=u[F][S]-u[P][S];if(Math.abs(T)>1)continue;let C=i[P]+(o[P]-i[P])*S/c,v=i[F]+(o[F]-i[F])*S/c,G=pt(n.centre,C,(e.startBin+P+.5)*n.binStepDeg),X=pt(n.centre,v,(e.startBin+F+.5)*n.binStepDeg),L=M*Math.hypot(X.x-G.x,X.y-G.y)*f;T>L?(u[F][S]=u[P][S]+L,N=!0):-T>L&&(u[P][S]=u[F][S]+L,N=!0)}}if(!N)break}}let x=1,w=(M,_)=>{for(let N=0;N<=c;N+=4)if(Math.abs(u[M][N]-u[_][N])>x)return!0;return Math.abs(u[M][c]-u[_][c])>x},A=Math.tan(38*Math.PI/180),E=M=>(o[M]-i[M])/c*f,R=(M,_)=>u[M][_+1]-u[M][_]>A*Math.max(1e-6,E(M)),I=(M,_)=>{let N=e.closed?(M-1+l)%l:Math.max(0,M-1),O=e.closed?(M+1)%l:Math.min(l-1,M+1);Math.abs(u[N][_]-u[M][_])>x&&(N=M),Math.abs(u[O][_]-u[M][_])>x&&(O=M);let P=Math.max(0,_-1),F=Math.min(c,_+1);P<_&&R(M,P)&&(P=_),F>_&&R(M,_)&&(F=_);let S=d(N,_),T=d(O,_),C=d(M,P),v=d(M,F),G=T[0]-S[0],X=T[1]-S[1],L=T[2]-S[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=(M,_)=>{let N=[M[0],a,M[2]],O=[_[0],a,_[2]],P=_[0]-M[0],F=_[2]-M[2],S=Math.hypot(P,F);if(!(S>1e-12))return;let T=[F/S,0,-P/S];t.tri(M,_,O,T,p,p,y),t.tri(M,O,N,T,p,y,y)},k=.05*lt,D=M=>o[M]-i[M]<k,U=e.closed?l:l-1;for(let M=0;M<U;M++){let _=(M+1)%l;if(D(M)||D(_))continue;if(w(M,_)){let T=(e.startBin+M+1)*n.binStepDeg,C=(j,$)=>{let z=(i[M]+i[_])/2,q=(o[M]+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 $=d(M,j),z=d(M,j+1),q=C(M,j),tt=C(M,j+1),Z=I(M,j),it=I(M,j+1);t.triN($,q,tt,Z,Z,it,h),t.triN($,tt,z,Z,it,it,h);let vt=d(_,j),kt=d(_,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(M,j),rt=C(M,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=d(M,0),G=d(_,0),X=d(_,c),L=d(M,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(M,T),v=I(_,T),G=I(_,T+1),X=I(M,T+1);if(R(M,T)||R(_,T)){let z=(rt,Ot)=>{let Kt=(e.startBin+rt+.5)*n.binStepDeg,Lt=i[rt]+(o[rt]-i[rt])*(T+.5)/c,Rt=pt(n.centre,Lt,Kt);return[Rt.x*f,Ot,Rt.y*f]},q=d(M,T),tt=d(_,T),Z=z(M,u[M][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=d(_,T+1),kt=d(M,T+1),dt=z(M,u[M][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=d(M,T),Y=d(_,T),j=d(_,T+1),$=d(M,T+1);t.triN(L,Y,j,C,v,G,h),t.triN(L,j,$,C,G,X,h)}let N=d(M,0),O=d(_,0),P=d(_,c),F=d(M,c),S=T=>[T[0],a,T[2]];t.tri(S(N),S(P),S(O),[0,-1,0],b),t.tri(S(N),S(F),S(P),[0,-1,0],b),B(N,O),B(F,P)}if(!e.closed)for(let M of[0,l-1])for(let _=0;_<c;_++)B(d(M,_),d(M,_+1))}function ce(t,n,e){let{bottomY:i,colors:o,ao:a}=e,r=new Float64Array(n.binCount).fill(-1/0);for(let f of n.rings)for(let m of f.arcs){let u=new Float64Array(m.binCount),h=new Float64Array(m.binCount);for(let p=0;p<m.binCount;p++){let y=(m.startBin+p)%n.binCount,d=Math.max(0,m.innerR[p]-ot);u[p]=Math.max(d,r[y]+.001),h[p]=Math.max(u[p]+.001,m.outerR[p]+ot)}let b=0;for(let p=0;p<m.binCount;p++){let y=m.topLevelM[p]-i;y>b&&(b=y)}b>=To&&Oo(t,n,m,u,h,i,o,a);for(let p=0;p<m.binCount;p++){let y=(m.startBin+p)%n.binCount;h[p]>r[y]&&(r[y]=h[p])}}if(e.deriveShell===!1||vo(e.shapes,n))return;let s=n.rings[n.rings.length-1],l=Bo*lt,c=Eo*lt;for(let f of s.arcs){let m=[],u=[];for(let p=0;p<f.binCount;p++){let y=(f.startBin+p+.5)*n.binStepDeg,d=f.outerR[p]+ot+l;m.push(pt(n.centre,d,y)),u.push(pt(n.centre,d+c,y))}let h=-1/0;for(let p=0;p<f.binCount;p++)f.topLevelM[p]>h&&(h=f.topLevelM[p]);let b=()=>h+Co;f.closed?K(t,u,[m.slice().reverse()],b,i,o.shellTop,o.shellWall,a):K(t,[...u,...m.slice().reverse()],void 0,b,i,o.shellTop,o.shellWall,a)}}function ue(t,n,e,i,o,a,r,s){if(!n.outline||n.outline.length<3)return;let l=e.baseHeightM,c=st(i,s.tierTop);if(!o)return;let f=y=>o.deckAt(y.x,y.y),m=Zn(n,r),u=m[0]??n.outline;if(o.rowLevels.length>=2){let y=Wt(o.rowLevels),d=Kn(Yn(o.rowLevels,e.focal,y),m),x=()=>[0,1,0];for(let A of d){let E=Math.max(l,A.topY-.02);for(let R of a.subtract(A.outline,E))K(t,R,A.holes,()=>E,l,c,s.tierWall,W,void 0,x)}d.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])Hn(t,o.rowLevels,e.focal,o.landingY,w,A,y);return}let h=o.flat?1/0:$n,b=y=>o.normalAt(y.x,y.y),p=o.flat?o.landingY:void 0;for(let y of a.subtract(u,p))K(t,y,n.holes,f,l,c,s.tierWall,W,h,b)}function Lo(t,n,e){let i=new Set;for(let r of t.objects)r.type==="section"&&i.add(r.id);let o=new Map;for(let r=0;r<n.length;r++){let s=e.seatOwner[r];if(!s||!i.has(s))continue;let l=e.bySection.get(s);if(l&&l.rowLevels.length>=2)continue;let c=n[r],f=o.get(s);f||(f=new Map,o.set(s,f));let m=c.rowId||`__seat-${r}`,u=f.get(m);u||(u={pts:[],levelM:0,n:0},f.set(m,u)),u.pts.push({x:c.x,y:c.y}),u.levelM+=e.seatDeckY(r),u.n++}let a=[];for(let r of t.objects){if(r.type!=="section")continue;let s=e.bySection.get(r.id);if(s&&s.rowLevels.length>=2){let c=s.rowLevels.filter(f=>!f.patch).map(f=>({pts:f.pts,levelM:f.y}));c.length>=2&&a.push({sectionId:r.id,rows:c});continue}let l=o.get(r.id);l&&a.push({sectionId:r.id,rows:[...l.values()].map(c=>({pts:c.pts,levelM:c.levelM/c.n}))})}return a}function le(t,n,e,i,o,a,r=!0){let s=Lo(n,e,i);if(!s.length)return;let l=Pn(s,n.focal);l&&(t.setMaterial(0),ce(t,l,{bottomY:n.baseHeightM,colors:{bandTop:et(o.tierTop,.8),bandWall:o.tierWall,shellTop:a??et(o.tierWall,1.15),shellWall:a??o.tierWall},ao:W,shapes:n.objects.filter(c=>c.type==="shape"),deriveShell:r}))}var Go=6,Do=2.2,me=.1,No=.3,Xo=1.8,Uo=.9,Yo=.55,jo=6e3;function fe(t){let{doc:n,units:e,seats:i,surfaces:o,focal:a}=t,r=n.zones??[],s=[];if(r.length){let l=new Map;for(let f of e)for(let m of f.objects)m.type==="section"&&m.zone&&l.set(m.id,m.zone);let c=new Map;for(let f=0;f<i.length;f++){let m=i[f],u=o.seatOwner[f],h=m.zoneId??(u?l.get(u):void 0);if(!h)continue;let b=c.get(h);b||(b={n:0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0,sumY:0},c.set(h,b)),b.n++,m.x<b.minX&&(b.minX=m.x),m.y<b.minY&&(b.minY=m.y),m.x>b.maxX&&(b.maxX=m.x),m.y>b.maxY&&(b.maxY=m.y),b.sumY+=o.seatDeckY(f)}for(let f of r){let m=c.get(f.id),u=[];for(let[h,b]of l)b===f.id&&u.push(h);if(!m||m.n===0){s.push({id:f.id,label:f.label,color:H(f.color),sectionIds:u,seatCount:0,center:[0,0,0],radius:0,focalWorld:[(f.focalPoint??a).x*g,1.5,(f.focalPoint??a).y*g]});continue}s.push({id:f.id,label:f.label,color:H(f.color),sectionIds:u,seatCount:m.n,center:[(m.minX+m.maxX)/2*g,m.sumY/m.n,(m.minY+m.maxY)/2*g],radius:.5*Math.hypot((m.maxX-m.minX)*g,(m.maxY-m.minY)*g)||1,focalWorld:[(f.focalPoint??a).x*g,1.5,(f.focalPoint??a).y*g]})}}return s}function he(t){let{doc:n,units:e,seats:i,surfaces:o,seatData:a,hintedSeatFloor:r,zones:s,focal:l}=t,c=[],f=[],m=[];for(let u of s)u.seatCount!==0&&c.push({id:`zone:${u.id}`,kind:"zone",text:u.label,anchor:[u.center[0],u.center[1]+Go,u.center[2]],color:n.zones?.find(h=>h.id===u.id)?.color});{let u=new Map,h=new Map;for(let b=0;b<i.length;b++){let p=o.seatOwner[b];if(!p)continue;let y=u.get(p);y||(y={n:0,x:0,y:0,deck:0},u.set(p,y)),y.n++,y.x+=i[b].x,y.y+=i[b].y,y.deck+=o.seatDeckY(b);let d=h.get(p);d||(d={minX:1/0,maxX:-1/0,minY:1/0,maxY:-1/0},h.set(p,d)),i[b].x<d.minX&&(d.minX=i[b].x),i[b].x>d.maxX&&(d.maxX=i[b].x),i[b].y<d.minY&&(d.minY=i[b].y),i[b].y>d.maxY&&(d.maxY=i[b].y)}for(let b of e)for(let p of b.objects){if(p.type!=="section")continue;let y=u.get(p.id);if(!y||y.n===0)continue;let d=h.get(p.id),x=[y.x/y.n*g,y.deck/y.n,y.y/y.n*g],w=p.displayLabel||p.label||p.id;f.push({id:p.id,floorIndex:b.index,label:w,seatCount:y.n,center:x,radius:Math.max(1,Math.hypot(d.maxX-d.minX,d.maxY-d.minY)*.5*g),focalWorld:[b.focal.x*g,b.baseHeightM+1.5,b.focal.y*g]});let 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]+Do,x[2]],floorIndex:b.index})}}{for(let b of e)for(let p of b.objects){if(p.type!=="gaArea")continue;let y=At(p.points);if(!y)continue;let d=p.displayLabel||p.label||p.id;c.push({id:`ga:${p.id}`,kind:"ga",text:p.capacity>0?`${d} \xB7 ${p.capacity.toLocaleString()}`:d,anchor:[y.x*g,b.baseHeightM+Xo,y.y*g],floorIndex:b.index})}let u=new Map;for(let b=0;b<i.length;b++){let p=i[b],y=Math.hypot(p.x-l.x,p.y-l.y),d=u.get(p.rowId);(!d||y>d.far)&&u.set(p.rowId,{seat:p,index:b,far:y})}for(let[b,p]of u){let y=p.seat.label?p.seat.label.lastIndexOf("-"):-1,d=y>0?p.seat.label.slice(0,y):b;d&&c.push({id:`row:${b}`,kind:"row",text:d,anchor:[p.seat.x*g,o.seatDeckY(p.index)+Uo,p.seat.y*g],floorIndex:r[p.index]})}let h=new Map;for(let b=0;b<i.length;b++){let p=i[b],y=p.label?p.label.lastIndexOf("-"):-1,d=h.get(p.rowId);d||(d={n:0,x:0,y:0,z:0,minX:1/0,maxX:-1/0,minZ:1/0,maxZ:-1/0,label:y>0?p.label.slice(0,y):p.rowId,sectionId:p.sectionId},h.set(p.rowId,d));let x=b*3,w=a.iPosition[x],A=a.iPosition[x+1],E=a.iPosition[x+2];d.n++,d.x+=w,d.y+=A,d.z+=E,d.minX=Math.min(d.minX,w),d.maxX=Math.max(d.maxX,w),d.minZ=Math.min(d.minZ,E),d.maxZ=Math.max(d.maxZ,E)}for(let[b,p]of h)m.push({id:b,label:p.label,sectionId:p.sectionId,seatCount:p.n,center:[p.x/p.n,p.y/p.n,p.z/p.n],radius:Math.max(.8,Math.hypot(p.maxX-p.minX,p.maxZ-p.minZ)*.5)});if(i.length<=jo)for(let b=0;b<i.length;b++){let p=i[b],y=p.displayLabel||p.label;y&&c.push({id:`seat:${p.id}`,kind:"seat",text:y,anchor:[p.x*g,o.seatDeckY(b)+Yo,p.y*g],floorIndex:r[b]})}}for(let u of e)for(let h of u.objects)if(h.type==="shape"&&h.role&&["entrance","exit","screen","suite","obstruction"].includes(h.role)){let b=bt(h),p=b?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+me,p.y*g],color:h.fill,floorIndex:u.index})}else if(h.type==="text"){if(!h.text)continue;c.push({id:`text:${h.id}`,kind:"annotation",text:h.text,anchor:[h.position.x*g,u.baseHeightM+me,h.position.y*g],color:h.color,rotation:h.rotation,floorIndex:u.index})}else if(h.type==="booth"){let b=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+cn+No,p.y*g],floorIndex:u.index})}return{labels:c,sections:f,rows:m}}function be(t,n){if(n.length>1)for(let e of n)t.push({id:`floor:${e.id}`,kind:"floor",text:e.label,anchor:[e.center[0],e.box.max[1]+1.2,e.center[2]],floorIndex:e.index})}function pe(t){let{doc:n,units:e,seats:i,surfaces:o,solids:a,hintedSeatFloor:r,seatFloor:s}=t,l=[];{let c=e.map(()=>({minX:1/0,minY:1/0,minZ:1/0,maxX:-1/0,maxY:-1/0,maxZ:-1/0}));for(let u=0;u<a.floor.length;u+=1){let h=Math.max(0,Math.min(e.length-1,Math.round(a.floor[u]))),b=u*3,p=c[h];p.minX=Math.min(p.minX,a.position[b]),p.minY=Math.min(p.minY,a.position[b+1]),p.minZ=Math.min(p.minZ,a.position[b+2]),p.maxX=Math.max(p.maxX,a.position[b]),p.maxY=Math.max(p.maxY,a.position[b+1]),p.maxZ=Math.max(p.maxZ,a.position[b+2])}let f=new Map;for(let u=0;u<e.length;u++)for(let h of e[u].objects)h.type==="section"&&f.set(h.id,u);let m=e.map(()=>({n:0,minX:1/0,minY:1/0,minDeck:1/0,maxX:-1/0,maxY:-1/0,maxDeck:-1/0,sumX:0,sumDeck:0,sumZ:0}));for(let u=0;u<i.length;u++){let h=o.seatOwner[u],b=(h!==null?f.get(h):void 0)??r[u];if(b===void 0)continue;let p=m[b],y=i[u];p.n++,y.x<p.minX&&(p.minX=y.x),y.y<p.minY&&(p.minY=y.y),y.x>p.maxX&&(p.maxX=y.x),y.y>p.maxY&&(p.maxY=y.y);let d=o.seatDeckY(u);p.sumX+=y.x*g,p.sumDeck+=d,p.sumZ+=y.y*g,p.minDeck=Math.min(p.minDeck,d),p.maxDeck=Math.max(p.maxDeck,d+1.6),s[u]=b}for(let u=0;u<e.length;u++){let h=m[u],b=n.floors?.[u],p=c[u],y=Math.min(h.n?h.minX*g:e[u].focal.x*g-1,Number.isFinite(p.minX)?p.minX:1/0),d=Math.max(h.n?h.maxX*g:e[u].focal.x*g+1,Number.isFinite(p.maxX)?p.maxX:-1/0),x=Math.min(h.n?h.minY*g:e[u].focal.y*g-1,Number.isFinite(p.minZ)?p.minZ:1/0),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),R=[h.n?h.sumX/h.n:(y+d)/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(d-y,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:R,radius:I,box:{min:[y,A,x],max:[d,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,i=1/0,o=-1/0,a=-1/0,r=(s,l)=>{s<e&&(e=s),l<i&&(i=l),s>o&&(o=s),l>a&&(a=l)};for(let s of n)r(s.x,s.y);for(let s of t)for(let l of s.objects)if(l.type==="section")for(let c of l.outline)r(c.x,c.y);else if(l.type==="shape"&&l.points)for(let c of l.points)r(c.x,c.y);else if(l.type==="gaArea")for(let c of l.points)r(c.x,c.y);else if(l.type==="booth"){let c=Ft(l);if(c)for(let f of c)r(f.x,f.y)}else if(l.type==="table"){let c=un(l);if(c)for(let f of c)r(f.x,f.y)}else if(l.type==="decorImage"){let c=ln(l);if(c)for(let f of c)r(f.x,f.y)}return Number.isFinite(e)||(e=-100,i=-100,o=100,a=100),{minX:e,minY:i,maxX:o,maxY:a}}function de(t,n,e,i,o,a){if(n.length===1){let r=Math.max(60,(o.maxX-o.minX+o.maxY-o.minY)*.06),s=Tt(o.minX-r,o.minY-r,o.maxX-o.minX+r*2,o.maxY-o.minY+r*2);K(t,s,void 0,()=>0,-.4,a.ground,a.ground,W)}else{let r=n.reduce((h,b)=>b.baseHeightM<h.baseHeightM?b:h);t.setFloor(r.index);let s=e.filter((h,b)=>i[b]===r.index),l=mn([r],s),c=Math.hypot(l.maxX-l.minX,l.maxY-l.minY),f=Math.max(28,Math.min(80,c*.04)),m=Tt(l.minX-f,l.minY-f,l.maxX-l.minX+f*2,l.maxY-l.minY+f*2),u=r.baseHeightM-.03;K(t,m,void 0,()=>u,u-.22,a.ground,a.ground,W)}}function ye(t,n,e){let{cx:i,cz:o,radius:a}=e,r=1/0,s=1/0,l=1/0,c=-1/0,f=-1/0,m=-1/0,u=(p,y,d)=>{r=Math.min(r,p),c=Math.max(c,p),s=Math.min(s,y),f=Math.max(f,y),l=Math.min(l,d),m=Math.max(m,d)};for(let p=0;p<t.position.length;p+=3)u(t.position[p],t.position[p+1],t.position[p+2]);for(let p=0;p<n.count;p++){let y=p*3,d=n.iPosition[y],x=n.iPosition[y+1],w=n.iPosition[y+2],A=Math.max(.35,n.iMaxRadius[p]??.35);u(d-A,x,w-A),u(d+A,x+1.6,w+A)}Number.isFinite(r)||(r=i-a,c=i+a,s=0,f=a*.16,l=o-a,m=o+a);let h=[(r+c)/2,(s+f)/2,(l+m)/2],b=Math.max(1,.5*Math.hypot(c-r,f-s,m-l));return{center:h,radius:b,minY:s,maxY:f}}function xe(t,n,e,i,o,a){let r=1/0,s=1/0,l=-1/0,c=-1/0;for(let A=0;A<t.count;A++){let E=A*3,R=t.iPosition[E],I=t.iPosition[E+2];R<r&&(r=R),R>l&&(l=R),I<s&&(s=I),I>c&&(c=I)}for(let A of n)r=Math.min(r,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,y=u,d=h;if(Number.isFinite(r)){let A=Math.max(2,.06*Math.hypot(l-r,c-s));b=Math.max(f,r-A),p=Math.min(m,l+A),y=Math.max(u,s-A),d=Math.min(h,c+A)}let x=Math.min(0,i),w=Math.max(o,a*.05);return{min:[b,x,y],max:[p,w,d]}}function ge(t,n,e){let i=()=>({byObjectId:new Map,elements:[]});if(!n||!t)return i();let o=bn(n);if(!o.ok||o.value.id!==t)return i();let a=new Map;for(let m of e)for(let u of m.objects)u.type==="shape"&&a.set(u.id,{shape:u,unit:m});let r=new Set,s=new Set,l=new Map((n.overlay.productionElements??[]).map(m=>{let u=m.runtimeContentImageUrl;return[m.id,typeof u=="string"&&/^(?:blob:|data:image\/|https:\/\/)/.test(u)?u:void 0]})),c=[];for(let m of o.value.overlay.productionElements??[]){let u=a.get(m.objectId),h=u?bt(u.shape):null,b=m.baseElevationM??0;if(!u||!h||h.length<3||!m.id||r.has(m.id)||s.has(m.objectId)||!Number.isFinite(m.heightM)||m.heightM<.05||m.heightM>50||!Number.isFinite(b)||b<-10||b>100)return i();r.add(m.id),s.add(m.objectId);let p=h.map(B=>B.x*g),y=h.map(B=>B.y*g),d=u.unit.baseHeightM+b,x=Math.min(...p),w=Math.max(...p),A=Math.min(...y),E=Math.max(...y),R,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;R=[[x,d,B],[w,d,B],[x,d+m.heightM,B],[w,d+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;R=[[B,d,A],[B,d,E],[B,d+m.heightM,A],[B,d+m.heightM,E]]}c.push({id:m.id,objectId:m.objectId,kind:m.kind,floorIndex:u.unit.index,baseY:d,topY:d+m.heightM,bounds:{min:[x,d,A],max:[w,d+m.heightM,E]},occlusion:m.occlusion,...I?{contentImageUrl:I}:{},...R?{contentPlane:R}:{}})}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 Ho(t){let n=[t];for(;n.length;){let e=n.pop();if(Array.isArray(e)){n.push(...e);continue}if(!Q(e))continue;let i=Q(e.extensions)?e.extensions:null;if(i&&Object.prototype.hasOwnProperty.call(i,"KHR_draco_mesh_compression"))return!0;n.push(...Object.values(e))}return!1}function Zt(t,n){return!Array.isArray(t)||t.length!==n||!t.every(e=>typeof e=="number"&&Number.isFinite(e))?null:t}function Vo(){return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}function Wo(t,n){let e=new Array(16).fill(0);for(let i=0;i<4;i++)for(let o=0;o<4;o++)for(let a=0;a<4;a++)e[i*4+o]+=t[a*4+o]*n[i*4+a];return e}function zo(t){let n=Zt(t.matrix,16);if(n)return n;if(t.matrix!==void 0)return null;let e=t.translation===void 0?[0,0,0]:Zt(t.translation,3),i=t.rotation===void 0?[0,0,0,1]:Zt(t.rotation,4),o=t.scale===void 0?[1,1,1]:Zt(t.scale,3);if(!e||!i||!o)return null;let[a,r,s,l]=i,c=Math.hypot(a,r,s,l);if(!(c>1e-8))return null;let f=a/c,m=r/c,u=s/c,h=l/c,b=f+f,p=m+m,y=u+u,d=f*b,x=f*p,w=f*y,A=m*p,E=m*y,R=u*y,I=h*b,B=h*p,k=h*y;return[(1-(A+R))*o[0],(x+k)*o[0],(w-B)*o[0],0,(x-k)*o[1],(1-(d+R))*o[1],(E+I)*o[1],0,(w+B)*o[2],(E-I)*o[2],(1-(d+A))*o[2],0,e[0],e[1],e[2],1]}function Zo(t,n,e,i){return[t[0]*n+t[4]*e+t[8]*i+t[12],t[1]*n+t[5]*e+t[9]*i+t[13],t[2]*n+t[6]*e+t[10]*i+t[14]]}function Ko(t){let n=t[0],e=t[4],i=t[8],o=t[1],a=t[5],r=t[9],s=t[2],l=t[6],c=t[10],f=a*c-r*l,m=r*s-o*c,u=o*l-a*s,h=n*f+e*m+i*u;if(Math.abs(h)<1e-12)return null;let b=1/h;return[f*b,m*b,u*b,(i*l-e*c)*b,(n*c-i*s)*b,(e*s-n*l)*b,(e*r-i*a)*b,(i*o-n*r)*b,(n*a-e*o)*b]}function Me(t,n,e,i){let o=t[0]*n+t[1]*e+t[2]*i,a=t[3]*n+t[4]*e+t[5]*i,r=t[6]*n+t[7]*e+t[8]*i,s=Math.hypot(o,a,r)||1;return o/=s,a/=s,r/=s,[o,a,r]}function $o(t){if(t.byteLength<20||t.byteLength>8388608)return null;let n=new DataView(t.buffer,t.byteOffset,t.byteLength);if(n.getUint32(0,!0)!==1179937895||n.getUint32(4,!0)!==2||n.getUint32(8,!0)!==t.byteLength)return null;let e=12,i=null,o=null;for(;e+8<=t.byteLength;){let a=n.getUint32(e,!0),r=n.getUint32(e+4,!0);if(e+=8,a%4!==0||e+a>t.byteLength)return null;let s=t.subarray(e,e+a);if(r===1313821514&&!i)try{let l=JSON.parse(new TextDecoder().decode(s).replace(/[\u0000 ]+$/g,""));if(!Q(l))return null;i=l}catch{return null}else if(r===5130562&&!o)o=s;else return null;e+=a}return e===t.byteLength&&i&&o?{json:i,bin:o}:null}function qo(t){return t===5120||t===5121?1:t===5122||t===5123?2:t===5125||t===5126?4:0}function Jo(t){return t==="SCALAR"?1:t==="VEC2"?2:t==="VEC3"?3:t==="VEC4"?4:0}function Qo(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 tr(t){let n=t instanceof Uint8Array?t:new Uint8Array(t),e=$o(n);if(!e)return{ok:!1,issue:"invalid_glb"};let{json:i,bin:o}=e;if(!Q(i.asset)||i.asset.version!=="2.0")return{ok:!1,issue:"unsupported_glb"};let a=J(i.extensionsUsed).filter(A=>typeof A=="string");if(a.includes("KHR_draco_mesh_compression")||Ho(i))return{ok:!1,issue:"draco_not_allowed"};if(a.length||J(i.extensionsRequired).length)return{ok:!1,issue:"unsupported_glb"};if(J(i.images).length||J(i.textures).length)return{ok:!1,issue:"external_resource"};let r=J(i.buffers);if(r.length!==1||!Q(r[0])||r[0].uri!==void 0||typeof r[0].byteLength!="number"||!Number.isInteger(r[0].byteLength)||r[0].byteLength<0||r[0].byteLength>o.byteLength)return{ok:!1,issue:"external_resource"};let s=J(i.accessors),l=J(i.bufferViews),c=J(i.meshes),f=J(i.nodes),m=J(i.scenes),u=typeof i.scene=="number"?i.scene:0;if(!Q(m[u]))return{ok:!1,issue:"unsupported_glb"};let h=new DataView(o.buffer,o.byteOffset,o.byteLength),b=(A,E,R)=>{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"||!R.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=Jo(I.type),D=qo(I.componentType),U=typeof B.byteStride=="number"?B.byteStride:k*D,M=typeof B.byteOffset=="number"?B.byteOffset:0,_=typeof I.byteOffset=="number"?I.byteOffset:0,N=M+_,O=_+(I.count-1)*U+k*D;if(!Number.isInteger(U)||!Number.isInteger(M)||!Number.isInteger(_)||U<k*D||M<0||_<0||M+B.byteLength>o.byteLength||O>B.byteLength)return null;let P=[];for(let F=0;F<I.count;F++){let S=[];for(let T=0;T<k;T++){let C=Qo(h,N+F*U+T*D,I.componentType);if(!Number.isFinite(C))return null;S.push(C)}P.push(S)}return P},p=[],y=[],d=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 R=f[A],I=zo(R);if(!I)return!1;let B=Wo(E,I),k=Ko(B);if(!k)return!1;if(R.mesh!==void 0){if(typeof R.mesh!="number")return!1;let D=c[R.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 M=b(U.attributes.POSITION,"VEC3",[5126]),_=U.attributes.NORMAL===void 0?null:b(U.attributes.NORMAL,"VEC3",[5126]);if(!M||U.attributes.NORMAL!==void 0&&!_)return!1;let N=M.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||(d+=N/3,d>1e5))return!1;let O=U.indices===void 0?M.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>=M.length))return!1;let S=F.map(C=>Zo(B,...M[C])),T=null;if(!_){let C=S[1][0]-S[0][0],v=S[1][1]-S[0][1],G=S[1][2]-S[0][2],X=S[2][0]-S[0][0],L=S[2][1]-S[0][1],Y=S[2][2]-S[0][2];T=Me([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(...S[C]),y.push(..._?Me(k,..._[F[C]]):T)}}}for(let D of J(R.children))if(!w(D,B))return!1;return x.delete(A),!0};for(let A of J(m[u].nodes))if(!w(A,Vo()))return{ok:!1,issue:d>1e5?"triangle_limit":"unsupported_glb"};return!d||p.length!==d*9||y.length!==p.length?{ok:!1,issue:"unsupported_glb"}:{ok:!0,triangleCount:d,position:new Float32Array(p),normal:new Float32Array(y)}}function Se(t){try{return tr(t)}catch{return{ok:!1,issue:"invalid_glb"}}}function gs(t){let{doc:n}=t,e=Fn(n.theme),i=e.structure,o=zn(n,t.eventConfigurationId??n.eventConfigurationId),a=ge(t.eventConfigurationId,t.eventConfiguration,o),r=t.seats,s=new Yt,l=null;if(t.registeredShellGlb){let P=Se(t.registeredShellGlb);if(P.ok){let F=P.position.length/3,S=new Float32Array(P.position.length),T=e.materials.shell??i.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);S[C*3]=T[0]*G,S[C*3+1]=T[1]*G,S[C*3+2]=T[2]*G}l={position:P.position,normal:P.normal,color:S,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=r.map(P=>c.get(P.sectionId??"")??c.get(P.rowId??"")??0),m=mn(o,r);de(s,o,r,f,m,i);let u=Jn(n,r),h=new Map,b=new Map;for(let P of n.categories??[])h.set(P.key,P.color),P.seatGlyph&&b.set(P.key,P.seatGlyph);let p=[],y=qn(o,r,f),d=new Float32Array(r.length),x=[];for(let P=0;P<o.length;P++){let F=o[P];s.setFloor(P);let S=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;ue(s,v,F,Qn(v,u),y.bySection.get(v.id),S,C,i);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),ie(s,v,F.baseHeightM,te(v,T),i,F.focal,p,G),s.setMaterial(0)}else v.type==="gaArea"?ae(s,v,F.baseHeightM,H(h.get(v.categoryKey)),i):v.type==="booth"?oe(s,v,F.baseHeightM,H(h.get(v.categoryKey)),i):v.type==="table"?re(s,v,F.baseHeightM,H(v.fill??n.theme?.decorFill??"#232c40"),i):v.type==="decorImage"&&se(s,v,F.baseHeightM,i);le(s,F,r,y,i,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=_n(l?[s.build(),l]:[s.build()]),E=Cn(r,t.initialState,y,d,h,b),R=fe({doc:n,units:o,seats:r,surfaces:y,focal:w}),{labels:I,sections:B,rows:k}=he({doc:n,units:o,seats:r,surfaces:y,seatData:E,hintedSeatFloor:f,zones:R,focal:w}),D=pe({doc:n,units:o,seats:r,surfaces:y,solids:A,hintedSeatFloor:f,seatFloor:d});be(I,D),E.iYaw=En(E.iPosition,r.length,P=>r[P].rowId,P=>{let F=o[d[P]]?.focal??w;return[F.x*g,F.y*g]});let U=(m.minX+m.maxX)/2*g,M=(m.minY+m.maxY)/2*g,_=.5*Math.hypot((m.maxX-m.minX)*g,(m.maxY-m.minY)*g)||10,N=ye(A,E,{cx:U,cz:M,radius:_}),O=xe(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:vn(e,Bt),theme:e,seatCount:r.length,focalWorld:[w.x*g,1.5,w.y*g],zones:R,stages:p,productionElements:a.elements,sections:B,rows:k,labels:I,floors:D}}export{Bt as a,Qt as b,cr as c,nn as d,g as e,lr as f,Le as g,De as h,mr as i,Vt as j,Mr as k,Sr as l,Pr as m,Ir as n,wr as o,_r as p,Tr as q,Br as r,Er as s,Cr as t,Fr as u,vr as v,gs as w};
@@ -1 +1 @@
1
- import{J as j,Ta as B,Wa as F}from"./chunk-QUOAQQMP.js";var L=.08,X=.045;function E(t,e,n){return{...t,objects:e,floors:void 0,...n?{focalPoint:n}:{},referenceImage:void 0,backgroundImage:void 0}}function T(t,e,n){let o=t.focalPoint??e.focalPoint;return o?o.x:n.x+n.width/2}function Y(t){let e=t.floors??[];if(!e.length)return[];let n=e.map(s=>F(E(t,s.objects,s.focalPoint),{freeText:"exclude"})),a=Math.max(1,...n.map(s=>s.width))*L,r=0;return e.map((s,l)=>{let h=n[l],u=r-(h.y+h.height);return r-=h.height+a,{floorId:s.id,label:s.name??s.id,level:l,levelBadge:l===0?"G":String(l),translation:{x:-T(s,t,h),y:u},bounds:h}})}function _(t,e,n,o){let a=e==="name"?t.label:t.levelBadge;if(!a)return[];let r=Math.max(1,n*X),s=t.bounds.x+t.translation.x,l=t.bounds.y+t.translation.y+r*.4,h=`floor-level-${t.floorId}`,u={type:"text",id:`${h}-text`,text:a,position:{x:s,y:l},fontSize:r,rotation:0,color:o,bold:!0};if(e==="name")return[u];let m=r*.95;return[{type:"shape",id:`${h}-badge`,kind:"ellipse",x:s-m*.35,y:l-m*.3,width:m*2,height:m*2,fill:"transparent",stroke:{color:o,width:Math.max(1,r*.09)},opacity:.8},u]}function z(t,e={}){let n=t.floors;if(!n||n.length<2)return t;let o=Y(t),a=[];n.forEach((u,m)=>{let{x:y,y:S}=o[m].translation;for(let w of u.objects)m>0&&w.type==="shape"&&w.role==="stage"||a.push(B(w,y,S))});let r={...t,objects:a,floors:void 0},s=F(r,{freeText:"exclude"}),l=Math.max(1,s.width,s.height),h=t.theme?.textColor??"#94a3b8";for(let u of o)a.push(..._(u,e.labelStyle??"number",l,h));return{...r,objects:a,referenceImage:void 0,backgroundImage:void 0}}function Q(t){let e=t.floors;if(!e?.length)return null;let n=e.find(r=>r.objects.some(s=>s.type==="shape"&&s.role==="stage"));if(n)return n.id;let o=e[0],a=-1;for(let r of e){let s=F(E(t,r.objects,r.focalPoint),{freeText:"exclude"}),l=s.width*s.height;l>a&&(a=l,o=r)}return o.id}var N=640;function H(t,e){return(t.floors?.length??0)<2?null:!Number.isFinite(e)||e<=0||e>=N?"all":Q(t)}var U=9;function $(t){if(t.kind==="circle")return{hx:t.r,hy:t.r};let e=t.width/2,n=t.height/2,o=t.rotation??0;if(!o)return{hx:e,hy:n};let a=o*Math.PI/180,r=Math.abs(Math.cos(a)),s=Math.abs(Math.sin(a));return{hx:e*r+n*s,hy:e*s+n*r}}function q(t,e,n){let o=e-t.seat.x,a=n-t.seat.y;if(t.shape.kind==="circle")return o*o+a*a<=t.shape.r*t.shape.r;let r=t.shape.rotation??0,s=o,l=a;if(r){let h=-r*Math.PI/180,u=Math.cos(h),m=Math.sin(h);s=o*u-a*m,l=o*m+a*u}return Math.abs(s)<=t.shape.width/2&&Math.abs(l)<=t.shape.height/2}function G(t,e,n,o,a){if(t.shape.kind==="circle"){let d=Math.min(Math.max(t.seat.x,e),o),x=Math.min(Math.max(t.seat.y,n),a),f=t.seat.x-d,b=t.seat.y-x;return f*f+b*b<=t.shape.r*t.shape.r}let r=t.shape.rotation??0;if(!r)return t.seat.x-t.hx<=o&&t.seat.x+t.hx>=e&&t.seat.y-t.hy<=a&&t.seat.y+t.hy>=n;let s=r*Math.PI/180,l=Math.cos(s),h=Math.sin(s),u=t.shape.width/2,m=t.shape.height/2,y=[[-u,-m],[u,-m],[u,m],[-u,m]].map(([d,x])=>[t.seat.x+d*l-x*h,t.seat.y+d*h+x*l]),S=[[e,n],[o,n],[o,a],[e,a]],w=[[1,0],[0,1],[l,h],[-h,l]];for(let[d,x]of w){let f=1/0,b=-1/0;for(let[P,O]of y){let c=P*d+O*x;c<f&&(f=c),c>b&&(b=c)}let M=1/0,I=-1/0;for(let[P,O]of S){let c=P*d+O*x;c<M&&(M=c),c>I&&(I=c)}if(b<M||I<f)return!1}return!0}function W(t,e={}){let n=e.seatRadius??U,o=t.length,a=new Array(o),r=1/0,s=1/0,l=-1/0,h=-1/0,u=0;for(let c=0;c<o;c++){let i=t[c],D=e.shapeOf?.(i)??{kind:"circle",r:n},{hx:g,hy:p}=$(D);a[c]={seat:i,shape:D,hx:g,hy:p},i.x-g<r&&(r=i.x-g),i.y-p<s&&(s=i.y-p),i.x+g>l&&(l=i.x+g),i.y+p>h&&(h=i.y+p),g>u&&(u=g),p>u&&(u=p)}o===0&&(r=0,s=0,l=0,h=0);let m=u>0?u*4:1,y=Math.max(l-r,0),S=Math.max(h-s,0),w=Math.max(64,e.maxCells??o*4),d=m,x=Math.max(1,Math.ceil(y/d)||1),f=Math.max(1,Math.ceil(S/d)||1);for(;x*f>w&&(x>1||f>1);)d*=2,x=Math.max(1,Math.ceil(y/d)||1),f=Math.max(1,Math.ceil(S/d)||1);let b=x*f,M=new Int32Array(b+1),I=0;for(let c=0;c<o;c++){let i=a[c],D=j(Math.floor((i.seat.x-i.hx-r)/d),0,x-1),g=j(Math.floor((i.seat.x+i.hx-r)/d),0,x-1),p=j(Math.floor((i.seat.y-i.hy-s)/d),0,f-1),R=j(Math.floor((i.seat.y+i.hy-s)/d),0,f-1);for(let C=p;C<=R;C++)for(let A=D;A<=g;A++)M[C*x+A+1]++,I++}for(let c=0;c<b;c++)M[c+1]+=M[c];let P=new Int32Array(I),O=M.slice(0,b);for(let c=0;c<o;c++){let i=a[c],D=j(Math.floor((i.seat.x-i.hx-r)/d),0,x-1),g=j(Math.floor((i.seat.x+i.hx-r)/d),0,x-1),p=j(Math.floor((i.seat.y-i.hy-s)/d),0,f-1),R=j(Math.floor((i.seat.y+i.hy-s)/d),0,f-1);for(let C=p;C<=R;C++)for(let A=D;A<=g;A++){let k=C*x+A;P[O[k]++]=c}}return{seats:t,entries:a,minX:r,minY:s,cell:d,cols:x,rows:f,cellStart:M,items:P,stamp:new Int32Array(o),epoch:0}}function tt(t,e,n={}){let{cols:o,rows:a,cell:r,minX:s,minY:l,cellStart:h,items:u,entries:m}=t,y=Math.floor((e.x-s)/r),S=Math.floor((e.y-l)/r);if(y<0||S<0||y>=o||S>=a)return null;let w=S*o+y,d=h[w+1],x=-1,f=1/0;for(let b=h[w];b<d;b++){let M=u[b],I=m[M];if(n.filter&&!n.filter(I.seat.id,I.seat)||!q(I,e.x,e.y))continue;let P=e.x-I.seat.x,O=e.y-I.seat.y,c=P*P+O*O;(c<f||c===f&&M<x)&&(f=c,x=M)}return x<0?null:m[x].seat.id}function et(t,e,n,o={}){if(!(n>0))return null;let{cols:a,rows:r,cell:s,minX:l,minY:h,cellStart:u,items:m,entries:y}=t,S=Math.max(0,Math.floor((e.x-n-l)/s)),w=Math.min(a-1,Math.floor((e.x+n-l)/s)),d=Math.max(0,Math.floor((e.y-n-h)/s)),x=Math.min(r-1,Math.floor((e.y+n-h)/s));if(S>w||d>x)return null;let f=-1,b=n*n,M=t.stamp,I=++t.epoch;for(let P=d;P<=x;P++){let O=P*a;for(let c=S;c<=w;c++){let i=O+c,D=u[i+1];for(let g=u[i];g<D;g++){let p=m[g];if(M[p]===I)continue;M[p]=I;let R=y[p];if(o.filter&&!o.filter(R.seat.id,R.seat))continue;let C=e.x-R.seat.x,A=e.y-R.seat.y,k=C*C+A*A;(k<b||k===b&&p<f)&&(b=k,f=p)}}}return f<0?null:y[f].seat.id}function nt(t,e,n={}){let o=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),s=Math.max(e.y,e.y+e.height),l=n.mode??"center",{cols:h,rows:u,cell:m,minX:y,minY:S,cellStart:w,items:d,entries:x}=t,f=Math.max(0,Math.floor((o-y)/m)),b=Math.min(h-1,Math.floor((a-y)/m)),M=Math.max(0,Math.floor((r-S)/m)),I=Math.min(u-1,Math.floor((s-S)/m));if(f>b||M>I)return[];let P=[],O=t.stamp,c=++t.epoch;for(let i=M;i<=I;i++){let D=i*h;for(let g=f;g<=b;g++){let p=D+g,R=w[p+1];for(let C=w[p];C<R;C++){let A=d[C];if(O[A]===c)continue;O[A]=c;let k=x[A];if(n.filter&&!n.filter(k.seat.id,k.seat))continue;(l==="center"?k.seat.x>=o&&k.seat.x<=a&&k.seat.y>=r&&k.seat.y<=s:G(k,o,r,a,s))&&P.push(A)}}}return P.sort((i,D)=>i-D),P.map(i=>x[i].seat.id)}function ot(t){let e=t.cols*t.rows,n=0,o=0;for(let r=0;r<e;r++){let s=t.cellStart[r+1]-t.cellStart[r];s>0&&n++,s>o&&(o=s)}let a=t.items.length;return{cell:t.cell,cols:t.cols,rows:t.rows,cells:e,occupiedCells:n,refs:a,maxPerCell:o,meanPerOccupiedCell:n?a/n:0}}function st(t,e=0){let n=Math.max(1,t.width,t.height),o={x:t.x+t.width/2,y:t.y+t.height/2},a=n*1.55,r=Math.max(n*.82,Math.max(0,e)+n*.45);return{target:o,distance:a,height:r,focalLength:Math.hypot(a,r),yawRad:-8*Math.PI/180}}function v(t,e,n=0){let o=e.x-t.target.x,a=e.y-t.target.y,r=Math.cos(t.yawRad),s=Math.sin(t.yawRad),l=o*r-a*s,u=o*s+a*r-t.distance,m=n-t.height,y=Math.hypot(t.distance,t.height),S=(-t.distance*u-t.height*m)/y,w=(-t.height*u+t.distance*m)/y,d=Math.max(y*.08,S),x=t.focalLength/d;return{x:t.target.x+l*x,y:t.target.y-w*x,depth:d,scale:x}}function at(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 ct(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 n=t.d/e,o=-t.b/e,a=-t.c/e,r=t.a/e;return{a:n,b:o,c:a,d:r,e:-(n*t.e+a*t.f),f:-(o*t.e+r*t.f)}}function it(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 lt(t,e,n=()=>0){let o=v(t,e,n(e)),a={x:e.x+1,y:e.y},r={x:e.x,y:e.y+1},s=v(t,a,n(a)),l=v(t,r,n(r)),h=s.x-o.x,u=s.y-o.y,m=l.x-o.x,y=l.y-o.y;return{a:h,b:u,c:m,d:y,e:o.x-h*e.x-m*e.y,f:o.y-u*e.x-y*e.y}}function ht(t){let e=Math.hypot(t.a,t.b),n=t.a*t.d-t.b*t.c;return{rotationDeg:Math.atan2(t.b,t.a)*180/Math.PI,scaleX:e,scaleY:n/Math.max(e,1e-9),skewX:(t.a*t.c+t.b*t.d)/Math.max(n,1e-9)}}export{L as a,Y as b,z as c,Q as d,N as e,H as f,U as g,W as h,tt as i,et as j,nt as k,ot as l,st as m,v as n,at as o,ct as p,it as q,lt as r,ht as s};
1
+ import{J as j,Ua as B,Xa as F}from"./chunk-24O23MNB.js";var L=.08,X=.045;function E(t,e,n){return{...t,objects:e,floors:void 0,...n?{focalPoint:n}:{},referenceImage:void 0,backgroundImage:void 0}}function T(t,e,n){let o=t.focalPoint??e.focalPoint;return o?o.x:n.x+n.width/2}function Y(t){let e=t.floors??[];if(!e.length)return[];let n=e.map(s=>F(E(t,s.objects,s.focalPoint),{freeText:"exclude"})),a=Math.max(1,...n.map(s=>s.width))*L,r=0;return e.map((s,l)=>{let h=n[l],u=r-(h.y+h.height);return r-=h.height+a,{floorId:s.id,label:s.name??s.id,level:l,levelBadge:l===0?"G":String(l),translation:{x:-T(s,t,h),y:u},bounds:h}})}function _(t,e,n,o){let a=e==="name"?t.label:t.levelBadge;if(!a)return[];let r=Math.max(1,n*X),s=t.bounds.x+t.translation.x,l=t.bounds.y+t.translation.y+r*.4,h=`floor-level-${t.floorId}`,u={type:"text",id:`${h}-text`,text:a,position:{x:s,y:l},fontSize:r,rotation:0,color:o,bold:!0};if(e==="name")return[u];let m=r*.95;return[{type:"shape",id:`${h}-badge`,kind:"ellipse",x:s-m*.35,y:l-m*.3,width:m*2,height:m*2,fill:"transparent",stroke:{color:o,width:Math.max(1,r*.09)},opacity:.8},u]}function z(t,e={}){let n=t.floors;if(!n||n.length<2)return t;let o=Y(t),a=[];n.forEach((u,m)=>{let{x:y,y:S}=o[m].translation;for(let w of u.objects)m>0&&w.type==="shape"&&w.role==="stage"||a.push(B(w,y,S))});let r={...t,objects:a,floors:void 0},s=F(r,{freeText:"exclude"}),l=Math.max(1,s.width,s.height),h=t.theme?.textColor??"#94a3b8";for(let u of o)a.push(..._(u,e.labelStyle??"number",l,h));return{...r,objects:a,referenceImage:void 0,backgroundImage:void 0}}function Q(t){let e=t.floors;if(!e?.length)return null;let n=e.find(r=>r.objects.some(s=>s.type==="shape"&&s.role==="stage"));if(n)return n.id;let o=e[0],a=-1;for(let r of e){let s=F(E(t,r.objects,r.focalPoint),{freeText:"exclude"}),l=s.width*s.height;l>a&&(a=l,o=r)}return o.id}var N=640;function H(t,e){return(t.floors?.length??0)<2?null:!Number.isFinite(e)||e<=0||e>=N?"all":Q(t)}var U=9;function $(t){if(t.kind==="circle")return{hx:t.r,hy:t.r};let e=t.width/2,n=t.height/2,o=t.rotation??0;if(!o)return{hx:e,hy:n};let a=o*Math.PI/180,r=Math.abs(Math.cos(a)),s=Math.abs(Math.sin(a));return{hx:e*r+n*s,hy:e*s+n*r}}function q(t,e,n){let o=e-t.seat.x,a=n-t.seat.y;if(t.shape.kind==="circle")return o*o+a*a<=t.shape.r*t.shape.r;let r=t.shape.rotation??0,s=o,l=a;if(r){let h=-r*Math.PI/180,u=Math.cos(h),m=Math.sin(h);s=o*u-a*m,l=o*m+a*u}return Math.abs(s)<=t.shape.width/2&&Math.abs(l)<=t.shape.height/2}function G(t,e,n,o,a){if(t.shape.kind==="circle"){let d=Math.min(Math.max(t.seat.x,e),o),x=Math.min(Math.max(t.seat.y,n),a),f=t.seat.x-d,b=t.seat.y-x;return f*f+b*b<=t.shape.r*t.shape.r}let r=t.shape.rotation??0;if(!r)return t.seat.x-t.hx<=o&&t.seat.x+t.hx>=e&&t.seat.y-t.hy<=a&&t.seat.y+t.hy>=n;let s=r*Math.PI/180,l=Math.cos(s),h=Math.sin(s),u=t.shape.width/2,m=t.shape.height/2,y=[[-u,-m],[u,-m],[u,m],[-u,m]].map(([d,x])=>[t.seat.x+d*l-x*h,t.seat.y+d*h+x*l]),S=[[e,n],[o,n],[o,a],[e,a]],w=[[1,0],[0,1],[l,h],[-h,l]];for(let[d,x]of w){let f=1/0,b=-1/0;for(let[P,O]of y){let c=P*d+O*x;c<f&&(f=c),c>b&&(b=c)}let M=1/0,I=-1/0;for(let[P,O]of S){let c=P*d+O*x;c<M&&(M=c),c>I&&(I=c)}if(b<M||I<f)return!1}return!0}function W(t,e={}){let n=e.seatRadius??U,o=t.length,a=new Array(o),r=1/0,s=1/0,l=-1/0,h=-1/0,u=0;for(let c=0;c<o;c++){let i=t[c],D=e.shapeOf?.(i)??{kind:"circle",r:n},{hx:g,hy:p}=$(D);a[c]={seat:i,shape:D,hx:g,hy:p},i.x-g<r&&(r=i.x-g),i.y-p<s&&(s=i.y-p),i.x+g>l&&(l=i.x+g),i.y+p>h&&(h=i.y+p),g>u&&(u=g),p>u&&(u=p)}o===0&&(r=0,s=0,l=0,h=0);let m=u>0?u*4:1,y=Math.max(l-r,0),S=Math.max(h-s,0),w=Math.max(64,e.maxCells??o*4),d=m,x=Math.max(1,Math.ceil(y/d)||1),f=Math.max(1,Math.ceil(S/d)||1);for(;x*f>w&&(x>1||f>1);)d*=2,x=Math.max(1,Math.ceil(y/d)||1),f=Math.max(1,Math.ceil(S/d)||1);let b=x*f,M=new Int32Array(b+1),I=0;for(let c=0;c<o;c++){let i=a[c],D=j(Math.floor((i.seat.x-i.hx-r)/d),0,x-1),g=j(Math.floor((i.seat.x+i.hx-r)/d),0,x-1),p=j(Math.floor((i.seat.y-i.hy-s)/d),0,f-1),R=j(Math.floor((i.seat.y+i.hy-s)/d),0,f-1);for(let C=p;C<=R;C++)for(let A=D;A<=g;A++)M[C*x+A+1]++,I++}for(let c=0;c<b;c++)M[c+1]+=M[c];let P=new Int32Array(I),O=M.slice(0,b);for(let c=0;c<o;c++){let i=a[c],D=j(Math.floor((i.seat.x-i.hx-r)/d),0,x-1),g=j(Math.floor((i.seat.x+i.hx-r)/d),0,x-1),p=j(Math.floor((i.seat.y-i.hy-s)/d),0,f-1),R=j(Math.floor((i.seat.y+i.hy-s)/d),0,f-1);for(let C=p;C<=R;C++)for(let A=D;A<=g;A++){let k=C*x+A;P[O[k]++]=c}}return{seats:t,entries:a,minX:r,minY:s,cell:d,cols:x,rows:f,cellStart:M,items:P,stamp:new Int32Array(o),epoch:0}}function tt(t,e,n={}){let{cols:o,rows:a,cell:r,minX:s,minY:l,cellStart:h,items:u,entries:m}=t,y=Math.floor((e.x-s)/r),S=Math.floor((e.y-l)/r);if(y<0||S<0||y>=o||S>=a)return null;let w=S*o+y,d=h[w+1],x=-1,f=1/0;for(let b=h[w];b<d;b++){let M=u[b],I=m[M];if(n.filter&&!n.filter(I.seat.id,I.seat)||!q(I,e.x,e.y))continue;let P=e.x-I.seat.x,O=e.y-I.seat.y,c=P*P+O*O;(c<f||c===f&&M<x)&&(f=c,x=M)}return x<0?null:m[x].seat.id}function et(t,e,n,o={}){if(!(n>0))return null;let{cols:a,rows:r,cell:s,minX:l,minY:h,cellStart:u,items:m,entries:y}=t,S=Math.max(0,Math.floor((e.x-n-l)/s)),w=Math.min(a-1,Math.floor((e.x+n-l)/s)),d=Math.max(0,Math.floor((e.y-n-h)/s)),x=Math.min(r-1,Math.floor((e.y+n-h)/s));if(S>w||d>x)return null;let f=-1,b=n*n,M=t.stamp,I=++t.epoch;for(let P=d;P<=x;P++){let O=P*a;for(let c=S;c<=w;c++){let i=O+c,D=u[i+1];for(let g=u[i];g<D;g++){let p=m[g];if(M[p]===I)continue;M[p]=I;let R=y[p];if(o.filter&&!o.filter(R.seat.id,R.seat))continue;let C=e.x-R.seat.x,A=e.y-R.seat.y,k=C*C+A*A;(k<b||k===b&&p<f)&&(b=k,f=p)}}}return f<0?null:y[f].seat.id}function nt(t,e,n={}){let o=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),s=Math.max(e.y,e.y+e.height),l=n.mode??"center",{cols:h,rows:u,cell:m,minX:y,minY:S,cellStart:w,items:d,entries:x}=t,f=Math.max(0,Math.floor((o-y)/m)),b=Math.min(h-1,Math.floor((a-y)/m)),M=Math.max(0,Math.floor((r-S)/m)),I=Math.min(u-1,Math.floor((s-S)/m));if(f>b||M>I)return[];let P=[],O=t.stamp,c=++t.epoch;for(let i=M;i<=I;i++){let D=i*h;for(let g=f;g<=b;g++){let p=D+g,R=w[p+1];for(let C=w[p];C<R;C++){let A=d[C];if(O[A]===c)continue;O[A]=c;let k=x[A];if(n.filter&&!n.filter(k.seat.id,k.seat))continue;(l==="center"?k.seat.x>=o&&k.seat.x<=a&&k.seat.y>=r&&k.seat.y<=s:G(k,o,r,a,s))&&P.push(A)}}}return P.sort((i,D)=>i-D),P.map(i=>x[i].seat.id)}function ot(t){let e=t.cols*t.rows,n=0,o=0;for(let r=0;r<e;r++){let s=t.cellStart[r+1]-t.cellStart[r];s>0&&n++,s>o&&(o=s)}let a=t.items.length;return{cell:t.cell,cols:t.cols,rows:t.rows,cells:e,occupiedCells:n,refs:a,maxPerCell:o,meanPerOccupiedCell:n?a/n:0}}function st(t,e=0){let n=Math.max(1,t.width,t.height),o={x:t.x+t.width/2,y:t.y+t.height/2},a=n*1.55,r=Math.max(n*.82,Math.max(0,e)+n*.45);return{target:o,distance:a,height:r,focalLength:Math.hypot(a,r),yawRad:-8*Math.PI/180}}function v(t,e,n=0){let o=e.x-t.target.x,a=e.y-t.target.y,r=Math.cos(t.yawRad),s=Math.sin(t.yawRad),l=o*r-a*s,u=o*s+a*r-t.distance,m=n-t.height,y=Math.hypot(t.distance,t.height),S=(-t.distance*u-t.height*m)/y,w=(-t.height*u+t.distance*m)/y,d=Math.max(y*.08,S),x=t.focalLength/d;return{x:t.target.x+l*x,y:t.target.y-w*x,depth:d,scale:x}}function at(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 ct(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 n=t.d/e,o=-t.b/e,a=-t.c/e,r=t.a/e;return{a:n,b:o,c:a,d:r,e:-(n*t.e+a*t.f),f:-(o*t.e+r*t.f)}}function it(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 lt(t,e,n=()=>0){let o=v(t,e,n(e)),a={x:e.x+1,y:e.y},r={x:e.x,y:e.y+1},s=v(t,a,n(a)),l=v(t,r,n(r)),h=s.x-o.x,u=s.y-o.y,m=l.x-o.x,y=l.y-o.y;return{a:h,b:u,c:m,d:y,e:o.x-h*e.x-m*e.y,f:o.y-u*e.x-y*e.y}}function ht(t){let e=Math.hypot(t.a,t.b),n=t.a*t.d-t.b*t.c;return{rotationDeg:Math.atan2(t.b,t.a)*180/Math.PI,scaleX:e,scaleY:n/Math.max(e,1e-9),skewX:(t.a*t.c+t.b*t.d)/Math.max(n,1e-9)}}export{L as a,Y as b,z as c,Q as d,N as e,H as f,U as g,W as h,tt as i,et as j,nt as k,ot as l,st as m,v as n,at as o,ct as p,it as q,lt as r,ht as s};
@@ -1 +1 @@
1
- import{Ja as A,Sa as O,Va as v}from"./chunk-QUOAQQMP.js";function I(t){let n=Number(t.slice(t.lastIndexOf(":")+1));return Number.isFinite(n)?n:-1}function $(t,n,i){let e=new Map;for(let o of t){if(o.kind==="booth")continue;let a=e.get(o.rowId);a?a.push(o):e.set(o.rowId,[o])}let c=o=>i.has(o.id)||n(o.id)!=="free",l=[];for(let o of e.values())if(!(o.length<3)){o.sort((a,b)=>I(a.id)-I(b.id));for(let a=1;a<o.length-1;a++){let b=o[a];if(c(b))continue;let y=o[a-1],m=o[a+1];I(b.id)-I(y.id)!==1||I(m.id)-I(b.id)!==1||!c(y)||!c(m)||!i.has(y.id)&&!i.has(m.id)||l.push(b)}}return l}function D(t){return{code:"ticket_option_not_applicable",labels:t,message:"That ticket choice is not available for the selected seat."}}function C(t,n){let i=t.applicability;return i?!(i.seatLabels?.length&&!i.seatLabels.includes(n.label)||i.accessibility?.length&&!i.accessibility.some(e=>n.accessibility?.includes(e))):!0}function Q(t,n){return(t.categories.find(i=>i.key===n.categoryKey)?.tiers??[]).filter(i=>C(i,n))}function M(t,n,i){let e=t.categories.find(l=>l.key===n.categoryKey)?.tiers;if(!e?.length)return{kind:"none"};let c=i==null?e.find(l=>C(l,n)):e.find(l=>l.id===i&&C(l,n));return c?{kind:"resolved",tier:c}:{kind:"invalid"}}function z(t,n){return(t.logicalRowId??t.rowId)===(n.logicalRowId??n.rowId)}function N(t){if(Number.isInteger(t.logicalSeatIndex))return t.logicalSeatIndex;let n=t.id.slice(t.id.lastIndexOf(":")+1),i=Number(n);return Number.isInteger(i)?i:void 0}function G(t,n){if(!z(t,n))return!1;let i=N(t),e=N(n);return i!=null&&e!=null&&Math.abs(i-e)===1}function U(t,n){if(!n.length)return null;let i=new Map(v(t,{resolveEyeHeights:!1}).map(o=>[o.label,o])),e=n.flatMap(o=>{let a=i.get(o.label);return a?[{selection:o,seat:a}]:[]}),c=e.map(({seat:o})=>o).filter(o=>o.accessibility?.includes("wheelchair")),l=[];for(let{selection:o,seat:a}of e){let b=M(t,a,o.tierId),y=b.kind==="resolved"?b.tier:void 0;(a.accessibility?.includes("companion")||y?.restriction==="companion")&&!c.some(s=>s.id!==a.id&&G(a,s))&&l.push(a.label)}return l.length?{code:"companion_pair_required",labels:l,message:"Select the adjacent wheelchair place with each companion ticket."}:null}function X(t,n){if(!n.length)return null;let i=new Map(v(t,{resolveEyeHeights:!1}).map(o=>[o.label,o])),e=new Set(t.categories.filter(o=>o.notForSale).map(o=>o.key)),c=[],l=[];for(let o of n){let a=i.get(o.label);if(!a)continue;if(e.has(a.categoryKey)){c.push(a.label);continue}M(t,a,o.tierId).kind==="invalid"&&l.push(a.label)}return c.length?{code:"not_for_sale",labels:c,message:"These seats are not for sale."}:l.length?D(l):U(t,n)}function E(t,n){if(Number.isInteger(t.logicalSeatIndex))return t.logicalSeatIndex;let i=t.id.lastIndexOf(":");if(i<0)return n;let e=Number(t.id.slice(i+1));return Number.isFinite(e)?e:n}function w(t,n){let i=t.x-n.x,e=t.y-n.y;return i*i+e*e}function R(t){let n=0,i=0;for(let e of t)n+=e.x,i+=e.y;return{x:n/t.length,y:i/t.length}}function K(t,n){return t.find(i=>i.focalPoint)?.focalPoint??n}function P(t){return t.commercial?.premium===!0}function V(t,n,i){let e=Math.floor(i.qty);if(!Number.isFinite(e)||e<=0)return{labels:[],reason:"sold_out"};let{categoryKey:c,zoneId:l,focal:o,preferPremium:a,accessibility:b,requireContiguous:y}=i,m=new Map,s=[];if(t.forEach((r,u)=>{let g=n.has(r.label)&&(!c||r.categoryKey===c)&&(!l||r.zoneId===l)&&(!b||b.some(h=>r.accessibility?.includes(h))),p=r.logicalRowId??r.rowId,d=m.get(p);d||(d=[],m.set(p,d)),d.push({seat:r,index:E(r,u),elig:g}),g&&s.push(r)}),s.length===0)return{labels:[],reason:"sold_out"};let f=null,B=r=>{if(!f)return!0;if(a&&r.nonPremium!==f.nonPremium)return r.nonPremium<f.nonPremium;if(r.orphan!==f.orphan)return r.orphan<f.orphan;if(r.d2!==f.d2)return r.d2<f.d2;let u=r.rowId.localeCompare(f.rowId);return u!==0?u<0:r.startIndex<f.startIndex};for(let[r,u]of m){let g=[...u].sort((d,h)=>d.index-h.index),p=0;for(;p<g.length;){if(!g[p].elig){p++;continue}let d=p;for(;d<g.length&&g[d].elig&&(d===p||g[d].index===g[d-1].index+1);)d++;let h=d-p;for(let x=0;x+e<=h;x++){let j=x,F=h-(x+e),L=j===1||F===1?1:0,S=g.slice(p+x,p+x+e).map(T=>T.seat),_={labels:S.map(T=>T.label),seats:S,rowId:r,startIndex:g[p+x].index,orphan:L,nonPremium:a?S.reduce((T,q)=>T+(P(q)?0:1),0):0,d2:w(R(S),K(S,o))};B(_)&&(f=_)}p=d}}return f?{labels:f.labels}:y?{labels:[],reason:s.length?"not_enough_together":"sold_out"}:s.length<e?{labels:[],reason:"not_enough_together"}:{labels:s.map((r,u)=>({seat:r,i:u,d2:w(r,r.focalPoint??o)})).sort((r,u)=>{if(a){let p=P(r.seat)?0:1,d=P(u.seat)?0:1;if(p!==d)return p-d}if(r.d2!==u.d2)return r.d2-u.d2;let g=(r.seat.logicalRowId??r.seat.rowId).localeCompare(u.seat.logicalRowId??u.seat.rowId);return g!==0?g:E(r.seat,r.i)-E(u.seat,u.i)}).slice(0,e).map(r=>r.seat.label)}}function ee(t,n,i,e){let c=Math.floor(e.qty),l=V(t,i,e),a=n.filter(s=>s.bookingMode==="whole"&&s.capacity===c&&i.has(s.label)&&(!e.categoryKey||s.categoryKey===e.categoryKey)&&(!e.zoneId||s.zoneId===e.zoneId)&&!e.accessibility).map(s=>({table:s,d2:w(s.center,s.focalPoint??e.focal)})).sort((s,f)=>s.d2-f.d2||s.table.label.localeCompare(f.table.label))[0];if(!a)return l;if(!l.labels.length)return{labels:[a.table.label]};let b=new Map(t.map(s=>[s.label,s])),y=l.labels.map(s=>b.get(s)).filter(s=>!!s),m=y.length?w(R(y),K(y,e.focal)):Number.POSITIVE_INFINITY;return a.d2<m?{labels:[a.table.label]}:l}var k=class extends Error{constructor(i,e){super(e);this.objectId=i;this.name="GroupedTableProjectionError"}};function H(t){let n=t.minOccupancy,i=t.maxOccupancy;if(!Number.isInteger(n)||!Number.isInteger(i)||n<1||i<n||i>t.seatCount)throw new k(t.id,`Table "${t.label}" has invalid variable-occupancy bounds`);return{min:n,max:i}}function ie(t,n){if(n!==2)return[];let i=[];for(let e of O(t)){if(e.type!=="table"||!e.bookAsWhole&&!e.variableOccupancy)continue;if(e.bookAsWhole&&e.variableOccupancy)throw new k(e.id,`Table "${e.label}" cannot be whole-table and variable-occupancy inventory`);if(!Number.isInteger(e.seatCount)||e.seatCount<1||!e.label.trim())throw new k(e.id,"Grouped tables require a label and at least one chair");let c=e.variableOccupancy?"variable":"whole",l=c==="variable"?H(e):{min:e.seatCount,max:e.seatCount};i.push({objectId:e.id,label:e.label,...e.displayLabel?{displayLabel:e.displayLabel}:{},...e.displayType?{displayType:e.displayType}:{},categoryKey:e.categoryKey,mode:c,capacity:e.seatCount,minOccupancy:l.min,maxOccupancy:l.max,chairs:A(e)})}return i}export{$ as a,D as b,C as c,Q as d,M as e,U as f,X as g,V as h,ee as i,k as j,ie as k};
1
+ import{Ka as A,Ta as O,Wa as v}from"./chunk-24O23MNB.js";function I(t){let n=Number(t.slice(t.lastIndexOf(":")+1));return Number.isFinite(n)?n:-1}function $(t,n,i){let e=new Map;for(let o of t){if(o.kind==="booth")continue;let a=e.get(o.rowId);a?a.push(o):e.set(o.rowId,[o])}let c=o=>i.has(o.id)||n(o.id)!=="free",l=[];for(let o of e.values())if(!(o.length<3)){o.sort((a,b)=>I(a.id)-I(b.id));for(let a=1;a<o.length-1;a++){let b=o[a];if(c(b))continue;let y=o[a-1],m=o[a+1];I(b.id)-I(y.id)!==1||I(m.id)-I(b.id)!==1||!c(y)||!c(m)||!i.has(y.id)&&!i.has(m.id)||l.push(b)}}return l}function D(t){return{code:"ticket_option_not_applicable",labels:t,message:"That ticket choice is not available for the selected seat."}}function C(t,n){let i=t.applicability;return i?!(i.seatLabels?.length&&!i.seatLabels.includes(n.label)||i.accessibility?.length&&!i.accessibility.some(e=>n.accessibility?.includes(e))):!0}function Q(t,n){return(t.categories.find(i=>i.key===n.categoryKey)?.tiers??[]).filter(i=>C(i,n))}function M(t,n,i){let e=t.categories.find(l=>l.key===n.categoryKey)?.tiers;if(!e?.length)return{kind:"none"};let c=i==null?e.find(l=>C(l,n)):e.find(l=>l.id===i&&C(l,n));return c?{kind:"resolved",tier:c}:{kind:"invalid"}}function z(t,n){return(t.logicalRowId??t.rowId)===(n.logicalRowId??n.rowId)}function N(t){if(Number.isInteger(t.logicalSeatIndex))return t.logicalSeatIndex;let n=t.id.slice(t.id.lastIndexOf(":")+1),i=Number(n);return Number.isInteger(i)?i:void 0}function G(t,n){if(!z(t,n))return!1;let i=N(t),e=N(n);return i!=null&&e!=null&&Math.abs(i-e)===1}function U(t,n){if(!n.length)return null;let i=new Map(v(t,{resolveEyeHeights:!1}).map(o=>[o.label,o])),e=n.flatMap(o=>{let a=i.get(o.label);return a?[{selection:o,seat:a}]:[]}),c=e.map(({seat:o})=>o).filter(o=>o.accessibility?.includes("wheelchair")),l=[];for(let{selection:o,seat:a}of e){let b=M(t,a,o.tierId),y=b.kind==="resolved"?b.tier:void 0;(a.accessibility?.includes("companion")||y?.restriction==="companion")&&!c.some(s=>s.id!==a.id&&G(a,s))&&l.push(a.label)}return l.length?{code:"companion_pair_required",labels:l,message:"Select the adjacent wheelchair place with each companion ticket."}:null}function X(t,n){if(!n.length)return null;let i=new Map(v(t,{resolveEyeHeights:!1}).map(o=>[o.label,o])),e=new Set(t.categories.filter(o=>o.notForSale).map(o=>o.key)),c=[],l=[];for(let o of n){let a=i.get(o.label);if(!a)continue;if(e.has(a.categoryKey)){c.push(a.label);continue}M(t,a,o.tierId).kind==="invalid"&&l.push(a.label)}return c.length?{code:"not_for_sale",labels:c,message:"These seats are not for sale."}:l.length?D(l):U(t,n)}function E(t,n){if(Number.isInteger(t.logicalSeatIndex))return t.logicalSeatIndex;let i=t.id.lastIndexOf(":");if(i<0)return n;let e=Number(t.id.slice(i+1));return Number.isFinite(e)?e:n}function w(t,n){let i=t.x-n.x,e=t.y-n.y;return i*i+e*e}function R(t){let n=0,i=0;for(let e of t)n+=e.x,i+=e.y;return{x:n/t.length,y:i/t.length}}function K(t,n){return t.find(i=>i.focalPoint)?.focalPoint??n}function P(t){return t.commercial?.premium===!0}function V(t,n,i){let e=Math.floor(i.qty);if(!Number.isFinite(e)||e<=0)return{labels:[],reason:"sold_out"};let{categoryKey:c,zoneId:l,focal:o,preferPremium:a,accessibility:b,requireContiguous:y}=i,m=new Map,s=[];if(t.forEach((r,u)=>{let g=n.has(r.label)&&(!c||r.categoryKey===c)&&(!l||r.zoneId===l)&&(!b||b.some(h=>r.accessibility?.includes(h))),p=r.logicalRowId??r.rowId,d=m.get(p);d||(d=[],m.set(p,d)),d.push({seat:r,index:E(r,u),elig:g}),g&&s.push(r)}),s.length===0)return{labels:[],reason:"sold_out"};let f=null,B=r=>{if(!f)return!0;if(a&&r.nonPremium!==f.nonPremium)return r.nonPremium<f.nonPremium;if(r.orphan!==f.orphan)return r.orphan<f.orphan;if(r.d2!==f.d2)return r.d2<f.d2;let u=r.rowId.localeCompare(f.rowId);return u!==0?u<0:r.startIndex<f.startIndex};for(let[r,u]of m){let g=[...u].sort((d,h)=>d.index-h.index),p=0;for(;p<g.length;){if(!g[p].elig){p++;continue}let d=p;for(;d<g.length&&g[d].elig&&(d===p||g[d].index===g[d-1].index+1);)d++;let h=d-p;for(let x=0;x+e<=h;x++){let j=x,F=h-(x+e),L=j===1||F===1?1:0,S=g.slice(p+x,p+x+e).map(T=>T.seat),_={labels:S.map(T=>T.label),seats:S,rowId:r,startIndex:g[p+x].index,orphan:L,nonPremium:a?S.reduce((T,q)=>T+(P(q)?0:1),0):0,d2:w(R(S),K(S,o))};B(_)&&(f=_)}p=d}}return f?{labels:f.labels}:y?{labels:[],reason:s.length?"not_enough_together":"sold_out"}:s.length<e?{labels:[],reason:"not_enough_together"}:{labels:s.map((r,u)=>({seat:r,i:u,d2:w(r,r.focalPoint??o)})).sort((r,u)=>{if(a){let p=P(r.seat)?0:1,d=P(u.seat)?0:1;if(p!==d)return p-d}if(r.d2!==u.d2)return r.d2-u.d2;let g=(r.seat.logicalRowId??r.seat.rowId).localeCompare(u.seat.logicalRowId??u.seat.rowId);return g!==0?g:E(r.seat,r.i)-E(u.seat,u.i)}).slice(0,e).map(r=>r.seat.label)}}function ee(t,n,i,e){let c=Math.floor(e.qty),l=V(t,i,e),a=n.filter(s=>s.bookingMode==="whole"&&s.capacity===c&&i.has(s.label)&&(!e.categoryKey||s.categoryKey===e.categoryKey)&&(!e.zoneId||s.zoneId===e.zoneId)&&!e.accessibility).map(s=>({table:s,d2:w(s.center,s.focalPoint??e.focal)})).sort((s,f)=>s.d2-f.d2||s.table.label.localeCompare(f.table.label))[0];if(!a)return l;if(!l.labels.length)return{labels:[a.table.label]};let b=new Map(t.map(s=>[s.label,s])),y=l.labels.map(s=>b.get(s)).filter(s=>!!s),m=y.length?w(R(y),K(y,e.focal)):Number.POSITIVE_INFINITY;return a.d2<m?{labels:[a.table.label]}:l}var k=class extends Error{constructor(i,e){super(e);this.objectId=i;this.name="GroupedTableProjectionError"}};function H(t){let n=t.minOccupancy,i=t.maxOccupancy;if(!Number.isInteger(n)||!Number.isInteger(i)||n<1||i<n||i>t.seatCount)throw new k(t.id,`Table "${t.label}" has invalid variable-occupancy bounds`);return{min:n,max:i}}function ie(t,n){if(n!==2)return[];let i=[];for(let e of O(t)){if(e.type!=="table"||!e.bookAsWhole&&!e.variableOccupancy)continue;if(e.bookAsWhole&&e.variableOccupancy)throw new k(e.id,`Table "${e.label}" cannot be whole-table and variable-occupancy inventory`);if(!Number.isInteger(e.seatCount)||e.seatCount<1||!e.label.trim())throw new k(e.id,"Grouped tables require a label and at least one chair");let c=e.variableOccupancy?"variable":"whole",l=c==="variable"?H(e):{min:e.seatCount,max:e.seatCount};i.push({objectId:e.id,label:e.label,...e.displayLabel?{displayLabel:e.displayLabel}:{},...e.displayType?{displayType:e.displayType}:{},categoryKey:e.categoryKey,mode:c,capacity:e.seatCount,minOccupancy:l.min,maxOccupancy:l.max,chairs:A(e)})}return i}export{$ as a,D as b,C as c,Q as d,M as e,U as f,X as g,V as h,ee as i,k as j,ie as k};
@@ -1 +1 @@
1
- import{ua as Y}from"./chunk-QUOAQQMP.js";function nn(c){return{kind:"radial",rowCount:0,rows:[],nearestRow:()=>-1,depthAt:(l,a)=>Math.hypot(l-c.x,a-c.y),gradientAt:(l,a)=>{let e=l-c.x,f=a-c.y,i=Math.hypot(e,f);return i<1e-9?[0,0]:[e/i,f/i]}}}function tn(c,l){if(!c.length)return null;let a=0,e=0,f=0;for(let n of c)a+=n.x,e+=n.y,f+=Math.hypot(n.x-l.x,n.y-l.y);let i=c.length;a/=i,e/=i,f/=i;let u=c[0],R=-1;for(let n of c){let o=Math.hypot(n.x-a,n.y-e);o>R&&(R=o,u=n)}let b=u.x-a,m=u.y-e,d=Math.hypot(b,m);d>1e-9?(b/=d,m/=d):(b=1,m=0);let y=[...c].sort((n,o)=>(n.x-a)*b+(n.y-e)*m-((o.x-a)*b+(o.y-e)*m)),t=0;for(let n of y){let o=Math.hypot(n.x-a,n.y-e);o>t&&(t=o)}return{pts:y,cx:a,cy:e,radius:t,depth:f}}function Z(c,l,a){let e=c.pts;if(e.length===1)return Math.hypot(l-e[0].x,a-e[0].y);let f=1/0;for(let i=0;i+1<e.length;i++){let u=e[i],R=e[i+1],b=R.x-u.x,m=R.y-u.y,d=b*b+m*m,y=d>1e-12?((l-u.x)*b+(a-u.y)*m)/d:0;y<0?y=0:y>1&&(y=1);let t=Math.hypot(l-(u.x+y*b),a-(u.y+y*m));t<f&&(f=t)}return f}var U=8;function en(c,l,a){let e=new Array(U).fill(1/0),f=new Array(U).fill(-1);for(let d=0;d<c.length;d++){let y=c[d],t=Math.hypot(l-y.cx,a-y.cy)-y.radius;for(let n=0;n<U;n++)if(t<e[n]){for(let o=U-1;o>n;o--)e[o]=e[o-1],f[o]=f[o-1];e[n]=t,f[n]=d;break}}let i=new Array(3).fill(1/0),u=new Array(3).fill(-1);for(let d of f){if(d<0)continue;let y=Z(c[d],l,a);for(let t=0;t<3;t++)if(y<i[t]){for(let n=2;n>t;n--)i[n]=i[n-1],u[n]=u[n-1];i[t]=y,u[t]=d;break}}if(u[0]<0)return 0;if(i[0]<1e-6)return c[u[0]].depth;let R=i[0]*2.2,b=0,m=0;for(let d=0;d<3;d++){let y=u[d];if(y<0||i[d]>R)continue;let t=1/(i[d]*i[d]);b+=t*c[y].depth,m+=t}return m>0?b/m:c[u[0]].depth}function on(c){let l=(e,f)=>en(c,e,f),a=(e,f)=>{let i=1/0,u=-1;for(let R=0;R<c.length;R++){let b=c[R];if(Math.hypot(e-b.cx,f-b.cy)-b.radius>=i)continue;let m=Z(b,e,f);m<i&&(i=m,u=R)}return u};return{kind:"rows",rowCount:c.length,rows:c,nearestRow:a,depthAt:l,gradientAt:(e,f)=>{let i=(l(e+.5,f)-l(e-.5,f))/1,u=(l(e,f+.5)-l(e,f-.5))/(2*.5),R=Math.hypot(i,u);return R<1e-9?[0,0]:[i/R,u/R]}}}function bn(c,l){let a=[];for(let e of c){let f=tn(e.points,l);f&&a.push(f)}return a.length<2?nn(l):(a.sort((e,f)=>e.depth-f.depth),on(a))}var rn=Math.PI/180,h=96,sn=6,ln=60,cn=150,$=.2,an=.35;function fn(c,l){let a=Math.atan2(l.x-c.x,l.y-c.y)/rn;return a<0?a+360:a}function z(c){if(!c.length)return NaN;let l=[...c].sort((a,e)=>a-e);return l[Math.floor(l.length/2)]}function J(c,l,a=2){let e=c.length,f=new Float64Array(e);for(let i=0;i<e;i++){let u=0,R=0;for(let b=-a;b<=a;b++){let m=i+b;if(l)m=(m%e+e)%e;else if(m<0||m>=e)continue;u+=c[m],R++}f[i]=u/R}return f}function hn(c,l){let a=c.filter(t=>t.rows.length>=1);if(a.length<1)return null;let e=[],f=0,i=0,u=0;for(let t of a)for(let n of t.rows){for(let o of n.pts)f+=o.x,i+=o.y,u++;if(n.pts.length>=4){let o=Y(n.pts);o&&Number.isFinite(o.cx)&&Number.isFinite(o.cy)&&e.push({x:o.cx,y:o.cy})}}if(!u)return null;let R={x:f/u,y:i/u},b=R;if(e.length>=8){let t=z(e.map(D=>D.x)),n=z(e.map(D=>D.y)),o=0;for(let D of a)for(let j of D.rows)for(let F of j.pts){let W=Math.hypot(F.x-R.x,F.y-R.y);W>o&&(o=W)}let B=0,S=o*.2;for(let D of a)for(let j of D.rows)for(let F of j.pts)Math.hypot(F.x-t,F.y-n)<S&&B++;Math.hypot(t-R.x,n-R.y)<=o&&B/u<.01&&(b={x:t,y:n})}let m=[];for(let t of a){let n={sectionId:t.sectionId,rMin:1/0,rMax:-1/0,samples:[]};for(let o of t.rows)for(let B of o.pts){let S=Math.hypot(B.x-b.x,B.y-b.y),D=Math.min(h-1,Math.floor(fn(b,B)/(360/h)));n.samples.push({r:S,bin:D,levelM:o.levelM}),S<n.rMin&&(n.rMin=S),S>n.rMax&&(n.rMax=S)}n.samples.length&&m.push(n)}if(!m.length)return null;m.sort((t,n)=>t.rMin+t.rMax-(n.rMin+n.rMax));let d=[];for(let t of m){let n=!1;for(let o of d){let B=Math.min(t.rMax,o.rMax)-Math.max(t.rMin,o.rMin),S=Math.min(t.rMax-t.rMin,o.rMax-o.rMin);if(S>1e-9&&B>=an*S){o.members.push(t),o.rMin=Math.min(o.rMin,t.rMin),o.rMax=Math.max(o.rMax,t.rMax),n=!0;break}}n||d.push({members:[t],rMin:t.rMin,rMax:t.rMax})}let y=[];for(let t of d){let n=new Array(h).fill(null);for(let r of t.members)for(let p of r.samples){let x=n[p.bin];x||(x={samples:[]},n[p.bin]=x),x.samples.push({r:p.r,levelM:p.levelM})}let o=n.map(r=>!!r);if(!o.filter(Boolean).length)continue;let S=[],D=[];for(let r of n){if(!r)continue;let p=1/0,x=-1/0;for(let A of r.samples)A.r<p&&(p=A.r),A.r>x&&(x=A.r);S.push(p),D.push(x)}let j=z(S),F=z(D);if(!(j>=$*F)||!(F>0))continue;let W=[...S].sort((r,p)=>r-p);if(!(W[Math.floor(W.length*.1)]>=$*F))continue;let V=n.map(r=>{if(!r)return null;let p=[...r.samples].sort((w,k)=>w.r-k.r),x=p[0].r,A=p[p.length-1].r,P=p[0].levelM,N=-1/0;for(let w of p)w.levelM>N&&(N=w.levelM);let M=[];for(let w of p){let k={r:w.r,l:w.levelM};for(;M.length&&Math.abs(M[M.length-1].r-k.r)<1e-9;){if(M[M.length-1].l<=k.l){k.skip=!0;break}M.pop()}if(!k.skip){for(;M.length>=2;){let L=M[M.length-2],v=M[M.length-1];if((v.r-L.r)*(k.l-L.l)-(v.l-L.l)*(k.r-L.r)<=0)M.pop();else break}M.push(k)}}let C=M.map(w=>w.r),_=M.map(w=>w.l);return{inner:x,outer:A,front:P,top:N,profile:{rs:C,ls:_}}}),O=o.slice();for(let r=0;r<h;r++){if(O[r])continue;let p=-1,x=-1,A=0;for(let s=1;s<=h;s++){let g=(r-s+h*2)%h;if(O[g]){p=g;break}}for(let s=1;s<=h;s++){let g=(r+s)%h;if(O[g]){x=g,A=s;break}}if(p<0||x<0)continue;let P=0;for(let s=1;s<=h;s++){let g=(r-s+h*2)%h;if(o[g]){P=s;break}}if(P-1+A>sn)continue;let M=V[p],C=V[x],_=P/(P+A),w=M.inner+(C.inner-M.inner)*_,k=M.outer+(C.outer-M.outer)*_,L=M.front+(C.front-M.front)*_,v=M.top+(C.top-M.top)*_;V[r]={inner:w,outer:k,front:L,top:v,profile:{rs:[w,k],ls:[L,v]}}}for(let r=0;r<h;r++)V[r]&&(O[r]=!0);let X=360/h,K=[],q=O.filter(Boolean).length,Q=[];if(q===h)Q.push({start:0,len:h});else{let r=0;for(;O[r];)r=(r+1)%h;let p=-1;for(let x=0;x<=h;x++){let A=(r+x)%h,P=x<h&&O[A];if(P&&p<0)p=A;else if(!P&&p>=0){let N=(A-p+h)%h||h;Q.push({start:p,len:N}),p=-1}}}for(let r of Q){if(r.len*X<ln&&r.len<h)continue;let p=r.len===h,x=new Float64Array(r.len),A=new Float64Array(r.len),P=new Float64Array(r.len),N=new Float64Array(r.len),M=[];for(let s=0;s<r.len;s++){let g=V[(r.start+s)%h];x[s]=g.inner,A[s]=g.outer,P[s]=g.front,N[s]=g.top,M.push(g.profile??{rs:[g.inner,g.outer],ls:[g.front,g.top]})}let C=J(x,p),_=J(A,p),w=J(P,p),k=J(N,p);for(let s=0;s<r.len;s++)C[s]>x[s]&&(C[s]=x[s]),_[s]<A[s]&&(_[s]=A[s]),C[s]>_[s]-1e-6&&(C[s]=Math.max(0,_[s]-1e-6)),k[s]<w[s]&&(k[s]=w[s]);let L={startBin:r.start,binCount:r.len,closed:p,innerR:C,outerR:_,frontLevelM:w,topLevelM:k,profiles:M},v=(s,g,I)=>{let H=M[s],T=H.rs,E=H.ls;if(g<=T[0]){E[0]>I&&(E[0]=I);return}if(g>=T[T.length-1]){E[E.length-1]>I&&(E[E.length-1]=I);return}for(let G=0;G+1<T.length;G++)if(g<=T[G+1]){E[G]>I&&(E[G]=I),E[G+1]>I&&(E[G+1]=I);return}};for(let s=0;s<r.len;s++){let g=n[(r.start+s)%h];if(g)for(let I of g.samples){v(s,I.r,I.levelM);let H=p?(s-1+r.len)%r.len:s-1,T=p?(s+1)%r.len:s+1;H>=0&&v(H,I.r,I.levelM),T<r.len&&v(T,I.r,I.levelM)}}K.push(L)}K.reduce((r,p)=>r+p.binCount*X,0)<cn||y.push({arcs:K,sectionIds:t.members.map(r=>r.sectionId),innerRMedian:j,outerRMedian:F})}if(!y.length)return null;if(y.sort((t,n)=>t.innerRMedian-n.innerRMedian),l){let t=y[y.length-1].outerRMedian;if(Math.hypot(l.x-b.x,l.y-b.y)>.9*t)return null}return{centre:b,binCount:h,binStepDeg:360/h,rings:y}}function dn(c,l,a,e){let f=c.binStepDeg,i=a/f-.5-l.startBin;i=(i%c.binCount+c.binCount)%c.binCount,i>l.binCount-1&&(l.closed?i=i-l.binCount<l.binCount-i?0:l.binCount-1:i=i-(l.binCount-1)<c.binCount-i?l.binCount-1:0);let u=Math.floor(i),R=l.closed?(u+1)%l.binCount:Math.min(l.binCount-1,u+1),b=i-u,m=d=>{let y=l.profiles[d],t=y.rs,n=y.ls;if(e<=t[0])return n[0];if(e>=t[t.length-1])return n[n.length-1];for(let o=0;o+1<t.length;o++)if(e<=t[o+1]){let B=t[o+1]-t[o],S=B>1e-9?(e-t[o])/B:0;return n[o]+(n[o+1]-n[o])*S}return n[n.length-1]};return m(u)*(1-b)+m(R)*b}export{bn as a,fn as b,hn as c,dn as d};
1
+ import{ua as Y}from"./chunk-24O23MNB.js";function nn(c){return{kind:"radial",rowCount:0,rows:[],nearestRow:()=>-1,depthAt:(l,a)=>Math.hypot(l-c.x,a-c.y),gradientAt:(l,a)=>{let e=l-c.x,f=a-c.y,i=Math.hypot(e,f);return i<1e-9?[0,0]:[e/i,f/i]}}}function tn(c,l){if(!c.length)return null;let a=0,e=0,f=0;for(let n of c)a+=n.x,e+=n.y,f+=Math.hypot(n.x-l.x,n.y-l.y);let i=c.length;a/=i,e/=i,f/=i;let u=c[0],R=-1;for(let n of c){let o=Math.hypot(n.x-a,n.y-e);o>R&&(R=o,u=n)}let b=u.x-a,m=u.y-e,d=Math.hypot(b,m);d>1e-9?(b/=d,m/=d):(b=1,m=0);let y=[...c].sort((n,o)=>(n.x-a)*b+(n.y-e)*m-((o.x-a)*b+(o.y-e)*m)),t=0;for(let n of y){let o=Math.hypot(n.x-a,n.y-e);o>t&&(t=o)}return{pts:y,cx:a,cy:e,radius:t,depth:f}}function Z(c,l,a){let e=c.pts;if(e.length===1)return Math.hypot(l-e[0].x,a-e[0].y);let f=1/0;for(let i=0;i+1<e.length;i++){let u=e[i],R=e[i+1],b=R.x-u.x,m=R.y-u.y,d=b*b+m*m,y=d>1e-12?((l-u.x)*b+(a-u.y)*m)/d:0;y<0?y=0:y>1&&(y=1);let t=Math.hypot(l-(u.x+y*b),a-(u.y+y*m));t<f&&(f=t)}return f}var U=8;function en(c,l,a){let e=new Array(U).fill(1/0),f=new Array(U).fill(-1);for(let d=0;d<c.length;d++){let y=c[d],t=Math.hypot(l-y.cx,a-y.cy)-y.radius;for(let n=0;n<U;n++)if(t<e[n]){for(let o=U-1;o>n;o--)e[o]=e[o-1],f[o]=f[o-1];e[n]=t,f[n]=d;break}}let i=new Array(3).fill(1/0),u=new Array(3).fill(-1);for(let d of f){if(d<0)continue;let y=Z(c[d],l,a);for(let t=0;t<3;t++)if(y<i[t]){for(let n=2;n>t;n--)i[n]=i[n-1],u[n]=u[n-1];i[t]=y,u[t]=d;break}}if(u[0]<0)return 0;if(i[0]<1e-6)return c[u[0]].depth;let R=i[0]*2.2,b=0,m=0;for(let d=0;d<3;d++){let y=u[d];if(y<0||i[d]>R)continue;let t=1/(i[d]*i[d]);b+=t*c[y].depth,m+=t}return m>0?b/m:c[u[0]].depth}function on(c){let l=(e,f)=>en(c,e,f),a=(e,f)=>{let i=1/0,u=-1;for(let R=0;R<c.length;R++){let b=c[R];if(Math.hypot(e-b.cx,f-b.cy)-b.radius>=i)continue;let m=Z(b,e,f);m<i&&(i=m,u=R)}return u};return{kind:"rows",rowCount:c.length,rows:c,nearestRow:a,depthAt:l,gradientAt:(e,f)=>{let i=(l(e+.5,f)-l(e-.5,f))/1,u=(l(e,f+.5)-l(e,f-.5))/(2*.5),R=Math.hypot(i,u);return R<1e-9?[0,0]:[i/R,u/R]}}}function bn(c,l){let a=[];for(let e of c){let f=tn(e.points,l);f&&a.push(f)}return a.length<2?nn(l):(a.sort((e,f)=>e.depth-f.depth),on(a))}var rn=Math.PI/180,h=96,sn=6,ln=60,cn=150,$=.2,an=.35;function fn(c,l){let a=Math.atan2(l.x-c.x,l.y-c.y)/rn;return a<0?a+360:a}function z(c){if(!c.length)return NaN;let l=[...c].sort((a,e)=>a-e);return l[Math.floor(l.length/2)]}function J(c,l,a=2){let e=c.length,f=new Float64Array(e);for(let i=0;i<e;i++){let u=0,R=0;for(let b=-a;b<=a;b++){let m=i+b;if(l)m=(m%e+e)%e;else if(m<0||m>=e)continue;u+=c[m],R++}f[i]=u/R}return f}function hn(c,l){let a=c.filter(t=>t.rows.length>=1);if(a.length<1)return null;let e=[],f=0,i=0,u=0;for(let t of a)for(let n of t.rows){for(let o of n.pts)f+=o.x,i+=o.y,u++;if(n.pts.length>=4){let o=Y(n.pts);o&&Number.isFinite(o.cx)&&Number.isFinite(o.cy)&&e.push({x:o.cx,y:o.cy})}}if(!u)return null;let R={x:f/u,y:i/u},b=R;if(e.length>=8){let t=z(e.map(D=>D.x)),n=z(e.map(D=>D.y)),o=0;for(let D of a)for(let j of D.rows)for(let F of j.pts){let W=Math.hypot(F.x-R.x,F.y-R.y);W>o&&(o=W)}let B=0,S=o*.2;for(let D of a)for(let j of D.rows)for(let F of j.pts)Math.hypot(F.x-t,F.y-n)<S&&B++;Math.hypot(t-R.x,n-R.y)<=o&&B/u<.01&&(b={x:t,y:n})}let m=[];for(let t of a){let n={sectionId:t.sectionId,rMin:1/0,rMax:-1/0,samples:[]};for(let o of t.rows)for(let B of o.pts){let S=Math.hypot(B.x-b.x,B.y-b.y),D=Math.min(h-1,Math.floor(fn(b,B)/(360/h)));n.samples.push({r:S,bin:D,levelM:o.levelM}),S<n.rMin&&(n.rMin=S),S>n.rMax&&(n.rMax=S)}n.samples.length&&m.push(n)}if(!m.length)return null;m.sort((t,n)=>t.rMin+t.rMax-(n.rMin+n.rMax));let d=[];for(let t of m){let n=!1;for(let o of d){let B=Math.min(t.rMax,o.rMax)-Math.max(t.rMin,o.rMin),S=Math.min(t.rMax-t.rMin,o.rMax-o.rMin);if(S>1e-9&&B>=an*S){o.members.push(t),o.rMin=Math.min(o.rMin,t.rMin),o.rMax=Math.max(o.rMax,t.rMax),n=!0;break}}n||d.push({members:[t],rMin:t.rMin,rMax:t.rMax})}let y=[];for(let t of d){let n=new Array(h).fill(null);for(let r of t.members)for(let p of r.samples){let x=n[p.bin];x||(x={samples:[]},n[p.bin]=x),x.samples.push({r:p.r,levelM:p.levelM})}let o=n.map(r=>!!r);if(!o.filter(Boolean).length)continue;let S=[],D=[];for(let r of n){if(!r)continue;let p=1/0,x=-1/0;for(let A of r.samples)A.r<p&&(p=A.r),A.r>x&&(x=A.r);S.push(p),D.push(x)}let j=z(S),F=z(D);if(!(j>=$*F)||!(F>0))continue;let W=[...S].sort((r,p)=>r-p);if(!(W[Math.floor(W.length*.1)]>=$*F))continue;let V=n.map(r=>{if(!r)return null;let p=[...r.samples].sort((w,k)=>w.r-k.r),x=p[0].r,A=p[p.length-1].r,P=p[0].levelM,N=-1/0;for(let w of p)w.levelM>N&&(N=w.levelM);let M=[];for(let w of p){let k={r:w.r,l:w.levelM};for(;M.length&&Math.abs(M[M.length-1].r-k.r)<1e-9;){if(M[M.length-1].l<=k.l){k.skip=!0;break}M.pop()}if(!k.skip){for(;M.length>=2;){let L=M[M.length-2],v=M[M.length-1];if((v.r-L.r)*(k.l-L.l)-(v.l-L.l)*(k.r-L.r)<=0)M.pop();else break}M.push(k)}}let C=M.map(w=>w.r),_=M.map(w=>w.l);return{inner:x,outer:A,front:P,top:N,profile:{rs:C,ls:_}}}),O=o.slice();for(let r=0;r<h;r++){if(O[r])continue;let p=-1,x=-1,A=0;for(let s=1;s<=h;s++){let g=(r-s+h*2)%h;if(O[g]){p=g;break}}for(let s=1;s<=h;s++){let g=(r+s)%h;if(O[g]){x=g,A=s;break}}if(p<0||x<0)continue;let P=0;for(let s=1;s<=h;s++){let g=(r-s+h*2)%h;if(o[g]){P=s;break}}if(P-1+A>sn)continue;let M=V[p],C=V[x],_=P/(P+A),w=M.inner+(C.inner-M.inner)*_,k=M.outer+(C.outer-M.outer)*_,L=M.front+(C.front-M.front)*_,v=M.top+(C.top-M.top)*_;V[r]={inner:w,outer:k,front:L,top:v,profile:{rs:[w,k],ls:[L,v]}}}for(let r=0;r<h;r++)V[r]&&(O[r]=!0);let X=360/h,K=[],q=O.filter(Boolean).length,Q=[];if(q===h)Q.push({start:0,len:h});else{let r=0;for(;O[r];)r=(r+1)%h;let p=-1;for(let x=0;x<=h;x++){let A=(r+x)%h,P=x<h&&O[A];if(P&&p<0)p=A;else if(!P&&p>=0){let N=(A-p+h)%h||h;Q.push({start:p,len:N}),p=-1}}}for(let r of Q){if(r.len*X<ln&&r.len<h)continue;let p=r.len===h,x=new Float64Array(r.len),A=new Float64Array(r.len),P=new Float64Array(r.len),N=new Float64Array(r.len),M=[];for(let s=0;s<r.len;s++){let g=V[(r.start+s)%h];x[s]=g.inner,A[s]=g.outer,P[s]=g.front,N[s]=g.top,M.push(g.profile??{rs:[g.inner,g.outer],ls:[g.front,g.top]})}let C=J(x,p),_=J(A,p),w=J(P,p),k=J(N,p);for(let s=0;s<r.len;s++)C[s]>x[s]&&(C[s]=x[s]),_[s]<A[s]&&(_[s]=A[s]),C[s]>_[s]-1e-6&&(C[s]=Math.max(0,_[s]-1e-6)),k[s]<w[s]&&(k[s]=w[s]);let L={startBin:r.start,binCount:r.len,closed:p,innerR:C,outerR:_,frontLevelM:w,topLevelM:k,profiles:M},v=(s,g,I)=>{let H=M[s],T=H.rs,E=H.ls;if(g<=T[0]){E[0]>I&&(E[0]=I);return}if(g>=T[T.length-1]){E[E.length-1]>I&&(E[E.length-1]=I);return}for(let G=0;G+1<T.length;G++)if(g<=T[G+1]){E[G]>I&&(E[G]=I),E[G+1]>I&&(E[G+1]=I);return}};for(let s=0;s<r.len;s++){let g=n[(r.start+s)%h];if(g)for(let I of g.samples){v(s,I.r,I.levelM);let H=p?(s-1+r.len)%r.len:s-1,T=p?(s+1)%r.len:s+1;H>=0&&v(H,I.r,I.levelM),T<r.len&&v(T,I.r,I.levelM)}}K.push(L)}K.reduce((r,p)=>r+p.binCount*X,0)<cn||y.push({arcs:K,sectionIds:t.members.map(r=>r.sectionId),innerRMedian:j,outerRMedian:F})}if(!y.length)return null;if(y.sort((t,n)=>t.innerRMedian-n.innerRMedian),l){let t=y[y.length-1].outerRMedian;if(Math.hypot(l.x-b.x,l.y-b.y)>.9*t)return null}return{centre:b,binCount:h,binStepDeg:360/h,rings:y}}function dn(c,l,a,e){let f=c.binStepDeg,i=a/f-.5-l.startBin;i=(i%c.binCount+c.binCount)%c.binCount,i>l.binCount-1&&(l.closed?i=i-l.binCount<l.binCount-i?0:l.binCount-1:i=i-(l.binCount-1)<c.binCount-i?l.binCount-1:0);let u=Math.floor(i),R=l.closed?(u+1)%l.binCount:Math.min(l.binCount-1,u+1),b=i-u,m=d=>{let y=l.profiles[d],t=y.rs,n=y.ls;if(e<=t[0])return n[0];if(e>=t[t.length-1])return n[n.length-1];for(let o=0;o+1<t.length;o++)if(e<=t[o+1]){let B=t[o+1]-t[o],S=B>1e-9?(e-t[o])/B:0;return n[o]+(n[o+1]-n[o])*S}return n[n.length-1]};return m(u)*(1-b)+m(R)*b}export{bn as a,fn as b,hn as c,dn as d};
@@ -1 +1 @@
1
- import{Fa as b,Ja as p,Ka as h,Pa as I,Sa as d}from"./chunk-QUOAQQMP.js";var m="__sl_ga__",f=1e5,v=1e5;function j(t,e){return`${m}${encodeURIComponent(t)}__${e+1}`}function S(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>f||(r+=o.count,r>f))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(f,Math.max(0,Math.floor(t.capacity)));return t.inventorySegments===void 0?e?[{sourceAreaId:t.id,startIndex:0,count:e}]:[]:S(t)?t.inventorySegments.map(r=>({...r})):[]}function y(t){return A(t).flatMap(e=>Array.from({length:e.count},(r,i)=>j(e.sourceAreaId,e.startIndex+i)))}function M(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 R(t){return d(t).filter(e=>e.type==="gaArea")}function N(t){return t.startsWith(m)}var g="__ungrouped__";function x(t){return t.type==="row"?b(t).map(e=>e.label):t.type==="table"?p(t).map(e=>e.label):t.type==="booth"?h(t).map(e=>e.label):t.type==="gaArea"?y(t):[]}function O(t){return t.type==="row"||t.type==="table"||t.type==="booth"||t.type==="gaArea"}function _(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:g,label:"Other seats",seatCount:0,objectIds:[],seatLabels:[]},u=new Map;for(let n of e){if(!O(n))continue;let s=x(n);if(s.length===0)continue;let a=I(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 C(t,e){return e.has(t.id)||!!t.logicalSectionId&&e.has(t.logicalSectionId)||!!t.zone&&e.has(t.zone)}function G(t,e){let r=new Set;if(!e.size)return r;let{sections:i,ungrouped:o,objectToSection:u}=_(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(g);for(let[c,l]of u)(n.has(l)||a&&l===g)&&r.add(c);return r}function U(t,e){if(!e.size)return t;let r=G(t,e),i=e instanceof Set?e:new Set(e),o=n=>!(r.has(n.id)||n.type==="section"&&C(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,v as b,j as c,S as d,A as e,y as f,M as g,R as h,N as i,g as j,_ as k,C as l,G as m,U as n};
1
+ import{Ga as b,Ka as p,La as h,Qa as I,Ta as d}from"./chunk-24O23MNB.js";var m="__sl_ga__",f=1e5,v=1e5;function j(t,e){return`${m}${encodeURIComponent(t)}__${e+1}`}function S(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>f||(r+=o.count,r>f))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(f,Math.max(0,Math.floor(t.capacity)));return t.inventorySegments===void 0?e?[{sourceAreaId:t.id,startIndex:0,count:e}]:[]:S(t)?t.inventorySegments.map(r=>({...r})):[]}function y(t){return A(t).flatMap(e=>Array.from({length:e.count},(r,i)=>j(e.sourceAreaId,e.startIndex+i)))}function M(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 R(t){return d(t).filter(e=>e.type==="gaArea")}function N(t){return t.startsWith(m)}var g="__ungrouped__";function x(t){return t.type==="row"?b(t).map(e=>e.label):t.type==="table"?p(t).map(e=>e.label):t.type==="booth"?h(t).map(e=>e.label):t.type==="gaArea"?y(t):[]}function O(t){return t.type==="row"||t.type==="table"||t.type==="booth"||t.type==="gaArea"}function _(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:g,label:"Other seats",seatCount:0,objectIds:[],seatLabels:[]},u=new Map;for(let n of e){if(!O(n))continue;let s=x(n);if(s.length===0)continue;let a=I(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 C(t,e){return e.has(t.id)||!!t.logicalSectionId&&e.has(t.logicalSectionId)||!!t.zone&&e.has(t.zone)}function G(t,e){let r=new Set;if(!e.size)return r;let{sections:i,ungrouped:o,objectToSection:u}=_(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(g);for(let[c,l]of u)(n.has(l)||a&&l===g)&&r.add(c);return r}function U(t,e){if(!e.size)return t;let r=G(t,e),i=e instanceof Set?e:new Set(e),o=n=>!(r.has(n.id)||n.type==="section"&&C(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,v as b,j as c,S as d,A as e,y as f,M as g,R as h,N as i,g as j,_ as k,C as l,G as m,U as n};
@@ -1 +1 @@
1
- import{I as c}from"./chunk-QUOAQQMP.js";var l=72;var w="seatmap.chart";var d=[{key:"wheelchair",label:"Wheelchair space",short:"Wheelchair",icon:"\u267F"},{key:"companion",label:"Companion seat",short:"Companion",icon:"\u{1F9D1}\u200D\u{1F91D}\u200D\u{1F9D1}"},{key:"semi-ambulatory",label:"Semi-ambulatory (limited mobility)",short:"Limited mobility",icon:"\u{1F9AF}"},{key:"designated-aisle",label:"Designated aisle / transfer seat",short:"Aisle transfer",icon:"AS"},{key:"step-free",label:"Step-free accessible seat",short:"Step-free",icon:"SF"},{key:"hearing",label:"Assistive listening",short:"Hearing",icon:"\u{1F9BB}"},{key:"cart",label:"CART live-caption view",short:"CART captions",icon:"CC"},{key:"sign-language",label:"Sign-language view",short:"Sign language",icon:"\u{1F91F}"},{key:"low-vision",label:"Blind / low-vision viewing",short:"Low vision",icon:"LV"},{key:"sensory-friendly",label:"Quiet / sensory-friendly seating",short:"Sensory-friendly",icon:"QS"},{key:"plus-size",label:"Plus-size seat",short:"Plus-size",icon:"\u{1F4BA}"},{key:"lift-armrest",label:"Lift-up armrest",short:"Lift armrest",icon:"\u2195\uFE0F"}],u=new Map(d.map(e=>[e.key,e]));function I(e){return u.get(e)}var b={wheelchair:"#3b82f6",companion:"#8b5cf6","semi-ambulatory":"#0ea5e9","designated-aisle":"#0284c7","step-free":"#16a34a",hearing:"#14b8a6",cart:"#7c3aed","sign-language":"#f59e0b","low-vision":"#d97706","sensory-friendly":"#6366f1","plus-size":"#ec4899","lift-armrest":"#22c55e"};function A(e){let t=e?.[0];return t&&b[t]||"#3b82f6"}var g=[{key:"obstructedView",label:"Obstructed view",short:"Obstructed",icon:"\u26D4"},{key:"restrictedView",label:"Restricted view",short:"Restricted",icon:"\u{1F441}"},{key:"premium",label:"Premium seat",short:"Premium",icon:"\u2605"}],m=new Map(g.map(e=>[e.key,e]));function k(e){return m.get(e)}var L=8,E=24,p=["reference-focal","bar","entrance","exit","restroom","screen","sound","concession","coat","wall","rail","suite","obstruction"],y=new Set(p);function P(e){switch(e.type){case"row":case"table":case"gaArea":case"booth":case"section":return"interactive";case"decorImage":return e.layer==="foreground"?"foreground":"background";case"shape":return e.role&&y.has(e.role)?"surroundings":"background";case"text":return"background";default:return"interactive"}}function S(e){let t=0;for(let r=0,i=e.length;r<i;r+=1){let o=e[r],a=e[(r+1)%i];t+=o.x*a.y-a.x*o.y}return t/2}function V(e){return S(e)*2}function Y(e,t,r){let i=!1;for(let o=0,a=e.length-1;o<e.length;a=o++){let n=e[o],s=e[a];n.y>r!=s.y>r&&t<(s.x-n.x)*(r-n.y)/(s.y-n.y)+n.x&&(i=!i)}return i}var f=.15,v=1.6;function X(e){return c(e??1,f,v)}function h(e){let t=1/0,r=1/0,i=-1/0,o=-1/0,a=!1;for(let n of e)!Number.isFinite(n.x)||!Number.isFinite(n.y)||(a=!0,n.x<t&&(t=n.x),n.y<r&&(r=n.y),n.x>i&&(i=n.x),n.y>o&&(o=n.y));return a?{minX:t,minY:r,maxX:i,maxY:o}:null}function K(e){let t=h(e);return t?x(t):null}function x(e){return{x:e.minX,y:e.minY,width:e.maxX-e.minX,height:e.maxY-e.minY}}function H(e,t){return e.minX<=t.maxX&&t.minX<=e.maxX&&e.minY<=t.maxY&&t.minY<=e.maxY}export{l as a,w as b,d as c,I as d,b as e,A as f,g,k as h,L as i,E as j,p as k,P as l,h as m,K as n,H as o,S as p,V as q,Y as r,f as s,v as t,X as u};
1
+ import{I as c}from"./chunk-24O23MNB.js";var l=72;var w="seatmap.chart";var d=[{key:"wheelchair",label:"Wheelchair space",short:"Wheelchair",icon:"\u267F"},{key:"companion",label:"Companion seat",short:"Companion",icon:"\u{1F9D1}\u200D\u{1F91D}\u200D\u{1F9D1}"},{key:"semi-ambulatory",label:"Semi-ambulatory (limited mobility)",short:"Limited mobility",icon:"\u{1F9AF}"},{key:"designated-aisle",label:"Designated aisle / transfer seat",short:"Aisle transfer",icon:"AS"},{key:"step-free",label:"Step-free accessible seat",short:"Step-free",icon:"SF"},{key:"hearing",label:"Assistive listening",short:"Hearing",icon:"\u{1F9BB}"},{key:"cart",label:"CART live-caption view",short:"CART captions",icon:"CC"},{key:"sign-language",label:"Sign-language view",short:"Sign language",icon:"\u{1F91F}"},{key:"low-vision",label:"Blind / low-vision viewing",short:"Low vision",icon:"LV"},{key:"sensory-friendly",label:"Quiet / sensory-friendly seating",short:"Sensory-friendly",icon:"QS"},{key:"plus-size",label:"Plus-size seat",short:"Plus-size",icon:"\u{1F4BA}"},{key:"lift-armrest",label:"Lift-up armrest",short:"Lift armrest",icon:"\u2195\uFE0F"}],u=new Map(d.map(e=>[e.key,e]));function I(e){return u.get(e)}var b={wheelchair:"#3b82f6",companion:"#8b5cf6","semi-ambulatory":"#0ea5e9","designated-aisle":"#0284c7","step-free":"#16a34a",hearing:"#14b8a6",cart:"#7c3aed","sign-language":"#f59e0b","low-vision":"#d97706","sensory-friendly":"#6366f1","plus-size":"#ec4899","lift-armrest":"#22c55e"};function A(e){let t=e?.[0];return t&&b[t]||"#3b82f6"}var g=[{key:"obstructedView",label:"Obstructed view",short:"Obstructed",icon:"\u26D4"},{key:"restrictedView",label:"Restricted view",short:"Restricted",icon:"\u{1F441}"},{key:"premium",label:"Premium seat",short:"Premium",icon:"\u2605"}],m=new Map(g.map(e=>[e.key,e]));function k(e){return m.get(e)}var L=8,E=24,p=["reference-focal","bar","entrance","exit","restroom","screen","sound","concession","coat","wall","rail","suite","obstruction"],y=new Set(p);function P(e){switch(e.type){case"row":case"table":case"gaArea":case"booth":case"section":return"interactive";case"decorImage":return e.layer==="foreground"?"foreground":"background";case"shape":return e.role&&y.has(e.role)?"surroundings":"background";case"text":return"background";default:return"interactive"}}function S(e){let t=0;for(let r=0,i=e.length;r<i;r+=1){let o=e[r],a=e[(r+1)%i];t+=o.x*a.y-a.x*o.y}return t/2}function V(e){return S(e)*2}function Y(e,t,r){let i=!1;for(let o=0,a=e.length-1;o<e.length;a=o++){let n=e[o],s=e[a];n.y>r!=s.y>r&&t<(s.x-n.x)*(r-n.y)/(s.y-n.y)+n.x&&(i=!i)}return i}var f=.15,v=1.6;function X(e){return c(e??1,f,v)}function h(e){let t=1/0,r=1/0,i=-1/0,o=-1/0,a=!1;for(let n of e)!Number.isFinite(n.x)||!Number.isFinite(n.y)||(a=!0,n.x<t&&(t=n.x),n.y<r&&(r=n.y),n.x>i&&(i=n.x),n.y>o&&(o=n.y));return a?{minX:t,minY:r,maxX:i,maxY:o}:null}function K(e){let t=h(e);return t?x(t):null}function x(e){return{x:e.minX,y:e.minY,width:e.maxX-e.minX,height:e.maxY-e.minY}}function H(e,t){return e.minX<=t.maxX&&t.minX<=e.maxX&&e.minY<=t.maxY&&t.minY<=e.maxY}export{l as a,w as b,d as c,I as d,b as e,A as f,g,k as h,L as i,E as j,p as k,P as l,h as m,K as n,H as o,S as p,V as q,Y as r,f as s,v as t,X as u};
@@ -1 +1 @@
1
- import{c,k as A,n as T}from"./chunk-JBOTRSMY.js";var d=7,B=10,N=10,R=15,k=11,y=.85,E=12,M=4.5,x=3,l="#000000",u="#ffffff",Z=24,g=18.67;function G(t,L=400){return t>=Z||L>=700&&t>=g?x:M}function H(t,L){return t*L>=E}var P=24,m={wheelchair:"M7.8 4.5a2.2 2.2 0 1 0 4.4 0a2.2 2.2 0 1 0 -4.4 0zM8 7L10.5 7L10.5 15L8 15ZM8 12.5L18 12.5L18 15L8 15ZM16 15L18 15L18 18L16 18ZM5.5 16a5.5 5.5 0 1 0 11 0a5.5 5.5 0 1 0 -11 0zM8 16a3 3 0 1 1 6 0a3 3 0 1 1 -6 0z",companion:"M5.5 6.5a3 3 0 1 0 6 0a3 3 0 1 0 -6 0zM4.5 18.5L6 11.5L11 11.5L12.5 18.5ZM12.5 7.5a3 3 0 1 0 6 0a3 3 0 1 0 -6 0zM11.5 19L13 12.5L18 12.5L19.5 19Z","semi-ambulatory":"M8.3 3.8a2.2 2.2 0 1 0 4.4 0a2.2 2.2 0 1 0 -4.4 0zM9 6.2L12 6.6L11 13.5L8.6 13L9 6.2ZM8.6 13L11 13L9.5 21L7 21ZM10.4 13L12.6 13L13.6 21L11.2 21ZM11.2 7.2L14 8L14.6 9.6L11.9 8.9ZM14.4 6.8L15.9 6.8L16.4 21L14.8 21Z","designated-aisle":"M3 5L6 5L6 14L3 14ZM3 12L13 12L13 15L3 15ZM5 15L7 15L7 20L5 20ZM11 15L13 15L13 20L11 20ZM13 7L20 7L17 4L19 4L23 8.5L19 13L17 13L20 10L13 10Z","step-free":"M4 4.5a2.2 2.2 0 1 0 4.4 0a2.2 2.2 0 1 0 -4.4 0zM4.4 7L7.5 7L7.5 13L11 15L9.5 17L5 14L4.4 7ZM2 19L8 19L17 10L22 10L22 13L18 13L10 21L2 21Z",hearing:"M15.5 3.5C9 2.2 5.5 6 5.5 11.5C5.5 16 8 19.5 10.5 21C13.2 22.6 16.4 20.8 15.4 18C14.8 16.4 12.9 16.1 13 14C13.1 11.9 15.8 11.4 15.8 8.5C15.8 5.4 13 4 15.5 3.5Z",cart:"M5.5 6L18.5 6a2.5 2.5 0 0 1 2.5 2.5L21 15.5a2.5 2.5 0 0 1 -2.5 2.5L11 18L7 20.5L7.5 18L5.5 18a2.5 2.5 0 0 1 -2.5 -2.5L3 8.5a2.5 2.5 0 0 1 2.5 -2.5zM6.5 11L17.5 11L17.5 12.6L6.5 12.6zM6.5 14L17.5 14L17.5 15.6L6.5 15.6z","sign-language":"M7 11L17 11L17 18a2 2 0 0 1 -2 2L9 20a2 2 0 0 1 -2 -2zM7.6 5L9.4 5L9.4 12L7.6 12zM9.9 3.5L11.7 3.5L11.7 12L9.9 12zM12.3 3.5L14.1 3.5L14.1 12L12.3 12zM14.6 5L16.4 5L16.4 12L14.6 12zM7.2 12.5L5 10.2L6.4 8.9L8.6 11.2Z","low-vision":"M2.5 12C6 6 18 6 21.5 12C18 18 6 18 2.5 12ZM9 12a3 3 0 1 0 6 0a3 3 0 1 0 -6 0zM17.5 3L19 3L19 6L17.5 6ZM19 4L22 4L22 5.5L19 5.5Z","sensory-friendly":"M4 11C4 5 7 2.5 12 2.5S20 5 20 11L17 11C17 7 15.5 5.5 12 5.5S7 7 7 11ZM3 10L8 10L8 19L5 19a2 2 0 0 1 -2 -2ZM16 10L21 10L21 17a2 2 0 0 1 -2 2L16 19ZM9 12L15 12L15 14L9 14ZM10 16L14 16L14 18L10 18Z","plus-size":"M9.4 4.3a2.6 2.6 0 1 0 5.2 0a2.6 2.6 0 1 0 -5.2 0zM5 20L4 13C4 10.5 7 9.5 12 9.5C17 9.5 20 10.5 20 13L19 20Z","lift-armrest":"M5 6L8 6L8 19L5 19zM5 16L18 16L18 19L5 19zM8 12L17 12L17 14.5L8 14.5zM14 7L16 7L16 12L14 12zM12 7L18 7L15 3Z"},v=m.wheelchair;function w(t){if(!t?.length)return null;let L=t.includes("wheelchair")?"wheelchair":t[0];return m[L]??null}function F(t){return/-(\d{1,5})$/.exec(t)?.[1]??t}var a=T;function X(t,L,r){let n=c(t),o=c(L);if(!n||!o)return L;let e=Math.max(0,Math.min(1,r));return`#${n.map((s,_)=>Math.round(s*e+o[_]*(1-e))).map(s=>s.toString(16).padStart(2,"0")).join("")}`}var K=3;function I(t,L,r=M){let n=a(L,t);if(n!=null&&n>=r)return L;let o=a(l,t)??0,e=a(u,t)??0;return o===0&&e===0?L:o>=e?l:u}var S=3;function Y(t){let L=a("#ffffff",t);if(L!=null&&L>=S)return"#ffffff";let r=a(l,t)??0,n=a(u,t)??0;return r===0&&n===0?"#ffffff":r>=n?l:u}var C=/^#[0-9a-f]{6}$/i;function O(t){let L=c(t);return L!=null&&A(L)>.5}var b="#e5e7eb",h="#273142";function D(t){return O(t)?b:h}function U(t,L,r=M){let n=C.test(t.trim()),o=t.trim().toLowerCase(),e=0,i=0,s=null;for(let p of L){if(!n||!C.test(p.trim()))continue;e+=1;let f=I(p,t,r);f.toLowerCase()!==o&&(i+=1,s=f)}return{total:e,overridden:i,status:e===0?"none":i===0?"applies":i===e?"overridden":"mixed",overrideInk:s}}export{d as a,B as b,N as c,R as d,k as e,y as f,E as g,M as h,x as i,l as j,u as k,G as l,H as m,P as n,m as o,v as p,w as q,F as r,a as s,X as t,K as u,I as v,Y as w,O as x,b as y,h as z,D as A,U as B};
1
+ import{c,k as A,n as T}from"./chunk-JBOTRSMY.js";var z=7,B=10,N=10,R=15,k=11,y=.85,E=12,M=4.5,g=3,l="#000000",u="#ffffff",Z=24,I=18.67;function G(t,L=400){return t>=Z||L>=700&&t>=I?g:M}function H(t,L){return t*L>=E}var P=24,x={wheelchair:"M7.8 4.5a2.2 2.2 0 1 0 4.4 0a2.2 2.2 0 1 0 -4.4 0zM8 7L10.5 7L10.5 15L8 15ZM8 12.5L18 12.5L18 15L8 15ZM16 15L18 15L18 18L16 18ZM5.5 16a5.5 5.5 0 1 0 11 0a5.5 5.5 0 1 0 -11 0zM8 16a3 3 0 1 1 6 0a3 3 0 1 1 -6 0z",companion:"M5.5 6.5a3 3 0 1 0 6 0a3 3 0 1 0 -6 0zM4.5 18.5L6 11.5L11 11.5L12.5 18.5ZM12.5 7.5a3 3 0 1 0 6 0a3 3 0 1 0 -6 0zM11.5 19L13 12.5L18 12.5L19.5 19Z","semi-ambulatory":"M8.3 3.8a2.2 2.2 0 1 0 4.4 0a2.2 2.2 0 1 0 -4.4 0zM9 6.2L12 6.6L11 13.5L8.6 13L9 6.2ZM8.6 13L11 13L9.5 21L7 21ZM10.4 13L12.6 13L13.6 21L11.2 21ZM11.2 7.2L14 8L14.6 9.6L11.9 8.9ZM14.4 6.8L15.9 6.8L16.4 21L14.8 21Z","designated-aisle":"M3 5L6 5L6 14L3 14ZM3 12L13 12L13 15L3 15ZM5 15L7 15L7 20L5 20ZM11 15L13 15L13 20L11 20ZM13 7L20 7L17 4L19 4L23 8.5L19 13L17 13L20 10L13 10Z","step-free":"M4 4.5a2.2 2.2 0 1 0 4.4 0a2.2 2.2 0 1 0 -4.4 0zM4.4 7L7.5 7L7.5 13L11 15L9.5 17L5 14L4.4 7ZM2 19L8 19L17 10L22 10L22 13L18 13L10 21L2 21Z",hearing:"M15.5 3.5C9 2.2 5.5 6 5.5 11.5C5.5 16 8 19.5 10.5 21C13.2 22.6 16.4 20.8 15.4 18C14.8 16.4 12.9 16.1 13 14C13.1 11.9 15.8 11.4 15.8 8.5C15.8 5.4 13 4 15.5 3.5Z",cart:"M5.5 6L18.5 6a2.5 2.5 0 0 1 2.5 2.5L21 15.5a2.5 2.5 0 0 1 -2.5 2.5L11 18L7 20.5L7.5 18L5.5 18a2.5 2.5 0 0 1 -2.5 -2.5L3 8.5a2.5 2.5 0 0 1 2.5 -2.5zM6.5 11L17.5 11L17.5 12.6L6.5 12.6zM6.5 14L17.5 14L17.5 15.6L6.5 15.6z","sign-language":"M7 11L17 11L17 18a2 2 0 0 1 -2 2L9 20a2 2 0 0 1 -2 -2zM7.6 5L9.4 5L9.4 12L7.6 12zM9.9 3.5L11.7 3.5L11.7 12L9.9 12zM12.3 3.5L14.1 3.5L14.1 12L12.3 12zM14.6 5L16.4 5L16.4 12L14.6 12zM7.2 12.5L5 10.2L6.4 8.9L8.6 11.2Z","low-vision":"M2.5 12C6 6 18 6 21.5 12C18 18 6 18 2.5 12ZM9 12a3 3 0 1 0 6 0a3 3 0 1 0 -6 0zM17.5 3L19 3L19 6L17.5 6ZM19 4L22 4L22 5.5L19 5.5Z","sensory-friendly":"M4 11C4 5 7 2.5 12 2.5S20 5 20 11L17 11C17 7 15.5 5.5 12 5.5S7 7 7 11ZM3 10L8 10L8 19L5 19a2 2 0 0 1 -2 -2ZM16 10L21 10L21 17a2 2 0 0 1 -2 2L16 19ZM9 12L15 12L15 14L9 14ZM10 16L14 16L14 18L10 18Z","plus-size":"M9.4 4.3a2.6 2.6 0 1 0 5.2 0a2.6 2.6 0 1 0 -5.2 0zM5 20L4 13C4 10.5 7 9.5 12 9.5C17 9.5 20 10.5 20 13L19 20Z","lift-armrest":"M5 6L8 6L8 19L5 19zM5 16L18 16L18 19L5 19zM8 12L17 12L17 14.5L8 14.5zM14 7L16 7L16 12L14 12zM12 7L18 7L15 3Z"},w=x.wheelchair;function v(t){if(!t?.length)return null;let L=t.includes("wheelchair")?"wheelchair":t[0];return x[L]??null}function F(t){return/-(\d{1,5})$/.exec(t)?.[1]??t}var a=T;function X(t,L,r){let n=c(t),o=c(L);if(!n||!o)return L;let e=Math.max(0,Math.min(1,r));return`#${n.map((s,_)=>Math.round(s*e+o[_]*(1-e))).map(s=>s.toString(16).padStart(2,"0")).join("")}`}var K=3;function C(t,L,r=M){let n=a(L,t);if(n!=null&&n>=r)return L;let o=a(l,t)??0,e=a(u,t)??0;return o===0&&e===0?L:o>=e?l:u}function Y(t,L,r,n=M){return L??C(t,r,n)}var S=3;function D(t){let L=a("#ffffff",t);if(L!=null&&L>=S)return"#ffffff";let r=a(l,t)??0,n=a(u,t)??0;return r===0&&n===0?"#ffffff":r>=n?l:u}var m=/^#[0-9a-f]{6}$/i;function O(t){let L=c(t);return L!=null&&A(L)>.5}var b="#e5e7eb",h="#273142";function U(t){return O(t)?b:h}function V(t,L,r=M){let n=m.test(t.trim()),o=t.trim().toLowerCase(),e=0,i=0,s=null;for(let p of L){if(!n||!m.test(p.trim()))continue;e+=1;let f=C(p,t,r);f.toLowerCase()!==o&&(i+=1,s=f)}return{total:e,overridden:i,status:e===0?"none":i===0?"applies":i===e?"overridden":"mixed",overrideInk:s}}export{z as a,B as b,N as c,R as d,k as e,y as f,E as g,M as h,g as i,l as j,u as k,G as l,H as m,P as n,x as o,w as p,v as q,F as r,a as s,X as t,K as u,C as v,Y as w,D as x,O as y,b as z,h as A,U as B,V as C};