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