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