!function(e){"use strict";var t,r="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},n=function(e,t,r,n,i,o,a,u){if(!e){var c;if(void 0===t)c=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var s=[r,n,i,o,a,u],l=0;(c=new Error(t.replace(/%s/g,function(){return s[l++]}))).name="Invariant Violation"}throw c.framesToPop=1,c}},i="undefined"!=typeof window?e.useLayoutEffect:e.useEffect,o=function(e,t,r,n){var i=r?r.call(n,e,t):void 0;if(void 0!==i)return!!i;if(e===t)return!0;if("object"!=typeof e||!e||"object"!=typeof t||!t)return!1;var o=Object.keys(e),a=Object.keys(t);if(o.length!==a.length)return!1;for(var u=Object.prototype.hasOwnProperty.bind(t),c=0;c0&&void 0!==arguments[0]?arguments[0]:[],r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{publishSource:!0},n=r.publishSource,i=void 0===n||n,o=r.clientOffset,a=r.getSourceClientOffset,u=e.getMonitor(),c=e.getRegistry();e.dispatch(m(o)),T(t,u,c);var s=k(t,u);if(null!==s){var l=null;o&&(I(a),l=a(s)),e.dispatch(m(o,l));var f=c.getSource(s),d=f.beginDrag(u,s);E(d),c.pinSource(s);var g=c.getSourceType(s);return{type:h,payload:{itemType:g,item:d,sourceId:s,clientOffset:o||null,sourceClientOffset:l||null,isSourcePublic:!!i}}}e.dispatch(D)}}function T(e,t,r){n(!t.isDragging(),"Cannot call beginDrag while dragging."),e.forEach(function(e){n(r.getSource(e),"Expected sourceIds to be registered.")})}function I(e){n("function"==typeof e,"When clientOffset is provided, getSourceClientOffset must be a function.")}function E(e){n(O(e),"Item must be an object.")}function k(e,t){for(var r=null,n=e.length-1;n>=0;n--)if(t.canDragSource(e[n])){r=e[n];break}return r}function C(e){return function(){if(e.getMonitor().isDragging())return{type:p}}}function P(e,t){return null===t?null===e:Array.isArray(e)?e.some(function(e){return e===t}):e===t}function N(e){return function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=r.clientOffset;R(t);var i=t.slice(0),o=e.getMonitor(),a=e.getRegistry();x(i,o,a);var u=o.getItemType();return j(i,a,u),M(i,o,a),{type:v,payload:{targetIds:i,clientOffset:n||null}}}}function R(e){n(Array.isArray(e),"Expected targetIds to be an array.")}function x(e,t,r){n(t.isDragging(),"Cannot call hover while not dragging."),n(!t.didDrop(),"Cannot call hover after drop.");for(var i=0;i=0;n--){var i=e[n];P(t.getTargetType(i),r)||e.splice(n,1)}}function M(e,t,r){e.forEach(function(e){r.getTarget(e).hover(t,e)})}function A(e,t){var r=Object.keys(e);return Object.getOwnPropertySymbols&&r.push.apply(r,Object.getOwnPropertySymbols(e)),t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r}function L(e){for(var t=1;t0&&void 0!==arguments[0]?arguments[0]:{},r=e.getMonitor(),n=e.getRegistry();U(r);var i=B(r);i.forEach(function(i,o){var a=F(i,o,n,r),u={type:y,payload:{dropResult:L({},t,{},a)}};e.dispatch(u)})}}function U(e){n(e.isDragging(),"Cannot call drop while not dragging."),n(!e.didDrop(),"Cannot call drop twice during one drag operation.")}function F(e,t,r,i){var o=r.getTarget(e),a=o?o.drop(i,e):void 0;return function(e){n(void 0===e||O(e),"Drop result must either be an object or undefined.")}(a),void 0===a&&(a=0===t?{}:i.getDropResult()),a}function B(e){var t=e.getTargetIds().filter(e.canDropOnTarget,e);return t.reverse(),t}function Y(e){return function(){var t=e.getMonitor(),r=e.getRegistry();!function(e){n(e.isDragging(),"Cannot call endDrag while not dragging.")}(t);var i=t.getSourceId();return r.getSource(i,!0).endDrag(t,i),r.unpinSource(),{type:b}}}var G=function(e,t){return e===t};function X(e,t){var r=Object.keys(e);return Object.getOwnPropertySymbols&&r.push.apply(r,Object.getOwnPropertySymbols(e)),t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r}function W(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var K={initialSourceClientOffset:null,initialClientOffset:null,clientOffset:null};function V(){var e,t,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:K,n=arguments.length>1?arguments[1]:void 0,i=n.payload;switch(n.type){case g:case h:return{initialSourceClientOffset:i.sourceClientOffset,initialClientOffset:i.clientOffset,clientOffset:i.clientOffset};case v:return e=r.clientOffset,t=i.clientOffset,!e&&!t||e&&t&&e.x===t.x&&e.y===t.y?r:function(e){for(var t=1;t0&&void 0!==arguments[0]?arguments[0]:te,n=arguments.length>1?arguments[1]:void 0,i=n.payload;switch(n.type){case h:return $({},r,{itemType:i.itemType,item:i.item,sourceId:i.sourceId,isSourcePublic:i.isSourcePublic,dropResult:null,didDrop:!1});case p:return $({},r,{isSourcePublic:!0});case v:return $({},r,{targetIds:i.targetIds});case Q:return-1===r.targetIds.indexOf(i.targetId)?r:$({},r,{targetIds:(e=r.targetIds,t=i.targetId,e.filter(function(e){return e!==t}))});case y:return $({},r,{dropResult:i.dropResult,didDrop:!0,targetIds:[]});case b:return $({},r,{itemType:null,item:null,sourceId:null,dropResult:null,didDrop:!1,isSourcePublic:null,targetIds:[]});default:return r}}function ne(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;switch((arguments.length>1?arguments[1]:void 0).type){case q:case z:return e+1;case J:case Q:return e-1;default:return e}}var ie=[],oe=[];function ae(e,t){return e!==ie&&(e===oe||void 0===t||(r=e,t.filter(function(e){return r.indexOf(e)>-1})).length>0);var r}function ue(){var e=arguments.length>1?arguments[1]:void 0;switch(e.type){case v:break;case q:case z:case Q:case J:return ie;case h:case p:case b:case y:default:return oe}var t=e.payload,r=t.targetIds,n=void 0===r?[]:r,i=t.prevTargetIds,o=void 0===i?[]:i,a=function(e,t){var r=new Map,n=function(e){return r.set(e,r.has(e)?r.get(e)+1:1)};e.forEach(n),t.forEach(n);var i=[];return r.forEach(function(e,t){1===e&&i.push(t)}),i}(n,o);if(!(a.length>0||!function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:G;if(e.length!==t.length)return!1;for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:0)+1}function se(e,t){var r=Object.keys(e);return Object.getOwnPropertySymbols&&r.push.apply(r,Object.getOwnPropertySymbols(e)),t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r}function le(e){for(var t=1;t0&&void 0!==arguments[0]?arguments[0]:{},i=arguments.length>1?arguments[1]:void 0;return{dirtyHandlerIds:ue(n.dirtyHandlerIds,{type:i.type,payload:le({},i.payload,{prevTargetIds:(e=n,t="dragOperation.targetIds",r=[],t.split(".").reduce(function(e,t){return e&&e[t]?e[t]:r||null},e))})}),dragOffset:V(n.dragOffset,i),refCount:ne(n.refCount,i),dragOperation:re(n.dragOperation,i),stateId:ce(n.stateId)}}function ge(e,t){return{x:e.x-t.x,y:e.y-t.y}}function he(e,t){for(var r=0;r1&&void 0!==arguments[1]?arguments[1]:{handlerIds:void 0},i=r.handlerIds;n("function"==typeof e,"listener must be a function."),n(void 0===i||Array.isArray(i),"handlerIds, when specified, must be an array of strings.");var o=this.store.getState().stateId,a=function(){var r=t.store.getState(),n=r.stateId;try{n===o||n===o+1&&!ae(r.dirtyHandlerIds,i)||e()}finally{o=n}};return this.store.subscribe(a)}},{key:"subscribeToOffsetChange",value:function(e){var t=this;n("function"==typeof e,"listener must be a function.");var r=this.store.getState().dragOffset;return this.store.subscribe(function(){var n=t.store.getState().dragOffset;n!==r&&(r=n,e())})}},{key:"canDragSource",value:function(e){if(!e)return!1;var t=this.registry.getSource(e);return n(t,"Expected to find a valid source."),!this.isDragging()&&t.canDrag(this,e)}},{key:"canDropOnTarget",value:function(e){if(!e)return!1;var t=this.registry.getTarget(e);return n(t,"Expected to find a valid target."),!(!this.isDragging()||this.didDrop())&&(P(this.registry.getTargetType(e),this.getItemType())&&t.canDrop(this,e))}},{key:"isDragging",value:function(){return Boolean(this.getItemType())}},{key:"isDraggingSource",value:function(e){if(!e)return!1;var t=this.registry.getSource(e,!0);return n(t,"Expected to find a valid source."),!(!this.isDragging()||!this.isSourcePublic())&&(this.registry.getSourceType(e)===this.getItemType()&&t.isDragging(this,e))}},{key:"isOverTarget",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{shallow:!1};if(!e)return!1;var r=t.shallow;if(!this.isDragging())return!1;var n=this.registry.getTargetType(e),i=this.getItemType();if(i&&!P(n,i))return!1;var o=this.getTargetIds();if(!o.length)return!1;var a=o.indexOf(e);return r?a===o.length-1:a>-1}},{key:"getItemType",value:function(){return this.store.getState().dragOperation.itemType}},{key:"getItem",value:function(){return this.store.getState().dragOperation.item}},{key:"getSourceId",value:function(){return this.store.getState().dragOperation.sourceId}},{key:"getTargetIds",value:function(){return this.store.getState().dragOperation.targetIds}},{key:"getDropResult",value:function(){return this.store.getState().dragOperation.dropResult}},{key:"didDrop",value:function(){return this.store.getState().dragOperation.didDrop}},{key:"isSourcePublic",value:function(){return this.store.getState().dragOperation.isSourcePublic}},{key:"getInitialClientOffset",value:function(){return this.store.getState().dragOffset.initialClientOffset}},{key:"getInitialSourceClientOffset",value:function(){return this.store.getState().dragOffset.initialSourceClientOffset}},{key:"getClientOffset",value:function(){return this.store.getState().dragOffset.clientOffset}},{key:"getSourceClientOffset",value:function(){return e=this.store.getState().dragOffset,n=e.clientOffset,i=e.initialClientOffset,o=e.initialSourceClientOffset,n&&i&&o?ge((r=o,{x:(t=n).x+r.x,y:t.y+r.y}),i):null;var e,t,r,n,i,o}},{key:"getDifferenceFromInitialOffset",value:function(){return e=this.store.getState().dragOffset,t=e.clientOffset,r=e.initialClientOffset,t&&r?ge(t,r):null;var e,t,r}}])&&he(t.prototype,r),i&&he(t,i),e}(),ve="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},ye=be;function be(e){we.length||me(),we[we.length]=e}var me,we=[],Oe=0,De=1024;function Se(){for(;OeDe){for(var t=0,r=we.length-Oe;t1&&void 0!==arguments[1]&&arguments[1];n(this.isSourceId(e),"Expected a valid source ID.");var r=t&&e===this.pinnedSourceId,i=r?this.pinnedSource:this.dragSources.get(e);return i}},{key:"getTarget",value:function(e){return n(this.isTargetId(e),"Expected a valid target ID."),this.dropTargets.get(e)}},{key:"getSourceType",value:function(e){return n(this.isSourceId(e),"Expected a valid source ID."),this.types.get(e)}},{key:"getTargetType",value:function(e){return n(this.isTargetId(e),"Expected a valid target ID."),this.types.get(e)}},{key:"isSourceId",value:function(e){return Ye(e)===t.SOURCE}},{key:"isTargetId",value:function(e){return Ye(e)===t.TARGET}},{key:"removeSource",value:function(e){var t=this;n(this.getSource(e),"Expected an existing source."),this.store.dispatch(function(e){return{type:J,payload:{sourceId:e}}}(e)),je(function(){t.dragSources.delete(e),t.types.delete(e)})}},{key:"removeTarget",value:function(e){n(this.getTarget(e),"Expected an existing target."),this.store.dispatch(function(e){return{type:Q,payload:{targetId:e}}}(e)),this.dropTargets.delete(e),this.types.delete(e)}},{key:"pinSource",value:function(e){var t=this.getSource(e);n(t,"Expected an existing source."),this.pinnedSourceId=e,this.pinnedSource=t}},{key:"unpinSource",value:function(){n(this.pinnedSource,"No source is pinned at the time."),this.pinnedSourceId=null,this.pinnedSource=null}},{key:"addHandler",value:function(e,r,n){var i=Be(e);return this.types.set(i,r),e===t.SOURCE?this.dragSources.set(i,n):e===t.TARGET&&this.dropTargets.set(i,n),i}}])&&Ue(r.prototype,i),o&&Ue(r,o),e}();function We(e,t){for(var r=0;r0&&void 0!==arguments[0]&&arguments[0];!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.isSetUp=!1,this.handleRefCountChange=function(){var e=t.store.getState().refCount>0;t.backend&&(e&&!t.isSetUp?(t.backend.setup(),t.isSetUp=!0):!e&&t.isSetUp&&(t.backend.teardown(),t.isSetUp=!1))};var n=function(e){var t="undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION__;return d(de,e&&t&&t({name:"dnd-core",instanceId:"dnd-core"}))}(r);this.store=n,this.monitor=new pe(n,new Xe(n)),n.subscribe(this.handleRefCountChange)}var t,r,n;return t=e,(r=[{key:"receiveBackend",value:function(e){this.backend=e}},{key:"getMonitor",value:function(){return this.monitor}},{key:"getBackend",value:function(){return this.backend}},{key:"getRegistry",value:function(){return this.monitor.registry}},{key:"getActions",value:function(){var e=this,t=this.store.dispatch;var r=function(e){return{beginDrag:S(e),publishDragSource:C(e),hover:N(e),drop:H(e),endDrag:Y(e)}}(this);return Object.keys(r).reduce(function(n,i){var o,a=r[i];return n[i]=(o=a,function(){for(var r=arguments.length,n=new Array(r),i=0;i or
. Read more: https://facebook.github.io/react/docs/more-about-refs.html#the-ref-callback-attribute"),i?e.cloneElement(t,{ref:function(e){et(i,e),et(r,e)}}):e.cloneElement(t,{ref:r})}function rt(e){if("string"!=typeof e.type){var t=e.type.displayName||e.type.name||"the component";throw new Error("Only native element nodes can now be passed to React DnD connectors."+"You can either wrap ".concat(t," into a
, or turn it into a ")+"drag source or a drop target itself.")}}function nt(t){var r={};return Object.keys(t).forEach(function(n){var i=t[n];if(n.endsWith("Ref"))r[n]=t[n];else{var o=function(t){return function(){var r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(!e.isValidElement(r)){var i=r;return t(i,n),i}var o=r;rt(o);var a=n?function(e){return t(e,n)}:t;return tt(o,a)}}(i);r[n]=function(){return o}}}),r}function it(e){return(it="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function ot(e){return null!==e&&"object"===it(e)&&e.hasOwnProperty("current")}function at(e,t){for(var r=0;r=0||(i[r]=e[r]);return i}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}var Ot=e.memo(function(t){var n=t.children,i=wt(t,["children"]),o="manager"in i?{dragDropManager:i.manager}:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0!==r?r:window,n=arguments.length>2?arguments[2]:void 0,i=arguments.length>3?arguments[3]:void 0,o=t;o[Dt]||(o[Dt]=function(e,t,r,n){return{dragDropManager:Ve(e,t,r,n)}}(e,t,n,i));return o[Dt]}(i.backend,i.context,i.options,i.debugMode);return e.createElement(qe.Provider,{value:o},n)}),Dt=Symbol.for("__REACT_DND_CONTEXT_INSTANCE__");function St(e){var t=null;return function(){return null==t&&(t=e()),t}}function Tt(e,t){for(var r=0;r0}},{key:"leave",value:function(e){var t,r,n=this.entered.length;return this.entered=(t=this.entered.filter(this.isNodeInDocument),r=e,t.filter(function(e){return e!==r})),n>0&&0===this.entered.length}},{key:"reset",value:function(){this.entered=[]}}])&&Tt(t.prototype,r),n&&Tt(t,n),e}(),Et=St(function(){return/firefox/i.test(navigator.userAgent)}),kt=St(function(){return Boolean(window.safari)});function Ct(e,t){for(var r=0;re))return r[u];s=u-1}}var f=e-t[a=Math.max(0,s)],d=f*f;return r[a]+n[a]*f+i[a]*d+o[a]*f*d}}])&&Ct(t.prototype,r),n&&Ct(t,n),e}(),Nt=1;function Rt(e){var t=e.nodeType===Nt?e:e.parentElement;if(!t)return null;var r=t.getBoundingClientRect(),n=r.top;return{x:r.left,y:n}}function xt(e){return{x:e.clientX,y:e.clientY}}function jt(e,t,r,n,i){var o,a=function(e){return"IMG"===e.nodeName&&(Et()||!document.documentElement.contains(e))}(t),u=Rt(a?e:t),c={x:r.x-u.x,y:r.y-u.y},s=e.offsetWidth,l=e.offsetHeight,f=n.anchorX,d=n.anchorY,g=function(e,t,r,n){var i=e?t.width:r,o=e?t.height:n;return kt()&&e&&(o/=window.devicePixelRatio,i/=window.devicePixelRatio),{dragPreviewWidth:i,dragPreviewHeight:o}}(a,t,s,l),h=g.dragPreviewWidth,p=g.dragPreviewHeight,v=i.offsetX,y=i.offsetY,b=0===y||y;return{x:0===v||v?v:new Pt([0,.5,1],[c.x,c.x/s*h,c.x+h-s]).interpolate(f),y:b?y:(o=new Pt([0,.5,1],[c.y,c.y/l*p,c.y+p-l]).interpolate(d),kt()&&a&&(o+=(window.devicePixelRatio-1)*p),o)}}var Mt,At="__NATIVE_FILE__",Lt="__NATIVE_URL__",_t="__NATIVE_TEXT__",Ht=Object.freeze({FILE:At,URL:Lt,TEXT:_t});function Ut(e,t,r){var n=t.reduce(function(t,r){return t||e.getData(r)},"");return null!=n?n:r}function Ft(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var Bt=(Ft(Mt={},At,{exposeProperties:{files:function(e){return Array.prototype.slice.call(e.files)},items:function(e){return e.items}},matchesTypes:["Files"]}),Ft(Mt,Lt,{exposeProperties:{urls:function(e,t){return Ut(e,t,"").split("\n")}},matchesTypes:["Url","text/uri-list"]}),Ft(Mt,_t,{exposeProperties:{text:function(e,t){return Ut(e,t,"")}},matchesTypes:["Text","text/plain"]}),Mt);function Yt(e,t){for(var r=0;r-1})})[0]||null}function Wt(e,t){for(var r=0;r