@mdspl/mds-shared-ui 0.4.0 → 0.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -7,4 +7,4 @@ React keys must be passed directly to JSX without using spread:
7
7
  To pick up a draggable item, press the space bar.
8
8
  While dragging, use the arrow keys to move the item.
9
9
  Press space again to drop the item in its new position, or press escape to cancel.
10
- `},vo={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 mo(e){let{announcements:t=vo,container:n,hiddenTextDescribedById:r,screenReaderInstructions:o=po}=e;const{announce:s,announcement:a}=fo(),c=nt("DndLiveRegion"),[l,d]=f.useState(!1);if(f.useEffect(()=>{d(!0)},[]),ho(f.useMemo(()=>({onDragStart(h){let{active:x}=h;s(t.onDragStart({active:x}))},onDragMove(h){let{active:x,over:m}=h;t.onDragMove&&s(t.onDragMove({active:x,over:m}))},onDragOver(h){let{active:x,over:m}=h;s(t.onDragOver({active:x,over:m}))},onDragEnd(h){let{active:x,over:m}=h;s(t.onDragEnd({active:x,over:m}))},onDragCancel(h){let{active:x,over:m}=h;s(t.onDragCancel({active:x,over:m}))}}),[s,t])),!l)return null;const g=f.createElement(f.Fragment,null,f.createElement(lo,{id:r,value:o.draggable}),f.createElement(uo,{id:c,announcement:a}));return n?Ue.createPortal(g,n):g}var Z;(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"})(Z||(Z={}));function yt(){}function bo(e,t){return f.useMemo(()=>({sensor:e,options:{}}),[e,t])}function xo(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return f.useMemo(()=>[...t].filter(r=>r!=null),[...t])}const pe=Object.freeze({x:0,y:0});function yo(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function So(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function wo(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function Do(e,t){if(!e||e.length===0)return null;const[n]=e;return n[t]}function jn(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 er=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=jn(t,t.left,t.top),s=[];for(const a of r){const{id:c}=a,l=n.get(c);if(l){const d=yo(jn(l),o);s.push({id:c,data:{droppableContainer:a,value:d}})}}return s.sort(So)};function Co(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),s=Math.min(t.top+t.height,e.top+e.height),a=o-r,c=s-n;if(r<o&&n<s){const l=t.width*t.height,d=e.width*e.height,g=a*c,h=g/(l+d-g);return Number(h.toFixed(4))}return 0}const Ro=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=[];for(const s of r){const{id:a}=s,c=n.get(a);if(c){const l=Co(c,t);l>0&&o.push({id:a,data:{droppableContainer:s,value:l}})}}return o.sort(wo)};function Eo(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function tr(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:pe}function To(e){return function(n){for(var r=arguments.length,o=new Array(r>1?r-1:0),s=1;s<r;s++)o[s-1]=arguments[s];return o.reduce((a,c)=>({...a,top:a.top+e*c.y,bottom:a.bottom+e*c.y,left:a.left+e*c.x,right:a.right+e*c.x}),{...n})}}const jo=To(1);function Mo(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 _o(e,t,n){const r=Mo(t);if(!r)return e;const{scaleX:o,scaleY:s,x:a,y:c}=r,l=e.left-a-(1-o)*parseFloat(n),d=e.top-c-(1-s)*parseFloat(n.slice(n.indexOf(" ")+1)),g=o?e.width/o:e.width,h=s?e.height/s:e.height;return{width:g,height:h,top:d,right:l+g,bottom:d+h,left:l}}const Oo={ignoreTransform:!1};function Ne(e,t){t===void 0&&(t=Oo);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:d,transformOrigin:g}=ae(e).getComputedStyle(e);d&&(n=_o(n,d,g))}const{top:r,left:o,width:s,height:a,bottom:c,right:l}=n;return{top:r,left:o,width:s,height:a,bottom:c,right:l}}function Mn(e){return Ne(e,{ignoreTransform:!0})}function ko(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function $o(e,t){return t===void 0&&(t=ae(e).getComputedStyle(e)),t.position==="fixed"}function Io(e,t){t===void 0&&(t=ae(e).getComputedStyle(e));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(o=>{const s=t[o];return typeof s=="string"?n.test(s):!1})}function tn(e,t){const n=[];function r(o){if(t!=null&&n.length>=t||!o)return n;if(Zt(o)&&o.scrollingElement!=null&&!n.includes(o.scrollingElement))return n.push(o.scrollingElement),n;if(!et(o)||Jn(o)||n.includes(o))return n;const s=ae(e).getComputedStyle(o);return o!==e&&Io(o,s)&&n.push(o),$o(o,s)?n:r(o.parentNode)}return e?r(e):n}function nr(e){const[t]=tn(e,1);return t??null}function zt(e){return!Dt||!e?null:Ae(e)?e:Jt(e)?Zt(e)||e===Le(e).scrollingElement?window:et(e)?e:null:null}function rr(e){return Ae(e)?e.scrollX:e.scrollLeft}function or(e){return Ae(e)?e.scrollY:e.scrollTop}function Ut(e){return{x:rr(e),y:or(e)}}var Q;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(Q||(Q={}));function sr(e){return!Dt||!e?!1:e===document.scrollingElement}function ir(e){const t={x:0,y:0},n=sr(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height},o=e.scrollTop<=t.y,s=e.scrollLeft<=t.x,a=e.scrollTop>=r.y,c=e.scrollLeft>=r.x;return{isTop:o,isLeft:s,isBottom:a,isRight:c,maxScroll:r,minScroll:t}}const Ao={x:.2,y:.2};function Lo(e,t,n,r,o){let{top:s,left:a,right:c,bottom:l}=n;r===void 0&&(r=10),o===void 0&&(o=Ao);const{isTop:d,isBottom:g,isLeft:h,isRight:x}=ir(e),m={x:0,y:0},b={x:0,y:0},p={height:t.height*o.y,width:t.width*o.x};return!d&&s<=t.top+p.height?(m.y=Q.Backward,b.y=r*Math.abs((t.top+p.height-s)/p.height)):!g&&l>=t.bottom-p.height&&(m.y=Q.Forward,b.y=r*Math.abs((t.bottom-p.height-l)/p.height)),!x&&c>=t.right-p.width?(m.x=Q.Forward,b.x=r*Math.abs((t.right-p.width-c)/p.width)):!h&&a<=t.left+p.width&&(m.x=Q.Backward,b.x=r*Math.abs((t.left+p.width-a)/p.width)),{direction:m,speed:b}}function No(e){if(e===document.scrollingElement){const{innerWidth:s,innerHeight:a}=window;return{top:0,left:0,right:s,bottom:a,width:s,height:a}}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 ar(e){return e.reduce((t,n)=>$e(t,Ut(n)),pe)}function zo(e){return e.reduce((t,n)=>t+rr(n),0)}function Po(e){return e.reduce((t,n)=>t+or(n),0)}function Yo(e,t){if(t===void 0&&(t=Ne),!e)return;const{top:n,left:r,bottom:o,right:s}=t(e);nr(e)&&(o<=0||s<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const Fo=[["x",["left","right"],zo],["y",["top","bottom"],Po]];class nn{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 r=tn(n),o=ar(r);this.rect={...t},this.width=t.width,this.height=t.height;for(const[s,a,c]of Fo)for(const l of a)Object.defineProperty(this,l,{get:()=>{const d=c(r),g=o[s]-d;return this.rect[l]+g},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class Ge{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var r;return(r=this.target)==null?void 0:r.removeEventListener(...n)})},this.target=t}add(t,n,r){var o;(o=this.target)==null||o.addEventListener(t,n,r),this.listeners.push([t,n,r])}}function Bo(e){const{EventTarget:t}=ae(e);return e instanceof t?e:Le(e)}function Pt(e,t){const n=Math.abs(e.x),r=Math.abs(e.y);return typeof t=="number"?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:!1}var fe;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(fe||(fe={}));function _n(e){e.preventDefault()}function Ho(e){e.stopPropagation()}var V;(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"})(V||(V={}));const cr={start:[V.Space,V.Enter],cancel:[V.Esc],end:[V.Space,V.Enter,V.Tab]},Vo=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case V.Right:return{...n,x:n.x+25};case V.Left:return{...n,x:n.x-25};case V.Down:return{...n,y:n.y+25};case V.Up:return{...n,y:n.y-25}}};class lr{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 Ge(Le(n)),this.windowListeners=new Ge(ae(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(fe.Resize,this.handleCancel),this.windowListeners.add(fe.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(fe.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props,r=t.node.current;r&&Yo(r),n(pe)}handleKeyDown(t){if(en(t)){const{active:n,context:r,options:o}=this.props,{keyboardCodes:s=cr,coordinateGetter:a=Vo,scrollBehavior:c="smooth"}=o,{code:l}=t;if(s.end.includes(l)){this.handleEnd(t);return}if(s.cancel.includes(l)){this.handleCancel(t);return}const{collisionRect:d}=r.current,g=d?{x:d.left,y:d.top}:pe;this.referenceCoordinates||(this.referenceCoordinates=g);const h=a(t,{active:n,context:r.current,currentCoordinates:g});if(h){const x=xt(h,g),m={x:0,y:0},{scrollableAncestors:b}=r.current;for(const p of b){const y=t.code,{isTop:D,isRight:T,isLeft:M,isBottom:_,maxScroll:k,minScroll:O}=ir(p),I=No(p),P={x:Math.min(y===V.Right?I.right-I.width/2:I.right,Math.max(y===V.Right?I.left:I.left+I.width/2,h.x)),y:Math.min(y===V.Down?I.bottom-I.height/2:I.bottom,Math.max(y===V.Down?I.top:I.top+I.height/2,h.y))},W=y===V.Right&&!T||y===V.Left&&!M,B=y===V.Down&&!_||y===V.Up&&!D;if(W&&P.x!==h.x){const A=p.scrollLeft+x.x,K=y===V.Right&&A<=k.x||y===V.Left&&A>=O.x;if(K&&!x.y){p.scrollTo({left:A,behavior:c});return}K?m.x=p.scrollLeft-A:m.x=y===V.Right?p.scrollLeft-k.x:p.scrollLeft-O.x,m.x&&p.scrollBy({left:-m.x,behavior:c});break}else if(B&&P.y!==h.y){const A=p.scrollTop+x.y,K=y===V.Down&&A<=k.y||y===V.Up&&A>=O.y;if(K&&!x.x){p.scrollTo({top:A,behavior:c});return}K?m.y=p.scrollTop-A:m.y=y===V.Down?p.scrollTop-k.y:p.scrollTop-O.y,m.y&&p.scrollBy({top:-m.y,behavior:c});break}}this.handleMove(t,$e(xt(h,this.referenceCoordinates),m))}}}handleMove(t,n){const{onMove:r}=this.props;t.preventDefault(),r(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()}}lr.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:r=cr,onActivation:o}=t,{active:s}=n;const{code:a}=e.nativeEvent;if(r.start.includes(a)){const c=s.activatorNode.current;return c&&e.target!==c?!1:(e.preventDefault(),o?.({event:e.nativeEvent}),!0)}return!1}}];function On(e){return!!(e&&"distance"in e)}function kn(e){return!!(e&&"delay"in e)}class rn{constructor(t,n,r){var o;r===void 0&&(r=Bo(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:s}=t,{target:a}=s;this.props=t,this.events=n,this.document=Le(a),this.documentListeners=new Ge(this.document),this.listeners=new Ge(r),this.windowListeners=new Ge(ae(a)),this.initialCoordinates=(o=Wt(s))!=null?o:pe,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:r}}}=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(fe.Resize,this.handleCancel),this.windowListeners.add(fe.DragStart,_n),this.windowListeners.add(fe.VisibilityChange,this.handleCancel),this.windowListeners.add(fe.ContextMenu,_n),this.documentListeners.add(fe.Keydown,this.handleKeydown),n){if(r!=null&&r({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(kn(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(On(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:r,onPending:o}=this.props;o(r,t,this.initialCoordinates,n)}handleStart(){const{initialCoordinates:t}=this,{onStart:n}=this.props;t&&(this.activated=!0,this.documentListeners.add(fe.Click,Ho,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(fe.SelectionChange,this.removeTextSelection),n(t))}handleMove(t){var n;const{activated:r,initialCoordinates:o,props:s}=this,{onMove:a,options:{activationConstraint:c}}=s;if(!o)return;const l=(n=Wt(t))!=null?n:pe,d=xt(o,l);if(!r&&c){if(On(c)){if(c.tolerance!=null&&Pt(d,c.tolerance))return this.handleCancel();if(Pt(d,c.distance))return this.handleStart()}if(kn(c)&&Pt(d,c.tolerance))return this.handleCancel();this.handlePending(c,d);return}t.cancelable&&t.preventDefault(),a(l)}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===V.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const Wo={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class on extends rn{constructor(t){const{event:n}=t,r=Le(n.target);super(t,Wo,r)}}on.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!n.isPrimary||n.button!==0?!1:(r?.({event:n}),!0)}}];const Uo={move:{name:"mousemove"},end:{name:"mouseup"}};var Gt;(function(e){e[e.RightClick=2]="RightClick"})(Gt||(Gt={}));class Go extends rn{constructor(t){super(t,Uo,Le(t.event.target))}}Go.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===Gt.RightClick?!1:(r?.({event:n}),!0)}}];const Yt={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class Xo extends rn{constructor(t){super(t,Yt)}static setup(){return window.addEventListener(Yt.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(Yt.move.name,t)};function t(){}}}Xo.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;const{touches:o}=n;return o.length>1?!1:(r?.({event:n}),!0)}}];var Xe;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(Xe||(Xe={}));var St;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(St||(St={}));function qo(e){let{acceleration:t,activator:n=Xe.Pointer,canScroll:r,draggingRect:o,enabled:s,interval:a=5,order:c=St.TreeOrder,pointerCoordinates:l,scrollableAncestors:d,scrollableAncestorRects:g,delta:h,threshold:x}=e;const m=Jo({delta:h,disabled:!s}),[b,p]=oo(),y=f.useRef({x:0,y:0}),D=f.useRef({x:0,y:0}),T=f.useMemo(()=>{switch(n){case Xe.Pointer:return l?{top:l.y,bottom:l.y,left:l.x,right:l.x}:null;case Xe.DraggableRect:return o}},[n,o,l]),M=f.useRef(null),_=f.useCallback(()=>{const O=M.current;if(!O)return;const I=y.current.x*D.current.x,P=y.current.y*D.current.y;O.scrollBy(I,P)},[]),k=f.useMemo(()=>c===St.TreeOrder?[...d].reverse():d,[c,d]);f.useEffect(()=>{if(!s||!d.length||!T){p();return}for(const O of k){if(r?.(O)===!1)continue;const I=d.indexOf(O),P=g[I];if(!P)continue;const{direction:W,speed:B}=Lo(O,P,T,t,x);for(const A of["x","y"])m[A][W[A]]||(B[A]=0,W[A]=0);if(B.x>0||B.y>0){p(),M.current=O,b(_,a),y.current=B,D.current=W;return}}y.current={x:0,y:0},D.current={x:0,y:0},p()},[t,_,r,p,s,a,JSON.stringify(T),JSON.stringify(m),b,d,k,g,JSON.stringify(x)])}const Ko={x:{[Q.Backward]:!1,[Q.Forward]:!1},y:{[Q.Backward]:!1,[Q.Forward]:!1}};function Jo(e){let{delta:t,disabled:n}=e;const r=Vt(t);return tt(o=>{if(n||!r||!o)return Ko;const s={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[Q.Backward]:o.x[Q.Backward]||s.x===-1,[Q.Forward]:o.x[Q.Forward]||s.x===1},y:{[Q.Backward]:o.y[Q.Backward]||s.y===-1,[Q.Forward]:o.y[Q.Forward]||s.y===1}}},[n,t,r])}function Zo(e,t){const n=t!=null?e.get(t):void 0,r=n?n.node.current:null;return tt(o=>{var s;return t==null?null:(s=r??o)!=null?s:null},[r,t])}function Qo(e,t){return f.useMemo(()=>e.reduce((n,r)=>{const{sensor:o}=r,s=o.activators.map(a=>({eventName:a.eventName,handler:t(a.handler,r)}));return[...n,...s]},[]),[e,t])}var Je;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(Je||(Je={}));var Xt;(function(e){e.Optimized="optimized"})(Xt||(Xt={}));const $n=new Map;function es(e,t){let{dragging:n,dependencies:r,config:o}=t;const[s,a]=f.useState(null),{frequency:c,measure:l,strategy:d}=o,g=f.useRef(e),h=y(),x=Ke(h),m=f.useCallback(function(D){D===void 0&&(D=[]),!x.current&&a(T=>T===null?D:T.concat(D.filter(M=>!T.includes(M))))},[x]),b=f.useRef(null),p=tt(D=>{if(h&&!n)return $n;if(!D||D===$n||g.current!==e||s!=null){const T=new Map;for(let M of e){if(!M)continue;if(s&&s.length>0&&!s.includes(M.id)&&M.rect.current){T.set(M.id,M.rect.current);continue}const _=M.node.current,k=_?new nn(l(_),_):null;M.rect.current=k,k&&T.set(M.id,k)}return T}return D},[e,s,n,h,l]);return f.useEffect(()=>{g.current=e},[e]),f.useEffect(()=>{h||m()},[n,h]),f.useEffect(()=>{s&&s.length>0&&a(null)},[JSON.stringify(s)]),f.useEffect(()=>{h||typeof c!="number"||b.current!==null||(b.current=setTimeout(()=>{m(),b.current=null},c))},[c,h,m,...r]),{droppableRects:p,measureDroppableContainers:m,measuringScheduled:s!=null};function y(){switch(d){case Je.Always:return!1;case Je.BeforeDragging:return n;default:return!n}}}function ur(e,t){return tt(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function ts(e,t){return ur(e,t)}function ns(e){let{callback:t,disabled:n}=e;const r=Qt(t),o=f.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:s}=window;return new s(r)},[r,n]);return f.useEffect(()=>()=>o?.disconnect(),[o]),o}function Ct(e){let{callback:t,disabled:n}=e;const r=Qt(t),o=f.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:s}=window;return new s(r)},[n]);return f.useEffect(()=>()=>o?.disconnect(),[o]),o}function rs(e){return new nn(Ne(e),e)}function In(e,t,n){t===void 0&&(t=rs);const[r,o]=f.useState(null);function s(){o(l=>{if(!e)return null;if(e.isConnected===!1){var d;return(d=l??n)!=null?d:null}const g=t(e);return JSON.stringify(l)===JSON.stringify(g)?l:g})}const a=ns({callback(l){if(e)for(const d of l){const{type:g,target:h}=d;if(g==="childList"&&h instanceof HTMLElement&&h.contains(e)){s();break}}}}),c=Ct({callback:s});return be(()=>{s(),e?(c?.observe(e),a?.observe(document.body,{childList:!0,subtree:!0})):(c?.disconnect(),a?.disconnect())},[e]),r}function os(e){const t=ur(e);return tr(e,t)}const An=[];function ss(e){const t=f.useRef(e),n=tt(r=>e?r&&r!==An&&e&&t.current&&e.parentNode===t.current.parentNode?r:tn(e):An,[e]);return f.useEffect(()=>{t.current=e},[e]),n}function is(e){const[t,n]=f.useState(null),r=f.useRef(e),o=f.useCallback(s=>{const a=zt(s.target);a&&n(c=>c?(c.set(a,Ut(a)),new Map(c)):null)},[]);return f.useEffect(()=>{const s=r.current;if(e!==s){a(s);const c=e.map(l=>{const d=zt(l);return d?(d.addEventListener("scroll",o,{passive:!0}),[d,Ut(d)]):null}).filter(l=>l!=null);n(c.length?new Map(c):null),r.current=e}return()=>{a(e),a(s)};function a(c){c.forEach(l=>{const d=zt(l);d?.removeEventListener("scroll",o)})}},[o,e]),f.useMemo(()=>e.length?t?Array.from(t.values()).reduce((s,a)=>$e(s,a),pe):ar(e):pe,[e,t])}function Ln(e,t){t===void 0&&(t=[]);const n=f.useRef(null);return f.useEffect(()=>{n.current=null},t),f.useEffect(()=>{const r=e!==pe;r&&!n.current&&(n.current=e),!r&&n.current&&(n.current=null)},[e]),n.current?xt(e,n.current):pe}function as(e){f.useEffect(()=>{if(!Dt)return;const t=e.map(n=>{let{sensor:r}=n;return r.setup==null?void 0:r.setup()});return()=>{for(const n of t)n?.()}},e.map(t=>{let{sensor:n}=t;return n}))}function cs(e,t){return f.useMemo(()=>e.reduce((n,r)=>{let{eventName:o,handler:s}=r;return n[o]=a=>{s(a,t)},n},{}),[e,t])}function dr(e){return f.useMemo(()=>e?ko(e):null,[e])}const Nn=[];function ls(e,t){t===void 0&&(t=Ne);const[n]=e,r=dr(n?ae(n):null),[o,s]=f.useState(Nn);function a(){s(()=>e.length?e.map(l=>sr(l)?r:new nn(t(l),l)):Nn)}const c=Ct({callback:a});return be(()=>{c?.disconnect(),a(),e.forEach(l=>c?.observe(l))},[e]),o}function us(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return et(t)?t:e}function ds(e){let{measure:t}=e;const[n,r]=f.useState(null),o=f.useCallback(d=>{for(const{target:g}of d)if(et(g)){r(h=>{const x=t(g);return h?{...h,width:x.width,height:x.height}:x});break}},[t]),s=Ct({callback:o}),a=f.useCallback(d=>{const g=us(d);s?.disconnect(),g&&s?.observe(g),r(g?t(g):null)},[t,s]),[c,l]=bt(a);return f.useMemo(()=>({nodeRef:c,rect:n,setRef:l}),[n,c,l])}const fs=[{sensor:on,options:{}},{sensor:lr,options:{}}],hs={current:{}},ft={draggable:{measure:Mn},droppable:{measure:Mn,strategy:Je.WhileDragging,frequency:Xt.Optimized},dragOverlay:{measure:Ne}};class qe 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,r;return(n=(r=this.get(t))==null?void 0:r.node.current)!=null?n:void 0}}const gs={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new qe,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:yt},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:ft,measureDroppableContainers:yt,windowRect:null,measuringScheduled:!1},ps={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:yt,draggableNodes:new Map,over:null,measureDroppableContainers:yt},Rt=f.createContext(ps),fr=f.createContext(gs);function vs(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new qe}}}function ms(e,t){switch(t.type){case Z.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case Z.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 Z.DragEnd:case Z.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case Z.RegisterDroppable:{const{element:n}=t,{id:r}=n,o=new qe(e.droppable.containers);return o.set(r,n),{...e,droppable:{...e.droppable,containers:o}}}case Z.SetDroppableDisabled:{const{id:n,key:r,disabled:o}=t,s=e.droppable.containers.get(n);if(!s||r!==s.key)return e;const a=new qe(e.droppable.containers);return a.set(n,{...s,disabled:o}),{...e,droppable:{...e.droppable,containers:a}}}case Z.UnregisterDroppable:{const{id:n,key:r}=t,o=e.droppable.containers.get(n);if(!o||r!==o.key)return e;const s=new qe(e.droppable.containers);return s.delete(n),{...e,droppable:{...e.droppable,containers:s}}}default:return e}}function bs(e){let{disabled:t}=e;const{active:n,activatorEvent:r,draggableNodes:o}=f.useContext(Rt),s=Vt(r),a=Vt(n?.id);return f.useEffect(()=>{if(!t&&!r&&s&&a!=null){if(!en(s)||document.activeElement===s.target)return;const c=o.get(a);if(!c)return;const{activatorNode:l,node:d}=c;if(!l.current&&!d.current)return;requestAnimationFrame(()=>{for(const g of[l.current,d.current]){if(!g)continue;const h=ao(g);if(h){h.focus();break}}})}},[r,t,o,a,s]),null}function xs(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((o,s)=>s({transform:o,...r}),n):n}function ys(e){return f.useMemo(()=>({draggable:{...ft.draggable,...e?.draggable},droppable:{...ft.droppable,...e?.droppable},dragOverlay:{...ft.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function Ss(e){let{activeNode:t,measure:n,initialRect:r,config:o=!0}=e;const s=f.useRef(!1),{x:a,y:c}=typeof o=="boolean"?{x:o,y:o}:o;be(()=>{if(!a&&!c||!t){s.current=!1;return}if(s.current||!r)return;const d=t?.node.current;if(!d||d.isConnected===!1)return;const g=n(d),h=tr(g,r);if(a||(h.x=0),c||(h.y=0),s.current=!0,Math.abs(h.x)>0||Math.abs(h.y)>0){const x=nr(d);x&&x.scrollBy({top:h.y,left:h.x})}},[t,a,c,r,n])}const hr=f.createContext({...pe,scaleX:1,scaleY:1});var Ee;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(Ee||(Ee={}));const gr=f.memo(function(t){var n,r,o,s;let{id:a,accessibility:c,autoScroll:l=!0,children:d,sensors:g=fs,collisionDetection:h=Ro,measuring:x,modifiers:m,...b}=t;const p=f.useReducer(ms,void 0,vs),[y,D]=p,[T,M]=go(),[_,k]=f.useState(Ee.Uninitialized),O=_===Ee.Initialized,{draggable:{active:I,nodes:P,translate:W},droppable:{containers:B}}=y,A=I!=null?P.get(I):null,K=f.useRef({initial:null,translated:null}),ee=f.useMemo(()=>{var re;return I!=null?{id:I,data:(re=A?.data)!=null?re:hs,rect:K}:null},[I,A]),$=f.useRef(null),[R,w]=f.useState(null),[j,E]=f.useState(null),L=Ke(b,Object.values(b)),z=nt("DndDescribedBy",a),v=f.useMemo(()=>B.getEnabled(),[B]),C=ys(x),{droppableRects:N,measureDroppableContainers:F,measuringScheduled:U}=es(v,{dragging:O,dependencies:[W.x,W.y],config:C.droppable}),G=Zo(P,I),H=f.useMemo(()=>j?Wt(j):null,[j]),X=Fr(),q=ts(G,C.draggable.measure);Ss({activeNode:I!=null?P.get(I):null,config:X.layoutShiftCompensation,initialRect:q,measure:C.draggable.measure});const Y=In(G,C.draggable.measure,q),se=In(G?G.parentElement:null),ne=f.useRef({activatorEvent:null,active:null,activeNode:G,collisionRect:null,collisions:null,droppableRects:N,draggableNodes:P,draggingNode:null,draggingNodeRect:null,droppableContainers:B,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),he=B.getNodeFor((n=ne.current.over)==null?void 0:n.id),xe=ds({measure:C.dragOverlay.measure}),je=(r=xe.nodeRef.current)!=null?r:G,Me=O?(o=xe.rect)!=null?o:Y:null,cn=!!(xe.nodeRef.current&&xe.rect),ln=os(cn?null:Y),Mt=dr(je?ae(je):null),Se=ss(O?he??G:null),rt=ls(Se),ot=xs(m,{transform:{x:W.x-ln.x,y:W.y-ln.y,scaleX:1,scaleY:1},activatorEvent:j,active:ee,activeNodeRect:Y,containerNodeRect:se,draggingNodeRect:Me,over:ne.current.over,overlayNodeRect:xe.rect,scrollableAncestors:Se,scrollableAncestorRects:rt,windowRect:Mt}),un=H?$e(H,W):null,dn=is(Se),Ir=Ln(dn),Ar=Ln(dn,[Y]),_e=$e(ot,Ir),Oe=Me?jo(Me,ot):null,ze=ee&&Oe?h({active:ee,collisionRect:Oe,droppableRects:N,droppableContainers:v,pointerCoordinates:un}):null,fn=Do(ze,"id"),[we,hn]=f.useState(null),Lr=cn?ot:$e(ot,Ar),Nr=Eo(Lr,(s=we?.rect)!=null?s:null,Y),_t=f.useRef(null),gn=f.useCallback((re,ce)=>{let{sensor:le,options:De}=ce;if($.current==null)return;const de=P.get($.current);if(!de)return;const ue=re.nativeEvent,ve=new le({active:$.current,activeNode:de,event:ue,options:De,context:ne,onAbort(te){if(!P.get(te))return;const{onDragAbort:me}=L.current,ye={id:te};me?.(ye),T({type:"onDragAbort",event:ye})},onPending(te,Ce,me,ye){if(!P.get(te))return;const{onDragPending:Ye}=L.current,Re={id:te,constraint:Ce,initialCoordinates:me,offset:ye};Ye?.(Re),T({type:"onDragPending",event:Re})},onStart(te){const Ce=$.current;if(Ce==null)return;const me=P.get(Ce);if(!me)return;const{onDragStart:ye}=L.current,Pe={activatorEvent:ue,active:{id:Ce,data:me.data,rect:K}};Ue.unstable_batchedUpdates(()=>{ye?.(Pe),k(Ee.Initializing),D({type:Z.DragStart,initialCoordinates:te,active:Ce}),T({type:"onDragStart",event:Pe}),w(_t.current),E(ue)})},onMove(te){D({type:Z.DragMove,coordinates:te})},onEnd:ke(Z.DragEnd),onCancel:ke(Z.DragCancel)});_t.current=ve;function ke(te){return async function(){const{active:me,collisions:ye,over:Pe,scrollAdjustedTranslate:Ye}=ne.current;let Re=null;if(me&&Ye){const{cancelDrop:Fe}=L.current;Re={activatorEvent:ue,active:me,collisions:ye,delta:Ye,over:Pe},te===Z.DragEnd&&typeof Fe=="function"&&await Promise.resolve(Fe(Re))&&(te=Z.DragCancel)}$.current=null,Ue.unstable_batchedUpdates(()=>{D({type:te}),k(Ee.Uninitialized),hn(null),w(null),E(null),_t.current=null;const Fe=te===Z.DragEnd?"onDragEnd":"onDragCancel";if(Re){const Ot=L.current[Fe];Ot?.(Re),T({type:Fe,event:Re})}})}}},[P]),zr=f.useCallback((re,ce)=>(le,De)=>{const de=le.nativeEvent,ue=P.get(De);if($.current!==null||!ue||de.dndKit||de.defaultPrevented)return;const ve={active:ue};re(le,ce.options,ve)===!0&&(de.dndKit={capturedBy:ce.sensor},$.current=De,gn(le,ce))},[P,gn]),pn=Qo(g,zr);as(g),be(()=>{Y&&_===Ee.Initializing&&k(Ee.Initialized)},[Y,_]),f.useEffect(()=>{const{onDragMove:re}=L.current,{active:ce,activatorEvent:le,collisions:De,over:de}=ne.current;if(!ce||!le)return;const ue={active:ce,activatorEvent:le,collisions:De,delta:{x:_e.x,y:_e.y},over:de};Ue.unstable_batchedUpdates(()=>{re?.(ue),T({type:"onDragMove",event:ue})})},[_e.x,_e.y]),f.useEffect(()=>{const{active:re,activatorEvent:ce,collisions:le,droppableContainers:De,scrollAdjustedTranslate:de}=ne.current;if(!re||$.current==null||!ce||!de)return;const{onDragOver:ue}=L.current,ve=De.get(fn),ke=ve&&ve.rect.current?{id:ve.id,rect:ve.rect.current,data:ve.data,disabled:ve.disabled}:null,te={active:re,activatorEvent:ce,collisions:le,delta:{x:de.x,y:de.y},over:ke};Ue.unstable_batchedUpdates(()=>{hn(ke),ue?.(te),T({type:"onDragOver",event:te})})},[fn]),be(()=>{ne.current={activatorEvent:j,active:ee,activeNode:G,collisionRect:Oe,collisions:ze,droppableRects:N,draggableNodes:P,draggingNode:je,draggingNodeRect:Me,droppableContainers:B,over:we,scrollableAncestors:Se,scrollAdjustedTranslate:_e},K.current={initial:Me,translated:Oe}},[ee,G,ze,Oe,P,je,Me,N,B,we,Se,_e]),qo({...X,delta:W,draggingRect:Oe,pointerCoordinates:un,scrollableAncestors:Se,scrollableAncestorRects:rt});const Pr=f.useMemo(()=>({active:ee,activeNode:G,activeNodeRect:Y,activatorEvent:j,collisions:ze,containerNodeRect:se,dragOverlay:xe,draggableNodes:P,droppableContainers:B,droppableRects:N,over:we,measureDroppableContainers:F,scrollableAncestors:Se,scrollableAncestorRects:rt,measuringConfiguration:C,measuringScheduled:U,windowRect:Mt}),[ee,G,Y,j,ze,se,xe,P,B,N,we,F,Se,rt,C,U,Mt]),Yr=f.useMemo(()=>({activatorEvent:j,activators:pn,active:ee,activeNodeRect:Y,ariaDescribedById:{draggable:z},dispatch:D,draggableNodes:P,over:we,measureDroppableContainers:F}),[j,pn,ee,Y,D,z,P,we,F]);return f.createElement(Qn.Provider,{value:M},f.createElement(Rt.Provider,{value:Yr},f.createElement(fr.Provider,{value:Pr},f.createElement(hr.Provider,{value:Nr},d)),f.createElement(bs,{disabled:c?.restoreFocus===!1})),f.createElement(mo,{...c,hiddenTextDescribedById:z}));function Fr(){const re=R?.autoScrollEnabled===!1,ce=typeof l=="object"?l.enabled===!1:l===!1,le=O&&!re&&!ce;return typeof l=="object"?{...l,enabled:le}:{enabled:le}}}),ws=f.createContext(null),zn="button",Ds="Draggable";function Cs(e){let{id:t,data:n,disabled:r=!1,attributes:o}=e;const s=nt(Ds),{activators:a,activatorEvent:c,active:l,activeNodeRect:d,ariaDescribedById:g,draggableNodes:h,over:x}=f.useContext(Rt),{role:m=zn,roleDescription:b="draggable",tabIndex:p=0}=o??{},y=l?.id===t,D=f.useContext(y?hr:ws),[T,M]=bt(),[_,k]=bt(),O=cs(a,t),I=Ke(n);be(()=>(h.set(t,{id:t,key:s,node:T,activatorNode:_,data:I}),()=>{const W=h.get(t);W&&W.key===s&&h.delete(t)}),[h,t]);const P=f.useMemo(()=>({role:m,tabIndex:p,"aria-disabled":r,"aria-pressed":y&&m===zn?!0:void 0,"aria-roledescription":b,"aria-describedby":g.draggable}),[r,m,p,y,b,g.draggable]);return{active:l,activatorEvent:c,activeNodeRect:d,attributes:P,isDragging:y,listeners:r?void 0:O,node:T,over:x,setNodeRef:M,setActivatorNodeRef:k,transform:D}}function Rs(){return f.useContext(fr)}const Es="Droppable",Ts={timeout:25};function js(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:o}=e;const s=nt(Es),{active:a,dispatch:c,over:l,measureDroppableContainers:d}=f.useContext(Rt),g=f.useRef({disabled:n}),h=f.useRef(!1),x=f.useRef(null),m=f.useRef(null),{disabled:b,updateMeasurementsFor:p,timeout:y}={...Ts,...o},D=Ke(p??r),T=f.useCallback(()=>{if(!h.current){h.current=!0;return}m.current!=null&&clearTimeout(m.current),m.current=setTimeout(()=>{d(Array.isArray(D.current)?D.current:[D.current]),m.current=null},y)},[y]),M=Ct({callback:T,disabled:b||!a}),_=f.useCallback((P,W)=>{M&&(W&&(M.unobserve(W),h.current=!1),P&&M.observe(P))},[M]),[k,O]=bt(_),I=Ke(t);return f.useEffect(()=>{!M||!k.current||(M.disconnect(),h.current=!1,M.observe(k.current))},[k,M]),f.useEffect(()=>(c({type:Z.RegisterDroppable,element:{id:r,key:s,disabled:n,node:k,rect:x,data:I}}),()=>c({type:Z.UnregisterDroppable,key:s,id:r})),[r]),f.useEffect(()=>{n!==g.current.disabled&&(c({type:Z.SetDroppableDisabled,id:r,key:s,disabled:n}),g.current.disabled=n)},[r,s,n,c]),{active:a,rect:x,isOver:l?.id===r,node:k,over:l,setNodeRef:O}}function Et(e,t,n){const r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function Ms(e,t){return e.reduce((n,r,o)=>{const s=t.get(r);return s&&(n[o]=s),n},Array(e.length))}function lt(e){return e!==null&&e>=0}function _s(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 Os(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const ut={scaleX:1,scaleY:1},ks=e=>{var t;let{rects:n,activeNodeRect:r,activeIndex:o,overIndex:s,index:a}=e;const c=(t=n[o])!=null?t:r;if(!c)return null;const l=$s(n,a,o);if(a===o){const d=n[s];return d?{x:o<s?d.left+d.width-(c.left+c.width):d.left-c.left,y:0,...ut}:null}return a>o&&a<=s?{x:-c.width-l,y:0,...ut}:a<o&&a>=s?{x:c.width+l,y:0,...ut}:{x:0,y:0,...ut}};function $s(e,t,n){const r=e[t],o=e[t-1],s=e[t+1];return!r||!o&&!s?0:n<t?o?r.left-(o.left+o.width):s.left-(r.left+r.width):s?s.left-(r.left+r.width):r.left-(o.left+o.width)}const pr=e=>{let{rects:t,activeIndex:n,overIndex:r,index:o}=e;const s=Et(t,r,n),a=t[o],c=s[o];return!c||!a?null:{x:c.left-a.left,y:c.top-a.top,scaleX:c.width/a.width,scaleY:c.height/a.height}},dt={scaleX:1,scaleY:1},Is=e=>{var t;let{activeIndex:n,activeNodeRect:r,index:o,rects:s,overIndex:a}=e;const c=(t=s[n])!=null?t:r;if(!c)return null;if(o===n){const d=s[a];return d?{x:0,y:n<a?d.top+d.height-(c.top+c.height):d.top-c.top,...dt}:null}const l=As(s,o,n);return o>n&&o<=a?{x:0,y:-c.height-l,...dt}:o<n&&o>=a?{x:0,y:c.height+l,...dt}:{x:0,y:0,...dt}};function As(e,t,n){const r=e[t],o=e[t-1],s=e[t+1];return r?n<t?o?r.top-(o.top+o.height):s?s.top-(r.top+r.height):0:s?s.top-(r.top+r.height):o?r.top-(o.top+o.height):0:0}const vr="Sortable",mr=f.createContext({activeIndex:-1,containerId:vr,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:pr,disabled:{draggable:!1,droppable:!1}});function br(e){let{children:t,id:n,items:r,strategy:o=pr,disabled:s=!1}=e;const{active:a,dragOverlay:c,droppableRects:l,over:d,measureDroppableContainers:g}=Rs(),h=nt(vr,n),x=c.rect!==null,m=f.useMemo(()=>r.map(O=>typeof O=="object"&&"id"in O?O.id:O),[r]),b=a!=null,p=a?m.indexOf(a.id):-1,y=d?m.indexOf(d.id):-1,D=f.useRef(m),T=!_s(m,D.current),M=y!==-1&&p===-1||T,_=Os(s);be(()=>{T&&b&&g(m)},[T,m,b,g]),f.useEffect(()=>{D.current=m},[m]);const k=f.useMemo(()=>({activeIndex:p,containerId:h,disabled:_,disableTransforms:M,items:m,overIndex:y,useDragOverlay:x,sortedRects:Ms(m,l),strategy:o}),[p,h,_.draggable,_.droppable,M,m,y,l,x,o]);return f.createElement(mr.Provider,{value:k},t)}const Ls=e=>{let{id:t,items:n,activeIndex:r,overIndex:o}=e;return Et(n,r,o).indexOf(t)},Ns=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:o,items:s,newIndex:a,previousItems:c,previousContainerId:l,transition:d}=e;return!d||!r||c!==s&&o===a?!1:n?!0:a!==o&&t===l},zs={duration:200,easing:"ease"},xr="transform",Ps=Ie.Transition.toString({property:xr,duration:0,easing:"linear"}),Ys={roleDescription:"sortable"};function Fs(e){let{disabled:t,index:n,node:r,rect:o}=e;const[s,a]=f.useState(null),c=f.useRef(n);return be(()=>{if(!t&&n!==c.current&&r.current){const l=o.current;if(l){const d=Ne(r.current,{ignoreTransform:!0}),g={x:l.left-d.left,y:l.top-d.top,scaleX:l.width/d.width,scaleY:l.height/d.height};(g.x||g.y)&&a(g)}}n!==c.current&&(c.current=n)},[t,n,r,o]),f.useEffect(()=>{s&&a(null)},[s]),s}function yr(e){let{animateLayoutChanges:t=Ns,attributes:n,disabled:r,data:o,getNewIndex:s=Ls,id:a,strategy:c,resizeObserverConfig:l,transition:d=zs}=e;const{items:g,containerId:h,activeIndex:x,disabled:m,disableTransforms:b,sortedRects:p,overIndex:y,useDragOverlay:D,strategy:T}=f.useContext(mr),M=Bs(r,m),_=g.indexOf(a),k=f.useMemo(()=>({sortable:{containerId:h,index:_,items:g},...o}),[h,o,_,g]),O=f.useMemo(()=>g.slice(g.indexOf(a)),[g,a]),{rect:I,node:P,isOver:W,setNodeRef:B}=js({id:a,data:k,disabled:M.droppable,resizeObserverConfig:{updateMeasurementsFor:O,...l}}),{active:A,activatorEvent:K,activeNodeRect:ee,attributes:$,setNodeRef:R,listeners:w,isDragging:j,over:E,setActivatorNodeRef:L,transform:z}=Cs({id:a,data:k,attributes:{...Ys,...n},disabled:M.draggable}),v=ro(B,R),C=!!A,N=C&&!b&&lt(x)&&lt(y),F=!D&&j,U=F&&N?z:null,H=N?U??(c??T)({rects:p,activeNodeRect:ee,activeIndex:x,overIndex:y,index:_}):null,X=lt(x)&&lt(y)?s({id:a,items:g,activeIndex:x,overIndex:y}):_,q=A?.id,Y=f.useRef({activeId:q,items:g,newIndex:X,containerId:h}),se=g!==Y.current.items,ne=t({active:A,containerId:h,isDragging:j,isSorting:C,id:a,index:_,items:g,newIndex:Y.current.newIndex,previousItems:Y.current.items,previousContainerId:Y.current.containerId,transition:d,wasDragging:Y.current.activeId!=null}),he=Fs({disabled:!ne,index:_,node:P,rect:I});return f.useEffect(()=>{C&&Y.current.newIndex!==X&&(Y.current.newIndex=X),h!==Y.current.containerId&&(Y.current.containerId=h),g!==Y.current.items&&(Y.current.items=g)},[C,X,h,g]),f.useEffect(()=>{if(q===Y.current.activeId)return;if(q!=null&&Y.current.activeId==null){Y.current.activeId=q;return}const je=setTimeout(()=>{Y.current.activeId=q},50);return()=>clearTimeout(je)},[q]),{active:A,activeIndex:x,attributes:$,data:k,rect:I,index:_,newIndex:X,items:g,isOver:W,isSorting:C,isDragging:j,listeners:w,node:P,overIndex:y,over:E,setNodeRef:v,setActivatorNodeRef:L,setDroppableNodeRef:B,setDraggableNodeRef:R,transform:he??H,transition:xe()};function xe(){if(he||se&&Y.current.newIndex===_)return Ps;if(!(F&&!en(K)||!d)&&(C||ne))return Ie.Transition.toString({...d,property:xr})}}function Bs(e,t){var n,r;return typeof e=="boolean"?{draggable:e,droppable:!1}:{draggable:(n=e?.draggable)!=null?n:t.draggable,droppable:(r=e?.droppable)!=null?r:t.droppable}}V.Down,V.Right,V.Up,V.Left;const Hs=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Vs=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,r)=>r?r.toUpperCase():n.toLowerCase()),Pn=e=>{const t=Vs(e);return t.charAt(0).toUpperCase()+t.slice(1)},Sr=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim(),Ws=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0};var Us={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const Gs=f.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:o="",children:s,iconNode:a,...c},l)=>f.createElement("svg",{ref:l,...Us,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:Sr("lucide",o),...!s&&!Ws(c)&&{"aria-hidden":"true"},...c},[...a.map(([d,g])=>f.createElement(d,g)),...Array.isArray(s)?s:[s]]));const oe=(e,t)=>{const n=f.forwardRef(({className:r,...o},s)=>f.createElement(Gs,{ref:s,iconNode:t,className:Sr(`lucide-${Hs(Pn(e))}`,`lucide-${e}`,r),...o}));return n.displayName=Pn(e),n};const Xs=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],qs=oe("arrow-down",Xs);const Ks=[["path",{d:"m21 16-4 4-4-4",key:"f6ql7i"}],["path",{d:"M17 20V4",key:"1ejh1v"}],["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}]],Js=oe("arrow-up-down",Ks);const Zs=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],Qs=oe("arrow-up",Zs);const ei=[["path",{d:"m19 21-7-4-7 4V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v16z",key:"1fy3hk"}]],ti=oe("bookmark",ei);const ni=[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]],Yn=oe("calendar",ni);const ri=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],oi=oe("chevron-left",ri);const si=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],ii=oe("chevron-right",si);const ai=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 3v18",key:"108xh3"}]],ci=oe("columns-2",ai);const li=[["path",{d:"M10 5a2 2 0 0 0-1.344.519l-6.328 5.74a1 1 0 0 0 0 1.481l6.328 5.741A2 2 0 0 0 10 19h10a2 2 0 0 0 2-2V7a2 2 0 0 0-2-2z",key:"1yo7s0"}],["path",{d:"m12 9 6 6",key:"anjzzh"}],["path",{d:"m18 9-6 6",key:"1fp51s"}]],ui=oe("delete",li);const di=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]],fi=oe("ellipsis",di);const hi=[["path",{d:"M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z",key:"sc7q7i"}]],gi=oe("funnel",hi);const pi=[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]],wr=oe("grip-vertical",pi);const vi=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]],mi=oe("pen",vi);const bi=[["path",{d:"M21 12a9 9 0 0 0-9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"14sxne"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M3 12a9 9 0 0 0 9 9 9.75 9.75 0 0 0 6.74-2.74L21 16",key:"1hlbsb"}],["path",{d:"M16 16h5v5",key:"ccwih5"}]],xi=oe("refresh-ccw",bi);const yi=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],Si=oe("settings",yi);const wi=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],Di=oe("triangle-alert",wi);function S(e){return f.forwardRef((t,n)=>{const{children:r,...o}=t;return i.jsx(e,{ref:n,...o,children:r})})}const Dr=e=>`table_column_order_v1:${e}`,Ci=e=>{const{tableId:t}=ie.state;localStorage.setItem(Dr(t),JSON.stringify(e.map(n=>n.id))),ie.setState(n=>({...n,columnOrder:e})),ie.setState(n=>({...n,columnOrder:e}))},Ri=e=>{ie.setState(t=>({...t,visibility:{...t.visibility,[e]:!t.visibility[e]}}))};function Ei(e){ie.setState(t=>t.sortColumn===e?{...t,sortDirection:t.sortDirection==="asc"?"desc":"asc"}:{...t,sortColumn:e,sortDirection:"asc"})}const ie=new Kn({tableId:"",sortColumn:null,sortDirection:"asc",visibility:{},columnOrder:[],data:[],sortableColumns:[],actionsConfig:{showActionColumn:!0,showColumnVisibilityMenu:!0,children:"Actions",width:"100px"}});function Cr(e,t){const n=e[0]??{},o=(t&&t.length?t:Object.keys(n).map(l=>({id:l,label:l}))).filter(l=>Object.prototype.hasOwnProperty.call(n,l.id)),{tableId:s}=ie.state,a=JSON.parse(localStorage.getItem(Dr(s))||"[]"),c=[...a.map(l=>o.find(d=>d.id===l)).filter(Boolean),...o.filter(l=>!a.includes(l.id))];ie.setState(l=>({...l,data:e,columnOrder:c,visibility:c.reduce((d,g)=>(d[g.id]=!0,d),{}),sortableColumns:c.map(d=>({id:d.id,label:d.label,sortable:!0,backgroundColor:d.backgroundColor}))}))}function Rr(e){ie.setState(t=>({...t,tableId:e}))}const Er=e=>{ie.setState(t=>({...t,actionsConfig:e}))},Ti=S(u.Menu.Trigger),ji=S(u.Menu.Positioner),Mi=S(u.Menu.Content),_i=S(u.Menu.Item),Oi=S(u.Checkbox.Label),ki=S(u.Checkbox.HiddenInput),$i=S(u.Checkbox.Control);function Ii({visibility:e,onToggle:t}){const{sortableColumns:n}=Qe(ie);return i.jsxs(u.Menu.Root,{closeOnSelect:!1,children:[i.jsx(Ti,{asChild:!0,children:i.jsx(u.IconButton,{"aria-label":"Toggle columns",variant:"outline",size:"sm",ml:"1",children:i.jsx(ci,{size:18})})}),i.jsx(u.Portal,{children:i.jsx(ji,{children:i.jsx(Mi,{minW:"220px",children:n.map(r=>{const o=!!e[r.id];return i.jsx(_i,{value:r.id,closeOnSelect:!1,children:i.jsxs(u.Checkbox.Root,{checked:o,onCheckedChange:()=>t(r.id),children:[i.jsx(ki,{}),i.jsx($i,{}),i.jsx(Oi,{children:r.label})]})},r.id)})})})})]})}function Ai({id:e,children:t,onClick:n,cursor:r,borderRight:o,borderRightColor:s,backgroundColor:a}){const{setNodeRef:c,attributes:l,listeners:d,transform:g,transition:h}=yr({id:e});return i.jsx(u.Table.ColumnHeader,{ref:c,onClick:n,backgroundColor:a,w:e==="id"?"80px":void 0,style:{transform:Ie.Transform.toString(g),transition:h,cursor:r,borderRight:o,borderRightColor:s},...l,children:i.jsxs(u.HStack,{justify:"space-between",children:[t,i.jsx("span",{...d,children:i.jsx(wr,{size:12})})]})})}function Li(){const{columnOrder:e,visibility:t,sortColumn:n,sortDirection:r,sortableColumns:o,actionsConfig:s}=Qe(ie),a=e.map(l=>o.find(d=>d.id===l.id)).filter(l=>l!==void 0).filter(l=>t[l.id]),c=l=>{const{active:d,over:g}=l;if(!g||d.id===g.id)return;const h=e.findIndex(b=>b.id===d.id),x=e.findIndex(b=>b.id===g.id),m=Et(e,h,x);Ci(m)};return i.jsx(u.Table.Header,{background:"blue.200",position:"sticky",top:0,p:"0",children:i.jsx(gr,{collisionDetection:er,onDragEnd:c,children:i.jsx(br,{items:e.map(l=>l.id),strategy:ks,children:i.jsxs(u.Table.Row,{height:"28px",children:[a.map(l=>{const d=n===l?.id;return i.jsx(Ai,{id:l?.id,onClick:()=>l?.sortable&&Ei(l?.id),cursor:l?.sortable?"pointer":"default",borderRight:"2px solid #dcdcdc",backgroundColor:l?.backgroundColor,children:i.jsxs("span",{style:{display:"flex",alignItems:"center",gap:6,userSelect:"none"},children:[l?.label,l?.sortable&&(d?r==="asc"?i.jsx(Qs,{size:14}):i.jsx(qs,{size:14}):i.jsx(Js,{size:14,opacity:.4}))]})},l?.id)}),s?.showActionColumn&&i.jsx(u.Table.ColumnHeader,{width:s.width,backgroundColor:s.backgroundColor,borderRight:"2px solid #dcdcdc",children:s.children}),s?.showColumnVisibilityMenu&&i.jsx(u.Table.ColumnHeader,{boxSize:"0.5",backgroundColor:s.backgroundColorColumnVisibilityMenu,children:i.jsx(Ii,{visibility:t,onToggle:Ri})})]})})})})}const Fn=u.createListCollection({items:[{label:"10",value:"10"},{label:"20",value:"20"},{label:"50",value:"50"},{label:"100",value:"100"}]}),Ni=S(u.Select.Positioner),zi=S(u.Select.Content),Pi=S(u.Select.Item),Yi=S(u.Pagination.PrevTrigger),Fi=S(u.Pagination.NextTrigger),Bi=S(u.Select.HiddenSelect),Hi=S(u.Select.Control),Vi=S(u.Select.Trigger),Wi=S(u.Select.ValueText),Ui=S(u.Select.IndicatorGroup),Gi=S(u.Select.Indicator);function Xi({totalCount:e,pageSize:t,currentPage:n,onPageChange:r,onPageSizeChange:o,siblingCount:s=2}){return i.jsx(u.Box,{width:"100%",children:i.jsxs(u.HStack,{justify:"space-between",mx:"auto",flexWrap:"wrap",children:[i.jsxs(u.HStack,{children:[i.jsx(u.Text,{fontSize:"sm",color:"gray.600",_dark:{color:"gray.400"},children:"Rows per page:"}),i.jsxs(u.Select.Root,{collection:Fn,size:"sm",width:"60px",onValueChange:a=>o&&o(Number(a.items[0].value)),value:[String(t)],children:[i.jsx(Bi,{}),i.jsxs(Hi,{children:[i.jsx(Vi,{children:i.jsx(Wi,{placeholder:""})}),i.jsx(Ui,{children:i.jsx(Gi,{})})]}),i.jsx(u.Portal,{children:i.jsx(Ni,{children:i.jsx(zi,{children:Fn.items.map(a=>i.jsxs(Pi,{item:a.value,children:[a.label,i.jsx(u.Select.ItemIndicator,{})]},a.value))})})})]})]}),i.jsx(u.Pagination.Root,{count:e,pageSize:t,page:n,siblingCount:s,onPageChange:a=>r&&r(a.page),children:i.jsxs(u.ButtonGroup,{size:"sm",variant:"ghost",children:[i.jsx(Yi,{asChild:!0,children:i.jsx(u.IconButton,{"aria-label":"Previous page",children:i.jsx(oi,{size:18})})}),i.jsx(u.Pagination.Items,{render:a=>i.jsx(u.IconButton,{variant:a.type==="page"&&a.value===n?"outline":"ghost","aria-current":a.type==="page"&&a.value===n?"page":void 0,children:a.type==="page"?a.value:"…"},a.value??a.type)}),i.jsx(Fi,{asChild:!0,children:i.jsx(u.IconButton,{"aria-label":"Next page",children:i.jsx(ii,{size:18})})})]})})]})})}const qi=S(u.Menu.Item),Ki=S(u.Menu.Content),Ji=S(u.Menu.Positioner),Zi=S(u.Menu.Trigger);function Qi({data:e=[],actions:t=[]}){const{columnOrder:n,visibility:r}=Qe(ie);return i.jsx(u.Table.Body,{children:e.map(o=>i.jsxs(u.Table.Row,{children:[n.filter(s=>r[s.id]).map(s=>i.jsx(u.Table.Cell,{children:o[s.id]},s.id)),i.jsx(u.Table.Cell,{textAlign:"center",display:"flex",gap:2,children:i.jsxs(u.Menu.Root,{children:[i.jsx(Zi,{asChild:!0,children:i.jsx(u.IconButton,{"aria-label":"Open",variant:"ghost",size:"sm",children:i.jsx(fi,{size:16})})}),i.jsx(u.Portal,{children:i.jsx(Ji,{children:i.jsx(Ki,{children:t.map(s=>i.jsxs(qi,{onClick:()=>s.onClick(o),colorScheme:s.colorScheme,value:s.label,children:[s.icon,s.label]},s.label))})})})]})})]},o.id))})}function ea({tableId:e,data:t=[],headers:n=[],loading:r=!1,emptyMessage:o="No data",actions:s,page:a=1,pageSize:c=10,onPageChange:l,onPageSizeChange:d,density:g="sm",totalCount:h=0,paginationMode:x="client",actionConfig:m}){f.useEffect(()=>{Rr(e)},[e]),f.useEffect(()=>{Cr(t,n)},[t,n]),f.useEffect(()=>{m&&Er(m)},[m]);const{sortColumn:b,sortDirection:p,data:y}=Qe(ie),D=f.useMemo(()=>{const T=[...y],M=Math.max(1,a||1);if(b&&T.sort((_,k)=>p==="asc"?String(_[b]).localeCompare(String(k[b])):String(k[b]).localeCompare(String(_[b]))),x==="client"){const _=(M-1)*c;return T.slice(_,_+c)}return T},[y,b,p,a,c,x]);return f.useEffect(()=>{a<1&&l&&l(1)},[a,l]),i.jsxs(u.Box,{h:"100%",display:"flex",flexDirection:"column",p:2,pt:2,minHeight:0,children:[i.jsx(u.Box,{flex:"1",minHeight:0,overflow:"auto",children:r?i.jsx(u.Box,{display:"flex",alignItems:"center",justifyContent:"center",h:"100%",color:"gray.500",children:"Loading..."}):D.length===0?i.jsx(u.Box,{display:"flex",alignItems:"center",justifyContent:"center",h:"100%",color:"gray.500",children:o}):i.jsxs(u.Table.Root,{variant:"outline",w:"100%",size:g,children:[i.jsx(Li,{}),i.jsx(Qi,{data:D,actions:s})]})}),i.jsx(u.Box,{mt:.5,children:i.jsx(Xi,{totalCount:h,pageSize:c,currentPage:a,onPageChange:l,onPageSizeChange:T=>{d&&d(T),a>1&&l&&l(1)}})})]})}const ta=S(u.Checkbox.Root),na=S(u.Checkbox.HiddenInput),ra=S(u.Checkbox.Control),oa=S(u.Checkbox.Label),Tr=({value:e,onChange:t,size:n="sm",label:r,helperText:o,isDisabled:s,required:a,errorText:c})=>i.jsxs(ta,{value:e,onChange:t,size:n,children:[i.jsx(na,{}),i.jsx(ra,{disabled:s,required:a,errorText:c,helperText:o}),r&&i.jsx(oa,{children:r})]}),J=" to ",Bn=10,Te={DAY_MAX:31,MONTH_MAX:12,YEAR_MIN:1900,YEAR_MAX:2100},sn=()=>{const e=new Date;return{year:e.getFullYear(),month:e.getMonth()+1,day:e.getDate()}},Hn=()=>{const{year:e,month:t,day:n}=sn();return`${String(n).padStart(2,"0")}-${String(t).padStart(2,"0")}-${e}`},sa=()=>{const{year:e,month:t,day:n}=sn();return`${e}-${String(t).padStart(2,"0")}-${String(n).padStart(2,"0")}`},ia=(e,t)=>{const n=e.length,r=parseInt(e);if(!e||isNaN(r))return t;if(n===4)return r>=Te.YEAR_MIN&&r<=Te.YEAR_MAX?r:t;if(n>0&&n<4){const o=t.toString(),s=4-n,a=o.substring(0,s);return parseInt(a+e)}return t},Ve=e=>{if(!e?.trim())return null;const n=e.replace(/[^\d-]/g,"").split("-").filter(d=>d!=="");if(n.length===0)return null;const{year:r,month:o,day:s}=sn();let a,c,l;return n.length===1?(a=parseInt(n[0])||s,c=o,l=r):n.length===2?(a=parseInt(n[0])||s,c=parseInt(n[1])||o,l=r):(a=parseInt(n[0])||s,c=parseInt(n[1])||o,l=ia(n[2],r)),c=Math.max(1,Math.min(Te.MONTH_MAX,c)),a=Math.max(1,Math.min(Te.DAY_MAX,a)),`${l}-${String(c).padStart(2,"0")}-${String(a).padStart(2,"0")}`},ge=e=>{if(!e)return"";const[t,n,r]=e.split("-");return`${r}-${n}-${t}`},aa=(e,t)=>{if(e[0]?.length>0){const n=parseInt(e[0]);if(isNaN(n)||n===0||e[0].length===2&&n>Te.DAY_MAX)return t}if(e[1]?.length>0){const n=parseInt(e[1]);if(isNaN(n)||n===0||e[1].length===2&&n>Te.MONTH_MAX)return t}if(e[2]?.length>0){const n=parseInt(e[2]),r=e[2].length===4;if(isNaN(n)||n===0||r&&(n<Te.YEAR_MIN||n>Te.YEAR_MAX))return t}return null},We=e=>{let t=e.replace(/[^\d-]/g,"").substring(0,Bn);if(t.length>=3&&t[2]!=="-"&&(t=t.substring(0,2)+"-"+t.substring(2).replace(/-/g,"")),t.length>=6&&t[5]!=="-"){const o=t.split("-");o.length>=2&&(t=`${o[0]}-${o[1].substring(0,2)}-${o[1].substring(2)}${o[2]||""}`)}const n=t.split("-");return n[0]=n[0]?.substring(0,2)||"",n[1]=n[1]?.substring(0,2)||"",n[2]=n[2]?.substring(0,4)||"",t=n.filter(o=>o!=="").join("-"),t=t.substring(0,Bn),aa(n,e)||t},ca=S(u.Popover.Root),la=S(u.Popover.Trigger),ua=S(u.Popover.Content),da=S(u.Popover.Positioner);function fa({value:e,onChange:t,disabled:n=!1}){const[r="",o=""]=e?e.split("|"):[],[s,a]=f.useState(()=>r&&o?`${ge(r)}${J}${ge(o)}`:r?ge(r):""),[c,l]=f.useState(!1),d=f.useRef(null);f.useEffect(()=>{const b=p=>{p.ctrlKey&&p.key==="d"&&!p.shiftKey&&!p.metaKey&&(p.preventDefault(),d.current?.focus())};return window.addEventListener("keydown",b),()=>window.removeEventListener("keydown",b)},[]);const g=b=>{let p=b;if(p.includes(J)){const[y,D=""]=p.split(J);p=`${We(y.trim())}${J}${We(D.trim())}`}else if(p.toLowerCase().includes(" to ")){const[y,D=""]=p.split(/\s+to\s+/i);p=`${We(y.trim())} to ${We(D.trim())}`}else p=We(p);a(p)},h=()=>{const b=s.trim();if(!b){t(void 0);return}if(b.includes(J)){const[p,y=""]=b.split(J).map(M=>M.trim()),D=Ve(p),T=y?Ve(y):null;if(D&&T){const[M,_]=T<D?[T,D]:[D,T],k=`${ge(M)}${J}${ge(_)}`;a(k),t(`${M}|${_}`)}else if(D&&!y)a(`${ge(D)}${J}`),t(void 0);else if(D&&y){const M=sa(),[_,k]=M<D?[M,D]:[D,M],O=`${ge(_)}${J}${ge(k)}`;a(O),t(`${_}|${k}`)}else a(""),t(void 0)}else{const p=Ve(b);p?(a(`${ge(p)}${J}`),t(void 0)):(a(""),t(void 0))}},x=b=>{if(b.key!=="Enter")return;b.preventDefault();const p=d.current?.selectionStart||0,y=s.indexOf(J);if(!s.trim()){a(`${Hn()}${J}`);return}if(y===-1){const T=Ve(s.trim());T&&a(`${ge(T)}${J}`);return}if(p<=y+J.length){const T=s.substring(0,y).trim(),M=s.substring(y+J.length),_=Ve(T);_&&a(`${ge(_)}${J}${M}`);return}if(s.substring(y+J.length).trim())h(),d.current?.blur();else{const T=s.substring(0,y+J.length)+Hn();a(T),setTimeout(()=>{h(),d.current?.blur()},0)}},m=()=>{a(""),t(void 0)};return i.jsx(u.InputGroup,{children:i.jsx(i.Fragment,{children:i.jsxs(u.InputElement,{position:"revert",children:[i.jsxs(ca,{open:c,onEscapeKeyDown:()=>{l(!1)},children:[i.jsx(la,{asChild:!0,children:i.jsx(u.IconButton,{size:"sm",variant:"ghost","aria-label":"Date range help",onClick:()=>l(b=>!b),children:i.jsx(Yn,{size:16})})}),i.jsx(u.Portal,{children:i.jsx(da,{children:i.jsxs(ua,{p:4,children:[i.jsx(u.PopoverArrow,{}),i.jsxs(u.VStack,{align:"start",gap:4,children:[i.jsxs(u.HStack,{children:[i.jsx(Yn,{size:16}),i.jsx(u.Text,{fontWeight:"semibold",fontSize:"sm",children:"Date Range Filter"})]}),i.jsxs(u.VStack,{align:"start",gap:1,children:[i.jsx(u.Text,{fontSize:"sm",fontWeight:"medium",children:"Format:"}),i.jsxs(u.Text,{fontSize:"xs",color:"gray.600",children:["DD-MM-YYYY",J,"DD-MM-YYYY"]})]}),i.jsxs(u.VStack,{align:"start",gap:1,children:[i.jsx(u.Text,{fontSize:"sm",fontWeight:"medium",children:"Tips:"}),i.jsx(u.Text,{fontSize:"xs",children:'• "15 to 20" → assumes current month/year'}),i.jsx(u.Text,{fontSize:"xs",children:"• Leave end blank → up to today"}),i.jsx(u.Text,{fontSize:"xs",children:"• Dates auto-swapped if reversed"}),i.jsx(u.Text,{fontSize:"xs",children:"• Press Enter on empty end → fills today"})]}),i.jsxs(u.VStack,{align:"start",gap:1,children:[i.jsx(u.Text,{fontSize:"sm",fontWeight:"medium",children:"Shortcut:"}),i.jsxs(u.HStack,{children:[i.jsx(u.Kbd,{children:"Ctrl"}),i.jsx(u.Text,{children:"+"}),i.jsx(u.Kbd,{children:"D"})]})]})]})]})})})]}),i.jsx(u.Input,{ref:d,placeholder:"15-06-2025 to 20-06-2025",value:s,size:"sm",disabled:n,onChange:b=>g(b.target.value),onBlur:h,onKeyDown:x,pr:s?"10":void 0,w:"100%"}),s&&i.jsx(u.InputElement,{children:i.jsx(u.IconButton,{size:"sm",variant:"ghost","aria-label":"Clear date range",onClick:m,w:"100%"})})]})})})}const ha=S(u.Field.Root),ga=S(u.Field.Label),pa=S(u.Field.HelperText),va=S(u.Field.ErrorText),qt=({icon:e,value:t,onChange:n,placeholder:r,size:o="xs",variant:s="outline",width:a="100%",label:c,helperText:l,isDisabled:d=!1,required:g=!1,errorText:h,visible:x})=>i.jsxs(ha,{width:a,children:[x&&i.jsx(ga,{children:c}),i.jsx(u.InputGroup,{startElement:e,children:i.jsx(u.Input,{value:t,onChange:m=>n?.(m.target.value),placeholder:r,size:o,variant:s,disabled:d,required:g})}),h&&i.jsx(va,{fontSize:"xs",children:h}),l&&i.jsx(pa,{fontSize:"xs",children:l})]}),ma=S(u.Field.Root),ba=S(u.Field.HelperText),xa=S(u.Field.ErrorText),ya=S(u.Select.Root),Sa=S(u.Select.Label),wa=S(u.Select.Control),Da=S(u.Select.Trigger),Ca=S(u.Select.ValueText),Ra=S(u.Select.IndicatorGroup),Ea=S(u.Select.Indicator),Ta=S(u.Select.Content),ja=S(u.Select.Item),Ma=S(u.Select.ItemIndicator),_a=S(u.Select.HiddenSelect),Oa=S(u.Select.Positioner),jr=({options:e=[],label:t,value:n,onChange:r,placeholder:o,size:s="xs",width:a="100%",variant:c="outline",helperText:l,isDisabled:d,required:g,errorText:h,visible:x})=>{const m=u.createListCollection({items:e});return i.jsxs(ma,{disabled:d,required:g,children:[i.jsxs(ya,{collection:m,variant:c,size:s,width:a,value:n?[n]:[],onValueChange:b=>r?.(b.value[0]),children:[i.jsx(_a,{}),x&&i.jsx(Sa,{children:t}),i.jsxs(wa,{children:[i.jsx(Da,{children:i.jsx(Ca,{placeholder:o})}),i.jsx(Ra,{children:i.jsx(Ea,{})})]}),i.jsx(Oa,{children:i.jsx(Ta,{children:m.items.map(b=>i.jsxs(ja,{item:b,children:[b.label,i.jsx(Ma,{})]},b.value))})})]}),l&&i.jsx(ba,{children:l}),h&&i.jsx(xa,{children:h})]})},Mr=e=>`FILTER_PRESETS_${e??"default"}`;function ka(e){try{return JSON.parse(localStorage.getItem(Mr(e))||"[]")}catch{return[]}}const Ze=new Kn({}),Tt=e=>{const t=Ze.state[e];if(t)return t;const n=ka(e);return Ze.setState(r=>({...r,[e]:n})),n},an=(e,t)=>{Ze.setState(n=>({...n,[e]:t})),localStorage.setItem(Mr(e),JSON.stringify(t))},_r=(e,t)=>{const n=Tt(e).filter(r=>r.id!==t);an(e,n)},Or=(e,t)=>{const n=[t,...Tt(e)];an(e,n)},$a=S(u.Checkbox.Root),Ia=S(u.Checkbox.HiddenInput),Aa=S(u.Checkbox.Control),La=S(u.Slider.Root),Na=S(u.Slider.Track),za=S(u.Slider.Range),Pa=S(u.Slider.Thumbs),Ya=S(u.Slider.Control),Fa=({filter:e,onVisibilityChange:t,onSizeChange:n})=>{const{attributes:r,listeners:o,setNodeRef:s,transform:a,transition:c}=yr({id:e.id}),l={transform:Ie.Transform.toString(a),transition:c};return i.jsxs(u.VStack,{ref:s,style:l,align:"stretch",border:"1px solid",borderColor:"gray.200",rounded:"md",p:3,mb:3,bg:"white",children:[i.jsxs(u.HStack,{...r,...o,cursor:"grab",userSelect:"none",gap:2,children:[i.jsx(wr,{size:16}),i.jsx(u.Text,{fontWeight:"bold",fontSize:"sm",children:e.label||e.id})]}),i.jsxs(u.HStack,{justify:"space-between",children:[i.jsx(u.Text,{fontSize:"sm",children:"Visible"}),i.jsxs($a,{checked:e.visible,size:"sm",onCheckedChange:d=>t?.(e.id,!!d.checked),children:[i.jsx(Ia,{}),i.jsx(Aa,{})]})]}),i.jsxs(u.VStack,{align:"stretch",gap:1,children:[i.jsx(u.Text,{fontSize:"sm",children:"Size"}),i.jsx(La,{min:1,max:5,step:.5,value:[e.size??1],onValueChange:d=>n?.(e.id,d.value[0]),children:i.jsxs(Ya,{children:[i.jsx(Na,{children:i.jsx(za,{})}),i.jsx(Pa,{})]})})]})]})},Ba=S(u.Drawer.Root),Ha=S(u.Drawer.Trigger),Va=S(u.Drawer.Backdrop),Wa=S(u.Drawer.Positioner),Ua=S(u.Drawer.Content),Ga=S(u.Drawer.Header),Xa=S(u.Drawer.Title),qa=S(u.Drawer.Body),Ka=S(u.Drawer.Footer),Ja=S(u.Drawer.CloseTrigger),Za=S(u.Tabs.Root),Qa=S(u.Tabs.List),Ft=S(u.Tabs.Trigger),Bt=S(u.Tabs.Content),kr=(e,t)=>{if(e.customComponent)return e.customComponent;switch(e.type){case"text":return i.jsx(qt,{placeholder:e.label,value:e.value,onChange:e.onChange,label:e.label,visible:t});case"number":return i.jsx(qt,{label:e.label,value:e.value,onChange:e.onChange});case"checkbox":return i.jsx(Tr,{label:e.label,value:e.value,onChange:e.onChange});case"select":return i.jsx(jr,{label:e.label,value:e.value,onChange:e.onChange,options:e.options??[],visible:t});case"date":return i.jsx(fa,{value:e.value,onChange:e.onChange});default:return null}},ec=({filterDrawerSize:e="sm",onVisibilityChange:t,onSizeChange:n,onClear:r,filters:o,pageKey:s="default",currentFilters:a={},onLoadPreset:c,activePresetName:l,onReorder:d,open:g,onOpenChange:h})=>{const m=Qe(Ze)[s]??Tt(s),b=()=>{const p=prompt("Preset name?");p&&Or(s,{id:crypto.randomUUID(),name:p,date:new Date().toISOString(),filters:a})};return i.jsx(u.HStack,{wrap:"wrap",children:i.jsxs(Ba,{size:e,open:g,onOpenChange:h,children:[i.jsx(Ha,{asChild:!0,children:i.jsxs(u.IconButton,{"aria-label":"Open filters",variant:"outline",size:"xs",ml:2,p:2,children:[i.jsx(gi,{size:16}),"Filters"]})}),i.jsxs(u.Portal,{children:[i.jsx(Va,{}),i.jsx(Wa,{children:i.jsxs(Ua,{children:[i.jsx(Ga,{children:i.jsx(Xa,{children:"Filters"})}),i.jsx(qa,{overflowY:"auto",pt:1,children:i.jsxs(Za,{defaultValue:"view",children:[i.jsxs(Qa,{mb:4,children:[i.jsxs(Ft,{value:"view",children:[i.jsx(mi,{size:16}),"Edit"]}),i.jsxs(Ft,{value:"settings",children:[i.jsx(Si,{size:16}),"Settings"]}),i.jsxs(Ft,{value:"presets",children:[i.jsx(ti,{size:16}),"Presets"]})]}),i.jsx(Bt,{value:"view",children:o.filter(p=>p.visible).map(p=>i.jsx(u.VStack,{align:"stretch",border:"1px solid",borderColor:"gray.200",flex:p.size??1,minW:`${(p.size??1)*100}px`,rounded:"md",p:3,mb:3,children:kr(p,g)},p.id))}),i.jsx(Bt,{value:"settings",children:i.jsx(gr,{sensors:xo(bo(on)),collisionDetection:er,onDragEnd:({active:p,over:y})=>{if(!y||p.id===y.id)return;const D=o.findIndex(_=>_.id===p.id),T=o.findIndex(_=>_.id===y.id),M=Et(o,D,T);d?.(M)},children:i.jsx(br,{items:o.map(p=>p.id),strategy:Is,children:o.map(p=>i.jsx(Fa,{filter:p,onVisibilityChange:t,onSizeChange:n},p.id))})})}),i.jsx(Bt,{value:"presets",children:i.jsxs(u.VStack,{align:"stretch",mb:3,children:[i.jsx(u.Button,{size:"sm",colorScheme:"blue",onClick:b,children:"Save Current Filters"}),m.length===0&&i.jsx(u.Text,{fontSize:"xs",color:"gray.500",children:"No presets saved yet."}),m.map(p=>i.jsxs(u.HStack,{justify:"space-between",border:"1px solid",borderColor:l===p.name?"blue.300":"gray.200",rounded:"md",p:2,children:[i.jsxs(u.VStack,{align:"start",gap:0,children:[i.jsx(u.Text,{fontWeight:"bold",fontSize:"sm",children:p.name}),i.jsx(u.Text,{fontSize:"xs",color:"gray.500",children:new Date(p.date).toLocaleDateString()})]}),i.jsxs(u.HStack,{children:[i.jsx(u.Button,{size:"xs",variant:"ghost",onClick:()=>c?.(p.filters,p.name),children:"Load"}),i.jsx(u.IconButton,{size:"xs","aria-label":"Delete preset",variant:"ghost",onClick:()=>_r(s,p.id),children:i.jsx(ui,{size:14})})]})]},p.id))]})})]})}),i.jsxs(Ka,{justify:"space-between",children:[i.jsx(u.Button,{size:"sm",variant:"ghost",colorScheme:"red",onClick:()=>r&&r(),children:"Clear All"}),i.jsx(Ja,{asChild:!0,children:i.jsx(u.CloseButton,{})})]})]})})]})]})})},tc=({title:e,filters:t,onVisibilityChange:n,onReorder:r,onSizeChange:o,onClear:s,maxToolbarUnits:a,pageKey:c,currentFilters:l,onLoadPreset:d,activePresetName:g,filterDrawerSize:h="sm"})=>{const[x,m]=f.useState(!1);return i.jsxs(u.HStack,{wrap:"wrap",pl:2,pr:2,width:"100%",justify:"space-between",children:[e,i.jsxs(u.HStack,{gapX:1,children:[t.filter(b=>b.visible!==!1).map(b=>i.jsx(u.HStack,{flex:b.size??1,minW:`${(b.size??1)*100}px`,alignItems:"center",children:kr(b)},b.id)),i.jsx(ec,{filterDrawerSize:h,onVisibilityChange:n,onReorder:r,onSizeChange:o,onClear:s,maxToolbarUnits:a,pageKey:c,filters:t,currentFilters:l,onLoadPreset:d,activePresetName:g,open:x,onOpenChange:b=>{m(b.open)}})]})]})},nc=(e,t)=>{localStorage.setItem(`FILTER_ORDER_${e}`,JSON.stringify(t))},rc=e=>{try{return JSON.parse(localStorage.getItem(`FILTER_ORDER_${e}`)||"[]")}catch{return[]}},oc=({onClick:e,size:t="xs",variant:n="solid",label:r,leftIcon:o,rightIcon:s,isDisabled:a,colorScheme:c,loading:l,loadingText:d,rounded:g,type:h="button"})=>i.jsx(u.Button,{onClick:e,size:t,variant:n,disabled:a,colorPalette:c,loading:l,loadingText:d,rounded:g,type:h,children:i.jsxs(u.HStack,{gap:1,children:[o,r,s]})}),sc=S(u.Dialog.Root),ic=S(u.Dialog.Backdrop),ac=S(u.Dialog.Positioner),cc=S(u.Dialog.Content),lc=S(u.Dialog.Header),uc=S(u.Dialog.Body),dc=S(u.Dialog.Footer),fc=S(u.Dialog.Title),hc=S(u.Dialog.CloseTrigger);function gc({open:e,onClose:t,onConfirm:n,title:r="Delete Company",entityName:o,confirmText:s="DELETE",confirmLabel:a="Delete",isLoading:c=!1}){const[l,d]=f.useState("");return i.jsx(sc,{open:e,placement:"center",onOpenChange:g=>!g.open&&t(),children:i.jsxs(u.Portal,{children:[i.jsx(ic,{}),i.jsx(ac,{children:i.jsxs(cc,{maxW:"520px",children:[i.jsx(lc,{borderBottom:"1px solid",borderColor:"red.200",boxShadow:"sm",children:i.jsx(fc,{color:"red.600",children:r})}),i.jsx(uc,{children:i.jsxs(u.Stack,{gap:4,boxShadow:"lg",border:"1px solid gray.200",borderRadius:"md",p:4,children:[i.jsx(u.Box,{border:"1px solid",borderColor:"red.200",bg:"red.50",borderRadius:"md",p:4,children:i.jsxs(u.Stack,{direction:"row",gap:3,align:"flex-start",children:[i.jsx(u.Box,{color:"red.600",mt:"2px",children:i.jsx(Di,{size:20})}),i.jsxs(u.Box,{children:[i.jsx(u.Text,{fontWeight:"semibold",color:"red.700",children:"Are you sure?"}),i.jsxs(u.Text,{fontSize:"sm",color:"red.600",children:["All the data of ",i.jsx("b",{children:o})," will permanently be deleted."]})]})]})}),i.jsx(u.Text,{fontSize:"sm",color:"gray.600",children:"You can’t undo this action afterwards."}),i.jsxs(u.Box,{children:[i.jsxs(u.Text,{fontSize:"sm",mb:1,children:["Type ",i.jsx("b",{children:s})," to continue"]}),i.jsx(u.Input,{placeholder:`Type ${s} here`,value:l,onChange:g=>d(g.target.value),size:"xs"})]})]})}),i.jsxs(dc,{justifyContent:"flex-end",gap:3,borderTop:"1px solid",borderColor:"red.200",boxShadow:"lg",children:[i.jsx(u.Button,{variant:"outline",size:"sm",onClick:t,children:"Cancel"}),i.jsx(u.Button,{size:"sm",style:{backgroundColor:"#FF0000"},loading:c,onClick:n,children:a})]}),i.jsx(hc,{asChild:!0,children:i.jsx(u.CloseButton,{size:"sm"})})]})})]})})}function $r({refetch:e,isLoading:t=!1,label:n="Refresh"}){const[r,o]=f.useState(!1),s=async()=>{o(!0);try{await e()}finally{setTimeout(()=>o(!1),300)}};return i.jsx(u.IconButton,{"aria-label":n,size:"xs",variant:"outline",disabled:t||r,onClick:s,ml:2,children:i.jsx(xi,{size:14,style:{animation:r?"spin 0.6s linear infinite":void 0}})})}var ht={exports:{}},pc=ht.exports,Vn;function vc(){return Vn||(Vn=1,(function(e,t){(function(n,r){e.exports=r()})(pc,(function(){var n=1e3,r=6e4,o=36e5,s="millisecond",a="second",c="minute",l="hour",d="day",g="week",h="month",x="quarter",m="year",b="date",p="Invalid Date",y=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,D=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,T={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function($){var R=["th","st","nd","rd"],w=$%100;return"["+$+(R[(w-20)%10]||R[w]||R[0])+"]"}},M=function($,R,w){var j=String($);return!j||j.length>=R?$:""+Array(R+1-j.length).join(w)+$},_={s:M,z:function($){var R=-$.utcOffset(),w=Math.abs(R),j=Math.floor(w/60),E=w%60;return(R<=0?"+":"-")+M(j,2,"0")+":"+M(E,2,"0")},m:function $(R,w){if(R.date()<w.date())return-$(w,R);var j=12*(w.year()-R.year())+(w.month()-R.month()),E=R.clone().add(j,h),L=w-E<0,z=R.clone().add(j+(L?-1:1),h);return+(-(j+(w-E)/(L?E-z:z-E))||0)},a:function($){return $<0?Math.ceil($)||0:Math.floor($)},p:function($){return{M:h,y:m,w:g,d,D:b,h:l,m:c,s:a,ms:s,Q:x}[$]||String($||"").toLowerCase().replace(/s$/,"")},u:function($){return $===void 0}},k="en",O={};O[k]=T;var I="$isDayjsObject",P=function($){return $ instanceof K||!(!$||!$[I])},W=function $(R,w,j){var E;if(!R)return k;if(typeof R=="string"){var L=R.toLowerCase();O[L]&&(E=L),w&&(O[L]=w,E=L);var z=R.split("-");if(!E&&z.length>1)return $(z[0])}else{var v=R.name;O[v]=R,E=v}return!j&&E&&(k=E),E||!j&&k},B=function($,R){if(P($))return $.clone();var w=typeof R=="object"?R:{};return w.date=$,w.args=arguments,new K(w)},A=_;A.l=W,A.i=P,A.w=function($,R){return B($,{locale:R.$L,utc:R.$u,x:R.$x,$offset:R.$offset})};var K=(function(){function $(w){this.$L=W(w.locale,null,!0),this.parse(w),this.$x=this.$x||w.x||{},this[I]=!0}var R=$.prototype;return R.parse=function(w){this.$d=(function(j){var E=j.date,L=j.utc;if(E===null)return new Date(NaN);if(A.u(E))return new Date;if(E instanceof Date)return new Date(E);if(typeof E=="string"&&!/Z$/i.test(E)){var z=E.match(y);if(z){var v=z[2]-1||0,C=(z[7]||"0").substring(0,3);return L?new Date(Date.UTC(z[1],v,z[3]||1,z[4]||0,z[5]||0,z[6]||0,C)):new Date(z[1],v,z[3]||1,z[4]||0,z[5]||0,z[6]||0,C)}}return new Date(E)})(w),this.init()},R.init=function(){var w=this.$d;this.$y=w.getFullYear(),this.$M=w.getMonth(),this.$D=w.getDate(),this.$W=w.getDay(),this.$H=w.getHours(),this.$m=w.getMinutes(),this.$s=w.getSeconds(),this.$ms=w.getMilliseconds()},R.$utils=function(){return A},R.isValid=function(){return this.$d.toString()!==p},R.isSame=function(w,j){var E=B(w);return this.startOf(j)<=E&&E<=this.endOf(j)},R.isAfter=function(w,j){return B(w)<this.startOf(j)},R.isBefore=function(w,j){return this.endOf(j)<B(w)},R.$g=function(w,j,E){return A.u(w)?this[j]:this.set(E,w)},R.unix=function(){return Math.floor(this.valueOf()/1e3)},R.valueOf=function(){return this.$d.getTime()},R.startOf=function(w,j){var E=this,L=!!A.u(j)||j,z=A.p(w),v=function(q,Y){var se=A.w(E.$u?Date.UTC(E.$y,Y,q):new Date(E.$y,Y,q),E);return L?se:se.endOf(d)},C=function(q,Y){return A.w(E.toDate()[q].apply(E.toDate("s"),(L?[0,0,0,0]:[23,59,59,999]).slice(Y)),E)},N=this.$W,F=this.$M,U=this.$D,G="set"+(this.$u?"UTC":"");switch(z){case m:return L?v(1,0):v(31,11);case h:return L?v(1,F):v(0,F+1);case g:var H=this.$locale().weekStart||0,X=(N<H?N+7:N)-H;return v(L?U-X:U+(6-X),F);case d:case b:return C(G+"Hours",0);case l:return C(G+"Minutes",1);case c:return C(G+"Seconds",2);case a:return C(G+"Milliseconds",3);default:return this.clone()}},R.endOf=function(w){return this.startOf(w,!1)},R.$set=function(w,j){var E,L=A.p(w),z="set"+(this.$u?"UTC":""),v=(E={},E[d]=z+"Date",E[b]=z+"Date",E[h]=z+"Month",E[m]=z+"FullYear",E[l]=z+"Hours",E[c]=z+"Minutes",E[a]=z+"Seconds",E[s]=z+"Milliseconds",E)[L],C=L===d?this.$D+(j-this.$W):j;if(L===h||L===m){var N=this.clone().set(b,1);N.$d[v](C),N.init(),this.$d=N.set(b,Math.min(this.$D,N.daysInMonth())).$d}else v&&this.$d[v](C);return this.init(),this},R.set=function(w,j){return this.clone().$set(w,j)},R.get=function(w){return this[A.p(w)]()},R.add=function(w,j){var E,L=this;w=Number(w);var z=A.p(j),v=function(F){var U=B(L);return A.w(U.date(U.date()+Math.round(F*w)),L)};if(z===h)return this.set(h,this.$M+w);if(z===m)return this.set(m,this.$y+w);if(z===d)return v(1);if(z===g)return v(7);var C=(E={},E[c]=r,E[l]=o,E[a]=n,E)[z]||1,N=this.$d.getTime()+w*C;return A.w(N,this)},R.subtract=function(w,j){return this.add(-1*w,j)},R.format=function(w){var j=this,E=this.$locale();if(!this.isValid())return E.invalidDate||p;var L=w||"YYYY-MM-DDTHH:mm:ssZ",z=A.z(this),v=this.$H,C=this.$m,N=this.$M,F=E.weekdays,U=E.months,G=E.meridiem,H=function(Y,se,ne,he){return Y&&(Y[se]||Y(j,L))||ne[se].slice(0,he)},X=function(Y){return A.s(v%12||12,Y,"0")},q=G||function(Y,se,ne){var he=Y<12?"AM":"PM";return ne?he.toLowerCase():he};return L.replace(D,(function(Y,se){return se||(function(ne){switch(ne){case"YY":return String(j.$y).slice(-2);case"YYYY":return A.s(j.$y,4,"0");case"M":return N+1;case"MM":return A.s(N+1,2,"0");case"MMM":return H(E.monthsShort,N,U,3);case"MMMM":return H(U,N);case"D":return j.$D;case"DD":return A.s(j.$D,2,"0");case"d":return String(j.$W);case"dd":return H(E.weekdaysMin,j.$W,F,2);case"ddd":return H(E.weekdaysShort,j.$W,F,3);case"dddd":return F[j.$W];case"H":return String(v);case"HH":return A.s(v,2,"0");case"h":return X(1);case"hh":return X(2);case"a":return q(v,C,!0);case"A":return q(v,C,!1);case"m":return String(C);case"mm":return A.s(C,2,"0");case"s":return String(j.$s);case"ss":return A.s(j.$s,2,"0");case"SSS":return A.s(j.$ms,3,"0");case"Z":return z}return null})(Y)||z.replace(":","")}))},R.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},R.diff=function(w,j,E){var L,z=this,v=A.p(j),C=B(w),N=(C.utcOffset()-this.utcOffset())*r,F=this-C,U=function(){return A.m(z,C)};switch(v){case m:L=U()/12;break;case h:L=U();break;case x:L=U()/3;break;case g:L=(F-N)/6048e5;break;case d:L=(F-N)/864e5;break;case l:L=F/o;break;case c:L=F/r;break;case a:L=F/n;break;default:L=F}return E?L:A.a(L)},R.daysInMonth=function(){return this.endOf(h).$D},R.$locale=function(){return O[this.$L]},R.locale=function(w,j){if(!w)return this.$L;var E=this.clone(),L=W(w,j,!0);return L&&(E.$L=L),E},R.clone=function(){return A.w(this.$d,this)},R.toDate=function(){return new Date(this.valueOf())},R.toJSON=function(){return this.isValid()?this.toISOString():null},R.toISOString=function(){return this.$d.toISOString()},R.toString=function(){return this.$d.toUTCString()},$})(),ee=K.prototype;return B.prototype=ee,[["$ms",s],["$s",a],["$m",c],["$H",l],["$W",d],["$M",h],["$y",m],["$D",b]].forEach((function($){ee[$[1]]=function(R){return this.$g(R,$[0],$[1])}})),B.extend=function($,R){return $.$i||($(R,K,B),$.$i=!0),B},B.locale=W,B.isDayjs=P,B.unix=function($){return B(1e3*$)},B.en=O[k],B.Ls=O,B.p={},B}))})(ht)),ht.exports}var mc=vc();const jt=wt(mc);var gt={exports:{}},bc=gt.exports,Wn;function xc(){return Wn||(Wn=1,(function(e,t){(function(n,r){e.exports=r()})(bc,(function(){return function(n,r,o){n=n||{};var s=r.prototype,a={future:"in %s",past:"%s ago",s:"a few seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"};function c(d,g,h,x){return s.fromToBase(d,g,h,x)}o.en.relativeTime=a,s.fromToBase=function(d,g,h,x,m){for(var b,p,y,D=h.$locale().relativeTime||a,T=n.thresholds||[{l:"s",r:44,d:"second"},{l:"m",r:89},{l:"mm",r:44,d:"minute"},{l:"h",r:89},{l:"hh",r:21,d:"hour"},{l:"d",r:35},{l:"dd",r:25,d:"day"},{l:"M",r:45},{l:"MM",r:10,d:"month"},{l:"y",r:17},{l:"yy",d:"year"}],M=T.length,_=0;_<M;_+=1){var k=T[_];k.d&&(b=x?o(d).diff(h,k.d,!0):h.diff(d,k.d,!0));var O=(n.rounding||Math.round)(Math.abs(b));if(y=b>0,O<=k.r||!k.r){O<=1&&_>0&&(k=T[_-1]);var I=D[k.l];m&&(O=m(""+O)),p=typeof I=="string"?I.replace("%d",O):I(O,g,k.l,y);break}}if(g)return p;var P=y?D.future:D.past;return typeof P=="function"?P(p):P.replace("%s",p)},s.to=function(d,g){return c(d,g,this,!0)},s.from=function(d,g){return c(d,g,this)};var l=function(d){return d.$u?o.utc():o()};s.toNow=function(d){return this.to(l(this),d)},s.fromNow=function(d){return this.from(l(this),d)}}}))})(gt)),gt.exports}var yc=xc();const Sc=wt(yc);var pt={exports:{}},wc=pt.exports,Un;function Dc(){return Un||(Un=1,(function(e,t){(function(n,r){e.exports=r()})(wc,(function(){var n={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"};return function(r,o,s){var a=o.prototype,c=a.format;s.en.formats=n,a.format=function(l){l===void 0&&(l="YYYY-MM-DDTHH:mm:ssZ");var d=this.$locale().formats,g=(function(h,x){return h.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,(function(m,b,p){var y=p&&p.toUpperCase();return b||x[p]||n[p]||x[y].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,(function(D,T,M){return T||M.slice(1)}))}))})(l,d===void 0?{}:d);return c.call(this,g)}}}))})(pt)),pt.exports}var Cc=Dc();const Rc=wt(Cc);var vt={exports:{}},Ec=vt.exports,Gn;function Tc(){return Gn||(Gn=1,(function(e,t){(function(n,r){e.exports=r()})(Ec,(function(){return function(n,r){var o=r.prototype,s=o.format;o.format=function(a){var c=this,l=this.$locale();if(!this.isValid())return s.bind(this)(a);var d=this.$utils(),g=(a||"YYYY-MM-DDTHH:mm:ssZ").replace(/\[([^\]]+)]|Q|wo|ww|w|WW|W|zzz|z|gggg|GGGG|Do|X|x|k{1,2}|S/g,(function(h){switch(h){case"Q":return Math.ceil((c.$M+1)/3);case"Do":return l.ordinal(c.$D);case"gggg":return c.weekYear();case"GGGG":return c.isoWeekYear();case"wo":return l.ordinal(c.week(),"W");case"w":case"ww":return d.s(c.week(),h==="w"?1:2,"0");case"W":case"WW":return d.s(c.isoWeek(),h==="W"?1:2,"0");case"k":case"kk":return d.s(String(c.$H===0?24:c.$H),h==="k"?1:2,"0");case"X":return Math.floor(c.$d.getTime()/1e3);case"x":return c.$d.getTime();case"z":return"["+c.offsetName()+"]";case"zzz":return"["+c.offsetName("long")+"]";default:return h}}));return s.bind(this)(g)}}}))})(vt)),vt.exports}var jc=Tc();const Mc=wt(jc);jt.extend(Sc);jt.extend(Rc);jt.extend(Mc);const _c={date:"DD MMM YYYY",time:"hh:mm A",dateTime:"DD MMM YYYY, hh:mm A",full:"dddd, DD MMM YYYY, hh:mm A",short:"DD/MM/YY",relative:""};function Kt({value:e,variant:t="dateTime",format:n,fallback:r="--"}){if(!e)return r;const o=jt(e);return o.isValid()?t==="relative"?o.fromNow():o.format(n??_c[t]):r}function Oc({value:e,dateVariant:t="date",timeVariant:n="time",dateFormat:r,timeFormat:o,align:s="start"}){return i.jsxs(u.Stack,{gap:.5,align:s,children:[i.jsx(u.Text,{fontSize:"sm",fontWeight:"500",children:Kt({value:e,variant:t,format:r})}),i.jsx(u.Text,{fontSize:"xs",color:"gray.500",children:Kt({value:e,variant:n,format:o})})]})}exports.DataTable=ea;exports.Filters=tc;exports.MDSButton=oc;exports.MDSCheckbox=Tr;exports.MDSConfirmDeleteDialog=gc;exports.MDSInput=qt;exports.MDSRefreshButton=$r;exports.MDSSelectBox=jr;exports.RefreshButton=$r;exports.StackedDateTime=Oc;exports.addPreset=Or;exports.deletePreset=_r;exports.formatDateTime=Kt;exports.getPresets=Tt;exports.loadOrder=rc;exports.presetStore=Ze;exports.saveOrder=nc;exports.savePresets=an;exports.setActionsConfig=Er;exports.setData=Cr;exports.setTableId=Rr;exports.tableStore=ie;exports.withChildren=S;
10
+ `},vo={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 mo(e){let{announcements:t=vo,container:n,hiddenTextDescribedById:r,screenReaderInstructions:o=po}=e;const{announce:s,announcement:a}=fo(),c=nt("DndLiveRegion"),[l,d]=f.useState(!1);if(f.useEffect(()=>{d(!0)},[]),ho(f.useMemo(()=>({onDragStart(h){let{active:x}=h;s(t.onDragStart({active:x}))},onDragMove(h){let{active:x,over:m}=h;t.onDragMove&&s(t.onDragMove({active:x,over:m}))},onDragOver(h){let{active:x,over:m}=h;s(t.onDragOver({active:x,over:m}))},onDragEnd(h){let{active:x,over:m}=h;s(t.onDragEnd({active:x,over:m}))},onDragCancel(h){let{active:x,over:m}=h;s(t.onDragCancel({active:x,over:m}))}}),[s,t])),!l)return null;const g=f.createElement(f.Fragment,null,f.createElement(lo,{id:r,value:o.draggable}),f.createElement(uo,{id:c,announcement:a}));return n?Ue.createPortal(g,n):g}var Z;(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"})(Z||(Z={}));function yt(){}function bo(e,t){return f.useMemo(()=>({sensor:e,options:{}}),[e,t])}function xo(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return f.useMemo(()=>[...t].filter(r=>r!=null),[...t])}const pe=Object.freeze({x:0,y:0});function yo(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function So(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function wo(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function Do(e,t){if(!e||e.length===0)return null;const[n]=e;return n[t]}function jn(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 er=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=jn(t,t.left,t.top),s=[];for(const a of r){const{id:c}=a,l=n.get(c);if(l){const d=yo(jn(l),o);s.push({id:c,data:{droppableContainer:a,value:d}})}}return s.sort(So)};function Co(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),s=Math.min(t.top+t.height,e.top+e.height),a=o-r,c=s-n;if(r<o&&n<s){const l=t.width*t.height,d=e.width*e.height,g=a*c,h=g/(l+d-g);return Number(h.toFixed(4))}return 0}const Ro=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=[];for(const s of r){const{id:a}=s,c=n.get(a);if(c){const l=Co(c,t);l>0&&o.push({id:a,data:{droppableContainer:s,value:l}})}}return o.sort(wo)};function Eo(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function tr(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:pe}function To(e){return function(n){for(var r=arguments.length,o=new Array(r>1?r-1:0),s=1;s<r;s++)o[s-1]=arguments[s];return o.reduce((a,c)=>({...a,top:a.top+e*c.y,bottom:a.bottom+e*c.y,left:a.left+e*c.x,right:a.right+e*c.x}),{...n})}}const jo=To(1);function Mo(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 _o(e,t,n){const r=Mo(t);if(!r)return e;const{scaleX:o,scaleY:s,x:a,y:c}=r,l=e.left-a-(1-o)*parseFloat(n),d=e.top-c-(1-s)*parseFloat(n.slice(n.indexOf(" ")+1)),g=o?e.width/o:e.width,h=s?e.height/s:e.height;return{width:g,height:h,top:d,right:l+g,bottom:d+h,left:l}}const Oo={ignoreTransform:!1};function Ne(e,t){t===void 0&&(t=Oo);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:d,transformOrigin:g}=ae(e).getComputedStyle(e);d&&(n=_o(n,d,g))}const{top:r,left:o,width:s,height:a,bottom:c,right:l}=n;return{top:r,left:o,width:s,height:a,bottom:c,right:l}}function Mn(e){return Ne(e,{ignoreTransform:!0})}function ko(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function $o(e,t){return t===void 0&&(t=ae(e).getComputedStyle(e)),t.position==="fixed"}function Io(e,t){t===void 0&&(t=ae(e).getComputedStyle(e));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(o=>{const s=t[o];return typeof s=="string"?n.test(s):!1})}function tn(e,t){const n=[];function r(o){if(t!=null&&n.length>=t||!o)return n;if(Zt(o)&&o.scrollingElement!=null&&!n.includes(o.scrollingElement))return n.push(o.scrollingElement),n;if(!et(o)||Jn(o)||n.includes(o))return n;const s=ae(e).getComputedStyle(o);return o!==e&&Io(o,s)&&n.push(o),$o(o,s)?n:r(o.parentNode)}return e?r(e):n}function nr(e){const[t]=tn(e,1);return t??null}function zt(e){return!Dt||!e?null:Ae(e)?e:Jt(e)?Zt(e)||e===Le(e).scrollingElement?window:et(e)?e:null:null}function rr(e){return Ae(e)?e.scrollX:e.scrollLeft}function or(e){return Ae(e)?e.scrollY:e.scrollTop}function Ut(e){return{x:rr(e),y:or(e)}}var Q;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(Q||(Q={}));function sr(e){return!Dt||!e?!1:e===document.scrollingElement}function ir(e){const t={x:0,y:0},n=sr(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height},o=e.scrollTop<=t.y,s=e.scrollLeft<=t.x,a=e.scrollTop>=r.y,c=e.scrollLeft>=r.x;return{isTop:o,isLeft:s,isBottom:a,isRight:c,maxScroll:r,minScroll:t}}const Ao={x:.2,y:.2};function Lo(e,t,n,r,o){let{top:s,left:a,right:c,bottom:l}=n;r===void 0&&(r=10),o===void 0&&(o=Ao);const{isTop:d,isBottom:g,isLeft:h,isRight:x}=ir(e),m={x:0,y:0},b={x:0,y:0},p={height:t.height*o.y,width:t.width*o.x};return!d&&s<=t.top+p.height?(m.y=Q.Backward,b.y=r*Math.abs((t.top+p.height-s)/p.height)):!g&&l>=t.bottom-p.height&&(m.y=Q.Forward,b.y=r*Math.abs((t.bottom-p.height-l)/p.height)),!x&&c>=t.right-p.width?(m.x=Q.Forward,b.x=r*Math.abs((t.right-p.width-c)/p.width)):!h&&a<=t.left+p.width&&(m.x=Q.Backward,b.x=r*Math.abs((t.left+p.width-a)/p.width)),{direction:m,speed:b}}function No(e){if(e===document.scrollingElement){const{innerWidth:s,innerHeight:a}=window;return{top:0,left:0,right:s,bottom:a,width:s,height:a}}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 ar(e){return e.reduce((t,n)=>$e(t,Ut(n)),pe)}function zo(e){return e.reduce((t,n)=>t+rr(n),0)}function Po(e){return e.reduce((t,n)=>t+or(n),0)}function Yo(e,t){if(t===void 0&&(t=Ne),!e)return;const{top:n,left:r,bottom:o,right:s}=t(e);nr(e)&&(o<=0||s<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const Fo=[["x",["left","right"],zo],["y",["top","bottom"],Po]];class nn{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 r=tn(n),o=ar(r);this.rect={...t},this.width=t.width,this.height=t.height;for(const[s,a,c]of Fo)for(const l of a)Object.defineProperty(this,l,{get:()=>{const d=c(r),g=o[s]-d;return this.rect[l]+g},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class Ge{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var r;return(r=this.target)==null?void 0:r.removeEventListener(...n)})},this.target=t}add(t,n,r){var o;(o=this.target)==null||o.addEventListener(t,n,r),this.listeners.push([t,n,r])}}function Bo(e){const{EventTarget:t}=ae(e);return e instanceof t?e:Le(e)}function Pt(e,t){const n=Math.abs(e.x),r=Math.abs(e.y);return typeof t=="number"?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:!1}var fe;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(fe||(fe={}));function _n(e){e.preventDefault()}function Ho(e){e.stopPropagation()}var V;(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"})(V||(V={}));const cr={start:[V.Space,V.Enter],cancel:[V.Esc],end:[V.Space,V.Enter,V.Tab]},Vo=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case V.Right:return{...n,x:n.x+25};case V.Left:return{...n,x:n.x-25};case V.Down:return{...n,y:n.y+25};case V.Up:return{...n,y:n.y-25}}};class lr{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 Ge(Le(n)),this.windowListeners=new Ge(ae(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(fe.Resize,this.handleCancel),this.windowListeners.add(fe.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(fe.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props,r=t.node.current;r&&Yo(r),n(pe)}handleKeyDown(t){if(en(t)){const{active:n,context:r,options:o}=this.props,{keyboardCodes:s=cr,coordinateGetter:a=Vo,scrollBehavior:c="smooth"}=o,{code:l}=t;if(s.end.includes(l)){this.handleEnd(t);return}if(s.cancel.includes(l)){this.handleCancel(t);return}const{collisionRect:d}=r.current,g=d?{x:d.left,y:d.top}:pe;this.referenceCoordinates||(this.referenceCoordinates=g);const h=a(t,{active:n,context:r.current,currentCoordinates:g});if(h){const x=xt(h,g),m={x:0,y:0},{scrollableAncestors:b}=r.current;for(const p of b){const y=t.code,{isTop:D,isRight:T,isLeft:M,isBottom:_,maxScroll:k,minScroll:O}=ir(p),I=No(p),P={x:Math.min(y===V.Right?I.right-I.width/2:I.right,Math.max(y===V.Right?I.left:I.left+I.width/2,h.x)),y:Math.min(y===V.Down?I.bottom-I.height/2:I.bottom,Math.max(y===V.Down?I.top:I.top+I.height/2,h.y))},W=y===V.Right&&!T||y===V.Left&&!M,B=y===V.Down&&!_||y===V.Up&&!D;if(W&&P.x!==h.x){const A=p.scrollLeft+x.x,K=y===V.Right&&A<=k.x||y===V.Left&&A>=O.x;if(K&&!x.y){p.scrollTo({left:A,behavior:c});return}K?m.x=p.scrollLeft-A:m.x=y===V.Right?p.scrollLeft-k.x:p.scrollLeft-O.x,m.x&&p.scrollBy({left:-m.x,behavior:c});break}else if(B&&P.y!==h.y){const A=p.scrollTop+x.y,K=y===V.Down&&A<=k.y||y===V.Up&&A>=O.y;if(K&&!x.x){p.scrollTo({top:A,behavior:c});return}K?m.y=p.scrollTop-A:m.y=y===V.Down?p.scrollTop-k.y:p.scrollTop-O.y,m.y&&p.scrollBy({top:-m.y,behavior:c});break}}this.handleMove(t,$e(xt(h,this.referenceCoordinates),m))}}}handleMove(t,n){const{onMove:r}=this.props;t.preventDefault(),r(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()}}lr.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:r=cr,onActivation:o}=t,{active:s}=n;const{code:a}=e.nativeEvent;if(r.start.includes(a)){const c=s.activatorNode.current;return c&&e.target!==c?!1:(e.preventDefault(),o?.({event:e.nativeEvent}),!0)}return!1}}];function On(e){return!!(e&&"distance"in e)}function kn(e){return!!(e&&"delay"in e)}class rn{constructor(t,n,r){var o;r===void 0&&(r=Bo(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:s}=t,{target:a}=s;this.props=t,this.events=n,this.document=Le(a),this.documentListeners=new Ge(this.document),this.listeners=new Ge(r),this.windowListeners=new Ge(ae(a)),this.initialCoordinates=(o=Wt(s))!=null?o:pe,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:r}}}=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(fe.Resize,this.handleCancel),this.windowListeners.add(fe.DragStart,_n),this.windowListeners.add(fe.VisibilityChange,this.handleCancel),this.windowListeners.add(fe.ContextMenu,_n),this.documentListeners.add(fe.Keydown,this.handleKeydown),n){if(r!=null&&r({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(kn(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(On(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:r,onPending:o}=this.props;o(r,t,this.initialCoordinates,n)}handleStart(){const{initialCoordinates:t}=this,{onStart:n}=this.props;t&&(this.activated=!0,this.documentListeners.add(fe.Click,Ho,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(fe.SelectionChange,this.removeTextSelection),n(t))}handleMove(t){var n;const{activated:r,initialCoordinates:o,props:s}=this,{onMove:a,options:{activationConstraint:c}}=s;if(!o)return;const l=(n=Wt(t))!=null?n:pe,d=xt(o,l);if(!r&&c){if(On(c)){if(c.tolerance!=null&&Pt(d,c.tolerance))return this.handleCancel();if(Pt(d,c.distance))return this.handleStart()}if(kn(c)&&Pt(d,c.tolerance))return this.handleCancel();this.handlePending(c,d);return}t.cancelable&&t.preventDefault(),a(l)}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===V.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const Wo={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class on extends rn{constructor(t){const{event:n}=t,r=Le(n.target);super(t,Wo,r)}}on.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!n.isPrimary||n.button!==0?!1:(r?.({event:n}),!0)}}];const Uo={move:{name:"mousemove"},end:{name:"mouseup"}};var Gt;(function(e){e[e.RightClick=2]="RightClick"})(Gt||(Gt={}));class Go extends rn{constructor(t){super(t,Uo,Le(t.event.target))}}Go.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===Gt.RightClick?!1:(r?.({event:n}),!0)}}];const Yt={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class Xo extends rn{constructor(t){super(t,Yt)}static setup(){return window.addEventListener(Yt.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(Yt.move.name,t)};function t(){}}}Xo.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;const{touches:o}=n;return o.length>1?!1:(r?.({event:n}),!0)}}];var Xe;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(Xe||(Xe={}));var St;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(St||(St={}));function qo(e){let{acceleration:t,activator:n=Xe.Pointer,canScroll:r,draggingRect:o,enabled:s,interval:a=5,order:c=St.TreeOrder,pointerCoordinates:l,scrollableAncestors:d,scrollableAncestorRects:g,delta:h,threshold:x}=e;const m=Jo({delta:h,disabled:!s}),[b,p]=oo(),y=f.useRef({x:0,y:0}),D=f.useRef({x:0,y:0}),T=f.useMemo(()=>{switch(n){case Xe.Pointer:return l?{top:l.y,bottom:l.y,left:l.x,right:l.x}:null;case Xe.DraggableRect:return o}},[n,o,l]),M=f.useRef(null),_=f.useCallback(()=>{const O=M.current;if(!O)return;const I=y.current.x*D.current.x,P=y.current.y*D.current.y;O.scrollBy(I,P)},[]),k=f.useMemo(()=>c===St.TreeOrder?[...d].reverse():d,[c,d]);f.useEffect(()=>{if(!s||!d.length||!T){p();return}for(const O of k){if(r?.(O)===!1)continue;const I=d.indexOf(O),P=g[I];if(!P)continue;const{direction:W,speed:B}=Lo(O,P,T,t,x);for(const A of["x","y"])m[A][W[A]]||(B[A]=0,W[A]=0);if(B.x>0||B.y>0){p(),M.current=O,b(_,a),y.current=B,D.current=W;return}}y.current={x:0,y:0},D.current={x:0,y:0},p()},[t,_,r,p,s,a,JSON.stringify(T),JSON.stringify(m),b,d,k,g,JSON.stringify(x)])}const Ko={x:{[Q.Backward]:!1,[Q.Forward]:!1},y:{[Q.Backward]:!1,[Q.Forward]:!1}};function Jo(e){let{delta:t,disabled:n}=e;const r=Vt(t);return tt(o=>{if(n||!r||!o)return Ko;const s={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[Q.Backward]:o.x[Q.Backward]||s.x===-1,[Q.Forward]:o.x[Q.Forward]||s.x===1},y:{[Q.Backward]:o.y[Q.Backward]||s.y===-1,[Q.Forward]:o.y[Q.Forward]||s.y===1}}},[n,t,r])}function Zo(e,t){const n=t!=null?e.get(t):void 0,r=n?n.node.current:null;return tt(o=>{var s;return t==null?null:(s=r??o)!=null?s:null},[r,t])}function Qo(e,t){return f.useMemo(()=>e.reduce((n,r)=>{const{sensor:o}=r,s=o.activators.map(a=>({eventName:a.eventName,handler:t(a.handler,r)}));return[...n,...s]},[]),[e,t])}var Je;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(Je||(Je={}));var Xt;(function(e){e.Optimized="optimized"})(Xt||(Xt={}));const $n=new Map;function es(e,t){let{dragging:n,dependencies:r,config:o}=t;const[s,a]=f.useState(null),{frequency:c,measure:l,strategy:d}=o,g=f.useRef(e),h=y(),x=Ke(h),m=f.useCallback(function(D){D===void 0&&(D=[]),!x.current&&a(T=>T===null?D:T.concat(D.filter(M=>!T.includes(M))))},[x]),b=f.useRef(null),p=tt(D=>{if(h&&!n)return $n;if(!D||D===$n||g.current!==e||s!=null){const T=new Map;for(let M of e){if(!M)continue;if(s&&s.length>0&&!s.includes(M.id)&&M.rect.current){T.set(M.id,M.rect.current);continue}const _=M.node.current,k=_?new nn(l(_),_):null;M.rect.current=k,k&&T.set(M.id,k)}return T}return D},[e,s,n,h,l]);return f.useEffect(()=>{g.current=e},[e]),f.useEffect(()=>{h||m()},[n,h]),f.useEffect(()=>{s&&s.length>0&&a(null)},[JSON.stringify(s)]),f.useEffect(()=>{h||typeof c!="number"||b.current!==null||(b.current=setTimeout(()=>{m(),b.current=null},c))},[c,h,m,...r]),{droppableRects:p,measureDroppableContainers:m,measuringScheduled:s!=null};function y(){switch(d){case Je.Always:return!1;case Je.BeforeDragging:return n;default:return!n}}}function ur(e,t){return tt(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function ts(e,t){return ur(e,t)}function ns(e){let{callback:t,disabled:n}=e;const r=Qt(t),o=f.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:s}=window;return new s(r)},[r,n]);return f.useEffect(()=>()=>o?.disconnect(),[o]),o}function Ct(e){let{callback:t,disabled:n}=e;const r=Qt(t),o=f.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:s}=window;return new s(r)},[n]);return f.useEffect(()=>()=>o?.disconnect(),[o]),o}function rs(e){return new nn(Ne(e),e)}function In(e,t,n){t===void 0&&(t=rs);const[r,o]=f.useState(null);function s(){o(l=>{if(!e)return null;if(e.isConnected===!1){var d;return(d=l??n)!=null?d:null}const g=t(e);return JSON.stringify(l)===JSON.stringify(g)?l:g})}const a=ns({callback(l){if(e)for(const d of l){const{type:g,target:h}=d;if(g==="childList"&&h instanceof HTMLElement&&h.contains(e)){s();break}}}}),c=Ct({callback:s});return be(()=>{s(),e?(c?.observe(e),a?.observe(document.body,{childList:!0,subtree:!0})):(c?.disconnect(),a?.disconnect())},[e]),r}function os(e){const t=ur(e);return tr(e,t)}const An=[];function ss(e){const t=f.useRef(e),n=tt(r=>e?r&&r!==An&&e&&t.current&&e.parentNode===t.current.parentNode?r:tn(e):An,[e]);return f.useEffect(()=>{t.current=e},[e]),n}function is(e){const[t,n]=f.useState(null),r=f.useRef(e),o=f.useCallback(s=>{const a=zt(s.target);a&&n(c=>c?(c.set(a,Ut(a)),new Map(c)):null)},[]);return f.useEffect(()=>{const s=r.current;if(e!==s){a(s);const c=e.map(l=>{const d=zt(l);return d?(d.addEventListener("scroll",o,{passive:!0}),[d,Ut(d)]):null}).filter(l=>l!=null);n(c.length?new Map(c):null),r.current=e}return()=>{a(e),a(s)};function a(c){c.forEach(l=>{const d=zt(l);d?.removeEventListener("scroll",o)})}},[o,e]),f.useMemo(()=>e.length?t?Array.from(t.values()).reduce((s,a)=>$e(s,a),pe):ar(e):pe,[e,t])}function Ln(e,t){t===void 0&&(t=[]);const n=f.useRef(null);return f.useEffect(()=>{n.current=null},t),f.useEffect(()=>{const r=e!==pe;r&&!n.current&&(n.current=e),!r&&n.current&&(n.current=null)},[e]),n.current?xt(e,n.current):pe}function as(e){f.useEffect(()=>{if(!Dt)return;const t=e.map(n=>{let{sensor:r}=n;return r.setup==null?void 0:r.setup()});return()=>{for(const n of t)n?.()}},e.map(t=>{let{sensor:n}=t;return n}))}function cs(e,t){return f.useMemo(()=>e.reduce((n,r)=>{let{eventName:o,handler:s}=r;return n[o]=a=>{s(a,t)},n},{}),[e,t])}function dr(e){return f.useMemo(()=>e?ko(e):null,[e])}const Nn=[];function ls(e,t){t===void 0&&(t=Ne);const[n]=e,r=dr(n?ae(n):null),[o,s]=f.useState(Nn);function a(){s(()=>e.length?e.map(l=>sr(l)?r:new nn(t(l),l)):Nn)}const c=Ct({callback:a});return be(()=>{c?.disconnect(),a(),e.forEach(l=>c?.observe(l))},[e]),o}function us(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return et(t)?t:e}function ds(e){let{measure:t}=e;const[n,r]=f.useState(null),o=f.useCallback(d=>{for(const{target:g}of d)if(et(g)){r(h=>{const x=t(g);return h?{...h,width:x.width,height:x.height}:x});break}},[t]),s=Ct({callback:o}),a=f.useCallback(d=>{const g=us(d);s?.disconnect(),g&&s?.observe(g),r(g?t(g):null)},[t,s]),[c,l]=bt(a);return f.useMemo(()=>({nodeRef:c,rect:n,setRef:l}),[n,c,l])}const fs=[{sensor:on,options:{}},{sensor:lr,options:{}}],hs={current:{}},ft={draggable:{measure:Mn},droppable:{measure:Mn,strategy:Je.WhileDragging,frequency:Xt.Optimized},dragOverlay:{measure:Ne}};class qe 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,r;return(n=(r=this.get(t))==null?void 0:r.node.current)!=null?n:void 0}}const gs={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new qe,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:yt},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:ft,measureDroppableContainers:yt,windowRect:null,measuringScheduled:!1},ps={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:yt,draggableNodes:new Map,over:null,measureDroppableContainers:yt},Rt=f.createContext(ps),fr=f.createContext(gs);function vs(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new qe}}}function ms(e,t){switch(t.type){case Z.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case Z.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 Z.DragEnd:case Z.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case Z.RegisterDroppable:{const{element:n}=t,{id:r}=n,o=new qe(e.droppable.containers);return o.set(r,n),{...e,droppable:{...e.droppable,containers:o}}}case Z.SetDroppableDisabled:{const{id:n,key:r,disabled:o}=t,s=e.droppable.containers.get(n);if(!s||r!==s.key)return e;const a=new qe(e.droppable.containers);return a.set(n,{...s,disabled:o}),{...e,droppable:{...e.droppable,containers:a}}}case Z.UnregisterDroppable:{const{id:n,key:r}=t,o=e.droppable.containers.get(n);if(!o||r!==o.key)return e;const s=new qe(e.droppable.containers);return s.delete(n),{...e,droppable:{...e.droppable,containers:s}}}default:return e}}function bs(e){let{disabled:t}=e;const{active:n,activatorEvent:r,draggableNodes:o}=f.useContext(Rt),s=Vt(r),a=Vt(n?.id);return f.useEffect(()=>{if(!t&&!r&&s&&a!=null){if(!en(s)||document.activeElement===s.target)return;const c=o.get(a);if(!c)return;const{activatorNode:l,node:d}=c;if(!l.current&&!d.current)return;requestAnimationFrame(()=>{for(const g of[l.current,d.current]){if(!g)continue;const h=ao(g);if(h){h.focus();break}}})}},[r,t,o,a,s]),null}function xs(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((o,s)=>s({transform:o,...r}),n):n}function ys(e){return f.useMemo(()=>({draggable:{...ft.draggable,...e?.draggable},droppable:{...ft.droppable,...e?.droppable},dragOverlay:{...ft.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function Ss(e){let{activeNode:t,measure:n,initialRect:r,config:o=!0}=e;const s=f.useRef(!1),{x:a,y:c}=typeof o=="boolean"?{x:o,y:o}:o;be(()=>{if(!a&&!c||!t){s.current=!1;return}if(s.current||!r)return;const d=t?.node.current;if(!d||d.isConnected===!1)return;const g=n(d),h=tr(g,r);if(a||(h.x=0),c||(h.y=0),s.current=!0,Math.abs(h.x)>0||Math.abs(h.y)>0){const x=nr(d);x&&x.scrollBy({top:h.y,left:h.x})}},[t,a,c,r,n])}const hr=f.createContext({...pe,scaleX:1,scaleY:1});var Ee;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(Ee||(Ee={}));const gr=f.memo(function(t){var n,r,o,s;let{id:a,accessibility:c,autoScroll:l=!0,children:d,sensors:g=fs,collisionDetection:h=Ro,measuring:x,modifiers:m,...b}=t;const p=f.useReducer(ms,void 0,vs),[y,D]=p,[T,M]=go(),[_,k]=f.useState(Ee.Uninitialized),O=_===Ee.Initialized,{draggable:{active:I,nodes:P,translate:W},droppable:{containers:B}}=y,A=I!=null?P.get(I):null,K=f.useRef({initial:null,translated:null}),ee=f.useMemo(()=>{var re;return I!=null?{id:I,data:(re=A?.data)!=null?re:hs,rect:K}:null},[I,A]),$=f.useRef(null),[R,w]=f.useState(null),[j,E]=f.useState(null),L=Ke(b,Object.values(b)),z=nt("DndDescribedBy",a),v=f.useMemo(()=>B.getEnabled(),[B]),C=ys(x),{droppableRects:N,measureDroppableContainers:F,measuringScheduled:U}=es(v,{dragging:O,dependencies:[W.x,W.y],config:C.droppable}),G=Zo(P,I),H=f.useMemo(()=>j?Wt(j):null,[j]),X=Fr(),q=ts(G,C.draggable.measure);Ss({activeNode:I!=null?P.get(I):null,config:X.layoutShiftCompensation,initialRect:q,measure:C.draggable.measure});const Y=In(G,C.draggable.measure,q),se=In(G?G.parentElement:null),ne=f.useRef({activatorEvent:null,active:null,activeNode:G,collisionRect:null,collisions:null,droppableRects:N,draggableNodes:P,draggingNode:null,draggingNodeRect:null,droppableContainers:B,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),he=B.getNodeFor((n=ne.current.over)==null?void 0:n.id),xe=ds({measure:C.dragOverlay.measure}),je=(r=xe.nodeRef.current)!=null?r:G,Me=O?(o=xe.rect)!=null?o:Y:null,cn=!!(xe.nodeRef.current&&xe.rect),ln=os(cn?null:Y),Mt=dr(je?ae(je):null),Se=ss(O?he??G:null),rt=ls(Se),ot=xs(m,{transform:{x:W.x-ln.x,y:W.y-ln.y,scaleX:1,scaleY:1},activatorEvent:j,active:ee,activeNodeRect:Y,containerNodeRect:se,draggingNodeRect:Me,over:ne.current.over,overlayNodeRect:xe.rect,scrollableAncestors:Se,scrollableAncestorRects:rt,windowRect:Mt}),un=H?$e(H,W):null,dn=is(Se),Ir=Ln(dn),Ar=Ln(dn,[Y]),_e=$e(ot,Ir),Oe=Me?jo(Me,ot):null,ze=ee&&Oe?h({active:ee,collisionRect:Oe,droppableRects:N,droppableContainers:v,pointerCoordinates:un}):null,fn=Do(ze,"id"),[we,hn]=f.useState(null),Lr=cn?ot:$e(ot,Ar),Nr=Eo(Lr,(s=we?.rect)!=null?s:null,Y),_t=f.useRef(null),gn=f.useCallback((re,ce)=>{let{sensor:le,options:De}=ce;if($.current==null)return;const de=P.get($.current);if(!de)return;const ue=re.nativeEvent,ve=new le({active:$.current,activeNode:de,event:ue,options:De,context:ne,onAbort(te){if(!P.get(te))return;const{onDragAbort:me}=L.current,ye={id:te};me?.(ye),T({type:"onDragAbort",event:ye})},onPending(te,Ce,me,ye){if(!P.get(te))return;const{onDragPending:Ye}=L.current,Re={id:te,constraint:Ce,initialCoordinates:me,offset:ye};Ye?.(Re),T({type:"onDragPending",event:Re})},onStart(te){const Ce=$.current;if(Ce==null)return;const me=P.get(Ce);if(!me)return;const{onDragStart:ye}=L.current,Pe={activatorEvent:ue,active:{id:Ce,data:me.data,rect:K}};Ue.unstable_batchedUpdates(()=>{ye?.(Pe),k(Ee.Initializing),D({type:Z.DragStart,initialCoordinates:te,active:Ce}),T({type:"onDragStart",event:Pe}),w(_t.current),E(ue)})},onMove(te){D({type:Z.DragMove,coordinates:te})},onEnd:ke(Z.DragEnd),onCancel:ke(Z.DragCancel)});_t.current=ve;function ke(te){return async function(){const{active:me,collisions:ye,over:Pe,scrollAdjustedTranslate:Ye}=ne.current;let Re=null;if(me&&Ye){const{cancelDrop:Fe}=L.current;Re={activatorEvent:ue,active:me,collisions:ye,delta:Ye,over:Pe},te===Z.DragEnd&&typeof Fe=="function"&&await Promise.resolve(Fe(Re))&&(te=Z.DragCancel)}$.current=null,Ue.unstable_batchedUpdates(()=>{D({type:te}),k(Ee.Uninitialized),hn(null),w(null),E(null),_t.current=null;const Fe=te===Z.DragEnd?"onDragEnd":"onDragCancel";if(Re){const Ot=L.current[Fe];Ot?.(Re),T({type:Fe,event:Re})}})}}},[P]),zr=f.useCallback((re,ce)=>(le,De)=>{const de=le.nativeEvent,ue=P.get(De);if($.current!==null||!ue||de.dndKit||de.defaultPrevented)return;const ve={active:ue};re(le,ce.options,ve)===!0&&(de.dndKit={capturedBy:ce.sensor},$.current=De,gn(le,ce))},[P,gn]),pn=Qo(g,zr);as(g),be(()=>{Y&&_===Ee.Initializing&&k(Ee.Initialized)},[Y,_]),f.useEffect(()=>{const{onDragMove:re}=L.current,{active:ce,activatorEvent:le,collisions:De,over:de}=ne.current;if(!ce||!le)return;const ue={active:ce,activatorEvent:le,collisions:De,delta:{x:_e.x,y:_e.y},over:de};Ue.unstable_batchedUpdates(()=>{re?.(ue),T({type:"onDragMove",event:ue})})},[_e.x,_e.y]),f.useEffect(()=>{const{active:re,activatorEvent:ce,collisions:le,droppableContainers:De,scrollAdjustedTranslate:de}=ne.current;if(!re||$.current==null||!ce||!de)return;const{onDragOver:ue}=L.current,ve=De.get(fn),ke=ve&&ve.rect.current?{id:ve.id,rect:ve.rect.current,data:ve.data,disabled:ve.disabled}:null,te={active:re,activatorEvent:ce,collisions:le,delta:{x:de.x,y:de.y},over:ke};Ue.unstable_batchedUpdates(()=>{hn(ke),ue?.(te),T({type:"onDragOver",event:te})})},[fn]),be(()=>{ne.current={activatorEvent:j,active:ee,activeNode:G,collisionRect:Oe,collisions:ze,droppableRects:N,draggableNodes:P,draggingNode:je,draggingNodeRect:Me,droppableContainers:B,over:we,scrollableAncestors:Se,scrollAdjustedTranslate:_e},K.current={initial:Me,translated:Oe}},[ee,G,ze,Oe,P,je,Me,N,B,we,Se,_e]),qo({...X,delta:W,draggingRect:Oe,pointerCoordinates:un,scrollableAncestors:Se,scrollableAncestorRects:rt});const Pr=f.useMemo(()=>({active:ee,activeNode:G,activeNodeRect:Y,activatorEvent:j,collisions:ze,containerNodeRect:se,dragOverlay:xe,draggableNodes:P,droppableContainers:B,droppableRects:N,over:we,measureDroppableContainers:F,scrollableAncestors:Se,scrollableAncestorRects:rt,measuringConfiguration:C,measuringScheduled:U,windowRect:Mt}),[ee,G,Y,j,ze,se,xe,P,B,N,we,F,Se,rt,C,U,Mt]),Yr=f.useMemo(()=>({activatorEvent:j,activators:pn,active:ee,activeNodeRect:Y,ariaDescribedById:{draggable:z},dispatch:D,draggableNodes:P,over:we,measureDroppableContainers:F}),[j,pn,ee,Y,D,z,P,we,F]);return f.createElement(Qn.Provider,{value:M},f.createElement(Rt.Provider,{value:Yr},f.createElement(fr.Provider,{value:Pr},f.createElement(hr.Provider,{value:Nr},d)),f.createElement(bs,{disabled:c?.restoreFocus===!1})),f.createElement(mo,{...c,hiddenTextDescribedById:z}));function Fr(){const re=R?.autoScrollEnabled===!1,ce=typeof l=="object"?l.enabled===!1:l===!1,le=O&&!re&&!ce;return typeof l=="object"?{...l,enabled:le}:{enabled:le}}}),ws=f.createContext(null),zn="button",Ds="Draggable";function Cs(e){let{id:t,data:n,disabled:r=!1,attributes:o}=e;const s=nt(Ds),{activators:a,activatorEvent:c,active:l,activeNodeRect:d,ariaDescribedById:g,draggableNodes:h,over:x}=f.useContext(Rt),{role:m=zn,roleDescription:b="draggable",tabIndex:p=0}=o??{},y=l?.id===t,D=f.useContext(y?hr:ws),[T,M]=bt(),[_,k]=bt(),O=cs(a,t),I=Ke(n);be(()=>(h.set(t,{id:t,key:s,node:T,activatorNode:_,data:I}),()=>{const W=h.get(t);W&&W.key===s&&h.delete(t)}),[h,t]);const P=f.useMemo(()=>({role:m,tabIndex:p,"aria-disabled":r,"aria-pressed":y&&m===zn?!0:void 0,"aria-roledescription":b,"aria-describedby":g.draggable}),[r,m,p,y,b,g.draggable]);return{active:l,activatorEvent:c,activeNodeRect:d,attributes:P,isDragging:y,listeners:r?void 0:O,node:T,over:x,setNodeRef:M,setActivatorNodeRef:k,transform:D}}function Rs(){return f.useContext(fr)}const Es="Droppable",Ts={timeout:25};function js(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:o}=e;const s=nt(Es),{active:a,dispatch:c,over:l,measureDroppableContainers:d}=f.useContext(Rt),g=f.useRef({disabled:n}),h=f.useRef(!1),x=f.useRef(null),m=f.useRef(null),{disabled:b,updateMeasurementsFor:p,timeout:y}={...Ts,...o},D=Ke(p??r),T=f.useCallback(()=>{if(!h.current){h.current=!0;return}m.current!=null&&clearTimeout(m.current),m.current=setTimeout(()=>{d(Array.isArray(D.current)?D.current:[D.current]),m.current=null},y)},[y]),M=Ct({callback:T,disabled:b||!a}),_=f.useCallback((P,W)=>{M&&(W&&(M.unobserve(W),h.current=!1),P&&M.observe(P))},[M]),[k,O]=bt(_),I=Ke(t);return f.useEffect(()=>{!M||!k.current||(M.disconnect(),h.current=!1,M.observe(k.current))},[k,M]),f.useEffect(()=>(c({type:Z.RegisterDroppable,element:{id:r,key:s,disabled:n,node:k,rect:x,data:I}}),()=>c({type:Z.UnregisterDroppable,key:s,id:r})),[r]),f.useEffect(()=>{n!==g.current.disabled&&(c({type:Z.SetDroppableDisabled,id:r,key:s,disabled:n}),g.current.disabled=n)},[r,s,n,c]),{active:a,rect:x,isOver:l?.id===r,node:k,over:l,setNodeRef:O}}function Et(e,t,n){const r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function Ms(e,t){return e.reduce((n,r,o)=>{const s=t.get(r);return s&&(n[o]=s),n},Array(e.length))}function lt(e){return e!==null&&e>=0}function _s(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 Os(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const ut={scaleX:1,scaleY:1},ks=e=>{var t;let{rects:n,activeNodeRect:r,activeIndex:o,overIndex:s,index:a}=e;const c=(t=n[o])!=null?t:r;if(!c)return null;const l=$s(n,a,o);if(a===o){const d=n[s];return d?{x:o<s?d.left+d.width-(c.left+c.width):d.left-c.left,y:0,...ut}:null}return a>o&&a<=s?{x:-c.width-l,y:0,...ut}:a<o&&a>=s?{x:c.width+l,y:0,...ut}:{x:0,y:0,...ut}};function $s(e,t,n){const r=e[t],o=e[t-1],s=e[t+1];return!r||!o&&!s?0:n<t?o?r.left-(o.left+o.width):s.left-(r.left+r.width):s?s.left-(r.left+r.width):r.left-(o.left+o.width)}const pr=e=>{let{rects:t,activeIndex:n,overIndex:r,index:o}=e;const s=Et(t,r,n),a=t[o],c=s[o];return!c||!a?null:{x:c.left-a.left,y:c.top-a.top,scaleX:c.width/a.width,scaleY:c.height/a.height}},dt={scaleX:1,scaleY:1},Is=e=>{var t;let{activeIndex:n,activeNodeRect:r,index:o,rects:s,overIndex:a}=e;const c=(t=s[n])!=null?t:r;if(!c)return null;if(o===n){const d=s[a];return d?{x:0,y:n<a?d.top+d.height-(c.top+c.height):d.top-c.top,...dt}:null}const l=As(s,o,n);return o>n&&o<=a?{x:0,y:-c.height-l,...dt}:o<n&&o>=a?{x:0,y:c.height+l,...dt}:{x:0,y:0,...dt}};function As(e,t,n){const r=e[t],o=e[t-1],s=e[t+1];return r?n<t?o?r.top-(o.top+o.height):s?s.top-(r.top+r.height):0:s?s.top-(r.top+r.height):o?r.top-(o.top+o.height):0:0}const vr="Sortable",mr=f.createContext({activeIndex:-1,containerId:vr,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:pr,disabled:{draggable:!1,droppable:!1}});function br(e){let{children:t,id:n,items:r,strategy:o=pr,disabled:s=!1}=e;const{active:a,dragOverlay:c,droppableRects:l,over:d,measureDroppableContainers:g}=Rs(),h=nt(vr,n),x=c.rect!==null,m=f.useMemo(()=>r.map(O=>typeof O=="object"&&"id"in O?O.id:O),[r]),b=a!=null,p=a?m.indexOf(a.id):-1,y=d?m.indexOf(d.id):-1,D=f.useRef(m),T=!_s(m,D.current),M=y!==-1&&p===-1||T,_=Os(s);be(()=>{T&&b&&g(m)},[T,m,b,g]),f.useEffect(()=>{D.current=m},[m]);const k=f.useMemo(()=>({activeIndex:p,containerId:h,disabled:_,disableTransforms:M,items:m,overIndex:y,useDragOverlay:x,sortedRects:Ms(m,l),strategy:o}),[p,h,_.draggable,_.droppable,M,m,y,l,x,o]);return f.createElement(mr.Provider,{value:k},t)}const Ls=e=>{let{id:t,items:n,activeIndex:r,overIndex:o}=e;return Et(n,r,o).indexOf(t)},Ns=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:o,items:s,newIndex:a,previousItems:c,previousContainerId:l,transition:d}=e;return!d||!r||c!==s&&o===a?!1:n?!0:a!==o&&t===l},zs={duration:200,easing:"ease"},xr="transform",Ps=Ie.Transition.toString({property:xr,duration:0,easing:"linear"}),Ys={roleDescription:"sortable"};function Fs(e){let{disabled:t,index:n,node:r,rect:o}=e;const[s,a]=f.useState(null),c=f.useRef(n);return be(()=>{if(!t&&n!==c.current&&r.current){const l=o.current;if(l){const d=Ne(r.current,{ignoreTransform:!0}),g={x:l.left-d.left,y:l.top-d.top,scaleX:l.width/d.width,scaleY:l.height/d.height};(g.x||g.y)&&a(g)}}n!==c.current&&(c.current=n)},[t,n,r,o]),f.useEffect(()=>{s&&a(null)},[s]),s}function yr(e){let{animateLayoutChanges:t=Ns,attributes:n,disabled:r,data:o,getNewIndex:s=Ls,id:a,strategy:c,resizeObserverConfig:l,transition:d=zs}=e;const{items:g,containerId:h,activeIndex:x,disabled:m,disableTransforms:b,sortedRects:p,overIndex:y,useDragOverlay:D,strategy:T}=f.useContext(mr),M=Bs(r,m),_=g.indexOf(a),k=f.useMemo(()=>({sortable:{containerId:h,index:_,items:g},...o}),[h,o,_,g]),O=f.useMemo(()=>g.slice(g.indexOf(a)),[g,a]),{rect:I,node:P,isOver:W,setNodeRef:B}=js({id:a,data:k,disabled:M.droppable,resizeObserverConfig:{updateMeasurementsFor:O,...l}}),{active:A,activatorEvent:K,activeNodeRect:ee,attributes:$,setNodeRef:R,listeners:w,isDragging:j,over:E,setActivatorNodeRef:L,transform:z}=Cs({id:a,data:k,attributes:{...Ys,...n},disabled:M.draggable}),v=ro(B,R),C=!!A,N=C&&!b&&lt(x)&&lt(y),F=!D&&j,U=F&&N?z:null,H=N?U??(c??T)({rects:p,activeNodeRect:ee,activeIndex:x,overIndex:y,index:_}):null,X=lt(x)&&lt(y)?s({id:a,items:g,activeIndex:x,overIndex:y}):_,q=A?.id,Y=f.useRef({activeId:q,items:g,newIndex:X,containerId:h}),se=g!==Y.current.items,ne=t({active:A,containerId:h,isDragging:j,isSorting:C,id:a,index:_,items:g,newIndex:Y.current.newIndex,previousItems:Y.current.items,previousContainerId:Y.current.containerId,transition:d,wasDragging:Y.current.activeId!=null}),he=Fs({disabled:!ne,index:_,node:P,rect:I});return f.useEffect(()=>{C&&Y.current.newIndex!==X&&(Y.current.newIndex=X),h!==Y.current.containerId&&(Y.current.containerId=h),g!==Y.current.items&&(Y.current.items=g)},[C,X,h,g]),f.useEffect(()=>{if(q===Y.current.activeId)return;if(q!=null&&Y.current.activeId==null){Y.current.activeId=q;return}const je=setTimeout(()=>{Y.current.activeId=q},50);return()=>clearTimeout(je)},[q]),{active:A,activeIndex:x,attributes:$,data:k,rect:I,index:_,newIndex:X,items:g,isOver:W,isSorting:C,isDragging:j,listeners:w,node:P,overIndex:y,over:E,setNodeRef:v,setActivatorNodeRef:L,setDroppableNodeRef:B,setDraggableNodeRef:R,transform:he??H,transition:xe()};function xe(){if(he||se&&Y.current.newIndex===_)return Ps;if(!(F&&!en(K)||!d)&&(C||ne))return Ie.Transition.toString({...d,property:xr})}}function Bs(e,t){var n,r;return typeof e=="boolean"?{draggable:e,droppable:!1}:{draggable:(n=e?.draggable)!=null?n:t.draggable,droppable:(r=e?.droppable)!=null?r:t.droppable}}V.Down,V.Right,V.Up,V.Left;const Hs=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Vs=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,r)=>r?r.toUpperCase():n.toLowerCase()),Pn=e=>{const t=Vs(e);return t.charAt(0).toUpperCase()+t.slice(1)},Sr=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim(),Ws=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0};var Us={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const Gs=f.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:o="",children:s,iconNode:a,...c},l)=>f.createElement("svg",{ref:l,...Us,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:Sr("lucide",o),...!s&&!Ws(c)&&{"aria-hidden":"true"},...c},[...a.map(([d,g])=>f.createElement(d,g)),...Array.isArray(s)?s:[s]]));const oe=(e,t)=>{const n=f.forwardRef(({className:r,...o},s)=>f.createElement(Gs,{ref:s,iconNode:t,className:Sr(`lucide-${Hs(Pn(e))}`,`lucide-${e}`,r),...o}));return n.displayName=Pn(e),n};const Xs=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],qs=oe("arrow-down",Xs);const Ks=[["path",{d:"m21 16-4 4-4-4",key:"f6ql7i"}],["path",{d:"M17 20V4",key:"1ejh1v"}],["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}]],Js=oe("arrow-up-down",Ks);const Zs=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],Qs=oe("arrow-up",Zs);const ei=[["path",{d:"m19 21-7-4-7 4V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v16z",key:"1fy3hk"}]],ti=oe("bookmark",ei);const ni=[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]],Yn=oe("calendar",ni);const ri=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],oi=oe("chevron-left",ri);const si=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],ii=oe("chevron-right",si);const ai=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 3v18",key:"108xh3"}]],ci=oe("columns-2",ai);const li=[["path",{d:"M10 5a2 2 0 0 0-1.344.519l-6.328 5.74a1 1 0 0 0 0 1.481l6.328 5.741A2 2 0 0 0 10 19h10a2 2 0 0 0 2-2V7a2 2 0 0 0-2-2z",key:"1yo7s0"}],["path",{d:"m12 9 6 6",key:"anjzzh"}],["path",{d:"m18 9-6 6",key:"1fp51s"}]],ui=oe("delete",li);const di=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]],fi=oe("ellipsis",di);const hi=[["path",{d:"M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z",key:"sc7q7i"}]],gi=oe("funnel",hi);const pi=[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]],wr=oe("grip-vertical",pi);const vi=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]],mi=oe("pen",vi);const bi=[["path",{d:"M21 12a9 9 0 0 0-9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"14sxne"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M3 12a9 9 0 0 0 9 9 9.75 9.75 0 0 0 6.74-2.74L21 16",key:"1hlbsb"}],["path",{d:"M16 16h5v5",key:"ccwih5"}]],xi=oe("refresh-ccw",bi);const yi=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],Si=oe("settings",yi);const wi=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],Di=oe("triangle-alert",wi);function S(e){return f.forwardRef((t,n)=>{const{children:r,...o}=t;return i.jsx(e,{ref:n,...o,children:r})})}const Dr=e=>`table_column_order_v1:${e}`,Ci=e=>{const{tableId:t}=ie.state;localStorage.setItem(Dr(t),JSON.stringify(e.map(n=>n.id))),ie.setState(n=>({...n,columnOrder:e})),ie.setState(n=>({...n,columnOrder:e}))},Ri=e=>{ie.setState(t=>({...t,visibility:{...t.visibility,[e]:!t.visibility[e]}}))};function Ei(e){ie.setState(t=>t.sortColumn===e?{...t,sortDirection:t.sortDirection==="asc"?"desc":"asc"}:{...t,sortColumn:e,sortDirection:"asc"})}const ie=new Kn({tableId:"",sortColumn:null,sortDirection:"asc",visibility:{},columnOrder:[],data:[],sortableColumns:[],actionsConfig:{showActionColumn:!0,showColumnVisibilityMenu:!0,children:"Actions",width:"100px"}});function Cr(e,t){const n=e[0]??{},o=(t&&t.length?t:Object.keys(n).map(l=>({id:l,label:l}))).filter(l=>Object.prototype.hasOwnProperty.call(n,l.id)),{tableId:s}=ie.state,a=JSON.parse(localStorage.getItem(Dr(s))||"[]"),c=[...a.map(l=>o.find(d=>d.id===l)).filter(Boolean),...o.filter(l=>!a.includes(l.id))];ie.setState(l=>({...l,data:e,columnOrder:c,visibility:c.reduce((d,g)=>(d[g.id]=!0,d),{}),sortableColumns:c.map(d=>({id:d.id,label:d.label,sortable:!0,backgroundColor:d.backgroundColor}))}))}function Rr(e){ie.setState(t=>({...t,tableId:e}))}const Er=e=>{ie.setState(t=>({...t,actionsConfig:e}))},Ti=S(u.Menu.Trigger),ji=S(u.Menu.Positioner),Mi=S(u.Menu.Content),_i=S(u.Menu.Item),Oi=S(u.Checkbox.Label),ki=S(u.Checkbox.HiddenInput),$i=S(u.Checkbox.Control);function Ii({visibility:e,onToggle:t}){const{sortableColumns:n}=Qe(ie);return i.jsxs(u.Menu.Root,{closeOnSelect:!1,children:[i.jsx(Ti,{asChild:!0,children:i.jsx(u.IconButton,{"aria-label":"Toggle columns",variant:"ghost",ml:"1",size:"xs",children:i.jsx(ci,{size:18})})}),i.jsx(u.Portal,{children:i.jsx(ji,{children:i.jsx(Mi,{minW:"220px",children:n.map(r=>{const o=!!e[r.id];return i.jsx(_i,{value:r.id,closeOnSelect:!1,children:i.jsxs(u.Checkbox.Root,{checked:o,onCheckedChange:()=>t(r.id),children:[i.jsx(ki,{}),i.jsx($i,{}),i.jsx(Oi,{children:r.label})]})},r.id)})})})})]})}function Ai({id:e,children:t,onClick:n,cursor:r,borderRight:o,borderRightColor:s,backgroundColor:a}){const{setNodeRef:c,attributes:l,listeners:d,transform:g,transition:h}=yr({id:e});return i.jsx(u.Table.ColumnHeader,{ref:c,onClick:n,backgroundColor:a,w:e==="id"?"80px":void 0,style:{transform:Ie.Transform.toString(g),transition:h,cursor:r,borderRight:o,borderRightColor:s},...l,children:i.jsxs(u.HStack,{justify:"space-between",children:[t,i.jsx("span",{...d,children:i.jsx(wr,{size:12})})]})})}function Li(){const{columnOrder:e,visibility:t,sortColumn:n,sortDirection:r,sortableColumns:o,actionsConfig:s}=Qe(ie),a=e.map(l=>o.find(d=>d.id===l.id)).filter(l=>l!==void 0).filter(l=>t[l.id]),c=l=>{const{active:d,over:g}=l;if(!g||d.id===g.id)return;const h=e.findIndex(b=>b.id===d.id),x=e.findIndex(b=>b.id===g.id),m=Et(e,h,x);Ci(m)};return i.jsx(u.Table.Header,{background:"blue.200",position:"sticky",top:0,p:"0",children:i.jsx(gr,{collisionDetection:er,onDragEnd:c,children:i.jsx(br,{items:e.map(l=>l.id),strategy:ks,children:i.jsxs(u.Table.Row,{height:"28px",children:[a.map(l=>{const d=n===l?.id;return i.jsx(Ai,{id:l?.id,onClick:()=>l?.sortable&&Ei(l?.id),cursor:l?.sortable?"pointer":"default",borderRight:"2px solid #dcdcdc",backgroundColor:l?.backgroundColor,children:i.jsxs("span",{style:{display:"flex",alignItems:"center",gap:6,userSelect:"none"},children:[l?.label,l?.sortable&&(d?r==="asc"?i.jsx(Qs,{size:14}):i.jsx(qs,{size:14}):i.jsx(Js,{size:14,opacity:.4}))]})},l?.id)}),s?.showActionColumn&&i.jsx(u.Table.ColumnHeader,{width:s.width,backgroundColor:s.backgroundColor,borderRight:"2px solid #dcdcdc",children:s.children}),s?.showColumnVisibilityMenu&&i.jsx(u.Table.ColumnHeader,{boxSize:"0.5",backgroundColor:s.backgroundColorColumnVisibilityMenu,children:i.jsx(Ii,{visibility:t,onToggle:Ri})})]})})})})}const Fn=u.createListCollection({items:[{label:"10",value:"10"},{label:"20",value:"20"},{label:"50",value:"50"},{label:"100",value:"100"}]}),Ni=S(u.Select.Positioner),zi=S(u.Select.Content),Pi=S(u.Select.Item),Yi=S(u.Pagination.PrevTrigger),Fi=S(u.Pagination.NextTrigger),Bi=S(u.Select.HiddenSelect),Hi=S(u.Select.Control),Vi=S(u.Select.Trigger),Wi=S(u.Select.ValueText),Ui=S(u.Select.IndicatorGroup),Gi=S(u.Select.Indicator);function Xi({totalCount:e,pageSize:t,currentPage:n,onPageChange:r,onPageSizeChange:o,siblingCount:s=2}){return i.jsx(u.Box,{width:"100%",children:i.jsxs(u.HStack,{justify:"space-between",mx:"auto",flexWrap:"wrap",children:[i.jsxs(u.HStack,{children:[i.jsx(u.Text,{fontSize:"sm",color:"gray.600",_dark:{color:"gray.400"},children:"Rows per page:"}),i.jsxs(u.Select.Root,{collection:Fn,size:"sm",width:"60px",onValueChange:a=>o&&o(Number(a.items[0].value)),value:[String(t)],children:[i.jsx(Bi,{}),i.jsxs(Hi,{children:[i.jsx(Vi,{children:i.jsx(Wi,{placeholder:""})}),i.jsx(Ui,{children:i.jsx(Gi,{})})]}),i.jsx(u.Portal,{children:i.jsx(Ni,{children:i.jsx(zi,{children:Fn.items.map(a=>i.jsxs(Pi,{item:a.value,children:[a.label,i.jsx(u.Select.ItemIndicator,{})]},a.value))})})})]})]}),i.jsx(u.Pagination.Root,{count:e,pageSize:t,page:n,siblingCount:s,onPageChange:a=>r&&r(a.page),children:i.jsxs(u.ButtonGroup,{size:"sm",variant:"ghost",children:[i.jsx(Yi,{asChild:!0,children:i.jsx(u.IconButton,{"aria-label":"Previous page",children:i.jsx(oi,{size:18})})}),i.jsx(u.Pagination.Items,{render:a=>i.jsx(u.IconButton,{variant:a.type==="page"&&a.value===n?"outline":"ghost","aria-current":a.type==="page"&&a.value===n?"page":void 0,children:a.type==="page"?a.value:"…"},a.value??a.type)}),i.jsx(Fi,{asChild:!0,children:i.jsx(u.IconButton,{"aria-label":"Next page",children:i.jsx(ii,{size:18})})})]})})]})})}const qi=S(u.Menu.Item),Ki=S(u.Menu.Content),Ji=S(u.Menu.Positioner),Zi=S(u.Menu.Trigger);function Qi({data:e=[],actions:t=[]}){const{columnOrder:n,visibility:r}=Qe(ie);return i.jsx(u.Table.Body,{children:e.map(o=>i.jsxs(u.Table.Row,{children:[n.filter(s=>r[s.id]).map(s=>i.jsx(u.Table.Cell,{children:o[s.id]},s.id)),i.jsx(u.Table.Cell,{textAlign:"center",display:"flex",gap:2,children:i.jsxs(u.Menu.Root,{children:[i.jsx(Zi,{asChild:!0,children:i.jsx(u.IconButton,{"aria-label":"Open",variant:"ghost",size:"sm",children:i.jsx(fi,{size:16})})}),i.jsx(u.Portal,{children:i.jsx(Ji,{children:i.jsx(Ki,{children:t.map(s=>i.jsxs(qi,{onClick:()=>s.onClick(o),colorScheme:s.colorScheme,value:s.label,children:[s.icon,s.label]},s.label))})})})]})})]},o.id))})}function ea({tableId:e,data:t=[],headers:n=[],loading:r=!1,emptyMessage:o="No data",actions:s,page:a=1,pageSize:c=10,onPageChange:l,onPageSizeChange:d,density:g="sm",totalCount:h=0,paginationMode:x="client",actionConfig:m}){f.useEffect(()=>{Rr(e)},[e]),f.useEffect(()=>{Cr(t,n)},[t,n]),f.useEffect(()=>{m&&Er(m)},[m]);const{sortColumn:b,sortDirection:p,data:y}=Qe(ie),D=f.useMemo(()=>{const T=[...y],M=Math.max(1,a||1);if(b&&T.sort((_,k)=>p==="asc"?String(_[b]).localeCompare(String(k[b])):String(k[b]).localeCompare(String(_[b]))),x==="client"){const _=(M-1)*c;return T.slice(_,_+c)}return T},[y,b,p,a,c,x]);return f.useEffect(()=>{a<1&&l&&l(1)},[a,l]),i.jsxs(u.Box,{h:"100%",display:"flex",flexDirection:"column",p:2,pt:2,minHeight:0,children:[i.jsx(u.Box,{flex:"1",minHeight:0,overflow:"auto",children:r?i.jsx(u.Box,{display:"flex",alignItems:"center",justifyContent:"center",h:"100%",color:"gray.500",children:"Loading..."}):D.length===0?i.jsx(u.Box,{display:"flex",alignItems:"center",justifyContent:"center",h:"100%",color:"gray.500",children:o}):i.jsxs(u.Table.Root,{variant:"outline",w:"100%",size:g,children:[i.jsx(Li,{}),i.jsx(Qi,{data:D,actions:s})]})}),i.jsx(u.Box,{mt:.5,children:i.jsx(Xi,{totalCount:h,pageSize:c,currentPage:a,onPageChange:l,onPageSizeChange:T=>{d&&d(T),a>1&&l&&l(1)}})})]})}const ta=S(u.Checkbox.Root),na=S(u.Checkbox.HiddenInput),ra=S(u.Checkbox.Control),oa=S(u.Checkbox.Label),Tr=({value:e,onChange:t,size:n="sm",label:r,helperText:o,isDisabled:s,required:a,errorText:c})=>i.jsxs(ta,{value:e,onChange:t,size:n,children:[i.jsx(na,{}),i.jsx(ra,{disabled:s,required:a,errorText:c,helperText:o}),r&&i.jsx(oa,{children:r})]}),J=" to ",Bn=10,Te={DAY_MAX:31,MONTH_MAX:12,YEAR_MIN:1900,YEAR_MAX:2100},sn=()=>{const e=new Date;return{year:e.getFullYear(),month:e.getMonth()+1,day:e.getDate()}},Hn=()=>{const{year:e,month:t,day:n}=sn();return`${String(n).padStart(2,"0")}-${String(t).padStart(2,"0")}-${e}`},sa=()=>{const{year:e,month:t,day:n}=sn();return`${e}-${String(t).padStart(2,"0")}-${String(n).padStart(2,"0")}`},ia=(e,t)=>{const n=e.length,r=parseInt(e);if(!e||isNaN(r))return t;if(n===4)return r>=Te.YEAR_MIN&&r<=Te.YEAR_MAX?r:t;if(n>0&&n<4){const o=t.toString(),s=4-n,a=o.substring(0,s);return parseInt(a+e)}return t},Ve=e=>{if(!e?.trim())return null;const n=e.replace(/[^\d-]/g,"").split("-").filter(d=>d!=="");if(n.length===0)return null;const{year:r,month:o,day:s}=sn();let a,c,l;return n.length===1?(a=parseInt(n[0])||s,c=o,l=r):n.length===2?(a=parseInt(n[0])||s,c=parseInt(n[1])||o,l=r):(a=parseInt(n[0])||s,c=parseInt(n[1])||o,l=ia(n[2],r)),c=Math.max(1,Math.min(Te.MONTH_MAX,c)),a=Math.max(1,Math.min(Te.DAY_MAX,a)),`${l}-${String(c).padStart(2,"0")}-${String(a).padStart(2,"0")}`},ge=e=>{if(!e)return"";const[t,n,r]=e.split("-");return`${r}-${n}-${t}`},aa=(e,t)=>{if(e[0]?.length>0){const n=parseInt(e[0]);if(isNaN(n)||n===0||e[0].length===2&&n>Te.DAY_MAX)return t}if(e[1]?.length>0){const n=parseInt(e[1]);if(isNaN(n)||n===0||e[1].length===2&&n>Te.MONTH_MAX)return t}if(e[2]?.length>0){const n=parseInt(e[2]),r=e[2].length===4;if(isNaN(n)||n===0||r&&(n<Te.YEAR_MIN||n>Te.YEAR_MAX))return t}return null},We=e=>{let t=e.replace(/[^\d-]/g,"").substring(0,Bn);if(t.length>=3&&t[2]!=="-"&&(t=t.substring(0,2)+"-"+t.substring(2).replace(/-/g,"")),t.length>=6&&t[5]!=="-"){const o=t.split("-");o.length>=2&&(t=`${o[0]}-${o[1].substring(0,2)}-${o[1].substring(2)}${o[2]||""}`)}const n=t.split("-");return n[0]=n[0]?.substring(0,2)||"",n[1]=n[1]?.substring(0,2)||"",n[2]=n[2]?.substring(0,4)||"",t=n.filter(o=>o!=="").join("-"),t=t.substring(0,Bn),aa(n,e)||t},ca=S(u.Popover.Root),la=S(u.Popover.Trigger),ua=S(u.Popover.Content),da=S(u.Popover.Positioner);function fa({value:e,onChange:t,disabled:n=!1}){const[r="",o=""]=e?e.split("|"):[],[s,a]=f.useState(()=>r&&o?`${ge(r)}${J}${ge(o)}`:r?ge(r):""),[c,l]=f.useState(!1),d=f.useRef(null);f.useEffect(()=>{const b=p=>{p.ctrlKey&&p.key==="d"&&!p.shiftKey&&!p.metaKey&&(p.preventDefault(),d.current?.focus())};return window.addEventListener("keydown",b),()=>window.removeEventListener("keydown",b)},[]);const g=b=>{let p=b;if(p.includes(J)){const[y,D=""]=p.split(J);p=`${We(y.trim())}${J}${We(D.trim())}`}else if(p.toLowerCase().includes(" to ")){const[y,D=""]=p.split(/\s+to\s+/i);p=`${We(y.trim())} to ${We(D.trim())}`}else p=We(p);a(p)},h=()=>{const b=s.trim();if(!b){t(void 0);return}if(b.includes(J)){const[p,y=""]=b.split(J).map(M=>M.trim()),D=Ve(p),T=y?Ve(y):null;if(D&&T){const[M,_]=T<D?[T,D]:[D,T],k=`${ge(M)}${J}${ge(_)}`;a(k),t(`${M}|${_}`)}else if(D&&!y)a(`${ge(D)}${J}`),t(void 0);else if(D&&y){const M=sa(),[_,k]=M<D?[M,D]:[D,M],O=`${ge(_)}${J}${ge(k)}`;a(O),t(`${_}|${k}`)}else a(""),t(void 0)}else{const p=Ve(b);p?(a(`${ge(p)}${J}`),t(void 0)):(a(""),t(void 0))}},x=b=>{if(b.key!=="Enter")return;b.preventDefault();const p=d.current?.selectionStart||0,y=s.indexOf(J);if(!s.trim()){a(`${Hn()}${J}`);return}if(y===-1){const T=Ve(s.trim());T&&a(`${ge(T)}${J}`);return}if(p<=y+J.length){const T=s.substring(0,y).trim(),M=s.substring(y+J.length),_=Ve(T);_&&a(`${ge(_)}${J}${M}`);return}if(s.substring(y+J.length).trim())h(),d.current?.blur();else{const T=s.substring(0,y+J.length)+Hn();a(T),setTimeout(()=>{h(),d.current?.blur()},0)}},m=()=>{a(""),t(void 0)};return i.jsx(u.InputGroup,{children:i.jsx(i.Fragment,{children:i.jsxs(u.InputElement,{position:"revert",children:[i.jsxs(ca,{open:c,onEscapeKeyDown:()=>{l(!1)},children:[i.jsx(la,{asChild:!0,children:i.jsx(u.IconButton,{size:"sm",variant:"ghost","aria-label":"Date range help",onClick:()=>l(b=>!b),children:i.jsx(Yn,{size:16})})}),i.jsx(u.Portal,{children:i.jsx(da,{children:i.jsxs(ua,{p:4,children:[i.jsx(u.PopoverArrow,{}),i.jsxs(u.VStack,{align:"start",gap:4,children:[i.jsxs(u.HStack,{children:[i.jsx(Yn,{size:16}),i.jsx(u.Text,{fontWeight:"semibold",fontSize:"sm",children:"Date Range Filter"})]}),i.jsxs(u.VStack,{align:"start",gap:1,children:[i.jsx(u.Text,{fontSize:"sm",fontWeight:"medium",children:"Format:"}),i.jsxs(u.Text,{fontSize:"xs",color:"gray.600",children:["DD-MM-YYYY",J,"DD-MM-YYYY"]})]}),i.jsxs(u.VStack,{align:"start",gap:1,children:[i.jsx(u.Text,{fontSize:"sm",fontWeight:"medium",children:"Tips:"}),i.jsx(u.Text,{fontSize:"xs",children:'• "15 to 20" → assumes current month/year'}),i.jsx(u.Text,{fontSize:"xs",children:"• Leave end blank → up to today"}),i.jsx(u.Text,{fontSize:"xs",children:"• Dates auto-swapped if reversed"}),i.jsx(u.Text,{fontSize:"xs",children:"• Press Enter on empty end → fills today"})]}),i.jsxs(u.VStack,{align:"start",gap:1,children:[i.jsx(u.Text,{fontSize:"sm",fontWeight:"medium",children:"Shortcut:"}),i.jsxs(u.HStack,{children:[i.jsx(u.Kbd,{children:"Ctrl"}),i.jsx(u.Text,{children:"+"}),i.jsx(u.Kbd,{children:"D"})]})]})]})]})})})]}),i.jsx(u.Input,{ref:d,placeholder:"15-06-2025 to 20-06-2025",value:s,size:"sm",disabled:n,onChange:b=>g(b.target.value),onBlur:h,onKeyDown:x,pr:s?"10":void 0,w:"100%"}),s&&i.jsx(u.InputElement,{children:i.jsx(u.IconButton,{size:"sm",variant:"ghost","aria-label":"Clear date range",onClick:m,w:"100%"})})]})})})}const ha=S(u.Field.Root),ga=S(u.Field.Label),pa=S(u.Field.HelperText),va=S(u.Field.ErrorText),qt=({icon:e,value:t,onChange:n,placeholder:r,size:o="xs",variant:s="outline",width:a="100%",label:c,helperText:l,isDisabled:d=!1,required:g=!1,errorText:h,visible:x})=>i.jsxs(ha,{width:a,children:[x&&i.jsx(ga,{children:c}),i.jsx(u.InputGroup,{startElement:e,children:i.jsx(u.Input,{value:t,onChange:m=>n?.(m.target.value),placeholder:r,size:o,variant:s,disabled:d,required:g})}),h&&i.jsx(va,{fontSize:"xs",children:h}),l&&i.jsx(pa,{fontSize:"xs",children:l})]}),ma=S(u.Field.Root),ba=S(u.Field.HelperText),xa=S(u.Field.ErrorText),ya=S(u.Select.Root),Sa=S(u.Select.Label),wa=S(u.Select.Control),Da=S(u.Select.Trigger),Ca=S(u.Select.ValueText),Ra=S(u.Select.IndicatorGroup),Ea=S(u.Select.Indicator),Ta=S(u.Select.Content),ja=S(u.Select.Item),Ma=S(u.Select.ItemIndicator),_a=S(u.Select.HiddenSelect),Oa=S(u.Select.Positioner),jr=({options:e=[],label:t,value:n,onChange:r,placeholder:o,size:s="xs",width:a="100%",variant:c="outline",helperText:l,isDisabled:d,required:g,errorText:h,visible:x})=>{const m=u.createListCollection({items:e});return i.jsxs(ma,{disabled:d,required:g,children:[i.jsxs(ya,{collection:m,variant:c,size:s,width:a,value:n?[n]:[],onValueChange:b=>r?.(b.value[0]),children:[i.jsx(_a,{}),x&&i.jsx(Sa,{children:t}),i.jsxs(wa,{children:[i.jsx(Da,{children:i.jsx(Ca,{placeholder:o})}),i.jsx(Ra,{children:i.jsx(Ea,{})})]}),i.jsx(Oa,{children:i.jsx(Ta,{children:m.items.map(b=>i.jsxs(ja,{item:b,children:[b.label,i.jsx(Ma,{})]},b.value))})})]}),l&&i.jsx(ba,{children:l}),h&&i.jsx(xa,{children:h})]})},Mr=e=>`FILTER_PRESETS_${e??"default"}`;function ka(e){try{return JSON.parse(localStorage.getItem(Mr(e))||"[]")}catch{return[]}}const Ze=new Kn({}),Tt=e=>{const t=Ze.state[e];if(t)return t;const n=ka(e);return Ze.setState(r=>({...r,[e]:n})),n},an=(e,t)=>{Ze.setState(n=>({...n,[e]:t})),localStorage.setItem(Mr(e),JSON.stringify(t))},_r=(e,t)=>{const n=Tt(e).filter(r=>r.id!==t);an(e,n)},Or=(e,t)=>{const n=[t,...Tt(e)];an(e,n)},$a=S(u.Checkbox.Root),Ia=S(u.Checkbox.HiddenInput),Aa=S(u.Checkbox.Control),La=S(u.Slider.Root),Na=S(u.Slider.Track),za=S(u.Slider.Range),Pa=S(u.Slider.Thumbs),Ya=S(u.Slider.Control),Fa=({filter:e,onVisibilityChange:t,onSizeChange:n})=>{const{attributes:r,listeners:o,setNodeRef:s,transform:a,transition:c}=yr({id:e.id}),l={transform:Ie.Transform.toString(a),transition:c};return i.jsxs(u.VStack,{ref:s,style:l,align:"stretch",border:"1px solid",borderColor:"gray.200",rounded:"md",p:3,mb:3,bg:"white",children:[i.jsxs(u.HStack,{...r,...o,cursor:"grab",userSelect:"none",gap:2,children:[i.jsx(wr,{size:16}),i.jsx(u.Text,{fontWeight:"bold",fontSize:"sm",children:e.label||e.id})]}),i.jsxs(u.HStack,{justify:"space-between",children:[i.jsx(u.Text,{fontSize:"sm",children:"Visible"}),i.jsxs($a,{checked:e.visible,size:"sm",onCheckedChange:d=>t?.(e.id,!!d.checked),children:[i.jsx(Ia,{}),i.jsx(Aa,{})]})]}),i.jsxs(u.VStack,{align:"stretch",gap:1,children:[i.jsx(u.Text,{fontSize:"sm",children:"Size"}),i.jsx(La,{min:1,max:5,step:.5,value:[e.size??1],onValueChange:d=>n?.(e.id,d.value[0]),children:i.jsxs(Ya,{children:[i.jsx(Na,{children:i.jsx(za,{})}),i.jsx(Pa,{})]})})]})]})},Ba=S(u.Drawer.Root),Ha=S(u.Drawer.Trigger),Va=S(u.Drawer.Backdrop),Wa=S(u.Drawer.Positioner),Ua=S(u.Drawer.Content),Ga=S(u.Drawer.Header),Xa=S(u.Drawer.Title),qa=S(u.Drawer.Body),Ka=S(u.Drawer.Footer),Ja=S(u.Drawer.CloseTrigger),Za=S(u.Tabs.Root),Qa=S(u.Tabs.List),Ft=S(u.Tabs.Trigger),Bt=S(u.Tabs.Content),kr=(e,t)=>{if(e.customComponent)return e.customComponent;switch(e.type){case"text":return i.jsx(qt,{placeholder:e.label,value:e.value,onChange:e.onChange,label:e.label,visible:t});case"number":return i.jsx(qt,{label:e.label,value:e.value,onChange:e.onChange});case"checkbox":return i.jsx(Tr,{label:e.label,value:e.value,onChange:e.onChange});case"select":return i.jsx(jr,{label:e.label,value:e.value,onChange:e.onChange,options:e.options??[],visible:t});case"date":return i.jsx(fa,{value:e.value,onChange:e.onChange});default:return null}},ec=({filterDrawerSize:e="sm",onVisibilityChange:t,onSizeChange:n,onClear:r,filters:o,pageKey:s="default",currentFilters:a={},onLoadPreset:c,activePresetName:l,onReorder:d,open:g,onOpenChange:h})=>{const m=Qe(Ze)[s]??Tt(s),b=()=>{const p=prompt("Preset name?");p&&Or(s,{id:crypto.randomUUID(),name:p,date:new Date().toISOString(),filters:a})};return i.jsx(u.HStack,{wrap:"wrap",children:i.jsxs(Ba,{size:e,open:g,onOpenChange:h,children:[i.jsx(Ha,{asChild:!0,children:i.jsxs(u.IconButton,{"aria-label":"Open filters",variant:"outline",size:"xs",ml:2,p:2,children:[i.jsx(gi,{size:16}),"Filters"]})}),i.jsxs(u.Portal,{children:[i.jsx(Va,{}),i.jsx(Wa,{children:i.jsxs(Ua,{children:[i.jsx(Ga,{children:i.jsx(Xa,{children:"Filters"})}),i.jsx(qa,{overflowY:"auto",pt:1,children:i.jsxs(Za,{defaultValue:"view",children:[i.jsxs(Qa,{mb:4,children:[i.jsxs(Ft,{value:"view",children:[i.jsx(mi,{size:16}),"Edit"]}),i.jsxs(Ft,{value:"settings",children:[i.jsx(Si,{size:16}),"Settings"]}),i.jsxs(Ft,{value:"presets",children:[i.jsx(ti,{size:16}),"Presets"]})]}),i.jsx(Bt,{value:"view",children:o.filter(p=>p.visible).map(p=>i.jsx(u.VStack,{align:"stretch",border:"1px solid",borderColor:"gray.200",flex:p.size??1,minW:`${(p.size??1)*100}px`,rounded:"md",p:3,mb:3,children:kr(p,g)},p.id))}),i.jsx(Bt,{value:"settings",children:i.jsx(gr,{sensors:xo(bo(on)),collisionDetection:er,onDragEnd:({active:p,over:y})=>{if(!y||p.id===y.id)return;const D=o.findIndex(_=>_.id===p.id),T=o.findIndex(_=>_.id===y.id),M=Et(o,D,T);d?.(M)},children:i.jsx(br,{items:o.map(p=>p.id),strategy:Is,children:o.map(p=>i.jsx(Fa,{filter:p,onVisibilityChange:t,onSizeChange:n},p.id))})})}),i.jsx(Bt,{value:"presets",children:i.jsxs(u.VStack,{align:"stretch",mb:3,children:[i.jsx(u.Button,{size:"sm",colorScheme:"blue",onClick:b,children:"Save Current Filters"}),m.length===0&&i.jsx(u.Text,{fontSize:"xs",color:"gray.500",children:"No presets saved yet."}),m.map(p=>i.jsxs(u.HStack,{justify:"space-between",border:"1px solid",borderColor:l===p.name?"blue.300":"gray.200",rounded:"md",p:2,children:[i.jsxs(u.VStack,{align:"start",gap:0,children:[i.jsx(u.Text,{fontWeight:"bold",fontSize:"sm",children:p.name}),i.jsx(u.Text,{fontSize:"xs",color:"gray.500",children:new Date(p.date).toLocaleDateString()})]}),i.jsxs(u.HStack,{children:[i.jsx(u.Button,{size:"xs",variant:"ghost",onClick:()=>c?.(p.filters,p.name),children:"Load"}),i.jsx(u.IconButton,{size:"xs","aria-label":"Delete preset",variant:"ghost",onClick:()=>_r(s,p.id),children:i.jsx(ui,{size:14})})]})]},p.id))]})})]})}),i.jsxs(Ka,{justify:"space-between",children:[i.jsx(u.Button,{size:"sm",variant:"ghost",colorScheme:"red",onClick:()=>r&&r(),children:"Clear All"}),i.jsx(Ja,{asChild:!0,children:i.jsx(u.CloseButton,{})})]})]})})]})]})})},tc=({title:e,filters:t,onVisibilityChange:n,onReorder:r,onSizeChange:o,onClear:s,maxToolbarUnits:a,pageKey:c,currentFilters:l,onLoadPreset:d,activePresetName:g,filterDrawerSize:h="sm"})=>{const[x,m]=f.useState(!1);return i.jsxs(u.HStack,{wrap:"wrap",pl:2,pr:2,width:"100%",justify:"space-between",children:[e,i.jsxs(u.HStack,{gapX:1,children:[t.filter(b=>b.visible!==!1).map(b=>i.jsx(u.HStack,{flex:b.size??1,minW:`${(b.size??1)*100}px`,alignItems:"center",children:kr(b)},b.id)),i.jsx(ec,{filterDrawerSize:h,onVisibilityChange:n,onReorder:r,onSizeChange:o,onClear:s,maxToolbarUnits:a,pageKey:c,filters:t,currentFilters:l,onLoadPreset:d,activePresetName:g,open:x,onOpenChange:b=>{m(b.open)}})]})]})},nc=(e,t)=>{localStorage.setItem(`FILTER_ORDER_${e}`,JSON.stringify(t))},rc=e=>{try{return JSON.parse(localStorage.getItem(`FILTER_ORDER_${e}`)||"[]")}catch{return[]}},oc=({onClick:e,size:t="xs",variant:n="solid",label:r,leftIcon:o,rightIcon:s,isDisabled:a,colorScheme:c,loading:l,loadingText:d,rounded:g,type:h="button"})=>i.jsx(u.Button,{onClick:e,size:t,variant:n,disabled:a,colorPalette:c,loading:l,loadingText:d,rounded:g,type:h,children:i.jsxs(u.HStack,{gap:1,children:[o,r,s]})}),sc=S(u.Dialog.Root),ic=S(u.Dialog.Backdrop),ac=S(u.Dialog.Positioner),cc=S(u.Dialog.Content),lc=S(u.Dialog.Header),uc=S(u.Dialog.Body),dc=S(u.Dialog.Footer),fc=S(u.Dialog.Title),hc=S(u.Dialog.CloseTrigger);function gc({open:e,onClose:t,onConfirm:n,title:r="Delete Company",entityName:o,confirmText:s="DELETE",confirmLabel:a="Delete",isLoading:c=!1}){const[l,d]=f.useState("");return i.jsx(sc,{open:e,placement:"center",onOpenChange:g=>!g.open&&t(),children:i.jsxs(u.Portal,{children:[i.jsx(ic,{}),i.jsx(ac,{children:i.jsxs(cc,{maxW:"520px",children:[i.jsx(lc,{borderBottom:"1px solid",borderColor:"red.200",boxShadow:"sm",children:i.jsx(fc,{color:"red.600",children:r})}),i.jsx(uc,{children:i.jsxs(u.Stack,{gap:4,boxShadow:"lg",border:"1px solid gray.200",borderRadius:"md",p:4,children:[i.jsx(u.Box,{border:"1px solid",borderColor:"red.200",bg:"red.50",borderRadius:"md",p:4,children:i.jsxs(u.Stack,{direction:"row",gap:3,align:"flex-start",children:[i.jsx(u.Box,{color:"red.600",mt:"2px",children:i.jsx(Di,{size:20})}),i.jsxs(u.Box,{children:[i.jsx(u.Text,{fontWeight:"semibold",color:"red.700",children:"Are you sure?"}),i.jsxs(u.Text,{fontSize:"sm",color:"red.600",children:["All the data of ",i.jsx("b",{children:o})," will permanently be deleted."]})]})]})}),i.jsx(u.Text,{fontSize:"sm",color:"gray.600",children:"You can’t undo this action afterwards."}),i.jsxs(u.Box,{children:[i.jsxs(u.Text,{fontSize:"sm",mb:1,children:["Type ",i.jsx("b",{children:s})," to continue"]}),i.jsx(u.Input,{placeholder:`Type ${s} here`,value:l,onChange:g=>d(g.target.value),size:"xs"})]})]})}),i.jsxs(dc,{justifyContent:"flex-end",gap:3,borderTop:"1px solid",borderColor:"red.200",boxShadow:"lg",children:[i.jsx(u.Button,{variant:"outline",size:"sm",onClick:t,children:"Cancel"}),i.jsx(u.Button,{size:"sm",style:{backgroundColor:"#FF0000"},loading:c,onClick:n,children:a})]}),i.jsx(hc,{asChild:!0,children:i.jsx(u.CloseButton,{size:"sm"})})]})})]})})}function $r({refetch:e,isLoading:t=!1,label:n="Refresh"}){const[r,o]=f.useState(!1),s=async()=>{o(!0);try{await e()}finally{setTimeout(()=>o(!1),300)}};return i.jsx(u.IconButton,{"aria-label":n,size:"xs",variant:"outline",disabled:t||r,onClick:s,ml:2,children:i.jsx(xi,{size:14,style:{animation:r?"spin 0.6s linear infinite":void 0}})})}var ht={exports:{}},pc=ht.exports,Vn;function vc(){return Vn||(Vn=1,(function(e,t){(function(n,r){e.exports=r()})(pc,(function(){var n=1e3,r=6e4,o=36e5,s="millisecond",a="second",c="minute",l="hour",d="day",g="week",h="month",x="quarter",m="year",b="date",p="Invalid Date",y=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,D=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,T={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function($){var R=["th","st","nd","rd"],w=$%100;return"["+$+(R[(w-20)%10]||R[w]||R[0])+"]"}},M=function($,R,w){var j=String($);return!j||j.length>=R?$:""+Array(R+1-j.length).join(w)+$},_={s:M,z:function($){var R=-$.utcOffset(),w=Math.abs(R),j=Math.floor(w/60),E=w%60;return(R<=0?"+":"-")+M(j,2,"0")+":"+M(E,2,"0")},m:function $(R,w){if(R.date()<w.date())return-$(w,R);var j=12*(w.year()-R.year())+(w.month()-R.month()),E=R.clone().add(j,h),L=w-E<0,z=R.clone().add(j+(L?-1:1),h);return+(-(j+(w-E)/(L?E-z:z-E))||0)},a:function($){return $<0?Math.ceil($)||0:Math.floor($)},p:function($){return{M:h,y:m,w:g,d,D:b,h:l,m:c,s:a,ms:s,Q:x}[$]||String($||"").toLowerCase().replace(/s$/,"")},u:function($){return $===void 0}},k="en",O={};O[k]=T;var I="$isDayjsObject",P=function($){return $ instanceof K||!(!$||!$[I])},W=function $(R,w,j){var E;if(!R)return k;if(typeof R=="string"){var L=R.toLowerCase();O[L]&&(E=L),w&&(O[L]=w,E=L);var z=R.split("-");if(!E&&z.length>1)return $(z[0])}else{var v=R.name;O[v]=R,E=v}return!j&&E&&(k=E),E||!j&&k},B=function($,R){if(P($))return $.clone();var w=typeof R=="object"?R:{};return w.date=$,w.args=arguments,new K(w)},A=_;A.l=W,A.i=P,A.w=function($,R){return B($,{locale:R.$L,utc:R.$u,x:R.$x,$offset:R.$offset})};var K=(function(){function $(w){this.$L=W(w.locale,null,!0),this.parse(w),this.$x=this.$x||w.x||{},this[I]=!0}var R=$.prototype;return R.parse=function(w){this.$d=(function(j){var E=j.date,L=j.utc;if(E===null)return new Date(NaN);if(A.u(E))return new Date;if(E instanceof Date)return new Date(E);if(typeof E=="string"&&!/Z$/i.test(E)){var z=E.match(y);if(z){var v=z[2]-1||0,C=(z[7]||"0").substring(0,3);return L?new Date(Date.UTC(z[1],v,z[3]||1,z[4]||0,z[5]||0,z[6]||0,C)):new Date(z[1],v,z[3]||1,z[4]||0,z[5]||0,z[6]||0,C)}}return new Date(E)})(w),this.init()},R.init=function(){var w=this.$d;this.$y=w.getFullYear(),this.$M=w.getMonth(),this.$D=w.getDate(),this.$W=w.getDay(),this.$H=w.getHours(),this.$m=w.getMinutes(),this.$s=w.getSeconds(),this.$ms=w.getMilliseconds()},R.$utils=function(){return A},R.isValid=function(){return this.$d.toString()!==p},R.isSame=function(w,j){var E=B(w);return this.startOf(j)<=E&&E<=this.endOf(j)},R.isAfter=function(w,j){return B(w)<this.startOf(j)},R.isBefore=function(w,j){return this.endOf(j)<B(w)},R.$g=function(w,j,E){return A.u(w)?this[j]:this.set(E,w)},R.unix=function(){return Math.floor(this.valueOf()/1e3)},R.valueOf=function(){return this.$d.getTime()},R.startOf=function(w,j){var E=this,L=!!A.u(j)||j,z=A.p(w),v=function(q,Y){var se=A.w(E.$u?Date.UTC(E.$y,Y,q):new Date(E.$y,Y,q),E);return L?se:se.endOf(d)},C=function(q,Y){return A.w(E.toDate()[q].apply(E.toDate("s"),(L?[0,0,0,0]:[23,59,59,999]).slice(Y)),E)},N=this.$W,F=this.$M,U=this.$D,G="set"+(this.$u?"UTC":"");switch(z){case m:return L?v(1,0):v(31,11);case h:return L?v(1,F):v(0,F+1);case g:var H=this.$locale().weekStart||0,X=(N<H?N+7:N)-H;return v(L?U-X:U+(6-X),F);case d:case b:return C(G+"Hours",0);case l:return C(G+"Minutes",1);case c:return C(G+"Seconds",2);case a:return C(G+"Milliseconds",3);default:return this.clone()}},R.endOf=function(w){return this.startOf(w,!1)},R.$set=function(w,j){var E,L=A.p(w),z="set"+(this.$u?"UTC":""),v=(E={},E[d]=z+"Date",E[b]=z+"Date",E[h]=z+"Month",E[m]=z+"FullYear",E[l]=z+"Hours",E[c]=z+"Minutes",E[a]=z+"Seconds",E[s]=z+"Milliseconds",E)[L],C=L===d?this.$D+(j-this.$W):j;if(L===h||L===m){var N=this.clone().set(b,1);N.$d[v](C),N.init(),this.$d=N.set(b,Math.min(this.$D,N.daysInMonth())).$d}else v&&this.$d[v](C);return this.init(),this},R.set=function(w,j){return this.clone().$set(w,j)},R.get=function(w){return this[A.p(w)]()},R.add=function(w,j){var E,L=this;w=Number(w);var z=A.p(j),v=function(F){var U=B(L);return A.w(U.date(U.date()+Math.round(F*w)),L)};if(z===h)return this.set(h,this.$M+w);if(z===m)return this.set(m,this.$y+w);if(z===d)return v(1);if(z===g)return v(7);var C=(E={},E[c]=r,E[l]=o,E[a]=n,E)[z]||1,N=this.$d.getTime()+w*C;return A.w(N,this)},R.subtract=function(w,j){return this.add(-1*w,j)},R.format=function(w){var j=this,E=this.$locale();if(!this.isValid())return E.invalidDate||p;var L=w||"YYYY-MM-DDTHH:mm:ssZ",z=A.z(this),v=this.$H,C=this.$m,N=this.$M,F=E.weekdays,U=E.months,G=E.meridiem,H=function(Y,se,ne,he){return Y&&(Y[se]||Y(j,L))||ne[se].slice(0,he)},X=function(Y){return A.s(v%12||12,Y,"0")},q=G||function(Y,se,ne){var he=Y<12?"AM":"PM";return ne?he.toLowerCase():he};return L.replace(D,(function(Y,se){return se||(function(ne){switch(ne){case"YY":return String(j.$y).slice(-2);case"YYYY":return A.s(j.$y,4,"0");case"M":return N+1;case"MM":return A.s(N+1,2,"0");case"MMM":return H(E.monthsShort,N,U,3);case"MMMM":return H(U,N);case"D":return j.$D;case"DD":return A.s(j.$D,2,"0");case"d":return String(j.$W);case"dd":return H(E.weekdaysMin,j.$W,F,2);case"ddd":return H(E.weekdaysShort,j.$W,F,3);case"dddd":return F[j.$W];case"H":return String(v);case"HH":return A.s(v,2,"0");case"h":return X(1);case"hh":return X(2);case"a":return q(v,C,!0);case"A":return q(v,C,!1);case"m":return String(C);case"mm":return A.s(C,2,"0");case"s":return String(j.$s);case"ss":return A.s(j.$s,2,"0");case"SSS":return A.s(j.$ms,3,"0");case"Z":return z}return null})(Y)||z.replace(":","")}))},R.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},R.diff=function(w,j,E){var L,z=this,v=A.p(j),C=B(w),N=(C.utcOffset()-this.utcOffset())*r,F=this-C,U=function(){return A.m(z,C)};switch(v){case m:L=U()/12;break;case h:L=U();break;case x:L=U()/3;break;case g:L=(F-N)/6048e5;break;case d:L=(F-N)/864e5;break;case l:L=F/o;break;case c:L=F/r;break;case a:L=F/n;break;default:L=F}return E?L:A.a(L)},R.daysInMonth=function(){return this.endOf(h).$D},R.$locale=function(){return O[this.$L]},R.locale=function(w,j){if(!w)return this.$L;var E=this.clone(),L=W(w,j,!0);return L&&(E.$L=L),E},R.clone=function(){return A.w(this.$d,this)},R.toDate=function(){return new Date(this.valueOf())},R.toJSON=function(){return this.isValid()?this.toISOString():null},R.toISOString=function(){return this.$d.toISOString()},R.toString=function(){return this.$d.toUTCString()},$})(),ee=K.prototype;return B.prototype=ee,[["$ms",s],["$s",a],["$m",c],["$H",l],["$W",d],["$M",h],["$y",m],["$D",b]].forEach((function($){ee[$[1]]=function(R){return this.$g(R,$[0],$[1])}})),B.extend=function($,R){return $.$i||($(R,K,B),$.$i=!0),B},B.locale=W,B.isDayjs=P,B.unix=function($){return B(1e3*$)},B.en=O[k],B.Ls=O,B.p={},B}))})(ht)),ht.exports}var mc=vc();const jt=wt(mc);var gt={exports:{}},bc=gt.exports,Wn;function xc(){return Wn||(Wn=1,(function(e,t){(function(n,r){e.exports=r()})(bc,(function(){return function(n,r,o){n=n||{};var s=r.prototype,a={future:"in %s",past:"%s ago",s:"a few seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"};function c(d,g,h,x){return s.fromToBase(d,g,h,x)}o.en.relativeTime=a,s.fromToBase=function(d,g,h,x,m){for(var b,p,y,D=h.$locale().relativeTime||a,T=n.thresholds||[{l:"s",r:44,d:"second"},{l:"m",r:89},{l:"mm",r:44,d:"minute"},{l:"h",r:89},{l:"hh",r:21,d:"hour"},{l:"d",r:35},{l:"dd",r:25,d:"day"},{l:"M",r:45},{l:"MM",r:10,d:"month"},{l:"y",r:17},{l:"yy",d:"year"}],M=T.length,_=0;_<M;_+=1){var k=T[_];k.d&&(b=x?o(d).diff(h,k.d,!0):h.diff(d,k.d,!0));var O=(n.rounding||Math.round)(Math.abs(b));if(y=b>0,O<=k.r||!k.r){O<=1&&_>0&&(k=T[_-1]);var I=D[k.l];m&&(O=m(""+O)),p=typeof I=="string"?I.replace("%d",O):I(O,g,k.l,y);break}}if(g)return p;var P=y?D.future:D.past;return typeof P=="function"?P(p):P.replace("%s",p)},s.to=function(d,g){return c(d,g,this,!0)},s.from=function(d,g){return c(d,g,this)};var l=function(d){return d.$u?o.utc():o()};s.toNow=function(d){return this.to(l(this),d)},s.fromNow=function(d){return this.from(l(this),d)}}}))})(gt)),gt.exports}var yc=xc();const Sc=wt(yc);var pt={exports:{}},wc=pt.exports,Un;function Dc(){return Un||(Un=1,(function(e,t){(function(n,r){e.exports=r()})(wc,(function(){var n={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"};return function(r,o,s){var a=o.prototype,c=a.format;s.en.formats=n,a.format=function(l){l===void 0&&(l="YYYY-MM-DDTHH:mm:ssZ");var d=this.$locale().formats,g=(function(h,x){return h.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,(function(m,b,p){var y=p&&p.toUpperCase();return b||x[p]||n[p]||x[y].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,(function(D,T,M){return T||M.slice(1)}))}))})(l,d===void 0?{}:d);return c.call(this,g)}}}))})(pt)),pt.exports}var Cc=Dc();const Rc=wt(Cc);var vt={exports:{}},Ec=vt.exports,Gn;function Tc(){return Gn||(Gn=1,(function(e,t){(function(n,r){e.exports=r()})(Ec,(function(){return function(n,r){var o=r.prototype,s=o.format;o.format=function(a){var c=this,l=this.$locale();if(!this.isValid())return s.bind(this)(a);var d=this.$utils(),g=(a||"YYYY-MM-DDTHH:mm:ssZ").replace(/\[([^\]]+)]|Q|wo|ww|w|WW|W|zzz|z|gggg|GGGG|Do|X|x|k{1,2}|S/g,(function(h){switch(h){case"Q":return Math.ceil((c.$M+1)/3);case"Do":return l.ordinal(c.$D);case"gggg":return c.weekYear();case"GGGG":return c.isoWeekYear();case"wo":return l.ordinal(c.week(),"W");case"w":case"ww":return d.s(c.week(),h==="w"?1:2,"0");case"W":case"WW":return d.s(c.isoWeek(),h==="W"?1:2,"0");case"k":case"kk":return d.s(String(c.$H===0?24:c.$H),h==="k"?1:2,"0");case"X":return Math.floor(c.$d.getTime()/1e3);case"x":return c.$d.getTime();case"z":return"["+c.offsetName()+"]";case"zzz":return"["+c.offsetName("long")+"]";default:return h}}));return s.bind(this)(g)}}}))})(vt)),vt.exports}var jc=Tc();const Mc=wt(jc);jt.extend(Sc);jt.extend(Rc);jt.extend(Mc);const _c={date:"DD MMM YYYY",time:"hh:mm A",dateTime:"DD MMM YYYY, hh:mm A",full:"dddd, DD MMM YYYY, hh:mm A",short:"DD/MM/YY",relative:""};function Kt({value:e,variant:t="dateTime",format:n,fallback:r="--"}){if(!e)return r;const o=jt(e);return o.isValid()?t==="relative"?o.fromNow():o.format(n??_c[t]):r}function Oc({value:e,dateVariant:t="date",timeVariant:n="time",dateFormat:r,timeFormat:o,align:s="start"}){return i.jsxs(u.Stack,{gap:.5,align:s,children:[i.jsx(u.Text,{fontSize:"sm",fontWeight:"500",children:Kt({value:e,variant:t,format:r})}),i.jsx(u.Text,{fontSize:"xs",color:"gray.500",children:Kt({value:e,variant:n,format:o})})]})}exports.DataTable=ea;exports.Filters=tc;exports.MDSButton=oc;exports.MDSCheckbox=Tr;exports.MDSConfirmDeleteDialog=gc;exports.MDSInput=qt;exports.MDSRefreshButton=$r;exports.MDSSelectBox=jr;exports.RefreshButton=$r;exports.StackedDateTime=Oc;exports.addPreset=Or;exports.deletePreset=_r;exports.formatDateTime=Kt;exports.getPresets=Tt;exports.loadOrder=rc;exports.presetStore=Ze;exports.saveOrder=nc;exports.savePresets=an;exports.setActionsConfig=Er;exports.setData=Cr;exports.setTableId=Rr;exports.tableStore=ie;exports.withChildren=S;
package/dist/index.d.ts CHANGED
@@ -5,18 +5,18 @@ import { JSX as JSX_2 } from 'react/jsx-runtime';
5
5
  import { RefAttributes } from 'react';
6
6
  import { Store } from '@tanstack/store';
7
7
 
8
- declare interface ActionHeaderProps {
8
+ export declare type ActionHeaderProps = {
9
9
  backgroundColor?: string;
10
10
  children?: React.ReactNode;
11
11
  showActionColumn?: boolean;
12
12
  width?: string;
13
13
  showColumnVisibilityMenu?: boolean;
14
14
  backgroundColorColumnVisibilityMenu?: string;
15
- }
15
+ };
16
16
 
17
17
  export declare const addPreset: (pageKey: string, item: PresetItem) => void;
18
18
 
19
- declare interface Column<T = unknown> {
19
+ export declare interface Column<T = unknown> {
20
20
  id: string;
21
21
  label: string;
22
22
  minWidth?: number | string;
@@ -39,14 +39,14 @@ export declare interface ConfirmDeleteDialogProps {
39
39
 
40
40
  export declare function DataTable<T extends Record<string, unknown>>({ tableId, data: rowData, headers, loading, emptyMessage, actions, page, pageSize, onPageChange, onPageSizeChange, density, totalCount, paginationMode, actionConfig, }: DataTableProps<T>): JSX_2.Element;
41
41
 
42
- declare interface DataTableAction<T = unknown> {
42
+ export declare interface DataTableAction<T = unknown> {
43
43
  icon: JSX.Element;
44
44
  label: string;
45
45
  onClick: (row: T) => void;
46
46
  colorScheme?: 'gray' | 'red' | 'orange' | 'yellow' | 'green' | 'teal' | 'blue' | 'cyan' | 'purple' | 'pink';
47
47
  }
48
48
 
49
- declare interface DataTableProps<T = unknown> {
49
+ export declare interface DataTableProps<T = unknown> {
50
50
  tableId: string;
51
51
  headers?: Column<T>[];
52
52
  data?: T[];
@@ -67,7 +67,7 @@ export declare type DateTimeVariant = 'date' | 'time' | 'dateTime' | 'full' | 'r
67
67
 
68
68
  export declare const deletePreset: (pageKey: string, id: string) => void;
69
69
 
70
- declare type DensityType = 'sm' | 'md' | 'lg';
70
+ export declare type DensityType = 'sm' | 'md' | 'lg';
71
71
 
72
72
  export declare const Filters: ({ title, filters, onVisibilityChange, onReorder, onSizeChange, onClear, maxToolbarUnits, pageKey, currentFilters, onLoadPreset, activePresetName, filterDrawerSize, }: IMainFilterType) => JSX_2.Element;
73
73
 
@@ -228,6 +228,8 @@ export declare function setData(newData: any[], headers?: Column<any>[]): void;
228
228
 
229
229
  export declare function setTableId(tableId: string): void;
230
230
 
231
+ export declare type SortOrder = 'asc' | 'desc';
232
+
231
233
  export declare function StackedDateTime({ value, dateVariant, timeVariant, dateFormat, timeFormat, align, }: StackedDateTimeProps): JSX_2.Element;
232
234
 
233
235
  declare interface StackedDateTimeProps {
package/dist/index.js CHANGED
@@ -3761,7 +3761,7 @@ const ia = (e) => {
3761
3761
  function ga({ visibility: e, onToggle: t }) {
3762
3762
  const { sortableColumns: n } = bt(me);
3763
3763
  return /* @__PURE__ */ i.jsxs(Oe.Root, { closeOnSelect: !1, children: [
3764
- /* @__PURE__ */ i.jsx(aa, { asChild: !0, children: /* @__PURE__ */ i.jsx(_e, { "aria-label": "Toggle columns", variant: "outline", size: "sm", ml: "1", children: /* @__PURE__ */ i.jsx(Pi, { size: 18 }) }) }),
3764
+ /* @__PURE__ */ i.jsx(aa, { asChild: !0, children: /* @__PURE__ */ i.jsx(_e, { "aria-label": "Toggle columns", variant: "ghost", ml: "1", size: "xs", children: /* @__PURE__ */ i.jsx(Pi, { size: 18 }) }) }),
3765
3765
  /* @__PURE__ */ i.jsx(Qe, { children: /* @__PURE__ */ i.jsx(ca, { children: /* @__PURE__ */ i.jsx(la, { minW: "220px", children: n.map((r) => {
3766
3766
  const o = !!e[r.id];
3767
3767
  return /* @__PURE__ */ i.jsx(ua, { value: r.id, closeOnSelect: !1, children: /* @__PURE__ */ i.jsxs(De.Root, { checked: o, onCheckedChange: () => t(r.id), children: [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mdspl/mds-shared-ui",
3
- "version": "0.4.0",
3
+ "version": "0.4.2",
4
4
  "description": "Chakra UI v3 DataTable with sorting, pagination, column visibility & drag reorder",
5
5
  "author": "magadh",
6
6
  "license": "MIT",