@mdspl/mds-shared-ui 0.3.3 → 0.3.5

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