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