UNPKG

@lanaco/lnc-react-ui

Version:

React component library

5 lines 86 kB
"use strict";const oe=require("react/jsx-runtime"),d=require("react"),Vt=require("./index-EeoArxOx.cjs"),Q=require("./index-BPVoEhTF.cjs"),we=require("./utils-NZLCh-J5.cjs"),Zr=require("./index-gY9e_8LL.cjs"),en=require("./emotion-styled.browser.esm-Cle7tAM9.cjs"),zr=require("./emotion-element-f0de968e.browser.esm-B7k6i6lC.cjs"),bo=require("./KanbanCard-CLOKZFYP.cjs"),Dt=require("./_commonjsHelpers-DKOUU3wS.cjs"),ii=require("./KanbanHeader.cjs"),si=require("./useEffectOnce-DFrzfNzT.cjs"),ai=require("./useUpdateEffect-BtMgpgIV.cjs");function ci(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return d.useMemo(()=>o=>{t.forEach(s=>s(o))},t)}const Un=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function tn(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function Hr(e){return"nodeType"in e}function Ke(e){var t,n;return e?tn(e)?e:Hr(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function Kr(e){const{Document:t}=Ke(e);return e instanceof t}function hn(e){return tn(e)?!1:e instanceof Ke(e).HTMLElement}function yo(e){return e instanceof Ke(e).SVGElement}function nn(e){return e?tn(e)?e.document:Hr(e)?Kr(e)?e:hn(e)||yo(e)?e.ownerDocument:document:document:document}const bt=Un?d.useLayoutEffect:d.useEffect;function kn(e){const t=d.useRef(e);return bt(()=>{t.current=e}),d.useCallback(function(){for(var n=arguments.length,o=new Array(n),s=0;s<n;s++)o[s]=arguments[s];return t.current==null?void 0:t.current(...o)},[])}function li(){const e=d.useRef(null),t=d.useCallback((o,s)=>{e.current=setInterval(o,s)},[]),n=d.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,n]}function gn(e,t){t===void 0&&(t=[e]);const n=d.useRef(e);return bt(()=>{n.current!==e&&(n.current=e)},t),n}function pn(e,t){const n=d.useRef();return d.useMemo(()=>{const o=e(n.current);return n.current=o,o},[...t])}function jn(e){const t=kn(e),n=d.useRef(null),o=d.useCallback(s=>{s!==n.current&&(t==null||t(s,n.current)),n.current=s},[]);return[n,o]}function $n(e){const t=d.useRef();return d.useEffect(()=>{t.current=e},[e]),t.current}let Tr={};function vn(e,t){return d.useMemo(()=>{if(t)return t;const n=Tr[e]==null?0:Tr[e]+1;return Tr[e]=n,e+"-"+n},[e,t])}function mo(e){return function(t){for(var n=arguments.length,o=new Array(n>1?n-1:0),s=1;s<n;s++)o[s-1]=arguments[s];return o.reduce((c,l)=>{const u=Object.entries(l);for(const[h,f]of u){const b=c[h];b!=null&&(c[h]=b+e*f)}return c},{...t})}}const Zt=mo(1),Bn=mo(-1);function ui(e){return"clientX"in e&&"clientY"in e}function Xn(e){if(!e)return!1;const{KeyboardEvent:t}=Ke(e.target);return t&&e instanceof t}function di(e){if(!e)return!1;const{TouchEvent:t}=Ke(e.target);return t&&e instanceof t}function Fn(e){if(di(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return ui(e)?{x:e.clientX,y:e.clientY}:null}const Gt=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:n}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:n}=e;return"scaleX("+t+") scaleY("+n+")"}},Transform:{toString(e){if(e)return[Gt.Translate.toString(e),Gt.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:o}=e;return t+" "+n+"ms "+o}}}),Qr="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function fi(e){return e.matches(Qr)?e:e.querySelector(Qr)}const gi={display:"none"};function hi(e){let{id:t,value:n}=e;return d.createElement("div",{id:t,style:gi},n)}function pi(e){let{id:t,announcement:n,ariaLiveType:o="assertive"}=e;const s={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return d.createElement("div",{id:t,style:s,role:"status","aria-live":o,"aria-atomic":!0},n)}function vi(){const[e,t]=d.useState("");return{announce:d.useCallback(o=>{o!=null&&t(o)},[]),announcement:e}}const xo=d.createContext(null);function bi(e){const t=d.useContext(xo);d.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function yi(){const[e]=d.useState(()=>new Set),t=d.useCallback(o=>(e.add(o),()=>e.delete(o)),[e]);return[d.useCallback(o=>{let{type:s,event:c}=o;e.forEach(l=>{var u;return(u=l[s])==null?void 0:u.call(l,c)})},[e]),t]}const mi={draggable:` To pick up a draggable item, press the space bar. While dragging, use the arrow keys to move the item. Press space again to drop the item in its new position, or press escape to cancel. `},xi={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was moved over droppable area "+n.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was dropped over droppable area "+n.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function wi(e){let{announcements:t=xi,container:n,hiddenTextDescribedById:o,screenReaderInstructions:s=mi}=e;const{announce:c,announcement:l}=vi(),u=vn("DndLiveRegion"),[h,f]=d.useState(!1);if(d.useEffect(()=>{f(!0)},[]),bi(d.useMemo(()=>({onDragStart(v){let{active:_}=v;c(t.onDragStart({active:_}))},onDragMove(v){let{active:_,over:w}=v;t.onDragMove&&c(t.onDragMove({active:_,over:w}))},onDragOver(v){let{active:_,over:w}=v;c(t.onDragOver({active:_,over:w}))},onDragEnd(v){let{active:_,over:w}=v;c(t.onDragEnd({active:_,over:w}))},onDragCancel(v){let{active:_,over:w}=v;c(t.onDragCancel({active:_,over:w}))}}),[c,t])),!h)return null;const b=d.createElement(d.Fragment,null,d.createElement(hi,{id:o,value:s.draggable}),d.createElement(pi,{id:u,announcement:l}));return n?Vt.reactDomExports.createPortal(b,n):b}var ye;(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"})(ye||(ye={}));function zn(){}function Or(e,t){return d.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function Ci(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return d.useMemo(()=>[...t].filter(o=>o!=null),[...t])}const yt=Object.freeze({x:0,y:0});function Gr(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Si(e,t){const n=Fn(e);if(!n)return"0 0";const o={x:(n.x-t.left)/t.width*100,y:(n.y-t.top)/t.height*100};return o.x+"% "+o.y+"%"}function Ur(e,t){let{data:{value:n}}=e,{data:{value:o}}=t;return n-o}function _i(e,t){let{data:{value:n}}=e,{data:{value:o}}=t;return o-n}function Pr(e){let{left:t,top:n,height:o,width:s}=e;return[{x:t,y:n},{x:t+s,y:n},{x:t,y:n+o},{x:t+s,y:n+o}]}function kr(e,t){if(!e||e.length===0)return null;const[n]=e;return t?n[t]:n}function eo(e,t,n){return t===void 0&&(t=e.left),n===void 0&&(n=e.top),{x:t+e.width*.5,y:n+e.height*.5}}const to=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:o}=e;const s=eo(t,t.left,t.top),c=[];for(const l of o){const{id:u}=l,h=n.get(u);if(h){const f=Gr(eo(h),s);c.push({id:u,data:{droppableContainer:l,value:f}})}}return c.sort(Ur)},Di=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:o}=e;const s=Pr(t),c=[];for(const l of o){const{id:u}=l,h=n.get(u);if(h){const f=Pr(h),b=s.reduce((_,w,I)=>_+Gr(f[I],w),0),v=Number((b/4).toFixed(4));c.push({id:u,data:{droppableContainer:l,value:v}})}}return c.sort(Ur)};function Ri(e,t){const n=Math.max(t.top,e.top),o=Math.max(t.left,e.left),s=Math.min(t.left+t.width,e.left+e.width),c=Math.min(t.top+t.height,e.top+e.height),l=s-o,u=c-n;if(o<s&&n<c){const h=t.width*t.height,f=e.width*e.height,b=l*u,v=b/(h+f-b);return Number(v.toFixed(4))}return 0}const wo=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:o}=e;const s=[];for(const c of o){const{id:l}=c,u=n.get(l);if(u){const h=Ri(u,t);h>0&&s.push({id:l,data:{droppableContainer:c,value:h}})}}return s.sort(_i)};function Ei(e,t){const{top:n,left:o,bottom:s,right:c}=t;return n<=e.y&&e.y<=s&&o<=e.x&&e.x<=c}const Ai=e=>{let{droppableContainers:t,droppableRects:n,pointerCoordinates:o}=e;if(!o)return[];const s=[];for(const c of t){const{id:l}=c,u=n.get(l);if(u&&Ei(o,u)){const f=Pr(u).reduce((v,_)=>v+Gr(o,_),0),b=Number((f/4).toFixed(4));s.push({id:l,data:{droppableContainer:c,value:b}})}}return s.sort(Ur)};function Ti(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function Co(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:yt}function Oi(e){return function(n){for(var o=arguments.length,s=new Array(o>1?o-1:0),c=1;c<o;c++)s[c-1]=arguments[c];return s.reduce((l,u)=>({...l,top:l.top+e*u.y,bottom:l.bottom+e*u.y,left:l.left+e*u.x,right:l.right+e*u.x}),{...n})}}const Ii=Oi(1);function So(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]}}else 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}function Mi(e,t,n){const o=So(t);if(!o)return e;const{scaleX:s,scaleY:c,x:l,y:u}=o,h=e.left-l-(1-s)*parseFloat(n),f=e.top-u-(1-c)*parseFloat(n.slice(n.indexOf(" ")+1)),b=s?e.width/s:e.width,v=c?e.height/c:e.height;return{width:b,height:v,top:f,right:h+b,bottom:f+v,left:h}}const Ni={ignoreTransform:!1};function rn(e,t){t===void 0&&(t=Ni);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:f,transformOrigin:b}=Ke(e).getComputedStyle(e);f&&(n=Mi(n,f,b))}const{top:o,left:s,width:c,height:l,bottom:u,right:h}=n;return{top:o,left:s,width:c,height:l,bottom:u,right:h}}function no(e){return rn(e,{ignoreTransform:!0})}function Pi(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function Li(e,t){return t===void 0&&(t=Ke(e).getComputedStyle(e)),t.position==="fixed"}function ji(e,t){t===void 0&&(t=Ke(e).getComputedStyle(e));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(s=>{const c=t[s];return typeof c=="string"?n.test(c):!1})}function Xr(e,t){const n=[];function o(s){if(t!=null&&n.length>=t||!s)return n;if(Kr(s)&&s.scrollingElement!=null&&!n.includes(s.scrollingElement))return n.push(s.scrollingElement),n;if(!hn(s)||yo(s)||n.includes(s))return n;const c=Ke(e).getComputedStyle(s);return s!==e&&ji(s,c)&&n.push(s),Li(s,c)?n:o(s.parentNode)}return e?o(e):n}function _o(e){const[t]=Xr(e,1);return t??null}function Ir(e){return!Un||!e?null:tn(e)?e:Hr(e)?Kr(e)||e===nn(e).scrollingElement?window:hn(e)?e:null:null}function Do(e){return tn(e)?e.scrollX:e.scrollLeft}function Ro(e){return tn(e)?e.scrollY:e.scrollTop}function Lr(e){return{x:Do(e),y:Ro(e)}}var Ce;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(Ce||(Ce={}));function Eo(e){return!Un||!e?!1:e===document.scrollingElement}function Ao(e){const t={x:0,y:0},n=Eo(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},o={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height},s=e.scrollTop<=t.y,c=e.scrollLeft<=t.x,l=e.scrollTop>=o.y,u=e.scrollLeft>=o.x;return{isTop:s,isLeft:c,isBottom:l,isRight:u,maxScroll:o,minScroll:t}}const $i={x:.2,y:.2};function Bi(e,t,n,o,s){let{top:c,left:l,right:u,bottom:h}=n;o===void 0&&(o=10),s===void 0&&(s=$i);const{isTop:f,isBottom:b,isLeft:v,isRight:_}=Ao(e),w={x:0,y:0},I={x:0,y:0},x={height:t.height*s.y,width:t.width*s.x};return!f&&c<=t.top+x.height?(w.y=Ce.Backward,I.y=o*Math.abs((t.top+x.height-c)/x.height)):!b&&h>=t.bottom-x.height&&(w.y=Ce.Forward,I.y=o*Math.abs((t.bottom-x.height-h)/x.height)),!_&&u>=t.right-x.width?(w.x=Ce.Forward,I.x=o*Math.abs((t.right-x.width-u)/x.width)):!v&&l<=t.left+x.width&&(w.x=Ce.Backward,I.x=o*Math.abs((t.left+x.width-l)/x.width)),{direction:w,speed:I}}function Fi(e){if(e===document.scrollingElement){const{innerWidth:c,innerHeight:l}=window;return{top:0,left:0,right:c,bottom:l,width:c,height:l}}const{top:t,left:n,right:o,bottom:s}=e.getBoundingClientRect();return{top:t,left:n,right:o,bottom:s,width:e.clientWidth,height:e.clientHeight}}function To(e){return e.reduce((t,n)=>Zt(t,Lr(n)),yt)}function zi(e){return e.reduce((t,n)=>t+Do(n),0)}function Hi(e){return e.reduce((t,n)=>t+Ro(n),0)}function Oo(e,t){if(t===void 0&&(t=rn),!e)return;const{top:n,left:o,bottom:s,right:c}=t(e);_o(e)&&(s<=0||c<=0||n>=window.innerHeight||o>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const Ki=[["x",["left","right"],zi],["y",["top","bottom"],Hi]];class Yr{constructor(t,n){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 o=Xr(n),s=To(o);this.rect={...t},this.width=t.width,this.height=t.height;for(const[c,l,u]of Ki)for(const h of l)Object.defineProperty(this,h,{get:()=>{const f=u(o),b=s[c]-f;return this.rect[h]+b},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class ln{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var o;return(o=this.target)==null?void 0:o.removeEventListener(...n)})},this.target=t}add(t,n,o){var s;(s=this.target)==null||s.addEventListener(t,n,o),this.listeners.push([t,n,o])}}function Gi(e){const{EventTarget:t}=Ke(e);return e instanceof t?e:nn(e)}function Mr(e,t){const n=Math.abs(e.x),o=Math.abs(e.y);return typeof t=="number"?Math.sqrt(n**2+o**2)>t:"x"in t&&"y"in t?n>t.x&&o>t.y:"x"in t?n>t.x:"y"in t?o>t.y:!1}var ut;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(ut||(ut={}));function ro(e){e.preventDefault()}function Ui(e){e.stopPropagation()}var H;(function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter",e.Tab="Tab"})(H||(H={}));const Io={start:[H.Space,H.Enter],cancel:[H.Esc],end:[H.Space,H.Enter,H.Tab]},ki=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case H.Right:return{...n,x:n.x+25};case H.Left:return{...n,x:n.x-25};case H.Down:return{...n,y:n.y+25};case H.Up:return{...n,y:n.y-25}}};class Wr{constructor(t){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=t;const{event:{target:n}}=t;this.props=t,this.listeners=new ln(nn(n)),this.windowListeners=new ln(Ke(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(ut.Resize,this.handleCancel),this.windowListeners.add(ut.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(ut.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props,o=t.node.current;o&&Oo(o),n(yt)}handleKeyDown(t){if(Xn(t)){const{active:n,context:o,options:s}=this.props,{keyboardCodes:c=Io,coordinateGetter:l=ki,scrollBehavior:u="smooth"}=s,{code:h}=t;if(c.end.includes(h)){this.handleEnd(t);return}if(c.cancel.includes(h)){this.handleCancel(t);return}const{collisionRect:f}=o.current,b=f?{x:f.left,y:f.top}:yt;this.referenceCoordinates||(this.referenceCoordinates=b);const v=l(t,{active:n,context:o.current,currentCoordinates:b});if(v){const _=Bn(v,b),w={x:0,y:0},{scrollableAncestors:I}=o.current;for(const x of I){const D=t.code,{isTop:A,isRight:M,isLeft:T,isBottom:O,maxScroll:L,minScroll:N}=Ao(x),P=Fi(x),$={x:Math.min(D===H.Right?P.right-P.width/2:P.right,Math.max(D===H.Right?P.left:P.left+P.width/2,v.x)),y:Math.min(D===H.Down?P.bottom-P.height/2:P.bottom,Math.max(D===H.Down?P.top:P.top+P.height/2,v.y))},Y=D===H.Right&&!M||D===H.Left&&!T,W=D===H.Down&&!O||D===H.Up&&!A;if(Y&&$.x!==v.x){const K=x.scrollLeft+_.x,ie=D===H.Right&&K<=L.x||D===H.Left&&K>=N.x;if(ie&&!_.y){x.scrollTo({left:K,behavior:u});return}ie?w.x=x.scrollLeft-K:w.x=D===H.Right?x.scrollLeft-L.x:x.scrollLeft-N.x,w.x&&x.scrollBy({left:-w.x,behavior:u});break}else if(W&&$.y!==v.y){const K=x.scrollTop+_.y,ie=D===H.Down&&K<=L.y||D===H.Up&&K>=N.y;if(ie&&!_.x){x.scrollTo({top:K,behavior:u});return}ie?w.y=x.scrollTop-K:w.y=D===H.Down?x.scrollTop-L.y:x.scrollTop-N.y,w.y&&x.scrollBy({top:-w.y,behavior:u});break}}this.handleMove(t,Zt(Bn(v,this.referenceCoordinates),w))}}}handleMove(t,n){const{onMove:o}=this.props;t.preventDefault(),o(n)}handleEnd(t){const{onEnd:n}=this.props;t.preventDefault(),this.detach(),n()}handleCancel(t){const{onCancel:n}=this.props;t.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}Wr.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:o=Io,onActivation:s}=t,{active:c}=n;const{code:l}=e.nativeEvent;if(o.start.includes(l)){const u=c.activatorNode.current;return u&&e.target!==u?!1:(e.preventDefault(),s==null||s({event:e.nativeEvent}),!0)}return!1}}];function oo(e){return!!(e&&"distance"in e)}function io(e){return!!(e&&"delay"in e)}class qr{constructor(t,n,o){var s;o===void 0&&(o=Gi(t.event.target)),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=t,this.events=n;const{event:c}=t,{target:l}=c;this.props=t,this.events=n,this.document=nn(l),this.documentListeners=new ln(this.document),this.listeners=new ln(o),this.windowListeners=new ln(Ke(l)),this.initialCoordinates=(s=Fn(c))!=null?s:yt,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:t,props:{options:{activationConstraint:n,bypassActivationConstraint:o}}}=this;if(this.listeners.add(t.move.name,this.handleMove,{passive:!1}),this.listeners.add(t.end.name,this.handleEnd),t.cancel&&this.listeners.add(t.cancel.name,this.handleCancel),this.windowListeners.add(ut.Resize,this.handleCancel),this.windowListeners.add(ut.DragStart,ro),this.windowListeners.add(ut.VisibilityChange,this.handleCancel),this.windowListeners.add(ut.ContextMenu,ro),this.documentListeners.add(ut.Keydown,this.handleKeydown),n){if(o!=null&&o({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(io(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(oo(n)){this.handlePending(n);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(t,n){const{active:o,onPending:s}=this.props;s(o,t,this.initialCoordinates,n)}handleStart(){const{initialCoordinates:t}=this,{onStart:n}=this.props;t&&(this.activated=!0,this.documentListeners.add(ut.Click,Ui,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(ut.SelectionChange,this.removeTextSelection),n(t))}handleMove(t){var n;const{activated:o,initialCoordinates:s,props:c}=this,{onMove:l,options:{activationConstraint:u}}=c;if(!s)return;const h=(n=Fn(t))!=null?n:yt,f=Bn(s,h);if(!o&&u){if(oo(u)){if(u.tolerance!=null&&Mr(f,u.tolerance))return this.handleCancel();if(Mr(f,u.distance))return this.handleStart()}if(io(u)&&Mr(f,u.tolerance))return this.handleCancel();this.handlePending(u,f);return}t.cancelable&&t.preventDefault(),l(h)}handleEnd(){const{onAbort:t,onEnd:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleCancel(){const{onAbort:t,onCancel:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleKeydown(t){t.code===H.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const Xi={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class Mo extends qr{constructor(t){const{event:n}=t,o=nn(n.target);super(t,Xi,o)}}Mo.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:o}=t;return!n.isPrimary||n.button!==0?!1:(o==null||o({event:n}),!0)}}];const Yi={move:{name:"mousemove"},end:{name:"mouseup"}};var jr;(function(e){e[e.RightClick=2]="RightClick"})(jr||(jr={}));class No extends qr{constructor(t){super(t,Yi,nn(t.event.target))}}No.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:o}=t;return n.button===jr.RightClick?!1:(o==null||o({event:n}),!0)}}];const Nr={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class Po extends qr{constructor(t){super(t,Nr)}static setup(){return window.addEventListener(Nr.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(Nr.move.name,t)};function t(){}}}Po.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:o}=t;const{touches:s}=n;return s.length>1?!1:(o==null||o({event:n}),!0)}}];var un;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(un||(un={}));var Hn;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(Hn||(Hn={}));function Wi(e){let{acceleration:t,activator:n=un.Pointer,canScroll:o,draggingRect:s,enabled:c,interval:l=5,order:u=Hn.TreeOrder,pointerCoordinates:h,scrollableAncestors:f,scrollableAncestorRects:b,delta:v,threshold:_}=e;const w=Ji({delta:v,disabled:!c}),[I,x]=li(),D=d.useRef({x:0,y:0}),A=d.useRef({x:0,y:0}),M=d.useMemo(()=>{switch(n){case un.Pointer:return h?{top:h.y,bottom:h.y,left:h.x,right:h.x}:null;case un.DraggableRect:return s}},[n,s,h]),T=d.useRef(null),O=d.useCallback(()=>{const N=T.current;if(!N)return;const P=D.current.x*A.current.x,$=D.current.y*A.current.y;N.scrollBy(P,$)},[]),L=d.useMemo(()=>u===Hn.TreeOrder?[...f].reverse():f,[u,f]);d.useEffect(()=>{if(!c||!f.length||!M){x();return}for(const N of L){if((o==null?void 0:o(N))===!1)continue;const P=f.indexOf(N),$=b[P];if(!$)continue;const{direction:Y,speed:W}=Bi(N,$,M,t,_);for(const K of["x","y"])w[K][Y[K]]||(W[K]=0,Y[K]=0);if(W.x>0||W.y>0){x(),T.current=N,I(O,l),D.current=W,A.current=Y;return}}D.current={x:0,y:0},A.current={x:0,y:0},x()},[t,O,o,x,c,l,JSON.stringify(M),JSON.stringify(w),I,f,L,b,JSON.stringify(_)])}const qi={x:{[Ce.Backward]:!1,[Ce.Forward]:!1},y:{[Ce.Backward]:!1,[Ce.Forward]:!1}};function Ji(e){let{delta:t,disabled:n}=e;const o=$n(t);return pn(s=>{if(n||!o||!s)return qi;const c={x:Math.sign(t.x-o.x),y:Math.sign(t.y-o.y)};return{x:{[Ce.Backward]:s.x[Ce.Backward]||c.x===-1,[Ce.Forward]:s.x[Ce.Forward]||c.x===1},y:{[Ce.Backward]:s.y[Ce.Backward]||c.y===-1,[Ce.Forward]:s.y[Ce.Forward]||c.y===1}}},[n,t,o])}function Vi(e,t){const n=t!=null?e.get(t):void 0,o=n?n.node.current:null;return pn(s=>{var c;return t==null?null:(c=o??s)!=null?c:null},[o,t])}function Zi(e,t){return d.useMemo(()=>e.reduce((n,o)=>{const{sensor:s}=o,c=s.activators.map(l=>({eventName:l.eventName,handler:t(l.handler,o)}));return[...n,...c]},[]),[e,t])}var Qt;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(Qt||(Qt={}));var $r;(function(e){e.Optimized="optimized"})($r||($r={}));const so=new Map;function Qi(e,t){let{dragging:n,dependencies:o,config:s}=t;const[c,l]=d.useState(null),{frequency:u,measure:h,strategy:f}=s,b=d.useRef(e),v=D(),_=gn(v),w=d.useCallback(function(A){A===void 0&&(A=[]),!_.current&&l(M=>M===null?A:M.concat(A.filter(T=>!M.includes(T))))},[_]),I=d.useRef(null),x=pn(A=>{if(v&&!n)return so;if(!A||A===so||b.current!==e||c!=null){const M=new Map;for(let T of e){if(!T)continue;if(c&&c.length>0&&!c.includes(T.id)&&T.rect.current){M.set(T.id,T.rect.current);continue}const O=T.node.current,L=O?new Yr(h(O),O):null;T.rect.current=L,L&&M.set(T.id,L)}return M}return A},[e,c,n,v,h]);return d.useEffect(()=>{b.current=e},[e]),d.useEffect(()=>{v||w()},[n,v]),d.useEffect(()=>{c&&c.length>0&&l(null)},[JSON.stringify(c)]),d.useEffect(()=>{v||typeof u!="number"||I.current!==null||(I.current=setTimeout(()=>{w(),I.current=null},u))},[u,v,w,...o]),{droppableRects:x,measureDroppableContainers:w,measuringScheduled:c!=null};function D(){switch(f){case Qt.Always:return!1;case Qt.BeforeDragging:return n;default:return!n}}}function Jr(e,t){return pn(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function es(e,t){return Jr(e,t)}function ts(e){let{callback:t,disabled:n}=e;const o=kn(t),s=d.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:c}=window;return new c(o)},[o,n]);return d.useEffect(()=>()=>s==null?void 0:s.disconnect(),[s]),s}function Yn(e){let{callback:t,disabled:n}=e;const o=kn(t),s=d.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:c}=window;return new c(o)},[n]);return d.useEffect(()=>()=>s==null?void 0:s.disconnect(),[s]),s}function ns(e){return new Yr(rn(e),e)}function ao(e,t,n){t===void 0&&(t=ns);const[o,s]=d.useState(null);function c(){s(h=>{if(!e)return null;if(e.isConnected===!1){var f;return(f=h??n)!=null?f:null}const b=t(e);return JSON.stringify(h)===JSON.stringify(b)?h:b})}const l=ts({callback(h){if(e)for(const f of h){const{type:b,target:v}=f;if(b==="childList"&&v instanceof HTMLElement&&v.contains(e)){c();break}}}}),u=Yn({callback:c});return bt(()=>{c(),e?(u==null||u.observe(e),l==null||l.observe(document.body,{childList:!0,subtree:!0})):(u==null||u.disconnect(),l==null||l.disconnect())},[e]),o}function rs(e){const t=Jr(e);return Co(e,t)}const co=[];function os(e){const t=d.useRef(e),n=pn(o=>e?o&&o!==co&&e&&t.current&&e.parentNode===t.current.parentNode?o:Xr(e):co,[e]);return d.useEffect(()=>{t.current=e},[e]),n}function is(e){const[t,n]=d.useState(null),o=d.useRef(e),s=d.useCallback(c=>{const l=Ir(c.target);l&&n(u=>u?(u.set(l,Lr(l)),new Map(u)):null)},[]);return d.useEffect(()=>{const c=o.current;if(e!==c){l(c);const u=e.map(h=>{const f=Ir(h);return f?(f.addEventListener("scroll",s,{passive:!0}),[f,Lr(f)]):null}).filter(h=>h!=null);n(u.length?new Map(u):null),o.current=e}return()=>{l(e),l(c)};function l(u){u.forEach(h=>{const f=Ir(h);f==null||f.removeEventListener("scroll",s)})}},[s,e]),d.useMemo(()=>e.length?t?Array.from(t.values()).reduce((c,l)=>Zt(c,l),yt):To(e):yt,[e,t])}function lo(e,t){t===void 0&&(t=[]);const n=d.useRef(null);return d.useEffect(()=>{n.current=null},t),d.useEffect(()=>{const o=e!==yt;o&&!n.current&&(n.current=e),!o&&n.current&&(n.current=null)},[e]),n.current?Bn(e,n.current):yt}function ss(e){d.useEffect(()=>{if(!Un)return;const t=e.map(n=>{let{sensor:o}=n;return o.setup==null?void 0:o.setup()});return()=>{for(const n of t)n==null||n()}},e.map(t=>{let{sensor:n}=t;return n}))}function as(e,t){return d.useMemo(()=>e.reduce((n,o)=>{let{eventName:s,handler:c}=o;return n[s]=l=>{c(l,t)},n},{}),[e,t])}function Lo(e){return d.useMemo(()=>e?Pi(e):null,[e])}const uo=[];function cs(e,t){t===void 0&&(t=rn);const[n]=e,o=Lo(n?Ke(n):null),[s,c]=d.useState(uo);function l(){c(()=>e.length?e.map(h=>Eo(h)?o:new Yr(t(h),h)):uo)}const u=Yn({callback:l});return bt(()=>{u==null||u.disconnect(),l(),e.forEach(h=>u==null?void 0:u.observe(h))},[e]),s}function jo(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return hn(t)?t:e}function ls(e){let{measure:t}=e;const[n,o]=d.useState(null),s=d.useCallback(f=>{for(const{target:b}of f)if(hn(b)){o(v=>{const _=t(b);return v?{...v,width:_.width,height:_.height}:_});break}},[t]),c=Yn({callback:s}),l=d.useCallback(f=>{const b=jo(f);c==null||c.disconnect(),b&&(c==null||c.observe(b)),o(b?t(b):null)},[t,c]),[u,h]=jn(l);return d.useMemo(()=>({nodeRef:u,rect:n,setRef:h}),[n,u,h])}const us=[{sensor:Mo,options:{}},{sensor:Wr,options:{}}],ds={current:{}},Ln={draggable:{measure:no},droppable:{measure:no,strategy:Qt.WhileDragging,frequency:$r.Optimized},dragOverlay:{measure:rn}};class dn extends Map{get(t){var n;return t!=null&&(n=super.get(t))!=null?n:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:n}=t;return!n})}getNodeFor(t){var n,o;return(n=(o=this.get(t))==null?void 0:o.node.current)!=null?n:void 0}}const fs={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new dn,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:zn},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:Ln,measureDroppableContainers:zn,windowRect:null,measuringScheduled:!1},$o={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:zn,draggableNodes:new Map,over:null,measureDroppableContainers:zn},bn=d.createContext($o),Bo=d.createContext(fs);function gs(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new dn}}}function hs(e,t){switch(t.type){case ye.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case ye.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case ye.DragEnd:case ye.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case ye.RegisterDroppable:{const{element:n}=t,{id:o}=n,s=new dn(e.droppable.containers);return s.set(o,n),{...e,droppable:{...e.droppable,containers:s}}}case ye.SetDroppableDisabled:{const{id:n,key:o,disabled:s}=t,c=e.droppable.containers.get(n);if(!c||o!==c.key)return e;const l=new dn(e.droppable.containers);return l.set(n,{...c,disabled:s}),{...e,droppable:{...e.droppable,containers:l}}}case ye.UnregisterDroppable:{const{id:n,key:o}=t,s=e.droppable.containers.get(n);if(!s||o!==s.key)return e;const c=new dn(e.droppable.containers);return c.delete(n),{...e,droppable:{...e.droppable,containers:c}}}default:return e}}function ps(e){let{disabled:t}=e;const{active:n,activatorEvent:o,draggableNodes:s}=d.useContext(bn),c=$n(o),l=$n(n==null?void 0:n.id);return d.useEffect(()=>{if(!t&&!o&&c&&l!=null){if(!Xn(c)||document.activeElement===c.target)return;const u=s.get(l);if(!u)return;const{activatorNode:h,node:f}=u;if(!h.current&&!f.current)return;requestAnimationFrame(()=>{for(const b of[h.current,f.current]){if(!b)continue;const v=fi(b);if(v){v.focus();break}}})}},[o,t,s,l,c]),null}function Fo(e,t){let{transform:n,...o}=t;return e!=null&&e.length?e.reduce((s,c)=>c({transform:s,...o}),n):n}function vs(e){return d.useMemo(()=>({draggable:{...Ln.draggable,...e==null?void 0:e.draggable},droppable:{...Ln.droppable,...e==null?void 0:e.droppable},dragOverlay:{...Ln.dragOverlay,...e==null?void 0:e.dragOverlay}}),[e==null?void 0:e.draggable,e==null?void 0:e.droppable,e==null?void 0:e.dragOverlay])}function bs(e){let{activeNode:t,measure:n,initialRect:o,config:s=!0}=e;const c=d.useRef(!1),{x:l,y:u}=typeof s=="boolean"?{x:s,y:s}:s;bt(()=>{if(!l&&!u||!t){c.current=!1;return}if(c.current||!o)return;const f=t==null?void 0:t.node.current;if(!f||f.isConnected===!1)return;const b=n(f),v=Co(b,o);if(l||(v.x=0),u||(v.y=0),c.current=!0,Math.abs(v.x)>0||Math.abs(v.y)>0){const _=_o(f);_&&_.scrollBy({top:v.y,left:v.x})}},[t,l,u,o,n])}const Wn=d.createContext({...yt,scaleX:1,scaleY:1});var Kt;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(Kt||(Kt={}));const ys=d.memo(function(t){var n,o,s,c;let{id:l,accessibility:u,autoScroll:h=!0,children:f,sensors:b=us,collisionDetection:v=wo,measuring:_,modifiers:w,...I}=t;const x=d.useReducer(hs,void 0,gs),[D,A]=x,[M,T]=yi(),[O,L]=d.useState(Kt.Uninitialized),N=O===Kt.Initialized,{draggable:{active:P,nodes:$,translate:Y},droppable:{containers:W}}=D,K=P!=null?$.get(P):null,ie=d.useRef({initial:null,translated:null}),ee=d.useMemo(()=>{var q;return P!=null?{id:P,data:(q=K==null?void 0:K.data)!=null?q:ds,rect:ie}:null},[P,K]),Se=d.useRef(null),[Ge,k]=d.useState(null),[te,Ue]=d.useState(null),_e=gn(I,Object.values(I)),B=vn("DndDescribedBy",l),ke=d.useMemo(()=>W.getEnabled(),[W]),ne=vs(_),{droppableRects:Z,measureDroppableContainers:Xe,measuringScheduled:nt}=Qi(ke,{dragging:N,dependencies:[Y.x,Y.y],config:ne.droppable}),se=Vi($,P),dt=d.useMemo(()=>te?Fn(te):null,[te]),Ye=Be(),fe=es(se,ne.draggable.measure);bs({activeNode:P!=null?$.get(P):null,config:Ye.layoutShiftCompensation,initialRect:fe,measure:ne.draggable.measure});const G=ao(se,ne.draggable.measure,fe),rt=ao(se?se.parentElement:null),Te=d.useRef({activatorEvent:null,active:null,activeNode:se,collisionRect:null,collisions:null,droppableRects:Z,draggableNodes:$,draggingNode:null,draggingNodeRect:null,droppableContainers:W,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),ot=W.getNodeFor((n=Te.current.over)==null?void 0:n.id),z=ls({measure:ne.dragOverlay.measure}),Ve=(o=z.nodeRef.current)!=null?o:se,Le=N?(s=z.rect)!=null?s:G:null,mt=!!(z.nodeRef.current&&z.rect),Oe=rs(mt?null:G),it=Lo(Ve?Ke(Ve):null),m=os(N?ot??se:null),C=cs(m),F=Fo(w,{transform:{x:Y.x-Oe.x,y:Y.y-Oe.y,scaleX:1,scaleY:1},activatorEvent:te,active:ee,activeNodeRect:G,containerNodeRect:rt,draggingNodeRect:Le,over:Te.current.over,overlayNodeRect:z.rect,scrollableAncestors:m,scrollableAncestorRects:C,windowRect:it}),V=dt?Zt(dt,Y):null,U=is(m),re=lo(U),ae=lo(U,[G]),ce=Zt(F,re),ge=Le?Ii(Le,F):null,pe=ee&&ge?v({active:ee,collisionRect:ge,droppableRects:Z,droppableContainers:ke,pointerCoordinates:V}):null,ft=kr(pe,"id"),[le,je]=d.useState(null),Rt=mt?F:Zt(F,ae),ue=Ti(Rt,(c=le==null?void 0:le.rect)!=null?c:null,G),de=d.useRef(null),$e=d.useCallback((q,De)=>{let{sensor:me,options:Qe}=De;if(Se.current==null)return;const Ie=$.get(Se.current);if(!Ie)return;const Re=q.nativeEvent,Fe=new me({active:Se.current,activeNode:Ie,event:Re,options:Qe,context:Te,onAbort(J){if(!$.get(J))return;const{onDragAbort:Ne}=_e.current,ze={id:J};Ne==null||Ne(ze),M({type:"onDragAbort",event:ze})},onPending(J,Me,Ne,ze){if(!$.get(J))return;const{onDragPending:et}=_e.current,he={id:J,constraint:Me,initialCoordinates:Ne,offset:ze};et==null||et(he),M({type:"onDragPending",event:he})},onStart(J){const Me=Se.current;if(Me==null)return;const Ne=$.get(Me);if(!Ne)return;const{onDragStart:ze}=_e.current,ht={activatorEvent:Re,active:{id:Me,data:Ne.data,rect:ie}};Vt.reactDomExports.unstable_batchedUpdates(()=>{ze==null||ze(ht),L(Kt.Initializing),A({type:ye.DragStart,initialCoordinates:J,active:Me}),M({type:"onDragStart",event:ht}),k(de.current),Ue(Re)})},onMove(J){A({type:ye.DragMove,coordinates:J})},onEnd:gt(ye.DragEnd),onCancel:gt(ye.DragCancel)});de.current=Fe;function gt(J){return async function(){const{active:Ne,collisions:ze,over:ht,scrollAdjustedTranslate:et}=Te.current;let he=null;if(Ne&&et){const{cancelDrop:Et}=_e.current;he={activatorEvent:Re,active:Ne,collisions:ze,delta:et,over:ht},J===ye.DragEnd&&typeof Et=="function"&&await Promise.resolve(Et(he))&&(J=ye.DragCancel)}Se.current=null,Vt.reactDomExports.unstable_batchedUpdates(()=>{A({type:J}),L(Kt.Uninitialized),je(null),k(null),Ue(null),de.current=null;const Et=J===ye.DragEnd?"onDragEnd":"onDragCancel";if(he){const Ut=_e.current[Et];Ut==null||Ut(he),M({type:Et,event:he})}})}}},[$]),Ze=d.useCallback((q,De)=>(me,Qe)=>{const Ie=me.nativeEvent,Re=$.get(Qe);if(Se.current!==null||!Re||Ie.dndKit||Ie.defaultPrevented)return;const Fe={active:Re};q(me,De.options,Fe)===!0&&(Ie.dndKit={capturedBy:De.sensor},Se.current=Qe,$e(me,De))},[$,$e]),st=Zi(b,Ze);ss(b),bt(()=>{G&&O===Kt.Initializing&&L(Kt.Initialized)},[G,O]),d.useEffect(()=>{const{onDragMove:q}=_e.current,{active:De,activatorEvent:me,collisions:Qe,over:Ie}=Te.current;if(!De||!me)return;const Re={active:De,activatorEvent:me,collisions:Qe,delta:{x:ce.x,y:ce.y},over:Ie};Vt.reactDomExports.unstable_batchedUpdates(()=>{q==null||q(Re),M({type:"onDragMove",event:Re})})},[ce.x,ce.y]),d.useEffect(()=>{const{active:q,activatorEvent:De,collisions:me,droppableContainers:Qe,scrollAdjustedTranslate:Ie}=Te.current;if(!q||Se.current==null||!De||!Ie)return;const{onDragOver:Re}=_e.current,Fe=Qe.get(ft),gt=Fe&&Fe.rect.current?{id:Fe.id,rect:Fe.rect.current,data:Fe.data,disabled:Fe.disabled}:null,J={active:q,activatorEvent:De,collisions:me,delta:{x:Ie.x,y:Ie.y},over:gt};Vt.reactDomExports.unstable_batchedUpdates(()=>{je(gt),Re==null||Re(J),M({type:"onDragOver",event:J})})},[ft]),bt(()=>{Te.current={activatorEvent:te,active:ee,activeNode:se,collisionRect:ge,collisions:pe,droppableRects:Z,draggableNodes:$,draggingNode:Ve,draggingNodeRect:Le,droppableContainers:W,over:le,scrollableAncestors:m,scrollAdjustedTranslate:ce},ie.current={initial:Le,translated:ge}},[ee,se,pe,ge,$,Ve,Le,Z,W,le,m,ce]),Wi({...Ye,delta:Y,draggingRect:ge,pointerCoordinates:V,scrollableAncestors:m,scrollableAncestorRects:C});const Pt=d.useMemo(()=>({active:ee,activeNode:se,activeNodeRect:G,activatorEvent:te,collisions:pe,containerNodeRect:rt,dragOverlay:z,draggableNodes:$,droppableContainers:W,droppableRects:Z,over:le,measureDroppableContainers:Xe,scrollableAncestors:m,scrollableAncestorRects:C,measuringConfiguration:ne,measuringScheduled:nt,windowRect:it}),[ee,se,G,te,pe,rt,z,$,W,Z,le,Xe,m,C,ne,nt,it]),Lt=d.useMemo(()=>({activatorEvent:te,activators:st,active:ee,activeNodeRect:G,ariaDescribedById:{draggable:B},dispatch:A,draggableNodes:$,over:le,measureDroppableContainers:Xe}),[te,st,ee,G,A,B,$,le,Xe]);return d.createElement(xo.Provider,{value:T},d.createElement(bn.Provider,{value:Lt},d.createElement(Bo.Provider,{value:Pt},d.createElement(Wn.Provider,{value:ue},f)),d.createElement(ps,{disabled:(u==null?void 0:u.restoreFocus)===!1})),d.createElement(wi,{...u,hiddenTextDescribedById:B}));function Be(){const q=(Ge==null?void 0:Ge.autoScrollEnabled)===!1,De=typeof h=="object"?h.enabled===!1:h===!1,me=N&&!q&&!De;return typeof h=="object"?{...h,enabled:me}:{enabled:me}}}),ms=d.createContext(null),fo="button",xs="Draggable";function ws(e){let{id:t,data:n,disabled:o=!1,attributes:s}=e;const c=vn(xs),{activators:l,activatorEvent:u,active:h,activeNodeRect:f,ariaDescribedById:b,draggableNodes:v,over:_}=d.useContext(bn),{role:w=fo,roleDescription:I="draggable",tabIndex:x=0}=s??{},D=(h==null?void 0:h.id)===t,A=d.useContext(D?Wn:ms),[M,T]=jn(),[O,L]=jn(),N=as(l,t),P=gn(n);bt(()=>(v.set(t,{id:t,key:c,node:M,activatorNode:O,data:P}),()=>{const Y=v.get(t);Y&&Y.key===c&&v.delete(t)}),[v,t]);const $=d.useMemo(()=>({role:w,tabIndex:x,"aria-disabled":o,"aria-pressed":D&&w===fo?!0:void 0,"aria-roledescription":I,"aria-describedby":b.draggable}),[o,w,x,D,I,b.draggable]);return{active:h,activatorEvent:u,activeNodeRect:f,attributes:$,isDragging:D,listeners:o?void 0:N,node:M,over:_,setNodeRef:T,setActivatorNodeRef:L,transform:A}}function zo(){return d.useContext(Bo)}const Cs="Droppable",Ss={timeout:25};function _s(e){let{data:t,disabled:n=!1,id:o,resizeObserverConfig:s}=e;const c=vn(Cs),{active:l,dispatch:u,over:h,measureDroppableContainers:f}=d.useContext(bn),b=d.useRef({disabled:n}),v=d.useRef(!1),_=d.useRef(null),w=d.useRef(null),{disabled:I,updateMeasurementsFor:x,timeout:D}={...Ss,...s},A=gn(x??o),M=d.useCallback(()=>{if(!v.current){v.current=!0;return}w.current!=null&&clearTimeout(w.current),w.current=setTimeout(()=>{f(Array.isArray(A.current)?A.current:[A.current]),w.current=null},D)},[D]),T=Yn({callback:M,disabled:I||!l}),O=d.useCallback(($,Y)=>{T&&(Y&&(T.unobserve(Y),v.current=!1),$&&T.observe($))},[T]),[L,N]=jn(O),P=gn(t);return d.useEffect(()=>{!T||!L.current||(T.disconnect(),v.current=!1,T.observe(L.current))},[L,T]),d.useEffect(()=>(u({type:ye.RegisterDroppable,element:{id:o,key:c,disabled:n,node:L,rect:_,data:P}}),()=>u({type:ye.UnregisterDroppable,key:c,id:o})),[o]),d.useEffect(()=>{n!==b.current.disabled&&(u({type:ye.SetDroppableDisabled,id:o,key:c,disabled:n}),b.current.disabled=n)},[o,c,n,u]),{active:l,rect:_,isOver:(h==null?void 0:h.id)===o,node:L,over:h,setNodeRef:N}}function Ds(e){let{animation:t,children:n}=e;const[o,s]=d.useState(null),[c,l]=d.useState(null),u=$n(n);return!n&&!o&&u&&s(u),bt(()=>{if(!c)return;const h=o==null?void 0:o.key,f=o==null?void 0:o.props.id;if(h==null||f==null){s(null);return}Promise.resolve(t(f,c)).then(()=>{s(null)})},[t,o,c]),d.createElement(d.Fragment,null,n,o?d.cloneElement(o,{ref:l}):null)}const Rs={x:0,y:0,scaleX:1,scaleY:1};function Es(e){let{children:t}=e;return d.createElement(bn.Provider,{value:$o},d.createElement(Wn.Provider,{value:Rs},t))}const As={position:"fixed",touchAction:"none"},Ts=e=>Xn(e)?"transform 250ms ease":void 0,Os=d.forwardRef((e,t)=>{let{as:n,activatorEvent:o,adjustScale:s,children:c,className:l,rect:u,style:h,transform:f,transition:b=Ts}=e;if(!u)return null;const v=s?f:{...f,scaleX:1,scaleY:1},_={...As,width:u.width,height:u.height,top:u.top,left:u.left,transform:Gt.Transform.toString(v),transformOrigin:s&&o?Si(o,u):void 0,transition:typeof b=="function"?b(o):b,...h};return d.createElement(n,{className:l,style:_,ref:t},c)}),Ho=e=>t=>{let{active:n,dragOverlay:o}=t;const s={},{styles:c,className:l}=e;if(c!=null&&c.active)for(const[u,h]of Object.entries(c.active))h!==void 0&&(s[u]=n.node.style.getPropertyValue(u),n.node.style.setProperty(u,h));if(c!=null&&c.dragOverlay)for(const[u,h]of Object.entries(c.dragOverlay))h!==void 0&&o.node.style.setProperty(u,h);return l!=null&&l.active&&n.node.classList.add(l.active),l!=null&&l.dragOverlay&&o.node.classList.add(l.dragOverlay),function(){for(const[h,f]of Object.entries(s))n.node.style.setProperty(h,f);l!=null&&l.active&&n.node.classList.remove(l.active)}},Is=e=>{let{transform:{initial:t,final:n}}=e;return[{transform:Gt.Transform.toString(t)},{transform:Gt.Transform.toString(n)}]},Ms={duration:250,easing:"ease",keyframes:Is,sideEffects:Ho({styles:{active:{opacity:"0"}}})};function Ns(e){let{config:t,draggableNodes:n,droppableContainers:o,measuringConfiguration:s}=e;return kn((c,l)=>{if(t===null)return;const u=n.get(c);if(!u)return;const h=u.node.current;if(!h)return;const f=jo(l);if(!f)return;const{transform:b}=Ke(l).getComputedStyle(l),v=So(b);if(!v)return;const _=typeof t=="function"?t:Ps(t);return Oo(h,s.draggable.measure),_({active:{id:c,data:u.data,node:h,rect:s.draggable.measure(h)},draggableNodes:n,dragOverlay:{node:l,rect:s.dragOverlay.measure(f)},droppableContainers:o,measuringConfiguration:s,transform:v})})}function Ps(e){const{duration:t,easing:n,sideEffects:o,keyframes:s}={...Ms,...e};return c=>{let{active:l,dragOverlay:u,transform:h,...f}=c;if(!t)return;const b={x:u.rect.left-l.rect.left,y:u.rect.top-l.rect.top},v={scaleX:h.scaleX!==1?l.rect.width*h.scaleX/u.rect.width:1,scaleY:h.scaleY!==1?l.rect.height*h.scaleY/u.rect.height:1},_={x:h.x-b.x,y:h.y-b.y,...v},w=s({...f,active:l,dragOverlay:u,transform:{initial:h,final:_}}),[I]=w,x=w[w.length-1];if(JSON.stringify(I)===JSON.stringify(x))return;const D=o==null?void 0:o({active:l,dragOverlay:u,...f}),A=u.node.animate(w,{duration:t,easing:n,fill:"forwards"});return new Promise(M=>{A.onfinish=()=>{D==null||D(),M()}})}}let go=0;function Ls(e){return d.useMemo(()=>{if(e!=null)return go++,go},[e])}const js=d.memo(e=>{let{adjustScale:t=!1,children:n,dropAnimation:o,style:s,transition:c,modifiers:l,wrapperElement:u="div",className:h,zIndex:f=999}=e;const{activatorEvent:b,active:v,activeNodeRect:_,containerNodeRect:w,draggableNodes:I,droppableContainers:x,dragOverlay:D,over:A,measuringConfiguration:M,scrollableAncestors:T,scrollableAncestorRects:O,windowRect:L}=zo(),N=d.useContext(Wn),P=Ls(v==null?void 0:v.id),$=Fo(l,{activatorEvent:b,active:v,activeNodeRect:_,containerNodeRect:w,draggingNodeRect:D.rect,over:A,overlayNodeRect:D.rect,scrollableAncestors:T,scrollableAncestorRects:O,transform:N,windowRect:L}),Y=Jr(_),W=Ns({config:o,draggableNodes:I,droppableContainers:x,measuringConfiguration:M}),K=Y?D.setRef:void 0;return d.createElement(Es,null,d.createElement(Ds,{animation:W},v&&P?d.createElement(Os,{key:P,id:v.id,ref:K,as:u,activatorEvent:b,adjustScale:t,className:h,transition:c,rect:Y,style:{zIndex:f,...s},transform:$},n):null))});function fn(e,t,n){const o=e.slice();return o.splice(n<0?o.length+n:n,0,o.splice(t,1)[0]),o}function $s(e,t){return e.reduce((n,o,s)=>{const c=t.get(o);return c&&(n[s]=c),n},Array(e.length))}function Mn(e){return e!==null&&e>=0}function Bs(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function Fs(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const Nn={scaleX:1,scaleY:1},zs=e=>{var t;let{rects:n,activeNodeRect:o,activeIndex:s,overIndex:c,index:l}=e;const u=(t=n[s])!=null?t:o;if(!u)return null;const h=Hs(n,l,s);if(l===s){const f=n[c];return f?{x:s<c?f.left+f.width-(u.left+u.width):f.left-u.left,y:0,...Nn}:null}return l>s&&l<=c?{x:-u.width-h,y:0,...Nn}:l<s&&l>=c?{x:u.width+h,y:0,...Nn}:{x:0,y:0,...Nn}};function Hs(e,t,n){const o=e[t],s=e[t-1],c=e[t+1];return!o||!s&&!c?0:n<t?s?o.left-(s.left+s.width):c.left-(o.left+o.width):c?c.left-(o.left+o.width):o.left-(s.left+s.width)}const Ko=e=>{let{rects:t,activeIndex:n,overIndex:o,index:s}=e;const c=fn(t,o,n),l=t[s],u=c[s];return!u||!l?null:{x:u.left-l.left,y:u.top-l.top,scaleX:u.width/l.width,scaleY:u.height/l.height}},Pn={scaleX:1,scaleY:1},ho=e=>{var t;let{activeIndex:n,activeNodeRect:o,index:s,rects:c,overIndex:l}=e;const u=(t=c[n])!=null?t:o;if(!u)return null;if(s===n){const f=c[l];return f?{x:0,y:n<l?f.top+f.height-(u.top+u.height):f.top-u.top,...Pn}:null}const h=Ks(c,s,n);return s>n&&s<=l?{x:0,y:-u.height-h,...Pn}:s<n&&s>=l?{x:0,y:u.height+h,...Pn}:{x:0,y:0,...Pn}};function Ks(e,t,n){const o=e[t],s=e[t-1],c=e[t+1];return o?n<t?s?o.top-(s.top+s.height):c?c.top-(o.top+o.height):0:c?c.top-(o.top+o.height):s?o.top-(s.top+s.height):0:0}const Go="Sortable",Uo=d.createContext({activeIndex:-1,containerId:Go,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:Ko,disabled:{draggable:!1,droppable:!1}});function po(e){let{children:t,id:n,items:o,strategy:s=Ko,disabled:c=!1}=e;const{active:l,dragOverlay:u,droppableRects:h,over:f,measureDroppableContainers:b}=zo(),v=vn(Go,n),_=u.rect!==null,w=d.useMemo(()=>o.map(N=>typeof N=="object"&&"id"in N?N.id:N),[o]),I=l!=null,x=l?w.indexOf(l.id):-1,D=f?w.indexOf(f.id):-1,A=d.useRef(w),M=!Bs(w,A.current),T=D!==-1&&x===-1||M,O=Fs(c);bt(()=>{M&&I&&b(w)},[M,w,I,b]),d.useEffect(()=>{A.current=w},[w]);const L=d.useMemo(()=>({activeIndex:x,containerId:v,disabled:O,disableTransforms:T,items:w,overIndex:D,useDragOverlay:_,sortedRects:$s(w,h),strategy:s}),[x,v,O.draggable,O.droppable,T,w,D,h,_,s]);return d.createElement(Uo.Provider,{value:L},t)}const Gs=e=>{let{id:t,items:n,activeIndex:o,overIndex:s}=e;return fn(n,o,s).indexOf(t)},ko=e=>{let{containerId:t,isSorting:n,wasDragging:o,index:s,items:c,newIndex:l,previousItems:u,previousContainerId:h,transition:f}=e;return!f||!o||u!==c&&s===l?!1:n?!0:l!==s&&t===h},Us={duration:200,easing:"ease"},Xo="transform",ks=Gt.Transition.toString({property:Xo,duration:0,easing:"linear"}),Xs={roleDescription:"sortable"};function Ys(e){let{disabled:t,index:n,node:o,rect:s}=e;const[c,l]=d.useState(null),u=d.useRef(n);return bt(()=>{if(!t&&n!==u.current&&o.current){const h=s.current;if(h){const f=rn(o.current,{ignoreTransform:!0}),b={x:h.left-f.left,y:h.top-f.top,scaleX:h.width/f.width,scaleY:h.height/f.height};(b.x||b.y)&&l(b)}}n!==u.current&&(u.current=n)},[t,n,o,s]),d.useEffect(()=>{c&&l(null)},[c]),c}function Yo(e){let{animateLayoutChanges:t=ko,attributes:n,disabled:o,data:s,getNewIndex:c=Gs,id:l,strategy:u,resizeObserverConfig:h,transition:f=Us}=e;const{items:b,containerId:v,activeIndex:_,disabled:w,disableTransforms:I,sortedRects:x,overIndex:D,useDragOverlay:A,strategy:M}=d.useContext(Uo),T=Ws(o,w),O=b.indexOf(l),L=d.useMemo(()=>({sortable:{containerId:v,index:O,items:b},...s}),[v,s,O,b]),N=d.useMemo(()=>b.slice(b.indexOf(l)),[b,l]),{rect:P,node:$,isOver:Y,setNodeRef:W}=_s({id:l,data:L,disabled:T.droppable,resizeObserverConfig:{updateMeasurementsFor:N,...h}}),{active:K,activatorEvent:ie,activeNodeRect:ee,attributes:Se,setNodeRef:Ge,listeners:k,isDragging:te,over:Ue,setActivatorNodeRef:_e,transform:B}=ws({id:l,data:L,attributes:{...Xs,...n},disabled:T.draggable}),ke=ci(W,Ge),ne=!!K,Z=ne&&!I&&Mn(_)&&Mn(D),Xe=!A&&te,nt=Xe&&Z?B:null,dt=Z?nt??(u??M)({rects:x,activeNodeRect:ee,activeIndex:_,overIndex:D,index:O}):null,Ye=Mn(_)&&Mn(D)?c({id:l,items:b,activeIndex:_,overIndex:D}):O,fe=K==null?void 0:K.id,G=d.useRef({activeId:fe,items:b,newIndex:Ye,containerId:v}),rt=b!==G.current.items,Te=t({active:K,containerId:v,isDragging:te,isSorting:ne,id:l,index:O,items:b,newIndex:G.current.newIndex,previousItems:G.current.items,previousContainerId:G.current.containerId,transition:f,wasDragging:G.current.activeId!=null}),ot=Ys({disabled:!Te,index:O,node:$,rect:P});return d.useEffect(()=>{ne&&G.current.newIndex!==Ye&&(G.current.newIndex=Ye),v!==G.current.containerId&&(G.current.containerId=v),b!==G.current.items&&(G.current.items=b)},[ne,Ye,v,b]),d.useEffect(()=>{if(fe===G.current.activeId)return;if(fe&&!G.current.activeId){G.current.activeId=fe;return}const Ve=setTimeout(()=>{G.current.activeId=fe},50);return()=>clearTimeout(Ve)},[fe]),{active:K,activeIndex:_,attributes:Se,data:L,rect:P,index:O,newIndex:Ye,items:b,isOver:Y,isSorting:ne,isDragging:te,listeners:k,node:$,overIndex:D,over:Ue,setNodeRef:ke,setActivatorNodeRef:_e,setDroppableNodeRef:W,setDraggableNodeRef:Ge,transform:o