venuekit 0.10.1 → 0.10.2
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-QQQM6AFF.js} +53 -23
- package/dist/{chunk-LFRA3GBP.cjs → chunk-Z47OPTEP.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 +396 -244
- package/dist/react.d.cts +16 -4
- package/dist/react.d.ts +16 -4
- package/dist/react.js +212 -60
- package/package.json +1 -1
package/dist/react.cjs
CHANGED
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
|
|
46
46
|
|
|
47
47
|
|
|
48
|
-
var
|
|
48
|
+
var _chunkZ47OPTEPcjs = require('./chunk-Z47OPTEP.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: _chunkZ47OPTEPcjs.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 = _chunkZ47OPTEPcjs.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 && _chunkZ47OPTEPcjs.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 = _chunkZ47OPTEPcjs.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 _chunkZ47OPTEPcjs.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" ? _chunkZ47OPTEPcjs.expandSeatBlock.call(void 0, element) : _chunkZ47OPTEPcjs.expandTable.call(void 0, element);
|
|
287
|
+
const own = units.length > 0 ? _chunkZ47OPTEPcjs.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 ? {
|
|
@@ -294,7 +302,7 @@ function elementAt(layout, screen, camera, viewport) {
|
|
|
294
302
|
const element = layout.elements[i];
|
|
295
303
|
const box = elementBounds(layout, element);
|
|
296
304
|
if (box && world.x >= box.minX && world.x <= box.maxX && world.y >= box.minY && world.y <= box.maxY) {
|
|
297
|
-
if (element.type === "zone" && !
|
|
305
|
+
if (element.type === "zone" && !_chunkZ47OPTEPcjs.pointInZone.call(void 0, element, world)) continue;
|
|
298
306
|
return element;
|
|
299
307
|
}
|
|
300
308
|
}
|
|
@@ -328,7 +336,7 @@ function unitRadii(layout) {
|
|
|
328
336
|
out.set(el.id, DEFAULT_UNIT_RADIUS * k);
|
|
329
337
|
continue;
|
|
330
338
|
}
|
|
331
|
-
const size =
|
|
339
|
+
const size = _chunkZ47OPTEPcjs.tableSize.call(void 0, el.shape, el.places);
|
|
332
340
|
out.set(el.id, ("radius" in size ? size.radius : Math.max(size.width, size.height) / 2) * k);
|
|
333
341
|
}
|
|
334
342
|
}
|
|
@@ -428,10 +436,10 @@ function buildScene(input) {
|
|
|
428
436
|
strokeWidth: strong ? 2.5 : 1.5,
|
|
429
437
|
...dim(ref) ? { alpha: DIMMED_ALPHA } : {}
|
|
430
438
|
};
|
|
431
|
-
const outline =
|
|
439
|
+
const outline = _chunkZ47OPTEPcjs.zoneOutline.call(void 0, el, ZONE_CORNER);
|
|
432
440
|
if (outline.length > 0) shapes.push({ kind: "polygon", points: outline, ...paint2 });
|
|
433
441
|
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 =
|
|
442
|
+
const room = _chunkZ47OPTEPcjs.zoneLabelSize.call(void 0, el);
|
|
435
443
|
const swap = el.transform.rotation === 90 || el.transform.rotation === 270;
|
|
436
444
|
const roomW = (swap ? room.height : room.width) * camera.zoom;
|
|
437
445
|
const roomH = (swap ? room.width : room.height) * camera.zoom;
|
|
@@ -481,16 +489,12 @@ function buildScene(input) {
|
|
|
481
489
|
}
|
|
482
490
|
}
|
|
483
491
|
}
|
|
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;
|
|
492
|
+
const chipped = mode === "designer" ? layout.elements.filter((el) => el.type !== "landmark" && colorOf(refOf(el)) === null) : [];
|
|
493
|
+
const byElement = new Map(chipped.map((el) => [el.id, []]));
|
|
494
|
+
if (byElement.size > 0) for (const u of units) _optionalChain([byElement, 'access', _14 => _14.get, 'call', _15 => _15(u.elementId), 'optionalAccess', _16 => _16.push, 'call', _17 => _17(u)]);
|
|
495
|
+
for (const el of chipped) {
|
|
492
496
|
const own = byElement.get(el.id);
|
|
493
|
-
if (!own) continue;
|
|
497
|
+
if (!own || own.length === 0) continue;
|
|
494
498
|
let minX = Infinity, minY = Infinity, maxX = -Infinity, maxY = -Infinity;
|
|
495
499
|
for (const u of own) {
|
|
496
500
|
if (u.x < minX) minX = u.x;
|
|
@@ -530,7 +534,7 @@ function buildScene(input) {
|
|
|
530
534
|
if (!visible.has(u.id)) continue;
|
|
531
535
|
visibleUnitIds.push(u.id);
|
|
532
536
|
const color = _nullishCoalesce(colorOf(u.placeTypeRef), () => ( palette.unassigned));
|
|
533
|
-
const state = mode === "designer" && _optionalChain([input, 'access',
|
|
537
|
+
const state = mode === "designer" && _optionalChain([input, 'access', _18 => _18.locked, 'optionalAccess', _19 => _19.has, 'call', _20 => _20(u.id)]) ? "taken" : _nullishCoalesce(states.get(u.id), () => ( "free"));
|
|
534
538
|
const mapPaint = mode === "map" ? mapUnitPaint(state, color, palette) : null;
|
|
535
539
|
const paint2 = mapPaint ? { fill: mapPaint.fill, stroke: mapPaint.stroke, strokeWidth: mapPaint.strokeWidth } : unitPaint(state, color, palette);
|
|
536
540
|
const dimmed = dim(u.placeTypeRef);
|
|
@@ -542,7 +546,7 @@ function buildScene(input) {
|
|
|
542
546
|
const size = Math.min(13, Math.max(8, radius * camera.zoom * 0.9));
|
|
543
547
|
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
548
|
}
|
|
545
|
-
if (_optionalChain([el, 'optionalAccess',
|
|
549
|
+
if (_optionalChain([el, 'optionalAccess', _21 => _21.type]) === "table" && el.mode === "whole" && el.shape === "rect") {
|
|
546
550
|
const b = tableBodyBox(el);
|
|
547
551
|
shapes.push({ kind: "rect", x: b.minX, y: b.minY, width: b.maxX - b.minX, height: b.maxY - b.minY, ...paint2, ...alpha });
|
|
548
552
|
continue;
|
|
@@ -621,7 +625,7 @@ function paint(ctx, fill, stroke, strokeWidth, zoom) {
|
|
|
621
625
|
}
|
|
622
626
|
function drawBackground(ctx, scene, images) {
|
|
623
627
|
const bg = scene.background;
|
|
624
|
-
const bitmap = bg ? _optionalChain([images, 'optionalAccess',
|
|
628
|
+
const bitmap = bg ? _optionalChain([images, 'optionalAccess', _22 => _22.get, 'call', _23 => _23(bg.src)]) : void 0;
|
|
625
629
|
if (!bg || !bitmap) return;
|
|
626
630
|
const previous = ctx.globalAlpha;
|
|
627
631
|
ctx.globalAlpha = bg.opacity;
|
|
@@ -730,7 +734,7 @@ function hitUnit(input) {
|
|
|
730
734
|
const unit = unitById.get(id);
|
|
731
735
|
if (!unit) continue;
|
|
732
736
|
const radius = _nullishCoalesce(radii.get(unit.elementId), () => ( 0));
|
|
733
|
-
const d =
|
|
737
|
+
const d = _chunkZ47OPTEPcjs.distance.call(void 0, world, unit);
|
|
734
738
|
if (d > reach + radius) continue;
|
|
735
739
|
const score = d - radius;
|
|
736
740
|
if (score < bestScore) {
|
|
@@ -755,7 +759,7 @@ function cornerPoint(box, corner) {
|
|
|
755
759
|
var clamp = (v, min, max) => Math.min(max, Math.max(min, v));
|
|
756
760
|
function resizeElement(el, corner, from, to) {
|
|
757
761
|
if (el.type === "zone" || el.type === "landmark") {
|
|
758
|
-
const box2 = el.type === "zone" ?
|
|
762
|
+
const box2 = el.type === "zone" ? _chunkZ47OPTEPcjs.zoneBounds.call(void 0, el) : centredBox(el.transform, el.width, el.height, el.transform.rotation);
|
|
759
763
|
const east = corner === "ne" || corner === "se";
|
|
760
764
|
const south = corner === "se" || corner === "sw";
|
|
761
765
|
const start = cornerPoint(box2, corner);
|
|
@@ -766,11 +770,11 @@ function resizeElement(el, corner, from, to) {
|
|
|
766
770
|
const swap = el.transform.rotation === 90 || el.transform.rotation === 270;
|
|
767
771
|
const [w, h] = swap ? [worldH, worldW] : [worldW, worldH];
|
|
768
772
|
if (el.type === "zone" && (_nullishCoalesce(el.curve, () => ( 0))) > 0) {
|
|
769
|
-
const sized =
|
|
773
|
+
const sized = _chunkZ47OPTEPcjs.zoneWithLocalSize.call(void 0, el, w, h);
|
|
770
774
|
const width = Math.round(clamp(sized.width, RESIZE_MIN, RESIZE_MAX));
|
|
771
775
|
const height = Math.round(clamp(sized.height, RESIZE_MIN, RESIZE_MAX));
|
|
772
776
|
const next = { ...sized, width, height };
|
|
773
|
-
const b =
|
|
777
|
+
const b = _chunkZ47OPTEPcjs.zoneBounds.call(void 0, next);
|
|
774
778
|
const dx = east ? box2.minX - b.minX : box2.maxX - b.maxX;
|
|
775
779
|
const dy = south ? box2.minY - b.minY : box2.maxY - b.maxY;
|
|
776
780
|
return { ...next, transform: { ...el.transform, x: el.transform.x + dx, y: el.transform.y + dy } };
|
|
@@ -782,11 +786,11 @@ function resizeElement(el, corner, from, to) {
|
|
|
782
786
|
const box = pieceBounds(el);
|
|
783
787
|
if (!box) return el;
|
|
784
788
|
const centre = { x: (box.minX + box.maxX) / 2, y: (box.minY + box.maxY) / 2 };
|
|
785
|
-
const reach =
|
|
789
|
+
const reach = _chunkZ47OPTEPcjs.distance.call(void 0, from, centre);
|
|
786
790
|
if (reach < 1) return el;
|
|
787
|
-
const scale =
|
|
791
|
+
const scale = _chunkZ47OPTEPcjs.snapScale.call(void 0, (_nullishCoalesce(el.scale, () => ( 1))) * (_chunkZ47OPTEPcjs.distance.call(void 0, to, centre) / reach), RESIZE_SCALE_STEP);
|
|
788
792
|
if (scale === (_nullishCoalesce(el.scale, () => ( 1)))) return el;
|
|
789
|
-
return
|
|
793
|
+
return _chunkZ47OPTEPcjs.scalePiece.call(void 0, el, scale);
|
|
790
794
|
}
|
|
791
795
|
|
|
792
796
|
// ../canvas/src/a11y.ts
|
|
@@ -830,7 +834,7 @@ function nearestInDirection(nodes, from, direction) {
|
|
|
830
834
|
const d = Math.hypot(dx, dy);
|
|
831
835
|
if (!best2 || d < best2.d) best2 = { id: n.id, d };
|
|
832
836
|
}
|
|
833
|
-
return _nullishCoalesce(_optionalChain([best2, 'optionalAccess',
|
|
837
|
+
return _nullishCoalesce(_optionalChain([best2, 'optionalAccess', _24 => _24.id]), () => ( null));
|
|
834
838
|
}
|
|
835
839
|
function navigateA11y(nodes, fromId, direction) {
|
|
836
840
|
const from = nodes.find((n) => n.id === fromId);
|
|
@@ -866,10 +870,10 @@ function initialEditGesture() {
|
|
|
866
870
|
return { g: initialGestureState, press: null };
|
|
867
871
|
}
|
|
868
872
|
function isArmed(state) {
|
|
869
|
-
return !!_optionalChain([state, 'access',
|
|
873
|
+
return !!_optionalChain([state, 'access', _25 => _25.press, 'optionalAccess', _26 => _26.armed]) && state.press.movable !== null;
|
|
870
874
|
}
|
|
871
875
|
function isMarqueeArmed(state) {
|
|
872
|
-
return !!_optionalChain([state, 'access',
|
|
876
|
+
return !!_optionalChain([state, 'access', _27 => _27.press, 'optionalAccess', _28 => _28.armed]) && !!state.press.marquee;
|
|
873
877
|
}
|
|
874
878
|
var sample = (p) => ({ id: p.id, x: p.x, y: p.y });
|
|
875
879
|
function reduceEditGesture(state, camera, viewport, input) {
|
|
@@ -896,9 +900,9 @@ function reduceEditGesture(state, camera, viewport, input) {
|
|
|
896
900
|
if (input.kind === "down") {
|
|
897
901
|
const r2 = delegate(state.g, { type: "pointerdown", pointer: sample(p) });
|
|
898
902
|
if (Object.keys(r2.state.pointers).length >= 2) {
|
|
899
|
-
const effects2 = _optionalChain([press, 'optionalAccess',
|
|
900
|
-
if (_optionalChain([press, 'optionalAccess',
|
|
901
|
-
if (_optionalChain([press, 'optionalAccess',
|
|
903
|
+
const effects2 = _optionalChain([press, 'optionalAccess', _29 => _29.moving]) && press.movable ? [{ type: "moveEnd", elementId: press.movable }] : [];
|
|
904
|
+
if (_optionalChain([press, 'optionalAccess', _30 => _30.resize, 'optionalAccess', _31 => _31.active]) && press.elementId) effects2.push({ type: "resizeCancel", elementId: press.elementId });
|
|
905
|
+
if (_optionalChain([press, 'optionalAccess', _32 => _32.marquee, 'optionalAccess', _33 => _33.active])) effects2.push({ type: "marqueeCancel" });
|
|
902
906
|
return {
|
|
903
907
|
state: {
|
|
904
908
|
g: r2.state,
|
|
@@ -953,9 +957,9 @@ function reduceEditGesture(state, camera, viewport, input) {
|
|
|
953
957
|
};
|
|
954
958
|
}
|
|
955
959
|
if (input.kind === "move") {
|
|
956
|
-
if (_optionalChain([press, 'optionalAccess',
|
|
960
|
+
if (_optionalChain([press, 'optionalAccess', _34 => _34.marquee]) && Object.keys(state.g.pointers).length === 1) {
|
|
957
961
|
const { origin } = press.marquee;
|
|
958
|
-
const active = press.marquee.active || press.armed ||
|
|
962
|
+
const active = press.marquee.active || press.armed || _chunkZ47OPTEPcjs.distance.call(void 0, origin, p) > TAP_SLOP;
|
|
959
963
|
if (!active) return { state, camera, effects: [] };
|
|
960
964
|
return {
|
|
961
965
|
state: { g: state.g, press: { ...press, last: { x: p.x, y: p.y }, marquee: { origin, active: true } } },
|
|
@@ -963,7 +967,7 @@ function reduceEditGesture(state, camera, viewport, input) {
|
|
|
963
967
|
effects: [{ type: "marquee", from: screenToWorld(camera, viewport, origin), to: screenToWorld(camera, viewport, p) }]
|
|
964
968
|
};
|
|
965
969
|
}
|
|
966
|
-
if (_optionalChain([press, 'optionalAccess',
|
|
970
|
+
if (_optionalChain([press, 'optionalAccess', _35 => _35.resize]) && press.elementId) {
|
|
967
971
|
if (Object.keys(state.g.pointers).length !== 1) return { state, camera, effects: [] };
|
|
968
972
|
const { corner, from } = press.resize;
|
|
969
973
|
return {
|
|
@@ -973,7 +977,7 @@ function reduceEditGesture(state, camera, viewport, input) {
|
|
|
973
977
|
};
|
|
974
978
|
}
|
|
975
979
|
if (press && press.movable && Object.keys(state.g.pointers).length === 1) {
|
|
976
|
-
const dragging = press.pointerType === "touch" ? press.armed : press.moving ||
|
|
980
|
+
const dragging = press.pointerType === "touch" ? press.armed : press.moving || _chunkZ47OPTEPcjs.distance.call(void 0,
|
|
977
981
|
_nullishCoalesce(state.g.origin, () => ( press.last)),
|
|
978
982
|
p
|
|
979
983
|
) > TAP_SLOP;
|
|
@@ -989,7 +993,7 @@ function reduceEditGesture(state, camera, viewport, input) {
|
|
|
989
993
|
if (press.pointerType !== "touch") return { state, camera, effects: [] };
|
|
990
994
|
}
|
|
991
995
|
const r2 = delegate(state.g, { type: "pointermove", pointer: sample(p) });
|
|
992
|
-
const lostPiece = _optionalChain([press, 'optionalAccess',
|
|
996
|
+
const lostPiece = _optionalChain([press, 'optionalAccess', _36 => _36.movable]) && r2.state.moved && !press.moving;
|
|
993
997
|
return {
|
|
994
998
|
state: { g: r2.state, press: press && lostPiece ? { ...press, movable: null } : press },
|
|
995
999
|
camera: r2.camera,
|
|
@@ -999,19 +1003,19 @@ function reduceEditGesture(state, camera, viewport, input) {
|
|
|
999
1003
|
const r = delegate(state.g, { type: input.kind === "up" ? "pointerup" : "pointercancel", pointer: sample(p) });
|
|
1000
1004
|
const idle = Object.keys(r.state.pointers).length === 0;
|
|
1001
1005
|
const effects = [];
|
|
1002
|
-
if (_optionalChain([press, 'optionalAccess',
|
|
1006
|
+
if (_optionalChain([press, 'optionalAccess', _37 => _37.resize]) && press.elementId) {
|
|
1003
1007
|
if (press.resize.active) {
|
|
1004
1008
|
effects.push({ type: input.kind === "up" ? "resizeEnd" : "resizeCancel", elementId: press.elementId });
|
|
1005
1009
|
}
|
|
1006
1010
|
return { state: { g: r.state, press: idle ? null : { ...press, resize: void 0 } }, camera: r.camera, effects };
|
|
1007
1011
|
}
|
|
1008
|
-
if (_optionalChain([press, 'optionalAccess',
|
|
1012
|
+
if (_optionalChain([press, 'optionalAccess', _38 => _38.marquee, 'optionalAccess', _39 => _39.active])) {
|
|
1009
1013
|
const from = screenToWorld(camera, viewport, press.marquee.origin);
|
|
1010
1014
|
const to = screenToWorld(camera, viewport, press.last);
|
|
1011
1015
|
effects.push(input.kind === "up" ? { type: "marqueeEnd", from, to, additive: !!press.additive } : { type: "marqueeCancel" });
|
|
1012
1016
|
return { state: { g: r.state, press: idle ? null : { ...press, marquee: void 0, canMarquee: false } }, camera: r.camera, effects };
|
|
1013
1017
|
}
|
|
1014
|
-
if (_optionalChain([press, 'optionalAccess',
|
|
1018
|
+
if (_optionalChain([press, 'optionalAccess', _40 => _40.moving]) && press.movable) effects.push({ type: "moveEnd", elementId: press.movable });
|
|
1015
1019
|
else if (r.tap && press) {
|
|
1016
1020
|
const world = screenToWorld(camera, viewport, r.tap);
|
|
1017
1021
|
effects.push(press.additive ? { type: "tap", world, elementId: press.elementId, additive: true } : { type: "tap", world, elementId: press.elementId });
|
|
@@ -1144,11 +1148,11 @@ function snapMove(moving, others, threshold, opts = {}) {
|
|
|
1144
1148
|
const pick = (axis) => best([...alignCandidates(moving, others, axis, threshold, opts.sheet), ...gapCandidates(moving, others, axis, threshold)]);
|
|
1145
1149
|
const x = pick("x");
|
|
1146
1150
|
const y = pick("y");
|
|
1147
|
-
const dx = _nullishCoalesce(_optionalChain([x, 'optionalAccess',
|
|
1148
|
-
const dy = _nullishCoalesce(_optionalChain([y, 'optionalAccess',
|
|
1151
|
+
const dx = _nullishCoalesce(_optionalChain([x, 'optionalAccess', _41 => _41.delta]), () => ( 0));
|
|
1152
|
+
const dy = _nullishCoalesce(_optionalChain([y, 'optionalAccess', _42 => _42.delta]), () => ( 0));
|
|
1149
1153
|
const moved = shiftBox(moving, dx, dy);
|
|
1150
1154
|
const guides = alignmentGuides(moved, others, opts.sheet);
|
|
1151
|
-
const gaps = [..._nullishCoalesce(_optionalChain([x, 'optionalAccess',
|
|
1155
|
+
const gaps = [..._nullishCoalesce(_optionalChain([x, 'optionalAccess', _43 => _43.gaps, 'call', _44 => _44(moved)]), () => ( [])), ..._nullishCoalesce(_optionalChain([y, 'optionalAccess', _45 => _45.gaps, 'call', _46 => _46(moved)]), () => ( []))];
|
|
1152
1156
|
return { dx, dy, guides, gaps };
|
|
1153
1157
|
}
|
|
1154
1158
|
function snapResize(box, edges, others, threshold, opts = {}) {
|
|
@@ -1271,7 +1275,7 @@ function focusBox(layout, units, radii, ref) {
|
|
|
1271
1275
|
maxY = Math.max(maxY, u.y + r);
|
|
1272
1276
|
}
|
|
1273
1277
|
for (const el of layout.elements) {
|
|
1274
|
-
if (el.type !== "zone" || _optionalChain([el, 'access',
|
|
1278
|
+
if (el.type !== "zone" || _optionalChain([el, 'access', _47 => _47.placeType, 'optionalAccess', _48 => _48.ref]) !== ref) continue;
|
|
1275
1279
|
const b = pieceBounds(el);
|
|
1276
1280
|
if (!b) continue;
|
|
1277
1281
|
minX = Math.min(minX, b.minX);
|
|
@@ -1326,6 +1330,8 @@ var es = {
|
|
|
1326
1330
|
mapLabel: "Plano del lugar. Movete con las flechas y eleg\xED con Enter.",
|
|
1327
1331
|
zoomIn: "Acercar",
|
|
1328
1332
|
zoomOut: "Alejar",
|
|
1333
|
+
zoomToChoose: "Hay {n} lugares a la vista. Acerc\xE1 el mapa para elegir uno.",
|
|
1334
|
+
wheelHint: "Para acercar el mapa, us\xE1 Ctrl + rueda o los botones + y \u2212",
|
|
1329
1335
|
overviewMapLabel: "Plano del lugar. Toc\xE1 una entrada en el mapa o elegila en la lista de abajo.",
|
|
1330
1336
|
overviewList: "Entradas del lugar",
|
|
1331
1337
|
soldOut: "Agotada",
|
|
@@ -1369,6 +1375,8 @@ var en = {
|
|
|
1369
1375
|
mapLabel: "Venue map. Move with the arrow keys and choose with Enter.",
|
|
1370
1376
|
zoomIn: "Zoom in",
|
|
1371
1377
|
zoomOut: "Zoom out",
|
|
1378
|
+
zoomToChoose: "There are {n} spots in view. Zoom in to choose one.",
|
|
1379
|
+
wheelHint: "To zoom the map, use Ctrl + scroll or the + and \u2212 buttons",
|
|
1372
1380
|
overviewMapLabel: "Venue map. Tap a ticket on the map or choose it from the list below.",
|
|
1373
1381
|
overviewList: "Tickets at the venue",
|
|
1374
1382
|
soldOut: "Sold out",
|
|
@@ -1481,11 +1489,19 @@ var PICKER_CSS = `
|
|
|
1481
1489
|
min-height:300px;max-height:70vh;background:var(--vk-surface);
|
|
1482
1490
|
border:1px solid var(--vk-line);border-radius:var(--vk-radius-lg);overflow:hidden;touch-action:none}
|
|
1483
1491
|
.vk-root[data-fill="true"] .vk-map{flex:1;aspect-ratio:auto;min-height:0;max-height:none}
|
|
1492
|
+
.vk-map[data-cooperative="true"]{touch-action:pan-y}
|
|
1484
1493
|
.vk-canvas{display:block;width:100%;height:100%}
|
|
1485
1494
|
.vk-a11y{position:absolute;inset:0;pointer-events:none}
|
|
1486
1495
|
.vk-seat{position:absolute;transform:translate(-50%,-50%);padding:0;margin:0;border:0;background:transparent;
|
|
1487
1496
|
border-radius:50%;cursor:pointer;color:transparent;overflow:hidden}
|
|
1488
1497
|
.vk-seat:focus-visible{outline:3px solid var(--vk-accent);outline-offset:2px}
|
|
1498
|
+
.vk-choose{position:absolute;left:8px;top:8px;max-width:calc(100% - 64px);min-height:44px;padding:8px 12px;
|
|
1499
|
+
border:1px solid var(--vk-line);border-radius:var(--vk-radius);background:var(--vk-bg);color:var(--vk-fg);
|
|
1500
|
+
font:inherit;font-size:14px;text-align:left;cursor:pointer;opacity:0}
|
|
1501
|
+
.vk-choose:focus{opacity:1;pointer-events:auto;outline:3px solid var(--vk-accent);outline-offset:2px}
|
|
1502
|
+
.vk-map-hint{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);margin:0;max-width:calc(100% - 32px);
|
|
1503
|
+
padding:8px 12px;border-radius:var(--vk-radius);background:rgba(0,0,0,.72);color:#fff;font-size:14px;
|
|
1504
|
+
text-align:center;pointer-events:none}
|
|
1489
1505
|
.vk-zoom{position:absolute;right:8px;bottom:8px;display:flex;flex-direction:column;gap:4px}
|
|
1490
1506
|
.vk-zoom button{width:36px;height:36px;border:1px solid var(--vk-line);background:var(--vk-bg);
|
|
1491
1507
|
color:var(--vk-fg);border-radius:var(--vk-radius);font-size:16px;line-height:1;cursor:pointer}
|
|
@@ -1561,13 +1577,43 @@ function useImage(src) {
|
|
|
1561
1577
|
img.onerror = null;
|
|
1562
1578
|
};
|
|
1563
1579
|
}, [src]);
|
|
1564
|
-
if (!src || _optionalChain([loaded, 'optionalAccess',
|
|
1580
|
+
if (!src || _optionalChain([loaded, 'optionalAccess', _49 => _49.src]) !== src) return { image: null, failed: false };
|
|
1565
1581
|
return { image: loaded.image, failed: loaded.failed };
|
|
1566
1582
|
}
|
|
1567
1583
|
|
|
1568
1584
|
// ../react/src/VenueCanvas.tsx
|
|
1569
1585
|
|
|
1586
|
+
|
|
1587
|
+
// ../react/src/map-targets.ts
|
|
1588
|
+
var MAX_SEAT_BUTTONS = 500;
|
|
1589
|
+
var MIN_PICK_RADIUS_PX = 6;
|
|
1590
|
+
function chooseTarget(visible, activeId, centre) {
|
|
1591
|
+
const active = activeId === null ? void 0 : visible.find((n) => n.id === activeId);
|
|
1592
|
+
if (active) return active;
|
|
1593
|
+
let best2 = null;
|
|
1594
|
+
let bestD = Infinity;
|
|
1595
|
+
for (const n of visible) {
|
|
1596
|
+
const d = (n.x - centre.x) ** 2 + (n.y - centre.y) ** 2;
|
|
1597
|
+
if (d < bestD) {
|
|
1598
|
+
bestD = d;
|
|
1599
|
+
best2 = n;
|
|
1600
|
+
}
|
|
1601
|
+
}
|
|
1602
|
+
return best2;
|
|
1603
|
+
}
|
|
1604
|
+
function zoomToChoose(camera, visibleCount, target) {
|
|
1605
|
+
const factor = Math.max(2, Math.sqrt(visibleCount / (MAX_SEAT_BUTTONS / 2)));
|
|
1606
|
+
return { x: target.x, y: target.y, zoom: clampZoom(camera.zoom * factor) };
|
|
1607
|
+
}
|
|
1608
|
+
function tapZoom(camera, viewport, screen, radiusPx) {
|
|
1609
|
+
if (radiusPx >= MIN_PICK_RADIUS_PX) return null;
|
|
1610
|
+
const next = zoomAt(camera, viewport, screen, Math.max(2, MIN_NUMBERED_RADIUS_PX / Math.max(radiusPx, 0.01)));
|
|
1611
|
+
return next.zoom > camera.zoom ? next : null;
|
|
1612
|
+
}
|
|
1613
|
+
|
|
1614
|
+
// ../react/src/VenueCanvas.tsx
|
|
1570
1615
|
var _jsxruntime = require('react/jsx-runtime');
|
|
1616
|
+
var WHEEL_HINT_MS = 1600;
|
|
1571
1617
|
var ARROWS = {
|
|
1572
1618
|
ArrowUp: "up",
|
|
1573
1619
|
ArrowDown: "down",
|
|
@@ -1638,6 +1684,9 @@ function VenueCanvas(props) {
|
|
|
1638
1684
|
);
|
|
1639
1685
|
const visible = _react.useMemo.call(void 0, () => new Set(scene.visibleUnitIds), [scene]);
|
|
1640
1686
|
const visibleNodes = _react.useMemo.call(void 0, () => a11yNodes.filter((n) => visible.has(n.id)), [a11yNodes, visible]);
|
|
1687
|
+
const tooMany = visibleNodes.length > MAX_SEAT_BUTTONS;
|
|
1688
|
+
const unitById = _react.useMemo.call(void 0, () => new Map(units.map((u) => [u.id, u])), [units]);
|
|
1689
|
+
const chooseRef = _react.useRef.call(void 0, null);
|
|
1641
1690
|
const sizeOf = (elementId) => Math.max(24, 2 * (_nullishCoalesce(props.radii.get(elementId), () => ( DEFAULT_UNIT_RADIUS))) * camera.zoom);
|
|
1642
1691
|
const lastSize = _react.useRef.call(void 0, { width: 0, height: 0 });
|
|
1643
1692
|
const onViewportChangeRef = _react.useRef.call(void 0, props.onViewportChange);
|
|
@@ -1674,10 +1723,23 @@ function VenueCanvas(props) {
|
|
|
1674
1723
|
viewportRef.current = viewport;
|
|
1675
1724
|
const onCameraChangeRef = _react.useRef.call(void 0, props.onCameraChange);
|
|
1676
1725
|
onCameraChangeRef.current = props.onCameraChange;
|
|
1726
|
+
const cooperativeRef = _react.useRef.call(void 0, props.cooperative === true);
|
|
1727
|
+
cooperativeRef.current = props.cooperative === true;
|
|
1728
|
+
const [wheelHint, setWheelHint] = _react.useState.call(void 0, false);
|
|
1729
|
+
const hintTimer = _react.useRef.call(void 0, null);
|
|
1730
|
+
_react.useEffect.call(void 0, () => () => {
|
|
1731
|
+
if (hintTimer.current) clearTimeout(hintTimer.current);
|
|
1732
|
+
}, []);
|
|
1677
1733
|
_react.useEffect.call(void 0, () => {
|
|
1678
1734
|
const canvas = canvasRef.current;
|
|
1679
1735
|
if (!canvas) return;
|
|
1680
1736
|
const onWheel = (e) => {
|
|
1737
|
+
if (cooperativeRef.current && !e.ctrlKey && !e.metaKey) {
|
|
1738
|
+
setWheelHint(true);
|
|
1739
|
+
if (hintTimer.current) clearTimeout(hintTimer.current);
|
|
1740
|
+
hintTimer.current = setTimeout(() => setWheelHint(false), WHEEL_HINT_MS);
|
|
1741
|
+
return;
|
|
1742
|
+
}
|
|
1681
1743
|
e.preventDefault();
|
|
1682
1744
|
const rect = canvas.getBoundingClientRect();
|
|
1683
1745
|
const currentCamera = cameraRef.current;
|
|
@@ -1695,9 +1757,9 @@ function VenueCanvas(props) {
|
|
|
1695
1757
|
_react.useEffect.call(void 0, () => {
|
|
1696
1758
|
const id = pendingFocus.current;
|
|
1697
1759
|
if (!id) return;
|
|
1698
|
-
const button = _optionalChain([wrapRef, 'access',
|
|
1760
|
+
const button = _optionalChain([wrapRef, 'access', _50 => _50.current, 'optionalAccess', _51 => _51.querySelector, 'call', _52 => _52(`[data-unit-id="${id}"]`)]);
|
|
1699
1761
|
pendingFocus.current = null;
|
|
1700
|
-
_optionalChain([button, 'optionalAccess',
|
|
1762
|
+
_optionalChain([(_nullishCoalesce(button, () => ( chooseRef.current))), 'optionalAccess', _53 => _53.focus, 'call', _54 => _54()]);
|
|
1701
1763
|
}, [visibleNodes]);
|
|
1702
1764
|
const send = (input) => {
|
|
1703
1765
|
const result = reduceGesture(gesture.current, camera, viewport, input);
|
|
@@ -1705,8 +1767,26 @@ function VenueCanvas(props) {
|
|
|
1705
1767
|
if (result.camera !== camera) props.onCameraChange(result.camera);
|
|
1706
1768
|
if (!result.tap) return;
|
|
1707
1769
|
const unitId = hitUnit({ index, camera, viewport, screenPoint: result.tap, units, radii: props.radii });
|
|
1708
|
-
if (unitId)
|
|
1709
|
-
|
|
1770
|
+
if (!unitId) {
|
|
1771
|
+
_optionalChain([props, 'access', _55 => _55.onTapEmpty, 'optionalCall', _56 => _56(result.tap)]);
|
|
1772
|
+
return;
|
|
1773
|
+
}
|
|
1774
|
+
const unit = unitById.get(unitId);
|
|
1775
|
+
if (unit && props.focusRef !== null && unit.placeTypeRef === props.focusRef) {
|
|
1776
|
+
const closer = tapZoom(camera, viewport, result.tap, (_nullishCoalesce(props.radii.get(unit.elementId), () => ( DEFAULT_UNIT_RADIUS))) * camera.zoom);
|
|
1777
|
+
if (closer) {
|
|
1778
|
+
props.onCameraChange(closer);
|
|
1779
|
+
return;
|
|
1780
|
+
}
|
|
1781
|
+
}
|
|
1782
|
+
props.onActivateUnit(unitId);
|
|
1783
|
+
};
|
|
1784
|
+
const zoomInToChoose = () => {
|
|
1785
|
+
const target = chooseTarget(visibleNodes, activeId, camera);
|
|
1786
|
+
if (!target) return;
|
|
1787
|
+
setActiveId(target.id);
|
|
1788
|
+
pendingFocus.current = target.id;
|
|
1789
|
+
props.onCameraChange(zoomToChoose(camera, visibleNodes.length, target));
|
|
1710
1790
|
};
|
|
1711
1791
|
const samplePointer = (e) => {
|
|
1712
1792
|
const rect = e.currentTarget.getBoundingClientRect();
|
|
@@ -1724,12 +1804,12 @@ function VenueCanvas(props) {
|
|
|
1724
1804
|
const node = a11yNodes.find((n) => n.id === next);
|
|
1725
1805
|
if (node) props.onCameraChange({ ...camera, x: node.x, y: node.y });
|
|
1726
1806
|
} else {
|
|
1727
|
-
_optionalChain([wrapRef, 'access',
|
|
1807
|
+
_optionalChain([wrapRef, 'access', _57 => _57.current, 'optionalAccess', _58 => _58.querySelector, 'call', _59 => _59(`[data-unit-id="${next}"]`), 'optionalAccess', _60 => _60.focus, 'call', _61 => _61()]);
|
|
1728
1808
|
pendingFocus.current = null;
|
|
1729
1809
|
}
|
|
1730
1810
|
};
|
|
1731
1811
|
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',
|
|
1812
|
+
const tabbableId = _nullishCoalesce((activeId !== null && visible.has(activeId) ? activeId : _optionalChain([visibleNodes, 'access', _62 => _62[0], 'optionalAccess', _63 => _63.id])), () => ( null));
|
|
1733
1813
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1734
1814
|
"div",
|
|
1735
1815
|
{
|
|
@@ -1738,6 +1818,7 @@ function VenueCanvas(props) {
|
|
|
1738
1818
|
"data-testid": "venue-map",
|
|
1739
1819
|
"data-background": props.backgroundStatus,
|
|
1740
1820
|
"data-camera": `${camera.x.toFixed(2)},${camera.y.toFixed(2)},${camera.zoom.toFixed(4)}`,
|
|
1821
|
+
"data-cooperative": props.cooperative ? "true" : void 0,
|
|
1741
1822
|
style: {
|
|
1742
1823
|
["--vk-plan-ratio"]: props.ratio ? `${Math.round(props.ratio.width)} / ${Math.round(props.ratio.height)}` : `${layout.meta.width} / ${layout.meta.height}`,
|
|
1743
1824
|
...props.height !== void 0 ? { height: props.height, aspectRatio: "auto", minHeight: 0, maxHeight: "none" } : {}
|
|
@@ -1758,7 +1839,7 @@ function VenueCanvas(props) {
|
|
|
1758
1839
|
onPointerCancel: (e) => send({ type: "pointercancel", pointer: samplePointer(e) })
|
|
1759
1840
|
}
|
|
1760
1841
|
),
|
|
1761
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "vk-a11y", role: "group", "aria-label": messages.mapLabel, onKeyDown, children: visibleNodes.map((node) => {
|
|
1842
|
+
/* @__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
1843
|
const p = worldToScreen(camera, viewport, node);
|
|
1763
1844
|
const size = sizeOf(node.elementId);
|
|
1764
1845
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -1779,6 +1860,7 @@ function VenueCanvas(props) {
|
|
|
1779
1860
|
node.id
|
|
1780
1861
|
);
|
|
1781
1862
|
}) }),
|
|
1863
|
+
wheelHint ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "vk-map-hint", role: "status", children: messages.wheelHint }) : null,
|
|
1782
1864
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "vk-zoom", children: [
|
|
1783
1865
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "button", { type: "button", onClick: zoomButton(1.4), "aria-label": messages.zoomIn, children: "+" }),
|
|
1784
1866
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "button", { type: "button", onClick: zoomButton(1 / 1.4), "aria-label": messages.zoomOut, children: "\u2212" })
|
|
@@ -1793,7 +1875,7 @@ function VenueCanvas(props) {
|
|
|
1793
1875
|
var NONE = [];
|
|
1794
1876
|
var EMPTY_SET = /* @__PURE__ */ new Set();
|
|
1795
1877
|
function byKind(u, seat, table, place) {
|
|
1796
|
-
return _optionalChain([u, 'optionalAccess',
|
|
1878
|
+
return _optionalChain([u, 'optionalAccess', _64 => _64.kind]) === "table" ? table : _optionalChain([u, 'optionalAccess', _65 => _65.kind]) === "place" ? place : seat;
|
|
1797
1879
|
}
|
|
1798
1880
|
function a11yLabel(u, m) {
|
|
1799
1881
|
const table = format(m.summaryTable, { table: _nullishCoalesce(u.table, () => ( u.label)) });
|
|
@@ -1803,13 +1885,13 @@ function a11yLabel(u, m) {
|
|
|
1803
1885
|
}
|
|
1804
1886
|
function SeatMap(props) {
|
|
1805
1887
|
const { layout, focusRef, selection, onSelectionChange } = props;
|
|
1806
|
-
const maxSelection = _nullishCoalesce(props.maxSelection, () => (
|
|
1888
|
+
const maxSelection = _nullishCoalesce(props.maxSelection, () => ( _chunkZ47OPTEPcjs.DEFAULT_MAX_SELECTION));
|
|
1807
1889
|
const messages = _react.useMemo.call(void 0,
|
|
1808
1890
|
() => mergeMessages({ ...props.messages, ...props.continueLabel ? { continueLabel: props.continueLabel } : {} }),
|
|
1809
1891
|
[props.messages, props.continueLabel]
|
|
1810
1892
|
);
|
|
1811
|
-
const units = _react.useMemo.call(void 0, () =>
|
|
1812
|
-
const index = _react.useMemo.call(void 0, () => new (0,
|
|
1893
|
+
const units = _react.useMemo.call(void 0, () => _chunkZ47OPTEPcjs.expand.call(void 0, layout), [layout]);
|
|
1894
|
+
const index = _react.useMemo.call(void 0, () => new (0, _chunkZ47OPTEPcjs.SpatialIndex)(units), [units]);
|
|
1813
1895
|
const radii = _react.useMemo.call(void 0, () => unitRadii(layout), [layout]);
|
|
1814
1896
|
const unitById = _react.useMemo.call(void 0, () => new Map(units.map((u) => [u.id, u])), [units]);
|
|
1815
1897
|
const placeTypeColors = _react.useMemo.call(void 0, () => new Map(props.placeTypes.map((p) => [p.ref, p.color])), [props.placeTypes]);
|
|
@@ -1847,7 +1929,7 @@ function SeatMap(props) {
|
|
|
1847
1929
|
[props.takenUnitIds, conflicted]
|
|
1848
1930
|
);
|
|
1849
1931
|
const held = _react.useMemo.call(void 0, () => new Set(_nullishCoalesce(props.heldUnitIds, () => ( NONE))), [props.heldUnitIds]);
|
|
1850
|
-
const states = _react.useMemo.call(void 0, () =>
|
|
1932
|
+
const states = _react.useMemo.call(void 0, () => _chunkZ47OPTEPcjs.unitStates.call(void 0, units, taken, selection, held), [units, taken, selection, held]);
|
|
1851
1933
|
const selectable = _react.useMemo.call(void 0, () => units.filter((u) => u.placeTypeRef === focusRef), [units, focusRef]);
|
|
1852
1934
|
const a11yNodes = _react.useMemo.call(void 0,
|
|
1853
1935
|
() => buildA11yNodes(
|
|
@@ -1859,7 +1941,7 @@ function SeatMap(props) {
|
|
|
1859
1941
|
[selectable, states, placeTypeNames, messages]
|
|
1860
1942
|
);
|
|
1861
1943
|
const bg = layout.meta.background;
|
|
1862
|
-
const background = useImage(_nullishCoalesce(_optionalChain([bg, 'optionalAccess',
|
|
1944
|
+
const background = useImage(_nullishCoalesce(_optionalChain([bg, 'optionalAccess', _66 => _66.src]), () => ( null)));
|
|
1863
1945
|
const images = _react.useMemo.call(void 0,
|
|
1864
1946
|
() => new Map(bg && background.image ? [[bg.src, background.image]] : []),
|
|
1865
1947
|
[bg, background.image]
|
|
@@ -1870,7 +1952,7 @@ function SeatMap(props) {
|
|
|
1870
1952
|
const framedFor = _react.useRef.call(void 0, null);
|
|
1871
1953
|
_react.useEffect.call(void 0, () => {
|
|
1872
1954
|
if (viewport.width === 0 || viewport.height === 0) return;
|
|
1873
|
-
if (_optionalChain([framedFor, 'access',
|
|
1955
|
+
if (_optionalChain([framedFor, 'access', _67 => _67.current, 'optionalAccess', _68 => _68.layout]) === layout && framedFor.current.focusRef === focusRef) return;
|
|
1874
1956
|
framedFor.current = { layout, focusRef };
|
|
1875
1957
|
const box = _nullishCoalesce(focusBox(layout, units, radii, focusRef), () => ( { minX: 0, minY: 0, maxX: layout.meta.width, maxY: layout.meta.height }));
|
|
1876
1958
|
setCamera(fitBox(box, viewport, props.embedded ? 16 : 24));
|
|
@@ -1888,7 +1970,7 @@ function SeatMap(props) {
|
|
|
1888
1970
|
const onTapEmpty = _react.useCallback.call(void 0, (screen) => {
|
|
1889
1971
|
const el = elementAt(layout, screen, cameraRef.current, viewportRef.current);
|
|
1890
1972
|
if (!el || el.type === "landmark") return;
|
|
1891
|
-
switchTo(_optionalChain([el, 'access',
|
|
1973
|
+
switchTo(_optionalChain([el, 'access', _69 => _69.placeType, 'optionalAccess', _70 => _70.ref]) || null);
|
|
1892
1974
|
}, [layout, switchTo]);
|
|
1893
1975
|
const activateUnit = _react.useCallback.call(void 0, (unitId) => {
|
|
1894
1976
|
const unit = unitById.get(unitId);
|
|
@@ -1901,7 +1983,7 @@ function SeatMap(props) {
|
|
|
1901
1983
|
announce(messages.heldSeat, true);
|
|
1902
1984
|
return;
|
|
1903
1985
|
}
|
|
1904
|
-
const result =
|
|
1986
|
+
const result = _chunkZ47OPTEPcjs.toggleUnit.call(void 0, selection, unitId, states, maxSelection);
|
|
1905
1987
|
if (result.rejected === "taken") {
|
|
1906
1988
|
announce(byKind(unit, messages.takenSeat, messages.takenTable, messages.takenPlace), true);
|
|
1907
1989
|
return;
|
|
@@ -1914,7 +1996,7 @@ function SeatMap(props) {
|
|
|
1914
1996
|
announce(`${unitName(unit, messages)}: ${added ? messages.selected : messages.free}`);
|
|
1915
1997
|
onSelectionChange(result.selection);
|
|
1916
1998
|
}, [unitById, focusRef, states, selection, maxSelection, messages, announce, onSelectionChange, switchTo]);
|
|
1917
|
-
const summary = selectionSummary(units, selection, messages);
|
|
1999
|
+
const summary = _react.useMemo.call(void 0, () => selectionSummary(units, selection, messages), [units, selection, messages]);
|
|
1918
2000
|
const focusColor = _nullishCoalesce(placeTypeColors.get(focusRef), () => ( "var(--vk-unassigned)"));
|
|
1919
2001
|
const focusType = props.placeTypes.find((p) => p.ref === focusRef);
|
|
1920
2002
|
const embedded = props.embedded === true;
|
|
@@ -1965,6 +2047,7 @@ function SeatMap(props) {
|
|
|
1965
2047
|
onTapEmpty,
|
|
1966
2048
|
placeTypePrices,
|
|
1967
2049
|
...props.height !== void 0 ? { height: props.height } : {},
|
|
2050
|
+
cooperative: embedded,
|
|
1968
2051
|
images,
|
|
1969
2052
|
...backgroundStatus ? { backgroundStatus } : {}
|
|
1970
2053
|
}
|
|
@@ -2013,7 +2096,7 @@ function overviewBox(layout, radii) {
|
|
|
2013
2096
|
for (const el of layout.elements) {
|
|
2014
2097
|
const b = elementBounds(layout, el);
|
|
2015
2098
|
if (!b) continue;
|
|
2016
|
-
const r = el.type === "seatBlock" || el.type === "table" ? _nullishCoalesce(_optionalChain([radii, 'optionalAccess',
|
|
2099
|
+
const r = el.type === "seatBlock" || el.type === "table" ? _nullishCoalesce(_optionalChain([radii, 'optionalAccess', _71 => _71.get, 'call', _72 => _72(el.id)]), () => ( 0)) : 0;
|
|
2017
2100
|
box = box ? {
|
|
2018
2101
|
minX: Math.min(box.minX, b.minX - r),
|
|
2019
2102
|
minY: Math.min(box.minY, b.minY - r),
|
|
@@ -2035,8 +2118,8 @@ var NO_NODES = [];
|
|
|
2035
2118
|
function VenueOverview(props) {
|
|
2036
2119
|
const { layout, placeTypes, onSelect } = props;
|
|
2037
2120
|
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,
|
|
2121
|
+
const units = _react.useMemo.call(void 0, () => _chunkZ47OPTEPcjs.expand.call(void 0, layout), [layout]);
|
|
2122
|
+
const index = _react.useMemo.call(void 0, () => new (0, _chunkZ47OPTEPcjs.SpatialIndex)(units), [units]);
|
|
2040
2123
|
const radii = _react.useMemo.call(void 0, () => unitRadii(layout), [layout]);
|
|
2041
2124
|
const unitById = _react.useMemo.call(void 0, () => new Map(units.map((u) => [u.id, u])), [units]);
|
|
2042
2125
|
const placeTypeColors = _react.useMemo.call(void 0, () => new Map(placeTypes.map((p) => [p.ref, p.color])), [placeTypes]);
|
|
@@ -2053,7 +2136,7 @@ function VenueOverview(props) {
|
|
|
2053
2136
|
const takenIds = _nullishCoalesce(props.takenUnitIds, () => ( NONE2));
|
|
2054
2137
|
const selectedIds = _nullishCoalesce(props.selectedUnitIds, () => ( NONE2));
|
|
2055
2138
|
const states = _react.useMemo.call(void 0,
|
|
2056
|
-
() =>
|
|
2139
|
+
() => _chunkZ47OPTEPcjs.unitStates.call(void 0, units, new Set(takenIds), selectedIds, NO_HELD),
|
|
2057
2140
|
[units, takenIds, selectedIds]
|
|
2058
2141
|
);
|
|
2059
2142
|
const hideList = props.hideList === true;
|
|
@@ -2066,12 +2149,12 @@ function VenueOverview(props) {
|
|
|
2066
2149
|
const tap = overviewTap(ref, placeTypes);
|
|
2067
2150
|
if (tap.kind === "select") onSelect(tap.ref);
|
|
2068
2151
|
else if (tap.kind === "soldOut") {
|
|
2069
|
-
const name = _nullishCoalesce(_optionalChain([placeTypes, 'access',
|
|
2152
|
+
const name = _nullishCoalesce(_optionalChain([placeTypes, 'access', _73 => _73.find, 'call', _74 => _74((p) => p.ref === tap.ref), 'optionalAccess', _75 => _75.label]), () => ( ""));
|
|
2070
2153
|
setNotice((n) => ({ text: format(messages.soldOutNotice, { name }), seq: n.seq + 1 }));
|
|
2071
2154
|
}
|
|
2072
2155
|
}, [placeTypes, onSelect, messages]);
|
|
2073
2156
|
const bg = layout.meta.background;
|
|
2074
|
-
const background = useImage(_nullishCoalesce(_optionalChain([bg, 'optionalAccess',
|
|
2157
|
+
const background = useImage(_nullishCoalesce(_optionalChain([bg, 'optionalAccess', _76 => _76.src]), () => ( null)));
|
|
2075
2158
|
const images = _react.useMemo.call(void 0,
|
|
2076
2159
|
() => new Map(bg && background.image ? [[bg.src, background.image]] : []),
|
|
2077
2160
|
[bg, background.image]
|
|
@@ -2098,7 +2181,7 @@ function VenueOverview(props) {
|
|
|
2098
2181
|
const onTapEmpty = _react.useCallback.call(void 0, (screen) => {
|
|
2099
2182
|
const el = elementAt(layout, screen, cameraRef.current, viewportRef.current);
|
|
2100
2183
|
if (!el || el.type === "landmark") return;
|
|
2101
|
-
choose(_optionalChain([el, 'access',
|
|
2184
|
+
choose(_optionalChain([el, 'access', _77 => _77.placeType, 'optionalAccess', _78 => _78.ref]) || null);
|
|
2102
2185
|
}, [layout, choose]);
|
|
2103
2186
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2104
2187
|
"div",
|
|
@@ -2123,7 +2206,7 @@ function VenueOverview(props) {
|
|
|
2123
2206
|
onCameraChange: setCamera,
|
|
2124
2207
|
viewport,
|
|
2125
2208
|
onViewportChange: setViewport,
|
|
2126
|
-
onActivateUnit: (id) => choose(_nullishCoalesce(_optionalChain([unitById, 'access',
|
|
2209
|
+
onActivateUnit: (id) => choose(_nullishCoalesce(_optionalChain([unitById, 'access', _79 => _79.get, 'call', _80 => _80(id), 'optionalAccess', _81 => _81.placeTypeRef]), () => ( null))),
|
|
2127
2210
|
onTapEmpty,
|
|
2128
2211
|
messages: canvasMessages,
|
|
2129
2212
|
placeTypeColors,
|
|
@@ -2133,6 +2216,7 @@ function VenueOverview(props) {
|
|
|
2133
2216
|
highlightRefs,
|
|
2134
2217
|
...props.height !== void 0 ? { height: props.height } : {},
|
|
2135
2218
|
ratio: contentRatio,
|
|
2219
|
+
cooperative: true,
|
|
2136
2220
|
images,
|
|
2137
2221
|
...backgroundStatus ? { backgroundStatus } : {}
|
|
2138
2222
|
}
|
|
@@ -2217,9 +2301,9 @@ function withWorldSize(el, axis, size) {
|
|
|
2217
2301
|
const swap = el.transform.rotation === 90 || el.transform.rotation === 270;
|
|
2218
2302
|
const field = axis === "x" !== swap ? "width" : "height";
|
|
2219
2303
|
if (el.type === "zone" && (_nullishCoalesce(el.curve, () => ( 0))) > 0) {
|
|
2220
|
-
const now =
|
|
2304
|
+
const now = _chunkZ47OPTEPcjs.zoneLocalSize.call(void 0, el);
|
|
2221
2305
|
if (Math.abs(now[field] - size) < 1e-6) return el;
|
|
2222
|
-
const next =
|
|
2306
|
+
const next = _chunkZ47OPTEPcjs.zoneWithLocalSize.call(void 0, el, field === "width" ? size : now.width, field === "height" ? size : now.height);
|
|
2223
2307
|
return { ...next, width: Math.round(next.width), height: Math.round(next.height) };
|
|
2224
2308
|
}
|
|
2225
2309
|
return el[field] === size ? el : { ...el, [field]: size };
|
|
@@ -2245,7 +2329,7 @@ function arrangeCommands(layout, ids, action) {
|
|
|
2245
2329
|
const scale = _nullishCoalesce(model.el.scale, () => ( 1));
|
|
2246
2330
|
return scaled.slice(1).flatMap(({ el }) => {
|
|
2247
2331
|
const piece = el;
|
|
2248
|
-
return (_nullishCoalesce(piece.scale, () => ( 1))) === scale ? [] : [{ type: "replaceElement", element:
|
|
2332
|
+
return (_nullishCoalesce(piece.scale, () => ( 1))) === scale ? [] : [{ type: "replaceElement", element: _chunkZ47OPTEPcjs.scalePiece.call(void 0, piece, scale) }];
|
|
2249
2333
|
});
|
|
2250
2334
|
}
|
|
2251
2335
|
const shifts = action === "distributeX" ? distributeBoxes(boxes, "x") : action === "distributeY" ? distributeBoxes(boxes, "y") : alignBoxes(boxes, action);
|
|
@@ -2394,14 +2478,65 @@ function BackgroundControl(props) {
|
|
|
2394
2478
|
// ../react/src/designer/DesignerCanvas.tsx
|
|
2395
2479
|
|
|
2396
2480
|
|
|
2481
|
+
// ../react/src/designer/drag-preview.ts
|
|
2482
|
+
function changedIds(preview) {
|
|
2483
|
+
return preview.kind === "move" ? [...preview.ids] : [preview.element.id];
|
|
2484
|
+
}
|
|
2485
|
+
function splitUnits(units, changed) {
|
|
2486
|
+
const still = [];
|
|
2487
|
+
const moving = [];
|
|
2488
|
+
for (const u of units) (changed.has(u.elementId) ? moving : still).push(u);
|
|
2489
|
+
return { changed, still, stillIndex: new (0, _chunkZ47OPTEPcjs.SpatialIndex)(still), moving, movingIndex: new (0, _chunkZ47OPTEPcjs.SpatialIndex)(moving) };
|
|
2490
|
+
}
|
|
2491
|
+
function boxesOf(layout) {
|
|
2492
|
+
const out = /* @__PURE__ */ new Map();
|
|
2493
|
+
for (const el of layout.elements) {
|
|
2494
|
+
const b = pieceBounds(el);
|
|
2495
|
+
if (b) out.set(el.id, b);
|
|
2496
|
+
}
|
|
2497
|
+
return out;
|
|
2498
|
+
}
|
|
2499
|
+
function shifted(el, dx, dy) {
|
|
2500
|
+
return { ...el, transform: { ...el.transform, x: el.transform.x + dx, y: el.transform.y + dy } };
|
|
2501
|
+
}
|
|
2502
|
+
function joined(still, moving, dx, dy) {
|
|
2503
|
+
return {
|
|
2504
|
+
queryRect: (q) => {
|
|
2505
|
+
const out = still.queryRect(q);
|
|
2506
|
+
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);
|
|
2507
|
+
return out;
|
|
2508
|
+
}
|
|
2509
|
+
};
|
|
2510
|
+
}
|
|
2511
|
+
function previewFrame(base, split, baseBoxes, preview) {
|
|
2512
|
+
const boxes = new Map(baseBoxes);
|
|
2513
|
+
if (preview.kind === "move") {
|
|
2514
|
+
const { dx, dy } = preview;
|
|
2515
|
+
const layout2 = { ...base, elements: base.elements.map((el) => split.changed.has(el.id) ? shifted(el, dx, dy) : el) };
|
|
2516
|
+
for (const id of split.changed) {
|
|
2517
|
+
const b2 = baseBoxes.get(id);
|
|
2518
|
+
if (b2) boxes.set(id, shiftBox(b2, dx, dy));
|
|
2519
|
+
}
|
|
2520
|
+
const units = split.still.concat(split.moving.map((u) => ({ ...u, x: u.x + dx, y: u.y + dy })));
|
|
2521
|
+
return { layout: layout2, units, index: joined(split.stillIndex, split.movingIndex, dx, dy), boxes };
|
|
2522
|
+
}
|
|
2523
|
+
const { element } = preview;
|
|
2524
|
+
const layout = { ...base, elements: base.elements.map((el) => el.id === element.id ? element : el) };
|
|
2525
|
+
const own = _chunkZ47OPTEPcjs.expand.call(void 0, { ...base, elements: [element] });
|
|
2526
|
+
const b = pieceBounds(element);
|
|
2527
|
+
if (b) boxes.set(element.id, b);
|
|
2528
|
+
else boxes.delete(element.id);
|
|
2529
|
+
return { layout, units: split.still.concat(own), index: joined(split.stillIndex, new (0, _chunkZ47OPTEPcjs.SpatialIndex)(own), 0, 0), boxes };
|
|
2530
|
+
}
|
|
2531
|
+
|
|
2397
2532
|
// ../react/src/designer/sizing.ts
|
|
2398
2533
|
var SIZE_STEP = 0.1;
|
|
2399
2534
|
var KEY_RESIZE_STEP = 20;
|
|
2400
2535
|
function steppedScale(scale, direction) {
|
|
2401
|
-
return
|
|
2536
|
+
return _chunkZ47OPTEPcjs.snapScale.call(void 0, scale + direction * SIZE_STEP);
|
|
2402
2537
|
}
|
|
2403
2538
|
function keyboardResize(el, corner, direction) {
|
|
2404
|
-
if (el.type === "seatBlock" || el.type === "table") return
|
|
2539
|
+
if (el.type === "seatBlock" || el.type === "table") return _chunkZ47OPTEPcjs.scalePiece.call(void 0, el, steppedScale(_nullishCoalesce(el.scale, () => ( 1)), direction));
|
|
2405
2540
|
const box = pieceBounds(el);
|
|
2406
2541
|
if (!box) return el;
|
|
2407
2542
|
const from = cornerPoint(box, corner);
|
|
@@ -2416,9 +2551,6 @@ var NO_STATES = /* @__PURE__ */ new Map();
|
|
|
2416
2551
|
var TICK_MS = 50;
|
|
2417
2552
|
var MAX_SEAT_TARGETS = 1e3;
|
|
2418
2553
|
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
2554
|
function union(boxes) {
|
|
2423
2555
|
if (boxes.length === 0) return null;
|
|
2424
2556
|
return boxes.reduce((a, b) => ({
|
|
@@ -2438,26 +2570,37 @@ function frame(layout, viewport) {
|
|
|
2438
2570
|
function pieceName(el, placeTypes, m) {
|
|
2439
2571
|
if (el.type === "landmark") return el.name;
|
|
2440
2572
|
if (el.type === "zone") {
|
|
2441
|
-
const ref2 = _optionalChain([el, 'access',
|
|
2442
|
-
return _nullishCoalesce((ref2 ? _optionalChain([placeTypes, 'access',
|
|
2573
|
+
const ref2 = _optionalChain([el, 'access', _82 => _82.placeType, 'optionalAccess', _83 => _83.ref]) || null;
|
|
2574
|
+
return _nullishCoalesce((ref2 ? _optionalChain([placeTypes, 'access', _84 => _84.find, 'call', _85 => _85((p) => p.ref === ref2), 'optionalAccess', _86 => _86.label]) : void 0), () => ( m.unassigned));
|
|
2443
2575
|
}
|
|
2444
2576
|
const own = el.type === "seatBlock" ? (() => {
|
|
2445
|
-
const rows =
|
|
2577
|
+
const rows = _chunkZ47OPTEPcjs.expandLabels.call(void 0, el.rowLabels, el.rows);
|
|
2446
2578
|
return format(m.pieceBlockName, { from: _nullishCoalesce(rows[0], () => ( "")), to: _nullishCoalesce(rows[rows.length - 1], () => ( "")) });
|
|
2447
2579
|
})() : format(m.pieceTableName, { label: el.label });
|
|
2448
|
-
const ref = _optionalChain([el, 'access',
|
|
2449
|
-
const type = ref ? _optionalChain([placeTypes, 'access',
|
|
2580
|
+
const ref = _optionalChain([el, 'access', _87 => _87.placeType, 'optionalAccess', _88 => _88.ref]) || null;
|
|
2581
|
+
const type = ref ? _optionalChain([placeTypes, 'access', _89 => _89.find, 'call', _90 => _90((p) => p.ref === ref), 'optionalAccess', _91 => _91.label]) : void 0;
|
|
2450
2582
|
return `${own}, ${_nullishCoalesce(type, () => ( m.unassigned))}`;
|
|
2451
2583
|
}
|
|
2452
2584
|
function fullBlock(layout, id) {
|
|
2453
2585
|
const el = id ? layout.elements.find((e) => e.id === id) : void 0;
|
|
2454
|
-
return _optionalChain([el, 'optionalAccess',
|
|
2586
|
+
return _optionalChain([el, 'optionalAccess', _92 => _92.type]) === "seatBlock" ? _chunkZ47OPTEPcjs.expandSeatBlock.call(void 0, { ...el, removed: [] }) : [];
|
|
2455
2587
|
}
|
|
2456
2588
|
var DesignerCanvas = _react.forwardRef.call(void 0, function DesignerCanvas2({ designer, placeTypes, lockedUnitIds, messages, frameKey, onPieceTap, backgroundImage = null, compact = false, overlay, theme }, ref) {
|
|
2457
2589
|
const { ui } = designer;
|
|
2458
|
-
const [
|
|
2590
|
+
const [preview, setPreview] = _react.useState.call(void 0, null);
|
|
2459
2591
|
const resizingRef = _react.useRef.call(void 0, null);
|
|
2460
|
-
const
|
|
2592
|
+
const resizing = _optionalChain([preview, 'optionalAccess', _93 => _93.kind]) === "replace" ? preview.element : null;
|
|
2593
|
+
const base = designer.layout;
|
|
2594
|
+
const baseUnits = _react.useMemo.call(void 0, () => _chunkZ47OPTEPcjs.expand.call(void 0, base), [base]);
|
|
2595
|
+
const baseIndex = _react.useMemo.call(void 0, () => new (0, _chunkZ47OPTEPcjs.SpatialIndex)(baseUnits), [baseUnits]);
|
|
2596
|
+
const baseBoxes = _react.useMemo.call(void 0, () => boxesOf(base), [base]);
|
|
2597
|
+
const changedKey = preview ? changedIds(preview).join("\0") : "";
|
|
2598
|
+
const split = _react.useMemo.call(void 0, () => changedKey ? splitUnits(baseUnits, new Set(changedKey.split("\0"))) : null, [baseUnits, changedKey]);
|
|
2599
|
+
const view = _react.useMemo.call(void 0,
|
|
2600
|
+
() => preview && split ? previewFrame(base, split, baseBoxes, preview) : { layout: base, units: baseUnits, index: baseIndex, boxes: baseBoxes },
|
|
2601
|
+
[preview, split, base, baseUnits, baseIndex, baseBoxes]
|
|
2602
|
+
);
|
|
2603
|
+
const { layout, units, index, boxes } = view;
|
|
2461
2604
|
const stageRef = _react.useRef.call(void 0, null);
|
|
2462
2605
|
const canvasRef = _react.useRef.call(void 0, null);
|
|
2463
2606
|
const [viewport, setViewport] = _react.useState.call(void 0, { width: 0, height: 0 });
|
|
@@ -2480,8 +2623,6 @@ var DesignerCanvas = _react.forwardRef.call(void 0, function DesignerCanvas2({ d
|
|
|
2480
2623
|
const spaceHeld = _react.useRef.call(void 0, false);
|
|
2481
2624
|
const [panReady, setPanReady] = _react.useState.call(void 0, false);
|
|
2482
2625
|
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
2626
|
const radii = _react.useMemo.call(void 0, () => unitRadii(layout), [layout]);
|
|
2486
2627
|
const bg = layout.meta.background;
|
|
2487
2628
|
const images = _react.useMemo.call(void 0,
|
|
@@ -2489,21 +2630,21 @@ var DesignerCanvas = _react.forwardRef.call(void 0, function DesignerCanvas2({ d
|
|
|
2489
2630
|
[bg, backgroundImage]
|
|
2490
2631
|
);
|
|
2491
2632
|
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,
|
|
2633
|
+
const seatEditUnits = _react.useMemo.call(void 0, () => fullBlock(base, ui.seatEditId), [base, ui.seatEditId]);
|
|
2634
|
+
const seatEditIndex = _react.useMemo.call(void 0, () => new (0, _chunkZ47OPTEPcjs.SpatialIndex)(seatEditUnits), [seatEditUnits]);
|
|
2494
2635
|
const seatEditById = _react.useMemo.call(void 0, () => new Map(seatEditUnits.map((u) => [u.id, u])), [seatEditUnits]);
|
|
2495
2636
|
const elementBoxes = _react.useMemo.call(void 0,
|
|
2496
2637
|
() => layout.elements.flatMap((el) => {
|
|
2497
|
-
const b =
|
|
2638
|
+
const b = boxes.get(el.id);
|
|
2498
2639
|
return b ? [{ el, b }] : [];
|
|
2499
2640
|
}),
|
|
2500
|
-
[layout]
|
|
2641
|
+
[layout, boxes]
|
|
2501
2642
|
);
|
|
2502
2643
|
const removed = _react.useMemo.call(void 0, () => {
|
|
2503
2644
|
if (seatEditUnits.length === 0) return /* @__PURE__ */ new Set();
|
|
2504
|
-
const present = new Set(
|
|
2645
|
+
const present = new Set(baseUnits.map((u) => u.id));
|
|
2505
2646
|
return new Set(seatEditUnits.filter((u) => !present.has(u.id)).map((u) => u.id));
|
|
2506
|
-
}, [seatEditUnits,
|
|
2647
|
+
}, [seatEditUnits, baseUnits]);
|
|
2507
2648
|
_react.useEffect.call(void 0, () => {
|
|
2508
2649
|
const el = stageRef.current;
|
|
2509
2650
|
if (!el) return;
|
|
@@ -2567,27 +2708,26 @@ var DesignerCanvas = _react.forwardRef.call(void 0, function DesignerCanvas2({ d
|
|
|
2567
2708
|
[layout, units, index, camera, viewport, palette, placeTypeColors, lockedUnitIds, messages.unassigned]
|
|
2568
2709
|
);
|
|
2569
2710
|
_react.useEffect.call(void 0, () => {
|
|
2570
|
-
const ctx = _optionalChain([canvasRef, 'access',
|
|
2711
|
+
const ctx = _optionalChain([canvasRef, 'access', _94 => _94.current, 'optionalAccess', _95 => _95.getContext, 'call', _96 => _96("2d")]);
|
|
2571
2712
|
if (!ctx || viewport.width === 0) return;
|
|
2572
2713
|
renderScene(scene, { ctx, camera, viewport, dpr, images });
|
|
2573
2714
|
ctx.setTransform(dpr, 0, 0, dpr, 0, 0);
|
|
2574
2715
|
if (bg && ui.backgroundEditing && !bg.locked) {
|
|
2575
2716
|
const a = worldToScreen(camera, viewport, { x: bg.x, y: bg.y });
|
|
2576
2717
|
const b = worldToScreen(camera, viewport, { x: bg.x + bg.width, y: bg.y + bg.height });
|
|
2577
|
-
const
|
|
2718
|
+
const up = lifted === BACKGROUND_ID;
|
|
2578
2719
|
ctx.save();
|
|
2579
|
-
if (
|
|
2720
|
+
if (up) {
|
|
2580
2721
|
ctx.shadowColor = "rgba(0,0,0,.35)";
|
|
2581
2722
|
ctx.shadowBlur = 12;
|
|
2582
2723
|
} else ctx.setLineDash([6, 4]);
|
|
2583
|
-
ctx.lineWidth =
|
|
2724
|
+
ctx.lineWidth = up ? 3 : 1.5;
|
|
2584
2725
|
ctx.strokeStyle = palette.selectedStroke;
|
|
2585
2726
|
ctx.strokeRect(a.x, a.y, b.x - a.x, b.y - a.y);
|
|
2586
2727
|
ctx.restore();
|
|
2587
2728
|
}
|
|
2588
2729
|
for (const id of ui.selection) {
|
|
2589
|
-
const
|
|
2590
|
-
const box = selected ? elementBounds(layout, selected) : null;
|
|
2730
|
+
const box = boxes.get(id);
|
|
2591
2731
|
if (!box) continue;
|
|
2592
2732
|
const a = worldToScreen(camera, viewport, { x: box.minX, y: box.minY });
|
|
2593
2733
|
const b = worldToScreen(camera, viewport, { x: box.maxX, y: box.maxY });
|
|
@@ -2612,12 +2752,11 @@ var DesignerCanvas = _react.forwardRef.call(void 0, function DesignerCanvas2({ d
|
|
|
2612
2752
|
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
2753
|
ctx.restore();
|
|
2614
2754
|
}
|
|
2615
|
-
const
|
|
2616
|
-
|
|
2617
|
-
if (upBox) {
|
|
2755
|
+
const upBox = lifted ? boxes.get(lifted) : void 0;
|
|
2756
|
+
if (lifted && upBox) {
|
|
2618
2757
|
const a = worldToScreen(camera, viewport, { x: upBox.minX, y: upBox.minY });
|
|
2619
2758
|
const b = worldToScreen(camera, viewport, { x: upBox.maxX, y: upBox.maxY });
|
|
2620
|
-
const pad = 12 + (_nullishCoalesce(radii.get(
|
|
2759
|
+
const pad = 12 + (_nullishCoalesce(radii.get(lifted), () => ( 0))) * camera.zoom;
|
|
2621
2760
|
ctx.save();
|
|
2622
2761
|
ctx.shadowColor = "rgba(0,0,0,.35)";
|
|
2623
2762
|
ctx.shadowBlur = 12;
|
|
@@ -2640,10 +2779,10 @@ var DesignerCanvas = _react.forwardRef.call(void 0, function DesignerCanvas2({ d
|
|
|
2640
2779
|
}
|
|
2641
2780
|
ctx.setLineDash([]);
|
|
2642
2781
|
}
|
|
2643
|
-
}, [scene, camera, viewport, dpr, images, bg, ui.backgroundEditing, ui.selection, ui.seatEditId,
|
|
2782
|
+
}, [scene, camera, viewport, dpr, images, bg, ui.backgroundEditing, ui.selection, ui.seatEditId, boxes, radii, palette, seatEditUnits, removed, lifted, hints, marquee]);
|
|
2644
2783
|
_react.useImperativeHandle.call(void 0, ref, () => ({
|
|
2645
2784
|
clientToWorld: (clientX, clientY) => {
|
|
2646
|
-
const r = _optionalChain([stageRef, 'access',
|
|
2785
|
+
const r = _optionalChain([stageRef, 'access', _97 => _97.current, 'optionalAccess', _98 => _98.getBoundingClientRect, 'call', _99 => _99()]);
|
|
2647
2786
|
if (!r || clientX < r.left || clientX > r.right || clientY < r.top || clientY > r.bottom) return null;
|
|
2648
2787
|
const { camera: c, viewport: v } = latest.current;
|
|
2649
2788
|
return screenToWorld(c, v, { x: clientX - r.left, y: clientY - r.top });
|
|
@@ -2679,9 +2818,12 @@ var DesignerCanvas = _react.forwardRef.call(void 0, function DesignerCanvas2({ d
|
|
|
2679
2818
|
} else if (fx.type === "moveBy") {
|
|
2680
2819
|
moveDragged(fx.elementId, fx.dx, fx.dy, fx.key, zoom);
|
|
2681
2820
|
} else if (fx.type === "moveEnd") {
|
|
2682
|
-
const
|
|
2821
|
+
const done = drag.current;
|
|
2822
|
+
const group = done && done.ids.length > 1;
|
|
2683
2823
|
drag.current = null;
|
|
2684
2824
|
setHints(null);
|
|
2825
|
+
setPreview(null);
|
|
2826
|
+
if (done && (done.applied.x !== 0 || done.applied.y !== 0)) d.moveMany(done.ids, done.applied.x, done.applied.y);
|
|
2685
2827
|
if (!group) d.dispatchUi({ type: "select", id: fx.elementId });
|
|
2686
2828
|
} else if (fx.type === "marquee") {
|
|
2687
2829
|
setMarquee({ from: fx.from, to: fx.to });
|
|
@@ -2699,12 +2841,12 @@ var DesignerCanvas = _react.forwardRef.call(void 0, function DesignerCanvas2({ d
|
|
|
2699
2841
|
const start = d.layout.elements.find((e) => e.id === fx.elementId);
|
|
2700
2842
|
if (!start) return;
|
|
2701
2843
|
resizingRef.current = snappedResize(start, fx.corner, fx.from, fx.to, zoom);
|
|
2702
|
-
|
|
2844
|
+
setPreview({ kind: "replace", element: resizingRef.current });
|
|
2703
2845
|
} else if (fx.type === "resizeEnd" || fx.type === "resizeCancel") {
|
|
2704
2846
|
const done = resizingRef.current;
|
|
2705
2847
|
resizingRef.current = null;
|
|
2706
2848
|
resizeOthers.current = null;
|
|
2707
|
-
|
|
2849
|
+
setPreview(null);
|
|
2708
2850
|
setHints(null);
|
|
2709
2851
|
const start = d.layout.elements.find((e) => e.id === fx.elementId);
|
|
2710
2852
|
if (fx.type === "resizeEnd" && done && start && done !== start) d.run({ type: "replaceElement", element: done });
|
|
@@ -2718,7 +2860,7 @@ var DesignerCanvas = _react.forwardRef.call(void 0, function DesignerCanvas2({ d
|
|
|
2718
2860
|
if (fx.elementId) d.dispatchUi({ type: "toggleSelect", id: fx.elementId });
|
|
2719
2861
|
} else {
|
|
2720
2862
|
d.dispatchUi({ type: "select", id: fx.elementId });
|
|
2721
|
-
if (fx.elementId) _optionalChain([onPieceTapRef, 'access',
|
|
2863
|
+
if (fx.elementId) _optionalChain([onPieceTapRef, 'access', _100 => _100.current, 'optionalCall', _101 => _101(fx.elementId)]);
|
|
2722
2864
|
}
|
|
2723
2865
|
};
|
|
2724
2866
|
const sheetBox = (l) => ({ minX: 0, minY: 0, maxX: l.meta.width, maxY: l.meta.height });
|
|
@@ -2736,10 +2878,11 @@ var DesignerCanvas = _react.forwardRef.call(void 0, function DesignerCanvas2({ d
|
|
|
2736
2878
|
}
|
|
2737
2879
|
current.raw = { x: current.raw.x + dx, y: current.raw.y + dy };
|
|
2738
2880
|
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
|
-
|
|
2881
|
+
const target = { x: current.raw.x + (_nullishCoalesce(_optionalChain([snap, 'optionalAccess', _102 => _102.dx]), () => ( 0))), y: current.raw.y + (_nullishCoalesce(_optionalChain([snap, 'optionalAccess', _103 => _103.dy]), () => ( 0))) };
|
|
2882
|
+
if (target.x !== current.applied.x || target.y !== current.applied.y) {
|
|
2883
|
+
current.applied = target;
|
|
2884
|
+
setPreview({ kind: "move", ids: current.ids, dx: target.x, dy: target.y });
|
|
2885
|
+
}
|
|
2743
2886
|
setHints(snap && (snap.guides.length > 0 || snap.gaps.length > 0) ? { guides: snap.guides, gaps: snap.gaps, matches: [] } : null);
|
|
2744
2887
|
};
|
|
2745
2888
|
const snappedResize = (start, corner, from, to, zoom) => {
|
|
@@ -2757,7 +2900,7 @@ var DesignerCanvas = _react.forwardRef.call(void 0, function DesignerCanvas2({ d
|
|
|
2757
2900
|
if (isScaled2(next) && isScaled2(start)) {
|
|
2758
2901
|
const same = d.layout.elements.filter((el) => el.id !== start.id && el.type === next.type);
|
|
2759
2902
|
const match = snapScaleTo(_nullishCoalesce(next.scale, () => ( 1)), same.map((el) => _nullishCoalesce(el.scale, () => ( 1))));
|
|
2760
|
-
const sized2 = match !== null && match !== (_nullishCoalesce(next.scale, () => ( 1))) ?
|
|
2903
|
+
const sized2 = match !== null && match !== (_nullishCoalesce(next.scale, () => ( 1))) ? _chunkZ47OPTEPcjs.scalePiece.call(void 0, start, match) : next;
|
|
2761
2904
|
const now = _nullishCoalesce(sized2.scale, () => ( 1));
|
|
2762
2905
|
const matches = same.filter((el) => (_nullishCoalesce(el.scale, () => ( 1))) === now).flatMap((el) => _nullishCoalesce(pieceBounds(el), () => ( [])));
|
|
2763
2906
|
setHints(matches.length > 0 ? { guides: [], gaps: [], matches } : null);
|
|
@@ -2783,7 +2926,7 @@ var DesignerCanvas = _react.forwardRef.call(void 0, function DesignerCanvas2({ d
|
|
|
2783
2926
|
const nowMarquee = isMarqueeArmed(r.state);
|
|
2784
2927
|
if (nowMarquee && !marqueeArmed.current) {
|
|
2785
2928
|
try {
|
|
2786
|
-
_optionalChain([navigator, 'access',
|
|
2929
|
+
_optionalChain([navigator, 'access', _104 => _104.vibrate, 'optionalCall', _105 => _105(10)]);
|
|
2787
2930
|
} catch (e2) {
|
|
2788
2931
|
}
|
|
2789
2932
|
}
|
|
@@ -2792,7 +2935,7 @@ var DesignerCanvas = _react.forwardRef.call(void 0, function DesignerCanvas2({ d
|
|
|
2792
2935
|
if (nowLifted !== liftedRef.current) {
|
|
2793
2936
|
if (nowLifted) {
|
|
2794
2937
|
try {
|
|
2795
|
-
_optionalChain([navigator, 'access',
|
|
2938
|
+
_optionalChain([navigator, 'access', _106 => _106.vibrate, 'optionalCall', _107 => _107(10)]);
|
|
2796
2939
|
} catch (e3) {
|
|
2797
2940
|
}
|
|
2798
2941
|
}
|
|
@@ -2864,7 +3007,7 @@ var DesignerCanvas = _react.forwardRef.call(void 0, function DesignerCanvas2({ d
|
|
|
2864
3007
|
}
|
|
2865
3008
|
const d = latest.current.designer;
|
|
2866
3009
|
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',
|
|
3010
|
+
const hit = kind === "down" ? _nullishCoalesce(_nullishCoalesce(backgroundAt(d.layout.meta.background, screenToWorld(c, v, p), d.ui.backgroundEditing), () => ( _optionalChain([elementAt, 'call', _108 => _108(d.layout, p, c, v), 'optionalAccess', _109 => _109.id]))), () => ( null)) : null;
|
|
2868
3011
|
const elementLocked = d.ui.armed !== null || hit !== null && hit === d.ui.seatEditId;
|
|
2869
3012
|
if (kind !== "down") {
|
|
2870
3013
|
feed({ kind, p, hitElementId: hit, elementLocked });
|
|
@@ -2925,23 +3068,22 @@ var DesignerCanvas = _react.forwardRef.call(void 0, function DesignerCanvas2({ d
|
|
|
2925
3068
|
const id = pendingFocus.current;
|
|
2926
3069
|
if (!id) return;
|
|
2927
3070
|
pendingFocus.current = null;
|
|
2928
|
-
_optionalChain([stageRef, 'access',
|
|
3071
|
+
_optionalChain([stageRef, 'access', _110 => _110.current, 'optionalAccess', _111 => _111.querySelector, 'call', _112 => _112(`[data-element-id="${id}"]`), 'optionalAccess', _113 => _113.focus, 'call', _114 => _114()]);
|
|
2929
3072
|
});
|
|
2930
3073
|
const armedName = ui.armed ? armedLabel(ui.armed, messages) : null;
|
|
2931
3074
|
const selectedEl = ui.selectedId ? layout.elements.find((e) => e.id === ui.selectedId) : void 0;
|
|
2932
3075
|
const selectedBox = _react.useMemo.call(void 0, () => {
|
|
2933
3076
|
if (viewport.width === 0) return null;
|
|
2934
|
-
const
|
|
2935
|
-
const
|
|
2936
|
-
const b = el ? elementBounds(layout, el) : null;
|
|
3077
|
+
const picked2 = ui.selection.flatMap((id) => {
|
|
3078
|
+
const b = boxes.get(id);
|
|
2937
3079
|
if (!b) return [];
|
|
2938
3080
|
const a = worldToScreen(camera, viewport, { x: b.minX, y: b.minY });
|
|
2939
3081
|
const z = worldToScreen(camera, viewport, { x: b.maxX, y: b.maxY });
|
|
2940
3082
|
const pad = 8 + (_nullishCoalesce(radii.get(id), () => ( 0))) * camera.zoom;
|
|
2941
3083
|
return [{ minX: a.x - pad, minY: a.y - pad, maxX: z.x + pad, maxY: z.y + pad }];
|
|
2942
3084
|
});
|
|
2943
|
-
return union(
|
|
2944
|
-
}, [ui.selection,
|
|
3085
|
+
return union(picked2);
|
|
3086
|
+
}, [ui.selection, boxes, camera, viewport, radii]);
|
|
2945
3087
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2946
3088
|
"div",
|
|
2947
3089
|
{
|
|
@@ -3015,7 +3157,7 @@ var DesignerCanvas = _react.forwardRef.call(void 0, function DesignerCanvas2({ d
|
|
|
3015
3157
|
return;
|
|
3016
3158
|
}
|
|
3017
3159
|
designer.dispatchUi({ type: "select", id: el.id });
|
|
3018
|
-
if (plain) _optionalChain([onPieceTap, 'optionalCall',
|
|
3160
|
+
if (plain) _optionalChain([onPieceTap, 'optionalCall', _115 => _115(el.id)]);
|
|
3019
3161
|
},
|
|
3020
3162
|
children: pieceName(el, placeTypes, messages)
|
|
3021
3163
|
},
|
|
@@ -3071,7 +3213,7 @@ function armedLabel(kind, m) {
|
|
|
3071
3213
|
if (kind === "roundTable") return m.pieceRoundTable;
|
|
3072
3214
|
if (kind === "rectTable") return m.pieceRectTable;
|
|
3073
3215
|
if (kind === "zone") return m.pieceZone;
|
|
3074
|
-
return _nullishCoalesce(_optionalChain([
|
|
3216
|
+
return _nullishCoalesce(_optionalChain([_chunkZ47OPTEPcjs.landmarkById.call(void 0, kind.slice("landmark:".length)), 'optionalAccess', _116 => _116.name]), () => ( kind));
|
|
3075
3217
|
}
|
|
3076
3218
|
function drawHints(ctx, hints, camera, viewport, color) {
|
|
3077
3219
|
const at = (x, y) => worldToScreen(camera, viewport, { x, y });
|
|
@@ -3160,6 +3302,9 @@ function violationText(v, m) {
|
|
|
3160
3302
|
return v.reason === "table" ? format(m.rejectTable, { table: v.table }) : format(m.rejectRow, { row: v.row });
|
|
3161
3303
|
}
|
|
3162
3304
|
function rejectionText(r, m) {
|
|
3305
|
+
if (r.invalid !== void 0) {
|
|
3306
|
+
return /máximo de unidades vendibles/.test(r.invalid) ? m.rejectTooManyUnits : m.rejectInvalid;
|
|
3307
|
+
}
|
|
3163
3308
|
const [over, ...moreOver] = _nullishCoalesce(r.capacity, () => ( []));
|
|
3164
3309
|
if (over) {
|
|
3165
3310
|
const head2 = format(m.rejectCapacity, { type: over.label, capacity: over.capacity, placed: over.placed });
|
|
@@ -3176,12 +3321,12 @@ function rejectionText(r, m) {
|
|
|
3176
3321
|
|
|
3177
3322
|
// ../react/src/designer/guide.ts
|
|
3178
3323
|
var overlaps = (a, b) => a.minX < b.maxX && a.maxX > b.minX && a.minY < b.maxY && a.maxY > b.minY;
|
|
3179
|
-
var
|
|
3324
|
+
var shifted2 = (b, dx, dy) => ({ minX: b.minX + dx, minY: b.minY + dy, maxX: b.maxX + dx, maxY: b.maxY + dy });
|
|
3180
3325
|
function freeSpot(box, occupied, gap = 24, rings = 12) {
|
|
3181
3326
|
const sx = box.maxX - box.minX + gap;
|
|
3182
3327
|
const sy = box.maxY - box.minY + gap;
|
|
3183
3328
|
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(
|
|
3329
|
+
const free = (dx, dy) => !padded.some((o) => overlaps(shifted2(box, dx, dy), o));
|
|
3185
3330
|
if (free(0, 0)) return { dx: 0, dy: 0 };
|
|
3186
3331
|
const dirs = [[0, 1], [1, 0], [0, -1], [-1, 0], [1, 1], [-1, 1], [1, -1], [-1, -1]];
|
|
3187
3332
|
for (let k = 1; k <= rings; k++) {
|
|
@@ -3207,7 +3352,7 @@ function anchorPanel(piece, panel, viewport, margin = 12) {
|
|
|
3207
3352
|
return docked;
|
|
3208
3353
|
}
|
|
3209
3354
|
function range(rule, count) {
|
|
3210
|
-
const labels =
|
|
3355
|
+
const labels = _chunkZ47OPTEPcjs.labelSequence.call(void 0, rule, count);
|
|
3211
3356
|
return { from: _nullishCoalesce(labels[0], () => ( "")), to: _nullishCoalesce(labels[labels.length - 1], () => ( "")) };
|
|
3212
3357
|
}
|
|
3213
3358
|
function blockRangeText(block, templates) {
|
|
@@ -3218,24 +3363,24 @@ function blockRangeText(block, templates) {
|
|
|
3218
3363
|
function reshapeBlock(block, patch) {
|
|
3219
3364
|
const next = { ...block, ...patch };
|
|
3220
3365
|
if (block.removed.length === 0) return next;
|
|
3221
|
-
const oldRows =
|
|
3222
|
-
const oldSeats =
|
|
3223
|
-
const newRows =
|
|
3224
|
-
const newSeats =
|
|
3366
|
+
const oldRows = _chunkZ47OPTEPcjs.expandLabels.call(void 0, block.rowLabels, block.rows);
|
|
3367
|
+
const oldSeats = _chunkZ47OPTEPcjs.expandLabels.call(void 0, block.seatLabels, block.cols);
|
|
3368
|
+
const newRows = _chunkZ47OPTEPcjs.expandLabels.call(void 0, next.rowLabels, next.rows);
|
|
3369
|
+
const newSeats = _chunkZ47OPTEPcjs.expandLabels.call(void 0, next.seatLabels, next.cols);
|
|
3225
3370
|
const removed = [];
|
|
3226
3371
|
for (const id of block.removed) {
|
|
3227
|
-
const [, row, seat] =
|
|
3372
|
+
const [, row, seat] = _chunkZ47OPTEPcjs.parseUnitId.call(void 0, id);
|
|
3228
3373
|
const r = row === void 0 ? -1 : oldRows.indexOf(row);
|
|
3229
3374
|
const c = seat === void 0 ? -1 : oldSeats.indexOf(seat);
|
|
3230
3375
|
if (r < 0 || c < 0 || r >= next.rows || c >= next.cols) continue;
|
|
3231
|
-
removed.push(
|
|
3376
|
+
removed.push(_chunkZ47OPTEPcjs.seatUnitId.call(void 0, block.id, newRows[r], newSeats[c]));
|
|
3232
3377
|
}
|
|
3233
3378
|
return { ...next, removed };
|
|
3234
3379
|
}
|
|
3235
3380
|
function labelStart(kind, raw, alphabet) {
|
|
3236
3381
|
const start = kind === "letters" ? raw.trim().toUpperCase() : raw.trim();
|
|
3237
3382
|
const rule = kind === "letters" && alphabet ? { kind, start, direction: "ltr", alphabet } : { kind, start, direction: "ltr" };
|
|
3238
|
-
return
|
|
3383
|
+
return _chunkZ47OPTEPcjs.labelRuleSchema.safeParse(rule).success ? start : null;
|
|
3239
3384
|
}
|
|
3240
3385
|
function switchLabelKind(rule, kind) {
|
|
3241
3386
|
if (rule.kind === kind) return rule;
|
|
@@ -3254,7 +3399,7 @@ function setLabelAlphabet(rule, alphabet) {
|
|
|
3254
3399
|
if (rule.kind !== "letters") return rule;
|
|
3255
3400
|
const { alphabet: _old, ...rest } = rule;
|
|
3256
3401
|
if (alphabet === "es") return { ...rest, alphabet };
|
|
3257
|
-
const skip = _optionalChain([rest, 'access',
|
|
3402
|
+
const skip = _optionalChain([rest, 'access', _117 => _117.skip, 'optionalAccess', _118 => _118.filter, 'call', _119 => _119((s) => !/ñ/i.test(s))]);
|
|
3258
3403
|
const { skip: _skip, ...noSkip } = rest;
|
|
3259
3404
|
return {
|
|
3260
3405
|
...skip && skip.length > 0 ? { ...noSkip, skip } : noSkip,
|
|
@@ -3280,10 +3425,10 @@ function withSkip(rule, skip) {
|
|
|
3280
3425
|
var plural = (n, one, many) => n === 1 ? one : format(many, { n });
|
|
3281
3426
|
function placeTypeStatus(option, layout, summary, m) {
|
|
3282
3427
|
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',
|
|
3428
|
+
const pieces = layout.elements.filter((e) => e.type !== "landmark" && (_optionalChain([e, 'access', _120 => _120.placeType, 'optionalAccess', _121 => _121.ref]) || null) === option.ref).length;
|
|
3429
|
+
const units = _nullishCoalesce(_optionalChain([s, 'optionalAccess', _122 => _122.units]), () => ( 0));
|
|
3285
3430
|
if (option.accepts === "zone") {
|
|
3286
|
-
const zones = _nullishCoalesce(_optionalChain([s, 'optionalAccess',
|
|
3431
|
+
const zones = _nullishCoalesce(_optionalChain([s, 'optionalAccess', _123 => _123.zones]), () => ( 0));
|
|
3287
3432
|
return {
|
|
3288
3433
|
units,
|
|
3289
3434
|
pieces,
|
|
@@ -3305,10 +3450,10 @@ function joinNames(names, m) {
|
|
|
3305
3450
|
return format(m.summaryAnd, { a: names.slice(0, -1).join(", "), b: names[names.length - 1] });
|
|
3306
3451
|
}
|
|
3307
3452
|
function missingPlaceTypes(placeTypes, summary) {
|
|
3308
|
-
return placeTypes.filter((o) => o.accepts !== "zone" && (_nullishCoalesce(_optionalChain([summary, 'access',
|
|
3453
|
+
return placeTypes.filter((o) => o.accepts !== "zone" && (_nullishCoalesce(_optionalChain([summary, 'access', _124 => _124.byRef, 'access', _125 => _125[o.ref], 'optionalAccess', _126 => _126.units]), () => ( 0))) === 0);
|
|
3309
3454
|
}
|
|
3310
3455
|
function unitsOnSale(placeTypes, summary) {
|
|
3311
|
-
return placeTypes.reduce((n, o) => o.accepts === "zone" ? n : n + (_nullishCoalesce(_optionalChain([summary, 'access',
|
|
3456
|
+
return placeTypes.reduce((n, o) => o.accepts === "zone" ? n : n + (_nullishCoalesce(_optionalChain([summary, 'access', _127 => _127.byRef, 'access', _128 => _128[o.ref], 'optionalAccess', _129 => _129.units]), () => ( 0))), 0);
|
|
3312
3457
|
}
|
|
3313
3458
|
function numberingCounts(block, m) {
|
|
3314
3459
|
const removed = block.removed.length;
|
|
@@ -3340,9 +3485,9 @@ function FloatingPanel(props) {
|
|
|
3340
3485
|
ref,
|
|
3341
3486
|
className: "vk-d-float",
|
|
3342
3487
|
"aria-labelledby": props.labelledBy,
|
|
3343
|
-
"data-docked": _optionalChain([pos, 'optionalAccess',
|
|
3488
|
+
"data-docked": _optionalChain([pos, 'optionalAccess', _130 => _130.docked]) || void 0,
|
|
3344
3489
|
"data-testid": "piece-panel",
|
|
3345
|
-
style: { width, left: _nullishCoalesce(_optionalChain([pos, 'optionalAccess',
|
|
3490
|
+
style: { width, left: _nullishCoalesce(_optionalChain([pos, 'optionalAccess', _131 => _131.left]), () => ( 0)), top: _nullishCoalesce(_optionalChain([pos, 'optionalAccess', _132 => _132.top]), () => ( 0)), visibility: pos ? "visible" : "hidden" },
|
|
3346
3491
|
children: props.children
|
|
3347
3492
|
}
|
|
3348
3493
|
);
|
|
@@ -3350,29 +3495,29 @@ function FloatingPanel(props) {
|
|
|
3350
3495
|
|
|
3351
3496
|
// ../react/src/designer/capacity.ts
|
|
3352
3497
|
function capacityRejections(before, after, placeTypes) {
|
|
3353
|
-
const over =
|
|
3498
|
+
const over = _chunkZ47OPTEPcjs.capacityViolations.call(void 0, before, after, placeTypes);
|
|
3354
3499
|
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',
|
|
3500
|
+
const was = _chunkZ47OPTEPcjs.summarize.call(void 0, before).byRef;
|
|
3501
|
+
return over.map((v) => ({ ref: v.ref, label: v.label, capacity: v.capacity, placed: _nullishCoalesce(_optionalChain([was, 'access', _133 => _133[v.ref], 'optionalAccess', _134 => _134.units]), () => ( 0)) }));
|
|
3357
3502
|
}
|
|
3358
3503
|
function placedUnits(option, summary) {
|
|
3359
|
-
return _nullishCoalesce(_optionalChain([summary, 'access',
|
|
3504
|
+
return _nullishCoalesce(_optionalChain([summary, 'access', _135 => _135.byRef, 'access', _136 => _136[option.ref], 'optionalAccess', _137 => _137.units]), () => ( 0));
|
|
3360
3505
|
}
|
|
3361
3506
|
function nextPiece(option, placed) {
|
|
3362
3507
|
if (option.accepts === "zone") return { units: 1 };
|
|
3363
|
-
if (option.accepts === "seats") return { units:
|
|
3364
|
-
const capacity =
|
|
3508
|
+
if (option.accepts === "seats") return { units: _chunkZ47OPTEPcjs.nextBlockUnits.call(void 0, option, placed) };
|
|
3509
|
+
const capacity = _chunkZ47OPTEPcjs.placeTypeCapacity.call(void 0, option);
|
|
3365
3510
|
const left = capacity === null ? Infinity : Math.max(0, capacity - placed);
|
|
3366
3511
|
if (option.accepts === "tableWhole") return { units: Math.min(1, left) };
|
|
3367
|
-
return { units: Math.min(
|
|
3512
|
+
return { units: Math.min(_chunkZ47OPTEPcjs.DEFAULT_TABLE_PLACES, left) };
|
|
3368
3513
|
}
|
|
3369
3514
|
function capacityText(option, summary, m) {
|
|
3370
|
-
const capacity =
|
|
3515
|
+
const capacity = _chunkZ47OPTEPcjs.placeTypeCapacity.call(void 0, option);
|
|
3371
3516
|
if (capacity === null || option.accepts === "zone") return null;
|
|
3372
3517
|
return format(m.capacityCount, { placed: placedUnits(option, summary), capacity });
|
|
3373
3518
|
}
|
|
3374
3519
|
function capacityFullText(option, summary, m) {
|
|
3375
|
-
const capacity =
|
|
3520
|
+
const capacity = _chunkZ47OPTEPcjs.placeTypeCapacity.call(void 0, option);
|
|
3376
3521
|
if (capacity === null || option.accepts === "zone") return null;
|
|
3377
3522
|
const placed = placedUnits(option, summary);
|
|
3378
3523
|
if (placed > capacity) return format(m.capacityOver, { over: placed - capacity, capacity, name: option.label });
|
|
@@ -3380,20 +3525,20 @@ function capacityFullText(option, summary, m) {
|
|
|
3380
3525
|
return format(m.capacityFull, { capacity, name: option.label });
|
|
3381
3526
|
}
|
|
3382
3527
|
function overCapacity(option, summary) {
|
|
3383
|
-
const capacity =
|
|
3528
|
+
const capacity = _chunkZ47OPTEPcjs.placeTypeCapacity.call(void 0, option);
|
|
3384
3529
|
if (capacity === null || option.accepts === "zone") return 0;
|
|
3385
3530
|
return Math.max(0, placedUnits(option, summary) - capacity);
|
|
3386
3531
|
}
|
|
3387
3532
|
function trimPlan(layout, option, locked) {
|
|
3388
|
-
let left = overCapacity(option,
|
|
3533
|
+
let left = overCapacity(option, _chunkZ47OPTEPcjs.summarize.call(void 0, layout));
|
|
3389
3534
|
if (left === 0) return null;
|
|
3390
3535
|
const commands = [];
|
|
3391
3536
|
let removed = 0;
|
|
3392
3537
|
for (let i = layout.elements.length - 1; i >= 0 && left > 0; i--) {
|
|
3393
3538
|
const el = layout.elements[i];
|
|
3394
|
-
if (el.type === "landmark" || el.type === "zone" || (_optionalChain([el, 'access',
|
|
3539
|
+
if (el.type === "landmark" || el.type === "zone" || (_optionalChain([el, 'access', _138 => _138.placeType, 'optionalAccess', _139 => _139.ref]) || null) !== option.ref) continue;
|
|
3395
3540
|
if (el.type === "seatBlock") {
|
|
3396
|
-
const units =
|
|
3541
|
+
const units = _chunkZ47OPTEPcjs.expandSeatBlock.call(void 0, el);
|
|
3397
3542
|
const take = units.filter((u) => !locked.has(u.id)).sort((a, b) => b.rowIndex - a.rowIndex || b.colIndex - a.colIndex).slice(0, left);
|
|
3398
3543
|
if (take.length === 0) continue;
|
|
3399
3544
|
commands.push(
|
|
@@ -3408,7 +3553,7 @@ function trimPlan(layout, option, locked) {
|
|
|
3408
3553
|
left--;
|
|
3409
3554
|
} else {
|
|
3410
3555
|
let lastLocked = 0;
|
|
3411
|
-
for (let n = 1; n <= el.places; n++) if (locked.has(
|
|
3556
|
+
for (let n = 1; n <= el.places; n++) if (locked.has(_chunkZ47OPTEPcjs.placeUnitId.call(void 0, el.id, n))) lastLocked = n;
|
|
3412
3557
|
if (lastLocked === 0 && left >= el.places) {
|
|
3413
3558
|
commands.push({ type: "removeElement", id: el.id });
|
|
3414
3559
|
removed += el.places;
|
|
@@ -3429,7 +3574,7 @@ function trimPlan(layout, option, locked) {
|
|
|
3429
3574
|
function piecesByRef(layout) {
|
|
3430
3575
|
const out = {};
|
|
3431
3576
|
for (const el of layout.elements) {
|
|
3432
|
-
const ref = el.type === "landmark" ? "" : _optionalChain([el, 'access',
|
|
3577
|
+
const ref = el.type === "landmark" ? "" : _optionalChain([el, 'access', _140 => _140.placeType, 'optionalAccess', _141 => _141.ref]) || "";
|
|
3433
3578
|
if (ref) out[ref] = (_nullishCoalesce(out[ref], () => ( 0))) + 1;
|
|
3434
3579
|
}
|
|
3435
3580
|
return out;
|
|
@@ -3442,8 +3587,8 @@ function hostReads(placeTypes, summary, pieces, m) {
|
|
|
3442
3587
|
return o ? nextPiece(o, placedUnits(o, summary)).units : 0;
|
|
3443
3588
|
},
|
|
3444
3589
|
placed: (ref) => ({
|
|
3445
|
-
units: _nullishCoalesce(_optionalChain([summary, 'access',
|
|
3446
|
-
zones: _nullishCoalesce(_optionalChain([summary, 'access',
|
|
3590
|
+
units: _nullishCoalesce(_optionalChain([summary, 'access', _142 => _142.byRef, 'access', _143 => _143[ref], 'optionalAccess', _144 => _144.units]), () => ( 0)),
|
|
3591
|
+
zones: _nullishCoalesce(_optionalChain([summary, 'access', _145 => _145.byRef, 'access', _146 => _146[ref], 'optionalAccess', _147 => _147.zones]), () => ( 0)),
|
|
3447
3592
|
pieces: _nullishCoalesce(pieces[ref], () => ( 0))
|
|
3448
3593
|
}),
|
|
3449
3594
|
capacityText: (ref) => {
|
|
@@ -3482,17 +3627,17 @@ function syncPlaceTypes(layout, previous, placeTypes) {
|
|
|
3482
3627
|
const before = new Set(previous.map((o) => o.ref));
|
|
3483
3628
|
let changed = false;
|
|
3484
3629
|
const elements = layout.elements.map((el) => {
|
|
3485
|
-
if (el.type === "landmark" || !_optionalChain([el, 'access',
|
|
3630
|
+
if (el.type === "landmark" || !_optionalChain([el, 'access', _148 => _148.placeType, 'optionalAccess', _149 => _149.ref])) return el;
|
|
3486
3631
|
const option = byRef.get(el.placeType.ref);
|
|
3487
3632
|
if (!option && !before.has(el.placeType.ref)) return el;
|
|
3488
|
-
if (!option || !
|
|
3633
|
+
if (!option || !_chunkZ47OPTEPcjs.canAssign.call(void 0, el, option)) {
|
|
3489
3634
|
changed = true;
|
|
3490
3635
|
return { ...el, placeType: { ref: "", name: el.placeType.name } };
|
|
3491
3636
|
}
|
|
3492
3637
|
const mode = option.accepts === "tablePerPlace" ? "perPlace" : "whole";
|
|
3493
3638
|
if (el.placeType.name === option.label && (el.type !== "table" || el.mode === mode)) return el;
|
|
3494
3639
|
changed = true;
|
|
3495
|
-
return
|
|
3640
|
+
return _chunkZ47OPTEPcjs.assignPlaceType.call(void 0, el, option);
|
|
3496
3641
|
});
|
|
3497
3642
|
return changed ? { ...layout, elements } : layout;
|
|
3498
3643
|
}
|
|
@@ -3646,7 +3791,7 @@ function LandmarkPicker({ messages: m, onPick }) {
|
|
|
3646
3791
|
const groups = LANDMARK_GROUPS.map(({ group, key }) => ({
|
|
3647
3792
|
group,
|
|
3648
3793
|
title: m[key],
|
|
3649
|
-
items:
|
|
3794
|
+
items: _chunkZ47OPTEPcjs.landmarks.filter((l) => l.group === group && (q === "" || fold(l.name).includes(q)))
|
|
3650
3795
|
})).filter((g) => g.items.length > 0);
|
|
3651
3796
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "vk-d-landmarks", children: [
|
|
3652
3797
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "label", { className: "vk-d-search", htmlFor: searchId, children: [
|
|
@@ -3851,6 +3996,8 @@ var designerEs = {
|
|
|
3851
3996
|
trimToCapacityLabel: "Sacar los {over} lugares que sobran de {name}",
|
|
3852
3997
|
trimPartial: "Quedan {n} de m\xE1s que no se pueden sacar: ya est\xE1n vendidos o reservados.",
|
|
3853
3998
|
rejectCapacity: "{type} tiene {capacity} lugares y ya ubicaste {placed}.",
|
|
3999
|
+
rejectInvalid: "No se pudo hacer ese cambio: la pieza quedar\xEDa demasiado grande o fuera del plano.",
|
|
4000
|
+
rejectTooManyUnits: "No se pudo hacer ese cambio: un plano puede tener hasta 100.000 lugares.",
|
|
3854
4001
|
zonesTitle: "Tus entradas generales",
|
|
3855
4002
|
zonesHint: "Si quer\xE9s, marc\xE1 en el plano d\xF3nde queda cada una. Quien compra la toca en el mapa.",
|
|
3856
4003
|
acceptsZone: "Entrada general",
|
|
@@ -4069,6 +4216,8 @@ var designerEn = {
|
|
|
4069
4216
|
trimToCapacityLabel: "Remove the {over} extra spots of {name}",
|
|
4070
4217
|
trimPartial: "{n} extra spots can't be removed: they are already sold or held.",
|
|
4071
4218
|
rejectCapacity: "{type} has {capacity} spots and you've already placed {placed}.",
|
|
4219
|
+
rejectInvalid: "That change couldn't be made: the piece would be too big or off the plan.",
|
|
4220
|
+
rejectTooManyUnits: "That change couldn't be made: a plan can have up to 100,000 spots.",
|
|
4072
4221
|
zonesTitle: "Your general admission tickets",
|
|
4073
4222
|
zonesHint: "If you want, mark on the plan where each one is. Buyers tap it on the map.",
|
|
4074
4223
|
acceptsZone: "General admission",
|
|
@@ -4171,13 +4320,13 @@ function SizeStepper(props) {
|
|
|
4171
4320
|
const { piece, messages: m } = props;
|
|
4172
4321
|
const scale = _nullishCoalesce(piece.scale, () => ( 1));
|
|
4173
4322
|
const id = _react.useId.call(void 0, );
|
|
4174
|
-
const set = (direction) => props.onRun({ type: "replaceElement", element:
|
|
4323
|
+
const set = (direction) => props.onRun({ type: "replaceElement", element: _chunkZ47OPTEPcjs.scalePiece.call(void 0, piece, steppedScale(scale, direction)) });
|
|
4175
4324
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "vk-d-field", role: "group", "aria-labelledby": id, children: [
|
|
4176
4325
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { id, children: m.pieceSize }),
|
|
4177
4326
|
/* @__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 <=
|
|
4327
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "button", { type: "button", "aria-label": m.sizeLess, disabled: scale <= _chunkZ47OPTEPcjs.MIN_SCALE, onClick: () => set(-1), children: "\u2212" }),
|
|
4179
4328
|
/* @__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 >=
|
|
4329
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "button", { type: "button", "aria-label": m.sizeMore, disabled: scale >= _chunkZ47OPTEPcjs.MAX_SCALE, onClick: () => set(1), children: "+" })
|
|
4181
4330
|
] })
|
|
4182
4331
|
] });
|
|
4183
4332
|
}
|
|
@@ -4222,12 +4371,12 @@ var ZONE_MAX = 4e3;
|
|
|
4222
4371
|
var ZONE_STEP = 20;
|
|
4223
4372
|
function pieceHeading(el, placeTypes, m) {
|
|
4224
4373
|
if (el.type === "landmark") return { color: null, text: el.name };
|
|
4225
|
-
const ref = _optionalChain([el, 'access',
|
|
4374
|
+
const ref = _optionalChain([el, 'access', _150 => _150.placeType, 'optionalAccess', _151 => _151.ref]) || null;
|
|
4226
4375
|
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',
|
|
4376
|
+
const name = _nullishCoalesce(_optionalChain([option, 'optionalAccess', _152 => _152.label]), () => ( m.unassigned));
|
|
4377
|
+
if (el.type === "zone") return { color: _nullishCoalesce(_optionalChain([option, 'optionalAccess', _153 => _153.color]), () => ( null)), text: name };
|
|
4378
|
+
const count = el.type === "seatBlock" ? plural2(_chunkZ47OPTEPcjs.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);
|
|
4379
|
+
return { color: _nullishCoalesce(_optionalChain([option, 'optionalAccess', _154 => _154.color]), () => ( null)), text: `${name} \xB7 ${count}` };
|
|
4231
4380
|
}
|
|
4232
4381
|
function PieceInspector(props) {
|
|
4233
4382
|
const { element: el, messages: m } = props;
|
|
@@ -4245,8 +4394,8 @@ function PieceInspector(props) {
|
|
|
4245
4394
|
setLabelError(null);
|
|
4246
4395
|
patch("label", label, `label:${el.id}`);
|
|
4247
4396
|
};
|
|
4248
|
-
const assigned = el.type !== "landmark" && !!_optionalChain([el, 'access',
|
|
4249
|
-
const options = el.type === "landmark" ? [] : props.placeTypes.filter((o) =>
|
|
4397
|
+
const assigned = el.type !== "landmark" && !!_optionalChain([el, 'access', _155 => _155.placeType, 'optionalAccess', _156 => _156.ref]);
|
|
4398
|
+
const options = el.type === "landmark" ? [] : props.placeTypes.filter((o) => _chunkZ47OPTEPcjs.canAssign.call(void 0, el, o));
|
|
4250
4399
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "vk-d-inspector", children: [
|
|
4251
4400
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "vk-d-insp-head", children: [
|
|
4252
4401
|
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 +4449,7 @@ function PieceInspector(props) {
|
|
|
4300
4449
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, SizeStepper, { piece: el, messages: m, onRun: props.onRun })
|
|
4301
4450
|
] }),
|
|
4302
4451
|
el.type === "table" && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
4303
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, TextField, { label: m.tableNumber, maxLength:
|
|
4452
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, TextField, { label: m.tableNumber, maxLength: _chunkZ47OPTEPcjs.MAX_TABLE_LABEL_LENGTH, value: el.label, onCommit: tableLabelCommit }),
|
|
4304
4453
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4305
4454
|
Stepper,
|
|
4306
4455
|
{
|
|
@@ -4365,7 +4514,7 @@ function PieceInspector(props) {
|
|
|
4365
4514
|
] }),
|
|
4366
4515
|
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
4516
|
] }, el.id),
|
|
4368
|
-
_optionalChain([labelError, 'optionalAccess',
|
|
4517
|
+
_optionalChain([labelError, 'optionalAccess', _157 => _157.id]) === el.id && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "vk-d-error", role: "alert", children: labelError.text }),
|
|
4369
4518
|
el.type === "seatBlock" && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "vk-d-insp-foot", children: [
|
|
4370
4519
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { "data-testid": "block-range", children: blockRangeText(el, { many: m.blockRange, one: m.blockRangeOneRow }) }),
|
|
4371
4520
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "button", { type: "button", className: "vk-d-link", "aria-haspopup": "dialog", onClick: props.onNumbering, children: m.numbering })
|
|
@@ -4432,12 +4581,12 @@ function NumberingDialog(props) {
|
|
|
4432
4581
|
const m = props.messages;
|
|
4433
4582
|
const [draft, setDraft] = _react.useState.call(void 0, props.block);
|
|
4434
4583
|
const [failed, setFailed] = _react.useState.call(void 0, false);
|
|
4435
|
-
const rowLabels =
|
|
4436
|
-
const seatLabels =
|
|
4584
|
+
const rowLabels = _chunkZ47OPTEPcjs.expandLabels.call(void 0, draft.rowLabels, draft.rows);
|
|
4585
|
+
const seatLabels = _chunkZ47OPTEPcjs.expandLabels.call(void 0, draft.seatLabels, draft.cols);
|
|
4437
4586
|
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(
|
|
4587
|
+
const origRows = _chunkZ47OPTEPcjs.expandLabels.call(void 0, props.block.rowLabels, props.block.rows);
|
|
4588
|
+
const origSeats = _chunkZ47OPTEPcjs.expandLabels.call(void 0, props.block.seatLabels, props.block.cols);
|
|
4589
|
+
const soldAt = (r, c) => r < origRows.length && c < origSeats.length && props.lockedUnitIds.has(_chunkZ47OPTEPcjs.seatUnitId.call(void 0, props.block.id, origRows[r], origSeats[c]));
|
|
4441
4590
|
const tooBig = draft.rows * draft.cols > MAX_PREVIEW_SEATS;
|
|
4442
4591
|
const pattern = draft.seatLabels.kind === "numbers" ? _nullishCoalesce(draft.seatLabels.pattern, () => ( "sequential")) : "sequential";
|
|
4443
4592
|
const patternId = _react.useId.call(void 0, );
|
|
@@ -4459,7 +4608,7 @@ function NumberingDialog(props) {
|
|
|
4459
4608
|
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
4609
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "vk-d-num-label", "aria-hidden": "true", children: row }),
|
|
4461
4610
|
seatLabels.map((seat, c) => {
|
|
4462
|
-
const id =
|
|
4611
|
+
const id = _chunkZ47OPTEPcjs.seatUnitId.call(void 0, draft.id, row, seat);
|
|
4463
4612
|
const sold = soldAt(r, c) && !removed.has(id);
|
|
4464
4613
|
const out = removed.has(id);
|
|
4465
4614
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -4474,7 +4623,7 @@ function NumberingDialog(props) {
|
|
|
4474
4623
|
"aria-label": format(sold ? m.seatNameSold : out ? m.seatNameRemoved : m.seatName, { row, seat }),
|
|
4475
4624
|
onClick: () => {
|
|
4476
4625
|
setFailed(false);
|
|
4477
|
-
setDraft((d) =>
|
|
4626
|
+
setDraft((d) => _chunkZ47OPTEPcjs.toggleRemovedSeat.call(void 0, d, id));
|
|
4478
4627
|
},
|
|
4479
4628
|
children: seat
|
|
4480
4629
|
},
|
|
@@ -4613,7 +4762,7 @@ function listOf(items, m) {
|
|
|
4613
4762
|
function duplicateWarnings(placeTypes, summary, m) {
|
|
4614
4763
|
const out = [];
|
|
4615
4764
|
for (const o of placeTypes) {
|
|
4616
|
-
const d = _optionalChain([summary, 'access',
|
|
4765
|
+
const d = _optionalChain([summary, 'access', _158 => _158.byRef, 'access', _159 => _159[o.ref], 'optionalAccess', _160 => _160.duplicates]);
|
|
4617
4766
|
if (!d) continue;
|
|
4618
4767
|
if (d.seats.length > 0) {
|
|
4619
4768
|
const items = d.seats.map((s) => {
|
|
@@ -4665,10 +4814,10 @@ function PlaceTypePanel(props) {
|
|
|
4665
4814
|
const capped = capacityText(o, summary, m);
|
|
4666
4815
|
const fullText = capacityFullText(o, summary, m);
|
|
4667
4816
|
const done = fullText !== null;
|
|
4668
|
-
const cap =
|
|
4817
|
+
const cap = _chunkZ47OPTEPcjs.placeTypeCapacity.call(void 0, o);
|
|
4669
4818
|
const over = cap !== null && placedUnits(o, summary) > cap;
|
|
4670
4819
|
const excess = over ? overCapacity(o, summary) : 0;
|
|
4671
|
-
const trimmable = excess > 0 && props.onTrim ? _nullishCoalesce(_optionalChain([trimPlan, 'call',
|
|
4820
|
+
const trimmable = excess > 0 && props.onTrim ? _nullishCoalesce(_optionalChain([trimPlan, 'call', _161 => _161(props.layout, o, _nullishCoalesce(props.lockedUnitIds, () => ( NOTHING))), 'optionalAccess', _162 => _162.removed]), () => ( 0)) : 0;
|
|
4672
4821
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
4673
4822
|
"li",
|
|
4674
4823
|
{
|
|
@@ -4698,7 +4847,7 @@ function PlaceTypePanel(props) {
|
|
|
4698
4847
|
className: "vk-d-btn vk-d-trim",
|
|
4699
4848
|
"data-testid": "capacity-trim",
|
|
4700
4849
|
"aria-label": format(m.trimToCapacityLabel, { over: trimmable, name: o.label }),
|
|
4701
|
-
onClick: () => _optionalChain([props, 'access',
|
|
4850
|
+
onClick: () => _optionalChain([props, 'access', _163 => _163.onTrim, 'optionalCall', _164 => _164(o)]),
|
|
4702
4851
|
children: m.trimToCapacity
|
|
4703
4852
|
}
|
|
4704
4853
|
),
|
|
@@ -4756,18 +4905,18 @@ function Popover({ title, onClose, anchorRef, children, className }) {
|
|
|
4756
4905
|
const close = _react.useRef.call(void 0, onClose);
|
|
4757
4906
|
close.current = onClose;
|
|
4758
4907
|
_react.useEffect.call(void 0, () => {
|
|
4759
|
-
const first = _optionalChain([ref, 'access',
|
|
4760
|
-
_optionalChain([(_nullishCoalesce(first, () => ( ref.current))), 'optionalAccess',
|
|
4908
|
+
const first = _optionalChain([ref, 'access', _165 => _165.current, 'optionalAccess', _166 => _166.querySelector, 'call', _167 => _167("input, button, select, [href]")]);
|
|
4909
|
+
_optionalChain([(_nullishCoalesce(first, () => ( ref.current))), 'optionalAccess', _168 => _168.focus, 'call', _169 => _169()]);
|
|
4761
4910
|
const onDown = (e) => {
|
|
4762
4911
|
const t = e.target;
|
|
4763
|
-
if (_optionalChain([ref, 'access',
|
|
4912
|
+
if (_optionalChain([ref, 'access', _170 => _170.current, 'optionalAccess', _171 => _171.contains, 'call', _172 => _172(t)]) || _optionalChain([anchorRef, 'access', _173 => _173.current, 'optionalAccess', _174 => _174.contains, 'call', _175 => _175(t)])) return;
|
|
4764
4913
|
close.current();
|
|
4765
4914
|
};
|
|
4766
4915
|
document.addEventListener("pointerdown", onDown);
|
|
4767
4916
|
const anchor = anchorRef.current;
|
|
4768
4917
|
return () => {
|
|
4769
4918
|
document.removeEventListener("pointerdown", onDown);
|
|
4770
|
-
if (_optionalChain([anchor, 'optionalAccess',
|
|
4919
|
+
if (_optionalChain([anchor, 'optionalAccess', _176 => _176.isConnected]) && (!document.activeElement || document.activeElement === document.body)) anchor.focus();
|
|
4771
4920
|
};
|
|
4772
4921
|
}, [anchorRef]);
|
|
4773
4922
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
@@ -4781,7 +4930,7 @@ function Popover({ title, onClose, anchorRef, children, className }) {
|
|
|
4781
4930
|
onKeyDown: (e) => {
|
|
4782
4931
|
if (e.key === "Escape") {
|
|
4783
4932
|
e.stopPropagation();
|
|
4784
|
-
_optionalChain([anchorRef, 'access',
|
|
4933
|
+
_optionalChain([anchorRef, 'access', _177 => _177.current, 'optionalAccess', _178 => _178.focus, 'call', _179 => _179()]);
|
|
4785
4934
|
close.current();
|
|
4786
4935
|
}
|
|
4787
4936
|
},
|
|
@@ -4862,9 +5011,9 @@ function Sheet({
|
|
|
4862
5011
|
if (!shown) return;
|
|
4863
5012
|
const active = document.activeElement instanceof HTMLElement && document.activeElement !== document.body ? document.activeElement : null;
|
|
4864
5013
|
const opener = _nullishCoalesce(returnTo.current, () => ( active));
|
|
4865
|
-
_optionalChain([panelRef, 'access',
|
|
5014
|
+
_optionalChain([panelRef, 'access', _180 => _180.current, 'optionalAccess', _181 => _181.focus, 'call', _182 => _182()]);
|
|
4866
5015
|
return () => {
|
|
4867
|
-
if (_optionalChain([opener, 'optionalAccess',
|
|
5016
|
+
if (_optionalChain([opener, 'optionalAccess', _183 => _183.isConnected])) opener.focus();
|
|
4868
5017
|
};
|
|
4869
5018
|
}, [shown]);
|
|
4870
5019
|
const onKeyDown = (e) => {
|
|
@@ -5245,12 +5394,12 @@ function TopBar(props) {
|
|
|
5245
5394
|
function guardedStep(history, step, locked) {
|
|
5246
5395
|
const candidate = step === "undo" ? history.peekUndo() : history.peekRedo();
|
|
5247
5396
|
if (!candidate) return null;
|
|
5248
|
-
const violations =
|
|
5397
|
+
const violations = _chunkZ47OPTEPcjs.findLockViolations.call(void 0, history.present, candidate, locked);
|
|
5249
5398
|
if (violations.length > 0) return { ok: false, rejection: { violations } };
|
|
5250
5399
|
return { ok: true, layout: step === "undo" ? history.undo() : history.redo() };
|
|
5251
5400
|
}
|
|
5252
5401
|
function guardedLoad(history, next, locked, placeTypes = []) {
|
|
5253
|
-
const violations =
|
|
5402
|
+
const violations = _chunkZ47OPTEPcjs.findLockViolations.call(void 0, history.present, next, locked);
|
|
5254
5403
|
if (violations.length > 0) return { ok: false, rejection: { violations } };
|
|
5255
5404
|
const capacity = capacityRejections(history.present, next, placeTypes);
|
|
5256
5405
|
if (capacity.length > 0) return { ok: false, rejection: { violations: [], capacity } };
|
|
@@ -5273,7 +5422,8 @@ function elementPrefix(el) {
|
|
|
5273
5422
|
return el.type === "seatBlock" ? "b" : el.type === "table" ? "m" : el.type === "zone" ? "z" : "r";
|
|
5274
5423
|
}
|
|
5275
5424
|
function useDesigner({ initial, lockedUnitIds, onChange, placeTypes }) {
|
|
5276
|
-
const
|
|
5425
|
+
const [history] = _react.useState.call(void 0, () => new (0, _chunkZ47OPTEPcjs.History)(initial));
|
|
5426
|
+
const historyRef = _react.useRef.call(void 0, history);
|
|
5277
5427
|
const [layout, setLayout] = _react.useState.call(void 0, initial);
|
|
5278
5428
|
const [rejection, setRejectionState] = _react.useState.call(void 0, null);
|
|
5279
5429
|
const [rejectionSeq, setRejectionSeq] = _react.useState.call(void 0, 0);
|
|
@@ -5289,7 +5439,7 @@ function useDesigner({ initial, lockedUnitIds, onChange, placeTypes }) {
|
|
|
5289
5439
|
(next) => {
|
|
5290
5440
|
setLayout(next);
|
|
5291
5441
|
setRejection(null);
|
|
5292
|
-
_optionalChain([onChange, 'optionalCall',
|
|
5442
|
+
_optionalChain([onChange, 'optionalCall', _184 => _184(next)]);
|
|
5293
5443
|
},
|
|
5294
5444
|
[onChange, setRejection]
|
|
5295
5445
|
);
|
|
@@ -5300,31 +5450,33 @@ function useDesigner({ initial, lockedUnitIds, onChange, placeTypes }) {
|
|
|
5300
5450
|
const previous = seenTypes.current.list;
|
|
5301
5451
|
const next = placeTypesRef.current;
|
|
5302
5452
|
seenTypes.current = { key: typesKey, list: next };
|
|
5303
|
-
const
|
|
5304
|
-
const before =
|
|
5305
|
-
|
|
5306
|
-
if (
|
|
5453
|
+
const history2 = historyRef.current;
|
|
5454
|
+
const before = history2.present;
|
|
5455
|
+
history2.rewrite((l) => syncPlaceTypes(l, previous, next));
|
|
5456
|
+
if (history2.present !== before) commit(history2.present);
|
|
5307
5457
|
}, [typesKey, commit]);
|
|
5308
5458
|
const run = _react.useCallback.call(void 0,
|
|
5309
5459
|
(command, key) => {
|
|
5310
5460
|
const before = historyRef.current.present;
|
|
5311
5461
|
let candidate;
|
|
5312
5462
|
try {
|
|
5313
|
-
candidate =
|
|
5314
|
-
} catch (
|
|
5463
|
+
candidate = _chunkZ47OPTEPcjs.applyCommand.call(void 0, before, command);
|
|
5464
|
+
} catch (error) {
|
|
5465
|
+
setRejection({ violations: [], invalid: error instanceof Error ? error.message : String(error) });
|
|
5315
5466
|
return false;
|
|
5316
5467
|
}
|
|
5317
|
-
const
|
|
5468
|
+
const moveOnly = keepsCount(command);
|
|
5469
|
+
const violations = moveOnly ? [] : _chunkZ47OPTEPcjs.findLockViolations.call(void 0, before, candidate, locked);
|
|
5318
5470
|
if (violations.length > 0) {
|
|
5319
5471
|
setRejection({ violations });
|
|
5320
5472
|
return false;
|
|
5321
5473
|
}
|
|
5322
|
-
const capacity =
|
|
5474
|
+
const capacity = moveOnly ? [] : capacityRejections(before, candidate, placeTypesRef.current);
|
|
5323
5475
|
if (capacity.length > 0) {
|
|
5324
5476
|
setRejection({ violations: [], capacity });
|
|
5325
5477
|
return false;
|
|
5326
5478
|
}
|
|
5327
|
-
commit(historyRef.current.
|
|
5479
|
+
commit(historyRef.current.commit(candidate, key));
|
|
5328
5480
|
return true;
|
|
5329
5481
|
},
|
|
5330
5482
|
[locked, commit, setRejection]
|
|
@@ -5333,8 +5485,8 @@ function useDesigner({ initial, lockedUnitIds, onChange, placeTypes }) {
|
|
|
5333
5485
|
const place = _react.useCallback.call(void 0,
|
|
5334
5486
|
(kind, at) => {
|
|
5335
5487
|
const current = historyRef.current.present;
|
|
5336
|
-
const id =
|
|
5337
|
-
if (!run({ type: "addElement", element:
|
|
5488
|
+
const id = _chunkZ47OPTEPcjs.newElementId.call(void 0, current, idPrefix(kind));
|
|
5489
|
+
if (!run({ type: "addElement", element: _chunkZ47OPTEPcjs.createPiece.call(void 0, kind, id, at, current) })) return null;
|
|
5338
5490
|
dispatchUi({ type: "select", id });
|
|
5339
5491
|
return id;
|
|
5340
5492
|
},
|
|
@@ -5343,10 +5495,10 @@ function useDesigner({ initial, lockedUnitIds, onChange, placeTypes }) {
|
|
|
5343
5495
|
const addFor = _react.useCallback.call(void 0,
|
|
5344
5496
|
(kind, option, near, opts = {}) => {
|
|
5345
5497
|
const current = historyRef.current.present;
|
|
5346
|
-
const id =
|
|
5347
|
-
let piece =
|
|
5498
|
+
const id = _chunkZ47OPTEPcjs.newElementId.call(void 0, current, idPrefix(kind));
|
|
5499
|
+
let piece = _chunkZ47OPTEPcjs.createPiece.call(void 0, kind, id, near, current, opts.seats === void 0 ? {} : { seats: opts.seats });
|
|
5348
5500
|
if (piece.type === "table" && opts.places !== void 0) piece = { ...piece, places: opts.places };
|
|
5349
|
-
if (option && piece.type !== "landmark" &&
|
|
5501
|
+
if (option && piece.type !== "landmark" && _chunkZ47OPTEPcjs.canAssign.call(void 0, piece, option)) piece = _chunkZ47OPTEPcjs.assignPlaceType.call(void 0, piece, option);
|
|
5350
5502
|
const own = elementBounds({ ...current, elements: [...current.elements, piece] }, piece);
|
|
5351
5503
|
if (own) {
|
|
5352
5504
|
const occupied = current.elements.flatMap((e) => _nullishCoalesce(elementBounds(current, e), () => ( [])));
|
|
@@ -5364,8 +5516,8 @@ function useDesigner({ initial, lockedUnitIds, onChange, placeTypes }) {
|
|
|
5364
5516
|
const el = find(id);
|
|
5365
5517
|
if (!el) return;
|
|
5366
5518
|
const current = historyRef.current.present;
|
|
5367
|
-
const newId =
|
|
5368
|
-
if (run({ type: "addElement", element:
|
|
5519
|
+
const newId = _chunkZ47OPTEPcjs.newElementId.call(void 0, current, elementPrefix(el));
|
|
5520
|
+
if (run({ type: "addElement", element: _chunkZ47OPTEPcjs.duplicatePiece.call(void 0, el, newId, current) })) {
|
|
5369
5521
|
dispatchUi({ type: "select", id: newId });
|
|
5370
5522
|
}
|
|
5371
5523
|
},
|
|
@@ -5374,7 +5526,7 @@ function useDesigner({ initial, lockedUnitIds, onChange, placeTypes }) {
|
|
|
5374
5526
|
const rotate = _react.useCallback.call(void 0,
|
|
5375
5527
|
(id) => {
|
|
5376
5528
|
const el = find(id);
|
|
5377
|
-
if (el) run({ type: "replaceElement", element:
|
|
5529
|
+
if (el) run({ type: "replaceElement", element: _chunkZ47OPTEPcjs.rotatePiece.call(void 0, el) });
|
|
5378
5530
|
},
|
|
5379
5531
|
[run]
|
|
5380
5532
|
);
|
|
@@ -5409,7 +5561,7 @@ function useDesigner({ initial, lockedUnitIds, onChange, placeTypes }) {
|
|
|
5409
5561
|
for (const id of ids) {
|
|
5410
5562
|
const el = current.elements.find((e) => e.id === id);
|
|
5411
5563
|
if (!el) continue;
|
|
5412
|
-
const copy =
|
|
5564
|
+
const copy = _chunkZ47OPTEPcjs.duplicatePiece.call(void 0, el, _chunkZ47OPTEPcjs.newElementId.call(void 0, current, elementPrefix(el)), current);
|
|
5413
5565
|
current = { ...current, elements: [...current.elements, copy] };
|
|
5414
5566
|
commands.push({ type: "addElement", element: copy });
|
|
5415
5567
|
created.push(copy.id);
|
|
@@ -5435,7 +5587,7 @@ function useDesigner({ initial, lockedUnitIds, onChange, placeTypes }) {
|
|
|
5435
5587
|
const toggleSeat = _react.useCallback.call(void 0,
|
|
5436
5588
|
(blockId, unitId) => {
|
|
5437
5589
|
const el = find(blockId);
|
|
5438
|
-
if (_optionalChain([el, 'optionalAccess',
|
|
5590
|
+
if (_optionalChain([el, 'optionalAccess', _185 => _185.type]) === "seatBlock") run({ type: "replaceElement", element: _chunkZ47OPTEPcjs.toggleRemovedSeat.call(void 0, el, unitId) });
|
|
5439
5591
|
},
|
|
5440
5592
|
[run]
|
|
5441
5593
|
);
|
|
@@ -5443,8 +5595,8 @@ function useDesigner({ initial, lockedUnitIds, onChange, placeTypes }) {
|
|
|
5443
5595
|
(id, option) => {
|
|
5444
5596
|
const el = find(id);
|
|
5445
5597
|
if (!el || el.type === "landmark") return;
|
|
5446
|
-
if (option && !
|
|
5447
|
-
run({ type: "replaceElement", element:
|
|
5598
|
+
if (option && !_chunkZ47OPTEPcjs.canAssign.call(void 0, el, option)) return;
|
|
5599
|
+
run({ type: "replaceElement", element: _chunkZ47OPTEPcjs.assignPlaceType.call(void 0, el, option) });
|
|
5448
5600
|
},
|
|
5449
5601
|
[run]
|
|
5450
5602
|
);
|
|
@@ -5510,7 +5662,7 @@ function useDesigner({ initial, lockedUnitIds, onChange, placeTypes }) {
|
|
|
5510
5662
|
var NOTHING_LOCKED = /* @__PURE__ */ new Set();
|
|
5511
5663
|
function blankLayout(name) {
|
|
5512
5664
|
return {
|
|
5513
|
-
meta: { id: "plan", name, version:
|
|
5665
|
+
meta: { id: "plan", name, version: _chunkZ47OPTEPcjs.CURRENT_VERSION, width: 1200, height: 800, background: null },
|
|
5514
5666
|
elements: []
|
|
5515
5667
|
};
|
|
5516
5668
|
}
|
|
@@ -5534,13 +5686,13 @@ function VenueDesigner(props) {
|
|
|
5534
5686
|
const loadingExternal = _react.useRef.call(void 0, false);
|
|
5535
5687
|
const onChange = _react.useCallback.call(void 0, (layout2) => {
|
|
5536
5688
|
lastEmitted.current = layout2;
|
|
5537
|
-
if (!loadingExternal.current) _optionalChain([onChangeRef, 'access',
|
|
5689
|
+
if (!loadingExternal.current) _optionalChain([onChangeRef, 'access', _186 => _186.current, 'optionalCall', _187 => _187(layout2)]);
|
|
5538
5690
|
}, []);
|
|
5539
5691
|
const designer = useDesigner({ initial, lockedUnitIds: locked, onChange, placeTypes: props.placeTypes });
|
|
5540
5692
|
const { layout, ui, dispatchUi } = designer;
|
|
5541
5693
|
const messages = _react.useMemo.call(void 0, () => mergeDesignerMessages(props.messages), [props.messages]);
|
|
5542
5694
|
const m = messages;
|
|
5543
|
-
const summary = _react.useMemo.call(void 0, () =>
|
|
5695
|
+
const summary = _react.useMemo.call(void 0, () => _chunkZ47OPTEPcjs.summarize.call(void 0, layout), [layout]);
|
|
5544
5696
|
const selected = ui.selectedId ? _nullishCoalesce(layout.elements.find((e) => e.id === ui.selectedId), () => ( null)) : null;
|
|
5545
5697
|
const canvasRef = _react.useRef.call(void 0, null);
|
|
5546
5698
|
const otherTableLabels = _react.useMemo.call(void 0,
|
|
@@ -5576,7 +5728,7 @@ function VenueDesigner(props) {
|
|
|
5576
5728
|
setSaveFailed(false);
|
|
5577
5729
|
try {
|
|
5578
5730
|
await finish(layout);
|
|
5579
|
-
} catch (
|
|
5731
|
+
} catch (e6) {
|
|
5580
5732
|
setSaveFailed(true);
|
|
5581
5733
|
} finally {
|
|
5582
5734
|
setSaving(false);
|
|
@@ -5609,7 +5761,7 @@ function VenueDesigner(props) {
|
|
|
5609
5761
|
if (compact && popover !== null) setPopover(null);
|
|
5610
5762
|
}, [sheet, selected, compact, popover]);
|
|
5611
5763
|
const bg = layout.meta.background;
|
|
5612
|
-
const current = useImage(_nullishCoalesce(_optionalChain([bg, 'optionalAccess',
|
|
5764
|
+
const current = useImage(_nullishCoalesce(_optionalChain([bg, 'optionalAccess', _188 => _188.src]), () => ( null)));
|
|
5613
5765
|
const [incomingSrc, setIncomingSrc] = _react.useState.call(void 0, null);
|
|
5614
5766
|
const incoming = useImage(incomingSrc);
|
|
5615
5767
|
const { run } = designer;
|
|
@@ -5631,7 +5783,7 @@ function VenueDesigner(props) {
|
|
|
5631
5783
|
};
|
|
5632
5784
|
const adoptBackground = (src) => {
|
|
5633
5785
|
if (!src) return;
|
|
5634
|
-
if (src === _optionalChain([bg, 'optionalAccess',
|
|
5786
|
+
if (src === _optionalChain([bg, 'optionalAccess', _189 => _189.src]) && incomingSrc === null) return;
|
|
5635
5787
|
setIncomingSrc(src);
|
|
5636
5788
|
};
|
|
5637
5789
|
const bgProp = props.background;
|
|
@@ -5641,13 +5793,13 @@ function VenueDesigner(props) {
|
|
|
5641
5793
|
setPicking(true);
|
|
5642
5794
|
try {
|
|
5643
5795
|
src = await bgProp.onPick();
|
|
5644
|
-
} catch (
|
|
5796
|
+
} catch (e7) {
|
|
5645
5797
|
} finally {
|
|
5646
5798
|
setPicking(false);
|
|
5647
5799
|
}
|
|
5648
5800
|
adoptBackground(src);
|
|
5649
5801
|
} : null;
|
|
5650
|
-
const suggestedSrc = _optionalChain([bgProp, 'optionalAccess',
|
|
5802
|
+
const suggestedSrc = _optionalChain([bgProp, 'optionalAccess', _190 => _190.suggestedSrc]) || null;
|
|
5651
5803
|
const bgStatus = incomingSrc ? incoming.failed ? "failed" : "loading" : current.failed ? "failed" : "idle";
|
|
5652
5804
|
const showBackground = bgProp !== void 0 || bg !== null;
|
|
5653
5805
|
const latest = _react.useRef.call(void 0, { summary, placeTypes: props.placeTypes, compact, meta: layout.meta });
|
|
@@ -5658,9 +5810,9 @@ function VenueDesigner(props) {
|
|
|
5658
5810
|
const { summary: summary2, placeTypes, compact: compact2, meta } = latest.current;
|
|
5659
5811
|
const request = pieceRequest(kind, ref, placeTypes, summary2);
|
|
5660
5812
|
if (!request) return null;
|
|
5661
|
-
const centre = _nullishCoalesce(_optionalChain([canvasRef, 'access',
|
|
5813
|
+
const centre = _nullishCoalesce(_optionalChain([canvasRef, 'access', _191 => _191.current, 'optionalAccess', _192 => _192.centre, 'call', _193 => _193()]), () => ( { x: meta.width / 2, y: meta.height / 2 }));
|
|
5662
5814
|
const id = designerAddFor(kind, request.option, centre, request.opts);
|
|
5663
|
-
if (id) _optionalChain([canvasRef, 'access',
|
|
5815
|
+
if (id) _optionalChain([canvasRef, 'access', _194 => _194.current, 'optionalAccess', _195 => _195.reveal, 'call', _196 => _196(id)]);
|
|
5664
5816
|
if (id && compact2) setSheet("piece");
|
|
5665
5817
|
return id;
|
|
5666
5818
|
},
|
|
@@ -5670,12 +5822,12 @@ function VenueDesigner(props) {
|
|
|
5670
5822
|
(id) => {
|
|
5671
5823
|
dispatchUi({ type: "select", id });
|
|
5672
5824
|
if (!id) return;
|
|
5673
|
-
_optionalChain([canvasRef, 'access',
|
|
5825
|
+
_optionalChain([canvasRef, 'access', _197 => _197.current, 'optionalAccess', _198 => _198.reveal, 'call', _199 => _199(id)]);
|
|
5674
5826
|
if (latest.current.compact) setSheet("piece");
|
|
5675
5827
|
},
|
|
5676
5828
|
[dispatchUi]
|
|
5677
5829
|
);
|
|
5678
|
-
const revealPiece = _react.useCallback.call(void 0, (id) => _optionalChain([canvasRef, 'access',
|
|
5830
|
+
const revealPiece = _react.useCallback.call(void 0, (id) => _optionalChain([canvasRef, 'access', _200 => _200.current, 'optionalAccess', _201 => _201.reveal, 'call', _202 => _202(id)]), []);
|
|
5679
5831
|
const trimToCapacity = _react.useCallback.call(void 0,
|
|
5680
5832
|
(ref) => {
|
|
5681
5833
|
const option = latest.current.placeTypes.find((o) => o.ref === ref);
|
|
@@ -5691,7 +5843,7 @@ function VenueDesigner(props) {
|
|
|
5691
5843
|
() => hostReads(latest.current.placeTypes, facts.summary, facts.pieces, m),
|
|
5692
5844
|
[typesKey, facts, m]
|
|
5693
5845
|
);
|
|
5694
|
-
const selectedRef = selected && selected.type !== "landmark" ? _optionalChain([selected, 'access',
|
|
5846
|
+
const selectedRef = selected && selected.type !== "landmark" ? _optionalChain([selected, 'access', _203 => _203.placeType, 'optionalAccess', _204 => _204.ref]) || null : null;
|
|
5695
5847
|
const hostApi = _react.useMemo.call(void 0,
|
|
5696
5848
|
() => ({ ...reads, addPiece, trimToCapacity, select: selectPiece, reveal: revealPiece, selectedRef }),
|
|
5697
5849
|
[reads, addPiece, trimToCapacity, selectPiece, revealPiece, selectedRef]
|
|
@@ -5756,7 +5908,7 @@ function VenueDesigner(props) {
|
|
|
5756
5908
|
editing: ui.backgroundEditing,
|
|
5757
5909
|
compact,
|
|
5758
5910
|
onPick: pickBackground ? () => void pickBackground() : null,
|
|
5759
|
-
onUseSuggested: suggestedSrc && suggestedSrc !== _optionalChain([bg, 'optionalAccess',
|
|
5911
|
+
onUseSuggested: suggestedSrc && suggestedSrc !== _optionalChain([bg, 'optionalAccess', _205 => _205.src]) ? () => adoptBackground(suggestedSrc) : null,
|
|
5760
5912
|
onSet: setBackground,
|
|
5761
5913
|
onEditing: (on) => {
|
|
5762
5914
|
dispatchUi({ type: "backgroundEdit", on });
|
|
@@ -5820,8 +5972,8 @@ function VenueDesigner(props) {
|
|
|
5820
5972
|
const panel = _nullishCoalesce(inspector, () => ( multiPanel));
|
|
5821
5973
|
const numberingTitleId = _react.useId.call(void 0, );
|
|
5822
5974
|
const numberingBlock = numberingId ? layout.elements.find((e) => e.id === numberingId) : void 0;
|
|
5823
|
-
const numberingTarget = _optionalChain([numberingBlock, 'optionalAccess',
|
|
5824
|
-
const numberingRef = _optionalChain([numberingTarget, 'optionalAccess',
|
|
5975
|
+
const numberingTarget = _optionalChain([numberingBlock, 'optionalAccess', _206 => _206.type]) === "seatBlock" ? numberingBlock : null;
|
|
5976
|
+
const numberingRef = _optionalChain([numberingTarget, 'optionalAccess', _207 => _207.placeType, 'optionalAccess', _208 => _208.ref]) || null;
|
|
5825
5977
|
const numberingType = numberingRef ? props.placeTypes.find((p) => p.ref === numberingRef) : void 0;
|
|
5826
5978
|
const closeNumbering = _react.useCallback.call(void 0, () => setNumberingId(null), []);
|
|
5827
5979
|
const canvas = /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -5923,8 +6075,8 @@ function VenueDesigner(props) {
|
|
|
5923
6075
|
NumberingDialog,
|
|
5924
6076
|
{
|
|
5925
6077
|
block: numberingTarget,
|
|
5926
|
-
typeName: _nullishCoalesce(_optionalChain([numberingType, 'optionalAccess',
|
|
5927
|
-
color: _nullishCoalesce(_optionalChain([numberingType, 'optionalAccess',
|
|
6078
|
+
typeName: _nullishCoalesce(_optionalChain([numberingType, 'optionalAccess', _209 => _209.label]), () => ( m.unassigned)),
|
|
6079
|
+
color: _nullishCoalesce(_optionalChain([numberingType, 'optionalAccess', _210 => _210.color]), () => ( null)),
|
|
5928
6080
|
lockedUnitIds: locked,
|
|
5929
6081
|
messages: m,
|
|
5930
6082
|
titleId: numberingTitleId,
|
|
@@ -5946,7 +6098,7 @@ function VenueDesigner(props) {
|
|
|
5946
6098
|
}
|
|
5947
6099
|
|
|
5948
6100
|
// ../react/src/index.ts
|
|
5949
|
-
var VERSION = "0.10.
|
|
6101
|
+
var VERSION = "0.10.2";
|
|
5950
6102
|
|
|
5951
6103
|
|
|
5952
6104
|
|