@seatlayer/core 0.89.2 → 0.91.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (79) hide show
  1. package/dist/{categoryInventory-DxHnIyza.d.ts → categoryInventory-4XH7dMDH.d.ts} +1 -1
  2. package/dist/{categoryInventory-6qAQffC9.d.cts → categoryInventory-C-bfH2av.d.cts} +1 -1
  3. package/dist/chunk-4N5CHKHD.js +1 -0
  4. package/dist/{chunk-66Q5LOBH.js → chunk-6FTHCEJW.js} +1 -1
  5. package/dist/chunk-D5ZLXZYU.js +1 -0
  6. package/dist/chunk-F45ZMLCU.js +1 -0
  7. package/dist/chunk-HC3U5BWH.js +1 -0
  8. package/dist/{chunk-PI3UH2EN.js → chunk-K42NW62J.js} +1 -1
  9. package/dist/{chunk-FVTW2IBN.js → chunk-LQKUHEL6.js} +1 -1
  10. package/dist/{chunk-GI7ZTQ7C.js → chunk-LVIAHZ4N.js} +1 -1
  11. package/dist/{chunk-R7TV7RYQ.js → chunk-NKJS7MLW.js} +1 -1
  12. package/dist/chunk-NRZY5UXV.js +1 -0
  13. package/dist/chunk-S4H34KCG.js +1 -0
  14. package/dist/{chunk-WAGKI44J.js → chunk-TXF2XAK4.js} +1 -1
  15. package/dist/core/chart-ops/index.cjs +1 -1
  16. package/dist/core/chart-ops/index.d.cts +17 -9
  17. package/dist/core/chart-ops/index.d.ts +17 -9
  18. package/dist/core/chart-ops/index.js +1 -1
  19. package/dist/core/inventory/index.cjs +1 -1
  20. package/dist/core/inventory/index.d.cts +4 -4
  21. package/dist/core/inventory/index.d.ts +4 -4
  22. package/dist/core/inventory/index.js +1 -1
  23. package/dist/core/layout/index.cjs +1 -1
  24. package/dist/core/layout/index.d.cts +5 -5
  25. package/dist/core/layout/index.d.ts +5 -5
  26. package/dist/core/layout/index.js +1 -1
  27. package/dist/core/quality/index.cjs +1 -1
  28. package/dist/core/quality/index.d.cts +31 -5
  29. package/dist/core/quality/index.d.ts +31 -5
  30. package/dist/core/quality/index.js +1 -1
  31. package/dist/core/render-assets/index.cjs +1 -1
  32. package/dist/core/render-assets/index.d.cts +27 -3
  33. package/dist/core/render-assets/index.d.ts +27 -3
  34. package/dist/core/render-assets/index.js +1 -1
  35. package/dist/core/seatConfidence.d.cts +1 -1
  36. package/dist/core/seatConfidence.d.ts +1 -1
  37. package/dist/core/sections/index.cjs +1 -1
  38. package/dist/core/sections/index.d.cts +5 -5
  39. package/dist/core/sections/index.d.ts +5 -5
  40. package/dist/core/sections/index.js +1 -1
  41. package/dist/{eventConfigurations-CMnIbVqZ.d.cts → eventConfigurations-BE0rFmbQ.d.cts} +1 -1
  42. package/dist/{eventConfigurations-uEwzNRzt.d.ts → eventConfigurations-BEyHDxBT.d.ts} +1 -1
  43. package/dist/index.cjs +1 -1
  44. package/dist/index.d.cts +41 -21
  45. package/dist/index.d.ts +41 -21
  46. package/dist/index.js +1 -1
  47. package/dist/{labeling-CCORxGjk.d.ts → labeling-HWSKKrX8.d.ts} +1 -1
  48. package/dist/{labeling--sSzNon3.d.cts → labeling-SURRJh5u.d.cts} +1 -1
  49. package/dist/{renderedQuality-CeSE6pEM.d.cts → renderedQuality-BZ9cIiVT.d.cts} +1 -1
  50. package/dist/{renderedQuality-CrlBXHzi.d.ts → renderedQuality-DeUSQqo6.d.ts} +1 -1
  51. package/dist/{renderer-BwZhXv8G.d.ts → renderer-BI7dyJjD.d.ts} +7 -3
  52. package/dist/{renderer-B1mEhbA7.d.cts → renderer-CMkBzwCP.d.cts} +7 -3
  53. package/dist/{seatTypeIcons-GlskmXH9.d.cts → seatTypeIcons-BAyWebjw.d.cts} +1 -1
  54. package/dist/{seatTypeIcons-8folIM2Q.d.ts → seatTypeIcons-CqLiEH9C.d.ts} +1 -1
  55. package/dist/{sections-BlBo6siI.d.ts → sections-BlCiPWJJ.d.cts} +63 -7
  56. package/dist/{sections-BFR0_Zeq.d.cts → sections-DOk8zxm5.d.ts} +63 -7
  57. package/dist/{segmentedRowModel-DR7Xz6mb.d.cts → segmentedRowModel-BbHdWqJy.d.cts} +1 -1
  58. package/dist/{segmentedRowModel-CfVeZaOw.d.ts → segmentedRowModel-oVUtwW87.d.ts} +1 -1
  59. package/dist/{tableSizing-DyS3UAha.d.ts → tableSizing-DGixGBdq.d.ts} +4 -4
  60. package/dist/{tableSizing-wnW3HNga.d.cts → tableSizing-w7kj0La7.d.cts} +4 -4
  61. package/dist/{ticketRestrictions-BTTN-LzH.d.cts → ticketRestrictions-B0qlW8_h.d.ts} +25 -4
  62. package/dist/{ticketRestrictions-DuYWl2uy.d.ts → ticketRestrictions-BkbfEnf8.d.cts} +25 -4
  63. package/dist/{types-D91PAu7c.d.ts → types-BbqhOJ5L.d.cts} +1 -1
  64. package/dist/{types-D91PAu7c.d.cts → types-BbqhOJ5L.d.ts} +1 -1
  65. package/dist/view3d/crossfade/panorama.d.cts +1 -1
  66. package/dist/view3d/crossfade/panorama.d.ts +1 -1
  67. package/dist/view3d/index.cjs +14 -14
  68. package/dist/view3d/index.d.cts +3 -3
  69. package/dist/view3d/index.d.ts +3 -3
  70. package/dist/view3d/index.js +1 -1
  71. package/dist/view3d/scene/scene.worker.cjs +1 -1
  72. package/dist/view3d/scene/scene.worker.js +1 -1
  73. package/package.json +1 -1
  74. package/dist/chunk-A4GTB3SG.js +0 -1
  75. package/dist/chunk-BCMCXHLH.js +0 -1
  76. package/dist/chunk-E7TOTX6I.js +0 -1
  77. package/dist/chunk-PMBS3VZM.js +0 -1
  78. package/dist/chunk-UL5OIGIF.js +0 -1
  79. package/dist/chunk-W53J4FJS.js +0 -1
@@ -1 +0,0 @@
1
- import{c as Pe}from"./chunk-WAGKI44J.js";import{a as Be,c as ze,f as be,g as Ue,m as Ge,v as pe,z as Ve}from"./chunk-W53J4FJS.js";import{i as He,k as Xe,l as Ye,m as he,q as ve}from"./chunk-TQN2VWQO.js";import{o as Fe}from"./chunk-5BMXWOE7.js";import{b as ne,c as ge,d as me,f as Ne,h as _e}from"./chunk-BCMCXHLH.js";import{b as Qe,e as z,i as qe}from"./chunk-R7TV7RYQ.js";import{c as Q}from"./chunk-4I2VWFJY.js";import{Ba as Y,Ea as W,Ga as oe,I as te,Ia as ye,L as Oe,M as Ae,aa as de,b as ce,ba as q,ca as H,da as X,ea as ue,fa as fe,ga as Ee,ja as Re,m as jt,n as $t,o as kt,p as Ot,q as At,r as Tt,s as je,t as Et,u as Rt,v as $e,va as Le,w as ke,x as le,xa as D,ya as Me}from"./chunk-E7TOTX6I.js";import{h as Te}from"./chunk-5ITK5236.js";import{a as De,i as Ke,n as F}from"./chunk-JBOTRSMY.js";var Ie=[{key:"row-seats",label:"row seats",suffix:"rows",labelSuffix:"Rows",creationWord:"Seats",objectType:"row"},{key:"table-chairs",label:"table chairs",suffix:"tables",labelSuffix:"Tables",creationWord:"Tables",objectType:"table"},{key:"booth-units",label:"booth units",suffix:"booths",labelSuffix:"Booths",creationWord:"Booths",objectType:"booth"},{key:"ga-capacity",label:"GA capacity",suffix:"ga",labelSuffix:"GA",creationWord:"Standing",objectType:"gaArea"}];function We(o){return o.floors?.length?o.floors:[{id:"floor-0",objects:o.objects}]}function Lt(o){return Ie.find(e=>e.key===o)}function re(o){let e=new Map,n=Math.max(0,Math.floor(o.seatCount)),i=new Map((o.overrides??[]).filter(s=>Number.isInteger(s.index)&&s.index>=0&&s.index<o.seatCount).map(s=>[s.index,s])),r=(s,y=1)=>{s&&y>0&&e.set(s,(e.get(s)??0)+y)};r(o.categoryKey,n-i.size);for(let s of i.values())s.skip||r(s.categoryKey??o.categoryKey);return e}function Mt(o){return o.type==="row"||o.type==="table"?[...re(o).keys()]:o.type==="booth"?o.categoryKey?[o.categoryKey]:[]:o.type==="gaArea"?o.capacity>0&&o.categoryKey?[o.categoryKey]:[]:[]}function Ze(o){return Ie.find(e=>e.objectType===o.type)??null}function Je(o){return o.type==="row"||o.type==="table"||o.type==="booth"||o.type==="gaArea"}function ie(o){let e=new Map;for(let r of We(o))for(let s of r.objects){if(!Je(s))continue;let y=Ze(s);for(let f of Mt(s)){let m=e.get(f)??new Map,a=m.get(y.key)??[];if(!a.some(u=>u.id===s.id)){let u=s.displayLabel||s.label||s.id;a.push({id:s.id,label:u,type:y.objectType,floorId:r.id})}m.set(y.key,a),e.set(f,m)}}let n=new Map(o.categories.map(r=>[r.key,r.label]));return[...o.categories.map(r=>r.key),...[...e.keys()].filter(r=>!n.has(r)).sort()].flatMap(r=>{let s=e.get(r);if(!s||s.size<2)return[];let y=Ie.flatMap(f=>{let m=s.get(f.key);return m?.length?[{family:f.key,label:f.label,objectType:f.objectType,targets:m}]:[]});return[{categoryKey:r,categoryLabel:n.get(r)??r,families:y,objectIds:[...new Set(y.flatMap(f=>f.targets.map(m=>m.id)))]}]})}function et(o){let e=o.families.map(n=>`${n.label} (${n.targets.map(i=>i.label).join(", ")})`).join(" and ");return`Category \u201C${o.categoryLabel}\u201D is used by more than one kind of inventory \u2014 ${e}. Each category can belong to only one kind \u2014 use the safe split to separate them (prices, ticket tiers, accessibility, and provenance are preserved).`}function tt(o){return o.normalize("NFKC").trim().toLocaleLowerCase("en")}function Ft(o,e,n){for(let i=1;i<=1e4;i+=1){let r=i===1?`--${e}`:`--${e}-${i}`,y=`${o.slice(0,Math.max(1,160-r.length))}${r}`;if(!n.has(y))return n.add(y),y}throw new Error(`Unable to allocate a category key for ${o} (${e})`)}function Pt(o,e,n){for(let i=1;i<=1e4;i+=1){let r=i===1?` (${e})`:` (${e} ${i})`,y=`${o.normalize("NFKC").trim().slice(0,Math.max(1,80-r.length)).trimEnd()}${r}`,f=tt(y);if(!n.has(f))return n.add(f),y}throw new Error(`Unable to allocate a category label for ${o} (${e})`)}function Nt(o,e,n,i){let r=Lt(e);return{...structuredClone(o),key:Ft(o.key,r.suffix,n),label:Pt(o.label,r.labelSuffix,i)}}function _t(o,e,n){let i=[];for(let r of We(o))for(let s of r.objects){if(!Je(s))continue;let y=Ze(s),f=n.get(y.key);if(!(!f||f===e))if(s.type==="row"||s.type==="table"){let m=[];s.categoryKey===e&&(s.categoryKey=f);for(let a of s.overrides??[])a.categoryKey===e&&(a.categoryKey=f,m.push(a.index));(s.categoryKey===f||m.length)&&i.push({family:y.key,floorId:r.id,objectId:s.id,objectType:y.objectType,fromCategoryKey:e,toCategoryKey:f,...m.length?{seatOverrideIndices:m.sort((a,u)=>a-u)}:{}})}else s.categoryKey===e&&(s.categoryKey=f,i.push({family:y.key,floorId:r.id,objectId:s.id,objectType:y.objectType,fromCategoryKey:e,toCategoryKey:f}))}return i}function ot(o){let e=structuredClone(o),n=ie(e);if(!n.length)return{doc:e,changed:!1,changes:[],before:n,after:n};let i=new Set(e.categories.map(f=>f.key)),r=new Set(e.categories.map(f=>tt(f.label))),s=[];for(let f of n){let m=e.categories.findIndex(I=>I.key===f.categoryKey);if(m<0)continue;let a=e.categories[m],u=f.families[0].family,g=new Map([[u,a.key]]),p=f.families.slice(1).map(I=>{let k=Nt(a,I.family,i,r);return g.set(I.family,k.key),{family:I.family,key:k.key,label:k.label,category:k}});e.categories.splice(m+1,0,...p.map(I=>I.category));let b=_t(e,a.key,g);s.push({categoryKey:a.key,categoryLabel:a.label,retainedFamily:u,clones:p.map(({family:I,key:k,label:w})=>({family:I,key:k,label:w})),reassignments:b})}e.floors?.length&&(e.objects=e.floors[0].objects);let y=ie(e);return{doc:e,changed:s.length>0,changes:s,before:n,after:y}}function vo(o){let e=(o%360+360)%360,n=e>=180?e-360:e;return Object.is(n,-0)||Math.abs(n)<1e-9?0:n}function Dt(o,e){return Math.abs(o.x-e.x)<=1e-7&&Math.abs(o.y-e.y)<=1e-7}function Z(o,e,n){return(e.x-o.x)*(n.y-o.y)-(e.y-o.y)*(n.x-o.x)}function ae(o,e,n){let i=Z(e,n,o);return Math.abs(i)>1e-7?!1:o.x>=Math.min(e.x,n.x)-1e-7&&o.x<=Math.max(e.x,n.x)+1e-7&&o.y>=Math.min(e.y,n.y)-1e-7&&o.y<=Math.max(e.y,n.y)+1e-7}function Kt(o,e,n,i){let r=Z(o,e,n),s=Z(o,e,i),y=Z(n,i,o),f=Z(n,i,e);return(r>1e-7&&s<-1e-7||r<-1e-7&&s>1e-7)&&(y>1e-7&&f<-1e-7||y<-1e-7&&f>1e-7)?!0:Math.abs(r)<=1e-7&&ae(n,o,e)||Math.abs(s)<=1e-7&&ae(i,o,e)||Math.abs(y)<=1e-7&&ae(o,n,i)||Math.abs(f)<=1e-7&&ae(e,n,i)}function Bt(o){return o.reduce((e,n,i)=>{let r=o[(i+1)%o.length];return e+n.x*r.y-r.x*n.y},0)}function zt(o){for(let e=0;e<o.length;e+=1){let n=(e+1)%o.length;for(let i=e+1;i<o.length;i+=1){let r=(i+1)%o.length;if(!(e===i||n===i||r===e)&&Kt(o[e],o[n],o[i],o[r]))return!0}}return!1}function nt(o){return o.length<3?{ok:!1,code:"too_few_vertices",message:"Add at least three vertices to create a polygon."}:o.length>256?{ok:!1,code:"too_many_vertices",message:"A polygon can contain at most 256 vertices."}:o.some(e=>!Number.isFinite(e.x)||!Number.isFinite(e.y)||Math.abs(e.x)>1e7||Math.abs(e.y)>1e7)?{ok:!1,code:"invalid_coordinate",message:"Every polygon vertex must use a finite coordinate inside the safe chart range."}:o.some((e,n)=>Dt(e,o[(n+1)%o.length]))?{ok:!1,code:"duplicate_vertex",message:"Move or remove duplicate neighbouring vertices."}:Math.abs(Bt(o))<2?{ok:!1,code:"degenerate_polygon",message:"The polygon needs a visible enclosed area."}:zt(o)?{ok:!1,code:"self_intersection",message:"Polygon edges cannot cross or touch each other."}:{ok:!0}}function B(o){return o.length>=3&&o.every(e=>Number.isFinite(e.x)&&Number.isFinite(e.y))}function U(o,e,n){let i=(o.y-e.y)*(n.x-e.x)-(o.x-e.x)*(n.y-e.y);if(Math.abs(i)>1e-7)return!1;let r=(o.x-e.x)*(n.x-e.x)+(o.y-e.y)*(n.y-e.y);if(r<-1e-7)return!1;let s=(n.x-e.x)**2+(n.y-e.y)**2;return r<=s+1e-7}function G(o,e){let n=!1;for(let i=0,r=e.length-1;i<e.length;r=i++){let s=e[r],y=e[i];if(U(o,s,y))return!0;s.y>o.y!=y.y>o.y&&o.x<(y.x-s.x)*(o.y-s.y)/(y.y-s.y)+s.x&&(n=!n)}return n}function K(o,e,n){return(e.x-o.x)*(n.y-o.y)-(e.y-o.y)*(n.x-o.x)}function rt(o,e,n,i){let r=K(o,e,n),s=K(o,e,i),y=K(n,i,o),f=K(n,i,e);return(r>1e-7&&s<-1e-7||r<-1e-7&&s>1e-7)&&(y>1e-7&&f<-1e-7||y<-1e-7&&f>1e-7)?!0:Math.abs(r)<=1e-7&&U(n,o,e)||Math.abs(s)<=1e-7&&U(i,o,e)||Math.abs(y)<=1e-7&&U(o,n,i)||Math.abs(f)<=1e-7&&U(e,n,i)}function V(o){for(let e=0;e<o.length;e+=1){let n=(e+1)%o.length;for(let i=e+1;i<o.length;i+=1){let r=(i+1)%o.length;if(!(e===i||n===i||r===e)&&rt(o[e],o[n],o[i],o[r]))return!0}}return!1}function J(o,e){for(let n=0;n<o.length;n+=1)for(let i=0;i<e.length;i+=1)if(rt(o[n],o[(n+1)%o.length],e[i],e[(i+1)%e.length]))return!0;return G(o[0],e)||G(e[0],o)}function it(o,e){return!e.some((n,i)=>U(o,n,e[(i+1)%e.length]))&&G(o,e)}function at(o){let e=o.outlinePath;if(!e?.segments.length)return;let n=s=>Number.isFinite(s.x)&&Number.isFinite(s.y),i=(s,y)=>Math.hypot(s.x-y.x,s.y-y.y);if(!n(e.start))return 0;let r=e.start;for(let s=0;s<e.segments.length;s++){let y=e.segments[s];if(!y||!n(y.end)||i(r,y.end)<=1e-9||y.kind==="bezier"&&(!n(y.control1)||!n(y.control2)))return s;if(y.kind==="arc"){if(!n(y.center)||!Number.isFinite(y.radius)||y.radius<=1e-6)return s;let f=Math.max(1e-4,y.radius*1e-4);if(Math.abs(i(r,y.center)-y.radius)>f||Math.abs(i(y.end,y.center)-y.radius)>f)return s}r=y.end}return i(r,e.start)>1e-4,e.segments.length-1}function Ut(o,e,n,i){let r=K(o,e,n),s=K(o,e,i),y=K(n,i,o),f=K(n,i,e);return(r>1e-7&&s<-1e-7||r<-1e-7&&s>1e-7)&&(y>1e-7&&f<-1e-7||y<-1e-7&&f>1e-7)}function st(o,e){for(let n=0;n<o.length;n+=1)for(let i=0;i<e.length;i+=1)if(Ut(o[n],o[(n+1)%o.length],e[i],e[(i+1)%e.length]))return!0;return o.some(n=>it(n,e))||e.some(n=>it(n,o))}function ct(o){return o.role!=="reference-focal"||!o.points||!B(o.points)?null:o.points}function dt(o,e){if(o.displayLabel!==void 0){let n=o.displayLabel.normalize("NFKC").trim();!(o.type==="row"&&o.displayLabel==="")&&(!n||n!==o.displayLabel||n.length>80)&&e.push({severity:"error",code:"invalid-display-label",message:`${o.type==="gaArea"?"GA area":o.type} "${o.label}" must use a normalized buyer label of 1 to 80 characters`,objectId:o.id})}if(o.displayType!==void 0){let n=o.displayType.normalize("NFKC").trim();(!n||n!==o.displayType||n.length>24)&&e.push({severity:"error",code:"invalid-display-type",message:`${o.type==="gaArea"?"GA area":o.type} "${o.label}" must use a normalized buyer type of 1 to 24 characters`,objectId:o.id})}}function lt(o,e,n,i){let r=o.crop,s=r&&(!Number.isFinite(r.x)||!Number.isFinite(r.y)||!Number.isFinite(r.width)||!Number.isFinite(r.height)||r.x<0||r.y<0||r.width<=0||r.height<=0||r.x+r.width>1.000001||r.y+r.height>1.000001);(!Number.isFinite(o.center?.x)||!Number.isFinite(o.center?.y)||!Number.isFinite(o.width)||o.width<=0||!Number.isFinite(o.opacity)||o.opacity<0||o.opacity>1||o.rotation!==void 0&&!Number.isFinite(o.rotation)||s)&&n.push({severity:"error",code:"invalid-background-placement",message:`The ${e} image has an invalid position, size, opacity, rotation, or crop`,...i?{floorId:i}:{}})}function we(o,e,n,i){let r=o.referenceImage,s=o.backgroundImage;r&&(lt(r,"reference",e,i),!r.assetId&&!r.url&&e.push({severity:"error",code:"invalid-reference-image",message:"A trace reference must identify a private asset or self-contained image",...i?{floorId:i}:{}})),s&&(lt(s,s.assetId?"legacy reference":"buyer background",e,i),!s.assetId&&!s.url&&e.push({severity:"error",code:"invalid-buyer-background",message:"A buyer background must contain a renderable image URL",...i?{floorId:i}:{}}),s.assetId&&n.push({severity:"warning",code:"legacy-reference-background",message:"This legacy asset-backed background is trace-only and will migrate to the private reference layer when edited",...i?{floorId:i}:{}})),Fe(o)&&e.push({severity:"error",code:"conflicting-reference-images",message:"The canonical reference and legacy asset-backed background identify different private sources",...i?{floorId:i}:{}})}function ee(o){let e=new Set(Q.map(n=>n.key));return!o||/^ref_[0-9a-f-]{36}$/.test(o.assetId)&&!!o.logicalSectionId.trim()&&["user-confirmed","authoritative-source"].includes(o.evidence)&&!!o.sourceDescription.trim()&&(o.derivation===void 0||["explicit-inventory","server-synthesized-from-aggregate"].includes(o.derivation))&&(o.aggregateEvidence===void 0||["user-confirmed","authoritative-source"].includes(o.aggregateEvidence))&&(o.derivation!=="server-synthesized-from-aggregate"||o.evidence==="user-confirmed")&&(o.sectionAssignmentEvidence===void 0||["user-confirmed","authoritative-source"].includes(o.sectionAssignmentEvidence))&&o.sectionAssignmentEvidence===void 0==!o.sectionAssignmentSourceDescription?.trim()&&(o.sectionAssignmentSourceDescription?.trim().length??0)<=240&&(o.numberingEvidence===void 0||o.numberingEvidence==="user-confirmed")&&o.numberingEvidence===void 0==!o.numberingSourceDescription?.trim()&&(o.numberingSourceDescription?.trim().length??0)<=240&&(!o.accessibility||o.accessibility.placementDerivation==="server-synthesized-row-edges"&&o.accessibility.groupLogicalSectionIds.length>0&&o.accessibility.groupLogicalSectionIds.length<=100&&new Set(o.accessibility.groupLogicalSectionIds).size===o.accessibility.groupLogicalSectionIds.length&&o.accessibility.groupLogicalSectionIds.includes(o.logicalSectionId)&&o.accessibility.groupLogicalSectionIds.every(n=>!!n.trim()&&n.length<=160)&&["user-confirmed","authoritative-source"].includes(o.accessibility.assignmentEvidence)&&!!o.accessibility.assignmentSourceDescription.trim()&&o.accessibility.assignmentSourceDescription.trim().length<=240&&o.accessibility.counts.length>0&&o.accessibility.counts.length<=Q.length&&new Set(o.accessibility.counts.map(n=>n.type)).size===o.accessibility.counts.length&&o.accessibility.counts.every(n=>e.has(n.type)&&Number.isInteger(n.count)&&n.count>0&&["user-confirmed","authoritative-source"].includes(n.evidence)&&!!n.sourceDescription.trim()&&n.sourceDescription.trim().length<=240))}function ut(o){let e=o.referenceInventoryExclusion;return!e||typeof e.assetId=="string"&&/^ref_[0-9a-f-]{36}$/.test(e.assetId)&&e.assetId===o.referenceSource?.assetId&&typeof e.logicalSectionId=="string"&&e.logicalSectionId===(o.logicalSectionId??o.id)&&typeof e.reason=="string"&&!!e.reason.trim()&&e.reason.trim().length<=80&&["user-confirmed","authoritative-source"].includes(e.evidence)&&typeof e.sourceDescription=="string"&&!!e.sourceDescription.trim()&&e.sourceDescription.trim().length<=240}function ft(o){let e=o.referenceCategorySource;return!e||/^ref_[0-9a-f-]{36}$/.test(e.assetId)&&/^#[0-9a-f]{6}$/i.test(e.sourceColor)&&(e.sourceColors===void 0||e.sourceColors.length>0&&e.sourceColors.includes(e.sourceColor)&&new Set(e.sourceColors).size===e.sourceColors.length&&e.sourceColors.every(n=>/^#[0-9a-f]{6}$/i.test(n)&&`${n[1]}${n[3]}${n[5]}`.toLowerCase()===`${e.sourceColor[1]}${e.sourceColor[3]}${e.sourceColor[5]}`.toLowerCase()))&&(e.logicalSectionIds===void 0||e.logicalSectionIds.length>0&&new Set(e.logicalSectionIds).size===e.logicalSectionIds.length&&e.logicalSectionIds.every(n=>!!n.trim()&&n.length<=160))&&(e.assignmentDerivation===void 0||["source-color-class","confirmed-logical-sections"].includes(e.assignmentDerivation))&&e.assignmentEvidence===void 0==!e.assignmentSourceDescription?.trim()&&(e.assignmentEvidence===void 0||["user-confirmed","authoritative-source"].includes(e.assignmentEvidence))&&(e.assignmentSourceDescription?.trim().length??0)<=240&&(e.assignmentDerivation!=="confirmed-logical-sections"||e.assignmentEvidence!==void 0&&!!e.assignmentSourceDescription?.trim())&&e.sourcePaletteColor===void 0==(e.sourcePaletteColorEvidence===void 0)&&e.sourcePaletteColorEvidence===void 0==!e.sourcePaletteColorSourceDescription?.trim()&&(e.sourcePaletteColor===void 0||/^#[0-9a-f]{6}$/i.test(e.sourcePaletteColor))&&(e.sourcePaletteColorEvidence===void 0||["user-confirmed","authoritative-source"].includes(e.sourcePaletteColorEvidence))&&(e.sourcePaletteColorSourceDescription?.trim().length??0)<=240&&["user-confirmed","authoritative-source"].includes(e.labelEvidence)&&!!e.labelSourceDescription.trim()&&e.labelSourceDescription.trim().length<=240&&o.price!==void 0&&["user-confirmed","authoritative-source"].includes(e.priceEvidence)&&!!e.priceSourceDescription.trim()&&e.priceSourceDescription.trim().length<=240&&e.outputColorEvidence===void 0==!e.outputColorSourceDescription?.trim()&&(e.outputColorEvidence===void 0||["user-confirmed","authoritative-source"].includes(e.outputColorEvidence))&&(e.outputColorSourceDescription?.trim().length??0)<=240&&(o.color.toLowerCase()===(e.sourcePaletteColor??e.sourceColor).toLowerCase()&&new Set((e.sourceColors??[e.sourceColor]).map(n=>`${n[1]}${n[3]}${n[5]}`.toLowerCase())).size===1||e.outputColorEvidence!==void 0&&["user-confirmed","authoritative-source"].includes(e.outputColorEvidence))}function yt(o){let e=o.referenceDirectSeatImport;return!e||/^ref_[0-9a-f-]{36}$/.test(e.assetId)&&/^source-color:(?:#[0-9a-f]{6}(?:\+#[0-9a-f]{6})*|unclassified)$/i.test(e.familyId)}function gt(o,e){let n=o.floors?.length?o.floors.map(s=>({id:s.id,objects:s.objects})):[{id:"floor-0",objects:o.objects}],i=new Map,r=new Map;for(let s of n){let y=s.objects.filter(a=>a.type==="row"),f=new Map,m=new Map;for(let a of y){if(a.segmentedRow){let u=f.get(a.segmentedRow.groupId)??[];u.push(a),f.set(a.segmentedRow.groupId,u)}if(a.rowBlockGeneration){let u=m.get(a.rowBlockGeneration.groupId)??[];u.push(a),m.set(a.rowBlockGeneration.groupId,u)}a.segmentedRow&&a.rowBlockGeneration&&e.push({severity:"error",code:"invalid-row-group-membership",message:`Row "${a.label}" cannot be both a segmented-row component and a generated row-block member`,objectId:a.id,floorId:s.id})}for(let[a,u]of f){let g=i.get(a);g&&g!==s.id&&e.push({severity:"error",code:"invalid-segmented-row",message:`Segmented row "${a}" cannot span multiple floors`,objectId:u[0].id,floorId:s.id}),i.set(a,s.id);let p=u.slice().sort((C,O)=>C.segmentedRow.componentIndex-O.segmentedRow.componentIndex),b=p[0]?.segmentedRow,I=b?.componentCount??0,k=b?JSON.stringify({displayLabel:b.displayLabel,repeatLabelOnComponents:b.repeatLabelOnComponents,displayType:b.displayType,labelPresentation:b.labelPresentation,viewFromSeatUrl:b.viewFromSeatUrl,viewFromSeatMeta:b.viewFromSeatMeta,confidenceEvidence:b.confidenceEvidence,smoothing:b.smoothing}):"";b&&I>=2&&I<=64&&p.length===I&&b.boundaryBefore==="start"&&p.every((C,O)=>{let j=C.segmentedRow;return j.kind==="segmented-row-v1"&&j.groupId===a&&j.componentCount===I&&j.componentIndex===O&&(O===0?j.boundaryBefore==="start":j.boundaryBefore!=="start")&&j.displayLabel.normalize("NFKC").trim()===j.displayLabel&&j.displayLabel.length>0&&j.displayLabel.length<=80&&JSON.stringify({displayLabel:j.displayLabel,repeatLabelOnComponents:j.repeatLabelOnComponents,displayType:j.displayType,labelPresentation:j.labelPresentation,viewFromSeatUrl:j.viewFromSeatUrl,viewFromSeatMeta:j.viewFromSeatMeta,confidenceEvidence:j.confidenceEvidence,smoothing:j.smoothing})===k})||e.push({severity:"error",code:"invalid-segmented-row",message:`Segmented row "${a}" has missing, duplicated, cyclic, or inconsistent component metadata`,objectId:u[0]?.id,floorId:s.id})}for(let[a,u]of m){let g=r.get(a);g&&g!==s.id&&e.push({severity:"error",code:"invalid-row-block-generation",message:"A generated row block cannot span multiple floors",objectId:u[0].id,floorId:s.id}),r.set(a,s.id)}}}function Gt(o){return o.type==="row"||o.type==="table"||o.type==="booth"}function Vt(o){let e=[],n=new Map((o.overrides??[]).map(i=>[i.index,i]));for(let i=0;i<o.seatCount;i++){let r=n.get(i);r?.skip||e.push({label:Te(o,i,r),index:i})}return e}function mt(o){let e=[],n=new Map((o.overrides??[]).map(i=>[i.index,i]));for(let i=0;i<o.seatCount;i++){let r=n.get(i);r?.skip||e.push({label:r?.label??`${o.label}-${i+1}`,index:i})}return e}function bt(o){let e=[];o.floorOverview!==void 0&&o.floorOverview!=="combined"&&o.floorOverview!=="separated"&&e.push({severity:"error",code:"invalid-floor-overview",message:"Whole venue view must be Combined plan or Separate levels"}),o.eventConfigurationId!==void 0&&(typeof o.eventConfigurationId!="string"||o.eventConfigurationId.normalize("NFKC").trim()!==o.eventConfigurationId||o.eventConfigurationId.length<1||o.eventConfigurationId.length>100)&&e.push({severity:"error",code:"invalid-event-configuration",message:"Active event configuration must contain 1 to 100 normalized characters"});let n=[],i=new Set(o.categories.map(t=>t.key)),r=new Set(Q.map(t=>t.key)),s=new Map(o.categories.map(t=>[t.key,t.price!=null||t.notForSale===!0])),y=new Set;we(o,e,n),o.theme?.sectionDetail!==void 0&&!["rows","seats"].includes(o.theme.sectionDetail)&&e.push({severity:"error",code:"invalid-section-detail",message:"Section detail must be rows or seats"}),o.theme?.logoUrl!==void 0&&!ce(o.theme.logoUrl)&&e.push({severity:"error",code:"invalid-theme-logo-url",message:"The buyer-facing theme logo URL is invalid"});let f=ce,m=(t,S,c,d={})=>{if(S===void 0)return;if(!S||typeof S!="object"||Array.isArray(S)){e.push({severity:"error",code:"invalid-seat-view-metadata",message:`${c} view metadata is invalid`,...d});return}let l=S;t||n.push({severity:"warning",code:"orphaned-seat-view-metadata",message:`${c} view metadata has no image`,...d});let v=new Set(["exact-seat","row-representative","section-representative","floor-representative","venue-representative"]);l.projection!==void 0&&l.projection!=="equirectangular"&&e.push({severity:"error",code:"invalid-seat-view-projection",message:`${c} view projection must be equirectangular`,...d}),l.coverage!==void 0&&!v.has(l.coverage)&&e.push({severity:"error",code:"invalid-seat-view-coverage",message:`${c} view coverage is invalid`,...d});let h=(x,$,A)=>typeof x=="number"&&Number.isFinite(x)&&x>=$&&x<=A;if(l.initialBearingDeg!==void 0&&!h(l.initialBearingDeg,-360,360)&&e.push({severity:"error",code:"invalid-seat-view-bearing",message:`${c} view bearing must be between -360\xB0 and 360\xB0`,...d}),l.initialPitchDeg!==void 0&&!h(l.initialPitchDeg,-90,90)&&e.push({severity:"error",code:"invalid-seat-view-pitch",message:`${c} view pitch must be between -90\xB0 and 90\xB0`,...d}),l.capturedAt!==void 0&&(typeof l.capturedAt!="string"||l.capturedAt.length>40||!Number.isFinite(Date.parse(l.capturedAt)))&&e.push({severity:"error",code:"invalid-seat-view-capture-date",message:`${c} view capture date is invalid`,...d}),l.sourceLabel!==void 0&&(typeof l.sourceLabel!="string"||l.sourceLabel.trim().length>100)&&e.push({severity:"error",code:"invalid-seat-view-source",message:`${c} view source label is invalid`,...d}),l.previewUrl!==void 0&&!f(l.previewUrl)&&e.push({severity:"error",code:"invalid-seat-view-preview-url",message:`${c} view preview URL is invalid`,...d}),l.variants!==void 0){let x=Array.isArray(l.variants)?l.variants:[];if(!Array.isArray(l.variants)||x.length<1||x.length>4)e.push({severity:"error",code:"invalid-seat-view-variants",message:`${c} view variants must contain between 1 and 4 tiers`,...d});else{let $=new Set;for(let A of x){if(!A||typeof A!="object"||!f(A.url)||!Number.isInteger(A.width)||A.width<1||A.width>12e3||!Number.isInteger(A.height)||A.height<1||A.height>12e3||A.width!==A.height*2||typeof A.sha256!="string"||!/^[a-f0-9]{64}$/.test(A.sha256)||$.has(A.width)){e.push({severity:"error",code:"invalid-seat-view-variant",message:`${c} view variant is not a unique immutable 2:1 equirectangular tier`,...d});break}$.add(A.width)}}}for(let[x,$]of[["width",l.sourceWidth],["height",l.sourceHeight],["preview width",l.previewWidth],["preview height",l.previewHeight]])$!==void 0&&(!Number.isInteger($)||$<1||$>32768)&&e.push({severity:"error",code:"invalid-seat-view-dimensions",message:`${c} view source ${x} is invalid`,...d});l.captureEyeHeightM!==void 0&&!h(l.captureEyeHeightM,.5,3)&&e.push({severity:"error",code:"invalid-seat-view-eye-height",message:`${c} capture eye height must be between 0.5 m and 3 m`,...d}),l.eventConfigurationId!==void 0&&(typeof l.eventConfigurationId!="string"||!l.eventConfigurationId.trim()||l.eventConfigurationId.length>100)&&e.push({severity:"error",code:"invalid-seat-view-configuration",message:`${c} event configuration id is invalid`,...d}),l.eventConfigurationVersion!==void 0&&(!Number.isInteger(l.eventConfigurationVersion)||l.eventConfigurationVersion<1)&&e.push({severity:"error",code:"invalid-seat-view-configuration-version",message:`${c} event configuration version is invalid`,...d}),l.eventConfigurationVersion!==void 0&&!l.eventConfigurationId&&e.push({severity:"error",code:"invalid-seat-view-configuration-pin",message:`${c} event configuration version requires an id`,...d})},a=(t,S,c={})=>{if(t===void 0)return;let d=$=>{e.push({severity:"error",code:"invalid-seat-confidence-evidence",message:`${S} confidence evidence ${$}`,...c})};if(!t||typeof t!="object"||Array.isArray(t)){d("is invalid");return}let l=t;l.schema!=="seatlayer.seat-confidence/1"&&d("has an unsupported schema");let v=($,A)=>typeof $=="string"&&$.normalize("NFKC").trim()===$&&$.length>0&&$.length<=A;v(l.evidenceId,120)||d("has an invalid evidence id"),v(l.modelVersion,120)||d("has an invalid model version"),new Set(["synthetic-model","organizer-approved","calibrated-provider"]).has(l.evidenceKind)||d("has an invalid evidence kind"),new Set(["generated","geometry-verified","configuration-verified"]).has(l.modelLevel)||d("has an invalid model level");let h=l.realityLevel??"none";new Set(["none","comparable-build-reference","actual-build-checked"]).has(h)||d("has an invalid reality level"),l.eventConfigurationId!==void 0&&!v(l.eventConfigurationId,100)&&d("has an invalid event configuration id"),l.eventConfigurationVersion!==void 0&&(!Number.isInteger(l.eventConfigurationVersion)||l.eventConfigurationVersion<1)&&d("has an invalid event configuration version"),l.status!==void 0&&!new Set(["draft","approved","retracted"]).has(l.status)&&d("has an invalid publication status"),l.basisSha256!==void 0&&!/^[a-f0-9]{64}$/.test(l.basisSha256)&&d("has an invalid venue basis SHA-256"),l.basisSha256!==void 0&&l.status!=="approved"&&d("can carry a venue basis SHA-256 only after approval");for(let[$,A]of[["assessment",l.assessedAt],["expiry",l.validUntil]])A!==void 0&&(!v(A,40)||!Number.isFinite(Date.parse(A)))&&d(`has an invalid ${$} date`);l.approvedByRole!==void 0&&!v(l.approvedByRole,100)&&d("has an invalid approving organization or role"),l.sourceLabel!==void 0&&!v(l.sourceLabel,120)&&d("has an invalid source label"),l.limitations!==void 0&&(!Array.isArray(l.limitations)||l.limitations.length>6||l.limitations.some($=>!v($,160)))&&d("has invalid limitations"),l.evidenceKind==="synthetic-model"&&(l.modelLevel!=="generated"||h!=="none")&&d("cannot describe synthetic data as verified or reality checked"),l.modelLevel!=="generated"&&(!l.assessedAt||!l.approvedByRole)&&d("requires an assessment date and approving organization or role for verified model levels"),l.modelLevel==="configuration-verified"&&!l.eventConfigurationId&&d("requires an event configuration id for configuration verification"),h!=="none"&&(!l.assessedAt||!l.sourceLabel)&&d("requires an assessment date and source for reality evidence"),h==="actual-build-checked"&&(l.modelLevel!=="configuration-verified"||!l.eventConfigurationId)&&d("requires a configuration-verified model and event configuration for an actual-build check");let x=l.modeledTarget;x!==void 0&&(!x||typeof x!="object"||Array.isArray(x)?d("has an invalid modeled target"):((!v(x.label,80)||!v(x.methodLabel,100))&&d("has invalid modeled-target labels"),(!Number.isInteger(x.totalRayCount)||x.totalRayCount<1||x.totalRayCount>1e3||!Number.isInteger(x.clearRayCount)||x.clearRayCount<0||x.clearRayCount>x.totalRayCount)&&d("has invalid modeled-target ray counts"),new Set(["clear","partial","obstructed"]).has(x.classification)||d("has an invalid modeled-target classification"),x.occluderLabels!==void 0&&(!Array.isArray(x.occluderLabels)||x.occluderLabels.length>10||x.occluderLabels.some($=>!v($,100)))&&d("has invalid modeled-target occluders")))};m(o.viewFromSeatUrl,o.viewFromSeatMeta,"Venue"),a(o.confidenceEvidence,"Venue"),o.viewFromSeatUrl!==void 0&&!f(o.viewFromSeatUrl)&&e.push({severity:"error",code:"invalid-venue-view-url",message:"The whole-venue view-from-seat image URL is invalid"});for(let t of o.floors??[])t.viewFromSeatUrl!==void 0&&!f(t.viewFromSeatUrl)&&e.push({severity:"error",code:"invalid-floor-view-url",message:`Floor "${t.name}" has an invalid view-from-seat image URL`}),m(t.viewFromSeatUrl,t.viewFromSeatMeta,`Floor "${t.name}"`,{floorId:t.id}),a(t.confidenceEvidence,`Floor "${t.name}"`,{floorId:t.id});let u=o.floors?.length?o.floors.flatMap(t=>t.objects):o.objects;for(let t of u)if((t.type==="row"||t.type==="section")&&(t.viewFromSeatUrl!==void 0&&!f(t.viewFromSeatUrl)&&e.push({severity:"error",code:t.type==="row"?"invalid-row-view-url":"invalid-section-view-url",message:`${t.type==="row"?"Row":"Section"} "${t.label}" has an invalid view-from-seat image URL`,objectId:t.id}),m(t.viewFromSeatUrl,t.viewFromSeatMeta,`${t.type==="row"?"Row":"Section"} "${t.label}"`,{objectId:t.id}),a(t.confidenceEvidence,`${t.type==="row"?"Row":"Section"} "${t.label}"`,{objectId:t.id})),t.type==="row"&&t.segmentedRow&&(t.segmentedRow.viewFromSeatUrl!==void 0&&!f(t.segmentedRow.viewFromSeatUrl)&&e.push({severity:"error",code:"invalid-segmented-row-view-url",message:`Segmented row "${t.segmentedRow.displayLabel}" has an invalid view-from-seat image URL`,objectId:t.id}),m(t.segmentedRow.viewFromSeatUrl,t.segmentedRow.viewFromSeatMeta,`Segmented row "${t.segmentedRow.displayLabel}"`,{objectId:t.id}),a(t.segmentedRow.confidenceEvidence,`Segmented row "${t.segmentedRow.displayLabel}"`,{objectId:t.id})),t.type==="row"||t.type==="table")for(let S of t.overrides??[])S.viewFromSeatUrl!==void 0&&!f(S.viewFromSeatUrl)&&e.push({severity:"error",code:"invalid-seat-view-url",message:`Seat ${S.index+1} has an invalid view-from-seat image URL`,objectId:t.id,seatIndices:[S.index]}),m(S.viewFromSeatUrl,S.viewFromSeatMeta,`Seat ${S.index+1}`,{objectId:t.id,seatIndices:[S.index]}),a(S.confidenceEvidence,`Seat ${S.index+1}`,{objectId:t.id,seatIndices:[S.index]});let g=new Set;for(let t of o.categories){g.has(t.key)&&e.push({severity:"error",code:"duplicate-category-key",message:`Category key "${t.key}" is used more than once`,categoryKey:t.key}),g.add(t.key);let S=new Set;for(let c of t.tiers??[]){if(S.has(c.id)&&e.push({severity:"error",code:"duplicate-category-tier-id",message:`Ticket tier id "${c.id}" is used more than once in category "${t.key}"`,categoryKey:t.key}),c.restriction!=null&&!["companion","child","senior","student","membership","custom"].includes(c.restriction)&&e.push({severity:"error",code:"invalid-category-tier-restriction",message:`Ticket tier "${c.name}" has an unknown restriction`,categoryKey:t.key}),c.buyerMessage!=null&&(!c.buyerMessage.trim()||c.buyerMessage.length>240)&&e.push({severity:"error",code:"invalid-category-tier-buyer-message",message:`Ticket tier "${c.name}" buyer guidance must contain 1 to 240 characters`,categoryKey:t.key}),c.currency!=null&&!/^[A-Z]{3}$/.test(c.currency)&&e.push({severity:"error",code:"invalid-category-tier-currency",message:`Ticket tier "${c.name}" must use a three-letter ISO currency`,categoryKey:t.key}),c.applicability!=null){let d=c.applicability.seatLabels,l=c.applicability.accessibility;(d!==void 0&&(!Array.isArray(d)||!d.length||d.length>1e4||d.some(v=>typeof v!="string"||!v.trim()||v.length>160)||new Set(d).size!==d.length)||l!==void 0&&(!Array.isArray(l)||!l.length||l.some(v=>!r.has(v))||new Set(l).size!==l.length))&&e.push({severity:"error",code:"invalid-category-tier-applicability",message:`Ticket tier "${c.name}" has invalid seat applicability`,categoryKey:t.key})}c.evidence!=null&&(!["public-host","public-event","user-confirmed"].includes(c.evidence.provenance)||!c.evidence.sourceDescription.trim()||c.evidence.sourceDescription.length>240||c.evidence.capturedAt!==void 0&&(c.evidence.capturedAt.length>40||!Number.isFinite(Date.parse(c.evidence.capturedAt))))&&e.push({severity:"error",code:"invalid-category-tier-evidence",message:`Ticket tier "${c.name}" has invalid evidence provenance`,categoryKey:t.key}),S.add(c.id)}ft(t)||e.push({severity:"error",code:"invalid-reference-category-source",message:`Category ${t.label||t.key} has incomplete or invalid reference evidence`,categoryKey:t.key}),yt(t)||e.push({severity:"error",code:"invalid-reference-direct-seat-import",message:`Category ${t.label||t.key} has invalid direct-seat import provenance`,categoryKey:t.key})}let p=new Map,b=new Map,I=[],k=new Map,w=0,C=0,O=new Set;for(let t of o.floors??[])we(t,e,n,t.id),O.has(t.id)&&e.push({severity:"error",code:"duplicate-floor-id",message:`Floor id "${t.id}" is used more than once`,floorId:t.id}),O.add(t.id),t.baseHeightM!==void 0&&(!Number.isFinite(t.baseHeightM)||t.baseHeightM<H||t.baseHeightM>X)&&e.push({severity:"error",code:"invalid-floor-base-height",message:`Floor "${t.name}" base height must be between ${H} and ${X} metres`,floorId:t.id});let j=o.floors&&o.floors.length?o.floors.flatMap(t=>t.objects):o.objects;gt(o,e);let P=new Set;for(let t of j)P.has(t.id)&&e.push({severity:"error",code:"duplicate-object-id",message:`Object id "${t.id}" is used more than once`,objectId:t.id}),P.add(t.id);let M=new Set;for(let t of o.zones??[])M.has(t.id)&&e.push({severity:"error",code:"duplicate-zone-id",message:`Zone id "${t.id}" is used more than once`}),M.add(t.id),t.focalPoint!==void 0&&(!Number.isFinite(t.focalPoint.x)||!Number.isFinite(t.focalPoint.y))&&e.push({severity:"error",code:"invalid-zone-focal-point",message:`Zone "${t.label}" must use a finite focal point`});let E=new Map;for(let t of j)if(!(t.type!=="section"||!t.zone)){if(o.zones?.length&&!M.has(t.zone)){e.push({severity:"error",code:"unknown-section-zone",message:`Section "${t.displayLabel??t.label}" references unknown zone "${t.zone}"`,objectId:t.id});continue}E.has(t.zone)||E.set(t.zone,t)}for(let[t,S]of E){let c=o.zones?.find(d=>d.id===t);c&&(c?.focalPoint||n.push({severity:"warning",code:"missing-zone-focal-point",message:`Zone "${c?.label??t}" uses the legacy floor focal; set its own focal point before publishing`,objectId:S.id}))}for(let t of j)if((t.type==="row"||t.type==="table"||t.type==="booth"||t.type==="gaArea")&&dt(t,e),Gt(t)){if(w++,C+=t.type==="booth"?1:t.type==="row"?Le(t):t.bookAsWhole||t.variableOccupancy?t.seatCount:mt(t).length,p.get(t.label)!==void 0?t.type!=="row"&&e.push({severity:"error",code:"duplicate-object-label",message:`Label "${t.label}" is used by more than one object`,objectId:t.id}):p.set(t.label,t.id),i.has(t.categoryKey)?y.add(t.categoryKey):e.push({severity:"error",code:"unknown-category",message:`"${t.label}" references unknown category "${t.categoryKey}"`,objectId:t.id,categoryKey:t.categoryKey}),t.type==="row"){ee(t.referenceInventorySource)||e.push({severity:"error",code:"invalid-reference-inventory-source",message:`Row "${t.label}" has invalid reference-inventory provenance`,objectId:t.id}),t.seatCount<1&&e.push({severity:"error",code:"empty-row",message:`Row "${t.label}" has no seats`,objectId:t.id});let c=new Set;for(let d of t.overrides??[]){(d.accessibility??[]).filter(x=>!r.has(x)).length&&e.push({severity:"error",code:"invalid-accessibility-type",message:`Row "${t.label}" seat ${d.index+1} uses an unknown accessibility type`,objectId:t.id,seatIndices:[d.index]}),(!Number.isInteger(d.index)||d.index<0||d.index>=t.seatCount||c.has(d.index))&&e.push({severity:"error",code:"invalid-seat-override",message:`Row "${t.label}" has a duplicated or out-of-range seat override`,objectId:t.id,...Number.isInteger(d.index)?{seatIndices:[d.index]}:{}}),c.add(d.index);let v=d.wheelchairSpaceType,h=d.accessible===!0||d.accessibility?.includes("wheelchair");v!==void 0&&v!=="seat-present"&&v!=="no-seat"?e.push({severity:"error",code:"invalid-wheelchair-space",message:`Row "${t.label}" seat ${d.index+1} has an invalid wheelchair-space type`,objectId:t.id,seatIndices:[d.index]}):v&&(!h||d.skip)&&e.push({severity:"error",code:"invalid-wheelchair-space",message:d.skip?`Row "${t.label}" seat ${d.index+1} cannot have a wheelchair-space physical type while skipped from inventory`:`Row "${t.label}" seat ${d.index+1} must include wheelchair accessibility for its physical-space type`,objectId:t.id,seatIndices:[d.index]})}for(let d of Vt(t))ne(d.label)&&e.push({severity:"error",code:"reserved-seat-label",message:`Seat label "${d.label}" uses SeatLayer's reserved GA namespace`,objectId:t.id,seatIndices:[d.index]}),b.get(d.label)!==void 0?I.push({severity:"error",code:"duplicate-seat-label",message:`Seat label "${d.label}" is used more than once`,objectId:t.id,seatIndices:[d.index]}):b.set(d.label,t.id)}else if(t.type==="table"){let c=t.bookAsWhole===!0||t.variableOccupancy===!0;if(t.fill!==void 0&&!De(t.fill)&&e.push({severity:"error",code:"invalid-table-fill",message:`Table "${t.label}" has an invalid surface color`,objectId:t.id}),t.automaticRadius!==void 0&&typeof t.automaticRadius!="boolean"?e.push({severity:"error",code:"invalid-table-automatic-radius",message:`Table "${t.label}" has an invalid automatic-radius setting`,objectId:t.id}):t.automaticRadius===!0&&(t.shape!=="round"||t.radius!==Pe(t.seatCount,t.seatArc))&&e.push({severity:"error",code:"invalid-table-automatic-radius",message:`Table "${t.label}" needs a radius that matches its automatic chair spacing`,objectId:t.id}),t.seatCountsBySide){let h=["top","bottom","left","right"],x=Object.keys(t.seatCountsBySide),$=h.every(_=>Number.isInteger(t.seatCountsBySide[_])&&t.seatCountsBySide[_]>=0&&t.seatCountsBySide[_]<=40),A=$?h.reduce((_,Ct)=>_+t.seatCountsBySide[Ct],0):Number.NaN;(t.shape!=="rect"||x.length!==h.length||x.some(_=>!h.includes(_))||!$||A!==t.seatCount||A<1||A>40)&&e.push({severity:"error",code:"invalid-table-side-counts",message:`Table "${t.label}" needs top, bottom, left, and right whole-number chair counts totaling its ${t.seatCount}-chair capacity`,objectId:t.id})}c&&t.overrides?.length&&e.push({severity:"error",code:"grouped-table-chair-overrides",message:`Grouped table "${t.label}" cannot carry individual-chair overrides`,objectId:t.id,seatIndices:t.overrides.map(h=>h.index)});let d=new Set;for(let h of t.overrides??[]){(h.accessibility??[]).filter(_=>!r.has(_)).length&&e.push({severity:"error",code:"invalid-accessibility-type",message:`Table "${t.label}" chair ${h.index+1} uses an unknown accessibility type`,objectId:t.id,seatIndices:[h.index]}),(!Number.isInteger(h.index)||h.index<0||h.index>=t.seatCount||d.has(h.index))&&e.push({severity:"error",code:"invalid-seat-override",message:`Table "${t.label}" has a duplicated or out-of-range chair override`,objectId:t.id,...Number.isInteger(h.index)?{seatIndices:[h.index]}:{}}),d.add(h.index),h.categoryKey&&!i.has(h.categoryKey)?e.push({severity:"error",code:"unknown-category",message:`Table "${t.label}" chair ${h.index+1} references unknown category "${h.categoryKey}"`,objectId:t.id,seatIndices:[h.index],categoryKey:h.categoryKey}):h.categoryKey&&y.add(h.categoryKey);let $=h.wheelchairSpaceType,A=h.accessible===!0||h.accessibility?.includes("wheelchair");$!==void 0&&$!=="seat-present"&&$!=="no-seat"?e.push({severity:"error",code:"invalid-wheelchair-space",message:`Table "${t.label}" chair ${h.index+1} has an invalid wheelchair-space type`,objectId:t.id,seatIndices:[h.index]}):$&&(!A||h.skip)&&e.push({severity:"error",code:"invalid-wheelchair-space",message:h.skip?`Table "${t.label}" chair ${h.index+1} cannot have a wheelchair-space physical type while skipped from inventory`:`Table "${t.label}" chair ${h.index+1} must include wheelchair accessibility for its physical-space type`,objectId:t.id,seatIndices:[h.index]})}t.bookAsWhole&&t.variableOccupancy?e.push({severity:"error",code:"invalid-table-booking-mode",message:`Table "${t.label}" cannot be sold both as a whole table and with variable occupancy`,objectId:t.id}):t.variableOccupancy?(!Number.isInteger(t.minOccupancy)||!Number.isInteger(t.maxOccupancy)||t.minOccupancy<1||t.maxOccupancy<t.minOccupancy||t.maxOccupancy>t.seatCount)&&e.push({severity:"error",code:"invalid-table-occupancy",message:`Table "${t.label}" needs whole-number minimum and maximum guests from 1 to its ${t.seatCount}-chair capacity`,objectId:t.id}):(t.minOccupancy!=null||t.maxOccupancy!=null)&&e.push({severity:"error",code:"invalid-table-occupancy",message:`Table "${t.label}" has guest bounds without variable-occupancy selling`,objectId:t.id}),ee(t.referenceInventorySource)||e.push({severity:"error",code:"invalid-reference-inventory-source",message:`Table "${t.label}" has invalid reference-inventory provenance`,objectId:t.id}),(t.shape==="round"&&t.radius==null||t.shape==="rect"&&(t.width==null||t.height==null)||t.seatCount<1)&&e.push({severity:"error",code:"bad-table",message:`Table "${t.label}" is missing required dimensions or seats`,objectId:t.id});let v=c?[{label:t.label,index:void 0}]:mt(t);for(let h of v)ne(h.label)&&e.push({severity:"error",code:"reserved-seat-label",message:`Inventory label "${h.label}" uses SeatLayer's reserved GA namespace`,objectId:t.id}),b.get(h.label)!==void 0?I.push({severity:"error",code:"duplicate-seat-label",message:`Inventory label "${h.label}" is used more than once; grouped table labels must be unique`,objectId:t.id,...h.index===void 0?{}:{seatIndices:[h.index]}}):b.set(h.label,t.id)}else if(t.type==="booth"){ee(t.referenceInventorySource)||e.push({severity:"error",code:"invalid-reference-inventory-source",message:`Booth "${t.label}" has invalid reference-inventory provenance`,objectId:t.id});let c=t.label;ne(c)&&e.push({severity:"error",code:"reserved-seat-label",message:`Seat label "${c}" uses SeatLayer's reserved GA namespace`,objectId:t.id}),b.get(c)!==void 0?I.push({severity:"error",code:"duplicate-seat-label",message:`Seat label "${c}" is used more than once`,objectId:t.id}):b.set(c,t.id)}}else if(t.type==="gaArea"){if(!Ne(t))e.push({severity:"error",code:"invalid-ga-inventory-segments",message:`GA area "${t.label}" has invalid joined-area inventory provenance`,objectId:t.id});else for(let l of _e(t))b.get(l)!==void 0?I.push({severity:"error",code:"duplicate-seat-label",message:`GA inventory label "${l}" is used more than once`,objectId:t.id}):b.set(l,t.id);ee(t.referenceInventorySource)||e.push({severity:"error",code:"invalid-reference-inventory-source",message:`GA area "${t.label}" has invalid reference-inventory provenance`,objectId:t.id}),(!B(t.points)||Math.abs(z(t.points))<=1e-7||V(t.points))&&e.push({severity:"error",code:"invalid-ga-outline",message:`GA area "${t.label}" must have a finite, non-self-intersecting polygon outline`,objectId:t.id});let c=t.holes??[],d=Array.isArray(c)&&c.length<=64?c.findIndex(l=>!Array.isArray(l)||l.length>512||!B(l)||Math.abs(z(l))<=1e-7||V(l)?!0:!l.flatMap((h,x)=>{let $=l[(x+1)%l.length];return[h,{x:(h.x+$.x)/2,y:(h.y+$.y)/2}]}).every(h=>G(h,t.points))):0;if(d>=0)e.push({severity:"error",code:"invalid-ga-hole",message:`GA area "${t.label}" has a cutout outside its outline or with invalid geometry`,objectId:t.id,holeIndex:d});else if(c.some((l,v)=>c.slice(v+1).some(h=>J(l,h)))){let l=c.findIndex((v,h)=>c.slice(h+1).some(x=>J(v,x)));e.push({severity:"error",code:"overlapping-ga-holes",message:`GA area "${t.label}" has overlapping cutout polygons`,objectId:t.id,holeIndex:l})}i.has(t.categoryKey)?y.add(t.categoryKey):e.push({severity:"error",code:"unknown-category",message:`"${t.label}" references unknown category "${t.categoryKey}"`,objectId:t.id,categoryKey:t.categoryKey}),t.capacity<1&&e.push({severity:"error",code:"empty-ga",message:`GA area "${t.label}" has zero capacity`,objectId:t.id}),(!Number.isInteger(t.capacity)||t.capacity>ge)&&e.push({severity:"error",code:"invalid-ga-capacity",message:`GA area "${t.label}" capacity must be a whole number from 1 to ${ge}`,objectId:t.id}),w++,C+=Math.max(0,Math.floor(t.capacity))}else if(t.type==="section"){if(t.displayLabel!==void 0){let d=t.displayLabel.normalize("NFKC").trim();d?(d!==t.displayLabel||d.length>80)&&e.push({severity:"error",code:"invalid-display-label",message:`Section "${t.label}" must use a normalized buyer label of 1 to 80 characters`,objectId:t.id}):e.push({severity:"error",code:"unnamed-section",message:`Section "${t.label}" needs a buyer-facing name before seats are added`,objectId:t.id})}if(t.editor?.defaultCategoryKey&&!i.has(t.editor.defaultCategoryKey)&&e.push({severity:"error",code:"unknown-category",message:`Section "${t.label}" references unknown future-seat category "${t.editor.defaultCategoryKey}"`,objectId:t.id}),t.elevation!==void 0&&(!Number.isInteger(t.elevation)||t.elevation<de||t.elevation>q)){let d=Number.isInteger(t.elevation)&&t.elevation>q&&t.elevation<=Ee;n.push({severity:"warning",code:d?"legacy-section-elevation":"invalid-section-elevation",message:d?`Section "${t.label}" uses legacy tier ${t.elevation}; set an exact height before normalizing it to tier ${q}`:`Section "${t.label}" elevation must be a whole-number tier from ${de} to ${q}`,objectId:t.id})}if(t.height!==void 0&&(!Number.isFinite(t.height)||t.height<H||t.height>X)&&e.push({severity:"error",code:"invalid-section-height",message:`Section "${t.label}" exact height must be between ${H} and ${X} metres`,objectId:t.id}),t.rake!==void 0&&(!Number.isFinite(t.rake)||t.rake<ue||t.rake>fe)&&e.push({severity:"error",code:"invalid-section-rake",message:`Section "${t.label}" rake must be between ${ue}\xB0 and ${fe}\xB0`,objectId:t.id}),t.surfaceKind!==void 0&&t.surfaceKind!=="flat"&&t.surfaceKind!=="rakedRows"&&e.push({severity:"error",code:"invalid-section-surface-kind",message:`Section "${t.label}" surfaceKind must be 'flat' or 'rakedRows'`,objectId:t.id}),!B(t.outline)||Math.abs(z(t.outline))<=1e-7||V(t.outline)){e.push({severity:"error",code:"invalid-section-outline",message:`Section "${t.label}" must have a finite, non-self-intersecting polygon outline`,objectId:t.id});continue}if(t.outlinePath){let d=[];try{d=Ae(t.outlinePath)}catch{}(!Oe(t.outlinePath)||!d.length||Math.hypot(t.outlinePath.start.x-t.outline[0].x,t.outlinePath.start.y-t.outline[0].y)>1e-4||!B(d)||Math.abs(z(d))<=1e-7||V(d))&&e.push({severity:"error",code:"invalid-section-outline-path",message:`Section "${t.label}" has an invalid or inconsistent curved outline path`,objectId:t.id,edgeIndex:at(t)})}if(t.referenceSource&&(!/^ref_[0-9a-f-]{36}$/.test(t.referenceSource.assetId)||!/^(?:reg|ai)_[0-9a-f]{16}$/.test(t.referenceSource.regionId))&&e.push({severity:"error",code:"invalid-section-reference-source",message:`Section "${t.label}" has invalid opaque reference provenance`,objectId:t.id}),ut(t)||e.push({severity:"error",code:"invalid-section-inventory-exclusion",message:`Section "${t.label}" has incomplete or mismatched non-sellable evidence`,objectId:t.id}),t.logicalSectionId!==void 0&&!t.logicalSectionId.trim())e.push({severity:"error",code:"invalid-logical-section-id",message:`Section "${t.label}" has an empty logical section id`,objectId:t.id});else if(t.logicalSectionId){let d=JSON.stringify({displayLabel:t.displayLabel??null,entrance:t.entrance??null,viewFromSeatUrl:t.viewFromSeatUrl??null,viewFromSeatMeta:t.viewFromSeatMeta??null,confidenceEvidence:t.confidenceEvidence??null,zone:t.zone??null,labelStyle:t.labelPresentation?.labelStyle??null,labelVisible:t.labelPresentation?.visible!==!1}),l=k.get(t.logicalSectionId);l&&(l.label!==t.label||l.semanticSignature!==d)?e.push({severity:"error",code:"inconsistent-logical-section",message:`Logical section "${t.logicalSectionId}" must use one technical label and buyer-facing presentation across every component`,objectId:t.id}):l||k.set(t.logicalSectionId,{label:t.label,semanticSignature:d})}let S=t.holes??[];if(!Array.isArray(S)||S.length>64){e.push({severity:"error",code:"invalid-section-hole",message:`Section "${t.label}" has an invalid opening collection`,objectId:t.id});continue}let c=-1;for(let d=0;d<S.length;d++){let l=S[d];if(!Array.isArray(l)||l.length>512||!B(l)||Math.abs(z(l))<=1e-7||V(l)){c=d;break}if(!l.flatMap((h,x)=>{let $=l[(x+1)%l.length];return[h,{x:(h.x+$.x)/2,y:(h.y+$.y)/2}]}).every(h=>G(h,t.outline))){c=d;break}}if(c>=0)e.push({severity:"error",code:"invalid-section-hole",message:`Section "${t.label}" has an opening outside its outline or with an invalid shape`,objectId:t.id,holeIndex:c});else if(S.some((d,l)=>S.slice(l+1).some(v=>J(d,v)))){let d=S.findIndex((l,v)=>S.slice(v+1).some(h=>J(l,h)));e.push({severity:"error",code:"overlapping-section-holes",message:`Section "${t.label}" has overlapping openings`,objectId:t.id,holeIndex:d})}}let N=o.floors?.length?o.floors.map(t=>t.objects):[o.objects];for(let t of N){let S=t.filter(c=>c.type==="section");for(let c of t.filter(d=>d.type==="text")){let d=c.iconKey;d!==void 0&&!He(d)&&e.push({severity:"error",code:"invalid-icon-key",message:`Venue icon "${c.text||c.id}" references an unknown symbol`,objectId:c.id});let l=c.fontFamily;l!==void 0&&(typeof l!="string"||l.normalize("NFKC").trim()!==l||l.length<1||l.length>120)&&e.push({severity:"error",code:"invalid-text-font-family",message:`Text "${c.text||c.id}" font family must contain 1 to 120 normalized characters`,objectId:c.id});let v=c.background;(c.width!==void 0&&(!Number.isFinite(c.width)||c.width<40||c.width>1200)||c.align!==void 0&&!["left","center","right"].includes(c.align)||c.lineHeight!==void 0&&(!Number.isFinite(c.lineHeight)||c.lineHeight<.8||c.lineHeight>3)||c.letterSpacing!==void 0&&(!Number.isFinite(c.letterSpacing)||c.letterSpacing<-2||c.letterSpacing>20)||c.opacity!==void 0&&(!Number.isFinite(c.opacity)||c.opacity<.1||c.opacity>1)||v!==void 0&&(!/^#[0-9a-f]{6}$/i.test(v.color)||v.padding!==void 0&&(!Number.isFinite(v.padding)||v.padding<0||v.padding>40)||v.cornerRadius!==void 0&&(!Number.isFinite(v.cornerRadius)||v.cornerRadius<0||v.cornerRadius>40)||v.opacity!==void 0&&(!Number.isFinite(v.opacity)||v.opacity<.1||v.opacity>1)))&&e.push({severity:"error",code:"invalid-text-layout",message:`Text "${c.text||c.id}" has invalid width, spacing, opacity, alignment, or background layout`,objectId:c.id})}for(let c of t.filter(d=>d.type==="shape")){if(c.eventConfigurationIds!==void 0){let v=c.eventConfigurationIds;Array.isArray(v)&&v.length>0&&v.length<=20&&v.every(x=>typeof x=="string"&&x.normalize("NFKC").trim()===x&&x.length>=1&&x.length<=100)&&new Set(v).size===v.length||e.push({severity:"error",code:"invalid-shape-configurations",message:`Shape "${c.label||c.id}" must reference 1 to 20 unique event configuration ids`,objectId:c.id})}if(c.heightM!==void 0&&(!Number.isFinite(c.heightM)||c.heightM<.05||c.heightM>50)&&e.push({severity:"error",code:"invalid-shape-height",message:`Shape "${c.label||c.id}" height must be between 0.05 m and 50 m`,objectId:c.id}),c.stroke!==void 0&&(!c.stroke||typeof c.stroke.color!="string"||!/^#[0-9a-f]{6}$/i.test(c.stroke.color)||!Number.isFinite(c.stroke.width)||c.stroke.width<.5||c.stroke.width>40)&&e.push({severity:"error",code:"invalid-shape-stroke",message:`Shape "${c.label||c.id}" stroke must use a six-digit color and width from 0.5 to 40 chart units`,objectId:c.id}),(c.lineCap!==void 0||c.lineJoin!==void 0||c.startEnding!==void 0||c.endEnding!==void 0)&&!ve(c.kind)?e.push({severity:"error",code:"invalid-shape-line-style-applicability",message:`Shape "${c.label||c.id}" may use line caps, joins, and end decorations only when it is an open line or polyline`,objectId:c.id}):ve(c.kind)&&(c.lineCap!==void 0&&!Xe.includes(c.lineCap)||c.lineJoin!==void 0&&!Ye.includes(c.lineJoin)||c.startEnding!==void 0&&!he.includes(c.startEnding)||c.endEnding!==void 0&&!he.includes(c.endEnding))&&e.push({severity:"error",code:"invalid-shape-line-style",message:`Shape "${c.label||c.id}" has an unsupported line cap, join, or ending`,objectId:c.id}),c.kind==="polygon"){let v=nt(c.points??[]);v.ok||e.push({severity:"error",code:"invalid-shape-polygon",message:`Shape "${c.label||c.id}" has invalid polygon geometry: ${v.message}`,objectId:c.id})}let l=ct(c);if(l){for(let v of S)if(st(l,v.outline)){e.push({severity:"error",code:"reference-focal-overlaps-section",message:`Reference focal area "${c.label??c.id}" overlaps section "${v.label}"`,objectId:c.id});break}}}}C>me&&e.push({severity:"error",code:"inventory-capacity-exceeded",message:`Chart has ${C} bookable units; the maximum is ${me}`}),e.push(...I.slice(0,5)),I.length>5&&e.push({severity:"error",code:"duplicate-seat-label",message:`${I.length} seats share a label with another seat; the first 5 are listed above. Seat labels must be unique across the whole chart.`});for(let t of ie(o)){let S=t.families[0]?.targets[0];n.push({severity:"warning",code:"category-inventory-family-conflict",message:et(t),categoryKey:t.categoryKey,...S?{objectId:S.id,floorId:S.floorId}:{},relatedObjectIds:t.objectIds,categoryInventoryFamilies:t.families})}o.focalPoint||n.push({severity:"warning",code:"missing-focal-point",message:"Chart has no focal point set"}),w===0&&n.push({severity:"warning",code:"no-bookables",message:"Chart has no rows, tables, booths, or GA areas"});for(let t of y)if(s.get(t)===!1){let S=o.categories.find(c=>c.key===t);n.push({severity:"warning",code:"unpriced-category",message:`Category "${S?.label??t}" is used but has no price`,categoryKey:t})}return[...e,...n]}var Qt=9,It="#f7f8fb",qt="#f5f6f8",wt="#8b93a7",Ht="#0b1220",Xt="#0b1220",Yt="#ffffff",Wt=100;function T(o,e=2){let n=10**e;return Math.round(o*n)/n}function R(o){return{source:"quality",...o}}function Zt(o){return o.code==="missing-focal-point"||o.code==="missing-zone-focal-point"?"navigation":"structure"}function Ce(o){return Qt*qe(o.theme?.seatScale)}function St(o){let e=[];for(let n of o.objects)n.type==="row"?e.push(...D(n)):n.type==="table"&&e.push(...Y(n));return e}function Jt(o){let e={rowSeats:0,tableSeats:0,booths:0,gaCapacity:0};for(let n of o)for(let i of n.objects)i.type==="row"?e.rowSeats+=D(i).length:i.type==="table"?e.tableSeats+=Y(i).length:i.type==="booth"?e.booths+=1:i.type==="gaArea"&&(e.gaCapacity+=Math.max(0,Math.floor(i.capacity)));return{inventoryByKind:e,bookableUnits:e.rowSeats+e.tableSeats+e.booths+e.gaCapacity}}function L(o,e){o.filter(n=>n.code===e.code).length<Wt&&o.push(e)}function eo(o,e,n){let i=Ce(o),r=2*i,s=2.3*i,y=0,f=0,m=1/0;for(let a of e){let u=new Map(a.objects.filter(w=>w.type==="row").map(w=>[w.id,w])),g=w=>{let C=a.objects.find(E=>E.id===w);if(!C||C.type!=="row"&&C.type!=="table")return"another seating object";let O=C.type==="row"?D(C):Y(C),j=O.length?{x:O.reduce((E,N)=>E+N.x,0)/O.length,y:O.reduce((E,N)=>E+N.y,0)/O.length}:C.type==="row"?C.origin:C.center,P=a.objects.find(E=>E.type==="section"&&W(j,E.outline,E.holes)),M=C.type==="row"?`Row \u201C${C.label}\u201D`:`Table \u201C${C.label}\u201D`;return P?.type==="section"?`${M} in \u201C${P.label}\u201D`:M},p=St(a);y+=p.length;let b=s,I=new Map,k=new Map;for(let w of p){let C=Math.floor(w.x/b),O=Math.floor(w.y/b);for(let M=-1;M<=1;M++)for(let E=-1;E<=1;E++){let N=I.get(`${C+M}:${O+E}`)??[];for(let t of N){f++;let S=Math.hypot(w.x-t.x,w.y-t.y);if(m=Math.min(m,S),S>=s)continue;let d=(w.rowId<t.rowId?[w.rowId,t.rowId]:[t.rowId,w.rowId]).join("|"),l=k.get(d);(!l||S<l.distance)&&k.set(d,{a:w,b:t,distance:S})}}let j=`${C}:${O}`,P=I.get(j)??[];P.push(w),I.set(j,P)}for(let w of k.values()){let C=w.a.rowId===w.b.rowId,O=u.get(w.a.rowId),j=u.get(w.b.rowId),P=!C&&O?.segmentedRow?.repeatLabelOnComponents===!0&&j?.segmentedRow?.repeatLabelOnComponents===!0&&O.segmentedRow.groupId===j.segmentedRow.groupId,M=!!O?.referenceScan&&!!j?.referenceScan&&O.referenceScan.assetId===j.referenceScan.assetId&&O.referenceScan.sectionId===j.referenceScan.sectionId,E=w.distance<r;if((P||M)&&!E)continue;let N=E?"seat-overlap":"seat-cramped",t=g(w.a.rowId),S=g(w.b.rowId),c=T(E?r:s);L(n,R({severity:"warning",code:N,dimension:"geometry",title:E?C?`${t} has overlapping seats`:`${t} and ${S} overlap`:C?`${t} has seats too close together`:`${t} and ${S} are too close together`,message:E?`The closest seats are ${T(w.distance)} chart units apart, so their markers overlap on the buyer map; at least ${c} keeps them apart.`:`The closest seats are ${T(w.distance)} chart units apart; at least ${c} are required.`,action:C?`Increase the seat spacing for ${t}, or use Review safe fixes.`:`Move ${t} or ${S} until they no longer overlap.`,objectId:w.a.rowId,relatedObjectIds:C?[w.a.rowId]:[w.a.rowId,w.b.rowId],floorId:a.id,measured:T(w.distance),minimum:c,autoFixable:C}))}}return{seats:y,checkedSeatPairs:f,minimumSeatDistance:Number.isFinite(m)?T(m):null}}function se(o){let{width:e,height:n}=$e(o);if(!o.rotation)return{x:o.position.x,y:o.position.y,width:e,height:n};let i=[{x:0,y:0},{x:e,y:0},{x:e,y:n},{x:0,y:n}].map(r=>{let s=ke(r,o.rotation);return{x:o.position.x+s.x,y:o.position.y+s.y}});return Qe(i)}function xt(o,e,n=0){return o.x<e.x+e.width+n&&o.x+o.width+n>e.x&&o.y<e.y+e.height+n&&o.y+o.height+n>e.y}function xe(o,e,n){let i=te(e.x,o.x,o.x+o.width),r=te(e.y,o.y,o.y+o.height);return(e.x-i)**2+(e.y-r)**2<n**2}function to(o,e,n){let i=Ce(o),r=0;for(let s of e){let y=s.objects.filter(m=>m.type==="text"),f=St(s);r+=y.length;for(let m=0;m<y.length;m++){let a=y[m],u=se(a),g=f.find(p=>xe(u,p,i));g&&L(n,R({severity:"warning",code:"label-collision",dimension:"labels",message:`Text \u201C${a.text}\u201D overlaps seat ${g.label}`,objectId:a.id,relatedObjectIds:[a.id,g.rowId],floorId:s.id,autoFixable:!0}));for(let p=0;p<m;p++){let b=y[p];xt(u,se(b),2)&&L(n,R({severity:"warning",code:"label-collision",dimension:"labels",message:`Text \u201C${a.text}\u201D overlaps text \u201C${b.text}\u201D`,objectId:a.id,relatedObjectIds:[a.id,b.id],floorId:s.id,autoFixable:!0}))}}}return r}function Se(o){return o.normalize("NFKC").trim().toLowerCase().replace(/\s+/g," ")}function oo(o,e,n){let i=new Map;for(let f of e)for(let m of f.objects){let a=m.type,u=a==="row"||a==="table"||a==="booth"||a==="gaArea",g=u||a==="section";if(u&&!m.categoryKey.trim()){let p=a==="gaArea"?"GA area":a==="row"?"Row":a==="table"?"Table":"Booth";L(n,R({severity:"warning",code:"object-uncategorized",dimension:"structure",title:`${p} \u201C${m.label||m.id}\u201D has no category`,message:`${p} \u201C${m.label||m.id}\u201D is not assigned to any category, so buyers see no price or colour for it.`,action:"Assign a category to this object in the inspector, or create one in the Categories tab first.",objectId:m.id,floorId:f.id,autoFixable:!1}))}if(g){let p=(m.type==="section"?m.displayLabel??m.label:m.label)??"";if(p.trim()){if(a==="table"||a==="booth"||a==="gaArea"){let b=Se(p),I=i.get(b);I&&I.raw!==p?L(n,R({severity:"warning",code:"duplicate-object-label-normalized",dimension:"labels",title:`\u201C${p}\u201D and \u201C${I.raw}\u201D read as the same label`,message:`Labels \u201C${p}\u201D and \u201C${I.raw}\u201D differ only by case, spacing, or accents, so buyers cannot tell them apart.`,action:"Make the two labels visibly distinct.",objectId:m.id,relatedObjectIds:[m.id,I.id],floorId:f.id,autoFixable:!1})):I||i.set(b,{id:m.id,raw:p})}}else{let b=a==="gaArea"?"A GA area":a==="section"?"A section":a==="row"?"A row":a==="table"?"A table":"A booth";L(n,R({severity:"warning",code:"object-unlabeled",dimension:"labels",title:`${b} has no label`,message:`${b} has an empty label; buyers rely on labels to identify what they are booking.`,action:"Give this object a short, unique label in the inspector.",objectId:m.id,floorId:f.id,autoFixable:!1}))}}}let r=[];for(let f of e){let m=f.objects.filter(a=>a.type==="row"||a.type==="table"||a.type==="booth"||a.type==="gaArea");for(let a of f.objects)if(!(a.type!=="section"||a.referenceInventoryExclusion||m.some(g=>W(oe(g),a.outline,a.holes)))){if(a.referenceSource){r.push({id:a.id,floorId:f.id});continue}L(n,R({severity:"warning",code:"empty-section",dimension:"structure",title:`Section \u201C${a.displayLabel??a.label}\u201D is empty`,message:`Section \u201C${a.displayLabel??a.label}\u201D contains no rows, tables, booths, or GA areas.`,action:"Add seating inside this section (Fill with rows), or remove the empty section.",objectId:a.id,floorId:f.id,autoFixable:!1}))}}r.length&&L(n,R({severity:"warning",code:"empty-section",dimension:"structure",title:r.length===1?"1 traced section has no seating yet":`${r.length} traced sections have no seating yet`,message:`${r.length} section${r.length===1?"":"s"} traced from the reference image contain${r.length===1?"s":""} no rows, tables, booths, or GA areas.`,action:"Fill them with rows, or remove the ones the venue does not sell.",objectId:r[0].id,relatedObjectIds:r.map(f=>f.id),floorId:r[0].floorId,autoFixable:!1}));let s=new Map,y=new Map;for(let f of e){let m=[];for(let a of f.objects)a.type!=="section"||a.outline.length<3||m.push({id:a.logicalSectionId??a.id,outline:a.outline,...a.holes?{holes:a.holes}:{},bounds:so(a.outline)});for(let a of f.objects){if(a.type!=="row")continue;let u=(a.segmentedRow?.displayLabel??a.displayLabel??a.label??"").trim(),g=(a.displayType??"").trim(),p=u&&g&&Se(g)!=="row"?`${g} ${u}`:u,b="";if(m.length){let C=oe(a),O=m.find(j=>C.x>=j.bounds.minX&&C.x<=j.bounds.maxX&&C.y>=j.bounds.minY&&C.y<=j.bounds.maxY&&W(C,j.outline,j.holes));O&&(b=O.id)}let I=`${f.id}\0${b}\0${Se(p)}`,k=a.segmentedRow?.groupId??a.id;if(!p){let C=`${f.id}\0${b}`,O=y.get(C);O?(O.ids.push(a.id),O.logical.set(k,[...O.logical.get(k)??[],a])):y.set(C,{ids:[a.id],logical:new Map([[k,[a]]]),floorId:f.id});continue}let w=s.get(I);w?(w.ids.push(a.id),w.logical.set(k,[...w.logical.get(k)??[],a])):s.set(I,{ids:[a.id],logical:new Map([[k,[a]]]),floorId:f.id,raw:p})}}for(let{ids:f,logical:m,floorId:a,raw:u}of s.values()){let g=m.size;g<2||pt([...m.values()])&&L(n,R({severity:"warning",code:"duplicate-row-label",dimension:"labels",title:`${g} rows share the name \u201C${u}\u201D`,message:`${g} rows share the label \u201C${u}\u201D, so buyers cannot tell which row a seat belongs to.`,action:"Rename them so each row reads differently \u2014 for example the section or box each belongs to.",objectId:f[0],relatedObjectIds:f,floorId:a,autoFixable:!1}))}for(let{ids:f,logical:m,floorId:a}of y.values()){let u=m.size;u<2||pt([...m.values()])&&L(n,R({severity:"warning",code:"unnamed-row-collision",dimension:"labels",title:`${u} rows have no name`,message:`${u} rows in the same area have no name and repeat each other\u2019s seat numbers, so buyers cannot tell which row a seat belongs to.`,action:"Give each of these rows a name \u2014 for example the box each belongs to \u2014 so a ticket can say which row a seat is in.",objectId:f[0],relatedObjectIds:f,floorId:a,autoFixable:!1}))}if(o.floors&&o.floors.length>1)for(let f of o.floors)f.objects.length===0&&L(n,R({severity:"warning",code:"unused-floor",dimension:"structure",title:`Floor \u201C${f.name}\u201D is empty`,message:`Floor \u201C${f.name}\u201D has no objects on it.`,action:"Add seating to this floor, or delete it from the floor list below the canvas.",floorId:f.id,autoFixable:!1}))}var no=5,io=16;function ro(o,e,n){for(let i of e){let r=i.focalPoint??o.focalPoint;if(r)for(let s of i.objects){if(s.type!=="section"||s.outline.length<3)continue;let{rake:y}=Re(s);if(y<no)continue;let f=s.outline.map(p=>Math.hypot(p.x-r.x,p.y-r.y)),m=Math.max(...f);if(m<=0)continue;let a=(m-Math.min(...f))/m;if(y*a<=io)continue;let g=s.displayLabel??s.label;L(n,R({severity:"warning",code:"section-rake-inconsistent",dimension:"geometry",title:`Section \u201C${g}\u201D is too deep for a single rake`,message:`Section \u201C${g}\u201D spans ${Math.round(a*100)}% of its distance to the stage at a ${Math.round(y)}\xB0 rake, so one rake can't represent its sightlines faithfully \u2014 a real tier this deep changes slope at a cross-aisle.`,action:"Split this section at the cross-aisle into two sections, each with its own rake.",objectId:s.id,floorId:i.id,autoFixable:!1}))}}}function ao(o,e,n){let i=o.theme?.background??It,r=qt,s=new Map;for(let a of e)for(let u of a.objects){if(u.type!=="gaArea")continue;let g=s.get(u.categoryKey)??[];g.push({id:u.id,floorId:a.id}),s.set(u.categoryKey,g)}for(let a of o.categories){let u=F(a.color,i),g=F(a.color,r);if(u==null||g==null){L(n,R({severity:"error",code:"invalid-category-color",dimension:"contrast",message:`Category \u201C${a.label}\u201D does not use a supported hex color`,categoryKey:a.key}));continue}let p=Math.min(u,g);p<3&&L(n,R({severity:"warning",code:"category-contrast-low",dimension:"contrast",title:`Category \u201C${a.label}\u201D is hard to see`,message:`Category \u201C${a.label}\u201D reaches only ${T(p)}:1 across dark and light chart backgrounds; 3:1 is required`,action:`Choose a lighter or darker color for \u201C${a.label}\u201D until this warning clears.`,categoryKey:a.key,measured:T(p),minimum:3,autoFixable:!1}));let b=s.get(a.key)??[];if(b.length){let I=pe(a.color,i,be),k=pe(a.color,r,be),w=Math.min(F(I,i)??0,F(k,r)??0);w<3&&L(n,R({severity:"warning",code:"ga-contrast-low",dimension:"contrast",message:`GA category \u201C${a.label}\u201D reaches only ${T(w)}:1 after its rendered opacity is composited; 3:1 is required`,objectId:b[0].id,categoryKey:a.key,floorId:b[0].floorId,relatedObjectIds:b.map(C=>C.id),measured:T(w),minimum:3,autoFixable:!1}))}}for(let a=0;a<o.categories.length;a++)for(let u=0;u<a;u++){let g=o.categories[a],p=o.categories[u],b=Ke(g.color,p.color);b!=null&&b<25&&L(n,R({severity:"warning",code:"category-colors-too-similar",dimension:"contrast",title:`\u201C${g.label}\u201D and \u201C${p.label}\u201D look too similar`,message:`Categories \u201C${g.label}\u201D and \u201C${p.label}\u201D are only \u0394E ${T(b)} apart; 25 is required`,action:"Pick a visibly different color for either category so buyers can tell them apart.",categoryKey:g.key,measured:T(b),minimum:25,autoFixable:!1}))}for(let a of e){let u=a.objects.filter(g=>g.type==="text");for(let g of u){let p=g.color??o.theme?.textColor??wt,b=F(p,i),I=g.fontSize>=18?3:4.5;(b==null||b<I)&&L(n,R({severity:"warning",code:"text-contrast-low",dimension:"contrast",message:`Text \u201C${g.text}\u201D has ${T(b??0)}:1 contrast against the chart background; ${I}:1 is required`,objectId:g.id,floorId:a.id,measured:T(b??0),minimum:I,autoFixable:!0}))}}if(o.theme?.selectionColor){let a=F(o.theme.selectionColor,i);(a==null||a<3)&&L(n,R({severity:"warning",code:"selection-contrast-low",dimension:"contrast",title:"The selection color is hard to see",message:`Selection rings have ${T(a??0)}:1 contrast against the chart background; 3:1 is required.`,action:"In Theme, choose a Selection color that stands out clearly from the Background color.",measured:T(a??0),minimum:3,autoFixable:!1}))}if(o.theme?.textColor){let a=F(o.theme.textColor,i);(a==null||a<3)&&L(n,R({severity:"warning",code:"theme-text-contrast-low",dimension:"contrast",title:"The theme text color is hard to read",message:`Theme text has ${T(a??0)}:1 contrast against the chart background; 3:1 is required.`,action:"In Theme, choose a Text color with stronger contrast against the Background color.",measured:T(a??0),minimum:3,autoFixable:!1}))}let y=o.theme?.seatLabelColor??Ht,f=new Map,m=(a,u,g)=>{let p=f.get(a)??new Map,b=p.get(u)??[];b.push(g),p.set(u,b),f.set(a,p)};for(let a of e)for(let u of a.objects)if(u.type==="row")for(let g of re(u).keys())m(g,"seat",u.id);else if(u.type==="table")for(let g of re(u).keys())m(g,"table seat",u.id);else u.type==="booth"&&m(u.categoryKey,"booth",u.id);for(let a of o.categories){let u=f.get(a.key);if(u)for(let[g,p]of u){let b=g==="booth"?ze:Be,I=Ge(Ue,600),k=Ve(a.color,y),w=F(k,a.color);(w==null||w<I)&&L(n,R({severity:"warning",code:"bookable-label-contrast-low",dimension:"contrast",message:`${g==="booth"?"Booth":g==="seat"?"Seat":"Table-seat"} labels use ${b}u type and have ${T(w??0)}:1 contrast on category \u201C${a.label}\u201D; ${I}:1 is required for small text`,objectId:p[0],relatedObjectIds:p,measured:T(w??0),minimum:I,autoFixable:!0}))}}}function pt(o){if(o.length>24)return!0;let e=new Set;for(let n of o){let i=new Set;for(let r of n)for(let s of D(r)){let y=s.label,f=y.lastIndexOf("-");i.add(f>=0?y.slice(f+1):y)}if(!i.size)return!0;for(let r of i)if(e.has(r))return!0;for(let r of i)e.add(r)}return!1}function so(o){let e=1/0,n=1/0,i=-1/0,r=-1/0;for(let s of o)s.x<e&&(e=s.x),s.y<n&&(n=s.y),s.x>i&&(i=s.x),s.y>r&&(r=s.y);return{minX:e,minY:n,maxX:i,maxY:r}}function co(o,e){for(let n of o){let i=n.objects.filter(r=>r.type==="section");if(!(i.length<2))for(let r of n.objects){if(!(r.type==="row"||r.type==="table"||r.type==="booth"||r.type==="gaArea"))continue;let y=oe(r),f=i.filter(b=>W(y,b.outline,b.holes)),m=new Map;for(let b of f){let I=b.logicalSectionId??b.id,k=m.get(I)??[];k.push(b),m.set(I,k)}if(m.size<2)continue;let a=[...m.values()],u=a.map(b=>`Section \u201C${b[0].displayLabel??b[0].label}\u201D`),g=u.length===2?u.join(" and "):`${u.slice(0,-1).join(", ")}, and ${u[u.length-1]}`,p=r.type==="gaArea"?"GA area":r.type==="row"?"Row":r.type==="table"?"Table":"Booth";L(e,R({severity:"warning",code:"ambiguous-section-ownership",dimension:"structure",title:`${p} \u201C${r.label}\u201D belongs to more than one section`,message:`${p} \u201C${r.label}\u201D has its center inside ${g}, so its buyer section is unclear.`,action:"Adjust the boundaries until this object sits in one Section. If the overlapping shapes are meant to form one Section, combine them first.",objectId:r.id,relatedObjectIds:[r.id,...a.flatMap(b=>b.map(I=>I.id))],floorId:n.id,autoFixable:!1}))}}}var lo={structure:20,geometry:30,contrast:25,labels:15,navigation:10},uo={"seat-overlap":15,"seat-cramped":4,"label-collision":4,"category-contrast-low":3,"ga-contrast-low":3,"category-colors-too-similar":3,"invalid-category-color":10,"text-contrast-low":4,"bookable-label-contrast-low":3,"selection-contrast-low":3,"theme-text-contrast-low":3,"missing-focal-point":10,"object-uncategorized":3,"object-unlabeled":3,"duplicate-object-label-normalized":2,"empty-section":2,"unused-floor":2,"ambiguous-section-ownership":4,"category-inventory-family-conflict":10};function fo(o){let e={...lo};for(let r of o){let s=r.severity==="error"?10:2;e[r.dimension]=Math.max(0,e[r.dimension]-(uo[r.code]??s))}let n=Object.values(e).reduce((r,s)=>r+s,0),i=n>=95?"A":n>=85?"B":n>=70?"C":n>=55?"D":"F";return{overall:n,dimensions:e,errorFree:o.every(r=>r.severity!=="error"),grade:i}}var yo=new Set(["unpriced-category","object-uncategorized"]);function ht(o,e={}){let n=ye(o),i=bt(o).filter(u=>u.code!=="missing-zone-focal-point"||e.requireExplicitZoneFocals).map(u=>{let g=u.objectId?n.find(I=>I.objects.some(k=>k.id===u.objectId))?.id:void 0,p=u.code==="category-inventory-family-conflict",b=p?o.categories.find(I=>I.key===u.categoryKey):void 0;return R({...u,...p?{severity:"error",title:`Category \u201C${b?.label??u.categoryKey??"Unknown"}\u201D spans incompatible inventory types`,action:"Show the affected objects, then review the safe category split. The repair preserves price, ticket tiers, accessibility assignments, and source provenance."}:{},...e.requireExplicitZoneFocals&&u.code==="missing-zone-focal-point"?{severity:"error"}:{},...g?{floorId:g}:{},source:"structural",dimension:Zt(u),autoFixable:p})}),r=eo(o,n,i),s=Jt(n),y=to(o,n,i);if(oo(o,n,i),co(n,i),ro(o,n,i),ao(o,n,i),n.reduce((u,g)=>u+g.objects.filter(p=>p.type==="row"||p.type==="table"||p.type==="booth"||p.type==="gaArea").length,0)===0){let u=new Set(["missing-focal-point","no-bookables"]);for(let g=i.length-1;g>=0;g--)u.has(i[g].code)&&i.splice(g,1)}if(e.requirePricedInventory)for(let u=0;u<i.length;u++)yo.has(i[u].code)&&(i[u]={...i[u],severity:"error"});let m=i.filter(u=>u.severity==="error"),a=i.filter(u=>u.severity==="warning");return{issues:i,errors:m,warnings:a,metrics:{floors:n.length,objects:n.reduce((u,g)=>u+g.objects.length,0),seats:r.seats,bookableUnits:s.bookableUnits,inventoryByKind:s.inventoryByKind,categories:o.categories.length,freeTextLabels:y,checkedSeatPairs:r.checkedSeatPairs,minimumSeatDistance:r.minimumSeatDistance},score:fo(i),deferredRules:["rendered-row-label-decollision","rendered-bookable-state-contrast","section-focus-opacity-and-backdrop","24px-pointer-hit-target","reference-image-diff","sightline-blocked","ga-density-high"]}}function go(o,e){if(o.seatCount<2||o.seatSpacing>=e)return!1;let n=le(D(o));o.seatSpacing=T(e,3);let i=le(D(o));return o.origin.x=T(o.origin.x+n.x-i.x,3),o.origin.y=T(o.origin.y+n.y-i.y,3),!0}function mo(o,e){if(o.seatCount<2)return!1;let n=!1;if(o.shape==="round"){let i=te(o.seatArc??360,0,360),r=(i>=360?360/o.seatCount:i/(o.seatCount-1))*Math.PI/180;if(r>0){let s=e/(2*Math.sin(r/2)),y=Math.max(1,s-16);(o.radius??40)<y&&(o.radius=T(y,3),n=!0)}}else{let i=Me(o),r=Math.max(i.top,i.bottom),s=Math.max(i.left,i.right);r>1&&(o.width??80)/r<e&&(o.width=T(r*e,3),n=!0),s>1&&(o.height??50)/s<e&&(o.height=T(s*e,3),n=!0)}return n}function bo(o){return[Xt,Yt].map(n=>({color:n,minimum:Math.min(...o.map(i=>F(n,i)??0))})).sort((n,i)=>i.minimum-n.minimum)[0].color}function vt(o,e,n){let i=se(o),r=0;for(let s of e)s.type==="row"?r+=D(s).filter(y=>xe(i,y,n)).length:s.type==="table"?r+=Y(s).filter(y=>xe(i,y,n)).length:s.type==="text"&&s.id!==o.id&&xt(i,se(s),2)&&r++;return r}function po(o,e,n){if(vt(o,e,n)===0)return!1;let r={...o.position},s=Math.max(12,o.fontSize*1.25),y=[[0,-1],[1,0],[0,1],[-1,0],[1,-1],[1,1],[-1,1],[-1,-1]];for(let f=1;f<=12;f++)for(let[m,a]of y)if(o.position={x:T(r.x+m*s*f,3),y:T(r.y+a*s*f,3)},vt(o,e,n)===0)return!0;return o.position=r,!1}function on(o){let e=JSON.parse(JSON.stringify(o)),n=ht(e),i=[],r=ot(e);if(r.changed){e=r.doc;for(let u of r.changes){let g=r.before.find(b=>b.categoryKey===u.categoryKey),p=g?.families.map(b=>b.label).join(", ")??"inventory families";i.push({code:"category-inventory-family-conflict",objectId:g?.objectIds[0],message:`Split category \u201C${u.categoryLabel}\u201D across ${p}; preserved its commercial metadata and reassigned ${u.reassignments.length} affected object${u.reassignments.length===1?"":"s"}`})}}let s=Ce(e),y=2.5*s,f=ye(e);for(let u of f)for(let g of u.objects)if(g.type==="row"){let p=g.seatSpacing;go(g,y)&&i.push({code:p<2*s?"seat-overlap":"seat-cramped",objectId:g.id,message:`Expanded ${g.id} to the ${T(y)}u target pitch while preserving its centre`})}else g.type==="table"&&mo(g,y)&&i.push({code:"seat-cramped",objectId:g.id,message:`Expanded ${g.id} so its perimeter seats meet the ${T(y)}u target pitch`});let m=e.theme?.background??It;for(let u of f)for(let g of u.objects){if(g.type!=="text")continue;let p=g.color??e.theme?.textColor??wt,b=g.fontSize>=18?3:4.5;(F(p,m)??0)<b&&(g.color=bo([m]),i.push({code:"text-contrast-low",objectId:g.id,message:`Changed ${g.id} to the highest-contrast black/white ink`}))}for(let u of f){let g=u.objects.filter(p=>p.type==="text");for(let p of g)po(p,u.objects,s)&&i.push({code:"label-collision",objectId:p.id,message:`Moved ${p.id} to the nearest collision-free deterministic label position`})}e.floors?.length&&(e.objects=e.floors[0].objects);let a=ht(e);return{doc:e,changed:i.length>0,fixes:i,before:n,after:a}}export{Ie as a,re as b,ie as c,et as d,ot as e,vo as f,nt as g,on as h};
@@ -1 +0,0 @@
1
- import{Ba as I,Ca as h,Ha as m,Ka as d,xa as p}from"./chunk-E7TOTX6I.js";var f="__sl_ga__";function j(t){return t.startsWith(f)}var S=f,g=1e5,N=1e5;function x(t,e){return`${S}${encodeURIComponent(t)}__${e+1}`}function _(t){let e=t.inventorySegments;if(e===void 0)return!0;if(!Array.isArray(e)||e.length<1||e.length>256)return!1;let r=0,i=new Map;for(let o of e){if(!o||typeof o.sourceAreaId!="string"||!o.sourceAreaId.trim()||o.sourceAreaId.length>160||!Number.isInteger(o.startIndex)||o.startIndex<0||!Number.isInteger(o.count)||o.count<1||o.startIndex+o.count>g||(r+=o.count,r>g))return!1;let u=i.get(o.sourceAreaId)??[],n=o.startIndex+o.count;if(u.some(s=>o.startIndex<s.end&&n>s.start))return!1;u.push({start:o.startIndex,end:n}),i.set(o.sourceAreaId,u)}return r===t.capacity}function A(t){let e=Math.min(g,Math.max(0,Math.floor(t.capacity)));return t.inventorySegments===void 0?e?[{sourceAreaId:t.id,startIndex:0,count:e}]:[]:_(t)?t.inventorySegments.map(r=>({...r})):[]}function y(t){return A(t).flatMap(e=>Array.from({length:e.count},(r,i)=>x(e.sourceAreaId,e.startIndex+i)))}function E(t,e){if(t.inventorySegments===void 0||e===t.capacity)return t.inventorySegments;if(e<t.capacity)return;let r=A(t);if(!r.length)return;let i=e-t.capacity;if(!i)return r;let u=r.filter(s=>s.sourceAreaId===t.id).reduce((s,a)=>Math.max(s,a.startIndex+a.count),0),n=r[r.length-1];if(n?.sourceAreaId===t.id&&n.startIndex+n.count===u)n.count+=i;else{if(r.length>=256)return;r.push({sourceAreaId:t.id,startIndex:u,count:i})}return r}function T(t){return d(t).filter(e=>e.type==="gaArea")}var b="__ungrouped__";function O(t){return t.type==="row"?p(t).map(e=>e.label):t.type==="table"?I(t).map(e=>e.label):t.type==="booth"?h(t).map(e=>e.label):t.type==="gaArea"?y(t):[]}function G(t){return t.type==="row"||t.type==="table"||t.type==="booth"||t.type==="gaArea"}function C(t){let e=d(t),r=e.filter(n=>n.type==="section"),i=new Map;for(let n of r){let s=n.logicalSectionId??n.id;i.get(s)||i.set(s,{id:s,label:n.displayLabel||n.label||"Section",zone:n.zone,seatCount:0,objectIds:[],seatLabels:[]})}let o={id:b,label:"Other seats",seatCount:0,objectIds:[],seatLabels:[]},u=new Map;for(let n of e){if(!G(n))continue;let s=O(n);if(s.length===0)continue;let a=m(e,n),c=a?i.get(a.logicalSectionId??a.id):o;c.seatCount+=s.length,c.objectIds.push(n.id),c.seatLabels.push(...s),u.set(n.id,c.id)}return{sections:[...i.values()],ungrouped:o.objectIds.length?o:null,objectToSection:u}}function w(t,e){return e.has(t.id)||!!t.logicalSectionId&&e.has(t.logicalSectionId)||!!t.zone&&e.has(t.zone)}function v(t,e){let r=new Set;if(!e.size)return r;let{sections:i,ungrouped:o,objectToSection:u}=C(t),n=new Set,s=new Map(i.map(c=>[c.id,c.zone]));for(let c of i){let l=s.get(c.id);(e.has(c.id)||l&&e.has(l))&&n.add(c.id)}let a=!!o&&e.has(b);for(let[c,l]of u)(n.has(l)||a&&l===b)&&r.add(c);return r}function X(t,e){if(!e.size)return t;let r=v(t,e),i=e instanceof Set?e:new Set(e),o=n=>!(r.has(n.id)||n.type==="section"&&w(n,i));if(t.floors&&t.floors.length){let n=!1,s=t.floors.map(a=>{let c=a.objects.filter(o);return c.length!==a.objects.length&&(n=!0),c.length===a.objects.length?a:{...a,objects:c}});return n?{...t,floors:s,objects:s[0].objects}:t}let u=t.objects.filter(o);return u.length===t.objects.length?t:{...t,objects:u}}export{f as a,j as b,g as c,N as d,x as e,_ as f,A as g,y as h,E as i,T as j,b as k,C as l,w as m,v as n,X as o};
@@ -1 +0,0 @@
1
- import{h as xe,i as ne}from"./chunk-5ITK5236.js";import{c as Se}from"./chunk-CRCGO52K.js";var kn=2e6,ut=/^data:image\/(?:png|jpe?g|webp|gif|avif);base64,[a-z0-9+/]+={0,2}$/i,dt=/[\s"'<>`\\]/;function ft(e){if(typeof e!="string"||!e||e.length>2e6||e!==e.trim())return!1;if(e.startsWith("data:"))return ut.test(e);if(dt.test(e))return!1;try{let t=new URL(e);return t.protocol==="https:"&&!t.username&&!t.password}catch{return!1}}function Me(e){let t=e.trim();return ft(t)?t:null}var Y="seatlayer.event-configuration/1",oe="seatlayer.event-configuration-export/1",D=100,ht=120,mt=1e5,pt=1e4,we=/^[a-f0-9]{64}$/,bt=new Set(["stage","screen","barrier","camera_platform","sound_desk","rigging_truss"]);function V(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function j(e,t){return typeof e=="string"&&e.length>=1&&e.length<=t&&e.normalize("NFKC").trim()===e}function Ee(e){return typeof e=="number"&&Number.isInteger(e)&&e>0}function ve(e){return!Array.isArray(e)||e.length>mt||!e.every(t=>j(t,D))?null:[...new Set(e)].sort()}function Ie(e){return!V(e)||!j(e.chartId,D)||!j(e.version,D)||e.sha256!==void 0&&(typeof e.sha256!="string"||!we.test(e.sha256))?null:{chartId:e.chartId,version:e.version,...typeof e.sha256=="string"?{sha256:e.sha256}:{}}}function ie(e,t,n){return typeof e=="number"&&Number.isFinite(e)&&e>=t&&e<=n}function yt(e){return V(e)?e.mode==="none"||e.mode==="opaque"?e.opacity===void 0?{mode:e.mode}:null:e.mode==="partial"&&ie(e.opacity,.01,.99)?{mode:"partial",opacity:e.opacity}:null:null}function gt(e,t){if(e===void 0)return;if(!Array.isArray(e)||e.length>pt)return null;let n=new Set(t),i=new Set,o=new Set,r=0,s=[];for(let l of e){if(!V(l)||!j(l.id,D)||!j(l.objectId,D)||!n.has(l.objectId)||!bt.has(String(l.kind))||!ie(l.heightM,.05,50)||l.baseElevationM!==void 0&&!ie(l.baseElevationM,-10,100))return null;let c=yt(l.occlusion);if(!c||i.has(l.id)||o.has(l.objectId))return null;let u=l.contentImageUrl===void 0?void 0:typeof l.contentImageUrl=="string"?Me(l.contentImageUrl):null;if(l.contentImageUrl!==void 0&&(!u||l.kind!=="screen"||++r>1))return null;i.add(l.id),o.add(l.objectId),s.push({id:l.id,objectId:l.objectId,kind:l.kind,heightM:l.heightM,...l.baseElevationM!==void 0?{baseElevationM:l.baseElevationM}:{},occlusion:c,...u?{contentImageUrl:u}:{}})}return s.sort((l,c)=>l.id.localeCompare(c.id))}function Pe(e){let t=[];if(!V(e))return{issues:[{code:"invalid_export",path:"configuration",message:"Configuration must be an object"}]};e.schema!==Y&&t.push({code:"unsupported_schema",path:"configuration.schema",message:`Configuration schema must be ${Y}`}),j(e.id,D)||t.push({code:"invalid_id",path:"configuration.id",message:"Configuration id must contain 1 to 100 normalized characters"}),j(e.label,ht)||t.push({code:"invalid_label",path:"configuration.label",message:"Configuration label must contain 1 to 120 normalized characters"}),Ee(e.version)||t.push({code:"invalid_version",path:"configuration.version",message:"Configuration version must be a positive integer"});let n=Ie(e.baseVenue);n||t.push({code:"invalid_base_venue",path:"configuration.baseVenue",message:"Base venue must identify one normalized chart id and exact version"});let i=V(e.overlay)?e.overlay:null,o=ve(i?.objectIds),r=ve(i?.productionKillSeatIds),s=o?gt(i?.productionElements,o):null;return(!i||!o||!r)&&t.push({code:"invalid_overlay",path:"configuration.overlay",message:"Overlay ids must be bounded arrays of normalized stable ids"}),s===null&&t.push({code:"invalid_production_element",path:"configuration.overlay.productionElements",message:"Production elements must be unique, bounded semantics over referenced base-venue objects"}),t.length||!n||!o||!r||s===null?{issues:t}:{issues:t,value:{schema:Y,id:e.id,label:e.label,version:e.version,baseVenue:n,overlay:{objectIds:o,productionKillSeatIds:r,...s!==void 0?{productionElements:s}:{}}}}}function On(e){let t=Pe(e);return t.value?{ok:!0,value:t.value}:{ok:!1,issues:t.issues}}function An(e){if(!V(e))return{ok:!1,issues:[{code:"invalid_export",path:"",message:"Export must be an object"}]};let t=[];e.schema!==oe&&t.push({code:"unsupported_schema",path:"schema",message:`Export schema must be ${oe}`}),(typeof e.contentSha256!="string"||!we.test(e.contentSha256))&&t.push({code:"invalid_checksum",path:"contentSha256",message:"Export checksum must be a lowercase SHA-256 digest"});let n=Pe(e.configuration);return t.push(...n.issues),t.length||!n.value||typeof e.contentSha256!="string"?{ok:!1,issues:t}:{ok:!0,value:{schema:oe,configuration:n.value,contentSha256:e.contentSha256}}}function jn(e){return JSON.stringify({schema:Y,id:e.id,label:e.label,version:e.version,baseVenue:{chartId:e.baseVenue.chartId,version:e.baseVenue.version,...e.baseVenue.sha256?{sha256:e.baseVenue.sha256}:{}},overlay:{objectIds:[...new Set(e.overlay.objectIds)].sort(),productionKillSeatIds:[...new Set(e.overlay.productionKillSeatIds)].sort(),...e.overlay.productionElements!==void 0?{productionElements:[...e.overlay.productionElements].sort((t,n)=>t.id.localeCompare(n.id)).map(t=>({id:t.id,objectId:t.objectId,kind:t.kind,heightM:t.heightM,...t.baseElevationM!==void 0?{baseElevationM:t.baseElevationM}:{},occlusion:t.occlusion,...t.contentImageUrl?{contentImageUrl:t.contentImageUrl}:{}}))}:{}}})}function Ln(e,t){let n=[];e.baseVenue.chartId!==t.chartId&&n.push({code:"base_venue_mismatch",message:"Configuration belongs to a different base venue"}),e.baseVenue.version!==t.version&&n.push({code:"base_venue_version_mismatch",message:"Configuration was authored against a different venue version"}),e.baseVenue.sha256&&!t.sha256?n.push({code:"base_venue_checksum_missing",message:"Venue checksum is required for this configuration"}):e.baseVenue.sha256&&e.baseVenue.sha256!==t.sha256&&n.push({code:"base_venue_checksum_mismatch",message:"Venue bytes do not match the configuration base"});let i=new Set(t.objectIds);for(let r of e.overlay.objectIds)i.has(r)||n.push({code:"overlay_object_missing",message:`Production object ${r} is missing from the base venue`,targetId:r});if(t.objectTypes)for(let r of e.overlay.productionElements??[])t.objectTypes.get(r.objectId)!=="shape"&&n.push({code:"production_element_not_shape",message:`Production element ${r.id} must reference base-venue shape geometry`,targetId:r.objectId});let o=new Set(t.seatIds);for(let r of e.overlay.productionKillSeatIds)o.has(r)||n.push({code:"production_kill_seat_missing",message:`Production-kill seat ${r} is missing from the base venue`,targetId:r});return{compatible:n.length===0,issues:n}}var xt={draft:new Set(["review","archived"]),review:new Set(["draft","approved","archived"]),approved:new Set(["published","archived"]),published:new Set(["archived"]),archived:new Set};function Nn(e,t){return e===t||xt[e].has(t)}function Fn(e,t,n){return!Ee(n)||n>=t.version?null:e.find(i=>i.id===t.id&&i.version===n&&i.status==="published")??null}function St(e){return e.floors?.length?e.floors.flatMap(t=>t.objects):e.objects}function re(e,t,n){if(!(!e||typeof e!="object")){if(Array.isArray(e)){for(let i of e)re(i,t,n);return}for(let[i,o]of Object.entries(e)){if(i==="eventConfigurationId"){j(o,D)?t.add(o):o!==void 0&&n.add(String(o));continue}if(i==="eventConfigurationIds"){if(!Array.isArray(o))n.add(String(o));else for(let r of o)j(r,D)?t.add(r):n.add(String(r));continue}re(o,t,n)}}}function Dn(e,t){let n=Ie(t);if(!n)return{ok:!1,invalidIds:["baseVenue"]};let i=new Set,o=new Set;if(re(e,i,o),o.size)return{ok:!1,invalidIds:[...o].sort()};let r=St(e);return{ok:!0,configurations:[...i].sort().map(s=>({schema:Y,id:s,label:s,version:1,baseVenue:n,overlay:{objectIds:r.filter(l=>l.type==="shape"&&l.eventConfigurationIds?.includes(s)).map(l=>l.id).sort(),productionKillSeatIds:[]}}))}}var Vn=40,Un=1200,Kn=.8,Xn=3,Gn=-2,Bn=20,zn=.1,Yn=40,Wn=40,Ce=e=>Math.max(1,e.fontSize*.6+(e.letterSpacing??0));function Mt(e,t){let n=e.text.split(/\r?\n/);if(!e.width)return Math.max(1,n.length);let i=Math.max(1,Math.floor(t/Ce(e))),o=0;for(let r of n){if(!r.length){o+=1;continue}let s=0;for(let l of r.split(/\s+/)){let c=l.length;s&&s+1+c<=i?s+=1+c:(o+=Math.max(1,Math.ceil(c/i)),s=c%i)}}return Math.max(1,o)}function _e(e){let t=e.background?.padding??0,n=e.text.split(/\r?\n/),i=Math.max(1,...n.map(l=>l.length))*Ce(e),o=e.width??i+t*2,r=Math.max(1,o-t*2),s=Mt(e,r);return{width:o,height:s*e.fontSize*(e.lineHeight??1.2)+t*2,lineCount:s,padding:t}}var vt=Math.PI/180;function P(e,t){return Math.hypot(e.x-t.x,e.y-t.y)}function wt(e,t,n){let i=Math.cos(n),o=Math.sin(n),r=e.x-t.x,s=e.y-t.y;return{x:t.x+r*i-s*o,y:t.y+r*o+s*i}}function qn(e,t){return wt(e,{x:0,y:0},t*vt)}function R(e,t,n){return{x:e.x+(t.x-e.x)*n,y:e.y+(t.y-e.y)*n}}function Et(e){let t=0,n=0;for(let o of e)t+=o.x,n+=o.y;let i=e.length||1;return{x:t/i,y:n/i}}function Jn(e){return e.length?Et(e):null}function se(e,t){let n=1-t,i=n*n*n,o=3*n*n*t,r=3*n*t*t,s=t*t*t;return{x:i*e.start.x+o*e.control1.x+r*e.control2.x+s*e.end.x,y:i*e.start.y+o*e.control1.y+r*e.control2.y+s*e.end.y}}function eo(e,t,n){let i={x:(e.x+t.x)/2,y:(e.y+t.y)/2},o={x:(n.x-i.x)*4/3,y:(n.y-i.y)*4/3};return{start:{...e},control1:{x:e.x+(t.x-e.x)/3+o.x,y:e.y+(t.y-e.y)/3+o.y},control2:{x:e.x+(t.x-e.x)*2/3+o.x,y:e.y+(t.y-e.y)*2/3+o.y},end:{...t}}}function Te(e,t,n=192){if(!Number.isInteger(t)||t<1)throw new Error("Path point count must be a positive integer");if(t===1)return[se(e,.5)];let i=Array.from({length:n+1},(c,u)=>se(e,u/n)),o=new Float64Array(i.length);for(let c=1;c<i.length;c+=1){let u=i[c].x-i[c-1].x,a=i[c].y-i[c-1].y;o[c]=o[c-1]+Math.hypot(u,a)}let r=o[o.length-1];if(r<=1e-9)return Array.from({length:t},()=>({...e.start}));let s=[],l=1;for(let c=0;c<t;c+=1){let u=r*c/(t-1);for(;l<o.length-1&&o[l]<u;)l+=1;let a=o[l-1],m=o[l],h=m===a?0:(u-a)/(m-a);s.push({x:i[l-1].x+(i[l].x-i[l-1].x)*h,y:i[l-1].y+(i[l].y-i[l-1].y)*h})}return s}function T(e,t){return{x:e.x+t.x,y:e.y+t.y}}function W(e,t){return{x:e.x-t.x,y:e.y-t.y}}function O(e,t){return{x:e.x*t,y:e.y*t}}function q(e,t=13){return Array.from({length:t},(n,i)=>se(e,i/(t-1)))}function ke(e,t){let n=Math.max(0,Math.min(1,t))*(e.length-1),i=Math.min(e.length-2,Math.floor(n));return R(e[i],e[i+1],n-i)}function Re(e,t,n){let i=Math.max(0,Math.min(1,t)),o=Math.max(i,Math.min(1,n)),r=[ke(e,i)];for(let s=1;s<e.length-1;s+=1){let l=s/(e.length-1);l>i+1e-9&&l<o-1e-9&&r.push(e[s])}return r.push(ke(e,o)),r}function Oe(e,t){let n=[[0,1],[1,2],[2,3],[3,0]],i=0,o=Number.POSITIVE_INFINITY;n.forEach(([h,f],b)=>{let y=P(R(e[h],e[f],.5),t);y<o&&(o=y,i=b)});let r=e[i],s=e[(i+1)%4],l=e[(i+2)%4],c=e[(i+3)%4],u=R(r,s,.5),a=W(t,u),m=Math.max(1e-9,Math.hypot(a.x,a.y));return{p0:r,p1:s,p2:l,p3:c,normal:O(a,1/m),depth:(P(r,c)+P(s,l))/2}}function Ae(e){let{p0:t,p1:n,p2:i,p3:o,normal:r,depth:s}=e,l=W(n,t),c=W(i,o),u=s*.22,a=s*.12;return{nearPath:{start:t,control1:T(T(t,O(l,1/3)),O(r,u)),control2:T(T(t,O(l,2/3)),O(r,u)),end:n},farPath:{start:i,control1:T(T(o,O(c,2/3)),O(r,a)),control2:T(T(o,O(c,1/3)),O(r,a)),end:o}}}function to(e,t,n){if(e.length!==4)throw new Error("A section shell requires four mapped bounds corners");let i=e.reduce((b,y)=>T(b,y),{x:0,y:0});i.x/=4,i.y/=4;let o=P(e[0],e[1]),r=P(e[0],e[3]),s=n==="auto"?o>r*1.25&&P(i,t)>r?"bezier":"tapered":n;if(s==="rectangle")return{mode:s,outline:e.map(b=>({...b}))};let l=Oe(e,t),{p0:c,p1:u,p2:a,p3:m}=l;if(s==="tapered")return{mode:s,outline:[T(c,O(W(u,c),.14)),T(c,O(W(u,c),1-.14)),a,m]};let{nearPath:h,farPath:f}=Ae(l);return{mode:s,outline:[...q(h),...q(f).slice(1)]}}function no(e,t,n,i){if(e.length!==4)throw new Error("Aisle generation requires four mapped bounds corners");if(!Number.isInteger(n)||n<0||n>3)throw new Error("Aisle count must be an integer from 0 to 3");if(n===0)return[];let o=Oe(e,t),{p0:r,p1:s,p2:l,p3:c}=o,u=i==="bezier"?Ae(o):null,a=u?q(u.nearPath):null,m=u?q(u.farPath).reverse():null,h=Math.min(.055,.18/(n+1));return Array.from({length:n},(f,b)=>{let y=(b+1)/(n+1),p=y-h/2,g=y+h/2;return a&&m?[...Re(a,p,g),...Re(m,p,g).reverse()]:[R(r,s,p),R(r,s,g),R(c,l,g),R(c,l,p)]})}function It(e,t,n){let i=n.x-t.x,o=n.y-t.y,r=i*i+o*o,s=r?Math.max(0,Math.min(1,((e.x-t.x)*i+(e.y-t.y)*o)/r)):0;return Math.hypot(e.x-(t.x+s*i),e.y-(t.y+s*o))}function Pt(e,t){let n=1/0;for(let i of t)if(!(i.length<2))for(let o=0,r=i.length-1;o<i.length;r=o++){let s=It(e,i[r],i[o]);s<n&&(n=s)}return n}function je(e,t){let n=!1;for(let i=0,o=t.length-1;i<t.length;o=i++){let r=t[i].x,s=t[i].y,l=t[o].x,c=t[o].y;s>e.y!=c>e.y&&e.x<(l-r)*(e.y-s)/(c-s)+r&&(n=!n)}return n}function Ct(e,t,n){let i=je(e,t)&&!n.some(r=>je(e,r)),o=Pt(e,[t,...n]);return i?o:-o}function U(e,t,n,i,o){let r=Ct({x:e,y:t},i,o);return{x:e,y:t,h:n,d:r,max:r+n*Math.SQRT2}}var ae=class{constructor(){this.items=[]}get size(){return this.items.length}push(t){let n=this.items;n.push(t);let i=n.length-1;for(;i>0;){let o=i-1>>1;if(n[o].max>=n[i].max)break;[n[o],n[i]]=[n[i],n[o]],i=o}}pop(){let t=this.items,n=t[0],i=t.pop();if(t.length&&i){t[0]=i;let o=0;for(;;){let r=o*2+1,s=r+1,l=o;if(r<t.length&&t[r].max>t[l].max&&(l=r),s<t.length&&t[s].max>t[l].max&&(l=s),l===o)break;[t[l],t[o]]=[t[o],t[l]],o=l}}return n}};function Le(e){if(e.length<3)return 0;let t=0;for(let n=0,i=e.length-1;n<e.length;i=n++)t+=(e[i].x+e[n].x)*(e[i].y-e[n].y);return Math.abs(t)/2}function io(e,t){return Math.max(0,Le(e)-(t??[]).reduce((n,i)=>n+Le(i),0))}function Ne(e,t){let n=t??[];if(!e.length)return{point:{x:0,y:0},radius:0};if(e.length<3){let y=e.reduce((g,S)=>g+S.x,0)/e.length,p=e.reduce((g,S)=>g+S.y,0)/e.length;return{point:{x:y,y:p},radius:0}}let i=1/0,o=1/0,r=-1/0,s=-1/0;for(let y of e)y.x<i&&(i=y.x),y.y<o&&(o=y.y),y.x>r&&(r=y.x),y.y>s&&(s=y.y);let l=r-i,c=s-o,u=Math.min(l,c);if(!(u>0))return{point:{x:(i+r)/2,y:(o+s)/2},radius:0};let a=Math.max(l,c)/150,m=new ae,h=u/2;for(let y=i;y<r;y+=u)for(let p=o;p<s;p+=u)m.push(U(y+h,p+h,h,e,n));let f=U(i+l/2,o+c/2,0,e,n),b=0;for(;m.size;){let y=m.pop();if(!y)break;y.d>f.d&&(f=y),!(y.max-f.d<=a)&&(b>=4e3||(b+=1,h=y.h/2,m.push(U(y.x-h,y.y-h,h,e,n)),m.push(U(y.x+h,y.y-h,h,e,n)),m.push(U(y.x-h,y.y+h,h,e,n)),m.push(U(y.x+h,y.y+h,h,e,n))))}return{point:{x:f.x,y:f.y},radius:Math.max(0,f.d)}}function _t(e,t,n){return Math.max(t,Math.min(n,e))}function so(e,t,n){return e<t?t:e>n?n:e}function kt(e){return _t(e,0,1)}function Fe(e){let t=kt(e);return t*t*(3-2*t)}var K=Math.PI*2;function X(e){return Number.isFinite(e.x)&&Number.isFinite(e.y)}function Rt(e,t,n){let i=t-e;if(n){for(;i<0;)i+=K;for(;i>=K;)i-=K}else{for(;i>0;)i-=K;for(;i<=-K;)i+=K}return i}function uo(e){return e.end}function Ve(e){if(e.version!==1||e.closed!==!0||!X(e.start)||!Array.isArray(e.segments)||e.segments.length<2||e.segments.length>512)return!1;let t=e.start;for(let n of e.segments){if(!n||!X(n.end))return!1;if(n.kind==="line"){if(P(t,n.end)<=1e-9)return!1}else if(n.kind==="bezier"){if(!X(n.control1)||!X(n.control2)||P(t,n.end)<=1e-9)return!1}else if(n.kind==="arc"){if(!X(n.center)||!Number.isFinite(n.radius)||n.radius<=1e-6||Math.abs(P(t,n.center)-n.radius)>Math.max(1e-4,n.radius*1e-4)||Math.abs(P(n.end,n.center)-n.radius)>Math.max(1e-4,n.radius*1e-4)||P(t,n.end)<=1e-9)return!1}else return!1;t=n.end}return P(t,e.start)<=1e-4}function Tt(e,t,n){let i=1-n;return{x:i**3*e.x+3*i**2*n*t.control1.x+3*i*n**2*t.control2.x+n**3*t.end.x,y:i**3*e.y+3*i**2*n*t.control1.y+3*i*n**2*t.control2.y+n**3*t.end.y}}function fo(e,t=2){if(!Ve(e))throw new Error("Section outline path is invalid");let n=Math.max(.25,t),i=[{...e.start}],o=e.start;for(let r of e.segments){if(r.kind==="line")i.push({...r.end});else if(r.kind==="arc"){let s=Math.atan2(o.y-r.center.y,o.x-r.center.x),l=Math.atan2(r.end.y-r.center.y,r.end.x-r.center.x),c=Rt(s,l,r.clockwise),u=Math.max(2,Math.ceil(Math.abs(c)*r.radius/n));for(let a=1;a<=u;a+=1){let m=s+c*a/u;i.push({x:r.center.x+Math.cos(m)*r.radius,y:r.center.y+Math.sin(m)*r.radius})}}else{let s=P(o,r.control1)+P(r.control1,r.control2)+P(r.control2,r.end),l=Math.max(2,Math.ceil(s/n));for(let c=1;c<=l;c+=1)i.push(Tt(o,r,c/l))}o=r.end}return P(i[i.length-1],i[0])<=1e-4&&i.pop(),i}function Ue(e,t,n){return Ot(e,o=>({x:o.x+t,y:o.y+n}))}function Ot(e,t,n=1,i=!1){return{...e,start:t(e.start),segments:e.segments.map(o=>o.kind==="line"?{...o,end:t(o.end)}:o.kind==="arc"?{...o,center:t(o.center),radius:o.radius*Math.abs(n),clockwise:i?!o.clockwise:o.clockwise,end:t(o.end)}:{...o,control1:t(o.control1),control2:t(o.control2),end:t(o.end)})}}var At=45,ce=150,jt=60;function Lt(e){let t=At/100;if(e<=t)return ce;let n=Math.min(1,(e-t)/(1-t));return ce-n*(ce-jt)}var De=.5523;function He(e,t){return Math.abs(e.x-t.x)<=1e-6&&Math.abs(e.y-t.y)<=1e-6}function Nt(e){let t=[],n=[];for(e.forEach((i,o)=>{X(i)&&(t.length&&He(t[t.length-1],i)||(t.push({x:i.x,y:i.y}),n.push(o)))});t.length>1&&He(t[0],t[t.length-1]);)t.pop(),n.pop();return{points:t,sourceIndex:n}}function ho(e,t,n){return Vt(e,{cornerSmoothing:t,...n})}var Ft=.5,Dt=4/3;function Ht(e,t,n){let i=t.x-e.x,o=t.y-e.y,r=Math.hypot(i,o);if(r<=1e-9)return{kind:"line",end:{...t}};let s=-o/r,l=i/r,c=n*Dt;return{kind:"bezier",control1:{x:e.x+i/3+s*c,y:e.y+o/3+l*c},control2:{x:e.x+i*2/3+s*c,y:e.y+o*2/3+l*c},end:{...t}}}function Vt(e,t){let{points:n,sourceIndex:i}=Nt(e),o=n.length;if(o<3)return null;let r=Math.min(100,Math.max(0,t.cornerSmoothing??0))/100,s=t.edgeCurvature,l=new Array(o).fill(0);if(s?.length)for(let d=0;d<o;d+=1){let v=s[i[d]];l[d]=Number.isFinite(v)?Math.min(100,Math.max(-100,v))/100:0}let c=l.some(d=>Math.abs(d)>1e-6);if(r<=0&&!c)return null;let u=t.wideAngleThresholdDeg??Lt(r),a=[];for(let d=0;d<o;d+=1)a[d]=P(n[d],n[(d+1)%o]);let m=new Array(o).fill(0);for(let d=0;d<o;d+=1){let v=n[(d-1+o)%o],M=n[d],w=n[(d+1)%o],E={x:v.x-M.x,y:v.y-M.y},C={x:w.x-M.x,y:w.y-M.y},_=Math.hypot(E.x,E.y),k=Math.hypot(C.x,C.y);if(_<=1e-9||k<=1e-9)continue;let H=Math.min(1,Math.max(-1,(E.x*C.x+E.y*C.y)/(_*k))),L=Math.acos(H)*180/Math.PI;if(L<u)continue;let A=Fe((L-u)/(180-u));m[d]=r*A*.5*Math.min(_,k)}for(let d=0;d<o;d+=1){let v=(d+1)%o,M=m[d]+m[v];if(M>a[d]&&M>1e-9){let w=a[d]/M;m[d]*=w,m[v]*=w}}let h=new Array(o),f=new Array(o);for(let d=0;d<o;d+=1){let v=n[(d-1+o)%o],M=n[d],w=n[(d+1)%o];if(m[d]<=1e-6){h[d]={...M},f[d]={...M};continue}let E=P(M,v)||1,C=P(M,w)||1;h[d]={x:M.x+(v.x-M.x)/E*m[d],y:M.y+(v.y-M.y)/E*m[d]},f[d]={x:M.x+(w.x-M.x)/C*m[d],y:M.y+(w.y-M.y)/C*m[d]}}if(m.every(d=>d<=1e-6)&&!c)return null;let b=[],y={...f[0]},p=y,g=(d,v)=>{if(P(p,d)<=1e-9)return;let M=l[v];Math.abs(M)>1e-6?b.push(Ht(p,d,M*Ft*a[v])):b.push({kind:"line",end:{...d}}),p=d};for(let d=1;d<=o;d+=1){let v=d%o,M=n[v];g(h[v],(d-1)%o),m[v]>1e-6&&P(h[v],f[v])>1e-9&&(b.push({kind:"bezier",control1:R(h[v],M,De),control2:R(f[v],M,De),end:{...f[v]}}),p=f[v])}if(!b.length)return null;let S=b[b.length-1];P(S.end,y)>1e-9&&(S.kind==="line"?S.end={...y}:b.push({kind:"line",end:{...y}}));let x={version:1,closed:!0,start:y,segments:b};return Ve(x)?x:null}function mo(e){let t=[],n=e.start;for(let o of e.segments)t.push(n),n=o.end;let i=[];for(let o=e.segments.length-1;o>=0;o-=1){let r=e.segments[o],s=t[o];r.kind==="line"?i.push({kind:"line",end:{...s}}):r.kind==="arc"?i.push({kind:"arc",center:{...r.center},radius:r.radius,clockwise:!r.clockwise,end:{...s}}):i.push({kind:"bezier",control1:{...r.control2},control2:{...r.control1},end:{...s}})}return{version:1,closed:!0,start:{...e.start},segments:i}}function bo(e,t,n){let i=[];for(let o=0;o<e.length-1;o+=1){let r=e[o],s=e[o+1],l=Math.hypot(s.x-r.x,s.y-r.y);if(l<=0)continue;let c=Math.max(1,Math.round(l/n)),u=l/c,a=Math.atan2(s.y-r.y,s.x-r.x),m=o===0,f=(o>0?t[o-1]:void 0)==="break"?2:1,b=m?{...r}:{x:r.x+Math.cos(a)*u*f,y:r.y+Math.sin(a)*u*f},y=m?c+1:Math.max(1,c-(f-1));i.push({origin:b,rotation:a*180/Math.PI,seatCount:y,seatSpacing:u})}return i}function yo(e){let t=e.rotation*Math.PI/180,n={x:Math.cos(t),y:Math.sin(t)};return Array.from({length:e.seatCount},(i,o)=>({x:e.origin.x+n.x*o*e.seatSpacing,y:e.origin.y+n.y*o*e.seatSpacing}))}function go(e){return e.reduce((t,n)=>t+n.seatCount,0)}function Ke(e){let t=new Map,n=new Map;for(let i of e){if(i.type!=="row"||!i.segmentedRow)continue;let o=n.get(i.segmentedRow.groupId)??[];o.push(i),n.set(i.segmentedRow.groupId,o)}for(let[i,o]of n){let r=o.slice().sort((h,f)=>h.segmentedRow.componentIndex-f.segmentedRow.componentIndex),s=r[0]?.segmentedRow?.componentCount??0,l=r[0]?.segmentedRow;if(!l||!(s>=2&&r.length===s&&l?.boundaryBefore==="start"&&r.every((h,f)=>h.segmentedRow?.kind==="segmented-row-v1"&&h.segmentedRow.groupId===i&&h.segmentedRow.componentCount===s&&h.segmentedRow.componentIndex===f&&h.segmentedRow.repeatLabelOnComponents===l.repeatLabelOnComponents&&(f===0?h.segmentedRow.boundaryBefore==="start":h.segmentedRow.boundaryBefore!=="start")&&h.segmentedRow.displayLabel===l.displayLabel)))continue;let u=r.reduce((h,f)=>h+f.seatCount,0),a=0,m=0;for(let h of r)h.segmentedRow.boundaryBefore==="break"&&(a+=1),t.set(h.id,{groupId:i,adjacencyOffset:a,displayOffset:m,displayLabel:l.displayLabel,totalSeats:u,canonical:r[0],viewFromSeatUrl:l.viewFromSeatUrl,viewFromSeatMeta:l.viewFromSeatMeta,confidenceEvidence:l.confidenceEvidence}),a+=h.seatCount,m+=h.seatCount}return t}var G=.02291666666666667,So=1/G,Ut=58,Kt=Ut*G,Xe=0,Be=3,Ge=0,le=120,Xt=0,Gt=45,Bt=7,B=1.2;function ue(e,t,n,i){return Number.isFinite(e)?Math.max(t,Math.min(n,e)):i}function Mo(e){return Number.isFinite(e)?Math.max(Xe,Math.min(Be,Math.round(e))):Xe}function zt(e){return!Number.isFinite(e)||!Number.isInteger(e)||e<0?0:e<=Bt?e:Be}function ze(e,t={}){let n=ue(t.floorBaseHeightM,Ge,le,0),i=Math.min(le,n+zt(e.elevation)*Kt),o=e.height===void 0?i:ue(e.height,Ge,le,i),r=ue(e.rake,Xt,Gt,0);return{height:o,rake:r}}function Ye(e){let t=e.length;return t<=3?[...e]:[e[Math.floor(t*.25)],e[Math.floor(t*.5)],e[Math.floor(t*.75)]]}function We(e,t,n){if(!e.length)return 1/0;if(e.length===1)return Math.hypot(t-e[0].x,n-e[0].y);let i=1/0;for(let o=0;o+1<e.length;o++){let r=e[o],s=e[o+1],l=s.x-r.x,c=s.y-r.y,u=l*l+c*c,a=u>1e-12?((t-r.x)*l+(n-r.y)*c)/u:0;a<0?a=0:a>1&&(a=1);let m=Math.hypot(t-(r.x+a*l),n-(r.y+a*c));m<i&&(i=m)}return i}function Yt(e){let t=0,n=0;for(let r of e)t+=r.x,n+=r.y;let i=e.length||1;t/=i,n/=i;let o=0;for(let r of e){let s=Math.hypot(r.x-t,r.y-n);s>o&&(o=s)}return{cx:t,cy:n,r:o}}function $e(e,t){return Math.hypot(e.cx-t.cx,e.cy-t.cy)-e.r-t.r}function de(e,t){let n=1/0;for(let i of Ye(e)){let o=We(t,i.x,i.y);o<n&&(n=o)}for(let i of Ye(t)){let o=We(e,i.x,i.y);o<n&&(n=o)}return n}function Wt(e,t){if(e.length<3)return{pts:e,seatIndices:t};let n=0,i=0;for(let a of e)n+=a.x,i+=a.y;n/=e.length,i/=e.length;let o=-1,r=e[0];for(let a of e){let m=Math.hypot(a.x-n,a.y-i);m>o&&(o=m,r=a)}let s=r.x-n,l=r.y-i,c=Math.hypot(s,l);c>1e-9?(s/=c,l/=c):(s=1,l=0);let u=e.map((a,m)=>({p:a,i:m,t:(a.x-n)*s+(a.y-i)*l})).sort((a,m)=>a.t-m.t);return{pts:u.map(a=>a.p),seatIndices:u.map(a=>t[a.i])}}function $t(e){let t=e.length;if(t<3)return null;let n=0,i=0;for(let S of e)n+=S.x,i+=S.y;n/=t,i/=t;let o=0,r=0,s=0,l=0,c=0,u=0,a=0;for(let S of e){let x=S.x-n,d=S.y-i;o+=x*x,s+=d*d,r+=x*d,l+=x*x*x,c+=d*d*d,u+=x*d*d,a+=d*x*x}let m=o*s-r*r;if(Math.abs(m)<1e-9)return null;let h=(l+u)/2,f=(c+a)/2,b=(h*s-f*r)/m,y=(f*o-h*r)/m,p=b+n,g=y+i;return!Number.isFinite(p)||!Number.isFinite(g)?null:{cx:p,cy:g}}var qt=.15;function Jt(e){if(e.length<2)return null;let t=e.map(S=>{let x=0,d=0;for(let v of S.pts)x+=v.x,d+=v.y;return{x:x/S.pts.length,y:d/S.pts.length}}),n=0,i=0;for(let S of t)n+=S.x,i+=S.y;n/=t.length,i/=t.length;let o=0,r=0,s=0;for(let S of t){let x=S.x-n,d=S.y-i;o+=x*x,r+=x*d,s+=d*d}let l=o+s,c=o*s-r*r,u=l/2+Math.sqrt(Math.max(0,l*l/4-c)),a,m;Math.abs(r)>1e-12?(a=u-s,m=r):o>=s?(a=1,m=0):(a=0,m=1);let h=Math.hypot(a,m);if(!(h>1e-12))return null;a/=h,m/=h;let f=1/0,b=-1/0,y=[];for(let S of e){let x=1/0,d=-1/0;for(let v of S.pts){let M=v.x*a+v.y*m;M<x&&(x=M),M>d&&(d=M),M<f&&(f=M),M>b&&(b=M)}y.push(d-x)}let p=b-f;return p>1e-9?(y.sort((S,x)=>S-x),y[Math.min(y.length-1,Math.floor(y.length*.9))]/p<=Zt?{x:a,y:m}:null):null}var Zt=.35;function qe(e,t,n,i){let o=new Map;for(let p of n){let g=t[p],S=g.rowId||`__seat-${p}`,x=o.get(S);x||(x={pts:[],idx:[]},o.set(S,x)),x.pts.push({x:g.x,y:g.y}),x.idx.push(p)}if(!o.size)return{sectionId:e,rows:[],blockCount:0};let r=[];for(let[p,g]of o){let S=Wt(g.pts,g.idx),x=0;for(let d of S.pts)x+=Math.hypot(d.x-i.x,d.y-i.y);r.push({id:p,pts:S.pts,seatIndices:S.seatIndices,blockId:-1,ordinal:0,blockDepth:0,focalDistance:x/S.pts.length})}let s=r.map(p=>Yt(p.pts)),l=[];for(let p=0;p<r.length;p++){let g=1/0;for(let S=0;S<r.length;S++){if(p===S||$e(s[p],s[S])>=g)continue;let x=de(r[p].pts,r[S].pts);x<g&&(g=x)}Number.isFinite(g)&&l.push(g)}l.sort((p,g)=>p-g);let c=l.length?l[Math.floor(l.length/2)]:1,u=Math.max(c*1.8,1e-6),a=r.map(()=>[]);for(let p=0;p<r.length;p++)for(let g=p+1;g<r.length;g++)$e(s[p],s[g])>u||de(r[p].pts,r[g].pts)<=u&&(a[p].push(g),a[g].push(p));let m=0;for(let p=0;p<r.length;p++){if(r[p].blockId!==-1)continue;let g=m++,S=[p];for(r[p].blockId=g;S.length;){let x=S.pop();for(let d of a[x])r[d].blockId===-1&&(r[d].blockId=g,S.push(d))}}let h=new Map;for(let p of r){let g=h.get(p.blockId)??[];g.push(p),h.set(p.blockId,g)}let f=[];for(let p of r){if(p.pts.length<4)continue;let g=$t(p.pts);g&&(!Number.isFinite(g.cx)||!Number.isFinite(g.cy)||f.push({x:g.cx,y:g.cy}))}let b=f.length>=2?(()=>{let p=f.map(x=>x.x).sort((x,d)=>x-d),g=f.map(x=>x.y).sort((x,d)=>x-d),S=Math.floor(f.length/2);return{cx:p[S],cy:g[S]}})():null;if(b){let p=M=>Math.hypot(M.x-b.cx,M.y-b.cy),g=1/0,S=-1/0,x=[];for(let M of r){let w=1/0,E=-1/0;for(let C of M.pts){let _=p(C);_<w&&(w=_),_>E&&(E=_)}x.push(E-w),w<g&&(g=w),E>S&&(S=E)}let d=S-g;x.sort((M,w)=>M-w);let v=x[Math.min(x.length-1,Math.floor(x.length*.9))];if(d>1e-9&&v/d<=qt){let M=r.map(I=>{let N=0;for(let F of I.pts)N+=p(F);return{row:I,radius:N/I.pts.length}}),w=0,E=0;for(let I of M)w+=I.radius,E+=I.row.focalDistance;w/=M.length,E/=M.length;let C=0;for(let I of M)C+=(I.radius-w)*(I.row.focalDistance-E);if(C<0)for(let I of M)I.radius=-I.radius;let k=1/0;for(let I of M)I.radius<k&&(k=I.radius);M.sort((I,N)=>I.radius-N.radius);let H=-1,L=-1/0,A=d/Math.max(1,M.length)*.5,$=[];for(let I of M)I.radius-L>A&&(H++,L=I.radius),I.row.ordinal=H,I.row.blockDepth=I.radius-k,$.push(I.row);return{sectionId:e,rows:$,blockCount:m}}}let y=[];for(let[,p]of h){let g=Jt(p);if(g){let S=d=>{let v=0;for(let M of d.pts)v+=M.x*g.x+M.y*g.y;return v/d.pts.length};p.sort((d,v)=>S(d)-S(v)),p.length>=2&&p[0].focalDistance>p[p.length-1].focalDistance&&p.reverse();let x=0;for(let d=0;d<p.length;d++)d>0&&(x+=de(p[d-1].pts,p[d].pts)),p[d].ordinal=d,p[d].blockDepth=x,y.push(p[d])}else{let S=1/0;for(let x of p)x.focalDistance<S&&(S=x.focalDistance);p.sort((x,d)=>x.focalDistance-d.focalDistance);for(let x=0;x<p.length;x++)p[x].ordinal=x,p[x].blockDepth=Math.max(0,p[x].focalDistance-S),y.push(p[x])}}return{sectionId:e,rows:y,blockCount:m}}var Eo=[{key:"rect",label:"Flat stage",blurb:"Classic proscenium box."},{key:"rounded",label:"Rounded",blurb:"Softened corners."},{key:"arc",label:"Curved front",blurb:"Front edge bows toward the audience."},{key:"thrust",label:"Thrust (T)",blurb:"Central tongue projects into the crowd."},{key:"runway",label:"Runway",blurb:"Long catwalk into the audience."},{key:"round",label:"In the round",blurb:"Central platform, audience all around."},{key:"pitch-football",label:"Football pitch",blurb:"105 \xD7 68 m pitch with centre circle and penalty boxes."},{key:"rink-hockey",label:"Hockey rink",blurb:"60 \xD7 30 m ice rink with blue lines and faceoff circles."},{key:"track-athletics",label:"Athletics track",blurb:"400 m track: two straights, two semicircles, eight lanes."},{key:"oval-cricket",label:"Cricket oval",blurb:"~150 \xD7 140 m oval with boundary rope and pitch strip."}],Qt={"pitch-football":{width:105,height:68},"rink-hockey":{width:60,height:30},"track-athletics":{width:176.9,height:92.5},"oval-cricket":{width:150,height:140}};var Je=Math.PI*2;function Ze(e,t,n,i,o,r){return{x:o+e*n-t*i,y:r+e*i+t*n}}function Io(e){let{kind:t,cx:n,cy:i,width:o,height:r}=e,s=(e.rotation??0)*Math.PI/180,l=Math.cos(s),c=Math.sin(s),u=o/2,a=r/2,m=[],h=(f,b)=>{m.push({x:f,y:b})};switch(t){case"rect":{h(-u,-a),h(u,-a),h(u,a),h(-u,a);break}case"rounded":{let f=Math.min(o,r)*.18,b=5,y=(p,g,S)=>{for(let x=0;x<=b;x++){let d=S+x/b*(Math.PI/2);h(p+f*Math.cos(d),g+f*Math.sin(d))}};y(u-f,-a+f,-Math.PI/2),y(u-f,a-f,0),y(-u+f,a-f,Math.PI/2),y(-u+f,-a+f,Math.PI);break}case"arc":{let f=r*.45;h(-u,-a),h(u,-a);let b=24;for(let y=0;y<=b;y++){let p=y/b,g=u-p*o,S=a+f*(1-Math.pow(2*g/o,2));h(g,S)}break}case"thrust":{let f=o*.18,b=r*1.1;h(-u,-a),h(u,-a),h(u,a),h(f,a),h(f,a+b),h(-f,a+b),h(-f,a),h(-u,a);break}case"runway":{let f=o*.1,b=r*3;h(-u,-a),h(u,-a),h(u,a),h(f,a),h(f,a+b),h(-f,a+b),h(-f,a),h(-u,a);break}case"round":case"oval-cricket":{for(let b=0;b<40;b++){let y=b/40*Je;h(u*Math.cos(y),a*Math.sin(y))}break}case"pitch-football":{h(-u,-a),h(u,-a),h(u,a),h(-u,a);break}case"rink-hockey":{for(let f of en(u,a,u*(8.5/60),a*(8.5/30)))h(f.x,f.y);break}case"track-athletics":{for(let f of he(u,a))h(f.x,f.y);break}}return m.map(f=>Ze(f.x,f.y,l,c,n,i))}function en(e,t,n,i){let o=[],s=(l,c,u)=>{for(let a=0;a<=8;a++){let m=u+a/8*(Math.PI/2);o.push({x:l+n*Math.cos(m),y:c+i*Math.sin(m)})}};return s(e-n,-t+i,-Math.PI/2),s(e-n,t-i,0),s(-e+n,t-i,Math.PI/2),s(-e+n,-t+i,Math.PI),o}function he(e,t){let n=Math.max(0,e-t),i=[],o=20;for(let r=0;r<=o;r++){let s=-Math.PI/2+r/o*Math.PI;i.push({x:n+t*Math.cos(s),y:t*Math.sin(s)})}for(let r=0;r<=o;r++){let s=Math.PI/2+r/o*Math.PI;i.push({x:-n+t*Math.cos(s),y:t*Math.sin(s)})}return i}var Po="#f1f5f9";function me(e){return e==="pitch-football"||e==="rink-hockey"||e==="track-athletics"||e==="oval-cricket"}function J(e,t,n,i,o=32){let r=[];for(let s=0;s<o;s++){let l=s/o*Je;r.push({x:e+n*Math.cos(l),y:t+i*Math.sin(l)})}return r}function fe(e,t,n,i){return[{x:e-n,y:t-i},{x:e+n,y:t-i},{x:e+n,y:t+i},{x:e-n,y:t+i}]}function tn(e){let{kind:t,cx:n,cy:i,width:o,height:r}=e,s=(e.rotation??0)*Math.PI/180,l=Math.cos(s),c=Math.sin(s),u=o/2,a=r/2,m=[],h=Qt[t],f=y=>h?y/h.width*o:0,b=y=>h?y/h.height*r:0;switch(t){case"pitch-football":{m.push({points:[{x:0,y:-a},{x:0,y:a}],closed:!1}),m.push({points:J(0,0,f(9.15),b(9.15)),closed:!0});for(let y of[-1,1])m.push({points:fe(y*(u-f(16.5)/2),0,f(16.5)/2,b(40.32)/2),closed:!0}),m.push({points:fe(y*(u-f(5.5)/2),0,f(5.5)/2,b(18.32)/2),closed:!0});break}case"rink-hockey":{m.push({points:[{x:0,y:-a},{x:0,y:a}],closed:!1,ink:"#d63b3b"});for(let y of[-1,1]){m.push({points:[{x:y*f(7.5),y:-a},{x:y*f(7.5),y:a}],closed:!1,ink:"#2f6ecb"}),m.push({points:[{x:y*(u-f(4)),y:-b(11)},{x:y*(u-f(4)),y:b(11)}],closed:!1,ink:"#d63b3b"});for(let p of[-1,1])m.push({points:J(y*f(20.5),p*b(7),f(4.5),b(4.5)),closed:!0,ink:"#2f6ecb"})}m.push({points:J(0,0,f(4.5),b(4.5)),closed:!0,ink:"#2f6ecb"});break}case"track-athletics":{let p=a-b(1.22)*8;p>0&&m.push({points:he(u-f(1.22)*8,p),closed:!0,fill:"#2f7d4f"});for(let g=1;g<8;g++){let S=b(1.22)*g,x=a-S;if(x<=0)break;m.push({points:he(u-f(1.22)*g,x),closed:!0})}break}case"oval-cricket":{m.push({points:J(0,0,f(27.4),b(27.4+20.12/2),40),closed:!0}),m.push({points:fe(0,0,f(3.05)/2,b(20.12)/2),closed:!0,ink:"#d8cfae"});break}default:return[]}return m.map(y=>({...y,points:y.points.map(p=>Ze(p.x,p.y,l,c,n,i))}))}function Co(e){if(e.role!=="stage"||!me(e.stageKind))return[];let t=null;if(e.x!=null&&e.y!=null&&e.width!=null&&e.height!=null&&e.width>0&&e.height>0&&[e.x,e.y,e.width,e.height].every(Number.isFinite))t={cx:e.x+e.width/2,cy:e.y+e.height/2,width:e.width,height:e.height};else if(e.points&&e.points.length>=3&&e.points.every(n=>Number.isFinite(n.x)&&Number.isFinite(n.y))){let n=e.points.map(a=>a.x),i=e.points.map(a=>a.y),o=Math.min(...n),r=Math.max(...n),s=Math.min(...i),l=Math.max(...i),c=Math.max(1,r-o),u=Math.max(1,l-s);t={cx:o+c/2,cy:s+u/2,width:c,height:u}}return t?tn({kind:e.stageKind,...t}):[]}function nn(e){if((e.kind==="polygon"||e.kind==="polyline"||e.kind==="line")&&e.points&&e.points.length>=2)return e.points;if(e.x==null||e.y==null||e.width==null||e.height==null)return null;let t=e.x,n=e.y,i=e.width,o=e.height;return[{x:t,y:n},{x:t+i,y:n},{x:t+i,y:n+o},{x:t,y:n+o}]}function on(e,t,n){let i=n*Math.PI/180,o=Math.cos(i),r=Math.sin(i),s=e.x-t.x,l=e.y-t.y;return{x:t.x+s*o-l*r,y:t.y+s*r+l*o}}function Qe(e){let t=nn(e);if(!t||t.length<2)return null;let n=e.rotation??0,i=Math.abs(n)<1e-6?t:t.map(c=>on(c,{x:t.reduce((u,a)=>u+a.x,0)/t.length,y:t.reduce((u,a)=>u+a.y,0)/t.length},n)),o=1/0,r=1/0,s=-1/0,l=-1/0;for(let c of i)o=Math.min(o,c.x),r=Math.min(r,c.y),s=Math.max(s,c.x),l=Math.max(l,c.y);return!Number.isFinite(o)||s-o<1e-6||l-r<1e-6?null:{minX:o,minY:r,maxX:s,maxY:l}}var rn=5,sn=3,an=.92,cn=1.9,ln=2,un=.6,dn=1,fn=.06;function hn(e){return e.heightM!==void 0?e.heightM:me(e.stageKind)?fn:dn}function et(e){let t=1/0,n=1/0,i=-1/0,o=-1/0,r=-1/0;for(let s of pe(e)){let l=s.baseHeightM??0;for(let c of s.objects){if(c.type!=="shape"||c.role!=="stage")continue;let u=Qe(c);u&&(t=Math.min(t,u.minX),n=Math.min(n,u.minY),i=Math.max(i,u.maxX),o=Math.max(o,u.maxY),r=Math.max(r,l+hn(c)))}}return!Number.isFinite(t)||!Number.isFinite(r)?null:{minX:t,minY:n,maxX:i,maxY:o,deckTopM:r}}function mn(e,t,n,i){let o=1/0,r=1/0,s=-1/0,l=-1/0;for(let f of e)Number.isFinite(f.eyeHeightM)&&(o=Math.min(o,f.x),s=Math.max(s,f.x),r=Math.min(r,f.y),l=Math.max(l,f.y));if(!Number.isFinite(o))return null;let c=o*t,u=r*t,a=Math.max(1,Math.ceil((s-o)*t/n)+1),m=Math.max(1,Math.ceil((l-r)*t/n)+1),h=new Float64Array(a*m).fill(-1/0);for(let f of e){if(!Number.isFinite(f.eyeHeightM))continue;let b=f.eyeHeightM-B,y=Math.min(a-1,Math.max(0,Math.floor((f.x*t-c)/n))),g=Math.min(m-1,Math.max(0,Math.floor((f.y*t-u)/n)))*a+y,S=b+i;S>h[g]&&(h[g]=S)}return{cellM:n,minX:c,minY:u,cols:a,rows:m,top:h}}function pn(e,t,n){let i=Math.floor((t-e.minX)/e.cellM),o=Math.floor((n-e.minY)/e.cellM);return i<0||o<0||i>=e.cols||o>=e.rows?-1/0:e.top[o*e.cols+i]}function tt(e,t,n={}){let i=new Map;if(!t||!e.length)return i;let o=n.metresPerChartUnit??G,r=n.cellM??un,s=n.chairBackM??an,l=n.selfRowSkipM??ln,c=n.clearThreshold??.9,u=n.partialThreshold??.25,a=Math.max(1,n.columns??rn),m=Math.max(1,n.rows??sn),h=mn(e,o,r,s);if(!h)return i;let f=(t.maxX-t.minX)*o,b=(t.maxY-t.minY)*o,y=f>=b,p=(t.minX+t.maxX)/2*o,g=(t.minY+t.maxY)/2*o,S=[];for(let d=0;d<a;d++){let v=(d+.5)/a-.5,M=y?p+v*f:p,w=y?g:g+v*b;for(let E=0;E<m;E++){let C=t.deckTopM+(m===1?0:E/(m-1)*cn);S.push({x:M,y:w,z:C})}}let x=r/2;for(let d of e){if(!Number.isFinite(d.eyeHeightM))continue;let v=d.x*o,M=d.y*o,w=d.eyeHeightM,E=0,C=1/0;for(let k of S){let H=k.x-v,L=k.y-M,A=Math.hypot(H,L);if(!(A>l)){E++;continue}let $=H/A,I=L/A,N=0;for(let F=l;F<A;F+=x){let te=pn(h,v+$*F,M+I*F);if(!(!Number.isFinite(te)||te>=w)&&te>w+(k.z-w)*F/A){N=F;break}}N?C=Math.min(C,N):E++}let _=E/S.length;_>=c||i.set(d.id,{seatId:d.id,mark:_<u?"obstructedView":"restrictedView",visibleFraction:_,totalRays:S.length,atDistanceM:Number.isFinite(C)?C:0})}return i}function nt(e,t){if(!t.size)return 0;let n=0;for(let i of e){let o=t.get(i.id);if(!o)continue;let r=i.commercial;r?.restrictedView!==void 0||r?.obstructedView!==void 0||(i.commercial={...r,[o.mark]:!0},n++)}return n}function be(e){return e?e.accessibility?.length?e.wheelchairSpaceType&&!e.accessibility.includes("wheelchair")?["wheelchair",...e.accessibility]:e.accessibility:e.wheelchairSpaceType?["wheelchair"]:e.accessible?["wheelchair"]:[]:[]}var Q=Math.PI/180,bn=9,z=16;function ge(e,t,n,i){let o=n*Q,r=Math.cos(o),s=Math.sin(o);return{x:i.x+e*r-t*s,y:i.y+e*s+t*r}}function at(e){let{seatCount:t,seatSpacing:n,curve:i,rotation:o,origin:r}=e,s=[];if(e.path)return Te(e.path,t);if(t<=1)return t===1&&s.push({x:r.x,y:r.y}),s;if(i===0){for(let u=0;u<t;u++)s.push(ge(u*n,0,o,r));return s}let l=i/(t-1)*Q,c=n/(2*Math.sin(Math.abs(l)/2));for(let u=0;u<t;u++){let a=u*l,m=c*Math.sin(a),h=-c+c*Math.cos(a);s.push(ge(m,h,o,r))}return s}function yn(e){let t=new Map;if(e.overrides)for(let n of e.overrides)t.set(n.index,n);return t}function $o(e){let t=new Set((e.overrides??[]).filter(n=>n.skip&&Number.isInteger(n.index)&&n.index>=0&&n.index<e.seatCount).map(n=>n.index));return Math.max(0,e.seatCount-t.size)}function gn(e,t){let n=yn(e);return at(e).map((i,o)=>{let r=n.get(o),s=be(r),l=xe(e,o,r),c={...e.commercial,...r?.commercial};return{index:o,x:i.x+(r?.dx??0),y:i.y+(r?.dy??0),label:l,displayLabel:ne(e,o,t,r),categoryKey:r?.categoryKey??e.categoryKey,skipped:!!r?.skip,accessible:s.length>0,accessibility:s,wheelchairSpaceType:r?.wheelchairSpaceType,commercial:Object.values(c).some(u=>u!==void 0&&u!==!1&&u!=="")?c:void 0,glyph:r?.glyph,viewUrl:r?.viewFromSeatUrl??e.viewFromSeatUrl,viewMeta:r?.viewFromSeatUrl?r.viewFromSeatMeta:e.viewFromSeatMeta,labelStyle:r?.labelStyle??e.seatLabelStyle}})}function ct(e){let t=[];for(let n of gn(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 xn(e){if(e.seatCountsBySide)return{...e.seatCountsBySide};let t=e.sides&&e.sides.length?e.sides:["top","bottom"],n=["top","bottom","left","right"].filter(r=>t.includes(r)),i={top:0,bottom:0,left:0,right:0};if(!n.length)return i;let o=Math.max(0,Math.round(e.seatCount));for(let r=0;r<o;r++)i[n[r%n.length]]+=1;return i}function lt(e){let t=[],n=Math.max(0,Math.round(e.seatCount));if(n===0)return t;let i=new Map((e.overrides??[]).map(a=>[a.index,a])),o=(a,m,h,f)=>{let b=i.get(a),y=be(b),p=b?.label??`${e.label}-${a+1}`,g=e.displayLabel??e.label;return{index:a,label:p,displayLabel:b?.displayLabel??`${g}-${a+1}`,x:m+(b?.dx??0),y:h+(b?.dy??0),categoryKey:b?.categoryKey??e.categoryKey,skipped:!!b?.skip,accessible:y.length>0,accessibility:y,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 a=(e.radius??40)+z,m=e.rotation*Q,h=Math.max(0,Math.min(360,e.seatArc??360));if(h>=360||n===1){for(let p=0;p<n;p++){let g=m+p/n*2*Math.PI;t.push(o(p,e.center.x+a*Math.cos(g),e.center.y+a*Math.sin(g)))}return t}let f=h*Q,b=(2*Math.PI-f)/2,y=m+b;for(let p=0;p<n;p++){let g=y+p/(n-1)*f;t.push(o(p,e.center.x+a*Math.cos(g),e.center.y+a*Math.sin(g)))}return t}let r=e.width??80,s=e.height??50,l=xn(e),c=["top","bottom","left","right"],u=0;for(let a of c){let m=l[a];for(let h=0;h<m;h++){let f,b;a==="top"?(f=-r/2+(h+.5)*r/m,b=-s/2-z):a==="bottom"?(f=-r/2+(h+.5)*r/m,b=s/2+z):a==="left"?(f=-r/2-z,b=-s/2+(h+.5)*s/m):(f=r/2+z,b=-s/2+(h+.5)*s/m);let y=ge(f,b,e.rotation,e.center);t.push(o(u++,y.x,y.y,a))}}return t}function qo(e){return e.bookAsWhole||e.variableOccupancy?Math.max(0,Math.round(e.seatCount)):lt(e).filter(t=>!t.skipped).length}function Sn(e){return lt(e).filter(t=>!t.skipped).map(t=>({id:`${e.id}:${t.index}`,label:t.label,...t.displayLabel!==t.label?{displayLabel:t.displayLabel}:{},x:t.x,y:t.y,rowId:e.id,categoryKey:t.categoryKey,...t.accessible?{accessible:!0}:{},...t.accessibility.length?{accessibility:t.accessibility}:{},...t.wheelchairSpaceType?{wheelchairSpaceType:t.wheelchairSpaceType}:{},...t.commercial?{commercial:t.commercial}:{},...t.glyph?{glyph:t.glyph}:{},...t.viewUrl?{viewUrl:t.viewUrl}:{},...t.viewUrl&&t.viewMeta?{viewMeta:t.viewMeta}:{},...t.labelStyle?{labelStyle:t.labelStyle}:{}}))}function Mn(e){return[{id:`${e.id}:0`,label:e.label,...e.displayLabel&&e.displayLabel!==e.label?{displayLabel:e.displayLabel}:{},x:e.center.x,y:e.center.y,rowId:e.id,categoryKey:e.categoryKey,kind:"booth"}]}function ot(e,t){let n=!1;for(let i=0,o=t.length-1;i<t.length;o=i++){let r=t[i].x,s=t[i].y,l=t[o].x,c=t[o].y;s>e.y!=c>e.y&&e.x<(l-r)*(e.y-s)/(c-s)+r&&(n=!n)}return n}function vn(e,t){return t.some((n,i)=>{let o=t[(i+1)%t.length],r=(e.y-n.y)*(o.x-n.x)-(e.x-n.x)*(o.y-n.y);if(Math.abs(r)>1e-7)return!1;let s=(e.x-n.x)*(o.x-n.x)+(e.y-n.y)*(o.y-n.y),l=(o.x-n.x)**2+(o.y-n.y)**2;return s>=-1e-7&&s<=l+1e-7})}function ee(e,t,n){return ot(e,t)&&!(n??[]).some(i=>ot(e,i)||vn(e,i))}function Jo(e,t){return Ne(e,t).point}function ye(e){if(!e.length)return{x:0,y:0};let t=0,n=0;for(let i of e)t+=i.x,n+=i.y;return{x:t/e.length,y:n/e.length}}function wn(e){switch(e.type){case"row":{let t=ct(e);if(!t.length)return{x:e.origin.x,y:e.origin.y};let n=0,i=0;for(let o of t)n+=o.x,i+=o.y;return{x:n/t.length,y:i/t.length}}case"table":case"booth":return{x:e.center.x,y:e.center.y};case"gaArea":return ye(e.points);case"section":return ye(e.outline);case"text":return{x:e.position.x,y:e.position.y};case"shape":return e.points&&e.points.length?ye(e.points):e.x!=null&&e.y!=null&&e.width!=null&&e.height!=null?{x:e.x+e.width/2,y:e.y+e.height/2}:{x:e.x??0,y:e.y??0};case"decorImage":return{x:e.x+e.width/2,y:e.y+e.height/2}}}function it(e,t){return e.length===t.length&&e.every((n,i)=>n.x===t[i].x&&n.y===t[i].y)}function En(e,t){if(e.type!=="gaArea"||!it(e.points,t.outline))return!1;let n=e.holes??[],i=t.holes??[];return n.length===i.length&&n.every((o,r)=>it(o,i[r]))}function In(e,t){let n=e.filter(s=>s.type==="section"),i="referenceInventorySource"in t?t.referenceInventorySource?.logicalSectionId:void 0,o=wn(t);return(i?n.find(s=>(s.logicalSectionId??s.id)===i&&(En(t,s)||ee(o,s.outline,s.holes))):void 0)??n.find(s=>ee(o,s.outline,s.holes))}function pe(e){return e.floors&&e.floors.length?e.floors:[{id:"floor-0",name:"Main",objects:e.objects,focalPoint:e.focalPoint,referenceImage:e.referenceImage,backgroundImage:e.backgroundImage}]}function Zo(e,t){let n=pe(e);return(t?n.find(i=>i.id===t):n[0])?.objects??[]}function Pn(e){return e.floors&&e.floors.length?e.floors.flatMap(t=>t.objects):e.objects}function Cn(e,t,n){let i=r=>({x:r.x+t,y:r.y+n}),o=r=>r.map(i);switch(e.type){case"row":return{...e,origin:i(e.origin)};case"table":case"booth":return{...e,center:i(e.center)};case"gaArea":return{...e,points:o(e.points),...e.holes?{holes:e.holes.map(o)}:{}};case"section":return{...e,outline:o(e.outline),...e.outlinePath?{outlinePath:Ue(e.outlinePath,t,n)}:{},...e.holes?{holes:e.holes.map(o)}:{}};case"text":return{...e,position:i(e.position)};case"shape":return{...e,...e.points?{points:o(e.points)}:{},...e.x!=null?{x:e.x+t}:{},...e.y!=null?{y:e.y+n}:{}};case"decorImage":return{...e,x:e.x+t,y:e.y+n}}}function Qo(e,t=900){if(!e.floors||e.floors.length<2)return e;let n=[];return e.floors.forEach((i,o)=>{let r=-o*t;for(let s of i.objects)n.push(r===0?s:Cn(s,0,r))}),{...e,objects:n,floors:void 0}}function rt(e,t,n,i,o,r,s,l,c){let u=[],a=Ke(e),m=b=>!b?.eventConfigurationId||b.eventConfigurationId===i&&(b.eventConfigurationVersion===void 0||b.eventConfigurationVersion===c),h=b=>Se(b,{activeConfigurationId:i,activeConfigurationVersion:c,activeBasisSha256:o,now:l}),f=(b,y)=>h(b)?{...b,coverage:y}:void 0;for(let b of e){let y=[];if(b.type==="row"?y=ct(b):b.type==="table"?y=Sn(b):b.type==="booth"&&(y=Mn(b)),!y.length)continue;for(let d of y)d.viewUrl&&!m(d.viewMeta)&&(d.viewUrl=void 0,d.viewMeta=void 0);if(b.type==="row"){let d=a.get(b.id);if(d){let v=new Map((b.overrides??[]).map(M=>[M.index,M]));for(let M of y){let w=Number(M.id.slice(M.id.lastIndexOf(":")+1));if(!Number.isInteger(w))continue;M.logicalRowId=d.groupId,M.logicalSeatIndex=d.adjacencyOffset+w,v.get(w)?.displayLabel||(M.displayLabel=ne(b,w,d)),!M.viewUrl&&d.viewFromSeatUrl&&m(d.viewFromSeatMeta)&&(M.viewUrl=d.viewFromSeatUrl,M.viewMeta=d.viewFromSeatMeta);let E=v.get(w)?.confidenceEvidence;M.confidenceEvidence=f(E,"exact-seat")??f(b.confidenceEvidence,"row-representative")??f(d.confidenceEvidence,"row-representative")}}}let p=In(e,b),g=p?.viewFromSeatUrl,x=(p?.zone?t?.find(d=>d.id===p.zone):void 0)?.focalPoint??n;for(let d of y){if(!d.confidenceEvidence){let v=Number(d.id.slice(d.id.lastIndexOf(":")+1)),M=(b.type==="row"||b.type==="table")&&Number.isInteger(v)?b.overrides?.find(w=>w.index===v)?.confidenceEvidence:void 0;d.confidenceEvidence=f(M,"exact-seat")??(b.type==="row"?f(b.confidenceEvidence,"row-representative"):void 0)}d.confidenceEvidence??=f(p?.confidenceEvidence,"section-representative")??(s?f(s.evidence,s.coverage):void 0),!d.viewUrl&&g&&m(p?.viewFromSeatMeta)&&(d.viewUrl=g,d.viewMeta=p?.viewFromSeatMeta),!d.viewUrl&&r&&m(r.meta)&&(d.viewUrl=r.url,d.viewMeta=r.meta),p&&(d.sectionId=p.logicalSectionId??p.id),p?.zone&&(d.zoneId=p.zone),x&&(d.focalPoint={...x})}u.push(...y)}return u}function ei(e,t={}){if(e.floors?.length){let i=[];for(let o of e.floors){let r=o.focalPoint??e.focalPoint,s=o.viewFromSeatUrl?{url:o.viewFromSeatUrl,meta:o.viewFromSeatMeta}:e.viewFromSeatUrl?{url:e.viewFromSeatUrl,meta:e.viewFromSeatMeta}:void 0,l=o.confidenceEvidence?{evidence:o.confidenceEvidence,coverage:"floor-representative"}:e.confidenceEvidence?{evidence:e.confidenceEvidence,coverage:"venue-representative"}:void 0,c=rt(o.objects,e.zones,r,e.eventConfigurationId,e.confidenceBasisSha256,s,l,t.now,t.eventConfigurationVersion??e.eventConfigurationVersion);t.resolveEyeHeights!==!1&&st(o.objects,o.focalPoint??e.focalPoint,o.baseHeightM??0,c);for(let u of c)u.floorId=o.id;i.push(...c)}return i}let n=rt(e.objects,e.zones,e.focalPoint,e.eventConfigurationId,e.confidenceBasisSha256,e.viewFromSeatUrl?{url:e.viewFromSeatUrl,meta:e.viewFromSeatMeta}:void 0,e.confidenceEvidence?{evidence:e.confidenceEvidence,coverage:"venue-representative"}:void 0,t.now,t.eventConfigurationVersion??e.eventConfigurationVersion);return t.resolveEyeHeights!==!1&&st(e.objects,e.focalPoint,t.floorBaseHeightM??0,n),_n(e,n,t)}function _n(e,t,n){return!n.deriveRestrictedView||e.derivedRestrictedView===!1||n.resolveEyeHeights===!1||nt(t,tt(t,et(e))),t}function st(e,t,n,i){let o=e.filter(a=>a.type==="section"),r=n>0||o.some(a=>a.height!==void 0||a.rake!==void 0||(a.elevation??0)>0);if(!o.length||!r||!t){for(let a of i)a.eyeHeightM=n+B;return}let s=new Array(i.length),l=new Map,c=new Map;for(let a=0;a<i.length;a++){let m=i[a],f=(m.sectionId?o.find(y=>y.id===m.sectionId)??o.find(y=>y.logicalSectionId===m.sectionId&&ee({x:m.x,y:m.y},y.outline,y.holes)):void 0)??o.find(y=>ee({x:m.x,y:m.y},y.outline,y.holes))??null;if(s[a]=f,!f)continue;l.has(f.id)||l.set(f.id,ze(f,{floorBaseHeightM:n}));let b=c.get(f.id);b?b.push(a):c.set(f.id,[a])}let u=new Array(i.length).fill(void 0);for(let[a,m]of c){let h=l.get(a);if(!h)continue;let f=h.rake>0?Math.tan(h.rake*Math.PI/180):0,b=qe(a,i,m,t);for(let y of b.rows){let p=y.blockDepth*G*f,g=h.height+p;for(let S of y.seatIndices)u[S]=g}}for(let a=0;a<i.length;a++){let m=i[a],h=s[a];if(!h){m.eyeHeightM=n+B;continue}let f=l.get(h.id);m.eyeHeightM=(u[a]??f.height)+B}}var Z=40;function ti(e,t){let n=t?.freeText==="exclude",i=1/0,o=1/0,r=-1/0,s=-1/0,l=(c,u)=>{c<i&&(i=c),u<o&&(o=u),c>r&&(r=c),u>s&&(s=u)};for(let c of Pn(e))if(c.type==="row"){let u=new Map((c.overrides??[]).map(a=>[a.index,a]));at(c).forEach((a,m)=>{let h=u.get(m);h?.skip||l(a.x+(h?.dx??0),a.y+(h?.dy??0))})}else if(c.type==="gaArea")for(let u of c.points)l(u.x,u.y);else if(c.type==="section")for(let u of c.outline)l(u.x,u.y);else if(c.type==="decorImage")l(c.x,c.y),l(c.x+c.width,c.y+c.height);else if(c.type==="shape")if(c.points&&c.points.length)for(let u of c.points)l(u.x,u.y);else c.x!=null&&c.y!=null&&c.width!=null&&c.height!=null&&(l(c.x,c.y),l(c.x+c.width,c.y+c.height));else if(c.type==="table"){let u=z+bn,a=c.shape==="round"?(c.radius??40)+u:Math.max((c.width??80)/2,(c.height??50)/2)+u;l(c.center.x-a,c.center.y-a),l(c.center.x+a,c.center.y+a)}else if(c.type==="booth"){let u=Math.max(c.width,c.height)/2;l(c.center.x-u,c.center.y-u),l(c.center.x+u,c.center.y+u)}else if(c.type==="text"){if(n)continue;let u=_e(c);l(c.position.x,c.position.y),l(c.position.x+u.width,c.position.y+u.height)}for(let c of[e.referenceImage,e.backgroundImage]){if(!c)continue;let{center:u,width:a}=c,m=a*3/4;l(u.x-a/2,u.y-m/2),l(u.x+a/2,u.y+m/2)}if(!isFinite(i)){let c=e.focalPoint??{x:0,y:0};return{x:c.x-200,y:c.y-200,width:400,height:400}}return{x:i-Z,y:o-Z,width:r-i+Z*2,height:s-o+Z*2}}export{kn as a,ft as b,Me as c,Y as d,oe as e,On as f,An as g,jn as h,Ln as i,Nn as j,Fn as k,Dn as l,Vn as m,Un as n,Kn as o,Xn as p,Gn as q,Bn as r,zn as s,Yn as t,Wn as u,_e as v,qn as w,Et as x,Jn as y,se as z,eo as A,Te as B,to as C,no as D,Pt as E,Le as F,io as G,Ne as H,_t as I,so as J,uo as K,Ve as L,fo as M,Ue as N,Ot as O,At as P,Lt as Q,ho as R,Ft as S,Vt as T,mo as U,bo as V,yo as W,go as X,Ke as Y,G as Z,So as _,Kt as $,Xe as aa,Be as ba,Ge as ca,le as da,Xt as ea,Gt as fa,Bt as ga,B as ha,Mo as ia,ze as ja,We as ka,$t as la,qe as ma,Eo as na,Io as oa,Po as pa,me as qa,Co as ra,be as sa,z as ta,at as ua,$o as va,gn as wa,ct as xa,xn as ya,lt as za,qo as Aa,Sn as Ba,Mn as Ca,ot as Da,ee as Ea,Jo as Fa,wn as Ga,In as Ha,pe as Ia,Zo as Ja,Pn as Ka,Cn as La,Qo as Ma,ei as Na,ti as Oa};
@@ -1 +0,0 @@
1
- import{a as Pn,c as In,d as wn}from"./chunk-FVTW2IBN.js";import{a as gn}from"./chunk-QJXSZT3H.js";import{a as Mn,c as Nt,d as ft,f as It,i as An}from"./chunk-R7TV7RYQ.js";import{f as hn}from"./chunk-4I2VWFJY.js";import{e as Sn,k as Rn}from"./chunk-UL5OIGIF.js";import{Ea as qt,Z as ut,_ as lt,f as bn,ha as Gt,ja as dn,ka as Dt,ma as yn,qa as xn,x as pn,y as At}from"./chunk-E7TOTX6I.js";import{A as Pt,d as H,y as nt}from"./chunk-JBOTRSMY.js";import Ae from"earcut";import Pe from"polygon-clipping";var g=ut,Ie=.002;function we(t,n,e){let r=Math.hypot(n[0]-t[0],n[1]-t[1],n[2]-t[2]),o=Math.hypot(e[0]-n[0],e[1]-n[1],e[2]-n[2]),a=Math.hypot(t[0]-e[0],t[1]-e[1],t[2]-e[2]),i=Math.max(r,o,a);if(i<1e-9)return!0;let s=(r+o+a)/2;return 2*Math.sqrt(Math.max(0,s*(s-r)*(s-o)*(s-a)))/i<Ie}var ht=class{constructor(n=16384){this.len=0;this.buf=new Float32Array(n)}push3(n,e,r){this.len+3>this.buf.length&&this.grow(this.len+3),this.buf[this.len++]=n,this.buf[this.len++]=e,this.buf[this.len++]=r}push1(n){this.len+1>this.buf.length&&this.grow(this.len+1),this.buf[this.len++]=n}grow(n){let e=this.buf.length*2;for(;e<n;)e*=2;let r=new Float32Array(e);r.set(this.buf.subarray(0,this.len)),this.buf=r}get length(){return this.len}toArray(){return this.buf.slice(0,this.len)}},Yt=class{constructor(){this.pos=new ht;this.nor=new ht;this.col=new ht;this.flr=new ht;this.mat=new ht;this.currentFloor=0;this.currentMaterial=0}setFloor(n){this.currentFloor=n}setMaterial(n){this.currentMaterial=n}tri(n,e,r,o,a,i=a,s=a){we(n,e,r)||(this.pos.push3(n[0],n[1],n[2]),this.pos.push3(e[0],e[1],e[2]),this.pos.push3(r[0],r[1],r[2]),this.nor.push3(o[0],o[1],o[2]),this.nor.push3(o[0],o[1],o[2]),this.nor.push3(o[0],o[1],o[2]),this.col.push3(a[0],a[1],a[2]),this.col.push3(i[0],i[1],i[2]),this.col.push3(s[0],s[1],s[2]),this.flr.push1(this.currentFloor),this.flr.push1(this.currentFloor),this.flr.push1(this.currentFloor),this.mat.push1(this.currentMaterial),this.mat.push1(this.currentMaterial),this.mat.push1(this.currentMaterial))}triN(n,e,r,o,a,i,s,l=s,c=s){[...n,...e,...r].every(Number.isFinite)&&(this.pos.push3(n[0],n[1],n[2]),this.pos.push3(e[0],e[1],e[2]),this.pos.push3(r[0],r[1],r[2]),this.nor.push3(o[0],o[1],o[2]),this.nor.push3(a[0],a[1],a[2]),this.nor.push3(i[0],i[1],i[2]),this.col.push3(s[0],s[1],s[2]),this.col.push3(l[0],l[1],l[2]),this.col.push3(c[0],c[1],c[2]),this.flr.push1(this.currentFloor),this.flr.push1(this.currentFloor),this.flr.push1(this.currentFloor),this.mat.push1(this.currentMaterial),this.mat.push1(this.currentMaterial),this.mat.push1(this.currentMaterial))}get vertexCount(){return this.pos.length/3}build(){return{position:this.pos.toArray(),normal:this.nor.toArray(),color:this.col.toArray(),floor:this.flr.toArray(),material:this.mat.toArray(),count:this.pos.length/3}}};function _e(t,n,e){let r=n[0]-t[0],o=n[1]-t[1],a=n[2]-t[2],i=e[0]-t[0],s=e[1]-t[1],l=e[2]-t[2],c=o*l-a*s,f=a*i-r*l,m=r*s-o*i,u=Math.hypot(c,f,m)||1;return c/=u,f/=u,m/=u,[c,f,m]}function Te(t,n){let e=[...t],r=[];for(let i of t)r.push(i.x,i.y);let o=[];if(n){for(let i of n)if(!(i.length<3)){o.push(e.length);for(let s of i)e.push(s),r.push(s.x,s.y)}}let a=Ae(r,o.length?o:void 0,2);return{pts:e,tris:a}}function Jt(t){return ft(t)<0?[...t].reverse():t}var Be=3;function Ee(t,n,e,r){let o=r(t),a=r(n),i=r(e),s=(h,b,p,d)=>Math.abs(r({x:(h.x+b.x)/2,y:(h.y+b.y)/2})-(p+d)/2),l=(t.x+n.x+e.x)/3,c=(t.y+n.y+e.y)/3,f=(o+a+i)/3,m=Math.max(s(t,n,o,a),s(n,e,a,i),s(e,t,i,o),Math.abs(r({x:l,y:c})-f)),u=(h,b,p)=>{let d=Math.abs(r({x:(h+l)/2,y:(b+c)/2})-(p+f)/2);d>m&&(m=d)};return u((t.x+n.x)/2,(t.y+n.y)/2,(o+a)/2),u((n.x+e.x)/2,(n.y+e.y)/2,(a+i)/2),u((e.x+t.x)/2,(e.y+t.y)/2,(i+o)/2),m}function wt(t,n,e,r,o){if(o<=0)return Ee(t,n,e,r);let a={x:(t.x+n.x)/2,y:(t.y+n.y)/2},i={x:(n.x+e.x)/2,y:(n.y+e.y)/2},s={x:(e.x+t.x)/2,y:(e.y+t.y)/2};return Math.max(wt(t,a,s,r,o-1),wt(a,n,i,r,o-1),wt(s,i,e,r,o-1),wt(a,i,s,r,o-1))}function _t(t,n,e,r,o,a,i,s){if(i>0){let u={x:(n.x+e.x)/2,y:(n.y+e.y)/2},h={x:(e.x+r.x)/2,y:(e.y+r.y)/2},b={x:(r.x+n.x)/2,y:(r.y+n.y)/2};_t(t,n,u,b,o,a,i-1,s),_t(t,u,e,h,o,a,i-1,s),_t(t,b,h,r,o,a,i-1,s),_t(t,u,h,b,o,a,i-1,s);return}let l=[n.x*g,o(n),n.y*g],c=[e.x*g,o(e),e.y*g],f=[r.x*g,o(r),r.y*g];if(s){t.triN(l,c,f,s(n),s(e),s(r),a);return}let m=_e(l,c,f);m[1]<0&&(m=[-m[0],-m[1],-m[2]]),t.tri(l,c,f,m,a)}var Ce=8;function _n(t,n,e){if(!Number.isFinite(e))return t;let r=[],o=(a,i,s,l,c)=>{if(c>0){let f={x:(a.x+i.x)/2,y:(a.y+i.y)/2},m=n(f);if(Math.abs(m-(s+l)/2)>e){o(a,f,s,m,c-1),o(f,i,m,l,c-1);return}}r.push(a)};for(let a=0;a<t.length;a++){let i=t[a],s=t[(a+1)%t.length];o(i,s,n(i),n(s),Ce)}return r}function Xt(t,n){if(t.length<3)return t;let e=[];for(let o of t){let a=e[e.length-1];a&&Math.hypot(o.x-a.x,o.y-a.y)<n||e.push(o)}for(;e.length>2&&Math.hypot(e[0].x-e[e.length-1].x,e[0].y-e[e.length-1].y)<n;)e.pop();if(e.length<3)return t;let r=[];for(let o=0;o<e.length;o++){let a=r.length?r[r.length-1]:e[(o-1+e.length)%e.length],i=e[o],s=e[(o+1)%e.length],l=s.x-a.x,c=s.y-a.y,f=Math.hypot(l,c);f>n&&Math.abs((i.x-a.x)*c-(i.y-a.y)*l)/f<n||r.push(i)}return r.length>=3?r:e}var Ut=.001*lt*.1;function K(t,n,e,r,o,a,i,s,l=1/0,c){if(!n||n.length<3||(l===void 0&&(l=1/0),Math.abs(ft(n))<1e-4))return;let f=Xt(_n(Xt(Jt(n),Ut),r,l),Ut),m=e?.map(M=>Xt(_n(Xt(Jt(M),Ut),r,l),Ut)).filter(M=>M.length>=3&&Math.abs(ft(M))>=1e-4),{pts:u,tris:h}=Te(f,m),b=[a[0]*s.top,a[1]*s.top,a[2]*s.top],p=[a[0]*s.bottomCap,a[1]*s.bottomCap,a[2]*s.bottomCap],d=[i[0]*s.top,i[1]*s.top,i[2]*s.top],y=[i[0]*s.wallBottom,i[1]*s.wallBottom,i[2]*s.wallBottom],x=0;if(Number.isFinite(l))for(;x<Be;x++){let M=0;for(let I=0;I<h.length;I+=3){let B=wt(u[h[I]],u[h[I+1]],u[h[I+2]],r,x);B>M&&(M=B)}if(M<=l)break}for(let M=0;M<h.length;M+=3){let I=u[h[M]],B=u[h[M+1]],k=u[h[M+2]];_t(t,I,B,k,r,b,x,c);let D=[I.x*g,o,I.y*g],U=[B.x*g,o,B.y*g],S=[k.x*g,o,k.y*g];t.tri(D,S,U,[0,-1,0],p)}let w=M=>{if(x<=0)return M;let I=1<<x,B=[];for(let k=0;k<M.length;k++){let D=M[k],U=M[(k+1)%M.length];for(let S=0;S<I;S++){let _=S/I;B.push({x:D.x+(U.x-D.x)*_,y:D.y+(U.y-D.y)*_})}}return B},A=pn(f),E=[{ring:w(f),flip:!1}];if(m)for(let M of m)M.length>=3&&E.push({ring:w(M),flip:!0});for(let{ring:M,flip:I}of E)for(let B=0;B<M.length;B++){let k=M[B],D=M[(B+1)%M.length],U=(D.x-k.x)*g,_=(D.y-k.y)*g,N=-U,O=Math.hypot(_,N)||1;_/=O,N/=O;let P=(k.x+D.x)/2-A.x,F=(k.y+D.y)/2-A.y,R=_*P+N*F;I&&(R=-R),R<0&&(_=-_,N=-N);let T=[_,0,N],C=[k.x*g,r(k),k.y*g],v=[D.x*g,r(D),D.y*g],G=[k.x*g,o,k.y*g],X=[D.x*g,o,D.y*g];t.tri(C,v,X,T,d,d,y),t.tri(C,X,G,T,d,y,y)}}function Tn(t){let n=0;for(let l of t)n+=l.count;let e=new Float32Array(n*3),r=new Float32Array(n*3),o=new Float32Array(n*3),a=new Float32Array(n),i=new Float32Array(n),s=0;for(let l of t)e.set(l.position,s*3),r.set(l.normal,s*3),o.set(l.color,s*3),a.set(l.floor,s),i.set(l.material,s),s+=l.count;return{position:e,normal:r,color:o,floor:a,material:i,count:n}}function jt(t,n,e=2.5){if(n<=0||t.length<3)return t;let r=Jt(t),o=r.length,a=[];for(let s=0;s<o;s++){let l=r[s],c=r[(s+1)%o],f=c.x-l.x,m=c.y-l.y,u=Math.hypot(f,m)||1;a.push({x:m/u,y:-f/u})}let i=[];for(let s=0;s<o;s++){let l=r[s],c=a[(s-1+o)%o],f=a[s],m=c.x+f.x,u=c.y+f.y,h=Math.hypot(m,u),b=()=>{i.push([l.x+c.x*n,l.y+c.y*n]),i.push([l.x+f.x*n,l.y+f.y*n])};if(h<1e-9){b();continue}m/=h,u/=h;let p=m*c.x+u*c.y,d=1/Math.max(p,1e-6);if(!Number.isFinite(d)||d>e){b();continue}i.push([l.x+m*n*d,l.y+u*n*d])}if(i.length<3)return t;try{let s=Pe.union([[...i,i[0]]]),l=null,c=-1/0;for(let m of s){let u=Math.abs(ft(m[0].map(([h,b])=>({x:h,y:b}))));u>c&&(c=u,l=m[0])}if(!l)return t;let f=l.map(([m,u])=>({x:m,y:u}));if(f.length>1){let m=f[0],u=f[f.length-1];Math.abs(m.x-u.x)<1e-9&&Math.abs(m.y-u.y)<1e-9&&f.pop()}return f.length>=3?f:t}catch{return t}}function Ht(t,n,e,r,o=28){let a=[];for(let i=0;i<o;i++){let s=i/o*Math.PI*2;a.push({x:t+e*Math.cos(s),y:n+r*Math.sin(s)})}return a}function Tt(t,n,e,r){return[{x:t,y:n},{x:t+e,y:n},{x:t+e,y:n+r},{x:t,y:n+r}]}var Bt=["available","held","sold","selected","dimmed"];function Qt(t){let n=Bt.indexOf(t);return n<0?0:n}var Bn={available:[.24,.82,.52],held:[.95,.66,.22],sold:[.34,.39,.45],selected:[.24,.74,1],dimmed:[.28,.32,.37]};function mr(t){let n=.2126*t[0]+.7152*t[1]+.0722*t[2],e=.42,r=.62;return[(n+(t[0]-n)*e)*r,(n+(t[1]-n)*e)*r,(n+(t[2]-n)*e)*r]}var tn={ground:[.07,.085,.11],tierTop:[.24,.28,.34],tierWall:[.17,.2,.25],stageTop:[.94,.7,.38],stageWall:[.48,.33,.18],decorTop:[.22,.25,.29],decorWall:[.15,.17,.2],gaTop:[.24,.28,.33],gaWall:[.16,.19,.23],boothTop:[.3,.33,.38],boothWall:[.2,.23,.27],tableTop:[.38,.34,.29],tableWall:[.24,.21,.18]},nn={top:[.05,.06,.08],bottom:[.1,.12,.15]};function et(t,n){return[Math.min(1,t[0]*n),Math.min(1,t[1]*n),Math.min(1,t[2]*n)]}var V={pedestal:0,pad:1,back:2,arm:3,footrest:4,leg:5,body:10,head:11},Fe=.44,ve=.15,ke=.3,Oe=.24;function En(t){return t===void 0||!Number.isFinite(t)||t<=0?Oe:Math.min(ke,Math.max(ve,t*Fe))}var hr=.21,Le=.05,en=.45,Ge=en+Le,De=.92,Ne=1.205,Xe=-.23,Ue=.38,Ye=[{part:V.pedestal,min:[-.3,0,-.3],max:[.3,.36,.3]},{part:V.pad,min:[-1,.36,-.95],max:[1,en,1]},{part:V.back,min:[-1,Ge,-1],max:[1,De,-.72]},{part:V.arm,min:[-1,.44,-.82],max:[-.78,.65,.78]},{part:V.arm,min:[.78,.44,-.82],max:[1,.65,.78]},{part:V.footrest,min:[-.9,.18,.78],max:[.9,.31,1.34]},{part:V.leg,min:[-.82,0,-.7],max:[-.62,.37,-.48]},{part:V.leg,min:[.62,0,-.7],max:[.82,.37,-.48]},{part:V.leg,min:[-.82,0,.48],max:[-.62,.37,.7]},{part:V.leg,min:[.62,0,.48],max:[.82,.37,.7]}],je=[{part:V.body,min:[-.52,.39,-.08],max:[-.08,.55,.82]},{part:V.body,min:[.08,.39,-.08],max:[.52,.55,.82]},{part:V.body,min:[-.47,.05,.58],max:[-.13,.43,.82]},{part:V.body,min:[.13,.05,.58],max:[.47,.43,.82]},{part:V.head,min:[-.16,1.04,-.33],max:[.16,1.1,-.13]}],He=[{n:[1,0,0],c:[[1,0,0],[1,1,0],[1,1,1],[1,0,1]]},{n:[-1,0,0],c:[[0,0,1],[0,1,1],[0,1,0],[0,0,0]]},{n:[0,1,0],c:[[0,1,0],[0,1,1],[1,1,1],[1,1,0]]},{n:[0,-1,0],c:[[0,0,1],[0,0,0],[1,0,0],[1,0,1]]},{n:[0,0,1],c:[[0,0,1],[1,0,1],[1,1,1],[0,1,1]]},{n:[0,0,-1],c:[[1,0,0],[0,0,0],[0,1,0],[1,1,0]]}];function br(){let t=[],n=[],e=[],r=[],o=(O,P,F)=>{let R=e.length,[T,C,v]=O,G=[C[0]-T[0],C[1]-T[1],C[2]-T[2]],X=[v[0]-T[0],v[1]-T[1],v[2]-T[2]],L=G[1]*X[2]-G[2]*X[1],Y=G[2]*X[0]-G[0]*X[2],j=G[0]*X[1]-G[1]*X[0],$=Math.hypot(L,Y,j);$>1e-9?(L/=$,Y/=$,j/=$):[L,Y,j]=P,L*P[0]+Y*P[1]+j*P[2]<0&&(L=-L,Y=-Y,j=-j);for(let z of O)t.push(...z),n.push(L,Y,j),e.push(F);r.push(R,R+1,R+2,R,R+2,R+3)},a=O=>{for(let P of He){let F=P.c.map(R=>R.map((T,C)=>T?O.max[C]:O.min[C]));o(F,P.n,O.part)}};for(let O of Ye)a(O);for(let O of je)a(O);let i=en,s=1.08,l=.47,c=.69,f=-.55,m=.08,u=-.48,h=.01,b=[-l,i,f],p=[l,i,f],d=[-l,i,m],y=[l,i,m],x=[-c,s,u],w=[c,s,u],A=[-c,s,h],E=[c,s,h];o([p,w,E,y],[1,0,0],V.body),o([d,A,x,b],[-1,0,0],V.body),o([A,E,w,x],[0,1,0],V.body),o([b,p,y,d],[0,-1,0],V.body),o([y,E,A,d],[0,0,1],V.body),o([b,x,w,p],[0,0,-1],V.body);let M=10,I=8,B=[0,Ne,Xe],k=[.42,.115,Ue],D=e.length;for(let O=0;O<=I;O++){let P=Math.PI*O/I,F=Math.cos(P),R=Math.sin(P);for(let T=0;T<=M;T++){let C=Math.PI*2*T/M,v=R*Math.cos(C),G=R*Math.sin(C);t.push(B[0]+k[0]*v,B[1]+k[1]*F,B[2]+k[2]*G);let X=v/k[0],L=F/k[1],Y=G/k[2],j=Math.hypot(X,L,Y)||1;X/=j,L/=j,Y/=j,n.push(X,L,Y),e.push(V.head)}}for(let O=0;O<I;O++)for(let P=0;P<M;P++){let F=D+O*(M+1)+P,R=F+M+1;r.push(F,R,F+1,F+1,R,R+1)}let U=new Float32Array(t),S=new Float32Array(n),_=new Float32Array(e),N=new Uint16Array(r);return{position:U,normal:S,part:_,index:N,vertexCount:e.length,indexCount:r.length}}function Cn(t,n,e,r){let o=new Float32Array(n),a=c=>t[c*3],i=c=>t[c*3+2],s=0,l=(c,f)=>{let m=f-c;for(let u=c;u<f;u++){let[h,b]=r(u),p=h-a(u),d=b-i(u);if(m>=2){let y=Math.max(c,u-1),x=Math.min(f-1,u+1),w=a(x)-a(y),A=i(x)-i(y),E=Math.hypot(w,A);if(E>1e-6){let M=-A/E,I=w/E;M*p+I*d<0&&(M=-M,I=-I),p=M,d=I}}o[u]=p===0&&d===0?0:Math.atan2(p,d)}};for(let c=1;c<=n;c++)(c===n||e(c)!==e(s))&&(l(s,c),s=c);return o}var Vt=.22;function Ar(t,n){let e=Bt[t];if(e!=="sold"&&e!=="held")return-1;let r=(n+1)*2654435761;return r^=r>>>15,r=Math.imul(r,2246822519),r^=r>>>13,(r>>>0)%1e5/1e5}var Ve=.42;function We(t){let n=t.length,e=new Float64Array(n);if(n<2)return e.fill(1/0),e;let r=1/0,o=1/0,a=-1/0,i=-1/0;for(let b of t)b.x<r&&(r=b.x),b.y<o&&(o=b.y),b.x>a&&(a=b.x),b.y>i&&(i=b.y);let s=Math.max(a-r,1e-6),l=Math.max(i-o,1e-6),c=Math.max(Math.sqrt(s*l/n),1e-6),f=Math.max(1,Math.ceil(s/c)+1),m=Math.max(1,Math.ceil(l/c)+1),u=new Map,h=(b,p)=>{let d=Math.min(f-1,Math.max(0,Math.floor((b-r)/c)));return Math.min(m-1,Math.max(0,Math.floor((p-o)/c)))*f+d};for(let b=0;b<n;b++){let p=h(t[b].x,t[b].y),d=u.get(p);d?d.push(b):u.set(p,[b])}for(let b=0;b<n;b++){let p=t[b],d=Math.min(f-1,Math.max(0,Math.floor((p.x-r)/c))),y=Math.min(m-1,Math.max(0,Math.floor((p.y-o)/c))),x=1/0;for(let w=1;w<=4;w++){for(let A=y-w;A<=y+w;A++)if(!(A<0||A>=m))for(let E=d-w;E<=d+w;E++){if(E<0||E>=f||w>1&&Math.abs(A-y)<w&&Math.abs(E-d)<w)continue;let M=u.get(A*f+E);if(M)for(let I of M){if(I===b)continue;let B=Math.hypot(t[I].x-p.x,t[I].y-p.y);B<x&&(x=B)}}if(Number.isFinite(x)&&x<=w*c)break}e[b]=x}return e}function ze(t){let n=t.eyeHeightM;return Number.isFinite(n)?Math.max(0,n-Gt):0}function Fn(t,n,e,r,o,a){let i=t.length,s=new Float32Array(i*3),l=new Float32Array(i),c=new Float32Array(i*3),f=new Float32Array(i),m=new Float32Array(i),u=new Float32Array(i),h=new Float32Array(i),b=new Float32Array(i*3),p=new Map,d=We(t);for(let y=0;y<i;y++){let x=t[y],A=(e?.seatPitchU(y)??d[y])*g;f[y]=Number.isFinite(A)?Math.max(.06,Math.min(Vt,A*Ve)):Vt,m[y]=En(Number.isFinite(A)?A:void 0);let E=Rn(x.glyph,{seatGlyph:a?.get(x.categoryKey)});u[y]=Sn.indexOf(E),h[y]=x.wheelchairSpaceType==="no-seat"?0:1,s[y*3]=x.x*g,s[y*3+1]=e?e.seatDeckY(y):ze(x),s[y*3+2]=x.y*g,l[y]=Qt(n?n(x):"available");let M=H(o?.get(x.categoryKey)??"#6e7bff")??[.43,.48,1];if(c[y*3]=M[0],c[y*3+1]=M[1],c[y*3+2]=M[2],x.accessibility?.length){let I=H(hn(x.accessibility));I&&(b[y*3]=I[0],b[y*3+1]=I[1],b[y*3+2]=I[2])}p.set(x.id,y)}return{count:i,iPosition:s,iState:l,iCategory:c,iMaxRadius:f,iRing:b,idToIndex:p,iChairWidth:m,iGlyph:u,iPhysicalSeat:h,iFloor:r??new Float32Array(i),iYaw:new Float32Array(i)}}var Ze=64;function Pr(t,n){let e=[];for(let i of n){let s=t.idToIndex.get(i.seatId);if(s===void 0)continue;let l=Qt(i.state);t.iState[s]!==l&&(t.iState[s]=l,e.push(s))}if(!e.length)return[];e.sort((i,s)=>i-s);let r=[],o=e[0],a=e[0];for(let i=1;i<e.length;i++){let s=e[i];if(s!==a){if(s<=a+Ze){a=s;continue}r.push({start:o,length:a-o+1}),o=s,a=s}}return r.push({start:o,length:a-o+1}),r}function _r(t,n,e){return e<0?n>1?t.filter(r=>r.kind==="floor"):[...t]:t.filter(r=>r.floorIndex===void 0||r.floorIndex===e)}function Tr(t,n){let e=[...t].sort((o,a)=>o.screen.y-a.screen.y),r=[];for(let o of e){let a=r.find(i=>i.some(s=>Math.abs(s.screen.x-o.screen.x)<104&&Math.abs(s.screen.y-o.screen.y)<34));a?a.push(o):r.push([o])}return r.flatMap(o=>o.length<2?o:o.map((a,i)=>({...a,screen:{...a.screen,x:Math.max(54,Math.min(n-54,a.screen.x+(i-(o.length-1)/2)*104))}})))}var Ke=1.15,$e=2.75,qe=4.5,Je=.85,Qe=.5,to=.26;function Br(t,n,e){let r=Math.max(1e-6,n),o=t/r,a=e?.hasZoneLabels??!0,i=new Set;return o>=.75&&i.add("floor"),o>=Ke&&i.add("zone"),o<=(a?$e:qe)&&(i.add("section"),i.add("ga")),o<=Je&&(i.add("annotation"),i.add("booth")),o<=Qe&&i.add("row"),o<=to&&i.add("seat"),i}function Er(t,n,e,r,o,a=6){let i=a+n,s=r-a-n,l=a+e,c=o-a-e;return{...t,x:i>s?r/2:Math.max(i,Math.min(s,t.x)),y:l>c?o/2:Math.max(l,Math.min(c,t.y))}}function Cr(t,n,e,r){let o=t,a=n[0],i=n[1],s=n[2],l=o[0]*a+o[4]*i+o[8]*s+o[12],c=o[1]*a+o[5]*i+o[9]*s+o[13],f=o[2]*a+o[6]*i+o[10]*s+o[14],m=o[3]*a+o[7]*i+o[11]*s+o[15];if(!(m>1e-6))return{x:0,y:0,depth:1/0,visible:!1};let u=l/m,h=c/m,b=f/m,p=u>=-1.05&&u<=1.05&&h>=-1.05&&h<=1.05&&b<=1;return{x:(u*.5+.5)*e,y:(1-(h*.5+.5))*r,depth:b,visible:p}}function Fr(t,n,e=n){let r=[],o=[...t].sort((a,i)=>a.screen.depth-i.screen.depth);for(let a of o){let i=!1;for(let s of r)if(on(a,s,n,e)){i=!0;break}i||r.push(a)}return r}var no=6;function on(t,n,e,r){let o=Math.abs(t.screen.x-n.screen.x),a=Math.abs(t.screen.y-n.screen.y),i=t.halfWidth!=null&&n.halfWidth!=null?Math.max(e,t.halfWidth+n.halfWidth+no):e;return o<i&&a<r}function vr(t,n,e){return t.length*n*.58+(e?14:0)}var eo={row:8,seat:14};function kr(t){return t<480?{row:5,seat:8}:t<768?{row:6,seat:10}:eo}function Or(t,n,e,r){let o=Math.max(1,Math.min(e,r)*.5),a=Math.min(2,Math.hypot(t.x-e/2,t.y-r/2)/o);return n*(1+1.5*a)}function Lr(t,n,e,r,o=[]){let a=[...t].sort((s,l)=>(l.priority??0)-(s.priority??0)||s.focus-l.focus),i=[];for(let s of a){if(i.length>=r)break;let l=!1;for(let c of o)if(on(s,c,n,e)){l=!0;break}if(!l){for(let c of i)if(on(s,c,n,e)){l=!0;break}}l||i.push(s)}return i}import bo from"polygon-clipping";var W={top:1,wallBottom:.5,bottomCap:.4};function st(t,n){if(!t)return n;let e=et(Pt(t,.4),.62);return nt(n,e,.72)}function vn(t,n){let e=new Map;for(let a of t.categories??[])e.set(a.key,a.color);let r=new Map;for(let a of n){if(!a.sectionId)continue;let i=r.get(a.sectionId);i||(i=new Map,r.set(a.sectionId,i)),i.set(a.categoryKey,(i.get(a.categoryKey)??0)+1)}let o=new Map;for(let[a,i]of r){let s=0,l=0,c=0,f=0;for(let[m,u]of i){let h=H(e.get(m));h&&(s+=h[0]*u,l+=h[1]*u,c+=h[2]*u,f+=u)}f>0&&o.set(a,[s/f,l/f,c/f])}return o}function kn(t,n){return H(t.color)??n.get(t.logicalSectionId??t.id)??null}import zn from"polygon-clipping";import Dn from"polygon-clipping";import oo from"earcut";var ro=.58,On=.01,ot=Vt*1.5*lt,io=.5,so=.6;function ao(t,n){let e=t.length,r=[];for(let i=0;i<e;i++){let s=t[Math.max(0,i-1)],l=t[Math.min(e-1,i+1)],c=l.x-s.x,f=l.y-s.y,m=Math.hypot(c,f);if(m<1e-9){r.push([0,0]);continue}c/=m,f/=m,r.push([-f,c])}let o=0;for(let i=0;i<e;i++)o+=(t[i].x-n.x)*r[i][0]+(t[i].y-n.y)*r[i][1];return o<0?r.map(([i,s])=>[-i,-s]):r}function co(t,n){if(t.length<2||n<=0)return[...t];let e=[...t],r=(i,s)=>{let l=s.x-i.x,c=s.y-i.y,f=Math.hypot(l,c)||1;return{x:l/f,y:c/f}},o=r(e[1],e[0]),a=r(e[e.length-2],e[e.length-1]);return e.unshift({x:e[0].x+o.x*n,y:e[0].y+o.y*n}),e.push({x:e[e.length-1].x+a.x*n,y:e[e.length-1].y+a.y*n}),e}var Ln=Math.PI/12;function uo(t){if(t.length<3)return[...t];let n=[...t].sort((a,i)=>a.x-i.x||a.y-i.y),e=(a,i,s)=>(i.x-a.x)*(s.y-a.y)-(i.y-a.y)*(s.x-a.x),r=a=>{let i=[];for(let s of a){for(;i.length>=2&&e(i[i.length-2],i[i.length-1],s)<=0;)i.pop();i.push(s)}return i.pop(),i},o=[...r(n),...r([...n].reverse())];return o.length>=3?o:[...t]}function Nn(t,n){if(!t.length||!(n>0))return[];let e=uo(t),r=(s,l,c,f)=>{let m=c-l;for(;m<0;)m+=Math.PI*2;for(;m>Math.PI*2;)m-=Math.PI*2;let u=Math.max(1,Math.ceil(m/Ln)),h=n/Math.cos(m/u/2);for(let b=0;b<=u;b++){let p=l+m*b/u;f.push({x:s.x+Math.cos(p)*h,y:s.y+Math.sin(p)*h})}};if(e.length<3){let s=0,l=0;for(let h of e)s+=h.x,l+=h.y;s/=e.length||1,l/=e.length||1;let c=0;for(let h of e)c=Math.max(c,Math.hypot(h.x-s,h.y-l));let f=[],m=Math.max(3,Math.ceil(Math.PI*2/Ln)),u=(c+n)/Math.cos(Math.PI/m);for(let h=0;h<m;h++){let b=h/m*Math.PI*2;f.push({x:s+Math.cos(b)*u,y:l+Math.sin(b)*u})}return f}let o=e.length,a=[];for(let s=0;s<o;s++){let l=e[s],c=e[(s+1)%o];a.push(Math.atan2(-(c.x-l.x),c.y-l.y))}let i=[];for(let s=0;s<o;s++)r(e[s],a[(s+o-1)%o],a[s],i);return Hn(i)}function lo(t,n,e){if(t.length===1)return Math.hypot(n-t[0].x,e-t[0].y);let r=1/0;for(let o=0;o+1<t.length;o++){let a=t[o],i=t[o+1],s=i.x-a.x,l=i.y-a.y,c=s*s+l*l,f=c>1e-12?((n-a.x)*s+(e-a.y)*l)/c:0;f<0?f=0:f>1&&(f=1);let m=Math.hypot(n-(a.x+f*s),e-(a.y+f*l));m<r&&(r=m)}return r}function Wt(t){let n=t.map(o=>{let a=0,i=0;for(let c of o.pts)a+=c.x,i+=c.y;let s=o.pts.length||1;a/=s,i/=s;let l=0;for(let c of o.pts){let f=Math.hypot(c.x-a,c.y-i);f>l&&(l=f)}return{cx:a,cy:i,rad:l}}),e=o=>{let a=o.length;return a<=2?[...o]:[o[Math.floor(a*.25)],o[Math.floor(a*.5)],o[Math.floor(a*.75)]]},r=[];for(let o=0;o<t.length;o++){let a=e(t[o].pts),i=[],s=1/0,l=null;for(let f of a){let m=1/0;for(let u=0;u<t.length;u++){if(u===o||Math.abs(t[u].y-t[o].y)<.001)continue;let h=n[u],b=Math.hypot(f.x-h.cx,f.y-h.cy)-h.rad;if(b>=m&&b>=s)continue;let p=lo(t[u].pts,f.x,f.y);p<m&&(m=p),t[u].depth<t[o].depth&&p<s&&(s=p,l=t[u].y)}Number.isFinite(m)&&m>0&&i.push(m)}i.sort((f,m)=>f-m);let c=i.length?i[Math.floor(i.length/2)]:1;r.push({pitch:c,belowY:l})}return r}function Xn(t,n,e,r){let o=t[n],a=o.pts.length>=2?[...o.pts]:o.pts.length===1?(()=>{let f=o.pts[0],m=f.x-r.x,u=f.y-r.y,h=Math.hypot(m,u)||1;m/=h,u/=h;let b=Math.max(e[n].pitch,.001)*.5;return[{x:f.x+u*b,y:f.y-m*b},{x:f.x-u*b,y:f.y+m*b}]})():[];if(a.length<2)return null;let i=0,s=0;for(let f=1;f<a.length;f++){let m=Math.hypot(a[f].x-a[f-1].x,a[f].y-a[f-1].y);m>1e-6&&(i+=m,s++)}let l=s>0?i/s:0,c=co(a,Math.max(l*so,ot));return{pts:c,nrm:ao(c,r),front:Math.max(e[n].pitch*ro,ot),back:Math.max(e[n].pitch*io,ot)}}var gt=1.5,Un=.3;function rn(t,n){if(t.length<3)return t;let e=t[0],r=t[t.length-1],o=r.x-e.x,a=r.y-e.y,i=Math.hypot(o,a),s=-1,l=-1;for(let m=1;m<t.length-1;m++){let u=t[m],h=i>1e-12?Math.abs((u.x-e.x)*a-(u.y-e.y)*o)/i:Math.hypot(u.x-e.x,u.y-e.y);h>s&&(s=h,l=m)}if(s<=n||l<0)return[e,r];let c=rn(t.slice(0,l+1),n),f=rn(t.slice(l),n);return[...c.slice(0,-1),...f]}function Yn(t,n){if(t.length<4)return t;let e=rn([...t,t[0]],n);return e.pop(),e.length>=3?e:t}function jn(t,n,e){if(t.length<2)return[];let r=e??Wt(t),o=new Map;for(let i=0;i<t.length;i++){let s=o.get(t[i].blockId);s?s.push(i):o.set(t[i].blockId,[i])}let a=[];for(let[,i]of o){let s=[];for(let x of i){let w=t[x].patch;w&&w.length>=3?a.push({outline:[...w],holes:[],topY:t[x].y}):s.push(x)}if(!s.length)continue;s.sort((x,w)=>t[x].depth-t[w].depth);let c=s.map(x=>Xn(t,x,r,n)).filter(x=>x!==null);if(!c.length)continue;let f=(x,w)=>({x:x.pts[w].x-x.nrm[w][0]*(x.front+gt),y:x.pts[w].y-x.nrm[w][1]*(x.front+gt)}),m=(x,w)=>({x:x.pts[w].x+x.nrm[w][0]*(x.back+gt),y:x.pts[w].y+x.nrm[w][1]*(x.back+gt)}),u=c[0],h=c[c.length-1],b=[];for(let x=0;x<u.pts.length;x++)b.push(f(u,x));for(let x of c)b.push(m(x,x.pts.length-1));for(let x=h.pts.length-1;x>=0;x--)b.push(m(h,x));for(let x=c.length-1;x>=0;x--)b.push(f(c[x],0));let p=Hn(b),d=1/0;for(let x of s)t[x].y<d&&(d=t[x].y);if(!Number.isFinite(d))continue;if(p.length>=3&&Math.abs(ft(p))>1e-6&&c.every(x=>{let w=x.pts[Math.floor(x.pts.length/2)];return It(p,w.x,w.y)})){a.push({outline:Yn(p,Un),holes:[],topY:d});continue}for(let x of mo(c))a.push({outline:x,holes:[],topY:d})}return a}function mo(t){let n=[];for(let e of t){let r=[],o=[],a=e.front+gt,i=e.back+gt;for(let l=0;l<e.pts.length;l++){let c=e.pts[l],f=e.nrm[l];r.push([c.x-f[0]*a,c.y-f[1]*a]),o.push([c.x+f[0]*i,c.y+f[1]*i])}let s=[...r,...o.reverse()];s.length<3||(s.push(s[0]),n.push([s]))}if(!n.length)return[];try{let e=Dn.union(n[0],...n.slice(1)),r=[];for(let o of e){if(!o.length||o[0].length<4)continue;let a=o[0].map(([l,c])=>({x:l,y:c})),i=a[0],s=a[a.length-1];a.length>1&&Math.abs(i.x-s.x)<1e-9&&Math.abs(i.y-s.y)<1e-9&&a.pop(),a.length>=3&&r.push(Yn(a,Un))}return r}catch{return[]}}function Hn(t){let n=[];for(let e of t){let r=n[n.length-1];r&&Math.hypot(e.x-r.x,e.y-r.y)<1e-9||n.push(e)}for(;n.length>2&&Math.hypot(n[0].x-n[n.length-1].x,n[0].y-n[n.length-1].y)<1e-9;)n.pop();return n}var sn=class{constructor(n){this.minX=1/0;this.minY=1/0;this.maxX=-1/0;this.maxY=-1/0;this.rings=n;for(let e of n)for(let r of e)r.x<this.minX&&(this.minX=r.x),r.y<this.minY&&(this.minY=r.y),r.x>this.maxX&&(this.maxX=r.x),r.y>this.maxY&&(this.maxY=r.y)}containsAll(n){for(let e of n)if(e.x<this.minX||e.x>this.maxX||e.y<this.minY||e.y>this.maxY)return!1;for(let e of this.rings){let r=!0;for(let o of n)if(!It(e,o.x,o.y)){r=!1;break}if(r)return!0}return!1}};function Gn(t,n,e,r,o,a){if(r.length<3)return;if(e.containsAll(r)){let c=[0,1,0],f=r[0];for(let m=1;m+1<r.length;m++){let u=r[m],h=r[m+1];t.tri([f.x*g,o,f.y*g],[u.x*g,o,u.y*g],[h.x*g,o,h.y*g],c,a)}return}let i=r.map(c=>[c.x,c.y]);i.push(i[0]);let s;try{s=Dn.intersection([i],n)}catch{return}let l=[0,1,0];for(let c of s){if(!c.length||c[0].length<4)continue;let f=c[0],m=[],u=[];for(let b=0;b<f.length-1;b++)m.push(f[b][0],f[b][1]),u.push([f[b][0],f[b][1]]);if(u.length<3)continue;let h=oo(m,void 0,2);for(let b=0;b<h.length;b+=3){let p=u[h[b]],d=u[h[b+1]],y=u[h[b+2]];t.tri([p[0]*g,o,p[1]*g],[d[0]*g,o,d[1]*g],[y[0]*g,o,y[1]*g],l,a)}}}function Vn(t,n,e,r,o,a,i){if(n.length<2)return;let s=i??Wt(n),l=[0,1,0],c=a&&a.length>=3?[[...a.map(h=>[h.x,h.y]),[a[0].x,a[0].y]]]:null,f=a&&a.length>=3?new sn([[...a]]):null,m=h=>{t.setMaterial(2),h(),t.setMaterial(0)},u=h=>{t.setMaterial(3),h(),t.setMaterial(0)};for(let h=0;h<n.length;h++){let b=n[h];if(b.patch&&b.patch.length>=3){let E=[...b.patch],M=s[h].belowY??r;if(u(()=>{if(c&&f)Gn(t,c,f,E,b.y,o.tread);else{let I=E[0];for(let B=1;B+1<E.length;B++){let k=E[B],D=E[B+1];t.tri([I.x*g,b.y,I.y*g],[k.x*g,b.y,k.y*g],[D.x*g,b.y,D.y*g],l,o.tread)}}}),b.y>M+On){let I=0,B=0;for(let k of E)I+=k.x,B+=k.y;I/=E.length,B/=E.length,m(()=>{for(let k=0;k<E.length;k++){let D=E[k],U=E[(k+1)%E.length],S=U.x-D.x,_=U.y-D.y,N=Math.hypot(S,_);if(N<1e-6)continue;let O=_/N,P=-S/N;(D.x-I)*O+(D.y-B)*P<0&&(O=-O,P=-P);let F=[O,0,P],R=[D.x*g,b.y,D.y*g],T=[U.x*g,b.y,U.y*g],C=[D.x*g,M,D.y*g],v=[U.x*g,M,U.y*g];t.tri(R,T,v,F,o.riser),t.tri(R,v,C,F,o.riser)}})}continue}let p=Xn(n,h,s,e);if(!p)continue;let{pts:d,nrm:y,front:x,back:w}=p,A=s[h].belowY??r;for(let E=0;E+1<d.length;E++){let M=d[E],I=d[E+1],B=y[E],k=y[E+1];if(Math.hypot(I.x-M.x,I.y-M.y)<1e-6||B[0]===0&&B[1]===0||k[0]===0&&k[1]===0)continue;let D=[(M.x-B[0]*x)*g,b.y,(M.y-B[1]*x)*g],U=[(I.x-k[0]*x)*g,b.y,(I.y-k[1]*x)*g],S=[(M.x+B[0]*w)*g,b.y,(M.y+B[1]*w)*g],_=[(I.x+k[0]*w)*g,b.y,(I.y+k[1]*w)*g];if(u(()=>{c&&f?Gn(t,c,f,[{x:M.x-B[0]*x,y:M.y-B[1]*x},{x:I.x-k[0]*x,y:I.y-k[1]*x},{x:I.x+k[0]*w,y:I.y+k[1]*w},{x:M.x+B[0]*w,y:M.y+B[1]*w}],b.y,o.tread):(t.tri(D,U,_,l,o.tread),t.tri(D,_,S,l,o.tread))}),b.y>A+On){let N=[D[0],A,D[2]],O=[U[0],A,U[2]],P=[-B[0],0,-B[1]];m(()=>{t.tri(D,U,O,P,o.riser),t.tri(D,O,N,P,o.riser)})}}}}function fo(t,n){let e=t.eventConfigurationIds;return!e?.length||!!n&&e.includes(n)}function Wn(t,n){return t.filter(e=>e.type!=="shape"||fo(e,n))}function Zn(t,n){let e=t.focalPoint??{x:0,y:0};return t.floors?.length?t.floors.map((r,o)=>({objects:Wn(r.objects,n),focal:{x:(r.focalPoint??e).x,y:(r.focalPoint??e).y},baseHeightM:r.baseHeightM??0,index:o})):[{objects:Wn(t.objects,n),focal:e,baseHeightM:0,index:0}]}var ho={minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};function Mt(t){return Mn(t)??ho}function Kn(t,n){let e=jt(t.outline,ot),r=Mt(e),o=n.filter(i=>i!==t&&i.outline&&i.outline.length>=3&&Nt(r,Mt(i.outline)));if(!o.length)return[e];let a=i=>{let s=i.map(l=>[l.x,l.y]);return s.push(s[0]),s};try{let i=zn.difference([a(e)],...o.map(l=>[a(l.outline)])),s=[];for(let l of i){if(!l.length)continue;let c=l[0].map(([f,m])=>({x:f,y:m}));if(c.length>1){let f=c[0],m=c[c.length-1];Math.abs(f.x-m.x)<1e-9&&Math.abs(f.y-m.y)<1e-9&&c.pop()}c.length>=3&&s.push(c)}return s.length?s:[e]}catch{return[e]}}function $n(t,n){if(!n.length)return t;let e=a=>{let i=a.map(s=>[s.x,s.y]);return i.push(i[0]),i},r=n.map(a=>[e(a)]),o=[];for(let a of t){let i;try{i=zn.intersection([e(a.outline)],r.flat())}catch{o.push(a);continue}for(let s of i){if(!s.length)continue;let l=s[0].map(([c,f])=>({x:c,y:f}));if(l.length>1){let c=l[0],f=l[l.length-1];Math.abs(c.x-f.x)<1e-9&&Math.abs(c.y-f.y)<1e-9&&l.pop()}l.length>=3&&o.push({outline:l,holes:[],topY:a.topY})}}return o.length?o:t}function po(t,n){return t===void 0||n===void 0?!0:Math.abs(t-n)<.001}var zt=class{constructor(){this.rings=[];this.boxes=[];this.levels=[]}subtract(n,e){let r=n.map(l=>[l.x,l.y]);if(r.length<3)return[];r.push(r[0]);let o=Mt(n),a=this.rings.filter((l,c)=>Nt(o,this.boxes[c])&&po(e,this.levels[c])),i=[[r]];if(a.length)try{i=bo.difference([r],...a).map(c=>c.map(f=>f.map(([m,u])=>[m,u])))}catch{i=[[r]]}this.rings.push([r]),this.boxes.push(o),this.levels.push(e);let s=[];for(let l of i){if(!l.length)continue;let c=l[0].map(([f,m])=>({x:f,y:m}));if(c.length>1){let f=c[0],m=c[c.length-1];Math.abs(f.x-m.x)<1e-9&&Math.abs(f.y-m.y)<1e-9&&c.pop()}c.length>=3&&s.push(c)}return s}};function yo(t,n){if(!n)return t;let e=1/0,r=-1/0,o=1/0,a=-1/0;for(let m of t)e=Math.min(e,m.x),r=Math.max(r,m.x),o=Math.min(o,m.y),a=Math.max(a,m.y);let i=(e+r)/2,s=(o+a)/2,l=n*Math.PI/180,c=Math.cos(l),f=Math.sin(l);return t.map(m=>{let u=m.x-i,h=m.y-s;return{x:i+u*c-h*f,y:s+u*f+h*c}})}function bt(t){let n=null;if(t.kind==="polygon"&&t.points&&t.points.length>=3&&(n=t.points),t.kind==="rect"&&t.width&&t.height&&(n=Tt(t.x??0,t.y??0,t.width,t.height)),t.kind==="ellipse"&&t.width&&t.height){let e=(t.x??0)+t.width/2,r=(t.y??0)+t.height/2;n=Ht(e,r,t.width/2,t.height/2)}return n?yo(n,t.rotation):null}function Et(t){let n=t.role??"",e={stage:{kind:"stage",heightM:1},entrance:{kind:"portal",heightM:2.7},exit:{kind:"portal",heightM:2.7},screen:{kind:"solid",heightM:6},wall:{kind:"solid",heightM:2.8},rail:{kind:"solid",heightM:1.1},suite:{kind:"suite",heightM:3},obstruction:{kind:"solid",heightM:4.5},sound:{kind:"solid",heightM:1.45},restroom:{kind:"solid",heightM:2.4},bar:{kind:"solid",heightM:1.1},concession:{kind:"solid",heightM:1.1},coat:{kind:"solid",heightM:1.1},goal:{kind:"portal",heightM:1.8}},r=n==="stage"&&xn(t.stageKind)?{kind:"stage",heightM:.06}:e[n]??{kind:"plate",heightM:.25};return{...r,heightM:t.heightM??r.heightM}}var xo=.08;function qn(t,n){let e=bt(t),r=Et(t),o=r.heightM;if(!e||r.kind!=="plate"&&r.kind!=="stage")return o;let a=1/0,i=1/0,s=-1/0,l=-1/0;for(let f of e)a=Math.min(a,f.x),i=Math.min(i,f.y),s=Math.max(s,f.x),l=Math.max(l,f.y);let c=o;for(let f of n)s>f.minX&&a<f.maxX&&l>f.minY&&i<f.maxY&&c<=f.topOffsetM+1e-6&&(c=f.topOffsetM+xo);return n.push({minX:a,minY:i,maxX:s,maxY:l,topOffsetM:c}),c}function mt(t,n,e){return{x:t.x+(n.x-t.x)*e,y:t.y+(n.y-t.y)*e}}function Jn(t){if(t.length!==4)return t;let n=Math.hypot(t[1].x-t[0].x,t[1].y-t[0].y),e=Math.hypot(t[2].x-t[1].x,t[2].y-t[1].y);return n>=e?t:[t[1],t[2],t[3],t[0]]}function Ct(t,n,e){return[mt(t[0],t[1],n),mt(t[0],t[1],e),mt(t[3],t[2],e),mt(t[3],t[2],n)]}function Qn(t,n,e){return[mt(t[0],t[3],n),mt(t[1],t[2],n),mt(t[1],t[2],e),mt(t[0],t[3],e)]}function at(t,n,e,r,o,a){K(t,n,void 0,()=>e,r,o,a,W)}var an=2.4,go=.75,Mo=.15;function Ft(t){if(t.points&&t.points.length>=3)return t.points;let{center:n,width:e,height:r,rotation:o}=t;if(!e||!r)return null;let a=(o??0)*Math.PI/180,i=Math.cos(a),s=Math.sin(a),l=e/2,c=r/2;return[[-l,-c],[l,-c],[l,c],[-l,c]].map(([f,m])=>({x:n.x+f*i-m*s,y:n.y+f*s+m*i}))}function te(t,n,e,r,o){let a=Ft(n);a&&K(t,a,void 0,()=>e+an,e,st(r,o.boothTop),o.boothWall,W)}function cn(t){if(t.shape==="round"){let f=t.radius;return f?Ht(t.center.x,t.center.y,f,f,24):null}let{width:n,height:e,rotation:r,center:o}=t;if(!n||!e)return null;let a=(r??0)*Math.PI/180,i=Math.cos(a),s=Math.sin(a),l=n/2,c=e/2;return[[-l,-c],[l,-c],[l,c],[-l,c]].map(([f,m])=>({x:o.x+f*i-m*s,y:o.y+f*s+m*i}))}function ne(t,n,e,r,o){let a=cn(n);a&&K(t,a,void 0,()=>e+go,e,st(r,o.tableTop),o.tableWall,W)}function ee(t,n,e,r,o,a,i,s){let l=bt(n);if(!l)return;let c=s?s.kind==="stage":n.role==="stage",f=s?s.kind==="screen":n.role==="screen",m=s?{kind:c?"stage":"solid",heightM:s.topY-s.baseY}:Et(n),u=s?.baseY??e,h=s?.topY??e+r;if(c&&i){let x=1/0,w=-1/0,A=1/0,E=-1/0;for(let M of l)M.x<x&&(x=M.x),M.x>w&&(w=M.x),M.y<A&&(A=M.y),M.y>E&&(E=M.y);i.push({cx:(x+w)/2*g,cz:(A+E)/2*g,y:h,halfX:Math.max((w-x)/2*g,.5),halfZ:Math.max((E-A)/2*g,.5)})}let b=H(n.fill),p=c&&b?nt(o.stageTop,et(Pt(b,.18),.9),.9):st(b,c?o.stageTop:o.decorTop),d=f?b:null,y=c?b?nt(o.stageWall,et(b,.58),.82):o.stageWall:f?d?nt(et(d,1.42),[.24,.46,.82],.08):[.24,.46,.82]:st(H(n.fill),o.decorWall);if(m.kind==="portal"&&l.length===4){let x=Jn(l);at(t,Ct(x,0,.16),h,u,p,y),at(t,Ct(x,.84,1),h,u,p,y),at(t,x,h,Math.max(u,h-.35),p,y);return}if(m.kind==="suite"&&l.length===4){let x=l.map((E,M)=>{let I=l[(M+1)%4],B=(E.x+I.x)/2,k=(E.y+I.y)/2;return Math.hypot(B-a.x,k-a.y)}),w=x.indexOf(Math.min(...x)),A=[0,1,2,3].map(E=>l[(w+E)%4]);at(t,Ct(A,0,.08),h,u,p,y),at(t,Ct(A,.92,1),h,u,p,y),at(t,Qn(A,.88,1),h,u,p,y),at(t,A,h,Math.max(u,h-.18),p,y);return}at(t,l,h,u,p,y)}function un(t){let{x:n,y:e,width:r,height:o}=t;if(!r||!o)return null;let a=n+r/2,i=e+o/2,s=(t.rotation??0)*Math.PI/180,l=Math.cos(s),c=Math.sin(s),f=r/2,m=o/2;return[[-f,-m],[f,-m],[f,m],[-f,m]].map(([u,h])=>({x:a+u*l-h*c,y:i+u*c+h*l}))}function So(t){if(!t||!t.startsWith("data:image/svg+xml"))return null;let n=t.slice(t.indexOf(",")+1);if(/;base64/i.test(t.slice(0,t.indexOf(","))))try{n=atob(n)}catch{return null}else try{n=decodeURIComponent(n)}catch{}let e=n.match(/<(?:rect|path)\b[^>]*\bfill="([^"]+)"/i);if(!e)return null;let r=e[1].trim();if(r==="none"||r==="transparent")return null;let o=r.match(/^url\(#([^)]+)\)$/);if(!o)return H(r);let a=n.match(new RegExp(`<(?:linear|radial)Gradient\\b[^>]*\\bid="${o[1]}"[^>]*>([\\s\\S]*?)</(?:linear|radial)Gradient>`,"i"));if(!a)return null;let i=[];for(let s of a[1].matchAll(/stop-color="([^"]+)"/gi)){let l=H(s[1].trim());l&&i.push(l)}return i.length?i.reduce((s,l,c)=>nt(s,l,1/(c+1)),i[0]):null}function oe(t,n,e,r){if(n.layer==="foreground")return;let o=un(n);if(!o)return;let a=e+Mo,i=st(So(n.href),r.decorTop),s=Math.max(0,Math.min(1,n.opacity??1));s<1&&(i=nt(r.ground,i,s)),K(t,o,void 0,()=>a,e,i,nt(i,r.decorWall,.5),W)}function re(t,n,e,r,o){if(!n.points||n.points.length<3)return;let a=st(r,o.gaTop);K(t,n.points,n.holes,()=>e+.15,e,a,o.gaWall,W)}var Ro=6,Ao=2.2,ie=.1,Po=.3,Io=1.8,wo=.9,_o=.55,To=6e3;function se(t){let{doc:n,units:e,seats:r,surfaces:o,focal:a}=t,i=n.zones??[],s=[];if(i.length){let l=new Map;for(let f of e)for(let m of f.objects)m.type==="section"&&m.zone&&l.set(m.id,m.zone);let c=new Map;for(let f=0;f<r.length;f++){let m=r[f],u=o.seatOwner[f],h=m.zoneId??(u?l.get(u):void 0);if(!h)continue;let b=c.get(h);b||(b={n:0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0,sumY:0},c.set(h,b)),b.n++,m.x<b.minX&&(b.minX=m.x),m.y<b.minY&&(b.minY=m.y),m.x>b.maxX&&(b.maxX=m.x),m.y>b.maxY&&(b.maxY=m.y),b.sumY+=o.seatDeckY(f)}for(let f of i){let m=c.get(f.id),u=[];for(let[h,b]of l)b===f.id&&u.push(h);if(!m||m.n===0){s.push({id:f.id,label:f.label,color:H(f.color),sectionIds:u,seatCount:0,center:[0,0,0],radius:0,focalWorld:[(f.focalPoint??a).x*g,1.5,(f.focalPoint??a).y*g]});continue}s.push({id:f.id,label:f.label,color:H(f.color),sectionIds:u,seatCount:m.n,center:[(m.minX+m.maxX)/2*g,m.sumY/m.n,(m.minY+m.maxY)/2*g],radius:.5*Math.hypot((m.maxX-m.minX)*g,(m.maxY-m.minY)*g)||1,focalWorld:[(f.focalPoint??a).x*g,1.5,(f.focalPoint??a).y*g]})}}return s}function ae(t){let{doc:n,units:e,seats:r,surfaces:o,seatData:a,hintedSeatFloor:i,zones:s,focal:l}=t,c=[],f=[],m=[];for(let u of s)u.seatCount!==0&&c.push({id:`zone:${u.id}`,kind:"zone",text:u.label,anchor:[u.center[0],u.center[1]+Ro,u.center[2]],color:n.zones?.find(h=>h.id===u.id)?.color});{let u=new Map,h=new Map;for(let b=0;b<r.length;b++){let p=o.seatOwner[b];if(!p)continue;let d=u.get(p);d||(d={n:0,x:0,y:0,deck:0},u.set(p,d)),d.n++,d.x+=r[b].x,d.y+=r[b].y,d.deck+=o.seatDeckY(b);let y=h.get(p);y||(y={minX:1/0,maxX:-1/0,minY:1/0,maxY:-1/0},h.set(p,y)),r[b].x<y.minX&&(y.minX=r[b].x),r[b].x>y.maxX&&(y.maxX=r[b].x),r[b].y<y.minY&&(y.minY=r[b].y),r[b].y>y.maxY&&(y.maxY=r[b].y)}for(let b of e)for(let p of b.objects){if(p.type!=="section")continue;let d=u.get(p.id);if(!d||d.n===0)continue;let y=h.get(p.id),x=[d.x/d.n*g,d.deck/d.n,d.y/d.n*g],w=p.displayLabel||p.label||p.id;f.push({id:p.id,floorIndex:b.index,label:w,seatCount:d.n,center:x,radius:Math.max(1,Math.hypot(y.maxX-y.minX,y.maxY-y.minY)*.5*g),focalWorld:[b.focal.x*g,b.baseHeightM+1.5,b.focal.y*g]});let A=n.floors?.[b.index]?.name?.trim().toLocaleLowerCase();e.length>1&&A===w.trim().toLocaleLowerCase()||c.push({id:`section:${p.id}`,kind:"section",text:w,anchor:[x[0],x[1]+Ao,x[2]],floorIndex:b.index})}}{for(let p of e)for(let d of p.objects){if(d.type!=="gaArea")continue;let y=At(d.points);if(!y)continue;let x=d.displayLabel||d.label||d.id;c.push({id:`ga:${d.id}`,kind:"ga",text:d.capacity>0?`${x} \xB7 ${d.capacity.toLocaleString()}`:x,anchor:[y.x*g,p.baseHeightM+Io,y.y*g],floorIndex:p.index})}let u=new Map;for(let p of e)for(let d of p.objects)d.type==="section"&&u.set(d.id,d.displayLabel||d.label||d.id);let h=new Map;for(let p=0;p<r.length;p++){let d=r[p],y=Math.hypot(d.x-l.x,d.y-l.y),x=h.get(d.rowId);(!x||y>x.far)&&h.set(d.rowId,{seat:d,index:p,far:y})}for(let[p,d]of h){let y=Eo(d.seat.label,p,u.get(d.seat.sectionId??""));y&&c.push({id:`row:${p}`,kind:"row",text:y,anchor:[d.seat.x*g,o.seatDeckY(d.index)+wo,d.seat.y*g],floorIndex:i[d.index]})}let b=new Map;for(let p=0;p<r.length;p++){let d=r[p],y=d.label?d.label.lastIndexOf("-"):-1,x=b.get(d.rowId);x||(x={n:0,x:0,y:0,z:0,minX:1/0,maxX:-1/0,minZ:1/0,maxZ:-1/0,label:y>0?d.label.slice(0,y):d.rowId,sectionId:d.sectionId},b.set(d.rowId,x));let w=p*3,A=a.iPosition[w],E=a.iPosition[w+1],M=a.iPosition[w+2];x.n++,x.x+=A,x.y+=E,x.z+=M,x.minX=Math.min(x.minX,A),x.maxX=Math.max(x.maxX,A),x.minZ=Math.min(x.minZ,M),x.maxZ=Math.max(x.maxZ,M)}for(let[p,d]of b)m.push({id:p,label:d.label,sectionId:d.sectionId,seatCount:d.n,center:[d.x/d.n,d.y/d.n,d.z/d.n],radius:Math.max(.8,Math.hypot(d.maxX-d.minX,d.maxZ-d.minZ)*.5)});if(r.length<=To)for(let p=0;p<r.length;p++){let d=r[p],y=Bo(d.displayLabel||d.label);y&&c.push({id:`seat:${d.id}`,kind:"seat",text:y,anchor:[d.x*g,o.seatDeckY(p)+_o,d.y*g],floorIndex:i[p]})}}for(let u of e)for(let h of u.objects)if(h.type==="shape"&&h.role&&["entrance","exit","screen","suite","obstruction"].includes(h.role)){let b=bt(h),p=b?At(b):null;if(!p||!h.label)continue;c.push({id:`architecture:${h.id}`,kind:"annotation",text:h.label,anchor:[p.x*g,u.baseHeightM+Et(h).heightM+ie,p.y*g],color:h.fill,floorIndex:u.index})}else if(h.type==="text"){if(!h.text)continue;c.push({id:`text:${h.id}`,kind:"annotation",text:h.text,anchor:[h.position.x*g,u.baseHeightM+ie,h.position.y*g],color:h.color,rotation:h.rotation,floorIndex:u.index})}else if(h.type==="booth"){let b=Ft(h);if(!b)continue;let p=At(b);if(!p)continue;c.push({id:`booth:${h.id}`,kind:"booth",text:h.displayLabel||h.label||h.id,anchor:[p.x*g,u.baseHeightM+an+Po,p.y*g],floorIndex:u.index})}return{labels:c,sections:f,rows:m}}function ce(t,n){if(n.length>1)for(let e of n)t.push({id:`floor:${e.id}`,kind:"floor",text:e.label,anchor:[e.center[0],e.box.max[1]+1.2,e.center[2]],floorIndex:e.index})}function Bo(t){let n=t.lastIndexOf("-");return n>=0&&n<t.length-1?t.slice(n+1):t}function Eo(t,n,e){let r=t?t.lastIndexOf("-"):-1,o=r>0?t.slice(0,r):n;return o&&gn(o,e)}var Co=.15,Fo=.9,vo=1.76;function ko(){return{background:{top:[...nn.top],bottom:[...nn.bottom]},structure:tn,seatStates:{...Bn},seatScale:1,materials:{seat:null,shell:null,roughness:.78}}}function ue(t){let n=ko();if(!t)return n;let e=H(t.background);if(e){n.background={top:et(e,Fo),bottom:et(e,vo)};let i={};for(let[s,l]of Object.entries(tn))i[s]=nt(l,e,Co);n.structure=i}let r=H(t.selectionColor)??H(t.accent);r&&(n.seatStates={...n.seatStates,selected:r});let o=t.seatScale;typeof o=="number"&&Number.isFinite(o)&&(n.seatScale=An(o));let a=t.venue3d;if(a){let i=H(a.deck),s=H(a.fascia);i&&(n.structure={...n.structure,tierTop:i,gaTop:i}),s&&(n.structure={...n.structure,tierWall:s,gaWall:s}),n.materials.seat=H(a.seat),n.materials.shell=H(a.shell),typeof a.roughness=="number"&&Number.isFinite(a.roughness)&&(n.materials.roughness=Math.min(1,Math.max(0,a.roughness)))}return n}function le(t,n){let e=[];for(let r of n)e.push(...t.seatStates[r]);return e}var Oo=.05,me=.05,Lo=.15,ln=25;function fe(t,n,e){let r=new Map,o=new Array(n.length).fill(null),a=new Float64Array(n.length),i=new Array(n.length).fill(void 0),s=new Array(n.length).fill(void 0),l=new Map,c=[],f=new Set;for(let u=0;u<t.length;u+=1){let h=t[u];for(let b of h.objects){if(b.type==="table"&&f.add(b.id),b.type!=="section"||!b.outline||b.outline.length<3)continue;let p=jt(b.outline,ot);l.set(b.id,{section:b,unit:h,frontU:1/0,hasSeats:!1,rows:new Map,seatIndices:[]}),c.push({id:b.id,floorIndex:u,box:Mt(p),section:b,unit:h,outline:p})}}let m=new Map;for(let u of c){let h=m.get(u.floorIndex);h?h.push(u):m.set(u.floorIndex,[u])}for(let u=0;u<n.length;u++){let h=n[u],b=e?m.get(e[u])??[]:c,p=h.sectionId?b.find(y=>y.id===h.sectionId)??b.find(y=>y.section.logicalSectionId===h.sectionId&&qt({x:h.x,y:h.y},y.outline,y.section.holes)):void 0,d=p?[p]:b;for(let y of d){if(e&&y.floorIndex!==e[u]||!p&&(h.x<y.box.minX||h.x>y.box.maxX||h.y<y.box.minY||h.y>y.box.maxY||!qt({x:h.x,y:h.y},y.outline,y.section.holes)))continue;o[u]=y.id;let x=l.get(y.id);x.hasSeats=!0;let w=h.focalPoint??y.unit.focal,A=Math.hypot(h.x-w.x,h.y-w.y);A<x.frontU&&(x.frontU=A),x.seatIndices.push(u);let E=h.rowId||`__seat-${u}`,M=x.rows.get(E);M?M.push({x:h.x,y:h.y}):x.rows.set(E,[{x:h.x,y:h.y}]);break}}for(let[u,h]of l){let b=dn(h.section,{floorBaseHeightM:h.unit.baseHeightM}),p=h.unit.baseHeightM,d=b.rake>0?Math.tan(b.rake*Math.PI/180):0,y=b.rake<=.01&&b.height<=p+.001,x=h.section.surfaceKind,w=x==="flat"?!0:x==="rakedRows"&&b.rake>.01?!1:y,A=h.hasSeats?yn(u,n,h.seatIndices,h.unit.focal):{sectionId:u,rows:[],blockCount:0},M=A.rows.length<2?Pn([...h.rows.values()].map(R=>({points:R})),h.unit.focal):null,I=1/0;if(M){if(h.hasSeats)for(let R of h.rows.values())for(let T of R){let C=M.depthAt(T.x,T.y);C<I&&(I=C)}if(!h.hasSeats||!Number.isFinite(I)){I=1/0;for(let R of h.section.outline){let T=M.depthAt(R.x,R.y);T<I&&(I=T)}}}let B=p+Oo,k=Math.max(B,b.height),D=R=>{let T=Math.max(0,R-I)*ut,C=Math.min(T*d,ln);return Math.max(B,b.height+C)},U=R=>{let T=Math.max(0,R)*ut,C=Math.min(T*d,ln);return Math.max(B,b.height+C)},S=w?[]:A.rows.map(R=>({pts:R.pts,y:U(R.blockDepth),depth:R.blockDepth,blockId:R.blockId,...f.has(R.id)?{patch:Nn(R.pts,ot)}:{}})),_=S.length?S[0].y:k,N=S.map(R=>{let T=R.patch&&R.patch.length>=3?R.patch:R.pts,C=0,v=0;for(let L of T)C+=L.x,v+=L.y;let G=T.length||1;C/=G,v/=G;let X=0;for(let L of T){let Y=Math.hypot(L.x-C,L.y-v);Y>X&&(X=Y)}return{cx:C,cy:v,rad:X}}),O=w?()=>k:S.length>=2?(R,T)=>{let C=1/0,v=_;for(let G=0;G<S.length;G++){let X=N[G];if(Math.hypot(R-X.cx,T-X.cy)-X.rad>=C)continue;let L=S[G].patch,Y=L&&L.length>=3?It(L,R,T)?0:Dt(L,R,T):Dt(S[G].pts,R,T);Y<C&&(C=Y,v=S[G].y)}return v}:(R,T)=>M?D(M.depthAt(R,T)):k,P=[0,1,0],F=S.length>=2||w?()=>P:(R,T)=>{if(!M)return P;let C=M.depthAt(R,T);if(C<=I)return P;let v=(C-I)*ut;if(v*d>=ln||b.height+v*d<=B)return P;let[G,X]=M.gradientAt(R,T);if(G===0&&X===0)return P;let L=1/Math.hypot(d,1);return[-G*d*L,L,-X*d*L]};if(!w)for(let R of A.rows){let T=U(R.blockDepth);for(let C of R.seatIndices)i[C]=T}for(let R of A.rows){let T=[];for(let L=1;L<R.pts.length;L++){let Y=Math.hypot(R.pts[L].x-R.pts[L-1].x,R.pts[L].y-R.pts[L-1].y);Y>1e-6&&T.push(Y)}T.sort((L,Y)=>L-Y);let C=T.length?T[Math.floor(T.length/2)]:1/0,v=1/0,G=R.pts[Math.floor(R.pts.length/2)];if(G)for(let L of A.rows){if(L===R||L.blockId!==R.blockId)continue;let Y=Dt(L.pts,G.x,G.y);Y>1e-6&&Y<v&&(v=Y)}let X=Math.min(C,Math.max(v,C*.5));if(Number.isFinite(X)&&X>0)for(let L of R.seatIndices)s[L]=X}r.set(u,{sectionId:u,deckAt:O,normalAt:F,flat:w,bottomY:p,rowLevels:S,landingY:_})}for(let u=0;u<n.length;u++){let h=o[u],b=n[u];if(h){let d=i[u];a[u]=(d??r.get(h).deckAt(b.x,b.y))+Lo;continue}let p=b.eyeHeightM;a[u]=Number.isFinite(p)?Math.max(0,p-Gt):0}return{bySection:r,seatOwner:o,seatDeckY:u=>a[u],seatPitchU:u=>s[u]}}var Go=.25,Do=1.2,No=.6,Xo=.45,Uo=2.3,Yo=Math.PI/180;function pt(t,n,e){let r=e*Yo;return{x:t.x+n*Math.sin(r),y:t.y+n*Math.cos(r)}}function jo(t,n){let e=n.rings[n.rings.length-1];if(!e)return!1;let r=e.outerRMedian*.85;for(let o of t){if(o.role!=="wall")continue;let a=o.points&&o.points.length>=2?o.points:o.x!==void 0&&o.y!==void 0&&o.width!==void 0&&o.height!==void 0?[{x:o.x,y:o.y},{x:o.x+o.width,y:o.y},{x:o.x+o.width,y:o.y+o.height},{x:o.x,y:o.y+o.height}]:[];if(a.length<2)continue;let i=0;for(let s of a)Math.hypot(s.x-n.centre.x,s.y-n.centre.y)>=r&&i++;if(i>=a.length/2)return!0}return!1}var Ho=24;function Vo(t,n,e,r,o,a,i,s){let l=e.binCount,c=Ho,f=ut,m=a+.02,u=[];for(let S=0;S<l;S++){let _=(e.startBin+S+.5)*n.binStepDeg,N=new Float64Array(c+1);for(let O=0;O<=c;O++){let P=r[S]+(o[S]-r[S])*O/c;N[O]=Math.max(m,wn(n,e,_,P)-Go)}u.push(N)}let h=[i.bandTop[0]*s.top,i.bandTop[1]*s.top,i.bandTop[2]*s.top],b=[i.bandTop[0]*s.bottomCap,i.bandTop[1]*s.bottomCap,i.bandTop[2]*s.bottomCap],p=[i.bandWall[0]*s.top,i.bandWall[1]*s.top,i.bandWall[2]*s.top],d=[i.bandWall[0]*s.wallBottom,i.bandWall[1]*s.wallBottom,i.bandWall[2]*s.wallBottom],y=(S,_)=>{let N=(e.startBin+S+.5)*n.binStepDeg,O=r[S]+(o[S]-r[S])*_/c,P=pt(n.centre,O,N);return[P.x*f,u[S][_],P.y*f]};{let S=Math.tan(12*Math.PI/180);for(let _=0;_<6;_++){let N=!1;for(let P=0;P<l;P++)for(let F=c-1;F>=0;F--)u[P][F]>u[P][F+1]&&(u[P][F]=u[P][F+1],N=!0);let O=e.closed?l:l-1;for(let P=0;P<O;P++){let F=(P+1)%l;for(let R=0;R<=c;R++){let T=u[F][R]-u[P][R];if(Math.abs(T)>1)continue;let C=r[P]+(o[P]-r[P])*R/c,v=r[F]+(o[F]-r[F])*R/c,G=pt(n.centre,C,(e.startBin+P+.5)*n.binStepDeg),X=pt(n.centre,v,(e.startBin+F+.5)*n.binStepDeg),L=S*Math.hypot(X.x-G.x,X.y-G.y)*f;T>L?(u[F][R]=u[P][R]+L,N=!0):-T>L&&(u[P][R]=u[F][R]+L,N=!0)}}if(!N)break}}let x=1,w=(S,_)=>{for(let N=0;N<=c;N+=4)if(Math.abs(u[S][N]-u[_][N])>x)return!0;return Math.abs(u[S][c]-u[_][c])>x},A=Math.tan(38*Math.PI/180),E=S=>(o[S]-r[S])/c*f,M=(S,_)=>u[S][_+1]-u[S][_]>A*Math.max(1e-6,E(S)),I=(S,_)=>{let N=e.closed?(S-1+l)%l:Math.max(0,S-1),O=e.closed?(S+1)%l:Math.min(l-1,S+1);Math.abs(u[N][_]-u[S][_])>x&&(N=S),Math.abs(u[O][_]-u[S][_])>x&&(O=S);let P=Math.max(0,_-1),F=Math.min(c,_+1);P<_&&M(S,P)&&(P=_),F>_&&M(S,_)&&(F=_);let R=y(N,_),T=y(O,_),C=y(S,P),v=y(S,F),G=T[0]-R[0],X=T[1]-R[1],L=T[2]-R[2],Y=v[0]-C[0],j=v[1]-C[1],$=v[2]-C[2],z=X*$-L*j,q=L*Y-G*$,tt=G*j-X*Y,Z=Math.hypot(z,q,tt);return Z>1e-12?(z/=Z,q/=Z,tt/=Z,q<0&&(z=-z,q=-q,tt=-tt),[z,q,tt]):[0,1,0]},B=(S,_)=>{let N=[S[0],a,S[2]],O=[_[0],a,_[2]],P=_[0]-S[0],F=_[2]-S[2],R=Math.hypot(P,F);if(!(R>1e-12))return;let T=[F/R,0,-P/R];t.tri(S,_,O,T,p,p,d),t.tri(S,O,N,T,p,d,d)},k=.05*lt,D=S=>o[S]-r[S]<k,U=e.closed?l:l-1;for(let S=0;S<U;S++){let _=(S+1)%l;if(D(S)||D(_))continue;if(w(S,_)){let T=(e.startBin+S+1)*n.binStepDeg,C=(j,$)=>{let z=(r[S]+r[_])/2,q=(o[S]+o[_])/2,tt=z+(q-z)*$/c,Z=pt(n.centre,tt,T);return[Z.x*f,u[j][$],Z.y*f]};for(let j=0;j<c;j++){let $=y(S,j),z=y(S,j+1),q=C(S,j),tt=C(S,j+1),Z=I(S,j),it=I(S,j+1);t.triN($,q,tt,Z,Z,it,h),t.triN($,tt,z,Z,it,it,h);let vt=y(_,j),kt=y(_,j+1),dt=C(_,j),St=C(_,j+1),yt=I(_,j),xt=I(_,j+1);t.triN(dt,vt,kt,yt,yt,xt,h),t.triN(dt,kt,St,yt,xt,xt,h);let ct=C(S,j),rt=C(S,j+1),Ot=C(_,j+1),Kt=C(_,j),Lt=rt[0]-ct[0],Rt=rt[2]-ct[2],$t=Math.hypot(Lt,Rt);if($t>1e-12){let fn=[Rt/$t,0,-Lt/$t];t.tri(ct,rt,Ot,fn,p),t.tri(ct,Ot,Kt,fn,p)}}let v=y(S,0),G=y(_,0),X=y(_,c),L=y(S,c),Y=j=>[j[0],a,j[2]];t.tri(Y(v),Y(X),Y(G),[0,-1,0],b),t.tri(Y(v),Y(L),Y(X),[0,-1,0],b),B(v,G),B(L,X);continue}for(let T=0;T<c;T++){let C=I(S,T),v=I(_,T),G=I(_,T+1),X=I(S,T+1);if(M(S,T)||M(_,T)){let z=(rt,Ot)=>{let Kt=(e.startBin+rt+.5)*n.binStepDeg,Lt=r[rt]+(o[rt]-r[rt])*(T+.5)/c,Rt=pt(n.centre,Lt,Kt);return[Rt.x*f,Ot,Rt.y*f]},q=y(S,T),tt=y(_,T),Z=z(S,u[S][T]),it=z(_,u[_][T]);t.triN(q,tt,it,C,v,v,h),t.triN(q,it,Z,C,v,C,h);let vt=y(_,T+1),kt=y(S,T+1),dt=z(S,u[S][T+1]),St=z(_,u[_][T+1]);t.triN(dt,St,vt,X,G,G,h),t.triN(dt,vt,kt,X,G,X,h);let yt=it[0]-Z[0],xt=it[2]-Z[2],ct=Math.hypot(yt,xt);if(ct>1e-12){let rt=[-xt/ct,0,yt/ct];t.tri(Z,it,St,rt,p),t.tri(Z,St,dt,rt,p)}continue}let L=y(S,T),Y=y(_,T),j=y(_,T+1),$=y(S,T+1);t.triN(L,Y,j,C,v,G,h),t.triN(L,j,$,C,G,X,h)}let N=y(S,0),O=y(_,0),P=y(_,c),F=y(S,c),R=T=>[T[0],a,T[2]];t.tri(R(N),R(P),R(O),[0,-1,0],b),t.tri(R(N),R(F),R(P),[0,-1,0],b),B(N,O),B(F,P)}if(!e.closed)for(let S of[0,l-1])for(let _=0;_<c;_++)B(y(S,_),y(S,_+1))}function he(t,n,e){let{bottomY:r,colors:o,ao:a}=e,i=new Float64Array(n.binCount).fill(-1/0);for(let f of n.rings)for(let m of f.arcs){let u=new Float64Array(m.binCount),h=new Float64Array(m.binCount);for(let p=0;p<m.binCount;p++){let d=(m.startBin+p)%n.binCount,y=Math.max(0,m.innerR[p]-ot);u[p]=Math.max(y,i[d]+.001),h[p]=Math.max(u[p]+.001,m.outerR[p]+ot)}let b=0;for(let p=0;p<m.binCount;p++){let d=m.topLevelM[p]-r;d>b&&(b=d)}b>=Do&&Vo(t,n,m,u,h,r,o,a);for(let p=0;p<m.binCount;p++){let d=(m.startBin+p)%n.binCount;h[p]>i[d]&&(i[d]=h[p])}}if(e.deriveShell===!1||jo(e.shapes,n))return;let s=n.rings[n.rings.length-1],l=No*lt,c=Xo*lt;for(let f of s.arcs){let m=[],u=[];for(let p=0;p<f.binCount;p++){let d=(f.startBin+p+.5)*n.binStepDeg,y=f.outerR[p]+ot+l;m.push(pt(n.centre,y,d)),u.push(pt(n.centre,y+c,d))}let h=-1/0;for(let p=0;p<f.binCount;p++)f.topLevelM[p]>h&&(h=f.topLevelM[p]);let b=()=>h+Uo;f.closed?K(t,u,[m.slice().reverse()],b,r,o.shellTop,o.shellWall,a):K(t,[...u,...m.slice().reverse()],void 0,b,r,o.shellTop,o.shellWall,a)}}function be(t,n,e,r,o,a,i,s){if(!n.outline||n.outline.length<3)return;let l=e.baseHeightM,c=st(r,s.tierTop);if(!o)return;let f=d=>o.deckAt(d.x,d.y),m=Kn(n,i),u=m[0]??n.outline;if(o.rowLevels.length>=2){let d=Wt(o.rowLevels),y=$n(jn(o.rowLevels,e.focal,d),m),x=()=>[0,1,0];for(let A of y){let E=Math.max(l,A.topY-.02);for(let M of a.subtract(A.outline,E))K(t,M,A.holes,()=>E,l,c,s.tierWall,W,void 0,x)}y.length||K(t,u,n.holes,()=>o.landingY,l,c,s.tierWall,W);let w={tread:[c[0]*W.top,c[1]*W.top,c[2]*W.top],riser:[c[0]*.72,c[1]*.72,c[2]*.72]};for(let A of m.length?m:[u])Vn(t,o.rowLevels,e.focal,o.landingY,w,A,d);return}let h=o.flat?1/0:me,b=d=>o.normalAt(d.x,d.y),p=o.flat?o.landingY:void 0;for(let d of a.subtract(u,p))K(t,d,n.holes,f,l,c,s.tierWall,W,h,b)}function Wo(t,n,e){let r=new Set;for(let i of t.objects)i.type==="section"&&r.add(i.id);let o=new Map;for(let i=0;i<n.length;i++){let s=e.seatOwner[i];if(!s||!r.has(s))continue;let l=e.bySection.get(s);if(l&&l.rowLevels.length>=2)continue;let c=n[i],f=o.get(s);f||(f=new Map,o.set(s,f));let m=c.rowId||`__seat-${i}`,u=f.get(m);u||(u={pts:[],levelM:0,n:0},f.set(m,u)),u.pts.push({x:c.x,y:c.y}),u.levelM+=e.seatDeckY(i),u.n++}let a=[];for(let i of t.objects){if(i.type!=="section")continue;let s=e.bySection.get(i.id);if(s&&s.rowLevels.length>=2){let c=s.rowLevels.filter(f=>!f.patch).map(f=>({pts:f.pts,levelM:f.y}));c.length>=2&&a.push({sectionId:i.id,rows:c});continue}let l=o.get(i.id);l&&a.push({sectionId:i.id,rows:[...l.values()].map(c=>({pts:c.pts,levelM:c.levelM/c.n}))})}return a}function pe(t,n,e,r,o,a,i=!0){let s=Wo(n,e,r);if(!s.length)return;let l=In(s,n.focal);l&&(t.setMaterial(0),he(t,l,{bottomY:n.baseHeightM,colors:{bandTop:et(o.tierTop,.8),bandWall:o.tierWall,shellTop:a??et(o.tierWall,1.15),shellWall:a??o.tierWall},ao:W,shapes:n.objects.filter(c=>c.type==="shape"),deriveShell:i}))}function de(t){let{doc:n,units:e,seats:r,surfaces:o,solids:a,hintedSeatFloor:i,seatFloor:s}=t,l=[];{let c=e.map(()=>({minX:1/0,minY:1/0,minZ:1/0,maxX:-1/0,maxY:-1/0,maxZ:-1/0}));for(let u=0;u<a.floor.length;u+=1){let h=Math.max(0,Math.min(e.length-1,Math.round(a.floor[u]))),b=u*3,p=c[h];p.minX=Math.min(p.minX,a.position[b]),p.minY=Math.min(p.minY,a.position[b+1]),p.minZ=Math.min(p.minZ,a.position[b+2]),p.maxX=Math.max(p.maxX,a.position[b]),p.maxY=Math.max(p.maxY,a.position[b+1]),p.maxZ=Math.max(p.maxZ,a.position[b+2])}let f=new Map;for(let u=0;u<e.length;u++)for(let h of e[u].objects)h.type==="section"&&f.set(h.id,u);let m=e.map(()=>({n:0,minX:1/0,minY:1/0,minDeck:1/0,maxX:-1/0,maxY:-1/0,maxDeck:-1/0,sumX:0,sumDeck:0,sumZ:0}));for(let u=0;u<r.length;u++){let h=o.seatOwner[u],b=(h!==null?f.get(h):void 0)??i[u];if(b===void 0)continue;let p=m[b],d=r[u];p.n++,d.x<p.minX&&(p.minX=d.x),d.y<p.minY&&(p.minY=d.y),d.x>p.maxX&&(p.maxX=d.x),d.y>p.maxY&&(p.maxY=d.y);let y=o.seatDeckY(u);p.sumX+=d.x*g,p.sumDeck+=y,p.sumZ+=d.y*g,p.minDeck=Math.min(p.minDeck,y),p.maxDeck=Math.max(p.maxDeck,y+1.6),s[u]=b}for(let u=0;u<e.length;u++){let h=m[u],b=n.floors?.[u],p=c[u],d=Math.min(h.n?h.minX*g:e[u].focal.x*g-1,Number.isFinite(p.minX)?p.minX:1/0),y=Math.max(h.n?h.maxX*g:e[u].focal.x*g+1,Number.isFinite(p.maxX)?p.maxX:-1/0),x=Math.min(h.n?h.minY*g:e[u].focal.y*g-1,Number.isFinite(p.minZ)?p.minZ:1/0),w=Math.max(h.n?h.maxY*g:e[u].focal.y*g+1,Number.isFinite(p.maxZ)?p.maxZ:-1/0),A=Math.min(h.n?Math.min(e[u].baseHeightM,h.minDeck):e[u].baseHeightM,Number.isFinite(p.minY)?p.minY:1/0),E=Math.max(h.n?Math.max(h.maxDeck,A+.5):A+.5,Number.isFinite(p.maxY)?p.maxY:-1/0),M=[h.n?h.sumX/h.n:(d+y)/2,h.n?h.sumDeck/h.n:(A+E)/2,h.n?h.sumZ/h.n:(x+w)/2],I=Math.max(1,.5*Math.hypot(y-d,E-A,w-x));l.push({index:u,id:b?.id??`floor-${u}`,label:b?.name??(e.length>1?`Floor ${u+1}`:"Venue"),seatCount:h.n,center:M,radius:I,box:{min:[d,A,x],max:[y,E,w]},focalWorld:[e[u].focal.x*g,e[u].baseHeightM+1.5,e[u].focal.y*g]})}}return l}function mn(t,n){let e=1/0,r=1/0,o=-1/0,a=-1/0,i=(s,l)=>{s<e&&(e=s),l<r&&(r=l),s>o&&(o=s),l>a&&(a=l)};for(let s of n)i(s.x,s.y);for(let s of t)for(let l of s.objects)if(l.type==="section")for(let c of l.outline)i(c.x,c.y);else if(l.type==="shape"&&l.points)for(let c of l.points)i(c.x,c.y);else if(l.type==="gaArea")for(let c of l.points)i(c.x,c.y);else if(l.type==="booth"){let c=Ft(l);if(c)for(let f of c)i(f.x,f.y)}else if(l.type==="table"){let c=cn(l);if(c)for(let f of c)i(f.x,f.y)}else if(l.type==="decorImage"){let c=un(l);if(c)for(let f of c)i(f.x,f.y)}return Number.isFinite(e)||(e=-100,r=-100,o=100,a=100),{minX:e,minY:r,maxX:o,maxY:a}}function ye(t,n,e,r,o,a){if(n.length===1){let i=Math.max(60,(o.maxX-o.minX+o.maxY-o.minY)*.06),s=Tt(o.minX-i,o.minY-i,o.maxX-o.minX+i*2,o.maxY-o.minY+i*2);K(t,s,void 0,()=>0,-.4,a.ground,a.ground,W)}else{let i=n.reduce((h,b)=>b.baseHeightM<h.baseHeightM?b:h);t.setFloor(i.index);let s=e.filter((h,b)=>r[b]===i.index),l=mn([i],s),c=Math.hypot(l.maxX-l.minX,l.maxY-l.minY),f=Math.max(28,Math.min(80,c*.04)),m=Tt(l.minX-f,l.minY-f,l.maxX-l.minX+f*2,l.maxY-l.minY+f*2),u=i.baseHeightM-.03;K(t,m,void 0,()=>u,u-.22,a.ground,a.ground,W)}}function xe(t,n,e){let{cx:r,cz:o,radius:a}=e,i=1/0,s=1/0,l=1/0,c=-1/0,f=-1/0,m=-1/0,u=(p,d,y)=>{i=Math.min(i,p),c=Math.max(c,p),s=Math.min(s,d),f=Math.max(f,d),l=Math.min(l,y),m=Math.max(m,y)};for(let p=0;p<t.position.length;p+=3)u(t.position[p],t.position[p+1],t.position[p+2]);for(let p=0;p<n.count;p++){let d=p*3,y=n.iPosition[d],x=n.iPosition[d+1],w=n.iPosition[d+2],A=Math.max(.35,n.iMaxRadius[p]??.35);u(y-A,x,w-A),u(y+A,x+1.6,w+A)}Number.isFinite(i)||(i=r-a,c=r+a,s=0,f=a*.16,l=o-a,m=o+a);let h=[(i+c)/2,(s+f)/2,(l+m)/2],b=Math.max(1,.5*Math.hypot(c-i,f-s,m-l));return{center:h,radius:b,minY:s,maxY:f}}function ge(t,n,e,r,o,a){let i=1/0,s=1/0,l=-1/0,c=-1/0;for(let A=0;A<t.count;A++){let E=A*3,M=t.iPosition[E],I=t.iPosition[E+2];M<i&&(i=M),M>l&&(l=M),I<s&&(s=I),I>c&&(c=I)}for(let A of n)i=Math.min(i,A.cx-A.halfX),l=Math.max(l,A.cx+A.halfX),s=Math.min(s,A.cz-A.halfZ),c=Math.max(c,A.cz+A.halfZ);let f=e.minX*g,m=e.maxX*g,u=e.minY*g,h=e.maxY*g,b=f,p=m,d=u,y=h;if(Number.isFinite(i)){let A=Math.max(2,.06*Math.hypot(l-i,c-s));b=Math.max(f,i-A),p=Math.min(m,l+A),d=Math.max(u,s-A),y=Math.min(h,c+A)}let x=Math.min(0,r),w=Math.max(o,a*.05);return{min:[b,x,d],max:[p,w,y]}}function Me(t,n,e){let r=()=>({byObjectId:new Map,elements:[]});if(!n||!t)return r();let o=bn(n);if(!o.ok||o.value.id!==t)return r();let a=new Map;for(let m of e)for(let u of m.objects)u.type==="shape"&&a.set(u.id,{shape:u,unit:m});let i=new Set,s=new Set,l=new Map((n.overlay.productionElements??[]).map(m=>{let u=m.runtimeContentImageUrl;return[m.id,typeof u=="string"&&/^(?:blob:|data:image\/|https:\/\/)/.test(u)?u:void 0]})),c=[];for(let m of o.value.overlay.productionElements??[]){let u=a.get(m.objectId),h=u?bt(u.shape):null,b=m.baseElevationM??0;if(!u||!h||h.length<3||!m.id||i.has(m.id)||s.has(m.objectId)||!Number.isFinite(m.heightM)||m.heightM<.05||m.heightM>50||!Number.isFinite(b)||b<-10||b>100)return r();i.add(m.id),s.add(m.objectId);let p=h.map(B=>B.x*g),d=h.map(B=>B.y*g),y=u.unit.baseHeightM+b,x=Math.min(...p),w=Math.max(...p),A=Math.min(...d),E=Math.max(...d),M,I=l.get(m.id)??m.contentImageUrl;if(m.kind==="screen"&&I)if(w-x>=E-A){let B=Math.abs(A-u.unit.focal.y*g)<=Math.abs(E-u.unit.focal.y*g)?A-.006:E+.006;M=[[x,y,B],[w,y,B],[x,y+m.heightM,B],[w,y+m.heightM,B]]}else{let B=Math.abs(x-u.unit.focal.x*g)<=Math.abs(w-u.unit.focal.x*g)?x-.006:w+.006;M=[[B,y,A],[B,y,E],[B,y+m.heightM,A],[B,y+m.heightM,E]]}c.push({id:m.id,objectId:m.objectId,kind:m.kind,floorIndex:u.unit.index,baseY:y,topY:y+m.heightM,bounds:{min:[x,y,A],max:[w,y+m.heightM,E]},occlusion:m.occlusion,...I?{contentImageUrl:I}:{},...M?{contentPlane:M}:{}})}let f=c.sort((m,u)=>m.id.localeCompare(u.id));return{byObjectId:new Map(f.map(m=>[m.objectId,m])),elements:f}}function Q(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}function J(t){return Array.isArray(t)?t:[]}function zo(t){let n=[t];for(;n.length;){let e=n.pop();if(Array.isArray(e)){n.push(...e);continue}if(!Q(e))continue;let r=Q(e.extensions)?e.extensions:null;if(r&&Object.prototype.hasOwnProperty.call(r,"KHR_draco_mesh_compression"))return!0;n.push(...Object.values(e))}return!1}function Zt(t,n){return!Array.isArray(t)||t.length!==n||!t.every(e=>typeof e=="number"&&Number.isFinite(e))?null:t}function Zo(){return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}function Ko(t,n){let e=new Array(16).fill(0);for(let r=0;r<4;r++)for(let o=0;o<4;o++)for(let a=0;a<4;a++)e[r*4+o]+=t[a*4+o]*n[r*4+a];return e}function $o(t){let n=Zt(t.matrix,16);if(n)return n;if(t.matrix!==void 0)return null;let e=t.translation===void 0?[0,0,0]:Zt(t.translation,3),r=t.rotation===void 0?[0,0,0,1]:Zt(t.rotation,4),o=t.scale===void 0?[1,1,1]:Zt(t.scale,3);if(!e||!r||!o)return null;let[a,i,s,l]=r,c=Math.hypot(a,i,s,l);if(!(c>1e-8))return null;let f=a/c,m=i/c,u=s/c,h=l/c,b=f+f,p=m+m,d=u+u,y=f*b,x=f*p,w=f*d,A=m*p,E=m*d,M=u*d,I=h*b,B=h*p,k=h*d;return[(1-(A+M))*o[0],(x+k)*o[0],(w-B)*o[0],0,(x-k)*o[1],(1-(y+M))*o[1],(E+I)*o[1],0,(w+B)*o[2],(E-I)*o[2],(1-(y+A))*o[2],0,e[0],e[1],e[2],1]}function qo(t,n,e,r){return[t[0]*n+t[4]*e+t[8]*r+t[12],t[1]*n+t[5]*e+t[9]*r+t[13],t[2]*n+t[6]*e+t[10]*r+t[14]]}function Jo(t){let n=t[0],e=t[4],r=t[8],o=t[1],a=t[5],i=t[9],s=t[2],l=t[6],c=t[10],f=a*c-i*l,m=i*s-o*c,u=o*l-a*s,h=n*f+e*m+r*u;if(Math.abs(h)<1e-12)return null;let b=1/h;return[f*b,m*b,u*b,(r*l-e*c)*b,(n*c-r*s)*b,(e*s-n*l)*b,(e*i-r*a)*b,(r*o-n*i)*b,(n*a-e*o)*b]}function Se(t,n,e,r){let o=t[0]*n+t[1]*e+t[2]*r,a=t[3]*n+t[4]*e+t[5]*r,i=t[6]*n+t[7]*e+t[8]*r,s=Math.hypot(o,a,i)||1;return o/=s,a/=s,i/=s,[o,a,i]}function Qo(t){if(t.byteLength<20||t.byteLength>8388608)return null;let n=new DataView(t.buffer,t.byteOffset,t.byteLength);if(n.getUint32(0,!0)!==1179937895||n.getUint32(4,!0)!==2||n.getUint32(8,!0)!==t.byteLength)return null;let e=12,r=null,o=null;for(;e+8<=t.byteLength;){let a=n.getUint32(e,!0),i=n.getUint32(e+4,!0);if(e+=8,a%4!==0||e+a>t.byteLength)return null;let s=t.subarray(e,e+a);if(i===1313821514&&!r)try{let l=JSON.parse(new TextDecoder().decode(s).replace(/[\u0000 ]+$/g,""));if(!Q(l))return null;r=l}catch{return null}else if(i===5130562&&!o)o=s;else return null;e+=a}return e===t.byteLength&&r&&o?{json:r,bin:o}:null}function tr(t){return t===5120||t===5121?1:t===5122||t===5123?2:t===5125||t===5126?4:0}function nr(t){return t==="SCALAR"?1:t==="VEC2"?2:t==="VEC3"?3:t==="VEC4"?4:0}function er(t,n,e){return e===5120?t.getInt8(n):e===5121?t.getUint8(n):e===5122?t.getInt16(n,!0):e===5123?t.getUint16(n,!0):e===5125?t.getUint32(n,!0):t.getFloat32(n,!0)}function or(t){let n=t instanceof Uint8Array?t:new Uint8Array(t),e=Qo(n);if(!e)return{ok:!1,issue:"invalid_glb"};let{json:r,bin:o}=e;if(!Q(r.asset)||r.asset.version!=="2.0")return{ok:!1,issue:"unsupported_glb"};let a=J(r.extensionsUsed).filter(A=>typeof A=="string");if(a.includes("KHR_draco_mesh_compression")||zo(r))return{ok:!1,issue:"draco_not_allowed"};if(a.length||J(r.extensionsRequired).length)return{ok:!1,issue:"unsupported_glb"};if(J(r.images).length||J(r.textures).length)return{ok:!1,issue:"external_resource"};let i=J(r.buffers);if(i.length!==1||!Q(i[0])||i[0].uri!==void 0||typeof i[0].byteLength!="number"||!Number.isInteger(i[0].byteLength)||i[0].byteLength<0||i[0].byteLength>o.byteLength)return{ok:!1,issue:"external_resource"};let s=J(r.accessors),l=J(r.bufferViews),c=J(r.meshes),f=J(r.nodes),m=J(r.scenes),u=typeof r.scene=="number"?r.scene:0;if(!Q(m[u]))return{ok:!1,issue:"unsupported_glb"};let h=new DataView(o.buffer,o.byteOffset,o.byteLength),b=(A,E,M)=>{if(typeof A!="number"||!Number.isInteger(A)||!Q(s[A]))return null;let I=s[A];if(I.type!==E||I.sparse!==void 0||I.normalized===!0||typeof I.count!="number"||!Number.isInteger(I.count)||I.count<1||typeof I.componentType!="number"||!M.includes(I.componentType)||typeof I.bufferView!="number")return null;let B=l[I.bufferView];if(!Q(B)||B.buffer!==0||typeof B.byteLength!="number"||!Number.isInteger(B.byteLength)||B.byteLength<0)return null;let k=nr(I.type),D=tr(I.componentType),U=typeof B.byteStride=="number"?B.byteStride:k*D,S=typeof B.byteOffset=="number"?B.byteOffset:0,_=typeof I.byteOffset=="number"?I.byteOffset:0,N=S+_,O=_+(I.count-1)*U+k*D;if(!Number.isInteger(U)||!Number.isInteger(S)||!Number.isInteger(_)||U<k*D||S<0||_<0||S+B.byteLength>o.byteLength||O>B.byteLength)return null;let P=[];for(let F=0;F<I.count;F++){let R=[];for(let T=0;T<k;T++){let C=er(h,N+F*U+T*D,I.componentType);if(!Number.isFinite(C))return null;R.push(C)}P.push(R)}return P},p=[],d=[],y=0,x=new Set,w=(A,E)=>{if(typeof A!="number"||!Number.isInteger(A)||!Q(f[A])||x.has(A))return!1;x.add(A);let M=f[A],I=$o(M);if(!I)return!1;let B=Ko(E,I),k=Jo(B);if(!k)return!1;if(M.mesh!==void 0){if(typeof M.mesh!="number")return!1;let D=c[M.mesh];if(!Q(D))return!1;for(let U of J(D.primitives)){if(!Q(U)||U.mode!==void 0&&U.mode!==4||!Q(U.attributes))return!1;let S=b(U.attributes.POSITION,"VEC3",[5126]),_=U.attributes.NORMAL===void 0?null:b(U.attributes.NORMAL,"VEC3",[5126]);if(!S||U.attributes.NORMAL!==void 0&&!_)return!1;let N=S.length;if(U.indices!==void 0){let P=typeof U.indices=="number"?s[U.indices]:null;N=Q(P)?P.count:void 0}if(typeof N!="number"||!Number.isInteger(N)||N%3!==0||(y+=N/3,y>1e5))return!1;let O=U.indices===void 0?S.map((P,F)=>[F]):b(U.indices,"SCALAR",[5121,5123,5125]);if(!O||O.length%3!==0||O.length!==N)return!1;for(let P=0;P<O.length;P+=3){let F=[O[P][0],O[P+1][0],O[P+2][0]];if(F.some(C=>!Number.isInteger(C)||C<0||C>=S.length))return!1;let R=F.map(C=>qo(B,...S[C])),T=null;if(!_){let C=R[1][0]-R[0][0],v=R[1][1]-R[0][1],G=R[1][2]-R[0][2],X=R[2][0]-R[0][0],L=R[2][1]-R[0][1],Y=R[2][2]-R[0][2];T=Se([1,0,0,0,1,0,0,0,1],v*Y-G*L,G*X-C*Y,C*L-v*X)}for(let C=0;C<3;C++)p.push(...R[C]),d.push(..._?Se(k,..._[F[C]]):T)}}}for(let D of J(M.children))if(!w(D,B))return!1;return x.delete(A),!0};for(let A of J(m[u].nodes))if(!w(A,Zo()))return{ok:!1,issue:y>1e5?"triangle_limit":"unsupported_glb"};return!y||p.length!==y*9||d.length!==p.length?{ok:!1,issue:"unsupported_glb"}:{ok:!0,triangleCount:y,position:new Float32Array(p),normal:new Float32Array(d)}}function Re(t){try{return or(t)}catch{return{ok:!1,issue:"invalid_glb"}}}function As(t){let{doc:n}=t,e=ue(n.theme),r=e.structure,o=Zn(n,t.eventConfigurationId??n.eventConfigurationId),a=Me(t.eventConfigurationId,t.eventConfiguration,o),i=t.seats,s=new Yt,l=null;if(t.registeredShellGlb){let P=Re(t.registeredShellGlb);if(P.ok){let F=P.position.length/3,R=new Float32Array(P.position.length),T=e.materials.shell??r.tierWall;for(let C=0;C<F;C++){let v=P.normal[C*3+1],G=v<-.25?.4:.62+.38*Math.max(0,v);R[C*3]=T[0]*G,R[C*3+1]=T[1]*G,R[C*3+2]=T[2]*G}l={position:P.position,normal:P.normal,color:R,floor:new Float32Array(F).fill(-2),material:new Float32Array(F),count:F}}}let c=new Map;for(let P of o)for(let F of P.objects)c.set(F.id,P.index),F.type==="section"&&c.set(F.logicalSectionId??F.id,P.index);let f=i.map(P=>c.get(P.sectionId??"")??c.get(P.rowId??"")??0),m=mn(o,i);ye(s,o,i,f,m,r);let u=vn(n,i),h=new Map,b=new Map;for(let P of n.categories??[])h.set(P.key,P.color),P.seatGlyph&&b.set(P.key,P.seatGlyph);let p=[],d=fe(o,i,f),y=new Float32Array(i.length),x=[];for(let P=0;P<o.length;P++){let F=o[P];s.setFloor(P);let R=new zt,T=[],C=F.objects.filter(v=>v.type==="section"&&!!v.outline&&v.outline.length>=3);for(let v of F.objects)if(v.type==="section"){let G=s.vertexCount;be(s,v,F,kn(v,u),d.bySection.get(v.id),R,C,r);let X=s.vertexCount-G;X>0&&x.push({sectionId:v.id,start:G,count:X})}else if(v.type==="shape"){let G=a.byObjectId.get(v.id);s.setMaterial((G?.kind??v.role)==="screen"?1:0),ee(s,v,F.baseHeightM,qn(v,T),r,F.focal,p,G),s.setMaterial(0)}else v.type==="gaArea"?re(s,v,F.baseHeightM,H(h.get(v.categoryKey)),r):v.type==="booth"?te(s,v,F.baseHeightM,H(h.get(v.categoryKey)),r):v.type==="table"?ne(s,v,F.baseHeightM,H(v.fill??n.theme?.decorFill??"#232c40"),r):v.type==="decorImage"&&oe(s,v,F.baseHeightM,r);pe(s,F,i,d,r,e.materials.shell,!l)}let w=o.length>1?{x:o.reduce((P,F)=>P+F.focal.x,0)/o.length,y:o.reduce((P,F)=>P+F.focal.y,0)/o.length}:n.focalPoint??{x:(m.minX+m.maxX)/2,y:(m.minY+m.maxY)/2},A=Tn(l?[s.build(),l]:[s.build()]),E=Fn(i,t.initialState,d,y,h,b),M=se({doc:n,units:o,seats:i,surfaces:d,focal:w}),{labels:I,sections:B,rows:k}=ae({doc:n,units:o,seats:i,surfaces:d,seatData:E,hintedSeatFloor:f,zones:M,focal:w}),D=de({doc:n,units:o,seats:i,surfaces:d,solids:A,hintedSeatFloor:f,seatFloor:y});ce(I,D),E.iYaw=Cn(E.iPosition,i.length,P=>i[P].rowId,P=>{let F=o[y[P]]?.focal??w;return[F.x*g,F.y*g]});let U=(m.minX+m.maxX)/2*g,S=(m.minY+m.maxY)/2*g,_=.5*Math.hypot((m.maxX-m.minX)*g,(m.maxY-m.minY)*g)||10,N=xe(A,E,{cx:U,cz:S,radius:_}),O=ge(E,p,m,N.minY,N.maxY,_);return{solids:A,sectionSolidRanges:x,seats:E,bounds:{center:[(O.min[0]+O.max[0])/2,(O.min[1]+O.max[1])/2,(O.min[2]+O.max[2])/2],radius:_,groundY:0,box:O},renderBounds:{center:N.center,radius:N.radius},stateColorLUT:le(e,Bt),theme:e,seatCount:i.length,focalWorld:[w.x*g,1.5,w.y*g],zones:M,stages:p,productionElements:a.elements,sections:B,rows:k,labels:I,floors:D}}export{Bt as a,Qt as b,mr as c,nn as d,g as e,hr as f,Ge as g,Ne as h,br as i,Vt as j,Ar as k,Pr as l,_r as m,Tr as n,Br as o,Er as p,Cr as q,Fr as r,vr as s,kr as t,Or as u,Lr as v,Bo as w,As as x};
@@ -1 +0,0 @@
1
- var i=24,l=16,h=.14,r=[{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}}],s=r.map(e=>e.key),a=new Map(r.map(e=>[e.key,e]));function L(e){return a.get(e)??a.get("circle")}function p(e){return L(e).label}function o(e){return L(e).path}function u(e,t){return{scale:t*2*(1-.14)/Math.max(e.width,e.height),centreX:e.x+e.width/2,centreY:e.y+e.height/2}}function n(e){return typeof e=="string"&&a.has(e)}function d(e,t){return n(e)?e:n(t?.seatGlyph)?t.seatGlyph:"circle"}export{i as a,l as b,h as c,r as d,s as e,L as f,p as g,o as h,u as i,n as j,d as k};
@@ -1 +0,0 @@
1
- import{f as A}from"./chunk-4I2VWFJY.js";import{c as p,k as T,n as x,t as M}from"./chunk-JBOTRSMY.js";var R=7,y=10,G=10,H=15,P=11,v=.85,b=12,u=4.5,w=3,I=3,o="#000000",i="#ffffff",Z=24,O=18.67;function F(t,n=400){return t>=Z||n>=700&&t>=O?I:u}function X(t,n){return t*n>=b}var K=24,m={wheelchair:"M7.8 4.5a2.2 2.2 0 1 0 4.4 0a2.2 2.2 0 1 0 -4.4 0zM8 7L10.5 7L10.5 15L8 15ZM8 12.5L18 12.5L18 15L8 15ZM16 15L18 15L18 18L16 18ZM5.5 16a5.5 5.5 0 1 0 11 0a5.5 5.5 0 1 0 -11 0zM8 16a3 3 0 1 1 6 0a3 3 0 1 1 -6 0z",companion:"M5.5 6.5a3 3 0 1 0 6 0a3 3 0 1 0 -6 0zM4.5 18.5L6 11.5L11 11.5L12.5 18.5ZM12.5 7.5a3 3 0 1 0 6 0a3 3 0 1 0 -6 0zM11.5 19L13 12.5L18 12.5L19.5 19Z","semi-ambulatory":"M8.3 3.8a2.2 2.2 0 1 0 4.4 0a2.2 2.2 0 1 0 -4.4 0zM9 6.2L12 6.6L11 13.5L8.6 13L9 6.2ZM8.6 13L11 13L9.5 21L7 21ZM10.4 13L12.6 13L13.6 21L11.2 21ZM11.2 7.2L14 8L14.6 9.6L11.9 8.9ZM14.4 6.8L15.9 6.8L16.4 21L14.8 21Z","designated-aisle":"M3 5L6 5L6 14L3 14ZM3 12L13 12L13 15L3 15ZM5 15L7 15L7 20L5 20ZM11 15L13 15L13 20L11 20ZM13 7L20 7L17 4L19 4L23 8.5L19 13L17 13L20 10L13 10Z","step-free":"M4 4.5a2.2 2.2 0 1 0 4.4 0a2.2 2.2 0 1 0 -4.4 0zM4.4 7L7.5 7L7.5 13L11 15L9.5 17L5 14L4.4 7ZM2 19L8 19L17 10L22 10L22 13L18 13L10 21L2 21Z",hearing:"M15.5 3.5C9 2.2 5.5 6 5.5 11.5C5.5 16 8 19.5 10.5 21C13.2 22.6 16.4 20.8 15.4 18C14.8 16.4 12.9 16.1 13 14C13.1 11.9 15.8 11.4 15.8 8.5C15.8 5.4 13 4 15.5 3.5Z",cart:"M5.5 6L18.5 6a2.5 2.5 0 0 1 2.5 2.5L21 15.5a2.5 2.5 0 0 1 -2.5 2.5L11 18L7 20.5L7.5 18L5.5 18a2.5 2.5 0 0 1 -2.5 -2.5L3 8.5a2.5 2.5 0 0 1 2.5 -2.5zM6.5 11L17.5 11L17.5 12.6L6.5 12.6zM6.5 14L17.5 14L17.5 15.6L6.5 15.6z","sign-language":"M7 11L17 11L17 18a2 2 0 0 1 -2 2L9 20a2 2 0 0 1 -2 -2zM7.6 5L9.4 5L9.4 12L7.6 12zM9.9 3.5L11.7 3.5L11.7 12L9.9 12zM12.3 3.5L14.1 3.5L14.1 12L12.3 12zM14.6 5L16.4 5L16.4 12L14.6 12zM7.2 12.5L5 10.2L6.4 8.9L8.6 11.2Z","low-vision":"M2.5 12C6 6 18 6 21.5 12C18 18 6 18 2.5 12ZM9 12a3 3 0 1 0 6 0a3 3 0 1 0 -6 0zM17.5 3L19 3L19 6L17.5 6ZM19 4L22 4L22 5.5L19 5.5Z","sensory-friendly":"M4 11C4 5 7 2.5 12 2.5S20 5 20 11L17 11C17 7 15.5 5.5 12 5.5S7 7 7 11ZM3 10L8 10L8 19L5 19a2 2 0 0 1 -2 -2ZM16 10L21 10L21 17a2 2 0 0 1 -2 2L16 19ZM9 12L15 12L15 14L9 14ZM10 16L14 16L14 18L10 18Z","plus-size":"M9.4 4.3a2.6 2.6 0 1 0 5.2 0a2.6 2.6 0 1 0 -5.2 0zM5 20L4 13C4 10.5 7 9.5 12 9.5C17 9.5 20 10.5 20 13L19 20Z","lift-armrest":"M5 6L8 6L8 19L5 19zM5 16L18 16L18 19L5 19zM8 12L17 12L17 14.5L8 14.5zM14 7L16 7L16 12L14 12zM12 7L18 7L15 3Z"},Y=m.wheelchair;function D(t){if(!t?.length)return null;let n=t.includes("wheelchair")?"wheelchair":t[0];return m[n]??null}function U(t,n){return n.colorblind?S(n.canvasBackground):A(t)}function V(t){return/-(\d{1,5})$/.exec(t)?.[1]??t}var s=x;function $(t,n,r){let L=p(t),a=p(n);if(!L||!a)return n;let e=Math.max(0,Math.min(1,r));return`#${L.map((c,_)=>Math.round(c*e+a[_]*(1-e))).map(c=>c.toString(16).padStart(2,"0")).join("")}`}var W=3;function j(t){let n=s(i,t)??0,r=s(o,t)??0;return n>=u?i:r>=u&&M(t)||M(t)?o:i}function S(t){return M(t)?o:i}function E(t,n,r=u){let L=s(n,t);if(L!=null&&L>=r)return n;let a=s(o,t)??0,e=s(i,t)??0;return a===0&&e===0?n:a>=e?o:i}function Q(t,n,r,L=u){return n??E(t,r,L)}var d=3;function q(t){let n=s("#ffffff",t);if(n!=null&&n>=d)return"#ffffff";let r=s(o,t)??0,L=s(i,t)??0;return r===0&&L===0?"#ffffff":r>=L?o:i}var C=/^#[0-9a-f]{6}$/i;function h(t){let n=p(t);return n!=null&&T(n)>.5}var B="#e5e7eb",k="#273142";function J(t){return h(t)?B:k}function t1(t,n,r=u){let L=C.test(t.trim()),a=t.trim().toLowerCase(),e=0,l=0,c=null;for(let f of n){if(!L||!C.test(f.trim()))continue;e+=1;let g=E(f,t,r);g.toLowerCase()!==a&&(l+=1,c=g)}return{total:e,overridden:l,status:e===0?"none":l===0?"applies":l===e?"overridden":"mixed",overrideInk:c}}export{R as a,y as b,G as c,H as d,P as e,v as f,b as g,u as h,w as i,I as j,o as k,i as l,F as m,X as n,K as o,m as p,Y as q,D as r,U as s,V as t,s as u,$ as v,W as w,j as x,S as y,E as z,Q as A,q as B,h as C,B as D,k as E,J as F,t1 as G};