@vue-dnd-kit/core 2.0.9 → 2.0.11

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.
@@ -1,5 +1,5 @@
1
1
  (function(){"use strict";try{if(typeof document<"u"){var e=document.createElement("style");e.appendChild(document.createTextNode(".dnd-kit-default-overlay{transform:translate3d(var(--position-x),var(--position-y),0)}.dnd-kit-overlay-container{position:fixed;top:0;left:0;pointer-events:none;cursor:grabbing;z-index:9999}")),document.head.appendChild(e)}}catch(t){console.error("vite-plugin-css-injected-by-js",t)}})();
2
- import { ref as j, watch as re, shallowRef as te, reactive as q, computed as y, onScopeDispose as Je, onMounted as U, onBeforeUnmount as V, inject as Be, defineComponent as Fe, unref as k, openBlock as C, createElementBlock as J, normalizeStyle as Le, Fragment as he, renderList as Qe, createBlock as ne, resolveDynamicComponent as be, createCommentVNode as et, useTemplateRef as tt, provide as nt, renderSlot as Ce, Teleport as st, createElementVNode as ot, mergeProps as at } from "vue";
2
+ import { ref as j, watch as ie, shallowRef as te, reactive as q, computed as y, onScopeDispose as Je, onMounted as U, onBeforeUnmount as V, inject as Oe, defineComponent as Fe, unref as k, openBlock as C, createElementBlock as J, normalizeStyle as Le, Fragment as he, renderList as Qe, createBlock as ne, resolveDynamicComponent as be, createCommentVNode as et, useTemplateRef as tt, provide as nt, renderSlot as Ce, Teleport as st, createElementVNode as ot, mergeProps as at } from "vue";
3
3
  const T = {
4
4
  SELECT_AREA: "data-dnd-kit-select-area",
5
5
  DRAGGABLE: "data-dnd-kit-draggable",
@@ -9,26 +9,26 @@ const T = {
9
9
  SELECT_AREA: `[${T.SELECT_AREA}]`,
10
10
  DRAGGABLE: `[${T.DRAGGABLE}]`,
11
11
  CONSTRAINT_AREA: `[${T.CONSTRAINT_AREA}]`
12
- }, we = "VueDnDKitProvider", Ie = (e, t, s, n) => {
12
+ }, ve = "VueDnDKitProvider", Ie = (e, t, s, n) => {
13
13
  const o = /* @__PURE__ */ new Set();
14
- return t.forEach((r) => {
15
- const a = e.get(r), i = n ? n(r) : a?.disabled;
16
- if (!a || i) return;
14
+ return t.forEach((i) => {
15
+ const a = e.get(i), r = n ? n(i) : a?.disabled;
16
+ if (!a || r) return;
17
17
  const g = a.modifier?.keys, l = a.modifier?.method;
18
18
  if (!g || !l || g.length === 0) {
19
- o.add(r);
19
+ o.add(i);
20
20
  return;
21
21
  }
22
- g[l]((c) => s.value.has(c)) && o.add(r);
22
+ g[l]((c) => s.value.has(c)) && o.add(i);
23
23
  }), o;
24
24
  };
25
- let _e = "", rt = "", it = "";
25
+ let _e = "", it = "", rt = "";
26
26
  const D = (e) => e.value ? e.value instanceof HTMLElement ? e.value : e.value.$el : null, K = (e, t) => e !== t && e.contains(t), lt = (e, t) => !(e.right < t.left || e.left > t.right || e.bottom < t.top || e.top > t.bottom), ye = () => {
27
27
  const e = document.body;
28
28
  _e = e.style.userSelect, e.style.userSelect = "none", window.addEventListener("contextmenu", M), window.addEventListener("selectstart", M), window.addEventListener("touchstart", M), window.addEventListener("touchmove", M);
29
29
  }, pe = () => {
30
30
  const e = document.body;
31
- e.style.userSelect = _e, e.style.touchAction = rt, e.style.overscrollBehavior = it, window.removeEventListener("contextmenu", M), window.removeEventListener("selectstart", M), window.removeEventListener("touchstart", M), window.removeEventListener("touchmove", M);
31
+ e.style.userSelect = _e, e.style.touchAction = it, e.style.overscrollBehavior = rt, window.removeEventListener("contextmenu", M), window.removeEventListener("selectstart", M), window.removeEventListener("touchstart", M), window.removeEventListener("touchmove", M);
32
32
  }, M = (e) => e.preventDefault(), xe = (e, t) => {
33
33
  if (t.entities.draggableMap.get(e)?.disabled) return !0;
34
34
  for (const n of t.entities.visibleDraggableSet)
@@ -46,29 +46,29 @@ const D = (e) => e.value ? e.value instanceof HTMLElement ? e.value : e.value.$e
46
46
  };
47
47
  function ct(e, t, s, n) {
48
48
  const o = /* @__PURE__ */ new Set();
49
- for (const i of t.keys()) {
50
- const g = s.get(i);
49
+ for (const r of t.keys()) {
50
+ const g = s.get(r);
51
51
  for (const l of g?.groups ?? []) o.add(l);
52
52
  }
53
- const r = [...o], a = /* @__PURE__ */ new Set();
54
- for (const i of e) {
55
- const l = n.get(i)?.groups ?? [];
56
- Ae(r, l) && a.add(i);
53
+ const i = [...o], a = /* @__PURE__ */ new Set();
54
+ for (const r of e) {
55
+ const l = n.get(r)?.groups ?? [];
56
+ Ae(i, l) && a.add(r);
57
57
  }
58
58
  return a;
59
59
  }
60
60
  function gt(e, t, s) {
61
61
  const n = /* @__PURE__ */ new Set();
62
62
  for (const a of t.keys()) {
63
- const i = s.get(a);
64
- for (const g of i?.groups ?? []) n.add(g);
63
+ const r = s.get(a);
64
+ for (const g of r?.groups ?? []) n.add(g);
65
65
  }
66
- const o = [...n], r = /* @__PURE__ */ new Set();
66
+ const o = [...n], i = /* @__PURE__ */ new Set();
67
67
  for (const a of e) {
68
68
  const g = s.get(a)?.groups ?? [];
69
- Ae(o, g) && r.add(a);
69
+ Ae(o, g) && i.add(a);
70
70
  }
71
- return r;
71
+ return i;
72
72
  }
73
73
  const ge = (e) => {
74
74
  const t = new IntersectionObserver((s) => {
@@ -86,8 +86,8 @@ const ge = (e) => {
86
86
  const t = new ResizeObserver((s) => {
87
87
  const n = s[0];
88
88
  if (!n) return;
89
- const { width: o, height: r } = n.contentRect;
90
- e.value = { width: o, height: r };
89
+ const { width: o, height: i } = n.contentRect;
90
+ e.value = { width: o, height: i };
91
91
  });
92
92
  return {
93
93
  observe: (s) => t.observe(s),
@@ -95,10 +95,10 @@ const ge = (e) => {
95
95
  disconnect: () => t.disconnect()
96
96
  };
97
97
  }, ft = (e) => {
98
- const t = j(null), s = ut(t), n = re(
98
+ const t = j(null), s = ut(t), n = ie(
99
99
  e,
100
- (r) => {
101
- s.disconnect(), r && s.observe(r);
100
+ (i) => {
101
+ s.disconnect(), i && s.observe(i);
102
102
  },
103
103
  { immediate: !0 }
104
104
  );
@@ -163,12 +163,12 @@ function bt(e, t) {
163
163
  }
164
164
  const {
165
165
  x: o = 0,
166
- y: r = 0,
166
+ y: i = 0,
167
167
  condition: a = "any"
168
168
  } = t;
169
- if (o === 0 && r === 0) return 1;
170
- const i = o > 0 ? Math.min(s / o, 1) : 1, g = r > 0 ? Math.min(n / r, 1) : 1;
171
- return a === "both" ? Math.min(i, g) : Math.max(i, g);
169
+ if (o === 0 && i === 0) return 1;
170
+ const r = o > 0 ? Math.min(s / o, 1) : 1, g = i > 0 ? Math.min(n / i, 1) : 1;
171
+ return a === "both" ? Math.min(r, g) : Math.max(r, g);
172
172
  }
173
173
  function Ze(e, t, s) {
174
174
  if (!s) return !0;
@@ -196,13 +196,13 @@ function pt(e, t) {
196
196
  }
197
197
  const o = e.entities.draggableMap.get(
198
198
  e.entities.initiatingDraggable
199
- ), r = o?.activation?.delay;
200
- if (!r) {
199
+ ), i = o?.activation?.delay;
200
+ if (!i) {
201
201
  s = null;
202
202
  return;
203
203
  }
204
204
  e.delay.progress = Math.min(
205
- (Date.now() - e.delay.startTime) / (r * 1e3),
205
+ (Date.now() - e.delay.startTime) / (i * 1e3),
206
206
  1
207
207
  ), Ze(
208
208
  e.distanceProgress.value,
@@ -229,20 +229,20 @@ function Dt(e, t, s, n) {
229
229
  return s === "x" ? { x: e, y: n.top } : s === "y" ? { x: n.left, y: t } : { x: e, y: t };
230
230
  }
231
231
  function Mt(e, t, s, n, o) {
232
- let r = e, a = t;
233
- return s !== "y" && (r = Math.max(
232
+ let i = e, a = t;
233
+ return s !== "y" && (i = Math.max(
234
234
  n.left,
235
235
  Math.min(n.right - o.width, e)
236
236
  )), s !== "x" && (a = Math.max(
237
237
  n.top,
238
238
  Math.min(n.bottom - o.height, t)
239
- )), { x: r, y: a };
239
+ )), { x: i, y: a };
240
240
  }
241
- function vt(e, t, s, n, o) {
241
+ function wt(e, t, s, n, o) {
242
242
  if (!e || !t)
243
243
  return { x: 0, y: 0 };
244
- const r = t.getBoundingClientRect(), a = r.width || o?.width || 0, i = r.height || o?.height || 0;
245
- let g = e.current.x - a * e.offset.x, l = e.current.y - i * e.offset.y;
244
+ const i = t.getBoundingClientRect(), a = i.width || o?.width || 0, r = i.height || o?.height || 0;
245
+ let g = e.current.x - a * e.offset.x, l = e.current.y - r * e.offset.y;
246
246
  if (!s)
247
247
  return { x: g, y: l };
248
248
  const u = St(s, n);
@@ -259,7 +259,7 @@ function vt(e, t, s, n, o) {
259
259
  h.y,
260
260
  f.axis || "both",
261
261
  d,
262
- r
262
+ i
263
263
  ) : h;
264
264
  }
265
265
  const N = {
@@ -278,8 +278,8 @@ const N = {
278
278
  ],
279
279
  forMoveFaster: ["ShiftLeft", "ShiftRight"]
280
280
  };
281
- function wt(e, t) {
282
- const s = te(), n = j(), r = {
281
+ function vt(e, t) {
282
+ const s = te(), n = j(), i = {
283
283
  keys: {
284
284
  pressedKeys: j(/* @__PURE__ */ new Set()),
285
285
  forDrag: [...N.forDrag],
@@ -299,6 +299,7 @@ function wt(e, t) {
299
299
  selectingArea: void 0,
300
300
  draggingMap: /* @__PURE__ */ new Map(),
301
301
  selectedSet: /* @__PURE__ */ new Set(),
302
+ selectionBase: /* @__PURE__ */ new Set(),
302
303
  allowedDroppableSet: y(() => s.value ? ct(
303
304
  a.visibleDroppableSet,
304
305
  a.draggingMap,
@@ -313,18 +314,18 @@ function wt(e, t) {
313
314
  modifiersSelectableAreaSet: y(() => Ie(
314
315
  a.selectableAreaMap,
315
316
  a.visibleSelectableAreaSet,
316
- r.keys.pressedKeys
317
+ i.keys.pressedKeys
317
318
  )),
318
319
  modifiersDraggableSet: y(() => Ie(
319
320
  a.draggableMap,
320
321
  a.visibleDraggableSet,
321
- r.keys.pressedKeys,
322
- (w) => xe(w, { entities: a })
322
+ i.keys.pressedKeys,
323
+ (v) => xe(v, { entities: a })
323
324
  )),
324
325
  visibleDraggableSet: /* @__PURE__ */ new Set(),
325
326
  visibleDroppableSet: /* @__PURE__ */ new Set(),
326
327
  visibleSelectableAreaSet: /* @__PURE__ */ new Set()
327
- }), i = q({
328
+ }), r = q({
328
329
  draggable: /* @__PURE__ */ new Map(),
329
330
  droppable: /* @__PURE__ */ new Map()
330
331
  }), g = {
@@ -337,17 +338,17 @@ function wt(e, t) {
337
338
  startTime: 0
338
339
  }), c = y(() => {
339
340
  if (!n.value || !a.initiatingDraggable) return 0;
340
- const w = a.draggableMap.get(a.initiatingDraggable)?.activation?.distance;
341
- return w ? bt(n.value, w) : 1;
341
+ const v = a.draggableMap.get(a.initiatingDraggable)?.activation?.distance;
342
+ return v ? bt(n.value, v) : 1;
342
343
  }), f = ge(
343
344
  a.visibleDraggableSet
344
345
  ), d = ge(
345
346
  a.visibleDroppableSet
346
347
  ), m = ge(
347
348
  a.visibleSelectableAreaSet
348
- ), { overlaySize: h, overlaySizeObserver: S } = ft(e), b = j(), v = y(() => {
349
+ ), { overlaySize: h, overlaySizeObserver: S } = ft(e), b = j(), w = y(() => {
349
350
  const p = a.initiatingDraggable;
350
- return vt(
351
+ return wt(
351
352
  n.value,
352
353
  e.value,
353
354
  p || null,
@@ -362,15 +363,15 @@ function wt(e, t) {
362
363
  state: s,
363
364
  pointer: n,
364
365
  entities: a,
365
- keyboard: r,
366
+ keyboard: i,
366
367
  scrollPosition: l,
367
368
  delay: u,
368
369
  distanceProgress: c,
369
- hovered: i,
370
+ hovered: r,
370
371
  collision: g,
371
372
  overlay: {
372
373
  size: h,
373
- position: v,
374
+ position: w,
374
375
  render: b,
375
376
  ref: e,
376
377
  to: E
@@ -396,7 +397,7 @@ const oe = (e) => {
396
397
  const n = e.entities.droppableMap.get(s);
397
398
  n && (n.hoveredPlacement = void 0);
398
399
  }
399
- e.lib.rectCache.clear(), e.pointer.value = void 0, e.state.value = void 0, e.entities.selectingArea = void 0, e.entities.initiatingDraggable = void 0, e.delay.progress = 0, e.delay.startTime = 0, e.entities.draggingMap.clear(), e.hovered.draggable.clear(), e.hovered.droppable.clear();
400
+ e.lib.rectCache.clear(), e.pointer.value = void 0, e.state.value = void 0, e.entities.selectingArea = void 0, e.entities.selectionBase.clear(), e.entities.initiatingDraggable = void 0, e.delay.progress = 0, e.delay.startTime = 0, e.entities.draggingMap.clear(), e.hovered.draggable.clear(), e.hovered.droppable.clear();
400
401
  };
401
402
  function I(e, t, s) {
402
403
  const n = Math.max(0, Math.min(t, e.length));
@@ -407,7 +408,7 @@ function Ee(e, t, s = 1) {
407
408
  return [...e.slice(0, n), ...e.slice(n + o)];
408
409
  }
409
410
  function H(e, t) {
410
- const s = [...new Set(t)].filter((o) => o >= 0 && o < e.length).sort((o, r) => r - o);
411
+ const s = [...new Set(t)].filter((o) => o >= 0 && o < e.length).sort((o, i) => i - o);
411
412
  let n = e;
412
413
  for (const o of s) n = Ee(n, o, 1);
413
414
  return n;
@@ -432,12 +433,12 @@ const R = {
432
433
  function Ye(e, t) {
433
434
  const { draggedItems: s, dropZone: n, hoveredDraggable: o } = e;
434
435
  if (!s.length) return null;
435
- const r = o?.placement.center === !0 && n != null && n.items !== o.items, a = r ? n.items : o?.items ?? n?.items;
436
+ const i = o?.placement.center === !0 && n != null && n.items !== o.items, a = i ? n.items : o?.items ?? n?.items;
436
437
  if (!a) return null;
437
- const i = s[0].items, g = s.map((f) => f.index), l = a.length;
438
+ const r = s[0].items, g = s.map((f) => f.index), l = a.length;
438
439
  let u, c;
439
- if (o && !r) {
440
- const f = o.items === i && g.includes(o.index);
440
+ if (o && !i) {
441
+ const f = o.items === r && g.includes(o.index);
441
442
  if (f && s.length === 1) {
442
443
  const d = R.isAtZoneStart(n?.placement, t);
443
444
  u = d ? 0 : l, c = d ? "prepend" : "append";
@@ -461,47 +462,47 @@ function xt(e, t = "vertical") {
461
462
  if (!s.length) return null;
462
463
  const n = Ye(e, t);
463
464
  if (!n) return null;
464
- const { targetArr: o, mode: r } = n;
465
+ const { targetArr: o, mode: i } = n;
465
466
  let { targetIndex: a } = n;
466
- const i = s.map((c) => c.index), g = s.map((c) => c.item), l = s[0].items;
467
+ const r = s.map((c) => c.index), g = s.map((c) => c.item), l = s[0].items;
467
468
  if (l === o) {
468
- const c = i.filter((d) => d < a).length;
469
+ const c = r.filter((d) => d < a).length;
469
470
  a = Math.max(0, a - c);
470
- const f = I(H(l, i), a, g);
471
- return { sourceItems: f, targetItems: f, draggedItems: g, sourceIndexes: i, targetIndex: a, mode: r, sameList: !0 };
471
+ const f = I(H(l, r), a, g);
472
+ return { sourceItems: f, targetItems: f, draggedItems: g, sourceIndexes: r, targetIndex: a, mode: i, sameList: !0 };
472
473
  } else {
473
- const c = H(l, i), f = I(o, a, g);
474
- return { sourceItems: c, targetItems: f, draggedItems: g, sourceIndexes: i, targetIndex: a, mode: r, sameList: !1 };
474
+ const c = H(l, r), f = I(o, a, g);
475
+ return { sourceItems: c, targetItems: f, draggedItems: g, sourceIndexes: r, targetIndex: a, mode: i, sameList: !1 };
475
476
  }
476
477
  }
477
478
  function At(e) {
478
479
  const { draggedItems: t, hoveredDraggable: s } = e;
479
480
  if (!t.length || !s) return null;
480
- const n = t.map((u) => u.index), o = s.index, r = t.map((u) => u.item), a = s.item, i = t[0].items, g = s.items, l = i === g;
481
+ const n = t.map((u) => u.index), o = s.index, i = t.map((u) => u.item), a = s.item, r = t[0].items, g = s.items, l = r === g;
481
482
  if (l && n.includes(o)) return null;
482
483
  if (t.length === 1) {
483
484
  const u = n[0];
484
485
  if (l) {
485
- const c = Ne(i, u, o);
486
+ const c = Ne(r, u, o);
486
487
  return { sourceItems: c, targetItems: c, sourceIndexes: n, targetIndex: o, sameList: !0 };
487
488
  } else {
488
- const c = [...i], f = [...g];
489
- return c[u] = g[o], f[o] = i[u], { sourceItems: c, targetItems: f, sourceIndexes: n, targetIndex: o, sameList: !1 };
489
+ const c = [...r], f = [...g];
490
+ return c[u] = g[o], f[o] = r[u], { sourceItems: c, targetItems: f, sourceIndexes: n, targetIndex: o, sameList: !1 };
490
491
  }
491
492
  } else {
492
493
  const u = Math.min(...n);
493
494
  if (l) {
494
495
  const c = n.filter((b) => b < o).length, f = Math.max(0, o - c), d = n.filter((b) => b < u).length, m = Math.max(0, u - d);
495
- let h = H(i, n);
496
- h = I(h, f, r);
497
- const S = m >= f ? m + r.length : m;
496
+ let h = H(r, n);
497
+ h = I(h, f, i);
498
+ const S = m >= f ? m + i.length : m;
498
499
  return h = I(h, S, [a]), { sourceItems: h, targetItems: h, sourceIndexes: n, targetIndex: f, sameList: !0 };
499
500
  } else {
500
501
  const c = n.filter((h) => h < u).length, f = Math.max(0, u - c);
501
- let d = H(i, n);
502
+ let d = H(r, n);
502
503
  d = I(d, f, [a]);
503
504
  let m = Ee(g, o);
504
- return m = I(m, o, r), { sourceItems: d, targetItems: m, sourceIndexes: n, targetIndex: o, sameList: !1 };
505
+ return m = I(m, o, i), { sourceItems: d, targetItems: m, sourceIndexes: n, targetIndex: o, sameList: !1 };
505
506
  }
506
507
  }
507
508
  }
@@ -510,8 +511,8 @@ function Et(e, t = "vertical") {
510
511
  if (!s.length) return null;
511
512
  const n = Ye(e, t);
512
513
  if (!n) return null;
513
- const { targetArr: o, targetIndex: r, mode: a } = n, i = s.map((l) => l.item);
514
- return { targetItems: I(o, r, i), copiedItems: i, targetIndex: r, mode: a };
514
+ const { targetArr: o, targetIndex: i, mode: a } = n, r = s.map((l) => l.item);
515
+ return { targetItems: I(o, i, r), copiedItems: r, targetIndex: i, mode: a };
515
516
  }
516
517
  function Lt(e) {
517
518
  const { draggedItems: t } = e;
@@ -548,10 +549,10 @@ function Rt(e) {
548
549
  return s?.data ? [{ index: -1, item: void 0, items: [], data: s.data() }] : [];
549
550
  const o = n();
550
551
  if (!Array.isArray(o) || o.length < 2) return [];
551
- const [r, a] = o, i = Number(r), g = a, l = /* @__PURE__ */ new Map();
552
- return l.set(i, {
553
- index: i,
554
- item: g[i],
552
+ const [i, a] = o, r = Number(i), g = a, l = /* @__PURE__ */ new Map();
553
+ return l.set(r, {
554
+ index: r,
555
+ item: g[r],
555
556
  items: g,
556
557
  data: s?.data?.()
557
558
  }), e.entities.draggingMap.forEach((u, c) => {
@@ -574,13 +575,13 @@ const A = (e, t) => {
574
575
  const s = Rt(e);
575
576
  let n, o;
576
577
  if (t) {
577
- const r = e.entities.droppableMap.get(t);
578
- if (r) {
579
- const g = r.payload;
578
+ const i = e.entities.droppableMap.get(t);
579
+ if (i) {
580
+ const g = i.payload;
580
581
  n = {
581
582
  items: g ? g() : [],
582
583
  placement: e.hovered.droppable.get(t),
583
- data: r.data?.()
584
+ data: i.data?.()
584
585
  };
585
586
  }
586
587
  const a = P(e.hovered.draggable);
@@ -661,9 +662,9 @@ const A = (e, t) => {
661
662
  function zt(e) {
662
663
  return e.parentElement?.closest(_.SELECT_AREA) ?? null;
663
664
  }
664
- const Ot = (e, t, s) => {
665
+ const Bt = (e, t, s) => {
665
666
  if (!s) return {};
666
- const n = s.getBoundingClientRect(), o = Math.max(n.left, Math.min(e.x, t.x)), r = Math.max(n.top, Math.min(e.y, t.y)), a = Math.min(n.right, Math.max(e.x, t.x)), i = Math.min(n.bottom, Math.max(e.y, t.y)), g = Math.max(0, a - o), l = Math.max(0, i - r), u = o - n.left + s.scrollLeft, c = r - n.top + s.scrollTop;
667
+ const n = s.getBoundingClientRect(), o = Math.max(n.left, Math.min(e.x, t.x)), i = Math.max(n.top, Math.min(e.y, t.y)), a = Math.min(n.right, Math.max(e.x, t.x)), r = Math.min(n.bottom, Math.max(e.y, t.y)), g = Math.max(0, a - o), l = Math.max(0, r - i), u = o - n.left + s.scrollLeft, c = i - n.top + s.scrollTop;
667
668
  return {
668
669
  position: "absolute",
669
670
  left: `${u}px`,
@@ -676,32 +677,34 @@ const Ot = (e, t, s) => {
676
677
  };
677
678
  }, Ue = (e) => {
678
679
  if (!e.pointer.value || !e.entities.selectingArea) return;
679
- const { selectingArea: t } = e.entities, s = Bt(
680
+ const { selectingArea: t } = e.entities, s = Ot(
680
681
  e.pointer.value.start,
681
682
  e.pointer.value.current
682
683
  ), n = e.entities.selectableAreaMap.get(t)?.groups ?? [], o = e.lib.rectCache;
683
- e.entities.visibleDraggableSet.forEach((r) => {
684
- if (r === t || !t.contains(r)) return;
685
- const a = zt(r);
684
+ e.entities.visibleDraggableSet.forEach((i) => {
685
+ if (i === t || !t.contains(i)) return;
686
+ const a = zt(i);
686
687
  if (a && a !== t) {
687
- e.entities.selectedSet.delete(r);
688
+ e.entities.selectedSet.delete(i);
688
689
  return;
689
690
  }
690
- if (xe(r, e)) {
691
- e.entities.selectedSet.delete(r);
691
+ if (xe(i, e)) {
692
+ e.entities.selectedSet.delete(i);
692
693
  return;
693
694
  }
694
- const g = e.entities.draggableMap.get(r)?.groups ?? [];
695
+ const g = e.entities.draggableMap.get(i)?.groups ?? [];
695
696
  if (!Ae(n, g)) {
696
- e.entities.selectedSet.delete(r);
697
+ e.entities.selectedSet.delete(i);
697
698
  return;
698
699
  }
699
- let l = o.get(r);
700
- l || (l = r.getBoundingClientRect(), o.set(r, l)), lt(s, l) ? e.entities.selectedSet.add(r) : e.entities.selectedSet.delete(r);
700
+ let l = o.get(i);
701
+ l || (l = i.getBoundingClientRect(), o.set(i, l));
702
+ const u = e.entities.selectionBase.has(i);
703
+ lt(s, l) ? u ? e.entities.selectedSet.delete(i) : e.entities.selectedSet.add(i) : u ? e.entities.selectedSet.add(i) : e.entities.selectedSet.delete(i);
701
704
  });
702
- }, Bt = (e, t) => {
703
- const s = Math.min(e.x, t.x), n = Math.min(e.y, t.y), o = Math.max(e.x, t.x), r = Math.max(e.y, t.y), a = o - s, i = r - n;
704
- return new DOMRect(s, n, a, i);
705
+ }, Ot = (e, t) => {
706
+ const s = Math.min(e.x, t.x), n = Math.min(e.y, t.y), o = Math.max(e.x, t.x), i = Math.max(e.y, t.y), a = o - s, r = i - n;
707
+ return new DOMRect(s, n, a, r);
705
708
  }, Ft = (e, t, s = 5) => {
706
709
  const n = s / 2;
707
710
  return {
@@ -713,10 +716,10 @@ const Ot = (e, t, s) => {
713
716
  }, _t = (e) => {
714
717
  const t = e.pointer.value?.current, s = t?.x ?? 0, n = t?.y ?? 0;
715
718
  return Ft(s, n, 5);
716
- }, O = (e, t, s) => {
719
+ }, B = (e, t, s) => {
717
720
  const n = e.left + e.width / 2, o = e.top + e.height / 2;
718
721
  if (s) {
719
- const i = s.top ?? 0, g = s.right ?? 0, l = s.bottom ?? 0, u = s.left ?? 0, c = t.left + u, f = t.right - g, d = t.top + i, m = t.bottom - l;
722
+ const r = s.top ?? 0, g = s.right ?? 0, l = s.bottom ?? 0, u = s.left ?? 0, c = t.left + u, f = t.right - g, d = t.top + r, m = t.bottom - l;
720
723
  if (c < f && d < m && n >= c && n <= f && o >= d && o <= m)
721
724
  return {
722
725
  top: !1,
@@ -726,12 +729,12 @@ const Ot = (e, t, s) => {
726
729
  center: !0
727
730
  };
728
731
  }
729
- const r = t.left + t.width / 2, a = t.top + t.height / 2;
732
+ const i = t.left + t.width / 2, a = t.top + t.height / 2;
730
733
  return {
731
734
  top: o <= a,
732
735
  bottom: o > a,
733
- left: n <= r,
734
- right: n > r,
736
+ left: n <= i,
737
+ right: n > i,
735
738
  center: !1
736
739
  };
737
740
  }, Gt = (e) => ({
@@ -750,9 +753,9 @@ function W(e, t) {
750
753
  const Kt = (e, t) => e.find((s) => s !== t && K(t, s)), ae = (e, t, s) => {
751
754
  const n = P(t.droppable), o = P(t.draggable);
752
755
  o && t.draggable.delete(o), n && t.droppable.delete(n);
753
- const r = _t(e), a = s.zones[0], i = s.elements[0];
754
- if (a && i && a === i && e.entities.droppableMap.has(a) && a) {
755
- const c = a.getBoundingClientRect(), f = e.entities.draggableMap.get(a)?.placementMargins, d = O(r, c, f);
756
+ const i = _t(e), a = s.zones[0], r = s.elements[0];
757
+ if (a && r && a === r && e.entities.droppableMap.has(a) && a) {
758
+ const c = a.getBoundingClientRect(), f = e.entities.draggableMap.get(a)?.placementMargins, d = B(i, c, f);
756
759
  if (d.center) {
757
760
  t.droppable.set(a, d);
758
761
  const m = Kt(s.elements, a);
@@ -760,40 +763,40 @@ const Kt = (e, t) => e.find((s) => s !== t && K(t, s)), ae = (e, t, s) => {
760
763
  const h = m.getBoundingClientRect();
761
764
  t.draggable.set(
762
765
  m,
763
- O(r, h, void 0)
766
+ B(i, h, void 0)
764
767
  );
765
768
  }
766
769
  } else
767
- t.draggable.set(i, d);
770
+ t.draggable.set(r, d);
768
771
  } else {
769
772
  if (a) {
770
773
  const c = a.getBoundingClientRect();
771
- t.droppable.set(a, O(r, c));
774
+ t.droppable.set(a, B(i, c));
772
775
  }
773
- if (i)
776
+ if (r)
774
777
  if (a)
775
- if (K(a, i)) {
776
- const c = i.getBoundingClientRect(), f = e.entities.draggableMap.get(i)?.placementMargins;
778
+ if (K(a, r)) {
779
+ const c = r.getBoundingClientRect(), f = e.entities.draggableMap.get(r)?.placementMargins;
777
780
  t.draggable.set(
778
- i,
779
- O(r, c, f)
781
+ r,
782
+ B(i, c, f)
780
783
  );
781
784
  } else {
782
- const c = e.pointer.value?.current ?? { x: 0, y: 0 }, f = a.getBoundingClientRect(), d = i.getBoundingClientRect(), m = Re(c, f);
785
+ const c = e.pointer.value?.current ?? { x: 0, y: 0 }, f = a.getBoundingClientRect(), d = r.getBoundingClientRect(), m = Re(c, f);
783
786
  if (Re(c, d) < m) {
784
787
  t.droppable.clear();
785
- const S = e.entities.draggableMap.get(i)?.placementMargins;
788
+ const S = e.entities.draggableMap.get(r)?.placementMargins;
786
789
  t.draggable.set(
787
- i,
788
- O(r, d, S)
790
+ r,
791
+ B(i, d, S)
789
792
  );
790
793
  }
791
794
  }
792
795
  else {
793
- const c = i.getBoundingClientRect(), f = e.entities.draggableMap.get(i)?.placementMargins;
796
+ const c = r.getBoundingClientRect(), f = e.entities.draggableMap.get(r)?.placementMargins;
794
797
  t.draggable.set(
795
- i,
796
- O(r, c, f)
798
+ r,
799
+ B(i, c, f)
797
800
  );
798
801
  }
799
802
  }
@@ -839,31 +842,31 @@ const Kt = (e, t) => e.find((s) => s !== t && K(t, s)), ae = (e, t, s) => {
839
842
  ), n = Math.max(
840
843
  0,
841
844
  Math.min(e.y + e.height, t.y + t.height) - Math.max(e.y, t.y)
842
- ), o = s * n, r = e.width * e.height, a = t.width * t.height;
843
- return r === 0 || a === 0 ? 0 : (o / r * 100 + o / a * 100) / 2;
845
+ ), o = s * n, i = e.width * e.height, a = t.width * t.height;
846
+ return i === 0 || a === 0 ? 0 : (o / i * 100 + o / a * 100) / 2;
844
847
  }, Nt = (e, t, s) => t >= e.x && t <= e.x + e.width && s >= e.y && s <= e.y + e.height, Yt = (e) => e.overlay.ref?.value ?? null, ke = (e) => {
845
848
  const t = e.overlay.position?.value ?? { x: 0, y: 0 }, { x: s, y: n } = t, o = e.overlay.size?.value;
846
- let r, a;
849
+ let i, a;
847
850
  if (o)
848
- r = o.width, a = o.height;
851
+ i = o.width, a = o.height;
849
852
  else {
850
- const i = e.overlay.ref?.value?.getBoundingClientRect();
851
- r = i?.width ?? 0, a = i?.height ?? 0;
853
+ const r = e.overlay.ref?.value?.getBoundingClientRect();
854
+ i = r?.width ?? 0, a = r?.height ?? 0;
852
855
  }
853
856
  return {
854
857
  x: s,
855
858
  y: n,
856
- width: r,
859
+ width: i,
857
860
  height: a,
858
861
  top: n,
859
862
  left: s,
860
- right: s + r,
863
+ right: s + i,
861
864
  bottom: n + a
862
865
  };
863
866
  }, De = (e) => e.entities.allowedDraggableSet, Ve = (e) => e.entities.allowedDroppableSet, Xt = (e, t) => !t.entities.draggingMap.has(e), Ut = (e, t) => ![...t.entities.draggingMap.keys()].some(
864
867
  (s) => K(s, e)
865
868
  ), Vt = (e, t) => t.entities.draggableMap.has(e) ? !xe(e, t) : t.entities.droppableMap.has(e) ? !G(e, t) : !0, ee = (e, t) => Xt(e, t) && Ut(e, t) && Vt(e, t), de = 10;
866
- function B(e, t) {
869
+ function O(e, t) {
867
870
  return Math.hypot(
868
871
  t.x - (e.x + e.width / 2),
869
872
  t.y - (e.y + e.height / 2)
@@ -872,11 +875,11 @@ function B(e, t) {
872
875
  function $t(e) {
873
876
  const t = e.pointer.value?.current ?? { x: 0, y: 0 }, s = document.elementFromPoint(t.x, t.y);
874
877
  if (!s) return null;
875
- const n = De(e), o = Ve(e), r = [], a = [];
876
- let i = s;
877
- for (; i; )
878
- (n.has(i) || o.has(i)) && ee(i, e) && (n.has(i) && r.push(i), o.has(i) && a.push(i)), i = i.parentElement;
879
- return r.length === 0 && a.length === 0 ? null : { elements: r, zones: a };
878
+ const n = De(e), o = Ve(e), i = [], a = [];
879
+ let r = s;
880
+ for (; r; )
881
+ (n.has(r) || o.has(r)) && ee(r, e) && (n.has(r) && i.push(r), o.has(r) && a.push(r)), r = r.parentElement;
882
+ return i.length === 0 && a.length === 0 ? null : { elements: i, zones: a };
880
883
  }
881
884
  const Me = (e) => {
882
885
  if (!Yt(e)) return { elements: [], zones: [] };
@@ -890,20 +893,20 @@ const Me = (e) => {
890
893
  (d) => l.contains(d) && ee(d, e)
891
894
  ).map((d) => ({ el: d, box: X(d) })).filter(
892
895
  ({ box: d }) => fe(d, u) && Q(d, u) >= de
893
- ).sort((d, m) => B(d.box, s) - B(m.box, s)).map(({ el: d }) => d), zones: n.zones };
896
+ ).sort((d, m) => O(d.box, s) - O(m.box, s)).map(({ el: d }) => d), zones: n.zones };
894
897
  }
895
- const o = ke(e), r = [...De(e)].filter(
898
+ const o = ke(e), i = [...De(e)].filter(
896
899
  (l) => ee(l, e)
897
900
  ), a = [...Ve(e)].filter(
898
901
  (l) => ee(l, e)
899
- ), i = r.map((l) => ({ n: l, box: X(l) })).filter(
902
+ ), r = i.map((l) => ({ n: l, box: X(l) })).filter(
900
903
  ({ box: l }) => fe(l, o) && Q(l, o) >= de
901
- ).sort((l, u) => B(l.box, s) - B(u.box, s)).map(({ n: l }) => l), g = a.map((l) => ({ n: l, box: X(l) })).filter(
904
+ ).sort((l, u) => O(l.box, s) - O(u.box, s)).map(({ n: l }) => l), g = a.map((l) => ({ n: l, box: X(l) })).filter(
902
905
  ({ box: l }) => fe(l, o) && Q(l, o) >= de
903
- ).sort((l, u) => B(l.box, s) - B(u.box, s)).map(({ n: l }) => l);
904
- return { elements: i, zones: g };
906
+ ).sort((l, u) => O(l.box, s) - O(u.box, s)).map(({ n: l }) => l);
907
+ return { elements: r, zones: g };
905
908
  };
906
- function ve(e) {
909
+ function we(e) {
907
910
  if (e.collision?.run) {
908
911
  const s = e.collision.run(e);
909
912
  ae(e, e.hovered, s);
@@ -915,11 +918,11 @@ function ve(e) {
915
918
  function qt(e, t) {
916
919
  const s = e.collision?.throttle?.value ?? 0;
917
920
  if (s <= 0) {
918
- ve(e);
921
+ we(e);
919
922
  return;
920
923
  }
921
924
  const n = Date.now();
922
- n - t.value >= s && (t.value = n, ve(e));
925
+ n - t.value >= s && (t.value = n, we(e));
923
926
  }
924
927
  async function $e(e) {
925
928
  const t = e.hovered.droppable.keys().next().value;
@@ -931,8 +934,8 @@ async function $e(e) {
931
934
  try {
932
935
  a = await o;
933
936
  } catch {
934
- const i = e.entities.initiatingDraggable;
935
- return F(e, i, "onSelfDragCancel"), x(e, "onDragCancel"), Xe(e, e.hovered), "cancel";
937
+ const r = e.entities.initiatingDraggable;
938
+ return F(e, r, "onSelfDragCancel"), x(e, "onDragCancel"), Xe(e, e.hovered), "cancel";
936
939
  }
937
940
  return a === !1 ? (e.state.value = "dragging", "decline") : "accept";
938
941
  }
@@ -953,20 +956,20 @@ const jt = (e) => {
953
956
  current: null
954
957
  }, s = { value: 0 }, n = async () => {
955
958
  pe(), t.current?.cancel(), t.current = null;
956
- const i = e.state.value;
957
- if (i === "dragging") {
959
+ const r = e.state.value;
960
+ if (r === "dragging") {
958
961
  const g = await $e(e);
959
962
  if (g === "accept" && qe(e), g === "accept" || g === "cancel") {
960
963
  oe(e), document.removeEventListener("pointerup", n), document.removeEventListener("pointermove", o);
961
964
  return;
962
965
  }
963
966
  return;
964
- } else i === "selecting" && Wt(e);
967
+ } else r === "selecting" && Wt(e);
965
968
  oe(e), document.removeEventListener("pointerup", n), document.removeEventListener("pointermove", o);
966
- }, o = (i) => {
969
+ }, o = (r) => {
967
970
  if (e.pointer.value) {
968
- if (e.pointer.value.current = { x: i.clientX, y: i.clientY }, yt(e)) {
969
- ue(e, i, "onSelfDragStart"), x(e, "onDragStart");
971
+ if (e.pointer.value.current = { x: r.clientX, y: r.clientY }, yt(e)) {
972
+ ue(e, r, "onSelfDragStart"), x(e, "onDragStart");
970
973
  return;
971
974
  }
972
975
  if (e.state.value === "dragging") {
@@ -977,15 +980,15 @@ const jt = (e) => {
977
980
  e.state.value === "selecting" && Ue(e);
978
981
  }
979
982
  };
980
- return { pointerDown: (i) => {
983
+ return { pointerDown: (r) => {
981
984
  document.addEventListener("pointerup", n), document.addEventListener("pointermove", o);
982
- const g = i.target, l = g.closest(
985
+ const g = r.target, l = g.closest(
983
986
  _.SELECT_AREA
984
987
  ), u = g.closest(
985
988
  _.DRAGGABLE
986
989
  );
987
990
  if (e.entities.modifiersSelectableAreaSet.size > 0 && e.entities.modifiersSelectableAreaSet.has(l)) {
988
- ye(), e.pointer.value = Se(i), e.state.value = "selecting", e.entities.selectingArea = l;
991
+ ye(), e.pointer.value = Se(r), e.state.value = "selecting", e.entities.selectingArea = l, e.entities.selectionBase = new Set(e.entities.selectedSet);
989
992
  return;
990
993
  }
991
994
  if (e.entities.modifiersDraggableSet.size > 0 && e.entities.modifiersDraggableSet.has(u)) {
@@ -993,10 +996,10 @@ const jt = (e) => {
993
996
  if (!Ke(g, u, c?.dragHandle))
994
997
  return;
995
998
  ye(), e.entities.initiatingDraggable = u;
996
- const f = Ge(i, u);
997
- e.pointer.value = Se(i, f.x, f.y), c?.activation?.distance || c?.activation?.delay ? (e.state.value = "activating", c?.activation?.delay && (e.delay.startTime = Date.now(), t.current = pt(e, () => {
998
- se(e), ue(e, i, "onSelfDragStart"), x(e, "onDragStart");
999
- }))) : (se(e), ue(e, i, "onSelfDragStart"), x(e, "onDragStart"));
999
+ const f = Ge(r, u);
1000
+ e.pointer.value = Se(r, f.x, f.y), c?.activation?.distance || c?.activation?.delay ? (e.state.value = "activating", c?.activation?.delay && (e.delay.startTime = Date.now(), t.current = pt(e, () => {
1001
+ se(e), ue(e, r, "onSelfDragStart"), x(e, "onDragStart");
1002
+ }))) : (se(e), ue(e, r, "onSelfDragStart"), x(e, "onDragStart"));
1000
1003
  }
1001
1004
  }, pointerUp: n, pointerMove: o, cleanup: () => {
1002
1005
  t.current?.cancel(), document.removeEventListener("pointerup", n), document.removeEventListener("pointermove", o), e.lib.draggableObserver.disconnect(), e.lib.droppableObserver.disconnect(), e.lib.selectableAreaObserver.disconnect(), e.lib.overlaySizeObserver.disconnect();
@@ -1028,9 +1031,9 @@ const jt = (e) => {
1028
1031
  const o = Jt[t.code];
1029
1032
  if (o && s.forMove.includes(t.code) && e.pointer.value) {
1030
1033
  t.preventDefault();
1031
- const r = s.forMoveFaster.some(
1034
+ const i = s.forMoveFaster.some(
1032
1035
  (l) => s.pressedKeys.value.has(l)
1033
- ), a = e.keyboard.step * (r ? e.keyboard.moveFaster : 1);
1036
+ ), a = e.keyboard.step * (i ? e.keyboard.moveFaster : 1);
1034
1037
  e.pointer.value.current = {
1035
1038
  x: e.pointer.value.current.x + o.dx * a,
1036
1039
  y: e.pointer.value.current.y + o.dy * a
@@ -1048,28 +1051,28 @@ const jt = (e) => {
1048
1051
  if (s.forDrag.includes(t.code)) {
1049
1052
  const o = document.activeElement;
1050
1053
  if (!o) return;
1051
- const r = o.closest(
1054
+ const i = o.closest(
1052
1055
  _.DRAGGABLE
1053
1056
  );
1054
- if (!r || e.entities.modifiersDraggableSet.size === 0 || !e.entities.modifiersDraggableSet.has(r))
1057
+ if (!i || e.entities.modifiersDraggableSet.size === 0 || !e.entities.modifiersDraggableSet.has(i))
1055
1058
  return;
1056
- const a = e.entities.draggableMap.get(r);
1057
- if (!Ke(o, r, a?.dragHandle, !0))
1059
+ const a = e.entities.draggableMap.get(i);
1060
+ if (!Ke(o, i, a?.dragHandle, !0))
1058
1061
  return;
1059
1062
  t.preventDefault(), ye();
1060
- const i = r.getBoundingClientRect(), g = i.left + i.width / 2, l = i.top + i.height / 2, u = {
1063
+ const r = i.getBoundingClientRect(), g = r.left + r.width / 2, l = r.top + r.height / 2, u = {
1061
1064
  clientX: g,
1062
1065
  clientY: l
1063
1066
  };
1064
- e.entities.initiatingDraggable = r;
1065
- const c = Ge(u, r);
1067
+ e.entities.initiatingDraggable = i;
1068
+ const c = Ge(u, i);
1066
1069
  e.pointer.value = Se(
1067
1070
  u,
1068
1071
  c.x,
1069
1072
  c.y
1070
1073
  ), se(e);
1071
1074
  const d = (e.collision?.run ?? Me)(e);
1072
- ae(e, e.hovered, d), F(e, r, "onSelfDragStart"), x(e, "onDragStart");
1075
+ ae(e, e.hovered, d), F(e, i, "onSelfDragStart"), x(e, "onDragStart");
1073
1076
  }
1074
1077
  }, en = (e) => (t) => {
1075
1078
  e.keyboard.keys.pressedKeys.value.delete(t.code);
@@ -1083,7 +1086,7 @@ const jt = (e) => {
1083
1086
  if (!e.state.value) return;
1084
1087
  const t = e.scrollPosition.x, s = e.scrollPosition.y;
1085
1088
  if (e.scrollPosition.x = window.scrollX, e.scrollPosition.y = window.scrollY, e.lib.rectCache.clear(), e.state.value === "dragging") {
1086
- ve(e);
1089
+ we(e);
1087
1090
  return;
1088
1091
  }
1089
1092
  if (e.state.value === "selecting" && e.pointer.value) {
@@ -1121,13 +1124,13 @@ const an = {
1121
1124
  }
1122
1125
  };
1123
1126
  function We(e, t, s, n = an, o) {
1124
- const { speed: r = 10, disabled: a = !1 } = t, i = on(t.threshold);
1127
+ const { speed: i = 10, disabled: a = !1 } = t, r = on(t.threshold);
1125
1128
  let g = null, l = null, u = null, c = 0, f = 0;
1126
1129
  const d = (b) => {
1127
1130
  o && (o.value = b);
1128
1131
  }, m = (b) => {
1129
- const v = e.value, E = s();
1130
- if (!v || !E || a) {
1132
+ const w = e.value, E = s();
1133
+ if (!w || !E || a) {
1131
1134
  d(!1);
1132
1135
  return;
1133
1136
  }
@@ -1137,12 +1140,12 @@ function We(e, t, s, n = an, o) {
1137
1140
  g = requestAnimationFrame(m);
1138
1141
  return;
1139
1142
  }
1140
- const p = r * ($ / Pe);
1143
+ const p = i * ($ / Pe);
1141
1144
  l = b;
1142
- const { scrollTop: w, scrollLeft: Z } = n.getScrollState(v);
1143
- (!u || c !== w || f !== Z) && (u = n.getRect ? n.getRect(v) : v.getBoundingClientRect(), c = w, f = Z);
1144
- let z = !1, le = w, ce = Z;
1145
- i.top > 0 && E.y - u.top < i.top ? (le = w - p, z = !0) : i.bottom > 0 && u.bottom - E.y < i.bottom && (le = w + p, z = !0), i.left > 0 && E.x - u.left < i.left ? (ce = Z - p, z = !0) : i.right > 0 && u.right - E.x < i.right && (ce = Z + p, z = !0), z && n.setScroll(v, le, ce), d(z), g = requestAnimationFrame(m);
1145
+ const { scrollTop: v, scrollLeft: Z } = n.getScrollState(w);
1146
+ (!u || c !== v || f !== Z) && (u = n.getRect ? n.getRect(w) : w.getBoundingClientRect(), c = v, f = Z);
1147
+ let z = !1, le = v, ce = Z;
1148
+ r.top > 0 && E.y - u.top < r.top ? (le = v - p, z = !0) : r.bottom > 0 && u.bottom - E.y < r.bottom && (le = v + p, z = !0), r.left > 0 && E.x - u.left < r.left ? (ce = Z - p, z = !0) : r.right > 0 && u.right - E.x < r.right && (ce = Z + p, z = !0), z && n.setScroll(w, le, ce), d(z), g = requestAnimationFrame(m);
1146
1149
  };
1147
1150
  return { run: () => {
1148
1151
  l = null, g = requestAnimationFrame(m);
@@ -1174,47 +1177,47 @@ function cn(e, t) {
1174
1177
  t ?? {},
1175
1178
  () => {
1176
1179
  if (e.state.value !== "dragging") return null;
1177
- const i = e.overlay.position.value, g = e.overlay.size.value;
1178
- return i ? g?.width && g?.height ? {
1179
- x: i.x + g.width / 2,
1180
- y: i.y + g.height / 2
1181
- } : i : null;
1180
+ const r = e.overlay.position.value, g = e.overlay.size.value;
1181
+ return r ? g?.width && g?.height ? {
1182
+ x: r.x + g.width / 2,
1183
+ y: r.y + g.height / 2
1184
+ } : r : null;
1182
1185
  },
1183
1186
  rn,
1184
1187
  s
1185
- ), r = re(
1188
+ ), i = ie(
1186
1189
  () => e.state.value,
1187
- (i) => {
1188
- i === "dragging" ? o.run() : o.stop();
1190
+ (r) => {
1191
+ r === "dragging" ? o.run() : o.stop();
1189
1192
  }
1190
1193
  ), a = () => {
1191
- r(), o.stop();
1194
+ i(), o.stop();
1192
1195
  };
1193
1196
  return Je(a), { isScrolling: s, stop: a };
1194
1197
  }
1195
1198
  const gn = (e) => {
1196
- const t = jt(e), s = me.keyDown(e), n = me.keyUp(e), o = me.clear(e), r = nn(e);
1199
+ const t = jt(e), s = me.keyDown(e), n = me.keyUp(e), o = me.clear(e), i = nn(e);
1197
1200
  let a = null;
1198
- re(
1201
+ ie(
1199
1202
  e.autoScrollViewport,
1200
- (i) => {
1201
- a?.(), a = null, (i === !0 || i && typeof i == "object") && (a = cn(
1203
+ (r) => {
1204
+ a?.(), a = null, (r === !0 || r && typeof r == "object") && (a = cn(
1202
1205
  e,
1203
- i === !0 ? {} : i
1206
+ r === !0 ? {} : r
1204
1207
  ).stop);
1205
1208
  },
1206
1209
  { immediate: !0 }
1207
1210
  ), U(() => {
1208
- document.addEventListener("pointerdown", t.pointerDown), document.addEventListener("keydown", s), document.addEventListener("keyup", n), document.addEventListener("blur", o), document.addEventListener("scroll", r, !0);
1211
+ document.addEventListener("pointerdown", t.pointerDown), document.addEventListener("keydown", s), document.addEventListener("keyup", n), document.addEventListener("blur", o), document.addEventListener("scroll", i, !0);
1209
1212
  }), V(() => {
1210
- document.removeEventListener("pointerdown", t.pointerDown), document.removeEventListener("pointerup", t.pointerUp), document.removeEventListener("pointermove", t.pointerMove), document.removeEventListener("keydown", s), document.removeEventListener("keyup", n), document.removeEventListener("blur", o), document.removeEventListener("scroll", r, !0), a?.(), t.cleanup();
1213
+ document.removeEventListener("pointerdown", t.pointerDown), document.removeEventListener("pointerup", t.pointerUp), document.removeEventListener("pointermove", t.pointerMove), document.removeEventListener("keydown", s), document.removeEventListener("keyup", n), document.removeEventListener("blur", o), document.removeEventListener("scroll", i, !0), a?.(), t.cleanup();
1211
1214
  });
1212
- }, ie = () => {
1213
- const e = Be(we);
1215
+ }, re = () => {
1216
+ const e = Oe(ve);
1214
1217
  if (!e) throw Error("DnD provider not found");
1215
1218
  return e;
1216
1219
  }, je = () => {
1217
- const e = ie();
1220
+ const e = re();
1218
1221
  return {
1219
1222
  overlay: e.overlay,
1220
1223
  delay: e.delay,
@@ -1232,7 +1235,7 @@ const gn = (e) => {
1232
1235
  __name: "DefaultOverlay",
1233
1236
  setup(e) {
1234
1237
  const { entities: t, state: s, overlay: n } = je();
1235
- return (o, r) => k(s) === "dragging" ? (C(), J("div", {
1238
+ return (o, i) => k(s) === "dragging" ? (C(), J("div", {
1236
1239
  key: 0,
1237
1240
  class: "dnd-kit-default-overlay",
1238
1241
  style: Le({
@@ -1240,13 +1243,13 @@ const gn = (e) => {
1240
1243
  "--position-y": k(n).position.value.y + "px"
1241
1244
  })
1242
1245
  }, [
1243
- (C(!0), J(he, null, Qe(k(t).draggingMap, ([a, i]) => (C(), J(he, null, [
1246
+ (C(!0), J(he, null, Qe(k(t).draggingMap, ([a, r]) => (C(), J(he, null, [
1244
1247
  k(t).draggableMap.get(a)?.render ? (C(), ne(be(k(t).draggableMap.get(a)?.render), { key: 0 })) : (C(), ne(be(a.tagName), {
1245
1248
  key: 1,
1246
- innerHTML: i.initialOuterHTML,
1249
+ innerHTML: r.initialOuterHTML,
1247
1250
  style: Le({
1248
- width: i.initialRect.width + "px",
1249
- height: i.initialRect.height + "px"
1251
+ width: r.initialRect.width + "px",
1252
+ height: r.initialRect.height + "px"
1250
1253
  })
1251
1254
  }, null, 8, ["innerHTML", "style"]))
1252
1255
  ], 64))), 256))
@@ -1261,13 +1264,13 @@ const gn = (e) => {
1261
1264
  class: {}
1262
1265
  },
1263
1266
  setup(e) {
1264
- const t = e, s = tt("overlayRef"), n = wt(s, t);
1267
+ const t = e, s = tt("overlayRef"), n = vt(s, t);
1265
1268
  gn(n);
1266
1269
  const o = y(
1267
1270
  () => n.overlay.render.value ?? un
1268
1271
  );
1269
- return nt(we, n), (r, a) => (C(), J(he, null, [
1270
- Ce(r.$slots, "default"),
1272
+ return nt(ve, n), (i, a) => (C(), J(he, null, [
1273
+ Ce(i.$slots, "default"),
1271
1274
  (C(), ne(st, {
1272
1275
  to: k(n).overlay.to.value || "body"
1273
1276
  }, [
@@ -1276,7 +1279,7 @@ const gn = (e) => {
1276
1279
  ref: s,
1277
1280
  class: "dnd-kit-overlay-container"
1278
1281
  }, t), [
1279
- Ce(r.$slots, "overlay", { overlay: o.value }, () => [
1282
+ Ce(i.$slots, "overlay", { overlay: o.value }, () => [
1280
1283
  (C(), ne(be(o.value)))
1281
1284
  ])
1282
1285
  ], 16)
@@ -1285,10 +1288,10 @@ const gn = (e) => {
1285
1288
  }
1286
1289
  });
1287
1290
  function bn(e, t, s) {
1288
- const n = ie();
1289
- let o, r, a;
1290
- typeof t == "function" ? (o = {}, r = t) : (o = t ?? {}, r = s);
1291
- const i = y({
1291
+ const n = re();
1292
+ let o, i, a;
1293
+ typeof t == "function" ? (o = {}, i = t) : (o = t ?? {}, i = s);
1294
+ const r = y({
1292
1295
  get() {
1293
1296
  const c = D(e);
1294
1297
  return c ? n.entities.selectedSet.has(c) : !1;
@@ -1315,7 +1318,7 @@ function bn(e, t, s) {
1315
1318
  groups: o.groups ?? [],
1316
1319
  modifier: o.modifier,
1317
1320
  events: o.events,
1318
- payload: r,
1321
+ payload: i,
1319
1322
  data: o.data,
1320
1323
  dragHandle: o.dragHandle,
1321
1324
  activation: o.activation,
@@ -1325,14 +1328,14 @@ function bn(e, t, s) {
1325
1328
  }), V(() => {
1326
1329
  a && (n.lib.draggableObserver.unobserve(a), n.entities.visibleDraggableSet.delete(a), n.entities.draggableMap.delete(a), n.entities.modifiersDraggableSet.delete(a));
1327
1330
  }), {
1328
- selected: i,
1331
+ selected: r,
1329
1332
  isDragging: g,
1330
1333
  isAllowed: l,
1331
1334
  isDragOver: u
1332
1335
  };
1333
1336
  }
1334
1337
  const yn = (e, t) => {
1335
- const s = ie(), n = y(() => e.value === s.entities.selectingArea);
1338
+ const s = re(), n = y(() => e.value === s.entities.selectingArea);
1336
1339
  let o = null;
1337
1340
  U(() => {
1338
1341
  o = D(e), o && (o.setAttribute(T.SELECT_AREA, ""), s.lib.selectableAreaObserver.observe(o), s.entities.selectableAreaMap.set(o, {
@@ -1347,18 +1350,18 @@ const yn = (e, t) => {
1347
1350
  }), V(() => {
1348
1351
  o && (s.lib.selectableAreaObserver.unobserve(o), s.entities.visibleSelectableAreaSet.delete(o), s.entities.modifiersSelectableAreaSet.delete(o), s.entities.selectableAreaMap.delete(o));
1349
1352
  });
1350
- const r = y(() => {
1353
+ const i = y(() => {
1351
1354
  s.scrollPosition.x, s.scrollPosition.y;
1352
1355
  const a = s.pointer.value;
1353
- return !a || s.state.value !== "selecting" || !o || !n.value ? {} : Ot(a.start, a.current, o);
1356
+ return !a || s.state.value !== "selecting" || !o || !n.value ? {} : Bt(a.start, a.current, o);
1354
1357
  });
1355
1358
  return {
1356
1359
  isSelecting: n,
1357
- style: r
1360
+ style: i
1358
1361
  };
1359
1362
  };
1360
1363
  function pn(e, t) {
1361
- const s = Be(we);
1364
+ const s = Oe(ve);
1362
1365
  if (!s) throw Error("DnD provider not found");
1363
1366
  let n = null;
1364
1367
  return U(() => {
@@ -1371,10 +1374,10 @@ function pn(e, t) {
1371
1374
  }), {};
1372
1375
  }
1373
1376
  function Sn(e, t, s) {
1374
- const n = ie();
1375
- let o = null, r, a;
1376
- typeof t == "function" ? (r = {}, a = t) : (r = t ?? {}, a = s);
1377
- const i = y(() => {
1377
+ const n = re();
1378
+ let o = null, i, a;
1379
+ typeof t == "function" ? (i = {}, a = t) : (i = t ?? {}, a = s);
1380
+ const r = y(() => {
1378
1381
  const l = D(e);
1379
1382
  return l ? n.entities.allowedDroppableSet.has(l) : !1;
1380
1383
  }), g = y(() => {
@@ -1384,39 +1387,39 @@ function Sn(e, t, s) {
1384
1387
  });
1385
1388
  return U(() => {
1386
1389
  o = D(e), o && (o.setAttribute(T.DROPPABLE, ""), n.lib.droppableObserver.observe(o), n.entities.droppableMap.set(o, {
1387
- disabled: r.disabled ?? !1,
1388
- groups: r.groups ?? [],
1389
- events: r.events,
1390
+ disabled: i.disabled ?? !1,
1391
+ groups: i.groups ?? [],
1392
+ events: i.events,
1390
1393
  payload: a,
1391
- data: r.data,
1394
+ data: i.data,
1392
1395
  hoveredPlacement: void 0
1393
1396
  }));
1394
1397
  }), V(() => {
1395
1398
  o && (n.lib.droppableObserver.unobserve(o), n.entities.visibleDroppableSet.delete(o), n.entities.droppableMap.delete(o));
1396
1399
  }), {
1397
- isAllowed: i,
1400
+ isAllowed: r,
1398
1401
  isDragOver: g
1399
1402
  };
1400
1403
  }
1401
1404
  const Dn = (e, t) => {
1402
- const s = je(), n = te(!1), r = We(
1405
+ const s = je(), n = te(!1), i = We(
1403
1406
  e,
1404
1407
  t ?? {},
1405
1408
  () => {
1406
1409
  if (s.state.value !== "dragging") return null;
1407
- const a = s.overlay.position.value, i = s.overlay.size.value;
1408
- return a ? i?.width && i?.height ? {
1409
- x: a.x + i.width / 2,
1410
- y: a.y + i.height / 2
1410
+ const a = s.overlay.position.value, r = s.overlay.size.value;
1411
+ return a ? r?.width && r?.height ? {
1412
+ x: a.x + r.width / 2,
1413
+ y: a.y + r.height / 2
1411
1414
  } : a : null;
1412
1415
  },
1413
1416
  void 0,
1414
1417
  n
1415
1418
  );
1416
- return re(
1419
+ return ie(
1417
1420
  () => s.state.value,
1418
1421
  (a) => {
1419
- a === "dragging" ? r.run() : r.stop();
1422
+ a === "dragging" ? i.run() : i.stop();
1420
1423
  }
1421
1424
  ), { isScrolling: n };
1422
1425
  };
@@ -1426,37 +1429,37 @@ function Te(e, t) {
1426
1429
  function Mn(e, t) {
1427
1430
  const s = t && "grid" in t && t.grid != null, n = t ? s ? t.grid : t.gridX : 1, o = t ? s ? t.grid : t.gridY : 1;
1428
1431
  return y(() => {
1429
- const { x: r, y: a } = e.value;
1432
+ const { x: i, y: a } = e.value;
1430
1433
  return {
1431
- x: Te(r, n),
1434
+ x: Te(i, n),
1432
1435
  y: Te(a, o)
1433
1436
  };
1434
1437
  });
1435
1438
  }
1436
- const ze = () => !0, Oe = () => 0, fn = "separate", dn = () => {
1439
+ const ze = () => !0, Be = () => 0, fn = "separate", dn = () => {
1437
1440
  const e = {
1438
1441
  filterElements: ze,
1439
1442
  filterZones: ze,
1440
- sortElements: Oe,
1441
- sortZones: Oe,
1443
+ sortElements: Be,
1444
+ sortZones: Be,
1442
1445
  mergeStrategy: fn,
1443
1446
  pickClosestBetweenFirst: !1
1444
- }, t = (n, o, r, a, i, g, l) => {
1445
- const u = a instanceof Set ? a : new Set(a), c = { containerBox: o, pointer: r }, f = e.minOverlapPercent, d = [];
1447
+ }, t = (n, o, i, a, r, g, l) => {
1448
+ const u = a instanceof Set ? a : new Set(a), c = { containerBox: o, pointer: i }, f = e.minOverlapPercent, d = [];
1446
1449
  for (const m of u) {
1447
- if (!i(m, n)) continue;
1450
+ if (!r(m, n)) continue;
1448
1451
  const h = X(m);
1449
1452
  if (!l(h, c)) continue;
1450
1453
  const S = Q(h, o);
1451
1454
  if (f !== void 0 && S < f) continue;
1452
1455
  let b = 0;
1453
- for (const v of u)
1454
- v !== m && K(v, m) && b++;
1456
+ for (const w of u)
1457
+ w !== m && K(w, m) && b++;
1455
1458
  d.push({
1456
1459
  node: m,
1457
1460
  box: h,
1458
1461
  meta: {
1459
- isPointerInElement: Nt(h, r.x, r.y),
1462
+ isPointerInElement: Nt(h, i.x, i.y),
1460
1463
  overlapPercent: S,
1461
1464
  depth: b,
1462
1465
  centerDistance: Zt(
@@ -1511,12 +1514,12 @@ const ze = () => !0, Oe = () => 0, fn = "separate", dn = () => {
1511
1514
  "sensor: container, elements, zones, collision are required"
1512
1515
  );
1513
1516
  return (o) => {
1514
- const r = n.container(o);
1515
- if (!r) return { elements: [], zones: [] };
1516
- const a = n.containerBox ? n.containerBox(o) : X(r), i = o.pointer.value?.current ?? { x: 0, y: 0 }, g = t(
1517
+ const i = n.container(o);
1518
+ if (!i) return { elements: [], zones: [] };
1519
+ const a = n.containerBox ? n.containerBox(o) : X(i), r = o.pointer.value?.current ?? { x: 0, y: 0 }, g = t(
1517
1520
  o,
1518
1521
  a,
1519
- i,
1522
+ r,
1520
1523
  n.elements(o),
1521
1524
  n.filterElements,
1522
1525
  n.sortElements,
@@ -1524,7 +1527,7 @@ const ze = () => !0, Oe = () => 0, fn = "separate", dn = () => {
1524
1527
  ), l = t(
1525
1528
  o,
1526
1529
  a,
1527
- i,
1530
+ r,
1528
1531
  n.zones(o),
1529
1532
  n.filterZones,
1530
1533
  n.sortZones,
@@ -1549,8 +1552,8 @@ const ze = () => !0, Oe = () => 0, fn = "separate", dn = () => {
1549
1552
  for (const f of u) {
1550
1553
  const d = Y(f.box);
1551
1554
  f.distance = Math.hypot(
1552
- i.x - d.x,
1553
- i.y - d.y
1555
+ r.x - d.x,
1556
+ r.y - d.y
1554
1557
  );
1555
1558
  }
1556
1559
  const c = u.reduce(
@@ -1560,12 +1563,12 @@ const ze = () => !0, Oe = () => 0, fn = "separate", dn = () => {
1560
1563
  }
1561
1564
  if (n.pickClosestBetweenFirst && g[0] && l[0]) {
1562
1565
  const u = Y(l[0].box), c = Y(g[0].box), f = Math.hypot(
1563
- i.x - u.x,
1564
- i.y - u.y
1566
+ r.x - u.x,
1567
+ r.y - u.y
1565
1568
  );
1566
1569
  return Math.hypot(
1567
- i.x - c.x,
1568
- i.y - c.y
1570
+ r.x - c.x,
1571
+ r.y - c.y
1569
1572
  ) < f ? { elements: g.map((m) => m.node), zones: [] } : { elements: [], zones: l.map((m) => m.node) };
1570
1573
  }
1571
1574
  return {
@@ -1576,10 +1579,10 @@ const ze = () => !0, Oe = () => 0, fn = "separate", dn = () => {
1576
1579
  }
1577
1580
  };
1578
1581
  return s;
1579
- }, vn = () => dn();
1582
+ }, wn = () => dn();
1580
1583
  export {
1581
1584
  hn as DnDProvider,
1582
- vn as createSensor,
1585
+ wn as createSensor,
1583
1586
  Me as defaultCollisionDetection,
1584
1587
  Dn as makeAutoScroll,
1585
1588
  pn as makeConstraintArea,