Last active
August 18, 2025 22:08
-
-
Save black1277/c5ced8c4bb15cf05dda3b987e39036af to your computer and use it in GitHub Desktop.
ReactDnD.umd.min.js 16.0.1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (function(global, factory) { | |
| typeof exports === 'object' && typeof module !== 'undefined' ? | |
| factory(exports) : | |
| typeof define === 'function' && define.amd ? | |
| define(['exports'], factory) : | |
| (global = global || self, factory(global.ReactDnD = {})); | |
| }(this, (function(exports) { | |
| var xt = Object.create | |
| var pe = Object.defineProperty | |
| var Ct = Object.getOwnPropertyDescriptor | |
| var Rt = Object.getOwnPropertyNames | |
| var Pt = Object.getPrototypeOf, | |
| Nt = Object.prototype.hasOwnProperty | |
| var _t = (t, e) => () => ( | |
| e || t((e = { exports: {} }).exports, e), e.exports | |
| ) | |
| var Mt = (t, e, r, n) => { | |
| if ((e && typeof e == 'object') || typeof e == 'function') | |
| for (let o of Rt(e)) | |
| !Nt.call(t, o) && | |
| o !== r && | |
| pe(t, o, { | |
| get: () => e[o], | |
| enumerable: !(n = Ct(e, o)) || n.enumerable, | |
| }) | |
| return t | |
| } | |
| var At = (t, e, r) => ( | |
| (r = t != null ? xt(Pt(t)) : {}), | |
| Mt( | |
| e || !t || !t.__esModule | |
| ? pe(r, 'default', { value: t, enumerable: !0 }) | |
| : r, | |
| t | |
| ) | |
| ) | |
| var nt = _t((ui, rt) => { | |
| 'use strict' | |
| rt.exports = function t(e, r) { | |
| if (e === r) return !0 | |
| if (e && r && typeof e == 'object' && typeof r == 'object') { | |
| if (e.constructor !== r.constructor) return !1 | |
| var n, o, i | |
| if (Array.isArray(e)) { | |
| if (((n = e.length), n != r.length)) return !1 | |
| for (o = n; o-- !== 0; ) if (!t(e[o], r[o])) return !1 | |
| return !0 | |
| } | |
| if (e.constructor === RegExp) | |
| return e.source === r.source && e.flags === r.flags | |
| if (e.valueOf !== Object.prototype.valueOf) | |
| return e.valueOf() === r.valueOf() | |
| if (e.toString !== Object.prototype.toString) | |
| return e.toString() === r.toString() | |
| if ( | |
| ((i = Object.keys(e)), | |
| (n = i.length), | |
| n !== Object.keys(r).length) | |
| ) | |
| return !1 | |
| for (o = n; o-- !== 0; ) | |
| if (!Object.prototype.hasOwnProperty.call(r, i[o])) return !1 | |
| for (o = n; o-- !== 0; ) { | |
| var a = i[o] | |
| if (!t(e[a], r[a])) return !1 | |
| } | |
| return !0 | |
| } | |
| return e !== e && r !== r | |
| } | |
| }) | |
| const { createContext: kt } = React | |
| var H = kt({ dragDropManager: void 0 }) | |
| const mr = React.createElement //'react/jsx-runtime' | |
| function h(t) { | |
| return ( | |
| 'Minified Redux error #' + | |
| t + | |
| '; visit https://redux.js.org/Errors?code=' + | |
| t + | |
| ' for the full message or use the non-minified dev environment for full errors. ' | |
| ) | |
| } | |
| var ge = (function () { | |
| return ( | |
| (typeof Symbol == 'function' && Symbol.observable) || '@@observable' | |
| ) | |
| })(), | |
| ie = function () { | |
| return Math.random().toString(36).substring(7).split('').join('.') | |
| }, | |
| he = { | |
| INIT: '@@redux/INIT' + ie(), | |
| REPLACE: '@@redux/REPLACE' + ie(), | |
| PROBE_UNKNOWN_ACTION: function () { | |
| return '@@redux/PROBE_UNKNOWN_ACTION' + ie() | |
| }, | |
| } | |
| function Ht(t) { | |
| if (typeof t != 'object' || t === null) return !1 | |
| for (var e = t; Object.getPrototypeOf(e) !== null; ) | |
| e = Object.getPrototypeOf(e) | |
| return Object.getPrototypeOf(t) === e | |
| } | |
| function se(t, e, r) { | |
| var n | |
| if ( | |
| (typeof e == 'function' && typeof r == 'function') || | |
| (typeof r == 'function' && typeof arguments[3] == 'function') | |
| ) | |
| throw new Error(h(0)) | |
| if ( | |
| (typeof e == 'function' && typeof r > 'u' && ((r = e), (e = void 0)), | |
| typeof r < 'u') | |
| ) { | |
| if (typeof r != 'function') throw new Error(h(1)) | |
| return r(se)(t, e) | |
| } | |
| if (typeof t != 'function') throw new Error(h(2)) | |
| var o = t, | |
| i = e, | |
| a = [], | |
| c = a, | |
| u = !1 | |
| function f() { | |
| c === a && (c = a.slice()) | |
| } | |
| function m() { | |
| if (u) throw new Error(h(3)) | |
| return i | |
| } | |
| function I(d) { | |
| if (typeof d != 'function') throw new Error(h(4)) | |
| if (u) throw new Error(h(5)) | |
| var E = !0 | |
| return ( | |
| f(), | |
| c.push(d), | |
| function () { | |
| if (E) { | |
| if (u) throw new Error(h(6)) | |
| ;(E = !1), f() | |
| var y = c.indexOf(d) | |
| c.splice(y, 1), (a = null) | |
| } | |
| } | |
| ) | |
| } | |
| function S(d) { | |
| if (!Ht(d)) throw new Error(h(7)) | |
| if (typeof d.type > 'u') throw new Error(h(8)) | |
| if (u) throw new Error(h(9)) | |
| try { | |
| ;(u = !0), (i = o(i, d)) | |
| } finally { | |
| u = !1 | |
| } | |
| for (var E = (a = c), P = 0; P < E.length; P++) { | |
| var y = E[P] | |
| y() | |
| } | |
| return d | |
| } | |
| function oe(d) { | |
| if (typeof d != 'function') throw new Error(h(10)) | |
| ;(o = d), S({ type: he.REPLACE }) | |
| } | |
| function It() { | |
| var d, | |
| E = I | |
| return ( | |
| (d = { | |
| subscribe: function (y) { | |
| if (typeof y != 'object' || y === null) throw new Error(h(11)) | |
| function le() { | |
| y.next && y.next(m()) | |
| } | |
| le() | |
| var wt = E(le) | |
| return { unsubscribe: wt } | |
| }, | |
| }), | |
| (d[ge] = function () { | |
| return this | |
| }), | |
| d | |
| ) | |
| } | |
| return ( | |
| S({ type: he.INIT }), | |
| (n = { dispatch: S, subscribe: I, getState: m, replaceReducer: oe }), | |
| (n[ge] = It), | |
| n | |
| ) | |
| } | |
| function s(t, e, ...r) { | |
| if (Ut() && e === void 0) | |
| throw new Error('invariant requires an error message argument') | |
| if (!t) { | |
| let n | |
| if (e === void 0) | |
| n = new Error( | |
| 'Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.' | |
| ) | |
| else { | |
| let o = 0 | |
| ;(n = new Error( | |
| e.replace(/%s/g, function () { | |
| return r[o++] | |
| }) | |
| )), | |
| (n.name = 'Invariant Violation') | |
| } | |
| throw ((n.framesToPop = 1), n) | |
| } | |
| } | |
| function Ut() { | |
| return typeof process < 'u' && !0 | |
| } | |
| function me(t, e, r) { | |
| return e.split('.').reduce((n, o) => (n && n[o] ? n[o] : r || null), t) | |
| } | |
| function ye(t, e) { | |
| return t.filter((r) => r !== e) | |
| } | |
| function U(t) { | |
| return typeof t == 'object' | |
| } | |
| function Oe(t, e) { | |
| let r = new Map(), | |
| n = (i) => { | |
| r.set(i, r.has(i) ? r.get(i) + 1 : 1) | |
| } | |
| t.forEach(n), e.forEach(n) | |
| let o = [] | |
| return ( | |
| r.forEach((i, a) => { | |
| i === 1 && o.push(a) | |
| }), | |
| o | |
| ) | |
| } | |
| function De(t, e) { | |
| return t.filter((r) => e.indexOf(r) > -1) | |
| } | |
| var w = 'dnd-core/INIT_COORDS', | |
| O = 'dnd-core/BEGIN_DRAG', | |
| x = 'dnd-core/PUBLISH_DRAG_SOURCE', | |
| D = 'dnd-core/HOVER', | |
| b = 'dnd-core/DROP', | |
| v = 'dnd-core/END_DRAG' | |
| function ae(t, e) { | |
| return { | |
| type: w, | |
| payload: { sourceClientOffset: e || null, clientOffset: t || null }, | |
| } | |
| } | |
| var Vt = { | |
| type: w, | |
| payload: { clientOffset: null, sourceClientOffset: null }, | |
| } | |
| function be(t) { | |
| return function (r = [], n = { publishSource: !0 }) { | |
| let { | |
| publishSource: o = !0, | |
| clientOffset: i, | |
| getSourceClientOffset: a, | |
| } = n, | |
| c = t.getMonitor(), | |
| u = t.getRegistry() | |
| t.dispatch(ae(i)), Gt(r, c, u) | |
| let f = Bt(r, c) | |
| if (f == null) { | |
| t.dispatch(Vt) | |
| return | |
| } | |
| let m = null | |
| if (i) { | |
| if (!a) throw new Error('getSourceClientOffset must be defined') | |
| Lt(a), (m = a(f)) | |
| } | |
| t.dispatch(ae(i, m)) | |
| let S = u.getSource(f).beginDrag(c, f) | |
| if (S == null) return | |
| qt(S), u.pinSource(f) | |
| let oe = u.getSourceType(f) | |
| return { | |
| type: O, | |
| payload: { | |
| itemType: oe, | |
| item: S, | |
| sourceId: f, | |
| clientOffset: i || null, | |
| sourceClientOffset: m || null, | |
| isSourcePublic: !!o, | |
| }, | |
| } | |
| } | |
| } | |
| function Gt(t, e, r) { | |
| s(!e.isDragging(), 'Cannot call beginDrag while dragging.'), | |
| t.forEach(function (n) { | |
| s(r.getSource(n), 'Expected sourceIds to be registered.') | |
| }) | |
| } | |
| function Lt(t) { | |
| s( | |
| typeof t == 'function', | |
| 'When clientOffset is provided, getSourceClientOffset must be a function.' | |
| ) | |
| } | |
| function qt(t) { | |
| s(U(t), 'Item must be an object.') | |
| } | |
| function Bt(t, e) { | |
| let r = null | |
| for (let n = t.length - 1; n >= 0; n--) | |
| if (e.canDragSource(t[n])) { | |
| r = t[n] | |
| break | |
| } | |
| return r | |
| } | |
| function Ft(t, e, r) { | |
| return ( | |
| e in t | |
| ? Object.defineProperty(t, e, { | |
| value: r, | |
| enumerable: !0, | |
| configurable: !0, | |
| writable: !0, | |
| }) | |
| : (t[e] = r), | |
| t | |
| ) | |
| } | |
| function Wt(t) { | |
| for (var e = 1; e < arguments.length; e++) { | |
| var r = arguments[e] != null ? arguments[e] : {}, | |
| n = Object.keys(r) | |
| typeof Object.getOwnPropertySymbols == 'function' && | |
| (n = n.concat( | |
| Object.getOwnPropertySymbols(r).filter(function (o) { | |
| return Object.getOwnPropertyDescriptor(r, o).enumerable | |
| }) | |
| )), | |
| n.forEach(function (o) { | |
| Ft(t, o, r[o]) | |
| }) | |
| } | |
| return t | |
| } | |
| function ve(t) { | |
| return function (r = {}) { | |
| let n = t.getMonitor(), | |
| o = t.getRegistry() | |
| Yt(n), | |
| Xt(n).forEach((a, c) => { | |
| let u = $t(a, c, o, n), | |
| f = { type: b, payload: { dropResult: Wt({}, r, u) } } | |
| t.dispatch(f) | |
| }) | |
| } | |
| } | |
| function Yt(t) { | |
| s(t.isDragging(), 'Cannot call drop while not dragging.'), | |
| s(!t.didDrop(), 'Cannot call drop twice during one drag operation.') | |
| } | |
| function $t(t, e, r, n) { | |
| let o = r.getTarget(t), | |
| i = o ? o.drop(n, t) : void 0 | |
| return ( | |
| Kt(i), typeof i > 'u' && (i = e === 0 ? {} : n.getDropResult()), i | |
| ) | |
| } | |
| function Kt(t) { | |
| s( | |
| typeof t > 'u' || U(t), | |
| 'Drop result must either be an object or undefined.' | |
| ) | |
| } | |
| function Xt(t) { | |
| let e = t.getTargetIds().filter(t.canDropOnTarget, t) | |
| return e.reverse(), e | |
| } | |
| function Se(t) { | |
| return function () { | |
| let r = t.getMonitor(), | |
| n = t.getRegistry() | |
| zt(r) | |
| let o = r.getSourceId() | |
| return ( | |
| o != null && (n.getSource(o, !0).endDrag(r, o), n.unpinSource()), | |
| { type: v } | |
| ) | |
| } | |
| } | |
| function zt(t) { | |
| s(t.isDragging(), 'Cannot call endDrag while not dragging.') | |
| } | |
| function N(t, e) { | |
| return e === null | |
| ? t === null | |
| : Array.isArray(t) | |
| ? t.some((r) => r === e) | |
| : t === e | |
| } | |
| function Ee(t) { | |
| return function (r, { clientOffset: n } = {}) { | |
| Qt(r) | |
| let o = r.slice(0), | |
| i = t.getMonitor(), | |
| a = t.getRegistry(), | |
| c = i.getItemType() | |
| return ( | |
| Zt(o, a, c), | |
| Jt(o, i, a), | |
| er(o, i, a), | |
| { type: D, payload: { targetIds: o, clientOffset: n || null } } | |
| ) | |
| } | |
| } | |
| function Qt(t) { | |
| s(Array.isArray(t), 'Expected targetIds to be an array.') | |
| } | |
| function Jt(t, e, r) { | |
| s(e.isDragging(), 'Cannot call hover while not dragging.'), | |
| s(!e.didDrop(), 'Cannot call hover after drop.') | |
| for (let n = 0; n < t.length; n++) { | |
| let o = t[n] | |
| s( | |
| t.lastIndexOf(o) === n, | |
| 'Expected targetIds to be unique in the passed array.' | |
| ) | |
| let i = r.getTarget(o) | |
| s(i, 'Expected targetIds to be registered.') | |
| } | |
| } | |
| function Zt(t, e, r) { | |
| for (let n = t.length - 1; n >= 0; n--) { | |
| let o = t[n], | |
| i = e.getTargetType(o) | |
| N(i, r) || t.splice(n, 1) | |
| } | |
| } | |
| function er(t, e, r) { | |
| t.forEach(function (n) { | |
| r.getTarget(n).hover(e, n) | |
| }) | |
| } | |
| function Te(t) { | |
| return function () { | |
| if (t.getMonitor().isDragging()) return { type: x } | |
| } | |
| } | |
| function Ie(t) { | |
| return { | |
| beginDrag: be(t), | |
| publishDragSource: Te(t), | |
| hover: Ee(t), | |
| drop: ve(t), | |
| endDrag: Se(t), | |
| } | |
| } | |
| var V = class { | |
| receiveBackend(e) { | |
| this.backend = e | |
| } | |
| getMonitor() { | |
| return this.monitor | |
| } | |
| getBackend() { | |
| return this.backend | |
| } | |
| getRegistry() { | |
| return this.monitor.registry | |
| } | |
| getActions() { | |
| let e = this, | |
| { dispatch: r } = this.store | |
| function n(i) { | |
| return (...a) => { | |
| let c = i.apply(e, a) | |
| typeof c < 'u' && r(c) | |
| } | |
| } | |
| let o = Ie(this) | |
| return Object.keys(o).reduce((i, a) => { | |
| let c = o[a] | |
| return (i[a] = n(c)), i | |
| }, {}) | |
| } | |
| dispatch(e) { | |
| this.store.dispatch(e) | |
| } | |
| constructor(e, r) { | |
| ;(this.isSetUp = !1), | |
| (this.handleRefCountChange = () => { | |
| let n = this.store.getState().refCount > 0 | |
| this.backend && | |
| (n && !this.isSetUp | |
| ? (this.backend.setup(), (this.isSetUp = !0)) | |
| : !n && | |
| this.isSetUp && | |
| (this.backend.teardown(), (this.isSetUp = !1))) | |
| }), | |
| (this.store = e), | |
| (this.monitor = r), | |
| e.subscribe(this.handleRefCountChange) | |
| } | |
| } | |
| function tr(t, e) { | |
| return { x: t.x + e.x, y: t.y + e.y } | |
| } | |
| function we(t, e) { | |
| return { x: t.x - e.x, y: t.y - e.y } | |
| } | |
| function xe(t) { | |
| let { | |
| clientOffset: e, | |
| initialClientOffset: r, | |
| initialSourceClientOffset: n, | |
| } = t | |
| return !e || !r || !n ? null : we(tr(e, n), r) | |
| } | |
| function Ce(t) { | |
| let { clientOffset: e, initialClientOffset: r } = t | |
| return !e || !r ? null : we(e, r) | |
| } | |
| var C = [], | |
| G = [] | |
| C.__IS_NONE__ = !0 | |
| G.__IS_ALL__ = !0 | |
| function Re(t, e) { | |
| return t === C | |
| ? !1 | |
| : t === G || typeof e > 'u' | |
| ? !0 | |
| : De(e, t).length > 0 | |
| } | |
| var L = class { | |
| subscribeToStateChange(e, r = {}) { | |
| let { handlerIds: n } = r | |
| s(typeof e == 'function', 'listener must be a function.'), | |
| s( | |
| typeof n > 'u' || Array.isArray(n), | |
| 'handlerIds, when specified, must be an array of strings.' | |
| ) | |
| let o = this.store.getState().stateId, | |
| i = () => { | |
| let a = this.store.getState(), | |
| c = a.stateId | |
| try { | |
| c === o || (c === o + 1 && !Re(a.dirtyHandlerIds, n)) || e() | |
| } finally { | |
| o = c | |
| } | |
| } | |
| return this.store.subscribe(i) | |
| } | |
| subscribeToOffsetChange(e) { | |
| s(typeof e == 'function', 'listener must be a function.') | |
| let r = this.store.getState().dragOffset, | |
| n = () => { | |
| let o = this.store.getState().dragOffset | |
| o !== r && ((r = o), e()) | |
| } | |
| return this.store.subscribe(n) | |
| } | |
| canDragSource(e) { | |
| if (!e) return !1 | |
| let r = this.registry.getSource(e) | |
| return ( | |
| s(r, `Expected to find a valid source. sourceId=${e}`), | |
| this.isDragging() ? !1 : r.canDrag(this, e) | |
| ) | |
| } | |
| canDropOnTarget(e) { | |
| if (!e) return !1 | |
| let r = this.registry.getTarget(e) | |
| if ( | |
| (s(r, `Expected to find a valid target. targetId=${e}`), | |
| !this.isDragging() || this.didDrop()) | |
| ) | |
| return !1 | |
| let n = this.registry.getTargetType(e), | |
| o = this.getItemType() | |
| return N(n, o) && r.canDrop(this, e) | |
| } | |
| isDragging() { | |
| return !!this.getItemType() | |
| } | |
| isDraggingSource(e) { | |
| if (!e) return !1 | |
| let r = this.registry.getSource(e, !0) | |
| if ( | |
| (s(r, `Expected to find a valid source. sourceId=${e}`), | |
| !this.isDragging() || !this.isSourcePublic()) | |
| ) | |
| return !1 | |
| let n = this.registry.getSourceType(e), | |
| o = this.getItemType() | |
| return n !== o ? !1 : r.isDragging(this, e) | |
| } | |
| isOverTarget(e, r = { shallow: !1 }) { | |
| if (!e) return !1 | |
| let { shallow: n } = r | |
| if (!this.isDragging()) return !1 | |
| let o = this.registry.getTargetType(e), | |
| i = this.getItemType() | |
| if (i && !N(o, i)) return !1 | |
| let a = this.getTargetIds() | |
| if (!a.length) return !1 | |
| let c = a.indexOf(e) | |
| return n ? c === a.length - 1 : c > -1 | |
| } | |
| getItemType() { | |
| return this.store.getState().dragOperation.itemType | |
| } | |
| getItem() { | |
| return this.store.getState().dragOperation.item | |
| } | |
| getSourceId() { | |
| return this.store.getState().dragOperation.sourceId | |
| } | |
| getTargetIds() { | |
| return this.store.getState().dragOperation.targetIds | |
| } | |
| getDropResult() { | |
| return this.store.getState().dragOperation.dropResult | |
| } | |
| didDrop() { | |
| return this.store.getState().dragOperation.didDrop | |
| } | |
| isSourcePublic() { | |
| return !!this.store.getState().dragOperation.isSourcePublic | |
| } | |
| getInitialClientOffset() { | |
| return this.store.getState().dragOffset.initialClientOffset | |
| } | |
| getInitialSourceClientOffset() { | |
| return this.store.getState().dragOffset.initialSourceClientOffset | |
| } | |
| getClientOffset() { | |
| return this.store.getState().dragOffset.clientOffset | |
| } | |
| getSourceClientOffset() { | |
| return xe(this.store.getState().dragOffset) | |
| } | |
| getDifferenceFromInitialOffset() { | |
| return Ce(this.store.getState().dragOffset) | |
| } | |
| constructor(e, r) { | |
| ;(this.store = e), (this.registry = r) | |
| } | |
| } | |
| var Pe = typeof global < 'u' ? global : self, | |
| Ne = Pe.MutationObserver || Pe.WebKitMutationObserver | |
| function ce(t) { | |
| return function () { | |
| let r = setTimeout(o, 0), | |
| n = setInterval(o, 50) | |
| function o() { | |
| clearTimeout(r), clearInterval(n), t() | |
| } | |
| } | |
| } | |
| function rr(t) { | |
| let e = 1, | |
| r = new Ne(t), | |
| n = document.createTextNode('') | |
| return ( | |
| r.observe(n, { characterData: !0 }), | |
| function () { | |
| ;(e = -e), (n.data = e) | |
| } | |
| ) | |
| } | |
| var _e = typeof Ne == 'function' ? rr : ce | |
| var q = class { | |
| enqueueTask(e) { | |
| let { queue: r, requestFlush: n } = this | |
| r.length || (n(), (this.flushing = !0)), (r[r.length] = e) | |
| } | |
| constructor() { | |
| ;(this.queue = []), | |
| (this.pendingErrors = []), | |
| (this.flushing = !1), | |
| (this.index = 0), | |
| (this.capacity = 1024), | |
| (this.flush = () => { | |
| let { queue: e } = this | |
| for (; this.index < e.length; ) { | |
| let r = this.index | |
| if ((this.index++, e[r].call(), this.index > this.capacity)) { | |
| for (let n = 0, o = e.length - this.index; n < o; n++) | |
| e[n] = e[n + this.index] | |
| ;(e.length -= this.index), (this.index = 0) | |
| } | |
| } | |
| ;(e.length = 0), (this.index = 0), (this.flushing = !1) | |
| }), | |
| (this.registerPendingError = (e) => { | |
| this.pendingErrors.push(e), this.requestErrorThrow() | |
| }), | |
| (this.requestFlush = _e(this.flush)), | |
| (this.requestErrorThrow = ce(() => { | |
| if (this.pendingErrors.length) throw this.pendingErrors.shift() | |
| })) | |
| } | |
| } | |
| var B = class { | |
| call() { | |
| try { | |
| this.task && this.task() | |
| } catch (e) { | |
| this.onError(e) | |
| } finally { | |
| ;(this.task = null), this.release(this) | |
| } | |
| } | |
| constructor(e, r) { | |
| ;(this.onError = e), (this.release = r), (this.task = null) | |
| } | |
| } | |
| var F = class { | |
| create(e) { | |
| let r = this.freeTasks, | |
| n = r.length | |
| ? r.pop() | |
| : new B(this.onError, (o) => (r[r.length] = o)) | |
| return (n.task = e), n | |
| } | |
| constructor(e) { | |
| ;(this.onError = e), (this.freeTasks = []) | |
| } | |
| } | |
| var Me = new q(), | |
| nr = new F(Me.registerPendingError) | |
| function Ae(t) { | |
| Me.enqueueTask(nr.create(t)) | |
| } | |
| var _ = 'dnd-core/ADD_SOURCE', | |
| M = 'dnd-core/ADD_TARGET', | |
| A = 'dnd-core/REMOVE_SOURCE', | |
| T = 'dnd-core/REMOVE_TARGET' | |
| function ke(t) { | |
| return { type: _, payload: { sourceId: t } } | |
| } | |
| function je(t) { | |
| return { type: M, payload: { targetId: t } } | |
| } | |
| function He(t) { | |
| return { type: A, payload: { sourceId: t } } | |
| } | |
| function Ue(t) { | |
| return { type: T, payload: { targetId: t } } | |
| } | |
| function Ve(t) { | |
| s(typeof t.canDrag == 'function', 'Expected canDrag to be a function.'), | |
| s( | |
| typeof t.beginDrag == 'function', | |
| 'Expected beginDrag to be a function.' | |
| ), | |
| s( | |
| typeof t.endDrag == 'function', | |
| 'Expected endDrag to be a function.' | |
| ) | |
| } | |
| function Ge(t) { | |
| s(typeof t.canDrop == 'function', 'Expected canDrop to be a function.'), | |
| s(typeof t.hover == 'function', 'Expected hover to be a function.'), | |
| s(typeof t.drop == 'function', 'Expected beginDrag to be a function.') | |
| } | |
| function W(t, e) { | |
| if (e && Array.isArray(t)) { | |
| t.forEach((r) => W(r, !1)) | |
| return | |
| } | |
| s( | |
| typeof t == 'string' || typeof t == 'symbol', | |
| e | |
| ? 'Type can only be a string, a symbol, or an array of either.' | |
| : 'Type can only be a string or a symbol.' | |
| ) | |
| } | |
| var p | |
| ;(function (t) { | |
| ;(t.SOURCE = 'SOURCE'), (t.TARGET = 'TARGET') | |
| })(p || (p = {})) | |
| var or = 0 | |
| function Le() { | |
| return or++ | |
| } | |
| function ir(t) { | |
| let e = Le().toString() | |
| switch (t) { | |
| case p.SOURCE: | |
| return `S${e}` | |
| case p.TARGET: | |
| return `T${e}` | |
| default: | |
| throw new Error(`Unknown Handler Role: ${t}`) | |
| } | |
| } | |
| function qe(t) { | |
| switch (t[0]) { | |
| case 'S': | |
| return p.SOURCE | |
| case 'T': | |
| return p.TARGET | |
| default: | |
| throw new Error(`Cannot parse handler ID: ${t}`) | |
| } | |
| } | |
| function Be(t, e) { | |
| let r = t.entries(), | |
| n = !1 | |
| do { | |
| let { | |
| done: o, | |
| value: [, i], | |
| } = r.next() | |
| if (i === e) return !0 | |
| n = !!o | |
| } while (!n) | |
| return !1 | |
| } | |
| var Y = class { | |
| addSource(e, r) { | |
| W(e), Ve(r) | |
| let n = this.addHandler(p.SOURCE, e, r) | |
| return this.store.dispatch(ke(n)), n | |
| } | |
| addTarget(e, r) { | |
| W(e, !0), Ge(r) | |
| let n = this.addHandler(p.TARGET, e, r) | |
| return this.store.dispatch(je(n)), n | |
| } | |
| containsHandler(e) { | |
| return Be(this.dragSources, e) || Be(this.dropTargets, e) | |
| } | |
| getSource(e, r = !1) { | |
| return ( | |
| s(this.isSourceId(e), 'Expected a valid source ID.'), | |
| r && e === this.pinnedSourceId | |
| ? this.pinnedSource | |
| : this.dragSources.get(e) | |
| ) | |
| } | |
| getTarget(e) { | |
| return ( | |
| s(this.isTargetId(e), 'Expected a valid target ID.'), | |
| this.dropTargets.get(e) | |
| ) | |
| } | |
| getSourceType(e) { | |
| return ( | |
| s(this.isSourceId(e), 'Expected a valid source ID.'), | |
| this.types.get(e) | |
| ) | |
| } | |
| getTargetType(e) { | |
| return ( | |
| s(this.isTargetId(e), 'Expected a valid target ID.'), | |
| this.types.get(e) | |
| ) | |
| } | |
| isSourceId(e) { | |
| return qe(e) === p.SOURCE | |
| } | |
| isTargetId(e) { | |
| return qe(e) === p.TARGET | |
| } | |
| removeSource(e) { | |
| s(this.getSource(e), 'Expected an existing source.'), | |
| this.store.dispatch(He(e)), | |
| Ae(() => { | |
| this.dragSources.delete(e), this.types.delete(e) | |
| }) | |
| } | |
| removeTarget(e) { | |
| s(this.getTarget(e), 'Expected an existing target.'), | |
| this.store.dispatch(Ue(e)), | |
| this.dropTargets.delete(e), | |
| this.types.delete(e) | |
| } | |
| pinSource(e) { | |
| let r = this.getSource(e) | |
| s(r, 'Expected an existing source.'), | |
| (this.pinnedSourceId = e), | |
| (this.pinnedSource = r) | |
| } | |
| unpinSource() { | |
| s(this.pinnedSource, 'No source is pinned at the time.'), | |
| (this.pinnedSourceId = null), | |
| (this.pinnedSource = null) | |
| } | |
| addHandler(e, r, n) { | |
| let o = ir(e) | |
| return ( | |
| this.types.set(o, r), | |
| e === p.SOURCE | |
| ? this.dragSources.set(o, n) | |
| : e === p.TARGET && this.dropTargets.set(o, n), | |
| o | |
| ) | |
| } | |
| constructor(e) { | |
| ;(this.types = new Map()), | |
| (this.dragSources = new Map()), | |
| (this.dropTargets = new Map()), | |
| (this.pinnedSourceId = null), | |
| (this.pinnedSource = null), | |
| (this.store = e) | |
| } | |
| } | |
| var sr = (t, e) => t === e | |
| function Fe(t, e) { | |
| return !t && !e ? !0 : !t || !e ? !1 : t.x === e.x && t.y === e.y | |
| } | |
| function We(t, e, r = sr) { | |
| if (t.length !== e.length) return !1 | |
| for (let n = 0; n < t.length; ++n) if (!r(t[n], e[n])) return !1 | |
| return !0 | |
| } | |
| function Ye(t = C, e) { | |
| switch (e.type) { | |
| case D: | |
| break | |
| case _: | |
| case M: | |
| case T: | |
| case A: | |
| return C | |
| case O: | |
| case x: | |
| case v: | |
| case b: | |
| default: | |
| return G | |
| } | |
| let { targetIds: r = [], prevTargetIds: n = [] } = e.payload, | |
| o = Oe(r, n) | |
| if (!(o.length > 0 || !We(r, n))) return C | |
| let a = n[n.length - 1], | |
| c = r[r.length - 1] | |
| return a !== c && (a && o.push(a), c && o.push(c)), o | |
| } | |
| function ar(t, e, r) { | |
| return ( | |
| e in t | |
| ? Object.defineProperty(t, e, { | |
| value: r, | |
| enumerable: !0, | |
| configurable: !0, | |
| writable: !0, | |
| }) | |
| : (t[e] = r), | |
| t | |
| ) | |
| } | |
| function cr(t) { | |
| for (var e = 1; e < arguments.length; e++) { | |
| var r = arguments[e] != null ? arguments[e] : {}, | |
| n = Object.keys(r) | |
| typeof Object.getOwnPropertySymbols == 'function' && | |
| (n = n.concat( | |
| Object.getOwnPropertySymbols(r).filter(function (o) { | |
| return Object.getOwnPropertyDescriptor(r, o).enumerable | |
| }) | |
| )), | |
| n.forEach(function (o) { | |
| ar(t, o, r[o]) | |
| }) | |
| } | |
| return t | |
| } | |
| var $e = { | |
| initialSourceClientOffset: null, | |
| initialClientOffset: null, | |
| clientOffset: null, | |
| } | |
| function Ke(t = $e, e) { | |
| let { payload: r } = e | |
| switch (e.type) { | |
| case w: | |
| case O: | |
| return { | |
| initialSourceClientOffset: r.sourceClientOffset, | |
| initialClientOffset: r.clientOffset, | |
| clientOffset: r.clientOffset, | |
| } | |
| case D: | |
| return Fe(t.clientOffset, r.clientOffset) | |
| ? t | |
| : cr({}, t, { clientOffset: r.clientOffset }) | |
| case v: | |
| case b: | |
| return $e | |
| default: | |
| return t | |
| } | |
| } | |
| function ur(t, e, r) { | |
| return ( | |
| e in t | |
| ? Object.defineProperty(t, e, { | |
| value: r, | |
| enumerable: !0, | |
| configurable: !0, | |
| writable: !0, | |
| }) | |
| : (t[e] = r), | |
| t | |
| ) | |
| } | |
| function R(t) { | |
| for (var e = 1; e < arguments.length; e++) { | |
| var r = arguments[e] != null ? arguments[e] : {}, | |
| n = Object.keys(r) | |
| typeof Object.getOwnPropertySymbols == 'function' && | |
| (n = n.concat( | |
| Object.getOwnPropertySymbols(r).filter(function (o) { | |
| return Object.getOwnPropertyDescriptor(r, o).enumerable | |
| }) | |
| )), | |
| n.forEach(function (o) { | |
| ur(t, o, r[o]) | |
| }) | |
| } | |
| return t | |
| } | |
| var fr = { | |
| itemType: null, | |
| item: null, | |
| sourceId: null, | |
| targetIds: [], | |
| dropResult: null, | |
| didDrop: !1, | |
| isSourcePublic: null, | |
| } | |
| function Xe(t = fr, e) { | |
| let { payload: r } = e | |
| switch (e.type) { | |
| case O: | |
| return R({}, t, { | |
| itemType: r.itemType, | |
| item: r.item, | |
| sourceId: r.sourceId, | |
| isSourcePublic: r.isSourcePublic, | |
| dropResult: null, | |
| didDrop: !1, | |
| }) | |
| case x: | |
| return R({}, t, { isSourcePublic: !0 }) | |
| case D: | |
| return R({}, t, { targetIds: r.targetIds }) | |
| case T: | |
| return t.targetIds.indexOf(r.targetId) === -1 | |
| ? t | |
| : R({}, t, { targetIds: ye(t.targetIds, r.targetId) }) | |
| case b: | |
| return R({}, t, { | |
| dropResult: r.dropResult, | |
| didDrop: !0, | |
| targetIds: [], | |
| }) | |
| case v: | |
| return R({}, t, { | |
| itemType: null, | |
| item: null, | |
| sourceId: null, | |
| dropResult: null, | |
| didDrop: !1, | |
| isSourcePublic: null, | |
| targetIds: [], | |
| }) | |
| default: | |
| return t | |
| } | |
| } | |
| function ze(t = 0, e) { | |
| switch (e.type) { | |
| case _: | |
| case M: | |
| return t + 1 | |
| case A: | |
| case T: | |
| return t - 1 | |
| default: | |
| return t | |
| } | |
| } | |
| function Qe(t = 0) { | |
| return t + 1 | |
| } | |
| function dr(t, e, r) { | |
| return ( | |
| e in t | |
| ? Object.defineProperty(t, e, { | |
| value: r, | |
| enumerable: !0, | |
| configurable: !0, | |
| writable: !0, | |
| }) | |
| : (t[e] = r), | |
| t | |
| ) | |
| } | |
| function lr(t) { | |
| for (var e = 1; e < arguments.length; e++) { | |
| var r = arguments[e] != null ? arguments[e] : {}, | |
| n = Object.keys(r) | |
| typeof Object.getOwnPropertySymbols == 'function' && | |
| (n = n.concat( | |
| Object.getOwnPropertySymbols(r).filter(function (o) { | |
| return Object.getOwnPropertyDescriptor(r, o).enumerable | |
| }) | |
| )), | |
| n.forEach(function (o) { | |
| dr(t, o, r[o]) | |
| }) | |
| } | |
| return t | |
| } | |
| function Je(t = {}, e) { | |
| return { | |
| dirtyHandlerIds: Ye(t.dirtyHandlerIds, { | |
| type: e.type, | |
| payload: lr({}, e.payload, { | |
| prevTargetIds: me(t, 'dragOperation.targetIds', []), | |
| }), | |
| }), | |
| dragOffset: Ke(t.dragOffset, e), | |
| refCount: ze(t.refCount, e), | |
| dragOperation: Xe(t.dragOperation, e), | |
| stateId: Qe(t.stateId), | |
| } | |
| } | |
| function Ze(t, e = void 0, r = {}, n = !1) { | |
| let o = pr(n), | |
| i = new L(o, new Y(o)), | |
| a = new V(o, i), | |
| c = t(a, e, r) | |
| return a.receiveBackend(c), a | |
| } | |
| function pr(t) { | |
| let e = typeof window < 'u' && window.__REDUX_DEVTOOLS_EXTENSION__ | |
| return se(Je, t && e && e({ name: 'dnd-core', instanceId: 'dnd-core' })) | |
| } | |
| const { memo: yr, useEffect: Or } = React | |
| function gr(t, e) { | |
| if (t == null) return {} | |
| var r = hr(t, e), | |
| n, | |
| o | |
| if (Object.getOwnPropertySymbols) { | |
| var i = Object.getOwnPropertySymbols(t) | |
| for (o = 0; o < i.length; o++) | |
| (n = i[o]), | |
| !(e.indexOf(n) >= 0) && | |
| Object.prototype.propertyIsEnumerable.call(t, n) && | |
| (r[n] = t[n]) | |
| } | |
| return r | |
| } | |
| function hr(t, e) { | |
| if (t == null) return {} | |
| var r = {}, | |
| n = Object.keys(t), | |
| o, | |
| i | |
| for (i = 0; i < n.length; i++) | |
| (o = n[i]), !(e.indexOf(o) >= 0) && (r[o] = t[o]) | |
| return r | |
| } | |
| var et = 0, | |
| $ = Symbol.for('__REACT_DND_CONTEXT_INSTANCE__'), | |
| oi = yr(function (e) { | |
| var { children: r } = e, | |
| n = gr(e, ['children']) | |
| let [o, i] = Dr(n) | |
| return ( | |
| Or(() => { | |
| if (i) { | |
| let a = tt() | |
| return ( | |
| ++et, | |
| () => { | |
| --et === 0 && (a[$] = null) | |
| } | |
| ) | |
| } | |
| }, []), | |
| mr(H.Provider, { value: o, children: r }) | |
| ) | |
| }) | |
| function Dr(t) { | |
| if ('manager' in t) return [{ dragDropManager: t.manager }, !1] | |
| let e = br(t.backend, t.context, t.options, t.debugMode), | |
| r = !t.context | |
| return [e, r] | |
| } | |
| function br(t, e = tt(), r, n) { | |
| let o = e | |
| return o[$] || (o[$] = { dragDropManager: Ze(t, e, r, n) }), o[$] | |
| } | |
| function tt() { | |
| return typeof global < 'u' ? global : window | |
| } | |
| const { memo: vr, useEffect: Sr } = React | |
| var ai = vr(function ({ connect: e, src: r }) { | |
| return ( | |
| Sr(() => { | |
| if (typeof Image > 'u') return | |
| let n = !1, | |
| o = new Image() | |
| return ( | |
| (o.src = r), | |
| (o.onload = () => { | |
| e(o), (n = !0) | |
| }), | |
| () => { | |
| n && e(null) | |
| } | |
| ) | |
| }), | |
| null | |
| ) | |
| }) | |
| var ot = At(nt()) | |
| const { useCallback: Ir, useState: wr } = React | |
| const { useEffect: Er, useLayoutEffect: Tr } = React | |
| var g = typeof window < 'u' ? Tr : Er | |
| function K(t, e, r) { | |
| let [n, o] = wr(() => e(t)), | |
| i = Ir(() => { | |
| let a = e(t) | |
| ;(0, ot.default)(n, a) || (o(a), r && r()) | |
| }, [n, t, r]) | |
| return g(i), [n, i] | |
| } | |
| function it(t, e, r) { | |
| let [n, o] = K(t, e, r) | |
| return ( | |
| g( | |
| function () { | |
| let a = t.getHandlerId() | |
| if (a != null) | |
| return t.subscribeToStateChange(o, { handlerIds: [a] }) | |
| }, | |
| [t, o] | |
| ), | |
| n | |
| ) | |
| } | |
| function X(t, e, r) { | |
| return it(e, t || (() => ({})), () => r.reconnect()) | |
| } | |
| const { useMemo: xr } = React | |
| function z(t, e) { | |
| let r = [...(e || [])] | |
| return ( | |
| e == null && typeof t != 'function' && r.push(t), | |
| xr(() => (typeof t == 'function' ? t() : t), r) | |
| ) | |
| } | |
| const { useMemo: st } = React | |
| function at(t) { | |
| return st(() => t.hooks.dragSource(), [t]) | |
| } | |
| function ct(t) { | |
| return st(() => t.hooks.dragPreview(), [t]) | |
| } | |
| const { useMemo: Mr } = React | |
| var ue = !1, | |
| fe = !1, | |
| Q = class { | |
| receiveHandlerId(e) { | |
| this.sourceId = e | |
| } | |
| getHandlerId() { | |
| return this.sourceId | |
| } | |
| canDrag() { | |
| s( | |
| !ue, | |
| 'You may not call monitor.canDrag() inside your canDrag() implementation. Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source-monitor' | |
| ) | |
| try { | |
| return ( | |
| (ue = !0), this.internalMonitor.canDragSource(this.sourceId) | |
| ) | |
| } finally { | |
| ue = !1 | |
| } | |
| } | |
| isDragging() { | |
| if (!this.sourceId) return !1 | |
| s( | |
| !fe, | |
| 'You may not call monitor.isDragging() inside your isDragging() implementation. Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source-monitor' | |
| ) | |
| try { | |
| return ( | |
| (fe = !0), this.internalMonitor.isDraggingSource(this.sourceId) | |
| ) | |
| } finally { | |
| fe = !1 | |
| } | |
| } | |
| subscribeToStateChange(e, r) { | |
| return this.internalMonitor.subscribeToStateChange(e, r) | |
| } | |
| isDraggingSource(e) { | |
| return this.internalMonitor.isDraggingSource(e) | |
| } | |
| isOverTarget(e, r) { | |
| return this.internalMonitor.isOverTarget(e, r) | |
| } | |
| getTargetIds() { | |
| return this.internalMonitor.getTargetIds() | |
| } | |
| isSourcePublic() { | |
| return this.internalMonitor.isSourcePublic() | |
| } | |
| getSourceId() { | |
| return this.internalMonitor.getSourceId() | |
| } | |
| subscribeToOffsetChange(e) { | |
| return this.internalMonitor.subscribeToOffsetChange(e) | |
| } | |
| canDragSource(e) { | |
| return this.internalMonitor.canDragSource(e) | |
| } | |
| canDropOnTarget(e) { | |
| return this.internalMonitor.canDropOnTarget(e) | |
| } | |
| getItemType() { | |
| return this.internalMonitor.getItemType() | |
| } | |
| getItem() { | |
| return this.internalMonitor.getItem() | |
| } | |
| getDropResult() { | |
| return this.internalMonitor.getDropResult() | |
| } | |
| didDrop() { | |
| return this.internalMonitor.didDrop() | |
| } | |
| getInitialClientOffset() { | |
| return this.internalMonitor.getInitialClientOffset() | |
| } | |
| getInitialSourceClientOffset() { | |
| return this.internalMonitor.getInitialSourceClientOffset() | |
| } | |
| getSourceClientOffset() { | |
| return this.internalMonitor.getSourceClientOffset() | |
| } | |
| getClientOffset() { | |
| return this.internalMonitor.getClientOffset() | |
| } | |
| getDifferenceFromInitialOffset() { | |
| return this.internalMonitor.getDifferenceFromInitialOffset() | |
| } | |
| constructor(e) { | |
| ;(this.sourceId = null), (this.internalMonitor = e.getMonitor()) | |
| } | |
| } | |
| var de = !1, | |
| J = class { | |
| receiveHandlerId(e) { | |
| this.targetId = e | |
| } | |
| getHandlerId() { | |
| return this.targetId | |
| } | |
| subscribeToStateChange(e, r) { | |
| return this.internalMonitor.subscribeToStateChange(e, r) | |
| } | |
| canDrop() { | |
| if (!this.targetId) return !1 | |
| s( | |
| !de, | |
| 'You may not call monitor.canDrop() inside your canDrop() implementation. Read more: http://react-dnd.github.io/react-dnd/docs/api/drop-target-monitor' | |
| ) | |
| try { | |
| return ( | |
| (de = !0), this.internalMonitor.canDropOnTarget(this.targetId) | |
| ) | |
| } finally { | |
| de = !1 | |
| } | |
| } | |
| isOver(e) { | |
| return this.targetId | |
| ? this.internalMonitor.isOverTarget(this.targetId, e) | |
| : !1 | |
| } | |
| getItemType() { | |
| return this.internalMonitor.getItemType() | |
| } | |
| getItem() { | |
| return this.internalMonitor.getItem() | |
| } | |
| getDropResult() { | |
| return this.internalMonitor.getDropResult() | |
| } | |
| didDrop() { | |
| return this.internalMonitor.didDrop() | |
| } | |
| getInitialClientOffset() { | |
| return this.internalMonitor.getInitialClientOffset() | |
| } | |
| getInitialSourceClientOffset() { | |
| return this.internalMonitor.getInitialSourceClientOffset() | |
| } | |
| getSourceClientOffset() { | |
| return this.internalMonitor.getSourceClientOffset() | |
| } | |
| getClientOffset() { | |
| return this.internalMonitor.getClientOffset() | |
| } | |
| getDifferenceFromInitialOffset() { | |
| return this.internalMonitor.getDifferenceFromInitialOffset() | |
| } | |
| constructor(e) { | |
| ;(this.targetId = null), (this.internalMonitor = e.getMonitor()) | |
| } | |
| } | |
| function ut(t, e, r) { | |
| let n = r.getRegistry(), | |
| o = n.addTarget(t, e) | |
| return [o, () => n.removeTarget(o)] | |
| } | |
| function ft(t, e, r) { | |
| let n = r.getRegistry(), | |
| o = n.addSource(t, e) | |
| return [o, () => n.removeSource(o)] | |
| } | |
| function k(t, e, r, n) { | |
| let o = r ? r.call(n, t, e) : void 0 | |
| if (o !== void 0) return !!o | |
| if (t === e) return !0 | |
| if (typeof t != 'object' || !t || typeof e != 'object' || !e) return !1 | |
| let i = Object.keys(t), | |
| a = Object.keys(e) | |
| if (i.length !== a.length) return !1 | |
| let c = Object.prototype.hasOwnProperty.bind(e) | |
| for (let u = 0; u < i.length; u++) { | |
| let f = i[u] | |
| if (!c(f)) return !1 | |
| let m = t[f], | |
| I = e[f] | |
| if ( | |
| ((o = r ? r.call(n, m, I, f) : void 0), | |
| o === !1 || (o === void 0 && m !== I)) | |
| ) | |
| return !1 | |
| } | |
| return !0 | |
| } | |
| function j(t) { | |
| return ( | |
| t !== null && | |
| typeof t == 'object' && | |
| Object.prototype.hasOwnProperty.call(t, 'current') | |
| ) | |
| } | |
| const { cloneElement: dt, isValidElement: Cr } = React | |
| function Rr(t) { | |
| if (typeof t.type == 'string') return | |
| let e = t.type.displayName || t.type.name || 'the component' | |
| 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.` | |
| ) | |
| } | |
| function Pr(t) { | |
| return (e = null, r = null) => { | |
| if (!Cr(e)) { | |
| let i = e | |
| return t(i, r), i | |
| } | |
| let n = e | |
| return Rr(n), Nr(n, r ? (i) => t(i, r) : t) | |
| } | |
| } | |
| function Z(t) { | |
| let e = {} | |
| return ( | |
| Object.keys(t).forEach((r) => { | |
| let n = t[r] | |
| if (r.endsWith('Ref')) e[r] = t[r] | |
| else { | |
| let o = Pr(n) | |
| e[r] = () => o | |
| } | |
| }), | |
| e | |
| ) | |
| } | |
| function lt(t, e) { | |
| typeof t == 'function' ? t(e) : (t.current = e) | |
| } | |
| function Nr(t, e) { | |
| let r = t.ref | |
| return ( | |
| s( | |
| typeof r != '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' | |
| ), | |
| r | |
| ? dt(t, { | |
| ref: (n) => { | |
| lt(r, n), lt(e, n) | |
| }, | |
| }) | |
| : dt(t, { ref: e }) | |
| ) | |
| } | |
| var ee = class { | |
| receiveHandlerId(e) { | |
| this.handlerId !== e && ((this.handlerId = e), this.reconnect()) | |
| } | |
| get connectTarget() { | |
| return this.dragSource | |
| } | |
| get dragSourceOptions() { | |
| return this.dragSourceOptionsInternal | |
| } | |
| set dragSourceOptions(e) { | |
| this.dragSourceOptionsInternal = e | |
| } | |
| get dragPreviewOptions() { | |
| return this.dragPreviewOptionsInternal | |
| } | |
| set dragPreviewOptions(e) { | |
| this.dragPreviewOptionsInternal = e | |
| } | |
| reconnect() { | |
| let e = this.reconnectDragSource() | |
| this.reconnectDragPreview(e) | |
| } | |
| reconnectDragSource() { | |
| let e = this.dragSource, | |
| r = | |
| this.didHandlerIdChange() || | |
| this.didConnectedDragSourceChange() || | |
| this.didDragSourceOptionsChange() | |
| return ( | |
| r && this.disconnectDragSource(), | |
| this.handlerId | |
| ? e | |
| ? (r && | |
| ((this.lastConnectedHandlerId = this.handlerId), | |
| (this.lastConnectedDragSource = e), | |
| (this.lastConnectedDragSourceOptions = | |
| this.dragSourceOptions), | |
| (this.dragSourceUnsubscribe = | |
| this.backend.connectDragSource( | |
| this.handlerId, | |
| e, | |
| this.dragSourceOptions | |
| ))), | |
| r) | |
| : ((this.lastConnectedDragSource = e), r) | |
| : r | |
| ) | |
| } | |
| reconnectDragPreview(e = !1) { | |
| let r = this.dragPreview, | |
| n = | |
| e || | |
| this.didHandlerIdChange() || | |
| this.didConnectedDragPreviewChange() || | |
| this.didDragPreviewOptionsChange() | |
| if ((n && this.disconnectDragPreview(), !!this.handlerId)) { | |
| if (!r) { | |
| this.lastConnectedDragPreview = r | |
| return | |
| } | |
| n && | |
| ((this.lastConnectedHandlerId = this.handlerId), | |
| (this.lastConnectedDragPreview = r), | |
| (this.lastConnectedDragPreviewOptions = this.dragPreviewOptions), | |
| (this.dragPreviewUnsubscribe = this.backend.connectDragPreview( | |
| this.handlerId, | |
| r, | |
| this.dragPreviewOptions | |
| ))) | |
| } | |
| } | |
| didHandlerIdChange() { | |
| return this.lastConnectedHandlerId !== this.handlerId | |
| } | |
| didConnectedDragSourceChange() { | |
| return this.lastConnectedDragSource !== this.dragSource | |
| } | |
| didConnectedDragPreviewChange() { | |
| return this.lastConnectedDragPreview !== this.dragPreview | |
| } | |
| didDragSourceOptionsChange() { | |
| return !k(this.lastConnectedDragSourceOptions, this.dragSourceOptions) | |
| } | |
| didDragPreviewOptionsChange() { | |
| return !k( | |
| this.lastConnectedDragPreviewOptions, | |
| this.dragPreviewOptions | |
| ) | |
| } | |
| disconnectDragSource() { | |
| this.dragSourceUnsubscribe && | |
| (this.dragSourceUnsubscribe(), | |
| (this.dragSourceUnsubscribe = void 0)) | |
| } | |
| disconnectDragPreview() { | |
| this.dragPreviewUnsubscribe && | |
| (this.dragPreviewUnsubscribe(), | |
| (this.dragPreviewUnsubscribe = void 0), | |
| (this.dragPreviewNode = null), | |
| (this.dragPreviewRef = null)) | |
| } | |
| get dragSource() { | |
| return ( | |
| this.dragSourceNode || | |
| (this.dragSourceRef && this.dragSourceRef.current) | |
| ) | |
| } | |
| get dragPreview() { | |
| return ( | |
| this.dragPreviewNode || | |
| (this.dragPreviewRef && this.dragPreviewRef.current) | |
| ) | |
| } | |
| clearDragSource() { | |
| ;(this.dragSourceNode = null), (this.dragSourceRef = null) | |
| } | |
| clearDragPreview() { | |
| ;(this.dragPreviewNode = null), (this.dragPreviewRef = null) | |
| } | |
| constructor(e) { | |
| ;(this.hooks = Z({ | |
| dragSource: (r, n) => { | |
| this.clearDragSource(), | |
| (this.dragSourceOptions = n || null), | |
| j(r) ? (this.dragSourceRef = r) : (this.dragSourceNode = r), | |
| this.reconnectDragSource() | |
| }, | |
| dragPreview: (r, n) => { | |
| this.clearDragPreview(), | |
| (this.dragPreviewOptions = n || null), | |
| j(r) ? (this.dragPreviewRef = r) : (this.dragPreviewNode = r), | |
| this.reconnectDragPreview() | |
| }, | |
| })), | |
| (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) | |
| } | |
| } | |
| var te = class { | |
| get connectTarget() { | |
| return this.dropTarget | |
| } | |
| reconnect() { | |
| let e = | |
| this.didHandlerIdChange() || | |
| this.didDropTargetChange() || | |
| this.didOptionsChange() | |
| e && this.disconnectDropTarget() | |
| let r = this.dropTarget | |
| if (this.handlerId) { | |
| if (!r) { | |
| this.lastConnectedDropTarget = r | |
| return | |
| } | |
| e && | |
| ((this.lastConnectedHandlerId = this.handlerId), | |
| (this.lastConnectedDropTarget = r), | |
| (this.lastConnectedDropTargetOptions = this.dropTargetOptions), | |
| (this.unsubscribeDropTarget = this.backend.connectDropTarget( | |
| this.handlerId, | |
| r, | |
| this.dropTargetOptions | |
| ))) | |
| } | |
| } | |
| receiveHandlerId(e) { | |
| e !== this.handlerId && ((this.handlerId = e), this.reconnect()) | |
| } | |
| get dropTargetOptions() { | |
| return this.dropTargetOptionsInternal | |
| } | |
| set dropTargetOptions(e) { | |
| this.dropTargetOptionsInternal = e | |
| } | |
| didHandlerIdChange() { | |
| return this.lastConnectedHandlerId !== this.handlerId | |
| } | |
| didDropTargetChange() { | |
| return this.lastConnectedDropTarget !== this.dropTarget | |
| } | |
| didOptionsChange() { | |
| return !k(this.lastConnectedDropTargetOptions, this.dropTargetOptions) | |
| } | |
| disconnectDropTarget() { | |
| this.unsubscribeDropTarget && | |
| (this.unsubscribeDropTarget(), | |
| (this.unsubscribeDropTarget = void 0)) | |
| } | |
| get dropTarget() { | |
| return ( | |
| this.dropTargetNode || | |
| (this.dropTargetRef && this.dropTargetRef.current) | |
| ) | |
| } | |
| clearDropTarget() { | |
| ;(this.dropTargetRef = null), (this.dropTargetNode = null) | |
| } | |
| constructor(e) { | |
| ;(this.hooks = Z({ | |
| dropTarget: (r, n) => { | |
| this.clearDropTarget(), | |
| (this.dropTargetOptions = n), | |
| j(r) ? (this.dropTargetRef = r) : (this.dropTargetNode = r), | |
| this.reconnect() | |
| }, | |
| })), | |
| (this.handlerId = null), | |
| (this.dropTargetRef = null), | |
| (this.dropTargetOptionsInternal = null), | |
| (this.lastConnectedHandlerId = null), | |
| (this.lastConnectedDropTarget = null), | |
| (this.lastConnectedDropTargetOptions = null), | |
| (this.backend = e) | |
| } | |
| } | |
| const { useContext: _r } = React | |
| function l() { | |
| let { dragDropManager: t } = _r(H) | |
| return s(t != null, 'Expected drag drop context'), t | |
| } | |
| function pt(t, e) { | |
| let r = l(), | |
| n = Mr(() => new ee(r.getBackend()), [r]) | |
| return ( | |
| g( | |
| () => ( | |
| (n.dragSourceOptions = t || null), | |
| n.reconnect(), | |
| () => n.disconnectDragSource() | |
| ), | |
| [n, t] | |
| ), | |
| g( | |
| () => ( | |
| (n.dragPreviewOptions = e || null), | |
| n.reconnect(), | |
| () => n.disconnectDragPreview() | |
| ), | |
| [n, e] | |
| ), | |
| n | |
| ) | |
| } | |
| const { useMemo: Ar } = React | |
| function gt() { | |
| let t = l() | |
| return Ar(() => new Q(t), [t]) | |
| } | |
| const { useEffect: kr, useMemo: jr } = React | |
| var re = class { | |
| beginDrag() { | |
| let e = this.spec, | |
| r = this.monitor, | |
| n = null | |
| return ( | |
| typeof e.item == 'object' | |
| ? (n = e.item) | |
| : typeof e.item == 'function' | |
| ? (n = e.item(r)) | |
| : (n = {}), | |
| n ?? null | |
| ) | |
| } | |
| canDrag() { | |
| let e = this.spec, | |
| r = this.monitor | |
| return typeof e.canDrag == 'boolean' | |
| ? e.canDrag | |
| : typeof e.canDrag == 'function' | |
| ? e.canDrag(r) | |
| : !0 | |
| } | |
| isDragging(e, r) { | |
| let n = this.spec, | |
| o = this.monitor, | |
| { isDragging: i } = n | |
| return i ? i(o) : r === e.getSourceId() | |
| } | |
| endDrag() { | |
| let e = this.spec, | |
| r = this.monitor, | |
| n = this.connector, | |
| { end: o } = e | |
| o && o(r.getItem(), r), n.reconnect() | |
| } | |
| constructor(e, r, n) { | |
| ;(this.spec = e), (this.monitor = r), (this.connector = n) | |
| } | |
| } | |
| function ht(t, e, r) { | |
| let n = jr(() => new re(t, e, r), [e, r]) | |
| return ( | |
| kr(() => { | |
| n.spec = t | |
| }, [t]), | |
| n | |
| ) | |
| } | |
| const { useMemo: Hr } = React | |
| function mt(t) { | |
| return Hr(() => { | |
| let e = t.type | |
| return s(e != null, 'spec.type must be defined'), e | |
| }, [t]) | |
| } | |
| function yt(t, e, r) { | |
| let n = l(), | |
| o = ht(t, e, r), | |
| i = mt(t) | |
| g( | |
| function () { | |
| if (i != null) { | |
| let [c, u] = ft(i, o, n) | |
| return e.receiveHandlerId(c), r.receiveHandlerId(c), u | |
| } | |
| }, | |
| [n, e, r, o, i] | |
| ) | |
| } | |
| function vs(t, e) { | |
| let r = z(t, e) | |
| s( | |
| !r.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)' | |
| ) | |
| let n = gt(), | |
| o = pt(r.options, r.previewOptions) | |
| return yt(r, n, o), [X(r.collect, n, o), at(o), ct(o)] | |
| } | |
| const { useEffect: Ot } = React | |
| function ws(t) { | |
| let r = l().getMonitor(), | |
| [n, o] = K(r, t) | |
| return ( | |
| Ot(() => r.subscribeToOffsetChange(o)), | |
| Ot(() => r.subscribeToStateChange(o)), | |
| n | |
| ) | |
| } | |
| const { useMemo: Ur } = React | |
| function Dt(t) { | |
| return Ur(() => t.hooks.dropTarget(), [t]) | |
| } | |
| const { useMemo: Vr } = React | |
| function bt(t) { | |
| let e = l(), | |
| r = Vr(() => new te(e.getBackend()), [e]) | |
| return ( | |
| g( | |
| () => ( | |
| (r.dropTargetOptions = t || null), | |
| r.reconnect(), | |
| () => r.disconnectDropTarget() | |
| ), | |
| [t] | |
| ), | |
| r | |
| ) | |
| } | |
| const { useMemo: Gr } = React | |
| function vt() { | |
| let t = l() | |
| return Gr(() => new J(t), [t]) | |
| } | |
| const { useMemo: Lr } = React | |
| function St(t) { | |
| let { accept: e } = t | |
| return Lr( | |
| () => ( | |
| s(t.accept != null, 'accept must be defined'), | |
| Array.isArray(e) ? e : [e] | |
| ), | |
| [e] | |
| ) | |
| } | |
| const { useEffect: qr, useMemo: Br } = React | |
| var ne = class { | |
| canDrop() { | |
| let e = this.spec, | |
| r = this.monitor | |
| return e.canDrop ? e.canDrop(r.getItem(), r) : !0 | |
| } | |
| hover() { | |
| let e = this.spec, | |
| r = this.monitor | |
| e.hover && e.hover(r.getItem(), r) | |
| } | |
| drop() { | |
| let e = this.spec, | |
| r = this.monitor | |
| if (e.drop) return e.drop(r.getItem(), r) | |
| } | |
| constructor(e, r) { | |
| ;(this.spec = e), (this.monitor = r) | |
| } | |
| } | |
| function Et(t, e) { | |
| let r = Br(() => new ne(t, e), [e]) | |
| return ( | |
| qr(() => { | |
| r.spec = t | |
| }, [t]), | |
| r | |
| ) | |
| } | |
| function Tt(t, e, r) { | |
| let n = l(), | |
| o = Et(t, e), | |
| i = St(t) | |
| g( | |
| function () { | |
| let [c, u] = ut(i, o, n) | |
| return e.receiveHandlerId(c), r.receiveHandlerId(c), u | |
| }, | |
| [n, e, o, r, i.map((a) => a.toString()).join('|')] | |
| ) | |
| } | |
| function oa(t, e) { | |
| let r = z(t, e), | |
| n = vt(), | |
| o = bt(r.options) | |
| return Tt(r, n, o), [X(r.collect, n, o), Dt(o)] | |
| } | |
| exports.DndContext = H; | |
| exports.DndProvider = oi; | |
| exports.DragPreviewImage = ai; | |
| exports.useDrag = vs; | |
| exports.useDragDropManager = l; | |
| exports.useDragLayer = ws; | |
| exports.useDrop = oa; | |
| }))); |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
For use https://cdn.statically.io/gist/black1277/c5ced8c4bb15cf05dda3b987e39036af/raw/0fa589ad8ef3b2d9cf35239c931b4043c4362c24/ReactDnD.umd.min.js