react-smart-scheduler 0.1.0

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.
@@ -0,0 +1,4943 @@
1
+ import { jsxs as L, jsx as b } from "react/jsx-runtime";
2
+ import B, { useRef as C, useMemo as F, useLayoutEffect as vr, useEffect as A, useCallback as I, useState as W, memo as yr, useReducer as br, useContext as kt, createContext as oe, cloneElement as pr, forwardRef as wr } from "react";
3
+ import { unstable_batchedUpdates as he, createPortal as Dr } from "react-dom";
4
+ /*!
5
+ * react-smart-scheduler v0.1.0
6
+ * (c) 2026 react-smart-scheduler contributors
7
+ * Released under the MIT License
8
+ * https://github.com/yourname/react-smart-scheduler
9
+ */
10
+ const Se = typeof window < "u" && typeof window.document < "u" && typeof window.document.createElement < "u";
11
+ function Ht(t) {
12
+ const e = Object.prototype.toString.call(t);
13
+ return e === "[object Window]" || // In Electron context the Window object serializes to [object global]
14
+ e === "[object global]";
15
+ }
16
+ function He(t) {
17
+ return "nodeType" in t;
18
+ }
19
+ function U(t) {
20
+ var e, n;
21
+ return t ? Ht(t) ? t : He(t) && (e = (n = t.ownerDocument) == null ? void 0 : n.defaultView) != null ? e : window : window;
22
+ }
23
+ function Xe(t) {
24
+ const {
25
+ Document: e
26
+ } = U(t);
27
+ return t instanceof e;
28
+ }
29
+ function ae(t) {
30
+ return Ht(t) ? !1 : t instanceof U(t).HTMLElement;
31
+ }
32
+ function Pn(t) {
33
+ return t instanceof U(t).SVGElement;
34
+ }
35
+ function Xt(t) {
36
+ return t ? Ht(t) ? t.document : He(t) ? Xe(t) ? t : ae(t) || Pn(t) ? t.ownerDocument : document : document : document;
37
+ }
38
+ const bt = Se ? vr : A;
39
+ function Ee(t) {
40
+ const e = C(t);
41
+ return bt(() => {
42
+ e.current = t;
43
+ }), I(function() {
44
+ for (var n = arguments.length, r = new Array(n), o = 0; o < n; o++)
45
+ r[o] = arguments[o];
46
+ return e.current == null ? void 0 : e.current(...r);
47
+ }, []);
48
+ }
49
+ function Mr() {
50
+ const t = C(null), e = I((r, o) => {
51
+ t.current = setInterval(r, o);
52
+ }, []), n = I(() => {
53
+ t.current !== null && (clearInterval(t.current), t.current = null);
54
+ }, []);
55
+ return [e, n];
56
+ }
57
+ function ne(t, e) {
58
+ e === void 0 && (e = [t]);
59
+ const n = C(t);
60
+ return bt(() => {
61
+ n.current !== t && (n.current = t);
62
+ }, e), n;
63
+ }
64
+ function ie(t, e) {
65
+ const n = C();
66
+ return F(
67
+ () => {
68
+ const r = t(n.current);
69
+ return n.current = r, r;
70
+ },
71
+ // eslint-disable-next-line react-hooks/exhaustive-deps
72
+ [...e]
73
+ );
74
+ }
75
+ function ve(t) {
76
+ const e = Ee(t), n = C(null), r = I(
77
+ (o) => {
78
+ o !== n.current && (e == null || e(o, n.current)), n.current = o;
79
+ },
80
+ //eslint-disable-next-line
81
+ []
82
+ );
83
+ return [n, r];
84
+ }
85
+ function ye(t) {
86
+ const e = C();
87
+ return A(() => {
88
+ e.current = t;
89
+ }, [t]), e.current;
90
+ }
91
+ let Re = {};
92
+ function Oe(t, e) {
93
+ return F(() => {
94
+ if (e)
95
+ return e;
96
+ const n = Re[t] == null ? 0 : Re[t] + 1;
97
+ return Re[t] = n, t + "-" + n;
98
+ }, [t, e]);
99
+ }
100
+ function Rn(t) {
101
+ return function(e) {
102
+ for (var n = arguments.length, r = new Array(n > 1 ? n - 1 : 0), o = 1; o < n; o++)
103
+ r[o - 1] = arguments[o];
104
+ return r.reduce((a, i) => {
105
+ const s = Object.entries(i);
106
+ for (const [c, l] of s) {
107
+ const u = a[c];
108
+ u != null && (a[c] = u + t * l);
109
+ }
110
+ return a;
111
+ }, {
112
+ ...e
113
+ });
114
+ };
115
+ }
116
+ const jt = /* @__PURE__ */ Rn(1), be = /* @__PURE__ */ Rn(-1);
117
+ function xr(t) {
118
+ return "clientX" in t && "clientY" in t;
119
+ }
120
+ function qe(t) {
121
+ if (!t)
122
+ return !1;
123
+ const {
124
+ KeyboardEvent: e
125
+ } = U(t.target);
126
+ return e && t instanceof e;
127
+ }
128
+ function Sr(t) {
129
+ if (!t)
130
+ return !1;
131
+ const {
132
+ TouchEvent: e
133
+ } = U(t.target);
134
+ return e && t instanceof e;
135
+ }
136
+ function pe(t) {
137
+ if (Sr(t)) {
138
+ if (t.touches && t.touches.length) {
139
+ const {
140
+ clientX: e,
141
+ clientY: n
142
+ } = t.touches[0];
143
+ return {
144
+ x: e,
145
+ y: n
146
+ };
147
+ } else if (t.changedTouches && t.changedTouches.length) {
148
+ const {
149
+ clientX: e,
150
+ clientY: n
151
+ } = t.changedTouches[0];
152
+ return {
153
+ x: e,
154
+ y: n
155
+ };
156
+ }
157
+ }
158
+ return xr(t) ? {
159
+ x: t.clientX,
160
+ y: t.clientY
161
+ } : null;
162
+ }
163
+ const Tt = /* @__PURE__ */ Object.freeze({
164
+ Translate: {
165
+ toString(t) {
166
+ if (!t)
167
+ return;
168
+ const {
169
+ x: e,
170
+ y: n
171
+ } = t;
172
+ return "translate3d(" + (e ? Math.round(e) : 0) + "px, " + (n ? Math.round(n) : 0) + "px, 0)";
173
+ }
174
+ },
175
+ Scale: {
176
+ toString(t) {
177
+ if (!t)
178
+ return;
179
+ const {
180
+ scaleX: e,
181
+ scaleY: n
182
+ } = t;
183
+ return "scaleX(" + e + ") scaleY(" + n + ")";
184
+ }
185
+ },
186
+ Transform: {
187
+ toString(t) {
188
+ if (t)
189
+ return [Tt.Translate.toString(t), Tt.Scale.toString(t)].join(" ");
190
+ }
191
+ },
192
+ Transition: {
193
+ toString(t) {
194
+ let {
195
+ property: e,
196
+ duration: n,
197
+ easing: r
198
+ } = t;
199
+ return e + " " + n + "ms " + r;
200
+ }
201
+ }
202
+ }), cn = "a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";
203
+ function Er(t) {
204
+ return t.matches(cn) ? t : t.querySelector(cn);
205
+ }
206
+ const Or = {
207
+ display: "none"
208
+ };
209
+ function Nr(t) {
210
+ let {
211
+ id: e,
212
+ value: n
213
+ } = t;
214
+ return B.createElement("div", {
215
+ id: e,
216
+ style: Or
217
+ }, n);
218
+ }
219
+ function Cr(t) {
220
+ let {
221
+ id: e,
222
+ announcement: n,
223
+ ariaLiveType: r = "assertive"
224
+ } = t;
225
+ const o = {
226
+ position: "fixed",
227
+ top: 0,
228
+ left: 0,
229
+ width: 1,
230
+ height: 1,
231
+ margin: -1,
232
+ border: 0,
233
+ padding: 0,
234
+ overflow: "hidden",
235
+ clip: "rect(0 0 0 0)",
236
+ clipPath: "inset(100%)",
237
+ whiteSpace: "nowrap"
238
+ };
239
+ return B.createElement("div", {
240
+ id: e,
241
+ style: o,
242
+ role: "status",
243
+ "aria-live": r,
244
+ "aria-atomic": !0
245
+ }, n);
246
+ }
247
+ function kr() {
248
+ const [t, e] = W("");
249
+ return {
250
+ announce: I((r) => {
251
+ r != null && e(r);
252
+ }, []),
253
+ announcement: t
254
+ };
255
+ }
256
+ const An = /* @__PURE__ */ oe(null);
257
+ function Tr(t) {
258
+ const e = kt(An);
259
+ A(() => {
260
+ if (!e)
261
+ throw new Error("useDndMonitor must be used within a children of <DndContext>");
262
+ return e(t);
263
+ }, [t, e]);
264
+ }
265
+ function Pr() {
266
+ const [t] = W(() => /* @__PURE__ */ new Set()), e = I((r) => (t.add(r), () => t.delete(r)), [t]);
267
+ return [I((r) => {
268
+ let {
269
+ type: o,
270
+ event: a
271
+ } = r;
272
+ t.forEach((i) => {
273
+ var s;
274
+ return (s = i[o]) == null ? void 0 : s.call(i, a);
275
+ });
276
+ }, [t]), e];
277
+ }
278
+ const Rr = {
279
+ draggable: `
280
+ To pick up a draggable item, press the space bar.
281
+ While dragging, use the arrow keys to move the item.
282
+ Press space again to drop the item in its new position, or press escape to cancel.
283
+ `
284
+ }, Ar = {
285
+ onDragStart(t) {
286
+ let {
287
+ active: e
288
+ } = t;
289
+ return "Picked up draggable item " + e.id + ".";
290
+ },
291
+ onDragOver(t) {
292
+ let {
293
+ active: e,
294
+ over: n
295
+ } = t;
296
+ return n ? "Draggable item " + e.id + " was moved over droppable area " + n.id + "." : "Draggable item " + e.id + " is no longer over a droppable area.";
297
+ },
298
+ onDragEnd(t) {
299
+ let {
300
+ active: e,
301
+ over: n
302
+ } = t;
303
+ return n ? "Draggable item " + e.id + " was dropped over droppable area " + n.id : "Draggable item " + e.id + " was dropped.";
304
+ },
305
+ onDragCancel(t) {
306
+ let {
307
+ active: e
308
+ } = t;
309
+ return "Dragging was cancelled. Draggable item " + e.id + " was dropped.";
310
+ }
311
+ };
312
+ function Wr(t) {
313
+ let {
314
+ announcements: e = Ar,
315
+ container: n,
316
+ hiddenTextDescribedById: r,
317
+ screenReaderInstructions: o = Rr
318
+ } = t;
319
+ const {
320
+ announce: a,
321
+ announcement: i
322
+ } = kr(), s = Oe("DndLiveRegion"), [c, l] = W(!1);
323
+ if (A(() => {
324
+ l(!0);
325
+ }, []), Tr(F(() => ({
326
+ onDragStart(d) {
327
+ let {
328
+ active: f
329
+ } = d;
330
+ a(e.onDragStart({
331
+ active: f
332
+ }));
333
+ },
334
+ onDragMove(d) {
335
+ let {
336
+ active: f,
337
+ over: m
338
+ } = d;
339
+ e.onDragMove && a(e.onDragMove({
340
+ active: f,
341
+ over: m
342
+ }));
343
+ },
344
+ onDragOver(d) {
345
+ let {
346
+ active: f,
347
+ over: m
348
+ } = d;
349
+ a(e.onDragOver({
350
+ active: f,
351
+ over: m
352
+ }));
353
+ },
354
+ onDragEnd(d) {
355
+ let {
356
+ active: f,
357
+ over: m
358
+ } = d;
359
+ a(e.onDragEnd({
360
+ active: f,
361
+ over: m
362
+ }));
363
+ },
364
+ onDragCancel(d) {
365
+ let {
366
+ active: f,
367
+ over: m
368
+ } = d;
369
+ a(e.onDragCancel({
370
+ active: f,
371
+ over: m
372
+ }));
373
+ }
374
+ }), [a, e])), !c)
375
+ return null;
376
+ const u = B.createElement(B.Fragment, null, B.createElement(Nr, {
377
+ id: r,
378
+ value: o.draggable
379
+ }), B.createElement(Cr, {
380
+ id: s,
381
+ announcement: i
382
+ }));
383
+ return n ? Dr(u, n) : u;
384
+ }
385
+ var j;
386
+ (function(t) {
387
+ t.DragStart = "dragStart", t.DragMove = "dragMove", t.DragEnd = "dragEnd", t.DragCancel = "dragCancel", t.DragOver = "dragOver", t.RegisterDroppable = "registerDroppable", t.SetDroppableDisabled = "setDroppableDisabled", t.UnregisterDroppable = "unregisterDroppable";
388
+ })(j || (j = {}));
389
+ function we() {
390
+ }
391
+ function Lr(t, e) {
392
+ return F(
393
+ () => ({
394
+ sensor: t,
395
+ options: e ?? {}
396
+ }),
397
+ // eslint-disable-next-line react-hooks/exhaustive-deps
398
+ [t, e]
399
+ );
400
+ }
401
+ function Yr() {
402
+ for (var t = arguments.length, e = new Array(t), n = 0; n < t; n++)
403
+ e[n] = arguments[n];
404
+ return F(
405
+ () => [...e].filter((r) => r != null),
406
+ // eslint-disable-next-line react-hooks/exhaustive-deps
407
+ [...e]
408
+ );
409
+ }
410
+ const dt = /* @__PURE__ */ Object.freeze({
411
+ x: 0,
412
+ y: 0
413
+ });
414
+ function Fr(t, e) {
415
+ const n = pe(t);
416
+ if (!n)
417
+ return "0 0";
418
+ const r = {
419
+ x: (n.x - e.left) / e.width * 100,
420
+ y: (n.y - e.top) / e.height * 100
421
+ };
422
+ return r.x + "% " + r.y + "%";
423
+ }
424
+ function Ir(t, e) {
425
+ let {
426
+ data: {
427
+ value: n
428
+ }
429
+ } = t, {
430
+ data: {
431
+ value: r
432
+ }
433
+ } = e;
434
+ return r - n;
435
+ }
436
+ function Br(t, e) {
437
+ if (!t || t.length === 0)
438
+ return null;
439
+ const [n] = t;
440
+ return n[e];
441
+ }
442
+ function $r(t, e) {
443
+ const n = Math.max(e.top, t.top), r = Math.max(e.left, t.left), o = Math.min(e.left + e.width, t.left + t.width), a = Math.min(e.top + e.height, t.top + t.height), i = o - r, s = a - n;
444
+ if (r < o && n < a) {
445
+ const c = e.width * e.height, l = t.width * t.height, u = i * s, d = u / (c + l - u);
446
+ return Number(d.toFixed(4));
447
+ }
448
+ return 0;
449
+ }
450
+ const zr = (t) => {
451
+ let {
452
+ collisionRect: e,
453
+ droppableRects: n,
454
+ droppableContainers: r
455
+ } = t;
456
+ const o = [];
457
+ for (const a of r) {
458
+ const {
459
+ id: i
460
+ } = a, s = n.get(i);
461
+ if (s) {
462
+ const c = $r(s, e);
463
+ c > 0 && o.push({
464
+ id: i,
465
+ data: {
466
+ droppableContainer: a,
467
+ value: c
468
+ }
469
+ });
470
+ }
471
+ }
472
+ return o.sort(Ir);
473
+ };
474
+ function jr(t, e, n) {
475
+ return {
476
+ ...t,
477
+ scaleX: e && n ? e.width / n.width : 1,
478
+ scaleY: e && n ? e.height / n.height : 1
479
+ };
480
+ }
481
+ function Wn(t, e) {
482
+ return t && e ? {
483
+ x: t.left - e.left,
484
+ y: t.top - e.top
485
+ } : dt;
486
+ }
487
+ function Hr(t) {
488
+ return function(n) {
489
+ for (var r = arguments.length, o = new Array(r > 1 ? r - 1 : 0), a = 1; a < r; a++)
490
+ o[a - 1] = arguments[a];
491
+ return o.reduce((i, s) => ({
492
+ ...i,
493
+ top: i.top + t * s.y,
494
+ bottom: i.bottom + t * s.y,
495
+ left: i.left + t * s.x,
496
+ right: i.right + t * s.x
497
+ }), {
498
+ ...n
499
+ });
500
+ };
501
+ }
502
+ const Xr = /* @__PURE__ */ Hr(1);
503
+ function Ln(t) {
504
+ if (t.startsWith("matrix3d(")) {
505
+ const e = t.slice(9, -1).split(/, /);
506
+ return {
507
+ x: +e[12],
508
+ y: +e[13],
509
+ scaleX: +e[0],
510
+ scaleY: +e[5]
511
+ };
512
+ } else if (t.startsWith("matrix(")) {
513
+ const e = t.slice(7, -1).split(/, /);
514
+ return {
515
+ x: +e[4],
516
+ y: +e[5],
517
+ scaleX: +e[0],
518
+ scaleY: +e[3]
519
+ };
520
+ }
521
+ return null;
522
+ }
523
+ function qr(t, e, n) {
524
+ const r = Ln(e);
525
+ if (!r)
526
+ return t;
527
+ const {
528
+ scaleX: o,
529
+ scaleY: a,
530
+ x: i,
531
+ y: s
532
+ } = r, c = t.left - i - (1 - o) * parseFloat(n), l = t.top - s - (1 - a) * parseFloat(n.slice(n.indexOf(" ") + 1)), u = o ? t.width / o : t.width, d = a ? t.height / a : t.height;
533
+ return {
534
+ width: u,
535
+ height: d,
536
+ top: l,
537
+ right: c + u,
538
+ bottom: l + d,
539
+ left: c
540
+ };
541
+ }
542
+ const _r = {
543
+ ignoreTransform: !1
544
+ };
545
+ function se(t, e) {
546
+ e === void 0 && (e = _r);
547
+ let n = t.getBoundingClientRect();
548
+ if (e.ignoreTransform) {
549
+ const {
550
+ transform: l,
551
+ transformOrigin: u
552
+ } = U(t).getComputedStyle(t);
553
+ l && (n = qr(n, l, u));
554
+ }
555
+ const {
556
+ top: r,
557
+ left: o,
558
+ width: a,
559
+ height: i,
560
+ bottom: s,
561
+ right: c
562
+ } = n;
563
+ return {
564
+ top: r,
565
+ left: o,
566
+ width: a,
567
+ height: i,
568
+ bottom: s,
569
+ right: c
570
+ };
571
+ }
572
+ function ln(t) {
573
+ return se(t, {
574
+ ignoreTransform: !0
575
+ });
576
+ }
577
+ function Vr(t) {
578
+ const e = t.innerWidth, n = t.innerHeight;
579
+ return {
580
+ top: 0,
581
+ left: 0,
582
+ right: e,
583
+ bottom: n,
584
+ width: e,
585
+ height: n
586
+ };
587
+ }
588
+ function Gr(t, e) {
589
+ return e === void 0 && (e = U(t).getComputedStyle(t)), e.position === "fixed";
590
+ }
591
+ function Kr(t, e) {
592
+ e === void 0 && (e = U(t).getComputedStyle(t));
593
+ const n = /(auto|scroll|overlay)/;
594
+ return ["overflow", "overflowX", "overflowY"].some((o) => {
595
+ const a = e[o];
596
+ return typeof a == "string" ? n.test(a) : !1;
597
+ });
598
+ }
599
+ function _e(t, e) {
600
+ const n = [];
601
+ function r(o) {
602
+ if (e != null && n.length >= e || !o)
603
+ return n;
604
+ if (Xe(o) && o.scrollingElement != null && !n.includes(o.scrollingElement))
605
+ return n.push(o.scrollingElement), n;
606
+ if (!ae(o) || Pn(o) || n.includes(o))
607
+ return n;
608
+ const a = U(t).getComputedStyle(o);
609
+ return o !== t && Kr(o, a) && n.push(o), Gr(o, a) ? n : r(o.parentNode);
610
+ }
611
+ return t ? r(t) : n;
612
+ }
613
+ function Yn(t) {
614
+ const [e] = _e(t, 1);
615
+ return e ?? null;
616
+ }
617
+ function Ae(t) {
618
+ return !Se || !t ? null : Ht(t) ? t : He(t) ? Xe(t) || t === Xt(t).scrollingElement ? window : ae(t) ? t : null : null;
619
+ }
620
+ function Fn(t) {
621
+ return Ht(t) ? t.scrollX : t.scrollLeft;
622
+ }
623
+ function In(t) {
624
+ return Ht(t) ? t.scrollY : t.scrollTop;
625
+ }
626
+ function Fe(t) {
627
+ return {
628
+ x: Fn(t),
629
+ y: In(t)
630
+ };
631
+ }
632
+ var q;
633
+ (function(t) {
634
+ t[t.Forward = 1] = "Forward", t[t.Backward = -1] = "Backward";
635
+ })(q || (q = {}));
636
+ function Bn(t) {
637
+ return !Se || !t ? !1 : t === document.scrollingElement;
638
+ }
639
+ function $n(t) {
640
+ const e = {
641
+ x: 0,
642
+ y: 0
643
+ }, n = Bn(t) ? {
644
+ height: window.innerHeight,
645
+ width: window.innerWidth
646
+ } : {
647
+ height: t.clientHeight,
648
+ width: t.clientWidth
649
+ }, r = {
650
+ x: t.scrollWidth - n.width,
651
+ y: t.scrollHeight - n.height
652
+ }, o = t.scrollTop <= e.y, a = t.scrollLeft <= e.x, i = t.scrollTop >= r.y, s = t.scrollLeft >= r.x;
653
+ return {
654
+ isTop: o,
655
+ isLeft: a,
656
+ isBottom: i,
657
+ isRight: s,
658
+ maxScroll: r,
659
+ minScroll: e
660
+ };
661
+ }
662
+ const Ur = {
663
+ x: 0.2,
664
+ y: 0.2
665
+ };
666
+ function Qr(t, e, n, r, o) {
667
+ let {
668
+ top: a,
669
+ left: i,
670
+ right: s,
671
+ bottom: c
672
+ } = n;
673
+ r === void 0 && (r = 10), o === void 0 && (o = Ur);
674
+ const {
675
+ isTop: l,
676
+ isBottom: u,
677
+ isLeft: d,
678
+ isRight: f
679
+ } = $n(t), m = {
680
+ x: 0,
681
+ y: 0
682
+ }, y = {
683
+ x: 0,
684
+ y: 0
685
+ }, g = {
686
+ height: e.height * o.y,
687
+ width: e.width * o.x
688
+ };
689
+ return !l && a <= e.top + g.height ? (m.y = q.Backward, y.y = r * Math.abs((e.top + g.height - a) / g.height)) : !u && c >= e.bottom - g.height && (m.y = q.Forward, y.y = r * Math.abs((e.bottom - g.height - c) / g.height)), !f && s >= e.right - g.width ? (m.x = q.Forward, y.x = r * Math.abs((e.right - g.width - s) / g.width)) : !d && i <= e.left + g.width && (m.x = q.Backward, y.x = r * Math.abs((e.left + g.width - i) / g.width)), {
690
+ direction: m,
691
+ speed: y
692
+ };
693
+ }
694
+ function Jr(t) {
695
+ if (t === document.scrollingElement) {
696
+ const {
697
+ innerWidth: a,
698
+ innerHeight: i
699
+ } = window;
700
+ return {
701
+ top: 0,
702
+ left: 0,
703
+ right: a,
704
+ bottom: i,
705
+ width: a,
706
+ height: i
707
+ };
708
+ }
709
+ const {
710
+ top: e,
711
+ left: n,
712
+ right: r,
713
+ bottom: o
714
+ } = t.getBoundingClientRect();
715
+ return {
716
+ top: e,
717
+ left: n,
718
+ right: r,
719
+ bottom: o,
720
+ width: t.clientWidth,
721
+ height: t.clientHeight
722
+ };
723
+ }
724
+ function zn(t) {
725
+ return t.reduce((e, n) => jt(e, Fe(n)), dt);
726
+ }
727
+ function Zr(t) {
728
+ return t.reduce((e, n) => e + Fn(n), 0);
729
+ }
730
+ function to(t) {
731
+ return t.reduce((e, n) => e + In(n), 0);
732
+ }
733
+ function jn(t, e) {
734
+ if (e === void 0 && (e = se), !t)
735
+ return;
736
+ const {
737
+ top: n,
738
+ left: r,
739
+ bottom: o,
740
+ right: a
741
+ } = e(t);
742
+ Yn(t) && (o <= 0 || a <= 0 || n >= window.innerHeight || r >= window.innerWidth) && t.scrollIntoView({
743
+ block: "center",
744
+ inline: "center"
745
+ });
746
+ }
747
+ const eo = [["x", ["left", "right"], Zr], ["y", ["top", "bottom"], to]];
748
+ class Ve {
749
+ constructor(e, n) {
750
+ this.rect = void 0, this.width = void 0, this.height = void 0, this.top = void 0, this.bottom = void 0, this.right = void 0, this.left = void 0;
751
+ const r = _e(n), o = zn(r);
752
+ this.rect = {
753
+ ...e
754
+ }, this.width = e.width, this.height = e.height;
755
+ for (const [a, i, s] of eo)
756
+ for (const c of i)
757
+ Object.defineProperty(this, c, {
758
+ get: () => {
759
+ const l = s(r), u = o[a] - l;
760
+ return this.rect[c] + u;
761
+ },
762
+ enumerable: !0
763
+ });
764
+ Object.defineProperty(this, "rect", {
765
+ enumerable: !1
766
+ });
767
+ }
768
+ }
769
+ class Zt {
770
+ constructor(e) {
771
+ this.target = void 0, this.listeners = [], this.removeAll = () => {
772
+ this.listeners.forEach((n) => {
773
+ var r;
774
+ return (r = this.target) == null ? void 0 : r.removeEventListener(...n);
775
+ });
776
+ }, this.target = e;
777
+ }
778
+ add(e, n, r) {
779
+ var o;
780
+ (o = this.target) == null || o.addEventListener(e, n, r), this.listeners.push([e, n, r]);
781
+ }
782
+ }
783
+ function no(t) {
784
+ const {
785
+ EventTarget: e
786
+ } = U(t);
787
+ return t instanceof e ? t : Xt(t);
788
+ }
789
+ function We(t, e) {
790
+ const n = Math.abs(t.x), r = Math.abs(t.y);
791
+ return typeof e == "number" ? Math.sqrt(n ** 2 + r ** 2) > e : "x" in e && "y" in e ? n > e.x && r > e.y : "x" in e ? n > e.x : "y" in e ? r > e.y : !1;
792
+ }
793
+ var it;
794
+ (function(t) {
795
+ t.Click = "click", t.DragStart = "dragstart", t.Keydown = "keydown", t.ContextMenu = "contextmenu", t.Resize = "resize", t.SelectionChange = "selectionchange", t.VisibilityChange = "visibilitychange";
796
+ })(it || (it = {}));
797
+ function un(t) {
798
+ t.preventDefault();
799
+ }
800
+ function ro(t) {
801
+ t.stopPropagation();
802
+ }
803
+ var N;
804
+ (function(t) {
805
+ t.Space = "Space", t.Down = "ArrowDown", t.Right = "ArrowRight", t.Left = "ArrowLeft", t.Up = "ArrowUp", t.Esc = "Escape", t.Enter = "Enter", t.Tab = "Tab";
806
+ })(N || (N = {}));
807
+ const Hn = {
808
+ start: [N.Space, N.Enter],
809
+ cancel: [N.Esc],
810
+ end: [N.Space, N.Enter, N.Tab]
811
+ }, oo = (t, e) => {
812
+ let {
813
+ currentCoordinates: n
814
+ } = e;
815
+ switch (t.code) {
816
+ case N.Right:
817
+ return {
818
+ ...n,
819
+ x: n.x + 25
820
+ };
821
+ case N.Left:
822
+ return {
823
+ ...n,
824
+ x: n.x - 25
825
+ };
826
+ case N.Down:
827
+ return {
828
+ ...n,
829
+ y: n.y + 25
830
+ };
831
+ case N.Up:
832
+ return {
833
+ ...n,
834
+ y: n.y - 25
835
+ };
836
+ }
837
+ };
838
+ class Xn {
839
+ constructor(e) {
840
+ this.props = void 0, this.autoScrollEnabled = !1, this.referenceCoordinates = void 0, this.listeners = void 0, this.windowListeners = void 0, this.props = e;
841
+ const {
842
+ event: {
843
+ target: n
844
+ }
845
+ } = e;
846
+ this.props = e, this.listeners = new Zt(Xt(n)), this.windowListeners = new Zt(U(n)), this.handleKeyDown = this.handleKeyDown.bind(this), this.handleCancel = this.handleCancel.bind(this), this.attach();
847
+ }
848
+ attach() {
849
+ this.handleStart(), this.windowListeners.add(it.Resize, this.handleCancel), this.windowListeners.add(it.VisibilityChange, this.handleCancel), setTimeout(() => this.listeners.add(it.Keydown, this.handleKeyDown));
850
+ }
851
+ handleStart() {
852
+ const {
853
+ activeNode: e,
854
+ onStart: n
855
+ } = this.props, r = e.node.current;
856
+ r && jn(r), n(dt);
857
+ }
858
+ handleKeyDown(e) {
859
+ if (qe(e)) {
860
+ const {
861
+ active: n,
862
+ context: r,
863
+ options: o
864
+ } = this.props, {
865
+ keyboardCodes: a = Hn,
866
+ coordinateGetter: i = oo,
867
+ scrollBehavior: s = "smooth"
868
+ } = o, {
869
+ code: c
870
+ } = e;
871
+ if (a.end.includes(c)) {
872
+ this.handleEnd(e);
873
+ return;
874
+ }
875
+ if (a.cancel.includes(c)) {
876
+ this.handleCancel(e);
877
+ return;
878
+ }
879
+ const {
880
+ collisionRect: l
881
+ } = r.current, u = l ? {
882
+ x: l.left,
883
+ y: l.top
884
+ } : dt;
885
+ this.referenceCoordinates || (this.referenceCoordinates = u);
886
+ const d = i(e, {
887
+ active: n,
888
+ context: r.current,
889
+ currentCoordinates: u
890
+ });
891
+ if (d) {
892
+ const f = be(d, u), m = {
893
+ x: 0,
894
+ y: 0
895
+ }, {
896
+ scrollableAncestors: y
897
+ } = r.current;
898
+ for (const g of y) {
899
+ const h = e.code, {
900
+ isTop: v,
901
+ isRight: D,
902
+ isLeft: w,
903
+ isBottom: E,
904
+ maxScroll: p,
905
+ minScroll: M
906
+ } = $n(g), x = Jr(g), S = {
907
+ x: Math.min(h === N.Right ? x.right - x.width / 2 : x.right, Math.max(h === N.Right ? x.left : x.left + x.width / 2, d.x)),
908
+ y: Math.min(h === N.Down ? x.bottom - x.height / 2 : x.bottom, Math.max(h === N.Down ? x.top : x.top + x.height / 2, d.y))
909
+ }, k = h === N.Right && !D || h === N.Left && !w, Y = h === N.Down && !E || h === N.Up && !v;
910
+ if (k && S.x !== d.x) {
911
+ const T = g.scrollLeft + f.x, H = h === N.Right && T <= p.x || h === N.Left && T >= M.x;
912
+ if (H && !f.y) {
913
+ g.scrollTo({
914
+ left: T,
915
+ behavior: s
916
+ });
917
+ return;
918
+ }
919
+ H ? m.x = g.scrollLeft - T : m.x = h === N.Right ? g.scrollLeft - p.x : g.scrollLeft - M.x, m.x && g.scrollBy({
920
+ left: -m.x,
921
+ behavior: s
922
+ });
923
+ break;
924
+ } else if (Y && S.y !== d.y) {
925
+ const T = g.scrollTop + f.y, H = h === N.Down && T <= p.y || h === N.Up && T >= M.y;
926
+ if (H && !f.x) {
927
+ g.scrollTo({
928
+ top: T,
929
+ behavior: s
930
+ });
931
+ return;
932
+ }
933
+ H ? m.y = g.scrollTop - T : m.y = h === N.Down ? g.scrollTop - p.y : g.scrollTop - M.y, m.y && g.scrollBy({
934
+ top: -m.y,
935
+ behavior: s
936
+ });
937
+ break;
938
+ }
939
+ }
940
+ this.handleMove(e, jt(be(d, this.referenceCoordinates), m));
941
+ }
942
+ }
943
+ }
944
+ handleMove(e, n) {
945
+ const {
946
+ onMove: r
947
+ } = this.props;
948
+ e.preventDefault(), r(n);
949
+ }
950
+ handleEnd(e) {
951
+ const {
952
+ onEnd: n
953
+ } = this.props;
954
+ e.preventDefault(), this.detach(), n();
955
+ }
956
+ handleCancel(e) {
957
+ const {
958
+ onCancel: n
959
+ } = this.props;
960
+ e.preventDefault(), this.detach(), n();
961
+ }
962
+ detach() {
963
+ this.listeners.removeAll(), this.windowListeners.removeAll();
964
+ }
965
+ }
966
+ Xn.activators = [{
967
+ eventName: "onKeyDown",
968
+ handler: (t, e, n) => {
969
+ let {
970
+ keyboardCodes: r = Hn,
971
+ onActivation: o
972
+ } = e, {
973
+ active: a
974
+ } = n;
975
+ const {
976
+ code: i
977
+ } = t.nativeEvent;
978
+ if (r.start.includes(i)) {
979
+ const s = a.activatorNode.current;
980
+ return s && t.target !== s ? !1 : (t.preventDefault(), o == null || o({
981
+ event: t.nativeEvent
982
+ }), !0);
983
+ }
984
+ return !1;
985
+ }
986
+ }];
987
+ function dn(t) {
988
+ return !!(t && "distance" in t);
989
+ }
990
+ function fn(t) {
991
+ return !!(t && "delay" in t);
992
+ }
993
+ class Ge {
994
+ constructor(e, n, r) {
995
+ var o;
996
+ r === void 0 && (r = no(e.event.target)), this.props = void 0, this.events = void 0, this.autoScrollEnabled = !0, this.document = void 0, this.activated = !1, this.initialCoordinates = void 0, this.timeoutId = null, this.listeners = void 0, this.documentListeners = void 0, this.windowListeners = void 0, this.props = e, this.events = n;
997
+ const {
998
+ event: a
999
+ } = e, {
1000
+ target: i
1001
+ } = a;
1002
+ this.props = e, this.events = n, this.document = Xt(i), this.documentListeners = new Zt(this.document), this.listeners = new Zt(r), this.windowListeners = new Zt(U(i)), this.initialCoordinates = (o = pe(a)) != null ? o : dt, this.handleStart = this.handleStart.bind(this), this.handleMove = this.handleMove.bind(this), this.handleEnd = this.handleEnd.bind(this), this.handleCancel = this.handleCancel.bind(this), this.handleKeydown = this.handleKeydown.bind(this), this.removeTextSelection = this.removeTextSelection.bind(this), this.attach();
1003
+ }
1004
+ attach() {
1005
+ const {
1006
+ events: e,
1007
+ props: {
1008
+ options: {
1009
+ activationConstraint: n,
1010
+ bypassActivationConstraint: r
1011
+ }
1012
+ }
1013
+ } = this;
1014
+ if (this.listeners.add(e.move.name, this.handleMove, {
1015
+ passive: !1
1016
+ }), this.listeners.add(e.end.name, this.handleEnd), e.cancel && this.listeners.add(e.cancel.name, this.handleCancel), this.windowListeners.add(it.Resize, this.handleCancel), this.windowListeners.add(it.DragStart, un), this.windowListeners.add(it.VisibilityChange, this.handleCancel), this.windowListeners.add(it.ContextMenu, un), this.documentListeners.add(it.Keydown, this.handleKeydown), n) {
1017
+ if (r != null && r({
1018
+ event: this.props.event,
1019
+ activeNode: this.props.activeNode,
1020
+ options: this.props.options
1021
+ }))
1022
+ return this.handleStart();
1023
+ if (fn(n)) {
1024
+ this.timeoutId = setTimeout(this.handleStart, n.delay), this.handlePending(n);
1025
+ return;
1026
+ }
1027
+ if (dn(n)) {
1028
+ this.handlePending(n);
1029
+ return;
1030
+ }
1031
+ }
1032
+ this.handleStart();
1033
+ }
1034
+ detach() {
1035
+ this.listeners.removeAll(), this.windowListeners.removeAll(), setTimeout(this.documentListeners.removeAll, 50), this.timeoutId !== null && (clearTimeout(this.timeoutId), this.timeoutId = null);
1036
+ }
1037
+ handlePending(e, n) {
1038
+ const {
1039
+ active: r,
1040
+ onPending: o
1041
+ } = this.props;
1042
+ o(r, e, this.initialCoordinates, n);
1043
+ }
1044
+ handleStart() {
1045
+ const {
1046
+ initialCoordinates: e
1047
+ } = this, {
1048
+ onStart: n
1049
+ } = this.props;
1050
+ e && (this.activated = !0, this.documentListeners.add(it.Click, ro, {
1051
+ capture: !0
1052
+ }), this.removeTextSelection(), this.documentListeners.add(it.SelectionChange, this.removeTextSelection), n(e));
1053
+ }
1054
+ handleMove(e) {
1055
+ var n;
1056
+ const {
1057
+ activated: r,
1058
+ initialCoordinates: o,
1059
+ props: a
1060
+ } = this, {
1061
+ onMove: i,
1062
+ options: {
1063
+ activationConstraint: s
1064
+ }
1065
+ } = a;
1066
+ if (!o)
1067
+ return;
1068
+ const c = (n = pe(e)) != null ? n : dt, l = be(o, c);
1069
+ if (!r && s) {
1070
+ if (dn(s)) {
1071
+ if (s.tolerance != null && We(l, s.tolerance))
1072
+ return this.handleCancel();
1073
+ if (We(l, s.distance))
1074
+ return this.handleStart();
1075
+ }
1076
+ if (fn(s) && We(l, s.tolerance))
1077
+ return this.handleCancel();
1078
+ this.handlePending(s, l);
1079
+ return;
1080
+ }
1081
+ e.cancelable && e.preventDefault(), i(c);
1082
+ }
1083
+ handleEnd() {
1084
+ const {
1085
+ onAbort: e,
1086
+ onEnd: n
1087
+ } = this.props;
1088
+ this.detach(), this.activated || e(this.props.active), n();
1089
+ }
1090
+ handleCancel() {
1091
+ const {
1092
+ onAbort: e,
1093
+ onCancel: n
1094
+ } = this.props;
1095
+ this.detach(), this.activated || e(this.props.active), n();
1096
+ }
1097
+ handleKeydown(e) {
1098
+ e.code === N.Esc && this.handleCancel();
1099
+ }
1100
+ removeTextSelection() {
1101
+ var e;
1102
+ (e = this.document.getSelection()) == null || e.removeAllRanges();
1103
+ }
1104
+ }
1105
+ const ao = {
1106
+ cancel: {
1107
+ name: "pointercancel"
1108
+ },
1109
+ move: {
1110
+ name: "pointermove"
1111
+ },
1112
+ end: {
1113
+ name: "pointerup"
1114
+ }
1115
+ };
1116
+ class Ke extends Ge {
1117
+ constructor(e) {
1118
+ const {
1119
+ event: n
1120
+ } = e, r = Xt(n.target);
1121
+ super(e, ao, r);
1122
+ }
1123
+ }
1124
+ Ke.activators = [{
1125
+ eventName: "onPointerDown",
1126
+ handler: (t, e) => {
1127
+ let {
1128
+ nativeEvent: n
1129
+ } = t, {
1130
+ onActivation: r
1131
+ } = e;
1132
+ return !n.isPrimary || n.button !== 0 ? !1 : (r == null || r({
1133
+ event: n
1134
+ }), !0);
1135
+ }
1136
+ }];
1137
+ const io = {
1138
+ move: {
1139
+ name: "mousemove"
1140
+ },
1141
+ end: {
1142
+ name: "mouseup"
1143
+ }
1144
+ };
1145
+ var Ie;
1146
+ (function(t) {
1147
+ t[t.RightClick = 2] = "RightClick";
1148
+ })(Ie || (Ie = {}));
1149
+ class so extends Ge {
1150
+ constructor(e) {
1151
+ super(e, io, Xt(e.event.target));
1152
+ }
1153
+ }
1154
+ so.activators = [{
1155
+ eventName: "onMouseDown",
1156
+ handler: (t, e) => {
1157
+ let {
1158
+ nativeEvent: n
1159
+ } = t, {
1160
+ onActivation: r
1161
+ } = e;
1162
+ return n.button === Ie.RightClick ? !1 : (r == null || r({
1163
+ event: n
1164
+ }), !0);
1165
+ }
1166
+ }];
1167
+ const Le = {
1168
+ cancel: {
1169
+ name: "touchcancel"
1170
+ },
1171
+ move: {
1172
+ name: "touchmove"
1173
+ },
1174
+ end: {
1175
+ name: "touchend"
1176
+ }
1177
+ };
1178
+ class co extends Ge {
1179
+ constructor(e) {
1180
+ super(e, Le);
1181
+ }
1182
+ static setup() {
1183
+ return window.addEventListener(Le.move.name, e, {
1184
+ capture: !1,
1185
+ passive: !1
1186
+ }), function() {
1187
+ window.removeEventListener(Le.move.name, e);
1188
+ };
1189
+ function e() {
1190
+ }
1191
+ }
1192
+ }
1193
+ co.activators = [{
1194
+ eventName: "onTouchStart",
1195
+ handler: (t, e) => {
1196
+ let {
1197
+ nativeEvent: n
1198
+ } = t, {
1199
+ onActivation: r
1200
+ } = e;
1201
+ const {
1202
+ touches: o
1203
+ } = n;
1204
+ return o.length > 1 ? !1 : (r == null || r({
1205
+ event: n
1206
+ }), !0);
1207
+ }
1208
+ }];
1209
+ var te;
1210
+ (function(t) {
1211
+ t[t.Pointer = 0] = "Pointer", t[t.DraggableRect = 1] = "DraggableRect";
1212
+ })(te || (te = {}));
1213
+ var De;
1214
+ (function(t) {
1215
+ t[t.TreeOrder = 0] = "TreeOrder", t[t.ReversedTreeOrder = 1] = "ReversedTreeOrder";
1216
+ })(De || (De = {}));
1217
+ function lo(t) {
1218
+ let {
1219
+ acceleration: e,
1220
+ activator: n = te.Pointer,
1221
+ canScroll: r,
1222
+ draggingRect: o,
1223
+ enabled: a,
1224
+ interval: i = 5,
1225
+ order: s = De.TreeOrder,
1226
+ pointerCoordinates: c,
1227
+ scrollableAncestors: l,
1228
+ scrollableAncestorRects: u,
1229
+ delta: d,
1230
+ threshold: f
1231
+ } = t;
1232
+ const m = fo({
1233
+ delta: d,
1234
+ disabled: !a
1235
+ }), [y, g] = Mr(), h = C({
1236
+ x: 0,
1237
+ y: 0
1238
+ }), v = C({
1239
+ x: 0,
1240
+ y: 0
1241
+ }), D = F(() => {
1242
+ switch (n) {
1243
+ case te.Pointer:
1244
+ return c ? {
1245
+ top: c.y,
1246
+ bottom: c.y,
1247
+ left: c.x,
1248
+ right: c.x
1249
+ } : null;
1250
+ case te.DraggableRect:
1251
+ return o;
1252
+ }
1253
+ }, [n, o, c]), w = C(null), E = I(() => {
1254
+ const M = w.current;
1255
+ if (!M)
1256
+ return;
1257
+ const x = h.current.x * v.current.x, S = h.current.y * v.current.y;
1258
+ M.scrollBy(x, S);
1259
+ }, []), p = F(() => s === De.TreeOrder ? [...l].reverse() : l, [s, l]);
1260
+ A(
1261
+ () => {
1262
+ if (!a || !l.length || !D) {
1263
+ g();
1264
+ return;
1265
+ }
1266
+ for (const M of p) {
1267
+ if ((r == null ? void 0 : r(M)) === !1)
1268
+ continue;
1269
+ const x = l.indexOf(M), S = u[x];
1270
+ if (!S)
1271
+ continue;
1272
+ const {
1273
+ direction: k,
1274
+ speed: Y
1275
+ } = Qr(M, S, D, e, f);
1276
+ for (const T of ["x", "y"])
1277
+ m[T][k[T]] || (Y[T] = 0, k[T] = 0);
1278
+ if (Y.x > 0 || Y.y > 0) {
1279
+ g(), w.current = M, y(E, i), h.current = Y, v.current = k;
1280
+ return;
1281
+ }
1282
+ }
1283
+ h.current = {
1284
+ x: 0,
1285
+ y: 0
1286
+ }, v.current = {
1287
+ x: 0,
1288
+ y: 0
1289
+ }, g();
1290
+ },
1291
+ // eslint-disable-next-line react-hooks/exhaustive-deps
1292
+ [
1293
+ e,
1294
+ E,
1295
+ r,
1296
+ g,
1297
+ a,
1298
+ i,
1299
+ // eslint-disable-next-line react-hooks/exhaustive-deps
1300
+ JSON.stringify(D),
1301
+ // eslint-disable-next-line react-hooks/exhaustive-deps
1302
+ JSON.stringify(m),
1303
+ y,
1304
+ l,
1305
+ p,
1306
+ u,
1307
+ // eslint-disable-next-line react-hooks/exhaustive-deps
1308
+ JSON.stringify(f)
1309
+ ]
1310
+ );
1311
+ }
1312
+ const uo = {
1313
+ x: {
1314
+ [q.Backward]: !1,
1315
+ [q.Forward]: !1
1316
+ },
1317
+ y: {
1318
+ [q.Backward]: !1,
1319
+ [q.Forward]: !1
1320
+ }
1321
+ };
1322
+ function fo(t) {
1323
+ let {
1324
+ delta: e,
1325
+ disabled: n
1326
+ } = t;
1327
+ const r = ye(e);
1328
+ return ie((o) => {
1329
+ if (n || !r || !o)
1330
+ return uo;
1331
+ const a = {
1332
+ x: Math.sign(e.x - r.x),
1333
+ y: Math.sign(e.y - r.y)
1334
+ };
1335
+ return {
1336
+ x: {
1337
+ [q.Backward]: o.x[q.Backward] || a.x === -1,
1338
+ [q.Forward]: o.x[q.Forward] || a.x === 1
1339
+ },
1340
+ y: {
1341
+ [q.Backward]: o.y[q.Backward] || a.y === -1,
1342
+ [q.Forward]: o.y[q.Forward] || a.y === 1
1343
+ }
1344
+ };
1345
+ }, [n, e, r]);
1346
+ }
1347
+ function ho(t, e) {
1348
+ const n = e != null ? t.get(e) : void 0, r = n ? n.node.current : null;
1349
+ return ie((o) => {
1350
+ var a;
1351
+ return e == null ? null : (a = r ?? o) != null ? a : null;
1352
+ }, [r, e]);
1353
+ }
1354
+ function go(t, e) {
1355
+ return F(() => t.reduce((n, r) => {
1356
+ const {
1357
+ sensor: o
1358
+ } = r, a = o.activators.map((i) => ({
1359
+ eventName: i.eventName,
1360
+ handler: e(i.handler, r)
1361
+ }));
1362
+ return [...n, ...a];
1363
+ }, []), [t, e]);
1364
+ }
1365
+ var re;
1366
+ (function(t) {
1367
+ t[t.Always = 0] = "Always", t[t.BeforeDragging = 1] = "BeforeDragging", t[t.WhileDragging = 2] = "WhileDragging";
1368
+ })(re || (re = {}));
1369
+ var Be;
1370
+ (function(t) {
1371
+ t.Optimized = "optimized";
1372
+ })(Be || (Be = {}));
1373
+ const hn = /* @__PURE__ */ new Map();
1374
+ function mo(t, e) {
1375
+ let {
1376
+ dragging: n,
1377
+ dependencies: r,
1378
+ config: o
1379
+ } = e;
1380
+ const [a, i] = W(null), {
1381
+ frequency: s,
1382
+ measure: c,
1383
+ strategy: l
1384
+ } = o, u = C(t), d = h(), f = ne(d), m = I(function(v) {
1385
+ v === void 0 && (v = []), !f.current && i((D) => D === null ? v : D.concat(v.filter((w) => !D.includes(w))));
1386
+ }, [f]), y = C(null), g = ie((v) => {
1387
+ if (d && !n)
1388
+ return hn;
1389
+ if (!v || v === hn || u.current !== t || a != null) {
1390
+ const D = /* @__PURE__ */ new Map();
1391
+ for (let w of t) {
1392
+ if (!w)
1393
+ continue;
1394
+ if (a && a.length > 0 && !a.includes(w.id) && w.rect.current) {
1395
+ D.set(w.id, w.rect.current);
1396
+ continue;
1397
+ }
1398
+ const E = w.node.current, p = E ? new Ve(c(E), E) : null;
1399
+ w.rect.current = p, p && D.set(w.id, p);
1400
+ }
1401
+ return D;
1402
+ }
1403
+ return v;
1404
+ }, [t, a, n, d, c]);
1405
+ return A(() => {
1406
+ u.current = t;
1407
+ }, [t]), A(
1408
+ () => {
1409
+ d || m();
1410
+ },
1411
+ // eslint-disable-next-line react-hooks/exhaustive-deps
1412
+ [n, d]
1413
+ ), A(
1414
+ () => {
1415
+ a && a.length > 0 && i(null);
1416
+ },
1417
+ //eslint-disable-next-line react-hooks/exhaustive-deps
1418
+ [JSON.stringify(a)]
1419
+ ), A(
1420
+ () => {
1421
+ d || typeof s != "number" || y.current !== null || (y.current = setTimeout(() => {
1422
+ m(), y.current = null;
1423
+ }, s));
1424
+ },
1425
+ // eslint-disable-next-line react-hooks/exhaustive-deps
1426
+ [s, d, m, ...r]
1427
+ ), {
1428
+ droppableRects: g,
1429
+ measureDroppableContainers: m,
1430
+ measuringScheduled: a != null
1431
+ };
1432
+ function h() {
1433
+ switch (l) {
1434
+ case re.Always:
1435
+ return !1;
1436
+ case re.BeforeDragging:
1437
+ return n;
1438
+ default:
1439
+ return !n;
1440
+ }
1441
+ }
1442
+ }
1443
+ function Ue(t, e) {
1444
+ return ie((n) => t ? n || (typeof e == "function" ? e(t) : t) : null, [e, t]);
1445
+ }
1446
+ function vo(t, e) {
1447
+ return Ue(t, e);
1448
+ }
1449
+ function yo(t) {
1450
+ let {
1451
+ callback: e,
1452
+ disabled: n
1453
+ } = t;
1454
+ const r = Ee(e), o = F(() => {
1455
+ if (n || typeof window > "u" || typeof window.MutationObserver > "u")
1456
+ return;
1457
+ const {
1458
+ MutationObserver: a
1459
+ } = window;
1460
+ return new a(r);
1461
+ }, [r, n]);
1462
+ return A(() => () => o == null ? void 0 : o.disconnect(), [o]), o;
1463
+ }
1464
+ function Ne(t) {
1465
+ let {
1466
+ callback: e,
1467
+ disabled: n
1468
+ } = t;
1469
+ const r = Ee(e), o = F(
1470
+ () => {
1471
+ if (n || typeof window > "u" || typeof window.ResizeObserver > "u")
1472
+ return;
1473
+ const {
1474
+ ResizeObserver: a
1475
+ } = window;
1476
+ return new a(r);
1477
+ },
1478
+ // eslint-disable-next-line react-hooks/exhaustive-deps
1479
+ [n]
1480
+ );
1481
+ return A(() => () => o == null ? void 0 : o.disconnect(), [o]), o;
1482
+ }
1483
+ function bo(t) {
1484
+ return new Ve(se(t), t);
1485
+ }
1486
+ function gn(t, e, n) {
1487
+ e === void 0 && (e = bo);
1488
+ const [r, o] = W(null);
1489
+ function a() {
1490
+ o((c) => {
1491
+ if (!t)
1492
+ return null;
1493
+ if (t.isConnected === !1) {
1494
+ var l;
1495
+ return (l = c ?? n) != null ? l : null;
1496
+ }
1497
+ const u = e(t);
1498
+ return JSON.stringify(c) === JSON.stringify(u) ? c : u;
1499
+ });
1500
+ }
1501
+ const i = yo({
1502
+ callback(c) {
1503
+ if (t)
1504
+ for (const l of c) {
1505
+ const {
1506
+ type: u,
1507
+ target: d
1508
+ } = l;
1509
+ if (u === "childList" && d instanceof HTMLElement && d.contains(t)) {
1510
+ a();
1511
+ break;
1512
+ }
1513
+ }
1514
+ }
1515
+ }), s = Ne({
1516
+ callback: a
1517
+ });
1518
+ return bt(() => {
1519
+ a(), t ? (s == null || s.observe(t), i == null || i.observe(document.body, {
1520
+ childList: !0,
1521
+ subtree: !0
1522
+ })) : (s == null || s.disconnect(), i == null || i.disconnect());
1523
+ }, [t]), r;
1524
+ }
1525
+ function po(t) {
1526
+ const e = Ue(t);
1527
+ return Wn(t, e);
1528
+ }
1529
+ const mn = [];
1530
+ function wo(t) {
1531
+ const e = C(t), n = ie((r) => t ? r && r !== mn && t && e.current && t.parentNode === e.current.parentNode ? r : _e(t) : mn, [t]);
1532
+ return A(() => {
1533
+ e.current = t;
1534
+ }, [t]), n;
1535
+ }
1536
+ function Do(t) {
1537
+ const [e, n] = W(null), r = C(t), o = I((a) => {
1538
+ const i = Ae(a.target);
1539
+ i && n((s) => s ? (s.set(i, Fe(i)), new Map(s)) : null);
1540
+ }, []);
1541
+ return A(() => {
1542
+ const a = r.current;
1543
+ if (t !== a) {
1544
+ i(a);
1545
+ const s = t.map((c) => {
1546
+ const l = Ae(c);
1547
+ return l ? (l.addEventListener("scroll", o, {
1548
+ passive: !0
1549
+ }), [l, Fe(l)]) : null;
1550
+ }).filter((c) => c != null);
1551
+ n(s.length ? new Map(s) : null), r.current = t;
1552
+ }
1553
+ return () => {
1554
+ i(t), i(a);
1555
+ };
1556
+ function i(s) {
1557
+ s.forEach((c) => {
1558
+ const l = Ae(c);
1559
+ l == null || l.removeEventListener("scroll", o);
1560
+ });
1561
+ }
1562
+ }, [o, t]), F(() => t.length ? e ? Array.from(e.values()).reduce((a, i) => jt(a, i), dt) : zn(t) : dt, [t, e]);
1563
+ }
1564
+ function vn(t, e) {
1565
+ e === void 0 && (e = []);
1566
+ const n = C(null);
1567
+ return A(
1568
+ () => {
1569
+ n.current = null;
1570
+ },
1571
+ // eslint-disable-next-line react-hooks/exhaustive-deps
1572
+ e
1573
+ ), A(() => {
1574
+ const r = t !== dt;
1575
+ r && !n.current && (n.current = t), !r && n.current && (n.current = null);
1576
+ }, [t]), n.current ? be(t, n.current) : dt;
1577
+ }
1578
+ function Mo(t) {
1579
+ A(
1580
+ () => {
1581
+ if (!Se)
1582
+ return;
1583
+ const e = t.map((n) => {
1584
+ let {
1585
+ sensor: r
1586
+ } = n;
1587
+ return r.setup == null ? void 0 : r.setup();
1588
+ });
1589
+ return () => {
1590
+ for (const n of e)
1591
+ n == null || n();
1592
+ };
1593
+ },
1594
+ // TO-DO: Sensors length could theoretically change which would not be a valid dependency
1595
+ // eslint-disable-next-line react-hooks/exhaustive-deps
1596
+ t.map((e) => {
1597
+ let {
1598
+ sensor: n
1599
+ } = e;
1600
+ return n;
1601
+ })
1602
+ );
1603
+ }
1604
+ function xo(t, e) {
1605
+ return F(() => t.reduce((n, r) => {
1606
+ let {
1607
+ eventName: o,
1608
+ handler: a
1609
+ } = r;
1610
+ return n[o] = (i) => {
1611
+ a(i, e);
1612
+ }, n;
1613
+ }, {}), [t, e]);
1614
+ }
1615
+ function qn(t) {
1616
+ return F(() => t ? Vr(t) : null, [t]);
1617
+ }
1618
+ const yn = [];
1619
+ function So(t, e) {
1620
+ e === void 0 && (e = se);
1621
+ const [n] = t, r = qn(n ? U(n) : null), [o, a] = W(yn);
1622
+ function i() {
1623
+ a(() => t.length ? t.map((c) => Bn(c) ? r : new Ve(e(c), c)) : yn);
1624
+ }
1625
+ const s = Ne({
1626
+ callback: i
1627
+ });
1628
+ return bt(() => {
1629
+ s == null || s.disconnect(), i(), t.forEach((c) => s == null ? void 0 : s.observe(c));
1630
+ }, [t]), o;
1631
+ }
1632
+ function _n(t) {
1633
+ if (!t)
1634
+ return null;
1635
+ if (t.children.length > 1)
1636
+ return t;
1637
+ const e = t.children[0];
1638
+ return ae(e) ? e : t;
1639
+ }
1640
+ function Eo(t) {
1641
+ let {
1642
+ measure: e
1643
+ } = t;
1644
+ const [n, r] = W(null), o = I((l) => {
1645
+ for (const {
1646
+ target: u
1647
+ } of l)
1648
+ if (ae(u)) {
1649
+ r((d) => {
1650
+ const f = e(u);
1651
+ return d ? {
1652
+ ...d,
1653
+ width: f.width,
1654
+ height: f.height
1655
+ } : f;
1656
+ });
1657
+ break;
1658
+ }
1659
+ }, [e]), a = Ne({
1660
+ callback: o
1661
+ }), i = I((l) => {
1662
+ const u = _n(l);
1663
+ a == null || a.disconnect(), u && (a == null || a.observe(u)), r(u ? e(u) : null);
1664
+ }, [e, a]), [s, c] = ve(i);
1665
+ return F(() => ({
1666
+ nodeRef: s,
1667
+ rect: n,
1668
+ setRef: c
1669
+ }), [n, s, c]);
1670
+ }
1671
+ const Oo = [{
1672
+ sensor: Ke,
1673
+ options: {}
1674
+ }, {
1675
+ sensor: Xn,
1676
+ options: {}
1677
+ }], No = {
1678
+ current: {}
1679
+ }, me = {
1680
+ draggable: {
1681
+ measure: ln
1682
+ },
1683
+ droppable: {
1684
+ measure: ln,
1685
+ strategy: re.WhileDragging,
1686
+ frequency: Be.Optimized
1687
+ },
1688
+ dragOverlay: {
1689
+ measure: se
1690
+ }
1691
+ };
1692
+ class ee extends Map {
1693
+ get(e) {
1694
+ var n;
1695
+ return e != null && (n = super.get(e)) != null ? n : void 0;
1696
+ }
1697
+ toArray() {
1698
+ return Array.from(this.values());
1699
+ }
1700
+ getEnabled() {
1701
+ return this.toArray().filter((e) => {
1702
+ let {
1703
+ disabled: n
1704
+ } = e;
1705
+ return !n;
1706
+ });
1707
+ }
1708
+ getNodeFor(e) {
1709
+ var n, r;
1710
+ return (n = (r = this.get(e)) == null ? void 0 : r.node.current) != null ? n : void 0;
1711
+ }
1712
+ }
1713
+ const Co = {
1714
+ activatorEvent: null,
1715
+ active: null,
1716
+ activeNode: null,
1717
+ activeNodeRect: null,
1718
+ collisions: null,
1719
+ containerNodeRect: null,
1720
+ draggableNodes: /* @__PURE__ */ new Map(),
1721
+ droppableRects: /* @__PURE__ */ new Map(),
1722
+ droppableContainers: /* @__PURE__ */ new ee(),
1723
+ over: null,
1724
+ dragOverlay: {
1725
+ nodeRef: {
1726
+ current: null
1727
+ },
1728
+ rect: null,
1729
+ setRef: we
1730
+ },
1731
+ scrollableAncestors: [],
1732
+ scrollableAncestorRects: [],
1733
+ measuringConfiguration: me,
1734
+ measureDroppableContainers: we,
1735
+ windowRect: null,
1736
+ measuringScheduled: !1
1737
+ }, Vn = {
1738
+ activatorEvent: null,
1739
+ activators: [],
1740
+ active: null,
1741
+ activeNodeRect: null,
1742
+ ariaDescribedById: {
1743
+ draggable: ""
1744
+ },
1745
+ dispatch: we,
1746
+ draggableNodes: /* @__PURE__ */ new Map(),
1747
+ over: null,
1748
+ measureDroppableContainers: we
1749
+ }, ce = /* @__PURE__ */ oe(Vn), Gn = /* @__PURE__ */ oe(Co);
1750
+ function ko() {
1751
+ return {
1752
+ draggable: {
1753
+ active: null,
1754
+ initialCoordinates: {
1755
+ x: 0,
1756
+ y: 0
1757
+ },
1758
+ nodes: /* @__PURE__ */ new Map(),
1759
+ translate: {
1760
+ x: 0,
1761
+ y: 0
1762
+ }
1763
+ },
1764
+ droppable: {
1765
+ containers: new ee()
1766
+ }
1767
+ };
1768
+ }
1769
+ function To(t, e) {
1770
+ switch (e.type) {
1771
+ case j.DragStart:
1772
+ return {
1773
+ ...t,
1774
+ draggable: {
1775
+ ...t.draggable,
1776
+ initialCoordinates: e.initialCoordinates,
1777
+ active: e.active
1778
+ }
1779
+ };
1780
+ case j.DragMove:
1781
+ return t.draggable.active == null ? t : {
1782
+ ...t,
1783
+ draggable: {
1784
+ ...t.draggable,
1785
+ translate: {
1786
+ x: e.coordinates.x - t.draggable.initialCoordinates.x,
1787
+ y: e.coordinates.y - t.draggable.initialCoordinates.y
1788
+ }
1789
+ }
1790
+ };
1791
+ case j.DragEnd:
1792
+ case j.DragCancel:
1793
+ return {
1794
+ ...t,
1795
+ draggable: {
1796
+ ...t.draggable,
1797
+ active: null,
1798
+ initialCoordinates: {
1799
+ x: 0,
1800
+ y: 0
1801
+ },
1802
+ translate: {
1803
+ x: 0,
1804
+ y: 0
1805
+ }
1806
+ }
1807
+ };
1808
+ case j.RegisterDroppable: {
1809
+ const {
1810
+ element: n
1811
+ } = e, {
1812
+ id: r
1813
+ } = n, o = new ee(t.droppable.containers);
1814
+ return o.set(r, n), {
1815
+ ...t,
1816
+ droppable: {
1817
+ ...t.droppable,
1818
+ containers: o
1819
+ }
1820
+ };
1821
+ }
1822
+ case j.SetDroppableDisabled: {
1823
+ const {
1824
+ id: n,
1825
+ key: r,
1826
+ disabled: o
1827
+ } = e, a = t.droppable.containers.get(n);
1828
+ if (!a || r !== a.key)
1829
+ return t;
1830
+ const i = new ee(t.droppable.containers);
1831
+ return i.set(n, {
1832
+ ...a,
1833
+ disabled: o
1834
+ }), {
1835
+ ...t,
1836
+ droppable: {
1837
+ ...t.droppable,
1838
+ containers: i
1839
+ }
1840
+ };
1841
+ }
1842
+ case j.UnregisterDroppable: {
1843
+ const {
1844
+ id: n,
1845
+ key: r
1846
+ } = e, o = t.droppable.containers.get(n);
1847
+ if (!o || r !== o.key)
1848
+ return t;
1849
+ const a = new ee(t.droppable.containers);
1850
+ return a.delete(n), {
1851
+ ...t,
1852
+ droppable: {
1853
+ ...t.droppable,
1854
+ containers: a
1855
+ }
1856
+ };
1857
+ }
1858
+ default:
1859
+ return t;
1860
+ }
1861
+ }
1862
+ function Po(t) {
1863
+ let {
1864
+ disabled: e
1865
+ } = t;
1866
+ const {
1867
+ active: n,
1868
+ activatorEvent: r,
1869
+ draggableNodes: o
1870
+ } = kt(ce), a = ye(r), i = ye(n == null ? void 0 : n.id);
1871
+ return A(() => {
1872
+ if (!e && !r && a && i != null) {
1873
+ if (!qe(a) || document.activeElement === a.target)
1874
+ return;
1875
+ const s = o.get(i);
1876
+ if (!s)
1877
+ return;
1878
+ const {
1879
+ activatorNode: c,
1880
+ node: l
1881
+ } = s;
1882
+ if (!c.current && !l.current)
1883
+ return;
1884
+ requestAnimationFrame(() => {
1885
+ for (const u of [c.current, l.current]) {
1886
+ if (!u)
1887
+ continue;
1888
+ const d = Er(u);
1889
+ if (d) {
1890
+ d.focus();
1891
+ break;
1892
+ }
1893
+ }
1894
+ });
1895
+ }
1896
+ }, [r, e, o, i, a]), null;
1897
+ }
1898
+ function Kn(t, e) {
1899
+ let {
1900
+ transform: n,
1901
+ ...r
1902
+ } = e;
1903
+ return t != null && t.length ? t.reduce((o, a) => a({
1904
+ transform: o,
1905
+ ...r
1906
+ }), n) : n;
1907
+ }
1908
+ function Ro(t) {
1909
+ return F(
1910
+ () => ({
1911
+ draggable: {
1912
+ ...me.draggable,
1913
+ ...t == null ? void 0 : t.draggable
1914
+ },
1915
+ droppable: {
1916
+ ...me.droppable,
1917
+ ...t == null ? void 0 : t.droppable
1918
+ },
1919
+ dragOverlay: {
1920
+ ...me.dragOverlay,
1921
+ ...t == null ? void 0 : t.dragOverlay
1922
+ }
1923
+ }),
1924
+ // eslint-disable-next-line react-hooks/exhaustive-deps
1925
+ [t == null ? void 0 : t.draggable, t == null ? void 0 : t.droppable, t == null ? void 0 : t.dragOverlay]
1926
+ );
1927
+ }
1928
+ function Ao(t) {
1929
+ let {
1930
+ activeNode: e,
1931
+ measure: n,
1932
+ initialRect: r,
1933
+ config: o = !0
1934
+ } = t;
1935
+ const a = C(!1), {
1936
+ x: i,
1937
+ y: s
1938
+ } = typeof o == "boolean" ? {
1939
+ x: o,
1940
+ y: o
1941
+ } : o;
1942
+ bt(() => {
1943
+ if (!i && !s || !e) {
1944
+ a.current = !1;
1945
+ return;
1946
+ }
1947
+ if (a.current || !r)
1948
+ return;
1949
+ const l = e == null ? void 0 : e.node.current;
1950
+ if (!l || l.isConnected === !1)
1951
+ return;
1952
+ const u = n(l), d = Wn(u, r);
1953
+ if (i || (d.x = 0), s || (d.y = 0), a.current = !0, Math.abs(d.x) > 0 || Math.abs(d.y) > 0) {
1954
+ const f = Yn(l);
1955
+ f && f.scrollBy({
1956
+ top: d.y,
1957
+ left: d.x
1958
+ });
1959
+ }
1960
+ }, [e, i, s, r, n]);
1961
+ }
1962
+ const Ce = /* @__PURE__ */ oe({
1963
+ ...dt,
1964
+ scaleX: 1,
1965
+ scaleY: 1
1966
+ });
1967
+ var Et;
1968
+ (function(t) {
1969
+ t[t.Uninitialized = 0] = "Uninitialized", t[t.Initializing = 1] = "Initializing", t[t.Initialized = 2] = "Initialized";
1970
+ })(Et || (Et = {}));
1971
+ const Wo = /* @__PURE__ */ yr(function(e) {
1972
+ var n, r, o, a;
1973
+ let {
1974
+ id: i,
1975
+ accessibility: s,
1976
+ autoScroll: c = !0,
1977
+ children: l,
1978
+ sensors: u = Oo,
1979
+ collisionDetection: d = zr,
1980
+ measuring: f,
1981
+ modifiers: m,
1982
+ ...y
1983
+ } = e;
1984
+ const g = br(To, void 0, ko), [h, v] = g, [D, w] = Pr(), [E, p] = W(Et.Uninitialized), M = E === Et.Initialized, {
1985
+ draggable: {
1986
+ active: x,
1987
+ nodes: S,
1988
+ translate: k
1989
+ },
1990
+ droppable: {
1991
+ containers: Y
1992
+ }
1993
+ } = h, T = x != null ? S.get(x) : null, H = C({
1994
+ initial: null,
1995
+ translated: null
1996
+ }), G = F(() => {
1997
+ var K;
1998
+ return x != null ? {
1999
+ id: x,
2000
+ // It's possible for the active node to unmount while dragging
2001
+ data: (K = T == null ? void 0 : T.data) != null ? K : No,
2002
+ rect: H
2003
+ } : null;
2004
+ }, [x, T]), $ = C(null), [ft, Rt] = W(null), [ct, ue] = W(null), nt = ne(y, Object.values(y)), At = Oe("DndDescribedBy", i), qt = F(() => Y.getEnabled(), [Y]), R = Ro(f), {
2005
+ droppableRects: X,
2006
+ measureDroppableContainers: lt,
2007
+ measuringScheduled: rt
2008
+ } = mo(qt, {
2009
+ dragging: M,
2010
+ dependencies: [k.x, k.y],
2011
+ config: R.droppable
2012
+ }), Q = ho(S, x), _t = F(() => ct ? pe(ct) : null, [ct]), ut = mr(), vt = vo(Q, R.draggable.measure);
2013
+ Ao({
2014
+ activeNode: x != null ? S.get(x) : null,
2015
+ config: ut.layoutShiftCompensation,
2016
+ initialRect: vt,
2017
+ measure: R.draggable.measure
2018
+ });
2019
+ const _ = gn(Q, R.draggable.measure, vt), ht = gn(Q ? Q.parentElement : null), ot = C({
2020
+ activatorEvent: null,
2021
+ active: null,
2022
+ activeNode: Q,
2023
+ collisionRect: null,
2024
+ collisions: null,
2025
+ droppableRects: X,
2026
+ draggableNodes: S,
2027
+ draggingNode: null,
2028
+ draggingNodeRect: null,
2029
+ droppableContainers: Y,
2030
+ over: null,
2031
+ scrollableAncestors: [],
2032
+ scrollAdjustedTranslate: null
2033
+ }), Wt = Y.getNodeFor((n = ot.current.over) == null ? void 0 : n.id), J = Eo({
2034
+ measure: R.dragOverlay.measure
2035
+ }), Lt = (r = J.nodeRef.current) != null ? r : Q, Yt = M ? (o = J.rect) != null ? o : _ : null, Ze = !!(J.nodeRef.current && J.rect), tn = po(Ze ? null : _), ke = qn(Lt ? U(Lt) : null), pt = wo(M ? Wt ?? Q : null), de = So(pt), fe = Kn(m, {
2036
+ transform: {
2037
+ x: k.x - tn.x,
2038
+ y: k.y - tn.y,
2039
+ scaleX: 1,
2040
+ scaleY: 1
2041
+ },
2042
+ activatorEvent: ct,
2043
+ active: G,
2044
+ activeNodeRect: _,
2045
+ containerNodeRect: ht,
2046
+ draggingNodeRect: Yt,
2047
+ over: ot.current.over,
2048
+ overlayNodeRect: J.rect,
2049
+ scrollableAncestors: pt,
2050
+ scrollableAncestorRects: de,
2051
+ windowRect: ke
2052
+ }), en = _t ? jt(_t, k) : null, nn = Do(pt), cr = vn(nn), lr = vn(nn, [_]), Ft = jt(fe, cr), It = Yt ? Xr(Yt, fe) : null, Vt = G && It ? d({
2053
+ active: G,
2054
+ collisionRect: It,
2055
+ droppableRects: X,
2056
+ droppableContainers: qt,
2057
+ pointerCoordinates: en
2058
+ }) : null, rn = Br(Vt, "id"), [wt, on] = W(null), ur = Ze ? fe : jt(fe, lr), dr = jr(ur, (a = wt == null ? void 0 : wt.rect) != null ? a : null, _), Te = C(null), an = I(
2059
+ (K, Z) => {
2060
+ let {
2061
+ sensor: tt,
2062
+ options: Dt
2063
+ } = Z;
2064
+ if ($.current == null)
2065
+ return;
2066
+ const at = S.get($.current);
2067
+ if (!at)
2068
+ return;
2069
+ const et = K.nativeEvent, gt = new tt({
2070
+ active: $.current,
2071
+ activeNode: at,
2072
+ event: et,
2073
+ options: Dt,
2074
+ // Sensors need to be instantiated with refs for arguments that change over time
2075
+ // otherwise they are frozen in time with the stale arguments
2076
+ context: ot,
2077
+ onAbort(V) {
2078
+ if (!S.get(V))
2079
+ return;
2080
+ const {
2081
+ onDragAbort: mt
2082
+ } = nt.current, yt = {
2083
+ id: V
2084
+ };
2085
+ mt == null || mt(yt), D({
2086
+ type: "onDragAbort",
2087
+ event: yt
2088
+ });
2089
+ },
2090
+ onPending(V, Mt, mt, yt) {
2091
+ if (!S.get(V))
2092
+ return;
2093
+ const {
2094
+ onDragPending: Kt
2095
+ } = nt.current, xt = {
2096
+ id: V,
2097
+ constraint: Mt,
2098
+ initialCoordinates: mt,
2099
+ offset: yt
2100
+ };
2101
+ Kt == null || Kt(xt), D({
2102
+ type: "onDragPending",
2103
+ event: xt
2104
+ });
2105
+ },
2106
+ onStart(V) {
2107
+ const Mt = $.current;
2108
+ if (Mt == null)
2109
+ return;
2110
+ const mt = S.get(Mt);
2111
+ if (!mt)
2112
+ return;
2113
+ const {
2114
+ onDragStart: yt
2115
+ } = nt.current, Gt = {
2116
+ activatorEvent: et,
2117
+ active: {
2118
+ id: Mt,
2119
+ data: mt.data,
2120
+ rect: H
2121
+ }
2122
+ };
2123
+ he(() => {
2124
+ yt == null || yt(Gt), p(Et.Initializing), v({
2125
+ type: j.DragStart,
2126
+ initialCoordinates: V,
2127
+ active: Mt
2128
+ }), D({
2129
+ type: "onDragStart",
2130
+ event: Gt
2131
+ }), Rt(Te.current), ue(et);
2132
+ });
2133
+ },
2134
+ onMove(V) {
2135
+ v({
2136
+ type: j.DragMove,
2137
+ coordinates: V
2138
+ });
2139
+ },
2140
+ onEnd: Bt(j.DragEnd),
2141
+ onCancel: Bt(j.DragCancel)
2142
+ });
2143
+ Te.current = gt;
2144
+ function Bt(V) {
2145
+ return async function() {
2146
+ const {
2147
+ active: mt,
2148
+ collisions: yt,
2149
+ over: Gt,
2150
+ scrollAdjustedTranslate: Kt
2151
+ } = ot.current;
2152
+ let xt = null;
2153
+ if (mt && Kt) {
2154
+ const {
2155
+ cancelDrop: Ut
2156
+ } = nt.current;
2157
+ xt = {
2158
+ activatorEvent: et,
2159
+ active: mt,
2160
+ collisions: yt,
2161
+ delta: Kt,
2162
+ over: Gt
2163
+ }, V === j.DragEnd && typeof Ut == "function" && await Promise.resolve(Ut(xt)) && (V = j.DragCancel);
2164
+ }
2165
+ $.current = null, he(() => {
2166
+ v({
2167
+ type: V
2168
+ }), p(Et.Uninitialized), on(null), Rt(null), ue(null), Te.current = null;
2169
+ const Ut = V === j.DragEnd ? "onDragEnd" : "onDragCancel";
2170
+ if (xt) {
2171
+ const Pe = nt.current[Ut];
2172
+ Pe == null || Pe(xt), D({
2173
+ type: Ut,
2174
+ event: xt
2175
+ });
2176
+ }
2177
+ });
2178
+ };
2179
+ }
2180
+ },
2181
+ // eslint-disable-next-line react-hooks/exhaustive-deps
2182
+ [S]
2183
+ ), fr = I((K, Z) => (tt, Dt) => {
2184
+ const at = tt.nativeEvent, et = S.get(Dt);
2185
+ if (
2186
+ // Another sensor is already instantiating
2187
+ $.current !== null || // No active draggable
2188
+ !et || // Event has already been captured
2189
+ at.dndKit || at.defaultPrevented
2190
+ )
2191
+ return;
2192
+ const gt = {
2193
+ active: et
2194
+ };
2195
+ K(tt, Z.options, gt) === !0 && (at.dndKit = {
2196
+ capturedBy: Z.sensor
2197
+ }, $.current = Dt, an(tt, Z));
2198
+ }, [S, an]), sn = go(u, fr);
2199
+ Mo(u), bt(() => {
2200
+ _ && E === Et.Initializing && p(Et.Initialized);
2201
+ }, [_, E]), A(
2202
+ () => {
2203
+ const {
2204
+ onDragMove: K
2205
+ } = nt.current, {
2206
+ active: Z,
2207
+ activatorEvent: tt,
2208
+ collisions: Dt,
2209
+ over: at
2210
+ } = ot.current;
2211
+ if (!Z || !tt)
2212
+ return;
2213
+ const et = {
2214
+ active: Z,
2215
+ activatorEvent: tt,
2216
+ collisions: Dt,
2217
+ delta: {
2218
+ x: Ft.x,
2219
+ y: Ft.y
2220
+ },
2221
+ over: at
2222
+ };
2223
+ he(() => {
2224
+ K == null || K(et), D({
2225
+ type: "onDragMove",
2226
+ event: et
2227
+ });
2228
+ });
2229
+ },
2230
+ // eslint-disable-next-line react-hooks/exhaustive-deps
2231
+ [Ft.x, Ft.y]
2232
+ ), A(
2233
+ () => {
2234
+ const {
2235
+ active: K,
2236
+ activatorEvent: Z,
2237
+ collisions: tt,
2238
+ droppableContainers: Dt,
2239
+ scrollAdjustedTranslate: at
2240
+ } = ot.current;
2241
+ if (!K || $.current == null || !Z || !at)
2242
+ return;
2243
+ const {
2244
+ onDragOver: et
2245
+ } = nt.current, gt = Dt.get(rn), Bt = gt && gt.rect.current ? {
2246
+ id: gt.id,
2247
+ rect: gt.rect.current,
2248
+ data: gt.data,
2249
+ disabled: gt.disabled
2250
+ } : null, V = {
2251
+ active: K,
2252
+ activatorEvent: Z,
2253
+ collisions: tt,
2254
+ delta: {
2255
+ x: at.x,
2256
+ y: at.y
2257
+ },
2258
+ over: Bt
2259
+ };
2260
+ he(() => {
2261
+ on(Bt), et == null || et(V), D({
2262
+ type: "onDragOver",
2263
+ event: V
2264
+ });
2265
+ });
2266
+ },
2267
+ // eslint-disable-next-line react-hooks/exhaustive-deps
2268
+ [rn]
2269
+ ), bt(() => {
2270
+ ot.current = {
2271
+ activatorEvent: ct,
2272
+ active: G,
2273
+ activeNode: Q,
2274
+ collisionRect: It,
2275
+ collisions: Vt,
2276
+ droppableRects: X,
2277
+ draggableNodes: S,
2278
+ draggingNode: Lt,
2279
+ draggingNodeRect: Yt,
2280
+ droppableContainers: Y,
2281
+ over: wt,
2282
+ scrollableAncestors: pt,
2283
+ scrollAdjustedTranslate: Ft
2284
+ }, H.current = {
2285
+ initial: Yt,
2286
+ translated: It
2287
+ };
2288
+ }, [G, Q, Vt, It, S, Lt, Yt, X, Y, wt, pt, Ft]), lo({
2289
+ ...ut,
2290
+ delta: k,
2291
+ draggingRect: It,
2292
+ pointerCoordinates: en,
2293
+ scrollableAncestors: pt,
2294
+ scrollableAncestorRects: de
2295
+ });
2296
+ const hr = F(() => ({
2297
+ active: G,
2298
+ activeNode: Q,
2299
+ activeNodeRect: _,
2300
+ activatorEvent: ct,
2301
+ collisions: Vt,
2302
+ containerNodeRect: ht,
2303
+ dragOverlay: J,
2304
+ draggableNodes: S,
2305
+ droppableContainers: Y,
2306
+ droppableRects: X,
2307
+ over: wt,
2308
+ measureDroppableContainers: lt,
2309
+ scrollableAncestors: pt,
2310
+ scrollableAncestorRects: de,
2311
+ measuringConfiguration: R,
2312
+ measuringScheduled: rt,
2313
+ windowRect: ke
2314
+ }), [G, Q, _, ct, Vt, ht, J, S, Y, X, wt, lt, pt, de, R, rt, ke]), gr = F(() => ({
2315
+ activatorEvent: ct,
2316
+ activators: sn,
2317
+ active: G,
2318
+ activeNodeRect: _,
2319
+ ariaDescribedById: {
2320
+ draggable: At
2321
+ },
2322
+ dispatch: v,
2323
+ draggableNodes: S,
2324
+ over: wt,
2325
+ measureDroppableContainers: lt
2326
+ }), [ct, sn, G, _, v, At, S, wt, lt]);
2327
+ return B.createElement(An.Provider, {
2328
+ value: w
2329
+ }, B.createElement(ce.Provider, {
2330
+ value: gr
2331
+ }, B.createElement(Gn.Provider, {
2332
+ value: hr
2333
+ }, B.createElement(Ce.Provider, {
2334
+ value: dr
2335
+ }, l)), B.createElement(Po, {
2336
+ disabled: (s == null ? void 0 : s.restoreFocus) === !1
2337
+ })), B.createElement(Wr, {
2338
+ ...s,
2339
+ hiddenTextDescribedById: At
2340
+ }));
2341
+ function mr() {
2342
+ const K = (ft == null ? void 0 : ft.autoScrollEnabled) === !1, Z = typeof c == "object" ? c.enabled === !1 : c === !1, tt = M && !K && !Z;
2343
+ return typeof c == "object" ? {
2344
+ ...c,
2345
+ enabled: tt
2346
+ } : {
2347
+ enabled: tt
2348
+ };
2349
+ }
2350
+ }), Lo = /* @__PURE__ */ oe(null), bn = "button", Yo = "Draggable";
2351
+ function Un(t) {
2352
+ let {
2353
+ id: e,
2354
+ data: n,
2355
+ disabled: r = !1,
2356
+ attributes: o
2357
+ } = t;
2358
+ const a = Oe(Yo), {
2359
+ activators: i,
2360
+ activatorEvent: s,
2361
+ active: c,
2362
+ activeNodeRect: l,
2363
+ ariaDescribedById: u,
2364
+ draggableNodes: d,
2365
+ over: f
2366
+ } = kt(ce), {
2367
+ role: m = bn,
2368
+ roleDescription: y = "draggable",
2369
+ tabIndex: g = 0
2370
+ } = o ?? {}, h = (c == null ? void 0 : c.id) === e, v = kt(h ? Ce : Lo), [D, w] = ve(), [E, p] = ve(), M = xo(i, e), x = ne(n);
2371
+ bt(
2372
+ () => (d.set(e, {
2373
+ id: e,
2374
+ key: a,
2375
+ node: D,
2376
+ activatorNode: E,
2377
+ data: x
2378
+ }), () => {
2379
+ const k = d.get(e);
2380
+ k && k.key === a && d.delete(e);
2381
+ }),
2382
+ // eslint-disable-next-line react-hooks/exhaustive-deps
2383
+ [d, e]
2384
+ );
2385
+ const S = F(() => ({
2386
+ role: m,
2387
+ tabIndex: g,
2388
+ "aria-disabled": r,
2389
+ "aria-pressed": h && m === bn ? !0 : void 0,
2390
+ "aria-roledescription": y,
2391
+ "aria-describedby": u.draggable
2392
+ }), [r, m, g, h, y, u.draggable]);
2393
+ return {
2394
+ active: c,
2395
+ activatorEvent: s,
2396
+ activeNodeRect: l,
2397
+ attributes: S,
2398
+ isDragging: h,
2399
+ listeners: r ? void 0 : M,
2400
+ node: D,
2401
+ over: f,
2402
+ setNodeRef: w,
2403
+ setActivatorNodeRef: p,
2404
+ transform: v
2405
+ };
2406
+ }
2407
+ function Fo() {
2408
+ return kt(Gn);
2409
+ }
2410
+ const Io = "Droppable", Bo = {
2411
+ timeout: 25
2412
+ };
2413
+ function Qn(t) {
2414
+ let {
2415
+ data: e,
2416
+ disabled: n = !1,
2417
+ id: r,
2418
+ resizeObserverConfig: o
2419
+ } = t;
2420
+ const a = Oe(Io), {
2421
+ active: i,
2422
+ dispatch: s,
2423
+ over: c,
2424
+ measureDroppableContainers: l
2425
+ } = kt(ce), u = C({
2426
+ disabled: n
2427
+ }), d = C(!1), f = C(null), m = C(null), {
2428
+ disabled: y,
2429
+ updateMeasurementsFor: g,
2430
+ timeout: h
2431
+ } = {
2432
+ ...Bo,
2433
+ ...o
2434
+ }, v = ne(g ?? r), D = I(
2435
+ () => {
2436
+ if (!d.current) {
2437
+ d.current = !0;
2438
+ return;
2439
+ }
2440
+ m.current != null && clearTimeout(m.current), m.current = setTimeout(() => {
2441
+ l(Array.isArray(v.current) ? v.current : [v.current]), m.current = null;
2442
+ }, h);
2443
+ },
2444
+ //eslint-disable-next-line react-hooks/exhaustive-deps
2445
+ [h]
2446
+ ), w = Ne({
2447
+ callback: D,
2448
+ disabled: y || !i
2449
+ }), E = I((S, k) => {
2450
+ w && (k && (w.unobserve(k), d.current = !1), S && w.observe(S));
2451
+ }, [w]), [p, M] = ve(E), x = ne(e);
2452
+ return A(() => {
2453
+ !w || !p.current || (w.disconnect(), d.current = !1, w.observe(p.current));
2454
+ }, [p, w]), A(
2455
+ () => (s({
2456
+ type: j.RegisterDroppable,
2457
+ element: {
2458
+ id: r,
2459
+ key: a,
2460
+ disabled: n,
2461
+ node: p,
2462
+ rect: f,
2463
+ data: x
2464
+ }
2465
+ }), () => s({
2466
+ type: j.UnregisterDroppable,
2467
+ key: a,
2468
+ id: r
2469
+ })),
2470
+ // eslint-disable-next-line react-hooks/exhaustive-deps
2471
+ [r]
2472
+ ), A(() => {
2473
+ n !== u.current.disabled && (s({
2474
+ type: j.SetDroppableDisabled,
2475
+ id: r,
2476
+ key: a,
2477
+ disabled: n
2478
+ }), u.current.disabled = n);
2479
+ }, [r, a, n, s]), {
2480
+ active: i,
2481
+ rect: f,
2482
+ isOver: (c == null ? void 0 : c.id) === r,
2483
+ node: p,
2484
+ over: c,
2485
+ setNodeRef: M
2486
+ };
2487
+ }
2488
+ function $o(t) {
2489
+ let {
2490
+ animation: e,
2491
+ children: n
2492
+ } = t;
2493
+ const [r, o] = W(null), [a, i] = W(null), s = ye(n);
2494
+ return !n && !r && s && o(s), bt(() => {
2495
+ if (!a)
2496
+ return;
2497
+ const c = r == null ? void 0 : r.key, l = r == null ? void 0 : r.props.id;
2498
+ if (c == null || l == null) {
2499
+ o(null);
2500
+ return;
2501
+ }
2502
+ Promise.resolve(e(l, a)).then(() => {
2503
+ o(null);
2504
+ });
2505
+ }, [e, r, a]), B.createElement(B.Fragment, null, n, r ? pr(r, {
2506
+ ref: i
2507
+ }) : null);
2508
+ }
2509
+ const zo = {
2510
+ x: 0,
2511
+ y: 0,
2512
+ scaleX: 1,
2513
+ scaleY: 1
2514
+ };
2515
+ function jo(t) {
2516
+ let {
2517
+ children: e
2518
+ } = t;
2519
+ return B.createElement(ce.Provider, {
2520
+ value: Vn
2521
+ }, B.createElement(Ce.Provider, {
2522
+ value: zo
2523
+ }, e));
2524
+ }
2525
+ const Ho = {
2526
+ position: "fixed",
2527
+ touchAction: "none"
2528
+ }, Xo = (t) => qe(t) ? "transform 250ms ease" : void 0, qo = /* @__PURE__ */ wr((t, e) => {
2529
+ let {
2530
+ as: n,
2531
+ activatorEvent: r,
2532
+ adjustScale: o,
2533
+ children: a,
2534
+ className: i,
2535
+ rect: s,
2536
+ style: c,
2537
+ transform: l,
2538
+ transition: u = Xo
2539
+ } = t;
2540
+ if (!s)
2541
+ return null;
2542
+ const d = o ? l : {
2543
+ ...l,
2544
+ scaleX: 1,
2545
+ scaleY: 1
2546
+ }, f = {
2547
+ ...Ho,
2548
+ width: s.width,
2549
+ height: s.height,
2550
+ top: s.top,
2551
+ left: s.left,
2552
+ transform: Tt.Transform.toString(d),
2553
+ transformOrigin: o && r ? Fr(r, s) : void 0,
2554
+ transition: typeof u == "function" ? u(r) : u,
2555
+ ...c
2556
+ };
2557
+ return B.createElement(n, {
2558
+ className: i,
2559
+ style: f,
2560
+ ref: e
2561
+ }, a);
2562
+ }), _o = (t) => (e) => {
2563
+ let {
2564
+ active: n,
2565
+ dragOverlay: r
2566
+ } = e;
2567
+ const o = {}, {
2568
+ styles: a,
2569
+ className: i
2570
+ } = t;
2571
+ if (a != null && a.active)
2572
+ for (const [s, c] of Object.entries(a.active))
2573
+ c !== void 0 && (o[s] = n.node.style.getPropertyValue(s), n.node.style.setProperty(s, c));
2574
+ if (a != null && a.dragOverlay)
2575
+ for (const [s, c] of Object.entries(a.dragOverlay))
2576
+ c !== void 0 && r.node.style.setProperty(s, c);
2577
+ return i != null && i.active && n.node.classList.add(i.active), i != null && i.dragOverlay && r.node.classList.add(i.dragOverlay), function() {
2578
+ for (const [c, l] of Object.entries(o))
2579
+ n.node.style.setProperty(c, l);
2580
+ i != null && i.active && n.node.classList.remove(i.active);
2581
+ };
2582
+ }, Vo = (t) => {
2583
+ let {
2584
+ transform: {
2585
+ initial: e,
2586
+ final: n
2587
+ }
2588
+ } = t;
2589
+ return [{
2590
+ transform: Tt.Transform.toString(e)
2591
+ }, {
2592
+ transform: Tt.Transform.toString(n)
2593
+ }];
2594
+ }, Go = {
2595
+ duration: 250,
2596
+ easing: "ease",
2597
+ keyframes: Vo,
2598
+ sideEffects: /* @__PURE__ */ _o({
2599
+ styles: {
2600
+ active: {
2601
+ opacity: "0"
2602
+ }
2603
+ }
2604
+ })
2605
+ };
2606
+ function Ko(t) {
2607
+ let {
2608
+ config: e,
2609
+ draggableNodes: n,
2610
+ droppableContainers: r,
2611
+ measuringConfiguration: o
2612
+ } = t;
2613
+ return Ee((a, i) => {
2614
+ if (e === null)
2615
+ return;
2616
+ const s = n.get(a);
2617
+ if (!s)
2618
+ return;
2619
+ const c = s.node.current;
2620
+ if (!c)
2621
+ return;
2622
+ const l = _n(i);
2623
+ if (!l)
2624
+ return;
2625
+ const {
2626
+ transform: u
2627
+ } = U(i).getComputedStyle(i), d = Ln(u);
2628
+ if (!d)
2629
+ return;
2630
+ const f = typeof e == "function" ? e : Uo(e);
2631
+ return jn(c, o.draggable.measure), f({
2632
+ active: {
2633
+ id: a,
2634
+ data: s.data,
2635
+ node: c,
2636
+ rect: o.draggable.measure(c)
2637
+ },
2638
+ draggableNodes: n,
2639
+ dragOverlay: {
2640
+ node: i,
2641
+ rect: o.dragOverlay.measure(l)
2642
+ },
2643
+ droppableContainers: r,
2644
+ measuringConfiguration: o,
2645
+ transform: d
2646
+ });
2647
+ });
2648
+ }
2649
+ function Uo(t) {
2650
+ const {
2651
+ duration: e,
2652
+ easing: n,
2653
+ sideEffects: r,
2654
+ keyframes: o
2655
+ } = {
2656
+ ...Go,
2657
+ ...t
2658
+ };
2659
+ return (a) => {
2660
+ let {
2661
+ active: i,
2662
+ dragOverlay: s,
2663
+ transform: c,
2664
+ ...l
2665
+ } = a;
2666
+ if (!e)
2667
+ return;
2668
+ const u = {
2669
+ x: s.rect.left - i.rect.left,
2670
+ y: s.rect.top - i.rect.top
2671
+ }, d = {
2672
+ scaleX: c.scaleX !== 1 ? i.rect.width * c.scaleX / s.rect.width : 1,
2673
+ scaleY: c.scaleY !== 1 ? i.rect.height * c.scaleY / s.rect.height : 1
2674
+ }, f = {
2675
+ x: c.x - u.x,
2676
+ y: c.y - u.y,
2677
+ ...d
2678
+ }, m = o({
2679
+ ...l,
2680
+ active: i,
2681
+ dragOverlay: s,
2682
+ transform: {
2683
+ initial: c,
2684
+ final: f
2685
+ }
2686
+ }), [y] = m, g = m[m.length - 1];
2687
+ if (JSON.stringify(y) === JSON.stringify(g))
2688
+ return;
2689
+ const h = r == null ? void 0 : r({
2690
+ active: i,
2691
+ dragOverlay: s,
2692
+ ...l
2693
+ }), v = s.node.animate(m, {
2694
+ duration: e,
2695
+ easing: n,
2696
+ fill: "forwards"
2697
+ });
2698
+ return new Promise((D) => {
2699
+ v.onfinish = () => {
2700
+ h == null || h(), D();
2701
+ };
2702
+ });
2703
+ };
2704
+ }
2705
+ let pn = 0;
2706
+ function Qo(t) {
2707
+ return F(() => {
2708
+ if (t != null)
2709
+ return pn++, pn;
2710
+ }, [t]);
2711
+ }
2712
+ const Jo = /* @__PURE__ */ B.memo((t) => {
2713
+ let {
2714
+ adjustScale: e = !1,
2715
+ children: n,
2716
+ dropAnimation: r,
2717
+ style: o,
2718
+ transition: a,
2719
+ modifiers: i,
2720
+ wrapperElement: s = "div",
2721
+ className: c,
2722
+ zIndex: l = 999
2723
+ } = t;
2724
+ const {
2725
+ activatorEvent: u,
2726
+ active: d,
2727
+ activeNodeRect: f,
2728
+ containerNodeRect: m,
2729
+ draggableNodes: y,
2730
+ droppableContainers: g,
2731
+ dragOverlay: h,
2732
+ over: v,
2733
+ measuringConfiguration: D,
2734
+ scrollableAncestors: w,
2735
+ scrollableAncestorRects: E,
2736
+ windowRect: p
2737
+ } = Fo(), M = kt(Ce), x = Qo(d == null ? void 0 : d.id), S = Kn(i, {
2738
+ activatorEvent: u,
2739
+ active: d,
2740
+ activeNodeRect: f,
2741
+ containerNodeRect: m,
2742
+ draggingNodeRect: h.rect,
2743
+ over: v,
2744
+ overlayNodeRect: h.rect,
2745
+ scrollableAncestors: w,
2746
+ scrollableAncestorRects: E,
2747
+ transform: M,
2748
+ windowRect: p
2749
+ }), k = Ue(f), Y = Ko({
2750
+ config: r,
2751
+ draggableNodes: y,
2752
+ droppableContainers: g,
2753
+ measuringConfiguration: D
2754
+ }), T = k ? h.setRef : void 0;
2755
+ return B.createElement(jo, null, B.createElement($o, {
2756
+ animation: Y
2757
+ }, d && x ? B.createElement(qo, {
2758
+ key: x,
2759
+ id: d.id,
2760
+ ref: T,
2761
+ as: s,
2762
+ activatorEvent: u,
2763
+ adjustScale: e,
2764
+ className: c,
2765
+ transition: a,
2766
+ rect: k,
2767
+ style: {
2768
+ zIndex: l,
2769
+ ...o
2770
+ },
2771
+ transform: S
2772
+ }, n) : null));
2773
+ });
2774
+ function Zo(t, e, n) {
2775
+ const r = {
2776
+ ...t
2777
+ };
2778
+ return e.top + t.y <= n.top ? r.y = n.top - e.top : e.bottom + t.y >= n.top + n.height && (r.y = n.top + n.height - e.bottom), e.left + t.x <= n.left ? r.x = n.left - e.left : e.right + t.x >= n.left + n.width && (r.x = n.left + n.width - e.right), r;
2779
+ }
2780
+ const ta = (t) => {
2781
+ let {
2782
+ transform: e,
2783
+ draggingNodeRect: n,
2784
+ windowRect: r
2785
+ } = t;
2786
+ return !n || !r ? e : Zo(e, n, r);
2787
+ };
2788
+ function P(t) {
2789
+ const e = Object.prototype.toString.call(t);
2790
+ return t instanceof Date || typeof t == "object" && e === "[object Date]" ? new t.constructor(+t) : typeof t == "number" || e === "[object Number]" || typeof t == "string" || e === "[object String]" ? new Date(t) : /* @__PURE__ */ new Date(NaN);
2791
+ }
2792
+ function st(t, e) {
2793
+ return t instanceof Date ? new t.constructor(e) : new Date(e);
2794
+ }
2795
+ function Ct(t, e) {
2796
+ const n = P(t);
2797
+ return isNaN(e) ? st(t, NaN) : (e && n.setDate(n.getDate() + e), n);
2798
+ }
2799
+ function Jn(t, e) {
2800
+ const n = P(t);
2801
+ if (isNaN(e)) return st(t, NaN);
2802
+ if (!e)
2803
+ return n;
2804
+ const r = n.getDate(), o = st(t, n.getTime());
2805
+ o.setMonth(n.getMonth() + e + 1, 0);
2806
+ const a = o.getDate();
2807
+ return r >= a ? o : (n.setFullYear(
2808
+ o.getFullYear(),
2809
+ o.getMonth(),
2810
+ r
2811
+ ), n);
2812
+ }
2813
+ function ea(t, e) {
2814
+ const n = +P(t);
2815
+ return st(t, n + e);
2816
+ }
2817
+ const Zn = 6048e5, na = 864e5, tr = 6e4;
2818
+ let ra = {};
2819
+ function le() {
2820
+ return ra;
2821
+ }
2822
+ function Ot(t, e) {
2823
+ var s, c, l, u;
2824
+ const n = le(), r = (e == null ? void 0 : e.weekStartsOn) ?? ((c = (s = e == null ? void 0 : e.locale) == null ? void 0 : s.options) == null ? void 0 : c.weekStartsOn) ?? n.weekStartsOn ?? ((u = (l = n.locale) == null ? void 0 : l.options) == null ? void 0 : u.weekStartsOn) ?? 0, o = P(t), a = o.getDay(), i = (a < r ? 7 : 0) + a - r;
2825
+ return o.setDate(o.getDate() - i), o.setHours(0, 0, 0, 0), o;
2826
+ }
2827
+ function Me(t) {
2828
+ return Ot(t, { weekStartsOn: 1 });
2829
+ }
2830
+ function er(t) {
2831
+ const e = P(t), n = e.getFullYear(), r = st(t, 0);
2832
+ r.setFullYear(n + 1, 0, 4), r.setHours(0, 0, 0, 0);
2833
+ const o = Me(r), a = st(t, 0);
2834
+ a.setFullYear(n, 0, 4), a.setHours(0, 0, 0, 0);
2835
+ const i = Me(a);
2836
+ return e.getTime() >= o.getTime() ? n + 1 : e.getTime() >= i.getTime() ? n : n - 1;
2837
+ }
2838
+ function Pt(t) {
2839
+ const e = P(t);
2840
+ return e.setHours(0, 0, 0, 0), e;
2841
+ }
2842
+ function wn(t) {
2843
+ const e = P(t), n = new Date(
2844
+ Date.UTC(
2845
+ e.getFullYear(),
2846
+ e.getMonth(),
2847
+ e.getDate(),
2848
+ e.getHours(),
2849
+ e.getMinutes(),
2850
+ e.getSeconds(),
2851
+ e.getMilliseconds()
2852
+ )
2853
+ );
2854
+ return n.setUTCFullYear(e.getFullYear()), +t - +n;
2855
+ }
2856
+ function oa(t, e) {
2857
+ const n = Pt(t), r = Pt(e), o = +n - wn(n), a = +r - wn(r);
2858
+ return Math.round((o - a) / na);
2859
+ }
2860
+ function aa(t) {
2861
+ const e = er(t), n = st(t, 0);
2862
+ return n.setFullYear(e, 0, 4), n.setHours(0, 0, 0, 0), Me(n);
2863
+ }
2864
+ function zt(t, e) {
2865
+ return ea(t, e * tr);
2866
+ }
2867
+ function nr(t, e) {
2868
+ const n = e * 7;
2869
+ return Ct(t, n);
2870
+ }
2871
+ function ia(t) {
2872
+ return st(t, Date.now());
2873
+ }
2874
+ function sa(t, e) {
2875
+ const n = Pt(t), r = Pt(e);
2876
+ return +n == +r;
2877
+ }
2878
+ function ca(t) {
2879
+ return t instanceof Date || typeof t == "object" && Object.prototype.toString.call(t) === "[object Date]";
2880
+ }
2881
+ function la(t) {
2882
+ if (!ca(t) && typeof t != "number")
2883
+ return !1;
2884
+ const e = P(t);
2885
+ return !isNaN(Number(e));
2886
+ }
2887
+ function ua(t) {
2888
+ return (e) => {
2889
+ const n = Math.trunc, r = n(e);
2890
+ return r === 0 ? 0 : r;
2891
+ };
2892
+ }
2893
+ function da(t, e) {
2894
+ return +P(t) - +P(e);
2895
+ }
2896
+ function $e(t, e, n) {
2897
+ const r = da(t, e) / tr;
2898
+ return ua()(r);
2899
+ }
2900
+ function fa(t) {
2901
+ const e = P(t), n = e.getMonth();
2902
+ return e.setFullYear(e.getFullYear(), n + 1, 0), e.setHours(23, 59, 59, 999), e;
2903
+ }
2904
+ function rr(t, e) {
2905
+ const n = P(t.start), r = P(t.end);
2906
+ let o = +n > +r;
2907
+ const a = o ? +n : +r, i = o ? r : n;
2908
+ i.setHours(0, 0, 0, 0);
2909
+ let s = 1;
2910
+ const c = [];
2911
+ for (; +i <= a; )
2912
+ c.push(P(i)), i.setDate(i.getDate() + s), i.setHours(0, 0, 0, 0);
2913
+ return o ? c.reverse() : c;
2914
+ }
2915
+ function ha(t) {
2916
+ const e = P(t);
2917
+ return e.setDate(1), e.setHours(0, 0, 0, 0), e;
2918
+ }
2919
+ function ga(t) {
2920
+ const e = P(t), n = st(t, 0);
2921
+ return n.setFullYear(e.getFullYear(), 0, 1), n.setHours(0, 0, 0, 0), n;
2922
+ }
2923
+ function Qe(t, e) {
2924
+ var s, c, l, u;
2925
+ const n = le(), r = (e == null ? void 0 : e.weekStartsOn) ?? ((c = (s = e == null ? void 0 : e.locale) == null ? void 0 : s.options) == null ? void 0 : c.weekStartsOn) ?? n.weekStartsOn ?? ((u = (l = n.locale) == null ? void 0 : l.options) == null ? void 0 : u.weekStartsOn) ?? 0, o = P(t), a = o.getDay(), i = (a < r ? -7 : 0) + 6 - (a - r);
2926
+ return o.setDate(o.getDate() + i), o.setHours(23, 59, 59, 999), o;
2927
+ }
2928
+ const ma = {
2929
+ lessThanXSeconds: {
2930
+ one: "less than a second",
2931
+ other: "less than {{count}} seconds"
2932
+ },
2933
+ xSeconds: {
2934
+ one: "1 second",
2935
+ other: "{{count}} seconds"
2936
+ },
2937
+ halfAMinute: "half a minute",
2938
+ lessThanXMinutes: {
2939
+ one: "less than a minute",
2940
+ other: "less than {{count}} minutes"
2941
+ },
2942
+ xMinutes: {
2943
+ one: "1 minute",
2944
+ other: "{{count}} minutes"
2945
+ },
2946
+ aboutXHours: {
2947
+ one: "about 1 hour",
2948
+ other: "about {{count}} hours"
2949
+ },
2950
+ xHours: {
2951
+ one: "1 hour",
2952
+ other: "{{count}} hours"
2953
+ },
2954
+ xDays: {
2955
+ one: "1 day",
2956
+ other: "{{count}} days"
2957
+ },
2958
+ aboutXWeeks: {
2959
+ one: "about 1 week",
2960
+ other: "about {{count}} weeks"
2961
+ },
2962
+ xWeeks: {
2963
+ one: "1 week",
2964
+ other: "{{count}} weeks"
2965
+ },
2966
+ aboutXMonths: {
2967
+ one: "about 1 month",
2968
+ other: "about {{count}} months"
2969
+ },
2970
+ xMonths: {
2971
+ one: "1 month",
2972
+ other: "{{count}} months"
2973
+ },
2974
+ aboutXYears: {
2975
+ one: "about 1 year",
2976
+ other: "about {{count}} years"
2977
+ },
2978
+ xYears: {
2979
+ one: "1 year",
2980
+ other: "{{count}} years"
2981
+ },
2982
+ overXYears: {
2983
+ one: "over 1 year",
2984
+ other: "over {{count}} years"
2985
+ },
2986
+ almostXYears: {
2987
+ one: "almost 1 year",
2988
+ other: "almost {{count}} years"
2989
+ }
2990
+ }, va = (t, e, n) => {
2991
+ let r;
2992
+ const o = ma[t];
2993
+ return typeof o == "string" ? r = o : e === 1 ? r = o.one : r = o.other.replace("{{count}}", e.toString()), n != null && n.addSuffix ? n.comparison && n.comparison > 0 ? "in " + r : r + " ago" : r;
2994
+ };
2995
+ function Ye(t) {
2996
+ return (e = {}) => {
2997
+ const n = e.width ? String(e.width) : t.defaultWidth;
2998
+ return t.formats[n] || t.formats[t.defaultWidth];
2999
+ };
3000
+ }
3001
+ const ya = {
3002
+ full: "EEEE, MMMM do, y",
3003
+ long: "MMMM do, y",
3004
+ medium: "MMM d, y",
3005
+ short: "MM/dd/yyyy"
3006
+ }, ba = {
3007
+ full: "h:mm:ss a zzzz",
3008
+ long: "h:mm:ss a z",
3009
+ medium: "h:mm:ss a",
3010
+ short: "h:mm a"
3011
+ }, pa = {
3012
+ full: "{{date}} 'at' {{time}}",
3013
+ long: "{{date}} 'at' {{time}}",
3014
+ medium: "{{date}}, {{time}}",
3015
+ short: "{{date}}, {{time}}"
3016
+ }, wa = {
3017
+ date: Ye({
3018
+ formats: ya,
3019
+ defaultWidth: "full"
3020
+ }),
3021
+ time: Ye({
3022
+ formats: ba,
3023
+ defaultWidth: "full"
3024
+ }),
3025
+ dateTime: Ye({
3026
+ formats: pa,
3027
+ defaultWidth: "full"
3028
+ })
3029
+ }, Da = {
3030
+ lastWeek: "'last' eeee 'at' p",
3031
+ yesterday: "'yesterday at' p",
3032
+ today: "'today at' p",
3033
+ tomorrow: "'tomorrow at' p",
3034
+ nextWeek: "eeee 'at' p",
3035
+ other: "P"
3036
+ }, Ma = (t, e, n, r) => Da[t];
3037
+ function Qt(t) {
3038
+ return (e, n) => {
3039
+ const r = n != null && n.context ? String(n.context) : "standalone";
3040
+ let o;
3041
+ if (r === "formatting" && t.formattingValues) {
3042
+ const i = t.defaultFormattingWidth || t.defaultWidth, s = n != null && n.width ? String(n.width) : i;
3043
+ o = t.formattingValues[s] || t.formattingValues[i];
3044
+ } else {
3045
+ const i = t.defaultWidth, s = n != null && n.width ? String(n.width) : t.defaultWidth;
3046
+ o = t.values[s] || t.values[i];
3047
+ }
3048
+ const a = t.argumentCallback ? t.argumentCallback(e) : e;
3049
+ return o[a];
3050
+ };
3051
+ }
3052
+ const xa = {
3053
+ narrow: ["B", "A"],
3054
+ abbreviated: ["BC", "AD"],
3055
+ wide: ["Before Christ", "Anno Domini"]
3056
+ }, Sa = {
3057
+ narrow: ["1", "2", "3", "4"],
3058
+ abbreviated: ["Q1", "Q2", "Q3", "Q4"],
3059
+ wide: ["1st quarter", "2nd quarter", "3rd quarter", "4th quarter"]
3060
+ }, Ea = {
3061
+ narrow: ["J", "F", "M", "A", "M", "J", "J", "A", "S", "O", "N", "D"],
3062
+ abbreviated: [
3063
+ "Jan",
3064
+ "Feb",
3065
+ "Mar",
3066
+ "Apr",
3067
+ "May",
3068
+ "Jun",
3069
+ "Jul",
3070
+ "Aug",
3071
+ "Sep",
3072
+ "Oct",
3073
+ "Nov",
3074
+ "Dec"
3075
+ ],
3076
+ wide: [
3077
+ "January",
3078
+ "February",
3079
+ "March",
3080
+ "April",
3081
+ "May",
3082
+ "June",
3083
+ "July",
3084
+ "August",
3085
+ "September",
3086
+ "October",
3087
+ "November",
3088
+ "December"
3089
+ ]
3090
+ }, Oa = {
3091
+ narrow: ["S", "M", "T", "W", "T", "F", "S"],
3092
+ short: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"],
3093
+ abbreviated: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
3094
+ wide: [
3095
+ "Sunday",
3096
+ "Monday",
3097
+ "Tuesday",
3098
+ "Wednesday",
3099
+ "Thursday",
3100
+ "Friday",
3101
+ "Saturday"
3102
+ ]
3103
+ }, Na = {
3104
+ narrow: {
3105
+ am: "a",
3106
+ pm: "p",
3107
+ midnight: "mi",
3108
+ noon: "n",
3109
+ morning: "morning",
3110
+ afternoon: "afternoon",
3111
+ evening: "evening",
3112
+ night: "night"
3113
+ },
3114
+ abbreviated: {
3115
+ am: "AM",
3116
+ pm: "PM",
3117
+ midnight: "midnight",
3118
+ noon: "noon",
3119
+ morning: "morning",
3120
+ afternoon: "afternoon",
3121
+ evening: "evening",
3122
+ night: "night"
3123
+ },
3124
+ wide: {
3125
+ am: "a.m.",
3126
+ pm: "p.m.",
3127
+ midnight: "midnight",
3128
+ noon: "noon",
3129
+ morning: "morning",
3130
+ afternoon: "afternoon",
3131
+ evening: "evening",
3132
+ night: "night"
3133
+ }
3134
+ }, Ca = {
3135
+ narrow: {
3136
+ am: "a",
3137
+ pm: "p",
3138
+ midnight: "mi",
3139
+ noon: "n",
3140
+ morning: "in the morning",
3141
+ afternoon: "in the afternoon",
3142
+ evening: "in the evening",
3143
+ night: "at night"
3144
+ },
3145
+ abbreviated: {
3146
+ am: "AM",
3147
+ pm: "PM",
3148
+ midnight: "midnight",
3149
+ noon: "noon",
3150
+ morning: "in the morning",
3151
+ afternoon: "in the afternoon",
3152
+ evening: "in the evening",
3153
+ night: "at night"
3154
+ },
3155
+ wide: {
3156
+ am: "a.m.",
3157
+ pm: "p.m.",
3158
+ midnight: "midnight",
3159
+ noon: "noon",
3160
+ morning: "in the morning",
3161
+ afternoon: "in the afternoon",
3162
+ evening: "in the evening",
3163
+ night: "at night"
3164
+ }
3165
+ }, ka = (t, e) => {
3166
+ const n = Number(t), r = n % 100;
3167
+ if (r > 20 || r < 10)
3168
+ switch (r % 10) {
3169
+ case 1:
3170
+ return n + "st";
3171
+ case 2:
3172
+ return n + "nd";
3173
+ case 3:
3174
+ return n + "rd";
3175
+ }
3176
+ return n + "th";
3177
+ }, Ta = {
3178
+ ordinalNumber: ka,
3179
+ era: Qt({
3180
+ values: xa,
3181
+ defaultWidth: "wide"
3182
+ }),
3183
+ quarter: Qt({
3184
+ values: Sa,
3185
+ defaultWidth: "wide",
3186
+ argumentCallback: (t) => t - 1
3187
+ }),
3188
+ month: Qt({
3189
+ values: Ea,
3190
+ defaultWidth: "wide"
3191
+ }),
3192
+ day: Qt({
3193
+ values: Oa,
3194
+ defaultWidth: "wide"
3195
+ }),
3196
+ dayPeriod: Qt({
3197
+ values: Na,
3198
+ defaultWidth: "wide",
3199
+ formattingValues: Ca,
3200
+ defaultFormattingWidth: "wide"
3201
+ })
3202
+ };
3203
+ function Jt(t) {
3204
+ return (e, n = {}) => {
3205
+ const r = n.width, o = r && t.matchPatterns[r] || t.matchPatterns[t.defaultMatchWidth], a = e.match(o);
3206
+ if (!a)
3207
+ return null;
3208
+ const i = a[0], s = r && t.parsePatterns[r] || t.parsePatterns[t.defaultParseWidth], c = Array.isArray(s) ? Ra(s, (d) => d.test(i)) : (
3209
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any -- I challange you to fix the type
3210
+ Pa(s, (d) => d.test(i))
3211
+ );
3212
+ let l;
3213
+ l = t.valueCallback ? t.valueCallback(c) : c, l = n.valueCallback ? (
3214
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any -- I challange you to fix the type
3215
+ n.valueCallback(l)
3216
+ ) : l;
3217
+ const u = e.slice(i.length);
3218
+ return { value: l, rest: u };
3219
+ };
3220
+ }
3221
+ function Pa(t, e) {
3222
+ for (const n in t)
3223
+ if (Object.prototype.hasOwnProperty.call(t, n) && e(t[n]))
3224
+ return n;
3225
+ }
3226
+ function Ra(t, e) {
3227
+ for (let n = 0; n < t.length; n++)
3228
+ if (e(t[n]))
3229
+ return n;
3230
+ }
3231
+ function Aa(t) {
3232
+ return (e, n = {}) => {
3233
+ const r = e.match(t.matchPattern);
3234
+ if (!r) return null;
3235
+ const o = r[0], a = e.match(t.parsePattern);
3236
+ if (!a) return null;
3237
+ let i = t.valueCallback ? t.valueCallback(a[0]) : a[0];
3238
+ i = n.valueCallback ? n.valueCallback(i) : i;
3239
+ const s = e.slice(o.length);
3240
+ return { value: i, rest: s };
3241
+ };
3242
+ }
3243
+ const Wa = /^(\d+)(th|st|nd|rd)?/i, La = /\d+/i, Ya = {
3244
+ narrow: /^(b|a)/i,
3245
+ abbreviated: /^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,
3246
+ wide: /^(before christ|before common era|anno domini|common era)/i
3247
+ }, Fa = {
3248
+ any: [/^b/i, /^(a|c)/i]
3249
+ }, Ia = {
3250
+ narrow: /^[1234]/i,
3251
+ abbreviated: /^q[1234]/i,
3252
+ wide: /^[1234](th|st|nd|rd)? quarter/i
3253
+ }, Ba = {
3254
+ any: [/1/i, /2/i, /3/i, /4/i]
3255
+ }, $a = {
3256
+ narrow: /^[jfmasond]/i,
3257
+ abbreviated: /^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,
3258
+ wide: /^(january|february|march|april|may|june|july|august|september|october|november|december)/i
3259
+ }, za = {
3260
+ narrow: [
3261
+ /^j/i,
3262
+ /^f/i,
3263
+ /^m/i,
3264
+ /^a/i,
3265
+ /^m/i,
3266
+ /^j/i,
3267
+ /^j/i,
3268
+ /^a/i,
3269
+ /^s/i,
3270
+ /^o/i,
3271
+ /^n/i,
3272
+ /^d/i
3273
+ ],
3274
+ any: [
3275
+ /^ja/i,
3276
+ /^f/i,
3277
+ /^mar/i,
3278
+ /^ap/i,
3279
+ /^may/i,
3280
+ /^jun/i,
3281
+ /^jul/i,
3282
+ /^au/i,
3283
+ /^s/i,
3284
+ /^o/i,
3285
+ /^n/i,
3286
+ /^d/i
3287
+ ]
3288
+ }, ja = {
3289
+ narrow: /^[smtwf]/i,
3290
+ short: /^(su|mo|tu|we|th|fr|sa)/i,
3291
+ abbreviated: /^(sun|mon|tue|wed|thu|fri|sat)/i,
3292
+ wide: /^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i
3293
+ }, Ha = {
3294
+ narrow: [/^s/i, /^m/i, /^t/i, /^w/i, /^t/i, /^f/i, /^s/i],
3295
+ any: [/^su/i, /^m/i, /^tu/i, /^w/i, /^th/i, /^f/i, /^sa/i]
3296
+ }, Xa = {
3297
+ narrow: /^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,
3298
+ any: /^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i
3299
+ }, qa = {
3300
+ any: {
3301
+ am: /^a/i,
3302
+ pm: /^p/i,
3303
+ midnight: /^mi/i,
3304
+ noon: /^no/i,
3305
+ morning: /morning/i,
3306
+ afternoon: /afternoon/i,
3307
+ evening: /evening/i,
3308
+ night: /night/i
3309
+ }
3310
+ }, _a = {
3311
+ ordinalNumber: Aa({
3312
+ matchPattern: Wa,
3313
+ parsePattern: La,
3314
+ valueCallback: (t) => parseInt(t, 10)
3315
+ }),
3316
+ era: Jt({
3317
+ matchPatterns: Ya,
3318
+ defaultMatchWidth: "wide",
3319
+ parsePatterns: Fa,
3320
+ defaultParseWidth: "any"
3321
+ }),
3322
+ quarter: Jt({
3323
+ matchPatterns: Ia,
3324
+ defaultMatchWidth: "wide",
3325
+ parsePatterns: Ba,
3326
+ defaultParseWidth: "any",
3327
+ valueCallback: (t) => t + 1
3328
+ }),
3329
+ month: Jt({
3330
+ matchPatterns: $a,
3331
+ defaultMatchWidth: "wide",
3332
+ parsePatterns: za,
3333
+ defaultParseWidth: "any"
3334
+ }),
3335
+ day: Jt({
3336
+ matchPatterns: ja,
3337
+ defaultMatchWidth: "wide",
3338
+ parsePatterns: Ha,
3339
+ defaultParseWidth: "any"
3340
+ }),
3341
+ dayPeriod: Jt({
3342
+ matchPatterns: Xa,
3343
+ defaultMatchWidth: "any",
3344
+ parsePatterns: qa,
3345
+ defaultParseWidth: "any"
3346
+ })
3347
+ }, Va = {
3348
+ code: "en-US",
3349
+ formatDistance: va,
3350
+ formatLong: wa,
3351
+ formatRelative: Ma,
3352
+ localize: Ta,
3353
+ match: _a,
3354
+ options: {
3355
+ weekStartsOn: 0,
3356
+ firstWeekContainsDate: 1
3357
+ }
3358
+ };
3359
+ function Ga(t) {
3360
+ const e = P(t);
3361
+ return oa(e, ga(e)) + 1;
3362
+ }
3363
+ function Ka(t) {
3364
+ const e = P(t), n = +Me(e) - +aa(e);
3365
+ return Math.round(n / Zn) + 1;
3366
+ }
3367
+ function or(t, e) {
3368
+ var u, d, f, m;
3369
+ const n = P(t), r = n.getFullYear(), o = le(), a = (e == null ? void 0 : e.firstWeekContainsDate) ?? ((d = (u = e == null ? void 0 : e.locale) == null ? void 0 : u.options) == null ? void 0 : d.firstWeekContainsDate) ?? o.firstWeekContainsDate ?? ((m = (f = o.locale) == null ? void 0 : f.options) == null ? void 0 : m.firstWeekContainsDate) ?? 1, i = st(t, 0);
3370
+ i.setFullYear(r + 1, 0, a), i.setHours(0, 0, 0, 0);
3371
+ const s = Ot(i, e), c = st(t, 0);
3372
+ c.setFullYear(r, 0, a), c.setHours(0, 0, 0, 0);
3373
+ const l = Ot(c, e);
3374
+ return n.getTime() >= s.getTime() ? r + 1 : n.getTime() >= l.getTime() ? r : r - 1;
3375
+ }
3376
+ function Ua(t, e) {
3377
+ var s, c, l, u;
3378
+ const n = le(), r = (e == null ? void 0 : e.firstWeekContainsDate) ?? ((c = (s = e == null ? void 0 : e.locale) == null ? void 0 : s.options) == null ? void 0 : c.firstWeekContainsDate) ?? n.firstWeekContainsDate ?? ((u = (l = n.locale) == null ? void 0 : l.options) == null ? void 0 : u.firstWeekContainsDate) ?? 1, o = or(t, e), a = st(t, 0);
3379
+ return a.setFullYear(o, 0, r), a.setHours(0, 0, 0, 0), Ot(a, e);
3380
+ }
3381
+ function Qa(t, e) {
3382
+ const n = P(t), r = +Ot(n, e) - +Ua(n, e);
3383
+ return Math.round(r / Zn) + 1;
3384
+ }
3385
+ function O(t, e) {
3386
+ const n = t < 0 ? "-" : "", r = Math.abs(t).toString().padStart(e, "0");
3387
+ return n + r;
3388
+ }
3389
+ const St = {
3390
+ // Year
3391
+ y(t, e) {
3392
+ const n = t.getFullYear(), r = n > 0 ? n : 1 - n;
3393
+ return O(e === "yy" ? r % 100 : r, e.length);
3394
+ },
3395
+ // Month
3396
+ M(t, e) {
3397
+ const n = t.getMonth();
3398
+ return e === "M" ? String(n + 1) : O(n + 1, 2);
3399
+ },
3400
+ // Day of the month
3401
+ d(t, e) {
3402
+ return O(t.getDate(), e.length);
3403
+ },
3404
+ // AM or PM
3405
+ a(t, e) {
3406
+ const n = t.getHours() / 12 >= 1 ? "pm" : "am";
3407
+ switch (e) {
3408
+ case "a":
3409
+ case "aa":
3410
+ return n.toUpperCase();
3411
+ case "aaa":
3412
+ return n;
3413
+ case "aaaaa":
3414
+ return n[0];
3415
+ case "aaaa":
3416
+ default:
3417
+ return n === "am" ? "a.m." : "p.m.";
3418
+ }
3419
+ },
3420
+ // Hour [1-12]
3421
+ h(t, e) {
3422
+ return O(t.getHours() % 12 || 12, e.length);
3423
+ },
3424
+ // Hour [0-23]
3425
+ H(t, e) {
3426
+ return O(t.getHours(), e.length);
3427
+ },
3428
+ // Minute
3429
+ m(t, e) {
3430
+ return O(t.getMinutes(), e.length);
3431
+ },
3432
+ // Second
3433
+ s(t, e) {
3434
+ return O(t.getSeconds(), e.length);
3435
+ },
3436
+ // Fraction of second
3437
+ S(t, e) {
3438
+ const n = e.length, r = t.getMilliseconds(), o = Math.trunc(
3439
+ r * Math.pow(10, n - 3)
3440
+ );
3441
+ return O(o, e.length);
3442
+ }
3443
+ }, $t = {
3444
+ midnight: "midnight",
3445
+ noon: "noon",
3446
+ morning: "morning",
3447
+ afternoon: "afternoon",
3448
+ evening: "evening",
3449
+ night: "night"
3450
+ }, Dn = {
3451
+ // Era
3452
+ G: function(t, e, n) {
3453
+ const r = t.getFullYear() > 0 ? 1 : 0;
3454
+ switch (e) {
3455
+ case "G":
3456
+ case "GG":
3457
+ case "GGG":
3458
+ return n.era(r, { width: "abbreviated" });
3459
+ case "GGGGG":
3460
+ return n.era(r, { width: "narrow" });
3461
+ case "GGGG":
3462
+ default:
3463
+ return n.era(r, { width: "wide" });
3464
+ }
3465
+ },
3466
+ // Year
3467
+ y: function(t, e, n) {
3468
+ if (e === "yo") {
3469
+ const r = t.getFullYear(), o = r > 0 ? r : 1 - r;
3470
+ return n.ordinalNumber(o, { unit: "year" });
3471
+ }
3472
+ return St.y(t, e);
3473
+ },
3474
+ // Local week-numbering year
3475
+ Y: function(t, e, n, r) {
3476
+ const o = or(t, r), a = o > 0 ? o : 1 - o;
3477
+ if (e === "YY") {
3478
+ const i = a % 100;
3479
+ return O(i, 2);
3480
+ }
3481
+ return e === "Yo" ? n.ordinalNumber(a, { unit: "year" }) : O(a, e.length);
3482
+ },
3483
+ // ISO week-numbering year
3484
+ R: function(t, e) {
3485
+ const n = er(t);
3486
+ return O(n, e.length);
3487
+ },
3488
+ // Extended year. This is a single number designating the year of this calendar system.
3489
+ // The main difference between `y` and `u` localizers are B.C. years:
3490
+ // | Year | `y` | `u` |
3491
+ // |------|-----|-----|
3492
+ // | AC 1 | 1 | 1 |
3493
+ // | BC 1 | 1 | 0 |
3494
+ // | BC 2 | 2 | -1 |
3495
+ // Also `yy` always returns the last two digits of a year,
3496
+ // while `uu` pads single digit years to 2 characters and returns other years unchanged.
3497
+ u: function(t, e) {
3498
+ const n = t.getFullYear();
3499
+ return O(n, e.length);
3500
+ },
3501
+ // Quarter
3502
+ Q: function(t, e, n) {
3503
+ const r = Math.ceil((t.getMonth() + 1) / 3);
3504
+ switch (e) {
3505
+ case "Q":
3506
+ return String(r);
3507
+ case "QQ":
3508
+ return O(r, 2);
3509
+ case "Qo":
3510
+ return n.ordinalNumber(r, { unit: "quarter" });
3511
+ case "QQQ":
3512
+ return n.quarter(r, {
3513
+ width: "abbreviated",
3514
+ context: "formatting"
3515
+ });
3516
+ case "QQQQQ":
3517
+ return n.quarter(r, {
3518
+ width: "narrow",
3519
+ context: "formatting"
3520
+ });
3521
+ case "QQQQ":
3522
+ default:
3523
+ return n.quarter(r, {
3524
+ width: "wide",
3525
+ context: "formatting"
3526
+ });
3527
+ }
3528
+ },
3529
+ // Stand-alone quarter
3530
+ q: function(t, e, n) {
3531
+ const r = Math.ceil((t.getMonth() + 1) / 3);
3532
+ switch (e) {
3533
+ case "q":
3534
+ return String(r);
3535
+ case "qq":
3536
+ return O(r, 2);
3537
+ case "qo":
3538
+ return n.ordinalNumber(r, { unit: "quarter" });
3539
+ case "qqq":
3540
+ return n.quarter(r, {
3541
+ width: "abbreviated",
3542
+ context: "standalone"
3543
+ });
3544
+ case "qqqqq":
3545
+ return n.quarter(r, {
3546
+ width: "narrow",
3547
+ context: "standalone"
3548
+ });
3549
+ case "qqqq":
3550
+ default:
3551
+ return n.quarter(r, {
3552
+ width: "wide",
3553
+ context: "standalone"
3554
+ });
3555
+ }
3556
+ },
3557
+ // Month
3558
+ M: function(t, e, n) {
3559
+ const r = t.getMonth();
3560
+ switch (e) {
3561
+ case "M":
3562
+ case "MM":
3563
+ return St.M(t, e);
3564
+ case "Mo":
3565
+ return n.ordinalNumber(r + 1, { unit: "month" });
3566
+ case "MMM":
3567
+ return n.month(r, {
3568
+ width: "abbreviated",
3569
+ context: "formatting"
3570
+ });
3571
+ case "MMMMM":
3572
+ return n.month(r, {
3573
+ width: "narrow",
3574
+ context: "formatting"
3575
+ });
3576
+ case "MMMM":
3577
+ default:
3578
+ return n.month(r, { width: "wide", context: "formatting" });
3579
+ }
3580
+ },
3581
+ // Stand-alone month
3582
+ L: function(t, e, n) {
3583
+ const r = t.getMonth();
3584
+ switch (e) {
3585
+ case "L":
3586
+ return String(r + 1);
3587
+ case "LL":
3588
+ return O(r + 1, 2);
3589
+ case "Lo":
3590
+ return n.ordinalNumber(r + 1, { unit: "month" });
3591
+ case "LLL":
3592
+ return n.month(r, {
3593
+ width: "abbreviated",
3594
+ context: "standalone"
3595
+ });
3596
+ case "LLLLL":
3597
+ return n.month(r, {
3598
+ width: "narrow",
3599
+ context: "standalone"
3600
+ });
3601
+ case "LLLL":
3602
+ default:
3603
+ return n.month(r, { width: "wide", context: "standalone" });
3604
+ }
3605
+ },
3606
+ // Local week of year
3607
+ w: function(t, e, n, r) {
3608
+ const o = Qa(t, r);
3609
+ return e === "wo" ? n.ordinalNumber(o, { unit: "week" }) : O(o, e.length);
3610
+ },
3611
+ // ISO week of year
3612
+ I: function(t, e, n) {
3613
+ const r = Ka(t);
3614
+ return e === "Io" ? n.ordinalNumber(r, { unit: "week" }) : O(r, e.length);
3615
+ },
3616
+ // Day of the month
3617
+ d: function(t, e, n) {
3618
+ return e === "do" ? n.ordinalNumber(t.getDate(), { unit: "date" }) : St.d(t, e);
3619
+ },
3620
+ // Day of year
3621
+ D: function(t, e, n) {
3622
+ const r = Ga(t);
3623
+ return e === "Do" ? n.ordinalNumber(r, { unit: "dayOfYear" }) : O(r, e.length);
3624
+ },
3625
+ // Day of week
3626
+ E: function(t, e, n) {
3627
+ const r = t.getDay();
3628
+ switch (e) {
3629
+ case "E":
3630
+ case "EE":
3631
+ case "EEE":
3632
+ return n.day(r, {
3633
+ width: "abbreviated",
3634
+ context: "formatting"
3635
+ });
3636
+ case "EEEEE":
3637
+ return n.day(r, {
3638
+ width: "narrow",
3639
+ context: "formatting"
3640
+ });
3641
+ case "EEEEEE":
3642
+ return n.day(r, {
3643
+ width: "short",
3644
+ context: "formatting"
3645
+ });
3646
+ case "EEEE":
3647
+ default:
3648
+ return n.day(r, {
3649
+ width: "wide",
3650
+ context: "formatting"
3651
+ });
3652
+ }
3653
+ },
3654
+ // Local day of week
3655
+ e: function(t, e, n, r) {
3656
+ const o = t.getDay(), a = (o - r.weekStartsOn + 8) % 7 || 7;
3657
+ switch (e) {
3658
+ case "e":
3659
+ return String(a);
3660
+ case "ee":
3661
+ return O(a, 2);
3662
+ case "eo":
3663
+ return n.ordinalNumber(a, { unit: "day" });
3664
+ case "eee":
3665
+ return n.day(o, {
3666
+ width: "abbreviated",
3667
+ context: "formatting"
3668
+ });
3669
+ case "eeeee":
3670
+ return n.day(o, {
3671
+ width: "narrow",
3672
+ context: "formatting"
3673
+ });
3674
+ case "eeeeee":
3675
+ return n.day(o, {
3676
+ width: "short",
3677
+ context: "formatting"
3678
+ });
3679
+ case "eeee":
3680
+ default:
3681
+ return n.day(o, {
3682
+ width: "wide",
3683
+ context: "formatting"
3684
+ });
3685
+ }
3686
+ },
3687
+ // Stand-alone local day of week
3688
+ c: function(t, e, n, r) {
3689
+ const o = t.getDay(), a = (o - r.weekStartsOn + 8) % 7 || 7;
3690
+ switch (e) {
3691
+ case "c":
3692
+ return String(a);
3693
+ case "cc":
3694
+ return O(a, e.length);
3695
+ case "co":
3696
+ return n.ordinalNumber(a, { unit: "day" });
3697
+ case "ccc":
3698
+ return n.day(o, {
3699
+ width: "abbreviated",
3700
+ context: "standalone"
3701
+ });
3702
+ case "ccccc":
3703
+ return n.day(o, {
3704
+ width: "narrow",
3705
+ context: "standalone"
3706
+ });
3707
+ case "cccccc":
3708
+ return n.day(o, {
3709
+ width: "short",
3710
+ context: "standalone"
3711
+ });
3712
+ case "cccc":
3713
+ default:
3714
+ return n.day(o, {
3715
+ width: "wide",
3716
+ context: "standalone"
3717
+ });
3718
+ }
3719
+ },
3720
+ // ISO day of week
3721
+ i: function(t, e, n) {
3722
+ const r = t.getDay(), o = r === 0 ? 7 : r;
3723
+ switch (e) {
3724
+ case "i":
3725
+ return String(o);
3726
+ case "ii":
3727
+ return O(o, e.length);
3728
+ case "io":
3729
+ return n.ordinalNumber(o, { unit: "day" });
3730
+ case "iii":
3731
+ return n.day(r, {
3732
+ width: "abbreviated",
3733
+ context: "formatting"
3734
+ });
3735
+ case "iiiii":
3736
+ return n.day(r, {
3737
+ width: "narrow",
3738
+ context: "formatting"
3739
+ });
3740
+ case "iiiiii":
3741
+ return n.day(r, {
3742
+ width: "short",
3743
+ context: "formatting"
3744
+ });
3745
+ case "iiii":
3746
+ default:
3747
+ return n.day(r, {
3748
+ width: "wide",
3749
+ context: "formatting"
3750
+ });
3751
+ }
3752
+ },
3753
+ // AM or PM
3754
+ a: function(t, e, n) {
3755
+ const o = t.getHours() / 12 >= 1 ? "pm" : "am";
3756
+ switch (e) {
3757
+ case "a":
3758
+ case "aa":
3759
+ return n.dayPeriod(o, {
3760
+ width: "abbreviated",
3761
+ context: "formatting"
3762
+ });
3763
+ case "aaa":
3764
+ return n.dayPeriod(o, {
3765
+ width: "abbreviated",
3766
+ context: "formatting"
3767
+ }).toLowerCase();
3768
+ case "aaaaa":
3769
+ return n.dayPeriod(o, {
3770
+ width: "narrow",
3771
+ context: "formatting"
3772
+ });
3773
+ case "aaaa":
3774
+ default:
3775
+ return n.dayPeriod(o, {
3776
+ width: "wide",
3777
+ context: "formatting"
3778
+ });
3779
+ }
3780
+ },
3781
+ // AM, PM, midnight, noon
3782
+ b: function(t, e, n) {
3783
+ const r = t.getHours();
3784
+ let o;
3785
+ switch (r === 12 ? o = $t.noon : r === 0 ? o = $t.midnight : o = r / 12 >= 1 ? "pm" : "am", e) {
3786
+ case "b":
3787
+ case "bb":
3788
+ return n.dayPeriod(o, {
3789
+ width: "abbreviated",
3790
+ context: "formatting"
3791
+ });
3792
+ case "bbb":
3793
+ return n.dayPeriod(o, {
3794
+ width: "abbreviated",
3795
+ context: "formatting"
3796
+ }).toLowerCase();
3797
+ case "bbbbb":
3798
+ return n.dayPeriod(o, {
3799
+ width: "narrow",
3800
+ context: "formatting"
3801
+ });
3802
+ case "bbbb":
3803
+ default:
3804
+ return n.dayPeriod(o, {
3805
+ width: "wide",
3806
+ context: "formatting"
3807
+ });
3808
+ }
3809
+ },
3810
+ // in the morning, in the afternoon, in the evening, at night
3811
+ B: function(t, e, n) {
3812
+ const r = t.getHours();
3813
+ let o;
3814
+ switch (r >= 17 ? o = $t.evening : r >= 12 ? o = $t.afternoon : r >= 4 ? o = $t.morning : o = $t.night, e) {
3815
+ case "B":
3816
+ case "BB":
3817
+ case "BBB":
3818
+ return n.dayPeriod(o, {
3819
+ width: "abbreviated",
3820
+ context: "formatting"
3821
+ });
3822
+ case "BBBBB":
3823
+ return n.dayPeriod(o, {
3824
+ width: "narrow",
3825
+ context: "formatting"
3826
+ });
3827
+ case "BBBB":
3828
+ default:
3829
+ return n.dayPeriod(o, {
3830
+ width: "wide",
3831
+ context: "formatting"
3832
+ });
3833
+ }
3834
+ },
3835
+ // Hour [1-12]
3836
+ h: function(t, e, n) {
3837
+ if (e === "ho") {
3838
+ let r = t.getHours() % 12;
3839
+ return r === 0 && (r = 12), n.ordinalNumber(r, { unit: "hour" });
3840
+ }
3841
+ return St.h(t, e);
3842
+ },
3843
+ // Hour [0-23]
3844
+ H: function(t, e, n) {
3845
+ return e === "Ho" ? n.ordinalNumber(t.getHours(), { unit: "hour" }) : St.H(t, e);
3846
+ },
3847
+ // Hour [0-11]
3848
+ K: function(t, e, n) {
3849
+ const r = t.getHours() % 12;
3850
+ return e === "Ko" ? n.ordinalNumber(r, { unit: "hour" }) : O(r, e.length);
3851
+ },
3852
+ // Hour [1-24]
3853
+ k: function(t, e, n) {
3854
+ let r = t.getHours();
3855
+ return r === 0 && (r = 24), e === "ko" ? n.ordinalNumber(r, { unit: "hour" }) : O(r, e.length);
3856
+ },
3857
+ // Minute
3858
+ m: function(t, e, n) {
3859
+ return e === "mo" ? n.ordinalNumber(t.getMinutes(), { unit: "minute" }) : St.m(t, e);
3860
+ },
3861
+ // Second
3862
+ s: function(t, e, n) {
3863
+ return e === "so" ? n.ordinalNumber(t.getSeconds(), { unit: "second" }) : St.s(t, e);
3864
+ },
3865
+ // Fraction of second
3866
+ S: function(t, e) {
3867
+ return St.S(t, e);
3868
+ },
3869
+ // Timezone (ISO-8601. If offset is 0, output is always `'Z'`)
3870
+ X: function(t, e, n) {
3871
+ const r = t.getTimezoneOffset();
3872
+ if (r === 0)
3873
+ return "Z";
3874
+ switch (e) {
3875
+ case "X":
3876
+ return xn(r);
3877
+ case "XXXX":
3878
+ case "XX":
3879
+ return Nt(r);
3880
+ case "XXXXX":
3881
+ case "XXX":
3882
+ default:
3883
+ return Nt(r, ":");
3884
+ }
3885
+ },
3886
+ // Timezone (ISO-8601. If offset is 0, output is `'+00:00'` or equivalent)
3887
+ x: function(t, e, n) {
3888
+ const r = t.getTimezoneOffset();
3889
+ switch (e) {
3890
+ case "x":
3891
+ return xn(r);
3892
+ case "xxxx":
3893
+ case "xx":
3894
+ return Nt(r);
3895
+ case "xxxxx":
3896
+ case "xxx":
3897
+ default:
3898
+ return Nt(r, ":");
3899
+ }
3900
+ },
3901
+ // Timezone (GMT)
3902
+ O: function(t, e, n) {
3903
+ const r = t.getTimezoneOffset();
3904
+ switch (e) {
3905
+ case "O":
3906
+ case "OO":
3907
+ case "OOO":
3908
+ return "GMT" + Mn(r, ":");
3909
+ case "OOOO":
3910
+ default:
3911
+ return "GMT" + Nt(r, ":");
3912
+ }
3913
+ },
3914
+ // Timezone (specific non-location)
3915
+ z: function(t, e, n) {
3916
+ const r = t.getTimezoneOffset();
3917
+ switch (e) {
3918
+ case "z":
3919
+ case "zz":
3920
+ case "zzz":
3921
+ return "GMT" + Mn(r, ":");
3922
+ case "zzzz":
3923
+ default:
3924
+ return "GMT" + Nt(r, ":");
3925
+ }
3926
+ },
3927
+ // Seconds timestamp
3928
+ t: function(t, e, n) {
3929
+ const r = Math.trunc(t.getTime() / 1e3);
3930
+ return O(r, e.length);
3931
+ },
3932
+ // Milliseconds timestamp
3933
+ T: function(t, e, n) {
3934
+ const r = t.getTime();
3935
+ return O(r, e.length);
3936
+ }
3937
+ };
3938
+ function Mn(t, e = "") {
3939
+ const n = t > 0 ? "-" : "+", r = Math.abs(t), o = Math.trunc(r / 60), a = r % 60;
3940
+ return a === 0 ? n + String(o) : n + String(o) + e + O(a, 2);
3941
+ }
3942
+ function xn(t, e) {
3943
+ return t % 60 === 0 ? (t > 0 ? "-" : "+") + O(Math.abs(t) / 60, 2) : Nt(t, e);
3944
+ }
3945
+ function Nt(t, e = "") {
3946
+ const n = t > 0 ? "-" : "+", r = Math.abs(t), o = O(Math.trunc(r / 60), 2), a = O(r % 60, 2);
3947
+ return n + o + e + a;
3948
+ }
3949
+ const Sn = (t, e) => {
3950
+ switch (t) {
3951
+ case "P":
3952
+ return e.date({ width: "short" });
3953
+ case "PP":
3954
+ return e.date({ width: "medium" });
3955
+ case "PPP":
3956
+ return e.date({ width: "long" });
3957
+ case "PPPP":
3958
+ default:
3959
+ return e.date({ width: "full" });
3960
+ }
3961
+ }, ar = (t, e) => {
3962
+ switch (t) {
3963
+ case "p":
3964
+ return e.time({ width: "short" });
3965
+ case "pp":
3966
+ return e.time({ width: "medium" });
3967
+ case "ppp":
3968
+ return e.time({ width: "long" });
3969
+ case "pppp":
3970
+ default:
3971
+ return e.time({ width: "full" });
3972
+ }
3973
+ }, Ja = (t, e) => {
3974
+ const n = t.match(/(P+)(p+)?/) || [], r = n[1], o = n[2];
3975
+ if (!o)
3976
+ return Sn(t, e);
3977
+ let a;
3978
+ switch (r) {
3979
+ case "P":
3980
+ a = e.dateTime({ width: "short" });
3981
+ break;
3982
+ case "PP":
3983
+ a = e.dateTime({ width: "medium" });
3984
+ break;
3985
+ case "PPP":
3986
+ a = e.dateTime({ width: "long" });
3987
+ break;
3988
+ case "PPPP":
3989
+ default:
3990
+ a = e.dateTime({ width: "full" });
3991
+ break;
3992
+ }
3993
+ return a.replace("{{date}}", Sn(r, e)).replace("{{time}}", ar(o, e));
3994
+ }, Za = {
3995
+ p: ar,
3996
+ P: Ja
3997
+ }, ti = /^D+$/, ei = /^Y+$/, ni = ["D", "DD", "YY", "YYYY"];
3998
+ function ri(t) {
3999
+ return ti.test(t);
4000
+ }
4001
+ function oi(t) {
4002
+ return ei.test(t);
4003
+ }
4004
+ function ai(t, e, n) {
4005
+ const r = ii(t, e, n);
4006
+ if (console.warn(r), ni.includes(t)) throw new RangeError(r);
4007
+ }
4008
+ function ii(t, e, n) {
4009
+ const r = t[0] === "Y" ? "years" : "days of the month";
4010
+ return `Use \`${t.toLowerCase()}\` instead of \`${t}\` (in \`${e}\`) for formatting ${r} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`;
4011
+ }
4012
+ const si = /[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g, ci = /P+p+|P+|p+|''|'(''|[^'])+('|$)|./g, li = /^'([^]*?)'?$/, ui = /''/g, di = /[a-zA-Z]/;
4013
+ function z(t, e, n) {
4014
+ var u, d, f, m;
4015
+ const r = le(), o = r.locale ?? Va, a = r.firstWeekContainsDate ?? ((d = (u = r.locale) == null ? void 0 : u.options) == null ? void 0 : d.firstWeekContainsDate) ?? 1, i = r.weekStartsOn ?? ((m = (f = r.locale) == null ? void 0 : f.options) == null ? void 0 : m.weekStartsOn) ?? 0, s = P(t);
4016
+ if (!la(s))
4017
+ throw new RangeError("Invalid time value");
4018
+ let c = e.match(ci).map((y) => {
4019
+ const g = y[0];
4020
+ if (g === "p" || g === "P") {
4021
+ const h = Za[g];
4022
+ return h(y, o.formatLong);
4023
+ }
4024
+ return y;
4025
+ }).join("").match(si).map((y) => {
4026
+ if (y === "''")
4027
+ return { isToken: !1, value: "'" };
4028
+ const g = y[0];
4029
+ if (g === "'")
4030
+ return { isToken: !1, value: fi(y) };
4031
+ if (Dn[g])
4032
+ return { isToken: !0, value: y };
4033
+ if (g.match(di))
4034
+ throw new RangeError(
4035
+ "Format string contains an unescaped latin alphabet character `" + g + "`"
4036
+ );
4037
+ return { isToken: !1, value: y };
4038
+ });
4039
+ o.localize.preprocessor && (c = o.localize.preprocessor(s, c));
4040
+ const l = {
4041
+ firstWeekContainsDate: a,
4042
+ weekStartsOn: i,
4043
+ locale: o
4044
+ };
4045
+ return c.map((y) => {
4046
+ if (!y.isToken) return y.value;
4047
+ const g = y.value;
4048
+ (oi(g) || ri(g)) && ai(g, e, String(t));
4049
+ const h = Dn[g[0]];
4050
+ return h(s, g, o.localize, l);
4051
+ }).join("");
4052
+ }
4053
+ function fi(t) {
4054
+ const e = t.match(li);
4055
+ return e ? e[1].replace(ui, "'") : t;
4056
+ }
4057
+ function hi(t) {
4058
+ return P(t).getHours();
4059
+ }
4060
+ function gi(t) {
4061
+ return P(t).getMinutes();
4062
+ }
4063
+ function mi(t, e) {
4064
+ const n = P(t), r = P(e);
4065
+ return n.getFullYear() === r.getFullYear() && n.getMonth() === r.getMonth();
4066
+ }
4067
+ function ze(t) {
4068
+ return sa(t, ia(t));
4069
+ }
4070
+ function vi(t, e) {
4071
+ return Ct(t, -1);
4072
+ }
4073
+ function yi(t, e) {
4074
+ return Jn(t, -1);
4075
+ }
4076
+ function bi(t, e) {
4077
+ return nr(t, -1);
4078
+ }
4079
+ function pi(t) {
4080
+ const e = Ot(t, { weekStartsOn: 0 }), n = Qe(t, { weekStartsOn: 0 });
4081
+ return rr({ start: e, end: n });
4082
+ }
4083
+ function wi(t) {
4084
+ const e = Ot(ha(t), { weekStartsOn: 0 }), n = Qe(fa(t), { weekStartsOn: 0 });
4085
+ return rr({ start: e, end: n });
4086
+ }
4087
+ function Di(t, e) {
4088
+ switch (e) {
4089
+ case "day":
4090
+ return z(t, "EEEE, MMMM d, yyyy");
4091
+ case "week": {
4092
+ const n = Ot(t, { weekStartsOn: 0 }), r = Qe(t, { weekStartsOn: 0 });
4093
+ return z(n, "MMMM yyyy") === z(r, "MMMM yyyy") ? `${z(n, "MMMM d")} – ${z(r, "d, yyyy")}` : `${z(n, "MMM d")} – ${z(r, "MMM d, yyyy")}`;
4094
+ }
4095
+ case "month":
4096
+ return z(t, "MMMM yyyy");
4097
+ }
4098
+ }
4099
+ function En(t) {
4100
+ return t === 0 ? "12 AM" : t < 12 ? `${t} AM` : t === 12 ? "12 PM" : `${t - 12} PM`;
4101
+ }
4102
+ function ge(t) {
4103
+ return z(t, "h:mm a");
4104
+ }
4105
+ function Mi(t, e) {
4106
+ const n = /* @__PURE__ */ new Date(), r = (e - t) * 60, o = hi(n) * 60 + gi(n) - t * 60;
4107
+ return Math.max(0, Math.min(1, o / r));
4108
+ }
4109
+ function je(t, e = 15) {
4110
+ return Math.round(t / e) * e;
4111
+ }
4112
+ function On(t, e, n) {
4113
+ switch (e) {
4114
+ case "day":
4115
+ return n === 1 ? Ct(t, 1) : vi(t);
4116
+ case "week":
4117
+ return n === 1 ? nr(t, 1) : bi(t);
4118
+ case "month":
4119
+ return n === 1 ? Jn(t, 1) : yi(t);
4120
+ }
4121
+ }
4122
+ function xi(t, e, n, r) {
4123
+ const o = t / n * 60, a = r * 60 + o, i = Math.floor(a / 60), s = Math.floor(a % 60), c = Pt(e);
4124
+ return c.setHours(i, s, 0, 0), c;
4125
+ }
4126
+ function Si(t, e) {
4127
+ return (e - t) * 60;
4128
+ }
4129
+ function Nn(t, e) {
4130
+ return $e(t, Pt(t)) - e * 60;
4131
+ }
4132
+ const Ei = [
4133
+ { key: "day", label: "Day" },
4134
+ { key: "week", label: "Week" },
4135
+ { key: "month", label: "Month" }
4136
+ ], Oi = ({ view: t, date: e, onViewChange: n, onDateChange: r }) => /* @__PURE__ */ L("header", { className: "rss-header", role: "toolbar", "aria-label": "Calendar navigation", children: [
4137
+ /* @__PURE__ */ L("div", { className: "rss-header-nav", children: [
4138
+ /* @__PURE__ */ b(
4139
+ "button",
4140
+ {
4141
+ className: "rss-btn rss-btn--icon",
4142
+ onClick: () => r(On(e, t, -1)),
4143
+ "aria-label": "Previous",
4144
+ title: "Previous",
4145
+ children: "‹"
4146
+ }
4147
+ ),
4148
+ /* @__PURE__ */ b("button", { className: "rss-btn", onClick: () => r(/* @__PURE__ */ new Date()), "aria-label": "Go to today", children: "Today" }),
4149
+ /* @__PURE__ */ b(
4150
+ "button",
4151
+ {
4152
+ className: "rss-btn rss-btn--icon",
4153
+ onClick: () => r(On(e, t, 1)),
4154
+ "aria-label": "Next",
4155
+ title: "Next",
4156
+ children: "›"
4157
+ }
4158
+ )
4159
+ ] }),
4160
+ /* @__PURE__ */ b("h2", { className: "rss-header-title", "aria-live": "polite", children: Di(e, t) }),
4161
+ /* @__PURE__ */ b("div", { className: "rss-view-switcher", role: "group", "aria-label": "View", children: Ei.map(({ key: s, label: c }) => /* @__PURE__ */ b(
4162
+ "button",
4163
+ {
4164
+ className: `rss-view-btn ${t === s ? "rss-view-btn--active" : ""}`,
4165
+ onClick: () => n(s),
4166
+ "aria-pressed": t === s,
4167
+ children: c
4168
+ },
4169
+ s
4170
+ )) })
4171
+ ] });
4172
+ function ir(t, e) {
4173
+ return t.filter((n) => {
4174
+ const r = Pt(e), o = new Date(r.getTime() + 24 * 60 * 60 * 1e3);
4175
+ return n.start < o && n.end > r;
4176
+ });
4177
+ }
4178
+ function Ni(t, e, n) {
4179
+ if (t.length === 0) return [];
4180
+ const r = Si(e, n), o = [...t].sort((s, c) => {
4181
+ const l = s.start.getTime() - c.start.getTime();
4182
+ return l !== 0 ? l : $e(c.end, c.start) - $e(s.end, s.start);
4183
+ }), a = [];
4184
+ for (const s of o) {
4185
+ let c = !1;
4186
+ for (const l of a)
4187
+ if (l.some((d) => Ci(d, s))) {
4188
+ l.push(s), c = !0;
4189
+ break;
4190
+ }
4191
+ c || a.push([s]);
4192
+ }
4193
+ const i = [];
4194
+ for (const s of a) {
4195
+ const c = [];
4196
+ for (const u of s) {
4197
+ let d = -1;
4198
+ for (let f = 0; f < c.length; f++) {
4199
+ const m = c[f], y = m[m.length - 1];
4200
+ if (!y || y.end <= u.start) {
4201
+ d = f;
4202
+ break;
4203
+ }
4204
+ }
4205
+ d === -1 && (d = c.length, c.push([])), c[d].push(u);
4206
+ }
4207
+ const l = c.length;
4208
+ c.forEach((u, d) => {
4209
+ u.forEach((f) => {
4210
+ const m = Math.max(0, Nn(f.start, e)), y = Math.min(r, Nn(f.end, e)), g = Math.max(15, y - m);
4211
+ i.push({
4212
+ ...f,
4213
+ topPercent: m / r * 100,
4214
+ heightPercent: g / r * 100,
4215
+ leftPercent: d / l * 100,
4216
+ widthPercent: 1 / l * 100
4217
+ });
4218
+ });
4219
+ });
4220
+ }
4221
+ return i;
4222
+ }
4223
+ function Ci(t, e) {
4224
+ return t.start < e.end && t.end > e.start;
4225
+ }
4226
+ function qi() {
4227
+ return `evt-${Date.now()}-${Math.random().toString(36).slice(2, 7)}`;
4228
+ }
4229
+ const xe = [
4230
+ "#3b82f6",
4231
+ // blue
4232
+ "#10b981",
4233
+ // emerald
4234
+ "#f59e0b",
4235
+ // amber
4236
+ "#ef4444",
4237
+ // red
4238
+ "#8b5cf6",
4239
+ // violet
4240
+ "#06b6d4",
4241
+ // cyan
4242
+ "#f97316",
4243
+ // orange
4244
+ "#84cc16"
4245
+ // lime
4246
+ ];
4247
+ function Je(t) {
4248
+ let e = 0;
4249
+ for (let n = 0; n < t.length; n++)
4250
+ e = e * 31 + t.charCodeAt(n) | 0;
4251
+ return xe[Math.abs(e) % xe.length];
4252
+ }
4253
+ function Cn(t) {
4254
+ return z(t, "yyyy-MM-dd'T'HH:mm");
4255
+ }
4256
+ function kn(t) {
4257
+ return new Date(t);
4258
+ }
4259
+ const ki = ({
4260
+ event: t,
4261
+ initialStart: e,
4262
+ initialEnd: n,
4263
+ onSave: r,
4264
+ onDelete: o,
4265
+ onClose: a
4266
+ }) => {
4267
+ const i = t !== null, s = C(null), [c, l] = W((t == null ? void 0 : t.title) ?? ""), [u, d] = W(
4268
+ Cn((t == null ? void 0 : t.start) ?? e ?? /* @__PURE__ */ new Date())
4269
+ ), [f, m] = W(
4270
+ Cn((t == null ? void 0 : t.end) ?? n ?? new Date(Date.now() + 60 * 60 * 1e3))
4271
+ ), [y, g] = W((t == null ? void 0 : t.color) ?? xe[0]);
4272
+ return A(() => {
4273
+ var v;
4274
+ (v = s.current) == null || v.focus();
4275
+ }, []), A(() => {
4276
+ const v = (D) => {
4277
+ D.key === "Escape" && a();
4278
+ };
4279
+ return window.addEventListener("keydown", v), () => window.removeEventListener("keydown", v);
4280
+ }, [a]), // Backdrop — click outside to close
4281
+ /* @__PURE__ */ b(
4282
+ "div",
4283
+ {
4284
+ className: "rss-modal-backdrop",
4285
+ role: "dialog",
4286
+ "aria-modal": "true",
4287
+ "aria-label": i ? "Edit event" : "New event",
4288
+ onMouseDown: (v) => {
4289
+ v.target === v.currentTarget && a();
4290
+ },
4291
+ children: /* @__PURE__ */ L("div", { className: "rss-modal", children: [
4292
+ /* @__PURE__ */ b("h3", { className: "rss-modal-title", children: i ? "Edit Event" : "New Event" }),
4293
+ /* @__PURE__ */ L("form", { onSubmit: (v) => {
4294
+ v.preventDefault(), c.trim() && r({
4295
+ title: c.trim(),
4296
+ start: kn(u),
4297
+ end: kn(f),
4298
+ color: y
4299
+ });
4300
+ }, style: { display: "contents" }, children: [
4301
+ /* @__PURE__ */ L("div", { className: "rss-form-group", children: [
4302
+ /* @__PURE__ */ b("label", { className: "rss-label", htmlFor: "rss-event-title", children: "Title" }),
4303
+ /* @__PURE__ */ b(
4304
+ "input",
4305
+ {
4306
+ id: "rss-event-title",
4307
+ ref: s,
4308
+ className: "rss-input",
4309
+ type: "text",
4310
+ placeholder: "Event title",
4311
+ value: c,
4312
+ onChange: (v) => l(v.target.value),
4313
+ required: !0,
4314
+ maxLength: 100
4315
+ }
4316
+ )
4317
+ ] }),
4318
+ /* @__PURE__ */ L("div", { className: "rss-form-row", children: [
4319
+ /* @__PURE__ */ L("div", { className: "rss-form-group", children: [
4320
+ /* @__PURE__ */ b("label", { className: "rss-label", htmlFor: "rss-event-start", children: "Start" }),
4321
+ /* @__PURE__ */ b(
4322
+ "input",
4323
+ {
4324
+ id: "rss-event-start",
4325
+ className: "rss-input",
4326
+ type: "datetime-local",
4327
+ value: u,
4328
+ onChange: (v) => d(v.target.value),
4329
+ required: !0
4330
+ }
4331
+ )
4332
+ ] }),
4333
+ /* @__PURE__ */ L("div", { className: "rss-form-group", children: [
4334
+ /* @__PURE__ */ b("label", { className: "rss-label", htmlFor: "rss-event-end", children: "End" }),
4335
+ /* @__PURE__ */ b(
4336
+ "input",
4337
+ {
4338
+ id: "rss-event-end",
4339
+ className: "rss-input",
4340
+ type: "datetime-local",
4341
+ value: f,
4342
+ min: u,
4343
+ onChange: (v) => m(v.target.value),
4344
+ required: !0
4345
+ }
4346
+ )
4347
+ ] })
4348
+ ] }),
4349
+ /* @__PURE__ */ L("div", { className: "rss-form-group", children: [
4350
+ /* @__PURE__ */ b("span", { className: "rss-label", children: "Color" }),
4351
+ /* @__PURE__ */ b("div", { className: "rss-color-row", role: "radiogroup", "aria-label": "Event color", children: xe.map((v) => /* @__PURE__ */ b(
4352
+ "button",
4353
+ {
4354
+ type: "button",
4355
+ role: "radio",
4356
+ "aria-checked": v === y,
4357
+ "aria-label": `Color ${v}`,
4358
+ className: `rss-color-swatch ${v === y ? "rss-color-swatch--selected" : ""}`,
4359
+ style: { background: v },
4360
+ onClick: () => g(v)
4361
+ },
4362
+ v
4363
+ )) })
4364
+ ] }),
4365
+ /* @__PURE__ */ L("div", { className: "rss-modal-actions", children: [
4366
+ i && o && /* @__PURE__ */ b("div", { className: "rss-modal-actions-left", children: /* @__PURE__ */ b(
4367
+ "button",
4368
+ {
4369
+ type: "button",
4370
+ className: "rss-btn rss-btn--danger",
4371
+ onClick: o,
4372
+ children: "Delete"
4373
+ }
4374
+ ) }),
4375
+ /* @__PURE__ */ b("button", { type: "button", className: "rss-btn", onClick: a, children: "Cancel" }),
4376
+ /* @__PURE__ */ b("button", { type: "submit", className: "rss-btn rss-btn--primary", children: i ? "Save" : "Create" })
4377
+ ] })
4378
+ ] })
4379
+ ] })
4380
+ }
4381
+ );
4382
+ }, Ti = ({
4383
+ event: t,
4384
+ hourHeight: e,
4385
+ gridHeight: n,
4386
+ onClick: r,
4387
+ onResizeEnd: o,
4388
+ isOverlay: a = !1
4389
+ }) => {
4390
+ const i = t.color ?? Je(t.id), s = { type: "event", event: t }, { attributes: c, listeners: l, setNodeRef: u, transform: d, isDragging: f } = Un({
4391
+ id: t.id,
4392
+ data: s,
4393
+ // Disable dragging while the user is resizing (handled separately)
4394
+ disabled: a
4395
+ }), [m, y] = W(null), g = C(!1), h = m ?? t.end, v = I(
4396
+ (p) => {
4397
+ if (f) return;
4398
+ p.preventDefault(), p.stopPropagation();
4399
+ const M = p.currentTarget;
4400
+ M.setPointerCapture(p.pointerId);
4401
+ const x = p.clientY, S = t.end;
4402
+ g.current = !0;
4403
+ const k = (T) => {
4404
+ const H = T.clientY - x, G = je(H / e * 60), $ = zt(S, G), ft = zt(t.start, 15);
4405
+ y($ > ft ? $ : ft);
4406
+ }, Y = (T) => {
4407
+ const H = T.clientY - x, G = je(H / e * 60), $ = zt(S, G), ft = zt(t.start, 15), Rt = $ > ft ? $ : ft;
4408
+ o(t.id, Rt), y(null), g.current = !1, M.removeEventListener("pointermove", k), M.removeEventListener("pointerup", Y);
4409
+ };
4410
+ M.addEventListener("pointermove", k), M.addEventListener("pointerup", Y);
4411
+ },
4412
+ [t, e, f, o]
4413
+ ), D = n / e * 60;
4414
+ let w = t.heightPercent;
4415
+ if (m) {
4416
+ const p = t.start.getHours() * 60 + t.start.getMinutes(), M = h.getHours() * 60 + h.getMinutes();
4417
+ w = Math.max(15, M - p) / D * 100;
4418
+ }
4419
+ const E = {
4420
+ top: `${t.topPercent}%`,
4421
+ height: `${w}%`,
4422
+ left: `calc(${t.leftPercent}% + 2px)`,
4423
+ width: `calc(${t.widthPercent}% - 4px)`,
4424
+ background: i,
4425
+ // Apply dnd-kit's drag transform (identity when not dragging)
4426
+ transform: Tt.Translate.toString(d),
4427
+ // Overlap: events at higher column indices sit slightly higher
4428
+ zIndex: a ? 100 : f ? 50 : 1
4429
+ };
4430
+ return /* @__PURE__ */ L(
4431
+ "div",
4432
+ {
4433
+ ref: u,
4434
+ className: [
4435
+ "rss-event",
4436
+ f ? "rss-event--dragging" : "",
4437
+ g.current ? "rss-event--resizing" : "",
4438
+ a ? "rss-event--overlay" : ""
4439
+ ].filter(Boolean).join(" "),
4440
+ style: E,
4441
+ ...l,
4442
+ ...c,
4443
+ role: "button",
4444
+ tabIndex: 0,
4445
+ "aria-label": `${t.title}, ${ge(t.start)} to ${ge(h)}`,
4446
+ onClick: (p) => {
4447
+ f || (p.stopPropagation(), r(t));
4448
+ },
4449
+ onKeyDown: (p) => {
4450
+ (p.key === "Enter" || p.key === " ") && (p.preventDefault(), r(t)), (p.key === "Delete" || p.key === "Backspace") && r(t);
4451
+ },
4452
+ children: [
4453
+ /* @__PURE__ */ b("div", { className: "rss-event-title", children: t.title }),
4454
+ /* @__PURE__ */ L("div", { className: "rss-event-time", children: [
4455
+ ge(t.start),
4456
+ " – ",
4457
+ ge(h)
4458
+ ] }),
4459
+ !a && /* @__PURE__ */ b(
4460
+ "div",
4461
+ {
4462
+ className: "rss-event-resize-handle",
4463
+ "aria-hidden": "true",
4464
+ onPointerDown: v,
4465
+ onClick: (p) => p.stopPropagation()
4466
+ }
4467
+ )
4468
+ ]
4469
+ }
4470
+ );
4471
+ };
4472
+ Array.from({ length: 24 }, (t, e) => e);
4473
+ const Pi = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], sr = ({
4474
+ columns: t,
4475
+ events: e,
4476
+ hourHeight: n,
4477
+ startHour: r,
4478
+ endHour: o,
4479
+ onColumnWidthChange: a,
4480
+ onEventClick: i,
4481
+ onEventResizeEnd: s,
4482
+ onSlotClick: c
4483
+ }) => {
4484
+ const l = Array.from(
4485
+ { length: o - r },
4486
+ (h, v) => r + v
4487
+ ), u = l.length * n, d = C(null);
4488
+ A(() => {
4489
+ if (!d.current || !a) return;
4490
+ const h = d.current, v = () => {
4491
+ const w = t.length || 1;
4492
+ a(h.offsetWidth / w);
4493
+ };
4494
+ v();
4495
+ const D = new ResizeObserver(v);
4496
+ return D.observe(h), () => D.disconnect();
4497
+ }, [t.length, a]);
4498
+ const m = Mi(r, o) * u, { setNodeRef: y } = Qn({ id: "timegrid-body" }), g = (h, v) => {
4499
+ if (h.target.closest(".rss-event")) return;
4500
+ const w = h.currentTarget.getBoundingClientRect(), E = h.clientY - w.top, p = xi(E, v.date, n, r), M = new Date(p.getTime() + 60 * 60 * 1e3);
4501
+ c(p, M);
4502
+ };
4503
+ return /* @__PURE__ */ L("div", { className: "rss-timegrid", children: [
4504
+ /* @__PURE__ */ L("div", { className: "rss-timegrid-allday", "aria-hidden": "true", children: [
4505
+ /* @__PURE__ */ b("div", { className: "rss-timegrid-allday-gutter" }),
4506
+ /* @__PURE__ */ b("div", { className: "rss-day-headers", children: t.map((h) => {
4507
+ const v = ze(h.date);
4508
+ return /* @__PURE__ */ L("div", { className: "rss-day-header", children: [
4509
+ /* @__PURE__ */ b("span", { className: "rss-day-header-weekday", children: Pi[h.date.getDay()] }),
4510
+ /* @__PURE__ */ b(
4511
+ "span",
4512
+ {
4513
+ className: `rss-day-header-num ${v ? "rss-day-header-num--today" : ""}`,
4514
+ children: z(h.date, "d")
4515
+ }
4516
+ )
4517
+ ] }, h.key);
4518
+ }) })
4519
+ ] }),
4520
+ /* @__PURE__ */ b("div", { className: "rss-timegrid-scroll", children: /* @__PURE__ */ L(
4521
+ "div",
4522
+ {
4523
+ className: "rss-timegrid-body",
4524
+ ref: y,
4525
+ style: { height: u },
4526
+ children: [
4527
+ /* @__PURE__ */ b("div", { className: "rss-time-gutter", "aria-hidden": "true", children: l.map((h) => /* @__PURE__ */ b(
4528
+ "div",
4529
+ {
4530
+ className: "rss-time-label",
4531
+ style: { height: n, lineHeight: `${n}px` },
4532
+ children: h === r ? "" : En(h)
4533
+ },
4534
+ h
4535
+ )) }),
4536
+ /* @__PURE__ */ b("div", { className: "rss-columns", ref: d, style: { height: u }, children: t.map((h) => {
4537
+ const v = ir(e, h.date), D = Ni(v, r, o), w = ze(h.date);
4538
+ return /* @__PURE__ */ L(
4539
+ "div",
4540
+ {
4541
+ className: `rss-column ${w ? "rss-column--today" : ""}`,
4542
+ style: { height: u },
4543
+ role: "grid",
4544
+ "aria-label": z(h.date, "EEEE, MMMM d"),
4545
+ onClick: (E) => g(E, h),
4546
+ children: [
4547
+ l.map((E) => /* @__PURE__ */ b(
4548
+ "div",
4549
+ {
4550
+ className: "rss-hour-cell",
4551
+ style: { height: n },
4552
+ "aria-label": `${En(E)} on ${z(h.date, "MMMM d")}`
4553
+ },
4554
+ E
4555
+ )),
4556
+ D.map((E) => /* @__PURE__ */ b(
4557
+ Ti,
4558
+ {
4559
+ event: E,
4560
+ hourHeight: n,
4561
+ gridHeight: u,
4562
+ onClick: i,
4563
+ onResizeEnd: s
4564
+ },
4565
+ E.id
4566
+ )),
4567
+ w && /* @__PURE__ */ b(
4568
+ "div",
4569
+ {
4570
+ className: "rss-now-line",
4571
+ style: { top: m },
4572
+ "aria-hidden": "true",
4573
+ "aria-label": "Current time"
4574
+ }
4575
+ )
4576
+ ]
4577
+ },
4578
+ h.key
4579
+ );
4580
+ }) })
4581
+ ]
4582
+ }
4583
+ ) })
4584
+ ] });
4585
+ }, Ri = ({
4586
+ date: t,
4587
+ events: e,
4588
+ hourHeight: n,
4589
+ startHour: r,
4590
+ endHour: o,
4591
+ onEventClick: a,
4592
+ onEventResizeEnd: i,
4593
+ onSlotClick: s,
4594
+ onColumnWidthChange: c
4595
+ }) => {
4596
+ const l = [{ date: t, key: t.toDateString() }];
4597
+ return /* @__PURE__ */ b(
4598
+ sr,
4599
+ {
4600
+ columns: l,
4601
+ events: e,
4602
+ hourHeight: n,
4603
+ startHour: r,
4604
+ endHour: o,
4605
+ onEventClick: a,
4606
+ onEventResizeEnd: i,
4607
+ onSlotClick: s,
4608
+ onColumnWidthChange: c
4609
+ }
4610
+ );
4611
+ }, Ai = ({
4612
+ date: t,
4613
+ events: e,
4614
+ hourHeight: n,
4615
+ startHour: r,
4616
+ endHour: o,
4617
+ onEventClick: a,
4618
+ onEventResizeEnd: i,
4619
+ onSlotClick: s,
4620
+ onColumnWidthChange: c
4621
+ }) => {
4622
+ const u = pi(t).map((d) => ({
4623
+ date: d,
4624
+ key: z(d, "yyyy-MM-dd")
4625
+ }));
4626
+ return /* @__PURE__ */ b(
4627
+ sr,
4628
+ {
4629
+ columns: u,
4630
+ events: e,
4631
+ hourHeight: n,
4632
+ startHour: r,
4633
+ endHour: o,
4634
+ onEventClick: a,
4635
+ onEventResizeEnd: i,
4636
+ onSlotClick: s,
4637
+ onColumnWidthChange: c
4638
+ }
4639
+ );
4640
+ }, Wi = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], Tn = 3, Li = ({ event: t, onClick: e }) => {
4641
+ const n = { type: "event", event: t }, { attributes: r, listeners: o, setNodeRef: a, transform: i, isDragging: s } = Un({
4642
+ id: `month-${t.id}`,
4643
+ data: n
4644
+ }), c = t.color ?? Je(t.id);
4645
+ return /* @__PURE__ */ b(
4646
+ "div",
4647
+ {
4648
+ ref: a,
4649
+ className: "rss-month-event",
4650
+ style: {
4651
+ background: c,
4652
+ opacity: s ? 0.4 : 1,
4653
+ transform: Tt.Translate.toString(i),
4654
+ cursor: "grab"
4655
+ },
4656
+ ...o,
4657
+ ...r,
4658
+ role: "button",
4659
+ tabIndex: 0,
4660
+ "aria-label": t.title,
4661
+ onClick: (l) => {
4662
+ l.stopPropagation(), e(t);
4663
+ },
4664
+ onKeyDown: (l) => {
4665
+ (l.key === "Enter" || l.key === " ") && (l.preventDefault(), e(t));
4666
+ },
4667
+ children: t.title
4668
+ }
4669
+ );
4670
+ }, Yi = ({
4671
+ day: t,
4672
+ currentMonth: e,
4673
+ events: n,
4674
+ onEventClick: r,
4675
+ onSlotClick: o
4676
+ }) => {
4677
+ const a = ze(t), i = !mi(t, e), { setNodeRef: s, isOver: c } = Qn({
4678
+ id: `month-cell-${z(t, "yyyy-MM-dd")}`,
4679
+ data: { date: t }
4680
+ }), l = n.slice(0, Tn), u = n.length - Tn, d = () => {
4681
+ const f = new Date(t);
4682
+ f.setHours(9, 0, 0, 0);
4683
+ const m = new Date(t);
4684
+ m.setHours(10, 0, 0, 0), o(f, m);
4685
+ };
4686
+ return /* @__PURE__ */ L(
4687
+ "div",
4688
+ {
4689
+ ref: s,
4690
+ className: [
4691
+ "rss-month-cell",
4692
+ a ? "rss-month-cell--today" : "",
4693
+ i ? "rss-month-cell--other-month" : "",
4694
+ c ? "rss-month-cell--drop-over" : ""
4695
+ ].filter(Boolean).join(" "),
4696
+ style: c ? { background: "rgb(59 130 246 / 0.08)" } : void 0,
4697
+ onClick: d,
4698
+ role: "gridcell",
4699
+ "aria-label": z(t, "MMMM d, yyyy"),
4700
+ children: [
4701
+ /* @__PURE__ */ b(
4702
+ "span",
4703
+ {
4704
+ className: [
4705
+ "rss-month-day-num",
4706
+ a ? "rss-month-day-num--today" : "",
4707
+ i ? "rss-month-day-num--other" : ""
4708
+ ].filter(Boolean).join(" "),
4709
+ children: z(t, "d")
4710
+ }
4711
+ ),
4712
+ l.map((f) => /* @__PURE__ */ b(Li, { event: f, onClick: r }, f.id)),
4713
+ u > 0 && /* @__PURE__ */ L("span", { className: "rss-month-more", "aria-label": `${u} more events`, children: [
4714
+ "+",
4715
+ u,
4716
+ " more"
4717
+ ] })
4718
+ ]
4719
+ }
4720
+ );
4721
+ }, Fi = ({
4722
+ date: t,
4723
+ events: e,
4724
+ onEventClick: n,
4725
+ onSlotClick: r
4726
+ }) => {
4727
+ const o = wi(t);
4728
+ return /* @__PURE__ */ L("div", { className: "rss-month", role: "grid", "aria-label": z(t, "MMMM yyyy"), children: [
4729
+ /* @__PURE__ */ b("div", { className: "rss-month-weekdays", role: "row", "aria-hidden": "true", children: Wi.map((a) => /* @__PURE__ */ b("div", { className: "rss-month-weekday", role: "columnheader", children: a }, a)) }),
4730
+ /* @__PURE__ */ b("div", { className: "rss-month-grid", children: o.map((a) => {
4731
+ const i = ir(e, a);
4732
+ return /* @__PURE__ */ b(
4733
+ Yi,
4734
+ {
4735
+ day: a,
4736
+ currentMonth: t,
4737
+ events: i,
4738
+ onEventClick: n,
4739
+ onSlotClick: r
4740
+ },
4741
+ z(a, "yyyy-MM-dd")
4742
+ );
4743
+ }) })
4744
+ ] });
4745
+ };
4746
+ function Ii(t) {
4747
+ const { onEventAdd: e, onEventChange: n, onEventDelete: r } = t, [o, a] = W(!1), [i, s] = W(null), [c, l] = W(null), u = I((g) => {
4748
+ s(g), l(null), a(!0);
4749
+ }, []), d = I((g) => {
4750
+ s(null), l(g), a(!0);
4751
+ }, []), f = I(() => {
4752
+ a(!1), s(null), l(null);
4753
+ }, []), m = I(
4754
+ (g) => {
4755
+ i ? n == null || n({ ...i, ...g }) : e == null || e(g), f();
4756
+ },
4757
+ [i, n, e, f]
4758
+ ), y = I(() => {
4759
+ i && (r == null || r(i.id)), f();
4760
+ }, [i, r, f]);
4761
+ return {
4762
+ isModalOpen: o,
4763
+ editingEvent: i,
4764
+ pendingSlot: c,
4765
+ openEditModal: u,
4766
+ openAddModal: d,
4767
+ closeModal: f,
4768
+ handleModalSave: m,
4769
+ handleModalDelete: y
4770
+ };
4771
+ }
4772
+ const Bi = 64, $i = 0, zi = 24, _i = ({
4773
+ events: t,
4774
+ view: e = "week",
4775
+ date: n,
4776
+ onEventAdd: r,
4777
+ onEventChange: o,
4778
+ onEventDelete: a,
4779
+ onViewChange: i,
4780
+ onDateChange: s,
4781
+ hourHeight: c = Bi,
4782
+ startHour: l = $i,
4783
+ endHour: u = zi,
4784
+ className: d = ""
4785
+ }) => {
4786
+ const [f, m] = W(e), [y, g] = W(n ?? /* @__PURE__ */ new Date()), h = n !== void 0 ? e : f, v = n ?? y, D = (R) => {
4787
+ m(R), i == null || i(R);
4788
+ }, w = (R) => {
4789
+ g(R), s == null || s(R);
4790
+ }, {
4791
+ isModalOpen: E,
4792
+ editingEvent: p,
4793
+ pendingSlot: M,
4794
+ openEditModal: x,
4795
+ openAddModal: S,
4796
+ closeModal: k,
4797
+ handleModalSave: Y,
4798
+ handleModalDelete: T
4799
+ } = Ii({ onEventAdd: r, onEventChange: o, onEventDelete: a }), [H, G] = W(null), $ = C({ hourHeight: c, columnWidth: 0 });
4800
+ $.current.hourHeight = c;
4801
+ const ft = Yr(
4802
+ Lr(Ke, {
4803
+ // Require a 6 px move before drag starts, so clicks still fire.
4804
+ activationConstraint: { distance: 6 }
4805
+ })
4806
+ ), Rt = (R) => {
4807
+ const X = R.active.data.current;
4808
+ (X == null ? void 0 : X.type) === "event" && G(X.event);
4809
+ }, ct = (R) => {
4810
+ var Q, _t;
4811
+ const { delta: X } = R, lt = R.active.data.current;
4812
+ if (G(null), !lt || lt.type !== "event") return;
4813
+ const rt = lt.event;
4814
+ if (h === "day" || h === "week") {
4815
+ const ut = je(X.y / $.current.hourHeight * 60);
4816
+ let vt = 0;
4817
+ if (h === "week" && $.current.columnWidth > 0 && (vt = Math.round(X.x / $.current.columnWidth)), ut === 0 && vt === 0) return;
4818
+ const _ = zt(Ct(rt.start, vt), ut), ht = zt(Ct(rt.end, vt), ut), ot = l * 60, Wt = u * 60, J = _.getHours() * 60 + _.getMinutes(), Lt = ht.getHours() * 60 + ht.getMinutes();
4819
+ if (J < ot || Lt > Wt) return;
4820
+ o == null || o({ ...rt, start: _, end: ht });
4821
+ return;
4822
+ }
4823
+ if (h === "month") {
4824
+ const ut = R.over;
4825
+ if (!((_t = (Q = ut == null ? void 0 : ut.data) == null ? void 0 : Q.current) != null && _t.date)) return;
4826
+ const vt = ut.data.current.date, _ = new Date(rt.start), ht = new Date(_);
4827
+ ht.setHours(0, 0, 0, 0);
4828
+ const ot = new Date(vt);
4829
+ ot.setHours(0, 0, 0, 0);
4830
+ const Wt = ot.getTime() - ht.getTime(), J = Math.round(Wt / (24 * 60 * 60 * 1e3));
4831
+ if (J === 0) return;
4832
+ o == null || o({
4833
+ ...rt,
4834
+ start: Ct(rt.start, J),
4835
+ end: Ct(rt.end, J)
4836
+ });
4837
+ }
4838
+ }, ue = (R, X) => {
4839
+ const lt = t.find((rt) => rt.id === R);
4840
+ lt && (o == null || o({ ...lt, end: X }));
4841
+ }, nt = H ? {
4842
+ ...H,
4843
+ color: H.color ?? Je(H.id),
4844
+ topPercent: 0,
4845
+ heightPercent: 0,
4846
+ leftPercent: 0,
4847
+ widthPercent: 100
4848
+ } : null, At = (R, X) => S({ start: R, end: X }), qt = {
4849
+ events: t,
4850
+ hourHeight: c,
4851
+ startHour: l,
4852
+ endHour: u,
4853
+ onEventClick: x,
4854
+ onEventResizeEnd: ue,
4855
+ onSlotClick: At,
4856
+ onColumnWidthChange: (R) => {
4857
+ $.current.columnWidth = R;
4858
+ }
4859
+ };
4860
+ return /* @__PURE__ */ L("div", { className: `rss-root ${d}`.trim(), children: [
4861
+ /* @__PURE__ */ L(
4862
+ Wo,
4863
+ {
4864
+ sensors: ft,
4865
+ modifiers: [ta],
4866
+ onDragStart: Rt,
4867
+ onDragEnd: ct,
4868
+ children: [
4869
+ /* @__PURE__ */ b(
4870
+ Oi,
4871
+ {
4872
+ view: h,
4873
+ date: v,
4874
+ onViewChange: D,
4875
+ onDateChange: w
4876
+ }
4877
+ ),
4878
+ h === "day" && /* @__PURE__ */ b(Ri, { date: v, ...qt }),
4879
+ h === "week" && /* @__PURE__ */ b(Ai, { date: v, ...qt }),
4880
+ h === "month" && /* @__PURE__ */ b(
4881
+ Fi,
4882
+ {
4883
+ date: v,
4884
+ events: t,
4885
+ onEventClick: x,
4886
+ onSlotClick: At
4887
+ }
4888
+ ),
4889
+ nt && /* @__PURE__ */ b(Jo, { children: /* @__PURE__ */ b(
4890
+ "div",
4891
+ {
4892
+ className: "rss-drag-overlay",
4893
+ style: {
4894
+ // Give the overlay a fixed height so it looks natural
4895
+ height: c * 1.5,
4896
+ width: h === "day" ? "100%" : 120
4897
+ },
4898
+ children: /* @__PURE__ */ L(
4899
+ "div",
4900
+ {
4901
+ className: "rss-event",
4902
+ style: {
4903
+ position: "relative",
4904
+ height: "100%",
4905
+ background: nt.color,
4906
+ opacity: 0.9,
4907
+ top: 0,
4908
+ left: 0,
4909
+ width: "100%",
4910
+ boxShadow: "0 8px 24px rgb(0 0 0 / 0.2)"
4911
+ },
4912
+ children: [
4913
+ /* @__PURE__ */ b("div", { className: "rss-event-title", children: nt.title }),
4914
+ /* @__PURE__ */ b("div", { className: "rss-event-time", children: z(nt.start, "h:mm a") })
4915
+ ]
4916
+ }
4917
+ )
4918
+ }
4919
+ ) })
4920
+ ]
4921
+ }
4922
+ ),
4923
+ E && /* @__PURE__ */ b(
4924
+ ki,
4925
+ {
4926
+ event: p,
4927
+ initialStart: M == null ? void 0 : M.start,
4928
+ initialEnd: M == null ? void 0 : M.end,
4929
+ onSave: Y,
4930
+ onDelete: p ? T : void 0,
4931
+ onClose: k
4932
+ }
4933
+ )
4934
+ ] });
4935
+ }, Vi = "0.1.0";
4936
+ export {
4937
+ xe as EVENT_COLORS,
4938
+ _i as Scheduler,
4939
+ Vi as VERSION,
4940
+ qi as generateId,
4941
+ Je as pickColor
4942
+ };
4943
+ //# sourceMappingURL=index.es.js.map