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