@dnd-kit/core
Advanced tools
Comparing version 1.0.0 to 1.0.1
# @dnd-kit/core | ||
## 1.0.1 | ||
### Patch Changes | ||
- [`5194696`](https://github.com/clauderic/dnd-kit/commit/5194696b4b91f26379cd3e6c11b2d66c92d32c5b) [#51](https://github.com/clauderic/dnd-kit/pull/51) Thanks [@clauderic](https://github.com/clauderic)! - Fix issue with reducer initial state variable causing collisions due to variable references all pointing to the original initial state variable. | ||
- [`310bbd6`](https://github.com/clauderic/dnd-kit/commit/310bbd6370e85f8fb16cad149e6254600a5beb3a) [#37](https://github.com/clauderic/dnd-kit/pull/37) Thanks [@nickpresta](https://github.com/nickpresta)! - Fix typo in package.json repository URL | ||
- Updated dependencies [[`0b343c7`](https://github.com/clauderic/dnd-kit/commit/0b343c7e88a68351f8a39f643e9f26b8e046ef48), [`310bbd6`](https://github.com/clauderic/dnd-kit/commit/310bbd6370e85f8fb16cad149e6254600a5beb3a)]: | ||
- @dnd-kit/utilities@1.0.1 | ||
- @dnd-kit/accessibility@1.0.1 | ||
## 1.0.0 | ||
@@ -4,0 +16,0 @@ |
@@ -1,2 +0,2 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t,n=require("react"),r=(e=n)&&"object"==typeof e&&"default"in e?e.default:e,o=require("react-dom"),a=require("@dnd-kit/utilities"),i=require("@dnd-kit/accessibility"),c={draggable:"\n To pick up a draggable item, press the space bar.\n While dragging, use the arrow keys to move the item.\n Press space again to drop the item in its new position, or press escape to cancel.\n "},l={onDragStart:function(e){return"Picked up draggable item "+e+"."},onDragOver:function(e,t){return t?"Draggable item "+e+" was moved over droppable area "+t+".":"Draggable item "+e+" is no longer over a droppable area."},onDragEnd:function(e,t){return t?"Draggable item "+e+" was dropped over droppable area "+t:"Draggable item "+e+" was dropped."},onDragCancel:function(e){return"Dragging was cancelled. Draggable item "+e+" was dropped."}};!function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"}(t||(t={}));var s=function(e){return u(e,(function(e,t){return e<t}))};function u(e,t){if(0===e.length)return-1;for(var n=e[0],r=0,o=1;o<e.length;o++)t(e[o],n)&&(r=o,n=e[o]);return r}function d(){}function f(){return(f=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function v(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}function p(e,t){if(null==e)return{};var n,r,o={},a=Object.keys(e);for(r=0;r<a.length;r++)t.indexOf(n=a[r])>=0||(o[n]=e[n]);return o}function h(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function g(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}var b=n.createContext({activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,activeNodeClientRect:null,activators:[],ariaDescribedById:{draggable:""},overlayNode:{nodeRef:{current:null},rect:null,setRef:d},containerNodeRect:null,dispatch:d,draggableNodes:{},droppableRects:new Map,droppableContainers:{},over:null,scrollableAncestors:[],scrollableAncestorRects:[],recomputeLayouts:d,windowRect:null,willRecomputeLayouts:!1}),y=Object.freeze({x:0,y:0});function m(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function x(e){if(function(e){var t;return(null==(t=window)?void 0:t.TouchEvent)&&e instanceof TouchEvent}(e)){if(e.touches&&e.touches.length){var t=e.touches[0];return{x:t.clientX,y:t.clientY}}if(e.changedTouches&&e.changedTouches.length){var n=e.changedTouches[0];return{x:n.clientX,y:n.clientY}}}return function(e){var t;return(null==(t=window)?void 0:t.MouseEvent)&&e instanceof MouseEvent||e.type.includes("mouse")}(e)?{x:e.clientX,y:e.clientY}:{x:0,y:0}}function w(e,t){if(e instanceof KeyboardEvent)return"0 0";var n=x(e);return(n.x-t.left)/t.width*100+"% "+(n.y-t.top)/t.height*100+"%"}function R(e,t,n){return void 0===t&&(t=e.offsetLeft),void 0===n&&(n=e.offsetTop),{x:t+.5*e.width,y:n+.5*e.height}}function E(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return r.reduce((function(t,n){return f({},t,{top:t.top+e*n.y,bottom:t.bottom+e*n.y,left:t.left+e*n.x,right:t.right+e*n.x,offsetLeft:t.offsetLeft+e*n.x,offsetTop:t.offsetTop+e*n.y})}),f({},t))}}var D,C=E(1);function M(e){var t=[];return e?function e(n){return n?n instanceof Document&&null!=n.scrollingElement?(t.push(n.scrollingElement),t):!(n instanceof HTMLElement)||n instanceof SVGElement?t:(function(e){var t=window.getComputedStyle(e),n=/(auto|scroll)/;return null!=["overflow","overflowX","overflowY"].find((function(e){var r=t[e];return"string"==typeof r&&n.test(r)}))}(n)&&t.push(n),e(n.parentNode)):t}(e.parentNode):t}function S(e){return a.canUseDOM?e===document.scrollingElement||e instanceof Document?window:e instanceof HTMLElement?e:null:null}function L(e){return e instanceof Window?{x:e.scrollX,y:e.scrollY}:{x:e.scrollLeft,y:e.scrollTop}}function N(e){var t=function(e){if(e===document.scrollingElement){var t=window,n=t.innerWidth,r=t.innerHeight;return{top:0,left:0,right:n,bottom:r,width:n,height:r}}return e.getBoundingClientRect()}(e),n={x:0,y:0},r={x:e.scrollWidth-t.width,y:e.scrollHeight-t.height};return{isTop:e.scrollTop<=n.y,isLeft:e.scrollLeft<=n.x,isBottom:e.scrollTop>=r.y,isRight:e.scrollLeft>=r.x,scrollElementRect:t,maxScroll:r,minScroll:n}}function T(e,t,n,r){void 0===r&&(r=10);var o,i=(o=e,a.canUseDOM&&o&&o===document.scrollingElement?{top:0,left:0,right:e.clientWidth,bottom:e.clientHeight}:t),c=N(e),l=c.isBottom,s=c.isLeft,u=c.isRight,d=n.width,f=n.height,v=n.left,p=n.top,h=n.bottom,g=n.right,b={x:0,y:0},y={x:0,y:0};return!c.isTop&&p<=i.top+f?(b.y=D.Backward,y.y=r*Math.abs((p-f-i.top)/f)):!l&&h>=i.bottom-f&&(b.y=D.Forward,y.y=r*Math.abs((i.bottom-f-h)/f)),!u&&g>=i.right-d?(b.x=D.Forward,y.x=r*Math.abs((i.right-d-g)/d)):!s&&v<=i.left+d&&(b.x=D.Backward,y.x=r*Math.abs((v-d-i.left)/d)),{direction:b,speed:y}}function I(e){return e.reduce((function(e,t){return a.add(e,L(t))}),y)}function K(e){var t=e.offsetWidth,n=e.offsetHeight,r=function e(t,n,r){if(void 0===r&&(r=y),!(t&&t instanceof HTMLElement))return r;var o={x:r.x+t.offsetLeft,y:r.y+t.offsetTop};return t.offsetParent===n?o:e(t.offsetParent,n,o)}(e,null);return{width:t,height:n,offsetTop:r.y,offsetLeft:r.x}}function A(e){if(e instanceof Window){var t=window.innerWidth,n=window.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n,offsetTop:0,offsetLeft:0}}var r=K(e),o=r.offsetTop,a=r.offsetLeft,i=e.getBoundingClientRect();return{width:i.width,height:i.height,top:i.top,bottom:i.bottom,right:i.right,left:i.left,offsetTop:o,offsetLeft:a}}function B(e){var t=K(e),n=t.width,r=t.height,o=t.offsetTop,a=t.offsetLeft,i=I(M(e)),c=o-i.y,l=a-i.x;return{width:n,height:r,top:c,bottom:c+r,right:l+n,left:l,offsetTop:o,offsetLeft:a}}function k(e){return"top"in e}function O(e,t,n){return void 0===t&&(t=e.offsetLeft),void 0===n&&(n=e.offsetTop),[{x:t,y:n},{x:t+e.width,y:n},{x:t,y:n+e.height},{x:t+e.width,y:n+e.height}]}!function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"}(D||(D={}));var j=function(e,t){var n=e.map((function(e){return function(e,t){var n=Math.max(t.top,e.offsetTop),r=Math.max(t.left,e.offsetLeft),o=Math.min(t.left+t.width,e.offsetLeft+e.width),a=Math.min(t.top+t.height,e.offsetTop+e.height);if(r<o&&n<a){var i=(o-r)*(a-n);return Number((i/(t.width*t.height+e.width*e.height-i)).toFixed(4))}return 0}(e[1],t)})),r=u(n,(function(e,t){return e>t}));return n[r]<=0?null:e[r]?e[r][0]:null};function P(e){return e instanceof HTMLElement?e.ownerDocument:document}var U={draggable:{active:null,initialCoordinates:{x:0,y:0},lastEvent:null,nodes:{},translate:{x:0,y:0}},droppable:{containers:{}}};function H(e,n){switch(n.type){case t.DragStart:return f({},e,{draggable:f({},U.draggable,{initialCoordinates:n.initialCoordinates,active:n.active,lastEvent:t.DragStart})});case t.DragMove:return e.draggable.active?f({},e,{draggable:f({},e.draggable,{translate:{x:n.coordinates.x-e.draggable.initialCoordinates.x,y:n.coordinates.y-e.draggable.initialCoordinates.y}})}):e;case t.DragEnd:case t.DragCancel:return f({},e,{draggable:f({},U.draggable,{lastEvent:n.type})});case t.RegisterDroppable:var r,o=n.element;return f({},e,{droppable:f({},e.droppable,{containers:f({},e.droppable.containers,(r={},r[o.id]=o,r))})});case t.SetDroppableDisabled:var a,i=n.id,c=e.droppable.containers[i];return c?f({},e,{droppable:f({},e.droppable,{containers:f({},e.droppable.containers,(a={},a[i]=f({},c,{disabled:n.disabled}),a))})}):e;case t.UnregisterDroppable:return f({},e,{droppable:f({},e.droppable,{containers:(l=n.id,s=e.droppable.containers,p(s,[l].map(g)))})});default:return e}var l,s}function X(e){var c=e.announcements,s=void 0===c?l:c,u=e.activeId,d=e.overId,f=e.lastEvent,v=e.hiddenTextDescribedById,p=e.screenReaderInstructions,h=i.useAnnouncement(),g=h.announce,b=h.entries,y=n.useRef({activeId:u,overId:d}),m=a.useUniqueId("DndLiveRegion");return n.useEffect((function(){var e,n=y.current,r=n.activeId,o=n.overId;!r&&u?e=s.onDragStart(u):!u&&r?f===t.DragEnd?e=s.onDragEnd(r,null!=o?o:void 0):f===t.DragCancel&&(e=s.onDragCancel(r)):u&&r&&d!==o&&(e=s.onDragOver(u,null!=d?d:void 0)),e&&g(e),y.current.overId===d&&y.current.activeId===u||(y.current={activeId:u,overId:d})}),[s,g,u,d,f]),a.canUseDOM?o.createPortal(r.createElement(r.Fragment,null,r.createElement(i.HiddenText,{id:v,value:p.draggable}),r.createElement(i.LiveRegion,{id:m,entries:b})),document.body):null}var Y=new Map,z=[],F=_(A),q=V(A),W=_(B);function _(e){return function(t,r){var o=n.useRef(t);return a.useLazyMemo((function(n){return t?r||!n&&t||t!==o.current?t instanceof HTMLElement&&null==t.parentNode?null:e(t):null!=n?n:null:null}),[t,r])}}function V(e){var t=[];return function(r,o){var i=n.useRef(r);return a.useLazyMemo((function(n){return r.length?o||!n&&r.length||r!==i.current?r.map((function(t){return e(t)})):null!=n?n:t:t}),[r,o])}}var G,$=function(){function e(e){this.target=e,this.listeners=[]}var t=e.prototype;return t.add=function(e,t,n){this.target.addEventListener(e,t,n),this.listeners.push({eventName:e,handler:t})},t.removeAll=function(){var e=this;this.listeners.forEach((function(t){return e.target.removeEventListener(t.eventName,t.handler)}))},e}();(G=exports.KeyboardCode||(exports.KeyboardCode={})).Space="Space",G.Down="ArrowDown",G.Right="ArrowRight",G.Left="ArrowLeft",G.Up="ArrowUp",G.Esc="Escape",G.Enter="Enter";var J,Q={start:[exports.KeyboardCode.Space,exports.KeyboardCode.Enter],cancel:[exports.KeyboardCode.Esc],end:[exports.KeyboardCode.Space,exports.KeyboardCode.Enter]},Z=function(e,t){var n=t.currentCoordinates;switch(e.code){case exports.KeyboardCode.Right:return f({},n,{x:n.x+25});case exports.KeyboardCode.Left:return f({},n,{x:n.x-25});case exports.KeyboardCode.Down:return f({},n,{y:n.y+25});case exports.KeyboardCode.Up:return f({},n,{y:n.y-25})}},ee=function(){function e(e){this.props=e,this.autoScrollEnabled=!1,this.coordinates=y;var t=e.event.target;this.props=e,this.listeners=new $(P(t)),this.handleKeyDown=this.handleKeyDown.bind(this),this.attach()}var t=e.prototype;return t.attach=function(){var e=this;this.handleStart(),setTimeout((function(){return e.listeners.add("keydown",e.handleKeyDown)}))},t.handleStart=function(){var e=this.props,t=e.activeNode,n=e.onStart;if(!t.current)throw new Error("Active draggable node is undefined");var r=A(t.current),o={x:r.left,y:r.top};this.coordinates=o,n(o)},t.handleKeyDown=function(e){if(e instanceof KeyboardEvent){var t=this.coordinates,n=this.props,r=n.active,o=n.context,i=n.options,c=i.keyboardCodes,l=void 0===c?Q:c,s=i.coordinateGetter,u=void 0===s?Z:s,d=i.scrollBehavior,f=void 0===d?"smooth":d,v=e.code;if(l.end.includes(v))return void this.handleEnd(e);if(l.cancel.includes(v))return void this.handleCancel(e);var p=u(e,{active:r,context:o.current,currentCoordinates:t});if(p){var h={x:0,y:0},g=o.current.scrollableAncestors[0];if(g){var b=e.code,y=a.subtract(p,t),m=N(g),x=m.isTop,w=m.isRight,R=m.isLeft,E=m.isBottom,D=m.scrollElementRect,C=m.maxScroll,M=m.minScroll,S={x:Math.min(b===exports.KeyboardCode.Right?D.right-D.width/2:D.right,Math.max(b===exports.KeyboardCode.Right?D.left:D.left+D.width/2,p.x)),y:Math.min(b===exports.KeyboardCode.Down?D.bottom-D.height/2:D.bottom,Math.max(b===exports.KeyboardCode.Down?D.top:D.top+D.height/2,p.y))},L=b===exports.KeyboardCode.Right&&!w||b===exports.KeyboardCode.Left&&!R,T=b===exports.KeyboardCode.Down&&!E||b===exports.KeyboardCode.Up&&!x;if(L&&S.x!==p.x){if(b===exports.KeyboardCode.Right&&g.scrollLeft+y.x<=C.x||b===exports.KeyboardCode.Left&&g.scrollLeft+y.x>=M.x)return void g.scrollBy({left:y.x,behavior:f});h.x=b===exports.KeyboardCode.Right?g.scrollLeft-C.x:g.scrollLeft-M.x,g.scrollBy({left:-h.x,behavior:f})}else if(T&&S.y!==p.y){if(b===exports.KeyboardCode.Down&&g.scrollTop+y.y<=C.y||b===exports.KeyboardCode.Up&&g.scrollTop+y.y>=M.y)return void g.scrollBy({top:y.y,behavior:f});h.y=b===exports.KeyboardCode.Down?g.scrollTop-C.y:g.scrollTop-M.y,g.scrollBy({top:-h.y,behavior:f})}}this.handleMove(e,a.add(p,h))}}},t.handleMove=function(e,t){var n=this.props.onMove;e.preventDefault(),n(t),this.coordinates=t},t.handleEnd=function(e){var t=this.props.onEnd;e.preventDefault(),this.detach(),t()},t.handleCancel=function(e){var t=this.props.onCancel;e.preventDefault(),this.detach(),t()},t.detach=function(){this.listeners.removeAll()},e}();function te(e){return Boolean(e&&"distance"in e)}function ne(e){return Boolean(e&&"delay"in e)}ee.activators=[{eventName:"onKeyDown",handler:function(e,t){var n=t.keyboardCodes;return!!(void 0===n?Q:n).start.includes(e.nativeEvent.code)&&(e.preventDefault(),!0)}}],function(e){e.Keydown="keydown"}(J||(J={}));var re=function(){function e(e,t,n){var r;void 0===n&&(n=(r=e.event.target)instanceof HTMLElement?r:P(r)),this.props=e,this.events=t,this.autoScrollEnabled=!0,this.activated=!1,this.timeoutId=null;var o=e.event;this.props=e,this.events=t,this.ownerDocument=P(o.target),this.listeners=new $(n),this.initialCoordinates=x(o),this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.attach()}var t=e.prototype;return t.attach=function(){var e=this.events,t=this.props.options.activationConstraint;if(this.listeners.add(e.move.name,this.handleMove,!1),this.listeners.add(e.end.name,this.handleEnd),this.ownerDocument.addEventListener(J.Keydown,this.handleKeydown),t){if(te(t))return;if(ne(t))return void(this.timeoutId=setTimeout(this.handleStart,t.delay))}this.handleStart()},t.detach=function(){this.listeners.removeAll(),this.ownerDocument.removeEventListener(J.Keydown,this.handleKeydown),null!==this.timeoutId&&(clearTimeout(this.timeoutId),this.timeoutId=null)},t.handleStart=function(){var e=this.initialCoordinates,t=this.props.onStart;e&&(this.activated=!0,t(e))},t.handleMove=function(e){var t=this.activated,n=this.initialCoordinates,r=this.props,o=r.onMove,i=r.options.activationConstraint;if(n){var c=x(e),l=a.subtract(n,c),s=Math.abs(l.x)+Math.abs(l.y);if(!t&&i){if(ne(i))return s>=i.tolerance?this.handleCancel():void 0;if(te(i))return s>=i.distance?this.handleStart():void 0}e.cancelable&&e.preventDefault(),o(c)}},t.handleEnd=function(){var e=this.props.onEnd;this.detach(),e()},t.handleCancel=function(){var e=this.props.onCancel;this.detach(),e()},t.handleKeydown=function(e){e.code===exports.KeyboardCode.Esc&&this.handleCancel()},e}(),oe={move:{name:"pointermove"},end:{name:"pointerup"}},ae=function(e){function t(t){var n=P(t.event.target);return e.call(this,t,oe,n)||this}return v(t,e),t}(re);ae.activators=[{eventName:"onPointerDown",handler:function(e){var t=e.nativeEvent;return!(!t.isPrimary||0!==t.button||(t.preventDefault(),0))}}];var ie,ce={move:{name:"mousemove"},end:{name:"mouseup"}};!function(e){e[e.RightClick=2]="RightClick"}(ie||(ie={}));var le=function(e){function t(t){return e.call(this,t,ce,P(t.event.target))||this}return v(t,e),t}(re);le.activators=[{eventName:"onMouseDown",handler:function(e){var t=e.nativeEvent;return t.button!==ie.RightClick&&(t.preventDefault(),!0)}}];var se={move:{name:"touchmove"},end:{name:"touchend"}},ue=function(e){function t(t){return e.call(this,t,se)||this}return v(t,e),t}(re);function de(e,t){var n=t.transform,r=p(t,["transform"]);return(null==e?void 0:e.length)?e.reduce((function(e,t){return t(f({transform:e},r))}),n):n}ue.activators=[{eventName:"onTouchStart",handler:function(e){var t=e.nativeEvent;return!(t.touches.length>1||(t.cancelable&&t.preventDefault(),0))}}];var fe=[{sensor:ae,options:{}},{sensor:ee,options:{}}],ve=n.createContext(f({},y,{scaleX:1,scaleY:1})),pe=n.memo((function(e){var o,i,l,s,u,d=e.autoScroll,v=void 0===d||d,g=e.announcements,m=e.children,x=e.sensors,w=void 0===x?fe:x,R=e.collisionDetection,E=void 0===R?j:R,D=e.screenReaderInstructions,N=void 0===D?c:D,A=e.modifiers,B=p(e,["autoScroll","announcements","children","sensors","collisionDetection","screenReaderInstructions","modifiers"]),k=n.useReducer(H,U),O=k[0],P=k[1],_=O.draggable,V=_.active,G=_.lastEvent,$=_.nodes,J=_.translate,Q=O.droppable.containers,Z=n.useRef(null),ee=n.useState(null),te=ee[0],ne=ee[1],re=n.useState(null),oe=re[0],ae=re[1],ie=n.useRef(B),ce=a.useUniqueId("DndDescribedBy"),le=function(e,t){var r=n.useState(!1),o=r[0],i=r[1],c=n.useRef(e),l=n.useCallback((function(){i(!0)}),[]),s=a.useLazyMemo((function(n){if(t)return Y;if(!n||n===Y||c.current!==e||o){for(var r=0,a=Object.values(e);r<a.length;r++){var i=a[r];i&&(i.rect.current=i.node.current?K(i.node.current):null)}return function(e){var t=new Map;if(e)for(var n=0,r=Object.values(e);n<r.length;n++){var o=r[n];if(o){var a=o.rect;o.disabled||null==a.current||t.set(o.id,a.current)}}return t}(e)}return n}),[e,t,o]);return n.useEffect((function(){c.current=e}),[e]),n.useEffect((function(){o&&i(!1)}),[o]),{layoutRectMap:s,recomputeLayouts:l,willRecomputeLayouts:o}}(Q,null===V),se=le.layoutRectMap,ue=le.recomputeLayouts,pe=le.willRecomputeLayouts,ge=function(e,t){return a.useLazyMemo((function(n){var r,o;return null===t?null:null!=(r=null!=(o=null==e?void 0:e.current)?o:n)?r:null}),[e,t])}(function(e,t){var n;return e&&null!=(n=t[e])?n:null}(V,$),V),be=W(ge),ye=F(ge),me=n.useRef(null),xe=(i=me.current,(o=be)&&i?{x:o.left-i.left,y:o.top-i.top}:y),we=n.useRef({active:V,droppableRects:se,overId:null,scrollAdjustedTransalte:y,translatedRect:null}),Re=function(e,t){var n,r;return e&&null!=(n=null==(r=t[e])?void 0:r.node.current)?n:null}(we.current.overId,Q),Ee=F(ge?ge.ownerDocument.defaultView:null),De=F(ge?ge.parentElement:null),Ce=(s=n.useRef(l=V?null!=Re?Re:ge:null),u=a.useLazyMemo((function(e){return l?e&&l&&s.current&&l.parentNode===s.current.parentNode?e:M(l):z}),[l]),n.useEffect((function(){s.current=l}),[l]),u),Me=q(Ce),Se=a.useNodeRef(),Le=Se[0],Ne=Se[1],Te=F(V?Le.current:null,pe),Ie=de(A,{transform:{x:J.x-xe.x,y:J.y-xe.y,scaleX:1,scaleY:1},activeNodeRect:ye,draggingNodeRect:null!=Te?Te:ye,containerNodeRect:De,overlayNodeRect:Te,scrollableAncestors:Ce,scrollableAncestorRects:Me,windowRect:Ee}),Ke=function(e){var t=n.useState(null),r=t[0],o=t[1],i=n.useRef(e),c=n.useCallback((function(e){var t=S(e.target);t&&o((function(e){return e?(e.set(t,L(t)),new Map(e)):null}))}),[]);return n.useEffect((function(){var t=i.current;if(e!==t){r(t);var n=e.map((function(e){var t=S(e);return t?(t.addEventListener("scroll",c,{passive:!0}),[t,L(t)]):null})).filter((function(e){return null!=e}));o(n.length?new Map(n):null),i.current=e}return function(){r(e),r(t)};function r(e){e.forEach((function(e){var t=S(e);null==t||t.removeEventListener("scroll",c)}))}}),[c,e]),n.useMemo((function(){return e.length?r?Array.from(r.values()).reduce((function(e,t){return a.add(e,t)}),y):I(e):y}),[e,r])}(Ce),Ae=a.add(Ie,Ke),Be=be?C(be,Ie):null,ke=Be?C(Be,Ke):null,Oe=V&&ke?E(Array.from(se.entries()),ke):null,je=he(Oe,se),Pe=n.useMemo((function(){return Oe&&je?{id:Oe,rect:je}:null}),[Oe,je]),Ue=function(e,t,n){return f({},e,{scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1})}(Ie,je,be),He=n.useRef({activeNode:ge,collisionRect:ke,droppableRects:se,droppableContainers:Q,over:Pe,scrollableAncestors:Ce,translatedRect:Be}),Xe=n.useCallback((function(e,n){if(Z.current){var r=$[Z.current];if(r){var o=new(0,n.sensor)({active:Z.current,activeNode:r,event:e.nativeEvent,options:n.options,context:He,onStart:function(e){var n=Z.current;if(n){var r=ie.current.onDragStart;P({type:t.DragStart,initialCoordinates:e,active:n}),null==r||r({active:{id:n}})}},onMove:function(e){P({type:t.DragMove,coordinates:e})},onEnd:a(t.DragEnd),onCancel:a(t.DragCancel)});ne(o),ae(e.nativeEvent)}}function a(e){return function(){var n=we.current,r=n.overId,o=n.scrollAdjustedTransalte,a=ie.current,i=Z.current;i&&(Z.current=null),P({type:e}),ne(null),ae(null);var c=e===t.DragEnd?a.onDragEnd:a.onDragCancel;i&&(null==c||c({active:{id:i},delta:o,over:r?{id:r}:null}))}}}),[P,$]),Ye=function(e,t){return n.useMemo((function(){return e.reduce((function(e,n){var r=n.sensor.activators.map((function(e){return{eventName:e.eventName,handler:t(e.handler,n)}}));return[].concat(e,r)}),[])}),[e,t])}(w,n.useCallback((function(e,t){return function(n,r){var o=n.nativeEvent;null!==Z.current||o.dndKit||o.defaultPrevented||!0===e(n,t.options)&&(o.dndKit={capturedBy:t.sensor},Z.current=r,Xe(n,t))}}),[Xe]));a.useIsomorphicLayoutEffect((function(){ie.current=B}),Object.values(B)),a.useIsomorphicLayoutEffect((function(){V&&ue()}),[V,ue]),n.useEffect((function(){V||(me.current=null),V&&be&&!me.current&&(me.current=be)}),[be,V]),n.useEffect((function(){var e=Z.current;if(e){var t=ie.current.onDragMove,n=we.current,r=n.overId,o=n.droppableRects,a=n.translatedRect;if(t&&a){var i=he(r,o);t({active:{id:e},draggingRect:a,droppableRects:o,delta:{x:Ae.x,y:Ae.y},over:r&&i?{id:r,rect:i}:null})}}}),[Ae.x,Ae.y]),n.useEffect((function(){if(Z.current){var e=we.current,t=e.active,n=e.translatedRect;if(t&&n){var r=ie.current.onDragOver,o=he(Oe,e.droppableRects);null==r||r({active:{id:t},droppableRects:we.current.droppableRects,draggingRect:n,over:Oe&&o?{id:Oe,rect:o}:null})}}}),[Oe]),n.useEffect((function(){we.current={active:V,droppableRects:se,overId:Oe,translatedRect:Be,scrollAdjustedTransalte:Ae}}),[V,se,Oe,Be,Ae]),a.useIsomorphicLayoutEffect((function(){He.current={activeNode:ge,collisionRect:ke,droppableRects:se,droppableContainers:Q,over:Pe,scrollableAncestors:Ce,translatedRect:Be}}),[ge,ke,se,Q,Pe,Ce,Be]),function(e){var t=e.disabled,r=e.draggingRect,o=e.interval,i=void 0===o?5:o,c=e.scrollableAncestors,l=e.scrollableAncestorRects,s=a.useInterval(),u=s[0],d=s[1],f=n.useRef({x:1,y:1}),v=n.useRef(y),p=n.useRef(null),g=n.useCallback((function(){var e=p.current;e&&e.scrollBy(f.current.x*v.current.x,f.current.y*v.current.y)}),[]);n.useEffect((function(){if(!t&&c.length&&r)for(var e,n=function(e,t){var n;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return h(e,void 0);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?h(e,void 0):void 0}}(e))){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(n=e[Symbol.iterator]()).next.bind(n)}(c);!(e=n()).done;){var o=e.value,a=c.indexOf(o),s=l[a];if(s){var b=T(o,s,r),y=b.direction,m=b.speed;if(f.current=m,v.current=y,d(),m.x>0||m.y>0){p.current=o,u(g,i);break}}}else d()}),[g,r,d,t,u,c,l,i])}({draggingRect:Be,disabled:!v||!(null==te?void 0:te.autoScrollEnabled),scrollableAncestors:Ce,scrollableAncestorRects:Me});var ze=n.useMemo((function(){return{active:V,activeNode:ge,activeNodeRect:be,activeNodeClientRect:ye,activatorEvent:oe,activators:Ye,ariaDescribedById:{draggable:ce},overlayNode:{nodeRef:Le,rect:Te,setRef:Ne},containerNodeRect:De,dispatch:P,draggableNodes:$,droppableContainers:Q,droppableRects:se,over:Pe,recomputeLayouts:ue,scrollableAncestors:Ce,scrollableAncestorRects:Me,willRecomputeLayouts:pe,windowRect:Ee}}),[V,ge,ye,be,oe,Ye,De,Te,Le,P,$,ce,Q,se,Pe,ue,Ce,Me,Ne,pe,Ee]);return r.createElement(r.Fragment,null,r.createElement(b.Provider,{value:ze},r.createElement(ve.Provider,{value:Ue},m)),r.createElement(X,{announcements:g,activeId:V,overId:Oe,lastEvent:G,hiddenTextDescribedById:ce,screenReaderInstructions:N}))}));function he(e,t){var n;return e&&null!=(n=t.get(e))?n:null}var ge=n.createContext(null);function be(){return n.useContext(b)}var ye={},me=function(e){return e instanceof KeyboardEvent?"transform 250ms ease":void 0},xe={duration:250,easing:"ease"},we=r.memo((function(e){var t,o=e.adjustScale,i=void 0!==o&&o,c=e.children,l=e.dropAnimation,s=void 0===l?xe:l,u=e.transition,d=void 0===u?me:u,v=e.modifiers,h=e.wrapperElement,g=void 0===h?"div":h,b=e.className,y=e.zIndex,m=void 0===y?999:y,x=be(),R=x.active,E=x.activeNodeRect,D=x.activeNodeClientRect,C=x.containerNodeRect,M=x.draggableNodes,S=x.activatorEvent,L=x.overlayNode,N=x.scrollableAncestors,T=x.scrollableAncestorRects,I=x.windowRect,K=de(v,{transform:n.useContext(ve),activeNodeRect:D,overlayNodeRect:L.rect,draggingNodeRect:L.rect,containerNodeRect:C,scrollableAncestors:N,scrollableAncestorRects:T,windowRect:I}),A=function(e,t,r){var o=n.useRef(t);return a.useLazyMemo((function(n){var a=o.current;if(t!==a){if(t&&a&&(a.left!==t.left||a.top!==t.top)&&!n){var i=null==r?void 0:r.getBoundingClientRect();if(i)return f({},e,{x:i.left-t.left,y:i.top-t.top})}o.current=t}}),[t,e,r])}(K,E,L.nodeRef.current),k=null!==R,O=null!=A?A:K,j=i?O:f({},O,{scaleX:1,scaleY:1}),P=E?{position:"fixed",width:E.width,height:E.height,top:E.top,left:E.left,zIndex:m,transform:a.CSS.Transform.toString(j),touchAction:"none",transformOrigin:i&&S?w(S,E):void 0,transition:A?void 0:"function"==typeof d?d(S):d}:void 0,U=k?{style:P,children:c,className:b,transform:j}:void 0,H=n.useRef(U),X=null!=U?U:H.current,Y=null!=X?X:{},z=Y.children,F=p(Y,["children","transform"]),q=n.useRef(R),W=function(e){var t=e.animate,r=e.adjustScale,o=e.activeId,i=e.draggableNodes,c=e.duration,l=e.easing,s=e.node,u=e.transform,d=n.useState(!1),v=d[0],p=d[1];return n.useEffect((function(){var e=!!u&&Boolean(Math.abs(u.x)||Math.abs(u.y));t&&o&&l&&c&&e?requestAnimationFrame((function(){var e,t=null==(e=i[o])?void 0:e.current;if(u&&s&&t&&null!==t.parentNode){var n=s.children.length>1?s:s.children[0];if(n){var d=n.getBoundingClientRect(),v=B(t),h={x:d.left-v.left,y:d.top-v.top};if(Math.abs(h.x)||Math.abs(h.y)){var g=a.CSS.Transform.toString(f({x:u.x-h.x,y:u.y-h.y},{scaleX:r?v.width*u.scaleX/d.width:1,scaleY:r?v.height*u.scaleY/d.height:1})),b=t.style.opacity;return t.style.opacity="0",void s.animate([{transform:a.CSS.Transform.toString(u)},{transform:g}],{easing:l,duration:c}).finished.then((function(){p(!0),t&&(t.style.opacity=b)}))}}}p(!0)})):t&&p(!0)}),[t,o,r,i,c,l,s,u]),a.useIsomorphicLayoutEffect((function(){v&&p(!1)}),[v]),v}({animate:Boolean(s&&q.current&&!R),adjustScale:i,activeId:q.current,draggableNodes:M,duration:null==s?void 0:s.duration,easing:null==s?void 0:s.easing,node:L.nodeRef.current,transform:null==(t=H.current)?void 0:t.transform}),_=Boolean(z&&(c||s&&!W));return n.useEffect((function(){q.current!==R&&(q.current=R),R&&H.current!==U&&(H.current=U)}),[R,U]),n.useEffect((function(){W&&(H.current=void 0)}),[W]),_?r.createElement(g,f({},F,{ref:L.setRef}),z):null}));exports.DndContext=pe,exports.DragOverlay=we,exports.KeyboardSensor=ee,exports.MouseSensor=le,exports.PointerSensor=ae,exports.TouchSensor=ue,exports.applyModifiers=de,exports.closestCenter=function(e,t){var n=R(t,t.left,t.top),r=e.map((function(e){return m(R(e[1]),n)})),o=s(r);return e[o]?e[o][0]:null},exports.closestCorners=function(e,t){var n=O(t,t.left,t.top),r=e.map((function(e){var t=e[1],r=O(t,k(t)?t.left:void 0,k(t)?t.top:void 0),o=n.reduce((function(e,t,n){return e+m(r[n],t)}),0);return Number((o/4).toFixed(4))})),o=s(r);return e[o]?e[o][0]:null},exports.defaultAnnouncements=l,exports.defaultCoordinates=y,exports.getBoundingClientRect=A,exports.getViewRect=B,exports.rectIntersection=j,exports.useDndContext=be,exports.useDraggable=function(e){var t=e.id,r=e.disabled,o=void 0!==r&&r,i=e.attributes,c=n.useContext(b),l=c.active,s=c.activeNodeRect,u=c.activatorEvent,d=c.ariaDescribedById,f=c.draggableNodes,v=c.droppableRects,p=c.activators,h=c.over,g=null!=i?i:{},y=g.role,m=void 0===y?"button":y,x=g.roleDescription,w=void 0===x?"draggable":x,R=g.tabIndex,E=void 0===R?0:R,D=Boolean(l===t),C=n.useContext(D?ve:ge),M=a.useNodeRef(),S=M[0],L=M[1],N=function(e,t){return n.useMemo((function(){return e.reduce((function(e,n){var r=n.handler;return e[n.eventName]=function(e){r(e,t)},e}),{})}),[e,t])}(p,t);return n.useEffect((function(){return f[t]=S,function(){delete f[t]}}),[f,t]),{active:l,activeNodeRect:s,activatorEvent:u,attributes:{role:m,tabIndex:E,"aria-pressed":!(!D||"button"!==m)||void 0,"aria-roledescription":w,"aria-describedby":d.draggable},droppableRects:v,isDragging:D,listeners:o?void 0:N,node:S,over:h,setNodeRef:L,transform:C}},exports.useDroppable=function(e){var r=e.data,o=void 0===r?ye:r,i=e.disabled,c=void 0!==i&&i,l=e.id,s=n.useContext(b),u=s.dispatch,d=s.over,f=n.useRef(null),v=a.useNodeRef(),p=v[0],h=v[1],g=n.useRef(o);return a.useIsomorphicLayoutEffect((function(){g.current!==o&&(g.current=o)}),[o]),a.useIsomorphicLayoutEffect((function(){return u({type:t.RegisterDroppable,element:{id:l,disabled:c,node:p,rect:f,data:g}}),function(){return u({type:t.UnregisterDroppable,id:l})}}),[l]),n.useEffect((function(){u({type:t.SetDroppableDisabled,id:l,disabled:c})}),[c]),{rect:f,isOver:(null==d?void 0:d.id)===l,node:p,over:d,setNodeRef:h}},exports.useSensor=function(e,t){return n.useMemo((function(){return{sensor:e,options:null!=t?t:{}}}),[e,t])},exports.useSensors=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return n.useMemo((function(){return[].concat(t).filter((function(e){return null!=e}))}),[].concat(t))}; | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t,n=require("react"),r=(e=n)&&"object"==typeof e&&"default"in e?e.default:e,o=require("react-dom"),a=require("@dnd-kit/utilities"),i=require("@dnd-kit/accessibility"),c={draggable:"\n To pick up a draggable item, press the space bar.\n While dragging, use the arrow keys to move the item.\n Press space again to drop the item in its new position, or press escape to cancel.\n "},l={onDragStart:function(e){return"Picked up draggable item "+e+"."},onDragOver:function(e,t){return t?"Draggable item "+e+" was moved over droppable area "+t+".":"Draggable item "+e+" is no longer over a droppable area."},onDragEnd:function(e,t){return t?"Draggable item "+e+" was dropped over droppable area "+t:"Draggable item "+e+" was dropped."},onDragCancel:function(e){return"Dragging was cancelled. Draggable item "+e+" was dropped."}};!function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"}(t||(t={}));var s=function(e){return u(e,(function(e,t){return e<t}))};function u(e,t){if(0===e.length)return-1;for(var n=e[0],r=0,o=1;o<e.length;o++)t(e[o],n)&&(r=o,n=e[o]);return r}function d(){}function f(){return(f=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function v(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}function p(e,t){if(null==e)return{};var n,r,o={},a=Object.keys(e);for(r=0;r<a.length;r++)t.indexOf(n=a[r])>=0||(o[n]=e[n]);return o}function h(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function g(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}var b=n.createContext({activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,activeNodeClientRect:null,activators:[],ariaDescribedById:{draggable:""},overlayNode:{nodeRef:{current:null},rect:null,setRef:d},containerNodeRect:null,dispatch:d,draggableNodes:{},droppableRects:new Map,droppableContainers:{},over:null,scrollableAncestors:[],scrollableAncestorRects:[],recomputeLayouts:d,windowRect:null,willRecomputeLayouts:!1}),y=Object.freeze({x:0,y:0});function m(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function x(e){if(function(e){var t;return(null==(t=window)?void 0:t.TouchEvent)&&e instanceof TouchEvent}(e)){if(e.touches&&e.touches.length){var t=e.touches[0];return{x:t.clientX,y:t.clientY}}if(e.changedTouches&&e.changedTouches.length){var n=e.changedTouches[0];return{x:n.clientX,y:n.clientY}}}return function(e){var t;return(null==(t=window)?void 0:t.MouseEvent)&&e instanceof MouseEvent||e.type.includes("mouse")}(e)?{x:e.clientX,y:e.clientY}:{x:0,y:0}}function w(e,t){if(e instanceof KeyboardEvent)return"0 0";var n=x(e);return(n.x-t.left)/t.width*100+"% "+(n.y-t.top)/t.height*100+"%"}function R(e,t,n){return void 0===t&&(t=e.offsetLeft),void 0===n&&(n=e.offsetTop),{x:t+.5*e.width,y:n+.5*e.height}}function E(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return r.reduce((function(t,n){return f({},t,{top:t.top+e*n.y,bottom:t.bottom+e*n.y,left:t.left+e*n.x,right:t.right+e*n.x,offsetLeft:t.offsetLeft+e*n.x,offsetTop:t.offsetTop+e*n.y})}),f({},t))}}var D,C=E(1);function M(e){var t=[];return e?function e(n){return n?n instanceof Document&&null!=n.scrollingElement?(t.push(n.scrollingElement),t):!(n instanceof HTMLElement)||n instanceof SVGElement?t:(function(e){var t=window.getComputedStyle(e),n=/(auto|scroll)/;return null!=["overflow","overflowX","overflowY"].find((function(e){var r=t[e];return"string"==typeof r&&n.test(r)}))}(n)&&t.push(n),e(n.parentNode)):t}(e.parentNode):t}function S(e){return a.canUseDOM?e===document.scrollingElement||e instanceof Document?window:e instanceof HTMLElement?e:null:null}function L(e){return e instanceof Window?{x:e.scrollX,y:e.scrollY}:{x:e.scrollLeft,y:e.scrollTop}}function N(e){var t=function(e){if(e===document.scrollingElement){var t=window,n=t.innerWidth,r=t.innerHeight;return{top:0,left:0,right:n,bottom:r,width:n,height:r}}return e.getBoundingClientRect()}(e),n={x:0,y:0},r={x:e.scrollWidth-t.width,y:e.scrollHeight-t.height};return{isTop:e.scrollTop<=n.y,isLeft:e.scrollLeft<=n.x,isBottom:e.scrollTop>=r.y,isRight:e.scrollLeft>=r.x,scrollElementRect:t,maxScroll:r,minScroll:n}}function T(e,t,n,r){void 0===r&&(r=10);var o,i=(o=e,a.canUseDOM&&o&&o===document.scrollingElement?{top:0,left:0,right:e.clientWidth,bottom:e.clientHeight}:t),c=N(e),l=c.isBottom,s=c.isLeft,u=c.isRight,d=n.width,f=n.height,v=n.left,p=n.top,h=n.bottom,g=n.right,b={x:0,y:0},y={x:0,y:0};return!c.isTop&&p<=i.top+f?(b.y=D.Backward,y.y=r*Math.abs((p-f-i.top)/f)):!l&&h>=i.bottom-f&&(b.y=D.Forward,y.y=r*Math.abs((i.bottom-f-h)/f)),!u&&g>=i.right-d?(b.x=D.Forward,y.x=r*Math.abs((i.right-d-g)/d)):!s&&v<=i.left+d&&(b.x=D.Backward,y.x=r*Math.abs((v-d-i.left)/d)),{direction:b,speed:y}}function I(e){return e.reduce((function(e,t){return a.add(e,L(t))}),y)}function K(e){var t=e.offsetWidth,n=e.offsetHeight,r=function e(t,n,r){if(void 0===r&&(r=y),!(t&&t instanceof HTMLElement))return r;var o={x:r.x+t.offsetLeft,y:r.y+t.offsetTop};return t.offsetParent===n?o:e(t.offsetParent,n,o)}(e,null);return{width:t,height:n,offsetTop:r.y,offsetLeft:r.x}}function A(e){if(e instanceof Window){var t=window.innerWidth,n=window.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n,offsetTop:0,offsetLeft:0}}var r=K(e),o=r.offsetTop,a=r.offsetLeft,i=e.getBoundingClientRect();return{width:i.width,height:i.height,top:i.top,bottom:i.bottom,right:i.right,left:i.left,offsetTop:o,offsetLeft:a}}function B(e){var t=K(e),n=t.width,r=t.height,o=t.offsetTop,a=t.offsetLeft,i=I(M(e)),c=o-i.y,l=a-i.x;return{width:n,height:r,top:c,bottom:c+r,right:l+n,left:l,offsetTop:o,offsetLeft:a}}function k(e){return"top"in e}function O(e,t,n){return void 0===t&&(t=e.offsetLeft),void 0===n&&(n=e.offsetTop),[{x:t,y:n},{x:t+e.width,y:n},{x:t,y:n+e.height},{x:t+e.width,y:n+e.height}]}!function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"}(D||(D={}));var j=function(e,t){var n=e.map((function(e){return function(e,t){var n=Math.max(t.top,e.offsetTop),r=Math.max(t.left,e.offsetLeft),o=Math.min(t.left+t.width,e.offsetLeft+e.width),a=Math.min(t.top+t.height,e.offsetTop+e.height);if(r<o&&n<a){var i=(o-r)*(a-n);return Number((i/(t.width*t.height+e.width*e.height-i)).toFixed(4))}return 0}(e[1],t)})),r=u(n,(function(e,t){return e>t}));return n[r]<=0?null:e[r]?e[r][0]:null};function P(e){return e instanceof HTMLElement?e.ownerDocument:document}function U(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},lastEvent:null,nodes:{},translate:{x:0,y:0}},droppable:{containers:{}}}}function H(e,n){switch(n.type){case t.DragStart:return f({},e,{draggable:f({},e.draggable,{initialCoordinates:n.initialCoordinates,active:n.active,lastEvent:t.DragStart})});case t.DragMove:return e.draggable.active?f({},e,{draggable:f({},e.draggable,{translate:{x:n.coordinates.x-e.draggable.initialCoordinates.x,y:n.coordinates.y-e.draggable.initialCoordinates.y}})}):e;case t.DragEnd:case t.DragCancel:return f({},e,{draggable:f({},e.draggable,{active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0},lastEvent:n.type})});case t.RegisterDroppable:var r,o=n.element;return f({},e,{droppable:f({},e.droppable,{containers:f({},e.droppable.containers,(r={},r[o.id]=o,r))})});case t.SetDroppableDisabled:var a,i=n.id,c=e.droppable.containers[i];return c?f({},e,{droppable:f({},e.droppable,{containers:f({},e.droppable.containers,(a={},a[i]=f({},c,{disabled:n.disabled}),a))})}):e;case t.UnregisterDroppable:return f({},e,{droppable:f({},e.droppable,{containers:(l=n.id,s=e.droppable.containers,p(s,[l].map(g)))})});default:return e}var l,s}function X(e){var c=e.announcements,s=void 0===c?l:c,u=e.activeId,d=e.overId,f=e.lastEvent,v=e.hiddenTextDescribedById,p=e.screenReaderInstructions,h=i.useAnnouncement(),g=h.announce,b=h.entries,y=n.useRef({activeId:u,overId:d}),m=a.useUniqueId("DndLiveRegion");return n.useEffect((function(){var e,n=y.current,r=n.activeId,o=n.overId;!r&&u?e=s.onDragStart(u):!u&&r?f===t.DragEnd?e=s.onDragEnd(r,null!=o?o:void 0):f===t.DragCancel&&(e=s.onDragCancel(r)):u&&r&&d!==o&&(e=s.onDragOver(u,null!=d?d:void 0)),e&&g(e),y.current.overId===d&&y.current.activeId===u||(y.current={activeId:u,overId:d})}),[s,g,u,d,f]),a.canUseDOM?o.createPortal(r.createElement(r.Fragment,null,r.createElement(i.HiddenText,{id:v,value:p.draggable}),r.createElement(i.LiveRegion,{id:m,entries:b})),document.body):null}var Y=new Map,z=[],F=_(A),q=V(A),W=_(B);function _(e){return function(t,r){var o=n.useRef(t);return a.useLazyMemo((function(n){return t?r||!n&&t||t!==o.current?t instanceof HTMLElement&&null==t.parentNode?null:e(t):null!=n?n:null:null}),[t,r])}}function V(e){var t=[];return function(r,o){var i=n.useRef(r);return a.useLazyMemo((function(n){return r.length?o||!n&&r.length||r!==i.current?r.map((function(t){return e(t)})):null!=n?n:t:t}),[r,o])}}var G,$=function(){function e(e){this.target=e,this.listeners=[]}var t=e.prototype;return t.add=function(e,t,n){this.target.addEventListener(e,t,n),this.listeners.push({eventName:e,handler:t})},t.removeAll=function(){var e=this;this.listeners.forEach((function(t){return e.target.removeEventListener(t.eventName,t.handler)}))},e}();(G=exports.KeyboardCode||(exports.KeyboardCode={})).Space="Space",G.Down="ArrowDown",G.Right="ArrowRight",G.Left="ArrowLeft",G.Up="ArrowUp",G.Esc="Escape",G.Enter="Enter";var J,Q={start:[exports.KeyboardCode.Space,exports.KeyboardCode.Enter],cancel:[exports.KeyboardCode.Esc],end:[exports.KeyboardCode.Space,exports.KeyboardCode.Enter]},Z=function(e,t){var n=t.currentCoordinates;switch(e.code){case exports.KeyboardCode.Right:return f({},n,{x:n.x+25});case exports.KeyboardCode.Left:return f({},n,{x:n.x-25});case exports.KeyboardCode.Down:return f({},n,{y:n.y+25});case exports.KeyboardCode.Up:return f({},n,{y:n.y-25})}},ee=function(){function e(e){this.props=e,this.autoScrollEnabled=!1,this.coordinates=y;var t=e.event.target;this.props=e,this.listeners=new $(P(t)),this.handleKeyDown=this.handleKeyDown.bind(this),this.attach()}var t=e.prototype;return t.attach=function(){var e=this;this.handleStart(),setTimeout((function(){return e.listeners.add("keydown",e.handleKeyDown)}))},t.handleStart=function(){var e=this.props,t=e.activeNode,n=e.onStart;if(!t.current)throw new Error("Active draggable node is undefined");var r=A(t.current),o={x:r.left,y:r.top};this.coordinates=o,n(o)},t.handleKeyDown=function(e){if(e instanceof KeyboardEvent){var t=this.coordinates,n=this.props,r=n.active,o=n.context,i=n.options,c=i.keyboardCodes,l=void 0===c?Q:c,s=i.coordinateGetter,u=void 0===s?Z:s,d=i.scrollBehavior,f=void 0===d?"smooth":d,v=e.code;if(l.end.includes(v))return void this.handleEnd(e);if(l.cancel.includes(v))return void this.handleCancel(e);var p=u(e,{active:r,context:o.current,currentCoordinates:t});if(p){var h={x:0,y:0},g=o.current.scrollableAncestors[0];if(g){var b=e.code,y=a.subtract(p,t),m=N(g),x=m.isTop,w=m.isRight,R=m.isLeft,E=m.isBottom,D=m.scrollElementRect,C=m.maxScroll,M=m.minScroll,S={x:Math.min(b===exports.KeyboardCode.Right?D.right-D.width/2:D.right,Math.max(b===exports.KeyboardCode.Right?D.left:D.left+D.width/2,p.x)),y:Math.min(b===exports.KeyboardCode.Down?D.bottom-D.height/2:D.bottom,Math.max(b===exports.KeyboardCode.Down?D.top:D.top+D.height/2,p.y))},L=b===exports.KeyboardCode.Right&&!w||b===exports.KeyboardCode.Left&&!R,T=b===exports.KeyboardCode.Down&&!E||b===exports.KeyboardCode.Up&&!x;if(L&&S.x!==p.x){if(b===exports.KeyboardCode.Right&&g.scrollLeft+y.x<=C.x||b===exports.KeyboardCode.Left&&g.scrollLeft+y.x>=M.x)return void g.scrollBy({left:y.x,behavior:f});h.x=b===exports.KeyboardCode.Right?g.scrollLeft-C.x:g.scrollLeft-M.x,g.scrollBy({left:-h.x,behavior:f})}else if(T&&S.y!==p.y){if(b===exports.KeyboardCode.Down&&g.scrollTop+y.y<=C.y||b===exports.KeyboardCode.Up&&g.scrollTop+y.y>=M.y)return void g.scrollBy({top:y.y,behavior:f});h.y=b===exports.KeyboardCode.Down?g.scrollTop-C.y:g.scrollTop-M.y,g.scrollBy({top:-h.y,behavior:f})}}this.handleMove(e,a.add(p,h))}}},t.handleMove=function(e,t){var n=this.props.onMove;e.preventDefault(),n(t),this.coordinates=t},t.handleEnd=function(e){var t=this.props.onEnd;e.preventDefault(),this.detach(),t()},t.handleCancel=function(e){var t=this.props.onCancel;e.preventDefault(),this.detach(),t()},t.detach=function(){this.listeners.removeAll()},e}();function te(e){return Boolean(e&&"distance"in e)}function ne(e){return Boolean(e&&"delay"in e)}ee.activators=[{eventName:"onKeyDown",handler:function(e,t){var n=t.keyboardCodes;return!!(void 0===n?Q:n).start.includes(e.nativeEvent.code)&&(e.preventDefault(),!0)}}],function(e){e.Keydown="keydown"}(J||(J={}));var re=function(){function e(e,t,n){var r;void 0===n&&(n=(r=e.event.target)instanceof HTMLElement?r:P(r)),this.props=e,this.events=t,this.autoScrollEnabled=!0,this.activated=!1,this.timeoutId=null;var o=e.event;this.props=e,this.events=t,this.ownerDocument=P(o.target),this.listeners=new $(n),this.initialCoordinates=x(o),this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.attach()}var t=e.prototype;return t.attach=function(){var e=this.events,t=this.props.options.activationConstraint;if(this.listeners.add(e.move.name,this.handleMove,!1),this.listeners.add(e.end.name,this.handleEnd),this.ownerDocument.addEventListener(J.Keydown,this.handleKeydown),t){if(te(t))return;if(ne(t))return void(this.timeoutId=setTimeout(this.handleStart,t.delay))}this.handleStart()},t.detach=function(){this.listeners.removeAll(),this.ownerDocument.removeEventListener(J.Keydown,this.handleKeydown),null!==this.timeoutId&&(clearTimeout(this.timeoutId),this.timeoutId=null)},t.handleStart=function(){var e=this.initialCoordinates,t=this.props.onStart;e&&(this.activated=!0,t(e))},t.handleMove=function(e){var t=this.activated,n=this.initialCoordinates,r=this.props,o=r.onMove,i=r.options.activationConstraint;if(n){var c=x(e),l=a.subtract(n,c),s=Math.abs(l.x)+Math.abs(l.y);if(!t&&i){if(ne(i))return s>=i.tolerance?this.handleCancel():void 0;if(te(i))return s>=i.distance?this.handleStart():void 0}e.cancelable&&e.preventDefault(),o(c)}},t.handleEnd=function(){var e=this.props.onEnd;this.detach(),e()},t.handleCancel=function(){var e=this.props.onCancel;this.detach(),e()},t.handleKeydown=function(e){e.code===exports.KeyboardCode.Esc&&this.handleCancel()},e}(),oe={move:{name:"pointermove"},end:{name:"pointerup"}},ae=function(e){function t(t){var n=P(t.event.target);return e.call(this,t,oe,n)||this}return v(t,e),t}(re);ae.activators=[{eventName:"onPointerDown",handler:function(e){var t=e.nativeEvent;return!(!t.isPrimary||0!==t.button||(t.preventDefault(),0))}}];var ie,ce={move:{name:"mousemove"},end:{name:"mouseup"}};!function(e){e[e.RightClick=2]="RightClick"}(ie||(ie={}));var le=function(e){function t(t){return e.call(this,t,ce,P(t.event.target))||this}return v(t,e),t}(re);le.activators=[{eventName:"onMouseDown",handler:function(e){var t=e.nativeEvent;return t.button!==ie.RightClick&&(t.preventDefault(),!0)}}];var se={move:{name:"touchmove"},end:{name:"touchend"}},ue=function(e){function t(t){return e.call(this,t,se)||this}return v(t,e),t}(re);function de(e,t){var n=t.transform,r=p(t,["transform"]);return(null==e?void 0:e.length)?e.reduce((function(e,t){return t(f({transform:e},r))}),n):n}ue.activators=[{eventName:"onTouchStart",handler:function(e){var t=e.nativeEvent;return!(t.touches.length>1||(t.cancelable&&t.preventDefault(),0))}}];var fe=[{sensor:ae,options:{}},{sensor:ee,options:{}}],ve=n.createContext(f({},y,{scaleX:1,scaleY:1})),pe=n.memo((function(e){var o,i,l,s,u,d=e.autoScroll,v=void 0===d||d,g=e.announcements,m=e.children,x=e.sensors,w=void 0===x?fe:x,R=e.collisionDetection,E=void 0===R?j:R,D=e.screenReaderInstructions,N=void 0===D?c:D,A=e.modifiers,B=p(e,["autoScroll","announcements","children","sensors","collisionDetection","screenReaderInstructions","modifiers"]),k=n.useReducer(H,void 0,U),O=k[0],P=k[1],_=O.draggable,V=_.active,G=_.lastEvent,$=_.nodes,J=_.translate,Q=O.droppable.containers,Z=n.useRef(null),ee=n.useState(null),te=ee[0],ne=ee[1],re=n.useState(null),oe=re[0],ae=re[1],ie=n.useRef(B),ce=a.useUniqueId("DndDescribedBy"),le=function(e,t){var r=n.useState(!1),o=r[0],i=r[1],c=n.useRef(e),l=n.useCallback((function(){i(!0)}),[]),s=a.useLazyMemo((function(n){if(t)return Y;if(!n||n===Y||c.current!==e||o){for(var r=0,a=Object.values(e);r<a.length;r++){var i=a[r];i&&(i.rect.current=i.node.current?K(i.node.current):null)}return function(e){var t=new Map;if(e)for(var n=0,r=Object.values(e);n<r.length;n++){var o=r[n];if(o){var a=o.rect;o.disabled||null==a.current||t.set(o.id,a.current)}}return t}(e)}return n}),[e,t,o]);return n.useEffect((function(){c.current=e}),[e]),n.useEffect((function(){o&&i(!1)}),[o]),{layoutRectMap:s,recomputeLayouts:l,willRecomputeLayouts:o}}(Q,null===V),se=le.layoutRectMap,ue=le.recomputeLayouts,pe=le.willRecomputeLayouts,ge=function(e,t){return a.useLazyMemo((function(n){var r,o;return null===t?null:null!=(r=null!=(o=null==e?void 0:e.current)?o:n)?r:null}),[e,t])}(function(e,t){var n;return e&&null!=(n=t[e])?n:null}(V,$),V),be=W(ge),ye=F(ge),me=n.useRef(null),xe=(i=me.current,(o=be)&&i?{x:o.left-i.left,y:o.top-i.top}:y),we=n.useRef({active:V,droppableRects:se,overId:null,scrollAdjustedTransalte:y,translatedRect:null}),Re=function(e,t){var n,r;return e&&null!=(n=null==(r=t[e])?void 0:r.node.current)?n:null}(we.current.overId,Q),Ee=F(ge?ge.ownerDocument.defaultView:null),De=F(ge?ge.parentElement:null),Ce=(s=n.useRef(l=V?null!=Re?Re:ge:null),u=a.useLazyMemo((function(e){return l?e&&l&&s.current&&l.parentNode===s.current.parentNode?e:M(l):z}),[l]),n.useEffect((function(){s.current=l}),[l]),u),Me=q(Ce),Se=a.useNodeRef(),Le=Se[0],Ne=Se[1],Te=F(V?Le.current:null,pe),Ie=de(A,{transform:{x:J.x-xe.x,y:J.y-xe.y,scaleX:1,scaleY:1},activeNodeRect:ye,draggingNodeRect:null!=Te?Te:ye,containerNodeRect:De,overlayNodeRect:Te,scrollableAncestors:Ce,scrollableAncestorRects:Me,windowRect:Ee}),Ke=function(e){var t=n.useState(null),r=t[0],o=t[1],i=n.useRef(e),c=n.useCallback((function(e){var t=S(e.target);t&&o((function(e){return e?(e.set(t,L(t)),new Map(e)):null}))}),[]);return n.useEffect((function(){var t=i.current;if(e!==t){r(t);var n=e.map((function(e){var t=S(e);return t?(t.addEventListener("scroll",c,{passive:!0}),[t,L(t)]):null})).filter((function(e){return null!=e}));o(n.length?new Map(n):null),i.current=e}return function(){r(e),r(t)};function r(e){e.forEach((function(e){var t=S(e);null==t||t.removeEventListener("scroll",c)}))}}),[c,e]),n.useMemo((function(){return e.length?r?Array.from(r.values()).reduce((function(e,t){return a.add(e,t)}),y):I(e):y}),[e,r])}(Ce),Ae=a.add(Ie,Ke),Be=be?C(be,Ie):null,ke=Be?C(Be,Ke):null,Oe=V&&ke?E(Array.from(se.entries()),ke):null,je=he(Oe,se),Pe=n.useMemo((function(){return Oe&&je?{id:Oe,rect:je}:null}),[Oe,je]),Ue=function(e,t,n){return f({},e,{scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1})}(Ie,je,be),He=n.useRef({activeNode:ge,collisionRect:ke,droppableRects:se,droppableContainers:Q,over:Pe,scrollableAncestors:Ce,translatedRect:Be}),Xe=n.useCallback((function(e,n){if(Z.current){var r=$[Z.current];if(r){var o=new(0,n.sensor)({active:Z.current,activeNode:r,event:e.nativeEvent,options:n.options,context:He,onStart:function(e){var n=Z.current;if(n){var r=ie.current.onDragStart;P({type:t.DragStart,initialCoordinates:e,active:n}),null==r||r({active:{id:n}})}},onMove:function(e){P({type:t.DragMove,coordinates:e})},onEnd:a(t.DragEnd),onCancel:a(t.DragCancel)});ne(o),ae(e.nativeEvent)}}function a(e){return function(){var n=we.current,r=n.overId,o=n.scrollAdjustedTransalte,a=ie.current,i=Z.current;i&&(Z.current=null),P({type:e}),ne(null),ae(null);var c=e===t.DragEnd?a.onDragEnd:a.onDragCancel;i&&(null==c||c({active:{id:i},delta:o,over:r?{id:r}:null}))}}}),[P,$]),Ye=function(e,t){return n.useMemo((function(){return e.reduce((function(e,n){var r=n.sensor.activators.map((function(e){return{eventName:e.eventName,handler:t(e.handler,n)}}));return[].concat(e,r)}),[])}),[e,t])}(w,n.useCallback((function(e,t){return function(n,r){var o=n.nativeEvent;null!==Z.current||o.dndKit||o.defaultPrevented||!0===e(n,t.options)&&(o.dndKit={capturedBy:t.sensor},Z.current=r,Xe(n,t))}}),[Xe]));a.useIsomorphicLayoutEffect((function(){ie.current=B}),Object.values(B)),a.useIsomorphicLayoutEffect((function(){V&&ue()}),[V,ue]),n.useEffect((function(){V||(me.current=null),V&&be&&!me.current&&(me.current=be)}),[be,V]),n.useEffect((function(){var e=Z.current;if(e){var t=ie.current.onDragMove,n=we.current,r=n.overId,o=n.droppableRects,a=n.translatedRect;if(t&&a){var i=he(r,o);t({active:{id:e},draggingRect:a,droppableRects:o,delta:{x:Ae.x,y:Ae.y},over:r&&i?{id:r,rect:i}:null})}}}),[Ae.x,Ae.y]),n.useEffect((function(){if(Z.current){var e=we.current,t=e.active,n=e.translatedRect;if(t&&n){var r=ie.current.onDragOver,o=he(Oe,e.droppableRects);null==r||r({active:{id:t},droppableRects:we.current.droppableRects,draggingRect:n,over:Oe&&o?{id:Oe,rect:o}:null})}}}),[Oe]),n.useEffect((function(){we.current={active:V,droppableRects:se,overId:Oe,translatedRect:Be,scrollAdjustedTransalte:Ae}}),[V,se,Oe,Be,Ae]),a.useIsomorphicLayoutEffect((function(){He.current={activeNode:ge,collisionRect:ke,droppableRects:se,droppableContainers:Q,over:Pe,scrollableAncestors:Ce,translatedRect:Be}}),[ge,ke,se,Q,Pe,Ce,Be]),function(e){var t=e.disabled,r=e.draggingRect,o=e.interval,i=void 0===o?5:o,c=e.scrollableAncestors,l=e.scrollableAncestorRects,s=a.useInterval(),u=s[0],d=s[1],f=n.useRef({x:1,y:1}),v=n.useRef(y),p=n.useRef(null),g=n.useCallback((function(){var e=p.current;e&&e.scrollBy(f.current.x*v.current.x,f.current.y*v.current.y)}),[]);n.useEffect((function(){if(!t&&c.length&&r)for(var e,n=function(e,t){var n;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return h(e,void 0);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?h(e,void 0):void 0}}(e))){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(n=e[Symbol.iterator]()).next.bind(n)}(c);!(e=n()).done;){var o=e.value,a=c.indexOf(o),s=l[a];if(s){var b=T(o,s,r),y=b.direction,m=b.speed;if(f.current=m,v.current=y,d(),m.x>0||m.y>0){p.current=o,u(g,i);break}}}else d()}),[g,r,d,t,u,c,l,i])}({draggingRect:Be,disabled:!v||!(null==te?void 0:te.autoScrollEnabled),scrollableAncestors:Ce,scrollableAncestorRects:Me});var ze=n.useMemo((function(){return{active:V,activeNode:ge,activeNodeRect:be,activeNodeClientRect:ye,activatorEvent:oe,activators:Ye,ariaDescribedById:{draggable:ce},overlayNode:{nodeRef:Le,rect:Te,setRef:Ne},containerNodeRect:De,dispatch:P,draggableNodes:$,droppableContainers:Q,droppableRects:se,over:Pe,recomputeLayouts:ue,scrollableAncestors:Ce,scrollableAncestorRects:Me,willRecomputeLayouts:pe,windowRect:Ee}}),[V,ge,ye,be,oe,Ye,De,Te,Le,P,$,ce,Q,se,Pe,ue,Ce,Me,Ne,pe,Ee]);return r.createElement(r.Fragment,null,r.createElement(b.Provider,{value:ze},r.createElement(ve.Provider,{value:Ue},m)),r.createElement(X,{announcements:g,activeId:V,overId:Oe,lastEvent:G,hiddenTextDescribedById:ce,screenReaderInstructions:N}))}));function he(e,t){var n;return e&&null!=(n=t.get(e))?n:null}var ge=n.createContext(null);function be(){return n.useContext(b)}var ye={},me=function(e){return e instanceof KeyboardEvent?"transform 250ms ease":void 0},xe={duration:250,easing:"ease"},we=r.memo((function(e){var t,o=e.adjustScale,i=void 0!==o&&o,c=e.children,l=e.dropAnimation,s=void 0===l?xe:l,u=e.transition,d=void 0===u?me:u,v=e.modifiers,h=e.wrapperElement,g=void 0===h?"div":h,b=e.className,y=e.zIndex,m=void 0===y?999:y,x=be(),R=x.active,E=x.activeNodeRect,D=x.activeNodeClientRect,C=x.containerNodeRect,M=x.draggableNodes,S=x.activatorEvent,L=x.overlayNode,N=x.scrollableAncestors,T=x.scrollableAncestorRects,I=x.windowRect,K=de(v,{transform:n.useContext(ve),activeNodeRect:D,overlayNodeRect:L.rect,draggingNodeRect:L.rect,containerNodeRect:C,scrollableAncestors:N,scrollableAncestorRects:T,windowRect:I}),A=function(e,t,r){var o=n.useRef(t);return a.useLazyMemo((function(n){var a=o.current;if(t!==a){if(t&&a&&(a.left!==t.left||a.top!==t.top)&&!n){var i=null==r?void 0:r.getBoundingClientRect();if(i)return f({},e,{x:i.left-t.left,y:i.top-t.top})}o.current=t}}),[t,e,r])}(K,E,L.nodeRef.current),k=null!==R,O=null!=A?A:K,j=i?O:f({},O,{scaleX:1,scaleY:1}),P=E?{position:"fixed",width:E.width,height:E.height,top:E.top,left:E.left,zIndex:m,transform:a.CSS.Transform.toString(j),touchAction:"none",transformOrigin:i&&S?w(S,E):void 0,transition:A?void 0:"function"==typeof d?d(S):d}:void 0,U=k?{style:P,children:c,className:b,transform:j}:void 0,H=n.useRef(U),X=null!=U?U:H.current,Y=null!=X?X:{},z=Y.children,F=p(Y,["children","transform"]),q=n.useRef(R),W=function(e){var t=e.animate,r=e.adjustScale,o=e.activeId,i=e.draggableNodes,c=e.duration,l=e.easing,s=e.node,u=e.transform,d=n.useState(!1),v=d[0],p=d[1];return n.useEffect((function(){var e=!!u&&Boolean(Math.abs(u.x)||Math.abs(u.y));t&&o&&l&&c&&e?requestAnimationFrame((function(){var e,t=null==(e=i[o])?void 0:e.current;if(u&&s&&t&&null!==t.parentNode){var n=s.children.length>1?s:s.children[0];if(n){var d=n.getBoundingClientRect(),v=B(t),h={x:d.left-v.left,y:d.top-v.top};if(Math.abs(h.x)||Math.abs(h.y)){var g=a.CSS.Transform.toString(f({x:u.x-h.x,y:u.y-h.y},{scaleX:r?v.width*u.scaleX/d.width:1,scaleY:r?v.height*u.scaleY/d.height:1})),b=t.style.opacity;return t.style.opacity="0",void s.animate([{transform:a.CSS.Transform.toString(u)},{transform:g}],{easing:l,duration:c}).finished.then((function(){p(!0),t&&(t.style.opacity=b)}))}}}p(!0)})):t&&p(!0)}),[t,o,r,i,c,l,s,u]),a.useIsomorphicLayoutEffect((function(){v&&p(!1)}),[v]),v}({animate:Boolean(s&&q.current&&!R),adjustScale:i,activeId:q.current,draggableNodes:M,duration:null==s?void 0:s.duration,easing:null==s?void 0:s.easing,node:L.nodeRef.current,transform:null==(t=H.current)?void 0:t.transform}),_=Boolean(z&&(c||s&&!W));return n.useEffect((function(){q.current!==R&&(q.current=R),R&&H.current!==U&&(H.current=U)}),[R,U]),n.useEffect((function(){W&&(H.current=void 0)}),[W]),_?r.createElement(g,f({},F,{ref:L.setRef}),z):null}));exports.DndContext=pe,exports.DragOverlay=we,exports.KeyboardSensor=ee,exports.MouseSensor=le,exports.PointerSensor=ae,exports.TouchSensor=ue,exports.applyModifiers=de,exports.closestCenter=function(e,t){var n=R(t,t.left,t.top),r=e.map((function(e){return m(R(e[1]),n)})),o=s(r);return e[o]?e[o][0]:null},exports.closestCorners=function(e,t){var n=O(t,t.left,t.top),r=e.map((function(e){var t=e[1],r=O(t,k(t)?t.left:void 0,k(t)?t.top:void 0),o=n.reduce((function(e,t,n){return e+m(r[n],t)}),0);return Number((o/4).toFixed(4))})),o=s(r);return e[o]?e[o][0]:null},exports.defaultAnnouncements=l,exports.defaultCoordinates=y,exports.getBoundingClientRect=A,exports.getViewRect=B,exports.rectIntersection=j,exports.useDndContext=be,exports.useDraggable=function(e){var t=e.id,r=e.disabled,o=void 0!==r&&r,i=e.attributes,c=n.useContext(b),l=c.active,s=c.activeNodeRect,u=c.activatorEvent,d=c.ariaDescribedById,f=c.draggableNodes,v=c.droppableRects,p=c.activators,h=c.over,g=null!=i?i:{},y=g.role,m=void 0===y?"button":y,x=g.roleDescription,w=void 0===x?"draggable":x,R=g.tabIndex,E=void 0===R?0:R,D=Boolean(l===t),C=n.useContext(D?ve:ge),M=a.useNodeRef(),S=M[0],L=M[1],N=function(e,t){return n.useMemo((function(){return e.reduce((function(e,n){var r=n.handler;return e[n.eventName]=function(e){r(e,t)},e}),{})}),[e,t])}(p,t);return n.useEffect((function(){return f[t]=S,function(){delete f[t]}}),[f,t]),{active:l,activeNodeRect:s,activatorEvent:u,attributes:{role:m,tabIndex:E,"aria-pressed":!(!D||"button"!==m)||void 0,"aria-roledescription":w,"aria-describedby":d.draggable},droppableRects:v,isDragging:D,listeners:o?void 0:N,node:S,over:h,setNodeRef:L,transform:C}},exports.useDroppable=function(e){var r=e.data,o=void 0===r?ye:r,i=e.disabled,c=void 0!==i&&i,l=e.id,s=n.useContext(b),u=s.dispatch,d=s.over,f=n.useRef(null),v=a.useNodeRef(),p=v[0],h=v[1],g=n.useRef(o);return a.useIsomorphicLayoutEffect((function(){g.current!==o&&(g.current=o)}),[o]),a.useIsomorphicLayoutEffect((function(){return u({type:t.RegisterDroppable,element:{id:l,disabled:c,node:p,rect:f,data:g}}),function(){return u({type:t.UnregisterDroppable,id:l})}}),[l]),n.useEffect((function(){u({type:t.SetDroppableDisabled,id:l,disabled:c})}),[c]),{rect:f,isOver:(null==d?void 0:d.id)===l,node:p,over:d,setNodeRef:h}},exports.useSensor=function(e,t){return n.useMemo((function(){return{sensor:e,options:null!=t?t:{}}}),[e,t])},exports.useSensors=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return n.useMemo((function(){return[].concat(t).filter((function(e){return null!=e}))}),[].concat(t))}; | ||
//# sourceMappingURL=core.cjs.production.min.js.map |
export { Action } from './actions'; | ||
export { Context } from './context'; | ||
export { reducer, initialState } from './reducer'; | ||
export { reducer, getInitialState } from './reducer'; | ||
export type { Data, DraggableElement, DraggableNode, DraggableNodes, DroppableContainer, DroppableContainers, DndContextDescriptor, LayoutRectMap, State, } from './types'; |
import { Actions } from './actions'; | ||
import type { State } from './types'; | ||
export declare const initialState: State; | ||
export declare function getInitialState(): State; | ||
export declare function reducer(state: State, action: Actions): State; |
{ | ||
"name": "@dnd-kit/core", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "dnd kit – a lightweight React library for building performant and accessible drag and drop experiences", | ||
@@ -8,3 +8,3 @@ "author": "Claudéric Demers", | ||
"type": "git", | ||
"url": "git+https://github.com/claudric/dnd-kit.git", | ||
"url": "git+https://github.com/clauderic/dnd-kit.git", | ||
"directory": "packages/core" | ||
@@ -33,4 +33,4 @@ }, | ||
"tslib": "^2.0.0", | ||
"@dnd-kit/accessibility": "^1.0.0", | ||
"@dnd-kit/utilities": "^1.0.0" | ||
"@dnd-kit/accessibility": "^1.0.1", | ||
"@dnd-kit/utilities": "^1.0.1" | ||
}, | ||
@@ -37,0 +37,0 @@ "publishConfig": { |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
660809
5215
Updated@dnd-kit/utilities@^1.0.1