quantum-component-library 0.0.1 → 1.0.0-qa

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 (119) hide show
  1. package/README.md +115 -69
  2. package/dist/babel-vendor-BOM86iTb.js +221 -0
  3. package/dist/babel-vendor-cKvSpnBp.cjs +3 -0
  4. package/dist/components/activity-list/index.d.ts +19 -0
  5. package/dist/components/copy-activity-form/index.d.ts +30 -0
  6. package/dist/components/copy-activity-form/index.stories.d.ts +6 -0
  7. package/dist/components/copy-module-form/index.d.ts +30 -0
  8. package/dist/components/copy-module-form/index.stories.d.ts +6 -0
  9. package/dist/components/index.d.ts +8 -0
  10. package/dist/components/module-form/index.d.ts +15 -0
  11. package/dist/components/parameter-edit-list/index.d.ts +13 -0
  12. package/dist/components/parameter-edit-select/index.d.ts +16 -0
  13. package/dist/components/test-filter-panel/index.d.ts +7 -0
  14. package/dist/components/ui/form/index.d.ts +4 -0
  15. package/dist/components/ui/form/label/index.d.ts +4 -0
  16. package/dist/components/ui/form/list-order-input/index.d.ts +14 -0
  17. package/dist/components/ui/form/radio-buttons/index.d.ts +16 -0
  18. package/dist/components/ui/form/range-slider-input/index.d.ts +17 -0
  19. package/dist/components/ui/index.d.ts +2 -1
  20. package/dist/components/ui/tag-group/index.d.ts +7 -0
  21. package/dist/components/upsert-activity-form/index.d.ts +18 -0
  22. package/dist/components/upsert-activity-form/index.stories.d.ts +6 -0
  23. package/dist/components/upsert-module-form/index.d.ts +17 -0
  24. package/dist/components/upsert-module-form/index.stories.d.ts +6 -0
  25. package/dist/components.cjs +13 -0
  26. package/dist/components.js +2078 -0
  27. package/dist/dnd-core-vendor-bgjKfDi6.cjs +1 -0
  28. package/dist/dnd-core-vendor-q7mfiuVu.js +750 -0
  29. package/dist/generated/fragment-masking.d.ts +19 -0
  30. package/dist/generated/gql.d.ts +271 -0
  31. package/dist/generated/graphql.d.ts +2326 -0
  32. package/dist/generated/index.d.ts +2 -0
  33. package/dist/generated-ChsGaiYd.cjs +1 -0
  34. package/dist/generated-GfcSQz21.js +65 -0
  35. package/dist/graphql/fragments/actions.d.ts +1 -0
  36. package/dist/graphql/fragments/analysis.d.ts +12 -0
  37. package/dist/graphql/fragments/groups.d.ts +1 -0
  38. package/dist/graphql/fragments/index.d.ts +6 -0
  39. package/dist/graphql/fragments/modules.d.ts +3 -0
  40. package/dist/graphql/fragments/playback.d.ts +11 -0
  41. package/dist/graphql/fragments/session.d.ts +3 -0
  42. package/dist/graphql/index.d.ts +3 -0
  43. package/dist/graphql/mutations/actions.d.ts +7 -0
  44. package/dist/graphql/mutations/index.d.ts +2 -0
  45. package/dist/graphql/mutations/modules.d.ts +13 -0
  46. package/dist/graphql/queries/actions.d.ts +19 -0
  47. package/dist/graphql/queries/groups.d.ts +9 -0
  48. package/dist/graphql/queries/index.d.ts +3 -0
  49. package/dist/graphql/queries/modules.d.ts +9 -0
  50. package/dist/graphql-CqPvuCvr.cjs +679 -0
  51. package/dist/graphql-DiUes2Np.js +735 -0
  52. package/dist/graphql-vendor-JsvuUrRs.cjs +14 -0
  53. package/dist/graphql-vendor-YnA_qhJA.js +669 -0
  54. package/dist/hooks.cjs +1 -0
  55. package/dist/hooks.js +84 -0
  56. package/dist/index.cjs +1 -0
  57. package/dist/index.d.ts +6 -1
  58. package/dist/index.js +132 -3159
  59. package/dist/lib/hooks/index.d.ts +7 -0
  60. package/dist/lib/hooks/use-graphql-client.d.ts +5 -0
  61. package/dist/lib/hooks/use-joints-for-limb-ids.d.ts +2 -0
  62. package/dist/lib/hooks/use-joints-for-sensor-locations.d.ts +2 -0
  63. package/dist/lib/hooks/use-limbs-for-sensor-locations.d.ts +2 -0
  64. package/dist/lib/hooks/use-part-options-for-joints.d.ts +3 -0
  65. package/dist/lib/hooks/use-part-options-for-limbs.d.ts +3 -0
  66. package/dist/lib/hooks/use-part-options-for-sensor-locations.d.ts +3 -0
  67. package/dist/lib/services/human.d.ts +69 -0
  68. package/dist/lib/services/index.d.ts +1 -0
  69. package/dist/lib/services/rom.json.d.ts +226 -0
  70. package/dist/lib/types/activity.d.ts +19 -0
  71. package/dist/lib/types/analysis.d.ts +115 -0
  72. package/dist/lib/types/athlete.d.ts +8 -0
  73. package/dist/lib/types/catalog.d.ts +35 -0
  74. package/dist/lib/types/error.d.ts +4 -0
  75. package/dist/lib/types/human-part.d.ts +23 -0
  76. package/dist/lib/types/human.d.ts +147 -0
  77. package/dist/lib/types/index.d.ts +14 -0
  78. package/dist/lib/types/parameters.d.ts +10 -0
  79. package/dist/lib/types/playback.d.ts +20 -0
  80. package/dist/lib/types/recording.d.ts +5 -0
  81. package/dist/lib/types/sensor-info.d.ts +105 -0
  82. package/dist/lib/types/threshold.d.ts +30 -0
  83. package/dist/lib/types/tracking.d.ts +82 -0
  84. package/dist/lib/types/upload.d.ts +28 -0
  85. package/dist/lib/utils/conversion.d.ts +27 -0
  86. package/dist/lib/utils/index.d.ts +6 -0
  87. package/dist/lib/utils/memo.d.ts +7 -0
  88. package/dist/lib/utils/parameters.d.ts +6 -0
  89. package/dist/lib/utils/text.d.ts +2 -0
  90. package/dist/lodash-vendor-D5A6v3mw.cjs +1 -0
  91. package/dist/lodash-vendor-Dz4vW7Gd.js +1120 -0
  92. package/dist/other-CmpBz5tg.js +15 -0
  93. package/dist/other-TR0ap-t4.cjs +1 -0
  94. package/dist/providers/index.d.ts +1 -0
  95. package/dist/providers/quantum-library-provider.d.ts +8 -0
  96. package/dist/providers.cjs +1 -0
  97. package/dist/providers.js +11 -0
  98. package/dist/quantum-component-library.css +1 -0
  99. package/dist/react-dnd-vendor-BWqlt2EC.cjs +2 -0
  100. package/dist/react-dnd-vendor-BZs2igAJ.js +1375 -0
  101. package/dist/react-icons-vendor-D2s8zw9h.cjs +1 -0
  102. package/dist/react-icons-vendor-TETORdU9.js +119 -0
  103. package/dist/react-select-vendor-By3h6JjH.cjs +4 -0
  104. package/dist/react-select-vendor-eBH7yy3O.js +2801 -0
  105. package/dist/services.cjs +1 -0
  106. package/dist/services.js +810 -0
  107. package/dist/styled-components-vendor-Bvwhddj9.js +1154 -0
  108. package/dist/styled-components-vendor-D09ATioU.cjs +60 -0
  109. package/dist/types.cjs +1 -0
  110. package/dist/types.js +316 -0
  111. package/dist/utils.cjs +1 -0
  112. package/dist/utils.js +128 -0
  113. package/dist/vendor-BeqUcSbw.cjs +45 -0
  114. package/dist/vendor-DvX9OX-j.js +7876 -0
  115. package/package.json +118 -60
  116. package/dist/components/ui/button.d.ts +0 -10
  117. package/dist/index.css +0 -1
  118. package/dist/index.umd.cjs +0 -22
  119. package/dist/lib/utils.d.ts +0 -2
@@ -0,0 +1,1375 @@
1
+ import { j as oe, e as ae } from "./vendor-DvX9OX-j.js";
2
+ import { createContext as ce, memo as ue, useEffect as y, useLayoutEffect as de, useState as le, useCallback as he, useMemo as p, isValidElement as ge, cloneElement as k, useContext as fe } from "react";
3
+ import { c as pe } from "./dnd-core-vendor-q7mfiuVu.js";
4
+ const X = ce({
5
+ dragDropManager: void 0
6
+ });
7
+ function T(r, e, ...t) {
8
+ if (ve() && e === void 0)
9
+ throw new Error("invariant requires an error message argument");
10
+ if (!r) {
11
+ let i;
12
+ if (e === void 0)
13
+ i = new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");
14
+ else {
15
+ let n = 0;
16
+ i = new Error(e.replace(/%s/g, function() {
17
+ return t[n++];
18
+ })), i.name = "Invariant Violation";
19
+ }
20
+ throw i.framesToPop = 1, i;
21
+ }
22
+ }
23
+ function ve() {
24
+ return typeof process < "u" && process.env.NODE_ENV === "production";
25
+ }
26
+ const F = typeof global < "u" ? global : self, z = F.MutationObserver || F.WebKitMutationObserver;
27
+ function W(r) {
28
+ return function() {
29
+ const t = setTimeout(n, 0), i = setInterval(n, 50);
30
+ function n() {
31
+ clearTimeout(t), clearInterval(i), r();
32
+ }
33
+ };
34
+ }
35
+ function De(r) {
36
+ let e = 1;
37
+ const t = new z(r), i = document.createTextNode("");
38
+ return t.observe(i, {
39
+ characterData: !0
40
+ }), function() {
41
+ e = -e, i.data = e;
42
+ };
43
+ }
44
+ const me = typeof z == "function" ? (
45
+ // reliably everywhere they are implemented.
46
+ // They are implemented in all modern browsers.
47
+ //
48
+ // - Android 4-4.3
49
+ // - Chrome 26-34
50
+ // - Firefox 14-29
51
+ // - Internet Explorer 11
52
+ // - iPad Safari 6-7.1
53
+ // - iPhone Safari 7-7.1
54
+ // - Safari 6-7
55
+ De
56
+ ) : (
57
+ // task queue, are implemented in Internet Explorer 10, Safari 5.0-1, and Opera
58
+ // 11-12, and in web workers in many engines.
59
+ // Although message channels yield to any queued rendering and IO tasks, they
60
+ // would be better than imposing the 4ms delay of timers.
61
+ // However, they do not work reliably in Internet Explorer or Safari.
62
+ // Internet Explorer 10 is the only browser that has setImmediate but does
63
+ // not have MutationObservers.
64
+ // Although setImmediate yields to the browser's renderer, it would be
65
+ // preferrable to falling back to setTimeout since it does not have
66
+ // the minimum 4ms penalty.
67
+ // Unfortunately there appears to be a bug in Internet Explorer 10 Mobile (and
68
+ // Desktop to a lesser extent) that renders both setImmediate and
69
+ // MessageChannel useless for the purposes of ASAP.
70
+ // https://github.com/kriskowal/q/issues/396
71
+ // Timers are implemented universally.
72
+ // We fall back to timers in workers in most engines, and in foreground
73
+ // contexts in the following browsers.
74
+ // However, note that even this simple case requires nuances to operate in a
75
+ // broad spectrum of browsers.
76
+ //
77
+ // - Firefox 3-13
78
+ // - Internet Explorer 6-9
79
+ // - iPad Safari 4.3
80
+ // - Lynx 2.8.7
81
+ W
82
+ );
83
+ class Te {
84
+ // Use the fastest means possible to execute a task in its own turn, with
85
+ // priority over other events including IO, animation, reflow, and redraw
86
+ // events in browsers.
87
+ //
88
+ // An exception thrown by a task will permanently interrupt the processing of
89
+ // subsequent tasks. The higher level `asap` function ensures that if an
90
+ // exception is thrown by a task, that the task queue will continue flushing as
91
+ // soon as possible, but if you use `rawAsap` directly, you are responsible to
92
+ // either ensure that no exceptions are thrown from your task, or to manually
93
+ // call `rawAsap.requestFlush` if an exception is thrown.
94
+ enqueueTask(e) {
95
+ const { queue: t, requestFlush: i } = this;
96
+ t.length || (i(), this.flushing = !0), t[t.length] = e;
97
+ }
98
+ constructor() {
99
+ this.queue = [], this.pendingErrors = [], this.flushing = !1, this.index = 0, this.capacity = 1024, this.flush = () => {
100
+ const { queue: e } = this;
101
+ for (; this.index < e.length; ) {
102
+ const t = this.index;
103
+ if (this.index++, e[t].call(), this.index > this.capacity) {
104
+ for (let i = 0, n = e.length - this.index; i < n; i++)
105
+ e[i] = e[i + this.index];
106
+ e.length -= this.index, this.index = 0;
107
+ }
108
+ }
109
+ e.length = 0, this.index = 0, this.flushing = !1;
110
+ }, this.registerPendingError = (e) => {
111
+ this.pendingErrors.push(e), this.requestErrorThrow();
112
+ }, this.requestFlush = me(this.flush), this.requestErrorThrow = W(() => {
113
+ if (this.pendingErrors.length)
114
+ throw this.pendingErrors.shift();
115
+ });
116
+ }
117
+ }
118
+ class Ie {
119
+ call() {
120
+ try {
121
+ this.task && this.task();
122
+ } catch (e) {
123
+ this.onError(e);
124
+ } finally {
125
+ this.task = null, this.release(this);
126
+ }
127
+ }
128
+ constructor(e, t) {
129
+ this.onError = e, this.release = t, this.task = null;
130
+ }
131
+ }
132
+ class Se {
133
+ create(e) {
134
+ const t = this.freeTasks, i = t.length ? t.pop() : new Ie(
135
+ this.onError,
136
+ (n) => t[t.length] = n
137
+ );
138
+ return i.task = e, i;
139
+ }
140
+ constructor(e) {
141
+ this.onError = e, this.freeTasks = [];
142
+ }
143
+ }
144
+ const B = new Te(), Oe = new Se(B.registerPendingError);
145
+ function pt(r) {
146
+ B.enqueueTask(Oe.create(r));
147
+ }
148
+ function Ce(r, e) {
149
+ if (r == null) return {};
150
+ var t = we(r, e), i, n;
151
+ if (Object.getOwnPropertySymbols) {
152
+ var s = Object.getOwnPropertySymbols(r);
153
+ for (n = 0; n < s.length; n++)
154
+ i = s[n], !(e.indexOf(i) >= 0) && Object.prototype.propertyIsEnumerable.call(r, i) && (t[i] = r[i]);
155
+ }
156
+ return t;
157
+ }
158
+ function we(r, e) {
159
+ if (r == null) return {};
160
+ var t = {}, i = Object.keys(r), n, s;
161
+ for (s = 0; s < i.length; s++)
162
+ n = i[s], !(e.indexOf(n) >= 0) && (t[n] = r[n]);
163
+ return t;
164
+ }
165
+ let A = 0;
166
+ const E = Symbol.for("__REACT_DND_CONTEXT_INSTANCE__");
167
+ var vt = /* @__PURE__ */ ue(function(e) {
168
+ var { children: t } = e, i = Ce(e, [
169
+ "children"
170
+ ]);
171
+ const [n, s] = Ee(i);
172
+ return y(() => {
173
+ if (s) {
174
+ const a = V();
175
+ return ++A, () => {
176
+ --A === 0 && (a[E] = null);
177
+ };
178
+ }
179
+ }, []), /* @__PURE__ */ oe.jsx(X.Provider, {
180
+ value: n,
181
+ children: t
182
+ });
183
+ });
184
+ function Ee(r) {
185
+ if ("manager" in r)
186
+ return [
187
+ {
188
+ dragDropManager: r.manager
189
+ },
190
+ !1
191
+ ];
192
+ const e = ye(r.backend, r.context, r.options, r.debugMode), t = !r.context;
193
+ return [
194
+ e,
195
+ t
196
+ ];
197
+ }
198
+ function ye(r, e = V(), t, i) {
199
+ const n = e;
200
+ return n[E] || (n[E] = {
201
+ dragDropManager: pe(r, e, t, i)
202
+ }), n[E];
203
+ }
204
+ function V() {
205
+ return typeof global < "u" ? global : window;
206
+ }
207
+ const I = typeof window < "u" ? de : y;
208
+ function be(r, e, t) {
209
+ const [i, n] = le(
210
+ () => e(r)
211
+ ), s = he(() => {
212
+ const a = e(r);
213
+ ae(i, a) || (n(a), t && t());
214
+ }, [
215
+ i,
216
+ r,
217
+ t
218
+ ]);
219
+ return I(s), [
220
+ i,
221
+ s
222
+ ];
223
+ }
224
+ function Pe(r, e, t) {
225
+ const [i, n] = be(r, e, t);
226
+ return I(function() {
227
+ const a = r.getHandlerId();
228
+ if (a != null)
229
+ return r.subscribeToStateChange(n, {
230
+ handlerIds: [
231
+ a
232
+ ]
233
+ });
234
+ }, [
235
+ r,
236
+ n
237
+ ]), i;
238
+ }
239
+ function K(r, e, t) {
240
+ return Pe(
241
+ e,
242
+ r || (() => ({})),
243
+ () => t.reconnect()
244
+ );
245
+ }
246
+ function G(r, e) {
247
+ const t = [];
248
+ return typeof r != "function" && t.push(r), p(() => typeof r == "function" ? r() : r, t);
249
+ }
250
+ function Ne(r) {
251
+ return p(
252
+ () => r.hooks.dragSource(),
253
+ [
254
+ r
255
+ ]
256
+ );
257
+ }
258
+ function Me(r) {
259
+ return p(
260
+ () => r.hooks.dragPreview(),
261
+ [
262
+ r
263
+ ]
264
+ );
265
+ }
266
+ let b = !1, P = !1;
267
+ class xe {
268
+ receiveHandlerId(e) {
269
+ this.sourceId = e;
270
+ }
271
+ getHandlerId() {
272
+ return this.sourceId;
273
+ }
274
+ canDrag() {
275
+ T(!b, "You may not call monitor.canDrag() inside your canDrag() implementation. Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source-monitor");
276
+ try {
277
+ return b = !0, this.internalMonitor.canDragSource(this.sourceId);
278
+ } finally {
279
+ b = !1;
280
+ }
281
+ }
282
+ isDragging() {
283
+ if (!this.sourceId)
284
+ return !1;
285
+ T(!P, "You may not call monitor.isDragging() inside your isDragging() implementation. Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source-monitor");
286
+ try {
287
+ return P = !0, this.internalMonitor.isDraggingSource(this.sourceId);
288
+ } finally {
289
+ P = !1;
290
+ }
291
+ }
292
+ subscribeToStateChange(e, t) {
293
+ return this.internalMonitor.subscribeToStateChange(e, t);
294
+ }
295
+ isDraggingSource(e) {
296
+ return this.internalMonitor.isDraggingSource(e);
297
+ }
298
+ isOverTarget(e, t) {
299
+ return this.internalMonitor.isOverTarget(e, t);
300
+ }
301
+ getTargetIds() {
302
+ return this.internalMonitor.getTargetIds();
303
+ }
304
+ isSourcePublic() {
305
+ return this.internalMonitor.isSourcePublic();
306
+ }
307
+ getSourceId() {
308
+ return this.internalMonitor.getSourceId();
309
+ }
310
+ subscribeToOffsetChange(e) {
311
+ return this.internalMonitor.subscribeToOffsetChange(e);
312
+ }
313
+ canDragSource(e) {
314
+ return this.internalMonitor.canDragSource(e);
315
+ }
316
+ canDropOnTarget(e) {
317
+ return this.internalMonitor.canDropOnTarget(e);
318
+ }
319
+ getItemType() {
320
+ return this.internalMonitor.getItemType();
321
+ }
322
+ getItem() {
323
+ return this.internalMonitor.getItem();
324
+ }
325
+ getDropResult() {
326
+ return this.internalMonitor.getDropResult();
327
+ }
328
+ didDrop() {
329
+ return this.internalMonitor.didDrop();
330
+ }
331
+ getInitialClientOffset() {
332
+ return this.internalMonitor.getInitialClientOffset();
333
+ }
334
+ getInitialSourceClientOffset() {
335
+ return this.internalMonitor.getInitialSourceClientOffset();
336
+ }
337
+ getSourceClientOffset() {
338
+ return this.internalMonitor.getSourceClientOffset();
339
+ }
340
+ getClientOffset() {
341
+ return this.internalMonitor.getClientOffset();
342
+ }
343
+ getDifferenceFromInitialOffset() {
344
+ return this.internalMonitor.getDifferenceFromInitialOffset();
345
+ }
346
+ constructor(e) {
347
+ this.sourceId = null, this.internalMonitor = e.getMonitor();
348
+ }
349
+ }
350
+ let N = !1;
351
+ class Le {
352
+ receiveHandlerId(e) {
353
+ this.targetId = e;
354
+ }
355
+ getHandlerId() {
356
+ return this.targetId;
357
+ }
358
+ subscribeToStateChange(e, t) {
359
+ return this.internalMonitor.subscribeToStateChange(e, t);
360
+ }
361
+ canDrop() {
362
+ if (!this.targetId)
363
+ return !1;
364
+ T(!N, "You may not call monitor.canDrop() inside your canDrop() implementation. Read more: http://react-dnd.github.io/react-dnd/docs/api/drop-target-monitor");
365
+ try {
366
+ return N = !0, this.internalMonitor.canDropOnTarget(this.targetId);
367
+ } finally {
368
+ N = !1;
369
+ }
370
+ }
371
+ isOver(e) {
372
+ return this.targetId ? this.internalMonitor.isOverTarget(this.targetId, e) : !1;
373
+ }
374
+ getItemType() {
375
+ return this.internalMonitor.getItemType();
376
+ }
377
+ getItem() {
378
+ return this.internalMonitor.getItem();
379
+ }
380
+ getDropResult() {
381
+ return this.internalMonitor.getDropResult();
382
+ }
383
+ didDrop() {
384
+ return this.internalMonitor.didDrop();
385
+ }
386
+ getInitialClientOffset() {
387
+ return this.internalMonitor.getInitialClientOffset();
388
+ }
389
+ getInitialSourceClientOffset() {
390
+ return this.internalMonitor.getInitialSourceClientOffset();
391
+ }
392
+ getSourceClientOffset() {
393
+ return this.internalMonitor.getSourceClientOffset();
394
+ }
395
+ getClientOffset() {
396
+ return this.internalMonitor.getClientOffset();
397
+ }
398
+ getDifferenceFromInitialOffset() {
399
+ return this.internalMonitor.getDifferenceFromInitialOffset();
400
+ }
401
+ constructor(e) {
402
+ this.targetId = null, this.internalMonitor = e.getMonitor();
403
+ }
404
+ }
405
+ function Re(r, e, t) {
406
+ const i = t.getRegistry(), n = i.addTarget(r, e);
407
+ return [
408
+ n,
409
+ () => i.removeTarget(n)
410
+ ];
411
+ }
412
+ function He(r, e, t) {
413
+ const i = t.getRegistry(), n = i.addSource(r, e);
414
+ return [
415
+ n,
416
+ () => i.removeSource(n)
417
+ ];
418
+ }
419
+ function L(r, e, t, i) {
420
+ let n;
421
+ if (n !== void 0)
422
+ return !!n;
423
+ if (r === e)
424
+ return !0;
425
+ if (typeof r != "object" || !r || typeof e != "object" || !e)
426
+ return !1;
427
+ const s = Object.keys(r), a = Object.keys(e);
428
+ if (s.length !== a.length)
429
+ return !1;
430
+ const o = Object.prototype.hasOwnProperty.bind(e);
431
+ for (let u = 0; u < s.length; u++) {
432
+ const d = s[u];
433
+ if (!o(d))
434
+ return !1;
435
+ const l = r[d], h = e[d];
436
+ if (n = void 0, n === !1 || n === void 0 && l !== h)
437
+ return !1;
438
+ }
439
+ return !0;
440
+ }
441
+ function R(r) {
442
+ return (
443
+ // eslint-disable-next-line no-prototype-builtins
444
+ r !== null && typeof r == "object" && Object.prototype.hasOwnProperty.call(r, "current")
445
+ );
446
+ }
447
+ function _e(r) {
448
+ if (typeof r.type == "string")
449
+ return;
450
+ const e = r.type.displayName || r.type.name || "the component";
451
+ throw new Error(`Only native element nodes can now be passed to React DnD connectors.You can either wrap ${e} into a <div>, or turn it into a drag source or a drop target itself.`);
452
+ }
453
+ function ke(r) {
454
+ return (e = null, t = null) => {
455
+ if (!ge(e)) {
456
+ const s = e;
457
+ return r(s, t), s;
458
+ }
459
+ const i = e;
460
+ return _e(i), Fe(i, t ? (s) => r(s, t) : r);
461
+ };
462
+ }
463
+ function $(r) {
464
+ const e = {};
465
+ return Object.keys(r).forEach((t) => {
466
+ const i = r[t];
467
+ if (t.endsWith("Ref"))
468
+ e[t] = r[t];
469
+ else {
470
+ const n = ke(i);
471
+ e[t] = () => n;
472
+ }
473
+ }), e;
474
+ }
475
+ function q(r, e) {
476
+ typeof r == "function" ? r(e) : r.current = e;
477
+ }
478
+ function Fe(r, e) {
479
+ const t = r.ref;
480
+ return T(typeof t != "string", "Cannot connect React DnD to an element with an existing string ref. Please convert it to use a callback ref instead, or wrap it into a <span> or <div>. Read more: https://reactjs.org/docs/refs-and-the-dom.html#callback-refs"), t ? k(r, {
481
+ ref: (i) => {
482
+ q(t, i), q(e, i);
483
+ }
484
+ }) : k(r, {
485
+ ref: e
486
+ });
487
+ }
488
+ class Ae {
489
+ receiveHandlerId(e) {
490
+ this.handlerId !== e && (this.handlerId = e, this.reconnect());
491
+ }
492
+ get connectTarget() {
493
+ return this.dragSource;
494
+ }
495
+ get dragSourceOptions() {
496
+ return this.dragSourceOptionsInternal;
497
+ }
498
+ set dragSourceOptions(e) {
499
+ this.dragSourceOptionsInternal = e;
500
+ }
501
+ get dragPreviewOptions() {
502
+ return this.dragPreviewOptionsInternal;
503
+ }
504
+ set dragPreviewOptions(e) {
505
+ this.dragPreviewOptionsInternal = e;
506
+ }
507
+ reconnect() {
508
+ const e = this.reconnectDragSource();
509
+ this.reconnectDragPreview(e);
510
+ }
511
+ reconnectDragSource() {
512
+ const e = this.dragSource, t = this.didHandlerIdChange() || this.didConnectedDragSourceChange() || this.didDragSourceOptionsChange();
513
+ return t && this.disconnectDragSource(), this.handlerId ? e ? (t && (this.lastConnectedHandlerId = this.handlerId, this.lastConnectedDragSource = e, this.lastConnectedDragSourceOptions = this.dragSourceOptions, this.dragSourceUnsubscribe = this.backend.connectDragSource(this.handlerId, e, this.dragSourceOptions)), t) : (this.lastConnectedDragSource = e, t) : t;
514
+ }
515
+ reconnectDragPreview(e = !1) {
516
+ const t = this.dragPreview, i = e || this.didHandlerIdChange() || this.didConnectedDragPreviewChange() || this.didDragPreviewOptionsChange();
517
+ if (i && this.disconnectDragPreview(), !!this.handlerId) {
518
+ if (!t) {
519
+ this.lastConnectedDragPreview = t;
520
+ return;
521
+ }
522
+ i && (this.lastConnectedHandlerId = this.handlerId, this.lastConnectedDragPreview = t, this.lastConnectedDragPreviewOptions = this.dragPreviewOptions, this.dragPreviewUnsubscribe = this.backend.connectDragPreview(this.handlerId, t, this.dragPreviewOptions));
523
+ }
524
+ }
525
+ didHandlerIdChange() {
526
+ return this.lastConnectedHandlerId !== this.handlerId;
527
+ }
528
+ didConnectedDragSourceChange() {
529
+ return this.lastConnectedDragSource !== this.dragSource;
530
+ }
531
+ didConnectedDragPreviewChange() {
532
+ return this.lastConnectedDragPreview !== this.dragPreview;
533
+ }
534
+ didDragSourceOptionsChange() {
535
+ return !L(this.lastConnectedDragSourceOptions, this.dragSourceOptions);
536
+ }
537
+ didDragPreviewOptionsChange() {
538
+ return !L(this.lastConnectedDragPreviewOptions, this.dragPreviewOptions);
539
+ }
540
+ disconnectDragSource() {
541
+ this.dragSourceUnsubscribe && (this.dragSourceUnsubscribe(), this.dragSourceUnsubscribe = void 0);
542
+ }
543
+ disconnectDragPreview() {
544
+ this.dragPreviewUnsubscribe && (this.dragPreviewUnsubscribe(), this.dragPreviewUnsubscribe = void 0, this.dragPreviewNode = null, this.dragPreviewRef = null);
545
+ }
546
+ get dragSource() {
547
+ return this.dragSourceNode || this.dragSourceRef && this.dragSourceRef.current;
548
+ }
549
+ get dragPreview() {
550
+ return this.dragPreviewNode || this.dragPreviewRef && this.dragPreviewRef.current;
551
+ }
552
+ clearDragSource() {
553
+ this.dragSourceNode = null, this.dragSourceRef = null;
554
+ }
555
+ clearDragPreview() {
556
+ this.dragPreviewNode = null, this.dragPreviewRef = null;
557
+ }
558
+ constructor(e) {
559
+ this.hooks = $({
560
+ dragSource: (t, i) => {
561
+ this.clearDragSource(), this.dragSourceOptions = i || null, R(t) ? this.dragSourceRef = t : this.dragSourceNode = t, this.reconnectDragSource();
562
+ },
563
+ dragPreview: (t, i) => {
564
+ this.clearDragPreview(), this.dragPreviewOptions = i || null, R(t) ? this.dragPreviewRef = t : this.dragPreviewNode = t, this.reconnectDragPreview();
565
+ }
566
+ }), this.handlerId = null, this.dragSourceRef = null, this.dragSourceOptionsInternal = null, this.dragPreviewRef = null, this.dragPreviewOptionsInternal = null, this.lastConnectedHandlerId = null, this.lastConnectedDragSource = null, this.lastConnectedDragSourceOptions = null, this.lastConnectedDragPreview = null, this.lastConnectedDragPreviewOptions = null, this.backend = e;
567
+ }
568
+ }
569
+ class qe {
570
+ get connectTarget() {
571
+ return this.dropTarget;
572
+ }
573
+ reconnect() {
574
+ const e = this.didHandlerIdChange() || this.didDropTargetChange() || this.didOptionsChange();
575
+ e && this.disconnectDropTarget();
576
+ const t = this.dropTarget;
577
+ if (this.handlerId) {
578
+ if (!t) {
579
+ this.lastConnectedDropTarget = t;
580
+ return;
581
+ }
582
+ e && (this.lastConnectedHandlerId = this.handlerId, this.lastConnectedDropTarget = t, this.lastConnectedDropTargetOptions = this.dropTargetOptions, this.unsubscribeDropTarget = this.backend.connectDropTarget(this.handlerId, t, this.dropTargetOptions));
583
+ }
584
+ }
585
+ receiveHandlerId(e) {
586
+ e !== this.handlerId && (this.handlerId = e, this.reconnect());
587
+ }
588
+ get dropTargetOptions() {
589
+ return this.dropTargetOptionsInternal;
590
+ }
591
+ set dropTargetOptions(e) {
592
+ this.dropTargetOptionsInternal = e;
593
+ }
594
+ didHandlerIdChange() {
595
+ return this.lastConnectedHandlerId !== this.handlerId;
596
+ }
597
+ didDropTargetChange() {
598
+ return this.lastConnectedDropTarget !== this.dropTarget;
599
+ }
600
+ didOptionsChange() {
601
+ return !L(this.lastConnectedDropTargetOptions, this.dropTargetOptions);
602
+ }
603
+ disconnectDropTarget() {
604
+ this.unsubscribeDropTarget && (this.unsubscribeDropTarget(), this.unsubscribeDropTarget = void 0);
605
+ }
606
+ get dropTarget() {
607
+ return this.dropTargetNode || this.dropTargetRef && this.dropTargetRef.current;
608
+ }
609
+ clearDropTarget() {
610
+ this.dropTargetRef = null, this.dropTargetNode = null;
611
+ }
612
+ constructor(e) {
613
+ this.hooks = $({
614
+ dropTarget: (t, i) => {
615
+ this.clearDropTarget(), this.dropTargetOptions = i, R(t) ? this.dropTargetRef = t : this.dropTargetNode = t, this.reconnect();
616
+ }
617
+ }), this.handlerId = null, this.dropTargetRef = null, this.dropTargetOptionsInternal = null, this.lastConnectedHandlerId = null, this.lastConnectedDropTarget = null, this.lastConnectedDropTargetOptions = null, this.backend = e;
618
+ }
619
+ }
620
+ function S() {
621
+ const { dragDropManager: r } = fe(X);
622
+ return T(r != null, "Expected drag drop context"), r;
623
+ }
624
+ function je(r, e) {
625
+ const t = S(), i = p(
626
+ () => new Ae(t.getBackend()),
627
+ [
628
+ t
629
+ ]
630
+ );
631
+ return I(() => (i.dragSourceOptions = r || null, i.reconnect(), () => i.disconnectDragSource()), [
632
+ i,
633
+ r
634
+ ]), I(() => (i.dragPreviewOptions = e || null, i.reconnect(), () => i.disconnectDragPreview()), [
635
+ i,
636
+ e
637
+ ]), i;
638
+ }
639
+ function Ue() {
640
+ const r = S();
641
+ return p(
642
+ () => new xe(r),
643
+ [
644
+ r
645
+ ]
646
+ );
647
+ }
648
+ class Ye {
649
+ beginDrag() {
650
+ const e = this.spec, t = this.monitor;
651
+ let i = null;
652
+ return typeof e.item == "object" ? i = e.item : typeof e.item == "function" ? i = e.item(t) : i = {}, i ?? null;
653
+ }
654
+ canDrag() {
655
+ const e = this.spec, t = this.monitor;
656
+ return typeof e.canDrag == "boolean" ? e.canDrag : typeof e.canDrag == "function" ? e.canDrag(t) : !0;
657
+ }
658
+ isDragging(e, t) {
659
+ const i = this.spec, n = this.monitor, { isDragging: s } = i;
660
+ return s ? s(n) : t === e.getSourceId();
661
+ }
662
+ endDrag() {
663
+ const e = this.spec, t = this.monitor, i = this.connector, { end: n } = e;
664
+ n && n(t.getItem(), t), i.reconnect();
665
+ }
666
+ constructor(e, t, i) {
667
+ this.spec = e, this.monitor = t, this.connector = i;
668
+ }
669
+ }
670
+ function Xe(r, e, t) {
671
+ const i = p(
672
+ () => new Ye(r, e, t),
673
+ [
674
+ e,
675
+ t
676
+ ]
677
+ );
678
+ return y(() => {
679
+ i.spec = r;
680
+ }, [
681
+ r
682
+ ]), i;
683
+ }
684
+ function ze(r) {
685
+ return p(() => {
686
+ const e = r.type;
687
+ return T(e != null, "spec.type must be defined"), e;
688
+ }, [
689
+ r
690
+ ]);
691
+ }
692
+ function We(r, e, t) {
693
+ const i = S(), n = Xe(r, e, t), s = ze(r);
694
+ I(function() {
695
+ if (s != null) {
696
+ const [o, u] = He(s, n, i);
697
+ return e.receiveHandlerId(o), t.receiveHandlerId(o), u;
698
+ }
699
+ }, [
700
+ i,
701
+ e,
702
+ t,
703
+ n,
704
+ s
705
+ ]);
706
+ }
707
+ function Dt(r, e) {
708
+ const t = G(r);
709
+ T(!t.begin, "useDrag::spec.begin was deprecated in v14. Replace spec.begin() with spec.item(). (see more here - https://react-dnd.github.io/react-dnd/docs/api/use-drag)");
710
+ const i = Ue(), n = je(t.options, t.previewOptions);
711
+ return We(t, i, n), [
712
+ K(t.collect, i, n),
713
+ Ne(n),
714
+ Me(n)
715
+ ];
716
+ }
717
+ function Be(r) {
718
+ return p(
719
+ () => r.hooks.dropTarget(),
720
+ [
721
+ r
722
+ ]
723
+ );
724
+ }
725
+ function Ve(r) {
726
+ const e = S(), t = p(
727
+ () => new qe(e.getBackend()),
728
+ [
729
+ e
730
+ ]
731
+ );
732
+ return I(() => (t.dropTargetOptions = r || null, t.reconnect(), () => t.disconnectDropTarget()), [
733
+ r
734
+ ]), t;
735
+ }
736
+ function Ke() {
737
+ const r = S();
738
+ return p(
739
+ () => new Le(r),
740
+ [
741
+ r
742
+ ]
743
+ );
744
+ }
745
+ function Ge(r) {
746
+ const { accept: e } = r;
747
+ return p(() => (T(r.accept != null, "accept must be defined"), Array.isArray(e) ? e : [
748
+ e
749
+ ]), [
750
+ e
751
+ ]);
752
+ }
753
+ class $e {
754
+ canDrop() {
755
+ const e = this.spec, t = this.monitor;
756
+ return e.canDrop ? e.canDrop(t.getItem(), t) : !0;
757
+ }
758
+ hover() {
759
+ const e = this.spec, t = this.monitor;
760
+ e.hover && e.hover(t.getItem(), t);
761
+ }
762
+ drop() {
763
+ const e = this.spec, t = this.monitor;
764
+ if (e.drop)
765
+ return e.drop(t.getItem(), t);
766
+ }
767
+ constructor(e, t) {
768
+ this.spec = e, this.monitor = t;
769
+ }
770
+ }
771
+ function Qe(r, e) {
772
+ const t = p(
773
+ () => new $e(r, e),
774
+ [
775
+ e
776
+ ]
777
+ );
778
+ return y(() => {
779
+ t.spec = r;
780
+ }, [
781
+ r
782
+ ]), t;
783
+ }
784
+ function Je(r, e, t) {
785
+ const i = S(), n = Qe(r, e), s = Ge(r);
786
+ I(function() {
787
+ const [o, u] = Re(s, n, i);
788
+ return e.receiveHandlerId(o), t.receiveHandlerId(o), u;
789
+ }, [
790
+ i,
791
+ e,
792
+ n,
793
+ t,
794
+ s.map(
795
+ (a) => a.toString()
796
+ ).join("|")
797
+ ]);
798
+ }
799
+ function mt(r, e) {
800
+ const t = G(r), i = Ke(), n = Ve(t.options);
801
+ return Je(t, i, n), [
802
+ K(t.collect, i, n),
803
+ Be(n)
804
+ ];
805
+ }
806
+ function Q(r) {
807
+ let e = null;
808
+ return () => (e == null && (e = r()), e);
809
+ }
810
+ function Ze(r, e) {
811
+ return r.filter(
812
+ (t) => t !== e
813
+ );
814
+ }
815
+ function et(r, e) {
816
+ const t = /* @__PURE__ */ new Set(), i = (s) => t.add(s);
817
+ r.forEach(i), e.forEach(i);
818
+ const n = [];
819
+ return t.forEach(
820
+ (s) => n.push(s)
821
+ ), n;
822
+ }
823
+ class tt {
824
+ enter(e) {
825
+ const t = this.entered.length, i = (n) => this.isNodeInDocument(n) && (!n.contains || n.contains(e));
826
+ return this.entered = et(this.entered.filter(i), [
827
+ e
828
+ ]), t === 0 && this.entered.length > 0;
829
+ }
830
+ leave(e) {
831
+ const t = this.entered.length;
832
+ return this.entered = Ze(this.entered.filter(this.isNodeInDocument), e), t > 0 && this.entered.length === 0;
833
+ }
834
+ reset() {
835
+ this.entered = [];
836
+ }
837
+ constructor(e) {
838
+ this.entered = [], this.isNodeInDocument = e;
839
+ }
840
+ }
841
+ class rt {
842
+ initializeExposedProperties() {
843
+ Object.keys(this.config.exposeProperties).forEach((e) => {
844
+ Object.defineProperty(this.item, e, {
845
+ configurable: !0,
846
+ enumerable: !0,
847
+ get() {
848
+ return console.warn(`Browser doesn't allow reading "${e}" until the drop event.`), null;
849
+ }
850
+ });
851
+ });
852
+ }
853
+ loadDataTransfer(e) {
854
+ if (e) {
855
+ const t = {};
856
+ Object.keys(this.config.exposeProperties).forEach((i) => {
857
+ const n = this.config.exposeProperties[i];
858
+ n != null && (t[i] = {
859
+ value: n(e, this.config.matchesTypes),
860
+ configurable: !0,
861
+ enumerable: !0
862
+ });
863
+ }), Object.defineProperties(this.item, t);
864
+ }
865
+ }
866
+ canDrag() {
867
+ return !0;
868
+ }
869
+ beginDrag() {
870
+ return this.item;
871
+ }
872
+ isDragging(e, t) {
873
+ return t === e.getSourceId();
874
+ }
875
+ endDrag() {
876
+ }
877
+ constructor(e) {
878
+ this.config = e, this.item = {}, this.initializeExposedProperties();
879
+ }
880
+ }
881
+ const J = "__NATIVE_FILE__", Z = "__NATIVE_URL__", ee = "__NATIVE_TEXT__", te = "__NATIVE_HTML__", j = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
882
+ __proto__: null,
883
+ FILE: J,
884
+ HTML: te,
885
+ TEXT: ee,
886
+ URL: Z
887
+ }, Symbol.toStringTag, { value: "Module" }));
888
+ function M(r, e, t) {
889
+ const i = e.reduce(
890
+ (n, s) => n || r.getData(s),
891
+ ""
892
+ );
893
+ return i ?? t;
894
+ }
895
+ const H = {
896
+ [J]: {
897
+ exposeProperties: {
898
+ files: (r) => Array.prototype.slice.call(r.files),
899
+ items: (r) => r.items,
900
+ dataTransfer: (r) => r
901
+ },
902
+ matchesTypes: [
903
+ "Files"
904
+ ]
905
+ },
906
+ [te]: {
907
+ exposeProperties: {
908
+ html: (r, e) => M(r, e, ""),
909
+ dataTransfer: (r) => r
910
+ },
911
+ matchesTypes: [
912
+ "Html",
913
+ "text/html"
914
+ ]
915
+ },
916
+ [Z]: {
917
+ exposeProperties: {
918
+ urls: (r, e) => M(r, e, "").split(`
919
+ `),
920
+ dataTransfer: (r) => r
921
+ },
922
+ matchesTypes: [
923
+ "Url",
924
+ "text/uri-list"
925
+ ]
926
+ },
927
+ [ee]: {
928
+ exposeProperties: {
929
+ text: (r, e) => M(r, e, ""),
930
+ dataTransfer: (r) => r
931
+ },
932
+ matchesTypes: [
933
+ "Text",
934
+ "text/plain"
935
+ ]
936
+ }
937
+ };
938
+ function nt(r, e) {
939
+ const t = H[r];
940
+ if (!t)
941
+ throw new Error(`native type ${r} has no configuration`);
942
+ const i = new rt(t);
943
+ return i.loadDataTransfer(e), i;
944
+ }
945
+ function x(r) {
946
+ if (!r)
947
+ return null;
948
+ const e = Array.prototype.slice.call(r.types || []);
949
+ return Object.keys(H).filter((t) => {
950
+ const i = H[t];
951
+ return i?.matchesTypes ? i.matchesTypes.some(
952
+ (n) => e.indexOf(n) > -1
953
+ ) : !1;
954
+ })[0] || null;
955
+ }
956
+ const it = Q(
957
+ () => /firefox/i.test(navigator.userAgent)
958
+ ), re = Q(
959
+ () => !!window.safari
960
+ );
961
+ class U {
962
+ interpolate(e) {
963
+ const { xs: t, ys: i, c1s: n, c2s: s, c3s: a } = this;
964
+ let o = t.length - 1;
965
+ if (e === t[o])
966
+ return i[o];
967
+ let u = 0, d = a.length - 1, l;
968
+ for (; u <= d; ) {
969
+ l = Math.floor(0.5 * (u + d));
970
+ const c = t[l];
971
+ if (c < e)
972
+ u = l + 1;
973
+ else if (c > e)
974
+ d = l - 1;
975
+ else
976
+ return i[l];
977
+ }
978
+ o = Math.max(0, d);
979
+ const h = e - t[o], g = h * h;
980
+ return i[o] + n[o] * h + s[o] * g + a[o] * h * g;
981
+ }
982
+ constructor(e, t) {
983
+ const { length: i } = e, n = [];
984
+ for (let c = 0; c < i; c++)
985
+ n.push(c);
986
+ n.sort(
987
+ (c, f) => e[c] < e[f] ? -1 : 1
988
+ );
989
+ const s = [], a = [];
990
+ let o, u;
991
+ for (let c = 0; c < i - 1; c++)
992
+ o = e[c + 1] - e[c], u = t[c + 1] - t[c], s.push(o), a.push(u / o);
993
+ const d = [
994
+ a[0]
995
+ ];
996
+ for (let c = 0; c < s.length - 1; c++) {
997
+ const f = a[c], v = a[c + 1];
998
+ if (f * v <= 0)
999
+ d.push(0);
1000
+ else {
1001
+ o = s[c];
1002
+ const D = s[c + 1], m = o + D;
1003
+ d.push(3 * m / ((m + D) / f + (m + o) / v));
1004
+ }
1005
+ }
1006
+ d.push(a[a.length - 1]);
1007
+ const l = [], h = [];
1008
+ let g;
1009
+ for (let c = 0; c < d.length - 1; c++) {
1010
+ g = a[c];
1011
+ const f = d[c], v = 1 / s[c], D = f + d[c + 1] - g - g;
1012
+ l.push((g - f - D) * v), h.push(D * v * v);
1013
+ }
1014
+ this.xs = e, this.ys = t, this.c1s = d, this.c2s = l, this.c3s = h;
1015
+ }
1016
+ }
1017
+ const st = 1;
1018
+ function ne(r) {
1019
+ const e = r.nodeType === st ? r : r.parentElement;
1020
+ if (!e)
1021
+ return null;
1022
+ const { top: t, left: i } = e.getBoundingClientRect();
1023
+ return {
1024
+ x: i,
1025
+ y: t
1026
+ };
1027
+ }
1028
+ function w(r) {
1029
+ return {
1030
+ x: r.clientX,
1031
+ y: r.clientY
1032
+ };
1033
+ }
1034
+ function ot(r) {
1035
+ var e;
1036
+ return r.nodeName === "IMG" && (it() || !(!((e = document.documentElement) === null || e === void 0) && e.contains(r)));
1037
+ }
1038
+ function at(r, e, t, i) {
1039
+ let n = r ? e.width : t, s = r ? e.height : i;
1040
+ return re() && r && (s /= window.devicePixelRatio, n /= window.devicePixelRatio), {
1041
+ dragPreviewWidth: n,
1042
+ dragPreviewHeight: s
1043
+ };
1044
+ }
1045
+ function ct(r, e, t, i, n) {
1046
+ const s = ot(e), o = ne(s ? r : e), u = {
1047
+ x: t.x - o.x,
1048
+ y: t.y - o.y
1049
+ }, { offsetWidth: d, offsetHeight: l } = r, { anchorX: h, anchorY: g } = i, { dragPreviewWidth: c, dragPreviewHeight: f } = at(s, e, d, l), v = () => {
1050
+ let _ = new U([
1051
+ 0,
1052
+ 0.5,
1053
+ 1
1054
+ ], [
1055
+ // Dock to the top
1056
+ u.y,
1057
+ // Align at the center
1058
+ u.y / l * f,
1059
+ // Dock to the bottom
1060
+ u.y + f - l
1061
+ ]).interpolate(g);
1062
+ return re() && s && (_ += (window.devicePixelRatio - 1) * f), _;
1063
+ }, D = () => new U([
1064
+ 0,
1065
+ 0.5,
1066
+ 1
1067
+ ], [
1068
+ // Dock to the left
1069
+ u.x,
1070
+ // Align at the center
1071
+ u.x / d * c,
1072
+ // Dock to the right
1073
+ u.x + c - d
1074
+ ]).interpolate(h), { offsetX: m, offsetY: O } = n, C = m === 0 || m, ie = O === 0 || O;
1075
+ return {
1076
+ x: C ? m : D(),
1077
+ y: ie ? O : v()
1078
+ };
1079
+ }
1080
+ class ut {
1081
+ get window() {
1082
+ if (this.globalContext)
1083
+ return this.globalContext;
1084
+ if (typeof window < "u")
1085
+ return window;
1086
+ }
1087
+ get document() {
1088
+ var e;
1089
+ return !((e = this.globalContext) === null || e === void 0) && e.document ? this.globalContext.document : this.window ? this.window.document : void 0;
1090
+ }
1091
+ get rootElement() {
1092
+ var e;
1093
+ return ((e = this.optionsArgs) === null || e === void 0 ? void 0 : e.rootElement) || this.window;
1094
+ }
1095
+ constructor(e, t) {
1096
+ this.ownerDocument = null, this.globalContext = e, this.optionsArgs = t;
1097
+ }
1098
+ }
1099
+ function dt(r, e, t) {
1100
+ return e in r ? Object.defineProperty(r, e, {
1101
+ value: t,
1102
+ enumerable: !0,
1103
+ configurable: !0,
1104
+ writable: !0
1105
+ }) : r[e] = t, r;
1106
+ }
1107
+ function Y(r) {
1108
+ for (var e = 1; e < arguments.length; e++) {
1109
+ var t = arguments[e] != null ? arguments[e] : {}, i = Object.keys(t);
1110
+ typeof Object.getOwnPropertySymbols == "function" && (i = i.concat(Object.getOwnPropertySymbols(t).filter(function(n) {
1111
+ return Object.getOwnPropertyDescriptor(t, n).enumerable;
1112
+ }))), i.forEach(function(n) {
1113
+ dt(r, n, t[n]);
1114
+ });
1115
+ }
1116
+ return r;
1117
+ }
1118
+ class lt {
1119
+ /**
1120
+ * Generate profiling statistics for the HTML5Backend.
1121
+ */
1122
+ profile() {
1123
+ var e, t;
1124
+ return {
1125
+ sourcePreviewNodes: this.sourcePreviewNodes.size,
1126
+ sourcePreviewNodeOptions: this.sourcePreviewNodeOptions.size,
1127
+ sourceNodeOptions: this.sourceNodeOptions.size,
1128
+ sourceNodes: this.sourceNodes.size,
1129
+ dragStartSourceIds: ((e = this.dragStartSourceIds) === null || e === void 0 ? void 0 : e.length) || 0,
1130
+ dropTargetIds: this.dropTargetIds.length,
1131
+ dragEnterTargetIds: this.dragEnterTargetIds.length,
1132
+ dragOverTargetIds: ((t = this.dragOverTargetIds) === null || t === void 0 ? void 0 : t.length) || 0
1133
+ };
1134
+ }
1135
+ // public for test
1136
+ get window() {
1137
+ return this.options.window;
1138
+ }
1139
+ get document() {
1140
+ return this.options.document;
1141
+ }
1142
+ /**
1143
+ * Get the root element to use for event subscriptions
1144
+ */
1145
+ get rootElement() {
1146
+ return this.options.rootElement;
1147
+ }
1148
+ setup() {
1149
+ const e = this.rootElement;
1150
+ if (e !== void 0) {
1151
+ if (e.__isReactDndBackendSetUp)
1152
+ throw new Error("Cannot have two HTML5 backends at the same time.");
1153
+ e.__isReactDndBackendSetUp = !0, this.addEventListeners(e);
1154
+ }
1155
+ }
1156
+ teardown() {
1157
+ const e = this.rootElement;
1158
+ if (e !== void 0 && (e.__isReactDndBackendSetUp = !1, this.removeEventListeners(this.rootElement), this.clearCurrentDragSourceNode(), this.asyncEndDragFrameId)) {
1159
+ var t;
1160
+ (t = this.window) === null || t === void 0 || t.cancelAnimationFrame(this.asyncEndDragFrameId);
1161
+ }
1162
+ }
1163
+ connectDragPreview(e, t, i) {
1164
+ return this.sourcePreviewNodeOptions.set(e, i), this.sourcePreviewNodes.set(e, t), () => {
1165
+ this.sourcePreviewNodes.delete(e), this.sourcePreviewNodeOptions.delete(e);
1166
+ };
1167
+ }
1168
+ connectDragSource(e, t, i) {
1169
+ this.sourceNodes.set(e, t), this.sourceNodeOptions.set(e, i);
1170
+ const n = (a) => this.handleDragStart(a, e), s = (a) => this.handleSelectStart(a);
1171
+ return t.setAttribute("draggable", "true"), t.addEventListener("dragstart", n), t.addEventListener("selectstart", s), () => {
1172
+ this.sourceNodes.delete(e), this.sourceNodeOptions.delete(e), t.removeEventListener("dragstart", n), t.removeEventListener("selectstart", s), t.setAttribute("draggable", "false");
1173
+ };
1174
+ }
1175
+ connectDropTarget(e, t) {
1176
+ const i = (a) => this.handleDragEnter(a, e), n = (a) => this.handleDragOver(a, e), s = (a) => this.handleDrop(a, e);
1177
+ return t.addEventListener("dragenter", i), t.addEventListener("dragover", n), t.addEventListener("drop", s), () => {
1178
+ t.removeEventListener("dragenter", i), t.removeEventListener("dragover", n), t.removeEventListener("drop", s);
1179
+ };
1180
+ }
1181
+ addEventListeners(e) {
1182
+ e.addEventListener && (e.addEventListener("dragstart", this.handleTopDragStart), e.addEventListener("dragstart", this.handleTopDragStartCapture, !0), e.addEventListener("dragend", this.handleTopDragEndCapture, !0), e.addEventListener("dragenter", this.handleTopDragEnter), e.addEventListener("dragenter", this.handleTopDragEnterCapture, !0), e.addEventListener("dragleave", this.handleTopDragLeaveCapture, !0), e.addEventListener("dragover", this.handleTopDragOver), e.addEventListener("dragover", this.handleTopDragOverCapture, !0), e.addEventListener("drop", this.handleTopDrop), e.addEventListener("drop", this.handleTopDropCapture, !0));
1183
+ }
1184
+ removeEventListeners(e) {
1185
+ e.removeEventListener && (e.removeEventListener("dragstart", this.handleTopDragStart), e.removeEventListener("dragstart", this.handleTopDragStartCapture, !0), e.removeEventListener("dragend", this.handleTopDragEndCapture, !0), e.removeEventListener("dragenter", this.handleTopDragEnter), e.removeEventListener("dragenter", this.handleTopDragEnterCapture, !0), e.removeEventListener("dragleave", this.handleTopDragLeaveCapture, !0), e.removeEventListener("dragover", this.handleTopDragOver), e.removeEventListener("dragover", this.handleTopDragOverCapture, !0), e.removeEventListener("drop", this.handleTopDrop), e.removeEventListener("drop", this.handleTopDropCapture, !0));
1186
+ }
1187
+ getCurrentSourceNodeOptions() {
1188
+ const e = this.monitor.getSourceId(), t = this.sourceNodeOptions.get(e);
1189
+ return Y({
1190
+ dropEffect: this.altKeyPressed ? "copy" : "move"
1191
+ }, t || {});
1192
+ }
1193
+ getCurrentDropEffect() {
1194
+ return this.isDraggingNativeItem() ? "copy" : this.getCurrentSourceNodeOptions().dropEffect;
1195
+ }
1196
+ getCurrentSourcePreviewNodeOptions() {
1197
+ const e = this.monitor.getSourceId(), t = this.sourcePreviewNodeOptions.get(e);
1198
+ return Y({
1199
+ anchorX: 0.5,
1200
+ anchorY: 0.5,
1201
+ captureDraggingState: !1
1202
+ }, t || {});
1203
+ }
1204
+ isDraggingNativeItem() {
1205
+ const e = this.monitor.getItemType();
1206
+ return Object.keys(j).some(
1207
+ (t) => j[t] === e
1208
+ );
1209
+ }
1210
+ beginDragNativeItem(e, t) {
1211
+ this.clearCurrentDragSourceNode(), this.currentNativeSource = nt(e, t), this.currentNativeHandle = this.registry.addSource(e, this.currentNativeSource), this.actions.beginDrag([
1212
+ this.currentNativeHandle
1213
+ ]);
1214
+ }
1215
+ setCurrentDragSourceNode(e) {
1216
+ this.clearCurrentDragSourceNode(), this.currentDragSourceNode = e;
1217
+ const t = 1e3;
1218
+ this.mouseMoveTimeoutTimer = setTimeout(() => {
1219
+ var i;
1220
+ return (i = this.rootElement) === null || i === void 0 ? void 0 : i.addEventListener("mousemove", this.endDragIfSourceWasRemovedFromDOM, !0);
1221
+ }, t);
1222
+ }
1223
+ clearCurrentDragSourceNode() {
1224
+ if (this.currentDragSourceNode) {
1225
+ if (this.currentDragSourceNode = null, this.rootElement) {
1226
+ var e;
1227
+ (e = this.window) === null || e === void 0 || e.clearTimeout(this.mouseMoveTimeoutTimer || void 0), this.rootElement.removeEventListener("mousemove", this.endDragIfSourceWasRemovedFromDOM, !0);
1228
+ }
1229
+ return this.mouseMoveTimeoutTimer = null, !0;
1230
+ }
1231
+ return !1;
1232
+ }
1233
+ handleDragStart(e, t) {
1234
+ e.defaultPrevented || (this.dragStartSourceIds || (this.dragStartSourceIds = []), this.dragStartSourceIds.unshift(t));
1235
+ }
1236
+ handleDragEnter(e, t) {
1237
+ this.dragEnterTargetIds.unshift(t);
1238
+ }
1239
+ handleDragOver(e, t) {
1240
+ this.dragOverTargetIds === null && (this.dragOverTargetIds = []), this.dragOverTargetIds.unshift(t);
1241
+ }
1242
+ handleDrop(e, t) {
1243
+ this.dropTargetIds.unshift(t);
1244
+ }
1245
+ constructor(e, t, i) {
1246
+ this.sourcePreviewNodes = /* @__PURE__ */ new Map(), this.sourcePreviewNodeOptions = /* @__PURE__ */ new Map(), this.sourceNodes = /* @__PURE__ */ new Map(), this.sourceNodeOptions = /* @__PURE__ */ new Map(), this.dragStartSourceIds = null, this.dropTargetIds = [], this.dragEnterTargetIds = [], this.currentNativeSource = null, this.currentNativeHandle = null, this.currentDragSourceNode = null, this.altKeyPressed = !1, this.mouseMoveTimeoutTimer = null, this.asyncEndDragFrameId = null, this.dragOverTargetIds = null, this.lastClientOffset = null, this.hoverRafId = null, this.getSourceClientOffset = (n) => {
1247
+ const s = this.sourceNodes.get(n);
1248
+ return s && ne(s) || null;
1249
+ }, this.endDragNativeItem = () => {
1250
+ this.isDraggingNativeItem() && (this.actions.endDrag(), this.currentNativeHandle && this.registry.removeSource(this.currentNativeHandle), this.currentNativeHandle = null, this.currentNativeSource = null);
1251
+ }, this.isNodeInDocument = (n) => !!(n && this.document && this.document.body && this.document.body.contains(n)), this.endDragIfSourceWasRemovedFromDOM = () => {
1252
+ const n = this.currentDragSourceNode;
1253
+ n == null || this.isNodeInDocument(n) || (this.clearCurrentDragSourceNode() && this.monitor.isDragging() && this.actions.endDrag(), this.cancelHover());
1254
+ }, this.scheduleHover = (n) => {
1255
+ this.hoverRafId === null && typeof requestAnimationFrame < "u" && (this.hoverRafId = requestAnimationFrame(() => {
1256
+ this.monitor.isDragging() && this.actions.hover(n || [], {
1257
+ clientOffset: this.lastClientOffset
1258
+ }), this.hoverRafId = null;
1259
+ }));
1260
+ }, this.cancelHover = () => {
1261
+ this.hoverRafId !== null && typeof cancelAnimationFrame < "u" && (cancelAnimationFrame(this.hoverRafId), this.hoverRafId = null);
1262
+ }, this.handleTopDragStartCapture = () => {
1263
+ this.clearCurrentDragSourceNode(), this.dragStartSourceIds = [];
1264
+ }, this.handleTopDragStart = (n) => {
1265
+ if (n.defaultPrevented)
1266
+ return;
1267
+ const { dragStartSourceIds: s } = this;
1268
+ this.dragStartSourceIds = null;
1269
+ const a = w(n);
1270
+ this.monitor.isDragging() && (this.actions.endDrag(), this.cancelHover()), this.actions.beginDrag(s || [], {
1271
+ publishSource: !1,
1272
+ getSourceClientOffset: this.getSourceClientOffset,
1273
+ clientOffset: a
1274
+ });
1275
+ const { dataTransfer: o } = n, u = x(o);
1276
+ if (this.monitor.isDragging()) {
1277
+ if (o && typeof o.setDragImage == "function") {
1278
+ const l = this.monitor.getSourceId(), h = this.sourceNodes.get(l), g = this.sourcePreviewNodes.get(l) || h;
1279
+ if (g) {
1280
+ const { anchorX: c, anchorY: f, offsetX: v, offsetY: D } = this.getCurrentSourcePreviewNodeOptions(), C = ct(h, g, a, {
1281
+ anchorX: c,
1282
+ anchorY: f
1283
+ }, {
1284
+ offsetX: v,
1285
+ offsetY: D
1286
+ });
1287
+ o.setDragImage(g, C.x, C.y);
1288
+ }
1289
+ }
1290
+ try {
1291
+ o?.setData("application/json", {});
1292
+ } catch {
1293
+ }
1294
+ this.setCurrentDragSourceNode(n.target);
1295
+ const { captureDraggingState: d } = this.getCurrentSourcePreviewNodeOptions();
1296
+ d ? this.actions.publishDragSource() : setTimeout(
1297
+ () => this.actions.publishDragSource(),
1298
+ 0
1299
+ );
1300
+ } else if (u)
1301
+ this.beginDragNativeItem(u);
1302
+ else {
1303
+ if (o && !o.types && (n.target && !n.target.hasAttribute || !n.target.hasAttribute("draggable")))
1304
+ return;
1305
+ n.preventDefault();
1306
+ }
1307
+ }, this.handleTopDragEndCapture = () => {
1308
+ this.clearCurrentDragSourceNode() && this.monitor.isDragging() && this.actions.endDrag(), this.cancelHover();
1309
+ }, this.handleTopDragEnterCapture = (n) => {
1310
+ if (this.dragEnterTargetIds = [], this.isDraggingNativeItem()) {
1311
+ var s;
1312
+ (s = this.currentNativeSource) === null || s === void 0 || s.loadDataTransfer(n.dataTransfer);
1313
+ }
1314
+ if (!this.enterLeaveCounter.enter(n.target) || this.monitor.isDragging())
1315
+ return;
1316
+ const { dataTransfer: o } = n, u = x(o);
1317
+ u && this.beginDragNativeItem(u, o);
1318
+ }, this.handleTopDragEnter = (n) => {
1319
+ const { dragEnterTargetIds: s } = this;
1320
+ if (this.dragEnterTargetIds = [], !this.monitor.isDragging())
1321
+ return;
1322
+ this.altKeyPressed = n.altKey, s.length > 0 && this.actions.hover(s, {
1323
+ clientOffset: w(n)
1324
+ }), s.some(
1325
+ (o) => this.monitor.canDropOnTarget(o)
1326
+ ) && (n.preventDefault(), n.dataTransfer && (n.dataTransfer.dropEffect = this.getCurrentDropEffect()));
1327
+ }, this.handleTopDragOverCapture = (n) => {
1328
+ if (this.dragOverTargetIds = [], this.isDraggingNativeItem()) {
1329
+ var s;
1330
+ (s = this.currentNativeSource) === null || s === void 0 || s.loadDataTransfer(n.dataTransfer);
1331
+ }
1332
+ }, this.handleTopDragOver = (n) => {
1333
+ const { dragOverTargetIds: s } = this;
1334
+ if (this.dragOverTargetIds = [], !this.monitor.isDragging()) {
1335
+ n.preventDefault(), n.dataTransfer && (n.dataTransfer.dropEffect = "none");
1336
+ return;
1337
+ }
1338
+ this.altKeyPressed = n.altKey, this.lastClientOffset = w(n), this.scheduleHover(s), (s || []).some(
1339
+ (o) => this.monitor.canDropOnTarget(o)
1340
+ ) ? (n.preventDefault(), n.dataTransfer && (n.dataTransfer.dropEffect = this.getCurrentDropEffect())) : this.isDraggingNativeItem() ? n.preventDefault() : (n.preventDefault(), n.dataTransfer && (n.dataTransfer.dropEffect = "none"));
1341
+ }, this.handleTopDragLeaveCapture = (n) => {
1342
+ this.isDraggingNativeItem() && n.preventDefault(), this.enterLeaveCounter.leave(n.target) && (this.isDraggingNativeItem() && setTimeout(
1343
+ () => this.endDragNativeItem(),
1344
+ 0
1345
+ ), this.cancelHover());
1346
+ }, this.handleTopDropCapture = (n) => {
1347
+ if (this.dropTargetIds = [], this.isDraggingNativeItem()) {
1348
+ var s;
1349
+ n.preventDefault(), (s = this.currentNativeSource) === null || s === void 0 || s.loadDataTransfer(n.dataTransfer);
1350
+ } else x(n.dataTransfer) && n.preventDefault();
1351
+ this.enterLeaveCounter.reset();
1352
+ }, this.handleTopDrop = (n) => {
1353
+ const { dropTargetIds: s } = this;
1354
+ this.dropTargetIds = [], this.actions.hover(s, {
1355
+ clientOffset: w(n)
1356
+ }), this.actions.drop({
1357
+ dropEffect: this.getCurrentDropEffect()
1358
+ }), this.isDraggingNativeItem() ? this.endDragNativeItem() : this.monitor.isDragging() && this.actions.endDrag(), this.cancelHover();
1359
+ }, this.handleSelectStart = (n) => {
1360
+ const s = n.target;
1361
+ typeof s.dragDrop == "function" && (s.tagName === "INPUT" || s.tagName === "SELECT" || s.tagName === "TEXTAREA" || s.isContentEditable || (n.preventDefault(), s.dragDrop()));
1362
+ }, this.options = new ut(t, i), this.actions = e.getActions(), this.monitor = e.getMonitor(), this.registry = e.getRegistry(), this.enterLeaveCounter = new tt(this.isNodeInDocument);
1363
+ }
1364
+ }
1365
+ const Tt = function(e, t, i) {
1366
+ return new lt(e, t, i);
1367
+ };
1368
+ export {
1369
+ vt as D,
1370
+ Tt as H,
1371
+ Dt as a,
1372
+ pt as b,
1373
+ T as i,
1374
+ mt as u
1375
+ };