venuekit 0.10.1 → 0.10.3
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 -1
- package/dist/{chunk-4FCSKCFJ.js → chunk-TDC5G7L7.js} +53 -23
- package/dist/{chunk-LFRA3GBP.cjs → chunk-UWCMN6Q7.cjs} +54 -24
- package/dist/index.cjs +12 -2
- package/dist/index.d.cts +8 -3
- package/dist/index.d.ts +8 -3
- package/dist/index.js +11 -1
- package/dist/{place-types-CeTjPHTF.d.cts → place-types-Dc0eabAi.d.cts} +12 -1
- package/dist/{place-types-CeTjPHTF.d.ts → place-types-Dc0eabAi.d.ts} +12 -1
- package/dist/react.cjs +407 -251
- package/dist/react.d.cts +16 -4
- package/dist/react.d.ts +16 -4
- package/dist/react.js +219 -63
- package/package.json +1 -1
package/dist/react.cjs
CHANGED
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
|
|
46
46
|
|
|
47
47
|
|
|
48
|
-
var
|
|
48
|
+
var _chunkUWCMN6Q7cjs = require('./chunk-UWCMN6Q7.cjs');
|
|
49
49
|
|
|
50
50
|
// ../canvas/src/camera.ts
|
|
51
51
|
var MIN_ZOOM = 0.05;
|
|
@@ -133,7 +133,7 @@ function reduceGesture(state, camera, viewport, input) {
|
|
|
133
133
|
const [a, b] = list2;
|
|
134
134
|
return {
|
|
135
135
|
// Con dos dedos ya no hay tap posible: `moved` queda en true a propósito.
|
|
136
|
-
state: { pointers, origin: null, moved: true, pinchDistance:
|
|
136
|
+
state: { pointers, origin: null, moved: true, pinchDistance: _chunkUWCMN6Q7cjs.distance.call(void 0, a, b) },
|
|
137
137
|
camera
|
|
138
138
|
};
|
|
139
139
|
}
|
|
@@ -146,7 +146,7 @@ function reduceGesture(state, camera, viewport, input) {
|
|
|
146
146
|
const [a, b] = list2;
|
|
147
147
|
const previousA = state.pointers[a.id];
|
|
148
148
|
const previousB = state.pointers[b.id];
|
|
149
|
-
const nextDistance =
|
|
149
|
+
const nextDistance = _chunkUWCMN6Q7cjs.distance.call(void 0, a, b);
|
|
150
150
|
const previousDistance = state.pinchDistance;
|
|
151
151
|
if (!previousA || !previousB || !previousDistance || previousDistance < 1e-6 || nextDistance < 1e-6) {
|
|
152
152
|
return { state: { ...state, pointers, pinchDistance: nextDistance }, camera };
|
|
@@ -159,7 +159,7 @@ function reduceGesture(state, camera, viewport, input) {
|
|
|
159
159
|
camera: panBy(zoomed, nextMid.x - previousMid.x, nextMid.y - previousMid.y)
|
|
160
160
|
};
|
|
161
161
|
}
|
|
162
|
-
const movedEnough = state.moved || state.origin !== null &&
|
|
162
|
+
const movedEnough = state.moved || state.origin !== null && _chunkUWCMN6Q7cjs.distance.call(void 0, state.origin, pointer) > TAP_SLOP;
|
|
163
163
|
if (!movedEnough) return { state: { ...state, pointers }, camera };
|
|
164
164
|
return {
|
|
165
165
|
state: { ...state, pointers, moved: true },
|
|
@@ -262,7 +262,7 @@ function centredBox(at, width, height, rotation) {
|
|
|
262
262
|
return { minX: at.x - hw, minY: at.y - hh, maxX: at.x + hw, maxY: at.y + hh };
|
|
263
263
|
}
|
|
264
264
|
function tableBodyBox(table) {
|
|
265
|
-
const size =
|
|
265
|
+
const size = _chunkUWCMN6Q7cjs.tableSize.call(void 0, table.shape, table.places);
|
|
266
266
|
const k = _nullishCoalesce(table.scale, () => ( 1));
|
|
267
267
|
const [w, h] = "radius" in size ? [size.radius * 2 * k, size.radius * 2 * k] : [size.width * k, size.height * k];
|
|
268
268
|
return centredBox(table.transform, w, h, table.transform.rotation);
|
|
@@ -270,13 +270,21 @@ function tableBodyBox(table) {
|
|
|
270
270
|
function elementBounds(_layout, element) {
|
|
271
271
|
return pieceBounds(element);
|
|
272
272
|
}
|
|
273
|
+
var boundsCache = /* @__PURE__ */ new WeakMap();
|
|
273
274
|
function pieceBounds(element) {
|
|
274
|
-
|
|
275
|
+
const cached = boundsCache.get(element);
|
|
276
|
+
if (cached !== void 0) return cached;
|
|
277
|
+
const box = computeBounds(element);
|
|
278
|
+
boundsCache.set(element, box);
|
|
279
|
+
return box;
|
|
280
|
+
}
|
|
281
|
+
function computeBounds(element) {
|
|
282
|
+
if (element.type === "zone") return _chunkUWCMN6Q7cjs.zoneBounds.call(void 0, element);
|
|
275
283
|
if (element.type === "landmark") {
|
|
276
284
|
return centredBox(element.transform, element.width, element.height, element.transform.rotation);
|
|
277
285
|
}
|
|
278
|
-
const units = element.type === "seatBlock" ?
|
|
279
|
-
const own = units.length > 0 ?
|
|
286
|
+
const units = element.type === "seatBlock" ? _chunkUWCMN6Q7cjs.expandSeatBlock.call(void 0, element) : _chunkUWCMN6Q7cjs.expandTable.call(void 0, element);
|
|
287
|
+
const own = units.length > 0 ? _chunkUWCMN6Q7cjs.bbox.call(void 0, units.map((u) => ({ x: u.x, y: u.y }))) : null;
|
|
280
288
|
if (element.type === "table") {
|
|
281
289
|
const body = tableBodyBox(element);
|
|
282
290
|
return own ? {
|
|
@@ -288,13 +296,17 @@ function pieceBounds(element) {
|
|
|
288
296
|
}
|
|
289
297
|
return own;
|
|
290
298
|
}
|
|
291
|
-
|
|
299
|
+
var EDIT_HIT_SLOP_PX = 4;
|
|
300
|
+
function elementAt(layout, screen, camera, viewport, options = {}) {
|
|
292
301
|
const world = screenToWorld(camera, viewport, screen);
|
|
302
|
+
const slop = (_nullishCoalesce(options.slopPx, () => ( 0))) / camera.zoom;
|
|
293
303
|
for (let i = layout.elements.length - 1; i >= 0; i -= 1) {
|
|
294
304
|
const element = layout.elements[i];
|
|
295
305
|
const box = elementBounds(layout, element);
|
|
296
|
-
|
|
297
|
-
|
|
306
|
+
const ownsRadius = element.type === "seatBlock" || element.type === "table" && element.mode === "perPlace";
|
|
307
|
+
const pad = element.type === "seatBlock" || element.type === "table" ? (ownsRadius ? _nullishCoalesce(_optionalChain([options, 'access', _ => _.radii, 'optionalAccess', _2 => _2.get, 'call', _3 => _3(element.id)]), () => ( 0)) : 0) + slop : 0;
|
|
308
|
+
if (box && world.x >= box.minX - pad && world.x <= box.maxX + pad && world.y >= box.minY - pad && world.y <= box.maxY + pad) {
|
|
309
|
+
if (element.type === "zone" && !_chunkUWCMN6Q7cjs.pointInZone.call(void 0, element, world)) continue;
|
|
298
310
|
return element;
|
|
299
311
|
}
|
|
300
312
|
}
|
|
@@ -328,7 +340,7 @@ function unitRadii(layout) {
|
|
|
328
340
|
out.set(el.id, DEFAULT_UNIT_RADIUS * k);
|
|
329
341
|
continue;
|
|
330
342
|
}
|
|
331
|
-
const size =
|
|
343
|
+
const size = _chunkUWCMN6Q7cjs.tableSize.call(void 0, el.shape, el.places);
|
|
332
344
|
out.set(el.id, ("radius" in size ? size.radius : Math.max(size.width, size.height) / 2) * k);
|
|
333
345
|
}
|
|
334
346
|
}
|
|
@@ -357,13 +369,13 @@ function buildScene(input) {
|
|
|
357
369
|
})
|
|
358
370
|
);
|
|
359
371
|
const colorOf = (ref) => ref === null ? null : _nullishCoalesce(placeTypeColors.get(ref), () => ( null));
|
|
360
|
-
const dim = (ref) => mode === "map" && (colorOf(ref) === null || input.focusRef != null && ref !== input.focusRef || ref !== null && !!_optionalChain([input, 'access',
|
|
372
|
+
const dim = (ref) => mode === "map" && (colorOf(ref) === null || input.focusRef != null && ref !== input.focusRef || ref !== null && !!_optionalChain([input, 'access', _4 => _4.dimmedRefs, 'optionalAccess', _5 => _5.has, 'call', _6 => _6(ref)]));
|
|
361
373
|
const bg = layout.meta.background;
|
|
362
374
|
const background = bg ? { src: bg.src, box: { minX: bg.x, minY: bg.y, maxX: bg.x + bg.width, maxY: bg.y + bg.height }, opacity: bg.opacity } : null;
|
|
363
375
|
const shapes = [];
|
|
364
376
|
const labels = [];
|
|
365
377
|
const chip = { fill: palette.shapeFill, stroke: palette.shape };
|
|
366
|
-
const refOf = (el) => el.type === "landmark" ? null : _optionalChain([el, 'access',
|
|
378
|
+
const refOf = (el) => el.type === "landmark" ? null : _optionalChain([el, 'access', _7 => _7.placeType, 'optionalAccess', _8 => _8.ref]) || null;
|
|
367
379
|
for (const el of layout.elements) {
|
|
368
380
|
if (el.type === "landmark") {
|
|
369
381
|
const b = centredBox(el.transform, el.width, el.height, el.transform.rotation);
|
|
@@ -421,24 +433,24 @@ function buildScene(input) {
|
|
|
421
433
|
const ref = refOf(el);
|
|
422
434
|
const color = _nullishCoalesce(colorOf(ref), () => ( palette.unassigned));
|
|
423
435
|
const b = centredBox(el.transform, el.width, el.height, el.transform.rotation);
|
|
424
|
-
const strong = mode === "map" && ref !== null && !!_optionalChain([input, 'access',
|
|
436
|
+
const strong = mode === "map" && ref !== null && !!_optionalChain([input, 'access', _9 => _9.highlightRefs, 'optionalAccess', _10 => _10.has, 'call', _11 => _11(ref)]);
|
|
425
437
|
const paint2 = {
|
|
426
438
|
fill: translucent(color, strong ? palette.zoneSelectedAlpha : palette.zoneAlpha),
|
|
427
439
|
stroke: color,
|
|
428
440
|
strokeWidth: strong ? 2.5 : 1.5,
|
|
429
441
|
...dim(ref) ? { alpha: DIMMED_ALPHA } : {}
|
|
430
442
|
};
|
|
431
|
-
const outline =
|
|
443
|
+
const outline = _chunkUWCMN6Q7cjs.zoneOutline.call(void 0, el, ZONE_CORNER);
|
|
432
444
|
if (outline.length > 0) shapes.push({ kind: "polygon", points: outline, ...paint2 });
|
|
433
445
|
else shapes.push({ kind: "rect", x: b.minX, y: b.minY, width: b.maxX - b.minX, height: b.maxY - b.minY, cornerRadius: ZONE_CORNER, ...paint2 });
|
|
434
|
-
const room =
|
|
446
|
+
const room = _chunkUWCMN6Q7cjs.zoneLabelSize.call(void 0, el);
|
|
435
447
|
const swap = el.transform.rotation === 90 || el.transform.rotation === 270;
|
|
436
448
|
const roomW = (swap ? room.height : room.width) * camera.zoom;
|
|
437
449
|
const roomH = (swap ? room.width : room.height) * camera.zoom;
|
|
438
|
-
const text = colorOf(ref) !== null ? _nullishCoalesce(_optionalChain([el, 'access',
|
|
450
|
+
const text = colorOf(ref) !== null ? _nullishCoalesce(_optionalChain([el, 'access', _12 => _12.placeType, 'optionalAccess', _13 => _13.name]), () => ( "")) : mode === "designer" ? input.unassignedLabel : "";
|
|
439
451
|
if (text && mode === "map") {
|
|
440
452
|
const maxWidth = roomW - LABEL_INSET_PX;
|
|
441
|
-
const price = ref !== null ? _optionalChain([input, 'access',
|
|
453
|
+
const price = ref !== null ? _optionalChain([input, 'access', _14 => _14.placeTypePrices, 'optionalAccess', _15 => _15.get, 'call', _16 => _16(ref)]) : void 0;
|
|
442
454
|
const twoLines = !!price && roomH >= TWO_LINES_PX;
|
|
443
455
|
const shift = twoLines ? 9 / camera.zoom : 0;
|
|
444
456
|
const maxHeight = twoLines ? void 0 : roomH - LABEL_INSET_PX;
|
|
@@ -481,16 +493,12 @@ function buildScene(input) {
|
|
|
481
493
|
}
|
|
482
494
|
}
|
|
483
495
|
}
|
|
484
|
-
const
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
else byElement.set(u.elementId, [u]);
|
|
489
|
-
}
|
|
490
|
-
for (const el of mode === "designer" ? layout.elements : []) {
|
|
491
|
-
if (el.type === "landmark" || colorOf(refOf(el)) !== null) continue;
|
|
496
|
+
const chipped = mode === "designer" ? layout.elements.filter((el) => el.type !== "landmark" && colorOf(refOf(el)) === null) : [];
|
|
497
|
+
const byElement = new Map(chipped.map((el) => [el.id, []]));
|
|
498
|
+
if (byElement.size > 0) for (const u of units) _optionalChain([byElement, 'access', _17 => _17.get, 'call', _18 => _18(u.elementId), 'optionalAccess', _19 => _19.push, 'call', _20 => _20(u)]);
|
|
499
|
+
for (const el of chipped) {
|
|
492
500
|
const own = byElement.get(el.id);
|
|
493
|
-
if (!own) continue;
|
|
501
|
+
if (!own || own.length === 0) continue;
|
|
494
502
|
let minX = Infinity, minY = Infinity, maxX = -Infinity, maxY = -Infinity;
|
|
495
503
|
for (const u of own) {
|
|
496
504
|
if (u.x < minX) minX = u.x;
|
|
@@ -530,7 +538,7 @@ function buildScene(input) {
|
|
|
530
538
|
if (!visible.has(u.id)) continue;
|
|
531
539
|
visibleUnitIds.push(u.id);
|
|
532
540
|
const color = _nullishCoalesce(colorOf(u.placeTypeRef), () => ( palette.unassigned));
|
|
533
|
-
const state = mode === "designer" && _optionalChain([input, 'access',
|
|
541
|
+
const state = mode === "designer" && _optionalChain([input, 'access', _21 => _21.locked, 'optionalAccess', _22 => _22.has, 'call', _23 => _23(u.id)]) ? "taken" : _nullishCoalesce(states.get(u.id), () => ( "free"));
|
|
534
542
|
const mapPaint = mode === "map" ? mapUnitPaint(state, color, palette) : null;
|
|
535
543
|
const paint2 = mapPaint ? { fill: mapPaint.fill, stroke: mapPaint.stroke, strokeWidth: mapPaint.strokeWidth } : unitPaint(state, color, palette);
|
|
536
544
|
const dimmed = dim(u.placeTypeRef);
|
|
@@ -542,7 +550,7 @@ function buildScene(input) {
|
|
|
542
550
|
const size = Math.min(13, Math.max(8, radius * camera.zoom * 0.9));
|
|
543
551
|
labels.push({ x: u.x, y: u.y, text: number, size, weight: 700, color: mapPaint.label, align: "centre", maxWidth: radius * camera.zoom * 1.7 });
|
|
544
552
|
}
|
|
545
|
-
if (_optionalChain([el, 'optionalAccess',
|
|
553
|
+
if (_optionalChain([el, 'optionalAccess', _24 => _24.type]) === "table" && el.mode === "whole" && el.shape === "rect") {
|
|
546
554
|
const b = tableBodyBox(el);
|
|
547
555
|
shapes.push({ kind: "rect", x: b.minX, y: b.minY, width: b.maxX - b.minX, height: b.maxY - b.minY, ...paint2, ...alpha });
|
|
548
556
|
continue;
|
|
@@ -621,7 +629,7 @@ function paint(ctx, fill, stroke, strokeWidth, zoom) {
|
|
|
621
629
|
}
|
|
622
630
|
function drawBackground(ctx, scene, images) {
|
|
623
631
|
const bg = scene.background;
|
|
624
|
-
const bitmap = bg ? _optionalChain([images, 'optionalAccess',
|
|
632
|
+
const bitmap = bg ? _optionalChain([images, 'optionalAccess', _25 => _25.get, 'call', _26 => _26(bg.src)]) : void 0;
|
|
625
633
|
if (!bg || !bitmap) return;
|
|
626
634
|
const previous = ctx.globalAlpha;
|
|
627
635
|
ctx.globalAlpha = bg.opacity;
|
|
@@ -730,7 +738,7 @@ function hitUnit(input) {
|
|
|
730
738
|
const unit = unitById.get(id);
|
|
731
739
|
if (!unit) continue;
|
|
732
740
|
const radius = _nullishCoalesce(radii.get(unit.elementId), () => ( 0));
|
|
733
|
-
const d =
|
|
741
|
+
const d = _chunkUWCMN6Q7cjs.distance.call(void 0, world, unit);
|
|
734
742
|
if (d > reach + radius) continue;
|
|
735
743
|
const score = d - radius;
|
|
736
744
|
if (score < bestScore) {
|
|
@@ -755,7 +763,7 @@ function cornerPoint(box, corner) {
|
|
|
755
763
|
var clamp = (v, min, max) => Math.min(max, Math.max(min, v));
|
|
756
764
|
function resizeElement(el, corner, from, to) {
|
|
757
765
|
if (el.type === "zone" || el.type === "landmark") {
|
|
758
|
-
const box2 = el.type === "zone" ?
|
|
766
|
+
const box2 = el.type === "zone" ? _chunkUWCMN6Q7cjs.zoneBounds.call(void 0, el) : centredBox(el.transform, el.width, el.height, el.transform.rotation);
|
|
759
767
|
const east = corner === "ne" || corner === "se";
|
|
760
768
|
const south = corner === "se" || corner === "sw";
|
|
761
769
|
const start = cornerPoint(box2, corner);
|
|
@@ -766,11 +774,11 @@ function resizeElement(el, corner, from, to) {
|
|
|
766
774
|
const swap = el.transform.rotation === 90 || el.transform.rotation === 270;
|
|
767
775
|
const [w, h] = swap ? [worldH, worldW] : [worldW, worldH];
|
|
768
776
|
if (el.type === "zone" && (_nullishCoalesce(el.curve, () => ( 0))) > 0) {
|
|
769
|
-
const sized =
|
|
777
|
+
const sized = _chunkUWCMN6Q7cjs.zoneWithLocalSize.call(void 0, el, w, h);
|
|
770
778
|
const width = Math.round(clamp(sized.width, RESIZE_MIN, RESIZE_MAX));
|
|
771
779
|
const height = Math.round(clamp(sized.height, RESIZE_MIN, RESIZE_MAX));
|
|
772
780
|
const next = { ...sized, width, height };
|
|
773
|
-
const b =
|
|
781
|
+
const b = _chunkUWCMN6Q7cjs.zoneBounds.call(void 0, next);
|
|
774
782
|
const dx = east ? box2.minX - b.minX : box2.maxX - b.maxX;
|
|
775
783
|
const dy = south ? box2.minY - b.minY : box2.maxY - b.maxY;
|
|
776
784
|
return { ...next, transform: { ...el.transform, x: el.transform.x + dx, y: el.transform.y + dy } };
|
|
@@ -782,11 +790,11 @@ function resizeElement(el, corner, from, to) {
|
|
|
782
790
|
const box = pieceBounds(el);
|
|
783
791
|
if (!box) return el;
|
|
784
792
|
const centre = { x: (box.minX + box.maxX) / 2, y: (box.minY + box.maxY) / 2 };
|
|
785
|
-
const reach =
|
|
793
|
+
const reach = _chunkUWCMN6Q7cjs.distance.call(void 0, from, centre);
|
|
786
794
|
if (reach < 1) return el;
|
|
787
|
-
const scale =
|
|
795
|
+
const scale = _chunkUWCMN6Q7cjs.snapScale.call(void 0, (_nullishCoalesce(el.scale, () => ( 1))) * (_chunkUWCMN6Q7cjs.distance.call(void 0, to, centre) / reach), RESIZE_SCALE_STEP);
|
|
788
796
|
if (scale === (_nullishCoalesce(el.scale, () => ( 1)))) return el;
|
|
789
|
-
return
|
|
797
|
+
return _chunkUWCMN6Q7cjs.scalePiece.call(void 0, el, scale);
|
|
790
798
|
}
|
|
791
799
|
|
|
792
800
|
// ../canvas/src/a11y.ts
|
|
@@ -830,7 +838,7 @@ function nearestInDirection(nodes, from, direction) {
|
|
|
830
838
|
const d = Math.hypot(dx, dy);
|
|
831
839
|
if (!best2 || d < best2.d) best2 = { id: n.id, d };
|
|
832
840
|
}
|
|
833
|
-
return _nullishCoalesce(_optionalChain([best2, 'optionalAccess',
|
|
841
|
+
return _nullishCoalesce(_optionalChain([best2, 'optionalAccess', _27 => _27.id]), () => ( null));
|
|
834
842
|
}
|
|
835
843
|
function navigateA11y(nodes, fromId, direction) {
|
|
836
844
|
const from = nodes.find((n) => n.id === fromId);
|
|
@@ -866,10 +874,10 @@ function initialEditGesture() {
|
|
|
866
874
|
return { g: initialGestureState, press: null };
|
|
867
875
|
}
|
|
868
876
|
function isArmed(state) {
|
|
869
|
-
return !!_optionalChain([state, 'access',
|
|
877
|
+
return !!_optionalChain([state, 'access', _28 => _28.press, 'optionalAccess', _29 => _29.armed]) && state.press.movable !== null;
|
|
870
878
|
}
|
|
871
879
|
function isMarqueeArmed(state) {
|
|
872
|
-
return !!_optionalChain([state, 'access',
|
|
880
|
+
return !!_optionalChain([state, 'access', _30 => _30.press, 'optionalAccess', _31 => _31.armed]) && !!state.press.marquee;
|
|
873
881
|
}
|
|
874
882
|
var sample = (p) => ({ id: p.id, x: p.x, y: p.y });
|
|
875
883
|
function reduceEditGesture(state, camera, viewport, input) {
|
|
@@ -896,9 +904,9 @@ function reduceEditGesture(state, camera, viewport, input) {
|
|
|
896
904
|
if (input.kind === "down") {
|
|
897
905
|
const r2 = delegate(state.g, { type: "pointerdown", pointer: sample(p) });
|
|
898
906
|
if (Object.keys(r2.state.pointers).length >= 2) {
|
|
899
|
-
const effects2 = _optionalChain([press, 'optionalAccess',
|
|
900
|
-
if (_optionalChain([press, 'optionalAccess',
|
|
901
|
-
if (_optionalChain([press, 'optionalAccess',
|
|
907
|
+
const effects2 = _optionalChain([press, 'optionalAccess', _32 => _32.moving]) && press.movable ? [{ type: "moveEnd", elementId: press.movable }] : [];
|
|
908
|
+
if (_optionalChain([press, 'optionalAccess', _33 => _33.resize, 'optionalAccess', _34 => _34.active]) && press.elementId) effects2.push({ type: "resizeCancel", elementId: press.elementId });
|
|
909
|
+
if (_optionalChain([press, 'optionalAccess', _35 => _35.marquee, 'optionalAccess', _36 => _36.active])) effects2.push({ type: "marqueeCancel" });
|
|
902
910
|
return {
|
|
903
911
|
state: {
|
|
904
912
|
g: r2.state,
|
|
@@ -953,9 +961,9 @@ function reduceEditGesture(state, camera, viewport, input) {
|
|
|
953
961
|
};
|
|
954
962
|
}
|
|
955
963
|
if (input.kind === "move") {
|
|
956
|
-
if (_optionalChain([press, 'optionalAccess',
|
|
964
|
+
if (_optionalChain([press, 'optionalAccess', _37 => _37.marquee]) && Object.keys(state.g.pointers).length === 1) {
|
|
957
965
|
const { origin } = press.marquee;
|
|
958
|
-
const active = press.marquee.active || press.armed ||
|
|
966
|
+
const active = press.marquee.active || press.armed || _chunkUWCMN6Q7cjs.distance.call(void 0, origin, p) > TAP_SLOP;
|
|
959
967
|
if (!active) return { state, camera, effects: [] };
|
|
960
968
|
return {
|
|
961
969
|
state: { g: state.g, press: { ...press, last: { x: p.x, y: p.y }, marquee: { origin, active: true } } },
|
|
@@ -963,7 +971,7 @@ function reduceEditGesture(state, camera, viewport, input) {
|
|
|
963
971
|
effects: [{ type: "marquee", from: screenToWorld(camera, viewport, origin), to: screenToWorld(camera, viewport, p) }]
|
|
964
972
|
};
|
|
965
973
|
}
|
|
966
|
-
if (_optionalChain([press, 'optionalAccess',
|
|
974
|
+
if (_optionalChain([press, 'optionalAccess', _38 => _38.resize]) && press.elementId) {
|
|
967
975
|
if (Object.keys(state.g.pointers).length !== 1) return { state, camera, effects: [] };
|
|
968
976
|
const { corner, from } = press.resize;
|
|
969
977
|
return {
|
|
@@ -973,7 +981,7 @@ function reduceEditGesture(state, camera, viewport, input) {
|
|
|
973
981
|
};
|
|
974
982
|
}
|
|
975
983
|
if (press && press.movable && Object.keys(state.g.pointers).length === 1) {
|
|
976
|
-
const dragging = press.pointerType === "touch" ? press.armed : press.moving ||
|
|
984
|
+
const dragging = press.pointerType === "touch" ? press.armed : press.moving || _chunkUWCMN6Q7cjs.distance.call(void 0,
|
|
977
985
|
_nullishCoalesce(state.g.origin, () => ( press.last)),
|
|
978
986
|
p
|
|
979
987
|
) > TAP_SLOP;
|
|
@@ -989,7 +997,7 @@ function reduceEditGesture(state, camera, viewport, input) {
|
|
|
989
997
|
if (press.pointerType !== "touch") return { state, camera, effects: [] };
|
|
990
998
|
}
|
|
991
999
|
const r2 = delegate(state.g, { type: "pointermove", pointer: sample(p) });
|
|
992
|
-
const lostPiece = _optionalChain([press, 'optionalAccess',
|
|
1000
|
+
const lostPiece = _optionalChain([press, 'optionalAccess', _39 => _39.movable]) && r2.state.moved && !press.moving;
|
|
993
1001
|
return {
|
|
994
1002
|
state: { g: r2.state, press: press && lostPiece ? { ...press, movable: null } : press },
|
|
995
1003
|
camera: r2.camera,
|
|
@@ -999,19 +1007,19 @@ function reduceEditGesture(state, camera, viewport, input) {
|
|
|
999
1007
|
const r = delegate(state.g, { type: input.kind === "up" ? "pointerup" : "pointercancel", pointer: sample(p) });
|
|
1000
1008
|
const idle = Object.keys(r.state.pointers).length === 0;
|
|
1001
1009
|
const effects = [];
|
|
1002
|
-
if (_optionalChain([press, 'optionalAccess',
|
|
1010
|
+
if (_optionalChain([press, 'optionalAccess', _40 => _40.resize]) && press.elementId) {
|
|
1003
1011
|
if (press.resize.active) {
|
|
1004
1012
|
effects.push({ type: input.kind === "up" ? "resizeEnd" : "resizeCancel", elementId: press.elementId });
|
|
1005
1013
|
}
|
|
1006
1014
|
return { state: { g: r.state, press: idle ? null : { ...press, resize: void 0 } }, camera: r.camera, effects };
|
|
1007
1015
|
}
|
|
1008
|
-
if (_optionalChain([press, 'optionalAccess',
|
|
1016
|
+
if (_optionalChain([press, 'optionalAccess', _41 => _41.marquee, 'optionalAccess', _42 => _42.active])) {
|
|
1009
1017
|
const from = screenToWorld(camera, viewport, press.marquee.origin);
|
|
1010
1018
|
const to = screenToWorld(camera, viewport, press.last);
|
|
1011
1019
|
effects.push(input.kind === "up" ? { type: "marqueeEnd", from, to, additive: !!press.additive } : { type: "marqueeCancel" });
|
|
1012
1020
|
return { state: { g: r.state, press: idle ? null : { ...press, marquee: void 0, canMarquee: false } }, camera: r.camera, effects };
|
|
1013
1021
|
}
|
|
1014
|
-
if (_optionalChain([press, 'optionalAccess',
|
|
1022
|
+
if (_optionalChain([press, 'optionalAccess', _43 => _43.moving]) && press.movable) effects.push({ type: "moveEnd", elementId: press.movable });
|
|
1015
1023
|
else if (r.tap && press) {
|
|
1016
1024
|
const world = screenToWorld(camera, viewport, r.tap);
|
|
1017
1025
|
effects.push(press.additive ? { type: "tap", world, elementId: press.elementId, additive: true } : { type: "tap", world, elementId: press.elementId });
|
|
@@ -1144,11 +1152,11 @@ function snapMove(moving, others, threshold, opts = {}) {
|
|
|
1144
1152
|
const pick = (axis) => best([...alignCandidates(moving, others, axis, threshold, opts.sheet), ...gapCandidates(moving, others, axis, threshold)]);
|
|
1145
1153
|
const x = pick("x");
|
|
1146
1154
|
const y = pick("y");
|
|
1147
|
-
const dx = _nullishCoalesce(_optionalChain([x, 'optionalAccess',
|
|
1148
|
-
const dy = _nullishCoalesce(_optionalChain([y, 'optionalAccess',
|
|
1155
|
+
const dx = _nullishCoalesce(_optionalChain([x, 'optionalAccess', _44 => _44.delta]), () => ( 0));
|
|
1156
|
+
const dy = _nullishCoalesce(_optionalChain([y, 'optionalAccess', _45 => _45.delta]), () => ( 0));
|
|
1149
1157
|
const moved = shiftBox(moving, dx, dy);
|
|
1150
1158
|
const guides = alignmentGuides(moved, others, opts.sheet);
|
|
1151
|
-
const gaps = [..._nullishCoalesce(_optionalChain([x, 'optionalAccess',
|
|
1159
|
+
const gaps = [..._nullishCoalesce(_optionalChain([x, 'optionalAccess', _46 => _46.gaps, 'call', _47 => _47(moved)]), () => ( [])), ..._nullishCoalesce(_optionalChain([y, 'optionalAccess', _48 => _48.gaps, 'call', _49 => _49(moved)]), () => ( []))];
|
|
1152
1160
|
return { dx, dy, guides, gaps };
|
|
1153
1161
|
}
|
|
1154
1162
|
function snapResize(box, edges, others, threshold, opts = {}) {
|
|
@@ -1271,7 +1279,7 @@ function focusBox(layout, units, radii, ref) {
|
|
|
1271
1279
|
maxY = Math.max(maxY, u.y + r);
|
|
1272
1280
|
}
|
|
1273
1281
|
for (const el of layout.elements) {
|
|
1274
|
-
if (el.type !== "zone" || _optionalChain([el, 'access',
|
|
1282
|
+
if (el.type !== "zone" || _optionalChain([el, 'access', _50 => _50.placeType, 'optionalAccess', _51 => _51.ref]) !== ref) continue;
|
|
1275
1283
|
const b = pieceBounds(el);
|
|
1276
1284
|
if (!b) continue;
|
|
1277
1285
|
minX = Math.min(minX, b.minX);
|
|
@@ -1326,6 +1334,8 @@ var es = {
|
|
|
1326
1334
|
mapLabel: "Plano del lugar. Movete con las flechas y eleg\xED con Enter.",
|
|
1327
1335
|
zoomIn: "Acercar",
|
|
1328
1336
|
zoomOut: "Alejar",
|
|
1337
|
+
zoomToChoose: "Hay {n} lugares a la vista. Acerc\xE1 el mapa para elegir uno.",
|
|
1338
|
+
wheelHint: "Para acercar el mapa, us\xE1 Ctrl + rueda o los botones + y \u2212",
|
|
1329
1339
|
overviewMapLabel: "Plano del lugar. Toc\xE1 una entrada en el mapa o elegila en la lista de abajo.",
|
|
1330
1340
|
overviewList: "Entradas del lugar",
|
|
1331
1341
|
soldOut: "Agotada",
|
|
@@ -1369,6 +1379,8 @@ var en = {
|
|
|
1369
1379
|
mapLabel: "Venue map. Move with the arrow keys and choose with Enter.",
|
|
1370
1380
|
zoomIn: "Zoom in",
|
|
1371
1381
|
zoomOut: "Zoom out",
|
|
1382
|
+
zoomToChoose: "There are {n} spots in view. Zoom in to choose one.",
|
|
1383
|
+
wheelHint: "To zoom the map, use Ctrl + scroll or the + and \u2212 buttons",
|
|
1372
1384
|
overviewMapLabel: "Venue map. Tap a ticket on the map or choose it from the list below.",
|
|
1373
1385
|
overviewList: "Tickets at the venue",
|
|
1374
1386
|
soldOut: "Sold out",
|
|
@@ -1481,11 +1493,19 @@ var PICKER_CSS = `
|
|
|
1481
1493
|
min-height:300px;max-height:70vh;background:var(--vk-surface);
|
|
1482
1494
|
border:1px solid var(--vk-line);border-radius:var(--vk-radius-lg);overflow:hidden;touch-action:none}
|
|
1483
1495
|
.vk-root[data-fill="true"] .vk-map{flex:1;aspect-ratio:auto;min-height:0;max-height:none}
|
|
1496
|
+
.vk-map[data-cooperative="true"]{touch-action:pan-y}
|
|
1484
1497
|
.vk-canvas{display:block;width:100%;height:100%}
|
|
1485
1498
|
.vk-a11y{position:absolute;inset:0;pointer-events:none}
|
|
1486
1499
|
.vk-seat{position:absolute;transform:translate(-50%,-50%);padding:0;margin:0;border:0;background:transparent;
|
|
1487
1500
|
border-radius:50%;cursor:pointer;color:transparent;overflow:hidden}
|
|
1488
1501
|
.vk-seat:focus-visible{outline:3px solid var(--vk-accent);outline-offset:2px}
|
|
1502
|
+
.vk-choose{position:absolute;left:8px;top:8px;max-width:calc(100% - 64px);min-height:44px;padding:8px 12px;
|
|
1503
|
+
border:1px solid var(--vk-line);border-radius:var(--vk-radius);background:var(--vk-bg);color:var(--vk-fg);
|
|
1504
|
+
font:inherit;font-size:14px;text-align:left;cursor:pointer;opacity:0}
|
|
1505
|
+
.vk-choose:focus{opacity:1;pointer-events:auto;outline:3px solid var(--vk-accent);outline-offset:2px}
|
|
1506
|
+
.vk-map-hint{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);margin:0;max-width:calc(100% - 32px);
|
|
1507
|
+
padding:8px 12px;border-radius:var(--vk-radius);background:rgba(0,0,0,.72);color:#fff;font-size:14px;
|
|
1508
|
+
text-align:center;pointer-events:none}
|
|
1489
1509
|
.vk-zoom{position:absolute;right:8px;bottom:8px;display:flex;flex-direction:column;gap:4px}
|
|
1490
1510
|
.vk-zoom button{width:36px;height:36px;border:1px solid var(--vk-line);background:var(--vk-bg);
|
|
1491
1511
|
color:var(--vk-fg);border-radius:var(--vk-radius);font-size:16px;line-height:1;cursor:pointer}
|
|
@@ -1561,13 +1581,43 @@ function useImage(src) {
|
|
|
1561
1581
|
img.onerror = null;
|
|
1562
1582
|
};
|
|
1563
1583
|
}, [src]);
|
|
1564
|
-
if (!src || _optionalChain([loaded, 'optionalAccess',
|
|
1584
|
+
if (!src || _optionalChain([loaded, 'optionalAccess', _52 => _52.src]) !== src) return { image: null, failed: false };
|
|
1565
1585
|
return { image: loaded.image, failed: loaded.failed };
|
|
1566
1586
|
}
|
|
1567
1587
|
|
|
1568
1588
|
// ../react/src/VenueCanvas.tsx
|
|
1569
1589
|
|
|
1590
|
+
|
|
1591
|
+
// ../react/src/map-targets.ts
|
|
1592
|
+
var MAX_SEAT_BUTTONS = 500;
|
|
1593
|
+
var MIN_PICK_RADIUS_PX = 6;
|
|
1594
|
+
function chooseTarget(visible, activeId, centre) {
|
|
1595
|
+
const active = activeId === null ? void 0 : visible.find((n) => n.id === activeId);
|
|
1596
|
+
if (active) return active;
|
|
1597
|
+
let best2 = null;
|
|
1598
|
+
let bestD = Infinity;
|
|
1599
|
+
for (const n of visible) {
|
|
1600
|
+
const d = (n.x - centre.x) ** 2 + (n.y - centre.y) ** 2;
|
|
1601
|
+
if (d < bestD) {
|
|
1602
|
+
bestD = d;
|
|
1603
|
+
best2 = n;
|
|
1604
|
+
}
|
|
1605
|
+
}
|
|
1606
|
+
return best2;
|
|
1607
|
+
}
|
|
1608
|
+
function zoomToChoose(camera, visibleCount, target) {
|
|
1609
|
+
const factor = Math.max(2, Math.sqrt(visibleCount / (MAX_SEAT_BUTTONS / 2)));
|
|
1610
|
+
return { x: target.x, y: target.y, zoom: clampZoom(camera.zoom * factor) };
|
|
1611
|
+
}
|
|
1612
|
+
function tapZoom(camera, viewport, screen, radiusPx) {
|
|
1613
|
+
if (radiusPx >= MIN_PICK_RADIUS_PX) return null;
|
|
1614
|
+
const next = zoomAt(camera, viewport, screen, Math.max(2, MIN_NUMBERED_RADIUS_PX / Math.max(radiusPx, 0.01)));
|
|
1615
|
+
return next.zoom > camera.zoom ? next : null;
|
|
1616
|
+
}
|
|
1617
|
+
|
|
1618
|
+
// ../react/src/VenueCanvas.tsx
|
|
1570
1619
|
var _jsxruntime = require('react/jsx-runtime');
|
|
1620
|
+
var WHEEL_HINT_MS = 1600;
|
|
1571
1621
|
var ARROWS = {
|
|
1572
1622
|
ArrowUp: "up",
|
|
1573
1623
|
ArrowDown: "down",
|
|
@@ -1638,6 +1688,9 @@ function VenueCanvas(props) {
|
|
|
1638
1688
|
);
|
|
1639
1689
|
const visible = _react.useMemo.call(void 0, () => new Set(scene.visibleUnitIds), [scene]);
|
|
1640
1690
|
const visibleNodes = _react.useMemo.call(void 0, () => a11yNodes.filter((n) => visible.has(n.id)), [a11yNodes, visible]);
|
|
1691
|
+
const tooMany = visibleNodes.length > MAX_SEAT_BUTTONS;
|
|
1692
|
+
const unitById = _react.useMemo.call(void 0, () => new Map(units.map((u) => [u.id, u])), [units]);
|
|
1693
|
+
const chooseRef = _react.useRef.call(void 0, null);
|
|
1641
1694
|
const sizeOf = (elementId) => Math.max(24, 2 * (_nullishCoalesce(props.radii.get(elementId), () => ( DEFAULT_UNIT_RADIUS))) * camera.zoom);
|
|
1642
1695
|
const lastSize = _react.useRef.call(void 0, { width: 0, height: 0 });
|
|
1643
1696
|
const onViewportChangeRef = _react.useRef.call(void 0, props.onViewportChange);
|
|
@@ -1674,10 +1727,23 @@ function VenueCanvas(props) {
|
|
|
1674
1727
|
viewportRef.current = viewport;
|
|
1675
1728
|
const onCameraChangeRef = _react.useRef.call(void 0, props.onCameraChange);
|
|
1676
1729
|
onCameraChangeRef.current = props.onCameraChange;
|
|
1730
|
+
const cooperativeRef = _react.useRef.call(void 0, props.cooperative === true);
|
|
1731
|
+
cooperativeRef.current = props.cooperative === true;
|
|
1732
|
+
const [wheelHint, setWheelHint] = _react.useState.call(void 0, false);
|
|
1733
|
+
const hintTimer = _react.useRef.call(void 0, null);
|
|
1734
|
+
_react.useEffect.call(void 0, () => () => {
|
|
1735
|
+
if (hintTimer.current) clearTimeout(hintTimer.current);
|
|
1736
|
+
}, []);
|
|
1677
1737
|
_react.useEffect.call(void 0, () => {
|
|
1678
1738
|
const canvas = canvasRef.current;
|
|
1679
1739
|
if (!canvas) return;
|
|
1680
1740
|
const onWheel = (e) => {
|
|
1741
|
+
if (cooperativeRef.current && !e.ctrlKey && !e.metaKey) {
|
|
1742
|
+
setWheelHint(true);
|
|
1743
|
+
if (hintTimer.current) clearTimeout(hintTimer.current);
|
|
1744
|
+
hintTimer.current = setTimeout(() => setWheelHint(false), WHEEL_HINT_MS);
|
|
1745
|
+
return;
|
|
1746
|
+
}
|
|
1681
1747
|
e.preventDefault();
|
|
1682
1748
|
const rect = canvas.getBoundingClientRect();
|
|
1683
1749
|
const currentCamera = cameraRef.current;
|
|
@@ -1695,9 +1761,9 @@ function VenueCanvas(props) {
|
|
|
1695
1761
|
_react.useEffect.call(void 0, () => {
|
|
1696
1762
|
const id = pendingFocus.current;
|
|
1697
1763
|
if (!id) return;
|
|
1698
|
-
const button = _optionalChain([wrapRef, 'access',
|
|
1764
|
+
const button = _optionalChain([wrapRef, 'access', _53 => _53.current, 'optionalAccess', _54 => _54.querySelector, 'call', _55 => _55(`[data-unit-id="${id}"]`)]);
|
|
1699
1765
|
pendingFocus.current = null;
|
|
1700
|
-
_optionalChain([button, 'optionalAccess',
|
|
1766
|
+
_optionalChain([(_nullishCoalesce(button, () => ( chooseRef.current))), 'optionalAccess', _56 => _56.focus, 'call', _57 => _57()]);
|
|
1701
1767
|
}, [visibleNodes]);
|
|
1702
1768
|
const send = (input) => {
|
|
1703
1769
|
const result = reduceGesture(gesture.current, camera, viewport, input);
|
|
@@ -1705,8 +1771,26 @@ function VenueCanvas(props) {
|
|
|
1705
1771
|
if (result.camera !== camera) props.onCameraChange(result.camera);
|
|
1706
1772
|
if (!result.tap) return;
|
|
1707
1773
|
const unitId = hitUnit({ index, camera, viewport, screenPoint: result.tap, units, radii: props.radii });
|
|
1708
|
-
if (unitId)
|
|
1709
|
-
|
|
1774
|
+
if (!unitId) {
|
|
1775
|
+
_optionalChain([props, 'access', _58 => _58.onTapEmpty, 'optionalCall', _59 => _59(result.tap)]);
|
|
1776
|
+
return;
|
|
1777
|
+
}
|
|
1778
|
+
const unit = unitById.get(unitId);
|
|
1779
|
+
if (unit && props.focusRef !== null && unit.placeTypeRef === props.focusRef) {
|
|
1780
|
+
const closer = tapZoom(camera, viewport, result.tap, (_nullishCoalesce(props.radii.get(unit.elementId), () => ( DEFAULT_UNIT_RADIUS))) * camera.zoom);
|
|
1781
|
+
if (closer) {
|
|
1782
|
+
props.onCameraChange(closer);
|
|
1783
|
+
return;
|
|
1784
|
+
}
|
|
1785
|
+
}
|
|
1786
|
+
props.onActivateUnit(unitId);
|
|
1787
|
+
};
|
|
1788
|
+
const zoomInToChoose = () => {
|
|
1789
|
+
const target = chooseTarget(visibleNodes, activeId, camera);
|
|
1790
|
+
if (!target) return;
|
|
1791
|
+
setActiveId(target.id);
|
|
1792
|
+
pendingFocus.current = target.id;
|
|
1793
|
+
props.onCameraChange(zoomToChoose(camera, visibleNodes.length, target));
|
|
1710
1794
|
};
|
|
1711
1795
|
const samplePointer = (e) => {
|
|
1712
1796
|
const rect = e.currentTarget.getBoundingClientRect();
|
|
@@ -1724,12 +1808,12 @@ function VenueCanvas(props) {
|
|
|
1724
1808
|
const node = a11yNodes.find((n) => n.id === next);
|
|
1725
1809
|
if (node) props.onCameraChange({ ...camera, x: node.x, y: node.y });
|
|
1726
1810
|
} else {
|
|
1727
|
-
_optionalChain([wrapRef, 'access',
|
|
1811
|
+
_optionalChain([wrapRef, 'access', _60 => _60.current, 'optionalAccess', _61 => _61.querySelector, 'call', _62 => _62(`[data-unit-id="${next}"]`), 'optionalAccess', _63 => _63.focus, 'call', _64 => _64()]);
|
|
1728
1812
|
pendingFocus.current = null;
|
|
1729
1813
|
}
|
|
1730
1814
|
};
|
|
1731
1815
|
const zoomButton = (factor) => () => props.onCameraChange(zoomAt(camera, viewport, { x: viewport.width / 2, y: viewport.height / 2 }, factor));
|
|
1732
|
-
const tabbableId = _nullishCoalesce((activeId !== null && visible.has(activeId) ? activeId : _optionalChain([visibleNodes, 'access',
|
|
1816
|
+
const tabbableId = _nullishCoalesce((activeId !== null && visible.has(activeId) ? activeId : _optionalChain([visibleNodes, 'access', _65 => _65[0], 'optionalAccess', _66 => _66.id])), () => ( null));
|
|
1733
1817
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1734
1818
|
"div",
|
|
1735
1819
|
{
|
|
@@ -1738,6 +1822,7 @@ function VenueCanvas(props) {
|
|
|
1738
1822
|
"data-testid": "venue-map",
|
|
1739
1823
|
"data-background": props.backgroundStatus,
|
|
1740
1824
|
"data-camera": `${camera.x.toFixed(2)},${camera.y.toFixed(2)},${camera.zoom.toFixed(4)}`,
|
|
1825
|
+
"data-cooperative": props.cooperative ? "true" : void 0,
|
|
1741
1826
|
style: {
|
|
1742
1827
|
["--vk-plan-ratio"]: props.ratio ? `${Math.round(props.ratio.width)} / ${Math.round(props.ratio.height)}` : `${layout.meta.width} / ${layout.meta.height}`,
|
|
1743
1828
|
...props.height !== void 0 ? { height: props.height, aspectRatio: "auto", minHeight: 0, maxHeight: "none" } : {}
|
|
@@ -1758,7 +1843,7 @@ function VenueCanvas(props) {
|
|
|
1758
1843
|
onPointerCancel: (e) => send({ type: "pointercancel", pointer: samplePointer(e) })
|
|
1759
1844
|
}
|
|
1760
1845
|
),
|
|
1761
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "vk-a11y", role: "group", "aria-label": messages.mapLabel, onKeyDown, children: visibleNodes.map((node) => {
|
|
1846
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "vk-a11y", role: "group", "aria-label": messages.mapLabel, onKeyDown, children: tooMany ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "button", { ref: chooseRef, type: "button", className: "vk-choose", "data-testid": "zoom-to-choose", onClick: zoomInToChoose, children: format(messages.zoomToChoose, { n: visibleNodes.length.toLocaleString() }) }) : visibleNodes.map((node) => {
|
|
1762
1847
|
const p = worldToScreen(camera, viewport, node);
|
|
1763
1848
|
const size = sizeOf(node.elementId);
|
|
1764
1849
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -1779,6 +1864,7 @@ function VenueCanvas(props) {
|
|
|
1779
1864
|
node.id
|
|
1780
1865
|
);
|
|
1781
1866
|
}) }),
|
|
1867
|
+
wheelHint ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "vk-map-hint", role: "status", children: messages.wheelHint }) : null,
|
|
1782
1868
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "vk-zoom", children: [
|
|
1783
1869
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "button", { type: "button", onClick: zoomButton(1.4), "aria-label": messages.zoomIn, children: "+" }),
|
|
1784
1870
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "button", { type: "button", onClick: zoomButton(1 / 1.4), "aria-label": messages.zoomOut, children: "\u2212" })
|
|
@@ -1793,7 +1879,7 @@ function VenueCanvas(props) {
|
|
|
1793
1879
|
var NONE = [];
|
|
1794
1880
|
var EMPTY_SET = /* @__PURE__ */ new Set();
|
|
1795
1881
|
function byKind(u, seat, table, place) {
|
|
1796
|
-
return _optionalChain([u, 'optionalAccess',
|
|
1882
|
+
return _optionalChain([u, 'optionalAccess', _67 => _67.kind]) === "table" ? table : _optionalChain([u, 'optionalAccess', _68 => _68.kind]) === "place" ? place : seat;
|
|
1797
1883
|
}
|
|
1798
1884
|
function a11yLabel(u, m) {
|
|
1799
1885
|
const table = format(m.summaryTable, { table: _nullishCoalesce(u.table, () => ( u.label)) });
|
|
@@ -1803,13 +1889,13 @@ function a11yLabel(u, m) {
|
|
|
1803
1889
|
}
|
|
1804
1890
|
function SeatMap(props) {
|
|
1805
1891
|
const { layout, focusRef, selection, onSelectionChange } = props;
|
|
1806
|
-
const maxSelection = _nullishCoalesce(props.maxSelection, () => (
|
|
1892
|
+
const maxSelection = _nullishCoalesce(props.maxSelection, () => ( _chunkUWCMN6Q7cjs.DEFAULT_MAX_SELECTION));
|
|
1807
1893
|
const messages = _react.useMemo.call(void 0,
|
|
1808
1894
|
() => mergeMessages({ ...props.messages, ...props.continueLabel ? { continueLabel: props.continueLabel } : {} }),
|
|
1809
1895
|
[props.messages, props.continueLabel]
|
|
1810
1896
|
);
|
|
1811
|
-
const units = _react.useMemo.call(void 0, () =>
|
|
1812
|
-
const index = _react.useMemo.call(void 0, () => new (0,
|
|
1897
|
+
const units = _react.useMemo.call(void 0, () => _chunkUWCMN6Q7cjs.expand.call(void 0, layout), [layout]);
|
|
1898
|
+
const index = _react.useMemo.call(void 0, () => new (0, _chunkUWCMN6Q7cjs.SpatialIndex)(units), [units]);
|
|
1813
1899
|
const radii = _react.useMemo.call(void 0, () => unitRadii(layout), [layout]);
|
|
1814
1900
|
const unitById = _react.useMemo.call(void 0, () => new Map(units.map((u) => [u.id, u])), [units]);
|
|
1815
1901
|
const placeTypeColors = _react.useMemo.call(void 0, () => new Map(props.placeTypes.map((p) => [p.ref, p.color])), [props.placeTypes]);
|
|
@@ -1847,7 +1933,7 @@ function SeatMap(props) {
|
|
|
1847
1933
|
[props.takenUnitIds, conflicted]
|
|
1848
1934
|
);
|
|
1849
1935
|
const held = _react.useMemo.call(void 0, () => new Set(_nullishCoalesce(props.heldUnitIds, () => ( NONE))), [props.heldUnitIds]);
|
|
1850
|
-
const states = _react.useMemo.call(void 0, () =>
|
|
1936
|
+
const states = _react.useMemo.call(void 0, () => _chunkUWCMN6Q7cjs.unitStates.call(void 0, units, taken, selection, held), [units, taken, selection, held]);
|
|
1851
1937
|
const selectable = _react.useMemo.call(void 0, () => units.filter((u) => u.placeTypeRef === focusRef), [units, focusRef]);
|
|
1852
1938
|
const a11yNodes = _react.useMemo.call(void 0,
|
|
1853
1939
|
() => buildA11yNodes(
|
|
@@ -1859,7 +1945,7 @@ function SeatMap(props) {
|
|
|
1859
1945
|
[selectable, states, placeTypeNames, messages]
|
|
1860
1946
|
);
|
|
1861
1947
|
const bg = layout.meta.background;
|
|
1862
|
-
const background = useImage(_nullishCoalesce(_optionalChain([bg, 'optionalAccess',
|
|
1948
|
+
const background = useImage(_nullishCoalesce(_optionalChain([bg, 'optionalAccess', _69 => _69.src]), () => ( null)));
|
|
1863
1949
|
const images = _react.useMemo.call(void 0,
|
|
1864
1950
|
() => new Map(bg && background.image ? [[bg.src, background.image]] : []),
|
|
1865
1951
|
[bg, background.image]
|
|
@@ -1870,7 +1956,7 @@ function SeatMap(props) {
|
|
|
1870
1956
|
const framedFor = _react.useRef.call(void 0, null);
|
|
1871
1957
|
_react.useEffect.call(void 0, () => {
|
|
1872
1958
|
if (viewport.width === 0 || viewport.height === 0) return;
|
|
1873
|
-
if (_optionalChain([framedFor, 'access',
|
|
1959
|
+
if (_optionalChain([framedFor, 'access', _70 => _70.current, 'optionalAccess', _71 => _71.layout]) === layout && framedFor.current.focusRef === focusRef) return;
|
|
1874
1960
|
framedFor.current = { layout, focusRef };
|
|
1875
1961
|
const box = _nullishCoalesce(focusBox(layout, units, radii, focusRef), () => ( { minX: 0, minY: 0, maxX: layout.meta.width, maxY: layout.meta.height }));
|
|
1876
1962
|
setCamera(fitBox(box, viewport, props.embedded ? 16 : 24));
|
|
@@ -1888,7 +1974,7 @@ function SeatMap(props) {
|
|
|
1888
1974
|
const onTapEmpty = _react.useCallback.call(void 0, (screen) => {
|
|
1889
1975
|
const el = elementAt(layout, screen, cameraRef.current, viewportRef.current);
|
|
1890
1976
|
if (!el || el.type === "landmark") return;
|
|
1891
|
-
switchTo(_optionalChain([el, 'access',
|
|
1977
|
+
switchTo(_optionalChain([el, 'access', _72 => _72.placeType, 'optionalAccess', _73 => _73.ref]) || null);
|
|
1892
1978
|
}, [layout, switchTo]);
|
|
1893
1979
|
const activateUnit = _react.useCallback.call(void 0, (unitId) => {
|
|
1894
1980
|
const unit = unitById.get(unitId);
|
|
@@ -1901,7 +1987,7 @@ function SeatMap(props) {
|
|
|
1901
1987
|
announce(messages.heldSeat, true);
|
|
1902
1988
|
return;
|
|
1903
1989
|
}
|
|
1904
|
-
const result =
|
|
1990
|
+
const result = _chunkUWCMN6Q7cjs.toggleUnit.call(void 0, selection, unitId, states, maxSelection);
|
|
1905
1991
|
if (result.rejected === "taken") {
|
|
1906
1992
|
announce(byKind(unit, messages.takenSeat, messages.takenTable, messages.takenPlace), true);
|
|
1907
1993
|
return;
|
|
@@ -1914,7 +2000,7 @@ function SeatMap(props) {
|
|
|
1914
2000
|
announce(`${unitName(unit, messages)}: ${added ? messages.selected : messages.free}`);
|
|
1915
2001
|
onSelectionChange(result.selection);
|
|
1916
2002
|
}, [unitById, focusRef, states, selection, maxSelection, messages, announce, onSelectionChange, switchTo]);
|
|
1917
|
-
const summary = selectionSummary(units, selection, messages);
|
|
2003
|
+
const summary = _react.useMemo.call(void 0, () => selectionSummary(units, selection, messages), [units, selection, messages]);
|
|
1918
2004
|
const focusColor = _nullishCoalesce(placeTypeColors.get(focusRef), () => ( "var(--vk-unassigned)"));
|
|
1919
2005
|
const focusType = props.placeTypes.find((p) => p.ref === focusRef);
|
|
1920
2006
|
const embedded = props.embedded === true;
|
|
@@ -1965,6 +2051,7 @@ function SeatMap(props) {
|
|
|
1965
2051
|
onTapEmpty,
|
|
1966
2052
|
placeTypePrices,
|
|
1967
2053
|
...props.height !== void 0 ? { height: props.height } : {},
|
|
2054
|
+
cooperative: embedded,
|
|
1968
2055
|
images,
|
|
1969
2056
|
...backgroundStatus ? { backgroundStatus } : {}
|
|
1970
2057
|
}
|
|
@@ -2013,7 +2100,7 @@ function overviewBox(layout, radii) {
|
|
|
2013
2100
|
for (const el of layout.elements) {
|
|
2014
2101
|
const b = elementBounds(layout, el);
|
|
2015
2102
|
if (!b) continue;
|
|
2016
|
-
const r = el.type === "seatBlock" || el.type === "table" ? _nullishCoalesce(_optionalChain([radii, 'optionalAccess',
|
|
2103
|
+
const r = el.type === "seatBlock" || el.type === "table" ? _nullishCoalesce(_optionalChain([radii, 'optionalAccess', _74 => _74.get, 'call', _75 => _75(el.id)]), () => ( 0)) : 0;
|
|
2017
2104
|
box = box ? {
|
|
2018
2105
|
minX: Math.min(box.minX, b.minX - r),
|
|
2019
2106
|
minY: Math.min(box.minY, b.minY - r),
|
|
@@ -2035,8 +2122,8 @@ var NO_NODES = [];
|
|
|
2035
2122
|
function VenueOverview(props) {
|
|
2036
2123
|
const { layout, placeTypes, onSelect } = props;
|
|
2037
2124
|
const messages = _react.useMemo.call(void 0, () => mergeMessages(props.messages), [props.messages]);
|
|
2038
|
-
const units = _react.useMemo.call(void 0, () =>
|
|
2039
|
-
const index = _react.useMemo.call(void 0, () => new (0,
|
|
2125
|
+
const units = _react.useMemo.call(void 0, () => _chunkUWCMN6Q7cjs.expand.call(void 0, layout), [layout]);
|
|
2126
|
+
const index = _react.useMemo.call(void 0, () => new (0, _chunkUWCMN6Q7cjs.SpatialIndex)(units), [units]);
|
|
2040
2127
|
const radii = _react.useMemo.call(void 0, () => unitRadii(layout), [layout]);
|
|
2041
2128
|
const unitById = _react.useMemo.call(void 0, () => new Map(units.map((u) => [u.id, u])), [units]);
|
|
2042
2129
|
const placeTypeColors = _react.useMemo.call(void 0, () => new Map(placeTypes.map((p) => [p.ref, p.color])), [placeTypes]);
|
|
@@ -2053,7 +2140,7 @@ function VenueOverview(props) {
|
|
|
2053
2140
|
const takenIds = _nullishCoalesce(props.takenUnitIds, () => ( NONE2));
|
|
2054
2141
|
const selectedIds = _nullishCoalesce(props.selectedUnitIds, () => ( NONE2));
|
|
2055
2142
|
const states = _react.useMemo.call(void 0,
|
|
2056
|
-
() =>
|
|
2143
|
+
() => _chunkUWCMN6Q7cjs.unitStates.call(void 0, units, new Set(takenIds), selectedIds, NO_HELD),
|
|
2057
2144
|
[units, takenIds, selectedIds]
|
|
2058
2145
|
);
|
|
2059
2146
|
const hideList = props.hideList === true;
|
|
@@ -2066,12 +2153,12 @@ function VenueOverview(props) {
|
|
|
2066
2153
|
const tap = overviewTap(ref, placeTypes);
|
|
2067
2154
|
if (tap.kind === "select") onSelect(tap.ref);
|
|
2068
2155
|
else if (tap.kind === "soldOut") {
|
|
2069
|
-
const name = _nullishCoalesce(_optionalChain([placeTypes, 'access',
|
|
2156
|
+
const name = _nullishCoalesce(_optionalChain([placeTypes, 'access', _76 => _76.find, 'call', _77 => _77((p) => p.ref === tap.ref), 'optionalAccess', _78 => _78.label]), () => ( ""));
|
|
2070
2157
|
setNotice((n) => ({ text: format(messages.soldOutNotice, { name }), seq: n.seq + 1 }));
|
|
2071
2158
|
}
|
|
2072
2159
|
}, [placeTypes, onSelect, messages]);
|
|
2073
2160
|
const bg = layout.meta.background;
|
|
2074
|
-
const background = useImage(_nullishCoalesce(_optionalChain([bg, 'optionalAccess',
|
|
2161
|
+
const background = useImage(_nullishCoalesce(_optionalChain([bg, 'optionalAccess', _79 => _79.src]), () => ( null)));
|
|
2075
2162
|
const images = _react.useMemo.call(void 0,
|
|
2076
2163
|
() => new Map(bg && background.image ? [[bg.src, background.image]] : []),
|
|
2077
2164
|
[bg, background.image]
|
|
@@ -2098,7 +2185,7 @@ function VenueOverview(props) {
|
|
|
2098
2185
|
const onTapEmpty = _react.useCallback.call(void 0, (screen) => {
|
|
2099
2186
|
const el = elementAt(layout, screen, cameraRef.current, viewportRef.current);
|
|
2100
2187
|
if (!el || el.type === "landmark") return;
|
|
2101
|
-
choose(_optionalChain([el, 'access',
|
|
2188
|
+
choose(_optionalChain([el, 'access', _80 => _80.placeType, 'optionalAccess', _81 => _81.ref]) || null);
|
|
2102
2189
|
}, [layout, choose]);
|
|
2103
2190
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2104
2191
|
"div",
|
|
@@ -2123,7 +2210,7 @@ function VenueOverview(props) {
|
|
|
2123
2210
|
onCameraChange: setCamera,
|
|
2124
2211
|
viewport,
|
|
2125
2212
|
onViewportChange: setViewport,
|
|
2126
|
-
onActivateUnit: (id) => choose(_nullishCoalesce(_optionalChain([unitById, 'access',
|
|
2213
|
+
onActivateUnit: (id) => choose(_nullishCoalesce(_optionalChain([unitById, 'access', _82 => _82.get, 'call', _83 => _83(id), 'optionalAccess', _84 => _84.placeTypeRef]), () => ( null))),
|
|
2127
2214
|
onTapEmpty,
|
|
2128
2215
|
messages: canvasMessages,
|
|
2129
2216
|
placeTypeColors,
|
|
@@ -2133,6 +2220,7 @@ function VenueOverview(props) {
|
|
|
2133
2220
|
highlightRefs,
|
|
2134
2221
|
...props.height !== void 0 ? { height: props.height } : {},
|
|
2135
2222
|
ratio: contentRatio,
|
|
2223
|
+
cooperative: true,
|
|
2136
2224
|
images,
|
|
2137
2225
|
...backgroundStatus ? { backgroundStatus } : {}
|
|
2138
2226
|
}
|
|
@@ -2217,9 +2305,9 @@ function withWorldSize(el, axis, size) {
|
|
|
2217
2305
|
const swap = el.transform.rotation === 90 || el.transform.rotation === 270;
|
|
2218
2306
|
const field = axis === "x" !== swap ? "width" : "height";
|
|
2219
2307
|
if (el.type === "zone" && (_nullishCoalesce(el.curve, () => ( 0))) > 0) {
|
|
2220
|
-
const now =
|
|
2308
|
+
const now = _chunkUWCMN6Q7cjs.zoneLocalSize.call(void 0, el);
|
|
2221
2309
|
if (Math.abs(now[field] - size) < 1e-6) return el;
|
|
2222
|
-
const next =
|
|
2310
|
+
const next = _chunkUWCMN6Q7cjs.zoneWithLocalSize.call(void 0, el, field === "width" ? size : now.width, field === "height" ? size : now.height);
|
|
2223
2311
|
return { ...next, width: Math.round(next.width), height: Math.round(next.height) };
|
|
2224
2312
|
}
|
|
2225
2313
|
return el[field] === size ? el : { ...el, [field]: size };
|
|
@@ -2245,7 +2333,7 @@ function arrangeCommands(layout, ids, action) {
|
|
|
2245
2333
|
const scale = _nullishCoalesce(model.el.scale, () => ( 1));
|
|
2246
2334
|
return scaled.slice(1).flatMap(({ el }) => {
|
|
2247
2335
|
const piece = el;
|
|
2248
|
-
return (_nullishCoalesce(piece.scale, () => ( 1))) === scale ? [] : [{ type: "replaceElement", element:
|
|
2336
|
+
return (_nullishCoalesce(piece.scale, () => ( 1))) === scale ? [] : [{ type: "replaceElement", element: _chunkUWCMN6Q7cjs.scalePiece.call(void 0, piece, scale) }];
|
|
2249
2337
|
});
|
|
2250
2338
|
}
|
|
2251
2339
|
const shifts = action === "distributeX" ? distributeBoxes(boxes, "x") : action === "distributeY" ? distributeBoxes(boxes, "y") : alignBoxes(boxes, action);
|
|
@@ -2394,14 +2482,65 @@ function BackgroundControl(props) {
|
|
|
2394
2482
|
// ../react/src/designer/DesignerCanvas.tsx
|
|
2395
2483
|
|
|
2396
2484
|
|
|
2485
|
+
// ../react/src/designer/drag-preview.ts
|
|
2486
|
+
function changedIds(preview) {
|
|
2487
|
+
return preview.kind === "move" ? [...preview.ids] : [preview.element.id];
|
|
2488
|
+
}
|
|
2489
|
+
function splitUnits(units, changed) {
|
|
2490
|
+
const still = [];
|
|
2491
|
+
const moving = [];
|
|
2492
|
+
for (const u of units) (changed.has(u.elementId) ? moving : still).push(u);
|
|
2493
|
+
return { changed, still, stillIndex: new (0, _chunkUWCMN6Q7cjs.SpatialIndex)(still), moving, movingIndex: new (0, _chunkUWCMN6Q7cjs.SpatialIndex)(moving) };
|
|
2494
|
+
}
|
|
2495
|
+
function boxesOf(layout) {
|
|
2496
|
+
const out = /* @__PURE__ */ new Map();
|
|
2497
|
+
for (const el of layout.elements) {
|
|
2498
|
+
const b = pieceBounds(el);
|
|
2499
|
+
if (b) out.set(el.id, b);
|
|
2500
|
+
}
|
|
2501
|
+
return out;
|
|
2502
|
+
}
|
|
2503
|
+
function shifted(el, dx, dy) {
|
|
2504
|
+
return { ...el, transform: { ...el.transform, x: el.transform.x + dx, y: el.transform.y + dy } };
|
|
2505
|
+
}
|
|
2506
|
+
function joined(still, moving, dx, dy) {
|
|
2507
|
+
return {
|
|
2508
|
+
queryRect: (q) => {
|
|
2509
|
+
const out = still.queryRect(q);
|
|
2510
|
+
for (const id of moving.queryRect({ minX: q.minX - dx, minY: q.minY - dy, maxX: q.maxX - dx, maxY: q.maxY - dy })) out.push(id);
|
|
2511
|
+
return out;
|
|
2512
|
+
}
|
|
2513
|
+
};
|
|
2514
|
+
}
|
|
2515
|
+
function previewFrame(base, split, baseBoxes, preview) {
|
|
2516
|
+
const boxes = new Map(baseBoxes);
|
|
2517
|
+
if (preview.kind === "move") {
|
|
2518
|
+
const { dx, dy } = preview;
|
|
2519
|
+
const layout2 = { ...base, elements: base.elements.map((el) => split.changed.has(el.id) ? shifted(el, dx, dy) : el) };
|
|
2520
|
+
for (const id of split.changed) {
|
|
2521
|
+
const b2 = baseBoxes.get(id);
|
|
2522
|
+
if (b2) boxes.set(id, shiftBox(b2, dx, dy));
|
|
2523
|
+
}
|
|
2524
|
+
const units = split.still.concat(split.moving.map((u) => ({ ...u, x: u.x + dx, y: u.y + dy })));
|
|
2525
|
+
return { layout: layout2, units, index: joined(split.stillIndex, split.movingIndex, dx, dy), boxes };
|
|
2526
|
+
}
|
|
2527
|
+
const { element } = preview;
|
|
2528
|
+
const layout = { ...base, elements: base.elements.map((el) => el.id === element.id ? element : el) };
|
|
2529
|
+
const own = _chunkUWCMN6Q7cjs.expand.call(void 0, { ...base, elements: [element] });
|
|
2530
|
+
const b = pieceBounds(element);
|
|
2531
|
+
if (b) boxes.set(element.id, b);
|
|
2532
|
+
else boxes.delete(element.id);
|
|
2533
|
+
return { layout, units: split.still.concat(own), index: joined(split.stillIndex, new (0, _chunkUWCMN6Q7cjs.SpatialIndex)(own), 0, 0), boxes };
|
|
2534
|
+
}
|
|
2535
|
+
|
|
2397
2536
|
// ../react/src/designer/sizing.ts
|
|
2398
2537
|
var SIZE_STEP = 0.1;
|
|
2399
2538
|
var KEY_RESIZE_STEP = 20;
|
|
2400
2539
|
function steppedScale(scale, direction) {
|
|
2401
|
-
return
|
|
2540
|
+
return _chunkUWCMN6Q7cjs.snapScale.call(void 0, scale + direction * SIZE_STEP);
|
|
2402
2541
|
}
|
|
2403
2542
|
function keyboardResize(el, corner, direction) {
|
|
2404
|
-
if (el.type === "seatBlock" || el.type === "table") return
|
|
2543
|
+
if (el.type === "seatBlock" || el.type === "table") return _chunkUWCMN6Q7cjs.scalePiece.call(void 0, el, steppedScale(_nullishCoalesce(el.scale, () => ( 1)), direction));
|
|
2405
2544
|
const box = pieceBounds(el);
|
|
2406
2545
|
if (!box) return el;
|
|
2407
2546
|
const from = cornerPoint(box, corner);
|
|
@@ -2416,9 +2555,6 @@ var NO_STATES = /* @__PURE__ */ new Map();
|
|
|
2416
2555
|
var TICK_MS = 50;
|
|
2417
2556
|
var MAX_SEAT_TARGETS = 1e3;
|
|
2418
2557
|
var isScaled2 = (el) => el.type === "seatBlock" || el.type === "table";
|
|
2419
|
-
function withElement(layout, el) {
|
|
2420
|
-
return { ...layout, elements: layout.elements.map((e) => e.id === el.id ? el : e) };
|
|
2421
|
-
}
|
|
2422
2558
|
function union(boxes) {
|
|
2423
2559
|
if (boxes.length === 0) return null;
|
|
2424
2560
|
return boxes.reduce((a, b) => ({
|
|
@@ -2438,26 +2574,37 @@ function frame(layout, viewport) {
|
|
|
2438
2574
|
function pieceName(el, placeTypes, m) {
|
|
2439
2575
|
if (el.type === "landmark") return el.name;
|
|
2440
2576
|
if (el.type === "zone") {
|
|
2441
|
-
const ref2 = _optionalChain([el, 'access',
|
|
2442
|
-
return _nullishCoalesce((ref2 ? _optionalChain([placeTypes, 'access',
|
|
2577
|
+
const ref2 = _optionalChain([el, 'access', _85 => _85.placeType, 'optionalAccess', _86 => _86.ref]) || null;
|
|
2578
|
+
return _nullishCoalesce((ref2 ? _optionalChain([placeTypes, 'access', _87 => _87.find, 'call', _88 => _88((p) => p.ref === ref2), 'optionalAccess', _89 => _89.label]) : void 0), () => ( m.unassigned));
|
|
2443
2579
|
}
|
|
2444
2580
|
const own = el.type === "seatBlock" ? (() => {
|
|
2445
|
-
const rows =
|
|
2581
|
+
const rows = _chunkUWCMN6Q7cjs.expandLabels.call(void 0, el.rowLabels, el.rows);
|
|
2446
2582
|
return format(m.pieceBlockName, { from: _nullishCoalesce(rows[0], () => ( "")), to: _nullishCoalesce(rows[rows.length - 1], () => ( "")) });
|
|
2447
2583
|
})() : format(m.pieceTableName, { label: el.label });
|
|
2448
|
-
const ref = _optionalChain([el, 'access',
|
|
2449
|
-
const type = ref ? _optionalChain([placeTypes, 'access',
|
|
2584
|
+
const ref = _optionalChain([el, 'access', _90 => _90.placeType, 'optionalAccess', _91 => _91.ref]) || null;
|
|
2585
|
+
const type = ref ? _optionalChain([placeTypes, 'access', _92 => _92.find, 'call', _93 => _93((p) => p.ref === ref), 'optionalAccess', _94 => _94.label]) : void 0;
|
|
2450
2586
|
return `${own}, ${_nullishCoalesce(type, () => ( m.unassigned))}`;
|
|
2451
2587
|
}
|
|
2452
2588
|
function fullBlock(layout, id) {
|
|
2453
2589
|
const el = id ? layout.elements.find((e) => e.id === id) : void 0;
|
|
2454
|
-
return _optionalChain([el, 'optionalAccess',
|
|
2590
|
+
return _optionalChain([el, 'optionalAccess', _95 => _95.type]) === "seatBlock" ? _chunkUWCMN6Q7cjs.expandSeatBlock.call(void 0, { ...el, removed: [] }) : [];
|
|
2455
2591
|
}
|
|
2456
2592
|
var DesignerCanvas = _react.forwardRef.call(void 0, function DesignerCanvas2({ designer, placeTypes, lockedUnitIds, messages, frameKey, onPieceTap, backgroundImage = null, compact = false, overlay, theme }, ref) {
|
|
2457
2593
|
const { ui } = designer;
|
|
2458
|
-
const [
|
|
2594
|
+
const [preview, setPreview] = _react.useState.call(void 0, null);
|
|
2459
2595
|
const resizingRef = _react.useRef.call(void 0, null);
|
|
2460
|
-
const
|
|
2596
|
+
const resizing = _optionalChain([preview, 'optionalAccess', _96 => _96.kind]) === "replace" ? preview.element : null;
|
|
2597
|
+
const base = designer.layout;
|
|
2598
|
+
const baseUnits = _react.useMemo.call(void 0, () => _chunkUWCMN6Q7cjs.expand.call(void 0, base), [base]);
|
|
2599
|
+
const baseIndex = _react.useMemo.call(void 0, () => new (0, _chunkUWCMN6Q7cjs.SpatialIndex)(baseUnits), [baseUnits]);
|
|
2600
|
+
const baseBoxes = _react.useMemo.call(void 0, () => boxesOf(base), [base]);
|
|
2601
|
+
const changedKey = preview ? changedIds(preview).join("\0") : "";
|
|
2602
|
+
const split = _react.useMemo.call(void 0, () => changedKey ? splitUnits(baseUnits, new Set(changedKey.split("\0"))) : null, [baseUnits, changedKey]);
|
|
2603
|
+
const view = _react.useMemo.call(void 0,
|
|
2604
|
+
() => preview && split ? previewFrame(base, split, baseBoxes, preview) : { layout: base, units: baseUnits, index: baseIndex, boxes: baseBoxes },
|
|
2605
|
+
[preview, split, base, baseUnits, baseIndex, baseBoxes]
|
|
2606
|
+
);
|
|
2607
|
+
const { layout, units, index, boxes } = view;
|
|
2461
2608
|
const stageRef = _react.useRef.call(void 0, null);
|
|
2462
2609
|
const canvasRef = _react.useRef.call(void 0, null);
|
|
2463
2610
|
const [viewport, setViewport] = _react.useState.call(void 0, { width: 0, height: 0 });
|
|
@@ -2480,8 +2627,6 @@ var DesignerCanvas = _react.forwardRef.call(void 0, function DesignerCanvas2({ d
|
|
|
2480
2627
|
const spaceHeld = _react.useRef.call(void 0, false);
|
|
2481
2628
|
const [panReady, setPanReady] = _react.useState.call(void 0, false);
|
|
2482
2629
|
const marqueeArmed = _react.useRef.call(void 0, false);
|
|
2483
|
-
const units = _react.useMemo.call(void 0, () => _chunkLFRA3GBPcjs.expand.call(void 0, layout), [layout]);
|
|
2484
|
-
const index = _react.useMemo.call(void 0, () => new (0, _chunkLFRA3GBPcjs.SpatialIndex)(units), [units]);
|
|
2485
2630
|
const radii = _react.useMemo.call(void 0, () => unitRadii(layout), [layout]);
|
|
2486
2631
|
const bg = layout.meta.background;
|
|
2487
2632
|
const images = _react.useMemo.call(void 0,
|
|
@@ -2489,21 +2634,21 @@ var DesignerCanvas = _react.forwardRef.call(void 0, function DesignerCanvas2({ d
|
|
|
2489
2634
|
[bg, backgroundImage]
|
|
2490
2635
|
);
|
|
2491
2636
|
const placeTypeColors = _react.useMemo.call(void 0, () => new Map(placeTypes.map((p) => [p.ref, p.color])), [placeTypes]);
|
|
2492
|
-
const seatEditUnits = _react.useMemo.call(void 0, () => fullBlock(
|
|
2493
|
-
const seatEditIndex = _react.useMemo.call(void 0, () => new (0,
|
|
2637
|
+
const seatEditUnits = _react.useMemo.call(void 0, () => fullBlock(base, ui.seatEditId), [base, ui.seatEditId]);
|
|
2638
|
+
const seatEditIndex = _react.useMemo.call(void 0, () => new (0, _chunkUWCMN6Q7cjs.SpatialIndex)(seatEditUnits), [seatEditUnits]);
|
|
2494
2639
|
const seatEditById = _react.useMemo.call(void 0, () => new Map(seatEditUnits.map((u) => [u.id, u])), [seatEditUnits]);
|
|
2495
2640
|
const elementBoxes = _react.useMemo.call(void 0,
|
|
2496
2641
|
() => layout.elements.flatMap((el) => {
|
|
2497
|
-
const b =
|
|
2642
|
+
const b = boxes.get(el.id);
|
|
2498
2643
|
return b ? [{ el, b }] : [];
|
|
2499
2644
|
}),
|
|
2500
|
-
[layout]
|
|
2645
|
+
[layout, boxes]
|
|
2501
2646
|
);
|
|
2502
2647
|
const removed = _react.useMemo.call(void 0, () => {
|
|
2503
2648
|
if (seatEditUnits.length === 0) return /* @__PURE__ */ new Set();
|
|
2504
|
-
const present = new Set(
|
|
2649
|
+
const present = new Set(baseUnits.map((u) => u.id));
|
|
2505
2650
|
return new Set(seatEditUnits.filter((u) => !present.has(u.id)).map((u) => u.id));
|
|
2506
|
-
}, [seatEditUnits,
|
|
2651
|
+
}, [seatEditUnits, baseUnits]);
|
|
2507
2652
|
_react.useEffect.call(void 0, () => {
|
|
2508
2653
|
const el = stageRef.current;
|
|
2509
2654
|
if (!el) return;
|
|
@@ -2567,27 +2712,26 @@ var DesignerCanvas = _react.forwardRef.call(void 0, function DesignerCanvas2({ d
|
|
|
2567
2712
|
[layout, units, index, camera, viewport, palette, placeTypeColors, lockedUnitIds, messages.unassigned]
|
|
2568
2713
|
);
|
|
2569
2714
|
_react.useEffect.call(void 0, () => {
|
|
2570
|
-
const ctx = _optionalChain([canvasRef, 'access',
|
|
2715
|
+
const ctx = _optionalChain([canvasRef, 'access', _97 => _97.current, 'optionalAccess', _98 => _98.getContext, 'call', _99 => _99("2d")]);
|
|
2571
2716
|
if (!ctx || viewport.width === 0) return;
|
|
2572
2717
|
renderScene(scene, { ctx, camera, viewport, dpr, images });
|
|
2573
2718
|
ctx.setTransform(dpr, 0, 0, dpr, 0, 0);
|
|
2574
2719
|
if (bg && ui.backgroundEditing && !bg.locked) {
|
|
2575
2720
|
const a = worldToScreen(camera, viewport, { x: bg.x, y: bg.y });
|
|
2576
2721
|
const b = worldToScreen(camera, viewport, { x: bg.x + bg.width, y: bg.y + bg.height });
|
|
2577
|
-
const
|
|
2722
|
+
const up = lifted === BACKGROUND_ID;
|
|
2578
2723
|
ctx.save();
|
|
2579
|
-
if (
|
|
2724
|
+
if (up) {
|
|
2580
2725
|
ctx.shadowColor = "rgba(0,0,0,.35)";
|
|
2581
2726
|
ctx.shadowBlur = 12;
|
|
2582
2727
|
} else ctx.setLineDash([6, 4]);
|
|
2583
|
-
ctx.lineWidth =
|
|
2728
|
+
ctx.lineWidth = up ? 3 : 1.5;
|
|
2584
2729
|
ctx.strokeStyle = palette.selectedStroke;
|
|
2585
2730
|
ctx.strokeRect(a.x, a.y, b.x - a.x, b.y - a.y);
|
|
2586
2731
|
ctx.restore();
|
|
2587
2732
|
}
|
|
2588
2733
|
for (const id of ui.selection) {
|
|
2589
|
-
const
|
|
2590
|
-
const box = selected ? elementBounds(layout, selected) : null;
|
|
2734
|
+
const box = boxes.get(id);
|
|
2591
2735
|
if (!box) continue;
|
|
2592
2736
|
const a = worldToScreen(camera, viewport, { x: box.minX, y: box.minY });
|
|
2593
2737
|
const b = worldToScreen(camera, viewport, { x: box.maxX, y: box.maxY });
|
|
@@ -2612,12 +2756,11 @@ var DesignerCanvas = _react.forwardRef.call(void 0, function DesignerCanvas2({ d
|
|
|
2612
2756
|
ctx.strokeRect(Math.min(a.x, b.x), Math.min(a.y, b.y), Math.abs(b.x - a.x), Math.abs(b.y - a.y));
|
|
2613
2757
|
ctx.restore();
|
|
2614
2758
|
}
|
|
2615
|
-
const
|
|
2616
|
-
|
|
2617
|
-
if (upBox) {
|
|
2759
|
+
const upBox = lifted ? boxes.get(lifted) : void 0;
|
|
2760
|
+
if (lifted && upBox) {
|
|
2618
2761
|
const a = worldToScreen(camera, viewport, { x: upBox.minX, y: upBox.minY });
|
|
2619
2762
|
const b = worldToScreen(camera, viewport, { x: upBox.maxX, y: upBox.maxY });
|
|
2620
|
-
const pad = 12 + (_nullishCoalesce(radii.get(
|
|
2763
|
+
const pad = 12 + (_nullishCoalesce(radii.get(lifted), () => ( 0))) * camera.zoom;
|
|
2621
2764
|
ctx.save();
|
|
2622
2765
|
ctx.shadowColor = "rgba(0,0,0,.35)";
|
|
2623
2766
|
ctx.shadowBlur = 12;
|
|
@@ -2640,10 +2783,10 @@ var DesignerCanvas = _react.forwardRef.call(void 0, function DesignerCanvas2({ d
|
|
|
2640
2783
|
}
|
|
2641
2784
|
ctx.setLineDash([]);
|
|
2642
2785
|
}
|
|
2643
|
-
}, [scene, camera, viewport, dpr, images, bg, ui.backgroundEditing, ui.selection, ui.seatEditId,
|
|
2786
|
+
}, [scene, camera, viewport, dpr, images, bg, ui.backgroundEditing, ui.selection, ui.seatEditId, boxes, radii, palette, seatEditUnits, removed, lifted, hints, marquee]);
|
|
2644
2787
|
_react.useImperativeHandle.call(void 0, ref, () => ({
|
|
2645
2788
|
clientToWorld: (clientX, clientY) => {
|
|
2646
|
-
const r = _optionalChain([stageRef, 'access',
|
|
2789
|
+
const r = _optionalChain([stageRef, 'access', _100 => _100.current, 'optionalAccess', _101 => _101.getBoundingClientRect, 'call', _102 => _102()]);
|
|
2647
2790
|
if (!r || clientX < r.left || clientX > r.right || clientY < r.top || clientY > r.bottom) return null;
|
|
2648
2791
|
const { camera: c, viewport: v } = latest.current;
|
|
2649
2792
|
return screenToWorld(c, v, { x: clientX - r.left, y: clientY - r.top });
|
|
@@ -2679,9 +2822,12 @@ var DesignerCanvas = _react.forwardRef.call(void 0, function DesignerCanvas2({ d
|
|
|
2679
2822
|
} else if (fx.type === "moveBy") {
|
|
2680
2823
|
moveDragged(fx.elementId, fx.dx, fx.dy, fx.key, zoom);
|
|
2681
2824
|
} else if (fx.type === "moveEnd") {
|
|
2682
|
-
const
|
|
2825
|
+
const done = drag.current;
|
|
2826
|
+
const group = done && done.ids.length > 1;
|
|
2683
2827
|
drag.current = null;
|
|
2684
2828
|
setHints(null);
|
|
2829
|
+
setPreview(null);
|
|
2830
|
+
if (done && (done.applied.x !== 0 || done.applied.y !== 0)) d.moveMany(done.ids, done.applied.x, done.applied.y);
|
|
2685
2831
|
if (!group) d.dispatchUi({ type: "select", id: fx.elementId });
|
|
2686
2832
|
} else if (fx.type === "marquee") {
|
|
2687
2833
|
setMarquee({ from: fx.from, to: fx.to });
|
|
@@ -2699,12 +2845,12 @@ var DesignerCanvas = _react.forwardRef.call(void 0, function DesignerCanvas2({ d
|
|
|
2699
2845
|
const start = d.layout.elements.find((e) => e.id === fx.elementId);
|
|
2700
2846
|
if (!start) return;
|
|
2701
2847
|
resizingRef.current = snappedResize(start, fx.corner, fx.from, fx.to, zoom);
|
|
2702
|
-
|
|
2848
|
+
setPreview({ kind: "replace", element: resizingRef.current });
|
|
2703
2849
|
} else if (fx.type === "resizeEnd" || fx.type === "resizeCancel") {
|
|
2704
2850
|
const done = resizingRef.current;
|
|
2705
2851
|
resizingRef.current = null;
|
|
2706
2852
|
resizeOthers.current = null;
|
|
2707
|
-
|
|
2853
|
+
setPreview(null);
|
|
2708
2854
|
setHints(null);
|
|
2709
2855
|
const start = d.layout.elements.find((e) => e.id === fx.elementId);
|
|
2710
2856
|
if (fx.type === "resizeEnd" && done && start && done !== start) d.run({ type: "replaceElement", element: done });
|
|
@@ -2718,7 +2864,7 @@ var DesignerCanvas = _react.forwardRef.call(void 0, function DesignerCanvas2({ d
|
|
|
2718
2864
|
if (fx.elementId) d.dispatchUi({ type: "toggleSelect", id: fx.elementId });
|
|
2719
2865
|
} else {
|
|
2720
2866
|
d.dispatchUi({ type: "select", id: fx.elementId });
|
|
2721
|
-
if (fx.elementId) _optionalChain([onPieceTapRef, 'access',
|
|
2867
|
+
if (fx.elementId) _optionalChain([onPieceTapRef, 'access', _103 => _103.current, 'optionalCall', _104 => _104(fx.elementId)]);
|
|
2722
2868
|
}
|
|
2723
2869
|
};
|
|
2724
2870
|
const sheetBox = (l) => ({ minX: 0, minY: 0, maxX: l.meta.width, maxY: l.meta.height });
|
|
@@ -2736,10 +2882,11 @@ var DesignerCanvas = _react.forwardRef.call(void 0, function DesignerCanvas2({ d
|
|
|
2736
2882
|
}
|
|
2737
2883
|
current.raw = { x: current.raw.x + dx, y: current.raw.y + dy };
|
|
2738
2884
|
const snap = altHeld.current ? null : snapMove(shiftBox(current.start, current.raw.x, current.raw.y), current.others, SNAP_PX / zoom, { sheet: sheetBox(d.layout) });
|
|
2739
|
-
const target = { x: current.raw.x + (_nullishCoalesce(_optionalChain([snap, 'optionalAccess',
|
|
2740
|
-
|
|
2741
|
-
|
|
2742
|
-
|
|
2885
|
+
const target = { x: current.raw.x + (_nullishCoalesce(_optionalChain([snap, 'optionalAccess', _105 => _105.dx]), () => ( 0))), y: current.raw.y + (_nullishCoalesce(_optionalChain([snap, 'optionalAccess', _106 => _106.dy]), () => ( 0))) };
|
|
2886
|
+
if (target.x !== current.applied.x || target.y !== current.applied.y) {
|
|
2887
|
+
current.applied = target;
|
|
2888
|
+
setPreview({ kind: "move", ids: current.ids, dx: target.x, dy: target.y });
|
|
2889
|
+
}
|
|
2743
2890
|
setHints(snap && (snap.guides.length > 0 || snap.gaps.length > 0) ? { guides: snap.guides, gaps: snap.gaps, matches: [] } : null);
|
|
2744
2891
|
};
|
|
2745
2892
|
const snappedResize = (start, corner, from, to, zoom) => {
|
|
@@ -2757,7 +2904,7 @@ var DesignerCanvas = _react.forwardRef.call(void 0, function DesignerCanvas2({ d
|
|
|
2757
2904
|
if (isScaled2(next) && isScaled2(start)) {
|
|
2758
2905
|
const same = d.layout.elements.filter((el) => el.id !== start.id && el.type === next.type);
|
|
2759
2906
|
const match = snapScaleTo(_nullishCoalesce(next.scale, () => ( 1)), same.map((el) => _nullishCoalesce(el.scale, () => ( 1))));
|
|
2760
|
-
const sized2 = match !== null && match !== (_nullishCoalesce(next.scale, () => ( 1))) ?
|
|
2907
|
+
const sized2 = match !== null && match !== (_nullishCoalesce(next.scale, () => ( 1))) ? _chunkUWCMN6Q7cjs.scalePiece.call(void 0, start, match) : next;
|
|
2761
2908
|
const now = _nullishCoalesce(sized2.scale, () => ( 1));
|
|
2762
2909
|
const matches = same.filter((el) => (_nullishCoalesce(el.scale, () => ( 1))) === now).flatMap((el) => _nullishCoalesce(pieceBounds(el), () => ( [])));
|
|
2763
2910
|
setHints(matches.length > 0 ? { guides: [], gaps: [], matches } : null);
|
|
@@ -2783,7 +2930,7 @@ var DesignerCanvas = _react.forwardRef.call(void 0, function DesignerCanvas2({ d
|
|
|
2783
2930
|
const nowMarquee = isMarqueeArmed(r.state);
|
|
2784
2931
|
if (nowMarquee && !marqueeArmed.current) {
|
|
2785
2932
|
try {
|
|
2786
|
-
_optionalChain([navigator, 'access',
|
|
2933
|
+
_optionalChain([navigator, 'access', _107 => _107.vibrate, 'optionalCall', _108 => _108(10)]);
|
|
2787
2934
|
} catch (e2) {
|
|
2788
2935
|
}
|
|
2789
2936
|
}
|
|
@@ -2792,7 +2939,7 @@ var DesignerCanvas = _react.forwardRef.call(void 0, function DesignerCanvas2({ d
|
|
|
2792
2939
|
if (nowLifted !== liftedRef.current) {
|
|
2793
2940
|
if (nowLifted) {
|
|
2794
2941
|
try {
|
|
2795
|
-
_optionalChain([navigator, 'access',
|
|
2942
|
+
_optionalChain([navigator, 'access', _109 => _109.vibrate, 'optionalCall', _110 => _110(10)]);
|
|
2796
2943
|
} catch (e3) {
|
|
2797
2944
|
}
|
|
2798
2945
|
}
|
|
@@ -2864,7 +3011,7 @@ var DesignerCanvas = _react.forwardRef.call(void 0, function DesignerCanvas2({ d
|
|
|
2864
3011
|
}
|
|
2865
3012
|
const d = latest.current.designer;
|
|
2866
3013
|
const { camera: c, viewport: v } = latest.current;
|
|
2867
|
-
const hit = kind === "down" ? _nullishCoalesce(_nullishCoalesce(backgroundAt(d.layout.meta.background, screenToWorld(c, v, p), d.ui.backgroundEditing), () => ( _optionalChain([elementAt, 'call',
|
|
3014
|
+
const hit = kind === "down" ? _nullishCoalesce(_nullishCoalesce(backgroundAt(d.layout.meta.background, screenToWorld(c, v, p), d.ui.backgroundEditing), () => ( _optionalChain([elementAt, 'call', _111 => _111(d.layout, p, c, v, { radii, slopPx: EDIT_HIT_SLOP_PX }), 'optionalAccess', _112 => _112.id]))), () => ( null)) : null;
|
|
2868
3015
|
const elementLocked = d.ui.armed !== null || hit !== null && hit === d.ui.seatEditId;
|
|
2869
3016
|
if (kind !== "down") {
|
|
2870
3017
|
feed({ kind, p, hitElementId: hit, elementLocked });
|
|
@@ -2925,23 +3072,22 @@ var DesignerCanvas = _react.forwardRef.call(void 0, function DesignerCanvas2({ d
|
|
|
2925
3072
|
const id = pendingFocus.current;
|
|
2926
3073
|
if (!id) return;
|
|
2927
3074
|
pendingFocus.current = null;
|
|
2928
|
-
_optionalChain([stageRef, 'access',
|
|
3075
|
+
_optionalChain([stageRef, 'access', _113 => _113.current, 'optionalAccess', _114 => _114.querySelector, 'call', _115 => _115(`[data-element-id="${id}"]`), 'optionalAccess', _116 => _116.focus, 'call', _117 => _117()]);
|
|
2929
3076
|
});
|
|
2930
3077
|
const armedName = ui.armed ? armedLabel(ui.armed, messages) : null;
|
|
2931
3078
|
const selectedEl = ui.selectedId ? layout.elements.find((e) => e.id === ui.selectedId) : void 0;
|
|
2932
3079
|
const selectedBox = _react.useMemo.call(void 0, () => {
|
|
2933
3080
|
if (viewport.width === 0) return null;
|
|
2934
|
-
const
|
|
2935
|
-
const
|
|
2936
|
-
const b = el ? elementBounds(layout, el) : null;
|
|
3081
|
+
const picked2 = ui.selection.flatMap((id) => {
|
|
3082
|
+
const b = boxes.get(id);
|
|
2937
3083
|
if (!b) return [];
|
|
2938
3084
|
const a = worldToScreen(camera, viewport, { x: b.minX, y: b.minY });
|
|
2939
3085
|
const z = worldToScreen(camera, viewport, { x: b.maxX, y: b.maxY });
|
|
2940
3086
|
const pad = 8 + (_nullishCoalesce(radii.get(id), () => ( 0))) * camera.zoom;
|
|
2941
3087
|
return [{ minX: a.x - pad, minY: a.y - pad, maxX: z.x + pad, maxY: z.y + pad }];
|
|
2942
3088
|
});
|
|
2943
|
-
return union(
|
|
2944
|
-
}, [ui.selection,
|
|
3089
|
+
return union(picked2);
|
|
3090
|
+
}, [ui.selection, boxes, camera, viewport, radii]);
|
|
2945
3091
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2946
3092
|
"div",
|
|
2947
3093
|
{
|
|
@@ -3015,7 +3161,7 @@ var DesignerCanvas = _react.forwardRef.call(void 0, function DesignerCanvas2({ d
|
|
|
3015
3161
|
return;
|
|
3016
3162
|
}
|
|
3017
3163
|
designer.dispatchUi({ type: "select", id: el.id });
|
|
3018
|
-
if (plain) _optionalChain([onPieceTap, 'optionalCall',
|
|
3164
|
+
if (plain) _optionalChain([onPieceTap, 'optionalCall', _118 => _118(el.id)]);
|
|
3019
3165
|
},
|
|
3020
3166
|
children: pieceName(el, placeTypes, messages)
|
|
3021
3167
|
},
|
|
@@ -3071,7 +3217,7 @@ function armedLabel(kind, m) {
|
|
|
3071
3217
|
if (kind === "roundTable") return m.pieceRoundTable;
|
|
3072
3218
|
if (kind === "rectTable") return m.pieceRectTable;
|
|
3073
3219
|
if (kind === "zone") return m.pieceZone;
|
|
3074
|
-
return _nullishCoalesce(_optionalChain([
|
|
3220
|
+
return _nullishCoalesce(_optionalChain([_chunkUWCMN6Q7cjs.landmarkById.call(void 0, kind.slice("landmark:".length)), 'optionalAccess', _119 => _119.name]), () => ( kind));
|
|
3075
3221
|
}
|
|
3076
3222
|
function drawHints(ctx, hints, camera, viewport, color) {
|
|
3077
3223
|
const at = (x, y) => worldToScreen(camera, viewport, { x, y });
|
|
@@ -3160,6 +3306,9 @@ function violationText(v, m) {
|
|
|
3160
3306
|
return v.reason === "table" ? format(m.rejectTable, { table: v.table }) : format(m.rejectRow, { row: v.row });
|
|
3161
3307
|
}
|
|
3162
3308
|
function rejectionText(r, m) {
|
|
3309
|
+
if (r.invalid !== void 0) {
|
|
3310
|
+
return /máximo de unidades vendibles/.test(r.invalid) ? m.rejectTooManyUnits : m.rejectInvalid;
|
|
3311
|
+
}
|
|
3163
3312
|
const [over, ...moreOver] = _nullishCoalesce(r.capacity, () => ( []));
|
|
3164
3313
|
if (over) {
|
|
3165
3314
|
const head2 = format(m.rejectCapacity, { type: over.label, capacity: over.capacity, placed: over.placed });
|
|
@@ -3176,12 +3325,12 @@ function rejectionText(r, m) {
|
|
|
3176
3325
|
|
|
3177
3326
|
// ../react/src/designer/guide.ts
|
|
3178
3327
|
var overlaps = (a, b) => a.minX < b.maxX && a.maxX > b.minX && a.minY < b.maxY && a.maxY > b.minY;
|
|
3179
|
-
var
|
|
3328
|
+
var shifted2 = (b, dx, dy) => ({ minX: b.minX + dx, minY: b.minY + dy, maxX: b.maxX + dx, maxY: b.maxY + dy });
|
|
3180
3329
|
function freeSpot(box, occupied, gap = 24, rings = 12) {
|
|
3181
3330
|
const sx = box.maxX - box.minX + gap;
|
|
3182
3331
|
const sy = box.maxY - box.minY + gap;
|
|
3183
3332
|
const padded = occupied.map((o) => ({ minX: o.minX - gap / 2, minY: o.minY - gap / 2, maxX: o.maxX + gap / 2, maxY: o.maxY + gap / 2 }));
|
|
3184
|
-
const free = (dx, dy) => !padded.some((o) => overlaps(
|
|
3333
|
+
const free = (dx, dy) => !padded.some((o) => overlaps(shifted2(box, dx, dy), o));
|
|
3185
3334
|
if (free(0, 0)) return { dx: 0, dy: 0 };
|
|
3186
3335
|
const dirs = [[0, 1], [1, 0], [0, -1], [-1, 0], [1, 1], [-1, 1], [1, -1], [-1, -1]];
|
|
3187
3336
|
for (let k = 1; k <= rings; k++) {
|
|
@@ -3207,7 +3356,7 @@ function anchorPanel(piece, panel, viewport, margin = 12) {
|
|
|
3207
3356
|
return docked;
|
|
3208
3357
|
}
|
|
3209
3358
|
function range(rule, count) {
|
|
3210
|
-
const labels =
|
|
3359
|
+
const labels = _chunkUWCMN6Q7cjs.labelSequence.call(void 0, rule, count);
|
|
3211
3360
|
return { from: _nullishCoalesce(labels[0], () => ( "")), to: _nullishCoalesce(labels[labels.length - 1], () => ( "")) };
|
|
3212
3361
|
}
|
|
3213
3362
|
function blockRangeText(block, templates) {
|
|
@@ -3218,24 +3367,24 @@ function blockRangeText(block, templates) {
|
|
|
3218
3367
|
function reshapeBlock(block, patch) {
|
|
3219
3368
|
const next = { ...block, ...patch };
|
|
3220
3369
|
if (block.removed.length === 0) return next;
|
|
3221
|
-
const oldRows =
|
|
3222
|
-
const oldSeats =
|
|
3223
|
-
const newRows =
|
|
3224
|
-
const newSeats =
|
|
3370
|
+
const oldRows = _chunkUWCMN6Q7cjs.expandLabels.call(void 0, block.rowLabels, block.rows);
|
|
3371
|
+
const oldSeats = _chunkUWCMN6Q7cjs.expandLabels.call(void 0, block.seatLabels, block.cols);
|
|
3372
|
+
const newRows = _chunkUWCMN6Q7cjs.expandLabels.call(void 0, next.rowLabels, next.rows);
|
|
3373
|
+
const newSeats = _chunkUWCMN6Q7cjs.expandLabels.call(void 0, next.seatLabels, next.cols);
|
|
3225
3374
|
const removed = [];
|
|
3226
3375
|
for (const id of block.removed) {
|
|
3227
|
-
const [, row, seat] =
|
|
3376
|
+
const [, row, seat] = _chunkUWCMN6Q7cjs.parseUnitId.call(void 0, id);
|
|
3228
3377
|
const r = row === void 0 ? -1 : oldRows.indexOf(row);
|
|
3229
3378
|
const c = seat === void 0 ? -1 : oldSeats.indexOf(seat);
|
|
3230
3379
|
if (r < 0 || c < 0 || r >= next.rows || c >= next.cols) continue;
|
|
3231
|
-
removed.push(
|
|
3380
|
+
removed.push(_chunkUWCMN6Q7cjs.seatUnitId.call(void 0, block.id, newRows[r], newSeats[c]));
|
|
3232
3381
|
}
|
|
3233
3382
|
return { ...next, removed };
|
|
3234
3383
|
}
|
|
3235
3384
|
function labelStart(kind, raw, alphabet) {
|
|
3236
3385
|
const start = kind === "letters" ? raw.trim().toUpperCase() : raw.trim();
|
|
3237
3386
|
const rule = kind === "letters" && alphabet ? { kind, start, direction: "ltr", alphabet } : { kind, start, direction: "ltr" };
|
|
3238
|
-
return
|
|
3387
|
+
return _chunkUWCMN6Q7cjs.labelRuleSchema.safeParse(rule).success ? start : null;
|
|
3239
3388
|
}
|
|
3240
3389
|
function switchLabelKind(rule, kind) {
|
|
3241
3390
|
if (rule.kind === kind) return rule;
|
|
@@ -3254,7 +3403,7 @@ function setLabelAlphabet(rule, alphabet) {
|
|
|
3254
3403
|
if (rule.kind !== "letters") return rule;
|
|
3255
3404
|
const { alphabet: _old, ...rest } = rule;
|
|
3256
3405
|
if (alphabet === "es") return { ...rest, alphabet };
|
|
3257
|
-
const skip = _optionalChain([rest, 'access',
|
|
3406
|
+
const skip = _optionalChain([rest, 'access', _120 => _120.skip, 'optionalAccess', _121 => _121.filter, 'call', _122 => _122((s) => !/ñ/i.test(s))]);
|
|
3258
3407
|
const { skip: _skip, ...noSkip } = rest;
|
|
3259
3408
|
return {
|
|
3260
3409
|
...skip && skip.length > 0 ? { ...noSkip, skip } : noSkip,
|
|
@@ -3280,10 +3429,10 @@ function withSkip(rule, skip) {
|
|
|
3280
3429
|
var plural = (n, one, many) => n === 1 ? one : format(many, { n });
|
|
3281
3430
|
function placeTypeStatus(option, layout, summary, m) {
|
|
3282
3431
|
const s = summary.byRef[option.ref];
|
|
3283
|
-
const pieces = layout.elements.filter((e) => e.type !== "landmark" && (_optionalChain([e, 'access',
|
|
3284
|
-
const units = _nullishCoalesce(_optionalChain([s, 'optionalAccess',
|
|
3432
|
+
const pieces = layout.elements.filter((e) => e.type !== "landmark" && (_optionalChain([e, 'access', _123 => _123.placeType, 'optionalAccess', _124 => _124.ref]) || null) === option.ref).length;
|
|
3433
|
+
const units = _nullishCoalesce(_optionalChain([s, 'optionalAccess', _125 => _125.units]), () => ( 0));
|
|
3285
3434
|
if (option.accepts === "zone") {
|
|
3286
|
-
const zones = _nullishCoalesce(_optionalChain([s, 'optionalAccess',
|
|
3435
|
+
const zones = _nullishCoalesce(_optionalChain([s, 'optionalAccess', _126 => _126.zones]), () => ( 0));
|
|
3287
3436
|
return {
|
|
3288
3437
|
units,
|
|
3289
3438
|
pieces,
|
|
@@ -3305,10 +3454,10 @@ function joinNames(names, m) {
|
|
|
3305
3454
|
return format(m.summaryAnd, { a: names.slice(0, -1).join(", "), b: names[names.length - 1] });
|
|
3306
3455
|
}
|
|
3307
3456
|
function missingPlaceTypes(placeTypes, summary) {
|
|
3308
|
-
return placeTypes.filter((o) => o.accepts !== "zone" && (_nullishCoalesce(_optionalChain([summary, 'access',
|
|
3457
|
+
return placeTypes.filter((o) => o.accepts !== "zone" && (_nullishCoalesce(_optionalChain([summary, 'access', _127 => _127.byRef, 'access', _128 => _128[o.ref], 'optionalAccess', _129 => _129.units]), () => ( 0))) === 0);
|
|
3309
3458
|
}
|
|
3310
3459
|
function unitsOnSale(placeTypes, summary) {
|
|
3311
|
-
return placeTypes.reduce((n, o) => o.accepts === "zone" ? n : n + (_nullishCoalesce(_optionalChain([summary, 'access',
|
|
3460
|
+
return placeTypes.reduce((n, o) => o.accepts === "zone" ? n : n + (_nullishCoalesce(_optionalChain([summary, 'access', _130 => _130.byRef, 'access', _131 => _131[o.ref], 'optionalAccess', _132 => _132.units]), () => ( 0))), 0);
|
|
3312
3461
|
}
|
|
3313
3462
|
function numberingCounts(block, m) {
|
|
3314
3463
|
const removed = block.removed.length;
|
|
@@ -3340,9 +3489,9 @@ function FloatingPanel(props) {
|
|
|
3340
3489
|
ref,
|
|
3341
3490
|
className: "vk-d-float",
|
|
3342
3491
|
"aria-labelledby": props.labelledBy,
|
|
3343
|
-
"data-docked": _optionalChain([pos, 'optionalAccess',
|
|
3492
|
+
"data-docked": _optionalChain([pos, 'optionalAccess', _133 => _133.docked]) || void 0,
|
|
3344
3493
|
"data-testid": "piece-panel",
|
|
3345
|
-
style: { width, left: _nullishCoalesce(_optionalChain([pos, 'optionalAccess',
|
|
3494
|
+
style: { width, left: _nullishCoalesce(_optionalChain([pos, 'optionalAccess', _134 => _134.left]), () => ( 0)), top: _nullishCoalesce(_optionalChain([pos, 'optionalAccess', _135 => _135.top]), () => ( 0)), visibility: pos ? "visible" : "hidden" },
|
|
3346
3495
|
children: props.children
|
|
3347
3496
|
}
|
|
3348
3497
|
);
|
|
@@ -3350,29 +3499,29 @@ function FloatingPanel(props) {
|
|
|
3350
3499
|
|
|
3351
3500
|
// ../react/src/designer/capacity.ts
|
|
3352
3501
|
function capacityRejections(before, after, placeTypes) {
|
|
3353
|
-
const over =
|
|
3502
|
+
const over = _chunkUWCMN6Q7cjs.capacityViolations.call(void 0, before, after, placeTypes);
|
|
3354
3503
|
if (over.length === 0) return [];
|
|
3355
|
-
const was =
|
|
3356
|
-
return over.map((v) => ({ ref: v.ref, label: v.label, capacity: v.capacity, placed: _nullishCoalesce(_optionalChain([was, 'access',
|
|
3504
|
+
const was = _chunkUWCMN6Q7cjs.summarize.call(void 0, before).byRef;
|
|
3505
|
+
return over.map((v) => ({ ref: v.ref, label: v.label, capacity: v.capacity, placed: _nullishCoalesce(_optionalChain([was, 'access', _136 => _136[v.ref], 'optionalAccess', _137 => _137.units]), () => ( 0)) }));
|
|
3357
3506
|
}
|
|
3358
3507
|
function placedUnits(option, summary) {
|
|
3359
|
-
return _nullishCoalesce(_optionalChain([summary, 'access',
|
|
3508
|
+
return _nullishCoalesce(_optionalChain([summary, 'access', _138 => _138.byRef, 'access', _139 => _139[option.ref], 'optionalAccess', _140 => _140.units]), () => ( 0));
|
|
3360
3509
|
}
|
|
3361
3510
|
function nextPiece(option, placed) {
|
|
3362
3511
|
if (option.accepts === "zone") return { units: 1 };
|
|
3363
|
-
if (option.accepts === "seats") return { units:
|
|
3364
|
-
const capacity =
|
|
3512
|
+
if (option.accepts === "seats") return { units: _chunkUWCMN6Q7cjs.nextBlockUnits.call(void 0, option, placed) };
|
|
3513
|
+
const capacity = _chunkUWCMN6Q7cjs.placeTypeCapacity.call(void 0, option);
|
|
3365
3514
|
const left = capacity === null ? Infinity : Math.max(0, capacity - placed);
|
|
3366
3515
|
if (option.accepts === "tableWhole") return { units: Math.min(1, left) };
|
|
3367
|
-
return { units: Math.min(
|
|
3516
|
+
return { units: Math.min(_chunkUWCMN6Q7cjs.DEFAULT_TABLE_PLACES, left) };
|
|
3368
3517
|
}
|
|
3369
3518
|
function capacityText(option, summary, m) {
|
|
3370
|
-
const capacity =
|
|
3519
|
+
const capacity = _chunkUWCMN6Q7cjs.placeTypeCapacity.call(void 0, option);
|
|
3371
3520
|
if (capacity === null || option.accepts === "zone") return null;
|
|
3372
3521
|
return format(m.capacityCount, { placed: placedUnits(option, summary), capacity });
|
|
3373
3522
|
}
|
|
3374
3523
|
function capacityFullText(option, summary, m) {
|
|
3375
|
-
const capacity =
|
|
3524
|
+
const capacity = _chunkUWCMN6Q7cjs.placeTypeCapacity.call(void 0, option);
|
|
3376
3525
|
if (capacity === null || option.accepts === "zone") return null;
|
|
3377
3526
|
const placed = placedUnits(option, summary);
|
|
3378
3527
|
if (placed > capacity) return format(m.capacityOver, { over: placed - capacity, capacity, name: option.label });
|
|
@@ -3380,20 +3529,20 @@ function capacityFullText(option, summary, m) {
|
|
|
3380
3529
|
return format(m.capacityFull, { capacity, name: option.label });
|
|
3381
3530
|
}
|
|
3382
3531
|
function overCapacity(option, summary) {
|
|
3383
|
-
const capacity =
|
|
3532
|
+
const capacity = _chunkUWCMN6Q7cjs.placeTypeCapacity.call(void 0, option);
|
|
3384
3533
|
if (capacity === null || option.accepts === "zone") return 0;
|
|
3385
3534
|
return Math.max(0, placedUnits(option, summary) - capacity);
|
|
3386
3535
|
}
|
|
3387
3536
|
function trimPlan(layout, option, locked) {
|
|
3388
|
-
let left = overCapacity(option,
|
|
3537
|
+
let left = overCapacity(option, _chunkUWCMN6Q7cjs.summarize.call(void 0, layout));
|
|
3389
3538
|
if (left === 0) return null;
|
|
3390
3539
|
const commands = [];
|
|
3391
3540
|
let removed = 0;
|
|
3392
3541
|
for (let i = layout.elements.length - 1; i >= 0 && left > 0; i--) {
|
|
3393
3542
|
const el = layout.elements[i];
|
|
3394
|
-
if (el.type === "landmark" || el.type === "zone" || (_optionalChain([el, 'access',
|
|
3543
|
+
if (el.type === "landmark" || el.type === "zone" || (_optionalChain([el, 'access', _141 => _141.placeType, 'optionalAccess', _142 => _142.ref]) || null) !== option.ref) continue;
|
|
3395
3544
|
if (el.type === "seatBlock") {
|
|
3396
|
-
const units =
|
|
3545
|
+
const units = _chunkUWCMN6Q7cjs.expandSeatBlock.call(void 0, el);
|
|
3397
3546
|
const take = units.filter((u) => !locked.has(u.id)).sort((a, b) => b.rowIndex - a.rowIndex || b.colIndex - a.colIndex).slice(0, left);
|
|
3398
3547
|
if (take.length === 0) continue;
|
|
3399
3548
|
commands.push(
|
|
@@ -3408,7 +3557,7 @@ function trimPlan(layout, option, locked) {
|
|
|
3408
3557
|
left--;
|
|
3409
3558
|
} else {
|
|
3410
3559
|
let lastLocked = 0;
|
|
3411
|
-
for (let n = 1; n <= el.places; n++) if (locked.has(
|
|
3560
|
+
for (let n = 1; n <= el.places; n++) if (locked.has(_chunkUWCMN6Q7cjs.placeUnitId.call(void 0, el.id, n))) lastLocked = n;
|
|
3412
3561
|
if (lastLocked === 0 && left >= el.places) {
|
|
3413
3562
|
commands.push({ type: "removeElement", id: el.id });
|
|
3414
3563
|
removed += el.places;
|
|
@@ -3429,7 +3578,7 @@ function trimPlan(layout, option, locked) {
|
|
|
3429
3578
|
function piecesByRef(layout) {
|
|
3430
3579
|
const out = {};
|
|
3431
3580
|
for (const el of layout.elements) {
|
|
3432
|
-
const ref = el.type === "landmark" ? "" : _optionalChain([el, 'access',
|
|
3581
|
+
const ref = el.type === "landmark" ? "" : _optionalChain([el, 'access', _143 => _143.placeType, 'optionalAccess', _144 => _144.ref]) || "";
|
|
3433
3582
|
if (ref) out[ref] = (_nullishCoalesce(out[ref], () => ( 0))) + 1;
|
|
3434
3583
|
}
|
|
3435
3584
|
return out;
|
|
@@ -3442,8 +3591,8 @@ function hostReads(placeTypes, summary, pieces, m) {
|
|
|
3442
3591
|
return o ? nextPiece(o, placedUnits(o, summary)).units : 0;
|
|
3443
3592
|
},
|
|
3444
3593
|
placed: (ref) => ({
|
|
3445
|
-
units: _nullishCoalesce(_optionalChain([summary, 'access',
|
|
3446
|
-
zones: _nullishCoalesce(_optionalChain([summary, 'access',
|
|
3594
|
+
units: _nullishCoalesce(_optionalChain([summary, 'access', _145 => _145.byRef, 'access', _146 => _146[ref], 'optionalAccess', _147 => _147.units]), () => ( 0)),
|
|
3595
|
+
zones: _nullishCoalesce(_optionalChain([summary, 'access', _148 => _148.byRef, 'access', _149 => _149[ref], 'optionalAccess', _150 => _150.zones]), () => ( 0)),
|
|
3447
3596
|
pieces: _nullishCoalesce(pieces[ref], () => ( 0))
|
|
3448
3597
|
}),
|
|
3449
3598
|
capacityText: (ref) => {
|
|
@@ -3482,17 +3631,17 @@ function syncPlaceTypes(layout, previous, placeTypes) {
|
|
|
3482
3631
|
const before = new Set(previous.map((o) => o.ref));
|
|
3483
3632
|
let changed = false;
|
|
3484
3633
|
const elements = layout.elements.map((el) => {
|
|
3485
|
-
if (el.type === "landmark" || !_optionalChain([el, 'access',
|
|
3634
|
+
if (el.type === "landmark" || !_optionalChain([el, 'access', _151 => _151.placeType, 'optionalAccess', _152 => _152.ref])) return el;
|
|
3486
3635
|
const option = byRef.get(el.placeType.ref);
|
|
3487
3636
|
if (!option && !before.has(el.placeType.ref)) return el;
|
|
3488
|
-
if (!option || !
|
|
3637
|
+
if (!option || !_chunkUWCMN6Q7cjs.canAssign.call(void 0, el, option)) {
|
|
3489
3638
|
changed = true;
|
|
3490
3639
|
return { ...el, placeType: { ref: "", name: el.placeType.name } };
|
|
3491
3640
|
}
|
|
3492
3641
|
const mode = option.accepts === "tablePerPlace" ? "perPlace" : "whole";
|
|
3493
3642
|
if (el.placeType.name === option.label && (el.type !== "table" || el.mode === mode)) return el;
|
|
3494
3643
|
changed = true;
|
|
3495
|
-
return
|
|
3644
|
+
return _chunkUWCMN6Q7cjs.assignPlaceType.call(void 0, el, option);
|
|
3496
3645
|
});
|
|
3497
3646
|
return changed ? { ...layout, elements } : layout;
|
|
3498
3647
|
}
|
|
@@ -3646,7 +3795,7 @@ function LandmarkPicker({ messages: m, onPick }) {
|
|
|
3646
3795
|
const groups = LANDMARK_GROUPS.map(({ group, key }) => ({
|
|
3647
3796
|
group,
|
|
3648
3797
|
title: m[key],
|
|
3649
|
-
items:
|
|
3798
|
+
items: _chunkUWCMN6Q7cjs.landmarks.filter((l) => l.group === group && (q === "" || fold(l.name).includes(q)))
|
|
3650
3799
|
})).filter((g) => g.items.length > 0);
|
|
3651
3800
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "vk-d-landmarks", children: [
|
|
3652
3801
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "label", { className: "vk-d-search", htmlFor: searchId, children: [
|
|
@@ -3851,6 +4000,8 @@ var designerEs = {
|
|
|
3851
4000
|
trimToCapacityLabel: "Sacar los {over} lugares que sobran de {name}",
|
|
3852
4001
|
trimPartial: "Quedan {n} de m\xE1s que no se pueden sacar: ya est\xE1n vendidos o reservados.",
|
|
3853
4002
|
rejectCapacity: "{type} tiene {capacity} lugares y ya ubicaste {placed}.",
|
|
4003
|
+
rejectInvalid: "No se pudo hacer ese cambio: la pieza quedar\xEDa demasiado grande o fuera del plano.",
|
|
4004
|
+
rejectTooManyUnits: "No se pudo hacer ese cambio: un plano puede tener hasta 100.000 lugares.",
|
|
3854
4005
|
zonesTitle: "Tus entradas generales",
|
|
3855
4006
|
zonesHint: "Si quer\xE9s, marc\xE1 en el plano d\xF3nde queda cada una. Quien compra la toca en el mapa.",
|
|
3856
4007
|
acceptsZone: "Entrada general",
|
|
@@ -4069,6 +4220,8 @@ var designerEn = {
|
|
|
4069
4220
|
trimToCapacityLabel: "Remove the {over} extra spots of {name}",
|
|
4070
4221
|
trimPartial: "{n} extra spots can't be removed: they are already sold or held.",
|
|
4071
4222
|
rejectCapacity: "{type} has {capacity} spots and you've already placed {placed}.",
|
|
4223
|
+
rejectInvalid: "That change couldn't be made: the piece would be too big or off the plan.",
|
|
4224
|
+
rejectTooManyUnits: "That change couldn't be made: a plan can have up to 100,000 spots.",
|
|
4072
4225
|
zonesTitle: "Your general admission tickets",
|
|
4073
4226
|
zonesHint: "If you want, mark on the plan where each one is. Buyers tap it on the map.",
|
|
4074
4227
|
acceptsZone: "General admission",
|
|
@@ -4171,13 +4324,13 @@ function SizeStepper(props) {
|
|
|
4171
4324
|
const { piece, messages: m } = props;
|
|
4172
4325
|
const scale = _nullishCoalesce(piece.scale, () => ( 1));
|
|
4173
4326
|
const id = _react.useId.call(void 0, );
|
|
4174
|
-
const set = (direction) => props.onRun({ type: "replaceElement", element:
|
|
4327
|
+
const set = (direction) => props.onRun({ type: "replaceElement", element: _chunkUWCMN6Q7cjs.scalePiece.call(void 0, piece, steppedScale(scale, direction)) });
|
|
4175
4328
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "vk-d-field", role: "group", "aria-labelledby": id, children: [
|
|
4176
4329
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { id, children: m.pieceSize }),
|
|
4177
4330
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "vk-d-stepper", children: [
|
|
4178
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "button", { type: "button", "aria-label": m.sizeLess, disabled: scale <=
|
|
4331
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "button", { type: "button", "aria-label": m.sizeLess, disabled: scale <= _chunkUWCMN6Q7cjs.MIN_SCALE, onClick: () => set(-1), children: "\u2212" }),
|
|
4179
4332
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "output", { className: "vk-d-stepper-value", "aria-live": "polite", children: format(m.pieceSizeValue, { n: Math.round(scale * 100) }) }),
|
|
4180
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "button", { type: "button", "aria-label": m.sizeMore, disabled: scale >=
|
|
4333
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "button", { type: "button", "aria-label": m.sizeMore, disabled: scale >= _chunkUWCMN6Q7cjs.MAX_SCALE, onClick: () => set(1), children: "+" })
|
|
4181
4334
|
] })
|
|
4182
4335
|
] });
|
|
4183
4336
|
}
|
|
@@ -4222,12 +4375,12 @@ var ZONE_MAX = 4e3;
|
|
|
4222
4375
|
var ZONE_STEP = 20;
|
|
4223
4376
|
function pieceHeading(el, placeTypes, m) {
|
|
4224
4377
|
if (el.type === "landmark") return { color: null, text: el.name };
|
|
4225
|
-
const ref = _optionalChain([el, 'access',
|
|
4378
|
+
const ref = _optionalChain([el, 'access', _153 => _153.placeType, 'optionalAccess', _154 => _154.ref]) || null;
|
|
4226
4379
|
const option = ref ? placeTypes.find((p) => p.ref === ref) : void 0;
|
|
4227
|
-
const name = _nullishCoalesce(_optionalChain([option, 'optionalAccess',
|
|
4228
|
-
if (el.type === "zone") return { color: _nullishCoalesce(_optionalChain([option, 'optionalAccess',
|
|
4229
|
-
const count = el.type === "seatBlock" ? plural2(
|
|
4230
|
-
return { color: _nullishCoalesce(_optionalChain([option, 'optionalAccess',
|
|
4380
|
+
const name = _nullishCoalesce(_optionalChain([option, 'optionalAccess', _155 => _155.label]), () => ( m.unassigned));
|
|
4381
|
+
if (el.type === "zone") return { color: _nullishCoalesce(_optionalChain([option, 'optionalAccess', _156 => _156.color]), () => ( null)), text: name };
|
|
4382
|
+
const count = el.type === "seatBlock" ? plural2(_chunkUWCMN6Q7cjs.expandSeatBlock.call(void 0, el).length, m.countSeat, m.countSeats) : el.mode === "whole" ? plural2(1, m.countTable, m.countTables) : plural2(el.places, m.countPlace, m.countPlaces);
|
|
4383
|
+
return { color: _nullishCoalesce(_optionalChain([option, 'optionalAccess', _157 => _157.color]), () => ( null)), text: `${name} \xB7 ${count}` };
|
|
4231
4384
|
}
|
|
4232
4385
|
function PieceInspector(props) {
|
|
4233
4386
|
const { element: el, messages: m } = props;
|
|
@@ -4245,8 +4398,8 @@ function PieceInspector(props) {
|
|
|
4245
4398
|
setLabelError(null);
|
|
4246
4399
|
patch("label", label, `label:${el.id}`);
|
|
4247
4400
|
};
|
|
4248
|
-
const assigned = el.type !== "landmark" && !!_optionalChain([el, 'access',
|
|
4249
|
-
const options = el.type === "landmark" ? [] : props.placeTypes.filter((o) =>
|
|
4401
|
+
const assigned = el.type !== "landmark" && !!_optionalChain([el, 'access', _158 => _158.placeType, 'optionalAccess', _159 => _159.ref]);
|
|
4402
|
+
const options = el.type === "landmark" ? [] : props.placeTypes.filter((o) => _chunkUWCMN6Q7cjs.canAssign.call(void 0, el, o));
|
|
4250
4403
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "vk-d-inspector", children: [
|
|
4251
4404
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "vk-d-insp-head", children: [
|
|
4252
4405
|
el.type !== "landmark" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "vk-d-dot", "aria-hidden": "true", style: { ["--vk-type"]: _nullishCoalesce(heading.color, () => ( "var(--vk-unassigned, #9ca3af)")) } }),
|
|
@@ -4300,7 +4453,7 @@ function PieceInspector(props) {
|
|
|
4300
4453
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, SizeStepper, { piece: el, messages: m, onRun: props.onRun })
|
|
4301
4454
|
] }),
|
|
4302
4455
|
el.type === "table" && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
4303
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, TextField, { label: m.tableNumber, maxLength:
|
|
4456
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, TextField, { label: m.tableNumber, maxLength: _chunkUWCMN6Q7cjs.MAX_TABLE_LABEL_LENGTH, value: el.label, onCommit: tableLabelCommit }),
|
|
4304
4457
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4305
4458
|
Stepper,
|
|
4306
4459
|
{
|
|
@@ -4365,7 +4518,7 @@ function PieceInspector(props) {
|
|
|
4365
4518
|
] }),
|
|
4366
4519
|
el.type === "landmark" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, TextField, { label: m.landmarkName, wide: true, maxLength: 60, value: el.name, onCommit: (v) => v.trim() && patch("name", v.trim(), `name:${el.id}`) })
|
|
4367
4520
|
] }, el.id),
|
|
4368
|
-
_optionalChain([labelError, 'optionalAccess',
|
|
4521
|
+
_optionalChain([labelError, 'optionalAccess', _160 => _160.id]) === el.id && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "vk-d-error", role: "alert", children: labelError.text }),
|
|
4369
4522
|
el.type === "seatBlock" && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "vk-d-insp-foot", children: [
|
|
4370
4523
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { "data-testid": "block-range", children: blockRangeText(el, { many: m.blockRange, one: m.blockRangeOneRow }) }),
|
|
4371
4524
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "button", { type: "button", className: "vk-d-link", "aria-haspopup": "dialog", onClick: props.onNumbering, children: m.numbering })
|
|
@@ -4432,12 +4585,12 @@ function NumberingDialog(props) {
|
|
|
4432
4585
|
const m = props.messages;
|
|
4433
4586
|
const [draft, setDraft] = _react.useState.call(void 0, props.block);
|
|
4434
4587
|
const [failed, setFailed] = _react.useState.call(void 0, false);
|
|
4435
|
-
const rowLabels =
|
|
4436
|
-
const seatLabels =
|
|
4588
|
+
const rowLabels = _chunkUWCMN6Q7cjs.expandLabels.call(void 0, draft.rowLabels, draft.rows);
|
|
4589
|
+
const seatLabels = _chunkUWCMN6Q7cjs.expandLabels.call(void 0, draft.seatLabels, draft.cols);
|
|
4437
4590
|
const removed = new Set(draft.removed);
|
|
4438
|
-
const origRows =
|
|
4439
|
-
const origSeats =
|
|
4440
|
-
const soldAt = (r, c) => r < origRows.length && c < origSeats.length && props.lockedUnitIds.has(
|
|
4591
|
+
const origRows = _chunkUWCMN6Q7cjs.expandLabels.call(void 0, props.block.rowLabels, props.block.rows);
|
|
4592
|
+
const origSeats = _chunkUWCMN6Q7cjs.expandLabels.call(void 0, props.block.seatLabels, props.block.cols);
|
|
4593
|
+
const soldAt = (r, c) => r < origRows.length && c < origSeats.length && props.lockedUnitIds.has(_chunkUWCMN6Q7cjs.seatUnitId.call(void 0, props.block.id, origRows[r], origSeats[c]));
|
|
4441
4594
|
const tooBig = draft.rows * draft.cols > MAX_PREVIEW_SEATS;
|
|
4442
4595
|
const pattern = draft.seatLabels.kind === "numbers" ? _nullishCoalesce(draft.seatLabels.pattern, () => ( "sequential")) : "sequential";
|
|
4443
4596
|
const patternId = _react.useId.call(void 0, );
|
|
@@ -4459,7 +4612,7 @@ function NumberingDialog(props) {
|
|
|
4459
4612
|
tooBig ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "vk-d-hint", children: m.numberingTooBig }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "vk-d-num-grid", role: "group", "aria-label": m.numbering, children: rowLabels.map((row, r) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "vk-d-num-row", children: [
|
|
4460
4613
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "vk-d-num-label", "aria-hidden": "true", children: row }),
|
|
4461
4614
|
seatLabels.map((seat, c) => {
|
|
4462
|
-
const id =
|
|
4615
|
+
const id = _chunkUWCMN6Q7cjs.seatUnitId.call(void 0, draft.id, row, seat);
|
|
4463
4616
|
const sold = soldAt(r, c) && !removed.has(id);
|
|
4464
4617
|
const out = removed.has(id);
|
|
4465
4618
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -4474,7 +4627,7 @@ function NumberingDialog(props) {
|
|
|
4474
4627
|
"aria-label": format(sold ? m.seatNameSold : out ? m.seatNameRemoved : m.seatName, { row, seat }),
|
|
4475
4628
|
onClick: () => {
|
|
4476
4629
|
setFailed(false);
|
|
4477
|
-
setDraft((d) =>
|
|
4630
|
+
setDraft((d) => _chunkUWCMN6Q7cjs.toggleRemovedSeat.call(void 0, d, id));
|
|
4478
4631
|
},
|
|
4479
4632
|
children: seat
|
|
4480
4633
|
},
|
|
@@ -4613,7 +4766,7 @@ function listOf(items, m) {
|
|
|
4613
4766
|
function duplicateWarnings(placeTypes, summary, m) {
|
|
4614
4767
|
const out = [];
|
|
4615
4768
|
for (const o of placeTypes) {
|
|
4616
|
-
const d = _optionalChain([summary, 'access',
|
|
4769
|
+
const d = _optionalChain([summary, 'access', _161 => _161.byRef, 'access', _162 => _162[o.ref], 'optionalAccess', _163 => _163.duplicates]);
|
|
4617
4770
|
if (!d) continue;
|
|
4618
4771
|
if (d.seats.length > 0) {
|
|
4619
4772
|
const items = d.seats.map((s) => {
|
|
@@ -4665,10 +4818,10 @@ function PlaceTypePanel(props) {
|
|
|
4665
4818
|
const capped = capacityText(o, summary, m);
|
|
4666
4819
|
const fullText = capacityFullText(o, summary, m);
|
|
4667
4820
|
const done = fullText !== null;
|
|
4668
|
-
const cap =
|
|
4821
|
+
const cap = _chunkUWCMN6Q7cjs.placeTypeCapacity.call(void 0, o);
|
|
4669
4822
|
const over = cap !== null && placedUnits(o, summary) > cap;
|
|
4670
4823
|
const excess = over ? overCapacity(o, summary) : 0;
|
|
4671
|
-
const trimmable = excess > 0 && props.onTrim ? _nullishCoalesce(_optionalChain([trimPlan, 'call',
|
|
4824
|
+
const trimmable = excess > 0 && props.onTrim ? _nullishCoalesce(_optionalChain([trimPlan, 'call', _164 => _164(props.layout, o, _nullishCoalesce(props.lockedUnitIds, () => ( NOTHING))), 'optionalAccess', _165 => _165.removed]), () => ( 0)) : 0;
|
|
4672
4825
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
4673
4826
|
"li",
|
|
4674
4827
|
{
|
|
@@ -4698,7 +4851,7 @@ function PlaceTypePanel(props) {
|
|
|
4698
4851
|
className: "vk-d-btn vk-d-trim",
|
|
4699
4852
|
"data-testid": "capacity-trim",
|
|
4700
4853
|
"aria-label": format(m.trimToCapacityLabel, { over: trimmable, name: o.label }),
|
|
4701
|
-
onClick: () => _optionalChain([props, 'access',
|
|
4854
|
+
onClick: () => _optionalChain([props, 'access', _166 => _166.onTrim, 'optionalCall', _167 => _167(o)]),
|
|
4702
4855
|
children: m.trimToCapacity
|
|
4703
4856
|
}
|
|
4704
4857
|
),
|
|
@@ -4756,18 +4909,18 @@ function Popover({ title, onClose, anchorRef, children, className }) {
|
|
|
4756
4909
|
const close = _react.useRef.call(void 0, onClose);
|
|
4757
4910
|
close.current = onClose;
|
|
4758
4911
|
_react.useEffect.call(void 0, () => {
|
|
4759
|
-
const first = _optionalChain([ref, 'access',
|
|
4760
|
-
_optionalChain([(_nullishCoalesce(first, () => ( ref.current))), 'optionalAccess',
|
|
4912
|
+
const first = _optionalChain([ref, 'access', _168 => _168.current, 'optionalAccess', _169 => _169.querySelector, 'call', _170 => _170("input, button, select, [href]")]);
|
|
4913
|
+
_optionalChain([(_nullishCoalesce(first, () => ( ref.current))), 'optionalAccess', _171 => _171.focus, 'call', _172 => _172()]);
|
|
4761
4914
|
const onDown = (e) => {
|
|
4762
4915
|
const t = e.target;
|
|
4763
|
-
if (_optionalChain([ref, 'access',
|
|
4916
|
+
if (_optionalChain([ref, 'access', _173 => _173.current, 'optionalAccess', _174 => _174.contains, 'call', _175 => _175(t)]) || _optionalChain([anchorRef, 'access', _176 => _176.current, 'optionalAccess', _177 => _177.contains, 'call', _178 => _178(t)])) return;
|
|
4764
4917
|
close.current();
|
|
4765
4918
|
};
|
|
4766
4919
|
document.addEventListener("pointerdown", onDown);
|
|
4767
4920
|
const anchor = anchorRef.current;
|
|
4768
4921
|
return () => {
|
|
4769
4922
|
document.removeEventListener("pointerdown", onDown);
|
|
4770
|
-
if (_optionalChain([anchor, 'optionalAccess',
|
|
4923
|
+
if (_optionalChain([anchor, 'optionalAccess', _179 => _179.isConnected]) && (!document.activeElement || document.activeElement === document.body)) anchor.focus();
|
|
4771
4924
|
};
|
|
4772
4925
|
}, [anchorRef]);
|
|
4773
4926
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
@@ -4781,7 +4934,7 @@ function Popover({ title, onClose, anchorRef, children, className }) {
|
|
|
4781
4934
|
onKeyDown: (e) => {
|
|
4782
4935
|
if (e.key === "Escape") {
|
|
4783
4936
|
e.stopPropagation();
|
|
4784
|
-
_optionalChain([anchorRef, 'access',
|
|
4937
|
+
_optionalChain([anchorRef, 'access', _180 => _180.current, 'optionalAccess', _181 => _181.focus, 'call', _182 => _182()]);
|
|
4785
4938
|
close.current();
|
|
4786
4939
|
}
|
|
4787
4940
|
},
|
|
@@ -4862,9 +5015,9 @@ function Sheet({
|
|
|
4862
5015
|
if (!shown) return;
|
|
4863
5016
|
const active = document.activeElement instanceof HTMLElement && document.activeElement !== document.body ? document.activeElement : null;
|
|
4864
5017
|
const opener = _nullishCoalesce(returnTo.current, () => ( active));
|
|
4865
|
-
_optionalChain([panelRef, 'access',
|
|
5018
|
+
_optionalChain([panelRef, 'access', _183 => _183.current, 'optionalAccess', _184 => _184.focus, 'call', _185 => _185()]);
|
|
4866
5019
|
return () => {
|
|
4867
|
-
if (_optionalChain([opener, 'optionalAccess',
|
|
5020
|
+
if (_optionalChain([opener, 'optionalAccess', _186 => _186.isConnected])) opener.focus();
|
|
4868
5021
|
};
|
|
4869
5022
|
}, [shown]);
|
|
4870
5023
|
const onKeyDown = (e) => {
|
|
@@ -5245,12 +5398,12 @@ function TopBar(props) {
|
|
|
5245
5398
|
function guardedStep(history, step, locked) {
|
|
5246
5399
|
const candidate = step === "undo" ? history.peekUndo() : history.peekRedo();
|
|
5247
5400
|
if (!candidate) return null;
|
|
5248
|
-
const violations =
|
|
5401
|
+
const violations = _chunkUWCMN6Q7cjs.findLockViolations.call(void 0, history.present, candidate, locked);
|
|
5249
5402
|
if (violations.length > 0) return { ok: false, rejection: { violations } };
|
|
5250
5403
|
return { ok: true, layout: step === "undo" ? history.undo() : history.redo() };
|
|
5251
5404
|
}
|
|
5252
5405
|
function guardedLoad(history, next, locked, placeTypes = []) {
|
|
5253
|
-
const violations =
|
|
5406
|
+
const violations = _chunkUWCMN6Q7cjs.findLockViolations.call(void 0, history.present, next, locked);
|
|
5254
5407
|
if (violations.length > 0) return { ok: false, rejection: { violations } };
|
|
5255
5408
|
const capacity = capacityRejections(history.present, next, placeTypes);
|
|
5256
5409
|
if (capacity.length > 0) return { ok: false, rejection: { violations: [], capacity } };
|
|
@@ -5273,7 +5426,8 @@ function elementPrefix(el) {
|
|
|
5273
5426
|
return el.type === "seatBlock" ? "b" : el.type === "table" ? "m" : el.type === "zone" ? "z" : "r";
|
|
5274
5427
|
}
|
|
5275
5428
|
function useDesigner({ initial, lockedUnitIds, onChange, placeTypes }) {
|
|
5276
|
-
const
|
|
5429
|
+
const [history] = _react.useState.call(void 0, () => new (0, _chunkUWCMN6Q7cjs.History)(initial));
|
|
5430
|
+
const historyRef = _react.useRef.call(void 0, history);
|
|
5277
5431
|
const [layout, setLayout] = _react.useState.call(void 0, initial);
|
|
5278
5432
|
const [rejection, setRejectionState] = _react.useState.call(void 0, null);
|
|
5279
5433
|
const [rejectionSeq, setRejectionSeq] = _react.useState.call(void 0, 0);
|
|
@@ -5289,7 +5443,7 @@ function useDesigner({ initial, lockedUnitIds, onChange, placeTypes }) {
|
|
|
5289
5443
|
(next) => {
|
|
5290
5444
|
setLayout(next);
|
|
5291
5445
|
setRejection(null);
|
|
5292
|
-
_optionalChain([onChange, 'optionalCall',
|
|
5446
|
+
_optionalChain([onChange, 'optionalCall', _187 => _187(next)]);
|
|
5293
5447
|
},
|
|
5294
5448
|
[onChange, setRejection]
|
|
5295
5449
|
);
|
|
@@ -5300,31 +5454,33 @@ function useDesigner({ initial, lockedUnitIds, onChange, placeTypes }) {
|
|
|
5300
5454
|
const previous = seenTypes.current.list;
|
|
5301
5455
|
const next = placeTypesRef.current;
|
|
5302
5456
|
seenTypes.current = { key: typesKey, list: next };
|
|
5303
|
-
const
|
|
5304
|
-
const before =
|
|
5305
|
-
|
|
5306
|
-
if (
|
|
5457
|
+
const history2 = historyRef.current;
|
|
5458
|
+
const before = history2.present;
|
|
5459
|
+
history2.rewrite((l) => syncPlaceTypes(l, previous, next));
|
|
5460
|
+
if (history2.present !== before) commit(history2.present);
|
|
5307
5461
|
}, [typesKey, commit]);
|
|
5308
5462
|
const run = _react.useCallback.call(void 0,
|
|
5309
5463
|
(command, key) => {
|
|
5310
5464
|
const before = historyRef.current.present;
|
|
5311
5465
|
let candidate;
|
|
5312
5466
|
try {
|
|
5313
|
-
candidate =
|
|
5314
|
-
} catch (
|
|
5467
|
+
candidate = _chunkUWCMN6Q7cjs.applyCommand.call(void 0, before, command);
|
|
5468
|
+
} catch (error) {
|
|
5469
|
+
setRejection({ violations: [], invalid: error instanceof Error ? error.message : String(error) });
|
|
5315
5470
|
return false;
|
|
5316
5471
|
}
|
|
5317
|
-
const
|
|
5472
|
+
const moveOnly = keepsCount(command);
|
|
5473
|
+
const violations = moveOnly ? [] : _chunkUWCMN6Q7cjs.findLockViolations.call(void 0, before, candidate, locked);
|
|
5318
5474
|
if (violations.length > 0) {
|
|
5319
5475
|
setRejection({ violations });
|
|
5320
5476
|
return false;
|
|
5321
5477
|
}
|
|
5322
|
-
const capacity =
|
|
5478
|
+
const capacity = moveOnly ? [] : capacityRejections(before, candidate, placeTypesRef.current);
|
|
5323
5479
|
if (capacity.length > 0) {
|
|
5324
5480
|
setRejection({ violations: [], capacity });
|
|
5325
5481
|
return false;
|
|
5326
5482
|
}
|
|
5327
|
-
commit(historyRef.current.
|
|
5483
|
+
commit(historyRef.current.commit(candidate, key));
|
|
5328
5484
|
return true;
|
|
5329
5485
|
},
|
|
5330
5486
|
[locked, commit, setRejection]
|
|
@@ -5333,8 +5489,8 @@ function useDesigner({ initial, lockedUnitIds, onChange, placeTypes }) {
|
|
|
5333
5489
|
const place = _react.useCallback.call(void 0,
|
|
5334
5490
|
(kind, at) => {
|
|
5335
5491
|
const current = historyRef.current.present;
|
|
5336
|
-
const id =
|
|
5337
|
-
if (!run({ type: "addElement", element:
|
|
5492
|
+
const id = _chunkUWCMN6Q7cjs.newElementId.call(void 0, current, idPrefix(kind));
|
|
5493
|
+
if (!run({ type: "addElement", element: _chunkUWCMN6Q7cjs.createPiece.call(void 0, kind, id, at, current) })) return null;
|
|
5338
5494
|
dispatchUi({ type: "select", id });
|
|
5339
5495
|
return id;
|
|
5340
5496
|
},
|
|
@@ -5343,10 +5499,10 @@ function useDesigner({ initial, lockedUnitIds, onChange, placeTypes }) {
|
|
|
5343
5499
|
const addFor = _react.useCallback.call(void 0,
|
|
5344
5500
|
(kind, option, near, opts = {}) => {
|
|
5345
5501
|
const current = historyRef.current.present;
|
|
5346
|
-
const id =
|
|
5347
|
-
let piece =
|
|
5502
|
+
const id = _chunkUWCMN6Q7cjs.newElementId.call(void 0, current, idPrefix(kind));
|
|
5503
|
+
let piece = _chunkUWCMN6Q7cjs.createPiece.call(void 0, kind, id, near, current, opts.seats === void 0 ? {} : { seats: opts.seats });
|
|
5348
5504
|
if (piece.type === "table" && opts.places !== void 0) piece = { ...piece, places: opts.places };
|
|
5349
|
-
if (option && piece.type !== "landmark" &&
|
|
5505
|
+
if (option && piece.type !== "landmark" && _chunkUWCMN6Q7cjs.canAssign.call(void 0, piece, option)) piece = _chunkUWCMN6Q7cjs.assignPlaceType.call(void 0, piece, option);
|
|
5350
5506
|
const own = elementBounds({ ...current, elements: [...current.elements, piece] }, piece);
|
|
5351
5507
|
if (own) {
|
|
5352
5508
|
const occupied = current.elements.flatMap((e) => _nullishCoalesce(elementBounds(current, e), () => ( [])));
|
|
@@ -5364,8 +5520,8 @@ function useDesigner({ initial, lockedUnitIds, onChange, placeTypes }) {
|
|
|
5364
5520
|
const el = find(id);
|
|
5365
5521
|
if (!el) return;
|
|
5366
5522
|
const current = historyRef.current.present;
|
|
5367
|
-
const newId =
|
|
5368
|
-
if (run({ type: "addElement", element:
|
|
5523
|
+
const newId = _chunkUWCMN6Q7cjs.newElementId.call(void 0, current, elementPrefix(el));
|
|
5524
|
+
if (run({ type: "addElement", element: _chunkUWCMN6Q7cjs.duplicatePiece.call(void 0, el, newId, current) })) {
|
|
5369
5525
|
dispatchUi({ type: "select", id: newId });
|
|
5370
5526
|
}
|
|
5371
5527
|
},
|
|
@@ -5374,7 +5530,7 @@ function useDesigner({ initial, lockedUnitIds, onChange, placeTypes }) {
|
|
|
5374
5530
|
const rotate = _react.useCallback.call(void 0,
|
|
5375
5531
|
(id) => {
|
|
5376
5532
|
const el = find(id);
|
|
5377
|
-
if (el) run({ type: "replaceElement", element:
|
|
5533
|
+
if (el) run({ type: "replaceElement", element: _chunkUWCMN6Q7cjs.rotatePiece.call(void 0, el) });
|
|
5378
5534
|
},
|
|
5379
5535
|
[run]
|
|
5380
5536
|
);
|
|
@@ -5409,7 +5565,7 @@ function useDesigner({ initial, lockedUnitIds, onChange, placeTypes }) {
|
|
|
5409
5565
|
for (const id of ids) {
|
|
5410
5566
|
const el = current.elements.find((e) => e.id === id);
|
|
5411
5567
|
if (!el) continue;
|
|
5412
|
-
const copy =
|
|
5568
|
+
const copy = _chunkUWCMN6Q7cjs.duplicatePiece.call(void 0, el, _chunkUWCMN6Q7cjs.newElementId.call(void 0, current, elementPrefix(el)), current);
|
|
5413
5569
|
current = { ...current, elements: [...current.elements, copy] };
|
|
5414
5570
|
commands.push({ type: "addElement", element: copy });
|
|
5415
5571
|
created.push(copy.id);
|
|
@@ -5435,7 +5591,7 @@ function useDesigner({ initial, lockedUnitIds, onChange, placeTypes }) {
|
|
|
5435
5591
|
const toggleSeat = _react.useCallback.call(void 0,
|
|
5436
5592
|
(blockId, unitId) => {
|
|
5437
5593
|
const el = find(blockId);
|
|
5438
|
-
if (_optionalChain([el, 'optionalAccess',
|
|
5594
|
+
if (_optionalChain([el, 'optionalAccess', _188 => _188.type]) === "seatBlock") run({ type: "replaceElement", element: _chunkUWCMN6Q7cjs.toggleRemovedSeat.call(void 0, el, unitId) });
|
|
5439
5595
|
},
|
|
5440
5596
|
[run]
|
|
5441
5597
|
);
|
|
@@ -5443,8 +5599,8 @@ function useDesigner({ initial, lockedUnitIds, onChange, placeTypes }) {
|
|
|
5443
5599
|
(id, option) => {
|
|
5444
5600
|
const el = find(id);
|
|
5445
5601
|
if (!el || el.type === "landmark") return;
|
|
5446
|
-
if (option && !
|
|
5447
|
-
run({ type: "replaceElement", element:
|
|
5602
|
+
if (option && !_chunkUWCMN6Q7cjs.canAssign.call(void 0, el, option)) return;
|
|
5603
|
+
run({ type: "replaceElement", element: _chunkUWCMN6Q7cjs.assignPlaceType.call(void 0, el, option) });
|
|
5448
5604
|
},
|
|
5449
5605
|
[run]
|
|
5450
5606
|
);
|
|
@@ -5510,7 +5666,7 @@ function useDesigner({ initial, lockedUnitIds, onChange, placeTypes }) {
|
|
|
5510
5666
|
var NOTHING_LOCKED = /* @__PURE__ */ new Set();
|
|
5511
5667
|
function blankLayout(name) {
|
|
5512
5668
|
return {
|
|
5513
|
-
meta: { id: "plan", name, version:
|
|
5669
|
+
meta: { id: "plan", name, version: _chunkUWCMN6Q7cjs.CURRENT_VERSION, width: 1200, height: 800, background: null },
|
|
5514
5670
|
elements: []
|
|
5515
5671
|
};
|
|
5516
5672
|
}
|
|
@@ -5534,13 +5690,13 @@ function VenueDesigner(props) {
|
|
|
5534
5690
|
const loadingExternal = _react.useRef.call(void 0, false);
|
|
5535
5691
|
const onChange = _react.useCallback.call(void 0, (layout2) => {
|
|
5536
5692
|
lastEmitted.current = layout2;
|
|
5537
|
-
if (!loadingExternal.current) _optionalChain([onChangeRef, 'access',
|
|
5693
|
+
if (!loadingExternal.current) _optionalChain([onChangeRef, 'access', _189 => _189.current, 'optionalCall', _190 => _190(layout2)]);
|
|
5538
5694
|
}, []);
|
|
5539
5695
|
const designer = useDesigner({ initial, lockedUnitIds: locked, onChange, placeTypes: props.placeTypes });
|
|
5540
5696
|
const { layout, ui, dispatchUi } = designer;
|
|
5541
5697
|
const messages = _react.useMemo.call(void 0, () => mergeDesignerMessages(props.messages), [props.messages]);
|
|
5542
5698
|
const m = messages;
|
|
5543
|
-
const summary = _react.useMemo.call(void 0, () =>
|
|
5699
|
+
const summary = _react.useMemo.call(void 0, () => _chunkUWCMN6Q7cjs.summarize.call(void 0, layout), [layout]);
|
|
5544
5700
|
const selected = ui.selectedId ? _nullishCoalesce(layout.elements.find((e) => e.id === ui.selectedId), () => ( null)) : null;
|
|
5545
5701
|
const canvasRef = _react.useRef.call(void 0, null);
|
|
5546
5702
|
const otherTableLabels = _react.useMemo.call(void 0,
|
|
@@ -5576,7 +5732,7 @@ function VenueDesigner(props) {
|
|
|
5576
5732
|
setSaveFailed(false);
|
|
5577
5733
|
try {
|
|
5578
5734
|
await finish(layout);
|
|
5579
|
-
} catch (
|
|
5735
|
+
} catch (e6) {
|
|
5580
5736
|
setSaveFailed(true);
|
|
5581
5737
|
} finally {
|
|
5582
5738
|
setSaving(false);
|
|
@@ -5609,7 +5765,7 @@ function VenueDesigner(props) {
|
|
|
5609
5765
|
if (compact && popover !== null) setPopover(null);
|
|
5610
5766
|
}, [sheet, selected, compact, popover]);
|
|
5611
5767
|
const bg = layout.meta.background;
|
|
5612
|
-
const current = useImage(_nullishCoalesce(_optionalChain([bg, 'optionalAccess',
|
|
5768
|
+
const current = useImage(_nullishCoalesce(_optionalChain([bg, 'optionalAccess', _191 => _191.src]), () => ( null)));
|
|
5613
5769
|
const [incomingSrc, setIncomingSrc] = _react.useState.call(void 0, null);
|
|
5614
5770
|
const incoming = useImage(incomingSrc);
|
|
5615
5771
|
const { run } = designer;
|
|
@@ -5631,7 +5787,7 @@ function VenueDesigner(props) {
|
|
|
5631
5787
|
};
|
|
5632
5788
|
const adoptBackground = (src) => {
|
|
5633
5789
|
if (!src) return;
|
|
5634
|
-
if (src === _optionalChain([bg, 'optionalAccess',
|
|
5790
|
+
if (src === _optionalChain([bg, 'optionalAccess', _192 => _192.src]) && incomingSrc === null) return;
|
|
5635
5791
|
setIncomingSrc(src);
|
|
5636
5792
|
};
|
|
5637
5793
|
const bgProp = props.background;
|
|
@@ -5641,13 +5797,13 @@ function VenueDesigner(props) {
|
|
|
5641
5797
|
setPicking(true);
|
|
5642
5798
|
try {
|
|
5643
5799
|
src = await bgProp.onPick();
|
|
5644
|
-
} catch (
|
|
5800
|
+
} catch (e7) {
|
|
5645
5801
|
} finally {
|
|
5646
5802
|
setPicking(false);
|
|
5647
5803
|
}
|
|
5648
5804
|
adoptBackground(src);
|
|
5649
5805
|
} : null;
|
|
5650
|
-
const suggestedSrc = _optionalChain([bgProp, 'optionalAccess',
|
|
5806
|
+
const suggestedSrc = _optionalChain([bgProp, 'optionalAccess', _193 => _193.suggestedSrc]) || null;
|
|
5651
5807
|
const bgStatus = incomingSrc ? incoming.failed ? "failed" : "loading" : current.failed ? "failed" : "idle";
|
|
5652
5808
|
const showBackground = bgProp !== void 0 || bg !== null;
|
|
5653
5809
|
const latest = _react.useRef.call(void 0, { summary, placeTypes: props.placeTypes, compact, meta: layout.meta });
|
|
@@ -5658,9 +5814,9 @@ function VenueDesigner(props) {
|
|
|
5658
5814
|
const { summary: summary2, placeTypes, compact: compact2, meta } = latest.current;
|
|
5659
5815
|
const request = pieceRequest(kind, ref, placeTypes, summary2);
|
|
5660
5816
|
if (!request) return null;
|
|
5661
|
-
const centre = _nullishCoalesce(_optionalChain([canvasRef, 'access',
|
|
5817
|
+
const centre = _nullishCoalesce(_optionalChain([canvasRef, 'access', _194 => _194.current, 'optionalAccess', _195 => _195.centre, 'call', _196 => _196()]), () => ( { x: meta.width / 2, y: meta.height / 2 }));
|
|
5662
5818
|
const id = designerAddFor(kind, request.option, centre, request.opts);
|
|
5663
|
-
if (id) _optionalChain([canvasRef, 'access',
|
|
5819
|
+
if (id) _optionalChain([canvasRef, 'access', _197 => _197.current, 'optionalAccess', _198 => _198.reveal, 'call', _199 => _199(id)]);
|
|
5664
5820
|
if (id && compact2) setSheet("piece");
|
|
5665
5821
|
return id;
|
|
5666
5822
|
},
|
|
@@ -5670,12 +5826,12 @@ function VenueDesigner(props) {
|
|
|
5670
5826
|
(id) => {
|
|
5671
5827
|
dispatchUi({ type: "select", id });
|
|
5672
5828
|
if (!id) return;
|
|
5673
|
-
_optionalChain([canvasRef, 'access',
|
|
5829
|
+
_optionalChain([canvasRef, 'access', _200 => _200.current, 'optionalAccess', _201 => _201.reveal, 'call', _202 => _202(id)]);
|
|
5674
5830
|
if (latest.current.compact) setSheet("piece");
|
|
5675
5831
|
},
|
|
5676
5832
|
[dispatchUi]
|
|
5677
5833
|
);
|
|
5678
|
-
const revealPiece = _react.useCallback.call(void 0, (id) => _optionalChain([canvasRef, 'access',
|
|
5834
|
+
const revealPiece = _react.useCallback.call(void 0, (id) => _optionalChain([canvasRef, 'access', _203 => _203.current, 'optionalAccess', _204 => _204.reveal, 'call', _205 => _205(id)]), []);
|
|
5679
5835
|
const trimToCapacity = _react.useCallback.call(void 0,
|
|
5680
5836
|
(ref) => {
|
|
5681
5837
|
const option = latest.current.placeTypes.find((o) => o.ref === ref);
|
|
@@ -5691,7 +5847,7 @@ function VenueDesigner(props) {
|
|
|
5691
5847
|
() => hostReads(latest.current.placeTypes, facts.summary, facts.pieces, m),
|
|
5692
5848
|
[typesKey, facts, m]
|
|
5693
5849
|
);
|
|
5694
|
-
const selectedRef = selected && selected.type !== "landmark" ? _optionalChain([selected, 'access',
|
|
5850
|
+
const selectedRef = selected && selected.type !== "landmark" ? _optionalChain([selected, 'access', _206 => _206.placeType, 'optionalAccess', _207 => _207.ref]) || null : null;
|
|
5695
5851
|
const hostApi = _react.useMemo.call(void 0,
|
|
5696
5852
|
() => ({ ...reads, addPiece, trimToCapacity, select: selectPiece, reveal: revealPiece, selectedRef }),
|
|
5697
5853
|
[reads, addPiece, trimToCapacity, selectPiece, revealPiece, selectedRef]
|
|
@@ -5756,7 +5912,7 @@ function VenueDesigner(props) {
|
|
|
5756
5912
|
editing: ui.backgroundEditing,
|
|
5757
5913
|
compact,
|
|
5758
5914
|
onPick: pickBackground ? () => void pickBackground() : null,
|
|
5759
|
-
onUseSuggested: suggestedSrc && suggestedSrc !== _optionalChain([bg, 'optionalAccess',
|
|
5915
|
+
onUseSuggested: suggestedSrc && suggestedSrc !== _optionalChain([bg, 'optionalAccess', _208 => _208.src]) ? () => adoptBackground(suggestedSrc) : null,
|
|
5760
5916
|
onSet: setBackground,
|
|
5761
5917
|
onEditing: (on) => {
|
|
5762
5918
|
dispatchUi({ type: "backgroundEdit", on });
|
|
@@ -5820,8 +5976,8 @@ function VenueDesigner(props) {
|
|
|
5820
5976
|
const panel = _nullishCoalesce(inspector, () => ( multiPanel));
|
|
5821
5977
|
const numberingTitleId = _react.useId.call(void 0, );
|
|
5822
5978
|
const numberingBlock = numberingId ? layout.elements.find((e) => e.id === numberingId) : void 0;
|
|
5823
|
-
const numberingTarget = _optionalChain([numberingBlock, 'optionalAccess',
|
|
5824
|
-
const numberingRef = _optionalChain([numberingTarget, 'optionalAccess',
|
|
5979
|
+
const numberingTarget = _optionalChain([numberingBlock, 'optionalAccess', _209 => _209.type]) === "seatBlock" ? numberingBlock : null;
|
|
5980
|
+
const numberingRef = _optionalChain([numberingTarget, 'optionalAccess', _210 => _210.placeType, 'optionalAccess', _211 => _211.ref]) || null;
|
|
5825
5981
|
const numberingType = numberingRef ? props.placeTypes.find((p) => p.ref === numberingRef) : void 0;
|
|
5826
5982
|
const closeNumbering = _react.useCallback.call(void 0, () => setNumberingId(null), []);
|
|
5827
5983
|
const canvas = /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -5923,8 +6079,8 @@ function VenueDesigner(props) {
|
|
|
5923
6079
|
NumberingDialog,
|
|
5924
6080
|
{
|
|
5925
6081
|
block: numberingTarget,
|
|
5926
|
-
typeName: _nullishCoalesce(_optionalChain([numberingType, 'optionalAccess',
|
|
5927
|
-
color: _nullishCoalesce(_optionalChain([numberingType, 'optionalAccess',
|
|
6082
|
+
typeName: _nullishCoalesce(_optionalChain([numberingType, 'optionalAccess', _212 => _212.label]), () => ( m.unassigned)),
|
|
6083
|
+
color: _nullishCoalesce(_optionalChain([numberingType, 'optionalAccess', _213 => _213.color]), () => ( null)),
|
|
5928
6084
|
lockedUnitIds: locked,
|
|
5929
6085
|
messages: m,
|
|
5930
6086
|
titleId: numberingTitleId,
|
|
@@ -5946,7 +6102,7 @@ function VenueDesigner(props) {
|
|
|
5946
6102
|
}
|
|
5947
6103
|
|
|
5948
6104
|
// ../react/src/index.ts
|
|
5949
|
-
var VERSION = "0.10.
|
|
6105
|
+
var VERSION = "0.10.3";
|
|
5950
6106
|
|
|
5951
6107
|
|
|
5952
6108
|
|