@innosolutions/inno-calendar 1.0.70 → 1.0.71

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 (58) hide show
  1. package/dist/agenda-widget-Bl-Gb588.cjs +2 -0
  2. package/dist/agenda-widget-Bl-Gb588.cjs.map +1 -0
  3. package/dist/{agenda-widget-GRHaHwQ2.js → agenda-widget-DrRyLzTK.js} +89 -87
  4. package/dist/agenda-widget-DrRyLzTK.js.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 +23 -1
  8. package/dist/components/inno-calendar.d.ts.map +1 -1
  9. package/dist/core/context/inno-calendar-provider.d.ts +8 -2
  10. package/dist/core/context/inno-calendar-provider.d.ts.map +1 -1
  11. package/dist/core/index.cjs +1 -1
  12. package/dist/core/index.d.ts +1 -1
  13. package/dist/core/index.d.ts.map +1 -1
  14. package/dist/core/index.mjs +4 -4
  15. package/dist/core/types.d.ts +40 -0
  16. package/dist/core/types.d.ts.map +1 -1
  17. package/dist/core/utils/view-storage.d.ts +14 -10
  18. package/dist/core/utils/view-storage.d.ts.map +1 -1
  19. package/dist/index.cjs +1 -1
  20. package/dist/index.mjs +7 -7
  21. package/dist/position-utils-D_KpwRus.js +1053 -0
  22. package/dist/position-utils-D_KpwRus.js.map +1 -0
  23. package/dist/position-utils-ksZ_IjXC.cjs +2 -0
  24. package/dist/position-utils-ksZ_IjXC.cjs.map +1 -0
  25. package/dist/presets/index.cjs +1 -1
  26. package/dist/presets/index.mjs +1 -1
  27. package/dist/slot-selection-context-CLYZU6ul.cjs +2 -0
  28. package/dist/{slot-selection-context-DvTn_R-Z.cjs.map → slot-selection-context-CLYZU6ul.cjs.map} +1 -1
  29. package/dist/slot-selection-context-Ct5cVcKW.js +611 -0
  30. package/dist/{slot-selection-context-D6zo91K_.js.map → slot-selection-context-Ct5cVcKW.js.map} +1 -1
  31. package/dist/{tailwind-calendar-BA7v_Wgx.cjs → tailwind-calendar-BbUb61uY.cjs} +2 -2
  32. package/dist/{tailwind-calendar-BA7v_Wgx.cjs.map → tailwind-calendar-BbUb61uY.cjs.map} +1 -1
  33. package/dist/{tailwind-calendar-Bh1yB1jf.js → tailwind-calendar-DrwGVSF-.js} +3 -3
  34. package/dist/{tailwind-calendar-Bh1yB1jf.js.map → tailwind-calendar-DrwGVSF-.js.map} +1 -1
  35. package/dist/{use-calendar-BwqE_WNA.cjs → use-calendar-BK0nQYJq.cjs} +2 -2
  36. package/dist/{use-calendar-BwqE_WNA.cjs.map → use-calendar-BK0nQYJq.cjs.map} +1 -1
  37. package/dist/{use-calendar--JnbGA3L.js → use-calendar-DJI35SSd.js} +2 -2
  38. package/dist/{use-calendar--JnbGA3L.js.map → use-calendar-DJI35SSd.js.map} +1 -1
  39. package/dist/{use-slot-selection-C1tk-o0j.cjs → use-slot-selection-CCE11R4j.cjs} +2 -2
  40. package/dist/{use-slot-selection-C1tk-o0j.cjs.map → use-slot-selection-CCE11R4j.cjs.map} +1 -1
  41. package/dist/{use-slot-selection-BLCDzQzo.js → use-slot-selection-CX1w8EdM.js} +3 -3
  42. package/dist/{use-slot-selection-BLCDzQzo.js.map → use-slot-selection-CX1w8EdM.js.map} +1 -1
  43. package/dist/utils.cjs +1 -1
  44. package/dist/utils.mjs +1 -1
  45. package/dist/{week-view-D1wefMb8.cjs → week-view-BXmaRChB.cjs} +2 -2
  46. package/dist/{week-view-D1wefMb8.cjs.map → week-view-BXmaRChB.cjs.map} +1 -1
  47. package/dist/{week-view-BbtTpJTU.js → week-view-BeasFcyR.js} +3 -3
  48. package/dist/{week-view-BbtTpJTU.js.map → week-view-BeasFcyR.js.map} +1 -1
  49. package/package.json +1 -1
  50. package/dist/agenda-widget-GRHaHwQ2.js.map +0 -1
  51. package/dist/agenda-widget-TLJuxen3.cjs +0 -2
  52. package/dist/agenda-widget-TLJuxen3.cjs.map +0 -1
  53. package/dist/position-utils-BzmOPdvQ.js +0 -1038
  54. package/dist/position-utils-BzmOPdvQ.js.map +0 -1
  55. package/dist/position-utils-EQTCC4tZ.cjs +0 -2
  56. package/dist/position-utils-EQTCC4tZ.cjs.map +0 -1
  57. package/dist/slot-selection-context-D6zo91K_.js +0 -610
  58. package/dist/slot-selection-context-DvTn_R-Z.cjs +0 -2
@@ -1,1038 +0,0 @@
1
- import { isValidElement as q } from "react";
2
- const Q = "inno-calendar-preferences";
3
- function I(t) {
4
- if (t == null || typeof t == "boolean") return "";
5
- if (typeof t == "string") return t;
6
- if (typeof t == "number") return String(t);
7
- if (Array.isArray(t)) return t.map(I).join("");
8
- if (q(t)) {
9
- const e = t.props;
10
- return I(e.children);
11
- }
12
- return "";
13
- }
14
- const A = "inno-calendar-view", O = "inno-calendar-resource-view", Z = [
15
- "day",
16
- "week",
17
- "month",
18
- "year",
19
- "agenda"
20
- ], tt = [
21
- "timeline-day",
22
- "timeline-3day",
23
- "timeline-week",
24
- "resource-day",
25
- "resource-week"
26
- ];
27
- function F(t) {
28
- return typeof t == "string" && Z.includes(t);
29
- }
30
- function x(t) {
31
- return typeof t == "string" && tt.includes(t);
32
- }
33
- function C() {
34
- return typeof window < "u" && typeof window.localStorage < "u";
35
- }
36
- function N(t) {
37
- if (!C()) return null;
38
- try {
39
- return window.localStorage.getItem(t);
40
- } catch {
41
- return console.warn(`[InnoCalendar] Failed to read "${t}" from localStorage`), null;
42
- }
43
- }
44
- function B(t, e) {
45
- if (C())
46
- try {
47
- window.localStorage.setItem(t, e);
48
- } catch {
49
- console.warn(`[InnoCalendar] Failed to write "${t}" to localStorage`);
50
- }
51
- }
52
- function P(t) {
53
- if (C())
54
- try {
55
- window.localStorage.removeItem(t);
56
- } catch {
57
- console.warn(`[InnoCalendar] Failed to remove "${t}" from localStorage`);
58
- }
59
- }
60
- function et(t, e = A) {
61
- F(t) && B(e, t);
62
- }
63
- function nt(t = A) {
64
- const e = N(t);
65
- return F(e) ? e : null;
66
- }
67
- function Tt(t = A) {
68
- P(t);
69
- }
70
- function rt(t, e = O) {
71
- x(t) && B(e, t);
72
- }
73
- function at(t = O) {
74
- const e = N(t);
75
- return x(e) ? e : null;
76
- }
77
- function Et(t = O) {
78
- P(t);
79
- }
80
- function St(t) {
81
- if (F(t)) {
82
- et(t);
83
- return;
84
- }
85
- x(t) && rt(t);
86
- }
87
- function ot() {
88
- if (!C()) return null;
89
- try {
90
- const t = window.localStorage.getItem(Q);
91
- if (!t) return null;
92
- const n = JSON.parse(t)?.view;
93
- return F(n) || x(n) ? n : null;
94
- } catch {
95
- return null;
96
- }
97
- }
98
- function Mt() {
99
- return nt() ?? at() ?? ot();
100
- }
101
- const bt = [
102
- "day",
103
- "week",
104
- "month",
105
- "year",
106
- "agenda",
107
- "resource-day",
108
- "resource-week",
109
- "timeline-day",
110
- "timeline-week"
111
- ], Ht = {
112
- startHour: 8,
113
- endHour: 18,
114
- firstDayOfWeek: 1,
115
- // Monday
116
- slotDuration: 30,
117
- showWeekends: !0,
118
- timeFormat: "24h",
119
- badgeVariant: "colored",
120
- showCanceledEvents: !1
121
- }, It = {
122
- startHour: 0,
123
- endHour: 24
124
- }, kt = {
125
- startHour: 8,
126
- endHour: 18
127
- }, Ft = {
128
- day: {
129
- type: "day",
130
- slotMinTime: "00:00",
131
- slotMaxTime: "24:00",
132
- slotDuration: "00:30:00",
133
- scrollTime: "08:00:00",
134
- allDaySlot: !0
135
- },
136
- week: {
137
- type: "week",
138
- slotMinTime: "00:00",
139
- slotMaxTime: "24:00",
140
- slotDuration: "00:30:00",
141
- scrollTime: "08:00:00",
142
- dayMaxEventRows: 3,
143
- allDaySlot: !0
144
- },
145
- month: {
146
- type: "month",
147
- dayMaxEventRows: 4,
148
- eventMaxStack: 3,
149
- allDaySlot: !1
150
- },
151
- year: {
152
- type: "year",
153
- dayMaxEventRows: 2,
154
- allDaySlot: !1
155
- },
156
- agenda: {
157
- type: "agenda",
158
- allDaySlot: !1
159
- },
160
- "resource-day": {
161
- type: "resource-day",
162
- slotMinTime: "00:00",
163
- slotMaxTime: "24:00",
164
- slotDuration: "00:30:00",
165
- scrollTime: "08:00:00",
166
- allDaySlot: !0
167
- },
168
- "resource-week": {
169
- type: "resource-week",
170
- slotMinTime: "00:00",
171
- slotMaxTime: "24:00",
172
- slotDuration: "00:30:00",
173
- scrollTime: "08:00:00",
174
- allDaySlot: !0
175
- },
176
- "timeline-day": {
177
- type: "timeline-day",
178
- slotDuration: "01:00:00"
179
- },
180
- "timeline-3day": {
181
- type: "timeline-3day",
182
- slotDuration: "01:00:00"
183
- },
184
- "timeline-week": {
185
- type: "timeline-week",
186
- slotDuration: "01:00:00"
187
- }
188
- }, xt = {
189
- blue: "#3b82f6",
190
- green: "#22c55e",
191
- red: "#ef4444",
192
- yellow: "#eab308",
193
- purple: "#a855f7",
194
- orange: "#f97316",
195
- pink: "#ec4899",
196
- teal: "#14b8a6",
197
- gray: "#6b7280",
198
- indigo: "#6366f1"
199
- }, Ct = {
200
- blue: { bg: "bg-blue-100", text: "text-blue-800", border: "border-blue-300" },
201
- green: { bg: "bg-green-100", text: "text-green-800", border: "border-green-300" },
202
- red: { bg: "bg-red-100", text: "text-red-800", border: "border-red-300" },
203
- yellow: { bg: "bg-yellow-100", text: "text-yellow-800", border: "border-yellow-300" },
204
- purple: { bg: "bg-purple-100", text: "text-purple-800", border: "border-purple-300" },
205
- orange: { bg: "bg-orange-100", text: "text-orange-800", border: "border-orange-300" },
206
- pink: { bg: "bg-pink-100", text: "text-pink-800", border: "border-pink-300" },
207
- teal: { bg: "bg-teal-100", text: "text-teal-800", border: "border-teal-300" },
208
- gray: { bg: "bg-gray-100", text: "text-gray-800", border: "border-gray-300" },
209
- indigo: { bg: "bg-indigo-100", text: "text-indigo-800", border: "border-indigo-300" }
210
- }, Rt = {
211
- "#3b82f6": "blue",
212
- "#22c55e": "green",
213
- "#ef4444": "red",
214
- "#eab308": "yellow",
215
- "#a855f7": "purple",
216
- "#f97316": "orange",
217
- "#ec4899": "pink",
218
- "#14b8a6": "teal",
219
- "#6b7280": "gray",
220
- "#6366f1": "indigo"
221
- }, _t = 24, $t = 60, st = 60 * 1e3, ut = 60 * st, At = 24 * ut, R = 64, Ot = 32, Wt = 56, vt = 200, it = 20;
222
- function g(t) {
223
- const e = new Date(t);
224
- return e.setHours(0, 0, 0, 0), e;
225
- }
226
- function w(t) {
227
- const e = new Date(t);
228
- return e.setHours(23, 59, 59, 999), e;
229
- }
230
- function l(t, e) {
231
- const n = new Date(t);
232
- return n.setDate(n.getDate() + e), n;
233
- }
234
- function Ut(t, e) {
235
- return l(t, -e);
236
- }
237
- function p(t, e) {
238
- return t.getFullYear() === e.getFullYear() && t.getMonth() === e.getMonth() && t.getDate() === e.getDate();
239
- }
240
- function G(t) {
241
- return p(t, /* @__PURE__ */ new Date());
242
- }
243
- function Vt(t) {
244
- return t.getDay();
245
- }
246
- function K(t) {
247
- const e = t.getDay();
248
- return e === 0 || e === 6;
249
- }
250
- function m(t, e = 1) {
251
- const n = new Date(t), r = n.getDay(), a = (r < e ? 7 : 0) + r - e;
252
- return n.setDate(n.getDate() - a), n.setHours(0, 0, 0, 0), n;
253
- }
254
- function T(t, e = 1) {
255
- const n = m(t, e);
256
- return n.setDate(n.getDate() + 6), n.setHours(23, 59, 59, 999), n;
257
- }
258
- function k(t, e) {
259
- return l(t, e * 7);
260
- }
261
- function Yt(t, e) {
262
- return l(t, -e * 7);
263
- }
264
- function Lt(t) {
265
- const e = new Date(Date.UTC(t.getFullYear(), t.getMonth(), t.getDate())), n = e.getUTCDay() || 7;
266
- e.setUTCDate(e.getUTCDate() + 4 - n);
267
- const r = new Date(Date.UTC(e.getUTCFullYear(), 0, 1));
268
- return Math.ceil(((e.getTime() - r.getTime()) / 864e5 + 1) / 7);
269
- }
270
- function Nt(t, e, n = 1) {
271
- const r = m(t, n), a = m(e, n);
272
- return p(r, a);
273
- }
274
- function S(t) {
275
- const e = new Date(t);
276
- return e.setDate(1), e.setHours(0, 0, 0, 0), e;
277
- }
278
- function M(t) {
279
- const e = new Date(t.getFullYear(), t.getMonth() + 1, 0);
280
- return e.setHours(23, 59, 59, 999), e;
281
- }
282
- function _(t, e) {
283
- const n = new Date(t);
284
- return n.setMonth(n.getMonth() + e), n;
285
- }
286
- function Bt(t, e) {
287
- return _(t, -e);
288
- }
289
- function Pt(t) {
290
- return new Date(t.getFullYear(), t.getMonth() + 1, 0).getDate();
291
- }
292
- function W(t, e) {
293
- return t.getFullYear() === e.getFullYear() && t.getMonth() === e.getMonth();
294
- }
295
- function z(t) {
296
- return new Date(t.getFullYear(), 0, 1, 0, 0, 0, 0);
297
- }
298
- function ct(t) {
299
- return new Date(t.getFullYear(), 11, 31, 23, 59, 59, 999);
300
- }
301
- function v(t, e) {
302
- const n = new Date(t);
303
- return n.setFullYear(n.getFullYear() + e), n;
304
- }
305
- function Gt(t, e) {
306
- return v(t, -e);
307
- }
308
- function Kt(t, e) {
309
- return t.getFullYear() === e.getFullYear();
310
- }
311
- function lt(t, e) {
312
- const n = new Date(t);
313
- return n.setHours(n.getHours() + e), n;
314
- }
315
- function zt(t, e) {
316
- const n = new Date(t);
317
- return n.setMinutes(n.getMinutes() + e), n;
318
- }
319
- function Jt(t, e, n = 0, r = 0) {
320
- const a = new Date(t);
321
- return a.setHours(e, n, r, 0), a;
322
- }
323
- function jt(t) {
324
- return t.getHours() + t.getMinutes() / 60;
325
- }
326
- function Xt(t, e) {
327
- return t.getTime() < e.getTime();
328
- }
329
- function qt(t, e) {
330
- return t.getTime() > e.getTime();
331
- }
332
- function Qt(t, e, n) {
333
- const r = t.getTime();
334
- return r >= e.getTime() && r <= n.getTime();
335
- }
336
- function Zt(t) {
337
- if (t.length !== 0)
338
- return t.reduce((e, n) => n < e ? n : e);
339
- }
340
- function te(t) {
341
- if (t.length !== 0)
342
- return t.reduce((e, n) => n > e ? n : e);
343
- }
344
- function U(t, e) {
345
- return t.getTime() - e.getTime();
346
- }
347
- function ee(t, e) {
348
- return Math.floor(U(t, e) / 6e4);
349
- }
350
- function ne(t, e) {
351
- return Math.floor(U(t, e) / 36e5);
352
- }
353
- function re(t, e) {
354
- const n = g(t), r = g(e);
355
- return Math.floor(U(n, r) / 864e5);
356
- }
357
- function H(t, e = "24h") {
358
- const n = t.getHours(), r = t.getMinutes();
359
- if (e === "12h") {
360
- const a = n >= 12 ? "PM" : "AM";
361
- return `${n % 12 || 12}:${r.toString().padStart(2, "0")} ${a}`;
362
- }
363
- return `${n.toString().padStart(2, "0")}:${r.toString().padStart(2, "0")}`;
364
- }
365
- function ae(t) {
366
- const e = t.getFullYear(), n = (t.getMonth() + 1).toString().padStart(2, "0"), r = t.getDate().toString().padStart(2, "0");
367
- return `${e}-${n}-${r}`;
368
- }
369
- function oe(t) {
370
- return new Date(t);
371
- }
372
- function ft(t, e) {
373
- const n = [];
374
- let r = g(t);
375
- const a = g(e);
376
- for (; r <= a; )
377
- n.push(new Date(r)), r = l(r, 1);
378
- return n;
379
- }
380
- function se(t, e) {
381
- const n = [];
382
- let r = new Date(t);
383
- for (; r <= e; )
384
- n.push(new Date(r)), r = lt(r, 1);
385
- return n;
386
- }
387
- function ue(t = "en-US", e = "short") {
388
- const n = new Intl.DateTimeFormat(t, { weekday: e }), r = [], a = new Date(2024, 0, 7);
389
- for (let o = 0; o < 7; o++)
390
- r.push(n.format(l(a, o)));
391
- return r;
392
- }
393
- function ie(t = "en-US", e = "long") {
394
- const n = new Intl.DateTimeFormat(t, { month: e }), r = [];
395
- for (let a = 0; a < 12; a++)
396
- r.push(n.format(new Date(2024, a, 1)));
397
- return r;
398
- }
399
- function ce(t) {
400
- const e = [];
401
- for (let n = t.startHour; n <= t.endHour; n++)
402
- e.push(n);
403
- return e;
404
- }
405
- function le(t, e = "24h") {
406
- if (e === "12h") {
407
- const n = t >= 12 ? "PM" : "AM";
408
- return `${t % 12 || 12} ${n}`;
409
- }
410
- return `${String(t).padStart(2, "0")}:00`;
411
- }
412
- function fe(t, e = 1) {
413
- const n = m(t, e), r = [];
414
- for (let a = 0; a < 7; a++)
415
- r.push(l(n, a));
416
- return r;
417
- }
418
- function de(t, e = 1) {
419
- const n = S(t), r = M(t), a = m(n, e), o = T(r, e), s = t.getMonth();
420
- return ft(a, o).map((c) => ({
421
- date: c,
422
- isCurrentMonth: c.getMonth() === s,
423
- isWeekend: c.getDay() === 0 || c.getDay() === 6
424
- }));
425
- }
426
- function V(t) {
427
- if (t.isAllDay === !0) return !0;
428
- if (t.isAllDay === !1) return !1;
429
- const e = t.startDate.getHours(), n = t.startDate.getMinutes(), r = t.endDate.getHours(), a = t.endDate.getMinutes(), o = e === 0 && n === 0, s = r === 0 && a === 0 || // midnight next day
430
- r === 23 && a >= 59;
431
- return !!(o && s);
432
- }
433
- function ge(t) {
434
- const e = [], n = [];
435
- for (const r of t)
436
- V(r) ? n.push(r) : p(r.startDate, r.endDate) ? e.push(r) : n.push(r);
437
- return { singleDay: e, multiDay: n };
438
- }
439
- function me(t, e, n) {
440
- return t.filter((r) => r.startDate <= n && r.endDate >= e);
441
- }
442
- function De(t, e, n) {
443
- if (!n) return !0;
444
- const r = t.getDay(), a = n[r];
445
- return !a || !(a.enabled !== !1) || a.from === a.to ? !1 : e >= a.from && e < a.to;
446
- }
447
- function he(t, e) {
448
- const n = t.getDay(), r = e[n];
449
- return !r || !(r.enabled !== !1) || r.from === r.to ? null : { from: r.from, to: r.to };
450
- }
451
- function ye(t) {
452
- const e = [];
453
- for (let n = 0; n < 12; n++)
454
- e.push(new Date(t, n, 1));
455
- return e;
456
- }
457
- function dt(t, e, n) {
458
- const r = g(e), a = w(n);
459
- return t.filter((o) => {
460
- const s = o.startDate, u = o.endDate;
461
- return s <= a && u >= r;
462
- });
463
- }
464
- function gt(t, e) {
465
- return e.length === 0 ? t : t.filter(
466
- (n) => n.scheduleTypeId !== void 0 && e.includes(n.scheduleTypeId)
467
- );
468
- }
469
- function mt(t, e) {
470
- return e.length === 0 ? t : t.filter(
471
- (n) => n.resourceId !== void 0 && e.includes(n.resourceId)
472
- );
473
- }
474
- function Dt(t, e) {
475
- if (!e.trim()) return t;
476
- const n = e.toLowerCase();
477
- return t.filter((r) => {
478
- const a = I(r.title).toLowerCase().includes(n), o = I(r.description).toLowerCase().includes(n);
479
- return a || o;
480
- });
481
- }
482
- function ht(t) {
483
- return t.filter((e) => !e.isCanceled);
484
- }
485
- function pe(t, e) {
486
- let n = [...t];
487
- return e.dateRange && (n = dt(
488
- n,
489
- e.dateRange.startDate,
490
- e.dateRange.endDate
491
- )), e.scheduleTypeIds && e.scheduleTypeIds.length > 0 && (n = gt(n, e.scheduleTypeIds)), e.resourceIds && e.resourceIds.length > 0 && (n = mt(n, e.resourceIds)), e.search && (n = Dt(n, e.search)), e.showCanceled || (n = ht(n)), n;
492
- }
493
- function we(t) {
494
- return [...t].sort((e, n) => e.startDate.getTime() - n.startDate.getTime());
495
- }
496
- function Te(t) {
497
- return [...t].sort((e, n) => e.endDate.getTime() - n.endDate.getTime());
498
- }
499
- function Ee(t) {
500
- return [...t].sort((e, n) => {
501
- const r = e.endDate.getTime() - e.startDate.getTime();
502
- return n.endDate.getTime() - n.startDate.getTime() - r;
503
- });
504
- }
505
- function Se(t) {
506
- const e = /* @__PURE__ */ new Map();
507
- for (const n of t) {
508
- const r = g(n.startDate).toISOString(), a = e.get(r) ?? [];
509
- a.push(n), e.set(r, a);
510
- }
511
- return e;
512
- }
513
- function Me(t) {
514
- const e = /* @__PURE__ */ new Map();
515
- for (const n of t) {
516
- const r = e.get(n.scheduleTypeId) ?? [];
517
- r.push(n), e.set(n.scheduleTypeId, r);
518
- }
519
- return e;
520
- }
521
- function be(t) {
522
- const e = /* @__PURE__ */ new Map();
523
- for (const n of t) {
524
- const r = e.get(n.resourceId) ?? [];
525
- r.push(n), e.set(n.resourceId, r);
526
- }
527
- return e;
528
- }
529
- function He(t, e) {
530
- return t.filter((n) => {
531
- const r = g(e), a = w(e);
532
- return n.startDate <= a && n.endDate >= r;
533
- });
534
- }
535
- function Ie(t) {
536
- return t.filter((e) => e.isAllDay);
537
- }
538
- function ke(t) {
539
- return t.filter((e) => !e.isAllDay);
540
- }
541
- function Fe(t) {
542
- return t.filter((e) => e.isMultiDay ? !0 : !p(e.startDate, e.endDate));
543
- }
544
- function xe(t) {
545
- return t.isMultiDay ? !0 : !p(t.startDate, t.endDate);
546
- }
547
- function Ce(t) {
548
- return Math.floor((t.endDate.getTime() - t.startDate.getTime()) / 6e4);
549
- }
550
- function Re(t, e = "blue") {
551
- return t.color ?? e;
552
- }
553
- function _e(t, e, n = "blue") {
554
- if (t.color) return t.color;
555
- if (t.scheduleTypeId !== void 0 && e) {
556
- const r = e.get(t.scheduleTypeId);
557
- if (r) return r;
558
- }
559
- return n;
560
- }
561
- function $e(t) {
562
- if (V(t)) {
563
- if (p(t.startDate, t.endDate))
564
- return "All day";
565
- const n = t.startDate.toLocaleDateString(void 0, {
566
- month: "short",
567
- day: "numeric"
568
- }), r = t.endDate.toLocaleDateString(void 0, {
569
- month: "short",
570
- day: "numeric"
571
- });
572
- return `All day · ${n} – ${r}`;
573
- }
574
- if (!p(t.startDate, t.endDate)) {
575
- const n = t.startDate.toLocaleDateString(void 0, {
576
- month: "short",
577
- day: "numeric"
578
- }), r = t.endDate.toLocaleDateString(void 0, {
579
- month: "short",
580
- day: "numeric"
581
- });
582
- return `${n}, ${H(t.startDate)} – ${r}, ${H(t.endDate)}`;
583
- }
584
- return `${H(t.startDate)} - ${H(t.endDate)}`;
585
- }
586
- function Ae(t) {
587
- return !V(t);
588
- }
589
- function yt(t, e, n = 1) {
590
- switch (e) {
591
- case "day":
592
- case "resource-day":
593
- case "timeline-day":
594
- return {
595
- startDate: g(t),
596
- endDate: w(t)
597
- };
598
- case "week":
599
- case "resource-week":
600
- case "timeline-week":
601
- return {
602
- startDate: m(t, n),
603
- endDate: T(t, n)
604
- };
605
- case "month": {
606
- const r = S(t), a = M(t);
607
- return {
608
- startDate: m(r, n),
609
- endDate: T(a, n)
610
- };
611
- }
612
- case "timeline-3day":
613
- return {
614
- startDate: g(t),
615
- endDate: w(l(t, 2))
616
- };
617
- case "year":
618
- return {
619
- startDate: z(t),
620
- endDate: ct(t)
621
- };
622
- case "agenda":
623
- return {
624
- startDate: g(t),
625
- endDate: w(l(t, 29))
626
- };
627
- default:
628
- return {
629
- startDate: g(t),
630
- endDate: w(t)
631
- };
632
- }
633
- }
634
- function Oe(t, e) {
635
- switch (e) {
636
- case "day":
637
- case "resource-day":
638
- case "timeline-day":
639
- return l(t, 1);
640
- case "timeline-3day":
641
- return l(t, 3);
642
- case "week":
643
- case "resource-week":
644
- case "timeline-week":
645
- return k(t, 1);
646
- case "month":
647
- return _(t, 1);
648
- case "year":
649
- return v(t, 1);
650
- case "agenda":
651
- return k(t, 1);
652
- default:
653
- return l(t, 1);
654
- }
655
- }
656
- function We(t, e) {
657
- switch (e) {
658
- case "day":
659
- case "resource-day":
660
- case "timeline-day":
661
- return l(t, -1);
662
- case "timeline-3day":
663
- return l(t, -3);
664
- case "week":
665
- case "resource-week":
666
- case "timeline-week":
667
- return k(t, -1);
668
- case "month":
669
- return _(t, -1);
670
- case "year":
671
- return v(t, -1);
672
- case "agenda":
673
- return k(t, -1);
674
- default:
675
- return l(t, -1);
676
- }
677
- }
678
- function ve() {
679
- return g(/* @__PURE__ */ new Date());
680
- }
681
- function Ue(t, e = 1) {
682
- const n = S(t), r = M(t), a = m(n, e), o = T(r, e), s = [];
683
- let u = a;
684
- for (; u <= o; )
685
- s.push({
686
- date: new Date(u),
687
- isToday: G(u),
688
- isCurrentMonth: W(u, t),
689
- isWeekend: K(u),
690
- dayOfWeek: u.getDay()
691
- }), u = l(u, 1);
692
- return s;
693
- }
694
- function Ve(t, e = 1) {
695
- const n = m(t, e), r = [];
696
- for (let a = 0; a < 7; a++) {
697
- const o = l(n, a);
698
- r.push({
699
- date: o,
700
- isToday: G(o),
701
- isCurrentMonth: W(o, t),
702
- isWeekend: K(o),
703
- dayOfWeek: o.getDay()
704
- });
705
- }
706
- return r;
707
- }
708
- function Ye(t) {
709
- const e = z(t), n = [];
710
- for (let r = 0; r < 12; r++) {
711
- const a = _(e, r);
712
- n.push({
713
- date: a,
714
- isToday: W(a, /* @__PURE__ */ new Date()),
715
- isCurrentMonth: !0,
716
- isWeekend: !1,
717
- dayOfWeek: a.getDay()
718
- });
719
- }
720
- return n;
721
- }
722
- function Le(t, e, n = 30) {
723
- const r = [], a = 60 / n;
724
- for (let o = t; o < e; o++)
725
- for (let s = 0; s < a; s++) {
726
- const u = s * n;
727
- r.push({
728
- hour: o,
729
- minute: u,
730
- label: `${o.toString().padStart(2, "0")}:${u.toString().padStart(2, "0")}`
731
- });
732
- }
733
- return r;
734
- }
735
- function Ne(t, e, n = "24h") {
736
- const r = [];
737
- for (let a = t; a <= e; a++) {
738
- let o;
739
- if (n === "12h") {
740
- const s = a >= 12 ? "PM" : "AM";
741
- o = `${a % 12 || 12} ${s}`;
742
- } else
743
- o = `${a.toString().padStart(2, "0")}:00`;
744
- r.push({ hour: a, label: o });
745
- }
746
- return r;
747
- }
748
- function Be(t, e, n = "en-US") {
749
- const r = new Intl.DateTimeFormat(n, {
750
- weekday: "short",
751
- month: "short",
752
- day: "numeric"
753
- }), a = new Intl.DateTimeFormat(n, { month: "short", day: "numeric" });
754
- switch (e) {
755
- case "day":
756
- case "resource-day":
757
- case "timeline-day":
758
- return r.format(t);
759
- case "timeline-3day": {
760
- const o = g(t), s = l(t, 2);
761
- return `${a.format(o)} - ${a.format(s)}`;
762
- }
763
- case "week":
764
- case "resource-week":
765
- case "timeline-week": {
766
- const o = m(t, 1), s = T(t, 1);
767
- return `${a.format(o)} - ${a.format(s)}`;
768
- }
769
- case "month": {
770
- const o = S(t), s = M(t);
771
- return `${a.format(o)} - ${a.format(s)}`;
772
- }
773
- case "year":
774
- return `Jan 1 - Dec 31, ${t.getFullYear()}`;
775
- case "agenda": {
776
- const o = S(t), s = M(t);
777
- return `${a.format(o)} - ${a.format(s)}`;
778
- }
779
- default:
780
- return "";
781
- }
782
- }
783
- function Pe(t, e, n, r = 1) {
784
- const a = yt(e, n, r);
785
- return t.filter((o) => o.startDate <= a.endDate && o.endDate >= a.startDate).length;
786
- }
787
- function Ge(t, e, n = "en-US") {
788
- const r = new Intl.DateTimeFormat(n, { month: "long", year: "numeric" }), a = new Intl.DateTimeFormat(n, {
789
- weekday: "long",
790
- month: "long",
791
- day: "numeric",
792
- year: "numeric"
793
- });
794
- switch (e) {
795
- case "day":
796
- case "resource-day":
797
- case "timeline-day":
798
- return a.format(t);
799
- case "week":
800
- case "resource-week":
801
- case "timeline-week": {
802
- const o = m(t, 1), s = T(t, 1), u = new Intl.DateTimeFormat(n, { month: "short" }).format(o), c = new Intl.DateTimeFormat(n, { month: "short" }).format(s), i = o.getFullYear();
803
- return u === c ? `${u} ${o.getDate()} - ${s.getDate()}, ${i}` : `${u} ${o.getDate()} - ${c} ${s.getDate()}, ${i}`;
804
- }
805
- case "month":
806
- return r.format(t);
807
- case "year":
808
- return t.getFullYear().toString();
809
- case "agenda":
810
- return `Agenda - ${r.format(t)}`;
811
- default:
812
- return r.format(t);
813
- }
814
- }
815
- function Ke(t = 1, e = "short", n = "en-US") {
816
- const r = new Intl.DateTimeFormat(n, { weekday: e }), a = [], o = new Date(2024, 0, 7);
817
- for (let s = 0; s < 7; s++) {
818
- const u = (t + s) % 7, c = l(o, u);
819
- a.push({
820
- dayOfWeek: u,
821
- label: r.format(c)
822
- });
823
- }
824
- return a;
825
- }
826
- function pt(t, e, n, r = R) {
827
- const { startHour: a, endHour: o } = n, s = o - a, u = s * r, c = t.startDate.getHours() + t.startDate.getMinutes() / 60, i = t.endDate.getHours() + t.endDate.getMinutes() / 60, d = Math.max(c, a), y = Math.min(i, o), D = (d - a) / s * u, h = (y - a) / s * u, f = Math.max(h - D, it);
828
- return {
829
- top: D,
830
- height: f,
831
- left: 0,
832
- width: 100,
833
- zIndex: 1
834
- };
835
- }
836
- function ze(t, e, n, r = R) {
837
- if (t.length === 0) return [];
838
- const a = [...t].sort((i, d) => {
839
- const y = i.startDate.getTime() - d.startDate.getTime();
840
- if (y !== 0) return y;
841
- const D = i.endDate.getTime() - i.startDate.getTime();
842
- return d.endDate.getTime() - d.startDate.getTime() - D;
843
- }), o = [];
844
- let s = [], u = 0;
845
- for (const i of a)
846
- s.length === 0 || i.startDate.getTime() < u ? (s.push(i), u = Math.max(u, i.endDate.getTime())) : (o.push(s), s = [i], u = i.endDate.getTime());
847
- s.length > 0 && o.push(s);
848
- const c = [];
849
- for (const i of o) {
850
- const d = [];
851
- for (const f of i) {
852
- const J = f.startDate.getTime(), j = f.endDate.getTime();
853
- let E = -1;
854
- for (let b = 0; b < d.length; b++) {
855
- const $ = d[b];
856
- if (!$) continue;
857
- const L = $[$.length - 1];
858
- if (L && L.endTime <= J) {
859
- E = b;
860
- break;
861
- }
862
- }
863
- E === -1 && (E = d.length, d.push([]));
864
- const Y = d[E];
865
- Y && Y.push({ event: f, endTime: j });
866
- const X = pt(f, e, n, r);
867
- c.push({
868
- event: f,
869
- position: X,
870
- column: E,
871
- columnSpan: 1
872
- });
873
- }
874
- const D = 100 / d.length, h = new Set(i.map((f) => f.id));
875
- for (const f of c)
876
- h.has(f.event.id) && (f.position.left = f.column * D, f.position.width = D * f.columnSpan, f.position.zIndex = f.column + 1);
877
- }
878
- return c;
879
- }
880
- function Je(t, e, n, r = R, a = 30) {
881
- const { startHour: o, endHour: s } = n, u = s - o, c = u * r, i = t / c * u, y = (o + i) * 60, D = Math.round(y / a) * a, h = new Date(e);
882
- return h.setHours(0, 0, 0, 0), h.setMinutes(D), h;
883
- }
884
- function je(t, e, n = R) {
885
- const { startHour: r, endHour: a } = e, o = a - r, s = o * n, u = t.getHours() + t.getMinutes() / 60;
886
- return (Math.max(r, Math.min(u, a)) - r) / o * s;
887
- }
888
- function Xe(t, e) {
889
- return t.startDate < e.endDate && t.endDate > e.startDate;
890
- }
891
- function qe(t) {
892
- if (t.length === 0) return [];
893
- const e = [...t].sort((o, s) => o.startDate.getTime() - s.startDate.getTime()), n = [];
894
- let r = [], a = 0;
895
- for (const o of e)
896
- r.length === 0 || o.startDate.getTime() < a ? (r.push(o), a = Math.max(a, o.endDate.getTime())) : (r.length > 0 && n.push(r), r = [o], a = o.endDate.getTime());
897
- return r.length > 0 && n.push(r), n;
898
- }
899
- function Qe(t, e, n) {
900
- const r = Math.max(0, Math.min(t, e)), a = Math.min(n, Math.max(t, e));
901
- return {
902
- top: r,
903
- height: a - r
904
- };
905
- }
906
- export {
907
- H as $,
908
- V as A,
909
- re as B,
910
- bt as C,
911
- kt as D,
912
- xt as E,
913
- ne as F,
914
- U as G,
915
- Rt as H,
916
- ee as I,
917
- ft as J,
918
- se as K,
919
- w as L,
920
- $t as M,
921
- M as N,
922
- T as O,
923
- Q as P,
924
- ct as Q,
925
- O as R,
926
- Xe as S,
927
- dt as T,
928
- mt as U,
929
- gt as V,
930
- Dt as W,
931
- ht as X,
932
- ae as Y,
933
- $e as Z,
934
- le as _,
935
- A as a,
936
- Ee as a$,
937
- Ne as a0,
938
- Ue as a1,
939
- de as a2,
940
- Le as a3,
941
- Ve as a4,
942
- Ye as a5,
943
- Ie as a6,
944
- Vt as a7,
945
- Pt as a8,
946
- jt as a9,
947
- xe as aA,
948
- x as aB,
949
- p as aC,
950
- W as aD,
951
- Nt as aE,
952
- Kt as aF,
953
- G as aG,
954
- K as aH,
955
- De as aI,
956
- te as aJ,
957
- Zt as aK,
958
- Oe as aL,
959
- We as aM,
960
- ve as aN,
961
- oe as aO,
962
- I as aP,
963
- nt as aQ,
964
- Mt as aR,
965
- ot as aS,
966
- at as aT,
967
- _e as aU,
968
- et as aV,
969
- rt as aW,
970
- St as aX,
971
- ge as aY,
972
- Jt as aZ,
973
- Ae as a_,
974
- Re as aa,
975
- Ce as ab,
976
- Pe as ac,
977
- He as ad,
978
- me as ae,
979
- ie as af,
980
- Fe as ag,
981
- qe as ah,
982
- Be as ai,
983
- ke as aj,
984
- yt as ak,
985
- Ge as al,
986
- ce as am,
987
- fe as an,
988
- Lt as ao,
989
- Ke as ap,
990
- ue as aq,
991
- he as ar,
992
- ye as as,
993
- Se as at,
994
- be as au,
995
- Me as av,
996
- qt as aw,
997
- Xt as ax,
998
- Qt as ay,
999
- F as az,
1000
- Wt as b,
1001
- Te as b0,
1002
- we as b1,
1003
- g as b2,
1004
- S as b3,
1005
- m as b4,
1006
- z as b5,
1007
- Ut as b6,
1008
- Bt as b7,
1009
- Yt as b8,
1010
- Gt as b9,
1011
- je as ba,
1012
- Je as bb,
1013
- R as c,
1014
- Ht as d,
1015
- vt as e,
1016
- Ot as f,
1017
- Ft as g,
1018
- It as h,
1019
- Ct as i,
1020
- _t as j,
1021
- it as k,
1022
- At as l,
1023
- ut as m,
1024
- st as n,
1025
- l as o,
1026
- lt as p,
1027
- zt as q,
1028
- _ as r,
1029
- k as s,
1030
- v as t,
1031
- pe as u,
1032
- pt as v,
1033
- ze as w,
1034
- Qe as x,
1035
- Tt as y,
1036
- Et as z
1037
- };
1038
- //# sourceMappingURL=position-utils-BzmOPdvQ.js.map