mirror of
https://github.com/penpot/penpot.git
synced 2025-02-05 05:49:07 -05:00
1 line
No EOL
59 KiB
JavaScript
1 line
No EOL
59 KiB
JavaScript
!function(e){"use strict";var t="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{};function r(e,t){for(var r=arguments.length,n=new Array(r>2?r-2:0),i=2;i<r;i++)n[i-2]=arguments[i];if(!e){var o;if(void 0===t)o=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var a=0;(o=new Error(t.replace(/%s/g,(function(){return n[a++]})))).name="Invariant Violation"}throw o.framesToPop=1,o}}var n,i="undefined"!=typeof window?e.useLayoutEffect:e.useEffect;function o(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;c<o.length;c++){var s=o[c];if(!u(s))return!1;var l=e[s],f=t[s];if(!1===(i=r?r.call(n,l,f,s):void 0)||void 0===i&&l!==f)return!1}return!0}function a(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var r=[],n=!0,i=!1,o=void 0;try{for(var a,u=e[Symbol.iterator]();!(n=(a=u.next()).done)&&(r.push(a.value),!t||r.length!==t);n=!0);}catch(e){i=!0,o=e}finally{try{n||null==u.return||u.return()}finally{if(i)throw o}}return r}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function u(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var r=[],n=!0,i=!1,o=void 0;try{for(var a,u=e[Symbol.iterator]();!(n=(a=u.next()).done)&&(r.push(a.value),!t||r.length!==t);n=!0);}catch(e){i=!0,o=e}finally{try{n||null==u.return||u.return()}finally{if(i)throw o}}return r}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function c(t,r,n){var c=u(function(t,r,n){var u=a(e.useState((function(){return r(t)})),2),c=u[0],s=u[1],l=e.useCallback((function(){var e=r(t);o(c,e)||(s(e),n&&n())}),[c,t,n]);return i(l,[]),[c,l]}(t,r,n),2),s=c[0],l=c[1];return i((function(){var e=t.getHandlerId();if(null!=e)return t.subscribeToStateChange(l,{handlerIds:[e]})}),[t,l]),s}!function(e){e.SOURCE="SOURCE",e.TARGET="TARGET"}(n||(n={}));var s=function(e){var t,r=e.Symbol;return"function"==typeof r?r.observable?t=r.observable:(t=r("observable"),r.observable=t):t="@@observable",t}("undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==t?t:"undefined"!=typeof module?module:Function("return this")()),l=function(){return Math.random().toString(36).substring(7).split("").join(".")},f={INIT:"@@redux/INIT"+l(),REPLACE:"@@redux/REPLACE"+l(),PROBE_UNKNOWN_ACTION:function(){return"@@redux/PROBE_UNKNOWN_ACTION"+l()}};function d(e){if("object"!=typeof e||null===e)return!1;for(var t=e;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}function g(e,t,r){var n;if("function"==typeof t&&"function"==typeof r||"function"==typeof r&&"function"==typeof arguments[3])throw new Error("It looks like you are passing several store enhancers to createStore(). This is not supported. Instead, compose them together to a single function.");if("function"==typeof t&&void 0===r&&(r=t,t=void 0),void 0!==r){if("function"!=typeof r)throw new Error("Expected the enhancer to be a function.");return r(g)(e,t)}if("function"!=typeof e)throw new Error("Expected the reducer to be a function.");var i=e,o=t,a=[],u=a,c=!1;function l(){u===a&&(u=a.slice())}function h(){if(c)throw new Error("You may not call store.getState() while the reducer is executing. The reducer has already received the state as an argument. Pass it down from the top reducer instead of reading it from the store.");return o}function p(e){if("function"!=typeof e)throw new Error("Expected the listener to be a function.");if(c)throw new Error("You may not call store.subscribe() while the reducer is executing. If you would like to be notified after the store has been updated, subscribe from a component and invoke store.getState() in the callback to access the latest state. See https://redux.js.org/api-reference/store#subscribelistener for more details.");var t=!0;return l(),u.push(e),function(){if(t){if(c)throw new Error("You may not unsubscribe from a store listener while the reducer is executing. See https://redux.js.org/api-reference/store#subscribelistener for more details.");t=!1,l();var r=u.indexOf(e);u.splice(r,1),a=null}}}function v(e){if(!d(e))throw new Error("Actions must be plain objects. Use custom middleware for async actions.");if(void 0===e.type)throw new Error('Actions may not have an undefined "type" property. Have you misspelled a constant?');if(c)throw new Error("Reducers may not dispatch actions.");try{c=!0,o=i(o,e)}finally{c=!1}for(var t=a=u,r=0;r<t.length;r++){(0,t[r])()}return e}function y(e){if("function"!=typeof e)throw new Error("Expected the nextReducer to be a function.");i=e,v({type:f.REPLACE})}function b(){var e,t=p;return(e={subscribe:function(e){if("object"!=typeof e||null===e)throw new TypeError("Expected the observer to be an object.");function r(){e.next&&e.next(h())}return r(),{unsubscribe:t(r)}}})[s]=function(){return this},e}return v({type:f.INIT}),(n={dispatch:v,subscribe:p,getState:h,replaceReducer:y})[s]=b,n}var h="dnd-core/INIT_COORDS",p="dnd-core/BEGIN_DRAG",v="dnd-core/PUBLISH_DRAG_SOURCE",y="dnd-core/HOVER",b="dnd-core/DROP",m="dnd-core/END_DRAG";function O(e,t){return{type:h,payload:{sourceClientOffset:t||null,clientOffset:e||null}}}function w(e){return(w="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 D(e,t,r){return t.split(".").reduce((function(e,t){return e&&e[t]?e[t]:r||null}),e)}function S(e,t){return e.filter((function(e){return e!==t}))}function T(e){return"object"===w(e)}function I(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}var E={type:h,payload:{clientOffset:null,sourceClientOffset:null}};function k(e){return function(){var t=arguments.length>0&&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)),C(t,u,c);var s=N(t,u);if(null!==s){var l=null;o&&(P(a),l=a(s)),e.dispatch(O(o,l));var f=c.getSource(s),d=f.beginDrag(u,s);j(d),c.pinSource(s);var g=c.getSourceType(s);return{type:p,payload:{itemType:g,item:d,sourceId:s,clientOffset:o||null,sourceClientOffset:l||null,isSourcePublic:!!i}}}e.dispatch(E)}}function C(e,t,n){r(!t.isDragging(),"Cannot call beginDrag while dragging."),e.forEach((function(e){r(n.getSource(e),"Expected sourceIds to be registered.")}))}function P(e){r("function"==typeof e,"When clientOffset is provided, getSourceClientOffset must be a function.")}function j(e){r(T(e),"Item must be an object.")}function N(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 x(e){return function(){if(e.getMonitor().isDragging())return{type:v}}}function R(e,t){return null===t?null===e:Array.isArray(e)?e.some((function(e){return e===t})):e===t}function M(e){return function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=r.clientOffset;A(t);var i=t.slice(0),o=e.getMonitor(),a=e.getRegistry();_(i,o,a);var u=o.getItemType();return L(i,a,u),H(i,o,a),{type:y,payload:{targetIds:i,clientOffset:n||null}}}}function A(e){r(Array.isArray(e),"Expected targetIds to be an array.")}function _(e,t,n){r(t.isDragging(),"Cannot call hover while not dragging."),r(!t.didDrop(),"Cannot call hover after drop.");for(var i=0;i<e.length;i++){var o=e[i];r(e.lastIndexOf(o)===i,"Expected targetIds to be unique in the passed array."),r(n.getTarget(o),"Expected targetIds to be registered.")}}function L(e,t,r){for(var n=e.length-1;n>=0;n--){var i=e[n];R(t.getTargetType(i),r)||e.splice(n,1)}}function H(e,t,r){e.forEach((function(e){r.getTarget(e).hover(t,e)}))}function U(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function F(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?U(Object(r),!0).forEach((function(t){B(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):U(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function B(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Y(e){return function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=e.getMonitor(),n=e.getRegistry();G(r);var i=W(r);i.forEach((function(i,o){var a=X(i,o,n,r),u={type:b,payload:{dropResult:F({},t,{},a)}};e.dispatch(u)}))}}function G(e){r(e.isDragging(),"Cannot call drop while not dragging."),r(!e.didDrop(),"Cannot call drop twice during one drag operation.")}function X(e,t,n,i){var o=n.getTarget(e),a=o?o.drop(i,e):void 0;return function(e){r(void 0===e||T(e),"Drop result must either be an object or undefined.")}(a),void 0===a&&(a=0===t?{}:i.getDropResult()),a}function W(e){var t=e.getTargetIds().filter(e.canDropOnTarget,e);return t.reverse(),t}function K(e){return function(){var t=e.getMonitor(),n=e.getRegistry();!function(e){r(e.isDragging(),"Cannot call endDrag while not dragging.")}(t);var i=t.getSourceId();return n.getSource(i,!0).endDrag(t,i),n.unpinSource(),{type:m}}}var V=function(e,t){return e===t};function q(e,t){return!e&&!t||!(!e||!t)&&(e.x===t.x&&e.y===t.y)}function z(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:V;if(e.length!==t.length)return!1;for(var n=0;n<e.length;++n)if(!r(e[n],t[n]))return!1;return!0}function J(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Q(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?J(Object(r),!0).forEach((function(t){Z(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):J(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function Z(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var $={initialSourceClientOffset:null,initialClientOffset:null,clientOffset:null};function ee(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:$,t=arguments.length>1?arguments[1]:void 0,r=t.payload;switch(t.type){case h:case p:return{initialSourceClientOffset:r.sourceClientOffset,initialClientOffset:r.clientOffset,clientOffset:r.clientOffset};case y:return q(e.clientOffset,r.clientOffset)?e:Q({},e,{clientOffset:r.clientOffset});case m:case b:return $;default:return e}}var te="dnd-core/ADD_SOURCE",re="dnd-core/ADD_TARGET",ne="dnd-core/REMOVE_SOURCE",ie="dnd-core/REMOVE_TARGET";function oe(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function ae(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?oe(Object(r),!0).forEach((function(t){ue(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):oe(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function ue(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var ce={itemType:null,item:null,sourceId:null,targetIds:[],dropResult:null,didDrop:!1,isSourcePublic:null};function se(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:ce,t=arguments.length>1?arguments[1]:void 0,r=t.payload;switch(t.type){case p:return ae({},e,{itemType:r.itemType,item:r.item,sourceId:r.sourceId,isSourcePublic:r.isSourcePublic,dropResult:null,didDrop:!1});case v:return ae({},e,{isSourcePublic:!0});case y:return ae({},e,{targetIds:r.targetIds});case ie:return-1===e.targetIds.indexOf(r.targetId)?e:ae({},e,{targetIds:S(e.targetIds,r.targetId)});case b:return ae({},e,{dropResult:r.dropResult,didDrop:!0,targetIds:[]});case m:return ae({},e,{itemType:null,item:null,sourceId:null,dropResult:null,didDrop:!1,isSourcePublic:null,targetIds:[]});default:return e}}function le(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1?arguments[1]:void 0;switch(t.type){case te:case re:return e+1;case ne:case ie:return e-1;default:return e}}var fe=[],de=[];function ge(e,t){return e!==fe&&(e===de||void 0===t||(r=e,t.filter((function(e){return r.indexOf(e)>-1}))).length>0);var r}function he(){var e=arguments.length>1?arguments[1]:void 0;switch(e.type){case y:break;case te:case re:case ie:case ne:return fe;case p:case v:case m:case b:default:return de}var t=e.payload,r=t.targetIds,n=void 0===r?[]:r,i=t.prevTargetIds,o=void 0===i?[]:i,a=I(n,o),u=a.length>0||!z(n,o);if(!u)return fe;var c=o[o.length-1],s=n[n.length-1];return c!==s&&(c&&a.push(c),s&&a.push(s)),a}function pe(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return e+1}function ve(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function ye(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ve(Object(r),!0).forEach((function(t){be(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ve(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function be(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function me(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;return{dirtyHandlerIds:he(e.dirtyHandlerIds,{type:t.type,payload:ye({},t.payload,{prevTargetIds:D(e,"dragOperation.targetIds",[])})}),dragOffset:ee(e.dragOffset,t),refCount:le(e.refCount,t),dragOperation:se(e.dragOperation,t),stateId:pe(e.stateId)}}function Oe(e,t){return{x:e.x-t.x,y:e.y-t.y}}function we(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}fe.__IS_NONE__=!0,de.__IS_ALL__=!0;var De=function(){function e(t,r){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.store=t,this.registry=r}var t,n,i;return t=e,(n=[{key:"subscribeToStateChange",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{handlerIds:void 0},i=n.handlerIds;r("function"==typeof e,"listener must be a function."),r(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&&!ge(r.dirtyHandlerIds,i)||e()}finally{o=n}};return this.store.subscribe(a)}},{key:"subscribeToOffsetChange",value:function(e){var t=this;r("function"==typeof e,"listener must be a function.");var n=this.store.getState().dragOffset;return this.store.subscribe((function(){var r=t.store.getState().dragOffset;r!==n&&(n=r,e())}))}},{key:"canDragSource",value:function(e){if(!e)return!1;var t=this.registry.getSource(e);return r(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 r(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 r(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?Oe((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?Oe(t,r):null;var e,t,r}}])&&we(t.prototype,n),i&&we(t,i),e}(),Se=0;function Te(e){return(Te="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 Ie(e,t){t&&Array.isArray(e)?e.forEach((function(e){return Ie(e,!1)})):r("string"==typeof e||"symbol"===Te(e),t?"Type can only be a string, a symbol, or an array of either.":"Type can only be a string or a symbol.")}function Ee(e){Ce.length||ke(),Ce[Ce.length]=e}var ke,Ce=[],Pe=0;function je(){for(;Pe<Ce.length;){var e=Pe;if(Pe+=1,Ce[e].call(),Pe>1024){for(var t=0,r=Ce.length-Pe;t<r;t++)Ce[t]=Ce[t+Pe];Ce.length-=Pe,Pe=0}}Ce.length=0,Pe=0}var Ne,xe,Re,Me=void 0!==t?t:self,Ae=Me.MutationObserver||Me.WebKitMutationObserver;function _e(e){return function(){var t=setTimeout(n,0),r=setInterval(n,50);function n(){clearTimeout(t),clearInterval(r),e()}}}"function"==typeof Ae?(Ne=1,xe=new Ae(je),Re=document.createTextNode(""),xe.observe(Re,{characterData:!0}),ke=function(){Ne=-Ne,Re.data=Ne}):ke=_e(je),Ee.requestFlush=ke,Ee.makeRequestCallFromTimer=_e;var Le=[],He=[],Ue=Ee.makeRequestCallFromTimer((function(){if(He.length)throw He.shift()}));function Fe(e){var t;(t=Le.length?Le.pop():new Be).task=e,Ee(t)}var Be=function(){function e(){}return e.prototype.call=function(){try{this.task.call()}catch(e){Fe.onerror?Fe.onerror(e):(He.push(e),Ue())}finally{this.task=null,Le[Le.length]=this}},e}();function Ye(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function Ge(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var r=[],n=!0,i=!1,o=void 0;try{for(var a,u=e[Symbol.iterator]();!(n=(a=u.next()).done)&&(r.push(a.value),!t||r.length!==t);n=!0);}catch(e){i=!0,o=e}finally{try{n||null==u.return||u.return()}finally{if(i)throw o}}return r}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function Xe(e){var t=(Se++).toString();switch(e){case n.SOURCE:return"S".concat(t);case n.TARGET:return"T".concat(t);default:throw new Error("Unknown Handler Role: ".concat(e))}}function We(e){switch(e[0]){case"S":return n.SOURCE;case"T":return n.TARGET;default:r(!1,"Cannot parse handler ID: ".concat(e))}}function Ke(e,t){var r=e.entries(),n=!1;do{var i=r.next(),o=i.done;if(Ge(i.value,2)[1]===t)return!0;n=!!o}while(!n);return!1}var Ve=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.types=new Map,this.dragSources=new Map,this.dropTargets=new Map,this.pinnedSourceId=null,this.pinnedSource=null,this.store=t}var t,i,o;return t=e,(i=[{key:"addSource",value:function(e,t){Ie(e),function(e){r("function"==typeof e.canDrag,"Expected canDrag to be a function."),r("function"==typeof e.beginDrag,"Expected beginDrag to be a function."),r("function"==typeof e.endDrag,"Expected endDrag to be a function.")}(t);var i=this.addHandler(n.SOURCE,e,t);return this.store.dispatch(function(e){return{type:te,payload:{sourceId:e}}}(i)),i}},{key:"addTarget",value:function(e,t){Ie(e,!0),function(e){r("function"==typeof e.canDrop,"Expected canDrop to be a function."),r("function"==typeof e.hover,"Expected hover to be a function."),r("function"==typeof e.drop,"Expected beginDrag to be a function.")}(t);var i=this.addHandler(n.TARGET,e,t);return this.store.dispatch(function(e){return{type:re,payload:{targetId:e}}}(i)),i}},{key:"containsHandler",value:function(e){return Ke(this.dragSources,e)||Ke(this.dropTargets,e)}},{key:"getSource",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];r(this.isSourceId(e),"Expected a valid source ID.");var n=t&&e===this.pinnedSourceId,i=n?this.pinnedSource:this.dragSources.get(e);return i}},{key:"getTarget",value:function(e){return r(this.isTargetId(e),"Expected a valid target ID."),this.dropTargets.get(e)}},{key:"getSourceType",value:function(e){return r(this.isSourceId(e),"Expected a valid source ID."),this.types.get(e)}},{key:"getTargetType",value:function(e){return r(this.isTargetId(e),"Expected a valid target ID."),this.types.get(e)}},{key:"isSourceId",value:function(e){return We(e)===n.SOURCE}},{key:"isTargetId",value:function(e){return We(e)===n.TARGET}},{key:"removeSource",value:function(e){var t=this;r(this.getSource(e),"Expected an existing source."),this.store.dispatch(function(e){return{type:ne,payload:{sourceId:e}}}(e)),Fe((function(){t.dragSources.delete(e),t.types.delete(e)}))}},{key:"removeTarget",value:function(e){r(this.getTarget(e),"Expected an existing target."),this.store.dispatch(function(e){return{type:ie,payload:{targetId:e}}}(e)),this.dropTargets.delete(e),this.types.delete(e)}},{key:"pinSource",value:function(e){var t=this.getSource(e);r(t,"Expected an existing source."),this.pinnedSourceId=e,this.pinnedSource=t}},{key:"unpinSource",value:function(){r(this.pinnedSource,"No source is pinned at the time."),this.pinnedSourceId=null,this.pinnedSource=null}},{key:"addHandler",value:function(e,t,r){var i=Xe(e);return this.types.set(i,t),e===n.SOURCE?this.dragSources.set(i,r):e===n.TARGET&&this.dropTargets.set(i,r),i}}])&&Ye(t.prototype,i),o&&Ye(t,o),e}();function qe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ze(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function Je(e){var t="undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION__;return g(me,e&&t&&t({name:"dnd-core",instanceId:"dnd-core"}))}var Qe=function(){function e(){var t=this,r=arguments.length>0&&void 0!==arguments[0]&&arguments[0];qe(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=Je(r);this.store=n,this.monitor=new De(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,r=function(e){return{beginDrag:k(e),publishDragSource:x(e),hover:M(e),drop:Y(e),endDrag:K(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<r;i++)n[i]=arguments[i];var a=o.apply(e,n);void 0!==a&&t(a)}),n}),{})}},{key:"dispatch",value:function(e){this.store.dispatch(e)}}])&&ze(t.prototype,r),n&&ze(t,n),e}();function Ze(e,t,r,n){var i=new Qe(n),o=e(i,t,r);return i.receiveBackend(o),i}var $e=e.createContext({dragDropManager:void 0});function et(e,t,r,n){return{dragDropManager:Ze(e,t,r,n)}}function tt(){var t=e.useContext($e).dragDropManager;return r(null!=t,"Expected drag drop context"),t}function rt(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var nt=!1,it=!1,ot=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.sourceId=null,this.internalMonitor=t.getMonitor()}var t,n,i;return t=e,(n=[{key:"receiveHandlerId",value:function(e){this.sourceId=e}},{key:"getHandlerId",value:function(){return this.sourceId}},{key:"canDrag",value:function(){r(!nt,"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 nt=!0,this.internalMonitor.canDragSource(this.sourceId)}finally{nt=!1}}},{key:"isDragging",value:function(){if(!this.sourceId)return!1;r(!it,"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 it=!0,this.internalMonitor.isDraggingSource(this.sourceId)}finally{it=!1}}},{key:"subscribeToStateChange",value:function(e,t){return this.internalMonitor.subscribeToStateChange(e,t)}},{key:"isDraggingSource",value:function(e){return this.internalMonitor.isDraggingSource(e)}},{key:"isOverTarget",value:function(e,t){return this.internalMonitor.isOverTarget(e,t)}},{key:"getTargetIds",value:function(){return this.internalMonitor.getTargetIds()}},{key:"isSourcePublic",value:function(){return this.internalMonitor.isSourcePublic()}},{key:"getSourceId",value:function(){return this.internalMonitor.getSourceId()}},{key:"subscribeToOffsetChange",value:function(e){return this.internalMonitor.subscribeToOffsetChange(e)}},{key:"canDragSource",value:function(e){return this.internalMonitor.canDragSource(e)}},{key:"canDropOnTarget",value:function(e){return this.internalMonitor.canDropOnTarget(e)}},{key:"getItemType",value:function(){return this.internalMonitor.getItemType()}},{key:"getItem",value:function(){return this.internalMonitor.getItem()}},{key:"getDropResult",value:function(){return this.internalMonitor.getDropResult()}},{key:"didDrop",value:function(){return this.internalMonitor.didDrop()}},{key:"getInitialClientOffset",value:function(){return this.internalMonitor.getInitialClientOffset()}},{key:"getInitialSourceClientOffset",value:function(){return this.internalMonitor.getInitialSourceClientOffset()}},{key:"getSourceClientOffset",value:function(){return this.internalMonitor.getSourceClientOffset()}},{key:"getClientOffset",value:function(){return this.internalMonitor.getClientOffset()}},{key:"getDifferenceFromInitialOffset",value:function(){return this.internalMonitor.getDifferenceFromInitialOffset()}}])&&rt(t.prototype,n),i&&rt(t,i),e}();function at(e,t){"function"==typeof e?e(t):e.current=t}function ut(t,n){var i=t.ref;return r("string"!=typeof i,"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://facebook.github.io/react/docs/more-about-refs.html#the-ref-callback-attribute"),i?e.cloneElement(t,{ref:function(e){at(i,e),at(n,e)}}):e.cloneElement(t,{ref:n})}function ct(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 <div>, or turn it into a ")+"drag source or a drop target itself.")}}function st(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;ct(o);var a=n?function(e){return t(e,n)}:t;return ut(o,a)}}(i);r[n]=function(){return o}}})),r}function lt(e){return(lt="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 ft(e){return null!==e&&"object"===lt(e)&&e.hasOwnProperty("current")}function dt(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var gt=function(){function e(t){var r=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.hooks=st({dragSource:function(e,t){r.clearDragSource(),r.dragSourceOptions=t||null,ft(e)?r.dragSourceRef=e:r.dragSourceNode=e,r.reconnectDragSource()},dragPreview:function(e,t){r.clearDragPreview(),r.dragPreviewOptions=t||null,ft(e)?r.dragPreviewRef=e:r.dragPreviewNode=e,r.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=t}var t,r,n;return t=e,(r=[{key:"receiveHandlerId",value:function(e){this.handlerId!==e&&(this.handlerId=e,this.reconnect())}},{key:"reconnect",value:function(){this.reconnectDragSource(),this.reconnectDragPreview()}},{key:"reconnectDragSource",value:function(){var e=this.dragSource,t=this.didHandlerIdChange()||this.didConnectedDragSourceChange()||this.didDragSourceOptionsChange();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)):this.lastConnectedDragSource=e)}},{key:"reconnectDragPreview",value:function(){var e=this.dragPreview,t=this.didHandlerIdChange()||this.didConnectedDragPreviewChange()||this.didDragPreviewOptionsChange();this.handlerId?this.dragPreview&&t&&(this.lastConnectedHandlerId=this.handlerId,this.lastConnectedDragPreview=e,this.lastConnectedDragPreviewOptions=this.dragPreviewOptions,this.disconnectDragPreview(),this.dragPreviewUnsubscribe=this.backend.connectDragPreview(this.handlerId,e,this.dragPreviewOptions)):this.disconnectDragPreview()}},{key:"didHandlerIdChange",value:function(){return this.lastConnectedHandlerId!==this.handlerId}},{key:"didConnectedDragSourceChange",value:function(){return this.lastConnectedDragSource!==this.dragSource}},{key:"didConnectedDragPreviewChange",value:function(){return this.lastConnectedDragPreview!==this.dragPreview}},{key:"didDragSourceOptionsChange",value:function(){return!o(this.lastConnectedDragSourceOptions,this.dragSourceOptions)}},{key:"didDragPreviewOptionsChange",value:function(){return!o(this.lastConnectedDragPreviewOptions,this.dragPreviewOptions)}},{key:"disconnectDragSource",value:function(){this.dragSourceUnsubscribe&&(this.dragSourceUnsubscribe(),this.dragSourceUnsubscribe=void 0)}},{key:"disconnectDragPreview",value:function(){this.dragPreviewUnsubscribe&&(this.dragPreviewUnsubscribe(),this.dragPreviewUnsubscribe=void 0,this.dragPreviewNode=null,this.dragPreviewRef=null)}},{key:"clearDragSource",value:function(){this.dragSourceNode=null,this.dragSourceRef=null}},{key:"clearDragPreview",value:function(){this.dragPreviewNode=null,this.dragPreviewRef=null}},{key:"connectTarget",get:function(){return this.dragSource}},{key:"dragSourceOptions",get:function(){return this.dragSourceOptionsInternal},set:function(e){this.dragSourceOptionsInternal=e}},{key:"dragPreviewOptions",get:function(){return this.dragPreviewOptionsInternal},set:function(e){this.dragPreviewOptionsInternal=e}},{key:"dragSource",get:function(){return this.dragSourceNode||this.dragSourceRef&&this.dragSourceRef.current}},{key:"dragPreview",get:function(){return this.dragPreviewNode||this.dragPreviewRef&&this.dragPreviewRef.current}}])&&dt(t.prototype,r),n&&dt(t,n),e}();function ht(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var r=[],n=!0,i=!1,o=void 0;try{for(var a,u=e[Symbol.iterator]();!(n=(a=u.next()).done)&&(r.push(a.value),!t||r.length!==t);n=!0);}catch(e){i=!0,o=e}finally{try{n||null==u.return||u.return()}finally{if(i)throw o}}return r}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function pt(e){return(pt="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 vt(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var r=[],n=!0,i=!1,o=void 0;try{for(var a,u=e[Symbol.iterator]();!(n=(a=u.next()).done)&&(r.push(a.value),!t||r.length!==t);n=!0);}catch(e){i=!0,o=e}finally{try{n||null==u.return||u.return()}finally{if(i)throw o}}return r}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function yt(t){var n=e.useRef(t);n.current=t,r(null!=t.item,"item must be defined"),r(null!=t.item.type,"item type must be defined");var o,a=vt((o=tt(),[e.useMemo((function(){return new ot(o)}),[o]),e.useMemo((function(){return new gt(o.getBackend())}),[o])]),2),u=a[0],s=a[1];!function(t,n,o){var a=tt(),u=e.useMemo((function(){return{beginDrag:function(){var e=t.current,i=e.begin,o=e.item;if(i){var a=i(n);return r(null==a||"object"===pt(a),"dragSpec.begin() must either return an object, undefined, or null"),a||o||{}}return o||{}},canDrag:function(){return"boolean"==typeof t.current.canDrag?t.current.canDrag:"function"!=typeof t.current.canDrag||t.current.canDrag(n)},isDragging:function(e,r){var i=t.current.isDragging;return i?i(n):r===e.getSourceId()},endDrag:function(){var e=t.current.end;e&&e(n.getItem(),n),o.reconnect()}}}),[]);i((function(){var e=ht(function(e,t,r){var n=r.getRegistry(),i=n.addSource(e,t);return[i,function(){return n.removeSource(i)}]}(t.current.item.type,u,a),2),r=e[0],i=e[1];return n.receiveHandlerId(r),o.receiveHandlerId(r),i}),[])}(n,u,s);var l=c(u,n.current.collect||function(){return{}},(function(){return s.reconnect()})),f=e.useMemo((function(){return s.hooks.dragSource()}),[s]),d=e.useMemo((function(){return s.hooks.dragPreview()}),[s]);return i((function(){s.dragSourceOptions=n.current.options||null,s.reconnect()}),[s]),i((function(){s.dragPreviewOptions=n.current.previewOptions||null,s.reconnect()}),[s]),[l,f,d]}function bt(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var mt=function(){function e(t){var r=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.hooks=st({dropTarget:function(e,t){r.clearDropTarget(),r.dropTargetOptions=t,ft(e)?r.dropTargetRef=e:r.dropTargetNode=e,r.reconnect()}}),this.handlerId=null,this.dropTargetRef=null,this.dropTargetOptionsInternal=null,this.lastConnectedHandlerId=null,this.lastConnectedDropTarget=null,this.lastConnectedDropTargetOptions=null,this.backend=t}var t,r,n;return t=e,(r=[{key:"reconnect",value:function(){var e=this.didHandlerIdChange()||this.didDropTargetChange()||this.didOptionsChange();e&&this.disconnectDropTarget();var t=this.dropTarget;this.handlerId&&(t?e&&(this.lastConnectedHandlerId=this.handlerId,this.lastConnectedDropTarget=t,this.lastConnectedDropTargetOptions=this.dropTargetOptions,this.unsubscribeDropTarget=this.backend.connectDropTarget(this.handlerId,t,this.dropTargetOptions)):this.lastConnectedDropTarget=t)}},{key:"receiveHandlerId",value:function(e){e!==this.handlerId&&(this.handlerId=e,this.reconnect())}},{key:"didHandlerIdChange",value:function(){return this.lastConnectedHandlerId!==this.handlerId}},{key:"didDropTargetChange",value:function(){return this.lastConnectedDropTarget!==this.dropTarget}},{key:"didOptionsChange",value:function(){return!o(this.lastConnectedDropTargetOptions,this.dropTargetOptions)}},{key:"disconnectDropTarget",value:function(){this.unsubscribeDropTarget&&(this.unsubscribeDropTarget(),this.unsubscribeDropTarget=void 0)}},{key:"clearDropTarget",value:function(){this.dropTargetRef=null,this.dropTargetNode=null}},{key:"connectTarget",get:function(){return this.dropTarget}},{key:"dropTargetOptions",get:function(){return this.dropTargetOptionsInternal},set:function(e){this.dropTargetOptionsInternal=e}},{key:"dropTarget",get:function(){return this.dropTargetNode||this.dropTargetRef&&this.dropTargetRef.current}}])&&bt(t.prototype,r),n&&bt(t,n),e}();function Ot(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var wt=!1,Dt=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.targetId=null,this.internalMonitor=t.getMonitor()}var t,n,i;return t=e,(n=[{key:"receiveHandlerId",value:function(e){this.targetId=e}},{key:"getHandlerId",value:function(){return this.targetId}},{key:"subscribeToStateChange",value:function(e,t){return this.internalMonitor.subscribeToStateChange(e,t)}},{key:"canDrop",value:function(){if(!this.targetId)return!1;r(!wt,"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 wt=!0,this.internalMonitor.canDropOnTarget(this.targetId)}finally{wt=!1}}},{key:"isOver",value:function(e){return!!this.targetId&&this.internalMonitor.isOverTarget(this.targetId,e)}},{key:"getItemType",value:function(){return this.internalMonitor.getItemType()}},{key:"getItem",value:function(){return this.internalMonitor.getItem()}},{key:"getDropResult",value:function(){return this.internalMonitor.getDropResult()}},{key:"didDrop",value:function(){return this.internalMonitor.didDrop()}},{key:"getInitialClientOffset",value:function(){return this.internalMonitor.getInitialClientOffset()}},{key:"getInitialSourceClientOffset",value:function(){return this.internalMonitor.getInitialSourceClientOffset()}},{key:"getSourceClientOffset",value:function(){return this.internalMonitor.getSourceClientOffset()}},{key:"getClientOffset",value:function(){return this.internalMonitor.getClientOffset()}},{key:"getDifferenceFromInitialOffset",value:function(){return this.internalMonitor.getDifferenceFromInitialOffset()}}])&&Ot(t.prototype,n),i&&Ot(t,i),e}();function St(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var r=[],n=!0,i=!1,o=void 0;try{for(var a,u=e[Symbol.iterator]();!(n=(a=u.next()).done)&&(r.push(a.value),!t||r.length!==t);n=!0);}catch(e){i=!0,o=e}finally{try{n||null==u.return||u.return()}finally{if(i)throw o}}return r}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function Tt(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var r=[],n=!0,i=!1,o=void 0;try{for(var a,u=e[Symbol.iterator]();!(n=(a=u.next()).done)&&(r.push(a.value),!t||r.length!==t);n=!0);}catch(e){i=!0,o=e}finally{try{n||null==u.return||u.return()}finally{if(i)throw o}}return r}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function It(t){var n=e.useRef(t);n.current=t,r(null!=t.accept,"accept must be defined");var o,a=Tt((o=tt(),[e.useMemo((function(){return new Dt(o)}),[o]),e.useMemo((function(){return new mt(o.getBackend())}),[o])]),2),u=a[0],s=a[1];!function(t,r,n){var o=tt(),a=e.useMemo((function(){return{canDrop:function(){var e=t.current.canDrop;return!e||e(r.getItem(),r)},hover:function(){var e=t.current.hover;e&&e(r.getItem(),r)},drop:function(){var e=t.current.drop;if(e)return e(r.getItem(),r)}}}),[r]);i((function(){var e=St(function(e,t,r){var n=r.getRegistry(),i=n.addTarget(e,t);return[i,function(){return n.removeTarget(i)}]}(t.current.accept,a,o),2),i=e[0],u=e[1];return r.receiveHandlerId(i),n.receiveHandlerId(i),u}),[r,n])}(n,u,s);var l=c(u,n.current.collect||function(){return{}},(function(){return s.reconnect()})),f=e.useMemo((function(){return s.hooks.dropTarget()}),[s]);return i((function(){s.dropTargetOptions=t.options||null,s.reconnect()}),[t.options]),[l,f]}function Et(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var r=[],n=!0,i=!1,o=void 0;try{for(var a,u=e[Symbol.iterator]();!(n=(a=u.next()).done)&&(r.push(a.value),!t||r.length!==t);n=!0);}catch(e){i=!0,o=e}finally{try{n||null==u.return||u.return()}finally{if(i)throw o}}return r}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function kt(e,t){if(null==e)return{};var r,n,i=function(e,t){if(null==e)return{};var r,n,i={},o=Object.keys(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||(i[r]=e[r]);return i}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}var Ct=0,Pt=e.memo((function(t){var r=t.children,n=Et(function(e){if("manager"in e){return[{dragDropManager:e.manager},!1]}var t=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Nt(),r=arguments.length>2?arguments[2]:void 0,n=arguments.length>3?arguments[3]:void 0,i=t;i[jt]||(i[jt]=et(e,t,r,n));return i[jt]}(e.backend,e.context,e.options,e.debugMode),r=!e.context;return[t,r]}(kt(t,["children"])),2),i=n[0],o=n[1];return e.useEffect((function(){return o&&Ct++,function(){o&&(0===--Ct&&(Nt()[jt]=null))}}),[]),e.createElement($e.Provider,{value:i},r)}));Pt.displayName="DndProvider";var jt=Symbol.for("__REACT_DND_CONTEXT_INSTANCE__");function Nt(){return void 0!==t?t:window}function xt(e){var t=null;return function(){return null==t&&(t=e()),t}}function Rt(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var Mt=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.entered=[],this.isNodeInDocument=t}var t,r,n;return t=e,(r=[{key:"enter",value:function(e){var t=this,r=this.entered.length;return this.entered=function(e,t){var r=new Set,n=function(e){return r.add(e)};e.forEach(n),t.forEach(n);var i=[];return r.forEach((function(e){return i.push(e)})),i}(this.entered.filter((function(r){return t.isNodeInDocument(r)&&(!r.contains||r.contains(e))})),[e]),0===r&&this.entered.length>0}},{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=[]}}])&&Rt(t.prototype,r),n&&Rt(t,n),e}(),At=xt((function(){return/firefox/i.test(navigator.userAgent)})),_t=xt((function(){return Boolean(window.safari)}));function Lt(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var Ht=function(){function e(t,r){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e);for(var n=t.length,i=[],o=0;o<n;o++)i.push(o);i.sort((function(e,r){return t[e]<t[r]?-1:1}));for(var a,u,c=[],s=[],l=0;l<n-1;l++)a=t[l+1]-t[l],u=r[l+1]-r[l],c.push(a),s.push(u/a);for(var f=[s[0]],d=0;d<c.length-1;d++){var g=s[d],h=s[d+1];if(g*h<=0)f.push(0);else{a=c[d];var p=c[d+1],v=a+p;f.push(3*v/((v+p)/g+(v+a)/h))}}f.push(s[s.length-1]);for(var y,b=[],m=[],O=0;O<f.length-1;O++){y=s[O];var w=f[O],D=1/c[O],S=w+f[O+1]-y-y;b.push((y-w-S)*D),m.push(S*D*D)}this.xs=t,this.ys=r,this.c1s=f,this.c2s=b,this.c3s=m}var t,r,n;return t=e,(r=[{key:"interpolate",value:function(e){var t=this.xs,r=this.ys,n=this.c1s,i=this.c2s,o=this.c3s,a=t.length-1;if(e===t[a])return r[a];for(var u,c=0,s=o.length-1;c<=s;){var l=t[u=Math.floor(.5*(c+s))];if(l<e)c=u+1;else{if(!(l>e))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}}])&&Lt(t.prototype,r),n&&Lt(t,n),e}();function Ut(e){var t=1===e.nodeType?e:e.parentElement;if(!t)return null;var r=t.getBoundingClientRect(),n=r.top;return{x:r.left,y:n}}function Ft(e){return{x:e.clientX,y:e.clientY}}function Bt(e,t,r,n,i){var o,a=function(e){return"IMG"===e.nodeName&&(At()||!document.documentElement.contains(e))}(t),u=Ut(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 _t()&&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 Ht([0,.5,1],[c.x,c.x/s*h,c.x+h-s]).interpolate(f),y:b?y:(o=new Ht([0,.5,1],[c.y,c.y/l*p,c.y+p-l]).interpolate(d),_t()&&a&&(o+=(window.devicePixelRatio-1)*p),o)}}var Yt,Gt="__NATIVE_FILE__",Xt="__NATIVE_URL__",Wt="__NATIVE_TEXT__",Kt=Object.freeze({__proto__:null,FILE:Gt,URL:Xt,TEXT:Wt});function Vt(e,t,r){var n=t.reduce((function(t,r){return t||e.getData(r)}),"");return null!=n?n:r}function qt(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var zt=(qt(Yt={},Gt,{exposeProperties:{files:function(e){return Array.prototype.slice.call(e.files)},items:function(e){return e.items}},matchesTypes:["Files"]}),qt(Yt,Xt,{exposeProperties:{urls:function(e,t){return Vt(e,t,"").split("\n")}},matchesTypes:["Url","text/uri-list"]}),qt(Yt,Wt,{exposeProperties:{text:function(e,t){return Vt(e,t,"")}},matchesTypes:["Text","text/plain"]}),Yt);function Jt(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var Qt=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.config=t,this.item={},this.initializeExposedProperties()}var t,r,n;return t=e,(r=[{key:"initializeExposedProperties",value:function(){var e=this;Object.keys(this.config.exposeProperties).forEach((function(t){Object.defineProperty(e.item,t,{configurable:!0,enumerable:!0,get:function(){return console.warn("Browser doesn't allow reading \"".concat(t,'" until the drop event.')),null}})}))}},{key:"loadDataTransfer",value:function(e){var t=this;if(e){var r={};Object.keys(this.config.exposeProperties).forEach((function(n){r[n]={value:t.config.exposeProperties[n](e,t.config.matchesTypes),configurable:!0,enumerable:!0}})),Object.defineProperties(this.item,r)}}},{key:"canDrag",value:function(){return!0}},{key:"beginDrag",value:function(){return this.item}},{key:"isDragging",value:function(e,t){return t===e.getSourceId()}},{key:"endDrag",value:function(){}}])&&Jt(t.prototype,r),n&&Jt(t,n),e}();function Zt(e){if(!e)return null;var t=Array.prototype.slice.call(e.types||[]);return Object.keys(zt).filter((function(e){return zt[e].matchesTypes.some((function(e){return t.indexOf(e)>-1}))}))[0]||null}function $t(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var er=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.globalContext=t}var t,r,n;return t=e,(r=[{key:"window",get:function(){return this.globalContext?this.globalContext:"undefined"!=typeof window?window:void 0}},{key:"document",get:function(){if(this.window)return this.window.document}}])&&$t(t.prototype,r),n&&$t(t,n),e}();function tr(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function rr(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?tr(Object(r),!0).forEach((function(t){nr(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):tr(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function nr(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ir(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var or=function(){function e(t,r){var n=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.sourcePreviewNodes=new Map,this.sourcePreviewNodeOptions=new Map,this.sourceNodes=new Map,this.sourceNodeOptions=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.getSourceClientOffset=function(e){return Ut(n.sourceNodes.get(e))},this.endDragNativeItem=function(){n.isDraggingNativeItem()&&(n.actions.endDrag(),n.registry.removeSource(n.currentNativeHandle),n.currentNativeHandle=null,n.currentNativeSource=null)},this.isNodeInDocument=function(e){return n.document&&n.document.body&&document.body.contains(e)},this.endDragIfSourceWasRemovedFromDOM=function(){var e=n.currentDragSourceNode;n.isNodeInDocument(e)||n.clearCurrentDragSourceNode()&&n.actions.endDrag()},this.handleTopDragStartCapture=function(){n.clearCurrentDragSourceNode(),n.dragStartSourceIds=[]},this.handleTopDragStart=function(e){if(!e.defaultPrevented){var t=n.dragStartSourceIds;n.dragStartSourceIds=null;var r=Ft(e);n.monitor.isDragging()&&n.actions.endDrag(),n.actions.beginDrag(t||[],{publishSource:!1,getSourceClientOffset:n.getSourceClientOffset,clientOffset:r});var i=e.dataTransfer,o=Zt(i);if(n.monitor.isDragging()){if(i&&"function"==typeof i.setDragImage){var a=n.monitor.getSourceId(),u=n.sourceNodes.get(a),c=n.sourcePreviewNodes.get(a)||u;if(c){var s=n.getCurrentSourcePreviewNodeOptions(),l=Bt(u,c,r,{anchorX:s.anchorX,anchorY:s.anchorY},{offsetX:s.offsetX,offsetY:s.offsetY});i.setDragImage(c,l.x,l.y)}}try{i.setData("application/json",{})}catch(e){}n.setCurrentDragSourceNode(e.target),n.getCurrentSourcePreviewNodeOptions().captureDraggingState?n.actions.publishDragSource():setTimeout((function(){return n.actions.publishDragSource()}),0)}else if(o)n.beginDragNativeItem(o);else{if(i&&!i.types&&(e.target&&!e.target.hasAttribute||!e.target.hasAttribute("draggable")))return;e.preventDefault()}}},this.handleTopDragEndCapture=function(){n.clearCurrentDragSourceNode()&&n.actions.endDrag()},this.handleTopDragEnterCapture=function(e){if(n.dragEnterTargetIds=[],n.enterLeaveCounter.enter(e.target)&&!n.monitor.isDragging()){var t=e.dataTransfer,r=Zt(t);r&&n.beginDragNativeItem(r,t)}},this.handleTopDragEnter=function(e){var t=n.dragEnterTargetIds;(n.dragEnterTargetIds=[],n.monitor.isDragging())&&(n.altKeyPressed=e.altKey,At()||n.actions.hover(t,{clientOffset:Ft(e)}),t.some((function(e){return n.monitor.canDropOnTarget(e)}))&&(e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect=n.getCurrentDropEffect())))},this.handleTopDragOverCapture=function(){n.dragOverTargetIds=[]},this.handleTopDragOver=function(e){var t=n.dragOverTargetIds;if(n.dragOverTargetIds=[],!n.monitor.isDragging())return e.preventDefault(),void(e.dataTransfer&&(e.dataTransfer.dropEffect="none"));n.altKeyPressed=e.altKey,n.actions.hover(t||[],{clientOffset:Ft(e)}),(t||[]).some((function(e){return n.monitor.canDropOnTarget(e)}))?(e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect=n.getCurrentDropEffect())):n.isDraggingNativeItem()?e.preventDefault():(e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect="none"))},this.handleTopDragLeaveCapture=function(e){n.isDraggingNativeItem()&&e.preventDefault(),n.enterLeaveCounter.leave(e.target)&&n.isDraggingNativeItem()&&n.endDragNativeItem()},this.handleTopDropCapture=function(e){n.dropTargetIds=[],e.preventDefault(),n.isDraggingNativeItem()&&n.currentNativeSource.loadDataTransfer(e.dataTransfer),n.enterLeaveCounter.reset()},this.handleTopDrop=function(e){var t=n.dropTargetIds;n.dropTargetIds=[],n.actions.hover(t,{clientOffset:Ft(e)}),n.actions.drop({dropEffect:n.getCurrentDropEffect()}),n.isDraggingNativeItem()?n.endDragNativeItem():n.endDragIfSourceWasRemovedFromDOM()},this.handleSelectStart=function(e){var t=e.target;"function"==typeof t.dragDrop&&("INPUT"===t.tagName||"SELECT"===t.tagName||"TEXTAREA"===t.tagName||t.isContentEditable||(e.preventDefault(),t.dragDrop()))},this.options=new er(r),this.actions=t.getActions(),this.monitor=t.getMonitor(),this.registry=t.getRegistry(),this.enterLeaveCounter=new Mt(this.isNodeInDocument)}var t,r,n;return t=e,(r=[{key:"setup",value:function(){if(void 0!==this.window){if(this.window.__isReactDndBackendSetUp)throw new Error("Cannot have two HTML5 backends at the same time.");this.window.__isReactDndBackendSetUp=!0,this.addEventListeners(this.window)}}},{key:"teardown",value:function(){void 0!==this.window&&(this.window.__isReactDndBackendSetUp=!1,this.removeEventListeners(this.window),this.clearCurrentDragSourceNode(),this.asyncEndDragFrameId&&this.window.cancelAnimationFrame(this.asyncEndDragFrameId))}},{key:"connectDragPreview",value:function(e,t,r){var n=this;return this.sourcePreviewNodeOptions.set(e,r),this.sourcePreviewNodes.set(e,t),function(){n.sourcePreviewNodes.delete(e),n.sourcePreviewNodeOptions.delete(e)}}},{key:"connectDragSource",value:function(e,t,r){var n=this;this.sourceNodes.set(e,t),this.sourceNodeOptions.set(e,r);var i=function(t){return n.handleDragStart(t,e)},o=function(e){return n.handleSelectStart(e)};return t.setAttribute("draggable","true"),t.addEventListener("dragstart",i),t.addEventListener("selectstart",o),function(){n.sourceNodes.delete(e),n.sourceNodeOptions.delete(e),t.removeEventListener("dragstart",i),t.removeEventListener("selectstart",o),t.setAttribute("draggable","false")}}},{key:"connectDropTarget",value:function(e,t){var r=this,n=function(t){return r.handleDragEnter(t,e)},i=function(t){return r.handleDragOver(t,e)},o=function(t){return r.handleDrop(t,e)};return t.addEventListener("dragenter",n),t.addEventListener("dragover",i),t.addEventListener("drop",o),function(){t.removeEventListener("dragenter",n),t.removeEventListener("dragover",i),t.removeEventListener("drop",o)}}},{key:"addEventListeners",value:function(e){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))}},{key:"removeEventListeners",value:function(e){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))}},{key:"getCurrentSourceNodeOptions",value:function(){var e=this.monitor.getSourceId(),t=this.sourceNodeOptions.get(e);return rr({dropEffect:this.altKeyPressed?"copy":"move"},t||{})}},{key:"getCurrentDropEffect",value:function(){return this.isDraggingNativeItem()?"copy":this.getCurrentSourceNodeOptions().dropEffect}},{key:"getCurrentSourcePreviewNodeOptions",value:function(){var e=this.monitor.getSourceId();return rr({anchorX:.5,anchorY:.5,captureDraggingState:!1},this.sourcePreviewNodeOptions.get(e)||{})}},{key:"isDraggingNativeItem",value:function(){var e=this.monitor.getItemType();return Object.keys(Kt).some((function(t){return Kt[t]===e}))}},{key:"beginDragNativeItem",value:function(e,t){this.clearCurrentDragSourceNode(),this.currentNativeSource=function(e,t){var r=new Qt(zt[e]);return r.loadDataTransfer(t),r}(e,t),this.currentNativeHandle=this.registry.addSource(e,this.currentNativeSource),this.actions.beginDrag([this.currentNativeHandle])}},{key:"setCurrentDragSourceNode",value:function(e){var t=this;this.clearCurrentDragSourceNode(),this.currentDragSourceNode=e,this.mouseMoveTimeoutTimer=setTimeout((function(){return t.window&&t.window.addEventListener("mousemove",t.endDragIfSourceWasRemovedFromDOM,!0)}),1e3)}},{key:"clearCurrentDragSourceNode",value:function(){return!!this.currentDragSourceNode&&(this.currentDragSourceNode=null,this.window&&(this.window.clearTimeout(this.mouseMoveTimeoutTimer||void 0),this.window.removeEventListener("mousemove",this.endDragIfSourceWasRemovedFromDOM,!0)),this.mouseMoveTimeoutTimer=null,!0)}},{key:"handleDragStart",value:function(e,t){e.defaultPrevented||(this.dragStartSourceIds||(this.dragStartSourceIds=[]),this.dragStartSourceIds.unshift(t))}},{key:"handleDragEnter",value:function(e,t){this.dragEnterTargetIds.unshift(t)}},{key:"handleDragOver",value:function(e,t){null===this.dragOverTargetIds&&(this.dragOverTargetIds=[]),this.dragOverTargetIds.unshift(t)}},{key:"handleDrop",value:function(e,t){this.dropTargetIds.unshift(t)}},{key:"window",get:function(){return this.options.window}},{key:"document",get:function(){return this.options.document}}])&&ir(t.prototype,r),n&&ir(t,n),e}(),ar=function(e,t){return new or(e,t)};if("undefined"!=typeof self)ur(self);else if(void 0!==t)ur(t);else{if("undefined"==typeof window)throw new Error("unsupported execution environment");ur(window)}function ur(e){e.ReactDnd={useDrag:yt,useDrop:It,DndProvider:Pt,HTML5Backend:ar}}}(React); |