@seatmap-fyi/map-domain 0.1.0-alpha.4 → 0.1.0-alpha.50

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (111) hide show
  1. package/dist/arc-fan-rebuild.d.ts +17 -0
  2. package/dist/arc-fan-rebuild.js +227 -0
  3. package/dist/arc-fan-section-layout.d.ts +11 -0
  4. package/dist/arc-fan-section-layout.js +54 -0
  5. package/dist/arc-fan.d.ts +27 -0
  6. package/dist/arc-fan.interface.d.ts +100 -0
  7. package/dist/arc-fan.interface.js +30 -0
  8. package/dist/arc-fan.js +182 -0
  9. package/dist/catalog.d.ts +6 -4
  10. package/dist/catalog.js +31 -17
  11. package/dist/categories.d.ts +14 -3
  12. package/dist/categories.js +146 -35
  13. package/dist/editor-state.d.ts +4 -1
  14. package/dist/editor-state.js +53 -30
  15. package/dist/floors.d.ts +22 -0
  16. package/dist/floors.js +72 -0
  17. package/dist/geometry/boundary.d.ts +1 -1
  18. package/dist/geometry/boundary.js +16 -12
  19. package/dist/geometry/curve-warnings.d.ts +1 -1
  20. package/dist/geometry/curve-warnings.js +3 -5
  21. package/dist/geometry/decoration-bounds.d.ts +4 -0
  22. package/dist/geometry/decoration-bounds.js +42 -0
  23. package/dist/geometry/ellipse.js +4 -12
  24. package/dist/geometry/geometry.d.ts +9 -3
  25. package/dist/geometry/geometry.js +58 -34
  26. package/dist/geometry/inventory-outline.d.ts +8 -0
  27. package/dist/geometry/inventory-outline.js +46 -0
  28. package/dist/geometry/layout-transform.d.ts +10 -0
  29. package/dist/geometry/layout-transform.interface.d.ts +6 -0
  30. package/dist/geometry/layout-transform.interface.js +1 -0
  31. package/dist/geometry/layout-transform.js +206 -0
  32. package/dist/geometry/polygon-curves.d.ts +17 -0
  33. package/dist/geometry/polygon-curves.interface.d.ts +21 -0
  34. package/dist/geometry/polygon-curves.interface.js +5 -0
  35. package/dist/geometry/polygon-curves.js +169 -0
  36. package/dist/geometry/primitives.d.ts +1 -1
  37. package/dist/geometry/primitives.js +2 -3
  38. package/dist/geometry/seat-shape.d.ts +1 -1
  39. package/dist/geometry/seat-shape.js +5 -5
  40. package/dist/geometry/seating-layout.d.ts +10 -1
  41. package/dist/geometry/seating-layout.js +73 -57
  42. package/dist/geometry/units.d.ts +8 -0
  43. package/dist/geometry/units.js +13 -0
  44. package/dist/geometry/venue-outline.d.ts +4 -18
  45. package/dist/geometry/venue-outline.interface.d.ts +23 -0
  46. package/dist/geometry/venue-outline.interface.js +7 -0
  47. package/dist/geometry/venue-outline.js +142 -49
  48. package/dist/identity.d.ts +3 -1
  49. package/dist/identity.js +32 -17
  50. package/dist/issues.d.ts +16 -2
  51. package/dist/issues.js +17 -6
  52. package/dist/labels.d.ts +6 -1
  53. package/dist/labels.js +20 -18
  54. package/dist/layers.d.ts +26 -0
  55. package/dist/layers.js +86 -0
  56. package/dist/media.d.ts +27 -0
  57. package/dist/media.js +89 -0
  58. package/dist/{types.d.ts → physical-document.interface.d.ts} +142 -10
  59. package/dist/{types.js → physical-document.interface.js} +23 -0
  60. package/dist/preview.d.ts +1 -1
  61. package/dist/preview.js +39 -29
  62. package/dist/reference.js +1 -1
  63. package/dist/row-segments.d.ts +5 -1
  64. package/dist/row-segments.js +10 -9
  65. package/dist/schema.d.ts +680 -18
  66. package/dist/schema.js +269 -111
  67. package/dist/seat-proximity.d.ts +4 -0
  68. package/dist/seat-proximity.js +119 -0
  69. package/dist/section-elevation.d.ts +5 -0
  70. package/dist/section-elevation.interface.d.ts +26 -0
  71. package/dist/section-elevation.interface.js +8 -0
  72. package/dist/section-elevation.js +53 -0
  73. package/dist/section-fill-rebuild.d.ts +10 -0
  74. package/dist/section-fill-rebuild.js +64 -0
  75. package/dist/section-fill.d.ts +84 -0
  76. package/dist/section-fill.interface.d.ts +94 -0
  77. package/dist/section-fill.interface.js +22 -0
  78. package/dist/section-fill.js +306 -0
  79. package/dist/section-growth.d.ts +11 -0
  80. package/dist/section-growth.interface.d.ts +20 -0
  81. package/dist/section-growth.interface.js +1 -0
  82. package/dist/section-growth.js +245 -0
  83. package/dist/section-layout.d.ts +101 -0
  84. package/dist/section-layout.interface.d.ts +8 -0
  85. package/dist/section-layout.interface.js +5 -0
  86. package/dist/section-layout.js +72 -0
  87. package/dist/section-outline-refit.d.ts +8 -0
  88. package/dist/section-outline-refit.js +246 -0
  89. package/dist/section-refit.d.ts +22 -0
  90. package/dist/section-refit.interface.d.ts +49 -0
  91. package/dist/section-refit.interface.js +6 -0
  92. package/dist/section-refit.js +179 -0
  93. package/dist/section-scale.d.ts +2 -0
  94. package/dist/section-scale.js +128 -0
  95. package/dist/sections.d.ts +23 -0
  96. package/dist/sections.js +144 -0
  97. package/dist/selling.d.ts +1 -1
  98. package/dist/selling.js +11 -26
  99. package/dist/spacing-repairs.d.ts +31 -0
  100. package/dist/spacing-repairs.js +168 -0
  101. package/dist/table-layout.d.ts +3 -3
  102. package/dist/table-layout.js +35 -35
  103. package/dist/validation.d.ts +7 -2
  104. package/dist/validation.interface.d.ts +20 -0
  105. package/dist/validation.interface.js +9 -0
  106. package/dist/validation.js +221 -85
  107. package/dist/wayfinding.d.ts +10 -0
  108. package/dist/wayfinding.interface.d.ts +52 -0
  109. package/dist/wayfinding.interface.js +28 -0
  110. package/dist/wayfinding.js +63 -0
  111. package/package.json +97 -4
package/dist/schema.js CHANGED
@@ -1,21 +1,22 @@
1
- import { DocumentLimits, TicketRestriction, TableBookingMode, TableChairDistribution, StandingBookingMode, SeatShape, TicketOptionLimit, NumberingScheme, LabelDirection, RowLabelPosition, AccessNeed, SeatingKind, CurveMode, DecorationKind, LabelAlignment, RowAlignment, RowEnds, RowJoin, SectionOutlineRole, AreaKind, ShapeKind, VenueGlyph, } from "./types.js";
1
+ import { ArcFanFacing, ArcFanFit, ArcFanMaximumRows, ArcFanMaximumPartsPerRow, ArcFanSectionOrigin, } from "./arc-fan.interface.js";
2
+ import { EntranceKind, GateUse, LineCap, LineJoin, LineEnding } from "./wayfinding.interface.js";
3
+ import { polygonContour, polygonContourVertexCount, PolygonVertexLimit, PolygonCornerRadiusMaxM, } from "./geometry/polygon-curves.js";
4
+ import { DocumentLimits, TicketRestriction, TableBookingMode, TableChairDistribution, StandingBookingMode, SeatShape, TicketOptionLimit, NumberingScheme, LabelDirection, TableChairNumberFormat, RowLabelPosition, AccessNeed, SeatingKind, CurveMode, DecorationKind, LabelAlignment, RowAlignment, RowStagger, RowEnds, RowJoin, SectionOutlineRole, RowRefitStrength, SectionRotation, SectionScale, SectionTier, SectionRake, SectionFrontRowHeight, AreaKind, ShapeKind, VenueGlyph, } from "./physical-document.interface.js";
2
5
  import { z } from "zod";
3
6
  import { tableSellingValid, standingSellingValid } from "./selling.js";
4
- import { categoryIssues, ticketOptionNameKey } from "./categories.js";
7
+ import { ticketOptionNameKey } from "./categories.js";
5
8
  import { issue, IssueCode } from "./issues.js";
6
- import { footprint, generateGroup, project, worldMatrices, } from "./geometry/geometry.js";
7
- const uuid = z
8
- .string()
9
- .regex(/^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/);
9
+ import { footprint, generateGroup, project, worldMatrices } from "./geometry/geometry.js";
10
+ const uuid = z.string().regex(/^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/);
10
11
  const finite = z.number().finite();
11
12
  const coordinate = finite.min(-10000).max(10000);
12
13
  const dimension = finite.min(0.001).max(10000);
13
14
  const nonNegative = finite.min(0).max(10000);
14
15
  const angle = finite.min(-180).lt(180);
16
+ const unsupportedText = /[\u0000-\u001f\u007f-\u009f]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?<![\uD800-\uDBFF])[\uDC00-\uDFFF]/u;
15
17
  const text = (limit, multiline = false) => z
16
18
  .string()
17
- .refine((v) => Array.from(v).length <= limit &&
18
- !/[\u0000-\u001f\u007f-\u009f]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?<![\uD800-\uDBFF])[\uDC00-\uDFFF]/u.test(multiline ? v.replace(/\n/g, "") : v), "Text exceeds its limit or contains unsupported control/surrogate characters.")
19
+ .refine((v) => Array.from(v).length <= limit && !unsupportedText.test(multiline ? v.replace(/\n/g, "") : v), "Text exceeds its limit or contains unsupported control/surrogate characters.")
19
20
  .meta({
20
21
  maxLength: limit,
21
22
  description: multiline
@@ -29,7 +30,13 @@ const name = text(120)
29
30
  description: "Nonempty, trimmed name; at most 120 Unicode code points. Control characters and unpaired surrogates are rejected.",
30
31
  });
31
32
  const label = text(80);
33
+ // Materialized labels retain their authored text within the document size limit.
34
+ export const storedLabelSchema = z
35
+ .string()
36
+ .refine((value) => !unsupportedText.test(value), "Use single-line text without control characters.")
37
+ .describe("Single-line label text without control characters or unpaired surrogates.");
32
38
  const point = z.strictObject({ x: coordinate, y: coordinate });
39
+ const focalPoint = point.describe("Authored seat-facing point in the chart coordinate system, in metres.").optional();
33
40
  const size = z.strictObject({ width: dimension, height: dimension });
34
41
  const transform = z.strictObject({
35
42
  positionM: point,
@@ -40,15 +47,40 @@ const transform = z.strictObject({
40
47
  const ring = z
41
48
  .array(point)
42
49
  .min(3)
43
- .max(10000)
50
+ .max(PolygonVertexLimit)
44
51
  .refine((v) => v[0].x !== v[v.length - 1].x || v[0].y !== v[v.length - 1].y, "Rings close implicitly; do not repeat the first vertex.")
45
52
  .describe("Implicitly closed ring; the last vertex must not repeat the first.");
46
- const polygon = z.strictObject({
53
+ const polygon = z
54
+ .strictObject({
47
55
  outer: ring,
48
56
  holes: z.array(ring).max(10000),
57
+ edgeCurvature: z.array(finite.min(-100).max(100)).max(PolygonVertexLimit).optional(),
58
+ cornerRounding: finite.min(0).max(100).optional(),
59
+ cornerRadiusM: nonNegative.max(PolygonCornerRadiusMaxM).optional(),
60
+ })
61
+ .superRefine((value, context) => {
62
+ if (value.edgeCurvature && value.edgeCurvature.length !== value.outer.length) {
63
+ context.addIssue({
64
+ code: "custom",
65
+ path: ["edgeCurvature"],
66
+ message: "Provide one curvature value per outer side.",
67
+ });
68
+ return;
69
+ }
70
+ if (value.cornerRounding !== undefined && value.cornerRadiusM !== undefined) {
71
+ context.addIssue({ code: "custom", path: ["cornerRadiusM"], message: "Use one corner rounding mode." });
72
+ return;
73
+ }
74
+ if (polygonContourVertexCount(value) > PolygonVertexLimit)
75
+ context.addIssue({
76
+ code: "custom",
77
+ path: ["edgeCurvature"],
78
+ message: "The boundary exceeds the 1mm / 10,000-vertex curve limit.",
79
+ });
49
80
  });
81
+ export const hexColourSchema = z.string().regex(/^#[0-9a-fA-F]{6}$/);
50
82
  const paint = z.strictObject({
51
- color: z.string().regex(/^#[0-9a-fA-F]{6}$/),
83
+ color: hexColourSchema,
52
84
  opacity: finite.min(0).max(1),
53
85
  });
54
86
  const sequence = z
@@ -68,8 +100,7 @@ const sequence = z
68
100
  path: ["lastAt"],
69
101
  message: "Last-seat anchoring requires a last number.",
70
102
  });
71
- if (value.scheme === NumberingScheme.Roman &&
72
- (value.startAt > 999 || (value.lastAt ?? 0) > 100999))
103
+ if (value.scheme === NumberingScheme.Roman && (value.startAt > 999 || (value.lastAt ?? 0) > 100999))
73
104
  context.addIssue({
74
105
  code: "custom",
75
106
  path: ["startAt"],
@@ -81,22 +112,23 @@ const labelStyle = z.strictObject({
81
112
  fontSizeM: dimension,
82
113
  style: z.enum(["plain", "pill"]).optional(),
83
114
  rotationDeg: angle.optional(),
84
- color: z
85
- .string()
86
- .regex(/^#[0-9a-fA-F]{6}$/)
87
- .optional(),
115
+ color: hexColourSchema.optional(),
88
116
  });
89
117
  const rowLabelStyle = labelStyle.extend({
90
118
  position: z.enum(RowLabelPosition),
91
119
  style: z.enum(["plain", "pill"]).optional(),
92
120
  rotationDeg: angle.optional(),
93
121
  });
122
+ export const buyerPhotoSchema = z.strictObject({ assetId: uuid });
94
123
  export const seatPresentationSchema = z.strictObject({
124
+ buyerPhoto: buyerPhotoSchema.optional(),
95
125
  gap: z.boolean().optional(),
96
126
  buyerNote: text(160).optional(),
97
127
  labelStyle: labelStyle.optional(),
98
128
  });
99
129
  export const rowPresentationSchema = z.strictObject({
130
+ buyerPhoto: buyerPhotoSchema.optional(),
131
+ bookingLabel: storedLabelSchema.optional(),
100
132
  buyerNoun: text(80).optional(),
101
133
  buyerNote: text(160).optional(),
102
134
  labelStyle: rowLabelStyle.optional(),
@@ -107,14 +139,11 @@ const seat = z.strictObject({
107
139
  seatShape: seatShapeSchema.optional(),
108
140
  id: uuid,
109
141
  categoryId: uuid.nullable().optional(),
110
- labelOverride: label.optional(),
142
+ labelOverride: storedLabelSchema.optional(),
111
143
  attributes: z
112
144
  .strictObject({
113
145
  wheelchair: z.enum(["seat", "space"]).optional(),
114
- accessNeeds: z
115
- .array(z.enum(AccessNeed))
116
- .max(Object.keys(AccessNeed).length)
117
- .optional(),
146
+ accessNeeds: z.array(z.enum(AccessNeed)).max(Object.keys(AccessNeed).length).optional(),
118
147
  obstructedView: z.boolean().optional(),
119
148
  premium: z.boolean().optional(),
120
149
  restrictedView: z.boolean().optional(),
@@ -132,16 +161,40 @@ const seat = z.strictObject({
132
161
  export const rowLayoutSchema = z.strictObject({
133
162
  originM: point,
134
163
  seatPitchM: dimension,
135
- curveDeg: finite.min(-360).max(360),
164
+ curveDeg: finite,
136
165
  rotationDeg: finite.min(-180).max(180),
137
166
  seatRotationOffsetDeg: finite.min(-180).max(180).optional(),
138
167
  });
168
+ export const entranceSchema = z.discriminatedUnion("kind", [
169
+ z.strictObject({ kind: z.literal(EntranceKind.Gate), gateId: uuid, label: storedLabelSchema.optional() }),
170
+ z.strictObject({ kind: z.literal(EntranceKind.Text), label: storedLabelSchema }),
171
+ ]);
172
+ const gateDetails = z.strictObject({
173
+ use: z.enum(GateUse),
174
+ stepFree: z.boolean().optional(),
175
+ opens: text(120).optional(),
176
+ showToBuyers: z.boolean().optional(),
177
+ });
139
178
  const row = z.strictObject({
179
+ entrance: entranceSchema.optional(),
180
+ fillOrigin: z
181
+ .strictObject({
182
+ sectionId: uuid,
183
+ rowIndex: finite
184
+ .int()
185
+ .min(0)
186
+ .max(DocumentLimits.PhysicalSeats - 1),
187
+ partIndex: finite
188
+ .int()
189
+ .min(0)
190
+ .max(DocumentLimits.PhysicalSeats - 1),
191
+ })
192
+ .optional(),
193
+ zIndex: finite.int().min(-2147483648).max(2147483647).optional(),
140
194
  ...rowPresentationSchema.shape,
141
195
  id: uuid,
142
196
  categoryId: uuid.nullable().optional(),
143
- labelOverride: label.optional(),
144
- bookingLabel: label.optional(),
197
+ labelOverride: storedLabelSchema.optional(),
145
198
  offsetM: point.optional(),
146
199
  seatSequenceOverride: sequence.optional(),
147
200
  layout: rowLayoutSchema.optional(),
@@ -149,6 +202,7 @@ const row = z.strictObject({
149
202
  seats: z.array(seat).min(1).max(DocumentLimits.PhysicalSeats),
150
203
  });
151
204
  const drawable = {
205
+ floorId: uuid.describe("Physical floor identity when the map defines levels.").optional(),
152
206
  id: uuid,
153
207
  parentId: uuid.nullable(),
154
208
  transform,
@@ -176,6 +230,7 @@ const standingSelling = z.discriminatedUnion("mode", [
176
230
  }),
177
231
  ]);
178
232
  const groupBase = {
233
+ entrance: entranceSchema.optional(),
179
234
  ...drawable,
180
235
  categoryId: uuid.nullable().optional(),
181
236
  name,
@@ -191,20 +246,34 @@ const rowsLabels = z.strictObject({
191
246
  });
192
247
  export const segmentedRowSchema = z.strictObject({
193
248
  id: uuid,
194
- label,
249
+ label: storedLabelSchema.min(1, "Use a nonempty connected row label."),
195
250
  sequence,
251
+ qualifySeatLabels: z.boolean().optional(),
196
252
  smoothCorners: z.boolean().optional(),
197
253
  parts: z
198
254
  .array(z.strictObject({
199
255
  rowId: uuid,
200
256
  joinBefore: z.enum(RowJoin).nullable(),
257
+ labelOverride: storedLabelSchema.optional(),
201
258
  }))
202
- .min(2)
259
+ .min(1)
203
260
  .max(DocumentLimits.PhysicalSeats),
204
261
  });
262
+ const inventoryNaming = { code: label, name: label.optional() };
263
+ export const tableChairNumberingSchema = z.strictObject({
264
+ startAt: z.number().int().min(0).max(999),
265
+ direction: z.enum([LabelDirection.Forward, LabelDirection.Reverse]),
266
+ format: z.enum(TableChairNumberFormat),
267
+ });
268
+ export const tableBuyerNounSchema = z
269
+ .string()
270
+ .min(1)
271
+ .refine((value) => value === value.trim() && !unsupportedText.test(value), "Use trimmed text without unsupported characters.");
205
272
  const tableLabels = z.strictObject({
206
- table: label,
273
+ ...inventoryNaming,
274
+ buyerNoun: tableBuyerNounSchema.optional(),
207
275
  chairs: sequence,
276
+ chairNumbering: tableChairNumberingSchema.optional(),
208
277
  tableStyle: labelStyle,
209
278
  });
210
279
  const roundTableRecipe = z.strictObject({
@@ -221,17 +290,45 @@ const rectangularTableRecipe = z.strictObject({
221
290
  chairPitchM: dimension.optional(),
222
291
  chairDistribution: z.enum(TableChairDistribution).optional(),
223
292
  });
224
- const longTableLayout = z
293
+ const tableChairSideSelection = z
225
294
  .strictObject({
295
+ top: z.boolean(),
296
+ bottom: z.boolean(),
297
+ left: z.boolean(),
298
+ right: z.boolean(),
299
+ })
300
+ .refine((value) => Object.values(value).some(Boolean), "Choose at least one table side.");
301
+ const longTableLayout = z.strictObject({
226
302
  recipe: rectangularTableRecipe,
227
- sides: z.strictObject({
228
- top: z.boolean(),
229
- bottom: z.boolean(),
230
- left: z.boolean(),
231
- right: z.boolean(),
232
- }),
303
+ sides: tableChairSideSelection.optional(),
304
+ });
305
+ const arcFanRecipeSchema = z
306
+ .strictObject({
307
+ rowCount: finite.int().min(1).max(ArcFanMaximumRows),
308
+ innerRadiusM: dimension,
309
+ rowPitchM: dimension,
310
+ seatPitchM: dimension,
311
+ startAngleDeg: finite,
312
+ endAngleDeg: finite,
313
+ taperDeg: finite,
314
+ skewDeg: finite,
315
+ fit: z.enum(ArcFanFit),
316
+ facing: z.enum(ArcFanFacing),
317
+ seatsPerRow: finite.int().min(2).max(DocumentLimits.PhysicalSeats).optional(),
318
+ aisles: z.strictObject({ left: nonNegative, center: nonNegative, right: nonNegative }),
233
319
  })
234
- .refine((value) => Object.values(value.sides).some(Boolean), "Choose at least one table side.");
320
+ .refine((recipe) => recipe.fit !== ArcFanFit.SameCount || recipe.seatsPerRow !== undefined, "A fixed-count fan requires seats per row.");
321
+ const arcFanGenerationSchema = z.strictObject({
322
+ recipe: arcFanRecipeSchema,
323
+ sectionId: uuid.nullable(),
324
+ sectionOrigin: z.enum(ArcFanSectionOrigin),
325
+ sectionOutlineGridOriginM: point.optional(),
326
+ members: z
327
+ .array(z.strictObject({ rowId: uuid, bookingLabel: storedLabelSchema, labelOverride: storedLabelSchema.optional() }))
328
+ .min(1)
329
+ .max(ArcFanMaximumRows * ArcFanMaximumPartsPerRow)
330
+ .refine((members) => new Set(members.map((member) => member.rowId)).size === members.length, "Generated fan members must be unique."),
331
+ });
235
332
  export const groupSchema = z.discriminatedUnion("kind", [
236
333
  z.strictObject({
237
334
  ...groupBase,
@@ -240,7 +337,9 @@ export const groupSchema = z.discriminatedUnion("kind", [
240
337
  seatPitchM: dimension,
241
338
  rowPitchM: dimension,
242
339
  rowAlignment: z.enum(RowAlignment).optional(),
340
+ stagger: z.enum(RowStagger).optional(),
243
341
  }),
342
+ arcFan: arcFanGenerationSchema.optional(),
244
343
  labels: rowsLabels,
245
344
  rows: z.array(row).min(1).max(DocumentLimits.PhysicalSeats),
246
345
  }),
@@ -267,6 +366,7 @@ export const groupSchema = z.discriminatedUnion("kind", [
267
366
  }),
268
367
  ]),
269
368
  }),
369
+ arcFan: arcFanGenerationSchema.optional(),
270
370
  labels: rowsLabels,
271
371
  rows: z.array(row).min(1).max(DocumentLimits.PhysicalSeats),
272
372
  }),
@@ -274,9 +374,11 @@ export const groupSchema = z.discriminatedUnion("kind", [
274
374
  .strictObject({
275
375
  ...groupBase,
276
376
  kind: z.literal(SeatingKind.Rectangular),
377
+ surfaceColor: hexColourSchema.optional(),
277
378
  selling: tableSelling.optional(),
278
379
  recipe: rectangularTableRecipe,
279
380
  roundLayout: roundTableRecipe.optional(),
381
+ conversionSides: tableChairSideSelection.optional(),
280
382
  labels: tableLabels,
281
383
  chairsBySide: z.strictObject({
282
384
  top: z.array(seat).max(DocumentLimits.PhysicalSeats),
@@ -291,6 +393,7 @@ export const groupSchema = z.discriminatedUnion("kind", [
291
393
  .strictObject({
292
394
  ...groupBase,
293
395
  kind: z.literal(SeatingKind.Round),
396
+ surfaceColor: hexColourSchema.optional(),
294
397
  selling: tableSelling.optional(),
295
398
  recipe: roundTableRecipe,
296
399
  longLayout: longTableLayout.optional(),
@@ -306,6 +409,8 @@ export const decorationStyleSchema = z.strictObject({
306
409
  });
307
410
  const decorationBase = {
308
411
  ...drawable,
412
+ label: storedLabelSchema.optional(),
413
+ heightM: nonNegative.optional(),
309
414
  style: decorationStyleSchema.optional(),
310
415
  };
311
416
  const decoration = z.discriminatedUnion("kind", [
@@ -320,6 +425,7 @@ const decoration = z.discriminatedUnion("kind", [
320
425
  .strictObject({
321
426
  ...decorationBase,
322
427
  kind: z.literal(DecorationKind.Rectangle),
428
+ gate: gateDetails.optional(),
323
429
  sizeM: size,
324
430
  cornerRadiusM: nonNegative,
325
431
  })
@@ -332,11 +438,17 @@ const decoration = z.discriminatedUnion("kind", [
332
438
  z.strictObject({
333
439
  ...decorationBase,
334
440
  kind: z.literal(DecorationKind.Line),
441
+ route: z.strictObject({ stepFree: z.boolean() }).optional(),
442
+ lineCap: z.enum(LineCap).optional(),
443
+ lineJoin: z.enum(LineJoin).optional(),
444
+ startEnding: z.enum(LineEnding).optional(),
445
+ endEnding: z.enum(LineEnding).optional(),
335
446
  pointsM: z.array(point).min(2).max(10000),
336
447
  }),
337
448
  z.strictObject({
338
449
  ...decorationBase,
339
450
  kind: z.literal(DecorationKind.Polygon),
451
+ gate: gateDetails.optional(),
340
452
  boundary: polygon,
341
453
  }),
342
454
  z.strictObject({
@@ -354,10 +466,11 @@ const decoration = z.discriminatedUnion("kind", [
354
466
  }),
355
467
  ]);
356
468
  const areaBase = {
469
+ entrance: entranceSchema.optional(),
357
470
  ...drawable,
471
+ ...inventoryNaming,
358
472
  categoryId: uuid.nullable().optional(),
359
473
  sectionId: uuid.nullable(),
360
- label,
361
474
  labelStyle,
362
475
  capacity: finite.int().min(1).max(2147483647),
363
476
  shape: z.discriminatedUnion("kind", [
@@ -394,14 +507,11 @@ export const categorySchema = z
394
507
  .strictObject({
395
508
  id: uuid,
396
509
  name,
397
- color: z.string().regex(/^#[0-9a-fA-F]{6}$/),
510
+ color: hexColourSchema,
398
511
  defaultPrice: templatePrice.nullable().optional(),
399
512
  onSale: z.boolean().optional(),
400
513
  seatShape: seatShapeSchema.optional(),
401
- ticketOptions: z
402
- .array(ticketOptionSchema)
403
- .max(TicketOptionLimit)
404
- .optional(),
514
+ ticketOptions: z.array(ticketOptionSchema).max(TicketOptionLimit).optional(),
405
515
  })
406
516
  .superRefine((category, context) => {
407
517
  const names = new Set();
@@ -422,10 +532,7 @@ export const categoriesSchema = z
422
532
  .superRefine((categories, context) => {
423
533
  const ids = new Set();
424
534
  for (const [index, category] of categories.entries()) {
425
- for (const id of [
426
- category.id,
427
- ...(category.ticketOptions ?? []).map((option) => option.id),
428
- ]) {
535
+ for (const id of [category.id, ...(category.ticketOptions ?? []).map((option) => option.id)]) {
429
536
  if (ids.has(id))
430
537
  context.addIssue({
431
538
  code: "custom",
@@ -437,9 +544,11 @@ export const categoriesSchema = z
437
544
  }
438
545
  });
439
546
  export const documentSchema = z.strictObject({
547
+ buyerPhoto: buyerPhotoSchema.optional(),
440
548
  schemaVersion: z.literal(1),
441
549
  mapId: uuid,
442
550
  name,
551
+ venueName: name.optional(),
443
552
  coordinateSystem: z.strictObject({
444
553
  unit: z.literal("metre"),
445
554
  xAxis: z.literal("right"),
@@ -448,14 +557,51 @@ export const documentSchema = z.strictObject({
448
557
  }),
449
558
  background: paint,
450
559
  categories: categoriesSchema.optional(),
560
+ floors: z
561
+ .array(z.strictObject({ id: uuid, name, baseHeightM: coordinate, focalPoint }))
562
+ .min(1)
563
+ .max(1024)
564
+ .describe("Physical levels in display order. When present, every section, collection and drawable must reference one of these floor identities.")
565
+ .optional(),
566
+ zones: z
567
+ .array(z.strictObject({ id: uuid, name, color: hexColourSchema, focalPoint }))
568
+ .max(1024)
569
+ .describe("Section groups in display order, independent of physical floors.")
570
+ .optional(),
451
571
  sections: z
452
572
  .array(z.strictObject({
573
+ entrance: entranceSchema.optional(),
574
+ buyerPhoto: buyerPhotoSchema.optional(),
453
575
  id: uuid,
454
- label,
576
+ label: storedLabelSchema,
577
+ floorId: uuid.describe("Physical floor identity when the map defines levels.").optional(),
578
+ zoneId: uuid.describe("Optional chart-wide zone membership.").optional(),
579
+ elevation: z
580
+ .strictObject({
581
+ tier: z.enum(SectionTier).optional(),
582
+ rakeDeg: finite.min(SectionRake.min).max(SectionRake.max).optional(),
583
+ frontRowHeightM: finite.min(SectionFrontRowHeight.min).max(SectionFrontRowHeight.max).optional(),
584
+ })
585
+ .describe("Authored section slope and front-row elevation relative to its floor.")
586
+ .optional(),
455
587
  categoryId: uuid.nullable().optional(),
456
- displayLabel: text(80, true).optional(),
588
+ displayLabel: z
589
+ .string()
590
+ .refine((value) => !unsupportedText.test(value.replace(/\n/g, "")), "Use text without unsupported characters.")
591
+ .describe("Stored section display name. LF is permitted and generated copy names retain their full text.")
592
+ .optional(),
457
593
  outline: polygon.optional(),
458
594
  outlineRole: z.enum(SectionOutlineRole).optional(),
595
+ rotationDeg: z.number().int().min(SectionRotation.min).max(SectionRotation.max).optional(),
596
+ scalePercent: z.number().min(SectionScale.min).max(SectionScale.max).optional(),
597
+ outlineGrowthFactor: finite.positive().optional(),
598
+ rowRefitStrength: z
599
+ .number()
600
+ .int()
601
+ .min(RowRefitStrength.min)
602
+ .max(RowRefitStrength.max)
603
+ .describe("Last accepted row refit strength in percent.")
604
+ .optional(),
459
605
  style: decorationStyleSchema.optional(),
460
606
  labelPlacement: z
461
607
  .strictObject({
@@ -469,21 +615,13 @@ export const documentSchema = z.strictObject({
469
615
  .max(1024),
470
616
  collections: z.array(z.strictObject({ ...drawable, name })).max(10000),
471
617
  seatingGroups: z.array(groupSchema).max(DocumentLimits.PhysicalSeats),
472
- segmentedRows: z
473
- .array(segmentedRowSchema)
474
- .max(DocumentLimits.PhysicalSeats)
475
- .optional(),
618
+ segmentedRows: z.array(segmentedRowSchema).max(DocumentLimits.PhysicalSeats).optional(),
476
619
  areas: z.array(area).max(10000),
477
620
  decorations: z.array(decoration).max(10000),
478
621
  assets: z
479
622
  .array(z.strictObject({
480
623
  id: uuid,
481
- mimeType: z.enum([
482
- "image/png",
483
- "image/jpeg",
484
- "image/webp",
485
- "image/svg+xml",
486
- ]),
624
+ mimeType: z.enum(["image/png", "image/jpeg", "image/webp", "image/svg+xml"]),
487
625
  }))
488
626
  .max(256),
489
627
  });
@@ -496,16 +634,16 @@ export const paintSchema = paint;
496
634
  export const transformSchema = transform;
497
635
  export const mapNameSchema = name;
498
636
  export const sectionSchema = documentSchema.shape.sections.element;
637
+ export const floorsSchema = documentSchema.shape.floors.unwrap();
638
+ export const zonesSchema = documentSchema.shape.zones.unwrap();
499
639
  export const uuidSchema = uuid;
500
640
  export const dimensionSchema = dimension;
501
641
  export const coordinateSchema = coordinate;
502
642
  export const rotationSchema = angle;
503
- export const positiveCountSchema = finite
504
- .int()
505
- .min(1)
506
- .max(DocumentLimits.PhysicalSeats);
643
+ export const positiveCountSchema = finite.int().min(1).max(DocumentLimits.PhysicalSeats);
507
644
  export const labelSequenceSchema = sequence;
508
645
  export const inventoryLabelSchema = label;
646
+ export const authoredSectionDisplayLabelSchema = text(80, true);
509
647
  export const attributesSchema = seat.shape.attributes;
510
648
  export const seatOverrideSchema = seat.shape.override;
511
649
  export function validateRecipe(group) {
@@ -522,8 +660,7 @@ export var DocumentParseStatus;
522
660
  DocumentParseStatus["Rejected"] = "rejected";
523
661
  })(DocumentParseStatus || (DocumentParseStatus = {}));
524
662
  export function groupSeatCount(group) {
525
- return group.kind === SeatingKind.Straight ||
526
- group.kind === SeatingKind.Curved
663
+ return group.kind === SeatingKind.Straight || group.kind === SeatingKind.Curved
527
664
  ? group.rows.reduce((n, r) => n + r.seats.length, 0)
528
665
  : group.kind === SeatingKind.Round
529
666
  ? group.chairs.length
@@ -570,24 +707,52 @@ export function capacity(document) {
570
707
  return { physicalSeats, gaQuantity };
571
708
  }
572
709
  export function structuralIssues(document, changedGroups) {
573
- const errors = categoryIssues(document);
710
+ const errors = [];
574
711
  const ids = new Set([document.mapId]);
575
712
  const add = (id) => {
576
713
  if (ids.has(id))
577
- errors.push(issue(IssueCode.DuplicateId, "Physical identities must be unique.", [
578
- id,
579
- ]));
714
+ errors.push(issue(IssueCode.DuplicateId, "Physical identities must be unique.", [id]));
580
715
  ids.add(id);
581
716
  };
717
+ const floors = new Set((document.floors ?? []).map((floor) => floor.id));
718
+ for (const floor of document.floors ?? [])
719
+ add(floor.id);
720
+ for (const member of [
721
+ ...document.sections,
722
+ ...document.collections,
723
+ ...document.seatingGroups,
724
+ ...document.areas,
725
+ ...document.decorations,
726
+ ]) {
727
+ if (member.floorId ? !floors.has(member.floorId) : floors.size > 0) {
728
+ errors.push(issue(IssueCode.UnknownFloor, "Physical objects must reference an existing floor when levels are defined.", [
729
+ member.id,
730
+ ]));
731
+ }
732
+ }
582
733
  const sections = new Set(document.sections.map((s) => s.id));
583
734
  const parents = new Map(document.collections.map((c) => [c.id, c]));
735
+ const floorById = new Map([
736
+ ...document.sections,
737
+ ...document.collections,
738
+ ...document.seatingGroups,
739
+ ...document.areas,
740
+ ...document.decorations,
741
+ ].map((object) => [object.id, object.floorId]));
584
742
  let vertices = 0;
585
- const visitPolygon = (p) => {
586
- if (p)
587
- vertices += p.outer.length + p.holes.reduce((n, h) => n + h.length, 0);
743
+ const visitPolygon = (polygon) => {
744
+ if (polygon)
745
+ vertices += polygonContourVertexCount(polygon) + polygon.holes.reduce((total, hole) => total + hole.length, 0);
588
746
  };
747
+ const zones = new Set();
748
+ for (const zone of document.zones ?? []) {
749
+ add(zone.id);
750
+ zones.add(zone.id);
751
+ }
589
752
  for (const s of document.sections) {
590
753
  add(s.id);
754
+ if (s.zoneId && !zones.has(s.zoneId))
755
+ errors.push(issue(IssueCode.UnknownZone, "Section zone reference does not exist.", [s.id]));
591
756
  visitPolygon(s.outline);
592
757
  }
593
758
  for (const category of document.categories ?? []) {
@@ -604,18 +769,23 @@ export function structuralIssues(document, changedGroups) {
604
769
  ...document.decorations,
605
770
  ]) {
606
771
  add(object.id);
772
+ if ("sectionId" in object && object.sectionId !== null && !sections.has(object.sectionId))
773
+ errors.push(issue(IssueCode.UnknownSection, "Section reference does not exist.", [object.id]));
607
774
  if ("sectionId" in object &&
608
775
  object.sectionId !== null &&
609
- !sections.has(object.sectionId))
610
- errors.push(issue(IssueCode.UnknownSection, "Section reference does not exist.", [
611
- object.id,
612
- ]));
776
+ sections.has(object.sectionId) &&
777
+ floorById.get(object.sectionId) !== object.floorId)
778
+ errors.push(issue(IssueCode.UnknownSection, "A section and its contents must belong to the same floor.", [object.id]));
779
+ if (object.parentId && parents.has(object.parentId) && floorById.get(object.parentId) !== object.floorId)
780
+ errors.push(issue(IssueCode.InvalidParent, "A collection and its contents must belong to the same floor.", [object.id]));
613
781
  const visited = new Set([object.id]);
614
782
  let parent = object.parentId;
615
783
  let depth = 0;
616
784
  while (parent) {
617
785
  if (visited.has(parent) || !parents.has(parent) || ++depth > 64) {
618
- errors.push(issue(IssueCode.InvalidParent, "Parent must be an existing acyclic collection, within depth 64.", [object.id]));
786
+ errors.push(issue(IssueCode.InvalidParent, "Parent must be an existing acyclic collection, within depth 64.", [
787
+ object.id,
788
+ ]));
619
789
  break;
620
790
  }
621
791
  visited.add(parent);
@@ -623,6 +793,13 @@ export function structuralIssues(document, changedGroups) {
623
793
  }
624
794
  }
625
795
  for (const g of document.seatingGroups) {
796
+ if ("arcFan" in g && g.arcFan?.sectionId) {
797
+ const target = g.arcFan.sectionId;
798
+ if (!sections.has(target))
799
+ errors.push(issue(IssueCode.UnknownSection, "Generated fan section reference does not exist.", [g.id]));
800
+ else if (floorById.get(target) !== g.floorId)
801
+ errors.push(issue(IssueCode.UnknownSection, "A generated fan and its section must belong to the same floor.", [g.id]));
802
+ }
626
803
  visitPolygon(g.boundary);
627
804
  if (g.kind === SeatingKind.Straight || g.kind === SeatingKind.Curved)
628
805
  for (const r of g.rows) {
@@ -634,22 +811,18 @@ export function structuralIssues(document, changedGroups) {
634
811
  for (const s of generateGroup(g))
635
812
  add(s.id);
636
813
  }
637
- const rowOwners = new Map(document.seatingGroups.flatMap((group) => "rows" in group
638
- ? group.rows.map((row) => [row.id, { group, row }])
639
- : []));
814
+ const rowOwners = new Map(document.seatingGroups.flatMap((group) => "rows" in group ? group.rows.map((row) => [row.id, { group, row }]) : []));
640
815
  const assignedRows = new Set();
641
816
  for (const logical of document.segmentedRows ?? []) {
642
817
  add(logical.id);
643
- const sectionId = rowOwners.get(logical.parts[0].rowId)?.group.sectionId;
644
818
  for (let index = 0; index < logical.parts.length; index++) {
645
819
  const part = logical.parts[index];
646
820
  const owner = rowOwners.get(part.rowId);
647
821
  if (!owner ||
648
822
  assignedRows.has(part.rowId) ||
649
823
  !owner.row.layout ||
650
- owner.group.sectionId !== sectionId ||
651
824
  (index === 0 ? part.joinBefore !== null : part.joinBefore === null))
652
- errors.push(issue(IssueCode.InvalidStructure, "Each row part must have independent geometry, one logical owner, a valid join and the same section.", [logical.id, part.rowId]));
825
+ errors.push(issue(IssueCode.InvalidStructure, "Each row part must have independent geometry, one logical owner and a valid join.", [logical.id, part.rowId]));
653
826
  assignedRows.add(part.rowId);
654
827
  }
655
828
  }
@@ -671,10 +844,10 @@ export function structuralIssues(document, changedGroups) {
671
844
  if (errors.length)
672
845
  return errors;
673
846
  const matrices = worldMatrices(document);
674
- const within = (p) => Number.isFinite(p.x) &&
675
- Number.isFinite(p.y) &&
676
- Math.abs(p.x) <= 10000 &&
677
- Math.abs(p.y) <= 10000;
847
+ const within = (p) => Number.isFinite(p.x) && Number.isFinite(p.y) && Math.abs(p.x) <= 10000 && Math.abs(p.y) <= 10000;
848
+ for (const section of document.sections)
849
+ if (section.outline && polygonContour(section.outline).outer.some((point) => !within(point)))
850
+ errors.push(issue(IssueCode.WorldBounds, "Derived section geometry exceeds its safety bounds.", [section.id]));
678
851
  for (const g of document.seatingGroups) {
679
852
  if (changedGroups && !changedGroups.has(g.id))
680
853
  continue;
@@ -688,25 +861,20 @@ export function structuralIssues(document, changedGroups) {
688
861
  if (d.kind === DecorationKind.Line)
689
862
  points = d.pointsM;
690
863
  else if (d.kind === DecorationKind.Polygon)
691
- points = [...d.boundary.outer, ...d.boundary.holes.flat()];
692
- else if ((d.kind === AreaKind.GeneralAdmission || d.kind === AreaKind.Booth) &&
693
- d.shape.kind === ShapeKind.Polygon)
694
- points = [...d.shape.boundary.outer, ...d.shape.boundary.holes.flat()];
864
+ points = [...polygonContour(d.boundary).outer, ...d.boundary.holes.flat()];
865
+ else if ((d.kind === AreaKind.GeneralAdmission || d.kind === AreaKind.Booth) && d.shape.kind === ShapeKind.Polygon)
866
+ points = [...polygonContour(d.shape.boundary).outer, ...d.shape.boundary.holes.flat()];
695
867
  else {
696
868
  const w = d.kind === DecorationKind.Circle
697
869
  ? d.radiusM * 2
698
- : (d.kind === AreaKind.GeneralAdmission ||
699
- d.kind === AreaKind.Booth) &&
700
- d.shape.kind === ShapeKind.Rectangle
870
+ : (d.kind === AreaKind.GeneralAdmission || d.kind === AreaKind.Booth) && d.shape.kind === ShapeKind.Rectangle
701
871
  ? d.shape.widthM
702
872
  : "sizeM" in d
703
873
  ? d.sizeM.width
704
874
  : 0;
705
875
  const h = d.kind === DecorationKind.Circle
706
876
  ? d.radiusM * 2
707
- : (d.kind === AreaKind.GeneralAdmission ||
708
- d.kind === AreaKind.Booth) &&
709
- d.shape.kind === ShapeKind.Rectangle
877
+ : (d.kind === AreaKind.GeneralAdmission || d.kind === AreaKind.Booth) && d.shape.kind === ShapeKind.Rectangle
710
878
  ? d.shape.heightM
711
879
  : "sizeM" in d
712
880
  ? d.sizeM.height
@@ -726,9 +894,7 @@ export function structuralIssues(document, changedGroups) {
726
894
  export function parsePhysicalDocument(input) {
727
895
  let raw = input;
728
896
  try {
729
- if (typeof raw !== "string" &&
730
- new TextEncoder().encode(JSON.stringify(raw)).byteLength >
731
- DocumentLimits.JsonBytes)
897
+ if (typeof raw !== "string" && new TextEncoder().encode(JSON.stringify(raw)).byteLength > DocumentLimits.JsonBytes)
732
898
  return {
733
899
  status: DocumentParseStatus.Rejected,
734
900
  issues: [issue(IssueCode.Limit, "Document exceeds 64MiB.", [])],
@@ -745,9 +911,7 @@ export function parsePhysicalDocument(input) {
745
911
  catch {
746
912
  return {
747
913
  status: DocumentParseStatus.Rejected,
748
- issues: [
749
- issue(IssueCode.InvalidJson, "Document is not readable JSON.", []),
750
- ],
914
+ issues: [issue(IssueCode.InvalidJson, "Document is not readable JSON.", [])],
751
915
  };
752
916
  }
753
917
  const result = documentSchema.safeParse(raw);
@@ -756,9 +920,7 @@ export function parsePhysicalDocument(input) {
756
920
  status: DocumentParseStatus.Rejected,
757
921
  issues: result.error.issues
758
922
  .slice(0, 50)
759
- .map((e) => issue(e.path[0] === "schemaVersion"
760
- ? IssueCode.UnsupportedVersion
761
- : IssueCode.InvalidStructure, e.message, [], e.path.map(String).join("."))),
923
+ .map((e) => issue(e.path[0] === "schemaVersion" ? IssueCode.UnsupportedVersion : IssueCode.InvalidStructure, e.message, [], e.path.map(String).join("."))),
762
924
  };
763
925
  const document = result.data;
764
926
  const errors = structuralIssues(document);
@@ -769,17 +931,13 @@ export function parsePhysicalDocument(input) {
769
931
  /** Prepared entity schemas have already passed. Recheck global references and only changed world geometry. */
770
932
  export function validatePreparedDocument(document, changedGroups) {
771
933
  const { seatingGroups, ...metadata } = document;
772
- const result = documentSchema
773
- .omit({ seatingGroups: true })
774
- .safeParse(metadata);
934
+ const result = documentSchema.omit({ seatingGroups: true }).safeParse(metadata);
775
935
  if (!result.success)
776
936
  return result.error.issues
777
937
  .slice(0, 50)
778
938
  .map((error) => issue(IssueCode.InvalidStructure, error.message, [], error.path.map(String).join(".")));
779
939
  if (seatingGroups.length > DocumentLimits.PhysicalSeats)
780
- return [
781
- issue(IssueCode.Limit, "Too many seating owners.", [document.mapId]),
782
- ];
940
+ return [issue(IssueCode.Limit, "Too many seating owners.", [document.mapId])];
783
941
  return structuralIssues(document, changedGroups);
784
942
  }
785
943
  export function serializePhysicalDocument(document) {