!function(e){"use strict";var t="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{};t.setTimeout,t.clearTimeout;var r,n=t.performance||{},i=(n.now||n.mozNow||n.msNow||n.oNow||n.webkitNow,function(e,t,r,n,i,o,a,u){if(void 0===t)throw new Error("invariant requires an error message argument");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}}),o="undefined"!=typeof window?e.useLayoutEffect:e.useEffect,a=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(O(o)),E(t,u,c);var s=P(t,u);if(null!==s){var l=null;o&&(k(a),l=a(s)),e.dispatch(O(o,l));var f=c.getSource(s),d=f.beginDrag(u,s);C(d),c.pinSource(s);var g=c.getSourceType(s);return{type:v,payload:{itemType:g,item:d,sourceId:s,clientOffset:o||null,sourceClientOffset:l||null,isSourcePublic:!!i}}}e.dispatch(T)}}function E(e,t,r){i(!t.isDragging(),"Cannot call beginDrag while dragging."),e.forEach(function(e){i(r.getSource(e),"Expected sourceIds to be registered.")})}function k(e){i("function"==typeof e,"When clientOffset is provided, getSourceClientOffset must be a function.")}function C(e){i(S(e),"Item must be an object.")}function P(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 N(e){return function(){if(e.getMonitor().isDragging())return{type:y}}}function R(e,t){return null===t?null===e:Array.isArray(e)?e.some(function(e){return e===t}):e===t}function x(e){return function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=r.clientOffset;j(t);var i=t.slice(0),o=e.getMonitor(),a=e.getRegistry();M(i,o,a);var u=o.getItemType();return A(i,a,u),L(i,o,a),{type:b,payload:{targetIds:i,clientOffset:n||null}}}}function j(e){i(Array.isArray(e),"Expected targetIds to be an array.")}function M(e,t,r){i(t.isDragging(),"Cannot call hover while not dragging."),i(!t.didDrop(),"Cannot call hover after drop.");for(var n=0;n=0;n--){var i=e[n];R(t.getTargetType(i),r)||e.splice(n,1)}}function L(e,t,r){e.forEach(function(e){r.getTarget(e).hover(t,e)})}function _(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 H(e){for(var t=1;t0&&void 0!==arguments[0]?arguments[0]:{},r=e.getMonitor(),n=e.getRegistry();B(r);var i=G(r);i.forEach(function(i,o){var a=Y(i,o,n,r),u={type:m,payload:{dropResult:H({},t,{},a)}};e.dispatch(u)})}}function B(e){i(e.isDragging(),"Cannot call drop while not dragging."),i(!e.didDrop(),"Cannot call drop twice during one drag operation.")}function Y(e,t,r,n){var o=r.getTarget(e),a=o?o.drop(n,e):void 0;return function(e){i(void 0===e||S(e),"Drop result must either be an object or undefined.")}(a),void 0===a&&(a=0===t?{}:n.getDropResult()),a}function G(e){var t=e.getTargetIds().filter(e.canDropOnTarget,e);return t.reverse(),t}function X(e){return function(){var t=e.getMonitor(),r=e.getRegistry();!function(e){i(e.isDragging(),"Cannot call endDrag while not dragging.")}(t);var n=t.getSourceId();return r.getSource(n,!0).endDrag(t,n),r.unpinSource(),{type:w}}}var W=function(e,t){return e===t};function V(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 K(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var q={initialSourceClientOffset:null,initialClientOffset:null,clientOffset:null};function z(){var e,t,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:q,n=arguments.length>1?arguments[1]:void 0,i=n.payload;switch(n.type){case p:case v:return{initialSourceClientOffset:i.sourceClientOffset,initialClientOffset:i.clientOffset,clientOffset:i.clientOffset};case b: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]:ne,n=arguments.length>1?arguments[1]:void 0,i=n.payload;switch(n.type){case v:return te({},r,{itemType:i.itemType,item:i.item,sourceId:i.sourceId,isSourcePublic:i.isSourcePublic,dropResult:null,didDrop:!1});case y:return te({},r,{isSourcePublic:!0});case b:return te({},r,{targetIds:i.targetIds});case $:return-1===r.targetIds.indexOf(i.targetId)?r:te({},r,{targetIds:(e=r.targetIds,t=i.targetId,e.filter(function(e){return e!==t}))});case m:return te({},r,{dropResult:i.dropResult,didDrop:!0,targetIds:[]});case w:return te({},r,{itemType:null,item:null,sourceId:null,dropResult:null,didDrop:!1,isSourcePublic:null,targetIds:[]});default:return r}}function oe(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;switch((arguments.length>1?arguments[1]:void 0).type){case J:case Q:return e+1;case Z:case $:return e-1;default:return e}}var ae=[],ue=[];function ce(e,t){return e!==ae&&(e===ue||void 0===t||(r=e,t.filter(function(e){return r.indexOf(e)>-1})).length>0);var r}function se(){var e=arguments.length>1?arguments[1]:void 0;switch(e.type){case b:break;case J:case Q:case $:case Z:return ae;case v:case y:case w:case m:default:return ue}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]:W;if(e.length!==t.length)return!1;for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:0)+1}function fe(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 de(e){for(var t=1;t0&&void 0!==arguments[0]?arguments[0]:{},i=arguments.length>1?arguments[1]:void 0;return{dirtyHandlerIds:se(n.dirtyHandlerIds,{type:i.type,payload:de({},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:z(n.dragOffset,i),refCount:oe(n.refCount,i),dragOperation:ie(n.dragOperation,i),stateId:le(n.stateId)}}function pe(e,t){return{x:e.x-t.x,y:e.y-t.y}}function ve(e,t){for(var r=0;r1&&void 0!==arguments[1]?arguments[1]:{handlerIds:void 0},n=r.handlerIds;i("function"==typeof e,"listener must be a function."),i(void 0===n||Array.isArray(n),"handlerIds, when specified, must be an array of strings.");var o=this.store.getState().stateId,a=function(){var r=t.store.getState(),i=r.stateId;try{i===o||i===o+1&&!ce(r.dirtyHandlerIds,n)||e()}finally{o=i}};return this.store.subscribe(a)}},{key:"subscribeToOffsetChange",value:function(e){var t=this;i("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 i(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 i(t,"Expected to find a valid target."),!(!this.isDragging()||this.didDrop())&&(R(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 i(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&&!R(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?pe((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?pe(t,r):null;var e,t,r}}])&&ve(t.prototype,r),n&&ve(t,n),e}(),be="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},me=we;function we(e){De.length||Oe(),De[De.length]=e}var Oe,De=[],Se=0,Te=1024;function Ie(){for(;SeTe){for(var t=0,r=De.length-Se;t1&&void 0!==arguments[1]&&arguments[1];i(this.isSourceId(e),"Expected a valid source ID.");var r=t&&e===this.pinnedSourceId,n=r?this.pinnedSource:this.dragSources.get(e);return n}},{key:"getTarget",value:function(e){return i(this.isTargetId(e),"Expected a valid target ID."),this.dropTargets.get(e)}},{key:"getSourceType",value:function(e){return i(this.isSourceId(e),"Expected a valid source ID."),this.types.get(e)}},{key:"getTargetType",value:function(e){return i(this.isTargetId(e),"Expected a valid target ID."),this.types.get(e)}},{key:"isSourceId",value:function(e){return Xe(e)===r.SOURCE}},{key:"isTargetId",value:function(e){return Xe(e)===r.TARGET}},{key:"removeSource",value:function(e){var t=this;i(this.getSource(e),"Expected an existing source."),this.store.dispatch(function(e){return{type:Z,payload:{sourceId:e}}}(e)),Ae(function(){t.dragSources.delete(e),t.types.delete(e)})}},{key:"removeTarget",value:function(e){i(this.getTarget(e),"Expected an existing target."),this.store.dispatch(function(e){return{type:$,payload:{targetId:e}}}(e)),this.dropTargets.delete(e),this.types.delete(e)}},{key:"pinSource",value:function(e){var t=this.getSource(e);i(t,"Expected an existing source."),this.pinnedSourceId=e,this.pinnedSource=t}},{key:"unpinSource",value:function(){i(this.pinnedSource,"No source is pinned at the time."),this.pinnedSourceId=null,this.pinnedSource=null}},{key:"addHandler",value:function(e,t,n){var i=Ge(e);return this.types.set(i,t),e===r.SOURCE?this.dragSources.set(i,n):e===r.TARGET&&this.dropTargets.set(i,n),i}}])&&Be(t.prototype,n),o&&Be(t,o),e}();function Ke(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 g(he,e&&t&&t({name:"dnd-core",instanceId:"dnd-core"}))}(r);this.store=n,this.monitor=new ye(n,new Ve(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:I(e),publishDragSource:N(e),hover:x(e),drop:F(e),endDrag:X(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"),n?e.cloneElement(t,{ref:function(e){rt(n,e),rt(r,e)}}):e.cloneElement(t,{ref:r})}function it(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 ot(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;it(o);var a=n?function(e){return t(e,n)}:t;return nt(o,a)}}(i);r[n]=function(){return o}}}),r}function at(e){return(at="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 ut(e){return null!==e&&"object"===at(e)&&e.hasOwnProperty("current")}function ct(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 St=e.memo(function(r){var n=r.children,i=Dt(r,["children"]),o="manager"in i?{dragDropManager:i.manager}:function(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0!==t?t:window,n=arguments.length>2?arguments[2]:void 0,i=arguments.length>3?arguments[3]:void 0,o=r;o[Tt]||(o[Tt]=function(e,t,r,n){return{dragDropManager:ze(e,t,r,n)}}(e,r,n,i));return o[Tt]}(i.backend,i.context,i.options,i.debugMode);return e.createElement(Je.Provider,{value:o},n)}),Tt=Symbol.for("__REACT_DND_CONTEXT_INSTANCE__");function It(e){var t=null;return function(){return null==t&&(t=e()),t}}function Et(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=[]}}])&&Et(t.prototype,r),n&&Et(t,n),e}(),Ct=It(function(){return/firefox/i.test(navigator.userAgent)}),Pt=It(function(){return Boolean(window.safari)});function Nt(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}}])&&Nt(t.prototype,r),n&&Nt(t,n),e}(),xt=1;function jt(e){var t=e.nodeType===xt?e:e.parentElement;if(!t)return null;var r=t.getBoundingClientRect(),n=r.top;return{x:r.left,y:n}}function Mt(e){return{x:e.clientX,y:e.clientY}}function At(e,t,r,n,i){var o,a=function(e){return"IMG"===e.nodeName&&(Ct()||!document.documentElement.contains(e))}(t),u=jt(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 Pt()&&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 Rt([0,.5,1],[c.x,c.x/s*h,c.x+h-s]).interpolate(f),y:b?y:(o=new Rt([0,.5,1],[c.y,c.y/l*p,c.y+p-l]).interpolate(d),Pt()&&a&&(o+=(window.devicePixelRatio-1)*p),o)}}var Lt,_t="__NATIVE_FILE__",Ht="__NATIVE_URL__",Ut="__NATIVE_TEXT__",Ft=Object.freeze({FILE:_t,URL:Ht,TEXT:Ut});function Bt(e,t,r){var n=t.reduce(function(t,r){return t||e.getData(r)},"");return null!=n?n:r}function Yt(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var Gt=(Yt(Lt={},_t,{exposeProperties:{files:function(e){return Array.prototype.slice.call(e.files)},items:function(e){return e.items}},matchesTypes:["Files"]}),Yt(Lt,Ht,{exposeProperties:{urls:function(e,t){return Bt(e,t,"").split("\n")}},matchesTypes:["Url","text/uri-list"]}),Yt(Lt,Ut,{exposeProperties:{text:function(e,t){return Bt(e,t,"")}},matchesTypes:["Text","text/plain"]}),Lt);function Xt(e,t){for(var r=0;r-1})})[0]||null}function Kt(e,t){for(var r=0;r