Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@dnd-kit/core

Package Overview
Dependencies
Maintainers
1
Versions
129
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@dnd-kit/core - npm Package Compare versions

Comparing version 5.0.0-next-20220101438 to 5.0.0-next-202201015122

4

CHANGELOG.md
# @dnd-kit/core
## 5.0.0-next-20220101438
## 5.0.0-next-202201015122

@@ -131,3 +131,3 @@ ### Major Changes

- Updated dependencies [[`6310227`](https://github.com/clauderic/dnd-kit/commit/63102272d0d63dae349e2e9f638277e16a7d5970), [`528c67e`](https://github.com/clauderic/dnd-kit/commit/528c67e4c617dfc0ce5221496aa8b222ffc82ddb), [`02edd26`](https://github.com/clauderic/dnd-kit/commit/02edd2691b24bb49f2e7c9f9a3f282031bf658b7)]:
- @dnd-kit/utilities@3.1.0-next-20220101438
- @dnd-kit/utilities@3.1.0-next-202201015122

@@ -134,0 +134,0 @@ ## 4.0.3

@@ -1,2 +0,2 @@

"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=require("react"),n=(e=t)&&"object"==typeof e&&"default"in e?e.default:e,r=require("react-dom"),o=require("@dnd-kit/utilities"),i=require("@dnd-kit/accessibility");const s={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 "},a={onDragStart:e=>`Picked up draggable item ${e}.`,onDragOver:(e,t)=>t?`Draggable item ${e} was moved over droppable area ${t}.`:`Draggable item ${e} is no longer over a droppable area.`,onDragEnd:(e,t)=>t?`Draggable item ${e} was dropped over droppable area ${t}`:`Draggable item ${e} was dropped.`,onDragCancel:e=>`Dragging was cancelled. Draggable item ${e} was dropped.`};var l;function c(...e){}!function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"}(l||(l={}));class d extends Map{get(e){var t;return null!=e&&null!=(t=super.get(e))?t:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(({disabled:e})=>!e)}getNodeFor(e){var t,n;return null!=(t=null==(n=this.get(e))?void 0:n.node.current)?t:void 0}}const u={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:{},droppableRects:new Map,droppableContainers:new d,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:c},scrollableAncestors:[],scrollableAncestorRects:[],measureDroppableContainers:c,windowRect:null,measuringScheduled:!1},h={active:null,activeNodeRect:null,activators:[],ariaDescribedById:{draggable:""},dispatch:c,draggableNodes:{},over:null,measureDroppableContainers:c},p=t.createContext(h),g=t.createContext(u);function v(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:{},translate:{x:0,y:0}},droppable:{containers:new d}}}function f(e,t){switch(t.type){case l.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case l.DragMove:return e.draggable.active?{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}}:e;case l.DragEnd:case l.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case l.RegisterDroppable:{const{element:n}=t,{id:r}=n,o=new d(e.droppable.containers);return o.set(r,n),{...e,droppable:{...e.droppable,containers:o}}}case l.SetDroppableDisabled:{const{id:n,key:r,disabled:o}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;const s=new d(e.droppable.containers);return s.set(n,{...i,disabled:o}),{...e,droppable:{...e.droppable,containers:s}}}case l.UnregisterDroppable:{const{id:n,key:r}=t,o=e.droppable.containers.get(n);if(!o||r!==o.key)return e;const i=new d(e.droppable.containers);return i.delete(n),{...e,droppable:{...e.droppable,containers:i}}}default:return e}}const b=t.createContext({type:null,event:null});function m({onDragStart:e,onDragMove:n,onDragOver:r,onDragEnd:o,onDragCancel:i}){const s=t.useContext(b),a=t.useRef(s);t.useEffect(()=>{if(s!==a.current){const{type:t,event:c}=s;switch(t){case l.DragStart:null==e||e(c);break;case l.DragMove:null==n||n(c);break;case l.DragOver:null==r||r(c);break;case l.DragCancel:null==i||i(c);break;case l.DragEnd:null==o||o(c)}a.current=s}},[s,e,n,r,o,i])}function y({announcements:e=a,hiddenTextDescribedById:s,screenReaderInstructions:l}){const{announce:c,announcement:d}=i.useAnnouncement(),u=o.useUniqueId("DndLiveRegion"),[h,p]=t.useState(!1);return t.useEffect(()=>{p(!0)},[]),m(t.useMemo(()=>({onDragStart({active:t}){c(e.onDragStart(t.id))},onDragMove({active:t,over:n}){e.onDragMove&&c(e.onDragMove(t.id,null==n?void 0:n.id))},onDragOver({active:t,over:n}){c(e.onDragOver(t.id,null==n?void 0:n.id))},onDragEnd({active:t,over:n}){c(e.onDragEnd(t.id,null==n?void 0:n.id))},onDragCancel({active:t}){c(e.onDragCancel(t.id))}}),[c,e])),h?r.createPortal(n.createElement(n.Fragment,null,n.createElement(i.HiddenText,{id:s,value:l.draggable}),n.createElement(i.LiveRegion,{id:u,announcement:d})),document.body):null}const x=Object.freeze({x:0,y:0});function w(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function C(e,t){const n=o.getEventCoordinates(e);return n?`${(n.x-t.left)/t.width*100}% ${(n.y-t.top)/t.height*100}%`:"0 0"}function D({data:{value:e}},{data:{value:t}}){return e-t}function R({data:{value:e}},{data:{value:t}}){return t-e}function E({left:e,top:t,height:n,width:r}){return[{x:e,y:t},{x:e+r,y:t},{x:e,y:t+n},{x:e+r,y:t+n}]}function S(e,t){if(!e||0===e.length)return null;const[n]=e;return t?n[t]:n}function M(e,t=e.left,n=e.top){return{x:t+.5*e.width,y:n+.5*e.height}}function N(e,t){const n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),o=Math.min(t.left+t.width,e.left+e.width),i=Math.min(t.top+t.height,e.top+e.height);if(r<o&&n<i){const s=(o-r)*(i-n);return Number((s/(t.width*t.height+e.width*e.height-s)).toFixed(4))}return 0}const L=({collisionRect:e,droppableContainers:t})=>{const n=[];for(const r of t){const{id:t,rect:{current:o}}=r;if(o){const i=N(o,e);i>0&&n.push({id:t,data:{droppableContainer:r,value:i}})}}return n.sort(R)};function A(e,t){const{top:n,left:r,bottom:o,right:i}=t;return n<=e.y&&e.y<=o&&r<=e.x&&e.x<=i}function O(e){return function(t,...n){return n.reduce((t,n)=>({...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}),{...t})}}const T=O(1),k={ignoreTransform:!1};function K(e,t=k){let n=e.getBoundingClientRect();if(t.ignoreTransform){const{getComputedStyle:t}=o.getWindow(e),{transform:r,transformOrigin:i}=t(e);r&&(n=function(e,t,n){let r,o,i,s,a;if(t.startsWith("matrix3d("))r=t.slice(9,-1).split(/, /),o=+r[0],i=+r[5],s=+r[12],a=+r[13];else{if(!t.startsWith("matrix("))return e;r=t.slice(7,-1).split(/, /),o=+r[0],i=+r[3],s=+r[4],a=+r[5]}const l=e.left-s-(1-o)*parseFloat(n),c=e.top-a-(1-i)*parseFloat(n.slice(n.indexOf(" ")+1)),d=o?e.width/o:e.width,u=i?e.height/i:e.height;return{width:d,height:u,top:c,right:l+d,bottom:c+u,left:l}}(n,r,i))}const{top:r,left:i,width:s,height:a,bottom:l,right:c}=n;return{top:r,left:i,width:s,height:a,bottom:l,right:c}}function I(e){return K(e,{ignoreTransform:!0})}function B(e){const t=[];return e?function n(r){if(!r)return t;if(o.isDocument(r)&&null!=r.scrollingElement&&!t.includes(r.scrollingElement))return t.push(r.scrollingElement),t;if(!o.isHTMLElement(r)||o.isSVGElement(r))return t;if(t.includes(r))return t;const{getComputedStyle:i}=o.getWindow(r),s=i(r);return r!==e&&function(e,t=o.getWindow(e).getComputedStyle(e)){const n=/(auto|scroll|overlay)/;return null!=["overflow","overflowX","overflowY"].find(e=>{const r=t[e];return"string"==typeof r&&n.test(r)})}(r,s)&&t.push(r),function(e,t=o.getWindow(e).getComputedStyle(e)){return"fixed"===t.position}(r,s)?t:n(r.parentNode)}(e):t}function W(e){return o.canUseDOM&&e?o.isWindow(e)?e:o.isNode(e)?o.isDocument(e)||e===o.getOwnerDocument(e).scrollingElement?window:o.isHTMLElement(e)?e:null:null:null}function P(e){return o.isWindow(e)?e.scrollX:e.scrollLeft}function z(e){return o.isWindow(e)?e.scrollY:e.scrollTop}function U(e){return{x:P(e),y:z(e)}}var F;function q(e){const t={x:0,y:0},n={x:e.scrollWidth-e.clientWidth,y:e.scrollHeight-e.clientHeight};return{isTop:e.scrollTop<=t.y,isLeft:e.scrollLeft<=t.x,isBottom:e.scrollTop>=n.y,isRight:e.scrollLeft>=n.x,maxScroll:n,minScroll:t}}!function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"}(F||(F={}));const j={x:.2,y:.2};function H(e,t,{top:n,left:r,right:i,bottom:s},a=10,l=j){const{clientHeight:c,clientWidth:d}=e,u=(h=e,o.canUseDOM&&h&&h===document.scrollingElement?{top:0,left:0,right:d,bottom:c,width:d,height:c}:t);var h;const{isTop:p,isBottom:g,isLeft:v,isRight:f}=q(e),b={x:0,y:0},m={x:0,y:0},y=u.height*l.y,x=u.width*l.x;return!p&&n<=u.top+y?(b.y=F.Backward,m.y=a*Math.abs((u.top+y-n)/y)):!g&&s>=u.bottom-y&&(b.y=F.Forward,m.y=a*Math.abs((u.bottom-y-s)/y)),!f&&i>=u.right-x?(b.x=F.Forward,m.x=a*Math.abs((u.right-x-i)/x)):!v&&r<=u.left+x&&(b.x=F.Backward,m.x=a*Math.abs((u.left+x-r)/x)),{direction:b,speed:m}}function $(e){if(e===document.scrollingElement){const{innerWidth:e,innerHeight:t}=window;return{top:0,left:0,right:e,bottom:t,width:e,height:t}}const{top:t,left:n,right:r,bottom:o}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:o,width:e.clientWidth,height:e.clientHeight}}function X(e){return e.reduce((e,t)=>o.add(e,U(t)),x)}const Y=[["x",["left","right"],function(e){return e.reduce((e,t)=>e+P(t),0)}],["y",["top","bottom"],function(e){return e.reduce((e,t)=>e+z(t),0)}]];class V{constructor(e,t){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const n=B(t),r=X(n);this.rect={...e},this.width=e.width,this.height=e.height;for(const[e,t,o]of Y)for(const i of t)Object.defineProperty(this,i,{get:()=>{const t=o(n);return this.rect[i]+(r[e]-t)},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}var _,G,J;(_=exports.AutoScrollActivator||(exports.AutoScrollActivator={}))[_.Pointer=0]="Pointer",_[_.DraggableRect=1]="DraggableRect",(G=exports.TraversalOrder||(exports.TraversalOrder={}))[G.TreeOrder=0]="TreeOrder",G[G.ReversedTreeOrder=1]="ReversedTreeOrder",(J=exports.MeasuringStrategy||(exports.MeasuringStrategy={}))[J.Always=0]="Always",J[J.BeforeDragging=1]="BeforeDragging",J[J.WhileDragging=2]="WhileDragging",(exports.MeasuringFrequency||(exports.MeasuringFrequency={})).Optimized="optimized";const Q=new Map,Z={measure:I,strategy:exports.MeasuringStrategy.WhileDragging,frequency:exports.MeasuringFrequency.Optimized},ee=[],te=oe(I),ne=ie(I);function re(e,n,r){const i=t.useRef(e);return o.useLazyMemo(t=>e?r||!t&&e||e!==i.current?o.isHTMLElement(e)&&null==e.parentNode?null:new V(n(e),e):null!=t?t:null:null,[e,r,n])}function oe(e){return(t,n)=>re(t,e,n)}function ie(e){const n=[];return function(r,i){const s=t.useRef(r);return o.useLazyMemo(t=>r.length?i||!t&&r.length||r!==s.current?r.map(t=>new V(e(t),t)):null!=t?t:n:n,[r,i])}}function se(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return o.isHTMLElement(t)?t:e}class ae{constructor(e){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(e=>{var t;return null==(t=this.target)?void 0:t.removeEventListener(...e)})},this.target=e}add(e,t,n){var r;null==(r=this.target)||r.addEventListener(e,t,n),this.listeners.push([e,t,n])}}function le(e,t){const n=Math.abs(e.x),r=Math.abs(e.y);return"number"==typeof t?Math.sqrt(n**2+r**2)>t:"x"in t&&"y"in t?n>t.x&&r>t.y:"x"in t?n>t.x:"y"in t&&r>t.y}var ce,de;function ue(e){e.preventDefault()}function he(e){e.stopPropagation()}!function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"}(ce||(ce={})),(de=exports.KeyboardCode||(exports.KeyboardCode={})).Space="Space",de.Down="ArrowDown",de.Right="ArrowRight",de.Left="ArrowLeft",de.Up="ArrowUp",de.Esc="Escape",de.Enter="Enter";const pe={start:[exports.KeyboardCode.Space,exports.KeyboardCode.Enter],cancel:[exports.KeyboardCode.Esc],end:[exports.KeyboardCode.Space,exports.KeyboardCode.Enter]},ge=(e,{currentCoordinates:t})=>{switch(e.code){case exports.KeyboardCode.Right:return{...t,x:t.x+25};case exports.KeyboardCode.Left:return{...t,x:t.x-25};case exports.KeyboardCode.Down:return{...t,y:t.y+25};case exports.KeyboardCode.Up:return{...t,y:t.y-25}}};class ve{constructor(e){this.props=void 0,this.autoScrollEnabled=!1,this.coordinates=x,this.listeners=void 0,this.windowListeners=void 0,this.props=e;const{event:{target:t}}=e;this.props=e,this.listeners=new ae(o.getOwnerDocument(t)),this.windowListeners=new ae(o.getWindow(t)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(ce.Resize,this.handleCancel),this.windowListeners.add(ce.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(ce.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:e,onStart:t}=this.props;if(!e.node.current)throw new Error("Active draggable node is undefined");const n=I(e.node.current),r={x:n.left,y:n.top};this.coordinates=r,t(r)}handleKeyDown(e){if(o.isKeyboardEvent(e)){const{coordinates:t}=this,{active:n,context:r,options:i}=this.props,{keyboardCodes:s=pe,coordinateGetter:a=ge,scrollBehavior:l="smooth"}=i,{code:c}=e;if(s.end.includes(c))return void this.handleEnd(e);if(s.cancel.includes(c))return void this.handleCancel(e);const d=a(e,{active:n,context:r.current,currentCoordinates:t});if(d){const n={x:0,y:0},{scrollableAncestors:i}=r.current;for(const r of i){const i=e.code,s=o.subtract(d,t),{isTop:a,isRight:c,isLeft:u,isBottom:h,maxScroll:p,minScroll:g}=q(r),v=$(r),f={x:Math.min(i===exports.KeyboardCode.Right?v.right-v.width/2:v.right,Math.max(i===exports.KeyboardCode.Right?v.left:v.left+v.width/2,d.x)),y:Math.min(i===exports.KeyboardCode.Down?v.bottom-v.height/2:v.bottom,Math.max(i===exports.KeyboardCode.Down?v.top:v.top+v.height/2,d.y))},b=i===exports.KeyboardCode.Right&&!c||i===exports.KeyboardCode.Left&&!u,m=i===exports.KeyboardCode.Down&&!h||i===exports.KeyboardCode.Up&&!a;if(b&&f.x!==d.x){if(i===exports.KeyboardCode.Right&&r.scrollLeft+s.x<=p.x||i===exports.KeyboardCode.Left&&r.scrollLeft+s.x>=g.x)return void r.scrollBy({left:s.x,behavior:l});n.x=i===exports.KeyboardCode.Right?r.scrollLeft-p.x:r.scrollLeft-g.x,r.scrollBy({left:-n.x,behavior:l});break}if(m&&f.y!==d.y){if(i===exports.KeyboardCode.Down&&r.scrollTop+s.y<=p.y||i===exports.KeyboardCode.Up&&r.scrollTop+s.y>=g.y)return void r.scrollBy({top:s.y,behavior:l});n.y=i===exports.KeyboardCode.Down?r.scrollTop-p.y:r.scrollTop-g.y,r.scrollBy({top:-n.y,behavior:l});break}}this.handleMove(e,o.add(d,n))}}}handleMove(e,t){const{onMove:n}=this.props;e.preventDefault(),n(t),this.coordinates=t}handleEnd(e){const{onEnd:t}=this.props;e.preventDefault(),this.detach(),t()}handleCancel(e){const{onCancel:t}=this.props;e.preventDefault(),this.detach(),t()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}function fe(e){return Boolean(e&&"distance"in e)}function be(e){return Boolean(e&&"delay"in e)}ve.activators=[{eventName:"onKeyDown",handler:(e,{keyboardCodes:t=pe,onActivation:n})=>{const{code:r}=e.nativeEvent;return!!t.start.includes(r)&&(e.preventDefault(),null==n||n({event:e.nativeEvent}),!0)}}];class me{constructor(e,t,n=function(e){const{EventTarget:t}=o.getWindow(e);return e instanceof t?e:o.getOwnerDocument(e)}(e.event.target)){var r;this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=e,this.events=t;const{event:i}=e,{target:s}=i;this.props=e,this.events=t,this.document=o.getOwnerDocument(s),this.documentListeners=new ae(this.document),this.listeners=new ae(n),this.windowListeners=new ae(o.getWindow(s)),this.initialCoordinates=null!=(r=o.getEventCoordinates(i))?r:x,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:e,props:{options:{activationConstraint:t}}}=this;if(this.listeners.add(e.move.name,this.handleMove,{passive:!1}),this.listeners.add(e.end.name,this.handleEnd),this.windowListeners.add(ce.Resize,this.handleCancel),this.windowListeners.add(ce.DragStart,ue),this.windowListeners.add(ce.VisibilityChange,this.handleCancel),this.windowListeners.add(ce.ContextMenu,ue),this.documentListeners.add(ce.Keydown,this.handleKeydown),t){if(fe(t))return;if(be(t))return void(this.timeoutId=setTimeout(this.handleStart,t.delay))}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),null!==this.timeoutId&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handleStart(){const{initialCoordinates:e}=this,{onStart:t}=this.props;e&&(this.activated=!0,this.documentListeners.add(ce.Click,he,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(ce.SelectionChange,this.removeTextSelection),t(e))}handleMove(e){var t;const{activated:n,initialCoordinates:r,props:i}=this,{onMove:s,options:{activationConstraint:a}}=i;if(!r)return;const l=null!=(t=o.getEventCoordinates(e))?t:x,c=o.subtract(r,l);if(!n&&a){if(be(a))return le(c,a.tolerance)?this.handleCancel():void 0;if(fe(a))return null!=a.tolerance&&le(c,a.tolerance)?this.handleCancel():le(c,a.distance)?this.handleStart():void 0}e.cancelable&&e.preventDefault(),s(l)}handleEnd(){const{onEnd:e}=this.props;this.detach(),e()}handleCancel(){const{onCancel:e}=this.props;this.detach(),e()}handleKeydown(e){e.code===exports.KeyboardCode.Esc&&this.handleCancel()}removeTextSelection(){var e;null==(e=this.document.getSelection())||e.removeAllRanges()}}const ye={move:{name:"pointermove"},end:{name:"pointerup"}};class xe extends me{constructor(e){const{event:t}=e,n=o.getOwnerDocument(t.target);super(e,ye,n)}}xe.activators=[{eventName:"onPointerDown",handler:({nativeEvent:e},{onActivation:t})=>!(!e.isPrimary||0!==e.button||(null==t||t({event:e}),0))}];const we={move:{name:"mousemove"},end:{name:"mouseup"}};var Ce;!function(e){e[e.RightClick=2]="RightClick"}(Ce||(Ce={}));class De extends me{constructor(e){super(e,we,o.getOwnerDocument(e.event.target))}}De.activators=[{eventName:"onMouseDown",handler:({nativeEvent:e},{onActivation:t})=>e.button!==Ce.RightClick&&(null==t||t({event:e}),!0)}];const Re={move:{name:"touchmove"},end:{name:"touchend"}};class Ee extends me{constructor(e){super(e,Re)}static setup(){return window.addEventListener(Re.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(Re.move.name,e)};function e(){}}}function Se(e,{transform:t,...n}){return(null==e?void 0:e.length)?e.reduce((e,t)=>t({transform:e,...n}),t):t}Ee.activators=[{eventName:"onTouchStart",handler:({nativeEvent:e},{onActivation:t})=>{const{touches:n}=e;return!(n.length>1||(null==t||t({event:e}),0))}}];const Me=[{sensor:xe,options:{}},{sensor:ve,options:{}}],Ne={current:{}},Le=t.createContext({...x,scaleX:1,scaleY:1}),Ae=t.memo((function({id:e,autoScroll:i=!0,announcements:a,children:c,sensors:d=Me,collisionDetection:u=L,measuring:h,modifiers:m,screenReaderInstructions:w=s,...C}){var D,R,E,M,N,A,O;const k=t.useReducer(f,void 0,v),[P,z]=k,[F,q]=t.useState(()=>({type:null,event:null})),[j,$]=t.useState(!1),{draggable:{active:Y,nodes:_,translate:G},droppable:{containers:J}}=P,oe=Y?_[Y]:null,ie=t.useRef({initial:null,translated:null}),ae=t.useMemo(()=>{var e;return null!=Y?{id:Y,data:null!=(e=null==oe?void 0:oe.data)?e:Ne,rect:ie}:null},[Y,oe]),le=t.useRef(null),[ce,de]=t.useState(null),[ue,he]=t.useState(null),pe=t.useRef(C),ge=o.useUniqueId("DndDescribedBy",e),ve=t.useMemo(()=>J.getEnabled(),[J]),{droppableRects:fe,measureDroppableContainers:be,measuringScheduled:me}=function(e,{dragging:n,dependencies:r,config:i}){const[s,a]=t.useState(null),l=null!=s,{frequency:c,measure:d,strategy:u}={...Z,...i},h=t.useRef(e),p=t.useCallback((e=[])=>a(t=>t?t.concat(e):e),[]),g=t.useRef(null),v=function(){switch(u){case exports.MeasuringStrategy.Always:return!1;case exports.MeasuringStrategy.BeforeDragging:return n;default:return!n}}(),f=o.useLazyMemo(t=>{if(v&&!n)return Q;const r=s;if(!t||t===Q||h.current!==e||null!=r){const t=new Map;for(let n of e){if(!n)continue;if(r&&r.length>0&&!r.includes(n.id)&&n.rect.current){t.set(n.id,n.rect.current);continue}const e=n.node.current,o=e?new V(d(e),e):null;n.rect.current=o,o&&t.set(n.id,o)}return t}return t},[e,s,n,v,d]);return t.useEffect(()=>{h.current=e},[e]),t.useEffect(()=>{v||requestAnimationFrame(()=>p())},[n,v]),t.useEffect(()=>{l&&a(null)},[l]),t.useEffect(()=>{v||"number"!=typeof c||null!==g.current||(g.current=setTimeout(()=>{p(),g.current=null},c))},[c,v,p,...r]),{droppableRects:f,measureDroppableContainers:p,measuringScheduled:l}}(ve,{dragging:j,dependencies:[G.x,G.y],config:null==h?void 0:h.droppable}),ye=function(e,t){const n=null!==t?e[t]:void 0,r=n?n.node.current:null;return o.useLazyMemo(e=>{var n;return null===t?null:null!=(n=null!=r?r:e)?n:null},[r,t])}(_,Y),xe=ue?o.getEventCoordinates(ue):null,we=re(ye,null!=(D=null==h||null==(R=h.draggable)?void 0:R.measure)?D:I),Ce=te(ye?ye.parentElement:null),De=t.useRef({active:null,activeNode:ye,collisionRect:null,collisions:null,droppableRects:fe,draggableNodes:_,draggingNode:null,draggingNodeRect:null,droppableContainers:J,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),Re=J.getNodeFor(null==(E=De.current.over)?void 0:E.id),Ee=function({measure:e=K}){const[n,r]=t.useState(null),i=t.useRef(e),s=t.useCallback(t=>{for(const{target:n}of t)if(o.isHTMLElement(n)){r(t=>{const r=e(n);return t?{...t,width:r.width,height:r.height}:r});break}},[e]),a=t.useMemo(()=>new ResizeObserver(s),[s]),l=t.useCallback(t=>{const n=se(t);a.disconnect(),n&&a.observe(n),r(n?e(n):null)},[e,a]),[c,d]=o.useNodeRef(l);return o.useIsomorphicLayoutEffect(()=>{i.current=e},[e]),t.useMemo(()=>({nodeRef:c,rect:n,setRef:d}),[n,c,d])}({measure:null==h||null==(M=h.dragOverlay)?void 0:M.measure}),Ae=null!=(N=Ee.nodeRef.current)?N:ye,Oe=null!=(A=Ee.rect)?A:we,Te=t.useRef(null),ke=Oe===we?(Ie=Te.current,(Ke=we)&&Ie?{x:Ke.left-Ie.left,y:Ke.top-Ie.top}:x):x;var Ke,Ie;const Be=t.useMemo(()=>We?function(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}(We):null,[We=Ae?Ae.ownerDocument.defaultView:null]);var We;const Pe=function(e){const n=t.useRef(e),r=o.useLazyMemo(t=>e?t&&e&&n.current&&e.parentNode===n.current.parentNode?t:B(e):ee,[e]);return t.useEffect(()=>{n.current=e},[e]),r}(Y?null!=Re?Re:Ae:null),ze=ne(Pe),Ue=Se(m,{transform:{x:G.x-ke.x,y:G.y-ke.y,scaleX:1,scaleY:1},activatorEvent:ue,active:ae,activeNodeRect:we,containerNodeRect:Ce,draggingNodeRect:Oe,over:De.current.over,overlayNodeRect:Ee.rect,scrollableAncestors:Pe,scrollableAncestorRects:ze,windowRect:Be}),Fe=xe?o.add(xe,G):null,qe=function(e){const[n,r]=t.useState(null),i=t.useRef(e),s=t.useCallback(e=>{const t=W(e.target);t&&r(e=>e?(e.set(t,U(t)),new Map(e)):null)},[]);return t.useEffect(()=>{const t=i.current;if(e!==t){n(t);const o=e.map(e=>{const t=W(e);return t?(t.addEventListener("scroll",s,{passive:!0}),[t,U(t)]):null}).filter(e=>null!=e);r(o.length?new Map(o):null),i.current=e}return()=>{n(e),n(t)};function n(e){e.forEach(e=>{const t=W(e);null==t||t.removeEventListener("scroll",s)})}},[s,e]),t.useMemo(()=>e.length?n?Array.from(n.values()).reduce((e,t)=>o.add(e,t),x):X(e):x,[e,n])}(Pe),je=o.add(Ue,qe),He=Oe?T(Oe,Ue):null,$e=ae&&He?u({active:ae,collisionRect:He,droppableContainers:ve,pointerCoordinates:Fe}):null,Xe=S($e,"id"),[Ye,Ve]=t.useState(null),_e=function(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}(Ue,null!=(O=null==Ye?void 0:Ye.rect)?O:null,we),Ge=t.useCallback((e,{sensor:t,options:n})=>{if(!le.current)return;const o=_[le.current];if(!o)return;const i=new t({active:le.current,activeNode:o,event:e.nativeEvent,options:n,context:De,onStart(e){const t=le.current;if(!t)return;const n=_[t];if(!n)return;const{onDragStart:o}=pe.current,i={active:{id:t,data:n.data,rect:ie}};r.unstable_batchedUpdates(()=>{z({type:l.DragStart,initialCoordinates:e,active:t}),q({type:l.DragStart,event:i})}),null==o||o(i)},onMove(e){z({type:l.DragMove,coordinates:e})},onEnd:s(l.DragEnd),onCancel:s(l.DragCancel)});function s(e){return async function(){const{active:t,collisions:n,over:o,scrollAdjustedTranslate:i}=De.current;let s=null;if(t&&i){const{cancelDrop:r}=pe.current;s={active:t,collisions:n,delta:i,over:o},e===l.DragEnd&&"function"==typeof r&&await Promise.resolve(r(s))&&(e=l.DragCancel)}le.current=null,r.unstable_batchedUpdates(()=>{if(z({type:e}),Ve(null),$(!1),de(null),he(null),s&&q({type:e,event:s}),s){const{onDragCancel:t,onDragEnd:n}=pe.current,r=e===l.DragEnd?n:t;null==r||r(s)}})}}r.unstable_batchedUpdates(()=>{de(i),he(e.nativeEvent)})},[z,_]),Je=function(e,n){return t.useMemo(()=>e.reduce((e,t)=>{const{sensor:r}=t;return[...e,...r.activators.map(e=>({eventName:e.eventName,handler:n(e.handler,t)}))]},[]),[e,n])}(d,t.useCallback((e,t)=>(n,r)=>{const o=n.nativeEvent;null!==le.current||o.dndKit||o.defaultPrevented||!0===e(n,t.options)&&(o.dndKit={capturedBy:t.sensor},le.current=r,Ge(n,t))},[Ge]));!function(e){t.useEffect(()=>{if(!o.canUseDOM)return;const t=e.map(({sensor:e})=>null==e.setup?void 0:e.setup());return()=>{for(const e of t)null==e||e()}},e.map(({sensor:e})=>e))}(d),o.useIsomorphicLayoutEffect(()=>{pe.current=C},Object.values(C)),t.useEffect(()=>{null!=Y&&$(!0)},[Y]),t.useEffect(()=>{ae||(Te.current=null),ae&&we&&!Te.current&&(Te.current=we)},[we,ae]),t.useEffect(()=>{const{onDragMove:e}=pe.current,{active:t,collisions:n,over:r}=De.current;if(!t)return;const o={active:t,collisions:n,delta:{x:je.x,y:je.y},over:r};q({type:l.DragMove,event:o}),null==e||e(o)},[je.x,je.y]),t.useEffect(()=>{const{active:e,collisions:t,droppableContainers:n,scrollAdjustedTranslate:o}=De.current;if(!e||!le.current||!o)return;const{onDragOver:i}=pe.current,s=n.get(Xe),a=s&&s.rect.current?{id:s.id,rect:s.rect.current,data:s.data,disabled:s.disabled}:null,c={active:e,collisions:t,delta:{x:o.x,y:o.y},over:a};r.unstable_batchedUpdates(()=>{Ve(a),q({type:l.DragOver,event:c}),null==i||i(c)})},[Xe]),o.useIsomorphicLayoutEffect(()=>{De.current={active:ae,activeNode:ye,collisionRect:He,collisions:$e,droppableRects:fe,draggableNodes:_,draggingNode:Ae,draggingNodeRect:Oe,droppableContainers:J,over:Ye,scrollableAncestors:Pe,scrollAdjustedTranslate:je},ie.current={initial:Oe,translated:He}},[ae,ye,$e,He,_,Ae,Oe,fe,J,Ye,Pe,je]),function({acceleration:e,activator:n=exports.AutoScrollActivator.Pointer,canScroll:r,draggingRect:i,enabled:s,interval:a=5,order:l=exports.TraversalOrder.TreeOrder,pointerCoordinates:c,scrollableAncestors:d,scrollableAncestorRects:u,threshold:h}){const[p,g]=o.useInterval(),v=t.useRef({x:1,y:1}),f=t.useMemo(()=>{switch(n){case exports.AutoScrollActivator.Pointer:return c?{top:c.y,bottom:c.y,left:c.x,right:c.x}:null;case exports.AutoScrollActivator.DraggableRect:return i}return null},[n,i,c]),b=t.useRef(x),m=t.useRef(null),y=t.useCallback(()=>{const e=m.current;e&&e.scrollBy(v.current.x*b.current.x,v.current.y*b.current.y)},[]),w=t.useMemo(()=>l===exports.TraversalOrder.TreeOrder?[...d].reverse():d,[l,d]);t.useEffect(()=>{if(s&&d.length&&f){for(const t of w){if(!1===(null==r?void 0:r(t)))continue;const n=d.indexOf(t),o=u[n];if(!o)continue;const{direction:i,speed:s}=H(t,o,f,e,h);if(s.x>0||s.y>0)return g(),m.current=t,p(y,a),v.current=s,void(b.current=i)}v.current={x:0,y:0},b.current={x:0,y:0},g()}else g()},[e,y,r,g,s,a,JSON.stringify(f),p,d,w,u,JSON.stringify(h)])}({...function(){const e=!(!1===(null==ce?void 0:ce.autoScrollEnabled)||("object"==typeof i?!1===i.enabled:!1===i));return"object"==typeof i?{...i,enabled:e}:{enabled:e}}(),draggingRect:He,pointerCoordinates:Fe,scrollableAncestors:Pe,scrollableAncestorRects:ze});const Qe=t.useMemo(()=>({active:ae,activeNode:ye,activeNodeRect:we,activatorEvent:ue,collisions:$e,containerNodeRect:Ce,dragOverlay:Ee,draggableNodes:_,droppableContainers:J,droppableRects:fe,over:Ye,measureDroppableContainers:be,scrollableAncestors:Pe,scrollableAncestorRects:ze,measuringScheduled:me,windowRect:Be}),[ae,ye,we,ue,$e,Ce,Ee,_,J,fe,Ye,be,Pe,ze,me,Be]),Ze=t.useMemo(()=>({active:ae,activeNodeRect:we,activators:Je,ariaDescribedById:{draggable:ge},dispatch:z,draggableNodes:_,over:Ye,measureDroppableContainers:be}),[ae,we,Je,z,ge,_,Ye,be]);return n.createElement(b.Provider,{value:F},n.createElement(p.Provider,{value:Ze},n.createElement(g.Provider,{value:Qe},n.createElement(Le.Provider,{value:_e},c))),n.createElement(y,{announcements:a,hiddenTextDescribedById:ge,screenReaderInstructions:w}))})),Oe=t.createContext(null),Te="button";function ke(){return t.useContext(g)}const Ke={timeout:25},Ie={duration:250,easing:"ease",dragSourceOpacity:0},Be={x:0,y:0,scaleX:1,scaleY:1},We=e=>o.isKeyboardEvent(e)?"transform 250ms ease":void 0,Pe=n.memo(({adjustScale:e=!1,children:r,dropAnimation:i=Ie,style:s,transition:a=We,modifiers:l,wrapperElement:c="div",className:d,zIndex:u=999})=>{var g,v;const{active:f,activeNodeRect:b,containerNodeRect:m,draggableNodes:y,activatorEvent:x,over:w,dragOverlay:D,scrollableAncestors:R,scrollableAncestorRects:E,windowRect:S}=ke(),M=t.useContext(Le),N=Se(l,{activatorEvent:x,active:f,activeNodeRect:b,containerNodeRect:m,draggingNodeRect:D.rect,over:w,overlayNodeRect:D.rect,scrollableAncestors:R,scrollableAncestorRects:E,transform:M,windowRect:S}),L=null!==f,A=e?N:{...N,scaleX:1,scaleY:1},O=o.useLazyMemo(e=>L?e||(b?{...b}:null):null,[L,b]),T=O?{position:"fixed",width:O.width,height:O.height,top:O.top,left:O.left,zIndex:u,transform:o.CSS.Transform.toString(A),touchAction:"none",transformOrigin:e&&x?C(x,O):void 0,transition:"function"==typeof a?a(x):a,...s}:void 0,k=L?{style:T,children:r,className:d,transform:A}:void 0,K=t.useRef(k),B=null!=k?k:K.current,{children:W,...P}=null!=B?B:{},z=t.useRef(null!=(g=null==f?void 0:f.id)?g:null),U=function({animate:e,adjustScale:n,activeId:r,draggableNodes:i,duration:s,dragSourceOpacity:a,easing:l,node:c,transform:d}){const[u,h]=t.useState(!1);return o.useIsomorphicLayoutEffect(()=>{var t;if(!(e&&r&&l&&s))return void(e&&h(!0));const u=null==(t=i[r])?void 0:t.node.current;if(d&&c&&u&&null!==u.parentNode){const e=se(c);if(e){const t=e.getBoundingClientRect(),r=I(u),i={x:t.left-r.left,y:t.top-r.top};if(Math.abs(i.x)||Math.abs(i.y)){const e=o.CSS.Transform.toString({x:d.x-i.x,y:d.y-i.y,scaleX:n?r.width*d.scaleX/t.width:1,scaleY:n?r.height*d.scaleY/t.height:1}),p=u.style.opacity;return null!=a&&(u.style.opacity=""+a),void(c.animate([{transform:o.CSS.Transform.toString(d)},{transform:e}],{easing:l,duration:s}).onfinish=()=>{c.style.display="none",h(!0),u&&null!=a&&(u.style.opacity=p)})}}}h(!0)},[e,r,n,i,s,l,a,c,d]),o.useIsomorphicLayoutEffect(()=>{u&&h(!1)},[u]),u}({animate:Boolean(i&&z.current&&!f),adjustScale:e,activeId:z.current,draggableNodes:y,duration:null==i?void 0:i.duration,easing:null==i?void 0:i.easing,dragSourceOpacity:null==i?void 0:i.dragSourceOpacity,node:D.nodeRef.current,transform:null==(v=K.current)?void 0:v.transform}),F=Boolean(W&&(r||i&&!U));return t.useEffect(()=>{var e;(null==f?void 0:f.id)!==z.current&&(z.current=null!=(e=null==f?void 0:f.id)?e:null),f&&K.current!==k&&(K.current=k)},[f,k]),t.useEffect(()=>{U&&(K.current=void 0)},[U]),F?n.createElement(p.Provider,{value:h},n.createElement(Le.Provider,{value:Be},n.createElement(c,{...P,ref:D.setRef},W))):null});exports.DndContext=Ae,exports.DragOverlay=Pe,exports.KeyboardSensor=ve,exports.MouseSensor=De,exports.PointerSensor=xe,exports.TouchSensor=Ee,exports.applyModifiers=Se,exports.closestCenter=({collisionRect:e,droppableContainers:t})=>{const n=M(e,e.left,e.top),r=[];for(const e of t){const{id:t,rect:{current:o}}=e;if(o){const i=w(M(o),n);r.push({id:t,data:{droppableContainer:e,value:i}})}}return r.sort(D)},exports.closestCorners=({collisionRect:e,droppableContainers:t})=>{const n=E(e),r=[];for(const e of t){const{id:t,rect:{current:o}}=e;if(o){const i=E(o),s=n.reduce((e,t,n)=>e+w(i[n],t),0),a=Number((s/4).toFixed(4));r.push({id:t,data:{droppableContainer:e,value:a}})}}return r.sort(D)},exports.defaultAnnouncements=a,exports.defaultCoordinates=x,exports.defaultDropAnimation=Ie,exports.getClientRect=K,exports.getFirstCollision=S,exports.getScrollableAncestors=B,exports.pointerWithin=({droppableContainers:e,pointerCoordinates:t})=>{if(!t)return[];const n=[];for(const r of e){const{id:e,rect:{current:o}}=r;if(o&&A(t,o)){const i=E(o).reduce((e,n)=>e+w(t,n),0),s=Number((i/4).toFixed(4));n.push({id:e,data:{droppableContainer:r,value:s}})}}return n.sort(D)},exports.rectIntersection=L,exports.useDndContext=ke,exports.useDndMonitor=m,exports.useDraggable=function({id:e,data:n,disabled:r=!1,attributes:i}){const s=o.useUniqueId("Droppable"),{activators:a,active:l,activeNodeRect:c,ariaDescribedById:d,draggableNodes:u,over:h}=t.useContext(p),{role:g=Te,roleDescription:v="draggable",tabIndex:f=0}=null!=i?i:{},b=(null==l?void 0:l.id)===e,m=t.useContext(b?Le:Oe),[y,x]=o.useNodeRef(),w=function(e,n){return t.useMemo(()=>e.reduce((e,{eventName:t,handler:r})=>(e[t]=e=>{r(e,n)},e),{}),[e,n])}(a,e),C=o.useLatestValue(n);return o.useIsomorphicLayoutEffect(()=>(u[e]={id:e,key:s,node:y,data:C},()=>{const t=u[e];t&&t.key===s&&delete u[e]}),[u,e]),{active:l,activeNodeRect:c,attributes:t.useMemo(()=>({role:g,tabIndex:f,"aria-pressed":!(!b||g!==Te)||void 0,"aria-roledescription":v,"aria-describedby":d.draggable}),[g,f,b,v,d.draggable]),isDragging:b,listeners:r?void 0:w,node:y,over:h,setNodeRef:x,transform:m}},exports.useDroppable=function({data:e,disabled:n=!1,id:r,resizeObserverConfig:i}){const s=o.useUniqueId("Droppable"),{active:a,dispatch:c,over:d,measureDroppableContainers:u}=t.useContext(p),h=t.useRef(!1),g=t.useRef(null),v=t.useRef(null),{disabled:f,updateMeasurementsFor:b,timeout:m}={...Ke,...i},y=o.useLatestValue(null!=b?b:r),x=t.useCallback(()=>{h.current?(null!=v.current&&clearTimeout(v.current),v.current=setTimeout(()=>{u("string"==typeof y.current?[y.current]:y.current),v.current=null},m)):h.current=!0},[m]),w=t.useMemo(()=>!a||f?null:new ResizeObserver(x),[a,x,f]),C=t.useCallback((e,t)=>{w&&(t&&(w.unobserve(t),h.current=!1),e&&w.observe(e))},[w]),[D,R]=o.useNodeRef(C),E=o.useLatestValue(e);return t.useEffect(()=>{w&&D.current&&(w.disconnect(),h.current=!1,w.observe(D.current))},[D,w]),o.useIsomorphicLayoutEffect(()=>(c({type:l.RegisterDroppable,element:{id:r,key:s,disabled:n,node:D,rect:g,data:E}}),()=>c({type:l.UnregisterDroppable,key:s,id:r})),[r]),t.useEffect(()=>{c({type:l.SetDroppableDisabled,id:r,key:s,disabled:n})},[n]),{active:a,rect:g,isOver:(null==d?void 0:d.id)===r,node:D,over:d,setNodeRef:R}},exports.useSensor=function(e,n){return t.useMemo(()=>({sensor:e,options:null!=n?n:{}}),[e,n])},exports.useSensors=function(...e){return t.useMemo(()=>[...e].filter(e=>null!=e),[...e])};
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=require("react"),n=(e=t)&&"object"==typeof e&&"default"in e?e.default:e,r=require("react-dom"),o=require("@dnd-kit/utilities"),i=require("@dnd-kit/accessibility");const a={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 "},s={onDragStart:e=>`Picked up draggable item ${e}.`,onDragOver:(e,t)=>t?`Draggable item ${e} was moved over droppable area ${t}.`:`Draggable item ${e} is no longer over a droppable area.`,onDragEnd:(e,t)=>t?`Draggable item ${e} was dropped over droppable area ${t}`:`Draggable item ${e} was dropped.`,onDragCancel:e=>`Dragging was cancelled. Draggable item ${e} was dropped.`};var l;function c(...e){}!function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"}(l||(l={}));class d extends Map{get(e){var t;return null!=e&&null!=(t=super.get(e))?t:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(({disabled:e})=>!e)}getNodeFor(e){var t,n;return null!=(t=null==(n=this.get(e))?void 0:n.node.current)?t:void 0}}const u={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:{},droppableRects:new Map,droppableContainers:new d,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:c},scrollableAncestors:[],scrollableAncestorRects:[],measureDroppableContainers:c,windowRect:null,measuringScheduled:!1},h={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:c,draggableNodes:{},over:null,measureDroppableContainers:c},p=t.createContext(h),g=t.createContext(u);function v(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:{},translate:{x:0,y:0}},droppable:{containers:new d}}}function f(e,t){switch(t.type){case l.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case l.DragMove:return e.draggable.active?{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}}:e;case l.DragEnd:case l.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case l.RegisterDroppable:{const{element:n}=t,{id:r}=n,o=new d(e.droppable.containers);return o.set(r,n),{...e,droppable:{...e.droppable,containers:o}}}case l.SetDroppableDisabled:{const{id:n,key:r,disabled:o}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;const a=new d(e.droppable.containers);return a.set(n,{...i,disabled:o}),{...e,droppable:{...e.droppable,containers:a}}}case l.UnregisterDroppable:{const{id:n,key:r}=t,o=e.droppable.containers.get(n);if(!o||r!==o.key)return e;const i=new d(e.droppable.containers);return i.delete(n),{...e,droppable:{...e.droppable,containers:i}}}default:return e}}const b=t.createContext({type:null,event:null});function m({onDragStart:e,onDragMove:n,onDragOver:r,onDragEnd:o,onDragCancel:i}){const a=t.useContext(b),s=t.useRef(a);t.useEffect(()=>{if(a!==s.current){const{type:t,event:c}=a;switch(t){case l.DragStart:null==e||e(c);break;case l.DragMove:null==n||n(c);break;case l.DragOver:null==r||r(c);break;case l.DragCancel:null==i||i(c);break;case l.DragEnd:null==o||o(c)}s.current=a}},[a,e,n,r,o,i])}function y({announcements:e=s,hiddenTextDescribedById:a,screenReaderInstructions:l}){const{announce:c,announcement:d}=i.useAnnouncement(),u=o.useUniqueId("DndLiveRegion"),[h,p]=t.useState(!1);return t.useEffect(()=>{p(!0)},[]),m(t.useMemo(()=>({onDragStart({active:t}){c(e.onDragStart(t.id))},onDragMove({active:t,over:n}){e.onDragMove&&c(e.onDragMove(t.id,null==n?void 0:n.id))},onDragOver({active:t,over:n}){c(e.onDragOver(t.id,null==n?void 0:n.id))},onDragEnd({active:t,over:n}){c(e.onDragEnd(t.id,null==n?void 0:n.id))},onDragCancel({active:t}){c(e.onDragCancel(t.id))}}),[c,e])),h?r.createPortal(n.createElement(n.Fragment,null,n.createElement(i.HiddenText,{id:a,value:l.draggable}),n.createElement(i.LiveRegion,{id:u,announcement:d})),document.body):null}const x=Object.freeze({x:0,y:0});function w(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function C(e,t){const n=o.getEventCoordinates(e);return n?`${(n.x-t.left)/t.width*100}% ${(n.y-t.top)/t.height*100}%`:"0 0"}function D({data:{value:e}},{data:{value:t}}){return e-t}function E({data:{value:e}},{data:{value:t}}){return t-e}function R({left:e,top:t,height:n,width:r}){return[{x:e,y:t},{x:e+r,y:t},{x:e,y:t+n},{x:e+r,y:t+n}]}function S(e,t){if(!e||0===e.length)return null;const[n]=e;return t?n[t]:n}function M(e,t=e.left,n=e.top){return{x:t+.5*e.width,y:n+.5*e.height}}function N(e,t){const n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),o=Math.min(t.left+t.width,e.left+e.width),i=Math.min(t.top+t.height,e.top+e.height);if(r<o&&n<i){const a=(o-r)*(i-n);return Number((a/(t.width*t.height+e.width*e.height-a)).toFixed(4))}return 0}const A=({collisionRect:e,droppableContainers:t})=>{const n=[];for(const r of t){const{id:t,rect:{current:o}}=r;if(o){const i=N(o,e);i>0&&n.push({id:t,data:{droppableContainer:r,value:i}})}}return n.sort(E)};function L(e,t){const{top:n,left:r,bottom:o,right:i}=t;return n<=e.y&&e.y<=o&&r<=e.x&&e.x<=i}function O(e){return function(t,...n){return n.reduce((t,n)=>({...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}),{...t})}}const T=O(1),k={ignoreTransform:!1};function K(e,t=k){let n=e.getBoundingClientRect();if(t.ignoreTransform){const{getComputedStyle:t}=o.getWindow(e),{transform:r,transformOrigin:i}=t(e);r&&(n=function(e,t,n){let r,o,i,a,s;if(t.startsWith("matrix3d("))r=t.slice(9,-1).split(/, /),o=+r[0],i=+r[5],a=+r[12],s=+r[13];else{if(!t.startsWith("matrix("))return e;r=t.slice(7,-1).split(/, /),o=+r[0],i=+r[3],a=+r[4],s=+r[5]}const l=e.left-a-(1-o)*parseFloat(n),c=e.top-s-(1-i)*parseFloat(n.slice(n.indexOf(" ")+1)),d=o?e.width/o:e.width,u=i?e.height/i:e.height;return{width:d,height:u,top:c,right:l+d,bottom:c+u,left:l}}(n,r,i))}const{top:r,left:i,width:a,height:s,bottom:l,right:c}=n;return{top:r,left:i,width:a,height:s,bottom:l,right:c}}function B(e){return K(e,{ignoreTransform:!0})}function I(e){const t=[];return e?function n(r){if(!r)return t;if(o.isDocument(r)&&null!=r.scrollingElement&&!t.includes(r.scrollingElement))return t.push(r.scrollingElement),t;if(!o.isHTMLElement(r)||o.isSVGElement(r))return t;if(t.includes(r))return t;const{getComputedStyle:i}=o.getWindow(r),a=i(r);return r!==e&&function(e,t=o.getWindow(e).getComputedStyle(e)){const n=/(auto|scroll|overlay)/;return null!=["overflow","overflowX","overflowY"].find(e=>{const r=t[e];return"string"==typeof r&&n.test(r)})}(r,a)&&t.push(r),function(e,t=o.getWindow(e).getComputedStyle(e)){return"fixed"===t.position}(r,a)?t:n(r.parentNode)}(e):t}function W(e){return o.canUseDOM&&e?o.isWindow(e)?e:o.isNode(e)?o.isDocument(e)||e===o.getOwnerDocument(e).scrollingElement?window:o.isHTMLElement(e)?e:null:null:null}function P(e){return o.isWindow(e)?e.scrollX:e.scrollLeft}function z(e){return o.isWindow(e)?e.scrollY:e.scrollTop}function U(e){return{x:P(e),y:z(e)}}var F;function q(e){const t={x:0,y:0},n={x:e.scrollWidth-e.clientWidth,y:e.scrollHeight-e.clientHeight};return{isTop:e.scrollTop<=t.y,isLeft:e.scrollLeft<=t.x,isBottom:e.scrollTop>=n.y,isRight:e.scrollLeft>=n.x,maxScroll:n,minScroll:t}}!function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"}(F||(F={}));const j={x:.2,y:.2};function H(e,t,{top:n,left:r,right:i,bottom:a},s=10,l=j){const{clientHeight:c,clientWidth:d}=e,u=(h=e,o.canUseDOM&&h&&h===document.scrollingElement?{top:0,left:0,right:d,bottom:c,width:d,height:c}:t);var h;const{isTop:p,isBottom:g,isLeft:v,isRight:f}=q(e),b={x:0,y:0},m={x:0,y:0},y=u.height*l.y,x=u.width*l.x;return!p&&n<=u.top+y?(b.y=F.Backward,m.y=s*Math.abs((u.top+y-n)/y)):!g&&a>=u.bottom-y&&(b.y=F.Forward,m.y=s*Math.abs((u.bottom-y-a)/y)),!f&&i>=u.right-x?(b.x=F.Forward,m.x=s*Math.abs((u.right-x-i)/x)):!v&&r<=u.left+x&&(b.x=F.Backward,m.x=s*Math.abs((u.left+x-r)/x)),{direction:b,speed:m}}function $(e){if(e===document.scrollingElement){const{innerWidth:e,innerHeight:t}=window;return{top:0,left:0,right:e,bottom:t,width:e,height:t}}const{top:t,left:n,right:r,bottom:o}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:o,width:e.clientWidth,height:e.clientHeight}}function V(e){return e.reduce((e,t)=>o.add(e,U(t)),x)}const X=[["x",["left","right"],function(e){return e.reduce((e,t)=>e+P(t),0)}],["y",["top","bottom"],function(e){return e.reduce((e,t)=>e+z(t),0)}]];class Y{constructor(e,t){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const n=I(t),r=V(n);this.rect={...e},this.width=e.width,this.height=e.height;for(const[e,t,o]of X)for(const i of t)Object.defineProperty(this,i,{get:()=>{const t=o(n);return this.rect[i]+(r[e]-t)},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}var _,G,J;(_=exports.AutoScrollActivator||(exports.AutoScrollActivator={}))[_.Pointer=0]="Pointer",_[_.DraggableRect=1]="DraggableRect",(G=exports.TraversalOrder||(exports.TraversalOrder={}))[G.TreeOrder=0]="TreeOrder",G[G.ReversedTreeOrder=1]="ReversedTreeOrder",(J=exports.MeasuringStrategy||(exports.MeasuringStrategy={}))[J.Always=0]="Always",J[J.BeforeDragging=1]="BeforeDragging",J[J.WhileDragging=2]="WhileDragging",(exports.MeasuringFrequency||(exports.MeasuringFrequency={})).Optimized="optimized";const Q=new Map,Z={measure:B,strategy:exports.MeasuringStrategy.WhileDragging,frequency:exports.MeasuringFrequency.Optimized},ee=[],te=oe(B),ne=ie(B);function re(e,n,r){const i=t.useRef(e);return o.useLazyMemo(t=>e?r||!t&&e||e!==i.current?o.isHTMLElement(e)&&null==e.parentNode?null:new Y(n(e),e):null!=t?t:null:null,[e,r,n])}function oe(e){return(t,n)=>re(t,e,n)}function ie(e){const n=[];return function(r,i){const a=t.useRef(r);return o.useLazyMemo(t=>r.length?i||!t&&r.length||r!==a.current?r.map(t=>new Y(e(t),t)):null!=t?t:n:n,[r,i])}}function ae(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return o.isHTMLElement(t)?t:e}class se{constructor(e){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(e=>{var t;return null==(t=this.target)?void 0:t.removeEventListener(...e)})},this.target=e}add(e,t,n){var r;null==(r=this.target)||r.addEventListener(e,t,n),this.listeners.push([e,t,n])}}function le(e,t){const n=Math.abs(e.x),r=Math.abs(e.y);return"number"==typeof t?Math.sqrt(n**2+r**2)>t:"x"in t&&"y"in t?n>t.x&&r>t.y:"x"in t?n>t.x:"y"in t&&r>t.y}var ce,de;function ue(e){e.preventDefault()}function he(e){e.stopPropagation()}!function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"}(ce||(ce={})),(de=exports.KeyboardCode||(exports.KeyboardCode={})).Space="Space",de.Down="ArrowDown",de.Right="ArrowRight",de.Left="ArrowLeft",de.Up="ArrowUp",de.Esc="Escape",de.Enter="Enter";const pe={start:[exports.KeyboardCode.Space,exports.KeyboardCode.Enter],cancel:[exports.KeyboardCode.Esc],end:[exports.KeyboardCode.Space,exports.KeyboardCode.Enter]},ge=(e,{currentCoordinates:t})=>{switch(e.code){case exports.KeyboardCode.Right:return{...t,x:t.x+25};case exports.KeyboardCode.Left:return{...t,x:t.x-25};case exports.KeyboardCode.Down:return{...t,y:t.y+25};case exports.KeyboardCode.Up:return{...t,y:t.y-25}}};class ve{constructor(e){this.props=void 0,this.autoScrollEnabled=!1,this.coordinates=x,this.listeners=void 0,this.windowListeners=void 0,this.props=e;const{event:{target:t}}=e;this.props=e,this.listeners=new se(o.getOwnerDocument(t)),this.windowListeners=new se(o.getWindow(t)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(ce.Resize,this.handleCancel),this.windowListeners.add(ce.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(ce.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:e,onStart:t}=this.props;if(!e.node.current)throw new Error("Active draggable node is undefined");const n=B(e.node.current),r={x:n.left,y:n.top};this.coordinates=r,t(r)}handleKeyDown(e){if(o.isKeyboardEvent(e)){const{coordinates:t}=this,{active:n,context:r,options:i}=this.props,{keyboardCodes:a=pe,coordinateGetter:s=ge,scrollBehavior:l="smooth"}=i,{code:c}=e;if(a.end.includes(c))return void this.handleEnd(e);if(a.cancel.includes(c))return void this.handleCancel(e);const d=s(e,{active:n,context:r.current,currentCoordinates:t});if(d){const n={x:0,y:0},{scrollableAncestors:i}=r.current;for(const r of i){const i=e.code,a=o.subtract(d,t),{isTop:s,isRight:c,isLeft:u,isBottom:h,maxScroll:p,minScroll:g}=q(r),v=$(r),f={x:Math.min(i===exports.KeyboardCode.Right?v.right-v.width/2:v.right,Math.max(i===exports.KeyboardCode.Right?v.left:v.left+v.width/2,d.x)),y:Math.min(i===exports.KeyboardCode.Down?v.bottom-v.height/2:v.bottom,Math.max(i===exports.KeyboardCode.Down?v.top:v.top+v.height/2,d.y))},b=i===exports.KeyboardCode.Right&&!c||i===exports.KeyboardCode.Left&&!u,m=i===exports.KeyboardCode.Down&&!h||i===exports.KeyboardCode.Up&&!s;if(b&&f.x!==d.x){if(i===exports.KeyboardCode.Right&&r.scrollLeft+a.x<=p.x||i===exports.KeyboardCode.Left&&r.scrollLeft+a.x>=g.x)return void r.scrollBy({left:a.x,behavior:l});n.x=i===exports.KeyboardCode.Right?r.scrollLeft-p.x:r.scrollLeft-g.x,r.scrollBy({left:-n.x,behavior:l});break}if(m&&f.y!==d.y){if(i===exports.KeyboardCode.Down&&r.scrollTop+a.y<=p.y||i===exports.KeyboardCode.Up&&r.scrollTop+a.y>=g.y)return void r.scrollBy({top:a.y,behavior:l});n.y=i===exports.KeyboardCode.Down?r.scrollTop-p.y:r.scrollTop-g.y,r.scrollBy({top:-n.y,behavior:l});break}}this.handleMove(e,o.add(d,n))}}}handleMove(e,t){const{onMove:n}=this.props;e.preventDefault(),n(t),this.coordinates=t}handleEnd(e){const{onEnd:t}=this.props;e.preventDefault(),this.detach(),t()}handleCancel(e){const{onCancel:t}=this.props;e.preventDefault(),this.detach(),t()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}function fe(e){return Boolean(e&&"distance"in e)}function be(e){return Boolean(e&&"delay"in e)}ve.activators=[{eventName:"onKeyDown",handler:(e,{keyboardCodes:t=pe,onActivation:n})=>{const{code:r}=e.nativeEvent;return!!t.start.includes(r)&&(e.preventDefault(),null==n||n({event:e.nativeEvent}),!0)}}];class me{constructor(e,t,n=function(e){const{EventTarget:t}=o.getWindow(e);return e instanceof t?e:o.getOwnerDocument(e)}(e.event.target)){var r;this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=e,this.events=t;const{event:i}=e,{target:a}=i;this.props=e,this.events=t,this.document=o.getOwnerDocument(a),this.documentListeners=new se(this.document),this.listeners=new se(n),this.windowListeners=new se(o.getWindow(a)),this.initialCoordinates=null!=(r=o.getEventCoordinates(i))?r:x,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:e,props:{options:{activationConstraint:t}}}=this;if(this.listeners.add(e.move.name,this.handleMove,{passive:!1}),this.listeners.add(e.end.name,this.handleEnd),this.windowListeners.add(ce.Resize,this.handleCancel),this.windowListeners.add(ce.DragStart,ue),this.windowListeners.add(ce.VisibilityChange,this.handleCancel),this.windowListeners.add(ce.ContextMenu,ue),this.documentListeners.add(ce.Keydown,this.handleKeydown),t){if(fe(t))return;if(be(t))return void(this.timeoutId=setTimeout(this.handleStart,t.delay))}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),null!==this.timeoutId&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handleStart(){const{initialCoordinates:e}=this,{onStart:t}=this.props;e&&(this.activated=!0,this.documentListeners.add(ce.Click,he,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(ce.SelectionChange,this.removeTextSelection),t(e))}handleMove(e){var t;const{activated:n,initialCoordinates:r,props:i}=this,{onMove:a,options:{activationConstraint:s}}=i;if(!r)return;const l=null!=(t=o.getEventCoordinates(e))?t:x,c=o.subtract(r,l);if(!n&&s){if(be(s))return le(c,s.tolerance)?this.handleCancel():void 0;if(fe(s))return null!=s.tolerance&&le(c,s.tolerance)?this.handleCancel():le(c,s.distance)?this.handleStart():void 0}e.cancelable&&e.preventDefault(),a(l)}handleEnd(){const{onEnd:e}=this.props;this.detach(),e()}handleCancel(){const{onCancel:e}=this.props;this.detach(),e()}handleKeydown(e){e.code===exports.KeyboardCode.Esc&&this.handleCancel()}removeTextSelection(){var e;null==(e=this.document.getSelection())||e.removeAllRanges()}}const ye={move:{name:"pointermove"},end:{name:"pointerup"}};class xe extends me{constructor(e){const{event:t}=e,n=o.getOwnerDocument(t.target);super(e,ye,n)}}xe.activators=[{eventName:"onPointerDown",handler:({nativeEvent:e},{onActivation:t})=>!(!e.isPrimary||0!==e.button||(null==t||t({event:e}),0))}];const we={move:{name:"mousemove"},end:{name:"mouseup"}};var Ce;!function(e){e[e.RightClick=2]="RightClick"}(Ce||(Ce={}));class De extends me{constructor(e){super(e,we,o.getOwnerDocument(e.event.target))}}De.activators=[{eventName:"onMouseDown",handler:({nativeEvent:e},{onActivation:t})=>e.button!==Ce.RightClick&&(null==t||t({event:e}),!0)}];const Ee={move:{name:"touchmove"},end:{name:"touchend"}};class Re extends me{constructor(e){super(e,Ee)}static setup(){return window.addEventListener(Ee.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(Ee.move.name,e)};function e(){}}}function Se(e,{transform:t,...n}){return(null==e?void 0:e.length)?e.reduce((e,t)=>t({transform:e,...n}),t):t}Re.activators=[{eventName:"onTouchStart",handler:({nativeEvent:e},{onActivation:t})=>{const{touches:n}=e;return!(n.length>1||(null==t||t({event:e}),0))}}];const Me=[{sensor:xe,options:{}},{sensor:ve,options:{}}],Ne={current:{}},Ae=t.createContext({...x,scaleX:1,scaleY:1}),Le=t.memo((function({id:e,autoScroll:i=!0,announcements:s,children:c,sensors:d=Me,collisionDetection:u=A,measuring:h,modifiers:m,screenReaderInstructions:w=a,...C}){var D,E,R,M,N,L,O;const k=t.useReducer(f,void 0,v),[P,z]=k,[F,q]=t.useState(()=>({type:null,event:null})),[j,$]=t.useState(!1),{draggable:{active:X,nodes:_,translate:G},droppable:{containers:J}}=P,oe=X?_[X]:null,ie=t.useRef({initial:null,translated:null}),se=t.useMemo(()=>{var e;return null!=X?{id:X,data:null!=(e=null==oe?void 0:oe.data)?e:Ne,rect:ie}:null},[X,oe]),le=t.useRef(null),[ce,de]=t.useState(null),[ue,he]=t.useState(null),pe=o.useLatestValue(C,Object.values(C)),ge=o.useUniqueId("DndDescribedBy",e),ve=t.useMemo(()=>J.getEnabled(),[J]),{droppableRects:fe,measureDroppableContainers:be,measuringScheduled:me}=function(e,{dragging:n,dependencies:r,config:i}){const[a,s]=t.useState(null),l=null!=a,{frequency:c,measure:d,strategy:u}={...Z,...i},h=t.useRef(e),p=t.useCallback((e=[])=>s(t=>t?t.concat(e):e),[]),g=t.useRef(null),v=function(){switch(u){case exports.MeasuringStrategy.Always:return!1;case exports.MeasuringStrategy.BeforeDragging:return n;default:return!n}}(),f=o.useLazyMemo(t=>{if(v&&!n)return Q;const r=a;if(!t||t===Q||h.current!==e||null!=r){const t=new Map;for(let n of e){if(!n)continue;if(r&&r.length>0&&!r.includes(n.id)&&n.rect.current){t.set(n.id,n.rect.current);continue}const e=n.node.current,o=e?new Y(d(e),e):null;n.rect.current=o,o&&t.set(n.id,o)}return t}return t},[e,a,n,v,d]);return t.useEffect(()=>{h.current=e},[e]),t.useEffect(()=>{v||requestAnimationFrame(()=>p())},[n,v]),t.useEffect(()=>{l&&s(null)},[l]),t.useEffect(()=>{v||"number"!=typeof c||null!==g.current||(g.current=setTimeout(()=>{p(),g.current=null},c))},[c,v,p,...r]),{droppableRects:f,measureDroppableContainers:p,measuringScheduled:l}}(ve,{dragging:j,dependencies:[G.x,G.y],config:null==h?void 0:h.droppable}),ye=function(e,t){const n=null!==t?e[t]:void 0,r=n?n.node.current:null;return o.useLazyMemo(e=>{var n;return null===t?null:null!=(n=null!=r?r:e)?n:null},[r,t])}(_,X),xe=ue?o.getEventCoordinates(ue):null,we=re(ye,null!=(D=null==h||null==(E=h.draggable)?void 0:E.measure)?D:B),Ce=te(ye?ye.parentElement:null),De=t.useRef({active:null,activeNode:ye,collisionRect:null,collisions:null,droppableRects:fe,draggableNodes:_,draggingNode:null,draggingNodeRect:null,droppableContainers:J,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),Ee=J.getNodeFor(null==(R=De.current.over)?void 0:R.id),Re=function({measure:e=K}){const[n,r]=t.useState(null),i=t.useCallback(t=>{for(const{target:n}of t)if(o.isHTMLElement(n)){r(t=>{const r=e(n);return t?{...t,width:r.width,height:r.height}:r});break}},[e]),a=t.useMemo(()=>new ResizeObserver(i),[i]),s=t.useCallback(t=>{const n=ae(t);a.disconnect(),n&&a.observe(n),r(n?e(n):null)},[e,a]),[l,c]=o.useNodeRef(s);return t.useMemo(()=>({nodeRef:l,rect:n,setRef:c}),[n,l,c])}({measure:null==h||null==(M=h.dragOverlay)?void 0:M.measure}),Le=null!=(N=Re.nodeRef.current)?N:ye,Oe=null!=(L=Re.rect)?L:we,Te=t.useRef(null),ke=Oe===we?(Be=Te.current,(Ke=we)&&Be?{x:Ke.left-Be.left,y:Ke.top-Be.top}:x):x;var Ke,Be;const Ie=t.useMemo(()=>We?function(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}(We):null,[We=Le?Le.ownerDocument.defaultView:null]);var We;const Pe=function(e){const n=t.useRef(e),r=o.useLazyMemo(t=>e?t&&e&&n.current&&e.parentNode===n.current.parentNode?t:I(e):ee,[e]);return t.useEffect(()=>{n.current=e},[e]),r}(X?null!=Ee?Ee:Le:null),ze=ne(Pe),Ue=Se(m,{transform:{x:G.x-ke.x,y:G.y-ke.y,scaleX:1,scaleY:1},activatorEvent:ue,active:se,activeNodeRect:we,containerNodeRect:Ce,draggingNodeRect:Oe,over:De.current.over,overlayNodeRect:Re.rect,scrollableAncestors:Pe,scrollableAncestorRects:ze,windowRect:Ie}),Fe=xe?o.add(xe,G):null,qe=function(e){const[n,r]=t.useState(null),i=t.useRef(e),a=t.useCallback(e=>{const t=W(e.target);t&&r(e=>e?(e.set(t,U(t)),new Map(e)):null)},[]);return t.useEffect(()=>{const t=i.current;if(e!==t){n(t);const o=e.map(e=>{const t=W(e);return t?(t.addEventListener("scroll",a,{passive:!0}),[t,U(t)]):null}).filter(e=>null!=e);r(o.length?new Map(o):null),i.current=e}return()=>{n(e),n(t)};function n(e){e.forEach(e=>{const t=W(e);null==t||t.removeEventListener("scroll",a)})}},[a,e]),t.useMemo(()=>e.length?n?Array.from(n.values()).reduce((e,t)=>o.add(e,t),x):V(e):x,[e,n])}(Pe),je=o.add(Ue,qe),He=Oe?T(Oe,Ue):null,$e=se&&He?u({active:se,collisionRect:He,droppableContainers:ve,pointerCoordinates:Fe}):null,Ve=S($e,"id"),[Xe,Ye]=t.useState(null),_e=function(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}(Ue,null!=(O=null==Xe?void 0:Xe.rect)?O:null,we),Ge=t.useCallback((e,{sensor:t,options:n})=>{if(!le.current)return;const o=_[le.current];if(!o)return;const i=new t({active:le.current,activeNode:o,event:e.nativeEvent,options:n,context:De,onStart(e){const t=le.current;if(!t)return;const n=_[t];if(!n)return;const{onDragStart:o}=pe.current,i={active:{id:t,data:n.data,rect:ie}};r.unstable_batchedUpdates(()=>{z({type:l.DragStart,initialCoordinates:e,active:t}),q({type:l.DragStart,event:i})}),null==o||o(i)},onMove(e){z({type:l.DragMove,coordinates:e})},onEnd:a(l.DragEnd),onCancel:a(l.DragCancel)});function a(e){return async function(){const{active:t,collisions:n,over:o,scrollAdjustedTranslate:i}=De.current;let a=null;if(t&&i){const{cancelDrop:r}=pe.current;a={active:t,collisions:n,delta:i,over:o},e===l.DragEnd&&"function"==typeof r&&await Promise.resolve(r(a))&&(e=l.DragCancel)}le.current=null,r.unstable_batchedUpdates(()=>{if(z({type:e}),Ye(null),$(!1),de(null),he(null),a&&q({type:e,event:a}),a){const{onDragCancel:t,onDragEnd:n}=pe.current,r=e===l.DragEnd?n:t;null==r||r(a)}})}}r.unstable_batchedUpdates(()=>{de(i),he(e.nativeEvent)})},[_]),Je=function(e,n){return t.useMemo(()=>e.reduce((e,t)=>{const{sensor:r}=t;return[...e,...r.activators.map(e=>({eventName:e.eventName,handler:n(e.handler,t)}))]},[]),[e,n])}(d,t.useCallback((e,t)=>(n,r)=>{const o=n.nativeEvent;null!==le.current||o.dndKit||o.defaultPrevented||!0===e(n,t.options)&&(o.dndKit={capturedBy:t.sensor},le.current=r,Ge(n,t))},[Ge]));!function(e){t.useEffect(()=>{if(!o.canUseDOM)return;const t=e.map(({sensor:e})=>null==e.setup?void 0:e.setup());return()=>{for(const e of t)null==e||e()}},e.map(({sensor:e})=>e))}(d),t.useEffect(()=>{null!=X&&$(!0)},[X]),t.useEffect(()=>{se||(Te.current=null),se&&we&&!Te.current&&(Te.current=we)},[we,se]),t.useEffect(()=>{const{onDragMove:e}=pe.current,{active:t,collisions:n,over:r}=De.current;if(!t)return;const o={active:t,collisions:n,delta:{x:je.x,y:je.y},over:r};q({type:l.DragMove,event:o}),null==e||e(o)},[je.x,je.y]),t.useEffect(()=>{const{active:e,collisions:t,droppableContainers:n,scrollAdjustedTranslate:o}=De.current;if(!e||!le.current||!o)return;const{onDragOver:i}=pe.current,a=n.get(Ve),s=a&&a.rect.current?{id:a.id,rect:a.rect.current,data:a.data,disabled:a.disabled}:null,c={active:e,collisions:t,delta:{x:o.x,y:o.y},over:s};r.unstable_batchedUpdates(()=>{Ye(s),q({type:l.DragOver,event:c}),null==i||i(c)})},[Ve]),o.useIsomorphicLayoutEffect(()=>{De.current={active:se,activeNode:ye,collisionRect:He,collisions:$e,droppableRects:fe,draggableNodes:_,draggingNode:Le,draggingNodeRect:Oe,droppableContainers:J,over:Xe,scrollableAncestors:Pe,scrollAdjustedTranslate:je},ie.current={initial:Oe,translated:He}},[se,ye,$e,He,_,Le,Oe,fe,J,Xe,Pe,je]),function({acceleration:e,activator:n=exports.AutoScrollActivator.Pointer,canScroll:r,draggingRect:i,enabled:a,interval:s=5,order:l=exports.TraversalOrder.TreeOrder,pointerCoordinates:c,scrollableAncestors:d,scrollableAncestorRects:u,threshold:h}){const[p,g]=o.useInterval(),v=t.useRef({x:1,y:1}),f=t.useMemo(()=>{switch(n){case exports.AutoScrollActivator.Pointer:return c?{top:c.y,bottom:c.y,left:c.x,right:c.x}:null;case exports.AutoScrollActivator.DraggableRect:return i}return null},[n,i,c]),b=t.useRef(x),m=t.useRef(null),y=t.useCallback(()=>{const e=m.current;e&&e.scrollBy(v.current.x*b.current.x,v.current.y*b.current.y)},[]),w=t.useMemo(()=>l===exports.TraversalOrder.TreeOrder?[...d].reverse():d,[l,d]);t.useEffect(()=>{if(a&&d.length&&f){for(const t of w){if(!1===(null==r?void 0:r(t)))continue;const n=d.indexOf(t),o=u[n];if(!o)continue;const{direction:i,speed:a}=H(t,o,f,e,h);if(a.x>0||a.y>0)return g(),m.current=t,p(y,s),v.current=a,void(b.current=i)}v.current={x:0,y:0},b.current={x:0,y:0},g()}else g()},[e,y,r,g,a,s,JSON.stringify(f),p,d,w,u,JSON.stringify(h)])}({...function(){const e=!(!1===(null==ce?void 0:ce.autoScrollEnabled)||("object"==typeof i?!1===i.enabled:!1===i));return"object"==typeof i?{...i,enabled:e}:{enabled:e}}(),draggingRect:He,pointerCoordinates:Fe,scrollableAncestors:Pe,scrollableAncestorRects:ze});const Qe=t.useMemo(()=>({active:se,activeNode:ye,activeNodeRect:we,activatorEvent:ue,collisions:$e,containerNodeRect:Ce,dragOverlay:Re,draggableNodes:_,droppableContainers:J,droppableRects:fe,over:Xe,measureDroppableContainers:be,scrollableAncestors:Pe,scrollableAncestorRects:ze,measuringScheduled:me,windowRect:Ie}),[se,ye,we,ue,$e,Ce,Re,_,J,fe,Xe,be,Pe,ze,me,Ie]),Ze=t.useMemo(()=>({activatorEvent:ue,activators:Je,active:se,activeNodeRect:we,ariaDescribedById:{draggable:ge},dispatch:z,draggableNodes:_,over:Xe,measureDroppableContainers:be}),[ue,Je,se,we,z,ge,_,Xe,be]);return n.createElement(b.Provider,{value:F},n.createElement(p.Provider,{value:Ze},n.createElement(g.Provider,{value:Qe},n.createElement(Ae.Provider,{value:_e},c))),n.createElement(y,{announcements:s,hiddenTextDescribedById:ge,screenReaderInstructions:w}))})),Oe=t.createContext(null),Te="button";function ke(){return t.useContext(g)}const Ke={timeout:25},Be={duration:250,easing:"ease",dragSourceOpacity:0},Ie={x:0,y:0,scaleX:1,scaleY:1},We=e=>o.isKeyboardEvent(e)?"transform 250ms ease":void 0,Pe=n.memo(({adjustScale:e=!1,children:r,dropAnimation:i=Be,style:a,transition:s=We,modifiers:l,wrapperElement:c="div",className:d,zIndex:u=999})=>{var g,v;const{active:f,activeNodeRect:b,containerNodeRect:m,draggableNodes:y,activatorEvent:x,over:w,dragOverlay:D,scrollableAncestors:E,scrollableAncestorRects:R,windowRect:S}=ke(),M=t.useContext(Ae),N=Se(l,{activatorEvent:x,active:f,activeNodeRect:b,containerNodeRect:m,draggingNodeRect:D.rect,over:w,overlayNodeRect:D.rect,scrollableAncestors:E,scrollableAncestorRects:R,transform:M,windowRect:S}),A=null!==f,L=e?N:{...N,scaleX:1,scaleY:1},O=o.useLazyMemo(e=>A?e||(b?{...b}:null):null,[A,b]),T=O?{position:"fixed",width:O.width,height:O.height,top:O.top,left:O.left,zIndex:u,transform:o.CSS.Transform.toString(L),touchAction:"none",transformOrigin:e&&x?C(x,O):void 0,transition:"function"==typeof s?s(x):s,...a}:void 0,k=A?{style:T,children:r,className:d,transform:L}:void 0,K=t.useRef(k),I=null!=k?k:K.current,{children:W,...P}=null!=I?I:{},z=t.useRef(null!=(g=null==f?void 0:f.id)?g:null),U=function({animate:e,adjustScale:n,activeId:r,draggableNodes:i,duration:a,dragSourceOpacity:s,easing:l,node:c,transform:d}){const[u,h]=t.useState(!1);return o.useIsomorphicLayoutEffect(()=>{var t;if(!(e&&r&&l&&a))return void(e&&h(!0));const u=null==(t=i[r])?void 0:t.node.current;if(d&&c&&u&&null!==u.parentNode){const e=ae(c);if(e){const t=e.getBoundingClientRect(),r=B(u),i={x:t.left-r.left,y:t.top-r.top};if(Math.abs(i.x)||Math.abs(i.y)){const e=o.CSS.Transform.toString({x:d.x-i.x,y:d.y-i.y,scaleX:n?r.width*d.scaleX/t.width:1,scaleY:n?r.height*d.scaleY/t.height:1}),p=u.style.opacity;return null!=s&&(u.style.opacity=""+s),void(c.animate([{transform:o.CSS.Transform.toString(d)},{transform:e}],{easing:l,duration:a}).onfinish=()=>{c.style.display="none",h(!0),u&&null!=s&&(u.style.opacity=p)})}}}h(!0)},[e,r,n,i,a,l,s,c,d]),o.useIsomorphicLayoutEffect(()=>{u&&h(!1)},[u]),u}({animate:Boolean(i&&z.current&&!f),adjustScale:e,activeId:z.current,draggableNodes:y,duration:null==i?void 0:i.duration,easing:null==i?void 0:i.easing,dragSourceOpacity:null==i?void 0:i.dragSourceOpacity,node:D.nodeRef.current,transform:null==(v=K.current)?void 0:v.transform}),F=Boolean(W&&(r||i&&!U));return t.useEffect(()=>{var e;(null==f?void 0:f.id)!==z.current&&(z.current=null!=(e=null==f?void 0:f.id)?e:null),f&&K.current!==k&&(K.current=k)},[f,k]),t.useEffect(()=>{U&&(K.current=void 0)},[U]),F?n.createElement(p.Provider,{value:h},n.createElement(Ae.Provider,{value:Ie},n.createElement(c,{...P,ref:D.setRef},W))):null});exports.DndContext=Le,exports.DragOverlay=Pe,exports.KeyboardSensor=ve,exports.MouseSensor=De,exports.PointerSensor=xe,exports.TouchSensor=Re,exports.applyModifiers=Se,exports.closestCenter=({collisionRect:e,droppableContainers:t})=>{const n=M(e,e.left,e.top),r=[];for(const e of t){const{id:t,rect:{current:o}}=e;if(o){const i=w(M(o),n);r.push({id:t,data:{droppableContainer:e,value:i}})}}return r.sort(D)},exports.closestCorners=({collisionRect:e,droppableContainers:t})=>{const n=R(e),r=[];for(const e of t){const{id:t,rect:{current:o}}=e;if(o){const i=R(o),a=n.reduce((e,t,n)=>e+w(i[n],t),0),s=Number((a/4).toFixed(4));r.push({id:t,data:{droppableContainer:e,value:s}})}}return r.sort(D)},exports.defaultAnnouncements=s,exports.defaultCoordinates=x,exports.defaultDropAnimation=Be,exports.getClientRect=K,exports.getFirstCollision=S,exports.getScrollableAncestors=I,exports.pointerWithin=({droppableContainers:e,pointerCoordinates:t})=>{if(!t)return[];const n=[];for(const r of e){const{id:e,rect:{current:o}}=r;if(o&&L(t,o)){const i=R(o).reduce((e,n)=>e+w(t,n),0),a=Number((i/4).toFixed(4));n.push({id:e,data:{droppableContainer:r,value:a}})}}return n.sort(D)},exports.rectIntersection=A,exports.useDndContext=ke,exports.useDndMonitor=m,exports.useDraggable=function({id:e,data:n,disabled:r=!1,attributes:i}){const a=o.useUniqueId("Droppable"),{activators:s,activatorEvent:l,active:c,activeNodeRect:d,ariaDescribedById:u,draggableNodes:h,over:g}=t.useContext(p),{role:v=Te,roleDescription:f="draggable",tabIndex:b=0}=null!=i?i:{},m=(null==c?void 0:c.id)===e,y=t.useContext(m?Ae:Oe),[x,w]=o.useNodeRef(),C=function(e,n){return t.useMemo(()=>e.reduce((e,{eventName:t,handler:r})=>(e[t]=e=>{r(e,n)},e),{}),[e,n])}(s,e),D=o.useLatestValue(n);return o.useIsomorphicLayoutEffect(()=>(h[e]={id:e,key:a,node:x,data:D},()=>{const t=h[e];t&&t.key===a&&delete h[e]}),[h,e]),{active:c,activatorEvent:l,activeNodeRect:d,attributes:t.useMemo(()=>({role:v,tabIndex:b,"aria-pressed":!(!m||v!==Te)||void 0,"aria-roledescription":f,"aria-describedby":u.draggable}),[v,b,m,f,u.draggable]),isDragging:m,listeners:r?void 0:C,node:x,over:g,setNodeRef:w,transform:y}},exports.useDroppable=function({data:e,disabled:n=!1,id:r,resizeObserverConfig:i}){const a=o.useUniqueId("Droppable"),{active:s,dispatch:c,over:d,measureDroppableContainers:u}=t.useContext(p),h=t.useRef(!1),g=t.useRef(null),v=t.useRef(null),{disabled:f,updateMeasurementsFor:b,timeout:m}={...Ke,...i},y=o.useLatestValue(null!=b?b:r),x=t.useCallback(()=>{h.current?(null!=v.current&&clearTimeout(v.current),v.current=setTimeout(()=>{u("string"==typeof y.current?[y.current]:y.current),v.current=null},m)):h.current=!0},[m]),w=t.useMemo(()=>!s||f?null:new ResizeObserver(x),[s,x,f]),C=t.useCallback((e,t)=>{w&&(t&&(w.unobserve(t),h.current=!1),e&&w.observe(e))},[w]),[D,E]=o.useNodeRef(C),R=o.useLatestValue(e);return t.useEffect(()=>{w&&D.current&&(w.disconnect(),h.current=!1,w.observe(D.current))},[D,w]),o.useIsomorphicLayoutEffect(()=>(c({type:l.RegisterDroppable,element:{id:r,key:a,disabled:n,node:D,rect:g,data:R}}),()=>c({type:l.UnregisterDroppable,key:a,id:r})),[r]),t.useEffect(()=>{c({type:l.SetDroppableDisabled,id:r,key:a,disabled:n})},[n]),{active:s,rect:g,isOver:(null==d?void 0:d.id)===r,node:D,over:d,setNodeRef:E}},exports.useSensor=function(e,n){return t.useMemo(()=>({sensor:e,options:null!=n?n:{}}),[e,n])},exports.useSensors=function(...e){return t.useMemo(()=>[...e].filter(e=>null!=e),[...e])};
//# sourceMappingURL=core.cjs.production.min.js.map

@@ -18,2 +18,3 @@ /// <reference types="react" />

active: import("../store").Active | null;
activatorEvent: Event | null;
activeNodeRect: import("..").ClientRect | null;

@@ -20,0 +21,0 @@ attributes: {

@@ -81,2 +81,3 @@ import type { MutableRefObject } from 'react';

export interface InternalContextDescriptor {
activatorEvent: Event | null;
activators: SyntheticListeners;

@@ -83,0 +84,0 @@ active: Active | null;

{
"name": "@dnd-kit/core",
"version": "5.0.0-next-20220101438",
"version": "5.0.0-next-202201015122",
"description": "dnd kit – a lightweight React library for building performant and accessible drag and drop experiences",

@@ -35,3 +35,3 @@ "author": "Claudéric Demers",

"@dnd-kit/accessibility": "^3.0.0",
"@dnd-kit/utilities": "^3.1.0-next-20220101438"
"@dnd-kit/utilities": "^3.1.0-next-202201015122"
},

@@ -38,0 +38,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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc