@middag-io/react 0.4.2 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. package/dist-lib/ConditionTreeBlock-Brab4Yig.js +83 -0
  2. package/dist-lib/FlowEditorBlock-BKwzEVAe.js +7770 -0
  3. package/dist-lib/FormBuilderBlock-Dsg3PFQL.js +2735 -0
  4. package/dist-lib/{MarkdownContent-B-Gd9918.js → MarkdownContent-CEXn51dl.js} +33 -32
  5. package/dist-lib/SentenceBuilderBlock-C7pY8tTB.js +92 -0
  6. package/dist-lib/app/ContractPage.d.ts +6 -7
  7. package/dist-lib/app/ContractPage.d.ts.map +1 -1
  8. package/dist-lib/app/bootstrap.d.ts +1 -1
  9. package/dist-lib/app/register-defaults.d.ts +6 -1
  10. package/dist-lib/app/register-defaults.d.ts.map +1 -1
  11. package/dist-lib/app/registries.d.ts +1 -1
  12. package/dist-lib/assets/lottie/index.d.ts +1 -1
  13. package/dist-lib/base/blocks/ActionGridBlock.d.ts +2 -2
  14. package/dist-lib/base/blocks/ActivityTimelineBlock.d.ts +2 -2
  15. package/dist-lib/base/blocks/CardGridBlock.d.ts +2 -2
  16. package/dist-lib/base/blocks/ConditionTreeBlock.d.ts +2 -2
  17. package/dist-lib/base/blocks/DenseTableBlock.d.ts +2 -2
  18. package/dist-lib/base/blocks/DenseTableBlock.d.ts.map +1 -1
  19. package/dist-lib/base/blocks/DetailPanelBlock.d.ts +2 -2
  20. package/dist-lib/base/blocks/EmptyStateBlock.d.ts +2 -2
  21. package/dist-lib/base/blocks/FlowEditorBlock.d.ts +2 -2
  22. package/dist-lib/base/blocks/FormBuilderBlock.d.ts +2 -2
  23. package/dist-lib/base/blocks/FormPanelBlock.d.ts +2 -2
  24. package/dist-lib/base/blocks/LinkListBlock.d.ts +2 -2
  25. package/dist-lib/base/blocks/MarkdownPanelBlock.d.ts +2 -2
  26. package/dist-lib/base/blocks/MetricCardBlock.d.ts +2 -2
  27. package/dist-lib/base/blocks/SentenceBuilderBlock.d.ts +2 -2
  28. package/dist-lib/base/blocks/StatusStripBlock.d.ts +2 -2
  29. package/dist-lib/base/blocks/TabbedPanelBlock.d.ts +2 -2
  30. package/dist-lib/base/layout/DashboardLayout.d.ts +1 -1
  31. package/dist-lib/base/layout/MasterDetailLayout.d.ts +1 -1
  32. package/dist-lib/base/layout/SplitLayout.d.ts +1 -1
  33. package/dist-lib/base/layout/StackLayout.d.ts +1 -1
  34. package/dist-lib/base/layout/WizardLayout.d.ts +1 -1
  35. package/dist-lib/base/partials/DataTable/types.d.ts +3 -3
  36. package/dist-lib/base/shell/AdminShell.d.ts +1 -1
  37. package/dist-lib/base/shell/ProductShell.d.ts +1 -1
  38. package/dist-lib/base/shell/partials/HelpContext.d.ts +1 -1
  39. package/dist-lib/base/shell/partials/InspectorContext.d.ts +1 -1
  40. package/dist-lib/base/shell/partials/PageActionButton.d.ts +1 -1
  41. package/dist-lib/base/shell/partials/PageFilterTabs.d.ts +1 -1
  42. package/dist-lib/base/shell/partials/PageHeader.d.ts +1 -1
  43. package/dist-lib/base/theme/useHostTheme.d.ts +1 -1
  44. package/dist-lib/base/utils/conditions.d.ts +1 -1
  45. package/dist-lib/chunk-DeC0fbbY.js +22 -0
  46. package/dist-lib/components/reui/alert-dialog.d.ts +1 -1
  47. package/dist-lib/components/reui/sidebar.d.ts +4 -4
  48. package/dist-lib/contracts/block-data.d.ts +2 -2
  49. package/dist-lib/contracts/page-contract-schema.d.ts +72 -0
  50. package/dist-lib/contracts/page-contract-schema.d.ts.map +1 -0
  51. package/dist-lib/contracts/page-contract.d.ts +3 -3
  52. package/dist-lib/contracts/page-contract.d.ts.map +1 -1
  53. package/dist-lib/contracts/shared-props.d.ts +2 -1
  54. package/dist-lib/contracts/shared-props.d.ts.map +1 -1
  55. package/dist-lib/hooks/use-copy-to-clipboard.d.ts +1 -1
  56. package/dist-lib/hooks/use-file-upload.d.ts +1 -1
  57. package/dist-lib/index.d.ts +13 -11
  58. package/dist-lib/index.d.ts.map +1 -1
  59. package/dist-lib/{index.min-CS28Xi5j.js → index.min-BVLV21vp.js} +483 -504
  60. package/dist-lib/middag-react.css +1 -1
  61. package/dist-lib/middag-react.js +16591 -24295
  62. package/package.json +1 -1
@@ -0,0 +1,2735 @@
1
+ import e, { cloneElement as t, createContext as n, forwardRef as r, memo as i, useCallback as a, useContext as o, useEffect as s, useLayoutEffect as c, useMemo as l, useReducer as u, useRef as d, useState as f } from "react";
2
+ import { jsx as p, jsxs as m } from "react/jsx-runtime";
3
+ import { createPortal as h, unstable_batchedUpdates as g } from "react-dom";
4
+ //#region node_modules/@dnd-kit/utilities/dist/utilities.esm.js
5
+ function _() {
6
+ var e = [...arguments];
7
+ return l(() => (t) => {
8
+ e.forEach((e) => e(t));
9
+ }, e);
10
+ }
11
+ var v = typeof window < "u" && window.document !== void 0 && window.document.createElement !== void 0;
12
+ function y(e) {
13
+ let t = Object.prototype.toString.call(e);
14
+ return t === "[object Window]" || t === "[object global]";
15
+ }
16
+ function b(e) {
17
+ return "nodeType" in e;
18
+ }
19
+ function x(e) {
20
+ return e ? y(e) ? e : b(e) ? e.ownerDocument?.defaultView ?? window : window : window;
21
+ }
22
+ function S(e) {
23
+ let { Document: t } = x(e);
24
+ return e instanceof t;
25
+ }
26
+ function C(e) {
27
+ return y(e) ? !1 : e instanceof x(e).HTMLElement;
28
+ }
29
+ function w(e) {
30
+ return e instanceof x(e).SVGElement;
31
+ }
32
+ function T(e) {
33
+ return e ? y(e) ? e.document : b(e) ? S(e) ? e : C(e) || w(e) ? e.ownerDocument : document : document : document;
34
+ }
35
+ var E = v ? c : s;
36
+ function D(e) {
37
+ let t = d(e);
38
+ return E(() => {
39
+ t.current = e;
40
+ }), a(function() {
41
+ var e = [...arguments];
42
+ return t.current == null ? void 0 : t.current(...e);
43
+ }, []);
44
+ }
45
+ function O() {
46
+ let e = d(null);
47
+ return [a((t, n) => {
48
+ e.current = setInterval(t, n);
49
+ }, []), a(() => {
50
+ e.current !== null && (clearInterval(e.current), e.current = null);
51
+ }, [])];
52
+ }
53
+ function k(e, t) {
54
+ t === void 0 && (t = [e]);
55
+ let n = d(e);
56
+ return E(() => {
57
+ n.current !== e && (n.current = e);
58
+ }, t), n;
59
+ }
60
+ function A(e, t) {
61
+ let n = d();
62
+ return l(() => {
63
+ let t = e(n.current);
64
+ return n.current = t, t;
65
+ }, [...t]);
66
+ }
67
+ function j(e) {
68
+ let t = D(e), n = d(null);
69
+ return [n, a((e) => {
70
+ e !== n.current && t?.(e, n.current), n.current = e;
71
+ }, [])];
72
+ }
73
+ function M(e) {
74
+ let t = d();
75
+ return s(() => {
76
+ t.current = e;
77
+ }, [e]), t.current;
78
+ }
79
+ var ee = {};
80
+ function te(e, t) {
81
+ return l(() => {
82
+ if (t) return t;
83
+ let n = ee[e] == null ? 0 : ee[e] + 1;
84
+ return ee[e] = n, e + "-" + n;
85
+ }, [e, t]);
86
+ }
87
+ function N(e) {
88
+ return function(t) {
89
+ return [...arguments].slice(1).reduce((t, n) => {
90
+ let r = Object.entries(n);
91
+ for (let [n, i] of r) {
92
+ let r = t[n];
93
+ r != null && (t[n] = r + e * i);
94
+ }
95
+ return t;
96
+ }, { ...t });
97
+ };
98
+ }
99
+ var ne = /* @__PURE__ */ N(1), P = /* @__PURE__ */ N(-1);
100
+ function re(e) {
101
+ return "clientX" in e && "clientY" in e;
102
+ }
103
+ function ie(e) {
104
+ if (!e) return !1;
105
+ let { KeyboardEvent: t } = x(e.target);
106
+ return t && e instanceof t;
107
+ }
108
+ function F(e) {
109
+ if (!e) return !1;
110
+ let { TouchEvent: t } = x(e.target);
111
+ return t && e instanceof t;
112
+ }
113
+ function ae(e) {
114
+ if (F(e)) {
115
+ if (e.touches && e.touches.length) {
116
+ let { clientX: t, clientY: n } = e.touches[0];
117
+ return {
118
+ x: t,
119
+ y: n
120
+ };
121
+ } else if (e.changedTouches && e.changedTouches.length) {
122
+ let { clientX: t, clientY: n } = e.changedTouches[0];
123
+ return {
124
+ x: t,
125
+ y: n
126
+ };
127
+ }
128
+ }
129
+ return re(e) ? {
130
+ x: e.clientX,
131
+ y: e.clientY
132
+ } : null;
133
+ }
134
+ var I = /* @__PURE__ */ Object.freeze({
135
+ Translate: { toString(e) {
136
+ if (!e) return;
137
+ let { x: t, y: n } = e;
138
+ return "translate3d(" + (t ? Math.round(t) : 0) + "px, " + (n ? Math.round(n) : 0) + "px, 0)";
139
+ } },
140
+ Scale: { toString(e) {
141
+ if (!e) return;
142
+ let { scaleX: t, scaleY: n } = e;
143
+ return "scaleX(" + t + ") scaleY(" + n + ")";
144
+ } },
145
+ Transform: { toString(e) {
146
+ if (e) return [I.Translate.toString(e), I.Scale.toString(e)].join(" ");
147
+ } },
148
+ Transition: { toString(e) {
149
+ let { property: t, duration: n, easing: r } = e;
150
+ return t + " " + n + "ms " + r;
151
+ } }
152
+ }), L = "a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";
153
+ function oe(e) {
154
+ return e.matches(L) ? e : e.querySelector(L);
155
+ }
156
+ //#endregion
157
+ //#region node_modules/@dnd-kit/accessibility/dist/accessibility.esm.js
158
+ var R = { display: "none" };
159
+ function z(t) {
160
+ let { id: n, value: r } = t;
161
+ return e.createElement("div", {
162
+ id: n,
163
+ style: R
164
+ }, r);
165
+ }
166
+ function B(t) {
167
+ let { id: n, announcement: r, ariaLiveType: i = "assertive" } = t;
168
+ return e.createElement("div", {
169
+ id: n,
170
+ style: {
171
+ position: "fixed",
172
+ top: 0,
173
+ left: 0,
174
+ width: 1,
175
+ height: 1,
176
+ margin: -1,
177
+ border: 0,
178
+ padding: 0,
179
+ overflow: "hidden",
180
+ clip: "rect(0 0 0 0)",
181
+ clipPath: "inset(100%)",
182
+ whiteSpace: "nowrap"
183
+ },
184
+ role: "status",
185
+ "aria-live": i,
186
+ "aria-atomic": !0
187
+ }, r);
188
+ }
189
+ function se() {
190
+ let [e, t] = f("");
191
+ return {
192
+ announce: a((e) => {
193
+ e != null && t(e);
194
+ }, []),
195
+ announcement: e
196
+ };
197
+ }
198
+ //#endregion
199
+ //#region node_modules/@dnd-kit/core/dist/core.esm.js
200
+ var ce = /* @__PURE__ */ n(null);
201
+ function V(e) {
202
+ let t = o(ce);
203
+ s(() => {
204
+ if (!t) throw Error("useDndMonitor must be used within a children of <DndContext>");
205
+ return t(e);
206
+ }, [e, t]);
207
+ }
208
+ function H() {
209
+ let [e] = f(() => /* @__PURE__ */ new Set()), t = a((t) => (e.add(t), () => e.delete(t)), [e]);
210
+ return [a((t) => {
211
+ let { type: n, event: r } = t;
212
+ e.forEach((e) => e[n]?.call(e, r));
213
+ }, [e]), t];
214
+ }
215
+ var U = { draggable: "\n To pick up a draggable item, press the space bar.\n While dragging, use the arrow keys to move the item.\n Press space again to drop the item in its new position, or press escape to cancel.\n " }, le = {
216
+ onDragStart(e) {
217
+ let { active: t } = e;
218
+ return "Picked up draggable item " + t.id + ".";
219
+ },
220
+ onDragOver(e) {
221
+ let { active: t, over: n } = e;
222
+ return n ? "Draggable item " + t.id + " was moved over droppable area " + n.id + "." : "Draggable item " + t.id + " is no longer over a droppable area.";
223
+ },
224
+ onDragEnd(e) {
225
+ let { active: t, over: n } = e;
226
+ return n ? "Draggable item " + t.id + " was dropped over droppable area " + n.id : "Draggable item " + t.id + " was dropped.";
227
+ },
228
+ onDragCancel(e) {
229
+ let { active: t } = e;
230
+ return "Dragging was cancelled. Draggable item " + t.id + " was dropped.";
231
+ }
232
+ };
233
+ function ue(t) {
234
+ let { announcements: n = le, container: r, hiddenTextDescribedById: i, screenReaderInstructions: a = U } = t, { announce: o, announcement: c } = se(), u = te("DndLiveRegion"), [d, p] = f(!1);
235
+ if (s(() => {
236
+ p(!0);
237
+ }, []), V(l(() => ({
238
+ onDragStart(e) {
239
+ let { active: t } = e;
240
+ o(n.onDragStart({ active: t }));
241
+ },
242
+ onDragMove(e) {
243
+ let { active: t, over: r } = e;
244
+ n.onDragMove && o(n.onDragMove({
245
+ active: t,
246
+ over: r
247
+ }));
248
+ },
249
+ onDragOver(e) {
250
+ let { active: t, over: r } = e;
251
+ o(n.onDragOver({
252
+ active: t,
253
+ over: r
254
+ }));
255
+ },
256
+ onDragEnd(e) {
257
+ let { active: t, over: r } = e;
258
+ o(n.onDragEnd({
259
+ active: t,
260
+ over: r
261
+ }));
262
+ },
263
+ onDragCancel(e) {
264
+ let { active: t, over: r } = e;
265
+ o(n.onDragCancel({
266
+ active: t,
267
+ over: r
268
+ }));
269
+ }
270
+ }), [o, n])), !d) return null;
271
+ let m = e.createElement(e.Fragment, null, e.createElement(z, {
272
+ id: i,
273
+ value: a.draggable
274
+ }), e.createElement(B, {
275
+ id: u,
276
+ announcement: c
277
+ }));
278
+ return r ? h(m, r) : m;
279
+ }
280
+ var W;
281
+ (function(e) {
282
+ e.DragStart = "dragStart", e.DragMove = "dragMove", e.DragEnd = "dragEnd", e.DragCancel = "dragCancel", e.DragOver = "dragOver", e.RegisterDroppable = "registerDroppable", e.SetDroppableDisabled = "setDroppableDisabled", e.UnregisterDroppable = "unregisterDroppable";
283
+ })(W ||= {});
284
+ function de() {}
285
+ function fe(e, t) {
286
+ return l(() => ({
287
+ sensor: e,
288
+ options: t ?? {}
289
+ }), [e, t]);
290
+ }
291
+ function G() {
292
+ var e = [...arguments];
293
+ return l(() => [...e].filter((e) => e != null), [...e]);
294
+ }
295
+ var K = /* @__PURE__ */ Object.freeze({
296
+ x: 0,
297
+ y: 0
298
+ });
299
+ function q(e, t) {
300
+ return Math.sqrt((e.x - t.x) ** 2 + (e.y - t.y) ** 2);
301
+ }
302
+ function pe(e, t) {
303
+ let n = ae(e);
304
+ if (!n) return "0 0";
305
+ let r = {
306
+ x: (n.x - t.left) / t.width * 100,
307
+ y: (n.y - t.top) / t.height * 100
308
+ };
309
+ return r.x + "% " + r.y + "%";
310
+ }
311
+ function J(e, t) {
312
+ let { data: { value: n } } = e, { data: { value: r } } = t;
313
+ return n - r;
314
+ }
315
+ function me(e, t) {
316
+ let { data: { value: n } } = e, { data: { value: r } } = t;
317
+ return r - n;
318
+ }
319
+ function he(e) {
320
+ let { left: t, top: n, height: r, width: i } = e;
321
+ return [
322
+ {
323
+ x: t,
324
+ y: n
325
+ },
326
+ {
327
+ x: t + i,
328
+ y: n
329
+ },
330
+ {
331
+ x: t,
332
+ y: n + r
333
+ },
334
+ {
335
+ x: t + i,
336
+ y: n + r
337
+ }
338
+ ];
339
+ }
340
+ function ge(e, t) {
341
+ if (!e || e.length === 0) return null;
342
+ let [n] = e;
343
+ return t ? n[t] : n;
344
+ }
345
+ function _e(e, t, n) {
346
+ return t === void 0 && (t = e.left), n === void 0 && (n = e.top), {
347
+ x: t + e.width * .5,
348
+ y: n + e.height * .5
349
+ };
350
+ }
351
+ var ve = (e) => {
352
+ let { collisionRect: t, droppableRects: n, droppableContainers: r } = e, i = _e(t, t.left, t.top), a = [];
353
+ for (let e of r) {
354
+ let { id: t } = e, r = n.get(t);
355
+ if (r) {
356
+ let n = q(_e(r), i);
357
+ a.push({
358
+ id: t,
359
+ data: {
360
+ droppableContainer: e,
361
+ value: n
362
+ }
363
+ });
364
+ }
365
+ }
366
+ return a.sort(J);
367
+ }, ye = (e) => {
368
+ let { collisionRect: t, droppableRects: n, droppableContainers: r } = e, i = he(t), a = [];
369
+ for (let e of r) {
370
+ let { id: t } = e, r = n.get(t);
371
+ if (r) {
372
+ let n = he(r), o = i.reduce((e, t, r) => e + q(n[r], t), 0), s = Number((o / 4).toFixed(4));
373
+ a.push({
374
+ id: t,
375
+ data: {
376
+ droppableContainer: e,
377
+ value: s
378
+ }
379
+ });
380
+ }
381
+ }
382
+ return a.sort(J);
383
+ };
384
+ function Y(e, t) {
385
+ let n = Math.max(t.top, e.top), r = Math.max(t.left, e.left), i = Math.min(t.left + t.width, e.left + e.width), a = Math.min(t.top + t.height, e.top + e.height), o = i - r, s = a - n;
386
+ if (r < i && n < a) {
387
+ let n = t.width * t.height, r = e.width * e.height, i = o * s, a = i / (n + r - i);
388
+ return Number(a.toFixed(4));
389
+ }
390
+ return 0;
391
+ }
392
+ var be = (e) => {
393
+ let { collisionRect: t, droppableRects: n, droppableContainers: r } = e, i = [];
394
+ for (let e of r) {
395
+ let { id: r } = e, a = n.get(r);
396
+ if (a) {
397
+ let n = Y(a, t);
398
+ n > 0 && i.push({
399
+ id: r,
400
+ data: {
401
+ droppableContainer: e,
402
+ value: n
403
+ }
404
+ });
405
+ }
406
+ }
407
+ return i.sort(me);
408
+ };
409
+ function xe(e, t, n) {
410
+ return {
411
+ ...e,
412
+ scaleX: t && n ? t.width / n.width : 1,
413
+ scaleY: t && n ? t.height / n.height : 1
414
+ };
415
+ }
416
+ function Se(e, t) {
417
+ return e && t ? {
418
+ x: e.left - t.left,
419
+ y: e.top - t.top
420
+ } : K;
421
+ }
422
+ function Ce(e) {
423
+ return function(t) {
424
+ return [...arguments].slice(1).reduce((t, n) => ({
425
+ ...t,
426
+ top: t.top + e * n.y,
427
+ bottom: t.bottom + e * n.y,
428
+ left: t.left + e * n.x,
429
+ right: t.right + e * n.x
430
+ }), { ...t });
431
+ };
432
+ }
433
+ var we = /* @__PURE__ */ Ce(1);
434
+ function Te(e) {
435
+ if (e.startsWith("matrix3d(")) {
436
+ let t = e.slice(9, -1).split(/, /);
437
+ return {
438
+ x: +t[12],
439
+ y: +t[13],
440
+ scaleX: +t[0],
441
+ scaleY: +t[5]
442
+ };
443
+ } else if (e.startsWith("matrix(")) {
444
+ let t = e.slice(7, -1).split(/, /);
445
+ return {
446
+ x: +t[4],
447
+ y: +t[5],
448
+ scaleX: +t[0],
449
+ scaleY: +t[3]
450
+ };
451
+ }
452
+ return null;
453
+ }
454
+ function Ee(e, t, n) {
455
+ let r = Te(t);
456
+ if (!r) return e;
457
+ let { scaleX: i, scaleY: a, x: o, y: s } = r, c = e.left - o - (1 - i) * parseFloat(n), l = e.top - s - (1 - a) * parseFloat(n.slice(n.indexOf(" ") + 1)), u = i ? e.width / i : e.width, d = a ? e.height / a : e.height;
458
+ return {
459
+ width: u,
460
+ height: d,
461
+ top: l,
462
+ right: c + u,
463
+ bottom: l + d,
464
+ left: c
465
+ };
466
+ }
467
+ var De = { ignoreTransform: !1 };
468
+ function Oe(e, t) {
469
+ t === void 0 && (t = De);
470
+ let n = e.getBoundingClientRect();
471
+ if (t.ignoreTransform) {
472
+ let { transform: t, transformOrigin: r } = x(e).getComputedStyle(e);
473
+ t && (n = Ee(n, t, r));
474
+ }
475
+ let { top: r, left: i, width: a, height: o, bottom: s, right: c } = n;
476
+ return {
477
+ top: r,
478
+ left: i,
479
+ width: a,
480
+ height: o,
481
+ bottom: s,
482
+ right: c
483
+ };
484
+ }
485
+ function ke(e) {
486
+ return Oe(e, { ignoreTransform: !0 });
487
+ }
488
+ function Ae(e) {
489
+ let t = e.innerWidth, n = e.innerHeight;
490
+ return {
491
+ top: 0,
492
+ left: 0,
493
+ right: t,
494
+ bottom: n,
495
+ width: t,
496
+ height: n
497
+ };
498
+ }
499
+ function je(e, t) {
500
+ return t === void 0 && (t = x(e).getComputedStyle(e)), t.position === "fixed";
501
+ }
502
+ function Me(e, t) {
503
+ t === void 0 && (t = x(e).getComputedStyle(e));
504
+ let n = /(auto|scroll|overlay)/;
505
+ return [
506
+ "overflow",
507
+ "overflowX",
508
+ "overflowY"
509
+ ].some((e) => {
510
+ let r = t[e];
511
+ return typeof r == "string" ? n.test(r) : !1;
512
+ });
513
+ }
514
+ function X(e, t) {
515
+ let n = [];
516
+ function r(i) {
517
+ if (t != null && n.length >= t || !i) return n;
518
+ if (S(i) && i.scrollingElement != null && !n.includes(i.scrollingElement)) return n.push(i.scrollingElement), n;
519
+ if (!C(i) || w(i) || n.includes(i)) return n;
520
+ let a = x(e).getComputedStyle(i);
521
+ return i !== e && Me(i, a) && n.push(i), je(i, a) ? n : r(i.parentNode);
522
+ }
523
+ return e ? r(e) : n;
524
+ }
525
+ function Ne(e) {
526
+ let [t] = X(e, 1);
527
+ return t ?? null;
528
+ }
529
+ function Pe(e) {
530
+ return !v || !e ? null : y(e) ? e : b(e) ? S(e) || e === T(e).scrollingElement ? window : C(e) ? e : null : null;
531
+ }
532
+ function Fe(e) {
533
+ return y(e) ? e.scrollX : e.scrollLeft;
534
+ }
535
+ function Ie(e) {
536
+ return y(e) ? e.scrollY : e.scrollTop;
537
+ }
538
+ function Le(e) {
539
+ return {
540
+ x: Fe(e),
541
+ y: Ie(e)
542
+ };
543
+ }
544
+ var Z;
545
+ (function(e) {
546
+ e[e.Forward = 1] = "Forward", e[e.Backward = -1] = "Backward";
547
+ })(Z ||= {});
548
+ function Re(e) {
549
+ return !v || !e ? !1 : e === document.scrollingElement;
550
+ }
551
+ function ze(e) {
552
+ let t = {
553
+ x: 0,
554
+ y: 0
555
+ }, n = Re(e) ? {
556
+ height: window.innerHeight,
557
+ width: window.innerWidth
558
+ } : {
559
+ height: e.clientHeight,
560
+ width: e.clientWidth
561
+ }, r = {
562
+ x: e.scrollWidth - n.width,
563
+ y: e.scrollHeight - n.height
564
+ };
565
+ return {
566
+ isTop: e.scrollTop <= t.y,
567
+ isLeft: e.scrollLeft <= t.x,
568
+ isBottom: e.scrollTop >= r.y,
569
+ isRight: e.scrollLeft >= r.x,
570
+ maxScroll: r,
571
+ minScroll: t
572
+ };
573
+ }
574
+ var Be = {
575
+ x: .2,
576
+ y: .2
577
+ };
578
+ function Ve(e, t, n, r, i) {
579
+ let { top: a, left: o, right: s, bottom: c } = n;
580
+ r === void 0 && (r = 10), i === void 0 && (i = Be);
581
+ let { isTop: l, isBottom: u, isLeft: d, isRight: f } = ze(e), p = {
582
+ x: 0,
583
+ y: 0
584
+ }, m = {
585
+ x: 0,
586
+ y: 0
587
+ }, h = {
588
+ height: t.height * i.y,
589
+ width: t.width * i.x
590
+ };
591
+ return !l && a <= t.top + h.height ? (p.y = Z.Backward, m.y = r * Math.abs((t.top + h.height - a) / h.height)) : !u && c >= t.bottom - h.height && (p.y = Z.Forward, m.y = r * Math.abs((t.bottom - h.height - c) / h.height)), !f && s >= t.right - h.width ? (p.x = Z.Forward, m.x = r * Math.abs((t.right - h.width - s) / h.width)) : !d && o <= t.left + h.width && (p.x = Z.Backward, m.x = r * Math.abs((t.left + h.width - o) / h.width)), {
592
+ direction: p,
593
+ speed: m
594
+ };
595
+ }
596
+ function He(e) {
597
+ if (e === document.scrollingElement) {
598
+ let { innerWidth: e, innerHeight: t } = window;
599
+ return {
600
+ top: 0,
601
+ left: 0,
602
+ right: e,
603
+ bottom: t,
604
+ width: e,
605
+ height: t
606
+ };
607
+ }
608
+ let { top: t, left: n, right: r, bottom: i } = e.getBoundingClientRect();
609
+ return {
610
+ top: t,
611
+ left: n,
612
+ right: r,
613
+ bottom: i,
614
+ width: e.clientWidth,
615
+ height: e.clientHeight
616
+ };
617
+ }
618
+ function Ue(e) {
619
+ return e.reduce((e, t) => ne(e, Le(t)), K);
620
+ }
621
+ function We(e) {
622
+ return e.reduce((e, t) => e + Fe(t), 0);
623
+ }
624
+ function Ge(e) {
625
+ return e.reduce((e, t) => e + Ie(t), 0);
626
+ }
627
+ function Ke(e, t) {
628
+ if (t === void 0 && (t = Oe), !e) return;
629
+ let { top: n, left: r, bottom: i, right: a } = t(e);
630
+ Ne(e) && (i <= 0 || a <= 0 || n >= window.innerHeight || r >= window.innerWidth) && e.scrollIntoView({
631
+ block: "center",
632
+ inline: "center"
633
+ });
634
+ }
635
+ var qe = [[
636
+ "x",
637
+ ["left", "right"],
638
+ We
639
+ ], [
640
+ "y",
641
+ ["top", "bottom"],
642
+ Ge
643
+ ]], Je = class {
644
+ constructor(e, t) {
645
+ this.rect = void 0, this.width = void 0, this.height = void 0, this.top = void 0, this.bottom = void 0, this.right = void 0, this.left = void 0;
646
+ let n = X(t), r = Ue(n);
647
+ this.rect = { ...e }, this.width = e.width, this.height = e.height;
648
+ for (let [e, t, i] of qe) for (let a of t) Object.defineProperty(this, a, {
649
+ get: () => {
650
+ let t = i(n), o = r[e] - t;
651
+ return this.rect[a] + o;
652
+ },
653
+ enumerable: !0
654
+ });
655
+ Object.defineProperty(this, "rect", { enumerable: !1 });
656
+ }
657
+ }, Ye = class {
658
+ constructor(e) {
659
+ this.target = void 0, this.listeners = [], this.removeAll = () => {
660
+ this.listeners.forEach((e) => this.target?.removeEventListener(...e));
661
+ }, this.target = e;
662
+ }
663
+ add(e, t, n) {
664
+ var r;
665
+ (r = this.target) == null || r.addEventListener(e, t, n), this.listeners.push([
666
+ e,
667
+ t,
668
+ n
669
+ ]);
670
+ }
671
+ };
672
+ function Xe(e) {
673
+ let { EventTarget: t } = x(e);
674
+ return e instanceof t ? e : T(e);
675
+ }
676
+ function Ze(e, t) {
677
+ let n = Math.abs(e.x), r = Math.abs(e.y);
678
+ return typeof t == "number" ? Math.sqrt(n ** 2 + r ** 2) > t : "x" in t && "y" in t ? n > t.x && r > t.y : "x" in t ? n > t.x : "y" in t ? r > t.y : !1;
679
+ }
680
+ var Q;
681
+ (function(e) {
682
+ e.Click = "click", e.DragStart = "dragstart", e.Keydown = "keydown", e.ContextMenu = "contextmenu", e.Resize = "resize", e.SelectionChange = "selectionchange", e.VisibilityChange = "visibilitychange";
683
+ })(Q ||= {});
684
+ function Qe(e) {
685
+ e.preventDefault();
686
+ }
687
+ function $e(e) {
688
+ e.stopPropagation();
689
+ }
690
+ var $;
691
+ (function(e) {
692
+ e.Space = "Space", e.Down = "ArrowDown", e.Right = "ArrowRight", e.Left = "ArrowLeft", e.Up = "ArrowUp", e.Esc = "Escape", e.Enter = "Enter", e.Tab = "Tab";
693
+ })($ ||= {});
694
+ var et = {
695
+ start: [$.Space, $.Enter],
696
+ cancel: [$.Esc],
697
+ end: [
698
+ $.Space,
699
+ $.Enter,
700
+ $.Tab
701
+ ]
702
+ }, tt = (e, t) => {
703
+ let { currentCoordinates: n } = t;
704
+ switch (e.code) {
705
+ case $.Right: return {
706
+ ...n,
707
+ x: n.x + 25
708
+ };
709
+ case $.Left: return {
710
+ ...n,
711
+ x: n.x - 25
712
+ };
713
+ case $.Down: return {
714
+ ...n,
715
+ y: n.y + 25
716
+ };
717
+ case $.Up: return {
718
+ ...n,
719
+ y: n.y - 25
720
+ };
721
+ }
722
+ }, nt = class {
723
+ constructor(e) {
724
+ this.props = void 0, this.autoScrollEnabled = !1, this.referenceCoordinates = void 0, this.listeners = void 0, this.windowListeners = void 0, this.props = e;
725
+ let { event: { target: t } } = e;
726
+ this.props = e, this.listeners = new Ye(T(t)), this.windowListeners = new Ye(x(t)), this.handleKeyDown = this.handleKeyDown.bind(this), this.handleCancel = this.handleCancel.bind(this), this.attach();
727
+ }
728
+ attach() {
729
+ this.handleStart(), this.windowListeners.add(Q.Resize, this.handleCancel), this.windowListeners.add(Q.VisibilityChange, this.handleCancel), setTimeout(() => this.listeners.add(Q.Keydown, this.handleKeyDown));
730
+ }
731
+ handleStart() {
732
+ let { activeNode: e, onStart: t } = this.props, n = e.node.current;
733
+ n && Ke(n), t(K);
734
+ }
735
+ handleKeyDown(e) {
736
+ if (ie(e)) {
737
+ let { active: t, context: n, options: r } = this.props, { keyboardCodes: i = et, coordinateGetter: a = tt, scrollBehavior: o = "smooth" } = r, { code: s } = e;
738
+ if (i.end.includes(s)) {
739
+ this.handleEnd(e);
740
+ return;
741
+ }
742
+ if (i.cancel.includes(s)) {
743
+ this.handleCancel(e);
744
+ return;
745
+ }
746
+ let { collisionRect: c } = n.current, l = c ? {
747
+ x: c.left,
748
+ y: c.top
749
+ } : K;
750
+ this.referenceCoordinates ||= l;
751
+ let u = a(e, {
752
+ active: t,
753
+ context: n.current,
754
+ currentCoordinates: l
755
+ });
756
+ if (u) {
757
+ let t = P(u, l), r = {
758
+ x: 0,
759
+ y: 0
760
+ }, { scrollableAncestors: i } = n.current;
761
+ for (let n of i) {
762
+ let i = e.code, { isTop: a, isRight: s, isLeft: c, isBottom: l, maxScroll: d, minScroll: f } = ze(n), p = He(n), m = {
763
+ x: Math.min(i === $.Right ? p.right - p.width / 2 : p.right, Math.max(i === $.Right ? p.left : p.left + p.width / 2, u.x)),
764
+ y: Math.min(i === $.Down ? p.bottom - p.height / 2 : p.bottom, Math.max(i === $.Down ? p.top : p.top + p.height / 2, u.y))
765
+ }, h = i === $.Right && !s || i === $.Left && !c, g = i === $.Down && !l || i === $.Up && !a;
766
+ if (h && m.x !== u.x) {
767
+ let e = n.scrollLeft + t.x, a = i === $.Right && e <= d.x || i === $.Left && e >= f.x;
768
+ if (a && !t.y) {
769
+ n.scrollTo({
770
+ left: e,
771
+ behavior: o
772
+ });
773
+ return;
774
+ }
775
+ a ? r.x = n.scrollLeft - e : r.x = i === $.Right ? n.scrollLeft - d.x : n.scrollLeft - f.x, r.x && n.scrollBy({
776
+ left: -r.x,
777
+ behavior: o
778
+ });
779
+ break;
780
+ } else if (g && m.y !== u.y) {
781
+ let e = n.scrollTop + t.y, a = i === $.Down && e <= d.y || i === $.Up && e >= f.y;
782
+ if (a && !t.x) {
783
+ n.scrollTo({
784
+ top: e,
785
+ behavior: o
786
+ });
787
+ return;
788
+ }
789
+ a ? r.y = n.scrollTop - e : r.y = i === $.Down ? n.scrollTop - d.y : n.scrollTop - f.y, r.y && n.scrollBy({
790
+ top: -r.y,
791
+ behavior: o
792
+ });
793
+ break;
794
+ }
795
+ }
796
+ this.handleMove(e, ne(P(u, this.referenceCoordinates), r));
797
+ }
798
+ }
799
+ }
800
+ handleMove(e, t) {
801
+ let { onMove: n } = this.props;
802
+ e.preventDefault(), n(t);
803
+ }
804
+ handleEnd(e) {
805
+ let { onEnd: t } = this.props;
806
+ e.preventDefault(), this.detach(), t();
807
+ }
808
+ handleCancel(e) {
809
+ let { onCancel: t } = this.props;
810
+ e.preventDefault(), this.detach(), t();
811
+ }
812
+ detach() {
813
+ this.listeners.removeAll(), this.windowListeners.removeAll();
814
+ }
815
+ };
816
+ nt.activators = [{
817
+ eventName: "onKeyDown",
818
+ handler: (e, t, n) => {
819
+ let { keyboardCodes: r = et, onActivation: i } = t, { active: a } = n, { code: o } = e.nativeEvent;
820
+ if (r.start.includes(o)) {
821
+ let t = a.activatorNode.current;
822
+ return t && e.target !== t ? !1 : (e.preventDefault(), i?.({ event: e.nativeEvent }), !0);
823
+ }
824
+ return !1;
825
+ }
826
+ }];
827
+ function rt(e) {
828
+ return !!(e && "distance" in e);
829
+ }
830
+ function it(e) {
831
+ return !!(e && "delay" in e);
832
+ }
833
+ var at = class {
834
+ constructor(e, t, n) {
835
+ n === void 0 && (n = Xe(e.event.target)), this.props = void 0, this.events = void 0, this.autoScrollEnabled = !0, this.document = void 0, this.activated = !1, this.initialCoordinates = void 0, this.timeoutId = null, this.listeners = void 0, this.documentListeners = void 0, this.windowListeners = void 0, this.props = e, this.events = t;
836
+ let { event: r } = e, { target: i } = r;
837
+ this.props = e, this.events = t, this.document = T(i), this.documentListeners = new Ye(this.document), this.listeners = new Ye(n), this.windowListeners = new Ye(x(i)), this.initialCoordinates = ae(r) ?? K, this.handleStart = this.handleStart.bind(this), this.handleMove = this.handleMove.bind(this), this.handleEnd = this.handleEnd.bind(this), this.handleCancel = this.handleCancel.bind(this), this.handleKeydown = this.handleKeydown.bind(this), this.removeTextSelection = this.removeTextSelection.bind(this), this.attach();
838
+ }
839
+ attach() {
840
+ let { events: e, props: { options: { activationConstraint: t, bypassActivationConstraint: n } } } = this;
841
+ if (this.listeners.add(e.move.name, this.handleMove, { passive: !1 }), this.listeners.add(e.end.name, this.handleEnd), e.cancel && this.listeners.add(e.cancel.name, this.handleCancel), this.windowListeners.add(Q.Resize, this.handleCancel), this.windowListeners.add(Q.DragStart, Qe), this.windowListeners.add(Q.VisibilityChange, this.handleCancel), this.windowListeners.add(Q.ContextMenu, Qe), this.documentListeners.add(Q.Keydown, this.handleKeydown), t) {
842
+ if (n != null && n({
843
+ event: this.props.event,
844
+ activeNode: this.props.activeNode,
845
+ options: this.props.options
846
+ })) return this.handleStart();
847
+ if (it(t)) {
848
+ this.timeoutId = setTimeout(this.handleStart, t.delay), this.handlePending(t);
849
+ return;
850
+ }
851
+ if (rt(t)) {
852
+ this.handlePending(t);
853
+ return;
854
+ }
855
+ }
856
+ this.handleStart();
857
+ }
858
+ detach() {
859
+ this.listeners.removeAll(), this.windowListeners.removeAll(), setTimeout(this.documentListeners.removeAll, 50), this.timeoutId !== null && (clearTimeout(this.timeoutId), this.timeoutId = null);
860
+ }
861
+ handlePending(e, t) {
862
+ let { active: n, onPending: r } = this.props;
863
+ r(n, e, this.initialCoordinates, t);
864
+ }
865
+ handleStart() {
866
+ let { initialCoordinates: e } = this, { onStart: t } = this.props;
867
+ e && (this.activated = !0, this.documentListeners.add(Q.Click, $e, { capture: !0 }), this.removeTextSelection(), this.documentListeners.add(Q.SelectionChange, this.removeTextSelection), t(e));
868
+ }
869
+ handleMove(e) {
870
+ let { activated: t, initialCoordinates: n, props: r } = this, { onMove: i, options: { activationConstraint: a } } = r;
871
+ if (!n) return;
872
+ let o = ae(e) ?? K, s = P(n, o);
873
+ if (!t && a) {
874
+ if (rt(a)) {
875
+ if (a.tolerance != null && Ze(s, a.tolerance)) return this.handleCancel();
876
+ if (Ze(s, a.distance)) return this.handleStart();
877
+ }
878
+ if (it(a) && Ze(s, a.tolerance)) return this.handleCancel();
879
+ this.handlePending(a, s);
880
+ return;
881
+ }
882
+ e.cancelable && e.preventDefault(), i(o);
883
+ }
884
+ handleEnd() {
885
+ let { onAbort: e, onEnd: t } = this.props;
886
+ this.detach(), this.activated || e(this.props.active), t();
887
+ }
888
+ handleCancel() {
889
+ let { onAbort: e, onCancel: t } = this.props;
890
+ this.detach(), this.activated || e(this.props.active), t();
891
+ }
892
+ handleKeydown(e) {
893
+ e.code === $.Esc && this.handleCancel();
894
+ }
895
+ removeTextSelection() {
896
+ var e;
897
+ (e = this.document.getSelection()) == null || e.removeAllRanges();
898
+ }
899
+ }, ot = {
900
+ cancel: { name: "pointercancel" },
901
+ move: { name: "pointermove" },
902
+ end: { name: "pointerup" }
903
+ }, st = class extends at {
904
+ constructor(e) {
905
+ let { event: t } = e, n = T(t.target);
906
+ super(e, ot, n);
907
+ }
908
+ };
909
+ st.activators = [{
910
+ eventName: "onPointerDown",
911
+ handler: (e, t) => {
912
+ let { nativeEvent: n } = e, { onActivation: r } = t;
913
+ return !n.isPrimary || n.button !== 0 ? !1 : (r?.({ event: n }), !0);
914
+ }
915
+ }];
916
+ var ct = {
917
+ move: { name: "mousemove" },
918
+ end: { name: "mouseup" }
919
+ }, lt;
920
+ (function(e) {
921
+ e[e.RightClick = 2] = "RightClick";
922
+ })(lt ||= {});
923
+ var ut = class extends at {
924
+ constructor(e) {
925
+ super(e, ct, T(e.event.target));
926
+ }
927
+ };
928
+ ut.activators = [{
929
+ eventName: "onMouseDown",
930
+ handler: (e, t) => {
931
+ let { nativeEvent: n } = e, { onActivation: r } = t;
932
+ return n.button === lt.RightClick ? !1 : (r?.({ event: n }), !0);
933
+ }
934
+ }];
935
+ var dt = {
936
+ cancel: { name: "touchcancel" },
937
+ move: { name: "touchmove" },
938
+ end: { name: "touchend" }
939
+ }, ft = class extends at {
940
+ constructor(e) {
941
+ super(e, dt);
942
+ }
943
+ static setup() {
944
+ return window.addEventListener(dt.move.name, e, {
945
+ capture: !1,
946
+ passive: !1
947
+ }), function() {
948
+ window.removeEventListener(dt.move.name, e);
949
+ };
950
+ function e() {}
951
+ }
952
+ };
953
+ ft.activators = [{
954
+ eventName: "onTouchStart",
955
+ handler: (e, t) => {
956
+ let { nativeEvent: n } = e, { onActivation: r } = t, { touches: i } = n;
957
+ return i.length > 1 ? !1 : (r?.({ event: n }), !0);
958
+ }
959
+ }];
960
+ var pt;
961
+ (function(e) {
962
+ e[e.Pointer = 0] = "Pointer", e[e.DraggableRect = 1] = "DraggableRect";
963
+ })(pt ||= {});
964
+ var mt;
965
+ (function(e) {
966
+ e[e.TreeOrder = 0] = "TreeOrder", e[e.ReversedTreeOrder = 1] = "ReversedTreeOrder";
967
+ })(mt ||= {});
968
+ function ht(e) {
969
+ let { acceleration: t, activator: n = pt.Pointer, canScroll: r, draggingRect: i, enabled: o, interval: c = 5, order: u = mt.TreeOrder, pointerCoordinates: f, scrollableAncestors: p, scrollableAncestorRects: m, delta: h, threshold: g } = e, _ = _t({
970
+ delta: h,
971
+ disabled: !o
972
+ }), [v, y] = O(), b = d({
973
+ x: 0,
974
+ y: 0
975
+ }), x = d({
976
+ x: 0,
977
+ y: 0
978
+ }), S = l(() => {
979
+ switch (n) {
980
+ case pt.Pointer: return f ? {
981
+ top: f.y,
982
+ bottom: f.y,
983
+ left: f.x,
984
+ right: f.x
985
+ } : null;
986
+ case pt.DraggableRect: return i;
987
+ }
988
+ }, [
989
+ n,
990
+ i,
991
+ f
992
+ ]), C = d(null), w = a(() => {
993
+ let e = C.current;
994
+ if (!e) return;
995
+ let t = b.current.x * x.current.x, n = b.current.y * x.current.y;
996
+ e.scrollBy(t, n);
997
+ }, []), T = l(() => u === mt.TreeOrder ? [...p].reverse() : p, [u, p]);
998
+ s(() => {
999
+ if (!o || !p.length || !S) {
1000
+ y();
1001
+ return;
1002
+ }
1003
+ for (let e of T) {
1004
+ if (r?.(e) === !1) continue;
1005
+ let n = m[p.indexOf(e)];
1006
+ if (!n) continue;
1007
+ let { direction: i, speed: a } = Ve(e, n, S, t, g);
1008
+ for (let e of ["x", "y"]) _[e][i[e]] || (a[e] = 0, i[e] = 0);
1009
+ if (a.x > 0 || a.y > 0) {
1010
+ y(), C.current = e, v(w, c), b.current = a, x.current = i;
1011
+ return;
1012
+ }
1013
+ }
1014
+ b.current = {
1015
+ x: 0,
1016
+ y: 0
1017
+ }, x.current = {
1018
+ x: 0,
1019
+ y: 0
1020
+ }, y();
1021
+ }, [
1022
+ t,
1023
+ w,
1024
+ r,
1025
+ y,
1026
+ o,
1027
+ c,
1028
+ JSON.stringify(S),
1029
+ JSON.stringify(_),
1030
+ v,
1031
+ p,
1032
+ T,
1033
+ m,
1034
+ JSON.stringify(g)
1035
+ ]);
1036
+ }
1037
+ var gt = {
1038
+ x: {
1039
+ [Z.Backward]: !1,
1040
+ [Z.Forward]: !1
1041
+ },
1042
+ y: {
1043
+ [Z.Backward]: !1,
1044
+ [Z.Forward]: !1
1045
+ }
1046
+ };
1047
+ function _t(e) {
1048
+ let { delta: t, disabled: n } = e, r = M(t);
1049
+ return A((e) => {
1050
+ if (n || !r || !e) return gt;
1051
+ let i = {
1052
+ x: Math.sign(t.x - r.x),
1053
+ y: Math.sign(t.y - r.y)
1054
+ };
1055
+ return {
1056
+ x: {
1057
+ [Z.Backward]: e.x[Z.Backward] || i.x === -1,
1058
+ [Z.Forward]: e.x[Z.Forward] || i.x === 1
1059
+ },
1060
+ y: {
1061
+ [Z.Backward]: e.y[Z.Backward] || i.y === -1,
1062
+ [Z.Forward]: e.y[Z.Forward] || i.y === 1
1063
+ }
1064
+ };
1065
+ }, [
1066
+ n,
1067
+ t,
1068
+ r
1069
+ ]);
1070
+ }
1071
+ function vt(e, t) {
1072
+ let n = t == null ? void 0 : e.get(t), r = n ? n.node.current : null;
1073
+ return A((e) => t == null ? null : r ?? e ?? null, [r, t]);
1074
+ }
1075
+ function yt(e, t) {
1076
+ return l(() => e.reduce((e, n) => {
1077
+ let { sensor: r } = n, i = r.activators.map((e) => ({
1078
+ eventName: e.eventName,
1079
+ handler: t(e.handler, n)
1080
+ }));
1081
+ return [...e, ...i];
1082
+ }, []), [e, t]);
1083
+ }
1084
+ var bt;
1085
+ (function(e) {
1086
+ e[e.Always = 0] = "Always", e[e.BeforeDragging = 1] = "BeforeDragging", e[e.WhileDragging = 2] = "WhileDragging";
1087
+ })(bt ||= {});
1088
+ var xt;
1089
+ (function(e) {
1090
+ e.Optimized = "optimized";
1091
+ })(xt ||= {});
1092
+ var St = /* @__PURE__ */ new Map();
1093
+ function Ct(e, t) {
1094
+ let { dragging: n, dependencies: r, config: i } = t, [o, c] = f(null), { frequency: l, measure: u, strategy: p } = i, m = d(e), h = b(), g = k(h), _ = a(function(e) {
1095
+ e === void 0 && (e = []), !g.current && c((t) => t === null ? e : t.concat(e.filter((e) => !t.includes(e))));
1096
+ }, [g]), v = d(null), y = A((t) => {
1097
+ if (h && !n) return St;
1098
+ if (!t || t === St || m.current !== e || o != null) {
1099
+ let t = /* @__PURE__ */ new Map();
1100
+ for (let n of e) {
1101
+ if (!n) continue;
1102
+ if (o && o.length > 0 && !o.includes(n.id) && n.rect.current) {
1103
+ t.set(n.id, n.rect.current);
1104
+ continue;
1105
+ }
1106
+ let e = n.node.current, r = e ? new Je(u(e), e) : null;
1107
+ n.rect.current = r, r && t.set(n.id, r);
1108
+ }
1109
+ return t;
1110
+ }
1111
+ return t;
1112
+ }, [
1113
+ e,
1114
+ o,
1115
+ n,
1116
+ h,
1117
+ u
1118
+ ]);
1119
+ return s(() => {
1120
+ m.current = e;
1121
+ }, [e]), s(() => {
1122
+ h || _();
1123
+ }, [n, h]), s(() => {
1124
+ o && o.length > 0 && c(null);
1125
+ }, [JSON.stringify(o)]), s(() => {
1126
+ h || typeof l != "number" || v.current !== null || (v.current = setTimeout(() => {
1127
+ _(), v.current = null;
1128
+ }, l));
1129
+ }, [
1130
+ l,
1131
+ h,
1132
+ _,
1133
+ ...r
1134
+ ]), {
1135
+ droppableRects: y,
1136
+ measureDroppableContainers: _,
1137
+ measuringScheduled: o != null
1138
+ };
1139
+ function b() {
1140
+ switch (p) {
1141
+ case bt.Always: return !1;
1142
+ case bt.BeforeDragging: return n;
1143
+ default: return !n;
1144
+ }
1145
+ }
1146
+ }
1147
+ function wt(e, t) {
1148
+ return A((n) => e ? n || (typeof t == "function" ? t(e) : e) : null, [t, e]);
1149
+ }
1150
+ function Tt(e, t) {
1151
+ return wt(e, t);
1152
+ }
1153
+ function Et(e) {
1154
+ let { callback: t, disabled: n } = e, r = D(t), i = l(() => {
1155
+ if (n || typeof window > "u" || window.MutationObserver === void 0) return;
1156
+ let { MutationObserver: e } = window;
1157
+ return new e(r);
1158
+ }, [r, n]);
1159
+ return s(() => () => i?.disconnect(), [i]), i;
1160
+ }
1161
+ function Dt(e) {
1162
+ let { callback: t, disabled: n } = e, r = D(t), i = l(() => {
1163
+ if (n || typeof window > "u" || window.ResizeObserver === void 0) return;
1164
+ let { ResizeObserver: e } = window;
1165
+ return new e(r);
1166
+ }, [n]);
1167
+ return s(() => () => i?.disconnect(), [i]), i;
1168
+ }
1169
+ function Ot(e) {
1170
+ return new Je(Oe(e), e);
1171
+ }
1172
+ function kt(e, t, n) {
1173
+ t === void 0 && (t = Ot);
1174
+ let [r, i] = f(null);
1175
+ function a() {
1176
+ i((r) => {
1177
+ if (!e) return null;
1178
+ if (e.isConnected === !1) return r ?? n ?? null;
1179
+ let i = t(e);
1180
+ return JSON.stringify(r) === JSON.stringify(i) ? r : i;
1181
+ });
1182
+ }
1183
+ let o = Et({ callback(t) {
1184
+ if (e) for (let n of t) {
1185
+ let { type: t, target: r } = n;
1186
+ if (t === "childList" && r instanceof HTMLElement && r.contains(e)) {
1187
+ a();
1188
+ break;
1189
+ }
1190
+ }
1191
+ } }), s = Dt({ callback: a });
1192
+ return E(() => {
1193
+ a(), e ? (s?.observe(e), o?.observe(document.body, {
1194
+ childList: !0,
1195
+ subtree: !0
1196
+ })) : (s?.disconnect(), o?.disconnect());
1197
+ }, [e]), r;
1198
+ }
1199
+ function At(e) {
1200
+ return Se(e, wt(e));
1201
+ }
1202
+ var jt = [];
1203
+ function Mt(e) {
1204
+ let t = d(e), n = A((n) => e ? n && n !== jt && e && t.current && e.parentNode === t.current.parentNode ? n : X(e) : jt, [e]);
1205
+ return s(() => {
1206
+ t.current = e;
1207
+ }, [e]), n;
1208
+ }
1209
+ function Nt(e) {
1210
+ let [t, n] = f(null), r = d(e), i = a((e) => {
1211
+ let t = Pe(e.target);
1212
+ t && n((e) => e ? (e.set(t, Le(t)), new Map(e)) : null);
1213
+ }, []);
1214
+ return s(() => {
1215
+ let t = r.current;
1216
+ if (e !== t) {
1217
+ a(t);
1218
+ let o = e.map((e) => {
1219
+ let t = Pe(e);
1220
+ return t ? (t.addEventListener("scroll", i, { passive: !0 }), [t, Le(t)]) : null;
1221
+ }).filter((e) => e != null);
1222
+ n(o.length ? new Map(o) : null), r.current = e;
1223
+ }
1224
+ return () => {
1225
+ a(e), a(t);
1226
+ };
1227
+ function a(e) {
1228
+ e.forEach((e) => {
1229
+ Pe(e)?.removeEventListener("scroll", i);
1230
+ });
1231
+ }
1232
+ }, [i, e]), l(() => e.length ? t ? Array.from(t.values()).reduce((e, t) => ne(e, t), K) : Ue(e) : K, [e, t]);
1233
+ }
1234
+ function Pt(e, t) {
1235
+ t === void 0 && (t = []);
1236
+ let n = d(null);
1237
+ return s(() => {
1238
+ n.current = null;
1239
+ }, t), s(() => {
1240
+ let t = e !== K;
1241
+ t && !n.current && (n.current = e), !t && n.current && (n.current = null);
1242
+ }, [e]), n.current ? P(e, n.current) : K;
1243
+ }
1244
+ function Ft(e) {
1245
+ s(() => {
1246
+ if (!v) return;
1247
+ let t = e.map((e) => {
1248
+ let { sensor: t } = e;
1249
+ return t.setup == null ? void 0 : t.setup();
1250
+ });
1251
+ return () => {
1252
+ for (let e of t) e?.();
1253
+ };
1254
+ }, e.map((e) => {
1255
+ let { sensor: t } = e;
1256
+ return t;
1257
+ }));
1258
+ }
1259
+ function It(e, t) {
1260
+ return l(() => e.reduce((e, n) => {
1261
+ let { eventName: r, handler: i } = n;
1262
+ return e[r] = (e) => {
1263
+ i(e, t);
1264
+ }, e;
1265
+ }, {}), [e, t]);
1266
+ }
1267
+ function Lt(e) {
1268
+ return l(() => e ? Ae(e) : null, [e]);
1269
+ }
1270
+ var Rt = [];
1271
+ function zt(e, t) {
1272
+ t === void 0 && (t = Oe);
1273
+ let [n] = e, r = Lt(n ? x(n) : null), [i, a] = f(Rt);
1274
+ function o() {
1275
+ a(() => e.length ? e.map((e) => Re(e) ? r : new Je(t(e), e)) : Rt);
1276
+ }
1277
+ let s = Dt({ callback: o });
1278
+ return E(() => {
1279
+ s?.disconnect(), o(), e.forEach((e) => s?.observe(e));
1280
+ }, [e]), i;
1281
+ }
1282
+ function Bt(e) {
1283
+ if (!e) return null;
1284
+ if (e.children.length > 1) return e;
1285
+ let t = e.children[0];
1286
+ return C(t) ? t : e;
1287
+ }
1288
+ function Vt(e) {
1289
+ let { measure: t } = e, [n, r] = f(null), i = Dt({ callback: a((e) => {
1290
+ for (let { target: n } of e) if (C(n)) {
1291
+ r((e) => {
1292
+ let r = t(n);
1293
+ return e ? {
1294
+ ...e,
1295
+ width: r.width,
1296
+ height: r.height
1297
+ } : r;
1298
+ });
1299
+ break;
1300
+ }
1301
+ }, [t]) }), [o, s] = j(a((e) => {
1302
+ let n = Bt(e);
1303
+ i?.disconnect(), n && i?.observe(n), r(n ? t(n) : null);
1304
+ }, [t, i]));
1305
+ return l(() => ({
1306
+ nodeRef: o,
1307
+ rect: n,
1308
+ setRef: s
1309
+ }), [
1310
+ n,
1311
+ o,
1312
+ s
1313
+ ]);
1314
+ }
1315
+ var Ht = [{
1316
+ sensor: st,
1317
+ options: {}
1318
+ }, {
1319
+ sensor: nt,
1320
+ options: {}
1321
+ }], Ut = { current: {} }, Wt = {
1322
+ draggable: { measure: ke },
1323
+ droppable: {
1324
+ measure: ke,
1325
+ strategy: bt.WhileDragging,
1326
+ frequency: xt.Optimized
1327
+ },
1328
+ dragOverlay: { measure: Oe }
1329
+ }, Gt = class extends Map {
1330
+ get(e) {
1331
+ return e == null ? void 0 : super.get(e) ?? void 0;
1332
+ }
1333
+ toArray() {
1334
+ return Array.from(this.values());
1335
+ }
1336
+ getEnabled() {
1337
+ return this.toArray().filter((e) => {
1338
+ let { disabled: t } = e;
1339
+ return !t;
1340
+ });
1341
+ }
1342
+ getNodeFor(e) {
1343
+ return this.get(e)?.node.current ?? void 0;
1344
+ }
1345
+ }, Kt = {
1346
+ activatorEvent: null,
1347
+ active: null,
1348
+ activeNode: null,
1349
+ activeNodeRect: null,
1350
+ collisions: null,
1351
+ containerNodeRect: null,
1352
+ draggableNodes: /* @__PURE__ */ new Map(),
1353
+ droppableRects: /* @__PURE__ */ new Map(),
1354
+ droppableContainers: /* @__PURE__ */ new Gt(),
1355
+ over: null,
1356
+ dragOverlay: {
1357
+ nodeRef: { current: null },
1358
+ rect: null,
1359
+ setRef: de
1360
+ },
1361
+ scrollableAncestors: [],
1362
+ scrollableAncestorRects: [],
1363
+ measuringConfiguration: Wt,
1364
+ measureDroppableContainers: de,
1365
+ windowRect: null,
1366
+ measuringScheduled: !1
1367
+ }, qt = {
1368
+ activatorEvent: null,
1369
+ activators: [],
1370
+ active: null,
1371
+ activeNodeRect: null,
1372
+ ariaDescribedById: { draggable: "" },
1373
+ dispatch: de,
1374
+ draggableNodes: /* @__PURE__ */ new Map(),
1375
+ over: null,
1376
+ measureDroppableContainers: de
1377
+ }, Jt = /* @__PURE__ */ n(qt), Yt = /* @__PURE__ */ n(Kt);
1378
+ function Xt() {
1379
+ return {
1380
+ draggable: {
1381
+ active: null,
1382
+ initialCoordinates: {
1383
+ x: 0,
1384
+ y: 0
1385
+ },
1386
+ nodes: /* @__PURE__ */ new Map(),
1387
+ translate: {
1388
+ x: 0,
1389
+ y: 0
1390
+ }
1391
+ },
1392
+ droppable: { containers: new Gt() }
1393
+ };
1394
+ }
1395
+ function Zt(e, t) {
1396
+ switch (t.type) {
1397
+ case W.DragStart: return {
1398
+ ...e,
1399
+ draggable: {
1400
+ ...e.draggable,
1401
+ initialCoordinates: t.initialCoordinates,
1402
+ active: t.active
1403
+ }
1404
+ };
1405
+ case W.DragMove: return e.draggable.active == null ? e : {
1406
+ ...e,
1407
+ draggable: {
1408
+ ...e.draggable,
1409
+ translate: {
1410
+ x: t.coordinates.x - e.draggable.initialCoordinates.x,
1411
+ y: t.coordinates.y - e.draggable.initialCoordinates.y
1412
+ }
1413
+ }
1414
+ };
1415
+ case W.DragEnd:
1416
+ case W.DragCancel: return {
1417
+ ...e,
1418
+ draggable: {
1419
+ ...e.draggable,
1420
+ active: null,
1421
+ initialCoordinates: {
1422
+ x: 0,
1423
+ y: 0
1424
+ },
1425
+ translate: {
1426
+ x: 0,
1427
+ y: 0
1428
+ }
1429
+ }
1430
+ };
1431
+ case W.RegisterDroppable: {
1432
+ let { element: n } = t, { id: r } = n, i = new Gt(e.droppable.containers);
1433
+ return i.set(r, n), {
1434
+ ...e,
1435
+ droppable: {
1436
+ ...e.droppable,
1437
+ containers: i
1438
+ }
1439
+ };
1440
+ }
1441
+ case W.SetDroppableDisabled: {
1442
+ let { id: n, key: r, disabled: i } = t, a = e.droppable.containers.get(n);
1443
+ if (!a || r !== a.key) return e;
1444
+ let o = new Gt(e.droppable.containers);
1445
+ return o.set(n, {
1446
+ ...a,
1447
+ disabled: i
1448
+ }), {
1449
+ ...e,
1450
+ droppable: {
1451
+ ...e.droppable,
1452
+ containers: o
1453
+ }
1454
+ };
1455
+ }
1456
+ case W.UnregisterDroppable: {
1457
+ let { id: n, key: r } = t, i = e.droppable.containers.get(n);
1458
+ if (!i || r !== i.key) return e;
1459
+ let a = new Gt(e.droppable.containers);
1460
+ return a.delete(n), {
1461
+ ...e,
1462
+ droppable: {
1463
+ ...e.droppable,
1464
+ containers: a
1465
+ }
1466
+ };
1467
+ }
1468
+ default: return e;
1469
+ }
1470
+ }
1471
+ function Qt(e) {
1472
+ let { disabled: t } = e, { active: n, activatorEvent: r, draggableNodes: i } = o(Jt), a = M(r), c = M(n?.id);
1473
+ return s(() => {
1474
+ if (!t && !r && a && c != null) {
1475
+ if (!ie(a) || document.activeElement === a.target) return;
1476
+ let e = i.get(c);
1477
+ if (!e) return;
1478
+ let { activatorNode: t, node: n } = e;
1479
+ if (!t.current && !n.current) return;
1480
+ requestAnimationFrame(() => {
1481
+ for (let e of [t.current, n.current]) {
1482
+ if (!e) continue;
1483
+ let t = oe(e);
1484
+ if (t) {
1485
+ t.focus();
1486
+ break;
1487
+ }
1488
+ }
1489
+ });
1490
+ }
1491
+ }, [
1492
+ r,
1493
+ t,
1494
+ i,
1495
+ c,
1496
+ a
1497
+ ]), null;
1498
+ }
1499
+ function $t(e, t) {
1500
+ let { transform: n, ...r } = t;
1501
+ return e != null && e.length ? e.reduce((e, t) => t({
1502
+ transform: e,
1503
+ ...r
1504
+ }), n) : n;
1505
+ }
1506
+ function en(e) {
1507
+ return l(() => ({
1508
+ draggable: {
1509
+ ...Wt.draggable,
1510
+ ...e?.draggable
1511
+ },
1512
+ droppable: {
1513
+ ...Wt.droppable,
1514
+ ...e?.droppable
1515
+ },
1516
+ dragOverlay: {
1517
+ ...Wt.dragOverlay,
1518
+ ...e?.dragOverlay
1519
+ }
1520
+ }), [
1521
+ e?.draggable,
1522
+ e?.droppable,
1523
+ e?.dragOverlay
1524
+ ]);
1525
+ }
1526
+ function tn(e) {
1527
+ let { activeNode: t, measure: n, initialRect: r, config: i = !0 } = e, a = d(!1), { x: o, y: s } = typeof i == "boolean" ? {
1528
+ x: i,
1529
+ y: i
1530
+ } : i;
1531
+ E(() => {
1532
+ if (!o && !s || !t) {
1533
+ a.current = !1;
1534
+ return;
1535
+ }
1536
+ if (a.current || !r) return;
1537
+ let e = t?.node.current;
1538
+ if (!e || e.isConnected === !1) return;
1539
+ let i = Se(n(e), r);
1540
+ if (o || (i.x = 0), s || (i.y = 0), a.current = !0, Math.abs(i.x) > 0 || Math.abs(i.y) > 0) {
1541
+ let t = Ne(e);
1542
+ t && t.scrollBy({
1543
+ top: i.y,
1544
+ left: i.x
1545
+ });
1546
+ }
1547
+ }, [
1548
+ t,
1549
+ o,
1550
+ s,
1551
+ r,
1552
+ n
1553
+ ]);
1554
+ }
1555
+ var nn = /* @__PURE__ */ n({
1556
+ ...K,
1557
+ scaleX: 1,
1558
+ scaleY: 1
1559
+ }), rn;
1560
+ (function(e) {
1561
+ e[e.Uninitialized = 0] = "Uninitialized", e[e.Initializing = 1] = "Initializing", e[e.Initialized = 2] = "Initialized";
1562
+ })(rn ||= {});
1563
+ var an = /* @__PURE__ */ i(function(t) {
1564
+ let { id: n, accessibility: r, autoScroll: i = !0, children: o, sensors: c = Ht, collisionDetection: p = be, measuring: m, modifiers: h, ..._ } = t, [v, y] = u(Zt, void 0, Xt), [b, S] = H(), [C, w] = f(rn.Uninitialized), T = C === rn.Initialized, { draggable: { active: D, nodes: O, translate: A }, droppable: { containers: j } } = v, M = D == null ? null : O.get(D), ee = d({
1565
+ initial: null,
1566
+ translated: null
1567
+ }), N = l(() => D == null ? null : {
1568
+ id: D,
1569
+ data: M?.data ?? Ut,
1570
+ rect: ee
1571
+ }, [D, M]), P = d(null), [re, ie] = f(null), [F, I] = f(null), L = k(_, Object.values(_)), oe = te("DndDescribedBy", n), R = l(() => j.getEnabled(), [j]), z = en(m), { droppableRects: B, measureDroppableContainers: se, measuringScheduled: V } = Ct(R, {
1572
+ dragging: T,
1573
+ dependencies: [A.x, A.y],
1574
+ config: z.droppable
1575
+ }), U = vt(O, D), le = l(() => F ? ae(F) : null, [F]), de = ze(), fe = Tt(U, z.draggable.measure);
1576
+ tn({
1577
+ activeNode: D == null ? null : O.get(D),
1578
+ config: de.layoutShiftCompensation,
1579
+ initialRect: fe,
1580
+ measure: z.draggable.measure
1581
+ });
1582
+ let G = kt(U, z.draggable.measure, fe), K = kt(U ? U.parentElement : null), q = d({
1583
+ activatorEvent: null,
1584
+ active: null,
1585
+ activeNode: U,
1586
+ collisionRect: null,
1587
+ collisions: null,
1588
+ droppableRects: B,
1589
+ draggableNodes: O,
1590
+ draggingNode: null,
1591
+ draggingNodeRect: null,
1592
+ droppableContainers: j,
1593
+ over: null,
1594
+ scrollableAncestors: [],
1595
+ scrollAdjustedTranslate: null
1596
+ }), pe = j.getNodeFor(q.current.over?.id), J = Vt({ measure: z.dragOverlay.measure }), me = J.nodeRef.current ?? U, he = T ? J.rect ?? G : null, _e = !!(J.nodeRef.current && J.rect), ve = At(_e ? null : G), ye = Lt(me ? x(me) : null), Y = Mt(T ? pe ?? U : null), Se = zt(Y), Ce = $t(h, {
1597
+ transform: {
1598
+ x: A.x - ve.x,
1599
+ y: A.y - ve.y,
1600
+ scaleX: 1,
1601
+ scaleY: 1
1602
+ },
1603
+ activatorEvent: F,
1604
+ active: N,
1605
+ activeNodeRect: G,
1606
+ containerNodeRect: K,
1607
+ draggingNodeRect: he,
1608
+ over: q.current.over,
1609
+ overlayNodeRect: J.rect,
1610
+ scrollableAncestors: Y,
1611
+ scrollableAncestorRects: Se,
1612
+ windowRect: ye
1613
+ }), Te = le ? ne(le, A) : null, Ee = Nt(Y), De = Pt(Ee), Oe = Pt(Ee, [G]), ke = ne(Ce, De), Ae = he ? we(he, Ce) : null, je = N && Ae ? p({
1614
+ active: N,
1615
+ collisionRect: Ae,
1616
+ droppableRects: B,
1617
+ droppableContainers: R,
1618
+ pointerCoordinates: Te
1619
+ }) : null, Me = ge(je, "id"), [X, Ne] = f(null), Pe = xe(_e ? Ce : ne(Ce, Oe), X?.rect ?? null, G), Fe = d(null), Ie = a((e, t) => {
1620
+ let { sensor: n, options: r } = t;
1621
+ if (P.current == null) return;
1622
+ let i = O.get(P.current);
1623
+ if (!i) return;
1624
+ let a = e.nativeEvent;
1625
+ Fe.current = new n({
1626
+ active: P.current,
1627
+ activeNode: i,
1628
+ event: a,
1629
+ options: r,
1630
+ context: q,
1631
+ onAbort(e) {
1632
+ if (!O.get(e)) return;
1633
+ let { onDragAbort: t } = L.current, n = { id: e };
1634
+ t?.(n), b({
1635
+ type: "onDragAbort",
1636
+ event: n
1637
+ });
1638
+ },
1639
+ onPending(e, t, n, r) {
1640
+ if (!O.get(e)) return;
1641
+ let { onDragPending: i } = L.current, a = {
1642
+ id: e,
1643
+ constraint: t,
1644
+ initialCoordinates: n,
1645
+ offset: r
1646
+ };
1647
+ i?.(a), b({
1648
+ type: "onDragPending",
1649
+ event: a
1650
+ });
1651
+ },
1652
+ onStart(e) {
1653
+ let t = P.current;
1654
+ if (t == null) return;
1655
+ let n = O.get(t);
1656
+ if (!n) return;
1657
+ let { onDragStart: r } = L.current, i = {
1658
+ activatorEvent: a,
1659
+ active: {
1660
+ id: t,
1661
+ data: n.data,
1662
+ rect: ee
1663
+ }
1664
+ };
1665
+ g(() => {
1666
+ r?.(i), w(rn.Initializing), y({
1667
+ type: W.DragStart,
1668
+ initialCoordinates: e,
1669
+ active: t
1670
+ }), b({
1671
+ type: "onDragStart",
1672
+ event: i
1673
+ }), ie(Fe.current), I(a);
1674
+ });
1675
+ },
1676
+ onMove(e) {
1677
+ y({
1678
+ type: W.DragMove,
1679
+ coordinates: e
1680
+ });
1681
+ },
1682
+ onEnd: o(W.DragEnd),
1683
+ onCancel: o(W.DragCancel)
1684
+ });
1685
+ function o(e) {
1686
+ return async function() {
1687
+ let { active: t, collisions: n, over: r, scrollAdjustedTranslate: i } = q.current, o = null;
1688
+ if (t && i) {
1689
+ let { cancelDrop: s } = L.current;
1690
+ o = {
1691
+ activatorEvent: a,
1692
+ active: t,
1693
+ collisions: n,
1694
+ delta: i,
1695
+ over: r
1696
+ }, e === W.DragEnd && typeof s == "function" && await Promise.resolve(s(o)) && (e = W.DragCancel);
1697
+ }
1698
+ P.current = null, g(() => {
1699
+ y({ type: e }), w(rn.Uninitialized), Ne(null), ie(null), I(null), Fe.current = null;
1700
+ let t = e === W.DragEnd ? "onDragEnd" : "onDragCancel";
1701
+ if (o) {
1702
+ let e = L.current[t];
1703
+ e?.(o), b({
1704
+ type: t,
1705
+ event: o
1706
+ });
1707
+ }
1708
+ });
1709
+ };
1710
+ }
1711
+ }, [O]), Le = yt(c, a((e, t) => (n, r) => {
1712
+ let i = n.nativeEvent, a = O.get(r);
1713
+ if (P.current !== null || !a || i.dndKit || i.defaultPrevented) return;
1714
+ let o = { active: a };
1715
+ e(n, t.options, o) === !0 && (i.dndKit = { capturedBy: t.sensor }, P.current = r, Ie(n, t));
1716
+ }, [O, Ie]));
1717
+ Ft(c), E(() => {
1718
+ G && C === rn.Initializing && w(rn.Initialized);
1719
+ }, [G, C]), s(() => {
1720
+ let { onDragMove: e } = L.current, { active: t, activatorEvent: n, collisions: r, over: i } = q.current;
1721
+ if (!t || !n) return;
1722
+ let a = {
1723
+ active: t,
1724
+ activatorEvent: n,
1725
+ collisions: r,
1726
+ delta: {
1727
+ x: ke.x,
1728
+ y: ke.y
1729
+ },
1730
+ over: i
1731
+ };
1732
+ g(() => {
1733
+ e?.(a), b({
1734
+ type: "onDragMove",
1735
+ event: a
1736
+ });
1737
+ });
1738
+ }, [ke.x, ke.y]), s(() => {
1739
+ let { active: e, activatorEvent: t, collisions: n, droppableContainers: r, scrollAdjustedTranslate: i } = q.current;
1740
+ if (!e || P.current == null || !t || !i) return;
1741
+ let { onDragOver: a } = L.current, o = r.get(Me), s = o && o.rect.current ? {
1742
+ id: o.id,
1743
+ rect: o.rect.current,
1744
+ data: o.data,
1745
+ disabled: o.disabled
1746
+ } : null, c = {
1747
+ active: e,
1748
+ activatorEvent: t,
1749
+ collisions: n,
1750
+ delta: {
1751
+ x: i.x,
1752
+ y: i.y
1753
+ },
1754
+ over: s
1755
+ };
1756
+ g(() => {
1757
+ Ne(s), a?.(c), b({
1758
+ type: "onDragOver",
1759
+ event: c
1760
+ });
1761
+ });
1762
+ }, [Me]), E(() => {
1763
+ q.current = {
1764
+ activatorEvent: F,
1765
+ active: N,
1766
+ activeNode: U,
1767
+ collisionRect: Ae,
1768
+ collisions: je,
1769
+ droppableRects: B,
1770
+ draggableNodes: O,
1771
+ draggingNode: me,
1772
+ draggingNodeRect: he,
1773
+ droppableContainers: j,
1774
+ over: X,
1775
+ scrollableAncestors: Y,
1776
+ scrollAdjustedTranslate: ke
1777
+ }, ee.current = {
1778
+ initial: he,
1779
+ translated: Ae
1780
+ };
1781
+ }, [
1782
+ N,
1783
+ U,
1784
+ je,
1785
+ Ae,
1786
+ O,
1787
+ me,
1788
+ he,
1789
+ B,
1790
+ j,
1791
+ X,
1792
+ Y,
1793
+ ke
1794
+ ]), ht({
1795
+ ...de,
1796
+ delta: A,
1797
+ draggingRect: Ae,
1798
+ pointerCoordinates: Te,
1799
+ scrollableAncestors: Y,
1800
+ scrollableAncestorRects: Se
1801
+ });
1802
+ let Z = l(() => ({
1803
+ active: N,
1804
+ activeNode: U,
1805
+ activeNodeRect: G,
1806
+ activatorEvent: F,
1807
+ collisions: je,
1808
+ containerNodeRect: K,
1809
+ dragOverlay: J,
1810
+ draggableNodes: O,
1811
+ droppableContainers: j,
1812
+ droppableRects: B,
1813
+ over: X,
1814
+ measureDroppableContainers: se,
1815
+ scrollableAncestors: Y,
1816
+ scrollableAncestorRects: Se,
1817
+ measuringConfiguration: z,
1818
+ measuringScheduled: V,
1819
+ windowRect: ye
1820
+ }), [
1821
+ N,
1822
+ U,
1823
+ G,
1824
+ F,
1825
+ je,
1826
+ K,
1827
+ J,
1828
+ O,
1829
+ j,
1830
+ B,
1831
+ X,
1832
+ se,
1833
+ Y,
1834
+ Se,
1835
+ z,
1836
+ V,
1837
+ ye
1838
+ ]), Re = l(() => ({
1839
+ activatorEvent: F,
1840
+ activators: Le,
1841
+ active: N,
1842
+ activeNodeRect: G,
1843
+ ariaDescribedById: { draggable: oe },
1844
+ dispatch: y,
1845
+ draggableNodes: O,
1846
+ over: X,
1847
+ measureDroppableContainers: se
1848
+ }), [
1849
+ F,
1850
+ Le,
1851
+ N,
1852
+ G,
1853
+ y,
1854
+ oe,
1855
+ O,
1856
+ X,
1857
+ se
1858
+ ]);
1859
+ return e.createElement(ce.Provider, { value: S }, e.createElement(Jt.Provider, { value: Re }, e.createElement(Yt.Provider, { value: Z }, e.createElement(nn.Provider, { value: Pe }, o)), e.createElement(Qt, { disabled: r?.restoreFocus === !1 })), e.createElement(ue, {
1860
+ ...r,
1861
+ hiddenTextDescribedById: oe
1862
+ }));
1863
+ function ze() {
1864
+ let e = re?.autoScrollEnabled === !1, t = typeof i == "object" ? i.enabled === !1 : i === !1, n = T && !e && !t;
1865
+ return typeof i == "object" ? {
1866
+ ...i,
1867
+ enabled: n
1868
+ } : { enabled: n };
1869
+ }
1870
+ }), on = /* @__PURE__ */ n(null), sn = "button", cn = "Draggable";
1871
+ function ln(e) {
1872
+ let { id: t, data: n, disabled: r = !1, attributes: i } = e, a = te(cn), { activators: s, activatorEvent: c, active: u, activeNodeRect: d, ariaDescribedById: f, draggableNodes: p, over: m } = o(Jt), { role: h = sn, roleDescription: g = "draggable", tabIndex: _ = 0 } = i ?? {}, v = u?.id === t, y = o(v ? nn : on), [b, x] = j(), [S, C] = j(), w = It(s, t), T = k(n);
1873
+ return E(() => (p.set(t, {
1874
+ id: t,
1875
+ key: a,
1876
+ node: b,
1877
+ activatorNode: S,
1878
+ data: T
1879
+ }), () => {
1880
+ let e = p.get(t);
1881
+ e && e.key === a && p.delete(t);
1882
+ }), [p, t]), {
1883
+ active: u,
1884
+ activatorEvent: c,
1885
+ activeNodeRect: d,
1886
+ attributes: l(() => ({
1887
+ role: h,
1888
+ tabIndex: _,
1889
+ "aria-disabled": r,
1890
+ "aria-pressed": v && h === sn ? !0 : void 0,
1891
+ "aria-roledescription": g,
1892
+ "aria-describedby": f.draggable
1893
+ }), [
1894
+ r,
1895
+ h,
1896
+ _,
1897
+ v,
1898
+ g,
1899
+ f.draggable
1900
+ ]),
1901
+ isDragging: v,
1902
+ listeners: r ? void 0 : w,
1903
+ node: b,
1904
+ over: m,
1905
+ setNodeRef: x,
1906
+ setActivatorNodeRef: C,
1907
+ transform: y
1908
+ };
1909
+ }
1910
+ function un() {
1911
+ return o(Yt);
1912
+ }
1913
+ var dn = "Droppable", fn = { timeout: 25 };
1914
+ function pn(e) {
1915
+ let { data: t, disabled: n = !1, id: r, resizeObserverConfig: i } = e, c = te(dn), { active: l, dispatch: u, over: f, measureDroppableContainers: p } = o(Jt), m = d({ disabled: n }), h = d(!1), g = d(null), _ = d(null), { disabled: v, updateMeasurementsFor: y, timeout: b } = {
1916
+ ...fn,
1917
+ ...i
1918
+ }, x = k(y ?? r), S = Dt({
1919
+ callback: a(() => {
1920
+ if (!h.current) {
1921
+ h.current = !0;
1922
+ return;
1923
+ }
1924
+ _.current != null && clearTimeout(_.current), _.current = setTimeout(() => {
1925
+ p(Array.isArray(x.current) ? x.current : [x.current]), _.current = null;
1926
+ }, b);
1927
+ }, [b]),
1928
+ disabled: v || !l
1929
+ }), [C, w] = j(a((e, t) => {
1930
+ S && (t && (S.unobserve(t), h.current = !1), e && S.observe(e));
1931
+ }, [S])), T = k(t);
1932
+ return s(() => {
1933
+ !S || !C.current || (S.disconnect(), h.current = !1, S.observe(C.current));
1934
+ }, [C, S]), s(() => (u({
1935
+ type: W.RegisterDroppable,
1936
+ element: {
1937
+ id: r,
1938
+ key: c,
1939
+ disabled: n,
1940
+ node: C,
1941
+ rect: g,
1942
+ data: T
1943
+ }
1944
+ }), () => u({
1945
+ type: W.UnregisterDroppable,
1946
+ key: c,
1947
+ id: r
1948
+ })), [r]), s(() => {
1949
+ n !== m.current.disabled && (u({
1950
+ type: W.SetDroppableDisabled,
1951
+ id: r,
1952
+ key: c,
1953
+ disabled: n
1954
+ }), m.current.disabled = n);
1955
+ }, [
1956
+ r,
1957
+ c,
1958
+ n,
1959
+ u
1960
+ ]), {
1961
+ active: l,
1962
+ rect: g,
1963
+ isOver: f?.id === r,
1964
+ node: C,
1965
+ over: f,
1966
+ setNodeRef: w
1967
+ };
1968
+ }
1969
+ function mn(n) {
1970
+ let { animation: r, children: i } = n, [a, o] = f(null), [s, c] = f(null), l = M(i);
1971
+ return !i && !a && l && o(l), E(() => {
1972
+ if (!s) return;
1973
+ let e = a?.key, t = a?.props.id;
1974
+ if (e == null || t == null) {
1975
+ o(null);
1976
+ return;
1977
+ }
1978
+ Promise.resolve(r(t, s)).then(() => {
1979
+ o(null);
1980
+ });
1981
+ }, [
1982
+ r,
1983
+ a,
1984
+ s
1985
+ ]), e.createElement(e.Fragment, null, i, a ? t(a, { ref: c }) : null);
1986
+ }
1987
+ var hn = {
1988
+ x: 0,
1989
+ y: 0,
1990
+ scaleX: 1,
1991
+ scaleY: 1
1992
+ };
1993
+ function gn(t) {
1994
+ let { children: n } = t;
1995
+ return e.createElement(Jt.Provider, { value: qt }, e.createElement(nn.Provider, { value: hn }, n));
1996
+ }
1997
+ var _n = {
1998
+ position: "fixed",
1999
+ touchAction: "none"
2000
+ }, vn = (e) => ie(e) ? "transform 250ms ease" : void 0, yn = /* @__PURE__ */ r((t, n) => {
2001
+ let { as: r, activatorEvent: i, adjustScale: a, children: o, className: s, rect: c, style: l, transform: u, transition: d = vn } = t;
2002
+ if (!c) return null;
2003
+ let f = a ? u : {
2004
+ ...u,
2005
+ scaleX: 1,
2006
+ scaleY: 1
2007
+ }, p = {
2008
+ ..._n,
2009
+ width: c.width,
2010
+ height: c.height,
2011
+ top: c.top,
2012
+ left: c.left,
2013
+ transform: I.Transform.toString(f),
2014
+ transformOrigin: a && i ? pe(i, c) : void 0,
2015
+ transition: typeof d == "function" ? d(i) : d,
2016
+ ...l
2017
+ };
2018
+ return e.createElement(r, {
2019
+ className: s,
2020
+ style: p,
2021
+ ref: n
2022
+ }, o);
2023
+ }), bn = {
2024
+ duration: 250,
2025
+ easing: "ease",
2026
+ keyframes: (e) => {
2027
+ let { transform: { initial: t, final: n } } = e;
2028
+ return [{ transform: I.Transform.toString(t) }, { transform: I.Transform.toString(n) }];
2029
+ },
2030
+ sideEffects: /* @__PURE__ */ ((e) => (t) => {
2031
+ let { active: n, dragOverlay: r } = t, i = {}, { styles: a, className: o } = e;
2032
+ if (a != null && a.active) for (let [e, t] of Object.entries(a.active)) t !== void 0 && (i[e] = n.node.style.getPropertyValue(e), n.node.style.setProperty(e, t));
2033
+ if (a != null && a.dragOverlay) for (let [e, t] of Object.entries(a.dragOverlay)) t !== void 0 && r.node.style.setProperty(e, t);
2034
+ return o != null && o.active && n.node.classList.add(o.active), o != null && o.dragOverlay && r.node.classList.add(o.dragOverlay), function() {
2035
+ for (let [e, t] of Object.entries(i)) n.node.style.setProperty(e, t);
2036
+ o != null && o.active && n.node.classList.remove(o.active);
2037
+ };
2038
+ })({ styles: { active: { opacity: "0" } } })
2039
+ };
2040
+ function xn(e) {
2041
+ let { config: t, draggableNodes: n, droppableContainers: r, measuringConfiguration: i } = e;
2042
+ return D((e, a) => {
2043
+ if (t === null) return;
2044
+ let o = n.get(e);
2045
+ if (!o) return;
2046
+ let s = o.node.current;
2047
+ if (!s) return;
2048
+ let c = Bt(a);
2049
+ if (!c) return;
2050
+ let { transform: l } = x(a).getComputedStyle(a), u = Te(l);
2051
+ if (!u) return;
2052
+ let d = typeof t == "function" ? t : Sn(t);
2053
+ return Ke(s, i.draggable.measure), d({
2054
+ active: {
2055
+ id: e,
2056
+ data: o.data,
2057
+ node: s,
2058
+ rect: i.draggable.measure(s)
2059
+ },
2060
+ draggableNodes: n,
2061
+ dragOverlay: {
2062
+ node: a,
2063
+ rect: i.dragOverlay.measure(c)
2064
+ },
2065
+ droppableContainers: r,
2066
+ measuringConfiguration: i,
2067
+ transform: u
2068
+ });
2069
+ });
2070
+ }
2071
+ function Sn(e) {
2072
+ let { duration: t, easing: n, sideEffects: r, keyframes: i } = {
2073
+ ...bn,
2074
+ ...e
2075
+ };
2076
+ return (e) => {
2077
+ let { active: a, dragOverlay: o, transform: s, ...c } = e;
2078
+ if (!t) return;
2079
+ let l = {
2080
+ x: o.rect.left - a.rect.left,
2081
+ y: o.rect.top - a.rect.top
2082
+ }, u = {
2083
+ scaleX: s.scaleX === 1 ? 1 : a.rect.width * s.scaleX / o.rect.width,
2084
+ scaleY: s.scaleY === 1 ? 1 : a.rect.height * s.scaleY / o.rect.height
2085
+ }, d = {
2086
+ x: s.x - l.x,
2087
+ y: s.y - l.y,
2088
+ ...u
2089
+ }, f = i({
2090
+ ...c,
2091
+ active: a,
2092
+ dragOverlay: o,
2093
+ transform: {
2094
+ initial: s,
2095
+ final: d
2096
+ }
2097
+ }), [p] = f, m = f[f.length - 1];
2098
+ if (JSON.stringify(p) === JSON.stringify(m)) return;
2099
+ let h = r?.({
2100
+ active: a,
2101
+ dragOverlay: o,
2102
+ ...c
2103
+ }), g = o.node.animate(f, {
2104
+ duration: t,
2105
+ easing: n,
2106
+ fill: "forwards"
2107
+ });
2108
+ return new Promise((e) => {
2109
+ g.onfinish = () => {
2110
+ h?.(), e();
2111
+ };
2112
+ });
2113
+ };
2114
+ }
2115
+ var Cn = 0;
2116
+ function wn(e) {
2117
+ return l(() => {
2118
+ if (e != null) return Cn++, Cn;
2119
+ }, [e]);
2120
+ }
2121
+ var Tn = /* @__PURE__ */ e.memo((t) => {
2122
+ let { adjustScale: n = !1, children: r, dropAnimation: i, style: a, transition: s, modifiers: c, wrapperElement: l = "div", className: u, zIndex: d = 999 } = t, { activatorEvent: f, active: p, activeNodeRect: m, containerNodeRect: h, draggableNodes: g, droppableContainers: _, dragOverlay: v, over: y, measuringConfiguration: b, scrollableAncestors: x, scrollableAncestorRects: S, windowRect: C } = un(), w = o(nn), T = wn(p?.id), E = $t(c, {
2123
+ activatorEvent: f,
2124
+ active: p,
2125
+ activeNodeRect: m,
2126
+ containerNodeRect: h,
2127
+ draggingNodeRect: v.rect,
2128
+ over: y,
2129
+ overlayNodeRect: v.rect,
2130
+ scrollableAncestors: x,
2131
+ scrollableAncestorRects: S,
2132
+ transform: w,
2133
+ windowRect: C
2134
+ }), D = wt(m), O = xn({
2135
+ config: i,
2136
+ draggableNodes: g,
2137
+ droppableContainers: _,
2138
+ measuringConfiguration: b
2139
+ }), k = D ? v.setRef : void 0;
2140
+ return e.createElement(gn, null, e.createElement(mn, { animation: O }, p && T ? e.createElement(yn, {
2141
+ key: T,
2142
+ id: p.id,
2143
+ ref: k,
2144
+ as: l,
2145
+ activatorEvent: f,
2146
+ adjustScale: n,
2147
+ className: u,
2148
+ transition: s,
2149
+ rect: D,
2150
+ style: {
2151
+ zIndex: d,
2152
+ ...a
2153
+ },
2154
+ transform: E
2155
+ }, r) : null));
2156
+ });
2157
+ //#endregion
2158
+ //#region node_modules/@dnd-kit/sortable/dist/sortable.esm.js
2159
+ function En(e, t, n) {
2160
+ let r = e.slice();
2161
+ return r.splice(n < 0 ? r.length + n : n, 0, r.splice(t, 1)[0]), r;
2162
+ }
2163
+ function Dn(e, t) {
2164
+ return e.reduce((e, n, r) => {
2165
+ let i = t.get(n);
2166
+ return i && (e[r] = i), e;
2167
+ }, Array(e.length));
2168
+ }
2169
+ function On(e) {
2170
+ return e !== null && e >= 0;
2171
+ }
2172
+ function kn(e, t) {
2173
+ if (e === t) return !0;
2174
+ if (e.length !== t.length) return !1;
2175
+ for (let n = 0; n < e.length; n++) if (e[n] !== t[n]) return !1;
2176
+ return !0;
2177
+ }
2178
+ function An(e) {
2179
+ return typeof e == "boolean" ? {
2180
+ draggable: e,
2181
+ droppable: e
2182
+ } : e;
2183
+ }
2184
+ var jn = (e) => {
2185
+ let { rects: t, activeIndex: n, overIndex: r, index: i } = e, a = En(t, r, n), o = t[i], s = a[i];
2186
+ return !s || !o ? null : {
2187
+ x: s.left - o.left,
2188
+ y: s.top - o.top,
2189
+ scaleX: s.width / o.width,
2190
+ scaleY: s.height / o.height
2191
+ };
2192
+ }, Mn = {
2193
+ scaleX: 1,
2194
+ scaleY: 1
2195
+ }, Nn = (e) => {
2196
+ let { activeIndex: t, activeNodeRect: n, index: r, rects: i, overIndex: a } = e, o = i[t] ?? n;
2197
+ if (!o) return null;
2198
+ if (r === t) {
2199
+ let e = i[a];
2200
+ return e ? {
2201
+ x: 0,
2202
+ y: t < a ? e.top + e.height - (o.top + o.height) : e.top - o.top,
2203
+ ...Mn
2204
+ } : null;
2205
+ }
2206
+ let s = Pn(i, r, t);
2207
+ return r > t && r <= a ? {
2208
+ x: 0,
2209
+ y: -o.height - s,
2210
+ ...Mn
2211
+ } : r < t && r >= a ? {
2212
+ x: 0,
2213
+ y: o.height + s,
2214
+ ...Mn
2215
+ } : {
2216
+ x: 0,
2217
+ y: 0,
2218
+ ...Mn
2219
+ };
2220
+ };
2221
+ function Pn(e, t, n) {
2222
+ let r = e[t], i = e[t - 1], a = e[t + 1];
2223
+ return r ? n < t ? i ? r.top - (i.top + i.height) : a ? a.top - (r.top + r.height) : 0 : a ? a.top - (r.top + r.height) : i ? r.top - (i.top + i.height) : 0 : 0;
2224
+ }
2225
+ var Fn = "Sortable", In = /* @__PURE__ */ e.createContext({
2226
+ activeIndex: -1,
2227
+ containerId: Fn,
2228
+ disableTransforms: !1,
2229
+ items: [],
2230
+ overIndex: -1,
2231
+ useDragOverlay: !1,
2232
+ sortedRects: [],
2233
+ strategy: jn,
2234
+ disabled: {
2235
+ draggable: !1,
2236
+ droppable: !1
2237
+ }
2238
+ });
2239
+ function Ln(t) {
2240
+ let { children: n, id: r, items: i, strategy: a = jn, disabled: o = !1 } = t, { active: c, dragOverlay: u, droppableRects: f, over: p, measureDroppableContainers: m } = un(), h = te(Fn, r), g = u.rect !== null, _ = l(() => i.map((e) => typeof e == "object" && "id" in e ? e.id : e), [i]), v = c != null, y = c ? _.indexOf(c.id) : -1, b = p ? _.indexOf(p.id) : -1, x = d(_), S = !kn(_, x.current), C = b !== -1 && y === -1 || S, w = An(o);
2241
+ E(() => {
2242
+ S && v && m(_);
2243
+ }, [
2244
+ S,
2245
+ _,
2246
+ v,
2247
+ m
2248
+ ]), s(() => {
2249
+ x.current = _;
2250
+ }, [_]);
2251
+ let T = l(() => ({
2252
+ activeIndex: y,
2253
+ containerId: h,
2254
+ disabled: w,
2255
+ disableTransforms: C,
2256
+ items: _,
2257
+ overIndex: b,
2258
+ useDragOverlay: g,
2259
+ sortedRects: Dn(_, f),
2260
+ strategy: a
2261
+ }), [
2262
+ y,
2263
+ h,
2264
+ w.draggable,
2265
+ w.droppable,
2266
+ C,
2267
+ _,
2268
+ b,
2269
+ f,
2270
+ g,
2271
+ a
2272
+ ]);
2273
+ return e.createElement(In.Provider, { value: T }, n);
2274
+ }
2275
+ var Rn = (e) => {
2276
+ let { id: t, items: n, activeIndex: r, overIndex: i } = e;
2277
+ return En(n, r, i).indexOf(t);
2278
+ }, zn = (e) => {
2279
+ let { containerId: t, isSorting: n, wasDragging: r, index: i, items: a, newIndex: o, previousItems: s, previousContainerId: c, transition: l } = e;
2280
+ return !l || !r || s !== a && i === o ? !1 : n ? !0 : o !== i && t === c;
2281
+ }, Bn = {
2282
+ duration: 200,
2283
+ easing: "ease"
2284
+ }, Vn = "transform", Hn = /* @__PURE__ */ I.Transition.toString({
2285
+ property: Vn,
2286
+ duration: 0,
2287
+ easing: "linear"
2288
+ }), Un = { roleDescription: "sortable" };
2289
+ function Wn(e) {
2290
+ let { disabled: t, index: n, node: r, rect: i } = e, [a, o] = f(null), c = d(n);
2291
+ return E(() => {
2292
+ if (!t && n !== c.current && r.current) {
2293
+ let e = i.current;
2294
+ if (e) {
2295
+ let t = Oe(r.current, { ignoreTransform: !0 }), n = {
2296
+ x: e.left - t.left,
2297
+ y: e.top - t.top,
2298
+ scaleX: e.width / t.width,
2299
+ scaleY: e.height / t.height
2300
+ };
2301
+ (n.x || n.y) && o(n);
2302
+ }
2303
+ }
2304
+ n !== c.current && (c.current = n);
2305
+ }, [
2306
+ t,
2307
+ n,
2308
+ r,
2309
+ i
2310
+ ]), s(() => {
2311
+ a && o(null);
2312
+ }, [a]), a;
2313
+ }
2314
+ function Gn(e) {
2315
+ let { animateLayoutChanges: t = zn, attributes: n, disabled: r, data: i, getNewIndex: a = Rn, id: c, strategy: u, resizeObserverConfig: f, transition: p = Bn } = e, { items: m, containerId: h, activeIndex: g, disabled: v, disableTransforms: y, sortedRects: b, overIndex: x, useDragOverlay: S, strategy: C } = o(In), w = Kn(r, v), T = m.indexOf(c), E = l(() => ({
2316
+ sortable: {
2317
+ containerId: h,
2318
+ index: T,
2319
+ items: m
2320
+ },
2321
+ ...i
2322
+ }), [
2323
+ h,
2324
+ i,
2325
+ T,
2326
+ m
2327
+ ]), D = l(() => m.slice(m.indexOf(c)), [m, c]), { rect: O, node: k, isOver: A, setNodeRef: j } = pn({
2328
+ id: c,
2329
+ data: E,
2330
+ disabled: w.droppable,
2331
+ resizeObserverConfig: {
2332
+ updateMeasurementsFor: D,
2333
+ ...f
2334
+ }
2335
+ }), { active: M, activatorEvent: ee, activeNodeRect: te, attributes: N, setNodeRef: ne, listeners: P, isDragging: re, over: F, setActivatorNodeRef: ae, transform: L } = ln({
2336
+ id: c,
2337
+ data: E,
2338
+ attributes: {
2339
+ ...Un,
2340
+ ...n
2341
+ },
2342
+ disabled: w.draggable
2343
+ }), oe = _(j, ne), R = !!M, z = R && !y && On(g) && On(x), B = !S && re, se = z ? (B && z ? L : null) ?? (u ?? C)({
2344
+ rects: b,
2345
+ activeNodeRect: te,
2346
+ activeIndex: g,
2347
+ overIndex: x,
2348
+ index: T
2349
+ }) : null, ce = On(g) && On(x) ? a({
2350
+ id: c,
2351
+ items: m,
2352
+ activeIndex: g,
2353
+ overIndex: x
2354
+ }) : T, V = M?.id, H = d({
2355
+ activeId: V,
2356
+ items: m,
2357
+ newIndex: ce,
2358
+ containerId: h
2359
+ }), U = m !== H.current.items, le = t({
2360
+ active: M,
2361
+ containerId: h,
2362
+ isDragging: re,
2363
+ isSorting: R,
2364
+ id: c,
2365
+ index: T,
2366
+ items: m,
2367
+ newIndex: H.current.newIndex,
2368
+ previousItems: H.current.items,
2369
+ previousContainerId: H.current.containerId,
2370
+ transition: p,
2371
+ wasDragging: H.current.activeId != null
2372
+ }), ue = Wn({
2373
+ disabled: !le,
2374
+ index: T,
2375
+ node: k,
2376
+ rect: O
2377
+ });
2378
+ return s(() => {
2379
+ R && H.current.newIndex !== ce && (H.current.newIndex = ce), h !== H.current.containerId && (H.current.containerId = h), m !== H.current.items && (H.current.items = m);
2380
+ }, [
2381
+ R,
2382
+ ce,
2383
+ h,
2384
+ m
2385
+ ]), s(() => {
2386
+ if (V === H.current.activeId) return;
2387
+ if (V != null && H.current.activeId == null) {
2388
+ H.current.activeId = V;
2389
+ return;
2390
+ }
2391
+ let e = setTimeout(() => {
2392
+ H.current.activeId = V;
2393
+ }, 50);
2394
+ return () => clearTimeout(e);
2395
+ }, [V]), {
2396
+ active: M,
2397
+ activeIndex: g,
2398
+ attributes: N,
2399
+ data: E,
2400
+ rect: O,
2401
+ index: T,
2402
+ newIndex: ce,
2403
+ items: m,
2404
+ isOver: A,
2405
+ isSorting: R,
2406
+ isDragging: re,
2407
+ listeners: P,
2408
+ node: k,
2409
+ overIndex: x,
2410
+ over: F,
2411
+ setNodeRef: oe,
2412
+ setActivatorNodeRef: ae,
2413
+ setDroppableNodeRef: j,
2414
+ setDraggableNodeRef: ne,
2415
+ transform: ue ?? se,
2416
+ transition: W()
2417
+ };
2418
+ function W() {
2419
+ if (ue || U && H.current.newIndex === T) return Hn;
2420
+ if (!(B && !ie(ee) || !p) && (R || le)) return I.Transition.toString({
2421
+ ...p,
2422
+ property: Vn
2423
+ });
2424
+ }
2425
+ }
2426
+ function Kn(e, t) {
2427
+ return typeof e == "boolean" ? {
2428
+ draggable: e,
2429
+ droppable: !1
2430
+ } : {
2431
+ draggable: e?.draggable ?? t.draggable,
2432
+ droppable: e?.droppable ?? t.droppable
2433
+ };
2434
+ }
2435
+ function qn(e) {
2436
+ if (!e) return !1;
2437
+ let t = e.data.current;
2438
+ return !!(t && "sortable" in t && typeof t.sortable == "object" && "containerId" in t.sortable && "items" in t.sortable && "index" in t.sortable);
2439
+ }
2440
+ var Jn = [
2441
+ $.Down,
2442
+ $.Right,
2443
+ $.Up,
2444
+ $.Left
2445
+ ], Yn = (e, t) => {
2446
+ let { context: { active: n, collisionRect: r, droppableRects: i, droppableContainers: a, over: o, scrollableAncestors: s } } = t;
2447
+ if (Jn.includes(e.code)) {
2448
+ if (e.preventDefault(), !n || !r) return;
2449
+ let t = [];
2450
+ a.getEnabled().forEach((n) => {
2451
+ if (!n || n != null && n.disabled) return;
2452
+ let a = i.get(n.id);
2453
+ if (a) switch (e.code) {
2454
+ case $.Down:
2455
+ r.top < a.top && t.push(n);
2456
+ break;
2457
+ case $.Up:
2458
+ r.top > a.top && t.push(n);
2459
+ break;
2460
+ case $.Left:
2461
+ r.left > a.left && t.push(n);
2462
+ break;
2463
+ case $.Right:
2464
+ r.left < a.left && t.push(n);
2465
+ break;
2466
+ }
2467
+ });
2468
+ let c = ye({
2469
+ active: n,
2470
+ collisionRect: r,
2471
+ droppableRects: i,
2472
+ droppableContainers: t,
2473
+ pointerCoordinates: null
2474
+ }), l = ge(c, "id");
2475
+ if (l === o?.id && c.length > 1 && (l = c[1].id), l != null) {
2476
+ let e = a.get(n.id), t = a.get(l), o = t ? i.get(t.id) : null, c = t?.node.current;
2477
+ if (c && o && e && t) {
2478
+ let n = X(c).some((e, t) => s[t] !== e), i = Xn(e, t), a = Zn(e, t), l = n || !i ? {
2479
+ x: 0,
2480
+ y: 0
2481
+ } : {
2482
+ x: a ? r.width - o.width : 0,
2483
+ y: a ? r.height - o.height : 0
2484
+ }, u = {
2485
+ x: o.left,
2486
+ y: o.top
2487
+ };
2488
+ return l.x && l.y ? u : P(u, l);
2489
+ }
2490
+ }
2491
+ }
2492
+ };
2493
+ function Xn(e, t) {
2494
+ return !qn(e) || !qn(t) ? !1 : e.data.current.sortable.containerId === t.data.current.sortable.containerId;
2495
+ }
2496
+ function Zn(e, t) {
2497
+ return !qn(e) || !qn(t) || !Xn(e, t) ? !1 : e.data.current.sortable.index < t.data.current.sortable.index;
2498
+ }
2499
+ //#endregion
2500
+ //#region node_modules/@dnd-kit/modifiers/dist/modifiers.esm.js
2501
+ var Qn = (e) => {
2502
+ let { transform: t } = e;
2503
+ return {
2504
+ ...t,
2505
+ x: 0
2506
+ };
2507
+ }, $n = {
2508
+ text: "Aa",
2509
+ textarea: "≡",
2510
+ select: "▾",
2511
+ checkbox: "☑",
2512
+ date: "📅",
2513
+ file: "📎",
2514
+ rating: "★",
2515
+ email: "@",
2516
+ number: "#"
2517
+ };
2518
+ function er(e) {
2519
+ return $n[e] ?? "?";
2520
+ }
2521
+ function tr({ field: e, onRemove: t }) {
2522
+ let { attributes: n, listeners: r, setNodeRef: i, transform: a, transition: o, isDragging: s } = Gn({ id: e.id });
2523
+ return /* @__PURE__ */ m("div", {
2524
+ ref: i,
2525
+ style: {
2526
+ transform: a ? `translate3d(${String(a.x)}px, ${String(a.y)}px, 0)` : void 0,
2527
+ transition: o ?? void 0,
2528
+ opacity: s ? .4 : 1
2529
+ },
2530
+ className: `flex items-center gap-3 rounded-md border p-3 ${s ? "border-accent bg-background shadow-md" : "border-border bg-background"}`,
2531
+ children: [
2532
+ /* @__PURE__ */ p("button", {
2533
+ type: "button",
2534
+ className: "text-muted-foreground flex-none cursor-grab text-base leading-none select-none",
2535
+ "aria-label": "Arrastar campo",
2536
+ ...n,
2537
+ ...r,
2538
+ children: "⠇"
2539
+ }),
2540
+ /* @__PURE__ */ p("span", {
2541
+ className: "bg-muted flex h-8 w-8 flex-none items-center justify-center rounded text-sm",
2542
+ children: er(e.type)
2543
+ }),
2544
+ /* @__PURE__ */ m("div", {
2545
+ className: "min-w-0 flex-1",
2546
+ children: [
2547
+ /* @__PURE__ */ p("span", {
2548
+ className: "text-foreground truncate text-sm font-medium",
2549
+ children: e.label
2550
+ }),
2551
+ e.required && /* @__PURE__ */ p("span", {
2552
+ className: "text-destructive ml-0.5 text-sm",
2553
+ "aria-label": "Obrigatório",
2554
+ children: "*"
2555
+ }),
2556
+ /* @__PURE__ */ p("span", {
2557
+ className: "text-muted-foreground ml-2 text-xs",
2558
+ children: e.type
2559
+ })
2560
+ ]
2561
+ }),
2562
+ /* @__PURE__ */ p("button", {
2563
+ type: "button",
2564
+ onClick: () => {
2565
+ t(e.id);
2566
+ },
2567
+ className: "text-muted-foreground hover:text-destructive flex h-6 w-6 flex-none items-center justify-center rounded text-sm transition-colors",
2568
+ "aria-label": "Remover campo",
2569
+ children: "×"
2570
+ })
2571
+ ]
2572
+ });
2573
+ }
2574
+ function nr({ field: e }) {
2575
+ return /* @__PURE__ */ m("div", {
2576
+ className: "border-accent bg-background flex items-center gap-3 rounded-md border p-3 shadow-md",
2577
+ children: [
2578
+ /* @__PURE__ */ p("span", {
2579
+ className: "text-muted-foreground flex-none text-base leading-none select-none",
2580
+ children: "⠇"
2581
+ }),
2582
+ /* @__PURE__ */ p("span", {
2583
+ className: "bg-muted flex h-8 w-8 flex-none items-center justify-center rounded text-sm",
2584
+ children: er(e.type)
2585
+ }),
2586
+ /* @__PURE__ */ m("div", {
2587
+ className: "min-w-0 flex-1",
2588
+ children: [/* @__PURE__ */ p("span", {
2589
+ className: "text-foreground text-sm font-medium",
2590
+ children: e.label
2591
+ }), e.required && /* @__PURE__ */ p("span", {
2592
+ className: "text-destructive ml-0.5 text-sm",
2593
+ children: "*"
2594
+ })]
2595
+ })
2596
+ ]
2597
+ });
2598
+ }
2599
+ function rr({ field: e }) {
2600
+ let t = /* @__PURE__ */ m("label", {
2601
+ className: "text-foreground mb-1 block text-xs font-medium",
2602
+ children: [e.label, e.required && /* @__PURE__ */ p("span", {
2603
+ className: "text-destructive ml-0.5",
2604
+ children: "*"
2605
+ })]
2606
+ });
2607
+ switch (e.type) {
2608
+ case "textarea": return /* @__PURE__ */ m("div", { children: [t, /* @__PURE__ */ p("div", { className: "border-border bg-background h-16 rounded-md border px-2 py-1 text-xs" })] });
2609
+ case "select": return /* @__PURE__ */ m("div", { children: [t, /* @__PURE__ */ m("div", {
2610
+ className: "border-border bg-background text-muted-foreground flex items-center justify-between rounded-md border px-2 py-1.5 text-xs",
2611
+ children: [/* @__PURE__ */ p("span", { children: "Selecione..." }), /* @__PURE__ */ p("span", {
2612
+ className: "text-[10px]",
2613
+ children: "▾"
2614
+ })]
2615
+ })] });
2616
+ case "checkbox": return /* @__PURE__ */ m("div", {
2617
+ className: "flex items-center gap-2",
2618
+ children: [/* @__PURE__ */ p("div", { className: "border-border h-4 w-4 rounded border" }), /* @__PURE__ */ p("span", {
2619
+ className: "text-foreground text-xs",
2620
+ children: e.label
2621
+ })]
2622
+ });
2623
+ case "rating": return /* @__PURE__ */ m("div", { children: [t, /* @__PURE__ */ p("div", {
2624
+ className: "flex gap-1",
2625
+ children: [
2626
+ 1,
2627
+ 2,
2628
+ 3,
2629
+ 4,
2630
+ 5
2631
+ ].map((e) => /* @__PURE__ */ p("span", {
2632
+ className: "text-muted-foreground/40 text-sm",
2633
+ children: "★"
2634
+ }, e))
2635
+ })] });
2636
+ case "file": return /* @__PURE__ */ m("div", { children: [t, /* @__PURE__ */ p("div", {
2637
+ className: "border-border text-muted-foreground flex items-center justify-center rounded-md border border-dashed px-2 py-3 text-xs",
2638
+ children: "Clique ou arraste um arquivo"
2639
+ })] });
2640
+ default: return /* @__PURE__ */ m("div", { children: [t, /* @__PURE__ */ p("div", {
2641
+ className: "border-border bg-background rounded-md border px-2 py-1.5 text-xs",
2642
+ children: e.placeholder ? /* @__PURE__ */ p("span", {
2643
+ className: "text-muted-foreground",
2644
+ children: e.placeholder
2645
+ }) : /* @__PURE__ */ p("span", { children: "\xA0" })
2646
+ })] });
2647
+ }
2648
+ }
2649
+ function ir({ block: e }) {
2650
+ let { data: t } = e, [n, r] = f(t.fields), [i, o] = f(null), s = G(fe(st, { activationConstraint: { distance: 5 } }), fe(nt, { coordinateGetter: Yn })), c = a((e) => {
2651
+ o(String(e.active.id));
2652
+ }, []), l = a((e) => {
2653
+ o(null);
2654
+ let { active: t, over: n } = e;
2655
+ n && t.id !== n.id && r((e) => En(e, e.findIndex((e) => e.id === t.id), e.findIndex((e) => e.id === n.id)));
2656
+ }, []), u = a((e) => {
2657
+ r((t) => t.filter((t) => t.id !== e));
2658
+ }, []), d = i ? n.find((e) => e.id === i) : null;
2659
+ return /* @__PURE__ */ m("div", {
2660
+ className: "flex min-h-[400px] gap-4",
2661
+ children: [
2662
+ /* @__PURE__ */ m("div", {
2663
+ className: "w-[200px] flex-none",
2664
+ children: [/* @__PURE__ */ p("h3", {
2665
+ className: "text-foreground mb-3 text-sm font-semibold",
2666
+ children: "Campos Disponíveis"
2667
+ }), /* @__PURE__ */ p("div", {
2668
+ className: "grid grid-cols-2 gap-2",
2669
+ children: t.availableTypes.map((e) => /* @__PURE__ */ m("div", {
2670
+ className: "bg-background hover:border-accent cursor-grab rounded-md border p-2 text-center text-xs transition-colors",
2671
+ children: [/* @__PURE__ */ p("div", {
2672
+ className: "mb-1 text-base leading-none",
2673
+ children: e.icon
2674
+ }), /* @__PURE__ */ p("span", {
2675
+ className: "text-foreground",
2676
+ children: e.label
2677
+ })]
2678
+ }, e.type))
2679
+ })]
2680
+ }),
2681
+ /* @__PURE__ */ m("div", {
2682
+ className: "min-w-0 flex-1",
2683
+ children: [/* @__PURE__ */ m("div", {
2684
+ className: "mb-3 flex items-center justify-between",
2685
+ children: [/* @__PURE__ */ p("h3", {
2686
+ className: "text-foreground text-sm font-semibold",
2687
+ children: "Campos do Formulário"
2688
+ }), /* @__PURE__ */ m("span", {
2689
+ className: "text-muted-foreground text-xs",
2690
+ children: [
2691
+ n.length,
2692
+ " ",
2693
+ n.length === 1 ? "campo" : "campos"
2694
+ ]
2695
+ })]
2696
+ }), /* @__PURE__ */ m(an, {
2697
+ sensors: s,
2698
+ collisionDetection: ve,
2699
+ modifiers: [Qn],
2700
+ onDragStart: c,
2701
+ onDragEnd: l,
2702
+ children: [/* @__PURE__ */ p(Ln, {
2703
+ items: n.map((e) => e.id),
2704
+ strategy: Nn,
2705
+ children: n.length > 0 ? /* @__PURE__ */ p("div", {
2706
+ className: "space-y-2",
2707
+ children: n.map((e) => /* @__PURE__ */ p(tr, {
2708
+ field: e,
2709
+ onRemove: u
2710
+ }, e.id))
2711
+ }) : /* @__PURE__ */ p("div", {
2712
+ className: "border-border text-muted-foreground flex min-h-[200px] items-center justify-center rounded-lg border border-dashed text-sm",
2713
+ children: "Arraste campos da paleta para cá"
2714
+ })
2715
+ }), /* @__PURE__ */ p(Tn, { children: d ? /* @__PURE__ */ p(nr, { field: d }) : null })]
2716
+ })]
2717
+ }),
2718
+ /* @__PURE__ */ m("div", {
2719
+ className: "w-[280px] flex-none",
2720
+ children: [/* @__PURE__ */ p("h3", {
2721
+ className: "text-foreground mb-3 text-sm font-semibold",
2722
+ children: "Preview"
2723
+ }), /* @__PURE__ */ p("div", {
2724
+ className: "bg-muted/30 space-y-3 rounded-lg border p-4",
2725
+ children: n.length > 0 ? n.map((e) => /* @__PURE__ */ p(rr, { field: e }, e.id)) : /* @__PURE__ */ p("p", {
2726
+ className: "text-muted-foreground text-center text-xs",
2727
+ children: "Nenhum campo adicionado"
2728
+ })
2729
+ })]
2730
+ })
2731
+ ]
2732
+ });
2733
+ }
2734
+ //#endregion
2735
+ export { ir as FormBuilderBlock };