@innosolutions/inno-calendar 1.0.53 → 1.0.55

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.
Files changed (33) hide show
  1. package/dist/agenda-widget-B7ryNQOt.js +3922 -0
  2. package/dist/agenda-widget-B7ryNQOt.js.map +1 -0
  3. package/dist/agenda-widget-YH495m1F.cjs +2 -0
  4. package/dist/agenda-widget-YH495m1F.cjs.map +1 -0
  5. package/dist/components/index.cjs +1 -1
  6. package/dist/components/index.mjs +2 -2
  7. package/dist/components/inno-calendar.d.ts.map +1 -1
  8. package/dist/components/primitives/index.d.ts +1 -0
  9. package/dist/components/primitives/index.d.ts.map +1 -1
  10. package/dist/components/primitives/scroll-navigator.d.ts +32 -0
  11. package/dist/components/primitives/scroll-navigator.d.ts.map +1 -0
  12. package/dist/components/views/day-events-expansion.d.ts +2 -2
  13. package/dist/components/views/day-events-expansion.d.ts.map +1 -1
  14. package/dist/index.cjs +1 -1
  15. package/dist/index.mjs +3 -3
  16. package/dist/presets/index.cjs +1 -1
  17. package/dist/presets/index.mjs +1 -1
  18. package/dist/styles/index.css +1 -1
  19. package/dist/{tailwind-calendar-Ufp5YM_i.cjs → tailwind-calendar-B2Wloz_o.cjs} +2 -2
  20. package/dist/{tailwind-calendar-Ufp5YM_i.cjs.map → tailwind-calendar-B2Wloz_o.cjs.map} +1 -1
  21. package/dist/{tailwind-calendar-Wvl6G_sK.js → tailwind-calendar-CjhEUHpL.js} +2 -2
  22. package/dist/{tailwind-calendar-Wvl6G_sK.js.map → tailwind-calendar-CjhEUHpL.js.map} +1 -1
  23. package/dist/{week-view-CCzE8DEb.js → week-view-D3PDybDq.js} +184 -187
  24. package/dist/week-view-D3PDybDq.js.map +1 -0
  25. package/dist/{week-view-1DnsOgRW.cjs → week-view-DfavofVM.cjs} +3 -3
  26. package/dist/week-view-DfavofVM.cjs.map +1 -0
  27. package/package.json +1 -1
  28. package/dist/agenda-widget-CcvTi51_.cjs +0 -2
  29. package/dist/agenda-widget-CcvTi51_.cjs.map +0 -1
  30. package/dist/agenda-widget-DHq2DsjV.js +0 -3740
  31. package/dist/agenda-widget-DHq2DsjV.js.map +0 -1
  32. package/dist/week-view-1DnsOgRW.cjs.map +0 -1
  33. package/dist/week-view-CCzE8DEb.js.map +0 -1
@@ -1,3740 +0,0 @@
1
- import { jsx as e, jsxs as n, Fragment as ge } from "react/jsx-runtime";
2
- import { g as ot, u as mt, C as ft } from "./use-calendar-Clo9DFK4.js";
3
- import { useCallback as Y, useState as se, useEffect as be, forwardRef as je, useRef as Ie, useMemo as G, useLayoutEffect as gt, useImperativeHandle as pt } from "react";
4
- import { c as m } from "./index-DtaLkIY8.js";
5
- import { P as st, p as at, o as it, z as ce, I as xt, J as vt, B as we, K as wt, L as _e, x as de, F as ue, y as he, k as bt, C as yt, M as Re, A as kt, W as Nt, c as Ct, N as Dt } from "./week-view-CCzE8DEb.js";
6
- import { j as Mt, D as St, I as Et, e as zt, S as Tt } from "./slot-selection-context-BwghpxKA.js";
7
- import { isToday as oe, startOfDay as We, endOfDay as lt, getYearMonths as Lt, generateMonthGrid as Ht, getEventsForDay as It, addDays as ct, formatDateISO as jt } from "./utils.mjs";
8
- function Wt({ view: t, className: r = "" }) {
9
- return /* @__PURE__ */ e(
10
- "div",
11
- {
12
- className: r,
13
- style: {
14
- display: "flex",
15
- alignItems: "center",
16
- justifyContent: "center",
17
- minHeight: "400px",
18
- backgroundColor: "#f9fafb",
19
- borderRadius: "0.5rem",
20
- border: "1px dashed #d1d5db"
21
- },
22
- children: /* @__PURE__ */ n("div", { style: { textAlign: "center", color: "#6b7280" }, children: [
23
- /* @__PURE__ */ n("p", { style: { fontSize: "1.125rem", fontWeight: 500 }, children: [
24
- t.charAt(0).toUpperCase() + t.slice(1),
25
- " View"
26
- ] }),
27
- /* @__PURE__ */ e("p", { style: { fontSize: "0.875rem" }, children: "Implementation pending" })
28
- ] })
29
- }
30
- );
31
- }
32
- function Ve({ view: t, className: r }) {
33
- return /* @__PURE__ */ e(Wt, { view: t, className: r });
34
- }
35
- function dn(t) {
36
- const {
37
- events: r,
38
- resources: o,
39
- scheduleTypes: a,
40
- initialView: i = "week",
41
- initialDate: l,
42
- initialFilters: p,
43
- preferences: f,
44
- locale: d,
45
- slots: x,
46
- renderEvent: y,
47
- onViewChange: v,
48
- onDateChange: L,
49
- onEventClick: F,
50
- onSlotSelect: I,
51
- onFiltersChange: W,
52
- className: E,
53
- children: N
54
- } = t, j = ot();
55
- if (j)
56
- return /* @__PURE__ */ e("div", { className: E, style: { position: "relative" }, children: N ?? /* @__PURE__ */ e(Ve, { view: j.view, className: E }) });
57
- const B = mt({
58
- events: r,
59
- resources: o,
60
- scheduleTypes: a,
61
- initialView: i,
62
- initialDate: l,
63
- initialFilters: p,
64
- preferences: f,
65
- locale: d,
66
- onViewChange: v,
67
- onDateChange: L,
68
- onEventClick: F,
69
- onSlotSelect: I,
70
- onFiltersChange: W
71
- });
72
- return /* @__PURE__ */ e(ft, { value: B, children: /* @__PURE__ */ e("div", { className: E, style: { position: "relative" }, children: N ?? /* @__PURE__ */ e(Ve, { view: B.view, className: E }) }) });
73
- }
74
- function At({ className: t }) {
75
- return /* @__PURE__ */ n(
76
- "svg",
77
- {
78
- xmlns: "http://www.w3.org/2000/svg",
79
- viewBox: "0 0 24 24",
80
- fill: "none",
81
- stroke: "currentColor",
82
- strokeWidth: "2",
83
- strokeLinecap: "round",
84
- strokeLinejoin: "round",
85
- className: t,
86
- children: [
87
- /* @__PURE__ */ e("path", { d: "M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z" }),
88
- /* @__PURE__ */ e("path", { d: "m15 5 4 4" })
89
- ]
90
- }
91
- );
92
- }
93
- function dt({ className: t }) {
94
- return /* @__PURE__ */ n(
95
- "svg",
96
- {
97
- xmlns: "http://www.w3.org/2000/svg",
98
- viewBox: "0 0 24 24",
99
- fill: "none",
100
- stroke: "currentColor",
101
- strokeWidth: "2",
102
- strokeLinecap: "round",
103
- strokeLinejoin: "round",
104
- className: t,
105
- children: [
106
- /* @__PURE__ */ e("path", { d: "M3 6h18" }),
107
- /* @__PURE__ */ e("path", { d: "M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6" }),
108
- /* @__PURE__ */ e("path", { d: "M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2" }),
109
- /* @__PURE__ */ e("line", { x1: "10", x2: "10", y1: "11", y2: "17" }),
110
- /* @__PURE__ */ e("line", { x1: "14", x2: "14", y1: "11", y2: "17" })
111
- ]
112
- }
113
- );
114
- }
115
- function He({ className: t }) {
116
- return /* @__PURE__ */ n(
117
- "svg",
118
- {
119
- xmlns: "http://www.w3.org/2000/svg",
120
- viewBox: "0 0 24 24",
121
- fill: "none",
122
- stroke: "currentColor",
123
- strokeWidth: "2",
124
- strokeLinecap: "round",
125
- strokeLinejoin: "round",
126
- className: t,
127
- children: [
128
- /* @__PURE__ */ e("path", { d: "M18 6 6 18" }),
129
- /* @__PURE__ */ e("path", { d: "m6 6 12 12" })
130
- ]
131
- }
132
- );
133
- }
134
- function Ft({ className: t }) {
135
- return /* @__PURE__ */ n(
136
- "svg",
137
- {
138
- xmlns: "http://www.w3.org/2000/svg",
139
- viewBox: "0 0 24 24",
140
- fill: "none",
141
- stroke: "currentColor",
142
- strokeWidth: "2",
143
- strokeLinecap: "round",
144
- strokeLinejoin: "round",
145
- className: t,
146
- children: [
147
- /* @__PURE__ */ e("circle", { cx: "12", cy: "12", r: "10" }),
148
- /* @__PURE__ */ e("path", { d: "m4.9 4.9 14.2 14.2" })
149
- ]
150
- }
151
- );
152
- }
153
- function ze({ className: t }) {
154
- return /* @__PURE__ */ e(
155
- "svg",
156
- {
157
- xmlns: "http://www.w3.org/2000/svg",
158
- viewBox: "0 0 24 24",
159
- fill: "none",
160
- stroke: "currentColor",
161
- strokeWidth: "2",
162
- strokeLinecap: "round",
163
- strokeLinejoin: "round",
164
- className: t,
165
- children: /* @__PURE__ */ e("path", { d: "M20 6 9 17l-5-5" })
166
- }
167
- );
168
- }
169
- function $t({ className: t }) {
170
- return /* @__PURE__ */ n(
171
- "svg",
172
- {
173
- xmlns: "http://www.w3.org/2000/svg",
174
- viewBox: "0 0 24 24",
175
- fill: "none",
176
- stroke: "currentColor",
177
- strokeWidth: "2",
178
- strokeLinecap: "round",
179
- strokeLinejoin: "round",
180
- className: t,
181
- children: [
182
- /* @__PURE__ */ e("circle", { cx: "12", cy: "12", r: "10" }),
183
- /* @__PURE__ */ e("path", { d: "m9 12 2 2 4-4" })
184
- ]
185
- }
186
- );
187
- }
188
- function Pt({ className: t }) {
189
- return /* @__PURE__ */ e(
190
- "svg",
191
- {
192
- xmlns: "http://www.w3.org/2000/svg",
193
- viewBox: "0 0 24 24",
194
- fill: "none",
195
- stroke: "currentColor",
196
- strokeWidth: "2",
197
- strokeLinecap: "round",
198
- strokeLinejoin: "round",
199
- className: t,
200
- children: /* @__PURE__ */ e("path", { d: "m6 9 6 6 6-6" })
201
- }
202
- );
203
- }
204
- function Bt({ className: t }) {
205
- return /* @__PURE__ */ n(
206
- "svg",
207
- {
208
- xmlns: "http://www.w3.org/2000/svg",
209
- viewBox: "0 0 24 24",
210
- fill: "none",
211
- stroke: "currentColor",
212
- strokeWidth: "2",
213
- strokeLinecap: "round",
214
- strokeLinejoin: "round",
215
- className: t,
216
- children: [
217
- /* @__PURE__ */ e("path", { d: "M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2" }),
218
- /* @__PURE__ */ e("circle", { cx: "9", cy: "7", r: "4" }),
219
- /* @__PURE__ */ e("path", { d: "M22 21v-2a4 4 0 0 0-3-3.87" }),
220
- /* @__PURE__ */ e("path", { d: "M16 3.13a4 4 0 0 1 0 7.75" })
221
- ]
222
- }
223
- );
224
- }
225
- function Ot({ className: t }) {
226
- return /* @__PURE__ */ n(
227
- "svg",
228
- {
229
- xmlns: "http://www.w3.org/2000/svg",
230
- viewBox: "0 0 24 24",
231
- fill: "none",
232
- stroke: "currentColor",
233
- strokeWidth: "2",
234
- strokeLinecap: "round",
235
- strokeLinejoin: "round",
236
- className: t,
237
- children: [
238
- /* @__PURE__ */ e("path", { d: "M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0" }),
239
- /* @__PURE__ */ e("circle", { cx: "12", cy: "10", r: "3" })
240
- ]
241
- }
242
- );
243
- }
244
- function _t({ className: t }) {
245
- return /* @__PURE__ */ n(
246
- "svg",
247
- {
248
- xmlns: "http://www.w3.org/2000/svg",
249
- viewBox: "0 0 24 24",
250
- fill: "none",
251
- stroke: "currentColor",
252
- strokeWidth: "2",
253
- strokeLinecap: "round",
254
- strokeLinejoin: "round",
255
- className: t,
256
- children: [
257
- /* @__PURE__ */ e("path", { d: "M8 2v4" }),
258
- /* @__PURE__ */ e("path", { d: "M16 2v4" }),
259
- /* @__PURE__ */ e("rect", { width: "18", height: "18", x: "3", y: "4", rx: "2" }),
260
- /* @__PURE__ */ e("path", { d: "M3 10h18" })
261
- ]
262
- }
263
- );
264
- }
265
- function Rt({ className: t }) {
266
- return /* @__PURE__ */ n(
267
- "svg",
268
- {
269
- xmlns: "http://www.w3.org/2000/svg",
270
- viewBox: "0 0 24 24",
271
- fill: "none",
272
- stroke: "currentColor",
273
- strokeWidth: "2",
274
- strokeLinecap: "round",
275
- strokeLinejoin: "round",
276
- className: t,
277
- children: [
278
- /* @__PURE__ */ e("path", { d: "M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z" }),
279
- /* @__PURE__ */ e("path", { d: "M14 2v4a2 2 0 0 0 2 2h4" }),
280
- /* @__PURE__ */ e("path", { d: "M10 9H8" }),
281
- /* @__PURE__ */ e("path", { d: "M16 13H8" }),
282
- /* @__PURE__ */ e("path", { d: "M16 17H8" })
283
- ]
284
- }
285
- );
286
- }
287
- function Ne({ className: t }) {
288
- return /* @__PURE__ */ e(
289
- "svg",
290
- {
291
- xmlns: "http://www.w3.org/2000/svg",
292
- viewBox: "0 0 24 24",
293
- fill: "none",
294
- stroke: "currentColor",
295
- strokeWidth: "2",
296
- strokeLinecap: "round",
297
- strokeLinejoin: "round",
298
- className: m("animate-spin", t),
299
- children: /* @__PURE__ */ e("path", { d: "M21 12a9 9 0 1 1-6.219-8.56" })
300
- }
301
- );
302
- }
303
- const Vt = {
304
- edit: "Edit",
305
- delete: "Delete",
306
- cancel: "Cancel Event",
307
- close: "Close",
308
- going: "Going",
309
- notGoing: "Not Going",
310
- confirmMeeting: "Confirm meeting took place",
311
- completed: "Completed",
312
- canceled: "Canceled",
313
- participants: "Participants",
314
- guest: "guest",
315
- guests: "guests",
316
- confirmed: "confirmed",
317
- organizer: "Organizer",
318
- client: "Client",
319
- more: "more",
320
- noDateProvided: "No date provided",
321
- eventNotFound: "Event not found",
322
- cancellationNote: "Cancellation Note",
323
- canceledOn: "Canceled on",
324
- acceptThisEvent: "Accept this event only",
325
- acceptAllEvents: "Accept all events",
326
- deleteConfirmTitle: "Delete Event",
327
- deleteConfirmDescription: "Are you sure you want to delete this event? This action cannot be undone."
328
- }, Te = je(
329
- ({ onClick: t, label: r, children: o, className: a, variant: i = "ghost", ...l }, p) => /* @__PURE__ */ n(de, { children: [
330
- /* @__PURE__ */ e(ue, { asChild: !0, children: /* @__PURE__ */ e(
331
- "button",
332
- {
333
- type: "button",
334
- ref: p,
335
- onClick: t,
336
- className: m(
337
- "h-8 w-8 rounded-full flex items-center justify-center transition-colors",
338
- i === "ghost" && "hover:bg-zinc-100 dark:hover:bg-zinc-800 text-zinc-600 dark:text-zinc-400",
339
- i === "destructive" && "hover:bg-red-50 dark:hover:bg-red-950/30 text-zinc-600 dark:text-zinc-400 hover:text-red-600",
340
- a
341
- ),
342
- "aria-label": r,
343
- ...l,
344
- children: o
345
- }
346
- ) }),
347
- /* @__PURE__ */ e(he, { side: "bottom", className: "text-xs", children: r })
348
- ] })
349
- );
350
- Te.displayName = "IconButton";
351
- function Ut({ src: t, alt: r, initials: o, className: a, isClient: i }) {
352
- const [l, p] = se(!1);
353
- return /* @__PURE__ */ e(
354
- "div",
355
- {
356
- className: m(
357
- "relative h-7 w-7 rounded-full overflow-hidden shrink-0",
358
- a
359
- ),
360
- children: t && !l ? /* @__PURE__ */ e(
361
- "img",
362
- {
363
- src: t,
364
- alt: r,
365
- className: "h-full w-full object-cover",
366
- onError: () => p(!0)
367
- }
368
- ) : /* @__PURE__ */ e(
369
- "div",
370
- {
371
- className: m(
372
- "h-full w-full flex items-center justify-center text-[10px] font-medium",
373
- i ? "bg-amber-100 dark:bg-amber-900/30 text-amber-700 dark:text-amber-300" : "bg-zinc-200 dark:bg-zinc-700 text-zinc-700 dark:text-zinc-300"
374
- ),
375
- children: o
376
- }
377
- )
378
- }
379
- );
380
- }
381
- function Ue({
382
- participant: t,
383
- isEventCanceled: r = !1,
384
- labels: o
385
- }) {
386
- const a = t.name || "Unknown", i = a.split(" ").map((L) => L[0]).join("").toUpperCase().slice(0, 2), l = t.isOrganizer ?? !1, p = t.isConfirmed, f = p === !0, d = p === !1, x = t.isClient ?? !1, y = t.profilePicture || t.avatar, v = r;
387
- return /* @__PURE__ */ n(
388
- "div",
389
- {
390
- className: m(
391
- "flex items-center gap-3 py-0",
392
- v && "opacity-60"
393
- ),
394
- children: [
395
- /* @__PURE__ */ n("div", { className: "relative", children: [
396
- /* @__PURE__ */ e(
397
- Ut,
398
- {
399
- src: y,
400
- alt: a,
401
- initials: i,
402
- isClient: x,
403
- className: m(v && "grayscale")
404
- }
405
- ),
406
- v || d ? /* @__PURE__ */ e("div", { className: "absolute -bottom-0.5 -right-0.5 h-3.5 w-3.5 rounded-full bg-white dark:bg-zinc-900 flex items-center justify-center", children: /* @__PURE__ */ e("div", { className: "h-3 w-3 rounded-full bg-red-100 dark:bg-red-900/50 flex items-center justify-center", children: /* @__PURE__ */ e(He, { className: "h-2 w-2 text-red-600 dark:text-red-400 stroke-[3]" }) }) }) : f ? /* @__PURE__ */ e("div", { className: "absolute -bottom-0.5 -right-0.5 h-3.5 w-3.5 rounded-full bg-white dark:bg-zinc-900 flex items-center justify-center", children: /* @__PURE__ */ e("div", { className: "h-3 w-3 rounded-full bg-green-100 dark:bg-green-900/50 flex items-center justify-center", children: /* @__PURE__ */ e(ze, { className: "h-2 w-2 text-green-600 dark:text-green-400 stroke-[3]" }) }) }) : null
407
- ] }),
408
- /* @__PURE__ */ n("div", { className: "!h-fit min-w-0 gap-0", children: [
409
- /* @__PURE__ */ e("div", { className: "gap-0", children: /* @__PURE__ */ e(
410
- "span",
411
- {
412
- className: m(
413
- "text-sm text-zinc-900 dark:text-zinc-100 truncate",
414
- v && "line-through text-zinc-500 dark:text-zinc-500"
415
- ),
416
- children: a
417
- }
418
- ) }),
419
- x && /* @__PURE__ */ e("div", { className: "text-[10px] px-1.5 w-fit py-0.5 rounded bg-amber-100 dark:bg-amber-900/30 text-amber-700 dark:text-amber-300 font-medium", children: o.client }),
420
- l && !v && /* @__PURE__ */ e("div", { className: "text-xs text-zinc-500", children: o.organizer })
421
- ] })
422
- ]
423
- }
424
- );
425
- }
426
- function Yt({
427
- open: t,
428
- onOpenChange: r,
429
- title: o,
430
- children: a
431
- }) {
432
- return be(() => {
433
- if (!t) return;
434
- const i = (l) => {
435
- l.key === "Escape" && r(!1);
436
- };
437
- return document.addEventListener("keydown", i), () => document.removeEventListener("keydown", i);
438
- }, [t, r]), be(() => (t ? document.body.style.overflow = "hidden" : document.body.style.overflow = "", () => {
439
- document.body.style.overflow = "";
440
- }), [t]), t ? /* @__PURE__ */ n("div", { className: "fixed inset-0 z-50", children: [
441
- /* @__PURE__ */ e(
442
- "div",
443
- {
444
- className: "fixed inset-0 bg-black/50 backdrop-blur-sm",
445
- onClick: () => r(!1),
446
- onKeyDown: (i) => {
447
- (i.key === "Enter" || i.key === " ") && r(!1);
448
- }
449
- }
450
- ),
451
- /* @__PURE__ */ e("div", { className: "fixed inset-x-4 top-[50%] translate-y-[-50%] max-w-md mx-auto", children: /* @__PURE__ */ n("div", { className: "bg-white dark:bg-zinc-900 rounded-2xl shadow-xl overflow-hidden", children: [
452
- o && /* @__PURE__ */ e("div", { className: "sr-only", children: o }),
453
- a
454
- ] }) })
455
- ] }) : null;
456
- }
457
- function Gt({
458
- open: t,
459
- onOpenChange: r,
460
- title: o,
461
- description: a,
462
- cancelLabel: i,
463
- confirmLabel: l,
464
- onConfirm: p,
465
- isLoading: f
466
- }) {
467
- return t ? /* @__PURE__ */ n("div", { className: "fixed inset-0 z-[60]", children: [
468
- /* @__PURE__ */ e(
469
- "div",
470
- {
471
- className: "fixed inset-0 bg-black/50 backdrop-blur-sm",
472
- onClick: () => r(!1),
473
- onKeyDown: (d) => {
474
- (d.key === "Enter" || d.key === " ") && r(!1);
475
- }
476
- }
477
- ),
478
- /* @__PURE__ */ e("div", { className: "fixed inset-x-4 top-[50%] translate-y-[-50%] max-w-md mx-auto", children: /* @__PURE__ */ n("div", { className: "bg-white dark:bg-zinc-900 rounded-lg shadow-xl p-6", children: [
479
- /* @__PURE__ */ e("h2", { className: "text-lg font-semibold text-zinc-900 dark:text-zinc-100", children: o }),
480
- /* @__PURE__ */ e("p", { className: "mt-2 text-sm text-zinc-600 dark:text-zinc-400", children: a }),
481
- /* @__PURE__ */ n("div", { className: "mt-4 flex justify-end gap-3", children: [
482
- /* @__PURE__ */ e(
483
- we,
484
- {
485
- variant: "outline",
486
- size: "sm",
487
- onClick: () => r(!1),
488
- children: i
489
- }
490
- ),
491
- /* @__PURE__ */ n(
492
- we,
493
- {
494
- variant: "destructive",
495
- size: "sm",
496
- onClick: p,
497
- disabled: f,
498
- children: [
499
- f && /* @__PURE__ */ e(Ne, { className: "h-4 w-4 mr-2" }),
500
- /* @__PURE__ */ e(dt, { className: "h-4 w-4 mr-2" }),
501
- l
502
- ]
503
- }
504
- )
505
- ] })
506
- ] }) })
507
- ] }) : null;
508
- }
509
- function Kt(t, r) {
510
- return t.toLocaleDateString(void 0, {
511
- weekday: "long",
512
- month: "long",
513
- day: "numeric"
514
- });
515
- }
516
- function qt(t, r) {
517
- const o = {
518
- hour: "2-digit",
519
- minute: "2-digit",
520
- hour12: !1
521
- };
522
- return `${t.toLocaleTimeString(void 0, o)} – ${r.toLocaleTimeString(void 0, o)}`;
523
- }
524
- function Jt(t) {
525
- return t.toLocaleDateString(void 0, {
526
- day: "2-digit",
527
- month: "short",
528
- year: "numeric",
529
- hour: "2-digit",
530
- minute: "2-digit"
531
- });
532
- }
533
- function Xt(t) {
534
- const [r, o] = se(() => typeof window < "u" ? window.matchMedia(t).matches : !1);
535
- return be(() => {
536
- if (typeof window > "u") return;
537
- const a = window.matchMedia(t), i = (l) => o(l.matches);
538
- return a.addEventListener("change", i), () => a.removeEventListener("change", i);
539
- }, [t]), r;
540
- }
541
- function Ye({
542
- event: t,
543
- labels: r,
544
- isLoading: o,
545
- onClose: a,
546
- onEdit: i,
547
- onDelete: l,
548
- onCancel: p,
549
- onAccept: f,
550
- onDecline: d,
551
- onConfirmMeeting: x,
552
- canEdit: y = !0,
553
- canDelete: v = !1,
554
- canCancel: L = !0,
555
- isCurrentUserParticipant: F = !1,
556
- isCurrentUserClient: I = !1,
557
- currentUserAcceptStatus: W,
558
- isAcceptLoading: E = !1,
559
- isDeclineLoading: N = !1,
560
- isConfirmLoading: j = !1,
561
- isDeleteLoading: B = !1,
562
- renderParticipant: O,
563
- renderHeaderActions: C,
564
- renderCancelReason: K,
565
- renderDeleteConfirmation: H,
566
- formatDate: T = Kt,
567
- formatTimeRange: _ = qt
568
- }) {
569
- const [q, R] = se(!1), A = !(t.isCanceled || t.meetingTookPlace), u = t.isRecurring ?? !1, k = t.participantDetails, $ = t.participantsNames || [], P = k && k.length > 0, z = W === !0, re = W === !1, X = F && !I && A, Ce = P ? k.filter((Q) => Q.isConfirmed).length : t.isAccepted ? $.length : 0, ee = P ? k.length : $.length, J = t.scheduleTypeColor || t.hexColor || "#039BE5", ye = Y(() => t.startDate ? T(t.startDate) : r.noDateProvided, [t.startDate, T, r.noDateProvided]), ne = Y(() => t.startDate && t.endDate ? _(t.startDate, t.endDate) : null, [t.startDate, t.endDate, _]), ae = () => {
570
- a(), i?.(t);
571
- }, De = () => {
572
- a(), p?.(t);
573
- }, fe = () => {
574
- R(!0);
575
- }, ke = () => {
576
- l?.(t), R(!1);
577
- };
578
- return o ? /* @__PURE__ */ e("div", { className: "flex h-48 items-center justify-center", children: /* @__PURE__ */ e(Ne, { className: "h-6 w-6 text-zinc-400" }) }) : /* @__PURE__ */ n(ce, { delayDuration: 300, children: [
579
- /* @__PURE__ */ n("div", { className: "flex flex-col gap-0.5 p-3", children: [
580
- /* @__PURE__ */ e("div", { className: "flex items-start justify-end gap-0.5", children: C ? C({ onClose: a }) : /* @__PURE__ */ n(ge, { children: [
581
- A && y && i && /* @__PURE__ */ e(Te, { onClick: ae, label: r.edit, children: /* @__PURE__ */ e(At, { className: "h-[18px] w-[18px]" }) }),
582
- A && L && p && /* @__PURE__ */ e(Te, { onClick: De, label: r.cancel, children: /* @__PURE__ */ e(Ft, { className: "h-[18px] w-[18px]" }) }),
583
- v && l && /* @__PURE__ */ e(
584
- Te,
585
- {
586
- onClick: fe,
587
- label: r.delete,
588
- variant: "destructive",
589
- children: /* @__PURE__ */ e(dt, { className: "h-[18px] w-[18px]" })
590
- }
591
- ),
592
- /* @__PURE__ */ e(Te, { onClick: a, label: r.close, children: /* @__PURE__ */ e(He, { className: "h-[18px] w-[18px]" }) })
593
- ] }) }),
594
- /* @__PURE__ */ e("div", { children: /* @__PURE__ */ n("div", { className: "flex items-start gap-2", children: [
595
- /* @__PURE__ */ e(
596
- "div",
597
- {
598
- className: "w-4 h-4 rounded mt-1 shrink-0",
599
- style: { backgroundColor: J }
600
- }
601
- ),
602
- /* @__PURE__ */ n("div", { className: "flex-1 min-w-0", children: [
603
- /* @__PURE__ */ n("div", { className: "flex items-center gap-2 flex-wrap", children: [
604
- /* @__PURE__ */ e(
605
- "h2",
606
- {
607
- className: m(
608
- "text-[22px] font-normal text-zinc-900 dark:text-zinc-100 leading-tight",
609
- t.isCanceled && "line-through opacity-60"
610
- ),
611
- children: t.title
612
- }
613
- ),
614
- t.meetingTookPlace && /* @__PURE__ */ n("span", { className: "inline-flex items-center gap-1 px-2 py-0.5 rounded-full bg-green-100 dark:bg-green-900/30 text-green-700 dark:text-green-400 text-xs font-medium", children: [
615
- /* @__PURE__ */ e($t, { className: "h-3 w-3" }),
616
- r.completed
617
- ] }),
618
- t.isCanceled && /* @__PURE__ */ n("span", { className: "inline-flex items-center gap-1 px-2 py-0.5 rounded-full bg-red-100 dark:bg-red-900/30 text-red-700 dark:text-red-400 text-xs font-medium", children: [
619
- /* @__PURE__ */ e(He, { className: "h-3 w-3" }),
620
- r.canceled
621
- ] })
622
- ] }),
623
- /* @__PURE__ */ n("div", { className: "mt-1 text-sm text-zinc-600 dark:text-zinc-400", children: [
624
- /* @__PURE__ */ e("span", { children: ye() }),
625
- ne() && /* @__PURE__ */ n(ge, { children: [
626
- /* @__PURE__ */ e("span", { className: "mx-1.5", children: "·" }),
627
- /* @__PURE__ */ e("span", { children: ne() })
628
- ] })
629
- ] }),
630
- u && t.recurrenceSummary && /* @__PURE__ */ e("div", { className: "text-sm text-zinc-500 dark:text-zinc-500", children: t.recurrenceSummary })
631
- ] })
632
- ] }) }),
633
- t.isCanceled && /* @__PURE__ */ e("div", { className: "mx-4 p-3 rounded-lg bg-red-50 dark:bg-red-950/30", children: K ? K(t) : /* @__PURE__ */ e("div", { className: "flex items-start gap-0", children: /* @__PURE__ */ n("div", { className: "flex-1 min-w-0", children: [
634
- /* @__PURE__ */ e("div", { className: "text-sm font-medium text-red-700 dark:text-red-400", children: r.cancellationNote }),
635
- t.cancelReason && /* @__PURE__ */ n("div", { className: "mt-1 text-sm text-red-600/80 dark:text-red-400/80 italic", children: [
636
- '"',
637
- t.cancelReason,
638
- '"'
639
- ] }),
640
- t.canceledDate && /* @__PURE__ */ n("div", { className: "mt-1.5 text-xs text-red-500/70 dark:text-red-400/60", children: [
641
- r.canceledOn,
642
- " ",
643
- Jt(t.canceledDate)
644
- ] })
645
- ] }) }) }),
646
- /* @__PURE__ */ n("div", { className: "space-y-0.5", children: [
647
- t.address && /* @__PURE__ */ n("div", { className: "flex items-start gap-2", children: [
648
- /* @__PURE__ */ e(Ot, { className: "h-5 w-5 text-zinc-400 mt-0.5 shrink-0" }),
649
- /* @__PURE__ */ e("span", { className: "text-sm text-zinc-700 dark:text-zinc-300", children: t.address })
650
- ] }),
651
- (P || $.length > 0) && /* @__PURE__ */ n("div", { className: "flex items-start gap-2 py-0", children: [
652
- /* @__PURE__ */ e(Bt, { className: "h-5 w-5 text-zinc-400 mt-0.5 shrink-0" }),
653
- /* @__PURE__ */ n("div", { className: "flex-1", children: [
654
- /* @__PURE__ */ n("div", { className: "flex items-center gap-0", children: [
655
- /* @__PURE__ */ n("span", { className: "text-sm text-zinc-900 dark:text-zinc-100 font-medium", children: [
656
- ee,
657
- " ",
658
- ee !== 1 ? r.guests : r.guest
659
- ] }),
660
- ee > 0 && /* @__PURE__ */ n("span", { className: "text-xs text-zinc-500", children: [
661
- "(",
662
- Ce,
663
- " ",
664
- r.confirmed,
665
- ")"
666
- ] })
667
- ] }),
668
- /* @__PURE__ */ n("div", { className: "mt-2 space-y-2", children: [
669
- P ? k.slice(0, 6).map(
670
- (Q, ie) => O ? O(Q, ie) : /* @__PURE__ */ e(
671
- Ue,
672
- {
673
- participant: Q,
674
- isEventCanceled: t.isCanceled,
675
- labels: r
676
- },
677
- Q.id
678
- )
679
- ) : $.slice(0, 6).map((Q, ie) => {
680
- const h = {
681
- id: String(ie),
682
- name: Q,
683
- email: "",
684
- isConfirmed: t.isAccepted,
685
- isOrganizer: ie === 0,
686
- isClient: !1
687
- };
688
- return O ? O(h, ie) : /* @__PURE__ */ e(
689
- Ue,
690
- {
691
- participant: h,
692
- isEventCanceled: t.isCanceled,
693
- labels: r
694
- },
695
- Q
696
- );
697
- }),
698
- ee > 6 && /* @__PURE__ */ n("div", { className: "text-xs text-zinc-500 py-1.5 pl-10", children: [
699
- "+",
700
- ee - 6,
701
- " ",
702
- r.more
703
- ] })
704
- ] })
705
- ] })
706
- ] }),
707
- t.description && /* @__PURE__ */ n("div", { className: "flex items-start gap-2", children: [
708
- /* @__PURE__ */ e(Rt, { className: "h-5 w-5 text-zinc-400 mt-0.5 shrink-0" }),
709
- /* @__PURE__ */ e("p", { className: "text-sm text-zinc-700 dark:text-zinc-300 whitespace-pre-wrap", children: t.description })
710
- ] }),
711
- /* @__PURE__ */ n("div", { className: "flex items-start gap-2", children: [
712
- /* @__PURE__ */ e(_t, { className: "h-5 w-5 text-zinc-400 mt-0.5 shrink-0" }),
713
- /* @__PURE__ */ e("div", { className: "text-sm text-zinc-700 dark:text-zinc-300", children: P && k.find((Q) => Q.isOrganizer)?.name || $[0] || "Calendar" })
714
- ] })
715
- ] }),
716
- X && f && d && /* @__PURE__ */ e("div", { className: "border-t border-zinc-100 dark:border-zinc-800 mt-3 py-3", children: /* @__PURE__ */ n("div", { className: "flex items-center gap-2", children: [
717
- u ? /* @__PURE__ */ n(xt, { children: [
718
- /* @__PURE__ */ e(vt, { asChild: !0, children: /* @__PURE__ */ n("div", { className: "flex", children: [
719
- /* @__PURE__ */ e(
720
- we,
721
- {
722
- size: "sm",
723
- variant: "outline",
724
- className: m(
725
- "rounded-r-none gap-1.5 h-8 !border-none !bg-green-100 text-green-800 hover:!bg-green-200",
726
- z && "!bg-green-700 !text-white hover:!bg-green-700"
727
- ),
728
- onClick: (Q) => {
729
- Q.stopPropagation(), z || f(t);
730
- },
731
- disabled: E,
732
- children: E ? /* @__PURE__ */ e(Ne, { className: "h-3.5 w-3.5" }) : /* @__PURE__ */ n(ge, { children: [
733
- z && /* @__PURE__ */ e(ze, { className: "h-3.5 w-3.5" }),
734
- r.going
735
- ] })
736
- }
737
- ),
738
- /* @__PURE__ */ e(
739
- we,
740
- {
741
- size: "sm",
742
- variant: "outline",
743
- className: m(
744
- "rounded-l-none px-1.5 h-8 !border-none !bg-green-100 text-green-800 hover:!bg-green-200",
745
- z && "!bg-green-700 !text-white hover:!bg-green-700"
746
- ),
747
- children: /* @__PURE__ */ e(Pt, { className: "h-3.5 w-3.5" })
748
- }
749
- )
750
- ] }) }),
751
- /* @__PURE__ */ n(wt, { align: "start", children: [
752
- /* @__PURE__ */ n(
753
- _e,
754
- {
755
- className: m(
756
- "gap-1.5 h-8 !border-none !bg-green-50 text-green-800 hover:!bg-green-100",
757
- z && "!bg-green-700 !text-white hover:!bg-green-700"
758
- ),
759
- onClick: () => f(t),
760
- children: [
761
- /* @__PURE__ */ e(ze, { className: "h-3.5 w-3.5 mr-2 text-green-600" }),
762
- r.acceptThisEvent
763
- ]
764
- }
765
- ),
766
- /* @__PURE__ */ n(_e, { onClick: () => f(t), children: [
767
- /* @__PURE__ */ e(ze, { className: "h-3.5 w-3.5 mr-2 text-green-600" }),
768
- r.acceptAllEvents
769
- ] })
770
- ] })
771
- ] }) : /* @__PURE__ */ e(
772
- we,
773
- {
774
- size: "sm",
775
- variant: "outline",
776
- className: m(
777
- "gap-1.5 h-8 !border-none !bg-green-100 text-green-800 hover:!bg-green-200",
778
- z && "!bg-green-700 !text-white hover:!bg-green-700"
779
- ),
780
- onClick: () => {
781
- z || f(t);
782
- },
783
- disabled: E,
784
- children: E ? /* @__PURE__ */ e(Ne, { className: "h-3.5 w-3.5" }) : /* @__PURE__ */ n(ge, { children: [
785
- z && /* @__PURE__ */ e(ze, { className: "h-3.5 w-3.5" }),
786
- r.going
787
- ] })
788
- }
789
- ),
790
- /* @__PURE__ */ e(
791
- we,
792
- {
793
- size: "sm",
794
- variant: "outline",
795
- className: m(
796
- "gap-1.5 h-8 !border-none !bg-rose-100 text-rose-800 hover:!bg-rose-200",
797
- re && "!bg-rose-700 !text-white hover:!bg-rose-700"
798
- ),
799
- onClick: () => {
800
- re || d(t);
801
- },
802
- disabled: N,
803
- children: N ? /* @__PURE__ */ e(Ne, { className: "h-3.5 w-3.5" }) : /* @__PURE__ */ n(ge, { children: [
804
- re && /* @__PURE__ */ e(He, { className: "h-3.5 w-3.5" }),
805
- r.notGoing
806
- ] })
807
- }
808
- )
809
- ] }) }),
810
- F && z && !t.meetingTookPlace && !t.isCanceled && x && /* @__PURE__ */ e("div", { className: "border-t border-zinc-100 dark:border-zinc-800 py-3", children: /* @__PURE__ */ n(
811
- we,
812
- {
813
- size: "sm",
814
- variant: "outline",
815
- className: "w-full h-9 hover:!bg-green-100 hover:text-green-700 text-green-700 !bg-green-100 !border-none dark:text-green-400 dark:hover:bg-green-950/30",
816
- onClick: () => x(t),
817
- disabled: j,
818
- children: [
819
- j && /* @__PURE__ */ e(Ne, { className: "h-4 w-4 mr-2" }),
820
- r.confirmMeeting
821
- ]
822
- }
823
- ) })
824
- ] }),
825
- H ? q && H({
826
- onConfirm: ke,
827
- onCancel: () => R(!1),
828
- isLoading: B
829
- }) : /* @__PURE__ */ e(
830
- Gt,
831
- {
832
- open: q,
833
- onOpenChange: R,
834
- title: r.deleteConfirmTitle,
835
- description: r.deleteConfirmDescription,
836
- cancelLabel: r.cancel,
837
- confirmLabel: r.delete,
838
- onConfirm: ke,
839
- isLoading: B
840
- }
841
- )
842
- ] });
843
- }
844
- function un({
845
- event: t,
846
- children: r,
847
- open: o,
848
- onOpenChange: a,
849
- isLoading: i,
850
- labels: l,
851
- onEdit: p,
852
- onDelete: f,
853
- onCancel: d,
854
- onAccept: x,
855
- onDecline: y,
856
- onConfirmMeeting: v,
857
- canEdit: L = !0,
858
- canDelete: F = !1,
859
- canCancel: I = !0,
860
- isCurrentUserParticipant: W,
861
- isCurrentUserClient: E,
862
- currentUserAcceptStatus: N,
863
- isAcceptLoading: j,
864
- isDeclineLoading: B,
865
- isConfirmLoading: O,
866
- isDeleteLoading: C,
867
- renderParticipant: K,
868
- renderHeaderActions: H,
869
- renderCancelReason: T,
870
- renderDeleteConfirmation: _,
871
- formatDate: q,
872
- formatTimeRange: R,
873
- className: A,
874
- width: u = 360
875
- }) {
876
- const k = Xt("(min-width: 768px)"), $ = { ...Vt, ...l }, P = Y(() => {
877
- a?.(!1);
878
- }, [a]), z = {
879
- event: t,
880
- labels: $,
881
- isLoading: i,
882
- onClose: P,
883
- onEdit: p,
884
- onDelete: f,
885
- onCancel: d,
886
- onAccept: x,
887
- onDecline: y,
888
- onConfirmMeeting: v,
889
- canEdit: L,
890
- canDelete: F,
891
- canCancel: I,
892
- isCurrentUserParticipant: W,
893
- isCurrentUserClient: E,
894
- currentUserAcceptStatus: N,
895
- isAcceptLoading: j,
896
- isDeclineLoading: B,
897
- isConfirmLoading: O,
898
- isDeleteLoading: C,
899
- renderParticipant: K,
900
- renderHeaderActions: H,
901
- renderCancelReason: T,
902
- renderDeleteConfirmation: _,
903
- formatDate: q,
904
- formatTimeRange: R
905
- };
906
- return k ? /* @__PURE__ */ n(st, { open: o ?? !1, onOpenChange: a ?? (() => {
907
- }), children: [
908
- /* @__PURE__ */ e(at, { asChild: !0, children: r }),
909
- /* @__PURE__ */ e(
910
- it,
911
- {
912
- className: m(
913
- "p-0 shadow-lg !rounded-2xl bg-white dark:bg-zinc-900 overflow-hidden border z-50",
914
- A
915
- ),
916
- style: { width: u },
917
- align: "center",
918
- side: "bottom",
919
- sideOffset: 4,
920
- children: /* @__PURE__ */ e(Ye, { ...z })
921
- }
922
- )
923
- ] }) : /* @__PURE__ */ n(ge, { children: [
924
- r,
925
- /* @__PURE__ */ e(
926
- Yt,
927
- {
928
- open: o ?? !1,
929
- onOpenChange: a ?? (() => {
930
- }),
931
- title: t.title,
932
- children: /* @__PURE__ */ e(Ye, { ...z })
933
- }
934
- )
935
- ] });
936
- }
937
- const Ae = 44, Ge = 4, Qt = 56, Ke = 8, Le = 80, Se = 140, qe = 100, Je = 2, Zt = 8, er = 18;
938
- function tr(t) {
939
- return t.split(" ").map((r) => r[0]).join("").toUpperCase().slice(0, 2);
940
- }
941
- function rr(t, r) {
942
- const o = [];
943
- for (let a = 0; a < r; a++) {
944
- const i = new Date(t);
945
- i.setDate(i.getDate() + a), o.push(i);
946
- }
947
- return o;
948
- }
949
- function nr(t, r, o) {
950
- const a = [];
951
- return t.forEach((i, l) => {
952
- for (let p = r; p < o; p++)
953
- a.push({ hour: p, dayIndex: l, date: i });
954
- }), a;
955
- }
956
- function Fe(t) {
957
- return `${t.toString().padStart(2, "0")}:00`;
958
- }
959
- function or(t) {
960
- return t.toLocaleDateString("en-US", {
961
- weekday: "short",
962
- month: "short",
963
- day: "numeric"
964
- });
965
- }
966
- function Xe(t) {
967
- const r = [...t].sort((i, l) => i.startCol !== l.startCol ? i.startCol - l.startCol : l.spanCols - i.spanCols), o = [], a = [];
968
- for (const i of r) {
969
- let l = 0;
970
- for (; a[l] !== void 0 && a[l] > i.startCol; )
971
- l++;
972
- a[l] = i.startCol + i.spanCols, o.push({
973
- ...i,
974
- stackIndex: l
975
- });
976
- }
977
- return o;
978
- }
979
- function sr({ src: t, alt: r, fallback: o, className: a }) {
980
- return /* @__PURE__ */ e(
981
- "div",
982
- {
983
- className: m(
984
- "relative flex shrink-0 overflow-hidden rounded-sm border bg-muted",
985
- a
986
- ),
987
- children: t ? /* @__PURE__ */ e(
988
- "img",
989
- {
990
- src: t,
991
- alt: r,
992
- className: "aspect-square h-full w-full object-cover"
993
- }
994
- ) : /* @__PURE__ */ e("div", { className: "flex h-full w-full items-center justify-center bg-muted text-muted-foreground", children: o })
995
- }
996
- );
997
- }
998
- const ar = 7;
999
- function Ee({
1000
- daysToShow: t = ar,
1001
- events: r,
1002
- users: o = [],
1003
- selectedDate: a,
1004
- onDateChange: i,
1005
- onEventClick: l,
1006
- onSlotClick: p,
1007
- onSlotSelect: f,
1008
- visibleHours: d,
1009
- className: x,
1010
- getEventUserId: y,
1011
- renderPopover: v,
1012
- slots: L,
1013
- classNames: F,
1014
- enableDrag: I = !0
1015
- }) {
1016
- const W = Ie(null), E = Mt(), [N, j] = se(null), B = Ie(!1), [O, C] = se(null), K = a ?? /* @__PURE__ */ new Date(), H = !0, T = d?.from ?? Zt, _ = d?.to ?? er, q = _ - T, R = G(() => {
1017
- const s = new Date(K);
1018
- if (t === 1 || t === 3)
1019
- return s.setHours(0, 0, 0, 0), s;
1020
- const c = s.getDay(), g = c === 0 ? -6 : 1 - c;
1021
- return s.setDate(s.getDate() + g), s.setHours(0, 0, 0, 0), s;
1022
- }, [K, t]), A = G(
1023
- () => rr(R, t),
1024
- [R, t]
1025
- ), u = G(
1026
- () => nr(A, T, _),
1027
- [H, A, T, _]
1028
- ), $ = y ?? ((s) => {
1029
- if (s.resourceId) return s.resourceId;
1030
- const c = s.data;
1031
- if (c?.userId) return String(c.userId);
1032
- if (c?.user && typeof c.user == "object" && c.user.id)
1033
- return String(c.user.id);
1034
- if (s.user?.id) return s.user.id;
1035
- if (s.participants?.[0]?.id) return s.participants[0].id;
1036
- }), P = G(() => {
1037
- const s = /* @__PURE__ */ new Map();
1038
- for (const c of o)
1039
- s.set(c.id, {
1040
- id: c.id,
1041
- name: c.name,
1042
- avatar: c.avatar ?? void 0,
1043
- email: c.email
1044
- });
1045
- for (const c of r) {
1046
- const w = c.data?.user;
1047
- w?.id && !s.has(w.id) && s.set(w.id, {
1048
- id: w.id,
1049
- name: w.name ?? "",
1050
- avatar: w.avatar ?? void 0,
1051
- email: w.email
1052
- }), c.user?.id && !s.has(c.user.id) && s.set(c.user.id, {
1053
- id: c.user.id,
1054
- name: c.user.name,
1055
- avatar: c.user.avatar ?? void 0,
1056
- email: c.user.email
1057
- });
1058
- for (const b of c.participants || [])
1059
- b.id && !s.has(b.id) && s.set(b.id, {
1060
- id: b.id,
1061
- name: b.name,
1062
- avatar: b.avatar ?? void 0,
1063
- email: b.email
1064
- });
1065
- }
1066
- return Array.from(s.values());
1067
- }, [o, r]), z = G(() => {
1068
- const s = [], c = /* @__PURE__ */ new Map();
1069
- for (const b of P)
1070
- c.set(b.id, []);
1071
- c.set("unassigned", []);
1072
- for (const b of r) {
1073
- const M = $(b) ?? "unassigned";
1074
- (c.get(M) ?? c.get("unassigned")).push(b);
1075
- }
1076
- const g = (b) => {
1077
- const M = [];
1078
- for (const S of b) {
1079
- const V = S.startDate.getHours() + S.startDate.getMinutes() / 60, Z = S.endDate.getHours() + S.endDate.getMinutes() / 60;
1080
- for (let U = 0; U < A.length; U++) {
1081
- const te = A[U], pe = We(te), xe = lt(te);
1082
- if (S.startDate <= xe && S.endDate >= pe) {
1083
- let ve = T, Me = _;
1084
- if (S.startDate >= pe && (ve = Math.max(T, V)), S.endDate <= xe && (Me = Math.min(_, Z)), ve = Math.max(
1085
- T,
1086
- Math.min(_, ve)
1087
- ), Me = Math.max(
1088
- T,
1089
- Math.min(_, Me)
1090
- ), Me > ve) {
1091
- const Oe = U * q + Math.floor(ve - T), ht = U * q + Math.ceil(Me - T);
1092
- M.push({
1093
- event: S,
1094
- startCol: Oe,
1095
- spanCols: Math.max(1, ht - Oe)
1096
- });
1097
- }
1098
- }
1099
- }
1100
- }
1101
- return M;
1102
- };
1103
- for (const b of P) {
1104
- const M = c.get(b.id) ?? [], S = g(M), V = Xe(S), Z = V.reduce(
1105
- (U, te) => Math.max(U, te.stackIndex + 1),
1106
- 0
1107
- );
1108
- s.push({
1109
- user: b,
1110
- events: V,
1111
- maxStack: Math.max(Z, 1)
1112
- });
1113
- }
1114
- const w = c.get("unassigned") ?? [];
1115
- if (w.length > 0) {
1116
- const b = g(w), M = Xe(b), S = M.reduce(
1117
- (V, Z) => Math.max(V, Z.stackIndex + 1),
1118
- 0
1119
- );
1120
- s.push({
1121
- user: {
1122
- id: "unassigned",
1123
- name: "Unassigned",
1124
- avatar: void 0,
1125
- email: void 0
1126
- },
1127
- events: M,
1128
- maxStack: Math.max(S, 1)
1129
- });
1130
- }
1131
- return s.filter((b) => b.events.length > 0);
1132
- }, [
1133
- P,
1134
- r,
1135
- A,
1136
- H,
1137
- q,
1138
- T,
1139
- _,
1140
- $
1141
- ]), re = G(() => {
1142
- const s = /* @__PURE__ */ new Map();
1143
- for (const c of z)
1144
- for (const g of c.events)
1145
- if (g.spanCols === 1) {
1146
- const w = s.get(g.startCol) ?? 0;
1147
- s.set(g.startCol, w + 1);
1148
- }
1149
- return s;
1150
- }, [z]), X = G(() => {
1151
- const s = u.length, c = Le, g = [];
1152
- for (let w = 0; w < s; w++) {
1153
- const b = re.get(w) ?? 0;
1154
- b > Je ? g.push(
1155
- qe + (b - Je) * 20
1156
- ) : b > 0 ? g.push(Math.max(c, qe)) : g.push(c);
1157
- }
1158
- return g;
1159
- }, [
1160
- H,
1161
- u.length,
1162
- A.length,
1163
- re
1164
- ]), Ce = (s) => Math.max(
1165
- Qt,
1166
- s * (Ae + Ge) + Ke * 2
1167
- ), ee = Se + X.reduce((s, c) => s + c, 0), J = G(() => {
1168
- const s = [0];
1169
- for (let c = 0; c < X.length; c++)
1170
- s.push(s[c] + X[c]);
1171
- return s;
1172
- }, [X]);
1173
- gt(() => {
1174
- const s = W.current;
1175
- if (!s) return;
1176
- const c = () => {
1177
- let g = -1;
1178
- const b = (/* @__PURE__ */ new Date()).getHours();
1179
- {
1180
- for (let M = 0; M < u.length; M++) {
1181
- const S = u[M];
1182
- if (S && oe(S.date) && S.hour <= b && S.hour + 1 > b) {
1183
- g = M;
1184
- break;
1185
- }
1186
- }
1187
- if (g === -1)
1188
- for (let M = 0; M < u.length; M++) {
1189
- const S = u[M];
1190
- if (S && oe(S.date)) {
1191
- g = M;
1192
- break;
1193
- }
1194
- }
1195
- }
1196
- if (g !== -1) {
1197
- const M = (J[g] ?? 0) + Se, S = s.clientWidth, V = Math.max(0, M - S / 3);
1198
- s.scrollTo({
1199
- left: V,
1200
- behavior: "instant"
1201
- });
1202
- }
1203
- };
1204
- requestAnimationFrame(() => {
1205
- requestAnimationFrame(c);
1206
- });
1207
- }, [K, u, A, J, H]);
1208
- const ye = Y(
1209
- (s, c) => {
1210
- const g = c.getBoundingClientRect(), w = s - g.left + c.scrollLeft;
1211
- for (let b = 0; b < J.length - 1; b++) {
1212
- const M = J[b], S = J[b + 1];
1213
- if (w >= M && w < S) {
1214
- const V = (w - M) / (S - M), Z = Math.floor(V * 60), U = Math.round(Z / 15) * 15;
1215
- return { colIndex: b, minute: Math.min(U, 45) };
1216
- }
1217
- }
1218
- return null;
1219
- },
1220
- [J]
1221
- ), ne = Y(
1222
- (s, c) => {
1223
- if (u[s]) {
1224
- const g = u[s], w = new Date(g.date);
1225
- return w.setHours(g.hour, c ?? 0, 0, 0), { date: w, hour: g.hour };
1226
- }
1227
- return { date: /* @__PURE__ */ new Date() };
1228
- },
1229
- [H, u, A]
1230
- ), ae = Y(
1231
- (s, c) => {
1232
- if (s.preventDefault(), s.dataTransfer.dropEffect = "move", !E?.isDragging || !E.dragState) return;
1233
- const g = s.currentTarget, w = ye(s.clientX, g);
1234
- if (!w) return;
1235
- const { colIndex: b, minute: M } = w, { date: S, hour: V } = ne(b, M);
1236
- E.updateDragPreview(S, V, M, c);
1237
- const { originalStartDate: Z, originalEndDate: U } = E.dragState, te = U.getTime() - Z.getTime(), pe = u.length;
1238
- let xe;
1239
- {
1240
- const ve = te / 36e5;
1241
- xe = Math.max(1, Math.ceil(ve));
1242
- }
1243
- xe = Math.min(xe, pe - b), C({ resourceId: c, colIndex: b, spanCols: xe });
1244
- },
1245
- [E, ye, ne, H, u.length, A.length]
1246
- ), De = Y(
1247
- (s) => {
1248
- const c = s.relatedTarget;
1249
- s.currentTarget.contains(c) || C(null);
1250
- },
1251
- []
1252
- ), fe = Y(
1253
- (s, c) => {
1254
- s.preventDefault(), C(null), E?.isDragging && E.endDrag();
1255
- },
1256
- [E]
1257
- ), ke = Y(
1258
- (s, c) => {
1259
- if (!N || N.resourceId !== s) return !1;
1260
- const g = Math.min(N.startCol, N.endCol), w = Math.max(N.startCol, N.endCol);
1261
- return c >= g && c <= w;
1262
- },
1263
- [N]
1264
- ), Q = Y(
1265
- (s, c) => !O || O.resourceId !== s ? !1 : c >= O.colIndex && c < O.colIndex + O.spanCols,
1266
- [O]
1267
- ), ie = Y(
1268
- (s, c, g) => {
1269
- g.button !== 0 && g.pointerType === "mouse" || (f || p) && (g.preventDefault(), B.current = !0, j({ resourceId: s, startCol: c, endCol: c, isSelecting: !0 }));
1270
- },
1271
- [f, p]
1272
- ), h = Y(
1273
- (s, c, g) => {
1274
- if (B.current && !(!N || N.resourceId !== s)) {
1275
- if (g.buttons === 0) {
1276
- B.current = !1;
1277
- return;
1278
- }
1279
- j((w) => w ? { ...w, endCol: c } : null);
1280
- }
1281
- },
1282
- [N]
1283
- ), D = Y(() => {
1284
- if (!B.current || !N) return;
1285
- B.current = !1;
1286
- const s = Math.min(N.startCol, N.endCol), c = Math.max(N.startCol, N.endCol), g = ne(s), w = ne(c), b = new Date(g.date), M = new Date(w.date);
1287
- w.hour !== void 0 && M.setHours(w.hour + 1, 0, 0, 0);
1288
- const S = {
1289
- startDate: b,
1290
- endDate: M,
1291
- resourceId: N.resourceId
1292
- };
1293
- s === c && p && p(g.date, g.hour, N.resourceId), f?.(S), j((V) => V ? { ...V, isSelecting: !1 } : null), setTimeout(() => j(null), 150);
1294
- }, [N, ne, H, p, f]);
1295
- return be(() => {
1296
- const s = () => {
1297
- B.current && D();
1298
- };
1299
- return window.addEventListener("pointerup", s), window.addEventListener("pointercancel", s), () => {
1300
- window.removeEventListener("pointerup", s), window.removeEventListener("pointercancel", s);
1301
- };
1302
- }, [D]), be(() => {
1303
- E?.isDragging || C(null);
1304
- }, [E?.isDragging]), /* @__PURE__ */ e("div", { className: m("flex h-full flex-col", x), children: /* @__PURE__ */ e("div", { className: "ic-timeline-scroll-container flex-1", ref: W, children: /* @__PURE__ */ n("div", { className: "relative", style: { minWidth: ee }, children: [
1305
- // Hour mode: Day headers + Hour sub-headers - sticky wrapper with flex child (sticky + flex breaks sticky)
1306
- /* @__PURE__ */ e("div", { className: "ic-timeline-header sticky top-0 z-20 border-b bg-background", children: t > 1 ? (
1307
- // Multi-day: Resources cell spans both day-header + hour-header rows
1308
- /* @__PURE__ */ n("div", { className: "flex", children: [
1309
- /* @__PURE__ */ e(
1310
- "div",
1311
- {
1312
- className: "flex shrink-0 items-center justify-center border-r bg-background px-2 sticky left-0 z-10",
1313
- style: { width: Se },
1314
- children: /* @__PURE__ */ e("span", { className: "text-[10px] font-medium uppercase text-muted-foreground", children: "Resources" })
1315
- }
1316
- ),
1317
- /* @__PURE__ */ n("div", { className: "flex min-w-0 flex-col", children: [
1318
- /* @__PURE__ */ e("div", { className: "flex border-b", children: A.map((s, c) => {
1319
- const g = oe(s), w = c * q, b = X.slice(w, w + q).reduce((M, S) => M + S, 0);
1320
- return /* @__PURE__ */ e(
1321
- "div",
1322
- {
1323
- className: m(
1324
- "flex shrink-0 items-center justify-center border-r py-1.5 font-medium",
1325
- g ? "bg-primary/10 text-primary" : "bg-muted/30"
1326
- ),
1327
- style: { width: b },
1328
- children: /* @__PURE__ */ e("span", { className: "text-xs", children: or(s) })
1329
- },
1330
- `day-${s.toISOString()}`
1331
- );
1332
- }) }),
1333
- /* @__PURE__ */ e("div", { className: "flex", children: u.map((s, c) => {
1334
- const g = s.hour === T, w = oe(s.date), b = X[c] ?? Le;
1335
- return /* @__PURE__ */ e(
1336
- "div",
1337
- {
1338
- className: m(
1339
- "flex shrink-0 items-center justify-center py-1.5 text-[10px] text-muted-foreground",
1340
- g && c > 0 ? "border-l-2 border-l-border" : "border-r border-r-border/50",
1341
- w && "bg-primary/5"
1342
- ),
1343
- style: { width: b },
1344
- children: Fe(s.hour)
1345
- },
1346
- `hour-${s.dayIndex}-${s.hour}`
1347
- );
1348
- }) })
1349
- ] })
1350
- ] })
1351
- ) : (
1352
- // Single-day: simple single row
1353
- /* @__PURE__ */ n("div", { className: "flex", children: [
1354
- /* @__PURE__ */ e(
1355
- "div",
1356
- {
1357
- className: "flex shrink-0 items-center border-r bg-background px-2 py-2",
1358
- style: { width: Se },
1359
- children: /* @__PURE__ */ e("span", { className: "text-[10px] font-medium uppercase text-muted-foreground", children: "Resources" })
1360
- }
1361
- ),
1362
- u.map((s, c) => {
1363
- const g = s.hour === T, w = oe(s.date), b = X[c] ?? Le;
1364
- return /* @__PURE__ */ e(
1365
- "div",
1366
- {
1367
- className: m(
1368
- "flex shrink-0 items-center justify-center py-1.5 text-[10px] text-muted-foreground",
1369
- g && c > 0 ? "border-l-2 border-l-border" : "border-r border-r-border/50",
1370
- w && "bg-primary/5"
1371
- ),
1372
- style: { width: b },
1373
- children: Fe(s.hour)
1374
- },
1375
- `hour-${s.dayIndex}-${s.hour}`
1376
- );
1377
- })
1378
- ] })
1379
- ) }),
1380
- z.map((s) => {
1381
- const c = Ce(s.maxStack);
1382
- return /* @__PURE__ */ n(
1383
- "div",
1384
- {
1385
- className: m(
1386
- "relative flex border-b",
1387
- F?.resourceRow
1388
- ),
1389
- style: { height: c },
1390
- children: [
1391
- /* @__PURE__ */ e(
1392
- "div",
1393
- {
1394
- className: "sticky left-0 z-10",
1395
- style: { width: Se },
1396
- children: /* @__PURE__ */ n(
1397
- "div",
1398
- {
1399
- className: m(
1400
- "flex h-full items-center gap-2 sm:gap-3 border-r bg-background px-2 sm:px-4",
1401
- F?.resourceHeader
1402
- ),
1403
- children: [
1404
- /* @__PURE__ */ e(
1405
- sr,
1406
- {
1407
- className: "size-7",
1408
- src: s.user.avatar,
1409
- alt: s.user.name,
1410
- fallback: tr(s.user.name)
1411
- }
1412
- ),
1413
- /* @__PURE__ */ e("span", { className: "truncate text-xs sm:text-sm font-medium", children: s.user.name })
1414
- ]
1415
- }
1416
- )
1417
- }
1418
- ),
1419
- /* @__PURE__ */ n(
1420
- "div",
1421
- {
1422
- className: "ic-timeline-grid relative flex",
1423
- onDragOver: (g) => ae(g, s.user.id),
1424
- onDragLeave: De,
1425
- onDrop: (g) => fe(g, s.user.id),
1426
- children: [
1427
- // Hour mode cells — interactive buttons for slot selection
1428
- u.map((g, w) => {
1429
- const b = g.hour === T && w > 0, M = X[w] ?? Le, S = ke(s.user.id, w), V = Q(s.user.id, w), Z = !!(f || p);
1430
- return /* @__PURE__ */ e(
1431
- "div",
1432
- {
1433
- role: Z ? "button" : void 0,
1434
- tabIndex: Z ? 0 : void 0,
1435
- "aria-label": Z ? `Select ${Fe(g.hour)} on ${g.date.toLocaleDateString()} for ${s.user.name}` : void 0,
1436
- onPointerDown: (U) => ie(s.user.id, w, U),
1437
- onPointerEnter: (U) => h(s.user.id, w, U),
1438
- onPointerUp: D,
1439
- onKeyDown: (U) => {
1440
- if (Z && (U.key === "Enter" || U.key === " ")) {
1441
- U.preventDefault();
1442
- const te = ne(w);
1443
- p?.(te.date, te.hour, s.user.id), f?.({
1444
- startDate: te.date,
1445
- endDate: (() => {
1446
- const pe = new Date(te.date);
1447
- return te.hour !== void 0 && pe.setHours(te.hour + 1, 0, 0, 0), pe;
1448
- })(),
1449
- resourceId: s.user.id
1450
- });
1451
- }
1452
- },
1453
- className: m(
1454
- "shrink-0 select-none touch-none transition-colors",
1455
- Z && "cursor-pointer",
1456
- b ? "border-l-2 border-l-border" : "border-r border-r-border/50",
1457
- oe(g.date) && "bg-primary/5",
1458
- // Hover — subtle feedback (only when not selecting or dragging)
1459
- Z && !N?.isSelecting && !E?.isDragging && "hover:bg-blue-50/60",
1460
- // Slot selection highlight
1461
- S && "bg-blue-100/70",
1462
- // Drop target highlight
1463
- V && "bg-primary/20 ring-2 ring-primary ring-inset"
1464
- ),
1465
- style: { width: M }
1466
- },
1467
- `cell-${g.dayIndex}-${g.hour}`
1468
- );
1469
- }),
1470
- s.events.map((g) => {
1471
- const w = (J[g.startCol] ?? 0) + 2, b = J[g.startCol + g.spanCols] ?? J[J.length - 1] ?? 0, M = J[g.startCol] ?? 0, S = b - M - 4, V = Ke + g.stackIndex * (Ae + Ge);
1472
- return /* @__PURE__ */ e(
1473
- "div",
1474
- {
1475
- className: "absolute",
1476
- style: {
1477
- left: w,
1478
- width: Math.max(S, 0),
1479
- // No forced minimum - columns are guaranteed wide enough
1480
- top: V,
1481
- height: Ae
1482
- },
1483
- children: /* @__PURE__ */ e(
1484
- bt,
1485
- {
1486
- event: g.event,
1487
- variant: "compact",
1488
- enableDrag: I,
1489
- onClick: l,
1490
- renderPopover: v,
1491
- className: m(
1492
- "h-full w-full",
1493
- F?.eventCardCompact
1494
- )
1495
- }
1496
- )
1497
- },
1498
- g.event.id
1499
- );
1500
- })
1501
- ]
1502
- }
1503
- )
1504
- ]
1505
- },
1506
- s.user.id
1507
- );
1508
- }),
1509
- z.length === 0 && /* @__PURE__ */ e("div", { className: "flex items-center justify-center py-20 text-muted-foreground", children: "No users or events to display" })
1510
- ] }) }) });
1511
- }
1512
- const ir = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], lr = [
1513
- "January",
1514
- "February",
1515
- "March",
1516
- "April",
1517
- "May",
1518
- "June",
1519
- "July",
1520
- "August",
1521
- "September",
1522
- "October",
1523
- "November",
1524
- "December"
1525
- ];
1526
- function Qe(t) {
1527
- const r = t.hexColor;
1528
- return r ? { backgroundColor: r } : {};
1529
- }
1530
- function cr({ day: t, date: r, events: o, isCurrentMonth: a, onDayClick: i }) {
1531
- const l = oe(r), p = 3, f = o.length;
1532
- return /* @__PURE__ */ n(
1533
- "button",
1534
- {
1535
- type: "button",
1536
- onClick: () => i?.(r),
1537
- className: m(
1538
- "flex h-9 sm:h-11 flex-1 flex-col items-center justify-start gap-0.5 rounded-md pt-0.5 sm:pt-1",
1539
- "hover:bg-accent focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",
1540
- "transition-colors",
1541
- !a && "opacity-40"
1542
- ),
1543
- children: [
1544
- /* @__PURE__ */ e(
1545
- "div",
1546
- {
1547
- className: m(
1548
- "flex size-5 sm:size-6 items-center justify-center rounded-full text-[10px] sm:text-xs font-medium",
1549
- l && "bg-primary font-semibold text-primary-foreground"
1550
- ),
1551
- children: t
1552
- }
1553
- ),
1554
- f > 0 && /* @__PURE__ */ e("div", { className: "mt-0.5 flex items-center gap-0.5", children: f <= p ? o.map((d) => /* @__PURE__ */ e(
1555
- "div",
1556
- {
1557
- className: "size-1 sm:size-1.5 rounded-full bg-primary",
1558
- style: Qe(d)
1559
- },
1560
- d.id
1561
- )) : /* @__PURE__ */ n(ge, { children: [
1562
- o.slice(0, p).map((d) => /* @__PURE__ */ e(
1563
- "div",
1564
- {
1565
- className: "size-1 sm:size-1.5 rounded-full bg-primary",
1566
- style: Qe(d)
1567
- },
1568
- d.id
1569
- )),
1570
- /* @__PURE__ */ n("span", { className: "text-[6px] sm:text-[7px] font-medium text-muted-foreground", children: [
1571
- "+",
1572
- f - p
1573
- ] })
1574
- ] }) })
1575
- ]
1576
- }
1577
- );
1578
- }
1579
- function dr({
1580
- date: t,
1581
- events: r,
1582
- onMonthClick: o,
1583
- onDayClick: a
1584
- }) {
1585
- const i = G(() => Ht(t, 0), [t]);
1586
- return /* @__PURE__ */ n("div", { className: "flex flex-col", children: [
1587
- /* @__PURE__ */ e(
1588
- "button",
1589
- {
1590
- type: "button",
1591
- onClick: () => o?.(t),
1592
- className: m(
1593
- "w-full rounded-t-lg border px-2 sm:px-3 py-1.5 sm:py-2 text-xs sm:text-sm font-semibold",
1594
- "hover:bg-accent focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",
1595
- "transition-colors"
1596
- ),
1597
- children: lr[t.getMonth()]
1598
- }
1599
- ),
1600
- /* @__PURE__ */ n("div", { className: "flex-1 space-y-1.5 sm:space-y-2 rounded-b-lg border border-t-0 p-2 sm:p-3", children: [
1601
- /* @__PURE__ */ e("div", { className: "grid grid-cols-7 gap-x-0.5 text-center", children: ir.map((l, p) => /* @__PURE__ */ n("div", { className: "text-[9px] sm:text-xs font-medium text-muted-foreground", children: [
1602
- /* @__PURE__ */ e("span", { className: "sm:hidden", children: l[0] }),
1603
- /* @__PURE__ */ e("span", { className: "hidden sm:inline", children: l })
1604
- ] }, p)) }),
1605
- /* @__PURE__ */ e("div", { className: "grid grid-cols-7 gap-x-0.5 gap-y-1", children: i.map((l, p) => {
1606
- const f = It(r, l.date);
1607
- return /* @__PURE__ */ e(
1608
- cr,
1609
- {
1610
- day: l.date.getDate(),
1611
- date: l.date,
1612
- events: f,
1613
- isCurrentMonth: l.isCurrentMonth,
1614
- onDayClick: a
1615
- },
1616
- `${p + 1}-${l.date.toISOString()}`
1617
- );
1618
- }) })
1619
- ] })
1620
- ] });
1621
- }
1622
- function ur({
1623
- events: t,
1624
- year: r,
1625
- onMonthClick: o,
1626
- onDayClick: a,
1627
- className: i,
1628
- slots: l,
1629
- classNames: p
1630
- }) {
1631
- const f = G(() => Lt(r), [r]);
1632
- return /* @__PURE__ */ n("div", { className: m("flex flex-col h-full", i), children: [
1633
- /* @__PURE__ */ e("div", { className: "flex items-center justify-center border-b px-4 py-3", children: /* @__PURE__ */ e("h2", { className: "text-lg font-semibold", children: r }) }),
1634
- /* @__PURE__ */ e("div", { className: "flex-1 overflow-auto p-4", children: /* @__PURE__ */ e("div", { className: "grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4", children: f.map((d) => /* @__PURE__ */ e(
1635
- dr,
1636
- {
1637
- date: d,
1638
- events: t,
1639
- onMonthClick: o,
1640
- onDayClick: a
1641
- },
1642
- d.getMonth()
1643
- )) }) })
1644
- ] });
1645
- }
1646
- function hr(t) {
1647
- switch (t) {
1648
- case "day":
1649
- case "week":
1650
- return "time";
1651
- default:
1652
- return "day";
1653
- }
1654
- }
1655
- function mr({
1656
- onEventClick: t,
1657
- onSlotClick: r,
1658
- onSlotSelect: o,
1659
- onAddEvent: a,
1660
- className: i,
1661
- showHeader: l = !0,
1662
- minSelectionMinutes: p = 30,
1663
- showMoreMode: f,
1664
- showMoreEventsInPopover: d = !1,
1665
- isLoading: x = !1,
1666
- slots: y,
1667
- classNames: v,
1668
- settingsContent: L,
1669
- filterContent: F,
1670
- headerActions: I,
1671
- renderPopover: W,
1672
- calendarRef: E,
1673
- headerConfig: N,
1674
- eventDetailMode: j,
1675
- renderEventDetail: B
1676
- }) {
1677
- const O = f ?? (d ? "popover" : "expand"), {
1678
- view: C,
1679
- setView: K,
1680
- selectedDate: H,
1681
- setSelectedDate: T,
1682
- slotDuration: _,
1683
- filteredEvents: q,
1684
- users: R,
1685
- visibleHours: A,
1686
- workingHours: u,
1687
- badgeVariant: k,
1688
- showWorkingHoursOnly: $,
1689
- clearFocusEventId: P
1690
- } = zt(), z = G(() => {
1691
- if (!$ || !u)
1692
- return {
1693
- startHour: A.start,
1694
- endHour: A.end
1695
- };
1696
- let h = 24, D = 0;
1697
- for (const s of Object.keys(u)) {
1698
- const c = u[Number(s)];
1699
- !c || c.enabled === !1 || (c.from < h && (h = c.from), c.to > D && (D = c.to));
1700
- }
1701
- return h >= D ? {
1702
- startHour: A.start,
1703
- endHour: A.end
1704
- } : { startHour: h, endHour: D };
1705
- }, [$, u, A]), re = z, X = Ie(null);
1706
- pt(
1707
- E,
1708
- () => ({
1709
- scrollToToday: () => {
1710
- const h = /* @__PURE__ */ new Date();
1711
- T(h, C), requestAnimationFrame(() => {
1712
- requestAnimationFrame(() => {
1713
- const D = X.current?.querySelector(
1714
- ".ic-timeline-scroll-container, [class*='overflow-auto']"
1715
- );
1716
- if (!D) return;
1717
- const g = (h.getHours() - z.startHour) * 96;
1718
- g > 0 && D.scrollTo({
1719
- top: Math.max(0, g - 100),
1720
- // Offset to show some context
1721
- behavior: "smooth"
1722
- });
1723
- });
1724
- });
1725
- },
1726
- scrollToWorkingHours: () => {
1727
- let h = 8;
1728
- if (u)
1729
- for (const D of Object.keys(u)) {
1730
- const s = u[Number(D)];
1731
- s?.enabled && s.from < h && (h = Math.max(s.from - 1, 0));
1732
- }
1733
- requestAnimationFrame(() => {
1734
- requestAnimationFrame(() => {
1735
- const D = X.current?.querySelector(
1736
- ".ic-timeline-scroll-container, [class*='overflow-auto']"
1737
- );
1738
- if (!D) return;
1739
- const c = (h - z.startHour) * 96;
1740
- D.scrollTo({
1741
- top: Math.max(0, c),
1742
- behavior: "smooth"
1743
- });
1744
- });
1745
- });
1746
- },
1747
- getViewRect: () => X.current?.getBoundingClientRect() ?? null,
1748
- focusEvent: (h) => {
1749
- P(), requestAnimationFrame(() => {
1750
- P();
1751
- });
1752
- const D = X.current?.querySelector(
1753
- `[data-event-id="${h}"]`
1754
- );
1755
- D && setTimeout(() => D.click(), 150);
1756
- }
1757
- }),
1758
- [
1759
- T,
1760
- C,
1761
- z,
1762
- u,
1763
- P
1764
- ]
1765
- );
1766
- const Ce = G(() => hr(C), [C]), ee = Y(
1767
- (h) => {
1768
- if (o) {
1769
- o(h);
1770
- return;
1771
- }
1772
- if (r) {
1773
- const D = h.startDate.getHours();
1774
- r(h.startDate, D);
1775
- }
1776
- },
1777
- [o, r]
1778
- ), J = Y(
1779
- (h) => {
1780
- K("day"), T(h, "day");
1781
- },
1782
- [T, K]
1783
- ), ye = Y(
1784
- (h) => {
1785
- K("month"), T(h, "month");
1786
- },
1787
- [T, K]
1788
- ), ne = Y(
1789
- (h) => {
1790
- t?.(h);
1791
- },
1792
- [t]
1793
- ), ae = Y(
1794
- (h, D, s) => {
1795
- r?.(h, D);
1796
- },
1797
- [r]
1798
- ), De = () => {
1799
- const h = q, D = ne, s = W;
1800
- switch (C) {
1801
- case "day":
1802
- return /* @__PURE__ */ e(
1803
- Ct,
1804
- {
1805
- events: h,
1806
- date: H,
1807
- visibleHours: re,
1808
- workingHours: u,
1809
- slotDuration: _,
1810
- badgeVariant: k,
1811
- onEventClick: D,
1812
- renderPopover: s,
1813
- ...y && { slots: y },
1814
- ...v && { classNames: v }
1815
- }
1816
- );
1817
- case "week":
1818
- return /* @__PURE__ */ e(
1819
- Nt,
1820
- {
1821
- events: h,
1822
- date: H,
1823
- visibleHours: re,
1824
- workingHours: u,
1825
- slotDuration: _,
1826
- badgeVariant: k,
1827
- onEventClick: D,
1828
- renderPopover: s,
1829
- ...y && { slots: y },
1830
- ...v && { classNames: v }
1831
- }
1832
- );
1833
- case "month":
1834
- return /* @__PURE__ */ e(
1835
- Re,
1836
- {
1837
- events: h,
1838
- date: H,
1839
- badgeVariant: k,
1840
- onEventClick: D,
1841
- onDayClick: J,
1842
- renderPopover: s,
1843
- showMoreMode: O,
1844
- ...y && { slots: y },
1845
- ...v && { classNames: v }
1846
- }
1847
- );
1848
- case "year":
1849
- return /* @__PURE__ */ e(
1850
- ur,
1851
- {
1852
- events: h,
1853
- year: H.getFullYear(),
1854
- onMonthClick: ye,
1855
- onDayClick: J,
1856
- ...y && { slots: y },
1857
- ...v && { classNames: v }
1858
- }
1859
- );
1860
- case "agenda":
1861
- return /* @__PURE__ */ e(
1862
- kt,
1863
- {
1864
- events: h,
1865
- date: H,
1866
- onEventClick: D,
1867
- renderPopover: s,
1868
- ...y && { slots: y },
1869
- ...v && { classNames: v }
1870
- }
1871
- );
1872
- // Resource views — delegate to TimelineView with matching day count
1873
- case "resource-day":
1874
- return /* @__PURE__ */ e(
1875
- Ee,
1876
- {
1877
- daysToShow: 1,
1878
- events: h,
1879
- users: R,
1880
- selectedDate: H,
1881
- visibleHours: {
1882
- from: z.startHour,
1883
- to: z.endHour
1884
- },
1885
- onEventClick: D,
1886
- onSlotSelect: ee,
1887
- onSlotClick: ae,
1888
- renderPopover: s,
1889
- ...y && { slots: y },
1890
- ...v && { classNames: v }
1891
- }
1892
- );
1893
- case "resource-week":
1894
- return /* @__PURE__ */ e(
1895
- Ee,
1896
- {
1897
- daysToShow: 7,
1898
- events: h,
1899
- users: R,
1900
- selectedDate: H,
1901
- visibleHours: {
1902
- from: z.startHour,
1903
- to: z.endHour
1904
- },
1905
- onEventClick: D,
1906
- onSlotSelect: ee,
1907
- onSlotClick: ae,
1908
- renderPopover: s,
1909
- ...y && { slots: y },
1910
- ...v && { classNames: v }
1911
- }
1912
- );
1913
- // Timeline views
1914
- case "timeline-day":
1915
- return /* @__PURE__ */ e(
1916
- Ee,
1917
- {
1918
- daysToShow: 1,
1919
- events: h,
1920
- users: R,
1921
- selectedDate: H,
1922
- visibleHours: {
1923
- from: z.startHour,
1924
- to: z.endHour
1925
- },
1926
- onEventClick: D,
1927
- onSlotSelect: ee,
1928
- onSlotClick: ae,
1929
- renderPopover: s,
1930
- ...y && { slots: y },
1931
- ...v && { classNames: v }
1932
- }
1933
- );
1934
- case "timeline-3day":
1935
- return /* @__PURE__ */ e(
1936
- Ee,
1937
- {
1938
- daysToShow: 3,
1939
- events: h,
1940
- users: R,
1941
- selectedDate: H,
1942
- visibleHours: {
1943
- from: z.startHour,
1944
- to: z.endHour
1945
- },
1946
- onEventClick: D,
1947
- onSlotSelect: ee,
1948
- onSlotClick: ae,
1949
- renderPopover: s,
1950
- ...y && { slots: y },
1951
- ...v && { classNames: v }
1952
- }
1953
- );
1954
- case "timeline-week":
1955
- return /* @__PURE__ */ e(
1956
- Ee,
1957
- {
1958
- daysToShow: 7,
1959
- events: h,
1960
- users: R,
1961
- selectedDate: H,
1962
- visibleHours: {
1963
- from: z.startHour,
1964
- to: z.endHour
1965
- },
1966
- onEventClick: D,
1967
- onSlotSelect: ee,
1968
- onSlotClick: ae,
1969
- renderPopover: s,
1970
- ...y && { slots: y },
1971
- ...v && { classNames: v }
1972
- }
1973
- );
1974
- default:
1975
- return /* @__PURE__ */ e(
1976
- Re,
1977
- {
1978
- events: h,
1979
- date: H,
1980
- badgeVariant: k,
1981
- onEventClick: D,
1982
- onDayClick: J,
1983
- ...y && { slots: y },
1984
- ...v && { classNames: v }
1985
- }
1986
- );
1987
- }
1988
- }, fe = Ie(null), [ke, Q] = se(!1);
1989
- be(() => {
1990
- X.current = fe.current;
1991
- }), be(() => {
1992
- const h = fe.current;
1993
- if (!h) return;
1994
- const D = () => {
1995
- const { scrollLeft: g, scrollWidth: w, clientWidth: b } = h;
1996
- Q(g + b < w - 4);
1997
- };
1998
- D(), h.addEventListener("scroll", D, { passive: !0 });
1999
- const s = new ResizeObserver(D);
2000
- s.observe(h);
2001
- const c = new MutationObserver(D);
2002
- return c.observe(h, { childList: !0, subtree: !0 }), () => {
2003
- h.removeEventListener("scroll", D), s.disconnect(), c.disconnect();
2004
- };
2005
- }, [C]);
2006
- const ie = Y(() => {
2007
- fe.current?.scrollBy({ left: 300, behavior: "smooth" });
2008
- }, []);
2009
- return /* @__PURE__ */ e(
2010
- Tt,
2011
- {
2012
- mode: Ce,
2013
- onSelect: ee,
2014
- minDurationMinutes: p,
2015
- slotDurationMinutes: _,
2016
- enabled: !!(o || r),
2017
- children: /* @__PURE__ */ n(
2018
- "div",
2019
- {
2020
- className: m(
2021
- "inno-calendar-root flex flex-col h-full p-4",
2022
- v?.root,
2023
- i
2024
- ),
2025
- children: [
2026
- l && /* @__PURE__ */ e(
2027
- yt,
2028
- {
2029
- currentDate: H,
2030
- view: C,
2031
- events: q,
2032
- onViewChange: K,
2033
- onNavigateToday: () => T(/* @__PURE__ */ new Date(), C),
2034
- onNavigatePrev: () => {
2035
- const h = new Date(H);
2036
- C === "day" || C === "timeline-day" || C === "resource-day" ? h.setDate(h.getDate() - 1) : C === "timeline-3day" ? h.setDate(h.getDate() - 3) : C === "week" || C === "timeline-week" || C === "resource-week" ? h.setDate(h.getDate() - 7) : C === "month" ? h.setMonth(h.getMonth() - 1) : C === "year" ? h.setFullYear(h.getFullYear() - 1) : h.setDate(h.getDate() - 7), T(h, C);
2037
- },
2038
- onNavigateNext: () => {
2039
- const h = new Date(H);
2040
- C === "day" || C === "timeline-day" || C === "resource-day" ? h.setDate(h.getDate() + 1) : C === "timeline-3day" ? h.setDate(h.getDate() + 3) : C === "week" || C === "timeline-week" || C === "resource-week" ? h.setDate(h.getDate() + 7) : C === "month" ? h.setMonth(h.getMonth() + 1) : C === "year" ? h.setFullYear(h.getFullYear() + 1) : h.setDate(h.getDate() + 7), T(h, C);
2041
- },
2042
- availableViews: [
2043
- "day",
2044
- "week",
2045
- "month",
2046
- // 'year', NOTE: Intentionally blocked cause it would severe performance issues when there are many events
2047
- "agenda"
2048
- ],
2049
- showTimelineViews: !0,
2050
- showSettings: !!L,
2051
- ...!I && a && { onAddEvent: a },
2052
- actions: I,
2053
- settingsContent: L,
2054
- filterContent: F,
2055
- ...N && { headerConfig: N }
2056
- }
2057
- ),
2058
- /* @__PURE__ */ n("div", { className: "relative flex-1 min-h-0", children: [
2059
- /* @__PURE__ */ e(
2060
- "div",
2061
- {
2062
- ref: fe,
2063
- className: m(
2064
- "h-full border rounded-lg bg-white overflow-x-auto",
2065
- v?.viewContainer
2066
- ),
2067
- children: De()
2068
- }
2069
- ),
2070
- x && /* @__PURE__ */ e("div", { className: "inno-calendar-loading-overlay", children: /* @__PURE__ */ e("div", { className: "inno-calendar-spinner" }) }),
2071
- ke && /* @__PURE__ */ e(
2072
- "button",
2073
- {
2074
- type: "button",
2075
- onClick: ie,
2076
- className: "inno-scroll-right-btn",
2077
- "aria-label": "Scroll right",
2078
- children: /* @__PURE__ */ n(
2079
- "svg",
2080
- {
2081
- xmlns: "http://www.w3.org/2000/svg",
2082
- width: "16",
2083
- height: "16",
2084
- viewBox: "0 0 24 24",
2085
- fill: "none",
2086
- stroke: "currentColor",
2087
- strokeWidth: "2",
2088
- strokeLinecap: "round",
2089
- strokeLinejoin: "round",
2090
- "aria-hidden": "true",
2091
- children: [
2092
- /* @__PURE__ */ e("title", { children: "Scroll right" }),
2093
- /* @__PURE__ */ e("path", { d: "m9 18 6-6-6-6" })
2094
- ]
2095
- }
2096
- )
2097
- }
2098
- )
2099
- ] })
2100
- ]
2101
- }
2102
- )
2103
- }
2104
- );
2105
- }
2106
- function fr({
2107
- events: t,
2108
- users: r = [],
2109
- scheduleTypes: o = [],
2110
- initialView: a = "week",
2111
- initialDate: i,
2112
- initialSelectedUserId: l,
2113
- initialScheduleTypeIds: p,
2114
- initialParticipantIds: f,
2115
- initialWorkingHoursView: d,
2116
- initialSearchQuery: x,
2117
- preferencesConfig: y,
2118
- onEventClick: v,
2119
- onSlotClick: L,
2120
- onSlotSelect: F,
2121
- onAddEvent: I,
2122
- onEventDrop: W,
2123
- onDateChange: E,
2124
- onViewChange: N,
2125
- className: j,
2126
- showHeader: B = !0,
2127
- minSelectionMinutes: O = 30,
2128
- showMoreMode: C,
2129
- showMoreEventsInPopover: K = !1,
2130
- isLoading: H = !1,
2131
- renderPopover: T,
2132
- slots: _,
2133
- classNames: q,
2134
- settingsContent: R,
2135
- filterContent: A,
2136
- headerActions: u,
2137
- focusEventId: k,
2138
- headerConfig: $,
2139
- eventDetailMode: P,
2140
- renderEventDetail: z
2141
- }, re) {
2142
- return /* @__PURE__ */ e(St, { ...W && { onEventDrop: W }, children: /* @__PURE__ */ e(
2143
- Et,
2144
- {
2145
- initialEvents: t,
2146
- initialUsers: r,
2147
- initialScheduleTypes: o,
2148
- initialView: a,
2149
- ...i && { initialDate: i },
2150
- ...l && { initialSelectedUserId: l },
2151
- ...p && { initialScheduleTypeIds: p },
2152
- ...f && { initialParticipantIds: f },
2153
- ...d && { initialWorkingHoursView: d },
2154
- ...x && { initialSearchQuery: x },
2155
- ...y && { preferencesConfig: y },
2156
- ...E && { onDateChange: E },
2157
- ...N && { onViewChange: N },
2158
- ...k && { initialFocusEventId: k },
2159
- children: /* @__PURE__ */ e(
2160
- mr,
2161
- {
2162
- ...v && { onEventClick: v },
2163
- ...L && { onSlotClick: L },
2164
- ...F && { onSlotSelect: F },
2165
- ...I && { onAddEvent: I },
2166
- ...T && { renderPopover: T },
2167
- className: j,
2168
- showHeader: B,
2169
- minSelectionMinutes: O,
2170
- ...C && { showMoreMode: C },
2171
- showMoreEventsInPopover: K,
2172
- isLoading: H,
2173
- ..._ && { slots: _ },
2174
- ...q && { classNames: q },
2175
- settingsContent: R,
2176
- filterContent: A,
2177
- headerActions: u,
2178
- calendarRef: re,
2179
- ...$ && { headerConfig: $ },
2180
- ...P && { eventDetailMode: P },
2181
- ...z && { renderEventDetail: z }
2182
- }
2183
- )
2184
- }
2185
- ) });
2186
- }
2187
- const hn = je(fr), me = je(
2188
- ({ className: t, children: r, ...o }, a) => /* @__PURE__ */ e(
2189
- "select",
2190
- {
2191
- ref: a,
2192
- className: m(
2193
- "flex h-9 w-full rounded-md border border-input bg-background px-3 py-1 text-sm shadow-sm",
2194
- "ring-offset-background",
2195
- "focus:outline-none focus:ring-1 focus:ring-ring",
2196
- "disabled:cursor-not-allowed disabled:opacity-50",
2197
- "[&>option]:bg-background",
2198
- t
2199
- ),
2200
- ...o,
2201
- children: r
2202
- }
2203
- )
2204
- );
2205
- me.displayName = "Select";
2206
- const le = je(({ className: t, ...r }, o) => /* @__PURE__ */ e(
2207
- "label",
2208
- {
2209
- ref: o,
2210
- className: m(
2211
- "text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",
2212
- t
2213
- ),
2214
- ...r
2215
- }
2216
- ));
2217
- le.displayName = "Label";
2218
- function gr({ className: t }) {
2219
- return /* @__PURE__ */ n(
2220
- "svg",
2221
- {
2222
- className: t,
2223
- xmlns: "http://www.w3.org/2000/svg",
2224
- width: "24",
2225
- height: "24",
2226
- viewBox: "0 0 24 24",
2227
- fill: "none",
2228
- stroke: "currentColor",
2229
- strokeWidth: "2",
2230
- strokeLinecap: "round",
2231
- strokeLinejoin: "round",
2232
- children: [
2233
- /* @__PURE__ */ e("circle", { cx: "12", cy: "12", r: "10" }),
2234
- /* @__PURE__ */ e("path", { d: "M12 16v-4" }),
2235
- /* @__PURE__ */ e("path", { d: "M12 8h.01" })
2236
- ]
2237
- }
2238
- );
2239
- }
2240
- function pr({ className: t }) {
2241
- return /* @__PURE__ */ n(
2242
- "svg",
2243
- {
2244
- className: t,
2245
- xmlns: "http://www.w3.org/2000/svg",
2246
- width: "24",
2247
- height: "24",
2248
- viewBox: "0 0 24 24",
2249
- fill: "none",
2250
- stroke: "currentColor",
2251
- strokeWidth: "2",
2252
- strokeLinecap: "round",
2253
- strokeLinejoin: "round",
2254
- children: [
2255
- /* @__PURE__ */ e("rect", { width: "18", height: "11", x: "3", y: "11", rx: "2", ry: "2" }),
2256
- /* @__PURE__ */ e("path", { d: "M7 11V7a5 5 0 0 1 10 0v4" })
2257
- ]
2258
- }
2259
- );
2260
- }
2261
- const xr = [
2262
- { value: 15, label: "15 minutes" },
2263
- { value: 30, label: "30 minutes" },
2264
- { value: 60, label: "1 hour" }
2265
- ];
2266
- function mn({
2267
- value: t,
2268
- onChange: r,
2269
- isLocked: o = !1,
2270
- className: a,
2271
- labels: i = {}
2272
- }) {
2273
- const l = {
2274
- title: "Slot duration",
2275
- lockedMessage: "This setting is locked by the administrator",
2276
- infoMessage: "Set the time slot duration for day and week calendar views.",
2277
- ...i
2278
- }, p = (f) => {
2279
- o || r(Number(f.target.value));
2280
- };
2281
- return /* @__PURE__ */ n("div", { className: m("flex flex-col gap-3", a), children: [
2282
- /* @__PURE__ */ n("div", { className: "flex items-center gap-2", children: [
2283
- /* @__PURE__ */ e(le, { className: "text-sm font-semibold", children: l.title }),
2284
- o ? /* @__PURE__ */ e(ce, { delayDuration: 100, children: /* @__PURE__ */ n(de, { children: [
2285
- /* @__PURE__ */ e(ue, { children: /* @__PURE__ */ e(pr, { className: "size-3 text-muted-foreground" }) }),
2286
- /* @__PURE__ */ e(he, { children: /* @__PURE__ */ e("p", { children: l.lockedMessage }) })
2287
- ] }) }) : /* @__PURE__ */ e(ce, { delayDuration: 100, children: /* @__PURE__ */ n(de, { children: [
2288
- /* @__PURE__ */ e(ue, { children: /* @__PURE__ */ e(gr, { className: "size-3 text-muted-foreground" }) }),
2289
- /* @__PURE__ */ e(he, { className: "max-w-64 text-center", children: /* @__PURE__ */ e("p", { children: l.infoMessage }) })
2290
- ] }) })
2291
- ] }),
2292
- /* @__PURE__ */ e(
2293
- me,
2294
- {
2295
- value: t.toString(),
2296
- onChange: p,
2297
- disabled: o,
2298
- className: "h-9 w-[128px] text-sm",
2299
- children: xr.map((f) => /* @__PURE__ */ e("option", { value: f.value.toString(), children: f.label }, f.value))
2300
- }
2301
- )
2302
- ] });
2303
- }
2304
- function vr({ className: t }) {
2305
- return /* @__PURE__ */ n(
2306
- "svg",
2307
- {
2308
- className: t,
2309
- xmlns: "http://www.w3.org/2000/svg",
2310
- width: "24",
2311
- height: "24",
2312
- viewBox: "0 0 24 24",
2313
- fill: "none",
2314
- stroke: "currentColor",
2315
- strokeWidth: "2",
2316
- strokeLinecap: "round",
2317
- strokeLinejoin: "round",
2318
- children: [
2319
- /* @__PURE__ */ e("circle", { cx: "12", cy: "12", r: "10" }),
2320
- /* @__PURE__ */ e("path", { d: "M12 16v-4" }),
2321
- /* @__PURE__ */ e("path", { d: "M12 8h.01" })
2322
- ]
2323
- }
2324
- );
2325
- }
2326
- function wr({ className: t }) {
2327
- return /* @__PURE__ */ n(
2328
- "svg",
2329
- {
2330
- className: t,
2331
- xmlns: "http://www.w3.org/2000/svg",
2332
- width: "24",
2333
- height: "24",
2334
- viewBox: "0 0 24 24",
2335
- fill: "none",
2336
- stroke: "currentColor",
2337
- strokeWidth: "2",
2338
- strokeLinecap: "round",
2339
- strokeLinejoin: "round",
2340
- children: [
2341
- /* @__PURE__ */ e("rect", { width: "18", height: "11", x: "3", y: "11", rx: "2", ry: "2" }),
2342
- /* @__PURE__ */ e("path", { d: "M7 11V7a5 5 0 0 1 10 0v4" })
2343
- ]
2344
- }
2345
- );
2346
- }
2347
- const br = [
2348
- { value: "dot", label: "Dot indicator" },
2349
- { value: "colored", label: "Full color" },
2350
- { value: "mixed", label: "Mixed" }
2351
- ];
2352
- function fn({
2353
- value: t,
2354
- onChange: r,
2355
- isLocked: o = !1,
2356
- className: a,
2357
- labels: i = {}
2358
- }) {
2359
- const l = {
2360
- title: "Event display",
2361
- lockedMessage: "This setting is locked by the administrator",
2362
- infoMessage: "Choose how events are displayed. Dot shows a small indicator, colored fills the entire event, mixed uses both.",
2363
- options: {
2364
- dot: "Dot indicator",
2365
- colored: "Full color",
2366
- mixed: "Mixed"
2367
- },
2368
- ...i
2369
- }, p = (d) => l.options?.[d] ?? d, f = (d) => {
2370
- o || r(d.target.value);
2371
- };
2372
- return /* @__PURE__ */ n("div", { className: m("flex flex-col gap-3", a), children: [
2373
- /* @__PURE__ */ n("div", { className: "flex items-center gap-2", children: [
2374
- /* @__PURE__ */ e(le, { className: "text-sm font-semibold", children: l.title }),
2375
- o ? /* @__PURE__ */ e(ce, { delayDuration: 100, children: /* @__PURE__ */ n(de, { children: [
2376
- /* @__PURE__ */ e(ue, { children: /* @__PURE__ */ e(wr, { className: "size-3 text-muted-foreground" }) }),
2377
- /* @__PURE__ */ e(he, { children: /* @__PURE__ */ e("p", { children: l.lockedMessage }) })
2378
- ] }) }) : /* @__PURE__ */ e(ce, { delayDuration: 100, children: /* @__PURE__ */ n(de, { children: [
2379
- /* @__PURE__ */ e(ue, { children: /* @__PURE__ */ e(vr, { className: "size-3 text-muted-foreground" }) }),
2380
- /* @__PURE__ */ e(he, { className: "max-w-64 text-center", children: /* @__PURE__ */ e("p", { children: l.infoMessage }) })
2381
- ] }) })
2382
- ] }),
2383
- /* @__PURE__ */ e(
2384
- me,
2385
- {
2386
- value: t,
2387
- onChange: f,
2388
- disabled: o,
2389
- className: "h-9 w-[128px] text-sm",
2390
- children: br.map((d) => /* @__PURE__ */ e("option", { value: d.value, children: p(d.value) }, d.value))
2391
- }
2392
- )
2393
- ] });
2394
- }
2395
- function yr({ className: t }) {
2396
- return /* @__PURE__ */ n(
2397
- "svg",
2398
- {
2399
- className: t,
2400
- xmlns: "http://www.w3.org/2000/svg",
2401
- width: "24",
2402
- height: "24",
2403
- viewBox: "0 0 24 24",
2404
- fill: "none",
2405
- stroke: "currentColor",
2406
- strokeWidth: "2",
2407
- strokeLinecap: "round",
2408
- strokeLinejoin: "round",
2409
- children: [
2410
- /* @__PURE__ */ e("circle", { cx: "12", cy: "12", r: "10" }),
2411
- /* @__PURE__ */ e("path", { d: "M12 16v-4" }),
2412
- /* @__PURE__ */ e("path", { d: "M12 8h.01" })
2413
- ]
2414
- }
2415
- );
2416
- }
2417
- function kr({ className: t }) {
2418
- return /* @__PURE__ */ n(
2419
- "svg",
2420
- {
2421
- className: t,
2422
- xmlns: "http://www.w3.org/2000/svg",
2423
- width: "24",
2424
- height: "24",
2425
- viewBox: "0 0 24 24",
2426
- fill: "none",
2427
- stroke: "currentColor",
2428
- strokeWidth: "2",
2429
- strokeLinecap: "round",
2430
- strokeLinejoin: "round",
2431
- children: [
2432
- /* @__PURE__ */ e("rect", { width: "18", height: "11", x: "3", y: "11", rx: "2", ry: "2" }),
2433
- /* @__PURE__ */ e("path", { d: "M7 11V7a5 5 0 0 1 10 0v4" })
2434
- ]
2435
- }
2436
- );
2437
- }
2438
- function Nr() {
2439
- return Array.from({ length: 25 }, (t, r) => ({
2440
- value: r,
2441
- label: `${String(r).padStart(2, "0")}:00`
2442
- }));
2443
- }
2444
- function gn({
2445
- value: t,
2446
- onChange: r,
2447
- isLocked: o = !1,
2448
- className: a,
2449
- labels: i = {}
2450
- }) {
2451
- const l = {
2452
- title: "Visible hours",
2453
- from: "From",
2454
- to: "To",
2455
- lockedMessage: "This setting is locked by the administrator",
2456
- infoMessage: "Set the visible hour range for day and week views. Hours outside this range will be hidden.",
2457
- ...i
2458
- }, p = Nr(), f = (x) => {
2459
- if (o) return;
2460
- const y = Number(x.target.value);
2461
- y < t.endHour && r({ ...t, startHour: y });
2462
- }, d = (x) => {
2463
- if (o) return;
2464
- const y = Number(x.target.value);
2465
- y > t.startHour && r({ ...t, endHour: y });
2466
- };
2467
- return /* @__PURE__ */ n("div", { className: m("flex flex-col gap-3", a), children: [
2468
- /* @__PURE__ */ n("div", { className: "flex items-center gap-2", children: [
2469
- /* @__PURE__ */ e(le, { className: "text-sm font-semibold", children: l.title }),
2470
- o ? /* @__PURE__ */ e(ce, { delayDuration: 100, children: /* @__PURE__ */ n(de, { children: [
2471
- /* @__PURE__ */ e(ue, { children: /* @__PURE__ */ e(kr, { className: "size-3 text-muted-foreground" }) }),
2472
- /* @__PURE__ */ e(he, { children: /* @__PURE__ */ e("p", { children: l.lockedMessage }) })
2473
- ] }) }) : /* @__PURE__ */ e(ce, { delayDuration: 100, children: /* @__PURE__ */ n(de, { children: [
2474
- /* @__PURE__ */ e(ue, { children: /* @__PURE__ */ e(yr, { className: "size-3 text-muted-foreground" }) }),
2475
- /* @__PURE__ */ e(he, { className: "max-w-64 text-center", children: /* @__PURE__ */ e("p", { children: l.infoMessage }) })
2476
- ] }) })
2477
- ] }),
2478
- /* @__PURE__ */ n("div", { className: "flex items-center gap-2", children: [
2479
- /* @__PURE__ */ n("div", { className: "flex flex-col gap-1", children: [
2480
- /* @__PURE__ */ e(le, { className: "text-xs text-muted-foreground", children: l.from }),
2481
- /* @__PURE__ */ e(
2482
- me,
2483
- {
2484
- value: t.startHour.toString(),
2485
- onChange: f,
2486
- disabled: o,
2487
- className: "h-9 w-[88px] text-sm",
2488
- children: p.map((x) => /* @__PURE__ */ e(
2489
- "option",
2490
- {
2491
- value: x.value.toString(),
2492
- disabled: x.value >= t.endHour,
2493
- children: x.label
2494
- },
2495
- x.value
2496
- ))
2497
- }
2498
- )
2499
- ] }),
2500
- /* @__PURE__ */ e("span", { className: "mt-5 text-muted-foreground", children: "—" }),
2501
- /* @__PURE__ */ n("div", { className: "flex flex-col gap-1", children: [
2502
- /* @__PURE__ */ e(le, { className: "text-xs text-muted-foreground", children: l.to }),
2503
- /* @__PURE__ */ e(
2504
- me,
2505
- {
2506
- value: t.endHour.toString(),
2507
- onChange: d,
2508
- disabled: o,
2509
- className: "h-9 w-[88px] text-sm",
2510
- children: p.map((x) => /* @__PURE__ */ e(
2511
- "option",
2512
- {
2513
- value: x.value.toString(),
2514
- disabled: x.value <= t.startHour,
2515
- children: x.label
2516
- },
2517
- x.value
2518
- ))
2519
- }
2520
- )
2521
- ] })
2522
- ] })
2523
- ] });
2524
- }
2525
- function Cr({ className: t }) {
2526
- return /* @__PURE__ */ n(
2527
- "svg",
2528
- {
2529
- className: t,
2530
- xmlns: "http://www.w3.org/2000/svg",
2531
- width: "24",
2532
- height: "24",
2533
- viewBox: "0 0 24 24",
2534
- fill: "none",
2535
- stroke: "currentColor",
2536
- strokeWidth: "2",
2537
- strokeLinecap: "round",
2538
- strokeLinejoin: "round",
2539
- children: [
2540
- /* @__PURE__ */ e("circle", { cx: "12", cy: "12", r: "10" }),
2541
- /* @__PURE__ */ e("path", { d: "M12 16v-4" }),
2542
- /* @__PURE__ */ e("path", { d: "M12 8h.01" })
2543
- ]
2544
- }
2545
- );
2546
- }
2547
- function Dr({ className: t }) {
2548
- return /* @__PURE__ */ n(
2549
- "svg",
2550
- {
2551
- className: t,
2552
- xmlns: "http://www.w3.org/2000/svg",
2553
- width: "24",
2554
- height: "24",
2555
- viewBox: "0 0 24 24",
2556
- fill: "none",
2557
- stroke: "currentColor",
2558
- strokeWidth: "2",
2559
- strokeLinecap: "round",
2560
- strokeLinejoin: "round",
2561
- children: [
2562
- /* @__PURE__ */ e("rect", { width: "18", height: "11", x: "3", y: "11", rx: "2", ry: "2" }),
2563
- /* @__PURE__ */ e("path", { d: "M7 11V7a5 5 0 0 1 10 0v4" })
2564
- ]
2565
- }
2566
- );
2567
- }
2568
- function Mr({ className: t }) {
2569
- return /* @__PURE__ */ e(
2570
- "svg",
2571
- {
2572
- className: t,
2573
- xmlns: "http://www.w3.org/2000/svg",
2574
- width: "24",
2575
- height: "24",
2576
- viewBox: "0 0 24 24",
2577
- fill: "none",
2578
- stroke: "currentColor",
2579
- strokeWidth: "2",
2580
- strokeLinecap: "round",
2581
- strokeLinejoin: "round",
2582
- children: /* @__PURE__ */ e("path", { d: "M20 6 9 17l-5-5" })
2583
- }
2584
- );
2585
- }
2586
- const Sr = [
2587
- "monday",
2588
- "tuesday",
2589
- "wednesday",
2590
- "thursday",
2591
- "friday",
2592
- "saturday",
2593
- "sunday"
2594
- ];
2595
- function Er() {
2596
- return Array.from({ length: 25 }, (t, r) => ({
2597
- value: r,
2598
- label: `${String(r).padStart(2, "0")}:00`
2599
- }));
2600
- }
2601
- const Ze = {
2602
- sunday: "Sun",
2603
- monday: "Mon",
2604
- tuesday: "Tue",
2605
- wednesday: "Wed",
2606
- thursday: "Thu",
2607
- friday: "Fri",
2608
- saturday: "Sat"
2609
- };
2610
- function zr({ dayLabel: t, config: r, onChange: o, disabled: a, hourOptions: i }) {
2611
- const l = () => {
2612
- a || o({ ...r, enabled: !r.enabled });
2613
- }, p = (d) => {
2614
- if (a) return;
2615
- const x = Number(d.target.value);
2616
- x < r.to && o({ ...r, from: x });
2617
- }, f = (d) => {
2618
- if (a) return;
2619
- const x = Number(d.target.value);
2620
- x > r.from && o({ ...r, to: x });
2621
- };
2622
- return /* @__PURE__ */ n("div", { className: "flex items-center gap-2", children: [
2623
- /* @__PURE__ */ e(
2624
- "button",
2625
- {
2626
- type: "button",
2627
- role: "checkbox",
2628
- "aria-checked": r.enabled,
2629
- "aria-label": `Enable ${t}`,
2630
- onClick: l,
2631
- disabled: a,
2632
- className: m(
2633
- "flex size-5 shrink-0 items-center justify-center rounded border transition-colors",
2634
- r.enabled ? "border-primary bg-primary text-primary-foreground" : "border-input bg-background",
2635
- a && "cursor-not-allowed opacity-50"
2636
- ),
2637
- children: r.enabled && /* @__PURE__ */ e(Mr, { className: "size-3" })
2638
- }
2639
- ),
2640
- /* @__PURE__ */ e("span", { className: m("w-10 text-sm", !r.enabled && "text-muted-foreground"), children: t }),
2641
- /* @__PURE__ */ e(
2642
- me,
2643
- {
2644
- value: r.from.toString(),
2645
- onChange: p,
2646
- disabled: a || !r.enabled,
2647
- className: "h-8 w-[76px] text-xs",
2648
- children: i.map((d) => /* @__PURE__ */ e("option", { value: d.value.toString(), disabled: d.value >= r.to, children: d.label }, d.value))
2649
- }
2650
- ),
2651
- /* @__PURE__ */ e("span", { className: "text-xs text-muted-foreground", children: "—" }),
2652
- /* @__PURE__ */ e(
2653
- me,
2654
- {
2655
- value: r.to.toString(),
2656
- onChange: f,
2657
- disabled: a || !r.enabled,
2658
- className: "h-8 w-[76px] text-xs",
2659
- children: i.map((d) => /* @__PURE__ */ e("option", { value: d.value.toString(), disabled: d.value <= r.from, children: d.label }, d.value))
2660
- }
2661
- )
2662
- ] });
2663
- }
2664
- function pn({
2665
- value: t,
2666
- onChange: r,
2667
- isLocked: o = !1,
2668
- className: a,
2669
- labels: i = {}
2670
- }) {
2671
- const l = {
2672
- title: "Working hours",
2673
- lockedMessage: "This setting is locked by the administrator",
2674
- infoMessage: "Configure working hours for each day of the week. Non-working hours will be grayed out in day and week views.",
2675
- days: Ze,
2676
- ...i
2677
- }, p = Er(), f = (d, x) => {
2678
- o || r({ ...t, [d]: x });
2679
- };
2680
- return /* @__PURE__ */ n("div", { className: m("flex flex-col gap-3", a), children: [
2681
- /* @__PURE__ */ n("div", { className: "flex items-center gap-2", children: [
2682
- /* @__PURE__ */ e(le, { className: "text-sm font-semibold", children: l.title }),
2683
- o ? /* @__PURE__ */ e(ce, { delayDuration: 100, children: /* @__PURE__ */ n(de, { children: [
2684
- /* @__PURE__ */ e(ue, { children: /* @__PURE__ */ e(Dr, { className: "size-3 text-muted-foreground" }) }),
2685
- /* @__PURE__ */ e(he, { children: /* @__PURE__ */ e("p", { children: l.lockedMessage }) })
2686
- ] }) }) : /* @__PURE__ */ e(ce, { delayDuration: 100, children: /* @__PURE__ */ n(de, { children: [
2687
- /* @__PURE__ */ e(ue, { children: /* @__PURE__ */ e(Cr, { className: "size-3 text-muted-foreground" }) }),
2688
- /* @__PURE__ */ e(he, { className: "max-w-64 text-center", children: /* @__PURE__ */ e("p", { children: l.infoMessage }) })
2689
- ] }) })
2690
- ] }),
2691
- /* @__PURE__ */ e("div", { className: "flex flex-col gap-2", children: Sr.map((d) => /* @__PURE__ */ e(
2692
- zr,
2693
- {
2694
- dayLabel: l.days?.[d] ?? Ze[d],
2695
- config: t[d],
2696
- onChange: (x) => f(d, x),
2697
- disabled: o,
2698
- hourOptions: p
2699
- },
2700
- d
2701
- )) })
2702
- ] });
2703
- }
2704
- const xn = {
2705
- sunday: { enabled: !1, from: 8, to: 18 },
2706
- monday: { enabled: !0, from: 8, to: 18 },
2707
- tuesday: { enabled: !0, from: 8, to: 18 },
2708
- wednesday: { enabled: !0, from: 8, to: 18 },
2709
- thursday: { enabled: !0, from: 8, to: 18 },
2710
- friday: { enabled: !0, from: 8, to: 18 },
2711
- saturday: { enabled: !1, from: 8, to: 18 }
2712
- };
2713
- function $e({ className: t }) {
2714
- return /* @__PURE__ */ e(
2715
- "svg",
2716
- {
2717
- className: t,
2718
- xmlns: "http://www.w3.org/2000/svg",
2719
- viewBox: "0 0 24 24",
2720
- fill: "none",
2721
- stroke: "currentColor",
2722
- strokeWidth: "3",
2723
- strokeLinecap: "round",
2724
- strokeLinejoin: "round",
2725
- children: /* @__PURE__ */ e("polyline", { points: "20 6 9 17 4 12" })
2726
- }
2727
- );
2728
- }
2729
- function Tr({ className: t }) {
2730
- return /* @__PURE__ */ n(
2731
- "svg",
2732
- {
2733
- className: t,
2734
- xmlns: "http://www.w3.org/2000/svg",
2735
- viewBox: "0 0 24 24",
2736
- fill: "none",
2737
- stroke: "currentColor",
2738
- strokeWidth: "2",
2739
- strokeLinecap: "round",
2740
- strokeLinejoin: "round",
2741
- children: [
2742
- /* @__PURE__ */ e("circle", { cx: "11", cy: "11", r: "8" }),
2743
- /* @__PURE__ */ e("line", { x1: "21", y1: "21", x2: "16.65", y2: "16.65" })
2744
- ]
2745
- }
2746
- );
2747
- }
2748
- function Lr({ className: t }) {
2749
- return /* @__PURE__ */ n(
2750
- "svg",
2751
- {
2752
- className: t,
2753
- xmlns: "http://www.w3.org/2000/svg",
2754
- viewBox: "0 0 24 24",
2755
- fill: "none",
2756
- stroke: "currentColor",
2757
- strokeWidth: "2",
2758
- strokeLinecap: "round",
2759
- strokeLinejoin: "round",
2760
- children: [
2761
- /* @__PURE__ */ e("line", { x1: "18", y1: "6", x2: "6", y2: "18" }),
2762
- /* @__PURE__ */ e("line", { x1: "6", y1: "6", x2: "18", y2: "18" })
2763
- ]
2764
- }
2765
- );
2766
- }
2767
- function Pe({ checked: t, onCheckedChange: r, className: o, children: a }) {
2768
- return /* @__PURE__ */ e(
2769
- "button",
2770
- {
2771
- type: "button",
2772
- role: "checkbox",
2773
- "aria-checked": t,
2774
- onClick: () => r(!t),
2775
- className: o,
2776
- children: a
2777
- }
2778
- );
2779
- }
2780
- function Hr({ src: t, alt: r, fallback: o, className: a }) {
2781
- const [i, l] = se(!1);
2782
- return !t || i ? /* @__PURE__ */ e(
2783
- "div",
2784
- {
2785
- className: m(
2786
- "flex items-center justify-center bg-zinc-200 text-zinc-600 font-medium text-sm",
2787
- a
2788
- ),
2789
- children: o || "?"
2790
- }
2791
- ) : /* @__PURE__ */ e(
2792
- "img",
2793
- {
2794
- src: t,
2795
- alt: r || "",
2796
- className: m("object-cover", a),
2797
- onError: () => l(!0)
2798
- }
2799
- );
2800
- }
2801
- function et({ value: t, onChange: r, placeholder: o, className: a }) {
2802
- return /* @__PURE__ */ n("div", { className: m("relative", a), children: [
2803
- /* @__PURE__ */ e(Tr, { className: "absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground" }),
2804
- /* @__PURE__ */ e(
2805
- "input",
2806
- {
2807
- type: "text",
2808
- value: t,
2809
- onChange: (i) => r(i.target.value),
2810
- placeholder: o,
2811
- className: "h-9 w-full rounded-lg border border-border bg-white pl-9 pr-3 text-sm placeholder:text-muted-foreground focus:border-primary focus:outline-none focus:ring-1 focus:ring-primary"
2812
- }
2813
- )
2814
- ] });
2815
- }
2816
- function tt(t, r, o, a = 0.3) {
2817
- if (!r.trim()) return t;
2818
- const i = r.toLowerCase();
2819
- return t.filter((l) => o(l).some((f) => f ? f.toLowerCase().includes(i) : !1));
2820
- }
2821
- const Ir = {
2822
- title: "Filters",
2823
- subtitle: "Filter calendar events",
2824
- scheduleTypes: "Event Types",
2825
- participants: "Participants",
2826
- clearAll: "Clear all",
2827
- selectAll: "Select all",
2828
- unselectAll: "Unselect all",
2829
- searchScheduleTypes: "Search event types...",
2830
- searchParticipants: "Search participants...",
2831
- noScheduleTypes: "No event types found",
2832
- noParticipants: "No participants found"
2833
- };
2834
- function vn({
2835
- scheduleTypes: t,
2836
- users: r,
2837
- selectedScheduleTypeIds: o,
2838
- onScheduleTypeChange: a,
2839
- selectedUserIds: i,
2840
- onUserChange: l,
2841
- onClearAll: p,
2842
- className: f,
2843
- scheduleTypesLoading: d = !1,
2844
- usersLoading: x = !1,
2845
- labels: y,
2846
- getScheduleTypeName: v
2847
- }) {
2848
- const L = { ...Ir, ...y }, [F, I] = se(""), [W, E] = se(""), N = G(() => F.trim() ? tt(t, F, (u) => [
2849
- u.name,
2850
- v?.(u) || u.name
2851
- ]) : t, [t, F, v]), j = G(() => W.trim() ? tt(r, W, (u) => [u.name, u.email || ""]) : r, [r, W]), B = N.length > 0 && N.every((u) => o.includes(u.id)), O = j.length > 0 && j.every((u) => i.includes(u.id)), C = o.length + i.length, K = (u, k) => {
2852
- const $ = k ? [...o, u] : o.filter((P) => P !== u);
2853
- a($);
2854
- }, H = () => {
2855
- if (B) {
2856
- const u = new Set(N.map((k) => k.id));
2857
- a(o.filter((k) => !u.has(k)));
2858
- } else {
2859
- const u = /* @__PURE__ */ new Set([
2860
- ...o,
2861
- ...N.map((k) => k.id)
2862
- ]);
2863
- a(Array.from(u));
2864
- }
2865
- }, T = (u, k) => {
2866
- const $ = k ? [...i, u] : i.filter((P) => P !== u);
2867
- l($);
2868
- }, _ = () => {
2869
- if (O) {
2870
- const u = new Set(j.map((k) => k.id));
2871
- l(i.filter((k) => !u.has(k)));
2872
- } else {
2873
- const u = /* @__PURE__ */ new Set([...i, ...j.map((k) => k.id)]);
2874
- l(Array.from(u));
2875
- }
2876
- }, q = () => {
2877
- a([]), l([]), p?.();
2878
- }, R = (u) => v ? v(u) : u.name, A = (u) => u.colorHex || u.color || "#069AD7";
2879
- return /* @__PURE__ */ n(
2880
- "div",
2881
- {
2882
- className: m(
2883
- "flex min-w-72 max-w-72 flex-col rounded-lg border bg-white shadow-sm",
2884
- f
2885
- ),
2886
- children: [
2887
- /* @__PURE__ */ n("header", { className: "flex items-start justify-between gap-2 px-4 pb-2 pt-4", children: [
2888
- /* @__PURE__ */ n("div", { className: "flex flex-col", children: [
2889
- /* @__PURE__ */ e("h3", { className: "text-base font-semibold text-foreground", children: L.title }),
2890
- /* @__PURE__ */ e("p", { className: "text-xs text-muted-foreground", children: L.subtitle })
2891
- ] }),
2892
- C > 0 && /* @__PURE__ */ n(
2893
- "button",
2894
- {
2895
- type: "button",
2896
- onClick: q,
2897
- className: "flex h-auto items-center gap-1 rounded-md px-2 py-1 text-xs font-medium text-destructive transition-colors hover:bg-destructive/10",
2898
- children: [
2899
- /* @__PURE__ */ e(Lr, { className: "h-3.5 w-3.5" }),
2900
- L.clearAll
2901
- ]
2902
- }
2903
- )
2904
- ] }),
2905
- /* @__PURE__ */ e("div", { className: "h-px w-full bg-border/60" }),
2906
- /* @__PURE__ */ n("section", { className: "flex flex-col", children: [
2907
- /* @__PURE__ */ n("div", { className: "flex items-center justify-between px-4 py-3", children: [
2908
- /* @__PURE__ */ e("h4", { className: "text-sm font-medium text-foreground", children: L.scheduleTypes }),
2909
- /* @__PURE__ */ e(
2910
- "button",
2911
- {
2912
- type: "button",
2913
- onClick: H,
2914
- className: "text-xs font-medium text-primary transition-colors hover:text-primary/80",
2915
- children: B ? L.unselectAll : L.selectAll
2916
- }
2917
- )
2918
- ] }),
2919
- t.length > 6 && /* @__PURE__ */ e("div", { className: "px-4 pb-3", children: /* @__PURE__ */ e(
2920
- et,
2921
- {
2922
- value: F,
2923
- onChange: I,
2924
- placeholder: L.searchScheduleTypes
2925
- }
2926
- ) }),
2927
- /* @__PURE__ */ n("div", { className: "flex max-h-[220px] flex-col gap-2 overflow-y-auto px-4 pb-2 scrollbar-thin", children: [
2928
- d ? (
2929
- // Loading skeletons
2930
- Array.from({ length: 4 }).map((u, k) => /* @__PURE__ */ n(
2931
- "div",
2932
- {
2933
- className: "flex animate-pulse items-center gap-2 rounded-md border border-border/60 bg-muted/40 p-2",
2934
- children: [
2935
- /* @__PURE__ */ e("div", { className: "h-5 w-5 rounded bg-muted-foreground/20" }),
2936
- /* @__PURE__ */ e("div", { className: "h-3 w-24 rounded bg-muted-foreground/20" })
2937
- ]
2938
- },
2939
- `skeleton-${k}`
2940
- ))
2941
- ) : N.map((u) => {
2942
- const k = o.includes(u.id), $ = A(u);
2943
- return /* @__PURE__ */ n(
2944
- Pe,
2945
- {
2946
- checked: k,
2947
- onCheckedChange: (P) => K(u.id, P),
2948
- className: m(
2949
- "relative flex w-full cursor-pointer items-center justify-between gap-3 rounded-md border border-border bg-white px-3 py-2 transition-colors hover:border-primary/50",
2950
- k && "border-primary bg-primary/5"
2951
- ),
2952
- children: [
2953
- /* @__PURE__ */ n("div", { className: "flex items-center gap-2", children: [
2954
- /* @__PURE__ */ e(
2955
- "span",
2956
- {
2957
- className: m(
2958
- "flex h-4 w-4 items-center justify-center rounded border border-border text-xs transition-colors",
2959
- k && "border-primary bg-primary text-primary-foreground"
2960
- ),
2961
- children: k && /* @__PURE__ */ e($e, { className: "h-3 w-3" })
2962
- }
2963
- ),
2964
- /* @__PURE__ */ e("span", { className: "text-sm font-medium text-foreground", children: R(u) })
2965
- ] }),
2966
- /* @__PURE__ */ e(
2967
- "div",
2968
- {
2969
- className: "h-4 w-4 rounded-full border",
2970
- style: {
2971
- backgroundColor: $,
2972
- borderColor: $
2973
- }
2974
- }
2975
- )
2976
- ]
2977
- },
2978
- u.id
2979
- );
2980
- }),
2981
- !d && N.length === 0 && /* @__PURE__ */ e("p", { className: "px-2 py-1 text-xs text-muted-foreground", children: L.noScheduleTypes })
2982
- ] })
2983
- ] }),
2984
- /* @__PURE__ */ e("div", { className: "h-px w-full bg-border/60" }),
2985
- /* @__PURE__ */ n("section", { className: "flex flex-col", children: [
2986
- /* @__PURE__ */ n("div", { className: "flex items-center justify-between px-4 py-3", children: [
2987
- /* @__PURE__ */ e("h4", { className: "text-sm font-medium text-foreground", children: L.participants }),
2988
- /* @__PURE__ */ e(
2989
- Pe,
2990
- {
2991
- checked: O,
2992
- onCheckedChange: () => _(),
2993
- className: m(
2994
- "flex h-5 w-5 items-center justify-center rounded border border-border bg-white transition-colors hover:border-primary/50",
2995
- O && "border-primary bg-primary text-primary-foreground"
2996
- ),
2997
- children: O && /* @__PURE__ */ e($e, { className: "h-3.5 w-3.5" })
2998
- }
2999
- )
3000
- ] }),
3001
- /* @__PURE__ */ e("div", { className: "px-4 pb-3", children: /* @__PURE__ */ e(
3002
- et,
3003
- {
3004
- value: W,
3005
- onChange: E,
3006
- placeholder: L.searchParticipants
3007
- }
3008
- ) }),
3009
- /* @__PURE__ */ n("div", { className: "flex max-h-[400px] flex-col gap-2 overflow-y-auto px-4 pb-4 scrollbar-thin", children: [
3010
- x ? (
3011
- // Loading skeletons
3012
- Array.from({ length: 4 }).map((u, k) => /* @__PURE__ */ n(
3013
- "div",
3014
- {
3015
- className: "flex animate-pulse items-center gap-3 rounded-md border border-border/60 bg-muted/40 p-3",
3016
- children: [
3017
- /* @__PURE__ */ e("div", { className: "h-5 w-5 rounded bg-muted-foreground/20" }),
3018
- /* @__PURE__ */ e("div", { className: "h-10 w-10 rounded-full bg-muted-foreground/20" }),
3019
- /* @__PURE__ */ n("div", { className: "space-y-2", children: [
3020
- /* @__PURE__ */ e("div", { className: "h-3 w-24 rounded bg-muted-foreground/20" }),
3021
- /* @__PURE__ */ e("div", { className: "h-2 w-32 rounded bg-muted-foreground/10" })
3022
- ] })
3023
- ]
3024
- },
3025
- `p-skeleton-${k}`
3026
- ))
3027
- ) : j.map((u) => {
3028
- const k = i.includes(u.id);
3029
- return /* @__PURE__ */ n(
3030
- Pe,
3031
- {
3032
- checked: k,
3033
- onCheckedChange: ($) => T(u.id, $),
3034
- className: m(
3035
- "relative flex w-full cursor-pointer items-start gap-2 rounded-lg border border-border bg-white p-2 transition-colors hover:border-primary/50",
3036
- k && "border-primary bg-zinc-50"
3037
- ),
3038
- children: [
3039
- /* @__PURE__ */ e(
3040
- "span",
3041
- {
3042
- className: m(
3043
- "flex h-4 w-4 flex-shrink-0 items-center justify-center rounded border border-border transition-colors",
3044
- k && "border-primary bg-primary text-primary-foreground"
3045
- ),
3046
- children: k && /* @__PURE__ */ e($e, { className: "h-2.5 w-2.5" })
3047
- }
3048
- ),
3049
- /* @__PURE__ */ n("div", { className: "flex flex-1 items-start gap-2", children: [
3050
- /* @__PURE__ */ e(
3051
- Hr,
3052
- {
3053
- src: u.avatar ?? null,
3054
- alt: u.name,
3055
- fallback: u.name?.[0]?.toUpperCase() ?? "?",
3056
- className: "h-10 w-10 rounded-lg"
3057
- }
3058
- ),
3059
- /* @__PURE__ */ n("div", { className: "flex max-w-[140px] flex-col gap-0.5 overflow-hidden", children: [
3060
- /* @__PURE__ */ e("span", { className: "line-clamp-1 text-sm font-medium text-foreground", children: u.name }),
3061
- /* @__PURE__ */ e(
3062
- "span",
3063
- {
3064
- className: "truncate text-[11px] text-muted-foreground",
3065
- title: u.email,
3066
- children: u.email
3067
- }
3068
- )
3069
- ] })
3070
- ] })
3071
- ]
3072
- },
3073
- u.id
3074
- );
3075
- }),
3076
- !x && j.length === 0 && /* @__PURE__ */ e("p", { className: "px-4 text-xs text-muted-foreground", children: L.noParticipants })
3077
- ] })
3078
- ] })
3079
- ]
3080
- }
3081
- );
3082
- }
3083
- function jr({ className: t }) {
3084
- return /* @__PURE__ */ n(
3085
- "svg",
3086
- {
3087
- className: t,
3088
- xmlns: "http://www.w3.org/2000/svg",
3089
- width: "24",
3090
- height: "24",
3091
- viewBox: "0 0 24 24",
3092
- fill: "none",
3093
- stroke: "currentColor",
3094
- strokeWidth: "2",
3095
- strokeLinecap: "round",
3096
- strokeLinejoin: "round",
3097
- children: [
3098
- /* @__PURE__ */ e("path", { d: "M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z" }),
3099
- /* @__PURE__ */ e("circle", { cx: "7.5", cy: "7.5", r: ".5", fill: "currentColor" })
3100
- ]
3101
- }
3102
- );
3103
- }
3104
- function wn({
3105
- scheduleTypes: t,
3106
- value: r,
3107
- onChange: o,
3108
- allLabel: a = "All types",
3109
- className: i,
3110
- label: l
3111
- }) {
3112
- const p = (d) => {
3113
- o(d.target.value);
3114
- }, f = t.find((d) => String(d.id) === r);
3115
- return /* @__PURE__ */ n("div", { className: m("flex flex-col gap-1", i), children: [
3116
- l && /* @__PURE__ */ e(le, { className: "text-xs text-muted-foreground", children: l }),
3117
- /* @__PURE__ */ n("div", { className: "relative", children: [
3118
- f ? /* @__PURE__ */ e(
3119
- "span",
3120
- {
3121
- className: "pointer-events-none absolute left-2.5 top-1/2 size-3 -translate-y-1/2 rounded-full",
3122
- style: { backgroundColor: f.color }
3123
- }
3124
- ) : /* @__PURE__ */ e(jr, { className: "pointer-events-none absolute left-2.5 top-1/2 size-4 -translate-y-1/2 text-muted-foreground" }),
3125
- /* @__PURE__ */ n(
3126
- me,
3127
- {
3128
- value: r,
3129
- onChange: p,
3130
- className: "h-9 w-full min-w-[140px] pl-8 pr-8 text-sm",
3131
- children: [
3132
- /* @__PURE__ */ e("option", { value: "all", children: a }),
3133
- t.map((d) => /* @__PURE__ */ e("option", { value: String(d.id), children: d.label }, d.id))
3134
- ]
3135
- }
3136
- )
3137
- ] })
3138
- ] });
3139
- }
3140
- function Wr({ className: t }) {
3141
- return /* @__PURE__ */ n(
3142
- "svg",
3143
- {
3144
- className: t,
3145
- xmlns: "http://www.w3.org/2000/svg",
3146
- width: "24",
3147
- height: "24",
3148
- viewBox: "0 0 24 24",
3149
- fill: "none",
3150
- stroke: "currentColor",
3151
- strokeWidth: "2",
3152
- strokeLinecap: "round",
3153
- strokeLinejoin: "round",
3154
- children: [
3155
- /* @__PURE__ */ e("path", { d: "M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2" }),
3156
- /* @__PURE__ */ e("circle", { cx: "9", cy: "7", r: "4" }),
3157
- /* @__PURE__ */ e("path", { d: "M22 21v-2a4 4 0 0 0-3-3.87" }),
3158
- /* @__PURE__ */ e("path", { d: "M16 3.13a4 4 0 0 1 0 7.75" })
3159
- ]
3160
- }
3161
- );
3162
- }
3163
- function bn({
3164
- users: t,
3165
- value: r,
3166
- onChange: o,
3167
- allLabel: a = "All users",
3168
- className: i,
3169
- label: l
3170
- }) {
3171
- const p = (f) => {
3172
- o(f.target.value);
3173
- };
3174
- return /* @__PURE__ */ n("div", { className: m("flex flex-col gap-1", i), children: [
3175
- l && /* @__PURE__ */ e(le, { className: "text-xs text-muted-foreground", children: l }),
3176
- /* @__PURE__ */ n("div", { className: "relative", children: [
3177
- /* @__PURE__ */ e(Wr, { className: "pointer-events-none absolute left-2.5 top-1/2 size-4 -translate-y-1/2 text-muted-foreground" }),
3178
- /* @__PURE__ */ n(
3179
- me,
3180
- {
3181
- value: r,
3182
- onChange: p,
3183
- className: "h-9 w-full min-w-[120px] pl-8 pr-8 text-sm",
3184
- children: [
3185
- /* @__PURE__ */ e("option", { value: "all", children: a }),
3186
- t.map((f) => /* @__PURE__ */ e("option", { value: f.id, children: f.name }, f.id))
3187
- ]
3188
- }
3189
- )
3190
- ] })
3191
- ] });
3192
- }
3193
- function Ar({ className: t }) {
3194
- return /* @__PURE__ */ n(
3195
- "svg",
3196
- {
3197
- xmlns: "http://www.w3.org/2000/svg",
3198
- viewBox: "0 0 24 24",
3199
- fill: "none",
3200
- stroke: "currentColor",
3201
- strokeWidth: 1.8,
3202
- strokeLinecap: "round",
3203
- strokeLinejoin: "round",
3204
- className: t,
3205
- children: [
3206
- /* @__PURE__ */ e("path", { d: "M8 2v4" }),
3207
- /* @__PURE__ */ e("path", { d: "M16 2v4" }),
3208
- /* @__PURE__ */ e("rect", { width: "18", height: "18", x: "3", y: "4", rx: "2" }),
3209
- /* @__PURE__ */ e("path", { d: "M3 10h18" }),
3210
- /* @__PURE__ */ e("path", { d: "M8 14h.01" }),
3211
- /* @__PURE__ */ e("path", { d: "M12 14h.01" }),
3212
- /* @__PURE__ */ e("path", { d: "M16 14h.01" }),
3213
- /* @__PURE__ */ e("path", { d: "M8 18h.01" }),
3214
- /* @__PURE__ */ e("path", { d: "M12 18h.01" }),
3215
- /* @__PURE__ */ e("path", { d: "M16 18h.01" })
3216
- ]
3217
- }
3218
- );
3219
- }
3220
- function Fr({ className: t }) {
3221
- return /* @__PURE__ */ n(
3222
- "svg",
3223
- {
3224
- xmlns: "http://www.w3.org/2000/svg",
3225
- viewBox: "0 0 24 24",
3226
- fill: "none",
3227
- stroke: "currentColor",
3228
- strokeWidth: 2,
3229
- strokeLinecap: "round",
3230
- strokeLinejoin: "round",
3231
- className: t,
3232
- children: [
3233
- /* @__PURE__ */ e("path", { d: "M21 7.5V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h3.5" }),
3234
- /* @__PURE__ */ e("path", { d: "M16 2v4" }),
3235
- /* @__PURE__ */ e("path", { d: "M8 2v4" }),
3236
- /* @__PURE__ */ e("path", { d: "M3 10h5" }),
3237
- /* @__PURE__ */ e("path", { d: "M17.5 17.5 16 16.3V14" }),
3238
- /* @__PURE__ */ e("circle", { cx: "16", cy: "16", r: "6" })
3239
- ]
3240
- }
3241
- );
3242
- }
3243
- function $r({ className: t }) {
3244
- return /* @__PURE__ */ e(
3245
- "svg",
3246
- {
3247
- xmlns: "http://www.w3.org/2000/svg",
3248
- viewBox: "0 0 24 24",
3249
- fill: "none",
3250
- stroke: "currentColor",
3251
- strokeWidth: 2,
3252
- strokeLinecap: "round",
3253
- strokeLinejoin: "round",
3254
- className: t,
3255
- children: /* @__PURE__ */ e("path", { d: "m9 18 6-6-6-6" })
3256
- }
3257
- );
3258
- }
3259
- function Pr({ className: t }) {
3260
- return /* @__PURE__ */ n(
3261
- "svg",
3262
- {
3263
- xmlns: "http://www.w3.org/2000/svg",
3264
- viewBox: "0 0 24 24",
3265
- fill: "none",
3266
- stroke: "currentColor",
3267
- strokeWidth: 2,
3268
- strokeLinecap: "round",
3269
- strokeLinejoin: "round",
3270
- className: t,
3271
- children: [
3272
- /* @__PURE__ */ e("path", { d: "M15 3h6v6" }),
3273
- /* @__PURE__ */ e("path", { d: "M10 14 21 3" }),
3274
- /* @__PURE__ */ e("path", { d: "M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6" })
3275
- ]
3276
- }
3277
- );
3278
- }
3279
- function Br(t) {
3280
- const r = t.getFullYear(), o = String(t.getMonth() + 1).padStart(2, "0"), a = String(t.getDate()).padStart(2, "0");
3281
- return `${r}-${o}-${a}`;
3282
- }
3283
- function rt(t) {
3284
- const r = t.getHours(), o = t.getMinutes(), a = r >= 12 ? "PM" : "AM", i = r % 12 || 12, l = String(o).padStart(2, "0");
3285
- return `${i}:${l} ${a}`;
3286
- }
3287
- function Or(t) {
3288
- const r = rt(t.startDate), o = rt(t.endDate);
3289
- return `${r} - ${o}`;
3290
- }
3291
- function _r(t) {
3292
- const r = ct(/* @__PURE__ */ new Date(), 1);
3293
- return t.getFullYear() === r.getFullYear() && t.getMonth() === r.getMonth() && t.getDate() === r.getDate();
3294
- }
3295
- function Rr(t) {
3296
- if (oe(t)) return "Today";
3297
- if (_r(t)) return "Tomorrow";
3298
- const r = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"], o = [
3299
- "Jan",
3300
- "Feb",
3301
- "Mar",
3302
- "Apr",
3303
- "May",
3304
- "Jun",
3305
- "Jul",
3306
- "Aug",
3307
- "Sep",
3308
- "Oct",
3309
- "Nov",
3310
- "Dec"
3311
- ], a = r[t.getDay()], i = o[t.getMonth()], l = t.getDate();
3312
- return `${a}, ${i} ${l}`;
3313
- }
3314
- function Vr(t, r) {
3315
- const o = /* @__PURE__ */ new Map();
3316
- for (const a of t) {
3317
- const i = Br(a.startDate), l = o.get(i) ?? [];
3318
- l.push(a), o.set(i, l);
3319
- }
3320
- return Array.from(o.entries()).map(([a, i]) => {
3321
- const l = [...i].sort(
3322
- (f, d) => f.startDate.getTime() - d.startDate.getTime()
3323
- ), p = r > 0 ? l.slice(0, r) : l;
3324
- return {
3325
- date: new Date(a),
3326
- dateKey: a,
3327
- events: p,
3328
- hasMore: r > 0 && l.length > r
3329
- };
3330
- }).sort((a, i) => a.date.getTime() - i.date.getTime());
3331
- }
3332
- function Ur(t) {
3333
- const r = We(/* @__PURE__ */ new Date()), o = lt(/* @__PURE__ */ new Date());
3334
- return t.filter((a) => a.startDate >= r && a.startDate <= o).length;
3335
- }
3336
- function Be({ className: t }) {
3337
- return /* @__PURE__ */ e("div", { className: m("animate-pulse rounded-md bg-muted", t) });
3338
- }
3339
- function Yr({ event: t, onClick: r }) {
3340
- return /* @__PURE__ */ n(
3341
- "button",
3342
- {
3343
- type: "button",
3344
- onClick: () => r?.(t),
3345
- className: m(
3346
- "w-full text-left rounded-lg transition-colors",
3347
- "hover:bg-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
3348
- "flex items-start gap-3 p-2"
3349
- ),
3350
- children: [
3351
- /* @__PURE__ */ e(
3352
- "div",
3353
- {
3354
- className: "shrink-0 rounded-full mt-1.5 size-2",
3355
- style: { backgroundColor: t.color ?? "#3b82f6" }
3356
- }
3357
- ),
3358
- /* @__PURE__ */ n("div", { className: "min-w-0 flex-1", children: [
3359
- /* @__PURE__ */ e("p", { className: "text-sm font-medium truncate", children: t.title }),
3360
- /* @__PURE__ */ e("p", { className: "text-xs text-muted-foreground truncate", children: Or(t) })
3361
- ] }),
3362
- r && /* @__PURE__ */ e($r, { className: "shrink-0 size-4 text-muted-foreground/50 mt-1" })
3363
- ]
3364
- }
3365
- );
3366
- }
3367
- function Gr({ group: t, onEventClick: r }) {
3368
- return /* @__PURE__ */ n("div", { className: "space-y-1", children: [
3369
- /* @__PURE__ */ n("div", { className: "flex items-center justify-between px-2 py-1.5", children: [
3370
- /* @__PURE__ */ e("h3", { className: m("text-xs font-semibold", oe(t.date) && "text-primary"), children: Rr(t.date) }),
3371
- t.hasMore && /* @__PURE__ */ n("span", { className: "text-[10px] text-muted-foreground", children: [
3372
- "+",
3373
- t.events.length,
3374
- " more"
3375
- ] })
3376
- ] }),
3377
- /* @__PURE__ */ e("div", { className: "space-y-0.5", children: t.events.map((o) => /* @__PURE__ */ e(Yr, { event: o, onClick: r }, o.id)) })
3378
- ] });
3379
- }
3380
- function yn({
3381
- events: t,
3382
- isLoading: r = !1,
3383
- className: o,
3384
- daysAhead: a = 7,
3385
- maxEventsPerDay: i = 3,
3386
- onEventClick: l,
3387
- onNavigateToAgenda: p
3388
- }) {
3389
- const [f, d] = se(!1), x = G(() => {
3390
- const I = We(/* @__PURE__ */ new Date()), W = ct(I, a);
3391
- return t.filter((E) => E.endDate >= I && E.startDate < W);
3392
- }, [t, a]), y = G(
3393
- () => Vr(x, i),
3394
- [x, i]
3395
- ), v = G(() => Ur(t), [t]), L = (I) => {
3396
- d(!1), l?.(I);
3397
- }, F = () => {
3398
- d(!1), p?.();
3399
- };
3400
- return /* @__PURE__ */ n(st, { open: f, onOpenChange: d, children: [
3401
- /* @__PURE__ */ n(
3402
- at,
3403
- {
3404
- className: m(
3405
- "relative rounded-xl hover:text-zinc-700 hover:!bg-zinc-300 !bg-zinc-200 text-zinc-600 shadow-none !px-2.5 p-2 max-h-10",
3406
- o
3407
- ),
3408
- children: [
3409
- /* @__PURE__ */ e(Ar, { className: "h-4 w-4" }),
3410
- v > 0 && /* @__PURE__ */ e(
3411
- Dt,
3412
- {
3413
- variant: "destructive",
3414
- className: "absolute -right-4 -top-4 m-3 flex h-5 w-5 items-center justify-center rounded-full bg-primary p-0 text-[10px] font-medium hover:bg-primary",
3415
- children: v > 99 ? "99+" : v
3416
- }
3417
- )
3418
- ]
3419
- }
3420
- ),
3421
- /* @__PURE__ */ n(it, { className: "w-80 rounded-xl p-0", align: "end", side: "bottom", sideOffset: 8, children: [
3422
- /* @__PURE__ */ n("div", { className: "flex items-center justify-between border-b p-4", children: [
3423
- /* @__PURE__ */ n("div", { children: [
3424
- /* @__PURE__ */ e("h3", { className: "text-sm font-semibold", children: "Upcoming" }),
3425
- /* @__PURE__ */ e("p", { className: "text-xs text-muted-foreground", children: v > 0 ? `${v} event${v > 1 ? "s" : ""} today` : "No events today" })
3426
- ] }),
3427
- p && /* @__PURE__ */ n(
3428
- "button",
3429
- {
3430
- type: "button",
3431
- onClick: F,
3432
- className: "text-xs text-primary hover:underline flex items-center gap-1",
3433
- children: [
3434
- "View all",
3435
- /* @__PURE__ */ e(Pr, { className: "size-3" })
3436
- ]
3437
- }
3438
- )
3439
- ] }),
3440
- /* @__PURE__ */ e("div", { className: "max-h-80 overflow-y-auto p-2", children: r ? /* @__PURE__ */ e("div", { className: "space-y-2 p-2", children: Array.from({ length: 3 }).map((I, W) => /* @__PURE__ */ n("div", { className: "flex space-x-3", children: [
3441
- /* @__PURE__ */ e(Be, { className: "h-2 w-2 rounded-full mt-2" }),
3442
- /* @__PURE__ */ n("div", { className: "flex-1 space-y-2", children: [
3443
- /* @__PURE__ */ e(Be, { className: "h-4 w-full" }),
3444
- /* @__PURE__ */ e(Be, { className: "h-3 w-3/4" })
3445
- ] })
3446
- ] }, W)) }) : y.length === 0 ? /* @__PURE__ */ n("div", { className: "flex flex-col items-center justify-center py-8 text-center", children: [
3447
- /* @__PURE__ */ e(Fr, { className: "mb-2 h-8 w-8 text-muted-foreground/50" }),
3448
- /* @__PURE__ */ e("p", { className: "text-sm text-muted-foreground", children: "No upcoming events" }),
3449
- /* @__PURE__ */ n("p", { className: "text-xs text-muted-foreground/70", children: [
3450
- "Your schedule is clear for the next ",
3451
- a,
3452
- " days"
3453
- ] })
3454
- ] }) : /* @__PURE__ */ e("div", { className: "space-y-3 divide-y", children: y.map((I) => /* @__PURE__ */ e(
3455
- Gr,
3456
- {
3457
- group: I,
3458
- onEventClick: L
3459
- },
3460
- I.dateKey
3461
- )) }) })
3462
- ] })
3463
- ] });
3464
- }
3465
- function Kr({ className: t }) {
3466
- return /* @__PURE__ */ n(
3467
- "svg",
3468
- {
3469
- xmlns: "http://www.w3.org/2000/svg",
3470
- width: "24",
3471
- height: "24",
3472
- viewBox: "0 0 24 24",
3473
- fill: "none",
3474
- stroke: "currentColor",
3475
- strokeWidth: "2",
3476
- strokeLinecap: "round",
3477
- strokeLinejoin: "round",
3478
- className: t,
3479
- children: [
3480
- /* @__PURE__ */ e("path", { d: "M21 7.5V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h3.5" }),
3481
- /* @__PURE__ */ e("path", { d: "M16 2v4" }),
3482
- /* @__PURE__ */ e("path", { d: "M8 2v4" }),
3483
- /* @__PURE__ */ e("path", { d: "M3 10h5" }),
3484
- /* @__PURE__ */ e("path", { d: "M17.5 17.5 16 16.25V14" }),
3485
- /* @__PURE__ */ e("circle", { cx: "16", cy: "16", r: "6" })
3486
- ]
3487
- }
3488
- );
3489
- }
3490
- function ut({ className: t }) {
3491
- return /* @__PURE__ */ e(
3492
- "svg",
3493
- {
3494
- xmlns: "http://www.w3.org/2000/svg",
3495
- width: "24",
3496
- height: "24",
3497
- viewBox: "0 0 24 24",
3498
- fill: "none",
3499
- stroke: "currentColor",
3500
- strokeWidth: "2",
3501
- strokeLinecap: "round",
3502
- strokeLinejoin: "round",
3503
- className: t,
3504
- children: /* @__PURE__ */ e("path", { d: "m9 18 6-6-6-6" })
3505
- }
3506
- );
3507
- }
3508
- function qr(t) {
3509
- const r = /* @__PURE__ */ new Date();
3510
- return r.setDate(r.getDate() + 1), t.getFullYear() === r.getFullYear() && t.getMonth() === r.getMonth() && t.getDate() === r.getDate();
3511
- }
3512
- function nt(t) {
3513
- const r = t.getHours(), o = t.getMinutes(), a = r >= 12 ? "PM" : "AM";
3514
- return `${r % 12 || 12}:${o.toString().padStart(2, "0")} ${a}`;
3515
- }
3516
- function Jr(t) {
3517
- return new Intl.DateTimeFormat("en-US", {
3518
- weekday: "long",
3519
- month: "short",
3520
- day: "numeric"
3521
- }).format(t);
3522
- }
3523
- function Xr(t) {
3524
- const r = nt(t.startDate), o = nt(t.endDate);
3525
- return `${r} - ${o}`;
3526
- }
3527
- function Qr(t) {
3528
- return oe(t) ? "Today" : qr(t) ? "Tomorrow" : Jr(t);
3529
- }
3530
- function Zr(t, r) {
3531
- const o = /* @__PURE__ */ new Map();
3532
- for (const a of t) {
3533
- const i = jt(a.startDate), l = o.get(i) ?? [];
3534
- l.push(a), o.set(i, l);
3535
- }
3536
- return Array.from(o.entries()).map(([a, i]) => {
3537
- const l = [...i].sort(
3538
- (f, d) => f.startDate.getTime() - d.startDate.getTime()
3539
- ), p = r > 0 ? l.slice(0, r) : l;
3540
- return {
3541
- date: new Date(a),
3542
- dateKey: a,
3543
- events: p,
3544
- hasMore: r > 0 && l.length > r
3545
- };
3546
- }).sort((a, i) => a.date.getTime() - i.date.getTime());
3547
- }
3548
- function en({ event: t, onClick: r, compact: o }) {
3549
- return /* @__PURE__ */ n(
3550
- "button",
3551
- {
3552
- type: "button",
3553
- onClick: () => r?.(t),
3554
- className: m(
3555
- "w-full text-left rounded-lg transition-colors",
3556
- "hover:bg-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
3557
- "flex items-start gap-3",
3558
- o ? "p-2" : "p-3"
3559
- ),
3560
- children: [
3561
- /* @__PURE__ */ e(
3562
- "div",
3563
- {
3564
- className: m("shrink-0 rounded-full mt-1", o ? "size-2" : "size-2.5"),
3565
- style: { backgroundColor: t.color ?? "#3b82f6" }
3566
- }
3567
- ),
3568
- /* @__PURE__ */ n("div", { className: "min-w-0 flex-1", children: [
3569
- /* @__PURE__ */ e("p", { className: m("font-medium truncate", o ? "text-xs" : "text-sm"), children: t.title }),
3570
- /* @__PURE__ */ e("p", { className: m("text-muted-foreground truncate", o ? "text-[10px]" : "text-xs"), children: Xr(t) })
3571
- ] }),
3572
- r && /* @__PURE__ */ e(
3573
- ut,
3574
- {
3575
- className: m("shrink-0 text-muted-foreground/50", o ? "size-3" : "size-4")
3576
- }
3577
- )
3578
- ]
3579
- }
3580
- );
3581
- }
3582
- function tn({
3583
- group: t,
3584
- onEventClick: r,
3585
- onViewMore: o,
3586
- compact: a
3587
- }) {
3588
- return /* @__PURE__ */ n("div", { className: "space-y-1", children: [
3589
- /* @__PURE__ */ n("div", { className: m("flex items-center justify-between px-2", a ? "py-1" : "py-1.5"), children: [
3590
- /* @__PURE__ */ e(
3591
- "h3",
3592
- {
3593
- className: m(
3594
- "font-semibold",
3595
- a ? "text-xs" : "text-sm",
3596
- oe(t.date) && "text-primary"
3597
- ),
3598
- children: Qr(t.date)
3599
- }
3600
- ),
3601
- t.hasMore && o && /* @__PURE__ */ e(
3602
- "button",
3603
- {
3604
- type: "button",
3605
- onClick: () => o(t.date),
3606
- className: m("text-primary hover:underline", a ? "text-[10px]" : "text-xs"),
3607
- children: "+more"
3608
- }
3609
- )
3610
- ] }),
3611
- /* @__PURE__ */ e("div", { className: "space-y-0.5", children: t.events.map((i) => /* @__PURE__ */ e(en, { event: i, onClick: r, compact: a }, i.id)) })
3612
- ] });
3613
- }
3614
- function kn({
3615
- events: t,
3616
- daysAhead: r = 7,
3617
- maxEventsPerDay: o = 3,
3618
- onEventClick: a,
3619
- onViewAll: i,
3620
- className: l,
3621
- emptyState: p,
3622
- title: f = "Upcoming",
3623
- showHeader: d = !0,
3624
- compact: x = !1
3625
- }) {
3626
- const y = ot(), v = y?.filteredEvents, L = y?.currentDate ?? /* @__PURE__ */ new Date(), F = t ?? v ?? [], I = G(() => {
3627
- const N = We(L), j = new Date(N);
3628
- return j.setDate(j.getDate() + r), F.filter((B) => B.endDate >= N && B.startDate < j);
3629
- }, [F, r, L]), W = G(
3630
- () => Zr(I, o),
3631
- [I, o]
3632
- ), E = I.length;
3633
- return W.length === 0 ? /* @__PURE__ */ n("div", { className: m("rounded-lg border bg-card", l), children: [
3634
- d && /* @__PURE__ */ e(
3635
- "div",
3636
- {
3637
- className: m(
3638
- "border-b px-4 flex items-center justify-between",
3639
- x ? "py-2" : "py-3"
3640
- ),
3641
- children: /* @__PURE__ */ e("h2", { className: m("font-semibold", x ? "text-sm" : "text-base"), children: f })
3642
- }
3643
- ),
3644
- /* @__PURE__ */ e(
3645
- "div",
3646
- {
3647
- className: m(
3648
- "flex flex-col items-center justify-center text-center",
3649
- x ? "py-6 px-4" : "py-10 px-6"
3650
- ),
3651
- children: p ?? /* @__PURE__ */ n(ge, { children: [
3652
- /* @__PURE__ */ e(
3653
- Kr,
3654
- {
3655
- className: m("text-muted-foreground/50 mb-2", x ? "size-8" : "size-10")
3656
- }
3657
- ),
3658
- /* @__PURE__ */ e("p", { className: m("text-muted-foreground", x ? "text-xs" : "text-sm"), children: "No upcoming events" })
3659
- ] })
3660
- }
3661
- )
3662
- ] }) : /* @__PURE__ */ n("div", { className: m("rounded-lg border bg-card overflow-hidden", l), children: [
3663
- d && /* @__PURE__ */ n(
3664
- "div",
3665
- {
3666
- className: m(
3667
- "border-b px-4 flex items-center justify-between",
3668
- x ? "py-2" : "py-3"
3669
- ),
3670
- children: [
3671
- /* @__PURE__ */ n("div", { className: "flex items-center gap-2", children: [
3672
- /* @__PURE__ */ e("h2", { className: m("font-semibold", x ? "text-sm" : "text-base"), children: f }),
3673
- /* @__PURE__ */ e(
3674
- "span",
3675
- {
3676
- className: m(
3677
- "text-muted-foreground bg-muted rounded-full px-2",
3678
- x ? "text-[10px] py-0" : "text-xs py-0.5"
3679
- ),
3680
- children: E
3681
- }
3682
- )
3683
- ] }),
3684
- i && /* @__PURE__ */ n(
3685
- "button",
3686
- {
3687
- type: "button",
3688
- onClick: () => i(),
3689
- className: m(
3690
- "text-primary hover:underline flex items-center gap-0.5",
3691
- x ? "text-xs" : "text-sm"
3692
- ),
3693
- children: [
3694
- "View all",
3695
- /* @__PURE__ */ e(ut, { className: "size-3" })
3696
- ]
3697
- }
3698
- )
3699
- ]
3700
- }
3701
- ),
3702
- /* @__PURE__ */ e(
3703
- "div",
3704
- {
3705
- className: m(
3706
- "divide-y overflow-auto",
3707
- x ? "p-2 max-h-[280px]" : "p-3 max-h-[400px]"
3708
- ),
3709
- children: W.map((N) => /* @__PURE__ */ e(
3710
- tn,
3711
- {
3712
- group: N,
3713
- onEventClick: a,
3714
- onViewMore: i ? (j) => i(j) : void 0,
3715
- compact: x
3716
- },
3717
- N.dateKey
3718
- ))
3719
- }
3720
- )
3721
- ] });
3722
- }
3723
- export {
3724
- yn as A,
3725
- fn as B,
3726
- dn as C,
3727
- xn as D,
3728
- un as E,
3729
- hn as I,
3730
- wn as S,
3731
- Ee as T,
3732
- bn as U,
3733
- gn as V,
3734
- pn as W,
3735
- ur as Y,
3736
- kn as a,
3737
- vn as b,
3738
- mn as c
3739
- };
3740
- //# sourceMappingURL=agenda-widget-DHq2DsjV.js.map