fluid-dnd 2.0.1 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (76) hide show
  1. package/README.md +8 -9
  2. package/dist/{HandlerPublisher-C-jTncuG.cjs → HandlerPublisher-CsD6p60X.cjs} +1 -1
  3. package/dist/{HandlerPublisher-BYI2bw4n.js → HandlerPublisher-LAmM6gCQ.js} +1 -1
  4. package/dist/core/HandlerPublisher.js +20 -0
  5. package/dist/core/configHandler.d.ts +2 -3
  6. package/dist/core/configHandler.js +33 -0
  7. package/dist/core/dragAndDrop.d.ts +3 -3
  8. package/dist/core/dragAndDrop.js +62 -0
  9. package/dist/core/index.d.ts +11 -0
  10. package/dist/core/index.js +2 -0
  11. package/dist/core/useDraggable.d.ts +2 -3
  12. package/dist/core/useDraggable.js +335 -0
  13. package/dist/core/useDroppable.d.ts +2 -3
  14. package/dist/core/useDroppable.js +55 -0
  15. package/dist/core/utils/GetStyles.d.ts +2 -3
  16. package/dist/core/utils/GetStyles.js +138 -0
  17. package/dist/core/utils/ParseStyles.d.ts +2 -3
  18. package/dist/core/utils/ParseStyles.js +40 -0
  19. package/dist/core/utils/SetStyles.d.ts +1 -2
  20. package/dist/core/utils/SetStyles.js +192 -0
  21. package/dist/core/utils/SetTransform.d.ts +2 -3
  22. package/dist/core/utils/SetTransform.js +148 -0
  23. package/dist/core/utils/classes.js +9 -0
  24. package/dist/core/utils/config.d.ts +3 -3
  25. package/dist/core/utils/config.js +56 -0
  26. package/dist/core/utils/dom/classList.js +35 -0
  27. package/dist/core/utils/droppableConfigurator.d.ts +3 -4
  28. package/dist/core/utils/droppableConfigurator.js +106 -0
  29. package/dist/core/utils/events/emitEvents.d.ts +5 -6
  30. package/dist/core/utils/events/emitEvents.js +333 -0
  31. package/dist/core/utils/index.js +9 -0
  32. package/dist/core/utils/observer.js +11 -0
  33. package/dist/core/utils/scroll.d.ts +2 -3
  34. package/dist/core/utils/scroll.js +17 -0
  35. package/dist/core/utils/tempChildren.d.ts +1 -2
  36. package/dist/core/utils/tempChildren.js +146 -0
  37. package/dist/core/utils/touchDevice.js +3 -0
  38. package/dist/core/utils/translate/GetTranslateBeforeDropping.d.ts +2 -3
  39. package/dist/core/utils/translate/GetTranslateBeforeDropping.js +129 -0
  40. package/dist/core/utils/translate/GetTranslationByDraggingAndEvent.d.ts +2 -3
  41. package/dist/core/utils/translate/GetTranslationByDraggingAndEvent.js +48 -0
  42. package/dist/index-DE3X7xW4.cjs +1 -0
  43. package/dist/index-D_kOy-fH.js +1306 -0
  44. package/dist/index.cjs +1 -1
  45. package/dist/index.d.ts +4 -0
  46. package/dist/index.js +2 -0
  47. package/dist/index.mjs +1 -1
  48. package/dist/react/index.cjs +1 -1
  49. package/dist/react/index.d.ts +1 -2
  50. package/dist/react/index.js +2 -0
  51. package/dist/react/index.mjs +2 -2
  52. package/dist/react/useDragAndDrop.d.ts +2 -3
  53. package/dist/react/useDragAndDrop.js +28 -0
  54. package/dist/react/utils/ReactLilstConfig.d.ts +3 -4
  55. package/dist/react/utils/ReactLilstConfig.js +64 -0
  56. package/dist/svelte/index.cjs +1 -1
  57. package/dist/svelte/index.d.ts +1 -2
  58. package/dist/svelte/index.js +2 -0
  59. package/dist/svelte/index.mjs +2 -2
  60. package/dist/svelte/useDragAndDrop.d.ts +1 -2
  61. package/dist/svelte/useDragAndDrop.js +25 -0
  62. package/dist/svelte/utils/SvelteListCondig.d.ts +2 -2
  63. package/dist/svelte/utils/SvelteListCondig.js +36 -0
  64. package/dist/vue/index.cjs +1 -1
  65. package/dist/vue/index.d.ts +1 -2
  66. package/dist/vue/index.js +2 -0
  67. package/dist/vue/index.mjs +2 -2
  68. package/dist/vue/useDragAndDrop.d.ts +2 -3
  69. package/dist/vue/useDragAndDrop.js +23 -0
  70. package/dist/vue/utils/DropMethods.d.ts +1 -2
  71. package/dist/vue/utils/DropMethods.js +19 -0
  72. package/dist/vue/utils/VueListCondig.d.ts +3 -3
  73. package/dist/vue/utils/VueListCondig.js +28 -0
  74. package/package.json +2 -5
  75. package/dist/index-BQUYvZRn.js +0 -1301
  76. package/dist/index-DNmnvxhi.cjs +0 -1
@@ -1,1301 +0,0 @@
1
- var Te = Object.defineProperty;
2
- var Ee = (t, e, n) => e in t ? Te(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
3
- var j = (t, e, n) => Ee(t, typeof e != "symbol" ? e + "" : e, n);
4
- const V = "horizontal", tt = "vertical", U = "draggable", Xt = "droppable", Lt = "handler-class", Ft = "dragging", Wt = "dragging-handler-class", Vt = "dropping", oe = "grabbing", ye = "grab", Kt = "disable-transition", Ce = (t, e) => {
5
- const n = (l, f) => t.removeAtEvent(l, f), s = (l, f, g) => t.insertEvent(l, f, g), o = () => t.getLength(), r = (l) => t.getValue(l), c = (l) => l;
6
- return {
7
- direction: (e == null ? void 0 : e.direction) ?? tt,
8
- handlerSelector: (e == null ? void 0 : e.handlerSelector) ?? U,
9
- draggingClass: (e == null ? void 0 : e.draggingClass) ?? "dragging",
10
- droppableClass: (e == null ? void 0 : e.droppableClass) ?? "droppable-hover",
11
- isDraggable: (e == null ? void 0 : e.isDraggable) ?? (() => !0),
12
- onDragStart: (e == null ? void 0 : e.onDragStart) ?? (() => {
13
- }),
14
- onDragEnd: (e == null ? void 0 : e.onDragEnd) ?? (() => {
15
- }),
16
- droppableGroup: e == null ? void 0 : e.droppableGroup,
17
- onRemoveAtEvent: n,
18
- onInsertEvent: s,
19
- onGetLegth: o,
20
- onGetValue: r,
21
- animationDuration: (e == null ? void 0 : e.animationDuration) ?? 200,
22
- removingClass: (e == null ? void 0 : e.removingClass) ?? "removing",
23
- insertingFromClass: (e == null ? void 0 : e.insertingFromClass) ?? "from-inserting",
24
- delayBeforeRemove: (e == null ? void 0 : e.delayBeforeRemove) ?? 200,
25
- delayBeforeInsert: (e == null ? void 0 : e.delayBeforeInsert) ?? 200,
26
- mapFrom: (e == null ? void 0 : e.mapFrom) ?? c
27
- };
28
- }, Ae = (t, e) => {
29
- const { config: n, droppable: s } = t, { onInsertEvent: o, onDragEnd: r } = n;
30
- return {
31
- ...n,
32
- onDragEnd: (f) => {
33
- const { index: g, value: m } = f;
34
- r({ index: g, value: e(m, s) });
35
- },
36
- onInsertEvent: (f, g) => o(f, e(g, s), !0)
37
- };
38
- }, nt = (t, e) => t.classList.contains(e), bt = (t, e, n = !1) => {
39
- t.classList.toggle(e, n);
40
- }, st = (t, e) => {
41
- t.classList.add(e);
42
- }, Ct = (t, e) => {
43
- t.classList.remove(e);
44
- }, xe = (t, e) => At(e).every(
45
- (n) => nt(t, n)
46
- ), gt = (t) => t ? `.${At(t).join(".")}` : "", we = (t, e) => {
47
- if (!e)
48
- return;
49
- const n = At(e);
50
- t.classList.add(...n);
51
- }, At = (t) => t ? t.split(" ").filter((e) => e) : [], Be = () => {
52
- const { scrollX: t, scrollY: e } = window;
53
- return { scrollX: t, scrollY: e };
54
- }, zt = (t) => !t || t.trim().length == 0 || t == "normal" ? 0 : parseFloat(t), Me = (t) => t ? parseInt(t) : -1, Re = (t) => {
55
- const e = getComputedStyle(t), n = new DOMMatrixReadOnly(e.transform);
56
- return {
57
- x: n.m41,
58
- y: n.m42
59
- };
60
- }, re = (t, e) => t.x1 > e.x1 ? re(e, t) : t.x2 < e.x1 ? 0 : t.x2 >= e.x2 ? t.x2 - t.x1 : t.x2 - e.x1, pt = (t, e) => !Le(t, e), Le = (t, e) => {
61
- const n = Ot(t), s = Ot(e), o = Qt(n, s, tt), r = Qt(n, s, V);
62
- return o >= Math.min(n.height, s.height) / 2 && r >= Math.min(n.width, s.width) / 2;
63
- }, Qt = (t, e, n) => {
64
- const { before: s, distance: o } = B(n);
65
- return re(
66
- {
67
- x1: t[s],
68
- x2: t[s] + t[o]
69
- },
70
- {
71
- x1: e[s],
72
- x2: e[s] + e[o]
73
- }
74
- );
75
- }, L = (t, e) => t ? zt(getComputedStyle(t)[e]) : 0, Ut = (t) => {
76
- const { scrollLeft: e, scrollTop: n } = t;
77
- return { scrollLeft: e, scrollTop: n };
78
- }, Ot = (t) => t.getBoundingClientRect(), B = (t) => {
79
- const e = t == V;
80
- return {
81
- beforeMargin: e ? "marginLeft" : "marginTop",
82
- afterMargin: e ? "marginRight" : "marginBottom",
83
- borderBeforeWidth: e ? "borderLeftWidth" : "borderTopWidth",
84
- before: e ? "left" : "top",
85
- after: e ? "right" : "down",
86
- gap: e ? "columnGap" : "rowGap",
87
- distance: e ? "width" : "height",
88
- axis: e ? "x" : "y",
89
- offset: e ? "offsetX" : "offsetY",
90
- scroll: e ? "scrollX" : "scrollY",
91
- scrollElement: e ? "scrollLeft" : "scrollTop",
92
- page: e ? "pageX" : "pageY",
93
- inner: e ? "innerWidth" : "innerHeight",
94
- offsetElement: e ? "offsetLeft" : "offsetTop",
95
- scrollDistance: e ? "scrollWidth" : "scrollHeight",
96
- clientDistance: e ? "clientWidth" : "clientHeight",
97
- paddingBefore: e ? "paddingLeft" : "paddingTop",
98
- getRect: Ot
99
- };
100
- }, Mt = (t, e) => Oe(t, e), ie = (t) => [...t.children].filter(
101
- (n) => nt(n, U)
102
- ), Oe = (t, e) => {
103
- const n = [...e.children].filter(
104
- (o) => nt(o, U) && !o.isEqualNode(t)
105
- ).toReversed(), s = [...e.children].findLastIndex(
106
- (o) => o.isEqualNode(t)
107
- );
108
- return [
109
- n,
110
- s,
111
- e
112
- ];
113
- }, Ne = (t) => {
114
- let e = t.parentElement;
115
- for (; e; ) {
116
- if (window.getComputedStyle(e).position === "fixed")
117
- return e;
118
- e = e.parentElement;
119
- }
120
- return null;
121
- }, ce = (t, e) => {
122
- const {
123
- before: n,
124
- borderBeforeWidth: s
125
- } = B(e), o = Ne(t);
126
- return o ? Ot(o)[n] + L(o, s) : 0;
127
- }, Tt = (t) => window.TouchEvent && t instanceof TouchEvent, it = (t) => t instanceof HTMLElement, ae = (t) => t instanceof MouseEvent, Fe = ["onmouseup", "onmousedown", "onmousemove"], Pe = (t, e, n) => {
128
- t && (t.style.height = `${e}px`, t.style.width = `${n}px`);
129
- }, Et = (t, e, n) => {
130
- !t || !it(t) || (n == 0 && e == 0 ? t.style.transform = "" : t.style.transform = `translate(${n}px,${e}px)`);
131
- }, $e = (t, e, n, s) => {
132
- t[e] = (o) => {
133
- if (o.defaultPrevented)
134
- return;
135
- s && s(o);
136
- const r = _t(o);
137
- n(r);
138
- };
139
- }, It = (t, e, n, s) => {
140
- n && (Ge(e) ? t[e] = n : $e(t, e, n, s));
141
- }, Ge = (t) => Fe.includes(t), Ie = (t) => {
142
- const { target: e } = t;
143
- return {
144
- clientX: 0,
145
- clientY: 0,
146
- pageX: 0,
147
- pageY: 0,
148
- screenX: 0,
149
- screenY: 0,
150
- target: e,
151
- offsetX: 0,
152
- offsetY: 0
153
- };
154
- }, Ye = (t, e) => {
155
- const n = (s, o) => We(e, window, o, s);
156
- if (ae(t)) {
157
- const { offsetX: s, offsetY: o } = t;
158
- return [s, o];
159
- } else {
160
- const s = t.target;
161
- return [
162
- n(s, V),
163
- n(s, tt)
164
- ];
165
- }
166
- }, _t = (t) => {
167
- const e = Xe(t);
168
- if (!e)
169
- return Ie(t);
170
- const [n, s] = Ye(t, e), { clientX: o, clientY: r, pageX: c, pageY: l, screenX: f, screenY: g, target: m } = e;
171
- return {
172
- clientX: o,
173
- clientY: r,
174
- pageX: c,
175
- pageY: l,
176
- screenX: f,
177
- screenY: g,
178
- target: m,
179
- offsetX: n,
180
- offsetY: s
181
- };
182
- }, Xe = (t) => {
183
- if (Tt(t))
184
- return t.touches[0] ?? t.changedTouches[0];
185
- if (ae(t))
186
- return t;
187
- }, We = (t, e, n, s) => {
188
- const { page: o, scroll: r, before: c, borderBeforeWidth: l, getRect: f } = B(n), g = f(s);
189
- return t[o] - e[r] - g[c] - L(s, l);
190
- }, Pt = (t, e, n = "ease-out", s = "transform") => {
191
- it(t) && (t.style.transitionDuration = `${e}ms`, t.style.transitionTimingFunction = `${n}`, t.style.transitionProperty = `${s}`);
192
- }, le = (t, e, n) => {
193
- !t || !it(t) || (t[e] = () => {
194
- n();
195
- });
196
- }, Ve = (t) => {
197
- var e = t.querySelector("style");
198
- if (!e) {
199
- var n = document.createElement("style");
200
- return t.appendChild(n), n;
201
- }
202
- return e;
203
- }, _e = (t, e) => {
204
- const n = /\.-?[_a-zA-Z0-9-*\s<>():]+/g, [s] = e.match(n) || [];
205
- for (const o of t.cssRules) {
206
- const [r] = o.cssText.match(n) || [];
207
- if (s === r)
208
- return !0;
209
- }
210
- return !1;
211
- }, He = (t, e) => {
212
- e.forEach((n) => {
213
- qe(t, n);
214
- });
215
- }, qe = (t, e) => {
216
- var s;
217
- var n = Ve(t);
218
- n.sheet && (_e(n.sheet, e) || (s = n.sheet) == null || s.insertRule(e, n.sheet.cssRules.length));
219
- }, ue = (t, e = {}) => {
220
- for (const n of Object.keys(e)) {
221
- const s = e[n];
222
- s != null && ze(t, `--${n}`, s);
223
- }
224
- }, ze = (t, e, n) => t && t.style.setProperty(e, n), je = (t, e, n) => {
225
- n != 0 && (e === "vertical" ? t.scrollBy(0, n) : t.scrollBy(n, 0));
226
- }, Ze = (t, e, n) => {
227
- const { scrollDistance: s, clientDistance: o, scrollElement: r } = B(t);
228
- return n[r] / (e[s] - e[o]);
229
- }, ke = (t) => {
230
- let e = { offsetX: 0, offsetY: 0 }, n = { top: 0, left: 0 }, s = { x: 0, y: 0 };
231
- const o = (f) => {
232
- t.style.transform = `translate( ${f.x}px, ${f.y}px)`;
233
- }, r = (f) => {
234
- t.style.top = `${f.top}px`, t.style.left = `${f.left}px`;
235
- };
236
- return [
237
- (f, g, m, b) => {
238
- const M = (y) => {
239
- const {
240
- beforeMargin: p,
241
- borderBeforeWidth: E,
242
- before: R,
243
- offset: w,
244
- scroll: P,
245
- page: X,
246
- inner: Z,
247
- distance: _,
248
- axis: H,
249
- getRect: $
250
- } = B(y), k = m[X], q = window[P], J = window[Z], I = $(f)[_], z = L(f, E), W = L(f, p), Y = k - e[w], et = ce(f, y);
251
- if (Y >= q - I / 2 && Y <= q + J) {
252
- const ot = Y - n[R] - z - W - q - et;
253
- return O(y), ot;
254
- }
255
- return s[H];
256
- }, O = (y) => {
257
- if (f && nt(f, Ft) && y === b) {
258
- const { before: p, distance: E, axis: R, getRect: w } = B(b), P = w(f)[E], X = w(g), Z = n[p] - X[p] + s[R], H = X[E] - P, $ = Z / H, k = P / H, q = 0.1, J = 0.2, I = 0.8;
259
- let z = 0;
260
- const W = pt(f, g);
261
- !W && $ < J && $ > -k ? z = $ / J - 1 : !W && $ > I && $ < 1 + k && (z = 1 / (1 - I) * ($ - I));
262
- const Y = q * P * z;
263
- je(g, b, Y);
264
- }
265
- }, F = (y) => {
266
- const { axis: p } = B(y);
267
- s[p] = M(y), o(s);
268
- };
269
- F(V), F(tt);
270
- },
271
- (f, g) => {
272
- const [m, b, M, O] = Qe(
273
- f,
274
- g,
275
- t
276
- );
277
- n = {
278
- top: m,
279
- left: b
280
- }, r(n), e = { offsetX: M, offsetY: O };
281
- }
282
- ];
283
- }, Rt = (t, e, n) => {
284
- const { borderBeforeWidth: s, before: o, getRect: r } = B(t);
285
- return r(e)[o] - r(n)[o] - L(n, s);
286
- }, Je = (t, e) => {
287
- let { offsetX: n, offsetY: s, target: o } = t, r = Ke(o, e);
288
- const c = o;
289
- return c && r && !c.isSameNode(r) && (n += Rt(V, c, r), s += Rt(tt, c, r)), r && e != o && (n += Rt(V, r, e), s += Rt(tt, r, e)), [n, s];
290
- }, Ke = (t, e) => {
291
- const n = t == null ? void 0 : t.closest(`.${Lt}`);
292
- return n && n.isSameNode(e) ? t : n;
293
- }, te = (t, e, n, s) => {
294
- const { offset: o, beforeMargin: r, page: c, borderBeforeWidth: l, scroll: f } = B(t), g = ce(n, t);
295
- return e[c] - s[o] - L(n, r) - L(n, l) - window[f] - g;
296
- }, Qe = (t, e, n) => {
297
- const [s, o] = Je(t, n);
298
- return [
299
- te(tt, t, e, {
300
- offsetX: s,
301
- offsetY: o
302
- }),
303
- te(V, t, e, {
304
- offsetX: s,
305
- offsetY: o
306
- }),
307
- s,
308
- o
309
- ];
310
- }, fe = "startDrag", Nt = "drag", jt = "startDrop", Ue = "drop", at = "temp-child", de = "cubic-bezier(0.2, 0, 0, 1)", tn = (t) => t === Ue || t === jt, Ht = (t) => !t || t.length == 0 ? 0 : zt(t.replace("px", "")), en = (t, e) => {
311
- const n = getComputedStyle(t)[e];
312
- if (n.match("%")) {
313
- const o = zt(n.replace("%", "")), { width: r } = t.getBoundingClientRect();
314
- return r * (o / 100);
315
- }
316
- return Ht(n);
317
- }, Zt = (t, e) => {
318
- if (!(t instanceof Element))
319
- return [
320
- 0,
321
- !1
322
- ];
323
- const n = en(t, e), s = getComputedStyle(t).display, o = n > 0 || s === "flex";
324
- return [n, o];
325
- }, nn = (t) => {
326
- const { top: e, left: n } = getComputedStyle(t);
327
- return [Ht(e), Ht(n)];
328
- }, sn = (t, e) => {
329
- const { gap: n } = B(e), [s, o] = Zt(t, n);
330
- return o ? s : 0;
331
- };
332
- function yt(t, e, n, s, o = t.previousElementSibling, r = t.nextElementSibling) {
333
- let { height: c, width: l } = on(
334
- n,
335
- t,
336
- o,
337
- r
338
- );
339
- return pt(t, s) && e == Nt && (c = 0, l = 0), { height: c, width: l };
340
- }
341
- const on = (t, e, n, s) => {
342
- const {
343
- afterMargin: o,
344
- beforeMargin: r,
345
- distance: c,
346
- gap: l,
347
- getRect: f
348
- } = B(t), g = L(e, o), m = L(e, r), b = L(s, r), [M, O] = Zt(
349
- e.parentElement,
350
- l
351
- ), F = f(e)[c];
352
- if (O)
353
- return ee(F, m, g, M, 0, t);
354
- const [y, p, E] = rn(
355
- n,
356
- b,
357
- g,
358
- m,
359
- o
360
- );
361
- return ee(F, p, y, 0, E, t);
362
- }, rn = (t, e, n, s, o) => {
363
- const r = Math.max(e, n);
364
- let c = s, l = e;
365
- if (t) {
366
- const f = L(
367
- t,
368
- o
369
- );
370
- c = Math.max(f, s), l = Math.max(l, f);
371
- }
372
- return [r, c, l];
373
- }, ee = (t, e, n, s, o, r) => cn(r, t + e + n + s - o), cn = (t, e) => t == V ? { width: e, height: 0 } : { width: 0, height: e }, ne = (t, e) => {
374
- const {
375
- borderBeforeWidth: n,
376
- paddingBefore: s,
377
- axis: o,
378
- getRect: r
379
- } = B(t), c = L(e, n), l = L(e, s), f = r(e)[o];
380
- return c + l + f;
381
- }, an = (t, e) => {
382
- const [n, s] = nn(e), o = ne(tt, t);
383
- return [
384
- ne(V, t) - s,
385
- o - n
386
- ];
387
- };
388
- function ln(t, e, n, s, o, r, c, l, f) {
389
- let g = 0, m = 0;
390
- const b = !!(n < 0 && f);
391
- if (n === s && !b)
392
- return se(
393
- { height: g, width: m },
394
- t,
395
- o,
396
- c,
397
- b
398
- );
399
- const [M, O, F, y] = dn(e, n, s, f);
400
- if (b) {
401
- const [et, ut] = an(l, f);
402
- g += ut, m += et;
403
- }
404
- const {
405
- scrollElement: p,
406
- beforeMargin: E,
407
- afterMargin: R,
408
- distance: w,
409
- gap: P
410
- } = B(t), [X, Z] = Zt(l, P), [
411
- _,
412
- H,
413
- $
414
- ] = pn(
415
- E,
416
- R,
417
- M,
418
- O == null ? void 0 : O.previousElementSibling,
419
- y,
420
- Z,
421
- b
422
- ), [k, q, J] = gn(
423
- E,
424
- R,
425
- w,
426
- F,
427
- X,
428
- Z
429
- ), I = fn(
430
- q,
431
- k,
432
- J,
433
- H,
434
- _,
435
- X
436
- ), z = b ? l[p] : un(p, l, r), Y = (y ? I - $ : $ - I) - z;
437
- return t === tt ? g += Y : t === V && (m += Y), se(
438
- { height: g, width: m },
439
- t,
440
- o,
441
- c,
442
- b
443
- );
444
- }
445
- const un = (t, e, n) => {
446
- const s = e[t], o = n[t];
447
- return s - o;
448
- }, fn = (t, e, n, s, o, r) => {
449
- const c = Math.max(e, o);
450
- return Math.max(n, s) + t + c + r;
451
- }, dn = (t, e, n, s) => {
452
- const o = e < n, [r, c] = [e, n].toSorted(
453
- (m, b) => m - b
454
- ), l = t[e] ?? s, f = t[n];
455
- let g = o ? t.slice(r + 1, c + 1) : t.slice(r, c);
456
- return r < 0 && s && (g = t.slice(r + 1, c)), [
457
- l,
458
- f,
459
- g,
460
- o
461
- ];
462
- }, gn = (t, e, n, s, o, r) => {
463
- if (s.length == 0)
464
- return [0, 0, 0];
465
- const c = L(s[0], t);
466
- let l = 0, f = -c;
467
- for (const [g, m] of s.entries()) {
468
- const b = m.getBoundingClientRect()[n], M = L(m, t);
469
- r && (l += M), r && g > 0 ? l += o : l = Math.max(l, M), f += l + b, l = L(m, e);
470
- }
471
- return [c, f, l];
472
- }, se = (t, e, n, s, o) => {
473
- const { scroll: r, distance: c } = B(e), l = window[r], f = n[r], g = o ? 0 : f - 2 * l + s[r];
474
- return t[c] += g, t;
475
- }, pn = (t, e, n, s, o, r, c) => {
476
- const l = o ? n.previousElementSibling : s;
477
- return hn(
478
- t,
479
- e,
480
- l,
481
- n,
482
- r,
483
- c
484
- );
485
- }, hn = (t, e, n, s, o, r) => {
486
- if (o)
487
- return [0, 0, 0];
488
- const c = L(
489
- r ? null : n,
490
- e
491
- ), l = L(s, t);
492
- let f = Math.max(c, l);
493
- return [c, l, f];
494
- }, kt = (t, e, n, s = () => !0) => {
495
- const o = new MutationObserver((r) => {
496
- if (r = r.filter(s), r.length > 0) {
497
- const c = r[0];
498
- t(o, c);
499
- }
500
- });
501
- return o.observe(e, n), o;
502
- }, mn = "startDrag", ge = "cubic-bezier(0.2, 0, 0, 1)", pe = 50, qt = (t) => it(t) ? t.classList.contains(at) : !1, Sn = (t, e, n) => {
503
- let s = yt(
504
- e,
505
- mn,
506
- n,
507
- t
508
- );
509
- const o = sn(t, n), { distance: r } = B(n);
510
- s[r] -= o;
511
- const [c, l] = Dn(n, e);
512
- return s[l] = c, s;
513
- }, Dn = (t, e) => {
514
- const n = t == V ? tt : V, { distance: s, getRect: o } = B(n);
515
- return [
516
- o(e)[s],
517
- s
518
- ];
519
- }, ht = (t, e, n) => {
520
- Pe(t, e, n), t.style.minWidth = `${n}px`;
521
- }, vn = (t, e, n) => (s) => {
522
- e.contains(t) && (ht(t, n.height, n.width), s.disconnect());
523
- }, bn = (t, e) => {
524
- if (!e)
525
- return;
526
- const { droppable: n, config: s, scroll: o } = t, { direction: r } = s, c = Ze(s.direction, n, o) > 0.99, { scrollDistance: l, clientDistance: f, scrollElement: g } = B(r);
527
- c && (n[g] = n[l] - n[f]);
528
- }, he = (t, e, n, s) => {
529
- if (!n)
530
- return;
531
- const { droppable: o, config: r } = n, { direction: c, animationDuration: l } = r;
532
- if (bn(n, e), o.querySelector(`.${at}`) || !t)
533
- return;
534
- var f = t.tagName == "LI" ? "DIV" : t.tagName, g = document.createElement(f);
535
- st(g, at), ht(g, 0, 0);
536
- const m = Sn(o, t, c);
537
- return Pt(
538
- g,
539
- l,
540
- ge,
541
- "width, min-width, height"
542
- ), [g, m, o];
543
- }, Yt = (t, e, n, s, o) => {
544
- const r = he(t, n, s);
545
- if (!r)
546
- return;
547
- const [c, l, f] = r;
548
- e.isSameNode(f) && ht(c, l.height, l.width), kt(
549
- vn(c, f, l),
550
- f,
551
- {
552
- childList: !0,
553
- subtree: !0
554
- }
555
- ), f.appendChild(c);
556
- }, Tn = (t, e, n) => {
557
- const s = he(t, e, n);
558
- if (!s)
559
- return;
560
- const [o, r, c] = s;
561
- c.appendChild(o), En(o, r);
562
- }, En = (t, e) => requestAnimationFrame(() => {
563
- ht(t, e.height, e.width), requestAnimationFrame(() => {
564
- Pt(
565
- t,
566
- 0,
567
- ge,
568
- "width, min-width, height"
569
- );
570
- });
571
- }), yn = (t, e, n, s, o = !0) => {
572
- if (n) {
573
- var r = document.querySelectorAll(
574
- `${gt(n)} > .${at}`
575
- );
576
- r.forEach((c) => {
577
- const l = c.parentElement;
578
- if (l != null && l.isSameNode(e) || !o && (l != null && l.isSameNode(t)))
579
- return;
580
- ht(c, 0, 0), setTimeout(() => {
581
- var g;
582
- (g = c.parentNode) == null || g.removeChild(c);
583
- }, s + pe);
584
- });
585
- }
586
- }, vt = (t, e, n = !1) => {
587
- var s = t.querySelectorAll(`.${at}`);
588
- s.forEach((o) => {
589
- const r = o;
590
- n ? (ht(r, 0, 0), setTimeout(() => {
591
- t.contains(r) && t.removeChild(r);
592
- }, e + pe)) : t.removeChild(o);
593
- });
594
- }, Cn = 50;
595
- function An(t, e, n, s, o, r) {
596
- let c = e;
597
- const {
598
- direction: l,
599
- handlerSelector: f,
600
- onRemoveAtEvent: g,
601
- animationDuration: m,
602
- delayBeforeInsert: b,
603
- draggingClass: M
604
- } = t, O = (u, a, h, D, C) => {
605
- if (!D)
606
- return;
607
- const { droppable: T, config: v } = D, A = yt(
608
- u,
609
- a,
610
- v.direction,
611
- T
612
- );
613
- tn(a) ? Z(
614
- u,
615
- a,
616
- A,
617
- h,
618
- D,
619
- C
620
- ) : E(
621
- u,
622
- a,
623
- A,
624
- D
625
- );
626
- }, F = (u, a, h, D, C) => {
627
- const T = yt(
628
- a,
629
- "insert",
630
- t.direction,
631
- h
632
- ), { onInsertEvent: v } = t, A = ie(h);
633
- for (const [N, x] of A.entries())
634
- nt(x, U) && N >= u && X(x, T);
635
- C(), setTimeout(() => {
636
- v(u, D), me(u, h, t), et(a), W(a, n), vt(n, 0, !0);
637
- }, b);
638
- }, y = (u, a, h, D) => {
639
- if (!h || !h.droppable || !h.config)
640
- return;
641
- const { droppable: C, config: T } = h;
642
- let [v] = Mt(a, C);
643
- v = [a, ...v].toReversed();
644
- const A = yt(
645
- a,
646
- "remove",
647
- T.direction,
648
- C
649
- );
650
- for (const [N, x] of v.entries())
651
- N >= u && (P(x, A), setTimeout(() => {
652
- D(x);
653
- }, m));
654
- }, p = (u) => {
655
- vt(n, m, !0), setTimeout(() => {
656
- et(u), W(u, n);
657
- }, m);
658
- }, E = (u, a, h, D) => {
659
- const { config: C, droppable: T } = D, [v] = Mt(u, T), A = pt(u, T);
660
- v.length == 0 && w(
661
- h,
662
- 1,
663
- C.direction,
664
- v
665
- );
666
- for (const [N, x] of v.entries()) {
667
- if (!nt(x, U))
668
- continue;
669
- const G = R(
670
- C.direction,
671
- u,
672
- x,
673
- h
674
- );
675
- if (!A && G)
676
- h = G;
677
- else if (!A)
678
- continue;
679
- const K = v.length - N;
680
- w(
681
- h,
682
- K,
683
- C.direction,
684
- v
685
- ), a === fe ? P(x, h) : a === Nt && X(x, h);
686
- }
687
- }, R = (u, a, h, D) => {
688
- const { before: C, distance: T, axis: v, getRect: A } = B(u), N = A(a), x = A(h), G = N[C], K = x[C], mt = x[T], ft = K + mt / 2, St = Re(h)[v], rt = ft - St;
689
- return G > rt ? { height: 0, width: 0 } : D;
690
- }, w = (u, a, h, D) => {
691
- const C = D.filter(
692
- (v) => nt(v, U)
693
- ).length, { distance: T } = B(h);
694
- u[T] == 0 ? c = Math.max(c, a) : c = Math.min(c, a - 1), c = Math.min(c, C);
695
- }, P = (u, a) => {
696
- const { width: h, height: D } = a;
697
- Et(u, D, h);
698
- }, X = (u, a) => {
699
- const { width: h, height: D } = a;
700
- Et(u, D, h), Pt(u, m, de);
701
- }, Z = (u, a, h, D, C, T) => {
702
- const { droppable: v, scroll: A, config: N } = C, [x, G] = Mt(
703
- u,
704
- v
705
- ), K = x.toReversed(), mt = G === -1 ? K.length : G;
706
- K.splice(mt, 0, u);
707
- const [ft, St, rt] = _(
708
- u,
709
- G,
710
- K,
711
- v
712
- );
713
- h = yt(
714
- u,
715
- a,
716
- N.direction,
717
- n,
718
- ft,
719
- St
720
- );
721
- const $t = Be(), xt = ln(
722
- N.direction,
723
- K,
724
- G,
725
- rt,
726
- $t,
727
- A,
728
- D,
729
- v,
730
- u
731
- );
732
- x.length == 0 && H(
733
- void 0,
734
- h,
735
- u,
736
- xt
737
- );
738
- for (const [Gt, wt] of x.toReversed().entries()) {
739
- let Bt = h;
740
- rt - 1 >= Gt && (Bt = { height: 0, width: 0 }), a === jt && !nt(wt, at) && H(
741
- wt,
742
- Bt,
743
- u,
744
- xt
745
- );
746
- }
747
- $(
748
- rt,
749
- u,
750
- N,
751
- v,
752
- T
753
- );
754
- }, _ = (u, a, h, D) => {
755
- const T = pt(u, D) ? a : c, v = () => a < T ? [T, T + 1] : a > T ? [T - 1, T] : [T - 1, T + 1], [A, N] = v(), x = h[A] ?? null, G = h[N] ?? null;
756
- return [
757
- x,
758
- G,
759
- T
760
- ];
761
- }, H = (u, a, h, D) => {
762
- Et(u, a.height, a.width), Et(
763
- h,
764
- D.height,
765
- D.width
766
- );
767
- }, $ = (u, a, h, D, C) => {
768
- const { onInsertEvent: T, onDragEnd: v } = h;
769
- st(a, Vt), J(a, n, D, () => {
770
- if (Ct(a, Vt), C != null) {
771
- const A = g(C, !0);
772
- A != null && (T(u, A, !0), v({ value: A, index: u })), q(a), k();
773
- }
774
- });
775
- }, k = () => {
776
- if (s) {
777
- var u = document.querySelectorAll(
778
- `${gt(s)} > .${U}`
779
- );
780
- for (const a of u)
781
- Y(a);
782
- }
783
- }, q = (u) => {
784
- setTimeout(() => {
785
- Ct(u, M);
786
- }, Cn);
787
- }, J = (u, a, h, D) => {
788
- setTimeout(() => {
789
- D && D(), I(a, h), z(h), et(u), W(u, a), W(u, h);
790
- }, m);
791
- }, I = (u, a) => {
792
- u.isSameNode(a) ? vt(u, m) : (vt(u, m, !0), vt(a, m));
793
- }, z = (u) => {
794
- if (n.isSameNode(u))
795
- return;
796
- var [a] = n.querySelectorAll(`.${at}`);
797
- if (!a)
798
- return;
799
- const { distance: h } = B(l);
800
- it(a) && (a.style[h] = "0px");
801
- }, W = (u, a) => {
802
- const [h] = Mt(u, a);
803
- for (const D of [...h, u])
804
- Y(D);
805
- }, Y = (u) => {
806
- it(u) && (u.style.transition = "", u.style.transform = "");
807
- }, et = (u) => {
808
- r(), ot(u, !1), u.style.transform = "", u.style.transition = "", u.style.top = "", u.style.left = "", ue(u, {
809
- fixedHeight: "",
810
- fixedWidth: ""
811
- });
812
- }, ut = (u, a) => {
813
- const h = a.querySelector(f);
814
- bt(document.body, oe, u), bt(h || a, Wt, u);
815
- }, ot = (u, a) => {
816
- bt(u, Ft, a), ut(a, u), o.toggleGrabClass(!a);
817
- };
818
- return [
819
- O,
820
- y,
821
- F,
822
- p,
823
- ot
824
- ];
825
- }
826
- const xn = (t) => t.addedNodes.values().filter((n) => !qt(n)).toArray().length > 0, me = (t, e, n) => {
827
- const { insertingFromClass: s, animationDuration: o } = n, r = kt(() => {
828
- const l = ie(e)[t];
829
- st(l, s), st(l, Kt), setTimeout(() => {
830
- Ct(l, Kt), Ct(l, s), r.disconnect();
831
- }, o);
832
- }, e, {
833
- childList: !0
834
- }, xn);
835
- }, Nn = (t, e, n, s) => {
836
- if (!e)
837
- return;
838
- const { onInsertEvent: o, delayBeforeInsert: r } = t;
839
- setTimeout(() => {
840
- o(n, s), me(n, e, t);
841
- }, r);
842
- }, Q = class Q {
843
- static addConfig(e, n) {
844
- const s = Q.configs.filter(
845
- (r) => !r.droppable.isSameNode(e)
846
- ), o = Ut(e);
847
- s.push({
848
- droppable: e,
849
- config: n,
850
- scroll: o
851
- }), Q.configs = s;
852
- }
853
- static updateScrolls(e, n) {
854
- for (const s of Q.configs) {
855
- const { droppable: o } = s;
856
- (n && xe(o, n) || o.isSameNode(e)) && (s.scroll = Ut(o));
857
- }
858
- }
859
- static getConfig(e) {
860
- return Q.configs.find(
861
- ({ droppable: s }) => s.isSameNode(e)
862
- );
863
- }
864
- };
865
- j(Q, "configs", []), j(Q, "removeObsoleteConfigs", () => {
866
- const e = Q.configs.filter(
867
- ({ droppable: n }) => document.contains(n)
868
- );
869
- Q.configs = e;
870
- });
871
- let lt = Q;
872
- class wn {
873
- constructor(e, n, s, o, r, c) {
874
- j(this, "initial");
875
- j(this, "current");
876
- j(this, "parent");
877
- j(this, "draggableElement");
878
- j(this, "groupClass");
879
- j(this, "dragEvent");
880
- j(this, "changeDroppable");
881
- j(this, "mapFrom");
882
- this.parent = s, this.draggableElement = e, this.groupClass = n, this.dragEvent = o, this.mapFrom = c, this.initial = s ? lt.getConfig(s) : void 0, this.changeDroppable = r;
883
- }
884
- getDraggableAncestor(e, n, s) {
885
- return document.elementsFromPoint(e, n).filter((o) => !o.isSameNode(s));
886
- }
887
- getElementBelow(e, n, s = !0) {
888
- const o = (c) => {
889
- const [l] = c.getDraggableAncestor(
890
- n.clientX,
891
- n.clientY,
892
- e
893
- );
894
- return l;
895
- };
896
- let r = null;
897
- return s ? (e.hidden = !0, r = o(this), e.hidden = !1) : r = o(this), r;
898
- }
899
- getCurrent(e, n, s = !0) {
900
- const o = this.getElementBelow(e, n, s);
901
- return !this.groupClass || !o ? void 0 : o.closest(
902
- gt(this.groupClass)
903
- );
904
- }
905
- isOutsideOfAllDroppables(e) {
906
- return (this.groupClass ? Array.from(
907
- document.querySelectorAll(gt(this.groupClass))
908
- ) : [this.parent]).every(
909
- (s) => pt(e, s)
910
- );
911
- }
912
- isNotInsideAnotherDroppable(e, n) {
913
- return !pt(e, n) || this.isOutsideOfAllDroppables(e);
914
- }
915
- onScrollEvent() {
916
- this.dragEvent();
917
- }
918
- setOnScroll(e) {
919
- le(e, "onscroll", () => {
920
- this.onScrollEvent();
921
- });
922
- }
923
- getConfigFrom(e) {
924
- const n = lt.getConfig(e);
925
- if (n)
926
- return e.isSameNode(this.parent) ? n : {
927
- ...n,
928
- config: Ae(n, this.mapFrom)
929
- };
930
- }
931
- getCurrentConfig(e) {
932
- var o;
933
- const n = this.draggableElement;
934
- if (this.current && this.isNotInsideAnotherDroppable(
935
- n,
936
- (o = this.current) == null ? void 0 : o.droppable
937
- ))
938
- return this.current;
939
- const s = this.getCurrent(n, e);
940
- return s ? (it(s) && !s.onscroll && this.setOnScroll(s), this.getConfigFrom(s)) : this.getConfigFrom(this.parent);
941
- }
942
- updateConfig(e) {
943
- const n = this.current;
944
- this.current = this.getCurrentConfig(e), this.changeDroppable(this.current, n);
945
- }
946
- isOutside(e, n = !0) {
947
- const s = this.draggableElement;
948
- return !this.getCurrent(s, e, n);
949
- }
950
- }
951
- function Bn(t, e, n, s, o) {
952
- const {
953
- handlerSelector: r,
954
- isDraggable: c,
955
- droppableGroup: l,
956
- animationDuration: f,
957
- delayBeforeRemove: g,
958
- draggingClass: m,
959
- removingClass: b,
960
- onRemoveAtEvent: M,
961
- droppableClass: O,
962
- onDragStart: F
963
- } = n, y = At(l).map((i) => `droppable-group-${i}`).join(" ");
964
- let p = 0, E = {
965
- scrollX: 0,
966
- scrollY: 0
967
- }, R = { pageX: 0, pageY: 0 }, w, P;
968
- const [X, Z] = ke(
969
- t
970
- ), [
971
- _,
972
- H,
973
- $,
974
- k,
975
- q
976
- ] = An(
977
- n,
978
- e,
979
- s,
980
- y,
981
- o,
982
- () => p = 0
983
- /* NOT_DRAGGING */
984
- ), J = () => {
985
- st(t, U);
986
- }, I = (i) => {
987
- st(i, Lt), o.addSubscriber(i);
988
- }, z = () => {
989
- if (c(t)) {
990
- const i = t.querySelector(r);
991
- I(i || t);
992
- }
993
- }, W = () => {
994
- z(), J();
995
- }, Y = (i) => {
996
- const d = i == null ? void 0 : i.querySelector(`.${Lt}`), S = d == null ? void 0 : d.parentElement;
997
- return d && S && nt(S, Xt) && !S.isSameNode(s) ? null : d;
998
- }, et = (i) => {
999
- const d = Y(i) ?? i;
1000
- d && c(i) && (It(
1001
- d,
1002
- "onmousedown",
1003
- G("mousemove", "mouseup")
1004
- ), It(
1005
- d,
1006
- "ontouchstart",
1007
- G("touchmove", "touchend"),
1008
- (S) => {
1009
- P = {
1010
- x: S.touches[0].clientX,
1011
- y: S.touches[0].clientY
1012
- };
1013
- }
1014
- ), ut(d)), i != null && i.isSameNode(d) || It(i, "onmousedown", K), st(s, Xt);
1015
- }, ut = (i) => {
1016
- const d = i.querySelectorAll("img");
1017
- Array.from(d).forEach((S) => {
1018
- S.onmousedown = () => !1;
1019
- });
1020
- }, ot = () => {
1021
- if (R.pageX == 0 && R.pageY == 0 || !a.current)
1022
- return;
1023
- const { droppable: i, config: d } = a.current;
1024
- X(t, i, R, d.direction), _(
1025
- t,
1026
- Nt,
1027
- E,
1028
- a.current
1029
- );
1030
- }, u = (i, d) => {
1031
- d && p == 2 && !(i != null && i.droppable.isSameNode(d.droppable)) && _(
1032
- t,
1033
- Nt,
1034
- E,
1035
- d
1036
- );
1037
- }, a = new wn(
1038
- t,
1039
- y,
1040
- s,
1041
- ot,
1042
- u,
1043
- n.mapFrom
1044
- ), h = (i) => {
1045
- if (!a.current)
1046
- return;
1047
- const d = y ? Array.from(
1048
- document.querySelectorAll(gt(y))
1049
- ) : [s];
1050
- for (const S of d)
1051
- S.classList.toggle(
1052
- O,
1053
- !i && S.isSameNode(a.current.droppable)
1054
- );
1055
- }, D = (i, d = !1) => {
1056
- a.updateConfig(i);
1057
- const S = a.isOutside(i);
1058
- h(S), p === 1 && !d ? rt(i) : p === 2 && (C(S), xt(i));
1059
- }, C = (i = !0) => {
1060
- if (!a.current)
1061
- return;
1062
- const { droppable: d } = a.current;
1063
- yn(
1064
- d,
1065
- s,
1066
- y,
1067
- f,
1068
- i
1069
- ), !i && Yt(
1070
- t,
1071
- s,
1072
- p == 1,
1073
- a.current
1074
- );
1075
- }, T = (i) => {
1076
- if (Tt(i) && P && p == 1) {
1077
- const d = Math.abs(i.touches[0].clientX - P.x), S = Math.abs(i.touches[0].clientY - P.y);
1078
- if (Math.abs(d) > 5 && Math.abs(S) > 5)
1079
- return clearTimeout(w), !1;
1080
- }
1081
- return !0;
1082
- }, v = (i) => {
1083
- clearTimeout(w);
1084
- const d = _t(i);
1085
- if (Tt(i) && i.cancelable && i.preventDefault(), Tt(i) && !i.cancelable || !T(i)) {
1086
- ft("touchmove", i);
1087
- return;
1088
- }
1089
- D(d, Tt(i));
1090
- }, A = (i, d) => {
1091
- i == "touchmove" ? w = setTimeout(() => {
1092
- d();
1093
- }, 150) : d();
1094
- }, N = (i, d) => {
1095
- const { clientX: S, clientY: dt } = i, ct = document.elementFromPoint(S, dt), Dt = ct == null ? void 0 : ct.closest(`.${U}`);
1096
- return Dt && d.isSameNode(Dt);
1097
- }, x = (i) => {
1098
- const d = n.onGetValue(e);
1099
- return { index: e, element: i, value: d };
1100
- }, G = (i, d) => (S) => {
1101
- if (!N(S, t))
1102
- return;
1103
- lt.updateScrolls(s, y);
1104
- const { scrollX: dt, scrollY: ct } = window;
1105
- if (E = { scrollX: dt, scrollY: ct }, p === 0) {
1106
- p = 1;
1107
- const Dt = x(t);
1108
- Dt && F(Dt), A(i, () => {
1109
- i == "touchmove" && (a.updateConfig(S), h(a.isOutside(S)), rt(S));
1110
- }), document.addEventListener(i, v, {
1111
- passive: !1
1112
- }), Gt(s), document.addEventListener(d, mt(i), {
1113
- once: !0
1114
- });
1115
- }
1116
- }, K = (i) => a.updateConfig(i), mt = (i) => (d) => {
1117
- ft(i, d);
1118
- }, ft = (i, d) => {
1119
- h(!0);
1120
- const S = _t(d);
1121
- Bt(a.isOutside(S, !1)), clearTimeout(w), document.removeEventListener(i, v), a.updateConfig(S);
1122
- const dt = a.getCurrentConfig(S);
1123
- if (dt) {
1124
- const { droppable: ct } = dt;
1125
- St(ct);
1126
- }
1127
- s.onscroll = null;
1128
- }, St = (i) => {
1129
- if (i.onscroll = null, !y)
1130
- return;
1131
- const d = Array.from(
1132
- document.querySelectorAll(gt(y))
1133
- );
1134
- for (const S of d)
1135
- it(S) && (S.onscroll = null);
1136
- }, rt = (i) => {
1137
- Yt(
1138
- t,
1139
- s,
1140
- p == 1,
1141
- a.current
1142
- ), $t(), _(
1143
- t,
1144
- fe,
1145
- E,
1146
- a.current
1147
- ), Se(t), Z(i, t);
1148
- }, $t = () => {
1149
- p = 2;
1150
- }, xt = (i) => {
1151
- const { pageX: d, pageY: S } = i;
1152
- R = { pageX: d, pageY: S }, ot();
1153
- }, Gt = (i) => le(i, "onscroll", wt), wt = () => ot(), Bt = (i) => {
1154
- if (p !== 2 && p !== 1) {
1155
- p = 0;
1156
- return;
1157
- }
1158
- p = 3, Jt(t), t.classList.contains(Ft) && _(
1159
- t,
1160
- jt,
1161
- E,
1162
- i ? a.initial : a.current,
1163
- e
1164
- );
1165
- }, Jt = (i) => {
1166
- Pt(i, f, de), Et(i, 0, 0);
1167
- }, Se = (i) => {
1168
- const { height: d, width: S } = i.getBoundingClientRect();
1169
- ue(i, {
1170
- fixedHeight: `${d}px`,
1171
- fixedWidth: `${S}px`
1172
- }), q(i, !0), bt(i, m, !0), i.style.transition = "";
1173
- }, De = (i, d) => {
1174
- Ct(t, b), Yt(
1175
- t,
1176
- s,
1177
- p == 1,
1178
- a.initial
1179
- ), H(
1180
- i,
1181
- t,
1182
- d,
1183
- (S) => {
1184
- Jt(S), k(t);
1185
- }
1186
- ), M(e, !0);
1187
- }, ve = (i) => {
1188
- if (!a.initial)
1189
- return;
1190
- const d = a.initial;
1191
- i == e && (st(t, b), setTimeout(() => {
1192
- De(i, d);
1193
- }, g));
1194
- }, be = (i, d) => {
1195
- (i === e || i === n.onGetLegth() && e === i - 1) && $(
1196
- i,
1197
- t,
1198
- s,
1199
- d,
1200
- () => {
1201
- Tn(
1202
- t,
1203
- p == 1,
1204
- a.initial
1205
- );
1206
- }
1207
- );
1208
- };
1209
- return W(), et(t), [ve, be];
1210
- }
1211
- const Mn = (t, e) => {
1212
- t && we(e, t);
1213
- }, Rn = () => {
1214
- He(document.body, [
1215
- `.${U}{touch-action:manipulation;user-select:none;box-sizing:border-box!important;-webkit-user-select:none;}`,
1216
- `.${Lt}{pointer-events:auto!important;}`,
1217
- `.${ye}{cursor:grab;}`,
1218
- ".temp-child{touch-action:none;pointer-events:none;box-sizing:border-box!important;}",
1219
- ".droppable{box-sizing:border-box!important;}",
1220
- `.${Ft}{position:fixed;z-index:5000;width:var(--fixedWidth)!important;height:var(--fixedHeight)!important;}`,
1221
- `.${Wt}{pointer-events:none!important;}`,
1222
- `.${Vt}{pointer-events:none!important;}`,
1223
- `.${oe}{cursor:grabbing;}`,
1224
- ".disable-transition{transition:none!important;}"
1225
- ]);
1226
- };
1227
- function Ln(t, e, n, s = "index") {
1228
- const o = s;
1229
- let r = [], c = [];
1230
- const { droppableGroup: l } = t;
1231
- if (!n)
1232
- return [
1233
- r,
1234
- c
1235
- ];
1236
- const f = At(l).map((g) => `droppable-group-${g}`).join(" ");
1237
- Rn(), Mn(f, n);
1238
- for (const g of n.children) {
1239
- const m = g.getAttribute(o), b = Me(m), M = g;
1240
- if (M && b >= 0) {
1241
- const [O, F] = Bn(
1242
- M,
1243
- b,
1244
- t,
1245
- n,
1246
- e
1247
- );
1248
- r.push(O), c.push(F);
1249
- }
1250
- }
1251
- return [
1252
- r,
1253
- c
1254
- ];
1255
- }
1256
- function Fn(t, e, n, s = "index") {
1257
- let o = [], r = [], c;
1258
- const l = Ce(t, n), f = (p) => {
1259
- for (const E of o)
1260
- E(p);
1261
- }, g = (p, E) => {
1262
- if (l.onGetLegth() === 0)
1263
- t.insertToListEmpty(l, p, E);
1264
- else
1265
- for (const w of r)
1266
- w(p, E);
1267
- }, m = (p) => {
1268
- const [E, R] = Ln(l, e, p, s);
1269
- o = E, r = R;
1270
- }, b = (p) => {
1271
- const E = p.addedNodes.values().filter((w) => !qt(w)).toArray(), R = p.removedNodes.values().filter((w) => !qt(w)).toArray();
1272
- return E.length > 0 || R.length > 0;
1273
- }, M = (p) => {
1274
- c = kt(
1275
- () => {
1276
- m(p);
1277
- },
1278
- p,
1279
- { childList: !0 },
1280
- b
1281
- );
1282
- }, O = (p) => {
1283
- st(p, Xt);
1284
- }, F = (p) => {
1285
- lt.addConfig(
1286
- p,
1287
- l
1288
- );
1289
- };
1290
- return [f, g, (p) => {
1291
- if (p)
1292
- return O(p), F(p), M(p), m(p), lt.removeObsoleteConfigs(), c;
1293
- }];
1294
- }
1295
- export {
1296
- ye as G,
1297
- st as a,
1298
- Fn as d,
1299
- Nn as i,
1300
- bt as t
1301
- };