@mdspl/mds-shared-ui 0.8.1 → 0.8.3

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
- `},uo={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 fo(e){let{announcements:t=uo,container:n,hiddenTextDescribedById:r,screenReaderInstructions:o=lo}=e;const{announce:s,announcement:c}=io(),a=tt("DndLiveRegion"),[u,d]=f.useState(!1);if(f.useEffect(()=>{d(!0)},[]),ao(f.useMemo(()=>({onDragStart(h){let{active:x}=h;s(t.onDragStart({active:x}))},onDragMove(h){let{active:x,over:p}=h;t.onDragMove&&s(t.onDragMove({active:x,over:p}))},onDragOver(h){let{active:x,over:p}=h;s(t.onDragOver({active:x,over:p}))},onDragEnd(h){let{active:x,over:p}=h;s(t.onDragEnd({active:x,over:p}))},onDragCancel(h){let{active:x,over:p}=h;s(t.onDragCancel({active:x,over:p}))}}),[s,t])),!u)return null;const g=f.createElement(f.Fragment,null,f.createElement(oo,{id:r,value:o.draggable}),f.createElement(so,{id:a,announcement:c}));return n?Ue.createPortal(g,n):g}var Q;(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"})(Q||(Q={}));function yt(){}function ho(e,t){return f.useMemo(()=>({sensor:e,options:{}}),[e,t])}function go(){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 po(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function vo(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function mo(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function bo(e,t){if(!e||e.length===0)return null;const[n]=e;return n[t]}function wn(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 Zn=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=wn(t,t.left,t.top),s=[];for(const c of r){const{id:a}=c,u=n.get(a);if(u){const d=po(wn(u),o);s.push({id:a,data:{droppableContainer:c,value:d}})}}return s.sort(vo)};function xo(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),c=o-r,a=s-n;if(r<o&&n<s){const u=t.width*t.height,d=e.width*e.height,g=c*a,h=g/(u+d-g);return Number(h.toFixed(4))}return 0}const yo=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=[];for(const s of r){const{id:c}=s,a=n.get(c);if(a){const u=xo(a,t);u>0&&o.push({id:c,data:{droppableContainer:s,value:u}})}}return o.sort(mo)};function So(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function Qn(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:pe}function wo(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((c,a)=>({...c,top:c.top+e*a.y,bottom:c.bottom+e*a.y,left:c.left+e*a.x,right:c.right+e*a.x}),{...n})}}const Co=wo(1);function Do(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 jo(e,t,n){const r=Do(t);if(!r)return e;const{scaleX:o,scaleY:s,x:c,y:a}=r,u=e.left-c-(1-o)*parseFloat(n),d=e.top-a-(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:u+g,bottom:d+h,left:u}}const Ro={ignoreTransform:!1};function Ne(e,t){t===void 0&&(t=Ro);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:d,transformOrigin:g}=ae(e).getComputedStyle(e);d&&(n=jo(n,d,g))}const{top:r,left:o,width:s,height:c,bottom:a,right:u}=n;return{top:r,left:o,width:s,height:c,bottom:a,right:u}}function Cn(e){return Ne(e,{ignoreTransform:!0})}function Eo(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function To(e,t){return t===void 0&&(t=ae(e).getComputedStyle(e)),t.position==="fixed"}function Mo(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 on(e,t){const n=[];function r(o){if(t!=null&&n.length>=t||!o)return n;if(tn(o)&&o.scrollingElement!=null&&!n.includes(o.scrollingElement))return n.push(o.scrollingElement),n;if(!Qe(o)||Xn(o)||n.includes(o))return n;const s=ae(e).getComputedStyle(o);return o!==e&&Mo(o,s)&&n.push(o),To(o,s)?n:r(o.parentNode)}return e?r(e):n}function er(e){const[t]=on(e,1);return t??null}function It(e){return!Dt||!e?null:Ae(e)?e:en(e)?tn(e)||e===Le(e).scrollingElement?window:Qe(e)?e:null:null}function tr(e){return Ae(e)?e.scrollX:e.scrollLeft}function nr(e){return Ae(e)?e.scrollY:e.scrollTop}function Ut(e){return{x:tr(e),y:nr(e)}}var ee;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(ee||(ee={}));function rr(e){return!Dt||!e?!1:e===document.scrollingElement}function or(e){const t={x:0,y:0},n=rr(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,c=e.scrollTop>=r.y,a=e.scrollLeft>=r.x;return{isTop:o,isLeft:s,isBottom:c,isRight:a,maxScroll:r,minScroll:t}}const Oo={x:.2,y:.2};function _o(e,t,n,r,o){let{top:s,left:c,right:a,bottom:u}=n;r===void 0&&(r=10),o===void 0&&(o=Oo);const{isTop:d,isBottom:g,isLeft:h,isRight:x}=or(e),p={x:0,y:0},b={x:0,y:0},v={height:t.height*o.y,width:t.width*o.x};return!d&&s<=t.top+v.height?(p.y=ee.Backward,b.y=r*Math.abs((t.top+v.height-s)/v.height)):!g&&u>=t.bottom-v.height&&(p.y=ee.Forward,b.y=r*Math.abs((t.bottom-v.height-u)/v.height)),!x&&a>=t.right-v.width?(p.x=ee.Forward,b.x=r*Math.abs((t.right-v.width-a)/v.width)):!h&&c<=t.left+v.width&&(p.x=ee.Backward,b.x=r*Math.abs((t.left+v.width-c)/v.width)),{direction:p,speed:b}}function ko(e){if(e===document.scrollingElement){const{innerWidth:s,innerHeight:c}=window;return{top:0,left:0,right:s,bottom:c,width:s,height:c}}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 sr(e){return e.reduce((t,n)=>$e(t,Ut(n)),pe)}function $o(e){return e.reduce((t,n)=>t+tr(n),0)}function Io(e){return e.reduce((t,n)=>t+nr(n),0)}function Ao(e,t){if(t===void 0&&(t=Ne),!e)return;const{top:n,left:r,bottom:o,right:s}=t(e);er(e)&&(o<=0||s<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const Lo=[["x",["left","right"],$o],["y",["top","bottom"],Io]];class sn{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=on(n),o=sr(r);this.rect={...t},this.width=t.width,this.height=t.height;for(const[s,c,a]of Lo)for(const u of c)Object.defineProperty(this,u,{get:()=>{const d=a(r),g=o[s]-d;return this.rect[u]+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 No(e){const{EventTarget:t}=ae(e);return e instanceof t?e:Le(e)}function At(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 Dn(e){e.preventDefault()}function Po(e){e.stopPropagation()}var W;(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"})(W||(W={}));const ir={start:[W.Space,W.Enter],cancel:[W.Esc],end:[W.Space,W.Enter,W.Tab]},zo=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case W.Right:return{...n,x:n.x+25};case W.Left:return{...n,x:n.x-25};case W.Down:return{...n,y:n.y+25};case W.Up:return{...n,y:n.y-25}}};class ar{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&&Ao(r),n(pe)}handleKeyDown(t){if(rn(t)){const{active:n,context:r,options:o}=this.props,{keyboardCodes:s=ir,coordinateGetter:c=zo,scrollBehavior:a="smooth"}=o,{code:u}=t;if(s.end.includes(u)){this.handleEnd(t);return}if(s.cancel.includes(u)){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=c(t,{active:n,context:r.current,currentCoordinates:g});if(h){const x=xt(h,g),p={x:0,y:0},{scrollableAncestors:b}=r.current;for(const v of b){const y=t.code,{isTop:w,isRight:E,isLeft:T,isBottom:I,maxScroll:k,minScroll:M}=or(v),A=ko(v),L={x:Math.min(y===W.Right?A.right-A.width/2:A.right,Math.max(y===W.Right?A.left:A.left+A.width/2,h.x)),y:Math.min(y===W.Down?A.bottom-A.height/2:A.bottom,Math.max(y===W.Down?A.top:A.top+A.height/2,h.y))},V=y===W.Right&&!E||y===W.Left&&!T,F=y===W.Down&&!I||y===W.Up&&!w;if(V&&L.x!==h.x){const D=v.scrollLeft+x.x,U=y===W.Right&&D<=k.x||y===W.Left&&D>=M.x;if(U&&!x.y){v.scrollTo({left:D,behavior:a});return}U?p.x=v.scrollLeft-D:p.x=y===W.Right?v.scrollLeft-k.x:v.scrollLeft-M.x,p.x&&v.scrollBy({left:-p.x,behavior:a});break}else if(F&&L.y!==h.y){const D=v.scrollTop+x.y,U=y===W.Down&&D<=k.y||y===W.Up&&D>=M.y;if(U&&!x.x){v.scrollTo({top:D,behavior:a});return}U?p.y=v.scrollTop-D:p.y=y===W.Down?v.scrollTop-k.y:v.scrollTop-M.y,p.y&&v.scrollBy({top:-p.y,behavior:a});break}}this.handleMove(t,$e(xt(h,this.referenceCoordinates),p))}}}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()}}ar.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:r=ir,onActivation:o}=t,{active:s}=n;const{code:c}=e.nativeEvent;if(r.start.includes(c)){const a=s.activatorNode.current;return a&&e.target!==a?!1:(e.preventDefault(),o?.({event:e.nativeEvent}),!0)}return!1}}];function jn(e){return!!(e&&"distance"in e)}function Rn(e){return!!(e&&"delay"in e)}class an{constructor(t,n,r){var o;r===void 0&&(r=No(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:c}=s;this.props=t,this.events=n,this.document=Le(c),this.documentListeners=new Ge(this.document),this.listeners=new Ge(r),this.windowListeners=new Ge(ae(c)),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,Dn),this.windowListeners.add(fe.VisibilityChange,this.handleCancel),this.windowListeners.add(fe.ContextMenu,Dn),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(Rn(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(jn(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,Po,{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:c,options:{activationConstraint:a}}=s;if(!o)return;const u=(n=Wt(t))!=null?n:pe,d=xt(o,u);if(!r&&a){if(jn(a)){if(a.tolerance!=null&&At(d,a.tolerance))return this.handleCancel();if(At(d,a.distance))return this.handleStart()}if(Rn(a)&&At(d,a.tolerance))return this.handleCancel();this.handlePending(a,d);return}t.cancelable&&t.preventDefault(),c(u)}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===W.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const Yo={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class cn extends an{constructor(t){const{event:n}=t,r=Le(n.target);super(t,Yo,r)}}cn.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 Fo={move:{name:"mousemove"},end:{name:"mouseup"}};var Gt;(function(e){e[e.RightClick=2]="RightClick"})(Gt||(Gt={}));class Bo extends an{constructor(t){super(t,Fo,Le(t.event.target))}}Bo.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===Gt.RightClick?!1:(r?.({event:n}),!0)}}];const Lt={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class Vo extends an{constructor(t){super(t,Lt)}static setup(){return window.addEventListener(Lt.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(Lt.move.name,t)};function t(){}}}Vo.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 qe;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(qe||(qe={}));var St;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(St||(St={}));function Ho(e){let{acceleration:t,activator:n=qe.Pointer,canScroll:r,draggingRect:o,enabled:s,interval:c=5,order:a=St.TreeOrder,pointerCoordinates:u,scrollableAncestors:d,scrollableAncestorRects:g,delta:h,threshold:x}=e;const p=Uo({delta:h,disabled:!s}),[b,v]=Qr(),y=f.useRef({x:0,y:0}),w=f.useRef({x:0,y:0}),E=f.useMemo(()=>{switch(n){case qe.Pointer:return u?{top:u.y,bottom:u.y,left:u.x,right:u.x}:null;case qe.DraggableRect:return o}},[n,o,u]),T=f.useRef(null),I=f.useCallback(()=>{const M=T.current;if(!M)return;const A=y.current.x*w.current.x,L=y.current.y*w.current.y;M.scrollBy(A,L)},[]),k=f.useMemo(()=>a===St.TreeOrder?[...d].reverse():d,[a,d]);f.useEffect(()=>{if(!s||!d.length||!E){v();return}for(const M of k){if(r?.(M)===!1)continue;const A=d.indexOf(M),L=g[A];if(!L)continue;const{direction:V,speed:F}=_o(M,L,E,t,x);for(const D of["x","y"])p[D][V[D]]||(F[D]=0,V[D]=0);if(F.x>0||F.y>0){v(),T.current=M,b(I,c),y.current=F,w.current=V;return}}y.current={x:0,y:0},w.current={x:0,y:0},v()},[t,I,r,v,s,c,JSON.stringify(E),JSON.stringify(p),b,d,k,g,JSON.stringify(x)])}const Wo={x:{[ee.Backward]:!1,[ee.Forward]:!1},y:{[ee.Backward]:!1,[ee.Forward]:!1}};function Uo(e){let{delta:t,disabled:n}=e;const r=Ht(t);return et(o=>{if(n||!r||!o)return Wo;const s={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[ee.Backward]:o.x[ee.Backward]||s.x===-1,[ee.Forward]:o.x[ee.Forward]||s.x===1},y:{[ee.Backward]:o.y[ee.Backward]||s.y===-1,[ee.Forward]:o.y[ee.Forward]||s.y===1}}},[n,t,r])}function Go(e,t){const n=t!=null?e.get(t):void 0,r=n?n.node.current:null;return et(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(c=>({eventName:c.eventName,handler:t(c.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 qt;(function(e){e.Optimized="optimized"})(qt||(qt={}));const En=new Map;function Xo(e,t){let{dragging:n,dependencies:r,config:o}=t;const[s,c]=f.useState(null),{frequency:a,measure:u,strategy:d}=o,g=f.useRef(e),h=y(),x=Ke(h),p=f.useCallback(function(w){w===void 0&&(w=[]),!x.current&&c(E=>E===null?w:E.concat(w.filter(T=>!E.includes(T))))},[x]),b=f.useRef(null),v=et(w=>{if(h&&!n)return En;if(!w||w===En||g.current!==e||s!=null){const E=new Map;for(let T of e){if(!T)continue;if(s&&s.length>0&&!s.includes(T.id)&&T.rect.current){E.set(T.id,T.rect.current);continue}const I=T.node.current,k=I?new sn(u(I),I):null;T.rect.current=k,k&&E.set(T.id,k)}return E}return w},[e,s,n,h,u]);return f.useEffect(()=>{g.current=e},[e]),f.useEffect(()=>{h||p()},[n,h]),f.useEffect(()=>{s&&s.length>0&&c(null)},[JSON.stringify(s)]),f.useEffect(()=>{h||typeof a!="number"||b.current!==null||(b.current=setTimeout(()=>{p(),b.current=null},a))},[a,h,p,...r]),{droppableRects:v,measureDroppableContainers:p,measuringScheduled:s!=null};function y(){switch(d){case Je.Always:return!1;case Je.BeforeDragging:return n;default:return!n}}}function cr(e,t){return et(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function Ko(e,t){return cr(e,t)}function Jo(e){let{callback:t,disabled:n}=e;const r=nn(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 jt(e){let{callback:t,disabled:n}=e;const r=nn(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 Zo(e){return new sn(Ne(e),e)}function Tn(e,t,n){t===void 0&&(t=Zo);const[r,o]=f.useState(null);function s(){o(u=>{if(!e)return null;if(e.isConnected===!1){var d;return(d=u??n)!=null?d:null}const g=t(e);return JSON.stringify(u)===JSON.stringify(g)?u:g})}const c=Jo({callback(u){if(e)for(const d of u){const{type:g,target:h}=d;if(g==="childList"&&h instanceof HTMLElement&&h.contains(e)){s();break}}}}),a=jt({callback:s});return be(()=>{s(),e?(a?.observe(e),c?.observe(document.body,{childList:!0,subtree:!0})):(a?.disconnect(),c?.disconnect())},[e]),r}function Qo(e){const t=cr(e);return Qn(e,t)}const Mn=[];function es(e){const t=f.useRef(e),n=et(r=>e?r&&r!==Mn&&e&&t.current&&e.parentNode===t.current.parentNode?r:on(e):Mn,[e]);return f.useEffect(()=>{t.current=e},[e]),n}function ts(e){const[t,n]=f.useState(null),r=f.useRef(e),o=f.useCallback(s=>{const c=It(s.target);c&&n(a=>a?(a.set(c,Ut(c)),new Map(a)):null)},[]);return f.useEffect(()=>{const s=r.current;if(e!==s){c(s);const a=e.map(u=>{const d=It(u);return d?(d.addEventListener("scroll",o,{passive:!0}),[d,Ut(d)]):null}).filter(u=>u!=null);n(a.length?new Map(a):null),r.current=e}return()=>{c(e),c(s)};function c(a){a.forEach(u=>{const d=It(u);d?.removeEventListener("scroll",o)})}},[o,e]),f.useMemo(()=>e.length?t?Array.from(t.values()).reduce((s,c)=>$e(s,c),pe):sr(e):pe,[e,t])}function On(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 ns(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 rs(e,t){return f.useMemo(()=>e.reduce((n,r)=>{let{eventName:o,handler:s}=r;return n[o]=c=>{s(c,t)},n},{}),[e,t])}function lr(e){return f.useMemo(()=>e?Eo(e):null,[e])}const _n=[];function os(e,t){t===void 0&&(t=Ne);const[n]=e,r=lr(n?ae(n):null),[o,s]=f.useState(_n);function c(){s(()=>e.length?e.map(u=>rr(u)?r:new sn(t(u),u)):_n)}const a=jt({callback:c});return be(()=>{a?.disconnect(),c(),e.forEach(u=>a?.observe(u))},[e]),o}function ss(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return Qe(t)?t:e}function is(e){let{measure:t}=e;const[n,r]=f.useState(null),o=f.useCallback(d=>{for(const{target:g}of d)if(Qe(g)){r(h=>{const x=t(g);return h?{...h,width:x.width,height:x.height}:x});break}},[t]),s=jt({callback:o}),c=f.useCallback(d=>{const g=ss(d);s?.disconnect(),g&&s?.observe(g),r(g?t(g):null)},[t,s]),[a,u]=bt(c);return f.useMemo(()=>({nodeRef:a,rect:n,setRef:u}),[n,a,u])}const as=[{sensor:cn,options:{}},{sensor:ar,options:{}}],cs={current:{}},ht={draggable:{measure:Cn},droppable:{measure:Cn,strategy:Je.WhileDragging,frequency:qt.Optimized},dragOverlay:{measure:Ne}};class Xe 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 ls={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Xe,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:yt},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:ht,measureDroppableContainers:yt,windowRect:null,measuringScheduled:!1},us={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:yt,draggableNodes:new Map,over:null,measureDroppableContainers:yt},Rt=f.createContext(us),ur=f.createContext(ls);function ds(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Xe}}}function fs(e,t){switch(t.type){case Q.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case Q.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 Q.DragEnd:case Q.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case Q.RegisterDroppable:{const{element:n}=t,{id:r}=n,o=new Xe(e.droppable.containers);return o.set(r,n),{...e,droppable:{...e.droppable,containers:o}}}case Q.SetDroppableDisabled:{const{id:n,key:r,disabled:o}=t,s=e.droppable.containers.get(n);if(!s||r!==s.key)return e;const c=new Xe(e.droppable.containers);return c.set(n,{...s,disabled:o}),{...e,droppable:{...e.droppable,containers:c}}}case Q.UnregisterDroppable:{const{id:n,key:r}=t,o=e.droppable.containers.get(n);if(!o||r!==o.key)return e;const s=new Xe(e.droppable.containers);return s.delete(n),{...e,droppable:{...e.droppable,containers:s}}}default:return e}}function hs(e){let{disabled:t}=e;const{active:n,activatorEvent:r,draggableNodes:o}=f.useContext(Rt),s=Ht(r),c=Ht(n?.id);return f.useEffect(()=>{if(!t&&!r&&s&&c!=null){if(!rn(s)||document.activeElement===s.target)return;const a=o.get(c);if(!a)return;const{activatorNode:u,node:d}=a;if(!u.current&&!d.current)return;requestAnimationFrame(()=>{for(const g of[u.current,d.current]){if(!g)continue;const h=no(g);if(h){h.focus();break}}})}},[r,t,o,c,s]),null}function gs(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((o,s)=>s({transform:o,...r}),n):n}function ps(e){return f.useMemo(()=>({draggable:{...ht.draggable,...e?.draggable},droppable:{...ht.droppable,...e?.droppable},dragOverlay:{...ht.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function vs(e){let{activeNode:t,measure:n,initialRect:r,config:o=!0}=e;const s=f.useRef(!1),{x:c,y:a}=typeof o=="boolean"?{x:o,y:o}:o;be(()=>{if(!c&&!a||!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=Qn(g,r);if(c||(h.x=0),a||(h.y=0),s.current=!0,Math.abs(h.x)>0||Math.abs(h.y)>0){const x=er(d);x&&x.scrollBy({top:h.y,left:h.x})}},[t,c,a,r,n])}const dr=f.createContext({...pe,scaleX:1,scaleY:1});var Re;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(Re||(Re={}));const fr=f.memo(function(t){var n,r,o,s;let{id:c,accessibility:a,autoScroll:u=!0,children:d,sensors:g=as,collisionDetection:h=yo,measuring:x,modifiers:p,...b}=t;const v=f.useReducer(fs,void 0,ds),[y,w]=v,[E,T]=co(),[I,k]=f.useState(Re.Uninitialized),M=I===Re.Initialized,{draggable:{active:A,nodes:L,translate:V},droppable:{containers:F}}=y,D=A!=null?L.get(A):null,U=f.useRef({initial:null,translated:null}),G=f.useMemo(()=>{var re;return A!=null?{id:A,data:(re=D?.data)!=null?re:cs,rect:U}:null},[A,D]),$=f.useRef(null),[j,C]=f.useState(null),[O,_]=f.useState(null),N=Ke(b,Object.values(b)),z=tt("DndDescribedBy",c),m=f.useMemo(()=>F.getEnabled(),[F]),R=ps(x),{droppableRects:P,measureDroppableContainers:B,measuringScheduled:q}=Xo(m,{dragging:M,dependencies:[V.x,V.y],config:R.droppable}),X=Go(L,A),H=f.useMemo(()=>O?Wt(O):null,[O]),K=qr(),J=Ko(X,R.draggable.measure);vs({activeNode:A!=null?L.get(A):null,config:K.layoutShiftCompensation,initialRect:J,measure:R.draggable.measure});const Y=Tn(X,R.draggable.measure,J),se=Tn(X?X.parentElement:null),ne=f.useRef({activatorEvent:null,active:null,activeNode:X,collisionRect:null,collisions:null,droppableRects:P,draggableNodes:L,draggingNode:null,draggingNodeRect:null,droppableContainers:F,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),he=F.getNodeFor((n=ne.current.over)==null?void 0:n.id),xe=is({measure:R.dragOverlay.measure}),Te=(r=xe.nodeRef.current)!=null?r:X,Me=M?(o=xe.rect)!=null?o:Y:null,un=!!(xe.nodeRef.current&&xe.rect),dn=Qo(un?null:Y),Ot=lr(Te?ae(Te):null),Se=es(M?he??X:null),ot=os(Se),st=gs(p,{transform:{x:V.x-dn.x,y:V.y-dn.y,scaleX:1,scaleY:1},activatorEvent:O,active:G,activeNodeRect:Y,containerNodeRect:se,draggingNodeRect:Me,over:ne.current.over,overlayNodeRect:xe.rect,scrollableAncestors:Se,scrollableAncestorRects:ot,windowRect:Ot}),fn=H?$e(H,V):null,hn=ts(Se),Fr=On(hn),Br=On(hn,[Y]),Oe=$e(st,Fr),_e=Me?Co(Me,st):null,Pe=G&&_e?h({active:G,collisionRect:_e,droppableRects:P,droppableContainers:m,pointerCoordinates:fn}):null,gn=bo(Pe,"id"),[we,pn]=f.useState(null),Vr=un?st:$e(st,Br),Hr=So(Vr,(s=we?.rect)!=null?s:null,Y),_t=f.useRef(null),vn=f.useCallback((re,ce)=>{let{sensor:le,options:Ce}=ce;if($.current==null)return;const de=L.get($.current);if(!de)return;const ue=re.nativeEvent,ve=new le({active:$.current,activeNode:de,event:ue,options:Ce,context:ne,onAbort(te){if(!L.get(te))return;const{onDragAbort:me}=N.current,ye={id:te};me?.(ye),E({type:"onDragAbort",event:ye})},onPending(te,De,me,ye){if(!L.get(te))return;const{onDragPending:Ye}=N.current,je={id:te,constraint:De,initialCoordinates:me,offset:ye};Ye?.(je),E({type:"onDragPending",event:je})},onStart(te){const De=$.current;if(De==null)return;const me=L.get(De);if(!me)return;const{onDragStart:ye}=N.current,ze={activatorEvent:ue,active:{id:De,data:me.data,rect:U}};Ue.unstable_batchedUpdates(()=>{ye?.(ze),k(Re.Initializing),w({type:Q.DragStart,initialCoordinates:te,active:De}),E({type:"onDragStart",event:ze}),C(_t.current),_(ue)})},onMove(te){w({type:Q.DragMove,coordinates:te})},onEnd:ke(Q.DragEnd),onCancel:ke(Q.DragCancel)});_t.current=ve;function ke(te){return async function(){const{active:me,collisions:ye,over:ze,scrollAdjustedTranslate:Ye}=ne.current;let je=null;if(me&&Ye){const{cancelDrop:Fe}=N.current;je={activatorEvent:ue,active:me,collisions:ye,delta:Ye,over:ze},te===Q.DragEnd&&typeof Fe=="function"&&await Promise.resolve(Fe(je))&&(te=Q.DragCancel)}$.current=null,Ue.unstable_batchedUpdates(()=>{w({type:te}),k(Re.Uninitialized),pn(null),C(null),_(null),_t.current=null;const Fe=te===Q.DragEnd?"onDragEnd":"onDragCancel";if(je){const kt=N.current[Fe];kt?.(je),E({type:Fe,event:je})}})}}},[L]),Wr=f.useCallback((re,ce)=>(le,Ce)=>{const de=le.nativeEvent,ue=L.get(Ce);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=Ce,vn(le,ce))},[L,vn]),mn=qo(g,Wr);ns(g),be(()=>{Y&&I===Re.Initializing&&k(Re.Initialized)},[Y,I]),f.useEffect(()=>{const{onDragMove:re}=N.current,{active:ce,activatorEvent:le,collisions:Ce,over:de}=ne.current;if(!ce||!le)return;const ue={active:ce,activatorEvent:le,collisions:Ce,delta:{x:Oe.x,y:Oe.y},over:de};Ue.unstable_batchedUpdates(()=>{re?.(ue),E({type:"onDragMove",event:ue})})},[Oe.x,Oe.y]),f.useEffect(()=>{const{active:re,activatorEvent:ce,collisions:le,droppableContainers:Ce,scrollAdjustedTranslate:de}=ne.current;if(!re||$.current==null||!ce||!de)return;const{onDragOver:ue}=N.current,ve=Ce.get(gn),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(()=>{pn(ke),ue?.(te),E({type:"onDragOver",event:te})})},[gn]),be(()=>{ne.current={activatorEvent:O,active:G,activeNode:X,collisionRect:_e,collisions:Pe,droppableRects:P,draggableNodes:L,draggingNode:Te,draggingNodeRect:Me,droppableContainers:F,over:we,scrollableAncestors:Se,scrollAdjustedTranslate:Oe},U.current={initial:Me,translated:_e}},[G,X,Pe,_e,L,Te,Me,P,F,we,Se,Oe]),Ho({...K,delta:V,draggingRect:_e,pointerCoordinates:fn,scrollableAncestors:Se,scrollableAncestorRects:ot});const Ur=f.useMemo(()=>({active:G,activeNode:X,activeNodeRect:Y,activatorEvent:O,collisions:Pe,containerNodeRect:se,dragOverlay:xe,draggableNodes:L,droppableContainers:F,droppableRects:P,over:we,measureDroppableContainers:B,scrollableAncestors:Se,scrollableAncestorRects:ot,measuringConfiguration:R,measuringScheduled:q,windowRect:Ot}),[G,X,Y,O,Pe,se,xe,L,F,P,we,B,Se,ot,R,q,Ot]),Gr=f.useMemo(()=>({activatorEvent:O,activators:mn,active:G,activeNodeRect:Y,ariaDescribedById:{draggable:z},dispatch:w,draggableNodes:L,over:we,measureDroppableContainers:B}),[O,mn,G,Y,w,z,L,we,B]);return f.createElement(Jn.Provider,{value:T},f.createElement(Rt.Provider,{value:Gr},f.createElement(ur.Provider,{value:Ur},f.createElement(dr.Provider,{value:Hr},d)),f.createElement(hs,{disabled:a?.restoreFocus===!1})),f.createElement(fo,{...a,hiddenTextDescribedById:z}));function qr(){const re=j?.autoScrollEnabled===!1,ce=typeof u=="object"?u.enabled===!1:u===!1,le=M&&!re&&!ce;return typeof u=="object"?{...u,enabled:le}:{enabled:le}}}),ms=f.createContext(null),kn="button",bs="Draggable";function xs(e){let{id:t,data:n,disabled:r=!1,attributes:o}=e;const s=tt(bs),{activators:c,activatorEvent:a,active:u,activeNodeRect:d,ariaDescribedById:g,draggableNodes:h,over:x}=f.useContext(Rt),{role:p=kn,roleDescription:b="draggable",tabIndex:v=0}=o??{},y=u?.id===t,w=f.useContext(y?dr:ms),[E,T]=bt(),[I,k]=bt(),M=rs(c,t),A=Ke(n);be(()=>(h.set(t,{id:t,key:s,node:E,activatorNode:I,data:A}),()=>{const V=h.get(t);V&&V.key===s&&h.delete(t)}),[h,t]);const L=f.useMemo(()=>({role:p,tabIndex:v,"aria-disabled":r,"aria-pressed":y&&p===kn?!0:void 0,"aria-roledescription":b,"aria-describedby":g.draggable}),[r,p,v,y,b,g.draggable]);return{active:u,activatorEvent:a,activeNodeRect:d,attributes:L,isDragging:y,listeners:r?void 0:M,node:E,over:x,setNodeRef:T,setActivatorNodeRef:k,transform:w}}function ys(){return f.useContext(ur)}const Ss="Droppable",ws={timeout:25};function Cs(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:o}=e;const s=tt(Ss),{active:c,dispatch:a,over:u,measureDroppableContainers:d}=f.useContext(Rt),g=f.useRef({disabled:n}),h=f.useRef(!1),x=f.useRef(null),p=f.useRef(null),{disabled:b,updateMeasurementsFor:v,timeout:y}={...ws,...o},w=Ke(v??r),E=f.useCallback(()=>{if(!h.current){h.current=!0;return}p.current!=null&&clearTimeout(p.current),p.current=setTimeout(()=>{d(Array.isArray(w.current)?w.current:[w.current]),p.current=null},y)},[y]),T=jt({callback:E,disabled:b||!c}),I=f.useCallback((L,V)=>{T&&(V&&(T.unobserve(V),h.current=!1),L&&T.observe(L))},[T]),[k,M]=bt(I),A=Ke(t);return f.useEffect(()=>{!T||!k.current||(T.disconnect(),h.current=!1,T.observe(k.current))},[k,T]),f.useEffect(()=>(a({type:Q.RegisterDroppable,element:{id:r,key:s,disabled:n,node:k,rect:x,data:A}}),()=>a({type:Q.UnregisterDroppable,key:s,id:r})),[r]),f.useEffect(()=>{n!==g.current.disabled&&(a({type:Q.SetDroppableDisabled,id:r,key:s,disabled:n}),g.current.disabled=n)},[r,s,n,a]),{active:c,rect:x,isOver:u?.id===r,node:k,over:u,setNodeRef:M}}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 Ds(e,t){return e.reduce((n,r,o)=>{const s=t.get(r);return s&&(n[o]=s),n},Array(e.length))}function at(e){return e!==null&&e>=0}function js(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 Rs(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const ct={scaleX:1,scaleY:1},Es=e=>{var t;let{rects:n,activeNodeRect:r,activeIndex:o,overIndex:s,index:c}=e;const a=(t=n[o])!=null?t:r;if(!a)return null;const u=Ts(n,c,o);if(c===o){const d=n[s];return d?{x:o<s?d.left+d.width-(a.left+a.width):d.left-a.left,y:0,...ct}:null}return c>o&&c<=s?{x:-a.width-u,y:0,...ct}:c<o&&c>=s?{x:a.width+u,y:0,...ct}:{x:0,y:0,...ct}};function Ts(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 hr=e=>{let{rects:t,activeIndex:n,overIndex:r,index:o}=e;const s=Et(t,r,n),c=t[o],a=s[o];return!a||!c?null:{x:a.left-c.left,y:a.top-c.top,scaleX:a.width/c.width,scaleY:a.height/c.height}},lt={scaleX:1,scaleY:1},Ms=e=>{var t;let{activeIndex:n,activeNodeRect:r,index:o,rects:s,overIndex:c}=e;const a=(t=s[n])!=null?t:r;if(!a)return null;if(o===n){const d=s[c];return d?{x:0,y:n<c?d.top+d.height-(a.top+a.height):d.top-a.top,...lt}:null}const u=Os(s,o,n);return o>n&&o<=c?{x:0,y:-a.height-u,...lt}:o<n&&o>=c?{x:0,y:a.height+u,...lt}:{x:0,y:0,...lt}};function Os(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 gr="Sortable",pr=f.createContext({activeIndex:-1,containerId:gr,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:hr,disabled:{draggable:!1,droppable:!1}});function vr(e){let{children:t,id:n,items:r,strategy:o=hr,disabled:s=!1}=e;const{active:c,dragOverlay:a,droppableRects:u,over:d,measureDroppableContainers:g}=ys(),h=tt(gr,n),x=a.rect!==null,p=f.useMemo(()=>r.map(M=>typeof M=="object"&&"id"in M?M.id:M),[r]),b=c!=null,v=c?p.indexOf(c.id):-1,y=d?p.indexOf(d.id):-1,w=f.useRef(p),E=!js(p,w.current),T=y!==-1&&v===-1||E,I=Rs(s);be(()=>{E&&b&&g(p)},[E,p,b,g]),f.useEffect(()=>{w.current=p},[p]);const k=f.useMemo(()=>({activeIndex:v,containerId:h,disabled:I,disableTransforms:T,items:p,overIndex:y,useDragOverlay:x,sortedRects:Ds(p,u),strategy:o}),[v,h,I.draggable,I.droppable,T,p,y,u,x,o]);return f.createElement(pr.Provider,{value:k},t)}const _s=e=>{let{id:t,items:n,activeIndex:r,overIndex:o}=e;return Et(n,r,o).indexOf(t)},ks=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:o,items:s,newIndex:c,previousItems:a,previousContainerId:u,transition:d}=e;return!d||!r||a!==s&&o===c?!1:n?!0:c!==o&&t===u},$s={duration:200,easing:"ease"},mr="transform",Is=Ie.Transition.toString({property:mr,duration:0,easing:"linear"}),As={roleDescription:"sortable"};function Ls(e){let{disabled:t,index:n,node:r,rect:o}=e;const[s,c]=f.useState(null),a=f.useRef(n);return be(()=>{if(!t&&n!==a.current&&r.current){const u=o.current;if(u){const d=Ne(r.current,{ignoreTransform:!0}),g={x:u.left-d.left,y:u.top-d.top,scaleX:u.width/d.width,scaleY:u.height/d.height};(g.x||g.y)&&c(g)}}n!==a.current&&(a.current=n)},[t,n,r,o]),f.useEffect(()=>{s&&c(null)},[s]),s}function br(e){let{animateLayoutChanges:t=ks,attributes:n,disabled:r,data:o,getNewIndex:s=_s,id:c,strategy:a,resizeObserverConfig:u,transition:d=$s}=e;const{items:g,containerId:h,activeIndex:x,disabled:p,disableTransforms:b,sortedRects:v,overIndex:y,useDragOverlay:w,strategy:E}=f.useContext(pr),T=Ns(r,p),I=g.indexOf(c),k=f.useMemo(()=>({sortable:{containerId:h,index:I,items:g},...o}),[h,o,I,g]),M=f.useMemo(()=>g.slice(g.indexOf(c)),[g,c]),{rect:A,node:L,isOver:V,setNodeRef:F}=Cs({id:c,data:k,disabled:T.droppable,resizeObserverConfig:{updateMeasurementsFor:M,...u}}),{active:D,activatorEvent:U,activeNodeRect:G,attributes:$,setNodeRef:j,listeners:C,isDragging:O,over:_,setActivatorNodeRef:N,transform:z}=xs({id:c,data:k,attributes:{...As,...n},disabled:T.draggable}),m=Zr(F,j),R=!!D,P=R&&!b&&at(x)&&at(y),B=!w&&O,q=B&&P?z:null,H=P?q??(a??E)({rects:v,activeNodeRect:G,activeIndex:x,overIndex:y,index:I}):null,K=at(x)&&at(y)?s({id:c,items:g,activeIndex:x,overIndex:y}):I,J=D?.id,Y=f.useRef({activeId:J,items:g,newIndex:K,containerId:h}),se=g!==Y.current.items,ne=t({active:D,containerId:h,isDragging:O,isSorting:R,id:c,index:I,items:g,newIndex:Y.current.newIndex,previousItems:Y.current.items,previousContainerId:Y.current.containerId,transition:d,wasDragging:Y.current.activeId!=null}),he=Ls({disabled:!ne,index:I,node:L,rect:A});return f.useEffect(()=>{R&&Y.current.newIndex!==K&&(Y.current.newIndex=K),h!==Y.current.containerId&&(Y.current.containerId=h),g!==Y.current.items&&(Y.current.items=g)},[R,K,h,g]),f.useEffect(()=>{if(J===Y.current.activeId)return;if(J!=null&&Y.current.activeId==null){Y.current.activeId=J;return}const Te=setTimeout(()=>{Y.current.activeId=J},50);return()=>clearTimeout(Te)},[J]),{active:D,activeIndex:x,attributes:$,data:k,rect:A,index:I,newIndex:K,items:g,isOver:V,isSorting:R,isDragging:O,listeners:C,node:L,overIndex:y,over:_,setNodeRef:m,setActivatorNodeRef:N,setDroppableNodeRef:F,setDraggableNodeRef:j,transform:he??H,transition:xe()};function xe(){if(he||se&&Y.current.newIndex===I)return Is;if(!(B&&!rn(U)||!d)&&(R||ne))return Ie.Transition.toString({...d,property:mr})}}function Ns(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}}W.Down,W.Right,W.Up,W.Left;var ut={exports:{}},Nt={},dt={exports:{}},Pt={};var $n;function Ps(){if($n)return Pt;$n=1;var e=f;function t(h,x){return h===x&&(h!==0||1/h===1/x)||h!==h&&x!==x}var n=typeof Object.is=="function"?Object.is:t,r=e.useState,o=e.useEffect,s=e.useLayoutEffect,c=e.useDebugValue;function a(h,x){var p=x(),b=r({inst:{value:p,getSnapshot:x}}),v=b[0].inst,y=b[1];return s(function(){v.value=p,v.getSnapshot=x,u(v)&&y({inst:v})},[h,p,x]),o(function(){return u(v)&&y({inst:v}),h(function(){u(v)&&y({inst:v})})},[h]),c(p),p}function u(h){var x=h.getSnapshot;h=h.value;try{var p=x();return!n(h,p)}catch{return!0}}function d(h,x){return x()}var g=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?d:a;return Pt.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:g,Pt}var zt={};var In;function zs(){return In||(In=1,process.env.NODE_ENV!=="production"&&(function(){function e(p,b){return p===b&&(p!==0||1/p===1/b)||p!==p&&b!==b}function t(p,b){g||o.startTransition===void 0||(g=!0,console.error("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));var v=b();if(!h){var y=b();s(v,y)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),h=!0)}y=c({inst:{value:v,getSnapshot:b}});var w=y[0].inst,E=y[1];return u(function(){w.value=v,w.getSnapshot=b,n(w)&&E({inst:w})},[p,v,b]),a(function(){return n(w)&&E({inst:w}),p(function(){n(w)&&E({inst:w})})},[p]),d(v),v}function n(p){var b=p.getSnapshot;p=p.value;try{var v=b();return!s(p,v)}catch{return!0}}function r(p,b){return b()}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var o=f,s=typeof Object.is=="function"?Object.is:e,c=o.useState,a=o.useEffect,u=o.useLayoutEffect,d=o.useDebugValue,g=!1,h=!1,x=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?r:t;zt.useSyncExternalStore=o.useSyncExternalStore!==void 0?o.useSyncExternalStore:x,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()),zt}var An;function xr(){return An||(An=1,process.env.NODE_ENV==="production"?dt.exports=Ps():dt.exports=zs()),dt.exports}var Ln;function Ys(){if(Ln)return Nt;Ln=1;var e=f,t=xr();function n(d,g){return d===g&&(d!==0||1/d===1/g)||d!==d&&g!==g}var r=typeof Object.is=="function"?Object.is:n,o=t.useSyncExternalStore,s=e.useRef,c=e.useEffect,a=e.useMemo,u=e.useDebugValue;return Nt.useSyncExternalStoreWithSelector=function(d,g,h,x,p){var b=s(null);if(b.current===null){var v={hasValue:!1,value:null};b.current=v}else v=b.current;b=a(function(){function w(M){if(!E){if(E=!0,T=M,M=x(M),p!==void 0&&v.hasValue){var A=v.value;if(p(A,M))return I=A}return I=M}if(A=I,r(T,M))return A;var L=x(M);return p!==void 0&&p(A,L)?(T=M,A):(T=M,I=L)}var E=!1,T,I,k=h===void 0?null:h;return[function(){return w(g())},k===null?void 0:function(){return w(k())}]},[g,h,x,p]);var y=o(d,b[0],b[1]);return c(function(){v.hasValue=!0,v.value=y},[y]),u(y),y},Nt}var Yt={};var Nn;function Fs(){return Nn||(Nn=1,process.env.NODE_ENV!=="production"&&(function(){function e(d,g){return d===g&&(d!==0||1/d===1/g)||d!==d&&g!==g}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var t=f,n=xr(),r=typeof Object.is=="function"?Object.is:e,o=n.useSyncExternalStore,s=t.useRef,c=t.useEffect,a=t.useMemo,u=t.useDebugValue;Yt.useSyncExternalStoreWithSelector=function(d,g,h,x,p){var b=s(null);if(b.current===null){var v={hasValue:!1,value:null};b.current=v}else v=b.current;b=a(function(){function w(M){if(!E){if(E=!0,T=M,M=x(M),p!==void 0&&v.hasValue){var A=v.value;if(p(A,M))return I=A}return I=M}if(A=I,r(T,M))return A;var L=x(M);return p!==void 0&&p(A,L)?(T=M,A):(T=M,I=L)}var E=!1,T,I,k=h===void 0?null:h;return[function(){return w(g())},k===null?void 0:function(){return w(k())}]},[g,h,x,p]);var y=o(d,b[0],b[1]);return c(function(){v.hasValue=!0,v.value=y},[y]),u(y),y},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()),Yt}var Pn;function Bs(){return Pn||(Pn=1,process.env.NODE_ENV==="production"?ut.exports=Ys():ut.exports=Fs()),ut.exports}var Vs=Bs();const Xt=new WeakMap,Hs=new WeakMap,wt={current:[]};let Ft=!1;const ft=new Set,zn=new Map;function yr(e){for(const t of e){if(wt.current.includes(t))continue;wt.current.push(t),t.recompute();const n=Hs.get(t);if(n)for(const r of n){const o=Xt.get(r);o?.length&&yr(o)}}}function Ws(e){const t={prevVal:e.prevState,currentVal:e.state};for(const n of e.listeners)n(t)}function Us(e){const t={prevVal:e.prevState,currentVal:e.state};for(const n of e.listeners)n(t)}function Gs(e){if(ft.add(e),!Ft)try{for(Ft=!0;ft.size>0;){const t=Array.from(ft);ft.clear();for(const n of t){const r=zn.get(n)??n.prevState;n.prevState=r,Ws(n)}for(const n of t){const r=Xt.get(n);r&&(wt.current.push(n),yr(r))}for(const n of t){const r=Xt.get(n);if(r)for(const o of r)Us(o)}}}finally{Ft=!1,wt.current=[],zn.clear()}}function qs(e){return typeof e=="function"}class Sr{constructor(t,n){this.listeners=new Set,this.subscribe=r=>{var o,s;this.listeners.add(r);const c=(s=(o=this.options)==null?void 0:o.onSubscribe)==null?void 0:s.call(o,r,this);return()=>{this.listeners.delete(r),c?.()}},this.prevState=t,this.state=t,this.options=n}setState(t){var n,r,o;this.prevState=this.state,(n=this.options)!=null&&n.updateFn?this.state=this.options.updateFn(this.prevState)(t):qs(t)?this.state=t(this.prevState):this.state=t,(o=(r=this.options)==null?void 0:r.onUpdate)==null||o.call(r),Gs(this)}}function nt(e,t=r=>r,n={}){const r=n.equal??Xs;return Vs.useSyncExternalStoreWithSelector(e.subscribe,()=>e.state,()=>e.state,t,r)}function Xs(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[r,o]of e)if(!t.has(r)||!Object.is(o,t.get(r)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const r of e)if(!t.has(r))return!1;return!0}if(e instanceof Date&&t instanceof Date)return e.getTime()===t.getTime();const n=Yn(e);if(n.length!==Yn(t).length)return!1;for(let r=0;r<n.length;r++)if(!Object.prototype.hasOwnProperty.call(t,n[r])||!Object.is(e[n[r]],t[n[r]]))return!1;return!0}function Yn(e){return Object.keys(e).concat(Object.getOwnPropertySymbols(e))}const ie=new Sr({tableId:"",sortColumn:null,sortDirection:"asc",visibility:{},columnOrder:[],data:[],sortableColumns:[],actionsConfig:{showActionColumn:!0,showColumnVisibilityMenu:!0,children:"Actions",width:"100px"}});function wr(e,t){const n=e[0]??{},o=(t&&t.length?t:Object.keys(n).map(g=>({id:g,label:g}))).filter(g=>Object.prototype.hasOwnProperty.call(n,g.id)),{tableId:s}=ie.state,c=JSON.parse(localStorage.getItem(jr(s))||"[]"),a=[...c.map(g=>o.find(h=>h.id===g)).filter(Boolean),...o.filter(g=>!c.includes(g.id))],u=JSON.parse(localStorage.getItem(Rr(s))||"{}"),d=a.reduce((g,h)=>(g[h.id]=u[h.id]??!0,g),{});ie.setState(g=>({...g,data:e,columnOrder:a,visibility:d,sortableColumns:a.map(h=>({id:h.id,label:h.label,sortable:!0,backgroundColor:h.backgroundColor}))}))}function Cr(e){ie.setState(t=>({...t,tableId:e,sortColumn:null,sortDirection:"asc",columnOrder:[],visibility:{}}))}const Dr=e=>{ie.setState(t=>({...t,actionsConfig:e}))},jr=e=>`table_column_order_v1:${e}`,Rr=e=>`table_column_visibility_v1:${e}`,Ks=e=>{const{tableId:t}=ie.state;localStorage.setItem(jr(t),JSON.stringify(e.map(n=>n.id))),ie.setState(n=>({...n,columnOrder:e})),ie.setState(n=>({...n,columnOrder:e}))};function Js(e){ie.setState(t=>t.sortColumn===e?{...t,sortDirection:t.sortDirection==="asc"?"desc":"asc"}:{...t,sortColumn:e,sortDirection:"asc"})}const Zs=e=>{ie.setState(t=>{const n={...t.visibility,[e]:!t.visibility[e]};return t.tableId&&localStorage.setItem(Rr(t.tableId),JSON.stringify(n)),{...t,visibility:n}})};const Qs=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),ei=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,r)=>r?r.toUpperCase():n.toLowerCase()),Fn=e=>{const t=ei(e);return t.charAt(0).toUpperCase()+t.slice(1)},Er=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim(),ti=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0};var ni={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 ri=f.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:o="",children:s,iconNode:c,...a},u)=>f.createElement("svg",{ref:u,...ni,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:Er("lucide",o),...!s&&!ti(a)&&{"aria-hidden":"true"},...a},[...c.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(ri,{ref:s,iconNode:t,className:Er(`lucide-${Qs(Fn(e))}`,`lucide-${e}`,r),...o}));return n.displayName=Fn(e),n};const oi=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],si=oe("arrow-down",oi);const ii=[["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"}]],ai=oe("arrow-up-down",ii);const ci=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],li=oe("arrow-up",ci);const ui=[["path",{d:"m19 21-7-4-7 4V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v16z",key:"1fy3hk"}]],di=oe("bookmark",ui);const fi=[["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"}]],Bn=oe("calendar",fi);const hi=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],gi=oe("chevron-left",hi);const pi=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],vi=oe("chevron-right",pi);const mi=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 3v18",key:"108xh3"}]],bi=oe("columns-2",mi);const xi=[["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"}]],yi=oe("delete",xi);const Si=[["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"}]],wi=oe("ellipsis",Si);const Ci=[["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"}]],Di=oe("funnel",Ci);const ji=[["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"}]],Tr=oe("grip-vertical",ji);const Ri=[["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"}]],Ei=oe("pen",Ri);const Ti=[["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"}]],Mi=oe("refresh-ccw",Ti);const Oi=[["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"}]],_i=oe("settings",Oi);const ki=[["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"}]],Mr=oe("triangle-alert",ki);function S(e){return f.forwardRef((t,n)=>{const{children:r,...o}=t;return i.jsx(e,{ref:n,...o,children:r})})}const $i=S(l.Menu.Trigger),Ii=S(l.Menu.Positioner),Ai=S(l.Menu.Content),Li=S(l.Menu.Item),Ni=S(l.Checkbox.Label),Pi=S(l.Checkbox.HiddenInput),zi=S(l.Checkbox.Control);function Yi({visibility:e,onToggle:t}){const{sortableColumns:n}=nt(ie);return i.jsxs(l.Menu.Root,{closeOnSelect:!1,children:[i.jsx($i,{asChild:!0,children:i.jsx(l.IconButton,{"aria-label":"Toggle columns",variant:"ghost",ml:"1",size:"xs",children:i.jsx(bi,{size:18})})}),i.jsx(l.Portal,{children:i.jsx(Ii,{children:i.jsx(Ai,{minW:"220px",children:n.map(r=>{const o=!!e[r.id];return i.jsx(Li,{value:r.id,closeOnSelect:!1,children:i.jsxs(l.Checkbox.Root,{checked:o,onCheckedChange:()=>t(r.id),children:[i.jsx(Pi,{}),i.jsx(zi,{}),i.jsx(Ni,{children:r.label})]})},r.id)})})})})]})}function Fi({id:e,children:t,onClick:n,cursor:r,borderRight:o,borderRightColor:s,backgroundColor:c}){const{setNodeRef:a,attributes:u,listeners:d,transform:g,transition:h}=br({id:e});return i.jsx(l.Table.ColumnHeader,{ref:a,onClick:n,backgroundColor:c,w:e==="id"||e==="row_number"?"80px":void 0,style:{transform:Ie.Transform.toString(g),transition:h,cursor:r,borderRight:o,borderRightColor:s},...u,children:i.jsxs(l.HStack,{justify:"space-between",children:[t,i.jsx("span",{...d,children:i.jsx(Tr,{size:12})})]})})}function Bi(){const{columnOrder:e,visibility:t,sortColumn:n,sortDirection:r,sortableColumns:o,actionsConfig:s}=nt(ie),c=e.map(a=>o.find(u=>u.id===a.id)).filter(a=>a!==void 0).filter(a=>t[a.id]);return i.jsx(l.Table.Header,{background:"blue.200",position:"sticky",top:0,p:"0",zIndex:1,children:i.jsxs(l.Table.Row,{height:"28px",children:[c.map(a=>{const u=n===a?.id;return i.jsx(Fi,{id:a?.id,onClick:()=>a?.sortable&&Js(a?.id),cursor:a?.sortable?"pointer":"default",borderRight:"2px solid #dcdcdc",backgroundColor:a?.backgroundColor,children:i.jsxs("span",{style:{display:"flex",alignItems:"center",gap:6,userSelect:"none"},children:[a?.label,a?.sortable&&(u?r==="asc"?i.jsx(li,{size:14}):i.jsx(si,{size:14}):i.jsx(ai,{size:14,opacity:.4}))]})},a?.id)}),s?.showActionColumn&&i.jsx(l.Table.ColumnHeader,{width:s.width,backgroundColor:s.backgroundColor,borderRight:"2px solid #dcdcdc",children:s.children}),s?.showColumnVisibilityMenu&&i.jsx(l.Table.ColumnHeader,{boxSize:"0.5",backgroundColor:s.backgroundColorColumnVisibilityMenu,children:i.jsx(Yi,{visibility:t,onToggle:Zs})})]})})}const Vi=[10,20,50,100],Hi=S(l.Select.Positioner),Wi=S(l.Select.Content),Ui=S(l.Select.Item),Gi=S(l.Pagination.PrevTrigger),qi=S(l.Pagination.NextTrigger),Xi=S(l.Select.HiddenSelect),Ki=S(l.Select.Control),Ji=S(l.Select.Trigger),Zi=S(l.Select.ValueText),Qi=S(l.Select.IndicatorGroup),ea=S(l.Select.Indicator);function ta({totalCount:e,pageSize:t,currentPage:n,onPageChange:r,onPageSizeChange:o,siblingCount:s=2,pageSizeOptions:c=Vi}){const a=l.createListCollection({items:c.map(u=>({label:String(u),value:String(u)}))});return i.jsx(l.Box,{width:"100%",children:i.jsxs(l.HStack,{justify:"space-between",mx:"auto",flexWrap:"wrap",children:[i.jsxs(l.HStack,{children:[i.jsx(l.Text,{fontSize:"sm",color:"gray.600",_dark:{color:"gray.400"},children:"Rows per page:"}),i.jsxs(l.Select.Root,{collection:a,size:"sm",width:"60px",onValueChange:u=>o?.(Number(u.items[0].value)),value:[String(t)],children:[i.jsx(Xi,{}),i.jsxs(Ki,{children:[i.jsx(Ji,{children:i.jsx(Zi,{placeholder:""})}),i.jsx(Qi,{children:i.jsx(ea,{})})]}),i.jsx(l.Portal,{children:i.jsx(Hi,{children:i.jsx(Wi,{children:a.items.map(u=>i.jsxs(Ui,{item:u.value,children:[u.label,i.jsx(l.Select.ItemIndicator,{})]},u.value))})})})]})]}),i.jsx(l.Pagination.Root,{count:e,pageSize:t,page:n,siblingCount:s,onPageChange:u=>r&&r(u.page),children:i.jsxs(l.ButtonGroup,{size:"sm",variant:"ghost",children:[i.jsx(Gi,{asChild:!0,children:i.jsx(l.IconButton,{"aria-label":"Previous page",children:i.jsx(gi,{size:18})})}),i.jsx(l.Pagination.Items,{render:u=>i.jsx(l.IconButton,{variant:u.type==="page"&&u.value===n?"outline":"ghost","aria-current":u.type==="page"&&u.value===n?"page":void 0,children:u.type==="page"?u.value:"…"},u.value??u.type)}),i.jsx(qi,{asChild:!0,children:i.jsx(l.IconButton,{"aria-label":"Next page",children:i.jsx(vi,{size:18})})})]})})]})})}const na=S(l.Menu.Item),ra=S(l.Menu.Content),oa=S(l.Menu.Positioner),sa=S(l.Menu.Trigger);function ia({data:e=[],actions:t=[],actionConfig:n,onRowSelect:r}){const{columnOrder:o,visibility:s}=nt(ie);return i.jsx(l.Table.Body,{children:e.map(c=>i.jsxs(l.Table.Row,{onClick:()=>r?.(c.__raw),_hover:{bg:"blue.50"},children:[o.filter(a=>s[a.id]).map(a=>i.jsx(l.Table.Cell,{children:c[a.id]},a.id)),n?.showActionColumn&&i.jsx(l.Table.Cell,{textAlign:"center",display:"flex",gap:2,children:i.jsxs(l.Menu.Root,{children:[i.jsx(sa,{asChild:!0,children:i.jsx(l.IconButton,{"aria-label":"Open",variant:"ghost",size:"sm",children:i.jsx(wi,{size:16})})}),i.jsx(l.Portal,{children:i.jsx(oa,{children:i.jsx(ra,{children:t.filter(a=>typeof a.visible=="function"?a.visible(c.__raw):a.visible!==!1).map(a=>i.jsxs(na,{onClick:()=>a.onClick(c.__raw),colorScheme:a.colorScheme,value:a.label,children:[a.icon,a.label]},a.label))})})})]})}),n?.showColumnVisibilityMenu&&i.jsx(l.Table.Cell,{})]},c.__key||c.id))})}function aa({rows:e=6,columns:t}){return i.jsx(l.Table.Body,{children:Array.from({length:e}).map((n,r)=>i.jsx(l.Table.Row,{children:Array.from({length:t}).map((o,s)=>i.jsx(l.Table.Cell,{children:i.jsx(l.Skeleton,{height:"25px"})},s))},r))})}function ca({tableId:e,data:t=[],headers:n=[],loading:r=!1,loadingChildren:o,skeletonLoading:s=!1,emptyMessage:c="No data",actions:a,page:u=1,pageSize:d=10,onPageChange:g,onPageSizeChange:h,density:x="sm",totalCount:p=0,paginationMode:b="client",actionConfig:v,pageSizeOptions:y,onRowSelect:w}){f.useEffect(()=>{Cr(e)},[e]),f.useEffect(()=>{wr(t,n)},[t,n]),f.useEffect(()=>{v&&Dr(v)},[v]);const{sortColumn:E,sortDirection:T,data:I,columnOrder:k}=nt(ie),M=f.useMemo(()=>{const D=[...I],U=Math.max(1,u||1);if(E&&D.sort((G,$)=>T==="asc"?String(G[E]).localeCompare(String($[E])):String($[E]).localeCompare(String(G[E]))),b==="client"){const G=(U-1)*d;return D.slice(G,G+d)}return D},[I,E,T,u,d,b]);f.useEffect(()=>{u<1&&g&&g(1)},[u,g]);const A=D=>{const{active:U,over:G}=D;if(!G||U.id===G.id)return;const $=k.findIndex(O=>O.id===U.id),j=k.findIndex(O=>O.id===G.id),C=Et(k,$,j);Ks(C)},L=r&&!s,V=s&&!r,F=!r&&!s&&M.length===0;return i.jsx(fr,{collisionDetection:Zn,onDragEnd:A,children:i.jsx(vr,{items:k.map(D=>D.id),strategy:Es,children:i.jsxs(l.Box,{flex:"1",minH:0,display:"flex",flexDirection:"column",p:2,children:[i.jsxs(l.Box,{flex:"1",minH:0,position:"relative",overflow:"auto",children:[L&&i.jsx(l.Box,{position:"absolute",inset:0,display:"flex",alignItems:"center",justifyContent:"center",zIndex:10,bg:"whiteAlpha.600",children:o??i.jsx(l.Spinner,{})}),i.jsxs(l.Table.Root,{variant:"outline",w:"100%",size:x,children:[i.jsx(Bi,{}),V?i.jsx(aa,{rows:d,columns:n.length+(a?2:0)}):F?i.jsx(l.Table.Body,{children:i.jsx(l.Table.Row,{children:i.jsx(l.Table.Cell,{colSpan:n.length+(a?1:0),children:i.jsx(l.Box,{display:"flex",alignItems:"center",justifyContent:"center",minH:"200px",color:"gray.500",children:c})})})}):i.jsx(ia,{data:M,actions:a,actionConfig:v,onRowSelect:w})]})]}),i.jsx(l.Box,{mt:.5,children:i.jsx(ta,{totalCount:p,pageSize:d,currentPage:u,onPageChange:g,onPageSizeChange:D=>{h?.(D),u>1&&g?.(1)},pageSizeOptions:y})})]})})})}const la=S(l.Checkbox.Root),ua=S(l.Checkbox.HiddenInput),da=S(l.Checkbox.Control),fa=S(l.Checkbox.Label),Or=({value:e,onChange:t,size:n="sm",label:r,helperText:o,isDisabled:s,required:c,errorText:a})=>i.jsxs(la,{value:e,onChange:t,size:n,children:[i.jsx(ua,{}),i.jsx(da,{disabled:s,required:c,errorText:a,helperText:o}),r&&i.jsx(fa,{children:r})]}),ha=S(l.Combobox.Root),ga=S(l.Combobox.Control),pa=S(l.Combobox.Input),va=S(l.Combobox.IndicatorGroup),ma=S(l.Combobox.ClearTrigger),ba=S(l.Combobox.Trigger),xa=S(l.Combobox.Positioner),ya=S(l.Combobox.Content);function _r({label:e,size:t="sm",width:n="100%",variant:r="outline",items:o=[],itemToString:s,itemToValue:c,renderItem:a,value:u,loading:d,error:g,errorMessage:h,placeholder:x,helpText:p,onInputChange:b,onSelect:v,visible:y=!0,rootProps:w,inputProps:E,controlProps:T,contentProps:I,itemProps:k}){const[M,A]=f.useState(""),{collection:L,set:V}=l.useListCollection({initialItems:o,itemToString:s,itemToValue:c}),F=f.useMemo(()=>{if(!M)return o;const D=M.toLowerCase();return o.filter(U=>s(U).toLowerCase().includes(D))},[o,M,s]);return f.useEffect(()=>{V(F)},[F,V]),f.useEffect(()=>{u&&A(s(u))},[u,s]),i.jsxs(ha,{width:n,size:t,variant:r,collection:L,placeholder:x,onInputValueChange:D=>{b?.(D.inputValue),A(D.inputValue)},value:u?[c(u)]:[],onValueChange:D=>{const U=D.value?.[0];if(!U)return;const G=L.items.find($=>c($)===U);G&&v?.(G)},positioning:{sameWidth:!1,placement:"bottom-start"},...w,children:[y&&e&&i.jsx(l.Text,{fontSize:"sm",children:e}),i.jsxs(ga,{...T,children:[i.jsx(pa,{placeholder:x??"Type to search",...E}),i.jsxs(va,{children:[i.jsx(ma,{}),i.jsx(ba,{})]})]}),i.jsx(xa,{children:i.jsxs(ya,{minW:"sm",...I,children:[d?i.jsxs(l.HStack,{p:"2",children:[i.jsx(l.Spinner,{size:"xs",borderWidth:"1px"}),i.jsx(l.Span,{children:"Loading..."})]}):g?i.jsx(l.Text,{p:"2",color:"red.500",fontSize:"sm",children:h||"Something went wrong"}):L.items.map(D=>i.jsxs(l.Combobox.Item,{item:D,...k,children:[a(D),i.jsx(l.Combobox.ItemIndicator,{})]},c(D))),p&&!g&&!d&&i.jsx(l.Text,{p:"2",color:"fg.muted",fontSize:"sm",children:p})]})})]})}const Z=" to ",Vn=10,Ee={DAY_MAX:31,MONTH_MAX:12,YEAR_MIN:1900,YEAR_MAX:2100},ln=()=>{const e=new Date;return{year:e.getFullYear(),month:e.getMonth()+1,day:e.getDate()}},Hn=()=>{const{year:e,month:t,day:n}=ln();return`${String(n).padStart(2,"0")}-${String(t).padStart(2,"0")}-${e}`},Sa=()=>{const{year:e,month:t,day:n}=ln();return`${e}-${String(t).padStart(2,"0")}-${String(n).padStart(2,"0")}`},wa=(e,t)=>{const n=e.length,r=parseInt(e);if(!e||isNaN(r))return t;if(n===4)return r>=Ee.YEAR_MIN&&r<=Ee.YEAR_MAX?r:t;if(n>0&&n<4){const o=t.toString(),s=4-n,c=o.substring(0,s);return parseInt(c+e)}return t},He=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}=ln();let c,a,u;return n.length===1?(c=parseInt(n[0])||s,a=o,u=r):n.length===2?(c=parseInt(n[0])||s,a=parseInt(n[1])||o,u=r):(c=parseInt(n[0])||s,a=parseInt(n[1])||o,u=wa(n[2],r)),a=Math.max(1,Math.min(Ee.MONTH_MAX,a)),c=Math.max(1,Math.min(Ee.DAY_MAX,c)),`${u}-${String(a).padStart(2,"0")}-${String(c).padStart(2,"0")}`},ge=e=>{if(!e)return"";const[t,n,r]=e.split("-");return`${r}-${n}-${t}`},Ca=(e,t)=>{if(e[0]?.length>0){const n=parseInt(e[0]);if(isNaN(n)||n===0||e[0].length===2&&n>Ee.DAY_MAX)return t}if(e[1]?.length>0){const n=parseInt(e[1]);if(isNaN(n)||n===0||e[1].length===2&&n>Ee.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<Ee.YEAR_MIN||n>Ee.YEAR_MAX))return t}return null},We=e=>{let t=e.replace(/[^\d-]/g,"").substring(0,Vn);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,Vn),Ca(n,e)||t},Da=S(l.Popover.Root),ja=S(l.Popover.Trigger),Ra=S(l.Popover.Content),Ea=S(l.Popover.Positioner);function Ta({value:e,onChange:t,disabled:n=!1}){const[r="",o=""]=e?e.split("|"):[],[s,c]=f.useState(()=>r&&o?`${ge(r)}${Z}${ge(o)}`:r?ge(r):""),[a,u]=f.useState(!1),d=f.useRef(null);f.useEffect(()=>{const b=v=>{v.ctrlKey&&v.key==="d"&&!v.shiftKey&&!v.metaKey&&(v.preventDefault(),d.current?.focus())};return window.addEventListener("keydown",b),()=>window.removeEventListener("keydown",b)},[]);const g=b=>{let v=b;if(v.includes(Z)){const[y,w=""]=v.split(Z);v=`${We(y.trim())}${Z}${We(w.trim())}`}else if(v.toLowerCase().includes(" to ")){const[y,w=""]=v.split(/\s+to\s+/i);v=`${We(y.trim())} to ${We(w.trim())}`}else v=We(v);c(v)},h=()=>{const b=s.trim();if(!b){t(void 0);return}if(b.includes(Z)){const[v,y=""]=b.split(Z).map(T=>T.trim()),w=He(v),E=y?He(y):null;if(w&&E){const[T,I]=E<w?[E,w]:[w,E],k=`${ge(T)}${Z}${ge(I)}`;c(k),t(`${T}|${I}`)}else if(w&&!y)c(`${ge(w)}${Z}`),t(void 0);else if(w&&y){const T=Sa(),[I,k]=T<w?[T,w]:[w,T],M=`${ge(I)}${Z}${ge(k)}`;c(M),t(`${I}|${k}`)}else c(""),t(void 0)}else{const v=He(b);v?(c(`${ge(v)}${Z}`),t(void 0)):(c(""),t(void 0))}},x=b=>{if(b.key!=="Enter")return;b.preventDefault();const v=d.current?.selectionStart||0,y=s.indexOf(Z);if(!s.trim()){c(`${Hn()}${Z}`);return}if(y===-1){const E=He(s.trim());E&&c(`${ge(E)}${Z}`);return}if(v<=y+Z.length){const E=s.substring(0,y).trim(),T=s.substring(y+Z.length),I=He(E);I&&c(`${ge(I)}${Z}${T}`);return}if(s.substring(y+Z.length).trim())h(),d.current?.blur();else{const E=s.substring(0,y+Z.length)+Hn();c(E),setTimeout(()=>{h(),d.current?.blur()},0)}},p=()=>{c(""),t(void 0)};return i.jsx(l.InputGroup,{children:i.jsx(i.Fragment,{children:i.jsxs(l.InputElement,{position:"revert",children:[i.jsxs(Da,{open:a,onEscapeKeyDown:()=>{u(!1)},children:[i.jsx(ja,{asChild:!0,children:i.jsx(l.IconButton,{size:"sm",variant:"ghost","aria-label":"Date range help",onClick:()=>u(b=>!b),children:i.jsx(Bn,{size:16})})}),i.jsx(l.Portal,{children:i.jsx(Ea,{children:i.jsxs(Ra,{p:4,children:[i.jsx(l.PopoverArrow,{}),i.jsxs(l.VStack,{align:"start",gap:4,children:[i.jsxs(l.HStack,{children:[i.jsx(Bn,{size:16}),i.jsx(l.Text,{fontWeight:"semibold",fontSize:"sm",children:"Date Range Filter"})]}),i.jsxs(l.VStack,{align:"start",gap:1,children:[i.jsx(l.Text,{fontSize:"sm",fontWeight:"medium",children:"Format:"}),i.jsxs(l.Text,{fontSize:"xs",color:"gray.600",children:["DD-MM-YYYY",Z,"DD-MM-YYYY"]})]}),i.jsxs(l.VStack,{align:"start",gap:1,children:[i.jsx(l.Text,{fontSize:"sm",fontWeight:"medium",children:"Tips:"}),i.jsx(l.Text,{fontSize:"xs",children:'• "15 to 20" → assumes current month/year'}),i.jsx(l.Text,{fontSize:"xs",children:"• Leave end blank → up to today"}),i.jsx(l.Text,{fontSize:"xs",children:"• Dates auto-swapped if reversed"}),i.jsx(l.Text,{fontSize:"xs",children:"• Press Enter on empty end → fills today"})]}),i.jsxs(l.VStack,{align:"start",gap:1,children:[i.jsx(l.Text,{fontSize:"sm",fontWeight:"medium",children:"Shortcut:"}),i.jsxs(l.HStack,{children:[i.jsx(l.Kbd,{children:"Ctrl"}),i.jsx(l.Text,{children:"+"}),i.jsx(l.Kbd,{children:"D"})]})]})]})]})})})]}),i.jsx(l.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(l.InputElement,{children:i.jsx(l.IconButton,{size:"sm",variant:"ghost","aria-label":"Clear date range",onClick:p,w:"100%"})})]})})})}const Ma=S(l.Field.Root),Oa=S(l.Field.Label),_a=S(l.Field.HelperText),ka=S(l.Field.ErrorText),Kt=({icon:e,value:t,onChange:n,placeholder:r,size:o="xs",variant:s="outline",width:c="100%",label:a,helperText:u,isDisabled:d=!1,required:g=!1,errorText:h,visible:x})=>i.jsxs(Ma,{width:c,children:[x&&i.jsx(Oa,{children:a}),i.jsx(l.InputGroup,{startElement:e,children:i.jsx(l.Input,{value:t,onChange:p=>n?.(p.target.value),placeholder:r,size:o,variant:s,disabled:d,required:g})}),h&&i.jsx(ka,{fontSize:"xs",children:h}),u&&i.jsx(_a,{fontSize:"xs",children:u})]}),$a=S(l.Field.Root),Ia=S(l.Field.HelperText),Aa=S(l.Field.ErrorText),La=S(l.Select.Root),Na=S(l.Select.Label),Pa=S(l.Select.Control),za=S(l.Select.Trigger),Ya=S(l.Select.ValueText),Fa=S(l.Select.IndicatorGroup),Ba=S(l.Select.Indicator),Va=S(l.Select.Content),Ha=S(l.Select.Item),Wa=S(l.Select.ItemIndicator),Ua=S(l.Select.HiddenSelect),Ga=S(l.Select.Positioner),kr=({options:e=[],label:t,value:n,onChange:r,placeholder:o,size:s="xs",width:c="100%",variant:a="outline",helperText:u,isDisabled:d,required:g,errorText:h,visible:x})=>{const p=l.createListCollection({items:e});return i.jsxs($a,{disabled:d,required:g,children:[i.jsxs(La,{collection:p,variant:a,size:s,width:c,value:n?[n]:[],onValueChange:b=>r?.(b.value[0]),children:[i.jsx(Ua,{}),x&&i.jsx(Na,{children:t}),i.jsxs(Pa,{children:[i.jsx(za,{children:i.jsx(Ya,{placeholder:o})}),i.jsx(Fa,{children:i.jsx(Ba,{})})]}),i.jsx(Ga,{children:i.jsx(Va,{children:p.items.map(b=>i.jsxs(Ha,{item:b,children:[b.label,i.jsx(Wa,{})]},b.value))})})]}),u&&i.jsx(Ia,{children:u}),h&&i.jsx(Aa,{children:h})]})},$r=(e="default")=>`FILTER_PRESETS_${e}`,qa=e=>{if(!e)return[];try{return JSON.parse(e)}catch{return[]}},Xa=e=>typeof window>"u"?[]:qa(localStorage.getItem($r(e))),Ze=new Sr({}),rt=e=>{const t=Ze.state;if(e in t)return t[e];const n=Xa(e);return Ze.setState(r=>({...r,[e]:n})),n},Tt=(e,t)=>{Ze.setState(n=>({...n,[e]:t})),typeof window<"u"&&localStorage.setItem($r(e),JSON.stringify(t))},Ir=(e,t)=>{const n=[t,...rt(e)];Tt(e,n)},Ar=(e,t)=>{const n=rt(e).filter(r=>r.id!==t);Tt(e,n)},Ka=(e,t,n)=>{const r=rt(e).map(o=>o.id===t?n(o):o);Tt(e,r)},Ja=S(l.Checkbox.Root),Za=S(l.Checkbox.HiddenInput),Qa=S(l.Checkbox.Control),ec=S(l.Slider.Root),tc=S(l.Slider.Track),nc=S(l.Slider.Range),rc=S(l.Slider.Thumbs),oc=S(l.Slider.Control),sc=({filter:e,onVisibilityChange:t,onSizeChange:n})=>{const{attributes:r,listeners:o,setNodeRef:s,transform:c,transition:a}=br({id:e.id}),u={transform:Ie.Transform.toString(c),transition:a};return i.jsxs(l.VStack,{ref:s,style:u,align:"stretch",border:"1px solid",borderColor:"gray.200",rounded:"md",p:3,mb:3,bg:"white",children:[i.jsxs(l.HStack,{...r,...o,cursor:"grab",userSelect:"none",gap:2,children:[i.jsx(Tr,{size:16}),i.jsx(l.Text,{fontWeight:"bold",fontSize:"sm",children:e.label||e.id})]}),i.jsxs(l.HStack,{justify:"space-between",children:[i.jsx(l.Text,{fontSize:"sm",children:"Visible"}),i.jsxs(Ja,{checked:e.visible,size:"sm",onCheckedChange:d=>t?.(e.id,!!d.checked),children:[i.jsx(Za,{}),i.jsx(Qa,{})]})]}),i.jsxs(l.VStack,{align:"stretch",gap:1,children:[i.jsx(l.Text,{fontSize:"sm",children:"Size"}),i.jsx(ec,{min:1,max:5,step:.5,value:[e.size??1],onValueChange:d=>n?.(e.id,d.value[0]),children:i.jsxs(oc,{children:[i.jsx(tc,{children:i.jsx(nc,{})}),i.jsx(rc,{})]})})]})]})},ic=S(l.Drawer.Root),ac=S(l.Drawer.Trigger),cc=S(l.Drawer.Backdrop),lc=S(l.Drawer.Positioner),uc=S(l.Drawer.Content),dc=S(l.Drawer.Header),fc=S(l.Drawer.Title),hc=S(l.Drawer.Body),gc=S(l.Drawer.Footer),pc=S(l.Drawer.CloseTrigger),vc=S(l.Tabs.Root),mc=S(l.Tabs.List),Bt=S(l.Tabs.Trigger),Vt=S(l.Tabs.Content),Lr=(e,t)=>{if(e.customComponent)return e.customComponent;switch(e.type){case"text":return i.jsx(Kt,{placeholder:e.label,value:e.value,onChange:e.onChange,label:e.label,visible:t});case"number":return i.jsx(Kt,{label:e.label,value:e.value,onChange:e.onChange});case"checkbox":return i.jsx(Or,{label:e.label,value:e.value,onChange:e.onChange});case"select":return i.jsx(kr,{label:e.label,value:e.value,onChange:e.onChange,options:e.options??[],visible:t,placeholder:e.placeholder});case"date":return i.jsx(Ta,{value:e.value,onChange:e.onChange});case"combobox":return i.jsx(_r,{visible:!0,label:e.label,items:e.options,itemToString:n=>n.label,itemToValue:n=>n.value,renderItem:n=>i.jsx("span",{children:n.label})});default:return null}},bc=({filterDrawerSize:e="sm",onVisibilityChange:t,onSizeChange:n,onClear:r,filters:o,pageKey:s="default",onLoadPreset:c,activePresetName:a,onReorder:u,open:d,onOpenChange:g})=>{const x=nt(Ze)[s]??rt(s),p=()=>{const b=prompt("Preset name?");if(!b)return;const v=o.reduce((y,w)=>(y[w.id]=w.value,y),{});Ir(s,{id:crypto.randomUUID(),name:b,date:new Date().toISOString(),values:v})};return i.jsx(l.HStack,{wrap:"wrap",children:i.jsxs(ic,{size:e,open:d,onOpenChange:g,children:[i.jsx(ac,{asChild:!0,children:i.jsxs(l.IconButton,{"aria-label":"Open filters",variant:"outline",size:"xs",ml:2,p:2,children:[i.jsx(Di,{size:16}),"Filters"]})}),i.jsxs(l.Portal,{children:[i.jsx(cc,{}),i.jsx(lc,{children:i.jsxs(uc,{children:[i.jsx(dc,{children:i.jsx(fc,{children:"Filters"})}),i.jsx(hc,{overflowY:"auto",pt:1,children:i.jsxs(vc,{defaultValue:"view",children:[i.jsxs(mc,{mb:4,children:[i.jsxs(Bt,{value:"view",children:[i.jsx(Ei,{size:16}),"Edit"]}),i.jsxs(Bt,{value:"settings",children:[i.jsx(_i,{size:16}),"Settings"]}),i.jsxs(Bt,{value:"presets",children:[i.jsx(di,{size:16}),"Presets"]})]}),i.jsx(Vt,{value:"view",children:o.filter(b=>b.visible).map(b=>i.jsx(l.VStack,{align:"stretch",border:"1px solid",borderColor:"gray.200",flex:b.size??1,minW:`${(b.size??1)*100}px`,rounded:"md",p:3,mb:3,children:Lr(b,d)},b.id))}),i.jsx(Vt,{value:"settings",children:i.jsx(fr,{sensors:go(ho(cn)),collisionDetection:Zn,onDragEnd:({active:b,over:v})=>{if(!v||b.id===v.id)return;const y=o.findIndex(T=>T.id===b.id),w=o.findIndex(T=>T.id===v.id),E=Et(o,y,w);u?.(E)},children:i.jsx(vr,{items:o.map(b=>b.id),strategy:Ms,children:o.map(b=>i.jsx(sc,{filter:b,onVisibilityChange:t,onSizeChange:n},b.id))})})}),i.jsx(Vt,{value:"presets",children:i.jsxs(l.VStack,{align:"stretch",mb:3,children:[x.length===0&&i.jsx(l.Text,{fontSize:"xs",color:"gray.500",children:"No presets saved yet."}),x.map(b=>i.jsxs(l.HStack,{justify:"space-between",border:"1px solid",borderColor:a===b.name?"blue.300":"gray.200",rounded:"md",p:2,children:[i.jsxs(l.VStack,{align:"start",gap:0,children:[i.jsx(l.Text,{fontWeight:"bold",fontSize:"sm",children:b.name}),i.jsx(l.Text,{fontSize:"xs",color:"gray.500",children:new Date(b.date).toLocaleDateString()})]}),i.jsxs(l.HStack,{children:[i.jsx(l.Button,{size:"xs",variant:"ghost",onClick:()=>{const v=o.map(y=>({...y,value:b.values[y.id]??y.value}));c?.(v,b.name)},children:"Load"}),i.jsx(l.IconButton,{size:"xs","aria-label":"Delete preset",variant:"ghost",onClick:()=>Ar(s,b.id),children:i.jsx(yi,{size:14})})]})]},b.id)),i.jsx(l.Button,{size:"sm",colorScheme:"blue",onClick:p,children:"Save Current Filters"})]})})]})}),i.jsx(gc,{justify:"space-between",children:i.jsx(pc,{asChild:!0,children:i.jsx(l.CloseButton,{})})})]})})]})]})})},xc=({title:e,filters:t,onVisibilityChange:n,onReorder:r,onSizeChange:o,onClear:s,maxToolbarUnits:c,pageKey:a,onLoadPreset:u,activePresetName:d,filterDrawerSize:g="sm"})=>{const[h,x]=f.useState(!1);return i.jsxs(l.HStack,{wrap:"wrap",pl:2,pr:2,width:"100%",justify:"space-between",children:[e,i.jsxs(l.HStack,{gapX:1,children:[t.filter(p=>p.visible!==!1).map(p=>i.jsx(l.HStack,{flex:p.size??1,minW:`${(p.size??1)*100}px`,alignItems:"center",children:Lr(p)},p.id)),i.jsx(bc,{filterDrawerSize:g,onVisibilityChange:n,onReorder:r,onSizeChange:o,onClear:s,maxToolbarUnits:c,pageKey:a,filters:t,onLoadPreset:u,activePresetName:d,open:h,onOpenChange:p=>{x(p.open)}})]})]})},yc=(e,t)=>{localStorage.setItem(`FILTER_ORDER_${e}`,JSON.stringify(t))},Sc=e=>{try{return JSON.parse(localStorage.getItem(`FILTER_ORDER_${e}`)||"[]")}catch{return[]}},wc=({onClick:e,size:t="xs",variant:n="solid",label:r,leftIcon:o,rightIcon:s,isDisabled:c,colorScheme:a,loading:u,loadingText:d,rounded:g,type:h="button"})=>i.jsx(l.Button,{onClick:e,size:t,variant:n,disabled:c,colorPalette:a,loading:u,loadingText:d,rounded:g,type:h,children:i.jsxs(l.HStack,{gap:1,children:[o,r,s]})}),Cc=S(l.Dialog.Root),Dc=S(l.Dialog.Backdrop),jc=S(l.Dialog.Positioner),Rc=S(l.Dialog.Content),Ec=S(l.Dialog.Header),Tc=S(l.Dialog.Body),Mc=S(l.Dialog.Footer),Oc=S(l.Dialog.Title),_c=S(l.Dialog.CloseTrigger);function kc({open:e,onClose:t,onConfirm:n,title:r="Confirm Action",description:o="Are you sure you want to continue?",confirmLabel:s="Confirm",cancelLabel:c="Cancel",icon:a,isLoading:u=!1,confirmButtonColorScheme:d="#4169e1"}){return i.jsx(Cc,{open:e,placement:"center",onOpenChange:g=>!g.open&&t(),children:i.jsxs(l.Portal,{children:[i.jsx(Dc,{}),i.jsx(jc,{children:i.jsxs(Rc,{maxW:"480px",children:[i.jsx(Ec,{borderBottom:"1px solid",borderColor:"gray.200",children:i.jsx(Oc,{children:r})}),i.jsx(Tc,{p:6,children:i.jsxs(l.Stack,{gap:4,align:"center",textAlign:"center",children:[i.jsx(l.Box,{color:"orange.500",children:a??i.jsx(Mr,{size:40})}),i.jsx(l.Text,{fontSize:"sm",color:"gray.600",children:o})]})}),i.jsxs(Mc,{justifyContent:"flex-end",gap:2,borderTop:"1px solid",borderColor:"gray.200",children:[i.jsx(l.Button,{variant:"outline",size:"sm",onClick:t,children:c}),i.jsx(l.Button,{size:"sm",style:{backgroundColor:d},loading:u,onClick:n,children:s})]}),i.jsx(_c,{asChild:!0,children:i.jsx(l.CloseButton,{size:"sm"})})]})})]})})}const $c=S(l.Dialog.Root),Ic=S(l.Dialog.Backdrop),Ac=S(l.Dialog.Positioner),Lc=S(l.Dialog.Content),Nc=S(l.Dialog.Header),Pc=S(l.Dialog.Body),zc=S(l.Dialog.Footer),Yc=S(l.Dialog.Title),Fc=S(l.Dialog.CloseTrigger);function Bc({open:e,onClose:t,onConfirm:n,title:r="Delete Company",entityName:o,confirmText:s="DELETE",confirmLabel:c="Delete",isLoading:a=!1}){const[u,d]=f.useState(""),g=u===s;return i.jsx($c,{open:e,placement:"center",onOpenChange:h=>{!h.open&&t(),d("")},children:i.jsxs(l.Portal,{children:[i.jsx(Ic,{}),i.jsx(Ac,{children:i.jsxs(Lc,{maxW:"550px",children:[i.jsx(Nc,{borderBottom:"1px solid",borderColor:"#d3d3d3",children:i.jsx(Yc,{color:"red.600",children:r})}),i.jsx(Pc,{p:2,style:{padding:"16px"},children:i.jsxs(l.Stack,{gap:4,borderRadius:"md",p:4,bg:"white",children:[i.jsx(l.Box,{border:"1px solid",borderColor:"red.200",bg:"red.50",borderRadius:"md",p:4,children:i.jsxs(l.Stack,{direction:"row",gap:3,align:"flex-start",children:[i.jsx(l.Box,{color:"red.600",mt:"2px",children:i.jsx(Mr,{size:20})}),i.jsxs(l.Box,{children:[i.jsx(l.Text,{fontWeight:"semibold",color:"red.700",children:"Are you sure?"}),i.jsxs(l.Text,{fontSize:"sm",color:"red.600",children:["All the data of ",i.jsx("b",{children:o})," will permanently be deleted."]})]})]})}),i.jsx(l.Text,{fontSize:"sm",color:"gray.600",children:"You can’t undo this action afterwards."}),i.jsxs(l.Box,{children:[i.jsxs(l.Text,{fontSize:"sm",mb:2,children:["Type ",i.jsx("b",{children:s})," to continue"]}),i.jsx(l.Input,{placeholder:`Type ${s} here`,value:u,onChange:h=>d(h.target.value),size:"xs"})]})]})}),i.jsxs(zc,{justifyContent:"flex-end",gap:2,borderTop:"1px solid",borderColor:"#d3d3d3",children:[i.jsx(l.Button,{variant:"outline",size:"sm",onClick:()=>{t(),d("")},children:"Cancel"}),i.jsx(l.Button,{size:"sm",disabled:!g,style:{backgroundColor:"#FF0000"},loading:a,onClick:n,children:c})]}),i.jsx(Fc,{asChild:!0,children:i.jsx(l.CloseButton,{size:"sm"})})]})})]})})}const Vc=S(l.Dialog.Root),Hc=S(l.Dialog.Title),Wc=S(l.Dialog.Content),Uc=({open:e,onClose:t,title:n,children:r,buttonChildren:o,size:s="md"})=>i.jsxs(Vc,{open:e,onOpenChange:()=>t(),children:[i.jsx(l.DialogBackdrop,{}),i.jsxs(Wc,{maxW:s,borderRadius:"12px",p:"0",children:[i.jsx(l.DialogHeader,{px:"20px",py:"16px",borderBottom:"1px solid",borderColor:"gray.200",children:i.jsxs(l.Flex,{align:"center",justify:"space-between",children:[i.jsx(Hc,{fontSize:"16px",fontWeight:"600",children:n}),i.jsx(l.DialogCloseTrigger,{})]})}),i.jsx(l.DialogBody,{px:"20px",py:"16px",children:r}),i.jsx(l.DialogFooter,{px:"20px",py:"16px",borderTop:"1px solid",borderColor:"gray.200",children:i.jsx(l.Flex,{gap:"12px",ml:"auto",children:o})})]})]});function Nr({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(l.IconButton,{"aria-label":n,size:"xs",variant:"outline",disabled:t||r,onClick:s,ml:2,children:i.jsx(Mi,{size:14,style:{animation:r?"spin 0.6s linear infinite":void 0}})})}var gt={exports:{}},Gc=gt.exports,Wn;function qc(){return Wn||(Wn=1,(function(e,t){(function(n,r){e.exports=r()})(Gc,(function(){var n=1e3,r=6e4,o=36e5,s="millisecond",c="second",a="minute",u="hour",d="day",g="week",h="month",x="quarter",p="year",b="date",v="Invalid Date",y=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,w=/\[([^\]]+)]|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,E={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 j=["th","st","nd","rd"],C=$%100;return"["+$+(j[(C-20)%10]||j[C]||j[0])+"]"}},T=function($,j,C){var O=String($);return!O||O.length>=j?$:""+Array(j+1-O.length).join(C)+$},I={s:T,z:function($){var j=-$.utcOffset(),C=Math.abs(j),O=Math.floor(C/60),_=C%60;return(j<=0?"+":"-")+T(O,2,"0")+":"+T(_,2,"0")},m:function $(j,C){if(j.date()<C.date())return-$(C,j);var O=12*(C.year()-j.year())+(C.month()-j.month()),_=j.clone().add(O,h),N=C-_<0,z=j.clone().add(O+(N?-1:1),h);return+(-(O+(C-_)/(N?_-z:z-_))||0)},a:function($){return $<0?Math.ceil($)||0:Math.floor($)},p:function($){return{M:h,y:p,w:g,d,D:b,h:u,m:a,s:c,ms:s,Q:x}[$]||String($||"").toLowerCase().replace(/s$/,"")},u:function($){return $===void 0}},k="en",M={};M[k]=E;var A="$isDayjsObject",L=function($){return $ instanceof U||!(!$||!$[A])},V=function $(j,C,O){var _;if(!j)return k;if(typeof j=="string"){var N=j.toLowerCase();M[N]&&(_=N),C&&(M[N]=C,_=N);var z=j.split("-");if(!_&&z.length>1)return $(z[0])}else{var m=j.name;M[m]=j,_=m}return!O&&_&&(k=_),_||!O&&k},F=function($,j){if(L($))return $.clone();var C=typeof j=="object"?j:{};return C.date=$,C.args=arguments,new U(C)},D=I;D.l=V,D.i=L,D.w=function($,j){return F($,{locale:j.$L,utc:j.$u,x:j.$x,$offset:j.$offset})};var U=(function(){function $(C){this.$L=V(C.locale,null,!0),this.parse(C),this.$x=this.$x||C.x||{},this[A]=!0}var j=$.prototype;return j.parse=function(C){this.$d=(function(O){var _=O.date,N=O.utc;if(_===null)return new Date(NaN);if(D.u(_))return new Date;if(_ instanceof Date)return new Date(_);if(typeof _=="string"&&!/Z$/i.test(_)){var z=_.match(y);if(z){var m=z[2]-1||0,R=(z[7]||"0").substring(0,3);return N?new Date(Date.UTC(z[1],m,z[3]||1,z[4]||0,z[5]||0,z[6]||0,R)):new Date(z[1],m,z[3]||1,z[4]||0,z[5]||0,z[6]||0,R)}}return new Date(_)})(C),this.init()},j.init=function(){var C=this.$d;this.$y=C.getFullYear(),this.$M=C.getMonth(),this.$D=C.getDate(),this.$W=C.getDay(),this.$H=C.getHours(),this.$m=C.getMinutes(),this.$s=C.getSeconds(),this.$ms=C.getMilliseconds()},j.$utils=function(){return D},j.isValid=function(){return this.$d.toString()!==v},j.isSame=function(C,O){var _=F(C);return this.startOf(O)<=_&&_<=this.endOf(O)},j.isAfter=function(C,O){return F(C)<this.startOf(O)},j.isBefore=function(C,O){return this.endOf(O)<F(C)},j.$g=function(C,O,_){return D.u(C)?this[O]:this.set(_,C)},j.unix=function(){return Math.floor(this.valueOf()/1e3)},j.valueOf=function(){return this.$d.getTime()},j.startOf=function(C,O){var _=this,N=!!D.u(O)||O,z=D.p(C),m=function(J,Y){var se=D.w(_.$u?Date.UTC(_.$y,Y,J):new Date(_.$y,Y,J),_);return N?se:se.endOf(d)},R=function(J,Y){return D.w(_.toDate()[J].apply(_.toDate("s"),(N?[0,0,0,0]:[23,59,59,999]).slice(Y)),_)},P=this.$W,B=this.$M,q=this.$D,X="set"+(this.$u?"UTC":"");switch(z){case p:return N?m(1,0):m(31,11);case h:return N?m(1,B):m(0,B+1);case g:var H=this.$locale().weekStart||0,K=(P<H?P+7:P)-H;return m(N?q-K:q+(6-K),B);case d:case b:return R(X+"Hours",0);case u:return R(X+"Minutes",1);case a:return R(X+"Seconds",2);case c:return R(X+"Milliseconds",3);default:return this.clone()}},j.endOf=function(C){return this.startOf(C,!1)},j.$set=function(C,O){var _,N=D.p(C),z="set"+(this.$u?"UTC":""),m=(_={},_[d]=z+"Date",_[b]=z+"Date",_[h]=z+"Month",_[p]=z+"FullYear",_[u]=z+"Hours",_[a]=z+"Minutes",_[c]=z+"Seconds",_[s]=z+"Milliseconds",_)[N],R=N===d?this.$D+(O-this.$W):O;if(N===h||N===p){var P=this.clone().set(b,1);P.$d[m](R),P.init(),this.$d=P.set(b,Math.min(this.$D,P.daysInMonth())).$d}else m&&this.$d[m](R);return this.init(),this},j.set=function(C,O){return this.clone().$set(C,O)},j.get=function(C){return this[D.p(C)]()},j.add=function(C,O){var _,N=this;C=Number(C);var z=D.p(O),m=function(B){var q=F(N);return D.w(q.date(q.date()+Math.round(B*C)),N)};if(z===h)return this.set(h,this.$M+C);if(z===p)return this.set(p,this.$y+C);if(z===d)return m(1);if(z===g)return m(7);var R=(_={},_[a]=r,_[u]=o,_[c]=n,_)[z]||1,P=this.$d.getTime()+C*R;return D.w(P,this)},j.subtract=function(C,O){return this.add(-1*C,O)},j.format=function(C){var O=this,_=this.$locale();if(!this.isValid())return _.invalidDate||v;var N=C||"YYYY-MM-DDTHH:mm:ssZ",z=D.z(this),m=this.$H,R=this.$m,P=this.$M,B=_.weekdays,q=_.months,X=_.meridiem,H=function(Y,se,ne,he){return Y&&(Y[se]||Y(O,N))||ne[se].slice(0,he)},K=function(Y){return D.s(m%12||12,Y,"0")},J=X||function(Y,se,ne){var he=Y<12?"AM":"PM";return ne?he.toLowerCase():he};return N.replace(w,(function(Y,se){return se||(function(ne){switch(ne){case"YY":return String(O.$y).slice(-2);case"YYYY":return D.s(O.$y,4,"0");case"M":return P+1;case"MM":return D.s(P+1,2,"0");case"MMM":return H(_.monthsShort,P,q,3);case"MMMM":return H(q,P);case"D":return O.$D;case"DD":return D.s(O.$D,2,"0");case"d":return String(O.$W);case"dd":return H(_.weekdaysMin,O.$W,B,2);case"ddd":return H(_.weekdaysShort,O.$W,B,3);case"dddd":return B[O.$W];case"H":return String(m);case"HH":return D.s(m,2,"0");case"h":return K(1);case"hh":return K(2);case"a":return J(m,R,!0);case"A":return J(m,R,!1);case"m":return String(R);case"mm":return D.s(R,2,"0");case"s":return String(O.$s);case"ss":return D.s(O.$s,2,"0");case"SSS":return D.s(O.$ms,3,"0");case"Z":return z}return null})(Y)||z.replace(":","")}))},j.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},j.diff=function(C,O,_){var N,z=this,m=D.p(O),R=F(C),P=(R.utcOffset()-this.utcOffset())*r,B=this-R,q=function(){return D.m(z,R)};switch(m){case p:N=q()/12;break;case h:N=q();break;case x:N=q()/3;break;case g:N=(B-P)/6048e5;break;case d:N=(B-P)/864e5;break;case u:N=B/o;break;case a:N=B/r;break;case c:N=B/n;break;default:N=B}return _?N:D.a(N)},j.daysInMonth=function(){return this.endOf(h).$D},j.$locale=function(){return M[this.$L]},j.locale=function(C,O){if(!C)return this.$L;var _=this.clone(),N=V(C,O,!0);return N&&(_.$L=N),_},j.clone=function(){return D.w(this.$d,this)},j.toDate=function(){return new Date(this.valueOf())},j.toJSON=function(){return this.isValid()?this.toISOString():null},j.toISOString=function(){return this.$d.toISOString()},j.toString=function(){return this.$d.toUTCString()},$})(),G=U.prototype;return F.prototype=G,[["$ms",s],["$s",c],["$m",a],["$H",u],["$W",d],["$M",h],["$y",p],["$D",b]].forEach((function($){G[$[1]]=function(j){return this.$g(j,$[0],$[1])}})),F.extend=function($,j){return $.$i||($(j,U,F),$.$i=!0),F},F.locale=V,F.isDayjs=L,F.unix=function($){return F(1e3*$)},F.en=M[k],F.Ls=M,F.p={},F}))})(gt)),gt.exports}var Xc=qc();const Mt=Ct(Xc);var pt={exports:{}},Kc=pt.exports,Un;function Jc(){return Un||(Un=1,(function(e,t){(function(n,r){e.exports=r()})(Kc,(function(){return function(n,r,o){n=n||{};var s=r.prototype,c={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 a(d,g,h,x){return s.fromToBase(d,g,h,x)}o.en.relativeTime=c,s.fromToBase=function(d,g,h,x,p){for(var b,v,y,w=h.$locale().relativeTime||c,E=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"}],T=E.length,I=0;I<T;I+=1){var k=E[I];k.d&&(b=x?o(d).diff(h,k.d,!0):h.diff(d,k.d,!0));var M=(n.rounding||Math.round)(Math.abs(b));if(y=b>0,M<=k.r||!k.r){M<=1&&I>0&&(k=E[I-1]);var A=w[k.l];p&&(M=p(""+M)),v=typeof A=="string"?A.replace("%d",M):A(M,g,k.l,y);break}}if(g)return v;var L=y?w.future:w.past;return typeof L=="function"?L(v):L.replace("%s",v)},s.to=function(d,g){return a(d,g,this,!0)},s.from=function(d,g){return a(d,g,this)};var u=function(d){return d.$u?o.utc():o()};s.toNow=function(d){return this.to(u(this),d)},s.fromNow=function(d){return this.from(u(this),d)}}}))})(pt)),pt.exports}var Zc=Jc();const Qc=Ct(Zc);var vt={exports:{}},el=vt.exports,Gn;function tl(){return Gn||(Gn=1,(function(e,t){(function(n,r){e.exports=r()})(el,(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 c=o.prototype,a=c.format;s.en.formats=n,c.format=function(u){u===void 0&&(u="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(p,b,v){var y=v&&v.toUpperCase();return b||x[v]||n[v]||x[y].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,(function(w,E,T){return E||T.slice(1)}))}))})(u,d===void 0?{}:d);return a.call(this,g)}}}))})(vt)),vt.exports}var nl=tl();const rl=Ct(nl);var mt={exports:{}},ol=mt.exports,qn;function sl(){return qn||(qn=1,(function(e,t){(function(n,r){e.exports=r()})(ol,(function(){return function(n,r){var o=r.prototype,s=o.format;o.format=function(c){var a=this,u=this.$locale();if(!this.isValid())return s.bind(this)(c);var d=this.$utils(),g=(c||"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((a.$M+1)/3);case"Do":return u.ordinal(a.$D);case"gggg":return a.weekYear();case"GGGG":return a.isoWeekYear();case"wo":return u.ordinal(a.week(),"W");case"w":case"ww":return d.s(a.week(),h==="w"?1:2,"0");case"W":case"WW":return d.s(a.isoWeek(),h==="W"?1:2,"0");case"k":case"kk":return d.s(String(a.$H===0?24:a.$H),h==="k"?1:2,"0");case"X":return Math.floor(a.$d.getTime()/1e3);case"x":return a.$d.getTime();case"z":return"["+a.offsetName()+"]";case"zzz":return"["+a.offsetName("long")+"]";default:return h}}));return s.bind(this)(g)}}}))})(mt)),mt.exports}var il=sl();const al=Ct(il);Mt.extend(Qc);Mt.extend(rl);Mt.extend(al);const cl={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 Jt({value:e,variant:t="dateTime",format:n,fallback:r="--"}){if(!e)return r;const o=Mt(e);return o.isValid()?t==="relative"?o.fromNow():o.format(n??cl[t]):r}function ll({value:e,dateVariant:t="date",timeVariant:n="time",dateFormat:r,timeFormat:o,align:s="start",dateColor:c="gray.700",dateFontSize:a="16px",dateFontWeight:u="500",timeColor:d="gray.500",timeFontSize:g="12px",timeFontWeight:h="400"}){return i.jsxs(l.Stack,{gap:.5,align:s,children:[i.jsx(l.Text,{fontSize:a,fontWeight:u,color:c,children:Jt({value:e,variant:t,format:r})}),i.jsx(l.Text,{fontSize:g,fontWeight:h,color:d,children:Jt({value:e,variant:n,format:o})})]})}class Pr{state=new Map;listeners=new Map;get(t){return this.state.get(t)}set(t){this.state.set(t.key,t),this.notify(t.key)}setMany(t){t.forEach(n=>this.set(n))}subscribe(t,n){return this.listeners.has(t)||this.listeners.set(t,new Set),this.listeners.get(t).add(n),n(this.state.get(t)),()=>{this.listeners.get(t)?.delete(n)}}notify(t){this.listeners.get(t)?.forEach(n=>n(this.state.get(t)))}clear(){this.state.clear()}}class Zt{constructor(t){this.baseUrl=t}async fetchLatest(t){const n=new URLSearchParams;return n.set("keys",t.join(",")),(await(await fetch(`${this.baseUrl}/options?${n}`)).json()).data}}class Qt{constructor(t){this.api=t}store=new Pr;inflight=new Map;getRaw(t){return this.store.get(t)}async getKey(t){const n=this.store.get(t);return n?n.value:(await this.fetchMissing([t]),this.store.get(t)?.value)}async getMultiKey(t){const n={},r=[];for(const o of t){const s=this.store.get(o);s?n[o]=s.value:r.push(o)}return r.length&&(await this.fetchMissing(r),r.forEach(o=>{const s=this.store.get(o);s&&(n[o]=s.value)})),n}subscribe(t,n){return this.store.subscribe(t,n)}hydrate(t){this.store.setMany(t)}clear(){this.store.clear()}async fetchMissing(t){const n=t.filter(o=>!this.inflight.has(o));if(!n.length)return;const r=this.api.fetchLatest(n).then(o=>{this.store.setMany(o),n.forEach(s=>this.inflight.delete(s))});n.forEach(o=>this.inflight.set(o,r)),await r}}const zr=f.createContext(null);function Yr(){const e=f.useContext(zr);if(!e)throw new Error("OptionsProvider is missing. Wrap your app with <OptionsProvider />");return e}function ul({client:{apiUrl:e},children:t}){const n=f.useRef(new Qt(new Zt(e)));return n.current||(n.current=new Qt(new Zt(e))),i.jsx(zr.Provider,{value:n.current,children:t})}function dl(e){const t=Yr(),[n,r]=f.useState(t.getRaw(e)?.value);return f.useEffect(()=>{let o=!0;t.getKey(e).then(c=>{o&&r(c)});const s=t.subscribe(e,c=>{r(c?.value)});return()=>{o=!1,s()}},[e,t]),n}function fl(e){const t=Yr(),[n,r]=f.useState({});return f.useEffect(()=>{let o=!0;t.getMultiKey(e).then(c=>{o&&r(c)});const s=e.map(c=>t.subscribe(c,a=>{r(u=>({...u,[c]:a?.value}))}));return()=>{o=!1,s.forEach(c=>c())}},[e.join("|"),t]),n}async function hl(e,t){return e.getKey(t)}async function gl(e,t){await e.getMultiKey(t)}function pl(e={}){const{initialPage:t=1,initialLimit:n=20}=e,[r,o]=f.useState(t),[s,c]=f.useState(n),a=f.useCallback(x=>{o(Math.max(1,x))},[]),u=f.useCallback(x=>{c(Math.max(1,x)),o(1)},[]),d=f.useCallback(()=>{o(x=>x+1)},[]),g=f.useCallback(()=>{o(x=>Math.max(1,x-1))},[]),h=f.useCallback(()=>{o(t),c(n)},[t,n]);return{page:r,limit:s,setPage:a,setLimit:u,nextPage:d,prevPage:g,reset:h}}function vl(e={}){const{initialValue:t="",delay:n=300}=e,[r,o]=f.useState(t),s=ml(r,n),c=f.useCallback(u=>{o(u)},[]),a=f.useCallback(()=>{o(t)},[t]);return{search:r,debouncedSearch:s,onSearchChange:c,reset:a}}function ml(e,t=300){const[n,r]=f.useState(e);return f.useEffect(()=>{const o=setTimeout(()=>{r(e)},t);return()=>clearTimeout(o)},[e,t]),n}exports.DataTable=ca;exports.Filters=xc;exports.HttpOptionsApi=Zt;exports.MDSButton=wc;exports.MDSCheckbox=Or;exports.MDSCombobox=_r;exports.MDSConfirmActionDialog=kc;exports.MDSConfirmDeleteDialog=Bc;exports.MDSDialogWrapper=Uc;exports.MDSInput=Kt;exports.MDSRefreshButton=Nr;exports.MDSSelectBox=kr;exports.OptionsClientImpl=Qt;exports.OptionsProvider=ul;exports.OptionsStore=Pr;exports.RefreshButton=Nr;exports.StackedDateTime=ll;exports.addPreset=Ir;exports.deletePreset=Ar;exports.formatDateTime=Jt;exports.getOption=hl;exports.getPresets=rt;exports.loadOrder=Sc;exports.prefetchOptions=gl;exports.presetStore=Ze;exports.saveOrder=yc;exports.savePresets=Tt;exports.setActionsConfig=Dr;exports.setData=wr;exports.setTableId=Cr;exports.tableStore=ie;exports.updatePreset=Ka;exports.useDebouncedSearch=vl;exports.useOption=dl;exports.useOptions=fl;exports.usePagination=pl;exports.withChildren=S;
10
+ `},uo={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 fo(e){let{announcements:t=uo,container:n,hiddenTextDescribedById:r,screenReaderInstructions:o=lo}=e;const{announce:s,announcement:c}=io(),a=tt("DndLiveRegion"),[u,d]=f.useState(!1);if(f.useEffect(()=>{d(!0)},[]),ao(f.useMemo(()=>({onDragStart(h){let{active:x}=h;s(t.onDragStart({active:x}))},onDragMove(h){let{active:x,over:p}=h;t.onDragMove&&s(t.onDragMove({active:x,over:p}))},onDragOver(h){let{active:x,over:p}=h;s(t.onDragOver({active:x,over:p}))},onDragEnd(h){let{active:x,over:p}=h;s(t.onDragEnd({active:x,over:p}))},onDragCancel(h){let{active:x,over:p}=h;s(t.onDragCancel({active:x,over:p}))}}),[s,t])),!u)return null;const g=f.createElement(f.Fragment,null,f.createElement(oo,{id:r,value:o.draggable}),f.createElement(so,{id:a,announcement:c}));return n?Ue.createPortal(g,n):g}var Q;(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"})(Q||(Q={}));function yt(){}function ho(e,t){return f.useMemo(()=>({sensor:e,options:{}}),[e,t])}function go(){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 po(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function vo(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function mo(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function bo(e,t){if(!e||e.length===0)return null;const[n]=e;return n[t]}function wn(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 Zn=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=wn(t,t.left,t.top),s=[];for(const c of r){const{id:a}=c,u=n.get(a);if(u){const d=po(wn(u),o);s.push({id:a,data:{droppableContainer:c,value:d}})}}return s.sort(vo)};function xo(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),c=o-r,a=s-n;if(r<o&&n<s){const u=t.width*t.height,d=e.width*e.height,g=c*a,h=g/(u+d-g);return Number(h.toFixed(4))}return 0}const yo=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=[];for(const s of r){const{id:c}=s,a=n.get(c);if(a){const u=xo(a,t);u>0&&o.push({id:c,data:{droppableContainer:s,value:u}})}}return o.sort(mo)};function So(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function Qn(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:pe}function wo(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((c,a)=>({...c,top:c.top+e*a.y,bottom:c.bottom+e*a.y,left:c.left+e*a.x,right:c.right+e*a.x}),{...n})}}const Co=wo(1);function Do(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 jo(e,t,n){const r=Do(t);if(!r)return e;const{scaleX:o,scaleY:s,x:c,y:a}=r,u=e.left-c-(1-o)*parseFloat(n),d=e.top-a-(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:u+g,bottom:d+h,left:u}}const Ro={ignoreTransform:!1};function Ne(e,t){t===void 0&&(t=Ro);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:d,transformOrigin:g}=ae(e).getComputedStyle(e);d&&(n=jo(n,d,g))}const{top:r,left:o,width:s,height:c,bottom:a,right:u}=n;return{top:r,left:o,width:s,height:c,bottom:a,right:u}}function Cn(e){return Ne(e,{ignoreTransform:!0})}function Eo(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function To(e,t){return t===void 0&&(t=ae(e).getComputedStyle(e)),t.position==="fixed"}function Mo(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 on(e,t){const n=[];function r(o){if(t!=null&&n.length>=t||!o)return n;if(tn(o)&&o.scrollingElement!=null&&!n.includes(o.scrollingElement))return n.push(o.scrollingElement),n;if(!Qe(o)||Xn(o)||n.includes(o))return n;const s=ae(e).getComputedStyle(o);return o!==e&&Mo(o,s)&&n.push(o),To(o,s)?n:r(o.parentNode)}return e?r(e):n}function er(e){const[t]=on(e,1);return t??null}function It(e){return!Dt||!e?null:Ae(e)?e:en(e)?tn(e)||e===Le(e).scrollingElement?window:Qe(e)?e:null:null}function tr(e){return Ae(e)?e.scrollX:e.scrollLeft}function nr(e){return Ae(e)?e.scrollY:e.scrollTop}function Ut(e){return{x:tr(e),y:nr(e)}}var ee;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(ee||(ee={}));function rr(e){return!Dt||!e?!1:e===document.scrollingElement}function or(e){const t={x:0,y:0},n=rr(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,c=e.scrollTop>=r.y,a=e.scrollLeft>=r.x;return{isTop:o,isLeft:s,isBottom:c,isRight:a,maxScroll:r,minScroll:t}}const Oo={x:.2,y:.2};function _o(e,t,n,r,o){let{top:s,left:c,right:a,bottom:u}=n;r===void 0&&(r=10),o===void 0&&(o=Oo);const{isTop:d,isBottom:g,isLeft:h,isRight:x}=or(e),p={x:0,y:0},b={x:0,y:0},v={height:t.height*o.y,width:t.width*o.x};return!d&&s<=t.top+v.height?(p.y=ee.Backward,b.y=r*Math.abs((t.top+v.height-s)/v.height)):!g&&u>=t.bottom-v.height&&(p.y=ee.Forward,b.y=r*Math.abs((t.bottom-v.height-u)/v.height)),!x&&a>=t.right-v.width?(p.x=ee.Forward,b.x=r*Math.abs((t.right-v.width-a)/v.width)):!h&&c<=t.left+v.width&&(p.x=ee.Backward,b.x=r*Math.abs((t.left+v.width-c)/v.width)),{direction:p,speed:b}}function ko(e){if(e===document.scrollingElement){const{innerWidth:s,innerHeight:c}=window;return{top:0,left:0,right:s,bottom:c,width:s,height:c}}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 sr(e){return e.reduce((t,n)=>$e(t,Ut(n)),pe)}function $o(e){return e.reduce((t,n)=>t+tr(n),0)}function Io(e){return e.reduce((t,n)=>t+nr(n),0)}function Ao(e,t){if(t===void 0&&(t=Ne),!e)return;const{top:n,left:r,bottom:o,right:s}=t(e);er(e)&&(o<=0||s<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const Lo=[["x",["left","right"],$o],["y",["top","bottom"],Io]];class sn{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=on(n),o=sr(r);this.rect={...t},this.width=t.width,this.height=t.height;for(const[s,c,a]of Lo)for(const u of c)Object.defineProperty(this,u,{get:()=>{const d=a(r),g=o[s]-d;return this.rect[u]+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 No(e){const{EventTarget:t}=ae(e);return e instanceof t?e:Le(e)}function At(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 Dn(e){e.preventDefault()}function Po(e){e.stopPropagation()}var W;(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"})(W||(W={}));const ir={start:[W.Space,W.Enter],cancel:[W.Esc],end:[W.Space,W.Enter,W.Tab]},zo=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case W.Right:return{...n,x:n.x+25};case W.Left:return{...n,x:n.x-25};case W.Down:return{...n,y:n.y+25};case W.Up:return{...n,y:n.y-25}}};class ar{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&&Ao(r),n(pe)}handleKeyDown(t){if(rn(t)){const{active:n,context:r,options:o}=this.props,{keyboardCodes:s=ir,coordinateGetter:c=zo,scrollBehavior:a="smooth"}=o,{code:u}=t;if(s.end.includes(u)){this.handleEnd(t);return}if(s.cancel.includes(u)){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=c(t,{active:n,context:r.current,currentCoordinates:g});if(h){const x=xt(h,g),p={x:0,y:0},{scrollableAncestors:b}=r.current;for(const v of b){const y=t.code,{isTop:w,isRight:E,isLeft:T,isBottom:I,maxScroll:k,minScroll:M}=or(v),A=ko(v),L={x:Math.min(y===W.Right?A.right-A.width/2:A.right,Math.max(y===W.Right?A.left:A.left+A.width/2,h.x)),y:Math.min(y===W.Down?A.bottom-A.height/2:A.bottom,Math.max(y===W.Down?A.top:A.top+A.height/2,h.y))},V=y===W.Right&&!E||y===W.Left&&!T,F=y===W.Down&&!I||y===W.Up&&!w;if(V&&L.x!==h.x){const D=v.scrollLeft+x.x,U=y===W.Right&&D<=k.x||y===W.Left&&D>=M.x;if(U&&!x.y){v.scrollTo({left:D,behavior:a});return}U?p.x=v.scrollLeft-D:p.x=y===W.Right?v.scrollLeft-k.x:v.scrollLeft-M.x,p.x&&v.scrollBy({left:-p.x,behavior:a});break}else if(F&&L.y!==h.y){const D=v.scrollTop+x.y,U=y===W.Down&&D<=k.y||y===W.Up&&D>=M.y;if(U&&!x.x){v.scrollTo({top:D,behavior:a});return}U?p.y=v.scrollTop-D:p.y=y===W.Down?v.scrollTop-k.y:v.scrollTop-M.y,p.y&&v.scrollBy({top:-p.y,behavior:a});break}}this.handleMove(t,$e(xt(h,this.referenceCoordinates),p))}}}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()}}ar.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:r=ir,onActivation:o}=t,{active:s}=n;const{code:c}=e.nativeEvent;if(r.start.includes(c)){const a=s.activatorNode.current;return a&&e.target!==a?!1:(e.preventDefault(),o?.({event:e.nativeEvent}),!0)}return!1}}];function jn(e){return!!(e&&"distance"in e)}function Rn(e){return!!(e&&"delay"in e)}class an{constructor(t,n,r){var o;r===void 0&&(r=No(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:c}=s;this.props=t,this.events=n,this.document=Le(c),this.documentListeners=new Ge(this.document),this.listeners=new Ge(r),this.windowListeners=new Ge(ae(c)),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,Dn),this.windowListeners.add(fe.VisibilityChange,this.handleCancel),this.windowListeners.add(fe.ContextMenu,Dn),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(Rn(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(jn(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,Po,{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:c,options:{activationConstraint:a}}=s;if(!o)return;const u=(n=Wt(t))!=null?n:pe,d=xt(o,u);if(!r&&a){if(jn(a)){if(a.tolerance!=null&&At(d,a.tolerance))return this.handleCancel();if(At(d,a.distance))return this.handleStart()}if(Rn(a)&&At(d,a.tolerance))return this.handleCancel();this.handlePending(a,d);return}t.cancelable&&t.preventDefault(),c(u)}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===W.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const Yo={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class cn extends an{constructor(t){const{event:n}=t,r=Le(n.target);super(t,Yo,r)}}cn.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 Fo={move:{name:"mousemove"},end:{name:"mouseup"}};var Gt;(function(e){e[e.RightClick=2]="RightClick"})(Gt||(Gt={}));class Bo extends an{constructor(t){super(t,Fo,Le(t.event.target))}}Bo.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===Gt.RightClick?!1:(r?.({event:n}),!0)}}];const Lt={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class Vo extends an{constructor(t){super(t,Lt)}static setup(){return window.addEventListener(Lt.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(Lt.move.name,t)};function t(){}}}Vo.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 qe;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(qe||(qe={}));var St;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(St||(St={}));function Ho(e){let{acceleration:t,activator:n=qe.Pointer,canScroll:r,draggingRect:o,enabled:s,interval:c=5,order:a=St.TreeOrder,pointerCoordinates:u,scrollableAncestors:d,scrollableAncestorRects:g,delta:h,threshold:x}=e;const p=Uo({delta:h,disabled:!s}),[b,v]=Qr(),y=f.useRef({x:0,y:0}),w=f.useRef({x:0,y:0}),E=f.useMemo(()=>{switch(n){case qe.Pointer:return u?{top:u.y,bottom:u.y,left:u.x,right:u.x}:null;case qe.DraggableRect:return o}},[n,o,u]),T=f.useRef(null),I=f.useCallback(()=>{const M=T.current;if(!M)return;const A=y.current.x*w.current.x,L=y.current.y*w.current.y;M.scrollBy(A,L)},[]),k=f.useMemo(()=>a===St.TreeOrder?[...d].reverse():d,[a,d]);f.useEffect(()=>{if(!s||!d.length||!E){v();return}for(const M of k){if(r?.(M)===!1)continue;const A=d.indexOf(M),L=g[A];if(!L)continue;const{direction:V,speed:F}=_o(M,L,E,t,x);for(const D of["x","y"])p[D][V[D]]||(F[D]=0,V[D]=0);if(F.x>0||F.y>0){v(),T.current=M,b(I,c),y.current=F,w.current=V;return}}y.current={x:0,y:0},w.current={x:0,y:0},v()},[t,I,r,v,s,c,JSON.stringify(E),JSON.stringify(p),b,d,k,g,JSON.stringify(x)])}const Wo={x:{[ee.Backward]:!1,[ee.Forward]:!1},y:{[ee.Backward]:!1,[ee.Forward]:!1}};function Uo(e){let{delta:t,disabled:n}=e;const r=Ht(t);return et(o=>{if(n||!r||!o)return Wo;const s={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[ee.Backward]:o.x[ee.Backward]||s.x===-1,[ee.Forward]:o.x[ee.Forward]||s.x===1},y:{[ee.Backward]:o.y[ee.Backward]||s.y===-1,[ee.Forward]:o.y[ee.Forward]||s.y===1}}},[n,t,r])}function Go(e,t){const n=t!=null?e.get(t):void 0,r=n?n.node.current:null;return et(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(c=>({eventName:c.eventName,handler:t(c.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 qt;(function(e){e.Optimized="optimized"})(qt||(qt={}));const En=new Map;function Xo(e,t){let{dragging:n,dependencies:r,config:o}=t;const[s,c]=f.useState(null),{frequency:a,measure:u,strategy:d}=o,g=f.useRef(e),h=y(),x=Ke(h),p=f.useCallback(function(w){w===void 0&&(w=[]),!x.current&&c(E=>E===null?w:E.concat(w.filter(T=>!E.includes(T))))},[x]),b=f.useRef(null),v=et(w=>{if(h&&!n)return En;if(!w||w===En||g.current!==e||s!=null){const E=new Map;for(let T of e){if(!T)continue;if(s&&s.length>0&&!s.includes(T.id)&&T.rect.current){E.set(T.id,T.rect.current);continue}const I=T.node.current,k=I?new sn(u(I),I):null;T.rect.current=k,k&&E.set(T.id,k)}return E}return w},[e,s,n,h,u]);return f.useEffect(()=>{g.current=e},[e]),f.useEffect(()=>{h||p()},[n,h]),f.useEffect(()=>{s&&s.length>0&&c(null)},[JSON.stringify(s)]),f.useEffect(()=>{h||typeof a!="number"||b.current!==null||(b.current=setTimeout(()=>{p(),b.current=null},a))},[a,h,p,...r]),{droppableRects:v,measureDroppableContainers:p,measuringScheduled:s!=null};function y(){switch(d){case Je.Always:return!1;case Je.BeforeDragging:return n;default:return!n}}}function cr(e,t){return et(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function Ko(e,t){return cr(e,t)}function Jo(e){let{callback:t,disabled:n}=e;const r=nn(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 jt(e){let{callback:t,disabled:n}=e;const r=nn(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 Zo(e){return new sn(Ne(e),e)}function Tn(e,t,n){t===void 0&&(t=Zo);const[r,o]=f.useState(null);function s(){o(u=>{if(!e)return null;if(e.isConnected===!1){var d;return(d=u??n)!=null?d:null}const g=t(e);return JSON.stringify(u)===JSON.stringify(g)?u:g})}const c=Jo({callback(u){if(e)for(const d of u){const{type:g,target:h}=d;if(g==="childList"&&h instanceof HTMLElement&&h.contains(e)){s();break}}}}),a=jt({callback:s});return be(()=>{s(),e?(a?.observe(e),c?.observe(document.body,{childList:!0,subtree:!0})):(a?.disconnect(),c?.disconnect())},[e]),r}function Qo(e){const t=cr(e);return Qn(e,t)}const Mn=[];function es(e){const t=f.useRef(e),n=et(r=>e?r&&r!==Mn&&e&&t.current&&e.parentNode===t.current.parentNode?r:on(e):Mn,[e]);return f.useEffect(()=>{t.current=e},[e]),n}function ts(e){const[t,n]=f.useState(null),r=f.useRef(e),o=f.useCallback(s=>{const c=It(s.target);c&&n(a=>a?(a.set(c,Ut(c)),new Map(a)):null)},[]);return f.useEffect(()=>{const s=r.current;if(e!==s){c(s);const a=e.map(u=>{const d=It(u);return d?(d.addEventListener("scroll",o,{passive:!0}),[d,Ut(d)]):null}).filter(u=>u!=null);n(a.length?new Map(a):null),r.current=e}return()=>{c(e),c(s)};function c(a){a.forEach(u=>{const d=It(u);d?.removeEventListener("scroll",o)})}},[o,e]),f.useMemo(()=>e.length?t?Array.from(t.values()).reduce((s,c)=>$e(s,c),pe):sr(e):pe,[e,t])}function On(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 ns(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 rs(e,t){return f.useMemo(()=>e.reduce((n,r)=>{let{eventName:o,handler:s}=r;return n[o]=c=>{s(c,t)},n},{}),[e,t])}function lr(e){return f.useMemo(()=>e?Eo(e):null,[e])}const _n=[];function os(e,t){t===void 0&&(t=Ne);const[n]=e,r=lr(n?ae(n):null),[o,s]=f.useState(_n);function c(){s(()=>e.length?e.map(u=>rr(u)?r:new sn(t(u),u)):_n)}const a=jt({callback:c});return be(()=>{a?.disconnect(),c(),e.forEach(u=>a?.observe(u))},[e]),o}function ss(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return Qe(t)?t:e}function is(e){let{measure:t}=e;const[n,r]=f.useState(null),o=f.useCallback(d=>{for(const{target:g}of d)if(Qe(g)){r(h=>{const x=t(g);return h?{...h,width:x.width,height:x.height}:x});break}},[t]),s=jt({callback:o}),c=f.useCallback(d=>{const g=ss(d);s?.disconnect(),g&&s?.observe(g),r(g?t(g):null)},[t,s]),[a,u]=bt(c);return f.useMemo(()=>({nodeRef:a,rect:n,setRef:u}),[n,a,u])}const as=[{sensor:cn,options:{}},{sensor:ar,options:{}}],cs={current:{}},ht={draggable:{measure:Cn},droppable:{measure:Cn,strategy:Je.WhileDragging,frequency:qt.Optimized},dragOverlay:{measure:Ne}};class Xe 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 ls={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Xe,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:yt},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:ht,measureDroppableContainers:yt,windowRect:null,measuringScheduled:!1},us={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:yt,draggableNodes:new Map,over:null,measureDroppableContainers:yt},Rt=f.createContext(us),ur=f.createContext(ls);function ds(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Xe}}}function fs(e,t){switch(t.type){case Q.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case Q.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 Q.DragEnd:case Q.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case Q.RegisterDroppable:{const{element:n}=t,{id:r}=n,o=new Xe(e.droppable.containers);return o.set(r,n),{...e,droppable:{...e.droppable,containers:o}}}case Q.SetDroppableDisabled:{const{id:n,key:r,disabled:o}=t,s=e.droppable.containers.get(n);if(!s||r!==s.key)return e;const c=new Xe(e.droppable.containers);return c.set(n,{...s,disabled:o}),{...e,droppable:{...e.droppable,containers:c}}}case Q.UnregisterDroppable:{const{id:n,key:r}=t,o=e.droppable.containers.get(n);if(!o||r!==o.key)return e;const s=new Xe(e.droppable.containers);return s.delete(n),{...e,droppable:{...e.droppable,containers:s}}}default:return e}}function hs(e){let{disabled:t}=e;const{active:n,activatorEvent:r,draggableNodes:o}=f.useContext(Rt),s=Ht(r),c=Ht(n?.id);return f.useEffect(()=>{if(!t&&!r&&s&&c!=null){if(!rn(s)||document.activeElement===s.target)return;const a=o.get(c);if(!a)return;const{activatorNode:u,node:d}=a;if(!u.current&&!d.current)return;requestAnimationFrame(()=>{for(const g of[u.current,d.current]){if(!g)continue;const h=no(g);if(h){h.focus();break}}})}},[r,t,o,c,s]),null}function gs(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((o,s)=>s({transform:o,...r}),n):n}function ps(e){return f.useMemo(()=>({draggable:{...ht.draggable,...e?.draggable},droppable:{...ht.droppable,...e?.droppable},dragOverlay:{...ht.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function vs(e){let{activeNode:t,measure:n,initialRect:r,config:o=!0}=e;const s=f.useRef(!1),{x:c,y:a}=typeof o=="boolean"?{x:o,y:o}:o;be(()=>{if(!c&&!a||!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=Qn(g,r);if(c||(h.x=0),a||(h.y=0),s.current=!0,Math.abs(h.x)>0||Math.abs(h.y)>0){const x=er(d);x&&x.scrollBy({top:h.y,left:h.x})}},[t,c,a,r,n])}const dr=f.createContext({...pe,scaleX:1,scaleY:1});var Re;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(Re||(Re={}));const fr=f.memo(function(t){var n,r,o,s;let{id:c,accessibility:a,autoScroll:u=!0,children:d,sensors:g=as,collisionDetection:h=yo,measuring:x,modifiers:p,...b}=t;const v=f.useReducer(fs,void 0,ds),[y,w]=v,[E,T]=co(),[I,k]=f.useState(Re.Uninitialized),M=I===Re.Initialized,{draggable:{active:A,nodes:L,translate:V},droppable:{containers:F}}=y,D=A!=null?L.get(A):null,U=f.useRef({initial:null,translated:null}),G=f.useMemo(()=>{var re;return A!=null?{id:A,data:(re=D?.data)!=null?re:cs,rect:U}:null},[A,D]),$=f.useRef(null),[j,C]=f.useState(null),[O,_]=f.useState(null),N=Ke(b,Object.values(b)),z=tt("DndDescribedBy",c),m=f.useMemo(()=>F.getEnabled(),[F]),R=ps(x),{droppableRects:P,measureDroppableContainers:B,measuringScheduled:q}=Xo(m,{dragging:M,dependencies:[V.x,V.y],config:R.droppable}),X=Go(L,A),H=f.useMemo(()=>O?Wt(O):null,[O]),K=qr(),J=Ko(X,R.draggable.measure);vs({activeNode:A!=null?L.get(A):null,config:K.layoutShiftCompensation,initialRect:J,measure:R.draggable.measure});const Y=Tn(X,R.draggable.measure,J),se=Tn(X?X.parentElement:null),ne=f.useRef({activatorEvent:null,active:null,activeNode:X,collisionRect:null,collisions:null,droppableRects:P,draggableNodes:L,draggingNode:null,draggingNodeRect:null,droppableContainers:F,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),he=F.getNodeFor((n=ne.current.over)==null?void 0:n.id),xe=is({measure:R.dragOverlay.measure}),Te=(r=xe.nodeRef.current)!=null?r:X,Me=M?(o=xe.rect)!=null?o:Y:null,un=!!(xe.nodeRef.current&&xe.rect),dn=Qo(un?null:Y),Ot=lr(Te?ae(Te):null),Se=es(M?he??X:null),ot=os(Se),st=gs(p,{transform:{x:V.x-dn.x,y:V.y-dn.y,scaleX:1,scaleY:1},activatorEvent:O,active:G,activeNodeRect:Y,containerNodeRect:se,draggingNodeRect:Me,over:ne.current.over,overlayNodeRect:xe.rect,scrollableAncestors:Se,scrollableAncestorRects:ot,windowRect:Ot}),fn=H?$e(H,V):null,hn=ts(Se),Fr=On(hn),Br=On(hn,[Y]),Oe=$e(st,Fr),_e=Me?Co(Me,st):null,Pe=G&&_e?h({active:G,collisionRect:_e,droppableRects:P,droppableContainers:m,pointerCoordinates:fn}):null,gn=bo(Pe,"id"),[we,pn]=f.useState(null),Vr=un?st:$e(st,Br),Hr=So(Vr,(s=we?.rect)!=null?s:null,Y),_t=f.useRef(null),vn=f.useCallback((re,ce)=>{let{sensor:le,options:Ce}=ce;if($.current==null)return;const de=L.get($.current);if(!de)return;const ue=re.nativeEvent,ve=new le({active:$.current,activeNode:de,event:ue,options:Ce,context:ne,onAbort(te){if(!L.get(te))return;const{onDragAbort:me}=N.current,ye={id:te};me?.(ye),E({type:"onDragAbort",event:ye})},onPending(te,De,me,ye){if(!L.get(te))return;const{onDragPending:Ye}=N.current,je={id:te,constraint:De,initialCoordinates:me,offset:ye};Ye?.(je),E({type:"onDragPending",event:je})},onStart(te){const De=$.current;if(De==null)return;const me=L.get(De);if(!me)return;const{onDragStart:ye}=N.current,ze={activatorEvent:ue,active:{id:De,data:me.data,rect:U}};Ue.unstable_batchedUpdates(()=>{ye?.(ze),k(Re.Initializing),w({type:Q.DragStart,initialCoordinates:te,active:De}),E({type:"onDragStart",event:ze}),C(_t.current),_(ue)})},onMove(te){w({type:Q.DragMove,coordinates:te})},onEnd:ke(Q.DragEnd),onCancel:ke(Q.DragCancel)});_t.current=ve;function ke(te){return async function(){const{active:me,collisions:ye,over:ze,scrollAdjustedTranslate:Ye}=ne.current;let je=null;if(me&&Ye){const{cancelDrop:Fe}=N.current;je={activatorEvent:ue,active:me,collisions:ye,delta:Ye,over:ze},te===Q.DragEnd&&typeof Fe=="function"&&await Promise.resolve(Fe(je))&&(te=Q.DragCancel)}$.current=null,Ue.unstable_batchedUpdates(()=>{w({type:te}),k(Re.Uninitialized),pn(null),C(null),_(null),_t.current=null;const Fe=te===Q.DragEnd?"onDragEnd":"onDragCancel";if(je){const kt=N.current[Fe];kt?.(je),E({type:Fe,event:je})}})}}},[L]),Wr=f.useCallback((re,ce)=>(le,Ce)=>{const de=le.nativeEvent,ue=L.get(Ce);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=Ce,vn(le,ce))},[L,vn]),mn=qo(g,Wr);ns(g),be(()=>{Y&&I===Re.Initializing&&k(Re.Initialized)},[Y,I]),f.useEffect(()=>{const{onDragMove:re}=N.current,{active:ce,activatorEvent:le,collisions:Ce,over:de}=ne.current;if(!ce||!le)return;const ue={active:ce,activatorEvent:le,collisions:Ce,delta:{x:Oe.x,y:Oe.y},over:de};Ue.unstable_batchedUpdates(()=>{re?.(ue),E({type:"onDragMove",event:ue})})},[Oe.x,Oe.y]),f.useEffect(()=>{const{active:re,activatorEvent:ce,collisions:le,droppableContainers:Ce,scrollAdjustedTranslate:de}=ne.current;if(!re||$.current==null||!ce||!de)return;const{onDragOver:ue}=N.current,ve=Ce.get(gn),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(()=>{pn(ke),ue?.(te),E({type:"onDragOver",event:te})})},[gn]),be(()=>{ne.current={activatorEvent:O,active:G,activeNode:X,collisionRect:_e,collisions:Pe,droppableRects:P,draggableNodes:L,draggingNode:Te,draggingNodeRect:Me,droppableContainers:F,over:we,scrollableAncestors:Se,scrollAdjustedTranslate:Oe},U.current={initial:Me,translated:_e}},[G,X,Pe,_e,L,Te,Me,P,F,we,Se,Oe]),Ho({...K,delta:V,draggingRect:_e,pointerCoordinates:fn,scrollableAncestors:Se,scrollableAncestorRects:ot});const Ur=f.useMemo(()=>({active:G,activeNode:X,activeNodeRect:Y,activatorEvent:O,collisions:Pe,containerNodeRect:se,dragOverlay:xe,draggableNodes:L,droppableContainers:F,droppableRects:P,over:we,measureDroppableContainers:B,scrollableAncestors:Se,scrollableAncestorRects:ot,measuringConfiguration:R,measuringScheduled:q,windowRect:Ot}),[G,X,Y,O,Pe,se,xe,L,F,P,we,B,Se,ot,R,q,Ot]),Gr=f.useMemo(()=>({activatorEvent:O,activators:mn,active:G,activeNodeRect:Y,ariaDescribedById:{draggable:z},dispatch:w,draggableNodes:L,over:we,measureDroppableContainers:B}),[O,mn,G,Y,w,z,L,we,B]);return f.createElement(Jn.Provider,{value:T},f.createElement(Rt.Provider,{value:Gr},f.createElement(ur.Provider,{value:Ur},f.createElement(dr.Provider,{value:Hr},d)),f.createElement(hs,{disabled:a?.restoreFocus===!1})),f.createElement(fo,{...a,hiddenTextDescribedById:z}));function qr(){const re=j?.autoScrollEnabled===!1,ce=typeof u=="object"?u.enabled===!1:u===!1,le=M&&!re&&!ce;return typeof u=="object"?{...u,enabled:le}:{enabled:le}}}),ms=f.createContext(null),kn="button",bs="Draggable";function xs(e){let{id:t,data:n,disabled:r=!1,attributes:o}=e;const s=tt(bs),{activators:c,activatorEvent:a,active:u,activeNodeRect:d,ariaDescribedById:g,draggableNodes:h,over:x}=f.useContext(Rt),{role:p=kn,roleDescription:b="draggable",tabIndex:v=0}=o??{},y=u?.id===t,w=f.useContext(y?dr:ms),[E,T]=bt(),[I,k]=bt(),M=rs(c,t),A=Ke(n);be(()=>(h.set(t,{id:t,key:s,node:E,activatorNode:I,data:A}),()=>{const V=h.get(t);V&&V.key===s&&h.delete(t)}),[h,t]);const L=f.useMemo(()=>({role:p,tabIndex:v,"aria-disabled":r,"aria-pressed":y&&p===kn?!0:void 0,"aria-roledescription":b,"aria-describedby":g.draggable}),[r,p,v,y,b,g.draggable]);return{active:u,activatorEvent:a,activeNodeRect:d,attributes:L,isDragging:y,listeners:r?void 0:M,node:E,over:x,setNodeRef:T,setActivatorNodeRef:k,transform:w}}function ys(){return f.useContext(ur)}const Ss="Droppable",ws={timeout:25};function Cs(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:o}=e;const s=tt(Ss),{active:c,dispatch:a,over:u,measureDroppableContainers:d}=f.useContext(Rt),g=f.useRef({disabled:n}),h=f.useRef(!1),x=f.useRef(null),p=f.useRef(null),{disabled:b,updateMeasurementsFor:v,timeout:y}={...ws,...o},w=Ke(v??r),E=f.useCallback(()=>{if(!h.current){h.current=!0;return}p.current!=null&&clearTimeout(p.current),p.current=setTimeout(()=>{d(Array.isArray(w.current)?w.current:[w.current]),p.current=null},y)},[y]),T=jt({callback:E,disabled:b||!c}),I=f.useCallback((L,V)=>{T&&(V&&(T.unobserve(V),h.current=!1),L&&T.observe(L))},[T]),[k,M]=bt(I),A=Ke(t);return f.useEffect(()=>{!T||!k.current||(T.disconnect(),h.current=!1,T.observe(k.current))},[k,T]),f.useEffect(()=>(a({type:Q.RegisterDroppable,element:{id:r,key:s,disabled:n,node:k,rect:x,data:A}}),()=>a({type:Q.UnregisterDroppable,key:s,id:r})),[r]),f.useEffect(()=>{n!==g.current.disabled&&(a({type:Q.SetDroppableDisabled,id:r,key:s,disabled:n}),g.current.disabled=n)},[r,s,n,a]),{active:c,rect:x,isOver:u?.id===r,node:k,over:u,setNodeRef:M}}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 Ds(e,t){return e.reduce((n,r,o)=>{const s=t.get(r);return s&&(n[o]=s),n},Array(e.length))}function at(e){return e!==null&&e>=0}function js(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 Rs(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const ct={scaleX:1,scaleY:1},Es=e=>{var t;let{rects:n,activeNodeRect:r,activeIndex:o,overIndex:s,index:c}=e;const a=(t=n[o])!=null?t:r;if(!a)return null;const u=Ts(n,c,o);if(c===o){const d=n[s];return d?{x:o<s?d.left+d.width-(a.left+a.width):d.left-a.left,y:0,...ct}:null}return c>o&&c<=s?{x:-a.width-u,y:0,...ct}:c<o&&c>=s?{x:a.width+u,y:0,...ct}:{x:0,y:0,...ct}};function Ts(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 hr=e=>{let{rects:t,activeIndex:n,overIndex:r,index:o}=e;const s=Et(t,r,n),c=t[o],a=s[o];return!a||!c?null:{x:a.left-c.left,y:a.top-c.top,scaleX:a.width/c.width,scaleY:a.height/c.height}},lt={scaleX:1,scaleY:1},Ms=e=>{var t;let{activeIndex:n,activeNodeRect:r,index:o,rects:s,overIndex:c}=e;const a=(t=s[n])!=null?t:r;if(!a)return null;if(o===n){const d=s[c];return d?{x:0,y:n<c?d.top+d.height-(a.top+a.height):d.top-a.top,...lt}:null}const u=Os(s,o,n);return o>n&&o<=c?{x:0,y:-a.height-u,...lt}:o<n&&o>=c?{x:0,y:a.height+u,...lt}:{x:0,y:0,...lt}};function Os(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 gr="Sortable",pr=f.createContext({activeIndex:-1,containerId:gr,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:hr,disabled:{draggable:!1,droppable:!1}});function vr(e){let{children:t,id:n,items:r,strategy:o=hr,disabled:s=!1}=e;const{active:c,dragOverlay:a,droppableRects:u,over:d,measureDroppableContainers:g}=ys(),h=tt(gr,n),x=a.rect!==null,p=f.useMemo(()=>r.map(M=>typeof M=="object"&&"id"in M?M.id:M),[r]),b=c!=null,v=c?p.indexOf(c.id):-1,y=d?p.indexOf(d.id):-1,w=f.useRef(p),E=!js(p,w.current),T=y!==-1&&v===-1||E,I=Rs(s);be(()=>{E&&b&&g(p)},[E,p,b,g]),f.useEffect(()=>{w.current=p},[p]);const k=f.useMemo(()=>({activeIndex:v,containerId:h,disabled:I,disableTransforms:T,items:p,overIndex:y,useDragOverlay:x,sortedRects:Ds(p,u),strategy:o}),[v,h,I.draggable,I.droppable,T,p,y,u,x,o]);return f.createElement(pr.Provider,{value:k},t)}const _s=e=>{let{id:t,items:n,activeIndex:r,overIndex:o}=e;return Et(n,r,o).indexOf(t)},ks=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:o,items:s,newIndex:c,previousItems:a,previousContainerId:u,transition:d}=e;return!d||!r||a!==s&&o===c?!1:n?!0:c!==o&&t===u},$s={duration:200,easing:"ease"},mr="transform",Is=Ie.Transition.toString({property:mr,duration:0,easing:"linear"}),As={roleDescription:"sortable"};function Ls(e){let{disabled:t,index:n,node:r,rect:o}=e;const[s,c]=f.useState(null),a=f.useRef(n);return be(()=>{if(!t&&n!==a.current&&r.current){const u=o.current;if(u){const d=Ne(r.current,{ignoreTransform:!0}),g={x:u.left-d.left,y:u.top-d.top,scaleX:u.width/d.width,scaleY:u.height/d.height};(g.x||g.y)&&c(g)}}n!==a.current&&(a.current=n)},[t,n,r,o]),f.useEffect(()=>{s&&c(null)},[s]),s}function br(e){let{animateLayoutChanges:t=ks,attributes:n,disabled:r,data:o,getNewIndex:s=_s,id:c,strategy:a,resizeObserverConfig:u,transition:d=$s}=e;const{items:g,containerId:h,activeIndex:x,disabled:p,disableTransforms:b,sortedRects:v,overIndex:y,useDragOverlay:w,strategy:E}=f.useContext(pr),T=Ns(r,p),I=g.indexOf(c),k=f.useMemo(()=>({sortable:{containerId:h,index:I,items:g},...o}),[h,o,I,g]),M=f.useMemo(()=>g.slice(g.indexOf(c)),[g,c]),{rect:A,node:L,isOver:V,setNodeRef:F}=Cs({id:c,data:k,disabled:T.droppable,resizeObserverConfig:{updateMeasurementsFor:M,...u}}),{active:D,activatorEvent:U,activeNodeRect:G,attributes:$,setNodeRef:j,listeners:C,isDragging:O,over:_,setActivatorNodeRef:N,transform:z}=xs({id:c,data:k,attributes:{...As,...n},disabled:T.draggable}),m=Zr(F,j),R=!!D,P=R&&!b&&at(x)&&at(y),B=!w&&O,q=B&&P?z:null,H=P?q??(a??E)({rects:v,activeNodeRect:G,activeIndex:x,overIndex:y,index:I}):null,K=at(x)&&at(y)?s({id:c,items:g,activeIndex:x,overIndex:y}):I,J=D?.id,Y=f.useRef({activeId:J,items:g,newIndex:K,containerId:h}),se=g!==Y.current.items,ne=t({active:D,containerId:h,isDragging:O,isSorting:R,id:c,index:I,items:g,newIndex:Y.current.newIndex,previousItems:Y.current.items,previousContainerId:Y.current.containerId,transition:d,wasDragging:Y.current.activeId!=null}),he=Ls({disabled:!ne,index:I,node:L,rect:A});return f.useEffect(()=>{R&&Y.current.newIndex!==K&&(Y.current.newIndex=K),h!==Y.current.containerId&&(Y.current.containerId=h),g!==Y.current.items&&(Y.current.items=g)},[R,K,h,g]),f.useEffect(()=>{if(J===Y.current.activeId)return;if(J!=null&&Y.current.activeId==null){Y.current.activeId=J;return}const Te=setTimeout(()=>{Y.current.activeId=J},50);return()=>clearTimeout(Te)},[J]),{active:D,activeIndex:x,attributes:$,data:k,rect:A,index:I,newIndex:K,items:g,isOver:V,isSorting:R,isDragging:O,listeners:C,node:L,overIndex:y,over:_,setNodeRef:m,setActivatorNodeRef:N,setDroppableNodeRef:F,setDraggableNodeRef:j,transform:he??H,transition:xe()};function xe(){if(he||se&&Y.current.newIndex===I)return Is;if(!(B&&!rn(U)||!d)&&(R||ne))return Ie.Transition.toString({...d,property:mr})}}function Ns(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}}W.Down,W.Right,W.Up,W.Left;var ut={exports:{}},Nt={},dt={exports:{}},Pt={};var $n;function Ps(){if($n)return Pt;$n=1;var e=f;function t(h,x){return h===x&&(h!==0||1/h===1/x)||h!==h&&x!==x}var n=typeof Object.is=="function"?Object.is:t,r=e.useState,o=e.useEffect,s=e.useLayoutEffect,c=e.useDebugValue;function a(h,x){var p=x(),b=r({inst:{value:p,getSnapshot:x}}),v=b[0].inst,y=b[1];return s(function(){v.value=p,v.getSnapshot=x,u(v)&&y({inst:v})},[h,p,x]),o(function(){return u(v)&&y({inst:v}),h(function(){u(v)&&y({inst:v})})},[h]),c(p),p}function u(h){var x=h.getSnapshot;h=h.value;try{var p=x();return!n(h,p)}catch{return!0}}function d(h,x){return x()}var g=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?d:a;return Pt.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:g,Pt}var zt={};var In;function zs(){return In||(In=1,process.env.NODE_ENV!=="production"&&(function(){function e(p,b){return p===b&&(p!==0||1/p===1/b)||p!==p&&b!==b}function t(p,b){g||o.startTransition===void 0||(g=!0,console.error("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));var v=b();if(!h){var y=b();s(v,y)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),h=!0)}y=c({inst:{value:v,getSnapshot:b}});var w=y[0].inst,E=y[1];return u(function(){w.value=v,w.getSnapshot=b,n(w)&&E({inst:w})},[p,v,b]),a(function(){return n(w)&&E({inst:w}),p(function(){n(w)&&E({inst:w})})},[p]),d(v),v}function n(p){var b=p.getSnapshot;p=p.value;try{var v=b();return!s(p,v)}catch{return!0}}function r(p,b){return b()}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var o=f,s=typeof Object.is=="function"?Object.is:e,c=o.useState,a=o.useEffect,u=o.useLayoutEffect,d=o.useDebugValue,g=!1,h=!1,x=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?r:t;zt.useSyncExternalStore=o.useSyncExternalStore!==void 0?o.useSyncExternalStore:x,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()),zt}var An;function xr(){return An||(An=1,process.env.NODE_ENV==="production"?dt.exports=Ps():dt.exports=zs()),dt.exports}var Ln;function Ys(){if(Ln)return Nt;Ln=1;var e=f,t=xr();function n(d,g){return d===g&&(d!==0||1/d===1/g)||d!==d&&g!==g}var r=typeof Object.is=="function"?Object.is:n,o=t.useSyncExternalStore,s=e.useRef,c=e.useEffect,a=e.useMemo,u=e.useDebugValue;return Nt.useSyncExternalStoreWithSelector=function(d,g,h,x,p){var b=s(null);if(b.current===null){var v={hasValue:!1,value:null};b.current=v}else v=b.current;b=a(function(){function w(M){if(!E){if(E=!0,T=M,M=x(M),p!==void 0&&v.hasValue){var A=v.value;if(p(A,M))return I=A}return I=M}if(A=I,r(T,M))return A;var L=x(M);return p!==void 0&&p(A,L)?(T=M,A):(T=M,I=L)}var E=!1,T,I,k=h===void 0?null:h;return[function(){return w(g())},k===null?void 0:function(){return w(k())}]},[g,h,x,p]);var y=o(d,b[0],b[1]);return c(function(){v.hasValue=!0,v.value=y},[y]),u(y),y},Nt}var Yt={};var Nn;function Fs(){return Nn||(Nn=1,process.env.NODE_ENV!=="production"&&(function(){function e(d,g){return d===g&&(d!==0||1/d===1/g)||d!==d&&g!==g}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var t=f,n=xr(),r=typeof Object.is=="function"?Object.is:e,o=n.useSyncExternalStore,s=t.useRef,c=t.useEffect,a=t.useMemo,u=t.useDebugValue;Yt.useSyncExternalStoreWithSelector=function(d,g,h,x,p){var b=s(null);if(b.current===null){var v={hasValue:!1,value:null};b.current=v}else v=b.current;b=a(function(){function w(M){if(!E){if(E=!0,T=M,M=x(M),p!==void 0&&v.hasValue){var A=v.value;if(p(A,M))return I=A}return I=M}if(A=I,r(T,M))return A;var L=x(M);return p!==void 0&&p(A,L)?(T=M,A):(T=M,I=L)}var E=!1,T,I,k=h===void 0?null:h;return[function(){return w(g())},k===null?void 0:function(){return w(k())}]},[g,h,x,p]);var y=o(d,b[0],b[1]);return c(function(){v.hasValue=!0,v.value=y},[y]),u(y),y},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()),Yt}var Pn;function Bs(){return Pn||(Pn=1,process.env.NODE_ENV==="production"?ut.exports=Ys():ut.exports=Fs()),ut.exports}var Vs=Bs();const Xt=new WeakMap,Hs=new WeakMap,wt={current:[]};let Ft=!1;const ft=new Set,zn=new Map;function yr(e){for(const t of e){if(wt.current.includes(t))continue;wt.current.push(t),t.recompute();const n=Hs.get(t);if(n)for(const r of n){const o=Xt.get(r);o?.length&&yr(o)}}}function Ws(e){const t={prevVal:e.prevState,currentVal:e.state};for(const n of e.listeners)n(t)}function Us(e){const t={prevVal:e.prevState,currentVal:e.state};for(const n of e.listeners)n(t)}function Gs(e){if(ft.add(e),!Ft)try{for(Ft=!0;ft.size>0;){const t=Array.from(ft);ft.clear();for(const n of t){const r=zn.get(n)??n.prevState;n.prevState=r,Ws(n)}for(const n of t){const r=Xt.get(n);r&&(wt.current.push(n),yr(r))}for(const n of t){const r=Xt.get(n);if(r)for(const o of r)Us(o)}}}finally{Ft=!1,wt.current=[],zn.clear()}}function qs(e){return typeof e=="function"}class Sr{constructor(t,n){this.listeners=new Set,this.subscribe=r=>{var o,s;this.listeners.add(r);const c=(s=(o=this.options)==null?void 0:o.onSubscribe)==null?void 0:s.call(o,r,this);return()=>{this.listeners.delete(r),c?.()}},this.prevState=t,this.state=t,this.options=n}setState(t){var n,r,o;this.prevState=this.state,(n=this.options)!=null&&n.updateFn?this.state=this.options.updateFn(this.prevState)(t):qs(t)?this.state=t(this.prevState):this.state=t,(o=(r=this.options)==null?void 0:r.onUpdate)==null||o.call(r),Gs(this)}}function nt(e,t=r=>r,n={}){const r=n.equal??Xs;return Vs.useSyncExternalStoreWithSelector(e.subscribe,()=>e.state,()=>e.state,t,r)}function Xs(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[r,o]of e)if(!t.has(r)||!Object.is(o,t.get(r)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const r of e)if(!t.has(r))return!1;return!0}if(e instanceof Date&&t instanceof Date)return e.getTime()===t.getTime();const n=Yn(e);if(n.length!==Yn(t).length)return!1;for(let r=0;r<n.length;r++)if(!Object.prototype.hasOwnProperty.call(t,n[r])||!Object.is(e[n[r]],t[n[r]]))return!1;return!0}function Yn(e){return Object.keys(e).concat(Object.getOwnPropertySymbols(e))}const ie=new Sr({tableId:"",sortColumn:null,sortDirection:"asc",visibility:{},columnOrder:[],data:[],sortableColumns:[],actionsConfig:{showActionColumn:!0,showColumnVisibilityMenu:!0,children:"Actions",width:"100px"}});function wr(e,t){const n=e[0]??{},o=(t&&t.length?t:Object.keys(n).map(g=>({id:g,label:g}))).filter(g=>Object.prototype.hasOwnProperty.call(n,g.id)),{tableId:s}=ie.state,c=JSON.parse(localStorage.getItem(jr(s))||"[]"),a=[...c.map(g=>o.find(h=>h.id===g)).filter(Boolean),...o.filter(g=>!c.includes(g.id))],u=JSON.parse(localStorage.getItem(Rr(s))||"{}"),d=a.reduce((g,h)=>(g[h.id]=u[h.id]??!0,g),{});ie.setState(g=>({...g,data:e,columnOrder:a,visibility:d,sortableColumns:a.map(h=>({id:h.id,label:h.label,sortable:!0,backgroundColor:h.backgroundColor}))}))}function Cr(e){ie.setState(t=>({...t,tableId:e,sortColumn:null,sortDirection:"asc",columnOrder:[],visibility:{}}))}const Dr=e=>{ie.setState(t=>({...t,actionsConfig:e}))},jr=e=>`table_column_order_v1:${e}`,Rr=e=>`table_column_visibility_v1:${e}`,Ks=e=>{const{tableId:t}=ie.state;localStorage.setItem(jr(t),JSON.stringify(e.map(n=>n.id))),ie.setState(n=>({...n,columnOrder:e})),ie.setState(n=>({...n,columnOrder:e}))};function Js(e){ie.setState(t=>t.sortColumn===e?{...t,sortDirection:t.sortDirection==="asc"?"desc":"asc"}:{...t,sortColumn:e,sortDirection:"asc"})}const Zs=e=>{ie.setState(t=>{const n={...t.visibility,[e]:!t.visibility[e]};return t.tableId&&localStorage.setItem(Rr(t.tableId),JSON.stringify(n)),{...t,visibility:n}})};const Qs=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),ei=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,r)=>r?r.toUpperCase():n.toLowerCase()),Fn=e=>{const t=ei(e);return t.charAt(0).toUpperCase()+t.slice(1)},Er=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim(),ti=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0};var ni={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 ri=f.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:o="",children:s,iconNode:c,...a},u)=>f.createElement("svg",{ref:u,...ni,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:Er("lucide",o),...!s&&!ti(a)&&{"aria-hidden":"true"},...a},[...c.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(ri,{ref:s,iconNode:t,className:Er(`lucide-${Qs(Fn(e))}`,`lucide-${e}`,r),...o}));return n.displayName=Fn(e),n};const oi=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],si=oe("arrow-down",oi);const ii=[["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"}]],ai=oe("arrow-up-down",ii);const ci=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],li=oe("arrow-up",ci);const ui=[["path",{d:"m19 21-7-4-7 4V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v16z",key:"1fy3hk"}]],di=oe("bookmark",ui);const fi=[["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"}]],Bn=oe("calendar",fi);const hi=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],gi=oe("chevron-left",hi);const pi=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],vi=oe("chevron-right",pi);const mi=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 3v18",key:"108xh3"}]],bi=oe("columns-2",mi);const xi=[["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"}]],yi=oe("delete",xi);const Si=[["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"}]],wi=oe("ellipsis",Si);const Ci=[["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"}]],Di=oe("funnel",Ci);const ji=[["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"}]],Tr=oe("grip-vertical",ji);const Ri=[["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"}]],Ei=oe("pen",Ri);const Ti=[["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"}]],Mi=oe("refresh-ccw",Ti);const Oi=[["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"}]],_i=oe("settings",Oi);const ki=[["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"}]],Mr=oe("triangle-alert",ki);function S(e){return f.forwardRef((t,n)=>{const{children:r,...o}=t;return i.jsx(e,{ref:n,...o,children:r})})}const $i=S(l.Menu.Trigger),Ii=S(l.Menu.Positioner),Ai=S(l.Menu.Content),Li=S(l.Menu.Item),Ni=S(l.Checkbox.Label),Pi=S(l.Checkbox.HiddenInput),zi=S(l.Checkbox.Control);function Yi({visibility:e,onToggle:t}){const{sortableColumns:n}=nt(ie);return i.jsxs(l.Menu.Root,{closeOnSelect:!1,children:[i.jsx($i,{asChild:!0,children:i.jsx(l.IconButton,{"aria-label":"Toggle columns",variant:"ghost",ml:"1",size:"xs",children:i.jsx(bi,{size:18})})}),i.jsx(l.Portal,{children:i.jsx(Ii,{children:i.jsx(Ai,{minW:"220px",children:n.map(r=>{const o=!!e[r.id];return i.jsx(Li,{value:r.id,closeOnSelect:!1,children:i.jsxs(l.Checkbox.Root,{checked:o,onCheckedChange:()=>t(r.id),children:[i.jsx(Pi,{}),i.jsx(zi,{}),i.jsx(Ni,{children:r.label})]})},r.id)})})})})]})}function Fi({id:e,children:t,onClick:n,cursor:r,borderRight:o,borderRightColor:s,backgroundColor:c}){const{setNodeRef:a,attributes:u,listeners:d,transform:g,transition:h}=br({id:e});return i.jsx(l.Table.ColumnHeader,{ref:a,onClick:n,backgroundColor:c,w:e==="id"||e==="row_number"?"80px":void 0,style:{transform:Ie.Transform.toString(g),transition:h,cursor:r,borderRight:o,borderRightColor:s},...u,children:i.jsxs(l.HStack,{justify:"space-between",children:[t,i.jsx("span",{...d,children:i.jsx(Tr,{size:12})})]})})}function Bi(){const{columnOrder:e,visibility:t,sortColumn:n,sortDirection:r,sortableColumns:o,actionsConfig:s}=nt(ie),c=e.map(a=>o.find(u=>u.id===a.id)).filter(a=>a!==void 0).filter(a=>t[a.id]);return i.jsx(l.Table.Header,{background:"blue.200",position:"sticky",top:0,p:"0",zIndex:1,children:i.jsxs(l.Table.Row,{height:"28px",children:[c.map(a=>{const u=n===a?.id;return i.jsx(Fi,{id:a?.id,onClick:()=>a?.sortable&&Js(a?.id),cursor:a?.sortable?"pointer":"default",borderRight:"2px solid #dcdcdc",backgroundColor:a?.backgroundColor,children:i.jsxs("span",{style:{display:"flex",alignItems:"center",gap:6,userSelect:"none"},children:[a?.label,a?.sortable&&(u?r==="asc"?i.jsx(li,{size:14}):i.jsx(si,{size:14}):i.jsx(ai,{size:14,opacity:.4}))]})},a?.id)}),s?.showActionColumn&&i.jsx(l.Table.ColumnHeader,{width:s.width,backgroundColor:s.backgroundColor,borderRight:"2px solid #dcdcdc",children:s.children}),s?.showColumnVisibilityMenu&&i.jsx(l.Table.ColumnHeader,{boxSize:"0.5",backgroundColor:s.backgroundColorColumnVisibilityMenu,children:i.jsx(Yi,{visibility:t,onToggle:Zs})})]})})}const Vi=[10,20,50,100],Hi=S(l.Select.Positioner),Wi=S(l.Select.Content),Ui=S(l.Select.Item),Gi=S(l.Pagination.PrevTrigger),qi=S(l.Pagination.NextTrigger),Xi=S(l.Select.HiddenSelect),Ki=S(l.Select.Control),Ji=S(l.Select.Trigger),Zi=S(l.Select.ValueText),Qi=S(l.Select.IndicatorGroup),ea=S(l.Select.Indicator);function ta({totalCount:e,pageSize:t,currentPage:n,onPageChange:r,onPageSizeChange:o,siblingCount:s=2,pageSizeOptions:c=Vi}){const a=l.createListCollection({items:c.map(u=>({label:String(u),value:String(u)}))});return i.jsx(l.Box,{width:"100%",children:i.jsxs(l.HStack,{justify:"space-between",mx:"auto",flexWrap:"wrap",children:[i.jsxs(l.HStack,{children:[i.jsx(l.Text,{fontSize:"sm",color:"gray.600",_dark:{color:"gray.400"},children:"Rows per page:"}),i.jsxs(l.Select.Root,{collection:a,size:"sm",width:"60px",onValueChange:u=>o?.(Number(u.items[0].value)),value:[String(t)],children:[i.jsx(Xi,{}),i.jsxs(Ki,{children:[i.jsx(Ji,{children:i.jsx(Zi,{placeholder:""})}),i.jsx(Qi,{children:i.jsx(ea,{})})]}),i.jsx(l.Portal,{children:i.jsx(Hi,{children:i.jsx(Wi,{children:a.items.map(u=>i.jsxs(Ui,{item:u.value,children:[u.label,i.jsx(l.Select.ItemIndicator,{})]},u.value))})})})]})]}),i.jsx(l.Pagination.Root,{count:e,pageSize:t,page:n,siblingCount:s,onPageChange:u=>r&&r(u.page),children:i.jsxs(l.ButtonGroup,{size:"sm",variant:"ghost",children:[i.jsx(Gi,{asChild:!0,children:i.jsx(l.IconButton,{"aria-label":"Previous page",children:i.jsx(gi,{size:18})})}),i.jsx(l.Pagination.Items,{render:u=>i.jsx(l.IconButton,{variant:u.type==="page"&&u.value===n?"outline":"ghost","aria-current":u.type==="page"&&u.value===n?"page":void 0,children:u.type==="page"?u.value:"…"},u.value??u.type)}),i.jsx(qi,{asChild:!0,children:i.jsx(l.IconButton,{"aria-label":"Next page",children:i.jsx(vi,{size:18})})})]})})]})})}const na=S(l.Menu.Item),ra=S(l.Menu.Content),oa=S(l.Menu.Positioner),sa=S(l.Menu.Trigger);function ia({data:e=[],actions:t=[],actionConfig:n,onRowSelect:r}){const{columnOrder:o,visibility:s}=nt(ie);return i.jsx(l.Table.Body,{children:e.map(c=>i.jsxs(l.Table.Row,{onClick:()=>r?.(c.__raw),_hover:{bg:"blue.50"},children:[o.filter(a=>s[a.id]).map(a=>i.jsx(l.Table.Cell,{children:c[a.id]},a.id)),n?.showActionColumn&&i.jsx(l.Table.Cell,{textAlign:"center",display:"flex",gap:2,children:i.jsxs(l.Menu.Root,{children:[i.jsx(sa,{asChild:!0,children:i.jsx(l.IconButton,{"aria-label":"Open",variant:"ghost",size:"sm",children:i.jsx(wi,{size:16})})}),i.jsx(l.Portal,{children:i.jsx(oa,{children:i.jsx(ra,{children:t.filter(a=>typeof a.visible=="function"?a.visible(c.__raw):a.visible!==!1).map(a=>i.jsxs(na,{onClick:()=>a.onClick(c.__raw),colorScheme:a.colorScheme,value:a.label,children:[a.icon,a.label]},a.label))})})})]})}),n?.showColumnVisibilityMenu&&i.jsx(l.Table.Cell,{})]},c.__key||c.id))})}function aa({rows:e=6,columns:t}){return i.jsx(l.Table.Body,{children:Array.from({length:e}).map((n,r)=>i.jsx(l.Table.Row,{children:Array.from({length:t}).map((o,s)=>i.jsx(l.Table.Cell,{children:i.jsx(l.Skeleton,{height:"25px"})},s))},r))})}function ca({tableId:e,data:t=[],headers:n=[],loading:r=!1,loadingChildren:o,skeletonLoading:s=!1,emptyMessage:c="No data",actions:a,page:u=1,pageSize:d=10,onPageChange:g,onPageSizeChange:h,density:x="sm",totalCount:p=0,paginationMode:b="client",actionConfig:v,pageSizeOptions:y,onRowSelect:w}){f.useEffect(()=>{Cr(e)},[e]),f.useEffect(()=>{wr(t,n)},[t,n]),f.useEffect(()=>{v&&Dr(v)},[v]);const{sortColumn:E,sortDirection:T,data:I,columnOrder:k}=nt(ie),M=f.useMemo(()=>{const D=[...I],U=Math.max(1,u||1);if(E&&D.sort((G,$)=>T==="asc"?String(G[E]).localeCompare(String($[E])):String($[E]).localeCompare(String(G[E]))),b==="client"){const G=(U-1)*d;return D.slice(G,G+d)}return D},[I,E,T,u,d,b]);f.useEffect(()=>{u<1&&g&&g(1)},[u,g]);const A=D=>{const{active:U,over:G}=D;if(!G||U.id===G.id)return;const $=k.findIndex(O=>O.id===U.id),j=k.findIndex(O=>O.id===G.id),C=Et(k,$,j);Ks(C)},L=r&&!s,V=s&&!r,F=!r&&!s&&M.length===0;return i.jsx(fr,{collisionDetection:Zn,onDragEnd:A,children:i.jsx(vr,{items:k.map(D=>D.id),strategy:Es,children:i.jsxs(l.Box,{flex:"1",minH:0,display:"flex",flexDirection:"column",p:2,children:[i.jsxs(l.Box,{flex:"1",minH:0,position:"relative",overflow:"auto",children:[L&&i.jsx(l.Box,{position:"absolute",inset:0,display:"flex",alignItems:"center",justifyContent:"center",zIndex:10,bg:"whiteAlpha.600",children:o??i.jsx(l.Spinner,{})}),i.jsxs(l.Table.Root,{variant:"outline",w:"100%",size:x,children:[i.jsx(Bi,{}),V?i.jsx(aa,{rows:d,columns:n.length+(a?2:0)}):F?i.jsx(l.Table.Body,{children:i.jsx(l.Table.Row,{children:i.jsx(l.Table.Cell,{colSpan:n.length+(a?1:0),children:i.jsx(l.Box,{display:"flex",alignItems:"center",justifyContent:"center",minH:"200px",color:"gray.500",children:c})})})}):i.jsx(ia,{data:M,actions:a,actionConfig:v,onRowSelect:w})]})]}),i.jsx(l.Box,{mt:.5,children:i.jsx(ta,{totalCount:p,pageSize:d,currentPage:u,onPageChange:g,onPageSizeChange:D=>{h?.(D),u>1&&g?.(1)},pageSizeOptions:y})})]})})})}const la=S(l.Checkbox.Root),ua=S(l.Checkbox.HiddenInput),da=S(l.Checkbox.Control),fa=S(l.Checkbox.Label),Or=({value:e,onChange:t,size:n="sm",label:r,helperText:o,isDisabled:s,required:c,errorText:a})=>i.jsxs(la,{value:e,onChange:t,size:n,children:[i.jsx(ua,{}),i.jsx(da,{disabled:s,required:c,errorText:a,helperText:o}),r&&i.jsx(fa,{children:r})]}),ha=S(l.Combobox.Root),ga=S(l.Combobox.Control),pa=S(l.Combobox.Input),va=S(l.Combobox.IndicatorGroup),ma=S(l.Combobox.ClearTrigger),ba=S(l.Combobox.Trigger),xa=S(l.Combobox.Positioner),ya=S(l.Combobox.Content);function _r({label:e,size:t="sm",width:n="100%",variant:r="outline",items:o=[],itemToString:s,itemToValue:c,renderItem:a,value:u,loading:d,error:g,errorMessage:h,placeholder:x,helpText:p,onInputChange:b,onSelect:v,visible:y=!0,rootProps:w,inputProps:E,controlProps:T,contentProps:I,itemProps:k}){const[M,A]=f.useState(""),{collection:L,set:V}=l.useListCollection({initialItems:o,itemToString:s,itemToValue:c}),F=f.useMemo(()=>{if(!M)return o;const D=M.toLowerCase();return o.filter(U=>s(U).toLowerCase().includes(D))},[o,M,s]);return f.useEffect(()=>{V(F)},[F,V]),f.useEffect(()=>{u&&A(s(u))},[u,s]),i.jsxs(ha,{width:n,size:t,variant:r,collection:L,placeholder:x,onInputValueChange:D=>{b?.(D.inputValue),A(D.inputValue)},value:u?[c(u)]:[],onValueChange:D=>{const U=D.value?.[0];if(!U)return;const G=L.items.find($=>c($)===U);G&&v?.(G)},positioning:{sameWidth:!1,placement:"bottom-start"},...w,children:[y&&e&&i.jsx(l.Text,{fontSize:"sm",children:e}),i.jsxs(ga,{...T,children:[i.jsx(pa,{placeholder:x??"Type to search",...E}),i.jsxs(va,{children:[i.jsx(ma,{}),i.jsx(ba,{})]})]}),i.jsx(xa,{children:i.jsxs(ya,{minW:"sm",...I,children:[d?i.jsxs(l.HStack,{p:"2",children:[i.jsx(l.Spinner,{size:"xs",borderWidth:"1px"}),i.jsx(l.Span,{children:"Loading..."})]}):g?i.jsx(l.Text,{p:"2",color:"red.500",fontSize:"sm",children:h||"Something went wrong"}):L.items.map(D=>i.jsxs(l.Combobox.Item,{item:D,...k,children:[a(D),i.jsx(l.Combobox.ItemIndicator,{})]},c(D))),p&&!g&&!d&&i.jsx(l.Text,{p:"2",color:"fg.muted",fontSize:"sm",children:p})]})})]})}const Z=" to ",Vn=10,Ee={DAY_MAX:31,MONTH_MAX:12,YEAR_MIN:1900,YEAR_MAX:2100},ln=()=>{const e=new Date;return{year:e.getFullYear(),month:e.getMonth()+1,day:e.getDate()}},Hn=()=>{const{year:e,month:t,day:n}=ln();return`${String(n).padStart(2,"0")}-${String(t).padStart(2,"0")}-${e}`},Sa=()=>{const{year:e,month:t,day:n}=ln();return`${e}-${String(t).padStart(2,"0")}-${String(n).padStart(2,"0")}`},wa=(e,t)=>{const n=e.length,r=parseInt(e);if(!e||isNaN(r))return t;if(n===4)return r>=Ee.YEAR_MIN&&r<=Ee.YEAR_MAX?r:t;if(n>0&&n<4){const o=t.toString(),s=4-n,c=o.substring(0,s);return parseInt(c+e)}return t},He=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}=ln();let c,a,u;return n.length===1?(c=parseInt(n[0])||s,a=o,u=r):n.length===2?(c=parseInt(n[0])||s,a=parseInt(n[1])||o,u=r):(c=parseInt(n[0])||s,a=parseInt(n[1])||o,u=wa(n[2],r)),a=Math.max(1,Math.min(Ee.MONTH_MAX,a)),c=Math.max(1,Math.min(Ee.DAY_MAX,c)),`${u}-${String(a).padStart(2,"0")}-${String(c).padStart(2,"0")}`},ge=e=>{if(!e)return"";const[t,n,r]=e.split("-");return`${r}-${n}-${t}`},Ca=(e,t)=>{if(e[0]?.length>0){const n=parseInt(e[0]);if(isNaN(n)||n===0||e[0].length===2&&n>Ee.DAY_MAX)return t}if(e[1]?.length>0){const n=parseInt(e[1]);if(isNaN(n)||n===0||e[1].length===2&&n>Ee.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<Ee.YEAR_MIN||n>Ee.YEAR_MAX))return t}return null},We=e=>{let t=e.replace(/[^\d-]/g,"").substring(0,Vn);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,Vn),Ca(n,e)||t},Da=S(l.Popover.Root),ja=S(l.Popover.Trigger),Ra=S(l.Popover.Content),Ea=S(l.Popover.Positioner);function Ta({value:e,onChange:t,disabled:n=!1}){const[r="",o=""]=e?e.split("|"):[],[s,c]=f.useState(()=>r&&o?`${ge(r)}${Z}${ge(o)}`:r?ge(r):""),[a,u]=f.useState(!1),d=f.useRef(null);f.useEffect(()=>{const b=v=>{v.ctrlKey&&v.key==="d"&&!v.shiftKey&&!v.metaKey&&(v.preventDefault(),d.current?.focus())};return window.addEventListener("keydown",b),()=>window.removeEventListener("keydown",b)},[]);const g=b=>{let v=b;if(v.includes(Z)){const[y,w=""]=v.split(Z);v=`${We(y.trim())}${Z}${We(w.trim())}`}else if(v.toLowerCase().includes(" to ")){const[y,w=""]=v.split(/\s+to\s+/i);v=`${We(y.trim())} to ${We(w.trim())}`}else v=We(v);c(v)},h=()=>{const b=s.trim();if(!b){t(void 0);return}if(b.includes(Z)){const[v,y=""]=b.split(Z).map(T=>T.trim()),w=He(v),E=y?He(y):null;if(w&&E){const[T,I]=E<w?[E,w]:[w,E],k=`${ge(T)}${Z}${ge(I)}`;c(k),t(`${T}|${I}`)}else if(w&&!y)c(`${ge(w)}${Z}`),t(void 0);else if(w&&y){const T=Sa(),[I,k]=T<w?[T,w]:[w,T],M=`${ge(I)}${Z}${ge(k)}`;c(M),t(`${I}|${k}`)}else c(""),t(void 0)}else{const v=He(b);v?(c(`${ge(v)}${Z}`),t(void 0)):(c(""),t(void 0))}},x=b=>{if(b.key!=="Enter")return;b.preventDefault();const v=d.current?.selectionStart||0,y=s.indexOf(Z);if(!s.trim()){c(`${Hn()}${Z}`);return}if(y===-1){const E=He(s.trim());E&&c(`${ge(E)}${Z}`);return}if(v<=y+Z.length){const E=s.substring(0,y).trim(),T=s.substring(y+Z.length),I=He(E);I&&c(`${ge(I)}${Z}${T}`);return}if(s.substring(y+Z.length).trim())h(),d.current?.blur();else{const E=s.substring(0,y+Z.length)+Hn();c(E),setTimeout(()=>{h(),d.current?.blur()},0)}},p=()=>{c(""),t(void 0)};return i.jsx(l.InputGroup,{children:i.jsx(i.Fragment,{children:i.jsxs(l.InputElement,{position:"revert",children:[i.jsxs(Da,{open:a,onEscapeKeyDown:()=>{u(!1)},children:[i.jsx(ja,{asChild:!0,children:i.jsx(l.IconButton,{size:"sm",variant:"ghost","aria-label":"Date range help",onClick:()=>u(b=>!b),children:i.jsx(Bn,{size:16})})}),i.jsx(l.Portal,{children:i.jsx(Ea,{children:i.jsxs(Ra,{p:4,children:[i.jsx(l.PopoverArrow,{}),i.jsxs(l.VStack,{align:"start",gap:4,children:[i.jsxs(l.HStack,{children:[i.jsx(Bn,{size:16}),i.jsx(l.Text,{fontWeight:"semibold",fontSize:"sm",children:"Date Range Filter"})]}),i.jsxs(l.VStack,{align:"start",gap:1,children:[i.jsx(l.Text,{fontSize:"sm",fontWeight:"medium",children:"Format:"}),i.jsxs(l.Text,{fontSize:"xs",color:"gray.600",children:["DD-MM-YYYY",Z,"DD-MM-YYYY"]})]}),i.jsxs(l.VStack,{align:"start",gap:1,children:[i.jsx(l.Text,{fontSize:"sm",fontWeight:"medium",children:"Tips:"}),i.jsx(l.Text,{fontSize:"xs",children:'• "15 to 20" → assumes current month/year'}),i.jsx(l.Text,{fontSize:"xs",children:"• Leave end blank → up to today"}),i.jsx(l.Text,{fontSize:"xs",children:"• Dates auto-swapped if reversed"}),i.jsx(l.Text,{fontSize:"xs",children:"• Press Enter on empty end → fills today"})]}),i.jsxs(l.VStack,{align:"start",gap:1,children:[i.jsx(l.Text,{fontSize:"sm",fontWeight:"medium",children:"Shortcut:"}),i.jsxs(l.HStack,{children:[i.jsx(l.Kbd,{children:"Ctrl"}),i.jsx(l.Text,{children:"+"}),i.jsx(l.Kbd,{children:"D"})]})]})]})]})})})]}),i.jsx(l.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(l.InputElement,{children:i.jsx(l.IconButton,{size:"sm",variant:"ghost","aria-label":"Clear date range",onClick:p,w:"100%"})})]})})})}const Ma=S(l.Field.Root),Oa=S(l.Field.Label),_a=S(l.Field.HelperText),ka=S(l.Field.ErrorText),Kt=({icon:e,value:t,onChange:n,placeholder:r,size:o="xs",variant:s="outline",width:c="100%",label:a,helperText:u,isDisabled:d=!1,required:g=!1,errorText:h,visible:x})=>i.jsxs(Ma,{width:c,children:[x&&i.jsx(Oa,{children:a}),i.jsx(l.InputGroup,{startElement:e,children:i.jsx(l.Input,{value:t,onChange:p=>n?.(p.target.value),placeholder:r,size:o,variant:s,disabled:d,required:g})}),h&&i.jsx(ka,{fontSize:"xs",children:h}),u&&i.jsx(_a,{fontSize:"xs",children:u})]}),$a=S(l.Field.Root),Ia=S(l.Field.HelperText),Aa=S(l.Field.ErrorText),La=S(l.Select.Root),Na=S(l.Select.Label),Pa=S(l.Select.Control),za=S(l.Select.Trigger),Ya=S(l.Select.ValueText),Fa=S(l.Select.IndicatorGroup),Ba=S(l.Select.Indicator),Va=S(l.Select.Content),Ha=S(l.Select.Item),Wa=S(l.Select.ItemIndicator),Ua=S(l.Select.HiddenSelect),Ga=S(l.Select.Positioner),kr=({options:e=[],label:t,value:n,onChange:r,placeholder:o,size:s="xs",width:c="100%",variant:a="outline",helperText:u,isDisabled:d,required:g,errorText:h,visible:x})=>{const p=l.createListCollection({items:e});return i.jsxs($a,{disabled:d,required:g,children:[i.jsxs(La,{collection:p,variant:a,size:s,width:c,value:n?[n]:[],onValueChange:b=>r?.(b.value[0]),children:[i.jsx(Ua,{}),x&&i.jsx(Na,{children:t}),i.jsxs(Pa,{children:[i.jsx(za,{children:i.jsx(Ya,{placeholder:o})}),i.jsx(Fa,{children:i.jsx(Ba,{})})]}),i.jsx(Ga,{children:i.jsx(Va,{children:p.items.map(b=>i.jsxs(Ha,{item:b,children:[b.label,i.jsx(Wa,{})]},b.value))})})]}),u&&i.jsx(Ia,{children:u}),h&&i.jsx(Aa,{children:h})]})},$r=(e="default")=>`FILTER_PRESETS_${e}`,qa=e=>{if(!e)return[];try{return JSON.parse(e)}catch{return[]}},Xa=e=>typeof window>"u"?[]:qa(localStorage.getItem($r(e))),Ze=new Sr({}),rt=e=>{const t=Ze.state;if(e in t)return t[e];const n=Xa(e);return Ze.setState(r=>({...r,[e]:n})),n},Tt=(e,t)=>{Ze.setState(n=>({...n,[e]:t})),typeof window<"u"&&localStorage.setItem($r(e),JSON.stringify(t))},Ir=(e,t)=>{const n=[t,...rt(e)];Tt(e,n)},Ar=(e,t)=>{const n=rt(e).filter(r=>r.id!==t);Tt(e,n)},Ka=(e,t,n)=>{const r=rt(e).map(o=>o.id===t?n(o):o);Tt(e,r)},Ja=S(l.Checkbox.Root),Za=S(l.Checkbox.HiddenInput),Qa=S(l.Checkbox.Control),ec=S(l.Slider.Root),tc=S(l.Slider.Track),nc=S(l.Slider.Range),rc=S(l.Slider.Thumbs),oc=S(l.Slider.Control),sc=({filter:e,onVisibilityChange:t,onSizeChange:n})=>{const{attributes:r,listeners:o,setNodeRef:s,transform:c,transition:a}=br({id:e.id}),u={transform:Ie.Transform.toString(c),transition:a};return i.jsxs(l.VStack,{ref:s,style:u,align:"stretch",border:"1px solid",borderColor:"gray.200",rounded:"md",p:3,mb:3,bg:"white",children:[i.jsxs(l.HStack,{...r,...o,cursor:"grab",userSelect:"none",gap:2,children:[i.jsx(Tr,{size:16}),i.jsx(l.Text,{fontWeight:"bold",fontSize:"sm",children:e.label||e.id})]}),i.jsxs(l.HStack,{justify:"space-between",children:[i.jsx(l.Text,{fontSize:"sm",children:"Visible"}),i.jsxs(Ja,{checked:e.visible,size:"sm",onCheckedChange:d=>t?.(e.id,!!d.checked),children:[i.jsx(Za,{}),i.jsx(Qa,{})]})]}),i.jsxs(l.VStack,{align:"stretch",gap:1,children:[i.jsx(l.Text,{fontSize:"sm",children:"Size"}),i.jsx(ec,{min:1,max:5,step:.5,value:[e.size??1],onValueChange:d=>n?.(e.id,d.value[0]),children:i.jsxs(oc,{children:[i.jsx(tc,{children:i.jsx(nc,{})}),i.jsx(rc,{})]})})]})]})},ic=S(l.Drawer.Root),ac=S(l.Drawer.Trigger),cc=S(l.Drawer.Backdrop),lc=S(l.Drawer.Positioner),uc=S(l.Drawer.Content),dc=S(l.Drawer.Header),fc=S(l.Drawer.Title),hc=S(l.Drawer.Body),gc=S(l.Drawer.Footer),pc=S(l.Drawer.CloseTrigger),vc=S(l.Tabs.Root),mc=S(l.Tabs.List),Bt=S(l.Tabs.Trigger),Vt=S(l.Tabs.Content),Lr=(e,t)=>{if(e.customComponent)return e.customComponent;switch(e.type){case"text":return i.jsx(Kt,{placeholder:e.label,value:e.value,onChange:e.onChange,label:e.label,visible:t});case"number":return i.jsx(Kt,{label:e.label,value:e.value,onChange:e.onChange});case"checkbox":return i.jsx(Or,{label:e.label,value:e.value,onChange:e.onChange});case"select":return i.jsx(kr,{label:e.label,value:e.value,onChange:e.onChange,options:e.options??[],visible:t,placeholder:e.placeholder});case"date":return i.jsx(Ta,{value:e.value,onChange:e.onChange});case"combobox":return i.jsx(_r,{visible:!0,label:e.label,items:e.options,itemToString:n=>n.label,itemToValue:n=>n.value,renderItem:n=>i.jsx("span",{children:n.label})});default:return null}},bc=({filterDrawerSize:e="sm",onVisibilityChange:t,onSizeChange:n,onClear:r,filters:o,pageKey:s="default",onLoadPreset:c,activePresetName:a,onReorder:u,open:d,onOpenChange:g})=>{const x=nt(Ze)[s]??rt(s),p=()=>{const b=prompt("Preset name?");if(!b)return;const v=o.reduce((y,w)=>(y[w.id]=w.value,y),{});Ir(s,{id:crypto.randomUUID(),name:b,date:new Date().toISOString(),values:v})};return i.jsx(l.HStack,{wrap:"wrap",children:i.jsxs(ic,{size:e,open:d,onOpenChange:g,children:[i.jsx(ac,{asChild:!0,children:i.jsxs(l.IconButton,{"aria-label":"Open filters",variant:"outline",size:"xs",ml:2,p:2,children:[i.jsx(Di,{size:16}),"Filters"]})}),i.jsxs(l.Portal,{children:[i.jsx(cc,{}),i.jsx(lc,{children:i.jsxs(uc,{children:[i.jsx(dc,{children:i.jsx(fc,{children:"Filters"})}),i.jsx(hc,{overflowY:"auto",pt:1,children:i.jsxs(vc,{defaultValue:"view",children:[i.jsxs(mc,{mb:4,children:[i.jsxs(Bt,{value:"view",children:[i.jsx(Ei,{size:16}),"Edit"]}),i.jsxs(Bt,{value:"settings",children:[i.jsx(_i,{size:16}),"Settings"]}),i.jsxs(Bt,{value:"presets",children:[i.jsx(di,{size:16}),"Presets"]})]}),i.jsx(Vt,{value:"view",children:o.filter(b=>b.visible).map(b=>i.jsx(l.VStack,{align:"stretch",border:"1px solid",borderColor:"gray.200",flex:b.size??1,minW:`${(b.size??1)*100}px`,rounded:"md",p:3,mb:3,children:Lr(b,d)},b.id))}),i.jsx(Vt,{value:"settings",children:i.jsx(fr,{sensors:go(ho(cn)),collisionDetection:Zn,onDragEnd:({active:b,over:v})=>{if(!v||b.id===v.id)return;const y=o.findIndex(T=>T.id===b.id),w=o.findIndex(T=>T.id===v.id),E=Et(o,y,w);u?.(E)},children:i.jsx(vr,{items:o.map(b=>b.id),strategy:Ms,children:o.map(b=>i.jsx(sc,{filter:b,onVisibilityChange:t,onSizeChange:n},b.id))})})}),i.jsx(Vt,{value:"presets",children:i.jsxs(l.VStack,{align:"stretch",mb:3,children:[x.length===0&&i.jsx(l.Text,{fontSize:"xs",color:"gray.500",children:"No presets saved yet."}),x.map(b=>i.jsxs(l.HStack,{justify:"space-between",border:"1px solid",borderColor:a===b.name?"blue.300":"gray.200",rounded:"md",p:2,children:[i.jsxs(l.VStack,{align:"start",gap:0,children:[i.jsx(l.Text,{fontWeight:"bold",fontSize:"sm",children:b.name}),i.jsx(l.Text,{fontSize:"xs",color:"gray.500",children:new Date(b.date).toLocaleDateString()})]}),i.jsxs(l.HStack,{children:[i.jsx(l.Button,{size:"xs",variant:"ghost",onClick:()=>{const v=o.map(y=>({...y,value:b.values[y.id]??y.value}));c?.(v,b.name)},children:"Load"}),i.jsx(l.IconButton,{size:"xs","aria-label":"Delete preset",variant:"ghost",onClick:()=>Ar(s,b.id),children:i.jsx(yi,{size:14})})]})]},b.id)),i.jsx(l.Button,{size:"sm",colorScheme:"blue",onClick:p,children:"Save Current Filters"})]})})]})}),i.jsx(gc,{justify:"space-between",children:i.jsx(pc,{asChild:!0,children:i.jsx(l.CloseButton,{})})})]})})]})]})})},xc=({title:e,filters:t,onVisibilityChange:n,onReorder:r,onSizeChange:o,onClear:s,maxToolbarUnits:c,pageKey:a,onLoadPreset:u,activePresetName:d,filterDrawerSize:g="sm"})=>{const[h,x]=f.useState(!1);return i.jsxs(l.HStack,{wrap:"wrap",pl:2,pr:2,width:"100%",justify:"space-between",children:[e,i.jsxs(l.HStack,{gapX:1,children:[t.filter(p=>p.visible!==!1).map(p=>i.jsx(l.HStack,{flex:p.size??1,minW:`${(p.size??1)*100}px`,alignItems:"center",children:Lr(p)},p.id)),i.jsx(bc,{filterDrawerSize:g,onVisibilityChange:n,onReorder:r,onSizeChange:o,onClear:s,maxToolbarUnits:c,pageKey:a,filters:t,onLoadPreset:u,activePresetName:d,open:h,onOpenChange:p=>{x(p.open)}})]})]})},yc=(e,t)=>{localStorage.setItem(`FILTER_ORDER_${e}`,JSON.stringify(t))},Sc=e=>{try{return JSON.parse(localStorage.getItem(`FILTER_ORDER_${e}`)||"[]")}catch{return[]}},wc=({onClick:e,size:t="xs",variant:n="solid",label:r,leftIcon:o,rightIcon:s,isDisabled:c,colorScheme:a,loading:u,loadingText:d,rounded:g,type:h="button"})=>i.jsx(l.Button,{onClick:e,size:t,variant:n,disabled:c,colorPalette:a,loading:u,loadingText:d,rounded:g,type:h,children:i.jsxs(l.HStack,{gap:1,children:[o,r,s]})}),Cc=S(l.Dialog.Root),Dc=S(l.Dialog.Backdrop),jc=S(l.Dialog.Positioner),Rc=S(l.Dialog.Content),Ec=S(l.Dialog.Header),Tc=S(l.Dialog.Body),Mc=S(l.Dialog.Footer),Oc=S(l.Dialog.Title),_c=S(l.Dialog.CloseTrigger);function kc({open:e,onClose:t,onConfirm:n,title:r="Confirm Action",description:o="Are you sure you want to continue?",confirmLabel:s="Confirm",cancelLabel:c="Cancel",icon:a,isLoading:u=!1,confirmButtonColorScheme:d="#4169e1"}){return i.jsx(Cc,{open:e,placement:"center",onOpenChange:g=>!g.open&&t(),children:i.jsxs(l.Portal,{children:[i.jsx(Dc,{}),i.jsx(jc,{children:i.jsxs(Rc,{maxW:"480px",children:[i.jsx(Ec,{borderBottom:"1px solid",borderColor:"gray.200",children:i.jsx(Oc,{children:r})}),i.jsx(Tc,{p:6,children:i.jsxs(l.Stack,{gap:4,align:"center",textAlign:"center",children:[i.jsx(l.Box,{color:"orange.500",children:a??i.jsx(Mr,{size:40})}),i.jsx(l.Text,{fontSize:"sm",color:"gray.600",children:o})]})}),i.jsxs(Mc,{justifyContent:"flex-end",gap:2,borderTop:"1px solid",borderColor:"gray.200",children:[i.jsx(l.Button,{variant:"outline",size:"sm",onClick:t,children:c}),i.jsx(l.Button,{size:"sm",style:{backgroundColor:d},loading:u,onClick:n,children:s})]}),i.jsx(_c,{asChild:!0,children:i.jsx(l.CloseButton,{size:"sm"})})]})})]})})}const $c=S(l.Dialog.Root),Ic=S(l.Dialog.Backdrop),Ac=S(l.Dialog.Positioner),Lc=S(l.Dialog.Content),Nc=S(l.Dialog.Header),Pc=S(l.Dialog.Body),zc=S(l.Dialog.Footer),Yc=S(l.Dialog.Title),Fc=S(l.Dialog.CloseTrigger);function Bc({open:e,onClose:t,onConfirm:n,title:r="Delete Company",entityName:o,confirmText:s="DELETE",confirmLabel:c="Delete",isLoading:a=!1}){const[u,d]=f.useState(""),g=u===s;return i.jsx($c,{open:e,placement:"center",onOpenChange:h=>{!h.open&&t(),d("")},children:i.jsxs(l.Portal,{children:[i.jsx(Ic,{}),i.jsx(Ac,{children:i.jsxs(Lc,{maxW:"550px",children:[i.jsx(Nc,{borderBottom:"1px solid",borderColor:"#d3d3d3",children:i.jsx(Yc,{color:"red.600",children:r})}),i.jsx(Pc,{p:2,style:{padding:"16px"},children:i.jsxs(l.Stack,{gap:4,borderRadius:"md",p:4,bg:"white",children:[i.jsx(l.Box,{border:"1px solid",borderColor:"red.200",bg:"red.50",borderRadius:"md",p:4,children:i.jsxs(l.Stack,{direction:"row",gap:3,align:"flex-start",children:[i.jsx(l.Box,{color:"red.600",mt:"2px",children:i.jsx(Mr,{size:20})}),i.jsxs(l.Box,{children:[i.jsx(l.Text,{fontWeight:"semibold",color:"red.700",children:"Are you sure?"}),i.jsxs(l.Text,{fontSize:"sm",color:"red.600",children:["All the data of ",i.jsx("b",{children:o})," will permanently be deleted."]})]})]})}),i.jsx(l.Text,{fontSize:"sm",color:"gray.600",children:"You can’t undo this action afterwards."}),i.jsxs(l.Box,{children:[i.jsxs(l.Text,{fontSize:"sm",mb:2,children:["Type ",i.jsx("b",{children:s})," to continue"]}),i.jsx(l.Input,{placeholder:`Type ${s} here`,value:u,onChange:h=>d(h.target.value),size:"xs"})]})]})}),i.jsxs(zc,{justifyContent:"flex-end",gap:2,borderTop:"1px solid",borderColor:"#d3d3d3",children:[i.jsx(l.Button,{variant:"outline",size:"sm",onClick:()=>{t(),d("")},children:"Cancel"}),i.jsx(l.Button,{size:"sm",disabled:!g,style:{backgroundColor:"#FF0000"},loading:a,onClick:n,children:c})]}),i.jsx(Fc,{asChild:!0,children:i.jsx(l.CloseButton,{size:"sm"})})]})})]})})}const Vc=({children:e})=>i.jsx(i.Fragment,{children:e}),Hc=({children:e})=>i.jsx(i.Fragment,{children:e}),Wc=S(l.Dialog.Title),Uc=S(l.Dialog.Content);function Gc(e){let t=null,n=null;return f.Children.forEach(e,r=>{f.isValidElement(r)&&(r.type===Vc&&(t=r.props.children),r.type===Hc&&(n=r.props.children))}),{body:t,actions:n}}const qc=({open:e,onClose:t,title:n,children:r,size:o="md"})=>{const{body:s,actions:c}=Gc(r);return i.jsxs(l.Dialog.Root,{open:e,onOpenChange:()=>t(),children:[i.jsx(l.DialogBackdrop,{}),i.jsxs(Uc,{maxW:o,borderRadius:"12px",p:"0",children:[i.jsx(l.DialogHeader,{px:"20px",py:"16px",borderBottom:"1px solid",borderColor:"gray.200",children:i.jsxs(l.Flex,{justify:"space-between",align:"center",children:[i.jsx(Wc,{fontSize:"16px",fontWeight:"600",children:n}),i.jsx(l.DialogCloseTrigger,{})]})}),s&&i.jsx(l.DialogBody,{px:"20px",py:"16px",children:s}),c&&i.jsx(l.DialogFooter,{px:"20px",py:"16px",borderTop:"1px solid",borderColor:"gray.200",children:i.jsx(l.Flex,{ml:"auto",gap:"12px",children:c})})]})]})};function Nr({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(l.IconButton,{"aria-label":n,size:"xs",variant:"outline",disabled:t||r,onClick:s,ml:2,children:i.jsx(Mi,{size:14,style:{animation:r?"spin 0.6s linear infinite":void 0}})})}var gt={exports:{}},Xc=gt.exports,Wn;function Kc(){return Wn||(Wn=1,(function(e,t){(function(n,r){e.exports=r()})(Xc,(function(){var n=1e3,r=6e4,o=36e5,s="millisecond",c="second",a="minute",u="hour",d="day",g="week",h="month",x="quarter",p="year",b="date",v="Invalid Date",y=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,w=/\[([^\]]+)]|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,E={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 j=["th","st","nd","rd"],C=$%100;return"["+$+(j[(C-20)%10]||j[C]||j[0])+"]"}},T=function($,j,C){var O=String($);return!O||O.length>=j?$:""+Array(j+1-O.length).join(C)+$},I={s:T,z:function($){var j=-$.utcOffset(),C=Math.abs(j),O=Math.floor(C/60),_=C%60;return(j<=0?"+":"-")+T(O,2,"0")+":"+T(_,2,"0")},m:function $(j,C){if(j.date()<C.date())return-$(C,j);var O=12*(C.year()-j.year())+(C.month()-j.month()),_=j.clone().add(O,h),N=C-_<0,z=j.clone().add(O+(N?-1:1),h);return+(-(O+(C-_)/(N?_-z:z-_))||0)},a:function($){return $<0?Math.ceil($)||0:Math.floor($)},p:function($){return{M:h,y:p,w:g,d,D:b,h:u,m:a,s:c,ms:s,Q:x}[$]||String($||"").toLowerCase().replace(/s$/,"")},u:function($){return $===void 0}},k="en",M={};M[k]=E;var A="$isDayjsObject",L=function($){return $ instanceof U||!(!$||!$[A])},V=function $(j,C,O){var _;if(!j)return k;if(typeof j=="string"){var N=j.toLowerCase();M[N]&&(_=N),C&&(M[N]=C,_=N);var z=j.split("-");if(!_&&z.length>1)return $(z[0])}else{var m=j.name;M[m]=j,_=m}return!O&&_&&(k=_),_||!O&&k},F=function($,j){if(L($))return $.clone();var C=typeof j=="object"?j:{};return C.date=$,C.args=arguments,new U(C)},D=I;D.l=V,D.i=L,D.w=function($,j){return F($,{locale:j.$L,utc:j.$u,x:j.$x,$offset:j.$offset})};var U=(function(){function $(C){this.$L=V(C.locale,null,!0),this.parse(C),this.$x=this.$x||C.x||{},this[A]=!0}var j=$.prototype;return j.parse=function(C){this.$d=(function(O){var _=O.date,N=O.utc;if(_===null)return new Date(NaN);if(D.u(_))return new Date;if(_ instanceof Date)return new Date(_);if(typeof _=="string"&&!/Z$/i.test(_)){var z=_.match(y);if(z){var m=z[2]-1||0,R=(z[7]||"0").substring(0,3);return N?new Date(Date.UTC(z[1],m,z[3]||1,z[4]||0,z[5]||0,z[6]||0,R)):new Date(z[1],m,z[3]||1,z[4]||0,z[5]||0,z[6]||0,R)}}return new Date(_)})(C),this.init()},j.init=function(){var C=this.$d;this.$y=C.getFullYear(),this.$M=C.getMonth(),this.$D=C.getDate(),this.$W=C.getDay(),this.$H=C.getHours(),this.$m=C.getMinutes(),this.$s=C.getSeconds(),this.$ms=C.getMilliseconds()},j.$utils=function(){return D},j.isValid=function(){return this.$d.toString()!==v},j.isSame=function(C,O){var _=F(C);return this.startOf(O)<=_&&_<=this.endOf(O)},j.isAfter=function(C,O){return F(C)<this.startOf(O)},j.isBefore=function(C,O){return this.endOf(O)<F(C)},j.$g=function(C,O,_){return D.u(C)?this[O]:this.set(_,C)},j.unix=function(){return Math.floor(this.valueOf()/1e3)},j.valueOf=function(){return this.$d.getTime()},j.startOf=function(C,O){var _=this,N=!!D.u(O)||O,z=D.p(C),m=function(J,Y){var se=D.w(_.$u?Date.UTC(_.$y,Y,J):new Date(_.$y,Y,J),_);return N?se:se.endOf(d)},R=function(J,Y){return D.w(_.toDate()[J].apply(_.toDate("s"),(N?[0,0,0,0]:[23,59,59,999]).slice(Y)),_)},P=this.$W,B=this.$M,q=this.$D,X="set"+(this.$u?"UTC":"");switch(z){case p:return N?m(1,0):m(31,11);case h:return N?m(1,B):m(0,B+1);case g:var H=this.$locale().weekStart||0,K=(P<H?P+7:P)-H;return m(N?q-K:q+(6-K),B);case d:case b:return R(X+"Hours",0);case u:return R(X+"Minutes",1);case a:return R(X+"Seconds",2);case c:return R(X+"Milliseconds",3);default:return this.clone()}},j.endOf=function(C){return this.startOf(C,!1)},j.$set=function(C,O){var _,N=D.p(C),z="set"+(this.$u?"UTC":""),m=(_={},_[d]=z+"Date",_[b]=z+"Date",_[h]=z+"Month",_[p]=z+"FullYear",_[u]=z+"Hours",_[a]=z+"Minutes",_[c]=z+"Seconds",_[s]=z+"Milliseconds",_)[N],R=N===d?this.$D+(O-this.$W):O;if(N===h||N===p){var P=this.clone().set(b,1);P.$d[m](R),P.init(),this.$d=P.set(b,Math.min(this.$D,P.daysInMonth())).$d}else m&&this.$d[m](R);return this.init(),this},j.set=function(C,O){return this.clone().$set(C,O)},j.get=function(C){return this[D.p(C)]()},j.add=function(C,O){var _,N=this;C=Number(C);var z=D.p(O),m=function(B){var q=F(N);return D.w(q.date(q.date()+Math.round(B*C)),N)};if(z===h)return this.set(h,this.$M+C);if(z===p)return this.set(p,this.$y+C);if(z===d)return m(1);if(z===g)return m(7);var R=(_={},_[a]=r,_[u]=o,_[c]=n,_)[z]||1,P=this.$d.getTime()+C*R;return D.w(P,this)},j.subtract=function(C,O){return this.add(-1*C,O)},j.format=function(C){var O=this,_=this.$locale();if(!this.isValid())return _.invalidDate||v;var N=C||"YYYY-MM-DDTHH:mm:ssZ",z=D.z(this),m=this.$H,R=this.$m,P=this.$M,B=_.weekdays,q=_.months,X=_.meridiem,H=function(Y,se,ne,he){return Y&&(Y[se]||Y(O,N))||ne[se].slice(0,he)},K=function(Y){return D.s(m%12||12,Y,"0")},J=X||function(Y,se,ne){var he=Y<12?"AM":"PM";return ne?he.toLowerCase():he};return N.replace(w,(function(Y,se){return se||(function(ne){switch(ne){case"YY":return String(O.$y).slice(-2);case"YYYY":return D.s(O.$y,4,"0");case"M":return P+1;case"MM":return D.s(P+1,2,"0");case"MMM":return H(_.monthsShort,P,q,3);case"MMMM":return H(q,P);case"D":return O.$D;case"DD":return D.s(O.$D,2,"0");case"d":return String(O.$W);case"dd":return H(_.weekdaysMin,O.$W,B,2);case"ddd":return H(_.weekdaysShort,O.$W,B,3);case"dddd":return B[O.$W];case"H":return String(m);case"HH":return D.s(m,2,"0");case"h":return K(1);case"hh":return K(2);case"a":return J(m,R,!0);case"A":return J(m,R,!1);case"m":return String(R);case"mm":return D.s(R,2,"0");case"s":return String(O.$s);case"ss":return D.s(O.$s,2,"0");case"SSS":return D.s(O.$ms,3,"0");case"Z":return z}return null})(Y)||z.replace(":","")}))},j.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},j.diff=function(C,O,_){var N,z=this,m=D.p(O),R=F(C),P=(R.utcOffset()-this.utcOffset())*r,B=this-R,q=function(){return D.m(z,R)};switch(m){case p:N=q()/12;break;case h:N=q();break;case x:N=q()/3;break;case g:N=(B-P)/6048e5;break;case d:N=(B-P)/864e5;break;case u:N=B/o;break;case a:N=B/r;break;case c:N=B/n;break;default:N=B}return _?N:D.a(N)},j.daysInMonth=function(){return this.endOf(h).$D},j.$locale=function(){return M[this.$L]},j.locale=function(C,O){if(!C)return this.$L;var _=this.clone(),N=V(C,O,!0);return N&&(_.$L=N),_},j.clone=function(){return D.w(this.$d,this)},j.toDate=function(){return new Date(this.valueOf())},j.toJSON=function(){return this.isValid()?this.toISOString():null},j.toISOString=function(){return this.$d.toISOString()},j.toString=function(){return this.$d.toUTCString()},$})(),G=U.prototype;return F.prototype=G,[["$ms",s],["$s",c],["$m",a],["$H",u],["$W",d],["$M",h],["$y",p],["$D",b]].forEach((function($){G[$[1]]=function(j){return this.$g(j,$[0],$[1])}})),F.extend=function($,j){return $.$i||($(j,U,F),$.$i=!0),F},F.locale=V,F.isDayjs=L,F.unix=function($){return F(1e3*$)},F.en=M[k],F.Ls=M,F.p={},F}))})(gt)),gt.exports}var Jc=Kc();const Mt=Ct(Jc);var pt={exports:{}},Zc=pt.exports,Un;function Qc(){return Un||(Un=1,(function(e,t){(function(n,r){e.exports=r()})(Zc,(function(){return function(n,r,o){n=n||{};var s=r.prototype,c={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 a(d,g,h,x){return s.fromToBase(d,g,h,x)}o.en.relativeTime=c,s.fromToBase=function(d,g,h,x,p){for(var b,v,y,w=h.$locale().relativeTime||c,E=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"}],T=E.length,I=0;I<T;I+=1){var k=E[I];k.d&&(b=x?o(d).diff(h,k.d,!0):h.diff(d,k.d,!0));var M=(n.rounding||Math.round)(Math.abs(b));if(y=b>0,M<=k.r||!k.r){M<=1&&I>0&&(k=E[I-1]);var A=w[k.l];p&&(M=p(""+M)),v=typeof A=="string"?A.replace("%d",M):A(M,g,k.l,y);break}}if(g)return v;var L=y?w.future:w.past;return typeof L=="function"?L(v):L.replace("%s",v)},s.to=function(d,g){return a(d,g,this,!0)},s.from=function(d,g){return a(d,g,this)};var u=function(d){return d.$u?o.utc():o()};s.toNow=function(d){return this.to(u(this),d)},s.fromNow=function(d){return this.from(u(this),d)}}}))})(pt)),pt.exports}var el=Qc();const tl=Ct(el);var vt={exports:{}},nl=vt.exports,Gn;function rl(){return Gn||(Gn=1,(function(e,t){(function(n,r){e.exports=r()})(nl,(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 c=o.prototype,a=c.format;s.en.formats=n,c.format=function(u){u===void 0&&(u="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(p,b,v){var y=v&&v.toUpperCase();return b||x[v]||n[v]||x[y].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,(function(w,E,T){return E||T.slice(1)}))}))})(u,d===void 0?{}:d);return a.call(this,g)}}}))})(vt)),vt.exports}var ol=rl();const sl=Ct(ol);var mt={exports:{}},il=mt.exports,qn;function al(){return qn||(qn=1,(function(e,t){(function(n,r){e.exports=r()})(il,(function(){return function(n,r){var o=r.prototype,s=o.format;o.format=function(c){var a=this,u=this.$locale();if(!this.isValid())return s.bind(this)(c);var d=this.$utils(),g=(c||"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((a.$M+1)/3);case"Do":return u.ordinal(a.$D);case"gggg":return a.weekYear();case"GGGG":return a.isoWeekYear();case"wo":return u.ordinal(a.week(),"W");case"w":case"ww":return d.s(a.week(),h==="w"?1:2,"0");case"W":case"WW":return d.s(a.isoWeek(),h==="W"?1:2,"0");case"k":case"kk":return d.s(String(a.$H===0?24:a.$H),h==="k"?1:2,"0");case"X":return Math.floor(a.$d.getTime()/1e3);case"x":return a.$d.getTime();case"z":return"["+a.offsetName()+"]";case"zzz":return"["+a.offsetName("long")+"]";default:return h}}));return s.bind(this)(g)}}}))})(mt)),mt.exports}var cl=al();const ll=Ct(cl);Mt.extend(tl);Mt.extend(sl);Mt.extend(ll);const ul={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 Jt({value:e,variant:t="dateTime",format:n,fallback:r="--"}){if(!e)return r;const o=Mt(e);return o.isValid()?t==="relative"?o.fromNow():o.format(n??ul[t]):r}function dl({value:e,dateVariant:t="date",timeVariant:n="time",dateFormat:r,timeFormat:o,align:s="start",dateColor:c="gray.700",dateFontSize:a="16px",dateFontWeight:u="500",timeColor:d="gray.500",timeFontSize:g="12px",timeFontWeight:h="400"}){return i.jsxs(l.Stack,{gap:.5,align:s,children:[i.jsx(l.Text,{fontSize:a,fontWeight:u,color:c,children:Jt({value:e,variant:t,format:r})}),i.jsx(l.Text,{fontSize:g,fontWeight:h,color:d,children:Jt({value:e,variant:n,format:o})})]})}class Pr{state=new Map;listeners=new Map;get(t){return this.state.get(t)}set(t){this.state.set(t.key,t),this.notify(t.key)}setMany(t){t.forEach(n=>this.set(n))}subscribe(t,n){return this.listeners.has(t)||this.listeners.set(t,new Set),this.listeners.get(t).add(n),n(this.state.get(t)),()=>{this.listeners.get(t)?.delete(n)}}notify(t){this.listeners.get(t)?.forEach(n=>n(this.state.get(t)))}clear(){this.state.clear()}}class Zt{constructor(t){this.baseUrl=t}async fetchLatest(t){const n=new URLSearchParams;return n.set("keys",t.join(",")),(await(await fetch(`${this.baseUrl}/options?${n}`)).json()).data}}class Qt{constructor(t){this.api=t}store=new Pr;inflight=new Map;getRaw(t){return this.store.get(t)}async getKey(t){const n=this.store.get(t);return n?n.value:(await this.fetchMissing([t]),this.store.get(t)?.value)}async getMultiKey(t){const n={},r=[];for(const o of t){const s=this.store.get(o);s?n[o]=s.value:r.push(o)}return r.length&&(await this.fetchMissing(r),r.forEach(o=>{const s=this.store.get(o);s&&(n[o]=s.value)})),n}subscribe(t,n){return this.store.subscribe(t,n)}hydrate(t){this.store.setMany(t)}clear(){this.store.clear()}async fetchMissing(t){const n=t.filter(o=>!this.inflight.has(o));if(!n.length)return;const r=this.api.fetchLatest(n).then(o=>{this.store.setMany(o),n.forEach(s=>this.inflight.delete(s))});n.forEach(o=>this.inflight.set(o,r)),await r}}const zr=f.createContext(null);function Yr(){const e=f.useContext(zr);if(!e)throw new Error("OptionsProvider is missing. Wrap your app with <OptionsProvider />");return e}function fl({client:{apiUrl:e},children:t}){const n=f.useRef(new Qt(new Zt(e)));return n.current||(n.current=new Qt(new Zt(e))),i.jsx(zr.Provider,{value:n.current,children:t})}function hl(e){const t=Yr(),[n,r]=f.useState(t.getRaw(e)?.value);return f.useEffect(()=>{let o=!0;t.getKey(e).then(c=>{o&&r(c)});const s=t.subscribe(e,c=>{r(c?.value)});return()=>{o=!1,s()}},[e,t]),n}function gl(e){const t=Yr(),[n,r]=f.useState({});return f.useEffect(()=>{let o=!0;t.getMultiKey(e).then(c=>{o&&r(c)});const s=e.map(c=>t.subscribe(c,a=>{r(u=>({...u,[c]:a?.value}))}));return()=>{o=!1,s.forEach(c=>c())}},[e.join("|"),t]),n}async function pl(e,t){return e.getKey(t)}async function vl(e,t){await e.getMultiKey(t)}function ml(e={}){const{initialPage:t=1,initialLimit:n=20}=e,[r,o]=f.useState(t),[s,c]=f.useState(n),a=f.useCallback(x=>{o(Math.max(1,x))},[]),u=f.useCallback(x=>{c(Math.max(1,x)),o(1)},[]),d=f.useCallback(()=>{o(x=>x+1)},[]),g=f.useCallback(()=>{o(x=>Math.max(1,x-1))},[]),h=f.useCallback(()=>{o(t),c(n)},[t,n]);return{page:r,limit:s,setPage:a,setLimit:u,nextPage:d,prevPage:g,reset:h}}function bl(e={}){const{initialValue:t="",delay:n=300}=e,[r,o]=f.useState(t),s=xl(r,n),c=f.useCallback(u=>{o(u)},[]),a=f.useCallback(()=>{o(t)},[t]);return{search:r,debouncedSearch:s,onSearchChange:c,reset:a}}function xl(e,t=300){const[n,r]=f.useState(e);return f.useEffect(()=>{const o=setTimeout(()=>{r(e)},t);return()=>clearTimeout(o)},[e,t]),n}exports.DataTable=ca;exports.Filters=xc;exports.HttpOptionsApi=Zt;exports.MDSButton=wc;exports.MDSCheckbox=Or;exports.MDSCombobox=_r;exports.MDSConfirmActionDialog=kc;exports.MDSConfirmDeleteDialog=Bc;exports.MDSDialogWrapper=qc;exports.MDSInput=Kt;exports.MDSRefreshButton=Nr;exports.MDSSelectBox=kr;exports.OptionsClientImpl=Qt;exports.OptionsProvider=fl;exports.OptionsStore=Pr;exports.RefreshButton=Nr;exports.StackedDateTime=dl;exports.addPreset=Ir;exports.deletePreset=Ar;exports.formatDateTime=Jt;exports.getOption=pl;exports.getPresets=rt;exports.loadOrder=Sc;exports.prefetchOptions=vl;exports.presetStore=Ze;exports.saveOrder=yc;exports.savePresets=Tt;exports.setActionsConfig=Dr;exports.setData=wr;exports.setTableId=Cr;exports.tableStore=ie;exports.updatePreset=Ka;exports.useDebouncedSearch=bl;exports.useOption=hl;exports.useOptions=gl;exports.usePagination=ml;exports.withChildren=S;
package/dist/index.d.ts CHANGED
@@ -262,14 +262,13 @@ export declare function MDSConfirmActionDialog({ open, onClose, onConfirm, title
262
262
 
263
263
  export declare function MDSConfirmDeleteDialog({ open, onClose, onConfirm, title, entityName, confirmText, confirmLabel, isLoading, }: ConfirmDeleteDialogProps): JSX_2.Element;
264
264
 
265
- export declare const MDSDialogWrapper: ({ open, onClose, title, children, buttonChildren, size, }: MDSDialogWrapperProps) => JSX_2.Element;
265
+ export declare const MDSDialogWrapper: ({ open, onClose, title, children, size, }: MDSDialogWrapperProps) => JSX_2.Element;
266
266
 
267
267
  export declare interface MDSDialogWrapperProps {
268
268
  open: boolean;
269
269
  onClose: () => void;
270
270
  title: string;
271
271
  children: ReactNode;
272
- buttonChildren?: ReactNode;
273
272
  size?: 'sm' | 'md' | 'lg' | 'xl';
274
273
  }
275
274
 
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
- import ie, { useLayoutEffect as So, useEffect as F, useRef as X, useMemo as G, useCallback as Q, useState as K, createContext as tt, memo as Do, useReducer as Co, useContext as We, forwardRef as Dn, createElement as vn } from "react";
2
- import { Menu as $e, Checkbox as Re, IconButton as Oe, Portal as Ue, Table as le, HStack as he, Select as ee, Pagination as zt, createListCollection as _r, Box as Ce, Text as q, ButtonGroup as jo, Skeleton as Ro, Spinner as Or, Combobox as Te, useListCollection as Eo, Span as _o, Popover as Ut, InputGroup as Tr, InputElement as Wn, PopoverArrow as Oo, VStack as Le, Kbd as Bn, Input as Cn, Field as Ge, Slider as xt, Drawer as Ie, Tabs as Gt, Button as Be, CloseButton as jn, Dialog as re, Stack as Pt, DialogBackdrop as To, DialogHeader as Mo, Flex as Un, DialogCloseTrigger as $o, DialogBody as Io, DialogFooter as Ao } from "@chakra-ui/react";
1
+ import re, { useLayoutEffect as So, useEffect as F, useRef as X, useMemo as G, useCallback as Q, useState as K, createContext as tt, memo as Do, useReducer as Co, useContext as We, forwardRef as Dn, createElement as vn } from "react";
2
+ import { Menu as $e, Checkbox as Re, IconButton as Oe, Portal as Ue, Table as le, HStack as he, Select as ee, Pagination as zt, createListCollection as _r, Box as Ce, Text as q, ButtonGroup as jo, Skeleton as Ro, Spinner as Or, Combobox as Te, useListCollection as Eo, Span as _o, Popover as Ut, InputGroup as Tr, InputElement as Wn, PopoverArrow as Oo, VStack as Le, Kbd as Bn, Input as Cn, Field as Ge, Slider as xt, Drawer as Ie, Tabs as Gt, Button as Be, CloseButton as jn, Dialog as oe, Stack as Pt, DialogBackdrop as To, DialogHeader as Mo, Flex as Un, DialogCloseTrigger as $o, DialogBody as Io, DialogFooter as Ao } from "@chakra-ui/react";
3
3
  import { unstable_batchedUpdates as jt, createPortal as ko } from "react-dom";
4
4
  function Xt(e) {
5
5
  return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
@@ -224,7 +224,7 @@ React keys must be passed directly to JSX without using spread:
224
224
  function m(p) {
225
225
  return typeof p == "object" && p !== null && p.$$typeof === v;
226
226
  }
227
- var h = ie, v = /* @__PURE__ */ Symbol.for("react.transitional.element"), g = /* @__PURE__ */ Symbol.for("react.portal"), x = /* @__PURE__ */ Symbol.for("react.fragment"), y = /* @__PURE__ */ Symbol.for("react.strict_mode"), j = /* @__PURE__ */ Symbol.for("react.profiler"), R = /* @__PURE__ */ Symbol.for("react.consumer"), $ = /* @__PURE__ */ Symbol.for("react.context"), T = /* @__PURE__ */ Symbol.for("react.forward_ref"), E = /* @__PURE__ */ Symbol.for("react.suspense"), I = /* @__PURE__ */ Symbol.for("react.suspense_list"), A = /* @__PURE__ */ Symbol.for("react.memo"), V = /* @__PURE__ */ Symbol.for("react.lazy"), P = /* @__PURE__ */ Symbol.for("react.activity"), S = /* @__PURE__ */ Symbol.for("react.client.reference"), B = h.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, U = Object.prototype.hasOwnProperty, M = Array.isArray, D = console.createTask ? console.createTask : function() {
227
+ var h = re, v = /* @__PURE__ */ Symbol.for("react.transitional.element"), g = /* @__PURE__ */ Symbol.for("react.portal"), x = /* @__PURE__ */ Symbol.for("react.fragment"), y = /* @__PURE__ */ Symbol.for("react.strict_mode"), j = /* @__PURE__ */ Symbol.for("react.profiler"), R = /* @__PURE__ */ Symbol.for("react.consumer"), $ = /* @__PURE__ */ Symbol.for("react.context"), T = /* @__PURE__ */ Symbol.for("react.forward_ref"), E = /* @__PURE__ */ Symbol.for("react.suspense"), I = /* @__PURE__ */ Symbol.for("react.suspense_list"), A = /* @__PURE__ */ Symbol.for("react.memo"), V = /* @__PURE__ */ Symbol.for("react.lazy"), P = /* @__PURE__ */ Symbol.for("react.activity"), S = /* @__PURE__ */ Symbol.for("react.client.reference"), B = h.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, U = Object.prototype.hasOwnProperty, M = Array.isArray, D = console.createTask ? console.createTask : function() {
228
228
  return null;
229
229
  };
230
230
  h = {
@@ -479,7 +479,7 @@ function Bo(e) {
479
479
  id: t,
480
480
  value: n
481
481
  } = e;
482
- return ie.createElement("div", {
482
+ return re.createElement("div", {
483
483
  id: t,
484
484
  style: Wo
485
485
  }, n);
@@ -504,7 +504,7 @@ function Uo(e) {
504
504
  clipPath: "inset(100%)",
505
505
  whiteSpace: "nowrap"
506
506
  };
507
- return ie.createElement("div", {
507
+ return re.createElement("div", {
508
508
  id: t,
509
509
  style: o,
510
510
  role: "status",
@@ -641,19 +641,19 @@ function Zo(e) {
641
641
  }
642
642
  }), [s, t])), !l)
643
643
  return null;
644
- const f = ie.createElement(ie.Fragment, null, ie.createElement(Bo, {
644
+ const f = re.createElement(re.Fragment, null, re.createElement(Bo, {
645
645
  id: r,
646
646
  value: o.draggable
647
- }), ie.createElement(Uo, {
647
+ }), re.createElement(Uo, {
648
648
  id: a,
649
649
  announcement: c
650
650
  }));
651
651
  return n ? ko(f, n) : f;
652
652
  }
653
- var se;
653
+ var ie;
654
654
  (function(e) {
655
655
  e.DragStart = "dragStart", e.DragMove = "dragMove", e.DragEnd = "dragEnd", e.DragCancel = "dragCancel", e.DragOver = "dragOver", e.RegisterDroppable = "registerDroppable", e.SetDroppableDisabled = "setDroppableDisabled", e.UnregisterDroppable = "unregisterDroppable";
656
- })(se || (se = {}));
656
+ })(ie || (ie = {}));
657
657
  function Vt() {
658
658
  }
659
659
  function Qo(e, t) {
@@ -2071,7 +2071,7 @@ function Js() {
2071
2071
  }
2072
2072
  function Zs(e, t) {
2073
2073
  switch (t.type) {
2074
- case se.DragStart:
2074
+ case ie.DragStart:
2075
2075
  return {
2076
2076
  ...e,
2077
2077
  draggable: {
@@ -2080,7 +2080,7 @@ function Zs(e, t) {
2080
2080
  active: t.active
2081
2081
  }
2082
2082
  };
2083
- case se.DragMove:
2083
+ case ie.DragMove:
2084
2084
  return e.draggable.active == null ? e : {
2085
2085
  ...e,
2086
2086
  draggable: {
@@ -2091,8 +2091,8 @@ function Zs(e, t) {
2091
2091
  }
2092
2092
  }
2093
2093
  };
2094
- case se.DragEnd:
2095
- case se.DragCancel:
2094
+ case ie.DragEnd:
2095
+ case ie.DragCancel:
2096
2096
  return {
2097
2097
  ...e,
2098
2098
  draggable: {
@@ -2108,7 +2108,7 @@ function Zs(e, t) {
2108
2108
  }
2109
2109
  }
2110
2110
  };
2111
- case se.RegisterDroppable: {
2111
+ case ie.RegisterDroppable: {
2112
2112
  const {
2113
2113
  element: n
2114
2114
  } = t, {
@@ -2122,7 +2122,7 @@ function Zs(e, t) {
2122
2122
  }
2123
2123
  };
2124
2124
  }
2125
- case se.SetDroppableDisabled: {
2125
+ case ie.SetDroppableDisabled: {
2126
2126
  const {
2127
2127
  id: n,
2128
2128
  key: r,
@@ -2142,7 +2142,7 @@ function Zs(e, t) {
2142
2142
  }
2143
2143
  };
2144
2144
  }
2145
- case se.UnregisterDroppable: {
2145
+ case ie.UnregisterDroppable: {
2146
2146
  const {
2147
2147
  id: n,
2148
2148
  key: r
@@ -2425,7 +2425,7 @@ const Xr = /* @__PURE__ */ Do(function(t) {
2425
2425
  };
2426
2426
  jt(() => {
2427
2427
  ke?.(it), T(Ve.Initializing), y({
2428
- type: se.DragStart,
2428
+ type: ie.DragStart,
2429
2429
  initialCoordinates: ce,
2430
2430
  active: Ye
2431
2431
  }), j({
@@ -2436,12 +2436,12 @@ const Xr = /* @__PURE__ */ Do(function(t) {
2436
2436
  },
2437
2437
  onMove(ce) {
2438
2438
  y({
2439
- type: se.DragMove,
2439
+ type: ie.DragMove,
2440
2440
  coordinates: ce
2441
2441
  });
2442
2442
  },
2443
- onEnd: Ze(se.DragEnd),
2444
- onCancel: Ze(se.DragCancel)
2443
+ onEnd: Ze(ie.DragEnd),
2444
+ onCancel: Ze(ie.DragCancel)
2445
2445
  });
2446
2446
  nn.current = Ee;
2447
2447
  function Ze(ce) {
@@ -2463,13 +2463,13 @@ const Xr = /* @__PURE__ */ Do(function(t) {
2463
2463
  collisions: ke,
2464
2464
  delta: at,
2465
2465
  over: it
2466
- }, ce === se.DragEnd && typeof ct == "function" && await Promise.resolve(ct(Fe)) && (ce = se.DragCancel);
2466
+ }, ce === ie.DragEnd && typeof ct == "function" && await Promise.resolve(ct(Fe)) && (ce = ie.DragCancel);
2467
2467
  }
2468
2468
  M.current = null, jt(() => {
2469
2469
  y({
2470
2470
  type: ce
2471
2471
  }), T(Ve.Uninitialized), Fn(null), w(null), O(null), nn.current = null;
2472
- const ct = ce === se.DragEnd ? "onDragEnd" : "onDragCancel";
2472
+ const ct = ce === ie.DragEnd ? "onDragEnd" : "onDragCancel";
2473
2473
  if (Fe) {
2474
2474
  const rn = k.current[ct];
2475
2475
  rn?.(Fe), j({
@@ -2627,17 +2627,17 @@ const Xr = /* @__PURE__ */ Do(function(t) {
2627
2627
  over: ze,
2628
2628
  measureDroppableContainers: Y
2629
2629
  }), [_, Hn, U, z, y, N, A, ze, Y]);
2630
- return ie.createElement(Ir.Provider, {
2630
+ return re.createElement(Ir.Provider, {
2631
2631
  value: R
2632
- }, ie.createElement(Jt.Provider, {
2632
+ }, re.createElement(Jt.Provider, {
2633
2633
  value: yo
2634
- }, ie.createElement(Ur.Provider, {
2634
+ }, re.createElement(Ur.Provider, {
2635
2635
  value: bo
2636
- }, ie.createElement(Gr.Provider, {
2636
+ }, re.createElement(Gr.Provider, {
2637
2637
  value: mo
2638
- }, u)), ie.createElement(Qs, {
2638
+ }, u)), re.createElement(Qs, {
2639
2639
  disabled: a?.restoreFocus === !1
2640
- })), ie.createElement(Zo, {
2640
+ })), re.createElement(Zo, {
2641
2641
  ...a,
2642
2642
  hiddenTextDescribedById: N
2643
2643
  }));
@@ -2756,7 +2756,7 @@ function li(e) {
2756
2756
  !R || !T.current || (R.disconnect(), d.current = !1, R.observe(T.current));
2757
2757
  }, [T, R]), F(
2758
2758
  () => (a({
2759
- type: se.RegisterDroppable,
2759
+ type: ie.RegisterDroppable,
2760
2760
  element: {
2761
2761
  id: r,
2762
2762
  key: s,
@@ -2766,7 +2766,7 @@ function li(e) {
2766
2766
  data: I
2767
2767
  }
2768
2768
  }), () => a({
2769
- type: se.UnregisterDroppable,
2769
+ type: ie.UnregisterDroppable,
2770
2770
  key: s,
2771
2771
  id: r
2772
2772
  })),
@@ -2774,7 +2774,7 @@ function li(e) {
2774
2774
  [r]
2775
2775
  ), F(() => {
2776
2776
  n !== f.current.disabled && (a({
2777
- type: se.SetDroppableDisabled,
2777
+ type: ie.SetDroppableDisabled,
2778
2778
  id: r,
2779
2779
  key: s,
2780
2780
  disabled: n
@@ -2915,7 +2915,7 @@ function vi(e, t, n) {
2915
2915
  const r = e[t], o = e[t - 1], s = e[t + 1];
2916
2916
  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;
2917
2917
  }
2918
- const Kr = "Sortable", Jr = /* @__PURE__ */ ie.createContext({
2918
+ const Kr = "Sortable", Jr = /* @__PURE__ */ re.createContext({
2919
2919
  activeIndex: -1,
2920
2920
  containerId: Kr,
2921
2921
  disableTransforms: !1,
@@ -2964,7 +2964,7 @@ function Zr(e) {
2964
2964
  // eslint-disable-next-line react-hooks/exhaustive-deps
2965
2965
  [g, d, $.draggable, $.droppable, R, h, x, l, m, o]
2966
2966
  );
2967
- return ie.createElement(Jr.Provider, {
2967
+ return re.createElement(Jr.Provider, {
2968
2968
  value: T
2969
2969
  }, t);
2970
2970
  }
@@ -3190,7 +3190,7 @@ var cr;
3190
3190
  function Ci() {
3191
3191
  if (cr) return un;
3192
3192
  cr = 1;
3193
- var e = ie;
3193
+ var e = re;
3194
3194
  function t(d, m) {
3195
3195
  return d === m && (d !== 0 || 1 / d === 1 / m) || d !== d && m !== m;
3196
3196
  }
@@ -3277,7 +3277,7 @@ function ji() {
3277
3277
  return v();
3278
3278
  }
3279
3279
  typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
3280
- var o = ie, s = typeof Object.is == "function" ? Object.is : e, c = o.useState, a = o.useEffect, l = o.useLayoutEffect, u = o.useDebugValue, f = !1, d = !1, m = typeof window > "u" || typeof window.document > "u" || typeof window.document.createElement > "u" ? r : t;
3280
+ var o = re, s = typeof Object.is == "function" ? Object.is : e, c = o.useState, a = o.useEffect, l = o.useLayoutEffect, u = o.useDebugValue, f = !1, d = !1, m = typeof window > "u" || typeof window.document > "u" || typeof window.document.createElement > "u" ? r : t;
3281
3281
  dn.useSyncExternalStore = o.useSyncExternalStore !== void 0 ? o.useSyncExternalStore : m, typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
3282
3282
  })()), dn;
3283
3283
  }
@@ -3289,7 +3289,7 @@ var dr;
3289
3289
  function Ri() {
3290
3290
  if (dr) return ln;
3291
3291
  dr = 1;
3292
- var e = ie, t = to();
3292
+ var e = re, t = to();
3293
3293
  function n(u, f) {
3294
3294
  return u === f && (u !== 0 || 1 / u === 1 / f) || u !== u && f !== f;
3295
3295
  }
@@ -3344,7 +3344,7 @@ function Ei() {
3344
3344
  return u === f && (u !== 0 || 1 / u === 1 / f) || u !== u && f !== f;
3345
3345
  }
3346
3346
  typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
3347
- var t = ie, n = to(), r = typeof Object.is == "function" ? Object.is : e, o = n.useSyncExternalStore, s = t.useRef, c = t.useEffect, a = t.useMemo, l = t.useDebugValue;
3347
+ var t = re, n = to(), r = typeof Object.is == "function" ? Object.is : e, o = n.useSyncExternalStore, s = t.useRef, c = t.useEffect, a = t.useMemo, l = t.useDebugValue;
3348
3348
  fn.useSyncExternalStoreWithSelector = function(u, f, d, m, h) {
3349
3349
  var v = s(null);
3350
3350
  if (v.current === null) {
@@ -3986,7 +3986,7 @@ function Ka({
3986
3986
  }) {
3987
3987
  return /* @__PURE__ */ i.jsx(le.Body, { children: Array.from({ length: e }).map((n, r) => /* @__PURE__ */ i.jsx(le.Row, { children: Array.from({ length: t }).map((o, s) => /* @__PURE__ */ i.jsx(le.Cell, { children: /* @__PURE__ */ i.jsx(Ro, { height: "25px" }) }, s)) }, r)) });
3988
3988
  }
3989
- function Ql({
3989
+ function tu({
3990
3990
  tableId: e,
3991
3991
  data: t = [],
3992
3992
  headers: n = [],
@@ -4195,7 +4195,7 @@ function uc({
4195
4195
  }
4196
4196
  );
4197
4197
  }
4198
- const oe = " to ", xr = 10, He = {
4198
+ const se = " to ", xr = 10, He = {
4199
4199
  DAY_MAX: 31,
4200
4200
  MONTH_MAX: 12,
4201
4201
  YEAR_MIN: 1900,
@@ -4265,7 +4265,7 @@ function xc({
4265
4265
  onChange: t,
4266
4266
  disabled: n = !1
4267
4267
  }) {
4268
- const [r = "", o = ""] = e ? e.split("|") : [], [s, c] = K(() => r && o ? `${De(r)}${oe}${De(o)}` : r ? De(r) : ""), [a, l] = K(!1), u = X(null);
4268
+ const [r = "", o = ""] = e ? e.split("|") : [], [s, c] = K(() => r && o ? `${De(r)}${se}${De(o)}` : r ? De(r) : ""), [a, l] = K(!1), u = X(null);
4269
4269
  F(() => {
4270
4270
  const v = (g) => {
4271
4271
  g.ctrlKey && g.key === "d" && !g.shiftKey && !g.metaKey && (g.preventDefault(), u.current?.focus());
@@ -4274,9 +4274,9 @@ function xc({
4274
4274
  }, []);
4275
4275
  const f = (v) => {
4276
4276
  let g = v;
4277
- if (g.includes(oe)) {
4278
- const [x, y = ""] = g.split(oe);
4279
- g = `${ft(x.trim())}${oe}${ft(
4277
+ if (g.includes(se)) {
4278
+ const [x, y = ""] = g.split(se);
4279
+ g = `${ft(x.trim())}${se}${ft(
4280
4280
  y.trim()
4281
4281
  )}`;
4282
4282
  } else if (g.toLowerCase().includes(" to ")) {
@@ -4291,17 +4291,17 @@ function xc({
4291
4291
  t(void 0);
4292
4292
  return;
4293
4293
  }
4294
- if (v.includes(oe)) {
4295
- const [g, x = ""] = v.split(oe).map((R) => R.trim()), y = dt(g), j = x ? dt(x) : null;
4294
+ if (v.includes(se)) {
4295
+ const [g, x = ""] = v.split(se).map((R) => R.trim()), y = dt(g), j = x ? dt(x) : null;
4296
4296
  if (y && j) {
4297
- const [R, $] = j < y ? [j, y] : [y, j], T = `${De(R)}${oe}${De(
4297
+ const [R, $] = j < y ? [j, y] : [y, j], T = `${De(R)}${se}${De(
4298
4298
  $
4299
4299
  )}`;
4300
4300
  c(T), t(`${R}|${$}`);
4301
4301
  } else if (y && !x)
4302
- c(`${De(y)}${oe}`), t(void 0);
4302
+ c(`${De(y)}${se}`), t(void 0);
4303
4303
  else if (y && x) {
4304
- const R = dc(), [$, T] = R < y ? [R, y] : [y, R], E = `${De($)}${oe}${De(
4304
+ const R = dc(), [$, T] = R < y ? [R, y] : [y, R], E = `${De($)}${se}${De(
4305
4305
  T
4306
4306
  )}`;
4307
4307
  c(E), t(`${$}|${T}`);
@@ -4309,30 +4309,30 @@ function xc({
4309
4309
  c(""), t(void 0);
4310
4310
  } else {
4311
4311
  const g = dt(v);
4312
- g ? (c(`${De(g)}${oe}`), t(void 0)) : (c(""), t(void 0));
4312
+ g ? (c(`${De(g)}${se}`), t(void 0)) : (c(""), t(void 0));
4313
4313
  }
4314
4314
  }, m = (v) => {
4315
4315
  if (v.key !== "Enter") return;
4316
4316
  v.preventDefault();
4317
- const g = u.current?.selectionStart || 0, x = s.indexOf(oe);
4317
+ const g = u.current?.selectionStart || 0, x = s.indexOf(se);
4318
4318
  if (!s.trim()) {
4319
- c(`${br()}${oe}`);
4319
+ c(`${br()}${se}`);
4320
4320
  return;
4321
4321
  }
4322
4322
  if (x === -1) {
4323
4323
  const j = dt(s.trim());
4324
- j && c(`${De(j)}${oe}`);
4324
+ j && c(`${De(j)}${se}`);
4325
4325
  return;
4326
4326
  }
4327
- if (g <= x + oe.length) {
4328
- const j = s.substring(0, x).trim(), R = s.substring(x + oe.length), $ = dt(j);
4329
- $ && c(`${De($)}${oe}${R}`);
4327
+ if (g <= x + se.length) {
4328
+ const j = s.substring(0, x).trim(), R = s.substring(x + se.length), $ = dt(j);
4329
+ $ && c(`${De($)}${se}${R}`);
4330
4330
  return;
4331
4331
  }
4332
- if (s.substring(x + oe.length).trim())
4332
+ if (s.substring(x + se.length).trim())
4333
4333
  d(), u.current?.blur();
4334
4334
  else {
4335
- const j = s.substring(0, x + oe.length) + br();
4335
+ const j = s.substring(0, x + se.length) + br();
4336
4336
  c(j), setTimeout(() => {
4337
4337
  d(), u.current?.blur();
4338
4338
  }, 0);
@@ -4370,7 +4370,7 @@ function xc({
4370
4370
  /* @__PURE__ */ i.jsx(q, { fontSize: "sm", fontWeight: "medium", children: "Format:" }),
4371
4371
  /* @__PURE__ */ i.jsxs(q, { fontSize: "xs", color: "gray.600", children: [
4372
4372
  "DD-MM-YYYY",
4373
- oe,
4373
+ se,
4374
4374
  "DD-MM-YYYY"
4375
4375
  ] })
4376
4376
  ] }),
@@ -4523,7 +4523,7 @@ const bc = b(Ge.Root), yc = b(Ge.Label), wc = b(Ge.HelperText), Sc = b(Ge.ErrorT
4523
4523
  }, Vc = (e, t) => {
4524
4524
  const n = Qt(e).filter((r) => r.id !== t);
4525
4525
  kn(e, n);
4526
- }, eu = (e, t, n) => {
4526
+ }, nu = (e, t, n) => {
4527
4527
  const r = Qt(e).map(
4528
4528
  (o) => o.id === t ? n(o) : o
4529
4529
  );
@@ -4792,7 +4792,7 @@ const bc = b(Ge.Root), yc = b(Ge.Label), wc = b(Ge.HelperText), Sc = b(Ge.ErrorT
4792
4792
  ] }) })
4793
4793
  ] })
4794
4794
  ] }) });
4795
- }, tu = ({
4795
+ }, ru = ({
4796
4796
  title: e,
4797
4797
  filters: t,
4798
4798
  onVisibilityChange: n,
@@ -4840,15 +4840,15 @@ const bc = b(Ge.Root), yc = b(Ge.Label), wc = b(Ge.HelperText), Sc = b(Ge.ErrorT
4840
4840
  )
4841
4841
  ] })
4842
4842
  ] });
4843
- }, nu = (e, t) => {
4843
+ }, ou = (e, t) => {
4844
4844
  localStorage.setItem(`FILTER_ORDER_${e}`, JSON.stringify(t));
4845
- }, ru = (e) => {
4845
+ }, su = (e) => {
4846
4846
  try {
4847
4847
  return JSON.parse(localStorage.getItem(`FILTER_ORDER_${e}`) || "[]");
4848
4848
  } catch {
4849
4849
  return [];
4850
4850
  }
4851
- }, ou = ({
4851
+ }, iu = ({
4852
4852
  onClick: e,
4853
4853
  size: t = "xs",
4854
4854
  variant: n = "solid",
@@ -4879,8 +4879,8 @@ const bc = b(Ge.Root), yc = b(Ge.Label), wc = b(Ge.HelperText), Sc = b(Ge.ErrorT
4879
4879
  s
4880
4880
  ] })
4881
4881
  }
4882
- ), dl = b(re.Root), fl = b(re.Backdrop), hl = b(re.Positioner), gl = b(re.Content), pl = b(re.Header), vl = b(re.Body), ml = b(re.Footer), xl = b(re.Title), bl = b(re.CloseTrigger);
4883
- function su({
4882
+ ), dl = b(oe.Root), fl = b(oe.Backdrop), hl = b(oe.Positioner), gl = b(oe.Content), pl = b(oe.Header), vl = b(oe.Body), ml = b(oe.Footer), xl = b(oe.Title), bl = b(oe.CloseTrigger);
4883
+ function au({
4884
4884
  open: e,
4885
4885
  onClose: t,
4886
4886
  onConfirm: n,
@@ -4928,8 +4928,8 @@ function su({
4928
4928
  ] }) })
4929
4929
  ] }) });
4930
4930
  }
4931
- const yl = b(re.Root), wl = b(re.Backdrop), Sl = b(re.Positioner), Dl = b(re.Content), Cl = b(re.Header), jl = b(re.Body), Rl = b(re.Footer), El = b(re.Title), _l = b(re.CloseTrigger);
4932
- function iu({
4931
+ const yl = b(oe.Root), wl = b(oe.Backdrop), Sl = b(oe.Positioner), Dl = b(oe.Content), Cl = b(oe.Header), jl = b(oe.Body), Rl = b(oe.Footer), El = b(oe.Title), _l = b(oe.CloseTrigger);
4932
+ function cu({
4933
4933
  open: e,
4934
4934
  onClose: t,
4935
4935
  onConfirm: n,
@@ -5032,25 +5032,34 @@ function iu({
5032
5032
  }
5033
5033
  );
5034
5034
  }
5035
- const Ol = b(re.Root), Tl = b(re.Title), Ml = b(re.Content), au = ({
5035
+ const Ol = ({ children: e }) => /* @__PURE__ */ i.jsx(i.Fragment, { children: e }), Tl = ({ children: e }) => /* @__PURE__ */ i.jsx(i.Fragment, { children: e }), Ml = b(oe.Title), $l = b(oe.Content);
5036
+ function Il(e) {
5037
+ let t = null, n = null;
5038
+ return re.Children.forEach(e, (r) => {
5039
+ re.isValidElement(r) && (r.type === Ol && (t = r.props.children), r.type === Tl && (n = r.props.children));
5040
+ }), { body: t, actions: n };
5041
+ }
5042
+ const lu = ({
5036
5043
  open: e,
5037
5044
  onClose: t,
5038
5045
  title: n,
5039
5046
  children: r,
5040
- buttonChildren: o,
5041
- size: s = "md"
5042
- }) => /* @__PURE__ */ i.jsxs(Ol, { open: e, onOpenChange: () => t(), children: [
5043
- /* @__PURE__ */ i.jsx(To, {}),
5044
- /* @__PURE__ */ i.jsxs(Ml, { maxW: s, borderRadius: "12px", p: "0", children: [
5045
- /* @__PURE__ */ i.jsx(Mo, { px: "20px", py: "16px", borderBottom: "1px solid", borderColor: "gray.200", children: /* @__PURE__ */ i.jsxs(Un, { align: "center", justify: "space-between", children: [
5046
- /* @__PURE__ */ i.jsx(Tl, { fontSize: "16px", fontWeight: "600", children: n }),
5047
- /* @__PURE__ */ i.jsx($o, {})
5048
- ] }) }),
5049
- /* @__PURE__ */ i.jsx(Io, { px: "20px", py: "16px", children: r }),
5050
- /* @__PURE__ */ i.jsx(Ao, { px: "20px", py: "16px", borderTop: "1px solid", borderColor: "gray.200", children: /* @__PURE__ */ i.jsx(Un, { gap: "12px", ml: "auto", children: o }) })
5051
- ] })
5052
- ] });
5053
- function cu({
5047
+ size: o = "md"
5048
+ }) => {
5049
+ const { body: s, actions: c } = Il(r);
5050
+ return /* @__PURE__ */ i.jsxs(oe.Root, { open: e, onOpenChange: () => t(), children: [
5051
+ /* @__PURE__ */ i.jsx(To, {}),
5052
+ /* @__PURE__ */ i.jsxs($l, { maxW: o, borderRadius: "12px", p: "0", children: [
5053
+ /* @__PURE__ */ i.jsx(Mo, { px: "20px", py: "16px", borderBottom: "1px solid", borderColor: "gray.200", children: /* @__PURE__ */ i.jsxs(Un, { justify: "space-between", align: "center", children: [
5054
+ /* @__PURE__ */ i.jsx(Ml, { fontSize: "16px", fontWeight: "600", children: n }),
5055
+ /* @__PURE__ */ i.jsx($o, {})
5056
+ ] }) }),
5057
+ s && /* @__PURE__ */ i.jsx(Io, { px: "20px", py: "16px", children: s }),
5058
+ c && /* @__PURE__ */ i.jsx(Ao, { px: "20px", py: "16px", borderTop: "1px solid", borderColor: "gray.200", children: /* @__PURE__ */ i.jsx(Un, { ml: "auto", gap: "12px", children: c }) })
5059
+ ] })
5060
+ ] });
5061
+ };
5062
+ function uu({
5054
5063
  refetch: e,
5055
5064
  isLoading: t = !1,
5056
5065
  label: n = "Refresh"
@@ -5084,12 +5093,12 @@ function cu({
5084
5093
  }
5085
5094
  );
5086
5095
  }
5087
- var At = { exports: {} }, $l = At.exports, wr;
5088
- function Il() {
5096
+ var At = { exports: {} }, Al = At.exports, wr;
5097
+ function kl() {
5089
5098
  return wr || (wr = 1, (function(e, t) {
5090
5099
  (function(n, r) {
5091
5100
  e.exports = r();
5092
- })($l, (function() {
5101
+ })(Al, (function() {
5093
5102
  var n = 1e3, r = 6e4, o = 36e5, s = "millisecond", c = "second", a = "minute", l = "hour", u = "day", f = "week", d = "month", m = "quarter", h = "year", v = "date", g = "Invalid Date", x = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/, y = /\[([^\]]+)]|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, j = { 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(M) {
5094
5103
  var D = ["th", "st", "nd", "rd"], w = M % 100;
5095
5104
  return "[" + M + (D[(w - 20) % 10] || D[w] || D[0]) + "]";
@@ -5362,14 +5371,14 @@ function Il() {
5362
5371
  }));
5363
5372
  })(At)), At.exports;
5364
5373
  }
5365
- var Al = Il();
5366
- const en = /* @__PURE__ */ Xt(Al);
5367
- var kt = { exports: {} }, kl = kt.exports, Sr;
5368
- function Ll() {
5374
+ var Ll = kl();
5375
+ const en = /* @__PURE__ */ Xt(Ll);
5376
+ var kt = { exports: {} }, Nl = kt.exports, Sr;
5377
+ function zl() {
5369
5378
  return Sr || (Sr = 1, (function(e, t) {
5370
5379
  (function(n, r) {
5371
5380
  e.exports = r();
5372
- })(kl, (function() {
5381
+ })(Nl, (function() {
5373
5382
  return function(n, r, o) {
5374
5383
  n = n || {};
5375
5384
  var s = r.prototype, c = { 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" };
@@ -5408,14 +5417,14 @@ function Ll() {
5408
5417
  }));
5409
5418
  })(kt)), kt.exports;
5410
5419
  }
5411
- var Nl = Ll();
5412
- const zl = /* @__PURE__ */ Xt(Nl);
5413
- var Lt = { exports: {} }, Pl = Lt.exports, Dr;
5414
- function Yl() {
5420
+ var Pl = zl();
5421
+ const Yl = /* @__PURE__ */ Xt(Pl);
5422
+ var Lt = { exports: {} }, Fl = Lt.exports, Dr;
5423
+ function Vl() {
5415
5424
  return Dr || (Dr = 1, (function(e, t) {
5416
5425
  (function(n, r) {
5417
5426
  e.exports = r();
5418
- })(Pl, (function() {
5427
+ })(Fl, (function() {
5419
5428
  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" };
5420
5429
  return function(r, o, s) {
5421
5430
  var c = o.prototype, a = c.format;
@@ -5435,14 +5444,14 @@ function Yl() {
5435
5444
  }));
5436
5445
  })(Lt)), Lt.exports;
5437
5446
  }
5438
- var Fl = Yl();
5439
- const Vl = /* @__PURE__ */ Xt(Fl);
5440
- var Nt = { exports: {} }, Hl = Nt.exports, Cr;
5441
- function Wl() {
5447
+ var Hl = Vl();
5448
+ const Wl = /* @__PURE__ */ Xt(Hl);
5449
+ var Nt = { exports: {} }, Bl = Nt.exports, Cr;
5450
+ function Ul() {
5442
5451
  return Cr || (Cr = 1, (function(e, t) {
5443
5452
  (function(n, r) {
5444
5453
  e.exports = r();
5445
- })(Hl, (function() {
5454
+ })(Bl, (function() {
5446
5455
  return function(n, r) {
5447
5456
  var o = r.prototype, s = o.format;
5448
5457
  o.format = function(c) {
@@ -5487,12 +5496,12 @@ function Wl() {
5487
5496
  }));
5488
5497
  })(Nt)), Nt.exports;
5489
5498
  }
5490
- var Bl = Wl();
5491
- const Ul = /* @__PURE__ */ Xt(Bl);
5492
- en.extend(zl);
5493
- en.extend(Vl);
5494
- en.extend(Ul);
5495
- const Gl = {
5499
+ var Gl = Ul();
5500
+ const Xl = /* @__PURE__ */ Xt(Gl);
5501
+ en.extend(Yl);
5502
+ en.extend(Wl);
5503
+ en.extend(Xl);
5504
+ const ql = {
5496
5505
  date: "DD MMM YYYY",
5497
5506
  time: "hh:mm A",
5498
5507
  dateTime: "DD MMM YYYY, hh:mm A",
@@ -5508,9 +5517,9 @@ function jr({
5508
5517
  }) {
5509
5518
  if (!e) return r;
5510
5519
  const o = en(e);
5511
- return o.isValid() ? t === "relative" ? o.fromNow() : o.format(n ?? Gl[t]) : r;
5520
+ return o.isValid() ? t === "relative" ? o.fromNow() : o.format(n ?? ql[t]) : r;
5512
5521
  }
5513
- function lu({
5522
+ function du({
5514
5523
  value: e,
5515
5524
  dateVariant: t = "date",
5516
5525
  timeVariant: n = "time",
@@ -5537,7 +5546,7 @@ function lu({
5537
5546
  }) })
5538
5547
  ] });
5539
5548
  }
5540
- class Xl {
5549
+ class Kl {
5541
5550
  state = /* @__PURE__ */ new Map();
5542
5551
  listeners = /* @__PURE__ */ new Map();
5543
5552
  get(t) {
@@ -5574,7 +5583,7 @@ class Er {
5574
5583
  constructor(t) {
5575
5584
  this.api = t;
5576
5585
  }
5577
- store = new Xl();
5586
+ store = new Kl();
5578
5587
  inflight = /* @__PURE__ */ new Map();
5579
5588
  getRaw(t) {
5580
5589
  return this.store.get(t);
@@ -5619,14 +5628,14 @@ function ho() {
5619
5628
  throw new Error("OptionsProvider is missing. Wrap your app with <OptionsProvider />");
5620
5629
  return e;
5621
5630
  }
5622
- function uu({
5631
+ function fu({
5623
5632
  client: { apiUrl: e },
5624
5633
  children: t
5625
5634
  }) {
5626
5635
  const n = X(new Er(new Rr(e)));
5627
5636
  return n.current || (n.current = new Er(new Rr(e))), /* @__PURE__ */ i.jsx(fo.Provider, { value: n.current, children: t });
5628
5637
  }
5629
- function du(e) {
5638
+ function hu(e) {
5630
5639
  const t = ho(), [n, r] = K(t.getRaw(e)?.value);
5631
5640
  return F(() => {
5632
5641
  let o = !0;
@@ -5641,7 +5650,7 @@ function du(e) {
5641
5650
  };
5642
5651
  }, [e, t]), n;
5643
5652
  }
5644
- function fu(e) {
5653
+ function gu(e) {
5645
5654
  const t = ho(), [n, r] = K({});
5646
5655
  return F(() => {
5647
5656
  let o = !0;
@@ -5661,13 +5670,13 @@ function fu(e) {
5661
5670
  };
5662
5671
  }, [e.join("|"), t]), n;
5663
5672
  }
5664
- async function hu(e, t) {
5673
+ async function pu(e, t) {
5665
5674
  return e.getKey(t);
5666
5675
  }
5667
- async function gu(e, t) {
5676
+ async function vu(e, t) {
5668
5677
  await e.getMultiKey(t);
5669
5678
  }
5670
- function pu(e = {}) {
5679
+ function mu(e = {}) {
5671
5680
  const { initialPage: t = 1, initialLimit: n = 20 } = e, [r, o] = K(t), [s, c] = K(n), a = Q((m) => {
5672
5681
  o(Math.max(1, m));
5673
5682
  }, []), l = Q((m) => {
@@ -5689,8 +5698,8 @@ function pu(e = {}) {
5689
5698
  reset: d
5690
5699
  };
5691
5700
  }
5692
- function vu(e = {}) {
5693
- const { initialValue: t = "", delay: n = 300 } = e, [r, o] = K(t), s = ql(r, n), c = Q((l) => {
5701
+ function xu(e = {}) {
5702
+ const { initialValue: t = "", delay: n = 300 } = e, [r, o] = K(t), s = Jl(r, n), c = Q((l) => {
5694
5703
  o(l);
5695
5704
  }, []), a = Q(() => {
5696
5705
  o(t);
@@ -5702,7 +5711,7 @@ function vu(e = {}) {
5702
5711
  reset: a
5703
5712
  };
5704
5713
  }
5705
- function ql(e, t = 300) {
5714
+ function Jl(e, t = 300) {
5706
5715
  const [n, r] = K(e);
5707
5716
  return F(() => {
5708
5717
  const o = setTimeout(() => {
@@ -5712,41 +5721,41 @@ function ql(e, t = 300) {
5712
5721
  }, [e, t]), n;
5713
5722
  }
5714
5723
  export {
5715
- Ql as DataTable,
5716
- tu as Filters,
5724
+ tu as DataTable,
5725
+ ru as Filters,
5717
5726
  Rr as HttpOptionsApi,
5718
- ou as MDSButton,
5727
+ iu as MDSButton,
5719
5728
  tc as MDSCheckbox,
5720
5729
  uc as MDSCombobox,
5721
- su as MDSConfirmActionDialog,
5722
- iu as MDSConfirmDeleteDialog,
5723
- au as MDSDialogWrapper,
5730
+ au as MDSConfirmActionDialog,
5731
+ cu as MDSConfirmDeleteDialog,
5732
+ lu as MDSDialogWrapper,
5724
5733
  yr as MDSInput,
5725
- cu as MDSRefreshButton,
5734
+ uu as MDSRefreshButton,
5726
5735
  zc as MDSSelectBox,
5727
5736
  Er as OptionsClientImpl,
5728
- uu as OptionsProvider,
5729
- Xl as OptionsStore,
5730
- cu as RefreshButton,
5731
- lu as StackedDateTime,
5737
+ fu as OptionsProvider,
5738
+ Kl as OptionsStore,
5739
+ uu as RefreshButton,
5740
+ du as StackedDateTime,
5732
5741
  Fc as addPreset,
5733
5742
  Vc as deletePreset,
5734
5743
  jr as formatDateTime,
5735
- hu as getOption,
5744
+ pu as getOption,
5736
5745
  Qt as getPresets,
5737
- ru as loadOrder,
5738
- gu as prefetchOptions,
5746
+ su as loadOrder,
5747
+ vu as prefetchOptions,
5739
5748
  Bt as presetStore,
5740
- nu as saveOrder,
5749
+ ou as saveOrder,
5741
5750
  kn as savePresets,
5742
5751
  zi as setActionsConfig,
5743
5752
  Li as setData,
5744
5753
  Ni as setTableId,
5745
5754
  be as tableStore,
5746
- eu as updatePreset,
5747
- vu as useDebouncedSearch,
5748
- du as useOption,
5749
- fu as useOptions,
5750
- pu as usePagination,
5755
+ nu as updatePreset,
5756
+ xu as useDebouncedSearch,
5757
+ hu as useOption,
5758
+ gu as useOptions,
5759
+ mu as usePagination,
5751
5760
  b as withChildren
5752
5761
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mdspl/mds-shared-ui",
3
- "version": "0.8.1",
3
+ "version": "0.8.3",
4
4
  "description": "Chakra UI v3 DataTable with sorting, pagination, column visibility & drag reorder",
5
5
  "author": "magadh",
6
6
  "license": "MIT",