@seatlayer/core 0.89.2 → 0.90.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-A4GTB3SG.js → chunk-52CBK5HX.js} +1 -1
- package/dist/{chunk-R7TV7RYQ.js → chunk-77QFA3F4.js} +1 -1
- package/dist/{chunk-FVTW2IBN.js → chunk-EH47GKSO.js} +1 -1
- package/dist/{chunk-PMBS3VZM.js → chunk-FMPQZEXD.js} +1 -1
- package/dist/{chunk-66Q5LOBH.js → chunk-GISLORLL.js} +1 -1
- package/dist/{chunk-BCMCXHLH.js → chunk-K4TZQOTG.js} +1 -1
- package/dist/{chunk-WAGKI44J.js → chunk-OYKT5CCU.js} +1 -1
- package/dist/chunk-W4RS6OW7.js +1 -0
- package/dist/{chunk-PI3UH2EN.js → chunk-YAWJTFYK.js} +1 -1
- package/dist/core/chart-ops/index.cjs +1 -1
- package/dist/core/chart-ops/index.js +1 -1
- package/dist/core/inventory/index.cjs +1 -1
- package/dist/core/inventory/index.d.cts +2 -2
- package/dist/core/inventory/index.d.ts +2 -2
- package/dist/core/inventory/index.js +1 -1
- package/dist/core/layout/index.cjs +1 -1
- package/dist/core/layout/index.d.cts +2 -2
- package/dist/core/layout/index.d.ts +2 -2
- package/dist/core/layout/index.js +1 -1
- package/dist/core/quality/index.d.cts +2 -2
- package/dist/core/quality/index.d.ts +2 -2
- package/dist/core/sections/index.cjs +1 -1
- package/dist/core/sections/index.d.cts +1 -1
- package/dist/core/sections/index.d.ts +1 -1
- package/dist/core/sections/index.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +18 -8
- package/dist/index.d.ts +18 -8
- package/dist/index.js +1 -1
- package/dist/{renderedQuality-CrlBXHzi.d.ts → renderedQuality-CHm4mIjB.d.ts} +1 -1
- package/dist/{renderedQuality-CeSE6pEM.d.cts → renderedQuality-x1_lUJYV.d.cts} +1 -1
- package/dist/{renderer-B1mEhbA7.d.cts → renderer-DLTYfHV2.d.cts} +6 -2
- package/dist/{renderer-BwZhXv8G.d.ts → renderer-DN1yCX7-.d.ts} +6 -2
- package/dist/{tableSizing-wnW3HNga.d.cts → tableSizing-f-hh6kCg.d.cts} +2 -2
- package/dist/{tableSizing-DyS3UAha.d.ts → tableSizing-oDI0D8c2.d.ts} +2 -2
- package/dist/{ticketRestrictions-DuYWl2uy.d.ts → ticketRestrictions-BXtFOUqJ.d.ts} +1 -1
- package/dist/{ticketRestrictions-BTTN-LzH.d.cts → ticketRestrictions-Bc08-Hip.d.cts} +1 -1
- package/dist/view3d/index.cjs +12 -12
- package/dist/view3d/index.d.cts +1 -1
- package/dist/view3d/index.d.ts +1 -1
- package/dist/view3d/index.js +1 -1
- package/dist/view3d/scene/scene.worker.cjs +1 -1
- package/dist/view3d/scene/scene.worker.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-E7TOTX6I.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var Co=Object.create;var Dt=Object.defineProperty;var Po=Object.getOwnPropertyDescriptor;var Eo=Object.getOwnPropertyNames;var Ao=Object.getPrototypeOf,_o=Object.prototype.hasOwnProperty;var ko=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Eo(t))!_o.call(e,o)&&o!==n&&Dt(e,o,{get:()=>t[o],enumerable:!(r=Po(t,o))||r.enumerable});return e};var Ie=(e,t,n)=>(n=e!=null?Co(Ao(e)):{},ko(t||!e||!e.__esModule?Dt(n,"default",{value:e,enumerable:!0}):n,e));var vs=Math.PI/180;function mt(e){let t=0,n=0;for(let o of e)t+=o.x,n+=o.y;let r=e.length||1;return{x:t/r,y:n/r}}function _e(e){return e.length?mt(e):null}function Nt(e,t){let n=1-t,r=n*n*n,o=3*n*n*t,i=3*n*t*t,s=t*t*t;return{x:r*e.start.x+o*e.control1.x+i*e.control2.x+s*e.end.x,y:r*e.start.y+o*e.control1.y+i*e.control2.y+s*e.end.y}}function jt(e,t,n=192){if(!Number.isInteger(t)||t<1)throw new Error("Path point count must be a positive integer");if(t===1)return[Nt(e,.5)];let r=Array.from({length:n+1},(m,f)=>Nt(e,f/n)),o=new Float64Array(r.length);for(let m=1;m<r.length;m+=1){let f=r[m].x-r[m-1].x,u=r[m].y-r[m-1].y;o[m]=o[m-1]+Math.hypot(f,u)}let i=o[o.length-1];if(i<=1e-9)return Array.from({length:t},()=>({...e.start}));let s=[],a=1;for(let m=0;m<t;m+=1){let f=i*m/(t-1);for(;a<o.length-1&&o[a]<f;)a+=1;let u=o[a-1],d=o[a],c=d===u?0:(f-u)/(d-u);s.push({x:r[a-1].x+(r[a].x-r[a-1].x)*c,y:r[a-1].y+(r[a].y-r[a-1].y)*c})}return s}function Gt(e,t,n){return Math.max(t,Math.min(n,e))}function Ut(e){let t=new Map,n=new Map;for(let r of e){if(r.type!=="row"||!r.segmentedRow)continue;let o=n.get(r.segmentedRow.groupId)??[];o.push(r),n.set(r.segmentedRow.groupId,o)}for(let[r,o]of n){let i=o.slice().sort((c,l)=>c.segmentedRow.componentIndex-l.segmentedRow.componentIndex),s=i[0]?.segmentedRow?.componentCount??0,a=i[0]?.segmentedRow;if(!a||!(s>=2&&i.length===s&&a?.boundaryBefore==="start"&&i.every((c,l)=>c.segmentedRow?.kind==="segmented-row-v1"&&c.segmentedRow.groupId===r&&c.segmentedRow.componentCount===s&&c.segmentedRow.componentIndex===l&&c.segmentedRow.repeatLabelOnComponents===a.repeatLabelOnComponents&&(l===0?c.segmentedRow.boundaryBefore==="start":c.segmentedRow.boundaryBefore!=="start")&&c.segmentedRow.displayLabel===a.displayLabel)))continue;let f=i.reduce((c,l)=>c+l.seatCount,0),u=0,d=0;for(let c of i)c.segmentedRow.boundaryBefore==="break"&&(u+=1),t.set(c.id,{groupId:r,adjacencyOffset:u,displayOffset:d,displayLabel:a.displayLabel,totalSeats:f,canonical:i[0],viewFromSeatUrl:a.viewFromSeatUrl,viewFromSeatMeta:a.viewFromSeatMeta,confidenceEvidence:a.confidenceEvidence}),u+=c.seatCount,d+=c.seatCount}return t}var To="ABCDEFGHIJKLMNOPQRSTUVWXYZ";var Lo="abcdefghijklmnopqrstuvwxyz";function Oo(e,t){let n=t.length,r=e+1,o="";for(;r>0;){r-=1;let i=r%n;o=t[i]+o,r=Math.floor(r/n)}return o}function dt(e,t=!1){let n=t?Lo:To;return Oo(Math.max(0,Math.floor(e)-1),n)}var Bo=[[1e3,"M"],[900,"CM"],[500,"D"],[400,"CD"],[100,"C"],[90,"XC"],[50,"L"],[40,"XL"],[10,"X"],[9,"IX"],[5,"V"],[4,"IV"],[1,"I"]];function Yt(e){if(!Number.isFinite(e)||e<=0)return String(e);let t=Math.floor(e),n="";for(let[r,o]of Bo)for(;t>=r;)n+=o,t-=r;return n}function Fo(e){let t=new Array(e);return Array.from({length:e},(n,r)=>r).sort((n,r)=>Math.abs(2*n-(e-1))-Math.abs(2*r-(e-1))||n-r).forEach((n,r)=>t[n]=r),t}function He(e,t){let n=e.seatLabelStart??1,r=e.seatNumbering?.direction??"ltr",o=e.seatNumbering?.step??1,i=e.seatNumbering?.scheme??"decimal",s=e.seatNumbering?.prefix??"",a=e.seatNumbering?.endAt,m=e.seatCount;if(i==="updown"||i==="updown-descending"){let l=Math.ceil(m/2),b=i==="updown"?t<l?n+2*t:n-1+2*(m-t):t<l?n+2*(l-1-t):n+1+2*(t-l);return`${s}${b}`}let f=i==="odd"||i==="even"?2:o,u=a!=null&&Number.isFinite(a)?a-(m-1)*f:n,d=r==="center"?Fo(m)[t]:r==="rtl"?m-1-t:t,c;switch(i){case"odd":{let l=u%2===1?u:u+1;c=String(l+d*2);break}case"even":{let l=u%2===0?u:u+1;c=String(l+d*2);break}case"roman":c=Yt(u+d*o);break;case"letters-upper":c=dt(u+d*o,!1);break;case"letters-lower":c=dt(u+d*o,!0);break;default:c=String(u+d*o);break}return`${s}${c}`}function Do(e){return{...e.canonical,seatCount:e.totalSeats,label:e.displayLabel,displayLabel:e.displayLabel}}function Xt(e,t,n){return n?.label??`${e.seatLabelBase??e.label}-${He(e,t)}`}function bt(e,t,n,r){if(r?.displayLabel)return r.displayLabel;if(e.seatDisplayLabelMode==="number")return He(e,t);if(!n)return`${e.displayLabel||e.label}-${He(e,t)}`;let o=Do(n),i=n.displayOffset+t;return`${n.displayLabel}-${He(o,i)}`}var te=.02291666666666667,me=1/te,No=58,jo=No*te;var Go=3,Vt=0,pt=120,Uo=0,Yo=45,Xo=7,ce=1.2;function ht(e,t,n,r){return Number.isFinite(e)?Math.max(t,Math.min(n,e)):r}function Vo(e){return!Number.isFinite(e)||!Number.isInteger(e)||e<0?0:e<=Xo?e:Go}function Ke(e,t={}){let n=ht(t.floorBaseHeightM,Vt,pt,0),r=Math.min(pt,n+Vo(e.elevation)*jo),o=e.height===void 0?r:ht(e.height,Vt,pt,r),i=ht(e.rake,Uo,Yo,0);return{height:o,rake:i}}function Ht(e){let t=e.length;return t<=3?[...e]:[e[Math.floor(t*.25)],e[Math.floor(t*.5)],e[Math.floor(t*.75)]]}function ve(e,t,n){if(!e.length)return 1/0;if(e.length===1)return Math.hypot(t-e[0].x,n-e[0].y);let r=1/0;for(let o=0;o+1<e.length;o++){let i=e[o],s=e[o+1],a=s.x-i.x,m=s.y-i.y,f=a*a+m*m,u=f>1e-12?((t-i.x)*a+(n-i.y)*m)/f:0;u<0?u=0:u>1&&(u=1);let d=Math.hypot(t-(i.x+u*a),n-(i.y+u*m));d<r&&(r=d)}return r}function Ho(e){let t=0,n=0;for(let i of e)t+=i.x,n+=i.y;let r=e.length||1;t/=r,n/=r;let o=0;for(let i of e){let s=Math.hypot(i.x-t,i.y-n);s>o&&(o=s)}return{cx:t,cy:n,r:o}}function Kt(e,t){return Math.hypot(e.cx-t.cx,e.cy-t.cy)-e.r-t.r}function yt(e,t){let n=1/0;for(let r of Ht(e)){let o=ve(t,r.x,r.y);o<n&&(n=o)}for(let r of Ht(t)){let o=ve(e,r.x,r.y);o<n&&(n=o)}return n}function Ko(e,t){if(e.length<3)return{pts:e,seatIndices:t};let n=0,r=0;for(let u of e)n+=u.x,r+=u.y;n/=e.length,r/=e.length;let o=-1,i=e[0];for(let u of e){let d=Math.hypot(u.x-n,u.y-r);d>o&&(o=d,i=u)}let s=i.x-n,a=i.y-r,m=Math.hypot(s,a);m>1e-9?(s/=m,a/=m):(s=1,a=0);let f=e.map((u,d)=>({p:u,i:d,t:(u.x-n)*s+(u.y-r)*a})).sort((u,d)=>u.t-d.t);return{pts:f.map(u=>u.p),seatIndices:f.map(u=>t[u.i])}}function gt(e){let t=e.length;if(t<3)return null;let n=0,r=0;for(let g of e)n+=g.x,r+=g.y;n/=t,r/=t;let o=0,i=0,s=0,a=0,m=0,f=0,u=0;for(let g of e){let M=g.x-n,x=g.y-r;o+=M*M,s+=x*x,i+=M*x,a+=M*M*M,m+=x*x*x,f+=M*x*x,u+=x*M*M}let d=o*s-i*i;if(Math.abs(d)<1e-9)return null;let c=(a+f)/2,l=(m+u)/2,b=(c*s-l*i)/d,h=(l*o-c*i)/d,p=b+n,y=h+r;return!Number.isFinite(p)||!Number.isFinite(y)?null:{cx:p,cy:y}}var zo=.15;function Wo(e){if(e.length<2)return null;let t=e.map(g=>{let M=0,x=0;for(let A of g.pts)M+=A.x,x+=A.y;return{x:M/g.pts.length,y:x/g.pts.length}}),n=0,r=0;for(let g of t)n+=g.x,r+=g.y;n/=t.length,r/=t.length;let o=0,i=0,s=0;for(let g of t){let M=g.x-n,x=g.y-r;o+=M*M,i+=M*x,s+=x*x}let a=o+s,m=o*s-i*i,f=a/2+Math.sqrt(Math.max(0,a*a/4-m)),u,d;Math.abs(i)>1e-12?(u=f-s,d=i):o>=s?(u=1,d=0):(u=0,d=1);let c=Math.hypot(u,d);if(!(c>1e-12))return null;u/=c,d/=c;let l=1/0,b=-1/0,h=[];for(let g of e){let M=1/0,x=-1/0;for(let A of g.pts){let S=A.x*u+A.y*d;S<M&&(M=S),S>x&&(x=S),S<l&&(l=S),S>b&&(b=S)}h.push(x-M)}let p=b-l;return p>1e-9?(h.sort((g,M)=>g-M),h[Math.min(h.length-1,Math.floor(h.length*.9))]/p<=Zo?{x:u,y:d}:null):null}var Zo=.35;function ze(e,t,n,r){let o=new Map;for(let p of n){let y=t[p],g=y.rowId||`__seat-${p}`,M=o.get(g);M||(M={pts:[],idx:[]},o.set(g,M)),M.pts.push({x:y.x,y:y.y}),M.idx.push(p)}if(!o.size)return{sectionId:e,rows:[],blockCount:0};let i=[];for(let[p,y]of o){let g=Ko(y.pts,y.idx),M=0;for(let x of g.pts)M+=Math.hypot(x.x-r.x,x.y-r.y);i.push({id:p,pts:g.pts,seatIndices:g.seatIndices,blockId:-1,ordinal:0,blockDepth:0,focalDistance:M/g.pts.length})}let s=i.map(p=>Ho(p.pts)),a=[];for(let p=0;p<i.length;p++){let y=1/0;for(let g=0;g<i.length;g++){if(p===g||Kt(s[p],s[g])>=y)continue;let M=yt(i[p].pts,i[g].pts);M<y&&(y=M)}Number.isFinite(y)&&a.push(y)}a.sort((p,y)=>p-y);let m=a.length?a[Math.floor(a.length/2)]:1,f=Math.max(m*1.8,1e-6),u=i.map(()=>[]);for(let p=0;p<i.length;p++)for(let y=p+1;y<i.length;y++)Kt(s[p],s[y])>f||yt(i[p].pts,i[y].pts)<=f&&(u[p].push(y),u[y].push(p));let d=0;for(let p=0;p<i.length;p++){if(i[p].blockId!==-1)continue;let y=d++,g=[p];for(i[p].blockId=y;g.length;){let M=g.pop();for(let x of u[M])i[x].blockId===-1&&(i[x].blockId=y,g.push(x))}}let c=new Map;for(let p of i){let y=c.get(p.blockId)??[];y.push(p),c.set(p.blockId,y)}let l=[];for(let p of i){if(p.pts.length<4)continue;let y=gt(p.pts);y&&(!Number.isFinite(y.cx)||!Number.isFinite(y.cy)||l.push({x:y.cx,y:y.cy}))}let b=l.length>=2?(()=>{let p=l.map(M=>M.x).sort((M,x)=>M-x),y=l.map(M=>M.y).sort((M,x)=>M-x),g=Math.floor(l.length/2);return{cx:p[g],cy:y[g]}})():null;if(b){let p=S=>Math.hypot(S.x-b.cx,S.y-b.cy),y=1/0,g=-1/0,M=[];for(let S of i){let v=1/0,_=-1/0;for(let D of S.pts){let N=p(D);N<v&&(v=N),N>_&&(_=N)}M.push(_-v),v<y&&(y=v),_>g&&(g=_)}let x=g-y;M.sort((S,v)=>S-v);let A=M[Math.min(M.length-1,Math.floor(M.length*.9))];if(x>1e-9&&A/x<=zo){let S=i.map(I=>{let T=0;for(let P of I.pts)T+=p(P);return{row:I,radius:T/I.pts.length}}),v=0,_=0;for(let I of S)v+=I.radius,_+=I.row.focalDistance;v/=S.length,_/=S.length;let D=0;for(let I of S)D+=(I.radius-v)*(I.row.focalDistance-_);if(D<0)for(let I of S)I.radius=-I.radius;let G=1/0;for(let I of S)I.radius<G&&(G=I.radius);S.sort((I,T)=>I.radius-T.radius);let C=-1,w=-1/0,k=x/Math.max(1,S.length)*.5,B=[];for(let I of S)I.radius-w>k&&(C++,w=I.radius),I.row.ordinal=C,I.row.blockDepth=I.radius-G,B.push(I.row);return{sectionId:e,rows:B,blockCount:d}}}let h=[];for(let[,p]of c){let y=Wo(p);if(y){let g=x=>{let A=0;for(let S of x.pts)A+=S.x*y.x+S.y*y.y;return A/x.pts.length};p.sort((x,A)=>g(x)-g(A)),p.length>=2&&p[0].focalDistance>p[p.length-1].focalDistance&&p.reverse();let M=0;for(let x=0;x<p.length;x++)x>0&&(M+=yt(p[x-1].pts,p[x].pts)),p[x].ordinal=x,p[x].blockDepth=M,h.push(p[x])}else{let g=1/0;for(let M of p)M.focalDistance<g&&(g=M.focalDistance);p.sort((M,x)=>M.focalDistance-x.focalDistance);for(let M=0;M<p.length;M++)p[M].ordinal=M,p[M].blockDepth=Math.max(0,p[M].focalDistance-g),h.push(p[M])}}return{sectionId:e,rows:h,blockCount:d}}var $o=/^\d{4}-\d{2}-\d{2}$/;function Qo(e){let t=Date.parse(e);return Number.isFinite(t)?$o.test(e)?t+864e5:t:null}function qo(e,t=Date.now()){if(e.validUntil===void 0){if(e.status!=="approved")return!0;let r=e.assessedAt?Date.parse(e.assessedAt):Number.NaN;return Number.isFinite(r)&&(t instanceof Date?t.getTime():t)<=r+366*864e5}let n=Qo(e.validUntil);return n===null?!1:(t instanceof Date?t.getTime():t)<n}function Jo(e,t,n){return!(e.eventConfigurationId&&e.eventConfigurationId!==t||e.eventConfigurationVersion!==void 0&&e.eventConfigurationVersion!==n)}function er(e){return e.status!=="draft"&&e.status!=="retracted"}function tr(e,t){return e.status===void 0?t===void 0:e.status!=="approved"?!0:typeof t=="string"&&typeof e.basisSha256=="string"&&e.basisSha256===t}function zt(e,t={}){return!!e&&er(e)&&Jo(e,t.activeConfigurationId,t.activeConfigurationVersion)&&tr(e,t.activeBasisSha256)&&qo(e,t.now)}var Bs=Math.PI*2;function We(e){return e==="pitch-football"||e==="rink-hockey"||e==="track-athletics"||e==="oval-cricket"}var nr=/^data:image\/(?:png|jpe?g|webp|gif|avif);base64,[a-z0-9+/]+={0,2}$/i,or=/[\s"'<>`\\]/;function rr(e){if(typeof e!="string"||!e||e.length>2e6||e!==e.trim())return!1;if(e.startsWith("data:"))return nr.test(e);if(or.test(e))return!1;try{let t=new URL(e);return t.protocol==="https:"&&!t.username&&!t.password}catch{return!1}}function Wt(e){let t=e.trim();return rr(t)?t:null}var xt="seatlayer.event-configuration/1";var Re=100,ir=120,sr=1e5,ar=1e4,cr=/^[a-f0-9]{64}$/,ur=new Set(["stage","screen","barrier","camera_platform","sound_desk","rigging_truss"]);function ke(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function be(e,t){return typeof e=="string"&&e.length>=1&&e.length<=t&&e.normalize("NFKC").trim()===e}function lr(e){return typeof e=="number"&&Number.isInteger(e)&&e>0}function Zt(e){return!Array.isArray(e)||e.length>sr||!e.every(t=>be(t,Re))?null:[...new Set(e)].sort()}function fr(e){return!ke(e)||!be(e.chartId,Re)||!be(e.version,Re)||e.sha256!==void 0&&(typeof e.sha256!="string"||!cr.test(e.sha256))?null:{chartId:e.chartId,version:e.version,...typeof e.sha256=="string"?{sha256:e.sha256}:{}}}function Mt(e,t,n){return typeof e=="number"&&Number.isFinite(e)&&e>=t&&e<=n}function mr(e){return ke(e)?e.mode==="none"||e.mode==="opaque"?e.opacity===void 0?{mode:e.mode}:null:e.mode==="partial"&&Mt(e.opacity,.01,.99)?{mode:"partial",opacity:e.opacity}:null:null}function dr(e,t){if(e===void 0)return;if(!Array.isArray(e)||e.length>ar)return null;let n=new Set(t),r=new Set,o=new Set,i=0,s=[];for(let a of e){if(!ke(a)||!be(a.id,Re)||!be(a.objectId,Re)||!n.has(a.objectId)||!ur.has(String(a.kind))||!Mt(a.heightM,.05,50)||a.baseElevationM!==void 0&&!Mt(a.baseElevationM,-10,100))return null;let m=mr(a.occlusion);if(!m||r.has(a.id)||o.has(a.objectId))return null;let f=a.contentImageUrl===void 0?void 0:typeof a.contentImageUrl=="string"?Wt(a.contentImageUrl):null;if(a.contentImageUrl!==void 0&&(!f||a.kind!=="screen"||++i>1))return null;r.add(a.id),o.add(a.objectId),s.push({id:a.id,objectId:a.objectId,kind:a.kind,heightM:a.heightM,...a.baseElevationM!==void 0?{baseElevationM:a.baseElevationM}:{},occlusion:m,...f?{contentImageUrl:f}:{}})}return s.sort((a,m)=>a.id.localeCompare(m.id))}function br(e){let t=[];if(!ke(e))return{issues:[{code:"invalid_export",path:"configuration",message:"Configuration must be an object"}]};e.schema!==xt&&t.push({code:"unsupported_schema",path:"configuration.schema",message:`Configuration schema must be ${xt}`}),be(e.id,Re)||t.push({code:"invalid_id",path:"configuration.id",message:"Configuration id must contain 1 to 100 normalized characters"}),be(e.label,ir)||t.push({code:"invalid_label",path:"configuration.label",message:"Configuration label must contain 1 to 120 normalized characters"}),lr(e.version)||t.push({code:"invalid_version",path:"configuration.version",message:"Configuration version must be a positive integer"});let n=fr(e.baseVenue);n||t.push({code:"invalid_base_venue",path:"configuration.baseVenue",message:"Base venue must identify one normalized chart id and exact version"});let r=ke(e.overlay)?e.overlay:null,o=Zt(r?.objectIds),i=Zt(r?.productionKillSeatIds),s=o?dr(r?.productionElements,o):null;return(!r||!o||!i)&&t.push({code:"invalid_overlay",path:"configuration.overlay",message:"Overlay ids must be bounded arrays of normalized stable ids"}),s===null&&t.push({code:"invalid_production_element",path:"configuration.overlay.productionElements",message:"Production elements must be unique, bounded semantics over referenced base-venue objects"}),t.length||!n||!o||!i||s===null?{issues:t}:{issues:t,value:{schema:xt,id:e.id,label:e.label,version:e.version,baseVenue:n,overlay:{objectIds:o,productionKillSeatIds:i,...s!==void 0?{productionElements:s}:{}}}}}function $t(e){let t=br(e);return t.value?{ok:!0,value:t.value}:{ok:!1,issues:t.issues}}function pr(e){if((e.kind==="polygon"||e.kind==="polyline"||e.kind==="line")&&e.points&&e.points.length>=2)return e.points;if(e.x==null||e.y==null||e.width==null||e.height==null)return null;let t=e.x,n=e.y,r=e.width,o=e.height;return[{x:t,y:n},{x:t+r,y:n},{x:t+r,y:n+o},{x:t,y:n+o}]}function hr(e,t,n){let r=n*Math.PI/180,o=Math.cos(r),i=Math.sin(r),s=e.x-t.x,a=e.y-t.y;return{x:t.x+s*o-a*i,y:t.y+s*i+a*o}}function Qt(e){let t=pr(e);if(!t||t.length<2)return null;let n=e.rotation??0,r=Math.abs(n)<1e-6?t:t.map(m=>hr(m,{x:t.reduce((f,u)=>f+u.x,0)/t.length,y:t.reduce((f,u)=>f+u.y,0)/t.length},n)),o=1/0,i=1/0,s=-1/0,a=-1/0;for(let m of r)o=Math.min(o,m.x),i=Math.min(i,m.y),s=Math.max(s,m.x),a=Math.max(a,m.y);return!Number.isFinite(o)||s-o<1e-6||a-i<1e-6?null:{minX:o,minY:i,maxX:s,maxY:a}}var yr=5,gr=3,xr=.92,Mr=1.9,Sr=2,wr=.6,Ir=1,vr=.06;function Rr(e){return e.heightM!==void 0?e.heightM:We(e.stageKind)?vr:Ir}function qt(e){let t=1/0,n=1/0,r=-1/0,o=-1/0,i=-1/0;for(let s of tn(e)){let a=s.baseHeightM??0;for(let m of s.objects){if(m.type!=="shape"||m.role!=="stage")continue;let f=Qt(m);f&&(t=Math.min(t,f.minX),n=Math.min(n,f.minY),r=Math.max(r,f.maxX),o=Math.max(o,f.maxY),i=Math.max(i,a+Rr(m)))}}return!Number.isFinite(t)||!Number.isFinite(i)?null:{minX:t,minY:n,maxX:r,maxY:o,deckTopM:i}}function Cr(e,t,n,r){let o=1/0,i=1/0,s=-1/0,a=-1/0;for(let l of e)Number.isFinite(l.eyeHeightM)&&(o=Math.min(o,l.x),s=Math.max(s,l.x),i=Math.min(i,l.y),a=Math.max(a,l.y));if(!Number.isFinite(o))return null;let m=o*t,f=i*t,u=Math.max(1,Math.ceil((s-o)*t/n)+1),d=Math.max(1,Math.ceil((a-i)*t/n)+1),c=new Float64Array(u*d).fill(-1/0);for(let l of e){if(!Number.isFinite(l.eyeHeightM))continue;let b=l.eyeHeightM-ce,h=Math.min(u-1,Math.max(0,Math.floor((l.x*t-m)/n))),y=Math.min(d-1,Math.max(0,Math.floor((l.y*t-f)/n)))*u+h,g=b+r;g>c[y]&&(c[y]=g)}return{cellM:n,minX:m,minY:f,cols:u,rows:d,top:c}}function Pr(e,t,n){let r=Math.floor((t-e.minX)/e.cellM),o=Math.floor((n-e.minY)/e.cellM);return r<0||o<0||r>=e.cols||o>=e.rows?-1/0:e.top[o*e.cols+r]}function Jt(e,t,n={}){let r=new Map;if(!t||!e.length)return r;let o=n.metresPerChartUnit??te,i=n.cellM??wr,s=n.chairBackM??xr,a=n.selfRowSkipM??Sr,m=n.clearThreshold??.9,f=n.partialThreshold??.25,u=Math.max(1,n.columns??yr),d=Math.max(1,n.rows??gr),c=Cr(e,o,i,s);if(!c)return r;let l=(t.maxX-t.minX)*o,b=(t.maxY-t.minY)*o,h=l>=b,p=(t.minX+t.maxX)/2*o,y=(t.minY+t.maxY)/2*o,g=[];for(let x=0;x<u;x++){let A=(x+.5)/u-.5,S=h?p+A*l:p,v=h?y:y+A*b;for(let _=0;_<d;_++){let D=t.deckTopM+(d===1?0:_/(d-1)*Mr);g.push({x:S,y:v,z:D})}}let M=i/2;for(let x of e){if(!Number.isFinite(x.eyeHeightM))continue;let A=x.x*o,S=x.y*o,v=x.eyeHeightM,_=0,D=1/0;for(let G of g){let C=G.x-A,w=G.y-S,k=Math.hypot(C,w);if(!(k>a)){_++;continue}let B=C/k,I=w/k,T=0;for(let P=a;P<k;P+=M){let E=Pr(c,A+B*P,S+I*P);if(!(!Number.isFinite(E)||E>=v)&&E>v+(G.z-v)*P/k){T=P;break}}T?D=Math.min(D,T):_++}let N=_/g.length;N>=m||r.set(x.id,{seatId:x.id,mark:N<f?"obstructedView":"restrictedView",visibleFraction:N,totalRays:g.length,atDistanceM:Number.isFinite(D)?D:0})}return r}function en(e,t){if(!t.size)return 0;let n=0;for(let r of e){let o=t.get(r.id);if(!o)continue;let i=r.commercial;i?.restrictedView!==void 0||i?.obstructedView!==void 0||(r.commercial={...i,[o.mark]:!0},n++)}return n}function St(e){return e?e.accessibility?.length?e.wheelchairSpaceType&&!e.accessibility.includes("wheelchair")?["wheelchair",...e.accessibility]:e.accessibility:e.wheelchairSpaceType?["wheelchair"]:e.accessible?["wheelchair"]:[]:[]}var Ze=Math.PI/180;var Te=16;function It(e,t,n,r){let o=n*Ze,i=Math.cos(o),s=Math.sin(o);return{x:r.x+e*i-t*s,y:r.y+e*s+t*i}}function Er(e){let{seatCount:t,seatSpacing:n,curve:r,rotation:o,origin:i}=e,s=[];if(e.path)return jt(e.path,t);if(t<=1)return t===1&&s.push({x:i.x,y:i.y}),s;if(r===0){for(let f=0;f<t;f++)s.push(It(f*n,0,o,i));return s}let a=r/(t-1)*Ze,m=n/(2*Math.sin(Math.abs(a)/2));for(let f=0;f<t;f++){let u=f*a,d=m*Math.sin(u),c=-m+m*Math.cos(u);s.push(It(d,c,o,i))}return s}function Ar(e){let t=new Map;if(e.overrides)for(let n of e.overrides)t.set(n.index,n);return t}function _r(e,t){let n=Ar(e);return Er(e).map((r,o)=>{let i=n.get(o),s=St(i),a=Xt(e,o,i),m={...e.commercial,...i?.commercial};return{index:o,x:r.x+(i?.dx??0),y:r.y+(i?.dy??0),label:a,displayLabel:bt(e,o,t,i),categoryKey:i?.categoryKey??e.categoryKey,skipped:!!i?.skip,accessible:s.length>0,accessibility:s,wheelchairSpaceType:i?.wheelchairSpaceType,commercial:Object.values(m).some(f=>f!==void 0&&f!==!1&&f!=="")?m:void 0,glyph:i?.glyph,viewUrl:i?.viewFromSeatUrl??e.viewFromSeatUrl,viewMeta:i?.viewFromSeatUrl?i.viewFromSeatMeta:e.viewFromSeatMeta,labelStyle:i?.labelStyle??e.seatLabelStyle}})}function an(e){let t=[];for(let n of _r(e))n.skipped||t.push({id:`${e.id}:${n.index}`,label:n.label,displayLabel:n.displayLabel===n.label?void 0:n.displayLabel,x:n.x,y:n.y,rowId:e.id,categoryKey:n.categoryKey,accessible:n.accessible||void 0,accessibility:n.accessibility.length?n.accessibility:void 0,wheelchairSpaceType:n.wheelchairSpaceType,commercial:n.commercial,glyph:n.glyph,viewUrl:n.viewUrl,viewMeta:n.viewMeta,labelStyle:n.labelStyle});return t}function kr(e){if(e.seatCountsBySide)return{...e.seatCountsBySide};let t=e.sides&&e.sides.length?e.sides:["top","bottom"],n=["top","bottom","left","right"].filter(i=>t.includes(i)),r={top:0,bottom:0,left:0,right:0};if(!n.length)return r;let o=Math.max(0,Math.round(e.seatCount));for(let i=0;i<o;i++)r[n[i%n.length]]+=1;return r}function Tr(e){let t=[],n=Math.max(0,Math.round(e.seatCount));if(n===0)return t;let r=new Map((e.overrides??[]).map(u=>[u.index,u])),o=(u,d,c,l)=>{let b=r.get(u),h=St(b),p=b?.label??`${e.label}-${u+1}`,y=e.displayLabel??e.label;return{index:u,label:p,displayLabel:b?.displayLabel??`${y}-${u+1}`,x:d+(b?.dx??0),y:c+(b?.dy??0),categoryKey:b?.categoryKey??e.categoryKey,skipped:!!b?.skip,accessible:h.length>0,accessibility:h,wheelchairSpaceType:b?.wheelchairSpaceType,commercial:b?.commercial,glyph:b?.glyph,viewUrl:b?.viewFromSeatUrl,viewMeta:b?.viewFromSeatUrl?b.viewFromSeatMeta:void 0,labelStyle:b?.labelStyle,...l?{side:l}:{}}};if(e.shape==="round"){let u=(e.radius??40)+Te,d=e.rotation*Ze,c=Math.max(0,Math.min(360,e.seatArc??360));if(c>=360||n===1){for(let p=0;p<n;p++){let y=d+p/n*2*Math.PI;t.push(o(p,e.center.x+u*Math.cos(y),e.center.y+u*Math.sin(y)))}return t}let l=c*Ze,b=(2*Math.PI-l)/2,h=d+b;for(let p=0;p<n;p++){let y=h+p/(n-1)*l;t.push(o(p,e.center.x+u*Math.cos(y),e.center.y+u*Math.sin(y)))}return t}let i=e.width??80,s=e.height??50,a=kr(e),m=["top","bottom","left","right"],f=0;for(let u of m){let d=a[u];for(let c=0;c<d;c++){let l,b;u==="top"?(l=-i/2+(c+.5)*i/d,b=-s/2-Te):u==="bottom"?(l=-i/2+(c+.5)*i/d,b=s/2+Te):u==="left"?(l=-i/2-Te,b=-s/2+(c+.5)*s/d):(l=i/2+Te,b=-s/2+(c+.5)*s/d);let h=It(l,b,e.rotation,e.center);t.push(o(f++,h.x,h.y,u))}}return t}function Lr(e){return Tr(e).filter(t=>!t.skipped).map(t=>({id:`${e.id}:${t.index}`,label:t.label,...t.displayLabel!==t.label?{displayLabel:t.displayLabel}:{},x:t.x,y:t.y,rowId:e.id,categoryKey:t.categoryKey,...t.accessible?{accessible:!0}:{},...t.accessibility.length?{accessibility:t.accessibility}:{},...t.wheelchairSpaceType?{wheelchairSpaceType:t.wheelchairSpaceType}:{},...t.commercial?{commercial:t.commercial}:{},...t.glyph?{glyph:t.glyph}:{},...t.viewUrl?{viewUrl:t.viewUrl}:{},...t.viewUrl&&t.viewMeta?{viewMeta:t.viewMeta}:{},...t.labelStyle?{labelStyle:t.labelStyle}:{}}))}function Or(e){return[{id:`${e.id}:0`,label:e.label,...e.displayLabel&&e.displayLabel!==e.label?{displayLabel:e.displayLabel}:{},x:e.center.x,y:e.center.y,rowId:e.id,categoryKey:e.categoryKey,kind:"booth"}]}function nn(e,t){let n=!1;for(let r=0,o=t.length-1;r<t.length;o=r++){let i=t[r].x,s=t[r].y,a=t[o].x,m=t[o].y;s>e.y!=m>e.y&&e.x<(a-i)*(e.y-s)/(m-s)+i&&(n=!n)}return n}function Br(e,t){return t.some((n,r)=>{let o=t[(r+1)%t.length],i=(e.y-n.y)*(o.x-n.x)-(e.x-n.x)*(o.y-n.y);if(Math.abs(i)>1e-7)return!1;let s=(e.x-n.x)*(o.x-n.x)+(e.y-n.y)*(o.y-n.y),a=(o.x-n.x)**2+(o.y-n.y)**2;return s>=-1e-7&&s<=a+1e-7})}function pe(e,t,n){return nn(e,t)&&!(n??[]).some(r=>nn(e,r)||Br(e,r))}function wt(e){if(!e.length)return{x:0,y:0};let t=0,n=0;for(let r of e)t+=r.x,n+=r.y;return{x:t/e.length,y:n/e.length}}function Fr(e){switch(e.type){case"row":{let t=an(e);if(!t.length)return{x:e.origin.x,y:e.origin.y};let n=0,r=0;for(let o of t)n+=o.x,r+=o.y;return{x:n/t.length,y:r/t.length}}case"table":case"booth":return{x:e.center.x,y:e.center.y};case"gaArea":return wt(e.points);case"section":return wt(e.outline);case"text":return{x:e.position.x,y:e.position.y};case"shape":return e.points&&e.points.length?wt(e.points):e.x!=null&&e.y!=null&&e.width!=null&&e.height!=null?{x:e.x+e.width/2,y:e.y+e.height/2}:{x:e.x??0,y:e.y??0};case"decorImage":return{x:e.x+e.width/2,y:e.y+e.height/2}}}function on(e,t){return e.length===t.length&&e.every((n,r)=>n.x===t[r].x&&n.y===t[r].y)}function Dr(e,t){if(e.type!=="gaArea"||!on(e.points,t.outline))return!1;let n=e.holes??[],r=t.holes??[];return n.length===r.length&&n.every((o,i)=>on(o,r[i]))}function Nr(e,t){let n=e.filter(s=>s.type==="section"),r="referenceInventorySource"in t?t.referenceInventorySource?.logicalSectionId:void 0,o=Fr(t);return(r?n.find(s=>(s.logicalSectionId??s.id)===r&&(Dr(t,s)||pe(o,s.outline,s.holes))):void 0)??n.find(s=>pe(o,s.outline,s.holes))}function tn(e){return e.floors&&e.floors.length?e.floors:[{id:"floor-0",name:"Main",objects:e.objects,focalPoint:e.focalPoint,referenceImage:e.referenceImage,backgroundImage:e.backgroundImage}]}function rn(e,t,n,r,o,i,s,a,m){let f=[],u=Ut(e),d=b=>!b?.eventConfigurationId||b.eventConfigurationId===r&&(b.eventConfigurationVersion===void 0||b.eventConfigurationVersion===m),c=b=>zt(b,{activeConfigurationId:r,activeConfigurationVersion:m,activeBasisSha256:o,now:a}),l=(b,h)=>c(b)?{...b,coverage:h}:void 0;for(let b of e){let h=[];if(b.type==="row"?h=an(b):b.type==="table"?h=Lr(b):b.type==="booth"&&(h=Or(b)),!h.length)continue;for(let x of h)x.viewUrl&&!d(x.viewMeta)&&(x.viewUrl=void 0,x.viewMeta=void 0);if(b.type==="row"){let x=u.get(b.id);if(x){let A=new Map((b.overrides??[]).map(S=>[S.index,S]));for(let S of h){let v=Number(S.id.slice(S.id.lastIndexOf(":")+1));if(!Number.isInteger(v))continue;S.logicalRowId=x.groupId,S.logicalSeatIndex=x.adjacencyOffset+v,A.get(v)?.displayLabel||(S.displayLabel=bt(b,v,x)),!S.viewUrl&&x.viewFromSeatUrl&&d(x.viewFromSeatMeta)&&(S.viewUrl=x.viewFromSeatUrl,S.viewMeta=x.viewFromSeatMeta);let _=A.get(v)?.confidenceEvidence;S.confidenceEvidence=l(_,"exact-seat")??l(b.confidenceEvidence,"row-representative")??l(x.confidenceEvidence,"row-representative")}}}let p=Nr(e,b),y=p?.viewFromSeatUrl,M=(p?.zone?t?.find(x=>x.id===p.zone):void 0)?.focalPoint??n;for(let x of h){if(!x.confidenceEvidence){let A=Number(x.id.slice(x.id.lastIndexOf(":")+1)),S=(b.type==="row"||b.type==="table")&&Number.isInteger(A)?b.overrides?.find(v=>v.index===A)?.confidenceEvidence:void 0;x.confidenceEvidence=l(S,"exact-seat")??(b.type==="row"?l(b.confidenceEvidence,"row-representative"):void 0)}x.confidenceEvidence??=l(p?.confidenceEvidence,"section-representative")??(s?l(s.evidence,s.coverage):void 0),!x.viewUrl&&y&&d(p?.viewFromSeatMeta)&&(x.viewUrl=y,x.viewMeta=p?.viewFromSeatMeta),!x.viewUrl&&i&&d(i.meta)&&(x.viewUrl=i.url,x.viewMeta=i.meta),p&&(x.sectionId=p.logicalSectionId??p.id),p?.zone&&(x.zoneId=p.zone),M&&(x.focalPoint={...M})}f.push(...h)}return f}function cn(e,t={}){if(e.floors?.length){let r=[];for(let o of e.floors){let i=o.focalPoint??e.focalPoint,s=o.viewFromSeatUrl?{url:o.viewFromSeatUrl,meta:o.viewFromSeatMeta}:e.viewFromSeatUrl?{url:e.viewFromSeatUrl,meta:e.viewFromSeatMeta}:void 0,a=o.confidenceEvidence?{evidence:o.confidenceEvidence,coverage:"floor-representative"}:e.confidenceEvidence?{evidence:e.confidenceEvidence,coverage:"venue-representative"}:void 0,m=rn(o.objects,e.zones,i,e.eventConfigurationId,e.confidenceBasisSha256,s,a,t.now,t.eventConfigurationVersion??e.eventConfigurationVersion);t.resolveEyeHeights!==!1&&sn(o.objects,o.focalPoint??e.focalPoint,o.baseHeightM??0,m);for(let f of m)f.floorId=o.id;r.push(...m)}return r}let n=rn(e.objects,e.zones,e.focalPoint,e.eventConfigurationId,e.confidenceBasisSha256,e.viewFromSeatUrl?{url:e.viewFromSeatUrl,meta:e.viewFromSeatMeta}:void 0,e.confidenceEvidence?{evidence:e.confidenceEvidence,coverage:"venue-representative"}:void 0,t.now,t.eventConfigurationVersion??e.eventConfigurationVersion);return t.resolveEyeHeights!==!1&&sn(e.objects,e.focalPoint,t.floorBaseHeightM??0,n),jr(e,n,t)}function jr(e,t,n){return!n.deriveRestrictedView||e.derivedRestrictedView===!1||n.resolveEyeHeights===!1||en(t,Jt(t,qt(e))),t}function sn(e,t,n,r){let o=e.filter(u=>u.type==="section"),i=n>0||o.some(u=>u.height!==void 0||u.rake!==void 0||(u.elevation??0)>0);if(!o.length||!i||!t){for(let u of r)u.eyeHeightM=n+ce;return}let s=new Array(r.length),a=new Map,m=new Map;for(let u=0;u<r.length;u++){let d=r[u],l=(d.sectionId?o.find(h=>h.id===d.sectionId)??o.find(h=>h.logicalSectionId===d.sectionId&&pe({x:d.x,y:d.y},h.outline,h.holes)):void 0)??o.find(h=>pe({x:d.x,y:d.y},h.outline,h.holes))??null;if(s[u]=l,!l)continue;a.has(l.id)||a.set(l.id,Ke(l,{floorBaseHeightM:n}));let b=m.get(l.id);b?b.push(u):m.set(l.id,[u])}let f=new Array(r.length).fill(void 0);for(let[u,d]of m){let c=a.get(u);if(!c)continue;let l=c.rake>0?Math.tan(c.rake*Math.PI/180):0,b=ze(u,r,d,t);for(let h of b.rows){let p=h.blockDepth*te*l,y=c.height+p;for(let g of h.seatIndices)f[g]=y}}for(let u=0;u<r.length;u++){let d=r[u],c=s[u];if(!c){d.eyeHeightM=n+ce;continue}let l=a.get(c.id);d.eyeHeightM=(f[u]??l.height)+ce}}var Gr=/^#?([\da-f]{3}|[\da-f]{6})$/i;function Ur(e){let t=Gr.exec((e??"").trim());if(!t)return null;let n=t[1].length===3?t[1].split("").map(o=>o+o).join(""):t[1],r=parseInt(n,16);return[r>>16&255,r>>8&255,r&255]}function W(e){let t=Ur(e);return t?[t[0]/255,t[1]/255,t[2]/255]:null}function Yr(e){return .2126*e[0]+.7152*e[1]+.0722*e[2]}function ne(e,t,n){return[e[0]+(t[0]-e[0])*n,e[1]+(t[1]-e[1])*n,e[2]+(t[2]-e[2])*n]}function Le(e,t){let n=Yr(e);return ne(e,[n,n,n],t)}var $e=["available","held","sold","selected","dimmed"];function un(e){let t=$e.indexOf(e);return t<0?0:t}var ln={available:[.24,.82,.52],held:[.95,.66,.22],sold:[.34,.39,.45],selected:[.24,.74,1],dimmed:[.28,.32,.37]};var vt={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]},Rt={top:[.05,.06,.08],bottom:[.1,.12,.15]};function ie(e,t){return[Math.min(1,e[0]*t),Math.min(1,e[1]*t),Math.min(1,e[2]*t)]}var Xr=.15,Vr=1.6;function fn(e){return Gt(e??1,Xr,Vr)}var Hr=.15,Kr=.9,zr=1.76;function Wr(){return{background:{top:[...Rt.top],bottom:[...Rt.bottom]},structure:vt,seatStates:{...ln},seatScale:1,materials:{seat:null,shell:null,roughness:.78}}}function mn(e){let t=Wr();if(!e)return t;let n=W(e.background);if(n){t.background={top:ie(n,Kr),bottom:ie(n,zr)};let s={};for(let[a,m]of Object.entries(vt))s[a]=ne(m,n,Hr);t.structure=s}let r=W(e.selectionColor)??W(e.accent);r&&(t.seatStates={...t.seatStates,selected:r});let o=e.seatScale;typeof o=="number"&&Number.isFinite(o)&&(t.seatScale=fn(o));let i=e.venue3d;if(i){let s=W(i.deck),a=W(i.fascia);s&&(t.structure={...t.structure,tierTop:s,gaTop:s}),a&&(t.structure={...t.structure,tierWall:a,gaWall:a}),t.materials.seat=W(i.seat),t.materials.shell=W(i.shell),typeof i.roughness=="number"&&Number.isFinite(i.roughness)&&(t.materials.roughness=Math.min(1,Math.max(0,i.roughness)))}return t}function dn(e,t){let n=[];for(let r of t)n.push(...e.seatStates[r]);return n}var pn=Ie(require("earcut"),1),hn=Ie(require("polygon-clipping"),1);function he(e){let t=0;for(let n=0,r=e.length;n<r;n+=1){let o=e[n],i=e[(n+1)%r];t+=o.x*i.y-i.x*o.y}return t/2}function Oe(e,t,n){let r=!1;for(let o=0,i=e.length-1;o<e.length;i=o++){let s=e[o],a=e[i];s.y>n!=a.y>n&&t<(a.x-s.x)*(n-s.y)/(a.y-s.y)+s.x&&(r=!r)}return r}var R=te,Zr=.002;function $r(e,t,n){let r=Math.hypot(t[0]-e[0],t[1]-e[1],t[2]-e[2]),o=Math.hypot(n[0]-t[0],n[1]-t[1],n[2]-t[2]),i=Math.hypot(e[0]-n[0],e[1]-n[1],e[2]-n[2]),s=Math.max(r,o,i);if(s<1e-9)return!0;let a=(r+o+i)/2;return 2*Math.sqrt(Math.max(0,a*(a-r)*(a-o)*(a-i)))/s<Zr}var ye=class{constructor(t=16384){this.len=0;this.buf=new Float32Array(t)}push3(t,n,r){this.len+3>this.buf.length&&this.grow(this.len+3),this.buf[this.len++]=t,this.buf[this.len++]=n,this.buf[this.len++]=r}push1(t){this.len+1>this.buf.length&&this.grow(this.len+1),this.buf[this.len++]=t}grow(t){let n=this.buf.length*2;for(;n<t;)n*=2;let r=new Float32Array(n);r.set(this.buf.subarray(0,this.len)),this.buf=r}get length(){return this.len}toArray(){return this.buf.slice(0,this.len)}},Je=class{constructor(){this.pos=new ye;this.nor=new ye;this.col=new ye;this.flr=new ye;this.mat=new ye;this.currentFloor=0;this.currentMaterial=0}setFloor(t){this.currentFloor=t}setMaterial(t){this.currentMaterial=t}tri(t,n,r,o,i,s=i,a=i){$r(t,n,r)||(this.pos.push3(t[0],t[1],t[2]),this.pos.push3(n[0],n[1],n[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(i[0],i[1],i[2]),this.col.push3(s[0],s[1],s[2]),this.col.push3(a[0],a[1],a[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(t,n,r,o,i,s,a,m=a,f=a){[...t,...n,...r].every(Number.isFinite)&&(this.pos.push3(t[0],t[1],t[2]),this.pos.push3(n[0],n[1],n[2]),this.pos.push3(r[0],r[1],r[2]),this.nor.push3(o[0],o[1],o[2]),this.nor.push3(i[0],i[1],i[2]),this.nor.push3(s[0],s[1],s[2]),this.col.push3(a[0],a[1],a[2]),this.col.push3(m[0],m[1],m[2]),this.col.push3(f[0],f[1],f[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 Qr(e,t,n){let r=t[0]-e[0],o=t[1]-e[1],i=t[2]-e[2],s=n[0]-e[0],a=n[1]-e[1],m=n[2]-e[2],f=o*m-i*a,u=i*s-r*m,d=r*a-o*s,c=Math.hypot(f,u,d)||1;return f/=c,u/=c,d/=c,[f,u,d]}function qr(e,t){let n=[...e],r=[];for(let s of e)r.push(s.x,s.y);let o=[];if(t){for(let s of t)if(!(s.length<3)){o.push(n.length);for(let a of s)n.push(a),r.push(a.x,a.y)}}let i=(0,pn.default)(r,o.length?o:void 0,2);return{pts:n,tris:i}}function Ct(e){return he(e)<0?[...e].reverse():e}var Jr=3;function ei(e,t,n,r){let o=r(e),i=r(t),s=r(n),a=(l,b,h,p)=>Math.abs(r({x:(l.x+b.x)/2,y:(l.y+b.y)/2})-(h+p)/2),m=(e.x+t.x+n.x)/3,f=(e.y+t.y+n.y)/3,u=(o+i+s)/3,d=Math.max(a(e,t,o,i),a(t,n,i,s),a(n,e,s,o),Math.abs(r({x:m,y:f})-u)),c=(l,b,h)=>{let p=Math.abs(r({x:(l+m)/2,y:(b+f)/2})-(h+u)/2);p>d&&(d=p)};return c((e.x+t.x)/2,(e.y+t.y)/2,(o+i)/2),c((t.x+n.x)/2,(t.y+n.y)/2,(i+s)/2),c((n.x+e.x)/2,(n.y+e.y)/2,(s+o)/2),d}function Be(e,t,n,r,o){if(o<=0)return ei(e,t,n,r);let i={x:(e.x+t.x)/2,y:(e.y+t.y)/2},s={x:(t.x+n.x)/2,y:(t.y+n.y)/2},a={x:(n.x+e.x)/2,y:(n.y+e.y)/2};return Math.max(Be(e,i,a,r,o-1),Be(i,t,s,r,o-1),Be(a,s,n,r,o-1),Be(i,s,a,r,o-1))}function Fe(e,t,n,r,o,i,s,a){if(s>0){let c={x:(t.x+n.x)/2,y:(t.y+n.y)/2},l={x:(n.x+r.x)/2,y:(n.y+r.y)/2},b={x:(r.x+t.x)/2,y:(r.y+t.y)/2};Fe(e,t,c,b,o,i,s-1,a),Fe(e,c,n,l,o,i,s-1,a),Fe(e,b,l,r,o,i,s-1,a),Fe(e,c,l,b,o,i,s-1,a);return}let m=[t.x*R,o(t),t.y*R],f=[n.x*R,o(n),n.y*R],u=[r.x*R,o(r),r.y*R];if(a){e.triN(m,f,u,a(t),a(n),a(r),i);return}let d=Qr(m,f,u);d[1]<0&&(d=[-d[0],-d[1],-d[2]]),e.tri(m,f,u,d,i)}var ti=8;function bn(e,t,n){if(!Number.isFinite(n))return e;let r=[],o=(i,s,a,m,f)=>{if(f>0){let u={x:(i.x+s.x)/2,y:(i.y+s.y)/2},d=t(u);if(Math.abs(d-(a+m)/2)>n){o(i,u,a,d,f-1),o(u,s,d,m,f-1);return}}r.push(i)};for(let i=0;i<e.length;i++){let s=e[i],a=e[(i+1)%e.length];o(s,a,t(s),t(a),ti)}return r}function Qe(e,t){if(e.length<3)return e;let n=[];for(let o of e){let i=n[n.length-1];i&&Math.hypot(o.x-i.x,o.y-i.y)<t||n.push(o)}for(;n.length>2&&Math.hypot(n[0].x-n[n.length-1].x,n[0].y-n[n.length-1].y)<t;)n.pop();if(n.length<3)return e;let r=[];for(let o=0;o<n.length;o++){let i=r.length?r[r.length-1]:n[(o-1+n.length)%n.length],s=n[o],a=n[(o+1)%n.length],m=a.x-i.x,f=a.y-i.y,u=Math.hypot(m,f);u>t&&Math.abs((s.x-i.x)*f-(s.y-i.y)*m)/u<t||r.push(s)}return r.length>=3?r:n}var qe=.001*me*.1;function J(e,t,n,r,o,i,s,a,m=1/0,f){if(!t||t.length<3||(m===void 0&&(m=1/0),Math.abs(he(t))<1e-4))return;let u=Qe(bn(Qe(Ct(t),qe),r,m),qe),d=n?.map(S=>Qe(bn(Qe(Ct(S),qe),r,m),qe)).filter(S=>S.length>=3&&Math.abs(he(S))>=1e-4),{pts:c,tris:l}=qr(u,d),b=[i[0]*a.top,i[1]*a.top,i[2]*a.top],h=[i[0]*a.bottomCap,i[1]*a.bottomCap,i[2]*a.bottomCap],p=[s[0]*a.top,s[1]*a.top,s[2]*a.top],y=[s[0]*a.wallBottom,s[1]*a.wallBottom,s[2]*a.wallBottom],g=0;if(Number.isFinite(m))for(;g<Jr;g++){let S=0;for(let v=0;v<l.length;v+=3){let _=Be(c[l[v]],c[l[v+1]],c[l[v+2]],r,g);_>S&&(S=_)}if(S<=m)break}for(let S=0;S<l.length;S+=3){let v=c[l[S]],_=c[l[S+1]],D=c[l[S+2]];Fe(e,v,_,D,r,b,g,f);let N=[v.x*R,o,v.y*R],G=[_.x*R,o,_.y*R],C=[D.x*R,o,D.y*R];e.tri(N,C,G,[0,-1,0],h)}let M=S=>{if(g<=0)return S;let v=1<<g,_=[];for(let D=0;D<S.length;D++){let N=S[D],G=S[(D+1)%S.length];for(let C=0;C<v;C++){let w=C/v;_.push({x:N.x+(G.x-N.x)*w,y:N.y+(G.y-N.y)*w})}}return _},x=mt(u),A=[{ring:M(u),flip:!1}];if(d)for(let S of d)S.length>=3&&A.push({ring:M(S),flip:!0});for(let{ring:S,flip:v}of A)for(let _=0;_<S.length;_++){let D=S[_],N=S[(_+1)%S.length],G=(N.x-D.x)*R,w=(N.y-D.y)*R,k=-G,B=Math.hypot(w,k)||1;w/=B,k/=B;let I=(D.x+N.x)/2-x.x,T=(D.y+N.y)/2-x.y,P=w*I+k*T;v&&(P=-P),P<0&&(w=-w,k=-k);let E=[w,0,k],L=[D.x*R,r(D),D.y*R],F=[N.x*R,r(N),N.y*R],j=[D.x*R,o,D.y*R],Y=[N.x*R,o,N.y*R];e.tri(L,F,Y,E,p,p,y),e.tri(L,Y,j,E,p,y,y)}}function yn(e){let t=0;for(let m of e)t+=m.count;let n=new Float32Array(t*3),r=new Float32Array(t*3),o=new Float32Array(t*3),i=new Float32Array(t),s=new Float32Array(t),a=0;for(let m of e)n.set(m.position,a*3),r.set(m.normal,a*3),o.set(m.color,a*3),i.set(m.floor,a),s.set(m.material,a),a+=m.count;return{position:n,normal:r,color:o,floor:i,material:s,count:t}}function et(e,t,n=2.5){if(t<=0||e.length<3)return e;let r=Ct(e),o=r.length,i=[];for(let a=0;a<o;a++){let m=r[a],f=r[(a+1)%o],u=f.x-m.x,d=f.y-m.y,c=Math.hypot(u,d)||1;i.push({x:d/c,y:-u/c})}let s=[];for(let a=0;a<o;a++){let m=r[a],f=i[(a-1+o)%o],u=i[a],d=f.x+u.x,c=f.y+u.y,l=Math.hypot(d,c),b=()=>{s.push([m.x+f.x*t,m.y+f.y*t]),s.push([m.x+u.x*t,m.y+u.y*t])};if(l<1e-9){b();continue}d/=l,c/=l;let h=d*f.x+c*f.y,p=1/Math.max(h,1e-6);if(!Number.isFinite(p)||p>n){b();continue}s.push([m.x+d*t*p,m.y+c*t*p])}if(s.length<3)return e;try{let a=hn.default.union([[...s,s[0]]]),m=null,f=-1/0;for(let d of a){let c=Math.abs(he(d[0].map(([l,b])=>({x:l,y:b}))));c>f&&(f=c,m=d[0])}if(!m)return e;let u=m.map(([d,c])=>({x:d,y:c}));if(u.length>1){let d=u[0],c=u[u.length-1];Math.abs(d.x-c.x)<1e-9&&Math.abs(d.y-c.y)<1e-9&&u.pop()}return u.length>=3?u:e}catch{return e}}function tt(e,t,n,r,o=28){let i=[];for(let s=0;s<o;s++){let a=s/o*Math.PI*2;i.push({x:e+n*Math.cos(a),y:t+r*Math.sin(a)})}return i}function De(e,t,n,r){return[{x:e,y:t},{x:e+n,y:t},{x:e+n,y:t+r},{x:e,y:t+r}]}var ni=[{key:"wheelchair",label:"Wheelchair space",short:"Wheelchair",icon:"\u267F"},{key:"companion",label:"Companion seat",short:"Companion",icon:"\u{1F9D1}\u200D\u{1F91D}\u200D\u{1F9D1}"},{key:"semi-ambulatory",label:"Semi-ambulatory (limited mobility)",short:"Limited mobility",icon:"\u{1F9AF}"},{key:"designated-aisle",label:"Designated aisle / transfer seat",short:"Aisle transfer",icon:"AS"},{key:"step-free",label:"Step-free accessible seat",short:"Step-free",icon:"SF"},{key:"hearing",label:"Assistive listening",short:"Hearing",icon:"\u{1F9BB}"},{key:"cart",label:"CART live-caption view",short:"CART captions",icon:"CC"},{key:"sign-language",label:"Sign-language view",short:"Sign language",icon:"\u{1F91F}"},{key:"low-vision",label:"Blind / low-vision viewing",short:"Low vision",icon:"LV"},{key:"sensory-friendly",label:"Quiet / sensory-friendly seating",short:"Sensory-friendly",icon:"QS"},{key:"plus-size",label:"Plus-size seat",short:"Plus-size",icon:"\u{1F4BA}"},{key:"lift-armrest",label:"Lift-up armrest",short:"Lift armrest",icon:"\u2195\uFE0F"}],ya=new Map(ni.map(e=>[e.key,e]));var oi={wheelchair:"#3b82f6",companion:"#8b5cf6","semi-ambulatory":"#0ea5e9","designated-aisle":"#0284c7","step-free":"#16a34a",hearing:"#14b8a6",cart:"#7c3aed","sign-language":"#f59e0b","low-vision":"#d97706","sensory-friendly":"#6366f1","plus-size":"#ec4899","lift-armrest":"#22c55e"};function gn(e){let t=e?.[0];return t&&oi[t]||"#3b82f6"}var ri=[{key:"obstructedView",label:"Obstructed view",short:"Obstructed",icon:"\u26D4"},{key:"restrictedView",label:"Restricted view",short:"Restricted",icon:"\u{1F441}"},{key:"premium",label:"Premium seat",short:"Premium",icon:"\u2605"}],ga=new Map(ri.map(e=>[e.key,e]));var ii=["reference-focal","bar","entrance","exit","restroom","screen","sound","concession","coat","wall","rail","suite","obstruction"],xa=new Set(ii);var Mn=[{key:"circle",label:"Standard seat",shortLabel:"Standard",useCase:"General assigned seating",group:"general",path:null,bounds:null},{key:"theatre",label:"Theatre chair",shortLabel:"Theatre",useCase:"Auditoriums, arenas and stadium stands",group:"fixed",path:"M4.5 3.5 Q4.5 1.5 6.5 1.5 L17.5 1.5 Q19.5 1.5 19.5 3.5 L19.5 13 L4.5 13 Z M3.5 12 L20.5 12 Q22.5 12 22.5 14 L22.5 21 Q22.5 22.5 21 22.5 Q19.5 22.5 19.5 21 L19.5 17.5 L4.5 17.5 L4.5 21 Q4.5 22.5 3 22.5 Q1.5 22.5 1.5 21 L1.5 14 Q1.5 12 3.5 12 Z",bounds:{x:1.5,y:1.5,width:21,height:21}},{key:"dining",label:"Dining chair",shortLabel:"Dining",useCase:"Banquets, restaurants and table seating",group:"flexible",path:"M7 1 Q6 1 6 2.5 L6.75 10.5 L5 10.5 Q4 10.5 4 12 L4 14 Q4 15 5.25 15 L6 15 L4 23 L7 23 L9.5 15 L14.5 15 L17 23 L20 23 L18 15 L18.75 15 Q20 15 20 14 L20 12 Q20 10.5 19 10.5 L17.25 10.5 L18 2.5 Q18 1 17 1 Z",bounds:{x:4,y:1,width:16,height:22}},{key:"folding",label:"Folding chair",shortLabel:"Folding",useCase:"Concert floors, ceremonies and conferences",group:"flexible",path:"M6 2 Q5 2 5 3 L6 8 L18 8 L19 3 Q19 2 18 2 Z M5 9 L19 9 Q20 9 20 10.5 L19 13 L5 13 L4 10.5 Q4 9 5 9 Z M6 12 L9 12 L12 17 L15 12 L18 12 L14 19 L17 23 L14 23 L12 21 L10 23 L7 23 L10 19 Z",bounds:{x:4,y:2,width:16,height:21}},{key:"armchair",label:"Premium armchair",shortLabel:"Armchair",useCase:"Boxes, lounges and club seating",group:"premium",path:"M3.5 4 Q3.5 1.5 6 1.5 L18 1.5 Q20.5 1.5 20.5 4 L20.5 13 L3.5 13 Z M1.5 12.5 Q1.5 10 3.25 10 Q5 10 5 12.5 L5 13.5 L19 13.5 L19 12.5 Q19 10 20.75 10 Q22.5 10 22.5 12.5 L22.5 19.5 Q22.5 22 20 22 L4 22 Q1.5 22 1.5 19.5 Z",bounds:{x:1.5,y:1.5,width:21,height:20.5}},{key:"recliner",label:"Recliner",shortLabel:"Recliner",useCase:"Luxury cinemas and premium clubs",group:"premium",path:"M7 2 Q7 1 8.5 1 L15.5 1 Q17 1 17 2 L19 13 L5 13 Z M4 9 Q2 9 2 11.5 L2 16 Q2 18 4 18 L6 18 L6 15 L18 15 L18 18 L20 18 Q22 18 22 16 L22 11.5 Q22 9 20 9 Q18 9 18 11 L18 13 L6 13 L6 11 Q6 9 4 9 Z M7 17 L17 17 Q18 17 18.5 18.5 L19.5 22.5 L4.5 22.5 L5.5 18.5 Q6 17 7 17 Z",bounds:{x:2,y:1,width:20,height:21.5}},{key:"stool",label:"Stool",shortLabel:"Stool",useCase:"Bars, high-tops and seating rails",group:"flexible",path:"M6 2.5 L18 2.5 Q22 2.5 22 6.5 L22 12 Q22 16 18 16 L6 16 Q2 16 2 12 L2 6.5 Q2 2.5 6 2.5 Z M6 15.5 L9.5 15.5 L7.5 22.5 L3 22.5 Z M14.5 15.5 L18 15.5 L20.5 22.5 L16 22.5 Z",bounds:{x:2,y:2.5,width:20,height:20}},{key:"bench",label:"Bench place",shortLabel:"Bench",useCase:"Pews, bleachers and terraces",group:"fixed",path:"M2.5 0.5 L21.5 0.5 Q23 0.5 23 2 L23 5 Q23 6.5 21.5 6.5 L2.5 6.5 Q1 6.5 1 5 L1 2 Q1 0.5 2.5 0.5 Z M2 7.5 L22 7.5 Q23.5 7.5 23.5 9 L23.5 15.5 Q23.5 17 22 17 L18 17 L18 21.5 Q18 22.5 16.75 22.5 Q15.5 22.5 15.5 21.5 L15.5 17 L8.5 17 L8.5 21.5 Q8.5 22.5 7.25 22.5 Q6 22.5 6 21.5 L6 17 L2 17 Q0.5 17 0.5 15.5 L0.5 9 Q0.5 7.5 2 7.5 Z",bounds:{x:.5,y:.5,width:23,height:22}}],Sn=Mn.map(e=>e.key),si=new Map(Mn.map(e=>[e.key,e]));function xn(e){return typeof e=="string"&&si.has(e)}function wn(e,t){return xn(e)?e:xn(t?.seatGlyph)?t.seatGlyph:"circle"}var ee={pedestal:0,pad:1,back:2,arm:3,footrest:4,leg:5,body:10,head:11},ai=.44,ci=.15,ui=.3,li=.24;function In(e){return e===void 0||!Number.isFinite(e)||e<=0?li:Math.min(ui,Math.max(ci,e*ai))}var fi=.05,vn=.45,mi=vn+fi,di=.92;var va=[{part:ee.pedestal,min:[-.3,0,-.3],max:[.3,.36,.3]},{part:ee.pad,min:[-1,.36,-.95],max:[1,vn,1]},{part:ee.back,min:[-1,mi,-1],max:[1,di,-.72]},{part:ee.arm,min:[-1,.44,-.82],max:[-.78,.65,.78]},{part:ee.arm,min:[.78,.44,-.82],max:[1,.65,.78]},{part:ee.footrest,min:[-.9,.18,.78],max:[.9,.31,1.34]},{part:ee.leg,min:[-.82,0,-.7],max:[-.62,.37,-.48]},{part:ee.leg,min:[.62,0,-.7],max:[.82,.37,-.48]},{part:ee.leg,min:[-.82,0,.48],max:[-.62,.37,.7]},{part:ee.leg,min:[.62,0,.48],max:[.82,.37,.7]}],Ra=[{part:ee.body,min:[-.52,.39,-.08],max:[-.08,.55,.82]},{part:ee.body,min:[.08,.39,-.08],max:[.52,.55,.82]},{part:ee.body,min:[-.47,.05,.58],max:[-.13,.43,.82]},{part:ee.body,min:[.13,.05,.58],max:[.47,.43,.82]},{part:ee.head,min:[-.16,1.04,-.33],max:[.16,1.1,-.13]}];function Rn(e,t,n,r){let o=new Float32Array(t),i=f=>e[f*3],s=f=>e[f*3+2],a=0,m=(f,u)=>{let d=u-f;for(let c=f;c<u;c++){let[l,b]=r(c),h=l-i(c),p=b-s(c);if(d>=2){let y=Math.max(f,c-1),g=Math.min(u-1,c+1),M=i(g)-i(y),x=s(g)-s(y),A=Math.hypot(M,x);if(A>1e-6){let S=-x/A,v=M/A;S*h+v*p<0&&(S=-S,v=-v),h=S,p=v}}o[c]=h===0&&p===0?0:Math.atan2(h,p)}};for(let f=1;f<=t;f++)(f===t||n(f)!==n(a))&&(m(a,f),a=f);return o}var nt=.22;var bi=.42;function pi(e){let t=e.length,n=new Float64Array(t);if(t<2)return n.fill(1/0),n;let r=1/0,o=1/0,i=-1/0,s=-1/0;for(let b of e)b.x<r&&(r=b.x),b.y<o&&(o=b.y),b.x>i&&(i=b.x),b.y>s&&(s=b.y);let a=Math.max(i-r,1e-6),m=Math.max(s-o,1e-6),f=Math.max(Math.sqrt(a*m/t),1e-6),u=Math.max(1,Math.ceil(a/f)+1),d=Math.max(1,Math.ceil(m/f)+1),c=new Map,l=(b,h)=>{let p=Math.min(u-1,Math.max(0,Math.floor((b-r)/f)));return Math.min(d-1,Math.max(0,Math.floor((h-o)/f)))*u+p};for(let b=0;b<t;b++){let h=l(e[b].x,e[b].y),p=c.get(h);p?p.push(b):c.set(h,[b])}for(let b=0;b<t;b++){let h=e[b],p=Math.min(u-1,Math.max(0,Math.floor((h.x-r)/f))),y=Math.min(d-1,Math.max(0,Math.floor((h.y-o)/f))),g=1/0;for(let M=1;M<=4;M++){for(let x=y-M;x<=y+M;x++)if(!(x<0||x>=d))for(let A=p-M;A<=p+M;A++){if(A<0||A>=u||M>1&&Math.abs(x-y)<M&&Math.abs(A-p)<M)continue;let S=c.get(x*u+A);if(S)for(let v of S){if(v===b)continue;let _=Math.hypot(e[v].x-h.x,e[v].y-h.y);_<g&&(g=_)}}if(Number.isFinite(g)&&g<=M*f)break}n[b]=g}return n}function hi(e){let t=e.eyeHeightM;return Number.isFinite(t)?Math.max(0,t-ce):0}function Cn(e,t,n,r,o,i){let s=e.length,a=new Float32Array(s*3),m=new Float32Array(s),f=new Float32Array(s*3),u=new Float32Array(s),d=new Float32Array(s),c=new Float32Array(s),l=new Float32Array(s),b=new Float32Array(s*3),h=new Map,p=pi(e);for(let y=0;y<s;y++){let g=e[y],x=(n?.seatPitchU(y)??p[y])*R;u[y]=Number.isFinite(x)?Math.max(.06,Math.min(nt,x*bi)):nt,d[y]=In(Number.isFinite(x)?x:void 0);let A=wn(g.glyph,{seatGlyph:i?.get(g.categoryKey)});c[y]=Sn.indexOf(A),l[y]=g.wheelchairSpaceType==="no-seat"?0:1,a[y*3]=g.x*R,a[y*3+1]=n?n.seatDeckY(y):hi(g),a[y*3+2]=g.y*R,m[y]=un(t?t(g):"available");let S=W(o?.get(g.categoryKey)??"#6e7bff")??[.43,.48,1];if(f[y*3]=S[0],f[y*3+1]=S[1],f[y*3+2]=S[2],g.accessibility?.length){let v=W(gn(g.accessibility));v&&(b[y*3]=v[0],b[y*3+1]=v[1],b[y*3+2]=v[2])}h.set(g.id,y)}return{count:s,iPosition:a,iState:m,iCategory:f,iMaxRadius:u,iRing:b,idToIndex:h,iChairWidth:d,iGlyph:c,iPhysicalSeat:l,iFloor:r??new Float32Array(s),iYaw:new Float32Array(s)}}function yi(e){return{kind:"radial",rowCount:0,rows:[],nearestRow:()=>-1,depthAt:(t,n)=>Math.hypot(t-e.x,n-e.y),gradientAt:(t,n)=>{let r=t-e.x,o=n-e.y,i=Math.hypot(r,o);return i<1e-9?[0,0]:[r/i,o/i]}}}function gi(e,t){if(!e.length)return null;let n=0,r=0,o=0;for(let l of e)n+=l.x,r+=l.y,o+=Math.hypot(l.x-t.x,l.y-t.y);let i=e.length;n/=i,r/=i,o/=i;let s=e[0],a=-1;for(let l of e){let b=Math.hypot(l.x-n,l.y-r);b>a&&(a=b,s=l)}let m=s.x-n,f=s.y-r,u=Math.hypot(m,f);u>1e-9?(m/=u,f/=u):(m=1,f=0);let d=[...e].sort((l,b)=>(l.x-n)*m+(l.y-r)*f-((b.x-n)*m+(b.y-r)*f)),c=0;for(let l of d){let b=Math.hypot(l.x-n,l.y-r);b>c&&(c=b)}return{pts:d,cx:n,cy:r,radius:c,depth:o}}function Pn(e,t,n){let r=e.pts;if(r.length===1)return Math.hypot(t-r[0].x,n-r[0].y);let o=1/0;for(let i=0;i+1<r.length;i++){let s=r[i],a=r[i+1],m=a.x-s.x,f=a.y-s.y,u=m*m+f*f,d=u>1e-12?((t-s.x)*m+(n-s.y)*f)/u:0;d<0?d=0:d>1&&(d=1);let c=Math.hypot(t-(s.x+d*m),n-(s.y+d*f));c<o&&(o=c)}return o}var ot=8;function xi(e,t,n){let r=new Array(ot).fill(1/0),o=new Array(ot).fill(-1);for(let u=0;u<e.length;u++){let d=e[u],c=Math.hypot(t-d.cx,n-d.cy)-d.radius;for(let l=0;l<ot;l++)if(c<r[l]){for(let b=ot-1;b>l;b--)r[b]=r[b-1],o[b]=o[b-1];r[l]=c,o[l]=u;break}}let i=new Array(3).fill(1/0),s=new Array(3).fill(-1);for(let u of o){if(u<0)continue;let d=Pn(e[u],t,n);for(let c=0;c<3;c++)if(d<i[c]){for(let l=2;l>c;l--)i[l]=i[l-1],s[l]=s[l-1];i[c]=d,s[c]=u;break}}if(s[0]<0)return 0;if(i[0]<1e-6)return e[s[0]].depth;let a=i[0]*2.2,m=0,f=0;for(let u=0;u<3;u++){let d=s[u];if(d<0||i[u]>a)continue;let c=1/(i[u]*i[u]);m+=c*e[d].depth,f+=c}return f>0?m/f:e[s[0]].depth}function Mi(e){let t=(r,o)=>xi(e,r,o),n=(r,o)=>{let i=1/0,s=-1;for(let a=0;a<e.length;a++){let m=e[a];if(Math.hypot(r-m.cx,o-m.cy)-m.radius>=i)continue;let f=Pn(m,r,o);f<i&&(i=f,s=a)}return s};return{kind:"rows",rowCount:e.length,rows:e,nearestRow:n,depthAt:t,gradientAt:(r,o)=>{let i=(t(r+.5,o)-t(r-.5,o))/1,s=(t(r,o+.5)-t(r,o-.5))/(2*.5),a=Math.hypot(i,s);return a<1e-9?[0,0]:[i/a,s/a]}}}function En(e,t){let n=[];for(let r of e){let o=gi(r.points,t);o&&n.push(o)}return n.length<2?yi(t):(n.sort((r,o)=>r.depth-o.depth),Mi(n))}var At=Ie(require("polygon-clipping"),1);var Tn=Ie(require("earcut"),1);var Si=.58,An=.01,se=nt*1.5*me,wi=.5,Ii=.6;function vi(e,t){let n=e.length,r=[];for(let s=0;s<n;s++){let a=e[Math.max(0,s-1)],m=e[Math.min(n-1,s+1)],f=m.x-a.x,u=m.y-a.y,d=Math.hypot(f,u);if(d<1e-9){r.push([0,0]);continue}f/=d,u/=d,r.push([-u,f])}let o=0;for(let s=0;s<n;s++)o+=(e[s].x-t.x)*r[s][0]+(e[s].y-t.y)*r[s][1];return o<0?r.map(([s,a])=>[-s,-a]):r}function Ri(e,t){if(e.length<2||t<=0)return[...e];let n=[...e],r=(s,a)=>{let m=a.x-s.x,f=a.y-s.y,u=Math.hypot(m,f)||1;return{x:m/u,y:f/u}},o=r(n[1],n[0]),i=r(n[n.length-2],n[n.length-1]);return n.unshift({x:n[0].x+o.x*t,y:n[0].y+o.y*t}),n.push({x:n[n.length-1].x+i.x*t,y:n[n.length-1].y+i.y*t}),n}var _n=Math.PI/12;function Ci(e){if(e.length<3)return[...e];let t=[...e].sort((i,s)=>i.x-s.x||i.y-s.y),n=(i,s,a)=>(s.x-i.x)*(a.y-i.y)-(s.y-i.y)*(a.x-i.x),r=i=>{let s=[];for(let a of i){for(;s.length>=2&&n(s[s.length-2],s[s.length-1],a)<=0;)s.pop();s.push(a)}return s.pop(),s},o=[...r(t),...r([...t].reverse())];return o.length>=3?o:[...e]}function Ln(e,t){if(!e.length||!(t>0))return[];let n=Ci(e),r=(a,m,f,u)=>{let d=f-m;for(;d<0;)d+=Math.PI*2;for(;d>Math.PI*2;)d-=Math.PI*2;let c=Math.max(1,Math.ceil(d/_n)),l=t/Math.cos(d/c/2);for(let b=0;b<=c;b++){let h=m+d*b/c;u.push({x:a.x+Math.cos(h)*l,y:a.y+Math.sin(h)*l})}};if(n.length<3){let a=0,m=0;for(let l of n)a+=l.x,m+=l.y;a/=n.length||1,m/=n.length||1;let f=0;for(let l of n)f=Math.max(f,Math.hypot(l.x-a,l.y-m));let u=[],d=Math.max(3,Math.ceil(Math.PI*2/_n)),c=(f+t)/Math.cos(Math.PI/d);for(let l=0;l<d;l++){let b=l/d*Math.PI*2;u.push({x:a+Math.cos(b)*c,y:m+Math.sin(b)*c})}return u}let o=n.length,i=[];for(let a=0;a<o;a++){let m=n[a],f=n[(a+1)%o];i.push(Math.atan2(-(f.x-m.x),f.y-m.y))}let s=[];for(let a=0;a<o;a++)r(n[a],i[(a+o-1)%o],i[a],s);return Nn(s)}function Pi(e,t,n){if(e.length===1)return Math.hypot(t-e[0].x,n-e[0].y);let r=1/0;for(let o=0;o+1<e.length;o++){let i=e[o],s=e[o+1],a=s.x-i.x,m=s.y-i.y,f=a*a+m*m,u=f>1e-12?((t-i.x)*a+(n-i.y)*m)/f:0;u<0?u=0:u>1&&(u=1);let d=Math.hypot(t-(i.x+u*a),n-(i.y+u*m));d<r&&(r=d)}return r}function rt(e){let t=e.map(o=>{let i=0,s=0;for(let f of o.pts)i+=f.x,s+=f.y;let a=o.pts.length||1;i/=a,s/=a;let m=0;for(let f of o.pts){let u=Math.hypot(f.x-i,f.y-s);u>m&&(m=u)}return{cx:i,cy:s,rad:m}}),n=o=>{let i=o.length;return i<=2?[...o]:[o[Math.floor(i*.25)],o[Math.floor(i*.5)],o[Math.floor(i*.75)]]},r=[];for(let o=0;o<e.length;o++){let i=n(e[o].pts),s=[],a=1/0,m=null;for(let u of i){let d=1/0;for(let c=0;c<e.length;c++){if(c===o||Math.abs(e[c].y-e[o].y)<.001)continue;let l=t[c],b=Math.hypot(u.x-l.cx,u.y-l.cy)-l.rad;if(b>=d&&b>=a)continue;let h=Pi(e[c].pts,u.x,u.y);h<d&&(d=h),e[c].depth<e[o].depth&&h<a&&(a=h,m=e[c].y)}Number.isFinite(d)&&d>0&&s.push(d)}s.sort((u,d)=>u-d);let f=s.length?s[Math.floor(s.length/2)]:1;r.push({pitch:f,belowY:m})}return r}function On(e,t,n,r){let o=e[t],i=o.pts.length>=2?[...o.pts]:o.pts.length===1?(()=>{let u=o.pts[0],d=u.x-r.x,c=u.y-r.y,l=Math.hypot(d,c)||1;d/=l,c/=l;let b=Math.max(n[t].pitch,.001)*.5;return[{x:u.x+c*b,y:u.y-d*b},{x:u.x-c*b,y:u.y+d*b}]})():[];if(i.length<2)return null;let s=0,a=0;for(let u=1;u<i.length;u++){let d=Math.hypot(i[u].x-i[u-1].x,i[u].y-i[u-1].y);d>1e-6&&(s+=d,a++)}let m=a>0?s/a:0,f=Ri(i,Math.max(m*Ii,se));return{pts:f,nrm:vi(f,r),front:Math.max(n[t].pitch*Si,se),back:Math.max(n[t].pitch*wi,se)}}var Ce=1.5,Bn=.3;function Pt(e,t){if(e.length<3)return e;let n=e[0],r=e[e.length-1],o=r.x-n.x,i=r.y-n.y,s=Math.hypot(o,i),a=-1,m=-1;for(let d=1;d<e.length-1;d++){let c=e[d],l=s>1e-12?Math.abs((c.x-n.x)*i-(c.y-n.y)*o)/s:Math.hypot(c.x-n.x,c.y-n.y);l>a&&(a=l,m=d)}if(a<=t||m<0)return[n,r];let f=Pt(e.slice(0,m+1),t),u=Pt(e.slice(m),t);return[...f.slice(0,-1),...u]}function Fn(e,t){if(e.length<4)return e;let n=Pt([...e,e[0]],t);return n.pop(),n.length>=3?n:e}function Dn(e,t,n){if(e.length<2)return[];let r=n??rt(e),o=new Map;for(let s=0;s<e.length;s++){let a=o.get(e[s].blockId);a?a.push(s):o.set(e[s].blockId,[s])}let i=[];for(let[,s]of o){let a=[];for(let g of s){let M=e[g].patch;M&&M.length>=3?i.push({outline:[...M],holes:[],topY:e[g].y}):a.push(g)}if(!a.length)continue;a.sort((g,M)=>e[g].depth-e[M].depth);let f=a.map(g=>On(e,g,r,t)).filter(g=>g!==null);if(!f.length)continue;let u=(g,M)=>({x:g.pts[M].x-g.nrm[M][0]*(g.front+Ce),y:g.pts[M].y-g.nrm[M][1]*(g.front+Ce)}),d=(g,M)=>({x:g.pts[M].x+g.nrm[M][0]*(g.back+Ce),y:g.pts[M].y+g.nrm[M][1]*(g.back+Ce)}),c=f[0],l=f[f.length-1],b=[];for(let g=0;g<c.pts.length;g++)b.push(u(c,g));for(let g of f)b.push(d(g,g.pts.length-1));for(let g=l.pts.length-1;g>=0;g--)b.push(d(l,g));for(let g=f.length-1;g>=0;g--)b.push(u(f[g],0));let h=Nn(b),p=1/0;for(let g of a)e[g].y<p&&(p=e[g].y);if(!Number.isFinite(p))continue;if(h.length>=3&&Math.abs(he(h))>1e-6&&f.every(g=>{let M=g.pts[Math.floor(g.pts.length/2)];return Oe(h,M.x,M.y)})){i.push({outline:Fn(h,Bn),holes:[],topY:p});continue}for(let g of Ei(f))i.push({outline:g,holes:[],topY:p})}return i}function Ei(e){let t=[];for(let n of e){let r=[],o=[],i=n.front+Ce,s=n.back+Ce;for(let m=0;m<n.pts.length;m++){let f=n.pts[m],u=n.nrm[m];r.push([f.x-u[0]*i,f.y-u[1]*i]),o.push([f.x+u[0]*s,f.y+u[1]*s])}let a=[...r,...o.reverse()];a.length<3||(a.push(a[0]),t.push([a]))}if(!t.length)return[];try{let n=At.default.union(t[0],...t.slice(1)),r=[];for(let o of n){if(!o.length||o[0].length<4)continue;let i=o[0].map(([m,f])=>({x:m,y:f})),s=i[0],a=i[i.length-1];i.length>1&&Math.abs(s.x-a.x)<1e-9&&Math.abs(s.y-a.y)<1e-9&&i.pop(),i.length>=3&&r.push(Fn(i,Bn))}return r}catch{return[]}}function Nn(e){let t=[];for(let n of e){let r=t[t.length-1];r&&Math.hypot(n.x-r.x,n.y-r.y)<1e-9||t.push(n)}for(;t.length>2&&Math.hypot(t[0].x-t[t.length-1].x,t[0].y-t[t.length-1].y)<1e-9;)t.pop();return t}var Et=class{constructor(t){this.minX=1/0;this.minY=1/0;this.maxX=-1/0;this.maxY=-1/0;this.rings=t;for(let n of t)for(let r of n)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(t){for(let n of t)if(n.x<this.minX||n.x>this.maxX||n.y<this.minY||n.y>this.maxY)return!1;for(let n of this.rings){let r=!0;for(let o of t)if(!Oe(n,o.x,o.y)){r=!1;break}if(r)return!0}return!1}};function kn(e,t,n,r,o,i){if(r.length<3)return;if(n.containsAll(r)){let f=[0,1,0],u=r[0];for(let d=1;d+1<r.length;d++){let c=r[d],l=r[d+1];e.tri([u.x*R,o,u.y*R],[c.x*R,o,c.y*R],[l.x*R,o,l.y*R],f,i)}return}let s=r.map(f=>[f.x,f.y]);s.push(s[0]);let a;try{a=At.default.intersection([s],t)}catch{return}let m=[0,1,0];for(let f of a){if(!f.length||f[0].length<4)continue;let u=f[0],d=[],c=[];for(let b=0;b<u.length-1;b++)d.push(u[b][0],u[b][1]),c.push([u[b][0],u[b][1]]);if(c.length<3)continue;let l=(0,Tn.default)(d,void 0,2);for(let b=0;b<l.length;b+=3){let h=c[l[b]],p=c[l[b+1]],y=c[l[b+2]];e.tri([h[0]*R,o,h[1]*R],[p[0]*R,o,p[1]*R],[y[0]*R,o,y[1]*R],m,i)}}}function jn(e,t,n,r,o,i,s){if(t.length<2)return;let a=s??rt(t),m=[0,1,0],f=i&&i.length>=3?[[...i.map(l=>[l.x,l.y]),[i[0].x,i[0].y]]]:null,u=i&&i.length>=3?new Et([[...i]]):null,d=l=>{e.setMaterial(2),l(),e.setMaterial(0)},c=l=>{e.setMaterial(3),l(),e.setMaterial(0)};for(let l=0;l<t.length;l++){let b=t[l];if(b.patch&&b.patch.length>=3){let A=[...b.patch],S=a[l].belowY??r;if(c(()=>{if(f&&u)kn(e,f,u,A,b.y,o.tread);else{let v=A[0];for(let _=1;_+1<A.length;_++){let D=A[_],N=A[_+1];e.tri([v.x*R,b.y,v.y*R],[D.x*R,b.y,D.y*R],[N.x*R,b.y,N.y*R],m,o.tread)}}}),b.y>S+An){let v=0,_=0;for(let D of A)v+=D.x,_+=D.y;v/=A.length,_/=A.length,d(()=>{for(let D=0;D<A.length;D++){let N=A[D],G=A[(D+1)%A.length],C=G.x-N.x,w=G.y-N.y,k=Math.hypot(C,w);if(k<1e-6)continue;let B=w/k,I=-C/k;(N.x-v)*B+(N.y-_)*I<0&&(B=-B,I=-I);let T=[B,0,I],P=[N.x*R,b.y,N.y*R],E=[G.x*R,b.y,G.y*R],L=[N.x*R,S,N.y*R],F=[G.x*R,S,G.y*R];e.tri(P,E,F,T,o.riser),e.tri(P,F,L,T,o.riser)}})}continue}let h=On(t,l,a,n);if(!h)continue;let{pts:p,nrm:y,front:g,back:M}=h,x=a[l].belowY??r;for(let A=0;A+1<p.length;A++){let S=p[A],v=p[A+1],_=y[A],D=y[A+1];if(Math.hypot(v.x-S.x,v.y-S.y)<1e-6||_[0]===0&&_[1]===0||D[0]===0&&D[1]===0)continue;let N=[(S.x-_[0]*g)*R,b.y,(S.y-_[1]*g)*R],G=[(v.x-D[0]*g)*R,b.y,(v.y-D[1]*g)*R],C=[(S.x+_[0]*M)*R,b.y,(S.y+_[1]*M)*R],w=[(v.x+D[0]*M)*R,b.y,(v.y+D[1]*M)*R];if(c(()=>{f&&u?kn(e,f,u,[{x:S.x-_[0]*g,y:S.y-_[1]*g},{x:v.x-D[0]*g,y:v.y-D[1]*g},{x:v.x+D[0]*M,y:v.y+D[1]*M},{x:S.x+_[0]*M,y:S.y+_[1]*M}],b.y,o.tread):(e.tri(N,G,w,m,o.tread),e.tri(N,w,C,m,o.tread))}),b.y>x+An){let k=[N[0],x,N[2]],B=[G[0],x,G[2]],I=[-_[0],0,-_[1]];d(()=>{e.tri(N,G,B,I,o.riser),e.tri(N,B,k,I,o.riser)})}}}}function Gn(e){let t=1/0,n=1/0,r=-1/0,o=-1/0,i=!1;for(let s of e)!Number.isFinite(s.x)||!Number.isFinite(s.y)||(i=!0,s.x<t&&(t=s.x),s.y<n&&(n=s.y),s.x>r&&(r=s.x),s.y>o&&(o=s.y));return i?{minX:t,minY:n,maxX:r,maxY:o}:null}function it(e,t){return e.minX<=t.maxX&&t.minX<=e.maxX&&e.minY<=t.maxY&&t.minY<=e.maxY}var _t=Ie(require("polygon-clipping"),1);function Ai(e,t){let n=e.eventConfigurationIds;return!n?.length||!!t&&n.includes(t)}function Un(e,t){return e.filter(n=>n.type!=="shape"||Ai(n,t))}function Yn(e,t){let n=e.focalPoint??{x:0,y:0};return e.floors?.length?e.floors.map((r,o)=>({objects:Un(r.objects,t),focal:{x:(r.focalPoint??n).x,y:(r.focalPoint??n).y},baseHeightM:r.baseHeightM??0,index:o})):[{objects:Un(e.objects,t),focal:n,baseHeightM:0,index:0}]}var _i={minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};function Pe(e){return Gn(e)??_i}function Xn(e,t){let n=et(e.outline,se),r=Pe(n),o=t.filter(s=>s!==e&&s.outline&&s.outline.length>=3&&it(r,Pe(s.outline)));if(!o.length)return[n];let i=s=>{let a=s.map(m=>[m.x,m.y]);return a.push(a[0]),a};try{let s=_t.default.difference([i(n)],...o.map(m=>[i(m.outline)])),a=[];for(let m of s){if(!m.length)continue;let f=m[0].map(([u,d])=>({x:u,y:d}));if(f.length>1){let u=f[0],d=f[f.length-1];Math.abs(u.x-d.x)<1e-9&&Math.abs(u.y-d.y)<1e-9&&f.pop()}f.length>=3&&a.push(f)}return a.length?a:[n]}catch{return[n]}}function Vn(e,t){if(!t.length)return e;let n=i=>{let s=i.map(a=>[a.x,a.y]);return s.push(s[0]),s},r=t.map(i=>[n(i)]),o=[];for(let i of e){let s;try{s=_t.default.intersection([n(i.outline)],r.flat())}catch{o.push(i);continue}for(let a of s){if(!a.length)continue;let m=a[0].map(([f,u])=>({x:f,y:u}));if(m.length>1){let f=m[0],u=m[m.length-1];Math.abs(f.x-u.x)<1e-9&&Math.abs(f.y-u.y)<1e-9&&m.pop()}m.length>=3&&o.push({outline:m,holes:[],topY:i.topY})}}return o.length?o:e}var ki=.05,Hn=.05,Ti=.15,kt=25;function Kn(e,t,n){let r=new Map,o=new Array(t.length).fill(null),i=new Float64Array(t.length),s=new Array(t.length).fill(void 0),a=new Array(t.length).fill(void 0),m=new Map,f=[],u=new Set;for(let c=0;c<e.length;c+=1){let l=e[c];for(let b of l.objects){if(b.type==="table"&&u.add(b.id),b.type!=="section"||!b.outline||b.outline.length<3)continue;let h=et(b.outline,se);m.set(b.id,{section:b,unit:l,frontU:1/0,hasSeats:!1,rows:new Map,seatIndices:[]}),f.push({id:b.id,floorIndex:c,box:Pe(h),section:b,unit:l,outline:h})}}let d=new Map;for(let c of f){let l=d.get(c.floorIndex);l?l.push(c):d.set(c.floorIndex,[c])}for(let c=0;c<t.length;c++){let l=t[c],b=n?d.get(n[c])??[]:f,h=l.sectionId?b.find(y=>y.id===l.sectionId)??b.find(y=>y.section.logicalSectionId===l.sectionId&&pe({x:l.x,y:l.y},y.outline,y.section.holes)):void 0,p=h?[h]:b;for(let y of p){if(n&&y.floorIndex!==n[c]||!h&&(l.x<y.box.minX||l.x>y.box.maxX||l.y<y.box.minY||l.y>y.box.maxY||!pe({x:l.x,y:l.y},y.outline,y.section.holes)))continue;o[c]=y.id;let g=m.get(y.id);g.hasSeats=!0;let M=l.focalPoint??y.unit.focal,x=Math.hypot(l.x-M.x,l.y-M.y);x<g.frontU&&(g.frontU=x),g.seatIndices.push(c);let A=l.rowId||`__seat-${c}`,S=g.rows.get(A);S?S.push({x:l.x,y:l.y}):g.rows.set(A,[{x:l.x,y:l.y}]);break}}for(let[c,l]of m){let b=Ke(l.section,{floorBaseHeightM:l.unit.baseHeightM}),h=l.unit.baseHeightM,p=b.rake>0?Math.tan(b.rake*Math.PI/180):0,y=b.rake<=.01&&b.height<=h+.001,g=l.section.surfaceKind,M=g==="flat"?!0:g==="rakedRows"&&b.rake>.01?!1:y,x=l.hasSeats?ze(c,t,l.seatIndices,l.unit.focal):{sectionId:c,rows:[],blockCount:0},S=x.rows.length<2?En([...l.rows.values()].map(P=>({points:P})),l.unit.focal):null,v=1/0;if(S){if(l.hasSeats)for(let P of l.rows.values())for(let E of P){let L=S.depthAt(E.x,E.y);L<v&&(v=L)}if(!l.hasSeats||!Number.isFinite(v)){v=1/0;for(let P of l.section.outline){let E=S.depthAt(P.x,P.y);E<v&&(v=E)}}}let _=h+ki,D=Math.max(_,b.height),N=P=>{let E=Math.max(0,P-v)*te,L=Math.min(E*p,kt);return Math.max(_,b.height+L)},G=P=>{let E=Math.max(0,P)*te,L=Math.min(E*p,kt);return Math.max(_,b.height+L)},C=M?[]:x.rows.map(P=>({pts:P.pts,y:G(P.blockDepth),depth:P.blockDepth,blockId:P.blockId,...u.has(P.id)?{patch:Ln(P.pts,se)}:{}})),w=C.length?C[0].y:D,k=C.map(P=>{let E=P.patch&&P.patch.length>=3?P.patch:P.pts,L=0,F=0;for(let U of E)L+=U.x,F+=U.y;let j=E.length||1;L/=j,F/=j;let Y=0;for(let U of E){let X=Math.hypot(U.x-L,U.y-F);X>Y&&(Y=X)}return{cx:L,cy:F,rad:Y}}),B=M?()=>D:C.length>=2?(P,E)=>{let L=1/0,F=w;for(let j=0;j<C.length;j++){let Y=k[j];if(Math.hypot(P-Y.cx,E-Y.cy)-Y.rad>=L)continue;let U=C[j].patch,X=U&&U.length>=3?Oe(U,P,E)?0:ve(U,P,E):ve(C[j].pts,P,E);X<L&&(L=X,F=C[j].y)}return F}:(P,E)=>S?N(S.depthAt(P,E)):D,I=[0,1,0],T=C.length>=2||M?()=>I:(P,E)=>{if(!S)return I;let L=S.depthAt(P,E);if(L<=v)return I;let F=(L-v)*te;if(F*p>=kt||b.height+F*p<=_)return I;let[j,Y]=S.gradientAt(P,E);if(j===0&&Y===0)return I;let U=1/Math.hypot(p,1);return[-j*p*U,U,-Y*p*U]};if(!M)for(let P of x.rows){let E=G(P.blockDepth);for(let L of P.seatIndices)s[L]=E}for(let P of x.rows){let E=[];for(let U=1;U<P.pts.length;U++){let X=Math.hypot(P.pts[U].x-P.pts[U-1].x,P.pts[U].y-P.pts[U-1].y);X>1e-6&&E.push(X)}E.sort((U,X)=>U-X);let L=E.length?E[Math.floor(E.length/2)]:1/0,F=1/0,j=P.pts[Math.floor(P.pts.length/2)];if(j)for(let U of x.rows){if(U===P||U.blockId!==P.blockId)continue;let X=ve(U.pts,j.x,j.y);X>1e-6&&X<F&&(F=X)}let Y=Math.min(L,Math.max(F,L*.5));if(Number.isFinite(Y)&&Y>0)for(let U of P.seatIndices)a[U]=Y}r.set(c,{sectionId:c,deckAt:B,normalAt:T,flat:M,bottomY:h,rowLevels:C,landingY:w})}for(let c=0;c<t.length;c++){let l=o[c],b=t[c];if(l){let p=s[c];i[c]=(p??r.get(l).deckAt(b.x,b.y))+Ti;continue}let h=b.eyeHeightM;i[c]=Number.isFinite(h)?Math.max(0,h-ce):0}return{bySection:r,seatOwner:o,seatDeckY:c=>i[c],seatPitchU:c=>a[c]}}var Q={top:1,wallBottom:.5,bottomCap:.4};function ue(e,t){if(!e)return t;let n=ie(Le(e,.4),.62);return ne(t,n,.72)}function zn(e,t){let n=new Map;for(let i of e.categories??[])n.set(i.key,i.color);let r=new Map;for(let i of t){if(!i.sectionId)continue;let s=r.get(i.sectionId);s||(s=new Map,r.set(i.sectionId,s)),s.set(i.categoryKey,(s.get(i.categoryKey)??0)+1)}let o=new Map;for(let[i,s]of r){let a=0,m=0,f=0,u=0;for(let[d,c]of s){let l=W(n.get(d));l&&(a+=l[0]*c,m+=l[1]*c,f+=l[2]*c,u+=c)}u>0&&o.set(i,[a/u,m/u,f/u])}return o}function Wn(e,t){return W(e.color)??t.get(e.logicalSectionId??e.id)??null}var Zn=Ie(require("polygon-clipping"),1);function Li(e,t){return e===void 0||t===void 0?!0:Math.abs(e-t)<.001}var st=class{constructor(){this.rings=[];this.boxes=[];this.levels=[]}subtract(t,n){let r=t.map(m=>[m.x,m.y]);if(r.length<3)return[];r.push(r[0]);let o=Pe(t),i=this.rings.filter((m,f)=>it(o,this.boxes[f])&&Li(n,this.levels[f])),s=[[r]];if(i.length)try{s=Zn.default.difference([r],...i).map(f=>f.map(u=>u.map(([d,c])=>[d,c])))}catch{s=[[r]]}this.rings.push([r]),this.boxes.push(o),this.levels.push(n);let a=[];for(let m of s){if(!m.length)continue;let f=m[0].map(([u,d])=>({x:u,y:d}));if(f.length>1){let u=f[0],d=f[f.length-1];Math.abs(u.x-d.x)<1e-9&&Math.abs(u.y-d.y)<1e-9&&f.pop()}f.length>=3&&a.push(f)}return a}};function Oi(e,t){if(!t)return e;let n=1/0,r=-1/0,o=1/0,i=-1/0;for(let d of e)n=Math.min(n,d.x),r=Math.max(r,d.x),o=Math.min(o,d.y),i=Math.max(i,d.y);let s=(n+r)/2,a=(o+i)/2,m=t*Math.PI/180,f=Math.cos(m),u=Math.sin(m);return e.map(d=>{let c=d.x-s,l=d.y-a;return{x:s+c*f-l*u,y:a+c*u+l*f}})}function ge(e){let t=null;if(e.kind==="polygon"&&e.points&&e.points.length>=3&&(t=e.points),e.kind==="rect"&&e.width&&e.height&&(t=De(e.x??0,e.y??0,e.width,e.height)),e.kind==="ellipse"&&e.width&&e.height){let n=(e.x??0)+e.width/2,r=(e.y??0)+e.height/2;t=tt(n,r,e.width/2,e.height/2)}return t?Oi(t,e.rotation):null}function Ne(e){let t=e.role??"",n={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=t==="stage"&&We(e.stageKind)?{kind:"stage",heightM:.06}:n[t]??{kind:"plate",heightM:.25};return{...r,heightM:e.heightM??r.heightM}}var Bi=.08;function $n(e,t){let n=ge(e),r=Ne(e),o=r.heightM;if(!n||r.kind!=="plate"&&r.kind!=="stage")return o;let i=1/0,s=1/0,a=-1/0,m=-1/0;for(let u of n)i=Math.min(i,u.x),s=Math.min(s,u.y),a=Math.max(a,u.x),m=Math.max(m,u.y);let f=o;for(let u of t)a>u.minX&&i<u.maxX&&m>u.minY&&s<u.maxY&&f<=u.topOffsetM+1e-6&&(f=u.topOffsetM+Bi);return t.push({minX:i,minY:s,maxX:a,maxY:m,topOffsetM:f}),f}function de(e,t,n){return{x:e.x+(t.x-e.x)*n,y:e.y+(t.y-e.y)*n}}function Qn(e){if(e.length!==4)return e;let t=Math.hypot(e[1].x-e[0].x,e[1].y-e[0].y),n=Math.hypot(e[2].x-e[1].x,e[2].y-e[1].y);return t>=n?e:[e[1],e[2],e[3],e[0]]}function je(e,t,n){return[de(e[0],e[1],t),de(e[0],e[1],n),de(e[3],e[2],n),de(e[3],e[2],t)]}function qn(e,t,n){return[de(e[0],e[3],t),de(e[1],e[2],t),de(e[1],e[2],n),de(e[0],e[3],n)]}function le(e,t,n,r,o,i){J(e,t,void 0,()=>n,r,o,i,Q)}var Tt=2.4,Fi=.75,Di=.15;function Ge(e){if(e.points&&e.points.length>=3)return e.points;let{center:t,width:n,height:r,rotation:o}=e;if(!n||!r)return null;let i=(o??0)*Math.PI/180,s=Math.cos(i),a=Math.sin(i),m=n/2,f=r/2;return[[-m,-f],[m,-f],[m,f],[-m,f]].map(([u,d])=>({x:t.x+u*s-d*a,y:t.y+u*a+d*s}))}function Jn(e,t,n,r,o){let i=Ge(t);i&&J(e,i,void 0,()=>n+Tt,n,ue(r,o.boothTop),o.boothWall,Q)}function Lt(e){if(e.shape==="round"){let u=e.radius;return u?tt(e.center.x,e.center.y,u,u,24):null}let{width:t,height:n,rotation:r,center:o}=e;if(!t||!n)return null;let i=(r??0)*Math.PI/180,s=Math.cos(i),a=Math.sin(i),m=t/2,f=n/2;return[[-m,-f],[m,-f],[m,f],[-m,f]].map(([u,d])=>({x:o.x+u*s-d*a,y:o.y+u*a+d*s}))}function eo(e,t,n,r,o){let i=Lt(t);i&&J(e,i,void 0,()=>n+Fi,n,ue(r,o.tableTop),o.tableWall,Q)}function to(e,t,n,r,o,i,s,a){let m=ge(t);if(!m)return;let f=a?a.kind==="stage":t.role==="stage",u=a?a.kind==="screen":t.role==="screen",d=a?{kind:f?"stage":"solid",heightM:a.topY-a.baseY}:Ne(t),c=a?.baseY??n,l=a?.topY??n+r;if(f&&s){let g=1/0,M=-1/0,x=1/0,A=-1/0;for(let S of m)S.x<g&&(g=S.x),S.x>M&&(M=S.x),S.y<x&&(x=S.y),S.y>A&&(A=S.y);s.push({cx:(g+M)/2*R,cz:(x+A)/2*R,y:l,halfX:Math.max((M-g)/2*R,.5),halfZ:Math.max((A-x)/2*R,.5)})}let b=W(t.fill),h=f&&b?ne(o.stageTop,ie(Le(b,.18),.9),.9):ue(b,f?o.stageTop:o.decorTop),p=u?b:null,y=f?b?ne(o.stageWall,ie(b,.58),.82):o.stageWall:u?p?ne(ie(p,1.42),[.24,.46,.82],.08):[.24,.46,.82]:ue(W(t.fill),o.decorWall);if(d.kind==="portal"&&m.length===4){let g=Qn(m);le(e,je(g,0,.16),l,c,h,y),le(e,je(g,.84,1),l,c,h,y),le(e,g,l,Math.max(c,l-.35),h,y);return}if(d.kind==="suite"&&m.length===4){let g=m.map((A,S)=>{let v=m[(S+1)%4],_=(A.x+v.x)/2,D=(A.y+v.y)/2;return Math.hypot(_-i.x,D-i.y)}),M=g.indexOf(Math.min(...g)),x=[0,1,2,3].map(A=>m[(M+A)%4]);le(e,je(x,0,.08),l,c,h,y),le(e,je(x,.92,1),l,c,h,y),le(e,qn(x,.88,1),l,c,h,y),le(e,x,l,Math.max(c,l-.18),h,y);return}le(e,m,l,c,h,y)}function Ot(e){let{x:t,y:n,width:r,height:o}=e;if(!r||!o)return null;let i=t+r/2,s=n+o/2,a=(e.rotation??0)*Math.PI/180,m=Math.cos(a),f=Math.sin(a),u=r/2,d=o/2;return[[-u,-d],[u,-d],[u,d],[-u,d]].map(([c,l])=>({x:i+c*m-l*f,y:s+c*f+l*m}))}function Ni(e){if(!e||!e.startsWith("data:image/svg+xml"))return null;let t=e.slice(e.indexOf(",")+1);if(/;base64/i.test(e.slice(0,e.indexOf(","))))try{t=atob(t)}catch{return null}else try{t=decodeURIComponent(t)}catch{}let n=t.match(/<(?:rect|path)\b[^>]*\bfill="([^"]+)"/i);if(!n)return null;let r=n[1].trim();if(r==="none"||r==="transparent")return null;let o=r.match(/^url\(#([^)]+)\)$/);if(!o)return W(r);let i=t.match(new RegExp(`<(?:linear|radial)Gradient\\b[^>]*\\bid="${o[1]}"[^>]*>([\\s\\S]*?)</(?:linear|radial)Gradient>`,"i"));if(!i)return null;let s=[];for(let a of i[1].matchAll(/stop-color="([^"]+)"/gi)){let m=W(a[1].trim());m&&s.push(m)}return s.length?s.reduce((a,m,f)=>ne(a,m,1/(f+1)),s[0]):null}function no(e,t,n,r){if(t.layer==="foreground")return;let o=Ot(t);if(!o)return;let i=n+Di,s=ue(Ni(t.href),r.decorTop),a=Math.max(0,Math.min(1,t.opacity??1));a<1&&(s=ne(r.ground,s,a)),J(e,o,void 0,()=>i,n,s,ne(s,r.decorWall,.5),Q)}function oo(e,t,n,r,o){if(!t.points||t.points.length<3)return;let i=ue(r,o.gaTop);J(e,t.points,t.holes,()=>n+.15,n,i,o.gaWall,Q)}var ji=Math.PI/180,K=96,Gi=6,Ui=60,Yi=150,ro=.2,Xi=.35;function Vi(e,t){let n=Math.atan2(t.x-e.x,t.y-e.y)/ji;return n<0?n+360:n}function at(e){if(!e.length)return NaN;let t=[...e].sort((n,r)=>n-r);return t[Math.floor(t.length/2)]}function ct(e,t,n=2){let r=e.length,o=new Float64Array(r);for(let i=0;i<r;i++){let s=0,a=0;for(let m=-n;m<=n;m++){let f=i+m;if(t)f=(f%r+r)%r;else if(f<0||f>=r)continue;s+=e[f],a++}o[i]=s/a}return o}function io(e,t){let n=e.filter(c=>c.rows.length>=1);if(n.length<1)return null;let r=[],o=0,i=0,s=0;for(let c of n)for(let l of c.rows){for(let b of l.pts)o+=b.x,i+=b.y,s++;if(l.pts.length>=4){let b=gt(l.pts);b&&Number.isFinite(b.cx)&&Number.isFinite(b.cy)&&r.push({x:b.cx,y:b.cy})}}if(!s)return null;let a={x:o/s,y:i/s},m=a;if(r.length>=8){let c=at(r.map(y=>y.x)),l=at(r.map(y=>y.y)),b=0;for(let y of n)for(let g of y.rows)for(let M of g.pts){let x=Math.hypot(M.x-a.x,M.y-a.y);x>b&&(b=x)}let h=0,p=b*.2;for(let y of n)for(let g of y.rows)for(let M of g.pts)Math.hypot(M.x-c,M.y-l)<p&&h++;Math.hypot(c-a.x,l-a.y)<=b&&h/s<.01&&(m={x:c,y:l})}let f=[];for(let c of n){let l={sectionId:c.sectionId,rMin:1/0,rMax:-1/0,samples:[]};for(let b of c.rows)for(let h of b.pts){let p=Math.hypot(h.x-m.x,h.y-m.y),y=Math.min(K-1,Math.floor(Vi(m,h)/(360/K)));l.samples.push({r:p,bin:y,levelM:b.levelM}),p<l.rMin&&(l.rMin=p),p>l.rMax&&(l.rMax=p)}l.samples.length&&f.push(l)}if(!f.length)return null;f.sort((c,l)=>c.rMin+c.rMax-(l.rMin+l.rMax));let u=[];for(let c of f){let l=!1;for(let b of u){let h=Math.min(c.rMax,b.rMax)-Math.max(c.rMin,b.rMin),p=Math.min(c.rMax-c.rMin,b.rMax-b.rMin);if(p>1e-9&&h>=Xi*p){b.members.push(c),b.rMin=Math.min(b.rMin,c.rMin),b.rMax=Math.max(b.rMax,c.rMax),l=!0;break}}l||u.push({members:[c],rMin:c.rMin,rMax:c.rMax})}let d=[];for(let c of u){let l=new Array(K).fill(null);for(let w of c.members)for(let k of w.samples){let B=l[k.bin];B||(B={samples:[]},l[k.bin]=B),B.samples.push({r:k.r,levelM:k.levelM})}let b=l.map(w=>!!w);if(!b.filter(Boolean).length)continue;let p=[],y=[];for(let w of l){if(!w)continue;let k=1/0,B=-1/0;for(let I of w.samples)I.r<k&&(k=I.r),I.r>B&&(B=I.r);p.push(k),y.push(B)}let g=at(p),M=at(y);if(!(g>=ro*M)||!(M>0))continue;let x=[...p].sort((w,k)=>w-k);if(!(x[Math.floor(x.length*.1)]>=ro*M))continue;let S=l.map(w=>{if(!w)return null;let k=[...w.samples].sort((j,Y)=>j.r-Y.r),B=k[0].r,I=k[k.length-1].r,T=k[0].levelM,P=-1/0;for(let j of k)j.levelM>P&&(P=j.levelM);let E=[];for(let j of k){let Y={r:j.r,l:j.levelM};for(;E.length&&Math.abs(E[E.length-1].r-Y.r)<1e-9;){if(E[E.length-1].l<=Y.l){Y.skip=!0;break}E.pop()}if(!Y.skip){for(;E.length>=2;){let U=E[E.length-2],X=E[E.length-1];if((X.r-U.r)*(Y.l-U.l)-(X.l-U.l)*(Y.r-U.r)<=0)E.pop();else break}E.push(Y)}}let L=E.map(j=>j.r),F=E.map(j=>j.l);return{inner:B,outer:I,front:T,top:P,profile:{rs:L,ls:F}}}),v=b.slice();for(let w=0;w<K;w++){if(v[w])continue;let k=-1,B=-1,I=0;for(let O=1;O<=K;O++){let V=(w-O+K*2)%K;if(v[V]){k=V;break}}for(let O=1;O<=K;O++){let V=(w+O)%K;if(v[V]){B=V,I=O;break}}if(k<0||B<0)continue;let T=0;for(let O=1;O<=K;O++){let V=(w-O+K*2)%K;if(b[V]){T=O;break}}if(T-1+I>Gi)continue;let E=S[k],L=S[B],F=T/(T+I),j=E.inner+(L.inner-E.inner)*F,Y=E.outer+(L.outer-E.outer)*F,U=E.front+(L.front-E.front)*F,X=E.top+(L.top-E.top)*F;S[w]={inner:j,outer:Y,front:U,top:X,profile:{rs:[j,Y],ls:[U,X]}}}for(let w=0;w<K;w++)S[w]&&(v[w]=!0);let _=360/K,D=[],N=v.filter(Boolean).length,G=[];if(N===K)G.push({start:0,len:K});else{let w=0;for(;v[w];)w=(w+1)%K;let k=-1;for(let B=0;B<=K;B++){let I=(w+B)%K,T=B<K&&v[I];if(T&&k<0)k=I;else if(!T&&k>=0){let P=(I-k+K)%K||K;G.push({start:k,len:P}),k=-1}}}for(let w of G){if(w.len*_<Ui&&w.len<K)continue;let k=w.len===K,B=new Float64Array(w.len),I=new Float64Array(w.len),T=new Float64Array(w.len),P=new Float64Array(w.len),E=[];for(let O=0;O<w.len;O++){let V=S[(w.start+O)%K];B[O]=V.inner,I[O]=V.outer,T[O]=V.front,P[O]=V.top,E.push(V.profile??{rs:[V.inner,V.outer],ls:[V.front,V.top]})}let L=ct(B,k),F=ct(I,k),j=ct(T,k),Y=ct(P,k);for(let O=0;O<w.len;O++)L[O]>B[O]&&(L[O]=B[O]),F[O]<I[O]&&(F[O]=I[O]),L[O]>F[O]-1e-6&&(L[O]=Math.max(0,F[O]-1e-6)),Y[O]<j[O]&&(Y[O]=j[O]);let U={startBin:w.start,binCount:w.len,closed:k,innerR:L,outerR:F,frontLevelM:j,topLevelM:Y,profiles:E},X=(O,V,H)=>{let $=E[O],Z=$.rs,z=$.ls;if(V<=Z[0]){z[0]>H&&(z[0]=H);return}if(V>=Z[Z.length-1]){z[z.length-1]>H&&(z[z.length-1]=H);return}for(let q=0;q+1<Z.length;q++)if(V<=Z[q+1]){z[q]>H&&(z[q]=H),z[q+1]>H&&(z[q+1]=H);return}};for(let O=0;O<w.len;O++){let V=l[(w.start+O)%K];if(V)for(let H of V.samples){X(O,H.r,H.levelM);let $=k?(O-1+w.len)%w.len:O-1,Z=k?(O+1)%w.len:O+1;$>=0&&X($,H.r,H.levelM),Z<w.len&&X(Z,H.r,H.levelM)}}D.push(U)}D.reduce((w,k)=>w+k.binCount*_,0)<Yi||d.push({arcs:D,sectionIds:c.members.map(w=>w.sectionId),innerRMedian:g,outerRMedian:M})}if(!d.length)return null;if(d.sort((c,l)=>c.innerRMedian-l.innerRMedian),t){let c=d[d.length-1].outerRMedian;if(Math.hypot(t.x-m.x,t.y-m.y)>.9*c)return null}return{centre:m,binCount:K,binStepDeg:360/K,rings:d}}function so(e,t,n,r){let o=e.binStepDeg,i=n/o-.5-t.startBin;i=(i%e.binCount+e.binCount)%e.binCount,i>t.binCount-1&&(t.closed?i=i-t.binCount<t.binCount-i?0:t.binCount-1:i=i-(t.binCount-1)<e.binCount-i?t.binCount-1:0);let s=Math.floor(i),a=t.closed?(s+1)%t.binCount:Math.min(t.binCount-1,s+1),m=i-s,f=u=>{let d=t.profiles[u],c=d.rs,l=d.ls;if(r<=c[0])return l[0];if(r>=c[c.length-1])return l[l.length-1];for(let b=0;b+1<c.length;b++)if(r<=c[b+1]){let h=c[b+1]-c[b],p=h>1e-9?(r-c[b])/h:0;return l[b]+(l[b+1]-l[b])*p}return l[l.length-1]};return f(s)*(1-m)+f(a)*m}var Hi=.25,Ki=1.2,zi=.6,Wi=.45,Zi=2.3,$i=Math.PI/180;function xe(e,t,n){let r=n*$i;return{x:e.x+t*Math.sin(r),y:e.y+t*Math.cos(r)}}function Qi(e,t){let n=t.rings[t.rings.length-1];if(!n)return!1;let r=n.outerRMedian*.85;for(let o of e){if(o.role!=="wall")continue;let i=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(i.length<2)continue;let s=0;for(let a of i)Math.hypot(a.x-t.centre.x,a.y-t.centre.y)>=r&&s++;if(s>=i.length/2)return!0}return!1}var qi=24;function Ji(e,t,n,r,o,i,s,a){let m=n.binCount,f=qi,u=te,d=i+.02,c=[];for(let C=0;C<m;C++){let w=(n.startBin+C+.5)*t.binStepDeg,k=new Float64Array(f+1);for(let B=0;B<=f;B++){let I=r[C]+(o[C]-r[C])*B/f;k[B]=Math.max(d,so(t,n,w,I)-Hi)}c.push(k)}let l=[s.bandTop[0]*a.top,s.bandTop[1]*a.top,s.bandTop[2]*a.top],b=[s.bandTop[0]*a.bottomCap,s.bandTop[1]*a.bottomCap,s.bandTop[2]*a.bottomCap],h=[s.bandWall[0]*a.top,s.bandWall[1]*a.top,s.bandWall[2]*a.top],p=[s.bandWall[0]*a.wallBottom,s.bandWall[1]*a.wallBottom,s.bandWall[2]*a.wallBottom],y=(C,w)=>{let k=(n.startBin+C+.5)*t.binStepDeg,B=r[C]+(o[C]-r[C])*w/f,I=xe(t.centre,B,k);return[I.x*u,c[C][w],I.y*u]};{let C=Math.tan(12*Math.PI/180);for(let w=0;w<6;w++){let k=!1;for(let I=0;I<m;I++)for(let T=f-1;T>=0;T--)c[I][T]>c[I][T+1]&&(c[I][T]=c[I][T+1],k=!0);let B=n.closed?m:m-1;for(let I=0;I<B;I++){let T=(I+1)%m;for(let P=0;P<=f;P++){let E=c[T][P]-c[I][P];if(Math.abs(E)>1)continue;let L=r[I]+(o[I]-r[I])*P/f,F=r[T]+(o[T]-r[T])*P/f,j=xe(t.centre,L,(n.startBin+I+.5)*t.binStepDeg),Y=xe(t.centre,F,(n.startBin+T+.5)*t.binStepDeg),U=C*Math.hypot(Y.x-j.x,Y.y-j.y)*u;E>U?(c[T][P]=c[I][P]+U,k=!0):-E>U&&(c[I][P]=c[T][P]+U,k=!0)}}if(!k)break}}let g=1,M=(C,w)=>{for(let k=0;k<=f;k+=4)if(Math.abs(c[C][k]-c[w][k])>g)return!0;return Math.abs(c[C][f]-c[w][f])>g},x=Math.tan(38*Math.PI/180),A=C=>(o[C]-r[C])/f*u,S=(C,w)=>c[C][w+1]-c[C][w]>x*Math.max(1e-6,A(C)),v=(C,w)=>{let k=n.closed?(C-1+m)%m:Math.max(0,C-1),B=n.closed?(C+1)%m:Math.min(m-1,C+1);Math.abs(c[k][w]-c[C][w])>g&&(k=C),Math.abs(c[B][w]-c[C][w])>g&&(B=C);let I=Math.max(0,w-1),T=Math.min(f,w+1);I<w&&S(C,I)&&(I=w),T>w&&S(C,w)&&(T=w);let P=y(k,w),E=y(B,w),L=y(C,I),F=y(C,T),j=E[0]-P[0],Y=E[1]-P[1],U=E[2]-P[2],X=F[0]-L[0],O=F[1]-L[1],V=F[2]-L[2],H=Y*V-U*O,$=U*X-j*V,Z=j*O-Y*X,z=Math.hypot(H,$,Z);return z>1e-12?(H/=z,$/=z,Z/=z,$<0&&(H=-H,$=-$,Z=-Z),[H,$,Z]):[0,1,0]},_=(C,w)=>{let k=[C[0],i,C[2]],B=[w[0],i,w[2]],I=w[0]-C[0],T=w[2]-C[2],P=Math.hypot(I,T);if(!(P>1e-12))return;let E=[T/P,0,-I/P];e.tri(C,w,B,E,h,h,p),e.tri(C,B,k,E,h,p,p)},D=.05*me,N=C=>o[C]-r[C]<D,G=n.closed?m:m-1;for(let C=0;C<G;C++){let w=(C+1)%m;if(N(C)||N(w))continue;if(M(C,w)){let E=(n.startBin+C+1)*t.binStepDeg,L=(O,V)=>{let H=(r[C]+r[w])/2,$=(o[C]+o[w])/2,Z=H+($-H)*V/f,z=xe(t.centre,Z,E);return[z.x*u,c[O][V],z.y*u]};for(let O=0;O<f;O++){let V=y(C,O),H=y(C,O+1),$=L(C,O),Z=L(C,O+1),z=v(C,O),q=v(C,O+1);e.triN(V,$,Z,z,z,q,l),e.triN(V,Z,H,z,q,q,l);let Ue=y(w,O),Ye=y(w,O+1),Me=L(w,O),Ee=L(w,O+1),Se=v(w,O),we=v(w,O+1);e.triN(Me,Ue,Ye,Se,Se,we,l),e.triN(Me,Ye,Ee,Se,we,we,l);let fe=L(C,O),ae=L(C,O+1),Xe=L(w,O+1),lt=L(w,O),Ve=ae[0]-fe[0],Ae=ae[2]-fe[2],ft=Math.hypot(Ve,Ae);if(ft>1e-12){let Ft=[Ae/ft,0,-Ve/ft];e.tri(fe,ae,Xe,Ft,h),e.tri(fe,Xe,lt,Ft,h)}}let F=y(C,0),j=y(w,0),Y=y(w,f),U=y(C,f),X=O=>[O[0],i,O[2]];e.tri(X(F),X(Y),X(j),[0,-1,0],b),e.tri(X(F),X(U),X(Y),[0,-1,0],b),_(F,j),_(U,Y);continue}for(let E=0;E<f;E++){let L=v(C,E),F=v(w,E),j=v(w,E+1),Y=v(C,E+1);if(S(C,E)||S(w,E)){let H=(ae,Xe)=>{let lt=(n.startBin+ae+.5)*t.binStepDeg,Ve=r[ae]+(o[ae]-r[ae])*(E+.5)/f,Ae=xe(t.centre,Ve,lt);return[Ae.x*u,Xe,Ae.y*u]},$=y(C,E),Z=y(w,E),z=H(C,c[C][E]),q=H(w,c[w][E]);e.triN($,Z,q,L,F,F,l),e.triN($,q,z,L,F,L,l);let Ue=y(w,E+1),Ye=y(C,E+1),Me=H(C,c[C][E+1]),Ee=H(w,c[w][E+1]);e.triN(Me,Ee,Ue,Y,j,j,l),e.triN(Me,Ue,Ye,Y,j,Y,l);let Se=q[0]-z[0],we=q[2]-z[2],fe=Math.hypot(Se,we);if(fe>1e-12){let ae=[-we/fe,0,Se/fe];e.tri(z,q,Ee,ae,h),e.tri(z,Ee,Me,ae,h)}continue}let U=y(C,E),X=y(w,E),O=y(w,E+1),V=y(C,E+1);e.triN(U,X,O,L,F,j,l),e.triN(U,O,V,L,j,Y,l)}let k=y(C,0),B=y(w,0),I=y(w,f),T=y(C,f),P=E=>[E[0],i,E[2]];e.tri(P(k),P(I),P(B),[0,-1,0],b),e.tri(P(k),P(T),P(I),[0,-1,0],b),_(k,B),_(T,I)}if(!n.closed)for(let C of[0,m-1])for(let w=0;w<f;w++)_(y(C,w),y(C,w+1))}function ao(e,t,n){let{bottomY:r,colors:o,ao:i}=n,s=new Float64Array(t.binCount).fill(-1/0);for(let u of t.rings)for(let d of u.arcs){let c=new Float64Array(d.binCount),l=new Float64Array(d.binCount);for(let h=0;h<d.binCount;h++){let p=(d.startBin+h)%t.binCount,y=Math.max(0,d.innerR[h]-se);c[h]=Math.max(y,s[p]+.001),l[h]=Math.max(c[h]+.001,d.outerR[h]+se)}let b=0;for(let h=0;h<d.binCount;h++){let p=d.topLevelM[h]-r;p>b&&(b=p)}b>=Ki&&Ji(e,t,d,c,l,r,o,i);for(let h=0;h<d.binCount;h++){let p=(d.startBin+h)%t.binCount;l[h]>s[p]&&(s[p]=l[h])}}if(n.deriveShell===!1||Qi(n.shapes,t))return;let a=t.rings[t.rings.length-1],m=zi*me,f=Wi*me;for(let u of a.arcs){let d=[],c=[];for(let h=0;h<u.binCount;h++){let p=(u.startBin+h+.5)*t.binStepDeg,y=u.outerR[h]+se+m;d.push(xe(t.centre,y,p)),c.push(xe(t.centre,y+f,p))}let l=-1/0;for(let h=0;h<u.binCount;h++)u.topLevelM[h]>l&&(l=u.topLevelM[h]);let b=()=>l+Zi;u.closed?J(e,c,[d.slice().reverse()],b,r,o.shellTop,o.shellWall,i):J(e,[...c,...d.slice().reverse()],void 0,b,r,o.shellTop,o.shellWall,i)}}function co(e,t,n,r,o,i,s,a){if(!t.outline||t.outline.length<3)return;let m=n.baseHeightM,f=ue(r,a.tierTop);if(!o)return;let u=p=>o.deckAt(p.x,p.y),d=Xn(t,s),c=d[0]??t.outline;if(o.rowLevels.length>=2){let p=rt(o.rowLevels),y=Vn(Dn(o.rowLevels,n.focal,p),d),g=()=>[0,1,0];for(let x of y){let A=Math.max(m,x.topY-.02);for(let S of i.subtract(x.outline,A))J(e,S,x.holes,()=>A,m,f,a.tierWall,Q,void 0,g)}y.length||J(e,c,t.holes,()=>o.landingY,m,f,a.tierWall,Q);let M={tread:[f[0]*Q.top,f[1]*Q.top,f[2]*Q.top],riser:[f[0]*.72,f[1]*.72,f[2]*.72]};for(let x of d.length?d:[c])jn(e,o.rowLevels,n.focal,o.landingY,M,x,p);return}let l=o.flat?1/0:Hn,b=p=>o.normalAt(p.x,p.y),h=o.flat?o.landingY:void 0;for(let p of i.subtract(c,h))J(e,p,t.holes,u,m,f,a.tierWall,Q,l,b)}function es(e,t,n){let r=new Set;for(let s of e.objects)s.type==="section"&&r.add(s.id);let o=new Map;for(let s=0;s<t.length;s++){let a=n.seatOwner[s];if(!a||!r.has(a))continue;let m=n.bySection.get(a);if(m&&m.rowLevels.length>=2)continue;let f=t[s],u=o.get(a);u||(u=new Map,o.set(a,u));let d=f.rowId||`__seat-${s}`,c=u.get(d);c||(c={pts:[],levelM:0,n:0},u.set(d,c)),c.pts.push({x:f.x,y:f.y}),c.levelM+=n.seatDeckY(s),c.n++}let i=[];for(let s of e.objects){if(s.type!=="section")continue;let a=n.bySection.get(s.id);if(a&&a.rowLevels.length>=2){let f=a.rowLevels.filter(u=>!u.patch).map(u=>({pts:u.pts,levelM:u.y}));f.length>=2&&i.push({sectionId:s.id,rows:f});continue}let m=o.get(s.id);m&&i.push({sectionId:s.id,rows:[...m.values()].map(f=>({pts:f.pts,levelM:f.levelM/f.n}))})}return i}function uo(e,t,n,r,o,i,s=!0){let a=es(t,n,r);if(!a.length)return;let m=io(a,t.focal);m&&(e.setMaterial(0),ao(e,m,{bottomY:t.baseHeightM,colors:{bandTop:ie(o.tierTop,.8),bandWall:o.tierWall,shellTop:i??ie(o.tierWall,1.15),shellWall:i??o.tierWall},ao:Q,shapes:t.objects.filter(f=>f.type==="shape"),deriveShell:s}))}var lo=/^[\p{L}\p{N}]{1,4}$/u,ts=/^([\p{L}\p{N}]{2,})[\s\-\u2013\u2014\u00b7_./]+(.+)$/u;function fo(e,t){let n=t?.trim();if(!n)return e;let r=e.toLocaleLowerCase("en-US"),o=n.toLocaleLowerCase("en-US");if(r.startsWith(`${o} `)){let s=e.slice(n.length).trim();if(lo.test(s))return s}let i=ts.exec(e);if(i){let s=i[1].toLocaleLowerCase("en-US"),a=i[2].trim();if((o.startsWith(s)||s.startsWith(o))&&lo.test(a))return a}return e}var ns=6,os=2.2,mo=.1,rs=.3,is=1.8,ss=.9,as=.55,cs=6e3;function bo(e){let{doc:t,units:n,seats:r,surfaces:o,focal:i}=e,s=t.zones??[],a=[];if(s.length){let m=new Map;for(let u of n)for(let d of u.objects)d.type==="section"&&d.zone&&m.set(d.id,d.zone);let f=new Map;for(let u=0;u<r.length;u++){let d=r[u],c=o.seatOwner[u],l=d.zoneId??(c?m.get(c):void 0);if(!l)continue;let b=f.get(l);b||(b={n:0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0,sumY:0},f.set(l,b)),b.n++,d.x<b.minX&&(b.minX=d.x),d.y<b.minY&&(b.minY=d.y),d.x>b.maxX&&(b.maxX=d.x),d.y>b.maxY&&(b.maxY=d.y),b.sumY+=o.seatDeckY(u)}for(let u of s){let d=f.get(u.id),c=[];for(let[l,b]of m)b===u.id&&c.push(l);if(!d||d.n===0){a.push({id:u.id,label:u.label,color:W(u.color),sectionIds:c,seatCount:0,center:[0,0,0],radius:0,focalWorld:[(u.focalPoint??i).x*R,1.5,(u.focalPoint??i).y*R]});continue}a.push({id:u.id,label:u.label,color:W(u.color),sectionIds:c,seatCount:d.n,center:[(d.minX+d.maxX)/2*R,d.sumY/d.n,(d.minY+d.maxY)/2*R],radius:.5*Math.hypot((d.maxX-d.minX)*R,(d.maxY-d.minY)*R)||1,focalWorld:[(u.focalPoint??i).x*R,1.5,(u.focalPoint??i).y*R]})}}return a}function po(e){let{doc:t,units:n,seats:r,surfaces:o,seatData:i,hintedSeatFloor:s,zones:a,focal:m}=e,f=[],u=[],d=[];for(let c of a)c.seatCount!==0&&f.push({id:`zone:${c.id}`,kind:"zone",text:c.label,anchor:[c.center[0],c.center[1]+ns,c.center[2]],color:t.zones?.find(l=>l.id===c.id)?.color});{let c=new Map,l=new Map;for(let b=0;b<r.length;b++){let h=o.seatOwner[b];if(!h)continue;let p=c.get(h);p||(p={n:0,x:0,y:0,deck:0},c.set(h,p)),p.n++,p.x+=r[b].x,p.y+=r[b].y,p.deck+=o.seatDeckY(b);let y=l.get(h);y||(y={minX:1/0,maxX:-1/0,minY:1/0,maxY:-1/0},l.set(h,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 n)for(let h of b.objects){if(h.type!=="section")continue;let p=c.get(h.id);if(!p||p.n===0)continue;let y=l.get(h.id),g=[p.x/p.n*R,p.deck/p.n,p.y/p.n*R],M=h.displayLabel||h.label||h.id;u.push({id:h.id,floorIndex:b.index,label:M,seatCount:p.n,center:g,radius:Math.max(1,Math.hypot(y.maxX-y.minX,y.maxY-y.minY)*.5*R),focalWorld:[b.focal.x*R,b.baseHeightM+1.5,b.focal.y*R]});let x=t.floors?.[b.index]?.name?.trim().toLocaleLowerCase();n.length>1&&x===M.trim().toLocaleLowerCase()||f.push({id:`section:${h.id}`,kind:"section",text:M,anchor:[g[0],g[1]+os,g[2]],floorIndex:b.index})}}{for(let h of n)for(let p of h.objects){if(p.type!=="gaArea")continue;let y=_e(p.points);if(!y)continue;let g=p.displayLabel||p.label||p.id;f.push({id:`ga:${p.id}`,kind:"ga",text:p.capacity>0?`${g} \xB7 ${p.capacity.toLocaleString()}`:g,anchor:[y.x*R,h.baseHeightM+is,y.y*R],floorIndex:h.index})}let c=new Map;for(let h of n)for(let p of h.objects)p.type==="section"&&c.set(p.id,p.displayLabel||p.label||p.id);let l=new Map;for(let h=0;h<r.length;h++){let p=r[h],y=Math.hypot(p.x-m.x,p.y-m.y),g=l.get(p.rowId);(!g||y>g.far)&&l.set(p.rowId,{seat:p,index:h,far:y})}for(let[h,p]of l){let y=ls(p.seat.label,h,c.get(p.seat.sectionId??""));y&&f.push({id:`row:${h}`,kind:"row",text:y,anchor:[p.seat.x*R,o.seatDeckY(p.index)+ss,p.seat.y*R],floorIndex:s[p.index]})}let b=new Map;for(let h=0;h<r.length;h++){let p=r[h],y=p.label?p.label.lastIndexOf("-"):-1,g=b.get(p.rowId);g||(g={n:0,x:0,y:0,z:0,minX:1/0,maxX:-1/0,minZ:1/0,maxZ:-1/0,label:y>0?p.label.slice(0,y):p.rowId,sectionId:p.sectionId},b.set(p.rowId,g));let M=h*3,x=i.iPosition[M],A=i.iPosition[M+1],S=i.iPosition[M+2];g.n++,g.x+=x,g.y+=A,g.z+=S,g.minX=Math.min(g.minX,x),g.maxX=Math.max(g.maxX,x),g.minZ=Math.min(g.minZ,S),g.maxZ=Math.max(g.maxZ,S)}for(let[h,p]of b)d.push({id:h,label:p.label,sectionId:p.sectionId,seatCount:p.n,center:[p.x/p.n,p.y/p.n,p.z/p.n],radius:Math.max(.8,Math.hypot(p.maxX-p.minX,p.maxZ-p.minZ)*.5)});if(r.length<=cs)for(let h=0;h<r.length;h++){let p=r[h],y=us(p.displayLabel||p.label);y&&f.push({id:`seat:${p.id}`,kind:"seat",text:y,anchor:[p.x*R,o.seatDeckY(h)+as,p.y*R],floorIndex:s[h]})}}for(let c of n)for(let l of c.objects)if(l.type==="shape"&&l.role&&["entrance","exit","screen","suite","obstruction"].includes(l.role)){let b=ge(l),h=b?_e(b):null;if(!h||!l.label)continue;f.push({id:`architecture:${l.id}`,kind:"annotation",text:l.label,anchor:[h.x*R,c.baseHeightM+Ne(l).heightM+mo,h.y*R],color:l.fill,floorIndex:c.index})}else if(l.type==="text"){if(!l.text)continue;f.push({id:`text:${l.id}`,kind:"annotation",text:l.text,anchor:[l.position.x*R,c.baseHeightM+mo,l.position.y*R],color:l.color,rotation:l.rotation,floorIndex:c.index})}else if(l.type==="booth"){let b=Ge(l);if(!b)continue;let h=_e(b);if(!h)continue;f.push({id:`booth:${l.id}`,kind:"booth",text:l.displayLabel||l.label||l.id,anchor:[h.x*R,c.baseHeightM+Tt+rs,h.y*R],floorIndex:c.index})}return{labels:f,sections:u,rows:d}}function ho(e,t){if(t.length>1)for(let n of t)e.push({id:`floor:${n.id}`,kind:"floor",text:n.label,anchor:[n.center[0],n.box.max[1]+1.2,n.center[2]],floorIndex:n.index})}function us(e){let t=e.lastIndexOf("-");return t>=0&&t<e.length-1?e.slice(t+1):e}function ls(e,t,n){let r=e?e.lastIndexOf("-"):-1,o=r>0?e.slice(0,r):t;return o&&fo(o,n)}function yo(e){let{doc:t,units:n,seats:r,surfaces:o,solids:i,hintedSeatFloor:s,seatFloor:a}=e,m=[];{let f=n.map(()=>({minX:1/0,minY:1/0,minZ:1/0,maxX:-1/0,maxY:-1/0,maxZ:-1/0}));for(let c=0;c<i.floor.length;c+=1){let l=Math.max(0,Math.min(n.length-1,Math.round(i.floor[c]))),b=c*3,h=f[l];h.minX=Math.min(h.minX,i.position[b]),h.minY=Math.min(h.minY,i.position[b+1]),h.minZ=Math.min(h.minZ,i.position[b+2]),h.maxX=Math.max(h.maxX,i.position[b]),h.maxY=Math.max(h.maxY,i.position[b+1]),h.maxZ=Math.max(h.maxZ,i.position[b+2])}let u=new Map;for(let c=0;c<n.length;c++)for(let l of n[c].objects)l.type==="section"&&u.set(l.id,c);let d=n.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 c=0;c<r.length;c++){let l=o.seatOwner[c],b=(l!==null?u.get(l):void 0)??s[c];if(b===void 0)continue;let h=d[b],p=r[c];h.n++,p.x<h.minX&&(h.minX=p.x),p.y<h.minY&&(h.minY=p.y),p.x>h.maxX&&(h.maxX=p.x),p.y>h.maxY&&(h.maxY=p.y);let y=o.seatDeckY(c);h.sumX+=p.x*R,h.sumDeck+=y,h.sumZ+=p.y*R,h.minDeck=Math.min(h.minDeck,y),h.maxDeck=Math.max(h.maxDeck,y+1.6),a[c]=b}for(let c=0;c<n.length;c++){let l=d[c],b=t.floors?.[c],h=f[c],p=Math.min(l.n?l.minX*R:n[c].focal.x*R-1,Number.isFinite(h.minX)?h.minX:1/0),y=Math.max(l.n?l.maxX*R:n[c].focal.x*R+1,Number.isFinite(h.maxX)?h.maxX:-1/0),g=Math.min(l.n?l.minY*R:n[c].focal.y*R-1,Number.isFinite(h.minZ)?h.minZ:1/0),M=Math.max(l.n?l.maxY*R:n[c].focal.y*R+1,Number.isFinite(h.maxZ)?h.maxZ:-1/0),x=Math.min(l.n?Math.min(n[c].baseHeightM,l.minDeck):n[c].baseHeightM,Number.isFinite(h.minY)?h.minY:1/0),A=Math.max(l.n?Math.max(l.maxDeck,x+.5):x+.5,Number.isFinite(h.maxY)?h.maxY:-1/0),S=[l.n?l.sumX/l.n:(p+y)/2,l.n?l.sumDeck/l.n:(x+A)/2,l.n?l.sumZ/l.n:(g+M)/2],v=Math.max(1,.5*Math.hypot(y-p,A-x,M-g));m.push({index:c,id:b?.id??`floor-${c}`,label:b?.name??(n.length>1?`Floor ${c+1}`:"Venue"),seatCount:l.n,center:S,radius:v,box:{min:[p,x,g],max:[y,A,M]},focalWorld:[n[c].focal.x*R,n[c].baseHeightM+1.5,n[c].focal.y*R]})}}return m}function Bt(e,t){let n=1/0,r=1/0,o=-1/0,i=-1/0,s=(a,m)=>{a<n&&(n=a),m<r&&(r=m),a>o&&(o=a),m>i&&(i=m)};for(let a of t)s(a.x,a.y);for(let a of e)for(let m of a.objects)if(m.type==="section")for(let f of m.outline)s(f.x,f.y);else if(m.type==="shape"&&m.points)for(let f of m.points)s(f.x,f.y);else if(m.type==="gaArea")for(let f of m.points)s(f.x,f.y);else if(m.type==="booth"){let f=Ge(m);if(f)for(let u of f)s(u.x,u.y)}else if(m.type==="table"){let f=Lt(m);if(f)for(let u of f)s(u.x,u.y)}else if(m.type==="decorImage"){let f=Ot(m);if(f)for(let u of f)s(u.x,u.y)}return Number.isFinite(n)||(n=-100,r=-100,o=100,i=100),{minX:n,minY:r,maxX:o,maxY:i}}function go(e,t,n,r,o,i){if(t.length===1){let s=Math.max(60,(o.maxX-o.minX+o.maxY-o.minY)*.06),a=De(o.minX-s,o.minY-s,o.maxX-o.minX+s*2,o.maxY-o.minY+s*2);J(e,a,void 0,()=>0,-.4,i.ground,i.ground,Q)}else{let s=t.reduce((l,b)=>b.baseHeightM<l.baseHeightM?b:l);e.setFloor(s.index);let a=n.filter((l,b)=>r[b]===s.index),m=Bt([s],a),f=Math.hypot(m.maxX-m.minX,m.maxY-m.minY),u=Math.max(28,Math.min(80,f*.04)),d=De(m.minX-u,m.minY-u,m.maxX-m.minX+u*2,m.maxY-m.minY+u*2),c=s.baseHeightM-.03;J(e,d,void 0,()=>c,c-.22,i.ground,i.ground,Q)}}function xo(e,t,n){let{cx:r,cz:o,radius:i}=n,s=1/0,a=1/0,m=1/0,f=-1/0,u=-1/0,d=-1/0,c=(h,p,y)=>{s=Math.min(s,h),f=Math.max(f,h),a=Math.min(a,p),u=Math.max(u,p),m=Math.min(m,y),d=Math.max(d,y)};for(let h=0;h<e.position.length;h+=3)c(e.position[h],e.position[h+1],e.position[h+2]);for(let h=0;h<t.count;h++){let p=h*3,y=t.iPosition[p],g=t.iPosition[p+1],M=t.iPosition[p+2],x=Math.max(.35,t.iMaxRadius[h]??.35);c(y-x,g,M-x),c(y+x,g+1.6,M+x)}Number.isFinite(s)||(s=r-i,f=r+i,a=0,u=i*.16,m=o-i,d=o+i);let l=[(s+f)/2,(a+u)/2,(m+d)/2],b=Math.max(1,.5*Math.hypot(f-s,u-a,d-m));return{center:l,radius:b,minY:a,maxY:u}}function Mo(e,t,n,r,o,i){let s=1/0,a=1/0,m=-1/0,f=-1/0;for(let x=0;x<e.count;x++){let A=x*3,S=e.iPosition[A],v=e.iPosition[A+2];S<s&&(s=S),S>m&&(m=S),v<a&&(a=v),v>f&&(f=v)}for(let x of t)s=Math.min(s,x.cx-x.halfX),m=Math.max(m,x.cx+x.halfX),a=Math.min(a,x.cz-x.halfZ),f=Math.max(f,x.cz+x.halfZ);let u=n.minX*R,d=n.maxX*R,c=n.minY*R,l=n.maxY*R,b=u,h=d,p=c,y=l;if(Number.isFinite(s)){let x=Math.max(2,.06*Math.hypot(m-s,f-a));b=Math.max(u,s-x),h=Math.min(d,m+x),p=Math.max(c,a-x),y=Math.min(l,f+x)}let g=Math.min(0,r),M=Math.max(o,i*.05);return{min:[b,g,p],max:[h,M,y]}}function So(e,t,n){let r=()=>({byObjectId:new Map,elements:[]});if(!t||!e)return r();let o=$t(t);if(!o.ok||o.value.id!==e)return r();let i=new Map;for(let d of n)for(let c of d.objects)c.type==="shape"&&i.set(c.id,{shape:c,unit:d});let s=new Set,a=new Set,m=new Map((t.overlay.productionElements??[]).map(d=>{let c=d.runtimeContentImageUrl;return[d.id,typeof c=="string"&&/^(?:blob:|data:image\/|https:\/\/)/.test(c)?c:void 0]})),f=[];for(let d of o.value.overlay.productionElements??[]){let c=i.get(d.objectId),l=c?ge(c.shape):null,b=d.baseElevationM??0;if(!c||!l||l.length<3||!d.id||s.has(d.id)||a.has(d.objectId)||!Number.isFinite(d.heightM)||d.heightM<.05||d.heightM>50||!Number.isFinite(b)||b<-10||b>100)return r();s.add(d.id),a.add(d.objectId);let h=l.map(_=>_.x*R),p=l.map(_=>_.y*R),y=c.unit.baseHeightM+b,g=Math.min(...h),M=Math.max(...h),x=Math.min(...p),A=Math.max(...p),S,v=m.get(d.id)??d.contentImageUrl;if(d.kind==="screen"&&v)if(M-g>=A-x){let _=Math.abs(x-c.unit.focal.y*R)<=Math.abs(A-c.unit.focal.y*R)?x-.006:A+.006;S=[[g,y,_],[M,y,_],[g,y+d.heightM,_],[M,y+d.heightM,_]]}else{let _=Math.abs(g-c.unit.focal.x*R)<=Math.abs(M-c.unit.focal.x*R)?g-.006:M+.006;S=[[_,y,x],[_,y,A],[_,y+d.heightM,x],[_,y+d.heightM,A]]}f.push({id:d.id,objectId:d.objectId,kind:d.kind,floorIndex:c.unit.index,baseY:y,topY:y+d.heightM,bounds:{min:[g,y,x],max:[M,y+d.heightM,A]},occlusion:d.occlusion,...v?{contentImageUrl:v}:{},...S?{contentPlane:S}:{}})}let u=f.sort((d,c)=>d.id.localeCompare(c.id));return{byObjectId:new Map(u.map(d=>[d.objectId,d])),elements:u}}function re(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function oe(e){return Array.isArray(e)?e:[]}function fs(e){let t=[e];for(;t.length;){let n=t.pop();if(Array.isArray(n)){t.push(...n);continue}if(!re(n))continue;let r=re(n.extensions)?n.extensions:null;if(r&&Object.prototype.hasOwnProperty.call(r,"KHR_draco_mesh_compression"))return!0;t.push(...Object.values(n))}return!1}function ut(e,t){return!Array.isArray(e)||e.length!==t||!e.every(n=>typeof n=="number"&&Number.isFinite(n))?null:e}function ms(){return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}function ds(e,t){let n=new Array(16).fill(0);for(let r=0;r<4;r++)for(let o=0;o<4;o++)for(let i=0;i<4;i++)n[r*4+o]+=e[i*4+o]*t[r*4+i];return n}function bs(e){let t=ut(e.matrix,16);if(t)return t;if(e.matrix!==void 0)return null;let n=e.translation===void 0?[0,0,0]:ut(e.translation,3),r=e.rotation===void 0?[0,0,0,1]:ut(e.rotation,4),o=e.scale===void 0?[1,1,1]:ut(e.scale,3);if(!n||!r||!o)return null;let[i,s,a,m]=r,f=Math.hypot(i,s,a,m);if(!(f>1e-8))return null;let u=i/f,d=s/f,c=a/f,l=m/f,b=u+u,h=d+d,p=c+c,y=u*b,g=u*h,M=u*p,x=d*h,A=d*p,S=c*p,v=l*b,_=l*h,D=l*p;return[(1-(x+S))*o[0],(g+D)*o[0],(M-_)*o[0],0,(g-D)*o[1],(1-(y+S))*o[1],(A+v)*o[1],0,(M+_)*o[2],(A-v)*o[2],(1-(y+x))*o[2],0,n[0],n[1],n[2],1]}function ps(e,t,n,r){return[e[0]*t+e[4]*n+e[8]*r+e[12],e[1]*t+e[5]*n+e[9]*r+e[13],e[2]*t+e[6]*n+e[10]*r+e[14]]}function hs(e){let t=e[0],n=e[4],r=e[8],o=e[1],i=e[5],s=e[9],a=e[2],m=e[6],f=e[10],u=i*f-s*m,d=s*a-o*f,c=o*m-i*a,l=t*u+n*d+r*c;if(Math.abs(l)<1e-12)return null;let b=1/l;return[u*b,d*b,c*b,(r*m-n*f)*b,(t*f-r*a)*b,(n*a-t*m)*b,(n*s-r*i)*b,(r*o-t*s)*b,(t*i-n*o)*b]}function wo(e,t,n,r){let o=e[0]*t+e[1]*n+e[2]*r,i=e[3]*t+e[4]*n+e[5]*r,s=e[6]*t+e[7]*n+e[8]*r,a=Math.hypot(o,i,s)||1;return o/=a,i/=a,s/=a,[o,i,s]}function ys(e){if(e.byteLength<20||e.byteLength>8388608)return null;let t=new DataView(e.buffer,e.byteOffset,e.byteLength);if(t.getUint32(0,!0)!==1179937895||t.getUint32(4,!0)!==2||t.getUint32(8,!0)!==e.byteLength)return null;let n=12,r=null,o=null;for(;n+8<=e.byteLength;){let i=t.getUint32(n,!0),s=t.getUint32(n+4,!0);if(n+=8,i%4!==0||n+i>e.byteLength)return null;let a=e.subarray(n,n+i);if(s===1313821514&&!r)try{let m=JSON.parse(new TextDecoder().decode(a).replace(/[\u0000 ]+$/g,""));if(!re(m))return null;r=m}catch{return null}else if(s===5130562&&!o)o=a;else return null;n+=i}return n===e.byteLength&&r&&o?{json:r,bin:o}:null}function gs(e){return e===5120||e===5121?1:e===5122||e===5123?2:e===5125||e===5126?4:0}function xs(e){return e==="SCALAR"?1:e==="VEC2"?2:e==="VEC3"?3:e==="VEC4"?4:0}function Ms(e,t,n){return n===5120?e.getInt8(t):n===5121?e.getUint8(t):n===5122?e.getInt16(t,!0):n===5123?e.getUint16(t,!0):n===5125?e.getUint32(t,!0):e.getFloat32(t,!0)}function Ss(e){let t=e instanceof Uint8Array?e:new Uint8Array(e),n=ys(t);if(!n)return{ok:!1,issue:"invalid_glb"};let{json:r,bin:o}=n;if(!re(r.asset)||r.asset.version!=="2.0")return{ok:!1,issue:"unsupported_glb"};let i=oe(r.extensionsUsed).filter(x=>typeof x=="string");if(i.includes("KHR_draco_mesh_compression")||fs(r))return{ok:!1,issue:"draco_not_allowed"};if(i.length||oe(r.extensionsRequired).length)return{ok:!1,issue:"unsupported_glb"};if(oe(r.images).length||oe(r.textures).length)return{ok:!1,issue:"external_resource"};let s=oe(r.buffers);if(s.length!==1||!re(s[0])||s[0].uri!==void 0||typeof s[0].byteLength!="number"||!Number.isInteger(s[0].byteLength)||s[0].byteLength<0||s[0].byteLength>o.byteLength)return{ok:!1,issue:"external_resource"};let a=oe(r.accessors),m=oe(r.bufferViews),f=oe(r.meshes),u=oe(r.nodes),d=oe(r.scenes),c=typeof r.scene=="number"?r.scene:0;if(!re(d[c]))return{ok:!1,issue:"unsupported_glb"};let l=new DataView(o.buffer,o.byteOffset,o.byteLength),b=(x,A,S)=>{if(typeof x!="number"||!Number.isInteger(x)||!re(a[x]))return null;let v=a[x];if(v.type!==A||v.sparse!==void 0||v.normalized===!0||typeof v.count!="number"||!Number.isInteger(v.count)||v.count<1||typeof v.componentType!="number"||!S.includes(v.componentType)||typeof v.bufferView!="number")return null;let _=m[v.bufferView];if(!re(_)||_.buffer!==0||typeof _.byteLength!="number"||!Number.isInteger(_.byteLength)||_.byteLength<0)return null;let D=xs(v.type),N=gs(v.componentType),G=typeof _.byteStride=="number"?_.byteStride:D*N,C=typeof _.byteOffset=="number"?_.byteOffset:0,w=typeof v.byteOffset=="number"?v.byteOffset:0,k=C+w,B=w+(v.count-1)*G+D*N;if(!Number.isInteger(G)||!Number.isInteger(C)||!Number.isInteger(w)||G<D*N||C<0||w<0||C+_.byteLength>o.byteLength||B>_.byteLength)return null;let I=[];for(let T=0;T<v.count;T++){let P=[];for(let E=0;E<D;E++){let L=Ms(l,k+T*G+E*N,v.componentType);if(!Number.isFinite(L))return null;P.push(L)}I.push(P)}return I},h=[],p=[],y=0,g=new Set,M=(x,A)=>{if(typeof x!="number"||!Number.isInteger(x)||!re(u[x])||g.has(x))return!1;g.add(x);let S=u[x],v=bs(S);if(!v)return!1;let _=ds(A,v),D=hs(_);if(!D)return!1;if(S.mesh!==void 0){if(typeof S.mesh!="number")return!1;let N=f[S.mesh];if(!re(N))return!1;for(let G of oe(N.primitives)){if(!re(G)||G.mode!==void 0&&G.mode!==4||!re(G.attributes))return!1;let C=b(G.attributes.POSITION,"VEC3",[5126]),w=G.attributes.NORMAL===void 0?null:b(G.attributes.NORMAL,"VEC3",[5126]);if(!C||G.attributes.NORMAL!==void 0&&!w)return!1;let k=C.length;if(G.indices!==void 0){let I=typeof G.indices=="number"?a[G.indices]:null;k=re(I)?I.count:void 0}if(typeof k!="number"||!Number.isInteger(k)||k%3!==0||(y+=k/3,y>1e5))return!1;let B=G.indices===void 0?C.map((I,T)=>[T]):b(G.indices,"SCALAR",[5121,5123,5125]);if(!B||B.length%3!==0||B.length!==k)return!1;for(let I=0;I<B.length;I+=3){let T=[B[I][0],B[I+1][0],B[I+2][0]];if(T.some(L=>!Number.isInteger(L)||L<0||L>=C.length))return!1;let P=T.map(L=>ps(_,...C[L])),E=null;if(!w){let L=P[1][0]-P[0][0],F=P[1][1]-P[0][1],j=P[1][2]-P[0][2],Y=P[2][0]-P[0][0],U=P[2][1]-P[0][1],X=P[2][2]-P[0][2];E=wo([1,0,0,0,1,0,0,0,1],F*X-j*U,j*Y-L*X,L*U-F*Y)}for(let L=0;L<3;L++)h.push(...P[L]),p.push(...w?wo(D,...w[T[L]]):E)}}}for(let N of oe(S.children))if(!M(N,_))return!1;return g.delete(x),!0};for(let x of oe(d[c].nodes))if(!M(x,ms()))return{ok:!1,issue:y>1e5?"triangle_limit":"unsupported_glb"};return!y||h.length!==y*9||p.length!==h.length?{ok:!1,issue:"unsupported_glb"}:{ok:!0,triangleCount:y,position:new Float32Array(h),normal:new Float32Array(p)}}function Io(e){try{return Ss(e)}catch{return{ok:!1,issue:"invalid_glb"}}}function vo(e){let{doc:t}=e,n=mn(t.theme),r=n.structure,o=Yn(t,e.eventConfigurationId??t.eventConfigurationId),i=So(e.eventConfigurationId,e.eventConfiguration,o),s=e.seats,a=new Je,m=null;if(e.registeredShellGlb){let I=Io(e.registeredShellGlb);if(I.ok){let T=I.position.length/3,P=new Float32Array(I.position.length),E=n.materials.shell??r.tierWall;for(let L=0;L<T;L++){let F=I.normal[L*3+1],j=F<-.25?.4:.62+.38*Math.max(0,F);P[L*3]=E[0]*j,P[L*3+1]=E[1]*j,P[L*3+2]=E[2]*j}m={position:I.position,normal:I.normal,color:P,floor:new Float32Array(T).fill(-2),material:new Float32Array(T),count:T}}}let f=new Map;for(let I of o)for(let T of I.objects)f.set(T.id,I.index),T.type==="section"&&f.set(T.logicalSectionId??T.id,I.index);let u=s.map(I=>f.get(I.sectionId??"")??f.get(I.rowId??"")??0),d=Bt(o,s);go(a,o,s,u,d,r);let c=zn(t,s),l=new Map,b=new Map;for(let I of t.categories??[])l.set(I.key,I.color),I.seatGlyph&&b.set(I.key,I.seatGlyph);let h=[],p=Kn(o,s,u),y=new Float32Array(s.length),g=[];for(let I=0;I<o.length;I++){let T=o[I];a.setFloor(I);let P=new st,E=[],L=T.objects.filter(F=>F.type==="section"&&!!F.outline&&F.outline.length>=3);for(let F of T.objects)if(F.type==="section"){let j=a.vertexCount;co(a,F,T,Wn(F,c),p.bySection.get(F.id),P,L,r);let Y=a.vertexCount-j;Y>0&&g.push({sectionId:F.id,start:j,count:Y})}else if(F.type==="shape"){let j=i.byObjectId.get(F.id);a.setMaterial((j?.kind??F.role)==="screen"?1:0),to(a,F,T.baseHeightM,$n(F,E),r,T.focal,h,j),a.setMaterial(0)}else F.type==="gaArea"?oo(a,F,T.baseHeightM,W(l.get(F.categoryKey)),r):F.type==="booth"?Jn(a,F,T.baseHeightM,W(l.get(F.categoryKey)),r):F.type==="table"?eo(a,F,T.baseHeightM,W(F.fill??t.theme?.decorFill??"#232c40"),r):F.type==="decorImage"&&no(a,F,T.baseHeightM,r);uo(a,T,s,p,r,n.materials.shell,!m)}let M=o.length>1?{x:o.reduce((I,T)=>I+T.focal.x,0)/o.length,y:o.reduce((I,T)=>I+T.focal.y,0)/o.length}:t.focalPoint??{x:(d.minX+d.maxX)/2,y:(d.minY+d.maxY)/2},x=yn(m?[a.build(),m]:[a.build()]),A=Cn(s,e.initialState,p,y,l,b),S=bo({doc:t,units:o,seats:s,surfaces:p,focal:M}),{labels:v,sections:_,rows:D}=po({doc:t,units:o,seats:s,surfaces:p,seatData:A,hintedSeatFloor:u,zones:S,focal:M}),N=yo({doc:t,units:o,seats:s,surfaces:p,solids:x,hintedSeatFloor:u,seatFloor:y});ho(v,N),A.iYaw=Rn(A.iPosition,s.length,I=>s[I].rowId,I=>{let T=o[y[I]]?.focal??M;return[T.x*R,T.y*R]});let G=(d.minX+d.maxX)/2*R,C=(d.minY+d.maxY)/2*R,w=.5*Math.hypot((d.maxX-d.minX)*R,(d.maxY-d.minY)*R)||10,k=xo(x,A,{cx:G,cz:C,radius:w}),B=Mo(A,h,d,k.minY,k.maxY,w);return{solids:x,sectionSolidRanges:g,seats:A,bounds:{center:[(B.min[0]+B.max[0])/2,(B.min[1]+B.max[1])/2,(B.min[2]+B.max[2])/2],radius:w,groundY:0,box:B},renderBounds:{center:k.center,radius:k.radius},stateColorLUT:dn(n,$e),theme:n,seatCount:s.length,focalWorld:[M.x*R,1.5,M.y*R],zones:S,stages:h,productionElements:i.elements,sections:_,rows:D,labels:v,floors:N}}function ws(e){return[e.solids.position,e.solids.normal,e.solids.color,e.solids.floor,e.solids.material,e.seats.iPosition,e.seats.iState,e.seats.iCategory,e.seats.iMaxRadius,e.seats.iRing,e.seats.iFloor,e.seats.iYaw,e.seats.iChairWidth,e.seats.iGlyph,e.seats.iPhysicalSeat].map(n=>n.buffer)}var Ro=self;Ro.onmessage=e=>{let t=performance.now(),n=!e.data.seats,r=e.data.seats??cn(e.data.doc),o=vo({doc:e.data.doc,seats:r,eventConfigurationId:e.data.eventConfigurationId,eventConfiguration:e.data.eventConfiguration,registeredShellGlb:e.data.registeredShellGlb});Ro.postMessage({model:o,buildMs:performance.now()-t,...n?{seats:r}:{}},ws(o))};
|
|
1
|
+
"use strict";var Po=Object.create;var Dt=Object.defineProperty;var Eo=Object.getOwnPropertyDescriptor;var Ao=Object.getOwnPropertyNames;var _o=Object.getPrototypeOf,ko=Object.prototype.hasOwnProperty;var To=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Ao(t))!ko.call(e,o)&&o!==n&&Dt(e,o,{get:()=>t[o],enumerable:!(r=Eo(t,o))||r.enumerable});return e};var Ie=(e,t,n)=>(n=e!=null?Po(_o(e)):{},To(t||!e||!e.__esModule?Dt(n,"default",{value:e,enumerable:!0}):n,e));var vs=Math.PI/180;function dt(e){let t=0,n=0;for(let o of e)t+=o.x,n+=o.y;let r=e.length||1;return{x:t/r,y:n/r}}function _e(e){return e.length?dt(e):null}function Nt(e,t){let n=1-t,r=n*n*n,o=3*n*n*t,i=3*n*t*t,s=t*t*t;return{x:r*e.start.x+o*e.control1.x+i*e.control2.x+s*e.end.x,y:r*e.start.y+o*e.control1.y+i*e.control2.y+s*e.end.y}}function jt(e,t,n=192){if(!Number.isInteger(t)||t<1)throw new Error("Path point count must be a positive integer");if(t===1)return[Nt(e,.5)];let r=Array.from({length:n+1},(m,u)=>Nt(e,u/n)),o=new Float64Array(r.length);for(let m=1;m<r.length;m+=1){let u=r[m].x-r[m-1].x,l=r[m].y-r[m-1].y;o[m]=o[m-1]+Math.hypot(u,l)}let i=o[o.length-1];if(i<=1e-9)return Array.from({length:t},()=>({...e.start}));let s=[],a=1;for(let m=0;m<t;m+=1){let u=i*m/(t-1);for(;a<o.length-1&&o[a]<u;)a+=1;let l=o[a-1],d=o[a],c=d===l?0:(u-l)/(d-l);s.push({x:r[a-1].x+(r[a].x-r[a-1].x)*c,y:r[a-1].y+(r[a].y-r[a-1].y)*c})}return s}function Gt(e,t,n){return Math.max(t,Math.min(n,e))}function Ut(e){let t=new Map,n=new Map;for(let r of e){if(r.type!=="row"||!r.segmentedRow)continue;let o=n.get(r.segmentedRow.groupId)??[];o.push(r),n.set(r.segmentedRow.groupId,o)}for(let[r,o]of n){let i=o.slice().sort((c,f)=>c.segmentedRow.componentIndex-f.segmentedRow.componentIndex),s=i[0]?.segmentedRow?.componentCount??0,a=i[0]?.segmentedRow;if(!a||!(s>=2&&i.length===s&&a?.boundaryBefore==="start"&&i.every((c,f)=>c.segmentedRow?.kind==="segmented-row-v1"&&c.segmentedRow.groupId===r&&c.segmentedRow.componentCount===s&&c.segmentedRow.componentIndex===f&&c.segmentedRow.repeatLabelOnComponents===a.repeatLabelOnComponents&&(f===0?c.segmentedRow.boundaryBefore==="start":c.segmentedRow.boundaryBefore!=="start")&&c.segmentedRow.displayLabel===a.displayLabel)))continue;let u=i.reduce((c,f)=>c+f.seatCount,0),l=0,d=0;for(let c of i)c.segmentedRow.boundaryBefore==="break"&&(l+=1),t.set(c.id,{groupId:r,adjacencyOffset:l,displayOffset:d,displayLabel:a.displayLabel,totalSeats:u,canonical:i[0],viewFromSeatUrl:a.viewFromSeatUrl,viewFromSeatMeta:a.viewFromSeatMeta,confidenceEvidence:a.confidenceEvidence}),l+=c.seatCount,d+=c.seatCount}return t}var Lo="ABCDEFGHIJKLMNOPQRSTUVWXYZ";var Oo="abcdefghijklmnopqrstuvwxyz";function Bo(e,t){let n=t.length,r=e+1,o="";for(;r>0;){r-=1;let i=r%n;o=t[i]+o,r=Math.floor(r/n)}return o}function bt(e,t=!1){let n=t?Oo:Lo;return Bo(Math.max(0,Math.floor(e)-1),n)}var Fo=[[1e3,"M"],[900,"CM"],[500,"D"],[400,"CD"],[100,"C"],[90,"XC"],[50,"L"],[40,"XL"],[10,"X"],[9,"IX"],[5,"V"],[4,"IV"],[1,"I"]];function Yt(e){if(!Number.isFinite(e)||e<=0)return String(e);let t=Math.floor(e),n="";for(let[r,o]of Fo)for(;t>=r;)n+=o,t-=r;return n}function Do(e){let t=new Array(e);return Array.from({length:e},(n,r)=>r).sort((n,r)=>Math.abs(2*n-(e-1))-Math.abs(2*r-(e-1))||n-r).forEach((n,r)=>t[n]=r),t}function He(e,t){let n=e.seatLabelStart??1,r=e.seatNumbering?.direction??"ltr",o=e.seatNumbering?.step??1,i=e.seatNumbering?.scheme??"decimal",s=e.seatNumbering?.prefix??"",a=e.seatNumbering?.endAt,m=e.seatCount;if(i==="updown"||i==="updown-descending"){let f=Math.ceil(m/2),b=i==="updown"?t<f?n+2*t:n-1+2*(m-t):t<f?n+2*(f-1-t):n+1+2*(t-f);return`${s}${b}`}let u=i==="odd"||i==="even"?2:o,l=a!=null&&Number.isFinite(a)?a-(m-1)*u:n,d=r==="center"?Do(m)[t]:r==="rtl"?m-1-t:t,c;switch(i){case"odd":{let f=l%2===1?l:l+1;c=String(f+d*2);break}case"even":{let f=l%2===0?l:l+1;c=String(f+d*2);break}case"roman":c=Yt(l+d*o);break;case"letters-upper":c=bt(l+d*o,!1);break;case"letters-lower":c=bt(l+d*o,!0);break;default:c=String(l+d*o);break}return`${s}${c}`}function No(e){return{...e.canonical,seatCount:e.totalSeats,label:e.displayLabel,displayLabel:e.displayLabel}}function Xt(e,t,n){return n?.label??`${e.seatLabelBase??e.label}-${He(e,t)}`}function pt(e,t,n,r){if(r?.displayLabel)return r.displayLabel;if(e.seatDisplayLabelMode==="number")return He(e,t);if(!n)return`${e.displayLabel||e.label}-${He(e,t)}`;let o=No(n),i=n.displayOffset+t;return`${n.displayLabel}-${He(o,i)}`}var te=.02291666666666667,me=1/te,jo=58,Go=jo*te;var Uo=3,Vt=0,ht=120,Yo=0,Xo=45,Vo=7,ce=1.2;function yt(e,t,n,r){return Number.isFinite(e)?Math.max(t,Math.min(n,e)):r}function Ho(e){return!Number.isFinite(e)||!Number.isInteger(e)||e<0?0:e<=Vo?e:Uo}function Ke(e,t={}){let n=yt(t.floorBaseHeightM,Vt,ht,0),r=Math.min(ht,n+Ho(e.elevation)*Go),o=e.height===void 0?r:yt(e.height,Vt,ht,r),i=yt(e.rake,Yo,Xo,0);return{height:o,rake:i}}function Ht(e){let t=e.length;return t<=3?[...e]:[e[Math.floor(t*.25)],e[Math.floor(t*.5)],e[Math.floor(t*.75)]]}function ve(e,t,n){if(!e.length)return 1/0;if(e.length===1)return Math.hypot(t-e[0].x,n-e[0].y);let r=1/0;for(let o=0;o+1<e.length;o++){let i=e[o],s=e[o+1],a=s.x-i.x,m=s.y-i.y,u=a*a+m*m,l=u>1e-12?((t-i.x)*a+(n-i.y)*m)/u:0;l<0?l=0:l>1&&(l=1);let d=Math.hypot(t-(i.x+l*a),n-(i.y+l*m));d<r&&(r=d)}return r}function Ko(e){let t=0,n=0;for(let i of e)t+=i.x,n+=i.y;let r=e.length||1;t/=r,n/=r;let o=0;for(let i of e){let s=Math.hypot(i.x-t,i.y-n);s>o&&(o=s)}return{cx:t,cy:n,r:o}}function Kt(e,t){return Math.hypot(e.cx-t.cx,e.cy-t.cy)-e.r-t.r}function gt(e,t){let n=1/0;for(let r of Ht(e)){let o=ve(t,r.x,r.y);o<n&&(n=o)}for(let r of Ht(t)){let o=ve(e,r.x,r.y);o<n&&(n=o)}return n}function zo(e,t){if(e.length<3)return{pts:e,seatIndices:t};let n=0,r=0;for(let l of e)n+=l.x,r+=l.y;n/=e.length,r/=e.length;let o=-1,i=e[0];for(let l of e){let d=Math.hypot(l.x-n,l.y-r);d>o&&(o=d,i=l)}let s=i.x-n,a=i.y-r,m=Math.hypot(s,a);m>1e-9?(s/=m,a/=m):(s=1,a=0);let u=e.map((l,d)=>({p:l,i:d,t:(l.x-n)*s+(l.y-r)*a})).sort((l,d)=>l.t-d.t);return{pts:u.map(l=>l.p),seatIndices:u.map(l=>t[l.i])}}function xt(e){let t=e.length;if(t<3)return null;let n=0,r=0;for(let g of e)n+=g.x,r+=g.y;n/=t,r/=t;let o=0,i=0,s=0,a=0,m=0,u=0,l=0;for(let g of e){let M=g.x-n,x=g.y-r;o+=M*M,s+=x*x,i+=M*x,a+=M*M*M,m+=x*x*x,u+=M*x*x,l+=x*M*M}let d=o*s-i*i;if(Math.abs(d)<1e-9)return null;let c=(a+u)/2,f=(m+l)/2,b=(c*s-f*i)/d,h=(f*o-c*i)/d,p=b+n,y=h+r;return!Number.isFinite(p)||!Number.isFinite(y)?null:{cx:p,cy:y}}var Wo=.15;function Zo(e){if(e.length<2)return null;let t=e.map(g=>{let M=0,x=0;for(let R of g.pts)M+=R.x,x+=R.y;return{x:M/g.pts.length,y:x/g.pts.length}}),n=0,r=0;for(let g of t)n+=g.x,r+=g.y;n/=t.length,r/=t.length;let o=0,i=0,s=0;for(let g of t){let M=g.x-n,x=g.y-r;o+=M*M,i+=M*x,s+=x*x}let a=o+s,m=o*s-i*i,u=a/2+Math.sqrt(Math.max(0,a*a/4-m)),l,d;Math.abs(i)>1e-12?(l=u-s,d=i):o>=s?(l=1,d=0):(l=0,d=1);let c=Math.hypot(l,d);if(!(c>1e-12))return null;l/=c,d/=c;let f=1/0,b=-1/0,h=[];for(let g of e){let M=1/0,x=-1/0;for(let R of g.pts){let S=R.x*l+R.y*d;S<M&&(M=S),S>x&&(x=S),S<f&&(f=S),S>b&&(b=S)}h.push(x-M)}let p=b-f;return p>1e-9?(h.sort((g,M)=>g-M),h[Math.min(h.length-1,Math.floor(h.length*.9))]/p<=$o?{x:l,y:d}:null):null}var $o=.35;function ze(e,t,n,r){let o=new Map;for(let p of n){let y=t[p],g=y.rowId||`__seat-${p}`,M=o.get(g);M||(M={pts:[],idx:[]},o.set(g,M)),M.pts.push({x:y.x,y:y.y}),M.idx.push(p)}if(!o.size)return{sectionId:e,rows:[],blockCount:0};let i=[];for(let[p,y]of o){let g=zo(y.pts,y.idx),M=0;for(let x of g.pts)M+=Math.hypot(x.x-r.x,x.y-r.y);i.push({id:p,pts:g.pts,seatIndices:g.seatIndices,blockId:-1,ordinal:0,blockDepth:0,focalDistance:M/g.pts.length})}let s=i.map(p=>Ko(p.pts)),a=[];for(let p=0;p<i.length;p++){let y=1/0;for(let g=0;g<i.length;g++){if(p===g||Kt(s[p],s[g])>=y)continue;let M=gt(i[p].pts,i[g].pts);M<y&&(y=M)}Number.isFinite(y)&&a.push(y)}a.sort((p,y)=>p-y);let m=a.length?a[Math.floor(a.length/2)]:1,u=Math.max(m*1.8,1e-6),l=i.map(()=>[]);for(let p=0;p<i.length;p++)for(let y=p+1;y<i.length;y++)Kt(s[p],s[y])>u||gt(i[p].pts,i[y].pts)<=u&&(l[p].push(y),l[y].push(p));let d=0;for(let p=0;p<i.length;p++){if(i[p].blockId!==-1)continue;let y=d++,g=[p];for(i[p].blockId=y;g.length;){let M=g.pop();for(let x of l[M])i[x].blockId===-1&&(i[x].blockId=y,g.push(x))}}let c=new Map;for(let p of i){let y=c.get(p.blockId)??[];y.push(p),c.set(p.blockId,y)}let f=[];for(let p of i){if(p.pts.length<4)continue;let y=xt(p.pts);y&&(!Number.isFinite(y.cx)||!Number.isFinite(y.cy)||f.push({x:y.cx,y:y.cy}))}let b=f.length>=2?(()=>{let p=f.map(M=>M.x).sort((M,x)=>M-x),y=f.map(M=>M.y).sort((M,x)=>M-x),g=Math.floor(f.length/2);return{cx:p[g],cy:y[g]}})():null;if(b){let p=S=>Math.hypot(S.x-b.cx,S.y-b.cy),y=1/0,g=-1/0,M=[];for(let S of i){let I=1/0,_=-1/0;for(let B of S.pts){let N=p(B);N<I&&(I=N),N>_&&(_=N)}M.push(_-I),I<y&&(y=I),_>g&&(g=_)}let x=g-y;M.sort((S,I)=>S-I);let R=M[Math.min(M.length-1,Math.floor(M.length*.9))];if(x>1e-9&&R/x<=Wo){let S=i.map(v=>{let T=0;for(let E of v.pts)T+=p(E);return{row:v,radius:T/v.pts.length}}),I=0,_=0;for(let v of S)I+=v.radius,_+=v.row.focalDistance;I/=S.length,_/=S.length;let B=0;for(let v of S)B+=(v.radius-I)*(v.row.focalDistance-_);if(B<0)for(let v of S)v.radius=-v.radius;let G=1/0;for(let v of S)v.radius<G&&(G=v.radius);S.sort((v,T)=>v.radius-T.radius);let P=-1,w=-1/0,k=x/Math.max(1,S.length)*.5,F=[];for(let v of S)v.radius-w>k&&(P++,w=v.radius),v.row.ordinal=P,v.row.blockDepth=v.radius-G,F.push(v.row);return{sectionId:e,rows:F,blockCount:d}}}let h=[];for(let[,p]of c){let y=Zo(p);if(y){let g=x=>{let R=0;for(let S of x.pts)R+=S.x*y.x+S.y*y.y;return R/x.pts.length};p.sort((x,R)=>g(x)-g(R)),p.length>=2&&p[0].focalDistance>p[p.length-1].focalDistance&&p.reverse();let M=0;for(let x=0;x<p.length;x++)x>0&&(M+=gt(p[x-1].pts,p[x].pts)),p[x].ordinal=x,p[x].blockDepth=M,h.push(p[x])}else{let g=1/0;for(let M of p)M.focalDistance<g&&(g=M.focalDistance);p.sort((M,x)=>M.focalDistance-x.focalDistance);for(let M=0;M<p.length;M++)p[M].ordinal=M,p[M].blockDepth=Math.max(0,p[M].focalDistance-g),h.push(p[M])}}return{sectionId:e,rows:h,blockCount:d}}var Qo=/^\d{4}-\d{2}-\d{2}$/;function qo(e){let t=Date.parse(e);return Number.isFinite(t)?Qo.test(e)?t+864e5:t:null}function Jo(e,t=Date.now()){if(e.validUntil===void 0){if(e.status!=="approved")return!0;let r=e.assessedAt?Date.parse(e.assessedAt):Number.NaN;return Number.isFinite(r)&&(t instanceof Date?t.getTime():t)<=r+366*864e5}let n=qo(e.validUntil);return n===null?!1:(t instanceof Date?t.getTime():t)<n}function er(e,t,n){return!(e.eventConfigurationId&&e.eventConfigurationId!==t||e.eventConfigurationVersion!==void 0&&e.eventConfigurationVersion!==n)}function tr(e){return e.status!=="draft"&&e.status!=="retracted"}function nr(e,t){return e.status===void 0?t===void 0:e.status!=="approved"?!0:typeof t=="string"&&typeof e.basisSha256=="string"&&e.basisSha256===t}function zt(e,t={}){return!!e&&tr(e)&&er(e,t.activeConfigurationId,t.activeConfigurationVersion)&&nr(e,t.activeBasisSha256)&&Jo(e,t.now)}var Bs=Math.PI*2;function We(e){return e==="pitch-football"||e==="rink-hockey"||e==="track-athletics"||e==="oval-cricket"}var or=/^data:image\/(?:png|jpe?g|webp|gif|avif);base64,[a-z0-9+/]+={0,2}$/i,rr=/[\s"'<>`\\]/;function ir(e){if(typeof e!="string"||!e||e.length>2e6||e!==e.trim())return!1;if(e.startsWith("data:"))return or.test(e);if(rr.test(e))return!1;try{let t=new URL(e);return t.protocol==="https:"&&!t.username&&!t.password}catch{return!1}}function Wt(e){let t=e.trim();return ir(t)?t:null}var Mt="seatlayer.event-configuration/1";var Re=100,sr=120,ar=1e5,cr=1e4,ur=/^[a-f0-9]{64}$/,lr=new Set(["stage","screen","barrier","camera_platform","sound_desk","rigging_truss"]);function ke(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function be(e,t){return typeof e=="string"&&e.length>=1&&e.length<=t&&e.normalize("NFKC").trim()===e}function fr(e){return typeof e=="number"&&Number.isInteger(e)&&e>0}function Zt(e){return!Array.isArray(e)||e.length>ar||!e.every(t=>be(t,Re))?null:[...new Set(e)].sort()}function mr(e){return!ke(e)||!be(e.chartId,Re)||!be(e.version,Re)||e.sha256!==void 0&&(typeof e.sha256!="string"||!ur.test(e.sha256))?null:{chartId:e.chartId,version:e.version,...typeof e.sha256=="string"?{sha256:e.sha256}:{}}}function St(e,t,n){return typeof e=="number"&&Number.isFinite(e)&&e>=t&&e<=n}function dr(e){return ke(e)?e.mode==="none"||e.mode==="opaque"?e.opacity===void 0?{mode:e.mode}:null:e.mode==="partial"&&St(e.opacity,.01,.99)?{mode:"partial",opacity:e.opacity}:null:null}function br(e,t){if(e===void 0)return;if(!Array.isArray(e)||e.length>cr)return null;let n=new Set(t),r=new Set,o=new Set,i=0,s=[];for(let a of e){if(!ke(a)||!be(a.id,Re)||!be(a.objectId,Re)||!n.has(a.objectId)||!lr.has(String(a.kind))||!St(a.heightM,.05,50)||a.baseElevationM!==void 0&&!St(a.baseElevationM,-10,100))return null;let m=dr(a.occlusion);if(!m||r.has(a.id)||o.has(a.objectId))return null;let u=a.contentImageUrl===void 0?void 0:typeof a.contentImageUrl=="string"?Wt(a.contentImageUrl):null;if(a.contentImageUrl!==void 0&&(!u||a.kind!=="screen"||++i>1))return null;r.add(a.id),o.add(a.objectId),s.push({id:a.id,objectId:a.objectId,kind:a.kind,heightM:a.heightM,...a.baseElevationM!==void 0?{baseElevationM:a.baseElevationM}:{},occlusion:m,...u?{contentImageUrl:u}:{}})}return s.sort((a,m)=>a.id.localeCompare(m.id))}function pr(e){let t=[];if(!ke(e))return{issues:[{code:"invalid_export",path:"configuration",message:"Configuration must be an object"}]};e.schema!==Mt&&t.push({code:"unsupported_schema",path:"configuration.schema",message:`Configuration schema must be ${Mt}`}),be(e.id,Re)||t.push({code:"invalid_id",path:"configuration.id",message:"Configuration id must contain 1 to 100 normalized characters"}),be(e.label,sr)||t.push({code:"invalid_label",path:"configuration.label",message:"Configuration label must contain 1 to 120 normalized characters"}),fr(e.version)||t.push({code:"invalid_version",path:"configuration.version",message:"Configuration version must be a positive integer"});let n=mr(e.baseVenue);n||t.push({code:"invalid_base_venue",path:"configuration.baseVenue",message:"Base venue must identify one normalized chart id and exact version"});let r=ke(e.overlay)?e.overlay:null,o=Zt(r?.objectIds),i=Zt(r?.productionKillSeatIds),s=o?br(r?.productionElements,o):null;return(!r||!o||!i)&&t.push({code:"invalid_overlay",path:"configuration.overlay",message:"Overlay ids must be bounded arrays of normalized stable ids"}),s===null&&t.push({code:"invalid_production_element",path:"configuration.overlay.productionElements",message:"Production elements must be unique, bounded semantics over referenced base-venue objects"}),t.length||!n||!o||!i||s===null?{issues:t}:{issues:t,value:{schema:Mt,id:e.id,label:e.label,version:e.version,baseVenue:n,overlay:{objectIds:o,productionKillSeatIds:i,...s!==void 0?{productionElements:s}:{}}}}}function $t(e){let t=pr(e);return t.value?{ok:!0,value:t.value}:{ok:!1,issues:t.issues}}function hr(e){if((e.kind==="polygon"||e.kind==="polyline"||e.kind==="line")&&e.points&&e.points.length>=2)return e.points;if(e.x==null||e.y==null||e.width==null||e.height==null)return null;let t=e.x,n=e.y,r=e.width,o=e.height;return[{x:t,y:n},{x:t+r,y:n},{x:t+r,y:n+o},{x:t,y:n+o}]}function yr(e,t,n){let r=n*Math.PI/180,o=Math.cos(r),i=Math.sin(r),s=e.x-t.x,a=e.y-t.y;return{x:t.x+s*o-a*i,y:t.y+s*i+a*o}}function Qt(e){let t=hr(e);if(!t||t.length<2)return null;let n=e.rotation??0,r=Math.abs(n)<1e-6?t:t.map(m=>yr(m,{x:t.reduce((u,l)=>u+l.x,0)/t.length,y:t.reduce((u,l)=>u+l.y,0)/t.length},n)),o=1/0,i=1/0,s=-1/0,a=-1/0;for(let m of r)o=Math.min(o,m.x),i=Math.min(i,m.y),s=Math.max(s,m.x),a=Math.max(a,m.y);return!Number.isFinite(o)||s-o<1e-6||a-i<1e-6?null:{minX:o,minY:i,maxX:s,maxY:a}}var gr=5,xr=3,Mr=.92,Sr=1.9,wr=2,Ir=.6,vr=1,Rr=.06;function Cr(e){return e.heightM!==void 0?e.heightM:We(e.stageKind)?Rr:vr}function qt(e){let t=1/0,n=1/0,r=-1/0,o=-1/0,i=-1/0;for(let s of tn(e)){let a=s.baseHeightM??0;for(let m of s.objects){if(m.type!=="shape"||m.role!=="stage")continue;let u=Qt(m);u&&(t=Math.min(t,u.minX),n=Math.min(n,u.minY),r=Math.max(r,u.maxX),o=Math.max(o,u.maxY),i=Math.max(i,a+Cr(m)))}}return!Number.isFinite(t)||!Number.isFinite(i)?null:{minX:t,minY:n,maxX:r,maxY:o,deckTopM:i}}function Pr(e,t,n,r){let o=1/0,i=1/0,s=-1/0,a=-1/0;for(let f of e)Number.isFinite(f.eyeHeightM)&&(o=Math.min(o,f.x),s=Math.max(s,f.x),i=Math.min(i,f.y),a=Math.max(a,f.y));if(!Number.isFinite(o))return null;let m=o*t,u=i*t,l=Math.max(1,Math.ceil((s-o)*t/n)+1),d=Math.max(1,Math.ceil((a-i)*t/n)+1),c=new Float64Array(l*d).fill(-1/0);for(let f of e){if(!Number.isFinite(f.eyeHeightM))continue;let b=f.eyeHeightM-ce,h=Math.min(l-1,Math.max(0,Math.floor((f.x*t-m)/n))),y=Math.min(d-1,Math.max(0,Math.floor((f.y*t-u)/n)))*l+h,g=b+r;g>c[y]&&(c[y]=g)}return{cellM:n,minX:m,minY:u,cols:l,rows:d,top:c}}function Er(e,t,n){let r=Math.floor((t-e.minX)/e.cellM),o=Math.floor((n-e.minY)/e.cellM);return r<0||o<0||r>=e.cols||o>=e.rows?-1/0:e.top[o*e.cols+r]}function Jt(e,t,n={}){let r=new Map;if(!t||!e.length)return r;let o=n.metresPerChartUnit??te,i=n.cellM??Ir,s=n.chairBackM??Mr,a=n.selfRowSkipM??wr,m=n.clearThreshold??.9,u=n.partialThreshold??.25,l=Math.max(1,n.columns??gr),d=Math.max(1,n.rows??xr),c=Pr(e,o,i,s);if(!c)return r;let f=(t.maxX-t.minX)*o,b=(t.maxY-t.minY)*o,h=f>=b,p=(t.minX+t.maxX)/2*o,y=(t.minY+t.maxY)/2*o,g=[];for(let x=0;x<l;x++){let R=(x+.5)/l-.5,S=h?p+R*f:p,I=h?y:y+R*b;for(let _=0;_<d;_++){let B=t.deckTopM+(d===1?0:_/(d-1)*Sr);g.push({x:S,y:I,z:B})}}let M=i/2;for(let x of e){if(!Number.isFinite(x.eyeHeightM))continue;let R=x.x*o,S=x.y*o,I=x.eyeHeightM,_=0,B=1/0;for(let G of g){let P=G.x-R,w=G.y-S,k=Math.hypot(P,w);if(!(k>a)){_++;continue}let F=P/k,v=w/k,T=0;for(let E=a;E<k;E+=M){let A=Er(c,R+F*E,S+v*E);if(!(!Number.isFinite(A)||A>=I)&&A>I+(G.z-I)*E/k){T=E;break}}T?B=Math.min(B,T):_++}let N=_/g.length;N>=m||r.set(x.id,{seatId:x.id,mark:N<u?"obstructedView":"restrictedView",visibleFraction:N,totalRays:g.length,atDistanceM:Number.isFinite(B)?B:0})}return r}function en(e,t){if(!t.size)return 0;let n=0;for(let r of e){let o=t.get(r.id);if(!o)continue;let i=r.commercial;i?.restrictedView!==void 0||i?.obstructedView!==void 0||(r.commercial={...i,[o.mark]:!0},n++)}return n}function wt(e){return e?e.accessibility?.length?e.wheelchairSpaceType&&!e.accessibility.includes("wheelchair")?["wheelchair",...e.accessibility]:e.accessibility:e.wheelchairSpaceType?["wheelchair"]:e.accessible?["wheelchair"]:[]:[]}var $e=Math.PI/180;var Te=16;function It(e,t,n,r){let o=n*$e,i=Math.cos(o),s=Math.sin(o);return{x:r.x+e*i-t*s,y:r.y+e*s+t*i}}function Ar(e){let{seatCount:t,seatSpacing:n,curve:r,rotation:o,origin:i}=e,s=[];if(e.path)return jt(e.path,t);if(t<=1)return t===1&&s.push({x:i.x,y:i.y}),s;if(r===0){for(let u=0;u<t;u++)s.push(It(u*n,0,o,i));return s}let a=r/(t-1)*$e,m=n/(2*Math.sin(Math.abs(a)/2));for(let u=0;u<t;u++){let l=u*a,d=m*Math.sin(l),c=-m+m*Math.cos(l);s.push(It(d,c,o,i))}return s}function _r(e){let t=new Map;if(e.overrides)for(let n of e.overrides)t.set(n.index,n);return t}function kr(e,t){let n=_r(e);return Ar(e).map((r,o)=>{let i=n.get(o),s=wt(i),a=Xt(e,o,i),m={...e.commercial,...i?.commercial};return{index:o,x:r.x+(i?.dx??0),y:r.y+(i?.dy??0),label:a,displayLabel:pt(e,o,t,i),categoryKey:i?.categoryKey??e.categoryKey,skipped:!!i?.skip,accessible:s.length>0,accessibility:s,wheelchairSpaceType:i?.wheelchairSpaceType,commercial:Object.values(m).some(u=>u!==void 0&&u!==!1&&u!=="")?m:void 0,glyph:i?.glyph,viewUrl:i?.viewFromSeatUrl??e.viewFromSeatUrl,viewMeta:i?.viewFromSeatUrl?i.viewFromSeatMeta:e.viewFromSeatMeta,labelStyle:i?.labelStyle??e.seatLabelStyle}})}function an(e){let t=[];for(let n of kr(e))n.skipped||t.push({id:`${e.id}:${n.index}`,label:n.label,displayLabel:n.displayLabel===n.label?void 0:n.displayLabel,x:n.x,y:n.y,rowId:e.id,categoryKey:n.categoryKey,accessible:n.accessible||void 0,accessibility:n.accessibility.length?n.accessibility:void 0,wheelchairSpaceType:n.wheelchairSpaceType,commercial:n.commercial,glyph:n.glyph,viewUrl:n.viewUrl,viewMeta:n.viewMeta,labelStyle:n.labelStyle});return t}function Tr(e){if(e.seatCountsBySide)return{...e.seatCountsBySide};let t=e.sides&&e.sides.length?e.sides:["top","bottom"],n=["top","bottom","left","right"].filter(i=>t.includes(i)),r={top:0,bottom:0,left:0,right:0};if(!n.length)return r;let o=Math.max(0,Math.round(e.seatCount));for(let i=0;i<o;i++)r[n[i%n.length]]+=1;return r}function Lr(e){let t=[],n=Math.max(0,Math.round(e.seatCount));if(n===0)return t;let r=new Map((e.overrides??[]).map(l=>[l.index,l])),o=(l,d,c,f)=>{let b=r.get(l),h=wt(b),p=b?.label??`${e.label}-${l+1}`,y=e.displayLabel??e.label;return{index:l,label:p,displayLabel:b?.displayLabel??`${y}-${l+1}`,x:d+(b?.dx??0),y:c+(b?.dy??0),categoryKey:b?.categoryKey??e.categoryKey,skipped:!!b?.skip,accessible:h.length>0,accessibility:h,wheelchairSpaceType:b?.wheelchairSpaceType,commercial:b?.commercial,glyph:b?.glyph,viewUrl:b?.viewFromSeatUrl,viewMeta:b?.viewFromSeatUrl?b.viewFromSeatMeta:void 0,labelStyle:b?.labelStyle,...f?{side:f}:{}}};if(e.shape==="round"){let l=(e.radius??40)+Te,d=e.rotation*$e,c=Math.max(0,Math.min(360,e.seatArc??360));if(c>=360||n===1){for(let p=0;p<n;p++){let y=d+p/n*2*Math.PI;t.push(o(p,e.center.x+l*Math.cos(y),e.center.y+l*Math.sin(y)))}return t}let f=c*$e,b=(2*Math.PI-f)/2,h=d+b;for(let p=0;p<n;p++){let y=h+p/(n-1)*f;t.push(o(p,e.center.x+l*Math.cos(y),e.center.y+l*Math.sin(y)))}return t}let i=e.width??80,s=e.height??50,a=Tr(e),m=["top","bottom","left","right"],u=0;for(let l of m){let d=a[l];for(let c=0;c<d;c++){let f,b;l==="top"?(f=-i/2+(c+.5)*i/d,b=-s/2-Te):l==="bottom"?(f=-i/2+(c+.5)*i/d,b=s/2+Te):l==="left"?(f=-i/2-Te,b=-s/2+(c+.5)*s/d):(f=i/2+Te,b=-s/2+(c+.5)*s/d);let h=It(f,b,e.rotation,e.center);t.push(o(u++,h.x,h.y,l))}}return t}function Or(e){return Lr(e).filter(t=>!t.skipped).map(t=>({id:`${e.id}:${t.index}`,label:t.label,...t.displayLabel!==t.label?{displayLabel:t.displayLabel}:{},x:t.x,y:t.y,rowId:e.id,categoryKey:t.categoryKey,...t.accessible?{accessible:!0}:{},...t.accessibility.length?{accessibility:t.accessibility}:{},...t.wheelchairSpaceType?{wheelchairSpaceType:t.wheelchairSpaceType}:{},...t.commercial?{commercial:t.commercial}:{},...t.glyph?{glyph:t.glyph}:{},...t.viewUrl?{viewUrl:t.viewUrl}:{},...t.viewUrl&&t.viewMeta?{viewMeta:t.viewMeta}:{},...t.labelStyle?{labelStyle:t.labelStyle}:{}}))}function Br(e){return[{id:`${e.id}:0`,label:e.label,...e.displayLabel&&e.displayLabel!==e.label?{displayLabel:e.displayLabel}:{},x:e.center.x,y:e.center.y,rowId:e.id,categoryKey:e.categoryKey,kind:"booth"}]}function nn(e,t){let n=!1;for(let r=0,o=t.length-1;r<t.length;o=r++){let i=t[r].x,s=t[r].y,a=t[o].x,m=t[o].y;s>e.y!=m>e.y&&e.x<(a-i)*(e.y-s)/(m-s)+i&&(n=!n)}return n}function Fr(e,t){return t.some((n,r)=>{let o=t[(r+1)%t.length],i=(e.y-n.y)*(o.x-n.x)-(e.x-n.x)*(o.y-n.y);if(Math.abs(i)>1e-7)return!1;let s=(e.x-n.x)*(o.x-n.x)+(e.y-n.y)*(o.y-n.y),a=(o.x-n.x)**2+(o.y-n.y)**2;return s>=-1e-7&&s<=a+1e-7})}function pe(e,t,n){return nn(e,t)&&!(n??[]).some(r=>nn(e,r)||Fr(e,r))}function Ze(e){if(!e.length)return{x:0,y:0};let t=0,n=0;for(let r of e)t+=r.x,n+=r.y;return{x:t/e.length,y:n/e.length}}function cn(e){switch(e.type){case"row":{let t=an(e);if(!t.length)return{x:e.origin.x,y:e.origin.y};let n=0,r=0;for(let o of t)n+=o.x,r+=o.y;return{x:n/t.length,y:r/t.length}}case"table":case"booth":return{x:e.center.x,y:e.center.y};case"gaArea":return Ze(e.points);case"section":return Ze(e.outline);case"text":return{x:e.position.x,y:e.position.y};case"shape":return e.points&&e.points.length?Ze(e.points):e.x!=null&&e.y!=null&&e.width!=null&&e.height!=null?{x:e.x+e.width/2,y:e.y+e.height/2}:{x:e.x??0,y:e.y??0};case"decorImage":return{x:e.x+e.width/2,y:e.y+e.height/2}}}function on(e,t){return e.length===t.length&&e.every((n,r)=>n.x===t[r].x&&n.y===t[r].y)}function Dr(e,t){if(e.type!=="gaArea"||!on(e.points,t.outline))return!1;let n=e.holes??[],r=t.holes??[];return n.length===r.length&&n.every((o,i)=>on(o,r[i]))}function Nr(e,t,n=e.filter(o=>o.type==="section"),r=cn(t)){let o="referenceInventorySource"in t?t.referenceInventorySource?.logicalSectionId:void 0;return(o?n.find(s=>(s.logicalSectionId??s.id)===o&&(Dr(t,s)||pe(r,s.outline,s.holes))):void 0)??n.find(s=>pe(r,s.outline,s.holes))}function tn(e){return e.floors&&e.floors.length?e.floors:[{id:"floor-0",name:"Main",objects:e.objects,focalPoint:e.focalPoint,referenceImage:e.referenceImage,backgroundImage:e.backgroundImage}]}function rn(e,t,n,r,o,i,s,a,m){let u=[],l=e.filter(h=>h.type==="section"),d=Ut(e),c=h=>!h?.eventConfigurationId||h.eventConfigurationId===r&&(h.eventConfigurationVersion===void 0||h.eventConfigurationVersion===m),f=h=>zt(h,{activeConfigurationId:r,activeConfigurationVersion:m,activeBasisSha256:o,now:a}),b=(h,p)=>f(h)?{...h,coverage:p}:void 0;for(let h of e){let p=[];if(h.type==="row"?p=an(h):h.type==="table"?p=Or(h):h.type==="booth"&&(p=Br(h)),!p.length)continue;for(let R of p)R.viewUrl&&!c(R.viewMeta)&&(R.viewUrl=void 0,R.viewMeta=void 0);if(h.type==="row"){let R=d.get(h.id);if(R){let S=new Map((h.overrides??[]).map(I=>[I.index,I]));for(let I of p){let _=Number(I.id.slice(I.id.lastIndexOf(":")+1));if(!Number.isInteger(_))continue;I.logicalRowId=R.groupId,I.logicalSeatIndex=R.adjacencyOffset+_,S.get(_)?.displayLabel||(I.displayLabel=pt(h,_,R)),!I.viewUrl&&R.viewFromSeatUrl&&c(R.viewFromSeatMeta)&&(I.viewUrl=R.viewFromSeatUrl,I.viewMeta=R.viewFromSeatMeta);let B=S.get(_)?.confidenceEvidence;I.confidenceEvidence=b(B,"exact-seat")??b(h.confidenceEvidence,"row-representative")??b(R.confidenceEvidence,"row-representative")}}}let y=Nr(e,h,l,h.type==="row"?Ze(p):cn(h)),g=y?.viewFromSeatUrl,x=(y?.zone?t?.find(R=>R.id===y.zone):void 0)?.focalPoint??n;for(let R of p){if(!R.confidenceEvidence){let S=Number(R.id.slice(R.id.lastIndexOf(":")+1)),I=(h.type==="row"||h.type==="table")&&Number.isInteger(S)?h.overrides?.find(_=>_.index===S)?.confidenceEvidence:void 0;R.confidenceEvidence=b(I,"exact-seat")??(h.type==="row"?b(h.confidenceEvidence,"row-representative"):void 0)}R.confidenceEvidence??=b(y?.confidenceEvidence,"section-representative")??(s?b(s.evidence,s.coverage):void 0),!R.viewUrl&&g&&c(y?.viewFromSeatMeta)&&(R.viewUrl=g,R.viewMeta=y?.viewFromSeatMeta),!R.viewUrl&&i&&c(i.meta)&&(R.viewUrl=i.url,R.viewMeta=i.meta),y&&(R.sectionId=y.logicalSectionId??y.id),y?.zone&&(R.zoneId=y.zone),x&&(R.focalPoint={...x})}u.push(...p)}return u}function un(e,t={}){if(e.floors?.length){let r=[];for(let o of e.floors){let i=o.focalPoint??e.focalPoint,s=o.viewFromSeatUrl?{url:o.viewFromSeatUrl,meta:o.viewFromSeatMeta}:e.viewFromSeatUrl?{url:e.viewFromSeatUrl,meta:e.viewFromSeatMeta}:void 0,a=o.confidenceEvidence?{evidence:o.confidenceEvidence,coverage:"floor-representative"}:e.confidenceEvidence?{evidence:e.confidenceEvidence,coverage:"venue-representative"}:void 0,m=rn(o.objects,e.zones,i,e.eventConfigurationId,e.confidenceBasisSha256,s,a,t.now,t.eventConfigurationVersion??e.eventConfigurationVersion);t.resolveEyeHeights!==!1&&sn(o.objects,o.focalPoint??e.focalPoint,o.baseHeightM??0,m);for(let u of m)u.floorId=o.id;r.push(...m)}return r}let n=rn(e.objects,e.zones,e.focalPoint,e.eventConfigurationId,e.confidenceBasisSha256,e.viewFromSeatUrl?{url:e.viewFromSeatUrl,meta:e.viewFromSeatMeta}:void 0,e.confidenceEvidence?{evidence:e.confidenceEvidence,coverage:"venue-representative"}:void 0,t.now,t.eventConfigurationVersion??e.eventConfigurationVersion);return t.resolveEyeHeights!==!1&&sn(e.objects,e.focalPoint,t.floorBaseHeightM??0,n),jr(e,n,t)}function jr(e,t,n){return!n.deriveRestrictedView||e.derivedRestrictedView===!1||n.resolveEyeHeights===!1||en(t,Jt(t,qt(e))),t}function sn(e,t,n,r){let o=e.filter(d=>d.type==="section"),i=n>0||o.some(d=>d.height!==void 0||d.rake!==void 0||(d.elevation??0)>0);if(!o.length||!i||!t){for(let d of r)d.eyeHeightM=n+ce;return}let s=new Array(r.length),a=new Map;for(let d of o)a.has(d.id)||a.set(d.id,d);let m=new Map,u=new Map;for(let d=0;d<r.length;d++){let c=r[d],b=(c.sectionId?a.get(c.sectionId)??o.find(p=>p.logicalSectionId===c.sectionId&&pe({x:c.x,y:c.y},p.outline,p.holes)):void 0)??o.find(p=>pe({x:c.x,y:c.y},p.outline,p.holes))??null;if(s[d]=b,!b)continue;m.has(b.id)||m.set(b.id,Ke(b,{floorBaseHeightM:n}));let h=u.get(b.id);h?h.push(d):u.set(b.id,[d])}let l=new Array(r.length).fill(void 0);for(let[d,c]of u){let f=m.get(d);if(!f)continue;let b=f.rake>0?Math.tan(f.rake*Math.PI/180):0,h=ze(d,r,c,t);for(let p of h.rows){let y=p.blockDepth*te*b,g=f.height+y;for(let M of p.seatIndices)l[M]=g}}for(let d=0;d<r.length;d++){let c=r[d],f=s[d];if(!f){c.eyeHeightM=n+ce;continue}let b=m.get(f.id);c.eyeHeightM=(l[d]??b.height)+ce}}var Gr=/^#?([\da-f]{3}|[\da-f]{6})$/i;function Ur(e){let t=Gr.exec((e??"").trim());if(!t)return null;let n=t[1].length===3?t[1].split("").map(o=>o+o).join(""):t[1],r=parseInt(n,16);return[r>>16&255,r>>8&255,r&255]}function W(e){let t=Ur(e);return t?[t[0]/255,t[1]/255,t[2]/255]:null}function Yr(e){return .2126*e[0]+.7152*e[1]+.0722*e[2]}function ne(e,t,n){return[e[0]+(t[0]-e[0])*n,e[1]+(t[1]-e[1])*n,e[2]+(t[2]-e[2])*n]}function Le(e,t){let n=Yr(e);return ne(e,[n,n,n],t)}var Qe=["available","held","sold","selected","dimmed"];function ln(e){let t=Qe.indexOf(e);return t<0?0:t}var fn={available:[.24,.82,.52],held:[.95,.66,.22],sold:[.34,.39,.45],selected:[.24,.74,1],dimmed:[.28,.32,.37]};var vt={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]},Rt={top:[.05,.06,.08],bottom:[.1,.12,.15]};function ie(e,t){return[Math.min(1,e[0]*t),Math.min(1,e[1]*t),Math.min(1,e[2]*t)]}var Xr=.15,Vr=1.6;function mn(e){return Gt(e??1,Xr,Vr)}var Hr=.15,Kr=.9,zr=1.76;function Wr(){return{background:{top:[...Rt.top],bottom:[...Rt.bottom]},structure:vt,seatStates:{...fn},seatScale:1,materials:{seat:null,shell:null,roughness:.78}}}function dn(e){let t=Wr();if(!e)return t;let n=W(e.background);if(n){t.background={top:ie(n,Kr),bottom:ie(n,zr)};let s={};for(let[a,m]of Object.entries(vt))s[a]=ne(m,n,Hr);t.structure=s}let r=W(e.selectionColor)??W(e.accent);r&&(t.seatStates={...t.seatStates,selected:r});let o=e.seatScale;typeof o=="number"&&Number.isFinite(o)&&(t.seatScale=mn(o));let i=e.venue3d;if(i){let s=W(i.deck),a=W(i.fascia);s&&(t.structure={...t.structure,tierTop:s,gaTop:s}),a&&(t.structure={...t.structure,tierWall:a,gaWall:a}),t.materials.seat=W(i.seat),t.materials.shell=W(i.shell),typeof i.roughness=="number"&&Number.isFinite(i.roughness)&&(t.materials.roughness=Math.min(1,Math.max(0,i.roughness)))}return t}function bn(e,t){let n=[];for(let r of t)n.push(...e.seatStates[r]);return n}var hn=Ie(require("earcut"),1),yn=Ie(require("polygon-clipping"),1);function he(e){let t=0;for(let n=0,r=e.length;n<r;n+=1){let o=e[n],i=e[(n+1)%r];t+=o.x*i.y-i.x*o.y}return t/2}function Oe(e,t,n){let r=!1;for(let o=0,i=e.length-1;o<e.length;i=o++){let s=e[o],a=e[i];s.y>n!=a.y>n&&t<(a.x-s.x)*(n-s.y)/(a.y-s.y)+s.x&&(r=!r)}return r}var C=te,Zr=.002;function $r(e,t,n){let r=Math.hypot(t[0]-e[0],t[1]-e[1],t[2]-e[2]),o=Math.hypot(n[0]-t[0],n[1]-t[1],n[2]-t[2]),i=Math.hypot(e[0]-n[0],e[1]-n[1],e[2]-n[2]),s=Math.max(r,o,i);if(s<1e-9)return!0;let a=(r+o+i)/2;return 2*Math.sqrt(Math.max(0,a*(a-r)*(a-o)*(a-i)))/s<Zr}var ye=class{constructor(t=16384){this.len=0;this.buf=new Float32Array(t)}push3(t,n,r){this.len+3>this.buf.length&&this.grow(this.len+3),this.buf[this.len++]=t,this.buf[this.len++]=n,this.buf[this.len++]=r}push1(t){this.len+1>this.buf.length&&this.grow(this.len+1),this.buf[this.len++]=t}grow(t){let n=this.buf.length*2;for(;n<t;)n*=2;let r=new Float32Array(n);r.set(this.buf.subarray(0,this.len)),this.buf=r}get length(){return this.len}toArray(){return this.buf.slice(0,this.len)}},et=class{constructor(){this.pos=new ye;this.nor=new ye;this.col=new ye;this.flr=new ye;this.mat=new ye;this.currentFloor=0;this.currentMaterial=0}setFloor(t){this.currentFloor=t}setMaterial(t){this.currentMaterial=t}tri(t,n,r,o,i,s=i,a=i){$r(t,n,r)||(this.pos.push3(t[0],t[1],t[2]),this.pos.push3(n[0],n[1],n[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(i[0],i[1],i[2]),this.col.push3(s[0],s[1],s[2]),this.col.push3(a[0],a[1],a[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(t,n,r,o,i,s,a,m=a,u=a){[...t,...n,...r].every(Number.isFinite)&&(this.pos.push3(t[0],t[1],t[2]),this.pos.push3(n[0],n[1],n[2]),this.pos.push3(r[0],r[1],r[2]),this.nor.push3(o[0],o[1],o[2]),this.nor.push3(i[0],i[1],i[2]),this.nor.push3(s[0],s[1],s[2]),this.col.push3(a[0],a[1],a[2]),this.col.push3(m[0],m[1],m[2]),this.col.push3(u[0],u[1],u[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 Qr(e,t,n){let r=t[0]-e[0],o=t[1]-e[1],i=t[2]-e[2],s=n[0]-e[0],a=n[1]-e[1],m=n[2]-e[2],u=o*m-i*a,l=i*s-r*m,d=r*a-o*s,c=Math.hypot(u,l,d)||1;return u/=c,l/=c,d/=c,[u,l,d]}function qr(e,t){let n=[...e],r=[];for(let s of e)r.push(s.x,s.y);let o=[];if(t){for(let s of t)if(!(s.length<3)){o.push(n.length);for(let a of s)n.push(a),r.push(a.x,a.y)}}let i=(0,hn.default)(r,o.length?o:void 0,2);return{pts:n,tris:i}}function Ct(e){return he(e)<0?[...e].reverse():e}var Jr=3;function ei(e,t,n,r){let o=r(e),i=r(t),s=r(n),a=(f,b,h,p)=>Math.abs(r({x:(f.x+b.x)/2,y:(f.y+b.y)/2})-(h+p)/2),m=(e.x+t.x+n.x)/3,u=(e.y+t.y+n.y)/3,l=(o+i+s)/3,d=Math.max(a(e,t,o,i),a(t,n,i,s),a(n,e,s,o),Math.abs(r({x:m,y:u})-l)),c=(f,b,h)=>{let p=Math.abs(r({x:(f+m)/2,y:(b+u)/2})-(h+l)/2);p>d&&(d=p)};return c((e.x+t.x)/2,(e.y+t.y)/2,(o+i)/2),c((t.x+n.x)/2,(t.y+n.y)/2,(i+s)/2),c((n.x+e.x)/2,(n.y+e.y)/2,(s+o)/2),d}function Be(e,t,n,r,o){if(o<=0)return ei(e,t,n,r);let i={x:(e.x+t.x)/2,y:(e.y+t.y)/2},s={x:(t.x+n.x)/2,y:(t.y+n.y)/2},a={x:(n.x+e.x)/2,y:(n.y+e.y)/2};return Math.max(Be(e,i,a,r,o-1),Be(i,t,s,r,o-1),Be(a,s,n,r,o-1),Be(i,s,a,r,o-1))}function Fe(e,t,n,r,o,i,s,a){if(s>0){let c={x:(t.x+n.x)/2,y:(t.y+n.y)/2},f={x:(n.x+r.x)/2,y:(n.y+r.y)/2},b={x:(r.x+t.x)/2,y:(r.y+t.y)/2};Fe(e,t,c,b,o,i,s-1,a),Fe(e,c,n,f,o,i,s-1,a),Fe(e,b,f,r,o,i,s-1,a),Fe(e,c,f,b,o,i,s-1,a);return}let m=[t.x*C,o(t),t.y*C],u=[n.x*C,o(n),n.y*C],l=[r.x*C,o(r),r.y*C];if(a){e.triN(m,u,l,a(t),a(n),a(r),i);return}let d=Qr(m,u,l);d[1]<0&&(d=[-d[0],-d[1],-d[2]]),e.tri(m,u,l,d,i)}var ti=8;function pn(e,t,n){if(!Number.isFinite(n))return e;let r=[],o=(i,s,a,m,u)=>{if(u>0){let l={x:(i.x+s.x)/2,y:(i.y+s.y)/2},d=t(l);if(Math.abs(d-(a+m)/2)>n){o(i,l,a,d,u-1),o(l,s,d,m,u-1);return}}r.push(i)};for(let i=0;i<e.length;i++){let s=e[i],a=e[(i+1)%e.length];o(s,a,t(s),t(a),ti)}return r}function qe(e,t){if(e.length<3)return e;let n=[];for(let o of e){let i=n[n.length-1];i&&Math.hypot(o.x-i.x,o.y-i.y)<t||n.push(o)}for(;n.length>2&&Math.hypot(n[0].x-n[n.length-1].x,n[0].y-n[n.length-1].y)<t;)n.pop();if(n.length<3)return e;let r=[];for(let o=0;o<n.length;o++){let i=r.length?r[r.length-1]:n[(o-1+n.length)%n.length],s=n[o],a=n[(o+1)%n.length],m=a.x-i.x,u=a.y-i.y,l=Math.hypot(m,u);l>t&&Math.abs((s.x-i.x)*u-(s.y-i.y)*m)/l<t||r.push(s)}return r.length>=3?r:n}var Je=.001*me*.1;function J(e,t,n,r,o,i,s,a,m=1/0,u){if(!t||t.length<3||(m===void 0&&(m=1/0),Math.abs(he(t))<1e-4))return;let l=qe(pn(qe(Ct(t),Je),r,m),Je),d=n?.map(S=>qe(pn(qe(Ct(S),Je),r,m),Je)).filter(S=>S.length>=3&&Math.abs(he(S))>=1e-4),{pts:c,tris:f}=qr(l,d),b=[i[0]*a.top,i[1]*a.top,i[2]*a.top],h=[i[0]*a.bottomCap,i[1]*a.bottomCap,i[2]*a.bottomCap],p=[s[0]*a.top,s[1]*a.top,s[2]*a.top],y=[s[0]*a.wallBottom,s[1]*a.wallBottom,s[2]*a.wallBottom],g=0;if(Number.isFinite(m))for(;g<Jr;g++){let S=0;for(let I=0;I<f.length;I+=3){let _=Be(c[f[I]],c[f[I+1]],c[f[I+2]],r,g);_>S&&(S=_)}if(S<=m)break}for(let S=0;S<f.length;S+=3){let I=c[f[S]],_=c[f[S+1]],B=c[f[S+2]];Fe(e,I,_,B,r,b,g,u);let N=[I.x*C,o,I.y*C],G=[_.x*C,o,_.y*C],P=[B.x*C,o,B.y*C];e.tri(N,P,G,[0,-1,0],h)}let M=S=>{if(g<=0)return S;let I=1<<g,_=[];for(let B=0;B<S.length;B++){let N=S[B],G=S[(B+1)%S.length];for(let P=0;P<I;P++){let w=P/I;_.push({x:N.x+(G.x-N.x)*w,y:N.y+(G.y-N.y)*w})}}return _},x=dt(l),R=[{ring:M(l),flip:!1}];if(d)for(let S of d)S.length>=3&&R.push({ring:M(S),flip:!0});for(let{ring:S,flip:I}of R)for(let _=0;_<S.length;_++){let B=S[_],N=S[(_+1)%S.length],G=(N.x-B.x)*C,w=(N.y-B.y)*C,k=-G,F=Math.hypot(w,k)||1;w/=F,k/=F;let v=(B.x+N.x)/2-x.x,T=(B.y+N.y)/2-x.y,E=w*v+k*T;I&&(E=-E),E<0&&(w=-w,k=-k);let A=[w,0,k],L=[B.x*C,r(B),B.y*C],D=[N.x*C,r(N),N.y*C],j=[B.x*C,o,B.y*C],Y=[N.x*C,o,N.y*C];e.tri(L,D,Y,A,p,p,y),e.tri(L,Y,j,A,p,y,y)}}function gn(e){let t=0;for(let m of e)t+=m.count;let n=new Float32Array(t*3),r=new Float32Array(t*3),o=new Float32Array(t*3),i=new Float32Array(t),s=new Float32Array(t),a=0;for(let m of e)n.set(m.position,a*3),r.set(m.normal,a*3),o.set(m.color,a*3),i.set(m.floor,a),s.set(m.material,a),a+=m.count;return{position:n,normal:r,color:o,floor:i,material:s,count:t}}function tt(e,t,n=2.5){if(t<=0||e.length<3)return e;let r=Ct(e),o=r.length,i=[];for(let a=0;a<o;a++){let m=r[a],u=r[(a+1)%o],l=u.x-m.x,d=u.y-m.y,c=Math.hypot(l,d)||1;i.push({x:d/c,y:-l/c})}let s=[];for(let a=0;a<o;a++){let m=r[a],u=i[(a-1+o)%o],l=i[a],d=u.x+l.x,c=u.y+l.y,f=Math.hypot(d,c),b=()=>{s.push([m.x+u.x*t,m.y+u.y*t]),s.push([m.x+l.x*t,m.y+l.y*t])};if(f<1e-9){b();continue}d/=f,c/=f;let h=d*u.x+c*u.y,p=1/Math.max(h,1e-6);if(!Number.isFinite(p)||p>n){b();continue}s.push([m.x+d*t*p,m.y+c*t*p])}if(s.length<3)return e;try{let a=yn.default.union([[...s,s[0]]]),m=null,u=-1/0;for(let d of a){let c=Math.abs(he(d[0].map(([f,b])=>({x:f,y:b}))));c>u&&(u=c,m=d[0])}if(!m)return e;let l=m.map(([d,c])=>({x:d,y:c}));if(l.length>1){let d=l[0],c=l[l.length-1];Math.abs(d.x-c.x)<1e-9&&Math.abs(d.y-c.y)<1e-9&&l.pop()}return l.length>=3?l:e}catch{return e}}function nt(e,t,n,r,o=28){let i=[];for(let s=0;s<o;s++){let a=s/o*Math.PI*2;i.push({x:e+n*Math.cos(a),y:t+r*Math.sin(a)})}return i}function De(e,t,n,r){return[{x:e,y:t},{x:e+n,y:t},{x:e+n,y:t+r},{x:e,y:t+r}]}var ni=[{key:"wheelchair",label:"Wheelchair space",short:"Wheelchair",icon:"\u267F"},{key:"companion",label:"Companion seat",short:"Companion",icon:"\u{1F9D1}\u200D\u{1F91D}\u200D\u{1F9D1}"},{key:"semi-ambulatory",label:"Semi-ambulatory (limited mobility)",short:"Limited mobility",icon:"\u{1F9AF}"},{key:"designated-aisle",label:"Designated aisle / transfer seat",short:"Aisle transfer",icon:"AS"},{key:"step-free",label:"Step-free accessible seat",short:"Step-free",icon:"SF"},{key:"hearing",label:"Assistive listening",short:"Hearing",icon:"\u{1F9BB}"},{key:"cart",label:"CART live-caption view",short:"CART captions",icon:"CC"},{key:"sign-language",label:"Sign-language view",short:"Sign language",icon:"\u{1F91F}"},{key:"low-vision",label:"Blind / low-vision viewing",short:"Low vision",icon:"LV"},{key:"sensory-friendly",label:"Quiet / sensory-friendly seating",short:"Sensory-friendly",icon:"QS"},{key:"plus-size",label:"Plus-size seat",short:"Plus-size",icon:"\u{1F4BA}"},{key:"lift-armrest",label:"Lift-up armrest",short:"Lift armrest",icon:"\u2195\uFE0F"}],ya=new Map(ni.map(e=>[e.key,e]));var oi={wheelchair:"#3b82f6",companion:"#8b5cf6","semi-ambulatory":"#0ea5e9","designated-aisle":"#0284c7","step-free":"#16a34a",hearing:"#14b8a6",cart:"#7c3aed","sign-language":"#f59e0b","low-vision":"#d97706","sensory-friendly":"#6366f1","plus-size":"#ec4899","lift-armrest":"#22c55e"};function xn(e){let t=e?.[0];return t&&oi[t]||"#3b82f6"}var ri=[{key:"obstructedView",label:"Obstructed view",short:"Obstructed",icon:"\u26D4"},{key:"restrictedView",label:"Restricted view",short:"Restricted",icon:"\u{1F441}"},{key:"premium",label:"Premium seat",short:"Premium",icon:"\u2605"}],ga=new Map(ri.map(e=>[e.key,e]));var ii=["reference-focal","bar","entrance","exit","restroom","screen","sound","concession","coat","wall","rail","suite","obstruction"],xa=new Set(ii);var Sn=[{key:"circle",label:"Standard seat",shortLabel:"Standard",useCase:"General assigned seating",group:"general",path:null,bounds:null},{key:"theatre",label:"Theatre chair",shortLabel:"Theatre",useCase:"Auditoriums, arenas and stadium stands",group:"fixed",path:"M4.5 3.5 Q4.5 1.5 6.5 1.5 L17.5 1.5 Q19.5 1.5 19.5 3.5 L19.5 13 L4.5 13 Z M3.5 12 L20.5 12 Q22.5 12 22.5 14 L22.5 21 Q22.5 22.5 21 22.5 Q19.5 22.5 19.5 21 L19.5 17.5 L4.5 17.5 L4.5 21 Q4.5 22.5 3 22.5 Q1.5 22.5 1.5 21 L1.5 14 Q1.5 12 3.5 12 Z",bounds:{x:1.5,y:1.5,width:21,height:21}},{key:"dining",label:"Dining chair",shortLabel:"Dining",useCase:"Banquets, restaurants and table seating",group:"flexible",path:"M7 1 Q6 1 6 2.5 L6.75 10.5 L5 10.5 Q4 10.5 4 12 L4 14 Q4 15 5.25 15 L6 15 L4 23 L7 23 L9.5 15 L14.5 15 L17 23 L20 23 L18 15 L18.75 15 Q20 15 20 14 L20 12 Q20 10.5 19 10.5 L17.25 10.5 L18 2.5 Q18 1 17 1 Z",bounds:{x:4,y:1,width:16,height:22}},{key:"folding",label:"Folding chair",shortLabel:"Folding",useCase:"Concert floors, ceremonies and conferences",group:"flexible",path:"M6 2 Q5 2 5 3 L6 8 L18 8 L19 3 Q19 2 18 2 Z M5 9 L19 9 Q20 9 20 10.5 L19 13 L5 13 L4 10.5 Q4 9 5 9 Z M6 12 L9 12 L12 17 L15 12 L18 12 L14 19 L17 23 L14 23 L12 21 L10 23 L7 23 L10 19 Z",bounds:{x:4,y:2,width:16,height:21}},{key:"armchair",label:"Premium armchair",shortLabel:"Armchair",useCase:"Boxes, lounges and club seating",group:"premium",path:"M3.5 4 Q3.5 1.5 6 1.5 L18 1.5 Q20.5 1.5 20.5 4 L20.5 13 L3.5 13 Z M1.5 12.5 Q1.5 10 3.25 10 Q5 10 5 12.5 L5 13.5 L19 13.5 L19 12.5 Q19 10 20.75 10 Q22.5 10 22.5 12.5 L22.5 19.5 Q22.5 22 20 22 L4 22 Q1.5 22 1.5 19.5 Z",bounds:{x:1.5,y:1.5,width:21,height:20.5}},{key:"recliner",label:"Recliner",shortLabel:"Recliner",useCase:"Luxury cinemas and premium clubs",group:"premium",path:"M7 2 Q7 1 8.5 1 L15.5 1 Q17 1 17 2 L19 13 L5 13 Z M4 9 Q2 9 2 11.5 L2 16 Q2 18 4 18 L6 18 L6 15 L18 15 L18 18 L20 18 Q22 18 22 16 L22 11.5 Q22 9 20 9 Q18 9 18 11 L18 13 L6 13 L6 11 Q6 9 4 9 Z M7 17 L17 17 Q18 17 18.5 18.5 L19.5 22.5 L4.5 22.5 L5.5 18.5 Q6 17 7 17 Z",bounds:{x:2,y:1,width:20,height:21.5}},{key:"stool",label:"Stool",shortLabel:"Stool",useCase:"Bars, high-tops and seating rails",group:"flexible",path:"M6 2.5 L18 2.5 Q22 2.5 22 6.5 L22 12 Q22 16 18 16 L6 16 Q2 16 2 12 L2 6.5 Q2 2.5 6 2.5 Z M6 15.5 L9.5 15.5 L7.5 22.5 L3 22.5 Z M14.5 15.5 L18 15.5 L20.5 22.5 L16 22.5 Z",bounds:{x:2,y:2.5,width:20,height:20}},{key:"bench",label:"Bench place",shortLabel:"Bench",useCase:"Pews, bleachers and terraces",group:"fixed",path:"M2.5 0.5 L21.5 0.5 Q23 0.5 23 2 L23 5 Q23 6.5 21.5 6.5 L2.5 6.5 Q1 6.5 1 5 L1 2 Q1 0.5 2.5 0.5 Z M2 7.5 L22 7.5 Q23.5 7.5 23.5 9 L23.5 15.5 Q23.5 17 22 17 L18 17 L18 21.5 Q18 22.5 16.75 22.5 Q15.5 22.5 15.5 21.5 L15.5 17 L8.5 17 L8.5 21.5 Q8.5 22.5 7.25 22.5 Q6 22.5 6 21.5 L6 17 L2 17 Q0.5 17 0.5 15.5 L0.5 9 Q0.5 7.5 2 7.5 Z",bounds:{x:.5,y:.5,width:23,height:22}}],wn=Sn.map(e=>e.key),si=new Map(Sn.map(e=>[e.key,e]));function Mn(e){return typeof e=="string"&&si.has(e)}function In(e,t){return Mn(e)?e:Mn(t?.seatGlyph)?t.seatGlyph:"circle"}var ee={pedestal:0,pad:1,back:2,arm:3,footrest:4,leg:5,body:10,head:11},ai=.44,ci=.15,ui=.3,li=.24;function vn(e){return e===void 0||!Number.isFinite(e)||e<=0?li:Math.min(ui,Math.max(ci,e*ai))}var fi=.05,Rn=.45,mi=Rn+fi,di=.92;var va=[{part:ee.pedestal,min:[-.3,0,-.3],max:[.3,.36,.3]},{part:ee.pad,min:[-1,.36,-.95],max:[1,Rn,1]},{part:ee.back,min:[-1,mi,-1],max:[1,di,-.72]},{part:ee.arm,min:[-1,.44,-.82],max:[-.78,.65,.78]},{part:ee.arm,min:[.78,.44,-.82],max:[1,.65,.78]},{part:ee.footrest,min:[-.9,.18,.78],max:[.9,.31,1.34]},{part:ee.leg,min:[-.82,0,-.7],max:[-.62,.37,-.48]},{part:ee.leg,min:[.62,0,-.7],max:[.82,.37,-.48]},{part:ee.leg,min:[-.82,0,.48],max:[-.62,.37,.7]},{part:ee.leg,min:[.62,0,.48],max:[.82,.37,.7]}],Ra=[{part:ee.body,min:[-.52,.39,-.08],max:[-.08,.55,.82]},{part:ee.body,min:[.08,.39,-.08],max:[.52,.55,.82]},{part:ee.body,min:[-.47,.05,.58],max:[-.13,.43,.82]},{part:ee.body,min:[.13,.05,.58],max:[.47,.43,.82]},{part:ee.head,min:[-.16,1.04,-.33],max:[.16,1.1,-.13]}];function Cn(e,t,n,r){let o=new Float32Array(t),i=u=>e[u*3],s=u=>e[u*3+2],a=0,m=(u,l)=>{let d=l-u;for(let c=u;c<l;c++){let[f,b]=r(c),h=f-i(c),p=b-s(c);if(d>=2){let y=Math.max(u,c-1),g=Math.min(l-1,c+1),M=i(g)-i(y),x=s(g)-s(y),R=Math.hypot(M,x);if(R>1e-6){let S=-x/R,I=M/R;S*h+I*p<0&&(S=-S,I=-I),h=S,p=I}}o[c]=h===0&&p===0?0:Math.atan2(h,p)}};for(let u=1;u<=t;u++)(u===t||n(u)!==n(a))&&(m(a,u),a=u);return o}var ot=.22;var bi=.42;function pi(e){let t=e.length,n=new Float64Array(t);if(t<2)return n.fill(1/0),n;let r=1/0,o=1/0,i=-1/0,s=-1/0;for(let b of e)b.x<r&&(r=b.x),b.y<o&&(o=b.y),b.x>i&&(i=b.x),b.y>s&&(s=b.y);let a=Math.max(i-r,1e-6),m=Math.max(s-o,1e-6),u=Math.max(Math.sqrt(a*m/t),1e-6),l=Math.max(1,Math.ceil(a/u)+1),d=Math.max(1,Math.ceil(m/u)+1),c=new Map,f=(b,h)=>{let p=Math.min(l-1,Math.max(0,Math.floor((b-r)/u)));return Math.min(d-1,Math.max(0,Math.floor((h-o)/u)))*l+p};for(let b=0;b<t;b++){let h=f(e[b].x,e[b].y),p=c.get(h);p?p.push(b):c.set(h,[b])}for(let b=0;b<t;b++){let h=e[b],p=Math.min(l-1,Math.max(0,Math.floor((h.x-r)/u))),y=Math.min(d-1,Math.max(0,Math.floor((h.y-o)/u))),g=1/0;for(let M=1;M<=4;M++){for(let x=y-M;x<=y+M;x++)if(!(x<0||x>=d))for(let R=p-M;R<=p+M;R++){if(R<0||R>=l||M>1&&Math.abs(x-y)<M&&Math.abs(R-p)<M)continue;let S=c.get(x*l+R);if(S)for(let I of S){if(I===b)continue;let _=Math.hypot(e[I].x-h.x,e[I].y-h.y);_<g&&(g=_)}}if(Number.isFinite(g)&&g<=M*u)break}n[b]=g}return n}function hi(e){let t=e.eyeHeightM;return Number.isFinite(t)?Math.max(0,t-ce):0}function Pn(e,t,n,r,o,i){let s=e.length,a=new Float32Array(s*3),m=new Float32Array(s),u=new Float32Array(s*3),l=new Float32Array(s),d=new Float32Array(s),c=new Float32Array(s),f=new Float32Array(s),b=new Float32Array(s*3),h=new Map,p=pi(e);for(let y=0;y<s;y++){let g=e[y],x=(n?.seatPitchU(y)??p[y])*C;l[y]=Number.isFinite(x)?Math.max(.06,Math.min(ot,x*bi)):ot,d[y]=vn(Number.isFinite(x)?x:void 0);let R=In(g.glyph,{seatGlyph:i?.get(g.categoryKey)});c[y]=wn.indexOf(R),f[y]=g.wheelchairSpaceType==="no-seat"?0:1,a[y*3]=g.x*C,a[y*3+1]=n?n.seatDeckY(y):hi(g),a[y*3+2]=g.y*C,m[y]=ln(t?t(g):"available");let S=W(o?.get(g.categoryKey)??"#6e7bff")??[.43,.48,1];if(u[y*3]=S[0],u[y*3+1]=S[1],u[y*3+2]=S[2],g.accessibility?.length){let I=W(xn(g.accessibility));I&&(b[y*3]=I[0],b[y*3+1]=I[1],b[y*3+2]=I[2])}h.set(g.id,y)}return{count:s,iPosition:a,iState:m,iCategory:u,iMaxRadius:l,iRing:b,idToIndex:h,iChairWidth:d,iGlyph:c,iPhysicalSeat:f,iFloor:r??new Float32Array(s),iYaw:new Float32Array(s)}}function yi(e){return{kind:"radial",rowCount:0,rows:[],nearestRow:()=>-1,depthAt:(t,n)=>Math.hypot(t-e.x,n-e.y),gradientAt:(t,n)=>{let r=t-e.x,o=n-e.y,i=Math.hypot(r,o);return i<1e-9?[0,0]:[r/i,o/i]}}}function gi(e,t){if(!e.length)return null;let n=0,r=0,o=0;for(let f of e)n+=f.x,r+=f.y,o+=Math.hypot(f.x-t.x,f.y-t.y);let i=e.length;n/=i,r/=i,o/=i;let s=e[0],a=-1;for(let f of e){let b=Math.hypot(f.x-n,f.y-r);b>a&&(a=b,s=f)}let m=s.x-n,u=s.y-r,l=Math.hypot(m,u);l>1e-9?(m/=l,u/=l):(m=1,u=0);let d=[...e].sort((f,b)=>(f.x-n)*m+(f.y-r)*u-((b.x-n)*m+(b.y-r)*u)),c=0;for(let f of d){let b=Math.hypot(f.x-n,f.y-r);b>c&&(c=b)}return{pts:d,cx:n,cy:r,radius:c,depth:o}}function En(e,t,n){let r=e.pts;if(r.length===1)return Math.hypot(t-r[0].x,n-r[0].y);let o=1/0;for(let i=0;i+1<r.length;i++){let s=r[i],a=r[i+1],m=a.x-s.x,u=a.y-s.y,l=m*m+u*u,d=l>1e-12?((t-s.x)*m+(n-s.y)*u)/l:0;d<0?d=0:d>1&&(d=1);let c=Math.hypot(t-(s.x+d*m),n-(s.y+d*u));c<o&&(o=c)}return o}var rt=8;function xi(e,t,n){let r=new Array(rt).fill(1/0),o=new Array(rt).fill(-1);for(let l=0;l<e.length;l++){let d=e[l],c=Math.hypot(t-d.cx,n-d.cy)-d.radius;for(let f=0;f<rt;f++)if(c<r[f]){for(let b=rt-1;b>f;b--)r[b]=r[b-1],o[b]=o[b-1];r[f]=c,o[f]=l;break}}let i=new Array(3).fill(1/0),s=new Array(3).fill(-1);for(let l of o){if(l<0)continue;let d=En(e[l],t,n);for(let c=0;c<3;c++)if(d<i[c]){for(let f=2;f>c;f--)i[f]=i[f-1],s[f]=s[f-1];i[c]=d,s[c]=l;break}}if(s[0]<0)return 0;if(i[0]<1e-6)return e[s[0]].depth;let a=i[0]*2.2,m=0,u=0;for(let l=0;l<3;l++){let d=s[l];if(d<0||i[l]>a)continue;let c=1/(i[l]*i[l]);m+=c*e[d].depth,u+=c}return u>0?m/u:e[s[0]].depth}function Mi(e){let t=(r,o)=>xi(e,r,o),n=(r,o)=>{let i=1/0,s=-1;for(let a=0;a<e.length;a++){let m=e[a];if(Math.hypot(r-m.cx,o-m.cy)-m.radius>=i)continue;let u=En(m,r,o);u<i&&(i=u,s=a)}return s};return{kind:"rows",rowCount:e.length,rows:e,nearestRow:n,depthAt:t,gradientAt:(r,o)=>{let i=(t(r+.5,o)-t(r-.5,o))/1,s=(t(r,o+.5)-t(r,o-.5))/(2*.5),a=Math.hypot(i,s);return a<1e-9?[0,0]:[i/a,s/a]}}}function An(e,t){let n=[];for(let r of e){let o=gi(r.points,t);o&&n.push(o)}return n.length<2?yi(t):(n.sort((r,o)=>r.depth-o.depth),Mi(n))}var At=Ie(require("polygon-clipping"),1);var Ln=Ie(require("earcut"),1);var Si=.58,_n=.01,se=ot*1.5*me,wi=.5,Ii=.6;function vi(e,t){let n=e.length,r=[];for(let s=0;s<n;s++){let a=e[Math.max(0,s-1)],m=e[Math.min(n-1,s+1)],u=m.x-a.x,l=m.y-a.y,d=Math.hypot(u,l);if(d<1e-9){r.push([0,0]);continue}u/=d,l/=d,r.push([-l,u])}let o=0;for(let s=0;s<n;s++)o+=(e[s].x-t.x)*r[s][0]+(e[s].y-t.y)*r[s][1];return o<0?r.map(([s,a])=>[-s,-a]):r}function Ri(e,t){if(e.length<2||t<=0)return[...e];let n=[...e],r=(s,a)=>{let m=a.x-s.x,u=a.y-s.y,l=Math.hypot(m,u)||1;return{x:m/l,y:u/l}},o=r(n[1],n[0]),i=r(n[n.length-2],n[n.length-1]);return n.unshift({x:n[0].x+o.x*t,y:n[0].y+o.y*t}),n.push({x:n[n.length-1].x+i.x*t,y:n[n.length-1].y+i.y*t}),n}var kn=Math.PI/12;function Ci(e){if(e.length<3)return[...e];let t=[...e].sort((i,s)=>i.x-s.x||i.y-s.y),n=(i,s,a)=>(s.x-i.x)*(a.y-i.y)-(s.y-i.y)*(a.x-i.x),r=i=>{let s=[];for(let a of i){for(;s.length>=2&&n(s[s.length-2],s[s.length-1],a)<=0;)s.pop();s.push(a)}return s.pop(),s},o=[...r(t),...r([...t].reverse())];return o.length>=3?o:[...e]}function On(e,t){if(!e.length||!(t>0))return[];let n=Ci(e),r=(a,m,u,l)=>{let d=u-m;for(;d<0;)d+=Math.PI*2;for(;d>Math.PI*2;)d-=Math.PI*2;let c=Math.max(1,Math.ceil(d/kn)),f=t/Math.cos(d/c/2);for(let b=0;b<=c;b++){let h=m+d*b/c;l.push({x:a.x+Math.cos(h)*f,y:a.y+Math.sin(h)*f})}};if(n.length<3){let a=0,m=0;for(let f of n)a+=f.x,m+=f.y;a/=n.length||1,m/=n.length||1;let u=0;for(let f of n)u=Math.max(u,Math.hypot(f.x-a,f.y-m));let l=[],d=Math.max(3,Math.ceil(Math.PI*2/kn)),c=(u+t)/Math.cos(Math.PI/d);for(let f=0;f<d;f++){let b=f/d*Math.PI*2;l.push({x:a+Math.cos(b)*c,y:m+Math.sin(b)*c})}return l}let o=n.length,i=[];for(let a=0;a<o;a++){let m=n[a],u=n[(a+1)%o];i.push(Math.atan2(-(u.x-m.x),u.y-m.y))}let s=[];for(let a=0;a<o;a++)r(n[a],i[(a+o-1)%o],i[a],s);return jn(s)}function Pi(e,t,n){if(e.length===1)return Math.hypot(t-e[0].x,n-e[0].y);let r=1/0;for(let o=0;o+1<e.length;o++){let i=e[o],s=e[o+1],a=s.x-i.x,m=s.y-i.y,u=a*a+m*m,l=u>1e-12?((t-i.x)*a+(n-i.y)*m)/u:0;l<0?l=0:l>1&&(l=1);let d=Math.hypot(t-(i.x+l*a),n-(i.y+l*m));d<r&&(r=d)}return r}function it(e){let t=e.map(o=>{let i=0,s=0;for(let u of o.pts)i+=u.x,s+=u.y;let a=o.pts.length||1;i/=a,s/=a;let m=0;for(let u of o.pts){let l=Math.hypot(u.x-i,u.y-s);l>m&&(m=l)}return{cx:i,cy:s,rad:m}}),n=o=>{let i=o.length;return i<=2?[...o]:[o[Math.floor(i*.25)],o[Math.floor(i*.5)],o[Math.floor(i*.75)]]},r=[];for(let o=0;o<e.length;o++){let i=n(e[o].pts),s=[],a=1/0,m=null;for(let l of i){let d=1/0;for(let c=0;c<e.length;c++){if(c===o||Math.abs(e[c].y-e[o].y)<.001)continue;let f=t[c],b=Math.hypot(l.x-f.cx,l.y-f.cy)-f.rad;if(b>=d&&b>=a)continue;let h=Pi(e[c].pts,l.x,l.y);h<d&&(d=h),e[c].depth<e[o].depth&&h<a&&(a=h,m=e[c].y)}Number.isFinite(d)&&d>0&&s.push(d)}s.sort((l,d)=>l-d);let u=s.length?s[Math.floor(s.length/2)]:1;r.push({pitch:u,belowY:m})}return r}function Bn(e,t,n,r){let o=e[t],i=o.pts.length>=2?[...o.pts]:o.pts.length===1?(()=>{let l=o.pts[0],d=l.x-r.x,c=l.y-r.y,f=Math.hypot(d,c)||1;d/=f,c/=f;let b=Math.max(n[t].pitch,.001)*.5;return[{x:l.x+c*b,y:l.y-d*b},{x:l.x-c*b,y:l.y+d*b}]})():[];if(i.length<2)return null;let s=0,a=0;for(let l=1;l<i.length;l++){let d=Math.hypot(i[l].x-i[l-1].x,i[l].y-i[l-1].y);d>1e-6&&(s+=d,a++)}let m=a>0?s/a:0,u=Ri(i,Math.max(m*Ii,se));return{pts:u,nrm:vi(u,r),front:Math.max(n[t].pitch*Si,se),back:Math.max(n[t].pitch*wi,se)}}var Ce=1.5,Fn=.3;function Pt(e,t){if(e.length<3)return e;let n=e[0],r=e[e.length-1],o=r.x-n.x,i=r.y-n.y,s=Math.hypot(o,i),a=-1,m=-1;for(let d=1;d<e.length-1;d++){let c=e[d],f=s>1e-12?Math.abs((c.x-n.x)*i-(c.y-n.y)*o)/s:Math.hypot(c.x-n.x,c.y-n.y);f>a&&(a=f,m=d)}if(a<=t||m<0)return[n,r];let u=Pt(e.slice(0,m+1),t),l=Pt(e.slice(m),t);return[...u.slice(0,-1),...l]}function Dn(e,t){if(e.length<4)return e;let n=Pt([...e,e[0]],t);return n.pop(),n.length>=3?n:e}function Nn(e,t,n){if(e.length<2)return[];let r=n??it(e),o=new Map;for(let s=0;s<e.length;s++){let a=o.get(e[s].blockId);a?a.push(s):o.set(e[s].blockId,[s])}let i=[];for(let[,s]of o){let a=[];for(let g of s){let M=e[g].patch;M&&M.length>=3?i.push({outline:[...M],holes:[],topY:e[g].y}):a.push(g)}if(!a.length)continue;a.sort((g,M)=>e[g].depth-e[M].depth);let u=a.map(g=>Bn(e,g,r,t)).filter(g=>g!==null);if(!u.length)continue;let l=(g,M)=>({x:g.pts[M].x-g.nrm[M][0]*(g.front+Ce),y:g.pts[M].y-g.nrm[M][1]*(g.front+Ce)}),d=(g,M)=>({x:g.pts[M].x+g.nrm[M][0]*(g.back+Ce),y:g.pts[M].y+g.nrm[M][1]*(g.back+Ce)}),c=u[0],f=u[u.length-1],b=[];for(let g=0;g<c.pts.length;g++)b.push(l(c,g));for(let g of u)b.push(d(g,g.pts.length-1));for(let g=f.pts.length-1;g>=0;g--)b.push(d(f,g));for(let g=u.length-1;g>=0;g--)b.push(l(u[g],0));let h=jn(b),p=1/0;for(let g of a)e[g].y<p&&(p=e[g].y);if(!Number.isFinite(p))continue;if(h.length>=3&&Math.abs(he(h))>1e-6&&u.every(g=>{let M=g.pts[Math.floor(g.pts.length/2)];return Oe(h,M.x,M.y)})){i.push({outline:Dn(h,Fn),holes:[],topY:p});continue}for(let g of Ei(u))i.push({outline:g,holes:[],topY:p})}return i}function Ei(e){let t=[];for(let n of e){let r=[],o=[],i=n.front+Ce,s=n.back+Ce;for(let m=0;m<n.pts.length;m++){let u=n.pts[m],l=n.nrm[m];r.push([u.x-l[0]*i,u.y-l[1]*i]),o.push([u.x+l[0]*s,u.y+l[1]*s])}let a=[...r,...o.reverse()];a.length<3||(a.push(a[0]),t.push([a]))}if(!t.length)return[];try{let n=At.default.union(t[0],...t.slice(1)),r=[];for(let o of n){if(!o.length||o[0].length<4)continue;let i=o[0].map(([m,u])=>({x:m,y:u})),s=i[0],a=i[i.length-1];i.length>1&&Math.abs(s.x-a.x)<1e-9&&Math.abs(s.y-a.y)<1e-9&&i.pop(),i.length>=3&&r.push(Dn(i,Fn))}return r}catch{return[]}}function jn(e){let t=[];for(let n of e){let r=t[t.length-1];r&&Math.hypot(n.x-r.x,n.y-r.y)<1e-9||t.push(n)}for(;t.length>2&&Math.hypot(t[0].x-t[t.length-1].x,t[0].y-t[t.length-1].y)<1e-9;)t.pop();return t}var Et=class{constructor(t){this.minX=1/0;this.minY=1/0;this.maxX=-1/0;this.maxY=-1/0;this.rings=t;for(let n of t)for(let r of n)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(t){for(let n of t)if(n.x<this.minX||n.x>this.maxX||n.y<this.minY||n.y>this.maxY)return!1;for(let n of this.rings){let r=!0;for(let o of t)if(!Oe(n,o.x,o.y)){r=!1;break}if(r)return!0}return!1}};function Tn(e,t,n,r,o,i){if(r.length<3)return;if(n.containsAll(r)){let u=[0,1,0],l=r[0];for(let d=1;d+1<r.length;d++){let c=r[d],f=r[d+1];e.tri([l.x*C,o,l.y*C],[c.x*C,o,c.y*C],[f.x*C,o,f.y*C],u,i)}return}let s=r.map(u=>[u.x,u.y]);s.push(s[0]);let a;try{a=At.default.intersection([s],t)}catch{return}let m=[0,1,0];for(let u of a){if(!u.length||u[0].length<4)continue;let l=u[0],d=[],c=[];for(let b=0;b<l.length-1;b++)d.push(l[b][0],l[b][1]),c.push([l[b][0],l[b][1]]);if(c.length<3)continue;let f=(0,Ln.default)(d,void 0,2);for(let b=0;b<f.length;b+=3){let h=c[f[b]],p=c[f[b+1]],y=c[f[b+2]];e.tri([h[0]*C,o,h[1]*C],[p[0]*C,o,p[1]*C],[y[0]*C,o,y[1]*C],m,i)}}}function Gn(e,t,n,r,o,i,s){if(t.length<2)return;let a=s??it(t),m=[0,1,0],u=i&&i.length>=3?[[...i.map(f=>[f.x,f.y]),[i[0].x,i[0].y]]]:null,l=i&&i.length>=3?new Et([[...i]]):null,d=f=>{e.setMaterial(2),f(),e.setMaterial(0)},c=f=>{e.setMaterial(3),f(),e.setMaterial(0)};for(let f=0;f<t.length;f++){let b=t[f];if(b.patch&&b.patch.length>=3){let R=[...b.patch],S=a[f].belowY??r;if(c(()=>{if(u&&l)Tn(e,u,l,R,b.y,o.tread);else{let I=R[0];for(let _=1;_+1<R.length;_++){let B=R[_],N=R[_+1];e.tri([I.x*C,b.y,I.y*C],[B.x*C,b.y,B.y*C],[N.x*C,b.y,N.y*C],m,o.tread)}}}),b.y>S+_n){let I=0,_=0;for(let B of R)I+=B.x,_+=B.y;I/=R.length,_/=R.length,d(()=>{for(let B=0;B<R.length;B++){let N=R[B],G=R[(B+1)%R.length],P=G.x-N.x,w=G.y-N.y,k=Math.hypot(P,w);if(k<1e-6)continue;let F=w/k,v=-P/k;(N.x-I)*F+(N.y-_)*v<0&&(F=-F,v=-v);let T=[F,0,v],E=[N.x*C,b.y,N.y*C],A=[G.x*C,b.y,G.y*C],L=[N.x*C,S,N.y*C],D=[G.x*C,S,G.y*C];e.tri(E,A,D,T,o.riser),e.tri(E,D,L,T,o.riser)}})}continue}let h=Bn(t,f,a,n);if(!h)continue;let{pts:p,nrm:y,front:g,back:M}=h,x=a[f].belowY??r;for(let R=0;R+1<p.length;R++){let S=p[R],I=p[R+1],_=y[R],B=y[R+1];if(Math.hypot(I.x-S.x,I.y-S.y)<1e-6||_[0]===0&&_[1]===0||B[0]===0&&B[1]===0)continue;let N=[(S.x-_[0]*g)*C,b.y,(S.y-_[1]*g)*C],G=[(I.x-B[0]*g)*C,b.y,(I.y-B[1]*g)*C],P=[(S.x+_[0]*M)*C,b.y,(S.y+_[1]*M)*C],w=[(I.x+B[0]*M)*C,b.y,(I.y+B[1]*M)*C];if(c(()=>{u&&l?Tn(e,u,l,[{x:S.x-_[0]*g,y:S.y-_[1]*g},{x:I.x-B[0]*g,y:I.y-B[1]*g},{x:I.x+B[0]*M,y:I.y+B[1]*M},{x:S.x+_[0]*M,y:S.y+_[1]*M}],b.y,o.tread):(e.tri(N,G,w,m,o.tread),e.tri(N,w,P,m,o.tread))}),b.y>x+_n){let k=[N[0],x,N[2]],F=[G[0],x,G[2]],v=[-_[0],0,-_[1]];d(()=>{e.tri(N,G,F,v,o.riser),e.tri(N,F,k,v,o.riser)})}}}}function Un(e){let t=1/0,n=1/0,r=-1/0,o=-1/0,i=!1;for(let s of e)!Number.isFinite(s.x)||!Number.isFinite(s.y)||(i=!0,s.x<t&&(t=s.x),s.y<n&&(n=s.y),s.x>r&&(r=s.x),s.y>o&&(o=s.y));return i?{minX:t,minY:n,maxX:r,maxY:o}:null}function st(e,t){return e.minX<=t.maxX&&t.minX<=e.maxX&&e.minY<=t.maxY&&t.minY<=e.maxY}var _t=Ie(require("polygon-clipping"),1);function Ai(e,t){let n=e.eventConfigurationIds;return!n?.length||!!t&&n.includes(t)}function Yn(e,t){return e.filter(n=>n.type!=="shape"||Ai(n,t))}function Xn(e,t){let n=e.focalPoint??{x:0,y:0};return e.floors?.length?e.floors.map((r,o)=>({objects:Yn(r.objects,t),focal:{x:(r.focalPoint??n).x,y:(r.focalPoint??n).y},baseHeightM:r.baseHeightM??0,index:o})):[{objects:Yn(e.objects,t),focal:n,baseHeightM:0,index:0}]}var _i={minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};function Pe(e){return Un(e)??_i}function Vn(e,t){let n=tt(e.outline,se),r=Pe(n),o=t.filter(s=>s!==e&&s.outline&&s.outline.length>=3&&st(r,Pe(s.outline)));if(!o.length)return[n];let i=s=>{let a=s.map(m=>[m.x,m.y]);return a.push(a[0]),a};try{let s=_t.default.difference([i(n)],...o.map(m=>[i(m.outline)])),a=[];for(let m of s){if(!m.length)continue;let u=m[0].map(([l,d])=>({x:l,y:d}));if(u.length>1){let l=u[0],d=u[u.length-1];Math.abs(l.x-d.x)<1e-9&&Math.abs(l.y-d.y)<1e-9&&u.pop()}u.length>=3&&a.push(u)}return a.length?a:[n]}catch{return[n]}}function Hn(e,t){if(!t.length)return e;let n=i=>{let s=i.map(a=>[a.x,a.y]);return s.push(s[0]),s},r=t.map(i=>[n(i)]),o=[];for(let i of e){let s;try{s=_t.default.intersection([n(i.outline)],r.flat())}catch{o.push(i);continue}for(let a of s){if(!a.length)continue;let m=a[0].map(([u,l])=>({x:u,y:l}));if(m.length>1){let u=m[0],l=m[m.length-1];Math.abs(u.x-l.x)<1e-9&&Math.abs(u.y-l.y)<1e-9&&m.pop()}m.length>=3&&o.push({outline:m,holes:[],topY:i.topY})}}return o.length?o:e}var ki=.05,Kn=.05,Ti=.15,kt=25;function zn(e,t,n){let r=new Map,o=new Array(t.length).fill(null),i=new Float64Array(t.length),s=new Array(t.length).fill(void 0),a=new Array(t.length).fill(void 0),m=new Map,u=[],l=new Set;for(let c=0;c<e.length;c+=1){let f=e[c];for(let b of f.objects){if(b.type==="table"&&l.add(b.id),b.type!=="section"||!b.outline||b.outline.length<3)continue;let h=tt(b.outline,se);m.set(b.id,{section:b,unit:f,frontU:1/0,hasSeats:!1,rows:new Map,seatIndices:[]}),u.push({id:b.id,floorIndex:c,box:Pe(h),section:b,unit:f,outline:h})}}let d=new Map;for(let c of u){let f=d.get(c.floorIndex);f?f.push(c):d.set(c.floorIndex,[c])}for(let c=0;c<t.length;c++){let f=t[c],b=n?d.get(n[c])??[]:u,h=f.sectionId?b.find(y=>y.id===f.sectionId)??b.find(y=>y.section.logicalSectionId===f.sectionId&&pe({x:f.x,y:f.y},y.outline,y.section.holes)):void 0,p=h?[h]:b;for(let y of p){if(n&&y.floorIndex!==n[c]||!h&&(f.x<y.box.minX||f.x>y.box.maxX||f.y<y.box.minY||f.y>y.box.maxY||!pe({x:f.x,y:f.y},y.outline,y.section.holes)))continue;o[c]=y.id;let g=m.get(y.id);g.hasSeats=!0;let M=f.focalPoint??y.unit.focal,x=Math.hypot(f.x-M.x,f.y-M.y);x<g.frontU&&(g.frontU=x),g.seatIndices.push(c);let R=f.rowId||`__seat-${c}`,S=g.rows.get(R);S?S.push({x:f.x,y:f.y}):g.rows.set(R,[{x:f.x,y:f.y}]);break}}for(let[c,f]of m){let b=Ke(f.section,{floorBaseHeightM:f.unit.baseHeightM}),h=f.unit.baseHeightM,p=b.rake>0?Math.tan(b.rake*Math.PI/180):0,y=b.rake<=.01&&b.height<=h+.001,g=f.section.surfaceKind,M=g==="flat"?!0:g==="rakedRows"&&b.rake>.01?!1:y,x=f.hasSeats?ze(c,t,f.seatIndices,f.unit.focal):{sectionId:c,rows:[],blockCount:0},S=x.rows.length<2?An([...f.rows.values()].map(E=>({points:E})),f.unit.focal):null,I=1/0;if(S){if(f.hasSeats)for(let E of f.rows.values())for(let A of E){let L=S.depthAt(A.x,A.y);L<I&&(I=L)}if(!f.hasSeats||!Number.isFinite(I)){I=1/0;for(let E of f.section.outline){let A=S.depthAt(E.x,E.y);A<I&&(I=A)}}}let _=h+ki,B=Math.max(_,b.height),N=E=>{let A=Math.max(0,E-I)*te,L=Math.min(A*p,kt);return Math.max(_,b.height+L)},G=E=>{let A=Math.max(0,E)*te,L=Math.min(A*p,kt);return Math.max(_,b.height+L)},P=M?[]:x.rows.map(E=>({pts:E.pts,y:G(E.blockDepth),depth:E.blockDepth,blockId:E.blockId,...l.has(E.id)?{patch:On(E.pts,se)}:{}})),w=P.length?P[0].y:B,k=P.map(E=>{let A=E.patch&&E.patch.length>=3?E.patch:E.pts,L=0,D=0;for(let U of A)L+=U.x,D+=U.y;let j=A.length||1;L/=j,D/=j;let Y=0;for(let U of A){let X=Math.hypot(U.x-L,U.y-D);X>Y&&(Y=X)}return{cx:L,cy:D,rad:Y}}),F=M?()=>B:P.length>=2?(E,A)=>{let L=1/0,D=w;for(let j=0;j<P.length;j++){let Y=k[j];if(Math.hypot(E-Y.cx,A-Y.cy)-Y.rad>=L)continue;let U=P[j].patch,X=U&&U.length>=3?Oe(U,E,A)?0:ve(U,E,A):ve(P[j].pts,E,A);X<L&&(L=X,D=P[j].y)}return D}:(E,A)=>S?N(S.depthAt(E,A)):B,v=[0,1,0],T=P.length>=2||M?()=>v:(E,A)=>{if(!S)return v;let L=S.depthAt(E,A);if(L<=I)return v;let D=(L-I)*te;if(D*p>=kt||b.height+D*p<=_)return v;let[j,Y]=S.gradientAt(E,A);if(j===0&&Y===0)return v;let U=1/Math.hypot(p,1);return[-j*p*U,U,-Y*p*U]};if(!M)for(let E of x.rows){let A=G(E.blockDepth);for(let L of E.seatIndices)s[L]=A}for(let E of x.rows){let A=[];for(let U=1;U<E.pts.length;U++){let X=Math.hypot(E.pts[U].x-E.pts[U-1].x,E.pts[U].y-E.pts[U-1].y);X>1e-6&&A.push(X)}A.sort((U,X)=>U-X);let L=A.length?A[Math.floor(A.length/2)]:1/0,D=1/0,j=E.pts[Math.floor(E.pts.length/2)];if(j)for(let U of x.rows){if(U===E||U.blockId!==E.blockId)continue;let X=ve(U.pts,j.x,j.y);X>1e-6&&X<D&&(D=X)}let Y=Math.min(L,Math.max(D,L*.5));if(Number.isFinite(Y)&&Y>0)for(let U of E.seatIndices)a[U]=Y}r.set(c,{sectionId:c,deckAt:F,normalAt:T,flat:M,bottomY:h,rowLevels:P,landingY:w})}for(let c=0;c<t.length;c++){let f=o[c],b=t[c];if(f){let p=s[c];i[c]=(p??r.get(f).deckAt(b.x,b.y))+Ti;continue}let h=b.eyeHeightM;i[c]=Number.isFinite(h)?Math.max(0,h-ce):0}return{bySection:r,seatOwner:o,seatDeckY:c=>i[c],seatPitchU:c=>a[c]}}var Q={top:1,wallBottom:.5,bottomCap:.4};function ue(e,t){if(!e)return t;let n=ie(Le(e,.4),.62);return ne(t,n,.72)}function Wn(e,t){let n=new Map;for(let i of e.categories??[])n.set(i.key,i.color);let r=new Map;for(let i of t){if(!i.sectionId)continue;let s=r.get(i.sectionId);s||(s=new Map,r.set(i.sectionId,s)),s.set(i.categoryKey,(s.get(i.categoryKey)??0)+1)}let o=new Map;for(let[i,s]of r){let a=0,m=0,u=0,l=0;for(let[d,c]of s){let f=W(n.get(d));f&&(a+=f[0]*c,m+=f[1]*c,u+=f[2]*c,l+=c)}l>0&&o.set(i,[a/l,m/l,u/l])}return o}function Zn(e,t){return W(e.color)??t.get(e.logicalSectionId??e.id)??null}var $n=Ie(require("polygon-clipping"),1);function Li(e,t){return e===void 0||t===void 0?!0:Math.abs(e-t)<.001}var at=class{constructor(){this.rings=[];this.boxes=[];this.levels=[]}subtract(t,n){let r=t.map(m=>[m.x,m.y]);if(r.length<3)return[];r.push(r[0]);let o=Pe(t),i=this.rings.filter((m,u)=>st(o,this.boxes[u])&&Li(n,this.levels[u])),s=[[r]];if(i.length)try{s=$n.default.difference([r],...i).map(u=>u.map(l=>l.map(([d,c])=>[d,c])))}catch{s=[[r]]}this.rings.push([r]),this.boxes.push(o),this.levels.push(n);let a=[];for(let m of s){if(!m.length)continue;let u=m[0].map(([l,d])=>({x:l,y:d}));if(u.length>1){let l=u[0],d=u[u.length-1];Math.abs(l.x-d.x)<1e-9&&Math.abs(l.y-d.y)<1e-9&&u.pop()}u.length>=3&&a.push(u)}return a}};function Oi(e,t){if(!t)return e;let n=1/0,r=-1/0,o=1/0,i=-1/0;for(let d of e)n=Math.min(n,d.x),r=Math.max(r,d.x),o=Math.min(o,d.y),i=Math.max(i,d.y);let s=(n+r)/2,a=(o+i)/2,m=t*Math.PI/180,u=Math.cos(m),l=Math.sin(m);return e.map(d=>{let c=d.x-s,f=d.y-a;return{x:s+c*u-f*l,y:a+c*l+f*u}})}function ge(e){let t=null;if(e.kind==="polygon"&&e.points&&e.points.length>=3&&(t=e.points),e.kind==="rect"&&e.width&&e.height&&(t=De(e.x??0,e.y??0,e.width,e.height)),e.kind==="ellipse"&&e.width&&e.height){let n=(e.x??0)+e.width/2,r=(e.y??0)+e.height/2;t=nt(n,r,e.width/2,e.height/2)}return t?Oi(t,e.rotation):null}function Ne(e){let t=e.role??"",n={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=t==="stage"&&We(e.stageKind)?{kind:"stage",heightM:.06}:n[t]??{kind:"plate",heightM:.25};return{...r,heightM:e.heightM??r.heightM}}var Bi=.08;function Qn(e,t){let n=ge(e),r=Ne(e),o=r.heightM;if(!n||r.kind!=="plate"&&r.kind!=="stage")return o;let i=1/0,s=1/0,a=-1/0,m=-1/0;for(let l of n)i=Math.min(i,l.x),s=Math.min(s,l.y),a=Math.max(a,l.x),m=Math.max(m,l.y);let u=o;for(let l of t)a>l.minX&&i<l.maxX&&m>l.minY&&s<l.maxY&&u<=l.topOffsetM+1e-6&&(u=l.topOffsetM+Bi);return t.push({minX:i,minY:s,maxX:a,maxY:m,topOffsetM:u}),u}function de(e,t,n){return{x:e.x+(t.x-e.x)*n,y:e.y+(t.y-e.y)*n}}function qn(e){if(e.length!==4)return e;let t=Math.hypot(e[1].x-e[0].x,e[1].y-e[0].y),n=Math.hypot(e[2].x-e[1].x,e[2].y-e[1].y);return t>=n?e:[e[1],e[2],e[3],e[0]]}function je(e,t,n){return[de(e[0],e[1],t),de(e[0],e[1],n),de(e[3],e[2],n),de(e[3],e[2],t)]}function Jn(e,t,n){return[de(e[0],e[3],t),de(e[1],e[2],t),de(e[1],e[2],n),de(e[0],e[3],n)]}function le(e,t,n,r,o,i){J(e,t,void 0,()=>n,r,o,i,Q)}var Tt=2.4,Fi=.75,Di=.15;function Ge(e){if(e.points&&e.points.length>=3)return e.points;let{center:t,width:n,height:r,rotation:o}=e;if(!n||!r)return null;let i=(o??0)*Math.PI/180,s=Math.cos(i),a=Math.sin(i),m=n/2,u=r/2;return[[-m,-u],[m,-u],[m,u],[-m,u]].map(([l,d])=>({x:t.x+l*s-d*a,y:t.y+l*a+d*s}))}function eo(e,t,n,r,o){let i=Ge(t);i&&J(e,i,void 0,()=>n+Tt,n,ue(r,o.boothTop),o.boothWall,Q)}function Lt(e){if(e.shape==="round"){let l=e.radius;return l?nt(e.center.x,e.center.y,l,l,24):null}let{width:t,height:n,rotation:r,center:o}=e;if(!t||!n)return null;let i=(r??0)*Math.PI/180,s=Math.cos(i),a=Math.sin(i),m=t/2,u=n/2;return[[-m,-u],[m,-u],[m,u],[-m,u]].map(([l,d])=>({x:o.x+l*s-d*a,y:o.y+l*a+d*s}))}function to(e,t,n,r,o){let i=Lt(t);i&&J(e,i,void 0,()=>n+Fi,n,ue(r,o.tableTop),o.tableWall,Q)}function no(e,t,n,r,o,i,s,a){let m=ge(t);if(!m)return;let u=a?a.kind==="stage":t.role==="stage",l=a?a.kind==="screen":t.role==="screen",d=a?{kind:u?"stage":"solid",heightM:a.topY-a.baseY}:Ne(t),c=a?.baseY??n,f=a?.topY??n+r;if(u&&s){let g=1/0,M=-1/0,x=1/0,R=-1/0;for(let S of m)S.x<g&&(g=S.x),S.x>M&&(M=S.x),S.y<x&&(x=S.y),S.y>R&&(R=S.y);s.push({cx:(g+M)/2*C,cz:(x+R)/2*C,y:f,halfX:Math.max((M-g)/2*C,.5),halfZ:Math.max((R-x)/2*C,.5)})}let b=W(t.fill),h=u&&b?ne(o.stageTop,ie(Le(b,.18),.9),.9):ue(b,u?o.stageTop:o.decorTop),p=l?b:null,y=u?b?ne(o.stageWall,ie(b,.58),.82):o.stageWall:l?p?ne(ie(p,1.42),[.24,.46,.82],.08):[.24,.46,.82]:ue(W(t.fill),o.decorWall);if(d.kind==="portal"&&m.length===4){let g=qn(m);le(e,je(g,0,.16),f,c,h,y),le(e,je(g,.84,1),f,c,h,y),le(e,g,f,Math.max(c,f-.35),h,y);return}if(d.kind==="suite"&&m.length===4){let g=m.map((R,S)=>{let I=m[(S+1)%4],_=(R.x+I.x)/2,B=(R.y+I.y)/2;return Math.hypot(_-i.x,B-i.y)}),M=g.indexOf(Math.min(...g)),x=[0,1,2,3].map(R=>m[(M+R)%4]);le(e,je(x,0,.08),f,c,h,y),le(e,je(x,.92,1),f,c,h,y),le(e,Jn(x,.88,1),f,c,h,y),le(e,x,f,Math.max(c,f-.18),h,y);return}le(e,m,f,c,h,y)}function Ot(e){let{x:t,y:n,width:r,height:o}=e;if(!r||!o)return null;let i=t+r/2,s=n+o/2,a=(e.rotation??0)*Math.PI/180,m=Math.cos(a),u=Math.sin(a),l=r/2,d=o/2;return[[-l,-d],[l,-d],[l,d],[-l,d]].map(([c,f])=>({x:i+c*m-f*u,y:s+c*u+f*m}))}function Ni(e){if(!e||!e.startsWith("data:image/svg+xml"))return null;let t=e.slice(e.indexOf(",")+1);if(/;base64/i.test(e.slice(0,e.indexOf(","))))try{t=atob(t)}catch{return null}else try{t=decodeURIComponent(t)}catch{}let n=t.match(/<(?:rect|path)\b[^>]*\bfill="([^"]+)"/i);if(!n)return null;let r=n[1].trim();if(r==="none"||r==="transparent")return null;let o=r.match(/^url\(#([^)]+)\)$/);if(!o)return W(r);let i=t.match(new RegExp(`<(?:linear|radial)Gradient\\b[^>]*\\bid="${o[1]}"[^>]*>([\\s\\S]*?)</(?:linear|radial)Gradient>`,"i"));if(!i)return null;let s=[];for(let a of i[1].matchAll(/stop-color="([^"]+)"/gi)){let m=W(a[1].trim());m&&s.push(m)}return s.length?s.reduce((a,m,u)=>ne(a,m,1/(u+1)),s[0]):null}function oo(e,t,n,r){if(t.layer==="foreground")return;let o=Ot(t);if(!o)return;let i=n+Di,s=ue(Ni(t.href),r.decorTop),a=Math.max(0,Math.min(1,t.opacity??1));a<1&&(s=ne(r.ground,s,a)),J(e,o,void 0,()=>i,n,s,ne(s,r.decorWall,.5),Q)}function ro(e,t,n,r,o){if(!t.points||t.points.length<3)return;let i=ue(r,o.gaTop);J(e,t.points,t.holes,()=>n+.15,n,i,o.gaWall,Q)}var ji=Math.PI/180,K=96,Gi=6,Ui=60,Yi=150,io=.2,Xi=.35;function Vi(e,t){let n=Math.atan2(t.x-e.x,t.y-e.y)/ji;return n<0?n+360:n}function ct(e){if(!e.length)return NaN;let t=[...e].sort((n,r)=>n-r);return t[Math.floor(t.length/2)]}function ut(e,t,n=2){let r=e.length,o=new Float64Array(r);for(let i=0;i<r;i++){let s=0,a=0;for(let m=-n;m<=n;m++){let u=i+m;if(t)u=(u%r+r)%r;else if(u<0||u>=r)continue;s+=e[u],a++}o[i]=s/a}return o}function so(e,t){let n=e.filter(c=>c.rows.length>=1);if(n.length<1)return null;let r=[],o=0,i=0,s=0;for(let c of n)for(let f of c.rows){for(let b of f.pts)o+=b.x,i+=b.y,s++;if(f.pts.length>=4){let b=xt(f.pts);b&&Number.isFinite(b.cx)&&Number.isFinite(b.cy)&&r.push({x:b.cx,y:b.cy})}}if(!s)return null;let a={x:o/s,y:i/s},m=a;if(r.length>=8){let c=ct(r.map(y=>y.x)),f=ct(r.map(y=>y.y)),b=0;for(let y of n)for(let g of y.rows)for(let M of g.pts){let x=Math.hypot(M.x-a.x,M.y-a.y);x>b&&(b=x)}let h=0,p=b*.2;for(let y of n)for(let g of y.rows)for(let M of g.pts)Math.hypot(M.x-c,M.y-f)<p&&h++;Math.hypot(c-a.x,f-a.y)<=b&&h/s<.01&&(m={x:c,y:f})}let u=[];for(let c of n){let f={sectionId:c.sectionId,rMin:1/0,rMax:-1/0,samples:[]};for(let b of c.rows)for(let h of b.pts){let p=Math.hypot(h.x-m.x,h.y-m.y),y=Math.min(K-1,Math.floor(Vi(m,h)/(360/K)));f.samples.push({r:p,bin:y,levelM:b.levelM}),p<f.rMin&&(f.rMin=p),p>f.rMax&&(f.rMax=p)}f.samples.length&&u.push(f)}if(!u.length)return null;u.sort((c,f)=>c.rMin+c.rMax-(f.rMin+f.rMax));let l=[];for(let c of u){let f=!1;for(let b of l){let h=Math.min(c.rMax,b.rMax)-Math.max(c.rMin,b.rMin),p=Math.min(c.rMax-c.rMin,b.rMax-b.rMin);if(p>1e-9&&h>=Xi*p){b.members.push(c),b.rMin=Math.min(b.rMin,c.rMin),b.rMax=Math.max(b.rMax,c.rMax),f=!0;break}}f||l.push({members:[c],rMin:c.rMin,rMax:c.rMax})}let d=[];for(let c of l){let f=new Array(K).fill(null);for(let w of c.members)for(let k of w.samples){let F=f[k.bin];F||(F={samples:[]},f[k.bin]=F),F.samples.push({r:k.r,levelM:k.levelM})}let b=f.map(w=>!!w);if(!b.filter(Boolean).length)continue;let p=[],y=[];for(let w of f){if(!w)continue;let k=1/0,F=-1/0;for(let v of w.samples)v.r<k&&(k=v.r),v.r>F&&(F=v.r);p.push(k),y.push(F)}let g=ct(p),M=ct(y);if(!(g>=io*M)||!(M>0))continue;let x=[...p].sort((w,k)=>w-k);if(!(x[Math.floor(x.length*.1)]>=io*M))continue;let S=f.map(w=>{if(!w)return null;let k=[...w.samples].sort((j,Y)=>j.r-Y.r),F=k[0].r,v=k[k.length-1].r,T=k[0].levelM,E=-1/0;for(let j of k)j.levelM>E&&(E=j.levelM);let A=[];for(let j of k){let Y={r:j.r,l:j.levelM};for(;A.length&&Math.abs(A[A.length-1].r-Y.r)<1e-9;){if(A[A.length-1].l<=Y.l){Y.skip=!0;break}A.pop()}if(!Y.skip){for(;A.length>=2;){let U=A[A.length-2],X=A[A.length-1];if((X.r-U.r)*(Y.l-U.l)-(X.l-U.l)*(Y.r-U.r)<=0)A.pop();else break}A.push(Y)}}let L=A.map(j=>j.r),D=A.map(j=>j.l);return{inner:F,outer:v,front:T,top:E,profile:{rs:L,ls:D}}}),I=b.slice();for(let w=0;w<K;w++){if(I[w])continue;let k=-1,F=-1,v=0;for(let O=1;O<=K;O++){let V=(w-O+K*2)%K;if(I[V]){k=V;break}}for(let O=1;O<=K;O++){let V=(w+O)%K;if(I[V]){F=V,v=O;break}}if(k<0||F<0)continue;let T=0;for(let O=1;O<=K;O++){let V=(w-O+K*2)%K;if(b[V]){T=O;break}}if(T-1+v>Gi)continue;let A=S[k],L=S[F],D=T/(T+v),j=A.inner+(L.inner-A.inner)*D,Y=A.outer+(L.outer-A.outer)*D,U=A.front+(L.front-A.front)*D,X=A.top+(L.top-A.top)*D;S[w]={inner:j,outer:Y,front:U,top:X,profile:{rs:[j,Y],ls:[U,X]}}}for(let w=0;w<K;w++)S[w]&&(I[w]=!0);let _=360/K,B=[],N=I.filter(Boolean).length,G=[];if(N===K)G.push({start:0,len:K});else{let w=0;for(;I[w];)w=(w+1)%K;let k=-1;for(let F=0;F<=K;F++){let v=(w+F)%K,T=F<K&&I[v];if(T&&k<0)k=v;else if(!T&&k>=0){let E=(v-k+K)%K||K;G.push({start:k,len:E}),k=-1}}}for(let w of G){if(w.len*_<Ui&&w.len<K)continue;let k=w.len===K,F=new Float64Array(w.len),v=new Float64Array(w.len),T=new Float64Array(w.len),E=new Float64Array(w.len),A=[];for(let O=0;O<w.len;O++){let V=S[(w.start+O)%K];F[O]=V.inner,v[O]=V.outer,T[O]=V.front,E[O]=V.top,A.push(V.profile??{rs:[V.inner,V.outer],ls:[V.front,V.top]})}let L=ut(F,k),D=ut(v,k),j=ut(T,k),Y=ut(E,k);for(let O=0;O<w.len;O++)L[O]>F[O]&&(L[O]=F[O]),D[O]<v[O]&&(D[O]=v[O]),L[O]>D[O]-1e-6&&(L[O]=Math.max(0,D[O]-1e-6)),Y[O]<j[O]&&(Y[O]=j[O]);let U={startBin:w.start,binCount:w.len,closed:k,innerR:L,outerR:D,frontLevelM:j,topLevelM:Y,profiles:A},X=(O,V,H)=>{let $=A[O],Z=$.rs,z=$.ls;if(V<=Z[0]){z[0]>H&&(z[0]=H);return}if(V>=Z[Z.length-1]){z[z.length-1]>H&&(z[z.length-1]=H);return}for(let q=0;q+1<Z.length;q++)if(V<=Z[q+1]){z[q]>H&&(z[q]=H),z[q+1]>H&&(z[q+1]=H);return}};for(let O=0;O<w.len;O++){let V=f[(w.start+O)%K];if(V)for(let H of V.samples){X(O,H.r,H.levelM);let $=k?(O-1+w.len)%w.len:O-1,Z=k?(O+1)%w.len:O+1;$>=0&&X($,H.r,H.levelM),Z<w.len&&X(Z,H.r,H.levelM)}}B.push(U)}B.reduce((w,k)=>w+k.binCount*_,0)<Yi||d.push({arcs:B,sectionIds:c.members.map(w=>w.sectionId),innerRMedian:g,outerRMedian:M})}if(!d.length)return null;if(d.sort((c,f)=>c.innerRMedian-f.innerRMedian),t){let c=d[d.length-1].outerRMedian;if(Math.hypot(t.x-m.x,t.y-m.y)>.9*c)return null}return{centre:m,binCount:K,binStepDeg:360/K,rings:d}}function ao(e,t,n,r){let o=e.binStepDeg,i=n/o-.5-t.startBin;i=(i%e.binCount+e.binCount)%e.binCount,i>t.binCount-1&&(t.closed?i=i-t.binCount<t.binCount-i?0:t.binCount-1:i=i-(t.binCount-1)<e.binCount-i?t.binCount-1:0);let s=Math.floor(i),a=t.closed?(s+1)%t.binCount:Math.min(t.binCount-1,s+1),m=i-s,u=l=>{let d=t.profiles[l],c=d.rs,f=d.ls;if(r<=c[0])return f[0];if(r>=c[c.length-1])return f[f.length-1];for(let b=0;b+1<c.length;b++)if(r<=c[b+1]){let h=c[b+1]-c[b],p=h>1e-9?(r-c[b])/h:0;return f[b]+(f[b+1]-f[b])*p}return f[f.length-1]};return u(s)*(1-m)+u(a)*m}var Hi=.25,Ki=1.2,zi=.6,Wi=.45,Zi=2.3,$i=Math.PI/180;function xe(e,t,n){let r=n*$i;return{x:e.x+t*Math.sin(r),y:e.y+t*Math.cos(r)}}function Qi(e,t){let n=t.rings[t.rings.length-1];if(!n)return!1;let r=n.outerRMedian*.85;for(let o of e){if(o.role!=="wall")continue;let i=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(i.length<2)continue;let s=0;for(let a of i)Math.hypot(a.x-t.centre.x,a.y-t.centre.y)>=r&&s++;if(s>=i.length/2)return!0}return!1}var qi=24;function Ji(e,t,n,r,o,i,s,a){let m=n.binCount,u=qi,l=te,d=i+.02,c=[];for(let P=0;P<m;P++){let w=(n.startBin+P+.5)*t.binStepDeg,k=new Float64Array(u+1);for(let F=0;F<=u;F++){let v=r[P]+(o[P]-r[P])*F/u;k[F]=Math.max(d,ao(t,n,w,v)-Hi)}c.push(k)}let f=[s.bandTop[0]*a.top,s.bandTop[1]*a.top,s.bandTop[2]*a.top],b=[s.bandTop[0]*a.bottomCap,s.bandTop[1]*a.bottomCap,s.bandTop[2]*a.bottomCap],h=[s.bandWall[0]*a.top,s.bandWall[1]*a.top,s.bandWall[2]*a.top],p=[s.bandWall[0]*a.wallBottom,s.bandWall[1]*a.wallBottom,s.bandWall[2]*a.wallBottom],y=(P,w)=>{let k=(n.startBin+P+.5)*t.binStepDeg,F=r[P]+(o[P]-r[P])*w/u,v=xe(t.centre,F,k);return[v.x*l,c[P][w],v.y*l]};{let P=Math.tan(12*Math.PI/180);for(let w=0;w<6;w++){let k=!1;for(let v=0;v<m;v++)for(let T=u-1;T>=0;T--)c[v][T]>c[v][T+1]&&(c[v][T]=c[v][T+1],k=!0);let F=n.closed?m:m-1;for(let v=0;v<F;v++){let T=(v+1)%m;for(let E=0;E<=u;E++){let A=c[T][E]-c[v][E];if(Math.abs(A)>1)continue;let L=r[v]+(o[v]-r[v])*E/u,D=r[T]+(o[T]-r[T])*E/u,j=xe(t.centre,L,(n.startBin+v+.5)*t.binStepDeg),Y=xe(t.centre,D,(n.startBin+T+.5)*t.binStepDeg),U=P*Math.hypot(Y.x-j.x,Y.y-j.y)*l;A>U?(c[T][E]=c[v][E]+U,k=!0):-A>U&&(c[v][E]=c[T][E]+U,k=!0)}}if(!k)break}}let g=1,M=(P,w)=>{for(let k=0;k<=u;k+=4)if(Math.abs(c[P][k]-c[w][k])>g)return!0;return Math.abs(c[P][u]-c[w][u])>g},x=Math.tan(38*Math.PI/180),R=P=>(o[P]-r[P])/u*l,S=(P,w)=>c[P][w+1]-c[P][w]>x*Math.max(1e-6,R(P)),I=(P,w)=>{let k=n.closed?(P-1+m)%m:Math.max(0,P-1),F=n.closed?(P+1)%m:Math.min(m-1,P+1);Math.abs(c[k][w]-c[P][w])>g&&(k=P),Math.abs(c[F][w]-c[P][w])>g&&(F=P);let v=Math.max(0,w-1),T=Math.min(u,w+1);v<w&&S(P,v)&&(v=w),T>w&&S(P,w)&&(T=w);let E=y(k,w),A=y(F,w),L=y(P,v),D=y(P,T),j=A[0]-E[0],Y=A[1]-E[1],U=A[2]-E[2],X=D[0]-L[0],O=D[1]-L[1],V=D[2]-L[2],H=Y*V-U*O,$=U*X-j*V,Z=j*O-Y*X,z=Math.hypot(H,$,Z);return z>1e-12?(H/=z,$/=z,Z/=z,$<0&&(H=-H,$=-$,Z=-Z),[H,$,Z]):[0,1,0]},_=(P,w)=>{let k=[P[0],i,P[2]],F=[w[0],i,w[2]],v=w[0]-P[0],T=w[2]-P[2],E=Math.hypot(v,T);if(!(E>1e-12))return;let A=[T/E,0,-v/E];e.tri(P,w,F,A,h,h,p),e.tri(P,F,k,A,h,p,p)},B=.05*me,N=P=>o[P]-r[P]<B,G=n.closed?m:m-1;for(let P=0;P<G;P++){let w=(P+1)%m;if(N(P)||N(w))continue;if(M(P,w)){let A=(n.startBin+P+1)*t.binStepDeg,L=(O,V)=>{let H=(r[P]+r[w])/2,$=(o[P]+o[w])/2,Z=H+($-H)*V/u,z=xe(t.centre,Z,A);return[z.x*l,c[O][V],z.y*l]};for(let O=0;O<u;O++){let V=y(P,O),H=y(P,O+1),$=L(P,O),Z=L(P,O+1),z=I(P,O),q=I(P,O+1);e.triN(V,$,Z,z,z,q,f),e.triN(V,Z,H,z,q,q,f);let Ue=y(w,O),Ye=y(w,O+1),Me=L(w,O),Ee=L(w,O+1),Se=I(w,O),we=I(w,O+1);e.triN(Me,Ue,Ye,Se,Se,we,f),e.triN(Me,Ye,Ee,Se,we,we,f);let fe=L(P,O),ae=L(P,O+1),Xe=L(w,O+1),ft=L(w,O),Ve=ae[0]-fe[0],Ae=ae[2]-fe[2],mt=Math.hypot(Ve,Ae);if(mt>1e-12){let Ft=[Ae/mt,0,-Ve/mt];e.tri(fe,ae,Xe,Ft,h),e.tri(fe,Xe,ft,Ft,h)}}let D=y(P,0),j=y(w,0),Y=y(w,u),U=y(P,u),X=O=>[O[0],i,O[2]];e.tri(X(D),X(Y),X(j),[0,-1,0],b),e.tri(X(D),X(U),X(Y),[0,-1,0],b),_(D,j),_(U,Y);continue}for(let A=0;A<u;A++){let L=I(P,A),D=I(w,A),j=I(w,A+1),Y=I(P,A+1);if(S(P,A)||S(w,A)){let H=(ae,Xe)=>{let ft=(n.startBin+ae+.5)*t.binStepDeg,Ve=r[ae]+(o[ae]-r[ae])*(A+.5)/u,Ae=xe(t.centre,Ve,ft);return[Ae.x*l,Xe,Ae.y*l]},$=y(P,A),Z=y(w,A),z=H(P,c[P][A]),q=H(w,c[w][A]);e.triN($,Z,q,L,D,D,f),e.triN($,q,z,L,D,L,f);let Ue=y(w,A+1),Ye=y(P,A+1),Me=H(P,c[P][A+1]),Ee=H(w,c[w][A+1]);e.triN(Me,Ee,Ue,Y,j,j,f),e.triN(Me,Ue,Ye,Y,j,Y,f);let Se=q[0]-z[0],we=q[2]-z[2],fe=Math.hypot(Se,we);if(fe>1e-12){let ae=[-we/fe,0,Se/fe];e.tri(z,q,Ee,ae,h),e.tri(z,Ee,Me,ae,h)}continue}let U=y(P,A),X=y(w,A),O=y(w,A+1),V=y(P,A+1);e.triN(U,X,O,L,D,j,f),e.triN(U,O,V,L,j,Y,f)}let k=y(P,0),F=y(w,0),v=y(w,u),T=y(P,u),E=A=>[A[0],i,A[2]];e.tri(E(k),E(v),E(F),[0,-1,0],b),e.tri(E(k),E(T),E(v),[0,-1,0],b),_(k,F),_(T,v)}if(!n.closed)for(let P of[0,m-1])for(let w=0;w<u;w++)_(y(P,w),y(P,w+1))}function co(e,t,n){let{bottomY:r,colors:o,ao:i}=n,s=new Float64Array(t.binCount).fill(-1/0);for(let l of t.rings)for(let d of l.arcs){let c=new Float64Array(d.binCount),f=new Float64Array(d.binCount);for(let h=0;h<d.binCount;h++){let p=(d.startBin+h)%t.binCount,y=Math.max(0,d.innerR[h]-se);c[h]=Math.max(y,s[p]+.001),f[h]=Math.max(c[h]+.001,d.outerR[h]+se)}let b=0;for(let h=0;h<d.binCount;h++){let p=d.topLevelM[h]-r;p>b&&(b=p)}b>=Ki&&Ji(e,t,d,c,f,r,o,i);for(let h=0;h<d.binCount;h++){let p=(d.startBin+h)%t.binCount;f[h]>s[p]&&(s[p]=f[h])}}if(n.deriveShell===!1||Qi(n.shapes,t))return;let a=t.rings[t.rings.length-1],m=zi*me,u=Wi*me;for(let l of a.arcs){let d=[],c=[];for(let h=0;h<l.binCount;h++){let p=(l.startBin+h+.5)*t.binStepDeg,y=l.outerR[h]+se+m;d.push(xe(t.centre,y,p)),c.push(xe(t.centre,y+u,p))}let f=-1/0;for(let h=0;h<l.binCount;h++)l.topLevelM[h]>f&&(f=l.topLevelM[h]);let b=()=>f+Zi;l.closed?J(e,c,[d.slice().reverse()],b,r,o.shellTop,o.shellWall,i):J(e,[...c,...d.slice().reverse()],void 0,b,r,o.shellTop,o.shellWall,i)}}function uo(e,t,n,r,o,i,s,a){if(!t.outline||t.outline.length<3)return;let m=n.baseHeightM,u=ue(r,a.tierTop);if(!o)return;let l=p=>o.deckAt(p.x,p.y),d=Vn(t,s),c=d[0]??t.outline;if(o.rowLevels.length>=2){let p=it(o.rowLevels),y=Hn(Nn(o.rowLevels,n.focal,p),d),g=()=>[0,1,0];for(let x of y){let R=Math.max(m,x.topY-.02);for(let S of i.subtract(x.outline,R))J(e,S,x.holes,()=>R,m,u,a.tierWall,Q,void 0,g)}y.length||J(e,c,t.holes,()=>o.landingY,m,u,a.tierWall,Q);let M={tread:[u[0]*Q.top,u[1]*Q.top,u[2]*Q.top],riser:[u[0]*.72,u[1]*.72,u[2]*.72]};for(let x of d.length?d:[c])Gn(e,o.rowLevels,n.focal,o.landingY,M,x,p);return}let f=o.flat?1/0:Kn,b=p=>o.normalAt(p.x,p.y),h=o.flat?o.landingY:void 0;for(let p of i.subtract(c,h))J(e,p,t.holes,l,m,u,a.tierWall,Q,f,b)}function es(e,t,n){let r=new Set;for(let s of e.objects)s.type==="section"&&r.add(s.id);let o=new Map;for(let s=0;s<t.length;s++){let a=n.seatOwner[s];if(!a||!r.has(a))continue;let m=n.bySection.get(a);if(m&&m.rowLevels.length>=2)continue;let u=t[s],l=o.get(a);l||(l=new Map,o.set(a,l));let d=u.rowId||`__seat-${s}`,c=l.get(d);c||(c={pts:[],levelM:0,n:0},l.set(d,c)),c.pts.push({x:u.x,y:u.y}),c.levelM+=n.seatDeckY(s),c.n++}let i=[];for(let s of e.objects){if(s.type!=="section")continue;let a=n.bySection.get(s.id);if(a&&a.rowLevels.length>=2){let u=a.rowLevels.filter(l=>!l.patch).map(l=>({pts:l.pts,levelM:l.y}));u.length>=2&&i.push({sectionId:s.id,rows:u});continue}let m=o.get(s.id);m&&i.push({sectionId:s.id,rows:[...m.values()].map(u=>({pts:u.pts,levelM:u.levelM/u.n}))})}return i}function lo(e,t,n,r,o,i,s=!0){let a=es(t,n,r);if(!a.length)return;let m=so(a,t.focal);m&&(e.setMaterial(0),co(e,m,{bottomY:t.baseHeightM,colors:{bandTop:ie(o.tierTop,.8),bandWall:o.tierWall,shellTop:i??ie(o.tierWall,1.15),shellWall:i??o.tierWall},ao:Q,shapes:t.objects.filter(u=>u.type==="shape"),deriveShell:s}))}var fo=/^[\p{L}\p{N}]{1,4}$/u,ts=/^([\p{L}\p{N}]{2,})[\s\-\u2013\u2014\u00b7_./]+(.+)$/u;function mo(e,t){let n=t?.trim();if(!n)return e;let r=e.toLocaleLowerCase("en-US"),o=n.toLocaleLowerCase("en-US");if(r.startsWith(`${o} `)){let s=e.slice(n.length).trim();if(fo.test(s))return s}let i=ts.exec(e);if(i){let s=i[1].toLocaleLowerCase("en-US"),a=i[2].trim();if((o.startsWith(s)||s.startsWith(o))&&fo.test(a))return a}return e}var ns=6,os=2.2,bo=.1,rs=.3,is=1.8,ss=.9,as=.55,cs=6e3;function po(e){let{doc:t,units:n,seats:r,surfaces:o,focal:i}=e,s=t.zones??[],a=[];if(s.length){let m=new Map;for(let l of n)for(let d of l.objects)d.type==="section"&&d.zone&&m.set(d.id,d.zone);let u=new Map;for(let l=0;l<r.length;l++){let d=r[l],c=o.seatOwner[l],f=d.zoneId??(c?m.get(c):void 0);if(!f)continue;let b=u.get(f);b||(b={n:0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0,sumY:0},u.set(f,b)),b.n++,d.x<b.minX&&(b.minX=d.x),d.y<b.minY&&(b.minY=d.y),d.x>b.maxX&&(b.maxX=d.x),d.y>b.maxY&&(b.maxY=d.y),b.sumY+=o.seatDeckY(l)}for(let l of s){let d=u.get(l.id),c=[];for(let[f,b]of m)b===l.id&&c.push(f);if(!d||d.n===0){a.push({id:l.id,label:l.label,color:W(l.color),sectionIds:c,seatCount:0,center:[0,0,0],radius:0,focalWorld:[(l.focalPoint??i).x*C,1.5,(l.focalPoint??i).y*C]});continue}a.push({id:l.id,label:l.label,color:W(l.color),sectionIds:c,seatCount:d.n,center:[(d.minX+d.maxX)/2*C,d.sumY/d.n,(d.minY+d.maxY)/2*C],radius:.5*Math.hypot((d.maxX-d.minX)*C,(d.maxY-d.minY)*C)||1,focalWorld:[(l.focalPoint??i).x*C,1.5,(l.focalPoint??i).y*C]})}}return a}function ho(e){let{doc:t,units:n,seats:r,surfaces:o,seatData:i,hintedSeatFloor:s,zones:a,focal:m}=e,u=[],l=[],d=[];for(let c of a)c.seatCount!==0&&u.push({id:`zone:${c.id}`,kind:"zone",text:c.label,anchor:[c.center[0],c.center[1]+ns,c.center[2]],color:t.zones?.find(f=>f.id===c.id)?.color});{let c=new Map,f=new Map;for(let b=0;b<r.length;b++){let h=o.seatOwner[b];if(!h)continue;let p=c.get(h);p||(p={n:0,x:0,y:0,deck:0},c.set(h,p)),p.n++,p.x+=r[b].x,p.y+=r[b].y,p.deck+=o.seatDeckY(b);let y=f.get(h);y||(y={minX:1/0,maxX:-1/0,minY:1/0,maxY:-1/0},f.set(h,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 n)for(let h of b.objects){if(h.type!=="section")continue;let p=c.get(h.id);if(!p||p.n===0)continue;let y=f.get(h.id),g=[p.x/p.n*C,p.deck/p.n,p.y/p.n*C],M=h.displayLabel||h.label||h.id;l.push({id:h.id,floorIndex:b.index,label:M,seatCount:p.n,center:g,radius:Math.max(1,Math.hypot(y.maxX-y.minX,y.maxY-y.minY)*.5*C),focalWorld:[b.focal.x*C,b.baseHeightM+1.5,b.focal.y*C]});let x=t.floors?.[b.index]?.name?.trim().toLocaleLowerCase();n.length>1&&x===M.trim().toLocaleLowerCase()||u.push({id:`section:${h.id}`,kind:"section",text:M,anchor:[g[0],g[1]+os,g[2]],floorIndex:b.index})}}{for(let h of n)for(let p of h.objects){if(p.type!=="gaArea")continue;let y=_e(p.points);if(!y)continue;let g=p.displayLabel||p.label||p.id;u.push({id:`ga:${p.id}`,kind:"ga",text:p.capacity>0?`${g} \xB7 ${p.capacity.toLocaleString()}`:g,anchor:[y.x*C,h.baseHeightM+is,y.y*C],floorIndex:h.index})}let c=new Map;for(let h of n)for(let p of h.objects)p.type==="section"&&c.set(p.id,p.displayLabel||p.label||p.id);let f=new Map;for(let h=0;h<r.length;h++){let p=r[h],y=Math.hypot(p.x-m.x,p.y-m.y),g=f.get(p.rowId);(!g||y>g.far)&&f.set(p.rowId,{seat:p,index:h,far:y})}for(let[h,p]of f){let y=ls(p.seat.label,h,c.get(p.seat.sectionId??""));y&&u.push({id:`row:${h}`,kind:"row",text:y,anchor:[p.seat.x*C,o.seatDeckY(p.index)+ss,p.seat.y*C],floorIndex:s[p.index]})}let b=new Map;for(let h=0;h<r.length;h++){let p=r[h],y=p.label?p.label.lastIndexOf("-"):-1,g=b.get(p.rowId);g||(g={n:0,x:0,y:0,z:0,minX:1/0,maxX:-1/0,minZ:1/0,maxZ:-1/0,label:y>0?p.label.slice(0,y):p.rowId,sectionId:p.sectionId},b.set(p.rowId,g));let M=h*3,x=i.iPosition[M],R=i.iPosition[M+1],S=i.iPosition[M+2];g.n++,g.x+=x,g.y+=R,g.z+=S,g.minX=Math.min(g.minX,x),g.maxX=Math.max(g.maxX,x),g.minZ=Math.min(g.minZ,S),g.maxZ=Math.max(g.maxZ,S)}for(let[h,p]of b)d.push({id:h,label:p.label,sectionId:p.sectionId,seatCount:p.n,center:[p.x/p.n,p.y/p.n,p.z/p.n],radius:Math.max(.8,Math.hypot(p.maxX-p.minX,p.maxZ-p.minZ)*.5)});if(r.length<=cs)for(let h=0;h<r.length;h++){let p=r[h],y=us(p.displayLabel||p.label);y&&u.push({id:`seat:${p.id}`,kind:"seat",text:y,anchor:[p.x*C,o.seatDeckY(h)+as,p.y*C],floorIndex:s[h]})}}for(let c of n)for(let f of c.objects)if(f.type==="shape"&&f.role&&["entrance","exit","screen","suite","obstruction"].includes(f.role)){let b=ge(f),h=b?_e(b):null;if(!h||!f.label)continue;u.push({id:`architecture:${f.id}`,kind:"annotation",text:f.label,anchor:[h.x*C,c.baseHeightM+Ne(f).heightM+bo,h.y*C],color:f.fill,floorIndex:c.index})}else if(f.type==="text"){if(!f.text)continue;u.push({id:`text:${f.id}`,kind:"annotation",text:f.text,anchor:[f.position.x*C,c.baseHeightM+bo,f.position.y*C],color:f.color,rotation:f.rotation,floorIndex:c.index})}else if(f.type==="booth"){let b=Ge(f);if(!b)continue;let h=_e(b);if(!h)continue;u.push({id:`booth:${f.id}`,kind:"booth",text:f.displayLabel||f.label||f.id,anchor:[h.x*C,c.baseHeightM+Tt+rs,h.y*C],floorIndex:c.index})}return{labels:u,sections:l,rows:d}}function yo(e,t){if(t.length>1)for(let n of t)e.push({id:`floor:${n.id}`,kind:"floor",text:n.label,anchor:[n.center[0],n.box.max[1]+1.2,n.center[2]],floorIndex:n.index})}function us(e){let t=e.lastIndexOf("-");return t>=0&&t<e.length-1?e.slice(t+1):e}function ls(e,t,n){let r=e?e.lastIndexOf("-"):-1,o=r>0?e.slice(0,r):t;return o&&mo(o,n)}function go(e){let{doc:t,units:n,seats:r,surfaces:o,solids:i,hintedSeatFloor:s,seatFloor:a}=e,m=[];{let u=n.map(()=>({minX:1/0,minY:1/0,minZ:1/0,maxX:-1/0,maxY:-1/0,maxZ:-1/0}));for(let c=0;c<i.floor.length;c+=1){let f=Math.max(0,Math.min(n.length-1,Math.round(i.floor[c]))),b=c*3,h=u[f];h.minX=Math.min(h.minX,i.position[b]),h.minY=Math.min(h.minY,i.position[b+1]),h.minZ=Math.min(h.minZ,i.position[b+2]),h.maxX=Math.max(h.maxX,i.position[b]),h.maxY=Math.max(h.maxY,i.position[b+1]),h.maxZ=Math.max(h.maxZ,i.position[b+2])}let l=new Map;for(let c=0;c<n.length;c++)for(let f of n[c].objects)f.type==="section"&&l.set(f.id,c);let d=n.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 c=0;c<r.length;c++){let f=o.seatOwner[c],b=(f!==null?l.get(f):void 0)??s[c];if(b===void 0)continue;let h=d[b],p=r[c];h.n++,p.x<h.minX&&(h.minX=p.x),p.y<h.minY&&(h.minY=p.y),p.x>h.maxX&&(h.maxX=p.x),p.y>h.maxY&&(h.maxY=p.y);let y=o.seatDeckY(c);h.sumX+=p.x*C,h.sumDeck+=y,h.sumZ+=p.y*C,h.minDeck=Math.min(h.minDeck,y),h.maxDeck=Math.max(h.maxDeck,y+1.6),a[c]=b}for(let c=0;c<n.length;c++){let f=d[c],b=t.floors?.[c],h=u[c],p=Math.min(f.n?f.minX*C:n[c].focal.x*C-1,Number.isFinite(h.minX)?h.minX:1/0),y=Math.max(f.n?f.maxX*C:n[c].focal.x*C+1,Number.isFinite(h.maxX)?h.maxX:-1/0),g=Math.min(f.n?f.minY*C:n[c].focal.y*C-1,Number.isFinite(h.minZ)?h.minZ:1/0),M=Math.max(f.n?f.maxY*C:n[c].focal.y*C+1,Number.isFinite(h.maxZ)?h.maxZ:-1/0),x=Math.min(f.n?Math.min(n[c].baseHeightM,f.minDeck):n[c].baseHeightM,Number.isFinite(h.minY)?h.minY:1/0),R=Math.max(f.n?Math.max(f.maxDeck,x+.5):x+.5,Number.isFinite(h.maxY)?h.maxY:-1/0),S=[f.n?f.sumX/f.n:(p+y)/2,f.n?f.sumDeck/f.n:(x+R)/2,f.n?f.sumZ/f.n:(g+M)/2],I=Math.max(1,.5*Math.hypot(y-p,R-x,M-g));m.push({index:c,id:b?.id??`floor-${c}`,label:b?.name??(n.length>1?`Floor ${c+1}`:"Venue"),seatCount:f.n,center:S,radius:I,box:{min:[p,x,g],max:[y,R,M]},focalWorld:[n[c].focal.x*C,n[c].baseHeightM+1.5,n[c].focal.y*C]})}}return m}function Bt(e,t){let n=1/0,r=1/0,o=-1/0,i=-1/0,s=(a,m)=>{a<n&&(n=a),m<r&&(r=m),a>o&&(o=a),m>i&&(i=m)};for(let a of t)s(a.x,a.y);for(let a of e)for(let m of a.objects)if(m.type==="section")for(let u of m.outline)s(u.x,u.y);else if(m.type==="shape"&&m.points)for(let u of m.points)s(u.x,u.y);else if(m.type==="gaArea")for(let u of m.points)s(u.x,u.y);else if(m.type==="booth"){let u=Ge(m);if(u)for(let l of u)s(l.x,l.y)}else if(m.type==="table"){let u=Lt(m);if(u)for(let l of u)s(l.x,l.y)}else if(m.type==="decorImage"){let u=Ot(m);if(u)for(let l of u)s(l.x,l.y)}return Number.isFinite(n)||(n=-100,r=-100,o=100,i=100),{minX:n,minY:r,maxX:o,maxY:i}}function xo(e,t,n,r,o,i){if(t.length===1){let s=Math.max(60,(o.maxX-o.minX+o.maxY-o.minY)*.06),a=De(o.minX-s,o.minY-s,o.maxX-o.minX+s*2,o.maxY-o.minY+s*2);J(e,a,void 0,()=>0,-.4,i.ground,i.ground,Q)}else{let s=t.reduce((f,b)=>b.baseHeightM<f.baseHeightM?b:f);e.setFloor(s.index);let a=n.filter((f,b)=>r[b]===s.index),m=Bt([s],a),u=Math.hypot(m.maxX-m.minX,m.maxY-m.minY),l=Math.max(28,Math.min(80,u*.04)),d=De(m.minX-l,m.minY-l,m.maxX-m.minX+l*2,m.maxY-m.minY+l*2),c=s.baseHeightM-.03;J(e,d,void 0,()=>c,c-.22,i.ground,i.ground,Q)}}function Mo(e,t,n){let{cx:r,cz:o,radius:i}=n,s=1/0,a=1/0,m=1/0,u=-1/0,l=-1/0,d=-1/0,c=(h,p,y)=>{s=Math.min(s,h),u=Math.max(u,h),a=Math.min(a,p),l=Math.max(l,p),m=Math.min(m,y),d=Math.max(d,y)};for(let h=0;h<e.position.length;h+=3)c(e.position[h],e.position[h+1],e.position[h+2]);for(let h=0;h<t.count;h++){let p=h*3,y=t.iPosition[p],g=t.iPosition[p+1],M=t.iPosition[p+2],x=Math.max(.35,t.iMaxRadius[h]??.35);c(y-x,g,M-x),c(y+x,g+1.6,M+x)}Number.isFinite(s)||(s=r-i,u=r+i,a=0,l=i*.16,m=o-i,d=o+i);let f=[(s+u)/2,(a+l)/2,(m+d)/2],b=Math.max(1,.5*Math.hypot(u-s,l-a,d-m));return{center:f,radius:b,minY:a,maxY:l}}function So(e,t,n,r,o,i){let s=1/0,a=1/0,m=-1/0,u=-1/0;for(let x=0;x<e.count;x++){let R=x*3,S=e.iPosition[R],I=e.iPosition[R+2];S<s&&(s=S),S>m&&(m=S),I<a&&(a=I),I>u&&(u=I)}for(let x of t)s=Math.min(s,x.cx-x.halfX),m=Math.max(m,x.cx+x.halfX),a=Math.min(a,x.cz-x.halfZ),u=Math.max(u,x.cz+x.halfZ);let l=n.minX*C,d=n.maxX*C,c=n.minY*C,f=n.maxY*C,b=l,h=d,p=c,y=f;if(Number.isFinite(s)){let x=Math.max(2,.06*Math.hypot(m-s,u-a));b=Math.max(l,s-x),h=Math.min(d,m+x),p=Math.max(c,a-x),y=Math.min(f,u+x)}let g=Math.min(0,r),M=Math.max(o,i*.05);return{min:[b,g,p],max:[h,M,y]}}function wo(e,t,n){let r=()=>({byObjectId:new Map,elements:[]});if(!t||!e)return r();let o=$t(t);if(!o.ok||o.value.id!==e)return r();let i=new Map;for(let d of n)for(let c of d.objects)c.type==="shape"&&i.set(c.id,{shape:c,unit:d});let s=new Set,a=new Set,m=new Map((t.overlay.productionElements??[]).map(d=>{let c=d.runtimeContentImageUrl;return[d.id,typeof c=="string"&&/^(?:blob:|data:image\/|https:\/\/)/.test(c)?c:void 0]})),u=[];for(let d of o.value.overlay.productionElements??[]){let c=i.get(d.objectId),f=c?ge(c.shape):null,b=d.baseElevationM??0;if(!c||!f||f.length<3||!d.id||s.has(d.id)||a.has(d.objectId)||!Number.isFinite(d.heightM)||d.heightM<.05||d.heightM>50||!Number.isFinite(b)||b<-10||b>100)return r();s.add(d.id),a.add(d.objectId);let h=f.map(_=>_.x*C),p=f.map(_=>_.y*C),y=c.unit.baseHeightM+b,g=Math.min(...h),M=Math.max(...h),x=Math.min(...p),R=Math.max(...p),S,I=m.get(d.id)??d.contentImageUrl;if(d.kind==="screen"&&I)if(M-g>=R-x){let _=Math.abs(x-c.unit.focal.y*C)<=Math.abs(R-c.unit.focal.y*C)?x-.006:R+.006;S=[[g,y,_],[M,y,_],[g,y+d.heightM,_],[M,y+d.heightM,_]]}else{let _=Math.abs(g-c.unit.focal.x*C)<=Math.abs(M-c.unit.focal.x*C)?g-.006:M+.006;S=[[_,y,x],[_,y,R],[_,y+d.heightM,x],[_,y+d.heightM,R]]}u.push({id:d.id,objectId:d.objectId,kind:d.kind,floorIndex:c.unit.index,baseY:y,topY:y+d.heightM,bounds:{min:[g,y,x],max:[M,y+d.heightM,R]},occlusion:d.occlusion,...I?{contentImageUrl:I}:{},...S?{contentPlane:S}:{}})}let l=u.sort((d,c)=>d.id.localeCompare(c.id));return{byObjectId:new Map(l.map(d=>[d.objectId,d])),elements:l}}function re(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function oe(e){return Array.isArray(e)?e:[]}function fs(e){let t=[e];for(;t.length;){let n=t.pop();if(Array.isArray(n)){t.push(...n);continue}if(!re(n))continue;let r=re(n.extensions)?n.extensions:null;if(r&&Object.prototype.hasOwnProperty.call(r,"KHR_draco_mesh_compression"))return!0;t.push(...Object.values(n))}return!1}function lt(e,t){return!Array.isArray(e)||e.length!==t||!e.every(n=>typeof n=="number"&&Number.isFinite(n))?null:e}function ms(){return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}function ds(e,t){let n=new Array(16).fill(0);for(let r=0;r<4;r++)for(let o=0;o<4;o++)for(let i=0;i<4;i++)n[r*4+o]+=e[i*4+o]*t[r*4+i];return n}function bs(e){let t=lt(e.matrix,16);if(t)return t;if(e.matrix!==void 0)return null;let n=e.translation===void 0?[0,0,0]:lt(e.translation,3),r=e.rotation===void 0?[0,0,0,1]:lt(e.rotation,4),o=e.scale===void 0?[1,1,1]:lt(e.scale,3);if(!n||!r||!o)return null;let[i,s,a,m]=r,u=Math.hypot(i,s,a,m);if(!(u>1e-8))return null;let l=i/u,d=s/u,c=a/u,f=m/u,b=l+l,h=d+d,p=c+c,y=l*b,g=l*h,M=l*p,x=d*h,R=d*p,S=c*p,I=f*b,_=f*h,B=f*p;return[(1-(x+S))*o[0],(g+B)*o[0],(M-_)*o[0],0,(g-B)*o[1],(1-(y+S))*o[1],(R+I)*o[1],0,(M+_)*o[2],(R-I)*o[2],(1-(y+x))*o[2],0,n[0],n[1],n[2],1]}function ps(e,t,n,r){return[e[0]*t+e[4]*n+e[8]*r+e[12],e[1]*t+e[5]*n+e[9]*r+e[13],e[2]*t+e[6]*n+e[10]*r+e[14]]}function hs(e){let t=e[0],n=e[4],r=e[8],o=e[1],i=e[5],s=e[9],a=e[2],m=e[6],u=e[10],l=i*u-s*m,d=s*a-o*u,c=o*m-i*a,f=t*l+n*d+r*c;if(Math.abs(f)<1e-12)return null;let b=1/f;return[l*b,d*b,c*b,(r*m-n*u)*b,(t*u-r*a)*b,(n*a-t*m)*b,(n*s-r*i)*b,(r*o-t*s)*b,(t*i-n*o)*b]}function Io(e,t,n,r){let o=e[0]*t+e[1]*n+e[2]*r,i=e[3]*t+e[4]*n+e[5]*r,s=e[6]*t+e[7]*n+e[8]*r,a=Math.hypot(o,i,s)||1;return o/=a,i/=a,s/=a,[o,i,s]}function ys(e){if(e.byteLength<20||e.byteLength>8388608)return null;let t=new DataView(e.buffer,e.byteOffset,e.byteLength);if(t.getUint32(0,!0)!==1179937895||t.getUint32(4,!0)!==2||t.getUint32(8,!0)!==e.byteLength)return null;let n=12,r=null,o=null;for(;n+8<=e.byteLength;){let i=t.getUint32(n,!0),s=t.getUint32(n+4,!0);if(n+=8,i%4!==0||n+i>e.byteLength)return null;let a=e.subarray(n,n+i);if(s===1313821514&&!r)try{let m=JSON.parse(new TextDecoder().decode(a).replace(/[\u0000 ]+$/g,""));if(!re(m))return null;r=m}catch{return null}else if(s===5130562&&!o)o=a;else return null;n+=i}return n===e.byteLength&&r&&o?{json:r,bin:o}:null}function gs(e){return e===5120||e===5121?1:e===5122||e===5123?2:e===5125||e===5126?4:0}function xs(e){return e==="SCALAR"?1:e==="VEC2"?2:e==="VEC3"?3:e==="VEC4"?4:0}function Ms(e,t,n){return n===5120?e.getInt8(t):n===5121?e.getUint8(t):n===5122?e.getInt16(t,!0):n===5123?e.getUint16(t,!0):n===5125?e.getUint32(t,!0):e.getFloat32(t,!0)}function Ss(e){let t=e instanceof Uint8Array?e:new Uint8Array(e),n=ys(t);if(!n)return{ok:!1,issue:"invalid_glb"};let{json:r,bin:o}=n;if(!re(r.asset)||r.asset.version!=="2.0")return{ok:!1,issue:"unsupported_glb"};let i=oe(r.extensionsUsed).filter(x=>typeof x=="string");if(i.includes("KHR_draco_mesh_compression")||fs(r))return{ok:!1,issue:"draco_not_allowed"};if(i.length||oe(r.extensionsRequired).length)return{ok:!1,issue:"unsupported_glb"};if(oe(r.images).length||oe(r.textures).length)return{ok:!1,issue:"external_resource"};let s=oe(r.buffers);if(s.length!==1||!re(s[0])||s[0].uri!==void 0||typeof s[0].byteLength!="number"||!Number.isInteger(s[0].byteLength)||s[0].byteLength<0||s[0].byteLength>o.byteLength)return{ok:!1,issue:"external_resource"};let a=oe(r.accessors),m=oe(r.bufferViews),u=oe(r.meshes),l=oe(r.nodes),d=oe(r.scenes),c=typeof r.scene=="number"?r.scene:0;if(!re(d[c]))return{ok:!1,issue:"unsupported_glb"};let f=new DataView(o.buffer,o.byteOffset,o.byteLength),b=(x,R,S)=>{if(typeof x!="number"||!Number.isInteger(x)||!re(a[x]))return null;let I=a[x];if(I.type!==R||I.sparse!==void 0||I.normalized===!0||typeof I.count!="number"||!Number.isInteger(I.count)||I.count<1||typeof I.componentType!="number"||!S.includes(I.componentType)||typeof I.bufferView!="number")return null;let _=m[I.bufferView];if(!re(_)||_.buffer!==0||typeof _.byteLength!="number"||!Number.isInteger(_.byteLength)||_.byteLength<0)return null;let B=xs(I.type),N=gs(I.componentType),G=typeof _.byteStride=="number"?_.byteStride:B*N,P=typeof _.byteOffset=="number"?_.byteOffset:0,w=typeof I.byteOffset=="number"?I.byteOffset:0,k=P+w,F=w+(I.count-1)*G+B*N;if(!Number.isInteger(G)||!Number.isInteger(P)||!Number.isInteger(w)||G<B*N||P<0||w<0||P+_.byteLength>o.byteLength||F>_.byteLength)return null;let v=[];for(let T=0;T<I.count;T++){let E=[];for(let A=0;A<B;A++){let L=Ms(f,k+T*G+A*N,I.componentType);if(!Number.isFinite(L))return null;E.push(L)}v.push(E)}return v},h=[],p=[],y=0,g=new Set,M=(x,R)=>{if(typeof x!="number"||!Number.isInteger(x)||!re(l[x])||g.has(x))return!1;g.add(x);let S=l[x],I=bs(S);if(!I)return!1;let _=ds(R,I),B=hs(_);if(!B)return!1;if(S.mesh!==void 0){if(typeof S.mesh!="number")return!1;let N=u[S.mesh];if(!re(N))return!1;for(let G of oe(N.primitives)){if(!re(G)||G.mode!==void 0&&G.mode!==4||!re(G.attributes))return!1;let P=b(G.attributes.POSITION,"VEC3",[5126]),w=G.attributes.NORMAL===void 0?null:b(G.attributes.NORMAL,"VEC3",[5126]);if(!P||G.attributes.NORMAL!==void 0&&!w)return!1;let k=P.length;if(G.indices!==void 0){let v=typeof G.indices=="number"?a[G.indices]:null;k=re(v)?v.count:void 0}if(typeof k!="number"||!Number.isInteger(k)||k%3!==0||(y+=k/3,y>1e5))return!1;let F=G.indices===void 0?P.map((v,T)=>[T]):b(G.indices,"SCALAR",[5121,5123,5125]);if(!F||F.length%3!==0||F.length!==k)return!1;for(let v=0;v<F.length;v+=3){let T=[F[v][0],F[v+1][0],F[v+2][0]];if(T.some(L=>!Number.isInteger(L)||L<0||L>=P.length))return!1;let E=T.map(L=>ps(_,...P[L])),A=null;if(!w){let L=E[1][0]-E[0][0],D=E[1][1]-E[0][1],j=E[1][2]-E[0][2],Y=E[2][0]-E[0][0],U=E[2][1]-E[0][1],X=E[2][2]-E[0][2];A=Io([1,0,0,0,1,0,0,0,1],D*X-j*U,j*Y-L*X,L*U-D*Y)}for(let L=0;L<3;L++)h.push(...E[L]),p.push(...w?Io(B,...w[T[L]]):A)}}}for(let N of oe(S.children))if(!M(N,_))return!1;return g.delete(x),!0};for(let x of oe(d[c].nodes))if(!M(x,ms()))return{ok:!1,issue:y>1e5?"triangle_limit":"unsupported_glb"};return!y||h.length!==y*9||p.length!==h.length?{ok:!1,issue:"unsupported_glb"}:{ok:!0,triangleCount:y,position:new Float32Array(h),normal:new Float32Array(p)}}function vo(e){try{return Ss(e)}catch{return{ok:!1,issue:"invalid_glb"}}}function Ro(e){let{doc:t}=e,n=dn(t.theme),r=n.structure,o=Xn(t,e.eventConfigurationId??t.eventConfigurationId),i=wo(e.eventConfigurationId,e.eventConfiguration,o),s=e.seats,a=new et,m=null;if(e.registeredShellGlb){let v=vo(e.registeredShellGlb);if(v.ok){let T=v.position.length/3,E=new Float32Array(v.position.length),A=n.materials.shell??r.tierWall;for(let L=0;L<T;L++){let D=v.normal[L*3+1],j=D<-.25?.4:.62+.38*Math.max(0,D);E[L*3]=A[0]*j,E[L*3+1]=A[1]*j,E[L*3+2]=A[2]*j}m={position:v.position,normal:v.normal,color:E,floor:new Float32Array(T).fill(-2),material:new Float32Array(T),count:T}}}let u=new Map;for(let v of o)for(let T of v.objects)u.set(T.id,v.index),T.type==="section"&&u.set(T.logicalSectionId??T.id,v.index);let l=s.map(v=>u.get(v.sectionId??"")??u.get(v.rowId??"")??0),d=Bt(o,s);xo(a,o,s,l,d,r);let c=Wn(t,s),f=new Map,b=new Map;for(let v of t.categories??[])f.set(v.key,v.color),v.seatGlyph&&b.set(v.key,v.seatGlyph);let h=[],p=zn(o,s,l),y=new Float32Array(s.length),g=[];for(let v=0;v<o.length;v++){let T=o[v];a.setFloor(v);let E=new at,A=[],L=T.objects.filter(D=>D.type==="section"&&!!D.outline&&D.outline.length>=3);for(let D of T.objects)if(D.type==="section"){let j=a.vertexCount;uo(a,D,T,Zn(D,c),p.bySection.get(D.id),E,L,r);let Y=a.vertexCount-j;Y>0&&g.push({sectionId:D.id,start:j,count:Y})}else if(D.type==="shape"){let j=i.byObjectId.get(D.id);a.setMaterial((j?.kind??D.role)==="screen"?1:0),no(a,D,T.baseHeightM,Qn(D,A),r,T.focal,h,j),a.setMaterial(0)}else D.type==="gaArea"?ro(a,D,T.baseHeightM,W(f.get(D.categoryKey)),r):D.type==="booth"?eo(a,D,T.baseHeightM,W(f.get(D.categoryKey)),r):D.type==="table"?to(a,D,T.baseHeightM,W(D.fill??t.theme?.decorFill??"#232c40"),r):D.type==="decorImage"&&oo(a,D,T.baseHeightM,r);lo(a,T,s,p,r,n.materials.shell,!m)}let M=o.length>1?{x:o.reduce((v,T)=>v+T.focal.x,0)/o.length,y:o.reduce((v,T)=>v+T.focal.y,0)/o.length}:t.focalPoint??{x:(d.minX+d.maxX)/2,y:(d.minY+d.maxY)/2},x=gn(m?[a.build(),m]:[a.build()]),R=Pn(s,e.initialState,p,y,f,b),S=po({doc:t,units:o,seats:s,surfaces:p,focal:M}),{labels:I,sections:_,rows:B}=ho({doc:t,units:o,seats:s,surfaces:p,seatData:R,hintedSeatFloor:l,zones:S,focal:M}),N=go({doc:t,units:o,seats:s,surfaces:p,solids:x,hintedSeatFloor:l,seatFloor:y});yo(I,N),R.iYaw=Cn(R.iPosition,s.length,v=>s[v].rowId,v=>{let T=o[y[v]]?.focal??M;return[T.x*C,T.y*C]});let G=(d.minX+d.maxX)/2*C,P=(d.minY+d.maxY)/2*C,w=.5*Math.hypot((d.maxX-d.minX)*C,(d.maxY-d.minY)*C)||10,k=Mo(x,R,{cx:G,cz:P,radius:w}),F=So(R,h,d,k.minY,k.maxY,w);return{solids:x,sectionSolidRanges:g,seats:R,bounds:{center:[(F.min[0]+F.max[0])/2,(F.min[1]+F.max[1])/2,(F.min[2]+F.max[2])/2],radius:w,groundY:0,box:F},renderBounds:{center:k.center,radius:k.radius},stateColorLUT:bn(n,Qe),theme:n,seatCount:s.length,focalWorld:[M.x*C,1.5,M.y*C],zones:S,stages:h,productionElements:i.elements,sections:_,rows:B,labels:I,floors:N}}function ws(e){return[e.solids.position,e.solids.normal,e.solids.color,e.solids.floor,e.solids.material,e.seats.iPosition,e.seats.iState,e.seats.iCategory,e.seats.iMaxRadius,e.seats.iRing,e.seats.iFloor,e.seats.iYaw,e.seats.iChairWidth,e.seats.iGlyph,e.seats.iPhysicalSeat].map(n=>n.buffer)}var Co=self;Co.onmessage=e=>{let t=performance.now(),n=!e.data.seats,r=e.data.seats??un(e.data.doc),o=Ro({doc:e.data.doc,seats:r,eventConfigurationId:e.data.eventConfigurationId,eventConfiguration:e.data.eventConfiguration,registeredShellGlb:e.data.registeredShellGlb});Co.postMessage({model:o,buildMs:performance.now()-t,...n?{seats:r}:{}},ws(o))};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{x as n}from"../../chunk-
|
|
1
|
+
import{x as n}from"../../chunk-FMPQZEXD.js";import"../../chunk-EH47GKSO.js";import"../../chunk-QJXSZT3H.js";import"../../chunk-77QFA3F4.js";import"../../chunk-4I2VWFJY.js";import"../../chunk-UL5OIGIF.js";import{Na as o}from"../../chunk-W4RS6OW7.js";import"../../chunk-5ITK5236.js";import"../../chunk-JBOTRSMY.js";import"../../chunk-CRCGO52K.js";function d(e){return[e.solids.position,e.solids.normal,e.solids.color,e.solids.floor,e.solids.material,e.seats.iPosition,e.seats.iState,e.seats.iCategory,e.seats.iMaxRadius,e.seats.iRing,e.seats.iFloor,e.seats.iYaw,e.seats.iChairWidth,e.seats.iGlyph,e.seats.iPhysicalSeat].map(s=>s.buffer)}var i=self;i.onmessage=e=>{let a=performance.now(),s=!e.data.seats,t=e.data.seats??o(e.data.doc),r=n({doc:e.data.doc,seats:t,eventConfigurationId:e.data.eventConfigurationId,eventConfiguration:e.data.eventConfiguration,registeredShellGlb:e.data.registeredShellGlb});i.postMessage({model:r,buildMs:performance.now()-a,...s?{seats:t}:{}},d(r))};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@seatlayer/core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.90.0",
|
|
4
4
|
"description": "SeatLayer's seat map rendering engine — the seating chart runtime behind @seatlayer/js and the React, Vue, and Angular SDKs.",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE",
|
|
6
6
|
"author": {
|