@nice2dev/ui 1.0.30 → 1.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (126) hide show
  1. package/CHANGELOG.md +848 -0
  2. package/README.md +30 -31
  3. package/dist/NiceCalendarScheduler.doc-BEtQkZjV.cjs +9 -0
  4. package/dist/NiceCalendarScheduler.doc-D__LRgOx.js +33 -0
  5. package/dist/NiceCodeEditor-BVUwp9yX.js +1134 -0
  6. package/dist/NiceCodeEditor-cIqUSk3j.cjs +260 -0
  7. package/dist/NiceColorPicker-C8NZZcXE.js +596 -0
  8. package/dist/NiceColorPicker-CKVbjicN.cjs +1 -0
  9. package/dist/NiceConfirmDialog-B57cl_F7.cjs +1 -0
  10. package/dist/NiceConfirmDialog-DmBX1Iea.js +81 -0
  11. package/dist/NiceConfirmDialog-N9fBTLYm.js +81 -0
  12. package/dist/NiceConfirmDialog-oSxVpsCs.cjs +1 -0
  13. package/dist/NiceDataGrid-3AIf2D3t.cjs +10 -0
  14. package/dist/NiceDataGrid-CXCUAkRb.js +1736 -0
  15. package/dist/NiceDocumentViewer-B-uEPZAf.js +672 -0
  16. package/dist/NiceDocumentViewer-BE0gKBlw.cjs +180 -0
  17. package/dist/NiceDrawingCanvas.doc-Dv5vB4gY.js +32 -0
  18. package/dist/NiceDrawingCanvas.doc-Ww9zz17x.cjs +8 -0
  19. package/dist/NiceErrorBoundary-BD-uqk_q.js +709 -0
  20. package/dist/NiceErrorBoundary-CIPXaYik.cjs +1 -0
  21. package/dist/NiceFileManagerViews.doc-CKlnm6cX.cjs +1 -0
  22. package/dist/NiceFileManagerViews.doc-Cg21DArG.js +25 -0
  23. package/dist/NiceForm-BNZB31Pg.js +4499 -0
  24. package/dist/NiceForm-C6F0HvrX.cjs +1 -0
  25. package/dist/NiceForm-CCyfWgIs.js +4805 -0
  26. package/dist/NiceForm-CPyAXxBO.cjs +1 -0
  27. package/dist/NiceGantt-CSFLZD2y.js +328 -0
  28. package/dist/NiceGantt-_ysNSVYR.cjs +1 -0
  29. package/dist/NiceHtmlEditor-B8B8AcSC.js +841 -0
  30. package/dist/NiceHtmlEditor-D8RQcBNp.cjs +10 -0
  31. package/dist/NiceLoginForm-Bai7aN8V.js +708 -0
  32. package/dist/NiceLoginForm-BrvIc-wq.cjs +1 -0
  33. package/dist/NiceMegaMenu.doc-7UyOCd3l.cjs +7 -0
  34. package/dist/NiceMegaMenu.doc-zeIyVa65.js +31 -0
  35. package/dist/NiceMention-CWoLD0SE.js +11082 -0
  36. package/dist/NiceMention-J1lUDLhg.cjs +430 -0
  37. package/dist/NiceMention.css +1 -0
  38. package/dist/NiceModal-0UxviEYE.cjs +1 -0
  39. package/dist/NiceModal-Bj53SKLI.js +95 -0
  40. package/dist/NiceModal-D-iOonog.js +95 -0
  41. package/dist/NiceModal-DC0UlQhc.cjs +1 -0
  42. package/dist/NiceModuleLifecyclePanel-4hzDw6it.js +6999 -0
  43. package/dist/NiceModuleLifecyclePanel-BBOg9g0b.cjs +1 -0
  44. package/dist/NiceModuleLifecyclePanel-Df_1k5qW.cjs +1 -0
  45. package/dist/NiceModuleLifecyclePanel-DtuXRiLR.js +6991 -0
  46. package/dist/NiceModuleLifecyclePanel.css +1 -1
  47. package/dist/NicePagination-Bjxy9aEc.js +172 -0
  48. package/dist/NicePagination-CPn-Q1h_.js +172 -0
  49. package/dist/NicePagination-CfFfNwrg.cjs +1 -0
  50. package/dist/NicePagination-EEQ6o1dF.cjs +1 -0
  51. package/dist/NicePivotGrid-Cmiolup9.cjs +152 -0
  52. package/dist/NicePivotGrid-DX_iUj2X.js +1167 -0
  53. package/dist/NiceSavedQueryPanel-BhjFJBvn.cjs +586 -0
  54. package/dist/NiceSavedQueryPanel-CH5c3rUG.js +6988 -0
  55. package/dist/NiceSavedQueryPanel-KvyXTnFx.js +5129 -0
  56. package/dist/NiceSavedQueryPanel-aQrEmmcC.cjs +596 -0
  57. package/dist/NiceScannerControl-Cd5KXJA9.js +12769 -0
  58. package/dist/NiceScannerControl-DZsERSw_.cjs +698 -0
  59. package/dist/NiceScannerControl.css +1 -0
  60. package/dist/NiceScheduler-DuxPzQQZ.js +1645 -0
  61. package/dist/NiceScheduler-nW7fMzKL.cjs +5 -0
  62. package/dist/NiceSelect-BVoqtfYN.cjs +1 -0
  63. package/dist/NiceSelect-DHowflmX.js +433 -0
  64. package/dist/NiceWindow-BoDzlGk-.js +1621 -0
  65. package/dist/NiceWindow-DdD9k4nc.cjs +1 -0
  66. package/dist/NiceWindow-DgONWxBm.cjs +1 -0
  67. package/dist/NiceWindow-xnTSHdHv.js +1623 -0
  68. package/dist/charts-B-sl1V9y.cjs +882 -0
  69. package/dist/charts-Bs0aDM0X.js +4671 -0
  70. package/dist/charts-DO2z6Ziu.js +31920 -0
  71. package/dist/charts-DjjKkw0q.cjs +761 -0
  72. package/dist/charts.cjs +1 -1
  73. package/dist/charts.mjs +7 -7
  74. package/dist/core-BUsZ7_vI.js +27914 -0
  75. package/dist/core-C2KhqEaU.cjs +1 -0
  76. package/dist/core-CLfcCDKc.cjs +122 -0
  77. package/dist/core-K2DIxXLn.js +795 -0
  78. package/dist/data-branching-D7l_kILW.cjs +1 -0
  79. package/dist/data-branching-DC6hcBQN.cjs +1 -0
  80. package/dist/data-branching-DykdTpjJ.js +6255 -0
  81. package/dist/data-branching-lJ07lDN-.js +6255 -0
  82. package/dist/data-branching.cjs +1 -1
  83. package/dist/data-branching.mjs +1 -1
  84. package/dist/data.cjs +1 -1
  85. package/dist/data.d.ts +70 -44
  86. package/dist/data.mjs +17 -16
  87. package/dist/devops-Bi8MXtko.js +8165 -0
  88. package/dist/devops-CU0sOVEA.cjs +17 -0
  89. package/dist/devops-CXyEwQeM.js +8165 -0
  90. package/dist/devops-On_1wRf9.cjs +17 -0
  91. package/dist/devops.cjs +1 -1
  92. package/dist/devops.mjs +1 -1
  93. package/dist/editors.cjs +1 -1
  94. package/dist/editors.d.ts +288 -432
  95. package/dist/editors.mjs +58 -62
  96. package/dist/feedback.cjs +1 -1
  97. package/dist/feedback.d.ts +1 -1
  98. package/dist/feedback.mjs +3 -3
  99. package/dist/index-BDH1yDSg.js +69235 -0
  100. package/dist/index-C9njkNOD.cjs +5470 -0
  101. package/dist/index.cjs +5137 -1
  102. package/dist/index.css +1 -1
  103. package/dist/index.d.ts +556 -929
  104. package/dist/index.mjs +66371 -1017
  105. package/dist/lazy.cjs +1 -1
  106. package/dist/lazy.mjs +24 -24
  107. package/dist/navigation.cjs +1 -1
  108. package/dist/navigation.d.ts +31 -213
  109. package/dist/navigation.mjs +105 -113
  110. package/dist/no-code-8lO7o6xi.js +7425 -0
  111. package/dist/no-code-C58g8_fb.cjs +332 -0
  112. package/dist/no-code-Cj4xJ3w9.js +7425 -0
  113. package/dist/no-code-K8tOLNew.cjs +332 -0
  114. package/dist/no-code.cjs +1 -1
  115. package/dist/no-code.mjs +1 -1
  116. package/dist/overlays.cjs +1 -1
  117. package/dist/overlays.d.ts +10 -0
  118. package/dist/overlays.mjs +36 -36
  119. package/dist/pickerCommons-B-wOzHFh.cjs +1 -0
  120. package/dist/pickerCommons-CORo9j2a.js +2119 -0
  121. package/dist/pickerCommons-COiSUiP2.js +1122 -0
  122. package/dist/pickerCommons-D3WShRrR.cjs +1 -0
  123. package/dist/style.css +6 -6
  124. package/dist/vendor-BPVpdtPp.js +271 -0
  125. package/dist/vendor-Bo2Q64AF.cjs +1 -0
  126. package/package.json +17 -17
@@ -0,0 +1,1645 @@
1
+ import { jsxs as p, jsx as t, Fragment as Ye } from "react/jsx-runtime";
2
+ import { w as it, G as ct } from "./charts-DO2z6Ziu.js";
3
+ import z, { useState as B, useRef as st, useCallback as te, useMemo as we } from "react";
4
+ import { N as at, a as ne } from "./NiceColorPicker-C8NZZcXE.js";
5
+ import { d as ot, c as Ie } from "./NiceForm-CCyfWgIs.js";
6
+ import { N as lt } from "./NiceModal-D-iOonog.js";
7
+ const Ae = ({
8
+ children: e,
9
+ className: r,
10
+ style: s,
11
+ direction: d = "horizontal",
12
+ size: a,
13
+ disabled: m,
14
+ readOnly: D,
15
+ loading: N,
16
+ error: T,
17
+ errorPlacement: I = "bottom"
18
+ }) => {
19
+ const b = /* @__PURE__ */ p(
20
+ "div",
21
+ {
22
+ className: `nice-btn-group ${d === "vertical" ? "nice-btn-group--vertical" : ""} ${N ? "nice-btn-group--loading" : ""} ${D ? "nice-btn-group--readonly" : ""} ${r || ""}`,
23
+ style: s,
24
+ role: "group",
25
+ "aria-busy": N || void 0,
26
+ children: [
27
+ z.Children.map(e, (M) => {
28
+ if (!z.isValidElement(M))
29
+ return M;
30
+ const n = {};
31
+ return m && (n.disabled = !0), D && (n.disabled = !0), N && (n.disabled = !0), a && (n.size = a), z.cloneElement(M, n);
32
+ }),
33
+ N && /* @__PURE__ */ t("span", { className: "nice-btn-group__spinner", children: /* @__PURE__ */ t("span", { className: "nice-spinner nice-spinner--sm" }) })
34
+ ]
35
+ }
36
+ );
37
+ if (!T)
38
+ return b;
39
+ const C = /* @__PURE__ */ t("div", { className: "nice-field__error", role: "alert", children: T });
40
+ return I === "right" ? /* @__PURE__ */ p(
41
+ "span",
42
+ {
43
+ className: `nice-btn-field nice-btn-field--right ${a ? `nice-field--${a}` : ""}`,
44
+ style: {
45
+ display: "inline-flex",
46
+ flexDirection: "row",
47
+ alignItems: "center",
48
+ gap: "8px",
49
+ width: "fit-content"
50
+ },
51
+ children: [
52
+ b,
53
+ C
54
+ ]
55
+ }
56
+ ) : /* @__PURE__ */ p(
57
+ "span",
58
+ {
59
+ className: `nice-btn-field nice-btn-field--bottom ${a ? `nice-field--${a}` : ""}`,
60
+ style: {
61
+ display: "inline-flex",
62
+ flexDirection: "column",
63
+ alignItems: "flex-start",
64
+ gap: "4px",
65
+ width: "fit-content"
66
+ },
67
+ children: [
68
+ b,
69
+ C
70
+ ]
71
+ }
72
+ );
73
+ }, F = (e, r) => {
74
+ const s = new Date(e);
75
+ return s.setDate(s.getDate() + r), s;
76
+ }, V = (e, r) => e.getFullYear() === r.getFullYear() && e.getMonth() === r.getMonth() && e.getDate() === r.getDate(), dt = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], ut = [
77
+ "January",
78
+ "February",
79
+ "March",
80
+ "April",
81
+ "May",
82
+ "June",
83
+ "July",
84
+ "August",
85
+ "September",
86
+ "October",
87
+ "November",
88
+ "December"
89
+ ], mt = ["sun", "mon", "tue", "wed", "thu", "fri", "sat"], ht = [
90
+ "january",
91
+ "february",
92
+ "march",
93
+ "april",
94
+ "may",
95
+ "june",
96
+ "july",
97
+ "august",
98
+ "september",
99
+ "october",
100
+ "november",
101
+ "december"
102
+ ];
103
+ function me(e) {
104
+ return mt.map((r, s) => e(r, dt[s]));
105
+ }
106
+ function gt(e) {
107
+ return ht.map((r, s) => e(r, ut[s]));
108
+ }
109
+ function He(e) {
110
+ const r = [
111
+ "Jan",
112
+ "Feb",
113
+ "Mar",
114
+ "Apr",
115
+ "May",
116
+ "Jun",
117
+ "Jul",
118
+ "Aug",
119
+ "Sep",
120
+ "Oct",
121
+ "Nov",
122
+ "Dec"
123
+ ];
124
+ return [
125
+ "janShort",
126
+ "febShort",
127
+ "marShort",
128
+ "aprShort",
129
+ "mayShort",
130
+ "junShort",
131
+ "julShort",
132
+ "augShort",
133
+ "sepShort",
134
+ "octShort",
135
+ "novShort",
136
+ "decShort"
137
+ ].map((d, a) => e(d, r[a]));
138
+ }
139
+ const pt = [
140
+ "Sunday",
141
+ "Monday",
142
+ "Tuesday",
143
+ "Wednesday",
144
+ "Thursday",
145
+ "Friday",
146
+ "Saturday"
147
+ ], yt = [
148
+ "sunday",
149
+ "monday",
150
+ "tuesday",
151
+ "wednesday",
152
+ "thursday",
153
+ "friday",
154
+ "saturday"
155
+ ];
156
+ function Me(e) {
157
+ return yt.map((r, s) => e(r, pt[s]));
158
+ }
159
+ function ft(e, r, s) {
160
+ const d = [];
161
+ for (const a of e) {
162
+ if (!a.recurrence) {
163
+ d.push(a);
164
+ continue;
165
+ }
166
+ const { freq: m, interval: D = 1, until: N, count: T } = a.recurrence, I = new Date(a.end).getTime() - new Date(a.start).getTime();
167
+ let b = new Date(a.start), C = 0;
168
+ const M = N ? new Date(Math.min(N.getTime(), s.getTime())) : s;
169
+ for (; b <= M && (!T || C < T); ) {
170
+ const n = new Date(b.getTime() + I);
171
+ n >= r && d.push({
172
+ ...a,
173
+ id: `${a.id}_${C}`,
174
+ start: new Date(b),
175
+ end: n
176
+ }), C++;
177
+ const v = new Date(b);
178
+ m === "daily" ? v.setDate(v.getDate() + D) : m === "weekly" ? v.setDate(v.getDate() + 7 * D) : m === "monthly" ? v.setMonth(v.getMonth() + D) : m === "yearly" && v.setFullYear(v.getFullYear() + D), b = v;
179
+ }
180
+ }
181
+ return d;
182
+ }
183
+ function We(e, r) {
184
+ return e.filter((s) => {
185
+ const d = new Date(s.start), a = new Date(s.end);
186
+ return r >= new Date(d.getFullYear(), d.getMonth(), d.getDate()) && r <= new Date(a.getFullYear(), a.getMonth(), a.getDate());
187
+ });
188
+ }
189
+ function _t(e = "r") {
190
+ return `${e}_${Math.random().toString(36).slice(2, 9)}`;
191
+ }
192
+ function vt(e = {}) {
193
+ return {
194
+ id: e.id ?? _t(),
195
+ title: e.title ?? "",
196
+ description: e.description ?? "",
197
+ servings: e.servings ?? 2,
198
+ prepMinutes: e.prepMinutes,
199
+ cookMinutes: e.cookMinutes,
200
+ difficulty: e.difficulty,
201
+ cuisine: e.cuisine,
202
+ tags: e.tags ?? [],
203
+ ingredients: e.ingredients ?? [],
204
+ steps: e.steps ?? [],
205
+ photos: e.photos ?? [],
206
+ nutrition: e.nutrition,
207
+ sourceUrl: e.sourceUrl,
208
+ createdAt: e.createdAt ?? /* @__PURE__ */ new Date(),
209
+ updatedAt: e.updatedAt ?? /* @__PURE__ */ new Date()
210
+ };
211
+ }
212
+ function Dt(e) {
213
+ const r = (e.prepMinutes ?? 0) + (e.cookMinutes ?? 0);
214
+ return r > 0 ? r : void 0;
215
+ }
216
+ const he = ({ ev: e, renderEvent: r, onClick: s, draggable: d, dragRef: a, onHover: m, categoryColor: D }) => {
217
+ const N = D || e.color || "var(--color-primary, #3b82f6)", I = {
218
+ solid: { backgroundColor: N, color: "var(--bg-primary, #fff)" },
219
+ striped: {
220
+ background: `repeating-linear-gradient(45deg, ${N}, ${N} 4px, transparent 4px, transparent 8px)`,
221
+ border: `1px solid ${N}`,
222
+ color: "var(--bg-tertiary, #333)"
223
+ },
224
+ outlined: { backgroundColor: "transparent", border: `2px solid ${N}`, color: N },
225
+ dashed: { backgroundColor: "transparent", border: `2px dashed ${N}`, color: N }
226
+ }[e.eventStyle || "solid"];
227
+ return /* @__PURE__ */ t(
228
+ "div",
229
+ {
230
+ className: `nice-scheduler__event nice-scheduler__event--${e.eventStyle || "solid"}`,
231
+ style: I,
232
+ draggable: d,
233
+ onDragStart: () => {
234
+ a.current = { event: e };
235
+ },
236
+ onDragEnd: () => {
237
+ a.current = null;
238
+ },
239
+ onClick: (b) => {
240
+ b.stopPropagation(), s?.(e);
241
+ },
242
+ onMouseEnter: (b) => m(e, b.currentTarget.getBoundingClientRect()),
243
+ onMouseLeave: () => m(null),
244
+ children: r ? r(e) : e.title
245
+ }
246
+ );
247
+ };
248
+ function re(e, r) {
249
+ if (!(!e.category || !r))
250
+ return r.find((s) => s.key === e.category)?.color;
251
+ }
252
+ const wt = ({
253
+ events: e,
254
+ curDate: r,
255
+ firstDayOfWeek: s,
256
+ onSlotClick: d,
257
+ onEventClick: a,
258
+ draggable: m,
259
+ dragRef: D,
260
+ categories: N,
261
+ renderEvent: T,
262
+ onHoverEvent: I,
263
+ readOnly: b,
264
+ t: C
265
+ }) => {
266
+ const M = me(C), n = r.getFullYear(), v = r.getMonth(), R = new Date(n, v, 1), o = new Date(n, v + 1, 0), l = (R.getDay() - s + 7) % 7, $ = o.getDate(), f = [];
267
+ for (let u = l - 1; u >= 0; u--)
268
+ f.push({ date: F(R, -u - 1), isCurrentMonth: !1 });
269
+ for (let u = 0; u < $; u++)
270
+ f.push({ date: new Date(n, v, u + 1), isCurrentMonth: !0 });
271
+ let L = 1;
272
+ for (; f.length < 42; )
273
+ f.push({ date: new Date(n, v + 1, L++), isCurrentMonth: !1 });
274
+ return /* @__PURE__ */ p("div", { className: "nice-scheduler__month", children: [
275
+ /* @__PURE__ */ t("div", { className: "nice-scheduler__month-header", children: Array.from({ length: 7 }, (u, y) => /* @__PURE__ */ t("div", { className: "nice-scheduler__month-dayname", children: M[(s + y) % 7] }, y)) }),
276
+ /* @__PURE__ */ t("div", { className: "nice-scheduler__month-grid", children: f.map((u, y) => {
277
+ const E = We(e, u.date), h = V(u.date, /* @__PURE__ */ new Date()), S = u.date.getDay(), Y = S === 0 || S === 6;
278
+ return /* @__PURE__ */ p(
279
+ "div",
280
+ {
281
+ className: `nice-scheduler__month-cell ${u.isCurrentMonth ? "" : "nice-scheduler__month-cell--other"} ${h ? "nice-scheduler__month-cell--today" : ""} ${Y ? "nice-scheduler__month-cell--weekend" : ""}`,
282
+ onClick: () => !b && d?.(u.date, F(u.date, 1)),
283
+ children: [
284
+ /* @__PURE__ */ t("div", { className: "nice-scheduler__month-date", children: u.date.getDate() }),
285
+ E.slice(0, 3).map((A) => /* @__PURE__ */ t(
286
+ he,
287
+ {
288
+ ev: A,
289
+ renderEvent: T,
290
+ onClick: a,
291
+ draggable: m && !b,
292
+ dragRef: D,
293
+ onHover: I,
294
+ categoryColor: re(A, N)
295
+ },
296
+ A.id
297
+ )),
298
+ E.length > 3 && /* @__PURE__ */ p("div", { className: "nice-scheduler__month-more", children: [
299
+ "+",
300
+ E.length - 3
301
+ ] })
302
+ ]
303
+ },
304
+ y
305
+ );
306
+ }) })
307
+ ] });
308
+ }, Nt = ({
309
+ events: e,
310
+ days: r,
311
+ startHour: s,
312
+ endHour: d,
313
+ draggable: a,
314
+ dragRef: m,
315
+ onEventClick: D,
316
+ onSlotClick: N,
317
+ onEventDrop: T,
318
+ categories: I,
319
+ workHours: b,
320
+ showCurrentTime: C,
321
+ renderEvent: M,
322
+ onHoverEvent: n,
323
+ readOnly: v,
324
+ t: R
325
+ }) => {
326
+ const o = [];
327
+ for (let h = s; h < d; h++)
328
+ o.push(h);
329
+ me(R);
330
+ const l = Me(R), $ = z.useRef(null), f = /* @__PURE__ */ new Date(), L = f.getHours() * 60 + f.getMinutes(), u = (d - s) * 60, y = (L - s * 60) / u * 100, E = C && L >= s * 60 && L < d * 60;
331
+ return z.useEffect(() => {
332
+ const h = $.current;
333
+ if (!h)
334
+ return;
335
+ const S = /* @__PURE__ */ new Date(), Y = e.filter((x) => r.some((W) => V(W, new Date(x.start)))), A = Y.filter((x) => V(new Date(x.start), S));
336
+ let H;
337
+ A.length > 0 ? H = Math.min(...A.map((x) => new Date(x.start).getHours())) : Y.length > 0 ? H = Math.min(...Y.map((x) => new Date(x.start).getHours())) : H = 8, H = Math.max(s, Math.min(H, d - 1));
338
+ const c = H - s, g = h.children[c];
339
+ if (g) {
340
+ const x = h.closest(".nice-scheduler__content") ?? h.closest(".nice-scheduler__timegrid");
341
+ x && (x.scrollTop = g.offsetTop - 4);
342
+ }
343
+ }, []), /* @__PURE__ */ p("div", { className: "nice-scheduler__timegrid", children: [
344
+ /* @__PURE__ */ p("div", { className: "nice-scheduler__timegrid-header", children: [
345
+ /* @__PURE__ */ t("div", { className: "nice-scheduler__time-gutter" }),
346
+ r.map((h, S) => {
347
+ const Y = h.getDay() === 0 || h.getDay() === 6;
348
+ return /* @__PURE__ */ p(
349
+ "div",
350
+ {
351
+ className: `nice-scheduler__timegrid-day-header ${V(h, f) ? "nice-scheduler__timegrid-day-header--today" : ""} ${Y ? "nice-scheduler__timegrid-day-header--weekend" : ""}`,
352
+ children: [
353
+ /* @__PURE__ */ t("div", { className: "nice-scheduler__timegrid-day-name", children: l[h.getDay()] }),
354
+ /* @__PURE__ */ t("div", { className: "nice-scheduler__timegrid-day-num", children: h.getDate() })
355
+ ]
356
+ },
357
+ S
358
+ );
359
+ })
360
+ ] }),
361
+ /* @__PURE__ */ p("div", { className: "nice-scheduler__timegrid-body", ref: $, style: { position: "relative" }, children: [
362
+ o.map((h) => {
363
+ const S = b ? h >= b[0] && h < b[1] : !1;
364
+ return /* @__PURE__ */ p(
365
+ "div",
366
+ {
367
+ className: `nice-scheduler__timegrid-row ${S ? "nice-scheduler__timegrid-row--work" : ""}`,
368
+ children: [
369
+ /* @__PURE__ */ t("div", { className: "nice-scheduler__time-gutter", children: `${h.toString().padStart(2, "0")}:00` }),
370
+ r.map((Y, A) => {
371
+ const H = e.filter((c) => {
372
+ const g = new Date(c.start);
373
+ return V(g, Y) && g.getHours() === h;
374
+ });
375
+ return /* @__PURE__ */ t(
376
+ "div",
377
+ {
378
+ className: "nice-scheduler__timegrid-cell",
379
+ onDragOver: a && !v ? (c) => c.preventDefault() : void 0,
380
+ onDrop: a && !v ? () => {
381
+ if (!m.current || !T)
382
+ return;
383
+ const c = m.current.event, g = new Date(c.end).getTime() - new Date(c.start).getTime(), x = new Date(Y);
384
+ x.setHours(h, 0, 0, 0);
385
+ const W = new Date(x.getTime() + g);
386
+ T(c, x, W), m.current = null;
387
+ } : void 0,
388
+ onClick: () => !v && (() => {
389
+ const c = new Date(Y);
390
+ c.setHours(h);
391
+ const g = new Date(c);
392
+ g.setHours(h + 1), N?.(c, g);
393
+ })(),
394
+ children: H.map((c) => /* @__PURE__ */ t(
395
+ he,
396
+ {
397
+ ev: c,
398
+ renderEvent: M,
399
+ onClick: D,
400
+ draggable: a && !v,
401
+ dragRef: m,
402
+ onHover: n,
403
+ categoryColor: re(c, I)
404
+ },
405
+ c.id
406
+ ))
407
+ },
408
+ A
409
+ );
410
+ })
411
+ ]
412
+ },
413
+ h
414
+ );
415
+ }),
416
+ E && r.some((h) => V(h, f)) && /* @__PURE__ */ t("div", { className: "nice-scheduler__now-line", style: { top: `${y}%` }, children: /* @__PURE__ */ t("div", { className: "nice-scheduler__now-dot" }) })
417
+ ] })
418
+ ] });
419
+ }, bt = ({
420
+ events: e,
421
+ curDate: r,
422
+ onEventClick: s,
423
+ categories: d,
424
+ t: a
425
+ }) => {
426
+ const m = [...e].filter(
427
+ (D) => new Date(D.start) >= new Date(r.getFullYear(), r.getMonth(), r.getDate())
428
+ ).sort((D, N) => new Date(D.start).getTime() - new Date(N.start).getTime()).slice(0, 50);
429
+ return /* @__PURE__ */ p("div", { className: "nice-scheduler__agenda", children: [
430
+ m.map((D) => /* @__PURE__ */ t(St, { ev: D, categories: d, onEventClick: s }, D.id)),
431
+ m.length === 0 && /* @__PURE__ */ t("div", { className: "nice-scheduler__agenda-empty", children: a("noEvents", "No upcoming events") })
432
+ ] });
433
+ }, je = ({ ev: e }) => {
434
+ if (e.eventType === "recipe" && e.recipe) {
435
+ const r = Dt(e.recipe), s = [];
436
+ return r !== void 0 && s.push(`⏱ ${r} min`), e.recipe.ingredients?.length && s.push(`🥕 ${e.recipe.ingredients.length} ingredients`), e.recipe.servings && s.push(`🍽 ${e.recipe.servings} servings`), s.length === 0 ? null : /* @__PURE__ */ t("div", { className: "nice-scheduler__agenda-meta", children: s.join(" · ") });
437
+ }
438
+ if (e.eventType === "service" && e.service) {
439
+ const r = e.service, s = [];
440
+ return r.serviceName && s.push(`🛎 ${r.serviceName}`), r.providerName && s.push(`👤 ${r.providerName}`), r.customerName && s.push(`→ ${r.customerName}`), typeof r.price == "number" && s.push(`💵 ${r.price}${r.currency ? " " + r.currency : ""}`), s.length === 0 ? null : /* @__PURE__ */ t("div", { className: "nice-scheduler__agenda-meta", children: s.join(" · ") });
441
+ }
442
+ return null;
443
+ }, St = ({ ev: e, categories: r, onEventClick: s }) => {
444
+ const d = it({ onClick: () => s?.(e) });
445
+ return /* @__PURE__ */ p("div", { className: "nice-scheduler__agenda-item", "aria-label": `Event ${e.title}`, ...d, children: [
446
+ /* @__PURE__ */ t(
447
+ "div",
448
+ {
449
+ className: "nice-scheduler__agenda-dot",
450
+ style: {
451
+ backgroundColor: re(e, r) || e.color || "var(--color-primary, #3b82f6)"
452
+ }
453
+ }
454
+ ),
455
+ /* @__PURE__ */ p("div", { className: "nice-scheduler__agenda-info", children: [
456
+ /* @__PURE__ */ t("div", { className: "nice-scheduler__agenda-title", children: e.title }),
457
+ /* @__PURE__ */ p("div", { className: "nice-scheduler__agenda-time", children: [
458
+ new Date(e.start).toLocaleString(),
459
+ " � ",
460
+ new Date(e.end).toLocaleString()
461
+ ] }),
462
+ e.description && /* @__PURE__ */ t("div", { className: "nice-scheduler__agenda-desc", children: e.description }),
463
+ /* @__PURE__ */ t(je, { ev: e })
464
+ ] }),
465
+ e.category && r && /* @__PURE__ */ t(
466
+ "span",
467
+ {
468
+ className: "nice-scheduler__agenda-badge",
469
+ style: { backgroundColor: re(e, r) || e.color },
470
+ children: r.find((a) => a.key === e.category)?.label
471
+ }
472
+ )
473
+ ] });
474
+ }, Ct = ({
475
+ events: e,
476
+ curDate: r,
477
+ timelineDays: s,
478
+ resources: d,
479
+ draggable: a,
480
+ dragRef: m,
481
+ onEventClick: D,
482
+ onSlotClick: N,
483
+ onEventDrop: T,
484
+ categories: I,
485
+ renderEvent: b,
486
+ onHoverEvent: C,
487
+ readOnly: M,
488
+ t: n
489
+ }) => {
490
+ const v = Array.from({ length: s }, (l, $) => F(r, $)), R = d ?? [{ id: "__default", name: "" }], o = me(n);
491
+ return /* @__PURE__ */ p("div", { className: "nice-scheduler__timeline", children: [
492
+ /* @__PURE__ */ p("div", { className: "nice-scheduler__timeline-header", children: [
493
+ /* @__PURE__ */ t("div", { className: "nice-scheduler__timeline-res-label" }),
494
+ v.map((l, $) => /* @__PURE__ */ p(
495
+ "div",
496
+ {
497
+ className: `nice-scheduler__timeline-day ${V(l, /* @__PURE__ */ new Date()) ? "nice-scheduler__timeline-day--today" : ""}`,
498
+ children: [
499
+ o[l.getDay()],
500
+ " ",
501
+ l.getDate()
502
+ ]
503
+ },
504
+ $
505
+ ))
506
+ ] }),
507
+ /* @__PURE__ */ t("div", { className: "nice-scheduler__timeline-body", children: R.map((l) => {
508
+ const $ = e.filter((f) => !d || f.resourceId === l.id);
509
+ return /* @__PURE__ */ p("div", { className: "nice-scheduler__timeline-row", children: [
510
+ /* @__PURE__ */ t("div", { className: "nice-scheduler__timeline-res-label", children: l.name }),
511
+ v.map((f, L) => {
512
+ const u = $.filter((y) => V(new Date(y.start), f));
513
+ return /* @__PURE__ */ t(
514
+ "div",
515
+ {
516
+ className: "nice-scheduler__timeline-cell",
517
+ onDragOver: a && !M ? (y) => y.preventDefault() : void 0,
518
+ onDrop: a && !M ? () => {
519
+ if (!m.current || !T)
520
+ return;
521
+ const y = m.current.event, E = new Date(y.end).getTime() - new Date(y.start).getTime(), h = new Date(f);
522
+ h.setHours(
523
+ new Date(y.start).getHours(),
524
+ new Date(y.start).getMinutes()
525
+ ), T(y, h, new Date(h.getTime() + E), l.id), m.current = null;
526
+ } : void 0,
527
+ onClick: () => !M && N?.(f, F(f, 1), l.id),
528
+ children: u.map((y) => /* @__PURE__ */ t(
529
+ he,
530
+ {
531
+ ev: y,
532
+ renderEvent: b,
533
+ onClick: D,
534
+ draggable: a && !M,
535
+ dragRef: m,
536
+ onHover: C,
537
+ categoryColor: re(y, I)
538
+ },
539
+ y.id
540
+ ))
541
+ },
542
+ L
543
+ );
544
+ })
545
+ ] }, l.id);
546
+ }) })
547
+ ] });
548
+ }, Pe = ({ categories: e, events: r, filteredCategories: s, onToggleCategory: d, t: a }) => /* @__PURE__ */ p("div", { className: "nice-scheduler__legend", children: [
549
+ /* @__PURE__ */ t("div", { className: "nice-scheduler__legend-title", children: a("legend", "Legend") }),
550
+ e.map((m) => {
551
+ const D = r.filter((T) => T.category === m.key).length, N = !s.has(m.key);
552
+ return /* @__PURE__ */ p(
553
+ "button",
554
+ {
555
+ className: `nice-scheduler__legend-item ${N ? "" : "nice-scheduler__legend-item--hidden"}`,
556
+ onClick: () => d(m.key),
557
+ children: [
558
+ /* @__PURE__ */ t(
559
+ "span",
560
+ {
561
+ className: "nice-scheduler__legend-dot",
562
+ style: { backgroundColor: N ? m.color : "var(--border-color, #ccc)" }
563
+ }
564
+ ),
565
+ /* @__PURE__ */ t("span", { className: "nice-scheduler__legend-label", children: m.label }),
566
+ /* @__PURE__ */ t("span", { className: "nice-scheduler__legend-count", children: D })
567
+ ]
568
+ },
569
+ m.key
570
+ );
571
+ })
572
+ ] }), kt = ({ curDate: e, onDateSelect: r, firstDayOfWeek: s, t: d }) => {
573
+ const [a, m] = z.useState(e.getMonth()), [D, N] = z.useState(e.getFullYear()), T = new Date(D, a, 1), I = new Date(D, a + 1, 0), b = (T.getDay() - s + 7) % 7, C = [];
574
+ for (let l = b - 1; l >= 0; l--)
575
+ C.push(F(T, -l - 1));
576
+ for (let l = 0; l < I.getDate(); l++)
577
+ C.push(new Date(D, a, l + 1));
578
+ const M = 7 - C.length % 7;
579
+ if (M < 7)
580
+ for (let l = 1; l <= M; l++)
581
+ C.push(new Date(D, a + 1, l));
582
+ const n = () => {
583
+ a === 0 ? (m(11), N((l) => l - 1)) : m((l) => l - 1);
584
+ }, v = () => {
585
+ a === 11 ? (m(0), N((l) => l + 1)) : m((l) => l + 1);
586
+ }, R = He(d), o = me(d);
587
+ return /* @__PURE__ */ p("div", { className: "nice-scheduler__mini-cal", children: [
588
+ /* @__PURE__ */ p("div", { className: "nice-scheduler__mini-cal-header", children: [
589
+ /* @__PURE__ */ t("button", { className: "nice-btn nice-btn--xs", onClick: n, children: "�" }),
590
+ /* @__PURE__ */ p("span", { children: [
591
+ R[a],
592
+ " ",
593
+ D
594
+ ] }),
595
+ /* @__PURE__ */ t("button", { className: "nice-btn nice-btn--xs", onClick: v, children: "�" })
596
+ ] }),
597
+ /* @__PURE__ */ p("div", { className: "nice-scheduler__mini-cal-grid", children: [
598
+ o.map((l, $) => /* @__PURE__ */ t("div", { className: "nice-scheduler__mini-cal-dayname", children: o[(s + $) % 7].charAt(0) }, $)),
599
+ C.map((l, $) => {
600
+ const f = V(l, /* @__PURE__ */ new Date()), L = V(l, e), u = l.getMonth() !== a;
601
+ return /* @__PURE__ */ t(
602
+ "button",
603
+ {
604
+ className: `nice-scheduler__mini-cal-day ${f ? "nice-scheduler__mini-cal-day--today" : ""} ${L ? "nice-scheduler__mini-cal-day--selected" : ""} ${u ? "nice-scheduler__mini-cal-day--other" : ""}`,
605
+ onClick: () => r(l),
606
+ children: l.getDate()
607
+ },
608
+ $
609
+ );
610
+ })
611
+ ] })
612
+ ] });
613
+ }, Mt = ({
614
+ events: e,
615
+ rangeStart: r,
616
+ rangeEnd: s,
617
+ startHour: d,
618
+ endHour: a,
619
+ draggable: m,
620
+ dragRef: D,
621
+ onEventClick: N,
622
+ onSlotClick: T,
623
+ onEventDrop: I,
624
+ categories: b,
625
+ workHours: C,
626
+ showCurrentTime: M,
627
+ renderEvent: n,
628
+ onHoverEvent: v,
629
+ readOnly: R,
630
+ t: o
631
+ }) => {
632
+ const l = [];
633
+ let $ = new Date(r);
634
+ for (; $ <= s; )
635
+ l.push(new Date($)), $ = F($, 1);
636
+ const f = [];
637
+ for (let g = d; g < a; g++)
638
+ f.push(g);
639
+ const L = Me(o), u = z.useRef(null), y = z.useRef(null), E = z.useRef(null), h = /* @__PURE__ */ new Date(), S = h.getHours() * 60 + h.getMinutes(), Y = (a - d) * 60, A = (S - d * 60) / Y * 100, H = M && S >= d * 60 && S < a * 60;
640
+ z.useEffect(() => {
641
+ const g = u.current;
642
+ if (!g)
643
+ return;
644
+ const x = /* @__PURE__ */ new Date(), W = e.filter(
645
+ (w) => l.some((j) => V(j, x) && V(new Date(w.start), x))
646
+ );
647
+ let U = W.length > 0 ? Math.min(...W.map((w) => new Date(w.start).getHours())) : x.getHours();
648
+ U = Math.max(d, Math.min(U, a - 1));
649
+ const X = g.children[U - d];
650
+ if (X) {
651
+ const w = E.current ?? g.closest(".nice-scheduler__content") ?? g.closest(".nice-scheduler__timegrid");
652
+ w && (w.scrollTop = X.offsetTop - 4);
653
+ }
654
+ }, []);
655
+ const c = (g) => {
656
+ y.current && (y.current.scrollLeft = g.currentTarget.scrollLeft);
657
+ };
658
+ return /* @__PURE__ */ p("div", { className: "nice-scheduler__timegrid nice-scheduler__timegrid--range", children: [
659
+ /* @__PURE__ */ t(
660
+ "div",
661
+ {
662
+ className: "nice-scheduler__timegrid-header-scroll",
663
+ ref: y,
664
+ "aria-hidden": "true",
665
+ children: /* @__PURE__ */ p("div", { className: "nice-scheduler__timegrid-header", children: [
666
+ /* @__PURE__ */ t("div", { className: "nice-scheduler__time-gutter" }),
667
+ l.map((g, x) => {
668
+ const W = g.getDay() === 0 || g.getDay() === 6;
669
+ return /* @__PURE__ */ p(
670
+ "div",
671
+ {
672
+ className: `nice-scheduler__timegrid-day-header ${V(g, h) ? "nice-scheduler__timegrid-day-header--today" : ""} ${W ? "nice-scheduler__timegrid-day-header--weekend" : ""}`,
673
+ children: [
674
+ /* @__PURE__ */ t("div", { className: "nice-scheduler__timegrid-day-name", children: L[g.getDay()] }),
675
+ /* @__PURE__ */ t("div", { className: "nice-scheduler__timegrid-day-num", children: g.getDate() })
676
+ ]
677
+ },
678
+ x
679
+ );
680
+ })
681
+ ] })
682
+ }
683
+ ),
684
+ /* @__PURE__ */ t(
685
+ "div",
686
+ {
687
+ className: "nice-scheduler__timegrid-body-scroll",
688
+ ref: E,
689
+ onScroll: c,
690
+ children: /* @__PURE__ */ p(
691
+ "div",
692
+ {
693
+ className: "nice-scheduler__timegrid-body",
694
+ ref: u,
695
+ style: { position: "relative" },
696
+ children: [
697
+ f.map((g) => {
698
+ const x = C ? g >= C[0] && g < C[1] : !1;
699
+ return /* @__PURE__ */ p(
700
+ "div",
701
+ {
702
+ className: `nice-scheduler__timegrid-row ${x ? "nice-scheduler__timegrid-row--work" : ""}`,
703
+ children: [
704
+ /* @__PURE__ */ t("div", { className: "nice-scheduler__time-gutter", children: `${g.toString().padStart(2, "0")}:00` }),
705
+ l.map((W, U) => {
706
+ const X = e.filter((w) => {
707
+ const j = new Date(w.start);
708
+ return V(j, W) && j.getHours() === g;
709
+ });
710
+ return /* @__PURE__ */ t(
711
+ "div",
712
+ {
713
+ className: "nice-scheduler__timegrid-cell",
714
+ onDragOver: m && !R ? (w) => w.preventDefault() : void 0,
715
+ onDrop: m && !R ? () => {
716
+ if (!D.current || !I)
717
+ return;
718
+ const w = D.current.event, j = new Date(w.end).getTime() - new Date(w.start).getTime(), K = new Date(W);
719
+ K.setHours(g, 0, 0, 0), I(w, K, new Date(K.getTime() + j)), D.current = null;
720
+ } : void 0,
721
+ onClick: () => !R && (() => {
722
+ const w = new Date(W);
723
+ w.setHours(g);
724
+ const j = new Date(w);
725
+ j.setHours(g + 1), T?.(w, j);
726
+ })(),
727
+ children: X.map((w) => /* @__PURE__ */ t(
728
+ he,
729
+ {
730
+ ev: w,
731
+ renderEvent: n,
732
+ onClick: N,
733
+ draggable: m && !R,
734
+ dragRef: D,
735
+ onHover: v,
736
+ categoryColor: re(w, b)
737
+ },
738
+ w.id
739
+ ))
740
+ },
741
+ U
742
+ );
743
+ })
744
+ ]
745
+ },
746
+ g
747
+ );
748
+ }),
749
+ H && l.some((g) => V(g, h)) && /* @__PURE__ */ t("div", { className: "nice-scheduler__now-line", style: { top: `${A}%` }, children: /* @__PURE__ */ t("div", { className: "nice-scheduler__now-dot" }) })
750
+ ]
751
+ }
752
+ )
753
+ }
754
+ )
755
+ ] });
756
+ }, Tt = ({
757
+ events: e,
758
+ rangeStart: r,
759
+ rangeEnd: s,
760
+ firstDayOfWeek: d,
761
+ onSlotClick: a,
762
+ onEventClick: m,
763
+ draggable: D,
764
+ dragRef: N,
765
+ categories: T,
766
+ renderEvent: I,
767
+ onHoverEvent: b,
768
+ readOnly: C,
769
+ t: M
770
+ }) => {
771
+ const n = me(M);
772
+ Me(M);
773
+ const v = [];
774
+ let R = new Date(r);
775
+ for (; R <= s; )
776
+ v.push(new Date(R)), R = F(R, 1);
777
+ const o = (v[0].getDay() - d + 7) % 7, l = [];
778
+ for (let f = o - 1; f >= 0; f--)
779
+ l.push({ date: F(v[0], -f - 1), inRange: !1 });
780
+ v.forEach((f) => l.push({ date: f, inRange: !0 }));
781
+ const $ = 7 - l.length % 7;
782
+ if ($ < 7) {
783
+ const f = v[v.length - 1];
784
+ for (let L = 1; L <= $; L++)
785
+ l.push({ date: F(f, L), inRange: !1 });
786
+ }
787
+ return /* @__PURE__ */ p("div", { className: "nice-scheduler__month nice-scheduler__month--range", children: [
788
+ /* @__PURE__ */ t("div", { className: "nice-scheduler__month-header", children: Array.from({ length: 7 }, (f, L) => /* @__PURE__ */ t("div", { className: "nice-scheduler__month-dayname", children: n[(d + L) % 7] }, L)) }),
789
+ /* @__PURE__ */ t("div", { className: "nice-scheduler__month-grid", children: l.map((f, L) => {
790
+ const u = We(e, f.date), y = V(f.date, /* @__PURE__ */ new Date()), E = f.date.getDay() === 0 || f.date.getDay() === 6;
791
+ return /* @__PURE__ */ p(
792
+ "div",
793
+ {
794
+ className: `nice-scheduler__month-cell ${f.inRange ? "" : "nice-scheduler__month-cell--other"} ${y ? "nice-scheduler__month-cell--today" : ""} ${E ? "nice-scheduler__month-cell--weekend" : ""}`,
795
+ onClick: () => !C && a?.(f.date, F(f.date, 1)),
796
+ children: [
797
+ /* @__PURE__ */ t("div", { className: "nice-scheduler__month-date", children: f.date.getDate() === 1 || L === 0 ? /* @__PURE__ */ p(Ye, { children: [
798
+ /* @__PURE__ */ t("span", { className: "nice-scheduler__month-monthname", children: He(M)[f.date.getMonth()] }),
799
+ " ",
800
+ f.date.getDate()
801
+ ] }) : f.date.getDate() }),
802
+ u.slice(0, 3).map((h) => /* @__PURE__ */ t(
803
+ he,
804
+ {
805
+ ev: h,
806
+ renderEvent: I,
807
+ onClick: m,
808
+ draggable: D && !C,
809
+ dragRef: N,
810
+ onHover: b,
811
+ categoryColor: re(h, T)
812
+ },
813
+ h.id
814
+ )),
815
+ u.length > 3 && /* @__PURE__ */ p("div", { className: "nice-scheduler__month-more", children: [
816
+ "+",
817
+ u.length - 3
818
+ ] })
819
+ ]
820
+ },
821
+ L
822
+ );
823
+ }) })
824
+ ] });
825
+ }, $t = ({ event: e, rect: r, categories: s, renderTooltip: d }) => {
826
+ if (d)
827
+ return /* @__PURE__ */ t(
828
+ "div",
829
+ {
830
+ className: "nice-scheduler__tooltip",
831
+ style: { position: "fixed", left: r.right + 8, top: r.top, zIndex: 1e4 },
832
+ children: d(e)
833
+ }
834
+ );
835
+ const a = s?.find((m) => m.key === e.category);
836
+ return /* @__PURE__ */ p(
837
+ "div",
838
+ {
839
+ className: "nice-scheduler__tooltip",
840
+ style: { position: "fixed", left: r.right + 8, top: r.top, zIndex: 1e4 },
841
+ children: [
842
+ /* @__PURE__ */ t("div", { className: "nice-scheduler__tooltip-title", children: e.title }),
843
+ /* @__PURE__ */ p("div", { className: "nice-scheduler__tooltip-time", children: [
844
+ new Date(e.start).toLocaleString(),
845
+ " � ",
846
+ new Date(e.end).toLocaleString()
847
+ ] }),
848
+ a && /* @__PURE__ */ p("div", { className: "nice-scheduler__tooltip-cat", children: [
849
+ /* @__PURE__ */ t("span", { className: "nice-scheduler__tooltip-dot", style: { backgroundColor: a.color } }),
850
+ a.label
851
+ ] }),
852
+ e.description && /* @__PURE__ */ t("div", { className: "nice-scheduler__tooltip-desc", children: e.description }),
853
+ /* @__PURE__ */ t(je, { ev: e })
854
+ ]
855
+ }
856
+ );
857
+ }, xt = ({
858
+ event: e,
859
+ slotStart: r,
860
+ slotEnd: s,
861
+ categories: d,
862
+ resources: a,
863
+ formFields: m,
864
+ formFieldsByType: D,
865
+ eventTypes: N,
866
+ renderEditor: T,
867
+ saving: I,
868
+ onSave: b,
869
+ onDelete: C,
870
+ onClose: M,
871
+ t: n
872
+ }) => {
873
+ const v = !!e, R = z.useMemo(
874
+ () => ({
875
+ title: e?.title ?? "",
876
+ description: e?.description ?? "",
877
+ color: e?.color ?? "var(--nice-primary, #3b82f6)",
878
+ category: e?.category ?? "",
879
+ eventStyle: e?.eventStyle ?? "solid",
880
+ start: e?.start ?? r ?? /* @__PURE__ */ new Date(),
881
+ end: e?.end ?? s ?? /* @__PURE__ */ new Date(),
882
+ allDay: e?.allDay ?? !1,
883
+ resourceId: e?.resourceId ?? "",
884
+ eventType: e?.eventType ?? "task",
885
+ recurring: !!e?.recurrence,
886
+ recurrenceFreq: e?.recurrence?.freq ?? "weekly",
887
+ recurrenceInterval: e?.recurrence?.interval ?? 1,
888
+ recurrenceCount: e?.recurrence?.count,
889
+ // Recipe-specific
890
+ recipeTitle: e?.recipe?.title ?? "",
891
+ recipeServings: e?.recipe?.servings ?? 2,
892
+ recipePrep: e?.recipe?.prepMinutes,
893
+ recipeCook: e?.recipe?.cookMinutes,
894
+ recipeIngredients: (e?.recipe?.ingredients ?? []).map(
895
+ (u) => [u.quantity, u.unit, u.name].filter((y) => y !== void 0 && y !== "").join(" ")
896
+ ).join(`
897
+ `),
898
+ recipeSteps: (e?.recipe?.steps ?? []).map((u) => u.instruction).join(`
899
+ `),
900
+ // Service-specific
901
+ serviceName: e?.service?.serviceName ?? "",
902
+ serviceProvider: e?.service?.providerName ?? "",
903
+ serviceCustomer: e?.service?.customerName ?? "",
904
+ serviceContact: e?.service?.customerContact ?? "",
905
+ serviceLocation: e?.service?.location ?? "",
906
+ servicePrice: e?.service?.price,
907
+ serviceCurrency: e?.service?.currency ?? "PLN",
908
+ serviceNotes: e?.service?.notes ?? ""
909
+ }),
910
+ [e, r, s]
911
+ ), [o, l] = z.useState(R);
912
+ z.useEffect(() => {
913
+ l(R);
914
+ }, [R]);
915
+ const $ = z.useCallback((u, y) => {
916
+ l((E) => ({ ...E, [u]: y }));
917
+ }, []), f = z.useMemo(() => {
918
+ if (m && m.length > 0)
919
+ return m;
920
+ const u = (c) => c.toString().padStart(2, "0"), y = (c) => `${c.getFullYear()}-${u(c.getMonth() + 1)}-${u(c.getDate())}`, E = (c) => `${u(c.getHours())}:${u(c.getMinutes())}`, h = (c, g) => {
921
+ const x = c instanceof Date ? c : new Date(c), W = isNaN(x.getTime()) ? /* @__PURE__ */ new Date() : x, U = y(W), X = E(W), w = (j, K) => {
922
+ const [J, ge, pe] = j.split("-").map((oe) => parseInt(oe, 10)), [ye, fe] = K.split(":").map((oe) => parseInt(oe, 10)), ae = new Date(W);
923
+ !isNaN(J) && !isNaN(ge) && !isNaN(pe) && ae.setFullYear(J, ge - 1, pe), !isNaN(ye) && !isNaN(fe) && ae.setHours(ye, fe, 0, 0), g(ae);
924
+ };
925
+ return /* @__PURE__ */ p("div", { style: { display: "flex", gap: 12, flexWrap: "wrap", alignItems: "flex-end" }, children: [
926
+ /* @__PURE__ */ p("div", { style: { display: "flex", flexDirection: "column", gap: 2 }, children: [
927
+ /* @__PURE__ */ t("span", { style: { fontSize: "0.7rem", color: "var(--text-muted, #888)" }, children: n("date", "Date") }),
928
+ /* @__PURE__ */ t(Ie, { value: U, onChange: (j) => w(j, X), size: "sm" })
929
+ ] }),
930
+ /* @__PURE__ */ p("div", { style: { display: "flex", flexDirection: "column", gap: 2 }, children: [
931
+ /* @__PURE__ */ t("span", { style: { fontSize: "0.7rem", color: "var(--text-muted, #888)" }, children: n("time", "Time") }),
932
+ /* @__PURE__ */ t(
933
+ Ie,
934
+ {
935
+ dateFormatPreset: "time",
936
+ value: X,
937
+ onChange: (j) => w(U, j),
938
+ size: "sm"
939
+ }
940
+ )
941
+ ] })
942
+ ] });
943
+ }, S = [];
944
+ N && N.length > 1 && S.push({
945
+ field: "eventType",
946
+ label: n("eventType", "Type"),
947
+ type: "select",
948
+ group: n("common", "Common"),
949
+ options: N.map((c) => ({
950
+ label: c.icon ? `${c.icon} ${c.label}` : c.label,
951
+ value: c.type
952
+ }))
953
+ }), S.push(
954
+ {
955
+ field: "title",
956
+ label: n("title", "Title"),
957
+ type: "text",
958
+ required: !0,
959
+ group: n("common", "Common")
960
+ },
961
+ {
962
+ field: "start",
963
+ label: n("start", "Start"),
964
+ render: h,
965
+ group: n("common", "Common")
966
+ },
967
+ {
968
+ field: "end",
969
+ label: n("end", "End"),
970
+ render: h,
971
+ group: n("common", "Common")
972
+ },
973
+ {
974
+ field: "description",
975
+ label: n("description", "Description"),
976
+ type: "textarea",
977
+ group: n("common", "Common")
978
+ },
979
+ {
980
+ field: "color",
981
+ label: n("color", "Color"),
982
+ group: n("common", "Common"),
983
+ render: (c, g) => /* @__PURE__ */ t(
984
+ at,
985
+ {
986
+ value: typeof c == "string" ? c : "var(--nice-primary, #3b82f6)",
987
+ onChange: g,
988
+ showInput: !1,
989
+ showRandom: !1
990
+ }
991
+ )
992
+ }
993
+ ), d && d.length > 0 && S.push({
994
+ field: "category",
995
+ label: n("category", "Category"),
996
+ type: "select",
997
+ group: n("common", "Common"),
998
+ options: [
999
+ { label: n("none", "(none)"), value: "" },
1000
+ ...d.map((c) => ({ label: c.label, value: c.key }))
1001
+ ]
1002
+ }), a && a.length > 0 && S.push({
1003
+ field: "resourceId",
1004
+ label: n("resource", "Resource"),
1005
+ type: "select",
1006
+ group: n("common", "Common"),
1007
+ options: [
1008
+ { label: n("none", "(none)"), value: "" },
1009
+ ...a.map((c) => ({ label: c.name, value: String(c.id) }))
1010
+ ]
1011
+ });
1012
+ const Y = n("recurring", "Recurring");
1013
+ S.push({
1014
+ field: "recurring",
1015
+ label: n("repeat", "Repeat"),
1016
+ type: "checkbox",
1017
+ group: Y
1018
+ }), S.push({
1019
+ field: "recurrenceFreq",
1020
+ label: n("frequency", "Frequency"),
1021
+ type: "select",
1022
+ group: Y,
1023
+ visibleWhen: (c) => !!c.recurring,
1024
+ options: [
1025
+ { label: n("daily", "Daily"), value: "daily" },
1026
+ { label: n("weekly", "Weekly"), value: "weekly" },
1027
+ { label: n("monthly", "Monthly"), value: "monthly" },
1028
+ { label: n("yearly", "Yearly"), value: "yearly" }
1029
+ ]
1030
+ }), S.push({
1031
+ field: "recurrenceInterval",
1032
+ label: n("interval", "Interval"),
1033
+ type: "number",
1034
+ group: Y,
1035
+ visibleWhen: (c) => !!c.recurring
1036
+ }), S.push({
1037
+ field: "recurrenceCount",
1038
+ label: n("occurrences", "Occurrences (optional)"),
1039
+ type: "number",
1040
+ group: Y,
1041
+ visibleWhen: (c) => !!c.recurring
1042
+ });
1043
+ const A = o.eventType ?? "task", H = D?.[A];
1044
+ if (H && H.length > 0)
1045
+ S.push(...H);
1046
+ else if (A === "recipe") {
1047
+ const c = n("recipe.section", "Recipe");
1048
+ S.push(
1049
+ { field: "recipeTitle", label: n("recipe.title", "Recipe title"), type: "text", group: c },
1050
+ {
1051
+ field: "recipeServings",
1052
+ label: n("recipe.servings", "Servings"),
1053
+ type: "number",
1054
+ group: c
1055
+ },
1056
+ {
1057
+ field: "recipePrep",
1058
+ label: n("recipe.prepMinutes", "Prep (min)"),
1059
+ type: "number",
1060
+ group: c
1061
+ },
1062
+ {
1063
+ field: "recipeCook",
1064
+ label: n("recipe.cookMinutes", "Cook (min)"),
1065
+ type: "number",
1066
+ group: c
1067
+ },
1068
+ {
1069
+ field: "recipeIngredients",
1070
+ label: n("recipe.ingredients", "Ingredients (one per line)"),
1071
+ type: "textarea",
1072
+ group: c,
1073
+ hint: n("recipe.ingredients.hint", 'Format: "200 g flour"')
1074
+ },
1075
+ {
1076
+ field: "recipeSteps",
1077
+ label: n("recipe.steps", "Steps (one per line)"),
1078
+ type: "textarea",
1079
+ group: c
1080
+ }
1081
+ );
1082
+ } else if (A === "service") {
1083
+ const c = n("service.section", "Service");
1084
+ S.push(
1085
+ {
1086
+ field: "serviceName",
1087
+ label: n("service.name", "Service name"),
1088
+ type: "text",
1089
+ group: c,
1090
+ required: !0
1091
+ },
1092
+ {
1093
+ field: "serviceProvider",
1094
+ label: n("service.provider", "Provider"),
1095
+ type: "text",
1096
+ group: c
1097
+ },
1098
+ {
1099
+ field: "serviceCustomer",
1100
+ label: n("service.customer", "Customer"),
1101
+ type: "text",
1102
+ group: c
1103
+ },
1104
+ { field: "serviceContact", label: n("service.contact", "Contact"), type: "text", group: c },
1105
+ {
1106
+ field: "serviceLocation",
1107
+ label: n("service.location", "Location"),
1108
+ type: "text",
1109
+ group: c
1110
+ },
1111
+ {
1112
+ field: "servicePrice",
1113
+ label: n("service.price", "Price"),
1114
+ type: "number",
1115
+ group: c
1116
+ },
1117
+ {
1118
+ field: "serviceCurrency",
1119
+ label: n("service.currency", "Currency"),
1120
+ type: "text",
1121
+ group: c
1122
+ },
1123
+ { field: "serviceNotes", label: n("service.notes", "Notes"), type: "textarea", group: c }
1124
+ );
1125
+ }
1126
+ return S;
1127
+ }, [m, D, N, d, a, o.eventType, n]), L = () => {
1128
+ const u = o.eventType ?? "task", y = {
1129
+ title: o.title,
1130
+ description: o.description || void 0,
1131
+ color: o.color,
1132
+ category: o.category || void 0,
1133
+ eventStyle: o.eventStyle,
1134
+ allDay: o.allDay,
1135
+ start: o.start instanceof Date ? o.start : new Date(o.start),
1136
+ end: o.end instanceof Date ? o.end : new Date(o.end),
1137
+ resourceId: o.resourceId || void 0,
1138
+ eventType: u
1139
+ };
1140
+ if (o.recurring) {
1141
+ const E = {
1142
+ freq: o.recurrenceFreq || "weekly",
1143
+ interval: typeof o.recurrenceInterval == "number" && o.recurrenceInterval > 0 ? o.recurrenceInterval : 1
1144
+ };
1145
+ typeof o.recurrenceCount == "number" && o.recurrenceCount > 0 && (E.count = o.recurrenceCount), y.recurrence = E;
1146
+ } else
1147
+ y.recurrence = void 0;
1148
+ if (u === "recipe") {
1149
+ const E = String(o.recipeIngredients || "").split(`
1150
+ `).map((A) => A.trim()).filter(Boolean).map((A, H) => {
1151
+ const c = A.match(/^([\d.,/]+)\s*(\S+)?\s+(.+)$/);
1152
+ if (c) {
1153
+ const g = parseFloat(c[1].replace(",", "."));
1154
+ return {
1155
+ id: `ing-${H}`,
1156
+ name: c[3],
1157
+ quantity: isNaN(g) ? void 0 : g,
1158
+ unit: c[2]
1159
+ };
1160
+ }
1161
+ return { id: `ing-${H}`, name: A };
1162
+ }), h = String(o.recipeSteps || "").split(`
1163
+ `).map((A) => A.trim()).filter(Boolean).map((A, H) => ({
1164
+ id: `step-${H}`,
1165
+ order: H + 1,
1166
+ instruction: A
1167
+ })), S = e?.recipe ?? vt(), Y = {
1168
+ ...S,
1169
+ title: o.recipeTitle || o.title || S.title,
1170
+ servings: typeof o.recipeServings == "number" ? o.recipeServings : S.servings,
1171
+ prepMinutes: typeof o.recipePrep == "number" ? o.recipePrep : S.prepMinutes,
1172
+ cookMinutes: typeof o.recipeCook == "number" ? o.recipeCook : S.cookMinutes,
1173
+ ingredients: E,
1174
+ steps: h
1175
+ };
1176
+ y.recipe = Y, y.service = void 0;
1177
+ } else if (u === "service") {
1178
+ const E = {
1179
+ serviceName: String(o.serviceName || ""),
1180
+ providerName: o.serviceProvider || void 0,
1181
+ customerName: o.serviceCustomer || void 0,
1182
+ customerContact: o.serviceContact || void 0,
1183
+ location: o.serviceLocation || void 0,
1184
+ price: typeof o.servicePrice == "number" ? o.servicePrice : void 0,
1185
+ currency: o.serviceCurrency || void 0,
1186
+ notes: o.serviceNotes || void 0
1187
+ };
1188
+ y.service = E, y.recipe = void 0;
1189
+ } else
1190
+ y.recipe = void 0, y.service = void 0;
1191
+ return v && (y.id = e.id), y;
1192
+ };
1193
+ return /* @__PURE__ */ t(
1194
+ lt,
1195
+ {
1196
+ open: !0,
1197
+ onClose: M,
1198
+ title: v ? n("editEvent", "Edit Event") : n("newEvent", "New Event"),
1199
+ size: "md",
1200
+ footer: T ? null : /* @__PURE__ */ p(Ye, { children: [
1201
+ v && C && /* @__PURE__ */ t(
1202
+ ne,
1203
+ {
1204
+ type: "button",
1205
+ variant: "error",
1206
+ size: "sm",
1207
+ onClick: () => {
1208
+ C(e), M();
1209
+ },
1210
+ disabled: I,
1211
+ children: n("delete", "Delete")
1212
+ }
1213
+ ),
1214
+ /* @__PURE__ */ t("div", { style: { flex: 1 } }),
1215
+ /* @__PURE__ */ t(
1216
+ ne,
1217
+ {
1218
+ type: "button",
1219
+ variant: "secondary",
1220
+ size: "sm",
1221
+ onClick: M,
1222
+ disabled: I,
1223
+ children: n("cancel", "Cancel")
1224
+ }
1225
+ ),
1226
+ /* @__PURE__ */ t(
1227
+ ne,
1228
+ {
1229
+ type: "button",
1230
+ variant: "primary",
1231
+ size: "sm",
1232
+ onClick: () => {
1233
+ o.title && b(L());
1234
+ },
1235
+ disabled: I || !o.title,
1236
+ children: I ? n("saving", "Saving…") : n("save", "Save")
1237
+ }
1238
+ )
1239
+ ] }),
1240
+ children: /* @__PURE__ */ t(
1241
+ "div",
1242
+ {
1243
+ className: "nice-scheduler__form-body",
1244
+ onKeyDown: (u) => {
1245
+ u.key === "Enter" && u.target.tagName !== "TEXTAREA" && (u.preventDefault(), o.title && b(L()));
1246
+ },
1247
+ children: T ? T({
1248
+ event: e,
1249
+ slotStart: r,
1250
+ slotEnd: s,
1251
+ save: b,
1252
+ cancel: M,
1253
+ remove: C
1254
+ }) : /* @__PURE__ */ t(
1255
+ ot,
1256
+ {
1257
+ items: f,
1258
+ data: o,
1259
+ onFieldChange: $,
1260
+ columns: 1,
1261
+ gap: 12,
1262
+ size: "sm"
1263
+ }
1264
+ )
1265
+ }
1266
+ )
1267
+ }
1268
+ );
1269
+ }, Et = [
1270
+ "day",
1271
+ "workWeek",
1272
+ "week",
1273
+ "dayRange",
1274
+ "month",
1275
+ "monthRange",
1276
+ "timeline",
1277
+ "agenda"
1278
+ ], qe = ({
1279
+ events: e,
1280
+ resources: r,
1281
+ currentDate: s,
1282
+ view: d,
1283
+ onDateChange: a,
1284
+ onViewChange: m,
1285
+ onEventClick: D,
1286
+ onSlotClick: N,
1287
+ onEventDrop: T,
1288
+ draggable: I = !1,
1289
+ timelineDays: b = 7,
1290
+ startHour: C = 0,
1291
+ endHour: M = 24,
1292
+ firstDayOfWeek: n = 1,
1293
+ categories: v,
1294
+ showLegend: R,
1295
+ showTooltip: o,
1296
+ renderEvent: l,
1297
+ renderTooltip: $,
1298
+ workHours: f,
1299
+ showCurrentTime: L = !0,
1300
+ showMiniCalendar: u,
1301
+ onEventCreate: y,
1302
+ onEventEdit: E,
1303
+ onEventDelete: h,
1304
+ editable: S = !0,
1305
+ formFields: Y,
1306
+ formFieldsByType: A,
1307
+ eventTypes: H,
1308
+ renderEventEditor: c,
1309
+ loadEvents: g,
1310
+ onEventsChange: x,
1311
+ accessMode: W = "full",
1312
+ className: U,
1313
+ style: X
1314
+ }) => {
1315
+ const { t: w } = ct(), j = W === "hidden", K = W === "readOnly" || W === "disabled", J = W === "disabled", [ge, pe] = B(s ?? /* @__PURE__ */ new Date()), [ye, fe] = B(d ?? "week"), ae = s !== void 0 && a !== void 0, oe = d !== void 0 && m !== void 0, P = ae ? s : ge, k = oe ? d : ye, ze = st(null), [G, Ne] = B(() => {
1316
+ const i = /* @__PURE__ */ new Date();
1317
+ return i.setHours(0, 0, 0, 0), i;
1318
+ }), [O, be] = B(() => F(/* @__PURE__ */ new Date(), 13)), [Se, Te] = B(
1319
+ null
1320
+ ), Ve = te(
1321
+ (i, _) => {
1322
+ o && Te(i && _ ? { event: i, rect: _ } : null);
1323
+ },
1324
+ [o]
1325
+ ), [ie, le] = B(null), [Ke, _e] = B(!1), [Be, Ue] = B(null), [Je, Ge] = B(null), [Rt, $e] = B(!1), Q = Je ?? Be ?? e, [de, Xe] = B(/* @__PURE__ */ new Set()), xe = te((i) => {
1326
+ Xe((_) => {
1327
+ const q = new Set(_);
1328
+ return q.has(i) ? q.delete(i) : q.add(i), q;
1329
+ });
1330
+ }, []), Z = we(() => {
1331
+ if (k === "month")
1332
+ return {
1333
+ start: new Date(P.getFullYear(), P.getMonth(), 1),
1334
+ end: new Date(P.getFullYear(), P.getMonth() + 2, 0)
1335
+ };
1336
+ if (k === "timeline")
1337
+ return { start: new Date(P), end: F(P, b) };
1338
+ if (k === "dayRange" || k === "monthRange")
1339
+ return { start: new Date(G), end: F(O, 1) };
1340
+ const i = (() => {
1341
+ const _ = new Date(P), q = (_.getDay() - n + 7) % 7;
1342
+ return F(_, -q);
1343
+ })();
1344
+ return { start: F(i, -1), end: F(i, 8) };
1345
+ }, [P, k, n, b, G, O]), Ce = we(() => {
1346
+ let i = ft(Q, Z.start, Z.end);
1347
+ return de.size > 0 && (i = i.filter((_) => !_.category || !de.has(_.category))), i;
1348
+ }, [Q, Z, de]), ce = (i) => {
1349
+ pe(i), a?.(i);
1350
+ }, Oe = (i) => {
1351
+ fe(i), m?.(i);
1352
+ }, Ee = (i) => {
1353
+ if (k === "day")
1354
+ ce(F(P, i));
1355
+ else if (k === "week" || k === "workWeek")
1356
+ ce(F(P, i * 7));
1357
+ else if (k === "timeline")
1358
+ ce(F(P, i * b));
1359
+ else if (k === "dayRange" || k === "monthRange") {
1360
+ const _ = Math.round((O.getTime() - G.getTime()) / 864e5) + 1;
1361
+ Ne(F(G, i * _)), be(F(O, i * _));
1362
+ } else {
1363
+ const _ = new Date(P);
1364
+ _.setMonth(_.getMonth() + i), ce(_);
1365
+ }
1366
+ }, ke = we(() => {
1367
+ const i = new Date(P), _ = (i.getDay() - n + 7) % 7;
1368
+ return F(i, -_);
1369
+ }, [P, n]), ve = we(() => {
1370
+ if (k === "day")
1371
+ return [P];
1372
+ if (k === "workWeek") {
1373
+ const i = [];
1374
+ for (let _ = 0; _ < 7; _++) {
1375
+ const q = F(ke, _), ee = q.getDay();
1376
+ ee !== 0 && ee !== 6 && i.push(q);
1377
+ }
1378
+ return i;
1379
+ }
1380
+ return Array.from({ length: 7 }, (i, _) => F(ke, _));
1381
+ }, [k, P, ke]), Qe = k === "day" ? P.toLocaleDateString() : k === "week" || k === "workWeek" ? `${ve[0].toLocaleDateString()} – ${ve[ve.length - 1].toLocaleDateString()}` : k === "timeline" ? `${P.toLocaleDateString()} – ${F(P, b - 1).toLocaleDateString()}` : k === "dayRange" || k === "monthRange" ? `${G.toLocaleDateString()} – ${O.toLocaleDateString()}` : `${gt(w)[P.getMonth()]} ${P.getFullYear()}`, Ze = te(
1382
+ (i, _, q) => {
1383
+ K || (S && le({ mode: "create", slotStart: i, slotEnd: _ }), N?.(i, _, q));
1384
+ },
1385
+ [S, N, K]
1386
+ ), et = te(
1387
+ (i) => {
1388
+ S && !K && le({ mode: "edit", event: i }), D?.(i);
1389
+ },
1390
+ [S, D, K]
1391
+ ), ue = te(
1392
+ (i) => {
1393
+ Ue(i), x?.(i);
1394
+ },
1395
+ [x]
1396
+ ), tt = te(
1397
+ async (i) => {
1398
+ const _ = ie?.mode === "create";
1399
+ try {
1400
+ if (_e(!0), _) {
1401
+ const ee = (y ? await y(i) : void 0) ?? {
1402
+ ...i,
1403
+ id: typeof crypto < "u" && crypto.randomUUID ? crypto.randomUUID() : `evt_${Date.now()}_${Math.random().toString(36).slice(2, 7)}`
1404
+ }, De = Q.slice();
1405
+ De.push(ee), ue(De);
1406
+ } else {
1407
+ const ee = (E ? await E(i) : void 0) ?? i, De = Q.map((Fe) => Fe.id === ee.id ? ee : Fe);
1408
+ ue(De);
1409
+ }
1410
+ le(null);
1411
+ } finally {
1412
+ _e(!1);
1413
+ }
1414
+ },
1415
+ [ie, y, E, Q, ue]
1416
+ ), nt = te(
1417
+ async (i) => {
1418
+ try {
1419
+ _e(!0), h && await h(i);
1420
+ const _ = Q.filter((q) => q.id !== i.id);
1421
+ ue(_), le(null);
1422
+ } finally {
1423
+ _e(!1);
1424
+ }
1425
+ },
1426
+ [h, Q, ue]
1427
+ );
1428
+ z.useEffect(() => {
1429
+ if (!g)
1430
+ return;
1431
+ let i = !1;
1432
+ return $e(!0), g({ start: Z.start, end: Z.end }).then((_) => {
1433
+ i || Ge(_);
1434
+ }).finally(() => {
1435
+ i || $e(!1);
1436
+ }), () => {
1437
+ i = !0;
1438
+ };
1439
+ }, [g, Z.start.getTime(), Z.end.getTime()]);
1440
+ const rt = (i) => ({
1441
+ day: w("day", "Day"),
1442
+ week: w("week", "Week"),
1443
+ workWeek: w("workWeek", "Work Week"),
1444
+ month: w("month", "Month"),
1445
+ timeline: w("timeline", "Timeline"),
1446
+ agenda: w("agenda", "Agenda"),
1447
+ dayRange: w("dayRange", "Day Range"),
1448
+ monthRange: w("monthRange", "Month Range")
1449
+ })[i], se = {
1450
+ events: Ce,
1451
+ curDate: P,
1452
+ firstDayOfWeek: n,
1453
+ startHour: C,
1454
+ endHour: M,
1455
+ draggable: I,
1456
+ dragRef: ze,
1457
+ onEventClick: et,
1458
+ onSlotClick: Ze,
1459
+ onEventDrop: T,
1460
+ resources: r,
1461
+ timelineDays: b,
1462
+ categories: v,
1463
+ workHours: f,
1464
+ showCurrentTime: L,
1465
+ renderEvent: l,
1466
+ showTooltip: o,
1467
+ renderTooltip: $,
1468
+ onHoverEvent: Ve,
1469
+ readOnly: K,
1470
+ t: w
1471
+ }, Re = k === "dayRange" || k === "monthRange", Le = (i) => {
1472
+ const _ = (q) => q.toString().padStart(2, "0");
1473
+ return `${i.getFullYear()}-${_(i.getMonth() + 1)}-${_(i.getDate())}`;
1474
+ };
1475
+ return j ? null : /* @__PURE__ */ p(
1476
+ "div",
1477
+ {
1478
+ className: `nice-scheduler ${J ? "nice-scheduler--disabled" : ""} ${U || ""}`,
1479
+ style: X,
1480
+ children: [
1481
+ /* @__PURE__ */ p("div", { className: "nice-scheduler__toolbar", children: [
1482
+ /* @__PURE__ */ p("div", { className: "nice-scheduler__nav", children: [
1483
+ /* @__PURE__ */ p(Ae, { size: "sm", children: [
1484
+ /* @__PURE__ */ t(
1485
+ ne,
1486
+ {
1487
+ onClick: () => Ee(-1),
1488
+ disabled: J,
1489
+ "aria-label": w("previous", "Previous"),
1490
+ children: "‹"
1491
+ }
1492
+ ),
1493
+ /* @__PURE__ */ t(
1494
+ ne,
1495
+ {
1496
+ onClick: () => {
1497
+ if (Re) {
1498
+ const i = /* @__PURE__ */ new Date();
1499
+ i.setHours(0, 0, 0, 0);
1500
+ const _ = Math.round((O.getTime() - G.getTime()) / 864e5);
1501
+ Ne(i), be(F(i, _));
1502
+ } else
1503
+ ce(/* @__PURE__ */ new Date());
1504
+ },
1505
+ disabled: J,
1506
+ children: w("today", "Today")
1507
+ }
1508
+ ),
1509
+ /* @__PURE__ */ t(
1510
+ ne,
1511
+ {
1512
+ onClick: () => Ee(1),
1513
+ disabled: J,
1514
+ "aria-label": w("next", "Next"),
1515
+ children: "›"
1516
+ }
1517
+ )
1518
+ ] }),
1519
+ Re ? /* @__PURE__ */ p("span", { className: "nice-scheduler__range-picker", children: [
1520
+ /* @__PURE__ */ t(
1521
+ "input",
1522
+ {
1523
+ type: "date",
1524
+ className: "nice-textinput nice-textinput--sm",
1525
+ value: Le(G),
1526
+ disabled: J,
1527
+ onChange: (i) => {
1528
+ const _ = /* @__PURE__ */ new Date(i.target.value + "T00:00:00");
1529
+ isNaN(_.getTime()) || Ne(_);
1530
+ }
1531
+ }
1532
+ ),
1533
+ /* @__PURE__ */ t("span", { style: { margin: "0 4px" }, children: "–" }),
1534
+ /* @__PURE__ */ t(
1535
+ "input",
1536
+ {
1537
+ type: "date",
1538
+ className: "nice-textinput nice-textinput--sm",
1539
+ value: Le(O),
1540
+ disabled: J,
1541
+ onChange: (i) => {
1542
+ const _ = /* @__PURE__ */ new Date(i.target.value + "T00:00:00");
1543
+ !isNaN(_.getTime()) && _ >= G && be(_);
1544
+ }
1545
+ }
1546
+ )
1547
+ ] }) : /* @__PURE__ */ t("span", { className: "nice-scheduler__title", children: Qe })
1548
+ ] }),
1549
+ /* @__PURE__ */ t("div", { className: "nice-scheduler__views", children: /* @__PURE__ */ t(Ae, { size: "sm", children: Et.map((i) => /* @__PURE__ */ t(
1550
+ ne,
1551
+ {
1552
+ variant: i === k ? "primary" : "secondary",
1553
+ onClick: () => Oe(i),
1554
+ disabled: J,
1555
+ children: rt(i)
1556
+ },
1557
+ i
1558
+ )) }) })
1559
+ ] }),
1560
+ /* @__PURE__ */ p("div", { className: "nice-scheduler__body", children: [
1561
+ u && /* @__PURE__ */ p("div", { className: "nice-scheduler__sidebar", children: [
1562
+ /* @__PURE__ */ t(
1563
+ kt,
1564
+ {
1565
+ curDate: P,
1566
+ onDateSelect: (i) => ce(i),
1567
+ firstDayOfWeek: n,
1568
+ t: w
1569
+ }
1570
+ ),
1571
+ R && v && /* @__PURE__ */ t(
1572
+ Pe,
1573
+ {
1574
+ categories: v,
1575
+ events: Ce,
1576
+ filteredCategories: de,
1577
+ onToggleCategory: xe,
1578
+ t: w
1579
+ }
1580
+ )
1581
+ ] }),
1582
+ /* @__PURE__ */ p("div", { className: "nice-scheduler__content", children: [
1583
+ k === "month" && /* @__PURE__ */ t(wt, { ...se }),
1584
+ (k === "week" || k === "day" || k === "workWeek") && /* @__PURE__ */ t(Nt, { ...se, days: ve }),
1585
+ k === "dayRange" && /* @__PURE__ */ t(Mt, { ...se, rangeStart: G, rangeEnd: O }),
1586
+ k === "monthRange" && /* @__PURE__ */ t(Tt, { ...se, rangeStart: G, rangeEnd: O }),
1587
+ k === "timeline" && /* @__PURE__ */ t(Ct, { ...se }),
1588
+ k === "agenda" && /* @__PURE__ */ t(bt, { ...se })
1589
+ ] }),
1590
+ !u && R && v && /* @__PURE__ */ t("div", { className: "nice-scheduler__sidebar nice-scheduler__sidebar--right", children: /* @__PURE__ */ t(
1591
+ Pe,
1592
+ {
1593
+ categories: v,
1594
+ events: Ce,
1595
+ filteredCategories: de,
1596
+ onToggleCategory: xe,
1597
+ t: w
1598
+ }
1599
+ ) })
1600
+ ] }),
1601
+ Se && /* @__PURE__ */ t(
1602
+ $t,
1603
+ {
1604
+ event: Se.event,
1605
+ rect: Se.rect,
1606
+ categories: v,
1607
+ renderTooltip: $
1608
+ }
1609
+ ),
1610
+ ie && S && /* @__PURE__ */ t(
1611
+ xt,
1612
+ {
1613
+ event: ie.event,
1614
+ slotStart: ie.slotStart,
1615
+ slotEnd: ie.slotEnd,
1616
+ categories: v,
1617
+ resources: r,
1618
+ formFields: Y,
1619
+ formFieldsByType: A,
1620
+ eventTypes: H,
1621
+ renderEditor: c,
1622
+ saving: Ke,
1623
+ onSave: tt,
1624
+ onDelete: nt,
1625
+ onClose: () => le(null),
1626
+ t: w
1627
+ }
1628
+ )
1629
+ ]
1630
+ }
1631
+ );
1632
+ };
1633
+ qe.displayName = "NiceScheduler";
1634
+ const Ht = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1635
+ __proto__: null,
1636
+ NiceScheduler: qe
1637
+ }, Symbol.toStringTag, { value: "Module" }));
1638
+ export {
1639
+ Ae as N,
1640
+ qe as a,
1641
+ Ht as b,
1642
+ vt as c,
1643
+ _t as n,
1644
+ Dt as r
1645
+ };