@pie-lib/rubric 2.0.4-next.31 → 2.0.4-next.34

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 (31) hide show
  1. package/CHANGELOG.json +1 -0
  2. package/CHANGELOG.md +1448 -0
  3. package/LICENSE.md +5 -0
  4. package/lib/authoring.js +496 -0
  5. package/lib/authoring.js.map +1 -0
  6. package/lib/index.js +20 -0
  7. package/lib/index.js.map +1 -0
  8. package/lib/point-menu.js +125 -0
  9. package/lib/point-menu.js.map +1 -0
  10. package/package.json +12 -35
  11. package/src/__tests__/rubric.test.jsx +373 -0
  12. package/src/authoring.jsx +413 -0
  13. package/src/index.js +9 -0
  14. package/src/point-menu.jsx +87 -0
  15. package/dist/_virtual/_rolldown/runtime.js +0 -7
  16. package/dist/authoring.d.ts +0 -62
  17. package/dist/authoring.js +0 -298
  18. package/dist/index.d.ts +0 -15
  19. package/dist/index.js +0 -9
  20. package/dist/node_modules/.bun/@babel_runtime@7.29.7/node_modules/@babel/runtime/helpers/esm/extends.js +0 -12
  21. package/dist/node_modules/.bun/@hello-pangea_dnd@18.0.1_d0d44917b9a63a72/node_modules/@hello-pangea/dnd/dist/dnd.esm.js +0 -4451
  22. package/dist/node_modules/.bun/css-box-model@1.2.1/node_modules/css-box-model/dist/css-box-model.esm.js +0 -102
  23. package/dist/node_modules/.bun/raf-schd@4.0.3/node_modules/raf-schd/dist/raf-schd.esm.js +0 -13
  24. package/dist/node_modules/.bun/react-redux@9.3.0_9e2203c65d1d5fa1/node_modules/react-redux/dist/react-redux.js +0 -471
  25. package/dist/node_modules/.bun/redux@5.0.1/node_modules/redux/dist/redux.js +0 -159
  26. package/dist/node_modules/.bun/tiny-invariant@1.3.3/node_modules/tiny-invariant/dist/esm/tiny-invariant.js +0 -11
  27. package/dist/node_modules/.bun/use-sync-external-store@1.6.0_f4eacebf2041cd4f/node_modules/use-sync-external-store/cjs/use-sync-external-store-with-selector.development.js +0 -53
  28. package/dist/node_modules/.bun/use-sync-external-store@1.6.0_f4eacebf2041cd4f/node_modules/use-sync-external-store/cjs/use-sync-external-store-with-selector.production.js +0 -51
  29. package/dist/node_modules/.bun/use-sync-external-store@1.6.0_f4eacebf2041cd4f/node_modules/use-sync-external-store/with-selector.js +0 -10
  30. package/dist/point-menu.d.ts +0 -27
  31. package/dist/point-menu.js +0 -73
@@ -1,4451 +0,0 @@
1
- import { applyMiddleware as e, bindActionCreators as t, compose as n, createStore as r } from "../../../../../redux@5.0.1/node_modules/redux/dist/redux.js";
2
- import { Provider_default as i, connect as a } from "../../../../../react-redux@9.3.0_9e2203c65d1d5fa1/node_modules/react-redux/dist/react-redux.js";
3
- import { calculateBox as o, createBox as s, expand as c, getBox as l, getRect as u, offset as d, withScroll as f } from "../../../../../css-box-model@1.2.1/node_modules/css-box-model/dist/css-box-model.esm.js";
4
- import p from "../../../../../raf-schd@4.0.3/node_modules/raf-schd/dist/raf-schd.esm.js";
5
- import { _extends as m } from "../../../../../@babel_runtime@7.29.7/node_modules/@babel/runtime/helpers/esm/extends.js";
6
- import h, { useContext as g, useEffect as _, useLayoutEffect as v, useRef as y, useState as b } from "react";
7
- import x, { flushSync as S } from "react-dom";
8
- //#region ../../../node_modules/.bun/@hello-pangea+dnd@18.0.1+d0d44917b9a63a72/node_modules/@hello-pangea/dnd/dist/dnd.esm.js
9
- var C = process.env.NODE_ENV === "production", w = /[ \t]{2,}/g, T = /^[ \t]*/gm, E = (e) => e.replace(w, " ").replace(T, "").trim(), ee = (e) => E(`
10
- %c@hello-pangea/dnd
11
-
12
- %c${E(e)}
13
-
14
- %c👷‍ This is a development only message. It will be removed in production builds.
15
- `), te = (e) => [
16
- ee(e),
17
- "color: #00C584; font-size: 1.2em; font-weight: bold;",
18
- "line-height: 1.5",
19
- "color: #723874;"
20
- ], ne = "__@hello-pangea/dnd-disable-dev-warnings";
21
- function re(e, t) {
22
- C || typeof window < "u" && window[ne] || console[e](...te(t));
23
- }
24
- var D = re.bind(null, "warn"), ie = re.bind(null, "error");
25
- function O() {}
26
- function ae(e, t) {
27
- return {
28
- ...e,
29
- ...t
30
- };
31
- }
32
- function k(e, t, n) {
33
- let r = t.map((t) => {
34
- let r = ae(n, t.options);
35
- return e.addEventListener(t.eventName, t.fn, r), function() {
36
- e.removeEventListener(t.eventName, t.fn, r);
37
- };
38
- });
39
- return function() {
40
- r.forEach((e) => {
41
- e();
42
- });
43
- };
44
- }
45
- var oe = process.env.NODE_ENV === "production", se = "Invariant failed", ce = class extends Error {};
46
- ce.prototype.toString = function() {
47
- return this.message;
48
- };
49
- function A(e, t) {
50
- throw oe ? new ce(se) : new ce(`${se}: ${t || ""}`);
51
- }
52
- var le = class extends h.Component {
53
- constructor(...e) {
54
- super(...e), this.callbacks = null, this.unbind = O, this.onWindowError = (e) => {
55
- let t = this.getCallbacks();
56
- t.isDragging() && (t.tryAbort(), process.env.NODE_ENV !== "production" && D("\n An error was caught by our window 'error' event listener while a drag was occurring.\n The active drag has been aborted.\n "));
57
- let n = e.error;
58
- n instanceof ce && (e.preventDefault(), process.env.NODE_ENV !== "production" && ie(n.message));
59
- }, this.getCallbacks = () => {
60
- if (!this.callbacks) throw Error("Unable to find AppCallbacks in <ErrorBoundary/>");
61
- return this.callbacks;
62
- }, this.setCallbacks = (e) => {
63
- this.callbacks = e;
64
- };
65
- }
66
- componentDidMount() {
67
- this.unbind = k(window, [{
68
- eventName: "error",
69
- fn: this.onWindowError
70
- }]);
71
- }
72
- componentDidCatch(e) {
73
- if (e instanceof ce) {
74
- process.env.NODE_ENV !== "production" && ie(e.message), this.setState({});
75
- return;
76
- }
77
- throw e;
78
- }
79
- componentWillUnmount() {
80
- this.unbind();
81
- }
82
- render() {
83
- return this.props.children(this.setCallbacks);
84
- }
85
- }, ue = "\n Press space bar to start a drag.\n When dragging you can use the arrow keys to move the item around and escape to cancel.\n Some screen readers may require you to be in focus mode or to use your pass through key\n", de = (e) => e + 1, fe = (e) => `
86
- You have lifted an item in position ${de(e.source.index)}
87
- `, pe = (e, t) => {
88
- let n = e.droppableId === t.droppableId, r = de(e.index), i = de(t.index);
89
- return n ? `
90
- You have moved the item from position ${r}
91
- to position ${i}
92
- ` : `
93
- You have moved the item from position ${r}
94
- in list ${e.droppableId}
95
- to list ${t.droppableId}
96
- in position ${i}
97
- `;
98
- }, me = (e, t, n) => t.droppableId === n.droppableId ? `
99
- The item ${e}
100
- has been combined with ${n.draggableId}` : `
101
- The item ${e}
102
- in list ${t.droppableId}
103
- has been combined with ${n.draggableId}
104
- in list ${n.droppableId}
105
- `, he = (e) => {
106
- let t = e.destination;
107
- if (t) return pe(e.source, t);
108
- let n = e.combine;
109
- return n ? me(e.draggableId, e.source, n) : "You are over an area that cannot be dropped on";
110
- }, ge = (e) => `
111
- The item has returned to its starting position
112
- of ${de(e.index)}
113
- `, _e = {
114
- dragHandleUsageInstructions: ue,
115
- onDragStart: fe,
116
- onDragUpdate: he,
117
- onDragEnd: (e) => {
118
- if (e.reason === "CANCEL") return `
119
- Movement cancelled.
120
- ${ge(e.source)}
121
- `;
122
- let t = e.destination, n = e.combine;
123
- return t ? `
124
- You have dropped the item.
125
- ${pe(e.source, t)}
126
- ` : n ? `
127
- You have dropped the item.
128
- ${me(e.draggableId, e.source, n)}
129
- ` : `
130
- The item has been dropped while not over a drop area.
131
- ${ge(e.source)}
132
- `;
133
- }
134
- };
135
- function ve(e, t) {
136
- return !!(e === t || Number.isNaN(e) && Number.isNaN(t));
137
- }
138
- function ye(e, t) {
139
- if (e.length !== t.length) return !1;
140
- for (let n = 0; n < e.length; n++) if (!ve(e[n], t[n])) return !1;
141
- return !0;
142
- }
143
- function j(e, t) {
144
- let n = b(() => ({
145
- inputs: t,
146
- result: e()
147
- }))[0], r = y(!0), i = y(n), a = r.current || t && i.current.inputs && ye(t, i.current.inputs) ? i.current : {
148
- inputs: t,
149
- result: e()
150
- };
151
- return _(() => {
152
- r.current = !1, i.current = a;
153
- }, [a]), a.result;
154
- }
155
- function M(e, t) {
156
- return j(() => e, t);
157
- }
158
- var N = {
159
- x: 0,
160
- y: 0
161
- }, P = (e, t) => ({
162
- x: e.x + t.x,
163
- y: e.y + t.y
164
- }), F = (e, t) => ({
165
- x: e.x - t.x,
166
- y: e.y - t.y
167
- }), I = (e, t) => e.x === t.x && e.y === t.y, L = (e) => ({
168
- x: e.x === 0 ? 0 : -e.x,
169
- y: e.y === 0 ? 0 : -e.y
170
- }), R = (e, t, n = 0) => e === "x" ? {
171
- x: t,
172
- y: n
173
- } : {
174
- x: n,
175
- y: t
176
- }, be = (e, t) => Math.sqrt((t.x - e.x) ** 2 + (t.y - e.y) ** 2), xe = (e, t) => Math.min(...t.map((t) => be(e, t))), Se = (e) => (t) => ({
177
- x: e(t.x),
178
- y: e(t.y)
179
- }), Ce = (e, t) => {
180
- let n = u({
181
- top: Math.max(t.top, e.top),
182
- right: Math.min(t.right, e.right),
183
- bottom: Math.min(t.bottom, e.bottom),
184
- left: Math.max(t.left, e.left)
185
- });
186
- return n.width <= 0 || n.height <= 0 ? null : n;
187
- }, we = (e, t) => ({
188
- top: e.top + t.y,
189
- left: e.left + t.x,
190
- bottom: e.bottom + t.y,
191
- right: e.right + t.x
192
- }), Te = (e) => [
193
- {
194
- x: e.left,
195
- y: e.top
196
- },
197
- {
198
- x: e.right,
199
- y: e.top
200
- },
201
- {
202
- x: e.left,
203
- y: e.bottom
204
- },
205
- {
206
- x: e.right,
207
- y: e.bottom
208
- }
209
- ], Ee = {
210
- top: 0,
211
- right: 0,
212
- bottom: 0,
213
- left: 0
214
- }, De = (e, t) => t ? we(e, t.scroll.diff.displacement) : e, Oe = (e, t, n) => n && n.increasedBy ? {
215
- ...e,
216
- [t.end]: e[t.end] + n.increasedBy[t.line]
217
- } : e, ke = (e, t) => t && t.shouldClipSubject ? Ce(t.pageMarginBox, e) : u(e), z = ({ page: e, withPlaceholder: t, axis: n, frame: r }) => ({
218
- page: e,
219
- withPlaceholder: t,
220
- active: ke(Oe(De(e.marginBox, r), n, t), r)
221
- }), Ae = (e, t) => {
222
- !e.frame && (process.env.NODE_ENV, A());
223
- let n = e.frame, r = F(t, n.scroll.initial), i = L(r), a = {
224
- ...n,
225
- scroll: {
226
- initial: n.scroll.initial,
227
- current: t,
228
- diff: {
229
- value: r,
230
- displacement: i
231
- },
232
- max: n.scroll.max
233
- }
234
- }, o = z({
235
- page: e.subject.page,
236
- withPlaceholder: e.subject.withPlaceholder,
237
- axis: e.axis,
238
- frame: a
239
- });
240
- return {
241
- ...e,
242
- frame: a,
243
- subject: o
244
- };
245
- };
246
- function B(e, t = ye) {
247
- let n = null;
248
- function r(...r) {
249
- if (n && n.lastThis === this && t(r, n.lastArgs)) return n.lastResult;
250
- let i = e.apply(this, r);
251
- return n = {
252
- lastResult: i,
253
- lastArgs: r,
254
- lastThis: this
255
- }, i;
256
- }
257
- return r.clear = function() {
258
- n = null;
259
- }, r;
260
- }
261
- var je = B((e) => e.reduce((e, t) => (e[t.descriptor.id] = t, e), {})), Me = B((e) => e.reduce((e, t) => (e[t.descriptor.id] = t, e), {})), Ne = B((e) => Object.values(e)), Pe = B((e) => Object.values(e)), V = B((e, t) => Pe(t).filter((t) => e === t.descriptor.droppableId).sort((e, t) => e.descriptor.index - t.descriptor.index));
262
- function Fe(e) {
263
- return e.at && e.at.type === "REORDER" ? e.at.destination : null;
264
- }
265
- function Ie(e) {
266
- return e.at && e.at.type === "COMBINE" ? e.at.combine : null;
267
- }
268
- var Le = B((e, t) => t.filter((t) => t.descriptor.id !== e.descriptor.id)), Re = ({ isMovingForward: e, draggable: t, destination: n, insideDestination: r, previousImpact: i }) => {
269
- if (!n.isCombineEnabled || !Fe(i)) return null;
270
- function a(e) {
271
- let t = {
272
- type: "COMBINE",
273
- combine: {
274
- draggableId: e,
275
- droppableId: n.descriptor.id
276
- }
277
- };
278
- return {
279
- ...i,
280
- at: t
281
- };
282
- }
283
- let o = i.displaced.all, s = o.length ? o[0] : null;
284
- if (e) return s ? a(s) : null;
285
- let c = Le(t, r);
286
- if (!s) {
287
- if (!c.length) return null;
288
- let e = c[c.length - 1];
289
- return a(e.descriptor.id);
290
- }
291
- let l = c.findIndex((e) => e.descriptor.id === s);
292
- l === -1 && (process.env.NODE_ENV === "production" ? A() : A(!1, "Could not find displaced item in set"));
293
- let u = l - 1;
294
- if (u < 0) return null;
295
- let d = c[u];
296
- return a(d.descriptor.id);
297
- }, H = (e, t) => e.descriptor.droppableId === t.descriptor.id, ze = {
298
- point: N,
299
- value: 0
300
- }, U = {
301
- invisible: {},
302
- visible: {},
303
- all: []
304
- }, Be = {
305
- displaced: U,
306
- displacedBy: ze,
307
- at: null
308
- }, W = (e, t) => (n) => e <= n && n <= t, Ve = (e) => {
309
- let t = W(e.top, e.bottom), n = W(e.left, e.right);
310
- return (r) => {
311
- if (t(r.top) && t(r.bottom) && n(r.left) && n(r.right)) return !0;
312
- let i = t(r.top) || t(r.bottom), a = n(r.left) || n(r.right);
313
- if (i && a) return !0;
314
- let o = r.top < e.top && r.bottom > e.bottom, s = r.left < e.left && r.right > e.right;
315
- return o && s ? !0 : o && a || s && i;
316
- };
317
- }, He = (e) => {
318
- let t = W(e.top, e.bottom), n = W(e.left, e.right);
319
- return (e) => t(e.top) && t(e.bottom) && n(e.left) && n(e.right);
320
- }, Ue = {
321
- direction: "vertical",
322
- line: "y",
323
- crossAxisLine: "x",
324
- start: "top",
325
- end: "bottom",
326
- size: "height",
327
- crossAxisStart: "left",
328
- crossAxisEnd: "right",
329
- crossAxisSize: "width"
330
- }, We = {
331
- direction: "horizontal",
332
- line: "x",
333
- crossAxisLine: "y",
334
- start: "left",
335
- end: "right",
336
- size: "width",
337
- crossAxisStart: "top",
338
- crossAxisEnd: "bottom",
339
- crossAxisSize: "height"
340
- }, Ge = (e) => (t) => {
341
- let n = W(t.top, t.bottom), r = W(t.left, t.right);
342
- return (t) => e === Ue ? n(t.top) && n(t.bottom) : r(t.left) && r(t.right);
343
- }, Ke = (e, t) => we(e, t.frame ? t.frame.scroll.diff.displacement : N), qe = (e, t, n) => t.subject.active ? n(t.subject.active)(e) : !1, Je = (e, t, n) => n(t)(e), Ye = ({ target: e, destination: t, viewport: n, withDroppableDisplacement: r, isVisibleThroughFrameFn: i }) => {
344
- let a = r ? Ke(e, t) : e;
345
- return qe(a, t, i) && Je(a, n, i);
346
- }, Xe = (e) => Ye({
347
- ...e,
348
- isVisibleThroughFrameFn: Ve
349
- }), Ze = (e) => Ye({
350
- ...e,
351
- isVisibleThroughFrameFn: He
352
- }), Qe = (e) => Ye({
353
- ...e,
354
- isVisibleThroughFrameFn: Ge(e.destination.axis)
355
- }), $e = (e, t, n) => {
356
- if (typeof n == "boolean") return n;
357
- if (!t) return !0;
358
- let { invisible: r, visible: i } = t;
359
- if (r[e]) return !1;
360
- let a = i[e];
361
- return a ? a.shouldAnimate : !0;
362
- };
363
- function et(e, t) {
364
- let n = e.page.marginBox;
365
- return u(c(n, {
366
- top: t.point.y,
367
- right: 0,
368
- bottom: 0,
369
- left: t.point.x
370
- }));
371
- }
372
- function tt({ afterDragging: e, destination: t, displacedBy: n, viewport: r, forceShouldAnimate: i, last: a }) {
373
- return e.reduce(function(e, o) {
374
- let s = et(o, n), c = o.descriptor.id;
375
- if (e.all.push(c), !Xe({
376
- target: s,
377
- destination: t,
378
- viewport: r,
379
- withDroppableDisplacement: !0
380
- })) return e.invisible[o.descriptor.id] = !0, e;
381
- let l = {
382
- draggableId: c,
383
- shouldAnimate: $e(c, a, i)
384
- };
385
- return e.visible[c] = l, e;
386
- }, {
387
- all: [],
388
- visible: {},
389
- invisible: {}
390
- });
391
- }
392
- function nt(e, t) {
393
- if (!e.length) return 0;
394
- let n = e[e.length - 1].descriptor.index;
395
- return t.inHomeList ? n : n + 1;
396
- }
397
- function rt({ insideDestination: e, inHomeList: t, displacedBy: n, destination: r }) {
398
- let i = nt(e, { inHomeList: t });
399
- return {
400
- displaced: U,
401
- displacedBy: n,
402
- at: {
403
- type: "REORDER",
404
- destination: {
405
- droppableId: r.descriptor.id,
406
- index: i
407
- }
408
- }
409
- };
410
- }
411
- function it({ draggable: e, insideDestination: t, destination: n, viewport: r, displacedBy: i, last: a, index: o, forceShouldAnimate: s }) {
412
- let c = H(e, n);
413
- if (o == null) return rt({
414
- insideDestination: t,
415
- inHomeList: c,
416
- displacedBy: i,
417
- destination: n
418
- });
419
- let l = t.find((e) => e.descriptor.index === o);
420
- if (!l) return rt({
421
- insideDestination: t,
422
- inHomeList: c,
423
- displacedBy: i,
424
- destination: n
425
- });
426
- let u = Le(e, t), d = t.indexOf(l);
427
- return {
428
- displaced: tt({
429
- afterDragging: u.slice(d),
430
- destination: n,
431
- displacedBy: i,
432
- last: a,
433
- viewport: r.frame,
434
- forceShouldAnimate: s
435
- }),
436
- displacedBy: i,
437
- at: {
438
- type: "REORDER",
439
- destination: {
440
- droppableId: n.descriptor.id,
441
- index: o
442
- }
443
- }
444
- };
445
- }
446
- function G(e, t) {
447
- return !!t.effected[e];
448
- }
449
- var at = ({ isMovingForward: e, destination: t, draggables: n, combine: r, afterCritical: i }) => {
450
- if (!t.isCombineEnabled) return null;
451
- let a = r.draggableId, o = n[a].descriptor.index;
452
- return G(a, i) ? e ? o : o - 1 : e ? o + 1 : o;
453
- }, ot = ({ isMovingForward: e, isInHomeList: t, insideDestination: n, location: r }) => {
454
- if (!n.length) return null;
455
- let i = r.index, a = e ? i + 1 : i - 1, o = n[0].descriptor.index, s = n[n.length - 1].descriptor.index, c = t ? s : s + 1;
456
- return a < o || a > c ? null : a;
457
- }, st = ({ isMovingForward: e, isInHomeList: t, draggable: n, draggables: r, destination: i, insideDestination: a, previousImpact: o, viewport: s, afterCritical: c }) => {
458
- let l = o.at;
459
- if (!l && (process.env.NODE_ENV === "production" ? A() : A(!1, "Cannot move in direction without previous impact location")), l.type === "REORDER") {
460
- let r = ot({
461
- isMovingForward: e,
462
- isInHomeList: t,
463
- location: l.destination,
464
- insideDestination: a
465
- });
466
- return r == null ? null : it({
467
- draggable: n,
468
- insideDestination: a,
469
- destination: i,
470
- viewport: s,
471
- last: o.displaced,
472
- displacedBy: o.displacedBy,
473
- index: r
474
- });
475
- }
476
- let u = at({
477
- isMovingForward: e,
478
- destination: i,
479
- displaced: o.displaced,
480
- draggables: r,
481
- combine: l.combine,
482
- afterCritical: c
483
- });
484
- return u == null ? null : it({
485
- draggable: n,
486
- insideDestination: a,
487
- destination: i,
488
- viewport: s,
489
- last: o.displaced,
490
- displacedBy: o.displacedBy,
491
- index: u
492
- });
493
- }, ct = ({ displaced: e, afterCritical: t, combineWith: n, displacedBy: r }) => {
494
- let i = !!(e.visible[n] || e.invisible[n]);
495
- return G(n, t) ? i ? N : L(r.point) : i ? r.point : N;
496
- }, lt = ({ afterCritical: e, impact: t, draggables: n }) => {
497
- let r = Ie(t);
498
- !r && (process.env.NODE_ENV, A());
499
- let i = r.draggableId, a = n[i].page.borderBox.center;
500
- return P(a, ct({
501
- displaced: t.displaced,
502
- afterCritical: e,
503
- combineWith: i,
504
- displacedBy: t.displacedBy
505
- }));
506
- }, ut = (e, t) => t.margin[e.start] + t.borderBox[e.size] / 2, dt = (e, t) => t.margin[e.end] + t.borderBox[e.size] / 2, ft = (e, t, n) => t[e.crossAxisStart] + n.margin[e.crossAxisStart] + n.borderBox[e.crossAxisSize] / 2, pt = ({ axis: e, moveRelativeTo: t, isMoving: n }) => R(e.line, t.marginBox[e.end] + ut(e, n), ft(e, t.marginBox, n)), mt = ({ axis: e, moveRelativeTo: t, isMoving: n }) => R(e.line, t.marginBox[e.start] - dt(e, n), ft(e, t.marginBox, n)), ht = ({ axis: e, moveInto: t, isMoving: n }) => R(e.line, t.contentBox[e.start] + ut(e, n), ft(e, t.contentBox, n)), gt = ({ impact: e, draggable: t, draggables: n, droppable: r, afterCritical: i }) => {
507
- let a = V(r.descriptor.id, n), o = t.page, s = r.axis;
508
- if (!a.length) return ht({
509
- axis: s,
510
- moveInto: r.page,
511
- isMoving: o
512
- });
513
- let { displaced: c, displacedBy: l } = e, u = c.all[0];
514
- if (u) {
515
- let e = n[u];
516
- return G(u, i) ? mt({
517
- axis: s,
518
- moveRelativeTo: e.page,
519
- isMoving: o
520
- }) : mt({
521
- axis: s,
522
- moveRelativeTo: d(e.page, l.point),
523
- isMoving: o
524
- });
525
- }
526
- let f = a[a.length - 1];
527
- return f.descriptor.id === t.descriptor.id ? o.borderBox.center : G(f.descriptor.id, i) ? pt({
528
- axis: s,
529
- moveRelativeTo: d(f.page, L(i.displacedBy.point)),
530
- isMoving: o
531
- }) : pt({
532
- axis: s,
533
- moveRelativeTo: f.page,
534
- isMoving: o
535
- });
536
- }, _t = (e, t) => {
537
- let n = e.frame;
538
- return n ? P(t, n.scroll.diff.displacement) : t;
539
- }, vt = ({ impact: e, draggable: t, droppable: n, draggables: r, afterCritical: i }) => {
540
- let a = t.page.borderBox.center, o = e.at;
541
- return !n || !o ? a : o.type === "REORDER" ? gt({
542
- impact: e,
543
- draggable: t,
544
- draggables: r,
545
- droppable: n,
546
- afterCritical: i
547
- }) : lt({
548
- impact: e,
549
- draggables: r,
550
- afterCritical: i
551
- });
552
- }, yt = (e) => {
553
- let t = vt(e), n = e.droppable;
554
- return n ? _t(n, t) : t;
555
- }, bt = (e, t) => {
556
- let n = F(t, e.scroll.initial), r = L(n);
557
- return {
558
- frame: u({
559
- top: t.y,
560
- bottom: t.y + e.frame.height,
561
- left: t.x,
562
- right: t.x + e.frame.width
563
- }),
564
- scroll: {
565
- initial: e.scroll.initial,
566
- max: e.scroll.max,
567
- current: t,
568
- diff: {
569
- value: n,
570
- displacement: r
571
- }
572
- }
573
- };
574
- };
575
- function xt(e, t) {
576
- return e.map((e) => t[e]);
577
- }
578
- function St(e, t) {
579
- for (let n = 0; n < t.length; n++) {
580
- let r = t[n].visible[e];
581
- if (r) return r;
582
- }
583
- return null;
584
- }
585
- var Ct = ({ impact: e, viewport: t, destination: n, draggables: r, maxScrollChange: i }) => {
586
- let a = bt(t, P(t.scroll.current, i)), o = n.frame ? Ae(n, P(n.frame.scroll.current, i)) : n, s = e.displaced, c = tt({
587
- afterDragging: xt(s.all, r),
588
- destination: n,
589
- displacedBy: e.displacedBy,
590
- viewport: a.frame,
591
- last: s,
592
- forceShouldAnimate: !1
593
- }), l = tt({
594
- afterDragging: xt(s.all, r),
595
- destination: o,
596
- displacedBy: e.displacedBy,
597
- viewport: t.frame,
598
- last: s,
599
- forceShouldAnimate: !1
600
- }), u = {}, d = {}, f = [
601
- s,
602
- c,
603
- l
604
- ];
605
- return s.all.forEach((e) => {
606
- let t = St(e, f);
607
- if (t) {
608
- d[e] = t;
609
- return;
610
- }
611
- u[e] = !0;
612
- }), {
613
- ...e,
614
- displaced: {
615
- all: s.all,
616
- invisible: u,
617
- visible: d
618
- }
619
- };
620
- }, wt = (e, t) => P(e.scroll.diff.displacement, t), Tt = ({ pageBorderBoxCenter: e, draggable: t, viewport: n }) => {
621
- let r = F(wt(n, e), t.page.borderBox.center);
622
- return P(t.client.borderBox.center, r);
623
- }, Et = ({ draggable: e, destination: t, newPageBorderBoxCenter: n, viewport: r, withDroppableDisplacement: i, onlyOnMainAxis: a = !1 }) => {
624
- let o = F(n, e.page.borderBox.center), s = {
625
- target: we(e.page.borderBox, o),
626
- destination: t,
627
- withDroppableDisplacement: i,
628
- viewport: r
629
- };
630
- return a ? Qe(s) : Ze(s);
631
- }, Dt = ({ isMovingForward: e, draggable: t, destination: n, draggables: r, previousImpact: i, viewport: a, previousPageBorderBoxCenter: o, previousClientSelection: s, afterCritical: c }) => {
632
- if (!n.isEnabled) return null;
633
- let l = V(n.descriptor.id, r), u = H(t, n), d = Re({
634
- isMovingForward: e,
635
- draggable: t,
636
- destination: n,
637
- insideDestination: l,
638
- previousImpact: i
639
- }) || st({
640
- isMovingForward: e,
641
- isInHomeList: u,
642
- draggable: t,
643
- draggables: r,
644
- destination: n,
645
- insideDestination: l,
646
- previousImpact: i,
647
- viewport: a,
648
- afterCritical: c
649
- });
650
- if (!d) return null;
651
- let f = yt({
652
- impact: d,
653
- draggable: t,
654
- droppable: n,
655
- draggables: r,
656
- afterCritical: c
657
- });
658
- if (Et({
659
- draggable: t,
660
- destination: n,
661
- newPageBorderBoxCenter: f,
662
- viewport: a.frame,
663
- withDroppableDisplacement: !1,
664
- onlyOnMainAxis: !0
665
- })) return {
666
- clientSelection: Tt({
667
- pageBorderBoxCenter: f,
668
- draggable: t,
669
- viewport: a
670
- }),
671
- impact: d,
672
- scrollJumpRequest: null
673
- };
674
- let p = F(f, o);
675
- return {
676
- clientSelection: s,
677
- impact: Ct({
678
- impact: d,
679
- viewport: a,
680
- destination: n,
681
- draggables: r,
682
- maxScrollChange: p
683
- }),
684
- scrollJumpRequest: p
685
- };
686
- }, K = (e) => {
687
- let t = e.subject.active;
688
- return !t && (process.env.NODE_ENV === "production" ? A() : A(!1, "Cannot get clipped area from droppable")), t;
689
- }, Ot = ({ isMovingForward: e, pageBorderBoxCenter: t, source: n, droppables: r, viewport: i }) => {
690
- let a = n.subject.active;
691
- if (!a) return null;
692
- let o = n.axis, s = W(a[o.start], a[o.end]), c = Ne(r).filter((e) => e !== n).filter((e) => e.isEnabled).filter((e) => !!e.subject.active).filter((e) => Ve(i.frame)(K(e))).filter((t) => {
693
- let n = K(t);
694
- return e ? a[o.crossAxisEnd] < n[o.crossAxisEnd] : n[o.crossAxisStart] < a[o.crossAxisStart];
695
- }).filter((e) => {
696
- let t = K(e), n = W(t[o.start], t[o.end]);
697
- return s(t[o.start]) || s(t[o.end]) || n(a[o.start]) || n(a[o.end]);
698
- }).sort((t, n) => {
699
- let r = K(t)[o.crossAxisStart], i = K(n)[o.crossAxisStart];
700
- return e ? r - i : i - r;
701
- }).filter((e, t, n) => K(e)[o.crossAxisStart] === K(n[0])[o.crossAxisStart]);
702
- if (!c.length) return null;
703
- if (c.length === 1) return c[0];
704
- let l = c.filter((e) => W(K(e)[o.start], K(e)[o.end])(t[o.line]));
705
- return l.length === 1 ? l[0] : l.length > 1 ? l.sort((e, t) => K(e)[o.start] - K(t)[o.start])[0] : c.sort((e, n) => {
706
- let r = xe(t, Te(K(e))), i = xe(t, Te(K(n)));
707
- return r === i ? K(e)[o.start] - K(n)[o.start] : r - i;
708
- })[0];
709
- }, kt = (e, t) => {
710
- let n = e.page.borderBox.center;
711
- return G(e.descriptor.id, t) ? F(n, t.displacedBy.point) : n;
712
- }, At = (e, t) => {
713
- let n = e.page.borderBox;
714
- return G(e.descriptor.id, t) ? we(n, L(t.displacedBy.point)) : n;
715
- }, jt = ({ pageBorderBoxCenter: e, viewport: t, destination: n, insideDestination: r, afterCritical: i }) => r.filter((e) => Ze({
716
- target: At(e, i),
717
- destination: n,
718
- viewport: t.frame,
719
- withDroppableDisplacement: !0
720
- })).sort((t, r) => {
721
- let a = be(e, _t(n, kt(t, i))), o = be(e, _t(n, kt(r, i)));
722
- return a < o ? -1 : o < a ? 1 : t.descriptor.index - r.descriptor.index;
723
- })[0] || null, Mt = B(function(e, t) {
724
- let n = t[e.line];
725
- return {
726
- value: n,
727
- point: R(e.line, n)
728
- };
729
- }), Nt = (e, t, n) => {
730
- let r = e.axis;
731
- if (e.descriptor.mode === "virtual") return R(r.line, t[r.line]);
732
- let i = e.subject.page.contentBox[r.size], a = V(e.descriptor.id, n).reduce((e, t) => e + t.client.marginBox[r.size], 0) + t[r.line] - i;
733
- return a <= 0 ? null : R(r.line, a);
734
- }, Pt = (e, t) => ({
735
- ...e,
736
- scroll: {
737
- ...e.scroll,
738
- max: t
739
- }
740
- }), Ft = (e, t, n) => {
741
- let r = e.frame;
742
- H(t, e) && (process.env.NODE_ENV === "production" ? A() : A(!1, "Should not add placeholder space to home list")), e.subject.withPlaceholder && (process.env.NODE_ENV === "production" ? A() : A(!1, "Cannot add placeholder size to a subject when it already has one"));
743
- let i = Mt(e.axis, t.displaceBy).point, a = Nt(e, i, n), o = {
744
- placeholderSize: i,
745
- increasedBy: a,
746
- oldFrameMaxScroll: e.frame ? e.frame.scroll.max : null
747
- };
748
- if (!r) {
749
- let t = z({
750
- page: e.subject.page,
751
- withPlaceholder: o,
752
- axis: e.axis,
753
- frame: e.frame
754
- });
755
- return {
756
- ...e,
757
- subject: t
758
- };
759
- }
760
- let s = Pt(r, a ? P(r.scroll.max, a) : r.scroll.max), c = z({
761
- page: e.subject.page,
762
- withPlaceholder: o,
763
- axis: e.axis,
764
- frame: s
765
- });
766
- return {
767
- ...e,
768
- subject: c,
769
- frame: s
770
- };
771
- }, It = (e) => {
772
- let t = e.subject.withPlaceholder;
773
- !t && (process.env.NODE_ENV === "production" ? A() : A(!1, "Cannot remove placeholder form subject when there was none"));
774
- let n = e.frame;
775
- if (!n) {
776
- let t = z({
777
- page: e.subject.page,
778
- axis: e.axis,
779
- frame: null,
780
- withPlaceholder: null
781
- });
782
- return {
783
- ...e,
784
- subject: t
785
- };
786
- }
787
- let r = t.oldFrameMaxScroll;
788
- !r && (process.env.NODE_ENV === "production" ? A() : A(!1, "Expected droppable with frame to have old max frame scroll when removing placeholder"));
789
- let i = Pt(n, r), a = z({
790
- page: e.subject.page,
791
- axis: e.axis,
792
- frame: i,
793
- withPlaceholder: null
794
- });
795
- return {
796
- ...e,
797
- subject: a,
798
- frame: i
799
- };
800
- }, Lt = ({ previousPageBorderBoxCenter: e, moveRelativeTo: t, insideDestination: n, draggable: r, draggables: i, destination: a, viewport: o, afterCritical: s }) => {
801
- if (!t) {
802
- if (n.length) return null;
803
- let e = {
804
- displaced: U,
805
- displacedBy: ze,
806
- at: {
807
- type: "REORDER",
808
- destination: {
809
- droppableId: a.descriptor.id,
810
- index: 0
811
- }
812
- }
813
- }, t = yt({
814
- impact: e,
815
- draggable: r,
816
- droppable: a,
817
- draggables: i,
818
- afterCritical: s
819
- });
820
- return Et({
821
- draggable: r,
822
- destination: H(r, a) ? a : Ft(a, r, i),
823
- newPageBorderBoxCenter: t,
824
- viewport: o.frame,
825
- withDroppableDisplacement: !1,
826
- onlyOnMainAxis: !0
827
- }) ? e : null;
828
- }
829
- let c = e[a.axis.line] <= t.page.borderBox.center[a.axis.line], l = (() => {
830
- let e = t.descriptor.index;
831
- return t.descriptor.id === r.descriptor.id || c ? e : e + 1;
832
- })();
833
- return it({
834
- draggable: r,
835
- insideDestination: n,
836
- destination: a,
837
- viewport: o,
838
- displacedBy: Mt(a.axis, r.displaceBy),
839
- last: U,
840
- index: l
841
- });
842
- }, Rt = ({ isMovingForward: e, previousPageBorderBoxCenter: t, draggable: n, isOver: r, draggables: i, droppables: a, viewport: o, afterCritical: s }) => {
843
- let c = Ot({
844
- isMovingForward: e,
845
- pageBorderBoxCenter: t,
846
- source: r,
847
- droppables: a,
848
- viewport: o
849
- });
850
- if (!c) return null;
851
- let l = V(c.descriptor.id, i), u = Lt({
852
- previousPageBorderBoxCenter: t,
853
- destination: c,
854
- draggable: n,
855
- draggables: i,
856
- moveRelativeTo: jt({
857
- pageBorderBoxCenter: t,
858
- viewport: o,
859
- destination: c,
860
- insideDestination: l,
861
- afterCritical: s
862
- }),
863
- insideDestination: l,
864
- viewport: o,
865
- afterCritical: s
866
- });
867
- return u ? {
868
- clientSelection: Tt({
869
- pageBorderBoxCenter: yt({
870
- impact: u,
871
- draggable: n,
872
- droppable: c,
873
- draggables: i,
874
- afterCritical: s
875
- }),
876
- draggable: n,
877
- viewport: o
878
- }),
879
- impact: u,
880
- scrollJumpRequest: null
881
- } : null;
882
- }, q = (e) => {
883
- let t = e.at;
884
- return t ? t.type === "REORDER" ? t.destination.droppableId : t.combine.droppableId : null;
885
- }, zt = (e, t) => {
886
- let n = q(e);
887
- return n ? t[n] : null;
888
- }, Bt = ({ state: e, type: t }) => {
889
- let n = zt(e.impact, e.dimensions.droppables), r = !!n, i = e.dimensions.droppables[e.critical.droppable.id], a = n || i, o = a.axis.direction, s = o === "vertical" && (t === "MOVE_UP" || t === "MOVE_DOWN") || o === "horizontal" && (t === "MOVE_LEFT" || t === "MOVE_RIGHT");
890
- if (s && !r) return null;
891
- let c = t === "MOVE_DOWN" || t === "MOVE_RIGHT", l = e.dimensions.draggables[e.critical.draggable.id], u = e.current.page.borderBoxCenter, { draggables: d, droppables: f } = e.dimensions;
892
- return s ? Dt({
893
- isMovingForward: c,
894
- previousPageBorderBoxCenter: u,
895
- draggable: l,
896
- destination: a,
897
- draggables: d,
898
- viewport: e.viewport,
899
- previousClientSelection: e.current.client.selection,
900
- previousImpact: e.impact,
901
- afterCritical: e.afterCritical
902
- }) : Rt({
903
- isMovingForward: c,
904
- previousPageBorderBoxCenter: u,
905
- draggable: l,
906
- isOver: a,
907
- draggables: d,
908
- droppables: f,
909
- viewport: e.viewport,
910
- afterCritical: e.afterCritical
911
- });
912
- };
913
- function J(e) {
914
- return e.phase === "DRAGGING" || e.phase === "COLLECTING";
915
- }
916
- function Vt(e) {
917
- let t = W(e.top, e.bottom), n = W(e.left, e.right);
918
- return function(e) {
919
- return t(e.y) && n(e.x);
920
- };
921
- }
922
- function Ht(e, t) {
923
- return e.left < t.right && e.right > t.left && e.top < t.bottom && e.bottom > t.top;
924
- }
925
- function Ut({ pageBorderBox: e, draggable: t, candidates: n }) {
926
- let r = t.page.borderBox.center, i = n.map((t) => {
927
- let n = t.axis, i = R(t.axis.line, e.center[n.line], t.page.borderBox.center[n.crossAxisLine]);
928
- return {
929
- id: t.descriptor.id,
930
- distance: be(r, i)
931
- };
932
- }).sort((e, t) => t.distance - e.distance);
933
- return i[0] ? i[0].id : null;
934
- }
935
- function Wt({ pageBorderBox: e, draggable: t, droppables: n }) {
936
- let r = Ne(n).filter((t) => {
937
- if (!t.isEnabled) return !1;
938
- let n = t.subject.active;
939
- if (!n || !Ht(e, n)) return !1;
940
- if (Vt(n)(e.center)) return !0;
941
- let r = t.axis, i = n.center[r.crossAxisLine], a = e[r.crossAxisStart], o = e[r.crossAxisEnd], s = W(n[r.crossAxisStart], n[r.crossAxisEnd]), c = s(a), l = s(o);
942
- return !c && !l ? !0 : c ? a < i : o > i;
943
- });
944
- return r.length ? r.length === 1 ? r[0].descriptor.id : Ut({
945
- pageBorderBox: e,
946
- draggable: t,
947
- candidates: r
948
- }) : null;
949
- }
950
- var Gt = (e, t) => u(we(e, t)), Kt = (e, t) => {
951
- let n = e.frame;
952
- return n ? Gt(t, n.scroll.diff.value) : t;
953
- };
954
- function qt({ displaced: e, id: t }) {
955
- return !!(e.visible[t] || e.invisible[t]);
956
- }
957
- function Jt({ draggable: e, closest: t, inHomeList: n }) {
958
- return t ? n && t.descriptor.index > e.descriptor.index ? t.descriptor.index - 1 : t.descriptor.index : null;
959
- }
960
- var Yt = ({ pageBorderBoxWithDroppableScroll: e, draggable: t, destination: n, insideDestination: r, last: i, viewport: a, afterCritical: o }) => {
961
- let s = n.axis, c = Mt(n.axis, t.displaceBy), l = c.value, u = e[s.start], d = e[s.end];
962
- return it({
963
- draggable: t,
964
- insideDestination: r,
965
- destination: n,
966
- viewport: a,
967
- last: i,
968
- displacedBy: c,
969
- index: Jt({
970
- draggable: t,
971
- closest: Le(t, r).find((e) => {
972
- let t = e.descriptor.id, n = e.page.borderBox.center[s.line], r = G(t, o), a = qt({
973
- displaced: i,
974
- id: t
975
- });
976
- return r ? a ? d <= n : u < n - l : a ? d <= n + l : u < n;
977
- }) || null,
978
- inHomeList: H(t, n)
979
- })
980
- });
981
- }, Xt = 4, Zt = ({ draggable: e, pageBorderBoxWithDroppableScroll: t, previousImpact: n, destination: r, insideDestination: i, afterCritical: a }) => {
982
- if (!r.isCombineEnabled) return null;
983
- let o = r.axis, s = Mt(r.axis, e.displaceBy), c = s.value, l = t[o.start], u = t[o.end], d = Le(e, i).find((e) => {
984
- let t = e.descriptor.id, r = e.page.borderBox, i = r[o.size] / Xt, s = G(t, a), d = qt({
985
- displaced: n.displaced,
986
- id: t
987
- });
988
- return s ? d ? u > r[o.start] + i && u < r[o.end] - i : l > r[o.start] - c + i && l < r[o.end] - c - i : d ? u > r[o.start] + c + i && u < r[o.end] + c - i : l > r[o.start] + i && l < r[o.end] - i;
989
- });
990
- return d ? {
991
- displacedBy: s,
992
- displaced: n.displaced,
993
- at: {
994
- type: "COMBINE",
995
- combine: {
996
- draggableId: d.descriptor.id,
997
- droppableId: r.descriptor.id
998
- }
999
- }
1000
- } : null;
1001
- }, Qt = ({ pageOffset: e, draggable: t, draggables: n, droppables: r, previousImpact: i, viewport: a, afterCritical: o }) => {
1002
- let s = Gt(t.page.borderBox, e), c = Wt({
1003
- pageBorderBox: s,
1004
- draggable: t,
1005
- droppables: r
1006
- });
1007
- if (!c) return Be;
1008
- let l = r[c], u = V(l.descriptor.id, n), d = Kt(l, s);
1009
- return Zt({
1010
- pageBorderBoxWithDroppableScroll: d,
1011
- draggable: t,
1012
- previousImpact: i,
1013
- destination: l,
1014
- insideDestination: u,
1015
- afterCritical: o
1016
- }) || Yt({
1017
- pageBorderBoxWithDroppableScroll: d,
1018
- draggable: t,
1019
- destination: l,
1020
- insideDestination: u,
1021
- last: i.displaced,
1022
- viewport: a,
1023
- afterCritical: o
1024
- });
1025
- }, $t = (e, t) => ({
1026
- ...e,
1027
- [t.descriptor.id]: t
1028
- }), en = ({ previousImpact: e, impact: t, droppables: n }) => {
1029
- let r = q(e), i = q(t);
1030
- if (!r || r === i) return n;
1031
- let a = n[r];
1032
- return a.subject.withPlaceholder ? $t(n, It(a)) : n;
1033
- }, tn = ({ draggable: e, draggables: t, droppables: n, previousImpact: r, impact: i }) => {
1034
- let a = en({
1035
- previousImpact: r,
1036
- impact: i,
1037
- droppables: n
1038
- }), o = q(i);
1039
- if (!o) return a;
1040
- let s = n[o];
1041
- return H(e, s) || s.subject.withPlaceholder ? a : $t(a, Ft(s, e, t));
1042
- }, nn = ({ state: e, clientSelection: t, dimensions: n, viewport: r, impact: i, scrollJumpRequest: a }) => {
1043
- let o = r || e.viewport, s = n || e.dimensions, c = t || e.current.client.selection, l = F(c, e.initial.client.selection), u = {
1044
- offset: l,
1045
- selection: c,
1046
- borderBoxCenter: P(e.initial.client.borderBoxCenter, l)
1047
- }, d = {
1048
- selection: P(u.selection, o.scroll.current),
1049
- borderBoxCenter: P(u.borderBoxCenter, o.scroll.current),
1050
- offset: P(u.offset, o.scroll.diff.value)
1051
- }, f = {
1052
- client: u,
1053
- page: d
1054
- };
1055
- if (e.phase === "COLLECTING") return {
1056
- ...e,
1057
- dimensions: s,
1058
- viewport: o,
1059
- current: f
1060
- };
1061
- let p = s.draggables[e.critical.draggable.id], m = i || Qt({
1062
- pageOffset: d.offset,
1063
- draggable: p,
1064
- draggables: s.draggables,
1065
- droppables: s.droppables,
1066
- previousImpact: e.impact,
1067
- viewport: o,
1068
- afterCritical: e.afterCritical
1069
- }), h = tn({
1070
- draggable: p,
1071
- impact: m,
1072
- previousImpact: e.impact,
1073
- draggables: s.draggables,
1074
- droppables: s.droppables
1075
- });
1076
- return {
1077
- ...e,
1078
- current: f,
1079
- dimensions: {
1080
- draggables: s.draggables,
1081
- droppables: h
1082
- },
1083
- impact: m,
1084
- viewport: o,
1085
- scrollJumpRequest: a || null,
1086
- forceShouldAnimate: a ? !1 : null
1087
- };
1088
- };
1089
- function rn(e, t) {
1090
- return e.map((e) => t[e]);
1091
- }
1092
- var an = ({ impact: e, viewport: t, draggables: n, destination: r, forceShouldAnimate: i }) => {
1093
- let a = e.displaced, o = tt({
1094
- afterDragging: rn(a.all, n),
1095
- destination: r,
1096
- displacedBy: e.displacedBy,
1097
- viewport: t.frame,
1098
- forceShouldAnimate: i,
1099
- last: a
1100
- });
1101
- return {
1102
- ...e,
1103
- displaced: o
1104
- };
1105
- }, on = ({ impact: e, draggable: t, droppable: n, draggables: r, viewport: i, afterCritical: a }) => Tt({
1106
- pageBorderBoxCenter: yt({
1107
- impact: e,
1108
- draggable: t,
1109
- draggables: r,
1110
- droppable: n,
1111
- afterCritical: a
1112
- }),
1113
- draggable: t,
1114
- viewport: i
1115
- }), sn = ({ state: e, dimensions: t, viewport: n }) => {
1116
- e.movementMode !== "SNAP" && (process.env.NODE_ENV, A());
1117
- let r = e.impact, i = n || e.viewport, a = t || e.dimensions, { draggables: o, droppables: s } = a, c = o[e.critical.draggable.id], l = q(r);
1118
- !l && (process.env.NODE_ENV === "production" ? A() : A(!1, "Must be over a destination in SNAP movement mode"));
1119
- let u = s[l], d = an({
1120
- impact: r,
1121
- viewport: i,
1122
- destination: u,
1123
- draggables: o
1124
- });
1125
- return nn({
1126
- impact: d,
1127
- clientSelection: on({
1128
- impact: d,
1129
- draggable: c,
1130
- droppable: u,
1131
- draggables: o,
1132
- viewport: i,
1133
- afterCritical: e.afterCritical
1134
- }),
1135
- state: e,
1136
- dimensions: a,
1137
- viewport: i
1138
- });
1139
- }, cn = (e) => ({
1140
- index: e.index,
1141
- droppableId: e.droppableId
1142
- }), ln = ({ draggable: e, home: t, draggables: n, viewport: r }) => {
1143
- let i = Mt(t.axis, e.displaceBy), a = V(t.descriptor.id, n), o = a.indexOf(e);
1144
- o === -1 && (process.env.NODE_ENV === "production" ? A() : A(!1, "Expected draggable to be inside home list"));
1145
- let s = a.slice(o + 1), c = s.reduce((e, t) => (e[t.descriptor.id] = !0, e), {}), l = {
1146
- inVirtualList: t.descriptor.mode === "virtual",
1147
- displacedBy: i,
1148
- effected: c
1149
- };
1150
- return {
1151
- impact: {
1152
- displaced: tt({
1153
- afterDragging: s,
1154
- destination: t,
1155
- displacedBy: i,
1156
- last: null,
1157
- viewport: r.frame,
1158
- forceShouldAnimate: !1
1159
- }),
1160
- displacedBy: i,
1161
- at: {
1162
- type: "REORDER",
1163
- destination: cn(e.descriptor)
1164
- }
1165
- },
1166
- afterCritical: l
1167
- };
1168
- }, un = (e, t) => ({
1169
- draggables: e.draggables,
1170
- droppables: $t(e.droppables, t)
1171
- }), dn = (e) => {
1172
- process.env.NODE_ENV;
1173
- }, fn = (e) => {
1174
- process.env.NODE_ENV;
1175
- }, pn = ({ draggable: e, offset: t, initialWindowScroll: n }) => {
1176
- let r = d(e.client, t), i = f(r, n);
1177
- return {
1178
- ...e,
1179
- placeholder: {
1180
- ...e.placeholder,
1181
- client: r
1182
- },
1183
- client: r,
1184
- page: i
1185
- };
1186
- }, mn = (e) => {
1187
- let t = e.frame;
1188
- return !t && (process.env.NODE_ENV === "production" ? A() : A(!1, "Expected Droppable to have a frame")), t;
1189
- }, hn = ({ additions: e, updatedDroppables: t, viewport: n }) => {
1190
- let r = n.scroll.diff.value;
1191
- return e.map((e) => {
1192
- let i = t[e.descriptor.droppableId], a = mn(i).scroll.diff.value;
1193
- return pn({
1194
- draggable: e,
1195
- offset: P(r, a),
1196
- initialWindowScroll: n.scroll.initial
1197
- });
1198
- });
1199
- }, gn = ({ state: e, published: t }) => {
1200
- dn();
1201
- let n = t.modified.map((t) => {
1202
- let n = e.dimensions.droppables[t.droppableId];
1203
- return Ae(n, t.scroll);
1204
- }), r = {
1205
- ...e.dimensions.droppables,
1206
- ...je(n)
1207
- }, i = Me(hn({
1208
- additions: t.additions,
1209
- updatedDroppables: r,
1210
- viewport: e.viewport
1211
- })), a = {
1212
- ...e.dimensions.draggables,
1213
- ...i
1214
- };
1215
- t.removals.forEach((e) => {
1216
- delete a[e];
1217
- });
1218
- let o = {
1219
- droppables: r,
1220
- draggables: a
1221
- }, s = q(e.impact), c = s ? o.droppables[s] : null, l = o.draggables[e.critical.draggable.id], u = o.droppables[e.critical.droppable.id], { impact: d, afterCritical: f } = ln({
1222
- draggable: l,
1223
- home: u,
1224
- draggables: a,
1225
- viewport: e.viewport
1226
- }), p = c && c.isCombineEnabled ? e.impact : d, m = Qt({
1227
- pageOffset: e.current.page.offset,
1228
- draggable: o.draggables[e.critical.draggable.id],
1229
- draggables: o.draggables,
1230
- droppables: o.droppables,
1231
- previousImpact: p,
1232
- viewport: e.viewport,
1233
- afterCritical: f
1234
- });
1235
- fn();
1236
- let h = {
1237
- ...e,
1238
- phase: "DRAGGING",
1239
- impact: m,
1240
- onLiftImpact: d,
1241
- dimensions: o,
1242
- afterCritical: f,
1243
- forceShouldAnimate: !1
1244
- };
1245
- return e.phase === "COLLECTING" ? h : {
1246
- ...h,
1247
- phase: "DROP_PENDING",
1248
- reason: e.reason,
1249
- isWaiting: !1
1250
- };
1251
- }, _n = (e) => e.movementMode === "SNAP", vn = (e, t, n) => {
1252
- let r = un(e.dimensions, t);
1253
- return !_n(e) || n ? nn({
1254
- state: e,
1255
- dimensions: r
1256
- }) : sn({
1257
- state: e,
1258
- dimensions: r
1259
- });
1260
- };
1261
- function yn(e) {
1262
- return e.isDragging && e.movementMode === "SNAP" ? {
1263
- ...e,
1264
- scrollJumpRequest: null
1265
- } : e;
1266
- }
1267
- var bn = {
1268
- phase: "IDLE",
1269
- completed: null,
1270
- shouldFlush: !1
1271
- }, xn = (e = bn, t) => {
1272
- if (t.type === "FLUSH") return {
1273
- ...bn,
1274
- shouldFlush: !0
1275
- };
1276
- if (t.type === "INITIAL_PUBLISH") {
1277
- e.phase !== "IDLE" && (process.env.NODE_ENV === "production" ? A() : A(!1, "INITIAL_PUBLISH must come after a IDLE phase"));
1278
- let { critical: n, clientSelection: r, viewport: i, dimensions: a, movementMode: o } = t.payload, s = a.draggables[n.draggable.id], c = a.droppables[n.droppable.id], l = {
1279
- selection: r,
1280
- borderBoxCenter: s.client.borderBox.center,
1281
- offset: N
1282
- }, u = {
1283
- client: l,
1284
- page: {
1285
- selection: P(l.selection, i.scroll.initial),
1286
- borderBoxCenter: P(l.selection, i.scroll.initial),
1287
- offset: P(l.selection, i.scroll.diff.value)
1288
- }
1289
- }, d = Ne(a.droppables).every((e) => !e.isFixedOnPage), { impact: f, afterCritical: p } = ln({
1290
- draggable: s,
1291
- home: c,
1292
- draggables: a.draggables,
1293
- viewport: i
1294
- });
1295
- return {
1296
- phase: "DRAGGING",
1297
- isDragging: !0,
1298
- critical: n,
1299
- movementMode: o,
1300
- dimensions: a,
1301
- initial: u,
1302
- current: u,
1303
- isWindowScrollAllowed: d,
1304
- impact: f,
1305
- afterCritical: p,
1306
- onLiftImpact: f,
1307
- viewport: i,
1308
- scrollJumpRequest: null,
1309
- forceShouldAnimate: null
1310
- };
1311
- }
1312
- if (t.type === "COLLECTION_STARTING") return e.phase === "COLLECTING" || e.phase === "DROP_PENDING" ? e : (e.phase !== "DRAGGING" && (process.env.NODE_ENV === "production" ? A() : A(!1, `Collection cannot start from phase ${e.phase}`)), {
1313
- ...e,
1314
- phase: "COLLECTING"
1315
- });
1316
- if (t.type === "PUBLISH_WHILE_DRAGGING") return !(e.phase === "COLLECTING" || e.phase === "DROP_PENDING") && (process.env.NODE_ENV === "production" ? A() : A(!1, `Unexpected ${t.type} received in phase ${e.phase}`)), gn({
1317
- state: e,
1318
- published: t.payload
1319
- });
1320
- if (t.type === "MOVE") {
1321
- if (e.phase === "DROP_PENDING") return e;
1322
- !J(e) && (process.env.NODE_ENV === "production" ? A() : A(!1, `${t.type} not permitted in phase ${e.phase}`));
1323
- let { client: n } = t.payload;
1324
- return I(n, e.current.client.selection) ? e : nn({
1325
- state: e,
1326
- clientSelection: n,
1327
- impact: _n(e) ? e.impact : null
1328
- });
1329
- }
1330
- if (t.type === "UPDATE_DROPPABLE_SCROLL") {
1331
- if (e.phase === "DROP_PENDING" || e.phase === "COLLECTING") return yn(e);
1332
- !J(e) && (process.env.NODE_ENV === "production" ? A() : A(!1, `${t.type} not permitted in phase ${e.phase}`));
1333
- let { id: n, newScroll: r } = t.payload, i = e.dimensions.droppables[n];
1334
- return i ? vn(e, Ae(i, r), !1) : e;
1335
- }
1336
- if (t.type === "UPDATE_DROPPABLE_IS_ENABLED") {
1337
- if (e.phase === "DROP_PENDING") return e;
1338
- !J(e) && (process.env.NODE_ENV === "production" ? A() : A(!1, `Attempting to move in an unsupported phase ${e.phase}`));
1339
- let { id: n, isEnabled: r } = t.payload, i = e.dimensions.droppables[n];
1340
- return !i && (process.env.NODE_ENV === "production" ? A() : A(!1, `Cannot find Droppable[id: ${n}] to toggle its enabled state`)), i.isEnabled === r && (process.env.NODE_ENV === "production" ? A() : A(!1, `Trying to set droppable isEnabled to ${String(r)}
1341
- but it is already ${String(i.isEnabled)}`)), vn(e, {
1342
- ...i,
1343
- isEnabled: r
1344
- }, !0);
1345
- }
1346
- if (t.type === "UPDATE_DROPPABLE_IS_COMBINE_ENABLED") {
1347
- if (e.phase === "DROP_PENDING") return e;
1348
- !J(e) && (process.env.NODE_ENV === "production" ? A() : A(!1, `Attempting to move in an unsupported phase ${e.phase}`));
1349
- let { id: n, isCombineEnabled: r } = t.payload, i = e.dimensions.droppables[n];
1350
- return !i && (process.env.NODE_ENV === "production" ? A() : A(!1, `Cannot find Droppable[id: ${n}] to toggle its isCombineEnabled state`)), i.isCombineEnabled === r && (process.env.NODE_ENV === "production" ? A() : A(!1, `Trying to set droppable isCombineEnabled to ${String(r)}
1351
- but it is already ${String(i.isCombineEnabled)}`)), vn(e, {
1352
- ...i,
1353
- isCombineEnabled: r
1354
- }, !0);
1355
- }
1356
- if (t.type === "MOVE_BY_WINDOW_SCROLL") {
1357
- if (e.phase === "DROP_PENDING" || e.phase === "DROP_ANIMATING") return e;
1358
- !J(e) && (process.env.NODE_ENV === "production" ? A() : A(!1, `Cannot move by window in phase ${e.phase}`)), !e.isWindowScrollAllowed && (process.env.NODE_ENV === "production" ? A() : A(!1, "Window scrolling is currently not supported for fixed lists"));
1359
- let n = t.payload.newScroll;
1360
- if (I(e.viewport.scroll.current, n)) return yn(e);
1361
- let r = bt(e.viewport, n);
1362
- return _n(e) ? sn({
1363
- state: e,
1364
- viewport: r
1365
- }) : nn({
1366
- state: e,
1367
- viewport: r
1368
- });
1369
- }
1370
- if (t.type === "UPDATE_VIEWPORT_MAX_SCROLL") {
1371
- if (!J(e)) return e;
1372
- let n = t.payload.maxScroll;
1373
- if (I(n, e.viewport.scroll.max)) return e;
1374
- let r = {
1375
- ...e.viewport,
1376
- scroll: {
1377
- ...e.viewport.scroll,
1378
- max: n
1379
- }
1380
- };
1381
- return {
1382
- ...e,
1383
- viewport: r
1384
- };
1385
- }
1386
- if (t.type === "MOVE_UP" || t.type === "MOVE_DOWN" || t.type === "MOVE_LEFT" || t.type === "MOVE_RIGHT") {
1387
- if (e.phase === "COLLECTING" || e.phase === "DROP_PENDING") return e;
1388
- e.phase !== "DRAGGING" && (process.env.NODE_ENV === "production" ? A() : A(!1, `${t.type} received while not in DRAGGING phase`));
1389
- let n = Bt({
1390
- state: e,
1391
- type: t.type
1392
- });
1393
- return n ? nn({
1394
- state: e,
1395
- impact: n.impact,
1396
- clientSelection: n.clientSelection,
1397
- scrollJumpRequest: n.scrollJumpRequest
1398
- }) : e;
1399
- }
1400
- if (t.type === "DROP_PENDING") {
1401
- let n = t.payload.reason;
1402
- return e.phase !== "COLLECTING" && (process.env.NODE_ENV === "production" ? A() : A(!1, "Can only move into the DROP_PENDING phase from the COLLECTING phase")), {
1403
- ...e,
1404
- phase: "DROP_PENDING",
1405
- isWaiting: !0,
1406
- reason: n
1407
- };
1408
- }
1409
- if (t.type === "DROP_ANIMATE") {
1410
- let { completed: n, dropDuration: r, newHomeClientOffset: i } = t.payload;
1411
- return !(e.phase === "DRAGGING" || e.phase === "DROP_PENDING") && (process.env.NODE_ENV === "production" ? A() : A(!1, `Cannot animate drop from phase ${e.phase}`)), {
1412
- phase: "DROP_ANIMATING",
1413
- completed: n,
1414
- dropDuration: r,
1415
- newHomeClientOffset: i,
1416
- dimensions: e.dimensions
1417
- };
1418
- }
1419
- if (t.type === "DROP_COMPLETE") {
1420
- let { completed: e } = t.payload;
1421
- return {
1422
- phase: "IDLE",
1423
- completed: e,
1424
- shouldFlush: !1
1425
- };
1426
- }
1427
- return e;
1428
- };
1429
- function Y(e, t) {
1430
- return e instanceof Object && "type" in e && e.type === t;
1431
- }
1432
- var Sn = (e) => ({
1433
- type: "BEFORE_INITIAL_CAPTURE",
1434
- payload: e
1435
- }), Cn = (e) => ({
1436
- type: "LIFT",
1437
- payload: e
1438
- }), wn = (e) => ({
1439
- type: "INITIAL_PUBLISH",
1440
- payload: e
1441
- }), Tn = (e) => ({
1442
- type: "PUBLISH_WHILE_DRAGGING",
1443
- payload: e
1444
- }), En = () => ({
1445
- type: "COLLECTION_STARTING",
1446
- payload: null
1447
- }), Dn = (e) => ({
1448
- type: "UPDATE_DROPPABLE_SCROLL",
1449
- payload: e
1450
- }), On = (e) => ({
1451
- type: "UPDATE_DROPPABLE_IS_ENABLED",
1452
- payload: e
1453
- }), kn = (e) => ({
1454
- type: "UPDATE_DROPPABLE_IS_COMBINE_ENABLED",
1455
- payload: e
1456
- }), An = (e) => ({
1457
- type: "MOVE",
1458
- payload: e
1459
- }), jn = (e) => ({
1460
- type: "MOVE_BY_WINDOW_SCROLL",
1461
- payload: e
1462
- }), Mn = (e) => ({
1463
- type: "UPDATE_VIEWPORT_MAX_SCROLL",
1464
- payload: e
1465
- }), Nn = () => ({
1466
- type: "MOVE_UP",
1467
- payload: null
1468
- }), Pn = () => ({
1469
- type: "MOVE_DOWN",
1470
- payload: null
1471
- }), Fn = () => ({
1472
- type: "MOVE_RIGHT",
1473
- payload: null
1474
- }), In = () => ({
1475
- type: "MOVE_LEFT",
1476
- payload: null
1477
- }), Ln = () => ({
1478
- type: "FLUSH",
1479
- payload: null
1480
- }), Rn = (e) => ({
1481
- type: "DROP_ANIMATE",
1482
- payload: e
1483
- }), zn = (e) => ({
1484
- type: "DROP_COMPLETE",
1485
- payload: e
1486
- }), Bn = (e) => ({
1487
- type: "DROP",
1488
- payload: e
1489
- }), Vn = (e) => ({
1490
- type: "DROP_PENDING",
1491
- payload: e
1492
- }), Hn = () => ({
1493
- type: "DROP_ANIMATION_FINISHED",
1494
- payload: null
1495
- });
1496
- function Un(e) {
1497
- if (e.length <= 1) return;
1498
- let t = e.map((e) => e.descriptor.index), n = {};
1499
- for (let e = 1; e < t.length; e++) {
1500
- let r = t[e];
1501
- r !== t[e - 1] + 1 && (n[r] = !0);
1502
- }
1503
- if (!Object.keys(n).length) return;
1504
- let r = t.map((e) => n[e] ? `[🔥${e}]` : `${e}`).join(", ");
1505
- process.env.NODE_ENV !== "production" && D(`
1506
- Detected non-consecutive <Draggable /> indexes.
1507
-
1508
- (This can cause unexpected bugs)
1509
-
1510
- ${r}
1511
- `);
1512
- }
1513
- function Wn(e, t) {
1514
- process.env.NODE_ENV !== "production" && Un(V(e.droppable.id, t.draggables));
1515
- }
1516
- var Gn = (e) => ({ getState: t, dispatch: n }) => (r) => (i) => {
1517
- if (!Y(i, "LIFT")) {
1518
- r(i);
1519
- return;
1520
- }
1521
- let { id: a, clientSelection: o, movementMode: s } = i.payload, c = t();
1522
- c.phase === "DROP_ANIMATING" && n(zn({ completed: c.completed })), t().phase !== "IDLE" && (process.env.NODE_ENV === "production" ? A() : A(!1, "Unexpected phase to start a drag")), n(Ln()), n(Sn({
1523
- draggableId: a,
1524
- movementMode: s
1525
- }));
1526
- let l = {
1527
- draggableId: a,
1528
- scrollOptions: { shouldPublishImmediately: s === "SNAP" }
1529
- }, { critical: u, dimensions: d, viewport: f } = e.startPublishing(l);
1530
- Wn(u, d), n(wn({
1531
- critical: u,
1532
- dimensions: d,
1533
- clientSelection: o,
1534
- movementMode: s,
1535
- viewport: f
1536
- }));
1537
- }, Kn = (e) => () => (t) => (n) => {
1538
- Y(n, "INITIAL_PUBLISH") && e.dragging(), Y(n, "DROP_ANIMATE") && e.dropping(n.payload.completed.result.reason), (Y(n, "FLUSH") || Y(n, "DROP_COMPLETE")) && e.resting(), t(n);
1539
- }, qn = {
1540
- outOfTheWay: "cubic-bezier(0.2, 0, 0, 1)",
1541
- drop: "cubic-bezier(.2,1,.1,1)"
1542
- }, Jn = {
1543
- opacity: {
1544
- drop: 0,
1545
- combining: .7
1546
- },
1547
- scale: { drop: .75 }
1548
- }, Yn = {
1549
- outOfTheWay: .2,
1550
- minDropTime: .33,
1551
- maxDropTime: .55
1552
- }, X = `${Yn.outOfTheWay}s ${qn.outOfTheWay}`, Xn = {
1553
- fluid: `opacity ${X}`,
1554
- snap: `transform ${X}, opacity ${X}`,
1555
- drop: (e) => {
1556
- let t = `${e}s ${qn.drop}`;
1557
- return `transform ${t}, opacity ${t}`;
1558
- },
1559
- outOfTheWay: `transform ${X}`,
1560
- placeholder: `height ${X}, width ${X}, margin ${X}`
1561
- }, Zn = (e) => I(e, N) ? void 0 : `translate(${e.x}px, ${e.y}px)`, Qn = {
1562
- moveTo: Zn,
1563
- drop: (e, t) => {
1564
- let n = Zn(e);
1565
- if (n) return t ? `${n} scale(${Jn.scale.drop})` : n;
1566
- }
1567
- }, { minDropTime: $n, maxDropTime: er } = Yn, tr = er - $n, nr = 1500, rr = .6, ir = ({ current: e, destination: t, reason: n }) => {
1568
- let r = be(e, t);
1569
- if (r <= 0) return $n;
1570
- if (r >= nr) return er;
1571
- let i = $n + r / nr * tr, a = n === "CANCEL" ? i * rr : i;
1572
- return Number(a.toFixed(2));
1573
- }, ar = ({ impact: e, draggable: t, dimensions: n, viewport: r, afterCritical: i }) => {
1574
- let { draggables: a, droppables: o } = n, s = q(e), c = s ? o[s] : null, l = o[t.descriptor.droppableId];
1575
- return F(on({
1576
- impact: e,
1577
- draggable: t,
1578
- draggables: a,
1579
- afterCritical: i,
1580
- droppable: c || l,
1581
- viewport: r
1582
- }), t.client.borderBox.center);
1583
- }, or = ({ draggables: e, reason: t, lastImpact: n, home: r, viewport: i, onLiftImpact: a }) => !n.at || t !== "DROP" ? {
1584
- impact: an({
1585
- draggables: e,
1586
- impact: a,
1587
- destination: r,
1588
- viewport: i,
1589
- forceShouldAnimate: !0
1590
- }),
1591
- didDropInsideDroppable: !1
1592
- } : n.at.type === "REORDER" ? {
1593
- impact: n,
1594
- didDropInsideDroppable: !0
1595
- } : {
1596
- impact: {
1597
- ...n,
1598
- displaced: U
1599
- },
1600
- didDropInsideDroppable: !0
1601
- }, sr = ({ getState: e, dispatch: t }) => (n) => (r) => {
1602
- if (!Y(r, "DROP")) {
1603
- n(r);
1604
- return;
1605
- }
1606
- let i = e(), a = r.payload.reason;
1607
- if (i.phase === "COLLECTING") {
1608
- t(Vn({ reason: a }));
1609
- return;
1610
- }
1611
- if (i.phase === "IDLE") return;
1612
- i.phase === "DROP_PENDING" && i.isWaiting && (process.env.NODE_ENV === "production" ? A() : A(!1, "A DROP action occurred while DROP_PENDING and still waiting")), !(i.phase === "DRAGGING" || i.phase === "DROP_PENDING") && (process.env.NODE_ENV === "production" ? A() : A(!1, `Cannot drop in phase: ${i.phase}`));
1613
- let o = i.critical, s = i.dimensions, c = s.draggables[i.critical.draggable.id], { impact: l, didDropInsideDroppable: u } = or({
1614
- reason: a,
1615
- lastImpact: i.impact,
1616
- afterCritical: i.afterCritical,
1617
- onLiftImpact: i.onLiftImpact,
1618
- home: i.dimensions.droppables[i.critical.droppable.id],
1619
- viewport: i.viewport,
1620
- draggables: i.dimensions.draggables
1621
- }), d = u ? Fe(l) : null, f = u ? Ie(l) : null, p = {
1622
- index: o.draggable.index,
1623
- droppableId: o.droppable.id
1624
- }, m = {
1625
- draggableId: c.descriptor.id,
1626
- type: c.descriptor.type,
1627
- source: p,
1628
- reason: a,
1629
- mode: i.movementMode,
1630
- destination: d,
1631
- combine: f
1632
- }, h = ar({
1633
- impact: l,
1634
- draggable: c,
1635
- dimensions: s,
1636
- viewport: i.viewport,
1637
- afterCritical: i.afterCritical
1638
- }), g = {
1639
- critical: i.critical,
1640
- afterCritical: i.afterCritical,
1641
- result: m,
1642
- impact: l
1643
- };
1644
- if (!(!I(i.current.client.offset, h) || m.combine)) {
1645
- t(zn({ completed: g }));
1646
- return;
1647
- }
1648
- t(Rn({
1649
- newHomeClientOffset: h,
1650
- dropDuration: ir({
1651
- current: i.current.client.offset,
1652
- destination: h,
1653
- reason: a
1654
- }),
1655
- completed: g
1656
- }));
1657
- }, cr = () => ({
1658
- x: window.pageXOffset,
1659
- y: window.pageYOffset
1660
- });
1661
- function lr(e) {
1662
- return {
1663
- eventName: "scroll",
1664
- options: {
1665
- passive: !0,
1666
- capture: !1
1667
- },
1668
- fn: (t) => {
1669
- t.target !== window && t.target !== window.document || e();
1670
- }
1671
- };
1672
- }
1673
- function ur({ onWindowScroll: e }) {
1674
- function t() {
1675
- e(cr());
1676
- }
1677
- let n = p(t), r = lr(n), i = O;
1678
- function a() {
1679
- return i !== O;
1680
- }
1681
- function o() {
1682
- a() && (process.env.NODE_ENV === "production" ? A() : A(!1, "Cannot start scroll listener when already active")), i = k(window, [r]);
1683
- }
1684
- function s() {
1685
- !a() && (process.env.NODE_ENV === "production" ? A() : A(!1, "Cannot stop scroll listener when not active")), n.cancel(), i(), i = O;
1686
- }
1687
- return {
1688
- start: o,
1689
- stop: s,
1690
- isActive: a
1691
- };
1692
- }
1693
- var dr = (e) => Y(e, "DROP_COMPLETE") || Y(e, "DROP_ANIMATE") || Y(e, "FLUSH"), fr = (e) => {
1694
- let t = ur({ onWindowScroll: (t) => {
1695
- e.dispatch(jn({ newScroll: t }));
1696
- } });
1697
- return (e) => (n) => {
1698
- !t.isActive() && Y(n, "INITIAL_PUBLISH") && t.start(), t.isActive() && dr(n) && t.stop(), e(n);
1699
- };
1700
- }, pr = (e) => {
1701
- let t = !1, n = !1, r = setTimeout(() => {
1702
- n = !0;
1703
- }), i = (i) => {
1704
- if (t) {
1705
- process.env.NODE_ENV !== "production" && D("Announcement already made. Not making a second announcement");
1706
- return;
1707
- }
1708
- if (n) {
1709
- process.env.NODE_ENV !== "production" && D("\n Announcements cannot be made asynchronously.\n Default message has already been announced.\n ");
1710
- return;
1711
- }
1712
- t = !0, e(i), clearTimeout(r);
1713
- };
1714
- return i.wasCalled = () => t, i;
1715
- }, mr = () => {
1716
- let e = [], t = (t) => {
1717
- let n = e.findIndex((e) => e.timerId === t);
1718
- n === -1 && (process.env.NODE_ENV === "production" ? A() : A(!1, "Could not find timer"));
1719
- let [r] = e.splice(n, 1);
1720
- r.callback();
1721
- };
1722
- return {
1723
- add: (n) => {
1724
- let r = setTimeout(() => t(r)), i = {
1725
- timerId: r,
1726
- callback: n
1727
- };
1728
- e.push(i);
1729
- },
1730
- flush: () => {
1731
- if (!e.length) return;
1732
- let t = [...e];
1733
- e.length = 0, t.forEach((e) => {
1734
- clearTimeout(e.timerId), e.callback();
1735
- });
1736
- }
1737
- };
1738
- }, hr = (e, t) => e == null && t == null ? !0 : e == null || t == null ? !1 : e.droppableId === t.droppableId && e.index === t.index, gr = (e, t) => e == null && t == null ? !0 : e == null || t == null ? !1 : e.draggableId === t.draggableId && e.droppableId === t.droppableId, _r = (e, t) => {
1739
- if (e === t) return !0;
1740
- let n = e.draggable.id === t.draggable.id && e.draggable.droppableId === t.draggable.droppableId && e.draggable.type === t.draggable.type && e.draggable.index === t.draggable.index, r = e.droppable.id === t.droppable.id && e.droppable.type === t.droppable.type;
1741
- return n && r;
1742
- }, vr = (e, t) => {
1743
- dn(), t(), fn();
1744
- }, yr = (e, t) => ({
1745
- draggableId: e.draggable.id,
1746
- type: e.droppable.type,
1747
- source: {
1748
- droppableId: e.droppable.id,
1749
- index: e.draggable.index
1750
- },
1751
- mode: t
1752
- });
1753
- function br(e, t, n, r) {
1754
- if (!e) {
1755
- n(r(t));
1756
- return;
1757
- }
1758
- let i = pr(n);
1759
- e(t, { announce: i }), i.wasCalled() || n(r(t));
1760
- }
1761
- var xr = (e, t) => {
1762
- let n = mr(), r = null, i = (t, n) => {
1763
- r && (process.env.NODE_ENV === "production" ? A() : A(!1, "Cannot fire onBeforeCapture as a drag start has already been published")), vr("onBeforeCapture", () => {
1764
- let r = e().onBeforeCapture;
1765
- r && r({
1766
- draggableId: t,
1767
- mode: n
1768
- });
1769
- });
1770
- }, a = (t, n) => {
1771
- r && (process.env.NODE_ENV === "production" ? A() : A(!1, "Cannot fire onBeforeDragStart as a drag start has already been published")), vr("onBeforeDragStart", () => {
1772
- let r = e().onBeforeDragStart;
1773
- r && r(yr(t, n));
1774
- });
1775
- }, o = (i, a) => {
1776
- r && (process.env.NODE_ENV === "production" ? A() : A(!1, "Cannot fire onBeforeDragStart as a drag start has already been published"));
1777
- let o = yr(i, a);
1778
- r = {
1779
- mode: a,
1780
- lastCritical: i,
1781
- lastLocation: o.source,
1782
- lastCombine: null
1783
- }, n.add(() => {
1784
- vr("onDragStart", () => br(e().onDragStart, o, t, _e.onDragStart));
1785
- });
1786
- }, s = (i, a) => {
1787
- let o = Fe(a), s = Ie(a);
1788
- !r && (process.env.NODE_ENV === "production" ? A() : A(!1, "Cannot fire onDragMove when onDragStart has not been called"));
1789
- let c = !_r(i, r.lastCritical);
1790
- c && (r.lastCritical = i);
1791
- let l = !hr(r.lastLocation, o);
1792
- l && (r.lastLocation = o);
1793
- let u = !gr(r.lastCombine, s);
1794
- if (u && (r.lastCombine = s), !c && !l && !u) return;
1795
- let d = {
1796
- ...yr(i, r.mode),
1797
- combine: s,
1798
- destination: o
1799
- };
1800
- n.add(() => {
1801
- vr("onDragUpdate", () => br(e().onDragUpdate, d, t, _e.onDragUpdate));
1802
- });
1803
- }, c = () => {
1804
- !r && (process.env.NODE_ENV === "production" ? A() : A(!1, "Can only flush responders while dragging")), n.flush();
1805
- }, l = (n) => {
1806
- !r && (process.env.NODE_ENV === "production" ? A() : A(!1, "Cannot fire onDragEnd when there is no matching onDragStart")), r = null, vr("onDragEnd", () => br(e().onDragEnd, n, t, _e.onDragEnd));
1807
- };
1808
- return {
1809
- beforeCapture: i,
1810
- beforeStart: a,
1811
- start: o,
1812
- update: s,
1813
- flush: c,
1814
- drop: l,
1815
- abort: () => {
1816
- r && l({
1817
- ...yr(r.lastCritical, r.mode),
1818
- combine: null,
1819
- destination: null,
1820
- reason: "CANCEL"
1821
- });
1822
- }
1823
- };
1824
- }, Sr = (e, t) => {
1825
- let n = xr(e, t);
1826
- return (e) => (t) => (r) => {
1827
- if (Y(r, "BEFORE_INITIAL_CAPTURE")) {
1828
- n.beforeCapture(r.payload.draggableId, r.payload.movementMode);
1829
- return;
1830
- }
1831
- if (Y(r, "INITIAL_PUBLISH")) {
1832
- let e = r.payload.critical;
1833
- n.beforeStart(e, r.payload.movementMode), t(r), n.start(e, r.payload.movementMode);
1834
- return;
1835
- }
1836
- if (Y(r, "DROP_COMPLETE")) {
1837
- let e = r.payload.completed.result;
1838
- n.flush(), t(r), n.drop(e);
1839
- return;
1840
- }
1841
- if (t(r), Y(r, "FLUSH")) {
1842
- n.abort();
1843
- return;
1844
- }
1845
- let i = e.getState();
1846
- i.phase === "DRAGGING" && n.update(i.critical, i.impact);
1847
- };
1848
- }, Cr = (e) => (t) => (n) => {
1849
- if (!Y(n, "DROP_ANIMATION_FINISHED")) {
1850
- t(n);
1851
- return;
1852
- }
1853
- let r = e.getState();
1854
- r.phase !== "DROP_ANIMATING" && (process.env.NODE_ENV === "production" ? A() : A(!1, "Cannot finish a drop animating when no drop is occurring")), e.dispatch(zn({ completed: r.completed }));
1855
- }, wr = (e) => {
1856
- let t = null, n = null;
1857
- function r() {
1858
- n &&= (cancelAnimationFrame(n), null), t &&= (t(), null);
1859
- }
1860
- return (i) => (a) => {
1861
- if ((Y(a, "FLUSH") || Y(a, "DROP_COMPLETE") || Y(a, "DROP_ANIMATION_FINISHED")) && r(), i(a), !Y(a, "DROP_ANIMATE")) return;
1862
- let o = {
1863
- eventName: "scroll",
1864
- options: {
1865
- capture: !0,
1866
- passive: !1,
1867
- once: !0
1868
- },
1869
- fn: function() {
1870
- e.getState().phase === "DROP_ANIMATING" && e.dispatch(Hn());
1871
- }
1872
- };
1873
- n = requestAnimationFrame(() => {
1874
- n = null, t = k(window, [o]);
1875
- });
1876
- };
1877
- }, Tr = (e) => () => (t) => (n) => {
1878
- (Y(n, "DROP_COMPLETE") || Y(n, "FLUSH") || Y(n, "DROP_ANIMATE")) && e.stopPublishing(), t(n);
1879
- }, Er = (e) => {
1880
- let t = !1;
1881
- return () => (n) => (r) => {
1882
- if (Y(r, "INITIAL_PUBLISH")) {
1883
- t = !0, e.tryRecordFocus(r.payload.critical.draggable.id), n(r), e.tryRestoreFocusRecorded();
1884
- return;
1885
- }
1886
- if (n(r), t) {
1887
- if (Y(r, "FLUSH")) {
1888
- t = !1, e.tryRestoreFocusRecorded();
1889
- return;
1890
- }
1891
- if (Y(r, "DROP_COMPLETE")) {
1892
- t = !1;
1893
- let n = r.payload.completed.result;
1894
- n.combine && e.tryShiftRecord(n.draggableId, n.combine.draggableId), e.tryRestoreFocusRecorded();
1895
- }
1896
- }
1897
- };
1898
- }, Dr = (e) => Y(e, "DROP_COMPLETE") || Y(e, "DROP_ANIMATE") || Y(e, "FLUSH"), Or = (e) => (t) => (n) => (r) => {
1899
- if (Dr(r)) {
1900
- e.stop(), n(r);
1901
- return;
1902
- }
1903
- if (Y(r, "INITIAL_PUBLISH")) {
1904
- n(r);
1905
- let i = t.getState();
1906
- i.phase !== "DRAGGING" && (process.env.NODE_ENV === "production" ? A() : A(!1, "Expected phase to be DRAGGING after INITIAL_PUBLISH")), e.start(i);
1907
- return;
1908
- }
1909
- n(r), e.scroll(t.getState());
1910
- }, kr = (e) => (t) => (n) => {
1911
- if (t(n), !Y(n, "PUBLISH_WHILE_DRAGGING")) return;
1912
- let r = e.getState();
1913
- r.phase === "DROP_PENDING" && (r.isWaiting || e.dispatch(Bn({ reason: r.reason })));
1914
- }, Ar = process.env.NODE_ENV !== "production" && typeof window < "u" && window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ ? window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__({ name: "@hello-pangea/dnd" }) : n, jr = ({ dimensionMarshal: t, focusMarshal: n, styleMarshal: i, getResponders: a, announce: o, autoScroller: s }) => r(xn, Ar(e(Kn(i), Tr(t), Gn(t), sr, Cr, wr, kr, Or(s), fr, Er(n), Sr(a, o)))), Mr = () => ({
1915
- additions: {},
1916
- removals: {},
1917
- modified: {}
1918
- });
1919
- function Nr({ registry: e, callbacks: t }) {
1920
- let n = Mr(), r = null, i = () => {
1921
- r ||= (t.collectionStarting(), requestAnimationFrame(() => {
1922
- r = null, dn();
1923
- let { additions: i, removals: a, modified: o } = n, s = Object.keys(i).map((t) => e.draggable.getById(t).getDimension(N)).sort((e, t) => e.descriptor.index - t.descriptor.index), c = Object.keys(o).map((t) => ({
1924
- droppableId: t,
1925
- scroll: e.droppable.getById(t).callbacks.getScrollWhileDragging()
1926
- })), l = {
1927
- additions: s,
1928
- removals: Object.keys(a),
1929
- modified: c
1930
- };
1931
- n = Mr(), fn(), t.publish(l);
1932
- }));
1933
- };
1934
- return {
1935
- add: (e) => {
1936
- let t = e.descriptor.id;
1937
- n.additions[t] = e, n.modified[e.descriptor.droppableId] = !0, n.removals[t] && delete n.removals[t], i();
1938
- },
1939
- remove: (e) => {
1940
- let t = e.descriptor;
1941
- n.removals[t.id] = !0, n.modified[t.droppableId] = !0, n.additions[t.id] && delete n.additions[t.id], i();
1942
- },
1943
- stop: () => {
1944
- r && (cancelAnimationFrame(r), r = null, n = Mr());
1945
- }
1946
- };
1947
- }
1948
- var Pr = ({ scrollHeight: e, scrollWidth: t, height: n, width: r }) => {
1949
- let i = F({
1950
- x: t,
1951
- y: e
1952
- }, {
1953
- x: r,
1954
- y: n
1955
- });
1956
- return {
1957
- x: Math.max(0, i.x),
1958
- y: Math.max(0, i.y)
1959
- };
1960
- }, Fr = () => {
1961
- let e = document.documentElement;
1962
- return !e && (process.env.NODE_ENV === "production" ? A() : A(!1, "Cannot find document.documentElement")), e;
1963
- }, Ir = () => {
1964
- let e = Fr();
1965
- return Pr({
1966
- scrollHeight: e.scrollHeight,
1967
- scrollWidth: e.scrollWidth,
1968
- width: e.clientWidth,
1969
- height: e.clientHeight
1970
- });
1971
- }, Lr = () => {
1972
- let e = cr(), t = Ir(), n = e.y, r = e.x, i = Fr(), a = i.clientWidth, o = i.clientHeight;
1973
- return {
1974
- frame: u({
1975
- top: n,
1976
- left: r,
1977
- right: r + a,
1978
- bottom: n + o
1979
- }),
1980
- scroll: {
1981
- initial: e,
1982
- current: e,
1983
- max: t,
1984
- diff: {
1985
- value: N,
1986
- displacement: N
1987
- }
1988
- }
1989
- };
1990
- }, Rr = ({ critical: e, scrollOptions: t, registry: n }) => {
1991
- dn();
1992
- let r = Lr(), i = r.scroll.current, a = e.droppable, o = n.droppable.getAllByType(a.type).map((e) => e.callbacks.getDimensionAndWatchScroll(i, t)), s = {
1993
- draggables: Me(n.draggable.getAllByType(e.draggable.type).map((e) => e.getDimension(i))),
1994
- droppables: je(o)
1995
- };
1996
- return fn(), {
1997
- dimensions: s,
1998
- critical: e,
1999
- viewport: r
2000
- };
2001
- };
2002
- function zr(e, t, n) {
2003
- return n.descriptor.id === t.id || n.descriptor.type !== t.type ? !1 : e.droppable.getById(n.descriptor.droppableId).descriptor.mode === "virtual" ? !0 : (process.env.NODE_ENV !== "production" && D(`
2004
- You are attempting to add or remove a Draggable [id: ${n.descriptor.id}]
2005
- while a drag is occurring. This is only supported for virtual lists.
2006
-
2007
- See https://github.com/hello-pangea/dnd/blob/main/docs/patterns/virtual-lists.md
2008
- `), !1);
2009
- }
2010
- var Br = (e, t) => {
2011
- let n = null, r = Nr({
2012
- callbacks: {
2013
- publish: t.publishWhileDragging,
2014
- collectionStarting: t.collectionStarting
2015
- },
2016
- registry: e
2017
- }), i = (r, i) => {
2018
- !e.droppable.exists(r) && (process.env.NODE_ENV === "production" ? A() : A(!1, `Cannot update is enabled flag of Droppable ${r} as it is not registered`)), n && t.updateDroppableIsEnabled({
2019
- id: r,
2020
- isEnabled: i
2021
- });
2022
- }, a = (r, i) => {
2023
- n && (!e.droppable.exists(r) && (process.env.NODE_ENV === "production" ? A() : A(!1, `Cannot update isCombineEnabled flag of Droppable ${r} as it is not registered`)), t.updateDroppableIsCombineEnabled({
2024
- id: r,
2025
- isCombineEnabled: i
2026
- }));
2027
- }, o = (r, i) => {
2028
- n && (!e.droppable.exists(r) && (process.env.NODE_ENV === "production" ? A() : A(!1, `Cannot update the scroll on Droppable ${r} as it is not registered`)), t.updateDroppableScroll({
2029
- id: r,
2030
- newScroll: i
2031
- }));
2032
- }, s = (t, r) => {
2033
- n && e.droppable.getById(t).callbacks.scroll(r);
2034
- }, c = () => {
2035
- if (!n) return;
2036
- r.stop();
2037
- let t = n.critical.droppable;
2038
- e.droppable.getAllByType(t.type).forEach((e) => e.callbacks.dragStopped()), n.unsubscribe(), n = null;
2039
- }, l = (t) => {
2040
- !n && (process.env.NODE_ENV === "production" ? A() : A(!1, "Should only be subscribed when a collection is occurring"));
2041
- let i = n.critical.draggable;
2042
- t.type === "ADDITION" && zr(e, i, t.value) && r.add(t.value), t.type === "REMOVAL" && zr(e, i, t.value) && r.remove(t.value);
2043
- };
2044
- return {
2045
- updateDroppableIsEnabled: i,
2046
- updateDroppableIsCombineEnabled: a,
2047
- scrollDroppable: s,
2048
- updateDroppableScroll: o,
2049
- startPublishing: (t) => {
2050
- n && (process.env.NODE_ENV === "production" ? A() : A(!1, "Cannot start capturing critical dimensions as there is already a collection"));
2051
- let r = e.draggable.getById(t.draggableId), i = e.droppable.getById(r.descriptor.droppableId), a = {
2052
- draggable: r.descriptor,
2053
- droppable: i.descriptor
2054
- };
2055
- return n = {
2056
- critical: a,
2057
- unsubscribe: e.subscribe(l)
2058
- }, Rr({
2059
- critical: a,
2060
- registry: e,
2061
- scrollOptions: t.scrollOptions
2062
- });
2063
- },
2064
- stopPublishing: c
2065
- };
2066
- }, Vr = (e, t) => e.phase === "IDLE" ? !0 : e.phase !== "DROP_ANIMATING" || e.completed.result.draggableId === t ? !1 : e.completed.result.reason === "DROP", Hr = (e) => {
2067
- window.scrollBy(e.x, e.y);
2068
- }, Ur = B((e) => Ne(e).filter((e) => !(!e.isEnabled || !e.frame))), Wr = (e, t) => Ur(t).find((t) => (!t.frame && (process.env.NODE_ENV === "production" ? A() : A(!1, "Invalid result")), Vt(t.frame.pageMarginBox)(e))) || null, Gr = ({ center: e, destination: t, droppables: n }) => {
2069
- if (t) {
2070
- let e = n[t];
2071
- return e.frame ? e : null;
2072
- }
2073
- return Wr(e, n);
2074
- }, Kr = {
2075
- startFromPercentage: .25,
2076
- maxScrollAtPercentage: .05,
2077
- maxPixelScroll: 28,
2078
- ease: (e) => e ** 2,
2079
- durationDampening: {
2080
- stopDampeningAt: 1200,
2081
- accelerateAt: 360
2082
- },
2083
- disabled: !1
2084
- }, qr = (e, t, n = () => Kr) => {
2085
- let r = n();
2086
- return {
2087
- startScrollingFrom: e[t.size] * r.startFromPercentage,
2088
- maxScrollValueAt: e[t.size] * r.maxScrollAtPercentage
2089
- };
2090
- }, Jr = ({ startOfRange: e, endOfRange: t, current: n }) => {
2091
- let r = t - e;
2092
- return r === 0 ? (process.env.NODE_ENV !== "production" && D("\n Detected distance range of 0 in the fluid auto scroller\n This is unexpected and would cause a divide by 0 issue.\n Not allowing an auto scroll\n "), 0) : (n - e) / r;
2093
- }, Yr = 1, Xr = (e, t, n = () => Kr) => {
2094
- let r = n();
2095
- if (e > t.startScrollingFrom) return 0;
2096
- if (e <= t.maxScrollValueAt) return r.maxPixelScroll;
2097
- if (e === t.startScrollingFrom) return Yr;
2098
- let i = 1 - Jr({
2099
- startOfRange: t.maxScrollValueAt,
2100
- endOfRange: t.startScrollingFrom,
2101
- current: e
2102
- }), a = r.maxPixelScroll * r.ease(i);
2103
- return Math.ceil(a);
2104
- }, Zr = (e, t, n) => {
2105
- let r = n(), i = r.durationDampening.accelerateAt, a = r.durationDampening.stopDampeningAt, o = t, s = a, c = Date.now() - o;
2106
- if (c >= a) return e;
2107
- if (c < i) return Yr;
2108
- let l = Jr({
2109
- startOfRange: i,
2110
- endOfRange: s,
2111
- current: c
2112
- }), u = e * r.ease(l);
2113
- return Math.ceil(u);
2114
- }, Qr = ({ distanceToEdge: e, thresholds: t, dragStartTime: n, shouldUseTimeDampening: r, getAutoScrollerOptions: i }) => {
2115
- let a = Xr(e, t, i);
2116
- return a === 0 ? 0 : r ? Math.max(Zr(a, n, i), Yr) : a;
2117
- }, $r = ({ container: e, distanceToEdges: t, dragStartTime: n, axis: r, shouldUseTimeDampening: i, getAutoScrollerOptions: a }) => {
2118
- let o = qr(e, r, a);
2119
- return t[r.end] < t[r.start] ? Qr({
2120
- distanceToEdge: t[r.end],
2121
- thresholds: o,
2122
- dragStartTime: n,
2123
- shouldUseTimeDampening: i,
2124
- getAutoScrollerOptions: a
2125
- }) : -1 * Qr({
2126
- distanceToEdge: t[r.start],
2127
- thresholds: o,
2128
- dragStartTime: n,
2129
- shouldUseTimeDampening: i,
2130
- getAutoScrollerOptions: a
2131
- });
2132
- }, ei = ({ container: e, subject: t, proposedScroll: n }) => {
2133
- let r = t.height > e.height, i = t.width > e.width;
2134
- return !i && !r ? n : i && r ? null : {
2135
- x: i ? 0 : n.x,
2136
- y: r ? 0 : n.y
2137
- };
2138
- }, ti = Se((e) => e === 0 ? 0 : e), ni = ({ dragStartTime: e, container: t, subject: n, center: r, shouldUseTimeDampening: i, getAutoScrollerOptions: a }) => {
2139
- let o = {
2140
- top: r.y - t.top,
2141
- right: t.right - r.x,
2142
- bottom: t.bottom - r.y,
2143
- left: r.x - t.left
2144
- }, s = $r({
2145
- container: t,
2146
- distanceToEdges: o,
2147
- dragStartTime: e,
2148
- axis: Ue,
2149
- shouldUseTimeDampening: i,
2150
- getAutoScrollerOptions: a
2151
- }), c = ti({
2152
- x: $r({
2153
- container: t,
2154
- distanceToEdges: o,
2155
- dragStartTime: e,
2156
- axis: We,
2157
- shouldUseTimeDampening: i,
2158
- getAutoScrollerOptions: a
2159
- }),
2160
- y: s
2161
- });
2162
- if (I(c, N)) return null;
2163
- let l = ei({
2164
- container: t,
2165
- subject: n,
2166
- proposedScroll: c
2167
- });
2168
- return l ? I(l, N) ? null : l : null;
2169
- }, ri = Se((e) => e === 0 ? 0 : e > 0 ? 1 : -1), ii = (() => {
2170
- let e = (e, t) => e < 0 ? e : e > t ? e - t : 0;
2171
- return ({ current: t, max: n, change: r }) => {
2172
- let i = P(t, r), a = {
2173
- x: e(i.x, n.x),
2174
- y: e(i.y, n.y)
2175
- };
2176
- return I(a, N) ? null : a;
2177
- };
2178
- })(), ai = ({ max: e, current: t, change: n }) => {
2179
- let r = {
2180
- x: Math.max(t.x, e.x),
2181
- y: Math.max(t.y, e.y)
2182
- }, i = ri(n), a = ii({
2183
- max: r,
2184
- current: t,
2185
- change: i
2186
- });
2187
- return !a || i.x !== 0 && a.x === 0 || i.y !== 0 && a.y === 0;
2188
- }, oi = (e, t) => ai({
2189
- current: e.scroll.current,
2190
- max: e.scroll.max,
2191
- change: t
2192
- }), si = (e, t) => {
2193
- if (!oi(e, t)) return null;
2194
- let n = e.scroll.max, r = e.scroll.current;
2195
- return ii({
2196
- current: r,
2197
- max: n,
2198
- change: t
2199
- });
2200
- }, ci = (e, t) => {
2201
- let n = e.frame;
2202
- return n ? ai({
2203
- current: n.scroll.current,
2204
- max: n.scroll.max,
2205
- change: t
2206
- }) : !1;
2207
- }, li = (e, t) => {
2208
- let n = e.frame;
2209
- return !n || !ci(e, t) ? null : ii({
2210
- current: n.scroll.current,
2211
- max: n.scroll.max,
2212
- change: t
2213
- });
2214
- }, ui = ({ viewport: e, subject: t, center: n, dragStartTime: r, shouldUseTimeDampening: i, getAutoScrollerOptions: a }) => {
2215
- let o = ni({
2216
- dragStartTime: r,
2217
- container: e.frame,
2218
- subject: t,
2219
- center: n,
2220
- shouldUseTimeDampening: i,
2221
- getAutoScrollerOptions: a
2222
- });
2223
- return o && oi(e, o) ? o : null;
2224
- }, di = ({ droppable: e, subject: t, center: n, dragStartTime: r, shouldUseTimeDampening: i, getAutoScrollerOptions: a }) => {
2225
- let o = e.frame;
2226
- if (!o) return null;
2227
- let s = ni({
2228
- dragStartTime: r,
2229
- container: o.pageMarginBox,
2230
- subject: t,
2231
- center: n,
2232
- shouldUseTimeDampening: i,
2233
- getAutoScrollerOptions: a
2234
- });
2235
- return s && ci(e, s) ? s : null;
2236
- }, fi = ({ state: e, dragStartTime: t, shouldUseTimeDampening: n, scrollWindow: r, scrollDroppable: i, getAutoScrollerOptions: a }) => {
2237
- let o = e.current.page.borderBoxCenter, s = e.dimensions.draggables[e.critical.draggable.id].page.marginBox;
2238
- if (e.isWindowScrollAllowed) {
2239
- let i = e.viewport, c = ui({
2240
- dragStartTime: t,
2241
- viewport: i,
2242
- subject: s,
2243
- center: o,
2244
- shouldUseTimeDampening: n,
2245
- getAutoScrollerOptions: a
2246
- });
2247
- if (c) {
2248
- r(c);
2249
- return;
2250
- }
2251
- }
2252
- let c = Gr({
2253
- center: o,
2254
- destination: q(e.impact),
2255
- droppables: e.dimensions.droppables
2256
- });
2257
- if (!c) return;
2258
- let l = di({
2259
- dragStartTime: t,
2260
- droppable: c,
2261
- subject: s,
2262
- center: o,
2263
- shouldUseTimeDampening: n,
2264
- getAutoScrollerOptions: a
2265
- });
2266
- l && i(c.descriptor.id, l);
2267
- }, pi = ({ scrollWindow: e, scrollDroppable: t, getAutoScrollerOptions: n = () => Kr }) => {
2268
- let r = p(e), i = p(t), a = null, o = (e) => {
2269
- !a && (process.env.NODE_ENV === "production" ? A() : A(!1, "Cannot fluid scroll if not dragging"));
2270
- let { shouldUseTimeDampening: t, dragStartTime: o } = a;
2271
- fi({
2272
- state: e,
2273
- scrollWindow: r,
2274
- scrollDroppable: i,
2275
- dragStartTime: o,
2276
- shouldUseTimeDampening: t,
2277
- getAutoScrollerOptions: n
2278
- });
2279
- };
2280
- return {
2281
- start: (e) => {
2282
- dn(), a && (process.env.NODE_ENV === "production" ? A() : A(!1, "Cannot start auto scrolling when already started"));
2283
- let t = Date.now(), r = !1, i = () => {
2284
- r = !0;
2285
- };
2286
- fi({
2287
- state: e,
2288
- dragStartTime: 0,
2289
- shouldUseTimeDampening: !1,
2290
- scrollWindow: i,
2291
- scrollDroppable: i,
2292
- getAutoScrollerOptions: n
2293
- }), a = {
2294
- dragStartTime: t,
2295
- shouldUseTimeDampening: r
2296
- }, fn(), r && o(e);
2297
- },
2298
- stop: () => {
2299
- a &&= (r.cancel(), i.cancel(), null);
2300
- },
2301
- scroll: o
2302
- };
2303
- }, mi = ({ move: e, scrollDroppable: t, scrollWindow: n }) => {
2304
- let r = (t, n) => {
2305
- e({ client: P(t.current.client.selection, n) });
2306
- }, i = (e, n) => {
2307
- if (!ci(e, n)) return n;
2308
- let r = li(e, n);
2309
- if (!r) return t(e.descriptor.id, n), null;
2310
- let i = F(n, r);
2311
- return t(e.descriptor.id, i), F(n, i);
2312
- }, a = (e, t, r) => {
2313
- if (!e || !oi(t, r)) return r;
2314
- let i = si(t, r);
2315
- if (!i) return n(r), null;
2316
- let a = F(r, i);
2317
- return n(a), F(r, a);
2318
- };
2319
- return (e) => {
2320
- let t = e.scrollJumpRequest;
2321
- if (!t) return;
2322
- let n = q(e.impact);
2323
- !n && (process.env.NODE_ENV === "production" ? A() : A(!1, "Cannot perform a jump scroll when there is no destination"));
2324
- let o = i(e.dimensions.droppables[n], t);
2325
- if (!o) return;
2326
- let s = e.viewport, c = a(e.isWindowScrollAllowed, s, o);
2327
- c && r(e, c);
2328
- };
2329
- }, hi = ({ scrollDroppable: e, scrollWindow: t, move: n, getAutoScrollerOptions: r }) => {
2330
- let i = pi({
2331
- scrollWindow: t,
2332
- scrollDroppable: e,
2333
- getAutoScrollerOptions: r
2334
- }), a = mi({
2335
- move: n,
2336
- scrollWindow: t,
2337
- scrollDroppable: e
2338
- });
2339
- return {
2340
- scroll: (e) => {
2341
- if (!(r().disabled || e.phase !== "DRAGGING")) {
2342
- if (e.movementMode === "FLUID") {
2343
- i.scroll(e);
2344
- return;
2345
- }
2346
- e.scrollJumpRequest && a(e);
2347
- }
2348
- },
2349
- start: i.start,
2350
- stop: i.stop
2351
- };
2352
- }, Z = "data-rfd", Q = (() => {
2353
- let e = `${Z}-drag-handle`;
2354
- return {
2355
- base: e,
2356
- draggableId: `${e}-draggable-id`,
2357
- contextId: `${e}-context-id`
2358
- };
2359
- })(), gi = (() => {
2360
- let e = `${Z}-draggable`;
2361
- return {
2362
- base: e,
2363
- contextId: `${e}-context-id`,
2364
- id: `${e}-id`
2365
- };
2366
- })(), _i = (() => {
2367
- let e = `${Z}-droppable`;
2368
- return {
2369
- base: e,
2370
- contextId: `${e}-context-id`,
2371
- id: `${e}-id`
2372
- };
2373
- })(), vi = { contextId: `${Z}-scroll-container-context-id` }, yi = (e) => (t) => `[${t}="${e}"]`, bi = (e, t) => e.map((e) => {
2374
- let n = e.styles[t];
2375
- return n ? `${e.selector} { ${n} }` : "";
2376
- }).join(" "), xi = "pointer-events: none;", Si = (e) => {
2377
- let t = yi(e), n = (() => {
2378
- let e = "\n cursor: -webkit-grab;\n cursor: grab;\n ";
2379
- return {
2380
- selector: t(Q.contextId),
2381
- styles: {
2382
- always: "\n -webkit-touch-callout: none;\n -webkit-tap-highlight-color: rgba(0,0,0,0);\n touch-action: manipulation;\n ",
2383
- resting: e,
2384
- dragging: xi,
2385
- dropAnimating: e
2386
- }
2387
- };
2388
- })(), r = [
2389
- (() => {
2390
- let e = `
2391
- transition: ${Xn.outOfTheWay};
2392
- `;
2393
- return {
2394
- selector: t(gi.contextId),
2395
- styles: {
2396
- dragging: e,
2397
- dropAnimating: e,
2398
- userCancel: e
2399
- }
2400
- };
2401
- })(),
2402
- n,
2403
- {
2404
- selector: t(_i.contextId),
2405
- styles: { always: "overflow-anchor: none;" }
2406
- },
2407
- {
2408
- selector: "body",
2409
- styles: { dragging: "\n cursor: grabbing;\n cursor: -webkit-grabbing;\n user-select: none;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n overflow-anchor: none;\n " }
2410
- }
2411
- ];
2412
- return {
2413
- always: bi(r, "always"),
2414
- resting: bi(r, "resting"),
2415
- dragging: bi(r, "dragging"),
2416
- dropAnimating: bi(r, "dropAnimating"),
2417
- userCancel: bi(r, "userCancel")
2418
- };
2419
- }, $ = typeof window < "u" && window.document !== void 0 && window.document.createElement !== void 0 ? v : _, Ci = () => {
2420
- let e = document.querySelector("head");
2421
- return !e && (process.env.NODE_ENV === "production" ? A() : A(!1, "Cannot find the head to append a style to")), e;
2422
- }, wi = (e) => {
2423
- let t = document.createElement("style");
2424
- return e && t.setAttribute("nonce", e), t.type = "text/css", t;
2425
- };
2426
- function Ti(e, t) {
2427
- let n = j(() => Si(e), [e]), r = y(null), i = y(null), a = M(B((e) => {
2428
- let t = i.current;
2429
- !t && (process.env.NODE_ENV === "production" ? A() : A(!1, "Cannot set dynamic style element if it is not set")), t.textContent = e;
2430
- }), []), o = M((e) => {
2431
- let t = r.current;
2432
- !t && (process.env.NODE_ENV === "production" ? A() : A(!1, "Cannot set dynamic style element if it is not set")), t.textContent = e;
2433
- }, []);
2434
- $(() => {
2435
- !(!r.current && !i.current) && (process.env.NODE_ENV === "production" ? A() : A(!1, "style elements already mounted"));
2436
- let s = wi(t), c = wi(t);
2437
- return r.current = s, i.current = c, s.setAttribute(`${Z}-always`, e), c.setAttribute(`${Z}-dynamic`, e), Ci().appendChild(s), Ci().appendChild(c), o(n.always), a(n.resting), () => {
2438
- let e = (e) => {
2439
- let t = e.current;
2440
- !t && (process.env.NODE_ENV === "production" ? A() : A(!1, "Cannot unmount ref as it is not set")), Ci().removeChild(t), e.current = null;
2441
- };
2442
- e(r), e(i);
2443
- };
2444
- }, [
2445
- t,
2446
- o,
2447
- a,
2448
- n.always,
2449
- n.resting,
2450
- e
2451
- ]);
2452
- let s = M(() => a(n.dragging), [a, n.dragging]), c = M((e) => {
2453
- if (e === "DROP") {
2454
- a(n.dropAnimating);
2455
- return;
2456
- }
2457
- a(n.userCancel);
2458
- }, [
2459
- a,
2460
- n.dropAnimating,
2461
- n.userCancel
2462
- ]), l = M(() => {
2463
- i.current && a(n.resting);
2464
- }, [a, n.resting]);
2465
- return j(() => ({
2466
- dragging: s,
2467
- dropping: c,
2468
- resting: l
2469
- }), [
2470
- s,
2471
- c,
2472
- l
2473
- ]);
2474
- }
2475
- function Ei(e, t) {
2476
- return Array.from(e.querySelectorAll(t));
2477
- }
2478
- var Di = (e) => e && e.ownerDocument && e.ownerDocument.defaultView ? e.ownerDocument.defaultView : window;
2479
- function Oi(e) {
2480
- return e instanceof Di(e).HTMLElement;
2481
- }
2482
- function ki(e, t) {
2483
- let n = `[${Q.contextId}="${e}"]`, r = Ei(document, n);
2484
- if (!r.length) return process.env.NODE_ENV !== "production" && D(`Unable to find any drag handles in the context "${e}"`), null;
2485
- let i = r.find((e) => e.getAttribute(Q.draggableId) === t);
2486
- return i ? Oi(i) ? i : (process.env.NODE_ENV !== "production" && D("drag handle needs to be a HTMLElement"), null) : (process.env.NODE_ENV !== "production" && D(`Unable to find drag handle with id "${t}" as no handle with a matching id was found`), null);
2487
- }
2488
- function Ai(e) {
2489
- let t = y({}), n = y(null), r = y(null), i = y(!1), a = M(function(e, n) {
2490
- let r = {
2491
- id: e,
2492
- focus: n
2493
- };
2494
- return t.current[e] = r, function() {
2495
- let n = t.current;
2496
- n[e] !== r && delete n[e];
2497
- };
2498
- }, []), o = M(function(t) {
2499
- let n = ki(e, t);
2500
- n && n !== document.activeElement && n.focus();
2501
- }, [e]), s = M(function(e, t) {
2502
- n.current === e && (n.current = t);
2503
- }, []), c = M(function() {
2504
- r.current || i.current && (r.current = requestAnimationFrame(() => {
2505
- r.current = null;
2506
- let e = n.current;
2507
- e && o(e);
2508
- }));
2509
- }, [o]), l = M(function(e) {
2510
- n.current = null;
2511
- let t = document.activeElement;
2512
- t && t.getAttribute(Q.draggableId) === e && (n.current = e);
2513
- }, []);
2514
- return $(() => (i.current = !0, function() {
2515
- i.current = !1;
2516
- let e = r.current;
2517
- e && cancelAnimationFrame(e);
2518
- }), []), j(() => ({
2519
- register: a,
2520
- tryRecordFocus: l,
2521
- tryRestoreFocusRecorded: c,
2522
- tryShiftRecord: s
2523
- }), [
2524
- a,
2525
- l,
2526
- c,
2527
- s
2528
- ]);
2529
- }
2530
- function ji() {
2531
- let e = {
2532
- draggables: {},
2533
- droppables: {}
2534
- }, t = [];
2535
- function n(e) {
2536
- return t.push(e), function() {
2537
- let n = t.indexOf(e);
2538
- n !== -1 && t.splice(n, 1);
2539
- };
2540
- }
2541
- function r(e) {
2542
- t.length && t.forEach((t) => t(e));
2543
- }
2544
- function i(t) {
2545
- return e.draggables[t] || null;
2546
- }
2547
- function a(e) {
2548
- let t = i(e);
2549
- return !t && (process.env.NODE_ENV === "production" ? A() : A(!1, `Cannot find draggable entry with id [${e}]`)), t;
2550
- }
2551
- let o = {
2552
- register: (t) => {
2553
- e.draggables[t.descriptor.id] = t, r({
2554
- type: "ADDITION",
2555
- value: t
2556
- });
2557
- },
2558
- update: (t, n) => {
2559
- let r = e.draggables[n.descriptor.id];
2560
- r && r.uniqueId === t.uniqueId && (delete e.draggables[n.descriptor.id], e.draggables[t.descriptor.id] = t);
2561
- },
2562
- unregister: (t) => {
2563
- let n = t.descriptor.id, a = i(n);
2564
- a && t.uniqueId === a.uniqueId && (delete e.draggables[n], e.droppables[t.descriptor.droppableId] && r({
2565
- type: "REMOVAL",
2566
- value: t
2567
- }));
2568
- },
2569
- getById: a,
2570
- findById: i,
2571
- exists: (e) => !!i(e),
2572
- getAllByType: (t) => Object.values(e.draggables).filter((e) => e.descriptor.type === t)
2573
- };
2574
- function s(t) {
2575
- return e.droppables[t] || null;
2576
- }
2577
- function c(e) {
2578
- let t = s(e);
2579
- return !t && (process.env.NODE_ENV === "production" ? A() : A(!1, `Cannot find droppable entry with id [${e}]`)), t;
2580
- }
2581
- let l = {
2582
- register: (t) => {
2583
- e.droppables[t.descriptor.id] = t;
2584
- },
2585
- unregister: (t) => {
2586
- let n = s(t.descriptor.id);
2587
- n && t.uniqueId === n.uniqueId && delete e.droppables[t.descriptor.id];
2588
- },
2589
- getById: c,
2590
- findById: s,
2591
- exists: (e) => !!s(e),
2592
- getAllByType: (t) => Object.values(e.droppables).filter((e) => e.descriptor.type === t)
2593
- };
2594
- function u() {
2595
- e.draggables = {}, e.droppables = {}, t.length = 0;
2596
- }
2597
- return {
2598
- draggable: o,
2599
- droppable: l,
2600
- subscribe: n,
2601
- clean: u
2602
- };
2603
- }
2604
- function Mi() {
2605
- let e = j(ji, []);
2606
- return _(() => function() {
2607
- e.clean();
2608
- }, [e]), e;
2609
- }
2610
- var Ni = h.createContext(null), Pi = () => {
2611
- let e = document.body;
2612
- return !e && (process.env.NODE_ENV === "production" ? A() : A(!1, "Cannot find document.body")), e;
2613
- }, Fi = {
2614
- position: "absolute",
2615
- width: "1px",
2616
- height: "1px",
2617
- margin: "-1px",
2618
- border: "0",
2619
- padding: "0",
2620
- overflow: "hidden",
2621
- clip: "rect(0 0 0 0)",
2622
- "clip-path": "inset(100%)"
2623
- }, Ii = (e) => `rfd-announcement-${e}`;
2624
- function Li(e) {
2625
- let t = j(() => Ii(e), [e]), n = y(null);
2626
- return _(function() {
2627
- let e = document.createElement("div");
2628
- return n.current = e, e.id = t, e.setAttribute("aria-live", "assertive"), e.setAttribute("aria-atomic", "true"), m(e.style, Fi), Pi().appendChild(e), function() {
2629
- setTimeout(function() {
2630
- let t = Pi();
2631
- t.contains(e) && t.removeChild(e), e === n.current && (n.current = null);
2632
- });
2633
- };
2634
- }, [t]), M((e) => {
2635
- let t = n.current;
2636
- if (t) {
2637
- t.textContent = e;
2638
- return;
2639
- }
2640
- process.env.NODE_ENV !== "production" && D(`
2641
- A screen reader message was trying to be announced but it was unable to do so.
2642
- This can occur if you unmount your <DragDropContext /> in your onDragEnd.
2643
- Consider calling provided.announce() before the unmount so that the instruction will
2644
- not be lost for users relying on a screen reader.
2645
-
2646
- Message not passed to screen reader:
2647
-
2648
- "${e}"
2649
- `);
2650
- }, []);
2651
- }
2652
- var Ri = { separator: "::" };
2653
- function zi(e, t = Ri) {
2654
- let n = h.useId();
2655
- return j(() => `${e}${t.separator}${n}`, [
2656
- t.separator,
2657
- e,
2658
- n
2659
- ]);
2660
- }
2661
- function Bi({ contextId: e, uniqueId: t }) {
2662
- return `rfd-hidden-text-${e}-${t}`;
2663
- }
2664
- function Vi({ contextId: e, text: t }) {
2665
- let n = zi("hidden-text", { separator: "-" }), r = j(() => Bi({
2666
- contextId: e,
2667
- uniqueId: n
2668
- }), [n, e]);
2669
- return _(function() {
2670
- let e = document.createElement("div");
2671
- return e.id = r, e.textContent = t, e.style.display = "none", Pi().appendChild(e), function() {
2672
- let t = Pi();
2673
- t.contains(e) && t.removeChild(e);
2674
- };
2675
- }, [r, t]), r;
2676
- }
2677
- var Hi = h.createContext(null), Ui = { react: "^18.0.0 || ^19.0.0" }, Wi = /(\d+)\.(\d+)\.(\d+)/, Gi = (e) => {
2678
- let t = Wi.exec(e);
2679
- return t ?? (process.env.NODE_ENV === "production" ? A() : A(!1, `Unable to parse React version ${e}`)), {
2680
- major: Number(t[1]),
2681
- minor: Number(t[2]),
2682
- patch: Number(t[3]),
2683
- raw: e
2684
- };
2685
- }, Ki = (e, t) => t.major > e.major ? !0 : t.major < e.major ? !1 : t.minor > e.minor ? !0 : t.minor < e.minor ? !1 : t.patch >= e.patch, qi = (e, t) => {
2686
- let n = Gi(e), r = Gi(t);
2687
- Ki(n, r) || process.env.NODE_ENV !== "production" && D(`
2688
- React version: [${r.raw}]
2689
- does not satisfy expected peer dependency version: [${n.raw}]
2690
-
2691
- This can result in run time bugs, and even fatal crashes
2692
- `);
2693
- }, Ji = "\n We expect a html5 doctype: <!doctype html>\n This is to ensure consistent browser layout and measurement\n\n More information: https://github.com/hello-pangea/dnd/blob/main/docs/guides/doctype.md\n", Yi = (e) => {
2694
- let t = e.doctype;
2695
- if (!t) {
2696
- process.env.NODE_ENV !== "production" && D(`
2697
- No <!doctype html> found.
2698
-
2699
- ${Ji}
2700
- `);
2701
- return;
2702
- }
2703
- t.name.toLowerCase() !== "html" && process.env.NODE_ENV !== "production" && D(`
2704
- Unexpected <!doctype> found: (${t.name})
2705
-
2706
- ${Ji}
2707
- `), t.publicId !== "" && process.env.NODE_ENV !== "production" && D(`
2708
- Unexpected <!doctype> publicId found: (${t.publicId})
2709
- A html5 doctype does not have a publicId
2710
-
2711
- ${Ji}
2712
- `);
2713
- };
2714
- function Xi(e) {
2715
- process.env.NODE_ENV !== "production" && e();
2716
- }
2717
- function Zi(e, t) {
2718
- Xi(() => {
2719
- _(() => {
2720
- try {
2721
- e();
2722
- } catch (e) {
2723
- ie(`
2724
- A setup problem was encountered.
2725
-
2726
- > ${e.message}
2727
- `);
2728
- }
2729
- }, t);
2730
- });
2731
- }
2732
- function Qi() {
2733
- Zi(() => {
2734
- qi(Ui.react, h.version), Yi(document);
2735
- }, []);
2736
- }
2737
- function $i(e) {
2738
- let t = y(e);
2739
- return _(() => {
2740
- t.current = e;
2741
- }), t;
2742
- }
2743
- function ea() {
2744
- let e = null;
2745
- function t() {
2746
- return !!e;
2747
- }
2748
- function n(t) {
2749
- return t === e;
2750
- }
2751
- function r(t) {
2752
- e && (process.env.NODE_ENV === "production" ? A() : A(!1, "Cannot claim lock as it is already claimed"));
2753
- let n = { abandon: t };
2754
- return e = n, n;
2755
- }
2756
- function i() {
2757
- !e && (process.env.NODE_ENV === "production" ? A() : A(!1, "Cannot release lock when there is no lock")), e = null;
2758
- }
2759
- function a() {
2760
- e && (e.abandon(), i());
2761
- }
2762
- return {
2763
- isClaimed: t,
2764
- isActive: n,
2765
- claim: r,
2766
- release: i,
2767
- tryAbandon: a
2768
- };
2769
- }
2770
- function ta(e) {
2771
- return e.phase === "IDLE" || e.phase === "DROP_ANIMATING" ? !1 : e.isDragging;
2772
- }
2773
- var na = 9, ra = 13, ia = 27, aa = 32, oa = 33, sa = 34, ca = 35, la = 36, ua = 37, da = 38, fa = 39, pa = 40, ma = {
2774
- [ra]: !0,
2775
- [na]: !0
2776
- }, ha = (e) => {
2777
- ma[e.keyCode] && e.preventDefault();
2778
- }, ga = (() => {
2779
- let e = "visibilitychange";
2780
- return typeof document > "u" ? e : [
2781
- e,
2782
- `ms${e}`,
2783
- `webkit${e}`,
2784
- `moz${e}`,
2785
- `o${e}`
2786
- ].find((e) => `on${e}` in document) || e;
2787
- })(), _a = 0, va = 5;
2788
- function ya(e, t) {
2789
- return Math.abs(t.x - e.x) >= va || Math.abs(t.y - e.y) >= va;
2790
- }
2791
- var ba = { type: "IDLE" };
2792
- function xa({ cancel: e, completed: t, getPhase: n, setPhase: r }) {
2793
- return [
2794
- {
2795
- eventName: "mousemove",
2796
- fn: (e) => {
2797
- let { button: t, clientX: i, clientY: a } = e;
2798
- if (t !== _a) return;
2799
- let o = {
2800
- x: i,
2801
- y: a
2802
- }, s = n();
2803
- if (s.type === "DRAGGING") {
2804
- e.preventDefault(), s.actions.move(o);
2805
- return;
2806
- }
2807
- s.type !== "PENDING" && (process.env.NODE_ENV === "production" ? A() : A(!1, "Cannot be IDLE"));
2808
- let c = s.point;
2809
- ya(c, o) && (e.preventDefault(), r({
2810
- type: "DRAGGING",
2811
- actions: s.actions.fluidLift(o)
2812
- }));
2813
- }
2814
- },
2815
- {
2816
- eventName: "mouseup",
2817
- fn: (r) => {
2818
- let i = n();
2819
- if (i.type !== "DRAGGING") {
2820
- e();
2821
- return;
2822
- }
2823
- r.preventDefault(), i.actions.drop({ shouldBlockNextClick: !0 }), t();
2824
- }
2825
- },
2826
- {
2827
- eventName: "mousedown",
2828
- fn: (t) => {
2829
- n().type === "DRAGGING" && t.preventDefault(), e();
2830
- }
2831
- },
2832
- {
2833
- eventName: "keydown",
2834
- fn: (t) => {
2835
- if (n().type === "PENDING") {
2836
- e();
2837
- return;
2838
- }
2839
- if (t.keyCode === ia) {
2840
- t.preventDefault(), e();
2841
- return;
2842
- }
2843
- ha(t);
2844
- }
2845
- },
2846
- {
2847
- eventName: "resize",
2848
- fn: e
2849
- },
2850
- {
2851
- eventName: "scroll",
2852
- options: {
2853
- passive: !0,
2854
- capture: !1
2855
- },
2856
- fn: () => {
2857
- n().type === "PENDING" && e();
2858
- }
2859
- },
2860
- {
2861
- eventName: "webkitmouseforcedown",
2862
- fn: (t) => {
2863
- let r = n();
2864
- if (r.type === "IDLE" && (process.env.NODE_ENV === "production" ? A() : A(!1, "Unexpected phase")), r.actions.shouldRespectForcePress()) {
2865
- e();
2866
- return;
2867
- }
2868
- t.preventDefault();
2869
- }
2870
- },
2871
- {
2872
- eventName: ga,
2873
- fn: e
2874
- }
2875
- ];
2876
- }
2877
- function Sa(e) {
2878
- let t = y(ba), n = y(O), r = j(() => ({
2879
- eventName: "mousedown",
2880
- fn: function(t) {
2881
- if (t.defaultPrevented || t.button !== _a || t.ctrlKey || t.metaKey || t.shiftKey || t.altKey) return;
2882
- let r = e.findClosestDraggableId(t);
2883
- if (!r) return;
2884
- let i = e.tryGetLock(r, o, { sourceEvent: t });
2885
- if (!i) return;
2886
- t.preventDefault();
2887
- let a = {
2888
- x: t.clientX,
2889
- y: t.clientY
2890
- };
2891
- n.current(), l(i, a);
2892
- }
2893
- }), [e]), i = j(() => ({
2894
- eventName: "webkitmouseforcewillbegin",
2895
- fn: (t) => {
2896
- if (t.defaultPrevented) return;
2897
- let n = e.findClosestDraggableId(t);
2898
- if (!n) return;
2899
- let r = e.findOptionsForDraggable(n);
2900
- r && (r.shouldRespectForcePress || e.canGetLock(n) && t.preventDefault());
2901
- }
2902
- }), [e]), a = M(function() {
2903
- n.current = k(window, [i, r], {
2904
- passive: !1,
2905
- capture: !0
2906
- });
2907
- }, [i, r]), o = M(() => {
2908
- t.current.type !== "IDLE" && (t.current = ba, n.current(), a());
2909
- }, [a]), s = M(() => {
2910
- let e = t.current;
2911
- o(), e.type === "DRAGGING" && e.actions.cancel({ shouldBlockNextClick: !0 }), e.type === "PENDING" && e.actions.abort();
2912
- }, [o]), c = M(function() {
2913
- let e = {
2914
- capture: !0,
2915
- passive: !1
2916
- }, r = xa({
2917
- cancel: s,
2918
- completed: o,
2919
- getPhase: () => t.current,
2920
- setPhase: (e) => {
2921
- t.current = e;
2922
- }
2923
- });
2924
- n.current = k(window, r, e);
2925
- }, [s, o]), l = M(function(e, n) {
2926
- t.current.type !== "IDLE" && (process.env.NODE_ENV === "production" ? A() : A(!1, "Expected to move from IDLE to PENDING drag")), t.current = {
2927
- type: "PENDING",
2928
- point: n,
2929
- actions: e
2930
- }, c();
2931
- }, [c]);
2932
- $(function() {
2933
- return a(), function() {
2934
- n.current();
2935
- };
2936
- }, [a]);
2937
- }
2938
- function Ca() {}
2939
- var wa = {
2940
- [sa]: !0,
2941
- [oa]: !0,
2942
- [la]: !0,
2943
- [ca]: !0
2944
- };
2945
- function Ta(e, t) {
2946
- function n() {
2947
- t(), e.cancel();
2948
- }
2949
- function r() {
2950
- t(), e.drop();
2951
- }
2952
- return [
2953
- {
2954
- eventName: "keydown",
2955
- fn: (t) => {
2956
- if (t.keyCode === ia) {
2957
- t.preventDefault(), n();
2958
- return;
2959
- }
2960
- if (t.keyCode === aa) {
2961
- t.preventDefault(), r();
2962
- return;
2963
- }
2964
- if (t.keyCode === pa) {
2965
- t.preventDefault(), e.moveDown();
2966
- return;
2967
- }
2968
- if (t.keyCode === da) {
2969
- t.preventDefault(), e.moveUp();
2970
- return;
2971
- }
2972
- if (t.keyCode === fa) {
2973
- t.preventDefault(), e.moveRight();
2974
- return;
2975
- }
2976
- if (t.keyCode === ua) {
2977
- t.preventDefault(), e.moveLeft();
2978
- return;
2979
- }
2980
- if (wa[t.keyCode]) {
2981
- t.preventDefault();
2982
- return;
2983
- }
2984
- ha(t);
2985
- }
2986
- },
2987
- {
2988
- eventName: "mousedown",
2989
- fn: n
2990
- },
2991
- {
2992
- eventName: "mouseup",
2993
- fn: n
2994
- },
2995
- {
2996
- eventName: "click",
2997
- fn: n
2998
- },
2999
- {
3000
- eventName: "touchstart",
3001
- fn: n
3002
- },
3003
- {
3004
- eventName: "resize",
3005
- fn: n
3006
- },
3007
- {
3008
- eventName: "wheel",
3009
- fn: n,
3010
- options: { passive: !0 }
3011
- },
3012
- {
3013
- eventName: ga,
3014
- fn: n
3015
- }
3016
- ];
3017
- }
3018
- function Ea(e) {
3019
- let t = y(Ca), n = j(() => ({
3020
- eventName: "keydown",
3021
- fn: function(n) {
3022
- if (n.defaultPrevented || n.keyCode !== aa) return;
3023
- let i = e.findClosestDraggableId(n);
3024
- if (!i) return;
3025
- let a = e.tryGetLock(i, c, { sourceEvent: n });
3026
- if (!a) return;
3027
- n.preventDefault();
3028
- let o = !0, s = a.snapLift();
3029
- t.current();
3030
- function c() {
3031
- !o && (process.env.NODE_ENV === "production" ? A() : A(!1, "Cannot stop capturing a keyboard drag when not capturing")), o = !1, t.current(), r();
3032
- }
3033
- t.current = k(window, Ta(s, c), {
3034
- capture: !0,
3035
- passive: !1
3036
- });
3037
- }
3038
- }), [e]), r = M(function() {
3039
- t.current = k(window, [n], {
3040
- passive: !1,
3041
- capture: !0
3042
- });
3043
- }, [n]);
3044
- $(function() {
3045
- return r(), function() {
3046
- t.current();
3047
- };
3048
- }, [r]);
3049
- }
3050
- var Da = { type: "IDLE" }, Oa = 120, ka = .15;
3051
- function Aa({ cancel: e, getPhase: t }) {
3052
- return [
3053
- {
3054
- eventName: "orientationchange",
3055
- fn: e
3056
- },
3057
- {
3058
- eventName: "resize",
3059
- fn: e
3060
- },
3061
- {
3062
- eventName: "contextmenu",
3063
- fn: (e) => {
3064
- e.preventDefault();
3065
- }
3066
- },
3067
- {
3068
- eventName: "keydown",
3069
- fn: (n) => {
3070
- if (t().type !== "DRAGGING") {
3071
- e();
3072
- return;
3073
- }
3074
- n.keyCode === ia && n.preventDefault(), e();
3075
- }
3076
- },
3077
- {
3078
- eventName: ga,
3079
- fn: e
3080
- }
3081
- ];
3082
- }
3083
- function ja({ cancel: e, completed: t, getPhase: n }) {
3084
- return [
3085
- {
3086
- eventName: "touchmove",
3087
- options: { capture: !1 },
3088
- fn: (t) => {
3089
- let r = n();
3090
- if (r.type !== "DRAGGING") {
3091
- e();
3092
- return;
3093
- }
3094
- r.hasMoved = !0;
3095
- let { clientX: i, clientY: a } = t.touches[0], o = {
3096
- x: i,
3097
- y: a
3098
- };
3099
- t.preventDefault(), r.actions.move(o);
3100
- }
3101
- },
3102
- {
3103
- eventName: "touchend",
3104
- fn: (r) => {
3105
- let i = n();
3106
- if (i.type !== "DRAGGING") {
3107
- e();
3108
- return;
3109
- }
3110
- r.preventDefault(), i.actions.drop({ shouldBlockNextClick: !0 }), t();
3111
- }
3112
- },
3113
- {
3114
- eventName: "touchcancel",
3115
- fn: (t) => {
3116
- if (n().type !== "DRAGGING") {
3117
- e();
3118
- return;
3119
- }
3120
- t.preventDefault(), e();
3121
- }
3122
- },
3123
- {
3124
- eventName: "touchforcechange",
3125
- fn: (t) => {
3126
- let r = n();
3127
- r.type === "IDLE" && (process.env.NODE_ENV, A());
3128
- let i = t.touches[0];
3129
- if (!i || !(i.force >= ka)) return;
3130
- let a = r.actions.shouldRespectForcePress();
3131
- if (r.type === "PENDING") {
3132
- a && e();
3133
- return;
3134
- }
3135
- if (a) {
3136
- if (r.hasMoved) {
3137
- t.preventDefault();
3138
- return;
3139
- }
3140
- e();
3141
- return;
3142
- }
3143
- t.preventDefault();
3144
- }
3145
- },
3146
- {
3147
- eventName: ga,
3148
- fn: e
3149
- }
3150
- ];
3151
- }
3152
- function Ma(e) {
3153
- let t = y(Da), n = y(O), r = M(function() {
3154
- return t.current;
3155
- }, []), i = M(function(e) {
3156
- t.current = e;
3157
- }, []), a = j(() => ({
3158
- eventName: "touchstart",
3159
- fn: function(t) {
3160
- if (t.defaultPrevented) return;
3161
- let r = e.findClosestDraggableId(t);
3162
- if (!r) return;
3163
- let i = e.tryGetLock(r, s, { sourceEvent: t });
3164
- if (!i) return;
3165
- let { clientX: a, clientY: o } = t.touches[0], c = {
3166
- x: a,
3167
- y: o
3168
- };
3169
- n.current(), d(i, c);
3170
- }
3171
- }), [e]), o = M(function() {
3172
- n.current = k(window, [a], {
3173
- capture: !0,
3174
- passive: !1
3175
- });
3176
- }, [a]), s = M(() => {
3177
- let e = t.current;
3178
- e.type !== "IDLE" && (e.type === "PENDING" && clearTimeout(e.longPressTimerId), i(Da), n.current(), o());
3179
- }, [o, i]), c = M(() => {
3180
- let e = t.current;
3181
- s(), e.type === "DRAGGING" && e.actions.cancel({ shouldBlockNextClick: !0 }), e.type === "PENDING" && e.actions.abort();
3182
- }, [s]), l = M(function() {
3183
- let e = {
3184
- capture: !0,
3185
- passive: !1
3186
- }, t = {
3187
- cancel: c,
3188
- completed: s,
3189
- getPhase: r
3190
- }, i = k(window, ja(t), e), a = k(window, Aa(t), e);
3191
- n.current = function() {
3192
- i(), a();
3193
- };
3194
- }, [
3195
- c,
3196
- r,
3197
- s
3198
- ]), u = M(function() {
3199
- let e = r();
3200
- e.type !== "PENDING" && (process.env.NODE_ENV === "production" ? A() : A(!1, `Cannot start dragging from phase ${e.type}`)), i({
3201
- type: "DRAGGING",
3202
- actions: e.actions.fluidLift(e.point),
3203
- hasMoved: !1
3204
- });
3205
- }, [r, i]), d = M(function(e, t) {
3206
- r().type !== "IDLE" && (process.env.NODE_ENV === "production" ? A() : A(!1, "Expected to move from IDLE to PENDING drag")), i({
3207
- type: "PENDING",
3208
- point: t,
3209
- actions: e,
3210
- longPressTimerId: setTimeout(u, Oa)
3211
- }), l();
3212
- }, [
3213
- l,
3214
- r,
3215
- i,
3216
- u
3217
- ]);
3218
- $(function() {
3219
- return o(), function() {
3220
- n.current();
3221
- let e = r();
3222
- e.type === "PENDING" && (clearTimeout(e.longPressTimerId), i(Da));
3223
- };
3224
- }, [
3225
- r,
3226
- o,
3227
- i
3228
- ]), $(function() {
3229
- return k(window, [{
3230
- eventName: "touchmove",
3231
- fn: () => {},
3232
- options: {
3233
- capture: !1,
3234
- passive: !1
3235
- }
3236
- }]);
3237
- }, []);
3238
- }
3239
- function Na(e) {
3240
- Xi(() => {
3241
- let t = $i(e);
3242
- Zi(() => {
3243
- t.current.length !== e.length && (process.env.NODE_ENV === "production" ? A(!1) : A(!1, "Cannot change the amount of sensor hooks after mounting"));
3244
- });
3245
- });
3246
- }
3247
- var Pa = [
3248
- "input",
3249
- "button",
3250
- "textarea",
3251
- "select",
3252
- "option",
3253
- "optgroup",
3254
- "video",
3255
- "audio"
3256
- ];
3257
- function Fa(e, t) {
3258
- if (t == null) return !1;
3259
- if (Pa.includes(t.tagName.toLowerCase())) return !0;
3260
- let n = t.getAttribute("contenteditable");
3261
- return n === "true" || n === "" ? !0 : t === e ? !1 : Fa(e, t.parentElement);
3262
- }
3263
- function Ia(e, t) {
3264
- let n = t.target;
3265
- return Oi(n) ? Fa(e, n) : !1;
3266
- }
3267
- var La = (e) => u(e.getBoundingClientRect()).center;
3268
- function Ra(e) {
3269
- return e instanceof Di(e).Element;
3270
- }
3271
- var za = (() => {
3272
- let e = "matches";
3273
- return typeof document > "u" ? e : [
3274
- e,
3275
- "msMatchesSelector",
3276
- "webkitMatchesSelector"
3277
- ].find((e) => e in Element.prototype) || e;
3278
- })();
3279
- function Ba(e, t) {
3280
- return e == null ? null : e[za](t) ? e : Ba(e.parentElement, t);
3281
- }
3282
- function Va(e, t) {
3283
- return e.closest ? e.closest(t) : Ba(e, t);
3284
- }
3285
- function Ha(e) {
3286
- return `[${Q.contextId}="${e}"]`;
3287
- }
3288
- function Ua(e, t) {
3289
- let n = t.target;
3290
- if (!Ra(n)) return process.env.NODE_ENV !== "production" && D("event.target must be a Element"), null;
3291
- let r = Va(n, Ha(e));
3292
- return r ? Oi(r) ? r : (process.env.NODE_ENV !== "production" && D("drag handle must be a HTMLElement"), null) : null;
3293
- }
3294
- function Wa(e, t) {
3295
- let n = Ua(e, t);
3296
- return n ? n.getAttribute(Q.draggableId) : null;
3297
- }
3298
- function Ga(e, t) {
3299
- let n = `[${gi.contextId}="${e}"]`, r = Ei(document, n).find((e) => e.getAttribute(gi.id) === t);
3300
- return r ? Oi(r) ? r : (process.env.NODE_ENV !== "production" && D("Draggable element is not a HTMLElement"), null) : null;
3301
- }
3302
- function Ka(e) {
3303
- e.preventDefault();
3304
- }
3305
- function qa({ expected: e, phase: t, isLockActive: n, shouldWarn: r }) {
3306
- return n() ? e === t ? !0 : (r && process.env.NODE_ENV !== "production" && D(`
3307
- Cannot perform action.
3308
- The actions you used belong to an outdated phase
3309
-
3310
- Current phase: ${e}
3311
- You called an action from outdated phase: ${t}
3312
-
3313
- Tips:
3314
-
3315
- - Do not use preDragActions actions after calling preDragActions.lift()
3316
- `), !1) : (r && process.env.NODE_ENV !== "production" && D("\n Cannot perform action.\n The sensor no longer has an action lock.\n\n Tips:\n\n - Throw away your action handlers when forceStop() is called\n - Check actions.isActive() if you really need to\n "), !1);
3317
- }
3318
- function Ja({ lockAPI: e, store: t, registry: n, draggableId: r }) {
3319
- if (e.isClaimed()) return !1;
3320
- let i = n.draggable.findById(r);
3321
- return i ? !(!i.options.isEnabled || !Vr(t.getState(), r)) : (process.env.NODE_ENV !== "production" && D(`Unable to find draggable with id: ${r}`), !1);
3322
- }
3323
- function Ya({ lockAPI: e, contextId: t, store: n, registry: r, draggableId: i, forceSensorStop: a, sourceEvent: o }) {
3324
- if (!Ja({
3325
- lockAPI: e,
3326
- store: n,
3327
- registry: r,
3328
- draggableId: i
3329
- })) return null;
3330
- let s = r.draggable.getById(i), c = Ga(t, s.descriptor.id);
3331
- if (!c) return process.env.NODE_ENV !== "production" && D(`Unable to find draggable element with id: ${i}`), null;
3332
- if (o && !s.options.canDragInteractiveElements && Ia(c, o)) return null;
3333
- let l = e.claim(a || O), u = "PRE_DRAG";
3334
- function d() {
3335
- return s.options.shouldRespectForcePress;
3336
- }
3337
- function f() {
3338
- return e.isActive(l);
3339
- }
3340
- function m(e, t) {
3341
- qa({
3342
- expected: e,
3343
- phase: u,
3344
- isLockActive: f,
3345
- shouldWarn: !0
3346
- }) && n.dispatch(t());
3347
- }
3348
- let h = m.bind(null, "DRAGGING");
3349
- function g(t) {
3350
- function r() {
3351
- e.release(), u = "COMPLETED";
3352
- }
3353
- u !== "PRE_DRAG" && (r(), process.env.NODE_ENV === "production" ? A() : A(!1, `Cannot lift in phase ${u}`)), n.dispatch(Cn(t.liftActionArgs)), u = "DRAGGING";
3354
- function i(e, i = { shouldBlockNextClick: !1 }) {
3355
- if (t.cleanup(), i.shouldBlockNextClick) {
3356
- let e = k(window, [{
3357
- eventName: "click",
3358
- fn: Ka,
3359
- options: {
3360
- once: !0,
3361
- passive: !1,
3362
- capture: !0
3363
- }
3364
- }]);
3365
- setTimeout(e);
3366
- }
3367
- r(), n.dispatch(Bn({ reason: e }));
3368
- }
3369
- return {
3370
- isActive: () => qa({
3371
- expected: "DRAGGING",
3372
- phase: u,
3373
- isLockActive: f,
3374
- shouldWarn: !1
3375
- }),
3376
- shouldRespectForcePress: d,
3377
- drop: (e) => i("DROP", e),
3378
- cancel: (e) => i("CANCEL", e),
3379
- ...t.actions
3380
- };
3381
- }
3382
- function _(e) {
3383
- let t = p((e) => {
3384
- h(() => An({ client: e }));
3385
- });
3386
- return {
3387
- ...g({
3388
- liftActionArgs: {
3389
- id: i,
3390
- clientSelection: e,
3391
- movementMode: "FLUID"
3392
- },
3393
- cleanup: () => t.cancel(),
3394
- actions: { move: t }
3395
- }),
3396
- move: t
3397
- };
3398
- }
3399
- function v() {
3400
- return g({
3401
- liftActionArgs: {
3402
- id: i,
3403
- clientSelection: La(c),
3404
- movementMode: "SNAP"
3405
- },
3406
- cleanup: O,
3407
- actions: {
3408
- moveUp: () => h(Nn),
3409
- moveRight: () => h(Fn),
3410
- moveDown: () => h(Pn),
3411
- moveLeft: () => h(In)
3412
- }
3413
- });
3414
- }
3415
- function y() {
3416
- qa({
3417
- expected: "PRE_DRAG",
3418
- phase: u,
3419
- isLockActive: f,
3420
- shouldWarn: !0
3421
- }) && e.release();
3422
- }
3423
- return {
3424
- isActive: () => qa({
3425
- expected: "PRE_DRAG",
3426
- phase: u,
3427
- isLockActive: f,
3428
- shouldWarn: !1
3429
- }),
3430
- shouldRespectForcePress: d,
3431
- fluidLift: _,
3432
- snapLift: v,
3433
- abort: y
3434
- };
3435
- }
3436
- var Xa = [
3437
- Sa,
3438
- Ea,
3439
- Ma
3440
- ];
3441
- function Za({ contextId: e, store: t, registry: n, customSensors: r, enableDefaultSensors: i }) {
3442
- let a = [...i ? Xa : [], ...r || []], o = b(() => ea())[0], s = M(function(e, t) {
3443
- ta(e) && !ta(t) && o.tryAbandon();
3444
- }, [o]);
3445
- $(function() {
3446
- let e = t.getState();
3447
- return t.subscribe(() => {
3448
- let n = t.getState();
3449
- s(e, n), e = n;
3450
- });
3451
- }, [
3452
- o,
3453
- t,
3454
- s
3455
- ]), $(() => o.tryAbandon, [o.tryAbandon]);
3456
- let c = M((e) => Ja({
3457
- lockAPI: o,
3458
- registry: n,
3459
- store: t,
3460
- draggableId: e
3461
- }), [
3462
- o,
3463
- n,
3464
- t
3465
- ]), l = M((r, i, a) => Ya({
3466
- lockAPI: o,
3467
- registry: n,
3468
- contextId: e,
3469
- store: t,
3470
- draggableId: r,
3471
- forceSensorStop: i || null,
3472
- sourceEvent: a && a.sourceEvent ? a.sourceEvent : null
3473
- }), [
3474
- e,
3475
- o,
3476
- n,
3477
- t
3478
- ]), u = M((t) => Wa(e, t), [e]), d = M((e) => {
3479
- let t = n.draggable.findById(e);
3480
- return t ? t.options : null;
3481
- }, [n.draggable]), f = M(function() {
3482
- o.isClaimed() && (o.tryAbandon(), t.getState().phase !== "IDLE" && t.dispatch(Ln()));
3483
- }, [o, t]), p = M(() => o.isClaimed(), [o]), m = j(() => ({
3484
- canGetLock: c,
3485
- tryGetLock: l,
3486
- findClosestDraggableId: u,
3487
- findOptionsForDraggable: d,
3488
- tryReleaseLock: f,
3489
- isLockClaimed: p
3490
- }), [
3491
- c,
3492
- l,
3493
- u,
3494
- d,
3495
- f,
3496
- p
3497
- ]);
3498
- Na(a);
3499
- for (let e = 0; e < a.length; e++) a[e](m);
3500
- }
3501
- var Qa = (e) => ({
3502
- onBeforeCapture: (t) => {
3503
- S(() => {
3504
- e.onBeforeCapture && e.onBeforeCapture(t);
3505
- });
3506
- },
3507
- onBeforeDragStart: e.onBeforeDragStart,
3508
- onDragStart: e.onDragStart,
3509
- onDragEnd: e.onDragEnd,
3510
- onDragUpdate: e.onDragUpdate
3511
- }), $a = (e) => ({
3512
- ...Kr,
3513
- ...e.autoScrollerOptions,
3514
- durationDampening: {
3515
- ...Kr.durationDampening,
3516
- ...e.autoScrollerOptions
3517
- }
3518
- });
3519
- function eo(e) {
3520
- return !e.current && (process.env.NODE_ENV === "production" ? A() : A(!1, "Could not find store from lazy ref")), e.current;
3521
- }
3522
- function to(e) {
3523
- let { contextId: n, setCallbacks: r, sensors: a, nonce: o, dragHandleUsageInstructions: s } = e, c = y(null);
3524
- Qi();
3525
- let l = $i(e), u = M(() => Qa(l.current), [l]), d = M(() => $a(l.current), [l]), f = Li(n), p = Vi({
3526
- contextId: n,
3527
- text: s
3528
- }), m = Ti(n, o), g = M((e) => {
3529
- eo(c).dispatch(e);
3530
- }, []), v = j(() => t({
3531
- publishWhileDragging: Tn,
3532
- updateDroppableScroll: Dn,
3533
- updateDroppableIsEnabled: On,
3534
- updateDroppableIsCombineEnabled: kn,
3535
- collectionStarting: En
3536
- }, g), [g]), b = Mi(), x = j(() => Br(b, v), [b, v]), S = j(() => hi({
3537
- scrollWindow: Hr,
3538
- scrollDroppable: x.scrollDroppable,
3539
- getAutoScrollerOptions: d,
3540
- ...t({ move: An }, g)
3541
- }), [
3542
- x.scrollDroppable,
3543
- g,
3544
- d
3545
- ]), C = Ai(n), w = j(() => jr({
3546
- announce: f,
3547
- autoScroller: S,
3548
- dimensionMarshal: x,
3549
- focusMarshal: C,
3550
- getResponders: u,
3551
- styleMarshal: m
3552
- }), [
3553
- f,
3554
- S,
3555
- x,
3556
- C,
3557
- u,
3558
- m
3559
- ]);
3560
- process.env.NODE_ENV !== "production" && c.current && c.current !== w && process.env.NODE_ENV !== "production" && D("unexpected store change"), c.current = w;
3561
- let T = M(() => {
3562
- let e = eo(c);
3563
- e.getState().phase !== "IDLE" && e.dispatch(Ln());
3564
- }, []), E = M(() => {
3565
- let e = eo(c).getState();
3566
- return e.phase === "DROP_ANIMATING" ? !0 : e.phase === "IDLE" ? !1 : e.isDragging;
3567
- }, []);
3568
- r(j(() => ({
3569
- isDragging: E,
3570
- tryAbort: T
3571
- }), [E, T]));
3572
- let ee = M((e) => Vr(eo(c).getState(), e), []), te = M(() => J(eo(c).getState()), []), ne = j(() => ({
3573
- marshal: x,
3574
- focus: C,
3575
- contextId: n,
3576
- canLift: ee,
3577
- isMovementAllowed: te,
3578
- dragHandleUsageInstructionsId: p,
3579
- registry: b
3580
- }), [
3581
- n,
3582
- x,
3583
- p,
3584
- C,
3585
- ee,
3586
- te,
3587
- b
3588
- ]);
3589
- return Za({
3590
- contextId: n,
3591
- store: w,
3592
- registry: b,
3593
- customSensors: a || null,
3594
- enableDefaultSensors: e.enableDefaultSensors !== !1
3595
- }), _(() => T, [T]), h.createElement(Hi.Provider, { value: ne }, h.createElement(i, {
3596
- context: Ni,
3597
- store: w
3598
- }, e.children));
3599
- }
3600
- function no() {
3601
- return h.useId();
3602
- }
3603
- function ro(e) {
3604
- let t = no(), n = e.dragHandleUsageInstructions || _e.dragHandleUsageInstructions;
3605
- return h.createElement(le, null, (r) => h.createElement(to, {
3606
- nonce: e.nonce,
3607
- contextId: t,
3608
- setCallbacks: r,
3609
- dragHandleUsageInstructions: n,
3610
- enableDefaultSensors: e.enableDefaultSensors,
3611
- sensors: e.sensors,
3612
- onBeforeCapture: e.onBeforeCapture,
3613
- onBeforeDragStart: e.onBeforeDragStart,
3614
- onDragStart: e.onDragStart,
3615
- onDragUpdate: e.onDragUpdate,
3616
- onDragEnd: e.onDragEnd,
3617
- autoScrollerOptions: e.autoScrollerOptions
3618
- }, e.children));
3619
- }
3620
- var io = {
3621
- dragging: 5e3,
3622
- dropAnimating: 4500
3623
- }, ao = (e, t) => t ? Xn.drop(t.duration) : e ? Xn.snap : Xn.fluid, oo = (e, t) => {
3624
- if (e) return t ? Jn.opacity.drop : Jn.opacity.combining;
3625
- }, so = (e) => e.forceShouldAnimate == null ? e.mode === "SNAP" : e.forceShouldAnimate;
3626
- function co(e) {
3627
- let t = e.dimension.client, { offset: n, combineWith: r, dropping: i } = e, a = !!r, o = so(e), s = !!i, c = s ? Qn.drop(n, a) : Qn.moveTo(n);
3628
- return {
3629
- position: "fixed",
3630
- top: t.marginBox.top,
3631
- left: t.marginBox.left,
3632
- boxSizing: "border-box",
3633
- width: t.borderBox.width,
3634
- height: t.borderBox.height,
3635
- transition: ao(o, i),
3636
- transform: c,
3637
- opacity: oo(a, s),
3638
- zIndex: s ? io.dropAnimating : io.dragging,
3639
- pointerEvents: "none"
3640
- };
3641
- }
3642
- function lo(e) {
3643
- return {
3644
- transform: Qn.moveTo(e.offset),
3645
- transition: e.shouldAnimateDisplacement ? void 0 : "none"
3646
- };
3647
- }
3648
- function uo(e) {
3649
- return e.type === "DRAGGING" ? co(e) : lo(e);
3650
- }
3651
- function fo(e, t, n = N) {
3652
- let r = window.getComputedStyle(t), i = o(t.getBoundingClientRect(), r), a = f(i, n);
3653
- return {
3654
- descriptor: e,
3655
- placeholder: {
3656
- client: i,
3657
- tagName: t.tagName.toLowerCase(),
3658
- display: r.display
3659
- },
3660
- displaceBy: {
3661
- x: i.marginBox.width,
3662
- y: i.marginBox.height
3663
- },
3664
- client: i,
3665
- page: a
3666
- };
3667
- }
3668
- function po(e) {
3669
- let t = zi("draggable"), { descriptor: n, registry: r, getDraggableRef: i, canDragInteractiveElements: a, shouldRespectForcePress: o, isEnabled: s } = e, c = j(() => ({
3670
- canDragInteractiveElements: a,
3671
- shouldRespectForcePress: o,
3672
- isEnabled: s
3673
- }), [
3674
- a,
3675
- s,
3676
- o
3677
- ]), l = M((e) => {
3678
- let t = i();
3679
- return !t && (process.env.NODE_ENV === "production" ? A() : A(!1, "Cannot get dimension when no ref is set")), fo(n, t, e);
3680
- }, [n, i]), u = j(() => ({
3681
- uniqueId: t,
3682
- descriptor: n,
3683
- options: c,
3684
- getDimension: l
3685
- }), [
3686
- n,
3687
- l,
3688
- c,
3689
- t
3690
- ]), d = y(u), f = y(!0);
3691
- $(() => (r.draggable.register(d.current), () => r.draggable.unregister(d.current)), [r.draggable]), $(() => {
3692
- if (f.current) {
3693
- f.current = !1;
3694
- return;
3695
- }
3696
- let e = d.current;
3697
- d.current = u, r.draggable.update(u, e);
3698
- }, [u, r.draggable]);
3699
- }
3700
- var mo = h.createContext(null);
3701
- function ho(e) {
3702
- !(e && Oi(e)) && (process.env.NODE_ENV === "production" ? A() : A(!1, "\n provided.innerRef has not been provided with a HTMLElement.\n\n You can find a guide on using the innerRef callback functions at:\n https://github.com/hello-pangea/dnd/blob/main/docs/guides/using-inner-ref.md\n "));
3703
- }
3704
- function go(e, t, n) {
3705
- Zi(() => {
3706
- function r(e) {
3707
- return `Draggable[id: ${e}]: `;
3708
- }
3709
- let i = e.draggableId;
3710
- !i && (process.env.NODE_ENV === "production" ? A(!1) : A(!1, "Draggable requires a draggableId")), typeof i != "string" && (process.env.NODE_ENV === "production" ? A(!1) : A(!1, `Draggable requires a [string] draggableId.
3711
- Provided: [type: ${typeof i}] (value: ${i})`)), !Number.isInteger(e.index) && (process.env.NODE_ENV === "production" ? A(!1) : A(!1, `${r(i)} requires an integer index prop`)), e.mapped.type !== "DRAGGING" && (ho(n()), e.isEnabled && !ki(t, i) && (process.env.NODE_ENV === "production" ? A(!1) : A(!1, `${r(i)} Unable to find drag handle`)));
3712
- });
3713
- }
3714
- function _o(e) {
3715
- Xi(() => {
3716
- let t = y(e);
3717
- Zi(() => {
3718
- e !== t.current && (process.env.NODE_ENV === "production" ? A(!1) : A(!1, "Draggable isClone prop value changed during component life"));
3719
- }, [e]);
3720
- });
3721
- }
3722
- function vo(e) {
3723
- let t = g(e);
3724
- return !t && (process.env.NODE_ENV === "production" ? A() : A(!1, "Could not find required context")), t;
3725
- }
3726
- function yo(e) {
3727
- e.preventDefault();
3728
- }
3729
- var bo = (e) => {
3730
- let t = y(null), n = M((e = null) => {
3731
- t.current = e;
3732
- }, []), r = M(() => t.current, []), { contextId: i, dragHandleUsageInstructionsId: a, registry: o } = vo(Hi), { type: s, droppableId: c } = vo(mo), l = j(() => ({
3733
- id: e.draggableId,
3734
- index: e.index,
3735
- type: s,
3736
- droppableId: c
3737
- }), [
3738
- e.draggableId,
3739
- e.index,
3740
- s,
3741
- c
3742
- ]), { children: u, draggableId: d, isEnabled: f, shouldRespectForcePress: p, canDragInteractiveElements: m, isClone: g, mapped: _, dropAnimationFinished: v } = e;
3743
- go(e, i, r), _o(g), g || po(j(() => ({
3744
- descriptor: l,
3745
- registry: o,
3746
- getDraggableRef: r,
3747
- canDragInteractiveElements: m,
3748
- shouldRespectForcePress: p,
3749
- isEnabled: f
3750
- }), [
3751
- l,
3752
- o,
3753
- r,
3754
- m,
3755
- p,
3756
- f
3757
- ]));
3758
- let b = j(() => f ? {
3759
- tabIndex: 0,
3760
- role: "button",
3761
- "aria-describedby": a,
3762
- "data-rfd-drag-handle-draggable-id": d,
3763
- "data-rfd-drag-handle-context-id": i,
3764
- draggable: !1,
3765
- onDragStart: yo
3766
- } : null, [
3767
- i,
3768
- a,
3769
- d,
3770
- f
3771
- ]), x = M((e) => {
3772
- _.type === "DRAGGING" && _.dropping && e.propertyName === "transform" && S(v);
3773
- }, [v, _]), C = j(() => ({
3774
- innerRef: n,
3775
- draggableProps: {
3776
- "data-rfd-draggable-context-id": i,
3777
- "data-rfd-draggable-id": d,
3778
- style: uo(_),
3779
- onTransitionEnd: _.type === "DRAGGING" && _.dropping ? x : void 0
3780
- },
3781
- dragHandleProps: b
3782
- }), [
3783
- i,
3784
- b,
3785
- d,
3786
- _,
3787
- x,
3788
- n
3789
- ]), w = j(() => ({
3790
- draggableId: l.id,
3791
- type: l.type,
3792
- source: {
3793
- index: l.index,
3794
- droppableId: l.droppableId
3795
- }
3796
- }), [
3797
- l.droppableId,
3798
- l.id,
3799
- l.index,
3800
- l.type
3801
- ]);
3802
- return h.createElement(h.Fragment, null, u(C, _.snapshot, w));
3803
- }, xo = (e, t) => e === t, So = (e) => {
3804
- let { combine: t, destination: n } = e;
3805
- return n ? n.droppableId : t ? t.droppableId : null;
3806
- }, Co = (e) => e.combine ? e.combine.draggableId : null, wo = (e) => e.at && e.at.type === "COMBINE" ? e.at.combine.draggableId : null;
3807
- function To() {
3808
- let e = B((e, t) => ({
3809
- x: e,
3810
- y: t
3811
- })), t = B((e, t, n = null, r = null, i = null) => ({
3812
- isDragging: !0,
3813
- isClone: t,
3814
- isDropAnimating: !!i,
3815
- dropAnimation: i,
3816
- mode: e,
3817
- draggingOver: n,
3818
- combineWith: r,
3819
- combineTargetFor: null
3820
- })), n = B((e, n, r, i, a = null, o = null, s = null) => ({ mapped: {
3821
- type: "DRAGGING",
3822
- dropping: null,
3823
- draggingOver: a,
3824
- combineWith: o,
3825
- mode: n,
3826
- offset: e,
3827
- dimension: r,
3828
- forceShouldAnimate: s,
3829
- snapshot: t(n, i, a, o, null)
3830
- } }));
3831
- return (r, i) => {
3832
- if (ta(r)) {
3833
- if (r.critical.draggable.id !== i.draggableId) return null;
3834
- let t = r.current.client.offset, a = r.dimensions.draggables[i.draggableId], o = q(r.impact), s = wo(r.impact), c = r.forceShouldAnimate;
3835
- return n(e(t.x, t.y), r.movementMode, a, i.isClone, o, s, c);
3836
- }
3837
- if (r.phase === "DROP_ANIMATING") {
3838
- let e = r.completed;
3839
- if (e.result.draggableId !== i.draggableId) return null;
3840
- let n = i.isClone, a = r.dimensions.draggables[i.draggableId], o = e.result, s = o.mode, c = So(o), l = Co(o), u = {
3841
- duration: r.dropDuration,
3842
- curve: qn.drop,
3843
- moveTo: r.newHomeClientOffset,
3844
- opacity: l ? Jn.opacity.drop : null,
3845
- scale: l ? Jn.scale.drop : null
3846
- };
3847
- return { mapped: {
3848
- type: "DRAGGING",
3849
- offset: r.newHomeClientOffset,
3850
- dimension: a,
3851
- dropping: u,
3852
- draggingOver: c,
3853
- combineWith: l,
3854
- mode: s,
3855
- forceShouldAnimate: null,
3856
- snapshot: t(s, n, c, l, u)
3857
- } };
3858
- }
3859
- return null;
3860
- };
3861
- }
3862
- function Eo(e = null) {
3863
- return {
3864
- isDragging: !1,
3865
- isDropAnimating: !1,
3866
- isClone: !1,
3867
- dropAnimation: null,
3868
- mode: null,
3869
- draggingOver: null,
3870
- combineTargetFor: e,
3871
- combineWith: null
3872
- };
3873
- }
3874
- var Do = { mapped: {
3875
- type: "SECONDARY",
3876
- offset: N,
3877
- combineTargetFor: null,
3878
- shouldAnimateDisplacement: !0,
3879
- snapshot: Eo(null)
3880
- } };
3881
- function Oo() {
3882
- let e = B((e, t) => ({
3883
- x: e,
3884
- y: t
3885
- })), t = B(Eo), n = B((e, n = null, r) => ({ mapped: {
3886
- type: "SECONDARY",
3887
- offset: e,
3888
- combineTargetFor: n,
3889
- shouldAnimateDisplacement: r,
3890
- snapshot: t(n)
3891
- } })), r = (e) => e ? n(N, e, !0) : null, i = (t, i, a, o) => {
3892
- let s = a.displaced.visible[t], c = !!(o.inVirtualList && o.effected[t]), l = Ie(a), u = l && l.draggableId === t ? i : null;
3893
- if (!s) {
3894
- if (!c) return r(u);
3895
- if (a.displaced.invisible[t]) return null;
3896
- let i = L(o.displacedBy.point);
3897
- return n(e(i.x, i.y), u, !0);
3898
- }
3899
- if (c) return r(u);
3900
- let d = a.displacedBy.point;
3901
- return n(e(d.x, d.y), u, s.shouldAnimate);
3902
- };
3903
- return (e, t) => {
3904
- if (ta(e)) return e.critical.draggable.id === t.draggableId ? null : i(t.draggableId, e.critical.draggable.id, e.impact, e.afterCritical);
3905
- if (e.phase === "DROP_ANIMATING") {
3906
- let n = e.completed;
3907
- return n.result.draggableId === t.draggableId ? null : i(t.draggableId, n.result.draggableId, n.impact, n.afterCritical);
3908
- }
3909
- return null;
3910
- };
3911
- }
3912
- var ko = a(() => {
3913
- let e = To(), t = Oo();
3914
- return (n, r) => e(n, r) || t(n, r) || Do;
3915
- }, { dropAnimationFinished: Hn }, null, {
3916
- context: Ni,
3917
- areStatePropsEqual: xo
3918
- })(bo);
3919
- function Ao(e) {
3920
- return vo(mo).isUsingCloneFor === e.draggableId && !e.isClone ? null : h.createElement(ko, e);
3921
- }
3922
- function jo(e) {
3923
- let t = typeof e.isDragDisabled == "boolean" ? !e.isDragDisabled : !0, n = !!e.disableInteractiveElementBlocking, r = !!e.shouldRespectForcePress;
3924
- return h.createElement(Ao, m({}, e, {
3925
- isClone: !1,
3926
- isEnabled: t,
3927
- canDragInteractiveElements: n,
3928
- shouldRespectForcePress: r
3929
- }));
3930
- }
3931
- var Mo = (e) => (t) => e === t, No = Mo("scroll"), Po = Mo("auto"), Fo = Mo("visible"), Io = (e, t) => t(e.overflowX) || t(e.overflowY), Lo = (e, t) => t(e.overflowX) && t(e.overflowY), Ro = (e) => {
3932
- let t = window.getComputedStyle(e), n = {
3933
- overflowX: t.overflowX,
3934
- overflowY: t.overflowY
3935
- };
3936
- return Io(n, No) || Io(n, Po);
3937
- }, zo = () => {
3938
- if (process.env.NODE_ENV === "production") return !1;
3939
- let e = Pi(), t = document.documentElement;
3940
- if (!t && (process.env.NODE_ENV, A()), !Ro(e)) return !1;
3941
- let n = window.getComputedStyle(t);
3942
- return Lo({
3943
- overflowX: n.overflowX,
3944
- overflowY: n.overflowY
3945
- }, Fo) || process.env.NODE_ENV !== "production" && D("\n We have detected that your <body> element might be a scroll container.\n We have found no reliable way of detecting whether the <body> element is a scroll container.\n Under most circumstances a <body> scroll bar will be on the <html> element (document.documentElement)\n\n Because we cannot determine if the <body> is a scroll container, and generally it is not one,\n we will be treating the <body> as *not* a scroll container\n\n More information: https://github.com/hello-pangea/dnd/blob/main/docs/guides/how-we-detect-scroll-containers.md\n "), !1;
3946
- }, Bo = (e) => e == null ? null : e === document.body ? zo() ? e : null : e === document.documentElement ? null : Ro(e) ? e : Bo(e.parentElement), Vo = (e) => {
3947
- e && Bo(e.parentElement) && process.env.NODE_ENV !== "production" && D("\n Droppable: unsupported nested scroll container detected.\n A Droppable can only have one scroll parent (which can be itself)\n Nested scroll containers are currently not supported.\n\n We hope to support nested scroll containers soon: https://github.com/atlassian/react-beautiful-dnd/issues/131\n ");
3948
- }, Ho = (e) => ({
3949
- x: e.scrollLeft,
3950
- y: e.scrollTop
3951
- }), Uo = (e) => e ? window.getComputedStyle(e).position === "fixed" ? !0 : Uo(e.parentElement) : !1, Wo = (e) => ({
3952
- closestScrollable: Bo(e),
3953
- isFixedOnPage: Uo(e)
3954
- }), Go = ({ descriptor: e, isEnabled: t, isCombineEnabled: n, isFixedOnPage: r, direction: i, client: a, page: o, closest: s }) => {
3955
- let c = (() => {
3956
- if (!s) return null;
3957
- let { scrollSize: e, client: t } = s, n = Pr({
3958
- scrollHeight: e.scrollHeight,
3959
- scrollWidth: e.scrollWidth,
3960
- height: t.paddingBox.height,
3961
- width: t.paddingBox.width
3962
- });
3963
- return {
3964
- pageMarginBox: s.page.marginBox,
3965
- frameClient: t,
3966
- scrollSize: e,
3967
- shouldClipSubject: s.shouldClipSubject,
3968
- scroll: {
3969
- initial: s.scroll,
3970
- current: s.scroll,
3971
- max: n,
3972
- diff: {
3973
- value: N,
3974
- displacement: N
3975
- }
3976
- }
3977
- };
3978
- })(), l = i === "vertical" ? Ue : We;
3979
- return {
3980
- descriptor: e,
3981
- isCombineEnabled: n,
3982
- isFixedOnPage: r,
3983
- axis: l,
3984
- isEnabled: t,
3985
- client: a,
3986
- page: o,
3987
- frame: c,
3988
- subject: z({
3989
- page: o,
3990
- withPlaceholder: null,
3991
- axis: l,
3992
- frame: c
3993
- })
3994
- };
3995
- }, Ko = (e, t) => {
3996
- let n = l(e);
3997
- if (!t || e !== t) return n;
3998
- let r = n.paddingBox.top - t.scrollTop, i = n.paddingBox.left - t.scrollLeft, a = r + t.scrollHeight;
3999
- return s({
4000
- borderBox: c({
4001
- top: r,
4002
- right: i + t.scrollWidth,
4003
- bottom: a,
4004
- left: i
4005
- }, n.border),
4006
- margin: n.margin,
4007
- border: n.border,
4008
- padding: n.padding
4009
- });
4010
- }, qo = ({ ref: e, descriptor: t, env: n, windowScroll: r, direction: i, isDropDisabled: a, isCombineEnabled: o, shouldClipSubject: s }) => {
4011
- let c = n.closestScrollable, u = Ko(e, c), d = f(u, r), p = (() => {
4012
- if (!c) return null;
4013
- let e = l(c), t = {
4014
- scrollHeight: c.scrollHeight,
4015
- scrollWidth: c.scrollWidth
4016
- };
4017
- return {
4018
- client: e,
4019
- page: f(e, r),
4020
- scroll: Ho(c),
4021
- scrollSize: t,
4022
- shouldClipSubject: s
4023
- };
4024
- })();
4025
- return Go({
4026
- descriptor: t,
4027
- isEnabled: !a,
4028
- isCombineEnabled: o,
4029
- isFixedOnPage: n.isFixedOnPage,
4030
- direction: i,
4031
- client: u,
4032
- page: d,
4033
- closest: p
4034
- });
4035
- }, Jo = { passive: !1 }, Yo = { passive: !0 }, Xo = (e) => e.shouldPublishImmediately ? Jo : Yo, Zo = (e) => e && e.env.closestScrollable || null;
4036
- function Qo(e) {
4037
- let t = y(null), n = vo(Hi), r = zi("droppable"), { registry: i, marshal: a } = n, o = $i(e), s = j(() => ({
4038
- id: e.droppableId,
4039
- type: e.type,
4040
- mode: e.mode
4041
- }), [
4042
- e.droppableId,
4043
- e.mode,
4044
- e.type
4045
- ]), c = y(s), l = j(() => B((e, n) => {
4046
- !t.current && (process.env.NODE_ENV === "production" ? A() : A(!1, "Can only update scroll when dragging"));
4047
- let r = {
4048
- x: e,
4049
- y: n
4050
- };
4051
- a.updateDroppableScroll(s.id, r);
4052
- }), [s.id, a]), u = M(() => {
4053
- let e = t.current;
4054
- return !e || !e.env.closestScrollable ? N : Ho(e.env.closestScrollable);
4055
- }, []), d = M(() => {
4056
- let e = u();
4057
- l(e.x, e.y);
4058
- }, [u, l]), f = j(() => p(d), [d]), m = M(() => {
4059
- let e = t.current, n = Zo(e);
4060
- if (!(e && n) && (process.env.NODE_ENV === "production" ? A() : A(!1, "Could not find scroll options while scrolling")), e.scrollOptions.shouldPublishImmediately) {
4061
- d();
4062
- return;
4063
- }
4064
- f();
4065
- }, [f, d]), h = M((e, r) => {
4066
- t.current && (process.env.NODE_ENV === "production" ? A() : A(!1, "Cannot collect a droppable while a drag is occurring"));
4067
- let i = o.current, a = i.getDroppableRef();
4068
- !a && (process.env.NODE_ENV === "production" ? A() : A(!1, "Cannot collect without a droppable ref"));
4069
- let c = Wo(a), l = {
4070
- ref: a,
4071
- descriptor: s,
4072
- env: c,
4073
- scrollOptions: r
4074
- };
4075
- t.current = l;
4076
- let u = qo({
4077
- ref: a,
4078
- descriptor: s,
4079
- env: c,
4080
- windowScroll: e,
4081
- direction: i.direction,
4082
- isDropDisabled: i.isDropDisabled,
4083
- isCombineEnabled: i.isCombineEnabled,
4084
- shouldClipSubject: !i.ignoreContainerClipping
4085
- }), d = c.closestScrollable;
4086
- return d && (d.setAttribute(vi.contextId, n.contextId), d.addEventListener("scroll", m, Xo(l.scrollOptions)), process.env.NODE_ENV !== "production" && Vo(d)), u;
4087
- }, [
4088
- n.contextId,
4089
- s,
4090
- m,
4091
- o
4092
- ]), g = M(() => {
4093
- let e = t.current, n = Zo(e);
4094
- return !(e && n) && (process.env.NODE_ENV === "production" ? A() : A(!1, "Can only recollect Droppable client for Droppables that have a scroll container")), Ho(n);
4095
- }, []), _ = M(() => {
4096
- let e = t.current;
4097
- !e && (process.env.NODE_ENV === "production" ? A() : A(!1, "Cannot stop drag when no active drag"));
4098
- let n = Zo(e);
4099
- t.current = null, n && (f.cancel(), n.removeAttribute(vi.contextId), n.removeEventListener("scroll", m, Xo(e.scrollOptions)));
4100
- }, [m, f]), v = M((e) => {
4101
- let n = t.current;
4102
- !n && (process.env.NODE_ENV === "production" ? A() : A(!1, "Cannot scroll when there is no drag"));
4103
- let r = Zo(n);
4104
- !r && (process.env.NODE_ENV === "production" ? A() : A(!1, "Cannot scroll a droppable with no closest scrollable")), r.scrollTop += e.y, r.scrollLeft += e.x;
4105
- }, []), b = j(() => ({
4106
- getDimensionAndWatchScroll: h,
4107
- getScrollWhileDragging: g,
4108
- dragStopped: _,
4109
- scroll: v
4110
- }), [
4111
- _,
4112
- h,
4113
- g,
4114
- v
4115
- ]), x = j(() => ({
4116
- uniqueId: r,
4117
- descriptor: s,
4118
- callbacks: b
4119
- }), [
4120
- b,
4121
- s,
4122
- r
4123
- ]);
4124
- $(() => (c.current = x.descriptor, i.droppable.register(x), () => {
4125
- t.current && (process.env.NODE_ENV !== "production" && D("Unsupported: changing the droppableId or type of a Droppable during a drag"), _()), i.droppable.unregister(x);
4126
- }), [
4127
- b,
4128
- s,
4129
- _,
4130
- x,
4131
- a,
4132
- i.droppable
4133
- ]), $(() => {
4134
- t.current && a.updateDroppableIsEnabled(c.current.id, !e.isDropDisabled);
4135
- }, [e.isDropDisabled, a]), $(() => {
4136
- t.current && a.updateDroppableIsCombineEnabled(c.current.id, e.isCombineEnabled);
4137
- }, [e.isCombineEnabled, a]);
4138
- }
4139
- function $o() {}
4140
- var es = {
4141
- width: 0,
4142
- height: 0,
4143
- margin: Ee
4144
- }, ts = ({ isAnimatingOpenOnMount: e, placeholder: t, animate: n }) => e || n === "close" ? es : {
4145
- height: t.client.borderBox.height,
4146
- width: t.client.borderBox.width,
4147
- margin: t.client.margin
4148
- }, ns = ({ isAnimatingOpenOnMount: e, placeholder: t, animate: n }) => {
4149
- let r = ts({
4150
- isAnimatingOpenOnMount: e,
4151
- placeholder: t,
4152
- animate: n
4153
- });
4154
- return {
4155
- display: t.display,
4156
- boxSizing: "border-box",
4157
- width: r.width,
4158
- height: r.height,
4159
- marginTop: r.margin.top,
4160
- marginRight: r.margin.right,
4161
- marginBottom: r.margin.bottom,
4162
- marginLeft: r.margin.left,
4163
- flexShrink: "0",
4164
- flexGrow: "0",
4165
- pointerEvents: "none",
4166
- transition: n === "none" ? null : Xn.placeholder
4167
- };
4168
- }, rs = h.memo((e) => {
4169
- let t = y(null), n = M(() => {
4170
- t.current &&= (clearTimeout(t.current), null);
4171
- }, []), { animate: r, onTransitionEnd: i, onClose: a, contextId: o } = e, [s, c] = b(e.animate === "open");
4172
- _(() => s ? r === "open" ? t.current ? $o : (t.current = setTimeout(() => {
4173
- t.current = null, c(!1);
4174
- }), n) : (n(), c(!1), $o) : $o, [
4175
- r,
4176
- s,
4177
- n
4178
- ]);
4179
- let l = M((e) => {
4180
- e.propertyName === "height" && (i(), r === "close" && a());
4181
- }, [
4182
- r,
4183
- a,
4184
- i
4185
- ]), u = ns({
4186
- isAnimatingOpenOnMount: s,
4187
- animate: e.animate,
4188
- placeholder: e.placeholder
4189
- });
4190
- return h.createElement(e.placeholder.tagName, {
4191
- style: u,
4192
- "data-rfd-placeholder-context-id": o,
4193
- onTransitionEnd: l,
4194
- ref: e.innerRef
4195
- });
4196
- });
4197
- function is(e) {
4198
- return typeof e == "boolean";
4199
- }
4200
- function as(e, t) {
4201
- t.forEach((t) => t(e));
4202
- }
4203
- var os = [
4204
- function({ props: e }) {
4205
- !e.droppableId && (process.env.NODE_ENV === "production" ? A() : A(!1, "A Droppable requires a droppableId prop")), typeof e.droppableId != "string" && (process.env.NODE_ENV === "production" ? A() : A(!1, `A Droppable requires a [string] droppableId. Provided: [${typeof e.droppableId}]`));
4206
- },
4207
- function({ props: e }) {
4208
- !is(e.isDropDisabled) && (process.env.NODE_ENV === "production" ? A() : A(!1, "isDropDisabled must be a boolean")), !is(e.isCombineEnabled) && (process.env.NODE_ENV === "production" ? A() : A(!1, "isCombineEnabled must be a boolean")), !is(e.ignoreContainerClipping) && (process.env.NODE_ENV === "production" ? A() : A(!1, "ignoreContainerClipping must be a boolean"));
4209
- },
4210
- function({ getDroppableRef: e }) {
4211
- ho(e());
4212
- }
4213
- ], ss = [function({ props: e, getPlaceholderRef: t }) {
4214
- e.placeholder && (t() || process.env.NODE_ENV !== "production" && D(`
4215
- Droppable setup issue [droppableId: "${e.droppableId}"]:
4216
- DroppableProvided > placeholder could not be found.
4217
-
4218
- Please be sure to add the {provided.placeholder} React Node as a child of your Droppable.
4219
- More information: https://github.com/hello-pangea/dnd/blob/main/docs/api/droppable.md
4220
- `));
4221
- }], cs = [function({ props: e }) {
4222
- !e.renderClone && (process.env.NODE_ENV === "production" ? A() : A(!1, "Must provide a clone render function (renderClone) for virtual lists"));
4223
- }, function({ getPlaceholderRef: e }) {
4224
- e() && (process.env.NODE_ENV === "production" ? A() : A(!1, "Expected virtual list to not have a placeholder"));
4225
- }];
4226
- function ls(e) {
4227
- Zi(() => {
4228
- as(e, os), e.props.mode === "standard" && as(e, ss), e.props.mode === "virtual" && as(e, cs);
4229
- });
4230
- }
4231
- var us = class extends h.PureComponent {
4232
- constructor(...e) {
4233
- super(...e), this.state = {
4234
- isVisible: !!this.props.on,
4235
- data: this.props.on,
4236
- animate: this.props.shouldAnimate && this.props.on ? "open" : "none"
4237
- }, this.onClose = () => {
4238
- this.state.animate === "close" && this.setState({ isVisible: !1 });
4239
- };
4240
- }
4241
- static getDerivedStateFromProps(e, t) {
4242
- return e.shouldAnimate ? e.on ? {
4243
- isVisible: !0,
4244
- data: e.on,
4245
- animate: "open"
4246
- } : t.isVisible ? {
4247
- isVisible: !0,
4248
- data: t.data,
4249
- animate: "close"
4250
- } : {
4251
- isVisible: !1,
4252
- animate: "close",
4253
- data: null
4254
- } : {
4255
- isVisible: !!e.on,
4256
- data: e.on,
4257
- animate: "none"
4258
- };
4259
- }
4260
- render() {
4261
- if (!this.state.isVisible) return null;
4262
- let e = {
4263
- onClose: this.onClose,
4264
- data: this.state.data,
4265
- animate: this.state.animate
4266
- };
4267
- return this.props.children(e);
4268
- }
4269
- }, ds = (e) => {
4270
- let t = g(Hi);
4271
- !t && (process.env.NODE_ENV === "production" ? A() : A(!1, "Could not find app context"));
4272
- let { contextId: n, isMovementAllowed: r } = t, i = y(null), a = y(null), { children: o, droppableId: s, type: c, mode: l, direction: u, ignoreContainerClipping: d, isDropDisabled: f, isCombineEnabled: p, snapshot: m, useClone: _, updateViewportMaxScroll: v, getContainerForClone: b } = e, S = M(() => i.current, []), C = M((e = null) => {
4273
- i.current = e;
4274
- }, []), w = M(() => a.current, []), T = M((e = null) => {
4275
- a.current = e;
4276
- }, []);
4277
- ls({
4278
- props: e,
4279
- getDroppableRef: S,
4280
- getPlaceholderRef: w
4281
- });
4282
- let E = M(() => {
4283
- r() && v({ maxScroll: Ir() });
4284
- }, [r, v]);
4285
- Qo({
4286
- droppableId: s,
4287
- type: c,
4288
- mode: l,
4289
- direction: u,
4290
- isDropDisabled: f,
4291
- isCombineEnabled: p,
4292
- ignoreContainerClipping: d,
4293
- getDroppableRef: S
4294
- });
4295
- let ee = j(() => h.createElement(us, {
4296
- on: e.placeholder,
4297
- shouldAnimate: e.shouldAnimatePlaceholder
4298
- }, ({ onClose: e, data: t, animate: r }) => h.createElement(rs, {
4299
- placeholder: t,
4300
- onClose: e,
4301
- innerRef: T,
4302
- animate: r,
4303
- contextId: n,
4304
- onTransitionEnd: E
4305
- })), [
4306
- n,
4307
- E,
4308
- e.placeholder,
4309
- e.shouldAnimatePlaceholder,
4310
- T
4311
- ]), te = j(() => ({
4312
- innerRef: C,
4313
- placeholder: ee,
4314
- droppableProps: {
4315
- "data-rfd-droppable-id": s,
4316
- "data-rfd-droppable-context-id": n
4317
- }
4318
- }), [
4319
- n,
4320
- s,
4321
- ee,
4322
- C
4323
- ]), ne = _ ? _.dragging.draggableId : null, re = j(() => ({
4324
- droppableId: s,
4325
- type: c,
4326
- isUsingCloneFor: ne
4327
- }), [
4328
- s,
4329
- ne,
4330
- c
4331
- ]);
4332
- function D() {
4333
- if (!_) return null;
4334
- let { dragging: e, render: t } = _, n = h.createElement(Ao, {
4335
- draggableId: e.draggableId,
4336
- index: e.source.index,
4337
- isClone: !0,
4338
- isEnabled: !0,
4339
- shouldRespectForcePress: !1,
4340
- canDragInteractiveElements: !0
4341
- }, (n, r) => t(n, r, e));
4342
- return x.createPortal(n, b());
4343
- }
4344
- return h.createElement(mo.Provider, { value: re }, o(te, m), D());
4345
- };
4346
- function fs() {
4347
- return !document.body && (process.env.NODE_ENV === "production" ? A() : A(!1, "document.body is not ready")), document.body;
4348
- }
4349
- var ps = {
4350
- mode: "standard",
4351
- type: "DEFAULT",
4352
- direction: "vertical",
4353
- isDropDisabled: !1,
4354
- isCombineEnabled: !1,
4355
- ignoreContainerClipping: !1,
4356
- renderClone: null,
4357
- getContainerForClone: fs
4358
- }, ms = (e) => {
4359
- let t = { ...e }, n;
4360
- for (n in ps) e[n] === void 0 && (t = {
4361
- ...t,
4362
- [n]: ps[n]
4363
- });
4364
- return t;
4365
- }, hs = (e, t) => e === t.droppable.type, gs = (e, t) => t.draggables[e.draggable.id], _s = a(() => {
4366
- let e = {
4367
- placeholder: null,
4368
- shouldAnimatePlaceholder: !0,
4369
- snapshot: {
4370
- isDraggingOver: !1,
4371
- draggingOverWith: null,
4372
- draggingFromThisWith: null,
4373
- isUsingPlaceholder: !1
4374
- },
4375
- useClone: null
4376
- }, t = {
4377
- ...e,
4378
- shouldAnimatePlaceholder: !1
4379
- }, n = B((e) => ({
4380
- draggableId: e.id,
4381
- type: e.type,
4382
- source: {
4383
- index: e.index,
4384
- droppableId: e.droppableId
4385
- }
4386
- })), r = B((r, i, a, o, s, c) => {
4387
- let l = s.descriptor.id;
4388
- if (s.descriptor.droppableId === r) {
4389
- let e = c ? {
4390
- render: c,
4391
- dragging: n(s.descriptor)
4392
- } : null, t = {
4393
- isDraggingOver: a,
4394
- draggingOverWith: a ? l : null,
4395
- draggingFromThisWith: l,
4396
- isUsingPlaceholder: !0
4397
- };
4398
- return {
4399
- placeholder: s.placeholder,
4400
- shouldAnimatePlaceholder: !1,
4401
- snapshot: t,
4402
- useClone: e
4403
- };
4404
- }
4405
- if (!i) return t;
4406
- if (!o) return e;
4407
- let u = {
4408
- isDraggingOver: a,
4409
- draggingOverWith: l,
4410
- draggingFromThisWith: null,
4411
- isUsingPlaceholder: !0
4412
- };
4413
- return {
4414
- placeholder: s.placeholder,
4415
- shouldAnimatePlaceholder: !0,
4416
- snapshot: u,
4417
- useClone: null
4418
- };
4419
- });
4420
- return (n, i) => {
4421
- let a = ms(i), o = a.droppableId, s = a.type, c = !a.isDropDisabled, l = a.renderClone;
4422
- if (ta(n)) {
4423
- let e = n.critical;
4424
- if (!hs(s, e)) return t;
4425
- let i = gs(e, n.dimensions), a = q(n.impact) === o;
4426
- return r(o, c, a, a, i, l);
4427
- }
4428
- if (n.phase === "DROP_ANIMATING") {
4429
- let e = n.completed;
4430
- if (!hs(s, e.critical)) return t;
4431
- let i = gs(e.critical, n.dimensions);
4432
- return r(o, c, So(e.result) === o, q(e.impact) === o, i, l);
4433
- }
4434
- if (n.phase === "IDLE" && n.completed && !n.shouldFlush) {
4435
- let r = n.completed;
4436
- if (!hs(s, r.critical)) return t;
4437
- let i = q(r.impact) === o, a = !!(r.impact.at && r.impact.at.type === "COMBINE"), c = r.critical.droppable.id === o;
4438
- return i ? a ? e : t : c ? e : t;
4439
- }
4440
- return t;
4441
- };
4442
- }, { updateViewportMaxScroll: Mn }, (e, t, n) => ({
4443
- ...ms(n),
4444
- ...e,
4445
- ...t
4446
- }), {
4447
- context: Ni,
4448
- areStatePropsEqual: xo
4449
- })(ds);
4450
- //#endregion
4451
- export { _s as ConnectedDroppable, ro as DragDropContext, jo as PublicDraggable };