@zonetrix/viewer 2.11.1 → 2.11.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/dist/index.js +1 -1
- package/dist/index.mjs +563 -551
- package/dist/types/index.d.ts +7 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,101 +1,116 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useState as
|
|
3
|
-
import { Stage as pt, Layer as
|
|
4
|
-
import { ref as
|
|
1
|
+
import { jsx as f, jsxs as D } from "react/jsx-runtime";
|
|
2
|
+
import { useState as W, useCallback as T, useEffect as U, useRef as P, useMemo as B, memo as Q, useSyncExternalStore as gt } from "react";
|
|
3
|
+
import { Stage as pt, Layer as we, Group as bt, Text as Ne, Circle as $e, Rect as ke, Path as vt, RegularPolygon as yt } from "react-konva";
|
|
4
|
+
import { ref as Re, onValue as We, off as Xe, get as mt } from "firebase/database";
|
|
5
5
|
import { fromFirebaseSeatMap as St } from "@zonetrix/shared";
|
|
6
6
|
function xt(n) {
|
|
7
|
-
const [
|
|
7
|
+
const [o, t] = W(null), [r, d] = W(!1), [c, s] = W(null), v = T(async () => {
|
|
8
8
|
if (n) {
|
|
9
|
-
d(!0),
|
|
9
|
+
d(!0), s(null);
|
|
10
10
|
try {
|
|
11
|
-
const
|
|
12
|
-
if (!
|
|
13
|
-
throw new Error(`Failed to fetch config: ${
|
|
14
|
-
const
|
|
15
|
-
t(
|
|
16
|
-
} catch (
|
|
17
|
-
const
|
|
18
|
-
i
|
|
11
|
+
const h = await fetch(n);
|
|
12
|
+
if (!h.ok)
|
|
13
|
+
throw new Error(`Failed to fetch config: ${h.statusText}`);
|
|
14
|
+
const i = await h.json();
|
|
15
|
+
t(i);
|
|
16
|
+
} catch (h) {
|
|
17
|
+
const i = h instanceof Error ? h : new Error("Unknown error occurred");
|
|
18
|
+
s(i), console.error("Failed to fetch seat map config:", i);
|
|
19
19
|
} finally {
|
|
20
20
|
d(!1);
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
|
-
};
|
|
24
|
-
return
|
|
25
|
-
|
|
26
|
-
}, [
|
|
27
|
-
config:
|
|
28
|
-
loading:
|
|
29
|
-
error:
|
|
30
|
-
refetch:
|
|
23
|
+
}, [n]);
|
|
24
|
+
return U(() => {
|
|
25
|
+
v();
|
|
26
|
+
}, [v]), {
|
|
27
|
+
config: o,
|
|
28
|
+
loading: r,
|
|
29
|
+
error: c,
|
|
30
|
+
refetch: v
|
|
31
31
|
};
|
|
32
32
|
}
|
|
33
33
|
function wt(n) {
|
|
34
|
-
const [
|
|
35
|
-
return
|
|
36
|
-
const
|
|
37
|
-
if (!
|
|
38
|
-
const { width: d, height:
|
|
39
|
-
d > 0 &&
|
|
40
|
-
const
|
|
41
|
-
const
|
|
42
|
-
if (!
|
|
43
|
-
const { width:
|
|
44
|
-
|
|
34
|
+
const [o, t] = W({ width: 0, height: 0 });
|
|
35
|
+
return U(() => {
|
|
36
|
+
const r = n.current;
|
|
37
|
+
if (!r) return;
|
|
38
|
+
const { width: d, height: c } = r.getBoundingClientRect();
|
|
39
|
+
d > 0 && c > 0 && t({ width: d, height: c });
|
|
40
|
+
const s = new ResizeObserver((v) => {
|
|
41
|
+
const h = v[0];
|
|
42
|
+
if (!h) return;
|
|
43
|
+
const { width: i, height: b } = h.contentRect;
|
|
44
|
+
i > 0 && b > 0 && t((y) => y.width === i && y.height === b ? y : { width: i, height: b });
|
|
45
45
|
});
|
|
46
|
-
return
|
|
47
|
-
|
|
46
|
+
return s.observe(r), () => {
|
|
47
|
+
s.disconnect();
|
|
48
48
|
};
|
|
49
|
-
}, [n]),
|
|
49
|
+
}, [n]), o;
|
|
50
50
|
}
|
|
51
|
-
function
|
|
52
|
-
return Math.sqrt(Math.pow(
|
|
51
|
+
function ze(n, o) {
|
|
52
|
+
return Math.sqrt(Math.pow(o.x - n.x, 2) + Math.pow(o.y - n.y, 2));
|
|
53
53
|
}
|
|
54
|
-
function
|
|
54
|
+
function De(n, o) {
|
|
55
55
|
return {
|
|
56
|
-
x: (n.x +
|
|
57
|
-
y: (n.y +
|
|
56
|
+
x: (n.x + o.x) / 2,
|
|
57
|
+
y: (n.y + o.y) / 2
|
|
58
58
|
};
|
|
59
59
|
}
|
|
60
|
-
function Ct(n,
|
|
61
|
-
const t =
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
60
|
+
function Ct(n, o) {
|
|
61
|
+
const t = P(null), r = P(null), d = P(1), {
|
|
62
|
+
enabled: c,
|
|
63
|
+
minScale: s,
|
|
64
|
+
maxScale: v,
|
|
65
|
+
currentScale: h,
|
|
66
|
+
currentPosition: i,
|
|
67
|
+
onScaleChange: b
|
|
68
|
+
} = o;
|
|
69
|
+
U(() => {
|
|
70
|
+
const y = n.current;
|
|
71
|
+
if (!y || !c) return;
|
|
72
|
+
const u = y.container(), w = (g) => {
|
|
73
|
+
if (g.touches.length === 2) {
|
|
74
|
+
g.preventDefault();
|
|
75
|
+
const I = { x: g.touches[0].clientX, y: g.touches[0].clientY }, R = { x: g.touches[1].clientX, y: g.touches[1].clientY };
|
|
76
|
+
t.current = ze(I, R), r.current = De(I, R), d.current = h;
|
|
70
77
|
}
|
|
71
|
-
},
|
|
72
|
-
if (
|
|
73
|
-
|
|
74
|
-
const
|
|
75
|
-
if (t.current !== null &&
|
|
76
|
-
const
|
|
77
|
-
Math.max(
|
|
78
|
-
|
|
79
|
-
),
|
|
80
|
-
x: (
|
|
81
|
-
y: (
|
|
82
|
-
},
|
|
83
|
-
x:
|
|
84
|
-
y:
|
|
78
|
+
}, m = (g) => {
|
|
79
|
+
if (g.touches.length !== 2) return;
|
|
80
|
+
g.preventDefault();
|
|
81
|
+
const I = { x: g.touches[0].clientX, y: g.touches[0].clientY }, R = { x: g.touches[1].clientX, y: g.touches[1].clientY }, F = ze(I, R), E = De(I, R);
|
|
82
|
+
if (t.current !== null && r.current !== null) {
|
|
83
|
+
const L = F / t.current, N = Math.min(
|
|
84
|
+
Math.max(h * L, s),
|
|
85
|
+
v
|
|
86
|
+
), Y = u.getBoundingClientRect(), V = E.x - Y.left, se = E.y - Y.top, ae = h, ce = {
|
|
87
|
+
x: (V - i.x) / ae,
|
|
88
|
+
y: (se - i.y) / ae
|
|
89
|
+
}, le = E.x - r.current.x, A = E.y - r.current.y, _ = {
|
|
90
|
+
x: V - ce.x * N + le,
|
|
91
|
+
y: se - ce.y * N + A
|
|
85
92
|
};
|
|
86
|
-
|
|
93
|
+
b(N, _), t.current = F, r.current = E;
|
|
87
94
|
}
|
|
88
|
-
},
|
|
89
|
-
|
|
95
|
+
}, M = (g) => {
|
|
96
|
+
g.touches.length < 2 && (t.current = null, r.current = null);
|
|
90
97
|
};
|
|
91
|
-
return
|
|
98
|
+
return u.addEventListener("touchstart", w, {
|
|
92
99
|
passive: !1
|
|
93
|
-
}),
|
|
100
|
+
}), u.addEventListener("touchmove", m, {
|
|
94
101
|
passive: !1
|
|
95
|
-
}),
|
|
96
|
-
|
|
102
|
+
}), u.addEventListener("touchend", M), () => {
|
|
103
|
+
u.removeEventListener("touchstart", w), u.removeEventListener("touchmove", m), u.removeEventListener("touchend", M);
|
|
97
104
|
};
|
|
98
|
-
}, [
|
|
105
|
+
}, [
|
|
106
|
+
n,
|
|
107
|
+
c,
|
|
108
|
+
s,
|
|
109
|
+
v,
|
|
110
|
+
h,
|
|
111
|
+
i,
|
|
112
|
+
b
|
|
113
|
+
]);
|
|
99
114
|
}
|
|
100
115
|
const Rt = {
|
|
101
116
|
canvasBackground: "#1a1a1a",
|
|
@@ -107,46 +122,46 @@ const Rt = {
|
|
|
107
122
|
seatHidden: "#4a4a4a",
|
|
108
123
|
gridLines: "#404040",
|
|
109
124
|
currency: "KD"
|
|
110
|
-
},
|
|
111
|
-
({ seat: n, state:
|
|
112
|
-
const
|
|
125
|
+
}, Pe = Q(
|
|
126
|
+
({ seat: n, state: o, colors: t, onClick: r, onMouseEnter: d, onMouseLeave: c }) => {
|
|
127
|
+
const h = {
|
|
113
128
|
available: t.seatAvailable,
|
|
114
129
|
reserved: t.seatReserved,
|
|
115
130
|
selected: t.seatSelected,
|
|
116
131
|
unavailable: t.seatUnavailable,
|
|
117
132
|
hidden: t.seatHidden
|
|
118
133
|
// Hidden seats are filtered out, but included for type safety
|
|
119
|
-
}[
|
|
120
|
-
|
|
121
|
-
}, [n,
|
|
122
|
-
(
|
|
123
|
-
d(n,
|
|
124
|
-
const
|
|
125
|
-
|
|
134
|
+
}[o], i = o === "available" || o === "selected", b = T(() => {
|
|
135
|
+
i && r(n);
|
|
136
|
+
}, [n, r, i]), y = T(
|
|
137
|
+
(m) => {
|
|
138
|
+
d(n, m);
|
|
139
|
+
const M = m.target.getStage();
|
|
140
|
+
M && i && (M.container().style.cursor = "pointer");
|
|
126
141
|
},
|
|
127
|
-
[n, d,
|
|
128
|
-
),
|
|
129
|
-
(
|
|
130
|
-
|
|
131
|
-
const
|
|
132
|
-
|
|
142
|
+
[n, d, i]
|
|
143
|
+
), u = T(
|
|
144
|
+
(m) => {
|
|
145
|
+
c();
|
|
146
|
+
const M = m.target.getStage();
|
|
147
|
+
M && (M.container().style.cursor = "grab");
|
|
133
148
|
},
|
|
134
|
-
[
|
|
135
|
-
),
|
|
149
|
+
[c]
|
|
150
|
+
), w = {
|
|
136
151
|
x: n.position.x,
|
|
137
152
|
y: n.position.y,
|
|
138
|
-
fill:
|
|
153
|
+
fill: h,
|
|
139
154
|
stroke: "#ffffff",
|
|
140
155
|
strokeWidth: 1,
|
|
141
|
-
onClick:
|
|
142
|
-
onTap:
|
|
143
|
-
onMouseEnter:
|
|
144
|
-
onMouseLeave:
|
|
156
|
+
onClick: b,
|
|
157
|
+
onTap: b,
|
|
158
|
+
onMouseEnter: y,
|
|
159
|
+
onMouseLeave: u
|
|
145
160
|
};
|
|
146
|
-
return n.shape === "circle" ? /* @__PURE__ */
|
|
147
|
-
|
|
161
|
+
return n.shape === "circle" ? /* @__PURE__ */ f($e, { ...w, radius: 12 }) : /* @__PURE__ */ f(
|
|
162
|
+
ke,
|
|
148
163
|
{
|
|
149
|
-
...
|
|
164
|
+
...w,
|
|
150
165
|
width: 24,
|
|
151
166
|
height: 24,
|
|
152
167
|
offsetX: 12,
|
|
@@ -156,55 +171,55 @@ const Rt = {
|
|
|
156
171
|
);
|
|
157
172
|
}
|
|
158
173
|
);
|
|
159
|
-
|
|
160
|
-
const
|
|
161
|
-
const t = n.config,
|
|
162
|
-
let
|
|
163
|
-
|
|
164
|
-
const
|
|
174
|
+
Pe.displayName = "ViewerSeat";
|
|
175
|
+
const Ye = Q(({ stage: n, stageColor: o }) => {
|
|
176
|
+
const t = n.config, r = t.shape || "rectangle", d = t.showLabel !== !1, c = t.color || o, s = t.width / t.height, v = s < 0.5, h = s > 2;
|
|
177
|
+
let i;
|
|
178
|
+
v ? i = t.width * 0.25 : h ? i = t.height * 0.35 : i = Math.min(t.width, t.height) * 0.25;
|
|
179
|
+
const b = t.label?.length || 6, w = t.width * 0.85 / b * 1.5, m = Math.max(
|
|
165
180
|
10,
|
|
166
|
-
Math.min(24, Math.min(
|
|
167
|
-
),
|
|
168
|
-
fill:
|
|
181
|
+
Math.min(24, Math.min(i, w))
|
|
182
|
+
), M = 4, g = Math.max(20, t.width - M * 2), I = (t.width - g) / 2, R = {
|
|
183
|
+
fill: c + "80",
|
|
169
184
|
stroke: "#ffffff",
|
|
170
185
|
strokeWidth: 2,
|
|
171
186
|
perfectDrawEnabled: !1,
|
|
172
187
|
hitStrokeWidth: 0
|
|
173
|
-
},
|
|
174
|
-
switch (
|
|
188
|
+
}, F = () => {
|
|
189
|
+
switch (r) {
|
|
175
190
|
case "circle": {
|
|
176
|
-
const
|
|
177
|
-
return /* @__PURE__ */
|
|
178
|
-
|
|
191
|
+
const E = Math.min(t.width, t.height) / 2;
|
|
192
|
+
return /* @__PURE__ */ f(
|
|
193
|
+
$e,
|
|
179
194
|
{
|
|
180
195
|
x: t.width / 2,
|
|
181
196
|
y: t.height / 2,
|
|
182
|
-
radius:
|
|
197
|
+
radius: E,
|
|
183
198
|
...R
|
|
184
199
|
}
|
|
185
200
|
);
|
|
186
201
|
}
|
|
187
202
|
case "triangle": {
|
|
188
|
-
const
|
|
189
|
-
return /* @__PURE__ */
|
|
203
|
+
const E = Math.min(t.width, t.height) / 2;
|
|
204
|
+
return /* @__PURE__ */ f(
|
|
190
205
|
yt,
|
|
191
206
|
{
|
|
192
207
|
x: t.width / 2,
|
|
193
208
|
y: t.height / 2,
|
|
194
209
|
sides: 3,
|
|
195
|
-
radius:
|
|
210
|
+
radius: E,
|
|
196
211
|
rotation: -90,
|
|
197
212
|
...R
|
|
198
213
|
}
|
|
199
214
|
);
|
|
200
215
|
}
|
|
201
216
|
case "arrow": {
|
|
202
|
-
const
|
|
203
|
-
return /* @__PURE__ */
|
|
217
|
+
const E = t.width / 24, L = t.height / 24, N = `M${9 * E},${18 * L} v${-8 * L} H${5 * E} l${7 * E},${-7 * L} l${7 * E},${7 * L} h${-4 * E} v${8 * L} Z`;
|
|
218
|
+
return /* @__PURE__ */ f(vt, { data: N, ...R });
|
|
204
219
|
}
|
|
205
220
|
default:
|
|
206
|
-
return /* @__PURE__ */
|
|
207
|
-
|
|
221
|
+
return /* @__PURE__ */ f(
|
|
222
|
+
ke,
|
|
208
223
|
{
|
|
209
224
|
width: t.width,
|
|
210
225
|
height: t.height,
|
|
@@ -221,16 +236,16 @@ const We = J(({ stage: n, stageColor: r }) => {
|
|
|
221
236
|
y: n.position.y,
|
|
222
237
|
rotation: t.rotation || 0,
|
|
223
238
|
children: [
|
|
224
|
-
|
|
225
|
-
d && /* @__PURE__ */
|
|
226
|
-
|
|
239
|
+
F(),
|
|
240
|
+
d && /* @__PURE__ */ f(
|
|
241
|
+
Ne,
|
|
227
242
|
{
|
|
228
243
|
text: t.label,
|
|
229
|
-
x:
|
|
230
|
-
y:
|
|
231
|
-
width:
|
|
232
|
-
height: t.height -
|
|
233
|
-
fontSize:
|
|
244
|
+
x: I,
|
|
245
|
+
y: M,
|
|
246
|
+
width: g,
|
|
247
|
+
height: t.height - M * 2,
|
|
248
|
+
fontSize: m,
|
|
234
249
|
fontStyle: "bold",
|
|
235
250
|
fill: "#ffffff",
|
|
236
251
|
align: "center",
|
|
@@ -243,9 +258,9 @@ const We = J(({ stage: n, stageColor: r }) => {
|
|
|
243
258
|
}
|
|
244
259
|
);
|
|
245
260
|
});
|
|
246
|
-
|
|
247
|
-
const
|
|
248
|
-
|
|
261
|
+
Ye.displayName = "ViewerStage";
|
|
262
|
+
const Ae = Q(({ text: n }) => /* @__PURE__ */ f(
|
|
263
|
+
Ne,
|
|
249
264
|
{
|
|
250
265
|
x: n.position.x,
|
|
251
266
|
y: n.position.y,
|
|
@@ -256,21 +271,21 @@ const Pe = J(({ text: n }) => /* @__PURE__ */ u(
|
|
|
256
271
|
listening: !1
|
|
257
272
|
}
|
|
258
273
|
));
|
|
259
|
-
|
|
260
|
-
const
|
|
274
|
+
Ae.displayName = "ViewerText";
|
|
275
|
+
const Be = Q(
|
|
261
276
|
({
|
|
262
277
|
floors: n,
|
|
263
|
-
currentFloorId:
|
|
278
|
+
currentFloorId: o,
|
|
264
279
|
onFloorChange: t,
|
|
265
|
-
showAllOption:
|
|
280
|
+
showAllOption: r,
|
|
266
281
|
allLabel: d,
|
|
267
|
-
position:
|
|
268
|
-
className:
|
|
282
|
+
position: c,
|
|
283
|
+
className: s
|
|
269
284
|
}) => {
|
|
270
|
-
const
|
|
271
|
-
() => [...n].sort((
|
|
285
|
+
const v = B(
|
|
286
|
+
() => [...n].sort((u, w) => u.order - w.order),
|
|
272
287
|
[n]
|
|
273
|
-
),
|
|
288
|
+
), i = {
|
|
274
289
|
position: "absolute",
|
|
275
290
|
display: "flex",
|
|
276
291
|
alignItems: "center",
|
|
@@ -285,8 +300,8 @@ const Xe = J(
|
|
|
285
300
|
"top-right": { top: 0, right: 0 },
|
|
286
301
|
"bottom-left": { bottom: 0, left: 0 },
|
|
287
302
|
"bottom-right": { bottom: 0, right: 0 }
|
|
288
|
-
}[
|
|
289
|
-
},
|
|
303
|
+
}[c]
|
|
304
|
+
}, b = {
|
|
290
305
|
padding: "10px 16px",
|
|
291
306
|
fontSize: "14px",
|
|
292
307
|
fontWeight: 500,
|
|
@@ -298,38 +313,38 @@ const Xe = J(
|
|
|
298
313
|
transition: "all 0.2s ease",
|
|
299
314
|
minHeight: "44px",
|
|
300
315
|
touchAction: "manipulation"
|
|
301
|
-
},
|
|
302
|
-
...
|
|
316
|
+
}, y = {
|
|
317
|
+
...b,
|
|
303
318
|
backgroundColor: "#3A7DE5",
|
|
304
319
|
borderColor: "#3A7DE5"
|
|
305
320
|
};
|
|
306
|
-
return /* @__PURE__ */ D("div", { className:
|
|
307
|
-
|
|
321
|
+
return /* @__PURE__ */ D("div", { className: s, style: i, children: [
|
|
322
|
+
r && /* @__PURE__ */ f(
|
|
308
323
|
"button",
|
|
309
324
|
{
|
|
310
325
|
type: "button",
|
|
311
326
|
onClick: () => t(null),
|
|
312
|
-
style:
|
|
327
|
+
style: o === null ? y : b,
|
|
313
328
|
children: d
|
|
314
329
|
}
|
|
315
330
|
),
|
|
316
|
-
|
|
331
|
+
v.map((u) => /* @__PURE__ */ f(
|
|
317
332
|
"button",
|
|
318
333
|
{
|
|
319
334
|
type: "button",
|
|
320
|
-
onClick: () => t(
|
|
321
|
-
style:
|
|
322
|
-
children:
|
|
335
|
+
onClick: () => t(u.id),
|
|
336
|
+
style: o === u.id ? y : b,
|
|
337
|
+
children: u.name
|
|
323
338
|
},
|
|
324
|
-
|
|
339
|
+
u.id
|
|
325
340
|
))
|
|
326
341
|
] });
|
|
327
342
|
}
|
|
328
343
|
);
|
|
329
|
-
|
|
330
|
-
const
|
|
331
|
-
({ scale: n, minScale:
|
|
332
|
-
const
|
|
344
|
+
Be.displayName = "FloorSelectorBar";
|
|
345
|
+
const Ue = Q(
|
|
346
|
+
({ scale: n, minScale: o, maxScale: t, onZoomIn: r, onZoomOut: d, position: c, className: s }) => {
|
|
347
|
+
const h = {
|
|
333
348
|
position: "absolute",
|
|
334
349
|
display: "flex",
|
|
335
350
|
flexDirection: "column",
|
|
@@ -344,8 +359,8 @@ const Ye = J(
|
|
|
344
359
|
"top-right": { top: 0, right: 0 },
|
|
345
360
|
"bottom-left": { bottom: 0, left: 0 },
|
|
346
361
|
"bottom-right": { bottom: 0, right: 0 }
|
|
347
|
-
}[
|
|
348
|
-
},
|
|
362
|
+
}[c]
|
|
363
|
+
}, i = {
|
|
349
364
|
width: "44px",
|
|
350
365
|
height: "44px",
|
|
351
366
|
minWidth: "44px",
|
|
@@ -362,30 +377,30 @@ const Ye = J(
|
|
|
362
377
|
justifyContent: "center",
|
|
363
378
|
transition: "all 0.2s ease",
|
|
364
379
|
touchAction: "manipulation"
|
|
365
|
-
},
|
|
366
|
-
...
|
|
380
|
+
}, b = {
|
|
381
|
+
...i,
|
|
367
382
|
opacity: 0.4,
|
|
368
383
|
cursor: "not-allowed"
|
|
369
|
-
},
|
|
370
|
-
return /* @__PURE__ */ D("div", { className:
|
|
371
|
-
/* @__PURE__ */
|
|
384
|
+
}, y = n < t, u = n > o;
|
|
385
|
+
return /* @__PURE__ */ D("div", { className: s, style: h, children: [
|
|
386
|
+
/* @__PURE__ */ f(
|
|
372
387
|
"button",
|
|
373
388
|
{
|
|
374
389
|
type: "button",
|
|
375
|
-
onClick:
|
|
376
|
-
disabled: !
|
|
377
|
-
style:
|
|
390
|
+
onClick: r,
|
|
391
|
+
disabled: !y,
|
|
392
|
+
style: y ? i : b,
|
|
378
393
|
title: "Zoom In",
|
|
379
394
|
children: "+"
|
|
380
395
|
}
|
|
381
396
|
),
|
|
382
|
-
/* @__PURE__ */
|
|
397
|
+
/* @__PURE__ */ f(
|
|
383
398
|
"button",
|
|
384
399
|
{
|
|
385
400
|
type: "button",
|
|
386
401
|
onClick: d,
|
|
387
|
-
disabled: !
|
|
388
|
-
style:
|
|
402
|
+
disabled: !u,
|
|
403
|
+
style: u ? i : b,
|
|
389
404
|
title: "Zoom Out",
|
|
390
405
|
children: "−"
|
|
391
406
|
}
|
|
@@ -393,17 +408,17 @@ const Ye = J(
|
|
|
393
408
|
] });
|
|
394
409
|
}
|
|
395
410
|
);
|
|
396
|
-
|
|
397
|
-
const
|
|
398
|
-
({ visible: n, x:
|
|
399
|
-
if (!n || !
|
|
400
|
-
const
|
|
411
|
+
Ue.displayName = "ZoomControls";
|
|
412
|
+
const He = Q(
|
|
413
|
+
({ visible: n, x: o, y: t, seat: r, currency: d, state: c }) => {
|
|
414
|
+
if (!n || !r) return null;
|
|
415
|
+
const s = r.seatNumber || (r.rowLabel && r.columnLabel ? `${r.rowLabel}-${r.columnLabel}` : "N/A"), v = {
|
|
401
416
|
position: "fixed",
|
|
402
|
-
left: `${
|
|
417
|
+
left: `${o + 15}px`,
|
|
403
418
|
top: `${t + 15}px`,
|
|
404
419
|
zIndex: 1e3,
|
|
405
420
|
pointerEvents: "none"
|
|
406
|
-
},
|
|
421
|
+
}, h = {
|
|
407
422
|
backgroundColor: "rgba(26, 26, 26, 0.95)",
|
|
408
423
|
color: "#fff",
|
|
409
424
|
border: "1px solid #444",
|
|
@@ -412,337 +427,334 @@ const Ae = J(
|
|
|
412
427
|
fontSize: "13px",
|
|
413
428
|
boxShadow: "0 4px 12px rgba(0, 0, 0, 0.3)",
|
|
414
429
|
minWidth: "140px"
|
|
415
|
-
},
|
|
430
|
+
}, i = {
|
|
416
431
|
color: "#9ca3af",
|
|
417
432
|
marginRight: "4px"
|
|
418
|
-
},
|
|
433
|
+
}, b = {
|
|
419
434
|
fontWeight: 600
|
|
420
|
-
},
|
|
435
|
+
}, y = {
|
|
421
436
|
color: "#4ade80",
|
|
422
437
|
fontWeight: 600
|
|
423
|
-
},
|
|
438
|
+
}, u = {
|
|
424
439
|
fontSize: "11px",
|
|
425
440
|
color: "#6b7280",
|
|
426
441
|
textTransform: "capitalize",
|
|
427
442
|
marginTop: "4px"
|
|
428
443
|
};
|
|
429
|
-
return /* @__PURE__ */
|
|
430
|
-
|
|
431
|
-
/* @__PURE__ */
|
|
432
|
-
/* @__PURE__ */
|
|
444
|
+
return /* @__PURE__ */ f("div", { style: v, children: /* @__PURE__ */ D("div", { style: h, children: [
|
|
445
|
+
r.sectionName && /* @__PURE__ */ D("div", { style: { marginBottom: "4px" }, children: [
|
|
446
|
+
/* @__PURE__ */ f("span", { style: i, children: "Section:" }),
|
|
447
|
+
/* @__PURE__ */ f("span", { style: { ...b, color: "#3b82f6" }, children: r.sectionName })
|
|
433
448
|
] }),
|
|
434
449
|
/* @__PURE__ */ D("div", { style: { marginBottom: "4px" }, children: [
|
|
435
|
-
/* @__PURE__ */
|
|
436
|
-
/* @__PURE__ */
|
|
450
|
+
/* @__PURE__ */ f("span", { style: i, children: "Seat:" }),
|
|
451
|
+
/* @__PURE__ */ f("span", { style: b, children: s })
|
|
437
452
|
] }),
|
|
438
|
-
|
|
439
|
-
/* @__PURE__ */
|
|
440
|
-
/* @__PURE__ */ D("span", { style:
|
|
453
|
+
r.price !== void 0 && r.price > 0 && c === "available" && /* @__PURE__ */ D("div", { style: { marginBottom: "4px" }, children: [
|
|
454
|
+
/* @__PURE__ */ f("span", { style: i, children: "Price:" }),
|
|
455
|
+
/* @__PURE__ */ D("span", { style: y, children: [
|
|
441
456
|
d,
|
|
442
457
|
" ",
|
|
443
|
-
|
|
458
|
+
r.price.toFixed(2)
|
|
444
459
|
] })
|
|
445
460
|
] }),
|
|
446
|
-
/* @__PURE__ */ D("div", { style:
|
|
461
|
+
/* @__PURE__ */ D("div", { style: u, children: [
|
|
447
462
|
"Status: ",
|
|
448
|
-
|
|
463
|
+
c
|
|
449
464
|
] })
|
|
450
465
|
] }) });
|
|
451
466
|
}
|
|
452
467
|
);
|
|
453
|
-
|
|
468
|
+
He.displayName = "SeatTooltip";
|
|
454
469
|
const Nt = ({
|
|
455
470
|
config: n,
|
|
456
|
-
configUrl:
|
|
471
|
+
configUrl: o,
|
|
457
472
|
floorId: t,
|
|
458
|
-
onFloorChange:
|
|
473
|
+
onFloorChange: r,
|
|
459
474
|
reservedSeats: d = [],
|
|
460
|
-
otherReservedSeats:
|
|
475
|
+
otherReservedSeats: c,
|
|
461
476
|
// v2.4.0: New prop name (preferred)
|
|
462
|
-
unavailableSeats:
|
|
463
|
-
selectedSeats:
|
|
464
|
-
myReservedSeats:
|
|
465
|
-
onSeatSelect:
|
|
466
|
-
onSeatDeselect:
|
|
467
|
-
onSelectionChange:
|
|
468
|
-
colorOverrides:
|
|
469
|
-
showTooltip:
|
|
470
|
-
zoomEnabled:
|
|
471
|
-
className:
|
|
472
|
-
onConfigLoad:
|
|
473
|
-
onError:
|
|
477
|
+
unavailableSeats: s = [],
|
|
478
|
+
selectedSeats: v,
|
|
479
|
+
myReservedSeats: h = [],
|
|
480
|
+
onSeatSelect: i,
|
|
481
|
+
onSeatDeselect: b,
|
|
482
|
+
onSelectionChange: y,
|
|
483
|
+
colorOverrides: u,
|
|
484
|
+
showTooltip: w = !0,
|
|
485
|
+
zoomEnabled: m = !0,
|
|
486
|
+
className: M = "",
|
|
487
|
+
onConfigLoad: g,
|
|
488
|
+
onError: I,
|
|
474
489
|
// Floor selector props
|
|
475
490
|
showFloorSelector: R,
|
|
476
|
-
floorSelectorPosition:
|
|
477
|
-
floorSelectorClassName:
|
|
491
|
+
floorSelectorPosition: F = "top-left",
|
|
492
|
+
floorSelectorClassName: E,
|
|
478
493
|
showAllFloorsOption: L = !0,
|
|
479
|
-
allFloorsLabel:
|
|
494
|
+
allFloorsLabel: N = "All",
|
|
480
495
|
fitToView: Y = !0,
|
|
481
|
-
fitPadding:
|
|
496
|
+
fitPadding: V = 40,
|
|
482
497
|
// Zoom controls
|
|
483
|
-
showZoomControls:
|
|
484
|
-
zoomControlsPosition:
|
|
485
|
-
zoomControlsClassName:
|
|
486
|
-
minZoom:
|
|
487
|
-
maxZoom:
|
|
488
|
-
zoomStep:
|
|
498
|
+
showZoomControls: se = !0,
|
|
499
|
+
zoomControlsPosition: ae = "bottom-right",
|
|
500
|
+
zoomControlsClassName: ce,
|
|
501
|
+
minZoom: le,
|
|
502
|
+
maxZoom: A = 3,
|
|
503
|
+
zoomStep: _ = 0.25,
|
|
489
504
|
// Touch gestures
|
|
490
505
|
touchEnabled: Ve = !0
|
|
491
506
|
}) => {
|
|
492
|
-
const
|
|
507
|
+
const Ie = c !== void 0 ? c : d, ve = P(null), Fe = P(null), z = wt(Fe), [q, Le] = W(
|
|
493
508
|
/* @__PURE__ */ new Set()
|
|
494
|
-
), [
|
|
509
|
+
), [$, ee] = W(1), [X, Z] = W({ x: 0, y: 0 }), [Oe, je] = W(null), [_e, qe] = W(1), de = P({ width: 0, height: 0 }), [te, Te] = W({ visible: !1, x: 0, y: 0, seat: null, state: "available" }), { config: Ze, loading: Ge, error: ne } = xt(o), l = n || Ze, ye = t !== void 0, k = ye ? t || null : Oe, he = v !== void 0, Ke = T(
|
|
495
510
|
(e) => {
|
|
496
|
-
|
|
511
|
+
ye || je(e), r?.(e);
|
|
497
512
|
},
|
|
498
|
-
[
|
|
499
|
-
),
|
|
500
|
-
() =>
|
|
501
|
-
[
|
|
502
|
-
),
|
|
503
|
-
if (!
|
|
504
|
-
let e =
|
|
505
|
-
return
|
|
506
|
-
(
|
|
513
|
+
[ye, r]
|
|
514
|
+
), me = l?.floors || [], Je = R !== void 0 ? R : me.length > 1, ue = B(
|
|
515
|
+
() => l ? { ...l.colors, ...u } : { ...Rt, ...u },
|
|
516
|
+
[l, u]
|
|
517
|
+
), G = B(() => {
|
|
518
|
+
if (!l) return [];
|
|
519
|
+
let e = l.seats.filter((a) => a.state !== "hidden");
|
|
520
|
+
return k && (e = e.filter(
|
|
521
|
+
(a) => a.floorId === k || !a.floorId && k === "floor_default"
|
|
507
522
|
)), e;
|
|
508
|
-
}, [
|
|
509
|
-
(e) => e.floorId ===
|
|
510
|
-
) :
|
|
511
|
-
(e) => e.floorId ===
|
|
512
|
-
) :
|
|
513
|
-
if (!
|
|
523
|
+
}, [l, k]), fe = B(() => l?.stages ? k ? l.stages.filter(
|
|
524
|
+
(e) => e.floorId === k || !e.floorId && k === "floor_default"
|
|
525
|
+
) : l.stages : [], [l, k]), ge = B(() => l?.texts ? k ? l.texts.filter(
|
|
526
|
+
(e) => e.floorId === k || !e.floorId && k === "floor_default"
|
|
527
|
+
) : l.texts : [], [l, k]), H = B(() => {
|
|
528
|
+
if (!l || G.length === 0 && fe.length === 0 && ge.length === 0)
|
|
514
529
|
return null;
|
|
515
530
|
const e = 12;
|
|
516
|
-
let
|
|
517
|
-
return
|
|
518
|
-
|
|
519
|
-
}),
|
|
520
|
-
|
|
521
|
-
}),
|
|
522
|
-
const j =
|
|
523
|
-
|
|
524
|
-
}), { minX:
|
|
525
|
-
}, [
|
|
526
|
-
|
|
527
|
-
if (!Y || !
|
|
531
|
+
let a = 1 / 0, p = 1 / 0, S = -1 / 0, C = -1 / 0;
|
|
532
|
+
return G.forEach((x) => {
|
|
533
|
+
a = Math.min(a, x.position.x - e), p = Math.min(p, x.position.y - e), S = Math.max(S, x.position.x + e), C = Math.max(C, x.position.y + e);
|
|
534
|
+
}), fe.forEach((x) => {
|
|
535
|
+
a = Math.min(a, x.position.x), p = Math.min(p, x.position.y), S = Math.max(S, x.position.x + (x.config?.width || 200)), C = Math.max(C, x.position.y + (x.config?.height || 100));
|
|
536
|
+
}), ge.forEach((x) => {
|
|
537
|
+
const j = x.config.text.length * x.config.fontSize * 0.6, J = x.config.fontSize;
|
|
538
|
+
a = Math.min(a, x.position.x), p = Math.min(p, x.position.y), S = Math.max(S, x.position.x + j), C = Math.max(C, x.position.y + J);
|
|
539
|
+
}), { minX: a, minY: p, maxX: S, maxY: C, width: S - a, height: C - p };
|
|
540
|
+
}, [l, G, fe, ge]);
|
|
541
|
+
U(() => {
|
|
542
|
+
if (!Y || !l || !H || z.width === 0 || z.height === 0) return;
|
|
528
543
|
const e = Math.abs(
|
|
529
|
-
|
|
530
|
-
),
|
|
531
|
-
|
|
544
|
+
z.width - de.current.width
|
|
545
|
+
), a = Math.abs(
|
|
546
|
+
z.height - de.current.height
|
|
532
547
|
);
|
|
533
|
-
if (!(
|
|
534
|
-
|
|
535
|
-
const
|
|
536
|
-
|
|
548
|
+
if (!(de.current.width === 0) && e < 10 && a < 10) return;
|
|
549
|
+
de.current = z;
|
|
550
|
+
const S = z.width, C = z.height, x = S - V * 2, j = C - V * 2, J = x / H.width, xe = j / H.height, pe = Math.min(J, xe, A), ct = H.minX + H.width / 2, lt = H.minY + H.height / 2, dt = S / 2, ht = C / 2, ut = dt - ct * pe, ft = ht - lt * pe;
|
|
551
|
+
ee(pe), Z({ x: ut, y: ft }), qe(pe);
|
|
537
552
|
}, [
|
|
538
553
|
Y,
|
|
539
|
-
|
|
554
|
+
l,
|
|
540
555
|
H,
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
556
|
+
V,
|
|
557
|
+
A,
|
|
558
|
+
z,
|
|
559
|
+
k
|
|
545
560
|
]);
|
|
546
|
-
const O =
|
|
547
|
-
const e = new Set(
|
|
548
|
-
return { reserved: e, unavailable:
|
|
549
|
-
}, [
|
|
561
|
+
const O = B(() => {
|
|
562
|
+
const e = new Set(Ie), a = new Set(s), p = new Set(h);
|
|
563
|
+
return { reserved: e, unavailable: a, myReserved: p };
|
|
564
|
+
}, [Ie, s, h]), Se = B(() => v ? new Set(v) : null, [v]), re = T(
|
|
550
565
|
(e) => {
|
|
551
|
-
const
|
|
552
|
-
return O.unavailable.has(
|
|
566
|
+
const a = e.id, p = e.seatNumber || "";
|
|
567
|
+
return O.unavailable.has(a) || O.unavailable.has(p) ? "unavailable" : O.reserved.has(a) || O.reserved.has(p) ? "reserved" : O.myReserved.has(a) || O.myReserved.has(p) || q.has(a) ? "selected" : e.state;
|
|
553
568
|
},
|
|
554
569
|
[O, q]
|
|
555
570
|
);
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
}, [
|
|
559
|
-
|
|
560
|
-
}, [
|
|
561
|
-
|
|
562
|
-
}, [
|
|
563
|
-
const Qe =
|
|
571
|
+
U(() => {
|
|
572
|
+
l && g && g(l);
|
|
573
|
+
}, [l, g]), U(() => {
|
|
574
|
+
ne && I && I(ne);
|
|
575
|
+
}, [ne, I]), U(() => {
|
|
576
|
+
he && Se && Le(Se);
|
|
577
|
+
}, [he, Se]);
|
|
578
|
+
const Qe = T(
|
|
564
579
|
(e) => {
|
|
565
|
-
const
|
|
566
|
-
if (
|
|
580
|
+
const a = re(e);
|
|
581
|
+
if (a !== "available" && a !== "selected")
|
|
567
582
|
return;
|
|
568
|
-
const
|
|
569
|
-
|
|
570
|
-
const
|
|
571
|
-
return
|
|
572
|
-
}),
|
|
583
|
+
const p = q.has(e.id);
|
|
584
|
+
he || Le((S) => {
|
|
585
|
+
const C = new Set(S);
|
|
586
|
+
return p ? C.delete(e.id) : C.add(e.id), C;
|
|
587
|
+
}), p ? b?.(e) : (i?.(e), i || console.log("Seat selected:", e));
|
|
573
588
|
},
|
|
574
589
|
[
|
|
575
|
-
|
|
590
|
+
re,
|
|
576
591
|
q,
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
592
|
+
he,
|
|
593
|
+
i,
|
|
594
|
+
b
|
|
580
595
|
]
|
|
581
|
-
),
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
}, [
|
|
585
|
-
const
|
|
586
|
-
if (!
|
|
587
|
-
const e = Math.min(
|
|
588
|
-
if (e !==
|
|
589
|
-
const
|
|
590
|
-
x: (
|
|
591
|
-
y: (
|
|
596
|
+
), oe = B(() => l ? G.filter((e) => q.has(e.id)) : [], [l, G, q]);
|
|
597
|
+
U(() => {
|
|
598
|
+
y?.(oe);
|
|
599
|
+
}, [oe, y]);
|
|
600
|
+
const K = le !== void 0 ? le : _e, et = T(() => {
|
|
601
|
+
if (!m) return;
|
|
602
|
+
const e = Math.min($ + _, A);
|
|
603
|
+
if (e !== $) {
|
|
604
|
+
const a = z.width || l?.canvas.width || 800, p = z.height || l?.canvas.height || 600, S = a / 2, C = p / 2, x = {
|
|
605
|
+
x: (S - X.x) / $,
|
|
606
|
+
y: (C - X.y) / $
|
|
592
607
|
};
|
|
593
|
-
|
|
594
|
-
x:
|
|
595
|
-
y:
|
|
608
|
+
ee(e), Z({
|
|
609
|
+
x: S - x.x * e,
|
|
610
|
+
y: C - x.y * e
|
|
596
611
|
});
|
|
597
612
|
}
|
|
598
613
|
}, [
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
]), tt =
|
|
607
|
-
if (!
|
|
608
|
-
const e = Math.max(
|
|
609
|
-
if (e !==
|
|
610
|
-
const
|
|
611
|
-
x: (
|
|
612
|
-
y: (
|
|
614
|
+
m,
|
|
615
|
+
$,
|
|
616
|
+
_,
|
|
617
|
+
A,
|
|
618
|
+
z,
|
|
619
|
+
l,
|
|
620
|
+
X
|
|
621
|
+
]), tt = T(() => {
|
|
622
|
+
if (!m) return;
|
|
623
|
+
const e = Math.max($ - _, K);
|
|
624
|
+
if (e !== $) {
|
|
625
|
+
const a = z.width || l?.canvas.width || 800, p = z.height || l?.canvas.height || 600, S = a / 2, C = p / 2, x = {
|
|
626
|
+
x: (S - X.x) / $,
|
|
627
|
+
y: (C - X.y) / $
|
|
613
628
|
};
|
|
614
|
-
|
|
615
|
-
x:
|
|
616
|
-
y:
|
|
629
|
+
ee(e), Z({
|
|
630
|
+
x: S - x.x * e,
|
|
631
|
+
y: C - x.y * e
|
|
617
632
|
});
|
|
618
633
|
}
|
|
619
634
|
}, [
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
]), nt =
|
|
628
|
-
|
|
635
|
+
m,
|
|
636
|
+
$,
|
|
637
|
+
_,
|
|
638
|
+
K,
|
|
639
|
+
z,
|
|
640
|
+
l,
|
|
641
|
+
X
|
|
642
|
+
]), nt = T((e) => {
|
|
643
|
+
Z({
|
|
629
644
|
x: e.target.x(),
|
|
630
645
|
y: e.target.y()
|
|
631
646
|
});
|
|
632
|
-
}, []), rt =
|
|
647
|
+
}, []), rt = T(
|
|
633
648
|
(e) => {
|
|
634
|
-
if (!
|
|
649
|
+
if (!m) return;
|
|
635
650
|
e.evt.preventDefault();
|
|
636
|
-
const
|
|
637
|
-
if (!
|
|
638
|
-
const
|
|
639
|
-
if (!
|
|
640
|
-
const
|
|
641
|
-
x: (
|
|
642
|
-
y: (
|
|
643
|
-
},
|
|
644
|
-
x:
|
|
645
|
-
y:
|
|
651
|
+
const a = ve.current;
|
|
652
|
+
if (!a) return;
|
|
653
|
+
const p = a.scaleX(), S = a.getPointerPosition();
|
|
654
|
+
if (!S) return;
|
|
655
|
+
const C = 1.1, x = e.evt.deltaY > 0 ? p / C : p * C, j = Math.min(Math.max(x, K), A), J = {
|
|
656
|
+
x: (S.x - X.x) / p,
|
|
657
|
+
y: (S.y - X.y) / p
|
|
658
|
+
}, xe = {
|
|
659
|
+
x: S.x - J.x * j,
|
|
660
|
+
y: S.y - J.y * j
|
|
646
661
|
};
|
|
647
|
-
|
|
662
|
+
ee(j), Z(xe);
|
|
648
663
|
},
|
|
649
|
-
[
|
|
664
|
+
[m, X, K, A]
|
|
650
665
|
);
|
|
651
|
-
Ct(
|
|
652
|
-
enabled: Ve &&
|
|
653
|
-
minScale:
|
|
654
|
-
maxScale:
|
|
655
|
-
currentScale:
|
|
656
|
-
currentPosition:
|
|
657
|
-
onScaleChange: (e,
|
|
658
|
-
|
|
659
|
-
},
|
|
660
|
-
onPositionChange: (e) => {
|
|
661
|
-
V(e);
|
|
666
|
+
Ct(ve, {
|
|
667
|
+
enabled: Ve && m,
|
|
668
|
+
minScale: K,
|
|
669
|
+
maxScale: A,
|
|
670
|
+
currentScale: $,
|
|
671
|
+
currentPosition: X,
|
|
672
|
+
onScaleChange: (e, a) => {
|
|
673
|
+
ee(e), Z(a);
|
|
662
674
|
}
|
|
663
675
|
});
|
|
664
|
-
const ot =
|
|
665
|
-
(e,
|
|
666
|
-
if (!
|
|
667
|
-
const
|
|
668
|
-
if (!
|
|
669
|
-
const
|
|
670
|
-
if (!
|
|
671
|
-
const
|
|
672
|
-
|
|
676
|
+
const ot = T(
|
|
677
|
+
(e, a) => {
|
|
678
|
+
if (!w) return;
|
|
679
|
+
const p = a.target.getStage();
|
|
680
|
+
if (!p) return;
|
|
681
|
+
const S = p.getPointerPosition();
|
|
682
|
+
if (!S) return;
|
|
683
|
+
const C = p.container().getBoundingClientRect();
|
|
684
|
+
Te({
|
|
673
685
|
visible: !0,
|
|
674
|
-
x:
|
|
675
|
-
y:
|
|
686
|
+
x: C.left + S.x,
|
|
687
|
+
y: C.top + S.y,
|
|
676
688
|
seat: e,
|
|
677
|
-
state:
|
|
689
|
+
state: re(e)
|
|
678
690
|
});
|
|
679
691
|
},
|
|
680
|
-
[
|
|
681
|
-
), it =
|
|
682
|
-
|
|
692
|
+
[w, re]
|
|
693
|
+
), it = T(() => {
|
|
694
|
+
Te((e) => ({ ...e, visible: !1 }));
|
|
683
695
|
}, []);
|
|
684
696
|
if (Ge)
|
|
685
|
-
return /* @__PURE__ */
|
|
686
|
-
if (
|
|
687
|
-
return /* @__PURE__ */
|
|
697
|
+
return /* @__PURE__ */ f("div", { className: `flex items-center justify-center h-full ${M}`, children: /* @__PURE__ */ f("p", { children: "Loading seat map..." }) });
|
|
698
|
+
if (ne)
|
|
699
|
+
return /* @__PURE__ */ f("div", { className: `flex items-center justify-center h-full ${M}`, children: /* @__PURE__ */ D("p", { className: "text-red-500", children: [
|
|
688
700
|
"Error loading seat map: ",
|
|
689
|
-
|
|
701
|
+
ne.message
|
|
690
702
|
] }) });
|
|
691
|
-
if (!
|
|
692
|
-
return /* @__PURE__ */
|
|
693
|
-
const st =
|
|
703
|
+
if (!l)
|
|
704
|
+
return /* @__PURE__ */ f("div", { className: `flex items-center justify-center h-full ${M}`, children: /* @__PURE__ */ f("p", { children: "No configuration provided" }) });
|
|
705
|
+
const st = z.width || l.canvas.width, at = z.height || l.canvas.height;
|
|
694
706
|
return /* @__PURE__ */ D(
|
|
695
707
|
"div",
|
|
696
708
|
{
|
|
697
|
-
ref:
|
|
698
|
-
className: `relative ${
|
|
709
|
+
ref: Fe,
|
|
710
|
+
className: `relative ${M}`,
|
|
699
711
|
style: { width: "100%", height: "100%" },
|
|
700
712
|
children: [
|
|
701
|
-
Je &&
|
|
702
|
-
|
|
713
|
+
Je && me.length > 0 && /* @__PURE__ */ f(
|
|
714
|
+
Be,
|
|
703
715
|
{
|
|
704
|
-
floors:
|
|
705
|
-
currentFloorId:
|
|
716
|
+
floors: me,
|
|
717
|
+
currentFloorId: k,
|
|
706
718
|
onFloorChange: Ke,
|
|
707
719
|
showAllOption: L,
|
|
708
|
-
allLabel:
|
|
709
|
-
position:
|
|
710
|
-
className:
|
|
720
|
+
allLabel: N,
|
|
721
|
+
position: F,
|
|
722
|
+
className: E
|
|
711
723
|
}
|
|
712
724
|
),
|
|
713
725
|
/* @__PURE__ */ D(
|
|
714
726
|
pt,
|
|
715
727
|
{
|
|
716
|
-
ref:
|
|
728
|
+
ref: ve,
|
|
717
729
|
width: st,
|
|
718
730
|
height: at,
|
|
719
|
-
scaleX:
|
|
720
|
-
scaleY:
|
|
721
|
-
x:
|
|
722
|
-
y:
|
|
731
|
+
scaleX: $,
|
|
732
|
+
scaleY: $,
|
|
733
|
+
x: X.x,
|
|
734
|
+
y: X.y,
|
|
723
735
|
draggable: !0,
|
|
724
736
|
onDragEnd: nt,
|
|
725
737
|
onWheel: rt,
|
|
726
738
|
style: {
|
|
727
|
-
backgroundColor:
|
|
739
|
+
backgroundColor: l.canvas.backgroundColor,
|
|
728
740
|
cursor: "grab"
|
|
729
741
|
},
|
|
730
742
|
children: [
|
|
731
|
-
/* @__PURE__ */
|
|
732
|
-
|
|
743
|
+
/* @__PURE__ */ f(we, { listening: !1, children: fe.map((e) => /* @__PURE__ */ f(
|
|
744
|
+
Ye,
|
|
733
745
|
{
|
|
734
746
|
stage: e,
|
|
735
|
-
stageColor:
|
|
747
|
+
stageColor: ue.stageColor
|
|
736
748
|
},
|
|
737
749
|
e.id
|
|
738
750
|
)) }),
|
|
739
|
-
/* @__PURE__ */
|
|
740
|
-
/* @__PURE__ */
|
|
741
|
-
|
|
751
|
+
/* @__PURE__ */ f(we, { listening: !1, children: ge.map((e) => /* @__PURE__ */ f(Ae, { text: e }, e.id)) }),
|
|
752
|
+
/* @__PURE__ */ f(we, { children: G.map((e) => /* @__PURE__ */ f(
|
|
753
|
+
Pe,
|
|
742
754
|
{
|
|
743
755
|
seat: e,
|
|
744
|
-
state:
|
|
745
|
-
colors:
|
|
756
|
+
state: re(e),
|
|
757
|
+
colors: ue,
|
|
746
758
|
onClick: Qe,
|
|
747
759
|
onMouseEnter: ot,
|
|
748
760
|
onMouseLeave: it
|
|
@@ -752,77 +764,77 @@ const Nt = ({
|
|
|
752
764
|
]
|
|
753
765
|
}
|
|
754
766
|
),
|
|
755
|
-
|
|
756
|
-
|
|
767
|
+
w && /* @__PURE__ */ f(
|
|
768
|
+
He,
|
|
757
769
|
{
|
|
758
|
-
visible:
|
|
759
|
-
x:
|
|
760
|
-
y:
|
|
761
|
-
seat:
|
|
762
|
-
currency:
|
|
763
|
-
state:
|
|
770
|
+
visible: te.visible,
|
|
771
|
+
x: te.x,
|
|
772
|
+
y: te.y,
|
|
773
|
+
seat: te.seat,
|
|
774
|
+
currency: ue.currency,
|
|
775
|
+
state: te.state
|
|
764
776
|
}
|
|
765
777
|
),
|
|
766
|
-
|
|
767
|
-
|
|
778
|
+
se && m && /* @__PURE__ */ f(
|
|
779
|
+
Ue,
|
|
768
780
|
{
|
|
769
|
-
scale:
|
|
770
|
-
minScale:
|
|
771
|
-
maxScale:
|
|
781
|
+
scale: $,
|
|
782
|
+
minScale: K,
|
|
783
|
+
maxScale: A,
|
|
772
784
|
onZoomIn: et,
|
|
773
785
|
onZoomOut: tt,
|
|
774
|
-
position:
|
|
775
|
-
className:
|
|
786
|
+
position: ae,
|
|
787
|
+
className: ce
|
|
776
788
|
}
|
|
777
789
|
),
|
|
778
|
-
|
|
790
|
+
oe.length > 0 && /* @__PURE__ */ D("div", { className: "absolute top-4 right-4 bg-white dark:bg-gray-800 p-4 rounded shadow-lg", children: [
|
|
779
791
|
/* @__PURE__ */ D("h3", { className: "font-semibold mb-2", children: [
|
|
780
792
|
"Selected Seats (",
|
|
781
|
-
|
|
793
|
+
oe.length,
|
|
782
794
|
")"
|
|
783
795
|
] }),
|
|
784
|
-
/* @__PURE__ */
|
|
796
|
+
/* @__PURE__ */ f("div", { className: "max-h-48 overflow-y-auto space-y-1", children: oe.map((e) => /* @__PURE__ */ D("div", { className: "text-sm", children: [
|
|
785
797
|
e.seatNumber,
|
|
786
|
-
e.price && ` - ${
|
|
798
|
+
e.price && ` - ${ue.currency} ${e.price.toFixed(2)}`
|
|
787
799
|
] }, e.id)) })
|
|
788
800
|
] })
|
|
789
801
|
]
|
|
790
802
|
}
|
|
791
803
|
);
|
|
792
804
|
};
|
|
793
|
-
let
|
|
805
|
+
let ie = null;
|
|
794
806
|
function $t(n) {
|
|
795
|
-
|
|
807
|
+
ie = n;
|
|
796
808
|
}
|
|
797
|
-
function
|
|
798
|
-
if (!
|
|
809
|
+
function Me() {
|
|
810
|
+
if (!ie)
|
|
799
811
|
throw new Error(
|
|
800
812
|
"Firebase database not initialized. Call initializeFirebaseForViewer(db) first."
|
|
801
813
|
);
|
|
802
|
-
return
|
|
814
|
+
return ie;
|
|
803
815
|
}
|
|
804
|
-
function
|
|
805
|
-
return
|
|
816
|
+
function Ee() {
|
|
817
|
+
return ie !== null;
|
|
806
818
|
}
|
|
807
819
|
function kt() {
|
|
808
|
-
|
|
820
|
+
ie = null;
|
|
809
821
|
}
|
|
810
|
-
function
|
|
811
|
-
if (n.length !==
|
|
812
|
-
const t = [...n].sort(),
|
|
813
|
-
return t.every((d,
|
|
822
|
+
function Ce(n, o) {
|
|
823
|
+
if (n.length !== o.length) return !1;
|
|
824
|
+
const t = [...n].sort(), r = [...o].sort();
|
|
825
|
+
return t.every((d, c) => d === r[c]);
|
|
814
826
|
}
|
|
815
|
-
function Mt(n,
|
|
816
|
-
const t = [],
|
|
817
|
-
return Object.entries(n).forEach(([
|
|
818
|
-
|
|
827
|
+
function Mt(n, o) {
|
|
828
|
+
const t = [], r = [], d = [];
|
|
829
|
+
return Object.entries(n).forEach(([c, s]) => {
|
|
830
|
+
s && typeof s == "object" && s.state && (s.state === "unavailable" ? d.push(c) : s.state === "reserved" && (o && s.userId === o ? t.push(c) : r.push(c)));
|
|
819
831
|
}), {
|
|
820
832
|
myReserved: t.sort(),
|
|
821
|
-
otherReserved:
|
|
833
|
+
otherReserved: r.sort(),
|
|
822
834
|
unavailable: d.sort()
|
|
823
835
|
};
|
|
824
836
|
}
|
|
825
|
-
const
|
|
837
|
+
const be = {
|
|
826
838
|
states: null,
|
|
827
839
|
loading: !0,
|
|
828
840
|
error: null,
|
|
@@ -833,182 +845,182 @@ const ue = {
|
|
|
833
845
|
};
|
|
834
846
|
function Et(n) {
|
|
835
847
|
const {
|
|
836
|
-
seatMapId:
|
|
848
|
+
seatMapId: o,
|
|
837
849
|
currentUserId: t,
|
|
838
|
-
enabled:
|
|
850
|
+
enabled: r = !0,
|
|
839
851
|
onStateChange: d,
|
|
840
|
-
onError:
|
|
841
|
-
} = n,
|
|
842
|
-
|
|
843
|
-
const
|
|
844
|
-
(
|
|
845
|
-
if (!
|
|
846
|
-
return (
|
|
852
|
+
onError: c
|
|
853
|
+
} = n, s = P({ ...be }), v = P(d), h = P(c), i = P(t);
|
|
854
|
+
v.current = d, h.current = c, i.current = t;
|
|
855
|
+
const b = T(
|
|
856
|
+
(m) => {
|
|
857
|
+
if (!r || !o)
|
|
858
|
+
return (s.current.loading !== !1 || s.current.states !== null) && (s.current = { ...be, loading: !1 }, m()), () => {
|
|
847
859
|
};
|
|
848
|
-
if (!
|
|
849
|
-
const
|
|
850
|
-
return
|
|
851
|
-
...
|
|
860
|
+
if (!Ee()) {
|
|
861
|
+
const F = "Firebase not initialized. Call initializeFirebaseForViewer first.";
|
|
862
|
+
return s.current.error?.message !== F && (s.current = {
|
|
863
|
+
...be,
|
|
852
864
|
loading: !1,
|
|
853
|
-
error: new Error(
|
|
854
|
-
},
|
|
865
|
+
error: new Error(F)
|
|
866
|
+
}, m()), () => {
|
|
855
867
|
};
|
|
856
868
|
}
|
|
857
|
-
const
|
|
858
|
-
return
|
|
859
|
-
const L =
|
|
869
|
+
const M = Me(), g = Re(M, `seatmaps/${o}/seat_states`);
|
|
870
|
+
return We(g, (F) => {
|
|
871
|
+
const L = F.val() || {}, N = Mt(
|
|
860
872
|
L,
|
|
861
|
-
|
|
862
|
-
), Y =
|
|
863
|
-
(Y.loading || !
|
|
873
|
+
i.current
|
|
874
|
+
), Y = s.current;
|
|
875
|
+
(Y.loading || !Ce(Y.myReservedSeats, N.myReserved) || !Ce(
|
|
864
876
|
Y.otherReservedSeats,
|
|
865
|
-
|
|
866
|
-
) || !
|
|
877
|
+
N.otherReserved
|
|
878
|
+
) || !Ce(Y.unavailableSeats, N.unavailable)) && (s.current = {
|
|
867
879
|
states: L,
|
|
868
880
|
loading: !1,
|
|
869
881
|
error: null,
|
|
870
882
|
lastUpdated: Date.now(),
|
|
871
|
-
myReservedSeats:
|
|
872
|
-
otherReservedSeats:
|
|
873
|
-
unavailableSeats:
|
|
874
|
-
},
|
|
875
|
-
}, (
|
|
876
|
-
|
|
877
|
-
...
|
|
883
|
+
myReservedSeats: N.myReserved,
|
|
884
|
+
otherReservedSeats: N.otherReserved,
|
|
885
|
+
unavailableSeats: N.unavailable
|
|
886
|
+
}, v.current?.(L), m());
|
|
887
|
+
}, (F) => {
|
|
888
|
+
s.current = {
|
|
889
|
+
...s.current,
|
|
878
890
|
loading: !1,
|
|
879
|
-
error:
|
|
880
|
-
},
|
|
891
|
+
error: F
|
|
892
|
+
}, h.current?.(F), m();
|
|
881
893
|
}), () => {
|
|
882
|
-
|
|
894
|
+
Xe(g);
|
|
883
895
|
};
|
|
884
896
|
},
|
|
885
|
-
[
|
|
897
|
+
[o, r]
|
|
886
898
|
// Don't include currentUserId - we use currentUserIdRef.current which is always up-to-date
|
|
887
|
-
),
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
899
|
+
), y = T(() => s.current, []), u = T(() => be, []), w = gt(
|
|
900
|
+
b,
|
|
901
|
+
y,
|
|
902
|
+
u
|
|
891
903
|
);
|
|
892
904
|
return {
|
|
893
|
-
states:
|
|
894
|
-
loading:
|
|
895
|
-
error:
|
|
896
|
-
lastUpdated:
|
|
897
|
-
myReservedSeats:
|
|
898
|
-
otherReservedSeats:
|
|
899
|
-
unavailableSeats:
|
|
905
|
+
states: w.states,
|
|
906
|
+
loading: w.loading,
|
|
907
|
+
error: w.error,
|
|
908
|
+
lastUpdated: w.lastUpdated,
|
|
909
|
+
myReservedSeats: w.myReservedSeats,
|
|
910
|
+
otherReservedSeats: w.otherReservedSeats,
|
|
911
|
+
unavailableSeats: w.unavailableSeats,
|
|
900
912
|
// Legacy alias
|
|
901
|
-
reservedSeats:
|
|
913
|
+
reservedSeats: w.otherReservedSeats
|
|
902
914
|
};
|
|
903
915
|
}
|
|
904
916
|
function It(n) {
|
|
905
917
|
const {
|
|
906
|
-
seatMapId:
|
|
918
|
+
seatMapId: o,
|
|
907
919
|
enabled: t = !0,
|
|
908
|
-
subscribeToChanges:
|
|
920
|
+
subscribeToChanges: r = !1,
|
|
909
921
|
onConfigLoad: d,
|
|
910
|
-
onError:
|
|
911
|
-
} = n, [
|
|
912
|
-
|
|
913
|
-
const
|
|
914
|
-
if (!
|
|
915
|
-
if (!
|
|
916
|
-
|
|
922
|
+
onError: c
|
|
923
|
+
} = n, [s, v] = W(null), [h, i] = W(!0), [b, y] = W(null), u = P(d), w = P(c);
|
|
924
|
+
u.current = d, w.current = c;
|
|
925
|
+
const m = T(async () => {
|
|
926
|
+
if (!o) return;
|
|
927
|
+
if (!Ee()) {
|
|
928
|
+
y(
|
|
917
929
|
new Error(
|
|
918
930
|
"Firebase not initialized. Call initializeFirebaseForViewer first."
|
|
919
931
|
)
|
|
920
|
-
),
|
|
932
|
+
), i(!1);
|
|
921
933
|
return;
|
|
922
934
|
}
|
|
923
|
-
const
|
|
935
|
+
const M = Me(), g = Re(M, `seatmaps/${o}`);
|
|
924
936
|
try {
|
|
925
|
-
|
|
926
|
-
const R = (await mt(
|
|
937
|
+
i(!0), y(null);
|
|
938
|
+
const R = (await mt(g)).val();
|
|
927
939
|
if (R) {
|
|
928
|
-
const
|
|
929
|
-
|
|
940
|
+
const F = St(R);
|
|
941
|
+
v(F), u.current?.(F);
|
|
930
942
|
} else
|
|
931
|
-
|
|
932
|
-
} catch (
|
|
933
|
-
const R =
|
|
934
|
-
|
|
943
|
+
y(new Error(`Seat map ${o} not found in Firebase`));
|
|
944
|
+
} catch (I) {
|
|
945
|
+
const R = I instanceof Error ? I : new Error("Unknown error");
|
|
946
|
+
y(R), w.current?.(R);
|
|
935
947
|
} finally {
|
|
936
|
-
|
|
948
|
+
i(!1);
|
|
937
949
|
}
|
|
938
|
-
}, [
|
|
939
|
-
return
|
|
940
|
-
if (!t || !
|
|
941
|
-
|
|
950
|
+
}, [o]);
|
|
951
|
+
return U(() => {
|
|
952
|
+
if (!t || !o) {
|
|
953
|
+
i(!1);
|
|
942
954
|
return;
|
|
943
955
|
}
|
|
944
|
-
if (
|
|
945
|
-
const
|
|
946
|
-
let
|
|
947
|
-
return
|
|
948
|
-
if (
|
|
949
|
-
|
|
956
|
+
if (m(), r && Ee()) {
|
|
957
|
+
const M = Me(), g = Re(M, `seatmaps/${o}/meta/updated_at`);
|
|
958
|
+
let I = !0, R = null;
|
|
959
|
+
return We(g, (E) => {
|
|
960
|
+
if (I) {
|
|
961
|
+
I = !1, R = E.val();
|
|
950
962
|
return;
|
|
951
963
|
}
|
|
952
|
-
const L =
|
|
953
|
-
|
|
964
|
+
const L = E.val();
|
|
965
|
+
E.exists() && L !== R && (R = L, m());
|
|
954
966
|
}), () => {
|
|
955
|
-
|
|
967
|
+
Xe(g);
|
|
956
968
|
};
|
|
957
969
|
}
|
|
958
|
-
}, [
|
|
959
|
-
config:
|
|
960
|
-
loading:
|
|
961
|
-
error:
|
|
962
|
-
refetch:
|
|
970
|
+
}, [o, t, r]), {
|
|
971
|
+
config: s,
|
|
972
|
+
loading: h,
|
|
973
|
+
error: b,
|
|
974
|
+
refetch: m
|
|
963
975
|
};
|
|
964
976
|
}
|
|
965
977
|
function Wt(n) {
|
|
966
978
|
const {
|
|
967
|
-
seatMapId:
|
|
979
|
+
seatMapId: o,
|
|
968
980
|
userId: t,
|
|
969
|
-
enabled:
|
|
981
|
+
enabled: r = !0,
|
|
970
982
|
subscribeToDesignChanges: d = !1,
|
|
971
|
-
onConfigLoad:
|
|
972
|
-
onStateChange:
|
|
973
|
-
onError:
|
|
983
|
+
onConfigLoad: c,
|
|
984
|
+
onStateChange: s,
|
|
985
|
+
onError: v
|
|
974
986
|
} = n, {
|
|
975
|
-
config:
|
|
976
|
-
loading:
|
|
977
|
-
error:
|
|
978
|
-
refetch:
|
|
987
|
+
config: h,
|
|
988
|
+
loading: i,
|
|
989
|
+
error: b,
|
|
990
|
+
refetch: y
|
|
979
991
|
} = It({
|
|
980
|
-
seatMapId:
|
|
981
|
-
enabled:
|
|
992
|
+
seatMapId: o,
|
|
993
|
+
enabled: r,
|
|
982
994
|
subscribeToChanges: d,
|
|
983
|
-
onConfigLoad:
|
|
984
|
-
onError:
|
|
995
|
+
onConfigLoad: c,
|
|
996
|
+
onError: v
|
|
985
997
|
}), {
|
|
986
|
-
states:
|
|
987
|
-
loading:
|
|
988
|
-
error:
|
|
989
|
-
lastUpdated:
|
|
990
|
-
myReservedSeats:
|
|
991
|
-
otherReservedSeats:
|
|
998
|
+
states: u,
|
|
999
|
+
loading: w,
|
|
1000
|
+
error: m,
|
|
1001
|
+
lastUpdated: M,
|
|
1002
|
+
myReservedSeats: g,
|
|
1003
|
+
otherReservedSeats: I,
|
|
992
1004
|
unavailableSeats: R,
|
|
993
|
-
reservedSeats:
|
|
1005
|
+
reservedSeats: F
|
|
994
1006
|
} = Et({
|
|
995
|
-
seatMapId:
|
|
1007
|
+
seatMapId: o,
|
|
996
1008
|
currentUserId: t,
|
|
997
|
-
enabled:
|
|
998
|
-
onStateChange:
|
|
999
|
-
onError:
|
|
1009
|
+
enabled: r,
|
|
1010
|
+
onStateChange: s,
|
|
1011
|
+
onError: v
|
|
1000
1012
|
});
|
|
1001
1013
|
return {
|
|
1002
|
-
config:
|
|
1003
|
-
loading:
|
|
1004
|
-
error:
|
|
1005
|
-
myReservedSeats:
|
|
1006
|
-
otherReservedSeats:
|
|
1014
|
+
config: h,
|
|
1015
|
+
loading: i || w,
|
|
1016
|
+
error: b || m,
|
|
1017
|
+
myReservedSeats: g,
|
|
1018
|
+
otherReservedSeats: I,
|
|
1007
1019
|
unavailableSeats: R,
|
|
1008
|
-
reservedSeats:
|
|
1009
|
-
seatStates:
|
|
1010
|
-
lastUpdated:
|
|
1011
|
-
refetch:
|
|
1020
|
+
reservedSeats: F,
|
|
1021
|
+
seatStates: u,
|
|
1022
|
+
lastUpdated: M,
|
|
1023
|
+
refetch: y
|
|
1012
1024
|
};
|
|
1013
1025
|
}
|
|
1014
1026
|
export {
|
|
@@ -1016,7 +1028,7 @@ export {
|
|
|
1016
1028
|
Nt as SeatMapViewer,
|
|
1017
1029
|
kt as clearFirebaseInstance,
|
|
1018
1030
|
$t as initializeFirebaseForViewer,
|
|
1019
|
-
|
|
1031
|
+
Ee as isFirebaseInitialized,
|
|
1020
1032
|
xt as useConfigFetcher,
|
|
1021
1033
|
wt as useContainerSize,
|
|
1022
1034
|
It as useFirebaseConfig,
|