@dnd-kit/core
Advanced tools
Comparing version 6.0.0-next-20224171791 to 6.0.0-next-2022417214515
# @dnd-kit/core | ||
## 6.0.0-next-20224171791 | ||
## 6.0.0-next-2022417214515 | ||
@@ -221,2 +221,4 @@ ### Major Changes | ||
- [#742](https://github.com/clauderic/dnd-kit/pull/742) [`7161f70`](https://github.com/clauderic/dnd-kit/commit/7161f702c9fe06f8dafa6449d48b918070ca46fb) Thanks [@clauderic](https://github.com/clauderic)! - Fallback to initial rect measured for the active draggable node if it unmounts during initialization (after `onDragStart` is dispatched). | ||
- [#699](https://github.com/clauderic/dnd-kit/pull/699) [`e302bd4`](https://github.com/clauderic/dnd-kit/commit/e302bd4488bdfb6735c97ac42c1f4a0b1e8bfdf9) Thanks [@JuAn-Kang](https://github.com/JuAn-Kang)! - Export `DragOverlayProps` for consumers. | ||
@@ -227,3 +229,3 @@ | ||
- Updated dependencies [[`035021a`](https://github.com/clauderic/dnd-kit/commit/035021aac51161e2bf9715f087a6dd1b46647bfc)]: | ||
- @dnd-kit/utilities@3.2.0-next-20224171791 | ||
- @dnd-kit/utilities@3.2.0-next-2022417214515 | ||
@@ -230,0 +232,0 @@ ## 5.0.3 |
import type { DeepRequired } from '@dnd-kit/utilities'; | ||
import type { ClientRect } from '../../types'; | ||
import type { MeasuringFunction, MeasuringConfiguration } from './types'; | ||
export declare function useMeasuringConfiguration(config: MeasuringConfiguration | undefined): DeepRequired<MeasuringConfiguration>; | ||
interface Options { | ||
disabled?: boolean; | ||
disabled: boolean; | ||
element: HTMLElement | null; | ||
initialRect: ClientRect | null; | ||
measure: MeasuringFunction; | ||
} | ||
export declare function useLayoutShiftScrollCompensation(node: HTMLElement | null, { disabled, measure }: Options): (node: HTMLElement) => void; | ||
export declare function useLayoutShiftScrollCompensation({ element, measure, initialRect, disabled, }: Options): void; | ||
export {}; |
@@ -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 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={}));const d=Object.freeze({x:0,y:0});function u(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function g(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 p({data:{value:e}},{data:{value:t}}){return e-t}function f({data:{value:e}},{data:{value:t}}){return t-e}function h({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 v(e,t){if(!e||0===e.length)return null;const[n]=e;return t?n[t]:n}function b(e,t=e.left,n=e.top){return{x:t+.5*e.width,y:n+.5*e.height}}function m(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 y=({collisionRect:e,droppableRects:t,droppableContainers:n})=>{const r=[];for(const o of n){const{id:n}=o,i=t.get(n);if(i){const t=m(i,e);t>0&&r.push({id:n,data:{droppableContainer:o,value:t}})}}return r.sort(f)};function x(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 w(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:d}function C(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 D=C(1);function E(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}const R={ignoreTransform:!1};function S(e,t=R){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){const r=E(t);if(!r)return e;const{scaleX:o,scaleY:i,x:a,y:s}=r,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 M(e){return S(e,{ignoreTransform:!0})}function O(e,t){const n=[];return e?function r(i){if(null!=t&&n.length>=t)return n;if(!i)return n;if(o.isDocument(i)&&null!=i.scrollingElement&&!n.includes(i.scrollingElement))return n.push(i.scrollingElement),n;if(!o.isHTMLElement(i)||o.isSVGElement(i))return n;if(n.includes(i))return n;const{getComputedStyle:a}=o.getWindow(i),s=a(i);return i!==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)})}(i,s)&&n.push(i),function(e,t=o.getWindow(e).getComputedStyle(e)){return"fixed"===t.position}(i,s)?n:r(i.parentNode)}(e):n}function N(e){const[t]=O(e,1);return null!=t?t:null}function L(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 k(e){return o.isWindow(e)?e.scrollX:e.scrollLeft}function A(e){return o.isWindow(e)?e.scrollY:e.scrollTop}function T(e){return{x:k(e),y:A(e)}}var K;function I(e){return!(!o.canUseDOM||!e)&&e===document.scrollingElement}function B(e){const t={x:0,y:0},n=I(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height};return{isTop:e.scrollTop<=t.y,isLeft:e.scrollLeft<=t.x,isBottom:e.scrollTop>=r.y,isRight:e.scrollLeft>=r.x,maxScroll:r,minScroll:t}}!function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"}(K||(K={}));const z={x:.2,y:.2};function P(e,t,{top:n,left:r,right:o,bottom:i},a=10,s=z){const{isTop:l,isBottom:c,isLeft:d,isRight:u}=B(e),g={x:0,y:0},p={x:0,y:0},f=t.height*s.y,h=t.width*s.x;return!l&&n<=t.top+f?(g.y=K.Backward,p.y=a*Math.abs((t.top+f-n)/f)):!c&&i>=t.bottom-f&&(g.y=K.Forward,p.y=a*Math.abs((t.bottom-f-i)/f)),!u&&o>=t.right-h?(g.x=K.Forward,p.x=a*Math.abs((t.right-h-o)/h)):!d&&r<=t.left+h&&(g.x=K.Backward,p.x=a*Math.abs((t.left+h-r)/h)),{direction:g,speed:p}}function W(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 F(e){return e.reduce((e,t)=>o.add(e,T(t)),d)}function U(e,t=S){if(!e)return;const{top:n,left:r,bottom:o,right:i}=t(e);N(e)&&(o<=0||i<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const j=[["x",["left","right"],function(e){return e.reduce((e,t)=>e+k(t),0)}],["y",["top","bottom"],function(e){return e.reduce((e,t)=>e+A(t),0)}]];class q{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=O(t),r=F(n);this.rect={...e},this.width=e.width,this.height=e.height;for(const[e,t,o]of j)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})}}class H{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 X(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 Y,$;function V(e){e.preventDefault()}function J(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"}(Y||(Y={})),($=exports.KeyboardCode||(exports.KeyboardCode={})).Space="Space",$.Down="ArrowDown",$.Right="ArrowRight",$.Left="ArrowLeft",$.Up="ArrowUp",$.Esc="Escape",$.Enter="Enter";const _={start:[exports.KeyboardCode.Space,exports.KeyboardCode.Enter],cancel:[exports.KeyboardCode.Esc],end:[exports.KeyboardCode.Space,exports.KeyboardCode.Enter]},G=(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 Q{constructor(e){this.props=void 0,this.autoScrollEnabled=!1,this.coordinates=d,this.listeners=void 0,this.windowListeners=void 0,this.props=e;const{event:{target:t}}=e;this.props=e,this.listeners=new H(o.getOwnerDocument(t)),this.windowListeners=new H(o.getWindow(t)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(Y.Resize,this.handleCancel),this.windowListeners.add(Y.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(Y.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:e,onStart:t}=this.props;if(!e.node.current)throw new Error("Active draggable node is undefined");U(e.node.current);const n=M(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=_,coordinateGetter:s=G,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:g,maxScroll:p,minScroll:f}=B(r),h=W(r),v={x:Math.min(i===exports.KeyboardCode.Right?h.right-h.width/2:h.right,Math.max(i===exports.KeyboardCode.Right?h.left:h.left+h.width/2,d.x)),y:Math.min(i===exports.KeyboardCode.Down?h.bottom-h.height/2:h.bottom,Math.max(i===exports.KeyboardCode.Down?h.top:h.top+h.height/2,d.y))},b=i===exports.KeyboardCode.Right&&!c||i===exports.KeyboardCode.Left&&!u,m=i===exports.KeyboardCode.Down&&!g||i===exports.KeyboardCode.Up&&!s;if(b&&v.x!==d.x){const e=r.scrollLeft+a.x;if(i===exports.KeyboardCode.Right&&e<=p.x||i===exports.KeyboardCode.Left&&e>=f.x)return void r.scrollTo({left:e,behavior:l});n.x=i===exports.KeyboardCode.Right?r.scrollLeft-p.x:r.scrollLeft-f.x,r.scrollBy({left:-n.x,behavior:l});break}if(m&&v.y!==d.y){const e=r.scrollTop+a.y;if(i===exports.KeyboardCode.Down&&e<=p.y||i===exports.KeyboardCode.Up&&e>=f.y)return void r.scrollTo({top:e,behavior:l});n.y=i===exports.KeyboardCode.Down?r.scrollTop-p.y:r.scrollTop-f.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 Z(e){return Boolean(e&&"distance"in e)}function ee(e){return Boolean(e&&"delay"in e)}Q.activators=[{eventName:"onKeyDown",handler:(e,{keyboardCodes:t=_,onActivation:n})=>{const{code:r}=e.nativeEvent;return!!t.start.includes(r)&&(e.preventDefault(),null==n||n({event:e.nativeEvent}),!0)}}];class te{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 H(this.document),this.listeners=new H(n),this.windowListeners=new H(o.getWindow(a)),this.initialCoordinates=null!=(r=o.getEventCoordinates(i))?r:d,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(Y.Resize,this.handleCancel),this.windowListeners.add(Y.DragStart,V),this.windowListeners.add(Y.VisibilityChange,this.handleCancel),this.windowListeners.add(Y.ContextMenu,V),this.documentListeners.add(Y.Keydown,this.handleKeydown),t){if(Z(t))return;if(ee(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(Y.Click,J,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(Y.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:d,c=o.subtract(r,l);if(!n&&s){if(ee(s))return X(c,s.tolerance)?this.handleCancel():void 0;if(Z(s))return null!=s.tolerance&&X(c,s.tolerance)?this.handleCancel():X(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 ne={move:{name:"pointermove"},end:{name:"pointerup"}};class re extends te{constructor(e){const{event:t}=e,n=o.getOwnerDocument(t.target);super(e,ne,n)}}re.activators=[{eventName:"onPointerDown",handler:({nativeEvent:e},{onActivation:t})=>!(!e.isPrimary||0!==e.button||(null==t||t({event:e}),0))}];const oe={move:{name:"mousemove"},end:{name:"mouseup"}};var ie;!function(e){e[e.RightClick=2]="RightClick"}(ie||(ie={}));class ae extends te{constructor(e){super(e,oe,o.getOwnerDocument(e.event.target))}}ae.activators=[{eventName:"onMouseDown",handler:({nativeEvent:e},{onActivation:t})=>e.button!==ie.RightClick&&(null==t||t({event:e}),!0)}];const se={move:{name:"touchmove"},end:{name:"touchend"}};class le extends te{constructor(e){super(e,se)}static setup(){return window.addEventListener(se.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(se.move.name,e)};function e(){}}}var ce,de;le.activators=[{eventName:"onTouchStart",handler:({nativeEvent:e},{onActivation:t})=>{const{touches:n}=e;return!(n.length>1||(null==t||t({event:e}),0))}}],(ce=exports.AutoScrollActivator||(exports.AutoScrollActivator={}))[ce.Pointer=0]="Pointer",ce[ce.DraggableRect=1]="DraggableRect",(de=exports.TraversalOrder||(exports.TraversalOrder={}))[de.TreeOrder=0]="TreeOrder",de[de.ReversedTreeOrder=1]="ReversedTreeOrder";const ue={x:{[K.Backward]:!1,[K.Forward]:!1},y:{[K.Backward]:!1,[K.Forward]:!1}};var ge;(ge=exports.MeasuringStrategy||(exports.MeasuringStrategy={}))[ge.Always=0]="Always",ge[ge.BeforeDragging=1]="BeforeDragging",ge[ge.WhileDragging=2]="WhileDragging",(exports.MeasuringFrequency||(exports.MeasuringFrequency={})).Optimized="optimized";const pe=new Map;function fe(e){return o.useLazyMemo(t=>e?t||e:null,[e])}function he({callback:e,disabled:n}){const r=o.useEvent(e),i=t.useMemo(()=>{if(n||"undefined"==typeof window||void 0===window.ResizeObserver)return;const{ResizeObserver:e}=window;return new e(r)},[n]);return t.useEffect(()=>()=>null==i?void 0:i.disconnect(),[i]),i}function ve(e,n=S){const[r,i]=t.useReducer((function(t){if(!e)return null;const r=n(e);return JSON.stringify(t)===JSON.stringify(r)?t:r}),null),a=function({callback:e,disabled:n}){const r=o.useEvent(e),i=t.useMemo(()=>{if(n||"undefined"==typeof window||void 0===window.MutationObserver)return;const{MutationObserver:e}=window;return new e(r)},[r,n]);return t.useEffect(()=>()=>null==i?void 0:i.disconnect(),[i]),i}({callback(t){if(e)for(const n of t){const{type:t,target:r}=n;if("childList"===t&&r instanceof HTMLElement&&r.contains(e)){i();break}}}}),s=he({callback:i});return o.useIsomorphicLayoutEffect(()=>{i(),e?(null==s||s.observe(e),null==a||a.observe(document.body,{childList:!0,subtree:!0})):(null==s||s.disconnect(),null==a||a.disconnect())},[e]),r}const be=[];function me(e,n=[]){const r=t.useRef(null);return t.useEffect(()=>{r.current=null},n),t.useEffect(()=>{const t=e!==d;t&&!r.current&&(r.current=e),!t&&r.current&&(r.current=null)},[e]),r.current?o.subtract(e,r.current):d}function ye(e){return t.useMemo(()=>e?function(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}(e):null,[e])}const xe=[];function we(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return o.isHTMLElement(t)?t:e}const Ce=[{sensor:re,options:{}},{sensor:Q,options:{}}],De={current:{}},Ee={draggable:{measure:M},droppable:{measure:M,strategy:exports.MeasuringStrategy.WhileDragging,frequency:exports.MeasuringFrequency.Optimized},dragOverlay:{measure:S}};class Re 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 Se={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:{},droppableRects:new Map,droppableContainers:new Re,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:c},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:Ee,measureDroppableContainers:c,windowRect:null,measuringScheduled:!1},Me={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:c,draggableNodes:{},over:null,measureDroppableContainers:c},Oe=t.createContext(Me),Ne=t.createContext(Se);function Le(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:{},translate:{x:0,y:0}},droppable:{containers:new Re}}}function ke(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 Re(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 Re(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 Re(e.droppable.containers);return i.delete(n),{...e,droppable:{...e.droppable,containers:i}}}default:return e}}const Ae=t.createContext({type:null,event:null});function Te({onDragStart:e,onDragMove:n,onDragOver:r,onDragEnd:o,onDragCancel:i}){const a=t.useContext(Ae),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 Ke({announcements:e=s,hiddenTextDescribedById:a,screenReaderInstructions:l}){const{announce:c,announcement:d}=i.useAnnouncement(),u=o.useUniqueId("DndLiveRegion"),[g,p]=t.useState(!1);return t.useEffect(()=>{p(!0)},[]),Te(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])),g?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}function Ie(e,{transform:t,...n}){return(null==e?void 0:e.length)?e.reduce((e,t)=>t({transform:e,...n}),t):t}const Be=t.createContext({...d,scaleX:1,scaleY:1});var ze;!function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"}(ze||(ze={}));const Pe=t.memo((function({id:e,autoScroll:i=!0,announcements:s,children:c,sensors:u=Ce,collisionDetection:g=y,measuring:p,modifiers:f,screenReaderInstructions:h=a,...b}){var m,x,C,E;const R=t.useReducer(ke,void 0,Le),[M,k]=R,[A,B]=t.useState(()=>({type:null,event:null})),[z,W]=t.useState(ze.Uninitialized),U=z===ze.Initialized,{draggable:{active:j,nodes:H,translate:X},droppable:{containers:Y}}=M,$=j?H[j]:null,V=t.useRef({initial:null,translated:null}),J=t.useMemo(()=>{var e;return null!=j?{id:j,data:null!=(e=null==$?void 0:$.data)?e:De,rect:V}:null},[j,$]),_=t.useRef(null),[G,Q]=t.useState(null),[Z,ee]=t.useState(null),te=o.useLatestValue(b,Object.values(b)),ne=o.useUniqueId("DndDescribedBy",e),re=t.useMemo(()=>Y.getEnabled(),[Y]),oe=t.useMemo(()=>({draggable:{...Ee.draggable,...null==ie?void 0:ie.draggable},droppable:{...Ee.droppable,...null==ie?void 0:ie.droppable},dragOverlay:{...Ee.dragOverlay,...null==ie?void 0:ie.dragOverlay}}),[null==(ie=p)?void 0:ie.draggable,null==ie?void 0:ie.droppable,null==ie?void 0:ie.dragOverlay]);var ie;const{droppableRects:ae,measureDroppableContainers:se,measuringScheduled:le}=function(e,{dragging:n,dependencies:r,config:i}){const[a,s]=t.useState(null),l=null!=a,{frequency:c,measure:d,strategy:u}=i,g=t.useRef(e),p=function(){switch(u){case exports.MeasuringStrategy.Always:return!1;case exports.MeasuringStrategy.BeforeDragging:return n;default:return!n}}(),f=o.useLatestValue(p),h=t.useCallback((e=[])=>{f.current||s(t=>t?t.concat(e):e)},[f]),v=t.useRef(null),b=o.useLazyMemo(t=>{if(p&&!n)return pe;const r=a;if(!t||t===pe||g.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 q(d(e),e):null;n.rect.current=o,o&&t.set(n.id,o)}return t}return t},[e,a,n,p,d]);return t.useEffect(()=>{g.current=e},[e]),t.useEffect(()=>{p||requestAnimationFrame(()=>h())},[n,p]),t.useEffect(()=>{l&&s(null)},[l]),t.useEffect(()=>{p||"number"!=typeof c||null!==v.current||(v.current=setTimeout(()=>{h(),v.current=null},c))},[c,p,h,...r]),{droppableRects:b,measureDroppableContainers:h,measuringScheduled:l}}(re,{dragging:U,dependencies:[X.x,X.y],config:oe.droppable}),ce=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])}(H,j),de=t.useMemo(()=>Z?o.getEventCoordinates(Z):null,[Z]),ge=function(){const e=U&&!(!1===(null==G?void 0:G.autoScrollEnabled))&&!("object"==typeof i?!1===i.enabled:!1===i);return"object"==typeof i?{...i,enabled:e}:{enabled:e}}(),Re=function(e,{disabled:n,measure:r}){const i=fe(e),a=t.useRef(null);return o.useIsomorphicLayoutEffect(()=>{if(!i)return void(a.current=null);if(n||!a.current)return;const e=w(r(i),a.current);if(e.x>0||e.y>0){const t=N(i);t&&t.scrollBy({top:e.y,left:e.x})}},[n,i,r]),t.useCallback(e=>{a.current=r(e)},[r])}(ce,{disabled:null==de||!1===ge.layoutShiftCompensation,measure:oe.draggable.measure}),Se=ve(ce,oe.draggable.measure),Me=fe(Se),Te=ve(ce?ce.parentElement:null),Pe=t.useRef({active:null,activeNode:ce,collisionRect:null,collisions:null,droppableRects:ae,draggableNodes:H,draggingNode:null,draggingNodeRect:null,droppableContainers:Y,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),We=Y.getNodeFor(null==(m=Pe.current.over)?void 0:m.id),Fe=function({measure:e}){const[n,r]=t.useState(null),i=he({callback: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.useCallback(t=>{const n=we(t);null==i||i.disconnect(),n&&(null==i||i.observe(n)),r(n?e(n):null)},[e,i]),[s,l]=o.useNodeRef(a);return t.useMemo(()=>({nodeRef:s,rect:n,setRef:l}),[n,s,l])}({measure:oe.dragOverlay.measure}),Ue=null!=(x=Fe.nodeRef.current)?x:ce,je=U?null!=(C=Fe.rect)?C:Se:null,qe=Boolean(Fe.nodeRef.current&&Fe.rect),He=qe?d:w(Se,Me),Xe=ye(Ue?o.getWindow(Ue):null),Ye=function(e){const n=t.useRef(e),r=o.useLazyMemo(t=>e?t&&e&&n.current&&e.parentNode===n.current.parentNode?t:O(e):be,[e]);return t.useEffect(()=>{n.current=e},[e]),r}(U?null!=We?We:Ue:null),$e=function(e,n=S){const[r]=e,i=ye(r?o.getWindow(r):null),[a,s]=t.useReducer((function(){return e.length?e.map(e=>I(e)?i:new q(n(e),e)):xe}),xe),l=he({callback:s});return e.length>0&&a===xe&&s(),o.useIsomorphicLayoutEffect(()=>{e.length?e.forEach(e=>null==l?void 0:l.observe(e)):(null==l||l.disconnect(),s())},[e]),a}(Ye),Ve=Ie(f,{transform:{x:X.x-He.x,y:X.y-He.y,scaleX:1,scaleY:1},activatorEvent:Z,active:J,activeNodeRect:Se,containerNodeRect:Te,draggingNodeRect:je,over:Pe.current.over,overlayNodeRect:Fe.rect,scrollableAncestors:Ye,scrollableAncestorRects:$e,windowRect:Xe}),Je=de?o.add(de,X):null,_e=function(e){const[n,r]=t.useState(null),i=t.useRef(e),a=t.useCallback(e=>{const t=L(e.target);t&&r(e=>e?(e.set(t,T(t)),new Map(e)):null)},[]);return t.useEffect(()=>{const t=i.current;if(e!==t){n(t);const o=e.map(e=>{const t=L(e);return t?(t.addEventListener("scroll",a,{passive:!0}),[t,T(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=L(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),d):F(e):d,[e,n])}(Ye),Ge=me(_e),Qe=me(_e,[Se]),Ze=o.add(Ve,Ge),et=je?D(je,Ve):null,tt=J&&et?g({active:J,collisionRect:et,droppableRects:ae,droppableContainers:re,pointerCoordinates:Je}):null,nt=v(tt,"id"),[rt,ot]=t.useState(null),it=function(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}(qe?Ve:o.add(Ve,Qe),null!=(E=null==rt?void 0:rt.rect)?E:null,Se),at=t.useCallback((e,{sensor:t,options:n})=>{if(!_.current)return;const o=H[_.current];if(!o)return;const i=new t({active:_.current,activeNode:o,event:e.nativeEvent,options:n,context:Pe,onStart(e){const t=_.current;if(!t)return;const n=H[t];if(!n)return;const{onDragStart:o}=te.current,i={active:{id:t,data:n.data,rect:V}},a=n.node.current;a&&Re(a),r.unstable_batchedUpdates(()=>{null==o||o(i),W(ze.Initializing),k({type:l.DragStart,initialCoordinates:e,active:t}),B({type:l.DragStart,event:i})})},onMove(e){k({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}=Pe.current;let a=null;if(t&&i){const{cancelDrop:r}=te.current;a={active:t,collisions:n,delta:i,over:o},e===l.DragEnd&&"function"==typeof r&&await Promise.resolve(r(a))&&(e=l.DragCancel)}_.current=null,r.unstable_batchedUpdates(()=>{if(k({type:e}),W(ze.Uninitialized),ot(null),Q(null),ee(null),a&&B({type:e,event:a}),a){const{onDragCancel:t,onDragEnd:n}=te.current,r=e===l.DragEnd?n:t;null==r||r(a)}})}}r.unstable_batchedUpdates(()=>{Q(i),ee(e.nativeEvent)})},[H]),st=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])}(u,t.useCallback((e,t)=>(n,r)=>{const o=n.nativeEvent;null!==_.current||o.dndKit||o.defaultPrevented||!0===e(n,t.options)&&(o.dndKit={capturedBy:t.sensor},_.current=r,at(n,t))},[at]));!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))}(u),o.useIsomorphicLayoutEffect(()=>{Se&&z===ze.Initializing&&W(ze.Initialized)},[Se,z]),t.useEffect(()=>{const{onDragMove:e}=te.current,{active:t,collisions:n,over:r}=Pe.current;if(!t)return;const o={active:t,collisions:n,delta:{x:Ze.x,y:Ze.y},over:r};B({type:l.DragMove,event:o}),null==e||e(o)},[Ze.x,Ze.y]),t.useEffect(()=>{const{active:e,collisions:t,droppableContainers:n,scrollAdjustedTranslate:o}=Pe.current;if(!e||!_.current||!o)return;const{onDragOver:i}=te.current,a=n.get(nt),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(()=>{ot(s),B({type:l.DragOver,event:c}),null==i||i(c)})},[nt]),o.useIsomorphicLayoutEffect(()=>{Pe.current={active:J,activeNode:ce,collisionRect:et,collisions:tt,droppableRects:ae,draggableNodes:H,draggingNode:Ue,draggingNodeRect:je,droppableContainers:Y,over:rt,scrollableAncestors:Ye,scrollAdjustedTranslate:Ze},V.current={initial:je,translated:et}},[J,ce,tt,et,H,Ue,je,ae,Y,rt,Ye,Ze]),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,delta:g,threshold:p}){const f=function({delta:e,disabled:t}){const n=o.usePrevious(e);return o.useLazyMemo(r=>{if(t||!n||!r)return ue;const o=Math.sign(e.x-n.x),i=Math.sign(e.y-n.y);return{x:{[K.Backward]:r.x[K.Backward]||-1===o,[K.Forward]:r.x[K.Forward]||1===o},y:{[K.Backward]:r.y[K.Backward]||-1===i,[K.Forward]:r.y[K.Forward]||1===i}}},[t,e,n])}({delta:g,disabled:!a}),[h,v]=o.useInterval(),b=t.useRef({x:0,y:0}),m=t.useRef({x:0,y:0}),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 i}},[n,i,c]),x=t.useRef(null),w=t.useCallback(()=>{const e=x.current;e&&e.scrollBy(b.current.x*m.current.x,b.current.y*m.current.y)},[]),C=t.useMemo(()=>l===exports.TraversalOrder.TreeOrder?[...d].reverse():d,[l,d]);t.useEffect(()=>{if(a&&d.length&&y){for(const t of C){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}=P(t,o,y,e,p);if(a.x>0&&f.x[i.x]||a.y>0&&f.y[i.y])return v(),x.current=t,h(w,s),b.current=a,void(m.current=i)}b.current={x:0,y:0},m.current={x:0,y:0},v()}else v()},[e,w,r,v,a,s,JSON.stringify(y),JSON.stringify(f),h,d,C,u,JSON.stringify(p)])}({...ge,delta:X,draggingRect:et,pointerCoordinates:Je,scrollableAncestors:Ye,scrollableAncestorRects:$e});const lt=t.useMemo(()=>({active:J,activeNode:ce,activeNodeRect:Se,activatorEvent:Z,collisions:tt,containerNodeRect:Te,dragOverlay:Fe,draggableNodes:H,droppableContainers:Y,droppableRects:ae,over:rt,measureDroppableContainers:se,scrollableAncestors:Ye,scrollableAncestorRects:$e,measuringConfiguration:oe,measuringScheduled:le,windowRect:Xe}),[J,ce,Se,Z,tt,Te,Fe,H,Y,ae,rt,se,Ye,$e,oe,le,Xe]),ct=t.useMemo(()=>({activatorEvent:Z,activators:st,active:J,activeNodeRect:Se,ariaDescribedById:{draggable:ne},dispatch:k,draggableNodes:H,over:rt,measureDroppableContainers:se}),[Z,st,J,Se,k,ne,H,rt,se]);return n.createElement(Ae.Provider,{value:A},n.createElement(Oe.Provider,{value:ct},n.createElement(Ne.Provider,{value:lt},n.createElement(Be.Provider,{value:it},c))),n.createElement(Ke,{announcements:s,hiddenTextDescribedById:ne,screenReaderInstructions:h}))})),We=t.createContext(null),Fe="button";function Ue(){return t.useContext(Ne)}const je={timeout:25};function qe({animation:e,children:r}){const[i,a]=t.useState(null),[s,l]=t.useState(null),c=o.usePrevious(r);return r||i||!c||a(c),o.useIsomorphicLayoutEffect(()=>{if(!s)return;const t=null==i?void 0:i.key;if("string"!=typeof t)return void a(null);const[n]=t.split("-",1),r=t.substring(n.length+1);Promise.resolve(e(r,s)).then(()=>{a(null)})},[e,i,s]),n.createElement(n.Fragment,null,r,i?t.cloneElement(i,{ref:l}):null)}const He={x:0,y:0,scaleX:1,scaleY:1};function Xe({children:e}){return n.createElement(Oe.Provider,{value:Me},n.createElement(Be.Provider,{value:He},e))}const Ye={position:"fixed",touchAction:"none"},$e=e=>o.isKeyboardEvent(e)?"transform 250ms ease":void 0,Ve=t.forwardRef(({as:e,activatorEvent:t,adjustScale:r,children:i,className:a,rect:s,style:l,transform:c,transition:d=$e},u)=>{if(!s)return null;const p=r?c:{...c,scaleX:1,scaleY:1},f={...Ye,width:s.width,height:s.height,top:s.top,left:s.left,transform:o.CSS.Transform.toString(p),transformOrigin:r&&t?g(t,s):void 0,transition:"function"==typeof d?d(t):d,...l};return n.createElement(e,{className:a,style:f,ref:u},i)}),Je=e=>({active:t,dragOverlay:n})=>{const r={},{styles:o,className:i}=e;if(null==o?void 0:o.active)for(const[e,n]of Object.entries(o.active))void 0!==n&&(r[e]=t.node.style.getPropertyValue(e),t.node.style.setProperty(e,n));if(null==o?void 0:o.dragOverlay)for(const[e,t]of Object.entries(o.dragOverlay))void 0!==t&&n.node.style.setProperty(e,t);return(null==i?void 0:i.active)&&t.node.classList.add(i.active),(null==i?void 0:i.dragOverlay)&&n.node.classList.add(i.dragOverlay),function(){for(const[e,n]of Object.entries(r))t.node.style.setProperty(e,n);(null==i?void 0:i.active)&&t.node.classList.remove(i.active)}},_e={duration:250,easing:"ease",keyframes:({transform:{initial:e,final:t}})=>[{transform:o.CSS.Transform.toString(e)},{transform:o.CSS.Transform.toString(t)}],sideEffects:Je({styles:{active:{opacity:"0"}}})};let Ge=0;function Qe(e){return t.useMemo(()=>{if(null!=e)return Ge++,Ge},[e])}const Ze=n.memo(({adjustScale:e=!1,children:r,dropAnimation:i,style:a,transition:s,modifiers:l,wrapperElement:c="div",className:d,zIndex:u=999})=>{const{activatorEvent:g,active:p,activeNodeRect:f,containerNodeRect:h,draggableNodes:v,droppableContainers:b,dragOverlay:m,over:y,measuringConfiguration:x,scrollableAncestors:w,scrollableAncestorRects:C,windowRect:D}=Ue(),R=t.useContext(Be),S=Qe(null==p?void 0:p.id),M=Ie(l,{activatorEvent:g,active:p,activeNodeRect:f,containerNodeRect:h,draggingNodeRect:m.rect,over:y,overlayNodeRect:m.rect,scrollableAncestors:w,scrollableAncestorRects:C,transform:R,windowRect:D}),O=fe(f),N=function({config:e,draggableNodes:t,droppableContainers:n,measuringConfiguration:r}){return o.useEvent((i,a)=>{if(null===e)return;const s=t[i];if(!s)return;const l=s.node.current;if(!l)return;const c=we(a);if(!c)return;const{transform:d}=o.getWindow(a).getComputedStyle(a),u=E(d);if(!u)return;const g="function"==typeof e?e:function(e){const{duration:t,easing:n,sideEffects:r,keyframes:o}={..._e,...e};return({active:e,dragOverlay:i,transform:a,...s})=>{if(!t)return;const l={x:a.x-(i.rect.left-e.rect.left),y:a.y-(i.rect.top-e.rect.top),scaleX:1!==a.scaleX?e.rect.width*a.scaleX/i.rect.width:1,scaleY:1!==a.scaleY?e.rect.height*a.scaleY/i.rect.height:1},c=o({...s,active:e,dragOverlay:i,transform:{initial:a,final:l}}),[d]=c,u=c[c.length-1];if(JSON.stringify(d)===JSON.stringify(u))return;const g=null==r?void 0:r({active:e,dragOverlay:i,...s}),p=i.node.animate(c,{easing:n,duration:t});return new Promise(e=>{p.onfinish=()=>{null==g||g(),e()}})}}(e);return U(l,r.draggable.measure),g({active:{id:i,data:s.data,node:l,rect:r.draggable.measure(l)},draggableNodes:t,dragOverlay:{node:a,rect:r.dragOverlay.measure(c)},droppableContainers:n,measuringConfiguration:r,transform:u})})}({config:i,draggableNodes:v,droppableContainers:b,measuringConfiguration:x});return n.createElement(Xe,null,n.createElement(qe,{animation:N},p&&S?n.createElement(Ve,{key:`${S}-${p.id}`,ref:O?m.setRef:void 0,as:c,activatorEvent:g,adjustScale:e,className:d,transition:s,rect:O,style:{zIndex:u,...a},transform:M},r):null))});exports.DndContext=Pe,exports.DragOverlay=Ze,exports.KeyboardSensor=Q,exports.MouseSensor=ae,exports.PointerSensor=re,exports.TouchSensor=le,exports.applyModifiers=Ie,exports.closestCenter=({collisionRect:e,droppableRects:t,droppableContainers:n})=>{const r=b(e,e.left,e.top),o=[];for(const e of n){const{id:n}=e,i=t.get(n);if(i){const t=u(b(i),r);o.push({id:n,data:{droppableContainer:e,value:t}})}}return o.sort(p)},exports.closestCorners=({collisionRect:e,droppableRects:t,droppableContainers:n})=>{const r=h(e),o=[];for(const e of n){const{id:n}=e,i=t.get(n);if(i){const t=h(i),a=r.reduce((e,n,r)=>e+u(t[r],n),0),s=Number((a/4).toFixed(4));o.push({id:n,data:{droppableContainer:e,value:s}})}}return o.sort(p)},exports.defaultAnnouncements=s,exports.defaultCoordinates=d,exports.defaultDropAnimation=_e,exports.defaultDropAnimationSideEffects=Je,exports.getClientRect=S,exports.getFirstCollision=v,exports.getScrollableAncestors=O,exports.pointerWithin=({droppableContainers:e,droppableRects:t,pointerCoordinates:n})=>{if(!n)return[];const r=[];for(const o of e){const{id:e}=o,i=t.get(e);if(i&&x(n,i)){const t=h(i).reduce((e,t)=>e+u(n,t),0),a=Number((t/4).toFixed(4));r.push({id:e,data:{droppableContainer:o,value:a}})}}return r.sort(p)},exports.rectIntersection=y,exports.useDndContext=Ue,exports.useDndMonitor=Te,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:g,over:p}=t.useContext(Oe),{role:f=Fe,roleDescription:h="draggable",tabIndex:v=0}=null!=i?i:{},b=(null==c?void 0:c.id)===e,m=t.useContext(b?Be:We),[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])}(s,e),C=o.useLatestValue(n);return o.useIsomorphicLayoutEffect(()=>(g[e]={id:e,key:a,node:y,data:C},()=>{const t=g[e];t&&t.key===a&&delete g[e]}),[g,e]),{active:c,activatorEvent:l,activeNodeRect:d,attributes:t.useMemo(()=>({role:f,tabIndex:v,"aria-pressed":!(!b||f!==Fe)||void 0,"aria-roledescription":h,"aria-describedby":u.draggable}),[f,v,b,h,u.draggable]),isDragging:b,listeners:r?void 0:w,node:y,over:p,setNodeRef:x,transform:m}},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(Oe),g=t.useRef({disabled:n}),p=t.useRef(!1),f=t.useRef(null),h=t.useRef(null),{disabled:v,updateMeasurementsFor:b,timeout:m}={...je,...i},y=o.useLatestValue(null!=b?b:r),x=he({callback:t.useCallback(()=>{p.current?(null!=h.current&&clearTimeout(h.current),h.current=setTimeout(()=>{u("string"==typeof y.current?[y.current]:y.current),h.current=null},m)):p.current=!0},[m]),disabled:v||!s}),w=t.useCallback((e,t)=>{x&&(t&&(x.unobserve(t),p.current=!1),e&&x.observe(e))},[x]),[C,D]=o.useNodeRef(w),E=o.useLatestValue(e);return t.useEffect(()=>{x&&C.current&&(x.disconnect(),p.current=!1,x.observe(C.current))},[C,x]),o.useIsomorphicLayoutEffect(()=>(c({type:l.RegisterDroppable,element:{id:r,key:a,disabled:n,node:C,rect:f,data:E}}),()=>c({type:l.UnregisterDroppable,key:a,id:r})),[r]),t.useEffect(()=>{n!==g.current.disabled&&(c({type:l.SetDroppableDisabled,id:r,key:a,disabled:n}),g.current.disabled=n)},[r,a,n,c]),{active:s,rect:f,isOver:(null==d?void 0:d.id)===r,node:C,over:d,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"),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={}));const d=Object.freeze({x:0,y:0});function u(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function g(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 p({data:{value:e}},{data:{value:t}}){return e-t}function f({data:{value:e}},{data:{value:t}}){return t-e}function h({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 v(e,t){if(!e||0===e.length)return null;const[n]=e;return t?n[t]:n}function b(e,t=e.left,n=e.top){return{x:t+.5*e.width,y:n+.5*e.height}}function m(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 y=({collisionRect:e,droppableRects:t,droppableContainers:n})=>{const r=[];for(const o of n){const{id:n}=o,i=t.get(n);if(i){const t=m(i,e);t>0&&r.push({id:n,data:{droppableContainer:o,value:t}})}}return r.sort(f)};function x(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 w(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:d}function C(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 D=C(1);function E(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}const R={ignoreTransform:!1};function S(e,t=R){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){const r=E(t);if(!r)return e;const{scaleX:o,scaleY:i,x:a,y:s}=r,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 M(e){return S(e,{ignoreTransform:!0})}function O(e,t){const n=[];return e?function r(i){if(null!=t&&n.length>=t)return n;if(!i)return n;if(o.isDocument(i)&&null!=i.scrollingElement&&!n.includes(i.scrollingElement))return n.push(i.scrollingElement),n;if(!o.isHTMLElement(i)||o.isSVGElement(i))return n;if(n.includes(i))return n;const{getComputedStyle:a}=o.getWindow(i),s=a(i);return i!==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)})}(i,s)&&n.push(i),function(e,t=o.getWindow(e).getComputedStyle(e)){return"fixed"===t.position}(i,s)?n:r(i.parentNode)}(e):n}function N(e){const[t]=O(e,1);return null!=t?t:null}function L(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 k(e){return o.isWindow(e)?e.scrollX:e.scrollLeft}function A(e){return o.isWindow(e)?e.scrollY:e.scrollTop}function T(e){return{x:k(e),y:A(e)}}var K;function I(e){return!(!o.canUseDOM||!e)&&e===document.scrollingElement}function B(e){const t={x:0,y:0},n=I(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height};return{isTop:e.scrollTop<=t.y,isLeft:e.scrollLeft<=t.x,isBottom:e.scrollTop>=r.y,isRight:e.scrollLeft>=r.x,maxScroll:r,minScroll:t}}!function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"}(K||(K={}));const z={x:.2,y:.2};function P(e,t,{top:n,left:r,right:o,bottom:i},a=10,s=z){const{isTop:l,isBottom:c,isLeft:d,isRight:u}=B(e),g={x:0,y:0},p={x:0,y:0},f=t.height*s.y,h=t.width*s.x;return!l&&n<=t.top+f?(g.y=K.Backward,p.y=a*Math.abs((t.top+f-n)/f)):!c&&i>=t.bottom-f&&(g.y=K.Forward,p.y=a*Math.abs((t.bottom-f-i)/f)),!u&&o>=t.right-h?(g.x=K.Forward,p.x=a*Math.abs((t.right-h-o)/h)):!d&&r<=t.left+h&&(g.x=K.Backward,p.x=a*Math.abs((t.left+h-r)/h)),{direction:g,speed:p}}function W(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 F(e){return e.reduce((e,t)=>o.add(e,T(t)),d)}function U(e,t=S){if(!e)return;const{top:n,left:r,bottom:o,right:i}=t(e);N(e)&&(o<=0||i<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const j=[["x",["left","right"],function(e){return e.reduce((e,t)=>e+k(t),0)}],["y",["top","bottom"],function(e){return e.reduce((e,t)=>e+A(t),0)}]];class q{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=O(t),r=F(n);this.rect={...e},this.width=e.width,this.height=e.height;for(const[e,t,o]of j)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})}}class H{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 X(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 Y,$;function V(e){e.preventDefault()}function J(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"}(Y||(Y={})),($=exports.KeyboardCode||(exports.KeyboardCode={})).Space="Space",$.Down="ArrowDown",$.Right="ArrowRight",$.Left="ArrowLeft",$.Up="ArrowUp",$.Esc="Escape",$.Enter="Enter";const _={start:[exports.KeyboardCode.Space,exports.KeyboardCode.Enter],cancel:[exports.KeyboardCode.Esc],end:[exports.KeyboardCode.Space,exports.KeyboardCode.Enter]},G=(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 Q{constructor(e){this.props=void 0,this.autoScrollEnabled=!1,this.coordinates=d,this.listeners=void 0,this.windowListeners=void 0,this.props=e;const{event:{target:t}}=e;this.props=e,this.listeners=new H(o.getOwnerDocument(t)),this.windowListeners=new H(o.getWindow(t)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(Y.Resize,this.handleCancel),this.windowListeners.add(Y.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(Y.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:e,onStart:t}=this.props;if(!e.node.current)throw new Error("Active draggable node is undefined");U(e.node.current);const n=M(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=_,coordinateGetter:s=G,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:g,maxScroll:p,minScroll:f}=B(r),h=W(r),v={x:Math.min(i===exports.KeyboardCode.Right?h.right-h.width/2:h.right,Math.max(i===exports.KeyboardCode.Right?h.left:h.left+h.width/2,d.x)),y:Math.min(i===exports.KeyboardCode.Down?h.bottom-h.height/2:h.bottom,Math.max(i===exports.KeyboardCode.Down?h.top:h.top+h.height/2,d.y))},b=i===exports.KeyboardCode.Right&&!c||i===exports.KeyboardCode.Left&&!u,m=i===exports.KeyboardCode.Down&&!g||i===exports.KeyboardCode.Up&&!s;if(b&&v.x!==d.x){const e=r.scrollLeft+a.x;if(i===exports.KeyboardCode.Right&&e<=p.x||i===exports.KeyboardCode.Left&&e>=f.x)return void r.scrollTo({left:e,behavior:l});n.x=i===exports.KeyboardCode.Right?r.scrollLeft-p.x:r.scrollLeft-f.x,r.scrollBy({left:-n.x,behavior:l});break}if(m&&v.y!==d.y){const e=r.scrollTop+a.y;if(i===exports.KeyboardCode.Down&&e<=p.y||i===exports.KeyboardCode.Up&&e>=f.y)return void r.scrollTo({top:e,behavior:l});n.y=i===exports.KeyboardCode.Down?r.scrollTop-p.y:r.scrollTop-f.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 Z(e){return Boolean(e&&"distance"in e)}function ee(e){return Boolean(e&&"delay"in e)}Q.activators=[{eventName:"onKeyDown",handler:(e,{keyboardCodes:t=_,onActivation:n})=>{const{code:r}=e.nativeEvent;return!!t.start.includes(r)&&(e.preventDefault(),null==n||n({event:e.nativeEvent}),!0)}}];class te{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 H(this.document),this.listeners=new H(n),this.windowListeners=new H(o.getWindow(a)),this.initialCoordinates=null!=(r=o.getEventCoordinates(i))?r:d,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(Y.Resize,this.handleCancel),this.windowListeners.add(Y.DragStart,V),this.windowListeners.add(Y.VisibilityChange,this.handleCancel),this.windowListeners.add(Y.ContextMenu,V),this.documentListeners.add(Y.Keydown,this.handleKeydown),t){if(Z(t))return;if(ee(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(Y.Click,J,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(Y.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:d,c=o.subtract(r,l);if(!n&&s){if(ee(s))return X(c,s.tolerance)?this.handleCancel():void 0;if(Z(s))return null!=s.tolerance&&X(c,s.tolerance)?this.handleCancel():X(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 ne={move:{name:"pointermove"},end:{name:"pointerup"}};class re extends te{constructor(e){const{event:t}=e,n=o.getOwnerDocument(t.target);super(e,ne,n)}}re.activators=[{eventName:"onPointerDown",handler:({nativeEvent:e},{onActivation:t})=>!(!e.isPrimary||0!==e.button||(null==t||t({event:e}),0))}];const oe={move:{name:"mousemove"},end:{name:"mouseup"}};var ie;!function(e){e[e.RightClick=2]="RightClick"}(ie||(ie={}));class ae extends te{constructor(e){super(e,oe,o.getOwnerDocument(e.event.target))}}ae.activators=[{eventName:"onMouseDown",handler:({nativeEvent:e},{onActivation:t})=>e.button!==ie.RightClick&&(null==t||t({event:e}),!0)}];const se={move:{name:"touchmove"},end:{name:"touchend"}};class le extends te{constructor(e){super(e,se)}static setup(){return window.addEventListener(se.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(se.move.name,e)};function e(){}}}var ce,de;le.activators=[{eventName:"onTouchStart",handler:({nativeEvent:e},{onActivation:t})=>{const{touches:n}=e;return!(n.length>1||(null==t||t({event:e}),0))}}],(ce=exports.AutoScrollActivator||(exports.AutoScrollActivator={}))[ce.Pointer=0]="Pointer",ce[ce.DraggableRect=1]="DraggableRect",(de=exports.TraversalOrder||(exports.TraversalOrder={}))[de.TreeOrder=0]="TreeOrder",de[de.ReversedTreeOrder=1]="ReversedTreeOrder";const ue={x:{[K.Backward]:!1,[K.Forward]:!1},y:{[K.Backward]:!1,[K.Forward]:!1}};var ge;(ge=exports.MeasuringStrategy||(exports.MeasuringStrategy={}))[ge.Always=0]="Always",ge[ge.BeforeDragging=1]="BeforeDragging",ge[ge.WhileDragging=2]="WhileDragging",(exports.MeasuringFrequency||(exports.MeasuringFrequency={})).Optimized="optimized";const pe=new Map;function fe(e){return o.useLazyMemo(t=>e?t||e:null,[e])}function he({callback:e,disabled:n}){const r=o.useEvent(e),i=t.useMemo(()=>{if(n||"undefined"==typeof window||void 0===window.ResizeObserver)return;const{ResizeObserver:e}=window;return new e(r)},[n]);return t.useEffect(()=>()=>null==i?void 0:i.disconnect(),[i]),i}function ve(e,n=S,r){const[i,a]=t.useReducer((function(t){if(!e)return null;var o;if(!1===e.isConnected)return null!=(o=null!=t?t:r)?o:null;const i=n(e);return JSON.stringify(t)===JSON.stringify(i)?t:i}),null),s=function({callback:e,disabled:n}){const r=o.useEvent(e),i=t.useMemo(()=>{if(n||"undefined"==typeof window||void 0===window.MutationObserver)return;const{MutationObserver:e}=window;return new e(r)},[r,n]);return t.useEffect(()=>()=>null==i?void 0:i.disconnect(),[i]),i}({callback(t){if(e)for(const n of t){const{type:t,target:r}=n;if("childList"===t&&r instanceof HTMLElement&&r.contains(e)){a();break}}}}),l=he({callback:a});return o.useIsomorphicLayoutEffect(()=>{a(),e?(null==l||l.observe(e),null==s||s.observe(document.body,{childList:!0,subtree:!0})):(null==l||l.disconnect(),null==s||s.disconnect())},[e]),i}const be=[];function me(e,n=[]){const r=t.useRef(null);return t.useEffect(()=>{r.current=null},n),t.useEffect(()=>{const t=e!==d;t&&!r.current&&(r.current=e),!t&&r.current&&(r.current=null)},[e]),r.current?o.subtract(e,r.current):d}function ye(e){return t.useMemo(()=>e?function(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}(e):null,[e])}const xe=[];function we(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return o.isHTMLElement(t)?t:e}const Ce=[{sensor:re,options:{}},{sensor:Q,options:{}}],De={current:{}},Ee={draggable:{measure:M},droppable:{measure:M,strategy:exports.MeasuringStrategy.WhileDragging,frequency:exports.MeasuringFrequency.Optimized},dragOverlay:{measure:S}};class Re 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 Se={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:{},droppableRects:new Map,droppableContainers:new Re,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:c},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:Ee,measureDroppableContainers:c,windowRect:null,measuringScheduled:!1},Me={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:c,draggableNodes:{},over:null,measureDroppableContainers:c},Oe=t.createContext(Me),Ne=t.createContext(Se);function Le(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:{},translate:{x:0,y:0}},droppable:{containers:new Re}}}function ke(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 Re(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 Re(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 Re(e.droppable.containers);return i.delete(n),{...e,droppable:{...e.droppable,containers:i}}}default:return e}}const Ae=t.createContext({type:null,event:null});function Te({onDragStart:e,onDragMove:n,onDragOver:r,onDragEnd:o,onDragCancel:i}){const a=t.useContext(Ae),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 Ke({announcements:e=s,hiddenTextDescribedById:a,screenReaderInstructions:l}){const{announce:c,announcement:d}=i.useAnnouncement(),u=o.useUniqueId("DndLiveRegion"),[g,p]=t.useState(!1);return t.useEffect(()=>{p(!0)},[]),Te(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])),g?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}function Ie(e,{transform:t,...n}){return(null==e?void 0:e.length)?e.reduce((e,t)=>t({transform:e,...n}),t):t}const Be=t.createContext({...d,scaleX:1,scaleY:1});var ze;!function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"}(ze||(ze={}));const Pe=t.memo((function({id:e,autoScroll:i=!0,announcements:s,children:c,sensors:u=Ce,collisionDetection:g=y,measuring:p,modifiers:f,screenReaderInstructions:h=a,...b}){var m,x,C,E;const R=t.useReducer(ke,void 0,Le),[M,k]=R,[A,B]=t.useState(()=>({type:null,event:null})),[z,W]=t.useState(ze.Uninitialized),U=z===ze.Initialized,{draggable:{active:j,nodes:H,translate:X},droppable:{containers:Y}}=M,$=j?H[j]:null,V=t.useRef({initial:null,translated:null}),J=t.useMemo(()=>{var e;return null!=j?{id:j,data:null!=(e=null==$?void 0:$.data)?e:De,rect:V}:null},[j,$]),_=t.useRef(null),[G,Q]=t.useState(null),[Z,ee]=t.useState(null),te=o.useLatestValue(b,Object.values(b)),ne=o.useUniqueId("DndDescribedBy",e),re=t.useMemo(()=>Y.getEnabled(),[Y]),oe=t.useMemo(()=>({draggable:{...Ee.draggable,...null==ie?void 0:ie.draggable},droppable:{...Ee.droppable,...null==ie?void 0:ie.droppable},dragOverlay:{...Ee.dragOverlay,...null==ie?void 0:ie.dragOverlay}}),[null==(ie=p)?void 0:ie.draggable,null==ie?void 0:ie.droppable,null==ie?void 0:ie.dragOverlay]);var ie;const{droppableRects:ae,measureDroppableContainers:se,measuringScheduled:le}=function(e,{dragging:n,dependencies:r,config:i}){const[a,s]=t.useState(null),l=null!=a,{frequency:c,measure:d,strategy:u}=i,g=t.useRef(e),p=function(){switch(u){case exports.MeasuringStrategy.Always:return!1;case exports.MeasuringStrategy.BeforeDragging:return n;default:return!n}}(),f=o.useLatestValue(p),h=t.useCallback((e=[])=>{f.current||s(t=>t?t.concat(e):e)},[f]),v=t.useRef(null),b=o.useLazyMemo(t=>{if(p&&!n)return pe;const r=a;if(!t||t===pe||g.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 q(d(e),e):null;n.rect.current=o,o&&t.set(n.id,o)}return t}return t},[e,a,n,p,d]);return t.useEffect(()=>{g.current=e},[e]),t.useEffect(()=>{p||requestAnimationFrame(()=>h())},[n,p]),t.useEffect(()=>{l&&s(null)},[l]),t.useEffect(()=>{p||"number"!=typeof c||null!==v.current||(v.current=setTimeout(()=>{h(),v.current=null},c))},[c,p,h,...r]),{droppableRects:b,measureDroppableContainers:h,measuringScheduled:l}}(re,{dragging:U,dependencies:[X.x,X.y],config:oe.droppable}),ce=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])}(H,j),de=t.useMemo(()=>Z?o.getEventCoordinates(Z):null,[Z]),ge=function(){const e=U&&!(!1===(null==G?void 0:G.autoScrollEnabled))&&!("object"==typeof i?!1===i.enabled:!1===i);return"object"==typeof i?{...i,enabled:e}:{enabled:e}}(),Re=null==de||!1===ge.layoutShiftCompensation,Se=t.useMemo(()=>ce?oe.draggable.measure(ce):null,[ce,oe.draggable.measure]);!function({element:e,measure:n,initialRect:r,disabled:i}){const a=t.useRef(!1);o.useIsomorphicLayoutEffect(()=>{if(i)return void(a.current=!1);if(!r||!e||a.current)return;const t=w(n(e),r);if(a.current=!0,t.x>0||t.y>0){const n=N(e);n&&n.scrollBy({top:t.y,left:t.x})}},[i,r,n,e])}({disabled:Re,element:ce,initialRect:Se,measure:oe.draggable.measure});const Me=ve(ce,oe.draggable.measure,Se),Te=ve(ce?ce.parentElement:null),Pe=t.useRef({active:null,activeNode:ce,collisionRect:null,collisions:null,droppableRects:ae,draggableNodes:H,draggingNode:null,draggingNodeRect:null,droppableContainers:Y,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),We=Y.getNodeFor(null==(m=Pe.current.over)?void 0:m.id),Fe=function({measure:e}){const[n,r]=t.useState(null),i=he({callback: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.useCallback(t=>{const n=we(t);null==i||i.disconnect(),n&&(null==i||i.observe(n)),r(n?e(n):null)},[e,i]),[s,l]=o.useNodeRef(a);return t.useMemo(()=>({nodeRef:s,rect:n,setRef:l}),[n,s,l])}({measure:oe.dragOverlay.measure}),Ue=null!=(x=Fe.nodeRef.current)?x:ce,je=U?null!=(C=Fe.rect)?C:Me:null,qe=Boolean(Fe.nodeRef.current&&Fe.rect),He=w(Xe=qe?null:Me,fe(Xe));var Xe;const Ye=ye(Ue?o.getWindow(Ue):null),$e=function(e){const n=t.useRef(e),r=o.useLazyMemo(t=>e?t&&e&&n.current&&e.parentNode===n.current.parentNode?t:O(e):be,[e]);return t.useEffect(()=>{n.current=e},[e]),r}(U?null!=We?We:Ue:null),Ve=function(e,n=S){const[r]=e,i=ye(r?o.getWindow(r):null),[a,s]=t.useReducer((function(){return e.length?e.map(e=>I(e)?i:new q(n(e),e)):xe}),xe),l=he({callback:s});return e.length>0&&a===xe&&s(),o.useIsomorphicLayoutEffect(()=>{e.length?e.forEach(e=>null==l?void 0:l.observe(e)):(null==l||l.disconnect(),s())},[e]),a}($e),Je=Ie(f,{transform:{x:X.x-He.x,y:X.y-He.y,scaleX:1,scaleY:1},activatorEvent:Z,active:J,activeNodeRect:Me,containerNodeRect:Te,draggingNodeRect:je,over:Pe.current.over,overlayNodeRect:Fe.rect,scrollableAncestors:$e,scrollableAncestorRects:Ve,windowRect:Ye}),_e=de?o.add(de,X):null,Ge=function(e){const[n,r]=t.useState(null),i=t.useRef(e),a=t.useCallback(e=>{const t=L(e.target);t&&r(e=>e?(e.set(t,T(t)),new Map(e)):null)},[]);return t.useEffect(()=>{const t=i.current;if(e!==t){n(t);const o=e.map(e=>{const t=L(e);return t?(t.addEventListener("scroll",a,{passive:!0}),[t,T(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=L(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),d):F(e):d,[e,n])}($e),Qe=me(Ge),Ze=me(Ge,[Me]),et=o.add(Je,Qe),tt=je?D(je,Je):null,nt=J&&tt?g({active:J,collisionRect:tt,droppableRects:ae,droppableContainers:re,pointerCoordinates:_e}):null,rt=v(nt,"id"),[ot,it]=t.useState(null),at=function(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}(qe?Je:o.add(Je,Ze),null!=(E=null==ot?void 0:ot.rect)?E:null,Me),st=t.useCallback((e,{sensor:t,options:n})=>{if(!_.current)return;const o=H[_.current];if(!o)return;const i=new t({active:_.current,activeNode:o,event:e.nativeEvent,options:n,context:Pe,onStart(e){const t=_.current;if(!t)return;const n=H[t];if(!n)return;const{onDragStart:o}=te.current,i={active:{id:t,data:n.data,rect:V}};r.unstable_batchedUpdates(()=>{null==o||o(i),W(ze.Initializing),k({type:l.DragStart,initialCoordinates:e,active:t}),B({type:l.DragStart,event:i})})},onMove(e){k({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}=Pe.current;let a=null;if(t&&i){const{cancelDrop:r}=te.current;a={active:t,collisions:n,delta:i,over:o},e===l.DragEnd&&"function"==typeof r&&await Promise.resolve(r(a))&&(e=l.DragCancel)}_.current=null,r.unstable_batchedUpdates(()=>{if(k({type:e}),W(ze.Uninitialized),it(null),Q(null),ee(null),a&&B({type:e,event:a}),a){const{onDragCancel:t,onDragEnd:n}=te.current,r=e===l.DragEnd?n:t;null==r||r(a)}})}}r.unstable_batchedUpdates(()=>{Q(i),ee(e.nativeEvent)})},[H]),lt=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])}(u,t.useCallback((e,t)=>(n,r)=>{const o=n.nativeEvent;null!==_.current||o.dndKit||o.defaultPrevented||!0===e(n,t.options)&&(o.dndKit={capturedBy:t.sensor},_.current=r,st(n,t))},[st]));!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))}(u),o.useIsomorphicLayoutEffect(()=>{Me&&z===ze.Initializing&&W(ze.Initialized)},[Me,z]),t.useEffect(()=>{const{onDragMove:e}=te.current,{active:t,collisions:n,over:r}=Pe.current;if(!t)return;const o={active:t,collisions:n,delta:{x:et.x,y:et.y},over:r};B({type:l.DragMove,event:o}),null==e||e(o)},[et.x,et.y]),t.useEffect(()=>{const{active:e,collisions:t,droppableContainers:n,scrollAdjustedTranslate:o}=Pe.current;if(!e||!_.current||!o)return;const{onDragOver:i}=te.current,a=n.get(rt),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(()=>{it(s),B({type:l.DragOver,event:c}),null==i||i(c)})},[rt]),o.useIsomorphicLayoutEffect(()=>{Pe.current={active:J,activeNode:ce,collisionRect:tt,collisions:nt,droppableRects:ae,draggableNodes:H,draggingNode:Ue,draggingNodeRect:je,droppableContainers:Y,over:ot,scrollableAncestors:$e,scrollAdjustedTranslate:et},V.current={initial:je,translated:tt}},[J,ce,nt,tt,H,Ue,je,ae,Y,ot,$e,et]),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,delta:g,threshold:p}){const f=function({delta:e,disabled:t}){const n=o.usePrevious(e);return o.useLazyMemo(r=>{if(t||!n||!r)return ue;const o=Math.sign(e.x-n.x),i=Math.sign(e.y-n.y);return{x:{[K.Backward]:r.x[K.Backward]||-1===o,[K.Forward]:r.x[K.Forward]||1===o},y:{[K.Backward]:r.y[K.Backward]||-1===i,[K.Forward]:r.y[K.Forward]||1===i}}},[t,e,n])}({delta:g,disabled:!a}),[h,v]=o.useInterval(),b=t.useRef({x:0,y:0}),m=t.useRef({x:0,y:0}),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 i}},[n,i,c]),x=t.useRef(null),w=t.useCallback(()=>{const e=x.current;e&&e.scrollBy(b.current.x*m.current.x,b.current.y*m.current.y)},[]),C=t.useMemo(()=>l===exports.TraversalOrder.TreeOrder?[...d].reverse():d,[l,d]);t.useEffect(()=>{if(a&&d.length&&y){for(const t of C){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}=P(t,o,y,e,p);if(a.x>0&&f.x[i.x]||a.y>0&&f.y[i.y])return v(),x.current=t,h(w,s),b.current=a,void(m.current=i)}b.current={x:0,y:0},m.current={x:0,y:0},v()}else v()},[e,w,r,v,a,s,JSON.stringify(y),JSON.stringify(f),h,d,C,u,JSON.stringify(p)])}({...ge,delta:X,draggingRect:tt,pointerCoordinates:_e,scrollableAncestors:$e,scrollableAncestorRects:Ve});const ct=t.useMemo(()=>({active:J,activeNode:ce,activeNodeRect:Me,activatorEvent:Z,collisions:nt,containerNodeRect:Te,dragOverlay:Fe,draggableNodes:H,droppableContainers:Y,droppableRects:ae,over:ot,measureDroppableContainers:se,scrollableAncestors:$e,scrollableAncestorRects:Ve,measuringConfiguration:oe,measuringScheduled:le,windowRect:Ye}),[J,ce,Me,Z,nt,Te,Fe,H,Y,ae,ot,se,$e,Ve,oe,le,Ye]),dt=t.useMemo(()=>({activatorEvent:Z,activators:lt,active:J,activeNodeRect:Me,ariaDescribedById:{draggable:ne},dispatch:k,draggableNodes:H,over:ot,measureDroppableContainers:se}),[Z,lt,J,Me,k,ne,H,ot,se]);return n.createElement(Ae.Provider,{value:A},n.createElement(Oe.Provider,{value:dt},n.createElement(Ne.Provider,{value:ct},n.createElement(Be.Provider,{value:at},c))),n.createElement(Ke,{announcements:s,hiddenTextDescribedById:ne,screenReaderInstructions:h}))})),We=t.createContext(null),Fe="button";function Ue(){return t.useContext(Ne)}const je={timeout:25};function qe({animation:e,children:r}){const[i,a]=t.useState(null),[s,l]=t.useState(null),c=o.usePrevious(r);return r||i||!c||a(c),o.useIsomorphicLayoutEffect(()=>{if(!s)return;const t=null==i?void 0:i.key;if("string"!=typeof t)return void a(null);const[n]=t.split("-",1),r=t.substring(n.length+1);Promise.resolve(e(r,s)).then(()=>{a(null)})},[e,i,s]),n.createElement(n.Fragment,null,r,i?t.cloneElement(i,{ref:l}):null)}const He={x:0,y:0,scaleX:1,scaleY:1};function Xe({children:e}){return n.createElement(Oe.Provider,{value:Me},n.createElement(Be.Provider,{value:He},e))}const Ye={position:"fixed",touchAction:"none"},$e=e=>o.isKeyboardEvent(e)?"transform 250ms ease":void 0,Ve=t.forwardRef(({as:e,activatorEvent:t,adjustScale:r,children:i,className:a,rect:s,style:l,transform:c,transition:d=$e},u)=>{if(!s)return null;const p=r?c:{...c,scaleX:1,scaleY:1},f={...Ye,width:s.width,height:s.height,top:s.top,left:s.left,transform:o.CSS.Transform.toString(p),transformOrigin:r&&t?g(t,s):void 0,transition:"function"==typeof d?d(t):d,...l};return n.createElement(e,{className:a,style:f,ref:u},i)}),Je=e=>({active:t,dragOverlay:n})=>{const r={},{styles:o,className:i}=e;if(null==o?void 0:o.active)for(const[e,n]of Object.entries(o.active))void 0!==n&&(r[e]=t.node.style.getPropertyValue(e),t.node.style.setProperty(e,n));if(null==o?void 0:o.dragOverlay)for(const[e,t]of Object.entries(o.dragOverlay))void 0!==t&&n.node.style.setProperty(e,t);return(null==i?void 0:i.active)&&t.node.classList.add(i.active),(null==i?void 0:i.dragOverlay)&&n.node.classList.add(i.dragOverlay),function(){for(const[e,n]of Object.entries(r))t.node.style.setProperty(e,n);(null==i?void 0:i.active)&&t.node.classList.remove(i.active)}},_e={duration:250,easing:"ease",keyframes:({transform:{initial:e,final:t}})=>[{transform:o.CSS.Transform.toString(e)},{transform:o.CSS.Transform.toString(t)}],sideEffects:Je({styles:{active:{opacity:"0"}}})};let Ge=0;function Qe(e){return t.useMemo(()=>{if(null!=e)return Ge++,Ge},[e])}const Ze=n.memo(({adjustScale:e=!1,children:r,dropAnimation:i,style:a,transition:s,modifiers:l,wrapperElement:c="div",className:d,zIndex:u=999})=>{const{activatorEvent:g,active:p,activeNodeRect:f,containerNodeRect:h,draggableNodes:v,droppableContainers:b,dragOverlay:m,over:y,measuringConfiguration:x,scrollableAncestors:w,scrollableAncestorRects:C,windowRect:D}=Ue(),R=t.useContext(Be),S=Qe(null==p?void 0:p.id),M=Ie(l,{activatorEvent:g,active:p,activeNodeRect:f,containerNodeRect:h,draggingNodeRect:m.rect,over:y,overlayNodeRect:m.rect,scrollableAncestors:w,scrollableAncestorRects:C,transform:R,windowRect:D}),O=fe(f),N=function({config:e,draggableNodes:t,droppableContainers:n,measuringConfiguration:r}){return o.useEvent((i,a)=>{if(null===e)return;const s=t[i];if(!s)return;const l=s.node.current;if(!l)return;const c=we(a);if(!c)return;const{transform:d}=o.getWindow(a).getComputedStyle(a),u=E(d);if(!u)return;const g="function"==typeof e?e:function(e){const{duration:t,easing:n,sideEffects:r,keyframes:o}={..._e,...e};return({active:e,dragOverlay:i,transform:a,...s})=>{if(!t)return;const l={x:a.x-(i.rect.left-e.rect.left),y:a.y-(i.rect.top-e.rect.top),scaleX:1!==a.scaleX?e.rect.width*a.scaleX/i.rect.width:1,scaleY:1!==a.scaleY?e.rect.height*a.scaleY/i.rect.height:1},c=o({...s,active:e,dragOverlay:i,transform:{initial:a,final:l}}),[d]=c,u=c[c.length-1];if(JSON.stringify(d)===JSON.stringify(u))return;const g=null==r?void 0:r({active:e,dragOverlay:i,...s}),p=i.node.animate(c,{easing:n,duration:t});return new Promise(e=>{p.onfinish=()=>{null==g||g(),e()}})}}(e);return U(l,r.draggable.measure),g({active:{id:i,data:s.data,node:l,rect:r.draggable.measure(l)},draggableNodes:t,dragOverlay:{node:a,rect:r.dragOverlay.measure(c)},droppableContainers:n,measuringConfiguration:r,transform:u})})}({config:i,draggableNodes:v,droppableContainers:b,measuringConfiguration:x});return n.createElement(Xe,null,n.createElement(qe,{animation:N},p&&S?n.createElement(Ve,{key:`${S}-${p.id}`,ref:O?m.setRef:void 0,as:c,activatorEvent:g,adjustScale:e,className:d,transition:s,rect:O,style:{zIndex:u,...a},transform:M},r):null))});exports.DndContext=Pe,exports.DragOverlay=Ze,exports.KeyboardSensor=Q,exports.MouseSensor=ae,exports.PointerSensor=re,exports.TouchSensor=le,exports.applyModifiers=Ie,exports.closestCenter=({collisionRect:e,droppableRects:t,droppableContainers:n})=>{const r=b(e,e.left,e.top),o=[];for(const e of n){const{id:n}=e,i=t.get(n);if(i){const t=u(b(i),r);o.push({id:n,data:{droppableContainer:e,value:t}})}}return o.sort(p)},exports.closestCorners=({collisionRect:e,droppableRects:t,droppableContainers:n})=>{const r=h(e),o=[];for(const e of n){const{id:n}=e,i=t.get(n);if(i){const t=h(i),a=r.reduce((e,n,r)=>e+u(t[r],n),0),s=Number((a/4).toFixed(4));o.push({id:n,data:{droppableContainer:e,value:s}})}}return o.sort(p)},exports.defaultAnnouncements=s,exports.defaultCoordinates=d,exports.defaultDropAnimation=_e,exports.defaultDropAnimationSideEffects=Je,exports.getClientRect=S,exports.getFirstCollision=v,exports.getScrollableAncestors=O,exports.pointerWithin=({droppableContainers:e,droppableRects:t,pointerCoordinates:n})=>{if(!n)return[];const r=[];for(const o of e){const{id:e}=o,i=t.get(e);if(i&&x(n,i)){const t=h(i).reduce((e,t)=>e+u(n,t),0),a=Number((t/4).toFixed(4));r.push({id:e,data:{droppableContainer:o,value:a}})}}return r.sort(p)},exports.rectIntersection=y,exports.useDndContext=Ue,exports.useDndMonitor=Te,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:g,over:p}=t.useContext(Oe),{role:f=Fe,roleDescription:h="draggable",tabIndex:v=0}=null!=i?i:{},b=(null==c?void 0:c.id)===e,m=t.useContext(b?Be:We),[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])}(s,e),C=o.useLatestValue(n);return o.useIsomorphicLayoutEffect(()=>(g[e]={id:e,key:a,node:y,data:C},()=>{const t=g[e];t&&t.key===a&&delete g[e]}),[g,e]),{active:c,activatorEvent:l,activeNodeRect:d,attributes:t.useMemo(()=>({role:f,tabIndex:v,"aria-pressed":!(!b||f!==Fe)||void 0,"aria-roledescription":h,"aria-describedby":u.draggable}),[f,v,b,h,u.draggable]),isDragging:b,listeners:r?void 0:w,node:y,over:p,setNodeRef:x,transform:m}},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(Oe),g=t.useRef({disabled:n}),p=t.useRef(!1),f=t.useRef(null),h=t.useRef(null),{disabled:v,updateMeasurementsFor:b,timeout:m}={...je,...i},y=o.useLatestValue(null!=b?b:r),x=he({callback:t.useCallback(()=>{p.current?(null!=h.current&&clearTimeout(h.current),h.current=setTimeout(()=>{u("string"==typeof y.current?[y.current]:y.current),h.current=null},m)):p.current=!0},[m]),disabled:v||!s}),w=t.useCallback((e,t)=>{x&&(t&&(x.unobserve(t),p.current=!1),e&&x.observe(e))},[x]),[C,D]=o.useNodeRef(w),E=o.useLatestValue(e);return t.useEffect(()=>{x&&C.current&&(x.disconnect(),p.current=!1,x.observe(C.current))},[C,x]),o.useIsomorphicLayoutEffect(()=>(c({type:l.RegisterDroppable,element:{id:r,key:a,disabled:n,node:C,rect:f,data:E}}),()=>c({type:l.UnregisterDroppable,key:a,id:r})),[r]),t.useEffect(()=>{n!==g.current.disabled&&(c({type:l.SetDroppableDisabled,id:r,key:a,disabled:n}),g.current.disabled=n)},[r,a,n,c]),{active:s,rect:f,isOver:(null==d?void 0:d.id)===r,node:C,over:d,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 |
@@ -9,2 +9,3 @@ export { AutoScrollActivator, TraversalOrder, useAutoScroller, } from './useAutoScroller'; | ||
export { useRect } from './useRect'; | ||
export { useRectDelta } from './useRectDelta'; | ||
export { useResizeObserver } from './useResizeObserver'; | ||
@@ -11,0 +12,0 @@ export { useScrollableAncestors } from './useScrollableAncestors'; |
import type { ClientRect } from '../../types'; | ||
export declare function useRect(element: HTMLElement | null, measure?: (element: HTMLElement) => ClientRect): ClientRect | null; | ||
export declare function useRect(element: HTMLElement | null, measure?: (element: HTMLElement) => ClientRect, fallbackRect?: ClientRect | null): ClientRect | null; |
{ | ||
"name": "@dnd-kit/core", | ||
"version": "6.0.0-next-20224171791", | ||
"version": "6.0.0-next-2022417214515", | ||
"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.2.0-next-20224171791" | ||
"@dnd-kit/utilities": "^3.2.0-next-2022417214515" | ||
}, | ||
@@ -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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1005112
133
7703