@mdspl/mds-shared-ui 0.4.2 → 0.4.4

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