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 3.0.0 to 3.0.1

6

CHANGELOG.md
# @dnd-kit/core
## 3.0.1
### Patch Changes
- [`f9ec28f`](https://github.com/clauderic/dnd-kit/commit/f9ec28fed77778669f93cfecee159dba54db38b4) [#217](https://github.com/clauderic/dnd-kit/pull/217) Thanks [@clauderic](https://github.com/clauderic)! - Fixes a regression introduced with `@dnd-kit/core@3.0.0` that was causeing sensors to stop working after a drag operation where activation constraints were not met.
## 3.0.0

@@ -4,0 +10,0 @@

2

dist/core.cjs.production.min.js

@@ -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"),a=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 "},i={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(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={}));const c=e=>u(e,(e,t)=>e<t);function u(e,t){if(0===e.length)return-1;let n=e[0],r=0;for(var o=1;o<e.length;o++)t(e[o],n)&&(r=o,n=e[o]);return r}function d(...e){}function f(e,t){const{[e]:n,...r}=t;return r}const p=t.createContext({activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,activeNodeClientRect:null,activators:[],ariaDescribedById:{draggable:""},containerNodeRect:null,dispatch:d,draggableNodes:{},droppableRects:new Map,droppableContainers:{},over:null,overlayNode:{nodeRef:{current:null},rect:null,setRef:d},scrollableAncestors:[],scrollableAncestorRects:[],recomputeLayouts:d,windowRect:null,willRecomputeLayouts:!1}),h=Object.freeze({x:0,y:0});function g(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function v(e){if(function(e){var t;return(null==(t=window)?void 0:t.TouchEvent)&&e instanceof TouchEvent}(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}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 y(e,t){if(e instanceof KeyboardEvent)return"0 0";const n=v(e);return`${(n.x-t.left)/t.width*100}% ${(n.y-t.top)/t.height*100}%`}function b(e,t=e.offsetLeft,n=e.offsetTop){return{x:t+.5*e.width,y:n+.5*e.height}}function m(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,offsetLeft:t.offsetLeft+e*n.x,offsetTop:t.offsetTop+e*n.y}),{...t})}}const x=m(1);function w(e){const 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){const t=window.getComputedStyle(e),n=/(auto|scroll)/;return null!=["overflow","overflowX","overflowY"].find(e=>{const r=t[e];return"string"==typeof r&&n.test(r)})}(n)&&t.push(n),e(n.parentNode)):t}(e.parentNode):t}function D(e){return o.canUseDOM?e===document.scrollingElement||e instanceof Document?window:e instanceof HTMLElement?e:null:null}function R(e){return e instanceof Window?{x:e.scrollX,y:e.scrollY}:{x:e.scrollLeft,y:e.scrollTop}}var C;function E(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"}(C||(C={}));const M={x:.2,y:.2};function S(e,t,{top:n,left:r,right:a,bottom:s},i=10,l=M){const{clientHeight:c,clientWidth:u}=e,d=(f=e,o.canUseDOM&&f&&f===document.scrollingElement?{top:0,left:0,right:u,bottom:c,width:u,height:c}:t);var f;const{isTop:p,isBottom:h,isLeft:g,isRight:v}=E(e),y={x:0,y:0},b={x:0,y:0},m=d.height*l.y,x=d.width*l.x;return!p&&n<=d.top+m?(y.y=C.Backward,b.y=i*Math.abs((d.top+m-n)/m)):!h&&s>=d.bottom-m&&(y.y=C.Forward,b.y=i*Math.abs((d.bottom-m-s)/m)),!v&&a>=d.right-x?(y.x=C.Forward,b.x=i*Math.abs((d.right-x-a)/x)):!g&&r<=d.left+x&&(y.x=C.Backward,b.x=i*Math.abs((d.left+x-r)/x)),{direction:y,speed:b}}function L(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 N(e){return e.reduce((e,t)=>o.add(e,R(t)),h)}function T(e){const{offsetWidth:t,offsetHeight:n}=e,{x:r,y:o}=function e(t,n,r=h){if(!(t&&t instanceof HTMLElement))return r;const 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:o,offsetLeft:r}}function A(e){if(e instanceof Window){const e=window.innerWidth,t=window.innerHeight;return{top:0,left:0,right:e,bottom:t,width:e,height:t,offsetTop:0,offsetLeft:0}}const{offsetTop:t,offsetLeft:n}=T(e),{width:r,height:o,top:a,bottom:s,left:i,right:l}=e.getBoundingClientRect();return{width:r,height:o,top:a,bottom:s,right:l,left:i,offsetTop:t,offsetLeft:n}}function K(e){const{width:t,height:n,offsetTop:r,offsetLeft:o}=T(e),a=N(w(e)),s=r-a.y,i=o-a.x;return{width:t,height:n,top:s,bottom:s+n,right:i+t,left:i,offsetTop:r,offsetLeft:o}}function O(e){return"top"in e}function B(e,t=e.offsetLeft,n=e.offsetTop){return[{x:t,y:n},{x:t+e.width,y:n},{x:t,y:n+e.height},{x:t+e.width,y:n+e.height}]}const I=(e,t)=>{const n=e.map(([e,n])=>function(e,t){const 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){const s=(o-r)*(a-n);return Number((s/(t.width*t.height+e.width*e.height-s)).toFixed(4))}return 0}(n,t)),r=u(n,(e,t)=>e>t);return n[r]<=0?null:e[r]?e[r][0]:null};function k(e){return e instanceof HTMLElement?e.ownerDocument:document}function P(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:{},translate:{x:0,y:0}},droppable:{containers:{}}}}function j(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;return{...e,droppable:{...e.droppable,containers:{...e.droppable.containers,[r]:n}}}}case l.SetDroppableDisabled:{const{id:n,disabled:r}=t,o=e.droppable.containers[n];return o?{...e,droppable:{...e.droppable,containers:{...e.droppable.containers,[n]:{...o,disabled:r}}}}:e}case l.UnregisterDroppable:{const{id:n}=t;return{...e,droppable:{...e.droppable,containers:f(n,e.droppable.containers)}}}default:return e}}const q=t.createContext({type:null,event:null});function H({onDragStart:e,onDragMove:n,onDragOver:r,onDragEnd:o,onDragCancel:a}){const s=t.useContext(q),i=t.useRef(s);t.useEffect(()=>{if(s!==i.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==a||a(c);break;case l.DragEnd:null==o||o(c)}i.current=s}},[s,e,n,r,o,a])}function z({announcements:e=i,hiddenTextDescribedById:s,screenReaderInstructions:l}){const{announce:c,announcement:u}=a.useAnnouncement(),d=o.useUniqueId("DndLiveRegion");return H(t.useMemo(()=>({onDragStart({active:t}){c(e.onDragStart(t.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])),o.canUseDOM?r.createPortal(n.createElement(n.Fragment,null,n.createElement(a.HiddenText,{id:s,value:l.draggable}),n.createElement(a.LiveRegion,{id:d,announcement:u})),document.body):null}var U,W,F;function X(e){const n=t.useRef(e);return o.useIsomorphicLayoutEffect(()=>{n.current!==e&&(n.current=e)},[e]),n}(U=exports.AutoScrollActivator||(exports.AutoScrollActivator={}))[U.Pointer=0]="Pointer",U[U.DraggableRect=1]="DraggableRect",(W=exports.TraversalOrder||(exports.TraversalOrder={}))[W.TreeOrder=0]="TreeOrder",W[W.ReversedTreeOrder=1]="ReversedTreeOrder",(F=exports.LayoutMeasuringStrategy||(exports.LayoutMeasuringStrategy={}))[F.Always=0]="Always",F[F.BeforeDragging=1]="BeforeDragging",F[F.WhileDragging=2]="WhileDragging",(exports.LayoutMeasuringFrequency||(exports.LayoutMeasuringFrequency={})).Optimized="optimized";const Y=new Map,$={strategy:exports.LayoutMeasuringStrategy.WhileDragging,frequency:exports.LayoutMeasuringFrequency.Optimized},V=[],G=Q(A),J=Z(A),_=Q(K);function Q(e){return function(n,r){const a=t.useRef(n);return o.useLazyMemo(t=>n?r||!t&&n||n!==a.current?n instanceof HTMLElement&&null==n.parentNode?null:e(n):null!=t?t:null:null,[n,r])}}function Z(e){const n=[];return function(r,a){const s=t.useRef(r);return o.useLazyMemo(t=>r.length?a||!t&&r.length||r!==s.current?r.map(t=>e(t)):null!=t?t:n:n,[r,a])}}class ee{constructor(e){this.target=e,this.listeners=[]}add(e,t,n){this.target.addEventListener(e,t,n),this.listeners.push({eventName:e,handler:t})}removeAll(){this.listeners.forEach(({eventName:e,handler:t})=>this.target.removeEventListener(e,t))}}function te(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 ne;(ne=exports.KeyboardCode||(exports.KeyboardCode={})).Space="Space",ne.Down="ArrowDown",ne.Right="ArrowRight",ne.Left="ArrowLeft",ne.Up="ArrowUp",ne.Esc="Escape",ne.Enter="Enter";const re={start:[exports.KeyboardCode.Space,exports.KeyboardCode.Enter],cancel:[exports.KeyboardCode.Esc],end:[exports.KeyboardCode.Space,exports.KeyboardCode.Enter]},oe=(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 ae{constructor(e){this.props=e,this.autoScrollEnabled=!1,this.coordinates=h;const{event:{target:t}}=e;this.props=e,this.listeners=new ee(k(t)),this.windowListeners=new ee(function(e){var t;return null!=(t=k(e).defaultView)?t:window}(t)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),setTimeout(()=>{this.listeners.add("keydown",this.handleKeyDown),this.windowListeners.add("resize",this.handleCancel)})}handleStart(){const{activeNode:e,onStart:t}=this.props;if(!e.node.current)throw new Error("Active draggable node is undefined");const n=A(e.node.current),r={x:n.left,y:n.top};this.coordinates=r,t(r)}handleKeyDown(e){if(e instanceof KeyboardEvent){const{coordinates:t}=this,{active:n,context:r,options:a}=this.props,{keyboardCodes:s=re,coordinateGetter:i=oe,scrollBehavior:l="smooth"}=a,{code:c}=e;if(s.end.includes(c))return void this.handleEnd(e);if(s.cancel.includes(c))return void this.handleCancel(e);const u=i(e,{active:n,context:r.current,currentCoordinates:t});if(u){const n={x:0,y:0},{scrollableAncestors:a}=r.current;for(const r of a){const a=e.code,s=o.subtract(u,t),{isTop:i,isRight:c,isLeft:d,isBottom:f,maxScroll:p,minScroll:h}=E(r),g=L(r),v={x:Math.min(a===exports.KeyboardCode.Right?g.right-g.width/2:g.right,Math.max(a===exports.KeyboardCode.Right?g.left:g.left+g.width/2,u.x)),y:Math.min(a===exports.KeyboardCode.Down?g.bottom-g.height/2:g.bottom,Math.max(a===exports.KeyboardCode.Down?g.top:g.top+g.height/2,u.y))},y=a===exports.KeyboardCode.Right&&!c||a===exports.KeyboardCode.Left&&!d,b=a===exports.KeyboardCode.Down&&!f||a===exports.KeyboardCode.Up&&!i;if(y&&v.x!==u.x){if(a===exports.KeyboardCode.Right&&r.scrollLeft+s.x<=p.x||a===exports.KeyboardCode.Left&&r.scrollLeft+s.x>=h.x)return void r.scrollBy({left:s.x,behavior:l});n.x=a===exports.KeyboardCode.Right?r.scrollLeft-p.x:r.scrollLeft-h.x,r.scrollBy({left:-n.x,behavior:l});break}if(b&&v.y!==u.y){if(a===exports.KeyboardCode.Down&&r.scrollTop+s.y<=p.y||a===exports.KeyboardCode.Up&&r.scrollTop+s.y>=h.y)return void r.scrollBy({top:s.y,behavior:l});n.y=a===exports.KeyboardCode.Down?r.scrollTop-p.y:r.scrollTop-h.y,r.scrollBy({top:-n.y,behavior:l});break}}this.handleMove(e,o.add(u,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 se(e){return Boolean(e&&"distance"in e)}function ie(e){return Boolean(e&&"delay"in e)}var le;ae.activators=[{eventName:"onKeyDown",handler:(e,{keyboardCodes:t=re,onActivation:n})=>{const{code:r}=e.nativeEvent;return!!t.start.includes(r)&&(e.preventDefault(),null==n||n({event:e.nativeEvent}),!0)}}],function(e){e.Keydown="keydown"}(le||(le={}));class ce{constructor(e,t,n=function(e){return e instanceof HTMLElement?e:k(e)}(e.event.target)){this.props=e,this.events=t,this.autoScrollEnabled=!0,this.activated=!1,this.timeoutId=null;const{event:r}=e;this.props=e,this.events=t,this.ownerDocument=k(r.target),this.listeners=new ee(n),this.initialCoordinates=v(r),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()}attach(){const{events:e,props:{options:{activationConstraint:t}}}=this;if(this.listeners.add(e.move.name,this.handleMove,!1),this.listeners.add(e.end.name,this.handleEnd),this.ownerDocument.addEventListener(le.Keydown,this.handleKeydown),t){if(se(t))return;if(ie(t))return void(this.timeoutId=setTimeout(this.handleStart,t.delay))}this.handleStart()}detach(){this.listeners.removeAll(),this.ownerDocument.removeEventListener(le.Keydown,this.handleKeydown),null!==this.timeoutId&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handleStart(){const{initialCoordinates:e}=this,{onStart:t}=this.props;e&&(this.activated=!0,t(e))}handleMove(e){const{activated:t,initialCoordinates:n,props:r}=this,{onMove:a,options:{activationConstraint:s}}=r;if(!n)return;const i=v(e),l=o.subtract(n,i);if(!t&&s){if(ie(s))return te(l,s.tolerance)?this.handleCancel():void 0;if(se(s))return te(l,s.distance)?this.handleStart():void 0}e.cancelable&&e.preventDefault(),a(i)}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()}}const ue={move:{name:"pointermove"},end:{name:"pointerup"}};class de extends ce{constructor(e){const{event:t}=e,n=k(t.target);super(e,ue,n)}}de.activators=[{eventName:"onPointerDown",handler:({nativeEvent:e},{onActivation:t})=>!(!e.isPrimary||0!==e.button||(null==t||t({event:e}),0))}];const fe={move:{name:"mousemove"},end:{name:"mouseup"}};var pe;!function(e){e[e.RightClick=2]="RightClick"}(pe||(pe={}));class he extends ce{constructor(e){super(e,fe,k(e.event.target))}}he.activators=[{eventName:"onMouseDown",handler:({nativeEvent:e},{onActivation:t})=>e.button!==pe.RightClick&&(null==t||t({event:e}),!0)}];const ge={move:{name:"touchmove"},end:{name:"touchend"}};class ve extends ce{constructor(e){super(e,ge)}}function ye(e,{transform:t,...n}){return(null==e?void 0:e.length)?e.reduce((e,t)=>t({transform:e,...n}),t):t}ve.activators=[{eventName:"onTouchStart",handler:({nativeEvent:e},{onActivation:t})=>{const{touches:n}=e;return!(n.length>1||(null==t||t({event:e}),0))}}];const be=[{sensor:de,options:{}},{sensor:ae,options:{}}],me={current:{}},xe=t.createContext({...h,scaleX:1,scaleY:1}),we=t.memo((function({autoScroll:e=!0,announcements:r,children:a,sensors:i=be,collisionDetection:c=I,layoutMeasuring:u,modifiers:d,screenReaderInstructions:f=s,...g}){var y,b,m;const C=t.useReducer(j,void 0,P),[E,M]=C,[L,A]=t.useState(()=>({type:null,event:null})),{draggable:{active:K,nodes:O,translate:B},droppable:{containers:k}}=E,H=K?O[K]:null,U=t.useRef({initial:null,translated:null}),W=t.useMemo(()=>{var e;return null!=K?{id:K,data:null!=(e=null==H?void 0:H.data)?e:me,rect:U}:null},[K,H]),F=t.useRef(null),[X,Q]=t.useState(null),[Z,ee]=t.useState(null),te=t.useRef(g),ne=o.useUniqueId("DndDescribedBy"),{layoutRectMap:re,recomputeLayouts:oe,willRecomputeLayouts:ae}=function(e,{dragging:n,dependencies:r,config:a}){const[s,i]=t.useState(!1),{frequency:l,strategy:c}=(u=a)?{...$,...u}:$;var u;const d=t.useRef(e),f=t.useCallback(()=>i(!0),[]),p=t.useRef(null),h=function(){switch(c){case exports.LayoutMeasuringStrategy.Always:return!1;case exports.LayoutMeasuringStrategy.BeforeDragging:return n;default:return!n}}(),g=o.useLazyMemo(t=>{if(h&&!n)return Y;if(!t||t===Y||d.current!==e||s){for(let t of Object.values(e))t&&(t.rect.current=t.node.current?T(t.node.current):null);return function(e){const t=new Map;if(e)for(const n of Object.values(e)){if(!n)continue;const{id:e,rect:r,disabled:o}=n;o||null==r.current||t.set(e,r.current)}return t}(e)}return t},[e,n,h,s]);return t.useEffect(()=>{d.current=e},[e]),t.useEffect(()=>{s&&i(!1)},[s]),t.useEffect((function(){h||requestAnimationFrame(f)}),[n,h]),t.useEffect((function(){h||"number"!=typeof l||null!==p.current||(p.current=setTimeout(()=>{f(),p.current=null},l))}),[l,h,f,...r]),{layoutRectMap:g,recomputeLayouts:f,willRecomputeLayouts:s}}(k,{dragging:null!=K,dependencies:[B.x,B.y],config:u}),se=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])}(O,K),ie=Z?v(Z):null,le=_(se),ce=G(se),ue=t.useRef(null),de=(pe=ue.current,(fe=le)&&pe?{x:fe.left-pe.left,y:fe.top-pe.top}:h);var fe,pe;const he=t.useRef({active:null,activeNode:se,collisionRect:null,droppableRects:re,draggableNodes:O,draggingNodeRect:null,droppableContainers:k,over:null,scrollableAncestors:[],scrollAdjustedTransalte:null,translatedRect:null}),ge=function(e,t){var n,r;return e&&null!=(n=null==(r=t[e])?void 0:r.node.current)?n:null}(null!=(y=null==(b=he.current.over)?void 0:b.id)?y:null,k),ve=G(se?se.ownerDocument.defaultView:null),we=G(se?se.parentElement:null),De=function(e){const n=t.useRef(e),r=o.useLazyMemo(t=>e?t&&e&&n.current&&e.parentNode===n.current.parentNode?t:w(e):V,[e]);return t.useEffect(()=>{n.current=e},[e]),r}(K?null!=ge?ge:se:null),Re=J(De),[Ce,Ee]=o.useNodeRef(),Me=G(K?Ce.current:null,ae),Se=null!=Me?Me:ce,Le=ye(d,{transform:{x:B.x-de.x,y:B.y-de.y,scaleX:1,scaleY:1},active:W,over:he.current.over,activeNodeRect:ce,draggingNodeRect:Se,containerNodeRect:we,overlayNodeRect:Me,scrollableAncestors:De,scrollableAncestorRects:Re,windowRect:ve}),Ne=ie?o.add(ie,B):null,Te=function(e){const[n,r]=t.useState(null),a=t.useRef(e),s=t.useCallback(e=>{const t=D(e.target);t&&r(e=>e?(e.set(t,R(t)),new Map(e)):null)},[]);return t.useEffect(()=>{const t=a.current;if(e!==t){n(t);const o=e.map(e=>{const t=D(e);return t?(t.addEventListener("scroll",s,{passive:!0}),[t,R(t)]):null}).filter(e=>null!=e);r(o.length?new Map(o):null),a.current=e}return()=>{n(e),n(t)};function n(e){e.forEach(e=>{const t=D(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),h):N(e):h,[e,n])}(De),Ae=o.add(Le,Te),Ke=le?x(le,Le):null,Oe=Ke?x(Ke,Te):null,Be=function(e,t){var n;return e&&null!=(n=t[e])?n:null}(W&&Oe?c(Array.from(re.entries()),Oe):null,k),Ie=t.useMemo(()=>Be&&Be.rect.current?{id:Be.id,rect:Be.rect.current,data:Be.data,disabled:Be.disabled}:null,[Be]),ke=function(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}(Le,null!=(m=null==Be?void 0:Be.rect.current)?m:null,le),Pe=t.useCallback((e,{sensor:t,options:n})=>{if(!F.current)return;const r=O[F.current];if(!r)return;const o=new t({active:F.current,activeNode:r,event:e.nativeEvent,options:n,context:he,onStart(e){const t=F.current;if(!t)return;const n=O[t];if(!n)return;const{onDragStart:r}=te.current,o={active:{id:t,data:n.data,rect:U}};M({type:l.DragStart,initialCoordinates:e,active:t}),A({type:l.DragStart,event:o}),null==r||r(o)},onMove(e){M({type:l.DragMove,coordinates:e})},onEnd:a(l.DragEnd),onCancel:a(l.DragCancel)});function a(e){return async function(){const t=F.current,{active:n,over:r,scrollAdjustedTransalte:o}=he.current;if(!n||!o)return;const{cancelDrop:a}=te.current,s={active:n,delta:o,over:r};F.current=null,e===l.DragEnd&&"function"==typeof a&&await Promise.resolve(a(s))&&(e=l.DragCancel),M({type:e}),Q(null),ee(null);const{onDragCancel:i,onDragEnd:c}=te.current,u=e===l.DragEnd?c:i;A({type:e,event:s}),t&&(null==u||u(s))}}Q(o),ee(e.nativeEvent)},[M,O]),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])}(i,t.useCallback((e,t)=>(n,r)=>{const o=n.nativeEvent;null!==F.current||o.dndKit||o.defaultPrevented||!0===e(n,t.options)&&(o.dndKit={capturedBy:t.sensor},F.current=r,Pe(n,t))},[Pe]));o.useIsomorphicLayoutEffect(()=>{te.current=g},Object.values(g)),t.useEffect(()=>{W||(ue.current=null),W&&le&&!ue.current&&(ue.current=le)},[le,W]),t.useEffect(()=>{const{onDragMove:e}=te.current,{active:t,over:n}=he.current;if(!t)return;const r={active:t,delta:{x:Ae.x,y:Ae.y},over:n};A({type:l.DragMove,event:r}),null==e||e(r)},[Ae.x,Ae.y]),t.useEffect(()=>{const{active:e,scrollAdjustedTransalte:t}=he.current;if(!e||!F.current||!t)return;const{onDragOver:n}=te.current,r={active:e,delta:{x:t.x,y:t.y},over:Ie};A({type:l.DragOver,event:r}),null==n||n(r)},[null==Ie?void 0:Ie.id]),o.useIsomorphicLayoutEffect(()=>{he.current={active:W,activeNode:se,collisionRect:Oe,droppableRects:re,draggableNodes:O,draggingNodeRect:Se,droppableContainers:k,over:Ie,scrollableAncestors:De,scrollAdjustedTransalte:Ae,translatedRect:Ke},U.current={initial:Se,translated:Ke}},[W,se,Oe,O,Se,re,k,Ie,De,Ae,Ke]),function({acceleration:e,activator:n=exports.AutoScrollActivator.Pointer,canScroll:r,draggingRect:a,enabled:s,interval:i=5,order:l=exports.TraversalOrder.TreeOrder,pointerCoordinates:c,scrollableAncestors:u,scrollableAncestorRects:d,threshold:f}){const[p,g]=o.useInterval(),v=t.useRef({x:1,y:1}),y=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 a}return null},[n,a,c]),b=t.useRef(h),m=t.useRef(null),x=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?[...u].reverse():u,[l,u]);t.useEffect(()=>{if(s&&u.length&&y){for(const t of w){if(!1===(null==r?void 0:r(t)))continue;const n=u.indexOf(t),o=d[n];if(!o)continue;const{direction:a,speed:s}=S(t,o,y,e,f);if(s.x>0||s.y>0)return g(),m.current=t,p(x,i),v.current=s,void(b.current=a)}v.current={x:0,y:0},b.current={x:0,y:0},g()}else g()},[e,x,r,g,s,i,JSON.stringify(y),p,u,w,d,JSON.stringify(f)])}({...function(){const t=!(!1===(null==X?void 0:X.autoScrollEnabled)||("object"==typeof e?!1===e.enabled:!1===e));return"object"==typeof e?{...e,enabled:t}:{enabled:t}}(),draggingRect:Ke,pointerCoordinates:Ne,scrollableAncestors:De,scrollableAncestorRects:Re});const qe=t.useMemo(()=>({active:W,activeNode:se,activeNodeRect:le,activeNodeClientRect:ce,activatorEvent:Z,activators:je,ariaDescribedById:{draggable:ne},overlayNode:{nodeRef:Ce,rect:Me,setRef:Ee},containerNodeRect:we,dispatch:M,draggableNodes:O,droppableContainers:k,droppableRects:re,over:Ie,recomputeLayouts:oe,scrollableAncestors:De,scrollableAncestorRects:Re,willRecomputeLayouts:ae,windowRect:ve}),[W,se,ce,le,Z,je,we,Me,Ce,M,O,ne,k,re,Ie,oe,De,Re,Ee,ae,ve]);return n.createElement(q.Provider,{value:L},n.createElement(p.Provider,{value:qe},n.createElement(xe.Provider,{value:ke},a)),n.createElement(z,{announcements:r,hiddenTextDescribedById:ne,screenReaderInstructions:f}))})),De=t.createContext(null),Re="button";function Ce(){return t.useContext(p)}const Ee=e=>e instanceof KeyboardEvent?"transform 250ms ease":void 0,Me={duration:250,easing:"ease",dragSourceOpacity:0},Se=n.memo(({adjustScale:e=!1,children:r,dropAnimation:a=Me,transition:s=Ee,modifiers:i,wrapperElement:l="div",className:c,zIndex:u=999})=>{var d,f;const{active:p,activeNodeRect:h,activeNodeClientRect:g,containerNodeRect:v,draggableNodes:b,activatorEvent:m,over:x,overlayNode:w,scrollableAncestors:D,scrollableAncestorRects:R,windowRect:C}=Ce(),E=t.useContext(xe),M=ye(i,{active:p,activeNodeRect:g,draggingNodeRect:w.rect,containerNodeRect:v,over:x,overlayNodeRect:w.rect,scrollableAncestors:D,scrollableAncestorRects:R,transform:E,windowRect:C}),S=function(e,n,r){const a=t.useRef(n);return o.useLazyMemo(t=>{const o=a.current;if(n!==o){if(n&&o&&(o.left!==n.left||o.top!==n.top)&&!t){const t=null==r?void 0:r.getBoundingClientRect();if(t)return{...e,x:t.left-n.left,y:t.top-n.top}}a.current=n}},[n,e,r])}(M,h,w.nodeRef.current),L=null!==p,N=null!=S?S:M,T=e?N:{...N,scaleX:1,scaleY:1},A=h?{position:"fixed",width:h.width,height:h.height,top:h.top,left:h.left,zIndex:u,transform:o.CSS.Transform.toString(T),touchAction:"none",transformOrigin:e&&m?y(m,h):void 0,transition:S?void 0:"function"==typeof s?s(m):s}:void 0,O=L?{style:A,children:r,className:c,transform:T}:void 0,B=t.useRef(O),I=null!=O?O:B.current,{children:k,...P}=null!=I?I:{},j=t.useRef(null!=(d=null==p?void 0:p.id)?d:null),q=function({animate:e,adjustScale:n,activeId:r,draggableNodes:a,duration:s,easing:i,dragSourceOpacity:l,node:c,transform:u}){const[d,f]=t.useState(!1);return t.useEffect(()=>{e&&r&&i&&s?requestAnimationFrame(()=>{var e;const t=null==(e=a[r])?void 0:e.node.current;if(u&&c&&t&&null!==t.parentNode){const e=c.children.length>1?c:c.children[0];if(e){const r=e.getBoundingClientRect(),a=K(t),d={x:r.left-a.left,y:r.top-a.top};if(Math.abs(d.x)||Math.abs(d.y)){const e=o.CSS.Transform.toString({x:u.x-d.x,y:u.y-d.y,scaleX:n?a.width*u.scaleX/r.width:1,scaleY:n?a.height*u.scaleY/r.height:1}),p=t.style.opacity;return null!=l&&(t.style.opacity=""+l),void(c.animate([{transform:o.CSS.Transform.toString(u)},{transform:e}],{easing:i,duration:s}).onfinish=()=>{f(!0),t&&null!=l&&(t.style.opacity=p)})}}}f(!0)}):e&&f(!0)},[e,r,n,a,s,i,l,c,u]),o.useIsomorphicLayoutEffect(()=>{d&&f(!1)},[d]),d}({animate:Boolean(a&&j.current&&!p),adjustScale:e,activeId:j.current,draggableNodes:b,duration:null==a?void 0:a.duration,easing:null==a?void 0:a.easing,dragSourceOpacity:null==a?void 0:a.dragSourceOpacity,node:w.nodeRef.current,transform:null==(f=B.current)?void 0:f.transform}),H=Boolean(k&&(r||a&&!q));return t.useEffect(()=>{var e;(null==p?void 0:p.id)!==j.current&&(j.current=null!=(e=null==p?void 0:p.id)?e:null),p&&B.current!==O&&(B.current=O)},[p,O]),t.useEffect(()=>{q&&(B.current=void 0)},[q]),H?n.createElement(l,{...P,ref:w.setRef},k):null});exports.DndContext=we,exports.DragOverlay=Se,exports.KeyboardSensor=ae,exports.MouseSensor=he,exports.PointerSensor=de,exports.TouchSensor=ve,exports.applyModifiers=ye,exports.closestCenter=(e,t)=>{const n=b(t,t.left,t.top),r=e.map(([e,t])=>g(b(t),n)),o=c(r);return e[o]?e[o][0]:null},exports.closestCorners=(e,t)=>{const n=B(t,t.left,t.top),r=e.map(([e,t])=>{const r=B(t,O(t)?t.left:void 0,O(t)?t.top:void 0),o=n.reduce((e,t,n)=>e+g(r[n],t),0);return Number((o/4).toFixed(4))}),o=c(r);return e[o]?e[o][0]:null},exports.defaultAnnouncements=i,exports.defaultCoordinates=h,exports.defaultDropAnimation=Me,exports.getBoundingClientRect=A,exports.getScrollableAncestors=w,exports.getViewRect=K,exports.rectIntersection=I,exports.useDndContext=Ce,exports.useDndMonitor=H,exports.useDraggable=function({id:e,data:n,disabled:r=!1,attributes:a}){const{active:s,activeNodeRect:i,activatorEvent:l,ariaDescribedById:c,draggableNodes:u,droppableRects:d,activators:f,over:h}=t.useContext(p),{role:g=Re,roleDescription:v="draggable",tabIndex:y=0}=null!=a?a:{},b=(null==s?void 0:s.id)===e,m=t.useContext(b?xe:De),[x,w]=o.useNodeRef(),D=function(e,n){return t.useMemo(()=>e.reduce((e,{eventName:t,handler:r})=>(e[t]=e=>{r(e,n)},e),{}),[e,n])}(f,e),R=X(n);return t.useEffect(()=>(u[e]={node:x,data:R},()=>{delete u[e]}),[u,e]),{active:s,activeNodeRect:i,activatorEvent:l,attributes:t.useMemo(()=>({role:g,tabIndex:y,"aria-pressed":!(!b||g!==Re)||void 0,"aria-roledescription":v,"aria-describedby":c.draggable}),[g,y,b,v,c.draggable]),droppableRects:d,isDragging:b,listeners:r?void 0:D,node:x,over:h,setNodeRef:w,transform:m}},exports.useDroppable=function({data:e,disabled:n=!1,id:r}){const{active:a,dispatch:s,over:i}=t.useContext(p),c=t.useRef(null),[u,d]=o.useNodeRef(),f=X(e);return o.useIsomorphicLayoutEffect(()=>(s({type:l.RegisterDroppable,element:{id:r,disabled:n,node:u,rect:c,data:f}}),()=>s({type:l.UnregisterDroppable,id:r})),[r]),t.useEffect(()=>{s({type:l.SetDroppableDisabled,id:r,disabled:n})},[n]),{active:a,rect:c,isOver:(null==i?void 0:i.id)===r,node:u,over:i,setNodeRef:d}},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"),a=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 "},i={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(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={}));const c=e=>u(e,(e,t)=>e<t);function u(e,t){if(0===e.length)return-1;let n=e[0],r=0;for(var o=1;o<e.length;o++)t(e[o],n)&&(r=o,n=e[o]);return r}function d(...e){}function f(e,t){const{[e]:n,...r}=t;return r}const p=t.createContext({activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,activeNodeClientRect:null,activators:[],ariaDescribedById:{draggable:""},containerNodeRect:null,dispatch:d,draggableNodes:{},droppableRects:new Map,droppableContainers:{},over:null,overlayNode:{nodeRef:{current:null},rect:null,setRef:d},scrollableAncestors:[],scrollableAncestorRects:[],recomputeLayouts:d,windowRect:null,willRecomputeLayouts:!1}),h=Object.freeze({x:0,y:0});function g(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function v(e){if(function(e){var t;return(null==(t=window)?void 0:t.TouchEvent)&&e instanceof TouchEvent}(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}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 y(e,t){if(e instanceof KeyboardEvent)return"0 0";const n=v(e);return`${(n.x-t.left)/t.width*100}% ${(n.y-t.top)/t.height*100}%`}function b(e,t=e.offsetLeft,n=e.offsetTop){return{x:t+.5*e.width,y:n+.5*e.height}}function m(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,offsetLeft:t.offsetLeft+e*n.x,offsetTop:t.offsetTop+e*n.y}),{...t})}}const x=m(1);function w(e){const 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){const t=window.getComputedStyle(e),n=/(auto|scroll)/;return null!=["overflow","overflowX","overflowY"].find(e=>{const r=t[e];return"string"==typeof r&&n.test(r)})}(n)&&t.push(n),e(n.parentNode)):t}(e.parentNode):t}function D(e){return o.canUseDOM?e===document.scrollingElement||e instanceof Document?window:e instanceof HTMLElement?e:null:null}function R(e){return e instanceof Window?{x:e.scrollX,y:e.scrollY}:{x:e.scrollLeft,y:e.scrollTop}}var C;function E(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"}(C||(C={}));const M={x:.2,y:.2};function S(e,t,{top:n,left:r,right:a,bottom:s},i=10,l=M){const{clientHeight:c,clientWidth:u}=e,d=(f=e,o.canUseDOM&&f&&f===document.scrollingElement?{top:0,left:0,right:u,bottom:c,width:u,height:c}:t);var f;const{isTop:p,isBottom:h,isLeft:g,isRight:v}=E(e),y={x:0,y:0},b={x:0,y:0},m=d.height*l.y,x=d.width*l.x;return!p&&n<=d.top+m?(y.y=C.Backward,b.y=i*Math.abs((d.top+m-n)/m)):!h&&s>=d.bottom-m&&(y.y=C.Forward,b.y=i*Math.abs((d.bottom-m-s)/m)),!v&&a>=d.right-x?(y.x=C.Forward,b.x=i*Math.abs((d.right-x-a)/x)):!g&&r<=d.left+x&&(y.x=C.Backward,b.x=i*Math.abs((d.left+x-r)/x)),{direction:y,speed:b}}function L(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 N(e){return e.reduce((e,t)=>o.add(e,R(t)),h)}function T(e){const{offsetWidth:t,offsetHeight:n}=e,{x:r,y:o}=function e(t,n,r=h){if(!(t&&t instanceof HTMLElement))return r;const 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:o,offsetLeft:r}}function A(e){if(e instanceof Window){const e=window.innerWidth,t=window.innerHeight;return{top:0,left:0,right:e,bottom:t,width:e,height:t,offsetTop:0,offsetLeft:0}}const{offsetTop:t,offsetLeft:n}=T(e),{width:r,height:o,top:a,bottom:s,left:i,right:l}=e.getBoundingClientRect();return{width:r,height:o,top:a,bottom:s,right:l,left:i,offsetTop:t,offsetLeft:n}}function K(e){const{width:t,height:n,offsetTop:r,offsetLeft:o}=T(e),a=N(w(e)),s=r-a.y,i=o-a.x;return{width:t,height:n,top:s,bottom:s+n,right:i+t,left:i,offsetTop:r,offsetLeft:o}}function O(e){return"top"in e}function B(e,t=e.offsetLeft,n=e.offsetTop){return[{x:t,y:n},{x:t+e.width,y:n},{x:t,y:n+e.height},{x:t+e.width,y:n+e.height}]}const I=(e,t)=>{const n=e.map(([e,n])=>function(e,t){const 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){const s=(o-r)*(a-n);return Number((s/(t.width*t.height+e.width*e.height-s)).toFixed(4))}return 0}(n,t)),r=u(n,(e,t)=>e>t);return n[r]<=0?null:e[r]?e[r][0]:null};function k(e){return e instanceof HTMLElement?e.ownerDocument:document}function P(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:{},translate:{x:0,y:0}},droppable:{containers:{}}}}function j(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;return{...e,droppable:{...e.droppable,containers:{...e.droppable.containers,[r]:n}}}}case l.SetDroppableDisabled:{const{id:n,disabled:r}=t,o=e.droppable.containers[n];return o?{...e,droppable:{...e.droppable,containers:{...e.droppable.containers,[n]:{...o,disabled:r}}}}:e}case l.UnregisterDroppable:{const{id:n}=t;return{...e,droppable:{...e.droppable,containers:f(n,e.droppable.containers)}}}default:return e}}const q=t.createContext({type:null,event:null});function H({onDragStart:e,onDragMove:n,onDragOver:r,onDragEnd:o,onDragCancel:a}){const s=t.useContext(q),i=t.useRef(s);t.useEffect(()=>{if(s!==i.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==a||a(c);break;case l.DragEnd:null==o||o(c)}i.current=s}},[s,e,n,r,o,a])}function z({announcements:e=i,hiddenTextDescribedById:s,screenReaderInstructions:l}){const{announce:c,announcement:u}=a.useAnnouncement(),d=o.useUniqueId("DndLiveRegion");return H(t.useMemo(()=>({onDragStart({active:t}){c(e.onDragStart(t.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])),o.canUseDOM?r.createPortal(n.createElement(n.Fragment,null,n.createElement(a.HiddenText,{id:s,value:l.draggable}),n.createElement(a.LiveRegion,{id:d,announcement:u})),document.body):null}var U,W,F;function X(e){const n=t.useRef(e);return o.useIsomorphicLayoutEffect(()=>{n.current!==e&&(n.current=e)},[e]),n}(U=exports.AutoScrollActivator||(exports.AutoScrollActivator={}))[U.Pointer=0]="Pointer",U[U.DraggableRect=1]="DraggableRect",(W=exports.TraversalOrder||(exports.TraversalOrder={}))[W.TreeOrder=0]="TreeOrder",W[W.ReversedTreeOrder=1]="ReversedTreeOrder",(F=exports.LayoutMeasuringStrategy||(exports.LayoutMeasuringStrategy={}))[F.Always=0]="Always",F[F.BeforeDragging=1]="BeforeDragging",F[F.WhileDragging=2]="WhileDragging",(exports.LayoutMeasuringFrequency||(exports.LayoutMeasuringFrequency={})).Optimized="optimized";const Y=new Map,$={strategy:exports.LayoutMeasuringStrategy.WhileDragging,frequency:exports.LayoutMeasuringFrequency.Optimized},V=[],G=Q(A),J=Z(A),_=Q(K);function Q(e){return function(n,r){const a=t.useRef(n);return o.useLazyMemo(t=>n?r||!t&&n||n!==a.current?n instanceof HTMLElement&&null==n.parentNode?null:e(n):null!=t?t:null:null,[n,r])}}function Z(e){const n=[];return function(r,a){const s=t.useRef(r);return o.useLazyMemo(t=>r.length?a||!t&&r.length||r!==s.current?r.map(t=>e(t)):null!=t?t:n:n,[r,a])}}class ee{constructor(e){this.target=e,this.listeners=[]}add(e,t,n){this.target.addEventListener(e,t,n),this.listeners.push({eventName:e,handler:t})}removeAll(){this.listeners.forEach(({eventName:e,handler:t})=>this.target.removeEventListener(e,t))}}function te(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 ne;(ne=exports.KeyboardCode||(exports.KeyboardCode={})).Space="Space",ne.Down="ArrowDown",ne.Right="ArrowRight",ne.Left="ArrowLeft",ne.Up="ArrowUp",ne.Esc="Escape",ne.Enter="Enter";const re={start:[exports.KeyboardCode.Space,exports.KeyboardCode.Enter],cancel:[exports.KeyboardCode.Esc],end:[exports.KeyboardCode.Space,exports.KeyboardCode.Enter]},oe=(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 ae{constructor(e){this.props=e,this.autoScrollEnabled=!1,this.coordinates=h;const{event:{target:t}}=e;this.props=e,this.listeners=new ee(k(t)),this.windowListeners=new ee(function(e){var t;return null!=(t=k(e).defaultView)?t:window}(t)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),setTimeout(()=>{this.listeners.add("keydown",this.handleKeyDown),this.windowListeners.add("resize",this.handleCancel)})}handleStart(){const{activeNode:e,onStart:t}=this.props;if(!e.node.current)throw new Error("Active draggable node is undefined");const n=A(e.node.current),r={x:n.left,y:n.top};this.coordinates=r,t(r)}handleKeyDown(e){if(e instanceof KeyboardEvent){const{coordinates:t}=this,{active:n,context:r,options:a}=this.props,{keyboardCodes:s=re,coordinateGetter:i=oe,scrollBehavior:l="smooth"}=a,{code:c}=e;if(s.end.includes(c))return void this.handleEnd(e);if(s.cancel.includes(c))return void this.handleCancel(e);const u=i(e,{active:n,context:r.current,currentCoordinates:t});if(u){const n={x:0,y:0},{scrollableAncestors:a}=r.current;for(const r of a){const a=e.code,s=o.subtract(u,t),{isTop:i,isRight:c,isLeft:d,isBottom:f,maxScroll:p,minScroll:h}=E(r),g=L(r),v={x:Math.min(a===exports.KeyboardCode.Right?g.right-g.width/2:g.right,Math.max(a===exports.KeyboardCode.Right?g.left:g.left+g.width/2,u.x)),y:Math.min(a===exports.KeyboardCode.Down?g.bottom-g.height/2:g.bottom,Math.max(a===exports.KeyboardCode.Down?g.top:g.top+g.height/2,u.y))},y=a===exports.KeyboardCode.Right&&!c||a===exports.KeyboardCode.Left&&!d,b=a===exports.KeyboardCode.Down&&!f||a===exports.KeyboardCode.Up&&!i;if(y&&v.x!==u.x){if(a===exports.KeyboardCode.Right&&r.scrollLeft+s.x<=p.x||a===exports.KeyboardCode.Left&&r.scrollLeft+s.x>=h.x)return void r.scrollBy({left:s.x,behavior:l});n.x=a===exports.KeyboardCode.Right?r.scrollLeft-p.x:r.scrollLeft-h.x,r.scrollBy({left:-n.x,behavior:l});break}if(b&&v.y!==u.y){if(a===exports.KeyboardCode.Down&&r.scrollTop+s.y<=p.y||a===exports.KeyboardCode.Up&&r.scrollTop+s.y>=h.y)return void r.scrollBy({top:s.y,behavior:l});n.y=a===exports.KeyboardCode.Down?r.scrollTop-p.y:r.scrollTop-h.y,r.scrollBy({top:-n.y,behavior:l});break}}this.handleMove(e,o.add(u,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 se(e){return Boolean(e&&"distance"in e)}function ie(e){return Boolean(e&&"delay"in e)}var le;ae.activators=[{eventName:"onKeyDown",handler:(e,{keyboardCodes:t=re,onActivation:n})=>{const{code:r}=e.nativeEvent;return!!t.start.includes(r)&&(e.preventDefault(),null==n||n({event:e.nativeEvent}),!0)}}],function(e){e.Keydown="keydown"}(le||(le={}));class ce{constructor(e,t,n=function(e){return e instanceof HTMLElement?e:k(e)}(e.event.target)){this.props=e,this.events=t,this.autoScrollEnabled=!0,this.activated=!1,this.timeoutId=null;const{event:r}=e;this.props=e,this.events=t,this.ownerDocument=k(r.target),this.listeners=new ee(n),this.initialCoordinates=v(r),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()}attach(){const{events:e,props:{options:{activationConstraint:t}}}=this;if(this.listeners.add(e.move.name,this.handleMove,!1),this.listeners.add(e.end.name,this.handleEnd),this.ownerDocument.addEventListener(le.Keydown,this.handleKeydown),t){if(se(t))return;if(ie(t))return void(this.timeoutId=setTimeout(this.handleStart,t.delay))}this.handleStart()}detach(){this.listeners.removeAll(),this.ownerDocument.removeEventListener(le.Keydown,this.handleKeydown),null!==this.timeoutId&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handleStart(){const{initialCoordinates:e}=this,{onStart:t}=this.props;e&&(this.activated=!0,t(e))}handleMove(e){const{activated:t,initialCoordinates:n,props:r}=this,{onMove:a,options:{activationConstraint:s}}=r;if(!n)return;const i=v(e),l=o.subtract(n,i);if(!t&&s){if(ie(s))return te(l,s.tolerance)?this.handleCancel():void 0;if(se(s))return te(l,s.distance)?this.handleStart():void 0}e.cancelable&&e.preventDefault(),a(i)}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()}}const ue={move:{name:"pointermove"},end:{name:"pointerup"}};class de extends ce{constructor(e){const{event:t}=e,n=k(t.target);super(e,ue,n)}}de.activators=[{eventName:"onPointerDown",handler:({nativeEvent:e},{onActivation:t})=>!(!e.isPrimary||0!==e.button||(null==t||t({event:e}),0))}];const fe={move:{name:"mousemove"},end:{name:"mouseup"}};var pe;!function(e){e[e.RightClick=2]="RightClick"}(pe||(pe={}));class he extends ce{constructor(e){super(e,fe,k(e.event.target))}}he.activators=[{eventName:"onMouseDown",handler:({nativeEvent:e},{onActivation:t})=>e.button!==pe.RightClick&&(null==t||t({event:e}),!0)}];const ge={move:{name:"touchmove"},end:{name:"touchend"}};class ve extends ce{constructor(e){super(e,ge)}}function ye(e,{transform:t,...n}){return(null==e?void 0:e.length)?e.reduce((e,t)=>t({transform:e,...n}),t):t}ve.activators=[{eventName:"onTouchStart",handler:({nativeEvent:e},{onActivation:t})=>{const{touches:n}=e;return!(n.length>1||(null==t||t({event:e}),0))}}];const be=[{sensor:de,options:{}},{sensor:ae,options:{}}],me={current:{}},xe=t.createContext({...h,scaleX:1,scaleY:1}),we=t.memo((function({autoScroll:e=!0,announcements:r,children:a,sensors:i=be,collisionDetection:c=I,layoutMeasuring:u,modifiers:d,screenReaderInstructions:f=s,...g}){var y,b,m;const C=t.useReducer(j,void 0,P),[E,M]=C,[L,A]=t.useState(()=>({type:null,event:null})),{draggable:{active:K,nodes:O,translate:B},droppable:{containers:k}}=E,H=K?O[K]:null,U=t.useRef({initial:null,translated:null}),W=t.useMemo(()=>{var e;return null!=K?{id:K,data:null!=(e=null==H?void 0:H.data)?e:me,rect:U}:null},[K,H]),F=t.useRef(null),[X,Q]=t.useState(null),[Z,ee]=t.useState(null),te=t.useRef(g),ne=o.useUniqueId("DndDescribedBy"),{layoutRectMap:re,recomputeLayouts:oe,willRecomputeLayouts:ae}=function(e,{dragging:n,dependencies:r,config:a}){const[s,i]=t.useState(!1),{frequency:l,strategy:c}=(u=a)?{...$,...u}:$;var u;const d=t.useRef(e),f=t.useCallback(()=>i(!0),[]),p=t.useRef(null),h=function(){switch(c){case exports.LayoutMeasuringStrategy.Always:return!1;case exports.LayoutMeasuringStrategy.BeforeDragging:return n;default:return!n}}(),g=o.useLazyMemo(t=>{if(h&&!n)return Y;if(!t||t===Y||d.current!==e||s){for(let t of Object.values(e))t&&(t.rect.current=t.node.current?T(t.node.current):null);return function(e){const t=new Map;if(e)for(const n of Object.values(e)){if(!n)continue;const{id:e,rect:r,disabled:o}=n;o||null==r.current||t.set(e,r.current)}return t}(e)}return t},[e,n,h,s]);return t.useEffect(()=>{d.current=e},[e]),t.useEffect(()=>{s&&i(!1)},[s]),t.useEffect((function(){h||requestAnimationFrame(f)}),[n,h]),t.useEffect((function(){h||"number"!=typeof l||null!==p.current||(p.current=setTimeout(()=>{f(),p.current=null},l))}),[l,h,f,...r]),{layoutRectMap:g,recomputeLayouts:f,willRecomputeLayouts:s}}(k,{dragging:null!=K,dependencies:[B.x,B.y],config:u}),se=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])}(O,K),ie=Z?v(Z):null,le=_(se),ce=G(se),ue=t.useRef(null),de=(pe=ue.current,(fe=le)&&pe?{x:fe.left-pe.left,y:fe.top-pe.top}:h);var fe,pe;const he=t.useRef({active:null,activeNode:se,collisionRect:null,droppableRects:re,draggableNodes:O,draggingNodeRect:null,droppableContainers:k,over:null,scrollableAncestors:[],scrollAdjustedTransalte:null,translatedRect:null}),ge=function(e,t){var n,r;return e&&null!=(n=null==(r=t[e])?void 0:r.node.current)?n:null}(null!=(y=null==(b=he.current.over)?void 0:b.id)?y:null,k),ve=G(se?se.ownerDocument.defaultView:null),we=G(se?se.parentElement:null),De=function(e){const n=t.useRef(e),r=o.useLazyMemo(t=>e?t&&e&&n.current&&e.parentNode===n.current.parentNode?t:w(e):V,[e]);return t.useEffect(()=>{n.current=e},[e]),r}(K?null!=ge?ge:se:null),Re=J(De),[Ce,Ee]=o.useNodeRef(),Me=G(K?Ce.current:null,ae),Se=null!=Me?Me:ce,Le=ye(d,{transform:{x:B.x-de.x,y:B.y-de.y,scaleX:1,scaleY:1},active:W,over:he.current.over,activeNodeRect:ce,draggingNodeRect:Se,containerNodeRect:we,overlayNodeRect:Me,scrollableAncestors:De,scrollableAncestorRects:Re,windowRect:ve}),Ne=ie?o.add(ie,B):null,Te=function(e){const[n,r]=t.useState(null),a=t.useRef(e),s=t.useCallback(e=>{const t=D(e.target);t&&r(e=>e?(e.set(t,R(t)),new Map(e)):null)},[]);return t.useEffect(()=>{const t=a.current;if(e!==t){n(t);const o=e.map(e=>{const t=D(e);return t?(t.addEventListener("scroll",s,{passive:!0}),[t,R(t)]):null}).filter(e=>null!=e);r(o.length?new Map(o):null),a.current=e}return()=>{n(e),n(t)};function n(e){e.forEach(e=>{const t=D(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),h):N(e):h,[e,n])}(De),Ae=o.add(Le,Te),Ke=le?x(le,Le):null,Oe=Ke?x(Ke,Te):null,Be=function(e,t){var n;return e&&null!=(n=t[e])?n:null}(W&&Oe?c(Array.from(re.entries()),Oe):null,k),Ie=t.useMemo(()=>Be&&Be.rect.current?{id:Be.id,rect:Be.rect.current,data:Be.data,disabled:Be.disabled}:null,[Be]),ke=function(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}(Le,null!=(m=null==Be?void 0:Be.rect.current)?m:null,le),Pe=t.useCallback((e,{sensor:t,options:n})=>{if(!F.current)return;const r=O[F.current];if(!r)return;const o=new t({active:F.current,activeNode:r,event:e.nativeEvent,options:n,context:he,onStart(e){const t=F.current;if(!t)return;const n=O[t];if(!n)return;const{onDragStart:r}=te.current,o={active:{id:t,data:n.data,rect:U}};M({type:l.DragStart,initialCoordinates:e,active:t}),A({type:l.DragStart,event:o}),null==r||r(o)},onMove(e){M({type:l.DragMove,coordinates:e})},onEnd:a(l.DragEnd),onCancel:a(l.DragCancel)});function a(e){return async function(){const{active:t,over:n,scrollAdjustedTransalte:r}=he.current;let o=null;if(t&&r){const{cancelDrop:a}=te.current;o={active:t,delta:r,over:n},e===l.DragEnd&&"function"==typeof a&&await Promise.resolve(a(o))&&(e=l.DragCancel)}if(F.current=null,M({type:e}),Q(null),ee(null),o){const{onDragCancel:t,onDragEnd:n}=te.current,r=e===l.DragEnd?n:t;A({type:e,event:o}),null==r||r(o)}}}Q(o),ee(e.nativeEvent)},[M,O]),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])}(i,t.useCallback((e,t)=>(n,r)=>{const o=n.nativeEvent;null!==F.current||o.dndKit||o.defaultPrevented||!0===e(n,t.options)&&(o.dndKit={capturedBy:t.sensor},F.current=r,Pe(n,t))},[Pe]));o.useIsomorphicLayoutEffect(()=>{te.current=g},Object.values(g)),t.useEffect(()=>{W||(ue.current=null),W&&le&&!ue.current&&(ue.current=le)},[le,W]),t.useEffect(()=>{const{onDragMove:e}=te.current,{active:t,over:n}=he.current;if(!t)return;const r={active:t,delta:{x:Ae.x,y:Ae.y},over:n};A({type:l.DragMove,event:r}),null==e||e(r)},[Ae.x,Ae.y]),t.useEffect(()=>{const{active:e,scrollAdjustedTransalte:t}=he.current;if(!e||!F.current||!t)return;const{onDragOver:n}=te.current,r={active:e,delta:{x:t.x,y:t.y},over:Ie};A({type:l.DragOver,event:r}),null==n||n(r)},[null==Ie?void 0:Ie.id]),o.useIsomorphicLayoutEffect(()=>{he.current={active:W,activeNode:se,collisionRect:Oe,droppableRects:re,draggableNodes:O,draggingNodeRect:Se,droppableContainers:k,over:Ie,scrollableAncestors:De,scrollAdjustedTransalte:Ae,translatedRect:Ke},U.current={initial:Se,translated:Ke}},[W,se,Oe,O,Se,re,k,Ie,De,Ae,Ke]),function({acceleration:e,activator:n=exports.AutoScrollActivator.Pointer,canScroll:r,draggingRect:a,enabled:s,interval:i=5,order:l=exports.TraversalOrder.TreeOrder,pointerCoordinates:c,scrollableAncestors:u,scrollableAncestorRects:d,threshold:f}){const[p,g]=o.useInterval(),v=t.useRef({x:1,y:1}),y=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 a}return null},[n,a,c]),b=t.useRef(h),m=t.useRef(null),x=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?[...u].reverse():u,[l,u]);t.useEffect(()=>{if(s&&u.length&&y){for(const t of w){if(!1===(null==r?void 0:r(t)))continue;const n=u.indexOf(t),o=d[n];if(!o)continue;const{direction:a,speed:s}=S(t,o,y,e,f);if(s.x>0||s.y>0)return g(),m.current=t,p(x,i),v.current=s,void(b.current=a)}v.current={x:0,y:0},b.current={x:0,y:0},g()}else g()},[e,x,r,g,s,i,JSON.stringify(y),p,u,w,d,JSON.stringify(f)])}({...function(){const t=!(!1===(null==X?void 0:X.autoScrollEnabled)||("object"==typeof e?!1===e.enabled:!1===e));return"object"==typeof e?{...e,enabled:t}:{enabled:t}}(),draggingRect:Ke,pointerCoordinates:Ne,scrollableAncestors:De,scrollableAncestorRects:Re});const qe=t.useMemo(()=>({active:W,activeNode:se,activeNodeRect:le,activeNodeClientRect:ce,activatorEvent:Z,activators:je,ariaDescribedById:{draggable:ne},overlayNode:{nodeRef:Ce,rect:Me,setRef:Ee},containerNodeRect:we,dispatch:M,draggableNodes:O,droppableContainers:k,droppableRects:re,over:Ie,recomputeLayouts:oe,scrollableAncestors:De,scrollableAncestorRects:Re,willRecomputeLayouts:ae,windowRect:ve}),[W,se,ce,le,Z,je,we,Me,Ce,M,O,ne,k,re,Ie,oe,De,Re,Ee,ae,ve]);return n.createElement(q.Provider,{value:L},n.createElement(p.Provider,{value:qe},n.createElement(xe.Provider,{value:ke},a)),n.createElement(z,{announcements:r,hiddenTextDescribedById:ne,screenReaderInstructions:f}))})),De=t.createContext(null),Re="button";function Ce(){return t.useContext(p)}const Ee=e=>e instanceof KeyboardEvent?"transform 250ms ease":void 0,Me={duration:250,easing:"ease",dragSourceOpacity:0},Se=n.memo(({adjustScale:e=!1,children:r,dropAnimation:a=Me,transition:s=Ee,modifiers:i,wrapperElement:l="div",className:c,zIndex:u=999})=>{var d,f;const{active:p,activeNodeRect:h,activeNodeClientRect:g,containerNodeRect:v,draggableNodes:b,activatorEvent:m,over:x,overlayNode:w,scrollableAncestors:D,scrollableAncestorRects:R,windowRect:C}=Ce(),E=t.useContext(xe),M=ye(i,{active:p,activeNodeRect:g,draggingNodeRect:w.rect,containerNodeRect:v,over:x,overlayNodeRect:w.rect,scrollableAncestors:D,scrollableAncestorRects:R,transform:E,windowRect:C}),S=function(e,n,r){const a=t.useRef(n);return o.useLazyMemo(t=>{const o=a.current;if(n!==o){if(n&&o&&(o.left!==n.left||o.top!==n.top)&&!t){const t=null==r?void 0:r.getBoundingClientRect();if(t)return{...e,x:t.left-n.left,y:t.top-n.top}}a.current=n}},[n,e,r])}(M,h,w.nodeRef.current),L=null!==p,N=null!=S?S:M,T=e?N:{...N,scaleX:1,scaleY:1},A=h?{position:"fixed",width:h.width,height:h.height,top:h.top,left:h.left,zIndex:u,transform:o.CSS.Transform.toString(T),touchAction:"none",transformOrigin:e&&m?y(m,h):void 0,transition:S?void 0:"function"==typeof s?s(m):s}:void 0,O=L?{style:A,children:r,className:c,transform:T}:void 0,B=t.useRef(O),I=null!=O?O:B.current,{children:k,...P}=null!=I?I:{},j=t.useRef(null!=(d=null==p?void 0:p.id)?d:null),q=function({animate:e,adjustScale:n,activeId:r,draggableNodes:a,duration:s,easing:i,dragSourceOpacity:l,node:c,transform:u}){const[d,f]=t.useState(!1);return t.useEffect(()=>{e&&r&&i&&s?requestAnimationFrame(()=>{var e;const t=null==(e=a[r])?void 0:e.node.current;if(u&&c&&t&&null!==t.parentNode){const e=c.children.length>1?c:c.children[0];if(e){const r=e.getBoundingClientRect(),a=K(t),d={x:r.left-a.left,y:r.top-a.top};if(Math.abs(d.x)||Math.abs(d.y)){const e=o.CSS.Transform.toString({x:u.x-d.x,y:u.y-d.y,scaleX:n?a.width*u.scaleX/r.width:1,scaleY:n?a.height*u.scaleY/r.height:1}),p=t.style.opacity;return null!=l&&(t.style.opacity=""+l),void(c.animate([{transform:o.CSS.Transform.toString(u)},{transform:e}],{easing:i,duration:s}).onfinish=()=>{f(!0),t&&null!=l&&(t.style.opacity=p)})}}}f(!0)}):e&&f(!0)},[e,r,n,a,s,i,l,c,u]),o.useIsomorphicLayoutEffect(()=>{d&&f(!1)},[d]),d}({animate:Boolean(a&&j.current&&!p),adjustScale:e,activeId:j.current,draggableNodes:b,duration:null==a?void 0:a.duration,easing:null==a?void 0:a.easing,dragSourceOpacity:null==a?void 0:a.dragSourceOpacity,node:w.nodeRef.current,transform:null==(f=B.current)?void 0:f.transform}),H=Boolean(k&&(r||a&&!q));return t.useEffect(()=>{var e;(null==p?void 0:p.id)!==j.current&&(j.current=null!=(e=null==p?void 0:p.id)?e:null),p&&B.current!==O&&(B.current=O)},[p,O]),t.useEffect(()=>{q&&(B.current=void 0)},[q]),H?n.createElement(l,{...P,ref:w.setRef},k):null});exports.DndContext=we,exports.DragOverlay=Se,exports.KeyboardSensor=ae,exports.MouseSensor=he,exports.PointerSensor=de,exports.TouchSensor=ve,exports.applyModifiers=ye,exports.closestCenter=(e,t)=>{const n=b(t,t.left,t.top),r=e.map(([e,t])=>g(b(t),n)),o=c(r);return e[o]?e[o][0]:null},exports.closestCorners=(e,t)=>{const n=B(t,t.left,t.top),r=e.map(([e,t])=>{const r=B(t,O(t)?t.left:void 0,O(t)?t.top:void 0),o=n.reduce((e,t,n)=>e+g(r[n],t),0);return Number((o/4).toFixed(4))}),o=c(r);return e[o]?e[o][0]:null},exports.defaultAnnouncements=i,exports.defaultCoordinates=h,exports.defaultDropAnimation=Me,exports.getBoundingClientRect=A,exports.getScrollableAncestors=w,exports.getViewRect=K,exports.rectIntersection=I,exports.useDndContext=Ce,exports.useDndMonitor=H,exports.useDraggable=function({id:e,data:n,disabled:r=!1,attributes:a}){const{active:s,activeNodeRect:i,activatorEvent:l,ariaDescribedById:c,draggableNodes:u,droppableRects:d,activators:f,over:h}=t.useContext(p),{role:g=Re,roleDescription:v="draggable",tabIndex:y=0}=null!=a?a:{},b=(null==s?void 0:s.id)===e,m=t.useContext(b?xe:De),[x,w]=o.useNodeRef(),D=function(e,n){return t.useMemo(()=>e.reduce((e,{eventName:t,handler:r})=>(e[t]=e=>{r(e,n)},e),{}),[e,n])}(f,e),R=X(n);return t.useEffect(()=>(u[e]={node:x,data:R},()=>{delete u[e]}),[u,e]),{active:s,activeNodeRect:i,activatorEvent:l,attributes:t.useMemo(()=>({role:g,tabIndex:y,"aria-pressed":!(!b||g!==Re)||void 0,"aria-roledescription":v,"aria-describedby":c.draggable}),[g,y,b,v,c.draggable]),droppableRects:d,isDragging:b,listeners:r?void 0:D,node:x,over:h,setNodeRef:w,transform:m}},exports.useDroppable=function({data:e,disabled:n=!1,id:r}){const{active:a,dispatch:s,over:i}=t.useContext(p),c=t.useRef(null),[u,d]=o.useNodeRef(),f=X(e);return o.useIsomorphicLayoutEffect(()=>(s({type:l.RegisterDroppable,element:{id:r,disabled:n,node:u,rect:c,data:f}}),()=>s({type:l.UnregisterDroppable,id:r})),[r]),t.useEffect(()=>{s({type:l.SetDroppableDisabled,id:r,disabled:n})},[n]),{active:a,rect:c,isOver:(null==i?void 0:i.id)===r,node:u,over:i,setNodeRef:d}},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
{
"name": "@dnd-kit/core",
"version": "3.0.0",
"version": "3.0.1",
"description": "dnd kit – a lightweight React library for building performant and accessible drag and drop experiences",

@@ -5,0 +5,0 @@ "author": "Claudéric Demers",

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