@seatlayer/core 0.53.0 → 0.54.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/categoryInventory-B4xo7hE2.d.ts +109 -0
- package/dist/categoryInventory-lRtu3VjD.d.cts +109 -0
- package/dist/chunk-3QLFGEQY.js +1 -0
- package/dist/chunk-55NOSZK5.js +1 -0
- package/dist/chunk-6LIPQU4G.js +1 -0
- package/dist/chunk-6VTTBC5F.js +1 -0
- package/dist/chunk-7PT7OQUO.js +1 -0
- package/dist/chunk-AQKYUJBX.js +1 -0
- package/dist/chunk-CXF32VPG.js +1 -0
- package/dist/chunk-DDE7IOFT.js +1 -0
- package/dist/chunk-EQM4FFN5.js +1 -0
- package/dist/chunk-EYROIZGQ.js +1 -0
- package/dist/chunk-QUKWJQLR.js +1 -0
- package/dist/chunk-VDZ24QVV.js +1 -0
- package/dist/core/chart-ops/index.cjs +1 -0
- package/dist/core/chart-ops/index.d.cts +1235 -0
- package/dist/core/chart-ops/index.d.ts +1235 -0
- package/dist/core/chart-ops/index.js +1 -0
- package/dist/core/color.cjs +1 -0
- package/dist/core/color.d.cts +192 -0
- package/dist/core/color.d.ts +192 -0
- package/dist/core/color.js +1 -0
- package/dist/core/inventory/index.cjs +1 -0
- package/dist/core/inventory/index.d.cts +209 -0
- package/dist/core/inventory/index.d.ts +209 -0
- package/dist/core/inventory/index.js +1 -0
- package/dist/core/layout/index.cjs +1 -0
- package/dist/core/layout/index.d.cts +376 -0
- package/dist/core/layout/index.d.ts +376 -0
- package/dist/core/layout/index.js +1 -0
- package/dist/core/quality/index.cjs +1 -0
- package/dist/core/quality/index.d.cts +132 -0
- package/dist/core/quality/index.d.ts +132 -0
- package/dist/core/quality/index.js +1 -0
- package/dist/core/render-assets/index.cjs +1 -0
- package/dist/core/render-assets/index.d.cts +99 -0
- package/dist/core/render-assets/index.d.ts +99 -0
- package/dist/core/render-assets/index.js +1 -0
- package/dist/core/seatConfidence.cjs +1 -1
- package/dist/core/seatConfidence.d.cts +1 -1
- package/dist/core/seatConfidence.d.ts +1 -1
- package/dist/core/seatConfidence.js +1 -1
- package/dist/core/sections/index.cjs +1 -0
- package/dist/core/sections/index.d.cts +346 -0
- package/dist/core/sections/index.d.ts +346 -0
- package/dist/core/sections/index.js +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +39 -533
- package/dist/index.d.ts +39 -533
- package/dist/index.js +1 -1
- package/dist/labeling-CsPt1mC_.d.cts +90 -0
- package/dist/labeling-w8bl86cb.d.ts +90 -0
- package/dist/layout-B5UYbwnv.d.ts +181 -0
- package/dist/layout-YFmuxw_M.d.cts +181 -0
- package/dist/renderedQuality-CugJarFp.d.cts +113 -0
- package/dist/renderedQuality-DbZM034G.d.ts +113 -0
- package/dist/renderer-DhUHFtsI.d.cts +531 -0
- package/dist/renderer-IBi9YKWR.d.ts +531 -0
- package/dist/sections-B7cDF0Nq.d.cts +123 -0
- package/dist/sections-mLOZrGrI.d.ts +123 -0
- package/dist/segmentedRowModel-BPTnJ7Tz.d.ts +75 -0
- package/dist/segmentedRowModel-CGoH684F.d.cts +75 -0
- package/dist/ticketRestrictions-BwAebpSK.d.cts +72 -0
- package/dist/ticketRestrictions-ChHJwvTq.d.ts +72 -0
- package/dist/{types-tLOunI-B.d.cts → types-COfJorq_.d.cts} +233 -757
- package/dist/{types-tLOunI-B.d.ts → types-COfJorq_.d.ts} +233 -757
- package/dist/view3d/crossfade/panorama.d.cts +1 -1
- package/dist/view3d/crossfade/panorama.d.ts +1 -1
- package/dist/view3d/index.cjs +25 -25
- package/dist/view3d/index.d.cts +2 -1
- package/dist/view3d/index.d.ts +2 -1
- package/dist/view3d/index.js +27 -27
- package/package.json +94 -5
- package/dist/chunk-54A7LIL5.js +0 -1
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Colour — the ONE home for hex parsing, WCAG luminance/contrast, and the
|
|
3
|
+
* lighten / darken / mix / desaturate operations every surface re-implemented.
|
|
4
|
+
*
|
|
5
|
+
* Twelve-plus private copies existed (`lib/contrast.ts`, `core/chartQuality`,
|
|
6
|
+
* `core/chartRenderRules`, `engine/SeatmapRenderer` ×4, `view3d/palette`,
|
|
7
|
+
* `view3d/labelOverlay`, `picker/widget/SeatPicker`, `view/generatePanorama`,
|
|
8
|
+
* designer `scene/primitives` ×3, `settings/BrandingCard`, inspector `ThemeTab`,
|
|
9
|
+
* `workers/api/ticketArtifacts`). The full implementation of `src/lib/contrast.ts`
|
|
10
|
+
* moved here verbatim; that file is now a re-export shim so its ~15 importers
|
|
11
|
+
* (and the palette AA tests) are untouched.
|
|
12
|
+
*
|
|
13
|
+
* ## Two representations, never silently mixed
|
|
14
|
+
* The tree uses 0–255 integer channels (Konva, canvas, hex round-trips) and
|
|
15
|
+
* 0–1 float channels (WebGL/OGL vertex colours). There is no lossy "one true"
|
|
16
|
+
* parser here: {@link hexToRgb255} and {@link hexToRgb01} are separate, and the
|
|
17
|
+
* operations that only make sense on one of them say so in their names.
|
|
18
|
+
*
|
|
19
|
+
* ## One luminance, one luma — they are different things
|
|
20
|
+
* - {@link relativeLuminance} is WCAG 2.1: sRGB channels are LINEARISED
|
|
21
|
+
* (gamma ~2.4) before weighting. This is the only thing a contrast ratio may
|
|
22
|
+
* be computed from.
|
|
23
|
+
* - {@link colorLuma} is the cheap Rec.709 weighted average of the RAW
|
|
24
|
+
* channels — no gamma. `SeatmapRenderer.isLightColor` and `view3d/palette`
|
|
25
|
+
* use it as a brightness heuristic. It is NOT interchangeable with the
|
|
26
|
+
* above and must never feed a contrast ratio.
|
|
27
|
+
*
|
|
28
|
+
* Pure: no DOM, no imports. Workers, the SDK mirror and the browser read this.
|
|
29
|
+
*/
|
|
30
|
+
/** Strict `#rrggbb`. The predicate `lib/contrast` has always exported. */
|
|
31
|
+
declare function isHexColor(value: unknown): value is string;
|
|
32
|
+
interface Rgb {
|
|
33
|
+
r: number;
|
|
34
|
+
g: number;
|
|
35
|
+
b: number;
|
|
36
|
+
}
|
|
37
|
+
/** 0–255 channels as a tuple — the shape the renderer's helpers pass around. */
|
|
38
|
+
type Rgb255 = [number, number, number];
|
|
39
|
+
/** 0–1 channels as a tuple — the shape WebGL/OGL vertex colours want. */
|
|
40
|
+
type Rgb01 = [number, number, number];
|
|
41
|
+
/**
|
|
42
|
+
* Strict `#rrggbb` → `{ r, g, b }` (0–255).
|
|
43
|
+
*
|
|
44
|
+
* Kept EXACTLY as `lib/contrast.hexToRgb` was, including its failure mode:
|
|
45
|
+
* anything else yields `NaN` channels rather than `null`, and its callers
|
|
46
|
+
* (`relativeLuminance`, `judgeAccent`) guard with {@link isHexColor} first.
|
|
47
|
+
* New code should prefer {@link hexToRgb255}.
|
|
48
|
+
*/
|
|
49
|
+
declare function hexToRgb(hex: string): Rgb;
|
|
50
|
+
/** Tolerant `#rgb` / `#rrggbb` (leading `#` optional) → 0–255; `null` on anything else. */
|
|
51
|
+
declare function hexToRgb255(hex: string | undefined | null): Rgb255 | null;
|
|
52
|
+
/** Tolerant `#rgb` / `#rrggbb` → 0–1 channels; `null` on anything else. */
|
|
53
|
+
declare function hexToRgb01(hex: string | undefined | null): Rgb01 | null;
|
|
54
|
+
/** `{ r, g, b }` (0–255) → `#rrggbb`; channels are rounded and clamped. */
|
|
55
|
+
declare function rgbToHex({ r, g, b }: Rgb): string;
|
|
56
|
+
/** Loose-channel form of {@link rgbToHex} (0–255 in, `#rrggbb` out). */
|
|
57
|
+
declare function rgb255ToHex(r: number, g: number, b: number): string;
|
|
58
|
+
/** 0–1 channels → `#rrggbb`. */
|
|
59
|
+
declare function rgb01ToHex(rgb: Rgb01): string;
|
|
60
|
+
/**
|
|
61
|
+
* Normalise an OPAQUE CSS colour to lower-case `#rrggbb`; `null` for anything
|
|
62
|
+
* that is not opaque or not one of the supported forms (`#rgb`, `#rrggbb`,
|
|
63
|
+
* `rgb()`, fully-opaque `rgba()`).
|
|
64
|
+
*
|
|
65
|
+
* Verbatim from `SeatmapRenderer` — buyer-surface quality evidence depends on
|
|
66
|
+
* a translucent paint being REFUSED rather than silently flattened.
|
|
67
|
+
*/
|
|
68
|
+
declare function opaqueColorHex(color: string): string | null;
|
|
69
|
+
/** WCAG relative luminance of a strict `#rrggbb`. `NaN` for an invalid hex. */
|
|
70
|
+
declare function relativeLuminance(hex: string): number;
|
|
71
|
+
/** WCAG relative luminance from 0–255 channels. */
|
|
72
|
+
declare function relativeLuminance255(rgb: Rgb255): number;
|
|
73
|
+
/** WCAG relative luminance from 0–1 channels. */
|
|
74
|
+
declare function relativeLuminance01(rgb: Rgb01): number;
|
|
75
|
+
/** WCAG contrast ratio, 1…21. Order-independent. Strict `#rrggbb` in. */
|
|
76
|
+
declare function contrastRatio(a: string, b: string): number;
|
|
77
|
+
/**
|
|
78
|
+
* Tolerant contrast ratio: accepts `#rgb` too and returns `null` — not `NaN` —
|
|
79
|
+
* when either side is unparseable. The `chartQuality` / `chartRenderRules` /
|
|
80
|
+
* `ThemeTab` semantic, where an unreadable token must not be reported as a
|
|
81
|
+
* failing ratio.
|
|
82
|
+
*/
|
|
83
|
+
declare function contrastRatioOrNull(a: string, b: string): number | null;
|
|
84
|
+
/** AA for body text. */
|
|
85
|
+
declare const AA_TEXT = 4.5;
|
|
86
|
+
/** AA for large text and UI components — what an accent is actually used for. */
|
|
87
|
+
declare const AA_LARGE = 3;
|
|
88
|
+
declare function passes(fg: string, bg: string, floor: number): boolean;
|
|
89
|
+
/**
|
|
90
|
+
* Rec.709 luma (0–1) of a CSS colour — NO gamma linearisation. Supports `#rgb`,
|
|
91
|
+
* `#rrggbb` and `rgb()`/`rgba()`. Returns `NaN` for anything else (gradients,
|
|
92
|
+
* `''`), which callers must treat as "unknown → assume dark".
|
|
93
|
+
*
|
|
94
|
+
* Never feed this to a contrast ratio; see the file header.
|
|
95
|
+
*/
|
|
96
|
+
declare function colorLuma(color: string): number;
|
|
97
|
+
/** Rec.709 luma of 0–1 channels — the `view3d/palette` weights. */
|
|
98
|
+
declare function luma01(rgb: Rgb01): number;
|
|
99
|
+
/**
|
|
100
|
+
* Light enough that white UI accents lose contrast against it.
|
|
101
|
+
* `threshold` is the renderer's 0.6 on {@link colorLuma}. Unparseable ⇒ false
|
|
102
|
+
* (assume dark), which preserves the dark defaults.
|
|
103
|
+
*/
|
|
104
|
+
declare function isLightColor(color: string, threshold?: number): boolean;
|
|
105
|
+
/** Mix a `#rrggbb` toward white by `amount` (0…1). Non-hex passes through. */
|
|
106
|
+
declare function lighten(hex: string, amount: number): string;
|
|
107
|
+
/** Mix a `#rrggbb` toward black by `amount` (0…1). Non-hex passes through. */
|
|
108
|
+
declare function darken(hex: string, amount: number): string;
|
|
109
|
+
/**
|
|
110
|
+
* Linear interpolation between two `#rrggbb` colours (`t` 0…1).
|
|
111
|
+
* Passes `a` through unchanged if EITHER side is unparseable — the renderer's
|
|
112
|
+
* behaviour, so a bad theme token degrades to the base colour rather than to
|
|
113
|
+
* black.
|
|
114
|
+
*/
|
|
115
|
+
declare function lerpColor(a: string, b: string, t: number): string;
|
|
116
|
+
/**
|
|
117
|
+
* Count-weighted blend of several `#rrggbb` colours — a section reads as its
|
|
118
|
+
* price makeup, not one flat colour. Unparseable or non-positive-weight parts
|
|
119
|
+
* are skipped; `fallback` is returned when nothing contributes.
|
|
120
|
+
*/
|
|
121
|
+
declare function mixColors(parts: readonly {
|
|
122
|
+
hex: string;
|
|
123
|
+
w: number;
|
|
124
|
+
}[], fallback: string): string;
|
|
125
|
+
/** Mix two 0–1 colours: `a·(1−t) + b·t`. The `view3d/palette.mix` semantic. */
|
|
126
|
+
declare function mixRgb01(a: Rgb01, b: Rgb01, t: number): Rgb01;
|
|
127
|
+
/**
|
|
128
|
+
* Drain saturation toward the colour's own Rec.709 luma by `amount`
|
|
129
|
+
* (0 = unchanged, 1 = grey). Brightness survives; hue does not.
|
|
130
|
+
*
|
|
131
|
+
* MIGRATION NOTE: `SeatmapRenderer.desaturate` used Rec.**601** weights
|
|
132
|
+
* (0.299/0.587/0.114); `view3d/palette.desaturate` used Rec.709. Rec.709 is the
|
|
133
|
+
* one kept, matching the audit's "pick one" call. The renderer's muted
|
|
134
|
+
* sold-out seats therefore shift by a few units on saturated greens and reds —
|
|
135
|
+
* a deliberate, visible-in-principle change to note in the migration commit,
|
|
136
|
+
* not a bug.
|
|
137
|
+
*/
|
|
138
|
+
declare function desaturate(hex: string, amount: number): string;
|
|
139
|
+
/** 0–1 form of {@link desaturate} — what the 3D upholstery tone needs. */
|
|
140
|
+
declare function desaturateRgb01(rgb: Rgb01, amount: number): Rgb01;
|
|
141
|
+
/**
|
|
142
|
+
* `#rrggbb` → `rgba(r,g,b,a)`. A NON-hex value passes through unchanged, which
|
|
143
|
+
* is what lets a host hand the widget any CSS colour it likes: the colour
|
|
144
|
+
* simply misses out on alpha compositing rather than breaking the paint.
|
|
145
|
+
*/
|
|
146
|
+
declare function withAlpha(hex: string, alpha: number): string;
|
|
147
|
+
/** Alias of {@link withAlpha} — the name the renderer and designer both use. */
|
|
148
|
+
declare const rgba: typeof withAlpha;
|
|
149
|
+
/** sRGB (0–255) → HSL, so a shade can move in lightness without changing hue. */
|
|
150
|
+
declare function rgbToHsl({ r, g, b }: Rgb): {
|
|
151
|
+
h: number;
|
|
152
|
+
s: number;
|
|
153
|
+
l: number;
|
|
154
|
+
};
|
|
155
|
+
/**
|
|
156
|
+
* HSL → sRGB (0–255). `h`, `s`, `l` are all 0–1 — note the HUE UNIT: this is
|
|
157
|
+
* turns, not degrees. `view/generatePanorama.hslToRgb` takes DEGREES and a
|
|
158
|
+
* different (chroma-based) formulation; that one stays where it is until its
|
|
159
|
+
* call sites are migrated deliberately.
|
|
160
|
+
*/
|
|
161
|
+
declare function hslToRgb(h: number, s: number, l: number): Rgb;
|
|
162
|
+
interface AccentVerdict {
|
|
163
|
+
/** The colour as given. */
|
|
164
|
+
requested: string;
|
|
165
|
+
ratio: number;
|
|
166
|
+
ok: boolean;
|
|
167
|
+
/**
|
|
168
|
+
* The nearest shade of the SAME HUE that clears the floor, or `null` when the
|
|
169
|
+
* hue cannot clear it at any lightness (a mid-grey on a mid-grey ground). The
|
|
170
|
+
* editor offers this; it never applies it silently.
|
|
171
|
+
*/
|
|
172
|
+
suggestion: string | null;
|
|
173
|
+
suggestionRatio: number;
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* Judge an org accent against a template's ground.
|
|
177
|
+
*
|
|
178
|
+
* The search walks lightness in both directions from the requested colour and
|
|
179
|
+
* takes the FIRST passing step, which is what makes it "nearest": an organizer
|
|
180
|
+
* whose brand red is one notch too dark gets their red back one notch lighter,
|
|
181
|
+
* not a colour picked for contrast alone. Hue and saturation are untouched —
|
|
182
|
+
* moving them would hand back a different brand.
|
|
183
|
+
*/
|
|
184
|
+
declare function judgeAccent(requested: string, ground: string, floor?: number): AccentVerdict;
|
|
185
|
+
/**
|
|
186
|
+
* The ink to print ON a colour: whichever of the palette's two extremes reads
|
|
187
|
+
* better. Used when an accent override replaces a palette's designed accent and
|
|
188
|
+
* its designed `accentInk` no longer belongs to it.
|
|
189
|
+
*/
|
|
190
|
+
declare function inkFor(background: string, dark: string, light: string): string;
|
|
191
|
+
|
|
192
|
+
export { AA_LARGE, AA_TEXT, type AccentVerdict, type Rgb, type Rgb01, type Rgb255, colorLuma, contrastRatio, contrastRatioOrNull, darken, desaturate, desaturateRgb01, hexToRgb, hexToRgb01, hexToRgb255, hslToRgb, inkFor, isHexColor, isLightColor, judgeAccent, lerpColor, lighten, luma01, mixColors, mixRgb01, opaqueColorHex, passes, relativeLuminance, relativeLuminance01, relativeLuminance255, rgb01ToHex, rgb255ToHex, rgbToHex, rgbToHsl, rgba, withAlpha };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{A,B,C,D,E,F,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z}from"../chunk-CXF32VPG.js";export{o as AA_LARGE,n as AA_TEXT,q as colorLuma,l as contrastRatio,m as contrastRatioOrNull,u as darken,y as desaturate,z as desaturateRgb01,b as hexToRgb,d as hexToRgb01,c as hexToRgb255,D as hslToRgb,F as inkFor,a as isHexColor,s as isLightColor,E as judgeAccent,v as lerpColor,t as lighten,r as luma01,w as mixColors,x as mixRgb01,h as opaqueColorHex,p as passes,i as relativeLuminance,k as relativeLuminance01,j as relativeLuminance255,g as rgb01ToHex,f as rgb255ToHex,e as rgbToHex,C as rgbToHsl,B as rgba,A as withAlpha};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var Re=Object.defineProperty;var jn=Object.getOwnPropertyDescriptor;var _n=Object.getOwnPropertyNames;var Nn=Object.prototype.hasOwnProperty;var $n=(e,t)=>{for(var n in t)Re(e,n,{get:t[n],enumerable:!0})},Fn=(e,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of _n(t))!Nn.call(e,r)&&r!==n&&Re(e,r,{get:()=>t[r],enumerable:!(o=jn(t,r))||o.enumerable});return e};var Dn=e=>Fn(Re({},"__esModule",{value:!0}),e);var Mr={};$n(Mr,{CATEGORY_INVENTORY_FAMILIES:()=>Oe,GroupedTableProjectionError:()=>ie,MAX_DIRECT_ROW_SWEEP:()=>fa,MAX_EVENT_INVENTORY:()=>Pe,MAX_GA_CAPACITY:()=>X,MAX_ROW_BLOCK_ROWS:()=>dt,MAX_ROW_SEATS:()=>da,MIN_ROW_BLOCK_ROWS:()=>ut,MIN_ROW_SEATS:()=>ua,applicableTicketTiers:()=>Ir,capacityControl:()=>Pn,categoryCapacity:()=>gr,chartCapacity:()=>ct,companionSelectionIssue:()=>Tn,describeCategoryInventoryConflict:()=>tt,effectiveSeatOwnerCategoryCounts:()=>ge,gaAreasOf:()=>mo,gaInventorySegments:()=>Ye,gaUnitLabel:()=>$t,gaUnitLabels:()=>We,groupedTableInventory:()=>vr,growJoinedGAInventory:()=>po,inspectCategoryInventoryConflicts:()=>fe,intactRowBlockMembers:()=>yr,isGaUnitLabel:()=>de,pickBestAvailable:()=>mt,pickBestAvailableInventory:()=>Bn,remediateCategoryInventoryConflicts:()=>nt,resizeChartCapacity:()=>pr,resolveRowBlockCount:()=>br,resolveRowTerminalCapacity:()=>hr,resolveTicketTierForSeat:()=>ft,rowBlockEdgePoint:()=>lt,rowBlockPreviewRows:()=>En,rowTerminalEndpoint:()=>kn,rowWithTerminalCapacity:()=>On,strandedSingles:()=>mr,ticketOptionNotApplicableIssue:()=>Ln,ticketSelectionIssue:()=>Cr,ticketTierAppliesToSeat:()=>Te,validGAInventorySegments:()=>Ee});module.exports=Dn(Mr);function je(e,t){if(Number.isInteger(e.logicalSeatIndex))return e.logicalSeatIndex;let n=e.id.lastIndexOf(":");if(n<0)return t;let o=Number(e.id.slice(n+1));return Number.isFinite(o)?o:t}function ye(e,t){let n=e.x-t.x,o=e.y-t.y;return n*n+o*o}function gt(e){let t=0,n=0;for(let o of e)t+=o.x,n+=o.y;return{x:t/e.length,y:n/e.length}}function pt(e,t){return e.find(n=>n.focalPoint)?.focalPoint??t}function _e(e){return e.commercial?.premium===!0}function mt(e,t,n){let o=Math.floor(n.qty);if(!Number.isFinite(o)||o<=0)return{labels:[],reason:"sold_out"};let{categoryKey:r,zoneId:i,focal:s,preferPremium:l}=n,g=new Map,f=[];if(e.forEach((u,h)=>{let C=t.has(u.label)&&(!r||u.categoryKey===r)&&(!i||u.zoneId===i),b=u.logicalRowId??u.rowId,y=g.get(b);y||(y=[],g.set(b,y)),y.push({seat:u,index:je(u,h),elig:C}),C&&f.push(u)}),f.length===0)return{labels:[],reason:"sold_out"};let c=null,d=u=>{if(!c)return!0;if(l&&u.nonPremium!==c.nonPremium)return u.nonPremium<c.nonPremium;if(u.orphan!==c.orphan)return u.orphan<c.orphan;if(u.d2!==c.d2)return u.d2<c.d2;let h=u.rowId.localeCompare(c.rowId);return h!==0?h<0:u.startIndex<c.startIndex};for(let[u,h]of g){let C=[...h].sort((y,S)=>y.index-S.index),b=0;for(;b<C.length;){if(!C[b].elig){b++;continue}let y=b;for(;y<C.length&&C[y].elig&&(y===b||C[y].index===C[y-1].index+1);)y++;let S=y-b;for(let v=0;v+o<=S;v++){let w=v,k=S-(v+o),O=w===1||k===1?1:0,T=C.slice(b+v,b+v+o).map(E=>E.seat),a={labels:T.map(E=>E.label),seats:T,rowId:u,startIndex:C[b+v].index,orphan:O,nonPremium:l?T.reduce((E,p)=>E+(_e(p)?0:1),0):0,d2:ye(gt(T),pt(T,s))};d(a)&&(c=a)}b=y}}return c?{labels:c.labels}:f.length<o?{labels:[],reason:"not_enough_together"}:{labels:f.map((u,h)=>({seat:u,i:h,d2:ye(u,u.focalPoint??s)})).sort((u,h)=>{if(l){let b=_e(u.seat)?0:1,y=_e(h.seat)?0:1;if(b!==y)return b-y}if(u.d2!==h.d2)return u.d2-h.d2;let C=(u.seat.logicalRowId??u.seat.rowId).localeCompare(h.seat.logicalRowId??h.seat.rowId);return C!==0?C:je(u.seat,u.i)-je(h.seat,h.i)}).slice(0,o).map(u=>u.seat.label)}}function Bn(e,t,n,o){let r=Math.floor(o.qty),i=mt(e,n,o),l=t.filter(d=>d.bookingMode==="whole"&&d.capacity===r&&n.has(d.label)&&(!o.categoryKey||d.categoryKey===o.categoryKey)&&(!o.zoneId||d.zoneId===o.zoneId)).map(d=>({table:d,d2:ye(d.center,d.focalPoint??o.focal)})).sort((d,m)=>d.d2-m.d2||d.table.label.localeCompare(m.table.label))[0];if(!l)return i;if(!i.labels.length)return{labels:[l.table.label]};let g=new Map(e.map(d=>[d.label,d])),f=i.labels.map(d=>g.get(d)).filter(d=>!!d),c=f.length?ye(gt(f),pt(f,o.focal)):Number.POSITIVE_INFINITY;return l.d2<c?{labels:[l.table.label]}:i}var bt=e=>Math.max(1,e.fontSize*.6+(e.letterSpacing??0));function Kn(e,t){let n=e.text.split(/\r?\n/);if(!e.width)return Math.max(1,n.length);let o=Math.max(1,Math.floor(t/bt(e))),r=0;for(let i of n){if(!i.length){r+=1;continue}let s=0;for(let l of i.split(/\s+/)){let g=l.length;s&&s+1+g<=o?s+=1+g:(r+=Math.max(1,Math.ceil(g/o)),s=g%o)}}return Math.max(1,r)}function yt(e){let t=e.background?.padding??0,n=e.text.split(/\r?\n/),o=Math.max(1,...n.map(l=>l.length))*bt(e),r=e.width??o+t*2,i=Math.max(1,r-t*2),s=Kn(e,i);return{width:r,height:s*e.fontSize*(e.lineHeight??1.2)+t*2,lineCount:s,padding:t}}var Gn=Math.PI/180;function D(e,t){return Math.hypot(e.x-t.x,e.y-t.y)}function zn(e,t,n){let o=Math.cos(n),r=Math.sin(n),i=e.x-t.x,s=e.y-t.y;return{x:t.x+i*o-s*r,y:t.y+i*r+s*o}}function ht(e,t){return zn(e,{x:0,y:0},t*Gn)}function ae(e){let t=0,n=0;for(let r of e)t+=r.x,n+=r.y;let o=e.length||1;return{x:t/o,y:n/o}}function xt(e,t){let n=1-t,o=n*n*n,r=3*n*n*t,i=3*n*t*t,s=t*t*t;return{x:o*e.start.x+r*e.control1.x+i*e.control2.x+s*e.end.x,y:o*e.start.y+r*e.control1.y+i*e.control2.y+s*e.end.y}}function vt(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[xt(e,.5)];let o=Array.from({length:n+1},(g,f)=>xt(e,f/n)),r=new Float64Array(o.length);for(let g=1;g<o.length;g+=1){let f=o[g].x-o[g-1].x,c=o[g].y-o[g-1].y;r[g]=r[g-1]+Math.hypot(f,c)}let i=r[r.length-1];if(i<=1e-9)return Array.from({length:t},()=>({...e.start}));let s=[],l=1;for(let g=0;g<t;g+=1){let f=i*g/(t-1);for(;l<r.length-1&&r[l]<f;)l+=1;let c=r[l-1],d=r[l],m=d===c?0:(f-c)/(d-c);s.push({x:o[l-1].x+(o[l].x-o[l-1].x)*m,y:o[l-1].y+(o[l].y-o[l-1].y)*m})}return s}function U(e,t,n){return Math.max(t,Math.min(n,e))}var q=Math.PI*2;function se(e){return Number.isFinite(e.x)&&Number.isFinite(e.y)}function Un(e,t,n){let o=t-e;if(n){for(;o<0;)o+=q;for(;o>=q;)o-=q}else{for(;o>0;)o-=q;for(;o<=-q;)o+=q}return o}function Ne(e){if(e.version!==1||e.closed!==!0||!se(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||!se(n.end))return!1;if(n.kind==="line"){if(D(t,n.end)<=1e-9)return!1}else if(n.kind==="bezier"){if(!se(n.control1)||!se(n.control2)||D(t,n.end)<=1e-9)return!1}else if(n.kind==="arc"){if(!se(n.center)||!Number.isFinite(n.radius)||n.radius<=1e-6||Math.abs(D(t,n.center)-n.radius)>Math.max(1e-4,n.radius*1e-4)||Math.abs(D(n.end,n.center)-n.radius)>Math.max(1e-4,n.radius*1e-4)||D(t,n.end)<=1e-9)return!1}else return!1;t=n.end}return D(t,e.start)<=1e-4}function Hn(e,t,n){let o=1-n;return{x:o**3*e.x+3*o**2*n*t.control1.x+3*o*n**2*t.control2.x+n**3*t.end.x,y:o**3*e.y+3*o**2*n*t.control1.y+3*o*n**2*t.control2.y+n**3*t.end.y}}function It(e,t=2){if(!Ne(e))throw new Error("Section outline path is invalid");let n=Math.max(.25,t),o=[{...e.start}],r=e.start;for(let i of e.segments){if(i.kind==="line")o.push({...i.end});else if(i.kind==="arc"){let s=Math.atan2(r.y-i.center.y,r.x-i.center.x),l=Math.atan2(i.end.y-i.center.y,i.end.x-i.center.x),g=Un(s,l,i.clockwise),f=Math.max(2,Math.ceil(Math.abs(g)*i.radius/n));for(let c=1;c<=f;c+=1){let d=s+g*c/f;o.push({x:i.center.x+Math.cos(d)*i.radius,y:i.center.y+Math.sin(d)*i.radius})}}else{let s=D(r,i.control1)+D(i.control1,i.control2)+D(i.control2,i.end),l=Math.max(2,Math.ceil(s/n));for(let g=1;g<=l;g+=1)o.push(Hn(r,i,g/l))}r=i.end}return D(o[o.length-1],o[0])<=1e-4&&o.pop(),o}var jr=4/3;function St(e){let t=new Map,n=new Map;for(let o of e){if(o.type!=="row"||!o.segmentedRow)continue;let r=n.get(o.segmentedRow.groupId)??[];r.push(o),n.set(o.segmentedRow.groupId,r)}for(let[o,r]of n){let i=r.slice().sort((m,u)=>m.segmentedRow.componentIndex-u.segmentedRow.componentIndex),s=i[0]?.segmentedRow?.componentCount??0,l=i[0]?.segmentedRow;if(!l||!(s>=2&&i.length===s&&l?.boundaryBefore==="start"&&i.every((m,u)=>m.segmentedRow?.kind==="segmented-row-v1"&&m.segmentedRow.groupId===o&&m.segmentedRow.componentCount===s&&m.segmentedRow.componentIndex===u&&m.segmentedRow.repeatLabelOnComponents===l.repeatLabelOnComponents&&(u===0?m.segmentedRow.boundaryBefore==="start":m.segmentedRow.boundaryBefore!=="start")&&m.segmentedRow.displayLabel===l.displayLabel)))continue;let f=i.reduce((m,u)=>m+u.seatCount,0),c=0,d=0;for(let m of i)m.segmentedRow.boundaryBefore==="break"&&(c+=1),t.set(m.id,{groupId:o,adjacencyOffset:c,displayOffset:d,displayLabel:l.displayLabel,totalSeats:f,canonical:i[0],viewFromSeatUrl:l.viewFromSeatUrl,viewFromSeatMeta:l.viewFromSeatMeta,confidenceEvidence:l.confidenceEvidence}),c+=m.seatCount,d+=m.seatCount}return t}var Vn="ABCDEFGHIJKLMNOPQRSTUVWXYZ";var Xn="abcdefghijklmnopqrstuvwxyz";function Yn(e,t){let n=t.length,o=e+1,r="";for(;o>0;){o-=1;let i=o%n;r=t[i]+r,o=Math.floor(o/n)}return r}function $e(e,t=!1){let n=t?Xn:Vn;return Yn(Math.max(0,Math.floor(e)-1),n)}var Wn=[[1e3,"M"],[900,"CM"],[500,"D"],[400,"CD"],[100,"C"],[90,"XC"],[50,"L"],[40,"XL"],[10,"X"],[9,"IX"],[5,"V"],[4,"IV"],[1,"I"]];function wt(e){if(!Number.isFinite(e)||e<=0)return String(e);let t=Math.floor(e),n="";for(let[o,r]of Wn)for(;t>=o;)n+=r,t-=o;return n}function qn(e){let t=new Array(e);return Array.from({length:e},(n,o)=>o).sort((n,o)=>Math.abs(2*n-(e-1))-Math.abs(2*o-(e-1))||n-o).forEach((n,o)=>t[n]=o),t}function Fe(e,t){let n=e.seatLabelStart??1,o=e.seatNumbering?.direction??"ltr",r=e.seatNumbering?.step??1,i=e.seatNumbering?.scheme??"decimal",s=e.seatNumbering?.prefix??"",l=e.seatNumbering?.endAt,g=e.seatCount;if(i==="updown"||i==="updown-descending"){let u=Math.ceil(g/2),h=i==="updown"?t<u?n+2*t:n-1+2*(g-t):t<u?n+2*(u-1-t):n+1+2*(t-u);return`${s}${h}`}let f=i==="odd"||i==="even"?2:r,c=l!=null&&Number.isFinite(l)?l-(g-1)*f:n,d=o==="center"?qn(g)[t]:o==="rtl"?g-1-t:t,m;switch(i){case"odd":{let u=c%2===1?c:c+1;m=String(u+d*2);break}case"even":{let u=c%2===0?c:c+1;m=String(u+d*2);break}case"roman":m=wt(c+d*r);break;case"letters-upper":m=$e(c+d*r,!1);break;case"letters-lower":m=$e(c+d*r,!0);break;default:m=String(c+d*r);break}return`${s}${m}`}function Zn(e){return{...e.canonical,seatCount:e.totalSeats,label:e.displayLabel,displayLabel:e.displayLabel}}function he(e,t,n){return n?.label??`${e.label}-${Fe(e,t)}`}function De(e,t,n,o){if(o?.displayLabel)return o.displayLabel;if(!n)return`${e.displayLabel??e.label}-${Fe(e,t)}`;let r=Zn(n),i=n.displayOffset+t;return`${n.displayLabel}-${Fe(r,i)}`}var xe=.02291666666666667,Br=1/xe,Qn=58,Ct=Qn*xe,Ke=0,Z=3,H=0,G=120,ve=0,Ie=45,Ge=7,Se=1.2;function Be(e,t,n,o){return Number.isFinite(e)?Math.max(t,Math.min(n,e)):o}function Jn(e){return!Number.isFinite(e)||!Number.isInteger(e)||e<0?0:e<=Ge?e:Z}function ce(e,t={}){let n=Be(t.floorBaseHeightM,H,G,0),o=Math.min(G,n+Jn(e.elevation)*Ct),r=e.height===void 0?o:Be(e.height,H,G,o),i=Be(e.rake,ve,Ie,0);return{height:r,rake:i}}function Mt(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 Pt(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 o=1/0;for(let r=0;r+1<e.length;r++){let i=e[r],s=e[r+1],l=s.x-i.x,g=s.y-i.y,f=l*l+g*g,c=f>1e-12?((t-i.x)*l+(n-i.y)*g)/f:0;c<0?c=0:c>1&&(c=1);let d=Math.hypot(t-(i.x+c*l),n-(i.y+c*g));d<o&&(o=d)}return o}function eo(e){let t=0,n=0;for(let i of e)t+=i.x,n+=i.y;let o=e.length||1;t/=o,n/=o;let r=0;for(let i of e){let s=Math.hypot(i.x-t,i.y-n);s>r&&(r=s)}return{cx:t,cy:n,r}}function Et(e,t){return Math.hypot(e.cx-t.cx,e.cy-t.cy)-e.r-t.r}function ze(e,t){let n=1/0;for(let o of Mt(e)){let r=Pt(t,o.x,o.y);r<n&&(n=r)}for(let o of Mt(t)){let r=Pt(e,o.x,o.y);r<n&&(n=r)}return n}function to(e,t){if(e.length<3)return{pts:e,seatIndices:t};let n=0,o=0;for(let c of e)n+=c.x,o+=c.y;n/=e.length,o/=e.length;let r=-1,i=e[0];for(let c of e){let d=Math.hypot(c.x-n,c.y-o);d>r&&(r=d,i=c)}let s=i.x-n,l=i.y-o,g=Math.hypot(s,l);g>1e-9?(s/=g,l/=g):(s=1,l=0);let f=e.map((c,d)=>({p:c,i:d,t:(c.x-n)*s+(c.y-o)*l})).sort((c,d)=>c.t-d.t);return{pts:f.map(c=>c.p),seatIndices:f.map(c=>t[c.i])}}function no(e){let t=e.length;if(t<3)return null;let n=0,o=0;for(let S of e)n+=S.x,o+=S.y;n/=t,o/=t;let r=0,i=0,s=0,l=0,g=0,f=0,c=0;for(let S of e){let v=S.x-n,w=S.y-o;r+=v*v,s+=w*w,i+=v*w,l+=v*v*v,g+=w*w*w,f+=v*w*w,c+=w*v*v}let d=r*s-i*i;if(Math.abs(d)<1e-9)return null;let m=(l+f)/2,u=(g+c)/2,h=(m*s-u*i)/d,C=(u*r-m*i)/d,b=h+n,y=C+o;return!Number.isFinite(b)||!Number.isFinite(y)?null:{cx:b,cy:y}}var oo=.15;function ro(e){if(e.length<2)return null;let t=e.map(S=>{let v=0,w=0;for(let k of S.pts)v+=k.x,w+=k.y;return{x:v/S.pts.length,y:w/S.pts.length}}),n=0,o=0;for(let S of t)n+=S.x,o+=S.y;n/=t.length,o/=t.length;let r=0,i=0,s=0;for(let S of t){let v=S.x-n,w=S.y-o;r+=v*v,i+=v*w,s+=w*w}let l=r+s,g=r*s-i*i,f=l/2+Math.sqrt(Math.max(0,l*l/4-g)),c,d;Math.abs(i)>1e-12?(c=f-s,d=i):r>=s?(c=1,d=0):(c=0,d=1);let m=Math.hypot(c,d);if(!(m>1e-12))return null;c/=m,d/=m;let u=1/0,h=-1/0,C=[];for(let S of e){let v=1/0,w=-1/0;for(let k of S.pts){let O=k.x*c+k.y*d;O<v&&(v=O),O>w&&(w=O),O<u&&(u=O),O>h&&(h=O)}C.push(w-v)}let b=h-u;return b>1e-9?(C.sort((S,v)=>S-v),C[Math.min(C.length-1,Math.floor(C.length*.9))]/b<=io?{x:c,y:d}:null):null}var io=.35;function Ot(e,t,n,o){let r=new Map;for(let b of n){let y=t[b],S=y.rowId||`__seat-${b}`,v=r.get(S);v||(v={pts:[],idx:[]},r.set(S,v)),v.pts.push({x:y.x,y:y.y}),v.idx.push(b)}if(!r.size)return{sectionId:e,rows:[],blockCount:0};let i=[];for(let[b,y]of r){let S=to(y.pts,y.idx),v=0;for(let w of S.pts)v+=Math.hypot(w.x-o.x,w.y-o.y);i.push({id:b,pts:S.pts,seatIndices:S.seatIndices,blockId:-1,ordinal:0,blockDepth:0,focalDistance:v/S.pts.length})}let s=i.map(b=>eo(b.pts)),l=[];for(let b=0;b<i.length;b++){let y=1/0;for(let S=0;S<i.length;S++){if(b===S||Et(s[b],s[S])>=y)continue;let v=ze(i[b].pts,i[S].pts);v<y&&(y=v)}Number.isFinite(y)&&l.push(y)}l.sort((b,y)=>b-y);let g=l.length?l[Math.floor(l.length/2)]:1,f=Math.max(g*1.8,1e-6),c=i.map(()=>[]);for(let b=0;b<i.length;b++)for(let y=b+1;y<i.length;y++)Et(s[b],s[y])>f||ze(i[b].pts,i[y].pts)<=f&&(c[b].push(y),c[y].push(b));let d=0;for(let b=0;b<i.length;b++){if(i[b].blockId!==-1)continue;let y=d++,S=[b];for(i[b].blockId=y;S.length;){let v=S.pop();for(let w of c[v])i[w].blockId===-1&&(i[w].blockId=y,S.push(w))}}let m=new Map;for(let b of i){let y=m.get(b.blockId)??[];y.push(b),m.set(b.blockId,y)}let u=[];for(let b of i){if(b.pts.length<4)continue;let y=no(b.pts);y&&(!Number.isFinite(y.cx)||!Number.isFinite(y.cy)||u.push({x:y.cx,y:y.cy}))}let h=u.length>=2?(()=>{let b=u.map(v=>v.x).sort((v,w)=>v-w),y=u.map(v=>v.y).sort((v,w)=>v-w),S=Math.floor(u.length/2);return{cx:b[S],cy:y[S]}})():null;if(h){let b=O=>Math.hypot(O.x-h.cx,O.y-h.cy),y=1/0,S=-1/0,v=[];for(let O of i){let T=1/0,a=-1/0;for(let E of O.pts){let p=b(E);p<T&&(T=p),p>a&&(a=p)}v.push(a-T),T<y&&(y=T),a>S&&(S=a)}let w=S-y;v.sort((O,T)=>O-T);let k=v[Math.min(v.length-1,Math.floor(v.length*.9))];if(w>1e-9&&k/w<=oo){let O=i.map(x=>{let P=0;for(let M of x.pts)P+=b(M);return{row:x,radius:P/x.pts.length}}),T=1/0;for(let x of O)x.radius<T&&(T=x.radius);O.sort((x,P)=>x.radius-P.radius);let a=-1,E=-1/0,p=w/Math.max(1,O.length)*.5,I=[];for(let x of O)x.radius-E>p&&(a++,E=x.radius),x.row.ordinal=a,x.row.blockDepth=x.radius-T,I.push(x.row);return{sectionId:e,rows:I,blockCount:d}}}let C=[];for(let[,b]of m){let y=ro(b);if(y){let S=w=>{let k=0;for(let O of w.pts)k+=O.x*y.x+O.y*y.y;return k/w.pts.length};b.sort((w,k)=>S(w)-S(k));let v=0;for(let w=0;w<b.length;w++)w>0&&(v+=ze(b[w-1].pts,b[w].pts)),b[w].ordinal=w,b[w].blockDepth=v,C.push(b[w])}else{let S=1/0;for(let v of b)v.focalDistance<S&&(S=v.focalDistance);b.sort((v,w)=>v.focalDistance-w.focalDistance);for(let v=0;v<b.length;v++)b[v].ordinal=v,b[v].blockDepth=Math.max(0,b[v].focalDistance-S),C.push(b[v])}}return{sectionId:e,rows:C,blockCount:d}}function Rt(e){return e?e.accessibility&&e.accessibility.length?e.wheelchairSpaceType&&!e.accessibility.includes("wheelchair")?["wheelchair",...e.accessibility]:e.accessibility:e.wheelchairSpaceType?["wheelchair"]:e.accessible?["wheelchair"]:[]:[]}var we=Math.PI/180;var le=16;function He(e,t,n,o){let r=n*we,i=Math.cos(r),s=Math.sin(r);return{x:o.x+e*i-t*s,y:o.y+e*s+t*i}}function ao(e){let{seatCount:t,seatSpacing:n,curve:o,rotation:r,origin:i}=e,s=[];if(e.path)return vt(e.path,t);if(t<=1)return t===1&&s.push({x:i.x,y:i.y}),s;if(o===0){for(let f=0;f<t;f++)s.push(He(f*n,0,r,i));return s}let l=o/(t-1)*we,g=n/(2*Math.sin(Math.abs(l)/2));for(let f=0;f<t;f++){let c=f*l,d=g*Math.sin(c),m=-g+g*Math.cos(c);s.push(He(d,m,r,i))}return s}function so(e){let t=new Map;if(e.overrides)for(let n of e.overrides)t.set(n.index,n);return t}function Ce(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 co(e,t){let n=so(e);return ao(e).map((o,r)=>{let i=n.get(r),s=Rt(i),l=he(e,r,i),g={...e.commercial,...i?.commercial};return{index:r,x:o.x+(i?.dx??0),y:o.y+(i?.dy??0),label:l,displayLabel:De(e,r,t,i),categoryKey:i?.categoryKey??e.categoryKey,skipped:!!i?.skip,accessible:s.length>0,accessibility:s,wheelchairSpaceType:i?.wheelchairSpaceType,commercial:Object.values(g).some(f=>f!==void 0&&f!==!1&&f!=="")?g:void 0,viewUrl:i?.viewFromSeatUrl??e.viewFromSeatUrl,viewMeta:i?.viewFromSeatUrl?i.viewFromSeatMeta:e.viewFromSeatMeta,labelStyle:i?.labelStyle}})}function F(e){let t=[];for(let n of co(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,viewUrl:n.viewUrl,viewMeta:n.viewMeta,labelStyle:n.labelStyle});return t}function ue(e){if(e.seatCountsBySide)return{...e.seatCountsBySide};let t=e.sides&&e.sides.length?e.sides:["top","bottom"],n=["top","bottom","left","right"].filter(i=>t.includes(i)),o={top:0,bottom:0,left:0,right:0};if(!n.length)return o;let r=Math.max(0,Math.round(e.seatCount));for(let i=0;i<r;i++)o[n[i%n.length]]+=1;return o}function jt(e){let t=[],n=Math.max(0,Math.round(e.seatCount));if(n===0)return t;let o=new Map((e.overrides??[]).map(c=>[c.index,c])),r=(c,d,m,u)=>{let h=o.get(c),C=Rt(h),b=h?.label??`${e.label}-${c+1}`,y=e.displayLabel??e.label;return{index:c,label:b,displayLabel:h?.displayLabel??`${y}-${c+1}`,x:d+(h?.dx??0),y:m+(h?.dy??0),categoryKey:h?.categoryKey??e.categoryKey,skipped:!!h?.skip,accessible:C.length>0,accessibility:C,wheelchairSpaceType:h?.wheelchairSpaceType,commercial:h?.commercial,viewUrl:h?.viewFromSeatUrl,viewMeta:h?.viewFromSeatUrl?h.viewFromSeatMeta:void 0,labelStyle:h?.labelStyle,...u?{side:u}:{}}};if(e.shape==="round"){let c=(e.radius??40)+le,d=e.rotation*we,m=Math.max(0,Math.min(360,e.seatArc??360));if(m>=360||n===1){for(let b=0;b<n;b++){let y=d+b/n*2*Math.PI;t.push(r(b,e.center.x+c*Math.cos(y),e.center.y+c*Math.sin(y)))}return t}let u=m*we,h=(2*Math.PI-u)/2,C=d+h;for(let b=0;b<n;b++){let y=C+b/(n-1)*u;t.push(r(b,e.center.x+c*Math.cos(y),e.center.y+c*Math.sin(y)))}return t}let i=e.width??80,s=e.height??50,l=ue(e),g=["top","bottom","left","right"],f=0;for(let c of g){let d=l[c];for(let m=0;m<d;m++){let u,h;c==="top"?(u=-i/2+(m+.5)*i/d,h=-s/2-le):c==="bottom"?(u=-i/2+(m+.5)*i/d,h=s/2+le):c==="left"?(u=-i/2-le,h=-s/2+(m+.5)*s/d):(u=i/2+le,h=-s/2+(m+.5)*s/d);let C=He(u,h,e.rotation,e.center);t.push(r(f++,C.x,C.y,c))}}return t}function _t(e){return e.bookAsWhole||e.variableOccupancy?Math.max(0,Math.round(e.seatCount)):jt(e).filter(t=>!t.skipped).length}function B(e){return jt(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.viewUrl?{viewUrl:t.viewUrl}:{},...t.viewUrl&&t.viewMeta?{viewMeta:t.viewMeta}:{},...t.labelStyle?{labelStyle:t.labelStyle}:{}}))}function lo(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 kt(e,t){let n=!1;for(let o=0,r=t.length-1;o<t.length;r=o++){let i=t[o].x,s=t[o].y,l=t[r].x,g=t[r].y;s>e.y!=g>e.y&&e.x<(l-i)*(e.y-s)/(g-s)+i&&(n=!n)}return n}function uo(e,t){return t.some((n,o)=>{let r=t[(o+1)%t.length],i=(e.y-n.y)*(r.x-n.x)-(e.x-n.x)*(r.y-n.y);if(Math.abs(i)>1e-7)return!1;let s=(e.x-n.x)*(r.x-n.x)+(e.y-n.y)*(r.y-n.y),l=(r.x-n.x)**2+(r.y-n.y)**2;return s>=-1e-7&&s<=l+1e-7})}function V(e,t,n){return kt(e,t)&&!(n??[]).some(o=>kt(e,o)||uo(e,o))}function Ue(e){if(!e.length)return{x:0,y:0};let t=0,n=0;for(let o of e)t+=o.x,n+=o.y;return{x:t/e.length,y:n/e.length}}function Q(e){switch(e.type){case"row":{let t=F(e);if(!t.length)return{x:e.origin.x,y:e.origin.y};let n=0,o=0;for(let r of t)n+=r.x,o+=r.y;return{x:n/t.length,y:o/t.length}}case"table":case"booth":return{x:e.center.x,y:e.center.y};case"gaArea":return Ue(e.points);case"section":return Ue(e.outline);case"text":return{x:e.position.x,y:e.position.y};case"shape":return e.points&&e.points.length?Ue(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 At(e,t){return e.length===t.length&&e.every((n,o)=>n.x===t[o].x&&n.y===t[o].y)}function fo(e,t){if(e.type!=="gaArea"||!At(e.points,t.outline))return!1;let n=e.holes??[],o=t.holes??[];return n.length===o.length&&n.every((r,i)=>At(r,o[i]))}function go(e,t){let n=e.filter(s=>s.type==="section"),o="referenceInventorySource"in t?t.referenceInventorySource?.logicalSectionId:void 0,r=Q(t);return(o?n.find(s=>(s.logicalSectionId??s.id)===o&&(fo(t,s)||V(r,s.outline,s.holes))):void 0)??n.find(s=>V(r,s.outline,s.holes))}function Ve(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 Me(e){return e.floors&&e.floors.length?e.floors.flatMap(t=>t.objects):e.objects}function Lt(e,t,n,o,r,i){let s=[],l=St(e),g=d=>!d?.eventConfigurationId||d.eventConfigurationId===o,f=d=>!!d&&(!d.eventConfigurationId||d.eventConfigurationId===o),c=(d,m)=>f(d)?{...d,coverage:m}:void 0;for(let d of e){let m=[];if(d.type==="row"?m=F(d):d.type==="table"?m=B(d):d.type==="booth"&&(m=lo(d)),!m.length)continue;for(let y of m)y.viewUrl&&!g(y.viewMeta)&&(y.viewUrl=void 0,y.viewMeta=void 0);if(d.type==="row"){let y=l.get(d.id);if(y){let S=new Map((d.overrides??[]).map(v=>[v.index,v]));for(let v of m){let w=Number(v.id.slice(v.id.lastIndexOf(":")+1));if(!Number.isInteger(w))continue;v.logicalRowId=y.groupId,v.logicalSeatIndex=y.adjacencyOffset+w,S.get(w)?.displayLabel||(v.displayLabel=De(d,w,y)),!v.viewUrl&&y.viewFromSeatUrl&&g(y.viewFromSeatMeta)&&(v.viewUrl=y.viewFromSeatUrl,v.viewMeta=y.viewFromSeatMeta);let k=S.get(w)?.confidenceEvidence;v.confidenceEvidence=c(k,"exact-seat")??c(d.confidenceEvidence,"row-representative")??c(y.confidenceEvidence,"row-representative")}}}let u=go(e,d),h=u?.viewFromSeatUrl,b=(u?.zone?t?.find(y=>y.id===u.zone):void 0)?.focalPoint??n;for(let y of m){if(!y.confidenceEvidence){let S=Number(y.id.slice(y.id.lastIndexOf(":")+1)),v=(d.type==="row"||d.type==="table")&&Number.isInteger(S)?d.overrides?.find(w=>w.index===S)?.confidenceEvidence:void 0;y.confidenceEvidence=c(v,"exact-seat")??(d.type==="row"?c(d.confidenceEvidence,"row-representative"):void 0)}y.confidenceEvidence??=c(u?.confidenceEvidence,"section-representative")??(i?c(i.evidence,i.coverage):void 0),!y.viewUrl&&h&&g(u?.viewFromSeatMeta)&&(y.viewUrl=h,y.viewMeta=u?.viewFromSeatMeta),!y.viewUrl&&r&&g(r.meta)&&(y.viewUrl=r.url,y.viewMeta=r.meta),u&&(y.sectionId=u.logicalSectionId??u.id),u?.zone&&(y.zoneId=u.zone),b&&(y.focalPoint={...b})}s.push(...m)}return s}function Xe(e,t={}){if(e.floors?.length){let o=[];for(let r of e.floors){let i=r.focalPoint??e.focalPoint,s=r.viewFromSeatUrl?{url:r.viewFromSeatUrl,meta:r.viewFromSeatMeta}:e.viewFromSeatUrl?{url:e.viewFromSeatUrl,meta:e.viewFromSeatMeta}:void 0,l=r.confidenceEvidence?{evidence:r.confidenceEvidence,coverage:"floor-representative"}:e.confidenceEvidence?{evidence:e.confidenceEvidence,coverage:"venue-representative"}:void 0,g=Lt(r.objects,e.zones,i,e.eventConfigurationId,s,l);t.resolveEyeHeights!==!1&&Tt(r.objects,r.focalPoint??e.focalPoint,r.baseHeightM??0,g),o.push(...g)}return o}let n=Lt(e.objects,e.zones,e.focalPoint,e.eventConfigurationId,e.viewFromSeatUrl?{url:e.viewFromSeatUrl,meta:e.viewFromSeatMeta}:void 0,e.confidenceEvidence?{evidence:e.confidenceEvidence,coverage:"venue-representative"}:void 0);return t.resolveEyeHeights!==!1&&Tt(e.objects,e.focalPoint,t.floorBaseHeightM??0,n),n}function Tt(e,t,n,o){let r=e.filter(c=>c.type==="section"),i=n>0||r.some(c=>c.height!==void 0||c.rake!==void 0||(c.elevation??0)>0);if(!r.length||!i||!t){for(let c of o)c.eyeHeightM=n+Se;return}let s=new Array(o.length),l=new Map,g=new Map;for(let c=0;c<o.length;c++){let d=o[c],m=r.find(h=>V({x:d.x,y:d.y},h.outline,h.holes))??null;if(s[c]=m,!m)continue;l.has(m.id)||l.set(m.id,ce(m,{floorBaseHeightM:n}));let u=g.get(m.id);u?u.push(c):g.set(m.id,[c])}let f=new Array(o.length).fill(void 0);for(let[c,d]of g){let m=l.get(c);if(!m)continue;let u=m.rake>0?Math.tan(m.rake*Math.PI/180):0,h=Ot(c,o,d,t);for(let C of h.rows){let b=C.blockDepth*xe*u,y=m.height+b;for(let S of C.seatIndices)f[S]=y}}for(let c=0;c<o.length;c++){let d=o[c],m=s[c];if(!m){d.eyeHeightM=n+Se;continue}let u=l.get(m.id);d.eyeHeightM=(f[c]??u.height)+Se}}var Nt="__sl_ga__",X=1e5,Pe=1e5;function $t(e,t){return`${Nt}${encodeURIComponent(e)}__${t+1}`}function Ee(e){let t=e.inventorySegments;if(t===void 0)return!0;if(!Array.isArray(t)||t.length<1||t.length>256)return!1;let n=0,o=new Map;for(let r of t){if(!r||typeof r.sourceAreaId!="string"||!r.sourceAreaId.trim()||r.sourceAreaId.length>160||!Number.isInteger(r.startIndex)||r.startIndex<0||!Number.isInteger(r.count)||r.count<1||r.startIndex+r.count>X||(n+=r.count,n>X))return!1;let i=o.get(r.sourceAreaId)??[],s=r.startIndex+r.count;if(i.some(l=>r.startIndex<l.end&&s>l.start))return!1;i.push({start:r.startIndex,end:s}),o.set(r.sourceAreaId,i)}return n===e.capacity}function Ye(e){let t=Math.min(X,Math.max(0,Math.floor(e.capacity)));return e.inventorySegments===void 0?t?[{sourceAreaId:e.id,startIndex:0,count:t}]:[]:Ee(e)?e.inventorySegments.map(n=>({...n})):[]}function We(e){return Ye(e).flatMap(t=>Array.from({length:t.count},(n,o)=>$t(t.sourceAreaId,t.startIndex+o)))}function po(e,t){if(e.inventorySegments===void 0||t===e.capacity)return e.inventorySegments;if(t<e.capacity)return;let n=Ye(e);if(!n.length)return;let o=t-e.capacity;if(!o)return n;let i=n.filter(l=>l.sourceAreaId===e.id).reduce((l,g)=>Math.max(l,g.startIndex+g.count),0),s=n[n.length-1];if(s?.sourceAreaId===e.id&&s.startIndex+s.count===i)s.count+=o;else{if(n.length>=256)return;n.push({sourceAreaId:e.id,startIndex:i,count:o})}return n}function mo(e){return Me(e).filter(t=>t.type==="gaArea")}function de(e){return e.startsWith(Nt)}var bo=/^#?([\da-f]{3}|[\da-f]{6})$/i;function Y(e){let t=bo.exec((e??"").trim());if(!t)return null;let n=t[1].length===3?t[1].split("").map(r=>r+r).join(""):t[1],o=parseInt(n,16);return[o>>16&255,o>>8&255,o&255]}function qe(e){let t=e/255;return t<=.04045?t/12.92:((t+.055)/1.055)**2.4}function Ze(e){return .2126*qe(e[0])+.7152*qe(e[1])+.0722*qe(e[2])}function $(e,t){let n=Y(e),o=Y(t);if(!n||!o)return null;let r=Ze(n),i=Ze(o);return(Math.max(r,i)+.05)/(Math.min(r,i)+.05)}function yo(e){let t=1/0,n=1/0,o=-1/0,r=-1/0,i=!1;for(let s of e)!Number.isFinite(s.x)||!Number.isFinite(s.y)||(i=!0,s.x<t&&(t=s.x),s.y<n&&(n=s.y),s.x>o&&(o=s.x),s.y>r&&(r=s.y));return i?{minX:t,minY:n,maxX:o,maxY:r}:null}function Ft(e){let t=yo(e);return t?ho(t):null}function ho(e){return{x:e.minX,y:e.minY,width:e.maxX-e.minX,height:e.maxY-e.minY}}var Kt=7,Gt=10;var Je=.85,zt=12,Ut=4.5,xo=3,Dt="#000000",Bt="#ffffff",vo=24,Io=18.67;function Ht(e,t=400){return e>=vo||t>=700&&e>=Io?xo:Ut}var So={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",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","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"},ni=So.wheelchair;var Qe=$;function et(e,t,n){let o=Y(e),r=Y(t);if(!o||!r)return t;let i=Math.max(0,Math.min(1,n));return`#${o.map((l,g)=>Math.round(l*i+r[g]*(1-i))).map(l=>l.toString(16).padStart(2,"0")).join("")}`}function Vt(e,t,n=Ut){let o=Qe(t,e);if(o!=null&&o>=n)return t;let r=Qe(Dt,e)??0,i=Qe(Bt,e)??0;return r===0&&i===0?t:r>=i?Dt:Bt}var J=[{key:"wheelchair",label:"Wheelchair space",short:"Wheelchair",icon:"\u267F"},{key:"companion",label:"Companion seat",short:"Companion",icon:"\u{1F9D1}\u200D\u{1F91D}\u200D\u{1F9D1}"},{key:"semi-ambulatory",label:"Semi-ambulatory (limited mobility)",short:"Limited mobility",icon:"\u{1F9AF}"},{key:"hearing",label:"Assistive listening",short:"Hearing",icon:"\u{1F9BB}"},{key:"cart",label:"CART live-caption view",short:"CART captions",icon:"CC"},{key:"sign-language",label:"Sign-language view",short:"Sign language",icon:"\u{1F91F}"},{key:"plus-size",label:"Plus-size seat",short:"Plus-size",icon:"\u{1F4BA}"},{key:"lift-armrest",label:"Lift-up armrest",short:"Lift armrest",icon:"\u2195\uFE0F"}],ri=new Map(J.map(e=>[e.key,e]));var wo=[{key:"obstructedView",label:"Obstructed view",short:"Obstructed",icon:"\u26D4"},{key:"restrictedView",label:"Restricted view",short:"Restricted",icon:"\u{1F441}"},{key:"premium",label:"Premium seat",short:"Premium",icon:"\u2605"}],ii=new Map(wo.map(e=>[e.key,e]));var Co=["reference-focal","bar","entrance","exit","restroom","screen","sound","concession","coat","wall","rail","suite","obstruction"],ai=new Set(Co);function Mo(e){let t=0;for(let n=0,o=e.length;n<o;n+=1){let r=e[n],i=e[(n+1)%o];t+=r.x*i.y-i.x*r.y}return t/2}function ee(e){return Mo(e)*2}var Oe=[{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 Xt(e){return e.floors?.length?e.floors:[{id:"floor-0",objects:e.objects}]}function Po(e){return Oe.find(t=>t.key===e)}function ge(e){let t=new Map,n=Math.max(0,Math.floor(e.seatCount)),o=new Map((e.overrides??[]).filter(i=>Number.isInteger(i.index)&&i.index>=0&&i.index<e.seatCount).map(i=>[i.index,i])),r=(i,s=1)=>{i&&s>0&&t.set(i,(t.get(i)??0)+s)};r(e.categoryKey,n-o.size);for(let i of o.values())i.skip||r(i.categoryKey??e.categoryKey);return t}function Eo(e){return e.type==="row"||e.type==="table"?[...ge(e).keys()]:e.type==="booth"?e.categoryKey?[e.categoryKey]:[]:e.type==="gaArea"?e.capacity>0&&e.categoryKey?[e.categoryKey]:[]:[]}function Yt(e){return Oe.find(t=>t.objectType===e.type)??null}function Wt(e){return e.type==="row"||e.type==="table"||e.type==="booth"||e.type==="gaArea"}function fe(e){let t=new Map;for(let r of Xt(e))for(let i of r.objects){if(!Wt(i))continue;let s=Yt(i);for(let l of Eo(i)){let g=t.get(l)??new Map,f=g.get(s.key)??[];if(!f.some(c=>c.id===i.id)){let c=i.displayLabel||i.label||i.id;f.push({id:i.id,label:c,type:s.objectType,floorId:r.id})}g.set(s.key,f),t.set(l,g)}}let n=new Map(e.categories.map(r=>[r.key,r.label]));return[...e.categories.map(r=>r.key),...[...t.keys()].filter(r=>!n.has(r)).sort()].flatMap(r=>{let i=t.get(r);if(!i||i.size<2)return[];let s=Oe.flatMap(l=>{let g=i.get(l.key);return g?.length?[{family:l.key,label:l.label,objectType:l.objectType,targets:g}]:[]});return[{categoryKey:r,categoryLabel:n.get(r)??r,families:s,objectIds:[...new Set(s.flatMap(l=>l.targets.map(g=>g.id)))]}]})}function tt(e){let t=e.families.map(n=>`${n.label} (${n.targets.map(o=>o.label).join(", ")})`).join(" and ");return`Category \u201C${e.categoryLabel}\u201D is used by more than one kind of inventory \u2014 ${t}. 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 qt(e){return e.normalize("NFKC").trim().toLocaleLowerCase("en")}function Oo(e,t,n){for(let o=1;o<=1e4;o+=1){let r=o===1?`--${t}`:`--${t}-${o}`,s=`${e.slice(0,Math.max(1,160-r.length))}${r}`;if(!n.has(s))return n.add(s),s}throw new Error(`Unable to allocate a category key for ${e} (${t})`)}function ko(e,t,n){for(let o=1;o<=1e4;o+=1){let r=o===1?` (${t})`:` (${t} ${o})`,s=`${e.normalize("NFKC").trim().slice(0,Math.max(1,80-r.length)).trimEnd()}${r}`,l=qt(s);if(!n.has(l))return n.add(l),s}throw new Error(`Unable to allocate a category label for ${e} (${t})`)}function Ao(e,t,n,o){let r=Po(t);return{...structuredClone(e),key:Oo(e.key,r.suffix,n),label:ko(e.label,r.labelSuffix,o)}}function Lo(e,t,n){let o=[];for(let r of Xt(e))for(let i of r.objects){if(!Wt(i))continue;let s=Yt(i),l=n.get(s.key);if(!(!l||l===t))if(i.type==="row"||i.type==="table"){let g=[];i.categoryKey===t&&(i.categoryKey=l);for(let f of i.overrides??[])f.categoryKey===t&&(f.categoryKey=l,g.push(f.index));(i.categoryKey===l||g.length)&&o.push({family:s.key,floorId:r.id,objectId:i.id,objectType:s.objectType,fromCategoryKey:t,toCategoryKey:l,...g.length?{seatOverrideIndices:g.sort((f,c)=>f-c)}:{}})}else i.categoryKey===t&&(i.categoryKey=l,o.push({family:s.key,floorId:r.id,objectId:i.id,objectType:s.objectType,fromCategoryKey:t,toCategoryKey:l}))}return o}function nt(e){let t=structuredClone(e),n=fe(t);if(!n.length)return{doc:t,changed:!1,changes:[],before:n,after:n};let o=new Set(t.categories.map(l=>l.key)),r=new Set(t.categories.map(l=>qt(l.label))),i=[];for(let l of n){let g=t.categories.findIndex(h=>h.key===l.categoryKey);if(g<0)continue;let f=t.categories[g],c=l.families[0].family,d=new Map([[c,f.key]]),m=l.families.slice(1).map(h=>{let C=Ao(f,h.family,o,r);return d.set(h.family,C.key),{family:h.family,key:C.key,label:C.label,category:C}});t.categories.splice(g+1,0,...m.map(h=>h.category));let u=Lo(t,f.key,d);i.push({categoryKey:f.key,categoryLabel:f.label,retainedFamily:c,clones:m.map(({family:h,key:C,label:b})=>({family:h,key:C,label:b})),reassignments:u})}t.floors?.length&&(t.objects=t.floors[0].objects);let s=fe(t);return{doc:t,changed:i.length>0,changes:i,before:n,after:s}}function To(e,t){return Math.abs(e.x-t.x)<=1e-7&&Math.abs(e.y-t.y)<=1e-7}function pe(e,t,n){return(t.x-e.x)*(n.y-e.y)-(t.y-e.y)*(n.x-e.x)}function ke(e,t,n){let o=pe(t,n,e);return Math.abs(o)>1e-7?!1:e.x>=Math.min(t.x,n.x)-1e-7&&e.x<=Math.max(t.x,n.x)+1e-7&&e.y>=Math.min(t.y,n.y)-1e-7&&e.y<=Math.max(t.y,n.y)+1e-7}function Ro(e,t,n,o){let r=pe(e,t,n),i=pe(e,t,o),s=pe(n,o,e),l=pe(n,o,t);return(r>1e-7&&i<-1e-7||r<-1e-7&&i>1e-7)&&(s>1e-7&&l<-1e-7||s<-1e-7&&l>1e-7)?!0:Math.abs(r)<=1e-7&&ke(n,e,t)||Math.abs(i)<=1e-7&&ke(o,e,t)||Math.abs(s)<=1e-7&&ke(e,n,o)||Math.abs(l)<=1e-7&&ke(t,n,o)}function jo(e){return e.reduce((t,n,o)=>{let r=e[(o+1)%e.length];return t+n.x*r.y-r.x*n.y},0)}function _o(e){for(let t=0;t<e.length;t+=1){let n=(t+1)%e.length;for(let o=t+1;o<e.length;o+=1){let r=(o+1)%e.length;if(!(t===o||n===o||r===t)&&Ro(e[t],e[n],e[o],e[r]))return!0}}return!1}function Zt(e){return e.length<3?{ok:!1,code:"too_few_vertices",message:"Add at least three vertices to create a polygon."}:e.length>256?{ok:!1,code:"too_many_vertices",message:"A polygon can contain at most 256 vertices."}:e.some(t=>!Number.isFinite(t.x)||!Number.isFinite(t.y)||Math.abs(t.x)>1e7||Math.abs(t.y)>1e7)?{ok:!1,code:"invalid_coordinate",message:"Every polygon vertex must use a finite coordinate inside the safe chart range."}:e.some((t,n)=>To(t,e[(n+1)%e.length]))?{ok:!1,code:"duplicate_vertex",message:"Move or remove duplicate neighbouring vertices."}:Math.abs(jo(e))<2?{ok:!1,code:"degenerate_polygon",message:"The polygon needs a visible enclosed area."}:_o(e)?{ok:!1,code:"self_intersection",message:"Polygon edges cannot cross or touch each other."}:{ok:!0}}var Qt="M13 4.6a1.6 1.6 0 1 0-3.2 0 1.6 1.6 0 0 0 3.2 0 M11 6.5V13h5l2.4 6 M15 16.4A5 5 0 1 1 9 11.3",Jt=[{key:"restroom-men",label:"Men's restroom",group:"facilities",path:"M16 7a4 4 0 1 0-8 0 4 4 0 0 0 8 0 M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"},{key:"restroom-women",label:"Women's restroom",group:"facilities",path:"M15 5a3 3 0 1 0-6 0 3 3 0 0 0 6 0 M12 8l-4 10h8l-4-10 M10 18v4 M14 18v4"},{key:"restroom-accessible",label:"Accessible restroom",group:"facilities",path:Qt},{key:"first-aid",label:"First aid",group:"facilities",path:"M5 4h14a1 1 0 0 1 1 1v14a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1Z M12 8v8 M8 12h8"},{key:"coat-check",label:"Coat check",group:"facilities",path:"M12 6a2 2 0 0 1 0-4 2 2 0 0 1 1.6 3.2L21 13H3l8.4-7.8 M3 13h18"},{key:"atm",label:"ATM / cash",group:"facilities",path:"M2 6h20v12H2V6Z M15 12a3 3 0 1 1-6 0 3 3 0 0 1 6 0 M6 9h.01 M18 15h.01"},{key:"info",label:"Info point",group:"facilities",path:"M12 3a9 9 0 1 0 0 18 9 9 0 0 0 0-18 M12 11v5 M12 8h.01"},{key:"lost-found",label:"Lost & found",group:"facilities",path:"M11 4a7 7 0 1 0 0 14 7 7 0 0 0 0-14 M16 16l5 5 M9 8.5a2 2 0 1 1 3 1.7c-.8.5-1 .8-1 1.8 M11 15h.01"},{key:"restrooms",label:"Restrooms",group:"facilities",path:"M6 3h12a1 1 0 0 1 1 1v16a1 1 0 0 1-1 1H6a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1Z M12 8a2 2 0 1 0 0 4 2 2 0 0 0 0-4 M9 18v-3.5a3 3 0 0 1 6 0V18"},{key:"charging",label:"Charging point",group:"facilities",path:"M3 8h13v8H3V8Z M16 10h3v4h-3 M9.6 9l-2 3.5h2.5l-1.5 3"},{key:"smoking",label:"Smoking area",group:"facilities",path:"M2 15h13v3H2v-3Z M18 16h2 M19 8c0 1 1 1.5 1 2.5S19 12 19 13"},{key:"no-smoking",label:"No smoking",group:"facilities",path:"M12 3a9 9 0 1 0 0 18 9 9 0 0 0 0-18 M5.6 5.6l12.8 12.8 M7 13h6v2H7v-2Z"},{key:"food",label:"Food",group:"food-drink",path:"M7 3v6a2 2 0 0 0 4 0V3 M9 11v10 M17 3c-1.6 1-2.2 3-2.2 6 0 2 .9 3.2 2.2 3.6V21"},{key:"bar",label:"Bar",group:"food-drink",path:"M4 5h16l-8 8-8-8Z M12 13v6 M8 20h8"},{key:"coffee",label:"Caf\xE9 / coffee",group:"food-drink",path:"M4 8h13v4a5 5 0 0 1-5 5H9a5 5 0 0 1-5-5V8Z M17 9h2a2 2 0 0 1 0 4h-2 M8 2v2 M11 2v2 M4 21h14"},{key:"water",label:"Water / drinks",group:"food-drink",path:"M12 22a7 7 0 0 1-7-7c0-5 7-12 7-12s7 7 7 12a7 7 0 0 1-7 7Z"},{key:"merch",label:"Merch / shop",group:"food-drink",path:"M6 8h12l-1 12H7L6 8Z M9 8V6a3 3 0 0 1 6 0v2"},{key:"screen",label:"Screen",group:"facilities",path:"M3 4h18v12H3V4Z M9 20h6 M12 16v4 M10 8l4 2-4 2V8Z"},{key:"sound-booth",label:"Sound booth",group:"facilities",path:"M6 4v16 M6 14a2 2 0 1 0 0-4 2 2 0 0 0 0 4 M12 4v16 M12 8a2 2 0 1 0 0 4 2 2 0 0 0 0-4 M18 4v16 M18 12a2 2 0 1 0 0 4 2 2 0 0 0 0-4"},{key:"entrance",label:"Entrance",group:"navigation",path:"M14 3h5a1 1 0 0 1 1 1v16a1 1 0 0 1-1 1h-5 M3 12h11 M10 8l4 4-4 4"},{key:"exit",label:"Exit",group:"navigation",path:"M10 3H5a1 1 0 0 0-1 1v16a1 1 0 0 0 1 1h5 M14 12h7 M17 8l4 4-4 4"},{key:"emergency-exit",label:"Emergency exit",group:"navigation",path:"M14 4.6a1.5 1.5 0 1 0-3 0 1.5 1.5 0 0 0 3 0 M12.5 8l-3.5 2 1.6 3.6-2 4.4 M12.5 10l3.5 1.5 M9 10.5l-3.5 1 M15 12h6 M18 9l3 3-3 3"},{key:"stairs",label:"Stairs",group:"navigation",path:"M3 20v-4h4v-4h4v-4h4V4h5"},{key:"elevator",label:"Elevator",group:"navigation",path:"M5 3h14a1 1 0 0 1 1 1v16a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1Z M8 11l1.5-2 1.5 2 M8 14l1.5 2 1.5-2 M15 8v8"},{key:"parking",label:"Parking",group:"navigation",path:"M5 3h14a1 1 0 0 1 1 1v16a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1Z M9 17V7h4a3 3 0 0 1 0 6H9"},{key:"wheelchair",label:"Wheelchair access",group:"accessibility",path:Qt},{key:"hearing",label:"Hearing assistance",group:"accessibility",path:"M8 20a4 4 0 0 1-2-3c0-1 .5-2 .5-3a4.5 4.5 0 1 1 9 0c0 1.4-1 2-2 2.4-1.2.5-1.5 1-1.5 2.2 M17 6a5 5 0 0 1 1 6 M19.5 4a8 8 0 0 1 1.2 9"}];var No=new Map(Jt.map(e=>[e.key,e]));function en(e){return typeof e=="string"&&No.has(e)}var gi=Jt.map(e=>e.key);var tn=["butt","round","square"],nn=["miter","round","bevel"],ot=["none","arrow"];function rt(e){return e==="line"||e==="polyline"}function W(e){return e.length>=3&&e.every(t=>Number.isFinite(t.x)&&Number.isFinite(t.y))}function te(e,t,n){let o=(e.y-t.y)*(n.x-t.x)-(e.x-t.x)*(n.y-t.y);if(Math.abs(o)>1e-7)return!1;let r=(e.x-t.x)*(n.x-t.x)+(e.y-t.y)*(n.y-t.y);if(r<-1e-7)return!1;let i=(n.x-t.x)**2+(n.y-t.y)**2;return r<=i+1e-7}function ne(e,t){let n=!1;for(let o=0,r=t.length-1;o<t.length;r=o++){let i=t[r],s=t[o];if(te(e,i,s))return!0;i.y>e.y!=s.y>e.y&&e.x<(s.x-i.x)*(e.y-i.y)/(s.y-i.y)+i.x&&(n=!n)}return n}function z(e,t,n){return(t.x-e.x)*(n.y-e.y)-(t.y-e.y)*(n.x-e.x)}function rn(e,t,n,o){let r=z(e,t,n),i=z(e,t,o),s=z(n,o,e),l=z(n,o,t);return(r>1e-7&&i<-1e-7||r<-1e-7&&i>1e-7)&&(s>1e-7&&l<-1e-7||s<-1e-7&&l>1e-7)?!0:Math.abs(r)<=1e-7&&te(n,e,t)||Math.abs(i)<=1e-7&&te(o,e,t)||Math.abs(s)<=1e-7&&te(e,n,o)||Math.abs(l)<=1e-7&&te(t,n,o)}function oe(e){for(let t=0;t<e.length;t+=1){let n=(t+1)%e.length;for(let o=t+1;o<e.length;o+=1){let r=(o+1)%e.length;if(!(t===o||n===o||r===t)&&rn(e[t],e[n],e[o],e[r]))return!0}}return!1}function me(e,t){for(let n=0;n<e.length;n+=1)for(let o=0;o<t.length;o+=1)if(rn(e[n],e[(n+1)%e.length],t[o],t[(o+1)%t.length]))return!0;return ne(e[0],t)||ne(t[0],e)}function on(e,t){return!t.some((n,o)=>te(e,n,t[(o+1)%t.length]))&&ne(e,t)}function an(e){let t=e.outlinePath;if(!t?.segments.length)return;let n=i=>Number.isFinite(i.x)&&Number.isFinite(i.y),o=(i,s)=>Math.hypot(i.x-s.x,i.y-s.y);if(!n(t.start))return 0;let r=t.start;for(let i=0;i<t.segments.length;i++){let s=t.segments[i];if(!s||!n(s.end)||o(r,s.end)<=1e-9||s.kind==="bezier"&&(!n(s.control1)||!n(s.control2)))return i;if(s.kind==="arc"){if(!n(s.center)||!Number.isFinite(s.radius)||s.radius<=1e-6)return i;let l=Math.max(1e-4,s.radius*1e-4);if(Math.abs(o(r,s.center)-s.radius)>l||Math.abs(o(s.end,s.center)-s.radius)>l)return i}r=s.end}return o(r,t.start)>1e-4,t.segments.length-1}function $o(e,t,n,o){let r=z(e,t,n),i=z(e,t,o),s=z(n,o,e),l=z(n,o,t);return(r>1e-7&&i<-1e-7||r<-1e-7&&i>1e-7)&&(s>1e-7&&l<-1e-7||s<-1e-7&&l>1e-7)}function sn(e,t){for(let n=0;n<e.length;n+=1)for(let o=0;o<t.length;o+=1)if($o(e[n],e[(n+1)%e.length],t[o],t[(o+1)%t.length]))return!0;return e.some(n=>on(n,t))||t.some(n=>on(n,e))}function cn(e){return e.role!=="reference-focal"||!e.points||!W(e.points)?null:e.points}function ln(e){return!!e.referenceImage?.assetId&&!!e.backgroundImage?.assetId&&e.referenceImage.assetId!==e.backgroundImage.assetId}function dn(e,t){if(e.displayLabel!==void 0){let n=e.displayLabel.normalize("NFKC").trim();(!n||n!==e.displayLabel||n.length>80)&&t.push({severity:"error",code:"invalid-display-label",message:`${e.type==="gaArea"?"GA area":e.type} "${e.label}" must use a normalized buyer label of 1 to 80 characters`,objectId:e.id})}if(e.displayType!==void 0){let n=e.displayType.normalize("NFKC").trim();(!n||n!==e.displayType||n.length>24)&&t.push({severity:"error",code:"invalid-display-type",message:`${e.type==="gaArea"?"GA area":e.type} "${e.label}" must use a normalized buyer type of 1 to 24 characters`,objectId:e.id})}}function un(e,t,n,o){let r=e.crop,i=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(e.center?.x)||!Number.isFinite(e.center?.y)||!Number.isFinite(e.width)||e.width<=0||!Number.isFinite(e.opacity)||e.opacity<0||e.opacity>1||e.rotation!==void 0&&!Number.isFinite(e.rotation)||i)&&n.push({severity:"error",code:"invalid-background-placement",message:`The ${t} image has an invalid position, size, opacity, rotation, or crop`,...o?{floorId:o}:{}})}function it(e,t,n,o){let r=e.referenceImage,i=e.backgroundImage;r&&(un(r,"reference",t,o),!r.assetId&&!r.url&&t.push({severity:"error",code:"invalid-reference-image",message:"A trace reference must identify a private asset or self-contained image",...o?{floorId:o}:{}})),i&&(un(i,i.assetId?"legacy reference":"buyer background",t,o),!i.assetId&&!i.url&&t.push({severity:"error",code:"invalid-buyer-background",message:"A buyer background must contain a renderable image URL",...o?{floorId:o}:{}}),i.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",...o?{floorId:o}:{}})),ln(e)&&t.push({severity:"error",code:"conflicting-reference-images",message:"The canonical reference and legacy asset-backed background identify different private sources",...o?{floorId:o}:{}})}function be(e){let t=new Set(J.map(n=>n.key));return!e||/^ref_[0-9a-f-]{36}$/.test(e.assetId)&&!!e.logicalSectionId.trim()&&["user-confirmed","authoritative-source"].includes(e.evidence)&&!!e.sourceDescription.trim()&&(e.derivation===void 0||["explicit-inventory","server-synthesized-from-aggregate"].includes(e.derivation))&&(e.aggregateEvidence===void 0||["user-confirmed","authoritative-source"].includes(e.aggregateEvidence))&&(e.derivation!=="server-synthesized-from-aggregate"||e.evidence==="user-confirmed")&&(e.sectionAssignmentEvidence===void 0||["user-confirmed","authoritative-source"].includes(e.sectionAssignmentEvidence))&&e.sectionAssignmentEvidence===void 0==!e.sectionAssignmentSourceDescription?.trim()&&(e.sectionAssignmentSourceDescription?.trim().length??0)<=240&&(e.numberingEvidence===void 0||e.numberingEvidence==="user-confirmed")&&e.numberingEvidence===void 0==!e.numberingSourceDescription?.trim()&&(e.numberingSourceDescription?.trim().length??0)<=240&&(!e.accessibility||e.accessibility.placementDerivation==="server-synthesized-row-edges"&&e.accessibility.groupLogicalSectionIds.length>0&&e.accessibility.groupLogicalSectionIds.length<=100&&new Set(e.accessibility.groupLogicalSectionIds).size===e.accessibility.groupLogicalSectionIds.length&&e.accessibility.groupLogicalSectionIds.includes(e.logicalSectionId)&&e.accessibility.groupLogicalSectionIds.every(n=>!!n.trim()&&n.length<=160)&&["user-confirmed","authoritative-source"].includes(e.accessibility.assignmentEvidence)&&!!e.accessibility.assignmentSourceDescription.trim()&&e.accessibility.assignmentSourceDescription.trim().length<=240&&e.accessibility.counts.length>0&&e.accessibility.counts.length<=J.length&&new Set(e.accessibility.counts.map(n=>n.type)).size===e.accessibility.counts.length&&e.accessibility.counts.every(n=>t.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 fn(e){let t=e.referenceInventoryExclusion;return!t||typeof t.assetId=="string"&&/^ref_[0-9a-f-]{36}$/.test(t.assetId)&&t.assetId===e.referenceSource?.assetId&&typeof t.logicalSectionId=="string"&&t.logicalSectionId===(e.logicalSectionId??e.id)&&typeof t.reason=="string"&&!!t.reason.trim()&&t.reason.trim().length<=80&&["user-confirmed","authoritative-source"].includes(t.evidence)&&typeof t.sourceDescription=="string"&&!!t.sourceDescription.trim()&&t.sourceDescription.trim().length<=240}function gn(e){let t=e.referenceCategorySource;return!t||/^ref_[0-9a-f-]{36}$/.test(t.assetId)&&/^#[0-9a-f]{6}$/i.test(t.sourceColor)&&(t.sourceColors===void 0||t.sourceColors.length>0&&t.sourceColors.includes(t.sourceColor)&&new Set(t.sourceColors).size===t.sourceColors.length&&t.sourceColors.every(n=>/^#[0-9a-f]{6}$/i.test(n)&&`${n[1]}${n[3]}${n[5]}`.toLowerCase()===`${t.sourceColor[1]}${t.sourceColor[3]}${t.sourceColor[5]}`.toLowerCase()))&&(t.logicalSectionIds===void 0||t.logicalSectionIds.length>0&&new Set(t.logicalSectionIds).size===t.logicalSectionIds.length&&t.logicalSectionIds.every(n=>!!n.trim()&&n.length<=160))&&(t.assignmentDerivation===void 0||["source-color-class","confirmed-logical-sections"].includes(t.assignmentDerivation))&&t.assignmentEvidence===void 0==!t.assignmentSourceDescription?.trim()&&(t.assignmentEvidence===void 0||["user-confirmed","authoritative-source"].includes(t.assignmentEvidence))&&(t.assignmentSourceDescription?.trim().length??0)<=240&&(t.assignmentDerivation!=="confirmed-logical-sections"||t.assignmentEvidence!==void 0&&!!t.assignmentSourceDescription?.trim())&&t.sourcePaletteColor===void 0==(t.sourcePaletteColorEvidence===void 0)&&t.sourcePaletteColorEvidence===void 0==!t.sourcePaletteColorSourceDescription?.trim()&&(t.sourcePaletteColor===void 0||/^#[0-9a-f]{6}$/i.test(t.sourcePaletteColor))&&(t.sourcePaletteColorEvidence===void 0||["user-confirmed","authoritative-source"].includes(t.sourcePaletteColorEvidence))&&(t.sourcePaletteColorSourceDescription?.trim().length??0)<=240&&["user-confirmed","authoritative-source"].includes(t.labelEvidence)&&!!t.labelSourceDescription.trim()&&t.labelSourceDescription.trim().length<=240&&e.price!==void 0&&["user-confirmed","authoritative-source"].includes(t.priceEvidence)&&!!t.priceSourceDescription.trim()&&t.priceSourceDescription.trim().length<=240&&t.outputColorEvidence===void 0==!t.outputColorSourceDescription?.trim()&&(t.outputColorEvidence===void 0||["user-confirmed","authoritative-source"].includes(t.outputColorEvidence))&&(t.outputColorSourceDescription?.trim().length??0)<=240&&(e.color.toLowerCase()===(t.sourcePaletteColor??t.sourceColor).toLowerCase()&&new Set((t.sourceColors??[t.sourceColor]).map(n=>`${n[1]}${n[3]}${n[5]}`.toLowerCase())).size===1||t.outputColorEvidence!==void 0&&["user-confirmed","authoritative-source"].includes(t.outputColorEvidence))}function pn(e,t){let n=e.floors?.length?e.floors.map(i=>({id:i.id,objects:i.objects})):[{id:"floor-0",objects:e.objects}],o=new Map,r=new Map;for(let i of n){let s=i.objects.filter(f=>f.type==="row"),l=new Map,g=new Map;for(let f of s){if(f.segmentedRow){let c=l.get(f.segmentedRow.groupId)??[];c.push(f),l.set(f.segmentedRow.groupId,c)}if(f.rowBlockGeneration){let c=g.get(f.rowBlockGeneration.groupId)??[];c.push(f),g.set(f.rowBlockGeneration.groupId,c)}f.segmentedRow&&f.rowBlockGeneration&&t.push({severity:"error",code:"invalid-row-group-membership",message:`Row "${f.label}" cannot be both a segmented-row component and a generated row-block member`,objectId:f.id,floorId:i.id})}for(let[f,c]of l){let d=o.get(f);d&&d!==i.id&&t.push({severity:"error",code:"invalid-segmented-row",message:`Segmented row "${f}" cannot span multiple floors`,objectId:c[0].id,floorId:i.id}),o.set(f,i.id);let m=c.slice().sort((y,S)=>y.segmentedRow.componentIndex-S.segmentedRow.componentIndex),u=m[0]?.segmentedRow,h=u?.componentCount??0,C=u?JSON.stringify({displayLabel:u.displayLabel,repeatLabelOnComponents:u.repeatLabelOnComponents,displayType:u.displayType,labelPresentation:u.labelPresentation,viewFromSeatUrl:u.viewFromSeatUrl,viewFromSeatMeta:u.viewFromSeatMeta,confidenceEvidence:u.confidenceEvidence,smoothing:u.smoothing}):"";u&&h>=2&&h<=64&&m.length===h&&u.boundaryBefore==="start"&&m.every((y,S)=>{let v=y.segmentedRow;return v.kind==="segmented-row-v1"&&v.groupId===f&&v.componentCount===h&&v.componentIndex===S&&(S===0?v.boundaryBefore==="start":v.boundaryBefore!=="start")&&v.displayLabel.normalize("NFKC").trim()===v.displayLabel&&v.displayLabel.length>0&&v.displayLabel.length<=80&&JSON.stringify({displayLabel:v.displayLabel,repeatLabelOnComponents:v.repeatLabelOnComponents,displayType:v.displayType,labelPresentation:v.labelPresentation,viewFromSeatUrl:v.viewFromSeatUrl,viewFromSeatMeta:v.viewFromSeatMeta,confidenceEvidence:v.confidenceEvidence,smoothing:v.smoothing})===C})||t.push({severity:"error",code:"invalid-segmented-row",message:`Segmented row "${f}" has missing, duplicated, cyclic, or inconsistent component metadata`,objectId:c[0]?.id,floorId:i.id})}for(let[f,c]of g){let d=r.get(f);d&&d!==i.id&&t.push({severity:"error",code:"invalid-row-block-generation",message:"A generated row block cannot span multiple floors",objectId:c[0].id,floorId:i.id}),r.set(f,i.id)}}}function Do(e){return e.type==="row"||e.type==="table"||e.type==="booth"}function Bo(e){let t=[],n=new Map((e.overrides??[]).map(o=>[o.index,o]));for(let o=0;o<e.seatCount;o++){let r=n.get(o);r?.skip||t.push({label:he(e,o,r),index:o})}return t}function mn(e){let t=[],n=new Map((e.overrides??[]).map(o=>[o.index,o]));for(let o=0;o<e.seatCount;o++){let r=n.get(o);r?.skip||t.push({label:r?.label??`${e.label}-${o+1}`,index:o})}return t}function bn(e){let t=[];e.eventConfigurationId!==void 0&&(typeof e.eventConfigurationId!="string"||e.eventConfigurationId.normalize("NFKC").trim()!==e.eventConfigurationId||e.eventConfigurationId.length<1||e.eventConfigurationId.length>100)&&t.push({severity:"error",code:"invalid-event-configuration",message:"Active event configuration must contain 1 to 100 normalized characters"});let n=[],o=new Set(e.categories.map(a=>a.key)),r=new Set(J.map(a=>a.key)),i=new Map(e.categories.map(a=>[a.key,a.price!=null||a.notForSale===!0])),s=new Set;it(e,t,n);let l=a=>a.length<=2e6&&/^(https:\/\/|data:image\/)/.test(a),g=(a,E,p,I={})=>{if(E===void 0)return;if(!E||typeof E!="object"||Array.isArray(E)){t.push({severity:"error",code:"invalid-seat-view-metadata",message:`${p} view metadata is invalid`,...I});return}let x=E;a||n.push({severity:"warning",code:"orphaned-seat-view-metadata",message:`${p} view metadata has no image`,...I});let P=new Set(["exact-seat","row-representative","section-representative","venue-representative"]);x.projection!==void 0&&x.projection!=="equirectangular"&&t.push({severity:"error",code:"invalid-seat-view-projection",message:`${p} view projection must be equirectangular`,...I}),x.coverage!==void 0&&!P.has(x.coverage)&&t.push({severity:"error",code:"invalid-seat-view-coverage",message:`${p} view coverage is invalid`,...I});let M=(A,L,N)=>typeof A=="number"&&Number.isFinite(A)&&A>=L&&A<=N;x.initialBearingDeg!==void 0&&!M(x.initialBearingDeg,-360,360)&&t.push({severity:"error",code:"invalid-seat-view-bearing",message:`${p} view bearing must be between -360\xB0 and 360\xB0`,...I}),x.initialPitchDeg!==void 0&&!M(x.initialPitchDeg,-90,90)&&t.push({severity:"error",code:"invalid-seat-view-pitch",message:`${p} view pitch must be between -90\xB0 and 90\xB0`,...I}),x.capturedAt!==void 0&&(typeof x.capturedAt!="string"||x.capturedAt.length>40||!Number.isFinite(Date.parse(x.capturedAt)))&&t.push({severity:"error",code:"invalid-seat-view-capture-date",message:`${p} view capture date is invalid`,...I}),x.sourceLabel!==void 0&&(typeof x.sourceLabel!="string"||x.sourceLabel.trim().length>100)&&t.push({severity:"error",code:"invalid-seat-view-source",message:`${p} view source label is invalid`,...I}),x.previewUrl!==void 0&&!l(x.previewUrl)&&t.push({severity:"error",code:"invalid-seat-view-preview-url",message:`${p} view preview URL is invalid`,...I});for(let[A,L]of[["width",x.sourceWidth],["height",x.sourceHeight],["preview width",x.previewWidth],["preview height",x.previewHeight]])L!==void 0&&(!Number.isInteger(L)||L<1||L>32768)&&t.push({severity:"error",code:"invalid-seat-view-dimensions",message:`${p} view source ${A} is invalid`,...I});x.captureEyeHeightM!==void 0&&!M(x.captureEyeHeightM,.5,2.5)&&t.push({severity:"error",code:"invalid-seat-view-eye-height",message:`${p} capture eye height must be between 0.5 m and 2.5 m`,...I}),x.eventConfigurationId!==void 0&&(typeof x.eventConfigurationId!="string"||!x.eventConfigurationId.trim()||x.eventConfigurationId.length>100)&&t.push({severity:"error",code:"invalid-seat-view-configuration",message:`${p} event configuration id is invalid`,...I})},f=(a,E,p={})=>{if(a===void 0)return;let I=L=>{t.push({severity:"error",code:"invalid-seat-confidence-evidence",message:`${E} confidence evidence ${L}`,...p})};if(!a||typeof a!="object"||Array.isArray(a)){I("is invalid");return}let x=a;x.schema!=="seatlayer.seat-confidence/1"&&I("has an unsupported schema");let P=(L,N)=>typeof L=="string"&&L.normalize("NFKC").trim()===L&&L.length>0&&L.length<=N;P(x.evidenceId,120)||I("has an invalid evidence id"),P(x.modelVersion,120)||I("has an invalid model version"),new Set(["synthetic-model","organizer-approved","calibrated-provider"]).has(x.evidenceKind)||I("has an invalid evidence kind"),new Set(["generated","geometry-verified","configuration-verified"]).has(x.modelLevel)||I("has an invalid model level");let M=x.realityLevel??"none";new Set(["none","comparable-build-reference","actual-build-checked"]).has(M)||I("has an invalid reality level"),x.eventConfigurationId!==void 0&&!P(x.eventConfigurationId,100)&&I("has an invalid event configuration id");for(let[L,N]of[["assessment",x.assessedAt],["expiry",x.validUntil]])N!==void 0&&(!P(N,40)||!Number.isFinite(Date.parse(N)))&&I(`has an invalid ${L} date`);x.approvedByRole!==void 0&&!P(x.approvedByRole,100)&&I("has an invalid approving organization or role"),x.sourceLabel!==void 0&&!P(x.sourceLabel,120)&&I("has an invalid source label"),x.limitations!==void 0&&(!Array.isArray(x.limitations)||x.limitations.length>6||x.limitations.some(L=>!P(L,160)))&&I("has invalid limitations"),x.evidenceKind==="synthetic-model"&&(x.modelLevel!=="generated"||M!=="none")&&I("cannot describe synthetic data as verified or reality checked"),x.modelLevel!=="generated"&&(!x.assessedAt||!x.approvedByRole)&&I("requires an assessment date and approving organization or role for verified model levels"),x.modelLevel==="configuration-verified"&&!x.eventConfigurationId&&I("requires an event configuration id for configuration verification"),M!=="none"&&(!x.assessedAt||!x.sourceLabel)&&I("requires an assessment date and source for reality evidence"),M==="actual-build-checked"&&(x.modelLevel!=="configuration-verified"||!x.eventConfigurationId)&&I("requires a configuration-verified model and event configuration for an actual-build check");let A=x.modeledTarget;A!==void 0&&(!A||typeof A!="object"||Array.isArray(A)?I("has an invalid modeled target"):((!P(A.label,80)||!P(A.methodLabel,100))&&I("has invalid modeled-target labels"),(!Number.isInteger(A.totalRayCount)||A.totalRayCount<1||A.totalRayCount>1e3||!Number.isInteger(A.clearRayCount)||A.clearRayCount<0||A.clearRayCount>A.totalRayCount)&&I("has invalid modeled-target ray counts"),new Set(["clear","partial","obstructed"]).has(A.classification)||I("has an invalid modeled-target classification"),A.occluderLabels!==void 0&&(!Array.isArray(A.occluderLabels)||A.occluderLabels.length>10||A.occluderLabels.some(L=>!P(L,100)))&&I("has invalid modeled-target occluders")))};g(e.viewFromSeatUrl,e.viewFromSeatMeta,"Venue"),f(e.confidenceEvidence,"Venue"),e.viewFromSeatUrl!==void 0&&!l(e.viewFromSeatUrl)&&t.push({severity:"error",code:"invalid-venue-view-url",message:"The whole-venue view-from-seat image URL is invalid"});for(let a of e.floors??[])a.viewFromSeatUrl!==void 0&&!l(a.viewFromSeatUrl)&&t.push({severity:"error",code:"invalid-floor-view-url",message:`Floor "${a.name}" has an invalid view-from-seat image URL`}),g(a.viewFromSeatUrl,a.viewFromSeatMeta,`Floor "${a.name}"`,{floorId:a.id}),f(a.confidenceEvidence,`Floor "${a.name}"`,{floorId:a.id});let c=e.floors?.length?e.floors.flatMap(a=>a.objects):e.objects;for(let a of c)if((a.type==="row"||a.type==="section")&&(g(a.viewFromSeatUrl,a.viewFromSeatMeta,`${a.type==="row"?"Row":"Section"} "${a.label}"`,{objectId:a.id}),f(a.confidenceEvidence,`${a.type==="row"?"Row":"Section"} "${a.label}"`,{objectId:a.id})),a.type==="row"&&a.segmentedRow&&(g(a.segmentedRow.viewFromSeatUrl,a.segmentedRow.viewFromSeatMeta,`Segmented row "${a.segmentedRow.displayLabel}"`,{objectId:a.id}),f(a.segmentedRow.confidenceEvidence,`Segmented row "${a.segmentedRow.displayLabel}"`,{objectId:a.id})),a.type==="row"||a.type==="table")for(let E of a.overrides??[])g(E.viewFromSeatUrl,E.viewFromSeatMeta,`Seat ${E.index+1}`,{objectId:a.id,seatIndices:[E.index]}),f(E.confidenceEvidence,`Seat ${E.index+1}`,{objectId:a.id,seatIndices:[E.index]});let d=new Set;for(let a of e.categories){d.has(a.key)&&t.push({severity:"error",code:"duplicate-category-key",message:`Category key "${a.key}" is used more than once`,categoryKey:a.key}),d.add(a.key);let E=new Set;for(let p of a.tiers??[]){if(E.has(p.id)&&t.push({severity:"error",code:"duplicate-category-tier-id",message:`Ticket tier id "${p.id}" is used more than once in category "${a.key}"`,categoryKey:a.key}),p.restriction!=null&&!["companion","child","senior","student","membership","custom"].includes(p.restriction)&&t.push({severity:"error",code:"invalid-category-tier-restriction",message:`Ticket tier "${p.name}" has an unknown restriction`,categoryKey:a.key}),p.buyerMessage!=null&&(!p.buyerMessage.trim()||p.buyerMessage.length>240)&&t.push({severity:"error",code:"invalid-category-tier-buyer-message",message:`Ticket tier "${p.name}" buyer guidance must contain 1 to 240 characters`,categoryKey:a.key}),p.currency!=null&&!/^[A-Z]{3}$/.test(p.currency)&&t.push({severity:"error",code:"invalid-category-tier-currency",message:`Ticket tier "${p.name}" must use a three-letter ISO currency`,categoryKey:a.key}),p.applicability!=null){let I=p.applicability.seatLabels,x=p.applicability.accessibility;(I!==void 0&&(!Array.isArray(I)||!I.length||I.length>1e4||I.some(P=>typeof P!="string"||!P.trim()||P.length>160)||new Set(I).size!==I.length)||x!==void 0&&(!Array.isArray(x)||!x.length||x.some(P=>!r.has(P))||new Set(x).size!==x.length))&&t.push({severity:"error",code:"invalid-category-tier-applicability",message:`Ticket tier "${p.name}" has invalid seat applicability`,categoryKey:a.key})}p.evidence!=null&&(!["public-host","public-event","user-confirmed"].includes(p.evidence.provenance)||!p.evidence.sourceDescription.trim()||p.evidence.sourceDescription.length>240||p.evidence.capturedAt!==void 0&&(p.evidence.capturedAt.length>40||!Number.isFinite(Date.parse(p.evidence.capturedAt))))&&t.push({severity:"error",code:"invalid-category-tier-evidence",message:`Ticket tier "${p.name}" has invalid evidence provenance`,categoryKey:a.key}),E.add(p.id)}gn(a)||t.push({severity:"error",code:"invalid-reference-category-source",message:`Category ${a.label||a.key} has incomplete or invalid reference evidence`,categoryKey:a.key})}let m=new Map,u=new Map,h=[],C=new Map,b=0,y=0,S=new Set;for(let a of e.floors??[])it(a,t,n,a.id),S.has(a.id)&&t.push({severity:"error",code:"duplicate-floor-id",message:`Floor id "${a.id}" is used more than once`,floorId:a.id}),S.add(a.id),a.baseHeightM!==void 0&&(!Number.isFinite(a.baseHeightM)||a.baseHeightM<H||a.baseHeightM>G)&&t.push({severity:"error",code:"invalid-floor-base-height",message:`Floor "${a.name}" base height must be between ${H} and ${G} metres`,floorId:a.id});let v=e.floors&&e.floors.length?e.floors.flatMap(a=>a.objects):e.objects;pn(e,t);let w=new Set;for(let a of v)w.has(a.id)&&t.push({severity:"error",code:"duplicate-object-id",message:`Object id "${a.id}" is used more than once`,objectId:a.id}),w.add(a.id);let k=new Set;for(let a of e.zones??[])k.has(a.id)&&t.push({severity:"error",code:"duplicate-zone-id",message:`Zone id "${a.id}" is used more than once`}),k.add(a.id),a.focalPoint!==void 0&&(!Number.isFinite(a.focalPoint.x)||!Number.isFinite(a.focalPoint.y))&&t.push({severity:"error",code:"invalid-zone-focal-point",message:`Zone "${a.label}" must use a finite focal point`});let O=new Map;for(let a of v)if(!(a.type!=="section"||!a.zone)){if(e.zones?.length&&!k.has(a.zone)){t.push({severity:"error",code:"unknown-section-zone",message:`Section "${a.displayLabel??a.label}" references unknown zone "${a.zone}"`,objectId:a.id});continue}O.has(a.zone)||O.set(a.zone,a)}for(let[a,E]of O){let p=e.zones?.find(I=>I.id===a);p&&(p?.focalPoint||n.push({severity:"warning",code:"missing-zone-focal-point",message:`Zone "${p?.label??a}" uses the legacy floor focal; set its own focal point before publishing`,objectId:E.id}))}for(let a of v)if((a.type==="row"||a.type==="table"||a.type==="booth"||a.type==="gaArea")&&dn(a,t),Do(a)){if(b++,y+=a.type==="booth"?1:a.type==="row"?Ce(a):a.bookAsWhole||a.variableOccupancy?a.seatCount:mn(a).length,m.get(a.label)!==void 0?a.type!=="row"&&t.push({severity:"error",code:"duplicate-object-label",message:`Label "${a.label}" is used by more than one object`,objectId:a.id}):m.set(a.label,a.id),o.has(a.categoryKey)?s.add(a.categoryKey):t.push({severity:"error",code:"unknown-category",message:`"${a.label}" references unknown category "${a.categoryKey}"`,objectId:a.id,categoryKey:a.categoryKey}),a.type==="row"){be(a.referenceInventorySource)||t.push({severity:"error",code:"invalid-reference-inventory-source",message:`Row "${a.label}" has invalid reference-inventory provenance`,objectId:a.id}),a.seatCount<1&&t.push({severity:"error",code:"empty-row",message:`Row "${a.label}" has no seats`,objectId:a.id});let p=new Set;for(let I of a.overrides??[]){(I.accessibility??[]).filter(A=>!r.has(A)).length&&t.push({severity:"error",code:"invalid-accessibility-type",message:`Row "${a.label}" seat ${I.index+1} uses an unknown accessibility type`,objectId:a.id,seatIndices:[I.index]}),(!Number.isInteger(I.index)||I.index<0||I.index>=a.seatCount||p.has(I.index))&&t.push({severity:"error",code:"invalid-seat-override",message:`Row "${a.label}" has a duplicated or out-of-range seat override`,objectId:a.id,...Number.isInteger(I.index)?{seatIndices:[I.index]}:{}}),p.add(I.index);let P=I.wheelchairSpaceType,M=I.accessible===!0||I.accessibility?.includes("wheelchair");P!==void 0&&P!=="seat-present"&&P!=="no-seat"?t.push({severity:"error",code:"invalid-wheelchair-space",message:`Row "${a.label}" seat ${I.index+1} has an invalid wheelchair-space type`,objectId:a.id,seatIndices:[I.index]}):P&&(!M||I.skip)&&t.push({severity:"error",code:"invalid-wheelchair-space",message:I.skip?`Row "${a.label}" seat ${I.index+1} cannot have a wheelchair-space physical type while skipped from inventory`:`Row "${a.label}" seat ${I.index+1} must include wheelchair accessibility for its physical-space type`,objectId:a.id,seatIndices:[I.index]})}for(let I of Bo(a))de(I.label)&&t.push({severity:"error",code:"reserved-seat-label",message:`Seat label "${I.label}" uses SeatLayer's reserved GA namespace`,objectId:a.id,seatIndices:[I.index]}),u.get(I.label)!==void 0?h.push({severity:"error",code:"duplicate-seat-label",message:`Seat label "${I.label}" is used more than once`,objectId:a.id,seatIndices:[I.index]}):u.set(I.label,a.id)}else if(a.type==="table"){let p=a.bookAsWhole===!0||a.variableOccupancy===!0;if(a.seatCountsBySide){let M=["top","bottom","left","right"],A=Object.keys(a.seatCountsBySide),L=M.every(K=>Number.isInteger(a.seatCountsBySide[K])&&a.seatCountsBySide[K]>=0&&a.seatCountsBySide[K]<=40),N=L?M.reduce((K,Rn)=>K+a.seatCountsBySide[Rn],0):Number.NaN;(a.shape!=="rect"||A.length!==M.length||A.some(K=>!M.includes(K))||!L||N!==a.seatCount||N<1||N>40)&&t.push({severity:"error",code:"invalid-table-side-counts",message:`Table "${a.label}" needs top, bottom, left, and right whole-number chair counts totaling its ${a.seatCount}-chair capacity`,objectId:a.id})}p&&a.overrides?.length&&t.push({severity:"error",code:"grouped-table-chair-overrides",message:`Grouped table "${a.label}" cannot carry individual-chair overrides`,objectId:a.id,seatIndices:a.overrides.map(M=>M.index)});let I=new Set;for(let M of a.overrides??[]){(M.accessibility??[]).filter(K=>!r.has(K)).length&&t.push({severity:"error",code:"invalid-accessibility-type",message:`Table "${a.label}" chair ${M.index+1} uses an unknown accessibility type`,objectId:a.id,seatIndices:[M.index]}),(!Number.isInteger(M.index)||M.index<0||M.index>=a.seatCount||I.has(M.index))&&t.push({severity:"error",code:"invalid-seat-override",message:`Table "${a.label}" has a duplicated or out-of-range chair override`,objectId:a.id,...Number.isInteger(M.index)?{seatIndices:[M.index]}:{}}),I.add(M.index),M.categoryKey&&!o.has(M.categoryKey)?t.push({severity:"error",code:"unknown-category",message:`Table "${a.label}" chair ${M.index+1} references unknown category "${M.categoryKey}"`,objectId:a.id,seatIndices:[M.index],categoryKey:M.categoryKey}):M.categoryKey&&s.add(M.categoryKey);let L=M.wheelchairSpaceType,N=M.accessible===!0||M.accessibility?.includes("wheelchair");L!==void 0&&L!=="seat-present"&&L!=="no-seat"?t.push({severity:"error",code:"invalid-wheelchair-space",message:`Table "${a.label}" chair ${M.index+1} has an invalid wheelchair-space type`,objectId:a.id,seatIndices:[M.index]}):L&&(!N||M.skip)&&t.push({severity:"error",code:"invalid-wheelchair-space",message:M.skip?`Table "${a.label}" chair ${M.index+1} cannot have a wheelchair-space physical type while skipped from inventory`:`Table "${a.label}" chair ${M.index+1} must include wheelchair accessibility for its physical-space type`,objectId:a.id,seatIndices:[M.index]})}a.bookAsWhole&&a.variableOccupancy?t.push({severity:"error",code:"invalid-table-booking-mode",message:`Table "${a.label}" cannot be sold both as a whole table and with variable occupancy`,objectId:a.id}):a.variableOccupancy?(!Number.isInteger(a.minOccupancy)||!Number.isInteger(a.maxOccupancy)||a.minOccupancy<1||a.maxOccupancy<a.minOccupancy||a.maxOccupancy>a.seatCount)&&t.push({severity:"error",code:"invalid-table-occupancy",message:`Table "${a.label}" needs whole-number minimum and maximum guests from 1 to its ${a.seatCount}-chair capacity`,objectId:a.id}):(a.minOccupancy!=null||a.maxOccupancy!=null)&&t.push({severity:"error",code:"invalid-table-occupancy",message:`Table "${a.label}" has guest bounds without variable-occupancy selling`,objectId:a.id}),be(a.referenceInventorySource)||t.push({severity:"error",code:"invalid-reference-inventory-source",message:`Table "${a.label}" has invalid reference-inventory provenance`,objectId:a.id}),(a.shape==="round"&&a.radius==null||a.shape==="rect"&&(a.width==null||a.height==null)||a.seatCount<1)&&t.push({severity:"error",code:"bad-table",message:`Table "${a.label}" is missing required dimensions or seats`,objectId:a.id});let P=p?[{label:a.label,index:void 0}]:mn(a);for(let M of P)de(M.label)&&t.push({severity:"error",code:"reserved-seat-label",message:`Inventory label "${M.label}" uses SeatLayer's reserved GA namespace`,objectId:a.id}),u.get(M.label)!==void 0?h.push({severity:"error",code:"duplicate-seat-label",message:`Inventory label "${M.label}" is used more than once; grouped table labels must be unique`,objectId:a.id,...M.index===void 0?{}:{seatIndices:[M.index]}}):u.set(M.label,a.id)}else if(a.type==="booth"){be(a.referenceInventorySource)||t.push({severity:"error",code:"invalid-reference-inventory-source",message:`Booth "${a.label}" has invalid reference-inventory provenance`,objectId:a.id});let p=a.label;de(p)&&t.push({severity:"error",code:"reserved-seat-label",message:`Seat label "${p}" uses SeatLayer's reserved GA namespace`,objectId:a.id}),u.get(p)!==void 0?h.push({severity:"error",code:"duplicate-seat-label",message:`Seat label "${p}" is used more than once`,objectId:a.id}):u.set(p,a.id)}}else if(a.type==="gaArea"){if(!Ee(a))t.push({severity:"error",code:"invalid-ga-inventory-segments",message:`GA area "${a.label}" has invalid joined-area inventory provenance`,objectId:a.id});else for(let x of We(a))u.get(x)!==void 0?h.push({severity:"error",code:"duplicate-seat-label",message:`GA inventory label "${x}" is used more than once`,objectId:a.id}):u.set(x,a.id);be(a.referenceInventorySource)||t.push({severity:"error",code:"invalid-reference-inventory-source",message:`GA area "${a.label}" has invalid reference-inventory provenance`,objectId:a.id}),(!W(a.points)||Math.abs(ee(a.points))<=1e-7||oe(a.points))&&t.push({severity:"error",code:"invalid-ga-outline",message:`GA area "${a.label}" must have a finite, non-self-intersecting polygon outline`,objectId:a.id});let p=a.holes??[],I=Array.isArray(p)&&p.length<=64?p.findIndex(x=>!Array.isArray(x)||x.length>512||!W(x)||Math.abs(ee(x))<=1e-7||oe(x)?!0:!x.flatMap((M,A)=>{let L=x[(A+1)%x.length];return[M,{x:(M.x+L.x)/2,y:(M.y+L.y)/2}]}).every(M=>ne(M,a.points))):0;if(I>=0)t.push({severity:"error",code:"invalid-ga-hole",message:`GA area "${a.label}" has a cutout outside its outline or with invalid geometry`,objectId:a.id,holeIndex:I});else if(p.some((x,P)=>p.slice(P+1).some(M=>me(x,M)))){let x=p.findIndex((P,M)=>p.slice(M+1).some(A=>me(P,A)));t.push({severity:"error",code:"overlapping-ga-holes",message:`GA area "${a.label}" has overlapping cutout polygons`,objectId:a.id,holeIndex:x})}o.has(a.categoryKey)?s.add(a.categoryKey):t.push({severity:"error",code:"unknown-category",message:`"${a.label}" references unknown category "${a.categoryKey}"`,objectId:a.id,categoryKey:a.categoryKey}),a.capacity<1&&t.push({severity:"error",code:"empty-ga",message:`GA area "${a.label}" has zero capacity`,objectId:a.id}),(!Number.isInteger(a.capacity)||a.capacity>X)&&t.push({severity:"error",code:"invalid-ga-capacity",message:`GA area "${a.label}" capacity must be a whole number from 1 to ${X}`,objectId:a.id}),b++,y+=Math.max(0,Math.floor(a.capacity))}else if(a.type==="section"){if(a.elevation!==void 0&&(!Number.isInteger(a.elevation)||a.elevation<Ke||a.elevation>Z)){let I=Number.isInteger(a.elevation)&&a.elevation>Z&&a.elevation<=Ge;n.push({severity:"warning",code:I?"legacy-section-elevation":"invalid-section-elevation",message:I?`Section "${a.label}" uses legacy tier ${a.elevation}; set an exact height before normalizing it to tier ${Z}`:`Section "${a.label}" elevation must be a whole-number tier from ${Ke} to ${Z}`,objectId:a.id})}if(a.height!==void 0&&(!Number.isFinite(a.height)||a.height<H||a.height>G)&&t.push({severity:"error",code:"invalid-section-height",message:`Section "${a.label}" exact height must be between ${H} and ${G} metres`,objectId:a.id}),a.rake!==void 0&&(!Number.isFinite(a.rake)||a.rake<ve||a.rake>Ie)&&t.push({severity:"error",code:"invalid-section-rake",message:`Section "${a.label}" rake must be between ${ve}\xB0 and ${Ie}\xB0`,objectId:a.id}),a.surfaceKind!==void 0&&a.surfaceKind!=="flat"&&a.surfaceKind!=="rakedRows"&&t.push({severity:"error",code:"invalid-section-surface-kind",message:`Section "${a.label}" surfaceKind must be 'flat' or 'rakedRows'`,objectId:a.id}),!W(a.outline)||Math.abs(ee(a.outline))<=1e-7||oe(a.outline)){t.push({severity:"error",code:"invalid-section-outline",message:`Section "${a.label}" must have a finite, non-self-intersecting polygon outline`,objectId:a.id});continue}if(a.outlinePath){let I=[];try{I=It(a.outlinePath)}catch{}(!Ne(a.outlinePath)||!I.length||Math.hypot(a.outlinePath.start.x-a.outline[0].x,a.outlinePath.start.y-a.outline[0].y)>1e-4||!W(I)||Math.abs(ee(I))<=1e-7||oe(I))&&t.push({severity:"error",code:"invalid-section-outline-path",message:`Section "${a.label}" has an invalid or inconsistent curved outline path`,objectId:a.id,edgeIndex:an(a)})}if(a.referenceSource&&(!/^ref_[0-9a-f-]{36}$/.test(a.referenceSource.assetId)||!/^reg_[0-9a-f]{16}$/.test(a.referenceSource.regionId))&&t.push({severity:"error",code:"invalid-section-reference-source",message:`Section "${a.label}" has invalid opaque reference provenance`,objectId:a.id}),fn(a)||t.push({severity:"error",code:"invalid-section-inventory-exclusion",message:`Section "${a.label}" has incomplete or mismatched non-sellable evidence`,objectId:a.id}),a.logicalSectionId!==void 0&&!a.logicalSectionId.trim())t.push({severity:"error",code:"invalid-logical-section-id",message:`Section "${a.label}" has an empty logical section id`,objectId:a.id});else if(a.logicalSectionId){let I=JSON.stringify({displayLabel:a.displayLabel??null,entrance:a.entrance??null,viewFromSeatUrl:a.viewFromSeatUrl??null,viewFromSeatMeta:a.viewFromSeatMeta??null,confidenceEvidence:a.confidenceEvidence??null,zone:a.zone??null,labelStyle:a.labelPresentation?.labelStyle??null,labelVisible:a.labelPresentation?.visible!==!1}),x=C.get(a.logicalSectionId);x&&(x.label!==a.label||x.semanticSignature!==I)?t.push({severity:"error",code:"inconsistent-logical-section",message:`Logical section "${a.logicalSectionId}" must use one technical label and buyer-facing presentation across every component`,objectId:a.id}):x||C.set(a.logicalSectionId,{label:a.label,semanticSignature:I})}a.viewFromSeatUrl!==void 0&&(a.viewFromSeatUrl.length>2e6||!/^(https:\/\/|data:image\/)/.test(a.viewFromSeatUrl))&&t.push({severity:"error",code:"invalid-section-view-url",message:`Section "${a.label}" has an invalid view-from-seat image URL`,objectId:a.id});let E=a.holes??[];if(!Array.isArray(E)||E.length>64){t.push({severity:"error",code:"invalid-section-hole",message:`Section "${a.label}" has an invalid opening collection`,objectId:a.id});continue}let p=-1;for(let I=0;I<E.length;I++){let x=E[I];if(!Array.isArray(x)||x.length>512||!W(x)||Math.abs(ee(x))<=1e-7||oe(x)){p=I;break}if(!x.flatMap((M,A)=>{let L=x[(A+1)%x.length];return[M,{x:(M.x+L.x)/2,y:(M.y+L.y)/2}]}).every(M=>ne(M,a.outline))){p=I;break}}if(p>=0)t.push({severity:"error",code:"invalid-section-hole",message:`Section "${a.label}" has an opening outside its outline or with an invalid shape`,objectId:a.id,holeIndex:p});else if(E.some((I,x)=>E.slice(x+1).some(P=>me(I,P)))){let I=E.findIndex((x,P)=>E.slice(P+1).some(M=>me(x,M)));t.push({severity:"error",code:"overlapping-section-holes",message:`Section "${a.label}" has overlapping openings`,objectId:a.id,holeIndex:I})}}let T=e.floors?.length?e.floors.map(a=>a.objects):[e.objects];for(let a of T){let E=a.filter(p=>p.type==="section");for(let p of a.filter(I=>I.type==="text")){let I=p.iconKey;I!==void 0&&!en(I)&&t.push({severity:"error",code:"invalid-icon-key",message:`Venue icon "${p.text||p.id}" references an unknown symbol`,objectId:p.id});let x=p.fontFamily;x!==void 0&&(typeof x!="string"||x.normalize("NFKC").trim()!==x||x.length<1||x.length>120)&&t.push({severity:"error",code:"invalid-text-font-family",message:`Text "${p.text||p.id}" font family must contain 1 to 120 normalized characters`,objectId:p.id});let P=p.background;(p.width!==void 0&&(!Number.isFinite(p.width)||p.width<40||p.width>1200)||p.align!==void 0&&!["left","center","right"].includes(p.align)||p.lineHeight!==void 0&&(!Number.isFinite(p.lineHeight)||p.lineHeight<.8||p.lineHeight>3)||p.letterSpacing!==void 0&&(!Number.isFinite(p.letterSpacing)||p.letterSpacing<-2||p.letterSpacing>20)||p.opacity!==void 0&&(!Number.isFinite(p.opacity)||p.opacity<.1||p.opacity>1)||P!==void 0&&(!/^#[0-9a-f]{6}$/i.test(P.color)||P.padding!==void 0&&(!Number.isFinite(P.padding)||P.padding<0||P.padding>40)||P.cornerRadius!==void 0&&(!Number.isFinite(P.cornerRadius)||P.cornerRadius<0||P.cornerRadius>40)||P.opacity!==void 0&&(!Number.isFinite(P.opacity)||P.opacity<.1||P.opacity>1)))&&t.push({severity:"error",code:"invalid-text-layout",message:`Text "${p.text||p.id}" has invalid width, spacing, opacity, alignment, or background layout`,objectId:p.id})}for(let p of a.filter(I=>I.type==="shape")){if(p.eventConfigurationIds!==void 0){let P=p.eventConfigurationIds;Array.isArray(P)&&P.length>0&&P.length<=20&&P.every(A=>typeof A=="string"&&A.normalize("NFKC").trim()===A&&A.length>=1&&A.length<=100)&&new Set(P).size===P.length||t.push({severity:"error",code:"invalid-shape-configurations",message:`Shape "${p.label||p.id}" must reference 1 to 20 unique event configuration ids`,objectId:p.id})}if(p.heightM!==void 0&&(!Number.isFinite(p.heightM)||p.heightM<.05||p.heightM>50)&&t.push({severity:"error",code:"invalid-shape-height",message:`Shape "${p.label||p.id}" height must be between 0.05 m and 50 m`,objectId:p.id}),p.stroke!==void 0&&(!p.stroke||typeof p.stroke.color!="string"||!/^#[0-9a-f]{6}$/i.test(p.stroke.color)||!Number.isFinite(p.stroke.width)||p.stroke.width<.5||p.stroke.width>40)&&t.push({severity:"error",code:"invalid-shape-stroke",message:`Shape "${p.label||p.id}" stroke must use a six-digit color and width from 0.5 to 40 chart units`,objectId:p.id}),(p.lineCap!==void 0||p.lineJoin!==void 0||p.startEnding!==void 0||p.endEnding!==void 0)&&!rt(p.kind)?t.push({severity:"error",code:"invalid-shape-line-style-applicability",message:`Shape "${p.label||p.id}" may use line caps, joins, and end decorations only when it is an open line or polyline`,objectId:p.id}):rt(p.kind)&&(p.lineCap!==void 0&&!tn.includes(p.lineCap)||p.lineJoin!==void 0&&!nn.includes(p.lineJoin)||p.startEnding!==void 0&&!ot.includes(p.startEnding)||p.endEnding!==void 0&&!ot.includes(p.endEnding))&&t.push({severity:"error",code:"invalid-shape-line-style",message:`Shape "${p.label||p.id}" has an unsupported line cap, join, or ending`,objectId:p.id}),p.kind==="polygon"){let P=Zt(p.points??[]);P.ok||t.push({severity:"error",code:"invalid-shape-polygon",message:`Shape "${p.label||p.id}" has invalid polygon geometry: ${P.message}`,objectId:p.id})}let x=cn(p);if(x){for(let P of E)if(sn(x,P.outline)){t.push({severity:"error",code:"reference-focal-overlaps-section",message:`Reference focal area "${p.label??p.id}" overlaps section "${P.label}"`,objectId:p.id});break}}}}y>Pe&&t.push({severity:"error",code:"inventory-capacity-exceeded",message:`Chart has ${y} bookable units; the maximum is ${Pe}`}),t.push(...h.slice(0,5)),h.length>5&&t.push({severity:"error",code:"duplicate-seat-label",message:`${h.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 a of fe(e)){let E=a.families[0]?.targets[0];n.push({severity:"warning",code:"category-inventory-family-conflict",message:tt(a),categoryKey:a.categoryKey,...E?{objectId:E.id,floorId:E.floorId}:{},relatedObjectIds:a.objectIds,categoryInventoryFamilies:a.families})}e.focalPoint||n.push({severity:"warning",code:"missing-focal-point",message:"Chart has no focal point set"}),b===0&&n.push({severity:"warning",code:"no-bookables",message:"Chart has no rows, tables, booths, or GA areas"});for(let a of s)if(i.get(a)===!1){let E=e.categories.find(p=>p.key===a);n.push({severity:"warning",code:"unpriced-category",message:`Category "${E?.label??a}" is used but has no price`,categoryKey:a})}return[...t,...n]}var Ko=9,vn="#0e1117",Go="#f5f6f8",In="#8b93a7",zo="#0b1220",Uo="#0b1220",Ho="#ffffff",Vo=100;function R(e,t=2){let n=10**t;return Math.round(e*n)/n}function yn(e){let t=Y(e);if(!t)return null;let n=u=>{let h=u/255;return h<=.04045?h/12.92:((h+.055)/1.055)**2.4},o=n(t[0]),r=n(t[1]),i=n(t[2]),s=(.4124*o+.3576*r+.1805*i)/.95047,l=(.2126*o+.7152*r+.0722*i)/1,g=(.0193*o+.1192*r+.9505*i)/1.08883,f=u=>u>.008856?Math.cbrt(u):7.787*u+16/116,c=f(s),d=f(l),m=f(g);return[116*d-16,500*(c-d),200*(d-m)]}function Xo(e,t){let n=yn(e),o=yn(t);return!n||!o?null:Math.hypot(n[0]-o[0],n[1]-o[1],n[2]-o[2])}function j(e){return{source:"quality",...e}}function Yo(e){return e.code==="missing-focal-point"||e.code==="missing-zone-focal-point"?"navigation":"structure"}function st(e){return Ko*U(e.theme?.seatScale??1,.7,1.6)}function Sn(e){let t=[];for(let n of e.objects)n.type==="row"?t.push(...F(n)):n.type==="table"&&t.push(...B(n));return t}function Wo(e){let t={rowSeats:0,tableSeats:0,booths:0,gaCapacity:0};for(let n of e)for(let o of n.objects)o.type==="row"?t.rowSeats+=F(o).length:o.type==="table"?t.tableSeats+=B(o).length:o.type==="booth"?t.booths+=1:o.type==="gaArea"&&(t.gaCapacity+=Math.max(0,Math.floor(o.capacity)));return{inventoryByKind:t,bookableUnits:t.rowSeats+t.tableSeats+t.booths+t.gaCapacity}}function _(e,t){e.filter(n=>n.code===t.code).length<Vo&&e.push(t)}function qo(e,t,n){let o=st(e),r=2*o,i=2.3*o,s=0,l=0,g=1/0;for(let f of t){let c=new Map(f.objects.filter(b=>b.type==="row").map(b=>[b.id,b])),d=b=>{let y=f.objects.find(O=>O.id===b);if(!y||y.type!=="row"&&y.type!=="table")return"another seating object";let S=y.type==="row"?F(y):B(y),v=S.length?{x:S.reduce((O,T)=>O+T.x,0)/S.length,y:S.reduce((O,T)=>O+T.y,0)/S.length}:y.type==="row"?y.origin:y.center,w=f.objects.find(O=>O.type==="section"&&V(v,O.outline,O.holes)),k=y.type==="row"?`Row \u201C${y.label}\u201D`:`Table \u201C${y.label}\u201D`;return w?.type==="section"?`${k} in \u201C${w.label}\u201D`:k},m=Sn(f);s+=m.length;let u=i,h=new Map,C=new Map;for(let b of m){let y=Math.floor(b.x/u),S=Math.floor(b.y/u);for(let k=-1;k<=1;k++)for(let O=-1;O<=1;O++){let T=h.get(`${y+k}:${S+O}`)??[];for(let a of T){l++;let E=Math.hypot(b.x-a.x,b.y-a.y);if(g=Math.min(g,E),E>=i)continue;let I=(b.rowId<a.rowId?[b.rowId,a.rowId]:[a.rowId,b.rowId]).join("|"),x=C.get(I);(!x||E<x.distance)&&C.set(I,{a:b,b:a,distance:E})}}let v=`${y}:${S}`,w=h.get(v)??[];w.push(b),h.set(v,w)}for(let b of C.values()){let y=b.a.rowId===b.b.rowId,S=c.get(b.a.rowId),v=c.get(b.b.rowId),w=!y&&S?.segmentedRow?.repeatLabelOnComponents===!0&&v?.segmentedRow?.repeatLabelOnComponents===!0&&S.segmentedRow.groupId===v.segmentedRow.groupId,k=b.distance<r?"error":"warning";if(w&&k==="warning")continue;let O=k==="error"?"seat-overlap":"seat-cramped",T=d(b.a.rowId),a=d(b.b.rowId),E=R(k==="error"?r:i);_(n,j({severity:k,code:O,dimension:"geometry",title:y?`${T} has seats too close together`:`${T} and ${a} are too close together`,message:`The closest seats are ${R(b.distance)} chart units apart; at least ${E} are required.`,action:y?`Increase the seat spacing for ${T}, or use Review safe fixes.`:`Move ${T} or ${a} until they no longer overlap.`,objectId:b.a.rowId,relatedObjectIds:y?[b.a.rowId]:[b.a.rowId,b.b.rowId],floorId:f.id,measured:R(b.distance),minimum:R(k==="error"?r:i),autoFixable:y}))}}return{seats:s,checkedSeatPairs:l,minimumSeatDistance:Number.isFinite(g)?R(g):null}}function Ae(e){let{width:t,height:n}=yt(e);if(!e.rotation)return{x:e.position.x,y:e.position.y,width:t,height:n};let o=[{x:0,y:0},{x:t,y:0},{x:t,y:n},{x:0,y:n}].map(r=>{let i=ht(r,e.rotation);return{x:e.position.x+i.x,y:e.position.y+i.y}});return Ft(o)}function wn(e,t,n=0){return e.x<t.x+t.width+n&&e.x+e.width+n>t.x&&e.y<t.y+t.height+n&&e.y+e.height+n>t.y}function at(e,t,n){let o=U(t.x,e.x,e.x+e.width),r=U(t.y,e.y,e.y+e.height);return(t.x-o)**2+(t.y-r)**2<n**2}function Zo(e,t,n){let o=st(e),r=0;for(let i of t){let s=i.objects.filter(g=>g.type==="text"),l=Sn(i);r+=s.length;for(let g=0;g<s.length;g++){let f=s[g],c=Ae(f),d=l.find(m=>at(c,m,o));d&&_(n,j({severity:"warning",code:"label-collision",dimension:"labels",message:`Text \u201C${f.text}\u201D overlaps seat ${d.label}`,objectId:f.id,relatedObjectIds:[f.id,d.rowId],floorId:i.id,autoFixable:!0}));for(let m=0;m<g;m++){let u=s[m];wn(c,Ae(u),2)&&_(n,j({severity:"warning",code:"label-collision",dimension:"labels",message:`Text \u201C${f.text}\u201D overlaps text \u201C${u.text}\u201D`,objectId:f.id,relatedObjectIds:[f.id,u.id],floorId:i.id,autoFixable:!0}))}}}return r}function Qo(e){return e.normalize("NFKC").trim().toLowerCase().replace(/\s+/g," ")}function Jo(e,t,n){let o=new Map;for(let i of t)for(let s of i.objects){let l=s.type,g=l==="row"||l==="table"||l==="booth"||l==="gaArea",f=g||l==="section";if(g&&!s.categoryKey.trim()){let c=l==="gaArea"?"GA area":l==="row"?"Row":l==="table"?"Table":"Booth";_(n,j({severity:"warning",code:"object-uncategorized",dimension:"structure",title:`${c} \u201C${s.label||s.id}\u201D has no category`,message:`${c} \u201C${s.label||s.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:s.id,floorId:i.id,autoFixable:!1}))}if(f){let c=(s.type==="section"?s.displayLabel??s.label:s.label)??"";if(c.trim()){if(l==="table"||l==="booth"||l==="gaArea"){let d=Qo(c),m=o.get(d);m&&m.raw!==c?_(n,j({severity:"warning",code:"duplicate-object-label-normalized",dimension:"labels",title:`\u201C${c}\u201D and \u201C${m.raw}\u201D read as the same label`,message:`Labels \u201C${c}\u201D and \u201C${m.raw}\u201D differ only by case, spacing, or accents, so buyers cannot tell them apart.`,action:"Make the two labels visibly distinct.",objectId:s.id,relatedObjectIds:[s.id,m.id],floorId:i.id,autoFixable:!1})):m||o.set(d,{id:s.id,raw:c})}}else{let d=l==="gaArea"?"A GA area":l==="section"?"A section":l==="row"?"A row":l==="table"?"A table":"A booth";_(n,j({severity:"warning",code:"object-unlabeled",dimension:"labels",title:`${d} has no label`,message:`${d} 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:s.id,floorId:i.id,autoFixable:!1}))}}}let r=[];for(let i of t){let s=i.objects.filter(l=>l.type==="row"||l.type==="table"||l.type==="booth"||l.type==="gaArea");for(let l of i.objects)if(!(l.type!=="section"||l.referenceInventoryExclusion||s.some(f=>V(Q(f),l.outline,l.holes)))){if(l.referenceSource){r.push({id:l.id,floorId:i.id});continue}_(n,j({severity:"warning",code:"empty-section",dimension:"structure",title:`Section \u201C${l.displayLabel??l.label}\u201D is empty`,message:`Section \u201C${l.displayLabel??l.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:l.id,floorId:i.id,autoFixable:!1}))}}if(r.length&&_(n,j({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(i=>i.id),floorId:r[0].floorId,autoFixable:!1})),e.floors&&e.floors.length>1)for(let i of e.floors)i.objects.length===0&&_(n,j({severity:"warning",code:"unused-floor",dimension:"structure",title:`Floor \u201C${i.name}\u201D is empty`,message:`Floor \u201C${i.name}\u201D has no objects on it.`,action:"Add seating to this floor, or delete it from the floor list below the canvas.",floorId:i.id,autoFixable:!1}))}var er=5,tr=16;function nr(e,t,n){for(let o of t){let r=o.focalPoint??e.focalPoint;if(r)for(let i of o.objects){if(i.type!=="section"||i.outline.length<3)continue;let{rake:s}=ce(i);if(s<er)continue;let l=i.outline.map(m=>Math.hypot(m.x-r.x,m.y-r.y)),g=Math.max(...l);if(g<=0)continue;let f=(g-Math.min(...l))/g;if(s*f<=tr)continue;let d=i.displayLabel??i.label;_(n,j({severity:"warning",code:"section-rake-inconsistent",dimension:"geometry",title:`Section \u201C${d}\u201D is too deep for a single rake`,message:`Section \u201C${d}\u201D spans ${Math.round(f*100)}% of its distance to the stage at a ${Math.round(s)}\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:i.id,floorId:o.id,autoFixable:!1}))}}}function or(e,t,n){let o=e.theme?.background??vn,r=Go,i=new Map;for(let f of t)for(let c of f.objects){if(c.type!=="gaArea")continue;let d=i.get(c.categoryKey)??[];d.push({id:c.id,floorId:f.id}),i.set(c.categoryKey,d)}for(let f of e.categories){let c=$(f.color,o),d=$(f.color,r);if(c==null||d==null){_(n,j({severity:"error",code:"invalid-category-color",dimension:"contrast",message:`Category \u201C${f.label}\u201D does not use a supported hex color`,categoryKey:f.key}));continue}let m=Math.min(c,d);m<3&&_(n,j({severity:"warning",code:"category-contrast-low",dimension:"contrast",title:`Category \u201C${f.label}\u201D is hard to see`,message:`Category \u201C${f.label}\u201D reaches only ${R(m)}:1 across dark and light chart backgrounds; 3:1 is required`,action:`Choose a lighter or darker color for \u201C${f.label}\u201D until this warning clears.`,categoryKey:f.key,measured:R(m),minimum:3,autoFixable:!1}));let u=i.get(f.key)??[];if(u.length){let h=et(f.color,o,Je),C=et(f.color,r,Je),b=Math.min($(h,o)??0,$(C,r)??0);b<3&&_(n,j({severity:"warning",code:"ga-contrast-low",dimension:"contrast",message:`GA category \u201C${f.label}\u201D reaches only ${R(b)}:1 after its rendered opacity is composited; 3:1 is required`,objectId:u[0].id,categoryKey:f.key,floorId:u[0].floorId,relatedObjectIds:u.map(y=>y.id),measured:R(b),minimum:3,autoFixable:!1}))}}for(let f=0;f<e.categories.length;f++)for(let c=0;c<f;c++){let d=e.categories[f],m=e.categories[c],u=Xo(d.color,m.color);u!=null&&u<25&&_(n,j({severity:"warning",code:"category-colors-too-similar",dimension:"contrast",title:`\u201C${d.label}\u201D and \u201C${m.label}\u201D look too similar`,message:`Categories \u201C${d.label}\u201D and \u201C${m.label}\u201D are only \u0394E ${R(u)} apart; 25 is required`,action:"Pick a visibly different color for either category so buyers can tell them apart.",categoryKey:d.key,measured:R(u),minimum:25,autoFixable:!1}))}for(let f of t){let c=f.objects.filter(d=>d.type==="text");for(let d of c){let m=d.color??e.theme?.textColor??In,u=$(m,o),h=d.fontSize>=18?3:4.5;(u==null||u<h)&&_(n,j({severity:"warning",code:"text-contrast-low",dimension:"contrast",message:`Text \u201C${d.text}\u201D has ${R(u??0)}:1 contrast against the chart background; ${h}:1 is required`,objectId:d.id,floorId:f.id,measured:R(u??0),minimum:h,autoFixable:!0}))}}if(e.theme?.selectionColor){let f=$(e.theme.selectionColor,o);(f==null||f<3)&&_(n,j({severity:"warning",code:"selection-contrast-low",dimension:"contrast",title:"The selection color is hard to see",message:`Selection rings have ${R(f??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:R(f??0),minimum:3,autoFixable:!1}))}if(e.theme?.textColor){let f=$(e.theme.textColor,o);(f==null||f<3)&&_(n,j({severity:"warning",code:"theme-text-contrast-low",dimension:"contrast",title:"The theme text color is hard to read",message:`Theme text has ${R(f??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:R(f??0),minimum:3,autoFixable:!1}))}let s=e.theme?.seatLabelColor??zo,l=new Map,g=(f,c,d)=>{let m=l.get(f)??new Map,u=m.get(c)??[];u.push(d),m.set(c,u),l.set(f,m)};for(let f of t)for(let c of f.objects)if(c.type==="row")for(let d of ge(c).keys())g(d,"seat",c.id);else if(c.type==="table")for(let d of ge(c).keys())g(d,"table seat",c.id);else c.type==="booth"&&g(c.categoryKey,"booth",c.id);for(let f of e.categories){let c=l.get(f.key);if(c)for(let[d,m]of c){let u=d==="booth"?Gt:Kt,h=Ht(zt,600),C=Vt(f.color,s),b=$(C,f.color);(b==null||b<h)&&_(n,j({severity:"warning",code:"bookable-label-contrast-low",dimension:"contrast",message:`${d==="booth"?"Booth":d==="seat"?"Seat":"Table-seat"} labels use ${u}u type and have ${R(b??0)}:1 contrast on category \u201C${f.label}\u201D; ${h}:1 is required for small text`,objectId:m[0],relatedObjectIds:m,measured:R(b??0),minimum:h,autoFixable:!0}))}}}function rr(e,t){for(let n of e){let o=n.objects.filter(r=>r.type==="section");if(!(o.length<2))for(let r of n.objects){if(!(r.type==="row"||r.type==="table"||r.type==="booth"||r.type==="gaArea"))continue;let s=Q(r),l=o.filter(u=>V(s,u.outline,u.holes)),g=new Map;for(let u of l){let h=u.logicalSectionId??u.id,C=g.get(h)??[];C.push(u),g.set(h,C)}if(g.size<2)continue;let f=[...g.values()],c=f.map(u=>`Section \u201C${u[0].displayLabel??u[0].label}\u201D`),d=c.length===2?c.join(" and "):`${c.slice(0,-1).join(", ")}, and ${c[c.length-1]}`,m=r.type==="gaArea"?"GA area":r.type==="row"?"Row":r.type==="table"?"Table":"Booth";_(t,j({severity:"warning",code:"ambiguous-section-ownership",dimension:"structure",title:`${m} \u201C${r.label}\u201D belongs to more than one section`,message:`${m} \u201C${r.label}\u201D has its center inside ${d}, 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,...f.flatMap(u=>u.map(h=>h.id))],floorId:n.id,autoFixable:!1}))}}}var ir={structure:20,geometry:30,contrast:25,labels:15,navigation:10},ar={"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 sr(e){let t={...ir};for(let r of e){let i=r.severity==="error"?10:2;t[r.dimension]=Math.max(0,t[r.dimension]-(ar[r.code]??i))}let n=Object.values(t).reduce((r,i)=>r+i,0),o=n>=95?"A":n>=85?"B":n>=70?"C":n>=55?"D":"F";return{overall:n,dimensions:t,errorFree:e.every(r=>r.severity!=="error"),grade:o}}var cr=new Set(["unpriced-category","object-uncategorized"]);function hn(e,t={}){let n=Ve(e),o=bn(e).filter(c=>c.code!=="missing-zone-focal-point"||t.requireExplicitZoneFocals).map(c=>{let d=c.objectId?n.find(h=>h.objects.some(C=>C.id===c.objectId))?.id:void 0,m=c.code==="category-inventory-family-conflict",u=m?e.categories.find(h=>h.key===c.categoryKey):void 0;return j({...c,...m?{severity:"error",title:`Category \u201C${u?.label??c.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."}:{},...t.requireExplicitZoneFocals&&c.code==="missing-zone-focal-point"?{severity:"error"}:{},...d?{floorId:d}:{},source:"structural",dimension:Yo(c),autoFixable:m})}),r=qo(e,n,o),i=Wo(n),s=Zo(e,n,o);if(Jo(e,n,o),rr(n,o),nr(e,n,o),or(e,n,o),n.reduce((c,d)=>c+d.objects.filter(m=>m.type==="row"||m.type==="table"||m.type==="booth"||m.type==="gaArea").length,0)===0){let c=new Set(["missing-focal-point","no-bookables"]);for(let d=o.length-1;d>=0;d--)c.has(o[d].code)&&o.splice(d,1)}if(t.requirePricedInventory)for(let c=0;c<o.length;c++)cr.has(o[c].code)&&(o[c]={...o[c],severity:"error"});let g=o.filter(c=>c.severity==="error"),f=o.filter(c=>c.severity==="warning");return{issues:o,errors:g,warnings:f,metrics:{floors:n.length,objects:n.reduce((c,d)=>c+d.objects.length,0),seats:r.seats,bookableUnits:i.bookableUnits,inventoryByKind:i.inventoryByKind,categories:e.categories.length,freeTextLabels:s,checkedSeatPairs:r.checkedSeatPairs,minimumSeatDistance:r.minimumSeatDistance},score:sr(o),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 lr(e,t){if(e.seatCount<2||e.seatSpacing>=t)return!1;let n=ae(F(e));e.seatSpacing=R(t,3);let o=ae(F(e));return e.origin.x=R(e.origin.x+n.x-o.x,3),e.origin.y=R(e.origin.y+n.y-o.y,3),!0}function ur(e,t){if(e.seatCount<2)return!1;let n=!1;if(e.shape==="round"){let o=U(e.seatArc??360,0,360),r=(o>=360?360/e.seatCount:o/(e.seatCount-1))*Math.PI/180;if(r>0){let i=t/(2*Math.sin(r/2)),s=Math.max(1,i-16);(e.radius??40)<s&&(e.radius=R(s,3),n=!0)}}else{let o=ue(e),r=Math.max(o.top,o.bottom),i=Math.max(o.left,o.right);r>1&&(e.width??80)/r<t&&(e.width=R(r*t,3),n=!0),i>1&&(e.height??50)/i<t&&(e.height=R(i*t,3),n=!0)}return n}function dr(e){return[Uo,Ho].map(n=>({color:n,minimum:Math.min(...e.map(o=>$(n,o)??0))})).sort((n,o)=>o.minimum-n.minimum)[0].color}function xn(e,t,n){let o=Ae(e),r=0;for(let i of t)i.type==="row"?r+=F(i).filter(s=>at(o,s,n)).length:i.type==="table"?r+=B(i).filter(s=>at(o,s,n)).length:i.type==="text"&&i.id!==e.id&&wn(o,Ae(i),2)&&r++;return r}function fr(e,t,n){if(xn(e,t,n)===0)return!1;let r={...e.position},i=Math.max(12,e.fontSize*1.25),s=[[0,-1],[1,0],[0,1],[-1,0],[1,-1],[1,1],[-1,1],[-1,-1]];for(let l=1;l<=12;l++)for(let[g,f]of s)if(e.position={x:R(r.x+g*i*l,3),y:R(r.y+f*i*l,3)},xn(e,t,n)===0)return!0;return e.position=r,!1}function Cn(e){let t=JSON.parse(JSON.stringify(e)),n=hn(t),o=[],r=nt(t);if(r.changed){t=r.doc;for(let c of r.changes){let d=r.before.find(u=>u.categoryKey===c.categoryKey),m=d?.families.map(u=>u.label).join(", ")??"inventory families";o.push({code:"category-inventory-family-conflict",objectId:d?.objectIds[0],message:`Split category \u201C${c.categoryLabel}\u201D across ${m}; preserved its commercial metadata and reassigned ${c.reassignments.length} affected object${c.reassignments.length===1?"":"s"}`})}}let i=st(t),s=2.5*i,l=Ve(t);for(let c of l)for(let d of c.objects)if(d.type==="row"){let m=d.seatSpacing;lr(d,s)&&o.push({code:m<2*i?"seat-overlap":"seat-cramped",objectId:d.id,message:`Expanded ${d.id} to the ${R(s)}u target pitch while preserving its centre`})}else d.type==="table"&&ur(d,s)&&o.push({code:"seat-cramped",objectId:d.id,message:`Expanded ${d.id} so its perimeter seats meet the ${R(s)}u target pitch`});let g=t.theme?.background??vn;for(let c of l)for(let d of c.objects){if(d.type!=="text")continue;let m=d.color??t.theme?.textColor??In,u=d.fontSize>=18?3:4.5;($(m,g)??0)<u&&(d.color=dr([g]),o.push({code:"text-contrast-low",objectId:d.id,message:`Changed ${d.id} to the highest-contrast black/white ink`}))}for(let c of l){let d=c.objects.filter(m=>m.type==="text");for(let m of d)fr(m,c.objects,i)&&o.push({code:"label-collision",objectId:m.id,message:`Moved ${m.id} to the nearest collision-free deterministic label position`})}t.floors?.length&&(t.objects=t.floors[0].objects);let f=hn(t);return{doc:t,changed:o.length>0,fixes:o,before:n,after:f}}function Le(e){return e.floors?.length?e.floors.flatMap(t=>t.objects):e.objects}function ct(e){return Le(e).reduce((t,n)=>n.type==="row"?t+Ce(n):n.type==="table"?t+_t(n):n.type==="gaArea"?t+Math.max(0,Math.floor(n.capacity)):n.type==="booth"?t+1:t,0)}function gr(e){let t={};for(let o of e.categories??[])t[o.key]=0;let n=(o,r)=>{r>0&&(t[o]=(t[o]??0)+r)};for(let o of Le(e))if(o.type==="row")for(let r of F(o))n(r.categoryKey,1);else if(o.type==="table")if(o.bookAsWhole||o.variableOccupancy)n(o.categoryKey,Math.max(0,Math.round(o.seatCount)));else for(let r of B(o))n(r.categoryKey,1);else o.type==="gaArea"?n(o.categoryKey,Math.max(0,Math.floor(o.capacity))):o.type==="booth"&&n(o.categoryKey,1);return t}function Pn(e){if(!e.template)return null;let t=Le(e),n=t.filter(g=>g.type==="row"||g.type==="table"||g.type==="gaArea");if(!n.length)return null;let r=t.filter(g=>g.type==="booth").length+n.reduce((g,f)=>g+(f.type==="table"?2:1),0),i=ct(e),s=Math.max(r+1,Math.min(5e4,i*4)),l=[.5,1,1.5,2].map(g=>U(Math.round(i*g),r,s));return{family:e.template.family,display:e.template.family.replace(/-/g," ").replace(/\b\w/g,g=>g.toUpperCase()),min:r,max:s,presets:["S","M","L","XL"].map((g,f)=>({size:g,seats:l[f]}))}}function Mn(e){let t=F(e);return t.length?ae(t):{...e.origin}}function pr(e,t){let n=Pn(e);if(!n)return structuredClone(e);let o=structuredClone(e),r=Le(o),i=r.filter(u=>u.type==="row"||u.type==="table"||u.type==="gaArea"),s=r.filter(u=>u.type==="booth").length,l=Math.max(n.min,Math.min(n.max,Math.round(t))),g=l-s,f=i.map((u,h)=>{let C=u.type==="gaArea"?Math.max(0,Math.floor(u.capacity)):u.seatCount,b=u.type==="table"?2:1;return{object:u,index:h,current:C,minimum:b,value:b,fraction:0}}),c=f.reduce((u,h)=>u+h.minimum,0),d=Math.max(0,g-c),m=f.reduce((u,h)=>u+Math.max(1,h.current-h.minimum),0);for(let u of f){let h=d*Math.max(1,u.current-u.minimum)/m,C=Math.floor(h);u.value+=C,u.fraction=h-C}d=g-f.reduce((u,h)=>u+h.value,0),f.sort((u,h)=>h.fraction-u.fraction||u.index-h.index);for(let u=0;u<d;u++)f[u%f.length].value++;f.sort((u,h)=>u.index-h.index);for(let u of f)if(u.object.type==="row"){let h=Mn(u.object);u.object.seatCount=u.value;let C=Mn(u.object);u.object.origin.x+=h.x-C.x,u.object.origin.y+=h.y-C.y}else if(u.object.type==="table"){let h=u.object;if(h.seatCountsBySide){let C=["top","bottom","left","right"],b=ue(h),y=C.reduce((w,k)=>w+b[k],0)||1,S=C.map((w,k)=>{let O=u.value*b[w]/y;return{side:w,index:k,value:Math.floor(O),fraction:O-Math.floor(O)}}),v=u.value-S.reduce((w,k)=>w+k.value,0);S.sort((w,k)=>k.fraction-w.fraction||w.index-k.index);for(let w=0;w<v;w++)S[w%S.length].value+=1;S.sort((w,k)=>w.index-k.index),h.seatCountsBySide={top:S[0].value,bottom:S[1].value,left:S[2].value,right:S[3].value},h.sides=C.filter(w=>h.seatCountsBySide[w]>0)}h.seatCount=u.value,h.overrides&&(h.overrides=h.overrides.filter(C=>C.index<u.value),h.overrides.length||delete h.overrides)}else u.object.capacity=u.value;return o.floors?.length&&(o.objects=o.floors[0].objects),o.template={family:o.template.family,targetSeats:l},o=Cn(o).doc,o.template={family:e.template.family,targetSeats:ct(o)},o}function re(e){let t=Number(e.slice(e.lastIndexOf(":")+1));return Number.isFinite(t)?t:-1}function mr(e,t,n){let o=new Map;for(let s of e){if(s.kind==="booth")continue;let l=o.get(s.rowId);l?l.push(s):o.set(s.rowId,[s])}let r=s=>n.has(s.id)||t(s.id)!=="free",i=[];for(let s of o.values())if(!(s.length<3)){s.sort((l,g)=>re(l.id)-re(g.id));for(let l=1;l<s.length-1;l++){let g=s[l];if(r(g))continue;let f=s[l-1],c=s[l+1];re(g.id)-re(f.id)!==1||re(c.id)-re(g.id)!==1||!r(f)||!r(c)||!n.has(f.id)&&!n.has(c.id)||i.push(g)}}return i}var ut=1,dt=100;function En(e,t){if(!Number.isInteger(t)||t<ut||t>dt)return null;let n=e.rotation*Math.PI/180,o={x:Math.cos(n),y:Math.sin(n)},r={x:-o.y,y:o.x};return Array.from({length:t},(i,s)=>{let l=e.style==="intertwined"&&s%2===1?e.seatSpacing/2:0;return{type:"row",id:`__block_preview_${s}`,label:"",origin:{x:e.origin.x+r.x*s*e.rowGap+o.x*l,y:e.origin.y+r.y*s*e.rowGap+o.y*l},rotation:e.rotation,curve:e.curve,seatCount:e.seatsPerRow,seatSpacing:e.seatSpacing,categoryKey:"__preview__"}})}function lt(e,t=e.rowCount){let n=En(e,t);return n?.length?Q(n[n.length-1]):null}function br(e,t){if(!Number.isFinite(t.x)||!Number.isFinite(t.y)||e.rowGap<=0)return null;let n=lt(e,1);if(!n)return null;let o=e.rotation*Math.PI/180,r={x:-Math.sin(o),y:Math.cos(o)},i=(t.x-n.x)*r.x+(t.y-n.y)*r.y,s=Math.max(ut,Math.min(dt,Math.round(i/e.rowGap)+1)),l=lt(e,s);return l?{rowCount:s,edgePoint:l}:null}function yr(e,t){return e.length!==t.rowCount?!1:[...e].sort((o,r)=>(o.rowBlockGeneration?.rowIndex??1/0)-(r.rowBlockGeneration?.rowIndex??1/0)).every((o,r)=>{let i=o.rowBlockGeneration;return i?.kind==="row-block-v1"&&i.groupId===t.groupId&&i.rowIndex===r&&i.signature===t.signature&&JSON.stringify(i)===JSON.stringify({...t,rowIndex:r})})}var ua=1,da=300,fa=330;function On(e,t){if(e.path||!Number.isInteger(t)||t<1||t>300)return null;let n=e.seatCount>1?e.curve/(e.seatCount-1):0;return{...e,seatCount:t,curve:n*(t-1)}}function kn(e,t=e.seatCount){let n=On(e,t);if(!n)return null;if(t===1)return{...n.origin};let o=n.rotation*Math.PI/180,r=n.curve/(t-1)*Math.PI/180,i,s;if(Math.abs(r)<1e-9)i=(t-1)*n.seatSpacing,s=0;else{let l=n.seatSpacing/(2*Math.sin(Math.abs(r)/2)),g=r*(t-1);i=l*Math.sin(g),s=-l+l*Math.cos(g)}return{x:n.origin.x+i*Math.cos(o)-s*Math.sin(o),y:n.origin.y+i*Math.sin(o)+s*Math.cos(o)}}function hr(e,t){if(e.path||!Number.isFinite(t.x)||!Number.isFinite(t.y))return null;let n=e.seatCount>1?e.curve/(e.seatCount-1):0,o=Math.abs(n)<1e-9?300:Math.min(300,Math.floor(330/Math.abs(n))+1),r=null;for(let i=1;i<=Math.max(1,o);i+=1){let s=kn(e,i);if(!s)continue;let l=Math.hypot(s.x-t.x,s.y-t.y),g=n*(i-1);(!r||l<r.distance||l===r.distance&&i<r.seatCount)&&(r={seatCount:i,curve:g,endpoint:s,distance:l})}return r}var ie=class extends Error{constructor(n,o){super(o);this.objectId=n;this.name="GroupedTableProjectionError"}};function xr(e){let t=e.minOccupancy,n=e.maxOccupancy;if(!Number.isInteger(t)||!Number.isInteger(n)||t<1||n<t||n>e.seatCount)throw new ie(e.id,`Table "${e.label}" has invalid variable-occupancy bounds`);return{min:t,max:n}}function vr(e,t){if(t!==2)return[];let n=[];for(let o of Me(e)){if(o.type!=="table"||!o.bookAsWhole&&!o.variableOccupancy)continue;if(o.bookAsWhole&&o.variableOccupancy)throw new ie(o.id,`Table "${o.label}" cannot be whole-table and variable-occupancy inventory`);if(!Number.isInteger(o.seatCount)||o.seatCount<1||!o.label.trim())throw new ie(o.id,"Grouped tables require a label and at least one chair");let r=o.variableOccupancy?"variable":"whole",i=r==="variable"?xr(o):{min:o.seatCount,max:o.seatCount};n.push({objectId:o.id,label:o.label,...o.displayLabel?{displayLabel:o.displayLabel}:{},...o.displayType?{displayType:o.displayType}:{},categoryKey:o.categoryKey,mode:r,capacity:o.seatCount,minOccupancy:i.min,maxOccupancy:i.max,chairs:B(o)})}return n}function Ln(e){return{code:"ticket_option_not_applicable",labels:e,message:"That ticket choice is not available for the selected seat."}}function Te(e,t){let n=e.applicability;return n?!(n.seatLabels?.length&&!n.seatLabels.includes(t.label)||n.accessibility?.length&&!n.accessibility.some(o=>t.accessibility?.includes(o))):!0}function Ir(e,t){return(e.categories.find(n=>n.key===t.categoryKey)?.tiers??[]).filter(n=>Te(n,t))}function ft(e,t,n){let o=e.categories.find(i=>i.key===t.categoryKey)?.tiers;if(!o?.length)return{kind:"none"};let r=n==null?o.find(i=>Te(i,t)):o.find(i=>i.id===n&&Te(i,t));return r?{kind:"resolved",tier:r}:{kind:"invalid"}}function Sr(e,t){return(e.logicalRowId??e.rowId)===(t.logicalRowId??t.rowId)}function An(e){if(Number.isInteger(e.logicalSeatIndex))return e.logicalSeatIndex;let t=e.id.slice(e.id.lastIndexOf(":")+1),n=Number(t);return Number.isInteger(n)?n:void 0}function wr(e,t){if(!Sr(e,t))return!1;let n=An(e),o=An(t);return n!=null&&o!=null&&Math.abs(n-o)===1}function Tn(e,t){if(!t.length)return null;let n=new Map(Xe(e,{resolveEyeHeights:!1}).map(s=>[s.label,s])),o=t.flatMap(s=>{let l=n.get(s.label);return l?[{selection:s,seat:l}]:[]}),r=o.map(({seat:s})=>s).filter(s=>s.accessibility?.includes("wheelchair")),i=[];for(let{selection:s,seat:l}of o){let g=ft(e,l,s.tierId),f=g.kind==="resolved"?g.tier:void 0;(l.accessibility?.includes("companion")||f?.restriction==="companion")&&!r.some(d=>d.id!==l.id&&wr(l,d))&&i.push(l.label)}return i.length?{code:"companion_pair_required",labels:i,message:"Select the adjacent wheelchair place with each companion ticket."}:null}function Cr(e,t){if(!t.length)return null;let n=new Map(Xe(e,{resolveEyeHeights:!1}).map(s=>[s.label,s])),o=new Set(e.categories.filter(s=>s.notForSale).map(s=>s.key)),r=[],i=[];for(let s of t){let l=n.get(s.label);if(!l)continue;if(o.has(l.categoryKey)){r.push(l.label);continue}ft(e,l,s.tierId).kind==="invalid"&&i.push(l.label)}return r.length?{code:"not_for_sale",labels:r,message:"These seats are not for sale."}:i.length?Ln(i):Tn(e,t)}0&&(module.exports={CATEGORY_INVENTORY_FAMILIES,GroupedTableProjectionError,MAX_DIRECT_ROW_SWEEP,MAX_EVENT_INVENTORY,MAX_GA_CAPACITY,MAX_ROW_BLOCK_ROWS,MAX_ROW_SEATS,MIN_ROW_BLOCK_ROWS,MIN_ROW_SEATS,applicableTicketTiers,capacityControl,categoryCapacity,chartCapacity,companionSelectionIssue,describeCategoryInventoryConflict,effectiveSeatOwnerCategoryCounts,gaAreasOf,gaInventorySegments,gaUnitLabel,gaUnitLabels,groupedTableInventory,growJoinedGAInventory,inspectCategoryInventoryConflicts,intactRowBlockMembers,isGaUnitLabel,pickBestAvailable,pickBestAvailableInventory,remediateCategoryInventoryConflicts,resizeChartCapacity,resolveRowBlockCount,resolveRowTerminalCapacity,resolveTicketTierForSeat,rowBlockEdgePoint,rowBlockPreviewRows,rowTerminalEndpoint,rowWithTerminalCapacity,strandedSingles,ticketOptionNotApplicableIssue,ticketSelectionIssue,ticketTierAppliesToSeat,validGAInventorySegments});
|