@mdspl/mds-shared-ui 1.1.0 → 1.1.1
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 +3 -3
- package/dist/index.js +543 -543
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const h=require("react"),a=require("@chakra-ui/react"),We=require("react-dom");function bt(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var nt={exports:{}},Ye={};var pn;function Kr(){if(pn)return Ye;pn=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(r,o,i){var c=null;if(i!==void 0&&(c=""+i),o.key!==void 0&&(c=""+o.key),"key"in o){i={};for(var l in o)l!=="key"&&(i[l]=o[l])}else i=o;return o=i.ref,{$$typeof:e,type:r,key:c,ref:o!==void 0?o:null,props:i}}return Ye.Fragment=t,Ye.jsx=n,Ye.jsxs=n,Ye}var Be={};var vn;function Jr(){return vn||(vn=1,process.env.NODE_ENV!=="production"&&(function(){function e(v){if(v==null)return null;if(typeof v=="function")return v.$$typeof===
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const h=require("react"),a=require("@chakra-ui/react"),We=require("react-dom");function bt(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var nt={exports:{}},Ye={};var pn;function Kr(){if(pn)return Ye;pn=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(r,o,i){var c=null;if(i!==void 0&&(c=""+i),o.key!==void 0&&(c=""+o.key),"key"in o){i={};for(var l in o)l!=="key"&&(i[l]=o[l])}else i=o;return o=i.ref,{$$typeof:e,type:r,key:c,ref:o!==void 0?o:null,props:i}}return Ye.Fragment=t,Ye.jsx=n,Ye.jsxs=n,Ye}var Be={};var vn;function Jr(){return vn||(vn=1,process.env.NODE_ENV!=="production"&&(function(){function e(v){if(v==null)return null;if(typeof v=="function")return v.$$typeof===A?null:v.displayName||v.name||null;if(typeof v=="string")return v;switch(v){case C:return"Fragment";case R:return"Profiler";case _:return"StrictMode";case O:return"Suspense";case $:return"SuspenseList";case B:return"Activity"}if(typeof v=="object")switch(typeof v.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),v.$$typeof){case b:return"Portal";case k:return v.displayName||"Context";case M:return(v._context.displayName||"Context")+".Consumer";case I:var E=v.render;return v=v.displayName,v||(v=E.displayName||E.name||"",v=v!==""?"ForwardRef("+v+")":"ForwardRef"),v;case N:return E=v.displayName||null,E!==null?E:e(v.type)||"Memo";case H:E=v._payload,v=v._init;try{return e(v(E))}catch{}}return null}function t(v){return""+v}function n(v){try{t(v);var E=!1}catch{E=!0}if(E){E=console;var F=E.error,W=typeof Symbol=="function"&&Symbol.toStringTag&&v[Symbol.toStringTag]||v.constructor.name||"Object";return F.call(E,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",W),t(v)}}function r(v){if(v===C)return"<>";if(typeof v=="object"&&v!==null&&v.$$typeof===H)return"<...>";try{var E=e(v);return E?"<"+E+">":"<...>"}catch{return"<...>"}}function o(){var v=L.A;return v===null?null:v.getOwner()}function i(){return Error("react-stack-top-frame")}function c(v){if(P.call(v,"key")){var E=Object.getOwnPropertyDescriptor(v,"key").get;if(E&&E.isReactWarning)return!1}return v.key!==void 0}function l(v,E){function F(){w||(w=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",E))}F.isReactWarning=!0,Object.defineProperty(v,"key",{get:F,configurable:!0})}function u(){var v=e(this.type);return j[v]||(j[v]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),v=this.props.ref,v!==void 0?v:null}function d(v,E,F,W,q,X){var U=F.ref;return v={$$typeof:x,type:v,key:E,props:F,_owner:W},(U!==void 0?U:null)!==null?Object.defineProperty(v,"ref",{enumerable:!1,get:u}):Object.defineProperty(v,"ref",{enumerable:!1,value:null}),v._store={},Object.defineProperty(v._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(v,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(v,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:q}),Object.defineProperty(v,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:X}),Object.freeze&&(Object.freeze(v.props),Object.freeze(v)),v}function g(v,E,F,W,q,X){var U=E.children;if(U!==void 0)if(W)if(D(U)){for(W=0;W<U.length;W++)f(U[W]);Object.freeze&&Object.freeze(U)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else f(U);if(P.call(E,"key")){U=e(v);var K=Object.keys(E).filter(function(V){return V!=="key"});W=0<K.length?"{key: someKey, "+K.join(": ..., ")+": ...}":"{key: someKey}",Y[U+W]||(K=0<K.length?"{"+K.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
|
|
2
2
|
let props = %s;
|
|
3
3
|
<%s {...props} />
|
|
4
4
|
React keys must be passed directly to JSX without using spread:
|
|
5
5
|
let props = %s;
|
|
6
|
-
<%s key={someKey} {...props} />`,W,U,K,U),Y[U+W]=!0)}if(U=null,
|
|
6
|
+
<%s key={someKey} {...props} />`,W,U,K,U),Y[U+W]=!0)}if(U=null,F!==void 0&&(n(F),U=""+F),c(E)&&(n(E.key),U=""+E.key),"key"in E){F={};for(var J in E)J!=="key"&&(F[J]=E[J])}else F=E;return U&&l(F,typeof v=="function"?v.displayName||v.name||"Unknown":v),d(v,U,F,o(),q,X)}function f(v){m(v)?v._store&&(v._store.validated=1):typeof v=="object"&&v!==null&&v.$$typeof===H&&(v._payload.status==="fulfilled"?m(v._payload.value)&&v._payload.value._store&&(v._payload.value._store.validated=1):v._store&&(v._store.validated=1))}function m(v){return typeof v=="object"&&v!==null&&v.$$typeof===x}var p=h,x=Symbol.for("react.transitional.element"),b=Symbol.for("react.portal"),C=Symbol.for("react.fragment"),_=Symbol.for("react.strict_mode"),R=Symbol.for("react.profiler"),M=Symbol.for("react.consumer"),k=Symbol.for("react.context"),I=Symbol.for("react.forward_ref"),O=Symbol.for("react.suspense"),$=Symbol.for("react.suspense_list"),N=Symbol.for("react.memo"),H=Symbol.for("react.lazy"),B=Symbol.for("react.activity"),A=Symbol.for("react.client.reference"),L=p.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,P=Object.prototype.hasOwnProperty,D=Array.isArray,S=console.createTask?console.createTask:function(){return null};p={react_stack_bottom_frame:function(v){return v()}};var w,j={},T=p.react_stack_bottom_frame.bind(p,i)(),z=S(r(i)),Y={};Be.Fragment=C,Be.jsx=function(v,E,F){var W=1e4>L.recentlyCreatedOwnerStacks++;return g(v,E,F,!1,W?Error("react-stack-top-frame"):T,W?S(r(v)):z)},Be.jsxs=function(v,E,F){var W=1e4>L.recentlyCreatedOwnerStacks++;return g(v,E,F,!0,W?Error("react-stack-top-frame"):T,W?S(r(v)):z)}})()),Be}var mn;function Zr(){return mn||(mn=1,process.env.NODE_ENV==="production"?nt.exports=Kr():nt.exports=Jr()),nt.exports}var s=Zr();function Qr(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return h.useMemo(()=>r=>{t.forEach(o=>o(r))},t)}const yt=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Ie(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function Jt(e){return"nodeType"in e}function ie(e){var t,n;return e?Ie(e)?e:Jt(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function Zt(e){const{Document:t}=ie(e);return e instanceof t}function Ke(e){return Ie(e)?!1:e instanceof ie(e).HTMLElement}function Hn(e){return e instanceof ie(e).SVGElement}function $e(e){return e?Ie(e)?e.document:Jt(e)?Zt(e)?e:Ke(e)||Hn(e)?e.ownerDocument:document:document:document}const ve=yt?h.useLayoutEffect:h.useEffect;function Qt(e){const t=h.useRef(e);return ve(()=>{t.current=e}),h.useCallback(function(){for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return t.current==null?void 0:t.current(...r)},[])}function eo(){const e=h.useRef(null),t=h.useCallback((r,o)=>{e.current=setInterval(r,o)},[]),n=h.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,n]}function Ge(e,t){t===void 0&&(t=[e]);const n=h.useRef(e);return ve(()=>{n.current!==e&&(n.current=e)},t),n}function Je(e,t){const n=h.useRef();return h.useMemo(()=>{const r=e(n.current);return n.current=r,r},[...t])}function gt(e){const t=Qt(e),n=h.useRef(null),r=h.useCallback(o=>{o!==n.current&&t?.(o,n.current),n.current=o},[]);return[n,r]}function Yt(e){const t=h.useRef();return h.useEffect(()=>{t.current=e},[e]),t.current}let _t={};function Ze(e,t){return h.useMemo(()=>{if(t)return t;const n=_t[e]==null?0:_t[e]+1;return _t[e]=n,e+"-"+n},[e,t])}function Un(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return r.reduce((i,c)=>{const l=Object.entries(c);for(const[u,d]of l){const g=i[u];g!=null&&(i[u]=g+e*d)}return i},{...t})}}const Oe=Un(1),pt=Un(-1);function to(e){return"clientX"in e&&"clientY"in e}function en(e){if(!e)return!1;const{KeyboardEvent:t}=ie(e.target);return t&&e instanceof t}function no(e){if(!e)return!1;const{TouchEvent:t}=ie(e.target);return t&&e instanceof t}function Bt(e){if(no(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return to(e)?{x:e.clientX,y:e.clientY}:null}const ke=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:n}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:n}=e;return"scaleX("+t+") scaleY("+n+")"}},Transform:{toString(e){if(e)return[ke.Translate.toString(e),ke.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+" "+n+"ms "+r}}}),xn="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function ro(e){return e.matches(xn)?e:e.querySelector(xn)}const oo={display:"none"};function so(e){let{id:t,value:n}=e;return h.createElement("div",{id:t,style:oo},n)}function io(e){let{id:t,announcement:n,ariaLiveType:r="assertive"}=e;const o={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return h.createElement("div",{id:t,style:o,role:"status","aria-live":r,"aria-atomic":!0},n)}function ao(){const[e,t]=h.useState("");return{announce:h.useCallback(r=>{r!=null&&t(r)},[]),announcement:e}}const Gn=h.createContext(null);function lo(e){const t=h.useContext(Gn);h.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function co(){const[e]=h.useState(()=>new Set),t=h.useCallback(r=>(e.add(r),()=>e.delete(r)),[e]);return[h.useCallback(r=>{let{type:o,event:i}=r;e.forEach(c=>{var l;return(l=c[o])==null?void 0:l.call(c,i)})},[e]),t]}const uo={draggable:`
|
|
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
|
-
`},fo={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 ho(e){let{announcements:t=fo,container:n,hiddenTextDescribedById:r,screenReaderInstructions:o=uo}=e;const{announce:i,announcement:c}=ao(),l=Ze("DndLiveRegion"),[u,d]=h.useState(!1);if(h.useEffect(()=>{d(!0)},[]),lo(h.useMemo(()=>({onDragStart(f){let{active:m}=f;i(t.onDragStart({active:m}))},onDragMove(f){let{active:m,over:p}=f;t.onDragMove&&i(t.onDragMove({active:m,over:p}))},onDragOver(f){let{active:m,over:p}=f;i(t.onDragOver({active:m,over:p}))},onDragEnd(f){let{active:m,over:p}=f;i(t.onDragEnd({active:m,over:p}))},onDragCancel(f){let{active:m,over:p}=f;i(t.onDragCancel({active:m,over:p}))}}),[i,t])),!u)return null;const g=h.createElement(h.Fragment,null,h.createElement(so,{id:r,value:o.draggable}),h.createElement(io,{id:l,announcement:c}));return n?We.createPortal(g,n):g}var Z;(function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"})(Z||(Z={}));function vt(){}function go(e,t){return h.useMemo(()=>({sensor:e,options:{}}),[e,t])}function po(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return h.useMemo(()=>[...t].filter(r=>r!=null),[...t])}const he=Object.freeze({x:0,y:0});function vo(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function mo(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function xo(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function bo(e,t){if(!e||e.length===0)return null;const[n]=e;return n[t]}function bn(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=bn(t,t.left,t.top),i=[];for(const c of r){const{id:l}=c,u=n.get(l);if(u){const d=vo(bn(u),o);i.push({id:l,data:{droppableContainer:c,value:d}})}}return i.sort(mo)};function yo(e,t){const n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),o=Math.min(t.left+t.width,e.left+e.width),i=Math.min(t.top+t.height,e.top+e.height),c=o-r,l=i-n;if(r<o&&n<i){const u=t.width*t.height,d=e.width*e.height,g=c*l,f=g/(u+d-g);return Number(f.toFixed(4))}return 0}const So=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=[];for(const i of r){const{id:c}=i,l=n.get(c);if(l){const u=yo(l,t);u>0&&o.push({id:c,data:{droppableContainer:i,value:u}})}}return o.sort(xo)};function wo(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function Xn(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:he}function Co(e){return function(n){for(var r=arguments.length,o=new Array(r>1?r-1:0),i=1;i<r;i++)o[i-1]=arguments[i];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 Do=Co(1);function jo(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 Ro(e,t,n){const r=jo(t);if(!r)return e;const{scaleX:o,scaleY:i,x:c,y:l}=r,u=e.left-c-(1-o)*parseFloat(n),d=e.top-l-(1-i)*parseFloat(n.slice(n.indexOf(" ")+1)),g=o?e.width/o:e.width,f=i?e.height/i:e.height;return{width:g,height:f,top:d,right:u+g,bottom:d+f,left:u}}const Mo={ignoreTransform:!1};function Ae(e,t){t===void 0&&(t=Mo);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:d,transformOrigin:g}=ie(e).getComputedStyle(e);d&&(n=Ro(n,d,g))}const{top:r,left:o,width:i,height:c,bottom:l,right:u}=n;return{top:r,left:o,width:i,height:c,bottom:l,right:u}}function yn(e){return Ae(e,{ignoreTransform:!0})}function To(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function Eo(e,t){return t===void 0&&(t=ie(e).getComputedStyle(e)),t.position==="fixed"}function _o(e,t){t===void 0&&(t=ie(e).getComputedStyle(e));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(o=>{const i=t[o];return typeof i=="string"?n.test(i):!1})}function tn(e,t){const n=[];function r(o){if(t!=null&&n.length>=t||!o)return n;if(Zt(o)&&o.scrollingElement!=null&&!n.includes(o.scrollingElement))return n.push(o.scrollingElement),n;if(!Ke(o)||Hn(o)||n.includes(o))return n;const i=ie(e).getComputedStyle(o);return o!==e&&_o(o,i)&&n.push(o),Eo(o,i)?n:r(o.parentNode)}return e?r(e):n}function Kn(e){const[t]=tn(e,1);return t??null}function Ot(e){return!yt||!e?null:Ie(e)?e:Jt(e)?Zt(e)||e===$e(e).scrollingElement?window:Ke(e)?e:null:null}function Jn(e){return Ie(e)?e.scrollX:e.scrollLeft}function Zn(e){return Ie(e)?e.scrollY:e.scrollTop}function Wt(e){return{x:Jn(e),y:Zn(e)}}var Q;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(Q||(Q={}));function Qn(e){return!yt||!e?!1:e===document.scrollingElement}function er(e){const t={x:0,y:0},n=Qn(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,i=e.scrollLeft<=t.x,c=e.scrollTop>=r.y,l=e.scrollLeft>=r.x;return{isTop:o,isLeft:i,isBottom:c,isRight:l,maxScroll:r,minScroll:t}}const Oo={x:.2,y:.2};function ko(e,t,n,r,o){let{top:i,left:c,right:l,bottom:u}=n;r===void 0&&(r=10),o===void 0&&(o=Oo);const{isTop:d,isBottom:g,isLeft:f,isRight:m}=er(e),p={x:0,y:0},x={x:0,y:0},b={height:t.height*o.y,width:t.width*o.x};return!d&&i<=t.top+b.height?(p.y=Q.Backward,x.y=r*Math.abs((t.top+b.height-i)/b.height)):!g&&u>=t.bottom-b.height&&(p.y=Q.Forward,x.y=r*Math.abs((t.bottom-b.height-u)/b.height)),!m&&l>=t.right-b.width?(p.x=Q.Forward,x.x=r*Math.abs((t.right-b.width-l)/b.width)):!f&&c<=t.left+b.width&&(p.x=Q.Backward,x.x=r*Math.abs((t.left+b.width-c)/b.width)),{direction:p,speed:x}}function Io(e){if(e===document.scrollingElement){const{innerWidth:i,innerHeight:c}=window;return{top:0,left:0,right:i,bottom:c,width:i,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 tr(e){return e.reduce((t,n)=>Oe(t,Wt(n)),he)}function $o(e){return e.reduce((t,n)=>t+Jn(n),0)}function Ao(e){return e.reduce((t,n)=>t+Zn(n),0)}function Lo(e,t){if(t===void 0&&(t=Ae),!e)return;const{top:n,left:r,bottom:o,right:i}=t(e);Kn(e)&&(o<=0||i<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const Po=[["x",["left","right"],$o],["y",["top","bottom"],Ao]];class nn{constructor(t,n){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const r=tn(n),o=tr(r);this.rect={...t},this.width=t.width,this.height=t.height;for(const[i,c,l]of Po)for(const u of c)Object.defineProperty(this,u,{get:()=>{const d=l(r),g=o[i]-d;return this.rect[u]+g},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class Ve{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 zo(e){const{EventTarget:t}=ie(e);return e instanceof t?e:$e(e)}function kt(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 de;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(de||(de={}));function Sn(e){e.preventDefault()}function No(e){e.stopPropagation()}var G;(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"})(G||(G={}));const nr={start:[G.Space,G.Enter],cancel:[G.Esc],end:[G.Space,G.Enter,G.Tab]},Fo=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case G.Right:return{...n,x:n.x+25};case G.Left:return{...n,x:n.x-25};case G.Down:return{...n,y:n.y+25};case G.Up:return{...n,y:n.y-25}}};class rr{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 Ve($e(n)),this.windowListeners=new Ve(ie(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(de.Resize,this.handleCancel),this.windowListeners.add(de.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(de.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props,r=t.node.current;r&&Lo(r),n(he)}handleKeyDown(t){if(en(t)){const{active:n,context:r,options:o}=this.props,{keyboardCodes:i=nr,coordinateGetter:c=Fo,scrollBehavior:l="smooth"}=o,{code:u}=t;if(i.end.includes(u)){this.handleEnd(t);return}if(i.cancel.includes(u)){this.handleCancel(t);return}const{collisionRect:d}=r.current,g=d?{x:d.left,y:d.top}:he;this.referenceCoordinates||(this.referenceCoordinates=g);const f=c(t,{active:n,context:r.current,currentCoordinates:g});if(f){const m=pt(f,g),p={x:0,y:0},{scrollableAncestors:x}=r.current;for(const b of x){const w=t.code,{isTop:_,isRight:R,isLeft:M,isBottom:I,maxScroll:$,minScroll:O}=er(b),A=Io(b),P={x:Math.min(w===G.Right?A.right-A.width/2:A.right,Math.max(w===G.Right?A.left:A.left+A.width/2,f.x)),y:Math.min(w===G.Down?A.bottom-A.height/2:A.bottom,Math.max(w===G.Down?A.top:A.top+A.height/2,f.y))},H=w===G.Right&&!R||w===G.Left&&!M,B=w===G.Down&&!I||w===G.Up&&!_;if(H&&P.x!==f.x){const k=b.scrollLeft+m.x,F=w===G.Right&&k<=$.x||w===G.Left&&k>=O.x;if(F&&!m.y){b.scrollTo({left:k,behavior:l});return}F?p.x=b.scrollLeft-k:p.x=w===G.Right?b.scrollLeft-$.x:b.scrollLeft-O.x,p.x&&b.scrollBy({left:-p.x,behavior:l});break}else if(B&&P.y!==f.y){const k=b.scrollTop+m.y,F=w===G.Down&&k<=$.y||w===G.Up&&k>=O.y;if(F&&!m.x){b.scrollTo({top:k,behavior:l});return}F?p.y=b.scrollTop-k:p.y=w===G.Down?b.scrollTop-$.y:b.scrollTop-O.y,p.y&&b.scrollBy({top:-p.y,behavior:l});break}}this.handleMove(t,Oe(pt(f,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()}}rr.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:r=nr,onActivation:o}=t,{active:i}=n;const{code:c}=e.nativeEvent;if(r.start.includes(c)){const l=i.activatorNode.current;return l&&e.target!==l?!1:(e.preventDefault(),o?.({event:e.nativeEvent}),!0)}return!1}}];function wn(e){return!!(e&&"distance"in e)}function Cn(e){return!!(e&&"delay"in e)}class rn{constructor(t,n,r){var o;r===void 0&&(r=zo(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:i}=t,{target:c}=i;this.props=t,this.events=n,this.document=$e(c),this.documentListeners=new Ve(this.document),this.listeners=new Ve(r),this.windowListeners=new Ve(ie(c)),this.initialCoordinates=(o=Bt(i))!=null?o:he,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(de.Resize,this.handleCancel),this.windowListeners.add(de.DragStart,Sn),this.windowListeners.add(de.VisibilityChange,this.handleCancel),this.windowListeners.add(de.ContextMenu,Sn),this.documentListeners.add(de.Keydown,this.handleKeydown),n){if(r!=null&&r({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(Cn(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(wn(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(de.Click,No,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(de.SelectionChange,this.removeTextSelection),n(t))}handleMove(t){var n;const{activated:r,initialCoordinates:o,props:i}=this,{onMove:c,options:{activationConstraint:l}}=i;if(!o)return;const u=(n=Bt(t))!=null?n:he,d=pt(o,u);if(!r&&l){if(wn(l)){if(l.tolerance!=null&&kt(d,l.tolerance))return this.handleCancel();if(kt(d,l.distance))return this.handleStart()}if(Cn(l)&&kt(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===G.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const Yo={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class on extends rn{constructor(t){const{event:n}=t,r=$e(n.target);super(t,Yo,r)}}on.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!n.isPrimary||n.button!==0?!1:(r?.({event:n}),!0)}}];const Bo={move:{name:"mousemove"},end:{name:"mouseup"}};var Vt;(function(e){e[e.RightClick=2]="RightClick"})(Vt||(Vt={}));class Wo extends rn{constructor(t){super(t,Bo,$e(t.event.target))}}Wo.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===Vt.RightClick?!1:(r?.({event:n}),!0)}}];const It={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class Vo extends rn{constructor(t){super(t,It)}static setup(){return window.addEventListener(It.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(It.move.name,t)};function t(){}}}Vo.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;const{touches:o}=n;return o.length>1?!1:(r?.({event:n}),!0)}}];var He;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(He||(He={}));var mt;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(mt||(mt={}));function Ho(e){let{acceleration:t,activator:n=He.Pointer,canScroll:r,draggingRect:o,enabled:i,interval:c=5,order:l=mt.TreeOrder,pointerCoordinates:u,scrollableAncestors:d,scrollableAncestorRects:g,delta:f,threshold:m}=e;const p=Go({delta:f,disabled:!i}),[x,b]=eo(),w=h.useRef({x:0,y:0}),_=h.useRef({x:0,y:0}),R=h.useMemo(()=>{switch(n){case He.Pointer:return u?{top:u.y,bottom:u.y,left:u.x,right:u.x}:null;case He.DraggableRect:return o}},[n,o,u]),M=h.useRef(null),I=h.useCallback(()=>{const O=M.current;if(!O)return;const A=w.current.x*_.current.x,P=w.current.y*_.current.y;O.scrollBy(A,P)},[]),$=h.useMemo(()=>l===mt.TreeOrder?[...d].reverse():d,[l,d]);h.useEffect(()=>{if(!i||!d.length||!R){b();return}for(const O of $){if(r?.(O)===!1)continue;const A=d.indexOf(O),P=g[A];if(!P)continue;const{direction:H,speed:B}=ko(O,P,R,t,m);for(const k of["x","y"])p[k][H[k]]||(B[k]=0,H[k]=0);if(B.x>0||B.y>0){b(),M.current=O,x(I,c),w.current=B,_.current=H;return}}w.current={x:0,y:0},_.current={x:0,y:0},b()},[t,I,r,b,i,c,JSON.stringify(R),JSON.stringify(p),x,d,$,g,JSON.stringify(m)])}const Uo={x:{[Q.Backward]:!1,[Q.Forward]:!1},y:{[Q.Backward]:!1,[Q.Forward]:!1}};function Go(e){let{delta:t,disabled:n}=e;const r=Yt(t);return Je(o=>{if(n||!r||!o)return Uo;const i={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[Q.Backward]:o.x[Q.Backward]||i.x===-1,[Q.Forward]:o.x[Q.Forward]||i.x===1},y:{[Q.Backward]:o.y[Q.Backward]||i.y===-1,[Q.Forward]:o.y[Q.Forward]||i.y===1}}},[n,t,r])}function qo(e,t){const n=t!=null?e.get(t):void 0,r=n?n.node.current:null;return Je(o=>{var i;return t==null?null:(i=r??o)!=null?i:null},[r,t])}function Xo(e,t){return h.useMemo(()=>e.reduce((n,r)=>{const{sensor:o}=r,i=o.activators.map(c=>({eventName:c.eventName,handler:t(c.handler,r)}));return[...n,...i]},[]),[e,t])}var qe;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(qe||(qe={}));var Ht;(function(e){e.Optimized="optimized"})(Ht||(Ht={}));const Dn=new Map;function Ko(e,t){let{dragging:n,dependencies:r,config:o}=t;const[i,c]=h.useState(null),{frequency:l,measure:u,strategy:d}=o,g=h.useRef(e),f=w(),m=Ge(f),p=h.useCallback(function(_){_===void 0&&(_=[]),!m.current&&c(R=>R===null?_:R.concat(_.filter(M=>!R.includes(M))))},[m]),x=h.useRef(null),b=Je(_=>{if(f&&!n)return Dn;if(!_||_===Dn||g.current!==e||i!=null){const R=new Map;for(let M of e){if(!M)continue;if(i&&i.length>0&&!i.includes(M.id)&&M.rect.current){R.set(M.id,M.rect.current);continue}const I=M.node.current,$=I?new nn(u(I),I):null;M.rect.current=$,$&&R.set(M.id,$)}return R}return _},[e,i,n,f,u]);return h.useEffect(()=>{g.current=e},[e]),h.useEffect(()=>{f||p()},[n,f]),h.useEffect(()=>{i&&i.length>0&&c(null)},[JSON.stringify(i)]),h.useEffect(()=>{f||typeof l!="number"||x.current!==null||(x.current=setTimeout(()=>{p(),x.current=null},l))},[l,f,p,...r]),{droppableRects:b,measureDroppableContainers:p,measuringScheduled:i!=null};function w(){switch(d){case qe.Always:return!1;case qe.BeforeDragging:return n;default:return!n}}}function or(e,t){return Je(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function Jo(e,t){return or(e,t)}function Zo(e){let{callback:t,disabled:n}=e;const r=Qt(t),o=h.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:i}=window;return new i(r)},[r,n]);return h.useEffect(()=>()=>o?.disconnect(),[o]),o}function St(e){let{callback:t,disabled:n}=e;const r=Qt(t),o=h.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:i}=window;return new i(r)},[n]);return h.useEffect(()=>()=>o?.disconnect(),[o]),o}function Qo(e){return new nn(Ae(e),e)}function jn(e,t,n){t===void 0&&(t=Qo);const[r,o]=h.useState(null);function i(){o(u=>{if(!e)return null;if(e.isConnected===!1){var d;return(d=u??n)!=null?d:null}const g=t(e);return JSON.stringify(u)===JSON.stringify(g)?u:g})}const c=Zo({callback(u){if(e)for(const d of u){const{type:g,target:f}=d;if(g==="childList"&&f instanceof HTMLElement&&f.contains(e)){i();break}}}}),l=St({callback:i});return ve(()=>{i(),e?(l?.observe(e),c?.observe(document.body,{childList:!0,subtree:!0})):(l?.disconnect(),c?.disconnect())},[e]),r}function es(e){const t=or(e);return Xn(e,t)}const Rn=[];function ts(e){const t=h.useRef(e),n=Je(r=>e?r&&r!==Rn&&e&&t.current&&e.parentNode===t.current.parentNode?r:tn(e):Rn,[e]);return h.useEffect(()=>{t.current=e},[e]),n}function ns(e){const[t,n]=h.useState(null),r=h.useRef(e),o=h.useCallback(i=>{const c=Ot(i.target);c&&n(l=>l?(l.set(c,Wt(c)),new Map(l)):null)},[]);return h.useEffect(()=>{const i=r.current;if(e!==i){c(i);const l=e.map(u=>{const d=Ot(u);return d?(d.addEventListener("scroll",o,{passive:!0}),[d,Wt(d)]):null}).filter(u=>u!=null);n(l.length?new Map(l):null),r.current=e}return()=>{c(e),c(i)};function c(l){l.forEach(u=>{const d=Ot(u);d?.removeEventListener("scroll",o)})}},[o,e]),h.useMemo(()=>e.length?t?Array.from(t.values()).reduce((i,c)=>Oe(i,c),he):tr(e):he,[e,t])}function Mn(e,t){t===void 0&&(t=[]);const n=h.useRef(null);return h.useEffect(()=>{n.current=null},t),h.useEffect(()=>{const r=e!==he;r&&!n.current&&(n.current=e),!r&&n.current&&(n.current=null)},[e]),n.current?pt(e,n.current):he}function rs(e){h.useEffect(()=>{if(!yt)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 os(e,t){return h.useMemo(()=>e.reduce((n,r)=>{let{eventName:o,handler:i}=r;return n[o]=c=>{i(c,t)},n},{}),[e,t])}function sr(e){return h.useMemo(()=>e?To(e):null,[e])}const Tn=[];function ss(e,t){t===void 0&&(t=Ae);const[n]=e,r=sr(n?ie(n):null),[o,i]=h.useState(Tn);function c(){i(()=>e.length?e.map(u=>Qn(u)?r:new nn(t(u),u)):Tn)}const l=St({callback:c});return ve(()=>{l?.disconnect(),c(),e.forEach(u=>l?.observe(u))},[e]),o}function is(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return Ke(t)?t:e}function as(e){let{measure:t}=e;const[n,r]=h.useState(null),o=h.useCallback(d=>{for(const{target:g}of d)if(Ke(g)){r(f=>{const m=t(g);return f?{...f,width:m.width,height:m.height}:m});break}},[t]),i=St({callback:o}),c=h.useCallback(d=>{const g=is(d);i?.disconnect(),g&&i?.observe(g),r(g?t(g):null)},[t,i]),[l,u]=gt(c);return h.useMemo(()=>({nodeRef:l,rect:n,setRef:u}),[n,l,u])}const ls=[{sensor:on,options:{}},{sensor:rr,options:{}}],cs={current:{}},ct={draggable:{measure:yn},droppable:{measure:yn,strategy:qe.WhileDragging,frequency:Ht.Optimized},dragOverlay:{measure:Ae}};class Ue 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 us={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Ue,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:vt},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:ct,measureDroppableContainers:vt,windowRect:null,measuringScheduled:!1},ds={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:vt,draggableNodes:new Map,over:null,measureDroppableContainers:vt},wt=h.createContext(ds),ir=h.createContext(us);function fs(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Ue}}}function hs(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 Ue(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,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;const c=new Ue(e.droppable.containers);return c.set(n,{...i,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 i=new Ue(e.droppable.containers);return i.delete(n),{...e,droppable:{...e.droppable,containers:i}}}default:return e}}function gs(e){let{disabled:t}=e;const{active:n,activatorEvent:r,draggableNodes:o}=h.useContext(wt),i=Yt(r),c=Yt(n?.id);return h.useEffect(()=>{if(!t&&!r&&i&&c!=null){if(!en(i)||document.activeElement===i.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 g of[u.current,d.current]){if(!g)continue;const f=ro(g);if(f){f.focus();break}}})}},[r,t,o,c,i]),null}function ps(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((o,i)=>i({transform:o,...r}),n):n}function vs(e){return h.useMemo(()=>({draggable:{...ct.draggable,...e?.draggable},droppable:{...ct.droppable,...e?.droppable},dragOverlay:{...ct.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function ms(e){let{activeNode:t,measure:n,initialRect:r,config:o=!0}=e;const i=h.useRef(!1),{x:c,y:l}=typeof o=="boolean"?{x:o,y:o}:o;ve(()=>{if(!c&&!l||!t){i.current=!1;return}if(i.current||!r)return;const d=t?.node.current;if(!d||d.isConnected===!1)return;const g=n(d),f=Xn(g,r);if(c||(f.x=0),l||(f.y=0),i.current=!0,Math.abs(f.x)>0||Math.abs(f.y)>0){const m=Kn(d);m&&m.scrollBy({top:f.y,left:f.x})}},[t,c,l,r,n])}const ar=h.createContext({...he,scaleX:1,scaleY:1});var De;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(De||(De={}));const lr=h.memo(function(t){var n,r,o,i;let{id:c,accessibility:l,autoScroll:u=!0,children:d,sensors:g=ls,collisionDetection:f=So,measuring:m,modifiers:p,...x}=t;const b=h.useReducer(hs,void 0,fs),[w,_]=b,[R,M]=co(),[I,$]=h.useState(De.Uninitialized),O=I===De.Initialized,{draggable:{active:A,nodes:P,translate:H},droppable:{containers:B}}=w,k=A!=null?P.get(A):null,F=h.useRef({initial:null,translated:null}),z=h.useMemo(()=>{var oe;return A!=null?{id:A,data:(oe=k?.data)!=null?oe:cs,rect:F}:null},[A,k]),D=h.useRef(null),[C,S]=h.useState(null),[j,T]=h.useState(null),L=Ge(x,Object.values(x)),Y=Ze("DndDescribedBy",c),v=h.useMemo(()=>B.getEnabled(),[B]),E=vs(m),{droppableRects:N,measureDroppableContainers:W,measuringScheduled:q}=Ko(v,{dragging:O,dependencies:[H.x,H.y],config:E.droppable}),X=qo(P,A),U=h.useMemo(()=>j?Bt(j):null,[j]),K=Xr(),J=Jo(X,E.draggable.measure);ms({activeNode:A!=null?P.get(A):null,config:K.layoutShiftCompensation,initialRect:J,measure:E.draggable.measure});const V=jn(X,E.draggable.measure,J),se=jn(X?X.parentElement:null),re=h.useRef({activatorEvent:null,active:null,activeNode:X,collisionRect:null,collisions:null,droppableRects:N,draggableNodes:P,draggingNode:null,draggingNodeRect:null,droppableContainers:B,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),fe=B.getNodeFor((n=re.current.over)==null?void 0:n.id),me=as({measure:E.dragOverlay.measure}),Re=(r=me.nodeRef.current)!=null?r:X,Me=O?(o=me.rect)!=null?o:V:null,an=!!(me.nodeRef.current&&me.rect),ln=es(an?null:V),Mt=sr(Re?ie(Re):null),be=ts(O?fe??X:null),et=ss(be),tt=ps(p,{transform:{x:H.x-ln.x,y:H.y-ln.y,scaleX:1,scaleY:1},activatorEvent:j,active:z,activeNodeRect:V,containerNodeRect:se,draggingNodeRect:Me,over:re.current.over,overlayNodeRect:me.rect,scrollableAncestors:be,scrollableAncestorRects:et,windowRect:Mt}),cn=U?Oe(U,H):null,un=ns(be),Br=Mn(un),Wr=Mn(un,[V]),Te=Oe(tt,Br),Ee=Me?Do(Me,tt):null,Pe=z&&Ee?f({active:z,collisionRect:Ee,droppableRects:N,droppableContainers:v,pointerCoordinates:cn}):null,dn=bo(Pe,"id"),[ye,fn]=h.useState(null),Vr=an?tt:Oe(tt,Wr),Hr=wo(Vr,(i=ye?.rect)!=null?i:null,V),Tt=h.useRef(null),hn=h.useCallback((oe,ae)=>{let{sensor:le,options:Se}=ae;if(D.current==null)return;const ue=P.get(D.current);if(!ue)return;const ce=oe.nativeEvent,ge=new le({active:D.current,activeNode:ue,event:ce,options:Se,context:re,onAbort(te){if(!P.get(te))return;const{onDragAbort:pe}=L.current,xe={id:te};pe?.(xe),R({type:"onDragAbort",event:xe})},onPending(te,we,pe,xe){if(!P.get(te))return;const{onDragPending:Ne}=L.current,Ce={id:te,constraint:we,initialCoordinates:pe,offset:xe};Ne?.(Ce),R({type:"onDragPending",event:Ce})},onStart(te){const we=D.current;if(we==null)return;const pe=P.get(we);if(!pe)return;const{onDragStart:xe}=L.current,ze={activatorEvent:ce,active:{id:we,data:pe.data,rect:F}};We.unstable_batchedUpdates(()=>{xe?.(ze),$(De.Initializing),_({type:Z.DragStart,initialCoordinates:te,active:we}),R({type:"onDragStart",event:ze}),S(Tt.current),T(ce)})},onMove(te){_({type:Z.DragMove,coordinates:te})},onEnd:_e(Z.DragEnd),onCancel:_e(Z.DragCancel)});Tt.current=ge;function _e(te){return async function(){const{active:pe,collisions:xe,over:ze,scrollAdjustedTranslate:Ne}=re.current;let Ce=null;if(pe&&Ne){const{cancelDrop:Fe}=L.current;Ce={activatorEvent:ce,active:pe,collisions:xe,delta:Ne,over:ze},te===Z.DragEnd&&typeof Fe=="function"&&await Promise.resolve(Fe(Ce))&&(te=Z.DragCancel)}D.current=null,We.unstable_batchedUpdates(()=>{_({type:te}),$(De.Uninitialized),fn(null),S(null),T(null),Tt.current=null;const Fe=te===Z.DragEnd?"onDragEnd":"onDragCancel";if(Ce){const Et=L.current[Fe];Et?.(Ce),R({type:Fe,event:Ce})}})}}},[P]),Ur=h.useCallback((oe,ae)=>(le,Se)=>{const ue=le.nativeEvent,ce=P.get(Se);if(D.current!==null||!ce||ue.dndKit||ue.defaultPrevented)return;const ge={active:ce};oe(le,ae.options,ge)===!0&&(ue.dndKit={capturedBy:ae.sensor},D.current=Se,hn(le,ae))},[P,hn]),gn=Xo(g,Ur);rs(g),ve(()=>{V&&I===De.Initializing&&$(De.Initialized)},[V,I]),h.useEffect(()=>{const{onDragMove:oe}=L.current,{active:ae,activatorEvent:le,collisions:Se,over:ue}=re.current;if(!ae||!le)return;const ce={active:ae,activatorEvent:le,collisions:Se,delta:{x:Te.x,y:Te.y},over:ue};We.unstable_batchedUpdates(()=>{oe?.(ce),R({type:"onDragMove",event:ce})})},[Te.x,Te.y]),h.useEffect(()=>{const{active:oe,activatorEvent:ae,collisions:le,droppableContainers:Se,scrollAdjustedTranslate:ue}=re.current;if(!oe||D.current==null||!ae||!ue)return;const{onDragOver:ce}=L.current,ge=Se.get(dn),_e=ge&&ge.rect.current?{id:ge.id,rect:ge.rect.current,data:ge.data,disabled:ge.disabled}:null,te={active:oe,activatorEvent:ae,collisions:le,delta:{x:ue.x,y:ue.y},over:_e};We.unstable_batchedUpdates(()=>{fn(_e),ce?.(te),R({type:"onDragOver",event:te})})},[dn]),ve(()=>{re.current={activatorEvent:j,active:z,activeNode:X,collisionRect:Ee,collisions:Pe,droppableRects:N,draggableNodes:P,draggingNode:Re,draggingNodeRect:Me,droppableContainers:B,over:ye,scrollableAncestors:be,scrollAdjustedTranslate:Te},F.current={initial:Me,translated:Ee}},[z,X,Pe,Ee,P,Re,Me,N,B,ye,be,Te]),Ho({...K,delta:H,draggingRect:Ee,pointerCoordinates:cn,scrollableAncestors:be,scrollableAncestorRects:et});const Gr=h.useMemo(()=>({active:z,activeNode:X,activeNodeRect:V,activatorEvent:j,collisions:Pe,containerNodeRect:se,dragOverlay:me,draggableNodes:P,droppableContainers:B,droppableRects:N,over:ye,measureDroppableContainers:W,scrollableAncestors:be,scrollableAncestorRects:et,measuringConfiguration:E,measuringScheduled:q,windowRect:Mt}),[z,X,V,j,Pe,se,me,P,B,N,ye,W,be,et,E,q,Mt]),qr=h.useMemo(()=>({activatorEvent:j,activators:gn,active:z,activeNodeRect:V,ariaDescribedById:{draggable:Y},dispatch:_,draggableNodes:P,over:ye,measureDroppableContainers:W}),[j,gn,z,V,_,Y,P,ye,W]);return h.createElement(Gn.Provider,{value:M},h.createElement(wt.Provider,{value:qr},h.createElement(ir.Provider,{value:Gr},h.createElement(ar.Provider,{value:Hr},d)),h.createElement(gs,{disabled:l?.restoreFocus===!1})),h.createElement(ho,{...l,hiddenTextDescribedById:Y}));function Xr(){const oe=C?.autoScrollEnabled===!1,ae=typeof u=="object"?u.enabled===!1:u===!1,le=O&&!oe&&!ae;return typeof u=="object"?{...u,enabled:le}:{enabled:le}}}),xs=h.createContext(null),En="button",bs="Draggable";function ys(e){let{id:t,data:n,disabled:r=!1,attributes:o}=e;const i=Ze(bs),{activators:c,activatorEvent:l,active:u,activeNodeRect:d,ariaDescribedById:g,draggableNodes:f,over:m}=h.useContext(wt),{role:p=En,roleDescription:x="draggable",tabIndex:b=0}=o??{},w=u?.id===t,_=h.useContext(w?ar:xs),[R,M]=gt(),[I,$]=gt(),O=os(c,t),A=Ge(n);ve(()=>(f.set(t,{id:t,key:i,node:R,activatorNode:I,data:A}),()=>{const H=f.get(t);H&&H.key===i&&f.delete(t)}),[f,t]);const P=h.useMemo(()=>({role:p,tabIndex:b,"aria-disabled":r,"aria-pressed":w&&p===En?!0:void 0,"aria-roledescription":x,"aria-describedby":g.draggable}),[r,p,b,w,x,g.draggable]);return{active:u,activatorEvent:l,activeNodeRect:d,attributes:P,isDragging:w,listeners:r?void 0:O,node:R,over:m,setNodeRef:M,setActivatorNodeRef:$,transform:_}}function Ss(){return h.useContext(ir)}const ws="Droppable",Cs={timeout:25};function Ds(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:o}=e;const i=Ze(ws),{active:c,dispatch:l,over:u,measureDroppableContainers:d}=h.useContext(wt),g=h.useRef({disabled:n}),f=h.useRef(!1),m=h.useRef(null),p=h.useRef(null),{disabled:x,updateMeasurementsFor:b,timeout:w}={...Cs,...o},_=Ge(b??r),R=h.useCallback(()=>{if(!f.current){f.current=!0;return}p.current!=null&&clearTimeout(p.current),p.current=setTimeout(()=>{d(Array.isArray(_.current)?_.current:[_.current]),p.current=null},w)},[w]),M=St({callback:R,disabled:x||!c}),I=h.useCallback((P,H)=>{M&&(H&&(M.unobserve(H),f.current=!1),P&&M.observe(P))},[M]),[$,O]=gt(I),A=Ge(t);return h.useEffect(()=>{!M||!$.current||(M.disconnect(),f.current=!1,M.observe($.current))},[$,M]),h.useEffect(()=>(l({type:Z.RegisterDroppable,element:{id:r,key:i,disabled:n,node:$,rect:m,data:A}}),()=>l({type:Z.UnregisterDroppable,key:i,id:r})),[r]),h.useEffect(()=>{n!==g.current.disabled&&(l({type:Z.SetDroppableDisabled,id:r,key:i,disabled:n}),g.current.disabled=n)},[r,i,n,l]),{active:c,rect:m,isOver:u?.id===r,node:$,over:u,setNodeRef:O}}function Ct(e,t,n){const r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function js(e,t){return e.reduce((n,r,o)=>{const i=t.get(r);return i&&(n[o]=i),n},Array(e.length))}function rt(e){return e!==null&&e>=0}function Rs(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 Ms(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const ot={scaleX:1,scaleY:1},Ts=e=>{var t;let{rects:n,activeNodeRect:r,activeIndex:o,overIndex:i,index:c}=e;const l=(t=n[o])!=null?t:r;if(!l)return null;const u=Es(n,c,o);if(c===o){const d=n[i];return d?{x:o<i?d.left+d.width-(l.left+l.width):d.left-l.left,y:0,...ot}:null}return c>o&&c<=i?{x:-l.width-u,y:0,...ot}:c<o&&c>=i?{x:l.width+u,y:0,...ot}:{x:0,y:0,...ot}};function Es(e,t,n){const r=e[t],o=e[t-1],i=e[t+1];return!r||!o&&!i?0:n<t?o?r.left-(o.left+o.width):i.left-(r.left+r.width):i?i.left-(r.left+r.width):r.left-(o.left+o.width)}const cr=e=>{let{rects:t,activeIndex:n,overIndex:r,index:o}=e;const i=Ct(t,r,n),c=t[o],l=i[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}},st={scaleX:1,scaleY:1},_s=e=>{var t;let{activeIndex:n,activeNodeRect:r,index:o,rects:i,overIndex:c}=e;const l=(t=i[n])!=null?t:r;if(!l)return null;if(o===n){const d=i[c];return d?{x:0,y:n<c?d.top+d.height-(l.top+l.height):d.top-l.top,...st}:null}const u=Os(i,o,n);return o>n&&o<=c?{x:0,y:-l.height-u,...st}:o<n&&o>=c?{x:0,y:l.height+u,...st}:{x:0,y:0,...st}};function Os(e,t,n){const r=e[t],o=e[t-1],i=e[t+1];return r?n<t?o?r.top-(o.top+o.height):i?i.top-(r.top+r.height):0:i?i.top-(r.top+r.height):o?r.top-(o.top+o.height):0:0}const ur="Sortable",dr=h.createContext({activeIndex:-1,containerId:ur,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:cr,disabled:{draggable:!1,droppable:!1}});function fr(e){let{children:t,id:n,items:r,strategy:o=cr,disabled:i=!1}=e;const{active:c,dragOverlay:l,droppableRects:u,over:d,measureDroppableContainers:g}=Ss(),f=Ze(ur,n),m=l.rect!==null,p=h.useMemo(()=>r.map(O=>typeof O=="object"&&"id"in O?O.id:O),[r]),x=c!=null,b=c?p.indexOf(c.id):-1,w=d?p.indexOf(d.id):-1,_=h.useRef(p),R=!Rs(p,_.current),M=w!==-1&&b===-1||R,I=Ms(i);ve(()=>{R&&x&&g(p)},[R,p,x,g]),h.useEffect(()=>{_.current=p},[p]);const $=h.useMemo(()=>({activeIndex:b,containerId:f,disabled:I,disableTransforms:M,items:p,overIndex:w,useDragOverlay:m,sortedRects:js(p,u),strategy:o}),[b,f,I.draggable,I.droppable,M,p,w,u,m,o]);return h.createElement(dr.Provider,{value:$},t)}const ks=e=>{let{id:t,items:n,activeIndex:r,overIndex:o}=e;return Ct(n,r,o).indexOf(t)},Is=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:o,items:i,newIndex:c,previousItems:l,previousContainerId:u,transition:d}=e;return!d||!r||l!==i&&o===c?!1:n?!0:c!==o&&t===u},$s={duration:200,easing:"ease"},hr="transform",As=ke.Transition.toString({property:hr,duration:0,easing:"linear"}),Ls={roleDescription:"sortable"};function Ps(e){let{disabled:t,index:n,node:r,rect:o}=e;const[i,c]=h.useState(null),l=h.useRef(n);return ve(()=>{if(!t&&n!==l.current&&r.current){const u=o.current;if(u){const d=Ae(r.current,{ignoreTransform:!0}),g={x:u.left-d.left,y:u.top-d.top,scaleX:u.width/d.width,scaleY:u.height/d.height};(g.x||g.y)&&c(g)}}n!==l.current&&(l.current=n)},[t,n,r,o]),h.useEffect(()=>{i&&c(null)},[i]),i}function gr(e){let{animateLayoutChanges:t=Is,attributes:n,disabled:r,data:o,getNewIndex:i=ks,id:c,strategy:l,resizeObserverConfig:u,transition:d=$s}=e;const{items:g,containerId:f,activeIndex:m,disabled:p,disableTransforms:x,sortedRects:b,overIndex:w,useDragOverlay:_,strategy:R}=h.useContext(dr),M=zs(r,p),I=g.indexOf(c),$=h.useMemo(()=>({sortable:{containerId:f,index:I,items:g},...o}),[f,o,I,g]),O=h.useMemo(()=>g.slice(g.indexOf(c)),[g,c]),{rect:A,node:P,isOver:H,setNodeRef:B}=Ds({id:c,data:$,disabled:M.droppable,resizeObserverConfig:{updateMeasurementsFor:O,...u}}),{active:k,activatorEvent:F,activeNodeRect:z,attributes:D,setNodeRef:C,listeners:S,isDragging:j,over:T,setActivatorNodeRef:L,transform:Y}=ys({id:c,data:$,attributes:{...Ls,...n},disabled:M.draggable}),v=Qr(B,C),E=!!k,N=E&&!x&&rt(m)&&rt(w),W=!_&&j,q=W&&N?Y:null,U=N?q??(l??R)({rects:b,activeNodeRect:z,activeIndex:m,overIndex:w,index:I}):null,K=rt(m)&&rt(w)?i({id:c,items:g,activeIndex:m,overIndex:w}):I,J=k?.id,V=h.useRef({activeId:J,items:g,newIndex:K,containerId:f}),se=g!==V.current.items,re=t({active:k,containerId:f,isDragging:j,isSorting:E,id:c,index:I,items:g,newIndex:V.current.newIndex,previousItems:V.current.items,previousContainerId:V.current.containerId,transition:d,wasDragging:V.current.activeId!=null}),fe=Ps({disabled:!re,index:I,node:P,rect:A});return h.useEffect(()=>{E&&V.current.newIndex!==K&&(V.current.newIndex=K),f!==V.current.containerId&&(V.current.containerId=f),g!==V.current.items&&(V.current.items=g)},[E,K,f,g]),h.useEffect(()=>{if(J===V.current.activeId)return;if(J!=null&&V.current.activeId==null){V.current.activeId=J;return}const Re=setTimeout(()=>{V.current.activeId=J},50);return()=>clearTimeout(Re)},[J]),{active:k,activeIndex:m,attributes:D,data:$,rect:A,index:I,newIndex:K,items:g,isOver:H,isSorting:E,isDragging:j,listeners:S,node:P,overIndex:w,over:T,setNodeRef:v,setActivatorNodeRef:L,setDroppableNodeRef:B,setDraggableNodeRef:C,transform:fe??U,transition:me()};function me(){if(fe||se&&V.current.newIndex===I)return As;if(!(W&&!en(F)||!d)&&(E||re))return ke.Transition.toString({...d,property:hr})}}function zs(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}}G.Down,G.Right,G.Up,G.Left;var it={exports:{}},$t={},at={exports:{}},At={};var _n;function Ns(){if(_n)return At;_n=1;var e=h;function t(f,m){return f===m&&(f!==0||1/f===1/m)||f!==f&&m!==m}var n=typeof Object.is=="function"?Object.is:t,r=e.useState,o=e.useEffect,i=e.useLayoutEffect,c=e.useDebugValue;function l(f,m){var p=m(),x=r({inst:{value:p,getSnapshot:m}}),b=x[0].inst,w=x[1];return i(function(){b.value=p,b.getSnapshot=m,u(b)&&w({inst:b})},[f,p,m]),o(function(){return u(b)&&w({inst:b}),f(function(){u(b)&&w({inst:b})})},[f]),c(p),p}function u(f){var m=f.getSnapshot;f=f.value;try{var p=m();return!n(f,p)}catch{return!0}}function d(f,m){return m()}var g=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?d:l;return At.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:g,At}var Lt={};var On;function Fs(){return On||(On=1,process.env.NODE_ENV!=="production"&&(function(){function e(p,x){return p===x&&(p!==0||1/p===1/x)||p!==p&&x!==x}function t(p,x){g||o.startTransition===void 0||(g=!0,console.error("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));var b=x();if(!f){var w=x();i(b,w)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),f=!0)}w=c({inst:{value:b,getSnapshot:x}});var _=w[0].inst,R=w[1];return u(function(){_.value=b,_.getSnapshot=x,n(_)&&R({inst:_})},[p,b,x]),l(function(){return n(_)&&R({inst:_}),p(function(){n(_)&&R({inst:_})})},[p]),d(b),b}function n(p){var x=p.getSnapshot;p=p.value;try{var b=x();return!i(p,b)}catch{return!0}}function r(p,x){return x()}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var o=h,i=typeof Object.is=="function"?Object.is:e,c=o.useState,l=o.useEffect,u=o.useLayoutEffect,d=o.useDebugValue,g=!1,f=!1,m=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?r:t;Lt.useSyncExternalStore=o.useSyncExternalStore!==void 0?o.useSyncExternalStore:m,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()),Lt}var kn;function pr(){return kn||(kn=1,process.env.NODE_ENV==="production"?at.exports=Ns():at.exports=Fs()),at.exports}var In;function Ys(){if(In)return $t;In=1;var e=h,t=pr();function n(d,g){return d===g&&(d!==0||1/d===1/g)||d!==d&&g!==g}var r=typeof Object.is=="function"?Object.is:n,o=t.useSyncExternalStore,i=e.useRef,c=e.useEffect,l=e.useMemo,u=e.useDebugValue;return $t.useSyncExternalStoreWithSelector=function(d,g,f,m,p){var x=i(null);if(x.current===null){var b={hasValue:!1,value:null};x.current=b}else b=x.current;x=l(function(){function _(O){if(!R){if(R=!0,M=O,O=m(O),p!==void 0&&b.hasValue){var A=b.value;if(p(A,O))return I=A}return I=O}if(A=I,r(M,O))return A;var P=m(O);return p!==void 0&&p(A,P)?(M=O,A):(M=O,I=P)}var R=!1,M,I,$=f===void 0?null:f;return[function(){return _(g())},$===null?void 0:function(){return _($())}]},[g,f,m,p]);var w=o(d,x[0],x[1]);return c(function(){b.hasValue=!0,b.value=w},[w]),u(w),w},$t}var Pt={};var $n;function Bs(){return $n||($n=1,process.env.NODE_ENV!=="production"&&(function(){function e(d,g){return d===g&&(d!==0||1/d===1/g)||d!==d&&g!==g}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var t=h,n=pr(),r=typeof Object.is=="function"?Object.is:e,o=n.useSyncExternalStore,i=t.useRef,c=t.useEffect,l=t.useMemo,u=t.useDebugValue;Pt.useSyncExternalStoreWithSelector=function(d,g,f,m,p){var x=i(null);if(x.current===null){var b={hasValue:!1,value:null};x.current=b}else b=x.current;x=l(function(){function _(O){if(!R){if(R=!0,M=O,O=m(O),p!==void 0&&b.hasValue){var A=b.value;if(p(A,O))return I=A}return I=O}if(A=I,r(M,O))return A;var P=m(O);return p!==void 0&&p(A,P)?(M=O,A):(M=O,I=P)}var R=!1,M,I,$=f===void 0?null:f;return[function(){return _(g())},$===null?void 0:function(){return _($())}]},[g,f,m,p]);var w=o(d,x[0],x[1]);return c(function(){b.hasValue=!0,b.value=w},[w]),u(w),w},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()),Pt}var An;function Ws(){return An||(An=1,process.env.NODE_ENV==="production"?it.exports=Ys():it.exports=Bs()),it.exports}var Vs=Ws();const Ut=new WeakMap,Hs=new WeakMap,xt={current:[]};let zt=!1;const lt=new Set,Ln=new Map;function vr(e){for(const t of e){if(xt.current.includes(t))continue;xt.current.push(t),t.recompute();const n=Hs.get(t);if(n)for(const r of n){const o=Ut.get(r);o?.length&&vr(o)}}}function Us(e){const t={prevVal:e.prevState,currentVal:e.state};for(const n of e.listeners)n(t)}function Gs(e){const t={prevVal:e.prevState,currentVal:e.state};for(const n of e.listeners)n(t)}function qs(e){if(lt.add(e),!zt)try{for(zt=!0;lt.size>0;){const t=Array.from(lt);lt.clear();for(const n of t){const r=Ln.get(n)??n.prevState;n.prevState=r,Us(n)}for(const n of t){const r=Ut.get(n);r&&(xt.current.push(n),vr(r))}for(const n of t){const r=Ut.get(n);if(r)for(const o of r)Gs(o)}}}finally{zt=!1,xt.current=[],Ln.clear()}}function Xs(e){return typeof e=="function"}class mr{constructor(t,n){this.listeners=new Set,this.subscribe=r=>{var o,i;this.listeners.add(r);const c=(i=(o=this.options)==null?void 0:o.onSubscribe)==null?void 0:i.call(o,r,this);return()=>{this.listeners.delete(r),c?.()}},this.prevState=t,this.state=t,this.options=n}setState(t){var n,r,o;this.prevState=this.state,(n=this.options)!=null&&n.updateFn?this.state=this.options.updateFn(this.prevState)(t):Xs(t)?this.state=t(this.prevState):this.state=t,(o=(r=this.options)==null?void 0:r.onUpdate)==null||o.call(r),qs(this)}}function Le(e,t=r=>r,n={}){const r=n.equal??Ks;return Vs.useSyncExternalStoreWithSelector(e.subscribe,()=>e.state,()=>e.state,t,r)}function Ks(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[r,o]of e)if(!t.has(r)||!Object.is(o,t.get(r)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const r of e)if(!t.has(r))return!1;return!0}if(e instanceof Date&&t instanceof Date)return e.getTime()===t.getTime();const n=Pn(e);if(n.length!==Pn(t).length)return!1;for(let r=0;r<n.length;r++)if(!Object.prototype.hasOwnProperty.call(t,n[r])||!Object.is(e[n[r]],t[n[r]]))return!1;return!0}function Pn(e){return Object.keys(e).concat(Object.getOwnPropertySymbols(e))}const ne=new mr({tableId:"",sortColumn:null,sortDirection:"asc",visibility:{},columnOrder:[],columnWidths:{},data:[],sortableColumns:[],actionsConfig:{showActionColumn:!0,showColumnVisibilityMenu:!0,children:"Actions",width:"100px"}}),Dt=e=>`datatable:${e}:column-widths`;function xr(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:i}=ne.state,c=JSON.parse(localStorage.getItem(Sr(i))||"[]"),l=[...c.map(f=>o.find(m=>m.id===f)).filter(Boolean),...o.filter(f=>!c.includes(f.id))],u=JSON.parse(localStorage.getItem(wr(i))||"{}"),d=l.reduce((f,m)=>(f[m.id]=u[m.id]??!0,f),{}),g=JSON.parse(localStorage.getItem(Dt(i))||"{}");ne.setState(f=>({...f,data:e,columnOrder:l,visibility:d,columnWidths:g,sortableColumns:l.map(m=>({id:m.id,label:m.label,sortable:!0,backgroundColor:m.backgroundColor}))}))}function br(e){ne.setState(t=>({...t,tableId:e,sortColumn:null,sortDirection:"asc",columnOrder:[],visibility:{}}))}const yr=e=>{ne.setState(t=>({...t,actionsConfig:e}))};function Js(e,t){ne.setState(n=>{const r={...n.columnWidths,[e]:Math.max(60,t)};return localStorage.setItem(Dt(n.tableId),JSON.stringify(r)),{...n,columnWidths:r}})}const Sr=e=>`table_column_order_v1:${e}`,wr=e=>`table_column_visibility_v1:${e}`,Zs=e=>{const{tableId:t}=ne.state;localStorage.setItem(Sr(t),JSON.stringify(e.map(n=>n.id))),ne.setState(n=>({...n,columnOrder:e})),ne.setState(n=>({...n,columnOrder:e}))};function Qs(e){ne.setState(t=>t.sortColumn===e?{...t,sortDirection:t.sortDirection==="asc"?"desc":"asc"}:{...t,sortColumn:e,sortDirection:"asc"})}const ei=e=>{ne.setState(t=>{const n={...t.visibility,[e]:!t.visibility[e]};return t.tableId&&localStorage.setItem(wr(t.tableId),JSON.stringify(n)),{...t,visibility:n}})};function ti(e,t){ne.setState(n=>{const r={...n.columnWidths,[e]:Math.max(60,t)};return localStorage.setItem(Dt(n.tableId),JSON.stringify(r)),{...n,columnWidths:r}})}const ni=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),ri=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,r)=>r?r.toUpperCase():n.toLowerCase()),zn=e=>{const t=ri(e);return t.charAt(0).toUpperCase()+t.slice(1)},Cr=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim(),oi=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0};var si={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 ii=h.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:o="",children:i,iconNode:c,...l},u)=>h.createElement("svg",{ref:u,...si,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:Cr("lucide",o),...!i&&!oi(l)&&{"aria-hidden":"true"},...l},[...c.map(([d,g])=>h.createElement(d,g)),...Array.isArray(i)?i:[i]]));const ee=(e,t)=>{const n=h.forwardRef(({className:r,...o},i)=>h.createElement(ii,{ref:i,iconNode:t,className:Cr(`lucide-${ni(zn(e))}`,`lucide-${e}`,r),...o}));return n.displayName=zn(e),n};const ai=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],li=ee("arrow-down",ai);const ci=[["path",{d:"M8 3 4 7l4 4",key:"9rb6wj"}],["path",{d:"M4 7h16",key:"6tx8e3"}],["path",{d:"m16 21 4-4-4-4",key:"siv7j2"}],["path",{d:"M20 17H4",key:"h6l3hr"}]],ui=ee("arrow-left-right",ci);const di=[["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"}]],fi=ee("arrow-up-down",di);const hi=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],gi=ee("arrow-up",hi);const pi=[["path",{d:"m19 21-7-4-7 4V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v16z",key:"1fy3hk"}]],vi=ee("bookmark",pi);const mi=[["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"}]],Dr=ee("calendar",mi);const xi=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],bi=ee("chevron-left",xi);const yi=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Si=ee("chevron-right",yi);const wi=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 3v18",key:"108xh3"}]],Ci=ee("columns-2",wi);const Di=[["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"}]],ji=ee("delete",Di);const Ri=[["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"}]],Mi=ee("ellipsis",Ri);const Ti=[["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"}]],Ei=ee("funnel",Ti);const _i=[["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"}]],jr=ee("grip-vertical",_i);const Oi=[["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"}]],ki=ee("pen",Oi);const Ii=[["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"}]],$i=ee("refresh-ccw",Ii);const Ai=[["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"}]],Li=ee("settings",Ai);const Pi=[["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"}]],Rr=ee("triangle-alert",Pi);const zi=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Mr=ee("x",zi);function y(e){return h.forwardRef((t,n)=>{const{children:r,...o}=t;return s.jsx(e,{ref:n,...o,children:r})})}const Ni=y(a.Menu.Trigger),Fi=y(a.Menu.Positioner),Yi=y(a.Menu.Content),Bi=y(a.Menu.Item),Wi=y(a.Checkbox.Label),Vi=y(a.Checkbox.HiddenInput),Hi=y(a.Checkbox.Control);function Ui({visibility:e,onToggle:t}){const{sortableColumns:n}=Le(ne);return s.jsxs(a.Menu.Root,{closeOnSelect:!1,children:[s.jsx(Ni,{asChild:!0,children:s.jsx(a.IconButton,{"aria-label":"Toggle columns",variant:"ghost",ml:"1",size:"xs",children:s.jsx(Ci,{size:18})})}),s.jsx(a.Portal,{children:s.jsx(Fi,{children:s.jsx(Yi,{minW:"220px",children:n.map(r=>{const o=!!e[r.id];return s.jsx(Bi,{value:r.id,closeOnSelect:!1,children:s.jsxs(a.Checkbox.Root,{checked:o,onCheckedChange:()=>t(r.id),children:[s.jsx(Vi,{}),s.jsx(Hi,{}),s.jsx(Wi,{children:r.label})]})},r.id)})})})})]})}function Gi({id:e,children:t,onClick:n,cursor:r,borderRight:o,backgroundColor:i}){const{columnWidths:c}=Le(ne),l=c[e],u=h.useRef(0),d=h.useRef(0),{setNodeRef:g,attributes:f,listeners:m,transform:p,transition:x}=gr({id:e}),b=R=>{R.stopPropagation(),u.current=R.clientX,d.current=l??150;const M=$=>{ti(e,d.current+($.clientX-u.current))},I=()=>{document.removeEventListener("mousemove",M),document.removeEventListener("mouseup",I)};document.addEventListener("mousemove",M),document.addEventListener("mouseup",I)},[w,_]=h.useState(!1);return s.jsx(a.Table.ColumnHeader,{ref:g,onClick:n,backgroundColor:i,w:l?`${l}px`:void 0,minW:"60px",style:{transform:ke.Transform.toString(p),transition:x,cursor:r,borderRight:o},...f,children:s.jsxs(a.HStack,{position:"relative",onMouseDown:b,children:[s.jsx("span",{...m,children:s.jsx(jr,{size:12,style:{cursor:"grab"}})}),t,s.jsx(a.Box,{position:"absolute",right:0,top:0,h:"100%",w:"10px",cursor:"col-resize",onMouseDown:b,onMouseEnter:()=>_(!0),onMouseLeave:()=>_(!1),display:"flex",alignItems:"center",justifyContent:"center",zIndex:2,children:w&&s.jsx(ui,{size:14,style:{pointerEvents:"none",opacity:.8}})})]})})}function qi(){const{columnOrder:e,visibility:t,sortColumn:n,sortDirection:r,sortableColumns:o,actionsConfig:i}=Le(ne),c=e.map(l=>o.find(u=>u.id===l.id)).filter(l=>l!==void 0).filter(l=>t[l.id]);return s.jsx(a.Table.Header,{background:"blue.200",position:"sticky",top:0,p:"0",zIndex:1,children:s.jsxs(a.Table.Row,{height:"28px",children:[i?.showSNo&&s.jsx(a.Table.ColumnHeader,{width:"20px",textAlign:"center",backgroundColor:i.backgroundColor,borderRight:"2px solid #dcdcdc",children:i.indexChildren||"S.No"}),c.map(l=>{const u=n===l?.id;return s.jsx(Gi,{id:l?.id,onClick:()=>l?.sortable&&Qs(l?.id),borderRight:"2px solid #dcdcdc",backgroundColor:l?.backgroundColor,children:s.jsxs("span",{style:{display:"flex",alignItems:"center",gap:6,userSelect:"none"},children:[l.label,l?.sortable&&(u?r==="asc"?s.jsx(gi,{size:14}):s.jsx(li,{size:14}):s.jsx(fi,{size:14,opacity:.4}))]})},l?.id)}),i?.showActionColumn&&s.jsx(a.Table.ColumnHeader,{width:i.width,backgroundColor:i.backgroundColor,borderRight:"2px solid #dcdcdc",children:i.children||"Actions"}),i?.showColumnVisibilityMenu&&s.jsx(a.Table.ColumnHeader,{boxSize:"0.5",backgroundColor:i.backgroundColorColumnVisibilityMenu,children:s.jsx(Ui,{visibility:t,onToggle:ei})})]})})}const Xi=[10,20,50,100],Ki=y(a.Select.Positioner),Ji=y(a.Select.Content),Zi=y(a.Select.Item),Qi=y(a.Pagination.PrevTrigger),ea=y(a.Pagination.NextTrigger),ta=y(a.Select.HiddenSelect),na=y(a.Select.Control),ra=y(a.Select.Trigger),oa=y(a.Select.ValueText),sa=y(a.Select.IndicatorGroup),ia=y(a.Select.Indicator);function aa({totalCount:e,pageSize:t,currentPage:n,onPageChange:r,onPageSizeChange:o,siblingCount:i=2,pageSizeOptions:c=Xi}){const l=a.createListCollection({items:c.map(u=>({label:String(u),value:String(u)}))});return s.jsx(a.Box,{width:"100%",children:s.jsxs(a.HStack,{justify:"space-between",mx:"auto",flexWrap:"wrap",children:[s.jsxs(a.HStack,{children:[s.jsx(a.Text,{fontSize:"sm",color:"gray.600",_dark:{color:"gray.400"},children:"Rows per page:"}),s.jsxs(a.Select.Root,{collection:l,size:"sm",width:"60px",onValueChange:u=>o?.(Number(u.items[0].value)),value:[String(t)],children:[s.jsx(ta,{}),s.jsxs(na,{children:[s.jsx(ra,{children:s.jsx(oa,{placeholder:""})}),s.jsx(sa,{children:s.jsx(ia,{})})]}),s.jsx(a.Portal,{children:s.jsx(Ki,{children:s.jsx(Ji,{children:l.items.map(u=>s.jsxs(Zi,{item:u.value,children:[u.label,s.jsx(a.Select.ItemIndicator,{})]},u.value))})})})]}),s.jsxs(a.Text,{fontSize:"sm",color:"gray.600",_dark:{color:"gray.400"},children:["of ",e]})]}),s.jsx(a.Pagination.Root,{count:e,pageSize:t,page:n,siblingCount:i,onPageChange:u=>r&&r(u.page),children:s.jsxs(a.ButtonGroup,{size:"sm",variant:"ghost",children:[s.jsx(Qi,{asChild:!0,children:s.jsx(a.IconButton,{"aria-label":"Previous page",children:s.jsx(bi,{size:18})})}),s.jsx(a.Pagination.Items,{render:u=>s.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)}),s.jsx(ea,{asChild:!0,children:s.jsx(a.IconButton,{"aria-label":"Next page",children:s.jsx(Si,{size:18})})})]})})]})})}const la=y(a.Menu.Item),ca=y(a.Menu.Content),ua=y(a.Menu.Positioner),da=y(a.Menu.Trigger);function fa({data:e=[],actions:t=[],actionConfig:n,onRowSelect:r,onRowSelectEvent:o="left",startIndex:i=0}){const{columnOrder:c,visibility:l,columnWidths:u}=Le(ne);return s.jsx(a.Table.Body,{children:e.map((d,g)=>s.jsxs(a.Table.Row,{onClick:()=>o==="left"&&r?.(d.__raw),_hover:{bg:"blue.50"},onContextMenu:o==="right"?f=>{f.preventDefault(),r?.(d.__raw,f)}:void 0,children:[n?.showSNo&&s.jsx(a.Table.Cell,{textAlign:"center",fontWeight:"medium",children:i+g+1}),c.filter(f=>l[f.id]).map(f=>s.jsx(a.Table.Cell,{w:u[f.id]?u[f.id]+"px":void 0,children:d[f.id]},f.id)),n?.showActionColumn&&s.jsx(a.Table.Cell,{textAlign:"center",display:"flex",gap:2,children:s.jsxs(a.Menu.Root,{children:[s.jsx(da,{asChild:!0,children:s.jsx(a.IconButton,{"aria-label":"Open",variant:"ghost",size:"sm",children:s.jsx(Mi,{size:16})})}),s.jsx(ua,{children:s.jsx(ca,{children:t.filter(f=>typeof f.visible=="function"?f.visible(d.__raw):f.visible!==!1).map(f=>s.jsxs(la,{onClick:()=>f.onClick(d.__raw),colorScheme:f.colorScheme,value:f.label,children:[f.icon,f.label]},f.label))})})]})}),n?.showColumnVisibilityMenu&&s.jsx(a.Table.Cell,{})]},d.__key||d.id))})}function ha({rows:e=6,columns:t}){return s.jsx(a.Table.Body,{children:Array.from({length:e}).map((n,r)=>s.jsx(a.Table.Row,{children:Array.from({length:t}).map((o,i)=>s.jsx(a.Table.Cell,{children:s.jsx(a.Skeleton,{height:"25px"})},i))},r))})}function ga({tableId:e,data:t=[],headers:n=[],loading:r=!1,loadingChildren:o,skeletonLoading:i=!1,emptyMessage:c="No data",actions:l,page:u=1,pageSize:d=10,onPageChange:g,onPageSizeChange:f,density:m="sm",totalCount:p=0,actionConfig:x,pageSizeOptions:b,onRowSelect:w,onRowSelectEvent:_="left"}){h.useEffect(()=>{br(e)},[e]),h.useEffect(()=>{xr(t,n)},[t,n]),h.useEffect(()=>{x&&yr(x)},[x]);const{sortColumn:R,sortDirection:M,data:I,columnOrder:$}=Le(ne),O=h.useMemo(()=>{const F=[...I];return R&&F.sort((z,D)=>M==="asc"?String(z[R]).localeCompare(String(D[R])):String(D[R]).localeCompare(String(z[R]))),F},[I,R,M,u,d]),A=h.useMemo(()=>(Math.max(1,u||1)-1)*d,[u,d]);h.useEffect(()=>{u<1&&g&&g(1)},[u,g]);const P=F=>{const{active:z,over:D}=F;if(!D||z.id===D.id)return;const C=$.findIndex(T=>T.id===z.id),S=$.findIndex(T=>T.id===D.id),j=Ct($,C,S);Zs(j)},H=r&&!i,B=i&&!r,k=!r&&!i&&O.length===0;return s.jsx(lr,{collisionDetection:qn,onDragEnd:P,children:s.jsx(fr,{items:$.map(F=>F.id),strategy:Ts,children:s.jsxs(a.Box,{flex:"1",minH:0,display:"flex",flexDirection:"column",p:2,children:[s.jsxs(a.Box,{flex:"1",minH:0,position:"relative",overflow:"auto",children:[H&&s.jsx(a.Box,{position:"absolute",inset:0,display:"flex",alignItems:"center",justifyContent:"center",zIndex:10,bg:"whiteAlpha.600",children:o??s.jsx(a.Spinner,{})}),s.jsxs(a.Table.Root,{variant:"outline",w:"100%",size:m,children:[s.jsx(qi,{}),B?s.jsx(ha,{rows:d,columns:n.length+(l?2:0)}):k?s.jsx(a.Table.Body,{children:s.jsx(a.Table.Row,{children:s.jsx(a.Table.Cell,{colSpan:n.length+(l?1:0),children:s.jsx(a.Box,{display:"flex",alignItems:"center",justifyContent:"center",minH:"200px",color:"gray.500",children:c})})})}):s.jsx(fa,{data:O,actions:l,actionConfig:x,onRowSelect:w,startIndex:A,onRowSelectEvent:_})]})]}),s.jsx(a.Box,{mt:.5,children:s.jsx(aa,{totalCount:p,pageSize:d,currentPage:u,onPageChange:g,onPageSizeChange:F=>{f?.(F),u>1&&g?.(1)},pageSizeOptions:b})})]})})})}const pa=y(a.Checkbox.Root),va=y(a.Checkbox.HiddenInput),ma=y(a.Checkbox.Control),xa=y(a.Checkbox.Label),Tr=({value:e,onChange:t,size:n="sm",label:r,helperText:o,isDisabled:i,required:c,errorText:l})=>s.jsxs(pa,{value:e,onChange:t,size:n,children:[s.jsx(va,{}),s.jsx(ma,{disabled:i,required:c,errorText:l,helperText:o}),r&&s.jsx(xa,{children:r})]}),ba=y(a.Combobox.Root),ya=y(a.Combobox.Control),Sa=y(a.Combobox.Input),wa=y(a.Combobox.IndicatorGroup),Ca=y(a.Combobox.ClearTrigger),Da=y(a.Combobox.Trigger),ja=y(a.Combobox.Positioner),Ra=y(a.Combobox.Content);function Er({label:e,size:t="sm",width:n="100%",variant:r="outline",items:o=[],itemToString:i,itemToValue:c,renderItem:l,value:u,loading:d,error:g,errorMessage:f,placeholder:m,helpText:p,onInputChange:x,onSelect:b,visible:w=!0,rootProps:_,inputProps:R,controlProps:M,contentProps:I,itemProps:$}){const[O,A]=h.useState(""),{collection:P,set:H}=a.useListCollection({initialItems:o,itemToString:i,itemToValue:c}),B=h.useMemo(()=>{if(!O)return o;const k=O.toLowerCase();return o.filter(F=>i(F).toLowerCase().includes(k))},[o,O,i]);return h.useEffect(()=>{H(B)},[B,H]),h.useEffect(()=>{u&&A(i(u))},[u,i]),s.jsxs(ba,{width:n,size:t,variant:r,collection:P,placeholder:m,onInputValueChange:k=>{x?.(k.inputValue),A(k.inputValue)},value:u?[c(u)]:[],onValueChange:k=>{const F=k.value?.[0];if(!F)return;const z=P.items.find(D=>c(D)===F);z&&b?.(z)},positioning:{sameWidth:!1,placement:"bottom-start"},..._,children:[w&&e&&s.jsx(a.Text,{fontSize:"sm",children:e}),s.jsxs(ya,{...M,children:[s.jsx(Sa,{placeholder:m??"Type to search",...R}),s.jsxs(wa,{children:[s.jsx(Ca,{}),s.jsx(Da,{})]})]}),s.jsx(ja,{children:s.jsxs(Ra,{minW:"sm",...I,children:[d?s.jsxs(a.HStack,{p:"2",children:[s.jsx(a.Spinner,{size:"xs",borderWidth:"1px"}),s.jsx(a.Span,{children:"Loading..."})]}):g?s.jsx(a.Text,{p:"2",color:"red.500",fontSize:"sm",children:f||"Something went wrong"}):P.items.map(k=>s.jsxs(a.Combobox.Item,{item:k,...$,children:[l(k),s.jsx(a.Combobox.ItemIndicator,{})]},c(k))),p&&!g&&!d&&s.jsx(a.Text,{p:"2",color:"fg.muted",fontSize:"sm",children:p})]})})]})}const Ma=y(a.Popover.Root),Ta=y(a.Popover.Content),Ea=y(a.Popover.Arrow),_a=y(a.Popover.Trigger),Oa=y(a.Popover.Positioner);function je(e){if(!e)return"";const t=String(e.getDate()).padStart(2,"0"),n=String(e.getMonth()+1).padStart(2,"0"),r=e.getFullYear();return`${t}-${n}-${r}`}function Nn(e){const t=e.split(/\s+to\s+/i),n=t[0],r=t[1],o=l=>{if(!l)return null;const u=l.trim().split("-");if(u.length!==3)return null;const[d,g,f]=u,m=parseInt(d),p=parseInt(g)-1,x=parseInt(f);if(isNaN(m)||isNaN(p)||isNaN(x)||f.length!==4)return null;const b=new Date(x,p,m);return b.getDate()===m&&b.getMonth()===p?b:null},i=o(n),c=o(r);return{start:i,end:c}}function _r({startDate:e,endDate:t,onChange:n,width:r="280px",showLabel:o=!0,label:i="Select date range",visible:c=!0}){const[l,u]=h.useState(!1),[d,g]=h.useState(e||new Date),[f,m]=h.useState(null),[p,x]=h.useState(e||null),[b,w]=h.useState(t||null),_=(F,z)=>F&&z?`${je(F)} to ${je(z)}`:F?`${je(F)}`:"",[R,M]=h.useState(_(e,t));h.useEffect(()=>{x(e||null),w(t||null)},[e,t]);const I=new Date(d.getFullYear(),d.getMonth()+1,0).getDate(),$=new Date(d.getFullYear(),d.getMonth(),1).getDay(),O=()=>{g(new Date(d.getFullYear(),d.getMonth()-1,1))},A=()=>{g(new Date(d.getFullYear(),d.getMonth()+1,1))},P=F=>{const z=new Date(d.getFullYear(),d.getMonth(),F);if(!p||p&&b){x(z),w(null),n(z,null),M(je(z));return}if(p&&!b){const D=z<p?z:p,C=z<p?p:z;x(D),w(C),n(D,C),M(`${je(D)} to ${je(C)}`),u(!1)}},H=F=>{const z=F.target.value;M(z);const{start:D,end:C}=Nn(z);if(D&&C){const S=D<C?D:C,j=D<C?C:D;n(S,j),g(S)}else D&&!z.toLowerCase().includes("to")&&n(D,null)},B=F=>{if(F.key!=="Enter")return;const{start:z,end:D}=Nn(R);if(z&&!D&&!R.toLowerCase().includes("to")){const C=`${je(z)} to `;M(C),x(z),w(null),n(z,null),requestAnimationFrame(()=>{F.target.setSelectionRange(C.length,C.length)});return}if(z&&D){const C=z<D?z:D,S=z<D?D:z;x(C),w(S),n(C,S),u(!1)}},k=()=>{x(null),w(null),M(""),n(null,null)};return s.jsxs(a.Box,{width:r,onKeyDown:B,children:[o&&!c&&s.jsx(a.Text,{fontSize:"xs",color:"fg.muted",mb:1,fontWeight:"medium",children:i}),s.jsxs(Ma,{open:l,onOpenChange:F=>u(F.open),positioning:{placement:"bottom-start",gutter:4},children:[s.jsxs(a.Group,{attached:!0,w:"full",position:"relative",children:[s.jsx(a.Input,{placeholder:"DD-MM-YYYY to DD-MM-YYYY",value:R,onChange:H,size:"sm",autoComplete:"off"}),R&&s.jsx(a.IconButton,{size:"xs",variant:"ghost","aria-label":"Clear date",onClick:k,position:"absolute",right:"32px",top:"50%",transform:"translateY(-50%)",children:s.jsx(Mr,{size:14})}),s.jsx(_a,{asChild:!0,children:s.jsx(a.InputAddon,{cursor:"pointer",px:2,_hover:{bg:"gray.100"},transition:"background 0.2s",children:s.jsx(Dr,{size:16})})})]}),s.jsx(Oa,{children:s.jsxs(Ta,{width:"300px",p:4,boxShadow:"xl",zIndex:1e3,borderRadius:"md",outline:"none",children:[s.jsx(Ea,{}),s.jsxs(a.HStack,{justify:"space-between",mb:4,children:[s.jsx(a.IconButton,{size:"xs",variant:"ghost",onClick:O,"aria-label":"Previous month",children:"‹"}),s.jsx(a.Text,{fontWeight:"bold",fontSize:"sm",children:d.toLocaleString("default",{month:"long",year:"numeric"})}),s.jsx(a.IconButton,{size:"xs",variant:"ghost",onClick:A,"aria-label":"Next month",children:"›"})]}),s.jsxs(a.Grid,{templateColumns:"repeat(7, 1fr)",gap:1,textAlign:"center",children:[["S","M","T","W","T","F","S"].map((F,z)=>s.jsx(a.Text,{fontSize:"xs",fontWeight:"bold",color:"fg.subtle",py:1,children:F},`${F}-${z}`)),Array($).fill(null).map((F,z)=>s.jsx(a.Box,{},`empty-${z}`)),Array.from({length:I},(F,z)=>{const D=z+1,C=new Date(d.getFullYear(),d.getMonth(),D);let S=e,j=t;if(S&&j&&f)if(e&&t){const W=e.getTime()+(t.getTime()-e.getTime())/2;f.getTime()<=W?S=f:j=f,S>j&&([S,j]=[j,S])}else e&&!t&&(S=f<e?f:e,j=f<e?e:f);const T=S&&C.getTime()===S.getTime(),L=j&&C.getTime()===j.getTime(),Y=S&&j&&C>S&&C<j;let v="transparent",E="gray";T||L?E="blue":Y&&(v="blue.100");let N="md";return Y&&(N="0"),T&&j&&(N=L?"md":"md 0 0 md"),L&&S&&(N=T?"md":"0 md md 0"),s.jsx(a.Button,{size:"xs",variant:"ghost",colorPalette:E,bg:v!=="transparent"?v:void 0,onClick:()=>P(D),onMouseEnter:()=>m(C),onMouseLeave:()=>m(null),minW:"32px",h:"32px",fontSize:"xs",borderRadius:N,_hover:{bg:T||L?void 0:"gray.100"},children:D},D)})]}),s.jsx(a.Text,{fontSize:"10px",color:"fg.muted",mt:3,textAlign:"center",children:"Select Start Date then End Date"})]})})]})]})}const ka=y(a.Popover.Root),Ia=y(a.Popover.Content),$a=y(a.Popover.Arrow),Aa=y(a.Popover.Trigger),La=y(a.Popover.Positioner);function Fn(e){if(!e)return"";const t=String(e.getDate()).padStart(2,"0"),n=String(e.getMonth()+1).padStart(2,"0"),r=e.getFullYear();return`${t}-${n}-${r}`}function Pa(e){const t=e.split("-");if(t.length!==3)return null;const[n,r,o]=t,i=parseInt(n),c=parseInt(r)-1,l=parseInt(o);if(isNaN(i)||isNaN(c)||isNaN(l)||o.length!==4)return null;const u=new Date(l,c,i);return u.getDate()===i&&u.getMonth()===c?u:null}function Or({value:e,onChange:t,width:n="220px",visible:r=!0,label:o="Select date"}){const[i,c]=h.useState(!1),[l,u]=h.useState(e||new Date),[d,g]=h.useState(Fn(e));h.useEffect(()=>{g(Fn(e))},[e]);const f=new Date(l.getFullYear(),l.getMonth()+1,0).getDate(),m=new Date(l.getFullYear(),l.getMonth(),1).getDay(),p=()=>{u(new Date(l.getFullYear(),l.getMonth()-1,1))},x=()=>{u(new Date(l.getFullYear(),l.getMonth()+1,1))},b=R=>{const M=new Date(l.getFullYear(),l.getMonth(),R);t(M),c(!1)},w=R=>{if(i)switch(R.key){case"ArrowLeft":p();break;case"ArrowRight":x();break;case"Escape":c(!1);break}},_=()=>{g(""),t(null)};return s.jsxs(a.Box,{width:n,onKeyDown:w,children:[!r&&s.jsx(a.Text,{fontSize:"xs",color:"fg.muted",mb:1,fontWeight:"medium",children:o}),s.jsxs(ka,{open:i,onOpenChange:R=>c(R.open),positioning:{placement:"bottom-start",gutter:4},children:[s.jsxs(a.Group,{attached:!0,w:"full",position:"relative",children:[d&&s.jsx(a.IconButton,{size:"xs",variant:"ghost","aria-label":"Clear date",onClick:_,position:"absolute",right:"32px",top:"50%",transform:"translateY(-50%)",zIndex:1,children:s.jsx(Mr,{size:14})}),s.jsx(a.Input,{placeholder:"DD-MM-YYYY",value:d,onChange:R=>{const M=R.target.value;g(M);const I=Pa(M);I&&(t(I),u(I))},size:"sm",autoComplete:"off"}),s.jsx(Aa,{asChild:!0,children:s.jsx(a.InputAddon,{cursor:"pointer",px:2,_hover:{bg:"gray.100"},transition:"background 0.2s",children:s.jsx(Dr,{size:16})})})]}),s.jsx(La,{children:s.jsxs(Ia,{width:"300px",p:4,boxShadow:"xl",zIndex:1e3,borderRadius:"md",outline:"none",children:[s.jsx($a,{}),s.jsxs(a.HStack,{justify:"space-between",mb:4,children:[s.jsx(a.IconButton,{size:"xs",variant:"ghost",onClick:p,"aria-label":"Previous month",children:"‹"}),s.jsx(a.Text,{fontWeight:"bold",fontSize:"sm",children:l.toLocaleString("default",{month:"long",year:"numeric"})}),s.jsx(a.IconButton,{size:"xs",variant:"ghost",onClick:x,"aria-label":"Next month",children:"›"})]}),s.jsxs(a.Grid,{templateColumns:"repeat(7, 1fr)",gap:1,textAlign:"center",children:[["S","M","T","W","T","F","S"].map((R,M)=>s.jsx(a.Text,{fontSize:"xs",fontWeight:"bold",color:"fg.subtle",py:1,children:R},`${R}-${M}`)),Array(m).fill(null).map((R,M)=>s.jsx(a.Box,{},`empty-${M}`)),Array.from({length:f},(R,M)=>{const I=M+1,$=e&&e.getDate()===I&&e.getMonth()===l.getMonth()&&e.getFullYear()===l.getFullYear();return s.jsx(a.Button,{size:"xs",variant:$?"solid":"ghost",colorPalette:$?"blue":"gray",onClick:()=>b(I),minW:"32px",h:"32px",fontSize:"xs",borderRadius:"md",children:I},I)})]}),s.jsx(a.Text,{fontSize:"10px",color:"fg.muted",mt:3,textAlign:"center",children:"Use Arrow Keys to change months • Esc to close"})]})})]})]})}const za=y(a.Field.Root),Na=y(a.Field.Label),Fa=y(a.Field.HelperText),Ya=y(a.Field.ErrorText),Gt=({icon:e,value:t,onChange:n,placeholder:r,size:o="xs",variant:i="outline",width:c="100%",label:l,helperText:u,isDisabled:d=!1,required:g=!1,errorText:f,visible:m,type:p="text",min:x=0,max:b=100,step:w=1})=>s.jsxs(za,{width:c,children:[m&&s.jsx(Na,{children:l}),s.jsx(a.InputGroup,{startElement:e,children:s.jsx(a.Input,{value:t,onChange:_=>n?.(_.target.value),placeholder:r,size:o,type:p,variant:i,disabled:d,required:g,min:x,max:b,step:w})}),f&&s.jsx(Ya,{fontSize:"xs",children:f}),u&&s.jsx(Fa,{fontSize:"xs",children:u})]}),Ba=y(a.Field.Root),Wa=y(a.Field.HelperText),Va=y(a.Field.ErrorText),Ha=y(a.Select.Root),Ua=y(a.Select.Label),Ga=y(a.Select.Control),qa=y(a.Select.Trigger),Xa=y(a.Select.ValueText),Ka=y(a.Select.IndicatorGroup),Ja=y(a.Select.Indicator),Za=y(a.Select.Content),Qa=y(a.Select.Item),el=y(a.Select.ItemIndicator),tl=y(a.Select.HiddenSelect),nl=y(a.Select.Positioner),kr=({options:e=[],label:t,value:n,onChange:r,placeholder:o,size:i="xs",width:c="100%",variant:l="outline",helperText:u,isDisabled:d,required:g,errorText:f,visible:m})=>{const p=a.createListCollection({items:e});return s.jsxs(Ba,{disabled:d,required:g,children:[s.jsxs(Ha,{collection:p,variant:l,size:i,width:c,value:n?[n]:[],onValueChange:x=>r?.(x.value[0]),children:[s.jsx(tl,{}),m&&s.jsx(Ua,{children:t}),s.jsxs(Ga,{children:[s.jsx(qa,{children:s.jsx(Xa,{placeholder:o})}),s.jsx(Ka,{children:s.jsx(Ja,{})})]}),s.jsx(nl,{children:s.jsx(Za,{children:p.items.map(x=>s.jsxs(Qa,{item:x,children:[x.label,s.jsx(el,{})]},x.value))})})]}),u&&s.jsx(Wa,{children:u}),f&&s.jsx(Va,{children:f})]})},Ir=(e="default")=>`FILTER_PRESETS_${e}`,rl=e=>{if(!e)return[];try{return JSON.parse(e)}catch{return[]}},ol=e=>typeof window>"u"?[]:rl(localStorage.getItem(Ir(e))),Xe=new mr({}),Qe=e=>{const t=Xe.state;if(e in t)return t[e];const n=ol(e);return Xe.setState(r=>({...r,[e]:n})),n},jt=(e,t)=>{Xe.setState(n=>({...n,[e]:t})),typeof window<"u"&&localStorage.setItem(Ir(e),JSON.stringify(t))},$r=(e,t)=>{const n=[t,...Qe(e)];jt(e,n)},Ar=(e,t)=>{const n=Qe(e).filter(r=>r.id!==t);jt(e,n)},sl=(e,t,n)=>{const r=Qe(e).map(o=>o.id===t?n(o):o);jt(e,r)},il=y(a.Checkbox.Root),al=y(a.Checkbox.HiddenInput),ll=y(a.Checkbox.Control),cl=y(a.Slider.Root),ul=y(a.Slider.Track),dl=y(a.Slider.Range),fl=y(a.Slider.Thumbs),hl=y(a.Slider.Control),gl=({filter:e,onVisibilityChange:t,onSizeChange:n})=>{const{attributes:r,listeners:o,setNodeRef:i,transform:c,transition:l}=gr({id:e.id}),u={transform:ke.Transform.toString(c),transition:l};return s.jsxs(a.VStack,{ref:i,style:u,align:"stretch",border:"1px solid",borderColor:"gray.200",rounded:"md",p:3,mb:3,bg:"white",children:[s.jsxs(a.HStack,{...r,...o,cursor:"grab",userSelect:"none",gap:2,children:[s.jsx(jr,{size:16}),s.jsx(a.Text,{fontWeight:"bold",fontSize:"sm",children:e.label||e.id})]}),s.jsxs(a.HStack,{justify:"space-between",children:[s.jsx(a.Text,{fontSize:"sm",children:"Visible"}),s.jsxs(il,{checked:e.visible,size:"sm",onCheckedChange:d=>t?.(e.id,!!d.checked),children:[s.jsx(al,{}),s.jsx(ll,{})]})]}),s.jsxs(a.VStack,{align:"stretch",gap:1,children:[s.jsx(a.Text,{fontSize:"sm",children:"Size"}),s.jsx(cl,{min:1,max:5,step:.5,value:[e.size??1],onValueChange:d=>n?.(e.id,d.value[0]),children:s.jsxs(hl,{children:[s.jsx(ul,{children:s.jsx(dl,{})}),s.jsx(fl,{})]})})]})]})},pl=y(a.Drawer.Root),vl=y(a.Drawer.Trigger),ml=y(a.Drawer.Backdrop),xl=y(a.Drawer.Positioner),bl=y(a.Drawer.Content),yl=y(a.Drawer.Header),Sl=y(a.Drawer.Title),wl=y(a.Drawer.Body),Cl=y(a.Drawer.Footer),Dl=y(a.Drawer.CloseTrigger),jl=y(a.Tabs.Root),Rl=y(a.Tabs.List),Nt=y(a.Tabs.Trigger),Ft=y(a.Tabs.Content),Lr=(e,t)=>{if(e.customComponent)return e.customComponent;switch(console.log(e.type),e.type){case"text":return s.jsx(Gt,{placeholder:e.label,value:e.value,onChange:e.onChange,label:e.label,visible:t});case"number":return s.jsx(Gt,{label:e.label,value:e.value,onChange:e.onChange});case"checkbox":return s.jsx(Tr,{label:e.label,value:e.value,onChange:e.onChange});case"select":return s.jsx(kr,{label:e.label,value:e.value,onChange:e.onChange,options:e.options??[],visible:t,placeholder:e.placeholder});case"date":return s.jsx(Or,{value:e.value,onChange:e.onChange,visible:t,label:e.label});case"date-range":return s.jsx(_r,{startDate:e.startDate?new Date(e.startDate):void 0,endDate:e.endDate?new Date(e.endDate):void 0,onChange:e.onChange,visible:t,label:e.label});case"combobox":return s.jsx(Er,{visible:!0,label:e.label,items:e.options,itemToString:n=>n.label,itemToValue:n=>n.value,renderItem:n=>s.jsx("span",{children:n.label})});default:return null}},Ml=({filterDrawerSize:e="sm",onVisibilityChange:t,onSizeChange:n,onClear:r,filters:o,pageKey:i="default",onLoadPreset:c,activePresetName:l,onReorder:u,open:d,onOpenChange:g})=>{const m=Le(Xe)[i]??Qe(i),p=()=>{const x=prompt("Preset name?");if(!x)return;const b=o.reduce((w,_)=>(w[_.id]=_.value,w),{});$r(i,{id:crypto.randomUUID(),name:x,date:new Date().toISOString(),values:b})};return s.jsx(a.HStack,{wrap:"wrap",children:s.jsxs(pl,{size:e,open:d,onOpenChange:g,children:[s.jsx(vl,{asChild:!0,children:s.jsxs(a.IconButton,{"aria-label":"Open filters",variant:"outline",size:"xs",ml:2,p:2,children:[s.jsx(Ei,{size:16}),"Filters"]})}),s.jsxs(a.Portal,{children:[s.jsx(ml,{}),s.jsx(xl,{children:s.jsxs(bl,{children:[s.jsx(yl,{children:s.jsx(Sl,{children:"Filters"})}),s.jsx(wl,{overflowY:"auto",pt:1,children:s.jsxs(jl,{defaultValue:"view",children:[s.jsxs(Rl,{mb:4,children:[s.jsxs(Nt,{value:"view",children:[s.jsx(ki,{size:16}),"Edit"]}),s.jsxs(Nt,{value:"settings",children:[s.jsx(Li,{size:16}),"Settings"]}),s.jsxs(Nt,{value:"presets",children:[s.jsx(vi,{size:16}),"Presets"]})]}),s.jsx(Ft,{value:"view",children:o.filter(x=>x.visible).map(x=>s.jsx(a.VStack,{align:"stretch",border:"1px solid",borderColor:"gray.200",flex:x.size??1,minW:`${(x.size??1)*100}px`,rounded:"md",p:3,mb:3,children:Lr(x,d)},x.id))}),s.jsx(Ft,{value:"settings",children:s.jsx(lr,{sensors:po(go(on)),collisionDetection:qn,onDragEnd:({active:x,over:b})=>{if(!b||x.id===b.id)return;const w=o.findIndex(M=>M.id===x.id),_=o.findIndex(M=>M.id===b.id),R=Ct(o,w,_);u?.(R)},children:s.jsx(fr,{items:o.map(x=>x.id),strategy:_s,children:o.map(x=>s.jsx(gl,{filter:x,onVisibilityChange:t,onSizeChange:n},x.id))})})}),s.jsx(Ft,{value:"presets",children:s.jsxs(a.VStack,{align:"stretch",mb:3,children:[m.length===0&&s.jsx(a.Text,{fontSize:"xs",color:"gray.500",children:"No presets saved yet."}),m.map(x=>s.jsxs(a.HStack,{justify:"space-between",border:"1px solid",borderColor:l===x.name?"blue.300":"gray.200",rounded:"md",p:2,children:[s.jsxs(a.VStack,{align:"start",gap:0,children:[s.jsx(a.Text,{fontWeight:"bold",fontSize:"sm",children:x.name}),s.jsx(a.Text,{fontSize:"xs",color:"gray.500",children:new Date(x.date).toLocaleDateString()})]}),s.jsxs(a.HStack,{children:[s.jsx(a.Button,{size:"xs",variant:"ghost",onClick:()=>{const b=o.map(w=>({...w,value:x.values[w.id]??w.value}));c?.(b,x.name)},children:"Load"}),s.jsx(a.IconButton,{size:"xs","aria-label":"Delete preset",variant:"ghost",onClick:()=>Ar(i,x.id),children:s.jsx(ji,{size:14})})]})]},x.id)),s.jsx(a.Button,{size:"sm",colorScheme:"blue",onClick:p,children:"Save Current Filters"})]})})]})}),s.jsx(Cl,{justify:"space-between",children:s.jsx(Dl,{asChild:!0,children:s.jsx(a.CloseButton,{})})})]})})]})]})})},Tl=({title:e,filters:t,onVisibilityChange:n,onReorder:r,onSizeChange:o,onClear:i,maxToolbarUnits:c,pageKey:l,onLoadPreset:u,activePresetName:d,filterDrawerSize:g="sm"})=>{const[f,m]=h.useState(!1);return s.jsxs(a.HStack,{wrap:"wrap",pl:2,pr:2,width:"100%",justify:"space-between",children:[e,s.jsxs(a.HStack,{gapX:1,children:[t.filter(p=>p.visible!==!1).map(p=>s.jsx(a.HStack,{flex:p.size??1,minW:`${(p.size??1)*100}px`,alignItems:"center",children:Lr(p)},p.id)),s.jsx(Ml,{filterDrawerSize:g,onVisibilityChange:n,onReorder:r,onSizeChange:o,onClear:i,maxToolbarUnits:c,pageKey:l,filters:t,onLoadPreset:u,activePresetName:d,open:f,onOpenChange:p=>{m(p.open)}})]})]})},El=(e,t)=>{localStorage.setItem(`FILTER_ORDER_${e}`,JSON.stringify(t))},_l=e=>{try{return JSON.parse(localStorage.getItem(`FILTER_ORDER_${e}`)||"[]")}catch{return[]}},Ol=({onClick:e,size:t="xs",variant:n="solid",label:r,leftIcon:o,rightIcon:i,isDisabled:c,colorScheme:l,loading:u,loadingText:d,rounded:g,type:f="button",textColor:m="white",borderColor:p})=>s.jsx(a.Button,{onClick:e,size:t,variant:n,disabled:c,loading:u,loadingText:d,rounded:g,type:f,background:l,color:m,border:p,children:s.jsxs(a.HStack,{gap:1,children:[o,r,i]})}),kl=y(a.Dialog.Root),Il=y(a.Dialog.Backdrop),$l=y(a.Dialog.Positioner),Al=y(a.Dialog.Content),Ll=y(a.Dialog.Header),Pl=y(a.Dialog.Body),zl=y(a.Dialog.Footer),Nl=y(a.Dialog.Title),Fl=y(a.Dialog.CloseTrigger);function Yl({open:e,onClose:t,onConfirm:n,title:r="Confirm Action",description:o="Are you sure you want to continue?",confirmLabel:i="Confirm",cancelLabel:c="Cancel",icon:l,isLoading:u=!1,confirmButtonColorScheme:d="#4169e1"}){return s.jsx(kl,{open:e,placement:"center",onOpenChange:g=>!g.open&&t(),children:s.jsxs(a.Portal,{children:[s.jsx(Il,{}),s.jsx($l,{children:s.jsxs(Al,{maxW:"480px",children:[s.jsx(Ll,{borderBottom:"1px solid",borderColor:"gray.200",children:s.jsx(Nl,{children:r})}),s.jsx(Pl,{p:6,children:s.jsxs(a.Stack,{gap:4,align:"center",textAlign:"center",children:[s.jsx(a.Box,{color:"orange.500",children:l??s.jsx(Rr,{size:40})}),s.jsx(a.Text,{fontSize:"sm",color:"gray.600",children:o})]})}),s.jsxs(zl,{justifyContent:"flex-end",gap:2,borderTop:"1px solid",borderColor:"gray.200",children:[s.jsx(a.Button,{variant:"outline",size:"sm",onClick:t,children:c}),s.jsx(a.Button,{size:"sm",style:{backgroundColor:d},loading:u,onClick:n,children:i})]}),s.jsx(Fl,{asChild:!0,children:s.jsx(a.CloseButton,{size:"sm"})})]})})]})})}const Bl=y(a.Dialog.Root),Wl=y(a.Dialog.Backdrop),Vl=y(a.Dialog.Positioner),Hl=y(a.Dialog.Content),Ul=y(a.Dialog.Header),Gl=y(a.Dialog.Body),ql=y(a.Dialog.Footer),Xl=y(a.Dialog.Title),Kl=y(a.Dialog.CloseTrigger);function Jl({open:e,onClose:t,onConfirm:n,title:r="Delete Company",entityName:o,confirmText:i="DELETE",confirmLabel:c="Delete",isLoading:l=!1}){const[u,d]=h.useState(""),g=u===i;return s.jsx(Bl,{open:e,placement:"center",onOpenChange:f=>{!f.open&&t(),d("")},children:s.jsxs(a.Portal,{children:[s.jsx(Wl,{}),s.jsx(Vl,{children:s.jsxs(Hl,{maxW:"550px",children:[s.jsx(Ul,{borderBottom:"1px solid",borderColor:"#d3d3d3",children:s.jsx(Xl,{color:"red.600",children:r})}),s.jsx(Gl,{p:2,style:{padding:"16px"},children:s.jsxs(a.Stack,{gap:4,borderRadius:"md",p:4,bg:"white",children:[s.jsx(a.Box,{border:"1px solid",borderColor:"red.200",bg:"red.50",borderRadius:"md",p:4,children:s.jsxs(a.Stack,{direction:"row",gap:3,align:"flex-start",children:[s.jsx(a.Box,{color:"red.600",mt:"2px",children:s.jsx(Rr,{size:20})}),s.jsxs(a.Box,{children:[s.jsx(a.Text,{fontWeight:"semibold",color:"red.700",children:"Are you sure?"}),s.jsxs(a.Text,{fontSize:"sm",color:"red.600",children:["All the data of ",s.jsx("b",{children:o})," will permanently be deleted."]})]})]})}),s.jsx(a.Text,{fontSize:"sm",color:"gray.600",children:"You can’t undo this action afterwards."}),s.jsxs(a.Box,{children:[s.jsxs(a.Text,{fontSize:"sm",mb:2,children:["Type ",s.jsx("b",{children:i})," to continue"]}),s.jsx(a.Input,{placeholder:`Type ${i} here`,value:u,onChange:f=>d(f.target.value),size:"xs"})]})]})}),s.jsxs(ql,{justifyContent:"flex-end",gap:2,borderTop:"1px solid",borderColor:"#d3d3d3",children:[s.jsx(a.Button,{variant:"outline",size:"sm",onClick:()=>{t(),d("")},children:"Cancel"}),s.jsx(a.Button,{size:"sm",disabled:!g,style:{backgroundColor:"#FF0000"},loading:l,onClick:n,children:c})]}),s.jsx(Kl,{asChild:!0,children:s.jsx(a.CloseButton,{size:"sm"})})]})})]})})}const Pr=({children:e})=>s.jsx(s.Fragment,{children:e}),zr=({children:e})=>s.jsx(s.Fragment,{children:e}),Zl=a.Button,Ql=y(a.Dialog.Root),ec=y(a.Dialog.Backdrop),tc=y(a.Dialog.Positioner),nc=y(a.Dialog.Content),rc=y(a.Dialog.Header),oc=y(a.Dialog.Body),sc=y(a.Dialog.Footer),ic=y(a.Dialog.Title),ac=y(a.Dialog.CloseTrigger);function lc(e){let t=null,n=null;return h.Children.forEach(e,r=>{h.isValidElement(r)&&(r.type===Pr&&(t=r.props.children),r.type===zr&&(n=r.props.children))}),{body:t,actions:n}}const cc=({open:e,onClose:t,title:n,children:r,width:o,position:i,refetch:c,loading:l=!1})=>{const{body:u,actions:d}=lc(r);return s.jsx(Ql,{open:e,onOpenChange:g=>!g.open&&t(),placement:i??"center",children:s.jsxs(a.Portal,{children:[s.jsx(ec,{bg:"blackAlpha.400"}),s.jsx(tc,{children:s.jsxs(nc,{w:o??"560px",maxW:o??"560px",borderRadius:"6px",overflow:"hidden",boxShadow:"lg",children:[s.jsx(rc,{px:"20px",py:"16px",bg:"white",borderBottom:"1px solid",borderColor:"gray.200",children:s.jsxs(a.Flex,{align:"center",justify:"space-between",children:[s.jsx(ic,{fontSize:"16px",fontWeight:"600",children:n}),s.jsx(ac,{asChild:!0,children:s.jsx(a.CloseButton,{size:"sm"})}),c&&s.jsx(sn,{label:"Refresh",refetch:c,isLoading:l})]})}),u&&s.jsx(oc,{px:"20px",py:"16px",bg:"#F8FAFC",type:"submit",children:s.jsx(a.Flex,{direction:"column",gap:"16px",children:u})}),d&&s.jsx(sc,{px:"20px",py:"16px",bg:"white",borderTop:"1px solid",borderColor:"gray.200",children:s.jsx(a.Flex,{ml:"auto",gap:"12px",children:d})})]})})]})})},uc=y(a.Field.Root),dc=y(a.Field.Label),fc=y(a.Field.HelperText),hc=y(a.Field.ErrorText),gc=y(a.PinInput.Input),pc=y(a.PinInput.Control),vc=y(a.PinInput.HiddenInput),mc=y(a.PinInput.Root),xc=({value:e,onChange:t,length:n=4,size:r="xs",isDisabled:o=!1,label:i,helperText:c,errorText:l,required:u=!1,visible:d=!0})=>{const g=Array.from({length:n}).map((f,m)=>e?.[m]??"");return s.jsxs(uc,{children:[d&&i&&s.jsxs(dc,{children:[i,u&&" *"]}),s.jsxs(mc,{value:g,onValueChange:f=>t?.(f.value.join("")),disabled:o,size:r,children:[s.jsx(vc,{}),s.jsx(pc,{children:s.jsx(a.HStack,{children:Array.from({length:n}).map((f,m)=>s.jsx(gc,{index:m},m))})})]}),l&&s.jsx(hc,{fontSize:"xs",children:l}),c&&!l&&s.jsx(fc,{fontSize:"xs",children:c})]})};function sn({refetch:e,isLoading:t=!1,label:n="Refresh"}){const[r,o]=h.useState(!1),i=async()=>{o(!0);try{await e()}finally{setTimeout(()=>o(!1),300)}};return s.jsx(a.IconButton,{"aria-label":n,size:"xs",variant:"outline",disabled:t||r,onClick:i,ml:2,children:s.jsx($i,{size:14,style:{animation:r?"spin 0.6s linear infinite":void 0}})})}var ut={exports:{}},bc=ut.exports,Yn;function yc(){return Yn||(Yn=1,(function(e,t){(function(n,r){e.exports=r()})(bc,(function(){var n=1e3,r=6e4,o=36e5,i="millisecond",c="second",l="minute",u="hour",d="day",g="week",f="month",m="quarter",p="year",x="date",b="Invalid Date",w=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,_=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,R={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(D){var C=["th","st","nd","rd"],S=D%100;return"["+D+(C[(S-20)%10]||C[S]||C[0])+"]"}},M=function(D,C,S){var j=String(D);return!j||j.length>=C?D:""+Array(C+1-j.length).join(S)+D},I={s:M,z:function(D){var C=-D.utcOffset(),S=Math.abs(C),j=Math.floor(S/60),T=S%60;return(C<=0?"+":"-")+M(j,2,"0")+":"+M(T,2,"0")},m:function D(C,S){if(C.date()<S.date())return-D(S,C);var j=12*(S.year()-C.year())+(S.month()-C.month()),T=C.clone().add(j,f),L=S-T<0,Y=C.clone().add(j+(L?-1:1),f);return+(-(j+(S-T)/(L?T-Y:Y-T))||0)},a:function(D){return D<0?Math.ceil(D)||0:Math.floor(D)},p:function(D){return{M:f,y:p,w:g,d,D:x,h:u,m:l,s:c,ms:i,Q:m}[D]||String(D||"").toLowerCase().replace(/s$/,"")},u:function(D){return D===void 0}},$="en",O={};O[$]=R;var A="$isDayjsObject",P=function(D){return D instanceof F||!(!D||!D[A])},H=function D(C,S,j){var T;if(!C)return $;if(typeof C=="string"){var L=C.toLowerCase();O[L]&&(T=L),S&&(O[L]=S,T=L);var Y=C.split("-");if(!T&&Y.length>1)return D(Y[0])}else{var v=C.name;O[v]=C,T=v}return!j&&T&&($=T),T||!j&&$},B=function(D,C){if(P(D))return D.clone();var S=typeof C=="object"?C:{};return S.date=D,S.args=arguments,new F(S)},k=I;k.l=H,k.i=P,k.w=function(D,C){return B(D,{locale:C.$L,utc:C.$u,x:C.$x,$offset:C.$offset})};var F=(function(){function D(S){this.$L=H(S.locale,null,!0),this.parse(S),this.$x=this.$x||S.x||{},this[A]=!0}var C=D.prototype;return C.parse=function(S){this.$d=(function(j){var T=j.date,L=j.utc;if(T===null)return new Date(NaN);if(k.u(T))return new Date;if(T instanceof Date)return new Date(T);if(typeof T=="string"&&!/Z$/i.test(T)){var Y=T.match(w);if(Y){var v=Y[2]-1||0,E=(Y[7]||"0").substring(0,3);return L?new Date(Date.UTC(Y[1],v,Y[3]||1,Y[4]||0,Y[5]||0,Y[6]||0,E)):new Date(Y[1],v,Y[3]||1,Y[4]||0,Y[5]||0,Y[6]||0,E)}}return new Date(T)})(S),this.init()},C.init=function(){var S=this.$d;this.$y=S.getFullYear(),this.$M=S.getMonth(),this.$D=S.getDate(),this.$W=S.getDay(),this.$H=S.getHours(),this.$m=S.getMinutes(),this.$s=S.getSeconds(),this.$ms=S.getMilliseconds()},C.$utils=function(){return k},C.isValid=function(){return this.$d.toString()!==b},C.isSame=function(S,j){var T=B(S);return this.startOf(j)<=T&&T<=this.endOf(j)},C.isAfter=function(S,j){return B(S)<this.startOf(j)},C.isBefore=function(S,j){return this.endOf(j)<B(S)},C.$g=function(S,j,T){return k.u(S)?this[j]:this.set(T,S)},C.unix=function(){return Math.floor(this.valueOf()/1e3)},C.valueOf=function(){return this.$d.getTime()},C.startOf=function(S,j){var T=this,L=!!k.u(j)||j,Y=k.p(S),v=function(J,V){var se=k.w(T.$u?Date.UTC(T.$y,V,J):new Date(T.$y,V,J),T);return L?se:se.endOf(d)},E=function(J,V){return k.w(T.toDate()[J].apply(T.toDate("s"),(L?[0,0,0,0]:[23,59,59,999]).slice(V)),T)},N=this.$W,W=this.$M,q=this.$D,X="set"+(this.$u?"UTC":"");switch(Y){case p:return L?v(1,0):v(31,11);case f:return L?v(1,W):v(0,W+1);case g:var U=this.$locale().weekStart||0,K=(N<U?N+7:N)-U;return v(L?q-K:q+(6-K),W);case d:case x:return E(X+"Hours",0);case u:return E(X+"Minutes",1);case l:return E(X+"Seconds",2);case c:return E(X+"Milliseconds",3);default:return this.clone()}},C.endOf=function(S){return this.startOf(S,!1)},C.$set=function(S,j){var T,L=k.p(S),Y="set"+(this.$u?"UTC":""),v=(T={},T[d]=Y+"Date",T[x]=Y+"Date",T[f]=Y+"Month",T[p]=Y+"FullYear",T[u]=Y+"Hours",T[l]=Y+"Minutes",T[c]=Y+"Seconds",T[i]=Y+"Milliseconds",T)[L],E=L===d?this.$D+(j-this.$W):j;if(L===f||L===p){var N=this.clone().set(x,1);N.$d[v](E),N.init(),this.$d=N.set(x,Math.min(this.$D,N.daysInMonth())).$d}else v&&this.$d[v](E);return this.init(),this},C.set=function(S,j){return this.clone().$set(S,j)},C.get=function(S){return this[k.p(S)]()},C.add=function(S,j){var T,L=this;S=Number(S);var Y=k.p(j),v=function(W){var q=B(L);return k.w(q.date(q.date()+Math.round(W*S)),L)};if(Y===f)return this.set(f,this.$M+S);if(Y===p)return this.set(p,this.$y+S);if(Y===d)return v(1);if(Y===g)return v(7);var E=(T={},T[l]=r,T[u]=o,T[c]=n,T)[Y]||1,N=this.$d.getTime()+S*E;return k.w(N,this)},C.subtract=function(S,j){return this.add(-1*S,j)},C.format=function(S){var j=this,T=this.$locale();if(!this.isValid())return T.invalidDate||b;var L=S||"YYYY-MM-DDTHH:mm:ssZ",Y=k.z(this),v=this.$H,E=this.$m,N=this.$M,W=T.weekdays,q=T.months,X=T.meridiem,U=function(V,se,re,fe){return V&&(V[se]||V(j,L))||re[se].slice(0,fe)},K=function(V){return k.s(v%12||12,V,"0")},J=X||function(V,se,re){var fe=V<12?"AM":"PM";return re?fe.toLowerCase():fe};return L.replace(_,(function(V,se){return se||(function(re){switch(re){case"YY":return String(j.$y).slice(-2);case"YYYY":return k.s(j.$y,4,"0");case"M":return N+1;case"MM":return k.s(N+1,2,"0");case"MMM":return U(T.monthsShort,N,q,3);case"MMMM":return U(q,N);case"D":return j.$D;case"DD":return k.s(j.$D,2,"0");case"d":return String(j.$W);case"dd":return U(T.weekdaysMin,j.$W,W,2);case"ddd":return U(T.weekdaysShort,j.$W,W,3);case"dddd":return W[j.$W];case"H":return String(v);case"HH":return k.s(v,2,"0");case"h":return K(1);case"hh":return K(2);case"a":return J(v,E,!0);case"A":return J(v,E,!1);case"m":return String(E);case"mm":return k.s(E,2,"0");case"s":return String(j.$s);case"ss":return k.s(j.$s,2,"0");case"SSS":return k.s(j.$ms,3,"0");case"Z":return Y}return null})(V)||Y.replace(":","")}))},C.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},C.diff=function(S,j,T){var L,Y=this,v=k.p(j),E=B(S),N=(E.utcOffset()-this.utcOffset())*r,W=this-E,q=function(){return k.m(Y,E)};switch(v){case p:L=q()/12;break;case f:L=q();break;case m:L=q()/3;break;case g:L=(W-N)/6048e5;break;case d:L=(W-N)/864e5;break;case u:L=W/o;break;case l:L=W/r;break;case c:L=W/n;break;default:L=W}return T?L:k.a(L)},C.daysInMonth=function(){return this.endOf(f).$D},C.$locale=function(){return O[this.$L]},C.locale=function(S,j){if(!S)return this.$L;var T=this.clone(),L=H(S,j,!0);return L&&(T.$L=L),T},C.clone=function(){return k.w(this.$d,this)},C.toDate=function(){return new Date(this.valueOf())},C.toJSON=function(){return this.isValid()?this.toISOString():null},C.toISOString=function(){return this.$d.toISOString()},C.toString=function(){return this.$d.toUTCString()},D})(),z=F.prototype;return B.prototype=z,[["$ms",i],["$s",c],["$m",l],["$H",u],["$W",d],["$M",f],["$y",p],["$D",x]].forEach((function(D){z[D[1]]=function(C){return this.$g(C,D[0],D[1])}})),B.extend=function(D,C){return D.$i||(D(C,F,B),D.$i=!0),B},B.locale=H,B.isDayjs=P,B.unix=function(D){return B(1e3*D)},B.en=O[$],B.Ls=O,B.p={},B}))})(ut)),ut.exports}var Sc=yc();const Rt=bt(Sc);var dt={exports:{}},wc=dt.exports,Bn;function Cc(){return Bn||(Bn=1,(function(e,t){(function(n,r){e.exports=r()})(wc,(function(){return function(n,r,o){n=n||{};var i=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,g,f,m){return i.fromToBase(d,g,f,m)}o.en.relativeTime=c,i.fromToBase=function(d,g,f,m,p){for(var x,b,w,_=f.$locale().relativeTime||c,R=n.thresholds||[{l:"s",r:44,d:"second"},{l:"m",r:89},{l:"mm",r:44,d:"minute"},{l:"h",r:89},{l:"hh",r:21,d:"hour"},{l:"d",r:35},{l:"dd",r:25,d:"day"},{l:"M",r:45},{l:"MM",r:10,d:"month"},{l:"y",r:17},{l:"yy",d:"year"}],M=R.length,I=0;I<M;I+=1){var $=R[I];$.d&&(x=m?o(d).diff(f,$.d,!0):f.diff(d,$.d,!0));var O=(n.rounding||Math.round)(Math.abs(x));if(w=x>0,O<=$.r||!$.r){O<=1&&I>0&&($=R[I-1]);var A=_[$.l];p&&(O=p(""+O)),b=typeof A=="string"?A.replace("%d",O):A(O,g,$.l,w);break}}if(g)return b;var P=w?_.future:_.past;return typeof P=="function"?P(b):P.replace("%s",b)},i.to=function(d,g){return l(d,g,this,!0)},i.from=function(d,g){return l(d,g,this)};var u=function(d){return d.$u?o.utc():o()};i.toNow=function(d){return this.to(u(this),d)},i.fromNow=function(d){return this.from(u(this),d)}}}))})(dt)),dt.exports}var Dc=Cc();const jc=bt(Dc);var ft={exports:{}},Rc=ft.exports,Wn;function Mc(){return Wn||(Wn=1,(function(e,t){(function(n,r){e.exports=r()})(Rc,(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,i){var c=o.prototype,l=c.format;i.en.formats=n,c.format=function(u){u===void 0&&(u="YYYY-MM-DDTHH:mm:ssZ");var d=this.$locale().formats,g=(function(f,m){return f.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,(function(p,x,b){var w=b&&b.toUpperCase();return x||m[b]||n[b]||m[w].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,(function(_,R,M){return R||M.slice(1)}))}))})(u,d===void 0?{}:d);return l.call(this,g)}}}))})(ft)),ft.exports}var Tc=Mc();const Ec=bt(Tc);var ht={exports:{}},_c=ht.exports,Vn;function Oc(){return Vn||(Vn=1,(function(e,t){(function(n,r){e.exports=r()})(_c,(function(){return function(n,r){var o=r.prototype,i=o.format;o.format=function(c){var l=this,u=this.$locale();if(!this.isValid())return i.bind(this)(c);var d=this.$utils(),g=(c||"YYYY-MM-DDTHH:mm:ssZ").replace(/\[([^\]]+)]|Q|wo|ww|w|WW|W|zzz|z|gggg|GGGG|Do|X|x|k{1,2}|S/g,(function(f){switch(f){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(),f==="w"?1:2,"0");case"W":case"WW":return d.s(l.isoWeek(),f==="W"?1:2,"0");case"k":case"kk":return d.s(String(l.$H===0?24:l.$H),f==="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 f}}));return i.bind(this)(g)}}}))})(ht)),ht.exports}var kc=Oc();const Ic=bt(kc);Rt.extend(jc);Rt.extend(Ec);Rt.extend(Ic);const $c={date:"DD MMM YYYY",time:"hh:mm A",dateTime:"DD MMM YYYY, hh:mm A",full:"dddd, DD MMM YYYY, hh:mm A",short:"DD/MM/YY",relative:""};function qt({value:e,variant:t="dateTime",format:n,fallback:r="--"}){if(!e)return r;const o=Rt(e);return o.isValid()?t==="relative"?o.fromNow():o.format(n??$c[t]):r}function Ac({value:e,dateVariant:t="date",timeVariant:n="time",dateFormat:r,timeFormat:o,align:i="start",dateColor:c="gray.700",dateFontSize:l="16px",dateFontWeight:u="500",timeColor:d="gray.500",timeFontSize:g="12px",timeFontWeight:f="400",showTime:m=!0}){return s.jsxs(a.Stack,{gap:.5,align:i,children:[s.jsx(a.Text,{fontSize:l,fontWeight:u,color:c,children:qt({value:e,variant:t,format:r})}),m&&s.jsx(a.Text,{fontSize:g,fontWeight:f,color:d,children:qt({value:e,variant:n,format:o})})]})}class Nr{state=new Map;listeners=new Map;get(t){return this.state.get(t)}set(t){this.state.set(t.key,t),this.notify(t.key)}setMany(t){t.forEach(n=>this.set(n))}subscribe(t,n){return this.listeners.has(t)||this.listeners.set(t,new Set),this.listeners.get(t).add(n),n(this.state.get(t)),()=>{this.listeners.get(t)?.delete(n)}}notify(t){this.listeners.get(t)?.forEach(n=>n(this.state.get(t)))}clear(){this.state.clear()}}class Xt{constructor(t){this.baseUrl=t}async fetchLatest(t){const n=new URLSearchParams;return n.set("keys",t.join(",")),(await(await fetch(`${this.baseUrl}/options?${n}`)).json()).data}}class Kt{constructor(t){this.api=t}store=new Nr;inflight=new Map;getRaw(t){return this.store.get(t)}async getKey(t){const n=this.store.get(t);return n?n.value:(await this.fetchMissing([t]),this.store.get(t)?.value)}async getMultiKey(t){const n={},r=[];for(const o of t){const i=this.store.get(o);i?n[o]=i.value:r.push(o)}return r.length&&(await this.fetchMissing(r),r.forEach(o=>{const i=this.store.get(o);i&&(n[o]=i.value)})),n}subscribe(t,n){return this.store.subscribe(t,n)}hydrate(t){this.store.setMany(t)}clear(){this.store.clear()}async fetchMissing(t){const n=t.filter(o=>!this.inflight.has(o));if(!n.length)return;const r=this.api.fetchLatest(n).then(o=>{this.store.setMany(o),n.forEach(i=>this.inflight.delete(i))});n.forEach(o=>this.inflight.set(o,r)),await r}}const Fr=h.createContext(null);function Yr(){const e=h.useContext(Fr);if(!e)throw new Error("OptionsProvider is missing. Wrap your app with <OptionsProvider />");return e}function Lc({client:{apiUrl:e},children:t}){const n=h.useRef(new Kt(new Xt(e)));return n.current||(n.current=new Kt(new Xt(e))),s.jsx(Fr.Provider,{value:n.current,children:t})}function Pc(e){const t=Yr(),[n,r]=h.useState(t.getRaw(e)?.value);return h.useEffect(()=>{let o=!0;t.getKey(e).then(c=>{o&&r(c)});const i=t.subscribe(e,c=>{r(c?.value)});return()=>{o=!1,i()}},[e,t]),n}function zc(e){const t=Yr(),[n,r]=h.useState({});return h.useEffect(()=>{let o=!0;t.getMultiKey(e).then(c=>{o&&r(c)});const i=e.map(c=>t.subscribe(c,l=>{r(u=>({...u,[c]:l?.value}))}));return()=>{o=!1,i.forEach(c=>c())}},[e.join("|"),t]),n}async function Nc(e,t){return e.getKey(t)}async function Fc(e,t){await e.getMultiKey(t)}function Yc(e={}){const{initialPage:t=1,initialLimit:n=20}=e,[r,o]=h.useState(t),[i,c]=h.useState(n),l=h.useCallback(m=>{o(Math.max(1,m))},[]),u=h.useCallback(m=>{c(Math.max(1,m)),o(1)},[]),d=h.useCallback(()=>{o(m=>m+1)},[]),g=h.useCallback(()=>{o(m=>Math.max(1,m-1))},[]),f=h.useCallback(()=>{o(t),c(n)},[t,n]);return{page:r,limit:i,setPage:l,setLimit:u,nextPage:d,prevPage:g,reset:f}}function Bc(e={}){const{initialValue:t="",delay:n=300}=e,[r,o]=h.useState(t),i=Wc(r,n),c=h.useCallback(u=>{o(u)},[]),l=h.useCallback(()=>{o(t)},[t]);return{search:r,debouncedSearch:i,onSearchChange:c,reset:l}}function Wc(e,t=300){const[n,r]=h.useState(e);return h.useEffect(()=>{const o=setTimeout(()=>{r(e)},t);return()=>clearTimeout(o)},[e,t]),n}exports.DataTable=ga;exports.Filters=Tl;exports.HttpOptionsApi=Xt;exports.MDSButton=Ol;exports.MDSCheckbox=Tr;exports.MDSCombobox=Er;exports.MDSConfirmActionDialog=Yl;exports.MDSConfirmDeleteDialog=Jl;exports.MDSDatePicker=Or;exports.MDSDateRangePicker=_r;exports.MDSDialogAction=Zl;exports.MDSDialogActions=zr;exports.MDSDialogBody=Pr;exports.MDSDialogWrapper=cc;exports.MDSInput=Gt;exports.MDSPinInput=xc;exports.MDSRefreshButton=sn;exports.MDSSelectBox=kr;exports.OptionsClientImpl=Kt;exports.OptionsProvider=Lc;exports.OptionsStore=Nr;exports.RefreshButton=sn;exports.StackedDateTime=Ac;exports.addPreset=$r;exports.deletePreset=Ar;exports.formatDateTime=qt;exports.getColumnWidthKey=Dt;exports.getOption=Nc;exports.getPresets=Qe;exports.loadOrder=_l;exports.prefetchOptions=Fc;exports.presetStore=Xe;exports.saveOrder=El;exports.savePresets=jt;exports.setActionsConfig=yr;exports.setColumnWidth=Js;exports.setData=xr;exports.setTableId=br;exports.tableStore=ne;exports.updatePreset=sl;exports.useDebouncedSearch=Bc;exports.useOption=Pc;exports.useOptions=zc;exports.usePagination=Yc;exports.withChildren=y;
|
|
10
|
+
`},fo={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 ho(e){let{announcements:t=fo,container:n,hiddenTextDescribedById:r,screenReaderInstructions:o=uo}=e;const{announce:i,announcement:c}=ao(),l=Ze("DndLiveRegion"),[u,d]=h.useState(!1);if(h.useEffect(()=>{d(!0)},[]),lo(h.useMemo(()=>({onDragStart(f){let{active:m}=f;i(t.onDragStart({active:m}))},onDragMove(f){let{active:m,over:p}=f;t.onDragMove&&i(t.onDragMove({active:m,over:p}))},onDragOver(f){let{active:m,over:p}=f;i(t.onDragOver({active:m,over:p}))},onDragEnd(f){let{active:m,over:p}=f;i(t.onDragEnd({active:m,over:p}))},onDragCancel(f){let{active:m,over:p}=f;i(t.onDragCancel({active:m,over:p}))}}),[i,t])),!u)return null;const g=h.createElement(h.Fragment,null,h.createElement(so,{id:r,value:o.draggable}),h.createElement(io,{id:l,announcement:c}));return n?We.createPortal(g,n):g}var Z;(function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"})(Z||(Z={}));function vt(){}function go(e,t){return h.useMemo(()=>({sensor:e,options:{}}),[e,t])}function po(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return h.useMemo(()=>[...t].filter(r=>r!=null),[...t])}const he=Object.freeze({x:0,y:0});function vo(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function mo(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function xo(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function bo(e,t){if(!e||e.length===0)return null;const[n]=e;return n[t]}function bn(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=bn(t,t.left,t.top),i=[];for(const c of r){const{id:l}=c,u=n.get(l);if(u){const d=vo(bn(u),o);i.push({id:l,data:{droppableContainer:c,value:d}})}}return i.sort(mo)};function yo(e,t){const n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),o=Math.min(t.left+t.width,e.left+e.width),i=Math.min(t.top+t.height,e.top+e.height),c=o-r,l=i-n;if(r<o&&n<i){const u=t.width*t.height,d=e.width*e.height,g=c*l,f=g/(u+d-g);return Number(f.toFixed(4))}return 0}const So=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=[];for(const i of r){const{id:c}=i,l=n.get(c);if(l){const u=yo(l,t);u>0&&o.push({id:c,data:{droppableContainer:i,value:u}})}}return o.sort(xo)};function wo(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function Xn(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:he}function Co(e){return function(n){for(var r=arguments.length,o=new Array(r>1?r-1:0),i=1;i<r;i++)o[i-1]=arguments[i];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 Do=Co(1);function jo(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 Ro(e,t,n){const r=jo(t);if(!r)return e;const{scaleX:o,scaleY:i,x:c,y:l}=r,u=e.left-c-(1-o)*parseFloat(n),d=e.top-l-(1-i)*parseFloat(n.slice(n.indexOf(" ")+1)),g=o?e.width/o:e.width,f=i?e.height/i:e.height;return{width:g,height:f,top:d,right:u+g,bottom:d+f,left:u}}const Mo={ignoreTransform:!1};function Ae(e,t){t===void 0&&(t=Mo);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:d,transformOrigin:g}=ie(e).getComputedStyle(e);d&&(n=Ro(n,d,g))}const{top:r,left:o,width:i,height:c,bottom:l,right:u}=n;return{top:r,left:o,width:i,height:c,bottom:l,right:u}}function yn(e){return Ae(e,{ignoreTransform:!0})}function To(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function Eo(e,t){return t===void 0&&(t=ie(e).getComputedStyle(e)),t.position==="fixed"}function _o(e,t){t===void 0&&(t=ie(e).getComputedStyle(e));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(o=>{const i=t[o];return typeof i=="string"?n.test(i):!1})}function tn(e,t){const n=[];function r(o){if(t!=null&&n.length>=t||!o)return n;if(Zt(o)&&o.scrollingElement!=null&&!n.includes(o.scrollingElement))return n.push(o.scrollingElement),n;if(!Ke(o)||Hn(o)||n.includes(o))return n;const i=ie(e).getComputedStyle(o);return o!==e&&_o(o,i)&&n.push(o),Eo(o,i)?n:r(o.parentNode)}return e?r(e):n}function Kn(e){const[t]=tn(e,1);return t??null}function Ot(e){return!yt||!e?null:Ie(e)?e:Jt(e)?Zt(e)||e===$e(e).scrollingElement?window:Ke(e)?e:null:null}function Jn(e){return Ie(e)?e.scrollX:e.scrollLeft}function Zn(e){return Ie(e)?e.scrollY:e.scrollTop}function Wt(e){return{x:Jn(e),y:Zn(e)}}var Q;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(Q||(Q={}));function Qn(e){return!yt||!e?!1:e===document.scrollingElement}function er(e){const t={x:0,y:0},n=Qn(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,i=e.scrollLeft<=t.x,c=e.scrollTop>=r.y,l=e.scrollLeft>=r.x;return{isTop:o,isLeft:i,isBottom:c,isRight:l,maxScroll:r,minScroll:t}}const Oo={x:.2,y:.2};function ko(e,t,n,r,o){let{top:i,left:c,right:l,bottom:u}=n;r===void 0&&(r=10),o===void 0&&(o=Oo);const{isTop:d,isBottom:g,isLeft:f,isRight:m}=er(e),p={x:0,y:0},x={x:0,y:0},b={height:t.height*o.y,width:t.width*o.x};return!d&&i<=t.top+b.height?(p.y=Q.Backward,x.y=r*Math.abs((t.top+b.height-i)/b.height)):!g&&u>=t.bottom-b.height&&(p.y=Q.Forward,x.y=r*Math.abs((t.bottom-b.height-u)/b.height)),!m&&l>=t.right-b.width?(p.x=Q.Forward,x.x=r*Math.abs((t.right-b.width-l)/b.width)):!f&&c<=t.left+b.width&&(p.x=Q.Backward,x.x=r*Math.abs((t.left+b.width-c)/b.width)),{direction:p,speed:x}}function Io(e){if(e===document.scrollingElement){const{innerWidth:i,innerHeight:c}=window;return{top:0,left:0,right:i,bottom:c,width:i,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 tr(e){return e.reduce((t,n)=>Oe(t,Wt(n)),he)}function $o(e){return e.reduce((t,n)=>t+Jn(n),0)}function Ao(e){return e.reduce((t,n)=>t+Zn(n),0)}function Lo(e,t){if(t===void 0&&(t=Ae),!e)return;const{top:n,left:r,bottom:o,right:i}=t(e);Kn(e)&&(o<=0||i<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const Po=[["x",["left","right"],$o],["y",["top","bottom"],Ao]];class nn{constructor(t,n){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const r=tn(n),o=tr(r);this.rect={...t},this.width=t.width,this.height=t.height;for(const[i,c,l]of Po)for(const u of c)Object.defineProperty(this,u,{get:()=>{const d=l(r),g=o[i]-d;return this.rect[u]+g},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class Ve{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 zo(e){const{EventTarget:t}=ie(e);return e instanceof t?e:$e(e)}function kt(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 de;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(de||(de={}));function Sn(e){e.preventDefault()}function No(e){e.stopPropagation()}var G;(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"})(G||(G={}));const nr={start:[G.Space,G.Enter],cancel:[G.Esc],end:[G.Space,G.Enter,G.Tab]},Fo=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case G.Right:return{...n,x:n.x+25};case G.Left:return{...n,x:n.x-25};case G.Down:return{...n,y:n.y+25};case G.Up:return{...n,y:n.y-25}}};class rr{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 Ve($e(n)),this.windowListeners=new Ve(ie(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(de.Resize,this.handleCancel),this.windowListeners.add(de.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(de.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props,r=t.node.current;r&&Lo(r),n(he)}handleKeyDown(t){if(en(t)){const{active:n,context:r,options:o}=this.props,{keyboardCodes:i=nr,coordinateGetter:c=Fo,scrollBehavior:l="smooth"}=o,{code:u}=t;if(i.end.includes(u)){this.handleEnd(t);return}if(i.cancel.includes(u)){this.handleCancel(t);return}const{collisionRect:d}=r.current,g=d?{x:d.left,y:d.top}:he;this.referenceCoordinates||(this.referenceCoordinates=g);const f=c(t,{active:n,context:r.current,currentCoordinates:g});if(f){const m=pt(f,g),p={x:0,y:0},{scrollableAncestors:x}=r.current;for(const b of x){const C=t.code,{isTop:_,isRight:R,isLeft:M,isBottom:k,maxScroll:I,minScroll:O}=er(b),$=Io(b),N={x:Math.min(C===G.Right?$.right-$.width/2:$.right,Math.max(C===G.Right?$.left:$.left+$.width/2,f.x)),y:Math.min(C===G.Down?$.bottom-$.height/2:$.bottom,Math.max(C===G.Down?$.top:$.top+$.height/2,f.y))},H=C===G.Right&&!R||C===G.Left&&!M,B=C===G.Down&&!k||C===G.Up&&!_;if(H&&N.x!==f.x){const A=b.scrollLeft+m.x,L=C===G.Right&&A<=I.x||C===G.Left&&A>=O.x;if(L&&!m.y){b.scrollTo({left:A,behavior:l});return}L?p.x=b.scrollLeft-A:p.x=C===G.Right?b.scrollLeft-I.x:b.scrollLeft-O.x,p.x&&b.scrollBy({left:-p.x,behavior:l});break}else if(B&&N.y!==f.y){const A=b.scrollTop+m.y,L=C===G.Down&&A<=I.y||C===G.Up&&A>=O.y;if(L&&!m.x){b.scrollTo({top:A,behavior:l});return}L?p.y=b.scrollTop-A:p.y=C===G.Down?b.scrollTop-I.y:b.scrollTop-O.y,p.y&&b.scrollBy({top:-p.y,behavior:l});break}}this.handleMove(t,Oe(pt(f,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()}}rr.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:r=nr,onActivation:o}=t,{active:i}=n;const{code:c}=e.nativeEvent;if(r.start.includes(c)){const l=i.activatorNode.current;return l&&e.target!==l?!1:(e.preventDefault(),o?.({event:e.nativeEvent}),!0)}return!1}}];function wn(e){return!!(e&&"distance"in e)}function Cn(e){return!!(e&&"delay"in e)}class rn{constructor(t,n,r){var o;r===void 0&&(r=zo(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:i}=t,{target:c}=i;this.props=t,this.events=n,this.document=$e(c),this.documentListeners=new Ve(this.document),this.listeners=new Ve(r),this.windowListeners=new Ve(ie(c)),this.initialCoordinates=(o=Bt(i))!=null?o:he,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(de.Resize,this.handleCancel),this.windowListeners.add(de.DragStart,Sn),this.windowListeners.add(de.VisibilityChange,this.handleCancel),this.windowListeners.add(de.ContextMenu,Sn),this.documentListeners.add(de.Keydown,this.handleKeydown),n){if(r!=null&&r({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(Cn(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(wn(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(de.Click,No,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(de.SelectionChange,this.removeTextSelection),n(t))}handleMove(t){var n;const{activated:r,initialCoordinates:o,props:i}=this,{onMove:c,options:{activationConstraint:l}}=i;if(!o)return;const u=(n=Bt(t))!=null?n:he,d=pt(o,u);if(!r&&l){if(wn(l)){if(l.tolerance!=null&&kt(d,l.tolerance))return this.handleCancel();if(kt(d,l.distance))return this.handleStart()}if(Cn(l)&&kt(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===G.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const Yo={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class on extends rn{constructor(t){const{event:n}=t,r=$e(n.target);super(t,Yo,r)}}on.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!n.isPrimary||n.button!==0?!1:(r?.({event:n}),!0)}}];const Bo={move:{name:"mousemove"},end:{name:"mouseup"}};var Vt;(function(e){e[e.RightClick=2]="RightClick"})(Vt||(Vt={}));class Wo extends rn{constructor(t){super(t,Bo,$e(t.event.target))}}Wo.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===Vt.RightClick?!1:(r?.({event:n}),!0)}}];const It={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class Vo extends rn{constructor(t){super(t,It)}static setup(){return window.addEventListener(It.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(It.move.name,t)};function t(){}}}Vo.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;const{touches:o}=n;return o.length>1?!1:(r?.({event:n}),!0)}}];var He;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(He||(He={}));var mt;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(mt||(mt={}));function Ho(e){let{acceleration:t,activator:n=He.Pointer,canScroll:r,draggingRect:o,enabled:i,interval:c=5,order:l=mt.TreeOrder,pointerCoordinates:u,scrollableAncestors:d,scrollableAncestorRects:g,delta:f,threshold:m}=e;const p=Go({delta:f,disabled:!i}),[x,b]=eo(),C=h.useRef({x:0,y:0}),_=h.useRef({x:0,y:0}),R=h.useMemo(()=>{switch(n){case He.Pointer:return u?{top:u.y,bottom:u.y,left:u.x,right:u.x}:null;case He.DraggableRect:return o}},[n,o,u]),M=h.useRef(null),k=h.useCallback(()=>{const O=M.current;if(!O)return;const $=C.current.x*_.current.x,N=C.current.y*_.current.y;O.scrollBy($,N)},[]),I=h.useMemo(()=>l===mt.TreeOrder?[...d].reverse():d,[l,d]);h.useEffect(()=>{if(!i||!d.length||!R){b();return}for(const O of I){if(r?.(O)===!1)continue;const $=d.indexOf(O),N=g[$];if(!N)continue;const{direction:H,speed:B}=ko(O,N,R,t,m);for(const A of["x","y"])p[A][H[A]]||(B[A]=0,H[A]=0);if(B.x>0||B.y>0){b(),M.current=O,x(k,c),C.current=B,_.current=H;return}}C.current={x:0,y:0},_.current={x:0,y:0},b()},[t,k,r,b,i,c,JSON.stringify(R),JSON.stringify(p),x,d,I,g,JSON.stringify(m)])}const Uo={x:{[Q.Backward]:!1,[Q.Forward]:!1},y:{[Q.Backward]:!1,[Q.Forward]:!1}};function Go(e){let{delta:t,disabled:n}=e;const r=Yt(t);return Je(o=>{if(n||!r||!o)return Uo;const i={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[Q.Backward]:o.x[Q.Backward]||i.x===-1,[Q.Forward]:o.x[Q.Forward]||i.x===1},y:{[Q.Backward]:o.y[Q.Backward]||i.y===-1,[Q.Forward]:o.y[Q.Forward]||i.y===1}}},[n,t,r])}function qo(e,t){const n=t!=null?e.get(t):void 0,r=n?n.node.current:null;return Je(o=>{var i;return t==null?null:(i=r??o)!=null?i:null},[r,t])}function Xo(e,t){return h.useMemo(()=>e.reduce((n,r)=>{const{sensor:o}=r,i=o.activators.map(c=>({eventName:c.eventName,handler:t(c.handler,r)}));return[...n,...i]},[]),[e,t])}var qe;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(qe||(qe={}));var Ht;(function(e){e.Optimized="optimized"})(Ht||(Ht={}));const Dn=new Map;function Ko(e,t){let{dragging:n,dependencies:r,config:o}=t;const[i,c]=h.useState(null),{frequency:l,measure:u,strategy:d}=o,g=h.useRef(e),f=C(),m=Ge(f),p=h.useCallback(function(_){_===void 0&&(_=[]),!m.current&&c(R=>R===null?_:R.concat(_.filter(M=>!R.includes(M))))},[m]),x=h.useRef(null),b=Je(_=>{if(f&&!n)return Dn;if(!_||_===Dn||g.current!==e||i!=null){const R=new Map;for(let M of e){if(!M)continue;if(i&&i.length>0&&!i.includes(M.id)&&M.rect.current){R.set(M.id,M.rect.current);continue}const k=M.node.current,I=k?new nn(u(k),k):null;M.rect.current=I,I&&R.set(M.id,I)}return R}return _},[e,i,n,f,u]);return h.useEffect(()=>{g.current=e},[e]),h.useEffect(()=>{f||p()},[n,f]),h.useEffect(()=>{i&&i.length>0&&c(null)},[JSON.stringify(i)]),h.useEffect(()=>{f||typeof l!="number"||x.current!==null||(x.current=setTimeout(()=>{p(),x.current=null},l))},[l,f,p,...r]),{droppableRects:b,measureDroppableContainers:p,measuringScheduled:i!=null};function C(){switch(d){case qe.Always:return!1;case qe.BeforeDragging:return n;default:return!n}}}function or(e,t){return Je(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function Jo(e,t){return or(e,t)}function Zo(e){let{callback:t,disabled:n}=e;const r=Qt(t),o=h.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:i}=window;return new i(r)},[r,n]);return h.useEffect(()=>()=>o?.disconnect(),[o]),o}function St(e){let{callback:t,disabled:n}=e;const r=Qt(t),o=h.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:i}=window;return new i(r)},[n]);return h.useEffect(()=>()=>o?.disconnect(),[o]),o}function Qo(e){return new nn(Ae(e),e)}function jn(e,t,n){t===void 0&&(t=Qo);const[r,o]=h.useState(null);function i(){o(u=>{if(!e)return null;if(e.isConnected===!1){var d;return(d=u??n)!=null?d:null}const g=t(e);return JSON.stringify(u)===JSON.stringify(g)?u:g})}const c=Zo({callback(u){if(e)for(const d of u){const{type:g,target:f}=d;if(g==="childList"&&f instanceof HTMLElement&&f.contains(e)){i();break}}}}),l=St({callback:i});return ve(()=>{i(),e?(l?.observe(e),c?.observe(document.body,{childList:!0,subtree:!0})):(l?.disconnect(),c?.disconnect())},[e]),r}function es(e){const t=or(e);return Xn(e,t)}const Rn=[];function ts(e){const t=h.useRef(e),n=Je(r=>e?r&&r!==Rn&&e&&t.current&&e.parentNode===t.current.parentNode?r:tn(e):Rn,[e]);return h.useEffect(()=>{t.current=e},[e]),n}function ns(e){const[t,n]=h.useState(null),r=h.useRef(e),o=h.useCallback(i=>{const c=Ot(i.target);c&&n(l=>l?(l.set(c,Wt(c)),new Map(l)):null)},[]);return h.useEffect(()=>{const i=r.current;if(e!==i){c(i);const l=e.map(u=>{const d=Ot(u);return d?(d.addEventListener("scroll",o,{passive:!0}),[d,Wt(d)]):null}).filter(u=>u!=null);n(l.length?new Map(l):null),r.current=e}return()=>{c(e),c(i)};function c(l){l.forEach(u=>{const d=Ot(u);d?.removeEventListener("scroll",o)})}},[o,e]),h.useMemo(()=>e.length?t?Array.from(t.values()).reduce((i,c)=>Oe(i,c),he):tr(e):he,[e,t])}function Mn(e,t){t===void 0&&(t=[]);const n=h.useRef(null);return h.useEffect(()=>{n.current=null},t),h.useEffect(()=>{const r=e!==he;r&&!n.current&&(n.current=e),!r&&n.current&&(n.current=null)},[e]),n.current?pt(e,n.current):he}function rs(e){h.useEffect(()=>{if(!yt)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 os(e,t){return h.useMemo(()=>e.reduce((n,r)=>{let{eventName:o,handler:i}=r;return n[o]=c=>{i(c,t)},n},{}),[e,t])}function sr(e){return h.useMemo(()=>e?To(e):null,[e])}const Tn=[];function ss(e,t){t===void 0&&(t=Ae);const[n]=e,r=sr(n?ie(n):null),[o,i]=h.useState(Tn);function c(){i(()=>e.length?e.map(u=>Qn(u)?r:new nn(t(u),u)):Tn)}const l=St({callback:c});return ve(()=>{l?.disconnect(),c(),e.forEach(u=>l?.observe(u))},[e]),o}function is(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return Ke(t)?t:e}function as(e){let{measure:t}=e;const[n,r]=h.useState(null),o=h.useCallback(d=>{for(const{target:g}of d)if(Ke(g)){r(f=>{const m=t(g);return f?{...f,width:m.width,height:m.height}:m});break}},[t]),i=St({callback:o}),c=h.useCallback(d=>{const g=is(d);i?.disconnect(),g&&i?.observe(g),r(g?t(g):null)},[t,i]),[l,u]=gt(c);return h.useMemo(()=>({nodeRef:l,rect:n,setRef:u}),[n,l,u])}const ls=[{sensor:on,options:{}},{sensor:rr,options:{}}],cs={current:{}},ct={draggable:{measure:yn},droppable:{measure:yn,strategy:qe.WhileDragging,frequency:Ht.Optimized},dragOverlay:{measure:Ae}};class Ue 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 us={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Ue,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:vt},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:ct,measureDroppableContainers:vt,windowRect:null,measuringScheduled:!1},ds={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:vt,draggableNodes:new Map,over:null,measureDroppableContainers:vt},wt=h.createContext(ds),ir=h.createContext(us);function fs(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Ue}}}function hs(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 Ue(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,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;const c=new Ue(e.droppable.containers);return c.set(n,{...i,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 i=new Ue(e.droppable.containers);return i.delete(n),{...e,droppable:{...e.droppable,containers:i}}}default:return e}}function gs(e){let{disabled:t}=e;const{active:n,activatorEvent:r,draggableNodes:o}=h.useContext(wt),i=Yt(r),c=Yt(n?.id);return h.useEffect(()=>{if(!t&&!r&&i&&c!=null){if(!en(i)||document.activeElement===i.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 g of[u.current,d.current]){if(!g)continue;const f=ro(g);if(f){f.focus();break}}})}},[r,t,o,c,i]),null}function ps(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((o,i)=>i({transform:o,...r}),n):n}function vs(e){return h.useMemo(()=>({draggable:{...ct.draggable,...e?.draggable},droppable:{...ct.droppable,...e?.droppable},dragOverlay:{...ct.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function ms(e){let{activeNode:t,measure:n,initialRect:r,config:o=!0}=e;const i=h.useRef(!1),{x:c,y:l}=typeof o=="boolean"?{x:o,y:o}:o;ve(()=>{if(!c&&!l||!t){i.current=!1;return}if(i.current||!r)return;const d=t?.node.current;if(!d||d.isConnected===!1)return;const g=n(d),f=Xn(g,r);if(c||(f.x=0),l||(f.y=0),i.current=!0,Math.abs(f.x)>0||Math.abs(f.y)>0){const m=Kn(d);m&&m.scrollBy({top:f.y,left:f.x})}},[t,c,l,r,n])}const ar=h.createContext({...he,scaleX:1,scaleY:1});var De;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(De||(De={}));const lr=h.memo(function(t){var n,r,o,i;let{id:c,accessibility:l,autoScroll:u=!0,children:d,sensors:g=ls,collisionDetection:f=So,measuring:m,modifiers:p,...x}=t;const b=h.useReducer(hs,void 0,fs),[C,_]=b,[R,M]=co(),[k,I]=h.useState(De.Uninitialized),O=k===De.Initialized,{draggable:{active:$,nodes:N,translate:H},droppable:{containers:B}}=C,A=$!=null?N.get($):null,L=h.useRef({initial:null,translated:null}),P=h.useMemo(()=>{var oe;return $!=null?{id:$,data:(oe=A?.data)!=null?oe:cs,rect:L}:null},[$,A]),D=h.useRef(null),[S,w]=h.useState(null),[j,T]=h.useState(null),z=Ge(x,Object.values(x)),Y=Ze("DndDescribedBy",c),v=h.useMemo(()=>B.getEnabled(),[B]),E=vs(m),{droppableRects:F,measureDroppableContainers:W,measuringScheduled:q}=Ko(v,{dragging:O,dependencies:[H.x,H.y],config:E.droppable}),X=qo(N,$),U=h.useMemo(()=>j?Bt(j):null,[j]),K=Xr(),J=Jo(X,E.draggable.measure);ms({activeNode:$!=null?N.get($):null,config:K.layoutShiftCompensation,initialRect:J,measure:E.draggable.measure});const V=jn(X,E.draggable.measure,J),se=jn(X?X.parentElement:null),re=h.useRef({activatorEvent:null,active:null,activeNode:X,collisionRect:null,collisions:null,droppableRects:F,draggableNodes:N,draggingNode:null,draggingNodeRect:null,droppableContainers:B,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),fe=B.getNodeFor((n=re.current.over)==null?void 0:n.id),me=as({measure:E.dragOverlay.measure}),Re=(r=me.nodeRef.current)!=null?r:X,Me=O?(o=me.rect)!=null?o:V:null,an=!!(me.nodeRef.current&&me.rect),ln=es(an?null:V),Mt=sr(Re?ie(Re):null),be=ts(O?fe??X:null),et=ss(be),tt=ps(p,{transform:{x:H.x-ln.x,y:H.y-ln.y,scaleX:1,scaleY:1},activatorEvent:j,active:P,activeNodeRect:V,containerNodeRect:se,draggingNodeRect:Me,over:re.current.over,overlayNodeRect:me.rect,scrollableAncestors:be,scrollableAncestorRects:et,windowRect:Mt}),cn=U?Oe(U,H):null,un=ns(be),Br=Mn(un),Wr=Mn(un,[V]),Te=Oe(tt,Br),Ee=Me?Do(Me,tt):null,Pe=P&&Ee?f({active:P,collisionRect:Ee,droppableRects:F,droppableContainers:v,pointerCoordinates:cn}):null,dn=bo(Pe,"id"),[ye,fn]=h.useState(null),Vr=an?tt:Oe(tt,Wr),Hr=wo(Vr,(i=ye?.rect)!=null?i:null,V),Tt=h.useRef(null),hn=h.useCallback((oe,ae)=>{let{sensor:le,options:Se}=ae;if(D.current==null)return;const ue=N.get(D.current);if(!ue)return;const ce=oe.nativeEvent,ge=new le({active:D.current,activeNode:ue,event:ce,options:Se,context:re,onAbort(te){if(!N.get(te))return;const{onDragAbort:pe}=z.current,xe={id:te};pe?.(xe),R({type:"onDragAbort",event:xe})},onPending(te,we,pe,xe){if(!N.get(te))return;const{onDragPending:Ne}=z.current,Ce={id:te,constraint:we,initialCoordinates:pe,offset:xe};Ne?.(Ce),R({type:"onDragPending",event:Ce})},onStart(te){const we=D.current;if(we==null)return;const pe=N.get(we);if(!pe)return;const{onDragStart:xe}=z.current,ze={activatorEvent:ce,active:{id:we,data:pe.data,rect:L}};We.unstable_batchedUpdates(()=>{xe?.(ze),I(De.Initializing),_({type:Z.DragStart,initialCoordinates:te,active:we}),R({type:"onDragStart",event:ze}),w(Tt.current),T(ce)})},onMove(te){_({type:Z.DragMove,coordinates:te})},onEnd:_e(Z.DragEnd),onCancel:_e(Z.DragCancel)});Tt.current=ge;function _e(te){return async function(){const{active:pe,collisions:xe,over:ze,scrollAdjustedTranslate:Ne}=re.current;let Ce=null;if(pe&&Ne){const{cancelDrop:Fe}=z.current;Ce={activatorEvent:ce,active:pe,collisions:xe,delta:Ne,over:ze},te===Z.DragEnd&&typeof Fe=="function"&&await Promise.resolve(Fe(Ce))&&(te=Z.DragCancel)}D.current=null,We.unstable_batchedUpdates(()=>{_({type:te}),I(De.Uninitialized),fn(null),w(null),T(null),Tt.current=null;const Fe=te===Z.DragEnd?"onDragEnd":"onDragCancel";if(Ce){const Et=z.current[Fe];Et?.(Ce),R({type:Fe,event:Ce})}})}}},[N]),Ur=h.useCallback((oe,ae)=>(le,Se)=>{const ue=le.nativeEvent,ce=N.get(Se);if(D.current!==null||!ce||ue.dndKit||ue.defaultPrevented)return;const ge={active:ce};oe(le,ae.options,ge)===!0&&(ue.dndKit={capturedBy:ae.sensor},D.current=Se,hn(le,ae))},[N,hn]),gn=Xo(g,Ur);rs(g),ve(()=>{V&&k===De.Initializing&&I(De.Initialized)},[V,k]),h.useEffect(()=>{const{onDragMove:oe}=z.current,{active:ae,activatorEvent:le,collisions:Se,over:ue}=re.current;if(!ae||!le)return;const ce={active:ae,activatorEvent:le,collisions:Se,delta:{x:Te.x,y:Te.y},over:ue};We.unstable_batchedUpdates(()=>{oe?.(ce),R({type:"onDragMove",event:ce})})},[Te.x,Te.y]),h.useEffect(()=>{const{active:oe,activatorEvent:ae,collisions:le,droppableContainers:Se,scrollAdjustedTranslate:ue}=re.current;if(!oe||D.current==null||!ae||!ue)return;const{onDragOver:ce}=z.current,ge=Se.get(dn),_e=ge&&ge.rect.current?{id:ge.id,rect:ge.rect.current,data:ge.data,disabled:ge.disabled}:null,te={active:oe,activatorEvent:ae,collisions:le,delta:{x:ue.x,y:ue.y},over:_e};We.unstable_batchedUpdates(()=>{fn(_e),ce?.(te),R({type:"onDragOver",event:te})})},[dn]),ve(()=>{re.current={activatorEvent:j,active:P,activeNode:X,collisionRect:Ee,collisions:Pe,droppableRects:F,draggableNodes:N,draggingNode:Re,draggingNodeRect:Me,droppableContainers:B,over:ye,scrollableAncestors:be,scrollAdjustedTranslate:Te},L.current={initial:Me,translated:Ee}},[P,X,Pe,Ee,N,Re,Me,F,B,ye,be,Te]),Ho({...K,delta:H,draggingRect:Ee,pointerCoordinates:cn,scrollableAncestors:be,scrollableAncestorRects:et});const Gr=h.useMemo(()=>({active:P,activeNode:X,activeNodeRect:V,activatorEvent:j,collisions:Pe,containerNodeRect:se,dragOverlay:me,draggableNodes:N,droppableContainers:B,droppableRects:F,over:ye,measureDroppableContainers:W,scrollableAncestors:be,scrollableAncestorRects:et,measuringConfiguration:E,measuringScheduled:q,windowRect:Mt}),[P,X,V,j,Pe,se,me,N,B,F,ye,W,be,et,E,q,Mt]),qr=h.useMemo(()=>({activatorEvent:j,activators:gn,active:P,activeNodeRect:V,ariaDescribedById:{draggable:Y},dispatch:_,draggableNodes:N,over:ye,measureDroppableContainers:W}),[j,gn,P,V,_,Y,N,ye,W]);return h.createElement(Gn.Provider,{value:M},h.createElement(wt.Provider,{value:qr},h.createElement(ir.Provider,{value:Gr},h.createElement(ar.Provider,{value:Hr},d)),h.createElement(gs,{disabled:l?.restoreFocus===!1})),h.createElement(ho,{...l,hiddenTextDescribedById:Y}));function Xr(){const oe=S?.autoScrollEnabled===!1,ae=typeof u=="object"?u.enabled===!1:u===!1,le=O&&!oe&&!ae;return typeof u=="object"?{...u,enabled:le}:{enabled:le}}}),xs=h.createContext(null),En="button",bs="Draggable";function ys(e){let{id:t,data:n,disabled:r=!1,attributes:o}=e;const i=Ze(bs),{activators:c,activatorEvent:l,active:u,activeNodeRect:d,ariaDescribedById:g,draggableNodes:f,over:m}=h.useContext(wt),{role:p=En,roleDescription:x="draggable",tabIndex:b=0}=o??{},C=u?.id===t,_=h.useContext(C?ar:xs),[R,M]=gt(),[k,I]=gt(),O=os(c,t),$=Ge(n);ve(()=>(f.set(t,{id:t,key:i,node:R,activatorNode:k,data:$}),()=>{const H=f.get(t);H&&H.key===i&&f.delete(t)}),[f,t]);const N=h.useMemo(()=>({role:p,tabIndex:b,"aria-disabled":r,"aria-pressed":C&&p===En?!0:void 0,"aria-roledescription":x,"aria-describedby":g.draggable}),[r,p,b,C,x,g.draggable]);return{active:u,activatorEvent:l,activeNodeRect:d,attributes:N,isDragging:C,listeners:r?void 0:O,node:R,over:m,setNodeRef:M,setActivatorNodeRef:I,transform:_}}function Ss(){return h.useContext(ir)}const ws="Droppable",Cs={timeout:25};function Ds(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:o}=e;const i=Ze(ws),{active:c,dispatch:l,over:u,measureDroppableContainers:d}=h.useContext(wt),g=h.useRef({disabled:n}),f=h.useRef(!1),m=h.useRef(null),p=h.useRef(null),{disabled:x,updateMeasurementsFor:b,timeout:C}={...Cs,...o},_=Ge(b??r),R=h.useCallback(()=>{if(!f.current){f.current=!0;return}p.current!=null&&clearTimeout(p.current),p.current=setTimeout(()=>{d(Array.isArray(_.current)?_.current:[_.current]),p.current=null},C)},[C]),M=St({callback:R,disabled:x||!c}),k=h.useCallback((N,H)=>{M&&(H&&(M.unobserve(H),f.current=!1),N&&M.observe(N))},[M]),[I,O]=gt(k),$=Ge(t);return h.useEffect(()=>{!M||!I.current||(M.disconnect(),f.current=!1,M.observe(I.current))},[I,M]),h.useEffect(()=>(l({type:Z.RegisterDroppable,element:{id:r,key:i,disabled:n,node:I,rect:m,data:$}}),()=>l({type:Z.UnregisterDroppable,key:i,id:r})),[r]),h.useEffect(()=>{n!==g.current.disabled&&(l({type:Z.SetDroppableDisabled,id:r,key:i,disabled:n}),g.current.disabled=n)},[r,i,n,l]),{active:c,rect:m,isOver:u?.id===r,node:I,over:u,setNodeRef:O}}function Ct(e,t,n){const r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function js(e,t){return e.reduce((n,r,o)=>{const i=t.get(r);return i&&(n[o]=i),n},Array(e.length))}function rt(e){return e!==null&&e>=0}function Rs(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 Ms(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const ot={scaleX:1,scaleY:1},Ts=e=>{var t;let{rects:n,activeNodeRect:r,activeIndex:o,overIndex:i,index:c}=e;const l=(t=n[o])!=null?t:r;if(!l)return null;const u=Es(n,c,o);if(c===o){const d=n[i];return d?{x:o<i?d.left+d.width-(l.left+l.width):d.left-l.left,y:0,...ot}:null}return c>o&&c<=i?{x:-l.width-u,y:0,...ot}:c<o&&c>=i?{x:l.width+u,y:0,...ot}:{x:0,y:0,...ot}};function Es(e,t,n){const r=e[t],o=e[t-1],i=e[t+1];return!r||!o&&!i?0:n<t?o?r.left-(o.left+o.width):i.left-(r.left+r.width):i?i.left-(r.left+r.width):r.left-(o.left+o.width)}const cr=e=>{let{rects:t,activeIndex:n,overIndex:r,index:o}=e;const i=Ct(t,r,n),c=t[o],l=i[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}},st={scaleX:1,scaleY:1},_s=e=>{var t;let{activeIndex:n,activeNodeRect:r,index:o,rects:i,overIndex:c}=e;const l=(t=i[n])!=null?t:r;if(!l)return null;if(o===n){const d=i[c];return d?{x:0,y:n<c?d.top+d.height-(l.top+l.height):d.top-l.top,...st}:null}const u=Os(i,o,n);return o>n&&o<=c?{x:0,y:-l.height-u,...st}:o<n&&o>=c?{x:0,y:l.height+u,...st}:{x:0,y:0,...st}};function Os(e,t,n){const r=e[t],o=e[t-1],i=e[t+1];return r?n<t?o?r.top-(o.top+o.height):i?i.top-(r.top+r.height):0:i?i.top-(r.top+r.height):o?r.top-(o.top+o.height):0:0}const ur="Sortable",dr=h.createContext({activeIndex:-1,containerId:ur,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:cr,disabled:{draggable:!1,droppable:!1}});function fr(e){let{children:t,id:n,items:r,strategy:o=cr,disabled:i=!1}=e;const{active:c,dragOverlay:l,droppableRects:u,over:d,measureDroppableContainers:g}=Ss(),f=Ze(ur,n),m=l.rect!==null,p=h.useMemo(()=>r.map(O=>typeof O=="object"&&"id"in O?O.id:O),[r]),x=c!=null,b=c?p.indexOf(c.id):-1,C=d?p.indexOf(d.id):-1,_=h.useRef(p),R=!Rs(p,_.current),M=C!==-1&&b===-1||R,k=Ms(i);ve(()=>{R&&x&&g(p)},[R,p,x,g]),h.useEffect(()=>{_.current=p},[p]);const I=h.useMemo(()=>({activeIndex:b,containerId:f,disabled:k,disableTransforms:M,items:p,overIndex:C,useDragOverlay:m,sortedRects:js(p,u),strategy:o}),[b,f,k.draggable,k.droppable,M,p,C,u,m,o]);return h.createElement(dr.Provider,{value:I},t)}const ks=e=>{let{id:t,items:n,activeIndex:r,overIndex:o}=e;return Ct(n,r,o).indexOf(t)},Is=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:o,items:i,newIndex:c,previousItems:l,previousContainerId:u,transition:d}=e;return!d||!r||l!==i&&o===c?!1:n?!0:c!==o&&t===u},$s={duration:200,easing:"ease"},hr="transform",As=ke.Transition.toString({property:hr,duration:0,easing:"linear"}),Ls={roleDescription:"sortable"};function Ps(e){let{disabled:t,index:n,node:r,rect:o}=e;const[i,c]=h.useState(null),l=h.useRef(n);return ve(()=>{if(!t&&n!==l.current&&r.current){const u=o.current;if(u){const d=Ae(r.current,{ignoreTransform:!0}),g={x:u.left-d.left,y:u.top-d.top,scaleX:u.width/d.width,scaleY:u.height/d.height};(g.x||g.y)&&c(g)}}n!==l.current&&(l.current=n)},[t,n,r,o]),h.useEffect(()=>{i&&c(null)},[i]),i}function gr(e){let{animateLayoutChanges:t=Is,attributes:n,disabled:r,data:o,getNewIndex:i=ks,id:c,strategy:l,resizeObserverConfig:u,transition:d=$s}=e;const{items:g,containerId:f,activeIndex:m,disabled:p,disableTransforms:x,sortedRects:b,overIndex:C,useDragOverlay:_,strategy:R}=h.useContext(dr),M=zs(r,p),k=g.indexOf(c),I=h.useMemo(()=>({sortable:{containerId:f,index:k,items:g},...o}),[f,o,k,g]),O=h.useMemo(()=>g.slice(g.indexOf(c)),[g,c]),{rect:$,node:N,isOver:H,setNodeRef:B}=Ds({id:c,data:I,disabled:M.droppable,resizeObserverConfig:{updateMeasurementsFor:O,...u}}),{active:A,activatorEvent:L,activeNodeRect:P,attributes:D,setNodeRef:S,listeners:w,isDragging:j,over:T,setActivatorNodeRef:z,transform:Y}=ys({id:c,data:I,attributes:{...Ls,...n},disabled:M.draggable}),v=Qr(B,S),E=!!A,F=E&&!x&&rt(m)&&rt(C),W=!_&&j,q=W&&F?Y:null,U=F?q??(l??R)({rects:b,activeNodeRect:P,activeIndex:m,overIndex:C,index:k}):null,K=rt(m)&&rt(C)?i({id:c,items:g,activeIndex:m,overIndex:C}):k,J=A?.id,V=h.useRef({activeId:J,items:g,newIndex:K,containerId:f}),se=g!==V.current.items,re=t({active:A,containerId:f,isDragging:j,isSorting:E,id:c,index:k,items:g,newIndex:V.current.newIndex,previousItems:V.current.items,previousContainerId:V.current.containerId,transition:d,wasDragging:V.current.activeId!=null}),fe=Ps({disabled:!re,index:k,node:N,rect:$});return h.useEffect(()=>{E&&V.current.newIndex!==K&&(V.current.newIndex=K),f!==V.current.containerId&&(V.current.containerId=f),g!==V.current.items&&(V.current.items=g)},[E,K,f,g]),h.useEffect(()=>{if(J===V.current.activeId)return;if(J!=null&&V.current.activeId==null){V.current.activeId=J;return}const Re=setTimeout(()=>{V.current.activeId=J},50);return()=>clearTimeout(Re)},[J]),{active:A,activeIndex:m,attributes:D,data:I,rect:$,index:k,newIndex:K,items:g,isOver:H,isSorting:E,isDragging:j,listeners:w,node:N,overIndex:C,over:T,setNodeRef:v,setActivatorNodeRef:z,setDroppableNodeRef:B,setDraggableNodeRef:S,transform:fe??U,transition:me()};function me(){if(fe||se&&V.current.newIndex===k)return As;if(!(W&&!en(L)||!d)&&(E||re))return ke.Transition.toString({...d,property:hr})}}function zs(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}}G.Down,G.Right,G.Up,G.Left;var it={exports:{}},$t={},at={exports:{}},At={};var _n;function Ns(){if(_n)return At;_n=1;var e=h;function t(f,m){return f===m&&(f!==0||1/f===1/m)||f!==f&&m!==m}var n=typeof Object.is=="function"?Object.is:t,r=e.useState,o=e.useEffect,i=e.useLayoutEffect,c=e.useDebugValue;function l(f,m){var p=m(),x=r({inst:{value:p,getSnapshot:m}}),b=x[0].inst,C=x[1];return i(function(){b.value=p,b.getSnapshot=m,u(b)&&C({inst:b})},[f,p,m]),o(function(){return u(b)&&C({inst:b}),f(function(){u(b)&&C({inst:b})})},[f]),c(p),p}function u(f){var m=f.getSnapshot;f=f.value;try{var p=m();return!n(f,p)}catch{return!0}}function d(f,m){return m()}var g=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?d:l;return At.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:g,At}var Lt={};var On;function Fs(){return On||(On=1,process.env.NODE_ENV!=="production"&&(function(){function e(p,x){return p===x&&(p!==0||1/p===1/x)||p!==p&&x!==x}function t(p,x){g||o.startTransition===void 0||(g=!0,console.error("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));var b=x();if(!f){var C=x();i(b,C)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),f=!0)}C=c({inst:{value:b,getSnapshot:x}});var _=C[0].inst,R=C[1];return u(function(){_.value=b,_.getSnapshot=x,n(_)&&R({inst:_})},[p,b,x]),l(function(){return n(_)&&R({inst:_}),p(function(){n(_)&&R({inst:_})})},[p]),d(b),b}function n(p){var x=p.getSnapshot;p=p.value;try{var b=x();return!i(p,b)}catch{return!0}}function r(p,x){return x()}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var o=h,i=typeof Object.is=="function"?Object.is:e,c=o.useState,l=o.useEffect,u=o.useLayoutEffect,d=o.useDebugValue,g=!1,f=!1,m=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?r:t;Lt.useSyncExternalStore=o.useSyncExternalStore!==void 0?o.useSyncExternalStore:m,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()),Lt}var kn;function pr(){return kn||(kn=1,process.env.NODE_ENV==="production"?at.exports=Ns():at.exports=Fs()),at.exports}var In;function Ys(){if(In)return $t;In=1;var e=h,t=pr();function n(d,g){return d===g&&(d!==0||1/d===1/g)||d!==d&&g!==g}var r=typeof Object.is=="function"?Object.is:n,o=t.useSyncExternalStore,i=e.useRef,c=e.useEffect,l=e.useMemo,u=e.useDebugValue;return $t.useSyncExternalStoreWithSelector=function(d,g,f,m,p){var x=i(null);if(x.current===null){var b={hasValue:!1,value:null};x.current=b}else b=x.current;x=l(function(){function _(O){if(!R){if(R=!0,M=O,O=m(O),p!==void 0&&b.hasValue){var $=b.value;if(p($,O))return k=$}return k=O}if($=k,r(M,O))return $;var N=m(O);return p!==void 0&&p($,N)?(M=O,$):(M=O,k=N)}var R=!1,M,k,I=f===void 0?null:f;return[function(){return _(g())},I===null?void 0:function(){return _(I())}]},[g,f,m,p]);var C=o(d,x[0],x[1]);return c(function(){b.hasValue=!0,b.value=C},[C]),u(C),C},$t}var Pt={};var $n;function Bs(){return $n||($n=1,process.env.NODE_ENV!=="production"&&(function(){function e(d,g){return d===g&&(d!==0||1/d===1/g)||d!==d&&g!==g}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var t=h,n=pr(),r=typeof Object.is=="function"?Object.is:e,o=n.useSyncExternalStore,i=t.useRef,c=t.useEffect,l=t.useMemo,u=t.useDebugValue;Pt.useSyncExternalStoreWithSelector=function(d,g,f,m,p){var x=i(null);if(x.current===null){var b={hasValue:!1,value:null};x.current=b}else b=x.current;x=l(function(){function _(O){if(!R){if(R=!0,M=O,O=m(O),p!==void 0&&b.hasValue){var $=b.value;if(p($,O))return k=$}return k=O}if($=k,r(M,O))return $;var N=m(O);return p!==void 0&&p($,N)?(M=O,$):(M=O,k=N)}var R=!1,M,k,I=f===void 0?null:f;return[function(){return _(g())},I===null?void 0:function(){return _(I())}]},[g,f,m,p]);var C=o(d,x[0],x[1]);return c(function(){b.hasValue=!0,b.value=C},[C]),u(C),C},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()),Pt}var An;function Ws(){return An||(An=1,process.env.NODE_ENV==="production"?it.exports=Ys():it.exports=Bs()),it.exports}var Vs=Ws();const Ut=new WeakMap,Hs=new WeakMap,xt={current:[]};let zt=!1;const lt=new Set,Ln=new Map;function vr(e){for(const t of e){if(xt.current.includes(t))continue;xt.current.push(t),t.recompute();const n=Hs.get(t);if(n)for(const r of n){const o=Ut.get(r);o?.length&&vr(o)}}}function Us(e){const t={prevVal:e.prevState,currentVal:e.state};for(const n of e.listeners)n(t)}function Gs(e){const t={prevVal:e.prevState,currentVal:e.state};for(const n of e.listeners)n(t)}function qs(e){if(lt.add(e),!zt)try{for(zt=!0;lt.size>0;){const t=Array.from(lt);lt.clear();for(const n of t){const r=Ln.get(n)??n.prevState;n.prevState=r,Us(n)}for(const n of t){const r=Ut.get(n);r&&(xt.current.push(n),vr(r))}for(const n of t){const r=Ut.get(n);if(r)for(const o of r)Gs(o)}}}finally{zt=!1,xt.current=[],Ln.clear()}}function Xs(e){return typeof e=="function"}class mr{constructor(t,n){this.listeners=new Set,this.subscribe=r=>{var o,i;this.listeners.add(r);const c=(i=(o=this.options)==null?void 0:o.onSubscribe)==null?void 0:i.call(o,r,this);return()=>{this.listeners.delete(r),c?.()}},this.prevState=t,this.state=t,this.options=n}setState(t){var n,r,o;this.prevState=this.state,(n=this.options)!=null&&n.updateFn?this.state=this.options.updateFn(this.prevState)(t):Xs(t)?this.state=t(this.prevState):this.state=t,(o=(r=this.options)==null?void 0:r.onUpdate)==null||o.call(r),qs(this)}}function Le(e,t=r=>r,n={}){const r=n.equal??Ks;return Vs.useSyncExternalStoreWithSelector(e.subscribe,()=>e.state,()=>e.state,t,r)}function Ks(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[r,o]of e)if(!t.has(r)||!Object.is(o,t.get(r)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const r of e)if(!t.has(r))return!1;return!0}if(e instanceof Date&&t instanceof Date)return e.getTime()===t.getTime();const n=Pn(e);if(n.length!==Pn(t).length)return!1;for(let r=0;r<n.length;r++)if(!Object.prototype.hasOwnProperty.call(t,n[r])||!Object.is(e[n[r]],t[n[r]]))return!1;return!0}function Pn(e){return Object.keys(e).concat(Object.getOwnPropertySymbols(e))}const ne=new mr({tableId:"",sortColumn:null,sortDirection:"asc",visibility:{},columnOrder:[],columnWidths:{},data:[],sortableColumns:[],actionsConfig:{showActionColumn:!0,showColumnVisibilityMenu:!0,children:"Actions",width:"100px"}}),Dt=e=>`datatable:${e}:column-widths`;function xr(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:i}=ne.state,c=JSON.parse(localStorage.getItem(Sr(i))||"[]"),l=[...c.map(f=>o.find(m=>m.id===f)).filter(Boolean),...o.filter(f=>!c.includes(f.id))],u=JSON.parse(localStorage.getItem(wr(i))||"{}"),d=l.reduce((f,m)=>(f[m.id]=u[m.id]??!0,f),{}),g=JSON.parse(localStorage.getItem(Dt(i))||"{}");ne.setState(f=>({...f,data:e,columnOrder:l,visibility:d,columnWidths:g,sortableColumns:l.map(m=>({id:m.id,label:m.label,sortable:!0,backgroundColor:m.backgroundColor}))}))}function br(e){ne.setState(t=>({...t,tableId:e,sortColumn:null,sortDirection:"asc",columnOrder:[],visibility:{}}))}const yr=e=>{ne.setState(t=>({...t,actionsConfig:e}))};function Js(e,t){ne.setState(n=>{const r={...n.columnWidths,[e]:Math.max(60,t)};return localStorage.setItem(Dt(n.tableId),JSON.stringify(r)),{...n,columnWidths:r}})}const Sr=e=>`table_column_order_v1:${e}`,wr=e=>`table_column_visibility_v1:${e}`,Zs=e=>{const{tableId:t}=ne.state;localStorage.setItem(Sr(t),JSON.stringify(e.map(n=>n.id))),ne.setState(n=>({...n,columnOrder:e})),ne.setState(n=>({...n,columnOrder:e}))};function Qs(e){ne.setState(t=>t.sortColumn===e?{...t,sortDirection:t.sortDirection==="asc"?"desc":"asc"}:{...t,sortColumn:e,sortDirection:"asc"})}const ei=e=>{ne.setState(t=>{const n={...t.visibility,[e]:!t.visibility[e]};return t.tableId&&localStorage.setItem(wr(t.tableId),JSON.stringify(n)),{...t,visibility:n}})};function ti(e,t){ne.setState(n=>{const r={...n.columnWidths,[e]:Math.max(60,t)};return localStorage.setItem(Dt(n.tableId),JSON.stringify(r)),{...n,columnWidths:r}})}const ni=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),ri=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,r)=>r?r.toUpperCase():n.toLowerCase()),zn=e=>{const t=ri(e);return t.charAt(0).toUpperCase()+t.slice(1)},Cr=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim(),oi=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0};var si={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 ii=h.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:o="",children:i,iconNode:c,...l},u)=>h.createElement("svg",{ref:u,...si,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:Cr("lucide",o),...!i&&!oi(l)&&{"aria-hidden":"true"},...l},[...c.map(([d,g])=>h.createElement(d,g)),...Array.isArray(i)?i:[i]]));const ee=(e,t)=>{const n=h.forwardRef(({className:r,...o},i)=>h.createElement(ii,{ref:i,iconNode:t,className:Cr(`lucide-${ni(zn(e))}`,`lucide-${e}`,r),...o}));return n.displayName=zn(e),n};const ai=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],li=ee("arrow-down",ai);const ci=[["path",{d:"M8 3 4 7l4 4",key:"9rb6wj"}],["path",{d:"M4 7h16",key:"6tx8e3"}],["path",{d:"m16 21 4-4-4-4",key:"siv7j2"}],["path",{d:"M20 17H4",key:"h6l3hr"}]],ui=ee("arrow-left-right",ci);const di=[["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"}]],fi=ee("arrow-up-down",di);const hi=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],gi=ee("arrow-up",hi);const pi=[["path",{d:"m19 21-7-4-7 4V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v16z",key:"1fy3hk"}]],vi=ee("bookmark",pi);const mi=[["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"}]],Dr=ee("calendar",mi);const xi=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],bi=ee("chevron-left",xi);const yi=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Si=ee("chevron-right",yi);const wi=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 3v18",key:"108xh3"}]],Ci=ee("columns-2",wi);const Di=[["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"}]],ji=ee("delete",Di);const Ri=[["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"}]],Mi=ee("ellipsis",Ri);const Ti=[["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"}]],Ei=ee("funnel",Ti);const _i=[["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"}]],jr=ee("grip-vertical",_i);const Oi=[["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"}]],ki=ee("pen",Oi);const Ii=[["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"}]],$i=ee("refresh-ccw",Ii);const Ai=[["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"}]],Li=ee("settings",Ai);const Pi=[["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"}]],Rr=ee("triangle-alert",Pi);const zi=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Mr=ee("x",zi);function y(e){return h.forwardRef((t,n)=>{const{children:r,...o}=t;return s.jsx(e,{ref:n,...o,children:r})})}const Ni=y(a.Menu.Trigger),Fi=y(a.Menu.Positioner),Yi=y(a.Menu.Content),Bi=y(a.Menu.Item),Wi=y(a.Checkbox.Label),Vi=y(a.Checkbox.HiddenInput),Hi=y(a.Checkbox.Control);function Ui({visibility:e,onToggle:t}){const{sortableColumns:n}=Le(ne);return s.jsxs(a.Menu.Root,{closeOnSelect:!1,children:[s.jsx(Ni,{asChild:!0,children:s.jsx(a.IconButton,{"aria-label":"Toggle columns",variant:"ghost",ml:"1",size:"xs",children:s.jsx(Ci,{size:18})})}),s.jsx(a.Portal,{children:s.jsx(Fi,{children:s.jsx(Yi,{minW:"220px",children:n.map(r=>{const o=!!e[r.id];return s.jsx(Bi,{value:r.id,closeOnSelect:!1,children:s.jsxs(a.Checkbox.Root,{checked:o,onCheckedChange:()=>t(r.id),children:[s.jsx(Vi,{}),s.jsx(Hi,{}),s.jsx(Wi,{children:r.label})]})},r.id)})})})})]})}function Gi({id:e,children:t,onClick:n,cursor:r,borderRight:o,backgroundColor:i}){const{columnWidths:c}=Le(ne),l=c[e],u=h.useRef(0),d=h.useRef(0),{setNodeRef:g,attributes:f,listeners:m,transform:p,transition:x}=gr({id:e}),b=R=>{R.stopPropagation(),u.current=R.clientX,d.current=l??150;const M=I=>{ti(e,d.current+(I.clientX-u.current))},k=()=>{document.removeEventListener("mousemove",M),document.removeEventListener("mouseup",k)};document.addEventListener("mousemove",M),document.addEventListener("mouseup",k)},[C,_]=h.useState(!1);return s.jsx(a.Table.ColumnHeader,{ref:g,onClick:n,backgroundColor:i,w:l?`${l}px`:void 0,minW:"60px",style:{transform:ke.Transform.toString(p),transition:x,cursor:r,borderRight:o},...f,children:s.jsxs(a.HStack,{position:"relative",onMouseDown:b,children:[s.jsx("span",{...m,children:s.jsx(jr,{size:12,style:{cursor:"grab"}})}),t,s.jsx(a.Box,{position:"absolute",right:0,top:0,h:"100%",w:"10px",cursor:"col-resize",onMouseDown:b,onMouseEnter:()=>_(!0),onMouseLeave:()=>_(!1),display:"flex",alignItems:"center",justifyContent:"center",zIndex:2,children:C&&s.jsx(ui,{size:14,style:{pointerEvents:"none",opacity:.8}})})]})})}function qi(){const{columnOrder:e,visibility:t,sortColumn:n,sortDirection:r,sortableColumns:o,actionsConfig:i}=Le(ne),c=e.map(l=>o.find(u=>u.id===l.id)).filter(l=>l!==void 0).filter(l=>t[l.id]);return s.jsx(a.Table.Header,{background:"blue.200",position:"sticky",top:0,p:"0",zIndex:1,children:s.jsxs(a.Table.Row,{height:"28px",children:[i?.showSNo&&s.jsx(a.Table.ColumnHeader,{width:"20px",textAlign:"center",backgroundColor:i.backgroundColor,borderRight:"2px solid #dcdcdc",children:i.indexChildren||"S.No"}),c.map(l=>{const u=n===l?.id;return s.jsx(Gi,{id:l?.id,onClick:()=>l?.sortable&&Qs(l?.id),borderRight:"2px solid #dcdcdc",backgroundColor:l?.backgroundColor,children:s.jsxs("span",{style:{display:"flex",alignItems:"center",gap:6,userSelect:"none"},children:[l.label,l?.sortable&&(u?r==="asc"?s.jsx(gi,{size:14}):s.jsx(li,{size:14}):s.jsx(fi,{size:14,opacity:.4}))]})},l?.id)}),i?.showActionColumn&&s.jsx(a.Table.ColumnHeader,{width:i.width,backgroundColor:i.backgroundColor,borderRight:"2px solid #dcdcdc",children:i.children||"Actions"}),i?.showColumnVisibilityMenu&&s.jsx(a.Table.ColumnHeader,{boxSize:"0.5",backgroundColor:i.backgroundColorColumnVisibilityMenu,children:s.jsx(Ui,{visibility:t,onToggle:ei})})]})})}const Xi=[10,20,50,100],Ki=y(a.Select.Positioner),Ji=y(a.Select.Content),Zi=y(a.Select.Item),Qi=y(a.Pagination.PrevTrigger),ea=y(a.Pagination.NextTrigger),ta=y(a.Select.HiddenSelect),na=y(a.Select.Control),ra=y(a.Select.Trigger),oa=y(a.Select.ValueText),sa=y(a.Select.IndicatorGroup),ia=y(a.Select.Indicator);function aa({totalCount:e,pageSize:t,currentPage:n,onPageChange:r,onPageSizeChange:o,siblingCount:i=2,pageSizeOptions:c=Xi}){const l=a.createListCollection({items:c.map(u=>({label:String(u),value:String(u)}))});return s.jsx(a.Box,{width:"100%",children:s.jsxs(a.HStack,{justify:"space-between",mx:"auto",flexWrap:"wrap",children:[s.jsxs(a.HStack,{children:[s.jsx(a.Text,{fontSize:"sm",color:"gray.600",_dark:{color:"gray.400"},children:"Rows per page:"}),s.jsxs(a.Select.Root,{collection:l,size:"sm",width:"60px",onValueChange:u=>o?.(Number(u.items[0].value)),value:[String(t)],children:[s.jsx(ta,{}),s.jsxs(na,{children:[s.jsx(ra,{children:s.jsx(oa,{placeholder:""})}),s.jsx(sa,{children:s.jsx(ia,{})})]}),s.jsx(a.Portal,{children:s.jsx(Ki,{children:s.jsx(Ji,{children:l.items.map(u=>s.jsxs(Zi,{item:u.value,children:[u.label,s.jsx(a.Select.ItemIndicator,{})]},u.value))})})})]}),s.jsxs(a.Text,{fontSize:"sm",color:"gray.600",_dark:{color:"gray.400"},children:["of ",e]})]}),s.jsx(a.Pagination.Root,{count:e,pageSize:t,page:n,siblingCount:i,onPageChange:u=>r&&r(u.page),children:s.jsxs(a.ButtonGroup,{size:"sm",variant:"ghost",children:[s.jsx(Qi,{asChild:!0,children:s.jsx(a.IconButton,{"aria-label":"Previous page",children:s.jsx(bi,{size:18})})}),s.jsx(a.Pagination.Items,{render:u=>s.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)}),s.jsx(ea,{asChild:!0,children:s.jsx(a.IconButton,{"aria-label":"Next page",children:s.jsx(Si,{size:18})})})]})})]})})}const la=y(a.Menu.Item),ca=y(a.Menu.Content),ua=y(a.Menu.Positioner),da=y(a.Menu.Trigger);function fa({data:e=[],actions:t=[],actionConfig:n,onRowSelect:r,onRowSelectEvent:o="left",startIndex:i=0}){const{columnOrder:c,visibility:l,columnWidths:u}=Le(ne);return s.jsx(a.Table.Body,{children:e.map((d,g)=>s.jsxs(a.Table.Row,{onClick:()=>o==="left"&&r?.(d.__raw),_hover:{bg:"blue.50"},onContextMenu:o==="right"?f=>{f.preventDefault(),r?.(d.__raw,f)}:void 0,children:[n?.showSNo&&s.jsx(a.Table.Cell,{textAlign:"center",fontWeight:"medium",children:i+g+1}),c.filter(f=>l[f.id]).map(f=>s.jsx(a.Table.Cell,{w:u[f.id]?u[f.id]+"px":void 0,children:d[f.id]},f.id)),n?.showActionColumn&&s.jsx(a.Table.Cell,{textAlign:"center",display:"flex",gap:2,children:s.jsxs(a.Menu.Root,{children:[s.jsx(da,{asChild:!0,children:s.jsx(a.IconButton,{"aria-label":"Open",variant:"ghost",size:"sm",children:s.jsx(Mi,{size:16})})}),s.jsx(ua,{children:s.jsx(ca,{children:t.filter(f=>typeof f.visible=="function"?f.visible(d.__raw):f.visible!==!1).map(f=>s.jsxs(la,{onClick:()=>f.onClick(d.__raw),colorScheme:f.colorScheme,value:f.label,children:[f.icon,f.label]},f.label))})})]})}),n?.showColumnVisibilityMenu&&s.jsx(a.Table.Cell,{})]},d.__key||d.id))})}function ha({rows:e=6,columns:t}){return s.jsx(a.Table.Body,{children:Array.from({length:e}).map((n,r)=>s.jsx(a.Table.Row,{children:Array.from({length:t}).map((o,i)=>s.jsx(a.Table.Cell,{children:s.jsx(a.Skeleton,{height:"25px"})},i))},r))})}function ga({tableId:e,data:t=[],headers:n=[],loading:r=!1,loadingChildren:o,skeletonLoading:i=!1,emptyMessage:c="No data",actions:l,page:u=1,pageSize:d=10,onPageChange:g,onPageSizeChange:f,density:m="sm",totalCount:p=0,actionConfig:x,pageSizeOptions:b,onRowSelect:C,onRowSelectEvent:_="left"}){h.useEffect(()=>{br(e)},[e]),h.useEffect(()=>{xr(t,n)},[t,n]),h.useEffect(()=>{x&&yr(x)},[x]);const{sortColumn:R,sortDirection:M,data:k,columnOrder:I}=Le(ne),O=h.useMemo(()=>{const L=[...k];return R&&L.sort((P,D)=>M==="asc"?String(P[R]).localeCompare(String(D[R])):String(D[R]).localeCompare(String(P[R]))),L},[k,R,M,u,d]),$=h.useMemo(()=>(Math.max(1,u||1)-1)*d,[u,d]);h.useEffect(()=>{u<1&&g&&g(1)},[u,g]);const N=L=>{const{active:P,over:D}=L;if(!D||P.id===D.id)return;const S=I.findIndex(T=>T.id===P.id),w=I.findIndex(T=>T.id===D.id),j=Ct(I,S,w);Zs(j)},H=r&&!i,B=i&&!r,A=!r&&!i&&O.length===0;return s.jsx(lr,{collisionDetection:qn,onDragEnd:N,children:s.jsx(fr,{items:I.map(L=>L.id),strategy:Ts,children:s.jsxs(a.Box,{flex:"1",minH:0,display:"flex",flexDirection:"column",p:2,children:[s.jsxs(a.Box,{flex:"1",minH:0,position:"relative",overflow:"auto",children:[H&&s.jsx(a.Box,{position:"absolute",inset:0,display:"flex",alignItems:"center",justifyContent:"center",zIndex:10,bg:"whiteAlpha.600",children:o??s.jsx(a.Spinner,{})}),s.jsxs(a.Table.Root,{variant:"outline",w:"100%",size:m,children:[s.jsx(qi,{}),B?s.jsx(ha,{rows:d,columns:n.length+(l?2:0)}):A?s.jsx(a.Table.Body,{children:s.jsx(a.Table.Row,{children:s.jsx(a.Table.Cell,{colSpan:n.length+(l?1:0),children:s.jsx(a.Box,{display:"flex",alignItems:"center",justifyContent:"center",minH:"200px",color:"gray.500",children:c})})})}):s.jsx(fa,{data:O,actions:l,actionConfig:x,onRowSelect:C,startIndex:$,onRowSelectEvent:_})]},e)]}),s.jsx(a.Box,{mt:.5,children:s.jsx(aa,{totalCount:p,pageSize:d,currentPage:u,onPageChange:g,onPageSizeChange:L=>{f?.(L),u>1&&g?.(1)},pageSizeOptions:b})})]})})})}const pa=y(a.Checkbox.Root),va=y(a.Checkbox.HiddenInput),ma=y(a.Checkbox.Control),xa=y(a.Checkbox.Label),Tr=({value:e,onChange:t,size:n="sm",label:r,helperText:o,isDisabled:i,required:c,errorText:l})=>s.jsxs(pa,{value:e,onChange:t,size:n,children:[s.jsx(va,{}),s.jsx(ma,{disabled:i,required:c,errorText:l,helperText:o}),r&&s.jsx(xa,{children:r})]}),ba=y(a.Combobox.Root),ya=y(a.Combobox.Control),Sa=y(a.Combobox.Input),wa=y(a.Combobox.IndicatorGroup),Ca=y(a.Combobox.ClearTrigger),Da=y(a.Combobox.Trigger),ja=y(a.Combobox.Positioner),Ra=y(a.Combobox.Content);function Er({label:e,size:t="sm",width:n="100%",variant:r="outline",items:o=[],itemToString:i,itemToValue:c,renderItem:l,value:u,loading:d,error:g,errorMessage:f,placeholder:m,helpText:p,onInputChange:x,onSelect:b,visible:C=!0,rootProps:_,inputProps:R,controlProps:M,contentProps:k,itemProps:I}){const[O,$]=h.useState(""),N=h.useMemo(()=>Array.isArray(o)?o:[],[o]),{collection:H,set:B}=a.useListCollection({initialItems:N,itemToString:i,itemToValue:c}),A=h.useMemo(()=>{if(!O)return N;const L=O.toLowerCase();return N.filter(P=>i(P).toLowerCase().includes(L))},[o,O,i]);return h.useEffect(()=>{B(A)},[A,B]),h.useEffect(()=>{u&&$(i(u))},[u,i]),s.jsxs(ba,{width:n,size:t,variant:r,collection:H,placeholder:m,onInputValueChange:L=>{x?.(L.inputValue),$(L.inputValue)},value:u?[c(u)]:[],onValueChange:L=>{const P=L.value?.[0];if(!P)return;const D=H.items.find(S=>c(S)===P);D&&b?.(D)},positioning:{sameWidth:!1,placement:"bottom-start"},..._,children:[C&&e&&s.jsx(a.Text,{fontSize:"sm",children:e}),s.jsxs(ya,{...M,children:[s.jsx(Sa,{placeholder:m??"Type to search",...R}),s.jsxs(wa,{children:[s.jsx(Ca,{}),s.jsx(Da,{})]})]}),s.jsx(ja,{children:s.jsxs(Ra,{minW:"sm",...k,children:[d?s.jsxs(a.HStack,{p:"2",children:[s.jsx(a.Spinner,{size:"xs",borderWidth:"1px"}),s.jsx(a.Span,{children:"Loading..."})]}):g?s.jsx(a.Text,{p:"2",color:"red.500",fontSize:"sm",children:f||"Something went wrong"}):H.items.map(L=>s.jsxs(a.Combobox.Item,{item:L,...I,children:[l(L),s.jsx(a.Combobox.ItemIndicator,{})]},c(L))),p&&!g&&!d&&s.jsx(a.Text,{p:"2",color:"fg.muted",fontSize:"sm",children:p})]})})]})}const Ma=y(a.Popover.Root),Ta=y(a.Popover.Content),Ea=y(a.Popover.Arrow),_a=y(a.Popover.Trigger),Oa=y(a.Popover.Positioner);function je(e){if(!e)return"";const t=String(e.getDate()).padStart(2,"0"),n=String(e.getMonth()+1).padStart(2,"0"),r=e.getFullYear();return`${t}-${n}-${r}`}function Nn(e){const t=e.split(/\s+to\s+/i),n=t[0],r=t[1],o=l=>{if(!l)return null;const u=l.trim().split("-");if(u.length!==3)return null;const[d,g,f]=u,m=parseInt(d),p=parseInt(g)-1,x=parseInt(f);if(isNaN(m)||isNaN(p)||isNaN(x)||f.length!==4)return null;const b=new Date(x,p,m);return b.getDate()===m&&b.getMonth()===p?b:null},i=o(n),c=o(r);return{start:i,end:c}}function _r({startDate:e,endDate:t,onChange:n,width:r="280px",showLabel:o=!0,label:i="Select date range",visible:c=!0}){const[l,u]=h.useState(!1),[d,g]=h.useState(e||new Date),[f,m]=h.useState(null),[p,x]=h.useState(e||null),[b,C]=h.useState(t||null),_=(L,P)=>L&&P?`${je(L)} to ${je(P)}`:L?`${je(L)}`:"",[R,M]=h.useState(_(e,t));h.useEffect(()=>{x(e||null),C(t||null)},[e,t]);const k=new Date(d.getFullYear(),d.getMonth()+1,0).getDate(),I=new Date(d.getFullYear(),d.getMonth(),1).getDay(),O=()=>{g(new Date(d.getFullYear(),d.getMonth()-1,1))},$=()=>{g(new Date(d.getFullYear(),d.getMonth()+1,1))},N=L=>{const P=new Date(d.getFullYear(),d.getMonth(),L);if(!p||p&&b){x(P),C(null),n(P,null),M(je(P));return}if(p&&!b){const D=P<p?P:p,S=P<p?p:P;x(D),C(S),n(D,S),M(`${je(D)} to ${je(S)}`),u(!1)}},H=L=>{const P=L.target.value;M(P);const{start:D,end:S}=Nn(P);if(D&&S){const w=D<S?D:S,j=D<S?S:D;n(w,j),g(w)}else D&&!P.toLowerCase().includes("to")&&n(D,null)},B=L=>{if(L.key!=="Enter")return;const{start:P,end:D}=Nn(R);if(P&&!D&&!R.toLowerCase().includes("to")){const S=`${je(P)} to `;M(S),x(P),C(null),n(P,null),requestAnimationFrame(()=>{L.target.setSelectionRange(S.length,S.length)});return}if(P&&D){const S=P<D?P:D,w=P<D?D:P;x(S),C(w),n(S,w),u(!1)}},A=()=>{x(null),C(null),M(""),n(null,null)};return s.jsxs(a.Box,{width:r,onKeyDown:B,children:[o&&!c&&s.jsx(a.Text,{fontSize:"xs",color:"fg.muted",mb:1,fontWeight:"medium",children:i}),s.jsxs(Ma,{open:l,onOpenChange:L=>u(L.open),positioning:{placement:"bottom-start",gutter:4},children:[s.jsxs(a.Group,{attached:!0,w:"full",position:"relative",children:[s.jsx(a.Input,{placeholder:"DD-MM-YYYY to DD-MM-YYYY",value:R,onChange:H,size:"sm",autoComplete:"off"}),R&&s.jsx(a.IconButton,{size:"xs",variant:"ghost","aria-label":"Clear date",onClick:A,position:"absolute",right:"32px",top:"50%",transform:"translateY(-50%)",children:s.jsx(Mr,{size:14})}),s.jsx(_a,{asChild:!0,children:s.jsx(a.InputAddon,{cursor:"pointer",px:2,_hover:{bg:"gray.100"},transition:"background 0.2s",children:s.jsx(Dr,{size:16})})})]}),s.jsx(Oa,{children:s.jsxs(Ta,{width:"300px",p:4,boxShadow:"xl",zIndex:1e3,borderRadius:"md",outline:"none",children:[s.jsx(Ea,{}),s.jsxs(a.HStack,{justify:"space-between",mb:4,children:[s.jsx(a.IconButton,{size:"xs",variant:"ghost",onClick:O,"aria-label":"Previous month",children:"‹"}),s.jsx(a.Text,{fontWeight:"bold",fontSize:"sm",children:d.toLocaleString("default",{month:"long",year:"numeric"})}),s.jsx(a.IconButton,{size:"xs",variant:"ghost",onClick:$,"aria-label":"Next month",children:"›"})]}),s.jsxs(a.Grid,{templateColumns:"repeat(7, 1fr)",gap:1,textAlign:"center",children:[["S","M","T","W","T","F","S"].map((L,P)=>s.jsx(a.Text,{fontSize:"xs",fontWeight:"bold",color:"fg.subtle",py:1,children:L},`${L}-${P}`)),Array(I).fill(null).map((L,P)=>s.jsx(a.Box,{},`empty-${P}`)),Array.from({length:k},(L,P)=>{const D=P+1,S=new Date(d.getFullYear(),d.getMonth(),D);let w=e,j=t;if(w&&j&&f)if(e&&t){const W=e.getTime()+(t.getTime()-e.getTime())/2;f.getTime()<=W?w=f:j=f,w>j&&([w,j]=[j,w])}else e&&!t&&(w=f<e?f:e,j=f<e?e:f);const T=w&&S.getTime()===w.getTime(),z=j&&S.getTime()===j.getTime(),Y=w&&j&&S>w&&S<j;let v="transparent",E="gray";T||z?E="blue":Y&&(v="blue.100");let F="md";return Y&&(F="0"),T&&j&&(F=z?"md":"md 0 0 md"),z&&w&&(F=T?"md":"0 md md 0"),s.jsx(a.Button,{size:"xs",variant:"ghost",colorPalette:E,bg:v!=="transparent"?v:void 0,onClick:()=>N(D),onMouseEnter:()=>m(S),onMouseLeave:()=>m(null),minW:"32px",h:"32px",fontSize:"xs",borderRadius:F,_hover:{bg:T||z?void 0:"gray.100"},children:D},D)})]}),s.jsx(a.Text,{fontSize:"10px",color:"fg.muted",mt:3,textAlign:"center",children:"Select Start Date then End Date"})]})})]})]})}const ka=y(a.Popover.Root),Ia=y(a.Popover.Content),$a=y(a.Popover.Arrow),Aa=y(a.Popover.Trigger),La=y(a.Popover.Positioner);function Fn(e){if(!e)return"";const t=String(e.getDate()).padStart(2,"0"),n=String(e.getMonth()+1).padStart(2,"0"),r=e.getFullYear();return`${t}-${n}-${r}`}function Pa(e){const t=e.split("-");if(t.length!==3)return null;const[n,r,o]=t,i=parseInt(n),c=parseInt(r)-1,l=parseInt(o);if(isNaN(i)||isNaN(c)||isNaN(l)||o.length!==4)return null;const u=new Date(l,c,i);return u.getDate()===i&&u.getMonth()===c?u:null}function Or({value:e,onChange:t,width:n="220px",visible:r=!0,label:o="Select date"}){const[i,c]=h.useState(!1),[l,u]=h.useState(e||new Date),[d,g]=h.useState(Fn(e));h.useEffect(()=>{g(Fn(e))},[e]);const f=new Date(l.getFullYear(),l.getMonth()+1,0).getDate(),m=new Date(l.getFullYear(),l.getMonth(),1).getDay(),p=()=>{u(new Date(l.getFullYear(),l.getMonth()-1,1))},x=()=>{u(new Date(l.getFullYear(),l.getMonth()+1,1))},b=R=>{const M=new Date(l.getFullYear(),l.getMonth(),R);t(M),c(!1)},C=R=>{if(i)switch(R.key){case"ArrowLeft":p();break;case"ArrowRight":x();break;case"Escape":c(!1);break}},_=()=>{g(""),t(null)};return s.jsxs(a.Box,{width:n,onKeyDown:C,children:[!r&&s.jsx(a.Text,{fontSize:"xs",color:"fg.muted",mb:1,fontWeight:"medium",children:o}),s.jsxs(ka,{open:i,onOpenChange:R=>c(R.open),positioning:{placement:"bottom-start",gutter:4},children:[s.jsxs(a.Group,{attached:!0,w:"full",position:"relative",children:[d&&s.jsx(a.IconButton,{size:"xs",variant:"ghost","aria-label":"Clear date",onClick:_,position:"absolute",right:"32px",top:"50%",transform:"translateY(-50%)",zIndex:1,children:s.jsx(Mr,{size:14})}),s.jsx(a.Input,{placeholder:"DD-MM-YYYY",value:d,onChange:R=>{const M=R.target.value;g(M);const k=Pa(M);k&&(t(k),u(k))},size:"sm",autoComplete:"off"}),s.jsx(Aa,{asChild:!0,children:s.jsx(a.InputAddon,{cursor:"pointer",px:2,_hover:{bg:"gray.100"},transition:"background 0.2s",children:s.jsx(Dr,{size:16})})})]}),s.jsx(La,{children:s.jsxs(Ia,{width:"300px",p:4,boxShadow:"xl",zIndex:1e3,borderRadius:"md",outline:"none",children:[s.jsx($a,{}),s.jsxs(a.HStack,{justify:"space-between",mb:4,children:[s.jsx(a.IconButton,{size:"xs",variant:"ghost",onClick:p,"aria-label":"Previous month",children:"‹"}),s.jsx(a.Text,{fontWeight:"bold",fontSize:"sm",children:l.toLocaleString("default",{month:"long",year:"numeric"})}),s.jsx(a.IconButton,{size:"xs",variant:"ghost",onClick:x,"aria-label":"Next month",children:"›"})]}),s.jsxs(a.Grid,{templateColumns:"repeat(7, 1fr)",gap:1,textAlign:"center",children:[["S","M","T","W","T","F","S"].map((R,M)=>s.jsx(a.Text,{fontSize:"xs",fontWeight:"bold",color:"fg.subtle",py:1,children:R},`${R}-${M}`)),Array(m).fill(null).map((R,M)=>s.jsx(a.Box,{},`empty-${M}`)),Array.from({length:f},(R,M)=>{const k=M+1,I=e&&e.getDate()===k&&e.getMonth()===l.getMonth()&&e.getFullYear()===l.getFullYear();return s.jsx(a.Button,{size:"xs",variant:I?"solid":"ghost",colorPalette:I?"blue":"gray",onClick:()=>b(k),minW:"32px",h:"32px",fontSize:"xs",borderRadius:"md",children:k},k)})]}),s.jsx(a.Text,{fontSize:"10px",color:"fg.muted",mt:3,textAlign:"center",children:"Use Arrow Keys to change months • Esc to close"})]})})]})]})}const za=y(a.Field.Root),Na=y(a.Field.Label),Fa=y(a.Field.HelperText),Ya=y(a.Field.ErrorText),Gt=({icon:e,value:t,onChange:n,placeholder:r,size:o="xs",variant:i="outline",width:c="100%",label:l,helperText:u,isDisabled:d=!1,required:g=!1,errorText:f,visible:m,type:p="text",min:x=0,max:b=100,step:C=1})=>s.jsxs(za,{width:c,children:[m&&s.jsx(Na,{children:l}),s.jsx(a.InputGroup,{startElement:e,children:s.jsx(a.Input,{value:t,onChange:_=>n?.(_.target.value),placeholder:r,size:o,type:p,variant:i,disabled:d,required:g,min:x,max:b,step:C})}),f&&s.jsx(Ya,{fontSize:"xs",children:f}),u&&s.jsx(Fa,{fontSize:"xs",children:u})]}),Ba=y(a.Field.Root),Wa=y(a.Field.HelperText),Va=y(a.Field.ErrorText),Ha=y(a.Select.Root),Ua=y(a.Select.Label),Ga=y(a.Select.Control),qa=y(a.Select.Trigger),Xa=y(a.Select.ValueText),Ka=y(a.Select.IndicatorGroup),Ja=y(a.Select.Indicator),Za=y(a.Select.Content),Qa=y(a.Select.Item),el=y(a.Select.ItemIndicator),tl=y(a.Select.HiddenSelect),nl=y(a.Select.Positioner),kr=({options:e=[],label:t,value:n,onChange:r,placeholder:o,size:i="xs",width:c="100%",variant:l="outline",helperText:u,isDisabled:d,required:g,errorText:f,visible:m})=>{const p=a.createListCollection({items:e});return s.jsxs(Ba,{disabled:d,required:g,children:[s.jsxs(Ha,{collection:p,variant:l,size:i,width:c,value:n?[n]:[],onValueChange:x=>r?.(x.value[0]),children:[s.jsx(tl,{}),m&&s.jsx(Ua,{children:t}),s.jsxs(Ga,{children:[s.jsx(qa,{children:s.jsx(Xa,{placeholder:o})}),s.jsx(Ka,{children:s.jsx(Ja,{})})]}),s.jsx(nl,{children:s.jsx(Za,{children:p.items.map(x=>s.jsxs(Qa,{item:x,children:[x.label,s.jsx(el,{})]},x.value))})})]}),u&&s.jsx(Wa,{children:u}),f&&s.jsx(Va,{children:f})]})},Ir=(e="default")=>`FILTER_PRESETS_${e}`,rl=e=>{if(!e)return[];try{return JSON.parse(e)}catch{return[]}},ol=e=>typeof window>"u"?[]:rl(localStorage.getItem(Ir(e))),Xe=new mr({}),Qe=e=>{const t=Xe.state;if(e in t)return t[e];const n=ol(e);return Xe.setState(r=>({...r,[e]:n})),n},jt=(e,t)=>{Xe.setState(n=>({...n,[e]:t})),typeof window<"u"&&localStorage.setItem(Ir(e),JSON.stringify(t))},$r=(e,t)=>{const n=[t,...Qe(e)];jt(e,n)},Ar=(e,t)=>{const n=Qe(e).filter(r=>r.id!==t);jt(e,n)},sl=(e,t,n)=>{const r=Qe(e).map(o=>o.id===t?n(o):o);jt(e,r)},il=y(a.Checkbox.Root),al=y(a.Checkbox.HiddenInput),ll=y(a.Checkbox.Control),cl=y(a.Slider.Root),ul=y(a.Slider.Track),dl=y(a.Slider.Range),fl=y(a.Slider.Thumbs),hl=y(a.Slider.Control),gl=({filter:e,onVisibilityChange:t,onSizeChange:n})=>{const{attributes:r,listeners:o,setNodeRef:i,transform:c,transition:l}=gr({id:e.id}),u={transform:ke.Transform.toString(c),transition:l};return s.jsxs(a.VStack,{ref:i,style:u,align:"stretch",border:"1px solid",borderColor:"gray.200",rounded:"md",p:3,mb:3,bg:"white",children:[s.jsxs(a.HStack,{...r,...o,cursor:"grab",userSelect:"none",gap:2,children:[s.jsx(jr,{size:16}),s.jsx(a.Text,{fontWeight:"bold",fontSize:"sm",children:e.label||e.id})]}),s.jsxs(a.HStack,{justify:"space-between",children:[s.jsx(a.Text,{fontSize:"sm",children:"Visible"}),s.jsxs(il,{checked:e.visible,size:"sm",onCheckedChange:d=>t?.(e.id,!!d.checked),children:[s.jsx(al,{}),s.jsx(ll,{})]})]}),s.jsxs(a.VStack,{align:"stretch",gap:1,children:[s.jsx(a.Text,{fontSize:"sm",children:"Size"}),s.jsx(cl,{min:1,max:5,step:.5,value:[e.size??1],onValueChange:d=>n?.(e.id,d.value[0]),children:s.jsxs(hl,{children:[s.jsx(ul,{children:s.jsx(dl,{})}),s.jsx(fl,{})]})})]})]})},pl=y(a.Drawer.Root),vl=y(a.Drawer.Trigger),ml=y(a.Drawer.Backdrop),xl=y(a.Drawer.Positioner),bl=y(a.Drawer.Content),yl=y(a.Drawer.Header),Sl=y(a.Drawer.Title),wl=y(a.Drawer.Body),Cl=y(a.Drawer.Footer),Dl=y(a.Drawer.CloseTrigger),jl=y(a.Tabs.Root),Rl=y(a.Tabs.List),Nt=y(a.Tabs.Trigger),Ft=y(a.Tabs.Content),Lr=(e,t)=>{if(e.customComponent)return e.customComponent;switch(console.log(e.type),e.type){case"text":return s.jsx(Gt,{placeholder:e.label,value:e.value,onChange:e.onChange,label:e.label,visible:t});case"number":return s.jsx(Gt,{label:e.label,value:e.value,onChange:e.onChange});case"checkbox":return s.jsx(Tr,{label:e.label,value:e.value,onChange:e.onChange});case"select":return s.jsx(kr,{label:e.label,value:e.value,onChange:e.onChange,options:e.options??[],visible:t,placeholder:e.placeholder});case"date":return s.jsx(Or,{value:e.value,onChange:e.onChange,visible:t,label:e.label});case"date-range":return s.jsx(_r,{startDate:e.startDate?new Date(e.startDate):void 0,endDate:e.endDate?new Date(e.endDate):void 0,onChange:e.onChange,visible:t,label:e.label});case"combobox":return s.jsx(Er,{visible:!0,label:e.label,items:e.options,itemToString:n=>n.label,itemToValue:n=>n.value,renderItem:n=>s.jsx("span",{children:n.label})});default:return null}},Ml=({filterDrawerSize:e="sm",onVisibilityChange:t,onSizeChange:n,onClear:r,filters:o,pageKey:i="default",onLoadPreset:c,activePresetName:l,onReorder:u,open:d,onOpenChange:g})=>{const m=Le(Xe)[i]??Qe(i),p=()=>{const x=prompt("Preset name?");if(!x)return;const b=o.reduce((C,_)=>(C[_.id]=_.value,C),{});$r(i,{id:crypto.randomUUID(),name:x,date:new Date().toISOString(),values:b})};return s.jsx(a.HStack,{wrap:"wrap",children:s.jsxs(pl,{size:e,open:d,onOpenChange:g,children:[s.jsx(vl,{asChild:!0,children:s.jsxs(a.IconButton,{"aria-label":"Open filters",variant:"outline",size:"xs",ml:2,p:2,children:[s.jsx(Ei,{size:16}),"Filters"]})}),s.jsxs(a.Portal,{children:[s.jsx(ml,{}),s.jsx(xl,{children:s.jsxs(bl,{children:[s.jsx(yl,{children:s.jsx(Sl,{children:"Filters"})}),s.jsx(wl,{overflowY:"auto",pt:1,children:s.jsxs(jl,{defaultValue:"view",children:[s.jsxs(Rl,{mb:4,children:[s.jsxs(Nt,{value:"view",children:[s.jsx(ki,{size:16}),"Edit"]}),s.jsxs(Nt,{value:"settings",children:[s.jsx(Li,{size:16}),"Settings"]}),s.jsxs(Nt,{value:"presets",children:[s.jsx(vi,{size:16}),"Presets"]})]}),s.jsx(Ft,{value:"view",children:o.filter(x=>x.visible).map(x=>s.jsx(a.VStack,{align:"stretch",border:"1px solid",borderColor:"gray.200",flex:x.size??1,minW:`${(x.size??1)*100}px`,rounded:"md",p:3,mb:3,children:Lr(x,d)},x.id))}),s.jsx(Ft,{value:"settings",children:s.jsx(lr,{sensors:po(go(on)),collisionDetection:qn,onDragEnd:({active:x,over:b})=>{if(!b||x.id===b.id)return;const C=o.findIndex(M=>M.id===x.id),_=o.findIndex(M=>M.id===b.id),R=Ct(o,C,_);u?.(R)},children:s.jsx(fr,{items:o.map(x=>x.id),strategy:_s,children:o.map(x=>s.jsx(gl,{filter:x,onVisibilityChange:t,onSizeChange:n},x.id))})})}),s.jsx(Ft,{value:"presets",children:s.jsxs(a.VStack,{align:"stretch",mb:3,children:[m.length===0&&s.jsx(a.Text,{fontSize:"xs",color:"gray.500",children:"No presets saved yet."}),m.map(x=>s.jsxs(a.HStack,{justify:"space-between",border:"1px solid",borderColor:l===x.name?"blue.300":"gray.200",rounded:"md",p:2,children:[s.jsxs(a.VStack,{align:"start",gap:0,children:[s.jsx(a.Text,{fontWeight:"bold",fontSize:"sm",children:x.name}),s.jsx(a.Text,{fontSize:"xs",color:"gray.500",children:new Date(x.date).toLocaleDateString()})]}),s.jsxs(a.HStack,{children:[s.jsx(a.Button,{size:"xs",variant:"ghost",onClick:()=>{const b=o.map(C=>({...C,value:x.values[C.id]??C.value}));c?.(b,x.name)},children:"Load"}),s.jsx(a.IconButton,{size:"xs","aria-label":"Delete preset",variant:"ghost",onClick:()=>Ar(i,x.id),children:s.jsx(ji,{size:14})})]})]},x.id)),s.jsx(a.Button,{size:"sm",colorScheme:"blue",onClick:p,children:"Save Current Filters"})]})})]})}),s.jsx(Cl,{justify:"space-between",children:s.jsx(Dl,{asChild:!0,children:s.jsx(a.CloseButton,{})})})]})})]})]})})},Tl=({title:e,filters:t,onVisibilityChange:n,onReorder:r,onSizeChange:o,onClear:i,maxToolbarUnits:c,pageKey:l,onLoadPreset:u,activePresetName:d,filterDrawerSize:g="sm"})=>{const[f,m]=h.useState(!1);return s.jsxs(a.HStack,{wrap:"wrap",pl:2,pr:2,width:"100%",justify:"space-between",children:[e,s.jsxs(a.HStack,{gapX:1,children:[t.filter(p=>p.visible!==!1).map(p=>s.jsx(a.HStack,{flex:p.size??1,minW:`${(p.size??1)*100}px`,alignItems:"center",children:Lr(p)},p.id)),s.jsx(Ml,{filterDrawerSize:g,onVisibilityChange:n,onReorder:r,onSizeChange:o,onClear:i,maxToolbarUnits:c,pageKey:l,filters:t,onLoadPreset:u,activePresetName:d,open:f,onOpenChange:p=>{m(p.open)}})]})]})},El=(e,t)=>{localStorage.setItem(`FILTER_ORDER_${e}`,JSON.stringify(t))},_l=e=>{try{return JSON.parse(localStorage.getItem(`FILTER_ORDER_${e}`)||"[]")}catch{return[]}},Ol=({onClick:e,size:t="xs",variant:n="solid",label:r,leftIcon:o,rightIcon:i,isDisabled:c,colorScheme:l,loading:u,loadingText:d,rounded:g,type:f="button",textColor:m="white",borderColor:p})=>s.jsx(a.Button,{onClick:e,size:t,variant:n,disabled:c,loading:u,loadingText:d,rounded:g,type:f,background:l,color:m,border:p,children:s.jsxs(a.HStack,{gap:1,children:[o,r,i]})}),kl=y(a.Dialog.Root),Il=y(a.Dialog.Backdrop),$l=y(a.Dialog.Positioner),Al=y(a.Dialog.Content),Ll=y(a.Dialog.Header),Pl=y(a.Dialog.Body),zl=y(a.Dialog.Footer),Nl=y(a.Dialog.Title),Fl=y(a.Dialog.CloseTrigger);function Yl({open:e,onClose:t,onConfirm:n,title:r="Confirm Action",description:o="Are you sure you want to continue?",confirmLabel:i="Confirm",cancelLabel:c="Cancel",icon:l,isLoading:u=!1,confirmButtonColorScheme:d="#4169e1"}){return s.jsx(kl,{open:e,placement:"center",onOpenChange:g=>!g.open&&t(),children:s.jsxs(a.Portal,{children:[s.jsx(Il,{}),s.jsx($l,{children:s.jsxs(Al,{maxW:"480px",children:[s.jsx(Ll,{borderBottom:"1px solid",borderColor:"gray.200",children:s.jsx(Nl,{children:r})}),s.jsx(Pl,{p:6,children:s.jsxs(a.Stack,{gap:4,align:"center",textAlign:"center",children:[s.jsx(a.Box,{color:"orange.500",children:l??s.jsx(Rr,{size:40})}),s.jsx(a.Text,{fontSize:"sm",color:"gray.600",children:o})]})}),s.jsxs(zl,{justifyContent:"flex-end",gap:2,borderTop:"1px solid",borderColor:"gray.200",children:[s.jsx(a.Button,{variant:"outline",size:"sm",onClick:t,children:c}),s.jsx(a.Button,{size:"sm",style:{backgroundColor:d},loading:u,onClick:n,children:i})]}),s.jsx(Fl,{asChild:!0,children:s.jsx(a.CloseButton,{size:"sm"})})]})})]})})}const Bl=y(a.Dialog.Root),Wl=y(a.Dialog.Backdrop),Vl=y(a.Dialog.Positioner),Hl=y(a.Dialog.Content),Ul=y(a.Dialog.Header),Gl=y(a.Dialog.Body),ql=y(a.Dialog.Footer),Xl=y(a.Dialog.Title),Kl=y(a.Dialog.CloseTrigger);function Jl({open:e,onClose:t,onConfirm:n,title:r="Delete Company",entityName:o,confirmText:i="DELETE",confirmLabel:c="Delete",isLoading:l=!1}){const[u,d]=h.useState(""),g=u===i;return s.jsx(Bl,{open:e,placement:"center",onOpenChange:f=>{!f.open&&t(),d("")},children:s.jsxs(a.Portal,{children:[s.jsx(Wl,{}),s.jsx(Vl,{children:s.jsxs(Hl,{maxW:"550px",children:[s.jsx(Ul,{borderBottom:"1px solid",borderColor:"#d3d3d3",children:s.jsx(Xl,{color:"red.600",children:r})}),s.jsx(Gl,{p:2,style:{padding:"16px"},children:s.jsxs(a.Stack,{gap:4,borderRadius:"md",p:4,bg:"white",children:[s.jsx(a.Box,{border:"1px solid",borderColor:"red.200",bg:"red.50",borderRadius:"md",p:4,children:s.jsxs(a.Stack,{direction:"row",gap:3,align:"flex-start",children:[s.jsx(a.Box,{color:"red.600",mt:"2px",children:s.jsx(Rr,{size:20})}),s.jsxs(a.Box,{children:[s.jsx(a.Text,{fontWeight:"semibold",color:"red.700",children:"Are you sure?"}),s.jsxs(a.Text,{fontSize:"sm",color:"red.600",children:["All the data of ",s.jsx("b",{children:o})," will permanently be deleted."]})]})]})}),s.jsx(a.Text,{fontSize:"sm",color:"gray.600",children:"You can’t undo this action afterwards."}),s.jsxs(a.Box,{children:[s.jsxs(a.Text,{fontSize:"sm",mb:2,children:["Type ",s.jsx("b",{children:i})," to continue"]}),s.jsx(a.Input,{placeholder:`Type ${i} here`,value:u,onChange:f=>d(f.target.value),size:"xs"})]})]})}),s.jsxs(ql,{justifyContent:"flex-end",gap:2,borderTop:"1px solid",borderColor:"#d3d3d3",children:[s.jsx(a.Button,{variant:"outline",size:"sm",onClick:()=>{t(),d("")},children:"Cancel"}),s.jsx(a.Button,{size:"sm",disabled:!g,style:{backgroundColor:"#FF0000"},loading:l,onClick:n,children:c})]}),s.jsx(Kl,{asChild:!0,children:s.jsx(a.CloseButton,{size:"sm"})})]})})]})})}const Pr=({children:e})=>s.jsx(s.Fragment,{children:e}),zr=({children:e})=>s.jsx(s.Fragment,{children:e}),Zl=a.Button,Ql=y(a.Dialog.Root),ec=y(a.Dialog.Backdrop),tc=y(a.Dialog.Positioner),nc=y(a.Dialog.Content),rc=y(a.Dialog.Header),oc=y(a.Dialog.Body),sc=y(a.Dialog.Footer),ic=y(a.Dialog.Title),ac=y(a.Dialog.CloseTrigger);function lc(e){let t=null,n=null;return h.Children.forEach(e,r=>{h.isValidElement(r)&&(r.type===Pr&&(t=r.props.children),r.type===zr&&(n=r.props.children))}),{body:t,actions:n}}const cc=({open:e,onClose:t,title:n,children:r,width:o,position:i,refetch:c,loading:l=!1})=>{const{body:u,actions:d}=lc(r);return s.jsx(Ql,{open:e,onOpenChange:g=>!g.open&&t(),placement:i??"center",children:s.jsxs(a.Portal,{children:[s.jsx(ec,{bg:"blackAlpha.400"}),s.jsx(tc,{children:s.jsxs(nc,{w:o??"560px",maxW:o??"560px",borderRadius:"6px",overflow:"hidden",boxShadow:"lg",children:[s.jsx(rc,{px:"20px",py:"16px",bg:"white",borderBottom:"1px solid",borderColor:"gray.200",children:s.jsxs(a.Flex,{align:"center",justify:"space-between",children:[s.jsx(ic,{fontSize:"16px",fontWeight:"600",children:n}),s.jsx(ac,{asChild:!0,children:s.jsx(a.CloseButton,{size:"sm"})}),c&&s.jsx(sn,{label:"Refresh",refetch:c,isLoading:l})]})}),u&&s.jsx(oc,{px:"20px",py:"16px",bg:"#F8FAFC",type:"submit",children:s.jsx(a.Flex,{direction:"column",gap:"16px",children:u})}),d&&s.jsx(sc,{px:"20px",py:"16px",bg:"white",borderTop:"1px solid",borderColor:"gray.200",children:s.jsx(a.Flex,{ml:"auto",gap:"12px",children:d})})]})})]})})},uc=y(a.Field.Root),dc=y(a.Field.Label),fc=y(a.Field.HelperText),hc=y(a.Field.ErrorText),gc=y(a.PinInput.Input),pc=y(a.PinInput.Control),vc=y(a.PinInput.HiddenInput),mc=y(a.PinInput.Root),xc=({value:e,onChange:t,length:n=4,size:r="xs",isDisabled:o=!1,label:i,helperText:c,errorText:l,required:u=!1,visible:d=!0})=>{const g=Array.from({length:n}).map((f,m)=>e?.[m]??"");return s.jsxs(uc,{children:[d&&i&&s.jsxs(dc,{children:[i,u&&" *"]}),s.jsxs(mc,{value:g,onValueChange:f=>t?.(f.value.join("")),disabled:o,size:r,children:[s.jsx(vc,{}),s.jsx(pc,{children:s.jsx(a.HStack,{children:Array.from({length:n}).map((f,m)=>s.jsx(gc,{index:m},m))})})]}),l&&s.jsx(hc,{fontSize:"xs",children:l}),c&&!l&&s.jsx(fc,{fontSize:"xs",children:c})]})};function sn({refetch:e,isLoading:t=!1,label:n="Refresh"}){const[r,o]=h.useState(!1),i=async()=>{o(!0);try{await e()}finally{setTimeout(()=>o(!1),300)}};return s.jsx(a.IconButton,{"aria-label":n,size:"xs",variant:"outline",disabled:t||r,onClick:i,ml:2,children:s.jsx($i,{size:14,style:{animation:r?"spin 0.6s linear infinite":void 0}})})}var ut={exports:{}},bc=ut.exports,Yn;function yc(){return Yn||(Yn=1,(function(e,t){(function(n,r){e.exports=r()})(bc,(function(){var n=1e3,r=6e4,o=36e5,i="millisecond",c="second",l="minute",u="hour",d="day",g="week",f="month",m="quarter",p="year",x="date",b="Invalid Date",C=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,_=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,R={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(D){var S=["th","st","nd","rd"],w=D%100;return"["+D+(S[(w-20)%10]||S[w]||S[0])+"]"}},M=function(D,S,w){var j=String(D);return!j||j.length>=S?D:""+Array(S+1-j.length).join(w)+D},k={s:M,z:function(D){var S=-D.utcOffset(),w=Math.abs(S),j=Math.floor(w/60),T=w%60;return(S<=0?"+":"-")+M(j,2,"0")+":"+M(T,2,"0")},m:function D(S,w){if(S.date()<w.date())return-D(w,S);var j=12*(w.year()-S.year())+(w.month()-S.month()),T=S.clone().add(j,f),z=w-T<0,Y=S.clone().add(j+(z?-1:1),f);return+(-(j+(w-T)/(z?T-Y:Y-T))||0)},a:function(D){return D<0?Math.ceil(D)||0:Math.floor(D)},p:function(D){return{M:f,y:p,w:g,d,D:x,h:u,m:l,s:c,ms:i,Q:m}[D]||String(D||"").toLowerCase().replace(/s$/,"")},u:function(D){return D===void 0}},I="en",O={};O[I]=R;var $="$isDayjsObject",N=function(D){return D instanceof L||!(!D||!D[$])},H=function D(S,w,j){var T;if(!S)return I;if(typeof S=="string"){var z=S.toLowerCase();O[z]&&(T=z),w&&(O[z]=w,T=z);var Y=S.split("-");if(!T&&Y.length>1)return D(Y[0])}else{var v=S.name;O[v]=S,T=v}return!j&&T&&(I=T),T||!j&&I},B=function(D,S){if(N(D))return D.clone();var w=typeof S=="object"?S:{};return w.date=D,w.args=arguments,new L(w)},A=k;A.l=H,A.i=N,A.w=function(D,S){return B(D,{locale:S.$L,utc:S.$u,x:S.$x,$offset:S.$offset})};var L=(function(){function D(w){this.$L=H(w.locale,null,!0),this.parse(w),this.$x=this.$x||w.x||{},this[$]=!0}var S=D.prototype;return S.parse=function(w){this.$d=(function(j){var T=j.date,z=j.utc;if(T===null)return new Date(NaN);if(A.u(T))return new Date;if(T instanceof Date)return new Date(T);if(typeof T=="string"&&!/Z$/i.test(T)){var Y=T.match(C);if(Y){var v=Y[2]-1||0,E=(Y[7]||"0").substring(0,3);return z?new Date(Date.UTC(Y[1],v,Y[3]||1,Y[4]||0,Y[5]||0,Y[6]||0,E)):new Date(Y[1],v,Y[3]||1,Y[4]||0,Y[5]||0,Y[6]||0,E)}}return new Date(T)})(w),this.init()},S.init=function(){var w=this.$d;this.$y=w.getFullYear(),this.$M=w.getMonth(),this.$D=w.getDate(),this.$W=w.getDay(),this.$H=w.getHours(),this.$m=w.getMinutes(),this.$s=w.getSeconds(),this.$ms=w.getMilliseconds()},S.$utils=function(){return A},S.isValid=function(){return this.$d.toString()!==b},S.isSame=function(w,j){var T=B(w);return this.startOf(j)<=T&&T<=this.endOf(j)},S.isAfter=function(w,j){return B(w)<this.startOf(j)},S.isBefore=function(w,j){return this.endOf(j)<B(w)},S.$g=function(w,j,T){return A.u(w)?this[j]:this.set(T,w)},S.unix=function(){return Math.floor(this.valueOf()/1e3)},S.valueOf=function(){return this.$d.getTime()},S.startOf=function(w,j){var T=this,z=!!A.u(j)||j,Y=A.p(w),v=function(J,V){var se=A.w(T.$u?Date.UTC(T.$y,V,J):new Date(T.$y,V,J),T);return z?se:se.endOf(d)},E=function(J,V){return A.w(T.toDate()[J].apply(T.toDate("s"),(z?[0,0,0,0]:[23,59,59,999]).slice(V)),T)},F=this.$W,W=this.$M,q=this.$D,X="set"+(this.$u?"UTC":"");switch(Y){case p:return z?v(1,0):v(31,11);case f:return z?v(1,W):v(0,W+1);case g:var U=this.$locale().weekStart||0,K=(F<U?F+7:F)-U;return v(z?q-K:q+(6-K),W);case d:case x:return E(X+"Hours",0);case u:return E(X+"Minutes",1);case l:return E(X+"Seconds",2);case c:return E(X+"Milliseconds",3);default:return this.clone()}},S.endOf=function(w){return this.startOf(w,!1)},S.$set=function(w,j){var T,z=A.p(w),Y="set"+(this.$u?"UTC":""),v=(T={},T[d]=Y+"Date",T[x]=Y+"Date",T[f]=Y+"Month",T[p]=Y+"FullYear",T[u]=Y+"Hours",T[l]=Y+"Minutes",T[c]=Y+"Seconds",T[i]=Y+"Milliseconds",T)[z],E=z===d?this.$D+(j-this.$W):j;if(z===f||z===p){var F=this.clone().set(x,1);F.$d[v](E),F.init(),this.$d=F.set(x,Math.min(this.$D,F.daysInMonth())).$d}else v&&this.$d[v](E);return this.init(),this},S.set=function(w,j){return this.clone().$set(w,j)},S.get=function(w){return this[A.p(w)]()},S.add=function(w,j){var T,z=this;w=Number(w);var Y=A.p(j),v=function(W){var q=B(z);return A.w(q.date(q.date()+Math.round(W*w)),z)};if(Y===f)return this.set(f,this.$M+w);if(Y===p)return this.set(p,this.$y+w);if(Y===d)return v(1);if(Y===g)return v(7);var E=(T={},T[l]=r,T[u]=o,T[c]=n,T)[Y]||1,F=this.$d.getTime()+w*E;return A.w(F,this)},S.subtract=function(w,j){return this.add(-1*w,j)},S.format=function(w){var j=this,T=this.$locale();if(!this.isValid())return T.invalidDate||b;var z=w||"YYYY-MM-DDTHH:mm:ssZ",Y=A.z(this),v=this.$H,E=this.$m,F=this.$M,W=T.weekdays,q=T.months,X=T.meridiem,U=function(V,se,re,fe){return V&&(V[se]||V(j,z))||re[se].slice(0,fe)},K=function(V){return A.s(v%12||12,V,"0")},J=X||function(V,se,re){var fe=V<12?"AM":"PM";return re?fe.toLowerCase():fe};return z.replace(_,(function(V,se){return se||(function(re){switch(re){case"YY":return String(j.$y).slice(-2);case"YYYY":return A.s(j.$y,4,"0");case"M":return F+1;case"MM":return A.s(F+1,2,"0");case"MMM":return U(T.monthsShort,F,q,3);case"MMMM":return U(q,F);case"D":return j.$D;case"DD":return A.s(j.$D,2,"0");case"d":return String(j.$W);case"dd":return U(T.weekdaysMin,j.$W,W,2);case"ddd":return U(T.weekdaysShort,j.$W,W,3);case"dddd":return W[j.$W];case"H":return String(v);case"HH":return A.s(v,2,"0");case"h":return K(1);case"hh":return K(2);case"a":return J(v,E,!0);case"A":return J(v,E,!1);case"m":return String(E);case"mm":return A.s(E,2,"0");case"s":return String(j.$s);case"ss":return A.s(j.$s,2,"0");case"SSS":return A.s(j.$ms,3,"0");case"Z":return Y}return null})(V)||Y.replace(":","")}))},S.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},S.diff=function(w,j,T){var z,Y=this,v=A.p(j),E=B(w),F=(E.utcOffset()-this.utcOffset())*r,W=this-E,q=function(){return A.m(Y,E)};switch(v){case p:z=q()/12;break;case f:z=q();break;case m:z=q()/3;break;case g:z=(W-F)/6048e5;break;case d:z=(W-F)/864e5;break;case u:z=W/o;break;case l:z=W/r;break;case c:z=W/n;break;default:z=W}return T?z:A.a(z)},S.daysInMonth=function(){return this.endOf(f).$D},S.$locale=function(){return O[this.$L]},S.locale=function(w,j){if(!w)return this.$L;var T=this.clone(),z=H(w,j,!0);return z&&(T.$L=z),T},S.clone=function(){return A.w(this.$d,this)},S.toDate=function(){return new Date(this.valueOf())},S.toJSON=function(){return this.isValid()?this.toISOString():null},S.toISOString=function(){return this.$d.toISOString()},S.toString=function(){return this.$d.toUTCString()},D})(),P=L.prototype;return B.prototype=P,[["$ms",i],["$s",c],["$m",l],["$H",u],["$W",d],["$M",f],["$y",p],["$D",x]].forEach((function(D){P[D[1]]=function(S){return this.$g(S,D[0],D[1])}})),B.extend=function(D,S){return D.$i||(D(S,L,B),D.$i=!0),B},B.locale=H,B.isDayjs=N,B.unix=function(D){return B(1e3*D)},B.en=O[I],B.Ls=O,B.p={},B}))})(ut)),ut.exports}var Sc=yc();const Rt=bt(Sc);var dt={exports:{}},wc=dt.exports,Bn;function Cc(){return Bn||(Bn=1,(function(e,t){(function(n,r){e.exports=r()})(wc,(function(){return function(n,r,o){n=n||{};var i=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,g,f,m){return i.fromToBase(d,g,f,m)}o.en.relativeTime=c,i.fromToBase=function(d,g,f,m,p){for(var x,b,C,_=f.$locale().relativeTime||c,R=n.thresholds||[{l:"s",r:44,d:"second"},{l:"m",r:89},{l:"mm",r:44,d:"minute"},{l:"h",r:89},{l:"hh",r:21,d:"hour"},{l:"d",r:35},{l:"dd",r:25,d:"day"},{l:"M",r:45},{l:"MM",r:10,d:"month"},{l:"y",r:17},{l:"yy",d:"year"}],M=R.length,k=0;k<M;k+=1){var I=R[k];I.d&&(x=m?o(d).diff(f,I.d,!0):f.diff(d,I.d,!0));var O=(n.rounding||Math.round)(Math.abs(x));if(C=x>0,O<=I.r||!I.r){O<=1&&k>0&&(I=R[k-1]);var $=_[I.l];p&&(O=p(""+O)),b=typeof $=="string"?$.replace("%d",O):$(O,g,I.l,C);break}}if(g)return b;var N=C?_.future:_.past;return typeof N=="function"?N(b):N.replace("%s",b)},i.to=function(d,g){return l(d,g,this,!0)},i.from=function(d,g){return l(d,g,this)};var u=function(d){return d.$u?o.utc():o()};i.toNow=function(d){return this.to(u(this),d)},i.fromNow=function(d){return this.from(u(this),d)}}}))})(dt)),dt.exports}var Dc=Cc();const jc=bt(Dc);var ft={exports:{}},Rc=ft.exports,Wn;function Mc(){return Wn||(Wn=1,(function(e,t){(function(n,r){e.exports=r()})(Rc,(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,i){var c=o.prototype,l=c.format;i.en.formats=n,c.format=function(u){u===void 0&&(u="YYYY-MM-DDTHH:mm:ssZ");var d=this.$locale().formats,g=(function(f,m){return f.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,(function(p,x,b){var C=b&&b.toUpperCase();return x||m[b]||n[b]||m[C].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,(function(_,R,M){return R||M.slice(1)}))}))})(u,d===void 0?{}:d);return l.call(this,g)}}}))})(ft)),ft.exports}var Tc=Mc();const Ec=bt(Tc);var ht={exports:{}},_c=ht.exports,Vn;function Oc(){return Vn||(Vn=1,(function(e,t){(function(n,r){e.exports=r()})(_c,(function(){return function(n,r){var o=r.prototype,i=o.format;o.format=function(c){var l=this,u=this.$locale();if(!this.isValid())return i.bind(this)(c);var d=this.$utils(),g=(c||"YYYY-MM-DDTHH:mm:ssZ").replace(/\[([^\]]+)]|Q|wo|ww|w|WW|W|zzz|z|gggg|GGGG|Do|X|x|k{1,2}|S/g,(function(f){switch(f){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(),f==="w"?1:2,"0");case"W":case"WW":return d.s(l.isoWeek(),f==="W"?1:2,"0");case"k":case"kk":return d.s(String(l.$H===0?24:l.$H),f==="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 f}}));return i.bind(this)(g)}}}))})(ht)),ht.exports}var kc=Oc();const Ic=bt(kc);Rt.extend(jc);Rt.extend(Ec);Rt.extend(Ic);const $c={date:"DD MMM YYYY",time:"hh:mm A",dateTime:"DD MMM YYYY, hh:mm A",full:"dddd, DD MMM YYYY, hh:mm A",short:"DD/MM/YY",relative:""};function qt({value:e,variant:t="dateTime",format:n,fallback:r="--"}){if(!e)return r;const o=Rt(e);return o.isValid()?t==="relative"?o.fromNow():o.format(n??$c[t]):r}function Ac({value:e,dateVariant:t="date",timeVariant:n="time",dateFormat:r,timeFormat:o,align:i="start",dateColor:c="gray.700",dateFontSize:l="16px",dateFontWeight:u="500",timeColor:d="gray.500",timeFontSize:g="12px",timeFontWeight:f="400",showTime:m=!0}){return s.jsxs(a.Stack,{gap:.5,align:i,children:[s.jsx(a.Text,{fontSize:l,fontWeight:u,color:c,children:qt({value:e,variant:t,format:r})}),m&&s.jsx(a.Text,{fontSize:g,fontWeight:f,color:d,children:qt({value:e,variant:n,format:o})})]})}class Nr{state=new Map;listeners=new Map;get(t){return this.state.get(t)}set(t){this.state.set(t.key,t),this.notify(t.key)}setMany(t){t.forEach(n=>this.set(n))}subscribe(t,n){return this.listeners.has(t)||this.listeners.set(t,new Set),this.listeners.get(t).add(n),n(this.state.get(t)),()=>{this.listeners.get(t)?.delete(n)}}notify(t){this.listeners.get(t)?.forEach(n=>n(this.state.get(t)))}clear(){this.state.clear()}}class Xt{constructor(t){this.baseUrl=t}async fetchLatest(t){const n=new URLSearchParams;return n.set("keys",t.join(",")),(await(await fetch(`${this.baseUrl}/options?${n}`)).json()).data}}class Kt{constructor(t){this.api=t}store=new Nr;inflight=new Map;getRaw(t){return this.store.get(t)}async getKey(t){const n=this.store.get(t);return n?n.value:(await this.fetchMissing([t]),this.store.get(t)?.value)}async getMultiKey(t){const n={},r=[];for(const o of t){const i=this.store.get(o);i?n[o]=i.value:r.push(o)}return r.length&&(await this.fetchMissing(r),r.forEach(o=>{const i=this.store.get(o);i&&(n[o]=i.value)})),n}subscribe(t,n){return this.store.subscribe(t,n)}hydrate(t){this.store.setMany(t)}clear(){this.store.clear()}async fetchMissing(t){const n=t.filter(o=>!this.inflight.has(o));if(!n.length)return;const r=this.api.fetchLatest(n).then(o=>{this.store.setMany(o),n.forEach(i=>this.inflight.delete(i))});n.forEach(o=>this.inflight.set(o,r)),await r}}const Fr=h.createContext(null);function Yr(){const e=h.useContext(Fr);if(!e)throw new Error("OptionsProvider is missing. Wrap your app with <OptionsProvider />");return e}function Lc({client:{apiUrl:e},children:t}){const n=h.useRef(new Kt(new Xt(e)));return n.current||(n.current=new Kt(new Xt(e))),s.jsx(Fr.Provider,{value:n.current,children:t})}function Pc(e){const t=Yr(),[n,r]=h.useState(t.getRaw(e)?.value);return h.useEffect(()=>{let o=!0;t.getKey(e).then(c=>{o&&r(c)});const i=t.subscribe(e,c=>{r(c?.value)});return()=>{o=!1,i()}},[e,t]),n}function zc(e){const t=Yr(),[n,r]=h.useState({});return h.useEffect(()=>{let o=!0;t.getMultiKey(e).then(c=>{o&&r(c)});const i=e.map(c=>t.subscribe(c,l=>{r(u=>({...u,[c]:l?.value}))}));return()=>{o=!1,i.forEach(c=>c())}},[e.join("|"),t]),n}async function Nc(e,t){return e.getKey(t)}async function Fc(e,t){await e.getMultiKey(t)}function Yc(e={}){const{initialPage:t=1,initialLimit:n=20}=e,[r,o]=h.useState(t),[i,c]=h.useState(n),l=h.useCallback(m=>{o(Math.max(1,m))},[]),u=h.useCallback(m=>{c(Math.max(1,m)),o(1)},[]),d=h.useCallback(()=>{o(m=>m+1)},[]),g=h.useCallback(()=>{o(m=>Math.max(1,m-1))},[]),f=h.useCallback(()=>{o(t),c(n)},[t,n]);return{page:r,limit:i,setPage:l,setLimit:u,nextPage:d,prevPage:g,reset:f}}function Bc(e={}){const{initialValue:t="",delay:n=300}=e,[r,o]=h.useState(t),i=Wc(r,n),c=h.useCallback(u=>{o(u)},[]),l=h.useCallback(()=>{o(t)},[t]);return{search:r,debouncedSearch:i,onSearchChange:c,reset:l}}function Wc(e,t=300){const[n,r]=h.useState(e);return h.useEffect(()=>{const o=setTimeout(()=>{r(e)},t);return()=>clearTimeout(o)},[e,t]),n}exports.DataTable=ga;exports.Filters=Tl;exports.HttpOptionsApi=Xt;exports.MDSButton=Ol;exports.MDSCheckbox=Tr;exports.MDSCombobox=Er;exports.MDSConfirmActionDialog=Yl;exports.MDSConfirmDeleteDialog=Jl;exports.MDSDatePicker=Or;exports.MDSDateRangePicker=_r;exports.MDSDialogAction=Zl;exports.MDSDialogActions=zr;exports.MDSDialogBody=Pr;exports.MDSDialogWrapper=cc;exports.MDSInput=Gt;exports.MDSPinInput=xc;exports.MDSRefreshButton=sn;exports.MDSSelectBox=kr;exports.OptionsClientImpl=Kt;exports.OptionsProvider=Lc;exports.OptionsStore=Nr;exports.RefreshButton=sn;exports.StackedDateTime=Ac;exports.addPreset=$r;exports.deletePreset=Ar;exports.formatDateTime=qt;exports.getColumnWidthKey=Dt;exports.getOption=Nc;exports.getPresets=Qe;exports.loadOrder=_l;exports.prefetchOptions=Fc;exports.presetStore=Xe;exports.saveOrder=El;exports.savePresets=jt;exports.setActionsConfig=yr;exports.setColumnWidth=Js;exports.setData=xr;exports.setTableId=br;exports.tableStore=ne;exports.updatePreset=sl;exports.useDebouncedSearch=Bc;exports.useOption=Pc;exports.useOptions=zc;exports.usePagination=Yc;exports.withChildren=y;
|