@seatlayer/core 0.78.0 → 0.80.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ar-EZLC3TID.js +1 -0
- package/dist/be-PNW4HSCT.js +1 -0
- package/dist/bg-WWTVMKHN.js +1 -0
- package/dist/ca-7CQTBZHV.js +1 -0
- package/dist/{categoryInventory-IgpsH6KG.d.cts → categoryInventory-BR7noBOD.d.cts} +1 -1
- package/dist/{categoryInventory-C_NIm0jr.d.ts → categoryInventory-CZRNxr1T.d.ts} +1 -1
- package/dist/chunk-7LMW7QTP.js +1 -0
- package/dist/chunk-C7MR6CFC.js +1 -0
- package/dist/{chunk-SGYNM3SG.js → chunk-GQLJAU75.js} +1 -1
- package/dist/{chunk-SSBMTFAV.js → chunk-SKMHD76O.js} +1 -1
- package/dist/{chunk-FGMGDTMR.js → chunk-YXOSJLK7.js} +1 -1
- package/dist/core/chart-ops/index.d.cts +4 -4
- package/dist/core/chart-ops/index.d.ts +4 -4
- package/dist/core/chart-ops/index.js +1 -1
- package/dist/core/inventory/index.cjs +1 -1
- package/dist/core/inventory/index.d.cts +5 -34
- package/dist/core/inventory/index.d.ts +5 -34
- package/dist/core/inventory/index.js +1 -1
- package/dist/core/layout/index.d.cts +5 -5
- package/dist/core/layout/index.d.ts +5 -5
- package/dist/core/quality/index.cjs +1 -1
- package/dist/core/quality/index.d.cts +35 -4
- package/dist/core/quality/index.d.ts +35 -4
- package/dist/core/quality/index.js +1 -1
- package/dist/core/render-assets/index.d.cts +1 -1
- package/dist/core/render-assets/index.d.ts +1 -1
- package/dist/core/seatConfidence.d.cts +1 -1
- package/dist/core/seatConfidence.d.ts +1 -1
- package/dist/core/sections/index.d.cts +5 -5
- package/dist/core/sections/index.d.ts +5 -5
- package/dist/cs-CO6IPOND.js +1 -0
- package/dist/cy-JSKIEF7V.js +1 -0
- package/dist/da-XNN2TLET.js +1 -0
- package/dist/de-T7S7DY4P.js +1 -0
- package/dist/el-SQNQJ6N5.js +1 -0
- package/dist/es-WIEMVIPM.js +1 -0
- package/dist/et-AJ666JLF.js +1 -0
- package/dist/{eventConfigurations-71rHjKl7.d.ts → eventConfigurations-DhGEe6fT.d.ts} +1 -1
- package/dist/{eventConfigurations-vOMFVz7c.d.cts → eventConfigurations-OVlni2ym.d.cts} +1 -1
- package/dist/fa-PA22MNZD.js +1 -0
- package/dist/fi-OIKV7BZB.js +1 -0
- package/dist/fr-K2BPY3ZG.js +1 -0
- package/dist/he-NB5S5QOD.js +1 -0
- package/dist/hr-HB2ZBWCL.js +1 -0
- package/dist/hu-DXONGHET.js +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +139 -121
- package/dist/index.d.ts +139 -121
- package/dist/index.js +1 -1
- package/dist/it-7YYWICOD.js +1 -0
- package/dist/ja-ROSYSJVY.js +1 -0
- package/dist/ku-3VHLRVJY.js +1 -0
- package/dist/{labeling-BnjyAEbI.d.ts → labeling-Btg_slmM.d.ts} +1 -1
- package/dist/{labeling-pdEv7UN1.d.cts → labeling-DzPlkJct.d.cts} +1 -1
- package/dist/localeLoaders-42CYOXB5.js +1 -0
- package/dist/lt-KOUZG2YJ.js +1 -0
- package/dist/lv-JOK7LYAH.js +1 -0
- package/dist/nl-H7NAUHTK.js +1 -0
- package/dist/no-OJ35WOND.js +1 -0
- package/dist/pl-FD5NFT6Y.js +1 -0
- package/dist/pt-BOCUN4SZ.js +1 -0
- package/dist/{renderedQuality-CXWlCsRS.d.ts → renderedQuality-DObXwisG.d.ts} +1 -1
- package/dist/{renderedQuality-rc4xZnIy.d.cts → renderedQuality-Dz-WTrRc.d.cts} +1 -1
- package/dist/{renderer-Cqd5w55S.d.ts → renderer-BjuHQ0bx.d.cts} +12 -2
- package/dist/{renderer-DW7ejcxk.d.cts → renderer-i_mthe5Z.d.ts} +12 -2
- package/dist/ro-Z44LTOXH.js +1 -0
- package/dist/ru-J4XWPJR6.js +1 -0
- package/dist/{sections-CQ0sd37E.d.cts → sections-DUG5M-hF.d.cts} +1 -1
- package/dist/{sections-F6wMlVqx.d.ts → sections-Du9QkrCf.d.ts} +1 -1
- package/dist/{segmentedRowModel-DqFhb-7Q.d.cts → segmentedRowModel-BYSxfsqX.d.cts} +1 -1
- package/dist/{segmentedRowModel-D-CEgxg7.d.ts → segmentedRowModel-N9Z0rnKY.d.ts} +1 -1
- package/dist/sk-4O4XNGR6.js +1 -0
- package/dist/sl-AHDPSHB6.js +1 -0
- package/dist/sr-B5PADXMB.js +1 -0
- package/dist/sv-KZCOVO3R.js +1 -0
- package/dist/{tableSizing-uVEPXCUD.d.ts → tableSizing-BpRvVdXK.d.ts} +3 -3
- package/dist/{tableSizing-OzEvBirS.d.cts → tableSizing-DnSAiaXL.d.cts} +3 -3
- package/dist/ticketRestrictions-BijtF-Lw.d.ts +141 -0
- package/dist/ticketRestrictions-CvaHRHti.d.cts +141 -0
- package/dist/tr-E5X266RM.js +1 -0
- package/dist/{types-Dq-ipTBG.d.ts → types-eVmh2-Yn.d.cts} +1 -1
- package/dist/{types-Dq-ipTBG.d.cts → types-eVmh2-Yn.d.ts} +1 -1
- package/dist/uk-6RR5RHIY.js +1 -0
- package/dist/view3d/crossfade/panorama.d.cts +1 -1
- package/dist/view3d/crossfade/panorama.d.ts +1 -1
- package/dist/view3d/index.d.cts +3 -3
- package/dist/view3d/index.d.ts +3 -3
- package/dist/view3d/index.js +1 -1
- package/dist/view3d/scene/scene.worker.js +1 -1
- package/dist/zh-Hans-GQWICG2Q.js +1 -0
- package/dist/zh-Hant-DTRJKLTS.js +1 -0
- package/package.json +1 -1
- package/dist/ar-U7RQGDKI.js +0 -1
- package/dist/be-AF2KLUPU.js +0 -1
- package/dist/bg-KQXVZFP5.js +0 -1
- package/dist/ca-2Z6OXARI.js +0 -1
- package/dist/chunk-O5UH442K.js +0 -1
- package/dist/chunk-XD2P4ZS4.js +0 -1
- package/dist/cs-OA5PNXZF.js +0 -1
- package/dist/cy-SEZB6CFS.js +0 -1
- package/dist/da-WNYFNHJW.js +0 -1
- package/dist/de-GZ5KABWX.js +0 -1
- package/dist/el-ROWVMGFA.js +0 -1
- package/dist/es-WDEEXPGZ.js +0 -1
- package/dist/et-UZ6PWBEI.js +0 -1
- package/dist/fa-6RECOCDS.js +0 -1
- package/dist/fi-W2NFGTLE.js +0 -1
- package/dist/fr-TGQU57AA.js +0 -1
- package/dist/he-GW4WHBMC.js +0 -1
- package/dist/hr-XYCPPQ2E.js +0 -1
- package/dist/hu-MXARVYEB.js +0 -1
- package/dist/it-AEJ2XXPK.js +0 -1
- package/dist/ja-GEZL7WIS.js +0 -1
- package/dist/ku-X2WS563F.js +0 -1
- package/dist/localeLoaders-YAOADFDS.js +0 -1
- package/dist/lt-O6WX2MFZ.js +0 -1
- package/dist/lv-JQH24NH4.js +0 -1
- package/dist/nl-OYNNCIHM.js +0 -1
- package/dist/no-TJCQIIDH.js +0 -1
- package/dist/pl-WWCEGFPX.js +0 -1
- package/dist/pt-FWBIZXLG.js +0 -1
- package/dist/ro-RHGJMFQQ.js +0 -1
- package/dist/ru-6IAWMJIM.js +0 -1
- package/dist/sk-2NHU34X2.js +0 -1
- package/dist/sl-O2QSGQWN.js +0 -1
- package/dist/sr-XK7AKCDR.js +0 -1
- package/dist/sv-IPA5ZBAA.js +0 -1
- package/dist/ticketRestrictions-BH430to6.d.ts +0 -72
- package/dist/ticketRestrictions-CGD-l3if.d.cts +0 -72
- package/dist/tr-TM3T5KYL.js +0 -1
- package/dist/uk-37NGTGA6.js +0 -1
- package/dist/zh-Hans-QKYGPQQE.js +0 -1
- package/dist/zh-Hant-AUEE5P67.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as Pn,c as In,d as wn}from"./chunk-PRED5KHO.js";import{a as An}from"./chunk-QJXSZT3H.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 Ae from"earcut";import Pe from"polygon-clipping";var g=ut,Ie=.002;function we(t,n,e){let r=Math.hypot(n[0]-t[0],n[1]-t[1],n[2]-t[2]),o=Math.hypot(e[0]-n[0],e[1]-n[1],e[2]-n[2]),a=Math.hypot(t[0]-e[0],t[1]-e[1],t[2]-e[2]),i=Math.max(r,o,a);if(i<1e-9)return!0;let s=(r+o+a)/2;return 2*Math.sqrt(Math.max(0,s*(s-r)*(s-o)*(s-a)))/i<Ie}var ht=class{constructor(n=16384){this.len=0;this.buf=new Float32Array(n)}push3(n,e,r){this.len+3>this.buf.length&&this.grow(this.len+3),this.buf[this.len++]=n,this.buf[this.len++]=e,this.buf[this.len++]=r}push1(n){this.len+1>this.buf.length&&this.grow(this.len+1),this.buf[this.len++]=n}grow(n){let e=this.buf.length*2;for(;e<n;)e*=2;let r=new Float32Array(e);r.set(this.buf.subarray(0,this.len)),this.buf=r}get length(){return this.len}toArray(){return this.buf.slice(0,this.len)}},Yt=class{constructor(){this.pos=new ht;this.nor=new ht;this.col=new ht;this.flr=new ht;this.mat=new ht;this.currentFloor=0;this.currentMaterial=0}setFloor(n){this.currentFloor=n}setMaterial(n){this.currentMaterial=n}tri(n,e,r,o,a,i=a,s=a){we(n,e,r)||(this.pos.push3(n[0],n[1],n[2]),this.pos.push3(e[0],e[1],e[2]),this.pos.push3(r[0],r[1],r[2]),this.nor.push3(o[0],o[1],o[2]),this.nor.push3(o[0],o[1],o[2]),this.nor.push3(o[0],o[1],o[2]),this.col.push3(a[0],a[1],a[2]),this.col.push3(i[0],i[1],i[2]),this.col.push3(s[0],s[1],s[2]),this.flr.push1(this.currentFloor),this.flr.push1(this.currentFloor),this.flr.push1(this.currentFloor),this.mat.push1(this.currentMaterial),this.mat.push1(this.currentMaterial),this.mat.push1(this.currentMaterial))}triN(n,e,r,o,a,i,s,l=s,c=s){[...n,...e,...r].every(Number.isFinite)&&(this.pos.push3(n[0],n[1],n[2]),this.pos.push3(e[0],e[1],e[2]),this.pos.push3(r[0],r[1],r[2]),this.nor.push3(o[0],o[1],o[2]),this.nor.push3(a[0],a[1],a[2]),this.nor.push3(i[0],i[1],i[2]),this.col.push3(s[0],s[1],s[2]),this.col.push3(l[0],l[1],l[2]),this.col.push3(c[0],c[1],c[2]),this.flr.push1(this.currentFloor),this.flr.push1(this.currentFloor),this.flr.push1(this.currentFloor),this.mat.push1(this.currentMaterial),this.mat.push1(this.currentMaterial),this.mat.push1(this.currentMaterial))}get vertexCount(){return this.pos.length/3}build(){return{position:this.pos.toArray(),normal:this.nor.toArray(),color:this.col.toArray(),floor:this.flr.toArray(),material:this.mat.toArray(),count:this.pos.length/3}}};function _e(t,n,e){let r=n[0]-t[0],o=n[1]-t[1],a=n[2]-t[2],i=e[0]-t[0],s=e[1]-t[1],l=e[2]-t[2],c=o*l-a*s,f=a*i-r*l,m=r*s-o*i,u=Math.hypot(c,f,m)||1;return c/=u,f/=u,m/=u,[c,f,m]}function Te(t,n){let e=[...t],r=[];for(let i of t)r.push(i.x,i.y);let o=[];if(n){for(let i of n)if(!(i.length<3)){o.push(e.length);for(let s of i)e.push(s),r.push(s.x,s.y)}}let a=Ae(r,o.length?o:void 0,2);return{pts:e,tris:a}}function Jt(t){return ft(t)<0?[...t].reverse():t}var Be=3;function Ee(t,n,e,r){let o=r(t),a=r(n),i=r(e),s=(h,b,p,d)=>Math.abs(r({x:(h.x+b.x)/2,y:(h.y+b.y)/2})-(p+d)/2),l=(t.x+n.x+e.x)/3,c=(t.y+n.y+e.y)/3,f=(o+a+i)/3,m=Math.max(s(t,n,o,a),s(n,e,a,i),s(e,t,i,o),Math.abs(r({x:l,y:c})-f)),u=(h,b,p)=>{let d=Math.abs(r({x:(h+l)/2,y:(b+c)/2})-(p+f)/2);d>m&&(m=d)};return u((t.x+n.x)/2,(t.y+n.y)/2,(o+a)/2),u((n.x+e.x)/2,(n.y+e.y)/2,(a+i)/2),u((e.x+t.x)/2,(e.y+t.y)/2,(i+o)/2),m}function wt(t,n,e,r,o){if(o<=0)return Ee(t,n,e,r);let a={x:(t.x+n.x)/2,y:(t.y+n.y)/2},i={x:(n.x+e.x)/2,y:(n.y+e.y)/2},s={x:(e.x+t.x)/2,y:(e.y+t.y)/2};return Math.max(wt(t,a,s,r,o-1),wt(a,n,i,r,o-1),wt(s,i,e,r,o-1),wt(a,i,s,r,o-1))}function _t(t,n,e,r,o,a,i,s){if(i>0){let u={x:(n.x+e.x)/2,y:(n.y+e.y)/2},h={x:(e.x+r.x)/2,y:(e.y+r.y)/2},b={x:(r.x+n.x)/2,y:(r.y+n.y)/2};_t(t,n,u,b,o,a,i-1,s),_t(t,u,e,h,o,a,i-1,s),_t(t,b,h,r,o,a,i-1,s),_t(t,u,h,b,o,a,i-1,s);return}let l=[n.x*g,o(n),n.y*g],c=[e.x*g,o(e),e.y*g],f=[r.x*g,o(r),r.y*g];if(s){t.triN(l,c,f,s(n),s(e),s(r),a);return}let m=_e(l,c,f);m[1]<0&&(m=[-m[0],-m[1],-m[2]]),t.tri(l,c,f,m,a)}var Ce=8;function _n(t,n,e){if(!Number.isFinite(e))return t;let r=[],o=(a,i,s,l,c)=>{if(c>0){let f={x:(a.x+i.x)/2,y:(a.y+i.y)/2},m=n(f);if(Math.abs(m-(s+l)/2)>e){o(a,f,s,m,c-1),o(f,i,m,l,c-1);return}}r.push(a)};for(let a=0;a<t.length;a++){let i=t[a],s=t[(a+1)%t.length];o(i,s,n(i),n(s),Ce)}return r}function Xt(t,n){if(t.length<3)return t;let e=[];for(let o of t){let a=e[e.length-1];a&&Math.hypot(o.x-a.x,o.y-a.y)<n||e.push(o)}for(;e.length>2&&Math.hypot(e[0].x-e[e.length-1].x,e[0].y-e[e.length-1].y)<n;)e.pop();if(e.length<3)return t;let r=[];for(let o=0;o<e.length;o++){let a=r.length?r[r.length-1]:e[(o-1+e.length)%e.length],i=e[o],s=e[(o+1)%e.length],l=s.x-a.x,c=s.y-a.y,f=Math.hypot(l,c);f>n&&Math.abs((i.x-a.x)*c-(i.y-a.y)*l)/f<n||r.push(i)}return r.length>=3?r:e}var Ut=.001*lt*.1;function K(t,n,e,r,o,a,i,s,l=1/0,c){if(!n||n.length<3||(l===void 0&&(l=1/0),Math.abs(ft(n))<1e-4))return;let f=Xt(_n(Xt(Jt(n),Ut),r,l),Ut),m=e?.map(M=>Xt(_n(Xt(Jt(M),Ut),r,l),Ut)).filter(M=>M.length>=3&&Math.abs(ft(M))>=1e-4),{pts:u,tris:h}=Te(f,m),b=[a[0]*s.top,a[1]*s.top,a[2]*s.top],p=[a[0]*s.bottomCap,a[1]*s.bottomCap,a[2]*s.bottomCap],d=[i[0]*s.top,i[1]*s.top,i[2]*s.top],y=[i[0]*s.wallBottom,i[1]*s.wallBottom,i[2]*s.wallBottom],x=0;if(Number.isFinite(l))for(;x<Be;x++){let M=0;for(let I=0;I<h.length;I+=3){let B=wt(u[h[I]],u[h[I+1]],u[h[I+2]],r,x);B>M&&(M=B)}if(M<=l)break}for(let M=0;M<h.length;M+=3){let I=u[h[M]],B=u[h[M+1]],k=u[h[M+2]];_t(t,I,B,k,r,b,x,c);let D=[I.x*g,o,I.y*g],U=[B.x*g,o,B.y*g],S=[k.x*g,o,k.y*g];t.tri(D,S,U,[0,-1,0],p)}let w=M=>{if(x<=0)return M;let I=1<<x,B=[];for(let k=0;k<M.length;k++){let D=M[k],U=M[(k+1)%M.length];for(let S=0;S<I;S++){let _=S/I;B.push({x:D.x+(U.x-D.x)*_,y:D.y+(U.y-D.y)*_})}}return B},A=pn(f),E=[{ring:w(f),flip:!1}];if(m)for(let M of m)M.length>=3&&E.push({ring:w(M),flip:!0});for(let{ring:M,flip:I}of E)for(let B=0;B<M.length;B++){let k=M[B],D=M[(B+1)%M.length],U=(D.x-k.x)*g,_=(D.y-k.y)*g,N=-U,O=Math.hypot(_,N)||1;_/=O,N/=O;let P=(k.x+D.x)/2-A.x,F=(k.y+D.y)/2-A.y,R=_*P+N*F;I&&(R=-R),R<0&&(_=-_,N=-N);let T=[_,0,N],C=[k.x*g,r(k),k.y*g],v=[D.x*g,r(D),D.y*g],G=[k.x*g,o,k.y*g],X=[D.x*g,o,D.y*g];t.tri(C,v,X,T,d,d,y),t.tri(C,X,G,T,d,y,y)}}function Tn(t){let n=0;for(let l of t)n+=l.count;let e=new Float32Array(n*3),r=new Float32Array(n*3),o=new Float32Array(n*3),a=new Float32Array(n),i=new Float32Array(n),s=0;for(let l of t)e.set(l.position,s*3),r.set(l.normal,s*3),o.set(l.color,s*3),a.set(l.floor,s),i.set(l.material,s),s+=l.count;return{position:e,normal:r,color:o,floor:a,material:i,count:n}}function jt(t,n,e=2.5){if(n<=0||t.length<3)return t;let r=Jt(t),o=r.length,a=[];for(let s=0;s<o;s++){let l=r[s],c=r[(s+1)%o],f=c.x-l.x,m=c.y-l.y,u=Math.hypot(f,m)||1;a.push({x:m/u,y:-f/u})}let i=[];for(let s=0;s<o;s++){let l=r[s],c=a[(s-1+o)%o],f=a[s],m=c.x+f.x,u=c.y+f.y,h=Math.hypot(m,u),b=()=>{i.push([l.x+c.x*n,l.y+c.y*n]),i.push([l.x+f.x*n,l.y+f.y*n])};if(h<1e-9){b();continue}m/=h,u/=h;let p=m*c.x+u*c.y,d=1/Math.max(p,1e-6);if(!Number.isFinite(d)||d>e){b();continue}i.push([l.x+m*n*d,l.y+u*n*d])}if(i.length<3)return t;try{let s=Pe.union([[...i,i[0]]]),l=null,c=-1/0;for(let m of s){let u=Math.abs(ft(m[0].map(([h,b])=>({x:h,y:b}))));u>c&&(c=u,l=m[0])}if(!l)return t;let f=l.map(([m,u])=>({x:m,y:u}));if(f.length>1){let m=f[0],u=f[f.length-1];Math.abs(m.x-u.x)<1e-9&&Math.abs(m.y-u.y)<1e-9&&f.pop()}return f.length>=3?f:t}catch{return t}}function Ht(t,n,e,r,o=28){let a=[];for(let i=0;i<o;i++){let s=i/o*Math.PI*2;a.push({x:t+e*Math.cos(s),y:n+r*Math.sin(s)})}return a}function Tt(t,n,e,r){return[{x:t,y:n},{x:t+e,y:n},{x:t+e,y:n+r},{x:t,y:n+r}]}var Bt=["available","held","sold","selected","dimmed"];function Qt(t){let n=Bt.indexOf(t);return n<0?0:n}var Bn={available:[.24,.82,.52],held:[.95,.66,.22],sold:[.34,.39,.45],selected:[.24,.74,1],dimmed:[.28,.32,.37]};function mr(t){let n=.2126*t[0]+.7152*t[1]+.0722*t[2],e=.42,r=.62;return[(n+(t[0]-n)*e)*r,(n+(t[1]-n)*e)*r,(n+(t[2]-n)*e)*r]}var tn={ground:[.07,.085,.11],tierTop:[.24,.28,.34],tierWall:[.17,.2,.25],stageTop:[.94,.7,.38],stageWall:[.48,.33,.18],decorTop:[.22,.25,.29],decorWall:[.15,.17,.2],gaTop:[.24,.28,.33],gaWall:[.16,.19,.23],boothTop:[.3,.33,.38],boothWall:[.2,.23,.27],tableTop:[.38,.34,.29],tableWall:[.24,.21,.18]},nn={top:[.05,.06,.08],bottom:[.1,.12,.15]};function et(t,n){return[Math.min(1,t[0]*n),Math.min(1,t[1]*n),Math.min(1,t[2]*n)]}var V={pedestal:0,pad:1,back:2,arm:3,footrest:4,leg:5,body:10,head:11},Fe=.44,ve=.15,ke=.3,Oe=.24;function En(t){return t===void 0||!Number.isFinite(t)||t<=0?Oe:Math.min(ke,Math.max(ve,t*Fe))}var hr=.21,Le=.05,en=.45,Ge=en+Le,De=.92,Ne=1.205,Xe=-.23,Ue=.38,Ye=[{part:V.pedestal,min:[-.3,0,-.3],max:[.3,.36,.3]},{part:V.pad,min:[-1,.36,-.95],max:[1,en,1]},{part:V.back,min:[-1,Ge,-1],max:[1,De,-.72]},{part:V.arm,min:[-1,.44,-.82],max:[-.78,.65,.78]},{part:V.arm,min:[.78,.44,-.82],max:[1,.65,.78]},{part:V.footrest,min:[-.9,.18,.78],max:[.9,.31,1.34]},{part:V.leg,min:[-.82,0,-.7],max:[-.62,.37,-.48]},{part:V.leg,min:[.62,0,-.7],max:[.82,.37,-.48]},{part:V.leg,min:[-.82,0,.48],max:[-.62,.37,.7]},{part:V.leg,min:[.62,0,.48],max:[.82,.37,.7]}],je=[{part:V.body,min:[-.52,.39,-.08],max:[-.08,.55,.82]},{part:V.body,min:[.08,.39,-.08],max:[.52,.55,.82]},{part:V.body,min:[-.47,.05,.58],max:[-.13,.43,.82]},{part:V.body,min:[.13,.05,.58],max:[.47,.43,.82]},{part:V.head,min:[-.16,1.04,-.33],max:[.16,1.1,-.13]}],He=[{n:[1,0,0],c:[[1,0,0],[1,1,0],[1,1,1],[1,0,1]]},{n:[-1,0,0],c:[[0,0,1],[0,1,1],[0,1,0],[0,0,0]]},{n:[0,1,0],c:[[0,1,0],[0,1,1],[1,1,1],[1,1,0]]},{n:[0,-1,0],c:[[0,0,1],[0,0,0],[1,0,0],[1,0,1]]},{n:[0,0,1],c:[[0,0,1],[1,0,1],[1,1,1],[0,1,1]]},{n:[0,0,-1],c:[[1,0,0],[0,0,0],[0,1,0],[1,1,0]]}];function br(){let t=[],n=[],e=[],r=[],o=(O,P,F)=>{let R=e.length,[T,C,v]=O,G=[C[0]-T[0],C[1]-T[1],C[2]-T[2]],X=[v[0]-T[0],v[1]-T[1],v[2]-T[2]],L=G[1]*X[2]-G[2]*X[1],Y=G[2]*X[0]-G[0]*X[2],j=G[0]*X[1]-G[1]*X[0],$=Math.hypot(L,Y,j);$>1e-9?(L/=$,Y/=$,j/=$):[L,Y,j]=P,L*P[0]+Y*P[1]+j*P[2]<0&&(L=-L,Y=-Y,j=-j);for(let z of O)t.push(...z),n.push(L,Y,j),e.push(F);r.push(R,R+1,R+2,R,R+2,R+3)},a=O=>{for(let P of He){let F=P.c.map(R=>R.map((T,C)=>T?O.max[C]:O.min[C]));o(F,P.n,O.part)}};for(let O of Ye)a(O);for(let O of je)a(O);let i=en,s=1.08,l=.47,c=.69,f=-.55,m=.08,u=-.48,h=.01,b=[-l,i,f],p=[l,i,f],d=[-l,i,m],y=[l,i,m],x=[-c,s,u],w=[c,s,u],A=[-c,s,h],E=[c,s,h];o([p,w,E,y],[1,0,0],V.body),o([d,A,x,b],[-1,0,0],V.body),o([A,E,w,x],[0,1,0],V.body),o([b,p,y,d],[0,-1,0],V.body),o([y,E,A,d],[0,0,1],V.body),o([b,x,w,p],[0,0,-1],V.body);let M=10,I=8,B=[0,Ne,Xe],k=[.42,.115,Ue],D=e.length;for(let O=0;O<=I;O++){let P=Math.PI*O/I,F=Math.cos(P),R=Math.sin(P);for(let T=0;T<=M;T++){let C=Math.PI*2*T/M,v=R*Math.cos(C),G=R*Math.sin(C);t.push(B[0]+k[0]*v,B[1]+k[1]*F,B[2]+k[2]*G);let X=v/k[0],L=F/k[1],Y=G/k[2],j=Math.hypot(X,L,Y)||1;X/=j,L/=j,Y/=j,n.push(X,L,Y),e.push(V.head)}}for(let O=0;O<I;O++)for(let P=0;P<M;P++){let F=D+O*(M+1)+P,R=F+M+1;r.push(F,R,F+1,F+1,R,R+1)}let U=new Float32Array(t),S=new Float32Array(n),_=new Float32Array(e),N=new Uint16Array(r);return{position:U,normal:S,part:_,index:N,vertexCount:e.length,indexCount:r.length}}function Cn(t,n,e,r){let o=new Float32Array(n),a=c=>t[c*3],i=c=>t[c*3+2],s=0,l=(c,f)=>{let m=f-c;for(let u=c;u<f;u++){let[h,b]=r(u),p=h-a(u),d=b-i(u);if(m>=2){let y=Math.max(c,u-1),x=Math.min(f-1,u+1),w=a(x)-a(y),A=i(x)-i(y),E=Math.hypot(w,A);if(E>1e-6){let M=-A/E,I=w/E;M*p+I*d<0&&(M=-M,I=-I),p=M,d=I}}o[u]=p===0&&d===0?0:Math.atan2(p,d)}};for(let c=1;c<=n;c++)(c===n||e(c)!==e(s))&&(l(s,c),s=c);return o}var Vt=.22;function Ar(t,n){let e=Bt[t];if(e!=="sold"&&e!=="held")return-1;let r=(n+1)*2654435761;return r^=r>>>15,r=Math.imul(r,2246822519),r^=r>>>13,(r>>>0)%1e5/1e5}var Ve=.42;function We(t){let n=t.length,e=new Float64Array(n);if(n<2)return e.fill(1/0),e;let r=1/0,o=1/0,a=-1/0,i=-1/0;for(let b of t)b.x<r&&(r=b.x),b.y<o&&(o=b.y),b.x>a&&(a=b.x),b.y>i&&(i=b.y);let s=Math.max(a-r,1e-6),l=Math.max(i-o,1e-6),c=Math.max(Math.sqrt(s*l/n),1e-6),f=Math.max(1,Math.ceil(s/c)+1),m=Math.max(1,Math.ceil(l/c)+1),u=new Map,h=(b,p)=>{let d=Math.min(f-1,Math.max(0,Math.floor((b-r)/c)));return Math.min(m-1,Math.max(0,Math.floor((p-o)/c)))*f+d};for(let b=0;b<n;b++){let p=h(t[b].x,t[b].y),d=u.get(p);d?d.push(b):u.set(p,[b])}for(let b=0;b<n;b++){let p=t[b],d=Math.min(f-1,Math.max(0,Math.floor((p.x-r)/c))),y=Math.min(m-1,Math.max(0,Math.floor((p.y-o)/c))),x=1/0;for(let w=1;w<=4;w++){for(let A=y-w;A<=y+w;A++)if(!(A<0||A>=m))for(let E=d-w;E<=d+w;E++){if(E<0||E>=f||w>1&&Math.abs(A-y)<w&&Math.abs(E-d)<w)continue;let M=u.get(A*f+E);if(M)for(let I of M){if(I===b)continue;let B=Math.hypot(t[I].x-p.x,t[I].y-p.y);B<x&&(x=B)}}if(Number.isFinite(x)&&x<=w*c)break}e[b]=x}return e}function ze(t){let n=t.eyeHeightM;return Number.isFinite(n)?Math.max(0,n-Gt):0}function Fn(t,n,e,r,o,a){let i=t.length,s=new Float32Array(i*3),l=new Float32Array(i),c=new Float32Array(i*3),f=new Float32Array(i),m=new Float32Array(i),u=new Float32Array(i),h=new Float32Array(i),b=new Float32Array(i*3),p=new Map,d=We(t);for(let y=0;y<i;y++){let x=t[y],A=(e?.seatPitchU(y)??d[y])*g;f[y]=Number.isFinite(A)?Math.max(.06,Math.min(Vt,A*Ve)):Vt,m[y]=En(Number.isFinite(A)?A:void 0);let E=Sn(x.glyph,{seatGlyph:a?.get(x.categoryKey)});u[y]=Mn.indexOf(E),h[y]=x.wheelchairSpaceType==="no-seat"?0:1,s[y*3]=x.x*g,s[y*3+1]=e?e.seatDeckY(y):ze(x),s[y*3+2]=x.y*g,l[y]=Qt(n?n(x):"available");let M=H(o?.get(x.categoryKey)??"#6e7bff")??[.43,.48,1];if(c[y*3]=M[0],c[y*3+1]=M[1],c[y*3+2]=M[2],x.accessibility?.length){let I=H(hn(x.accessibility));I&&(b[y*3]=I[0],b[y*3+1]=I[1],b[y*3+2]=I[2])}p.set(x.id,y)}return{count:i,iPosition:s,iState:l,iCategory:c,iMaxRadius:f,iRing:b,idToIndex:p,iChairWidth:m,iGlyph:u,iPhysicalSeat:h,iFloor:r??new Float32Array(i),iYaw:new Float32Array(i)}}var Ze=64;function Pr(t,n){let e=[];for(let i of n){let s=t.idToIndex.get(i.seatId);if(s===void 0)continue;let l=Qt(i.state);t.iState[s]!==l&&(t.iState[s]=l,e.push(s))}if(!e.length)return[];e.sort((i,s)=>i-s);let r=[],o=e[0],a=e[0];for(let i=1;i<e.length;i++){let s=e[i];if(s!==a){if(s<=a+Ze){a=s;continue}r.push({start:o,length:a-o+1}),o=s,a=s}}return r.push({start:o,length:a-o+1}),r}function _r(t,n,e){return e<0?n>1?t.filter(r=>r.kind==="floor"):[...t]:t.filter(r=>r.floorIndex===void 0||r.floorIndex===e)}function Tr(t,n){let e=[...t].sort((o,a)=>o.screen.y-a.screen.y),r=[];for(let o of e){let a=r.find(i=>i.some(s=>Math.abs(s.screen.x-o.screen.x)<104&&Math.abs(s.screen.y-o.screen.y)<34));a?a.push(o):r.push([o])}return r.flatMap(o=>o.length<2?o:o.map((a,i)=>({...a,screen:{...a.screen,x:Math.max(54,Math.min(n-54,a.screen.x+(i-(o.length-1)/2)*104))}})))}var Ke=1.15,$e=2.75,qe=4.5,Je=.85,Qe=.5,to=.26;function Br(t,n,e){let r=Math.max(1e-6,n),o=t/r,a=e?.hasZoneLabels??!0,i=new Set;return o>=.75&&i.add("floor"),o>=Ke&&i.add("zone"),o<=(a?$e:qe)&&(i.add("section"),i.add("ga")),o<=Je&&(i.add("annotation"),i.add("booth")),o<=Qe&&i.add("row"),o<=to&&i.add("seat"),i}function Er(t,n,e,r,o,a=6){let i=a+n,s=r-a-n,l=a+e,c=o-a-e;return{...t,x:i>s?r/2:Math.max(i,Math.min(s,t.x)),y:l>c?o/2:Math.max(l,Math.min(c,t.y))}}function Cr(t,n,e,r){let o=t,a=n[0],i=n[1],s=n[2],l=o[0]*a+o[4]*i+o[8]*s+o[12],c=o[1]*a+o[5]*i+o[9]*s+o[13],f=o[2]*a+o[6]*i+o[10]*s+o[14],m=o[3]*a+o[7]*i+o[11]*s+o[15];if(!(m>1e-6))return{x:0,y:0,depth:1/0,visible:!1};let u=l/m,h=c/m,b=f/m,p=u>=-1.05&&u<=1.05&&h>=-1.05&&h<=1.05&&b<=1;return{x:(u*.5+.5)*e,y:(1-(h*.5+.5))*r,depth:b,visible:p}}function Fr(t,n,e=n){let r=[],o=[...t].sort((a,i)=>a.screen.depth-i.screen.depth);for(let a of o){let i=!1;for(let s of r)if(on(a,s,n,e)){i=!0;break}i||r.push(a)}return r}var no=6;function on(t,n,e,r){let o=Math.abs(t.screen.x-n.screen.x),a=Math.abs(t.screen.y-n.screen.y),i=t.halfWidth!=null&&n.halfWidth!=null?Math.max(e,t.halfWidth+n.halfWidth+no):e;return o<i&&a<r}function vr(t,n,e){return t.length*n*.58+(e?14:0)}var eo={row:8,seat:14};function kr(t){return t<480?{row:5,seat:8}:t<768?{row:6,seat:10}:eo}function Or(t,n,e,r){let o=Math.max(1,Math.min(e,r)*.5),a=Math.min(2,Math.hypot(t.x-e/2,t.y-r/2)/o);return n*(1+1.5*a)}function Lr(t,n,e,r,o=[]){let a=[...t].sort((s,l)=>(l.priority??0)-(s.priority??0)||s.focus-l.focus),i=[];for(let s of a){if(i.length>=r)break;let l=!1;for(let c of o)if(on(s,c,n,e)){l=!0;break}if(!l){for(let c of i)if(on(s,c,n,e)){l=!0;break}}l||i.push(s)}return i}import bo from"polygon-clipping";var W={top:1,wallBottom:.5,bottomCap:.4};function st(t,n){if(!t)return n;let e=et(Pt(t,.4),.62);return nt(n,e,.72)}function vn(t,n){let e=new Map;for(let a of t.categories??[])e.set(a.key,a.color);let r=new Map;for(let a of n){if(!a.sectionId)continue;let i=r.get(a.sectionId);i||(i=new Map,r.set(a.sectionId,i)),i.set(a.categoryKey,(i.get(a.categoryKey)??0)+1)}let o=new Map;for(let[a,i]of r){let s=0,l=0,c=0,f=0;for(let[m,u]of i){let h=H(e.get(m));h&&(s+=h[0]*u,l+=h[1]*u,c+=h[2]*u,f+=u)}f>0&&o.set(a,[s/f,l/f,c/f])}return o}function kn(t,n){return H(t.color)??n.get(t.logicalSectionId??t.id)??null}import zn from"polygon-clipping";import Dn from"polygon-clipping";import oo from"earcut";var ro=.58,On=.01,ot=Vt*1.5*lt,io=.5,so=.6;function ao(t,n){let e=t.length,r=[];for(let i=0;i<e;i++){let s=t[Math.max(0,i-1)],l=t[Math.min(e-1,i+1)],c=l.x-s.x,f=l.y-s.y,m=Math.hypot(c,f);if(m<1e-9){r.push([0,0]);continue}c/=m,f/=m,r.push([-f,c])}let o=0;for(let i=0;i<e;i++)o+=(t[i].x-n.x)*r[i][0]+(t[i].y-n.y)*r[i][1];return o<0?r.map(([i,s])=>[-i,-s]):r}function co(t,n){if(t.length<2||n<=0)return[...t];let e=[...t],r=(i,s)=>{let l=s.x-i.x,c=s.y-i.y,f=Math.hypot(l,c)||1;return{x:l/f,y:c/f}},o=r(e[1],e[0]),a=r(e[e.length-2],e[e.length-1]);return e.unshift({x:e[0].x+o.x*n,y:e[0].y+o.y*n}),e.push({x:e[e.length-1].x+a.x*n,y:e[e.length-1].y+a.y*n}),e}var Ln=Math.PI/12;function uo(t){if(t.length<3)return[...t];let n=[...t].sort((a,i)=>a.x-i.x||a.y-i.y),e=(a,i,s)=>(i.x-a.x)*(s.y-a.y)-(i.y-a.y)*(s.x-a.x),r=a=>{let i=[];for(let s of a){for(;i.length>=2&&e(i[i.length-2],i[i.length-1],s)<=0;)i.pop();i.push(s)}return i.pop(),i},o=[...r(n),...r([...n].reverse())];return o.length>=3?o:[...t]}function Nn(t,n){if(!t.length||!(n>0))return[];let e=uo(t),r=(s,l,c,f)=>{let m=c-l;for(;m<0;)m+=Math.PI*2;for(;m>Math.PI*2;)m-=Math.PI*2;let u=Math.max(1,Math.ceil(m/Ln)),h=n/Math.cos(m/u/2);for(let b=0;b<=u;b++){let p=l+m*b/u;f.push({x:s.x+Math.cos(p)*h,y:s.y+Math.sin(p)*h})}};if(e.length<3){let s=0,l=0;for(let h of e)s+=h.x,l+=h.y;s/=e.length||1,l/=e.length||1;let c=0;for(let h of e)c=Math.max(c,Math.hypot(h.x-s,h.y-l));let f=[],m=Math.max(3,Math.ceil(Math.PI*2/Ln)),u=(c+n)/Math.cos(Math.PI/m);for(let h=0;h<m;h++){let b=h/m*Math.PI*2;f.push({x:s+Math.cos(b)*u,y:l+Math.sin(b)*u})}return f}let o=e.length,a=[];for(let s=0;s<o;s++){let l=e[s],c=e[(s+1)%o];a.push(Math.atan2(-(c.x-l.x),c.y-l.y))}let i=[];for(let s=0;s<o;s++)r(e[s],a[(s+o-1)%o],a[s],i);return Hn(i)}function lo(t,n,e){if(t.length===1)return Math.hypot(n-t[0].x,e-t[0].y);let r=1/0;for(let o=0;o+1<t.length;o++){let a=t[o],i=t[o+1],s=i.x-a.x,l=i.y-a.y,c=s*s+l*l,f=c>1e-12?((n-a.x)*s+(e-a.y)*l)/c:0;f<0?f=0:f>1&&(f=1);let m=Math.hypot(n-(a.x+f*s),e-(a.y+f*l));m<r&&(r=m)}return r}function Wt(t){let n=t.map(o=>{let a=0,i=0;for(let c of o.pts)a+=c.x,i+=c.y;let s=o.pts.length||1;a/=s,i/=s;let l=0;for(let c of o.pts){let f=Math.hypot(c.x-a,c.y-i);f>l&&(l=f)}return{cx:a,cy:i,rad:l}}),e=o=>{let a=o.length;return a<=2?[...o]:[o[Math.floor(a*.25)],o[Math.floor(a*.5)],o[Math.floor(a*.75)]]},r=[];for(let o=0;o<t.length;o++){let a=e(t[o].pts),i=[],s=1/0,l=null;for(let f of a){let m=1/0;for(let u=0;u<t.length;u++){if(u===o||Math.abs(t[u].y-t[o].y)<.001)continue;let h=n[u],b=Math.hypot(f.x-h.cx,f.y-h.cy)-h.rad;if(b>=m&&b>=s)continue;let p=lo(t[u].pts,f.x,f.y);p<m&&(m=p),t[u].depth<t[o].depth&&p<s&&(s=p,l=t[u].y)}Number.isFinite(m)&&m>0&&i.push(m)}i.sort((f,m)=>f-m);let c=i.length?i[Math.floor(i.length/2)]:1;r.push({pitch:c,belowY:l})}return r}function Xn(t,n,e,r){let o=t[n],a=o.pts.length>=2?[...o.pts]:o.pts.length===1?(()=>{let f=o.pts[0],m=f.x-r.x,u=f.y-r.y,h=Math.hypot(m,u)||1;m/=h,u/=h;let b=Math.max(e[n].pitch,.001)*.5;return[{x:f.x+u*b,y:f.y-m*b},{x:f.x-u*b,y:f.y+m*b}]})():[];if(a.length<2)return null;let i=0,s=0;for(let f=1;f<a.length;f++){let m=Math.hypot(a[f].x-a[f-1].x,a[f].y-a[f-1].y);m>1e-6&&(i+=m,s++)}let l=s>0?i/s:0,c=co(a,Math.max(l*so,ot));return{pts:c,nrm:ao(c,r),front:Math.max(e[n].pitch*ro,ot),back:Math.max(e[n].pitch*io,ot)}}var gt=1.5,Un=.3;function rn(t,n){if(t.length<3)return t;let e=t[0],r=t[t.length-1],o=r.x-e.x,a=r.y-e.y,i=Math.hypot(o,a),s=-1,l=-1;for(let m=1;m<t.length-1;m++){let u=t[m],h=i>1e-12?Math.abs((u.x-e.x)*a-(u.y-e.y)*o)/i:Math.hypot(u.x-e.x,u.y-e.y);h>s&&(s=h,l=m)}if(s<=n||l<0)return[e,r];let c=rn(t.slice(0,l+1),n),f=rn(t.slice(l),n);return[...c.slice(0,-1),...f]}function Yn(t,n){if(t.length<4)return t;let e=rn([...t,t[0]],n);return e.pop(),e.length>=3?e:t}function jn(t,n,e){if(t.length<2)return[];let r=e??Wt(t),o=new Map;for(let i=0;i<t.length;i++){let s=o.get(t[i].blockId);s?s.push(i):o.set(t[i].blockId,[i])}let a=[];for(let[,i]of o){let s=[];for(let x of i){let w=t[x].patch;w&&w.length>=3?a.push({outline:[...w],holes:[],topY:t[x].y}):s.push(x)}if(!s.length)continue;s.sort((x,w)=>t[x].depth-t[w].depth);let c=s.map(x=>Xn(t,x,r,n)).filter(x=>x!==null);if(!c.length)continue;let f=(x,w)=>({x:x.pts[w].x-x.nrm[w][0]*(x.front+gt),y:x.pts[w].y-x.nrm[w][1]*(x.front+gt)}),m=(x,w)=>({x:x.pts[w].x+x.nrm[w][0]*(x.back+gt),y:x.pts[w].y+x.nrm[w][1]*(x.back+gt)}),u=c[0],h=c[c.length-1],b=[];for(let x=0;x<u.pts.length;x++)b.push(f(u,x));for(let x of c)b.push(m(x,x.pts.length-1));for(let x=h.pts.length-1;x>=0;x--)b.push(m(h,x));for(let x=c.length-1;x>=0;x--)b.push(f(c[x],0));let p=Hn(b),d=1/0;for(let x of s)t[x].y<d&&(d=t[x].y);if(!Number.isFinite(d))continue;if(p.length>=3&&Math.abs(ft(p))>1e-6&&c.every(x=>{let w=x.pts[Math.floor(x.pts.length/2)];return It(p,w.x,w.y)})){a.push({outline:Yn(p,Un),holes:[],topY:d});continue}for(let x of mo(c))a.push({outline:x,holes:[],topY:d})}return a}function mo(t){let n=[];for(let e of t){let r=[],o=[],a=e.front+gt,i=e.back+gt;for(let l=0;l<e.pts.length;l++){let c=e.pts[l],f=e.nrm[l];r.push([c.x-f[0]*a,c.y-f[1]*a]),o.push([c.x+f[0]*i,c.y+f[1]*i])}let s=[...r,...o.reverse()];s.length<3||(s.push(s[0]),n.push([s]))}if(!n.length)return[];try{let e=Dn.union(n[0],...n.slice(1)),r=[];for(let o of e){if(!o.length||o[0].length<4)continue;let a=o[0].map(([l,c])=>({x:l,y:c})),i=a[0],s=a[a.length-1];a.length>1&&Math.abs(i.x-s.x)<1e-9&&Math.abs(i.y-s.y)<1e-9&&a.pop(),a.length>=3&&r.push(Yn(a,Un))}return r}catch{return[]}}function Hn(t){let n=[];for(let e of t){let r=n[n.length-1];r&&Math.hypot(e.x-r.x,e.y-r.y)<1e-9||n.push(e)}for(;n.length>2&&Math.hypot(n[0].x-n[n.length-1].x,n[0].y-n[n.length-1].y)<1e-9;)n.pop();return n}var sn=class{constructor(n){this.minX=1/0;this.minY=1/0;this.maxX=-1/0;this.maxY=-1/0;this.rings=n;for(let e of n)for(let r of e)r.x<this.minX&&(this.minX=r.x),r.y<this.minY&&(this.minY=r.y),r.x>this.maxX&&(this.maxX=r.x),r.y>this.maxY&&(this.maxY=r.y)}containsAll(n){for(let e of n)if(e.x<this.minX||e.x>this.maxX||e.y<this.minY||e.y>this.maxY)return!1;for(let e of this.rings){let r=!0;for(let o of n)if(!It(e,o.x,o.y)){r=!1;break}if(r)return!0}return!1}};function Gn(t,n,e,r,o,a){if(r.length<3)return;if(e.containsAll(r)){let c=[0,1,0],f=r[0];for(let m=1;m+1<r.length;m++){let u=r[m],h=r[m+1];t.tri([f.x*g,o,f.y*g],[u.x*g,o,u.y*g],[h.x*g,o,h.y*g],c,a)}return}let i=r.map(c=>[c.x,c.y]);i.push(i[0]);let s;try{s=Dn.intersection([i],n)}catch{return}let l=[0,1,0];for(let c of s){if(!c.length||c[0].length<4)continue;let f=c[0],m=[],u=[];for(let b=0;b<f.length-1;b++)m.push(f[b][0],f[b][1]),u.push([f[b][0],f[b][1]]);if(u.length<3)continue;let h=oo(m,void 0,2);for(let b=0;b<h.length;b+=3){let p=u[h[b]],d=u[h[b+1]],y=u[h[b+2]];t.tri([p[0]*g,o,p[1]*g],[d[0]*g,o,d[1]*g],[y[0]*g,o,y[1]*g],l,a)}}}function Vn(t,n,e,r,o,a,i){if(n.length<2)return;let s=i??Wt(n),l=[0,1,0],c=a&&a.length>=3?[[...a.map(h=>[h.x,h.y]),[a[0].x,a[0].y]]]:null,f=a&&a.length>=3?new sn([[...a]]):null,m=h=>{t.setMaterial(2),h(),t.setMaterial(0)},u=h=>{t.setMaterial(3),h(),t.setMaterial(0)};for(let h=0;h<n.length;h++){let b=n[h];if(b.patch&&b.patch.length>=3){let E=[...b.patch],M=s[h].belowY??r;if(u(()=>{if(c&&f)Gn(t,c,f,E,b.y,o.tread);else{let I=E[0];for(let B=1;B+1<E.length;B++){let k=E[B],D=E[B+1];t.tri([I.x*g,b.y,I.y*g],[k.x*g,b.y,k.y*g],[D.x*g,b.y,D.y*g],l,o.tread)}}}),b.y>M+On){let I=0,B=0;for(let k of E)I+=k.x,B+=k.y;I/=E.length,B/=E.length,m(()=>{for(let k=0;k<E.length;k++){let D=E[k],U=E[(k+1)%E.length],S=U.x-D.x,_=U.y-D.y,N=Math.hypot(S,_);if(N<1e-6)continue;let O=_/N,P=-S/N;(D.x-I)*O+(D.y-B)*P<0&&(O=-O,P=-P);let F=[O,0,P],R=[D.x*g,b.y,D.y*g],T=[U.x*g,b.y,U.y*g],C=[D.x*g,M,D.y*g],v=[U.x*g,M,U.y*g];t.tri(R,T,v,F,o.riser),t.tri(R,v,C,F,o.riser)}})}continue}let p=Xn(n,h,s,e);if(!p)continue;let{pts:d,nrm:y,front:x,back:w}=p,A=s[h].belowY??r;for(let E=0;E+1<d.length;E++){let M=d[E],I=d[E+1],B=y[E],k=y[E+1];if(Math.hypot(I.x-M.x,I.y-M.y)<1e-6||B[0]===0&&B[1]===0||k[0]===0&&k[1]===0)continue;let D=[(M.x-B[0]*x)*g,b.y,(M.y-B[1]*x)*g],U=[(I.x-k[0]*x)*g,b.y,(I.y-k[1]*x)*g],S=[(M.x+B[0]*w)*g,b.y,(M.y+B[1]*w)*g],_=[(I.x+k[0]*w)*g,b.y,(I.y+k[1]*w)*g];if(u(()=>{c&&f?Gn(t,c,f,[{x:M.x-B[0]*x,y:M.y-B[1]*x},{x:I.x-k[0]*x,y:I.y-k[1]*x},{x:I.x+k[0]*w,y:I.y+k[1]*w},{x:M.x+B[0]*w,y:M.y+B[1]*w}],b.y,o.tread):(t.tri(D,U,_,l,o.tread),t.tri(D,_,S,l,o.tread))}),b.y>A+On){let N=[D[0],A,D[2]],O=[U[0],A,U[2]],P=[-B[0],0,-B[1]];m(()=>{t.tri(D,U,O,P,o.riser),t.tri(D,O,N,P,o.riser)})}}}}function fo(t,n){let e=t.eventConfigurationIds;return!e?.length||!!n&&e.includes(n)}function Wn(t,n){return t.filter(e=>e.type!=="shape"||fo(e,n))}function Zn(t,n){let e=t.focalPoint??{x:0,y:0};return t.floors?.length?t.floors.map((r,o)=>({objects:Wn(r.objects,n),focal:{x:(r.focalPoint??e).x,y:(r.focalPoint??e).y},baseHeightM:r.baseHeightM??0,index:o})):[{objects:Wn(t.objects,n),focal:e,baseHeightM:0,index:0}]}var ho={minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};function Mt(t){return gn(t)??ho}function Kn(t,n){let e=jt(t.outline,ot),r=Mt(e),o=n.filter(i=>i!==t&&i.outline&&i.outline.length>=3&&Nt(r,Mt(i.outline)));if(!o.length)return[e];let a=i=>{let s=i.map(l=>[l.x,l.y]);return s.push(s[0]),s};try{let i=zn.difference([a(e)],...o.map(l=>[a(l.outline)])),s=[];for(let l of i){if(!l.length)continue;let c=l[0].map(([f,m])=>({x:f,y:m}));if(c.length>1){let f=c[0],m=c[c.length-1];Math.abs(f.x-m.x)<1e-9&&Math.abs(f.y-m.y)<1e-9&&c.pop()}c.length>=3&&s.push(c)}return s.length?s:[e]}catch{return[e]}}function $n(t,n){if(!n.length)return t;let e=a=>{let i=a.map(s=>[s.x,s.y]);return i.push(i[0]),i},r=n.map(a=>[e(a)]),o=[];for(let a of t){let i;try{i=zn.intersection([e(a.outline)],r.flat())}catch{o.push(a);continue}for(let s of i){if(!s.length)continue;let l=s[0].map(([c,f])=>({x:c,y:f}));if(l.length>1){let c=l[0],f=l[l.length-1];Math.abs(c.x-f.x)<1e-9&&Math.abs(c.y-f.y)<1e-9&&l.pop()}l.length>=3&&o.push({outline:l,holes:[],topY:a.topY})}}return o.length?o:t}function po(t,n){return t===void 0||n===void 0?!0:Math.abs(t-n)<.001}var zt=class{constructor(){this.rings=[];this.boxes=[];this.levels=[]}subtract(n,e){let r=n.map(l=>[l.x,l.y]);if(r.length<3)return[];r.push(r[0]);let o=Mt(n),a=this.rings.filter((l,c)=>Nt(o,this.boxes[c])&&po(e,this.levels[c])),i=[[r]];if(a.length)try{i=bo.difference([r],...a).map(c=>c.map(f=>f.map(([m,u])=>[m,u])))}catch{i=[[r]]}this.rings.push([r]),this.boxes.push(o),this.levels.push(e);let s=[];for(let l of i){if(!l.length)continue;let c=l[0].map(([f,m])=>({x:f,y:m}));if(c.length>1){let f=c[0],m=c[c.length-1];Math.abs(f.x-m.x)<1e-9&&Math.abs(f.y-m.y)<1e-9&&c.pop()}c.length>=3&&s.push(c)}return s}};function yo(t,n){if(!n)return t;let e=1/0,r=-1/0,o=1/0,a=-1/0;for(let m of t)e=Math.min(e,m.x),r=Math.max(r,m.x),o=Math.min(o,m.y),a=Math.max(a,m.y);let i=(e+r)/2,s=(o+a)/2,l=n*Math.PI/180,c=Math.cos(l),f=Math.sin(l);return t.map(m=>{let u=m.x-i,h=m.y-s;return{x:i+u*c-h*f,y:s+u*f+h*c}})}function bt(t){let n=null;if(t.kind==="polygon"&&t.points&&t.points.length>=3&&(n=t.points),t.kind==="rect"&&t.width&&t.height&&(n=Tt(t.x??0,t.y??0,t.width,t.height)),t.kind==="ellipse"&&t.width&&t.height){let e=(t.x??0)+t.width/2,r=(t.y??0)+t.height/2;n=Ht(e,r,t.width/2,t.height/2)}return n?yo(n,t.rotation):null}function Et(t){let n=t.role??"",e={stage:{kind:"stage",heightM:1},entrance:{kind:"portal",heightM:2.7},exit:{kind:"portal",heightM:2.7},screen:{kind:"solid",heightM:6},wall:{kind:"solid",heightM:2.8},rail:{kind:"solid",heightM:1.1},suite:{kind:"suite",heightM:3},obstruction:{kind:"solid",heightM:4.5},sound:{kind:"solid",heightM:1.45},restroom:{kind:"solid",heightM:2.4},bar:{kind:"solid",heightM:1.1},concession:{kind:"solid",heightM:1.1},coat:{kind:"solid",heightM:1.1},goal:{kind:"portal",heightM:1.8}},r=n==="stage"&&xn(t.stageKind)?{kind:"stage",heightM:.06}:e[n]??{kind:"plate",heightM:.25};return{...r,heightM:t.heightM??r.heightM}}var xo=.08;function qn(t,n){let e=bt(t),r=Et(t),o=r.heightM;if(!e||r.kind!=="plate"&&r.kind!=="stage")return o;let a=1/0,i=1/0,s=-1/0,l=-1/0;for(let f of e)a=Math.min(a,f.x),i=Math.min(i,f.y),s=Math.max(s,f.x),l=Math.max(l,f.y);let c=o;for(let f of n)s>f.minX&&a<f.maxX&&l>f.minY&&i<f.maxY&&c<=f.topOffsetM+1e-6&&(c=f.topOffsetM+xo);return n.push({minX:a,minY:i,maxX:s,maxY:l,topOffsetM:c}),c}function mt(t,n,e){return{x:t.x+(n.x-t.x)*e,y:t.y+(n.y-t.y)*e}}function Jn(t){if(t.length!==4)return t;let n=Math.hypot(t[1].x-t[0].x,t[1].y-t[0].y),e=Math.hypot(t[2].x-t[1].x,t[2].y-t[1].y);return n>=e?t:[t[1],t[2],t[3],t[0]]}function Ct(t,n,e){return[mt(t[0],t[1],n),mt(t[0],t[1],e),mt(t[3],t[2],e),mt(t[3],t[2],n)]}function Qn(t,n,e){return[mt(t[0],t[3],n),mt(t[1],t[2],n),mt(t[1],t[2],e),mt(t[0],t[3],e)]}function at(t,n,e,r,o,a){K(t,n,void 0,()=>e,r,o,a,W)}var an=2.4,go=.75,Mo=.15;function Ft(t){if(t.points&&t.points.length>=3)return t.points;let{center:n,width:e,height:r,rotation:o}=t;if(!e||!r)return null;let a=(o??0)*Math.PI/180,i=Math.cos(a),s=Math.sin(a),l=e/2,c=r/2;return[[-l,-c],[l,-c],[l,c],[-l,c]].map(([f,m])=>({x:n.x+f*i-m*s,y:n.y+f*s+m*i}))}function te(t,n,e,r,o){let a=Ft(n);a&&K(t,a,void 0,()=>e+an,e,st(r,o.boothTop),o.boothWall,W)}function cn(t){if(t.shape==="round"){let f=t.radius;return f?Ht(t.center.x,t.center.y,f,f,24):null}let{width:n,height:e,rotation:r,center:o}=t;if(!n||!e)return null;let a=(r??0)*Math.PI/180,i=Math.cos(a),s=Math.sin(a),l=n/2,c=e/2;return[[-l,-c],[l,-c],[l,c],[-l,c]].map(([f,m])=>({x:o.x+f*i-m*s,y:o.y+f*s+m*i}))}function ne(t,n,e,r,o){let a=cn(n);a&&K(t,a,void 0,()=>e+go,e,st(r,o.tableTop),o.tableWall,W)}function ee(t,n,e,r,o,a,i,s){let l=bt(n);if(!l)return;let c=s?s.kind==="stage":n.role==="stage",f=s?s.kind==="screen":n.role==="screen",m=s?{kind:c?"stage":"solid",heightM:s.topY-s.baseY}:Et(n),u=s?.baseY??e,h=s?.topY??e+r;if(c&&i){let x=1/0,w=-1/0,A=1/0,E=-1/0;for(let M of l)M.x<x&&(x=M.x),M.x>w&&(w=M.x),M.y<A&&(A=M.y),M.y>E&&(E=M.y);i.push({cx:(x+w)/2*g,cz:(A+E)/2*g,y:h,halfX:Math.max((w-x)/2*g,.5),halfZ:Math.max((E-A)/2*g,.5)})}let b=H(n.fill),p=c&&b?nt(o.stageTop,et(Pt(b,.18),.9),.9):st(b,c?o.stageTop:o.decorTop),d=f?b:null,y=c?b?nt(o.stageWall,et(b,.58),.82):o.stageWall:f?d?nt(et(d,1.42),[.24,.46,.82],.08):[.24,.46,.82]:st(H(n.fill),o.decorWall);if(m.kind==="portal"&&l.length===4){let x=Jn(l);at(t,Ct(x,0,.16),h,u,p,y),at(t,Ct(x,.84,1),h,u,p,y),at(t,x,h,Math.max(u,h-.35),p,y);return}if(m.kind==="suite"&&l.length===4){let x=l.map((E,M)=>{let I=l[(M+1)%4],B=(E.x+I.x)/2,k=(E.y+I.y)/2;return Math.hypot(B-a.x,k-a.y)}),w=x.indexOf(Math.min(...x)),A=[0,1,2,3].map(E=>l[(w+E)%4]);at(t,Ct(A,0,.08),h,u,p,y),at(t,Ct(A,.92,1),h,u,p,y),at(t,Qn(A,.88,1),h,u,p,y),at(t,A,h,Math.max(u,h-.18),p,y);return}at(t,l,h,u,p,y)}function un(t){let{x:n,y:e,width:r,height:o}=t;if(!r||!o)return null;let a=n+r/2,i=e+o/2,s=(t.rotation??0)*Math.PI/180,l=Math.cos(s),c=Math.sin(s),f=r/2,m=o/2;return[[-f,-m],[f,-m],[f,m],[-f,m]].map(([u,h])=>({x:a+u*l-h*c,y:i+u*c+h*l}))}function So(t){if(!t||!t.startsWith("data:image/svg+xml"))return null;let n=t.slice(t.indexOf(",")+1);if(/;base64/i.test(t.slice(0,t.indexOf(","))))try{n=atob(n)}catch{return null}else try{n=decodeURIComponent(n)}catch{}let e=n.match(/<(?:rect|path)\b[^>]*\bfill="([^"]+)"/i);if(!e)return null;let r=e[1].trim();if(r==="none"||r==="transparent")return null;let o=r.match(/^url\(#([^)]+)\)$/);if(!o)return H(r);let a=n.match(new RegExp(`<(?:linear|radial)Gradient\\b[^>]*\\bid="${o[1]}"[^>]*>([\\s\\S]*?)</(?:linear|radial)Gradient>`,"i"));if(!a)return null;let i=[];for(let s of a[1].matchAll(/stop-color="([^"]+)"/gi)){let l=H(s[1].trim());l&&i.push(l)}return i.length?i.reduce((s,l,c)=>nt(s,l,1/(c+1)),i[0]):null}function oe(t,n,e,r){if(n.layer==="foreground")return;let o=un(n);if(!o)return;let a=e+Mo,i=st(So(n.href),r.decorTop),s=Math.max(0,Math.min(1,n.opacity??1));s<1&&(i=nt(r.ground,i,s)),K(t,o,void 0,()=>a,e,i,nt(i,r.decorWall,.5),W)}function re(t,n,e,r,o){if(!n.points||n.points.length<3)return;let a=st(r,o.gaTop);K(t,n.points,n.holes,()=>e+.15,e,a,o.gaWall,W)}var Ro=6,Ao=2.2,ie=.1,Po=.3,Io=1.8,wo=.9,_o=.55,To=6e3;function se(t){let{doc:n,units:e,seats:r,surfaces:o,focal:a}=t,i=n.zones??[],s=[];if(i.length){let l=new Map;for(let f of e)for(let m of f.objects)m.type==="section"&&m.zone&&l.set(m.id,m.zone);let c=new Map;for(let f=0;f<r.length;f++){let m=r[f],u=o.seatOwner[f],h=m.zoneId??(u?l.get(u):void 0);if(!h)continue;let b=c.get(h);b||(b={n:0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0,sumY:0},c.set(h,b)),b.n++,m.x<b.minX&&(b.minX=m.x),m.y<b.minY&&(b.minY=m.y),m.x>b.maxX&&(b.maxX=m.x),m.y>b.maxY&&(b.maxY=m.y),b.sumY+=o.seatDeckY(f)}for(let f of i){let m=c.get(f.id),u=[];for(let[h,b]of l)b===f.id&&u.push(h);if(!m||m.n===0){s.push({id:f.id,label:f.label,color:H(f.color),sectionIds:u,seatCount:0,center:[0,0,0],radius:0,focalWorld:[(f.focalPoint??a).x*g,1.5,(f.focalPoint??a).y*g]});continue}s.push({id:f.id,label:f.label,color:H(f.color),sectionIds:u,seatCount:m.n,center:[(m.minX+m.maxX)/2*g,m.sumY/m.n,(m.minY+m.maxY)/2*g],radius:.5*Math.hypot((m.maxX-m.minX)*g,(m.maxY-m.minY)*g)||1,focalWorld:[(f.focalPoint??a).x*g,1.5,(f.focalPoint??a).y*g]})}}return s}function ae(t){let{doc:n,units:e,seats:r,surfaces:o,seatData:a,hintedSeatFloor:i,zones:s,focal:l}=t,c=[],f=[],m=[];for(let u of s)u.seatCount!==0&&c.push({id:`zone:${u.id}`,kind:"zone",text:u.label,anchor:[u.center[0],u.center[1]+Ro,u.center[2]],color:n.zones?.find(h=>h.id===u.id)?.color});{let u=new Map,h=new Map;for(let b=0;b<r.length;b++){let p=o.seatOwner[b];if(!p)continue;let d=u.get(p);d||(d={n:0,x:0,y:0,deck:0},u.set(p,d)),d.n++,d.x+=r[b].x,d.y+=r[b].y,d.deck+=o.seatDeckY(b);let y=h.get(p);y||(y={minX:1/0,maxX:-1/0,minY:1/0,maxY:-1/0},h.set(p,y)),r[b].x<y.minX&&(y.minX=r[b].x),r[b].x>y.maxX&&(y.maxX=r[b].x),r[b].y<y.minY&&(y.minY=r[b].y),r[b].y>y.maxY&&(y.maxY=r[b].y)}for(let b of e)for(let p of b.objects){if(p.type!=="section")continue;let d=u.get(p.id);if(!d||d.n===0)continue;let y=h.get(p.id),x=[d.x/d.n*g,d.deck/d.n,d.y/d.n*g],w=p.displayLabel||p.label||p.id;f.push({id:p.id,floorIndex:b.index,label:w,seatCount:d.n,center:x,radius:Math.max(1,Math.hypot(y.maxX-y.minX,y.maxY-y.minY)*.5*g),focalWorld:[b.focal.x*g,b.baseHeightM+1.5,b.focal.y*g]});let A=n.floors?.[b.index]?.name?.trim().toLocaleLowerCase();e.length>1&&A===w.trim().toLocaleLowerCase()||c.push({id:`section:${p.id}`,kind:"section",text:w,anchor:[x[0],x[1]+Ao,x[2]],floorIndex:b.index})}}{for(let p of e)for(let d of p.objects){if(d.type!=="gaArea")continue;let y=At(d.points);if(!y)continue;let x=d.displayLabel||d.label||d.id;c.push({id:`ga:${d.id}`,kind:"ga",text:d.capacity>0?`${x} \xB7 ${d.capacity.toLocaleString()}`:x,anchor:[y.x*g,p.baseHeightM+Io,y.y*g],floorIndex:p.index})}let u=new Map;for(let p of e)for(let d of p.objects)d.type==="section"&&u.set(d.id,d.displayLabel||d.label||d.id);let h=new Map;for(let p=0;p<r.length;p++){let d=r[p],y=Math.hypot(d.x-l.x,d.y-l.y),x=h.get(d.rowId);(!x||y>x.far)&&h.set(d.rowId,{seat:d,index:p,far:y})}for(let[p,d]of h){let y=Eo(d.seat.label,p,u.get(d.seat.sectionId??""));y&&c.push({id:`row:${p}`,kind:"row",text:y,anchor:[d.seat.x*g,o.seatDeckY(d.index)+wo,d.seat.y*g],floorIndex:i[d.index]})}let b=new Map;for(let p=0;p<r.length;p++){let d=r[p],y=d.label?d.label.lastIndexOf("-"):-1,x=b.get(d.rowId);x||(x={n:0,x:0,y:0,z:0,minX:1/0,maxX:-1/0,minZ:1/0,maxZ:-1/0,label:y>0?d.label.slice(0,y):d.rowId,sectionId:d.sectionId},b.set(d.rowId,x));let w=p*3,A=a.iPosition[w],E=a.iPosition[w+1],M=a.iPosition[w+2];x.n++,x.x+=A,x.y+=E,x.z+=M,x.minX=Math.min(x.minX,A),x.maxX=Math.max(x.maxX,A),x.minZ=Math.min(x.minZ,M),x.maxZ=Math.max(x.maxZ,M)}for(let[p,d]of b)m.push({id:p,label:d.label,sectionId:d.sectionId,seatCount:d.n,center:[d.x/d.n,d.y/d.n,d.z/d.n],radius:Math.max(.8,Math.hypot(d.maxX-d.minX,d.maxZ-d.minZ)*.5)});if(r.length<=To)for(let p=0;p<r.length;p++){let d=r[p],y=Bo(d.displayLabel||d.label);y&&c.push({id:`seat:${d.id}`,kind:"seat",text:y,anchor:[d.x*g,o.seatDeckY(p)+_o,d.y*g],floorIndex:i[p]})}}for(let u of e)for(let h of u.objects)if(h.type==="shape"&&h.role&&["entrance","exit","screen","suite","obstruction"].includes(h.role)){let b=bt(h),p=b?At(b):null;if(!p||!h.label)continue;c.push({id:`architecture:${h.id}`,kind:"annotation",text:h.label,anchor:[p.x*g,u.baseHeightM+Et(h).heightM+ie,p.y*g],color:h.fill,floorIndex:u.index})}else if(h.type==="text"){if(!h.text)continue;c.push({id:`text:${h.id}`,kind:"annotation",text:h.text,anchor:[h.position.x*g,u.baseHeightM+ie,h.position.y*g],color:h.color,rotation:h.rotation,floorIndex:u.index})}else if(h.type==="booth"){let b=Ft(h);if(!b)continue;let p=At(b);if(!p)continue;c.push({id:`booth:${h.id}`,kind:"booth",text:h.displayLabel||h.label||h.id,anchor:[p.x*g,u.baseHeightM+an+Po,p.y*g],floorIndex:u.index})}return{labels:c,sections:f,rows:m}}function ce(t,n){if(n.length>1)for(let e of n)t.push({id:`floor:${e.id}`,kind:"floor",text:e.label,anchor:[e.center[0],e.box.max[1]+1.2,e.center[2]],floorIndex:e.index})}function Bo(t){let n=t.lastIndexOf("-");return n>=0&&n<t.length-1?t.slice(n+1):t}function Eo(t,n,e){let r=t?t.lastIndexOf("-"):-1,o=r>0?t.slice(0,r):n;return o&&An(o,e)}var Co=.15,Fo=.9,vo=1.76;function ko(){return{background:{top:[...nn.top],bottom:[...nn.bottom]},structure:tn,seatStates:{...Bn},seatScale:1,materials:{seat:null,shell:null,roughness:.78}}}function ue(t){let n=ko();if(!t)return n;let e=H(t.background);if(e){n.background={top:et(e,Fo),bottom:et(e,vo)};let i={};for(let[s,l]of Object.entries(tn))i[s]=nt(l,e,Co);n.structure=i}let r=H(t.selectionColor)??H(t.accent);r&&(n.seatStates={...n.seatStates,selected:r});let o=t.seatScale;typeof o=="number"&&Number.isFinite(o)&&(n.seatScale=Rn(o));let a=t.venue3d;if(a){let i=H(a.deck),s=H(a.fascia);i&&(n.structure={...n.structure,tierTop:i,gaTop:i}),s&&(n.structure={...n.structure,tierWall:s,gaWall:s}),n.materials.seat=H(a.seat),n.materials.shell=H(a.shell),typeof a.roughness=="number"&&Number.isFinite(a.roughness)&&(n.materials.roughness=Math.min(1,Math.max(0,a.roughness)))}return n}function le(t,n){let e=[];for(let r of n)e.push(...t.seatStates[r]);return e}var Oo=.05,me=.05,Lo=.15,ln=25;function fe(t,n,e){let r=new Map,o=new Array(n.length).fill(null),a=new Float64Array(n.length),i=new Array(n.length).fill(void 0),s=new Array(n.length).fill(void 0),l=new Map,c=[],f=new Set;for(let u=0;u<t.length;u+=1){let h=t[u];for(let b of h.objects){if(b.type==="table"&&f.add(b.id),b.type!=="section"||!b.outline||b.outline.length<3)continue;let p=jt(b.outline,ot);l.set(b.id,{section:b,unit:h,frontU:1/0,hasSeats:!1,rows:new Map,seatIndices:[]}),c.push({id:b.id,floorIndex:u,box:Mt(p),section:b,unit:h,outline:p})}}let m=new Map;for(let u of c){let h=m.get(u.floorIndex);h?h.push(u):m.set(u.floorIndex,[u])}for(let u=0;u<n.length;u++){let h=n[u],b=e?m.get(e[u])??[]:c,p=h.sectionId?b.find(y=>y.id===h.sectionId)??b.find(y=>y.section.logicalSectionId===h.sectionId&&qt({x:h.x,y:h.y},y.outline,y.section.holes)):void 0,d=p?[p]:b;for(let y of d){if(e&&y.floorIndex!==e[u]||!p&&(h.x<y.box.minX||h.x>y.box.maxX||h.y<y.box.minY||h.y>y.box.maxY||!qt({x:h.x,y:h.y},y.outline,y.section.holes)))continue;o[u]=y.id;let x=l.get(y.id);x.hasSeats=!0;let w=h.focalPoint??y.unit.focal,A=Math.hypot(h.x-w.x,h.y-w.y);A<x.frontU&&(x.frontU=A),x.seatIndices.push(u);let E=h.rowId||`__seat-${u}`,M=x.rows.get(E);M?M.push({x:h.x,y:h.y}):x.rows.set(E,[{x:h.x,y:h.y}]);break}}for(let[u,h]of l){let b=dn(h.section,{floorBaseHeightM:h.unit.baseHeightM}),p=h.unit.baseHeightM,d=b.rake>0?Math.tan(b.rake*Math.PI/180):0,y=b.rake<=.01&&b.height<=p+.001,x=h.section.surfaceKind,w=x==="flat"?!0:x==="rakedRows"&&b.rake>.01?!1:y,A=h.hasSeats?yn(u,n,h.seatIndices,h.unit.focal):{sectionId:u,rows:[],blockCount:0},M=A.rows.length<2?Pn([...h.rows.values()].map(R=>({points:R})),h.unit.focal):null,I=1/0;if(M){if(h.hasSeats)for(let R of h.rows.values())for(let T of R){let C=M.depthAt(T.x,T.y);C<I&&(I=C)}if(!h.hasSeats||!Number.isFinite(I)){I=1/0;for(let R of h.section.outline){let T=M.depthAt(R.x,R.y);T<I&&(I=T)}}}let B=p+Oo,k=Math.max(B,b.height),D=R=>{let T=Math.max(0,R-I)*ut,C=Math.min(T*d,ln);return Math.max(B,b.height+C)},U=R=>{let T=Math.max(0,R)*ut,C=Math.min(T*d,ln);return Math.max(B,b.height+C)},S=w?[]:A.rows.map(R=>({pts:R.pts,y:U(R.blockDepth),depth:R.blockDepth,blockId:R.blockId,...f.has(R.id)?{patch:Nn(R.pts,ot)}:{}})),_=S.length?S[0].y:k,N=S.map(R=>{let T=R.patch&&R.patch.length>=3?R.patch:R.pts,C=0,v=0;for(let L of T)C+=L.x,v+=L.y;let G=T.length||1;C/=G,v/=G;let X=0;for(let L of T){let Y=Math.hypot(L.x-C,L.y-v);Y>X&&(X=Y)}return{cx:C,cy:v,rad:X}}),O=w?()=>k:S.length>=2?(R,T)=>{let C=1/0,v=_;for(let G=0;G<S.length;G++){let X=N[G];if(Math.hypot(R-X.cx,T-X.cy)-X.rad>=C)continue;let L=S[G].patch,Y=L&&L.length>=3?It(L,R,T)?0:Dt(L,R,T):Dt(S[G].pts,R,T);Y<C&&(C=Y,v=S[G].y)}return v}:(R,T)=>M?D(M.depthAt(R,T)):k,P=[0,1,0],F=S.length>=2||w?()=>P:(R,T)=>{if(!M)return P;let C=M.depthAt(R,T);if(C<=I)return P;let v=(C-I)*ut;if(v*d>=ln||b.height+v*d<=B)return P;let[G,X]=M.gradientAt(R,T);if(G===0&&X===0)return P;let L=1/Math.hypot(d,1);return[-G*d*L,L,-X*d*L]};if(!w)for(let R of A.rows){let T=U(R.blockDepth);for(let C of R.seatIndices)i[C]=T}for(let R of A.rows){let T=[];for(let L=1;L<R.pts.length;L++){let Y=Math.hypot(R.pts[L].x-R.pts[L-1].x,R.pts[L].y-R.pts[L-1].y);Y>1e-6&&T.push(Y)}T.sort((L,Y)=>L-Y);let C=T.length?T[Math.floor(T.length/2)]:1/0,v=1/0,G=R.pts[Math.floor(R.pts.length/2)];if(G)for(let L of A.rows){if(L===R||L.blockId!==R.blockId)continue;let Y=Dt(L.pts,G.x,G.y);Y>1e-6&&Y<v&&(v=Y)}let X=Math.min(C,Math.max(v,C*.5));if(Number.isFinite(X)&&X>0)for(let L of R.seatIndices)s[L]=X}r.set(u,{sectionId:u,deckAt:O,normalAt:F,flat:w,bottomY:p,rowLevels:S,landingY:_})}for(let u=0;u<n.length;u++){let h=o[u],b=n[u];if(h){let d=i[u];a[u]=(d??r.get(h).deckAt(b.x,b.y))+Lo;continue}let p=b.eyeHeightM;a[u]=Number.isFinite(p)?Math.max(0,p-Gt):0}return{bySection:r,seatOwner:o,seatDeckY:u=>a[u],seatPitchU:u=>s[u]}}var Go=.25,Do=1.2,No=.6,Xo=.45,Uo=2.3,Yo=Math.PI/180;function pt(t,n,e){let r=e*Yo;return{x:t.x+n*Math.sin(r),y:t.y+n*Math.cos(r)}}function jo(t,n){let e=n.rings[n.rings.length-1];if(!e)return!1;let r=e.outerRMedian*.85;for(let o of t){if(o.role!=="wall")continue;let a=o.points&&o.points.length>=2?o.points:o.x!==void 0&&o.y!==void 0&&o.width!==void 0&&o.height!==void 0?[{x:o.x,y:o.y},{x:o.x+o.width,y:o.y},{x:o.x+o.width,y:o.y+o.height},{x:o.x,y:o.y+o.height}]:[];if(a.length<2)continue;let i=0;for(let s of a)Math.hypot(s.x-n.centre.x,s.y-n.centre.y)>=r&&i++;if(i>=a.length/2)return!0}return!1}var Ho=24;function Vo(t,n,e,r,o,a,i,s){let l=e.binCount,c=Ho,f=ut,m=a+.02,u=[];for(let S=0;S<l;S++){let _=(e.startBin+S+.5)*n.binStepDeg,N=new Float64Array(c+1);for(let O=0;O<=c;O++){let P=r[S]+(o[S]-r[S])*O/c;N[O]=Math.max(m,wn(n,e,_,P)-Go)}u.push(N)}let h=[i.bandTop[0]*s.top,i.bandTop[1]*s.top,i.bandTop[2]*s.top],b=[i.bandTop[0]*s.bottomCap,i.bandTop[1]*s.bottomCap,i.bandTop[2]*s.bottomCap],p=[i.bandWall[0]*s.top,i.bandWall[1]*s.top,i.bandWall[2]*s.top],d=[i.bandWall[0]*s.wallBottom,i.bandWall[1]*s.wallBottom,i.bandWall[2]*s.wallBottom],y=(S,_)=>{let N=(e.startBin+S+.5)*n.binStepDeg,O=r[S]+(o[S]-r[S])*_/c,P=pt(n.centre,O,N);return[P.x*f,u[S][_],P.y*f]};{let S=Math.tan(12*Math.PI/180);for(let _=0;_<6;_++){let N=!1;for(let P=0;P<l;P++)for(let F=c-1;F>=0;F--)u[P][F]>u[P][F+1]&&(u[P][F]=u[P][F+1],N=!0);let O=e.closed?l:l-1;for(let P=0;P<O;P++){let F=(P+1)%l;for(let R=0;R<=c;R++){let T=u[F][R]-u[P][R];if(Math.abs(T)>1)continue;let C=r[P]+(o[P]-r[P])*R/c,v=r[F]+(o[F]-r[F])*R/c,G=pt(n.centre,C,(e.startBin+P+.5)*n.binStepDeg),X=pt(n.centre,v,(e.startBin+F+.5)*n.binStepDeg),L=S*Math.hypot(X.x-G.x,X.y-G.y)*f;T>L?(u[F][R]=u[P][R]+L,N=!0):-T>L&&(u[P][R]=u[F][R]+L,N=!0)}}if(!N)break}}let x=1,w=(S,_)=>{for(let N=0;N<=c;N+=4)if(Math.abs(u[S][N]-u[_][N])>x)return!0;return Math.abs(u[S][c]-u[_][c])>x},A=Math.tan(38*Math.PI/180),E=S=>(o[S]-r[S])/c*f,M=(S,_)=>u[S][_+1]-u[S][_]>A*Math.max(1e-6,E(S)),I=(S,_)=>{let N=e.closed?(S-1+l)%l:Math.max(0,S-1),O=e.closed?(S+1)%l:Math.min(l-1,S+1);Math.abs(u[N][_]-u[S][_])>x&&(N=S),Math.abs(u[O][_]-u[S][_])>x&&(O=S);let P=Math.max(0,_-1),F=Math.min(c,_+1);P<_&&M(S,P)&&(P=_),F>_&&M(S,_)&&(F=_);let R=y(N,_),T=y(O,_),C=y(S,P),v=y(S,F),G=T[0]-R[0],X=T[1]-R[1],L=T[2]-R[2],Y=v[0]-C[0],j=v[1]-C[1],$=v[2]-C[2],z=X*$-L*j,q=L*Y-G*$,tt=G*j-X*Y,Z=Math.hypot(z,q,tt);return Z>1e-12?(z/=Z,q/=Z,tt/=Z,q<0&&(z=-z,q=-q,tt=-tt),[z,q,tt]):[0,1,0]},B=(S,_)=>{let N=[S[0],a,S[2]],O=[_[0],a,_[2]],P=_[0]-S[0],F=_[2]-S[2],R=Math.hypot(P,F);if(!(R>1e-12))return;let T=[F/R,0,-P/R];t.tri(S,_,O,T,p,p,d),t.tri(S,O,N,T,p,d,d)},k=.05*lt,D=S=>o[S]-r[S]<k,U=e.closed?l:l-1;for(let S=0;S<U;S++){let _=(S+1)%l;if(D(S)||D(_))continue;if(w(S,_)){let T=(e.startBin+S+1)*n.binStepDeg,C=(j,$)=>{let z=(r[S]+r[_])/2,q=(o[S]+o[_])/2,tt=z+(q-z)*$/c,Z=pt(n.centre,tt,T);return[Z.x*f,u[j][$],Z.y*f]};for(let j=0;j<c;j++){let $=y(S,j),z=y(S,j+1),q=C(S,j),tt=C(S,j+1),Z=I(S,j),it=I(S,j+1);t.triN($,q,tt,Z,Z,it,h),t.triN($,tt,z,Z,it,it,h);let vt=y(_,j),kt=y(_,j+1),dt=C(_,j),St=C(_,j+1),yt=I(_,j),xt=I(_,j+1);t.triN(dt,vt,kt,yt,yt,xt,h),t.triN(dt,kt,St,yt,xt,xt,h);let ct=C(S,j),rt=C(S,j+1),Ot=C(_,j+1),Kt=C(_,j),Lt=rt[0]-ct[0],Rt=rt[2]-ct[2],$t=Math.hypot(Lt,Rt);if($t>1e-12){let fn=[Rt/$t,0,-Lt/$t];t.tri(ct,rt,Ot,fn,p),t.tri(ct,Ot,Kt,fn,p)}}let v=y(S,0),G=y(_,0),X=y(_,c),L=y(S,c),Y=j=>[j[0],a,j[2]];t.tri(Y(v),Y(X),Y(G),[0,-1,0],b),t.tri(Y(v),Y(L),Y(X),[0,-1,0],b),B(v,G),B(L,X);continue}for(let T=0;T<c;T++){let C=I(S,T),v=I(_,T),G=I(_,T+1),X=I(S,T+1);if(M(S,T)||M(_,T)){let z=(rt,Ot)=>{let Kt=(e.startBin+rt+.5)*n.binStepDeg,Lt=r[rt]+(o[rt]-r[rt])*(T+.5)/c,Rt=pt(n.centre,Lt,Kt);return[Rt.x*f,Ot,Rt.y*f]},q=y(S,T),tt=y(_,T),Z=z(S,u[S][T]),it=z(_,u[_][T]);t.triN(q,tt,it,C,v,v,h),t.triN(q,it,Z,C,v,C,h);let vt=y(_,T+1),kt=y(S,T+1),dt=z(S,u[S][T+1]),St=z(_,u[_][T+1]);t.triN(dt,St,vt,X,G,G,h),t.triN(dt,vt,kt,X,G,X,h);let yt=it[0]-Z[0],xt=it[2]-Z[2],ct=Math.hypot(yt,xt);if(ct>1e-12){let rt=[-xt/ct,0,yt/ct];t.tri(Z,it,St,rt,p),t.tri(Z,St,dt,rt,p)}continue}let L=y(S,T),Y=y(_,T),j=y(_,T+1),$=y(S,T+1);t.triN(L,Y,j,C,v,G,h),t.triN(L,j,$,C,G,X,h)}let N=y(S,0),O=y(_,0),P=y(_,c),F=y(S,c),R=T=>[T[0],a,T[2]];t.tri(R(N),R(P),R(O),[0,-1,0],b),t.tri(R(N),R(F),R(P),[0,-1,0],b),B(N,O),B(F,P)}if(!e.closed)for(let S of[0,l-1])for(let _=0;_<c;_++)B(y(S,_),y(S,_+1))}function he(t,n,e){let{bottomY:r,colors:o,ao:a}=e,i=new Float64Array(n.binCount).fill(-1/0);for(let f of n.rings)for(let m of f.arcs){let u=new Float64Array(m.binCount),h=new Float64Array(m.binCount);for(let p=0;p<m.binCount;p++){let d=(m.startBin+p)%n.binCount,y=Math.max(0,m.innerR[p]-ot);u[p]=Math.max(y,i[d]+.001),h[p]=Math.max(u[p]+.001,m.outerR[p]+ot)}let b=0;for(let p=0;p<m.binCount;p++){let d=m.topLevelM[p]-r;d>b&&(b=d)}b>=Do&&Vo(t,n,m,u,h,r,o,a);for(let p=0;p<m.binCount;p++){let d=(m.startBin+p)%n.binCount;h[p]>i[d]&&(i[d]=h[p])}}if(e.deriveShell===!1||jo(e.shapes,n))return;let s=n.rings[n.rings.length-1],l=No*lt,c=Xo*lt;for(let f of s.arcs){let m=[],u=[];for(let p=0;p<f.binCount;p++){let d=(f.startBin+p+.5)*n.binStepDeg,y=f.outerR[p]+ot+l;m.push(pt(n.centre,y,d)),u.push(pt(n.centre,y+c,d))}let h=-1/0;for(let p=0;p<f.binCount;p++)f.topLevelM[p]>h&&(h=f.topLevelM[p]);let b=()=>h+Uo;f.closed?K(t,u,[m.slice().reverse()],b,r,o.shellTop,o.shellWall,a):K(t,[...u,...m.slice().reverse()],void 0,b,r,o.shellTop,o.shellWall,a)}}function be(t,n,e,r,o,a,i,s){if(!n.outline||n.outline.length<3)return;let l=e.baseHeightM,c=st(r,s.tierTop);if(!o)return;let f=d=>o.deckAt(d.x,d.y),m=Kn(n,i),u=m[0]??n.outline;if(o.rowLevels.length>=2){let d=Wt(o.rowLevels),y=$n(jn(o.rowLevels,e.focal,d),m),x=()=>[0,1,0];for(let A of y){let E=Math.max(l,A.topY-.02);for(let M of a.subtract(A.outline,E))K(t,M,A.holes,()=>E,l,c,s.tierWall,W,void 0,x)}y.length||K(t,u,n.holes,()=>o.landingY,l,c,s.tierWall,W);let w={tread:[c[0]*W.top,c[1]*W.top,c[2]*W.top],riser:[c[0]*.72,c[1]*.72,c[2]*.72]};for(let A of m.length?m:[u])Vn(t,o.rowLevels,e.focal,o.landingY,w,A,d);return}let h=o.flat?1/0:me,b=d=>o.normalAt(d.x,d.y),p=o.flat?o.landingY:void 0;for(let d of a.subtract(u,p))K(t,d,n.holes,f,l,c,s.tierWall,W,h,b)}function Wo(t,n,e){let r=new Set;for(let i of t.objects)i.type==="section"&&r.add(i.id);let o=new Map;for(let i=0;i<n.length;i++){let s=e.seatOwner[i];if(!s||!r.has(s))continue;let l=e.bySection.get(s);if(l&&l.rowLevels.length>=2)continue;let c=n[i],f=o.get(s);f||(f=new Map,o.set(s,f));let m=c.rowId||`__seat-${i}`,u=f.get(m);u||(u={pts:[],levelM:0,n:0},f.set(m,u)),u.pts.push({x:c.x,y:c.y}),u.levelM+=e.seatDeckY(i),u.n++}let a=[];for(let i of t.objects){if(i.type!=="section")continue;let s=e.bySection.get(i.id);if(s&&s.rowLevels.length>=2){let c=s.rowLevels.filter(f=>!f.patch).map(f=>({pts:f.pts,levelM:f.y}));c.length>=2&&a.push({sectionId:i.id,rows:c});continue}let l=o.get(i.id);l&&a.push({sectionId:i.id,rows:[...l.values()].map(c=>({pts:c.pts,levelM:c.levelM/c.n}))})}return a}function pe(t,n,e,r,o,a,i=!0){let s=Wo(n,e,r);if(!s.length)return;let l=In(s,n.focal);l&&(t.setMaterial(0),he(t,l,{bottomY:n.baseHeightM,colors:{bandTop:et(o.tierTop,.8),bandWall:o.tierWall,shellTop:a??et(o.tierWall,1.15),shellWall:a??o.tierWall},ao:W,shapes:n.objects.filter(c=>c.type==="shape"),deriveShell:i}))}function de(t){let{doc:n,units:e,seats:r,surfaces:o,solids:a,hintedSeatFloor:i,seatFloor:s}=t,l=[];{let c=e.map(()=>({minX:1/0,minY:1/0,minZ:1/0,maxX:-1/0,maxY:-1/0,maxZ:-1/0}));for(let u=0;u<a.floor.length;u+=1){let h=Math.max(0,Math.min(e.length-1,Math.round(a.floor[u]))),b=u*3,p=c[h];p.minX=Math.min(p.minX,a.position[b]),p.minY=Math.min(p.minY,a.position[b+1]),p.minZ=Math.min(p.minZ,a.position[b+2]),p.maxX=Math.max(p.maxX,a.position[b]),p.maxY=Math.max(p.maxY,a.position[b+1]),p.maxZ=Math.max(p.maxZ,a.position[b+2])}let f=new Map;for(let u=0;u<e.length;u++)for(let h of e[u].objects)h.type==="section"&&f.set(h.id,u);let m=e.map(()=>({n:0,minX:1/0,minY:1/0,minDeck:1/0,maxX:-1/0,maxY:-1/0,maxDeck:-1/0,sumX:0,sumDeck:0,sumZ:0}));for(let u=0;u<r.length;u++){let h=o.seatOwner[u],b=(h!==null?f.get(h):void 0)??i[u];if(b===void 0)continue;let p=m[b],d=r[u];p.n++,d.x<p.minX&&(p.minX=d.x),d.y<p.minY&&(p.minY=d.y),d.x>p.maxX&&(p.maxX=d.x),d.y>p.maxY&&(p.maxY=d.y);let y=o.seatDeckY(u);p.sumX+=d.x*g,p.sumDeck+=y,p.sumZ+=d.y*g,p.minDeck=Math.min(p.minDeck,y),p.maxDeck=Math.max(p.maxDeck,y+1.6),s[u]=b}for(let u=0;u<e.length;u++){let h=m[u],b=n.floors?.[u],p=c[u],d=Math.min(h.n?h.minX*g:e[u].focal.x*g-1,Number.isFinite(p.minX)?p.minX:1/0),y=Math.max(h.n?h.maxX*g:e[u].focal.x*g+1,Number.isFinite(p.maxX)?p.maxX:-1/0),x=Math.min(h.n?h.minY*g:e[u].focal.y*g-1,Number.isFinite(p.minZ)?p.minZ:1/0),w=Math.max(h.n?h.maxY*g:e[u].focal.y*g+1,Number.isFinite(p.maxZ)?p.maxZ:-1/0),A=Math.min(h.n?Math.min(e[u].baseHeightM,h.minDeck):e[u].baseHeightM,Number.isFinite(p.minY)?p.minY:1/0),E=Math.max(h.n?Math.max(h.maxDeck,A+.5):A+.5,Number.isFinite(p.maxY)?p.maxY:-1/0),M=[h.n?h.sumX/h.n:(d+y)/2,h.n?h.sumDeck/h.n:(A+E)/2,h.n?h.sumZ/h.n:(x+w)/2],I=Math.max(1,.5*Math.hypot(y-d,E-A,w-x));l.push({index:u,id:b?.id??`floor-${u}`,label:b?.name??(e.length>1?`Floor ${u+1}`:"Venue"),seatCount:h.n,center:M,radius:I,box:{min:[d,A,x],max:[y,E,w]},focalWorld:[e[u].focal.x*g,e[u].baseHeightM+1.5,e[u].focal.y*g]})}}return l}function mn(t,n){let e=1/0,r=1/0,o=-1/0,a=-1/0,i=(s,l)=>{s<e&&(e=s),l<r&&(r=l),s>o&&(o=s),l>a&&(a=l)};for(let s of n)i(s.x,s.y);for(let s of t)for(let l of s.objects)if(l.type==="section")for(let c of l.outline)i(c.x,c.y);else if(l.type==="shape"&&l.points)for(let c of l.points)i(c.x,c.y);else if(l.type==="gaArea")for(let c of l.points)i(c.x,c.y);else if(l.type==="booth"){let c=Ft(l);if(c)for(let f of c)i(f.x,f.y)}else if(l.type==="table"){let c=cn(l);if(c)for(let f of c)i(f.x,f.y)}else if(l.type==="decorImage"){let c=un(l);if(c)for(let f of c)i(f.x,f.y)}return Number.isFinite(e)||(e=-100,r=-100,o=100,a=100),{minX:e,minY:r,maxX:o,maxY:a}}function ye(t,n,e,r,o,a){if(n.length===1){let i=Math.max(60,(o.maxX-o.minX+o.maxY-o.minY)*.06),s=Tt(o.minX-i,o.minY-i,o.maxX-o.minX+i*2,o.maxY-o.minY+i*2);K(t,s,void 0,()=>0,-.4,a.ground,a.ground,W)}else{let i=n.reduce((h,b)=>b.baseHeightM<h.baseHeightM?b:h);t.setFloor(i.index);let s=e.filter((h,b)=>r[b]===i.index),l=mn([i],s),c=Math.hypot(l.maxX-l.minX,l.maxY-l.minY),f=Math.max(28,Math.min(80,c*.04)),m=Tt(l.minX-f,l.minY-f,l.maxX-l.minX+f*2,l.maxY-l.minY+f*2),u=i.baseHeightM-.03;K(t,m,void 0,()=>u,u-.22,a.ground,a.ground,W)}}function xe(t,n,e){let{cx:r,cz:o,radius:a}=e,i=1/0,s=1/0,l=1/0,c=-1/0,f=-1/0,m=-1/0,u=(p,d,y)=>{i=Math.min(i,p),c=Math.max(c,p),s=Math.min(s,d),f=Math.max(f,d),l=Math.min(l,y),m=Math.max(m,y)};for(let p=0;p<t.position.length;p+=3)u(t.position[p],t.position[p+1],t.position[p+2]);for(let p=0;p<n.count;p++){let d=p*3,y=n.iPosition[d],x=n.iPosition[d+1],w=n.iPosition[d+2],A=Math.max(.35,n.iMaxRadius[p]??.35);u(y-A,x,w-A),u(y+A,x+1.6,w+A)}Number.isFinite(i)||(i=r-a,c=r+a,s=0,f=a*.16,l=o-a,m=o+a);let h=[(i+c)/2,(s+f)/2,(l+m)/2],b=Math.max(1,.5*Math.hypot(c-i,f-s,m-l));return{center:h,radius:b,minY:s,maxY:f}}function ge(t,n,e,r,o,a){let i=1/0,s=1/0,l=-1/0,c=-1/0;for(let A=0;A<t.count;A++){let E=A*3,M=t.iPosition[E],I=t.iPosition[E+2];M<i&&(i=M),M>l&&(l=M),I<s&&(s=I),I>c&&(c=I)}for(let A of n)i=Math.min(i,A.cx-A.halfX),l=Math.max(l,A.cx+A.halfX),s=Math.min(s,A.cz-A.halfZ),c=Math.max(c,A.cz+A.halfZ);let f=e.minX*g,m=e.maxX*g,u=e.minY*g,h=e.maxY*g,b=f,p=m,d=u,y=h;if(Number.isFinite(i)){let A=Math.max(2,.06*Math.hypot(l-i,c-s));b=Math.max(f,i-A),p=Math.min(m,l+A),d=Math.max(u,s-A),y=Math.min(h,c+A)}let x=Math.min(0,r),w=Math.max(o,a*.05);return{min:[b,x,d],max:[p,w,y]}}function Me(t,n,e){let r=()=>({byObjectId:new Map,elements:[]});if(!n||!t)return r();let o=bn(n);if(!o.ok||o.value.id!==t)return r();let a=new Map;for(let m of e)for(let u of m.objects)u.type==="shape"&&a.set(u.id,{shape:u,unit:m});let i=new Set,s=new Set,l=new Map((n.overlay.productionElements??[]).map(m=>{let u=m.runtimeContentImageUrl;return[m.id,typeof u=="string"&&/^(?:blob:|data:image\/|https:\/\/)/.test(u)?u:void 0]})),c=[];for(let m of o.value.overlay.productionElements??[]){let u=a.get(m.objectId),h=u?bt(u.shape):null,b=m.baseElevationM??0;if(!u||!h||h.length<3||!m.id||i.has(m.id)||s.has(m.objectId)||!Number.isFinite(m.heightM)||m.heightM<.05||m.heightM>50||!Number.isFinite(b)||b<-10||b>100)return r();i.add(m.id),s.add(m.objectId);let p=h.map(B=>B.x*g),d=h.map(B=>B.y*g),y=u.unit.baseHeightM+b,x=Math.min(...p),w=Math.max(...p),A=Math.min(...d),E=Math.max(...d),M,I=l.get(m.id)??m.contentImageUrl;if(m.kind==="screen"&&I)if(w-x>=E-A){let B=Math.abs(A-u.unit.focal.y*g)<=Math.abs(E-u.unit.focal.y*g)?A-.006:E+.006;M=[[x,y,B],[w,y,B],[x,y+m.heightM,B],[w,y+m.heightM,B]]}else{let B=Math.abs(x-u.unit.focal.x*g)<=Math.abs(w-u.unit.focal.x*g)?x-.006:w+.006;M=[[B,y,A],[B,y,E],[B,y+m.heightM,A],[B,y+m.heightM,E]]}c.push({id:m.id,objectId:m.objectId,kind:m.kind,floorIndex:u.unit.index,baseY:y,topY:y+m.heightM,bounds:{min:[x,y,A],max:[w,y+m.heightM,E]},occlusion:m.occlusion,...I?{contentImageUrl:I}:{},...M?{contentPlane:M}:{}})}let f=c.sort((m,u)=>m.id.localeCompare(u.id));return{byObjectId:new Map(f.map(m=>[m.objectId,m])),elements:f}}function Q(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}function J(t){return Array.isArray(t)?t:[]}function zo(t){let n=[t];for(;n.length;){let e=n.pop();if(Array.isArray(e)){n.push(...e);continue}if(!Q(e))continue;let r=Q(e.extensions)?e.extensions:null;if(r&&Object.prototype.hasOwnProperty.call(r,"KHR_draco_mesh_compression"))return!0;n.push(...Object.values(e))}return!1}function Zt(t,n){return!Array.isArray(t)||t.length!==n||!t.every(e=>typeof e=="number"&&Number.isFinite(e))?null:t}function Zo(){return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}function Ko(t,n){let e=new Array(16).fill(0);for(let r=0;r<4;r++)for(let o=0;o<4;o++)for(let a=0;a<4;a++)e[r*4+o]+=t[a*4+o]*n[r*4+a];return e}function $o(t){let n=Zt(t.matrix,16);if(n)return n;if(t.matrix!==void 0)return null;let e=t.translation===void 0?[0,0,0]:Zt(t.translation,3),r=t.rotation===void 0?[0,0,0,1]:Zt(t.rotation,4),o=t.scale===void 0?[1,1,1]:Zt(t.scale,3);if(!e||!r||!o)return null;let[a,i,s,l]=r,c=Math.hypot(a,i,s,l);if(!(c>1e-8))return null;let f=a/c,m=i/c,u=s/c,h=l/c,b=f+f,p=m+m,d=u+u,y=f*b,x=f*p,w=f*d,A=m*p,E=m*d,M=u*d,I=h*b,B=h*p,k=h*d;return[(1-(A+M))*o[0],(x+k)*o[0],(w-B)*o[0],0,(x-k)*o[1],(1-(y+M))*o[1],(E+I)*o[1],0,(w+B)*o[2],(E-I)*o[2],(1-(y+A))*o[2],0,e[0],e[1],e[2],1]}function qo(t,n,e,r){return[t[0]*n+t[4]*e+t[8]*r+t[12],t[1]*n+t[5]*e+t[9]*r+t[13],t[2]*n+t[6]*e+t[10]*r+t[14]]}function Jo(t){let n=t[0],e=t[4],r=t[8],o=t[1],a=t[5],i=t[9],s=t[2],l=t[6],c=t[10],f=a*c-i*l,m=i*s-o*c,u=o*l-a*s,h=n*f+e*m+r*u;if(Math.abs(h)<1e-12)return null;let b=1/h;return[f*b,m*b,u*b,(r*l-e*c)*b,(n*c-r*s)*b,(e*s-n*l)*b,(e*i-r*a)*b,(r*o-n*i)*b,(n*a-e*o)*b]}function Se(t,n,e,r){let o=t[0]*n+t[1]*e+t[2]*r,a=t[3]*n+t[4]*e+t[5]*r,i=t[6]*n+t[7]*e+t[8]*r,s=Math.hypot(o,a,i)||1;return o/=s,a/=s,i/=s,[o,a,i]}function Qo(t){if(t.byteLength<20||t.byteLength>8388608)return null;let n=new DataView(t.buffer,t.byteOffset,t.byteLength);if(n.getUint32(0,!0)!==1179937895||n.getUint32(4,!0)!==2||n.getUint32(8,!0)!==t.byteLength)return null;let e=12,r=null,o=null;for(;e+8<=t.byteLength;){let a=n.getUint32(e,!0),i=n.getUint32(e+4,!0);if(e+=8,a%4!==0||e+a>t.byteLength)return null;let s=t.subarray(e,e+a);if(i===1313821514&&!r)try{let l=JSON.parse(new TextDecoder().decode(s).replace(/[\u0000 ]+$/g,""));if(!Q(l))return null;r=l}catch{return null}else if(i===5130562&&!o)o=s;else return null;e+=a}return e===t.byteLength&&r&&o?{json:r,bin:o}:null}function tr(t){return t===5120||t===5121?1:t===5122||t===5123?2:t===5125||t===5126?4:0}function nr(t){return t==="SCALAR"?1:t==="VEC2"?2:t==="VEC3"?3:t==="VEC4"?4:0}function er(t,n,e){return e===5120?t.getInt8(n):e===5121?t.getUint8(n):e===5122?t.getInt16(n,!0):e===5123?t.getUint16(n,!0):e===5125?t.getUint32(n,!0):t.getFloat32(n,!0)}function or(t){let n=t instanceof Uint8Array?t:new Uint8Array(t),e=Qo(n);if(!e)return{ok:!1,issue:"invalid_glb"};let{json:r,bin:o}=e;if(!Q(r.asset)||r.asset.version!=="2.0")return{ok:!1,issue:"unsupported_glb"};let a=J(r.extensionsUsed).filter(A=>typeof A=="string");if(a.includes("KHR_draco_mesh_compression")||zo(r))return{ok:!1,issue:"draco_not_allowed"};if(a.length||J(r.extensionsRequired).length)return{ok:!1,issue:"unsupported_glb"};if(J(r.images).length||J(r.textures).length)return{ok:!1,issue:"external_resource"};let i=J(r.buffers);if(i.length!==1||!Q(i[0])||i[0].uri!==void 0||typeof i[0].byteLength!="number"||!Number.isInteger(i[0].byteLength)||i[0].byteLength<0||i[0].byteLength>o.byteLength)return{ok:!1,issue:"external_resource"};let s=J(r.accessors),l=J(r.bufferViews),c=J(r.meshes),f=J(r.nodes),m=J(r.scenes),u=typeof r.scene=="number"?r.scene:0;if(!Q(m[u]))return{ok:!1,issue:"unsupported_glb"};let h=new DataView(o.buffer,o.byteOffset,o.byteLength),b=(A,E,M)=>{if(typeof A!="number"||!Number.isInteger(A)||!Q(s[A]))return null;let I=s[A];if(I.type!==E||I.sparse!==void 0||I.normalized===!0||typeof I.count!="number"||!Number.isInteger(I.count)||I.count<1||typeof I.componentType!="number"||!M.includes(I.componentType)||typeof I.bufferView!="number")return null;let B=l[I.bufferView];if(!Q(B)||B.buffer!==0||typeof B.byteLength!="number"||!Number.isInteger(B.byteLength)||B.byteLength<0)return null;let k=nr(I.type),D=tr(I.componentType),U=typeof B.byteStride=="number"?B.byteStride:k*D,S=typeof B.byteOffset=="number"?B.byteOffset:0,_=typeof I.byteOffset=="number"?I.byteOffset:0,N=S+_,O=_+(I.count-1)*U+k*D;if(!Number.isInteger(U)||!Number.isInteger(S)||!Number.isInteger(_)||U<k*D||S<0||_<0||S+B.byteLength>o.byteLength||O>B.byteLength)return null;let P=[];for(let F=0;F<I.count;F++){let R=[];for(let T=0;T<k;T++){let C=er(h,N+F*U+T*D,I.componentType);if(!Number.isFinite(C))return null;R.push(C)}P.push(R)}return P},p=[],d=[],y=0,x=new Set,w=(A,E)=>{if(typeof A!="number"||!Number.isInteger(A)||!Q(f[A])||x.has(A))return!1;x.add(A);let M=f[A],I=$o(M);if(!I)return!1;let B=Ko(E,I),k=Jo(B);if(!k)return!1;if(M.mesh!==void 0){if(typeof M.mesh!="number")return!1;let D=c[M.mesh];if(!Q(D))return!1;for(let U of J(D.primitives)){if(!Q(U)||U.mode!==void 0&&U.mode!==4||!Q(U.attributes))return!1;let S=b(U.attributes.POSITION,"VEC3",[5126]),_=U.attributes.NORMAL===void 0?null:b(U.attributes.NORMAL,"VEC3",[5126]);if(!S||U.attributes.NORMAL!==void 0&&!_)return!1;let N=S.length;if(U.indices!==void 0){let P=typeof U.indices=="number"?s[U.indices]:null;N=Q(P)?P.count:void 0}if(typeof N!="number"||!Number.isInteger(N)||N%3!==0||(y+=N/3,y>1e5))return!1;let O=U.indices===void 0?S.map((P,F)=>[F]):b(U.indices,"SCALAR",[5121,5123,5125]);if(!O||O.length%3!==0||O.length!==N)return!1;for(let P=0;P<O.length;P+=3){let F=[O[P][0],O[P+1][0],O[P+2][0]];if(F.some(C=>!Number.isInteger(C)||C<0||C>=S.length))return!1;let R=F.map(C=>qo(B,...S[C])),T=null;if(!_){let C=R[1][0]-R[0][0],v=R[1][1]-R[0][1],G=R[1][2]-R[0][2],X=R[2][0]-R[0][0],L=R[2][1]-R[0][1],Y=R[2][2]-R[0][2];T=Se([1,0,0,0,1,0,0,0,1],v*Y-G*L,G*X-C*Y,C*L-v*X)}for(let C=0;C<3;C++)p.push(...R[C]),d.push(..._?Se(k,..._[F[C]]):T)}}}for(let D of J(M.children))if(!w(D,B))return!1;return x.delete(A),!0};for(let A of J(m[u].nodes))if(!w(A,Zo()))return{ok:!1,issue:y>1e5?"triangle_limit":"unsupported_glb"};return!y||p.length!==y*9||d.length!==p.length?{ok:!1,issue:"unsupported_glb"}:{ok:!0,triangleCount:y,position:new Float32Array(p),normal:new Float32Array(d)}}function Re(t){try{return or(t)}catch{return{ok:!1,issue:"invalid_glb"}}}function As(t){let{doc:n}=t,e=ue(n.theme),r=e.structure,o=Zn(n,t.eventConfigurationId??n.eventConfigurationId),a=Me(t.eventConfigurationId,t.eventConfiguration,o),i=t.seats,s=new Yt,l=null;if(t.registeredShellGlb){let P=Re(t.registeredShellGlb);if(P.ok){let F=P.position.length/3,R=new Float32Array(P.position.length),T=e.materials.shell??r.tierWall;for(let C=0;C<F;C++){let v=P.normal[C*3+1],G=v<-.25?.4:.62+.38*Math.max(0,v);R[C*3]=T[0]*G,R[C*3+1]=T[1]*G,R[C*3+2]=T[2]*G}l={position:P.position,normal:P.normal,color:R,floor:new Float32Array(F).fill(-2),material:new Float32Array(F),count:F}}}let c=new Map;for(let P of o)for(let F of P.objects)c.set(F.id,P.index),F.type==="section"&&c.set(F.logicalSectionId??F.id,P.index);let f=i.map(P=>c.get(P.sectionId??"")??c.get(P.rowId??"")??0),m=mn(o,i);ye(s,o,i,f,m,r);let u=vn(n,i),h=new Map,b=new Map;for(let P of n.categories??[])h.set(P.key,P.color),P.seatGlyph&&b.set(P.key,P.seatGlyph);let p=[],d=fe(o,i,f),y=new Float32Array(i.length),x=[];for(let P=0;P<o.length;P++){let F=o[P];s.setFloor(P);let R=new zt,T=[],C=F.objects.filter(v=>v.type==="section"&&!!v.outline&&v.outline.length>=3);for(let v of F.objects)if(v.type==="section"){let G=s.vertexCount;be(s,v,F,kn(v,u),d.bySection.get(v.id),R,C,r);let X=s.vertexCount-G;X>0&&x.push({sectionId:v.id,start:G,count:X})}else if(v.type==="shape"){let G=a.byObjectId.get(v.id);s.setMaterial((G?.kind??v.role)==="screen"?1:0),ee(s,v,F.baseHeightM,qn(v,T),r,F.focal,p,G),s.setMaterial(0)}else v.type==="gaArea"?re(s,v,F.baseHeightM,H(h.get(v.categoryKey)),r):v.type==="booth"?te(s,v,F.baseHeightM,H(h.get(v.categoryKey)),r):v.type==="table"?ne(s,v,F.baseHeightM,H(v.fill??n.theme?.decorFill??"#232c40"),r):v.type==="decorImage"&&oe(s,v,F.baseHeightM,r);pe(s,F,i,d,r,e.materials.shell,!l)}let w=o.length>1?{x:o.reduce((P,F)=>P+F.focal.x,0)/o.length,y:o.reduce((P,F)=>P+F.focal.y,0)/o.length}:n.focalPoint??{x:(m.minX+m.maxX)/2,y:(m.minY+m.maxY)/2},A=Tn(l?[s.build(),l]:[s.build()]),E=Fn(i,t.initialState,d,y,h,b),M=se({doc:n,units:o,seats:i,surfaces:d,focal:w}),{labels:I,sections:B,rows:k}=ae({doc:n,units:o,seats:i,surfaces:d,seatData:E,hintedSeatFloor:f,zones:M,focal:w}),D=de({doc:n,units:o,seats:i,surfaces:d,solids:A,hintedSeatFloor:f,seatFloor:y});ce(I,D),E.iYaw=Cn(E.iPosition,i.length,P=>i[P].rowId,P=>{let F=o[y[P]]?.focal??w;return[F.x*g,F.y*g]});let U=(m.minX+m.maxX)/2*g,S=(m.minY+m.maxY)/2*g,_=.5*Math.hypot((m.maxX-m.minX)*g,(m.maxY-m.minY)*g)||10,N=xe(A,E,{cx:U,cz:S,radius:_}),O=ge(E,p,m,N.minY,N.maxY,_);return{solids:A,sectionSolidRanges:x,seats:E,bounds:{center:[(O.min[0]+O.max[0])/2,(O.min[1]+O.max[1])/2,(O.min[2]+O.max[2])/2],radius:_,groundY:0,box:O},renderBounds:{center:N.center,radius:N.radius},stateColorLUT:le(e,Bt),theme:e,seatCount:i.length,focalWorld:[w.x*g,1.5,w.y*g],zones:M,stages:p,productionElements:a.elements,sections:B,rows:k,labels:I,floors:D}}export{Bt as a,Qt as b,mr as c,nn as d,g as e,hr as f,Ge as g,Ne as h,br as i,Vt as j,Ar as k,Pr as l,_r as m,Tr as n,Br as o,Er as p,Cr as q,Fr as r,vr as s,kr as t,Or as u,Lr as v,Bo as w,As as x};
|
|
1
|
+
import{a as Pn,c as In,d as wn}from"./chunk-PRED5KHO.js";import{a as gn}from"./chunk-QJXSZT3H.js";import{f as hn,m as Mn,o as Nt,p as ft,r as It,u as An}from"./chunk-WXGW2SYC.js";import{e as Sn,k as Rn}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 Ae from"earcut";import Pe from"polygon-clipping";var g=ut,Ie=.002;function we(t,n,e){let r=Math.hypot(n[0]-t[0],n[1]-t[1],n[2]-t[2]),o=Math.hypot(e[0]-n[0],e[1]-n[1],e[2]-n[2]),a=Math.hypot(t[0]-e[0],t[1]-e[1],t[2]-e[2]),i=Math.max(r,o,a);if(i<1e-9)return!0;let s=(r+o+a)/2;return 2*Math.sqrt(Math.max(0,s*(s-r)*(s-o)*(s-a)))/i<Ie}var ht=class{constructor(n=16384){this.len=0;this.buf=new Float32Array(n)}push3(n,e,r){this.len+3>this.buf.length&&this.grow(this.len+3),this.buf[this.len++]=n,this.buf[this.len++]=e,this.buf[this.len++]=r}push1(n){this.len+1>this.buf.length&&this.grow(this.len+1),this.buf[this.len++]=n}grow(n){let e=this.buf.length*2;for(;e<n;)e*=2;let r=new Float32Array(e);r.set(this.buf.subarray(0,this.len)),this.buf=r}get length(){return this.len}toArray(){return this.buf.slice(0,this.len)}},Yt=class{constructor(){this.pos=new ht;this.nor=new ht;this.col=new ht;this.flr=new ht;this.mat=new ht;this.currentFloor=0;this.currentMaterial=0}setFloor(n){this.currentFloor=n}setMaterial(n){this.currentMaterial=n}tri(n,e,r,o,a,i=a,s=a){we(n,e,r)||(this.pos.push3(n[0],n[1],n[2]),this.pos.push3(e[0],e[1],e[2]),this.pos.push3(r[0],r[1],r[2]),this.nor.push3(o[0],o[1],o[2]),this.nor.push3(o[0],o[1],o[2]),this.nor.push3(o[0],o[1],o[2]),this.col.push3(a[0],a[1],a[2]),this.col.push3(i[0],i[1],i[2]),this.col.push3(s[0],s[1],s[2]),this.flr.push1(this.currentFloor),this.flr.push1(this.currentFloor),this.flr.push1(this.currentFloor),this.mat.push1(this.currentMaterial),this.mat.push1(this.currentMaterial),this.mat.push1(this.currentMaterial))}triN(n,e,r,o,a,i,s,l=s,c=s){[...n,...e,...r].every(Number.isFinite)&&(this.pos.push3(n[0],n[1],n[2]),this.pos.push3(e[0],e[1],e[2]),this.pos.push3(r[0],r[1],r[2]),this.nor.push3(o[0],o[1],o[2]),this.nor.push3(a[0],a[1],a[2]),this.nor.push3(i[0],i[1],i[2]),this.col.push3(s[0],s[1],s[2]),this.col.push3(l[0],l[1],l[2]),this.col.push3(c[0],c[1],c[2]),this.flr.push1(this.currentFloor),this.flr.push1(this.currentFloor),this.flr.push1(this.currentFloor),this.mat.push1(this.currentMaterial),this.mat.push1(this.currentMaterial),this.mat.push1(this.currentMaterial))}get vertexCount(){return this.pos.length/3}build(){return{position:this.pos.toArray(),normal:this.nor.toArray(),color:this.col.toArray(),floor:this.flr.toArray(),material:this.mat.toArray(),count:this.pos.length/3}}};function _e(t,n,e){let r=n[0]-t[0],o=n[1]-t[1],a=n[2]-t[2],i=e[0]-t[0],s=e[1]-t[1],l=e[2]-t[2],c=o*l-a*s,f=a*i-r*l,m=r*s-o*i,u=Math.hypot(c,f,m)||1;return c/=u,f/=u,m/=u,[c,f,m]}function Te(t,n){let e=[...t],r=[];for(let i of t)r.push(i.x,i.y);let o=[];if(n){for(let i of n)if(!(i.length<3)){o.push(e.length);for(let s of i)e.push(s),r.push(s.x,s.y)}}let a=Ae(r,o.length?o:void 0,2);return{pts:e,tris:a}}function Jt(t){return ft(t)<0?[...t].reverse():t}var Be=3;function Ee(t,n,e,r){let o=r(t),a=r(n),i=r(e),s=(h,b,p,d)=>Math.abs(r({x:(h.x+b.x)/2,y:(h.y+b.y)/2})-(p+d)/2),l=(t.x+n.x+e.x)/3,c=(t.y+n.y+e.y)/3,f=(o+a+i)/3,m=Math.max(s(t,n,o,a),s(n,e,a,i),s(e,t,i,o),Math.abs(r({x:l,y:c})-f)),u=(h,b,p)=>{let d=Math.abs(r({x:(h+l)/2,y:(b+c)/2})-(p+f)/2);d>m&&(m=d)};return u((t.x+n.x)/2,(t.y+n.y)/2,(o+a)/2),u((n.x+e.x)/2,(n.y+e.y)/2,(a+i)/2),u((e.x+t.x)/2,(e.y+t.y)/2,(i+o)/2),m}function wt(t,n,e,r,o){if(o<=0)return Ee(t,n,e,r);let a={x:(t.x+n.x)/2,y:(t.y+n.y)/2},i={x:(n.x+e.x)/2,y:(n.y+e.y)/2},s={x:(e.x+t.x)/2,y:(e.y+t.y)/2};return Math.max(wt(t,a,s,r,o-1),wt(a,n,i,r,o-1),wt(s,i,e,r,o-1),wt(a,i,s,r,o-1))}function _t(t,n,e,r,o,a,i,s){if(i>0){let u={x:(n.x+e.x)/2,y:(n.y+e.y)/2},h={x:(e.x+r.x)/2,y:(e.y+r.y)/2},b={x:(r.x+n.x)/2,y:(r.y+n.y)/2};_t(t,n,u,b,o,a,i-1,s),_t(t,u,e,h,o,a,i-1,s),_t(t,b,h,r,o,a,i-1,s),_t(t,u,h,b,o,a,i-1,s);return}let l=[n.x*g,o(n),n.y*g],c=[e.x*g,o(e),e.y*g],f=[r.x*g,o(r),r.y*g];if(s){t.triN(l,c,f,s(n),s(e),s(r),a);return}let m=_e(l,c,f);m[1]<0&&(m=[-m[0],-m[1],-m[2]]),t.tri(l,c,f,m,a)}var Ce=8;function _n(t,n,e){if(!Number.isFinite(e))return t;let r=[],o=(a,i,s,l,c)=>{if(c>0){let f={x:(a.x+i.x)/2,y:(a.y+i.y)/2},m=n(f);if(Math.abs(m-(s+l)/2)>e){o(a,f,s,m,c-1),o(f,i,m,l,c-1);return}}r.push(a)};for(let a=0;a<t.length;a++){let i=t[a],s=t[(a+1)%t.length];o(i,s,n(i),n(s),Ce)}return r}function Xt(t,n){if(t.length<3)return t;let e=[];for(let o of t){let a=e[e.length-1];a&&Math.hypot(o.x-a.x,o.y-a.y)<n||e.push(o)}for(;e.length>2&&Math.hypot(e[0].x-e[e.length-1].x,e[0].y-e[e.length-1].y)<n;)e.pop();if(e.length<3)return t;let r=[];for(let o=0;o<e.length;o++){let a=r.length?r[r.length-1]:e[(o-1+e.length)%e.length],i=e[o],s=e[(o+1)%e.length],l=s.x-a.x,c=s.y-a.y,f=Math.hypot(l,c);f>n&&Math.abs((i.x-a.x)*c-(i.y-a.y)*l)/f<n||r.push(i)}return r.length>=3?r:e}var Ut=.001*lt*.1;function K(t,n,e,r,o,a,i,s,l=1/0,c){if(!n||n.length<3||(l===void 0&&(l=1/0),Math.abs(ft(n))<1e-4))return;let f=Xt(_n(Xt(Jt(n),Ut),r,l),Ut),m=e?.map(M=>Xt(_n(Xt(Jt(M),Ut),r,l),Ut)).filter(M=>M.length>=3&&Math.abs(ft(M))>=1e-4),{pts:u,tris:h}=Te(f,m),b=[a[0]*s.top,a[1]*s.top,a[2]*s.top],p=[a[0]*s.bottomCap,a[1]*s.bottomCap,a[2]*s.bottomCap],d=[i[0]*s.top,i[1]*s.top,i[2]*s.top],y=[i[0]*s.wallBottom,i[1]*s.wallBottom,i[2]*s.wallBottom],x=0;if(Number.isFinite(l))for(;x<Be;x++){let M=0;for(let I=0;I<h.length;I+=3){let B=wt(u[h[I]],u[h[I+1]],u[h[I+2]],r,x);B>M&&(M=B)}if(M<=l)break}for(let M=0;M<h.length;M+=3){let I=u[h[M]],B=u[h[M+1]],k=u[h[M+2]];_t(t,I,B,k,r,b,x,c);let D=[I.x*g,o,I.y*g],U=[B.x*g,o,B.y*g],S=[k.x*g,o,k.y*g];t.tri(D,S,U,[0,-1,0],p)}let w=M=>{if(x<=0)return M;let I=1<<x,B=[];for(let k=0;k<M.length;k++){let D=M[k],U=M[(k+1)%M.length];for(let S=0;S<I;S++){let _=S/I;B.push({x:D.x+(U.x-D.x)*_,y:D.y+(U.y-D.y)*_})}}return B},A=pn(f),E=[{ring:w(f),flip:!1}];if(m)for(let M of m)M.length>=3&&E.push({ring:w(M),flip:!0});for(let{ring:M,flip:I}of E)for(let B=0;B<M.length;B++){let k=M[B],D=M[(B+1)%M.length],U=(D.x-k.x)*g,_=(D.y-k.y)*g,N=-U,O=Math.hypot(_,N)||1;_/=O,N/=O;let P=(k.x+D.x)/2-A.x,F=(k.y+D.y)/2-A.y,R=_*P+N*F;I&&(R=-R),R<0&&(_=-_,N=-N);let T=[_,0,N],C=[k.x*g,r(k),k.y*g],v=[D.x*g,r(D),D.y*g],G=[k.x*g,o,k.y*g],X=[D.x*g,o,D.y*g];t.tri(C,v,X,T,d,d,y),t.tri(C,X,G,T,d,y,y)}}function Tn(t){let n=0;for(let l of t)n+=l.count;let e=new Float32Array(n*3),r=new Float32Array(n*3),o=new Float32Array(n*3),a=new Float32Array(n),i=new Float32Array(n),s=0;for(let l of t)e.set(l.position,s*3),r.set(l.normal,s*3),o.set(l.color,s*3),a.set(l.floor,s),i.set(l.material,s),s+=l.count;return{position:e,normal:r,color:o,floor:a,material:i,count:n}}function jt(t,n,e=2.5){if(n<=0||t.length<3)return t;let r=Jt(t),o=r.length,a=[];for(let s=0;s<o;s++){let l=r[s],c=r[(s+1)%o],f=c.x-l.x,m=c.y-l.y,u=Math.hypot(f,m)||1;a.push({x:m/u,y:-f/u})}let i=[];for(let s=0;s<o;s++){let l=r[s],c=a[(s-1+o)%o],f=a[s],m=c.x+f.x,u=c.y+f.y,h=Math.hypot(m,u),b=()=>{i.push([l.x+c.x*n,l.y+c.y*n]),i.push([l.x+f.x*n,l.y+f.y*n])};if(h<1e-9){b();continue}m/=h,u/=h;let p=m*c.x+u*c.y,d=1/Math.max(p,1e-6);if(!Number.isFinite(d)||d>e){b();continue}i.push([l.x+m*n*d,l.y+u*n*d])}if(i.length<3)return t;try{let s=Pe.union([[...i,i[0]]]),l=null,c=-1/0;for(let m of s){let u=Math.abs(ft(m[0].map(([h,b])=>({x:h,y:b}))));u>c&&(c=u,l=m[0])}if(!l)return t;let f=l.map(([m,u])=>({x:m,y:u}));if(f.length>1){let m=f[0],u=f[f.length-1];Math.abs(m.x-u.x)<1e-9&&Math.abs(m.y-u.y)<1e-9&&f.pop()}return f.length>=3?f:t}catch{return t}}function Ht(t,n,e,r,o=28){let a=[];for(let i=0;i<o;i++){let s=i/o*Math.PI*2;a.push({x:t+e*Math.cos(s),y:n+r*Math.sin(s)})}return a}function Tt(t,n,e,r){return[{x:t,y:n},{x:t+e,y:n},{x:t+e,y:n+r},{x:t,y:n+r}]}var Bt=["available","held","sold","selected","dimmed"];function Qt(t){let n=Bt.indexOf(t);return n<0?0:n}var Bn={available:[.24,.82,.52],held:[.95,.66,.22],sold:[.34,.39,.45],selected:[.24,.74,1],dimmed:[.28,.32,.37]};function mr(t){let n=.2126*t[0]+.7152*t[1]+.0722*t[2],e=.42,r=.62;return[(n+(t[0]-n)*e)*r,(n+(t[1]-n)*e)*r,(n+(t[2]-n)*e)*r]}var tn={ground:[.07,.085,.11],tierTop:[.24,.28,.34],tierWall:[.17,.2,.25],stageTop:[.94,.7,.38],stageWall:[.48,.33,.18],decorTop:[.22,.25,.29],decorWall:[.15,.17,.2],gaTop:[.24,.28,.33],gaWall:[.16,.19,.23],boothTop:[.3,.33,.38],boothWall:[.2,.23,.27],tableTop:[.38,.34,.29],tableWall:[.24,.21,.18]},nn={top:[.05,.06,.08],bottom:[.1,.12,.15]};function et(t,n){return[Math.min(1,t[0]*n),Math.min(1,t[1]*n),Math.min(1,t[2]*n)]}var V={pedestal:0,pad:1,back:2,arm:3,footrest:4,leg:5,body:10,head:11},Fe=.44,ve=.15,ke=.3,Oe=.24;function En(t){return t===void 0||!Number.isFinite(t)||t<=0?Oe:Math.min(ke,Math.max(ve,t*Fe))}var hr=.21,Le=.05,en=.45,Ge=en+Le,De=.92,Ne=1.205,Xe=-.23,Ue=.38,Ye=[{part:V.pedestal,min:[-.3,0,-.3],max:[.3,.36,.3]},{part:V.pad,min:[-1,.36,-.95],max:[1,en,1]},{part:V.back,min:[-1,Ge,-1],max:[1,De,-.72]},{part:V.arm,min:[-1,.44,-.82],max:[-.78,.65,.78]},{part:V.arm,min:[.78,.44,-.82],max:[1,.65,.78]},{part:V.footrest,min:[-.9,.18,.78],max:[.9,.31,1.34]},{part:V.leg,min:[-.82,0,-.7],max:[-.62,.37,-.48]},{part:V.leg,min:[.62,0,-.7],max:[.82,.37,-.48]},{part:V.leg,min:[-.82,0,.48],max:[-.62,.37,.7]},{part:V.leg,min:[.62,0,.48],max:[.82,.37,.7]}],je=[{part:V.body,min:[-.52,.39,-.08],max:[-.08,.55,.82]},{part:V.body,min:[.08,.39,-.08],max:[.52,.55,.82]},{part:V.body,min:[-.47,.05,.58],max:[-.13,.43,.82]},{part:V.body,min:[.13,.05,.58],max:[.47,.43,.82]},{part:V.head,min:[-.16,1.04,-.33],max:[.16,1.1,-.13]}],He=[{n:[1,0,0],c:[[1,0,0],[1,1,0],[1,1,1],[1,0,1]]},{n:[-1,0,0],c:[[0,0,1],[0,1,1],[0,1,0],[0,0,0]]},{n:[0,1,0],c:[[0,1,0],[0,1,1],[1,1,1],[1,1,0]]},{n:[0,-1,0],c:[[0,0,1],[0,0,0],[1,0,0],[1,0,1]]},{n:[0,0,1],c:[[0,0,1],[1,0,1],[1,1,1],[0,1,1]]},{n:[0,0,-1],c:[[1,0,0],[0,0,0],[0,1,0],[1,1,0]]}];function br(){let t=[],n=[],e=[],r=[],o=(O,P,F)=>{let R=e.length,[T,C,v]=O,G=[C[0]-T[0],C[1]-T[1],C[2]-T[2]],X=[v[0]-T[0],v[1]-T[1],v[2]-T[2]],L=G[1]*X[2]-G[2]*X[1],Y=G[2]*X[0]-G[0]*X[2],j=G[0]*X[1]-G[1]*X[0],$=Math.hypot(L,Y,j);$>1e-9?(L/=$,Y/=$,j/=$):[L,Y,j]=P,L*P[0]+Y*P[1]+j*P[2]<0&&(L=-L,Y=-Y,j=-j);for(let z of O)t.push(...z),n.push(L,Y,j),e.push(F);r.push(R,R+1,R+2,R,R+2,R+3)},a=O=>{for(let P of He){let F=P.c.map(R=>R.map((T,C)=>T?O.max[C]:O.min[C]));o(F,P.n,O.part)}};for(let O of Ye)a(O);for(let O of je)a(O);let i=en,s=1.08,l=.47,c=.69,f=-.55,m=.08,u=-.48,h=.01,b=[-l,i,f],p=[l,i,f],d=[-l,i,m],y=[l,i,m],x=[-c,s,u],w=[c,s,u],A=[-c,s,h],E=[c,s,h];o([p,w,E,y],[1,0,0],V.body),o([d,A,x,b],[-1,0,0],V.body),o([A,E,w,x],[0,1,0],V.body),o([b,p,y,d],[0,-1,0],V.body),o([y,E,A,d],[0,0,1],V.body),o([b,x,w,p],[0,0,-1],V.body);let M=10,I=8,B=[0,Ne,Xe],k=[.42,.115,Ue],D=e.length;for(let O=0;O<=I;O++){let P=Math.PI*O/I,F=Math.cos(P),R=Math.sin(P);for(let T=0;T<=M;T++){let C=Math.PI*2*T/M,v=R*Math.cos(C),G=R*Math.sin(C);t.push(B[0]+k[0]*v,B[1]+k[1]*F,B[2]+k[2]*G);let X=v/k[0],L=F/k[1],Y=G/k[2],j=Math.hypot(X,L,Y)||1;X/=j,L/=j,Y/=j,n.push(X,L,Y),e.push(V.head)}}for(let O=0;O<I;O++)for(let P=0;P<M;P++){let F=D+O*(M+1)+P,R=F+M+1;r.push(F,R,F+1,F+1,R,R+1)}let U=new Float32Array(t),S=new Float32Array(n),_=new Float32Array(e),N=new Uint16Array(r);return{position:U,normal:S,part:_,index:N,vertexCount:e.length,indexCount:r.length}}function Cn(t,n,e,r){let o=new Float32Array(n),a=c=>t[c*3],i=c=>t[c*3+2],s=0,l=(c,f)=>{let m=f-c;for(let u=c;u<f;u++){let[h,b]=r(u),p=h-a(u),d=b-i(u);if(m>=2){let y=Math.max(c,u-1),x=Math.min(f-1,u+1),w=a(x)-a(y),A=i(x)-i(y),E=Math.hypot(w,A);if(E>1e-6){let M=-A/E,I=w/E;M*p+I*d<0&&(M=-M,I=-I),p=M,d=I}}o[u]=p===0&&d===0?0:Math.atan2(p,d)}};for(let c=1;c<=n;c++)(c===n||e(c)!==e(s))&&(l(s,c),s=c);return o}var Vt=.22;function Ar(t,n){let e=Bt[t];if(e!=="sold"&&e!=="held")return-1;let r=(n+1)*2654435761;return r^=r>>>15,r=Math.imul(r,2246822519),r^=r>>>13,(r>>>0)%1e5/1e5}var Ve=.42;function We(t){let n=t.length,e=new Float64Array(n);if(n<2)return e.fill(1/0),e;let r=1/0,o=1/0,a=-1/0,i=-1/0;for(let b of t)b.x<r&&(r=b.x),b.y<o&&(o=b.y),b.x>a&&(a=b.x),b.y>i&&(i=b.y);let s=Math.max(a-r,1e-6),l=Math.max(i-o,1e-6),c=Math.max(Math.sqrt(s*l/n),1e-6),f=Math.max(1,Math.ceil(s/c)+1),m=Math.max(1,Math.ceil(l/c)+1),u=new Map,h=(b,p)=>{let d=Math.min(f-1,Math.max(0,Math.floor((b-r)/c)));return Math.min(m-1,Math.max(0,Math.floor((p-o)/c)))*f+d};for(let b=0;b<n;b++){let p=h(t[b].x,t[b].y),d=u.get(p);d?d.push(b):u.set(p,[b])}for(let b=0;b<n;b++){let p=t[b],d=Math.min(f-1,Math.max(0,Math.floor((p.x-r)/c))),y=Math.min(m-1,Math.max(0,Math.floor((p.y-o)/c))),x=1/0;for(let w=1;w<=4;w++){for(let A=y-w;A<=y+w;A++)if(!(A<0||A>=m))for(let E=d-w;E<=d+w;E++){if(E<0||E>=f||w>1&&Math.abs(A-y)<w&&Math.abs(E-d)<w)continue;let M=u.get(A*f+E);if(M)for(let I of M){if(I===b)continue;let B=Math.hypot(t[I].x-p.x,t[I].y-p.y);B<x&&(x=B)}}if(Number.isFinite(x)&&x<=w*c)break}e[b]=x}return e}function ze(t){let n=t.eyeHeightM;return Number.isFinite(n)?Math.max(0,n-Gt):0}function Fn(t,n,e,r,o,a){let i=t.length,s=new Float32Array(i*3),l=new Float32Array(i),c=new Float32Array(i*3),f=new Float32Array(i),m=new Float32Array(i),u=new Float32Array(i),h=new Float32Array(i),b=new Float32Array(i*3),p=new Map,d=We(t);for(let y=0;y<i;y++){let x=t[y],A=(e?.seatPitchU(y)??d[y])*g;f[y]=Number.isFinite(A)?Math.max(.06,Math.min(Vt,A*Ve)):Vt,m[y]=En(Number.isFinite(A)?A:void 0);let E=Rn(x.glyph,{seatGlyph:a?.get(x.categoryKey)});u[y]=Sn.indexOf(E),h[y]=x.wheelchairSpaceType==="no-seat"?0:1,s[y*3]=x.x*g,s[y*3+1]=e?e.seatDeckY(y):ze(x),s[y*3+2]=x.y*g,l[y]=Qt(n?n(x):"available");let M=H(o?.get(x.categoryKey)??"#6e7bff")??[.43,.48,1];if(c[y*3]=M[0],c[y*3+1]=M[1],c[y*3+2]=M[2],x.accessibility?.length){let I=H(hn(x.accessibility));I&&(b[y*3]=I[0],b[y*3+1]=I[1],b[y*3+2]=I[2])}p.set(x.id,y)}return{count:i,iPosition:s,iState:l,iCategory:c,iMaxRadius:f,iRing:b,idToIndex:p,iChairWidth:m,iGlyph:u,iPhysicalSeat:h,iFloor:r??new Float32Array(i),iYaw:new Float32Array(i)}}var Ze=64;function Pr(t,n){let e=[];for(let i of n){let s=t.idToIndex.get(i.seatId);if(s===void 0)continue;let l=Qt(i.state);t.iState[s]!==l&&(t.iState[s]=l,e.push(s))}if(!e.length)return[];e.sort((i,s)=>i-s);let r=[],o=e[0],a=e[0];for(let i=1;i<e.length;i++){let s=e[i];if(s!==a){if(s<=a+Ze){a=s;continue}r.push({start:o,length:a-o+1}),o=s,a=s}}return r.push({start:o,length:a-o+1}),r}function _r(t,n,e){return e<0?n>1?t.filter(r=>r.kind==="floor"):[...t]:t.filter(r=>r.floorIndex===void 0||r.floorIndex===e)}function Tr(t,n){let e=[...t].sort((o,a)=>o.screen.y-a.screen.y),r=[];for(let o of e){let a=r.find(i=>i.some(s=>Math.abs(s.screen.x-o.screen.x)<104&&Math.abs(s.screen.y-o.screen.y)<34));a?a.push(o):r.push([o])}return r.flatMap(o=>o.length<2?o:o.map((a,i)=>({...a,screen:{...a.screen,x:Math.max(54,Math.min(n-54,a.screen.x+(i-(o.length-1)/2)*104))}})))}var Ke=1.15,$e=2.75,qe=4.5,Je=.85,Qe=.5,to=.26;function Br(t,n,e){let r=Math.max(1e-6,n),o=t/r,a=e?.hasZoneLabels??!0,i=new Set;return o>=.75&&i.add("floor"),o>=Ke&&i.add("zone"),o<=(a?$e:qe)&&(i.add("section"),i.add("ga")),o<=Je&&(i.add("annotation"),i.add("booth")),o<=Qe&&i.add("row"),o<=to&&i.add("seat"),i}function Er(t,n,e,r,o,a=6){let i=a+n,s=r-a-n,l=a+e,c=o-a-e;return{...t,x:i>s?r/2:Math.max(i,Math.min(s,t.x)),y:l>c?o/2:Math.max(l,Math.min(c,t.y))}}function Cr(t,n,e,r){let o=t,a=n[0],i=n[1],s=n[2],l=o[0]*a+o[4]*i+o[8]*s+o[12],c=o[1]*a+o[5]*i+o[9]*s+o[13],f=o[2]*a+o[6]*i+o[10]*s+o[14],m=o[3]*a+o[7]*i+o[11]*s+o[15];if(!(m>1e-6))return{x:0,y:0,depth:1/0,visible:!1};let u=l/m,h=c/m,b=f/m,p=u>=-1.05&&u<=1.05&&h>=-1.05&&h<=1.05&&b<=1;return{x:(u*.5+.5)*e,y:(1-(h*.5+.5))*r,depth:b,visible:p}}function Fr(t,n,e=n){let r=[],o=[...t].sort((a,i)=>a.screen.depth-i.screen.depth);for(let a of o){let i=!1;for(let s of r)if(on(a,s,n,e)){i=!0;break}i||r.push(a)}return r}var no=6;function on(t,n,e,r){let o=Math.abs(t.screen.x-n.screen.x),a=Math.abs(t.screen.y-n.screen.y),i=t.halfWidth!=null&&n.halfWidth!=null?Math.max(e,t.halfWidth+n.halfWidth+no):e;return o<i&&a<r}function vr(t,n,e){return t.length*n*.58+(e?14:0)}var eo={row:8,seat:14};function kr(t){return t<480?{row:5,seat:8}:t<768?{row:6,seat:10}:eo}function Or(t,n,e,r){let o=Math.max(1,Math.min(e,r)*.5),a=Math.min(2,Math.hypot(t.x-e/2,t.y-r/2)/o);return n*(1+1.5*a)}function Lr(t,n,e,r,o=[]){let a=[...t].sort((s,l)=>(l.priority??0)-(s.priority??0)||s.focus-l.focus),i=[];for(let s of a){if(i.length>=r)break;let l=!1;for(let c of o)if(on(s,c,n,e)){l=!0;break}if(!l){for(let c of i)if(on(s,c,n,e)){l=!0;break}}l||i.push(s)}return i}import bo from"polygon-clipping";var W={top:1,wallBottom:.5,bottomCap:.4};function st(t,n){if(!t)return n;let e=et(Pt(t,.4),.62);return nt(n,e,.72)}function vn(t,n){let e=new Map;for(let a of t.categories??[])e.set(a.key,a.color);let r=new Map;for(let a of n){if(!a.sectionId)continue;let i=r.get(a.sectionId);i||(i=new Map,r.set(a.sectionId,i)),i.set(a.categoryKey,(i.get(a.categoryKey)??0)+1)}let o=new Map;for(let[a,i]of r){let s=0,l=0,c=0,f=0;for(let[m,u]of i){let h=H(e.get(m));h&&(s+=h[0]*u,l+=h[1]*u,c+=h[2]*u,f+=u)}f>0&&o.set(a,[s/f,l/f,c/f])}return o}function kn(t,n){return H(t.color)??n.get(t.logicalSectionId??t.id)??null}import zn from"polygon-clipping";import Dn from"polygon-clipping";import oo from"earcut";var ro=.58,On=.01,ot=Vt*1.5*lt,io=.5,so=.6;function ao(t,n){let e=t.length,r=[];for(let i=0;i<e;i++){let s=t[Math.max(0,i-1)],l=t[Math.min(e-1,i+1)],c=l.x-s.x,f=l.y-s.y,m=Math.hypot(c,f);if(m<1e-9){r.push([0,0]);continue}c/=m,f/=m,r.push([-f,c])}let o=0;for(let i=0;i<e;i++)o+=(t[i].x-n.x)*r[i][0]+(t[i].y-n.y)*r[i][1];return o<0?r.map(([i,s])=>[-i,-s]):r}function co(t,n){if(t.length<2||n<=0)return[...t];let e=[...t],r=(i,s)=>{let l=s.x-i.x,c=s.y-i.y,f=Math.hypot(l,c)||1;return{x:l/f,y:c/f}},o=r(e[1],e[0]),a=r(e[e.length-2],e[e.length-1]);return e.unshift({x:e[0].x+o.x*n,y:e[0].y+o.y*n}),e.push({x:e[e.length-1].x+a.x*n,y:e[e.length-1].y+a.y*n}),e}var Ln=Math.PI/12;function uo(t){if(t.length<3)return[...t];let n=[...t].sort((a,i)=>a.x-i.x||a.y-i.y),e=(a,i,s)=>(i.x-a.x)*(s.y-a.y)-(i.y-a.y)*(s.x-a.x),r=a=>{let i=[];for(let s of a){for(;i.length>=2&&e(i[i.length-2],i[i.length-1],s)<=0;)i.pop();i.push(s)}return i.pop(),i},o=[...r(n),...r([...n].reverse())];return o.length>=3?o:[...t]}function Nn(t,n){if(!t.length||!(n>0))return[];let e=uo(t),r=(s,l,c,f)=>{let m=c-l;for(;m<0;)m+=Math.PI*2;for(;m>Math.PI*2;)m-=Math.PI*2;let u=Math.max(1,Math.ceil(m/Ln)),h=n/Math.cos(m/u/2);for(let b=0;b<=u;b++){let p=l+m*b/u;f.push({x:s.x+Math.cos(p)*h,y:s.y+Math.sin(p)*h})}};if(e.length<3){let s=0,l=0;for(let h of e)s+=h.x,l+=h.y;s/=e.length||1,l/=e.length||1;let c=0;for(let h of e)c=Math.max(c,Math.hypot(h.x-s,h.y-l));let f=[],m=Math.max(3,Math.ceil(Math.PI*2/Ln)),u=(c+n)/Math.cos(Math.PI/m);for(let h=0;h<m;h++){let b=h/m*Math.PI*2;f.push({x:s+Math.cos(b)*u,y:l+Math.sin(b)*u})}return f}let o=e.length,a=[];for(let s=0;s<o;s++){let l=e[s],c=e[(s+1)%o];a.push(Math.atan2(-(c.x-l.x),c.y-l.y))}let i=[];for(let s=0;s<o;s++)r(e[s],a[(s+o-1)%o],a[s],i);return Hn(i)}function lo(t,n,e){if(t.length===1)return Math.hypot(n-t[0].x,e-t[0].y);let r=1/0;for(let o=0;o+1<t.length;o++){let a=t[o],i=t[o+1],s=i.x-a.x,l=i.y-a.y,c=s*s+l*l,f=c>1e-12?((n-a.x)*s+(e-a.y)*l)/c:0;f<0?f=0:f>1&&(f=1);let m=Math.hypot(n-(a.x+f*s),e-(a.y+f*l));m<r&&(r=m)}return r}function Wt(t){let n=t.map(o=>{let a=0,i=0;for(let c of o.pts)a+=c.x,i+=c.y;let s=o.pts.length||1;a/=s,i/=s;let l=0;for(let c of o.pts){let f=Math.hypot(c.x-a,c.y-i);f>l&&(l=f)}return{cx:a,cy:i,rad:l}}),e=o=>{let a=o.length;return a<=2?[...o]:[o[Math.floor(a*.25)],o[Math.floor(a*.5)],o[Math.floor(a*.75)]]},r=[];for(let o=0;o<t.length;o++){let a=e(t[o].pts),i=[],s=1/0,l=null;for(let f of a){let m=1/0;for(let u=0;u<t.length;u++){if(u===o||Math.abs(t[u].y-t[o].y)<.001)continue;let h=n[u],b=Math.hypot(f.x-h.cx,f.y-h.cy)-h.rad;if(b>=m&&b>=s)continue;let p=lo(t[u].pts,f.x,f.y);p<m&&(m=p),t[u].depth<t[o].depth&&p<s&&(s=p,l=t[u].y)}Number.isFinite(m)&&m>0&&i.push(m)}i.sort((f,m)=>f-m);let c=i.length?i[Math.floor(i.length/2)]:1;r.push({pitch:c,belowY:l})}return r}function Xn(t,n,e,r){let o=t[n],a=o.pts.length>=2?[...o.pts]:o.pts.length===1?(()=>{let f=o.pts[0],m=f.x-r.x,u=f.y-r.y,h=Math.hypot(m,u)||1;m/=h,u/=h;let b=Math.max(e[n].pitch,.001)*.5;return[{x:f.x+u*b,y:f.y-m*b},{x:f.x-u*b,y:f.y+m*b}]})():[];if(a.length<2)return null;let i=0,s=0;for(let f=1;f<a.length;f++){let m=Math.hypot(a[f].x-a[f-1].x,a[f].y-a[f-1].y);m>1e-6&&(i+=m,s++)}let l=s>0?i/s:0,c=co(a,Math.max(l*so,ot));return{pts:c,nrm:ao(c,r),front:Math.max(e[n].pitch*ro,ot),back:Math.max(e[n].pitch*io,ot)}}var gt=1.5,Un=.3;function rn(t,n){if(t.length<3)return t;let e=t[0],r=t[t.length-1],o=r.x-e.x,a=r.y-e.y,i=Math.hypot(o,a),s=-1,l=-1;for(let m=1;m<t.length-1;m++){let u=t[m],h=i>1e-12?Math.abs((u.x-e.x)*a-(u.y-e.y)*o)/i:Math.hypot(u.x-e.x,u.y-e.y);h>s&&(s=h,l=m)}if(s<=n||l<0)return[e,r];let c=rn(t.slice(0,l+1),n),f=rn(t.slice(l),n);return[...c.slice(0,-1),...f]}function Yn(t,n){if(t.length<4)return t;let e=rn([...t,t[0]],n);return e.pop(),e.length>=3?e:t}function jn(t,n,e){if(t.length<2)return[];let r=e??Wt(t),o=new Map;for(let i=0;i<t.length;i++){let s=o.get(t[i].blockId);s?s.push(i):o.set(t[i].blockId,[i])}let a=[];for(let[,i]of o){let s=[];for(let x of i){let w=t[x].patch;w&&w.length>=3?a.push({outline:[...w],holes:[],topY:t[x].y}):s.push(x)}if(!s.length)continue;s.sort((x,w)=>t[x].depth-t[w].depth);let c=s.map(x=>Xn(t,x,r,n)).filter(x=>x!==null);if(!c.length)continue;let f=(x,w)=>({x:x.pts[w].x-x.nrm[w][0]*(x.front+gt),y:x.pts[w].y-x.nrm[w][1]*(x.front+gt)}),m=(x,w)=>({x:x.pts[w].x+x.nrm[w][0]*(x.back+gt),y:x.pts[w].y+x.nrm[w][1]*(x.back+gt)}),u=c[0],h=c[c.length-1],b=[];for(let x=0;x<u.pts.length;x++)b.push(f(u,x));for(let x of c)b.push(m(x,x.pts.length-1));for(let x=h.pts.length-1;x>=0;x--)b.push(m(h,x));for(let x=c.length-1;x>=0;x--)b.push(f(c[x],0));let p=Hn(b),d=1/0;for(let x of s)t[x].y<d&&(d=t[x].y);if(!Number.isFinite(d))continue;if(p.length>=3&&Math.abs(ft(p))>1e-6&&c.every(x=>{let w=x.pts[Math.floor(x.pts.length/2)];return It(p,w.x,w.y)})){a.push({outline:Yn(p,Un),holes:[],topY:d});continue}for(let x of mo(c))a.push({outline:x,holes:[],topY:d})}return a}function mo(t){let n=[];for(let e of t){let r=[],o=[],a=e.front+gt,i=e.back+gt;for(let l=0;l<e.pts.length;l++){let c=e.pts[l],f=e.nrm[l];r.push([c.x-f[0]*a,c.y-f[1]*a]),o.push([c.x+f[0]*i,c.y+f[1]*i])}let s=[...r,...o.reverse()];s.length<3||(s.push(s[0]),n.push([s]))}if(!n.length)return[];try{let e=Dn.union(n[0],...n.slice(1)),r=[];for(let o of e){if(!o.length||o[0].length<4)continue;let a=o[0].map(([l,c])=>({x:l,y:c})),i=a[0],s=a[a.length-1];a.length>1&&Math.abs(i.x-s.x)<1e-9&&Math.abs(i.y-s.y)<1e-9&&a.pop(),a.length>=3&&r.push(Yn(a,Un))}return r}catch{return[]}}function Hn(t){let n=[];for(let e of t){let r=n[n.length-1];r&&Math.hypot(e.x-r.x,e.y-r.y)<1e-9||n.push(e)}for(;n.length>2&&Math.hypot(n[0].x-n[n.length-1].x,n[0].y-n[n.length-1].y)<1e-9;)n.pop();return n}var sn=class{constructor(n){this.minX=1/0;this.minY=1/0;this.maxX=-1/0;this.maxY=-1/0;this.rings=n;for(let e of n)for(let r of e)r.x<this.minX&&(this.minX=r.x),r.y<this.minY&&(this.minY=r.y),r.x>this.maxX&&(this.maxX=r.x),r.y>this.maxY&&(this.maxY=r.y)}containsAll(n){for(let e of n)if(e.x<this.minX||e.x>this.maxX||e.y<this.minY||e.y>this.maxY)return!1;for(let e of this.rings){let r=!0;for(let o of n)if(!It(e,o.x,o.y)){r=!1;break}if(r)return!0}return!1}};function Gn(t,n,e,r,o,a){if(r.length<3)return;if(e.containsAll(r)){let c=[0,1,0],f=r[0];for(let m=1;m+1<r.length;m++){let u=r[m],h=r[m+1];t.tri([f.x*g,o,f.y*g],[u.x*g,o,u.y*g],[h.x*g,o,h.y*g],c,a)}return}let i=r.map(c=>[c.x,c.y]);i.push(i[0]);let s;try{s=Dn.intersection([i],n)}catch{return}let l=[0,1,0];for(let c of s){if(!c.length||c[0].length<4)continue;let f=c[0],m=[],u=[];for(let b=0;b<f.length-1;b++)m.push(f[b][0],f[b][1]),u.push([f[b][0],f[b][1]]);if(u.length<3)continue;let h=oo(m,void 0,2);for(let b=0;b<h.length;b+=3){let p=u[h[b]],d=u[h[b+1]],y=u[h[b+2]];t.tri([p[0]*g,o,p[1]*g],[d[0]*g,o,d[1]*g],[y[0]*g,o,y[1]*g],l,a)}}}function Vn(t,n,e,r,o,a,i){if(n.length<2)return;let s=i??Wt(n),l=[0,1,0],c=a&&a.length>=3?[[...a.map(h=>[h.x,h.y]),[a[0].x,a[0].y]]]:null,f=a&&a.length>=3?new sn([[...a]]):null,m=h=>{t.setMaterial(2),h(),t.setMaterial(0)},u=h=>{t.setMaterial(3),h(),t.setMaterial(0)};for(let h=0;h<n.length;h++){let b=n[h];if(b.patch&&b.patch.length>=3){let E=[...b.patch],M=s[h].belowY??r;if(u(()=>{if(c&&f)Gn(t,c,f,E,b.y,o.tread);else{let I=E[0];for(let B=1;B+1<E.length;B++){let k=E[B],D=E[B+1];t.tri([I.x*g,b.y,I.y*g],[k.x*g,b.y,k.y*g],[D.x*g,b.y,D.y*g],l,o.tread)}}}),b.y>M+On){let I=0,B=0;for(let k of E)I+=k.x,B+=k.y;I/=E.length,B/=E.length,m(()=>{for(let k=0;k<E.length;k++){let D=E[k],U=E[(k+1)%E.length],S=U.x-D.x,_=U.y-D.y,N=Math.hypot(S,_);if(N<1e-6)continue;let O=_/N,P=-S/N;(D.x-I)*O+(D.y-B)*P<0&&(O=-O,P=-P);let F=[O,0,P],R=[D.x*g,b.y,D.y*g],T=[U.x*g,b.y,U.y*g],C=[D.x*g,M,D.y*g],v=[U.x*g,M,U.y*g];t.tri(R,T,v,F,o.riser),t.tri(R,v,C,F,o.riser)}})}continue}let p=Xn(n,h,s,e);if(!p)continue;let{pts:d,nrm:y,front:x,back:w}=p,A=s[h].belowY??r;for(let E=0;E+1<d.length;E++){let M=d[E],I=d[E+1],B=y[E],k=y[E+1];if(Math.hypot(I.x-M.x,I.y-M.y)<1e-6||B[0]===0&&B[1]===0||k[0]===0&&k[1]===0)continue;let D=[(M.x-B[0]*x)*g,b.y,(M.y-B[1]*x)*g],U=[(I.x-k[0]*x)*g,b.y,(I.y-k[1]*x)*g],S=[(M.x+B[0]*w)*g,b.y,(M.y+B[1]*w)*g],_=[(I.x+k[0]*w)*g,b.y,(I.y+k[1]*w)*g];if(u(()=>{c&&f?Gn(t,c,f,[{x:M.x-B[0]*x,y:M.y-B[1]*x},{x:I.x-k[0]*x,y:I.y-k[1]*x},{x:I.x+k[0]*w,y:I.y+k[1]*w},{x:M.x+B[0]*w,y:M.y+B[1]*w}],b.y,o.tread):(t.tri(D,U,_,l,o.tread),t.tri(D,_,S,l,o.tread))}),b.y>A+On){let N=[D[0],A,D[2]],O=[U[0],A,U[2]],P=[-B[0],0,-B[1]];m(()=>{t.tri(D,U,O,P,o.riser),t.tri(D,O,N,P,o.riser)})}}}}function fo(t,n){let e=t.eventConfigurationIds;return!e?.length||!!n&&e.includes(n)}function Wn(t,n){return t.filter(e=>e.type!=="shape"||fo(e,n))}function Zn(t,n){let e=t.focalPoint??{x:0,y:0};return t.floors?.length?t.floors.map((r,o)=>({objects:Wn(r.objects,n),focal:{x:(r.focalPoint??e).x,y:(r.focalPoint??e).y},baseHeightM:r.baseHeightM??0,index:o})):[{objects:Wn(t.objects,n),focal:e,baseHeightM:0,index:0}]}var ho={minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};function Mt(t){return Mn(t)??ho}function Kn(t,n){let e=jt(t.outline,ot),r=Mt(e),o=n.filter(i=>i!==t&&i.outline&&i.outline.length>=3&&Nt(r,Mt(i.outline)));if(!o.length)return[e];let a=i=>{let s=i.map(l=>[l.x,l.y]);return s.push(s[0]),s};try{let i=zn.difference([a(e)],...o.map(l=>[a(l.outline)])),s=[];for(let l of i){if(!l.length)continue;let c=l[0].map(([f,m])=>({x:f,y:m}));if(c.length>1){let f=c[0],m=c[c.length-1];Math.abs(f.x-m.x)<1e-9&&Math.abs(f.y-m.y)<1e-9&&c.pop()}c.length>=3&&s.push(c)}return s.length?s:[e]}catch{return[e]}}function $n(t,n){if(!n.length)return t;let e=a=>{let i=a.map(s=>[s.x,s.y]);return i.push(i[0]),i},r=n.map(a=>[e(a)]),o=[];for(let a of t){let i;try{i=zn.intersection([e(a.outline)],r.flat())}catch{o.push(a);continue}for(let s of i){if(!s.length)continue;let l=s[0].map(([c,f])=>({x:c,y:f}));if(l.length>1){let c=l[0],f=l[l.length-1];Math.abs(c.x-f.x)<1e-9&&Math.abs(c.y-f.y)<1e-9&&l.pop()}l.length>=3&&o.push({outline:l,holes:[],topY:a.topY})}}return o.length?o:t}function po(t,n){return t===void 0||n===void 0?!0:Math.abs(t-n)<.001}var zt=class{constructor(){this.rings=[];this.boxes=[];this.levels=[]}subtract(n,e){let r=n.map(l=>[l.x,l.y]);if(r.length<3)return[];r.push(r[0]);let o=Mt(n),a=this.rings.filter((l,c)=>Nt(o,this.boxes[c])&&po(e,this.levels[c])),i=[[r]];if(a.length)try{i=bo.difference([r],...a).map(c=>c.map(f=>f.map(([m,u])=>[m,u])))}catch{i=[[r]]}this.rings.push([r]),this.boxes.push(o),this.levels.push(e);let s=[];for(let l of i){if(!l.length)continue;let c=l[0].map(([f,m])=>({x:f,y:m}));if(c.length>1){let f=c[0],m=c[c.length-1];Math.abs(f.x-m.x)<1e-9&&Math.abs(f.y-m.y)<1e-9&&c.pop()}c.length>=3&&s.push(c)}return s}};function yo(t,n){if(!n)return t;let e=1/0,r=-1/0,o=1/0,a=-1/0;for(let m of t)e=Math.min(e,m.x),r=Math.max(r,m.x),o=Math.min(o,m.y),a=Math.max(a,m.y);let i=(e+r)/2,s=(o+a)/2,l=n*Math.PI/180,c=Math.cos(l),f=Math.sin(l);return t.map(m=>{let u=m.x-i,h=m.y-s;return{x:i+u*c-h*f,y:s+u*f+h*c}})}function bt(t){let n=null;if(t.kind==="polygon"&&t.points&&t.points.length>=3&&(n=t.points),t.kind==="rect"&&t.width&&t.height&&(n=Tt(t.x??0,t.y??0,t.width,t.height)),t.kind==="ellipse"&&t.width&&t.height){let e=(t.x??0)+t.width/2,r=(t.y??0)+t.height/2;n=Ht(e,r,t.width/2,t.height/2)}return n?yo(n,t.rotation):null}function Et(t){let n=t.role??"",e={stage:{kind:"stage",heightM:1},entrance:{kind:"portal",heightM:2.7},exit:{kind:"portal",heightM:2.7},screen:{kind:"solid",heightM:6},wall:{kind:"solid",heightM:2.8},rail:{kind:"solid",heightM:1.1},suite:{kind:"suite",heightM:3},obstruction:{kind:"solid",heightM:4.5},sound:{kind:"solid",heightM:1.45},restroom:{kind:"solid",heightM:2.4},bar:{kind:"solid",heightM:1.1},concession:{kind:"solid",heightM:1.1},coat:{kind:"solid",heightM:1.1},goal:{kind:"portal",heightM:1.8}},r=n==="stage"&&xn(t.stageKind)?{kind:"stage",heightM:.06}:e[n]??{kind:"plate",heightM:.25};return{...r,heightM:t.heightM??r.heightM}}var xo=.08;function qn(t,n){let e=bt(t),r=Et(t),o=r.heightM;if(!e||r.kind!=="plate"&&r.kind!=="stage")return o;let a=1/0,i=1/0,s=-1/0,l=-1/0;for(let f of e)a=Math.min(a,f.x),i=Math.min(i,f.y),s=Math.max(s,f.x),l=Math.max(l,f.y);let c=o;for(let f of n)s>f.minX&&a<f.maxX&&l>f.minY&&i<f.maxY&&c<=f.topOffsetM+1e-6&&(c=f.topOffsetM+xo);return n.push({minX:a,minY:i,maxX:s,maxY:l,topOffsetM:c}),c}function mt(t,n,e){return{x:t.x+(n.x-t.x)*e,y:t.y+(n.y-t.y)*e}}function Jn(t){if(t.length!==4)return t;let n=Math.hypot(t[1].x-t[0].x,t[1].y-t[0].y),e=Math.hypot(t[2].x-t[1].x,t[2].y-t[1].y);return n>=e?t:[t[1],t[2],t[3],t[0]]}function Ct(t,n,e){return[mt(t[0],t[1],n),mt(t[0],t[1],e),mt(t[3],t[2],e),mt(t[3],t[2],n)]}function Qn(t,n,e){return[mt(t[0],t[3],n),mt(t[1],t[2],n),mt(t[1],t[2],e),mt(t[0],t[3],e)]}function at(t,n,e,r,o,a){K(t,n,void 0,()=>e,r,o,a,W)}var an=2.4,go=.75,Mo=.15;function Ft(t){if(t.points&&t.points.length>=3)return t.points;let{center:n,width:e,height:r,rotation:o}=t;if(!e||!r)return null;let a=(o??0)*Math.PI/180,i=Math.cos(a),s=Math.sin(a),l=e/2,c=r/2;return[[-l,-c],[l,-c],[l,c],[-l,c]].map(([f,m])=>({x:n.x+f*i-m*s,y:n.y+f*s+m*i}))}function te(t,n,e,r,o){let a=Ft(n);a&&K(t,a,void 0,()=>e+an,e,st(r,o.boothTop),o.boothWall,W)}function cn(t){if(t.shape==="round"){let f=t.radius;return f?Ht(t.center.x,t.center.y,f,f,24):null}let{width:n,height:e,rotation:r,center:o}=t;if(!n||!e)return null;let a=(r??0)*Math.PI/180,i=Math.cos(a),s=Math.sin(a),l=n/2,c=e/2;return[[-l,-c],[l,-c],[l,c],[-l,c]].map(([f,m])=>({x:o.x+f*i-m*s,y:o.y+f*s+m*i}))}function ne(t,n,e,r,o){let a=cn(n);a&&K(t,a,void 0,()=>e+go,e,st(r,o.tableTop),o.tableWall,W)}function ee(t,n,e,r,o,a,i,s){let l=bt(n);if(!l)return;let c=s?s.kind==="stage":n.role==="stage",f=s?s.kind==="screen":n.role==="screen",m=s?{kind:c?"stage":"solid",heightM:s.topY-s.baseY}:Et(n),u=s?.baseY??e,h=s?.topY??e+r;if(c&&i){let x=1/0,w=-1/0,A=1/0,E=-1/0;for(let M of l)M.x<x&&(x=M.x),M.x>w&&(w=M.x),M.y<A&&(A=M.y),M.y>E&&(E=M.y);i.push({cx:(x+w)/2*g,cz:(A+E)/2*g,y:h,halfX:Math.max((w-x)/2*g,.5),halfZ:Math.max((E-A)/2*g,.5)})}let b=H(n.fill),p=c&&b?nt(o.stageTop,et(Pt(b,.18),.9),.9):st(b,c?o.stageTop:o.decorTop),d=f?b:null,y=c?b?nt(o.stageWall,et(b,.58),.82):o.stageWall:f?d?nt(et(d,1.42),[.24,.46,.82],.08):[.24,.46,.82]:st(H(n.fill),o.decorWall);if(m.kind==="portal"&&l.length===4){let x=Jn(l);at(t,Ct(x,0,.16),h,u,p,y),at(t,Ct(x,.84,1),h,u,p,y),at(t,x,h,Math.max(u,h-.35),p,y);return}if(m.kind==="suite"&&l.length===4){let x=l.map((E,M)=>{let I=l[(M+1)%4],B=(E.x+I.x)/2,k=(E.y+I.y)/2;return Math.hypot(B-a.x,k-a.y)}),w=x.indexOf(Math.min(...x)),A=[0,1,2,3].map(E=>l[(w+E)%4]);at(t,Ct(A,0,.08),h,u,p,y),at(t,Ct(A,.92,1),h,u,p,y),at(t,Qn(A,.88,1),h,u,p,y),at(t,A,h,Math.max(u,h-.18),p,y);return}at(t,l,h,u,p,y)}function un(t){let{x:n,y:e,width:r,height:o}=t;if(!r||!o)return null;let a=n+r/2,i=e+o/2,s=(t.rotation??0)*Math.PI/180,l=Math.cos(s),c=Math.sin(s),f=r/2,m=o/2;return[[-f,-m],[f,-m],[f,m],[-f,m]].map(([u,h])=>({x:a+u*l-h*c,y:i+u*c+h*l}))}function So(t){if(!t||!t.startsWith("data:image/svg+xml"))return null;let n=t.slice(t.indexOf(",")+1);if(/;base64/i.test(t.slice(0,t.indexOf(","))))try{n=atob(n)}catch{return null}else try{n=decodeURIComponent(n)}catch{}let e=n.match(/<(?:rect|path)\b[^>]*\bfill="([^"]+)"/i);if(!e)return null;let r=e[1].trim();if(r==="none"||r==="transparent")return null;let o=r.match(/^url\(#([^)]+)\)$/);if(!o)return H(r);let a=n.match(new RegExp(`<(?:linear|radial)Gradient\\b[^>]*\\bid="${o[1]}"[^>]*>([\\s\\S]*?)</(?:linear|radial)Gradient>`,"i"));if(!a)return null;let i=[];for(let s of a[1].matchAll(/stop-color="([^"]+)"/gi)){let l=H(s[1].trim());l&&i.push(l)}return i.length?i.reduce((s,l,c)=>nt(s,l,1/(c+1)),i[0]):null}function oe(t,n,e,r){if(n.layer==="foreground")return;let o=un(n);if(!o)return;let a=e+Mo,i=st(So(n.href),r.decorTop),s=Math.max(0,Math.min(1,n.opacity??1));s<1&&(i=nt(r.ground,i,s)),K(t,o,void 0,()=>a,e,i,nt(i,r.decorWall,.5),W)}function re(t,n,e,r,o){if(!n.points||n.points.length<3)return;let a=st(r,o.gaTop);K(t,n.points,n.holes,()=>e+.15,e,a,o.gaWall,W)}var Ro=6,Ao=2.2,ie=.1,Po=.3,Io=1.8,wo=.9,_o=.55,To=6e3;function se(t){let{doc:n,units:e,seats:r,surfaces:o,focal:a}=t,i=n.zones??[],s=[];if(i.length){let l=new Map;for(let f of e)for(let m of f.objects)m.type==="section"&&m.zone&&l.set(m.id,m.zone);let c=new Map;for(let f=0;f<r.length;f++){let m=r[f],u=o.seatOwner[f],h=m.zoneId??(u?l.get(u):void 0);if(!h)continue;let b=c.get(h);b||(b={n:0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0,sumY:0},c.set(h,b)),b.n++,m.x<b.minX&&(b.minX=m.x),m.y<b.minY&&(b.minY=m.y),m.x>b.maxX&&(b.maxX=m.x),m.y>b.maxY&&(b.maxY=m.y),b.sumY+=o.seatDeckY(f)}for(let f of i){let m=c.get(f.id),u=[];for(let[h,b]of l)b===f.id&&u.push(h);if(!m||m.n===0){s.push({id:f.id,label:f.label,color:H(f.color),sectionIds:u,seatCount:0,center:[0,0,0],radius:0,focalWorld:[(f.focalPoint??a).x*g,1.5,(f.focalPoint??a).y*g]});continue}s.push({id:f.id,label:f.label,color:H(f.color),sectionIds:u,seatCount:m.n,center:[(m.minX+m.maxX)/2*g,m.sumY/m.n,(m.minY+m.maxY)/2*g],radius:.5*Math.hypot((m.maxX-m.minX)*g,(m.maxY-m.minY)*g)||1,focalWorld:[(f.focalPoint??a).x*g,1.5,(f.focalPoint??a).y*g]})}}return s}function ae(t){let{doc:n,units:e,seats:r,surfaces:o,seatData:a,hintedSeatFloor:i,zones:s,focal:l}=t,c=[],f=[],m=[];for(let u of s)u.seatCount!==0&&c.push({id:`zone:${u.id}`,kind:"zone",text:u.label,anchor:[u.center[0],u.center[1]+Ro,u.center[2]],color:n.zones?.find(h=>h.id===u.id)?.color});{let u=new Map,h=new Map;for(let b=0;b<r.length;b++){let p=o.seatOwner[b];if(!p)continue;let d=u.get(p);d||(d={n:0,x:0,y:0,deck:0},u.set(p,d)),d.n++,d.x+=r[b].x,d.y+=r[b].y,d.deck+=o.seatDeckY(b);let y=h.get(p);y||(y={minX:1/0,maxX:-1/0,minY:1/0,maxY:-1/0},h.set(p,y)),r[b].x<y.minX&&(y.minX=r[b].x),r[b].x>y.maxX&&(y.maxX=r[b].x),r[b].y<y.minY&&(y.minY=r[b].y),r[b].y>y.maxY&&(y.maxY=r[b].y)}for(let b of e)for(let p of b.objects){if(p.type!=="section")continue;let d=u.get(p.id);if(!d||d.n===0)continue;let y=h.get(p.id),x=[d.x/d.n*g,d.deck/d.n,d.y/d.n*g],w=p.displayLabel||p.label||p.id;f.push({id:p.id,floorIndex:b.index,label:w,seatCount:d.n,center:x,radius:Math.max(1,Math.hypot(y.maxX-y.minX,y.maxY-y.minY)*.5*g),focalWorld:[b.focal.x*g,b.baseHeightM+1.5,b.focal.y*g]});let A=n.floors?.[b.index]?.name?.trim().toLocaleLowerCase();e.length>1&&A===w.trim().toLocaleLowerCase()||c.push({id:`section:${p.id}`,kind:"section",text:w,anchor:[x[0],x[1]+Ao,x[2]],floorIndex:b.index})}}{for(let p of e)for(let d of p.objects){if(d.type!=="gaArea")continue;let y=At(d.points);if(!y)continue;let x=d.displayLabel||d.label||d.id;c.push({id:`ga:${d.id}`,kind:"ga",text:d.capacity>0?`${x} \xB7 ${d.capacity.toLocaleString()}`:x,anchor:[y.x*g,p.baseHeightM+Io,y.y*g],floorIndex:p.index})}let u=new Map;for(let p of e)for(let d of p.objects)d.type==="section"&&u.set(d.id,d.displayLabel||d.label||d.id);let h=new Map;for(let p=0;p<r.length;p++){let d=r[p],y=Math.hypot(d.x-l.x,d.y-l.y),x=h.get(d.rowId);(!x||y>x.far)&&h.set(d.rowId,{seat:d,index:p,far:y})}for(let[p,d]of h){let y=Eo(d.seat.label,p,u.get(d.seat.sectionId??""));y&&c.push({id:`row:${p}`,kind:"row",text:y,anchor:[d.seat.x*g,o.seatDeckY(d.index)+wo,d.seat.y*g],floorIndex:i[d.index]})}let b=new Map;for(let p=0;p<r.length;p++){let d=r[p],y=d.label?d.label.lastIndexOf("-"):-1,x=b.get(d.rowId);x||(x={n:0,x:0,y:0,z:0,minX:1/0,maxX:-1/0,minZ:1/0,maxZ:-1/0,label:y>0?d.label.slice(0,y):d.rowId,sectionId:d.sectionId},b.set(d.rowId,x));let w=p*3,A=a.iPosition[w],E=a.iPosition[w+1],M=a.iPosition[w+2];x.n++,x.x+=A,x.y+=E,x.z+=M,x.minX=Math.min(x.minX,A),x.maxX=Math.max(x.maxX,A),x.minZ=Math.min(x.minZ,M),x.maxZ=Math.max(x.maxZ,M)}for(let[p,d]of b)m.push({id:p,label:d.label,sectionId:d.sectionId,seatCount:d.n,center:[d.x/d.n,d.y/d.n,d.z/d.n],radius:Math.max(.8,Math.hypot(d.maxX-d.minX,d.maxZ-d.minZ)*.5)});if(r.length<=To)for(let p=0;p<r.length;p++){let d=r[p],y=Bo(d.displayLabel||d.label);y&&c.push({id:`seat:${d.id}`,kind:"seat",text:y,anchor:[d.x*g,o.seatDeckY(p)+_o,d.y*g],floorIndex:i[p]})}}for(let u of e)for(let h of u.objects)if(h.type==="shape"&&h.role&&["entrance","exit","screen","suite","obstruction"].includes(h.role)){let b=bt(h),p=b?At(b):null;if(!p||!h.label)continue;c.push({id:`architecture:${h.id}`,kind:"annotation",text:h.label,anchor:[p.x*g,u.baseHeightM+Et(h).heightM+ie,p.y*g],color:h.fill,floorIndex:u.index})}else if(h.type==="text"){if(!h.text)continue;c.push({id:`text:${h.id}`,kind:"annotation",text:h.text,anchor:[h.position.x*g,u.baseHeightM+ie,h.position.y*g],color:h.color,rotation:h.rotation,floorIndex:u.index})}else if(h.type==="booth"){let b=Ft(h);if(!b)continue;let p=At(b);if(!p)continue;c.push({id:`booth:${h.id}`,kind:"booth",text:h.displayLabel||h.label||h.id,anchor:[p.x*g,u.baseHeightM+an+Po,p.y*g],floorIndex:u.index})}return{labels:c,sections:f,rows:m}}function ce(t,n){if(n.length>1)for(let e of n)t.push({id:`floor:${e.id}`,kind:"floor",text:e.label,anchor:[e.center[0],e.box.max[1]+1.2,e.center[2]],floorIndex:e.index})}function Bo(t){let n=t.lastIndexOf("-");return n>=0&&n<t.length-1?t.slice(n+1):t}function Eo(t,n,e){let r=t?t.lastIndexOf("-"):-1,o=r>0?t.slice(0,r):n;return o&&gn(o,e)}var Co=.15,Fo=.9,vo=1.76;function ko(){return{background:{top:[...nn.top],bottom:[...nn.bottom]},structure:tn,seatStates:{...Bn},seatScale:1,materials:{seat:null,shell:null,roughness:.78}}}function ue(t){let n=ko();if(!t)return n;let e=H(t.background);if(e){n.background={top:et(e,Fo),bottom:et(e,vo)};let i={};for(let[s,l]of Object.entries(tn))i[s]=nt(l,e,Co);n.structure=i}let r=H(t.selectionColor)??H(t.accent);r&&(n.seatStates={...n.seatStates,selected:r});let o=t.seatScale;typeof o=="number"&&Number.isFinite(o)&&(n.seatScale=An(o));let a=t.venue3d;if(a){let i=H(a.deck),s=H(a.fascia);i&&(n.structure={...n.structure,tierTop:i,gaTop:i}),s&&(n.structure={...n.structure,tierWall:s,gaWall:s}),n.materials.seat=H(a.seat),n.materials.shell=H(a.shell),typeof a.roughness=="number"&&Number.isFinite(a.roughness)&&(n.materials.roughness=Math.min(1,Math.max(0,a.roughness)))}return n}function le(t,n){let e=[];for(let r of n)e.push(...t.seatStates[r]);return e}var Oo=.05,me=.05,Lo=.15,ln=25;function fe(t,n,e){let r=new Map,o=new Array(n.length).fill(null),a=new Float64Array(n.length),i=new Array(n.length).fill(void 0),s=new Array(n.length).fill(void 0),l=new Map,c=[],f=new Set;for(let u=0;u<t.length;u+=1){let h=t[u];for(let b of h.objects){if(b.type==="table"&&f.add(b.id),b.type!=="section"||!b.outline||b.outline.length<3)continue;let p=jt(b.outline,ot);l.set(b.id,{section:b,unit:h,frontU:1/0,hasSeats:!1,rows:new Map,seatIndices:[]}),c.push({id:b.id,floorIndex:u,box:Mt(p),section:b,unit:h,outline:p})}}let m=new Map;for(let u of c){let h=m.get(u.floorIndex);h?h.push(u):m.set(u.floorIndex,[u])}for(let u=0;u<n.length;u++){let h=n[u],b=e?m.get(e[u])??[]:c,p=h.sectionId?b.find(y=>y.id===h.sectionId)??b.find(y=>y.section.logicalSectionId===h.sectionId&&qt({x:h.x,y:h.y},y.outline,y.section.holes)):void 0,d=p?[p]:b;for(let y of d){if(e&&y.floorIndex!==e[u]||!p&&(h.x<y.box.minX||h.x>y.box.maxX||h.y<y.box.minY||h.y>y.box.maxY||!qt({x:h.x,y:h.y},y.outline,y.section.holes)))continue;o[u]=y.id;let x=l.get(y.id);x.hasSeats=!0;let w=h.focalPoint??y.unit.focal,A=Math.hypot(h.x-w.x,h.y-w.y);A<x.frontU&&(x.frontU=A),x.seatIndices.push(u);let E=h.rowId||`__seat-${u}`,M=x.rows.get(E);M?M.push({x:h.x,y:h.y}):x.rows.set(E,[{x:h.x,y:h.y}]);break}}for(let[u,h]of l){let b=dn(h.section,{floorBaseHeightM:h.unit.baseHeightM}),p=h.unit.baseHeightM,d=b.rake>0?Math.tan(b.rake*Math.PI/180):0,y=b.rake<=.01&&b.height<=p+.001,x=h.section.surfaceKind,w=x==="flat"?!0:x==="rakedRows"&&b.rake>.01?!1:y,A=h.hasSeats?yn(u,n,h.seatIndices,h.unit.focal):{sectionId:u,rows:[],blockCount:0},M=A.rows.length<2?Pn([...h.rows.values()].map(R=>({points:R})),h.unit.focal):null,I=1/0;if(M){if(h.hasSeats)for(let R of h.rows.values())for(let T of R){let C=M.depthAt(T.x,T.y);C<I&&(I=C)}if(!h.hasSeats||!Number.isFinite(I)){I=1/0;for(let R of h.section.outline){let T=M.depthAt(R.x,R.y);T<I&&(I=T)}}}let B=p+Oo,k=Math.max(B,b.height),D=R=>{let T=Math.max(0,R-I)*ut,C=Math.min(T*d,ln);return Math.max(B,b.height+C)},U=R=>{let T=Math.max(0,R)*ut,C=Math.min(T*d,ln);return Math.max(B,b.height+C)},S=w?[]:A.rows.map(R=>({pts:R.pts,y:U(R.blockDepth),depth:R.blockDepth,blockId:R.blockId,...f.has(R.id)?{patch:Nn(R.pts,ot)}:{}})),_=S.length?S[0].y:k,N=S.map(R=>{let T=R.patch&&R.patch.length>=3?R.patch:R.pts,C=0,v=0;for(let L of T)C+=L.x,v+=L.y;let G=T.length||1;C/=G,v/=G;let X=0;for(let L of T){let Y=Math.hypot(L.x-C,L.y-v);Y>X&&(X=Y)}return{cx:C,cy:v,rad:X}}),O=w?()=>k:S.length>=2?(R,T)=>{let C=1/0,v=_;for(let G=0;G<S.length;G++){let X=N[G];if(Math.hypot(R-X.cx,T-X.cy)-X.rad>=C)continue;let L=S[G].patch,Y=L&&L.length>=3?It(L,R,T)?0:Dt(L,R,T):Dt(S[G].pts,R,T);Y<C&&(C=Y,v=S[G].y)}return v}:(R,T)=>M?D(M.depthAt(R,T)):k,P=[0,1,0],F=S.length>=2||w?()=>P:(R,T)=>{if(!M)return P;let C=M.depthAt(R,T);if(C<=I)return P;let v=(C-I)*ut;if(v*d>=ln||b.height+v*d<=B)return P;let[G,X]=M.gradientAt(R,T);if(G===0&&X===0)return P;let L=1/Math.hypot(d,1);return[-G*d*L,L,-X*d*L]};if(!w)for(let R of A.rows){let T=U(R.blockDepth);for(let C of R.seatIndices)i[C]=T}for(let R of A.rows){let T=[];for(let L=1;L<R.pts.length;L++){let Y=Math.hypot(R.pts[L].x-R.pts[L-1].x,R.pts[L].y-R.pts[L-1].y);Y>1e-6&&T.push(Y)}T.sort((L,Y)=>L-Y);let C=T.length?T[Math.floor(T.length/2)]:1/0,v=1/0,G=R.pts[Math.floor(R.pts.length/2)];if(G)for(let L of A.rows){if(L===R||L.blockId!==R.blockId)continue;let Y=Dt(L.pts,G.x,G.y);Y>1e-6&&Y<v&&(v=Y)}let X=Math.min(C,Math.max(v,C*.5));if(Number.isFinite(X)&&X>0)for(let L of R.seatIndices)s[L]=X}r.set(u,{sectionId:u,deckAt:O,normalAt:F,flat:w,bottomY:p,rowLevels:S,landingY:_})}for(let u=0;u<n.length;u++){let h=o[u],b=n[u];if(h){let d=i[u];a[u]=(d??r.get(h).deckAt(b.x,b.y))+Lo;continue}let p=b.eyeHeightM;a[u]=Number.isFinite(p)?Math.max(0,p-Gt):0}return{bySection:r,seatOwner:o,seatDeckY:u=>a[u],seatPitchU:u=>s[u]}}var Go=.25,Do=1.2,No=.6,Xo=.45,Uo=2.3,Yo=Math.PI/180;function pt(t,n,e){let r=e*Yo;return{x:t.x+n*Math.sin(r),y:t.y+n*Math.cos(r)}}function jo(t,n){let e=n.rings[n.rings.length-1];if(!e)return!1;let r=e.outerRMedian*.85;for(let o of t){if(o.role!=="wall")continue;let a=o.points&&o.points.length>=2?o.points:o.x!==void 0&&o.y!==void 0&&o.width!==void 0&&o.height!==void 0?[{x:o.x,y:o.y},{x:o.x+o.width,y:o.y},{x:o.x+o.width,y:o.y+o.height},{x:o.x,y:o.y+o.height}]:[];if(a.length<2)continue;let i=0;for(let s of a)Math.hypot(s.x-n.centre.x,s.y-n.centre.y)>=r&&i++;if(i>=a.length/2)return!0}return!1}var Ho=24;function Vo(t,n,e,r,o,a,i,s){let l=e.binCount,c=Ho,f=ut,m=a+.02,u=[];for(let S=0;S<l;S++){let _=(e.startBin+S+.5)*n.binStepDeg,N=new Float64Array(c+1);for(let O=0;O<=c;O++){let P=r[S]+(o[S]-r[S])*O/c;N[O]=Math.max(m,wn(n,e,_,P)-Go)}u.push(N)}let h=[i.bandTop[0]*s.top,i.bandTop[1]*s.top,i.bandTop[2]*s.top],b=[i.bandTop[0]*s.bottomCap,i.bandTop[1]*s.bottomCap,i.bandTop[2]*s.bottomCap],p=[i.bandWall[0]*s.top,i.bandWall[1]*s.top,i.bandWall[2]*s.top],d=[i.bandWall[0]*s.wallBottom,i.bandWall[1]*s.wallBottom,i.bandWall[2]*s.wallBottom],y=(S,_)=>{let N=(e.startBin+S+.5)*n.binStepDeg,O=r[S]+(o[S]-r[S])*_/c,P=pt(n.centre,O,N);return[P.x*f,u[S][_],P.y*f]};{let S=Math.tan(12*Math.PI/180);for(let _=0;_<6;_++){let N=!1;for(let P=0;P<l;P++)for(let F=c-1;F>=0;F--)u[P][F]>u[P][F+1]&&(u[P][F]=u[P][F+1],N=!0);let O=e.closed?l:l-1;for(let P=0;P<O;P++){let F=(P+1)%l;for(let R=0;R<=c;R++){let T=u[F][R]-u[P][R];if(Math.abs(T)>1)continue;let C=r[P]+(o[P]-r[P])*R/c,v=r[F]+(o[F]-r[F])*R/c,G=pt(n.centre,C,(e.startBin+P+.5)*n.binStepDeg),X=pt(n.centre,v,(e.startBin+F+.5)*n.binStepDeg),L=S*Math.hypot(X.x-G.x,X.y-G.y)*f;T>L?(u[F][R]=u[P][R]+L,N=!0):-T>L&&(u[P][R]=u[F][R]+L,N=!0)}}if(!N)break}}let x=1,w=(S,_)=>{for(let N=0;N<=c;N+=4)if(Math.abs(u[S][N]-u[_][N])>x)return!0;return Math.abs(u[S][c]-u[_][c])>x},A=Math.tan(38*Math.PI/180),E=S=>(o[S]-r[S])/c*f,M=(S,_)=>u[S][_+1]-u[S][_]>A*Math.max(1e-6,E(S)),I=(S,_)=>{let N=e.closed?(S-1+l)%l:Math.max(0,S-1),O=e.closed?(S+1)%l:Math.min(l-1,S+1);Math.abs(u[N][_]-u[S][_])>x&&(N=S),Math.abs(u[O][_]-u[S][_])>x&&(O=S);let P=Math.max(0,_-1),F=Math.min(c,_+1);P<_&&M(S,P)&&(P=_),F>_&&M(S,_)&&(F=_);let R=y(N,_),T=y(O,_),C=y(S,P),v=y(S,F),G=T[0]-R[0],X=T[1]-R[1],L=T[2]-R[2],Y=v[0]-C[0],j=v[1]-C[1],$=v[2]-C[2],z=X*$-L*j,q=L*Y-G*$,tt=G*j-X*Y,Z=Math.hypot(z,q,tt);return Z>1e-12?(z/=Z,q/=Z,tt/=Z,q<0&&(z=-z,q=-q,tt=-tt),[z,q,tt]):[0,1,0]},B=(S,_)=>{let N=[S[0],a,S[2]],O=[_[0],a,_[2]],P=_[0]-S[0],F=_[2]-S[2],R=Math.hypot(P,F);if(!(R>1e-12))return;let T=[F/R,0,-P/R];t.tri(S,_,O,T,p,p,d),t.tri(S,O,N,T,p,d,d)},k=.05*lt,D=S=>o[S]-r[S]<k,U=e.closed?l:l-1;for(let S=0;S<U;S++){let _=(S+1)%l;if(D(S)||D(_))continue;if(w(S,_)){let T=(e.startBin+S+1)*n.binStepDeg,C=(j,$)=>{let z=(r[S]+r[_])/2,q=(o[S]+o[_])/2,tt=z+(q-z)*$/c,Z=pt(n.centre,tt,T);return[Z.x*f,u[j][$],Z.y*f]};for(let j=0;j<c;j++){let $=y(S,j),z=y(S,j+1),q=C(S,j),tt=C(S,j+1),Z=I(S,j),it=I(S,j+1);t.triN($,q,tt,Z,Z,it,h),t.triN($,tt,z,Z,it,it,h);let vt=y(_,j),kt=y(_,j+1),dt=C(_,j),St=C(_,j+1),yt=I(_,j),xt=I(_,j+1);t.triN(dt,vt,kt,yt,yt,xt,h),t.triN(dt,kt,St,yt,xt,xt,h);let ct=C(S,j),rt=C(S,j+1),Ot=C(_,j+1),Kt=C(_,j),Lt=rt[0]-ct[0],Rt=rt[2]-ct[2],$t=Math.hypot(Lt,Rt);if($t>1e-12){let fn=[Rt/$t,0,-Lt/$t];t.tri(ct,rt,Ot,fn,p),t.tri(ct,Ot,Kt,fn,p)}}let v=y(S,0),G=y(_,0),X=y(_,c),L=y(S,c),Y=j=>[j[0],a,j[2]];t.tri(Y(v),Y(X),Y(G),[0,-1,0],b),t.tri(Y(v),Y(L),Y(X),[0,-1,0],b),B(v,G),B(L,X);continue}for(let T=0;T<c;T++){let C=I(S,T),v=I(_,T),G=I(_,T+1),X=I(S,T+1);if(M(S,T)||M(_,T)){let z=(rt,Ot)=>{let Kt=(e.startBin+rt+.5)*n.binStepDeg,Lt=r[rt]+(o[rt]-r[rt])*(T+.5)/c,Rt=pt(n.centre,Lt,Kt);return[Rt.x*f,Ot,Rt.y*f]},q=y(S,T),tt=y(_,T),Z=z(S,u[S][T]),it=z(_,u[_][T]);t.triN(q,tt,it,C,v,v,h),t.triN(q,it,Z,C,v,C,h);let vt=y(_,T+1),kt=y(S,T+1),dt=z(S,u[S][T+1]),St=z(_,u[_][T+1]);t.triN(dt,St,vt,X,G,G,h),t.triN(dt,vt,kt,X,G,X,h);let yt=it[0]-Z[0],xt=it[2]-Z[2],ct=Math.hypot(yt,xt);if(ct>1e-12){let rt=[-xt/ct,0,yt/ct];t.tri(Z,it,St,rt,p),t.tri(Z,St,dt,rt,p)}continue}let L=y(S,T),Y=y(_,T),j=y(_,T+1),$=y(S,T+1);t.triN(L,Y,j,C,v,G,h),t.triN(L,j,$,C,G,X,h)}let N=y(S,0),O=y(_,0),P=y(_,c),F=y(S,c),R=T=>[T[0],a,T[2]];t.tri(R(N),R(P),R(O),[0,-1,0],b),t.tri(R(N),R(F),R(P),[0,-1,0],b),B(N,O),B(F,P)}if(!e.closed)for(let S of[0,l-1])for(let _=0;_<c;_++)B(y(S,_),y(S,_+1))}function he(t,n,e){let{bottomY:r,colors:o,ao:a}=e,i=new Float64Array(n.binCount).fill(-1/0);for(let f of n.rings)for(let m of f.arcs){let u=new Float64Array(m.binCount),h=new Float64Array(m.binCount);for(let p=0;p<m.binCount;p++){let d=(m.startBin+p)%n.binCount,y=Math.max(0,m.innerR[p]-ot);u[p]=Math.max(y,i[d]+.001),h[p]=Math.max(u[p]+.001,m.outerR[p]+ot)}let b=0;for(let p=0;p<m.binCount;p++){let d=m.topLevelM[p]-r;d>b&&(b=d)}b>=Do&&Vo(t,n,m,u,h,r,o,a);for(let p=0;p<m.binCount;p++){let d=(m.startBin+p)%n.binCount;h[p]>i[d]&&(i[d]=h[p])}}if(e.deriveShell===!1||jo(e.shapes,n))return;let s=n.rings[n.rings.length-1],l=No*lt,c=Xo*lt;for(let f of s.arcs){let m=[],u=[];for(let p=0;p<f.binCount;p++){let d=(f.startBin+p+.5)*n.binStepDeg,y=f.outerR[p]+ot+l;m.push(pt(n.centre,y,d)),u.push(pt(n.centre,y+c,d))}let h=-1/0;for(let p=0;p<f.binCount;p++)f.topLevelM[p]>h&&(h=f.topLevelM[p]);let b=()=>h+Uo;f.closed?K(t,u,[m.slice().reverse()],b,r,o.shellTop,o.shellWall,a):K(t,[...u,...m.slice().reverse()],void 0,b,r,o.shellTop,o.shellWall,a)}}function be(t,n,e,r,o,a,i,s){if(!n.outline||n.outline.length<3)return;let l=e.baseHeightM,c=st(r,s.tierTop);if(!o)return;let f=d=>o.deckAt(d.x,d.y),m=Kn(n,i),u=m[0]??n.outline;if(o.rowLevels.length>=2){let d=Wt(o.rowLevels),y=$n(jn(o.rowLevels,e.focal,d),m),x=()=>[0,1,0];for(let A of y){let E=Math.max(l,A.topY-.02);for(let M of a.subtract(A.outline,E))K(t,M,A.holes,()=>E,l,c,s.tierWall,W,void 0,x)}y.length||K(t,u,n.holes,()=>o.landingY,l,c,s.tierWall,W);let w={tread:[c[0]*W.top,c[1]*W.top,c[2]*W.top],riser:[c[0]*.72,c[1]*.72,c[2]*.72]};for(let A of m.length?m:[u])Vn(t,o.rowLevels,e.focal,o.landingY,w,A,d);return}let h=o.flat?1/0:me,b=d=>o.normalAt(d.x,d.y),p=o.flat?o.landingY:void 0;for(let d of a.subtract(u,p))K(t,d,n.holes,f,l,c,s.tierWall,W,h,b)}function Wo(t,n,e){let r=new Set;for(let i of t.objects)i.type==="section"&&r.add(i.id);let o=new Map;for(let i=0;i<n.length;i++){let s=e.seatOwner[i];if(!s||!r.has(s))continue;let l=e.bySection.get(s);if(l&&l.rowLevels.length>=2)continue;let c=n[i],f=o.get(s);f||(f=new Map,o.set(s,f));let m=c.rowId||`__seat-${i}`,u=f.get(m);u||(u={pts:[],levelM:0,n:0},f.set(m,u)),u.pts.push({x:c.x,y:c.y}),u.levelM+=e.seatDeckY(i),u.n++}let a=[];for(let i of t.objects){if(i.type!=="section")continue;let s=e.bySection.get(i.id);if(s&&s.rowLevels.length>=2){let c=s.rowLevels.filter(f=>!f.patch).map(f=>({pts:f.pts,levelM:f.y}));c.length>=2&&a.push({sectionId:i.id,rows:c});continue}let l=o.get(i.id);l&&a.push({sectionId:i.id,rows:[...l.values()].map(c=>({pts:c.pts,levelM:c.levelM/c.n}))})}return a}function pe(t,n,e,r,o,a,i=!0){let s=Wo(n,e,r);if(!s.length)return;let l=In(s,n.focal);l&&(t.setMaterial(0),he(t,l,{bottomY:n.baseHeightM,colors:{bandTop:et(o.tierTop,.8),bandWall:o.tierWall,shellTop:a??et(o.tierWall,1.15),shellWall:a??o.tierWall},ao:W,shapes:n.objects.filter(c=>c.type==="shape"),deriveShell:i}))}function de(t){let{doc:n,units:e,seats:r,surfaces:o,solids:a,hintedSeatFloor:i,seatFloor:s}=t,l=[];{let c=e.map(()=>({minX:1/0,minY:1/0,minZ:1/0,maxX:-1/0,maxY:-1/0,maxZ:-1/0}));for(let u=0;u<a.floor.length;u+=1){let h=Math.max(0,Math.min(e.length-1,Math.round(a.floor[u]))),b=u*3,p=c[h];p.minX=Math.min(p.minX,a.position[b]),p.minY=Math.min(p.minY,a.position[b+1]),p.minZ=Math.min(p.minZ,a.position[b+2]),p.maxX=Math.max(p.maxX,a.position[b]),p.maxY=Math.max(p.maxY,a.position[b+1]),p.maxZ=Math.max(p.maxZ,a.position[b+2])}let f=new Map;for(let u=0;u<e.length;u++)for(let h of e[u].objects)h.type==="section"&&f.set(h.id,u);let m=e.map(()=>({n:0,minX:1/0,minY:1/0,minDeck:1/0,maxX:-1/0,maxY:-1/0,maxDeck:-1/0,sumX:0,sumDeck:0,sumZ:0}));for(let u=0;u<r.length;u++){let h=o.seatOwner[u],b=(h!==null?f.get(h):void 0)??i[u];if(b===void 0)continue;let p=m[b],d=r[u];p.n++,d.x<p.minX&&(p.minX=d.x),d.y<p.minY&&(p.minY=d.y),d.x>p.maxX&&(p.maxX=d.x),d.y>p.maxY&&(p.maxY=d.y);let y=o.seatDeckY(u);p.sumX+=d.x*g,p.sumDeck+=y,p.sumZ+=d.y*g,p.minDeck=Math.min(p.minDeck,y),p.maxDeck=Math.max(p.maxDeck,y+1.6),s[u]=b}for(let u=0;u<e.length;u++){let h=m[u],b=n.floors?.[u],p=c[u],d=Math.min(h.n?h.minX*g:e[u].focal.x*g-1,Number.isFinite(p.minX)?p.minX:1/0),y=Math.max(h.n?h.maxX*g:e[u].focal.x*g+1,Number.isFinite(p.maxX)?p.maxX:-1/0),x=Math.min(h.n?h.minY*g:e[u].focal.y*g-1,Number.isFinite(p.minZ)?p.minZ:1/0),w=Math.max(h.n?h.maxY*g:e[u].focal.y*g+1,Number.isFinite(p.maxZ)?p.maxZ:-1/0),A=Math.min(h.n?Math.min(e[u].baseHeightM,h.minDeck):e[u].baseHeightM,Number.isFinite(p.minY)?p.minY:1/0),E=Math.max(h.n?Math.max(h.maxDeck,A+.5):A+.5,Number.isFinite(p.maxY)?p.maxY:-1/0),M=[h.n?h.sumX/h.n:(d+y)/2,h.n?h.sumDeck/h.n:(A+E)/2,h.n?h.sumZ/h.n:(x+w)/2],I=Math.max(1,.5*Math.hypot(y-d,E-A,w-x));l.push({index:u,id:b?.id??`floor-${u}`,label:b?.name??(e.length>1?`Floor ${u+1}`:"Venue"),seatCount:h.n,center:M,radius:I,box:{min:[d,A,x],max:[y,E,w]},focalWorld:[e[u].focal.x*g,e[u].baseHeightM+1.5,e[u].focal.y*g]})}}return l}function mn(t,n){let e=1/0,r=1/0,o=-1/0,a=-1/0,i=(s,l)=>{s<e&&(e=s),l<r&&(r=l),s>o&&(o=s),l>a&&(a=l)};for(let s of n)i(s.x,s.y);for(let s of t)for(let l of s.objects)if(l.type==="section")for(let c of l.outline)i(c.x,c.y);else if(l.type==="shape"&&l.points)for(let c of l.points)i(c.x,c.y);else if(l.type==="gaArea")for(let c of l.points)i(c.x,c.y);else if(l.type==="booth"){let c=Ft(l);if(c)for(let f of c)i(f.x,f.y)}else if(l.type==="table"){let c=cn(l);if(c)for(let f of c)i(f.x,f.y)}else if(l.type==="decorImage"){let c=un(l);if(c)for(let f of c)i(f.x,f.y)}return Number.isFinite(e)||(e=-100,r=-100,o=100,a=100),{minX:e,minY:r,maxX:o,maxY:a}}function ye(t,n,e,r,o,a){if(n.length===1){let i=Math.max(60,(o.maxX-o.minX+o.maxY-o.minY)*.06),s=Tt(o.minX-i,o.minY-i,o.maxX-o.minX+i*2,o.maxY-o.minY+i*2);K(t,s,void 0,()=>0,-.4,a.ground,a.ground,W)}else{let i=n.reduce((h,b)=>b.baseHeightM<h.baseHeightM?b:h);t.setFloor(i.index);let s=e.filter((h,b)=>r[b]===i.index),l=mn([i],s),c=Math.hypot(l.maxX-l.minX,l.maxY-l.minY),f=Math.max(28,Math.min(80,c*.04)),m=Tt(l.minX-f,l.minY-f,l.maxX-l.minX+f*2,l.maxY-l.minY+f*2),u=i.baseHeightM-.03;K(t,m,void 0,()=>u,u-.22,a.ground,a.ground,W)}}function xe(t,n,e){let{cx:r,cz:o,radius:a}=e,i=1/0,s=1/0,l=1/0,c=-1/0,f=-1/0,m=-1/0,u=(p,d,y)=>{i=Math.min(i,p),c=Math.max(c,p),s=Math.min(s,d),f=Math.max(f,d),l=Math.min(l,y),m=Math.max(m,y)};for(let p=0;p<t.position.length;p+=3)u(t.position[p],t.position[p+1],t.position[p+2]);for(let p=0;p<n.count;p++){let d=p*3,y=n.iPosition[d],x=n.iPosition[d+1],w=n.iPosition[d+2],A=Math.max(.35,n.iMaxRadius[p]??.35);u(y-A,x,w-A),u(y+A,x+1.6,w+A)}Number.isFinite(i)||(i=r-a,c=r+a,s=0,f=a*.16,l=o-a,m=o+a);let h=[(i+c)/2,(s+f)/2,(l+m)/2],b=Math.max(1,.5*Math.hypot(c-i,f-s,m-l));return{center:h,radius:b,minY:s,maxY:f}}function ge(t,n,e,r,o,a){let i=1/0,s=1/0,l=-1/0,c=-1/0;for(let A=0;A<t.count;A++){let E=A*3,M=t.iPosition[E],I=t.iPosition[E+2];M<i&&(i=M),M>l&&(l=M),I<s&&(s=I),I>c&&(c=I)}for(let A of n)i=Math.min(i,A.cx-A.halfX),l=Math.max(l,A.cx+A.halfX),s=Math.min(s,A.cz-A.halfZ),c=Math.max(c,A.cz+A.halfZ);let f=e.minX*g,m=e.maxX*g,u=e.minY*g,h=e.maxY*g,b=f,p=m,d=u,y=h;if(Number.isFinite(i)){let A=Math.max(2,.06*Math.hypot(l-i,c-s));b=Math.max(f,i-A),p=Math.min(m,l+A),d=Math.max(u,s-A),y=Math.min(h,c+A)}let x=Math.min(0,r),w=Math.max(o,a*.05);return{min:[b,x,d],max:[p,w,y]}}function Me(t,n,e){let r=()=>({byObjectId:new Map,elements:[]});if(!n||!t)return r();let o=bn(n);if(!o.ok||o.value.id!==t)return r();let a=new Map;for(let m of e)for(let u of m.objects)u.type==="shape"&&a.set(u.id,{shape:u,unit:m});let i=new Set,s=new Set,l=new Map((n.overlay.productionElements??[]).map(m=>{let u=m.runtimeContentImageUrl;return[m.id,typeof u=="string"&&/^(?:blob:|data:image\/|https:\/\/)/.test(u)?u:void 0]})),c=[];for(let m of o.value.overlay.productionElements??[]){let u=a.get(m.objectId),h=u?bt(u.shape):null,b=m.baseElevationM??0;if(!u||!h||h.length<3||!m.id||i.has(m.id)||s.has(m.objectId)||!Number.isFinite(m.heightM)||m.heightM<.05||m.heightM>50||!Number.isFinite(b)||b<-10||b>100)return r();i.add(m.id),s.add(m.objectId);let p=h.map(B=>B.x*g),d=h.map(B=>B.y*g),y=u.unit.baseHeightM+b,x=Math.min(...p),w=Math.max(...p),A=Math.min(...d),E=Math.max(...d),M,I=l.get(m.id)??m.contentImageUrl;if(m.kind==="screen"&&I)if(w-x>=E-A){let B=Math.abs(A-u.unit.focal.y*g)<=Math.abs(E-u.unit.focal.y*g)?A-.006:E+.006;M=[[x,y,B],[w,y,B],[x,y+m.heightM,B],[w,y+m.heightM,B]]}else{let B=Math.abs(x-u.unit.focal.x*g)<=Math.abs(w-u.unit.focal.x*g)?x-.006:w+.006;M=[[B,y,A],[B,y,E],[B,y+m.heightM,A],[B,y+m.heightM,E]]}c.push({id:m.id,objectId:m.objectId,kind:m.kind,floorIndex:u.unit.index,baseY:y,topY:y+m.heightM,bounds:{min:[x,y,A],max:[w,y+m.heightM,E]},occlusion:m.occlusion,...I?{contentImageUrl:I}:{},...M?{contentPlane:M}:{}})}let f=c.sort((m,u)=>m.id.localeCompare(u.id));return{byObjectId:new Map(f.map(m=>[m.objectId,m])),elements:f}}function Q(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}function J(t){return Array.isArray(t)?t:[]}function zo(t){let n=[t];for(;n.length;){let e=n.pop();if(Array.isArray(e)){n.push(...e);continue}if(!Q(e))continue;let r=Q(e.extensions)?e.extensions:null;if(r&&Object.prototype.hasOwnProperty.call(r,"KHR_draco_mesh_compression"))return!0;n.push(...Object.values(e))}return!1}function Zt(t,n){return!Array.isArray(t)||t.length!==n||!t.every(e=>typeof e=="number"&&Number.isFinite(e))?null:t}function Zo(){return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}function Ko(t,n){let e=new Array(16).fill(0);for(let r=0;r<4;r++)for(let o=0;o<4;o++)for(let a=0;a<4;a++)e[r*4+o]+=t[a*4+o]*n[r*4+a];return e}function $o(t){let n=Zt(t.matrix,16);if(n)return n;if(t.matrix!==void 0)return null;let e=t.translation===void 0?[0,0,0]:Zt(t.translation,3),r=t.rotation===void 0?[0,0,0,1]:Zt(t.rotation,4),o=t.scale===void 0?[1,1,1]:Zt(t.scale,3);if(!e||!r||!o)return null;let[a,i,s,l]=r,c=Math.hypot(a,i,s,l);if(!(c>1e-8))return null;let f=a/c,m=i/c,u=s/c,h=l/c,b=f+f,p=m+m,d=u+u,y=f*b,x=f*p,w=f*d,A=m*p,E=m*d,M=u*d,I=h*b,B=h*p,k=h*d;return[(1-(A+M))*o[0],(x+k)*o[0],(w-B)*o[0],0,(x-k)*o[1],(1-(y+M))*o[1],(E+I)*o[1],0,(w+B)*o[2],(E-I)*o[2],(1-(y+A))*o[2],0,e[0],e[1],e[2],1]}function qo(t,n,e,r){return[t[0]*n+t[4]*e+t[8]*r+t[12],t[1]*n+t[5]*e+t[9]*r+t[13],t[2]*n+t[6]*e+t[10]*r+t[14]]}function Jo(t){let n=t[0],e=t[4],r=t[8],o=t[1],a=t[5],i=t[9],s=t[2],l=t[6],c=t[10],f=a*c-i*l,m=i*s-o*c,u=o*l-a*s,h=n*f+e*m+r*u;if(Math.abs(h)<1e-12)return null;let b=1/h;return[f*b,m*b,u*b,(r*l-e*c)*b,(n*c-r*s)*b,(e*s-n*l)*b,(e*i-r*a)*b,(r*o-n*i)*b,(n*a-e*o)*b]}function Se(t,n,e,r){let o=t[0]*n+t[1]*e+t[2]*r,a=t[3]*n+t[4]*e+t[5]*r,i=t[6]*n+t[7]*e+t[8]*r,s=Math.hypot(o,a,i)||1;return o/=s,a/=s,i/=s,[o,a,i]}function Qo(t){if(t.byteLength<20||t.byteLength>8388608)return null;let n=new DataView(t.buffer,t.byteOffset,t.byteLength);if(n.getUint32(0,!0)!==1179937895||n.getUint32(4,!0)!==2||n.getUint32(8,!0)!==t.byteLength)return null;let e=12,r=null,o=null;for(;e+8<=t.byteLength;){let a=n.getUint32(e,!0),i=n.getUint32(e+4,!0);if(e+=8,a%4!==0||e+a>t.byteLength)return null;let s=t.subarray(e,e+a);if(i===1313821514&&!r)try{let l=JSON.parse(new TextDecoder().decode(s).replace(/[\u0000 ]+$/g,""));if(!Q(l))return null;r=l}catch{return null}else if(i===5130562&&!o)o=s;else return null;e+=a}return e===t.byteLength&&r&&o?{json:r,bin:o}:null}function tr(t){return t===5120||t===5121?1:t===5122||t===5123?2:t===5125||t===5126?4:0}function nr(t){return t==="SCALAR"?1:t==="VEC2"?2:t==="VEC3"?3:t==="VEC4"?4:0}function er(t,n,e){return e===5120?t.getInt8(n):e===5121?t.getUint8(n):e===5122?t.getInt16(n,!0):e===5123?t.getUint16(n,!0):e===5125?t.getUint32(n,!0):t.getFloat32(n,!0)}function or(t){let n=t instanceof Uint8Array?t:new Uint8Array(t),e=Qo(n);if(!e)return{ok:!1,issue:"invalid_glb"};let{json:r,bin:o}=e;if(!Q(r.asset)||r.asset.version!=="2.0")return{ok:!1,issue:"unsupported_glb"};let a=J(r.extensionsUsed).filter(A=>typeof A=="string");if(a.includes("KHR_draco_mesh_compression")||zo(r))return{ok:!1,issue:"draco_not_allowed"};if(a.length||J(r.extensionsRequired).length)return{ok:!1,issue:"unsupported_glb"};if(J(r.images).length||J(r.textures).length)return{ok:!1,issue:"external_resource"};let i=J(r.buffers);if(i.length!==1||!Q(i[0])||i[0].uri!==void 0||typeof i[0].byteLength!="number"||!Number.isInteger(i[0].byteLength)||i[0].byteLength<0||i[0].byteLength>o.byteLength)return{ok:!1,issue:"external_resource"};let s=J(r.accessors),l=J(r.bufferViews),c=J(r.meshes),f=J(r.nodes),m=J(r.scenes),u=typeof r.scene=="number"?r.scene:0;if(!Q(m[u]))return{ok:!1,issue:"unsupported_glb"};let h=new DataView(o.buffer,o.byteOffset,o.byteLength),b=(A,E,M)=>{if(typeof A!="number"||!Number.isInteger(A)||!Q(s[A]))return null;let I=s[A];if(I.type!==E||I.sparse!==void 0||I.normalized===!0||typeof I.count!="number"||!Number.isInteger(I.count)||I.count<1||typeof I.componentType!="number"||!M.includes(I.componentType)||typeof I.bufferView!="number")return null;let B=l[I.bufferView];if(!Q(B)||B.buffer!==0||typeof B.byteLength!="number"||!Number.isInteger(B.byteLength)||B.byteLength<0)return null;let k=nr(I.type),D=tr(I.componentType),U=typeof B.byteStride=="number"?B.byteStride:k*D,S=typeof B.byteOffset=="number"?B.byteOffset:0,_=typeof I.byteOffset=="number"?I.byteOffset:0,N=S+_,O=_+(I.count-1)*U+k*D;if(!Number.isInteger(U)||!Number.isInteger(S)||!Number.isInteger(_)||U<k*D||S<0||_<0||S+B.byteLength>o.byteLength||O>B.byteLength)return null;let P=[];for(let F=0;F<I.count;F++){let R=[];for(let T=0;T<k;T++){let C=er(h,N+F*U+T*D,I.componentType);if(!Number.isFinite(C))return null;R.push(C)}P.push(R)}return P},p=[],d=[],y=0,x=new Set,w=(A,E)=>{if(typeof A!="number"||!Number.isInteger(A)||!Q(f[A])||x.has(A))return!1;x.add(A);let M=f[A],I=$o(M);if(!I)return!1;let B=Ko(E,I),k=Jo(B);if(!k)return!1;if(M.mesh!==void 0){if(typeof M.mesh!="number")return!1;let D=c[M.mesh];if(!Q(D))return!1;for(let U of J(D.primitives)){if(!Q(U)||U.mode!==void 0&&U.mode!==4||!Q(U.attributes))return!1;let S=b(U.attributes.POSITION,"VEC3",[5126]),_=U.attributes.NORMAL===void 0?null:b(U.attributes.NORMAL,"VEC3",[5126]);if(!S||U.attributes.NORMAL!==void 0&&!_)return!1;let N=S.length;if(U.indices!==void 0){let P=typeof U.indices=="number"?s[U.indices]:null;N=Q(P)?P.count:void 0}if(typeof N!="number"||!Number.isInteger(N)||N%3!==0||(y+=N/3,y>1e5))return!1;let O=U.indices===void 0?S.map((P,F)=>[F]):b(U.indices,"SCALAR",[5121,5123,5125]);if(!O||O.length%3!==0||O.length!==N)return!1;for(let P=0;P<O.length;P+=3){let F=[O[P][0],O[P+1][0],O[P+2][0]];if(F.some(C=>!Number.isInteger(C)||C<0||C>=S.length))return!1;let R=F.map(C=>qo(B,...S[C])),T=null;if(!_){let C=R[1][0]-R[0][0],v=R[1][1]-R[0][1],G=R[1][2]-R[0][2],X=R[2][0]-R[0][0],L=R[2][1]-R[0][1],Y=R[2][2]-R[0][2];T=Se([1,0,0,0,1,0,0,0,1],v*Y-G*L,G*X-C*Y,C*L-v*X)}for(let C=0;C<3;C++)p.push(...R[C]),d.push(..._?Se(k,..._[F[C]]):T)}}}for(let D of J(M.children))if(!w(D,B))return!1;return x.delete(A),!0};for(let A of J(m[u].nodes))if(!w(A,Zo()))return{ok:!1,issue:y>1e5?"triangle_limit":"unsupported_glb"};return!y||p.length!==y*9||d.length!==p.length?{ok:!1,issue:"unsupported_glb"}:{ok:!0,triangleCount:y,position:new Float32Array(p),normal:new Float32Array(d)}}function Re(t){try{return or(t)}catch{return{ok:!1,issue:"invalid_glb"}}}function As(t){let{doc:n}=t,e=ue(n.theme),r=e.structure,o=Zn(n,t.eventConfigurationId??n.eventConfigurationId),a=Me(t.eventConfigurationId,t.eventConfiguration,o),i=t.seats,s=new Yt,l=null;if(t.registeredShellGlb){let P=Re(t.registeredShellGlb);if(P.ok){let F=P.position.length/3,R=new Float32Array(P.position.length),T=e.materials.shell??r.tierWall;for(let C=0;C<F;C++){let v=P.normal[C*3+1],G=v<-.25?.4:.62+.38*Math.max(0,v);R[C*3]=T[0]*G,R[C*3+1]=T[1]*G,R[C*3+2]=T[2]*G}l={position:P.position,normal:P.normal,color:R,floor:new Float32Array(F).fill(-2),material:new Float32Array(F),count:F}}}let c=new Map;for(let P of o)for(let F of P.objects)c.set(F.id,P.index),F.type==="section"&&c.set(F.logicalSectionId??F.id,P.index);let f=i.map(P=>c.get(P.sectionId??"")??c.get(P.rowId??"")??0),m=mn(o,i);ye(s,o,i,f,m,r);let u=vn(n,i),h=new Map,b=new Map;for(let P of n.categories??[])h.set(P.key,P.color),P.seatGlyph&&b.set(P.key,P.seatGlyph);let p=[],d=fe(o,i,f),y=new Float32Array(i.length),x=[];for(let P=0;P<o.length;P++){let F=o[P];s.setFloor(P);let R=new zt,T=[],C=F.objects.filter(v=>v.type==="section"&&!!v.outline&&v.outline.length>=3);for(let v of F.objects)if(v.type==="section"){let G=s.vertexCount;be(s,v,F,kn(v,u),d.bySection.get(v.id),R,C,r);let X=s.vertexCount-G;X>0&&x.push({sectionId:v.id,start:G,count:X})}else if(v.type==="shape"){let G=a.byObjectId.get(v.id);s.setMaterial((G?.kind??v.role)==="screen"?1:0),ee(s,v,F.baseHeightM,qn(v,T),r,F.focal,p,G),s.setMaterial(0)}else v.type==="gaArea"?re(s,v,F.baseHeightM,H(h.get(v.categoryKey)),r):v.type==="booth"?te(s,v,F.baseHeightM,H(h.get(v.categoryKey)),r):v.type==="table"?ne(s,v,F.baseHeightM,H(v.fill??n.theme?.decorFill??"#232c40"),r):v.type==="decorImage"&&oe(s,v,F.baseHeightM,r);pe(s,F,i,d,r,e.materials.shell,!l)}let w=o.length>1?{x:o.reduce((P,F)=>P+F.focal.x,0)/o.length,y:o.reduce((P,F)=>P+F.focal.y,0)/o.length}:n.focalPoint??{x:(m.minX+m.maxX)/2,y:(m.minY+m.maxY)/2},A=Tn(l?[s.build(),l]:[s.build()]),E=Fn(i,t.initialState,d,y,h,b),M=se({doc:n,units:o,seats:i,surfaces:d,focal:w}),{labels:I,sections:B,rows:k}=ae({doc:n,units:o,seats:i,surfaces:d,seatData:E,hintedSeatFloor:f,zones:M,focal:w}),D=de({doc:n,units:o,seats:i,surfaces:d,solids:A,hintedSeatFloor:f,seatFloor:y});ce(I,D),E.iYaw=Cn(E.iPosition,i.length,P=>i[P].rowId,P=>{let F=o[y[P]]?.focal??w;return[F.x*g,F.y*g]});let U=(m.minX+m.maxX)/2*g,S=(m.minY+m.maxY)/2*g,_=.5*Math.hypot((m.maxX-m.minX)*g,(m.maxY-m.minY)*g)||10,N=xe(A,E,{cx:U,cz:S,radius:_}),O=ge(E,p,m,N.minY,N.maxY,_);return{solids:A,sectionSolidRanges:x,seats:E,bounds:{center:[(O.min[0]+O.max[0])/2,(O.min[1]+O.max[1])/2,(O.min[2]+O.max[2])/2],radius:_,groundY:0,box:O},renderBounds:{center:N.center,radius:N.radius},stateColorLUT:le(e,Bt),theme:e,seatCount:i.length,focalWorld:[w.x*g,1.5,w.y*g],zones:M,stages:p,productionElements:a.elements,sections:B,rows:k,labels:I,floors:D}}export{Bt as a,Qt as b,mr as c,nn as d,g as e,hr as f,Ge as g,Ne as h,br as i,Vt as j,Ar as k,Pr as l,_r as m,Tr as n,Br as o,Er as p,Cr as q,Fr as r,vr as s,kr as t,Or as u,Lr as v,Bo as w,As as x};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{g as V,s as m}from"./chunk-XD2P4ZS4.js";var te=3,I=4.5,T=3,O=24,ie=20;function F(t){return t.filter(a=>a.visible&&!!a.screenBox)}function y(t,a){return t.x<a.x+a.width&&t.x+t.width>a.x&&t.y<a.y+a.height&&t.y+t.height>a.y}function p(t){return t.length?Math.round(Math.min(...t)*100)/100:null}function o(t,a,s){return s.length?{code:t,message:a,count:s.length,samples:s.slice(0,ie)}:null}function B(t,a,s){return{primaryId:t.seatId,primaryLabel:t.label,...a==null?{}:{measured:Math.round(a*100)/100},...s==null?{}:{minimum:s}}}function A(t,a,s){return{primaryId:t.id,primaryLabel:t.label,...a==null?{}:{measured:Math.round(a*100)/100},...s==null?{}:{minimum:s}}}function $(t,a,s){return{primaryId:t.objectId,primaryLabel:t.text,...a==null?{}:{measured:Math.round(a*100)/100},...s==null?{}:{minimum:s}}}function g(t,a,s,l){return{primaryId:t,primaryLabel:a,secondaryId:s,secondaryLabel:l}}function ne(t,a="overview",s=null){let l=F(t.labels),c=F(t.hierarchyLabels),d=F(t.freeTextLabels),f=F(t.rowLabels),P=t.gaAreas.filter(e=>e.visible),D=l.map(e=>m(e.ink,e.fill)??0),W=c.map(e=>m(e.ink,e.fill)??0),X=d.map(e=>m(e.ink,e.background)??0),Y=P.map(e=>m(e.effectiveBackground,t.canvasBackground)??0),u=s?t.labels.filter(e=>e.categoryKey===s):t.labels,v=s?t.gaAreas.filter(e=>e.categoryKey===s):t.gaAreas,h=u.filter(e=>e.selected),x=u.filter(e=>e.status==="held"),w=u.filter(e=>e.status==="booked"),R=u.filter(e=>e.pointerTarget.active),M=new Set([...t.labels.filter(e=>e.visible&&(e.opacity>.25||e.selected||e.status!=="free")).map(e=>e.categoryKey),...t.gaAreas.filter(e=>e.visible&&e.opacity>.1).map(e=>e.categoryKey)]),S=h.length?p(h.map(e=>m(e.selectionRingColor??t.selectionRingColor,e.fill)??0)):null,n=[],k=(e,i)=>Array.from({length:e},(b,L)=>({primaryId:`overview:${L+1}`,primaryLabel:i}));a==="overview"&&t.rung==="sections"&&(n.push(o("overview-section-category-paint","Section overview shells must use the neutral hierarchy palette, not category paint",k(t.overviewStyle.categoryPaintedSectionShells,"category-painted section shell"))),n.push(o("overview-category-detail-visible","Category-tinted section detail must wait until section focus or seat zoom",k(t.overviewStyle.visibleCategoryDetailOutlines,"category detail outline"))),n.push(o("overview-row-hints-visible","Row and seat patterns must not clutter the section overview",k(t.overviewStyle.visibleSectionRowHints,"section row hint"))),n.push(o("overview-availability-clutter","Live availability counts belong in focused detail, not on section overview shells",k(t.overviewStyle.visibleSectionAvailabilityLabels,"section availability label"))),n.push(o("overview-ga-detail-visible","Section-contained standing paint belongs in focused detail, not on section overview shells",k(t.overviewStyle.visibleSectionGADetails,"section-contained GA detail")))),n.push(o("bookable-label-undersized","Visible bookable labels must meet the rendered small-text size floor",l.filter(e=>e.renderedFontPx<t.minimumVisibleLabelPx).map(e=>B(e,e.renderedFontPx,t.minimumVisibleLabelPx)))),n.push(o("bookable-label-viewport-clipped","Visible interaction labels must remain fully inside the buyer viewport",a==="interaction"?l.filter(e=>e.screenBox.x<0||e.screenBox.y<0||e.screenBox.x+e.screenBox.width>t.viewport.width||e.screenBox.y+e.screenBox.height>t.viewport.height).map(e=>B(e)):[])),n.push(o("row-label-viewport-clipped","Visible interaction row labels must remain fully inside the buyer viewport",a==="interaction"?f.flatMap((e,i)=>{let b=e.screenBox;return b.x<0||b.y<0||b.x+b.width>t.viewport.width||b.y+b.height>t.viewport.height?[{primaryId:`row-label-${i}`,primaryLabel:e.text}]:[]}):[]));let z=[];if(a==="interaction")for(let e=0;e<f.length;e+=1)for(let i=0;i<e;i+=1)y(f[e].screenBox,f[i].screenBox)&&z.push(g(`row-label-${i}`,f[i].text,`row-label-${e}`,f[e].text));if(n.push(o("row-label-collision","Visible interaction row labels must not overlap",z)),a==="interaction"){let e=u.length>0,i=v.length>0,b=e||i,L=v.filter(r=>r.visible),q=new Set([...u.flatMap(r=>r.sectionId?[r.sectionId]:[]),...v.flatMap(r=>r.sectionId?[r.sectionId]:[])]),J=new Set([...t.labels.map(r=>r.categoryKey),...t.gaAreas.map(r=>r.categoryKey)]),C=r=>r.screenCenter.x>=0&&r.screenCenter.x<=t.viewport.width&&r.screenCenter.y>=0&&r.screenCenter.y<=t.viewport.height;n.push(o("detail-rung-missing","Interaction evidence with bookable inventory must render the seat-detail rung",b&&t.rung!=="seats"?[{primaryId:"renderer",primaryLabel:t.rung}]:[])),n.push(o("detail-inventory-not-visible","Interaction evidence must frame at least one real bookable unit",b&&!u.some(C)&&!L.length?[{primaryId:"renderer",primaryLabel:"no target inventory in viewport"}]:[])),n.push(o("pointer-target-inactive","Interaction evidence must expose a live production pointer target",e&&!R.some(C)||!e&&i&&!L.some(r=>r.interactive)?[{primaryId:"renderer",primaryLabel:"no active pointer target in viewport"}]:[])),n.push(o("pointer-target-undersized","Every active production pointer target must reach at least 24 CSS pixels",R.filter(r=>C(r)&&r.pointerTarget.effectiveMinimumPx<O).map(r=>B(r,r.pointerTarget.effectiveMinimumPx,O)))),n.push(o("selected-state-missing","Interaction evidence must paint a selected unit and its renderer-owned ring",e&&(!h.length||!h.some(r=>t.selectionRingSeatIds.includes(r.seatId)))?[{primaryId:"renderer",primaryLabel:"selected state"}]:[])),n.push(o("selected-state-contrast-low","The selected-state ring must maintain 3:1 graphical contrast with the seat paint",h.length&&(S??0)<T?[{primaryId:h[0].seatId,primaryLabel:h[0].label,measured:Math.round((S??0)*100)/100,minimum:T}]:[])),n.push(o("held-state-missing","Interaction evidence must paint a held state when the floor has at least two status-managed units",u.length>=2&&!x.length?[{primaryId:"renderer",primaryLabel:"held state"}]:[])),n.push(o("booked-state-missing","Interaction evidence must paint a taken state when the floor has at least three status-managed units",u.length>=3&&!w.length?[{primaryId:"renderer",primaryLabel:"booked state"}]:[]));let Z=new Set(x.map(r=>`${r.fill.toLowerCase()}:${r.opacity}`)),ee=new Set(w.map(r=>`${r.fill.toLowerCase()}:${r.opacity}`));n.push(o("status-state-indistinct","Held and taken evidence must resolve to distinct renderer paint",x.length&&w.length&&[...Z].some(r=>ee.has(r))?[{primaryId:x[0].seatId,primaryLabel:x[0].label,secondaryId:w[0].seatId,secondaryLabel:w[0].label}]:[])),n.push(o("section-focus-missing","Interaction evidence must exercise section focus and its backdrop when section membership exists",q.size&&(!t.focusedSectionId||!t.focusBackdropVisible)?[{primaryId:"renderer",primaryLabel:"section focus"}]:[])),n.push(o("category-filter-missing","Interaction evidence must exercise a category filter when multiple categories exist",J.size>=2&&(!t.categoryFilterKeys||!t.categoryFilterKeys.length)?[{primaryId:"renderer",primaryLabel:"category filter"}]:[]));let E=t.labels.filter(r=>r.status==="free"&&!r.selected&&t.categoryFilterKeys!=null&&!t.categoryFilterKeys.includes(r.categoryKey)),Q=t.gaAreas.filter(r=>t.categoryFilterKeys!=null&&!t.categoryFilterKeys.includes(r.categoryKey));n.push(o("category-filter-ineffective","The active category filter must visibly dim excluded free inventory",(E.length||Q.length)&&!E.some(r=>r.opacity<=.25)&&!Q.some(r=>r.opacity<=.1)?[...E.map(r=>B(r,r.opacity)),...Q.map(r=>({primaryId:r.areaId,primaryLabel:r.label,measured:r.opacity}))]:[])),n.push(o("target-category-not-visible","A category-specific interaction scene must visibly paint its exact target category",s&&!M.has(s)?[{primaryId:s,primaryLabel:s}]:[])),n.push(o("target-category-filter-mismatch","A category-specific interaction scene must bind its filter to only the exact target category",s&&(t.categoryFilterKeys?.length!==1||t.categoryFilterKeys[0]!==s)?[{primaryId:s,primaryLabel:s}]:[]))}n.push(o("bookable-label-contrast-low","Visible bookable labels must meet 4.5:1 contrast against their actual paint",l.flatMap(e=>{let i=m(e.ink,e.fill)??0;return i<I?[B(e,i,I)]:[]})));let K=[];for(let e=0;e<l.length;e+=1)for(let i=0;i<e;i+=1)y(l[e].screenBox,l[i].screenBox)&&K.push(g(l[i].seatId,l[i].label,l[e].seatId,l[e].label));n.push(o("bookable-label-collision","Visible bookable labels must not overlap",K)),n.push(o("hierarchy-label-undersized","Visible section and zone labels must meet the rendered small-text size floor",c.filter(e=>e.renderedFontPx<(e.sizeFloorPx??V)).map(e=>A(e,e.renderedFontPx,e.sizeFloorPx??V)))),n.push(o("hierarchy-label-contrast-low","Visible section and zone labels must meet 4.5:1 contrast against their backing paint",c.flatMap(e=>{let i=m(e.ink,e.fill)??0;return i<I?[A(e,i,I)]:[]}))),n.push(o("hierarchy-label-viewport-clipped","Visible overview hierarchy labels must remain fully inside the buyer viewport",a==="overview"?c.filter(e=>e.screenBox.x<0||e.screenBox.y<0||e.screenBox.x+e.screenBox.width>t.viewport.width||e.screenBox.y+e.screenBox.height>t.viewport.height).map(e=>A(e)):[])),n.push(o("hierarchy-label-outside-section","Visible section labels must remain inside the filled section surface and outside holes",c.filter(e=>e.kind==="section"&&e.fitsContainer===!1).map(e=>A(e))));let _=[];for(let e=0;e<c.length;e+=1)for(let i=0;i<e;i+=1)y(c[e].screenBox,c[i].screenBox)&&_.push(g(c[i].id,c[i].label,c[e].id,c[e].label));n.push(o("hierarchy-label-collision","Visible hierarchy labels must not overlap each other",_));let G=[];for(let e of c)for(let i of l)y(e.screenBox,i.screenBox)&&G.push(g(e.id,e.label,i.seatId,i.label));n.push(o("hierarchy-bookable-collision","Visible hierarchy labels must not overlap bookable labels",G)),n.push(o("free-text-undersized","Visible chart text must meet the rendered small-text size floor",d.filter(e=>e.renderedFontPx<t.minimumVisibleLabelPx).map(e=>$(e,e.renderedFontPx,t.minimumVisibleLabelPx)))),n.push(o("free-text-contrast-low","Visible chart text must meet 4.5:1 contrast against its measured background",d.flatMap(e=>{let i=m(e.ink,e.background)??0;return i<I?[$(e,i,I)]:[]})));let U=[];for(let e=0;e<d.length;e+=1)for(let i=0;i<e;i+=1)y(d[e].screenBox,d[i].screenBox)&&U.push(g(d[i].objectId,d[i].text,d[e].objectId,d[e].text));n.push(o("free-text-collision","Visible chart text labels must not overlap each other",U));let N=[];for(let e of d)for(let i of l)y(e.screenBox,i.screenBox)&&N.push(g(e.objectId,e.text,i.seatId,i.label));n.push(o("free-text-bookable-collision","Visible chart text must not overlap bookable labels",N));let j=[];for(let e of d)for(let i of c)y(e.screenBox,i.screenBox)&&j.push(g(e.objectId,e.text,i.id,i.label));n.push(o("free-text-hierarchy-collision","Visible chart text must not overlap hierarchy labels",j)),n.push(o("ga-contrast-low","Visible GA surfaces must maintain 3:1 graphical contrast with the canvas",P.flatMap(e=>{let i=m(e.effectiveBackground,t.canvasBackground)??0;return i<T?[{primaryId:e.areaId,primaryLabel:e.label,measured:Math.round(i*100)/100,minimum:T}]:[]})));let H=n.filter(e=>!!e);return{version:te,passed:H.length===0,state:a,targetCategoryKey:s,resolvedRules:["rendered-overview-label-size","rendered-overview-label-contrast","rendered-overview-label-collision","rendered-overview-hierarchy-viewport","rendered-overview-hierarchy-containment","rendered-overview-section-first-style","rendered-overview-ga-contrast",...a==="interaction"?["rendered-detail-label-viewport","rendered-detail-inventory","rendered-pointer-target","rendered-selected-held-taken-states","rendered-section-focus","rendered-category-filter"]:[]],viewport:t.viewport,canvasBackground:t.canvasBackground,effectiveScale:t.effectiveScale,rung:t.rung,inventory:{totalBookableUnits:t.totalBookableUnits,totalLabelledBookableUnits:t.totalLabelledBookableUnits,visibleBookableLabels:l.length,hiddenBookableLabels:t.hiddenLabels,visibleHierarchyLabels:c.length,visibleFreeTextLabels:d.length,visibleGAAreas:P.length},overviewStyle:t.overviewStyle,composition:{hierarchy:t.hierarchyLabels.filter(e=>e.role==="name").map(e=>({id:e.id,kind:e.kind,label:e.label,visible:e.visible})).sort((e,i)=>e.kind.localeCompare(i.kind)||e.id.localeCompare(i.id)),labelledObjects:t.freeTextLabels.map(e=>({objectId:e.objectId,kind:e.kind,text:e.text,visible:e.visible})).sort((e,i)=>e.objectId.localeCompare(i.objectId)||e.kind.localeCompare(i.kind)),gaAreas:t.gaAreas.map(e=>({areaId:e.areaId,label:e.label,categoryKey:e.categoryKey,...e.sectionId?{sectionId:e.sectionId}:{},visible:e.visible})).sort((e,i)=>e.areaId.localeCompare(i.areaId)),bookableSectionIds:[...new Set(t.labels.flatMap(e=>e.sectionId?[e.sectionId]:[]))].sort(),categoryKeys:[...new Set([...t.labels.map(e=>e.categoryKey),...t.gaAreas.map(e=>e.categoryKey)])].sort(),activeCategoryKeys:[...M].sort()},metrics:{minimumRenderedBookableLabelPx:p(l.map(e=>e.renderedFontPx)),minimumBookableLabelContrast:p(D),minimumRenderedHierarchyLabelPx:p(c.map(e=>e.renderedFontPx)),minimumHierarchyLabelContrast:p(W),minimumRenderedFreeTextPx:p(d.map(e=>e.renderedFontPx)),minimumFreeTextContrast:p(X),minimumGAContrast:p(Y),minimumEffectivePointerTargetPx:p(R.map(e=>e.pointerTarget.effectiveMinimumPx)),selectedRingContrast:S==null?null:Math.round(S*100)/100},interaction:{applicable:{detail:u.length>0||v.length>0,pointer:u.length>0||v.length>0,held:u.length>=2,booked:u.length>=3,sectionFocus:u.some(e=>!!e.sectionId)||v.some(e=>!!e.sectionId),categoryFilter:new Set([...t.labels.map(e=>e.categoryKey),...t.gaAreas.map(e=>e.categoryKey)]).size>=2},selectedUnits:h.length,heldUnits:x.length,bookedUnits:w.length,activePointerTargets:R.length,focusedSectionId:t.focusedSectionId,focusBackdropVisible:t.focusBackdropVisible,categoryFilterKeys:t.categoryFilterKeys},findings:H}}export{te as a,O as b,ne as c};
|
|
1
|
+
import{g as V,s as m}from"./chunk-C7MR6CFC.js";var te=3,I=4.5,T=3,O=24,ie=20;function F(t){return t.filter(a=>a.visible&&!!a.screenBox)}function y(t,a){return t.x<a.x+a.width&&t.x+t.width>a.x&&t.y<a.y+a.height&&t.y+t.height>a.y}function p(t){return t.length?Math.round(Math.min(...t)*100)/100:null}function o(t,a,s){return s.length?{code:t,message:a,count:s.length,samples:s.slice(0,ie)}:null}function B(t,a,s){return{primaryId:t.seatId,primaryLabel:t.label,...a==null?{}:{measured:Math.round(a*100)/100},...s==null?{}:{minimum:s}}}function A(t,a,s){return{primaryId:t.id,primaryLabel:t.label,...a==null?{}:{measured:Math.round(a*100)/100},...s==null?{}:{minimum:s}}}function $(t,a,s){return{primaryId:t.objectId,primaryLabel:t.text,...a==null?{}:{measured:Math.round(a*100)/100},...s==null?{}:{minimum:s}}}function g(t,a,s,l){return{primaryId:t,primaryLabel:a,secondaryId:s,secondaryLabel:l}}function ne(t,a="overview",s=null){let l=F(t.labels),c=F(t.hierarchyLabels),d=F(t.freeTextLabels),f=F(t.rowLabels),P=t.gaAreas.filter(e=>e.visible),D=l.map(e=>m(e.ink,e.fill)??0),W=c.map(e=>m(e.ink,e.fill)??0),X=d.map(e=>m(e.ink,e.background)??0),Y=P.map(e=>m(e.effectiveBackground,t.canvasBackground)??0),u=s?t.labels.filter(e=>e.categoryKey===s):t.labels,v=s?t.gaAreas.filter(e=>e.categoryKey===s):t.gaAreas,h=u.filter(e=>e.selected),x=u.filter(e=>e.status==="held"),w=u.filter(e=>e.status==="booked"),R=u.filter(e=>e.pointerTarget.active),M=new Set([...t.labels.filter(e=>e.visible&&(e.opacity>.25||e.selected||e.status!=="free")).map(e=>e.categoryKey),...t.gaAreas.filter(e=>e.visible&&e.opacity>.1).map(e=>e.categoryKey)]),S=h.length?p(h.map(e=>m(e.selectionRingColor??t.selectionRingColor,e.fill)??0)):null,n=[],k=(e,i)=>Array.from({length:e},(b,L)=>({primaryId:`overview:${L+1}`,primaryLabel:i}));a==="overview"&&t.rung==="sections"&&(n.push(o("overview-section-category-paint","Section overview shells must use the neutral hierarchy palette, not category paint",k(t.overviewStyle.categoryPaintedSectionShells,"category-painted section shell"))),n.push(o("overview-category-detail-visible","Category-tinted section detail must wait until section focus or seat zoom",k(t.overviewStyle.visibleCategoryDetailOutlines,"category detail outline"))),n.push(o("overview-row-hints-visible","Row and seat patterns must not clutter the section overview",k(t.overviewStyle.visibleSectionRowHints,"section row hint"))),n.push(o("overview-availability-clutter","Live availability counts belong in focused detail, not on section overview shells",k(t.overviewStyle.visibleSectionAvailabilityLabels,"section availability label"))),n.push(o("overview-ga-detail-visible","Section-contained standing paint belongs in focused detail, not on section overview shells",k(t.overviewStyle.visibleSectionGADetails,"section-contained GA detail")))),n.push(o("bookable-label-undersized","Visible bookable labels must meet the rendered small-text size floor",l.filter(e=>e.renderedFontPx<t.minimumVisibleLabelPx).map(e=>B(e,e.renderedFontPx,t.minimumVisibleLabelPx)))),n.push(o("bookable-label-viewport-clipped","Visible interaction labels must remain fully inside the buyer viewport",a==="interaction"?l.filter(e=>e.screenBox.x<0||e.screenBox.y<0||e.screenBox.x+e.screenBox.width>t.viewport.width||e.screenBox.y+e.screenBox.height>t.viewport.height).map(e=>B(e)):[])),n.push(o("row-label-viewport-clipped","Visible interaction row labels must remain fully inside the buyer viewport",a==="interaction"?f.flatMap((e,i)=>{let b=e.screenBox;return b.x<0||b.y<0||b.x+b.width>t.viewport.width||b.y+b.height>t.viewport.height?[{primaryId:`row-label-${i}`,primaryLabel:e.text}]:[]}):[]));let z=[];if(a==="interaction")for(let e=0;e<f.length;e+=1)for(let i=0;i<e;i+=1)y(f[e].screenBox,f[i].screenBox)&&z.push(g(`row-label-${i}`,f[i].text,`row-label-${e}`,f[e].text));if(n.push(o("row-label-collision","Visible interaction row labels must not overlap",z)),a==="interaction"){let e=u.length>0,i=v.length>0,b=e||i,L=v.filter(r=>r.visible),q=new Set([...u.flatMap(r=>r.sectionId?[r.sectionId]:[]),...v.flatMap(r=>r.sectionId?[r.sectionId]:[])]),J=new Set([...t.labels.map(r=>r.categoryKey),...t.gaAreas.map(r=>r.categoryKey)]),C=r=>r.screenCenter.x>=0&&r.screenCenter.x<=t.viewport.width&&r.screenCenter.y>=0&&r.screenCenter.y<=t.viewport.height;n.push(o("detail-rung-missing","Interaction evidence with bookable inventory must render the seat-detail rung",b&&t.rung!=="seats"?[{primaryId:"renderer",primaryLabel:t.rung}]:[])),n.push(o("detail-inventory-not-visible","Interaction evidence must frame at least one real bookable unit",b&&!u.some(C)&&!L.length?[{primaryId:"renderer",primaryLabel:"no target inventory in viewport"}]:[])),n.push(o("pointer-target-inactive","Interaction evidence must expose a live production pointer target",e&&!R.some(C)||!e&&i&&!L.some(r=>r.interactive)?[{primaryId:"renderer",primaryLabel:"no active pointer target in viewport"}]:[])),n.push(o("pointer-target-undersized","Every active production pointer target must reach at least 24 CSS pixels",R.filter(r=>C(r)&&r.pointerTarget.effectiveMinimumPx<O).map(r=>B(r,r.pointerTarget.effectiveMinimumPx,O)))),n.push(o("selected-state-missing","Interaction evidence must paint a selected unit and its renderer-owned ring",e&&(!h.length||!h.some(r=>t.selectionRingSeatIds.includes(r.seatId)))?[{primaryId:"renderer",primaryLabel:"selected state"}]:[])),n.push(o("selected-state-contrast-low","The selected-state ring must maintain 3:1 graphical contrast with the seat paint",h.length&&(S??0)<T?[{primaryId:h[0].seatId,primaryLabel:h[0].label,measured:Math.round((S??0)*100)/100,minimum:T}]:[])),n.push(o("held-state-missing","Interaction evidence must paint a held state when the floor has at least two status-managed units",u.length>=2&&!x.length?[{primaryId:"renderer",primaryLabel:"held state"}]:[])),n.push(o("booked-state-missing","Interaction evidence must paint a taken state when the floor has at least three status-managed units",u.length>=3&&!w.length?[{primaryId:"renderer",primaryLabel:"booked state"}]:[]));let Z=new Set(x.map(r=>`${r.fill.toLowerCase()}:${r.opacity}`)),ee=new Set(w.map(r=>`${r.fill.toLowerCase()}:${r.opacity}`));n.push(o("status-state-indistinct","Held and taken evidence must resolve to distinct renderer paint",x.length&&w.length&&[...Z].some(r=>ee.has(r))?[{primaryId:x[0].seatId,primaryLabel:x[0].label,secondaryId:w[0].seatId,secondaryLabel:w[0].label}]:[])),n.push(o("section-focus-missing","Interaction evidence must exercise section focus and its backdrop when section membership exists",q.size&&(!t.focusedSectionId||!t.focusBackdropVisible)?[{primaryId:"renderer",primaryLabel:"section focus"}]:[])),n.push(o("category-filter-missing","Interaction evidence must exercise a category filter when multiple categories exist",J.size>=2&&(!t.categoryFilterKeys||!t.categoryFilterKeys.length)?[{primaryId:"renderer",primaryLabel:"category filter"}]:[]));let E=t.labels.filter(r=>r.status==="free"&&!r.selected&&t.categoryFilterKeys!=null&&!t.categoryFilterKeys.includes(r.categoryKey)),Q=t.gaAreas.filter(r=>t.categoryFilterKeys!=null&&!t.categoryFilterKeys.includes(r.categoryKey));n.push(o("category-filter-ineffective","The active category filter must visibly dim excluded free inventory",(E.length||Q.length)&&!E.some(r=>r.opacity<=.25)&&!Q.some(r=>r.opacity<=.1)?[...E.map(r=>B(r,r.opacity)),...Q.map(r=>({primaryId:r.areaId,primaryLabel:r.label,measured:r.opacity}))]:[])),n.push(o("target-category-not-visible","A category-specific interaction scene must visibly paint its exact target category",s&&!M.has(s)?[{primaryId:s,primaryLabel:s}]:[])),n.push(o("target-category-filter-mismatch","A category-specific interaction scene must bind its filter to only the exact target category",s&&(t.categoryFilterKeys?.length!==1||t.categoryFilterKeys[0]!==s)?[{primaryId:s,primaryLabel:s}]:[]))}n.push(o("bookable-label-contrast-low","Visible bookable labels must meet 4.5:1 contrast against their actual paint",l.flatMap(e=>{let i=m(e.ink,e.fill)??0;return i<I?[B(e,i,I)]:[]})));let K=[];for(let e=0;e<l.length;e+=1)for(let i=0;i<e;i+=1)y(l[e].screenBox,l[i].screenBox)&&K.push(g(l[i].seatId,l[i].label,l[e].seatId,l[e].label));n.push(o("bookable-label-collision","Visible bookable labels must not overlap",K)),n.push(o("hierarchy-label-undersized","Visible section and zone labels must meet the rendered small-text size floor",c.filter(e=>e.renderedFontPx<(e.sizeFloorPx??V)).map(e=>A(e,e.renderedFontPx,e.sizeFloorPx??V)))),n.push(o("hierarchy-label-contrast-low","Visible section and zone labels must meet 4.5:1 contrast against their backing paint",c.flatMap(e=>{let i=m(e.ink,e.fill)??0;return i<I?[A(e,i,I)]:[]}))),n.push(o("hierarchy-label-viewport-clipped","Visible overview hierarchy labels must remain fully inside the buyer viewport",a==="overview"?c.filter(e=>e.screenBox.x<0||e.screenBox.y<0||e.screenBox.x+e.screenBox.width>t.viewport.width||e.screenBox.y+e.screenBox.height>t.viewport.height).map(e=>A(e)):[])),n.push(o("hierarchy-label-outside-section","Visible section labels must remain inside the filled section surface and outside holes",c.filter(e=>e.kind==="section"&&e.fitsContainer===!1).map(e=>A(e))));let _=[];for(let e=0;e<c.length;e+=1)for(let i=0;i<e;i+=1)y(c[e].screenBox,c[i].screenBox)&&_.push(g(c[i].id,c[i].label,c[e].id,c[e].label));n.push(o("hierarchy-label-collision","Visible hierarchy labels must not overlap each other",_));let G=[];for(let e of c)for(let i of l)y(e.screenBox,i.screenBox)&&G.push(g(e.id,e.label,i.seatId,i.label));n.push(o("hierarchy-bookable-collision","Visible hierarchy labels must not overlap bookable labels",G)),n.push(o("free-text-undersized","Visible chart text must meet the rendered small-text size floor",d.filter(e=>e.renderedFontPx<t.minimumVisibleLabelPx).map(e=>$(e,e.renderedFontPx,t.minimumVisibleLabelPx)))),n.push(o("free-text-contrast-low","Visible chart text must meet 4.5:1 contrast against its measured background",d.flatMap(e=>{let i=m(e.ink,e.background)??0;return i<I?[$(e,i,I)]:[]})));let U=[];for(let e=0;e<d.length;e+=1)for(let i=0;i<e;i+=1)y(d[e].screenBox,d[i].screenBox)&&U.push(g(d[i].objectId,d[i].text,d[e].objectId,d[e].text));n.push(o("free-text-collision","Visible chart text labels must not overlap each other",U));let N=[];for(let e of d)for(let i of l)y(e.screenBox,i.screenBox)&&N.push(g(e.objectId,e.text,i.seatId,i.label));n.push(o("free-text-bookable-collision","Visible chart text must not overlap bookable labels",N));let j=[];for(let e of d)for(let i of c)y(e.screenBox,i.screenBox)&&j.push(g(e.objectId,e.text,i.id,i.label));n.push(o("free-text-hierarchy-collision","Visible chart text must not overlap hierarchy labels",j)),n.push(o("ga-contrast-low","Visible GA surfaces must maintain 3:1 graphical contrast with the canvas",P.flatMap(e=>{let i=m(e.effectiveBackground,t.canvasBackground)??0;return i<T?[{primaryId:e.areaId,primaryLabel:e.label,measured:Math.round(i*100)/100,minimum:T}]:[]})));let H=n.filter(e=>!!e);return{version:te,passed:H.length===0,state:a,targetCategoryKey:s,resolvedRules:["rendered-overview-label-size","rendered-overview-label-contrast","rendered-overview-label-collision","rendered-overview-hierarchy-viewport","rendered-overview-hierarchy-containment","rendered-overview-section-first-style","rendered-overview-ga-contrast",...a==="interaction"?["rendered-detail-label-viewport","rendered-detail-inventory","rendered-pointer-target","rendered-selected-held-taken-states","rendered-section-focus","rendered-category-filter"]:[]],viewport:t.viewport,canvasBackground:t.canvasBackground,effectiveScale:t.effectiveScale,rung:t.rung,inventory:{totalBookableUnits:t.totalBookableUnits,totalLabelledBookableUnits:t.totalLabelledBookableUnits,visibleBookableLabels:l.length,hiddenBookableLabels:t.hiddenLabels,visibleHierarchyLabels:c.length,visibleFreeTextLabels:d.length,visibleGAAreas:P.length},overviewStyle:t.overviewStyle,composition:{hierarchy:t.hierarchyLabels.filter(e=>e.role==="name").map(e=>({id:e.id,kind:e.kind,label:e.label,visible:e.visible})).sort((e,i)=>e.kind.localeCompare(i.kind)||e.id.localeCompare(i.id)),labelledObjects:t.freeTextLabels.map(e=>({objectId:e.objectId,kind:e.kind,text:e.text,visible:e.visible})).sort((e,i)=>e.objectId.localeCompare(i.objectId)||e.kind.localeCompare(i.kind)),gaAreas:t.gaAreas.map(e=>({areaId:e.areaId,label:e.label,categoryKey:e.categoryKey,...e.sectionId?{sectionId:e.sectionId}:{},visible:e.visible})).sort((e,i)=>e.areaId.localeCompare(i.areaId)),bookableSectionIds:[...new Set(t.labels.flatMap(e=>e.sectionId?[e.sectionId]:[]))].sort(),categoryKeys:[...new Set([...t.labels.map(e=>e.categoryKey),...t.gaAreas.map(e=>e.categoryKey)])].sort(),activeCategoryKeys:[...M].sort()},metrics:{minimumRenderedBookableLabelPx:p(l.map(e=>e.renderedFontPx)),minimumBookableLabelContrast:p(D),minimumRenderedHierarchyLabelPx:p(c.map(e=>e.renderedFontPx)),minimumHierarchyLabelContrast:p(W),minimumRenderedFreeTextPx:p(d.map(e=>e.renderedFontPx)),minimumFreeTextContrast:p(X),minimumGAContrast:p(Y),minimumEffectivePointerTargetPx:p(R.map(e=>e.pointerTarget.effectiveMinimumPx)),selectedRingContrast:S==null?null:Math.round(S*100)/100},interaction:{applicable:{detail:u.length>0||v.length>0,pointer:u.length>0||v.length>0,held:u.length>=2,booked:u.length>=3,sectionFocus:u.some(e=>!!e.sectionId)||v.some(e=>!!e.sectionId),categoryFilter:new Set([...t.labels.map(e=>e.categoryKey),...t.gaAreas.map(e=>e.categoryKey)]).size>=2},selectedUnits:h.length,heldUnits:x.length,bookedUnits:w.length,activePointerTargets:R.length,focusedSectionId:t.focusedSectionId,focusBackdropVisible:t.focusBackdropVisible,categoryFilterKeys:t.categoryFilterKeys},findings:H}}export{te as a,O as b,ne as c};
|