@object-ui/plugin-kanban 0.3.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,3335 @@
1
+ import { j as L } from "./index-i_5clVsp.js";
2
+ import * as ye from "react";
3
+ import j, { useLayoutEffect as zn, useEffect as T, useRef as M, useMemo as A, useCallback as $, useState as X, memo as Bn, useReducer as Fn, createContext as Ke, useContext as pe, forwardRef as $n, cloneElement as Xn } from "react";
4
+ import { unstable_batchedUpdates as et, createPortal as Yn } from "react-dom";
5
+ import { Badge as en, ScrollArea as Kn, Card as Wn, CardHeader as Hn, CardTitle as Un, CardDescription as Vn, CardContent as qn } from "@object-ui/components";
6
+ function Gn() {
7
+ for (var e = arguments.length, t = new Array(e), n = 0; n < e; n++)
8
+ t[n] = arguments[n];
9
+ return A(
10
+ () => (r) => {
11
+ t.forEach((o) => o(r));
12
+ },
13
+ // eslint-disable-next-line react-hooks/exhaustive-deps
14
+ t
15
+ );
16
+ }
17
+ const dt = typeof window < "u" && typeof window.document < "u" && typeof window.document.createElement < "u";
18
+ function Ne(e) {
19
+ const t = Object.prototype.toString.call(e);
20
+ return t === "[object Window]" || // In Electron context the Window object serializes to [object global]
21
+ t === "[object global]";
22
+ }
23
+ function Rt(e) {
24
+ return "nodeType" in e;
25
+ }
26
+ function Y(e) {
27
+ var t, n;
28
+ return e ? Ne(e) ? e : Rt(e) && (t = (n = e.ownerDocument) == null ? void 0 : n.defaultView) != null ? t : window : window;
29
+ }
30
+ function Et(e) {
31
+ const {
32
+ Document: t
33
+ } = Y(e);
34
+ return e instanceof t;
35
+ }
36
+ function We(e) {
37
+ return Ne(e) ? !1 : e instanceof Y(e).HTMLElement;
38
+ }
39
+ function tn(e) {
40
+ return e instanceof Y(e).SVGElement;
41
+ }
42
+ function Ie(e) {
43
+ return e ? Ne(e) ? e.document : Rt(e) ? Et(e) ? e : We(e) || tn(e) ? e.ownerDocument : document : document : document;
44
+ }
45
+ const Q = dt ? zn : T;
46
+ function ut(e) {
47
+ const t = M(e);
48
+ return Q(() => {
49
+ t.current = e;
50
+ }), $(function() {
51
+ for (var n = arguments.length, r = new Array(n), o = 0; o < n; o++)
52
+ r[o] = arguments[o];
53
+ return t.current == null ? void 0 : t.current(...r);
54
+ }, []);
55
+ }
56
+ function Jn() {
57
+ const e = M(null), t = $((r, o) => {
58
+ e.current = setInterval(r, o);
59
+ }, []), n = $(() => {
60
+ e.current !== null && (clearInterval(e.current), e.current = null);
61
+ }, []);
62
+ return [t, n];
63
+ }
64
+ function Xe(e, t) {
65
+ t === void 0 && (t = [e]);
66
+ const n = M(e);
67
+ return Q(() => {
68
+ n.current !== e && (n.current = e);
69
+ }, t), n;
70
+ }
71
+ function He(e, t) {
72
+ const n = M();
73
+ return A(
74
+ () => {
75
+ const r = e(n.current);
76
+ return n.current = r, r;
77
+ },
78
+ // eslint-disable-next-line react-hooks/exhaustive-deps
79
+ [...t]
80
+ );
81
+ }
82
+ function ot(e) {
83
+ const t = ut(e), n = M(null), r = $(
84
+ (o) => {
85
+ o !== n.current && t?.(o, n.current), n.current = o;
86
+ },
87
+ //eslint-disable-next-line
88
+ []
89
+ );
90
+ return [n, r];
91
+ }
92
+ function it(e) {
93
+ const t = M();
94
+ return T(() => {
95
+ t.current = e;
96
+ }, [e]), t.current;
97
+ }
98
+ let mt = {};
99
+ function Ue(e, t) {
100
+ return A(() => {
101
+ if (t)
102
+ return t;
103
+ const n = mt[e] == null ? 0 : mt[e] + 1;
104
+ return mt[e] = n, e + "-" + n;
105
+ }, [e, t]);
106
+ }
107
+ function nn(e) {
108
+ return function(t) {
109
+ for (var n = arguments.length, r = new Array(n > 1 ? n - 1 : 0), o = 1; o < n; o++)
110
+ r[o - 1] = arguments[o];
111
+ return r.reduce((i, s) => {
112
+ const a = Object.entries(s);
113
+ for (const [l, c] of a) {
114
+ const d = i[l];
115
+ d != null && (i[l] = d + e * c);
116
+ }
117
+ return i;
118
+ }, {
119
+ ...t
120
+ });
121
+ };
122
+ }
123
+ const Ee = /* @__PURE__ */ nn(1), st = /* @__PURE__ */ nn(-1);
124
+ function _n(e) {
125
+ return "clientX" in e && "clientY" in e;
126
+ }
127
+ function ft(e) {
128
+ if (!e)
129
+ return !1;
130
+ const {
131
+ KeyboardEvent: t
132
+ } = Y(e.target);
133
+ return t && e instanceof t;
134
+ }
135
+ function Qn(e) {
136
+ if (!e)
137
+ return !1;
138
+ const {
139
+ TouchEvent: t
140
+ } = Y(e.target);
141
+ return t && e instanceof t;
142
+ }
143
+ function at(e) {
144
+ if (Qn(e)) {
145
+ if (e.touches && e.touches.length) {
146
+ const {
147
+ clientX: t,
148
+ clientY: n
149
+ } = e.touches[0];
150
+ return {
151
+ x: t,
152
+ y: n
153
+ };
154
+ } else if (e.changedTouches && e.changedTouches.length) {
155
+ const {
156
+ clientX: t,
157
+ clientY: n
158
+ } = e.changedTouches[0];
159
+ return {
160
+ x: t,
161
+ y: n
162
+ };
163
+ }
164
+ }
165
+ return _n(e) ? {
166
+ x: e.clientX,
167
+ y: e.clientY
168
+ } : null;
169
+ }
170
+ const be = /* @__PURE__ */ Object.freeze({
171
+ Translate: {
172
+ toString(e) {
173
+ if (!e)
174
+ return;
175
+ const {
176
+ x: t,
177
+ y: n
178
+ } = e;
179
+ return "translate3d(" + (t ? Math.round(t) : 0) + "px, " + (n ? Math.round(n) : 0) + "px, 0)";
180
+ }
181
+ },
182
+ Scale: {
183
+ toString(e) {
184
+ if (!e)
185
+ return;
186
+ const {
187
+ scaleX: t,
188
+ scaleY: n
189
+ } = e;
190
+ return "scaleX(" + t + ") scaleY(" + n + ")";
191
+ }
192
+ },
193
+ Transform: {
194
+ toString(e) {
195
+ if (e)
196
+ return [be.Translate.toString(e), be.Scale.toString(e)].join(" ");
197
+ }
198
+ },
199
+ Transition: {
200
+ toString(e) {
201
+ let {
202
+ property: t,
203
+ duration: n,
204
+ easing: r
205
+ } = e;
206
+ return t + " " + n + "ms " + r;
207
+ }
208
+ }
209
+ }), Xt = "a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";
210
+ function Zn(e) {
211
+ return e.matches(Xt) ? e : e.querySelector(Xt);
212
+ }
213
+ const er = {
214
+ display: "none"
215
+ };
216
+ function tr(e) {
217
+ let {
218
+ id: t,
219
+ value: n
220
+ } = e;
221
+ return j.createElement("div", {
222
+ id: t,
223
+ style: er
224
+ }, n);
225
+ }
226
+ function nr(e) {
227
+ let {
228
+ id: t,
229
+ announcement: n,
230
+ ariaLiveType: r = "assertive"
231
+ } = e;
232
+ const o = {
233
+ position: "fixed",
234
+ top: 0,
235
+ left: 0,
236
+ width: 1,
237
+ height: 1,
238
+ margin: -1,
239
+ border: 0,
240
+ padding: 0,
241
+ overflow: "hidden",
242
+ clip: "rect(0 0 0 0)",
243
+ clipPath: "inset(100%)",
244
+ whiteSpace: "nowrap"
245
+ };
246
+ return j.createElement("div", {
247
+ id: t,
248
+ style: o,
249
+ role: "status",
250
+ "aria-live": r,
251
+ "aria-atomic": !0
252
+ }, n);
253
+ }
254
+ function rr() {
255
+ const [e, t] = X("");
256
+ return {
257
+ announce: $((r) => {
258
+ r != null && t(r);
259
+ }, []),
260
+ announcement: e
261
+ };
262
+ }
263
+ const rn = /* @__PURE__ */ Ke(null);
264
+ function or(e) {
265
+ const t = pe(rn);
266
+ T(() => {
267
+ if (!t)
268
+ throw new Error("useDndMonitor must be used within a children of <DndContext>");
269
+ return t(e);
270
+ }, [e, t]);
271
+ }
272
+ function ir() {
273
+ const [e] = X(() => /* @__PURE__ */ new Set()), t = $((r) => (e.add(r), () => e.delete(r)), [e]);
274
+ return [$((r) => {
275
+ let {
276
+ type: o,
277
+ event: i
278
+ } = r;
279
+ e.forEach((s) => {
280
+ var a;
281
+ return (a = s[o]) == null ? void 0 : a.call(s, i);
282
+ });
283
+ }, [e]), t];
284
+ }
285
+ const sr = {
286
+ draggable: `
287
+ To pick up a draggable item, press the space bar.
288
+ While dragging, use the arrow keys to move the item.
289
+ Press space again to drop the item in its new position, or press escape to cancel.
290
+ `
291
+ }, ar = {
292
+ onDragStart(e) {
293
+ let {
294
+ active: t
295
+ } = e;
296
+ return "Picked up draggable item " + t.id + ".";
297
+ },
298
+ onDragOver(e) {
299
+ let {
300
+ active: t,
301
+ over: n
302
+ } = e;
303
+ return n ? "Draggable item " + t.id + " was moved over droppable area " + n.id + "." : "Draggable item " + t.id + " is no longer over a droppable area.";
304
+ },
305
+ onDragEnd(e) {
306
+ let {
307
+ active: t,
308
+ over: n
309
+ } = e;
310
+ return n ? "Draggable item " + t.id + " was dropped over droppable area " + n.id : "Draggable item " + t.id + " was dropped.";
311
+ },
312
+ onDragCancel(e) {
313
+ let {
314
+ active: t
315
+ } = e;
316
+ return "Dragging was cancelled. Draggable item " + t.id + " was dropped.";
317
+ }
318
+ };
319
+ function lr(e) {
320
+ let {
321
+ announcements: t = ar,
322
+ container: n,
323
+ hiddenTextDescribedById: r,
324
+ screenReaderInstructions: o = sr
325
+ } = e;
326
+ const {
327
+ announce: i,
328
+ announcement: s
329
+ } = rr(), a = Ue("DndLiveRegion"), [l, c] = X(!1);
330
+ if (T(() => {
331
+ c(!0);
332
+ }, []), or(A(() => ({
333
+ onDragStart(u) {
334
+ let {
335
+ active: h
336
+ } = u;
337
+ i(t.onDragStart({
338
+ active: h
339
+ }));
340
+ },
341
+ onDragMove(u) {
342
+ let {
343
+ active: h,
344
+ over: f
345
+ } = u;
346
+ t.onDragMove && i(t.onDragMove({
347
+ active: h,
348
+ over: f
349
+ }));
350
+ },
351
+ onDragOver(u) {
352
+ let {
353
+ active: h,
354
+ over: f
355
+ } = u;
356
+ i(t.onDragOver({
357
+ active: h,
358
+ over: f
359
+ }));
360
+ },
361
+ onDragEnd(u) {
362
+ let {
363
+ active: h,
364
+ over: f
365
+ } = u;
366
+ i(t.onDragEnd({
367
+ active: h,
368
+ over: f
369
+ }));
370
+ },
371
+ onDragCancel(u) {
372
+ let {
373
+ active: h,
374
+ over: f
375
+ } = u;
376
+ i(t.onDragCancel({
377
+ active: h,
378
+ over: f
379
+ }));
380
+ }
381
+ }), [i, t])), !l)
382
+ return null;
383
+ const d = j.createElement(j.Fragment, null, j.createElement(tr, {
384
+ id: r,
385
+ value: o.draggable
386
+ }), j.createElement(nr, {
387
+ id: a,
388
+ announcement: s
389
+ }));
390
+ return n ? Yn(d, n) : d;
391
+ }
392
+ var k;
393
+ (function(e) {
394
+ e.DragStart = "dragStart", e.DragMove = "dragMove", e.DragEnd = "dragEnd", e.DragCancel = "dragCancel", e.DragOver = "dragOver", e.RegisterDroppable = "registerDroppable", e.SetDroppableDisabled = "setDroppableDisabled", e.UnregisterDroppable = "unregisterDroppable";
395
+ })(k || (k = {}));
396
+ function lt() {
397
+ }
398
+ function cr(e, t) {
399
+ return A(
400
+ () => ({
401
+ sensor: e,
402
+ options: t ?? {}
403
+ }),
404
+ // eslint-disable-next-line react-hooks/exhaustive-deps
405
+ [e, t]
406
+ );
407
+ }
408
+ function dr() {
409
+ for (var e = arguments.length, t = new Array(e), n = 0; n < e; n++)
410
+ t[n] = arguments[n];
411
+ return A(
412
+ () => [...t].filter((r) => r != null),
413
+ // eslint-disable-next-line react-hooks/exhaustive-deps
414
+ [...t]
415
+ );
416
+ }
417
+ const Z = /* @__PURE__ */ Object.freeze({
418
+ x: 0,
419
+ y: 0
420
+ });
421
+ function ur(e, t) {
422
+ return Math.sqrt(Math.pow(e.x - t.x, 2) + Math.pow(e.y - t.y, 2));
423
+ }
424
+ function fr(e, t) {
425
+ const n = at(e);
426
+ if (!n)
427
+ return "0 0";
428
+ const r = {
429
+ x: (n.x - t.left) / t.width * 100,
430
+ y: (n.y - t.top) / t.height * 100
431
+ };
432
+ return r.x + "% " + r.y + "%";
433
+ }
434
+ function gr(e, t) {
435
+ let {
436
+ data: {
437
+ value: n
438
+ }
439
+ } = e, {
440
+ data: {
441
+ value: r
442
+ }
443
+ } = t;
444
+ return n - r;
445
+ }
446
+ function hr(e, t) {
447
+ let {
448
+ data: {
449
+ value: n
450
+ }
451
+ } = e, {
452
+ data: {
453
+ value: r
454
+ }
455
+ } = t;
456
+ return r - n;
457
+ }
458
+ function Yt(e) {
459
+ let {
460
+ left: t,
461
+ top: n,
462
+ height: r,
463
+ width: o
464
+ } = e;
465
+ return [{
466
+ x: t,
467
+ y: n
468
+ }, {
469
+ x: t + o,
470
+ y: n
471
+ }, {
472
+ x: t,
473
+ y: n + r
474
+ }, {
475
+ x: t + o,
476
+ y: n + r
477
+ }];
478
+ }
479
+ function vr(e, t) {
480
+ if (!e || e.length === 0)
481
+ return null;
482
+ const [n] = e;
483
+ return n[t];
484
+ }
485
+ const pr = (e) => {
486
+ let {
487
+ collisionRect: t,
488
+ droppableRects: n,
489
+ droppableContainers: r
490
+ } = e;
491
+ const o = Yt(t), i = [];
492
+ for (const s of r) {
493
+ const {
494
+ id: a
495
+ } = s, l = n.get(a);
496
+ if (l) {
497
+ const c = Yt(l), d = o.reduce((h, f, p) => h + ur(c[p], f), 0), u = Number((d / 4).toFixed(4));
498
+ i.push({
499
+ id: a,
500
+ data: {
501
+ droppableContainer: s,
502
+ value: u
503
+ }
504
+ });
505
+ }
506
+ }
507
+ return i.sort(gr);
508
+ };
509
+ function br(e, t) {
510
+ const n = Math.max(t.top, e.top), r = Math.max(t.left, e.left), o = Math.min(t.left + t.width, e.left + e.width), i = Math.min(t.top + t.height, e.top + e.height), s = o - r, a = i - n;
511
+ if (r < o && n < i) {
512
+ const l = t.width * t.height, c = e.width * e.height, d = s * a, u = d / (l + c - d);
513
+ return Number(u.toFixed(4));
514
+ }
515
+ return 0;
516
+ }
517
+ const mr = (e) => {
518
+ let {
519
+ collisionRect: t,
520
+ droppableRects: n,
521
+ droppableContainers: r
522
+ } = e;
523
+ const o = [];
524
+ for (const i of r) {
525
+ const {
526
+ id: s
527
+ } = i, a = n.get(s);
528
+ if (a) {
529
+ const l = br(a, t);
530
+ l > 0 && o.push({
531
+ id: s,
532
+ data: {
533
+ droppableContainer: i,
534
+ value: l
535
+ }
536
+ });
537
+ }
538
+ }
539
+ return o.sort(hr);
540
+ };
541
+ function yr(e, t, n) {
542
+ return {
543
+ ...e,
544
+ scaleX: t && n ? t.width / n.width : 1,
545
+ scaleY: t && n ? t.height / n.height : 1
546
+ };
547
+ }
548
+ function on(e, t) {
549
+ return e && t ? {
550
+ x: e.left - t.left,
551
+ y: e.top - t.top
552
+ } : Z;
553
+ }
554
+ function xr(e) {
555
+ return function(n) {
556
+ for (var r = arguments.length, o = new Array(r > 1 ? r - 1 : 0), i = 1; i < r; i++)
557
+ o[i - 1] = arguments[i];
558
+ return o.reduce((s, a) => ({
559
+ ...s,
560
+ top: s.top + e * a.y,
561
+ bottom: s.bottom + e * a.y,
562
+ left: s.left + e * a.x,
563
+ right: s.right + e * a.x
564
+ }), {
565
+ ...n
566
+ });
567
+ };
568
+ }
569
+ const wr = /* @__PURE__ */ xr(1);
570
+ function sn(e) {
571
+ if (e.startsWith("matrix3d(")) {
572
+ const t = e.slice(9, -1).split(/, /);
573
+ return {
574
+ x: +t[12],
575
+ y: +t[13],
576
+ scaleX: +t[0],
577
+ scaleY: +t[5]
578
+ };
579
+ } else if (e.startsWith("matrix(")) {
580
+ const t = e.slice(7, -1).split(/, /);
581
+ return {
582
+ x: +t[4],
583
+ y: +t[5],
584
+ scaleX: +t[0],
585
+ scaleY: +t[3]
586
+ };
587
+ }
588
+ return null;
589
+ }
590
+ function Dr(e, t, n) {
591
+ const r = sn(t);
592
+ if (!r)
593
+ return e;
594
+ const {
595
+ scaleX: o,
596
+ scaleY: i,
597
+ x: s,
598
+ y: a
599
+ } = r, l = e.left - s - (1 - o) * parseFloat(n), c = e.top - a - (1 - i) * parseFloat(n.slice(n.indexOf(" ") + 1)), d = o ? e.width / o : e.width, u = i ? e.height / i : e.height;
600
+ return {
601
+ width: d,
602
+ height: u,
603
+ top: c,
604
+ right: l + d,
605
+ bottom: c + u,
606
+ left: l
607
+ };
608
+ }
609
+ const Cr = {
610
+ ignoreTransform: !1
611
+ };
612
+ function Ae(e, t) {
613
+ t === void 0 && (t = Cr);
614
+ let n = e.getBoundingClientRect();
615
+ if (t.ignoreTransform) {
616
+ const {
617
+ transform: c,
618
+ transformOrigin: d
619
+ } = Y(e).getComputedStyle(e);
620
+ c && (n = Dr(n, c, d));
621
+ }
622
+ const {
623
+ top: r,
624
+ left: o,
625
+ width: i,
626
+ height: s,
627
+ bottom: a,
628
+ right: l
629
+ } = n;
630
+ return {
631
+ top: r,
632
+ left: o,
633
+ width: i,
634
+ height: s,
635
+ bottom: a,
636
+ right: l
637
+ };
638
+ }
639
+ function Kt(e) {
640
+ return Ae(e, {
641
+ ignoreTransform: !0
642
+ });
643
+ }
644
+ function Sr(e) {
645
+ const t = e.innerWidth, n = e.innerHeight;
646
+ return {
647
+ top: 0,
648
+ left: 0,
649
+ right: t,
650
+ bottom: n,
651
+ width: t,
652
+ height: n
653
+ };
654
+ }
655
+ function Rr(e, t) {
656
+ return t === void 0 && (t = Y(e).getComputedStyle(e)), t.position === "fixed";
657
+ }
658
+ function Er(e, t) {
659
+ t === void 0 && (t = Y(e).getComputedStyle(e));
660
+ const n = /(auto|scroll|overlay)/;
661
+ return ["overflow", "overflowX", "overflowY"].some((o) => {
662
+ const i = t[o];
663
+ return typeof i == "string" ? n.test(i) : !1;
664
+ });
665
+ }
666
+ function Nt(e, t) {
667
+ const n = [];
668
+ function r(o) {
669
+ if (t != null && n.length >= t || !o)
670
+ return n;
671
+ if (Et(o) && o.scrollingElement != null && !n.includes(o.scrollingElement))
672
+ return n.push(o.scrollingElement), n;
673
+ if (!We(o) || tn(o) || n.includes(o))
674
+ return n;
675
+ const i = Y(e).getComputedStyle(o);
676
+ return o !== e && Er(o, i) && n.push(o), Rr(o, i) ? n : r(o.parentNode);
677
+ }
678
+ return e ? r(e) : n;
679
+ }
680
+ function an(e) {
681
+ const [t] = Nt(e, 1);
682
+ return t ?? null;
683
+ }
684
+ function yt(e) {
685
+ return !dt || !e ? null : Ne(e) ? e : Rt(e) ? Et(e) || e === Ie(e).scrollingElement ? window : We(e) ? e : null : null;
686
+ }
687
+ function ln(e) {
688
+ return Ne(e) ? e.scrollX : e.scrollLeft;
689
+ }
690
+ function cn(e) {
691
+ return Ne(e) ? e.scrollY : e.scrollTop;
692
+ }
693
+ function Dt(e) {
694
+ return {
695
+ x: ln(e),
696
+ y: cn(e)
697
+ };
698
+ }
699
+ var P;
700
+ (function(e) {
701
+ e[e.Forward = 1] = "Forward", e[e.Backward = -1] = "Backward";
702
+ })(P || (P = {}));
703
+ function dn(e) {
704
+ return !dt || !e ? !1 : e === document.scrollingElement;
705
+ }
706
+ function un(e) {
707
+ const t = {
708
+ x: 0,
709
+ y: 0
710
+ }, n = dn(e) ? {
711
+ height: window.innerHeight,
712
+ width: window.innerWidth
713
+ } : {
714
+ height: e.clientHeight,
715
+ width: e.clientWidth
716
+ }, r = {
717
+ x: e.scrollWidth - n.width,
718
+ y: e.scrollHeight - n.height
719
+ }, o = e.scrollTop <= t.y, i = e.scrollLeft <= t.x, s = e.scrollTop >= r.y, a = e.scrollLeft >= r.x;
720
+ return {
721
+ isTop: o,
722
+ isLeft: i,
723
+ isBottom: s,
724
+ isRight: a,
725
+ maxScroll: r,
726
+ minScroll: t
727
+ };
728
+ }
729
+ const Nr = {
730
+ x: 0.2,
731
+ y: 0.2
732
+ };
733
+ function Ir(e, t, n, r, o) {
734
+ let {
735
+ top: i,
736
+ left: s,
737
+ right: a,
738
+ bottom: l
739
+ } = n;
740
+ r === void 0 && (r = 10), o === void 0 && (o = Nr);
741
+ const {
742
+ isTop: c,
743
+ isBottom: d,
744
+ isLeft: u,
745
+ isRight: h
746
+ } = un(e), f = {
747
+ x: 0,
748
+ y: 0
749
+ }, p = {
750
+ x: 0,
751
+ y: 0
752
+ }, g = {
753
+ height: t.height * o.y,
754
+ width: t.width * o.x
755
+ };
756
+ return !c && i <= t.top + g.height ? (f.y = P.Backward, p.y = r * Math.abs((t.top + g.height - i) / g.height)) : !d && l >= t.bottom - g.height && (f.y = P.Forward, p.y = r * Math.abs((t.bottom - g.height - l) / g.height)), !h && a >= t.right - g.width ? (f.x = P.Forward, p.x = r * Math.abs((t.right - g.width - a) / g.width)) : !u && s <= t.left + g.width && (f.x = P.Backward, p.x = r * Math.abs((t.left + g.width - s) / g.width)), {
757
+ direction: f,
758
+ speed: p
759
+ };
760
+ }
761
+ function Ar(e) {
762
+ if (e === document.scrollingElement) {
763
+ const {
764
+ innerWidth: i,
765
+ innerHeight: s
766
+ } = window;
767
+ return {
768
+ top: 0,
769
+ left: 0,
770
+ right: i,
771
+ bottom: s,
772
+ width: i,
773
+ height: s
774
+ };
775
+ }
776
+ const {
777
+ top: t,
778
+ left: n,
779
+ right: r,
780
+ bottom: o
781
+ } = e.getBoundingClientRect();
782
+ return {
783
+ top: t,
784
+ left: n,
785
+ right: r,
786
+ bottom: o,
787
+ width: e.clientWidth,
788
+ height: e.clientHeight
789
+ };
790
+ }
791
+ function fn(e) {
792
+ return e.reduce((t, n) => Ee(t, Dt(n)), Z);
793
+ }
794
+ function Or(e) {
795
+ return e.reduce((t, n) => t + ln(n), 0);
796
+ }
797
+ function Tr(e) {
798
+ return e.reduce((t, n) => t + cn(n), 0);
799
+ }
800
+ function gn(e, t) {
801
+ if (t === void 0 && (t = Ae), !e)
802
+ return;
803
+ const {
804
+ top: n,
805
+ left: r,
806
+ bottom: o,
807
+ right: i
808
+ } = t(e);
809
+ an(e) && (o <= 0 || i <= 0 || n >= window.innerHeight || r >= window.innerWidth) && e.scrollIntoView({
810
+ block: "center",
811
+ inline: "center"
812
+ });
813
+ }
814
+ const Mr = [["x", ["left", "right"], Or], ["y", ["top", "bottom"], Tr]];
815
+ class It {
816
+ constructor(t, n) {
817
+ 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;
818
+ const r = Nt(n), o = fn(r);
819
+ this.rect = {
820
+ ...t
821
+ }, this.width = t.width, this.height = t.height;
822
+ for (const [i, s, a] of Mr)
823
+ for (const l of s)
824
+ Object.defineProperty(this, l, {
825
+ get: () => {
826
+ const c = a(r), d = o[i] - c;
827
+ return this.rect[l] + d;
828
+ },
829
+ enumerable: !0
830
+ });
831
+ Object.defineProperty(this, "rect", {
832
+ enumerable: !1
833
+ });
834
+ }
835
+ }
836
+ class Be {
837
+ constructor(t) {
838
+ this.target = void 0, this.listeners = [], this.removeAll = () => {
839
+ this.listeners.forEach((n) => {
840
+ var r;
841
+ return (r = this.target) == null ? void 0 : r.removeEventListener(...n);
842
+ });
843
+ }, this.target = t;
844
+ }
845
+ add(t, n, r) {
846
+ var o;
847
+ (o = this.target) == null || o.addEventListener(t, n, r), this.listeners.push([t, n, r]);
848
+ }
849
+ }
850
+ function Lr(e) {
851
+ const {
852
+ EventTarget: t
853
+ } = Y(e);
854
+ return e instanceof t ? e : Ie(e);
855
+ }
856
+ function xt(e, t) {
857
+ const n = Math.abs(e.x), r = Math.abs(e.y);
858
+ return typeof t == "number" ? Math.sqrt(n ** 2 + r ** 2) > t : "x" in t && "y" in t ? n > t.x && r > t.y : "x" in t ? n > t.x : "y" in t ? r > t.y : !1;
859
+ }
860
+ var J;
861
+ (function(e) {
862
+ e.Click = "click", e.DragStart = "dragstart", e.Keydown = "keydown", e.ContextMenu = "contextmenu", e.Resize = "resize", e.SelectionChange = "selectionchange", e.VisibilityChange = "visibilitychange";
863
+ })(J || (J = {}));
864
+ function Wt(e) {
865
+ e.preventDefault();
866
+ }
867
+ function jr(e) {
868
+ e.stopPropagation();
869
+ }
870
+ var N;
871
+ (function(e) {
872
+ e.Space = "Space", e.Down = "ArrowDown", e.Right = "ArrowRight", e.Left = "ArrowLeft", e.Up = "ArrowUp", e.Esc = "Escape", e.Enter = "Enter", e.Tab = "Tab";
873
+ })(N || (N = {}));
874
+ const hn = {
875
+ start: [N.Space, N.Enter],
876
+ cancel: [N.Esc],
877
+ end: [N.Space, N.Enter, N.Tab]
878
+ }, kr = (e, t) => {
879
+ let {
880
+ currentCoordinates: n
881
+ } = t;
882
+ switch (e.code) {
883
+ case N.Right:
884
+ return {
885
+ ...n,
886
+ x: n.x + 25
887
+ };
888
+ case N.Left:
889
+ return {
890
+ ...n,
891
+ x: n.x - 25
892
+ };
893
+ case N.Down:
894
+ return {
895
+ ...n,
896
+ y: n.y + 25
897
+ };
898
+ case N.Up:
899
+ return {
900
+ ...n,
901
+ y: n.y - 25
902
+ };
903
+ }
904
+ };
905
+ class vn {
906
+ constructor(t) {
907
+ this.props = void 0, this.autoScrollEnabled = !1, this.referenceCoordinates = void 0, this.listeners = void 0, this.windowListeners = void 0, this.props = t;
908
+ const {
909
+ event: {
910
+ target: n
911
+ }
912
+ } = t;
913
+ this.props = t, this.listeners = new Be(Ie(n)), this.windowListeners = new Be(Y(n)), this.handleKeyDown = this.handleKeyDown.bind(this), this.handleCancel = this.handleCancel.bind(this), this.attach();
914
+ }
915
+ attach() {
916
+ this.handleStart(), this.windowListeners.add(J.Resize, this.handleCancel), this.windowListeners.add(J.VisibilityChange, this.handleCancel), setTimeout(() => this.listeners.add(J.Keydown, this.handleKeyDown));
917
+ }
918
+ handleStart() {
919
+ const {
920
+ activeNode: t,
921
+ onStart: n
922
+ } = this.props, r = t.node.current;
923
+ r && gn(r), n(Z);
924
+ }
925
+ handleKeyDown(t) {
926
+ if (ft(t)) {
927
+ const {
928
+ active: n,
929
+ context: r,
930
+ options: o
931
+ } = this.props, {
932
+ keyboardCodes: i = hn,
933
+ coordinateGetter: s = kr,
934
+ scrollBehavior: a = "smooth"
935
+ } = o, {
936
+ code: l
937
+ } = t;
938
+ if (i.end.includes(l)) {
939
+ this.handleEnd(t);
940
+ return;
941
+ }
942
+ if (i.cancel.includes(l)) {
943
+ this.handleCancel(t);
944
+ return;
945
+ }
946
+ const {
947
+ collisionRect: c
948
+ } = r.current, d = c ? {
949
+ x: c.left,
950
+ y: c.top
951
+ } : Z;
952
+ this.referenceCoordinates || (this.referenceCoordinates = d);
953
+ const u = s(t, {
954
+ active: n,
955
+ context: r.current,
956
+ currentCoordinates: d
957
+ });
958
+ if (u) {
959
+ const h = st(u, d), f = {
960
+ x: 0,
961
+ y: 0
962
+ }, {
963
+ scrollableAncestors: p
964
+ } = r.current;
965
+ for (const g of p) {
966
+ const v = t.code, {
967
+ isTop: b,
968
+ isRight: y,
969
+ isLeft: m,
970
+ isBottom: D,
971
+ maxScroll: x,
972
+ minScroll: S
973
+ } = un(g), w = Ar(g), C = {
974
+ x: Math.min(v === N.Right ? w.right - w.width / 2 : w.right, Math.max(v === N.Right ? w.left : w.left + w.width / 2, u.x)),
975
+ y: Math.min(v === N.Down ? w.bottom - w.height / 2 : w.bottom, Math.max(v === N.Down ? w.top : w.top + w.height / 2, u.y))
976
+ }, R = v === N.Right && !y || v === N.Left && !m, O = v === N.Down && !D || v === N.Up && !b;
977
+ if (R && C.x !== u.x) {
978
+ const E = g.scrollLeft + h.x, z = v === N.Right && E <= x.x || v === N.Left && E >= S.x;
979
+ if (z && !h.y) {
980
+ g.scrollTo({
981
+ left: E,
982
+ behavior: a
983
+ });
984
+ return;
985
+ }
986
+ z ? f.x = g.scrollLeft - E : f.x = v === N.Right ? g.scrollLeft - x.x : g.scrollLeft - S.x, f.x && g.scrollBy({
987
+ left: -f.x,
988
+ behavior: a
989
+ });
990
+ break;
991
+ } else if (O && C.y !== u.y) {
992
+ const E = g.scrollTop + h.y, z = v === N.Down && E <= x.y || v === N.Up && E >= S.y;
993
+ if (z && !h.x) {
994
+ g.scrollTo({
995
+ top: E,
996
+ behavior: a
997
+ });
998
+ return;
999
+ }
1000
+ z ? f.y = g.scrollTop - E : f.y = v === N.Down ? g.scrollTop - x.y : g.scrollTop - S.y, f.y && g.scrollBy({
1001
+ top: -f.y,
1002
+ behavior: a
1003
+ });
1004
+ break;
1005
+ }
1006
+ }
1007
+ this.handleMove(t, Ee(st(u, this.referenceCoordinates), f));
1008
+ }
1009
+ }
1010
+ }
1011
+ handleMove(t, n) {
1012
+ const {
1013
+ onMove: r
1014
+ } = this.props;
1015
+ t.preventDefault(), r(n);
1016
+ }
1017
+ handleEnd(t) {
1018
+ const {
1019
+ onEnd: n
1020
+ } = this.props;
1021
+ t.preventDefault(), this.detach(), n();
1022
+ }
1023
+ handleCancel(t) {
1024
+ const {
1025
+ onCancel: n
1026
+ } = this.props;
1027
+ t.preventDefault(), this.detach(), n();
1028
+ }
1029
+ detach() {
1030
+ this.listeners.removeAll(), this.windowListeners.removeAll();
1031
+ }
1032
+ }
1033
+ vn.activators = [{
1034
+ eventName: "onKeyDown",
1035
+ handler: (e, t, n) => {
1036
+ let {
1037
+ keyboardCodes: r = hn,
1038
+ onActivation: o
1039
+ } = t, {
1040
+ active: i
1041
+ } = n;
1042
+ const {
1043
+ code: s
1044
+ } = e.nativeEvent;
1045
+ if (r.start.includes(s)) {
1046
+ const a = i.activatorNode.current;
1047
+ return a && e.target !== a ? !1 : (e.preventDefault(), o?.({
1048
+ event: e.nativeEvent
1049
+ }), !0);
1050
+ }
1051
+ return !1;
1052
+ }
1053
+ }];
1054
+ function Ht(e) {
1055
+ return !!(e && "distance" in e);
1056
+ }
1057
+ function Ut(e) {
1058
+ return !!(e && "delay" in e);
1059
+ }
1060
+ class At {
1061
+ constructor(t, n, r) {
1062
+ var o;
1063
+ r === void 0 && (r = Lr(t.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 = t, this.events = n;
1064
+ const {
1065
+ event: i
1066
+ } = t, {
1067
+ target: s
1068
+ } = i;
1069
+ this.props = t, this.events = n, this.document = Ie(s), this.documentListeners = new Be(this.document), this.listeners = new Be(r), this.windowListeners = new Be(Y(s)), this.initialCoordinates = (o = at(i)) != null ? o : Z, 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();
1070
+ }
1071
+ attach() {
1072
+ const {
1073
+ events: t,
1074
+ props: {
1075
+ options: {
1076
+ activationConstraint: n,
1077
+ bypassActivationConstraint: r
1078
+ }
1079
+ }
1080
+ } = this;
1081
+ if (this.listeners.add(t.move.name, this.handleMove, {
1082
+ passive: !1
1083
+ }), this.listeners.add(t.end.name, this.handleEnd), t.cancel && this.listeners.add(t.cancel.name, this.handleCancel), this.windowListeners.add(J.Resize, this.handleCancel), this.windowListeners.add(J.DragStart, Wt), this.windowListeners.add(J.VisibilityChange, this.handleCancel), this.windowListeners.add(J.ContextMenu, Wt), this.documentListeners.add(J.Keydown, this.handleKeydown), n) {
1084
+ if (r != null && r({
1085
+ event: this.props.event,
1086
+ activeNode: this.props.activeNode,
1087
+ options: this.props.options
1088
+ }))
1089
+ return this.handleStart();
1090
+ if (Ut(n)) {
1091
+ this.timeoutId = setTimeout(this.handleStart, n.delay), this.handlePending(n);
1092
+ return;
1093
+ }
1094
+ if (Ht(n)) {
1095
+ this.handlePending(n);
1096
+ return;
1097
+ }
1098
+ }
1099
+ this.handleStart();
1100
+ }
1101
+ detach() {
1102
+ this.listeners.removeAll(), this.windowListeners.removeAll(), setTimeout(this.documentListeners.removeAll, 50), this.timeoutId !== null && (clearTimeout(this.timeoutId), this.timeoutId = null);
1103
+ }
1104
+ handlePending(t, n) {
1105
+ const {
1106
+ active: r,
1107
+ onPending: o
1108
+ } = this.props;
1109
+ o(r, t, this.initialCoordinates, n);
1110
+ }
1111
+ handleStart() {
1112
+ const {
1113
+ initialCoordinates: t
1114
+ } = this, {
1115
+ onStart: n
1116
+ } = this.props;
1117
+ t && (this.activated = !0, this.documentListeners.add(J.Click, jr, {
1118
+ capture: !0
1119
+ }), this.removeTextSelection(), this.documentListeners.add(J.SelectionChange, this.removeTextSelection), n(t));
1120
+ }
1121
+ handleMove(t) {
1122
+ var n;
1123
+ const {
1124
+ activated: r,
1125
+ initialCoordinates: o,
1126
+ props: i
1127
+ } = this, {
1128
+ onMove: s,
1129
+ options: {
1130
+ activationConstraint: a
1131
+ }
1132
+ } = i;
1133
+ if (!o)
1134
+ return;
1135
+ const l = (n = at(t)) != null ? n : Z, c = st(o, l);
1136
+ if (!r && a) {
1137
+ if (Ht(a)) {
1138
+ if (a.tolerance != null && xt(c, a.tolerance))
1139
+ return this.handleCancel();
1140
+ if (xt(c, a.distance))
1141
+ return this.handleStart();
1142
+ }
1143
+ if (Ut(a) && xt(c, a.tolerance))
1144
+ return this.handleCancel();
1145
+ this.handlePending(a, c);
1146
+ return;
1147
+ }
1148
+ t.cancelable && t.preventDefault(), s(l);
1149
+ }
1150
+ handleEnd() {
1151
+ const {
1152
+ onAbort: t,
1153
+ onEnd: n
1154
+ } = this.props;
1155
+ this.detach(), this.activated || t(this.props.active), n();
1156
+ }
1157
+ handleCancel() {
1158
+ const {
1159
+ onAbort: t,
1160
+ onCancel: n
1161
+ } = this.props;
1162
+ this.detach(), this.activated || t(this.props.active), n();
1163
+ }
1164
+ handleKeydown(t) {
1165
+ t.code === N.Esc && this.handleCancel();
1166
+ }
1167
+ removeTextSelection() {
1168
+ var t;
1169
+ (t = this.document.getSelection()) == null || t.removeAllRanges();
1170
+ }
1171
+ }
1172
+ const Pr = {
1173
+ cancel: {
1174
+ name: "pointercancel"
1175
+ },
1176
+ move: {
1177
+ name: "pointermove"
1178
+ },
1179
+ end: {
1180
+ name: "pointerup"
1181
+ }
1182
+ };
1183
+ class Ot extends At {
1184
+ constructor(t) {
1185
+ const {
1186
+ event: n
1187
+ } = t, r = Ie(n.target);
1188
+ super(t, Pr, r);
1189
+ }
1190
+ }
1191
+ Ot.activators = [{
1192
+ eventName: "onPointerDown",
1193
+ handler: (e, t) => {
1194
+ let {
1195
+ nativeEvent: n
1196
+ } = e, {
1197
+ onActivation: r
1198
+ } = t;
1199
+ return !n.isPrimary || n.button !== 0 ? !1 : (r?.({
1200
+ event: n
1201
+ }), !0);
1202
+ }
1203
+ }];
1204
+ const zr = {
1205
+ move: {
1206
+ name: "mousemove"
1207
+ },
1208
+ end: {
1209
+ name: "mouseup"
1210
+ }
1211
+ };
1212
+ var Ct;
1213
+ (function(e) {
1214
+ e[e.RightClick = 2] = "RightClick";
1215
+ })(Ct || (Ct = {}));
1216
+ class Br extends At {
1217
+ constructor(t) {
1218
+ super(t, zr, Ie(t.event.target));
1219
+ }
1220
+ }
1221
+ Br.activators = [{
1222
+ eventName: "onMouseDown",
1223
+ handler: (e, t) => {
1224
+ let {
1225
+ nativeEvent: n
1226
+ } = e, {
1227
+ onActivation: r
1228
+ } = t;
1229
+ return n.button === Ct.RightClick ? !1 : (r?.({
1230
+ event: n
1231
+ }), !0);
1232
+ }
1233
+ }];
1234
+ const wt = {
1235
+ cancel: {
1236
+ name: "touchcancel"
1237
+ },
1238
+ move: {
1239
+ name: "touchmove"
1240
+ },
1241
+ end: {
1242
+ name: "touchend"
1243
+ }
1244
+ };
1245
+ class Fr extends At {
1246
+ constructor(t) {
1247
+ super(t, wt);
1248
+ }
1249
+ static setup() {
1250
+ return window.addEventListener(wt.move.name, t, {
1251
+ capture: !1,
1252
+ passive: !1
1253
+ }), function() {
1254
+ window.removeEventListener(wt.move.name, t);
1255
+ };
1256
+ function t() {
1257
+ }
1258
+ }
1259
+ }
1260
+ Fr.activators = [{
1261
+ eventName: "onTouchStart",
1262
+ handler: (e, t) => {
1263
+ let {
1264
+ nativeEvent: n
1265
+ } = e, {
1266
+ onActivation: r
1267
+ } = t;
1268
+ const {
1269
+ touches: o
1270
+ } = n;
1271
+ return o.length > 1 ? !1 : (r?.({
1272
+ event: n
1273
+ }), !0);
1274
+ }
1275
+ }];
1276
+ var Fe;
1277
+ (function(e) {
1278
+ e[e.Pointer = 0] = "Pointer", e[e.DraggableRect = 1] = "DraggableRect";
1279
+ })(Fe || (Fe = {}));
1280
+ var ct;
1281
+ (function(e) {
1282
+ e[e.TreeOrder = 0] = "TreeOrder", e[e.ReversedTreeOrder = 1] = "ReversedTreeOrder";
1283
+ })(ct || (ct = {}));
1284
+ function $r(e) {
1285
+ let {
1286
+ acceleration: t,
1287
+ activator: n = Fe.Pointer,
1288
+ canScroll: r,
1289
+ draggingRect: o,
1290
+ enabled: i,
1291
+ interval: s = 5,
1292
+ order: a = ct.TreeOrder,
1293
+ pointerCoordinates: l,
1294
+ scrollableAncestors: c,
1295
+ scrollableAncestorRects: d,
1296
+ delta: u,
1297
+ threshold: h
1298
+ } = e;
1299
+ const f = Yr({
1300
+ delta: u,
1301
+ disabled: !i
1302
+ }), [p, g] = Jn(), v = M({
1303
+ x: 0,
1304
+ y: 0
1305
+ }), b = M({
1306
+ x: 0,
1307
+ y: 0
1308
+ }), y = A(() => {
1309
+ switch (n) {
1310
+ case Fe.Pointer:
1311
+ return l ? {
1312
+ top: l.y,
1313
+ bottom: l.y,
1314
+ left: l.x,
1315
+ right: l.x
1316
+ } : null;
1317
+ case Fe.DraggableRect:
1318
+ return o;
1319
+ }
1320
+ }, [n, o, l]), m = M(null), D = $(() => {
1321
+ const S = m.current;
1322
+ if (!S)
1323
+ return;
1324
+ const w = v.current.x * b.current.x, C = v.current.y * b.current.y;
1325
+ S.scrollBy(w, C);
1326
+ }, []), x = A(() => a === ct.TreeOrder ? [...c].reverse() : c, [a, c]);
1327
+ T(
1328
+ () => {
1329
+ if (!i || !c.length || !y) {
1330
+ g();
1331
+ return;
1332
+ }
1333
+ for (const S of x) {
1334
+ if (r?.(S) === !1)
1335
+ continue;
1336
+ const w = c.indexOf(S), C = d[w];
1337
+ if (!C)
1338
+ continue;
1339
+ const {
1340
+ direction: R,
1341
+ speed: O
1342
+ } = Ir(S, C, y, t, h);
1343
+ for (const E of ["x", "y"])
1344
+ f[E][R[E]] || (O[E] = 0, R[E] = 0);
1345
+ if (O.x > 0 || O.y > 0) {
1346
+ g(), m.current = S, p(D, s), v.current = O, b.current = R;
1347
+ return;
1348
+ }
1349
+ }
1350
+ v.current = {
1351
+ x: 0,
1352
+ y: 0
1353
+ }, b.current = {
1354
+ x: 0,
1355
+ y: 0
1356
+ }, g();
1357
+ },
1358
+ // eslint-disable-next-line react-hooks/exhaustive-deps
1359
+ [
1360
+ t,
1361
+ D,
1362
+ r,
1363
+ g,
1364
+ i,
1365
+ s,
1366
+ // eslint-disable-next-line react-hooks/exhaustive-deps
1367
+ JSON.stringify(y),
1368
+ // eslint-disable-next-line react-hooks/exhaustive-deps
1369
+ JSON.stringify(f),
1370
+ p,
1371
+ c,
1372
+ x,
1373
+ d,
1374
+ // eslint-disable-next-line react-hooks/exhaustive-deps
1375
+ JSON.stringify(h)
1376
+ ]
1377
+ );
1378
+ }
1379
+ const Xr = {
1380
+ x: {
1381
+ [P.Backward]: !1,
1382
+ [P.Forward]: !1
1383
+ },
1384
+ y: {
1385
+ [P.Backward]: !1,
1386
+ [P.Forward]: !1
1387
+ }
1388
+ };
1389
+ function Yr(e) {
1390
+ let {
1391
+ delta: t,
1392
+ disabled: n
1393
+ } = e;
1394
+ const r = it(t);
1395
+ return He((o) => {
1396
+ if (n || !r || !o)
1397
+ return Xr;
1398
+ const i = {
1399
+ x: Math.sign(t.x - r.x),
1400
+ y: Math.sign(t.y - r.y)
1401
+ };
1402
+ return {
1403
+ x: {
1404
+ [P.Backward]: o.x[P.Backward] || i.x === -1,
1405
+ [P.Forward]: o.x[P.Forward] || i.x === 1
1406
+ },
1407
+ y: {
1408
+ [P.Backward]: o.y[P.Backward] || i.y === -1,
1409
+ [P.Forward]: o.y[P.Forward] || i.y === 1
1410
+ }
1411
+ };
1412
+ }, [n, t, r]);
1413
+ }
1414
+ function Kr(e, t) {
1415
+ const n = t != null ? e.get(t) : void 0, r = n ? n.node.current : null;
1416
+ return He((o) => {
1417
+ var i;
1418
+ return t == null ? null : (i = r ?? o) != null ? i : null;
1419
+ }, [r, t]);
1420
+ }
1421
+ function Wr(e, t) {
1422
+ return A(() => e.reduce((n, r) => {
1423
+ const {
1424
+ sensor: o
1425
+ } = r, i = o.activators.map((s) => ({
1426
+ eventName: s.eventName,
1427
+ handler: t(s.handler, r)
1428
+ }));
1429
+ return [...n, ...i];
1430
+ }, []), [e, t]);
1431
+ }
1432
+ var Ye;
1433
+ (function(e) {
1434
+ e[e.Always = 0] = "Always", e[e.BeforeDragging = 1] = "BeforeDragging", e[e.WhileDragging = 2] = "WhileDragging";
1435
+ })(Ye || (Ye = {}));
1436
+ var St;
1437
+ (function(e) {
1438
+ e.Optimized = "optimized";
1439
+ })(St || (St = {}));
1440
+ const Vt = /* @__PURE__ */ new Map();
1441
+ function Hr(e, t) {
1442
+ let {
1443
+ dragging: n,
1444
+ dependencies: r,
1445
+ config: o
1446
+ } = t;
1447
+ const [i, s] = X(null), {
1448
+ frequency: a,
1449
+ measure: l,
1450
+ strategy: c
1451
+ } = o, d = M(e), u = v(), h = Xe(u), f = $(function(b) {
1452
+ b === void 0 && (b = []), !h.current && s((y) => y === null ? b : y.concat(b.filter((m) => !y.includes(m))));
1453
+ }, [h]), p = M(null), g = He((b) => {
1454
+ if (u && !n)
1455
+ return Vt;
1456
+ if (!b || b === Vt || d.current !== e || i != null) {
1457
+ const y = /* @__PURE__ */ new Map();
1458
+ for (let m of e) {
1459
+ if (!m)
1460
+ continue;
1461
+ if (i && i.length > 0 && !i.includes(m.id) && m.rect.current) {
1462
+ y.set(m.id, m.rect.current);
1463
+ continue;
1464
+ }
1465
+ const D = m.node.current, x = D ? new It(l(D), D) : null;
1466
+ m.rect.current = x, x && y.set(m.id, x);
1467
+ }
1468
+ return y;
1469
+ }
1470
+ return b;
1471
+ }, [e, i, n, u, l]);
1472
+ return T(() => {
1473
+ d.current = e;
1474
+ }, [e]), T(
1475
+ () => {
1476
+ u || f();
1477
+ },
1478
+ // eslint-disable-next-line react-hooks/exhaustive-deps
1479
+ [n, u]
1480
+ ), T(
1481
+ () => {
1482
+ i && i.length > 0 && s(null);
1483
+ },
1484
+ //eslint-disable-next-line react-hooks/exhaustive-deps
1485
+ [JSON.stringify(i)]
1486
+ ), T(
1487
+ () => {
1488
+ u || typeof a != "number" || p.current !== null || (p.current = setTimeout(() => {
1489
+ f(), p.current = null;
1490
+ }, a));
1491
+ },
1492
+ // eslint-disable-next-line react-hooks/exhaustive-deps
1493
+ [a, u, f, ...r]
1494
+ ), {
1495
+ droppableRects: g,
1496
+ measureDroppableContainers: f,
1497
+ measuringScheduled: i != null
1498
+ };
1499
+ function v() {
1500
+ switch (c) {
1501
+ case Ye.Always:
1502
+ return !1;
1503
+ case Ye.BeforeDragging:
1504
+ return n;
1505
+ default:
1506
+ return !n;
1507
+ }
1508
+ }
1509
+ }
1510
+ function Tt(e, t) {
1511
+ return He((n) => e ? n || (typeof t == "function" ? t(e) : e) : null, [t, e]);
1512
+ }
1513
+ function Ur(e, t) {
1514
+ return Tt(e, t);
1515
+ }
1516
+ function Vr(e) {
1517
+ let {
1518
+ callback: t,
1519
+ disabled: n
1520
+ } = e;
1521
+ const r = ut(t), o = A(() => {
1522
+ if (n || typeof window > "u" || typeof window.MutationObserver > "u")
1523
+ return;
1524
+ const {
1525
+ MutationObserver: i
1526
+ } = window;
1527
+ return new i(r);
1528
+ }, [r, n]);
1529
+ return T(() => () => o?.disconnect(), [o]), o;
1530
+ }
1531
+ function gt(e) {
1532
+ let {
1533
+ callback: t,
1534
+ disabled: n
1535
+ } = e;
1536
+ const r = ut(t), o = A(
1537
+ () => {
1538
+ if (n || typeof window > "u" || typeof window.ResizeObserver > "u")
1539
+ return;
1540
+ const {
1541
+ ResizeObserver: i
1542
+ } = window;
1543
+ return new i(r);
1544
+ },
1545
+ // eslint-disable-next-line react-hooks/exhaustive-deps
1546
+ [n]
1547
+ );
1548
+ return T(() => () => o?.disconnect(), [o]), o;
1549
+ }
1550
+ function qr(e) {
1551
+ return new It(Ae(e), e);
1552
+ }
1553
+ function qt(e, t, n) {
1554
+ t === void 0 && (t = qr);
1555
+ const [r, o] = X(null);
1556
+ function i() {
1557
+ o((l) => {
1558
+ if (!e)
1559
+ return null;
1560
+ if (e.isConnected === !1) {
1561
+ var c;
1562
+ return (c = l ?? n) != null ? c : null;
1563
+ }
1564
+ const d = t(e);
1565
+ return JSON.stringify(l) === JSON.stringify(d) ? l : d;
1566
+ });
1567
+ }
1568
+ const s = Vr({
1569
+ callback(l) {
1570
+ if (e)
1571
+ for (const c of l) {
1572
+ const {
1573
+ type: d,
1574
+ target: u
1575
+ } = c;
1576
+ if (d === "childList" && u instanceof HTMLElement && u.contains(e)) {
1577
+ i();
1578
+ break;
1579
+ }
1580
+ }
1581
+ }
1582
+ }), a = gt({
1583
+ callback: i
1584
+ });
1585
+ return Q(() => {
1586
+ i(), e ? (a?.observe(e), s?.observe(document.body, {
1587
+ childList: !0,
1588
+ subtree: !0
1589
+ })) : (a?.disconnect(), s?.disconnect());
1590
+ }, [e]), r;
1591
+ }
1592
+ function Gr(e) {
1593
+ const t = Tt(e);
1594
+ return on(e, t);
1595
+ }
1596
+ const Gt = [];
1597
+ function Jr(e) {
1598
+ const t = M(e), n = He((r) => e ? r && r !== Gt && e && t.current && e.parentNode === t.current.parentNode ? r : Nt(e) : Gt, [e]);
1599
+ return T(() => {
1600
+ t.current = e;
1601
+ }, [e]), n;
1602
+ }
1603
+ function _r(e) {
1604
+ const [t, n] = X(null), r = M(e), o = $((i) => {
1605
+ const s = yt(i.target);
1606
+ s && n((a) => a ? (a.set(s, Dt(s)), new Map(a)) : null);
1607
+ }, []);
1608
+ return T(() => {
1609
+ const i = r.current;
1610
+ if (e !== i) {
1611
+ s(i);
1612
+ const a = e.map((l) => {
1613
+ const c = yt(l);
1614
+ return c ? (c.addEventListener("scroll", o, {
1615
+ passive: !0
1616
+ }), [c, Dt(c)]) : null;
1617
+ }).filter((l) => l != null);
1618
+ n(a.length ? new Map(a) : null), r.current = e;
1619
+ }
1620
+ return () => {
1621
+ s(e), s(i);
1622
+ };
1623
+ function s(a) {
1624
+ a.forEach((l) => {
1625
+ const c = yt(l);
1626
+ c?.removeEventListener("scroll", o);
1627
+ });
1628
+ }
1629
+ }, [o, e]), A(() => e.length ? t ? Array.from(t.values()).reduce((i, s) => Ee(i, s), Z) : fn(e) : Z, [e, t]);
1630
+ }
1631
+ function Jt(e, t) {
1632
+ t === void 0 && (t = []);
1633
+ const n = M(null);
1634
+ return T(
1635
+ () => {
1636
+ n.current = null;
1637
+ },
1638
+ // eslint-disable-next-line react-hooks/exhaustive-deps
1639
+ t
1640
+ ), T(() => {
1641
+ const r = e !== Z;
1642
+ r && !n.current && (n.current = e), !r && n.current && (n.current = null);
1643
+ }, [e]), n.current ? st(e, n.current) : Z;
1644
+ }
1645
+ function Qr(e) {
1646
+ T(
1647
+ () => {
1648
+ if (!dt)
1649
+ return;
1650
+ const t = e.map((n) => {
1651
+ let {
1652
+ sensor: r
1653
+ } = n;
1654
+ return r.setup == null ? void 0 : r.setup();
1655
+ });
1656
+ return () => {
1657
+ for (const n of t)
1658
+ n?.();
1659
+ };
1660
+ },
1661
+ // TO-DO: Sensors length could theoretically change which would not be a valid dependency
1662
+ // eslint-disable-next-line react-hooks/exhaustive-deps
1663
+ e.map((t) => {
1664
+ let {
1665
+ sensor: n
1666
+ } = t;
1667
+ return n;
1668
+ })
1669
+ );
1670
+ }
1671
+ function Zr(e, t) {
1672
+ return A(() => e.reduce((n, r) => {
1673
+ let {
1674
+ eventName: o,
1675
+ handler: i
1676
+ } = r;
1677
+ return n[o] = (s) => {
1678
+ i(s, t);
1679
+ }, n;
1680
+ }, {}), [e, t]);
1681
+ }
1682
+ function pn(e) {
1683
+ return A(() => e ? Sr(e) : null, [e]);
1684
+ }
1685
+ const _t = [];
1686
+ function eo(e, t) {
1687
+ t === void 0 && (t = Ae);
1688
+ const [n] = e, r = pn(n ? Y(n) : null), [o, i] = X(_t);
1689
+ function s() {
1690
+ i(() => e.length ? e.map((l) => dn(l) ? r : new It(t(l), l)) : _t);
1691
+ }
1692
+ const a = gt({
1693
+ callback: s
1694
+ });
1695
+ return Q(() => {
1696
+ a?.disconnect(), s(), e.forEach((l) => a?.observe(l));
1697
+ }, [e]), o;
1698
+ }
1699
+ function bn(e) {
1700
+ if (!e)
1701
+ return null;
1702
+ if (e.children.length > 1)
1703
+ return e;
1704
+ const t = e.children[0];
1705
+ return We(t) ? t : e;
1706
+ }
1707
+ function to(e) {
1708
+ let {
1709
+ measure: t
1710
+ } = e;
1711
+ const [n, r] = X(null), o = $((c) => {
1712
+ for (const {
1713
+ target: d
1714
+ } of c)
1715
+ if (We(d)) {
1716
+ r((u) => {
1717
+ const h = t(d);
1718
+ return u ? {
1719
+ ...u,
1720
+ width: h.width,
1721
+ height: h.height
1722
+ } : h;
1723
+ });
1724
+ break;
1725
+ }
1726
+ }, [t]), i = gt({
1727
+ callback: o
1728
+ }), s = $((c) => {
1729
+ const d = bn(c);
1730
+ i?.disconnect(), d && i?.observe(d), r(d ? t(d) : null);
1731
+ }, [t, i]), [a, l] = ot(s);
1732
+ return A(() => ({
1733
+ nodeRef: a,
1734
+ rect: n,
1735
+ setRef: l
1736
+ }), [n, a, l]);
1737
+ }
1738
+ const no = [{
1739
+ sensor: Ot,
1740
+ options: {}
1741
+ }, {
1742
+ sensor: vn,
1743
+ options: {}
1744
+ }], ro = {
1745
+ current: {}
1746
+ }, rt = {
1747
+ draggable: {
1748
+ measure: Kt
1749
+ },
1750
+ droppable: {
1751
+ measure: Kt,
1752
+ strategy: Ye.WhileDragging,
1753
+ frequency: St.Optimized
1754
+ },
1755
+ dragOverlay: {
1756
+ measure: Ae
1757
+ }
1758
+ };
1759
+ class $e extends Map {
1760
+ get(t) {
1761
+ var n;
1762
+ return t != null && (n = super.get(t)) != null ? n : void 0;
1763
+ }
1764
+ toArray() {
1765
+ return Array.from(this.values());
1766
+ }
1767
+ getEnabled() {
1768
+ return this.toArray().filter((t) => {
1769
+ let {
1770
+ disabled: n
1771
+ } = t;
1772
+ return !n;
1773
+ });
1774
+ }
1775
+ getNodeFor(t) {
1776
+ var n, r;
1777
+ return (n = (r = this.get(t)) == null ? void 0 : r.node.current) != null ? n : void 0;
1778
+ }
1779
+ }
1780
+ const oo = {
1781
+ activatorEvent: null,
1782
+ active: null,
1783
+ activeNode: null,
1784
+ activeNodeRect: null,
1785
+ collisions: null,
1786
+ containerNodeRect: null,
1787
+ draggableNodes: /* @__PURE__ */ new Map(),
1788
+ droppableRects: /* @__PURE__ */ new Map(),
1789
+ droppableContainers: /* @__PURE__ */ new $e(),
1790
+ over: null,
1791
+ dragOverlay: {
1792
+ nodeRef: {
1793
+ current: null
1794
+ },
1795
+ rect: null,
1796
+ setRef: lt
1797
+ },
1798
+ scrollableAncestors: [],
1799
+ scrollableAncestorRects: [],
1800
+ measuringConfiguration: rt,
1801
+ measureDroppableContainers: lt,
1802
+ windowRect: null,
1803
+ measuringScheduled: !1
1804
+ }, mn = {
1805
+ activatorEvent: null,
1806
+ activators: [],
1807
+ active: null,
1808
+ activeNodeRect: null,
1809
+ ariaDescribedById: {
1810
+ draggable: ""
1811
+ },
1812
+ dispatch: lt,
1813
+ draggableNodes: /* @__PURE__ */ new Map(),
1814
+ over: null,
1815
+ measureDroppableContainers: lt
1816
+ }, Ve = /* @__PURE__ */ Ke(mn), yn = /* @__PURE__ */ Ke(oo);
1817
+ function io() {
1818
+ return {
1819
+ draggable: {
1820
+ active: null,
1821
+ initialCoordinates: {
1822
+ x: 0,
1823
+ y: 0
1824
+ },
1825
+ nodes: /* @__PURE__ */ new Map(),
1826
+ translate: {
1827
+ x: 0,
1828
+ y: 0
1829
+ }
1830
+ },
1831
+ droppable: {
1832
+ containers: new $e()
1833
+ }
1834
+ };
1835
+ }
1836
+ function so(e, t) {
1837
+ switch (t.type) {
1838
+ case k.DragStart:
1839
+ return {
1840
+ ...e,
1841
+ draggable: {
1842
+ ...e.draggable,
1843
+ initialCoordinates: t.initialCoordinates,
1844
+ active: t.active
1845
+ }
1846
+ };
1847
+ case k.DragMove:
1848
+ return e.draggable.active == null ? e : {
1849
+ ...e,
1850
+ draggable: {
1851
+ ...e.draggable,
1852
+ translate: {
1853
+ x: t.coordinates.x - e.draggable.initialCoordinates.x,
1854
+ y: t.coordinates.y - e.draggable.initialCoordinates.y
1855
+ }
1856
+ }
1857
+ };
1858
+ case k.DragEnd:
1859
+ case k.DragCancel:
1860
+ return {
1861
+ ...e,
1862
+ draggable: {
1863
+ ...e.draggable,
1864
+ active: null,
1865
+ initialCoordinates: {
1866
+ x: 0,
1867
+ y: 0
1868
+ },
1869
+ translate: {
1870
+ x: 0,
1871
+ y: 0
1872
+ }
1873
+ }
1874
+ };
1875
+ case k.RegisterDroppable: {
1876
+ const {
1877
+ element: n
1878
+ } = t, {
1879
+ id: r
1880
+ } = n, o = new $e(e.droppable.containers);
1881
+ return o.set(r, n), {
1882
+ ...e,
1883
+ droppable: {
1884
+ ...e.droppable,
1885
+ containers: o
1886
+ }
1887
+ };
1888
+ }
1889
+ case k.SetDroppableDisabled: {
1890
+ const {
1891
+ id: n,
1892
+ key: r,
1893
+ disabled: o
1894
+ } = t, i = e.droppable.containers.get(n);
1895
+ if (!i || r !== i.key)
1896
+ return e;
1897
+ const s = new $e(e.droppable.containers);
1898
+ return s.set(n, {
1899
+ ...i,
1900
+ disabled: o
1901
+ }), {
1902
+ ...e,
1903
+ droppable: {
1904
+ ...e.droppable,
1905
+ containers: s
1906
+ }
1907
+ };
1908
+ }
1909
+ case k.UnregisterDroppable: {
1910
+ const {
1911
+ id: n,
1912
+ key: r
1913
+ } = t, o = e.droppable.containers.get(n);
1914
+ if (!o || r !== o.key)
1915
+ return e;
1916
+ const i = new $e(e.droppable.containers);
1917
+ return i.delete(n), {
1918
+ ...e,
1919
+ droppable: {
1920
+ ...e.droppable,
1921
+ containers: i
1922
+ }
1923
+ };
1924
+ }
1925
+ default:
1926
+ return e;
1927
+ }
1928
+ }
1929
+ function ao(e) {
1930
+ let {
1931
+ disabled: t
1932
+ } = e;
1933
+ const {
1934
+ active: n,
1935
+ activatorEvent: r,
1936
+ draggableNodes: o
1937
+ } = pe(Ve), i = it(r), s = it(n?.id);
1938
+ return T(() => {
1939
+ if (!t && !r && i && s != null) {
1940
+ if (!ft(i) || document.activeElement === i.target)
1941
+ return;
1942
+ const a = o.get(s);
1943
+ if (!a)
1944
+ return;
1945
+ const {
1946
+ activatorNode: l,
1947
+ node: c
1948
+ } = a;
1949
+ if (!l.current && !c.current)
1950
+ return;
1951
+ requestAnimationFrame(() => {
1952
+ for (const d of [l.current, c.current]) {
1953
+ if (!d)
1954
+ continue;
1955
+ const u = Zn(d);
1956
+ if (u) {
1957
+ u.focus();
1958
+ break;
1959
+ }
1960
+ }
1961
+ });
1962
+ }
1963
+ }, [r, t, o, s, i]), null;
1964
+ }
1965
+ function xn(e, t) {
1966
+ let {
1967
+ transform: n,
1968
+ ...r
1969
+ } = t;
1970
+ return e != null && e.length ? e.reduce((o, i) => i({
1971
+ transform: o,
1972
+ ...r
1973
+ }), n) : n;
1974
+ }
1975
+ function lo(e) {
1976
+ return A(
1977
+ () => ({
1978
+ draggable: {
1979
+ ...rt.draggable,
1980
+ ...e?.draggable
1981
+ },
1982
+ droppable: {
1983
+ ...rt.droppable,
1984
+ ...e?.droppable
1985
+ },
1986
+ dragOverlay: {
1987
+ ...rt.dragOverlay,
1988
+ ...e?.dragOverlay
1989
+ }
1990
+ }),
1991
+ // eslint-disable-next-line react-hooks/exhaustive-deps
1992
+ [e?.draggable, e?.droppable, e?.dragOverlay]
1993
+ );
1994
+ }
1995
+ function co(e) {
1996
+ let {
1997
+ activeNode: t,
1998
+ measure: n,
1999
+ initialRect: r,
2000
+ config: o = !0
2001
+ } = e;
2002
+ const i = M(!1), {
2003
+ x: s,
2004
+ y: a
2005
+ } = typeof o == "boolean" ? {
2006
+ x: o,
2007
+ y: o
2008
+ } : o;
2009
+ Q(() => {
2010
+ if (!s && !a || !t) {
2011
+ i.current = !1;
2012
+ return;
2013
+ }
2014
+ if (i.current || !r)
2015
+ return;
2016
+ const c = t?.node.current;
2017
+ if (!c || c.isConnected === !1)
2018
+ return;
2019
+ const d = n(c), u = on(d, r);
2020
+ if (s || (u.x = 0), a || (u.y = 0), i.current = !0, Math.abs(u.x) > 0 || Math.abs(u.y) > 0) {
2021
+ const h = an(c);
2022
+ h && h.scrollBy({
2023
+ top: u.y,
2024
+ left: u.x
2025
+ });
2026
+ }
2027
+ }, [t, s, a, r, n]);
2028
+ }
2029
+ const ht = /* @__PURE__ */ Ke({
2030
+ ...Z,
2031
+ scaleX: 1,
2032
+ scaleY: 1
2033
+ });
2034
+ var ve;
2035
+ (function(e) {
2036
+ e[e.Uninitialized = 0] = "Uninitialized", e[e.Initializing = 1] = "Initializing", e[e.Initialized = 2] = "Initialized";
2037
+ })(ve || (ve = {}));
2038
+ const uo = /* @__PURE__ */ Bn(function(t) {
2039
+ var n, r, o, i;
2040
+ let {
2041
+ id: s,
2042
+ accessibility: a,
2043
+ autoScroll: l = !0,
2044
+ children: c,
2045
+ sensors: d = no,
2046
+ collisionDetection: u = mr,
2047
+ measuring: h,
2048
+ modifiers: f,
2049
+ ...p
2050
+ } = t;
2051
+ const g = Fn(so, void 0, io), [v, b] = g, [y, m] = ir(), [D, x] = X(ve.Uninitialized), S = D === ve.Initialized, {
2052
+ draggable: {
2053
+ active: w,
2054
+ nodes: C,
2055
+ translate: R
2056
+ },
2057
+ droppable: {
2058
+ containers: O
2059
+ }
2060
+ } = v, E = w != null ? C.get(w) : null, z = M({
2061
+ initial: null,
2062
+ translated: null
2063
+ }), _ = A(() => {
2064
+ var F;
2065
+ return w != null ? {
2066
+ id: w,
2067
+ // It's possible for the active node to unmount while dragging
2068
+ data: (F = E?.data) != null ? F : ro,
2069
+ rect: z
2070
+ } : null;
2071
+ }, [w, E]), ee = M(null), [Oe, qe] = X(null), [W, Ge] = X(null), oe = Xe(p, Object.values(p)), Te = Ue("DndDescribedBy", s), Je = A(() => O.getEnabled(), [O]), K = lo(h), {
2072
+ droppableRects: ie,
2073
+ measureDroppableContainers: me,
2074
+ measuringScheduled: Me
2075
+ } = Hr(Je, {
2076
+ dragging: S,
2077
+ dependencies: [R.x, R.y],
2078
+ config: K.droppable
2079
+ }), q = Kr(C, w), _e = A(() => W ? at(W) : null, [W]), ce = Pn(), se = Ur(q, K.draggable.measure);
2080
+ co({
2081
+ activeNode: w != null ? C.get(w) : null,
2082
+ config: ce.layoutShiftCompensation,
2083
+ initialRect: se,
2084
+ measure: K.draggable.measure
2085
+ });
2086
+ const I = qt(q, K.draggable.measure, se), Le = qt(q ? q.parentElement : null), te = M({
2087
+ activatorEvent: null,
2088
+ active: null,
2089
+ activeNode: q,
2090
+ collisionRect: null,
2091
+ collisions: null,
2092
+ droppableRects: ie,
2093
+ draggableNodes: C,
2094
+ draggingNode: null,
2095
+ draggingNodeRect: null,
2096
+ droppableContainers: O,
2097
+ over: null,
2098
+ scrollableAncestors: [],
2099
+ scrollAdjustedTranslate: null
2100
+ }), xe = O.getNodeFor((n = te.current.over) == null ? void 0 : n.id), ae = to({
2101
+ measure: K.dragOverlay.measure
2102
+ }), we = (r = ae.nodeRef.current) != null ? r : q, De = S ? (o = ae.rect) != null ? o : I : null, Lt = !!(ae.nodeRef.current && ae.rect), jt = Gr(Lt ? null : I), vt = pn(we ? Y(we) : null), de = Jr(S ? xe ?? q : null), Qe = eo(de), Ze = xn(f, {
2103
+ transform: {
2104
+ x: R.x - jt.x,
2105
+ y: R.y - jt.y,
2106
+ scaleX: 1,
2107
+ scaleY: 1
2108
+ },
2109
+ activatorEvent: W,
2110
+ active: _,
2111
+ activeNodeRect: I,
2112
+ containerNodeRect: Le,
2113
+ draggingNodeRect: De,
2114
+ over: te.current.over,
2115
+ overlayNodeRect: ae.rect,
2116
+ scrollableAncestors: de,
2117
+ scrollableAncestorRects: Qe,
2118
+ windowRect: vt
2119
+ }), kt = _e ? Ee(_e, R) : null, Pt = _r(de), An = Jt(Pt), On = Jt(Pt, [I]), Ce = Ee(Ze, An), Se = De ? wr(De, Ze) : null, je = _ && Se ? u({
2120
+ active: _,
2121
+ collisionRect: Se,
2122
+ droppableRects: ie,
2123
+ droppableContainers: Je,
2124
+ pointerCoordinates: kt
2125
+ }) : null, zt = vr(je, "id"), [ue, Bt] = X(null), Tn = Lt ? Ze : Ee(Ze, On), Mn = yr(Tn, (i = ue?.rect) != null ? i : null, I), pt = M(null), Ft = $(
2126
+ (F, H) => {
2127
+ let {
2128
+ sensor: U,
2129
+ options: fe
2130
+ } = H;
2131
+ if (ee.current == null)
2132
+ return;
2133
+ const G = C.get(ee.current);
2134
+ if (!G)
2135
+ return;
2136
+ const V = F.nativeEvent, ne = new U({
2137
+ active: ee.current,
2138
+ activeNode: G,
2139
+ event: V,
2140
+ options: fe,
2141
+ // Sensors need to be instantiated with refs for arguments that change over time
2142
+ // otherwise they are frozen in time with the stale arguments
2143
+ context: te,
2144
+ onAbort(B) {
2145
+ if (!C.get(B))
2146
+ return;
2147
+ const {
2148
+ onDragAbort: re
2149
+ } = oe.current, le = {
2150
+ id: B
2151
+ };
2152
+ re?.(le), y({
2153
+ type: "onDragAbort",
2154
+ event: le
2155
+ });
2156
+ },
2157
+ onPending(B, ge, re, le) {
2158
+ if (!C.get(B))
2159
+ return;
2160
+ const {
2161
+ onDragPending: Pe
2162
+ } = oe.current, he = {
2163
+ id: B,
2164
+ constraint: ge,
2165
+ initialCoordinates: re,
2166
+ offset: le
2167
+ };
2168
+ Pe?.(he), y({
2169
+ type: "onDragPending",
2170
+ event: he
2171
+ });
2172
+ },
2173
+ onStart(B) {
2174
+ const ge = ee.current;
2175
+ if (ge == null)
2176
+ return;
2177
+ const re = C.get(ge);
2178
+ if (!re)
2179
+ return;
2180
+ const {
2181
+ onDragStart: le
2182
+ } = oe.current, ke = {
2183
+ activatorEvent: V,
2184
+ active: {
2185
+ id: ge,
2186
+ data: re.data,
2187
+ rect: z
2188
+ }
2189
+ };
2190
+ et(() => {
2191
+ le?.(ke), x(ve.Initializing), b({
2192
+ type: k.DragStart,
2193
+ initialCoordinates: B,
2194
+ active: ge
2195
+ }), y({
2196
+ type: "onDragStart",
2197
+ event: ke
2198
+ }), qe(pt.current), Ge(V);
2199
+ });
2200
+ },
2201
+ onMove(B) {
2202
+ b({
2203
+ type: k.DragMove,
2204
+ coordinates: B
2205
+ });
2206
+ },
2207
+ onEnd: Re(k.DragEnd),
2208
+ onCancel: Re(k.DragCancel)
2209
+ });
2210
+ pt.current = ne;
2211
+ function Re(B) {
2212
+ return async function() {
2213
+ const {
2214
+ active: re,
2215
+ collisions: le,
2216
+ over: ke,
2217
+ scrollAdjustedTranslate: Pe
2218
+ } = te.current;
2219
+ let he = null;
2220
+ if (re && Pe) {
2221
+ const {
2222
+ cancelDrop: ze
2223
+ } = oe.current;
2224
+ he = {
2225
+ activatorEvent: V,
2226
+ active: re,
2227
+ collisions: le,
2228
+ delta: Pe,
2229
+ over: ke
2230
+ }, B === k.DragEnd && typeof ze == "function" && await Promise.resolve(ze(he)) && (B = k.DragCancel);
2231
+ }
2232
+ ee.current = null, et(() => {
2233
+ b({
2234
+ type: B
2235
+ }), x(ve.Uninitialized), Bt(null), qe(null), Ge(null), pt.current = null;
2236
+ const ze = B === k.DragEnd ? "onDragEnd" : "onDragCancel";
2237
+ if (he) {
2238
+ const bt = oe.current[ze];
2239
+ bt?.(he), y({
2240
+ type: ze,
2241
+ event: he
2242
+ });
2243
+ }
2244
+ });
2245
+ };
2246
+ }
2247
+ },
2248
+ // eslint-disable-next-line react-hooks/exhaustive-deps
2249
+ [C]
2250
+ ), Ln = $((F, H) => (U, fe) => {
2251
+ const G = U.nativeEvent, V = C.get(fe);
2252
+ if (
2253
+ // Another sensor is already instantiating
2254
+ ee.current !== null || // No active draggable
2255
+ !V || // Event has already been captured
2256
+ G.dndKit || G.defaultPrevented
2257
+ )
2258
+ return;
2259
+ const ne = {
2260
+ active: V
2261
+ };
2262
+ F(U, H.options, ne) === !0 && (G.dndKit = {
2263
+ capturedBy: H.sensor
2264
+ }, ee.current = fe, Ft(U, H));
2265
+ }, [C, Ft]), $t = Wr(d, Ln);
2266
+ Qr(d), Q(() => {
2267
+ I && D === ve.Initializing && x(ve.Initialized);
2268
+ }, [I, D]), T(
2269
+ () => {
2270
+ const {
2271
+ onDragMove: F
2272
+ } = oe.current, {
2273
+ active: H,
2274
+ activatorEvent: U,
2275
+ collisions: fe,
2276
+ over: G
2277
+ } = te.current;
2278
+ if (!H || !U)
2279
+ return;
2280
+ const V = {
2281
+ active: H,
2282
+ activatorEvent: U,
2283
+ collisions: fe,
2284
+ delta: {
2285
+ x: Ce.x,
2286
+ y: Ce.y
2287
+ },
2288
+ over: G
2289
+ };
2290
+ et(() => {
2291
+ F?.(V), y({
2292
+ type: "onDragMove",
2293
+ event: V
2294
+ });
2295
+ });
2296
+ },
2297
+ // eslint-disable-next-line react-hooks/exhaustive-deps
2298
+ [Ce.x, Ce.y]
2299
+ ), T(
2300
+ () => {
2301
+ const {
2302
+ active: F,
2303
+ activatorEvent: H,
2304
+ collisions: U,
2305
+ droppableContainers: fe,
2306
+ scrollAdjustedTranslate: G
2307
+ } = te.current;
2308
+ if (!F || ee.current == null || !H || !G)
2309
+ return;
2310
+ const {
2311
+ onDragOver: V
2312
+ } = oe.current, ne = fe.get(zt), Re = ne && ne.rect.current ? {
2313
+ id: ne.id,
2314
+ rect: ne.rect.current,
2315
+ data: ne.data,
2316
+ disabled: ne.disabled
2317
+ } : null, B = {
2318
+ active: F,
2319
+ activatorEvent: H,
2320
+ collisions: U,
2321
+ delta: {
2322
+ x: G.x,
2323
+ y: G.y
2324
+ },
2325
+ over: Re
2326
+ };
2327
+ et(() => {
2328
+ Bt(Re), V?.(B), y({
2329
+ type: "onDragOver",
2330
+ event: B
2331
+ });
2332
+ });
2333
+ },
2334
+ // eslint-disable-next-line react-hooks/exhaustive-deps
2335
+ [zt]
2336
+ ), Q(() => {
2337
+ te.current = {
2338
+ activatorEvent: W,
2339
+ active: _,
2340
+ activeNode: q,
2341
+ collisionRect: Se,
2342
+ collisions: je,
2343
+ droppableRects: ie,
2344
+ draggableNodes: C,
2345
+ draggingNode: we,
2346
+ draggingNodeRect: De,
2347
+ droppableContainers: O,
2348
+ over: ue,
2349
+ scrollableAncestors: de,
2350
+ scrollAdjustedTranslate: Ce
2351
+ }, z.current = {
2352
+ initial: De,
2353
+ translated: Se
2354
+ };
2355
+ }, [_, q, je, Se, C, we, De, ie, O, ue, de, Ce]), $r({
2356
+ ...ce,
2357
+ delta: R,
2358
+ draggingRect: Se,
2359
+ pointerCoordinates: kt,
2360
+ scrollableAncestors: de,
2361
+ scrollableAncestorRects: Qe
2362
+ });
2363
+ const jn = A(() => ({
2364
+ active: _,
2365
+ activeNode: q,
2366
+ activeNodeRect: I,
2367
+ activatorEvent: W,
2368
+ collisions: je,
2369
+ containerNodeRect: Le,
2370
+ dragOverlay: ae,
2371
+ draggableNodes: C,
2372
+ droppableContainers: O,
2373
+ droppableRects: ie,
2374
+ over: ue,
2375
+ measureDroppableContainers: me,
2376
+ scrollableAncestors: de,
2377
+ scrollableAncestorRects: Qe,
2378
+ measuringConfiguration: K,
2379
+ measuringScheduled: Me,
2380
+ windowRect: vt
2381
+ }), [_, q, I, W, je, Le, ae, C, O, ie, ue, me, de, Qe, K, Me, vt]), kn = A(() => ({
2382
+ activatorEvent: W,
2383
+ activators: $t,
2384
+ active: _,
2385
+ activeNodeRect: I,
2386
+ ariaDescribedById: {
2387
+ draggable: Te
2388
+ },
2389
+ dispatch: b,
2390
+ draggableNodes: C,
2391
+ over: ue,
2392
+ measureDroppableContainers: me
2393
+ }), [W, $t, _, I, b, Te, C, ue, me]);
2394
+ return j.createElement(rn.Provider, {
2395
+ value: m
2396
+ }, j.createElement(Ve.Provider, {
2397
+ value: kn
2398
+ }, j.createElement(yn.Provider, {
2399
+ value: jn
2400
+ }, j.createElement(ht.Provider, {
2401
+ value: Mn
2402
+ }, c)), j.createElement(ao, {
2403
+ disabled: a?.restoreFocus === !1
2404
+ })), j.createElement(lr, {
2405
+ ...a,
2406
+ hiddenTextDescribedById: Te
2407
+ }));
2408
+ function Pn() {
2409
+ const F = Oe?.autoScrollEnabled === !1, H = typeof l == "object" ? l.enabled === !1 : l === !1, U = S && !F && !H;
2410
+ return typeof l == "object" ? {
2411
+ ...l,
2412
+ enabled: U
2413
+ } : {
2414
+ enabled: U
2415
+ };
2416
+ }
2417
+ }), fo = /* @__PURE__ */ Ke(null), Qt = "button", go = "Draggable";
2418
+ function ho(e) {
2419
+ let {
2420
+ id: t,
2421
+ data: n,
2422
+ disabled: r = !1,
2423
+ attributes: o
2424
+ } = e;
2425
+ const i = Ue(go), {
2426
+ activators: s,
2427
+ activatorEvent: a,
2428
+ active: l,
2429
+ activeNodeRect: c,
2430
+ ariaDescribedById: d,
2431
+ draggableNodes: u,
2432
+ over: h
2433
+ } = pe(Ve), {
2434
+ role: f = Qt,
2435
+ roleDescription: p = "draggable",
2436
+ tabIndex: g = 0
2437
+ } = o ?? {}, v = l?.id === t, b = pe(v ? ht : fo), [y, m] = ot(), [D, x] = ot(), S = Zr(s, t), w = Xe(n);
2438
+ Q(
2439
+ () => (u.set(t, {
2440
+ id: t,
2441
+ key: i,
2442
+ node: y,
2443
+ activatorNode: D,
2444
+ data: w
2445
+ }), () => {
2446
+ const R = u.get(t);
2447
+ R && R.key === i && u.delete(t);
2448
+ }),
2449
+ // eslint-disable-next-line react-hooks/exhaustive-deps
2450
+ [u, t]
2451
+ );
2452
+ const C = A(() => ({
2453
+ role: f,
2454
+ tabIndex: g,
2455
+ "aria-disabled": r,
2456
+ "aria-pressed": v && f === Qt ? !0 : void 0,
2457
+ "aria-roledescription": p,
2458
+ "aria-describedby": d.draggable
2459
+ }), [r, f, g, v, p, d.draggable]);
2460
+ return {
2461
+ active: l,
2462
+ activatorEvent: a,
2463
+ activeNodeRect: c,
2464
+ attributes: C,
2465
+ isDragging: v,
2466
+ listeners: r ? void 0 : S,
2467
+ node: y,
2468
+ over: h,
2469
+ setNodeRef: m,
2470
+ setActivatorNodeRef: x,
2471
+ transform: b
2472
+ };
2473
+ }
2474
+ function wn() {
2475
+ return pe(yn);
2476
+ }
2477
+ const vo = "Droppable", po = {
2478
+ timeout: 25
2479
+ };
2480
+ function bo(e) {
2481
+ let {
2482
+ data: t,
2483
+ disabled: n = !1,
2484
+ id: r,
2485
+ resizeObserverConfig: o
2486
+ } = e;
2487
+ const i = Ue(vo), {
2488
+ active: s,
2489
+ dispatch: a,
2490
+ over: l,
2491
+ measureDroppableContainers: c
2492
+ } = pe(Ve), d = M({
2493
+ disabled: n
2494
+ }), u = M(!1), h = M(null), f = M(null), {
2495
+ disabled: p,
2496
+ updateMeasurementsFor: g,
2497
+ timeout: v
2498
+ } = {
2499
+ ...po,
2500
+ ...o
2501
+ }, b = Xe(g ?? r), y = $(
2502
+ () => {
2503
+ if (!u.current) {
2504
+ u.current = !0;
2505
+ return;
2506
+ }
2507
+ f.current != null && clearTimeout(f.current), f.current = setTimeout(() => {
2508
+ c(Array.isArray(b.current) ? b.current : [b.current]), f.current = null;
2509
+ }, v);
2510
+ },
2511
+ //eslint-disable-next-line react-hooks/exhaustive-deps
2512
+ [v]
2513
+ ), m = gt({
2514
+ callback: y,
2515
+ disabled: p || !s
2516
+ }), D = $((C, R) => {
2517
+ m && (R && (m.unobserve(R), u.current = !1), C && m.observe(C));
2518
+ }, [m]), [x, S] = ot(D), w = Xe(t);
2519
+ return T(() => {
2520
+ !m || !x.current || (m.disconnect(), u.current = !1, m.observe(x.current));
2521
+ }, [x, m]), T(
2522
+ () => (a({
2523
+ type: k.RegisterDroppable,
2524
+ element: {
2525
+ id: r,
2526
+ key: i,
2527
+ disabled: n,
2528
+ node: x,
2529
+ rect: h,
2530
+ data: w
2531
+ }
2532
+ }), () => a({
2533
+ type: k.UnregisterDroppable,
2534
+ key: i,
2535
+ id: r
2536
+ })),
2537
+ // eslint-disable-next-line react-hooks/exhaustive-deps
2538
+ [r]
2539
+ ), T(() => {
2540
+ n !== d.current.disabled && (a({
2541
+ type: k.SetDroppableDisabled,
2542
+ id: r,
2543
+ key: i,
2544
+ disabled: n
2545
+ }), d.current.disabled = n);
2546
+ }, [r, i, n, a]), {
2547
+ active: s,
2548
+ rect: h,
2549
+ isOver: l?.id === r,
2550
+ node: x,
2551
+ over: l,
2552
+ setNodeRef: S
2553
+ };
2554
+ }
2555
+ function mo(e) {
2556
+ let {
2557
+ animation: t,
2558
+ children: n
2559
+ } = e;
2560
+ const [r, o] = X(null), [i, s] = X(null), a = it(n);
2561
+ return !n && !r && a && o(a), Q(() => {
2562
+ if (!i)
2563
+ return;
2564
+ const l = r?.key, c = r?.props.id;
2565
+ if (l == null || c == null) {
2566
+ o(null);
2567
+ return;
2568
+ }
2569
+ Promise.resolve(t(c, i)).then(() => {
2570
+ o(null);
2571
+ });
2572
+ }, [t, r, i]), j.createElement(j.Fragment, null, n, r ? Xn(r, {
2573
+ ref: s
2574
+ }) : null);
2575
+ }
2576
+ const yo = {
2577
+ x: 0,
2578
+ y: 0,
2579
+ scaleX: 1,
2580
+ scaleY: 1
2581
+ };
2582
+ function xo(e) {
2583
+ let {
2584
+ children: t
2585
+ } = e;
2586
+ return j.createElement(Ve.Provider, {
2587
+ value: mn
2588
+ }, j.createElement(ht.Provider, {
2589
+ value: yo
2590
+ }, t));
2591
+ }
2592
+ const wo = {
2593
+ position: "fixed",
2594
+ touchAction: "none"
2595
+ }, Do = (e) => ft(e) ? "transform 250ms ease" : void 0, Co = /* @__PURE__ */ $n((e, t) => {
2596
+ let {
2597
+ as: n,
2598
+ activatorEvent: r,
2599
+ adjustScale: o,
2600
+ children: i,
2601
+ className: s,
2602
+ rect: a,
2603
+ style: l,
2604
+ transform: c,
2605
+ transition: d = Do
2606
+ } = e;
2607
+ if (!a)
2608
+ return null;
2609
+ const u = o ? c : {
2610
+ ...c,
2611
+ scaleX: 1,
2612
+ scaleY: 1
2613
+ }, h = {
2614
+ ...wo,
2615
+ width: a.width,
2616
+ height: a.height,
2617
+ top: a.top,
2618
+ left: a.left,
2619
+ transform: be.Transform.toString(u),
2620
+ transformOrigin: o && r ? fr(r, a) : void 0,
2621
+ transition: typeof d == "function" ? d(r) : d,
2622
+ ...l
2623
+ };
2624
+ return j.createElement(n, {
2625
+ className: s,
2626
+ style: h,
2627
+ ref: t
2628
+ }, i);
2629
+ }), So = (e) => (t) => {
2630
+ let {
2631
+ active: n,
2632
+ dragOverlay: r
2633
+ } = t;
2634
+ const o = {}, {
2635
+ styles: i,
2636
+ className: s
2637
+ } = e;
2638
+ if (i != null && i.active)
2639
+ for (const [a, l] of Object.entries(i.active))
2640
+ l !== void 0 && (o[a] = n.node.style.getPropertyValue(a), n.node.style.setProperty(a, l));
2641
+ if (i != null && i.dragOverlay)
2642
+ for (const [a, l] of Object.entries(i.dragOverlay))
2643
+ l !== void 0 && r.node.style.setProperty(a, l);
2644
+ return s != null && s.active && n.node.classList.add(s.active), s != null && s.dragOverlay && r.node.classList.add(s.dragOverlay), function() {
2645
+ for (const [l, c] of Object.entries(o))
2646
+ n.node.style.setProperty(l, c);
2647
+ s != null && s.active && n.node.classList.remove(s.active);
2648
+ };
2649
+ }, Ro = (e) => {
2650
+ let {
2651
+ transform: {
2652
+ initial: t,
2653
+ final: n
2654
+ }
2655
+ } = e;
2656
+ return [{
2657
+ transform: be.Transform.toString(t)
2658
+ }, {
2659
+ transform: be.Transform.toString(n)
2660
+ }];
2661
+ }, Eo = {
2662
+ duration: 250,
2663
+ easing: "ease",
2664
+ keyframes: Ro,
2665
+ sideEffects: /* @__PURE__ */ So({
2666
+ styles: {
2667
+ active: {
2668
+ opacity: "0"
2669
+ }
2670
+ }
2671
+ })
2672
+ };
2673
+ function No(e) {
2674
+ let {
2675
+ config: t,
2676
+ draggableNodes: n,
2677
+ droppableContainers: r,
2678
+ measuringConfiguration: o
2679
+ } = e;
2680
+ return ut((i, s) => {
2681
+ if (t === null)
2682
+ return;
2683
+ const a = n.get(i);
2684
+ if (!a)
2685
+ return;
2686
+ const l = a.node.current;
2687
+ if (!l)
2688
+ return;
2689
+ const c = bn(s);
2690
+ if (!c)
2691
+ return;
2692
+ const {
2693
+ transform: d
2694
+ } = Y(s).getComputedStyle(s), u = sn(d);
2695
+ if (!u)
2696
+ return;
2697
+ const h = typeof t == "function" ? t : Io(t);
2698
+ return gn(l, o.draggable.measure), h({
2699
+ active: {
2700
+ id: i,
2701
+ data: a.data,
2702
+ node: l,
2703
+ rect: o.draggable.measure(l)
2704
+ },
2705
+ draggableNodes: n,
2706
+ dragOverlay: {
2707
+ node: s,
2708
+ rect: o.dragOverlay.measure(c)
2709
+ },
2710
+ droppableContainers: r,
2711
+ measuringConfiguration: o,
2712
+ transform: u
2713
+ });
2714
+ });
2715
+ }
2716
+ function Io(e) {
2717
+ const {
2718
+ duration: t,
2719
+ easing: n,
2720
+ sideEffects: r,
2721
+ keyframes: o
2722
+ } = {
2723
+ ...Eo,
2724
+ ...e
2725
+ };
2726
+ return (i) => {
2727
+ let {
2728
+ active: s,
2729
+ dragOverlay: a,
2730
+ transform: l,
2731
+ ...c
2732
+ } = i;
2733
+ if (!t)
2734
+ return;
2735
+ const d = {
2736
+ x: a.rect.left - s.rect.left,
2737
+ y: a.rect.top - s.rect.top
2738
+ }, u = {
2739
+ scaleX: l.scaleX !== 1 ? s.rect.width * l.scaleX / a.rect.width : 1,
2740
+ scaleY: l.scaleY !== 1 ? s.rect.height * l.scaleY / a.rect.height : 1
2741
+ }, h = {
2742
+ x: l.x - d.x,
2743
+ y: l.y - d.y,
2744
+ ...u
2745
+ }, f = o({
2746
+ ...c,
2747
+ active: s,
2748
+ dragOverlay: a,
2749
+ transform: {
2750
+ initial: l,
2751
+ final: h
2752
+ }
2753
+ }), [p] = f, g = f[f.length - 1];
2754
+ if (JSON.stringify(p) === JSON.stringify(g))
2755
+ return;
2756
+ const v = r?.({
2757
+ active: s,
2758
+ dragOverlay: a,
2759
+ ...c
2760
+ }), b = a.node.animate(f, {
2761
+ duration: t,
2762
+ easing: n,
2763
+ fill: "forwards"
2764
+ });
2765
+ return new Promise((y) => {
2766
+ b.onfinish = () => {
2767
+ v?.(), y();
2768
+ };
2769
+ });
2770
+ };
2771
+ }
2772
+ let Zt = 0;
2773
+ function Ao(e) {
2774
+ return A(() => {
2775
+ if (e != null)
2776
+ return Zt++, Zt;
2777
+ }, [e]);
2778
+ }
2779
+ const Oo = /* @__PURE__ */ j.memo((e) => {
2780
+ let {
2781
+ adjustScale: t = !1,
2782
+ children: n,
2783
+ dropAnimation: r,
2784
+ style: o,
2785
+ transition: i,
2786
+ modifiers: s,
2787
+ wrapperElement: a = "div",
2788
+ className: l,
2789
+ zIndex: c = 999
2790
+ } = e;
2791
+ const {
2792
+ activatorEvent: d,
2793
+ active: u,
2794
+ activeNodeRect: h,
2795
+ containerNodeRect: f,
2796
+ draggableNodes: p,
2797
+ droppableContainers: g,
2798
+ dragOverlay: v,
2799
+ over: b,
2800
+ measuringConfiguration: y,
2801
+ scrollableAncestors: m,
2802
+ scrollableAncestorRects: D,
2803
+ windowRect: x
2804
+ } = wn(), S = pe(ht), w = Ao(u?.id), C = xn(s, {
2805
+ activatorEvent: d,
2806
+ active: u,
2807
+ activeNodeRect: h,
2808
+ containerNodeRect: f,
2809
+ draggingNodeRect: v.rect,
2810
+ over: b,
2811
+ overlayNodeRect: v.rect,
2812
+ scrollableAncestors: m,
2813
+ scrollableAncestorRects: D,
2814
+ transform: S,
2815
+ windowRect: x
2816
+ }), R = Tt(h), O = No({
2817
+ config: r,
2818
+ draggableNodes: p,
2819
+ droppableContainers: g,
2820
+ measuringConfiguration: y
2821
+ }), E = R ? v.setRef : void 0;
2822
+ return j.createElement(xo, null, j.createElement(mo, {
2823
+ animation: O
2824
+ }, u && w ? j.createElement(Co, {
2825
+ key: w,
2826
+ id: u.id,
2827
+ ref: E,
2828
+ as: a,
2829
+ activatorEvent: d,
2830
+ adjustScale: t,
2831
+ className: l,
2832
+ transition: i,
2833
+ rect: R,
2834
+ style: {
2835
+ zIndex: c,
2836
+ ...o
2837
+ },
2838
+ transform: C
2839
+ }, n) : null));
2840
+ });
2841
+ function Mt(e, t, n) {
2842
+ const r = e.slice();
2843
+ return r.splice(n < 0 ? r.length + n : n, 0, r.splice(t, 1)[0]), r;
2844
+ }
2845
+ function To(e, t) {
2846
+ return e.reduce((n, r, o) => {
2847
+ const i = t.get(r);
2848
+ return i && (n[o] = i), n;
2849
+ }, Array(e.length));
2850
+ }
2851
+ function tt(e) {
2852
+ return e !== null && e >= 0;
2853
+ }
2854
+ function Mo(e, t) {
2855
+ if (e === t)
2856
+ return !0;
2857
+ if (e.length !== t.length)
2858
+ return !1;
2859
+ for (let n = 0; n < e.length; n++)
2860
+ if (e[n] !== t[n])
2861
+ return !1;
2862
+ return !0;
2863
+ }
2864
+ function Lo(e) {
2865
+ return typeof e == "boolean" ? {
2866
+ draggable: e,
2867
+ droppable: e
2868
+ } : e;
2869
+ }
2870
+ const Dn = (e) => {
2871
+ let {
2872
+ rects: t,
2873
+ activeIndex: n,
2874
+ overIndex: r,
2875
+ index: o
2876
+ } = e;
2877
+ const i = Mt(t, r, n), s = t[o], a = i[o];
2878
+ return !a || !s ? null : {
2879
+ x: a.left - s.left,
2880
+ y: a.top - s.top,
2881
+ scaleX: a.width / s.width,
2882
+ scaleY: a.height / s.height
2883
+ };
2884
+ }, nt = {
2885
+ scaleX: 1,
2886
+ scaleY: 1
2887
+ }, jo = (e) => {
2888
+ var t;
2889
+ let {
2890
+ activeIndex: n,
2891
+ activeNodeRect: r,
2892
+ index: o,
2893
+ rects: i,
2894
+ overIndex: s
2895
+ } = e;
2896
+ const a = (t = i[n]) != null ? t : r;
2897
+ if (!a)
2898
+ return null;
2899
+ if (o === n) {
2900
+ const c = i[s];
2901
+ return c ? {
2902
+ x: 0,
2903
+ y: n < s ? c.top + c.height - (a.top + a.height) : c.top - a.top,
2904
+ ...nt
2905
+ } : null;
2906
+ }
2907
+ const l = ko(i, o, n);
2908
+ return o > n && o <= s ? {
2909
+ x: 0,
2910
+ y: -a.height - l,
2911
+ ...nt
2912
+ } : o < n && o >= s ? {
2913
+ x: 0,
2914
+ y: a.height + l,
2915
+ ...nt
2916
+ } : {
2917
+ x: 0,
2918
+ y: 0,
2919
+ ...nt
2920
+ };
2921
+ };
2922
+ function ko(e, t, n) {
2923
+ const r = e[t], o = e[t - 1], i = e[t + 1];
2924
+ return r ? n < t ? o ? r.top - (o.top + o.height) : i ? i.top - (r.top + r.height) : 0 : i ? i.top - (r.top + r.height) : o ? r.top - (o.top + o.height) : 0 : 0;
2925
+ }
2926
+ const Cn = "Sortable", Sn = /* @__PURE__ */ j.createContext({
2927
+ activeIndex: -1,
2928
+ containerId: Cn,
2929
+ disableTransforms: !1,
2930
+ items: [],
2931
+ overIndex: -1,
2932
+ useDragOverlay: !1,
2933
+ sortedRects: [],
2934
+ strategy: Dn,
2935
+ disabled: {
2936
+ draggable: !1,
2937
+ droppable: !1
2938
+ }
2939
+ });
2940
+ function Po(e) {
2941
+ let {
2942
+ children: t,
2943
+ id: n,
2944
+ items: r,
2945
+ strategy: o = Dn,
2946
+ disabled: i = !1
2947
+ } = e;
2948
+ const {
2949
+ active: s,
2950
+ dragOverlay: a,
2951
+ droppableRects: l,
2952
+ over: c,
2953
+ measureDroppableContainers: d
2954
+ } = wn(), u = Ue(Cn, n), h = a.rect !== null, f = A(() => r.map((S) => typeof S == "object" && "id" in S ? S.id : S), [r]), p = s != null, g = s ? f.indexOf(s.id) : -1, v = c ? f.indexOf(c.id) : -1, b = M(f), y = !Mo(f, b.current), m = v !== -1 && g === -1 || y, D = Lo(i);
2955
+ Q(() => {
2956
+ y && p && d(f);
2957
+ }, [y, f, p, d]), T(() => {
2958
+ b.current = f;
2959
+ }, [f]);
2960
+ const x = A(
2961
+ () => ({
2962
+ activeIndex: g,
2963
+ containerId: u,
2964
+ disabled: D,
2965
+ disableTransforms: m,
2966
+ items: f,
2967
+ overIndex: v,
2968
+ useDragOverlay: h,
2969
+ sortedRects: To(f, l),
2970
+ strategy: o
2971
+ }),
2972
+ // eslint-disable-next-line react-hooks/exhaustive-deps
2973
+ [g, u, D.draggable, D.droppable, m, f, v, l, h, o]
2974
+ );
2975
+ return j.createElement(Sn.Provider, {
2976
+ value: x
2977
+ }, t);
2978
+ }
2979
+ const zo = (e) => {
2980
+ let {
2981
+ id: t,
2982
+ items: n,
2983
+ activeIndex: r,
2984
+ overIndex: o
2985
+ } = e;
2986
+ return Mt(n, r, o).indexOf(t);
2987
+ }, Bo = (e) => {
2988
+ let {
2989
+ containerId: t,
2990
+ isSorting: n,
2991
+ wasDragging: r,
2992
+ index: o,
2993
+ items: i,
2994
+ newIndex: s,
2995
+ previousItems: a,
2996
+ previousContainerId: l,
2997
+ transition: c
2998
+ } = e;
2999
+ return !c || !r || a !== i && o === s ? !1 : n ? !0 : s !== o && t === l;
3000
+ }, Fo = {
3001
+ duration: 200,
3002
+ easing: "ease"
3003
+ }, Rn = "transform", $o = /* @__PURE__ */ be.Transition.toString({
3004
+ property: Rn,
3005
+ duration: 0,
3006
+ easing: "linear"
3007
+ }), Xo = {
3008
+ roleDescription: "sortable"
3009
+ };
3010
+ function Yo(e) {
3011
+ let {
3012
+ disabled: t,
3013
+ index: n,
3014
+ node: r,
3015
+ rect: o
3016
+ } = e;
3017
+ const [i, s] = X(null), a = M(n);
3018
+ return Q(() => {
3019
+ if (!t && n !== a.current && r.current) {
3020
+ const l = o.current;
3021
+ if (l) {
3022
+ const c = Ae(r.current, {
3023
+ ignoreTransform: !0
3024
+ }), d = {
3025
+ x: l.left - c.left,
3026
+ y: l.top - c.top,
3027
+ scaleX: l.width / c.width,
3028
+ scaleY: l.height / c.height
3029
+ };
3030
+ (d.x || d.y) && s(d);
3031
+ }
3032
+ }
3033
+ n !== a.current && (a.current = n);
3034
+ }, [t, n, r, o]), T(() => {
3035
+ i && s(null);
3036
+ }, [i]), i;
3037
+ }
3038
+ function En(e) {
3039
+ let {
3040
+ animateLayoutChanges: t = Bo,
3041
+ attributes: n,
3042
+ disabled: r,
3043
+ data: o,
3044
+ getNewIndex: i = zo,
3045
+ id: s,
3046
+ strategy: a,
3047
+ resizeObserverConfig: l,
3048
+ transition: c = Fo
3049
+ } = e;
3050
+ const {
3051
+ items: d,
3052
+ containerId: u,
3053
+ activeIndex: h,
3054
+ disabled: f,
3055
+ disableTransforms: p,
3056
+ sortedRects: g,
3057
+ overIndex: v,
3058
+ useDragOverlay: b,
3059
+ strategy: y
3060
+ } = pe(Sn), m = Ko(r, f), D = d.indexOf(s), x = A(() => ({
3061
+ sortable: {
3062
+ containerId: u,
3063
+ index: D,
3064
+ items: d
3065
+ },
3066
+ ...o
3067
+ }), [u, o, D, d]), S = A(() => d.slice(d.indexOf(s)), [d, s]), {
3068
+ rect: w,
3069
+ node: C,
3070
+ isOver: R,
3071
+ setNodeRef: O
3072
+ } = bo({
3073
+ id: s,
3074
+ data: x,
3075
+ disabled: m.droppable,
3076
+ resizeObserverConfig: {
3077
+ updateMeasurementsFor: S,
3078
+ ...l
3079
+ }
3080
+ }), {
3081
+ active: E,
3082
+ activatorEvent: z,
3083
+ activeNodeRect: _,
3084
+ attributes: ee,
3085
+ setNodeRef: Oe,
3086
+ listeners: qe,
3087
+ isDragging: W,
3088
+ over: Ge,
3089
+ setActivatorNodeRef: oe,
3090
+ transform: Te
3091
+ } = ho({
3092
+ id: s,
3093
+ data: x,
3094
+ attributes: {
3095
+ ...Xo,
3096
+ ...n
3097
+ },
3098
+ disabled: m.draggable
3099
+ }), Je = Gn(O, Oe), K = !!E, ie = K && !p && tt(h) && tt(v), me = !b && W, Me = me && ie ? Te : null, _e = ie ? Me ?? (a ?? y)({
3100
+ rects: g,
3101
+ activeNodeRect: _,
3102
+ activeIndex: h,
3103
+ overIndex: v,
3104
+ index: D
3105
+ }) : null, ce = tt(h) && tt(v) ? i({
3106
+ id: s,
3107
+ items: d,
3108
+ activeIndex: h,
3109
+ overIndex: v
3110
+ }) : D, se = E?.id, I = M({
3111
+ activeId: se,
3112
+ items: d,
3113
+ newIndex: ce,
3114
+ containerId: u
3115
+ }), Le = d !== I.current.items, te = t({
3116
+ active: E,
3117
+ containerId: u,
3118
+ isDragging: W,
3119
+ isSorting: K,
3120
+ id: s,
3121
+ index: D,
3122
+ items: d,
3123
+ newIndex: I.current.newIndex,
3124
+ previousItems: I.current.items,
3125
+ previousContainerId: I.current.containerId,
3126
+ transition: c,
3127
+ wasDragging: I.current.activeId != null
3128
+ }), xe = Yo({
3129
+ disabled: !te,
3130
+ index: D,
3131
+ node: C,
3132
+ rect: w
3133
+ });
3134
+ return T(() => {
3135
+ K && I.current.newIndex !== ce && (I.current.newIndex = ce), u !== I.current.containerId && (I.current.containerId = u), d !== I.current.items && (I.current.items = d);
3136
+ }, [K, ce, u, d]), T(() => {
3137
+ if (se === I.current.activeId)
3138
+ return;
3139
+ if (se != null && I.current.activeId == null) {
3140
+ I.current.activeId = se;
3141
+ return;
3142
+ }
3143
+ const we = setTimeout(() => {
3144
+ I.current.activeId = se;
3145
+ }, 50);
3146
+ return () => clearTimeout(we);
3147
+ }, [se]), {
3148
+ active: E,
3149
+ activeIndex: h,
3150
+ attributes: ee,
3151
+ data: x,
3152
+ rect: w,
3153
+ index: D,
3154
+ newIndex: ce,
3155
+ items: d,
3156
+ isOver: R,
3157
+ isSorting: K,
3158
+ isDragging: W,
3159
+ listeners: qe,
3160
+ node: C,
3161
+ overIndex: v,
3162
+ over: Ge,
3163
+ setNodeRef: Je,
3164
+ setActivatorNodeRef: oe,
3165
+ setDroppableNodeRef: O,
3166
+ setDraggableNodeRef: Oe,
3167
+ transform: xe ?? _e,
3168
+ transition: ae()
3169
+ };
3170
+ function ae() {
3171
+ if (
3172
+ // Temporarily disable transitions for a single frame to set up derived transforms
3173
+ xe || // Or to prevent items jumping to back to their "new" position when items change
3174
+ Le && I.current.newIndex === D
3175
+ )
3176
+ return $o;
3177
+ if (!(me && !ft(z) || !c) && (K || te))
3178
+ return be.Transition.toString({
3179
+ ...c,
3180
+ property: Rn
3181
+ });
3182
+ }
3183
+ }
3184
+ function Ko(e, t) {
3185
+ var n, r;
3186
+ return typeof e == "boolean" ? {
3187
+ draggable: e,
3188
+ // Backwards compatibility
3189
+ droppable: !1
3190
+ } : {
3191
+ draggable: (n = e?.draggable) != null ? n : t.draggable,
3192
+ droppable: (r = e?.droppable) != null ? r : t.droppable
3193
+ };
3194
+ }
3195
+ N.Down, N.Right, N.Up, N.Left;
3196
+ const Nn = (...e) => e.filter(Boolean).join(" ");
3197
+ function In({ card: e }) {
3198
+ const {
3199
+ attributes: t,
3200
+ listeners: n,
3201
+ setNodeRef: r,
3202
+ transform: o,
3203
+ transition: i,
3204
+ isDragging: s
3205
+ } = En({ id: e.id }), a = {
3206
+ transform: be.Transform.toString(o),
3207
+ transition: i,
3208
+ opacity: s ? 0.5 : void 0
3209
+ };
3210
+ return /* @__PURE__ */ L.jsx("div", { ref: r, style: a, ...t, ...n, children: /* @__PURE__ */ L.jsxs(Wn, { className: "mb-2 cursor-grab active:cursor-grabbing border-border bg-card/60 hover:border-primary/40 hover:shadow-lg hover:shadow-primary/10 transition-all duration-300 group", children: [
3211
+ /* @__PURE__ */ L.jsxs(Hn, { className: "p-4", children: [
3212
+ /* @__PURE__ */ L.jsx(Un, { className: "text-sm font-medium font-mono tracking-tight text-foreground group-hover:text-primary transition-colors", children: e.title }),
3213
+ e.description && /* @__PURE__ */ L.jsx(Vn, { className: "text-xs text-muted-foreground font-mono", children: e.description })
3214
+ ] }),
3215
+ e.badges && e.badges.length > 0 && /* @__PURE__ */ L.jsx(qn, { className: "p-4 pt-0", children: /* @__PURE__ */ L.jsx("div", { className: "flex flex-wrap gap-1", children: e.badges.map((l, c) => /* @__PURE__ */ L.jsx(en, { variant: l.variant || "default", className: "text-xs", children: l.label }, c)) }) })
3216
+ ] }) });
3217
+ }
3218
+ function Wo({
3219
+ column: e,
3220
+ cards: t
3221
+ }) {
3222
+ const n = t || [], { setNodeRef: r } = En({
3223
+ id: e.id,
3224
+ data: {
3225
+ type: "column"
3226
+ }
3227
+ }), o = e.limit && n.length >= e.limit;
3228
+ return /* @__PURE__ */ L.jsxs(
3229
+ "div",
3230
+ {
3231
+ ref: r,
3232
+ className: Nn(
3233
+ "flex flex-col w-80 flex-shrink-0 rounded-lg border border-border bg-card/20 backdrop-blur-sm shadow-xl",
3234
+ e.className
3235
+ ),
3236
+ children: [
3237
+ /* @__PURE__ */ L.jsx("div", { className: "p-4 border-b border-border/50 bg-muted/20", children: /* @__PURE__ */ L.jsxs("div", { className: "flex items-center justify-between", children: [
3238
+ /* @__PURE__ */ L.jsx("h3", { className: "font-mono text-sm font-semibold tracking-wider text-primary/90 uppercase", children: e.title }),
3239
+ /* @__PURE__ */ L.jsxs("div", { className: "flex items-center gap-2", children: [
3240
+ /* @__PURE__ */ L.jsxs("span", { className: "font-mono text-xs text-muted-foreground", children: [
3241
+ n.length,
3242
+ e.limit && ` / ${e.limit}`
3243
+ ] }),
3244
+ o && /* @__PURE__ */ L.jsx(en, { variant: "destructive", className: "text-xs", children: "Full" })
3245
+ ] })
3246
+ ] }) }),
3247
+ /* @__PURE__ */ L.jsx(Kn, { className: "flex-1 p-4", children: /* @__PURE__ */ L.jsx(
3248
+ Po,
3249
+ {
3250
+ items: n.map((i) => i.id),
3251
+ strategy: jo,
3252
+ children: /* @__PURE__ */ L.jsx("div", { className: "space-y-2", children: n.map((i) => /* @__PURE__ */ L.jsx(In, { card: i }, i.id)) })
3253
+ }
3254
+ ) })
3255
+ ]
3256
+ }
3257
+ );
3258
+ }
3259
+ function Go({ columns: e, onCardMove: t, className: n }) {
3260
+ const [r, o] = ye.useState(null), i = ye.useMemo(() => (e || []).map((p) => ({
3261
+ ...p,
3262
+ cards: p.cards || []
3263
+ })), [e]), [s, a] = ye.useState(i);
3264
+ ye.useEffect(() => {
3265
+ a(i);
3266
+ }, [i]);
3267
+ const l = dr(
3268
+ cr(Ot, {
3269
+ activationConstraint: {
3270
+ distance: 8
3271
+ }
3272
+ })
3273
+ ), c = (p) => {
3274
+ const { active: g } = p, v = u(g.id);
3275
+ o(v);
3276
+ }, d = (p) => {
3277
+ const { active: g, over: v } = p;
3278
+ if (o(null), !v) return;
3279
+ const b = g.id, y = v.id;
3280
+ if (b === y) return;
3281
+ const m = h(b), D = h(y) || f(y);
3282
+ if (!(!m || !D))
3283
+ if (m.id === D.id) {
3284
+ const x = [...m.cards], S = x.findIndex((R) => R.id === b), w = x.findIndex((R) => R.id === y), C = Mt(x, S, w);
3285
+ a(
3286
+ (R) => R.map(
3287
+ (O) => O.id === m.id ? { ...O, cards: C } : O
3288
+ )
3289
+ );
3290
+ } else {
3291
+ const x = [...m.cards], S = [...D.cards], w = x.findIndex((E) => E.id === b), R = y === D.id ? S.length : S.findIndex((E) => E.id === y), [O] = x.splice(w, 1);
3292
+ S.splice(R, 0, O), a(
3293
+ (E) => E.map((z) => z.id === m.id ? { ...z, cards: x } : z.id === D.id ? { ...z, cards: S } : z)
3294
+ ), t && t(b, m.id, D.id, R);
3295
+ }
3296
+ }, u = ye.useCallback(
3297
+ (p) => {
3298
+ for (const g of s) {
3299
+ const v = g.cards.find((b) => b.id === p);
3300
+ if (v) return v;
3301
+ }
3302
+ return null;
3303
+ },
3304
+ [s]
3305
+ ), h = ye.useCallback(
3306
+ (p) => s.find((g) => g.cards.some((v) => v.id === p)) || null,
3307
+ [s]
3308
+ ), f = ye.useCallback(
3309
+ (p) => s.find((g) => g.id === p) || null,
3310
+ [s]
3311
+ );
3312
+ return /* @__PURE__ */ L.jsxs(
3313
+ uo,
3314
+ {
3315
+ sensors: l,
3316
+ collisionDetection: pr,
3317
+ onDragStart: c,
3318
+ onDragEnd: d,
3319
+ children: [
3320
+ /* @__PURE__ */ L.jsx("div", { className: Nn("flex gap-4 overflow-x-auto p-4", n), children: s.map((p) => /* @__PURE__ */ L.jsx(
3321
+ Wo,
3322
+ {
3323
+ column: p,
3324
+ cards: p.cards
3325
+ },
3326
+ p.id
3327
+ )) }),
3328
+ /* @__PURE__ */ L.jsx(Oo, { children: r ? /* @__PURE__ */ L.jsx(In, { card: r }) : null })
3329
+ ]
3330
+ }
3331
+ );
3332
+ }
3333
+ export {
3334
+ Go as default
3335
+ };