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