@nice2dev/events 1.0.29 → 1.1.5
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/CHANGELOG.md +144 -0
- package/README.md +41 -10
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +699 -13
- package/dist/index.mjs +3475 -865
- package/package.json +16 -12
package/dist/index.mjs
CHANGED
|
@@ -1,842 +1,3444 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { NtdHeart as
|
|
3
|
-
import { NiceUpload as
|
|
4
|
-
import
|
|
5
|
-
import { NiceIcon as
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import { jsxs as a, jsx as e, Fragment as Ke } from "react/jsx-runtime";
|
|
2
|
+
import { NtdMove as bn, NtdHeart as dt, NtdTrash as Te, NtdPlay as wn, NtdImage as xn, NtdPlus as kn, NtdCheck as He, NtdHelp as Qe, NtdClose as ut, NtdSearch as mt, NtdQrCode as ht, NtdMail as In, NtdWheelchair as Cn, NtdSend as pt, NtdGiftCard as gt, NtdStar as ft, NtdLink as vt, NtdReceipt as yt, NtdCoins as _t, NtdArrowRight as Nt, NtdSparkle as Sn, NtdCamera as zn, NtdMicrophone as $n, NtdMusic as Re, NtdGamepad as An, NtdThumbsUp as bt, NtdClipboardCheck as wt, NtdMedal as dn, NtdTrophy as xt } from "@nice2dev/icons";
|
|
3
|
+
import { NiceUpload as qe, NiceTextInput as J, NiceCardGroup as Pn, NiceEmpty as kt, NiceButton as F, NiceSegmentedControl as Tn, NiceAvatarGroup as un, NiceAvatar as Be, NiceBadge as te, NiceSelect as Pe, NiceAmountBreakdown as It, NiceToggle as We, NiceTabs as Ct, NiceTextArea as Ze, NiceNumericInput as Je, NiceCollapse as St, NiceHtmlEditor as zt, NiceProgress as $t } from "@nice2dev/ui";
|
|
4
|
+
import Ue, { useState as E, useRef as ve, useCallback as G, forwardRef as ee, useMemo as X, useEffect as Oe } from "react";
|
|
5
|
+
import { NiceIcon as ie } from "@nice2dev/ui-core";
|
|
6
|
+
function At(s) {
|
|
7
|
+
return s.map((t, r) => ({ item: t, index: r, key: t.order ?? r })).sort((t, r) => t.key - r.key || t.index - r.index).map((t) => t.item);
|
|
8
|
+
}
|
|
9
|
+
function mn(s, t, r) {
|
|
10
|
+
if (t === r)
|
|
11
|
+
return [...s];
|
|
12
|
+
if (t < 0 || t >= s.length)
|
|
13
|
+
return [...s];
|
|
14
|
+
if (r < 0 || r >= s.length)
|
|
15
|
+
return [...s];
|
|
16
|
+
const n = [...s], [c] = n.splice(t, 1);
|
|
17
|
+
return n.splice(r, 0, c), n;
|
|
18
|
+
}
|
|
19
|
+
function Mn(s) {
|
|
20
|
+
const { items: t, onReorder: r, disabled: n = !1 } = s, [c, o] = E(null), [d, m] = E(null), [h, i] = E(!1), u = ve(null), p = G((w) => t.findIndex((k) => k.id === w), [t]), b = G(
|
|
21
|
+
(w, k) => {
|
|
22
|
+
const _ = p(w), $ = p(k);
|
|
23
|
+
_ < 0 || $ < 0 || _ === $ || r == null || r(mn([...t], _, $).map((l) => l.id));
|
|
24
|
+
},
|
|
25
|
+
[t, p, r]
|
|
26
|
+
), f = G(() => {
|
|
27
|
+
o(null), m(null), i(!1), u.current = null;
|
|
28
|
+
}, []), g = G(
|
|
29
|
+
(w, k) => ({
|
|
30
|
+
role: "button",
|
|
31
|
+
// Explicitly off: this is a pointer-driven control, and leaving the
|
|
32
|
+
// native HTML5 drag enabled would fight it on desktop.
|
|
33
|
+
draggable: !1,
|
|
34
|
+
tabIndex: n ? -1 : 0,
|
|
35
|
+
"aria-grabbed": c === w,
|
|
36
|
+
onPointerDown: (_) => {
|
|
37
|
+
var y, v;
|
|
38
|
+
if (n || _.button !== 0 && _.pointerType === "mouse")
|
|
39
|
+
return;
|
|
40
|
+
(v = (y = _.currentTarget).setPointerCapture) == null || v.call(y, _.pointerId), o(w), i(!0), u.current = t.map((A) => A.id);
|
|
41
|
+
const $ = () => {
|
|
42
|
+
window.removeEventListener("pointerup", $), window.removeEventListener("pointercancel", l), i(!1), o(null), m(null);
|
|
43
|
+
}, l = () => {
|
|
44
|
+
window.removeEventListener("pointerup", $), window.removeEventListener("pointercancel", l), u.current && (r == null || r(u.current)), f();
|
|
45
|
+
};
|
|
46
|
+
window.addEventListener("pointerup", $), window.addEventListener("pointercancel", l);
|
|
47
|
+
},
|
|
48
|
+
onPointerEnter: () => {
|
|
49
|
+
n || !c || c === w || (m(w), b(c, w));
|
|
50
|
+
},
|
|
51
|
+
onKeyDown: (_) => {
|
|
52
|
+
if (n)
|
|
53
|
+
return;
|
|
54
|
+
if (_.key === " " || _.key === "Enter") {
|
|
55
|
+
_.preventDefault(), c === w ? f() : (o(w), u.current = t.map((A) => A.id));
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
if (_.key === "Escape" && c === w) {
|
|
59
|
+
_.preventDefault(), u.current && (r == null || r(u.current)), f();
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
if (c !== w)
|
|
63
|
+
return;
|
|
64
|
+
const l = _.key === "ArrowLeft" || _.key === "ArrowUp" ? -1 : _.key === "ArrowRight" || _.key === "ArrowDown" ? 1 : 0;
|
|
65
|
+
if (l === 0)
|
|
66
|
+
return;
|
|
67
|
+
_.preventDefault();
|
|
68
|
+
const y = p(w), v = y + l;
|
|
69
|
+
v < 0 || v >= t.length || r == null || r(mn([...t], y, v).map((A) => A.id));
|
|
70
|
+
},
|
|
71
|
+
...k ? { "aria-label": k } : {}
|
|
72
|
+
}),
|
|
73
|
+
[c, b, n, f, p, t, r]
|
|
74
|
+
);
|
|
75
|
+
return { activeId: c, overId: d, getHandleProps: g, dragging: h };
|
|
76
|
+
}
|
|
77
|
+
const Pt = ({ item: s }) => {
|
|
78
|
+
const [t, r] = E(!1), n = s.thumbnailUrl ?? s.url;
|
|
79
|
+
return s.type === "video" ? /* @__PURE__ */ e("div", { className: "nice-event-media__video-thumb", children: /* @__PURE__ */ e(wn, { size: 26 }) }) : t || !n ? /* @__PURE__ */ e("div", { className: "nice-event-media__broken", title: "Image unavailable", children: /* @__PURE__ */ e(xn, { size: 24 }) }) : /* @__PURE__ */ e(
|
|
9
80
|
"img",
|
|
10
81
|
{
|
|
11
|
-
src:
|
|
12
|
-
alt:
|
|
82
|
+
src: n,
|
|
83
|
+
alt: s.caption ?? "",
|
|
13
84
|
className: "nice-event-media__thumb",
|
|
14
85
|
loading: "lazy",
|
|
15
|
-
onError: () =>
|
|
86
|
+
onError: () => r(!0)
|
|
16
87
|
}
|
|
17
88
|
);
|
|
18
|
-
},
|
|
19
|
-
function(
|
|
89
|
+
}, Si = ee(
|
|
90
|
+
function(t, r) {
|
|
20
91
|
const {
|
|
21
|
-
items:
|
|
22
|
-
onUpload:
|
|
23
|
-
onDelete:
|
|
24
|
-
onLike:
|
|
25
|
-
onItemClick:
|
|
26
|
-
layout:
|
|
27
|
-
uploadEnabled:
|
|
28
|
-
typeFilter:
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
92
|
+
items: n,
|
|
93
|
+
onUpload: c,
|
|
94
|
+
onDelete: o,
|
|
95
|
+
onLike: d,
|
|
96
|
+
onItemClick: m,
|
|
97
|
+
layout: h = "grid",
|
|
98
|
+
uploadEnabled: i = !0,
|
|
99
|
+
typeFilter: u = "all",
|
|
100
|
+
onReorder: p,
|
|
101
|
+
className: b,
|
|
102
|
+
style: f
|
|
103
|
+
} = t, [g, w] = E(""), k = X(() => At(n), [n]), _ = X(() => u === "all" ? k : k.filter((A) => A.type === u), [k, u]), $ = !!p && u === "all", l = Mn({ items: k, onReorder: p, disabled: !$ }), y = (A) => {
|
|
104
|
+
const I = A[0];
|
|
105
|
+
!I || !c || (c(I, g.trim() || void 0), w(""));
|
|
106
|
+
}, v = h === "list";
|
|
107
|
+
return /* @__PURE__ */ a(
|
|
36
108
|
"div",
|
|
37
109
|
{
|
|
38
|
-
ref:
|
|
39
|
-
className: `nice-event-media nice-event-media--${
|
|
40
|
-
style:
|
|
110
|
+
ref: r,
|
|
111
|
+
className: `nice-event-media nice-event-media--${h} ${b ?? ""}`,
|
|
112
|
+
style: f,
|
|
41
113
|
children: [
|
|
42
|
-
/* @__PURE__ */ e("div", { className: "nice-event-media__header", children: /* @__PURE__ */
|
|
114
|
+
/* @__PURE__ */ e("div", { className: "nice-event-media__header", children: /* @__PURE__ */ a("h3", { children: [
|
|
43
115
|
"Media (",
|
|
44
|
-
|
|
116
|
+
_.length,
|
|
45
117
|
")"
|
|
46
118
|
] }) }),
|
|
47
|
-
|
|
119
|
+
i && c && /* @__PURE__ */ a("div", { className: "nice-event-media__upload", children: [
|
|
48
120
|
/* @__PURE__ */ e(
|
|
49
|
-
|
|
121
|
+
qe,
|
|
50
122
|
{
|
|
51
123
|
accept: "image/*,video/*",
|
|
52
124
|
multiple: !1,
|
|
53
125
|
imagePreview: !1,
|
|
54
|
-
onFilesSelected:
|
|
126
|
+
onFilesSelected: y
|
|
55
127
|
}
|
|
56
128
|
),
|
|
57
|
-
/* @__PURE__ */ e(
|
|
129
|
+
/* @__PURE__ */ e(J, { value: g, onChange: w, placeholder: "Add a caption…" })
|
|
58
130
|
] }),
|
|
59
|
-
|
|
60
|
-
|
|
131
|
+
_.length === 0 ? /* @__PURE__ */ e("p", { className: "nice-event-media__empty", children: "No media yet." }) : /* @__PURE__ */ e(
|
|
132
|
+
Pn,
|
|
61
133
|
{
|
|
62
|
-
columns:
|
|
134
|
+
columns: v ? 1 : void 0,
|
|
63
135
|
minColumnWidth: 200,
|
|
64
136
|
gap: 12,
|
|
65
137
|
align: "stretch",
|
|
66
|
-
children:
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
"
|
|
138
|
+
children: _.map((A, I) => {
|
|
139
|
+
const D = $ ? l.getHandleProps(A.id, `Move ${A.caption ?? `item ${I + 1}`}`) : null;
|
|
140
|
+
return /* @__PURE__ */ a(
|
|
141
|
+
"div",
|
|
142
|
+
{
|
|
143
|
+
className: `nice-event-media__card${v ? " nice-event-media__card--row" : ""}${l.activeId === A.id ? " nice-event-media__card--dragging" : ""}`,
|
|
144
|
+
onClick: () => m == null ? void 0 : m(A),
|
|
145
|
+
onPointerEnter: D == null ? void 0 : D.onPointerEnter,
|
|
146
|
+
role: m ? "button" : void 0,
|
|
147
|
+
tabIndex: m ? 0 : void 0,
|
|
148
|
+
children: [
|
|
149
|
+
D && /* @__PURE__ */ e(
|
|
150
|
+
"span",
|
|
151
|
+
{
|
|
152
|
+
className: "nice-event-media__grip",
|
|
153
|
+
role: D.role,
|
|
154
|
+
tabIndex: D.tabIndex,
|
|
155
|
+
"aria-grabbed": D["aria-grabbed"],
|
|
156
|
+
"aria-label": D["aria-label"],
|
|
157
|
+
draggable: D.draggable,
|
|
158
|
+
onPointerDown: D.onPointerDown,
|
|
159
|
+
onKeyDown: D.onKeyDown,
|
|
160
|
+
onClick: (N) => N.stopPropagation(),
|
|
161
|
+
children: /* @__PURE__ */ e(bn, { size: 14 })
|
|
162
|
+
}
|
|
163
|
+
),
|
|
164
|
+
/* @__PURE__ */ e(Pt, { item: A }),
|
|
165
|
+
/* @__PURE__ */ a("div", { className: "nice-event-media__body", children: [
|
|
166
|
+
A.caption && /* @__PURE__ */ e("span", { className: "nice-event-media__caption", children: A.caption }),
|
|
167
|
+
A.uploadedByName && /* @__PURE__ */ e("span", { className: "nice-event-media__uploader", children: A.uploadedByName }),
|
|
168
|
+
/* @__PURE__ */ a("div", { className: "nice-event-media__actions", children: [
|
|
169
|
+
d && /* @__PURE__ */ a(
|
|
170
|
+
"button",
|
|
171
|
+
{
|
|
172
|
+
type: "button",
|
|
173
|
+
className: "nice-event-media__action",
|
|
174
|
+
onClick: (N) => {
|
|
175
|
+
N.stopPropagation(), d(A.id);
|
|
176
|
+
},
|
|
177
|
+
"aria-label": "Like",
|
|
178
|
+
children: [
|
|
179
|
+
/* @__PURE__ */ e(dt, { size: 15 }),
|
|
180
|
+
" ",
|
|
181
|
+
A.likes ?? 0
|
|
182
|
+
]
|
|
183
|
+
}
|
|
184
|
+
),
|
|
185
|
+
o && /* @__PURE__ */ e(
|
|
186
|
+
"button",
|
|
187
|
+
{
|
|
188
|
+
type: "button",
|
|
189
|
+
className: "nice-event-media__action nice-event-media__action--danger",
|
|
190
|
+
onClick: (N) => {
|
|
191
|
+
N.stopPropagation(), o(A.id);
|
|
192
|
+
},
|
|
193
|
+
"aria-label": "Delete",
|
|
194
|
+
children: /* @__PURE__ */ e(Te, { size: 15 })
|
|
195
|
+
}
|
|
196
|
+
)
|
|
197
|
+
] })
|
|
198
|
+
] })
|
|
199
|
+
]
|
|
200
|
+
},
|
|
201
|
+
A.id
|
|
202
|
+
);
|
|
203
|
+
})
|
|
204
|
+
}
|
|
205
|
+
)
|
|
206
|
+
]
|
|
207
|
+
}
|
|
208
|
+
);
|
|
209
|
+
}
|
|
210
|
+
), ye = ({
|
|
211
|
+
title: s,
|
|
212
|
+
description: t,
|
|
213
|
+
icon: r,
|
|
214
|
+
action: n,
|
|
215
|
+
className: c
|
|
216
|
+
}) => /* @__PURE__ */ e(
|
|
217
|
+
kt,
|
|
218
|
+
{
|
|
219
|
+
size: "sm",
|
|
220
|
+
title: s,
|
|
221
|
+
description: t,
|
|
222
|
+
icon: r,
|
|
223
|
+
action: n,
|
|
224
|
+
className: c
|
|
225
|
+
}
|
|
226
|
+
), zi = ee(
|
|
227
|
+
function(t, r) {
|
|
228
|
+
const {
|
|
229
|
+
items: n,
|
|
230
|
+
layout: c = "grid",
|
|
231
|
+
onReorder: o,
|
|
232
|
+
onItemAdd: d,
|
|
233
|
+
onItemRemove: m,
|
|
234
|
+
onCaptionChange: h,
|
|
235
|
+
onItemClick: i,
|
|
236
|
+
previewMode: u = !1,
|
|
237
|
+
transition: p = "fade",
|
|
238
|
+
defaultDurationMs: b = 3e3,
|
|
239
|
+
autoPlay: f = !0,
|
|
240
|
+
disabled: g = !1,
|
|
241
|
+
readOnly: w = !1,
|
|
242
|
+
size: k = "md",
|
|
243
|
+
className: _,
|
|
244
|
+
style: $
|
|
245
|
+
} = t, [l, y] = E(0), [v, A] = E(null), [I, D] = E(""), N = g || w, L = !!o && !N, V = Mn({ items: n, onReorder: o, disabled: !L }), B = n.length > 0 ? Math.min(l, n.length - 1) : 0, C = n[B], O = (C == null ? void 0 : C.durationMs) ?? b;
|
|
246
|
+
Oe(() => {
|
|
247
|
+
if (!u || !f || n.length < 2)
|
|
248
|
+
return;
|
|
249
|
+
const M = window.setTimeout(
|
|
250
|
+
() => y((j) => (j + 1) % n.length),
|
|
251
|
+
Math.max(250, O)
|
|
252
|
+
);
|
|
253
|
+
return () => window.clearTimeout(M);
|
|
254
|
+
}, [u, f, n.length, B, O]);
|
|
255
|
+
const z = X(
|
|
256
|
+
() => n.reduce((M, j) => M + (j.durationMs ?? b), 0),
|
|
257
|
+
[n, b]
|
|
258
|
+
), P = (M) => {
|
|
259
|
+
h == null || h(M, I), A(null), D("");
|
|
260
|
+
};
|
|
261
|
+
return n.length === 0 ? /* @__PURE__ */ e("div", { ref: r, className: `nice-media-collage ${_ ?? ""}`, style: $, children: /* @__PURE__ */ e(
|
|
262
|
+
ye,
|
|
263
|
+
{
|
|
264
|
+
icon: /* @__PURE__ */ e(xn, { size: 28 }),
|
|
265
|
+
title: "Nothing in the collage yet",
|
|
266
|
+
description: "Add photos or video to start arranging them.",
|
|
267
|
+
action: d && !N ? /* @__PURE__ */ e(qe, { accept: "image/*,video/*", multiple: !0, onFilesSelected: d }) : void 0
|
|
268
|
+
}
|
|
269
|
+
) }) : u ? /* @__PURE__ */ a(
|
|
270
|
+
"div",
|
|
271
|
+
{
|
|
272
|
+
ref: r,
|
|
273
|
+
className: `nice-media-collage nice-media-collage--preview nice-media-collage--${p} ${_ ?? ""}`,
|
|
274
|
+
style: $,
|
|
275
|
+
children: [
|
|
276
|
+
/* @__PURE__ */ a("div", { className: "nice-media-collage__stage", "aria-live": "polite", children: [
|
|
277
|
+
(C == null ? void 0 : C.type) === "video" ? /* @__PURE__ */ e(
|
|
278
|
+
"video",
|
|
279
|
+
{
|
|
280
|
+
className: "nice-media-collage__slide",
|
|
281
|
+
src: C.mediaUrl,
|
|
282
|
+
controls: !0
|
|
283
|
+
},
|
|
284
|
+
C.id
|
|
285
|
+
) : /* @__PURE__ */ e(
|
|
286
|
+
"img",
|
|
287
|
+
{
|
|
288
|
+
className: "nice-media-collage__slide",
|
|
289
|
+
src: C == null ? void 0 : C.mediaUrl,
|
|
290
|
+
alt: (C == null ? void 0 : C.caption) ?? ""
|
|
291
|
+
},
|
|
292
|
+
C == null ? void 0 : C.id
|
|
293
|
+
),
|
|
294
|
+
(C == null ? void 0 : C.caption) && /* @__PURE__ */ e("p", { className: "nice-media-collage__slide-caption", children: C.caption })
|
|
295
|
+
] }),
|
|
296
|
+
/* @__PURE__ */ a("div", { className: "nice-media-collage__playbar", children: [
|
|
297
|
+
/* @__PURE__ */ e(
|
|
298
|
+
F,
|
|
299
|
+
{
|
|
300
|
+
size: "sm",
|
|
301
|
+
variant: "ghost",
|
|
302
|
+
onClick: () => y((M) => (M - 1 + n.length) % n.length),
|
|
303
|
+
children: "Previous"
|
|
304
|
+
}
|
|
305
|
+
),
|
|
306
|
+
/* @__PURE__ */ a("span", { className: "nice-media-collage__counter", children: [
|
|
307
|
+
B + 1,
|
|
308
|
+
" / ",
|
|
309
|
+
n.length
|
|
310
|
+
] }),
|
|
311
|
+
/* @__PURE__ */ e(
|
|
312
|
+
F,
|
|
313
|
+
{
|
|
314
|
+
size: "sm",
|
|
315
|
+
variant: "ghost",
|
|
316
|
+
onClick: () => y((M) => (M + 1) % n.length),
|
|
317
|
+
children: "Next"
|
|
318
|
+
}
|
|
319
|
+
)
|
|
320
|
+
] })
|
|
321
|
+
]
|
|
322
|
+
}
|
|
323
|
+
) : /* @__PURE__ */ a(
|
|
324
|
+
"div",
|
|
325
|
+
{
|
|
326
|
+
ref: r,
|
|
327
|
+
className: `nice-media-collage nice-media-collage--${c} nice-media-collage--${k} ${_ ?? ""}`,
|
|
328
|
+
style: $,
|
|
329
|
+
children: [
|
|
330
|
+
/* @__PURE__ */ a("div", { className: "nice-media-collage__toolbar", children: [
|
|
331
|
+
/* @__PURE__ */ e(
|
|
332
|
+
Tn,
|
|
333
|
+
{
|
|
334
|
+
size: "sm",
|
|
335
|
+
value: c,
|
|
336
|
+
readOnly: !0,
|
|
337
|
+
options: [
|
|
338
|
+
{ value: "sequence", label: "Sequence" },
|
|
339
|
+
{ value: "grid", label: "Grid" },
|
|
340
|
+
{ value: "mosaic", label: "Mosaic" }
|
|
341
|
+
]
|
|
342
|
+
}
|
|
343
|
+
),
|
|
344
|
+
/* @__PURE__ */ a("span", { className: "nice-media-collage__duration", children: [
|
|
345
|
+
n.length,
|
|
346
|
+
" item",
|
|
347
|
+
n.length === 1 ? "" : "s",
|
|
348
|
+
" · ",
|
|
349
|
+
Math.round(z / 1e3),
|
|
350
|
+
"s"
|
|
351
|
+
] }),
|
|
352
|
+
d && !N && /* @__PURE__ */ e(
|
|
353
|
+
qe,
|
|
354
|
+
{
|
|
355
|
+
accept: "image/*,video/*",
|
|
356
|
+
multiple: !0,
|
|
357
|
+
imagePreview: !1,
|
|
358
|
+
onFilesSelected: d
|
|
359
|
+
}
|
|
360
|
+
)
|
|
361
|
+
] }),
|
|
362
|
+
/* @__PURE__ */ e(
|
|
363
|
+
"ol",
|
|
364
|
+
{
|
|
365
|
+
className: "nice-media-collage__tiles",
|
|
366
|
+
"aria-label": "Collage order",
|
|
367
|
+
"aria-busy": V.dragging,
|
|
368
|
+
children: n.map((M, j) => {
|
|
369
|
+
const W = L ? V.getHandleProps(M.id, `Move ${M.caption ?? `item ${j + 1}`}`) : null;
|
|
370
|
+
return /* @__PURE__ */ a(
|
|
371
|
+
"li",
|
|
372
|
+
{
|
|
373
|
+
className: `nice-media-collage__tile${V.activeId === M.id ? " nice-media-collage__tile--active" : ""}${V.overId === M.id ? " nice-media-collage__tile--over" : ""}`,
|
|
374
|
+
onPointerEnter: W == null ? void 0 : W.onPointerEnter,
|
|
375
|
+
children: [
|
|
376
|
+
/* @__PURE__ */ e("span", { className: "nice-media-collage__index", "aria-hidden": "true", children: j + 1 }),
|
|
377
|
+
/* @__PURE__ */ e(
|
|
378
|
+
"button",
|
|
379
|
+
{
|
|
380
|
+
type: "button",
|
|
381
|
+
className: "nice-media-collage__thumb-button",
|
|
382
|
+
onClick: () => i == null ? void 0 : i(M),
|
|
383
|
+
disabled: !i,
|
|
384
|
+
children: M.type === "video" ? /* @__PURE__ */ e("span", { className: "nice-media-collage__video-thumb", children: /* @__PURE__ */ e(wn, { size: 22 }) }) : /* @__PURE__ */ e(
|
|
385
|
+
"img",
|
|
386
|
+
{
|
|
387
|
+
className: "nice-media-collage__thumb",
|
|
388
|
+
src: M.mediaUrl,
|
|
389
|
+
alt: M.caption ?? "",
|
|
390
|
+
loading: "lazy"
|
|
391
|
+
}
|
|
392
|
+
)
|
|
393
|
+
}
|
|
394
|
+
),
|
|
395
|
+
v === M.id ? /* @__PURE__ */ e(
|
|
396
|
+
J,
|
|
397
|
+
{
|
|
398
|
+
value: I,
|
|
399
|
+
onChange: D,
|
|
400
|
+
placeholder: "Caption",
|
|
401
|
+
autoFocus: !0,
|
|
402
|
+
size: "sm",
|
|
403
|
+
onBlur: () => P(M.id),
|
|
404
|
+
onKeyDown: (S) => {
|
|
405
|
+
S.key === "Enter" && P(M.id), S.key === "Escape" && A(null);
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
) : /* @__PURE__ */ e(
|
|
409
|
+
"button",
|
|
410
|
+
{
|
|
411
|
+
type: "button",
|
|
412
|
+
className: "nice-media-collage__caption",
|
|
413
|
+
disabled: !h || N,
|
|
414
|
+
onClick: () => {
|
|
415
|
+
A(M.id), D(M.caption ?? "");
|
|
416
|
+
},
|
|
417
|
+
children: M.caption || /* @__PURE__ */ e("em", { children: "Add a caption" })
|
|
418
|
+
}
|
|
419
|
+
),
|
|
420
|
+
/* @__PURE__ */ a("div", { className: "nice-media-collage__tile-actions", children: [
|
|
421
|
+
W && /* @__PURE__ */ e(
|
|
422
|
+
"span",
|
|
81
423
|
{
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
d.likes ?? 0
|
|
92
|
-
]
|
|
424
|
+
className: "nice-media-collage__grip",
|
|
425
|
+
role: W.role,
|
|
426
|
+
tabIndex: W.tabIndex,
|
|
427
|
+
"aria-grabbed": W["aria-grabbed"],
|
|
428
|
+
"aria-label": W["aria-label"],
|
|
429
|
+
draggable: W.draggable,
|
|
430
|
+
onPointerDown: W.onPointerDown,
|
|
431
|
+
onKeyDown: W.onKeyDown,
|
|
432
|
+
children: /* @__PURE__ */ e(bn, { size: 14 })
|
|
93
433
|
}
|
|
94
434
|
),
|
|
95
|
-
|
|
96
|
-
|
|
435
|
+
m && !w && /* @__PURE__ */ e(
|
|
436
|
+
F,
|
|
97
437
|
{
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
children: /* @__PURE__ */ e(nn, { size: 15 })
|
|
438
|
+
size: "sm",
|
|
439
|
+
variant: "ghost",
|
|
440
|
+
ariaLabel: `Remove ${M.caption ?? `item ${j + 1}`}`,
|
|
441
|
+
disabled: g,
|
|
442
|
+
onClick: () => m(M.id),
|
|
443
|
+
children: /* @__PURE__ */ e(Te, { size: 14 })
|
|
105
444
|
}
|
|
106
445
|
)
|
|
107
446
|
] })
|
|
108
|
-
]
|
|
109
|
-
|
|
447
|
+
]
|
|
448
|
+
},
|
|
449
|
+
M.id
|
|
450
|
+
);
|
|
451
|
+
})
|
|
452
|
+
}
|
|
453
|
+
),
|
|
454
|
+
d && !N && n.length > 0 && /* @__PURE__ */ a("p", { className: "nice-media-collage__hint", children: [
|
|
455
|
+
/* @__PURE__ */ e(kn, { size: 12 }),
|
|
456
|
+
" Drag a tile, or focus one and press Space then the arrow keys."
|
|
457
|
+
] })
|
|
458
|
+
]
|
|
459
|
+
}
|
|
460
|
+
);
|
|
461
|
+
}
|
|
462
|
+
);
|
|
463
|
+
function Ee(s) {
|
|
464
|
+
const t = s.toLowerCase();
|
|
465
|
+
return ["active", "live", "published", "completed", "confirmed"].includes(t) ? "success" : ["cancelled", "canceled", "rejected", "failed"].includes(t) ? "error" : ["scheduled", "pending", "planning"].includes(t) ? "info" : ["draft", "archived"].includes(t) ? "secondary" : "warning";
|
|
466
|
+
}
|
|
467
|
+
const Tt = {
|
|
468
|
+
micro: [],
|
|
469
|
+
compact: ["details", "location", "budget"],
|
|
470
|
+
normal: ["details", "location", "schedule", "participants", "tasks", "surveys", "budget"],
|
|
471
|
+
full: [
|
|
472
|
+
"details",
|
|
473
|
+
"location",
|
|
474
|
+
"schedule",
|
|
475
|
+
"participants",
|
|
476
|
+
"tasks",
|
|
477
|
+
"surveys",
|
|
478
|
+
"vendors",
|
|
479
|
+
"budget",
|
|
480
|
+
"documents",
|
|
481
|
+
"settings"
|
|
482
|
+
]
|
|
483
|
+
}, $i = ee(
|
|
484
|
+
function(t, r) {
|
|
485
|
+
var an, sn, rn, ln, cn, on;
|
|
486
|
+
const {
|
|
487
|
+
event: n,
|
|
488
|
+
participants: c = [],
|
|
489
|
+
surveys: o = [],
|
|
490
|
+
billing: d = [],
|
|
491
|
+
scheduleItems: m = [],
|
|
492
|
+
tasks: h = [],
|
|
493
|
+
vendors: i = [],
|
|
494
|
+
documents: u = [],
|
|
495
|
+
displayMode: p = "normal",
|
|
496
|
+
tabs: b,
|
|
497
|
+
activeTab: f,
|
|
498
|
+
onTabChange: g,
|
|
499
|
+
tabsIconOnly: w = !0,
|
|
500
|
+
tabsCentered: k = "auto",
|
|
501
|
+
countLocation: _ = "bottom",
|
|
502
|
+
showDetails: $ = !0,
|
|
503
|
+
showLocation: l = !0,
|
|
504
|
+
showSchedule: y = !0,
|
|
505
|
+
showParticipants: v = !0,
|
|
506
|
+
showTasks: A = !0,
|
|
507
|
+
showSurveys: I = !0,
|
|
508
|
+
showVendors: D = !0,
|
|
509
|
+
showBudget: N = !0,
|
|
510
|
+
showDocuments: L = !0,
|
|
511
|
+
showSettings: V = !0,
|
|
512
|
+
editable: B = !1,
|
|
513
|
+
onSave: C,
|
|
514
|
+
onPublish: O,
|
|
515
|
+
onShare: z,
|
|
516
|
+
onExport: P,
|
|
517
|
+
onUpdateEvent: M,
|
|
518
|
+
onUpdateLocation: j,
|
|
519
|
+
onAddSurvey: W,
|
|
520
|
+
onSurveyRespond: S,
|
|
521
|
+
onAddBilling: Y,
|
|
522
|
+
className: q,
|
|
523
|
+
style: Q
|
|
524
|
+
} = t, [R, ne] = E(n.title), [H, _e] = E(n.description ?? ""), [le, me] = E(n.startDate ?? ""), [Ne, Me] = E(n.endDate ?? ""), [be, he] = E(((an = n.location) == null ? void 0 : an.name) ?? ""), [we, Ve] = E(((sn = n.location) == null ? void 0 : sn.address) ?? ""), [pe, oe] = E(((rn = n.location) == null ? void 0 : rn.virtualUrl) ?? ""), [re, Ie] = E(((ln = n.location) == null ? void 0 : ln.isVirtual) ?? !1), [ge, Ce] = E(""), [fe, Fe] = E("single"), [Se, ze] = E(""), [de, $e] = E(""), [xe, T] = E(""), [U, K] = E("PLN"), Z = {
|
|
525
|
+
details: $,
|
|
526
|
+
location: l,
|
|
527
|
+
schedule: y,
|
|
528
|
+
participants: v,
|
|
529
|
+
tasks: A,
|
|
530
|
+
surveys: I,
|
|
531
|
+
vendors: D,
|
|
532
|
+
budget: N,
|
|
533
|
+
documents: L,
|
|
534
|
+
settings: V
|
|
535
|
+
}, ue = (b ?? Tt[p]).filter((x) => Z[x] !== !1), [De, On] = E(ue[0] ?? "details"), Rn = f ?? De, Un = G(
|
|
536
|
+
(x) => {
|
|
537
|
+
const ce = x;
|
|
538
|
+
f === void 0 && On(ce), g == null || g(ce);
|
|
539
|
+
},
|
|
540
|
+
[f, g]
|
|
541
|
+
), Yn = G(() => {
|
|
542
|
+
M == null || M({
|
|
543
|
+
title: R,
|
|
544
|
+
description: H || void 0,
|
|
545
|
+
startDate: le || void 0,
|
|
546
|
+
endDate: Ne || void 0
|
|
547
|
+
});
|
|
548
|
+
}, [R, H, le, Ne, M]), Xn = G(() => {
|
|
549
|
+
j == null || j({
|
|
550
|
+
name: be,
|
|
551
|
+
address: we || void 0,
|
|
552
|
+
virtualUrl: pe || void 0,
|
|
553
|
+
isVirtual: re
|
|
554
|
+
});
|
|
555
|
+
}, [be, we, pe, re, j]), Vn = G(() => {
|
|
556
|
+
if (!ge.trim() || !W)
|
|
557
|
+
return;
|
|
558
|
+
const x = Se.split(",").map((ce) => ce.trim()).filter(Boolean);
|
|
559
|
+
W(ge.trim(), fe, x.length > 0 ? x : void 0), Ce(""), ze("");
|
|
560
|
+
}, [ge, fe, Se, W]), Fn = G(() => {
|
|
561
|
+
!de.trim() || !Y || (Y({
|
|
562
|
+
label: de.trim(),
|
|
563
|
+
amount: parseFloat(xe) || 0,
|
|
564
|
+
currency: U
|
|
565
|
+
}), $e(""), T(""));
|
|
566
|
+
}, [de, xe, U, Y]), Wn = X(
|
|
567
|
+
() => d.map((x) => ({
|
|
568
|
+
label: x.label,
|
|
569
|
+
amount: x.amount
|
|
570
|
+
})),
|
|
571
|
+
[d]
|
|
572
|
+
), qn = X(() => d.reduce((x, ce) => x + ce.amount, 0), [d]), jn = ((cn = d[0]) == null ? void 0 : cn.currency) ?? "PLN", Gn = /* @__PURE__ */ a("div", { className: "nice-event-planning__form", children: [
|
|
573
|
+
/* @__PURE__ */ e(
|
|
574
|
+
J,
|
|
575
|
+
{
|
|
576
|
+
label: "Title",
|
|
577
|
+
value: R,
|
|
578
|
+
onChange: ne,
|
|
579
|
+
readOnly: !B
|
|
580
|
+
}
|
|
581
|
+
),
|
|
582
|
+
/* @__PURE__ */ e(
|
|
583
|
+
Ze,
|
|
584
|
+
{
|
|
585
|
+
label: "Description",
|
|
586
|
+
value: H,
|
|
587
|
+
onChange: _e,
|
|
588
|
+
readOnly: !B,
|
|
589
|
+
rows: 3
|
|
590
|
+
}
|
|
591
|
+
),
|
|
592
|
+
/* @__PURE__ */ a("div", { className: "nice-event-planning__row", children: [
|
|
593
|
+
/* @__PURE__ */ a("label", { className: "nice-field", children: [
|
|
594
|
+
/* @__PURE__ */ e("span", { className: "nice-field__label", children: "Start" }),
|
|
595
|
+
/* @__PURE__ */ e(
|
|
596
|
+
"input",
|
|
597
|
+
{
|
|
598
|
+
className: "nice-input",
|
|
599
|
+
type: "datetime-local",
|
|
600
|
+
value: le,
|
|
601
|
+
onChange: (x) => me(x.target.value),
|
|
602
|
+
readOnly: !B
|
|
603
|
+
}
|
|
604
|
+
)
|
|
605
|
+
] }),
|
|
606
|
+
/* @__PURE__ */ a("label", { className: "nice-field", children: [
|
|
607
|
+
/* @__PURE__ */ e("span", { className: "nice-field__label", children: "End" }),
|
|
608
|
+
/* @__PURE__ */ e(
|
|
609
|
+
"input",
|
|
610
|
+
{
|
|
611
|
+
className: "nice-input",
|
|
612
|
+
type: "datetime-local",
|
|
613
|
+
value: Ne,
|
|
614
|
+
onChange: (x) => Me(x.target.value),
|
|
615
|
+
readOnly: !B
|
|
616
|
+
}
|
|
617
|
+
)
|
|
618
|
+
] })
|
|
619
|
+
] }),
|
|
620
|
+
B && /* @__PURE__ */ e(
|
|
621
|
+
F,
|
|
622
|
+
{
|
|
623
|
+
variant: "primary",
|
|
624
|
+
leftIcon: /* @__PURE__ */ e(ie, { name: "check", size: "sm" }),
|
|
625
|
+
onClick: Yn,
|
|
626
|
+
children: "Save details"
|
|
627
|
+
}
|
|
628
|
+
)
|
|
629
|
+
] }), Kn = /* @__PURE__ */ a("div", { className: "nice-event-planning__form", children: [
|
|
630
|
+
/* @__PURE__ */ e(
|
|
631
|
+
We,
|
|
632
|
+
{
|
|
633
|
+
label: "Virtual event",
|
|
634
|
+
checked: re,
|
|
635
|
+
onChange: Ie,
|
|
636
|
+
disabled: !B
|
|
637
|
+
}
|
|
638
|
+
),
|
|
639
|
+
/* @__PURE__ */ e(
|
|
640
|
+
J,
|
|
641
|
+
{
|
|
642
|
+
label: "Venue name",
|
|
643
|
+
value: be,
|
|
644
|
+
onChange: he,
|
|
645
|
+
readOnly: !B
|
|
646
|
+
}
|
|
647
|
+
),
|
|
648
|
+
re ? /* @__PURE__ */ e(
|
|
649
|
+
J,
|
|
650
|
+
{
|
|
651
|
+
label: "Virtual URL",
|
|
652
|
+
value: pe,
|
|
653
|
+
onChange: oe,
|
|
654
|
+
readOnly: !B
|
|
655
|
+
}
|
|
656
|
+
) : /* @__PURE__ */ e(
|
|
657
|
+
J,
|
|
658
|
+
{
|
|
659
|
+
label: "Address",
|
|
660
|
+
value: we,
|
|
661
|
+
onChange: Ve,
|
|
662
|
+
readOnly: !B
|
|
663
|
+
}
|
|
664
|
+
),
|
|
665
|
+
B && /* @__PURE__ */ e(
|
|
666
|
+
F,
|
|
667
|
+
{
|
|
668
|
+
variant: "primary",
|
|
669
|
+
leftIcon: /* @__PURE__ */ e(ie, { name: "check", size: "sm" }),
|
|
670
|
+
onClick: Xn,
|
|
671
|
+
children: "Save location"
|
|
672
|
+
}
|
|
673
|
+
)
|
|
674
|
+
] }), Hn = /* @__PURE__ */ e("div", { className: "nice-event-planning__participants", children: c.length === 0 ? /* @__PURE__ */ e("p", { className: "nice-event-planning__empty", children: "No participants yet." }) : /* @__PURE__ */ a(Ke, { children: [
|
|
675
|
+
/* @__PURE__ */ e(un, { max: 8, children: c.map((x) => /* @__PURE__ */ e(Be, { name: x.name, src: x.avatarUrl }, x.id)) }),
|
|
676
|
+
/* @__PURE__ */ e("ul", { className: "nice-event-planning__participant-list", children: c.map((x) => /* @__PURE__ */ a("li", { className: "nice-event-planning__participant", children: [
|
|
677
|
+
/* @__PURE__ */ e(Be, { name: x.name, src: x.avatarUrl, size: "sm" }),
|
|
678
|
+
/* @__PURE__ */ e("span", { className: "nice-event-planning__participant-name", children: x.name }),
|
|
679
|
+
/* @__PURE__ */ e(te, { size: "xs", subtle: !0, variant: Ee(x.status), children: x.status })
|
|
680
|
+
] }, x.id)) })
|
|
681
|
+
] }) }), Qn = /* @__PURE__ */ a("div", { className: "nice-event-planning__form", children: [
|
|
682
|
+
o.length === 0 ? /* @__PURE__ */ e("p", { className: "nice-event-planning__empty", children: "No surveys yet." }) : o.map((x) => /* @__PURE__ */ a("div", { className: "nice-event-planning__survey", children: [
|
|
683
|
+
/* @__PURE__ */ e("strong", { children: x.question }),
|
|
684
|
+
" ",
|
|
685
|
+
/* @__PURE__ */ e(te, { size: "xs", outline: !0, variant: "info", children: x.type }),
|
|
686
|
+
x.options && /* @__PURE__ */ e("div", { className: "nice-event-planning__survey-options", children: x.options.map((ce, ot) => /* @__PURE__ */ e(
|
|
687
|
+
F,
|
|
688
|
+
{
|
|
689
|
+
size: "sm",
|
|
690
|
+
variant: "outline",
|
|
691
|
+
onClick: () => S == null ? void 0 : S(x.id, ce),
|
|
692
|
+
children: ce
|
|
693
|
+
},
|
|
694
|
+
ot
|
|
695
|
+
)) }),
|
|
696
|
+
x.responses && /* @__PURE__ */ a("span", { className: "nice-event-planning__muted", children: [
|
|
697
|
+
x.responses.length,
|
|
698
|
+
" responses"
|
|
699
|
+
] })
|
|
700
|
+
] }, x.id)),
|
|
701
|
+
B && W && /* @__PURE__ */ a("div", { className: "nice-event-planning__form", children: [
|
|
702
|
+
/* @__PURE__ */ e(
|
|
703
|
+
J,
|
|
704
|
+
{
|
|
705
|
+
label: "New survey question",
|
|
706
|
+
value: ge,
|
|
707
|
+
onChange: Ce,
|
|
708
|
+
placeholder: "Question"
|
|
709
|
+
}
|
|
710
|
+
),
|
|
711
|
+
/* @__PURE__ */ e(
|
|
712
|
+
Pe,
|
|
713
|
+
{
|
|
714
|
+
label: "Type",
|
|
715
|
+
value: fe,
|
|
716
|
+
onChange: (x) => Fe(x),
|
|
717
|
+
options: [
|
|
718
|
+
{ value: "single", label: "Single choice" },
|
|
719
|
+
{ value: "multiple", label: "Multiple choice" },
|
|
720
|
+
{ value: "text", label: "Free text" },
|
|
721
|
+
{ value: "rating", label: "Rating" }
|
|
722
|
+
]
|
|
723
|
+
}
|
|
724
|
+
),
|
|
725
|
+
/* @__PURE__ */ e(
|
|
726
|
+
J,
|
|
727
|
+
{
|
|
728
|
+
label: "Options (comma-separated)",
|
|
729
|
+
value: Se,
|
|
730
|
+
onChange: ze,
|
|
731
|
+
placeholder: "Yes, No, Maybe"
|
|
732
|
+
}
|
|
733
|
+
),
|
|
734
|
+
/* @__PURE__ */ e(
|
|
735
|
+
F,
|
|
736
|
+
{
|
|
737
|
+
variant: "primary",
|
|
738
|
+
leftIcon: /* @__PURE__ */ e(ie, { name: "plus", size: "sm" }),
|
|
739
|
+
onClick: Vn,
|
|
740
|
+
disabled: !ge.trim(),
|
|
741
|
+
children: "Add survey"
|
|
742
|
+
}
|
|
743
|
+
)
|
|
744
|
+
] })
|
|
745
|
+
] }), Zn = /* @__PURE__ */ a("div", { className: "nice-event-planning__form", children: [
|
|
746
|
+
d.length === 0 ? /* @__PURE__ */ e("p", { className: "nice-event-planning__empty", children: "No billing items yet." }) : /* @__PURE__ */ e(
|
|
747
|
+
It,
|
|
748
|
+
{
|
|
749
|
+
lines: [...Wn, { label: "Total", amount: qn, isSummary: !0 }],
|
|
750
|
+
currency: jn
|
|
751
|
+
}
|
|
752
|
+
),
|
|
753
|
+
B && Y && /* @__PURE__ */ a("div", { className: "nice-event-planning__row", children: [
|
|
754
|
+
/* @__PURE__ */ e(
|
|
755
|
+
J,
|
|
756
|
+
{
|
|
757
|
+
label: "Item",
|
|
758
|
+
value: de,
|
|
759
|
+
onChange: $e,
|
|
760
|
+
placeholder: "Catering"
|
|
761
|
+
}
|
|
762
|
+
),
|
|
763
|
+
/* @__PURE__ */ e(
|
|
764
|
+
J,
|
|
765
|
+
{
|
|
766
|
+
label: "Amount",
|
|
767
|
+
value: xe,
|
|
768
|
+
onChange: T,
|
|
769
|
+
placeholder: "0.00"
|
|
770
|
+
}
|
|
771
|
+
),
|
|
772
|
+
/* @__PURE__ */ e(
|
|
773
|
+
Pe,
|
|
774
|
+
{
|
|
775
|
+
label: "Currency",
|
|
776
|
+
value: U,
|
|
777
|
+
onChange: (x) => K(x),
|
|
778
|
+
options: ["PLN", "EUR", "USD", "GBP"]
|
|
779
|
+
}
|
|
780
|
+
),
|
|
781
|
+
/* @__PURE__ */ e(
|
|
782
|
+
F,
|
|
783
|
+
{
|
|
784
|
+
variant: "primary",
|
|
785
|
+
leftIcon: /* @__PURE__ */ e(ie, { name: "plus", size: "sm" }),
|
|
786
|
+
onClick: Fn,
|
|
787
|
+
disabled: !de.trim(),
|
|
788
|
+
children: "Add"
|
|
789
|
+
}
|
|
790
|
+
)
|
|
791
|
+
] })
|
|
792
|
+
] }), Jn = /* @__PURE__ */ a("div", { className: "nice-event-planning__form", children: [
|
|
793
|
+
/* @__PURE__ */ e(We, { label: "Public event", checked: n.isPublic ?? !1, disabled: !B }),
|
|
794
|
+
/* @__PURE__ */ e(
|
|
795
|
+
J,
|
|
796
|
+
{
|
|
797
|
+
label: "Max participants",
|
|
798
|
+
value: n.maxParticipants != null ? String(n.maxParticipants) : "",
|
|
799
|
+
onChange: () => {
|
|
800
|
+
},
|
|
801
|
+
readOnly: !B
|
|
802
|
+
}
|
|
803
|
+
),
|
|
804
|
+
/* @__PURE__ */ a("div", { className: "nice-event-planning__muted", children: [
|
|
805
|
+
"Host: ",
|
|
806
|
+
n.hostName,
|
|
807
|
+
" · Created ",
|
|
808
|
+
new Date(n.createdAt).toLocaleDateString()
|
|
809
|
+
] })
|
|
810
|
+
] }), et = /* @__PURE__ */ e("div", { className: "nice-event-planning__list", children: m.length === 0 ? /* @__PURE__ */ e("p", { className: "nice-event-planning__empty", children: "No agenda items yet." }) : /* @__PURE__ */ e("ul", { className: "nice-event-planning__schedule", children: m.map((x) => /* @__PURE__ */ a("li", { className: "nice-event-planning__schedule-item", children: [
|
|
811
|
+
/* @__PURE__ */ a("span", { className: "nice-event-planning__schedule-time", children: [
|
|
812
|
+
/* @__PURE__ */ e(ie, { name: "clock", size: "sm" }),
|
|
813
|
+
x.startTime ?? "",
|
|
814
|
+
x.endTime ? `–${x.endTime}` : ""
|
|
815
|
+
] }),
|
|
816
|
+
/* @__PURE__ */ e("span", { className: "nice-event-planning__schedule-title", children: x.title }),
|
|
817
|
+
x.location && /* @__PURE__ */ e("span", { className: "nice-event-planning__muted", children: x.location })
|
|
818
|
+
] }, x.id)) }) }), nt = /* @__PURE__ */ e("div", { className: "nice-event-planning__list", children: h.length === 0 ? /* @__PURE__ */ e("p", { className: "nice-event-planning__empty", children: "No tasks yet." }) : /* @__PURE__ */ e("ul", { className: "nice-event-planning__tasks", children: h.map((x) => /* @__PURE__ */ a("li", { className: "nice-event-planning__task", children: [
|
|
819
|
+
/* @__PURE__ */ e(We, { label: x.title, checked: x.done ?? !1, disabled: !B }),
|
|
820
|
+
x.assigneeName && /* @__PURE__ */ e(te, { size: "xs", subtle: !0, variant: "info", children: x.assigneeName }),
|
|
821
|
+
x.dueDate && /* @__PURE__ */ e("span", { className: "nice-event-planning__muted", children: x.dueDate })
|
|
822
|
+
] }, x.id)) }) }), tt = /* @__PURE__ */ e("div", { className: "nice-event-planning__list", children: i.length === 0 ? /* @__PURE__ */ e("p", { className: "nice-event-planning__empty", children: "No vendors yet." }) : /* @__PURE__ */ e("ul", { className: "nice-event-planning__vendors", children: i.map((x) => /* @__PURE__ */ a("li", { className: "nice-event-planning__vendor", children: [
|
|
823
|
+
/* @__PURE__ */ e(ie, { name: "briefcase", size: "sm" }),
|
|
824
|
+
/* @__PURE__ */ e("span", { className: "nice-event-planning__vendor-name", children: x.name }),
|
|
825
|
+
x.category && /* @__PURE__ */ e("span", { className: "nice-event-planning__muted", children: x.category }),
|
|
826
|
+
x.status && /* @__PURE__ */ e(te, { size: "xs", subtle: !0, variant: Ee(x.status), children: x.status }),
|
|
827
|
+
x.cost != null && /* @__PURE__ */ a("span", { className: "nice-event-planning__vendor-cost", children: [
|
|
828
|
+
x.cost,
|
|
829
|
+
" ",
|
|
830
|
+
x.currency ?? ""
|
|
831
|
+
] })
|
|
832
|
+
] }, x.id)) }) }), it = /* @__PURE__ */ e("div", { className: "nice-event-planning__list", children: u.length === 0 ? /* @__PURE__ */ e("p", { className: "nice-event-planning__empty", children: "No documents yet." }) : /* @__PURE__ */ e("ul", { className: "nice-event-planning__documents", children: u.map((x) => /* @__PURE__ */ a("li", { className: "nice-event-planning__document", children: [
|
|
833
|
+
/* @__PURE__ */ e(ie, { name: "file", size: "sm" }),
|
|
834
|
+
/* @__PURE__ */ e("span", { className: "nice-event-planning__document-name", children: x.name }),
|
|
835
|
+
x.fileType && /* @__PURE__ */ e(te, { size: "xs", outline: !0, variant: "secondary", children: x.fileType }),
|
|
836
|
+
x.sizeKb != null && /* @__PURE__ */ a("span", { className: "nice-event-planning__muted", children: [
|
|
837
|
+
x.sizeKb,
|
|
838
|
+
" KB"
|
|
839
|
+
] })
|
|
840
|
+
] }, x.id)) }) }), at = {
|
|
841
|
+
details: Gn,
|
|
842
|
+
location: Kn,
|
|
843
|
+
schedule: et,
|
|
844
|
+
participants: Hn,
|
|
845
|
+
tasks: nt,
|
|
846
|
+
surveys: Qn,
|
|
847
|
+
vendors: tt,
|
|
848
|
+
budget: Zn,
|
|
849
|
+
documents: it,
|
|
850
|
+
settings: Jn
|
|
851
|
+
}, st = {
|
|
852
|
+
details: "file",
|
|
853
|
+
location: "home",
|
|
854
|
+
schedule: "clock",
|
|
855
|
+
participants: "users",
|
|
856
|
+
tasks: "list",
|
|
857
|
+
surveys: "clipboard",
|
|
858
|
+
vendors: "briefcase",
|
|
859
|
+
budget: "dollar",
|
|
860
|
+
documents: "folder",
|
|
861
|
+
settings: "settings"
|
|
862
|
+
}, rt = {
|
|
863
|
+
schedule: m.length || void 0,
|
|
864
|
+
participants: c.length || void 0,
|
|
865
|
+
tasks: h.length || void 0,
|
|
866
|
+
surveys: o.length || void 0,
|
|
867
|
+
vendors: i.length || void 0,
|
|
868
|
+
budget: d.length || void 0,
|
|
869
|
+
documents: u.length || void 0
|
|
870
|
+
}, lt = ue.map((x) => ({
|
|
871
|
+
id: x,
|
|
872
|
+
label: x.charAt(0).toUpperCase() + x.slice(1),
|
|
873
|
+
icon: /* @__PURE__ */ e(ie, { name: st[x], size: "sm" }),
|
|
874
|
+
badge: rt[x],
|
|
875
|
+
content: at[x]
|
|
876
|
+
})), ct = /* @__PURE__ */ a("div", { className: "nice-event-planning__toolbar", children: [
|
|
877
|
+
/* @__PURE__ */ a("div", { className: "nice-event-planning__toolbar-title", children: [
|
|
878
|
+
/* @__PURE__ */ e(ie, { name: "calendar", size: "md" }),
|
|
879
|
+
/* @__PURE__ */ e("span", { className: "nice-event-planning__title", children: n.title }),
|
|
880
|
+
/* @__PURE__ */ e(te, { size: "sm", variant: Ee(n.status), children: n.status })
|
|
881
|
+
] }),
|
|
882
|
+
/* @__PURE__ */ e("span", { className: "nice-event-planning__toolbar-spacer" }),
|
|
883
|
+
/* @__PURE__ */ a("div", { className: "nice-event-planning__toolbar-actions", children: [
|
|
884
|
+
C && /* @__PURE__ */ e(
|
|
885
|
+
F,
|
|
886
|
+
{
|
|
887
|
+
size: "sm",
|
|
888
|
+
variant: "primary",
|
|
889
|
+
leftIcon: /* @__PURE__ */ e(ie, { name: "check", size: "sm" }),
|
|
890
|
+
onClick: () => C({ title: R, description: H }),
|
|
891
|
+
children: "Save"
|
|
892
|
+
}
|
|
893
|
+
),
|
|
894
|
+
O && /* @__PURE__ */ e(
|
|
895
|
+
F,
|
|
896
|
+
{
|
|
897
|
+
size: "sm",
|
|
898
|
+
variant: "success",
|
|
899
|
+
leftIcon: /* @__PURE__ */ e(ie, { name: "upload", size: "sm" }),
|
|
900
|
+
onClick: O,
|
|
901
|
+
children: "Publish"
|
|
902
|
+
}
|
|
903
|
+
),
|
|
904
|
+
z && /* @__PURE__ */ e(
|
|
905
|
+
F,
|
|
906
|
+
{
|
|
907
|
+
size: "sm",
|
|
908
|
+
variant: "ghost",
|
|
909
|
+
leftIcon: /* @__PURE__ */ e(ie, { name: "link", size: "sm" }),
|
|
910
|
+
onClick: z,
|
|
911
|
+
children: "Share"
|
|
912
|
+
}
|
|
913
|
+
),
|
|
914
|
+
P && /* @__PURE__ */ e(
|
|
915
|
+
F,
|
|
916
|
+
{
|
|
917
|
+
size: "sm",
|
|
918
|
+
variant: "ghost",
|
|
919
|
+
leftIcon: /* @__PURE__ */ e(ie, { name: "download", size: "sm" }),
|
|
920
|
+
onClick: P,
|
|
921
|
+
children: "Export"
|
|
922
|
+
}
|
|
923
|
+
)
|
|
924
|
+
] })
|
|
925
|
+
] });
|
|
926
|
+
return p === "micro" ? /* @__PURE__ */ e(
|
|
927
|
+
"div",
|
|
928
|
+
{
|
|
929
|
+
ref: r,
|
|
930
|
+
className: `nice-event-planning nice-event-planning--micro ${q ?? ""}`,
|
|
931
|
+
style: Q,
|
|
932
|
+
children: /* @__PURE__ */ a("div", { className: "nice-event-planning__micro", children: [
|
|
933
|
+
/* @__PURE__ */ e(ie, { name: "calendar", size: "md" }),
|
|
934
|
+
/* @__PURE__ */ a("div", { className: "nice-event-planning__micro-body", children: [
|
|
935
|
+
/* @__PURE__ */ e("span", { className: "nice-event-planning__title", children: n.title }),
|
|
936
|
+
/* @__PURE__ */ a("span", { className: "nice-event-planning__muted", children: [
|
|
937
|
+
n.startDate ? new Date(n.startDate).toLocaleString() : "No date",
|
|
938
|
+
(on = n.location) != null && on.name ? ` · ${n.location.name}` : ""
|
|
939
|
+
] })
|
|
940
|
+
] }),
|
|
941
|
+
/* @__PURE__ */ e(te, { size: "sm", variant: Ee(n.status), children: n.status }),
|
|
942
|
+
c.length > 0 && /* @__PURE__ */ e(un, { max: 4, size: "sm", children: c.map((x) => /* @__PURE__ */ e(Be, { name: x.name, src: x.avatarUrl, size: "sm" }, x.id)) })
|
|
943
|
+
] })
|
|
944
|
+
}
|
|
945
|
+
) : /* @__PURE__ */ a(
|
|
946
|
+
"div",
|
|
947
|
+
{
|
|
948
|
+
ref: r,
|
|
949
|
+
className: `nice-event-planning nice-event-planning--${p} ${q ?? ""}`,
|
|
950
|
+
style: Q,
|
|
951
|
+
children: [
|
|
952
|
+
ct,
|
|
953
|
+
/* @__PURE__ */ e(
|
|
954
|
+
Ct,
|
|
955
|
+
{
|
|
956
|
+
tabs: lt,
|
|
957
|
+
activeTab: Rn,
|
|
958
|
+
onChange: Un,
|
|
959
|
+
iconOnly: w,
|
|
960
|
+
centered: k,
|
|
961
|
+
countLocation: _
|
|
962
|
+
}
|
|
963
|
+
)
|
|
964
|
+
]
|
|
965
|
+
}
|
|
966
|
+
);
|
|
967
|
+
}
|
|
968
|
+
);
|
|
969
|
+
function Mt(s) {
|
|
970
|
+
switch (s) {
|
|
971
|
+
case "confirmed":
|
|
972
|
+
return "success";
|
|
973
|
+
case "checked-in":
|
|
974
|
+
return "info";
|
|
975
|
+
case "declined":
|
|
976
|
+
return "error";
|
|
977
|
+
case "no-show":
|
|
978
|
+
return "warning";
|
|
979
|
+
default:
|
|
980
|
+
return "secondary";
|
|
981
|
+
}
|
|
982
|
+
}
|
|
983
|
+
const je = ({
|
|
984
|
+
participant: s,
|
|
985
|
+
showRole: t = !0,
|
|
986
|
+
showStatus: r = !0,
|
|
987
|
+
meta: n,
|
|
988
|
+
children: c,
|
|
989
|
+
size: o = "md",
|
|
990
|
+
className: d
|
|
991
|
+
}) => /* @__PURE__ */ a("li", { className: `nice-participant-row nice-participant-row--${o} ${d ?? ""}`, children: [
|
|
992
|
+
/* @__PURE__ */ e(Be, { name: s.name, src: s.avatarUrl, size: o }),
|
|
993
|
+
/* @__PURE__ */ e("span", { className: "nice-participant-row__name", children: s.name }),
|
|
994
|
+
t && s.role && /* @__PURE__ */ e(te, { size: "xs", outline: !0, variant: "info", children: s.role }),
|
|
995
|
+
r && s.status && /* @__PURE__ */ e(te, { size: "xs", subtle: !0, variant: Mt(s.status), children: s.status }),
|
|
996
|
+
n && /* @__PURE__ */ e("span", { className: "nice-participant-row__meta", children: n }),
|
|
997
|
+
c && /* @__PURE__ */ e("span", { className: "nice-participant-row__trailing", children: c })
|
|
998
|
+
] }), Dt = /^[^\s@,;]+@[^\s@,;]+\.[^\s@,;]{2,}$/, hn = /^.*<\s*([^<>\s]+)\s*>$/;
|
|
999
|
+
function Dn(s) {
|
|
1000
|
+
var o, d;
|
|
1001
|
+
const t = [], r = [], n = /* @__PURE__ */ new Set();
|
|
1002
|
+
let c = 0;
|
|
1003
|
+
if (!s)
|
|
1004
|
+
return { valid: t, invalid: r, duplicates: c };
|
|
1005
|
+
for (const m of s.split(/[,;\r\n\t]+/)) {
|
|
1006
|
+
const h = m.trim();
|
|
1007
|
+
if (!h)
|
|
1008
|
+
continue;
|
|
1009
|
+
const i = ((d = (o = hn.exec(h)) == null ? void 0 : o[1]) == null ? void 0 : d.trim()) ?? h, u = hn.test(h) ? [i] : i.split(/\s+/);
|
|
1010
|
+
for (const p of u) {
|
|
1011
|
+
if (!p)
|
|
1012
|
+
continue;
|
|
1013
|
+
if (!Dt.test(p)) {
|
|
1014
|
+
r.push(p);
|
|
1015
|
+
continue;
|
|
1016
|
+
}
|
|
1017
|
+
const b = p.toLowerCase();
|
|
1018
|
+
if (n.has(b)) {
|
|
1019
|
+
c += 1;
|
|
1020
|
+
continue;
|
|
1021
|
+
}
|
|
1022
|
+
n.add(b), t.push(p);
|
|
1023
|
+
}
|
|
1024
|
+
}
|
|
1025
|
+
return { valid: t, invalid: r, duplicates: c };
|
|
1026
|
+
}
|
|
1027
|
+
function Et(s, t) {
|
|
1028
|
+
const r = new Set(s.map((c) => c.toLowerCase())), n = [...s];
|
|
1029
|
+
for (const c of t) {
|
|
1030
|
+
const o = c.toLowerCase();
|
|
1031
|
+
r.has(o) || (r.add(o), n.push(c));
|
|
1032
|
+
}
|
|
1033
|
+
return n;
|
|
1034
|
+
}
|
|
1035
|
+
function En(s = {}) {
|
|
1036
|
+
const { currentUserId: t, currentUserName: r, requireIdentity: n = !0 } = s, [c, o] = E(""), d = !t, m = r ?? c, h = !n || m.trim().length > 0;
|
|
1037
|
+
return {
|
|
1038
|
+
isAnonymous: d,
|
|
1039
|
+
name: m,
|
|
1040
|
+
setName: o,
|
|
1041
|
+
canAct: h,
|
|
1042
|
+
actor: { userId: t, userName: m.trim() }
|
|
1043
|
+
};
|
|
1044
|
+
}
|
|
1045
|
+
const Lt = [
|
|
1046
|
+
{ answer: "yes", label: "Yes", variant: "success", Icon: He },
|
|
1047
|
+
{ answer: "maybe", label: "Maybe", variant: "warning", Icon: Qe },
|
|
1048
|
+
{ answer: "no", label: "No", variant: "error", Icon: ut }
|
|
1049
|
+
], pn = ee(
|
|
1050
|
+
function(t, r) {
|
|
1051
|
+
const {
|
|
1052
|
+
value: n,
|
|
1053
|
+
onRespond: c,
|
|
1054
|
+
allowPlusOnes: o = !1,
|
|
1055
|
+
maxPlusOnes: d = 5,
|
|
1056
|
+
plusOnes: m = 0,
|
|
1057
|
+
allowNote: h = !1,
|
|
1058
|
+
currentUserId: i,
|
|
1059
|
+
currentUserName: u,
|
|
1060
|
+
compact: p = !1,
|
|
1061
|
+
disabled: b = !1,
|
|
1062
|
+
readOnly: f = !1,
|
|
1063
|
+
size: g = "md",
|
|
1064
|
+
className: w,
|
|
1065
|
+
style: k
|
|
1066
|
+
} = t, _ = En({ currentUserId: i, currentUserName: u }), [$, l] = E(m), [y, v] = E(""), A = !p && _.isAnonymous && !_.canAct, I = b || f, D = (N) => {
|
|
1067
|
+
I || !c || c({
|
|
1068
|
+
answer: N,
|
|
1069
|
+
plusOnes: o && N !== "no" ? $ : void 0,
|
|
1070
|
+
note: h && y.trim() ? y.trim() : void 0,
|
|
1071
|
+
userId: _.actor.userId,
|
|
1072
|
+
userName: _.actor.userName || void 0
|
|
1073
|
+
});
|
|
1074
|
+
};
|
|
1075
|
+
return /* @__PURE__ */ a(
|
|
1076
|
+
"div",
|
|
1077
|
+
{
|
|
1078
|
+
ref: r,
|
|
1079
|
+
className: `nice-rsvp-control nice-rsvp-control--${g}${p ? " nice-rsvp-control--compact" : ""} ${w ?? ""}`,
|
|
1080
|
+
style: k,
|
|
1081
|
+
children: [
|
|
1082
|
+
!p && _.isAnonymous && /* @__PURE__ */ e(
|
|
1083
|
+
J,
|
|
1084
|
+
{
|
|
1085
|
+
label: "Your name",
|
|
1086
|
+
value: _.name,
|
|
1087
|
+
onChange: _.setName,
|
|
1088
|
+
placeholder: "Who is replying?",
|
|
1089
|
+
required: !0,
|
|
1090
|
+
disabled: I,
|
|
1091
|
+
size: g
|
|
1092
|
+
}
|
|
1093
|
+
),
|
|
1094
|
+
/* @__PURE__ */ e("div", { className: "nice-rsvp-control__answers", role: "group", "aria-label": "Your reply", children: Lt.map(({ answer: N, label: L, variant: V, Icon: B }) => /* @__PURE__ */ e(
|
|
1095
|
+
F,
|
|
1096
|
+
{
|
|
1097
|
+
size: g,
|
|
1098
|
+
variant: n === N ? V : "outline",
|
|
1099
|
+
leftIcon: /* @__PURE__ */ e(B, { size: 16 }),
|
|
1100
|
+
disabled: I || A,
|
|
1101
|
+
"aria-pressed": n === N,
|
|
1102
|
+
onClick: () => D(N),
|
|
1103
|
+
children: L
|
|
1104
|
+
},
|
|
1105
|
+
N
|
|
1106
|
+
)) }),
|
|
1107
|
+
!p && o && n !== "no" && /* @__PURE__ */ a("label", { className: "nice-rsvp-control__field", children: [
|
|
1108
|
+
/* @__PURE__ */ e("span", { className: "nice-rsvp-control__field-label", children: "Additional guests" }),
|
|
1109
|
+
/* @__PURE__ */ e(
|
|
1110
|
+
Je,
|
|
1111
|
+
{
|
|
1112
|
+
value: $,
|
|
1113
|
+
onChange: (N) => l(Math.max(0, Math.min(d, N ?? 0))),
|
|
1114
|
+
min: 0,
|
|
1115
|
+
max: d,
|
|
1116
|
+
step: 1,
|
|
1117
|
+
size: "xs",
|
|
1118
|
+
disabled: I
|
|
1119
|
+
}
|
|
1120
|
+
)
|
|
1121
|
+
] }),
|
|
1122
|
+
!p && h && /* @__PURE__ */ e(
|
|
1123
|
+
J,
|
|
1124
|
+
{
|
|
1125
|
+
label: "Note",
|
|
1126
|
+
value: y,
|
|
1127
|
+
onChange: v,
|
|
1128
|
+
placeholder: "Anything we should know?",
|
|
1129
|
+
disabled: I,
|
|
1130
|
+
size: g
|
|
1131
|
+
}
|
|
1132
|
+
),
|
|
1133
|
+
A && /* @__PURE__ */ e("p", { className: "nice-rsvp-control__hint", children: "Enter your name to reply." })
|
|
1134
|
+
]
|
|
1135
|
+
}
|
|
1136
|
+
);
|
|
1137
|
+
}
|
|
1138
|
+
), Bt = {
|
|
1139
|
+
yes: "confirmed",
|
|
1140
|
+
maybe: "invited",
|
|
1141
|
+
no: "declined"
|
|
1142
|
+
}, gn = {
|
|
1143
|
+
confirmed: "yes",
|
|
1144
|
+
"checked-in": "yes",
|
|
1145
|
+
declined: "no"
|
|
1146
|
+
}, Le = [
|
|
1147
|
+
"confirmed",
|
|
1148
|
+
"checked-in",
|
|
1149
|
+
"invited",
|
|
1150
|
+
"declined",
|
|
1151
|
+
"no-show"
|
|
1152
|
+
], Ai = ee(
|
|
1153
|
+
function(t, r) {
|
|
1154
|
+
const {
|
|
1155
|
+
participants: n,
|
|
1156
|
+
mode: c = "organizer",
|
|
1157
|
+
currentUserId: o,
|
|
1158
|
+
currentUserName: d,
|
|
1159
|
+
onRsvpChange: m,
|
|
1160
|
+
onCheckIn: h,
|
|
1161
|
+
onScan: i,
|
|
1162
|
+
checkInSlot: u,
|
|
1163
|
+
onInvite: p,
|
|
1164
|
+
extraFields: b,
|
|
1165
|
+
groupBy: f = "none",
|
|
1166
|
+
showSummary: g = !0,
|
|
1167
|
+
showSearch: w = !0,
|
|
1168
|
+
allowPlusOnes: k = !1,
|
|
1169
|
+
disabled: _ = !1,
|
|
1170
|
+
readOnly: $ = !1,
|
|
1171
|
+
size: l = "md",
|
|
1172
|
+
className: y,
|
|
1173
|
+
style: v
|
|
1174
|
+
} = t, [A, I] = E(""), [D, N] = E("all"), [L, V] = E(""), B = _ || $, C = c === "guest", O = X(() => {
|
|
1175
|
+
const S = { total: n.length };
|
|
1176
|
+
for (const Y of Le)
|
|
1177
|
+
S[Y] = 0;
|
|
1178
|
+
for (const Y of n)
|
|
1179
|
+
S[Y.status] = (S[Y.status] ?? 0) + 1;
|
|
1180
|
+
return S;
|
|
1181
|
+
}, [n]), z = X(() => {
|
|
1182
|
+
if (C)
|
|
1183
|
+
return n.filter((Y) => Y.userId === o || Y.id === o);
|
|
1184
|
+
const S = A.trim().toLowerCase();
|
|
1185
|
+
return n.filter((Y) => D !== "all" && Y.status !== D ? !1 : !S || Y.name.toLowerCase().includes(S));
|
|
1186
|
+
}, [n, C, o, A, D]), P = X(() => {
|
|
1187
|
+
if (f === "none" || C)
|
|
1188
|
+
return [{ key: "all", label: "", items: z }];
|
|
1189
|
+
const S = /* @__PURE__ */ new Map();
|
|
1190
|
+
for (const q of z) {
|
|
1191
|
+
const Q = f === "status" ? q.status : q.role, R = S.get(Q);
|
|
1192
|
+
R ? R.push(q) : S.set(Q, [q]);
|
|
1193
|
+
}
|
|
1194
|
+
return [...S.keys()].sort((q, Q) => f !== "status" ? q.localeCompare(Q) : Le.indexOf(q) - Le.indexOf(Q)).map((q) => ({ key: q, label: q, items: S.get(q) ?? [] }));
|
|
1195
|
+
}, [z, f, C]), M = X(() => Dn(L), [L]), j = (S) => (Y) => {
|
|
1196
|
+
m == null || m(S, Bt[Y.answer], Y);
|
|
1197
|
+
}, W = () => {
|
|
1198
|
+
!p || M.valid.length === 0 || (p(M.valid), V(""));
|
|
1199
|
+
};
|
|
1200
|
+
if (C) {
|
|
1201
|
+
const S = z[0];
|
|
1202
|
+
return S ? /* @__PURE__ */ a(
|
|
1203
|
+
"div",
|
|
1204
|
+
{
|
|
1205
|
+
ref: r,
|
|
1206
|
+
className: `nice-participant-list nice-participant-list--guest ${y ?? ""}`,
|
|
1207
|
+
style: v,
|
|
1208
|
+
children: [
|
|
1209
|
+
/* @__PURE__ */ e("ul", { className: "nice-participant-list__rows", children: /* @__PURE__ */ e(je, { participant: S, size: l }) }),
|
|
1210
|
+
/* @__PURE__ */ e(
|
|
1211
|
+
pn,
|
|
1212
|
+
{
|
|
1213
|
+
value: gn[S.status],
|
|
1214
|
+
onRespond: j(S.id),
|
|
1215
|
+
allowPlusOnes: k,
|
|
1216
|
+
currentUserId: o ?? S.userId,
|
|
1217
|
+
currentUserName: d ?? S.name,
|
|
1218
|
+
disabled: _,
|
|
1219
|
+
readOnly: $,
|
|
1220
|
+
size: l
|
|
1221
|
+
}
|
|
1222
|
+
)
|
|
1223
|
+
]
|
|
1224
|
+
}
|
|
1225
|
+
) : /* @__PURE__ */ e("div", { ref: r, className: `nice-participant-list ${y ?? ""}`, style: v, children: /* @__PURE__ */ e(
|
|
1226
|
+
ye,
|
|
1227
|
+
{
|
|
1228
|
+
title: "You are not on this guest list",
|
|
1229
|
+
description: "Ask the host for an invitation link."
|
|
1230
|
+
}
|
|
1231
|
+
) });
|
|
1232
|
+
}
|
|
1233
|
+
return /* @__PURE__ */ a("div", { ref: r, className: `nice-participant-list ${y ?? ""}`, style: v, children: [
|
|
1234
|
+
g && /* @__PURE__ */ a("div", { className: "nice-participant-list__summary", children: [
|
|
1235
|
+
/* @__PURE__ */ a("span", { className: "nice-participant-list__stat", children: [
|
|
1236
|
+
/* @__PURE__ */ e("strong", { children: O.confirmed }),
|
|
1237
|
+
" confirmed"
|
|
1238
|
+
] }),
|
|
1239
|
+
/* @__PURE__ */ a("span", { className: "nice-participant-list__stat", children: [
|
|
1240
|
+
/* @__PURE__ */ e("strong", { children: O.invited }),
|
|
1241
|
+
" awaiting reply"
|
|
1242
|
+
] }),
|
|
1243
|
+
/* @__PURE__ */ a("span", { className: "nice-participant-list__stat", children: [
|
|
1244
|
+
/* @__PURE__ */ e("strong", { children: O.declined }),
|
|
1245
|
+
" declined"
|
|
1246
|
+
] }),
|
|
1247
|
+
/* @__PURE__ */ a("span", { className: "nice-participant-list__stat", children: [
|
|
1248
|
+
/* @__PURE__ */ e("strong", { children: O["checked-in"] }),
|
|
1249
|
+
" checked in"
|
|
1250
|
+
] }),
|
|
1251
|
+
/* @__PURE__ */ a("span", { className: "nice-participant-list__stat nice-participant-list__stat--total", children: [
|
|
1252
|
+
/* @__PURE__ */ e("strong", { children: O.total }),
|
|
1253
|
+
" total"
|
|
1254
|
+
] })
|
|
1255
|
+
] }),
|
|
1256
|
+
(w || u || i) && /* @__PURE__ */ a("div", { className: "nice-participant-list__toolbar", children: [
|
|
1257
|
+
w && /* @__PURE__ */ a(Ke, { children: [
|
|
1258
|
+
/* @__PURE__ */ e(
|
|
1259
|
+
J,
|
|
1260
|
+
{
|
|
1261
|
+
value: A,
|
|
1262
|
+
onChange: I,
|
|
1263
|
+
placeholder: "Search guests…",
|
|
1264
|
+
prefix: /* @__PURE__ */ e(mt, { size: 15 }),
|
|
1265
|
+
size: l
|
|
1266
|
+
}
|
|
1267
|
+
),
|
|
1268
|
+
/* @__PURE__ */ e(
|
|
1269
|
+
Pe,
|
|
1270
|
+
{
|
|
1271
|
+
value: D,
|
|
1272
|
+
onChange: (S) => N(S),
|
|
1273
|
+
size: l,
|
|
1274
|
+
options: [
|
|
1275
|
+
{ value: "all", label: "All statuses" },
|
|
1276
|
+
...Le.map((S) => ({ value: S, label: S }))
|
|
1277
|
+
]
|
|
1278
|
+
}
|
|
1279
|
+
)
|
|
1280
|
+
] }),
|
|
1281
|
+
u,
|
|
1282
|
+
i && !u && /* @__PURE__ */ a("span", { className: "nice-participant-list__scan-hint", children: [
|
|
1283
|
+
/* @__PURE__ */ e(ht, { size: 15 }),
|
|
1284
|
+
" Scanner ready"
|
|
1285
|
+
] })
|
|
1286
|
+
] }),
|
|
1287
|
+
z.length === 0 ? /* @__PURE__ */ e(
|
|
1288
|
+
ye,
|
|
1289
|
+
{
|
|
1290
|
+
title: "No guests yet",
|
|
1291
|
+
description: n.length > 0 ? "No one matches the current filter." : "Invite people to see them here."
|
|
1292
|
+
}
|
|
1293
|
+
) : P.map((S) => /* @__PURE__ */ a("section", { className: "nice-participant-list__group", children: [
|
|
1294
|
+
S.label && /* @__PURE__ */ a("h4", { className: "nice-participant-list__group-title", children: [
|
|
1295
|
+
S.label,
|
|
1296
|
+
" ",
|
|
1297
|
+
/* @__PURE__ */ a("span", { children: [
|
|
1298
|
+
"(",
|
|
1299
|
+
S.items.length,
|
|
1300
|
+
")"
|
|
1301
|
+
] })
|
|
1302
|
+
] }),
|
|
1303
|
+
/* @__PURE__ */ e("ul", { className: "nice-participant-list__rows", children: S.items.map((Y) => /* @__PURE__ */ a(
|
|
1304
|
+
je,
|
|
1305
|
+
{
|
|
1306
|
+
participant: Y,
|
|
1307
|
+
size: l,
|
|
1308
|
+
meta: b == null ? void 0 : b.map((q) => /* @__PURE__ */ e("span", { className: "nice-participant-list__extra", children: q.render ? q.render(Y) : String(
|
|
1309
|
+
Y[q.key] ?? ""
|
|
1310
|
+
) }, q.key)),
|
|
1311
|
+
children: [
|
|
1312
|
+
m && /* @__PURE__ */ e(
|
|
1313
|
+
pn,
|
|
1314
|
+
{
|
|
1315
|
+
compact: !0,
|
|
1316
|
+
value: gn[Y.status],
|
|
1317
|
+
onRespond: j(Y.id),
|
|
1318
|
+
currentUserId: Y.userId,
|
|
1319
|
+
currentUserName: Y.name,
|
|
1320
|
+
disabled: B,
|
|
1321
|
+
size: "sm"
|
|
1322
|
+
}
|
|
1323
|
+
),
|
|
1324
|
+
h && Y.status !== "checked-in" && /* @__PURE__ */ e(
|
|
1325
|
+
F,
|
|
1326
|
+
{
|
|
1327
|
+
size: "sm",
|
|
1328
|
+
variant: "outline",
|
|
1329
|
+
leftIcon: /* @__PURE__ */ e(He, { size: 14 }),
|
|
1330
|
+
disabled: B,
|
|
1331
|
+
onClick: () => h(Y.id),
|
|
1332
|
+
children: "Check in"
|
|
1333
|
+
}
|
|
1334
|
+
)
|
|
1335
|
+
]
|
|
1336
|
+
},
|
|
1337
|
+
Y.id
|
|
1338
|
+
)) })
|
|
1339
|
+
] }, S.key)),
|
|
1340
|
+
p && !$ && /* @__PURE__ */ a("div", { className: "nice-participant-list__invite", children: [
|
|
1341
|
+
/* @__PURE__ */ e(
|
|
1342
|
+
Ze,
|
|
1343
|
+
{
|
|
1344
|
+
label: "Invite by email",
|
|
1345
|
+
value: L,
|
|
1346
|
+
onChange: V,
|
|
1347
|
+
placeholder: "Paste addresses — commas, semicolons or new lines",
|
|
1348
|
+
rows: 3,
|
|
1349
|
+
disabled: _,
|
|
1350
|
+
size: l
|
|
1351
|
+
}
|
|
1352
|
+
),
|
|
1353
|
+
/* @__PURE__ */ a(
|
|
1354
|
+
F,
|
|
1355
|
+
{
|
|
1356
|
+
variant: "primary",
|
|
1357
|
+
size: l,
|
|
1358
|
+
leftIcon: /* @__PURE__ */ e(In, { size: 15 }),
|
|
1359
|
+
disabled: _ || M.valid.length === 0,
|
|
1360
|
+
onClick: W,
|
|
1361
|
+
children: [
|
|
1362
|
+
"Invite ",
|
|
1363
|
+
M.valid.length > 0 ? `(${M.valid.length})` : ""
|
|
1364
|
+
]
|
|
1365
|
+
}
|
|
1366
|
+
),
|
|
1367
|
+
(M.invalid.length > 0 || M.duplicates > 0) && /* @__PURE__ */ a("p", { className: "nice-participant-list__invite-hint", children: [
|
|
1368
|
+
M.duplicates > 0 && `${M.duplicates} duplicate(s) removed. `,
|
|
1369
|
+
M.invalid.length > 0 && `${M.invalid.length} entry(ies) not recognised.`
|
|
1370
|
+
] })
|
|
1371
|
+
] })
|
|
1372
|
+
] });
|
|
1373
|
+
}
|
|
1374
|
+
), Ot = {
|
|
1375
|
+
// No minor unit at all.
|
|
1376
|
+
BIF: 0,
|
|
1377
|
+
CLP: 0,
|
|
1378
|
+
DJF: 0,
|
|
1379
|
+
GNF: 0,
|
|
1380
|
+
ISK: 0,
|
|
1381
|
+
JPY: 0,
|
|
1382
|
+
KMF: 0,
|
|
1383
|
+
KRW: 0,
|
|
1384
|
+
PYG: 0,
|
|
1385
|
+
RWF: 0,
|
|
1386
|
+
UGX: 0,
|
|
1387
|
+
UYI: 0,
|
|
1388
|
+
VND: 0,
|
|
1389
|
+
VUV: 0,
|
|
1390
|
+
XAF: 0,
|
|
1391
|
+
XOF: 0,
|
|
1392
|
+
XPF: 0,
|
|
1393
|
+
// Thousandths.
|
|
1394
|
+
BHD: 3,
|
|
1395
|
+
IQD: 3,
|
|
1396
|
+
JOD: 3,
|
|
1397
|
+
KWD: 3,
|
|
1398
|
+
LYD: 3,
|
|
1399
|
+
OMR: 3,
|
|
1400
|
+
TND: 3
|
|
1401
|
+
};
|
|
1402
|
+
function en(s) {
|
|
1403
|
+
return Ot[s == null ? void 0 : s.toUpperCase()] ?? 2;
|
|
1404
|
+
}
|
|
1405
|
+
function nn(s, t) {
|
|
1406
|
+
return Number.isFinite(s) ? Math.round(s * 10 ** en(t)) : 0;
|
|
1407
|
+
}
|
|
1408
|
+
function Ye(s, t) {
|
|
1409
|
+
const r = en(t);
|
|
1410
|
+
return r === 0 ? s : s / 10 ** r;
|
|
1411
|
+
}
|
|
1412
|
+
function Rt(s, t, r) {
|
|
1413
|
+
const n = en(t), c = Ye(s, t);
|
|
1414
|
+
try {
|
|
1415
|
+
return new Intl.NumberFormat(r, {
|
|
1416
|
+
style: "currency",
|
|
1417
|
+
currency: t.toUpperCase(),
|
|
1418
|
+
minimumFractionDigits: n,
|
|
1419
|
+
maximumFractionDigits: n
|
|
1420
|
+
}).format(c);
|
|
1421
|
+
} catch {
|
|
1422
|
+
return `${c.toFixed(n)} ${t}`;
|
|
1423
|
+
}
|
|
1424
|
+
}
|
|
1425
|
+
function se(s, t, r) {
|
|
1426
|
+
return Rt(nn(s, t), t, r);
|
|
1427
|
+
}
|
|
1428
|
+
const Ge = { minX: 0, minY: 0, maxX: 0, maxY: 0 };
|
|
1429
|
+
function Ut(s, t = 0) {
|
|
1430
|
+
if (s.length === 0)
|
|
1431
|
+
return { ...Ge };
|
|
1432
|
+
let r = 1 / 0, n = 1 / 0, c = -1 / 0, o = -1 / 0;
|
|
1433
|
+
for (const d of s)
|
|
1434
|
+
d.x < r && (r = d.x), d.y < n && (n = d.y), d.x > c && (c = d.x), d.y > o && (o = d.y);
|
|
1435
|
+
return { minX: r - t, minY: n - t, maxX: c + t, maxY: o + t };
|
|
1436
|
+
}
|
|
1437
|
+
function fn(s, t) {
|
|
1438
|
+
return {
|
|
1439
|
+
minX: Math.min(s.minX, t.minX),
|
|
1440
|
+
minY: Math.min(s.minY, t.minY),
|
|
1441
|
+
maxX: Math.max(s.maxX, t.maxX),
|
|
1442
|
+
maxY: Math.max(s.maxY, t.maxY)
|
|
1443
|
+
};
|
|
1444
|
+
}
|
|
1445
|
+
function vn(s, t) {
|
|
1446
|
+
return s.minX <= t.maxX && s.maxX >= t.minX && s.minY <= t.maxY && s.maxY >= t.minY;
|
|
1447
|
+
}
|
|
1448
|
+
function Yt(s, t, r = 0) {
|
|
1449
|
+
const n = s.zoom || 1, c = -s.pan.x / n - r, o = -s.pan.y / n - r;
|
|
1450
|
+
return {
|
|
1451
|
+
minX: c,
|
|
1452
|
+
minY: o,
|
|
1453
|
+
maxX: c + t.width / n + r * 2,
|
|
1454
|
+
maxY: o + t.height / n + r * 2
|
|
1455
|
+
};
|
|
1456
|
+
}
|
|
1457
|
+
function Xt(s, t = 12) {
|
|
1458
|
+
const r = [], n = [], c = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map();
|
|
1459
|
+
let d = null, m = 0;
|
|
1460
|
+
for (const h of s.sections ?? []) {
|
|
1461
|
+
let i = null, u = 0;
|
|
1462
|
+
(h.rows ?? []).forEach((b, f) => {
|
|
1463
|
+
const g = Vt(b.seats ?? []);
|
|
1464
|
+
if (g.length === 0)
|
|
1465
|
+
return;
|
|
1466
|
+
const w = Ut(g, t);
|
|
1467
|
+
n.push({ sectionId: h.id, rowIndex: f, label: b.label, seats: g, bounds: w }), g.forEach((k, _) => {
|
|
1468
|
+
c.set(k.id, k), o.set(k.id, { sectionId: h.id, rowIndex: f, seatIndex: _ });
|
|
1469
|
+
}), u += g.length, i = i ? fn(i, w) : w;
|
|
1470
|
+
});
|
|
1471
|
+
const p = i ?? { ...Ge };
|
|
1472
|
+
r.push({ section: h, bounds: p, seatCount: u }), m += u, u > 0 && (d = d ? fn(d, p) : p);
|
|
1473
|
+
}
|
|
1474
|
+
return {
|
|
1475
|
+
sections: r,
|
|
1476
|
+
rows: n,
|
|
1477
|
+
bounds: d ?? { ...Ge },
|
|
1478
|
+
totalSeats: m,
|
|
1479
|
+
seatById: c,
|
|
1480
|
+
locationById: o
|
|
1481
|
+
};
|
|
1482
|
+
}
|
|
1483
|
+
function Vt(s) {
|
|
1484
|
+
return [...s].sort((t, r) => t.number - r.number || t.x - r.x);
|
|
1485
|
+
}
|
|
1486
|
+
function Ft(s, t) {
|
|
1487
|
+
return s > t * 4 ? "section" : s > t ? "row" : "seat";
|
|
1488
|
+
}
|
|
1489
|
+
function Wt(s, t, r = 2500, n) {
|
|
1490
|
+
const c = s.sections.filter((u) => vn(u.bounds, t)), o = new Set(c.map((u) => u.section.id)), d = s.rows.filter(
|
|
1491
|
+
(u) => o.has(u.sectionId) && vn(u.bounds, t)
|
|
1492
|
+
);
|
|
1493
|
+
let m = 0;
|
|
1494
|
+
for (const u of d)
|
|
1495
|
+
for (const p of u.seats)
|
|
1496
|
+
p.x >= t.minX && p.x <= t.maxX && p.y >= t.minY && p.y <= t.maxY && (m += 1);
|
|
1497
|
+
const h = n ?? Ft(m, r);
|
|
1498
|
+
let i = [];
|
|
1499
|
+
if (h === "seat") {
|
|
1500
|
+
i = [];
|
|
1501
|
+
for (const u of d)
|
|
1502
|
+
for (const p of u.seats)
|
|
1503
|
+
p.x >= t.minX && p.x <= t.maxX && p.y >= t.minY && p.y <= t.maxY && i.push(p);
|
|
1504
|
+
}
|
|
1505
|
+
return { tier: h, sections: c, rows: h === "section" ? [] : d, seats: i, visibleSeatCount: m };
|
|
1506
|
+
}
|
|
1507
|
+
function tn(s) {
|
|
1508
|
+
if (s.accessType)
|
|
1509
|
+
return s.accessType;
|
|
1510
|
+
if (s.status === "wheelchair" || s.status === "companion")
|
|
1511
|
+
return s.status;
|
|
1512
|
+
}
|
|
1513
|
+
function ke(s, t) {
|
|
1514
|
+
const r = (t == null ? void 0 : t[s.id]) ?? s.status;
|
|
1515
|
+
return r === "wheelchair" || r === "companion" ? "available" : r;
|
|
1516
|
+
}
|
|
1517
|
+
function yn(s, t, r) {
|
|
1518
|
+
var c;
|
|
1519
|
+
const n = (c = t.priceCategories) == null ? void 0 : c.find((o) => o.id === s.priceCategoryId);
|
|
1520
|
+
return {
|
|
1521
|
+
amount: (n == null ? void 0 : n.price) ?? r.basePrice,
|
|
1522
|
+
currency: r.currency
|
|
1523
|
+
};
|
|
1524
|
+
}
|
|
1525
|
+
function qt(s, t = {}, r) {
|
|
1526
|
+
return !(ke(s, r) !== "available" || t.allowedCategories && !t.allowedCategories.includes(s.priceCategoryId));
|
|
1527
|
+
}
|
|
1528
|
+
function Ln(s, t = {}, r) {
|
|
1529
|
+
const n = [];
|
|
1530
|
+
let c = null;
|
|
1531
|
+
return s.forEach((o, d) => {
|
|
1532
|
+
qt(o, t, r) ? c ? c.seats.push(o) : c = { start: d, seats: [o] } : c && (n.push(c), c = null);
|
|
1533
|
+
}), c && n.push(c), n;
|
|
1534
|
+
}
|
|
1535
|
+
function jt(s, t, r = {}, n) {
|
|
1536
|
+
const c = r.maxSeats ?? 8;
|
|
1537
|
+
if (s.length > c)
|
|
1538
|
+
return { ok: !1, reason: "max-seats" };
|
|
1539
|
+
for (const d of s) {
|
|
1540
|
+
const m = t.seatById.get(d);
|
|
1541
|
+
if (m) {
|
|
1542
|
+
if (ke(m, n) !== "available")
|
|
1543
|
+
return { ok: !1, reason: "unavailable", seatId: d };
|
|
1544
|
+
if (r.allowedCategories && !r.allowedCategories.includes(m.priceCategoryId))
|
|
1545
|
+
return { ok: !1, reason: "category-not-allowed", seatId: d };
|
|
1546
|
+
}
|
|
1547
|
+
}
|
|
1548
|
+
if (!r.adjacentOnly || s.length === 0)
|
|
1549
|
+
return { ok: !0 };
|
|
1550
|
+
const o = /* @__PURE__ */ new Map();
|
|
1551
|
+
for (const d of s) {
|
|
1552
|
+
const m = t.locationById.get(d);
|
|
1553
|
+
if (!m)
|
|
1554
|
+
continue;
|
|
1555
|
+
const h = `${m.sectionId}::${m.rowIndex}`, i = o.get(h);
|
|
1556
|
+
i ? i.push(d) : o.set(h, [d]);
|
|
1557
|
+
}
|
|
1558
|
+
for (const [d, m] of o) {
|
|
1559
|
+
const [h, i] = d.split("::"), u = Number(i), p = t.rows.find((l) => l.sectionId === h && l.rowIndex === u);
|
|
1560
|
+
if (!p)
|
|
1561
|
+
continue;
|
|
1562
|
+
const b = Ln(p.seats, r, n), f = new Set(m);
|
|
1563
|
+
let g = null;
|
|
1564
|
+
for (const l of b)
|
|
1565
|
+
if (l.seats.some((y) => f.has(y.id))) {
|
|
1566
|
+
if (g)
|
|
1567
|
+
return { ok: !1, reason: "not-adjacent", seatId: m[0] };
|
|
1568
|
+
g = l;
|
|
1569
|
+
}
|
|
1570
|
+
if (!g)
|
|
1571
|
+
continue;
|
|
1572
|
+
const w = g.seats.map((l, y) => f.has(l.id) ? y : -1).filter((l) => l >= 0);
|
|
1573
|
+
if (w.length === 0)
|
|
1574
|
+
continue;
|
|
1575
|
+
const k = w[0], _ = w[w.length - 1];
|
|
1576
|
+
if (_ - k + 1 !== w.length)
|
|
1577
|
+
return { ok: !1, reason: "not-adjacent", seatId: m[0] };
|
|
1578
|
+
const $ = g.seats.length;
|
|
1579
|
+
if ($ > 1 && (k === 1 || $ - 1 - _ === 1))
|
|
1580
|
+
return { ok: !1, reason: "orphan-seat", seatId: m[0] };
|
|
1581
|
+
}
|
|
1582
|
+
return { ok: !0 };
|
|
1583
|
+
}
|
|
1584
|
+
function Gt(s, t, r, n = {}, c) {
|
|
1585
|
+
if (s.includes(t))
|
|
1586
|
+
return { selected: s.filter((m) => m !== t) };
|
|
1587
|
+
const o = [...s, t], d = jt(o, r, n, c);
|
|
1588
|
+
return d.ok ? { selected: o } : { rejected: d.reason ?? "not-adjacent" };
|
|
1589
|
+
}
|
|
1590
|
+
function Kt(s, t, r = {}, n = {}, c) {
|
|
1591
|
+
if (t <= 0)
|
|
1592
|
+
return [];
|
|
1593
|
+
const o = n.categoryId ? { ...r, allowedCategories: [n.categoryId] } : r;
|
|
1594
|
+
let d = null;
|
|
1595
|
+
for (const m of s.rows)
|
|
1596
|
+
if (!(n.sectionId && m.sectionId !== n.sectionId))
|
|
1597
|
+
for (const h of Ln(m.seats, o, c)) {
|
|
1598
|
+
const i = h.seats.length;
|
|
1599
|
+
if (!(i < t))
|
|
1600
|
+
for (let u = 0; u + t <= i; u += 1) {
|
|
1601
|
+
const p = u + t - 1;
|
|
1602
|
+
if (i > t && (u === 1 || i - 1 - p === 1))
|
|
1603
|
+
continue;
|
|
1604
|
+
const b = h.seats.slice(u, p + 1), f = b.reduce((g, w) => g + (w.viewScore ?? 50), 0) / t;
|
|
1605
|
+
(!d || f > d.score) && (d = { ids: b.map((g) => g.id), score: f });
|
|
1606
|
+
}
|
|
1607
|
+
}
|
|
1608
|
+
return (d == null ? void 0 : d.ids) ?? [];
|
|
1609
|
+
}
|
|
1610
|
+
function Ht(s, t, r) {
|
|
1611
|
+
var u, p, b, f;
|
|
1612
|
+
const n = s.locationById.get(t);
|
|
1613
|
+
if (!n)
|
|
1614
|
+
return null;
|
|
1615
|
+
const c = s.rows.findIndex(
|
|
1616
|
+
(g) => g.sectionId === n.sectionId && g.rowIndex === n.rowIndex
|
|
1617
|
+
);
|
|
1618
|
+
if (c < 0)
|
|
1619
|
+
return null;
|
|
1620
|
+
const o = s.rows[c];
|
|
1621
|
+
if (r === "left")
|
|
1622
|
+
return ((u = o.seats[n.seatIndex - 1]) == null ? void 0 : u.id) ?? null;
|
|
1623
|
+
if (r === "right")
|
|
1624
|
+
return ((p = o.seats[n.seatIndex + 1]) == null ? void 0 : p.id) ?? null;
|
|
1625
|
+
if (r === "row-start")
|
|
1626
|
+
return ((b = o.seats[0]) == null ? void 0 : b.id) ?? null;
|
|
1627
|
+
if (r === "row-end")
|
|
1628
|
+
return ((f = o.seats[o.seats.length - 1]) == null ? void 0 : f.id) ?? null;
|
|
1629
|
+
const d = s.rows[r === "up" ? c - 1 : c + 1];
|
|
1630
|
+
if (!d)
|
|
1631
|
+
return null;
|
|
1632
|
+
const m = o.seats[n.seatIndex].x;
|
|
1633
|
+
let h = null, i = 1 / 0;
|
|
1634
|
+
for (const g of d.seats) {
|
|
1635
|
+
const w = Math.abs(g.x - m);
|
|
1636
|
+
w < i && (i = w, h = g);
|
|
1637
|
+
}
|
|
1638
|
+
return (h == null ? void 0 : h.id) ?? null;
|
|
1639
|
+
}
|
|
1640
|
+
function Qt(s, t, r) {
|
|
1641
|
+
var h, i, u;
|
|
1642
|
+
const n = s.sections.filter((p) => p.seatCount > 0);
|
|
1643
|
+
if (n.length === 0)
|
|
1644
|
+
return null;
|
|
1645
|
+
const c = t ? (h = s.locationById.get(t)) == null ? void 0 : h.sectionId : void 0, o = n.findIndex((p) => p.section.id === c), d = o < 0 ? 0 : r === "next" ? o + 1 : o - 1, m = n[d];
|
|
1646
|
+
return m ? ((u = (i = s.rows.find((p) => p.sectionId === m.section.id)) == null ? void 0 : i.seats[0]) == null ? void 0 : u.id) ?? null : null;
|
|
1647
|
+
}
|
|
1648
|
+
const Ae = 8;
|
|
1649
|
+
function Zt(s, t) {
|
|
1650
|
+
return s.seats.length === 0 ? 0 : s.seats.filter((n) => ke(n, t) === "available").length / s.seats.length;
|
|
1651
|
+
}
|
|
1652
|
+
const Jt = ({
|
|
1653
|
+
cull: s,
|
|
1654
|
+
selectedIds: t,
|
|
1655
|
+
cursorId: r,
|
|
1656
|
+
statusOverrides: n,
|
|
1657
|
+
sectionColorById: c,
|
|
1658
|
+
interactive: o,
|
|
1659
|
+
onSeatClick: d,
|
|
1660
|
+
onSectionClick: m,
|
|
1661
|
+
describeSeat: h
|
|
1662
|
+
}) => s.tier === "section" ? /* @__PURE__ */ e("g", { className: "nice-seating-chart__sections", children: s.sections.map(({ section: i, bounds: u, seatCount: p }) => /* @__PURE__ */ a("g", { className: "nice-seating-chart__section", children: [
|
|
1663
|
+
/* @__PURE__ */ e(
|
|
1664
|
+
"rect",
|
|
1665
|
+
{
|
|
1666
|
+
x: u.minX,
|
|
1667
|
+
y: u.minY,
|
|
1668
|
+
width: u.maxX - u.minX,
|
|
1669
|
+
height: u.maxY - u.minY,
|
|
1670
|
+
rx: 12,
|
|
1671
|
+
className: "nice-seating-chart__section-shape",
|
|
1672
|
+
style: { fill: c.get(i.id) },
|
|
1673
|
+
role: m ? "button" : "img",
|
|
1674
|
+
"aria-label": `${i.name}, ${p} seats`,
|
|
1675
|
+
tabIndex: m ? 0 : void 0,
|
|
1676
|
+
onClick: m ? () => m(i.id) : void 0
|
|
1677
|
+
}
|
|
1678
|
+
),
|
|
1679
|
+
/* @__PURE__ */ e(
|
|
1680
|
+
"text",
|
|
1681
|
+
{
|
|
1682
|
+
x: (u.minX + u.maxX) / 2,
|
|
1683
|
+
y: (u.minY + u.maxY) / 2,
|
|
1684
|
+
className: "nice-seating-chart__section-label",
|
|
1685
|
+
textAnchor: "middle",
|
|
1686
|
+
dominantBaseline: "middle",
|
|
1687
|
+
"aria-hidden": "true",
|
|
1688
|
+
children: i.name
|
|
1689
|
+
}
|
|
1690
|
+
)
|
|
1691
|
+
] }, i.id)) }) : s.tier === "row" ? /* @__PURE__ */ e("g", { className: "nice-seating-chart__rows", children: s.rows.map((i) => {
|
|
1692
|
+
const u = Zt(i, n);
|
|
1693
|
+
return /* @__PURE__ */ a("g", { children: [
|
|
1694
|
+
/* @__PURE__ */ e(
|
|
1695
|
+
"rect",
|
|
1696
|
+
{
|
|
1697
|
+
x: i.bounds.minX,
|
|
1698
|
+
y: i.bounds.minY,
|
|
1699
|
+
width: i.bounds.maxX - i.bounds.minX,
|
|
1700
|
+
height: i.bounds.maxY - i.bounds.minY,
|
|
1701
|
+
rx: 8,
|
|
1702
|
+
className: "nice-seating-chart__row-shape",
|
|
1703
|
+
style: {
|
|
1704
|
+
fill: c.get(i.sectionId),
|
|
1705
|
+
fillOpacity: 0.25 + u * 0.65
|
|
1706
|
+
},
|
|
1707
|
+
role: "img",
|
|
1708
|
+
"aria-label": `Row ${i.label}, ${i.seats.length} seats, ${Math.round(
|
|
1709
|
+
u * i.seats.length
|
|
1710
|
+
)} available`
|
|
1711
|
+
}
|
|
1712
|
+
),
|
|
1713
|
+
/* @__PURE__ */ e(
|
|
1714
|
+
"text",
|
|
1715
|
+
{
|
|
1716
|
+
x: i.bounds.minX - 6,
|
|
1717
|
+
y: (i.bounds.minY + i.bounds.maxY) / 2,
|
|
1718
|
+
className: "nice-seating-chart__row-label",
|
|
1719
|
+
textAnchor: "end",
|
|
1720
|
+
dominantBaseline: "middle",
|
|
1721
|
+
"aria-hidden": "true",
|
|
1722
|
+
children: i.label
|
|
1723
|
+
}
|
|
1724
|
+
)
|
|
1725
|
+
] }, `${i.sectionId}-${i.rowIndex}`);
|
|
1726
|
+
}) }) : /* @__PURE__ */ e("g", { className: "nice-seating-chart__seats", children: s.seats.map((i) => {
|
|
1727
|
+
const u = ke(i, n), p = tn(i), b = t.has(i.id), f = r === i.id, g = { row: i.row, number: i.number }, w = [
|
|
1728
|
+
"nice-seating-chart__seat",
|
|
1729
|
+
`nice-seating-chart__seat--${u}`,
|
|
1730
|
+
b ? "nice-seating-chart__seat--selected" : "",
|
|
1731
|
+
p ? `nice-seating-chart__seat--${p}` : "",
|
|
1732
|
+
f ? "nice-seating-chart__seat--cursor" : ""
|
|
1733
|
+
].filter(Boolean).join(" ");
|
|
1734
|
+
return /* @__PURE__ */ a(
|
|
1735
|
+
"g",
|
|
1736
|
+
{
|
|
1737
|
+
className: w,
|
|
1738
|
+
"data-seat-id": i.id,
|
|
1739
|
+
role: "gridcell",
|
|
1740
|
+
"aria-selected": b,
|
|
1741
|
+
"aria-disabled": u !== "available",
|
|
1742
|
+
"aria-label": h(i),
|
|
1743
|
+
tabIndex: f ? 0 : -1,
|
|
1744
|
+
onClick: o && d ? () => d(i) : void 0,
|
|
1745
|
+
children: [
|
|
1746
|
+
p ? /* @__PURE__ */ e(
|
|
1747
|
+
"rect",
|
|
1748
|
+
{
|
|
1749
|
+
x: i.x - Ae,
|
|
1750
|
+
y: i.y - Ae,
|
|
1751
|
+
width: Ae * 2,
|
|
1752
|
+
height: Ae * 2,
|
|
1753
|
+
rx: 3,
|
|
1754
|
+
className: "nice-seating-chart__seat-shape",
|
|
1755
|
+
fill: p === "companion" ? "url(#nice-seat-companion-hatch)" : void 0
|
|
1756
|
+
}
|
|
1757
|
+
) : /* @__PURE__ */ e(
|
|
1758
|
+
"circle",
|
|
1759
|
+
{
|
|
1760
|
+
cx: i.x,
|
|
1761
|
+
cy: i.y,
|
|
1762
|
+
r: Ae,
|
|
1763
|
+
className: "nice-seating-chart__seat-shape"
|
|
1764
|
+
}
|
|
1765
|
+
),
|
|
1766
|
+
p === "wheelchair" && /* @__PURE__ */ e(
|
|
1767
|
+
Cn,
|
|
1768
|
+
{
|
|
1769
|
+
size: 10,
|
|
1770
|
+
x: i.x - 5,
|
|
1771
|
+
y: i.y - 5,
|
|
1772
|
+
className: "nice-seating-chart__seat-glyph"
|
|
1773
|
+
}
|
|
1774
|
+
),
|
|
1775
|
+
/* @__PURE__ */ e("title", { children: h(i) }),
|
|
1776
|
+
/* @__PURE__ */ e(
|
|
1777
|
+
"text",
|
|
1778
|
+
{
|
|
1779
|
+
x: i.x,
|
|
1780
|
+
y: i.y,
|
|
1781
|
+
className: "nice-seating-chart__seat-number",
|
|
1782
|
+
textAnchor: "middle",
|
|
1783
|
+
dominantBaseline: "middle",
|
|
1784
|
+
"aria-hidden": "true",
|
|
1785
|
+
children: g.number
|
|
1786
|
+
}
|
|
1787
|
+
)
|
|
1788
|
+
]
|
|
1789
|
+
},
|
|
1790
|
+
i.id
|
|
1791
|
+
);
|
|
1792
|
+
}) }), ei = ({
|
|
1793
|
+
index: s,
|
|
1794
|
+
selectedIds: t,
|
|
1795
|
+
statusOverrides: r,
|
|
1796
|
+
maxSeats: n,
|
|
1797
|
+
onSeatToggle: c,
|
|
1798
|
+
onBestAvailable: o,
|
|
1799
|
+
describeSeat: d,
|
|
1800
|
+
disabled: m = !1,
|
|
1801
|
+
defaultOpen: h = !1
|
|
1802
|
+
}) => {
|
|
1803
|
+
var $;
|
|
1804
|
+
const i = X(
|
|
1805
|
+
() => s.sections.filter((l) => l.seatCount > 0),
|
|
1806
|
+
[s.sections]
|
|
1807
|
+
), [u, p] = E((($ = i[0]) == null ? void 0 : $.section.id) ?? ""), [b, f] = E(0), [g, w] = E(2), k = X(
|
|
1808
|
+
() => s.rows.filter((l) => l.sectionId === u),
|
|
1809
|
+
[s.rows, u]
|
|
1810
|
+
), _ = k.find((l) => l.rowIndex === b) ?? k[0];
|
|
1811
|
+
return /* @__PURE__ */ a(
|
|
1812
|
+
St,
|
|
1813
|
+
{
|
|
1814
|
+
trigger: "Choose seats without the map",
|
|
1815
|
+
defaultExpanded: h,
|
|
1816
|
+
className: "nice-seating-chart__list-panel",
|
|
1817
|
+
children: [
|
|
1818
|
+
o && /* @__PURE__ */ a("div", { className: "nice-seating-chart__best", children: [
|
|
1819
|
+
/* @__PURE__ */ a("label", { className: "nice-seating-chart__field", children: [
|
|
1820
|
+
/* @__PURE__ */ e("span", { children: "How many seats?" }),
|
|
1821
|
+
/* @__PURE__ */ e(
|
|
1822
|
+
Je,
|
|
1823
|
+
{
|
|
1824
|
+
value: g,
|
|
1825
|
+
onChange: (l) => w(Math.max(1, Math.min(n, l ?? 1))),
|
|
1826
|
+
min: 1,
|
|
1827
|
+
max: n,
|
|
1828
|
+
size: "xs",
|
|
1829
|
+
disabled: m
|
|
1830
|
+
}
|
|
1831
|
+
)
|
|
1832
|
+
] }),
|
|
1833
|
+
/* @__PURE__ */ e(
|
|
1834
|
+
F,
|
|
1835
|
+
{
|
|
1836
|
+
size: "sm",
|
|
1837
|
+
variant: "primary",
|
|
1838
|
+
disabled: m,
|
|
1839
|
+
onClick: () => o(g, { sectionId: u || void 0 }),
|
|
1840
|
+
children: "Best available"
|
|
1841
|
+
}
|
|
1842
|
+
)
|
|
1843
|
+
] }),
|
|
1844
|
+
/* @__PURE__ */ a("div", { className: "nice-seating-chart__pickers", children: [
|
|
1845
|
+
/* @__PURE__ */ a("label", { className: "nice-seating-chart__field", children: [
|
|
1846
|
+
/* @__PURE__ */ e("span", { children: "Section" }),
|
|
1847
|
+
/* @__PURE__ */ e(
|
|
1848
|
+
Pe,
|
|
1849
|
+
{
|
|
1850
|
+
size: "sm",
|
|
1851
|
+
value: u,
|
|
1852
|
+
disabled: m,
|
|
1853
|
+
onChange: (l) => {
|
|
1854
|
+
p(l), f(0);
|
|
1855
|
+
},
|
|
1856
|
+
options: i.map((l) => ({
|
|
1857
|
+
value: l.section.id,
|
|
1858
|
+
label: `${l.section.name} (${l.seatCount})`
|
|
1859
|
+
}))
|
|
1860
|
+
}
|
|
1861
|
+
)
|
|
1862
|
+
] }),
|
|
1863
|
+
/* @__PURE__ */ a("label", { className: "nice-seating-chart__field", children: [
|
|
1864
|
+
/* @__PURE__ */ e("span", { children: "Row" }),
|
|
1865
|
+
/* @__PURE__ */ e(
|
|
1866
|
+
Pe,
|
|
1867
|
+
{
|
|
1868
|
+
size: "sm",
|
|
1869
|
+
value: String((_ == null ? void 0 : _.rowIndex) ?? 0),
|
|
1870
|
+
disabled: m || k.length === 0,
|
|
1871
|
+
onChange: (l) => f(Number(l)),
|
|
1872
|
+
options: k.map((l) => ({
|
|
1873
|
+
value: String(l.rowIndex),
|
|
1874
|
+
label: `${l.label} (${l.seats.length})`
|
|
1875
|
+
}))
|
|
1876
|
+
}
|
|
1877
|
+
)
|
|
1878
|
+
] })
|
|
1879
|
+
] }),
|
|
1880
|
+
_ && /* @__PURE__ */ e("ul", { className: "nice-seating-chart__seat-list", children: _.seats.map((l) => {
|
|
1881
|
+
const y = ke(l, r), v = tn(l), A = t.has(l.id);
|
|
1882
|
+
return /* @__PURE__ */ e("li", { children: /* @__PURE__ */ a(
|
|
1883
|
+
F,
|
|
1884
|
+
{
|
|
1885
|
+
size: "sm",
|
|
1886
|
+
variant: A ? "primary" : "outline",
|
|
1887
|
+
disabled: m || y !== "available",
|
|
1888
|
+
ariaLabel: d(l),
|
|
1889
|
+
"aria-pressed": A,
|
|
1890
|
+
onClick: () => c(l),
|
|
1891
|
+
children: [
|
|
1892
|
+
l.number,
|
|
1893
|
+
v && /* @__PURE__ */ e(Cn, { size: 11 })
|
|
1894
|
+
]
|
|
1895
|
+
}
|
|
1896
|
+
) }, l.id);
|
|
1897
|
+
}) })
|
|
1898
|
+
]
|
|
1899
|
+
}
|
|
1900
|
+
);
|
|
1901
|
+
}, ni = { zoom: 1, pan: { x: 0, y: 0 } };
|
|
1902
|
+
function ti(s = {}) {
|
|
1903
|
+
const {
|
|
1904
|
+
minZoom: t = 0.1,
|
|
1905
|
+
maxZoom: r = 10,
|
|
1906
|
+
initial: n = ni,
|
|
1907
|
+
viewport: c,
|
|
1908
|
+
onViewportChange: o,
|
|
1909
|
+
disabled: d = !1
|
|
1910
|
+
} = s, [m, h] = E(n), i = c ?? m, [u, p] = E(!1), b = ve(/* @__PURE__ */ new Map()), f = ve(null), g = ve(null), w = G(
|
|
1911
|
+
(N) => {
|
|
1912
|
+
c === void 0 && h(N), o == null || o(N);
|
|
1913
|
+
},
|
|
1914
|
+
[c, o]
|
|
1915
|
+
), k = G(
|
|
1916
|
+
(N) => Math.min(r, Math.max(t, N)),
|
|
1917
|
+
[t, r]
|
|
1918
|
+
), _ = G(
|
|
1919
|
+
(N, L) => {
|
|
1920
|
+
const V = k(i.zoom * N);
|
|
1921
|
+
if (V === i.zoom)
|
|
1922
|
+
return;
|
|
1923
|
+
const B = V / i.zoom;
|
|
1924
|
+
w({
|
|
1925
|
+
zoom: V,
|
|
1926
|
+
pan: {
|
|
1927
|
+
x: L.x - (L.x - i.pan.x) * B,
|
|
1928
|
+
y: L.y - (L.y - i.pan.y) * B
|
|
1929
|
+
}
|
|
1930
|
+
});
|
|
1931
|
+
},
|
|
1932
|
+
[w, k, i]
|
|
1933
|
+
), $ = G(
|
|
1934
|
+
(N, L, V) => {
|
|
1935
|
+
const B = L ?? (V ? { x: V.width / 2, y: V.height / 2 } : { x: 0, y: 0 });
|
|
1936
|
+
_(N, B);
|
|
1937
|
+
},
|
|
1938
|
+
[_]
|
|
1939
|
+
), l = G(
|
|
1940
|
+
(N, L, V = 24) => {
|
|
1941
|
+
const B = Math.max(1, N.maxX - N.minX), C = Math.max(1, N.maxY - N.minY), O = k(
|
|
1942
|
+
Math.min((L.width - V * 2) / B, (L.height - V * 2) / C)
|
|
1943
|
+
);
|
|
1944
|
+
w({
|
|
1945
|
+
zoom: O,
|
|
1946
|
+
pan: {
|
|
1947
|
+
x: (L.width - B * O) / 2 - N.minX * O,
|
|
1948
|
+
y: (L.height - C * O) / 2 - N.minY * O
|
|
1949
|
+
}
|
|
1950
|
+
});
|
|
1951
|
+
},
|
|
1952
|
+
[w, k]
|
|
1953
|
+
), y = G(() => w(n), [w, n]), v = G(
|
|
1954
|
+
(N) => ({
|
|
1955
|
+
x: (N.x - i.pan.x) / i.zoom,
|
|
1956
|
+
y: (N.y - i.pan.y) / i.zoom
|
|
1957
|
+
}),
|
|
1958
|
+
[i]
|
|
1959
|
+
), A = G(
|
|
1960
|
+
(N) => ({
|
|
1961
|
+
x: N.x * i.zoom + i.pan.x,
|
|
1962
|
+
y: N.y * i.zoom + i.pan.y
|
|
1963
|
+
}),
|
|
1964
|
+
[i]
|
|
1965
|
+
), I = (N) => {
|
|
1966
|
+
const L = N.currentTarget.getBoundingClientRect();
|
|
1967
|
+
return { x: N.clientX - L.left, y: N.clientY - L.top };
|
|
1968
|
+
};
|
|
1969
|
+
return {
|
|
1970
|
+
viewport: i,
|
|
1971
|
+
setViewport: w,
|
|
1972
|
+
containerProps: d ? {} : {
|
|
1973
|
+
onWheel: (N) => {
|
|
1974
|
+
N.preventDefault();
|
|
1975
|
+
const L = Math.exp(-N.deltaY * 2e-3);
|
|
1976
|
+
_(Math.min(2, Math.max(0.5, L)), I(N));
|
|
1977
|
+
},
|
|
1978
|
+
onPointerDown: (N) => {
|
|
1979
|
+
var V, B;
|
|
1980
|
+
const L = I(N);
|
|
1981
|
+
if (b.current.set(N.pointerId, L), (B = (V = N.currentTarget).setPointerCapture) == null || B.call(V, N.pointerId), b.current.size === 2) {
|
|
1982
|
+
const [C, O] = [...b.current.values()];
|
|
1983
|
+
f.current = {
|
|
1984
|
+
distance: Math.hypot(C.x - O.x, C.y - O.y) || 1,
|
|
1985
|
+
zoom: i.zoom
|
|
1986
|
+
};
|
|
1987
|
+
} else
|
|
1988
|
+
g.current = L, p(!0);
|
|
1989
|
+
},
|
|
1990
|
+
onPointerMove: (N) => {
|
|
1991
|
+
if (!b.current.has(N.pointerId))
|
|
1992
|
+
return;
|
|
1993
|
+
const L = I(N);
|
|
1994
|
+
if (b.current.set(N.pointerId, L), b.current.size === 2 && f.current) {
|
|
1995
|
+
const [C, O] = [...b.current.values()], z = Math.hypot(C.x - O.x, C.y - O.y) || 1, P = k(f.current.zoom * (z / f.current.distance)), M = { x: (C.x + O.x) / 2, y: (C.y + O.y) / 2 };
|
|
1996
|
+
P !== i.zoom && _(P / i.zoom, M);
|
|
1997
|
+
return;
|
|
1998
|
+
}
|
|
1999
|
+
if (!g.current)
|
|
2000
|
+
return;
|
|
2001
|
+
const V = L.x - g.current.x, B = L.y - g.current.y;
|
|
2002
|
+
g.current = L, w({ zoom: i.zoom, pan: { x: i.pan.x + V, y: i.pan.y + B } });
|
|
2003
|
+
},
|
|
2004
|
+
onPointerUp: (N) => {
|
|
2005
|
+
b.current.delete(N.pointerId), b.current.size < 2 && (f.current = null), b.current.size === 0 && (g.current = null, p(!1));
|
|
2006
|
+
},
|
|
2007
|
+
onPointerCancel: (N) => {
|
|
2008
|
+
b.current.delete(N.pointerId), f.current = null, g.current = null, p(!1);
|
|
2009
|
+
}
|
|
2010
|
+
},
|
|
2011
|
+
zoomBy: $,
|
|
2012
|
+
fitTo: l,
|
|
2013
|
+
reset: y,
|
|
2014
|
+
screenToWorld: v,
|
|
2015
|
+
worldToScreen: A,
|
|
2016
|
+
panning: u
|
|
2017
|
+
};
|
|
2018
|
+
}
|
|
2019
|
+
const ii = {
|
|
2020
|
+
"orphan-seat": "That would leave a single empty seat. Pick a different seat.",
|
|
2021
|
+
"not-adjacent": "Seats must be next to each other.",
|
|
2022
|
+
"max-seats": "You have selected as many seats as this order allows.",
|
|
2023
|
+
"category-not-allowed": "That seat is not part of the selected ticket type.",
|
|
2024
|
+
unavailable: "That seat is not available."
|
|
2025
|
+
}, ai = ee(
|
|
2026
|
+
function(t, r) {
|
|
2027
|
+
var de, $e, xe;
|
|
2028
|
+
const {
|
|
2029
|
+
chart: n,
|
|
2030
|
+
mode: c = "select",
|
|
2031
|
+
selection: o = {},
|
|
2032
|
+
selectedSeatIds: d,
|
|
2033
|
+
defaultSelectedSeatIds: m = [],
|
|
2034
|
+
onSelectionChange: h,
|
|
2035
|
+
onSelectionRejected: i,
|
|
2036
|
+
seatStatusOverrides: u,
|
|
2037
|
+
onSeatClick: p,
|
|
2038
|
+
onBestAvailable: b,
|
|
2039
|
+
lod: f = "auto",
|
|
2040
|
+
onLodChange: g,
|
|
2041
|
+
maxRenderedSeats: w = 2500,
|
|
2042
|
+
containerSize: k,
|
|
2043
|
+
showLegend: _ = !0,
|
|
2044
|
+
showList: $ = !1,
|
|
2045
|
+
zoomable: l = !0,
|
|
2046
|
+
locale: y,
|
|
2047
|
+
disabled: v = !1,
|
|
2048
|
+
readOnly: A = !1,
|
|
2049
|
+
className: I,
|
|
2050
|
+
style: D
|
|
2051
|
+
} = t, N = ve(null), [L, V] = E({ width: 800, height: 500 }), [B, C] = E(!1), [O, z] = E(m), [P, M] = E(null), [j, W] = E(""), S = d ?? O, Y = X(() => new Set(S), [S]), q = c === "select" && !v && !A && o.interactive !== !1, Q = o.maxSeats ?? 8, R = X(() => Xt(n), [n]), ne = k ?? L, H = !!k || B;
|
|
2052
|
+
Oe(() => {
|
|
2053
|
+
if (k || !N.current || typeof ResizeObserver > "u")
|
|
2054
|
+
return;
|
|
2055
|
+
const T = N.current, U = new ResizeObserver(([K]) => {
|
|
2056
|
+
const { width: Z, height: ae } = K.contentRect;
|
|
2057
|
+
Z > 0 && ae > 0 && (V({ width: Z, height: ae }), C(!0));
|
|
2058
|
+
});
|
|
2059
|
+
return U.observe(T), () => U.disconnect();
|
|
2060
|
+
}, [k]);
|
|
2061
|
+
const _e = ti({ disabled: !l || v }), { fitTo: le, viewport: me } = _e, Ne = ve(!1);
|
|
2062
|
+
Oe(() => {
|
|
2063
|
+
Ne.current || !H || R.totalSeats === 0 || ne.width <= 0 || (Ne.current = !0, le(R.bounds, ne));
|
|
2064
|
+
}, [le, R, ne, H]);
|
|
2065
|
+
const Me = X(() => Yt(me, ne, 40), [me, ne]), be = f !== "auto" ? f : P ? "seat" : void 0, he = X(
|
|
2066
|
+
() => Wt(R, Me, w, be),
|
|
2067
|
+
[R, Me, w, be]
|
|
2068
|
+
), we = ve(null);
|
|
2069
|
+
Oe(() => {
|
|
2070
|
+
we.current !== he.tier && (we.current = he.tier, g == null || g(he.tier));
|
|
2071
|
+
}, [he.tier, g]);
|
|
2072
|
+
const Ve = X(
|
|
2073
|
+
() => {
|
|
2074
|
+
var T;
|
|
2075
|
+
return new Map(((T = n.sections) == null ? void 0 : T.map((U) => [U.id, U.color])) ?? []);
|
|
2076
|
+
},
|
|
2077
|
+
[n.sections]
|
|
2078
|
+
), pe = X(
|
|
2079
|
+
() => {
|
|
2080
|
+
var T;
|
|
2081
|
+
return new Map(((T = n.sections) == null ? void 0 : T.map((U) => [U.id, U])) ?? []);
|
|
2082
|
+
},
|
|
2083
|
+
[n.sections]
|
|
2084
|
+
), oe = G(
|
|
2085
|
+
(T) => {
|
|
2086
|
+
const U = pe.get(T.sectorId), K = ke(T, u), Z = tn(T), ae = [
|
|
2087
|
+
U ? U.name : "",
|
|
2088
|
+
`row ${T.row}`,
|
|
2089
|
+
`seat ${T.number}`
|
|
2090
|
+
].filter(Boolean);
|
|
2091
|
+
if (U && o.showPrices !== !1) {
|
|
2092
|
+
const ue = yn(T, n, U);
|
|
2093
|
+
ae.push(se(ue.amount, ue.currency, y));
|
|
2094
|
+
}
|
|
2095
|
+
return ae.push(K), Z === "wheelchair" && ae.push("wheelchair accessible"), Z === "companion" && ae.push("companion seat"), ae.join(", ");
|
|
2096
|
+
},
|
|
2097
|
+
[n, pe, u, o.showPrices, y]
|
|
2098
|
+
), re = G(
|
|
2099
|
+
(T) => {
|
|
2100
|
+
d === void 0 && z(T), h == null || h(T);
|
|
2101
|
+
},
|
|
2102
|
+
[d, h]
|
|
2103
|
+
), Ie = G(
|
|
2104
|
+
(T) => {
|
|
2105
|
+
if (p == null || p(T), !q)
|
|
2106
|
+
return;
|
|
2107
|
+
const U = Gt(S, T.id, R, o, u);
|
|
2108
|
+
if ("rejected" in U) {
|
|
2109
|
+
i == null || i({ reason: U.rejected, seatId: T.id }), W(ii[U.rejected]);
|
|
2110
|
+
return;
|
|
2111
|
+
}
|
|
2112
|
+
re(U.selected), W(`${oe(T)}. ${U.selected.length} of ${Q} selected.`);
|
|
2113
|
+
},
|
|
2114
|
+
[
|
|
2115
|
+
re,
|
|
2116
|
+
oe,
|
|
2117
|
+
R,
|
|
2118
|
+
q,
|
|
2119
|
+
Q,
|
|
2120
|
+
p,
|
|
2121
|
+
i,
|
|
2122
|
+
u,
|
|
2123
|
+
S,
|
|
2124
|
+
o
|
|
2125
|
+
]
|
|
2126
|
+
), ge = G(
|
|
2127
|
+
(T, U) => {
|
|
2128
|
+
if (b) {
|
|
2129
|
+
b(T, U);
|
|
2130
|
+
return;
|
|
2131
|
+
}
|
|
2132
|
+
const K = Kt(R, T, o, U, u);
|
|
2133
|
+
if (K.length === 0) {
|
|
2134
|
+
W(`No block of ${T} seats together is available.`);
|
|
2135
|
+
return;
|
|
2136
|
+
}
|
|
2137
|
+
re(K), M(K[0]), W(`Selected ${K.length} seats together.`);
|
|
2138
|
+
},
|
|
2139
|
+
[re, R, b, u, o]
|
|
2140
|
+
), Ce = G(
|
|
2141
|
+
(T) => {
|
|
2142
|
+
const U = R.locationById.get(T);
|
|
2143
|
+
if (!U)
|
|
2144
|
+
return;
|
|
2145
|
+
const K = R.rows.find(
|
|
2146
|
+
(Z) => Z.sectionId === U.sectionId && Z.rowIndex === U.rowIndex
|
|
2147
|
+
);
|
|
2148
|
+
K && le(K.bounds, ne, 80);
|
|
2149
|
+
},
|
|
2150
|
+
[le, R, ne]
|
|
2151
|
+
), fe = G(
|
|
2152
|
+
(T) => {
|
|
2153
|
+
if (!T)
|
|
2154
|
+
return;
|
|
2155
|
+
M(T), Ce(T);
|
|
2156
|
+
const U = R.seatById.get(T);
|
|
2157
|
+
U && W(oe(U));
|
|
2158
|
+
},
|
|
2159
|
+
[oe, R.seatById, Ce]
|
|
2160
|
+
), Fe = (T) => {
|
|
2161
|
+
var ae, ue;
|
|
2162
|
+
const U = P ?? ((ue = (ae = R.rows[0]) == null ? void 0 : ae.seats[0]) == null ? void 0 : ue.id) ?? null;
|
|
2163
|
+
if (!U)
|
|
2164
|
+
return;
|
|
2165
|
+
const Z = {
|
|
2166
|
+
ArrowLeft: "left",
|
|
2167
|
+
ArrowRight: "right",
|
|
2168
|
+
ArrowUp: "up",
|
|
2169
|
+
ArrowDown: "down",
|
|
2170
|
+
Home: "row-start",
|
|
2171
|
+
End: "row-end"
|
|
2172
|
+
}[T.key];
|
|
2173
|
+
if (Z) {
|
|
2174
|
+
T.preventDefault(), fe(P ? Ht(R, U, Z) : U);
|
|
2175
|
+
return;
|
|
2176
|
+
}
|
|
2177
|
+
if (T.key === "PageDown" || T.key === "PageUp") {
|
|
2178
|
+
T.preventDefault(), fe(Qt(R, P, T.key === "PageDown" ? "next" : "prev"));
|
|
2179
|
+
return;
|
|
2180
|
+
}
|
|
2181
|
+
if (T.key === "Enter" || T.key === " ") {
|
|
2182
|
+
T.preventDefault();
|
|
2183
|
+
const De = R.seatById.get(U);
|
|
2184
|
+
De && Ie(De);
|
|
2185
|
+
return;
|
|
2186
|
+
}
|
|
2187
|
+
T.key === "Escape" && S.length > 0 && (T.preventDefault(), re([]), W("Selection cleared."));
|
|
2188
|
+
};
|
|
2189
|
+
if (R.totalSeats === 0)
|
|
2190
|
+
return /* @__PURE__ */ e("div", { ref: r, className: `nice-seating-chart ${I ?? ""}`, style: D, children: /* @__PURE__ */ e(
|
|
2191
|
+
ye,
|
|
2192
|
+
{
|
|
2193
|
+
title: "This chart has no seats",
|
|
2194
|
+
description: "Add sections and rows to the seating chart to see it here."
|
|
2195
|
+
}
|
|
2196
|
+
) });
|
|
2197
|
+
const Se = S.reduce((T, U) => {
|
|
2198
|
+
const K = R.seatById.get(U), Z = K ? pe.get(K.sectorId) : void 0;
|
|
2199
|
+
return !K || !Z ? T : T + yn(K, n, Z).amount;
|
|
2200
|
+
}, 0), ze = (($e = (de = n.sections) == null ? void 0 : de[0]) == null ? void 0 : $e.currency) ?? "PLN";
|
|
2201
|
+
return /* @__PURE__ */ a(
|
|
2202
|
+
"div",
|
|
2203
|
+
{
|
|
2204
|
+
ref: r,
|
|
2205
|
+
className: `nice-seating-chart nice-seating-chart--${c} ${I ?? ""}`,
|
|
2206
|
+
style: D,
|
|
2207
|
+
children: [
|
|
2208
|
+
/* @__PURE__ */ a(
|
|
2209
|
+
"div",
|
|
2210
|
+
{
|
|
2211
|
+
ref: N,
|
|
2212
|
+
className: "nice-seating-chart__canvas-host",
|
|
2213
|
+
role: "grid",
|
|
2214
|
+
"aria-label": `${n.name} seating chart`,
|
|
2215
|
+
"aria-rowcount": R.rows.length,
|
|
2216
|
+
"aria-colcount": R.totalSeats,
|
|
2217
|
+
tabIndex: P ? -1 : 0,
|
|
2218
|
+
onKeyDown: Fe,
|
|
2219
|
+
..._e.containerProps,
|
|
2220
|
+
children: [
|
|
2221
|
+
/* @__PURE__ */ a(
|
|
2222
|
+
"svg",
|
|
2223
|
+
{
|
|
2224
|
+
className: "nice-seating-chart__canvas",
|
|
2225
|
+
width: "100%",
|
|
2226
|
+
height: "100%",
|
|
2227
|
+
role: "presentation",
|
|
2228
|
+
children: [
|
|
2229
|
+
/* @__PURE__ */ e("defs", { children: /* @__PURE__ */ e(
|
|
2230
|
+
"pattern",
|
|
2231
|
+
{
|
|
2232
|
+
id: "nice-seat-companion-hatch",
|
|
2233
|
+
width: 4,
|
|
2234
|
+
height: 4,
|
|
2235
|
+
patternUnits: "userSpaceOnUse",
|
|
2236
|
+
patternTransform: "rotate(45)",
|
|
2237
|
+
children: /* @__PURE__ */ e("line", { x1: 0, y1: 0, x2: 0, y2: 4, className: "nice-seating-chart__hatch" })
|
|
2238
|
+
}
|
|
2239
|
+
) }),
|
|
2240
|
+
/* @__PURE__ */ e("g", { transform: `translate(${me.pan.x} ${me.pan.y}) scale(${me.zoom})`, children: /* @__PURE__ */ e(
|
|
2241
|
+
Jt,
|
|
2242
|
+
{
|
|
2243
|
+
cull: he,
|
|
2244
|
+
selectedIds: Y,
|
|
2245
|
+
cursorId: P,
|
|
2246
|
+
statusOverrides: u,
|
|
2247
|
+
sectionColorById: Ve,
|
|
2248
|
+
interactive: q,
|
|
2249
|
+
onSeatClick: Ie,
|
|
2250
|
+
onSectionClick: o.sectionSelect ? (T) => {
|
|
2251
|
+
var K;
|
|
2252
|
+
const U = (K = R.rows.find((Z) => Z.sectionId === T)) == null ? void 0 : K.seats[0];
|
|
2253
|
+
U && fe(U.id);
|
|
2254
|
+
} : void 0,
|
|
2255
|
+
describeSeat: oe
|
|
2256
|
+
}
|
|
2257
|
+
) })
|
|
2258
|
+
]
|
|
2259
|
+
}
|
|
2260
|
+
),
|
|
2261
|
+
l && /* @__PURE__ */ a("div", { className: "nice-seating-chart__zoom", children: [
|
|
2262
|
+
/* @__PURE__ */ e(
|
|
2263
|
+
F,
|
|
2264
|
+
{
|
|
2265
|
+
size: "sm",
|
|
2266
|
+
variant: "ghost",
|
|
2267
|
+
ariaLabel: "Zoom in",
|
|
2268
|
+
onClick: () => _e.zoomBy(1.25, void 0, ne),
|
|
2269
|
+
children: "+"
|
|
2270
|
+
}
|
|
2271
|
+
),
|
|
2272
|
+
/* @__PURE__ */ e(
|
|
2273
|
+
F,
|
|
2274
|
+
{
|
|
2275
|
+
size: "sm",
|
|
2276
|
+
variant: "ghost",
|
|
2277
|
+
ariaLabel: "Zoom out",
|
|
2278
|
+
onClick: () => _e.zoomBy(0.8, void 0, ne),
|
|
2279
|
+
children: "−"
|
|
2280
|
+
}
|
|
2281
|
+
),
|
|
2282
|
+
/* @__PURE__ */ e(
|
|
2283
|
+
F,
|
|
2284
|
+
{
|
|
2285
|
+
size: "sm",
|
|
2286
|
+
variant: "ghost",
|
|
2287
|
+
ariaLabel: "Fit to view",
|
|
2288
|
+
onClick: () => le(R.bounds, ne),
|
|
2289
|
+
children: "Fit"
|
|
2290
|
+
}
|
|
2291
|
+
)
|
|
2292
|
+
] })
|
|
2293
|
+
]
|
|
2294
|
+
}
|
|
2295
|
+
),
|
|
2296
|
+
/* @__PURE__ */ e("p", { className: "nice-seating-chart__status", role: "status", "aria-live": "polite", children: j }),
|
|
2297
|
+
_ && /* @__PURE__ */ a("ul", { className: "nice-seating-chart__legend", children: [
|
|
2298
|
+
(xe = n.priceCategories) == null ? void 0 : xe.map((T) => /* @__PURE__ */ a("li", { className: "nice-seating-chart__legend-item", children: [
|
|
2299
|
+
/* @__PURE__ */ e(
|
|
2300
|
+
"span",
|
|
2301
|
+
{
|
|
2302
|
+
className: "nice-seating-chart__legend-swatch",
|
|
2303
|
+
style: { background: T.color },
|
|
2304
|
+
"aria-hidden": "true"
|
|
2305
|
+
}
|
|
2306
|
+
),
|
|
2307
|
+
T.name,
|
|
2308
|
+
" · ",
|
|
2309
|
+
se(T.price, ze, y)
|
|
2310
|
+
] }, T.id)),
|
|
2311
|
+
/* @__PURE__ */ a("li", { className: "nice-seating-chart__legend-item nice-seating-chart__legend-item--sold", children: [
|
|
2312
|
+
/* @__PURE__ */ e("span", { className: "nice-seating-chart__legend-swatch", "aria-hidden": "true" }),
|
|
2313
|
+
" Sold"
|
|
2314
|
+
] })
|
|
2315
|
+
] }),
|
|
2316
|
+
c === "select" && S.length > 0 && /* @__PURE__ */ a("p", { className: "nice-seating-chart__total", children: [
|
|
2317
|
+
S.length,
|
|
2318
|
+
" seat",
|
|
2319
|
+
S.length === 1 ? "" : "s",
|
|
2320
|
+
" ·",
|
|
2321
|
+
" ",
|
|
2322
|
+
se(Se, ze, y)
|
|
2323
|
+
] }),
|
|
2324
|
+
$ && /* @__PURE__ */ e(
|
|
2325
|
+
ei,
|
|
2326
|
+
{
|
|
2327
|
+
index: R,
|
|
2328
|
+
selectedIds: Y,
|
|
2329
|
+
statusOverrides: u,
|
|
2330
|
+
maxSeats: Q,
|
|
2331
|
+
onSeatToggle: Ie,
|
|
2332
|
+
onBestAvailable: ge,
|
|
2333
|
+
describeSeat: oe,
|
|
2334
|
+
disabled: !q,
|
|
2335
|
+
defaultOpen: c === "select" && $
|
|
2336
|
+
}
|
|
2337
|
+
)
|
|
2338
|
+
]
|
|
2339
|
+
}
|
|
2340
|
+
);
|
|
2341
|
+
}
|
|
2342
|
+
), Pi = ee(
|
|
2343
|
+
function({ showList: t = !0, className: r, ...n }, c) {
|
|
2344
|
+
return /* @__PURE__ */ e(
|
|
2345
|
+
ai,
|
|
2346
|
+
{
|
|
2347
|
+
ref: c,
|
|
2348
|
+
mode: "select",
|
|
2349
|
+
showList: t,
|
|
2350
|
+
className: `nice-seat-picker ${r ?? ""}`,
|
|
2351
|
+
...n
|
|
2352
|
+
}
|
|
2353
|
+
);
|
|
2354
|
+
}
|
|
2355
|
+
), Bn = /\{\{\s*([\w.-]+)\s*\}\}/g, si = {
|
|
2356
|
+
"&": "&",
|
|
2357
|
+
"<": "<",
|
|
2358
|
+
">": ">",
|
|
2359
|
+
'"': """,
|
|
2360
|
+
"'": "'"
|
|
2361
|
+
};
|
|
2362
|
+
function ri(s) {
|
|
2363
|
+
return s.replace(/[&<>"']/g, (t) => si[t] ?? t);
|
|
2364
|
+
}
|
|
2365
|
+
function li(s) {
|
|
2366
|
+
const t = [], r = /* @__PURE__ */ new Set();
|
|
2367
|
+
for (const n of s.matchAll(Bn)) {
|
|
2368
|
+
const c = n[1];
|
|
2369
|
+
r.has(c) || (r.add(c), t.push(c));
|
|
2370
|
+
}
|
|
2371
|
+
return t;
|
|
2372
|
+
}
|
|
2373
|
+
function ci(s, t = {}, r = {}) {
|
|
2374
|
+
const { escape: n = !0, missing: c = "keep" } = r;
|
|
2375
|
+
return s.replace(Bn, (o, d) => {
|
|
2376
|
+
const m = t[d];
|
|
2377
|
+
return m == null ? c === "blank" ? "" : o : n ? ri(String(m)) : String(m);
|
|
2378
|
+
});
|
|
2379
|
+
}
|
|
2380
|
+
function _n(s) {
|
|
2381
|
+
return `{{${s}}}`;
|
|
2382
|
+
}
|
|
2383
|
+
function oi(s, t = {}) {
|
|
2384
|
+
return li(s).filter((r) => t[r] === void 0 || t[r] === null);
|
|
2385
|
+
}
|
|
2386
|
+
const di = [
|
|
2387
|
+
"bold",
|
|
2388
|
+
"italic",
|
|
2389
|
+
"underline",
|
|
2390
|
+
"h1",
|
|
2391
|
+
"h2",
|
|
2392
|
+
"ul",
|
|
2393
|
+
"ol",
|
|
2394
|
+
"link",
|
|
2395
|
+
"image",
|
|
2396
|
+
"alignLeft",
|
|
2397
|
+
"alignCenter",
|
|
2398
|
+
"undo",
|
|
2399
|
+
"redo"
|
|
2400
|
+
], Ti = ee(
|
|
2401
|
+
function(t, r) {
|
|
2402
|
+
const {
|
|
2403
|
+
template: n,
|
|
2404
|
+
onTemplateChange: c,
|
|
2405
|
+
tokens: o = [],
|
|
2406
|
+
previewData: d = {},
|
|
2407
|
+
recipients: m = [],
|
|
2408
|
+
onRecipientsChange: h,
|
|
2409
|
+
onSend: i,
|
|
2410
|
+
sending: u = !1,
|
|
2411
|
+
toolbar: p = di,
|
|
2412
|
+
disabled: b = !1,
|
|
2413
|
+
readOnly: f = !1,
|
|
2414
|
+
size: g = "md",
|
|
2415
|
+
className: w,
|
|
2416
|
+
style: k
|
|
2417
|
+
} = t, [_, $] = E(""), l = b || f || u, y = X(() => Dn(_), [_]), v = X(() => {
|
|
2418
|
+
const C = {};
|
|
2419
|
+
for (const O of o)
|
|
2420
|
+
O.sample !== void 0 && (C[O.key] = O.sample);
|
|
2421
|
+
return { ...C, ...d };
|
|
2422
|
+
}, [o, d]), A = X(
|
|
2423
|
+
() => ci(n.body ?? "", v),
|
|
2424
|
+
[n.body, v]
|
|
2425
|
+
), I = X(
|
|
2426
|
+
() => oi(n.body ?? "", v),
|
|
2427
|
+
[n.body, v]
|
|
2428
|
+
), D = m.map((C) => C.email), N = (C) => c == null ? void 0 : c({ ...n, ...C }), L = (C) => {
|
|
2429
|
+
N({ body: `${n.body ?? ""}${_n(C)}` });
|
|
2430
|
+
}, V = () => {
|
|
2431
|
+
!h || y.valid.length === 0 || (h(Et(D, y.valid)), $(""));
|
|
2432
|
+
}, B = (C) => {
|
|
2433
|
+
h == null || h(D.filter((O) => O !== C));
|
|
2434
|
+
};
|
|
2435
|
+
return /* @__PURE__ */ a(
|
|
2436
|
+
"div",
|
|
2437
|
+
{
|
|
2438
|
+
ref: r,
|
|
2439
|
+
className: `nice-invitation-designer nice-invitation-designer--${g} ${w ?? ""}`,
|
|
2440
|
+
style: k,
|
|
2441
|
+
children: [
|
|
2442
|
+
/* @__PURE__ */ a("section", { className: "nice-invitation-designer__editor", children: [
|
|
2443
|
+
/* @__PURE__ */ e(
|
|
2444
|
+
J,
|
|
2445
|
+
{
|
|
2446
|
+
label: "Template name",
|
|
2447
|
+
value: n.name,
|
|
2448
|
+
onChange: (C) => N({ name: C }),
|
|
2449
|
+
placeholder: "Birthday invitation",
|
|
2450
|
+
disabled: l,
|
|
2451
|
+
size: g
|
|
2452
|
+
}
|
|
2453
|
+
),
|
|
2454
|
+
o.length > 0 && !f && /* @__PURE__ */ a("div", { className: "nice-invitation-designer__tokens", children: [
|
|
2455
|
+
/* @__PURE__ */ e("span", { className: "nice-invitation-designer__tokens-label", children: "Insert:" }),
|
|
2456
|
+
o.map((C) => /* @__PURE__ */ e(
|
|
2457
|
+
F,
|
|
2458
|
+
{
|
|
2459
|
+
size: "sm",
|
|
2460
|
+
variant: "outline",
|
|
2461
|
+
disabled: l,
|
|
2462
|
+
onClick: () => L(C.key),
|
|
2463
|
+
children: C.label
|
|
2464
|
+
},
|
|
2465
|
+
C.key
|
|
2466
|
+
))
|
|
2467
|
+
] }),
|
|
2468
|
+
/* @__PURE__ */ e(
|
|
2469
|
+
zt,
|
|
2470
|
+
{
|
|
2471
|
+
value: n.body ?? "",
|
|
2472
|
+
onChange: (C) => N({ body: C }),
|
|
2473
|
+
toolbar: p,
|
|
2474
|
+
height: 280,
|
|
2475
|
+
readOnly: f || u,
|
|
2476
|
+
disabled: b
|
|
2477
|
+
}
|
|
2478
|
+
)
|
|
2479
|
+
] }),
|
|
2480
|
+
/* @__PURE__ */ a("section", { className: "nice-invitation-designer__preview", "aria-label": "Invitation preview", children: [
|
|
2481
|
+
/* @__PURE__ */ a("header", { className: "nice-invitation-designer__preview-header", children: [
|
|
2482
|
+
/* @__PURE__ */ e("h4", { children: "Preview" }),
|
|
2483
|
+
I.length > 0 && /* @__PURE__ */ a(te, { size: "xs", subtle: !0, variant: "warning", children: [
|
|
2484
|
+
I.length,
|
|
2485
|
+
" unresolved"
|
|
2486
|
+
] })
|
|
2487
|
+
] }),
|
|
2488
|
+
n.coverImageUrl && /* @__PURE__ */ e("img", { className: "nice-invitation-designer__cover", src: n.coverImageUrl, alt: "" }),
|
|
2489
|
+
/* @__PURE__ */ e(
|
|
2490
|
+
"div",
|
|
2491
|
+
{
|
|
2492
|
+
className: "nice-invitation-designer__preview-body",
|
|
2493
|
+
dangerouslySetInnerHTML: { __html: A }
|
|
2494
|
+
}
|
|
2495
|
+
),
|
|
2496
|
+
I.length > 0 && /* @__PURE__ */ a("p", { className: "nice-invitation-designer__unresolved", children: [
|
|
2497
|
+
"No preview value for: ",
|
|
2498
|
+
I.map((C) => _n(C)).join(", ")
|
|
2499
|
+
] })
|
|
2500
|
+
] }),
|
|
2501
|
+
/* @__PURE__ */ a("section", { className: "nice-invitation-designer__recipients", children: [
|
|
2502
|
+
/* @__PURE__ */ e("header", { className: "nice-invitation-designer__recipients-header", children: /* @__PURE__ */ a("h4", { children: [
|
|
2503
|
+
"Recipients ",
|
|
2504
|
+
/* @__PURE__ */ a("span", { children: [
|
|
2505
|
+
"(",
|
|
2506
|
+
m.length,
|
|
2507
|
+
")"
|
|
2508
|
+
] })
|
|
2509
|
+
] }) }),
|
|
2510
|
+
h && !f && /* @__PURE__ */ a(Ke, { children: [
|
|
2511
|
+
/* @__PURE__ */ e(
|
|
2512
|
+
Ze,
|
|
2513
|
+
{
|
|
2514
|
+
label: "Add addresses",
|
|
2515
|
+
value: _,
|
|
2516
|
+
onChange: $,
|
|
2517
|
+
placeholder: "Paste a list — commas, semicolons or new lines",
|
|
2518
|
+
rows: 3,
|
|
2519
|
+
disabled: l,
|
|
2520
|
+
size: g
|
|
2521
|
+
}
|
|
2522
|
+
),
|
|
2523
|
+
/* @__PURE__ */ a("div", { className: "nice-invitation-designer__paste-actions", children: [
|
|
2524
|
+
/* @__PURE__ */ a(
|
|
2525
|
+
F,
|
|
2526
|
+
{
|
|
2527
|
+
size: g,
|
|
2528
|
+
variant: "outline",
|
|
2529
|
+
leftIcon: /* @__PURE__ */ e(In, { size: 15 }),
|
|
2530
|
+
disabled: l || y.valid.length === 0,
|
|
2531
|
+
onClick: V,
|
|
2532
|
+
children: [
|
|
2533
|
+
"Add ",
|
|
2534
|
+
y.valid.length > 0 ? `(${y.valid.length})` : ""
|
|
2535
|
+
]
|
|
2536
|
+
}
|
|
2537
|
+
),
|
|
2538
|
+
(y.invalid.length > 0 || y.duplicates > 0) && /* @__PURE__ */ a("span", { className: "nice-invitation-designer__paste-hint", children: [
|
|
2539
|
+
y.duplicates > 0 && `${y.duplicates} duplicate(s). `,
|
|
2540
|
+
y.invalid.length > 0 && `${y.invalid.length} not recognised: ${y.invalid.slice(0, 3).join(", ")}`
|
|
2541
|
+
] })
|
|
2542
|
+
] })
|
|
2543
|
+
] }),
|
|
2544
|
+
m.length > 0 && /* @__PURE__ */ e("ul", { className: "nice-invitation-designer__recipient-list", children: m.map((C) => /* @__PURE__ */ a("li", { className: "nice-invitation-designer__recipient", children: [
|
|
2545
|
+
/* @__PURE__ */ e("span", { children: C.name ? `${C.name} <${C.email}>` : C.email }),
|
|
2546
|
+
C.status && C.status !== "pending" && /* @__PURE__ */ e(
|
|
2547
|
+
te,
|
|
2548
|
+
{
|
|
2549
|
+
size: "xs",
|
|
2550
|
+
subtle: !0,
|
|
2551
|
+
variant: C.status === "sent" ? "success" : "error",
|
|
2552
|
+
children: C.status
|
|
2553
|
+
}
|
|
2554
|
+
),
|
|
2555
|
+
h && !f && /* @__PURE__ */ e(
|
|
2556
|
+
F,
|
|
2557
|
+
{
|
|
2558
|
+
size: "sm",
|
|
2559
|
+
variant: "ghost",
|
|
2560
|
+
ariaLabel: `Remove ${C.email}`,
|
|
2561
|
+
disabled: l,
|
|
2562
|
+
onClick: () => B(C.email),
|
|
2563
|
+
children: /* @__PURE__ */ e(Te, { size: 13 })
|
|
2564
|
+
}
|
|
2565
|
+
)
|
|
2566
|
+
] }, C.email)) }),
|
|
2567
|
+
i && !f && /* @__PURE__ */ e(
|
|
2568
|
+
F,
|
|
2569
|
+
{
|
|
2570
|
+
variant: "primary",
|
|
2571
|
+
size: g,
|
|
2572
|
+
leftIcon: /* @__PURE__ */ e(pt, { size: 15 }),
|
|
2573
|
+
loading: u,
|
|
2574
|
+
ariaLabel: "Send invitations",
|
|
2575
|
+
disabled: b || u || m.length === 0,
|
|
2576
|
+
onClick: () => i({ templateId: n.id, emails: D }),
|
|
2577
|
+
children: u ? "Sending…" : `Send to ${m.length}`
|
|
2578
|
+
}
|
|
2579
|
+
)
|
|
2580
|
+
] })
|
|
2581
|
+
]
|
|
2582
|
+
}
|
|
2583
|
+
);
|
|
2584
|
+
}
|
|
2585
|
+
), ui = ({
|
|
2586
|
+
value: s,
|
|
2587
|
+
max: t,
|
|
2588
|
+
currency: r,
|
|
2589
|
+
locale: n,
|
|
2590
|
+
label: c,
|
|
2591
|
+
className: o
|
|
2592
|
+
}) => {
|
|
2593
|
+
const d = t > 0 ? t : 1, m = s >= t && t > 0, h = (i, u) => r ? `${se(i, r, n)} / ${se(u, r, n)}` : `${i} / ${u}`;
|
|
2594
|
+
return /* @__PURE__ */ e(
|
|
2595
|
+
$t,
|
|
2596
|
+
{
|
|
2597
|
+
className: o,
|
|
2598
|
+
value: Math.min(s, d),
|
|
2599
|
+
max: d,
|
|
2600
|
+
variant: m ? "success" : "primary",
|
|
2601
|
+
size: "sm",
|
|
2602
|
+
showValue: !0,
|
|
2603
|
+
formatValue: () => h(s, t),
|
|
2604
|
+
"aria-label": c
|
|
2605
|
+
}
|
|
2606
|
+
);
|
|
2607
|
+
};
|
|
2608
|
+
function mi(s, t) {
|
|
2609
|
+
if (t === "wishlist")
|
|
2610
|
+
return { value: s.isPurchased ? 1 : 0, max: 1, complete: !!s.isPurchased };
|
|
2611
|
+
const r = s.quantityNeeded ?? 1, n = s.quantityContributed ?? 0;
|
|
2612
|
+
return { value: n, max: r, complete: r > 0 && n >= r };
|
|
2613
|
+
}
|
|
2614
|
+
const Mi = ee(
|
|
2615
|
+
function(t, r) {
|
|
2616
|
+
const {
|
|
2617
|
+
items: n,
|
|
2618
|
+
kind: c = "registry",
|
|
2619
|
+
mode: o = "owner",
|
|
2620
|
+
currency: d = "PLN",
|
|
2621
|
+
locale: m,
|
|
2622
|
+
hideContributors: h = !1,
|
|
2623
|
+
currentUserId: i,
|
|
2624
|
+
currentUserName: u,
|
|
2625
|
+
onContribute: p,
|
|
2626
|
+
onClaim: b,
|
|
2627
|
+
onUnclaim: f,
|
|
2628
|
+
onItemAdd: g,
|
|
2629
|
+
onItemDelete: w,
|
|
2630
|
+
onItemClick: k,
|
|
2631
|
+
layout: _ = "grid",
|
|
2632
|
+
disabled: $ = !1,
|
|
2633
|
+
readOnly: l = !1,
|
|
2634
|
+
size: y = "md",
|
|
2635
|
+
className: v,
|
|
2636
|
+
style: A
|
|
2637
|
+
} = t, I = En({ currentUserId: i, currentUserName: u }), [D, N] = E(null), [L, V] = E(0), [B, C] = E(""), O = o === "owner", z = $ || l, P = c === "wishlist", M = X(() => P ? [...n].sort(
|
|
2638
|
+
(S, Y) => Number(S.isPurchased ?? !1) - Number(Y.isPurchased ?? !1) || (Y.priority ?? 0) - (S.priority ?? 0)
|
|
2639
|
+
) : n, [n, P]), j = () => {
|
|
2640
|
+
N(null), V(0);
|
|
2641
|
+
}, W = (S) => {
|
|
2642
|
+
!p || !I.canAct || (p(S.id, {
|
|
2643
|
+
amount: L > 0 ? L : void 0,
|
|
2644
|
+
quantity: L > 0 ? void 0 : 1,
|
|
2645
|
+
userName: I.actor.userName,
|
|
2646
|
+
userId: I.actor.userId
|
|
2647
|
+
}), j());
|
|
2648
|
+
};
|
|
2649
|
+
return n.length === 0 ? /* @__PURE__ */ e("div", { ref: r, className: `nice-gift-registry ${v ?? ""}`, style: A, children: /* @__PURE__ */ e(
|
|
2650
|
+
ye,
|
|
2651
|
+
{
|
|
2652
|
+
icon: /* @__PURE__ */ e(gt, { size: 28 }),
|
|
2653
|
+
title: P ? "Nothing on the wishlist yet" : "No gifts on the registry yet",
|
|
2654
|
+
description: O ? "Add what you would like and share the link." : "The host has not added anything yet."
|
|
2655
|
+
}
|
|
2656
|
+
) }) : /* @__PURE__ */ a(
|
|
2657
|
+
"div",
|
|
2658
|
+
{
|
|
2659
|
+
ref: r,
|
|
2660
|
+
className: `nice-gift-registry nice-gift-registry--${c} nice-gift-registry--${_} nice-gift-registry--${y} ${v ?? ""}`,
|
|
2661
|
+
style: A,
|
|
2662
|
+
children: [
|
|
2663
|
+
!O && I.isAnonymous && (p || b) && /* @__PURE__ */ e(
|
|
2664
|
+
J,
|
|
2665
|
+
{
|
|
2666
|
+
label: "Your name",
|
|
2667
|
+
value: I.name,
|
|
2668
|
+
onChange: I.setName,
|
|
2669
|
+
placeholder: "So the host knows who to thank",
|
|
2670
|
+
required: !0,
|
|
2671
|
+
disabled: z,
|
|
2672
|
+
size: y
|
|
2673
|
+
}
|
|
2674
|
+
),
|
|
2675
|
+
/* @__PURE__ */ e(Pn, { columns: _ === "list" ? 1 : void 0, minColumnWidth: 240, gap: 12, children: M.map((S) => {
|
|
2676
|
+
const { value: Y, max: q, complete: Q } = mi(S, c), R = S.price, ne = S.contributions ?? [];
|
|
2677
|
+
return /* @__PURE__ */ a(
|
|
2678
|
+
"div",
|
|
2679
|
+
{
|
|
2680
|
+
className: `nice-gift-registry__item${Q ? " nice-gift-registry__item--complete" : ""}`,
|
|
2681
|
+
children: [
|
|
2682
|
+
S.imageUrl && /* @__PURE__ */ e(
|
|
2683
|
+
"img",
|
|
2684
|
+
{
|
|
2685
|
+
src: S.imageUrl,
|
|
2686
|
+
alt: "",
|
|
2687
|
+
className: "nice-gift-registry__image",
|
|
2688
|
+
loading: "lazy"
|
|
2689
|
+
}
|
|
2690
|
+
),
|
|
2691
|
+
/* @__PURE__ */ a("div", { className: "nice-gift-registry__body", children: [
|
|
2692
|
+
/* @__PURE__ */ e(
|
|
2693
|
+
"button",
|
|
2694
|
+
{
|
|
2695
|
+
type: "button",
|
|
2696
|
+
className: "nice-gift-registry__title",
|
|
2697
|
+
onClick: () => k == null ? void 0 : k(S),
|
|
2698
|
+
disabled: !k,
|
|
2699
|
+
children: S.title
|
|
2700
|
+
}
|
|
2701
|
+
),
|
|
2702
|
+
S.description && /* @__PURE__ */ e("p", { className: "nice-gift-registry__description", children: S.description }),
|
|
2703
|
+
/* @__PURE__ */ a("div", { className: "nice-gift-registry__facts", children: [
|
|
2704
|
+
R && /* @__PURE__ */ e("span", { className: "nice-gift-registry__price", children: se(R.amount, R.currency || d, m) }),
|
|
2705
|
+
P && (S.priority ?? 0) > 0 && /* @__PURE__ */ a(te, { size: "xs", subtle: !0, variant: "warning", children: [
|
|
2706
|
+
/* @__PURE__ */ e(ft, { size: 11 }),
|
|
2707
|
+
" ",
|
|
2708
|
+
S.priority
|
|
2709
|
+
] }),
|
|
2710
|
+
Q && /* @__PURE__ */ e(te, { size: "xs", subtle: !0, variant: "success", children: P ? "bought" : "fully covered" }),
|
|
2711
|
+
S.url && /* @__PURE__ */ a(
|
|
2712
|
+
"a",
|
|
2713
|
+
{
|
|
2714
|
+
className: "nice-gift-registry__link",
|
|
2715
|
+
href: S.url,
|
|
2716
|
+
target: "_blank",
|
|
2717
|
+
rel: "noopener noreferrer",
|
|
2718
|
+
children: [
|
|
2719
|
+
/* @__PURE__ */ e(vt, { size: 13 }),
|
|
2720
|
+
" Shop"
|
|
2721
|
+
]
|
|
2722
|
+
}
|
|
2723
|
+
)
|
|
2724
|
+
] }),
|
|
2725
|
+
!P && /* @__PURE__ */ e(
|
|
2726
|
+
ui,
|
|
2727
|
+
{
|
|
2728
|
+
value: Y,
|
|
2729
|
+
max: q,
|
|
2730
|
+
label: `${S.title}: ${Y} of ${q} covered`
|
|
2731
|
+
}
|
|
2732
|
+
),
|
|
2733
|
+
!h && ne.length > 0 && /* @__PURE__ */ e("ul", { className: "nice-gift-registry__contributors", children: ne.map((H) => /* @__PURE__ */ a("li", { className: "nice-gift-registry__contributor", children: [
|
|
2734
|
+
/* @__PURE__ */ e("strong", { children: H.contributorName }),
|
|
2735
|
+
H.amount !== void 0 && ` — ${se(H.amount, (R == null ? void 0 : R.currency) || d, m)}`,
|
|
2736
|
+
H.amount === void 0 && H.quantity ? ` — ${H.quantity}×` : "",
|
|
2737
|
+
H.message && /* @__PURE__ */ a("em", { children: [
|
|
2738
|
+
" “",
|
|
2739
|
+
H.message,
|
|
2740
|
+
"”"
|
|
2741
|
+
] })
|
|
2742
|
+
] }, H.id)) }),
|
|
2743
|
+
/* @__PURE__ */ a("div", { className: "nice-gift-registry__actions", children: [
|
|
2744
|
+
!O && !Q && b && /* @__PURE__ */ e(
|
|
2745
|
+
F,
|
|
2746
|
+
{
|
|
2747
|
+
size: "sm",
|
|
2748
|
+
variant: "primary",
|
|
2749
|
+
disabled: z || !I.canAct,
|
|
2750
|
+
leftIcon: /* @__PURE__ */ e(He, { size: 14 }),
|
|
2751
|
+
onClick: () => b(S.id, { ...I.actor, quantity: 1 }),
|
|
2752
|
+
children: "I'll take this"
|
|
2753
|
+
}
|
|
2754
|
+
),
|
|
2755
|
+
!O && Q && f && /* @__PURE__ */ e(
|
|
2756
|
+
F,
|
|
2757
|
+
{
|
|
2758
|
+
size: "sm",
|
|
2759
|
+
variant: "ghost",
|
|
2760
|
+
disabled: z,
|
|
2761
|
+
onClick: () => f(S.id),
|
|
2762
|
+
children: "Release"
|
|
2763
|
+
}
|
|
2764
|
+
),
|
|
2765
|
+
!O && !Q && !P && p && /* @__PURE__ */ e(
|
|
2766
|
+
F,
|
|
2767
|
+
{
|
|
2768
|
+
size: "sm",
|
|
2769
|
+
variant: "outline",
|
|
2770
|
+
disabled: z || !I.canAct,
|
|
2771
|
+
onClick: () => N(D === S.id ? null : S.id),
|
|
2772
|
+
children: "Chip in"
|
|
2773
|
+
}
|
|
2774
|
+
),
|
|
2775
|
+
O && w && !l && /* @__PURE__ */ e(
|
|
2776
|
+
F,
|
|
2777
|
+
{
|
|
2778
|
+
size: "sm",
|
|
2779
|
+
variant: "ghost",
|
|
2780
|
+
ariaLabel: `Delete ${S.title}`,
|
|
2781
|
+
disabled: $,
|
|
2782
|
+
onClick: () => w(S.id),
|
|
2783
|
+
children: /* @__PURE__ */ e(Te, { size: 14 })
|
|
2784
|
+
}
|
|
2785
|
+
)
|
|
2786
|
+
] }),
|
|
2787
|
+
D === S.id && /* @__PURE__ */ a("div", { className: "nice-gift-registry__pledge", children: [
|
|
2788
|
+
/* @__PURE__ */ a("label", { className: "nice-gift-registry__pledge-field", children: [
|
|
2789
|
+
/* @__PURE__ */ a("span", { children: [
|
|
2790
|
+
"Amount (",
|
|
2791
|
+
(R == null ? void 0 : R.currency) || d,
|
|
2792
|
+
")"
|
|
2793
|
+
] }),
|
|
2794
|
+
/* @__PURE__ */ e(
|
|
2795
|
+
Je,
|
|
2796
|
+
{
|
|
2797
|
+
value: L,
|
|
2798
|
+
onChange: (H) => V(Math.max(0, H ?? 0)),
|
|
2799
|
+
min: 0,
|
|
2800
|
+
size: "xs",
|
|
2801
|
+
disabled: z
|
|
2802
|
+
}
|
|
2803
|
+
)
|
|
2804
|
+
] }),
|
|
2805
|
+
/* @__PURE__ */ e(
|
|
2806
|
+
F,
|
|
2807
|
+
{
|
|
2808
|
+
size: "sm",
|
|
2809
|
+
variant: "primary",
|
|
2810
|
+
disabled: z || !I.canAct,
|
|
2811
|
+
onClick: () => W(S),
|
|
2812
|
+
children: "Confirm"
|
|
2813
|
+
}
|
|
2814
|
+
),
|
|
2815
|
+
/* @__PURE__ */ e(F, { size: "sm", variant: "ghost", onClick: j, children: "Cancel" })
|
|
2816
|
+
] })
|
|
2817
|
+
] })
|
|
2818
|
+
]
|
|
2819
|
+
},
|
|
2820
|
+
S.id
|
|
2821
|
+
);
|
|
2822
|
+
}) }),
|
|
2823
|
+
O && g && !l && /* @__PURE__ */ a("div", { className: "nice-gift-registry__add", children: [
|
|
2824
|
+
/* @__PURE__ */ e(
|
|
2825
|
+
J,
|
|
2826
|
+
{
|
|
2827
|
+
label: P ? "Add a wish" : "Add a gift",
|
|
2828
|
+
value: B,
|
|
2829
|
+
onChange: C,
|
|
2830
|
+
placeholder: "What would you like?",
|
|
2831
|
+
disabled: $,
|
|
2832
|
+
size: y
|
|
2833
|
+
}
|
|
2834
|
+
),
|
|
2835
|
+
/* @__PURE__ */ e(
|
|
2836
|
+
F,
|
|
2837
|
+
{
|
|
2838
|
+
variant: "primary",
|
|
2839
|
+
size: y,
|
|
2840
|
+
leftIcon: /* @__PURE__ */ e(kn, { size: 15 }),
|
|
2841
|
+
disabled: $ || !B.trim(),
|
|
2842
|
+
onClick: () => {
|
|
2843
|
+
g({ title: B.trim(), quantityNeeded: 1 }), C("");
|
|
110
2844
|
},
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
)
|
|
2845
|
+
children: "Add"
|
|
2846
|
+
}
|
|
2847
|
+
)
|
|
2848
|
+
] })
|
|
115
2849
|
]
|
|
116
2850
|
}
|
|
117
2851
|
);
|
|
118
2852
|
}
|
|
119
2853
|
);
|
|
120
|
-
function
|
|
121
|
-
const
|
|
122
|
-
|
|
2854
|
+
function hi(s) {
|
|
2855
|
+
const t = /* @__PURE__ */ new Map();
|
|
2856
|
+
for (const r of s) {
|
|
2857
|
+
const n = (r.currency || "").toUpperCase(), c = t.get(n);
|
|
2858
|
+
c ? c.push(r) : t.set(n, [r]);
|
|
2859
|
+
}
|
|
2860
|
+
return t;
|
|
123
2861
|
}
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
},
|
|
158
|
-
[k, f]
|
|
159
|
-
), Be = $(() => {
|
|
160
|
-
g == null || g({
|
|
161
|
-
title: r,
|
|
162
|
-
description: P || void 0,
|
|
163
|
-
startDate: q || void 0,
|
|
164
|
-
endDate: F || void 0
|
|
165
|
-
});
|
|
166
|
-
}, [r, P, q, F, g]), Ee = $(() => {
|
|
167
|
-
S == null || S({
|
|
168
|
-
name: Q,
|
|
169
|
-
address: j || void 0,
|
|
170
|
-
virtualUrl: G || void 0,
|
|
171
|
-
isVirtual: M
|
|
172
|
-
});
|
|
173
|
-
}, [Q, j, G, M, S]), $e = $(() => {
|
|
174
|
-
if (!O.trim() || !d)
|
|
175
|
-
return;
|
|
176
|
-
const l = Y.split(",").map((R) => R.trim()).filter(Boolean);
|
|
177
|
-
d(O.trim(), H, l.length > 0 ? l : void 0), ne(""), ie("");
|
|
178
|
-
}, [O, H, Y, d]), Oe = $(() => {
|
|
179
|
-
!D.trim() || !s || (s({
|
|
180
|
-
label: D.trim(),
|
|
181
|
-
amount: parseFloat(K) || 0,
|
|
182
|
-
currency: J
|
|
183
|
-
}), te(""), ae(""));
|
|
184
|
-
}, [D, K, J, s]), De = I(
|
|
185
|
-
() => m.map((l) => ({
|
|
186
|
-
label: l.label,
|
|
187
|
-
amount: l.amount
|
|
188
|
-
})),
|
|
189
|
-
[m]
|
|
190
|
-
), Ve = I(() => m.reduce((l, R) => l + R.amount, 0), [m]), Me = ((de = m[0]) == null ? void 0 : de.currency) ?? "PLN", Ue = /* @__PURE__ */ i("div", { className: "nice-event-planning__form", children: [
|
|
191
|
-
/* @__PURE__ */ e(
|
|
192
|
-
T,
|
|
193
|
-
{
|
|
194
|
-
label: "Title",
|
|
195
|
-
value: r,
|
|
196
|
-
onChange: A,
|
|
197
|
-
readOnly: !h
|
|
198
|
-
}
|
|
199
|
-
),
|
|
200
|
-
/* @__PURE__ */ e(
|
|
201
|
-
pn,
|
|
202
|
-
{
|
|
203
|
-
label: "Description",
|
|
204
|
-
value: P,
|
|
205
|
-
onChange: V,
|
|
206
|
-
readOnly: !h,
|
|
207
|
-
rows: 3
|
|
208
|
-
}
|
|
209
|
-
),
|
|
210
|
-
/* @__PURE__ */ i("div", { className: "nice-event-planning__row", children: [
|
|
211
|
-
/* @__PURE__ */ i("label", { className: "nice-field", children: [
|
|
212
|
-
/* @__PURE__ */ e("span", { className: "nice-field__label", children: "Start" }),
|
|
213
|
-
/* @__PURE__ */ e(
|
|
214
|
-
"input",
|
|
215
|
-
{
|
|
216
|
-
className: "nice-input",
|
|
217
|
-
type: "datetime-local",
|
|
218
|
-
value: q,
|
|
219
|
-
onChange: (l) => ke(l.target.value),
|
|
220
|
-
readOnly: !h
|
|
221
|
-
}
|
|
222
|
-
)
|
|
223
|
-
] }),
|
|
224
|
-
/* @__PURE__ */ i("label", { className: "nice-field", children: [
|
|
225
|
-
/* @__PURE__ */ e("span", { className: "nice-field__label", children: "End" }),
|
|
226
|
-
/* @__PURE__ */ e(
|
|
227
|
-
"input",
|
|
228
|
-
{
|
|
229
|
-
className: "nice-input",
|
|
230
|
-
type: "datetime-local",
|
|
231
|
-
value: F,
|
|
232
|
-
onChange: (l) => Ce(l.target.value),
|
|
233
|
-
readOnly: !h
|
|
234
|
-
}
|
|
235
|
-
)
|
|
236
|
-
] })
|
|
237
|
-
] }),
|
|
238
|
-
h && /* @__PURE__ */ e(
|
|
239
|
-
B,
|
|
240
|
-
{
|
|
241
|
-
variant: "primary",
|
|
242
|
-
leftIcon: /* @__PURE__ */ e(L, { name: "check", size: "sm" }),
|
|
243
|
-
onClick: Be,
|
|
244
|
-
children: "Save details"
|
|
245
|
-
}
|
|
246
|
-
)
|
|
247
|
-
] }), We = /* @__PURE__ */ i("div", { className: "nice-event-planning__form", children: [
|
|
248
|
-
/* @__PURE__ */ e(
|
|
249
|
-
ve,
|
|
250
|
-
{
|
|
251
|
-
label: "Virtual event",
|
|
252
|
-
checked: M,
|
|
253
|
-
onChange: ze,
|
|
254
|
-
disabled: !h
|
|
255
|
-
}
|
|
256
|
-
),
|
|
257
|
-
/* @__PURE__ */ e(
|
|
258
|
-
T,
|
|
259
|
-
{
|
|
260
|
-
label: "Venue name",
|
|
261
|
-
value: Q,
|
|
262
|
-
onChange: Se,
|
|
263
|
-
readOnly: !h
|
|
264
|
-
}
|
|
265
|
-
),
|
|
266
|
-
M ? /* @__PURE__ */ e(
|
|
267
|
-
T,
|
|
268
|
-
{
|
|
269
|
-
label: "Virtual URL",
|
|
270
|
-
value: G,
|
|
271
|
-
onChange: we,
|
|
272
|
-
readOnly: !h
|
|
273
|
-
}
|
|
274
|
-
) : /* @__PURE__ */ e(
|
|
275
|
-
T,
|
|
276
|
-
{
|
|
277
|
-
label: "Address",
|
|
278
|
-
value: j,
|
|
279
|
-
onChange: xe,
|
|
280
|
-
readOnly: !h
|
|
281
|
-
}
|
|
282
|
-
),
|
|
283
|
-
h && /* @__PURE__ */ e(
|
|
284
|
-
B,
|
|
285
|
-
{
|
|
286
|
-
variant: "primary",
|
|
287
|
-
leftIcon: /* @__PURE__ */ e(L, { name: "check", size: "sm" }),
|
|
288
|
-
onClick: Ee,
|
|
289
|
-
children: "Save location"
|
|
290
|
-
}
|
|
291
|
-
)
|
|
292
|
-
] }), qe = /* @__PURE__ */ e("div", { className: "nice-event-planning__participants", children: p.length === 0 ? /* @__PURE__ */ e("p", { className: "nice-event-planning__empty", children: "No participants yet." }) : /* @__PURE__ */ i(Ze, { children: [
|
|
293
|
-
/* @__PURE__ */ e(ue, { max: 8, children: p.map((l) => /* @__PURE__ */ e(X, { name: l.name, src: l.avatarUrl }, l.id)) }),
|
|
294
|
-
/* @__PURE__ */ e("ul", { className: "nice-event-planning__participant-list", children: p.map((l) => /* @__PURE__ */ i("li", { className: "nice-event-planning__participant", children: [
|
|
295
|
-
/* @__PURE__ */ e(X, { name: l.name, src: l.avatarUrl, size: "sm" }),
|
|
296
|
-
/* @__PURE__ */ e("span", { className: "nice-event-planning__participant-name", children: l.name }),
|
|
297
|
-
/* @__PURE__ */ e(U, { size: "xs", subtle: !0, variant: Z(l.status), children: l.status })
|
|
298
|
-
] }, l.id)) })
|
|
299
|
-
] }) }), Fe = /* @__PURE__ */ i("div", { className: "nice-event-planning__form", children: [
|
|
300
|
-
u.length === 0 ? /* @__PURE__ */ e("p", { className: "nice-event-planning__empty", children: "No surveys yet." }) : u.map((l) => /* @__PURE__ */ i("div", { className: "nice-event-planning__survey", children: [
|
|
301
|
-
/* @__PURE__ */ e("strong", { children: l.question }),
|
|
302
|
-
" ",
|
|
303
|
-
/* @__PURE__ */ e(U, { size: "xs", outline: !0, variant: "info", children: l.type }),
|
|
304
|
-
l.options && /* @__PURE__ */ e("div", { className: "nice-event-planning__survey-options", children: l.options.map((R, Xe) => /* @__PURE__ */ e(
|
|
305
|
-
B,
|
|
306
|
-
{
|
|
307
|
-
size: "sm",
|
|
308
|
-
variant: "outline",
|
|
309
|
-
onClick: () => n == null ? void 0 : n(l.id, R),
|
|
310
|
-
children: R
|
|
311
|
-
},
|
|
312
|
-
Xe
|
|
313
|
-
)) }),
|
|
314
|
-
l.responses && /* @__PURE__ */ i("span", { className: "nice-event-planning__muted", children: [
|
|
315
|
-
l.responses.length,
|
|
316
|
-
" responses"
|
|
317
|
-
] })
|
|
318
|
-
] }, l.id)),
|
|
319
|
-
h && d && /* @__PURE__ */ i("div", { className: "nice-event-planning__form", children: [
|
|
320
|
-
/* @__PURE__ */ e(
|
|
321
|
-
T,
|
|
322
|
-
{
|
|
323
|
-
label: "New survey question",
|
|
324
|
-
value: O,
|
|
325
|
-
onChange: ne,
|
|
326
|
-
placeholder: "Question"
|
|
327
|
-
}
|
|
328
|
-
),
|
|
329
|
-
/* @__PURE__ */ e(
|
|
330
|
-
he,
|
|
331
|
-
{
|
|
332
|
-
label: "Type",
|
|
333
|
-
value: H,
|
|
334
|
-
onChange: (l) => Ae(l),
|
|
335
|
-
options: [
|
|
336
|
-
{ value: "single", label: "Single choice" },
|
|
337
|
-
{ value: "multiple", label: "Multiple choice" },
|
|
338
|
-
{ value: "text", label: "Free text" },
|
|
339
|
-
{ value: "rating", label: "Rating" }
|
|
340
|
-
]
|
|
341
|
-
}
|
|
342
|
-
),
|
|
343
|
-
/* @__PURE__ */ e(
|
|
344
|
-
T,
|
|
345
|
-
{
|
|
346
|
-
label: "Options (comma-separated)",
|
|
347
|
-
value: Y,
|
|
348
|
-
onChange: ie,
|
|
349
|
-
placeholder: "Yes, No, Maybe"
|
|
350
|
-
}
|
|
351
|
-
),
|
|
352
|
-
/* @__PURE__ */ e(
|
|
353
|
-
B,
|
|
354
|
-
{
|
|
355
|
-
variant: "primary",
|
|
356
|
-
leftIcon: /* @__PURE__ */ e(L, { name: "plus", size: "sm" }),
|
|
357
|
-
onClick: $e,
|
|
358
|
-
disabled: !O.trim(),
|
|
359
|
-
children: "Add survey"
|
|
360
|
-
}
|
|
361
|
-
)
|
|
362
|
-
] })
|
|
363
|
-
] }), Qe = /* @__PURE__ */ i("div", { className: "nice-event-planning__form", children: [
|
|
364
|
-
m.length === 0 ? /* @__PURE__ */ e("p", { className: "nice-event-planning__empty", children: "No billing items yet." }) : /* @__PURE__ */ e(
|
|
365
|
-
dn,
|
|
366
|
-
{
|
|
367
|
-
lines: [...De, { label: "Total", amount: Ve, isSummary: !0 }],
|
|
368
|
-
currency: Me
|
|
369
|
-
}
|
|
370
|
-
),
|
|
371
|
-
h && s && /* @__PURE__ */ i("div", { className: "nice-event-planning__row", children: [
|
|
372
|
-
/* @__PURE__ */ e(
|
|
373
|
-
T,
|
|
374
|
-
{
|
|
375
|
-
label: "Item",
|
|
376
|
-
value: D,
|
|
377
|
-
onChange: te,
|
|
378
|
-
placeholder: "Catering"
|
|
379
|
-
}
|
|
380
|
-
),
|
|
381
|
-
/* @__PURE__ */ e(
|
|
382
|
-
T,
|
|
383
|
-
{
|
|
384
|
-
label: "Amount",
|
|
385
|
-
value: K,
|
|
386
|
-
onChange: ae,
|
|
387
|
-
placeholder: "0.00"
|
|
388
|
-
}
|
|
389
|
-
),
|
|
390
|
-
/* @__PURE__ */ e(
|
|
391
|
-
he,
|
|
392
|
-
{
|
|
393
|
-
label: "Currency",
|
|
394
|
-
value: J,
|
|
395
|
-
onChange: (l) => Ie(l),
|
|
396
|
-
options: ["PLN", "EUR", "USD", "GBP"]
|
|
397
|
-
}
|
|
398
|
-
),
|
|
399
|
-
/* @__PURE__ */ e(
|
|
400
|
-
B,
|
|
401
|
-
{
|
|
402
|
-
variant: "primary",
|
|
403
|
-
leftIcon: /* @__PURE__ */ e(L, { name: "plus", size: "sm" }),
|
|
404
|
-
onClick: Oe,
|
|
405
|
-
disabled: !D.trim(),
|
|
406
|
-
children: "Add"
|
|
407
|
-
}
|
|
408
|
-
)
|
|
409
|
-
] })
|
|
410
|
-
] }), je = /* @__PURE__ */ i("div", { className: "nice-event-planning__form", children: [
|
|
411
|
-
/* @__PURE__ */ e(ve, { label: "Public event", checked: t.isPublic ?? !1, disabled: !h }),
|
|
412
|
-
/* @__PURE__ */ e(
|
|
413
|
-
T,
|
|
414
|
-
{
|
|
415
|
-
label: "Max participants",
|
|
416
|
-
value: t.maxParticipants != null ? String(t.maxParticipants) : "",
|
|
417
|
-
onChange: () => {
|
|
418
|
-
},
|
|
419
|
-
readOnly: !h
|
|
2862
|
+
function pi(s, t, r) {
|
|
2863
|
+
var h;
|
|
2864
|
+
const n = new Set(t.map((i) => i.id)), c = t.map((i) => i.id), o = new Map(c.map((i) => [i, 0])), d = [];
|
|
2865
|
+
let m = 0;
|
|
2866
|
+
if (c.length === 0)
|
|
2867
|
+
return {
|
|
2868
|
+
balances: o,
|
|
2869
|
+
issues: s.map((i) => ({ itemId: i.id, reason: "no-participants" })),
|
|
2870
|
+
totalMinor: 0
|
|
2871
|
+
};
|
|
2872
|
+
for (const i of s) {
|
|
2873
|
+
const u = i.paidById;
|
|
2874
|
+
if (!u) {
|
|
2875
|
+
d.push({ itemId: i.id, reason: "no-payer" });
|
|
2876
|
+
continue;
|
|
2877
|
+
}
|
|
2878
|
+
if (!n.has(u)) {
|
|
2879
|
+
d.push({ itemId: i.id, reason: "unknown-payer" });
|
|
2880
|
+
continue;
|
|
2881
|
+
}
|
|
2882
|
+
let p = (h = i.splitAmong) != null && h.length ? i.splitAmong.filter((_) => n.has(_)) : c;
|
|
2883
|
+
p.length === 0 && (p = c);
|
|
2884
|
+
const b = nn(i.amount, r);
|
|
2885
|
+
m += b;
|
|
2886
|
+
const f = p.length, g = Math.floor(b / f), w = b - g * f, k = new Map(p.map((_) => [_, g]));
|
|
2887
|
+
if (w !== 0)
|
|
2888
|
+
if (k.has(u))
|
|
2889
|
+
k.set(u, (k.get(u) ?? 0) + w);
|
|
2890
|
+
else {
|
|
2891
|
+
const _ = [...p].sort(Xe), $ = w > 0 ? 1 : -1;
|
|
2892
|
+
for (let l = 0; l < Math.abs(w); l += 1) {
|
|
2893
|
+
const y = _[l % _.length];
|
|
2894
|
+
k.set(y, (k.get(y) ?? 0) + $);
|
|
420
2895
|
}
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
] });
|
|
502
|
-
|
|
503
|
-
|
|
2896
|
+
}
|
|
2897
|
+
o.set(u, (o.get(u) ?? 0) + b);
|
|
2898
|
+
for (const [_, $] of k)
|
|
2899
|
+
o.set(_, (o.get(_) ?? 0) - $);
|
|
2900
|
+
}
|
|
2901
|
+
return { balances: o, issues: d, totalMinor: m };
|
|
2902
|
+
}
|
|
2903
|
+
function gi(s, t, r) {
|
|
2904
|
+
for (const n of t) {
|
|
2905
|
+
if ((n.currency || "").toUpperCase() !== r || !s.has(n.fromId) || !s.has(n.toId))
|
|
2906
|
+
continue;
|
|
2907
|
+
const c = nn(n.amount, r);
|
|
2908
|
+
s.set(n.fromId, (s.get(n.fromId) ?? 0) + c), s.set(n.toId, (s.get(n.toId) ?? 0) - c);
|
|
2909
|
+
}
|
|
2910
|
+
}
|
|
2911
|
+
function fi(s, t, r) {
|
|
2912
|
+
const n = new Map(t.map((i) => [i.id, i.name])), c = [...s.entries()].filter(([, i]) => i > 0).map(([i, u]) => ({ id: i, v: u })).sort((i, u) => u.v - i.v || Xe(i.id, u.id)), o = [...s.entries()].filter(([, i]) => i < 0).map(([i, u]) => ({ id: i, v: u })).sort((i, u) => i.v - u.v || Xe(i.id, u.id)), d = [];
|
|
2913
|
+
let m = 0, h = 0;
|
|
2914
|
+
for (; m < o.length && h < c.length; ) {
|
|
2915
|
+
const i = Math.min(-o[m].v, c[h].v);
|
|
2916
|
+
i > 0 && d.push({
|
|
2917
|
+
fromId: o[m].id,
|
|
2918
|
+
fromName: n.get(o[m].id) ?? o[m].id,
|
|
2919
|
+
toId: c[h].id,
|
|
2920
|
+
toName: n.get(c[h].id) ?? c[h].id,
|
|
2921
|
+
amount: Ye(i, r),
|
|
2922
|
+
currency: r
|
|
2923
|
+
}), o[m].v += i, c[h].v -= i, o[m].v === 0 && (m += 1), c[h].v === 0 && (h += 1);
|
|
2924
|
+
}
|
|
2925
|
+
return d;
|
|
2926
|
+
}
|
|
2927
|
+
function vi(s, t, r = []) {
|
|
2928
|
+
const n = [], c = [], o = [...hi(s).entries()].sort(([d], [m]) => Xe(d, m));
|
|
2929
|
+
for (const [d, m] of o) {
|
|
2930
|
+
const h = pi(m, t, d);
|
|
2931
|
+
c.push(...h.issues), gi(h.balances, r, d), n.push({
|
|
2932
|
+
currency: d,
|
|
2933
|
+
total: Ye(h.totalMinor, d),
|
|
2934
|
+
balances: t.map((i) => ({
|
|
2935
|
+
participantId: i.id,
|
|
2936
|
+
participantName: i.name,
|
|
2937
|
+
amount: Ye(h.balances.get(i.id) ?? 0, d),
|
|
2938
|
+
currency: d
|
|
2939
|
+
})),
|
|
2940
|
+
transfers: fi(h.balances, t, d)
|
|
2941
|
+
});
|
|
2942
|
+
}
|
|
2943
|
+
return { groups: n, issues: c };
|
|
2944
|
+
}
|
|
2945
|
+
function Xe(s, t) {
|
|
2946
|
+
return s < t ? -1 : s > t ? 1 : 0;
|
|
2947
|
+
}
|
|
2948
|
+
const Di = ee(
|
|
2949
|
+
function(t, r) {
|
|
2950
|
+
const {
|
|
2951
|
+
items: n,
|
|
2952
|
+
participants: c,
|
|
2953
|
+
settlements: o = [],
|
|
2954
|
+
view: d,
|
|
2955
|
+
defaultView: m = "expenses",
|
|
2956
|
+
onViewChange: h,
|
|
2957
|
+
onSettle: i,
|
|
2958
|
+
onItemDelete: u,
|
|
2959
|
+
onItemClick: p,
|
|
2960
|
+
onValidationChange: b,
|
|
2961
|
+
sortBy: f = "date",
|
|
2962
|
+
locale: g,
|
|
2963
|
+
disabled: w = !1,
|
|
2964
|
+
readOnly: k = !1,
|
|
2965
|
+
size: _ = "md",
|
|
2966
|
+
className: $,
|
|
2967
|
+
style: l
|
|
2968
|
+
} = t, [y, v] = E(m), A = d ?? y, I = w || k, D = X(
|
|
2969
|
+
() => c.map((z) => ({ id: z.id, name: z.name })),
|
|
2970
|
+
[c]
|
|
2971
|
+
), N = X(() => vi(n, D, o), [n, D, o]), L = X(() => f === "none" ? n : n.map((z, P) => ({ item: z, index: P })).sort((z, P) => {
|
|
2972
|
+
if (f === "amount")
|
|
2973
|
+
return P.item.amount - z.item.amount || z.index - P.index;
|
|
2974
|
+
const M = z.item.incurredAt, j = P.item.incurredAt;
|
|
2975
|
+
return M && j ? M.localeCompare(j) || z.index - P.index : M ? -1 : j ? 1 : z.index - P.index;
|
|
2976
|
+
}).map((z) => z.item), [n, f]), V = N.issues.map((z) => `${z.itemId}:${z.reason}`).join("|");
|
|
2977
|
+
Ue.useEffect(() => {
|
|
2978
|
+
b == null || b(N.issues);
|
|
2979
|
+
}, [V]);
|
|
2980
|
+
const B = X(
|
|
2981
|
+
() => new Map(c.map((z) => [z.id, z.avatarUrl])),
|
|
2982
|
+
[c]
|
|
2983
|
+
), C = X(
|
|
2984
|
+
() => new Map(N.issues.map((z) => [z.itemId, z.reason])),
|
|
2985
|
+
[N.issues]
|
|
2986
|
+
), O = (z) => {
|
|
2987
|
+
d === void 0 && v(z), h == null || h(z);
|
|
2988
|
+
};
|
|
2989
|
+
return n.length === 0 ? /* @__PURE__ */ e("div", { ref: r, className: `nice-expense-split ${$ ?? ""}`, style: l, children: /* @__PURE__ */ e(
|
|
2990
|
+
ye,
|
|
504
2991
|
{
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
children: /* @__PURE__ */ i("div", { className: "nice-event-planning__micro", children: [
|
|
509
|
-
/* @__PURE__ */ e(L, { name: "calendar", size: "md" }),
|
|
510
|
-
/* @__PURE__ */ i("div", { className: "nice-event-planning__micro-body", children: [
|
|
511
|
-
/* @__PURE__ */ e("span", { className: "nice-event-planning__title", children: t.title }),
|
|
512
|
-
/* @__PURE__ */ i("span", { className: "nice-event-planning__muted", children: [
|
|
513
|
-
t.startDate ? new Date(t.startDate).toLocaleString() : "No date",
|
|
514
|
-
(me = t.location) != null && me.name ? ` · ${t.location.name}` : ""
|
|
515
|
-
] })
|
|
516
|
-
] }),
|
|
517
|
-
/* @__PURE__ */ e(U, { size: "sm", variant: Z(t.status), children: t.status }),
|
|
518
|
-
p.length > 0 && /* @__PURE__ */ e(ue, { max: 4, size: "sm", children: p.map((l) => /* @__PURE__ */ e(X, { name: l.name, src: l.avatarUrl, size: "sm" }, l.id)) })
|
|
519
|
-
] })
|
|
2992
|
+
icon: /* @__PURE__ */ e(yt, { size: 28 }),
|
|
2993
|
+
title: "No expenses yet",
|
|
2994
|
+
description: "Add what people paid for and this will work out who owes whom."
|
|
520
2995
|
}
|
|
521
|
-
) : /* @__PURE__ */
|
|
2996
|
+
) }) : /* @__PURE__ */ a(
|
|
522
2997
|
"div",
|
|
523
2998
|
{
|
|
524
|
-
ref:
|
|
525
|
-
className: `nice-
|
|
526
|
-
style:
|
|
2999
|
+
ref: r,
|
|
3000
|
+
className: `nice-expense-split nice-expense-split--${_} ${$ ?? ""}`,
|
|
3001
|
+
style: l,
|
|
527
3002
|
children: [
|
|
528
|
-
|
|
529
|
-
|
|
3003
|
+
/* @__PURE__ */ e(
|
|
3004
|
+
Tn,
|
|
3005
|
+
{
|
|
3006
|
+
size: _,
|
|
3007
|
+
value: A,
|
|
3008
|
+
onChange: (z) => O(z),
|
|
3009
|
+
options: [
|
|
3010
|
+
{ value: "expenses", label: "Expenses" },
|
|
3011
|
+
{ value: "balances", label: "Balances" },
|
|
3012
|
+
{ value: "settlement", label: "Settle up" }
|
|
3013
|
+
]
|
|
3014
|
+
}
|
|
3015
|
+
),
|
|
3016
|
+
A === "expenses" && /* @__PURE__ */ e("ul", { className: "nice-expense-split__items", children: L.map((z) => {
|
|
3017
|
+
const P = C.get(z.id);
|
|
3018
|
+
return /* @__PURE__ */ a(
|
|
3019
|
+
"li",
|
|
3020
|
+
{
|
|
3021
|
+
className: `nice-expense-split__item${P ? " nice-expense-split__item--excluded" : ""}`,
|
|
3022
|
+
children: [
|
|
3023
|
+
/* @__PURE__ */ a(
|
|
3024
|
+
"button",
|
|
3025
|
+
{
|
|
3026
|
+
type: "button",
|
|
3027
|
+
className: "nice-expense-split__item-main",
|
|
3028
|
+
onClick: () => p == null ? void 0 : p(z),
|
|
3029
|
+
disabled: !p,
|
|
3030
|
+
children: [
|
|
3031
|
+
/* @__PURE__ */ e("span", { className: "nice-expense-split__item-label", children: z.label }),
|
|
3032
|
+
/* @__PURE__ */ a("span", { className: "nice-expense-split__item-payer", children: [
|
|
3033
|
+
z.paidByName ?? z.paidById ?? "nobody",
|
|
3034
|
+
" paid"
|
|
3035
|
+
] })
|
|
3036
|
+
]
|
|
3037
|
+
}
|
|
3038
|
+
),
|
|
3039
|
+
/* @__PURE__ */ e("span", { className: "nice-expense-split__item-amount", children: se(z.amount, z.currency, g) }),
|
|
3040
|
+
z.isPaid && /* @__PURE__ */ e(te, { size: "xs", subtle: !0, variant: "success", children: "paid" }),
|
|
3041
|
+
P && /* @__PURE__ */ e(te, { size: "xs", subtle: !0, variant: "warning", children: P === "no-payer" ? "no payer" : "unknown payer" }),
|
|
3042
|
+
u && !k && /* @__PURE__ */ e(
|
|
3043
|
+
F,
|
|
3044
|
+
{
|
|
3045
|
+
size: "sm",
|
|
3046
|
+
variant: "ghost",
|
|
3047
|
+
ariaLabel: `Delete ${z.label}`,
|
|
3048
|
+
disabled: w,
|
|
3049
|
+
onClick: () => u(z.id),
|
|
3050
|
+
children: /* @__PURE__ */ e(Te, { size: 14 })
|
|
3051
|
+
}
|
|
3052
|
+
)
|
|
3053
|
+
]
|
|
3054
|
+
},
|
|
3055
|
+
z.id
|
|
3056
|
+
);
|
|
3057
|
+
}) }),
|
|
3058
|
+
A === "balances" && N.groups.map((z) => /* @__PURE__ */ a("section", { className: "nice-expense-split__group", children: [
|
|
3059
|
+
/* @__PURE__ */ a("h4", { className: "nice-expense-split__group-title", children: [
|
|
3060
|
+
z.currency,
|
|
3061
|
+
/* @__PURE__ */ a("span", { className: "nice-expense-split__group-total", children: [
|
|
3062
|
+
se(z.total, z.currency, g),
|
|
3063
|
+
" total"
|
|
3064
|
+
] })
|
|
3065
|
+
] }),
|
|
3066
|
+
/* @__PURE__ */ e("ul", { className: "nice-participant-list__rows", children: z.balances.map((P) => /* @__PURE__ */ e(
|
|
3067
|
+
je,
|
|
3068
|
+
{
|
|
3069
|
+
participant: {
|
|
3070
|
+
id: P.participantId,
|
|
3071
|
+
name: P.participantName,
|
|
3072
|
+
avatarUrl: B.get(P.participantId)
|
|
3073
|
+
},
|
|
3074
|
+
showRole: !1,
|
|
3075
|
+
showStatus: !1,
|
|
3076
|
+
size: _,
|
|
3077
|
+
children: /* @__PURE__ */ a(
|
|
3078
|
+
"span",
|
|
3079
|
+
{
|
|
3080
|
+
className: `nice-expense-split__balance nice-expense-split__balance--${P.amount > 0 ? "owed" : P.amount < 0 ? "owes" : "settled"}`,
|
|
3081
|
+
children: [
|
|
3082
|
+
P.amount === 0 ? "settled up" : se(Math.abs(P.amount), P.currency, g),
|
|
3083
|
+
P.amount > 0 && /* @__PURE__ */ e("em", { children: " is owed" }),
|
|
3084
|
+
P.amount < 0 && /* @__PURE__ */ e("em", { children: " owes" })
|
|
3085
|
+
]
|
|
3086
|
+
}
|
|
3087
|
+
)
|
|
3088
|
+
},
|
|
3089
|
+
P.participantId
|
|
3090
|
+
)) })
|
|
3091
|
+
] }, z.currency)),
|
|
3092
|
+
A === "settlement" && (N.groups.every((z) => z.transfers.length === 0) ? /* @__PURE__ */ e(
|
|
3093
|
+
ye,
|
|
3094
|
+
{
|
|
3095
|
+
icon: /* @__PURE__ */ e(_t, { size: 28 }),
|
|
3096
|
+
title: "All settled up",
|
|
3097
|
+
description: "Nobody owes anybody anything."
|
|
3098
|
+
}
|
|
3099
|
+
) : N.groups.filter((z) => z.transfers.length > 0).map((z) => /* @__PURE__ */ a("section", { className: "nice-expense-split__group", children: [
|
|
3100
|
+
/* @__PURE__ */ a("h4", { className: "nice-expense-split__group-title", children: [
|
|
3101
|
+
z.currency,
|
|
3102
|
+
/* @__PURE__ */ a("span", { className: "nice-expense-split__group-total", children: [
|
|
3103
|
+
z.transfers.length,
|
|
3104
|
+
" transfer",
|
|
3105
|
+
z.transfers.length === 1 ? "" : "s"
|
|
3106
|
+
] })
|
|
3107
|
+
] }),
|
|
3108
|
+
/* @__PURE__ */ e("ul", { className: "nice-expense-split__transfers", children: z.transfers.map((P) => /* @__PURE__ */ a(
|
|
3109
|
+
"li",
|
|
3110
|
+
{
|
|
3111
|
+
className: "nice-expense-split__transfer",
|
|
3112
|
+
children: [
|
|
3113
|
+
/* @__PURE__ */ e("span", { className: "nice-expense-split__transfer-from", children: P.fromName }),
|
|
3114
|
+
/* @__PURE__ */ e(Nt, { size: 15 }),
|
|
3115
|
+
/* @__PURE__ */ e("span", { className: "nice-expense-split__transfer-to", children: P.toName }),
|
|
3116
|
+
/* @__PURE__ */ e("span", { className: "nice-expense-split__transfer-amount", children: se(P.amount, P.currency, g) }),
|
|
3117
|
+
i && !k && /* @__PURE__ */ e(
|
|
3118
|
+
F,
|
|
3119
|
+
{
|
|
3120
|
+
size: "sm",
|
|
3121
|
+
variant: "outline",
|
|
3122
|
+
disabled: I,
|
|
3123
|
+
onClick: () => i(P),
|
|
3124
|
+
children: "Mark paid"
|
|
3125
|
+
}
|
|
3126
|
+
)
|
|
3127
|
+
]
|
|
3128
|
+
},
|
|
3129
|
+
`${P.fromId}-${P.toId}-${P.amount}`
|
|
3130
|
+
)) })
|
|
3131
|
+
] }, z.currency)))
|
|
530
3132
|
]
|
|
531
3133
|
}
|
|
532
3134
|
);
|
|
533
3135
|
}
|
|
534
|
-
),
|
|
3136
|
+
), yi = {
|
|
535
3137
|
upcoming: "⏳",
|
|
536
3138
|
active: "▶️",
|
|
537
3139
|
voting: "🗳️",
|
|
538
3140
|
scored: "📊",
|
|
539
3141
|
completed: "✅",
|
|
540
3142
|
skipped: "⏭️"
|
|
541
|
-
},
|
|
3143
|
+
}, _i = {
|
|
542
3144
|
upcoming: "#9ca3af",
|
|
543
3145
|
active: "#22c55e",
|
|
544
3146
|
voting: "#eab308",
|
|
545
3147
|
scored: "#3b82f6",
|
|
546
3148
|
completed: "#6b7280",
|
|
547
3149
|
skipped: "#d1d5db"
|
|
548
|
-
},
|
|
549
|
-
function(
|
|
3150
|
+
}, Ei = ee(
|
|
3151
|
+
function(t, r) {
|
|
550
3152
|
const {
|
|
551
|
-
rounds:
|
|
552
|
-
activeRoundId:
|
|
553
|
-
onSelect:
|
|
554
|
-
onStart:
|
|
555
|
-
onEnd:
|
|
556
|
-
onCreate:
|
|
557
|
-
editable:
|
|
558
|
-
className:
|
|
559
|
-
style:
|
|
560
|
-
} =
|
|
561
|
-
return /* @__PURE__ */
|
|
562
|
-
/* @__PURE__ */
|
|
563
|
-
/* @__PURE__ */
|
|
3153
|
+
rounds: n,
|
|
3154
|
+
activeRoundId: c,
|
|
3155
|
+
onSelect: o,
|
|
3156
|
+
onStart: d,
|
|
3157
|
+
onEnd: m,
|
|
3158
|
+
onCreate: h,
|
|
3159
|
+
editable: i = !1,
|
|
3160
|
+
className: u,
|
|
3161
|
+
style: p
|
|
3162
|
+
} = t, b = [...n].sort((f, g) => f.order - g.order);
|
|
3163
|
+
return /* @__PURE__ */ a("div", { ref: r, className: `nice-round-list ${u ?? ""}`, style: p, children: [
|
|
3164
|
+
/* @__PURE__ */ a("div", { className: "nice-round-list__header", children: [
|
|
3165
|
+
/* @__PURE__ */ a("h3", { children: [
|
|
564
3166
|
"Rounds (",
|
|
565
|
-
|
|
3167
|
+
n.length,
|
|
566
3168
|
")"
|
|
567
3169
|
] }),
|
|
568
|
-
|
|
3170
|
+
i && h && /* @__PURE__ */ e("button", { onClick: h, children: "+ Add Round" })
|
|
569
3171
|
] }),
|
|
570
|
-
|
|
571
|
-
const
|
|
572
|
-
return /* @__PURE__ */
|
|
3172
|
+
b.length === 0 ? /* @__PURE__ */ e("p", { className: "nice-round-list__empty", children: "No rounds yet." }) : /* @__PURE__ */ e("div", { className: "nice-round-list__items", children: b.map((f) => {
|
|
3173
|
+
const g = f.id === c;
|
|
3174
|
+
return /* @__PURE__ */ a(
|
|
573
3175
|
"div",
|
|
574
3176
|
{
|
|
575
|
-
className: `nice-round-list__item ${
|
|
576
|
-
onClick: () =>
|
|
577
|
-
role:
|
|
578
|
-
tabIndex:
|
|
3177
|
+
className: `nice-round-list__item ${g ? "nice-round-list__item--active" : ""}`,
|
|
3178
|
+
onClick: () => o == null ? void 0 : o(f),
|
|
3179
|
+
role: o ? "button" : void 0,
|
|
3180
|
+
tabIndex: o ? 0 : void 0,
|
|
579
3181
|
children: [
|
|
580
|
-
/* @__PURE__ */
|
|
3182
|
+
/* @__PURE__ */ a("span", { className: "nice-round-list__order", children: [
|
|
581
3183
|
"#",
|
|
582
|
-
|
|
3184
|
+
f.order
|
|
583
3185
|
] }),
|
|
584
|
-
/* @__PURE__ */ e("span", { className: "nice-round-list__icon", children:
|
|
585
|
-
/* @__PURE__ */
|
|
586
|
-
/* @__PURE__ */ e("strong", { className: "nice-round-list__name", children:
|
|
587
|
-
|
|
588
|
-
|
|
3186
|
+
/* @__PURE__ */ e("span", { className: "nice-round-list__icon", children: yi[f.status] }),
|
|
3187
|
+
/* @__PURE__ */ a("div", { className: "nice-round-list__info", children: [
|
|
3188
|
+
/* @__PURE__ */ e("strong", { className: "nice-round-list__name", children: f.name }),
|
|
3189
|
+
f.description && /* @__PURE__ */ e("small", { children: f.description }),
|
|
3190
|
+
f.type && /* @__PURE__ */ e("span", { className: "nice-round-list__type", children: f.type })
|
|
589
3191
|
] }),
|
|
590
3192
|
/* @__PURE__ */ e(
|
|
591
3193
|
"span",
|
|
592
3194
|
{
|
|
593
3195
|
className: "nice-round-list__status",
|
|
594
|
-
style: { color:
|
|
595
|
-
children:
|
|
3196
|
+
style: { color: _i[f.status] },
|
|
3197
|
+
children: f.status
|
|
596
3198
|
}
|
|
597
3199
|
),
|
|
598
|
-
|
|
599
|
-
|
|
3200
|
+
f.durationMinutes && /* @__PURE__ */ a("span", { className: "nice-round-list__duration", children: [
|
|
3201
|
+
f.durationMinutes,
|
|
600
3202
|
"m"
|
|
601
3203
|
] }),
|
|
602
|
-
|
|
3204
|
+
f.winnerIds && f.winnerIds.length > 0 && /* @__PURE__ */ a("span", { className: "nice-round-list__winners", children: [
|
|
603
3205
|
"🏆 ",
|
|
604
|
-
|
|
3206
|
+
f.winnerIds.length
|
|
605
3207
|
] }),
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
(
|
|
3208
|
+
i && /* @__PURE__ */ a("div", { className: "nice-round-list__actions", onClick: (w) => w.stopPropagation(), children: [
|
|
3209
|
+
f.status === "upcoming" && d && /* @__PURE__ */ e("button", { onClick: () => d(f.id), children: "Start" }),
|
|
3210
|
+
(f.status === "active" || f.status === "voting") && m && /* @__PURE__ */ e("button", { onClick: () => m(f.id), children: "End" })
|
|
609
3211
|
] })
|
|
610
3212
|
]
|
|
611
3213
|
},
|
|
612
|
-
|
|
3214
|
+
f.id
|
|
613
3215
|
);
|
|
614
3216
|
}) })
|
|
615
3217
|
] });
|
|
616
3218
|
}
|
|
617
|
-
),
|
|
618
|
-
function(
|
|
3219
|
+
), Li = ee(
|
|
3220
|
+
function(t, r) {
|
|
619
3221
|
const {
|
|
620
|
-
round:
|
|
621
|
-
timerRunning:
|
|
622
|
-
remainingSeconds:
|
|
623
|
-
onSubmitScore:
|
|
624
|
-
onStart:
|
|
625
|
-
onEnd:
|
|
626
|
-
onSkip:
|
|
627
|
-
editable:
|
|
628
|
-
footerActions:
|
|
629
|
-
className:
|
|
630
|
-
style:
|
|
631
|
-
} =
|
|
632
|
-
(
|
|
633
|
-
const
|
|
634
|
-
isNaN(
|
|
3222
|
+
round: n,
|
|
3223
|
+
timerRunning: c = !1,
|
|
3224
|
+
remainingSeconds: o,
|
|
3225
|
+
onSubmitScore: d,
|
|
3226
|
+
onStart: m,
|
|
3227
|
+
onEnd: h,
|
|
3228
|
+
onSkip: i,
|
|
3229
|
+
editable: u = !1,
|
|
3230
|
+
footerActions: p,
|
|
3231
|
+
className: b,
|
|
3232
|
+
style: f
|
|
3233
|
+
} = t, [g, w] = E({}), k = G(
|
|
3234
|
+
(l) => {
|
|
3235
|
+
const y = parseFloat(g[l] ?? "");
|
|
3236
|
+
isNaN(y) || !d || (d(l, y), w((v) => ({ ...v, [l]: "" })));
|
|
635
3237
|
},
|
|
636
|
-
[
|
|
637
|
-
),
|
|
638
|
-
const
|
|
639
|
-
return `${
|
|
640
|
-
},
|
|
641
|
-
return /* @__PURE__ */
|
|
3238
|
+
[g, d]
|
|
3239
|
+
), _ = (l) => {
|
|
3240
|
+
const y = Math.floor(l / 60), v = l % 60;
|
|
3241
|
+
return `${y}:${v.toString().padStart(2, "0")}`;
|
|
3242
|
+
}, $ = n.scores ? [...n.scores].sort((l, y) => y.score - l.score) : [];
|
|
3243
|
+
return /* @__PURE__ */ a(
|
|
642
3244
|
"div",
|
|
643
3245
|
{
|
|
644
|
-
ref:
|
|
645
|
-
className: `nice-round-card nice-round-card--${
|
|
646
|
-
style:
|
|
3246
|
+
ref: r,
|
|
3247
|
+
className: `nice-round-card nice-round-card--${n.status} ${b ?? ""}`,
|
|
3248
|
+
style: f,
|
|
647
3249
|
children: [
|
|
648
|
-
/* @__PURE__ */
|
|
649
|
-
/* @__PURE__ */
|
|
3250
|
+
/* @__PURE__ */ a("div", { className: "nice-round-card__header", children: [
|
|
3251
|
+
/* @__PURE__ */ a("span", { className: "nice-round-card__order", children: [
|
|
650
3252
|
"Round #",
|
|
651
|
-
|
|
3253
|
+
n.order
|
|
652
3254
|
] }),
|
|
653
|
-
/* @__PURE__ */ e("h3", { className: "nice-round-card__name", children:
|
|
654
|
-
/* @__PURE__ */ e("span", { className: "nice-round-card__status", children:
|
|
3255
|
+
/* @__PURE__ */ e("h3", { className: "nice-round-card__name", children: n.name }),
|
|
3256
|
+
/* @__PURE__ */ e("span", { className: "nice-round-card__status", children: n.status })
|
|
655
3257
|
] }),
|
|
656
|
-
|
|
657
|
-
(
|
|
3258
|
+
n.description && /* @__PURE__ */ e("p", { className: "nice-round-card__description", children: n.description }),
|
|
3259
|
+
(c || o != null) && /* @__PURE__ */ a(
|
|
658
3260
|
"div",
|
|
659
3261
|
{
|
|
660
|
-
className: `nice-round-card__timer ${
|
|
3262
|
+
className: `nice-round-card__timer ${c ? "nice-round-card__timer--running" : ""}`,
|
|
661
3263
|
children: [
|
|
662
3264
|
"⏱️ ",
|
|
663
|
-
|
|
3265
|
+
o != null ? _(o) : "—"
|
|
664
3266
|
]
|
|
665
3267
|
}
|
|
666
3268
|
),
|
|
667
|
-
|
|
3269
|
+
$.length > 0 && /* @__PURE__ */ a("div", { className: "nice-round-card__scoreboard", children: [
|
|
668
3270
|
/* @__PURE__ */ e("h4", { children: "Scoreboard" }),
|
|
669
|
-
/* @__PURE__ */
|
|
670
|
-
/* @__PURE__ */ e("thead", { children: /* @__PURE__ */
|
|
3271
|
+
/* @__PURE__ */ a("table", { className: "nice-round-card__scores-table", children: [
|
|
3272
|
+
/* @__PURE__ */ e("thead", { children: /* @__PURE__ */ a("tr", { children: [
|
|
671
3273
|
/* @__PURE__ */ e("th", { children: "Rank" }),
|
|
672
3274
|
/* @__PURE__ */ e("th", { children: "Participant" }),
|
|
673
3275
|
/* @__PURE__ */ e("th", { children: "Score" })
|
|
674
3276
|
] }) }),
|
|
675
|
-
/* @__PURE__ */ e("tbody", { children:
|
|
3277
|
+
/* @__PURE__ */ e("tbody", { children: $.map((l, y) => /* @__PURE__ */ a(
|
|
676
3278
|
"tr",
|
|
677
3279
|
{
|
|
678
|
-
className:
|
|
3280
|
+
className: y < 3 ? `nice-round-card__top-${y + 1}` : "",
|
|
679
3281
|
children: [
|
|
680
|
-
/* @__PURE__ */
|
|
681
|
-
|
|
682
|
-
|
|
3282
|
+
/* @__PURE__ */ a("td", { children: [
|
|
3283
|
+
l.rank ?? y + 1,
|
|
3284
|
+
y === 0 ? " 🥇" : y === 1 ? " 🥈" : y === 2 ? " 🥉" : ""
|
|
683
3285
|
] }),
|
|
684
|
-
/* @__PURE__ */ e("td", { children:
|
|
685
|
-
/* @__PURE__ */ e("td", { children:
|
|
3286
|
+
/* @__PURE__ */ e("td", { children: l.participantName }),
|
|
3287
|
+
/* @__PURE__ */ e("td", { children: l.score })
|
|
686
3288
|
]
|
|
687
3289
|
},
|
|
688
|
-
|
|
3290
|
+
l.participantId
|
|
689
3291
|
)) })
|
|
690
3292
|
] })
|
|
691
3293
|
] }),
|
|
692
|
-
|
|
3294
|
+
d && (n.status === "active" || n.status === "voting") && $.length > 0 && /* @__PURE__ */ a("div", { className: "nice-round-card__score-input", children: [
|
|
693
3295
|
/* @__PURE__ */ e("h4", { children: "Submit Scores" }),
|
|
694
|
-
|
|
695
|
-
/* @__PURE__ */ e("span", { children:
|
|
3296
|
+
$.map((l) => /* @__PURE__ */ a("div", { className: "nice-round-card__score-row", children: [
|
|
3297
|
+
/* @__PURE__ */ e("span", { children: l.participantName }),
|
|
696
3298
|
/* @__PURE__ */ e(
|
|
697
3299
|
"input",
|
|
698
3300
|
{
|
|
699
3301
|
type: "number",
|
|
700
|
-
value:
|
|
701
|
-
onChange: (
|
|
3302
|
+
value: g[l.participantId] ?? "",
|
|
3303
|
+
onChange: (y) => w((v) => ({ ...v, [l.participantId]: y.target.value })),
|
|
702
3304
|
min: 0,
|
|
703
3305
|
step: 1,
|
|
704
3306
|
placeholder: "Score"
|
|
705
3307
|
}
|
|
706
3308
|
),
|
|
707
|
-
/* @__PURE__ */ e("button", { onClick: () =>
|
|
708
|
-
] },
|
|
3309
|
+
/* @__PURE__ */ e("button", { onClick: () => k(l.participantId), children: "Submit" })
|
|
3310
|
+
] }, l.participantId))
|
|
709
3311
|
] }),
|
|
710
|
-
/* @__PURE__ */
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
(
|
|
714
|
-
|
|
3312
|
+
/* @__PURE__ */ a("div", { className: "nice-round-card__footer", children: [
|
|
3313
|
+
u && /* @__PURE__ */ a("div", { className: "nice-round-card__actions", children: [
|
|
3314
|
+
n.status === "upcoming" && m && /* @__PURE__ */ e("button", { onClick: m, children: "▶ Start Round" }),
|
|
3315
|
+
(n.status === "active" || n.status === "voting") && h && /* @__PURE__ */ e("button", { onClick: h, children: "⏹ End Round" }),
|
|
3316
|
+
n.status === "upcoming" && i && /* @__PURE__ */ e("button", { onClick: i, children: "⏭ Skip" })
|
|
715
3317
|
] }),
|
|
716
|
-
|
|
3318
|
+
p
|
|
717
3319
|
] }),
|
|
718
|
-
|
|
3320
|
+
n.winnerIds && n.winnerIds.length > 0 && /* @__PURE__ */ a("div", { className: "nice-round-card__winners", children: [
|
|
719
3321
|
"🏆 Winners: ",
|
|
720
|
-
|
|
3322
|
+
n.winnerIds.length
|
|
721
3323
|
] })
|
|
722
3324
|
]
|
|
723
3325
|
}
|
|
724
3326
|
);
|
|
725
3327
|
}
|
|
726
|
-
),
|
|
727
|
-
function(
|
|
3328
|
+
), Bi = ee(
|
|
3329
|
+
function(t, r) {
|
|
728
3330
|
const {
|
|
729
|
-
songs:
|
|
730
|
-
onAdd:
|
|
731
|
-
onRemove:
|
|
732
|
-
onVote:
|
|
733
|
-
onSearch:
|
|
734
|
-
showQueue:
|
|
735
|
-
readOnly:
|
|
736
|
-
className:
|
|
737
|
-
style:
|
|
738
|
-
} =
|
|
739
|
-
if (!
|
|
740
|
-
return
|
|
741
|
-
const
|
|
742
|
-
return
|
|
743
|
-
(
|
|
3331
|
+
songs: n,
|
|
3332
|
+
onAdd: c,
|
|
3333
|
+
onRemove: o,
|
|
3334
|
+
onVote: d,
|
|
3335
|
+
onSearch: m,
|
|
3336
|
+
showQueue: h = !0,
|
|
3337
|
+
readOnly: i = !1,
|
|
3338
|
+
className: u,
|
|
3339
|
+
style: p
|
|
3340
|
+
} = t, [b, f] = E(""), g = X(() => {
|
|
3341
|
+
if (!b.trim())
|
|
3342
|
+
return n;
|
|
3343
|
+
const l = b.toLowerCase();
|
|
3344
|
+
return n.filter(
|
|
3345
|
+
(y) => y.title.toLowerCase().includes(l) || y.artist.toLowerCase().includes(l)
|
|
744
3346
|
);
|
|
745
|
-
}, [
|
|
746
|
-
|
|
747
|
-
},
|
|
748
|
-
if (!
|
|
3347
|
+
}, [n, b]), w = X(() => n.filter((l) => l.isQueued), [n]), k = n.find((l) => l.isPlaying), _ = (l) => {
|
|
3348
|
+
f(l), m == null || m(l);
|
|
3349
|
+
}, $ = (l) => {
|
|
3350
|
+
if (!l)
|
|
749
3351
|
return "";
|
|
750
|
-
const
|
|
751
|
-
return `${
|
|
3352
|
+
const y = Math.floor(l / 60), v = l % 60;
|
|
3353
|
+
return `${y}:${v.toString().padStart(2, "0")}`;
|
|
752
3354
|
};
|
|
753
|
-
return /* @__PURE__ */
|
|
754
|
-
|
|
3355
|
+
return /* @__PURE__ */ a("div", { ref: r, className: `nice-song-picker ${u ?? ""}`, style: p, children: [
|
|
3356
|
+
k && /* @__PURE__ */ a("div", { className: "nice-song-picker__now-playing", children: [
|
|
755
3357
|
/* @__PURE__ */ e("span", { className: "nice-song-picker__np-label", children: "🎵 Now Playing" }),
|
|
756
|
-
|
|
757
|
-
/* @__PURE__ */ e("strong", { children:
|
|
758
|
-
/* @__PURE__ */ e("span", { children:
|
|
3358
|
+
k.albumArt && /* @__PURE__ */ e("img", { src: k.albumArt, alt: "", className: "nice-song-picker__album-art" }),
|
|
3359
|
+
/* @__PURE__ */ e("strong", { children: k.title }),
|
|
3360
|
+
/* @__PURE__ */ e("span", { children: k.artist })
|
|
759
3361
|
] }),
|
|
760
3362
|
/* @__PURE__ */ e(
|
|
761
3363
|
"input",
|
|
762
3364
|
{
|
|
763
3365
|
type: "text",
|
|
764
|
-
value:
|
|
765
|
-
onChange: (
|
|
3366
|
+
value: b,
|
|
3367
|
+
onChange: (l) => _(l.target.value),
|
|
766
3368
|
placeholder: "Search songs…",
|
|
767
3369
|
className: "nice-song-picker__search"
|
|
768
3370
|
}
|
|
769
3371
|
),
|
|
770
|
-
/* @__PURE__ */ e("div", { className: "nice-song-picker__list", children:
|
|
3372
|
+
/* @__PURE__ */ e("div", { className: "nice-song-picker__list", children: g.length === 0 ? /* @__PURE__ */ e("p", { className: "nice-song-picker__empty", children: "No songs found." }) : g.map((l) => /* @__PURE__ */ a(
|
|
771
3373
|
"div",
|
|
772
3374
|
{
|
|
773
|
-
className: `nice-song-picker__item ${
|
|
3375
|
+
className: `nice-song-picker__item ${l.isPlaying ? "nice-song-picker__item--playing" : ""}`,
|
|
774
3376
|
children: [
|
|
775
|
-
|
|
776
|
-
/* @__PURE__ */
|
|
777
|
-
/* @__PURE__ */ e("strong", { children:
|
|
778
|
-
/* @__PURE__ */ e("span", { children:
|
|
779
|
-
|
|
780
|
-
|
|
3377
|
+
l.albumArt && /* @__PURE__ */ e("img", { src: l.albumArt, alt: "", className: "nice-song-picker__thumb" }),
|
|
3378
|
+
/* @__PURE__ */ a("div", { className: "nice-song-picker__info", children: [
|
|
3379
|
+
/* @__PURE__ */ e("strong", { children: l.title }),
|
|
3380
|
+
/* @__PURE__ */ e("span", { children: l.artist }),
|
|
3381
|
+
l.duration && /* @__PURE__ */ e("span", { className: "nice-song-picker__duration", children: $(l.duration) }),
|
|
3382
|
+
l.addedByName && /* @__PURE__ */ a("small", { children: [
|
|
781
3383
|
"Added by ",
|
|
782
|
-
|
|
3384
|
+
l.addedByName
|
|
783
3385
|
] })
|
|
784
3386
|
] }),
|
|
785
|
-
!
|
|
786
|
-
|
|
3387
|
+
!i && /* @__PURE__ */ a("div", { className: "nice-song-picker__actions", children: [
|
|
3388
|
+
d && /* @__PURE__ */ a("button", { onClick: () => d(l.id), children: [
|
|
787
3389
|
"👍 ",
|
|
788
|
-
|
|
3390
|
+
l.votes ?? 0
|
|
789
3391
|
] }),
|
|
790
|
-
|
|
791
|
-
|
|
3392
|
+
c && !l.isQueued && /* @__PURE__ */ e("button", { onClick: () => c(l.id), children: "+ Queue" }),
|
|
3393
|
+
o && l.isQueued && /* @__PURE__ */ e("button", { onClick: () => o(l.id), children: "Remove" })
|
|
792
3394
|
] })
|
|
793
3395
|
]
|
|
794
3396
|
},
|
|
795
|
-
|
|
3397
|
+
l.id
|
|
796
3398
|
)) }),
|
|
797
|
-
|
|
798
|
-
/* @__PURE__ */
|
|
3399
|
+
h && w.length > 0 && /* @__PURE__ */ a("div", { className: "nice-song-picker__queue", children: [
|
|
3400
|
+
/* @__PURE__ */ a("h4", { children: [
|
|
799
3401
|
"Queue (",
|
|
800
|
-
|
|
3402
|
+
w.length,
|
|
801
3403
|
")"
|
|
802
3404
|
] }),
|
|
803
|
-
|
|
804
|
-
/* @__PURE__ */
|
|
805
|
-
|
|
3405
|
+
w.map((l, y) => /* @__PURE__ */ a("div", { className: "nice-song-picker__queue-item", children: [
|
|
3406
|
+
/* @__PURE__ */ a("span", { className: "nice-song-picker__queue-pos", children: [
|
|
3407
|
+
y + 1,
|
|
806
3408
|
"."
|
|
807
3409
|
] }),
|
|
808
|
-
/* @__PURE__ */
|
|
809
|
-
|
|
3410
|
+
/* @__PURE__ */ a("span", { children: [
|
|
3411
|
+
l.title,
|
|
810
3412
|
" — ",
|
|
811
|
-
|
|
3413
|
+
l.artist
|
|
812
3414
|
] })
|
|
813
|
-
] },
|
|
3415
|
+
] }, l.id))
|
|
814
3416
|
] })
|
|
815
3417
|
] });
|
|
816
3418
|
}
|
|
817
|
-
),
|
|
818
|
-
function(
|
|
3419
|
+
), Oi = ee(
|
|
3420
|
+
function(t, r) {
|
|
819
3421
|
const {
|
|
820
|
-
songs:
|
|
821
|
-
queue:
|
|
822
|
-
onEnqueue:
|
|
823
|
-
onDequeue:
|
|
824
|
-
onNext:
|
|
825
|
-
nowPlayingId:
|
|
826
|
-
readOnly:
|
|
827
|
-
className:
|
|
828
|
-
style:
|
|
829
|
-
} =
|
|
830
|
-
let
|
|
831
|
-
if (
|
|
832
|
-
const
|
|
833
|
-
|
|
834
|
-
(
|
|
3422
|
+
songs: n,
|
|
3423
|
+
queue: c = [],
|
|
3424
|
+
onEnqueue: o,
|
|
3425
|
+
onDequeue: d,
|
|
3426
|
+
onNext: m,
|
|
3427
|
+
nowPlayingId: h,
|
|
3428
|
+
readOnly: i = !1,
|
|
3429
|
+
className: u,
|
|
3430
|
+
style: p
|
|
3431
|
+
} = t, [b, f] = E(""), [g, w] = E(""), k = n.find((v) => v.id === h), _ = X(() => {
|
|
3432
|
+
let v = n;
|
|
3433
|
+
if (b.trim()) {
|
|
3434
|
+
const A = b.toLowerCase();
|
|
3435
|
+
v = v.filter(
|
|
3436
|
+
(I) => I.title.toLowerCase().includes(A) || I.artist.toLowerCase().includes(A)
|
|
835
3437
|
);
|
|
836
3438
|
}
|
|
837
|
-
return
|
|
838
|
-
}, [
|
|
839
|
-
switch (
|
|
3439
|
+
return g && (v = v.filter((A) => A.difficulty === g)), v;
|
|
3440
|
+
}, [n, b, g]), $ = X(() => new Set(c.map((v) => v.id)), [c]), l = ["easy", "medium", "hard", "expert"], y = (v) => {
|
|
3441
|
+
switch (v) {
|
|
840
3442
|
case "easy":
|
|
841
3443
|
return "#4caf50";
|
|
842
3444
|
case "medium":
|
|
@@ -849,8 +3451,8 @@ const hn = {
|
|
|
849
3451
|
return "#999";
|
|
850
3452
|
}
|
|
851
3453
|
};
|
|
852
|
-
return /* @__PURE__ */
|
|
853
|
-
|
|
3454
|
+
return /* @__PURE__ */ a("div", { ref: r, className: `nice-karaoke-picker ${u ?? ""}`, style: p, children: [
|
|
3455
|
+
k && /* @__PURE__ */ a(
|
|
854
3456
|
"div",
|
|
855
3457
|
{
|
|
856
3458
|
className: "nice-karaoke-picker__now-singing",
|
|
@@ -862,21 +3464,21 @@ const hn = {
|
|
|
862
3464
|
},
|
|
863
3465
|
children: [
|
|
864
3466
|
/* @__PURE__ */ e("span", { style: { fontWeight: 600 }, children: "🎤 Now Singing" }),
|
|
865
|
-
/* @__PURE__ */
|
|
866
|
-
/* @__PURE__ */ e("strong", { children:
|
|
3467
|
+
/* @__PURE__ */ a("div", { children: [
|
|
3468
|
+
/* @__PURE__ */ e("strong", { children: k.title }),
|
|
867
3469
|
" — ",
|
|
868
|
-
|
|
869
|
-
|
|
3470
|
+
k.artist,
|
|
3471
|
+
k.performerName && /* @__PURE__ */ a("span", { children: [
|
|
870
3472
|
" (by ",
|
|
871
|
-
|
|
3473
|
+
k.performerName,
|
|
872
3474
|
")"
|
|
873
3475
|
] })
|
|
874
3476
|
] }),
|
|
875
|
-
!
|
|
3477
|
+
!i && m && /* @__PURE__ */ e("button", { onClick: m, style: { marginTop: 8 }, children: "Skip / Next ⏭" })
|
|
876
3478
|
]
|
|
877
3479
|
}
|
|
878
3480
|
),
|
|
879
|
-
/* @__PURE__ */
|
|
3481
|
+
/* @__PURE__ */ a(
|
|
880
3482
|
"div",
|
|
881
3483
|
{
|
|
882
3484
|
className: "nice-karaoke-picker__filters",
|
|
@@ -886,20 +3488,20 @@ const hn = {
|
|
|
886
3488
|
"input",
|
|
887
3489
|
{
|
|
888
3490
|
type: "text",
|
|
889
|
-
value:
|
|
890
|
-
onChange: (
|
|
3491
|
+
value: b,
|
|
3492
|
+
onChange: (v) => f(v.target.value),
|
|
891
3493
|
placeholder: "Search songs or artists…",
|
|
892
3494
|
style: { flex: 1 }
|
|
893
3495
|
}
|
|
894
3496
|
),
|
|
895
|
-
/* @__PURE__ */
|
|
3497
|
+
/* @__PURE__ */ a("select", { value: g, onChange: (v) => w(v.target.value), children: [
|
|
896
3498
|
/* @__PURE__ */ e("option", { value: "", children: "All Difficulties" }),
|
|
897
|
-
|
|
3499
|
+
l.map((v) => /* @__PURE__ */ e("option", { value: v, children: v }, v))
|
|
898
3500
|
] })
|
|
899
3501
|
]
|
|
900
3502
|
}
|
|
901
3503
|
),
|
|
902
|
-
/* @__PURE__ */ e("div", { className: "nice-karaoke-picker__catalog", children:
|
|
3504
|
+
/* @__PURE__ */ e("div", { className: "nice-karaoke-picker__catalog", children: _.length === 0 ? /* @__PURE__ */ e("p", { children: "No songs match your search." }) : _.map((v) => /* @__PURE__ */ a(
|
|
903
3505
|
"div",
|
|
904
3506
|
{
|
|
905
3507
|
className: "nice-karaoke-picker__song",
|
|
@@ -911,81 +3513,81 @@ const hn = {
|
|
|
911
3513
|
borderBottom: "1px solid #eee"
|
|
912
3514
|
},
|
|
913
3515
|
children: [
|
|
914
|
-
/* @__PURE__ */
|
|
915
|
-
/* @__PURE__ */ e("strong", { children:
|
|
3516
|
+
/* @__PURE__ */ a("div", { children: [
|
|
3517
|
+
/* @__PURE__ */ e("strong", { children: v.title }),
|
|
916
3518
|
" — ",
|
|
917
|
-
|
|
918
|
-
|
|
3519
|
+
v.artist,
|
|
3520
|
+
v.difficulty && /* @__PURE__ */ a(
|
|
919
3521
|
"span",
|
|
920
3522
|
{
|
|
921
3523
|
style: {
|
|
922
3524
|
marginLeft: 8,
|
|
923
3525
|
fontSize: 12,
|
|
924
|
-
color:
|
|
3526
|
+
color: y(v.difficulty),
|
|
925
3527
|
fontWeight: 600
|
|
926
3528
|
},
|
|
927
3529
|
children: [
|
|
928
3530
|
"[",
|
|
929
|
-
|
|
3531
|
+
v.difficulty,
|
|
930
3532
|
"]"
|
|
931
3533
|
]
|
|
932
3534
|
}
|
|
933
3535
|
),
|
|
934
|
-
|
|
935
|
-
|
|
3536
|
+
v.hasLyrics && /* @__PURE__ */ e("span", { style: { marginLeft: 6, fontSize: 12 }, title: "Lyrics available", children: "📝" }),
|
|
3537
|
+
v.language && /* @__PURE__ */ a("span", { style: { marginLeft: 6, fontSize: 12, color: "#666" }, children: [
|
|
936
3538
|
"(",
|
|
937
|
-
|
|
3539
|
+
v.language,
|
|
938
3540
|
")"
|
|
939
3541
|
] })
|
|
940
3542
|
] }),
|
|
941
|
-
!
|
|
3543
|
+
!i && /* @__PURE__ */ e("div", { children: $.has(v.id) ? /* @__PURE__ */ e("button", { onClick: () => d == null ? void 0 : d(v.id), style: { color: "#f44336" }, children: "Remove" }) : /* @__PURE__ */ e("button", { onClick: () => o == null ? void 0 : o(v.id), children: "🎤 Sing" }) })
|
|
942
3544
|
]
|
|
943
3545
|
},
|
|
944
|
-
|
|
3546
|
+
v.id
|
|
945
3547
|
)) }),
|
|
946
|
-
|
|
947
|
-
/* @__PURE__ */
|
|
3548
|
+
c.length > 0 && /* @__PURE__ */ a("div", { className: "nice-karaoke-picker__queue", style: { marginTop: 16 }, children: [
|
|
3549
|
+
/* @__PURE__ */ a("h4", { children: [
|
|
948
3550
|
"🎶 Queue (",
|
|
949
|
-
|
|
3551
|
+
c.length,
|
|
950
3552
|
")"
|
|
951
3553
|
] }),
|
|
952
|
-
|
|
3554
|
+
c.map((v, A) => /* @__PURE__ */ a(
|
|
953
3555
|
"div",
|
|
954
3556
|
{
|
|
955
3557
|
style: { display: "flex", justifyContent: "space-between", padding: "4px 0" },
|
|
956
3558
|
children: [
|
|
957
|
-
/* @__PURE__ */
|
|
958
|
-
/* @__PURE__ */
|
|
959
|
-
|
|
3559
|
+
/* @__PURE__ */ a("span", { children: [
|
|
3560
|
+
/* @__PURE__ */ a("strong", { children: [
|
|
3561
|
+
A + 1,
|
|
960
3562
|
"."
|
|
961
3563
|
] }),
|
|
962
3564
|
" ",
|
|
963
|
-
|
|
3565
|
+
v.title,
|
|
964
3566
|
" — ",
|
|
965
|
-
|
|
966
|
-
|
|
3567
|
+
v.artist,
|
|
3568
|
+
v.performerName && /* @__PURE__ */ a("em", { children: [
|
|
967
3569
|
" (",
|
|
968
|
-
|
|
3570
|
+
v.performerName,
|
|
969
3571
|
")"
|
|
970
3572
|
] })
|
|
971
3573
|
] }),
|
|
972
|
-
!
|
|
3574
|
+
!i && d && /* @__PURE__ */ e("button", { onClick: () => d(v.id), style: { fontSize: 12 }, children: "✕" })
|
|
973
3575
|
]
|
|
974
3576
|
},
|
|
975
|
-
|
|
3577
|
+
v.id
|
|
976
3578
|
))
|
|
977
3579
|
] })
|
|
978
3580
|
] });
|
|
979
3581
|
}
|
|
980
|
-
),
|
|
981
|
-
game:
|
|
982
|
-
music:
|
|
983
|
-
dance:
|
|
984
|
-
quiz:
|
|
985
|
-
karaoke:
|
|
986
|
-
photo:
|
|
987
|
-
custom:
|
|
988
|
-
},
|
|
3582
|
+
), Nn = {
|
|
3583
|
+
game: An,
|
|
3584
|
+
music: Re,
|
|
3585
|
+
dance: Re,
|
|
3586
|
+
quiz: Qe,
|
|
3587
|
+
karaoke: $n,
|
|
3588
|
+
photo: zn,
|
|
3589
|
+
custom: Sn
|
|
3590
|
+
}, Ni = {
|
|
989
3591
|
game: "Games",
|
|
990
3592
|
music: "Music",
|
|
991
3593
|
dance: "Dance",
|
|
@@ -993,46 +3595,46 @@ const hn = {
|
|
|
993
3595
|
karaoke: "Karaoke",
|
|
994
3596
|
photo: "Photo",
|
|
995
3597
|
custom: "Custom"
|
|
996
|
-
},
|
|
997
|
-
function(
|
|
3598
|
+
}, Ri = ee(
|
|
3599
|
+
function(t, r) {
|
|
998
3600
|
const {
|
|
999
|
-
attractions:
|
|
1000
|
-
onSelect:
|
|
1001
|
-
onDeselect:
|
|
1002
|
-
onVote:
|
|
1003
|
-
selectedIds:
|
|
1004
|
-
maxSelections:
|
|
1005
|
-
showVotes:
|
|
1006
|
-
readOnly:
|
|
1007
|
-
layout:
|
|
1008
|
-
className:
|
|
1009
|
-
style:
|
|
1010
|
-
} =
|
|
1011
|
-
const
|
|
1012
|
-
return Array.from(
|
|
1013
|
-
}, [
|
|
1014
|
-
let
|
|
1015
|
-
if (
|
|
1016
|
-
const
|
|
1017
|
-
|
|
1018
|
-
(
|
|
1019
|
-
var
|
|
1020
|
-
return
|
|
3601
|
+
attractions: n,
|
|
3602
|
+
onSelect: c,
|
|
3603
|
+
onDeselect: o,
|
|
3604
|
+
onVote: d,
|
|
3605
|
+
selectedIds: m = [],
|
|
3606
|
+
maxSelections: h,
|
|
3607
|
+
showVotes: i = !0,
|
|
3608
|
+
readOnly: u = !1,
|
|
3609
|
+
layout: p = "grid",
|
|
3610
|
+
className: b,
|
|
3611
|
+
style: f
|
|
3612
|
+
} = t, [g, w] = E(""), [k, _] = E(""), $ = X(() => new Set(m), [m]), l = X(() => {
|
|
3613
|
+
const I = new Set(n.map((D) => D.category));
|
|
3614
|
+
return Array.from(I);
|
|
3615
|
+
}, [n]), y = X(() => {
|
|
3616
|
+
let I = n;
|
|
3617
|
+
if (g && (I = I.filter((D) => D.category === g)), k.trim()) {
|
|
3618
|
+
const D = k.toLowerCase();
|
|
3619
|
+
I = I.filter(
|
|
3620
|
+
(N) => {
|
|
3621
|
+
var L;
|
|
3622
|
+
return N.name.toLowerCase().includes(D) || ((L = N.description) == null ? void 0 : L.toLowerCase().includes(D));
|
|
1021
3623
|
}
|
|
1022
3624
|
);
|
|
1023
3625
|
}
|
|
1024
|
-
return
|
|
1025
|
-
}, [
|
|
1026
|
-
|
|
3626
|
+
return I;
|
|
3627
|
+
}, [n, g, k]), v = !h || $.size < h, A = (I) => {
|
|
3628
|
+
u || ($.has(I) ? o == null || o(I) : v && (c == null || c(I)));
|
|
1027
3629
|
};
|
|
1028
|
-
return /* @__PURE__ */
|
|
3630
|
+
return /* @__PURE__ */ a(
|
|
1029
3631
|
"div",
|
|
1030
3632
|
{
|
|
1031
|
-
ref:
|
|
1032
|
-
className: `nice-attraction-picker ${
|
|
1033
|
-
style: { color: "var(--text-primary)", ...
|
|
3633
|
+
ref: r,
|
|
3634
|
+
className: `nice-attraction-picker ${b ?? ""}`,
|
|
3635
|
+
style: { color: "var(--text-primary)", ...f },
|
|
1034
3636
|
children: [
|
|
1035
|
-
/* @__PURE__ */
|
|
3637
|
+
/* @__PURE__ */ a(
|
|
1036
3638
|
"div",
|
|
1037
3639
|
{
|
|
1038
3640
|
style: {
|
|
@@ -1043,22 +3645,22 @@ const hn = {
|
|
|
1043
3645
|
},
|
|
1044
3646
|
children: [
|
|
1045
3647
|
/* @__PURE__ */ e("h3", { style: { margin: 0 }, children: "Attractions" }),
|
|
1046
|
-
|
|
1047
|
-
|
|
3648
|
+
h && /* @__PURE__ */ a("span", { style: { color: "var(--text-secondary, #64748b)", fontSize: 14 }, children: [
|
|
3649
|
+
$.size,
|
|
1048
3650
|
"/",
|
|
1049
|
-
|
|
3651
|
+
h,
|
|
1050
3652
|
" selected"
|
|
1051
3653
|
] })
|
|
1052
3654
|
]
|
|
1053
3655
|
}
|
|
1054
3656
|
),
|
|
1055
|
-
/* @__PURE__ */
|
|
3657
|
+
/* @__PURE__ */ a("div", { style: { display: "flex", gap: 8, marginBottom: 12, flexWrap: "wrap" }, children: [
|
|
1056
3658
|
/* @__PURE__ */ e(
|
|
1057
3659
|
"input",
|
|
1058
3660
|
{
|
|
1059
3661
|
type: "text",
|
|
1060
|
-
value:
|
|
1061
|
-
onChange: (
|
|
3662
|
+
value: k,
|
|
3663
|
+
onChange: (I) => _(I.target.value),
|
|
1062
3664
|
placeholder: "Search attractions…",
|
|
1063
3665
|
style: { flex: 1, minWidth: 150 }
|
|
1064
3666
|
}
|
|
@@ -1066,60 +3668,60 @@ const hn = {
|
|
|
1066
3668
|
/* @__PURE__ */ e(
|
|
1067
3669
|
"button",
|
|
1068
3670
|
{
|
|
1069
|
-
onClick: () =>
|
|
1070
|
-
style: { fontWeight:
|
|
3671
|
+
onClick: () => w(""),
|
|
3672
|
+
style: { fontWeight: g ? 400 : 700 },
|
|
1071
3673
|
children: "All"
|
|
1072
3674
|
}
|
|
1073
3675
|
),
|
|
1074
|
-
|
|
3676
|
+
l.map((I) => /* @__PURE__ */ a(
|
|
1075
3677
|
"button",
|
|
1076
3678
|
{
|
|
1077
|
-
onClick: () =>
|
|
3679
|
+
onClick: () => w(I === g ? "" : I),
|
|
1078
3680
|
style: {
|
|
1079
|
-
fontWeight:
|
|
3681
|
+
fontWeight: I === g ? 700 : 400,
|
|
1080
3682
|
display: "inline-flex",
|
|
1081
3683
|
alignItems: "center",
|
|
1082
3684
|
gap: 4
|
|
1083
3685
|
},
|
|
1084
3686
|
children: [
|
|
1085
|
-
|
|
3687
|
+
Ue.createElement(Nn[I], { size: 14 }),
|
|
1086
3688
|
" ",
|
|
1087
|
-
|
|
3689
|
+
Ni[I]
|
|
1088
3690
|
]
|
|
1089
3691
|
},
|
|
1090
|
-
|
|
3692
|
+
I
|
|
1091
3693
|
))
|
|
1092
3694
|
] }),
|
|
1093
3695
|
/* @__PURE__ */ e(
|
|
1094
3696
|
"div",
|
|
1095
3697
|
{
|
|
1096
3698
|
style: {
|
|
1097
|
-
display:
|
|
1098
|
-
gridTemplateColumns:
|
|
3699
|
+
display: p === "grid" ? "grid" : "flex",
|
|
3700
|
+
gridTemplateColumns: p === "grid" ? "repeat(auto-fill, minmax(200px, 1fr))" : void 0,
|
|
1099
3701
|
gap: 12,
|
|
1100
|
-
flexDirection:
|
|
3702
|
+
flexDirection: p === "list" ? "column" : void 0
|
|
1101
3703
|
},
|
|
1102
|
-
children:
|
|
1103
|
-
const
|
|
1104
|
-
return /* @__PURE__ */
|
|
3704
|
+
children: y.length === 0 ? /* @__PURE__ */ e("p", { children: "No attractions found." }) : y.map((I) => {
|
|
3705
|
+
const D = $.has(I.id);
|
|
3706
|
+
return /* @__PURE__ */ a(
|
|
1105
3707
|
"div",
|
|
1106
3708
|
{
|
|
1107
3709
|
className: "nice-attraction-picker__card",
|
|
1108
3710
|
style: {
|
|
1109
|
-
border:
|
|
3711
|
+
border: D ? "2px solid var(--color-primary, #6366f1)" : "1px solid var(--border-color, #cbd5e1)",
|
|
1110
3712
|
borderRadius: 8,
|
|
1111
3713
|
padding: 12,
|
|
1112
|
-
cursor:
|
|
1113
|
-
background:
|
|
3714
|
+
cursor: u ? "default" : "pointer",
|
|
3715
|
+
background: D ? "color-mix(in srgb, var(--color-primary) 12%, transparent)" : "var(--bg-elevated, var(--bg-primary))",
|
|
1114
3716
|
transition: "all 0.2s"
|
|
1115
3717
|
},
|
|
1116
|
-
onClick: () =>
|
|
3718
|
+
onClick: () => A(I.id),
|
|
1117
3719
|
children: [
|
|
1118
|
-
|
|
3720
|
+
I.imageUrl && /* @__PURE__ */ e(
|
|
1119
3721
|
"img",
|
|
1120
3722
|
{
|
|
1121
|
-
src:
|
|
1122
|
-
alt:
|
|
3723
|
+
src: I.imageUrl,
|
|
3724
|
+
alt: I.name,
|
|
1123
3725
|
style: {
|
|
1124
3726
|
width: "100%",
|
|
1125
3727
|
borderRadius: 6,
|
|
@@ -1129,11 +3731,11 @@ const hn = {
|
|
|
1129
3731
|
}
|
|
1130
3732
|
}
|
|
1131
3733
|
),
|
|
1132
|
-
/* @__PURE__ */
|
|
1133
|
-
/* @__PURE__ */ e("span", { style: { display: "inline-flex" }, children:
|
|
1134
|
-
/* @__PURE__ */ e("strong", { children:
|
|
3734
|
+
/* @__PURE__ */ a("div", { style: { display: "flex", alignItems: "center", gap: 6 }, children: [
|
|
3735
|
+
/* @__PURE__ */ e("span", { style: { display: "inline-flex" }, children: Ue.createElement(Nn[I.category], { size: 16 }) }),
|
|
3736
|
+
/* @__PURE__ */ e("strong", { children: I.name })
|
|
1135
3737
|
] }),
|
|
1136
|
-
|
|
3738
|
+
I.description && /* @__PURE__ */ e(
|
|
1137
3739
|
"p",
|
|
1138
3740
|
{
|
|
1139
3741
|
style: {
|
|
@@ -1141,10 +3743,10 @@ const hn = {
|
|
|
1141
3743
|
color: "var(--text-secondary, #64748b)",
|
|
1142
3744
|
margin: "6px 0"
|
|
1143
3745
|
},
|
|
1144
|
-
children:
|
|
3746
|
+
children: I.description
|
|
1145
3747
|
}
|
|
1146
3748
|
),
|
|
1147
|
-
/* @__PURE__ */
|
|
3749
|
+
/* @__PURE__ */ a(
|
|
1148
3750
|
"div",
|
|
1149
3751
|
{
|
|
1150
3752
|
style: {
|
|
@@ -1154,7 +3756,7 @@ const hn = {
|
|
|
1154
3756
|
marginTop: 8
|
|
1155
3757
|
},
|
|
1156
3758
|
children: [
|
|
1157
|
-
|
|
3759
|
+
i && /* @__PURE__ */ a(
|
|
1158
3760
|
"span",
|
|
1159
3761
|
{
|
|
1160
3762
|
style: {
|
|
@@ -1164,17 +3766,17 @@ const hn = {
|
|
|
1164
3766
|
gap: 4
|
|
1165
3767
|
},
|
|
1166
3768
|
children: [
|
|
1167
|
-
/* @__PURE__ */ e(
|
|
3769
|
+
/* @__PURE__ */ e(bt, { size: 14 }),
|
|
1168
3770
|
" ",
|
|
1169
|
-
|
|
3771
|
+
I.votes ?? 0
|
|
1170
3772
|
]
|
|
1171
3773
|
}
|
|
1172
3774
|
),
|
|
1173
|
-
!
|
|
3775
|
+
!u && d && /* @__PURE__ */ e(
|
|
1174
3776
|
"button",
|
|
1175
3777
|
{
|
|
1176
|
-
onClick: (
|
|
1177
|
-
|
|
3778
|
+
onClick: (N) => {
|
|
3779
|
+
N.stopPropagation(), d(I.id);
|
|
1178
3780
|
},
|
|
1179
3781
|
style: { fontSize: 12 },
|
|
1180
3782
|
children: "Vote"
|
|
@@ -1185,7 +3787,7 @@ const hn = {
|
|
|
1185
3787
|
)
|
|
1186
3788
|
]
|
|
1187
3789
|
},
|
|
1188
|
-
|
|
3790
|
+
I.id
|
|
1189
3791
|
);
|
|
1190
3792
|
})
|
|
1191
3793
|
}
|
|
@@ -1194,66 +3796,66 @@ const hn = {
|
|
|
1194
3796
|
}
|
|
1195
3797
|
);
|
|
1196
3798
|
}
|
|
1197
|
-
),
|
|
1198
|
-
game:
|
|
1199
|
-
music:
|
|
1200
|
-
dance:
|
|
1201
|
-
quiz:
|
|
1202
|
-
karaoke:
|
|
1203
|
-
photo:
|
|
1204
|
-
custom:
|
|
1205
|
-
},
|
|
1206
|
-
function(
|
|
3799
|
+
), bi = {
|
|
3800
|
+
game: An,
|
|
3801
|
+
music: Re,
|
|
3802
|
+
dance: Re,
|
|
3803
|
+
quiz: Qe,
|
|
3804
|
+
karaoke: $n,
|
|
3805
|
+
photo: zn,
|
|
3806
|
+
custom: Sn
|
|
3807
|
+
}, Ui = ee(
|
|
3808
|
+
function(t, r) {
|
|
1207
3809
|
const {
|
|
1208
|
-
attractions:
|
|
1209
|
-
onVote:
|
|
1210
|
-
onUnvote:
|
|
1211
|
-
votedIds:
|
|
1212
|
-
maxVotes:
|
|
1213
|
-
closed:
|
|
1214
|
-
sortBy:
|
|
1215
|
-
showResults:
|
|
1216
|
-
className:
|
|
1217
|
-
style:
|
|
1218
|
-
} =
|
|
1219
|
-
const
|
|
1220
|
-
switch (
|
|
3810
|
+
attractions: n,
|
|
3811
|
+
onVote: c,
|
|
3812
|
+
onUnvote: o,
|
|
3813
|
+
votedIds: d = [],
|
|
3814
|
+
maxVotes: m,
|
|
3815
|
+
closed: h = !1,
|
|
3816
|
+
sortBy: i = "votes",
|
|
3817
|
+
showResults: u = !0,
|
|
3818
|
+
className: p,
|
|
3819
|
+
style: b
|
|
3820
|
+
} = t, f = X(() => new Set(d), [d]), g = m ? m - f.size : void 0, w = X(() => {
|
|
3821
|
+
const l = [...n];
|
|
3822
|
+
switch (i) {
|
|
1221
3823
|
case "votes":
|
|
1222
|
-
|
|
3824
|
+
l.sort((y, v) => (v.votes ?? 0) - (y.votes ?? 0));
|
|
1223
3825
|
break;
|
|
1224
3826
|
case "name":
|
|
1225
|
-
|
|
3827
|
+
l.sort((y, v) => y.name.localeCompare(v.name));
|
|
1226
3828
|
break;
|
|
1227
3829
|
case "category":
|
|
1228
|
-
|
|
3830
|
+
l.sort((y, v) => y.category.localeCompare(v.category));
|
|
1229
3831
|
break;
|
|
1230
3832
|
}
|
|
1231
|
-
return
|
|
1232
|
-
}, [
|
|
1233
|
-
() => Math.max(...
|
|
1234
|
-
[
|
|
1235
|
-
),
|
|
1236
|
-
|
|
1237
|
-
},
|
|
1238
|
-
switch (
|
|
3833
|
+
return l;
|
|
3834
|
+
}, [n, i]), k = X(
|
|
3835
|
+
() => Math.max(...n.map((l) => l.votes ?? 0), 1),
|
|
3836
|
+
[n]
|
|
3837
|
+
), _ = (l) => {
|
|
3838
|
+
h || (f.has(l) ? o == null || o(l) : (!g || g > 0) && (c == null || c(l)));
|
|
3839
|
+
}, $ = (l) => {
|
|
3840
|
+
switch (l) {
|
|
1239
3841
|
case 0:
|
|
1240
|
-
return /* @__PURE__ */ e(
|
|
3842
|
+
return /* @__PURE__ */ e(xt, { size: 18, primaryColor: "#f59e0b", title: "1st place" });
|
|
1241
3843
|
case 1:
|
|
1242
|
-
return /* @__PURE__ */ e(
|
|
3844
|
+
return /* @__PURE__ */ e(dn, { size: 18, primaryColor: "#94a3b8", title: "2nd place" });
|
|
1243
3845
|
case 2:
|
|
1244
|
-
return /* @__PURE__ */ e(
|
|
3846
|
+
return /* @__PURE__ */ e(dn, { size: 18, primaryColor: "#b45309", title: "3rd place" });
|
|
1245
3847
|
default:
|
|
1246
|
-
return `${
|
|
3848
|
+
return `${l + 1}.`;
|
|
1247
3849
|
}
|
|
1248
3850
|
};
|
|
1249
|
-
return /* @__PURE__ */
|
|
3851
|
+
return /* @__PURE__ */ a(
|
|
1250
3852
|
"div",
|
|
1251
3853
|
{
|
|
1252
|
-
ref:
|
|
1253
|
-
className: `nice-attraction-voting ${
|
|
1254
|
-
style: { color: "var(--text-primary)", ...
|
|
3854
|
+
ref: r,
|
|
3855
|
+
className: `nice-attraction-voting ${p ?? ""}`,
|
|
3856
|
+
style: { color: "var(--text-primary)", ...b },
|
|
1255
3857
|
children: [
|
|
1256
|
-
/* @__PURE__ */
|
|
3858
|
+
/* @__PURE__ */ a(
|
|
1257
3859
|
"div",
|
|
1258
3860
|
{
|
|
1259
3861
|
style: {
|
|
@@ -1263,21 +3865,21 @@ const hn = {
|
|
|
1263
3865
|
marginBottom: 16
|
|
1264
3866
|
},
|
|
1265
3867
|
children: [
|
|
1266
|
-
/* @__PURE__ */
|
|
1267
|
-
/* @__PURE__ */ e(
|
|
1268
|
-
|
|
3868
|
+
/* @__PURE__ */ a("h3", { style: { margin: 0, display: "inline-flex", alignItems: "center", gap: 8 }, children: [
|
|
3869
|
+
/* @__PURE__ */ e(wt, { size: 20 }),
|
|
3870
|
+
h ? "Voting Results" : "Vote for Attractions"
|
|
1269
3871
|
] }),
|
|
1270
|
-
!
|
|
3872
|
+
!h && g !== void 0 && /* @__PURE__ */ a(
|
|
1271
3873
|
"span",
|
|
1272
3874
|
{
|
|
1273
3875
|
style: {
|
|
1274
3876
|
fontSize: 14,
|
|
1275
|
-
color:
|
|
3877
|
+
color: g > 0 ? "var(--color-primary, #6366f1)" : "var(--color-error, #ef4444)"
|
|
1276
3878
|
},
|
|
1277
3879
|
children: [
|
|
1278
|
-
|
|
3880
|
+
g,
|
|
1279
3881
|
" vote",
|
|
1280
|
-
|
|
3882
|
+
g !== 1 ? "s" : "",
|
|
1281
3883
|
" remaining"
|
|
1282
3884
|
]
|
|
1283
3885
|
}
|
|
@@ -1285,10 +3887,10 @@ const hn = {
|
|
|
1285
3887
|
]
|
|
1286
3888
|
}
|
|
1287
3889
|
),
|
|
1288
|
-
|
|
1289
|
-
/* @__PURE__ */ e("div", { style: { display: "flex", flexDirection: "column", gap: 8 }, children:
|
|
1290
|
-
const
|
|
1291
|
-
return /* @__PURE__ */
|
|
3890
|
+
h && /* @__PURE__ */ e("p", { style: { color: "var(--text-secondary, #64748b)", marginBottom: 12 }, children: "Voting is closed. Final results:" }),
|
|
3891
|
+
/* @__PURE__ */ e("div", { style: { display: "flex", flexDirection: "column", gap: 8 }, children: w.map((l, y) => {
|
|
3892
|
+
const v = f.has(l.id), A = l.votes ?? 0, I = u ? `${Math.round(A / k * 100)}%` : "0%";
|
|
3893
|
+
return /* @__PURE__ */ a(
|
|
1292
3894
|
"div",
|
|
1293
3895
|
{
|
|
1294
3896
|
style: {
|
|
@@ -1297,18 +3899,18 @@ const hn = {
|
|
|
1297
3899
|
gap: 12,
|
|
1298
3900
|
padding: "10px 14px",
|
|
1299
3901
|
borderRadius: 8,
|
|
1300
|
-
border:
|
|
1301
|
-
background:
|
|
1302
|
-
cursor:
|
|
3902
|
+
border: v ? "2px solid var(--color-primary, #6366f1)" : "1px solid var(--border-color, #cbd5e1)",
|
|
3903
|
+
background: v ? "color-mix(in srgb, var(--color-primary) 12%, transparent)" : "var(--bg-elevated, var(--bg-primary))",
|
|
3904
|
+
cursor: h ? "default" : "pointer",
|
|
1303
3905
|
transition: "all 0.2s"
|
|
1304
3906
|
},
|
|
1305
|
-
onClick: () =>
|
|
3907
|
+
onClick: () => _(l.id),
|
|
1306
3908
|
children: [
|
|
1307
|
-
|
|
1308
|
-
/* @__PURE__ */ e("span", { style: { display: "inline-flex", fontSize: 20 }, children:
|
|
1309
|
-
/* @__PURE__ */
|
|
1310
|
-
/* @__PURE__ */ e("div", { style: { fontWeight: 600 }, children:
|
|
1311
|
-
|
|
3909
|
+
u && /* @__PURE__ */ e("span", { style: { fontSize: 18, minWidth: 32, textAlign: "center" }, children: $(y) }),
|
|
3910
|
+
/* @__PURE__ */ e("span", { style: { display: "inline-flex", fontSize: 20 }, children: Ue.createElement(bi[l.category], { size: 20 }) }),
|
|
3911
|
+
/* @__PURE__ */ a("div", { style: { flex: 1, minWidth: 0 }, children: [
|
|
3912
|
+
/* @__PURE__ */ e("div", { style: { fontWeight: 600 }, children: l.name }),
|
|
3913
|
+
l.description && /* @__PURE__ */ e(
|
|
1312
3914
|
"div",
|
|
1313
3915
|
{
|
|
1314
3916
|
style: {
|
|
@@ -1318,10 +3920,10 @@ const hn = {
|
|
|
1318
3920
|
textOverflow: "ellipsis",
|
|
1319
3921
|
whiteSpace: "nowrap"
|
|
1320
3922
|
},
|
|
1321
|
-
children:
|
|
3923
|
+
children: l.description
|
|
1322
3924
|
}
|
|
1323
3925
|
),
|
|
1324
|
-
|
|
3926
|
+
u && /* @__PURE__ */ e(
|
|
1325
3927
|
"div",
|
|
1326
3928
|
{
|
|
1327
3929
|
style: {
|
|
@@ -1336,7 +3938,7 @@ const hn = {
|
|
|
1336
3938
|
{
|
|
1337
3939
|
style: {
|
|
1338
3940
|
height: "100%",
|
|
1339
|
-
width:
|
|
3941
|
+
width: I,
|
|
1340
3942
|
background: "var(--color-primary, #6366f1)",
|
|
1341
3943
|
borderRadius: 3,
|
|
1342
3944
|
transition: "width 0.3s"
|
|
@@ -1346,31 +3948,31 @@ const hn = {
|
|
|
1346
3948
|
}
|
|
1347
3949
|
)
|
|
1348
3950
|
] }),
|
|
1349
|
-
|
|
1350
|
-
!
|
|
3951
|
+
u && /* @__PURE__ */ e("span", { style: { fontWeight: 600, fontSize: 16, minWidth: 40, textAlign: "right" }, children: A }),
|
|
3952
|
+
!h && /* @__PURE__ */ e(
|
|
1351
3953
|
"button",
|
|
1352
3954
|
{
|
|
1353
|
-
onClick: (
|
|
1354
|
-
|
|
3955
|
+
onClick: (D) => {
|
|
3956
|
+
D.stopPropagation(), _(l.id);
|
|
1355
3957
|
},
|
|
1356
3958
|
style: {
|
|
1357
3959
|
padding: "4px 12px",
|
|
1358
3960
|
borderRadius: 4,
|
|
1359
3961
|
border: "none",
|
|
1360
|
-
background:
|
|
3962
|
+
background: v ? "var(--color-error, #ef4444)" : "var(--color-primary, #6366f1)",
|
|
1361
3963
|
color: "#fff",
|
|
1362
3964
|
cursor: "pointer",
|
|
1363
3965
|
fontSize: 13
|
|
1364
3966
|
},
|
|
1365
|
-
children:
|
|
3967
|
+
children: v ? "Unvote" : "Vote"
|
|
1366
3968
|
}
|
|
1367
3969
|
)
|
|
1368
3970
|
]
|
|
1369
3971
|
},
|
|
1370
|
-
|
|
3972
|
+
l.id
|
|
1371
3973
|
);
|
|
1372
3974
|
}) }),
|
|
1373
|
-
|
|
3975
|
+
u && /* @__PURE__ */ a(
|
|
1374
3976
|
"div",
|
|
1375
3977
|
{
|
|
1376
3978
|
style: {
|
|
@@ -1381,7 +3983,7 @@ const hn = {
|
|
|
1381
3983
|
},
|
|
1382
3984
|
children: [
|
|
1383
3985
|
"Total votes: ",
|
|
1384
|
-
|
|
3986
|
+
n.reduce((l, y) => l + (y.votes ?? 0), 0)
|
|
1385
3987
|
]
|
|
1386
3988
|
}
|
|
1387
3989
|
)
|
|
@@ -1391,12 +3993,20 @@ const hn = {
|
|
|
1391
3993
|
}
|
|
1392
3994
|
);
|
|
1393
3995
|
export {
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
3996
|
+
Ri as NiceAttractionPicker,
|
|
3997
|
+
Ui as NiceAttractionVoting,
|
|
3998
|
+
Si as NiceEventMedia,
|
|
3999
|
+
$i as NiceEventPlanning,
|
|
4000
|
+
Di as NiceExpenseSplit,
|
|
4001
|
+
Mi as NiceGiftRegistry,
|
|
4002
|
+
Ti as NiceInvitationDesigner,
|
|
4003
|
+
Oi as NiceKaraokePicker,
|
|
4004
|
+
zi as NiceMediaCollage,
|
|
4005
|
+
Ai as NiceParticipantList,
|
|
4006
|
+
Li as NiceRoundCard,
|
|
4007
|
+
Ei as NiceRoundList,
|
|
4008
|
+
pn as NiceRsvpControl,
|
|
4009
|
+
Pi as NiceSeatPicker,
|
|
4010
|
+
ai as NiceSeatingChart,
|
|
4011
|
+
Bi as NiceSongPicker
|
|
1402
4012
|
};
|