@pie-lib/rubric 2.0.4-next.32 → 2.0.4-next.33

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4460 +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 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 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;
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 && 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
- if (!r) return;
1817
- let e = {
1818
- ...yr(r.lastCritical, r.mode),
1819
- combine: null,
1820
- destination: null,
1821
- reason: "CANCEL"
1822
- };
1823
- l(e);
1824
- }
1825
- };
1826
- }, Sr = (e, t) => {
1827
- let n = xr(e, t);
1828
- return (e) => (t) => (r) => {
1829
- if (Y(r, "BEFORE_INITIAL_CAPTURE")) {
1830
- n.beforeCapture(r.payload.draggableId, r.payload.movementMode);
1831
- return;
1832
- }
1833
- if (Y(r, "INITIAL_PUBLISH")) {
1834
- let e = r.payload.critical;
1835
- n.beforeStart(e, r.payload.movementMode), t(r), n.start(e, r.payload.movementMode);
1836
- return;
1837
- }
1838
- if (Y(r, "DROP_COMPLETE")) {
1839
- let e = r.payload.completed.result;
1840
- n.flush(), t(r), n.drop(e);
1841
- return;
1842
- }
1843
- if (t(r), Y(r, "FLUSH")) {
1844
- n.abort();
1845
- return;
1846
- }
1847
- let i = e.getState();
1848
- i.phase === "DRAGGING" && n.update(i.critical, i.impact);
1849
- };
1850
- }, Cr = (e) => (t) => (n) => {
1851
- if (!Y(n, "DROP_ANIMATION_FINISHED")) {
1852
- t(n);
1853
- return;
1854
- }
1855
- let r = e.getState();
1856
- 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 }));
1857
- }, wr = (e) => {
1858
- let t = null, n = null;
1859
- function r() {
1860
- n &&= (cancelAnimationFrame(n), null), t &&= (t(), null);
1861
- }
1862
- return (i) => (a) => {
1863
- if ((Y(a, "FLUSH") || Y(a, "DROP_COMPLETE") || Y(a, "DROP_ANIMATION_FINISHED")) && r(), i(a), !Y(a, "DROP_ANIMATE")) return;
1864
- let o = {
1865
- eventName: "scroll",
1866
- options: {
1867
- capture: !0,
1868
- passive: !1,
1869
- once: !0
1870
- },
1871
- fn: function() {
1872
- e.getState().phase === "DROP_ANIMATING" && e.dispatch(Hn());
1873
- }
1874
- };
1875
- n = requestAnimationFrame(() => {
1876
- n = null, t = k(window, [o]);
1877
- });
1878
- };
1879
- }, Tr = (e) => () => (t) => (n) => {
1880
- (Y(n, "DROP_COMPLETE") || Y(n, "FLUSH") || Y(n, "DROP_ANIMATE")) && e.stopPublishing(), t(n);
1881
- }, Er = (e) => {
1882
- let t = !1;
1883
- return () => (n) => (r) => {
1884
- if (Y(r, "INITIAL_PUBLISH")) {
1885
- t = !0, e.tryRecordFocus(r.payload.critical.draggable.id), n(r), e.tryRestoreFocusRecorded();
1886
- return;
1887
- }
1888
- if (n(r), t) {
1889
- if (Y(r, "FLUSH")) {
1890
- t = !1, e.tryRestoreFocusRecorded();
1891
- return;
1892
- }
1893
- if (Y(r, "DROP_COMPLETE")) {
1894
- t = !1;
1895
- let n = r.payload.completed.result;
1896
- n.combine && e.tryShiftRecord(n.draggableId, n.combine.draggableId), e.tryRestoreFocusRecorded();
1897
- }
1898
- }
1899
- };
1900
- }, Dr = (e) => Y(e, "DROP_COMPLETE") || Y(e, "DROP_ANIMATE") || Y(e, "FLUSH"), Or = (e) => (t) => (n) => (r) => {
1901
- if (Dr(r)) {
1902
- e.stop(), n(r);
1903
- return;
1904
- }
1905
- if (Y(r, "INITIAL_PUBLISH")) {
1906
- n(r);
1907
- let i = t.getState();
1908
- i.phase !== "DRAGGING" && (process.env.NODE_ENV === "production" ? A() : A(!1, "Expected phase to be DRAGGING after INITIAL_PUBLISH")), e.start(i);
1909
- return;
1910
- }
1911
- n(r), e.scroll(t.getState());
1912
- }, kr = (e) => (t) => (n) => {
1913
- if (t(n), !Y(n, "PUBLISH_WHILE_DRAGGING")) return;
1914
- let r = e.getState();
1915
- r.phase === "DROP_PENDING" && (r.isWaiting || e.dispatch(Bn({ reason: r.reason })));
1916
- }, 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 = () => ({
1917
- additions: {},
1918
- removals: {},
1919
- modified: {}
1920
- });
1921
- function Nr({ registry: e, callbacks: t }) {
1922
- let n = Mr(), r = null, i = () => {
1923
- r ||= (t.collectionStarting(), requestAnimationFrame(() => {
1924
- r = null, dn();
1925
- 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) => ({
1926
- droppableId: t,
1927
- scroll: e.droppable.getById(t).callbacks.getScrollWhileDragging()
1928
- })), l = {
1929
- additions: s,
1930
- removals: Object.keys(a),
1931
- modified: c
1932
- };
1933
- n = Mr(), fn(), t.publish(l);
1934
- }));
1935
- };
1936
- return {
1937
- add: (e) => {
1938
- let t = e.descriptor.id;
1939
- n.additions[t] = e, n.modified[e.descriptor.droppableId] = !0, n.removals[t] && delete n.removals[t], i();
1940
- },
1941
- remove: (e) => {
1942
- let t = e.descriptor;
1943
- n.removals[t.id] = !0, n.modified[t.droppableId] = !0, n.additions[t.id] && delete n.additions[t.id], i();
1944
- },
1945
- stop: () => {
1946
- r && (cancelAnimationFrame(r), r = null, n = Mr());
1947
- }
1948
- };
1949
- }
1950
- var Pr = ({ scrollHeight: e, scrollWidth: t, height: n, width: r }) => {
1951
- let i = F({
1952
- x: t,
1953
- y: e
1954
- }, {
1955
- x: r,
1956
- y: n
1957
- });
1958
- return {
1959
- x: Math.max(0, i.x),
1960
- y: Math.max(0, i.y)
1961
- };
1962
- }, Fr = () => {
1963
- let e = document.documentElement;
1964
- return !e && (process.env.NODE_ENV === "production" ? A() : A(!1, "Cannot find document.documentElement")), e;
1965
- }, Ir = () => {
1966
- let e = Fr();
1967
- return Pr({
1968
- scrollHeight: e.scrollHeight,
1969
- scrollWidth: e.scrollWidth,
1970
- width: e.clientWidth,
1971
- height: e.clientHeight
1972
- });
1973
- }, Lr = () => {
1974
- let e = cr(), t = Ir(), n = e.y, r = e.x, i = Fr(), a = i.clientWidth, o = i.clientHeight;
1975
- return {
1976
- frame: u({
1977
- top: n,
1978
- left: r,
1979
- right: r + a,
1980
- bottom: n + o
1981
- }),
1982
- scroll: {
1983
- initial: e,
1984
- current: e,
1985
- max: t,
1986
- diff: {
1987
- value: N,
1988
- displacement: N
1989
- }
1990
- }
1991
- };
1992
- }, Rr = ({ critical: e, scrollOptions: t, registry: n }) => {
1993
- dn();
1994
- let r = Lr(), i = r.scroll.current, a = e.droppable, o = n.droppable.getAllByType(a.type).map((e) => e.callbacks.getDimensionAndWatchScroll(i, t)), s = {
1995
- draggables: Me(n.draggable.getAllByType(e.draggable.type).map((e) => e.getDimension(i))),
1996
- droppables: je(o)
1997
- };
1998
- return fn(), {
1999
- dimensions: s,
2000
- critical: e,
2001
- viewport: r
2002
- };
2003
- };
2004
- function zr(e, t, n) {
2005
- 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(`
2006
- You are attempting to add or remove a Draggable [id: ${n.descriptor.id}]
2007
- while a drag is occurring. This is only supported for virtual lists.
2008
-
2009
- See https://github.com/hello-pangea/dnd/blob/main/docs/patterns/virtual-lists.md
2010
- `), !1);
2011
- }
2012
- var Br = (e, t) => {
2013
- let n = null, r = Nr({
2014
- callbacks: {
2015
- publish: t.publishWhileDragging,
2016
- collectionStarting: t.collectionStarting
2017
- },
2018
- registry: e
2019
- }), i = (r, i) => {
2020
- !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({
2021
- id: r,
2022
- isEnabled: i
2023
- });
2024
- }, a = (r, i) => {
2025
- 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({
2026
- id: r,
2027
- isCombineEnabled: i
2028
- }));
2029
- }, o = (r, i) => {
2030
- 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({
2031
- id: r,
2032
- newScroll: i
2033
- }));
2034
- }, s = (t, r) => {
2035
- n && e.droppable.getById(t).callbacks.scroll(r);
2036
- }, c = () => {
2037
- if (!n) return;
2038
- r.stop();
2039
- let t = n.critical.droppable;
2040
- e.droppable.getAllByType(t.type).forEach((e) => e.callbacks.dragStopped()), n.unsubscribe(), n = null;
2041
- }, l = (t) => {
2042
- !n && (process.env.NODE_ENV === "production" ? A() : A(!1, "Should only be subscribed when a collection is occurring"));
2043
- let i = n.critical.draggable;
2044
- t.type === "ADDITION" && zr(e, i, t.value) && r.add(t.value), t.type === "REMOVAL" && zr(e, i, t.value) && r.remove(t.value);
2045
- };
2046
- return {
2047
- updateDroppableIsEnabled: i,
2048
- updateDroppableIsCombineEnabled: a,
2049
- scrollDroppable: s,
2050
- updateDroppableScroll: o,
2051
- startPublishing: (t) => {
2052
- n && (process.env.NODE_ENV === "production" ? A() : A(!1, "Cannot start capturing critical dimensions as there is already a collection"));
2053
- let r = e.draggable.getById(t.draggableId), i = e.droppable.getById(r.descriptor.droppableId), a = {
2054
- draggable: r.descriptor,
2055
- droppable: i.descriptor
2056
- };
2057
- return n = {
2058
- critical: a,
2059
- unsubscribe: e.subscribe(l)
2060
- }, Rr({
2061
- critical: a,
2062
- registry: e,
2063
- scrollOptions: t.scrollOptions
2064
- });
2065
- },
2066
- stopPublishing: c
2067
- };
2068
- }, Vr = (e, t) => e.phase === "IDLE" ? !0 : e.phase !== "DROP_ANIMATING" || e.completed.result.draggableId === t ? !1 : e.completed.result.reason === "DROP", Hr = (e) => {
2069
- window.scrollBy(e.x, e.y);
2070
- }, 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 }) => {
2071
- if (t) {
2072
- let e = n[t];
2073
- return e.frame ? e : null;
2074
- }
2075
- return Wr(e, n);
2076
- }, Kr = {
2077
- startFromPercentage: .25,
2078
- maxScrollAtPercentage: .05,
2079
- maxPixelScroll: 28,
2080
- ease: (e) => e ** 2,
2081
- durationDampening: {
2082
- stopDampeningAt: 1200,
2083
- accelerateAt: 360
2084
- },
2085
- disabled: !1
2086
- }, qr = (e, t, n = () => Kr) => {
2087
- let r = n();
2088
- return {
2089
- startScrollingFrom: e[t.size] * r.startFromPercentage,
2090
- maxScrollValueAt: e[t.size] * r.maxScrollAtPercentage
2091
- };
2092
- }, Jr = ({ startOfRange: e, endOfRange: t, current: n }) => {
2093
- let r = t - e;
2094
- 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;
2095
- }, Yr = 1, Xr = (e, t, n = () => Kr) => {
2096
- let r = n();
2097
- if (e > t.startScrollingFrom) return 0;
2098
- if (e <= t.maxScrollValueAt) return r.maxPixelScroll;
2099
- if (e === t.startScrollingFrom) return Yr;
2100
- let i = 1 - Jr({
2101
- startOfRange: t.maxScrollValueAt,
2102
- endOfRange: t.startScrollingFrom,
2103
- current: e
2104
- }), a = r.maxPixelScroll * r.ease(i);
2105
- return Math.ceil(a);
2106
- }, Zr = (e, t, n) => {
2107
- let r = n(), i = r.durationDampening.accelerateAt, a = r.durationDampening.stopDampeningAt, o = t, s = a, c = Date.now() - o;
2108
- if (c >= a) return e;
2109
- if (c < i) return Yr;
2110
- let l = Jr({
2111
- startOfRange: i,
2112
- endOfRange: s,
2113
- current: c
2114
- }), u = e * r.ease(l);
2115
- return Math.ceil(u);
2116
- }, Qr = ({ distanceToEdge: e, thresholds: t, dragStartTime: n, shouldUseTimeDampening: r, getAutoScrollerOptions: i }) => {
2117
- let a = Xr(e, t, i);
2118
- return a === 0 ? 0 : r ? Math.max(Zr(a, n, i), Yr) : a;
2119
- }, $r = ({ container: e, distanceToEdges: t, dragStartTime: n, axis: r, shouldUseTimeDampening: i, getAutoScrollerOptions: a }) => {
2120
- let o = qr(e, r, a);
2121
- return t[r.end] < t[r.start] ? Qr({
2122
- distanceToEdge: t[r.end],
2123
- thresholds: o,
2124
- dragStartTime: n,
2125
- shouldUseTimeDampening: i,
2126
- getAutoScrollerOptions: a
2127
- }) : -1 * Qr({
2128
- distanceToEdge: t[r.start],
2129
- thresholds: o,
2130
- dragStartTime: n,
2131
- shouldUseTimeDampening: i,
2132
- getAutoScrollerOptions: a
2133
- });
2134
- }, ei = ({ container: e, subject: t, proposedScroll: n }) => {
2135
- let r = t.height > e.height, i = t.width > e.width;
2136
- return !i && !r ? n : i && r ? null : {
2137
- x: i ? 0 : n.x,
2138
- y: r ? 0 : n.y
2139
- };
2140
- }, ti = Se((e) => e === 0 ? 0 : e), ni = ({ dragStartTime: e, container: t, subject: n, center: r, shouldUseTimeDampening: i, getAutoScrollerOptions: a }) => {
2141
- let o = {
2142
- top: r.y - t.top,
2143
- right: t.right - r.x,
2144
- bottom: t.bottom - r.y,
2145
- left: r.x - t.left
2146
- }, s = $r({
2147
- container: t,
2148
- distanceToEdges: o,
2149
- dragStartTime: e,
2150
- axis: Ue,
2151
- shouldUseTimeDampening: i,
2152
- getAutoScrollerOptions: a
2153
- }), c = ti({
2154
- x: $r({
2155
- container: t,
2156
- distanceToEdges: o,
2157
- dragStartTime: e,
2158
- axis: We,
2159
- shouldUseTimeDampening: i,
2160
- getAutoScrollerOptions: a
2161
- }),
2162
- y: s
2163
- });
2164
- if (I(c, N)) return null;
2165
- let l = ei({
2166
- container: t,
2167
- subject: n,
2168
- proposedScroll: c
2169
- });
2170
- return l ? I(l, N) ? null : l : null;
2171
- }, ri = Se((e) => e === 0 ? 0 : e > 0 ? 1 : -1), ii = (() => {
2172
- let e = (e, t) => e < 0 ? e : e > t ? e - t : 0;
2173
- return ({ current: t, max: n, change: r }) => {
2174
- let i = P(t, r), a = {
2175
- x: e(i.x, n.x),
2176
- y: e(i.y, n.y)
2177
- };
2178
- return I(a, N) ? null : a;
2179
- };
2180
- })(), ai = ({ max: e, current: t, change: n }) => {
2181
- let r = {
2182
- x: Math.max(t.x, e.x),
2183
- y: Math.max(t.y, e.y)
2184
- }, i = ri(n), a = ii({
2185
- max: r,
2186
- current: t,
2187
- change: i
2188
- });
2189
- return !a || i.x !== 0 && a.x === 0 || i.y !== 0 && a.y === 0;
2190
- }, oi = (e, t) => ai({
2191
- current: e.scroll.current,
2192
- max: e.scroll.max,
2193
- change: t
2194
- }), si = (e, t) => {
2195
- if (!oi(e, t)) return null;
2196
- let n = e.scroll.max, r = e.scroll.current;
2197
- return ii({
2198
- current: r,
2199
- max: n,
2200
- change: t
2201
- });
2202
- }, ci = (e, t) => {
2203
- let n = e.frame;
2204
- return n ? ai({
2205
- current: n.scroll.current,
2206
- max: n.scroll.max,
2207
- change: t
2208
- }) : !1;
2209
- }, li = (e, t) => {
2210
- let n = e.frame;
2211
- return !n || !ci(e, t) ? null : ii({
2212
- current: n.scroll.current,
2213
- max: n.scroll.max,
2214
- change: t
2215
- });
2216
- }, ui = ({ viewport: e, subject: t, center: n, dragStartTime: r, shouldUseTimeDampening: i, getAutoScrollerOptions: a }) => {
2217
- let o = ni({
2218
- dragStartTime: r,
2219
- container: e.frame,
2220
- subject: t,
2221
- center: n,
2222
- shouldUseTimeDampening: i,
2223
- getAutoScrollerOptions: a
2224
- });
2225
- return o && oi(e, o) ? o : null;
2226
- }, di = ({ droppable: e, subject: t, center: n, dragStartTime: r, shouldUseTimeDampening: i, getAutoScrollerOptions: a }) => {
2227
- let o = e.frame;
2228
- if (!o) return null;
2229
- let s = ni({
2230
- dragStartTime: r,
2231
- container: o.pageMarginBox,
2232
- subject: t,
2233
- center: n,
2234
- shouldUseTimeDampening: i,
2235
- getAutoScrollerOptions: a
2236
- });
2237
- return s && ci(e, s) ? s : null;
2238
- }, fi = ({ state: e, dragStartTime: t, shouldUseTimeDampening: n, scrollWindow: r, scrollDroppable: i, getAutoScrollerOptions: a }) => {
2239
- let o = e.current.page.borderBoxCenter, s = e.dimensions.draggables[e.critical.draggable.id].page.marginBox;
2240
- if (e.isWindowScrollAllowed) {
2241
- let i = e.viewport, c = ui({
2242
- dragStartTime: t,
2243
- viewport: i,
2244
- subject: s,
2245
- center: o,
2246
- shouldUseTimeDampening: n,
2247
- getAutoScrollerOptions: a
2248
- });
2249
- if (c) {
2250
- r(c);
2251
- return;
2252
- }
2253
- }
2254
- let c = Gr({
2255
- center: o,
2256
- destination: q(e.impact),
2257
- droppables: e.dimensions.droppables
2258
- });
2259
- if (!c) return;
2260
- let l = di({
2261
- dragStartTime: t,
2262
- droppable: c,
2263
- subject: s,
2264
- center: o,
2265
- shouldUseTimeDampening: n,
2266
- getAutoScrollerOptions: a
2267
- });
2268
- l && i(c.descriptor.id, l);
2269
- }, pi = ({ scrollWindow: e, scrollDroppable: t, getAutoScrollerOptions: n = () => Kr }) => {
2270
- let r = p(e), i = p(t), a = null, o = (e) => {
2271
- !a && (process.env.NODE_ENV === "production" ? A() : A(!1, "Cannot fluid scroll if not dragging"));
2272
- let { shouldUseTimeDampening: t, dragStartTime: o } = a;
2273
- fi({
2274
- state: e,
2275
- scrollWindow: r,
2276
- scrollDroppable: i,
2277
- dragStartTime: o,
2278
- shouldUseTimeDampening: t,
2279
- getAutoScrollerOptions: n
2280
- });
2281
- };
2282
- return {
2283
- start: (e) => {
2284
- dn(), a && (process.env.NODE_ENV === "production" ? A() : A(!1, "Cannot start auto scrolling when already started"));
2285
- let t = Date.now(), r = !1, i = () => {
2286
- r = !0;
2287
- };
2288
- fi({
2289
- state: e,
2290
- dragStartTime: 0,
2291
- shouldUseTimeDampening: !1,
2292
- scrollWindow: i,
2293
- scrollDroppable: i,
2294
- getAutoScrollerOptions: n
2295
- }), a = {
2296
- dragStartTime: t,
2297
- shouldUseTimeDampening: r
2298
- }, fn(), r && o(e);
2299
- },
2300
- stop: () => {
2301
- a &&= (r.cancel(), i.cancel(), null);
2302
- },
2303
- scroll: o
2304
- };
2305
- }, mi = ({ move: e, scrollDroppable: t, scrollWindow: n }) => {
2306
- let r = (t, n) => {
2307
- e({ client: P(t.current.client.selection, n) });
2308
- }, i = (e, n) => {
2309
- if (!ci(e, n)) return n;
2310
- let r = li(e, n);
2311
- if (!r) return t(e.descriptor.id, n), null;
2312
- let i = F(n, r);
2313
- return t(e.descriptor.id, i), F(n, i);
2314
- }, a = (e, t, r) => {
2315
- if (!e || !oi(t, r)) return r;
2316
- let i = si(t, r);
2317
- if (!i) return n(r), null;
2318
- let a = F(r, i);
2319
- return n(a), F(r, a);
2320
- };
2321
- return (e) => {
2322
- let t = e.scrollJumpRequest;
2323
- if (!t) return;
2324
- let n = q(e.impact);
2325
- !n && (process.env.NODE_ENV === "production" ? A() : A(!1, "Cannot perform a jump scroll when there is no destination"));
2326
- let o = i(e.dimensions.droppables[n], t);
2327
- if (!o) return;
2328
- let s = e.viewport, c = a(e.isWindowScrollAllowed, s, o);
2329
- c && r(e, c);
2330
- };
2331
- }, hi = ({ scrollDroppable: e, scrollWindow: t, move: n, getAutoScrollerOptions: r }) => {
2332
- let i = pi({
2333
- scrollWindow: t,
2334
- scrollDroppable: e,
2335
- getAutoScrollerOptions: r
2336
- }), a = mi({
2337
- move: n,
2338
- scrollWindow: t,
2339
- scrollDroppable: e
2340
- });
2341
- return {
2342
- scroll: (e) => {
2343
- if (!(r().disabled || e.phase !== "DRAGGING")) {
2344
- if (e.movementMode === "FLUID") {
2345
- i.scroll(e);
2346
- return;
2347
- }
2348
- e.scrollJumpRequest && a(e);
2349
- }
2350
- },
2351
- start: i.start,
2352
- stop: i.stop
2353
- };
2354
- }, Z = "data-rfd", Q = (() => {
2355
- let e = `${Z}-drag-handle`;
2356
- return {
2357
- base: e,
2358
- draggableId: `${e}-draggable-id`,
2359
- contextId: `${e}-context-id`
2360
- };
2361
- })(), gi = (() => {
2362
- let e = `${Z}-draggable`;
2363
- return {
2364
- base: e,
2365
- contextId: `${e}-context-id`,
2366
- id: `${e}-id`
2367
- };
2368
- })(), _i = (() => {
2369
- let e = `${Z}-droppable`;
2370
- return {
2371
- base: e,
2372
- contextId: `${e}-context-id`,
2373
- id: `${e}-id`
2374
- };
2375
- })(), vi = { contextId: `${Z}-scroll-container-context-id` }, yi = (e) => (t) => `[${t}="${e}"]`, bi = (e, t) => e.map((e) => {
2376
- let n = e.styles[t];
2377
- return n ? `${e.selector} { ${n} }` : "";
2378
- }).join(" "), xi = "pointer-events: none;", Si = (e) => {
2379
- let t = yi(e), n = (() => {
2380
- let e = "\n cursor: -webkit-grab;\n cursor: grab;\n ";
2381
- return {
2382
- selector: t(Q.contextId),
2383
- styles: {
2384
- always: "\n -webkit-touch-callout: none;\n -webkit-tap-highlight-color: rgba(0,0,0,0);\n touch-action: manipulation;\n ",
2385
- resting: e,
2386
- dragging: xi,
2387
- dropAnimating: e
2388
- }
2389
- };
2390
- })(), r = [
2391
- (() => {
2392
- let e = `
2393
- transition: ${Xn.outOfTheWay};
2394
- `;
2395
- return {
2396
- selector: t(gi.contextId),
2397
- styles: {
2398
- dragging: e,
2399
- dropAnimating: e,
2400
- userCancel: e
2401
- }
2402
- };
2403
- })(),
2404
- n,
2405
- {
2406
- selector: t(_i.contextId),
2407
- styles: { always: "overflow-anchor: none;" }
2408
- },
2409
- {
2410
- selector: "body",
2411
- 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 " }
2412
- }
2413
- ];
2414
- return {
2415
- always: bi(r, "always"),
2416
- resting: bi(r, "resting"),
2417
- dragging: bi(r, "dragging"),
2418
- dropAnimating: bi(r, "dropAnimating"),
2419
- userCancel: bi(r, "userCancel")
2420
- };
2421
- }, $ = typeof window < "u" && window.document !== void 0 && window.document.createElement !== void 0 ? v : _, Ci = () => {
2422
- let e = document.querySelector("head");
2423
- return !e && (process.env.NODE_ENV === "production" ? A() : A(!1, "Cannot find the head to append a style to")), e;
2424
- }, wi = (e) => {
2425
- let t = document.createElement("style");
2426
- return e && t.setAttribute("nonce", e), t.type = "text/css", t;
2427
- };
2428
- function Ti(e, t) {
2429
- let n = j(() => Si(e), [e]), r = y(null), i = y(null), a = M(B((e) => {
2430
- let t = i.current;
2431
- !t && (process.env.NODE_ENV === "production" ? A() : A(!1, "Cannot set dynamic style element if it is not set")), t.textContent = e;
2432
- }), []), o = M((e) => {
2433
- let t = r.current;
2434
- !t && (process.env.NODE_ENV === "production" ? A() : A(!1, "Cannot set dynamic style element if it is not set")), t.textContent = e;
2435
- }, []);
2436
- $(() => {
2437
- !(!r.current && !i.current) && (process.env.NODE_ENV === "production" ? A() : A(!1, "style elements already mounted"));
2438
- let s = wi(t), c = wi(t);
2439
- 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), () => {
2440
- let e = (e) => {
2441
- let t = e.current;
2442
- !t && (process.env.NODE_ENV === "production" ? A() : A(!1, "Cannot unmount ref as it is not set")), Ci().removeChild(t), e.current = null;
2443
- };
2444
- e(r), e(i);
2445
- };
2446
- }, [
2447
- t,
2448
- o,
2449
- a,
2450
- n.always,
2451
- n.resting,
2452
- e
2453
- ]);
2454
- let s = M(() => a(n.dragging), [a, n.dragging]), c = M((e) => {
2455
- if (e === "DROP") {
2456
- a(n.dropAnimating);
2457
- return;
2458
- }
2459
- a(n.userCancel);
2460
- }, [
2461
- a,
2462
- n.dropAnimating,
2463
- n.userCancel
2464
- ]), l = M(() => {
2465
- i.current && a(n.resting);
2466
- }, [a, n.resting]);
2467
- return j(() => ({
2468
- dragging: s,
2469
- dropping: c,
2470
- resting: l
2471
- }), [
2472
- s,
2473
- c,
2474
- l
2475
- ]);
2476
- }
2477
- function Ei(e, t) {
2478
- return Array.from(e.querySelectorAll(t));
2479
- }
2480
- var Di = (e) => e && e.ownerDocument && e.ownerDocument.defaultView ? e.ownerDocument.defaultView : window;
2481
- function Oi(e) {
2482
- return e instanceof Di(e).HTMLElement;
2483
- }
2484
- function ki(e, t) {
2485
- let n = `[${Q.contextId}="${e}"]`, r = Ei(document, n);
2486
- if (!r.length) return process.env.NODE_ENV !== "production" && D(`Unable to find any drag handles in the context "${e}"`), null;
2487
- let i = r.find((e) => e.getAttribute(Q.draggableId) === t);
2488
- 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);
2489
- }
2490
- function Ai(e) {
2491
- let t = y({}), n = y(null), r = y(null), i = y(!1), a = M(function(e, n) {
2492
- let r = {
2493
- id: e,
2494
- focus: n
2495
- };
2496
- return t.current[e] = r, function() {
2497
- let n = t.current;
2498
- n[e] !== r && delete n[e];
2499
- };
2500
- }, []), o = M(function(t) {
2501
- let n = ki(e, t);
2502
- n && n !== document.activeElement && n.focus();
2503
- }, [e]), s = M(function(e, t) {
2504
- n.current === e && (n.current = t);
2505
- }, []), c = M(function() {
2506
- r.current || i.current && (r.current = requestAnimationFrame(() => {
2507
- r.current = null;
2508
- let e = n.current;
2509
- e && o(e);
2510
- }));
2511
- }, [o]), l = M(function(e) {
2512
- n.current = null;
2513
- let t = document.activeElement;
2514
- t && t.getAttribute(Q.draggableId) === e && (n.current = e);
2515
- }, []);
2516
- return $(() => (i.current = !0, function() {
2517
- i.current = !1;
2518
- let e = r.current;
2519
- e && cancelAnimationFrame(e);
2520
- }), []), j(() => ({
2521
- register: a,
2522
- tryRecordFocus: l,
2523
- tryRestoreFocusRecorded: c,
2524
- tryShiftRecord: s
2525
- }), [
2526
- a,
2527
- l,
2528
- c,
2529
- s
2530
- ]);
2531
- }
2532
- function ji() {
2533
- let e = {
2534
- draggables: {},
2535
- droppables: {}
2536
- }, t = [];
2537
- function n(e) {
2538
- return t.push(e), function() {
2539
- let n = t.indexOf(e);
2540
- n !== -1 && t.splice(n, 1);
2541
- };
2542
- }
2543
- function r(e) {
2544
- t.length && t.forEach((t) => t(e));
2545
- }
2546
- function i(t) {
2547
- return e.draggables[t] || null;
2548
- }
2549
- function a(e) {
2550
- let t = i(e);
2551
- return !t && (process.env.NODE_ENV === "production" ? A() : A(!1, `Cannot find draggable entry with id [${e}]`)), t;
2552
- }
2553
- let o = {
2554
- register: (t) => {
2555
- e.draggables[t.descriptor.id] = t, r({
2556
- type: "ADDITION",
2557
- value: t
2558
- });
2559
- },
2560
- update: (t, n) => {
2561
- let r = e.draggables[n.descriptor.id];
2562
- r && r.uniqueId === t.uniqueId && (delete e.draggables[n.descriptor.id], e.draggables[t.descriptor.id] = t);
2563
- },
2564
- unregister: (t) => {
2565
- let n = t.descriptor.id, a = i(n);
2566
- a && t.uniqueId === a.uniqueId && (delete e.draggables[n], e.droppables[t.descriptor.droppableId] && r({
2567
- type: "REMOVAL",
2568
- value: t
2569
- }));
2570
- },
2571
- getById: a,
2572
- findById: i,
2573
- exists: (e) => !!i(e),
2574
- getAllByType: (t) => Object.values(e.draggables).filter((e) => e.descriptor.type === t)
2575
- };
2576
- function s(t) {
2577
- return e.droppables[t] || null;
2578
- }
2579
- function c(e) {
2580
- let t = s(e);
2581
- return !t && (process.env.NODE_ENV === "production" ? A() : A(!1, `Cannot find droppable entry with id [${e}]`)), t;
2582
- }
2583
- let l = {
2584
- register: (t) => {
2585
- e.droppables[t.descriptor.id] = t;
2586
- },
2587
- unregister: (t) => {
2588
- let n = s(t.descriptor.id);
2589
- n && t.uniqueId === n.uniqueId && delete e.droppables[t.descriptor.id];
2590
- },
2591
- getById: c,
2592
- findById: s,
2593
- exists: (e) => !!s(e),
2594
- getAllByType: (t) => Object.values(e.droppables).filter((e) => e.descriptor.type === t)
2595
- };
2596
- function u() {
2597
- e.draggables = {}, e.droppables = {}, t.length = 0;
2598
- }
2599
- return {
2600
- draggable: o,
2601
- droppable: l,
2602
- subscribe: n,
2603
- clean: u
2604
- };
2605
- }
2606
- function Mi() {
2607
- let e = j(ji, []);
2608
- return _(() => function() {
2609
- e.clean();
2610
- }, [e]), e;
2611
- }
2612
- var Ni = h.createContext(null), Pi = () => {
2613
- let e = document.body;
2614
- return !e && (process.env.NODE_ENV === "production" ? A() : A(!1, "Cannot find document.body")), e;
2615
- }, Fi = {
2616
- position: "absolute",
2617
- width: "1px",
2618
- height: "1px",
2619
- margin: "-1px",
2620
- border: "0",
2621
- padding: "0",
2622
- overflow: "hidden",
2623
- clip: "rect(0 0 0 0)",
2624
- "clip-path": "inset(100%)"
2625
- }, Ii = (e) => `rfd-announcement-${e}`;
2626
- function Li(e) {
2627
- let t = j(() => Ii(e), [e]), n = y(null);
2628
- return _(function() {
2629
- let e = document.createElement("div");
2630
- 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() {
2631
- setTimeout(function() {
2632
- let t = Pi();
2633
- t.contains(e) && t.removeChild(e), e === n.current && (n.current = null);
2634
- });
2635
- };
2636
- }, [t]), M((e) => {
2637
- let t = n.current;
2638
- if (t) {
2639
- t.textContent = e;
2640
- return;
2641
- }
2642
- process.env.NODE_ENV !== "production" && D(`
2643
- A screen reader message was trying to be announced but it was unable to do so.
2644
- This can occur if you unmount your <DragDropContext /> in your onDragEnd.
2645
- Consider calling provided.announce() before the unmount so that the instruction will
2646
- not be lost for users relying on a screen reader.
2647
-
2648
- Message not passed to screen reader:
2649
-
2650
- "${e}"
2651
- `);
2652
- }, []);
2653
- }
2654
- var Ri = { separator: "::" };
2655
- function zi(e, t = Ri) {
2656
- let n = h.useId();
2657
- return j(() => `${e}${t.separator}${n}`, [
2658
- t.separator,
2659
- e,
2660
- n
2661
- ]);
2662
- }
2663
- function Bi({ contextId: e, uniqueId: t }) {
2664
- return `rfd-hidden-text-${e}-${t}`;
2665
- }
2666
- function Vi({ contextId: e, text: t }) {
2667
- let n = zi("hidden-text", { separator: "-" }), r = j(() => Bi({
2668
- contextId: e,
2669
- uniqueId: n
2670
- }), [n, e]);
2671
- return _(function() {
2672
- let e = document.createElement("div");
2673
- return e.id = r, e.textContent = t, e.style.display = "none", Pi().appendChild(e), function() {
2674
- let t = Pi();
2675
- t.contains(e) && t.removeChild(e);
2676
- };
2677
- }, [r, t]), r;
2678
- }
2679
- var Hi = h.createContext(null), Ui = { react: "^18.0.0 || ^19.0.0" }, Wi = /(\d+)\.(\d+)\.(\d+)/, Gi = (e) => {
2680
- let t = Wi.exec(e);
2681
- return t ?? (process.env.NODE_ENV === "production" ? A() : A(!1, `Unable to parse React version ${e}`)), {
2682
- major: Number(t[1]),
2683
- minor: Number(t[2]),
2684
- patch: Number(t[3]),
2685
- raw: e
2686
- };
2687
- }, 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) => {
2688
- let n = Gi(e), r = Gi(t);
2689
- Ki(n, r) || process.env.NODE_ENV !== "production" && D(`
2690
- React version: [${r.raw}]
2691
- does not satisfy expected peer dependency version: [${n.raw}]
2692
-
2693
- This can result in run time bugs, and even fatal crashes
2694
- `);
2695
- }, 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) => {
2696
- let t = e.doctype;
2697
- if (!t) {
2698
- process.env.NODE_ENV !== "production" && D(`
2699
- No <!doctype html> found.
2700
-
2701
- ${Ji}
2702
- `);
2703
- return;
2704
- }
2705
- t.name.toLowerCase() !== "html" && process.env.NODE_ENV !== "production" && D(`
2706
- Unexpected <!doctype> found: (${t.name})
2707
-
2708
- ${Ji}
2709
- `), t.publicId !== "" && process.env.NODE_ENV !== "production" && D(`
2710
- Unexpected <!doctype> publicId found: (${t.publicId})
2711
- A html5 doctype does not have a publicId
2712
-
2713
- ${Ji}
2714
- `);
2715
- };
2716
- function Xi(e) {
2717
- process.env.NODE_ENV !== "production" && e();
2718
- }
2719
- function Zi(e, t) {
2720
- Xi(() => {
2721
- _(() => {
2722
- try {
2723
- e();
2724
- } catch (e) {
2725
- ie(`
2726
- A setup problem was encountered.
2727
-
2728
- > ${e.message}
2729
- `);
2730
- }
2731
- }, t);
2732
- });
2733
- }
2734
- function Qi() {
2735
- Zi(() => {
2736
- qi(Ui.react, h.version), Yi(document);
2737
- }, []);
2738
- }
2739
- function $i(e) {
2740
- let t = y(e);
2741
- return _(() => {
2742
- t.current = e;
2743
- }), t;
2744
- }
2745
- function ea() {
2746
- let e = null;
2747
- function t() {
2748
- return !!e;
2749
- }
2750
- function n(t) {
2751
- return t === e;
2752
- }
2753
- function r(t) {
2754
- e && (process.env.NODE_ENV === "production" ? A() : A(!1, "Cannot claim lock as it is already claimed"));
2755
- let n = { abandon: t };
2756
- return e = n, n;
2757
- }
2758
- function i() {
2759
- !e && (process.env.NODE_ENV === "production" ? A() : A(!1, "Cannot release lock when there is no lock")), e = null;
2760
- }
2761
- function a() {
2762
- e && (e.abandon(), i());
2763
- }
2764
- return {
2765
- isClaimed: t,
2766
- isActive: n,
2767
- claim: r,
2768
- release: i,
2769
- tryAbandon: a
2770
- };
2771
- }
2772
- function ta(e) {
2773
- return e.phase === "IDLE" || e.phase === "DROP_ANIMATING" ? !1 : e.isDragging;
2774
- }
2775
- 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 = {
2776
- [ra]: !0,
2777
- [na]: !0
2778
- }, ha = (e) => {
2779
- ma[e.keyCode] && e.preventDefault();
2780
- }, ga = (() => {
2781
- let e = "visibilitychange";
2782
- return typeof document > "u" ? e : [
2783
- e,
2784
- `ms${e}`,
2785
- `webkit${e}`,
2786
- `moz${e}`,
2787
- `o${e}`
2788
- ].find((e) => `on${e}` in document) || e;
2789
- })(), _a = 0, va = 5;
2790
- function ya(e, t) {
2791
- return Math.abs(t.x - e.x) >= va || Math.abs(t.y - e.y) >= va;
2792
- }
2793
- var ba = { type: "IDLE" };
2794
- function xa({ cancel: e, completed: t, getPhase: n, setPhase: r }) {
2795
- return [
2796
- {
2797
- eventName: "mousemove",
2798
- fn: (e) => {
2799
- let { button: t, clientX: i, clientY: a } = e;
2800
- if (t !== _a) return;
2801
- let o = {
2802
- x: i,
2803
- y: a
2804
- }, s = n();
2805
- if (s.type === "DRAGGING") {
2806
- e.preventDefault(), s.actions.move(o);
2807
- return;
2808
- }
2809
- s.type !== "PENDING" && (process.env.NODE_ENV === "production" ? A() : A(!1, "Cannot be IDLE"));
2810
- let c = s.point;
2811
- ya(c, o) && (e.preventDefault(), r({
2812
- type: "DRAGGING",
2813
- actions: s.actions.fluidLift(o)
2814
- }));
2815
- }
2816
- },
2817
- {
2818
- eventName: "mouseup",
2819
- fn: (r) => {
2820
- let i = n();
2821
- if (i.type !== "DRAGGING") {
2822
- e();
2823
- return;
2824
- }
2825
- r.preventDefault(), i.actions.drop({ shouldBlockNextClick: !0 }), t();
2826
- }
2827
- },
2828
- {
2829
- eventName: "mousedown",
2830
- fn: (t) => {
2831
- n().type === "DRAGGING" && t.preventDefault(), e();
2832
- }
2833
- },
2834
- {
2835
- eventName: "keydown",
2836
- fn: (t) => {
2837
- if (n().type === "PENDING") {
2838
- e();
2839
- return;
2840
- }
2841
- if (t.keyCode === ia) {
2842
- t.preventDefault(), e();
2843
- return;
2844
- }
2845
- ha(t);
2846
- }
2847
- },
2848
- {
2849
- eventName: "resize",
2850
- fn: e
2851
- },
2852
- {
2853
- eventName: "scroll",
2854
- options: {
2855
- passive: !0,
2856
- capture: !1
2857
- },
2858
- fn: () => {
2859
- n().type === "PENDING" && e();
2860
- }
2861
- },
2862
- {
2863
- eventName: "webkitmouseforcedown",
2864
- fn: (t) => {
2865
- let r = n();
2866
- if (r.type === "IDLE" && (process.env.NODE_ENV === "production" ? A() : A(!1, "Unexpected phase")), r.actions.shouldRespectForcePress()) {
2867
- e();
2868
- return;
2869
- }
2870
- t.preventDefault();
2871
- }
2872
- },
2873
- {
2874
- eventName: ga,
2875
- fn: e
2876
- }
2877
- ];
2878
- }
2879
- function Sa(e) {
2880
- let t = y(ba), n = y(O), r = j(() => ({
2881
- eventName: "mousedown",
2882
- fn: function(t) {
2883
- if (t.defaultPrevented || t.button !== _a || t.ctrlKey || t.metaKey || t.shiftKey || t.altKey) return;
2884
- let r = e.findClosestDraggableId(t);
2885
- if (!r) return;
2886
- let i = e.tryGetLock(r, o, { sourceEvent: t });
2887
- if (!i) return;
2888
- t.preventDefault();
2889
- let a = {
2890
- x: t.clientX,
2891
- y: t.clientY
2892
- };
2893
- n.current(), l(i, a);
2894
- }
2895
- }), [e]), i = j(() => ({
2896
- eventName: "webkitmouseforcewillbegin",
2897
- fn: (t) => {
2898
- if (t.defaultPrevented) return;
2899
- let n = e.findClosestDraggableId(t);
2900
- if (!n) return;
2901
- let r = e.findOptionsForDraggable(n);
2902
- r && (r.shouldRespectForcePress || e.canGetLock(n) && t.preventDefault());
2903
- }
2904
- }), [e]), a = M(function() {
2905
- n.current = k(window, [i, r], {
2906
- passive: !1,
2907
- capture: !0
2908
- });
2909
- }, [i, r]), o = M(() => {
2910
- t.current.type !== "IDLE" && (t.current = ba, n.current(), a());
2911
- }, [a]), s = M(() => {
2912
- let e = t.current;
2913
- o(), e.type === "DRAGGING" && e.actions.cancel({ shouldBlockNextClick: !0 }), e.type === "PENDING" && e.actions.abort();
2914
- }, [o]), c = M(function() {
2915
- let e = {
2916
- capture: !0,
2917
- passive: !1
2918
- }, r = xa({
2919
- cancel: s,
2920
- completed: o,
2921
- getPhase: () => t.current,
2922
- setPhase: (e) => {
2923
- t.current = e;
2924
- }
2925
- });
2926
- n.current = k(window, r, e);
2927
- }, [s, o]), l = M(function(e, n) {
2928
- t.current.type !== "IDLE" && (process.env.NODE_ENV === "production" ? A() : A(!1, "Expected to move from IDLE to PENDING drag")), t.current = {
2929
- type: "PENDING",
2930
- point: n,
2931
- actions: e
2932
- }, c();
2933
- }, [c]);
2934
- $(function() {
2935
- return a(), function() {
2936
- n.current();
2937
- };
2938
- }, [a]);
2939
- }
2940
- function Ca() {}
2941
- var wa = {
2942
- [sa]: !0,
2943
- [oa]: !0,
2944
- [la]: !0,
2945
- [ca]: !0
2946
- };
2947
- function Ta(e, t) {
2948
- function n() {
2949
- t(), e.cancel();
2950
- }
2951
- function r() {
2952
- t(), e.drop();
2953
- }
2954
- return [
2955
- {
2956
- eventName: "keydown",
2957
- fn: (t) => {
2958
- if (t.keyCode === ia) {
2959
- t.preventDefault(), n();
2960
- return;
2961
- }
2962
- if (t.keyCode === aa) {
2963
- t.preventDefault(), r();
2964
- return;
2965
- }
2966
- if (t.keyCode === pa) {
2967
- t.preventDefault(), e.moveDown();
2968
- return;
2969
- }
2970
- if (t.keyCode === da) {
2971
- t.preventDefault(), e.moveUp();
2972
- return;
2973
- }
2974
- if (t.keyCode === fa) {
2975
- t.preventDefault(), e.moveRight();
2976
- return;
2977
- }
2978
- if (t.keyCode === ua) {
2979
- t.preventDefault(), e.moveLeft();
2980
- return;
2981
- }
2982
- if (wa[t.keyCode]) {
2983
- t.preventDefault();
2984
- return;
2985
- }
2986
- ha(t);
2987
- }
2988
- },
2989
- {
2990
- eventName: "mousedown",
2991
- fn: n
2992
- },
2993
- {
2994
- eventName: "mouseup",
2995
- fn: n
2996
- },
2997
- {
2998
- eventName: "click",
2999
- fn: n
3000
- },
3001
- {
3002
- eventName: "touchstart",
3003
- fn: n
3004
- },
3005
- {
3006
- eventName: "resize",
3007
- fn: n
3008
- },
3009
- {
3010
- eventName: "wheel",
3011
- fn: n,
3012
- options: { passive: !0 }
3013
- },
3014
- {
3015
- eventName: ga,
3016
- fn: n
3017
- }
3018
- ];
3019
- }
3020
- function Ea(e) {
3021
- let t = y(Ca), n = j(() => ({
3022
- eventName: "keydown",
3023
- fn: function(n) {
3024
- if (n.defaultPrevented || n.keyCode !== aa) return;
3025
- let i = e.findClosestDraggableId(n);
3026
- if (!i) return;
3027
- let a = e.tryGetLock(i, c, { sourceEvent: n });
3028
- if (!a) return;
3029
- n.preventDefault();
3030
- let o = !0, s = a.snapLift();
3031
- t.current();
3032
- function c() {
3033
- !o && (process.env.NODE_ENV === "production" ? A() : A(!1, "Cannot stop capturing a keyboard drag when not capturing")), o = !1, t.current(), r();
3034
- }
3035
- t.current = k(window, Ta(s, c), {
3036
- capture: !0,
3037
- passive: !1
3038
- });
3039
- }
3040
- }), [e]), r = M(function() {
3041
- t.current = k(window, [n], {
3042
- passive: !1,
3043
- capture: !0
3044
- });
3045
- }, [n]);
3046
- $(function() {
3047
- return r(), function() {
3048
- t.current();
3049
- };
3050
- }, [r]);
3051
- }
3052
- var Da = { type: "IDLE" }, Oa = 120, ka = .15;
3053
- function Aa({ cancel: e, getPhase: t }) {
3054
- return [
3055
- {
3056
- eventName: "orientationchange",
3057
- fn: e
3058
- },
3059
- {
3060
- eventName: "resize",
3061
- fn: e
3062
- },
3063
- {
3064
- eventName: "contextmenu",
3065
- fn: (e) => {
3066
- e.preventDefault();
3067
- }
3068
- },
3069
- {
3070
- eventName: "keydown",
3071
- fn: (n) => {
3072
- if (t().type !== "DRAGGING") {
3073
- e();
3074
- return;
3075
- }
3076
- n.keyCode === ia && n.preventDefault(), e();
3077
- }
3078
- },
3079
- {
3080
- eventName: ga,
3081
- fn: e
3082
- }
3083
- ];
3084
- }
3085
- function ja({ cancel: e, completed: t, getPhase: n }) {
3086
- return [
3087
- {
3088
- eventName: "touchmove",
3089
- options: { capture: !1 },
3090
- fn: (t) => {
3091
- let r = n();
3092
- if (r.type !== "DRAGGING") {
3093
- e();
3094
- return;
3095
- }
3096
- r.hasMoved = !0;
3097
- let { clientX: i, clientY: a } = t.touches[0], o = {
3098
- x: i,
3099
- y: a
3100
- };
3101
- t.preventDefault(), r.actions.move(o);
3102
- }
3103
- },
3104
- {
3105
- eventName: "touchend",
3106
- fn: (r) => {
3107
- let i = n();
3108
- if (i.type !== "DRAGGING") {
3109
- e();
3110
- return;
3111
- }
3112
- r.preventDefault(), i.actions.drop({ shouldBlockNextClick: !0 }), t();
3113
- }
3114
- },
3115
- {
3116
- eventName: "touchcancel",
3117
- fn: (t) => {
3118
- if (n().type !== "DRAGGING") {
3119
- e();
3120
- return;
3121
- }
3122
- t.preventDefault(), e();
3123
- }
3124
- },
3125
- {
3126
- eventName: "touchforcechange",
3127
- fn: (t) => {
3128
- let r = n();
3129
- r.type === "IDLE" && (process.env.NODE_ENV, A());
3130
- let i = t.touches[0];
3131
- if (!i || !(i.force >= ka)) return;
3132
- let a = r.actions.shouldRespectForcePress();
3133
- if (r.type === "PENDING") {
3134
- a && e();
3135
- return;
3136
- }
3137
- if (a) {
3138
- if (r.hasMoved) {
3139
- t.preventDefault();
3140
- return;
3141
- }
3142
- e();
3143
- return;
3144
- }
3145
- t.preventDefault();
3146
- }
3147
- },
3148
- {
3149
- eventName: ga,
3150
- fn: e
3151
- }
3152
- ];
3153
- }
3154
- function Ma(e) {
3155
- let t = y(Da), n = y(O), r = M(function() {
3156
- return t.current;
3157
- }, []), i = M(function(e) {
3158
- t.current = e;
3159
- }, []), a = j(() => ({
3160
- eventName: "touchstart",
3161
- fn: function(t) {
3162
- if (t.defaultPrevented) return;
3163
- let r = e.findClosestDraggableId(t);
3164
- if (!r) return;
3165
- let i = e.tryGetLock(r, s, { sourceEvent: t });
3166
- if (!i) return;
3167
- let { clientX: a, clientY: o } = t.touches[0], c = {
3168
- x: a,
3169
- y: o
3170
- };
3171
- n.current(), d(i, c);
3172
- }
3173
- }), [e]), o = M(function() {
3174
- n.current = k(window, [a], {
3175
- capture: !0,
3176
- passive: !1
3177
- });
3178
- }, [a]), s = M(() => {
3179
- let e = t.current;
3180
- e.type !== "IDLE" && (e.type === "PENDING" && clearTimeout(e.longPressTimerId), i(Da), n.current(), o());
3181
- }, [o, i]), c = M(() => {
3182
- let e = t.current;
3183
- s(), e.type === "DRAGGING" && e.actions.cancel({ shouldBlockNextClick: !0 }), e.type === "PENDING" && e.actions.abort();
3184
- }, [s]), l = M(function() {
3185
- let e = {
3186
- capture: !0,
3187
- passive: !1
3188
- }, t = {
3189
- cancel: c,
3190
- completed: s,
3191
- getPhase: r
3192
- }, i = k(window, ja(t), e), a = k(window, Aa(t), e);
3193
- n.current = function() {
3194
- i(), a();
3195
- };
3196
- }, [
3197
- c,
3198
- r,
3199
- s
3200
- ]), u = M(function() {
3201
- let e = r();
3202
- e.type !== "PENDING" && (process.env.NODE_ENV === "production" ? A() : A(!1, `Cannot start dragging from phase ${e.type}`));
3203
- let t = e.actions.fluidLift(e.point);
3204
- i({
3205
- type: "DRAGGING",
3206
- actions: t,
3207
- hasMoved: !1
3208
- });
3209
- }, [r, i]), d = M(function(e, t) {
3210
- r().type !== "IDLE" && (process.env.NODE_ENV === "production" ? A() : A(!1, "Expected to move from IDLE to PENDING drag"));
3211
- let n = setTimeout(u, Oa);
3212
- i({
3213
- type: "PENDING",
3214
- point: t,
3215
- actions: e,
3216
- longPressTimerId: n
3217
- }), l();
3218
- }, [
3219
- l,
3220
- r,
3221
- i,
3222
- u
3223
- ]);
3224
- $(function() {
3225
- return o(), function() {
3226
- n.current();
3227
- let e = r();
3228
- e.type === "PENDING" && (clearTimeout(e.longPressTimerId), i(Da));
3229
- };
3230
- }, [
3231
- r,
3232
- o,
3233
- i
3234
- ]), $(function() {
3235
- return k(window, [{
3236
- eventName: "touchmove",
3237
- fn: () => {},
3238
- options: {
3239
- capture: !1,
3240
- passive: !1
3241
- }
3242
- }]);
3243
- }, []);
3244
- }
3245
- function Na(e) {
3246
- Xi(() => {
3247
- let t = $i(e);
3248
- Zi(() => {
3249
- t.current.length !== e.length && (process.env.NODE_ENV === "production" ? A(!1) : A(!1, "Cannot change the amount of sensor hooks after mounting"));
3250
- });
3251
- });
3252
- }
3253
- var Pa = [
3254
- "input",
3255
- "button",
3256
- "textarea",
3257
- "select",
3258
- "option",
3259
- "optgroup",
3260
- "video",
3261
- "audio"
3262
- ];
3263
- function Fa(e, t) {
3264
- if (t == null) return !1;
3265
- if (Pa.includes(t.tagName.toLowerCase())) return !0;
3266
- let n = t.getAttribute("contenteditable");
3267
- return n === "true" || n === "" || t !== e && Fa(e, t.parentElement);
3268
- }
3269
- function Ia(e, t) {
3270
- let n = t.target;
3271
- return Oi(n) ? Fa(e, n) : !1;
3272
- }
3273
- var La = (e) => u(e.getBoundingClientRect()).center;
3274
- function Ra(e) {
3275
- return e instanceof Di(e).Element;
3276
- }
3277
- var za = (() => {
3278
- let e = "matches";
3279
- return typeof document > "u" ? e : [
3280
- e,
3281
- "msMatchesSelector",
3282
- "webkitMatchesSelector"
3283
- ].find((e) => e in Element.prototype) || e;
3284
- })();
3285
- function Ba(e, t) {
3286
- return e == null ? null : e[za](t) ? e : Ba(e.parentElement, t);
3287
- }
3288
- function Va(e, t) {
3289
- return e.closest ? e.closest(t) : Ba(e, t);
3290
- }
3291
- function Ha(e) {
3292
- return `[${Q.contextId}="${e}"]`;
3293
- }
3294
- function Ua(e, t) {
3295
- let n = t.target;
3296
- if (!Ra(n)) return process.env.NODE_ENV !== "production" && D("event.target must be a Element"), null;
3297
- let r = Va(n, Ha(e));
3298
- return r ? Oi(r) ? r : (process.env.NODE_ENV !== "production" && D("drag handle must be a HTMLElement"), null) : null;
3299
- }
3300
- function Wa(e, t) {
3301
- let n = Ua(e, t);
3302
- return n ? n.getAttribute(Q.draggableId) : null;
3303
- }
3304
- function Ga(e, t) {
3305
- let n = `[${gi.contextId}="${e}"]`, r = Ei(document, n).find((e) => e.getAttribute(gi.id) === t);
3306
- return r ? Oi(r) ? r : (process.env.NODE_ENV !== "production" && D("Draggable element is not a HTMLElement"), null) : null;
3307
- }
3308
- function Ka(e) {
3309
- e.preventDefault();
3310
- }
3311
- function qa({ expected: e, phase: t, isLockActive: n, shouldWarn: r }) {
3312
- return n() ? e === t ? !0 : (r && process.env.NODE_ENV !== "production" && D(`
3313
- Cannot perform action.
3314
- The actions you used belong to an outdated phase
3315
-
3316
- Current phase: ${e}
3317
- You called an action from outdated phase: ${t}
3318
-
3319
- Tips:
3320
-
3321
- - Do not use preDragActions actions after calling preDragActions.lift()
3322
- `), !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);
3323
- }
3324
- function Ja({ lockAPI: e, store: t, registry: n, draggableId: r }) {
3325
- if (e.isClaimed()) return !1;
3326
- let i = n.draggable.findById(r);
3327
- return i ? !(!i.options.isEnabled || !Vr(t.getState(), r)) : (process.env.NODE_ENV !== "production" && D(`Unable to find draggable with id: ${r}`), !1);
3328
- }
3329
- function Ya({ lockAPI: e, contextId: t, store: n, registry: r, draggableId: i, forceSensorStop: a, sourceEvent: o }) {
3330
- if (!Ja({
3331
- lockAPI: e,
3332
- store: n,
3333
- registry: r,
3334
- draggableId: i
3335
- })) return null;
3336
- let s = r.draggable.getById(i), c = Ga(t, s.descriptor.id);
3337
- if (!c) return process.env.NODE_ENV !== "production" && D(`Unable to find draggable element with id: ${i}`), null;
3338
- if (o && !s.options.canDragInteractiveElements && Ia(c, o)) return null;
3339
- let l = e.claim(a || O), u = "PRE_DRAG";
3340
- function d() {
3341
- return s.options.shouldRespectForcePress;
3342
- }
3343
- function f() {
3344
- return e.isActive(l);
3345
- }
3346
- function m(e, t) {
3347
- qa({
3348
- expected: e,
3349
- phase: u,
3350
- isLockActive: f,
3351
- shouldWarn: !0
3352
- }) && n.dispatch(t());
3353
- }
3354
- let h = m.bind(null, "DRAGGING");
3355
- function g(t) {
3356
- function r() {
3357
- e.release(), u = "COMPLETED";
3358
- }
3359
- u !== "PRE_DRAG" && (r(), process.env.NODE_ENV === "production" ? A() : A(!1, `Cannot lift in phase ${u}`)), n.dispatch(Cn(t.liftActionArgs)), u = "DRAGGING";
3360
- function i(e, i = { shouldBlockNextClick: !1 }) {
3361
- if (t.cleanup(), i.shouldBlockNextClick) {
3362
- let e = k(window, [{
3363
- eventName: "click",
3364
- fn: Ka,
3365
- options: {
3366
- once: !0,
3367
- passive: !1,
3368
- capture: !0
3369
- }
3370
- }]);
3371
- setTimeout(e);
3372
- }
3373
- r(), n.dispatch(Bn({ reason: e }));
3374
- }
3375
- return {
3376
- isActive: () => qa({
3377
- expected: "DRAGGING",
3378
- phase: u,
3379
- isLockActive: f,
3380
- shouldWarn: !1
3381
- }),
3382
- shouldRespectForcePress: d,
3383
- drop: (e) => i("DROP", e),
3384
- cancel: (e) => i("CANCEL", e),
3385
- ...t.actions
3386
- };
3387
- }
3388
- function _(e) {
3389
- let t = p((e) => {
3390
- h(() => An({ client: e }));
3391
- });
3392
- return {
3393
- ...g({
3394
- liftActionArgs: {
3395
- id: i,
3396
- clientSelection: e,
3397
- movementMode: "FLUID"
3398
- },
3399
- cleanup: () => t.cancel(),
3400
- actions: { move: t }
3401
- }),
3402
- move: t
3403
- };
3404
- }
3405
- function v() {
3406
- return g({
3407
- liftActionArgs: {
3408
- id: i,
3409
- clientSelection: La(c),
3410
- movementMode: "SNAP"
3411
- },
3412
- cleanup: O,
3413
- actions: {
3414
- moveUp: () => h(Nn),
3415
- moveRight: () => h(Fn),
3416
- moveDown: () => h(Pn),
3417
- moveLeft: () => h(In)
3418
- }
3419
- });
3420
- }
3421
- function y() {
3422
- qa({
3423
- expected: "PRE_DRAG",
3424
- phase: u,
3425
- isLockActive: f,
3426
- shouldWarn: !0
3427
- }) && e.release();
3428
- }
3429
- return {
3430
- isActive: () => qa({
3431
- expected: "PRE_DRAG",
3432
- phase: u,
3433
- isLockActive: f,
3434
- shouldWarn: !1
3435
- }),
3436
- shouldRespectForcePress: d,
3437
- fluidLift: _,
3438
- snapLift: v,
3439
- abort: y
3440
- };
3441
- }
3442
- var Xa = [
3443
- Sa,
3444
- Ea,
3445
- Ma
3446
- ];
3447
- function Za({ contextId: e, store: t, registry: n, customSensors: r, enableDefaultSensors: i }) {
3448
- let a = [...i ? Xa : [], ...r || []], o = b(() => ea())[0], s = M(function(e, t) {
3449
- ta(e) && !ta(t) && o.tryAbandon();
3450
- }, [o]);
3451
- $(function() {
3452
- let e = t.getState();
3453
- return t.subscribe(() => {
3454
- let n = t.getState();
3455
- s(e, n), e = n;
3456
- });
3457
- }, [
3458
- o,
3459
- t,
3460
- s
3461
- ]), $(() => o.tryAbandon, [o.tryAbandon]);
3462
- let c = M((e) => Ja({
3463
- lockAPI: o,
3464
- registry: n,
3465
- store: t,
3466
- draggableId: e
3467
- }), [
3468
- o,
3469
- n,
3470
- t
3471
- ]), l = M((r, i, a) => Ya({
3472
- lockAPI: o,
3473
- registry: n,
3474
- contextId: e,
3475
- store: t,
3476
- draggableId: r,
3477
- forceSensorStop: i || null,
3478
- sourceEvent: a && a.sourceEvent ? a.sourceEvent : null
3479
- }), [
3480
- e,
3481
- o,
3482
- n,
3483
- t
3484
- ]), u = M((t) => Wa(e, t), [e]), d = M((e) => {
3485
- let t = n.draggable.findById(e);
3486
- return t ? t.options : null;
3487
- }, [n.draggable]), f = M(function() {
3488
- o.isClaimed() && (o.tryAbandon(), t.getState().phase !== "IDLE" && t.dispatch(Ln()));
3489
- }, [o, t]), p = M(() => o.isClaimed(), [o]), m = j(() => ({
3490
- canGetLock: c,
3491
- tryGetLock: l,
3492
- findClosestDraggableId: u,
3493
- findOptionsForDraggable: d,
3494
- tryReleaseLock: f,
3495
- isLockClaimed: p
3496
- }), [
3497
- c,
3498
- l,
3499
- u,
3500
- d,
3501
- f,
3502
- p
3503
- ]);
3504
- Na(a);
3505
- for (let e = 0; e < a.length; e++) a[e](m);
3506
- }
3507
- var Qa = (e) => ({
3508
- onBeforeCapture: (t) => {
3509
- S(() => {
3510
- e.onBeforeCapture && e.onBeforeCapture(t);
3511
- });
3512
- },
3513
- onBeforeDragStart: e.onBeforeDragStart,
3514
- onDragStart: e.onDragStart,
3515
- onDragEnd: e.onDragEnd,
3516
- onDragUpdate: e.onDragUpdate
3517
- }), $a = (e) => ({
3518
- ...Kr,
3519
- ...e.autoScrollerOptions,
3520
- durationDampening: {
3521
- ...Kr.durationDampening,
3522
- ...e.autoScrollerOptions
3523
- }
3524
- });
3525
- function eo(e) {
3526
- return !e.current && (process.env.NODE_ENV === "production" ? A() : A(!1, "Could not find store from lazy ref")), e.current;
3527
- }
3528
- function to(e) {
3529
- let { contextId: n, setCallbacks: r, sensors: a, nonce: o, dragHandleUsageInstructions: s } = e, c = y(null);
3530
- Qi();
3531
- let l = $i(e), u = M(() => Qa(l.current), [l]), d = M(() => $a(l.current), [l]), f = Li(n), p = Vi({
3532
- contextId: n,
3533
- text: s
3534
- }), m = Ti(n, o), g = M((e) => {
3535
- eo(c).dispatch(e);
3536
- }, []), v = j(() => t({
3537
- publishWhileDragging: Tn,
3538
- updateDroppableScroll: Dn,
3539
- updateDroppableIsEnabled: On,
3540
- updateDroppableIsCombineEnabled: kn,
3541
- collectionStarting: En
3542
- }, g), [g]), b = Mi(), x = j(() => Br(b, v), [b, v]), S = j(() => hi({
3543
- scrollWindow: Hr,
3544
- scrollDroppable: x.scrollDroppable,
3545
- getAutoScrollerOptions: d,
3546
- ...t({ move: An }, g)
3547
- }), [
3548
- x.scrollDroppable,
3549
- g,
3550
- d
3551
- ]), C = Ai(n), w = j(() => jr({
3552
- announce: f,
3553
- autoScroller: S,
3554
- dimensionMarshal: x,
3555
- focusMarshal: C,
3556
- getResponders: u,
3557
- styleMarshal: m
3558
- }), [
3559
- f,
3560
- S,
3561
- x,
3562
- C,
3563
- u,
3564
- m
3565
- ]);
3566
- process.env.NODE_ENV !== "production" && c.current && c.current !== w && process.env.NODE_ENV !== "production" && D("unexpected store change"), c.current = w;
3567
- let T = M(() => {
3568
- let e = eo(c);
3569
- e.getState().phase !== "IDLE" && e.dispatch(Ln());
3570
- }, []), E = M(() => {
3571
- let e = eo(c).getState();
3572
- return e.phase === "DROP_ANIMATING" || e.phase !== "IDLE" && e.isDragging;
3573
- }, []);
3574
- r(j(() => ({
3575
- isDragging: E,
3576
- tryAbort: T
3577
- }), [E, T]));
3578
- let ee = M((e) => Vr(eo(c).getState(), e), []), te = M(() => J(eo(c).getState()), []), ne = j(() => ({
3579
- marshal: x,
3580
- focus: C,
3581
- contextId: n,
3582
- canLift: ee,
3583
- isMovementAllowed: te,
3584
- dragHandleUsageInstructionsId: p,
3585
- registry: b
3586
- }), [
3587
- n,
3588
- x,
3589
- p,
3590
- C,
3591
- ee,
3592
- te,
3593
- b
3594
- ]);
3595
- return Za({
3596
- contextId: n,
3597
- store: w,
3598
- registry: b,
3599
- customSensors: a || null,
3600
- enableDefaultSensors: e.enableDefaultSensors !== !1
3601
- }), _(() => T, [T]), h.createElement(Hi.Provider, { value: ne }, h.createElement(i, {
3602
- context: Ni,
3603
- store: w
3604
- }, e.children));
3605
- }
3606
- function no() {
3607
- return h.useId();
3608
- }
3609
- function ro(e) {
3610
- let t = no(), n = e.dragHandleUsageInstructions || _e.dragHandleUsageInstructions;
3611
- return h.createElement(le, null, (r) => h.createElement(to, {
3612
- nonce: e.nonce,
3613
- contextId: t,
3614
- setCallbacks: r,
3615
- dragHandleUsageInstructions: n,
3616
- enableDefaultSensors: e.enableDefaultSensors,
3617
- sensors: e.sensors,
3618
- onBeforeCapture: e.onBeforeCapture,
3619
- onBeforeDragStart: e.onBeforeDragStart,
3620
- onDragStart: e.onDragStart,
3621
- onDragUpdate: e.onDragUpdate,
3622
- onDragEnd: e.onDragEnd,
3623
- autoScrollerOptions: e.autoScrollerOptions
3624
- }, e.children));
3625
- }
3626
- var io = {
3627
- dragging: 5e3,
3628
- dropAnimating: 4500
3629
- }, ao = (e, t) => t ? Xn.drop(t.duration) : e ? Xn.snap : Xn.fluid, oo = (e, t) => {
3630
- if (e) return t ? Jn.opacity.drop : Jn.opacity.combining;
3631
- }, so = (e) => e.forceShouldAnimate == null ? e.mode === "SNAP" : e.forceShouldAnimate;
3632
- function co(e) {
3633
- 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);
3634
- return {
3635
- position: "fixed",
3636
- top: t.marginBox.top,
3637
- left: t.marginBox.left,
3638
- boxSizing: "border-box",
3639
- width: t.borderBox.width,
3640
- height: t.borderBox.height,
3641
- transition: ao(o, i),
3642
- transform: c,
3643
- opacity: oo(a, s),
3644
- zIndex: s ? io.dropAnimating : io.dragging,
3645
- pointerEvents: "none"
3646
- };
3647
- }
3648
- function lo(e) {
3649
- return {
3650
- transform: Qn.moveTo(e.offset),
3651
- transition: e.shouldAnimateDisplacement ? void 0 : "none"
3652
- };
3653
- }
3654
- function uo(e) {
3655
- return e.type === "DRAGGING" ? co(e) : lo(e);
3656
- }
3657
- function fo(e, t, n = N) {
3658
- let r = window.getComputedStyle(t), i = o(t.getBoundingClientRect(), r), a = f(i, n);
3659
- return {
3660
- descriptor: e,
3661
- placeholder: {
3662
- client: i,
3663
- tagName: t.tagName.toLowerCase(),
3664
- display: r.display
3665
- },
3666
- displaceBy: {
3667
- x: i.marginBox.width,
3668
- y: i.marginBox.height
3669
- },
3670
- client: i,
3671
- page: a
3672
- };
3673
- }
3674
- function po(e) {
3675
- let t = zi("draggable"), { descriptor: n, registry: r, getDraggableRef: i, canDragInteractiveElements: a, shouldRespectForcePress: o, isEnabled: s } = e, c = j(() => ({
3676
- canDragInteractiveElements: a,
3677
- shouldRespectForcePress: o,
3678
- isEnabled: s
3679
- }), [
3680
- a,
3681
- s,
3682
- o
3683
- ]), l = M((e) => {
3684
- let t = i();
3685
- return !t && (process.env.NODE_ENV === "production" ? A() : A(!1, "Cannot get dimension when no ref is set")), fo(n, t, e);
3686
- }, [n, i]), u = j(() => ({
3687
- uniqueId: t,
3688
- descriptor: n,
3689
- options: c,
3690
- getDimension: l
3691
- }), [
3692
- n,
3693
- l,
3694
- c,
3695
- t
3696
- ]), d = y(u), f = y(!0);
3697
- $(() => (r.draggable.register(d.current), () => r.draggable.unregister(d.current)), [r.draggable]), $(() => {
3698
- if (f.current) {
3699
- f.current = !1;
3700
- return;
3701
- }
3702
- let e = d.current;
3703
- d.current = u, r.draggable.update(u, e);
3704
- }, [u, r.draggable]);
3705
- }
3706
- var mo = h.createContext(null);
3707
- function ho(e) {
3708
- !(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 "));
3709
- }
3710
- function go(e, t, n) {
3711
- Zi(() => {
3712
- function r(e) {
3713
- return `Draggable[id: ${e}]: `;
3714
- }
3715
- let i = e.draggableId;
3716
- !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.
3717
- 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`)));
3718
- });
3719
- }
3720
- function _o(e) {
3721
- Xi(() => {
3722
- let t = y(e);
3723
- Zi(() => {
3724
- e !== t.current && (process.env.NODE_ENV === "production" ? A(!1) : A(!1, "Draggable isClone prop value changed during component life"));
3725
- }, [e]);
3726
- });
3727
- }
3728
- function vo(e) {
3729
- let t = g(e);
3730
- return !t && (process.env.NODE_ENV === "production" ? A() : A(!1, "Could not find required context")), t;
3731
- }
3732
- function yo(e) {
3733
- e.preventDefault();
3734
- }
3735
- var bo = (e) => {
3736
- let t = y(null), n = M((e = null) => {
3737
- t.current = e;
3738
- }, []), r = M(() => t.current, []), { contextId: i, dragHandleUsageInstructionsId: a, registry: o } = vo(Hi), { type: s, droppableId: c } = vo(mo), l = j(() => ({
3739
- id: e.draggableId,
3740
- index: e.index,
3741
- type: s,
3742
- droppableId: c
3743
- }), [
3744
- e.draggableId,
3745
- e.index,
3746
- s,
3747
- c
3748
- ]), { children: u, draggableId: d, isEnabled: f, shouldRespectForcePress: p, canDragInteractiveElements: m, isClone: g, mapped: _, dropAnimationFinished: v } = e;
3749
- go(e, i, r), _o(g), g || po(j(() => ({
3750
- descriptor: l,
3751
- registry: o,
3752
- getDraggableRef: r,
3753
- canDragInteractiveElements: m,
3754
- shouldRespectForcePress: p,
3755
- isEnabled: f
3756
- }), [
3757
- l,
3758
- o,
3759
- r,
3760
- m,
3761
- p,
3762
- f
3763
- ]));
3764
- let b = j(() => f ? {
3765
- tabIndex: 0,
3766
- role: "button",
3767
- "aria-describedby": a,
3768
- "data-rfd-drag-handle-draggable-id": d,
3769
- "data-rfd-drag-handle-context-id": i,
3770
- draggable: !1,
3771
- onDragStart: yo
3772
- } : null, [
3773
- i,
3774
- a,
3775
- d,
3776
- f
3777
- ]), x = M((e) => {
3778
- _.type === "DRAGGING" && _.dropping && e.propertyName === "transform" && S(v);
3779
- }, [v, _]), C = j(() => {
3780
- let e = uo(_), t = _.type === "DRAGGING" && _.dropping ? x : void 0;
3781
- return {
3782
- innerRef: n,
3783
- draggableProps: {
3784
- "data-rfd-draggable-context-id": i,
3785
- "data-rfd-draggable-id": d,
3786
- style: e,
3787
- onTransitionEnd: t
3788
- },
3789
- dragHandleProps: b
3790
- };
3791
- }, [
3792
- i,
3793
- b,
3794
- d,
3795
- _,
3796
- x,
3797
- n
3798
- ]), w = j(() => ({
3799
- draggableId: l.id,
3800
- type: l.type,
3801
- source: {
3802
- index: l.index,
3803
- droppableId: l.droppableId
3804
- }
3805
- }), [
3806
- l.droppableId,
3807
- l.id,
3808
- l.index,
3809
- l.type
3810
- ]);
3811
- return h.createElement(h.Fragment, null, u(C, _.snapshot, w));
3812
- }, xo = (e, t) => e === t, So = (e) => {
3813
- let { combine: t, destination: n } = e;
3814
- return n ? n.droppableId : t ? t.droppableId : null;
3815
- }, Co = (e) => e.combine ? e.combine.draggableId : null, wo = (e) => e.at && e.at.type === "COMBINE" ? e.at.combine.draggableId : null;
3816
- function To() {
3817
- let e = B((e, t) => ({
3818
- x: e,
3819
- y: t
3820
- })), t = B((e, t, n = null, r = null, i = null) => ({
3821
- isDragging: !0,
3822
- isClone: t,
3823
- isDropAnimating: !!i,
3824
- dropAnimation: i,
3825
- mode: e,
3826
- draggingOver: n,
3827
- combineWith: r,
3828
- combineTargetFor: null
3829
- })), n = B((e, n, r, i, a = null, o = null, s = null) => ({ mapped: {
3830
- type: "DRAGGING",
3831
- dropping: null,
3832
- draggingOver: a,
3833
- combineWith: o,
3834
- mode: n,
3835
- offset: e,
3836
- dimension: r,
3837
- forceShouldAnimate: s,
3838
- snapshot: t(n, i, a, o, null)
3839
- } }));
3840
- return (r, i) => {
3841
- if (ta(r)) {
3842
- if (r.critical.draggable.id !== i.draggableId) return null;
3843
- let t = r.current.client.offset, a = r.dimensions.draggables[i.draggableId], o = q(r.impact), s = wo(r.impact), c = r.forceShouldAnimate;
3844
- return n(e(t.x, t.y), r.movementMode, a, i.isClone, o, s, c);
3845
- }
3846
- if (r.phase === "DROP_ANIMATING") {
3847
- let e = r.completed;
3848
- if (e.result.draggableId !== i.draggableId) return null;
3849
- let n = i.isClone, a = r.dimensions.draggables[i.draggableId], o = e.result, s = o.mode, c = So(o), l = Co(o), u = {
3850
- duration: r.dropDuration,
3851
- curve: qn.drop,
3852
- moveTo: r.newHomeClientOffset,
3853
- opacity: l ? Jn.opacity.drop : null,
3854
- scale: l ? Jn.scale.drop : null
3855
- };
3856
- return { mapped: {
3857
- type: "DRAGGING",
3858
- offset: r.newHomeClientOffset,
3859
- dimension: a,
3860
- dropping: u,
3861
- draggingOver: c,
3862
- combineWith: l,
3863
- mode: s,
3864
- forceShouldAnimate: null,
3865
- snapshot: t(s, n, c, l, u)
3866
- } };
3867
- }
3868
- return null;
3869
- };
3870
- }
3871
- function Eo(e = null) {
3872
- return {
3873
- isDragging: !1,
3874
- isDropAnimating: !1,
3875
- isClone: !1,
3876
- dropAnimation: null,
3877
- mode: null,
3878
- draggingOver: null,
3879
- combineTargetFor: e,
3880
- combineWith: null
3881
- };
3882
- }
3883
- var Do = { mapped: {
3884
- type: "SECONDARY",
3885
- offset: N,
3886
- combineTargetFor: null,
3887
- shouldAnimateDisplacement: !0,
3888
- snapshot: Eo(null)
3889
- } };
3890
- function Oo() {
3891
- let e = B((e, t) => ({
3892
- x: e,
3893
- y: t
3894
- })), t = B(Eo), n = B((e, n = null, r) => ({ mapped: {
3895
- type: "SECONDARY",
3896
- offset: e,
3897
- combineTargetFor: n,
3898
- shouldAnimateDisplacement: r,
3899
- snapshot: t(n)
3900
- } })), r = (e) => e ? n(N, e, !0) : null, i = (t, i, a, o) => {
3901
- let s = a.displaced.visible[t], c = !!(o.inVirtualList && o.effected[t]), l = Ie(a), u = l && l.draggableId === t ? i : null;
3902
- if (!s) {
3903
- if (!c) return r(u);
3904
- if (a.displaced.invisible[t]) return null;
3905
- let i = L(o.displacedBy.point), s = e(i.x, i.y);
3906
- return n(s, u, !0);
3907
- }
3908
- if (c) return r(u);
3909
- let d = a.displacedBy.point, f = e(d.x, d.y);
3910
- return n(f, u, s.shouldAnimate);
3911
- };
3912
- return (e, t) => {
3913
- if (ta(e)) return e.critical.draggable.id === t.draggableId ? null : i(t.draggableId, e.critical.draggable.id, e.impact, e.afterCritical);
3914
- if (e.phase === "DROP_ANIMATING") {
3915
- let n = e.completed;
3916
- return n.result.draggableId === t.draggableId ? null : i(t.draggableId, n.result.draggableId, n.impact, n.afterCritical);
3917
- }
3918
- return null;
3919
- };
3920
- }
3921
- var ko = a(() => {
3922
- let e = To(), t = Oo();
3923
- return (n, r) => e(n, r) || t(n, r) || Do;
3924
- }, { dropAnimationFinished: Hn }, null, {
3925
- context: Ni,
3926
- areStatePropsEqual: xo
3927
- })(bo);
3928
- function Ao(e) {
3929
- return vo(mo).isUsingCloneFor === e.draggableId && !e.isClone ? null : h.createElement(ko, e);
3930
- }
3931
- function jo(e) {
3932
- let t = typeof e.isDragDisabled != "boolean" || !e.isDragDisabled, n = !!e.disableInteractiveElementBlocking, r = !!e.shouldRespectForcePress;
3933
- return h.createElement(Ao, m({}, e, {
3934
- isClone: !1,
3935
- isEnabled: t,
3936
- canDragInteractiveElements: n,
3937
- shouldRespectForcePress: r
3938
- }));
3939
- }
3940
- 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) => {
3941
- let t = window.getComputedStyle(e), n = {
3942
- overflowX: t.overflowX,
3943
- overflowY: t.overflowY
3944
- };
3945
- return Io(n, No) || Io(n, Po);
3946
- }, zo = () => {
3947
- if (process.env.NODE_ENV === "production") return !1;
3948
- let e = Pi(), t = document.documentElement;
3949
- if (!t && (process.env.NODE_ENV, A()), !Ro(e)) return !1;
3950
- let n = window.getComputedStyle(t);
3951
- return Lo({
3952
- overflowX: n.overflowX,
3953
- overflowY: n.overflowY
3954
- }, 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;
3955
- }, Bo = (e) => e == null ? null : e === document.body ? zo() ? e : null : e === document.documentElement ? null : Ro(e) ? e : Bo(e.parentElement), Vo = (e) => {
3956
- 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 ");
3957
- }, Ho = (e) => ({
3958
- x: e.scrollLeft,
3959
- y: e.scrollTop
3960
- }), Uo = (e) => e ? window.getComputedStyle(e).position === "fixed" || Uo(e.parentElement) : !1, Wo = (e) => ({
3961
- closestScrollable: Bo(e),
3962
- isFixedOnPage: Uo(e)
3963
- }), Go = ({ descriptor: e, isEnabled: t, isCombineEnabled: n, isFixedOnPage: r, direction: i, client: a, page: o, closest: s }) => {
3964
- let c = (() => {
3965
- if (!s) return null;
3966
- let { scrollSize: e, client: t } = s, n = Pr({
3967
- scrollHeight: e.scrollHeight,
3968
- scrollWidth: e.scrollWidth,
3969
- height: t.paddingBox.height,
3970
- width: t.paddingBox.width
3971
- });
3972
- return {
3973
- pageMarginBox: s.page.marginBox,
3974
- frameClient: t,
3975
- scrollSize: e,
3976
- shouldClipSubject: s.shouldClipSubject,
3977
- scroll: {
3978
- initial: s.scroll,
3979
- current: s.scroll,
3980
- max: n,
3981
- diff: {
3982
- value: N,
3983
- displacement: N
3984
- }
3985
- }
3986
- };
3987
- })(), l = i === "vertical" ? Ue : We;
3988
- return {
3989
- descriptor: e,
3990
- isCombineEnabled: n,
3991
- isFixedOnPage: r,
3992
- axis: l,
3993
- isEnabled: t,
3994
- client: a,
3995
- page: o,
3996
- frame: c,
3997
- subject: z({
3998
- page: o,
3999
- withPlaceholder: null,
4000
- axis: l,
4001
- frame: c
4002
- })
4003
- };
4004
- }, Ko = (e, t) => {
4005
- let n = l(e);
4006
- if (!t || e !== t) return n;
4007
- let r = n.paddingBox.top - t.scrollTop, i = n.paddingBox.left - t.scrollLeft, a = r + t.scrollHeight;
4008
- return s({
4009
- borderBox: c({
4010
- top: r,
4011
- right: i + t.scrollWidth,
4012
- bottom: a,
4013
- left: i
4014
- }, n.border),
4015
- margin: n.margin,
4016
- border: n.border,
4017
- padding: n.padding
4018
- });
4019
- }, qo = ({ ref: e, descriptor: t, env: n, windowScroll: r, direction: i, isDropDisabled: a, isCombineEnabled: o, shouldClipSubject: s }) => {
4020
- let c = n.closestScrollable, u = Ko(e, c), d = f(u, r), p = (() => {
4021
- if (!c) return null;
4022
- let e = l(c), t = {
4023
- scrollHeight: c.scrollHeight,
4024
- scrollWidth: c.scrollWidth
4025
- };
4026
- return {
4027
- client: e,
4028
- page: f(e, r),
4029
- scroll: Ho(c),
4030
- scrollSize: t,
4031
- shouldClipSubject: s
4032
- };
4033
- })();
4034
- return Go({
4035
- descriptor: t,
4036
- isEnabled: !a,
4037
- isCombineEnabled: o,
4038
- isFixedOnPage: n.isFixedOnPage,
4039
- direction: i,
4040
- client: u,
4041
- page: d,
4042
- closest: p
4043
- });
4044
- }, Jo = { passive: !1 }, Yo = { passive: !0 }, Xo = (e) => e.shouldPublishImmediately ? Jo : Yo, Zo = (e) => e && e.env.closestScrollable || null;
4045
- function Qo(e) {
4046
- let t = y(null), n = vo(Hi), r = zi("droppable"), { registry: i, marshal: a } = n, o = $i(e), s = j(() => ({
4047
- id: e.droppableId,
4048
- type: e.type,
4049
- mode: e.mode
4050
- }), [
4051
- e.droppableId,
4052
- e.mode,
4053
- e.type
4054
- ]), c = y(s), l = j(() => B((e, n) => {
4055
- !t.current && (process.env.NODE_ENV === "production" ? A() : A(!1, "Can only update scroll when dragging"));
4056
- let r = {
4057
- x: e,
4058
- y: n
4059
- };
4060
- a.updateDroppableScroll(s.id, r);
4061
- }), [s.id, a]), u = M(() => {
4062
- let e = t.current;
4063
- return !e || !e.env.closestScrollable ? N : Ho(e.env.closestScrollable);
4064
- }, []), d = M(() => {
4065
- let e = u();
4066
- l(e.x, e.y);
4067
- }, [u, l]), f = j(() => p(d), [d]), m = M(() => {
4068
- let e = t.current, n = Zo(e);
4069
- if (!(e && n) && (process.env.NODE_ENV === "production" ? A() : A(!1, "Could not find scroll options while scrolling")), e.scrollOptions.shouldPublishImmediately) {
4070
- d();
4071
- return;
4072
- }
4073
- f();
4074
- }, [f, d]), h = M((e, r) => {
4075
- t.current && (process.env.NODE_ENV === "production" ? A() : A(!1, "Cannot collect a droppable while a drag is occurring"));
4076
- let i = o.current, a = i.getDroppableRef();
4077
- !a && (process.env.NODE_ENV === "production" ? A() : A(!1, "Cannot collect without a droppable ref"));
4078
- let c = Wo(a), l = {
4079
- ref: a,
4080
- descriptor: s,
4081
- env: c,
4082
- scrollOptions: r
4083
- };
4084
- t.current = l;
4085
- let u = qo({
4086
- ref: a,
4087
- descriptor: s,
4088
- env: c,
4089
- windowScroll: e,
4090
- direction: i.direction,
4091
- isDropDisabled: i.isDropDisabled,
4092
- isCombineEnabled: i.isCombineEnabled,
4093
- shouldClipSubject: !i.ignoreContainerClipping
4094
- }), d = c.closestScrollable;
4095
- return d && (d.setAttribute(vi.contextId, n.contextId), d.addEventListener("scroll", m, Xo(l.scrollOptions)), process.env.NODE_ENV !== "production" && Vo(d)), u;
4096
- }, [
4097
- n.contextId,
4098
- s,
4099
- m,
4100
- o
4101
- ]), g = M(() => {
4102
- let e = t.current, n = Zo(e);
4103
- 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);
4104
- }, []), _ = M(() => {
4105
- let e = t.current;
4106
- !e && (process.env.NODE_ENV === "production" ? A() : A(!1, "Cannot stop drag when no active drag"));
4107
- let n = Zo(e);
4108
- t.current = null, n && (f.cancel(), n.removeAttribute(vi.contextId), n.removeEventListener("scroll", m, Xo(e.scrollOptions)));
4109
- }, [m, f]), v = M((e) => {
4110
- let n = t.current;
4111
- !n && (process.env.NODE_ENV === "production" ? A() : A(!1, "Cannot scroll when there is no drag"));
4112
- let r = Zo(n);
4113
- !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;
4114
- }, []), b = j(() => ({
4115
- getDimensionAndWatchScroll: h,
4116
- getScrollWhileDragging: g,
4117
- dragStopped: _,
4118
- scroll: v
4119
- }), [
4120
- _,
4121
- h,
4122
- g,
4123
- v
4124
- ]), x = j(() => ({
4125
- uniqueId: r,
4126
- descriptor: s,
4127
- callbacks: b
4128
- }), [
4129
- b,
4130
- s,
4131
- r
4132
- ]);
4133
- $(() => (c.current = x.descriptor, i.droppable.register(x), () => {
4134
- t.current && (process.env.NODE_ENV !== "production" && D("Unsupported: changing the droppableId or type of a Droppable during a drag"), _()), i.droppable.unregister(x);
4135
- }), [
4136
- b,
4137
- s,
4138
- _,
4139
- x,
4140
- a,
4141
- i.droppable
4142
- ]), $(() => {
4143
- t.current && a.updateDroppableIsEnabled(c.current.id, !e.isDropDisabled);
4144
- }, [e.isDropDisabled, a]), $(() => {
4145
- t.current && a.updateDroppableIsCombineEnabled(c.current.id, e.isCombineEnabled);
4146
- }, [e.isCombineEnabled, a]);
4147
- }
4148
- function $o() {}
4149
- var es = {
4150
- width: 0,
4151
- height: 0,
4152
- margin: Ee
4153
- }, ts = ({ isAnimatingOpenOnMount: e, placeholder: t, animate: n }) => e || n === "close" ? es : {
4154
- height: t.client.borderBox.height,
4155
- width: t.client.borderBox.width,
4156
- margin: t.client.margin
4157
- }, ns = ({ isAnimatingOpenOnMount: e, placeholder: t, animate: n }) => {
4158
- let r = ts({
4159
- isAnimatingOpenOnMount: e,
4160
- placeholder: t,
4161
- animate: n
4162
- });
4163
- return {
4164
- display: t.display,
4165
- boxSizing: "border-box",
4166
- width: r.width,
4167
- height: r.height,
4168
- marginTop: r.margin.top,
4169
- marginRight: r.margin.right,
4170
- marginBottom: r.margin.bottom,
4171
- marginLeft: r.margin.left,
4172
- flexShrink: "0",
4173
- flexGrow: "0",
4174
- pointerEvents: "none",
4175
- transition: n === "none" ? null : Xn.placeholder
4176
- };
4177
- }, rs = h.memo((e) => {
4178
- let t = y(null), n = M(() => {
4179
- t.current &&= (clearTimeout(t.current), null);
4180
- }, []), { animate: r, onTransitionEnd: i, onClose: a, contextId: o } = e, [s, c] = b(e.animate === "open");
4181
- _(() => s ? r === "open" ? t.current ? $o : (t.current = setTimeout(() => {
4182
- t.current = null, c(!1);
4183
- }), n) : (n(), c(!1), $o) : $o, [
4184
- r,
4185
- s,
4186
- n
4187
- ]);
4188
- let l = M((e) => {
4189
- e.propertyName === "height" && (i(), r === "close" && a());
4190
- }, [
4191
- r,
4192
- a,
4193
- i
4194
- ]), u = ns({
4195
- isAnimatingOpenOnMount: s,
4196
- animate: e.animate,
4197
- placeholder: e.placeholder
4198
- });
4199
- return h.createElement(e.placeholder.tagName, {
4200
- style: u,
4201
- "data-rfd-placeholder-context-id": o,
4202
- onTransitionEnd: l,
4203
- ref: e.innerRef
4204
- });
4205
- });
4206
- function is(e) {
4207
- return typeof e == "boolean";
4208
- }
4209
- function as(e, t) {
4210
- t.forEach((t) => t(e));
4211
- }
4212
- var os = [
4213
- function({ props: e }) {
4214
- !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}]`));
4215
- },
4216
- function({ props: e }) {
4217
- !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"));
4218
- },
4219
- function({ getDroppableRef: e }) {
4220
- ho(e());
4221
- }
4222
- ], ss = [function({ props: e, getPlaceholderRef: t }) {
4223
- e.placeholder && (t() || process.env.NODE_ENV !== "production" && D(`
4224
- Droppable setup issue [droppableId: "${e.droppableId}"]:
4225
- DroppableProvided > placeholder could not be found.
4226
-
4227
- Please be sure to add the {provided.placeholder} React Node as a child of your Droppable.
4228
- More information: https://github.com/hello-pangea/dnd/blob/main/docs/api/droppable.md
4229
- `));
4230
- }], cs = [function({ props: e }) {
4231
- !e.renderClone && (process.env.NODE_ENV === "production" ? A() : A(!1, "Must provide a clone render function (renderClone) for virtual lists"));
4232
- }, function({ getPlaceholderRef: e }) {
4233
- e() && (process.env.NODE_ENV === "production" ? A() : A(!1, "Expected virtual list to not have a placeholder"));
4234
- }];
4235
- function ls(e) {
4236
- Zi(() => {
4237
- as(e, os), e.props.mode === "standard" && as(e, ss), e.props.mode === "virtual" && as(e, cs);
4238
- });
4239
- }
4240
- var us = class extends h.PureComponent {
4241
- constructor(...e) {
4242
- super(...e), this.state = {
4243
- isVisible: !!this.props.on,
4244
- data: this.props.on,
4245
- animate: this.props.shouldAnimate && this.props.on ? "open" : "none"
4246
- }, this.onClose = () => {
4247
- this.state.animate === "close" && this.setState({ isVisible: !1 });
4248
- };
4249
- }
4250
- static getDerivedStateFromProps(e, t) {
4251
- return e.shouldAnimate ? e.on ? {
4252
- isVisible: !0,
4253
- data: e.on,
4254
- animate: "open"
4255
- } : t.isVisible ? {
4256
- isVisible: !0,
4257
- data: t.data,
4258
- animate: "close"
4259
- } : {
4260
- isVisible: !1,
4261
- animate: "close",
4262
- data: null
4263
- } : {
4264
- isVisible: !!e.on,
4265
- data: e.on,
4266
- animate: "none"
4267
- };
4268
- }
4269
- render() {
4270
- if (!this.state.isVisible) return null;
4271
- let e = {
4272
- onClose: this.onClose,
4273
- data: this.state.data,
4274
- animate: this.state.animate
4275
- };
4276
- return this.props.children(e);
4277
- }
4278
- }, ds = (e) => {
4279
- let t = g(Hi);
4280
- !t && (process.env.NODE_ENV === "production" ? A() : A(!1, "Could not find app context"));
4281
- 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) => {
4282
- i.current = e;
4283
- }, []), w = M(() => a.current, []), T = M((e = null) => {
4284
- a.current = e;
4285
- }, []);
4286
- ls({
4287
- props: e,
4288
- getDroppableRef: S,
4289
- getPlaceholderRef: w
4290
- });
4291
- let E = M(() => {
4292
- r() && v({ maxScroll: Ir() });
4293
- }, [r, v]);
4294
- Qo({
4295
- droppableId: s,
4296
- type: c,
4297
- mode: l,
4298
- direction: u,
4299
- isDropDisabled: f,
4300
- isCombineEnabled: p,
4301
- ignoreContainerClipping: d,
4302
- getDroppableRef: S
4303
- });
4304
- let ee = j(() => h.createElement(us, {
4305
- on: e.placeholder,
4306
- shouldAnimate: e.shouldAnimatePlaceholder
4307
- }, ({ onClose: e, data: t, animate: r }) => h.createElement(rs, {
4308
- placeholder: t,
4309
- onClose: e,
4310
- innerRef: T,
4311
- animate: r,
4312
- contextId: n,
4313
- onTransitionEnd: E
4314
- })), [
4315
- n,
4316
- E,
4317
- e.placeholder,
4318
- e.shouldAnimatePlaceholder,
4319
- T
4320
- ]), te = j(() => ({
4321
- innerRef: C,
4322
- placeholder: ee,
4323
- droppableProps: {
4324
- "data-rfd-droppable-id": s,
4325
- "data-rfd-droppable-context-id": n
4326
- }
4327
- }), [
4328
- n,
4329
- s,
4330
- ee,
4331
- C
4332
- ]), ne = _ ? _.dragging.draggableId : null, re = j(() => ({
4333
- droppableId: s,
4334
- type: c,
4335
- isUsingCloneFor: ne
4336
- }), [
4337
- s,
4338
- ne,
4339
- c
4340
- ]);
4341
- function D() {
4342
- if (!_) return null;
4343
- let { dragging: e, render: t } = _, n = h.createElement(Ao, {
4344
- draggableId: e.draggableId,
4345
- index: e.source.index,
4346
- isClone: !0,
4347
- isEnabled: !0,
4348
- shouldRespectForcePress: !1,
4349
- canDragInteractiveElements: !0
4350
- }, (n, r) => t(n, r, e));
4351
- return x.createPortal(n, b());
4352
- }
4353
- return h.createElement(mo.Provider, { value: re }, o(te, m), D());
4354
- };
4355
- function fs() {
4356
- return !document.body && (process.env.NODE_ENV === "production" ? A() : A(!1, "document.body is not ready")), document.body;
4357
- }
4358
- var ps = {
4359
- mode: "standard",
4360
- type: "DEFAULT",
4361
- direction: "vertical",
4362
- isDropDisabled: !1,
4363
- isCombineEnabled: !1,
4364
- ignoreContainerClipping: !1,
4365
- renderClone: null,
4366
- getContainerForClone: fs
4367
- }, ms = (e) => {
4368
- let t = { ...e }, n;
4369
- for (n in ps) e[n] === void 0 && (t = {
4370
- ...t,
4371
- [n]: ps[n]
4372
- });
4373
- return t;
4374
- }, hs = (e, t) => e === t.droppable.type, gs = (e, t) => t.draggables[e.draggable.id], _s = a(() => {
4375
- let e = {
4376
- placeholder: null,
4377
- shouldAnimatePlaceholder: !0,
4378
- snapshot: {
4379
- isDraggingOver: !1,
4380
- draggingOverWith: null,
4381
- draggingFromThisWith: null,
4382
- isUsingPlaceholder: !1
4383
- },
4384
- useClone: null
4385
- }, t = {
4386
- ...e,
4387
- shouldAnimatePlaceholder: !1
4388
- }, n = B((e) => ({
4389
- draggableId: e.id,
4390
- type: e.type,
4391
- source: {
4392
- index: e.index,
4393
- droppableId: e.droppableId
4394
- }
4395
- })), r = B((r, i, a, o, s, c) => {
4396
- let l = s.descriptor.id;
4397
- if (s.descriptor.droppableId === r) {
4398
- let e = c ? {
4399
- render: c,
4400
- dragging: n(s.descriptor)
4401
- } : null, t = {
4402
- isDraggingOver: a,
4403
- draggingOverWith: a ? l : null,
4404
- draggingFromThisWith: l,
4405
- isUsingPlaceholder: !0
4406
- };
4407
- return {
4408
- placeholder: s.placeholder,
4409
- shouldAnimatePlaceholder: !1,
4410
- snapshot: t,
4411
- useClone: e
4412
- };
4413
- }
4414
- if (!i) return t;
4415
- if (!o) return e;
4416
- let u = {
4417
- isDraggingOver: a,
4418
- draggingOverWith: l,
4419
- draggingFromThisWith: null,
4420
- isUsingPlaceholder: !0
4421
- };
4422
- return {
4423
- placeholder: s.placeholder,
4424
- shouldAnimatePlaceholder: !0,
4425
- snapshot: u,
4426
- useClone: null
4427
- };
4428
- });
4429
- return (n, i) => {
4430
- let a = ms(i), o = a.droppableId, s = a.type, c = !a.isDropDisabled, l = a.renderClone;
4431
- if (ta(n)) {
4432
- let e = n.critical;
4433
- if (!hs(s, e)) return t;
4434
- let i = gs(e, n.dimensions), a = q(n.impact) === o;
4435
- return r(o, c, a, a, i, l);
4436
- }
4437
- if (n.phase === "DROP_ANIMATING") {
4438
- let e = n.completed;
4439
- if (!hs(s, e.critical)) return t;
4440
- let i = gs(e.critical, n.dimensions);
4441
- return r(o, c, So(e.result) === o, q(e.impact) === o, i, l);
4442
- }
4443
- if (n.phase === "IDLE" && n.completed && !n.shouldFlush) {
4444
- let r = n.completed;
4445
- if (!hs(s, r.critical)) return t;
4446
- let i = q(r.impact) === o, a = !!(r.impact.at && r.impact.at.type === "COMBINE"), c = r.critical.droppable.id === o;
4447
- return i ? a ? e : t : c ? e : t;
4448
- }
4449
- return t;
4450
- };
4451
- }, { updateViewportMaxScroll: Mn }, (e, t, n) => ({
4452
- ...ms(n),
4453
- ...e,
4454
- ...t
4455
- }), {
4456
- context: Ni,
4457
- areStatePropsEqual: xo
4458
- })(ds);
4459
- //#endregion
4460
- export { ro as DragDropContext, jo as Draggable, _s as Droppable, Ea as useKeyboardSensor, Sa as useMouseSensor, Ma as useTouchSensor };