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