@mdspl/mds-shared-ui 0.1.9 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +3 -3
- package/dist/index.d.ts +38 -50
- package/dist/index.js +2414 -2046
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("react"),c=require("@chakra-ui/react"),Ue=require("react-dom");var ot={exports:{}},Be={};var an;function wr(){if(an)return Be;an=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 Be.Fragment=t,Be.jsx=n,Be.jsxs=n,Be}var He={};var ln;function Cr(){return ln||(ln=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 y:return"Fragment";case C:return"Profiler";case S:return"StrictMode";case D: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 v:return"Portal";case T:return b.displayName||"Context";case R:return(b._context.displayName||"Context")+".Consumer";case _:var E=b.render;return b=b.displayName,b||(b=E.displayName||E.name||"",b=b!==""?"ForwardRef("+b+")":"ForwardRef"),b;case O:return E=b.displayName||null,E!==null?E:e(b.type)||"Memo";case L:E=b._payload,b=b._init;try{return e(b(E))}catch{}}return null}function t(b){return""+b}function n(b){try{t(b);var E=!1}catch{E=!0}if(E){E=console;var I=E.error,A=typeof Symbol=="function"&&Symbol.toStringTag&&b[Symbol.toStringTag]||b.constructor.name||"Object";return I.call(E,"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===y)return"<>";if(typeof b=="object"&&b!==null&&b.$$typeof===L)return"<...>";try{var E=e(b);return E?"<"+E+">":"<...>"}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(X.call(b,"key")){var E=Object.getOwnPropertyDescriptor(b,"key").get;if(E&&E.isReactWarning)return!1}return b.key!==void 0}function l(b,E){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)",E))}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,E,I,A,le,Y){var $=I.ref;return b={$$typeof:x,type:b,key:E,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 p(b,E,I,A,le,Y){var $=E.children;if($!==void 0)if(A)if(te($)){for(A=0;A<$.length;A++)g($[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 g($);if(X.call(E,"key")){$=e(b);var G=Object.keys(E).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:
|
|
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} />`,M,P,Y,P),ve[P+M]=!0)}if(P=null,k!==void 0&&(n(k),P=""+k),i(C)&&(n(C.key),P=""+C.key),"key"in C){k={};for(var X in C)X!=="key"&&(k[X]=C[X])}else k=C;return P&&a(k,typeof p=="function"?p.displayName||p.name||"Unknown":p),u(p,P,k,o(),ie,H)}function v(p){b(p)?p._store&&(p._store.validated=1):typeof p=="object"&&p!==null&&p.$$typeof===L&&(p._payload.status==="fulfilled"?b(p._payload.value)&&p._payload.value._store&&(p._payload.value._store.validated=1):p._store&&(p._store.validated=1))}function b(p){return typeof p=="object"&&p!==null&&p.$$typeof===x}var d=c,x=Symbol.for("react.transitional.element"),m=Symbol.for("react.portal"),y=Symbol.for("react.fragment"),w=Symbol.for("react.strict_mode"),S=Symbol.for("react.profiler"),E=Symbol.for("react.consumer"),O=Symbol.for("react.context"),j=Symbol.for("react.forward_ref"),R=Symbol.for("react.suspense"),D=Symbol.for("react.suspense_list"),T=Symbol.for("react.memo"),L=Symbol.for("react.lazy"),z=Symbol.for("react.activity"),N=Symbol.for("react.client.reference"),U=d.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,G=Object.prototype.hasOwnProperty,te=Array.isArray,de=console.createTask?console.createTask:function(){return null};d={react_stack_bottom_frame:function(p){return p()}};var we,F={},Se=d.react_stack_bottom_frame.bind(d,s)(),ne=de(r(s)),ve={};Ve.Fragment=y,Ve.jsx=function(p,C,k){var M=1e4>U.recentlyCreatedOwnerStacks++;return h(p,C,k,!1,M?Error("react-stack-top-frame"):Se,M?de(r(p)):ne)},Ve.jsxs=function(p,C,k){var M=1e4>U.recentlyCreatedOwnerStacks++;return h(p,C,k,!0,M?Error("react-stack-top-frame"):Se,M?de(r(p)):ne)}})()),Ve}var rn;function br(){return rn||(rn=1,process.env.NODE_ENV==="production"?et.exports=gr():et.exports=pr()),et.exports}var f=br(),tt={exports:{}},wt={},nt={exports:{}},St={};var on;function mr(){if(on)return St;on=1;var e=c;function t(v,b){return v===b&&(v!==0||1/v===1/b)||v!==v&&b!==b}var n=typeof Object.is=="function"?Object.is:t,r=e.useState,o=e.useEffect,s=e.useLayoutEffect,i=e.useDebugValue;function a(v,b){var d=b(),x=r({inst:{value:d,getSnapshot:b}}),m=x[0].inst,y=x[1];return s(function(){m.value=d,m.getSnapshot=b,l(m)&&y({inst:m})},[v,d,b]),o(function(){return l(m)&&y({inst:m}),v(function(){l(m)&&y({inst:m})})},[v]),i(d),d}function l(v){var b=v.getSnapshot;v=v.value;try{var d=b();return!n(v,d)}catch{return!0}}function u(v,b){return b()}var h=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?u:a;return St.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:h,St}var Ct={};var sn;function xr(){return sn||(sn=1,process.env.NODE_ENV!=="production"&&(function(){function e(d,x){return d===x&&(d!==0||1/d===1/x)||d!==d&&x!==x}function t(d,x){h||o.startTransition===void 0||(h=!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 m=x();if(!v){var y=x();s(m,y)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),v=!0)}y=i({inst:{value:m,getSnapshot:x}});var w=y[0].inst,S=y[1];return l(function(){w.value=m,w.getSnapshot=x,n(w)&&S({inst:w})},[d,m,x]),a(function(){return n(w)&&S({inst:w}),d(function(){n(w)&&S({inst:w})})},[d]),u(m),m}function n(d){var x=d.getSnapshot;d=d.value;try{var m=x();return!s(d,m)}catch{return!0}}function r(d,x){return x()}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var o=c,s=typeof Object.is=="function"?Object.is:e,i=o.useState,a=o.useEffect,l=o.useLayoutEffect,u=o.useDebugValue,h=!1,v=!1,b=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?r:t;Ct.useSyncExternalStore=o.useSyncExternalStore!==void 0?o.useSyncExternalStore:b,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()),Ct}var an;function _n(){return an||(an=1,process.env.NODE_ENV==="production"?nt.exports=mr():nt.exports=xr()),nt.exports}var cn;function yr(){if(cn)return wt;cn=1;var e=c,t=_n();function n(u,h){return u===h&&(u!==0||1/u===1/h)||u!==u&&h!==h}var r=typeof Object.is=="function"?Object.is:n,o=t.useSyncExternalStore,s=e.useRef,i=e.useEffect,a=e.useMemo,l=e.useDebugValue;return wt.useSyncExternalStoreWithSelector=function(u,h,v,b,d){var x=s(null);if(x.current===null){var m={hasValue:!1,value:null};x.current=m}else m=x.current;x=a(function(){function w(R){if(!S){if(S=!0,E=R,R=b(R),d!==void 0&&m.hasValue){var D=m.value;if(d(D,R))return O=D}return O=R}if(D=O,r(E,R))return D;var T=b(R);return d!==void 0&&d(D,T)?(E=R,D):(E=R,O=T)}var S=!1,E,O,j=v===void 0?null:v;return[function(){return w(h())},j===null?void 0:function(){return w(j())}]},[h,v,b,d]);var y=o(u,x[0],x[1]);return i(function(){m.hasValue=!0,m.value=y},[y]),l(y),y},wt}var Rt={};var ln;function wr(){return ln||(ln=1,process.env.NODE_ENV!=="production"&&(function(){function e(u,h){return u===h&&(u!==0||1/u===1/h)||u!==u&&h!==h}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var t=c,n=_n(),r=typeof Object.is=="function"?Object.is:e,o=n.useSyncExternalStore,s=t.useRef,i=t.useEffect,a=t.useMemo,l=t.useDebugValue;Rt.useSyncExternalStoreWithSelector=function(u,h,v,b,d){var x=s(null);if(x.current===null){var m={hasValue:!1,value:null};x.current=m}else m=x.current;x=a(function(){function w(R){if(!S){if(S=!0,E=R,R=b(R),d!==void 0&&m.hasValue){var D=m.value;if(d(D,R))return O=D}return O=R}if(D=O,r(E,R))return D;var T=b(R);return d!==void 0&&d(D,T)?(E=R,D):(E=R,O=T)}var S=!1,E,O,j=v===void 0?null:v;return[function(){return w(h())},j===null?void 0:function(){return w(j())}]},[h,v,b,d]);var y=o(u,x[0],x[1]);return i(function(){m.hasValue=!0,m.value=y},[y]),l(y),y},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()),Rt}var un;function Sr(){return un||(un=1,process.env.NODE_ENV==="production"?tt.exports=yr():tt.exports=wr()),tt.exports}var Cr=Sr();const It=new WeakMap,Rr=new WeakMap,ct={current:[]};let Et=!1;const rt=new Set,dn=new Map;function On(e){for(const t of e){if(ct.current.includes(t))continue;ct.current.push(t),t.recompute();const n=Rr.get(t);if(n)for(const r of n){const o=It.get(r);o?.length&&On(o)}}}function Er(e){const t={prevVal:e.prevState,currentVal:e.state};for(const n of e.listeners)n(t)}function Dr(e){const t={prevVal:e.prevState,currentVal:e.state};for(const n of e.listeners)n(t)}function _r(e){if(rt.add(e),!Et)try{for(Et=!0;rt.size>0;){const t=Array.from(rt);rt.clear();for(const n of t){const r=dn.get(n)??n.prevState;n.prevState=r,Er(n)}for(const n of t){const r=It.get(n);r&&(ct.current.push(n),On(r))}for(const n of t){const r=It.get(n);if(r)for(const o of r)Dr(o)}}}finally{Et=!1,ct.current=[],dn.clear()}}function Or(e){return typeof e=="function"}class Tn{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):Or(t)?this.state=t(this.prevState):this.state=t,(o=(r=this.options)==null?void 0:r.onUpdate)==null||o.call(r),_r(this)}}function qe(e,t=r=>r,n={}){const r=n.equal??Tr;return Cr.useSyncExternalStoreWithSelector(e.subscribe,()=>e.state,()=>e.state,t,r)}function Tr(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=fn(e);if(n.length!==fn(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 fn(e){return Object.keys(e).concat(Object.getOwnPropertySymbols(e))}function jr(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return c.useMemo(()=>r=>{t.forEach(o=>o(r))},t)}const ht=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function ke(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function zt(e){return"nodeType"in e}function q(e){var t,n;return e?ke(e)?e:zt(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function $t(e){const{Document:t}=q(e);return e instanceof t}function Xe(e){return ke(e)?!1:e instanceof q(e).HTMLElement}function jn(e){return e instanceof q(e).SVGElement}function Ie(e){return e?ke(e)?e.document:zt(e)?$t(e)?e:Xe(e)||jn(e)?e.ownerDocument:document:document:document}const ue=ht?c.useLayoutEffect:c.useEffect;function Vt(e){const t=c.useRef(e);return ue(()=>{t.current=e}),c.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 kr(){const e=c.useRef(null),t=c.useCallback((r,o)=>{e.current=setInterval(r,o)},[]),n=c.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,n]}function Ue(e,t){t===void 0&&(t=[e]);const n=c.useRef(e);return ue(()=>{n.current!==e&&(n.current=e)},t),n}function Je(e,t){const n=c.useRef();return c.useMemo(()=>{const r=e(n.current);return n.current=r,r},[...t])}function lt(e){const t=Vt(e),n=c.useRef(null),r=c.useCallback(o=>{o!==n.current&&t?.(o,n.current),n.current=o},[]);return[n,r]}function At(e){const t=c.useRef();return c.useEffect(()=>{t.current=e},[e]),t.current}let Dt={};function Ke(e,t){return c.useMemo(()=>{if(t)return t;const n=Dt[e]==null?0:Dt[e]+1;return Dt[e]=n,e+"-"+n},[e,t])}function kn(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[l,u]of a){const h=s[l];h!=null&&(s[l]=h+e*u)}return s},{...t})}}const Te=kn(1),ut=kn(-1);function Ir(e){return"clientX"in e&&"clientY"in e}function Bt(e){if(!e)return!1;const{KeyboardEvent:t}=q(e.target);return t&&e instanceof t}function Ar(e){if(!e)return!1;const{TouchEvent:t}=q(e.target);return t&&e instanceof t}function Mt(e){if(Ar(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 Ir(e)?{x:e.clientX,y:e.clientY}:null}const je=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[je.Translate.toString(e),je.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+" "+n+"ms "+r}}}),hn="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function Mr(e){return e.matches(hn)?e:e.querySelector(hn)}const Nr={display:"none"};function Lr(e){let{id:t,value:n}=e;return c.createElement("div",{id:t,style:Nr},n)}function Pr(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 c.createElement("div",{id:t,style:o,role:"status","aria-live":r,"aria-atomic":!0},n)}function zr(){const[e,t]=c.useState("");return{announce:c.useCallback(r=>{r!=null&&t(r)},[]),announcement:e}}const In=c.createContext(null);function $r(e){const t=c.useContext(In);c.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function Vr(){const[e]=c.useState(()=>new Set),t=c.useCallback(r=>(e.add(r),()=>e.delete(r)),[e]);return[c.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 Br={draggable:`
|
|
6
|
+
<%s key={someKey} {...props} />`,A,$,G,$),ve[$+A]=!0)}if($=null,I!==void 0&&(n(I),$=""+I),i(E)&&(n(E.key),$=""+E.key),"key"in E){I={};for(var J in E)J!=="key"&&(I[J]=E[J])}else I=E;return $&&l(I,typeof b=="function"?b.displayName||b.name||"Unknown":b),f(b,$,I,o(),le,Y)}function g(b){m(b)?b._store&&(b._store.validated=1):typeof b=="object"&&b!==null&&b.$$typeof===L&&(b._payload.status==="fulfilled"?m(b._payload.value)&&b._payload.value._store&&(b._payload.value._store.validated=1):b._store&&(b._store.validated=1))}function m(b){return typeof b=="object"&&b!==null&&b.$$typeof===x}var h=d,x=Symbol.for("react.transitional.element"),v=Symbol.for("react.portal"),y=Symbol.for("react.fragment"),S=Symbol.for("react.strict_mode"),C=Symbol.for("react.profiler"),R=Symbol.for("react.consumer"),T=Symbol.for("react.context"),_=Symbol.for("react.forward_ref"),D=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=h.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,X=Object.prototype.hasOwnProperty,te=Array.isArray,he=console.createTask?console.createTask:function(){return null};h={react_stack_bottom_frame:function(b){return b()}};var Re,H={},Ee=h.react_stack_bottom_frame.bind(h,s)(),ne=he(r(s)),ve={};He.Fragment=y,He.jsx=function(b,E,I){var A=1e4>U.recentlyCreatedOwnerStacks++;return p(b,E,I,!1,A?Error("react-stack-top-frame"):Ee,A?he(r(b)):ne)},He.jsxs=function(b,E,I){var A=1e4>U.recentlyCreatedOwnerStacks++;return p(b,E,I,!0,A?Error("react-stack-top-frame"):Ee,A?he(r(b)):ne)}})()),He}var cn;function Rr(){return cn||(cn=1,process.env.NODE_ENV==="production"?ot.exports=wr():ot.exports=Cr()),ot.exports}var a=Rr();function w(e){return d.forwardRef((t,n)=>{const{children:r,...o}=t;return a.jsx(e,{ref:n,...o,children:r})})}const Er=Object.freeze(Object.defineProperty({__proto__:null,withChildren:w},Symbol.toStringTag,{value:"Module"})),Dr=w(c.Checkbox.Root),Tr=w(c.Checkbox.HiddenInput),jr=w(c.Checkbox.Control),_r=w(c.Checkbox.Label),Or=({value:e,onChange:t,size:n="sm",label:r,helperText:o,isDisabled:s,required:i,errorText:l})=>a.jsxs(Dr,{value:e,onChange:t,size:n,children:[a.jsx(Tr,{}),a.jsx(jr,{disabled:s,required:i,errorText:l,helperText:o}),r&&a.jsx(_r,{children:r})]});const Ir=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),kr=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,r)=>r?r.toUpperCase():n.toLowerCase()),un=e=>{const t=kr(e);return t.charAt(0).toUpperCase()+t.slice(1)},Ln=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim(),Mr=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0};var Ar={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 Nr=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,...Ar,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:Ln("lucide",o),...!s&&!Mr(l)&&{"aria-hidden":"true"},...l},[...i.map(([f,p])=>d.createElement(f,p)),...Array.isArray(s)?s:[s]]));const q=(e,t)=>{const n=d.forwardRef(({className:r,...o},s)=>d.createElement(Nr,{ref:s,iconNode:t,className:Ln(`lucide-${Ir(un(e))}`,`lucide-${e}`,r),...o}));return n.displayName=un(e),n};const Lr=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],$r=q("arrow-down",Lr);const Pr=[["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"}]],zr=q("arrow-up-down",Pr);const Fr=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],Vr=q("arrow-up",Fr);const Br=[["path",{d:"m19 21-7-4-7 4V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v16z",key:"1fy3hk"}]],Hr=q("bookmark",Br);const Yr=[["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"}]],dn=q("calendar",Yr);const Wr=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],Ur=q("chevron-left",Wr);const Gr=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Xr=q("chevron-right",Gr);const qr=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 3v18",key:"108xh3"}]],Kr=q("columns-2",qr);const Jr=[["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"}]],Zr=q("delete",Jr);const Qr=[["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"}]],eo=q("ellipsis",Qr);const to=[["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"}]],no=q("funnel",to);const ro=[["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"}]],oo=q("grip-vertical",ro);const so=[["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"}]],io=q("pen",so);const ao=[["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"}]],lo=q("settings",ao),z=" to ",fn=10,Ce={DAY_MAX:31,MONTH_MAX:12,YEAR_MIN:1900,YEAR_MAX:2100},Bt=()=>{const e=new Date;return{year:e.getFullYear(),month:e.getMonth()+1,day:e.getDate()}},hn=()=>{const{year:e,month:t,day:n}=Bt();return`${String(n).padStart(2,"0")}-${String(t).padStart(2,"0")}-${e}`},co=()=>{const{year:e,month:t,day:n}=Bt();return`${e}-${String(t).padStart(2,"0")}-${String(n).padStart(2,"0")}`},uo=(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}=Bt();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=uo(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}`},fo=(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,fn);if(t.length>=3&&t[2]!=="-"&&(t=t.substring(0,2)+"-"+t.substring(2).replace(/-/g,"")),t.length>=6&&t[5]!=="-"){const o=t.split("-");o.length>=2&&(t=`${o[0]}-${o[1].substring(0,2)}-${o[1].substring(2)}${o[2]||""}`)}const n=t.split("-");return n[0]=n[0]?.substring(0,2)||"",n[1]=n[1]?.substring(0,2)||"",n[2]=n[2]?.substring(0,4)||"",t=n.filter(o=>o!=="").join("-"),t=t.substring(0,fn),fo(n,e)||t},ho=w(c.Popover.Root),go=w(c.Popover.Trigger),po=w(c.Popover.Content),vo=w(c.Popover.Positioner);function bo({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 x=v=>{v.ctrlKey&&v.key==="d"&&!v.shiftKey&&!v.metaKey&&(v.preventDefault(),f.current?.focus())};return window.addEventListener("keydown",x),()=>window.removeEventListener("keydown",x)},[]);const p=x=>{let v=x;if(v.includes(z)){const[y,S=""]=v.split(z);v=`${We(y.trim())}${z}${We(S.trim())}`}else if(v.toLowerCase().includes(" to ")){const[y,S=""]=v.split(/\s+to\s+/i);v=`${We(y.trim())} to ${We(S.trim())}`}else v=We(v);i(v)},g=()=>{const x=s.trim();if(!x){t(void 0);return}if(x.includes(z)){const[v,y=""]=x.split(z).map(R=>R.trim()),S=Ye(v),C=y?Ye(y):null;if(S&&C){const[R,T]=C<S?[C,S]:[S,C],_=`${ie(R)}${z}${ie(T)}`;i(_),t(`${R}|${T}`)}else if(S&&!y)i(`${ie(S)}${z}`),t(void 0);else if(S&&y){const R=co(),[T,_]=R<S?[R,S]:[S,R],D=`${ie(T)}${z}${ie(_)}`;i(D),t(`${T}|${_}`)}else i(""),t(void 0)}else{const v=Ye(x);v?(i(`${ie(v)}${z}`),t(void 0)):(i(""),t(void 0))}},m=x=>{if(x.key!=="Enter")return;x.preventDefault();const v=f.current?.selectionStart||0,y=s.indexOf(z);if(!s.trim()){i(`${hn()}${z}`);return}if(y===-1){const C=Ye(s.trim());C&&i(`${ie(C)}${z}`);return}if(v<=y+z.length){const C=s.substring(0,y).trim(),R=s.substring(y+z.length),T=Ye(C);T&&i(`${ie(T)}${z}${R}`);return}if(s.substring(y+z.length).trim())g(),f.current?.blur();else{const C=s.substring(0,y+z.length)+hn();i(C),setTimeout(()=>{g(),f.current?.blur()},0)}},h=()=>{i(""),t(void 0)};return a.jsx(c.InputGroup,{children:a.jsx(a.Fragment,{children:a.jsxs(c.InputElement,{position:"revert",children:[a.jsxs(ho,{open:l,onEscapeKeyDown:()=>{u(!1)},children:[a.jsx(go,{asChild:!0,children:a.jsx(c.IconButton,{size:"sm",variant:"ghost","aria-label":"Date range help",onClick:()=>u(x=>!x),children:a.jsx(dn,{size:16})})}),a.jsx(c.Portal,{children:a.jsx(vo,{children:a.jsxs(po,{p:4,children:[a.jsx(c.PopoverArrow,{}),a.jsxs(c.VStack,{align:"start",gap:4,children:[a.jsxs(c.HStack,{children:[a.jsx(dn,{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:x=>p(x.target.value),onBlur:g,onKeyDown:m,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:h,w:"100%"})})]})})})}const mo=w(c.Field.Root),xo=w(c.Field.Label),yo=w(c.Field.HelperText),So=w(c.Field.ErrorText),gn=({icon:e,value:t,onChange:n,placeholder:r,size:o="sm",variant:s="outline",width:i="100%",label:l,helperText:u,isDisabled:f=!1,required:p=!1,errorText:g})=>a.jsxs(mo,{children:[l&&a.jsx(xo,{children:l}),a.jsx(c.InputGroup,{startElement:e,children:a.jsx(c.Input,{value:t,onChange:m=>n&&n(m.target.value),placeholder:r,size:o,variant:s,width:i,disabled:f,required:p})}),a.jsx(yo,{children:u}),g&&a.jsx(So,{children:g})]}),wo=w(c.Field.Root),Co=w(c.Field.HelperText),Ro=w(c.Field.ErrorText),Eo=w(c.Select.Root),Do=w(c.Select.Label),To=w(c.Select.Control),jo=w(c.Select.Trigger),_o=w(c.Select.ValueText),Oo=w(c.Select.IndicatorGroup),Io=w(c.Select.Indicator),ko=w(c.Select.Content),Mo=w(c.Select.Item),Ao=w(c.Select.ItemIndicator),No=w(c.Select.HiddenSelect),Lo=w(c.Select.Positioner),$o=({options:e=[],label:t,value:n,onChange:r,placeholder:o,size:s="sm",width:i="100%",variant:l="outline",helperText:u,isDisabled:f,required:p,errorText:g})=>{const m=c.createListCollection({items:e});return a.jsxs(wo,{disabled:f,required:p,children:[a.jsxs(Eo,{collection:m,variant:l,size:s,width:i,value:n?[n]:[],onValueChange:h=>r?.(h.value[0]),children:[a.jsx(No,{}),t&&a.jsx(Do,{children:t}),a.jsxs(To,{children:[a.jsx(jo,{children:a.jsx(_o,{placeholder:o})}),a.jsx(Oo,{children:a.jsx(Io,{})})]}),a.jsx(Lo,{children:a.jsx(ko,{children:m.items.map(h=>a.jsxs(Mo,{item:h,children:[h.label,a.jsx(Ao,{})]},h.value))})})]}),u&&a.jsx(Co,{children:u}),g&&a.jsx(Ro,{children:g})]})},Po=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));var st={exports:{}},Et={},it={exports:{}},Dt={};var pn;function zo(){if(pn)return Dt;pn=1;var e=d;function t(g,m){return g===m&&(g!==0||1/g===1/m)||g!==g&&m!==m}var n=typeof Object.is=="function"?Object.is:t,r=e.useState,o=e.useEffect,s=e.useLayoutEffect,i=e.useDebugValue;function l(g,m){var h=m(),x=r({inst:{value:h,getSnapshot:m}}),v=x[0].inst,y=x[1];return s(function(){v.value=h,v.getSnapshot=m,u(v)&&y({inst:v})},[g,h,m]),o(function(){return u(v)&&y({inst:v}),g(function(){u(v)&&y({inst:v})})},[g]),i(h),h}function u(g){var m=g.getSnapshot;g=g.value;try{var h=m();return!n(g,h)}catch{return!0}}function f(g,m){return m()}var p=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?f:l;return Dt.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:p,Dt}var Tt={};var vn;function Fo(){return vn||(vn=1,process.env.NODE_ENV!=="production"&&(function(){function e(h,x){return h===x&&(h!==0||1/h===1/x)||h!==h&&x!==x}function t(h,x){p||o.startTransition===void 0||(p=!0,console.error("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));var v=x();if(!g){var y=x();s(v,y)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),g=!0)}y=i({inst:{value:v,getSnapshot:x}});var S=y[0].inst,C=y[1];return u(function(){S.value=v,S.getSnapshot=x,n(S)&&C({inst:S})},[h,v,x]),l(function(){return n(S)&&C({inst:S}),h(function(){n(S)&&C({inst:S})})},[h]),f(v),v}function n(h){var x=h.getSnapshot;h=h.value;try{var v=x();return!s(h,v)}catch{return!0}}function r(h,x){return x()}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,p=!1,g=!1,m=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?r:t;Tt.useSyncExternalStore=o.useSyncExternalStore!==void 0?o.useSyncExternalStore:m,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()),Tt}var bn;function $n(){return bn||(bn=1,process.env.NODE_ENV==="production"?it.exports=zo():it.exports=Fo()),it.exports}var mn;function Vo(){if(mn)return Et;mn=1;var e=d,t=$n();function n(f,p){return f===p&&(f!==0||1/f===1/p)||f!==f&&p!==p}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 Et.useSyncExternalStoreWithSelector=function(f,p,g,m,h){var x=s(null);if(x.current===null){var v={hasValue:!1,value:null};x.current=v}else v=x.current;x=l(function(){function S(D){if(!C){if(C=!0,R=D,D=m(D),h!==void 0&&v.hasValue){var j=v.value;if(h(j,D))return T=j}return T=D}if(j=T,r(R,D))return j;var O=m(D);return h!==void 0&&h(j,O)?(R=D,j):(R=D,T=O)}var C=!1,R,T,_=g===void 0?null:g;return[function(){return S(p())},_===null?void 0:function(){return S(_())}]},[p,g,m,h]);var y=o(f,x[0],x[1]);return i(function(){v.hasValue=!0,v.value=y},[y]),u(y),y},Et}var jt={};var xn;function Bo(){return xn||(xn=1,process.env.NODE_ENV!=="production"&&(function(){function e(f,p){return f===p&&(f!==0||1/f===1/p)||f!==f&&p!==p}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;jt.useSyncExternalStoreWithSelector=function(f,p,g,m,h){var x=s(null);if(x.current===null){var v={hasValue:!1,value:null};x.current=v}else v=x.current;x=l(function(){function S(D){if(!C){if(C=!0,R=D,D=m(D),h!==void 0&&v.hasValue){var j=v.value;if(h(j,D))return T=j}return T=D}if(j=T,r(R,D))return j;var O=m(D);return h!==void 0&&h(j,O)?(R=D,j):(R=D,T=O)}var C=!1,R,T,_=g===void 0?null:g;return[function(){return S(p())},_===null?void 0:function(){return S(_())}]},[p,g,m,h]);var y=o(f,x[0],x[1]);return i(function(){v.hasValue=!0,v.value=y},[y]),u(y),y},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()),jt}var yn;function Ho(){return yn||(yn=1,process.env.NODE_ENV==="production"?st.exports=Vo():st.exports=Bo()),st.exports}var Yo=Ho();const Lt=new WeakMap,Wo=new WeakMap,ft={current:[]};let _t=!1;const at=new Set,Sn=new Map;function Pn(e){for(const t of e){if(ft.current.includes(t))continue;ft.current.push(t),t.recompute();const n=Wo.get(t);if(n)for(const r of n){const o=Lt.get(r);o?.length&&Pn(o)}}}function Uo(e){const t={prevVal:e.prevState,currentVal:e.state};for(const n of e.listeners)n(t)}function Go(e){const t={prevVal:e.prevState,currentVal:e.state};for(const n of e.listeners)n(t)}function Xo(e){if(at.add(e),!_t)try{for(_t=!0;at.size>0;){const t=Array.from(at);at.clear();for(const n of t){const r=Sn.get(n)??n.prevState;n.prevState=r,Uo(n)}for(const n of t){const r=Lt.get(n);r&&(ft.current.push(n),Pn(r))}for(const n of t){const r=Lt.get(n);if(r)for(const o of r)Go(o)}}}finally{_t=!1,ft.current=[],Sn.clear()}}function qo(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):qo(t)?this.state=t(this.prevState):this.state=t,(o=(r=this.options)==null?void 0:r.onUpdate)==null||o.call(r),Xo(this)}}function Ze(e,t=r=>r,n={}){const r=n.equal??Ko;return Yo.useSyncExternalStoreWithSelector(e.subscribe,()=>e.state,()=>e.state,t,r)}function Ko(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=wn(e);if(n.length!==wn(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 wn(e){return Object.keys(e).concat(Object.getOwnPropertySymbols(e))}function Jo(){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 Ht(e){return"nodeType"in e}function K(e){var t,n;return e?Ae(e)?e:Ht(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function Yt(e){const{Document:t}=K(e);return e instanceof t}function Qe(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:Ht(e)?Yt(e)?e:Qe(e)||Fn(e)?e.ownerDocument:document:document:document}const fe=mt?d.useLayoutEffect:d.useEffect;function Wt(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 Zo(){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 et(e,t){const n=d.useRef();return d.useMemo(()=>{const r=e(n.current);return n.current=r,r},[...t])}function ht(e){const t=Wt(e),n=d.useRef(null),r=d.useCallback(o=>{o!==n.current&&t?.(o,n.current),n.current=o},[]);return[n,r]}function $t(e){const t=d.useRef();return d.useEffect(()=>{t.current=e},[e]),t.current}let Ot={};function tt(e,t){return d.useMemo(()=>{if(t)return t;const n=Ot[e]==null?0:Ot[e]+1;return Ot[e]=n,e+"-"+n},[e,t])}function Vn(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 p=s[u];p!=null&&(s[u]=p+e*f)}return s},{...t})}}const ke=Vn(1),gt=Vn(-1);function Qo(e){return"clientX"in e&&"clientY"in e}function Ut(e){if(!e)return!1;const{KeyboardEvent:t}=K(e.target);return t&&e instanceof t}function es(e){if(!e)return!1;const{TouchEvent:t}=K(e.target);return t&&e instanceof t}function Pt(e){if(es(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 Qo(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}}}),Cn="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function ts(e){return e.matches(Cn)?e:e.querySelector(Cn)}const ns={display:"none"};function rs(e){let{id:t,value:n}=e;return d.createElement("div",{id:t,style:ns},n)}function os(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 ss(){const[e,t]=d.useState("");return{announce:d.useCallback(r=>{r!=null&&t(r)},[]),announcement:e}}const Bn=d.createContext(null);function is(e){const t=d.useContext(Bn);d.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function as(){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 ls={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
|
-
`},Fr={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 Hr(e){let{announcements:t=Fr,container:n,hiddenTextDescribedById:r,screenReaderInstructions:o=Br}=e;const{announce:s,announcement:i}=zr(),a=Ke("DndLiveRegion"),[l,u]=c.useState(!1);if(c.useEffect(()=>{u(!0)},[]),$r(c.useMemo(()=>({onDragStart(v){let{active:b}=v;s(t.onDragStart({active:b}))},onDragMove(v){let{active:b,over:d}=v;t.onDragMove&&s(t.onDragMove({active:b,over:d}))},onDragOver(v){let{active:b,over:d}=v;s(t.onDragOver({active:b,over:d}))},onDragEnd(v){let{active:b,over:d}=v;s(t.onDragEnd({active:b,over:d}))},onDragCancel(v){let{active:b,over:d}=v;s(t.onDragCancel({active:b,over:d}))}}),[s,t])),!l)return null;const h=c.createElement(c.Fragment,null,c.createElement(Lr,{id:r,value:o.draggable}),c.createElement(Pr,{id:a,announcement:i}));return n?Be.createPortal(h,n):h}var $;(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"})($||($={}));function dt(){}function Wr(e,t){return c.useMemo(()=>({sensor:e,options:{}}),[e,t])}function Ur(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return c.useMemo(()=>[...t].filter(r=>r!=null),[...t])}const se=Object.freeze({x:0,y:0});function Yr(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Gr(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function qr(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function Xr(e,t){if(!e||e.length===0)return null;const[n]=e;return n[t]}function vn(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 An=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=vn(t,t.left,t.top),s=[];for(const i of r){const{id:a}=i,l=n.get(a);if(l){const u=Yr(vn(l),o);s.push({id:a,data:{droppableContainer:i,value:u}})}}return s.sort(Gr)};function Jr(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 l=t.width*t.height,u=e.width*e.height,h=i*a,v=h/(l+u-h);return Number(v.toFixed(4))}return 0}const Kr=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 l=Jr(a,t);l>0&&o.push({id:i,data:{droppableContainer:s,value:l}})}}return o.sort(qr)};function Zr(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function Mn(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:se}function Qr(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 eo=Qr(1);function to(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 no(e,t,n){const r=to(t);if(!r)return e;const{scaleX:o,scaleY:s,x:i,y:a}=r,l=e.left-i-(1-o)*parseFloat(n),u=e.top-a-(1-s)*parseFloat(n.slice(n.indexOf(" ")+1)),h=o?e.width/o:e.width,v=s?e.height/s:e.height;return{width:h,height:v,top:u,right:l+h,bottom:u+v,left:l}}const ro={ignoreTransform:!1};function Ae(e,t){t===void 0&&(t=ro);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:u,transformOrigin:h}=q(e).getComputedStyle(e);u&&(n=no(n,u,h))}const{top:r,left:o,width:s,height:i,bottom:a,right:l}=n;return{top:r,left:o,width:s,height:i,bottom:a,right:l}}function gn(e){return Ae(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 so(e,t){return t===void 0&&(t=q(e).getComputedStyle(e)),t.position==="fixed"}function io(e,t){t===void 0&&(t=q(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 Ft(e,t){const n=[];function r(o){if(t!=null&&n.length>=t||!o)return n;if($t(o)&&o.scrollingElement!=null&&!n.includes(o.scrollingElement))return n.push(o.scrollingElement),n;if(!Xe(o)||jn(o)||n.includes(o))return n;const s=q(e).getComputedStyle(o);return o!==e&&io(o,s)&&n.push(o),so(o,s)?n:r(o.parentNode)}return e?r(e):n}function Nn(e){const[t]=Ft(e,1);return t??null}function _t(e){return!ht||!e?null:ke(e)?e:zt(e)?$t(e)||e===Ie(e).scrollingElement?window:Xe(e)?e:null:null}function Ln(e){return ke(e)?e.scrollX:e.scrollLeft}function Pn(e){return ke(e)?e.scrollY:e.scrollTop}function Nt(e){return{x:Ln(e),y:Pn(e)}}var V;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(V||(V={}));function zn(e){return!ht||!e?!1:e===document.scrollingElement}function $n(e){const t={x:0,y:0},n=zn(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 ao={x:.2,y:.2};function co(e,t,n,r,o){let{top:s,left:i,right:a,bottom:l}=n;r===void 0&&(r=10),o===void 0&&(o=ao);const{isTop:u,isBottom:h,isLeft:v,isRight:b}=$n(e),d={x:0,y:0},x={x:0,y:0},m={height:t.height*o.y,width:t.width*o.x};return!u&&s<=t.top+m.height?(d.y=V.Backward,x.y=r*Math.abs((t.top+m.height-s)/m.height)):!h&&l>=t.bottom-m.height&&(d.y=V.Forward,x.y=r*Math.abs((t.bottom-m.height-l)/m.height)),!b&&a>=t.right-m.width?(d.x=V.Forward,x.x=r*Math.abs((t.right-m.width-a)/m.width)):!v&&i<=t.left+m.width&&(d.x=V.Backward,x.x=r*Math.abs((t.left+m.width-i)/m.width)),{direction:d,speed:x}}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 Vn(e){return e.reduce((t,n)=>Te(t,Nt(n)),se)}function uo(e){return e.reduce((t,n)=>t+Ln(n),0)}function fo(e){return e.reduce((t,n)=>t+Pn(n),0)}function ho(e,t){if(t===void 0&&(t=Ae),!e)return;const{top:n,left:r,bottom:o,right:s}=t(e);Nn(e)&&(o<=0||s<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const vo=[["x",["left","right"],uo],["y",["top","bottom"],fo]];class Ht{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=Ft(n),o=Vn(r);this.rect={...t},this.width=t.width,this.height=t.height;for(const[s,i,a]of vo)for(const l of i)Object.defineProperty(this,l,{get:()=>{const u=a(r),h=o[s]-u;return this.rect[l]+h},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class Fe{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var r;return(r=this.target)==null?void 0:r.removeEventListener(...n)})},this.target=t}add(t,n,r){var o;(o=this.target)==null||o.addEventListener(t,n,r),this.listeners.push([t,n,r])}}function go(e){const{EventTarget:t}=q(e);return e instanceof t?e:Ie(e)}function Ot(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 oe;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(oe||(oe={}));function pn(e){e.preventDefault()}function po(e){e.stopPropagation()}var I;(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"})(I||(I={}));const Bn={start:[I.Space,I.Enter],cancel:[I.Esc],end:[I.Space,I.Enter,I.Tab]},bo=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case I.Right:return{...n,x:n.x+25};case I.Left:return{...n,x:n.x-25};case I.Down:return{...n,y:n.y+25};case I.Up:return{...n,y:n.y-25}}};class Fn{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 Fe(Ie(n)),this.windowListeners=new Fe(q(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(oe.Resize,this.handleCancel),this.windowListeners.add(oe.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(oe.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props,r=t.node.current;r&&ho(r),n(se)}handleKeyDown(t){if(Bt(t)){const{active:n,context:r,options:o}=this.props,{keyboardCodes:s=Bn,coordinateGetter:i=bo,scrollBehavior:a="smooth"}=o,{code:l}=t;if(s.end.includes(l)){this.handleEnd(t);return}if(s.cancel.includes(l)){this.handleCancel(t);return}const{collisionRect:u}=r.current,h=u?{x:u.left,y:u.top}:se;this.referenceCoordinates||(this.referenceCoordinates=h);const v=i(t,{active:n,context:r.current,currentCoordinates:h});if(v){const b=ut(v,h),d={x:0,y:0},{scrollableAncestors:x}=r.current;for(const m of x){const y=t.code,{isTop:w,isRight:S,isLeft:E,isBottom:O,maxScroll:j,minScroll:R}=$n(m),D=lo(m),T={x:Math.min(y===I.Right?D.right-D.width/2:D.right,Math.max(y===I.Right?D.left:D.left+D.width/2,v.x)),y:Math.min(y===I.Down?D.bottom-D.height/2:D.bottom,Math.max(y===I.Down?D.top:D.top+D.height/2,v.y))},L=y===I.Right&&!S||y===I.Left&&!E,z=y===I.Down&&!O||y===I.Up&&!w;if(L&&T.x!==v.x){const N=m.scrollLeft+b.x,U=y===I.Right&&N<=j.x||y===I.Left&&N>=R.x;if(U&&!b.y){m.scrollTo({left:N,behavior:a});return}U?d.x=m.scrollLeft-N:d.x=y===I.Right?m.scrollLeft-j.x:m.scrollLeft-R.x,d.x&&m.scrollBy({left:-d.x,behavior:a});break}else if(z&&T.y!==v.y){const N=m.scrollTop+b.y,U=y===I.Down&&N<=j.y||y===I.Up&&N>=R.y;if(U&&!b.x){m.scrollTo({top:N,behavior:a});return}U?d.y=m.scrollTop-N:d.y=y===I.Down?m.scrollTop-j.y:m.scrollTop-R.y,d.y&&m.scrollBy({top:-d.y,behavior:a});break}}this.handleMove(t,Te(ut(v,this.referenceCoordinates),d))}}}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()}}Fn.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:r=Bn,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 bn(e){return!!(e&&"distance"in e)}function mn(e){return!!(e&&"delay"in e)}class Wt{constructor(t,n,r){var o;r===void 0&&(r=go(t.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=t,this.events=n;const{event:s}=t,{target:i}=s;this.props=t,this.events=n,this.document=Ie(i),this.documentListeners=new Fe(this.document),this.listeners=new Fe(r),this.windowListeners=new Fe(q(i)),this.initialCoordinates=(o=Mt(s))!=null?o:se,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(oe.Resize,this.handleCancel),this.windowListeners.add(oe.DragStart,pn),this.windowListeners.add(oe.VisibilityChange,this.handleCancel),this.windowListeners.add(oe.ContextMenu,pn),this.documentListeners.add(oe.Keydown,this.handleKeydown),n){if(r!=null&&r({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(mn(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(bn(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(oe.Click,po,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(oe.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 l=(n=Mt(t))!=null?n:se,u=ut(o,l);if(!r&&a){if(bn(a)){if(a.tolerance!=null&&Ot(u,a.tolerance))return this.handleCancel();if(Ot(u,a.distance))return this.handleStart()}if(mn(a)&&Ot(u,a.tolerance))return this.handleCancel();this.handlePending(a,u);return}t.cancelable&&t.preventDefault(),i(l)}handleEnd(){const{onAbort:t,onEnd:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleCancel(){const{onAbort:t,onCancel:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleKeydown(t){t.code===I.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 Ut extends Wt{constructor(t){const{event:n}=t,r=Ie(n.target);super(t,mo,r)}}Ut.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 xo={move:{name:"mousemove"},end:{name:"mouseup"}};var Lt;(function(e){e[e.RightClick=2]="RightClick"})(Lt||(Lt={}));class yo extends Wt{constructor(t){super(t,xo,Ie(t.event.target))}}yo.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===Lt.RightClick?!1:(r?.({event:n}),!0)}}];const Tt={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class wo extends Wt{constructor(t){super(t,Tt)}static setup(){return window.addEventListener(Tt.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(Tt.move.name,t)};function t(){}}}wo.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;const{touches:o}=n;return o.length>1?!1:(r?.({event:n}),!0)}}];var He;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(He||(He={}));var ft;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(ft||(ft={}));function So(e){let{acceleration:t,activator:n=He.Pointer,canScroll:r,draggingRect:o,enabled:s,interval:i=5,order:a=ft.TreeOrder,pointerCoordinates:l,scrollableAncestors:u,scrollableAncestorRects:h,delta:v,threshold:b}=e;const d=Ro({delta:v,disabled:!s}),[x,m]=kr(),y=c.useRef({x:0,y:0}),w=c.useRef({x:0,y:0}),S=c.useMemo(()=>{switch(n){case He.Pointer:return l?{top:l.y,bottom:l.y,left:l.x,right:l.x}:null;case He.DraggableRect:return o}},[n,o,l]),E=c.useRef(null),O=c.useCallback(()=>{const R=E.current;if(!R)return;const D=y.current.x*w.current.x,T=y.current.y*w.current.y;R.scrollBy(D,T)},[]),j=c.useMemo(()=>a===ft.TreeOrder?[...u].reverse():u,[a,u]);c.useEffect(()=>{if(!s||!u.length||!S){m();return}for(const R of j){if(r?.(R)===!1)continue;const D=u.indexOf(R),T=h[D];if(!T)continue;const{direction:L,speed:z}=co(R,T,S,t,b);for(const N of["x","y"])d[N][L[N]]||(z[N]=0,L[N]=0);if(z.x>0||z.y>0){m(),E.current=R,x(O,i),y.current=z,w.current=L;return}}y.current={x:0,y:0},w.current={x:0,y:0},m()},[t,O,r,m,s,i,JSON.stringify(S),JSON.stringify(d),x,u,j,h,JSON.stringify(b)])}const Co={x:{[V.Backward]:!1,[V.Forward]:!1},y:{[V.Backward]:!1,[V.Forward]:!1}};function Ro(e){let{delta:t,disabled:n}=e;const r=At(t);return Je(o=>{if(n||!r||!o)return Co;const s={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[V.Backward]:o.x[V.Backward]||s.x===-1,[V.Forward]:o.x[V.Forward]||s.x===1},y:{[V.Backward]:o.y[V.Backward]||s.y===-1,[V.Forward]:o.y[V.Forward]||s.y===1}}},[n,t,r])}function Eo(e,t){const n=t!=null?e.get(t):void 0,r=n?n.node.current:null;return Je(o=>{var s;return t==null?null:(s=r??o)!=null?s:null},[r,t])}function Do(e,t){return c.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 Ye;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(Ye||(Ye={}));var Pt;(function(e){e.Optimized="optimized"})(Pt||(Pt={}));const xn=new Map;function _o(e,t){let{dragging:n,dependencies:r,config:o}=t;const[s,i]=c.useState(null),{frequency:a,measure:l,strategy:u}=o,h=c.useRef(e),v=y(),b=Ue(v),d=c.useCallback(function(w){w===void 0&&(w=[]),!b.current&&i(S=>S===null?w:S.concat(w.filter(E=>!S.includes(E))))},[b]),x=c.useRef(null),m=Je(w=>{if(v&&!n)return xn;if(!w||w===xn||h.current!==e||s!=null){const S=new Map;for(let E of e){if(!E)continue;if(s&&s.length>0&&!s.includes(E.id)&&E.rect.current){S.set(E.id,E.rect.current);continue}const O=E.node.current,j=O?new Ht(l(O),O):null;E.rect.current=j,j&&S.set(E.id,j)}return S}return w},[e,s,n,v,l]);return c.useEffect(()=>{h.current=e},[e]),c.useEffect(()=>{v||d()},[n,v]),c.useEffect(()=>{s&&s.length>0&&i(null)},[JSON.stringify(s)]),c.useEffect(()=>{v||typeof a!="number"||x.current!==null||(x.current=setTimeout(()=>{d(),x.current=null},a))},[a,v,d,...r]),{droppableRects:m,measureDroppableContainers:d,measuringScheduled:s!=null};function y(){switch(u){case Ye.Always:return!1;case Ye.BeforeDragging:return n;default:return!n}}}function Hn(e,t){return Je(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function Oo(e,t){return Hn(e,t)}function To(e){let{callback:t,disabled:n}=e;const r=Vt(t),o=c.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:s}=window;return new s(r)},[r,n]);return c.useEffect(()=>()=>o?.disconnect(),[o]),o}function vt(e){let{callback:t,disabled:n}=e;const r=Vt(t),o=c.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:s}=window;return new s(r)},[n]);return c.useEffect(()=>()=>o?.disconnect(),[o]),o}function jo(e){return new Ht(Ae(e),e)}function yn(e,t,n){t===void 0&&(t=jo);const[r,o]=c.useState(null);function s(){o(l=>{if(!e)return null;if(e.isConnected===!1){var u;return(u=l??n)!=null?u:null}const h=t(e);return JSON.stringify(l)===JSON.stringify(h)?l:h})}const i=To({callback(l){if(e)for(const u of l){const{type:h,target:v}=u;if(h==="childList"&&v instanceof HTMLElement&&v.contains(e)){s();break}}}}),a=vt({callback:s});return ue(()=>{s(),e?(a?.observe(e),i?.observe(document.body,{childList:!0,subtree:!0})):(a?.disconnect(),i?.disconnect())},[e]),r}function ko(e){const t=Hn(e);return Mn(e,t)}const wn=[];function Io(e){const t=c.useRef(e),n=Je(r=>e?r&&r!==wn&&e&&t.current&&e.parentNode===t.current.parentNode?r:Ft(e):wn,[e]);return c.useEffect(()=>{t.current=e},[e]),n}function Ao(e){const[t,n]=c.useState(null),r=c.useRef(e),o=c.useCallback(s=>{const i=_t(s.target);i&&n(a=>a?(a.set(i,Nt(i)),new Map(a)):null)},[]);return c.useEffect(()=>{const s=r.current;if(e!==s){i(s);const a=e.map(l=>{const u=_t(l);return u?(u.addEventListener("scroll",o,{passive:!0}),[u,Nt(u)]):null}).filter(l=>l!=null);n(a.length?new Map(a):null),r.current=e}return()=>{i(e),i(s)};function i(a){a.forEach(l=>{const u=_t(l);u?.removeEventListener("scroll",o)})}},[o,e]),c.useMemo(()=>e.length?t?Array.from(t.values()).reduce((s,i)=>Te(s,i),se):Vn(e):se,[e,t])}function Sn(e,t){t===void 0&&(t=[]);const n=c.useRef(null);return c.useEffect(()=>{n.current=null},t),c.useEffect(()=>{const r=e!==se;r&&!n.current&&(n.current=e),!r&&n.current&&(n.current=null)},[e]),n.current?ut(e,n.current):se}function Mo(e){c.useEffect(()=>{if(!ht)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 No(e,t){return c.useMemo(()=>e.reduce((n,r)=>{let{eventName:o,handler:s}=r;return n[o]=i=>{s(i,t)},n},{}),[e,t])}function Wn(e){return c.useMemo(()=>e?oo(e):null,[e])}const Cn=[];function Lo(e,t){t===void 0&&(t=Ae);const[n]=e,r=Wn(n?q(n):null),[o,s]=c.useState(Cn);function i(){s(()=>e.length?e.map(l=>zn(l)?r:new Ht(t(l),l)):Cn)}const a=vt({callback:i});return ue(()=>{a?.disconnect(),i(),e.forEach(l=>a?.observe(l))},[e]),o}function Po(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return Xe(t)?t:e}function zo(e){let{measure:t}=e;const[n,r]=c.useState(null),o=c.useCallback(u=>{for(const{target:h}of u)if(Xe(h)){r(v=>{const b=t(h);return v?{...v,width:b.width,height:b.height}:b});break}},[t]),s=vt({callback:o}),i=c.useCallback(u=>{const h=Po(u);s?.disconnect(),h&&s?.observe(h),r(h?t(h):null)},[t,s]),[a,l]=lt(i);return c.useMemo(()=>({nodeRef:a,rect:n,setRef:l}),[n,a,l])}const $o=[{sensor:Ut,options:{}},{sensor:Fn,options:{}}],Vo={current:{}},at={draggable:{measure:gn},droppable:{measure:gn,strategy:Ye.WhileDragging,frequency:Pt.Optimized},dragOverlay:{measure:Ae}};class We 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 Bo={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new We,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:dt},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:at,measureDroppableContainers:dt,windowRect:null,measuringScheduled:!1},Fo={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:dt,draggableNodes:new Map,over:null,measureDroppableContainers:dt},gt=c.createContext(Fo),Un=c.createContext(Bo);function Ho(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new We}}}function Wo(e,t){switch(t.type){case $.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case $.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 $.DragEnd:case $.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case $.RegisterDroppable:{const{element:n}=t,{id:r}=n,o=new We(e.droppable.containers);return o.set(r,n),{...e,droppable:{...e.droppable,containers:o}}}case $.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 We(e.droppable.containers);return i.set(n,{...s,disabled:o}),{...e,droppable:{...e.droppable,containers:i}}}case $.UnregisterDroppable:{const{id:n,key:r}=t,o=e.droppable.containers.get(n);if(!o||r!==o.key)return e;const s=new We(e.droppable.containers);return s.delete(n),{...e,droppable:{...e.droppable,containers:s}}}default:return e}}function Uo(e){let{disabled:t}=e;const{active:n,activatorEvent:r,draggableNodes:o}=c.useContext(gt),s=At(r),i=At(n?.id);return c.useEffect(()=>{if(!t&&!r&&s&&i!=null){if(!Bt(s)||document.activeElement===s.target)return;const a=o.get(i);if(!a)return;const{activatorNode:l,node:u}=a;if(!l.current&&!u.current)return;requestAnimationFrame(()=>{for(const h of[l.current,u.current]){if(!h)continue;const v=Mr(h);if(v){v.focus();break}}})}},[r,t,o,i,s]),null}function Yo(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((o,s)=>s({transform:o,...r}),n):n}function Go(e){return c.useMemo(()=>({draggable:{...at.draggable,...e?.draggable},droppable:{...at.droppable,...e?.droppable},dragOverlay:{...at.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function qo(e){let{activeNode:t,measure:n,initialRect:r,config:o=!0}=e;const s=c.useRef(!1),{x:i,y:a}=typeof o=="boolean"?{x:o,y:o}:o;ue(()=>{if(!i&&!a||!t){s.current=!1;return}if(s.current||!r)return;const u=t?.node.current;if(!u||u.isConnected===!1)return;const h=n(u),v=Mn(h,r);if(i||(v.x=0),a||(v.y=0),s.current=!0,Math.abs(v.x)>0||Math.abs(v.y)>0){const b=Nn(u);b&&b.scrollBy({top:v.y,left:v.x})}},[t,i,a,r,n])}const Yn=c.createContext({...se,scaleX:1,scaleY:1});var ye;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(ye||(ye={}));const Gn=c.memo(function(t){var n,r,o,s;let{id:i,accessibility:a,autoScroll:l=!0,children:u,sensors:h=$o,collisionDetection:v=Kr,measuring:b,modifiers:d,...x}=t;const m=c.useReducer(Wo,void 0,Ho),[y,w]=m,[S,E]=Vr(),[O,j]=c.useState(ye.Uninitialized),R=O===ye.Initialized,{draggable:{active:D,nodes:T,translate:L},droppable:{containers:z}}=y,N=D!=null?T.get(D):null,U=c.useRef({initial:null,translated:null}),G=c.useMemo(()=>{var W;return D!=null?{id:D,data:(W=N?.data)!=null?W:Vo,rect:U}:null},[D,N]),te=c.useRef(null),[de,we]=c.useState(null),[F,Se]=c.useState(null),ne=Ue(x,Object.values(x)),ve=Ke("DndDescribedBy",i),p=c.useMemo(()=>z.getEnabled(),[z]),C=Go(b),{droppableRects:k,measureDroppableContainers:M,measuringScheduled:ie}=_o(p,{dragging:R,dependencies:[L.x,L.y],config:C.droppable}),H=Eo(T,D),P=c.useMemo(()=>F?Mt(F):null,[F]),Y=vr(),X=Oo(H,C.draggable.measure);qo({activeNode:D!=null?T.get(D):null,config:Y.layoutShiftCompensation,initialRect:X,measure:C.draggable.measure});const A=yn(H,C.draggable.measure,X),Me=yn(H?H.parentElement:null),ae=c.useRef({activatorEvent:null,active:null,activeNode:H,collisionRect:null,collisions:null,droppableRects:k,draggableNodes:T,draggingNode:null,draggingNodeRect:null,droppableContainers:z,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),Ce=z.getNodeFor((n=ae.current.over)==null?void 0:n.id),fe=zo({measure:C.dragOverlay.measure}),Re=(r=fe.nodeRef.current)!=null?r:H,Ee=R?(o=fe.rect)!=null?o:A:null,Gt=!!(fe.nodeRef.current&&fe.rect),qt=ko(Gt?null:A),mt=Wn(Re?q(Re):null),ge=Io(R?Ce??H:null),Ze=Lo(ge),Qe=Yo(d,{transform:{x:L.x-qt.x,y:L.y-qt.y,scaleX:1,scaleY:1},activatorEvent:F,active:G,activeNodeRect:A,containerNodeRect:Me,draggingNodeRect:Ee,over:ae.current.over,overlayNodeRect:fe.rect,scrollableAncestors:ge,scrollableAncestorRects:Ze,windowRect:mt}),Xt=P?Te(P,L):null,Jt=Ao(ge),ar=Sn(Jt),cr=Sn(Jt,[A]),De=Te(Qe,ar),_e=Ee?eo(Ee,Qe):null,Ne=G&&_e?v({active:G,collisionRect:_e,droppableRects:k,droppableContainers:p,pointerCoordinates:Xt}):null,Kt=Xr(Ne,"id"),[pe,Zt]=c.useState(null),lr=Gt?Qe:Te(Qe,cr),ur=Zr(lr,(s=pe?.rect)!=null?s:null,A),xt=c.useRef(null),Qt=c.useCallback((W,J)=>{let{sensor:K,options:be}=J;if(te.current==null)return;const re=T.get(te.current);if(!re)return;const Z=W.nativeEvent,ce=new K({active:te.current,activeNode:re,event:Z,options:be,context:ae,onAbort(B){if(!T.get(B))return;const{onDragAbort:le}=ne.current,he={id:B};le?.(he),S({type:"onDragAbort",event:he})},onPending(B,me,le,he){if(!T.get(B))return;const{onDragPending:Pe}=ne.current,xe={id:B,constraint:me,initialCoordinates:le,offset:he};Pe?.(xe),S({type:"onDragPending",event:xe})},onStart(B){const me=te.current;if(me==null)return;const le=T.get(me);if(!le)return;const{onDragStart:he}=ne.current,Le={activatorEvent:Z,active:{id:me,data:le.data,rect:U}};Be.unstable_batchedUpdates(()=>{he?.(Le),j(ye.Initializing),w({type:$.DragStart,initialCoordinates:B,active:me}),S({type:"onDragStart",event:Le}),we(xt.current),Se(Z)})},onMove(B){w({type:$.DragMove,coordinates:B})},onEnd:Oe($.DragEnd),onCancel:Oe($.DragCancel)});xt.current=ce;function Oe(B){return async function(){const{active:le,collisions:he,over:Le,scrollAdjustedTranslate:Pe}=ae.current;let xe=null;if(le&&Pe){const{cancelDrop:ze}=ne.current;xe={activatorEvent:Z,active:le,collisions:he,delta:Pe,over:Le},B===$.DragEnd&&typeof ze=="function"&&await Promise.resolve(ze(xe))&&(B=$.DragCancel)}te.current=null,Be.unstable_batchedUpdates(()=>{w({type:B}),j(ye.Uninitialized),Zt(null),we(null),Se(null),xt.current=null;const ze=B===$.DragEnd?"onDragEnd":"onDragCancel";if(xe){const yt=ne.current[ze];yt?.(xe),S({type:ze,event:xe})}})}}},[T]),dr=c.useCallback((W,J)=>(K,be)=>{const re=K.nativeEvent,Z=T.get(be);if(te.current!==null||!Z||re.dndKit||re.defaultPrevented)return;const ce={active:Z};W(K,J.options,ce)===!0&&(re.dndKit={capturedBy:J.sensor},te.current=be,Qt(K,J))},[T,Qt]),en=Do(h,dr);Mo(h),ue(()=>{A&&O===ye.Initializing&&j(ye.Initialized)},[A,O]),c.useEffect(()=>{const{onDragMove:W}=ne.current,{active:J,activatorEvent:K,collisions:be,over:re}=ae.current;if(!J||!K)return;const Z={active:J,activatorEvent:K,collisions:be,delta:{x:De.x,y:De.y},over:re};Be.unstable_batchedUpdates(()=>{W?.(Z),S({type:"onDragMove",event:Z})})},[De.x,De.y]),c.useEffect(()=>{const{active:W,activatorEvent:J,collisions:K,droppableContainers:be,scrollAdjustedTranslate:re}=ae.current;if(!W||te.current==null||!J||!re)return;const{onDragOver:Z}=ne.current,ce=be.get(Kt),Oe=ce&&ce.rect.current?{id:ce.id,rect:ce.rect.current,data:ce.data,disabled:ce.disabled}:null,B={active:W,activatorEvent:J,collisions:K,delta:{x:re.x,y:re.y},over:Oe};Be.unstable_batchedUpdates(()=>{Zt(Oe),Z?.(B),S({type:"onDragOver",event:B})})},[Kt]),ue(()=>{ae.current={activatorEvent:F,active:G,activeNode:H,collisionRect:_e,collisions:Ne,droppableRects:k,draggableNodes:T,draggingNode:Re,draggingNodeRect:Ee,droppableContainers:z,over:pe,scrollableAncestors:ge,scrollAdjustedTranslate:De},U.current={initial:Ee,translated:_e}},[G,H,Ne,_e,T,Re,Ee,k,z,pe,ge,De]),So({...Y,delta:L,draggingRect:_e,pointerCoordinates:Xt,scrollableAncestors:ge,scrollableAncestorRects:Ze});const fr=c.useMemo(()=>({active:G,activeNode:H,activeNodeRect:A,activatorEvent:F,collisions:Ne,containerNodeRect:Me,dragOverlay:fe,draggableNodes:T,droppableContainers:z,droppableRects:k,over:pe,measureDroppableContainers:M,scrollableAncestors:ge,scrollableAncestorRects:Ze,measuringConfiguration:C,measuringScheduled:ie,windowRect:mt}),[G,H,A,F,Ne,Me,fe,T,z,k,pe,M,ge,Ze,C,ie,mt]),hr=c.useMemo(()=>({activatorEvent:F,activators:en,active:G,activeNodeRect:A,ariaDescribedById:{draggable:ve},dispatch:w,draggableNodes:T,over:pe,measureDroppableContainers:M}),[F,en,G,A,w,ve,T,pe,M]);return c.createElement(In.Provider,{value:E},c.createElement(gt.Provider,{value:hr},c.createElement(Un.Provider,{value:fr},c.createElement(Yn.Provider,{value:ur},u)),c.createElement(Uo,{disabled:a?.restoreFocus===!1})),c.createElement(Hr,{...a,hiddenTextDescribedById:ve}));function vr(){const W=de?.autoScrollEnabled===!1,J=typeof l=="object"?l.enabled===!1:l===!1,K=R&&!W&&!J;return typeof l=="object"?{...l,enabled:K}:{enabled:K}}}),Xo=c.createContext(null),Rn="button",Jo="Draggable";function Ko(e){let{id:t,data:n,disabled:r=!1,attributes:o}=e;const s=Ke(Jo),{activators:i,activatorEvent:a,active:l,activeNodeRect:u,ariaDescribedById:h,draggableNodes:v,over:b}=c.useContext(gt),{role:d=Rn,roleDescription:x="draggable",tabIndex:m=0}=o??{},y=l?.id===t,w=c.useContext(y?Yn:Xo),[S,E]=lt(),[O,j]=lt(),R=No(i,t),D=Ue(n);ue(()=>(v.set(t,{id:t,key:s,node:S,activatorNode:O,data:D}),()=>{const L=v.get(t);L&&L.key===s&&v.delete(t)}),[v,t]);const T=c.useMemo(()=>({role:d,tabIndex:m,"aria-disabled":r,"aria-pressed":y&&d===Rn?!0:void 0,"aria-roledescription":x,"aria-describedby":h.draggable}),[r,d,m,y,x,h.draggable]);return{active:l,activatorEvent:a,activeNodeRect:u,attributes:T,isDragging:y,listeners:r?void 0:R,node:S,over:b,setNodeRef:E,setActivatorNodeRef:j,transform:w}}function Zo(){return c.useContext(Un)}const Qo="Droppable",es={timeout:25};function ts(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:o}=e;const s=Ke(Qo),{active:i,dispatch:a,over:l,measureDroppableContainers:u}=c.useContext(gt),h=c.useRef({disabled:n}),v=c.useRef(!1),b=c.useRef(null),d=c.useRef(null),{disabled:x,updateMeasurementsFor:m,timeout:y}={...es,...o},w=Ue(m??r),S=c.useCallback(()=>{if(!v.current){v.current=!0;return}d.current!=null&&clearTimeout(d.current),d.current=setTimeout(()=>{u(Array.isArray(w.current)?w.current:[w.current]),d.current=null},y)},[y]),E=vt({callback:S,disabled:x||!i}),O=c.useCallback((T,L)=>{E&&(L&&(E.unobserve(L),v.current=!1),T&&E.observe(T))},[E]),[j,R]=lt(O),D=Ue(t);return c.useEffect(()=>{!E||!j.current||(E.disconnect(),v.current=!1,E.observe(j.current))},[j,E]),c.useEffect(()=>(a({type:$.RegisterDroppable,element:{id:r,key:s,disabled:n,node:j,rect:b,data:D}}),()=>a({type:$.UnregisterDroppable,key:s,id:r})),[r]),c.useEffect(()=>{n!==h.current.disabled&&(a({type:$.SetDroppableDisabled,id:r,key:s,disabled:n}),h.current.disabled=n)},[r,s,n,a]),{active:i,rect:b,isOver:l?.id===r,node:j,over:l,setNodeRef:R}}function pt(e,t,n){const r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function ns(e,t){return e.reduce((n,r,o)=>{const s=t.get(r);return s&&(n[o]=s),n},Array(e.length))}function ot(e){return e!==null&&e>=0}function rs(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function os(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const st={scaleX:1,scaleY:1},ss=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 l=is(n,i,o);if(i===o){const u=n[s];return u?{x:o<s?u.left+u.width-(a.left+a.width):u.left-a.left,y:0,...st}:null}return i>o&&i<=s?{x:-a.width-l,y:0,...st}:i<o&&i>=s?{x:a.width+l,y:0,...st}:{x:0,y:0,...st}};function is(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 qn=e=>{let{rects:t,activeIndex:n,overIndex:r,index:o}=e;const s=pt(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}},it={scaleX:1,scaleY:1},as=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 u=s[i];return u?{x:0,y:n<i?u.top+u.height-(a.top+a.height):u.top-a.top,...it}:null}const l=cs(s,o,n);return o>n&&o<=i?{x:0,y:-a.height-l,...it}:o<n&&o>=i?{x:0,y:a.height+l,...it}:{x:0,y:0,...it}};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 Xn="Sortable",Jn=c.createContext({activeIndex:-1,containerId:Xn,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:qn,disabled:{draggable:!1,droppable:!1}});function Kn(e){let{children:t,id:n,items:r,strategy:o=qn,disabled:s=!1}=e;const{active:i,dragOverlay:a,droppableRects:l,over:u,measureDroppableContainers:h}=Zo(),v=Ke(Xn,n),b=a.rect!==null,d=c.useMemo(()=>r.map(R=>typeof R=="object"&&"id"in R?R.id:R),[r]),x=i!=null,m=i?d.indexOf(i.id):-1,y=u?d.indexOf(u.id):-1,w=c.useRef(d),S=!rs(d,w.current),E=y!==-1&&m===-1||S,O=os(s);ue(()=>{S&&x&&h(d)},[S,d,x,h]),c.useEffect(()=>{w.current=d},[d]);const j=c.useMemo(()=>({activeIndex:m,containerId:v,disabled:O,disableTransforms:E,items:d,overIndex:y,useDragOverlay:b,sortedRects:ns(d,l),strategy:o}),[m,v,O.draggable,O.droppable,E,d,y,l,b,o]);return c.createElement(Jn.Provider,{value:j},t)}const ls=e=>{let{id:t,items:n,activeIndex:r,overIndex:o}=e;return pt(n,r,o).indexOf(t)},us=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:o,items:s,newIndex:i,previousItems:a,previousContainerId:l,transition:u}=e;return!u||!r||a!==s&&o===i?!1:n?!0:i!==o&&t===l},ds={duration:200,easing:"ease"},Zn="transform",fs=je.Transition.toString({property:Zn,duration:0,easing:"linear"}),hs={roleDescription:"sortable"};function vs(e){let{disabled:t,index:n,node:r,rect:o}=e;const[s,i]=c.useState(null),a=c.useRef(n);return ue(()=>{if(!t&&n!==a.current&&r.current){const l=o.current;if(l){const u=Ae(r.current,{ignoreTransform:!0}),h={x:l.left-u.left,y:l.top-u.top,scaleX:l.width/u.width,scaleY:l.height/u.height};(h.x||h.y)&&i(h)}}n!==a.current&&(a.current=n)},[t,n,r,o]),c.useEffect(()=>{s&&i(null)},[s]),s}function Qn(e){let{animateLayoutChanges:t=us,attributes:n,disabled:r,data:o,getNewIndex:s=ls,id:i,strategy:a,resizeObserverConfig:l,transition:u=ds}=e;const{items:h,containerId:v,activeIndex:b,disabled:d,disableTransforms:x,sortedRects:m,overIndex:y,useDragOverlay:w,strategy:S}=c.useContext(Jn),E=gs(r,d),O=h.indexOf(i),j=c.useMemo(()=>({sortable:{containerId:v,index:O,items:h},...o}),[v,o,O,h]),R=c.useMemo(()=>h.slice(h.indexOf(i)),[h,i]),{rect:D,node:T,isOver:L,setNodeRef:z}=ts({id:i,data:j,disabled:E.droppable,resizeObserverConfig:{updateMeasurementsFor:R,...l}}),{active:N,activatorEvent:U,activeNodeRect:G,attributes:te,setNodeRef:de,listeners:we,isDragging:F,over:Se,setActivatorNodeRef:ne,transform:ve}=Ko({id:i,data:j,attributes:{...hs,...n},disabled:E.draggable}),p=jr(z,de),C=!!N,k=C&&!x&&ot(b)&&ot(y),M=!w&&F,ie=M&&k?ve:null,P=k?ie??(a??S)({rects:m,activeNodeRect:G,activeIndex:b,overIndex:y,index:O}):null,Y=ot(b)&&ot(y)?s({id:i,items:h,activeIndex:b,overIndex:y}):O,X=N?.id,A=c.useRef({activeId:X,items:h,newIndex:Y,containerId:v}),Me=h!==A.current.items,ae=t({active:N,containerId:v,isDragging:F,isSorting:C,id:i,index:O,items:h,newIndex:A.current.newIndex,previousItems:A.current.items,previousContainerId:A.current.containerId,transition:u,wasDragging:A.current.activeId!=null}),Ce=vs({disabled:!ae,index:O,node:T,rect:D});return c.useEffect(()=>{C&&A.current.newIndex!==Y&&(A.current.newIndex=Y),v!==A.current.containerId&&(A.current.containerId=v),h!==A.current.items&&(A.current.items=h)},[C,Y,v,h]),c.useEffect(()=>{if(X===A.current.activeId)return;if(X!=null&&A.current.activeId==null){A.current.activeId=X;return}const Re=setTimeout(()=>{A.current.activeId=X},50);return()=>clearTimeout(Re)},[X]),{active:N,activeIndex:b,attributes:te,data:j,rect:D,index:O,newIndex:Y,items:h,isOver:L,isSorting:C,isDragging:F,listeners:we,node:T,overIndex:y,over:Se,setNodeRef:p,setActivatorNodeRef:ne,setDroppableNodeRef:z,setDraggableNodeRef:de,transform:Ce??P,transition:fe()};function fe(){if(Ce||Me&&A.current.newIndex===O)return fs;if(!(M&&!Bt(U)||!u)&&(C||ae))return je.Transition.toString({...u,property:Zn})}}function gs(e,t){var n,r;return typeof e=="boolean"?{draggable:e,droppable:!1}:{draggable:(n=e?.draggable)!=null?n:t.draggable,droppable:(r=e?.droppable)!=null?r:t.droppable}}I.Down,I.Right,I.Up,I.Left;const ps=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()),En=e=>{const t=bs(e);return t.charAt(0).toUpperCase()+t.slice(1)},er=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim(),ms=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0};var xs={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 ys=c.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:o="",children:s,iconNode:i,...a},l)=>c.createElement("svg",{ref:l,...xs,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:er("lucide",o),...!s&&!ms(a)&&{"aria-hidden":"true"},...a},[...i.map(([u,h])=>c.createElement(u,h)),...Array.isArray(s)?s:[s]]));const ee=(e,t)=>{const n=c.forwardRef(({className:r,...o},s)=>c.createElement(ys,{ref:s,iconNode:t,className:er(`lucide-${ps(En(e))}`,`lucide-${e}`,r),...o}));return n.displayName=En(e),n};const ws=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],Ss=ee("arrow-down",ws);const Cs=[["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"}]],Rs=ee("arrow-up-down",Cs);const Es=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],Ds=ee("arrow-up",Es);const _s=[["path",{d:"m19 21-7-4-7 4V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v16z",key:"1fy3hk"}]],Os=ee("bookmark",_s);const Ts=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],js=ee("chevron-left",Ts);const ks=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Is=ee("chevron-right",ks);const As=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 3v18",key:"108xh3"}]],Ms=ee("columns-2",As);const Ns=[["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"}]],Ls=ee("delete",Ns);const Ps=[["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"}]],zs=ee("ellipsis",Ps);const $s=[["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"}]],Vs=ee("funnel",$s);const Bs=[["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"}]],Fs=ee("grip-vertical",Bs);const Hs=[["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"}]],Ws=ee("pen",Hs);const Us=[["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"}]],Ys=ee("settings",Us);function _(e){return c.forwardRef((t,n)=>{const{children:r,...o}=t;return f.jsx(e,{ref:n,...o,children:r})})}const tr=e=>`table_column_order_v1:${e}`,Gs=e=>{const{tableId:t}=Q.state;localStorage.setItem(tr(t),JSON.stringify(e.map(n=>n.id))),Q.setState(n=>({...n,columnOrder:e})),Q.setState(n=>({...n,columnOrder:e}))},qs=e=>{Q.setState(t=>({...t,visibility:{...t.visibility,[e]:!t.visibility[e]}}))};function Xs(e){Q.setState(t=>t.sortColumn===e?{...t,sortDirection:t.sortDirection==="asc"?"desc":"asc"}:{...t,sortColumn:e,sortDirection:"asc"})}const Q=new Tn({tableId:"",sortColumn:null,sortDirection:"asc",visibility:{},columnOrder:[],data:[],sortableColumns:[]});function nr(e,t){const n=e[0]??{},o=(t&&t.length?t:Object.keys(n).map(l=>({id:l,label:l}))).filter(l=>Object.prototype.hasOwnProperty.call(n,l.id)),{tableId:s}=Q.state,i=JSON.parse(localStorage.getItem(tr(s))||"[]"),a=[...i.map(l=>o.find(u=>u.id===l)).filter(Boolean),...o.filter(l=>!i.includes(l.id))];Q.setState(l=>({...l,data:e,columnOrder:a,visibility:a.reduce((u,h)=>(u[h.id]=!0,u),{}),sortableColumns:a.map(u=>({id:u.id,label:u.label,sortable:!0}))}))}function rr(e){Q.setState(t=>({...t,tableId:e}))}const Js=_(g.Menu.Trigger),Ks=_(g.Menu.Positioner),Zs=_(g.Menu.Content),Qs=_(g.Menu.Item),ei=_(g.Checkbox.Label),ti=_(g.Checkbox.HiddenInput),ni=_(g.Checkbox.Control);function ri({visibility:e,onToggle:t}){const{sortableColumns:n}=qe(Q);return f.jsxs(g.Menu.Root,{closeOnSelect:!1,children:[f.jsx(Js,{asChild:!0,children:f.jsx(g.IconButton,{"aria-label":"Toggle columns",variant:"outline",size:"sm",ml:"1",children:f.jsx(Ms,{size:18})})}),f.jsx(g.Portal,{children:f.jsx(Ks,{children:f.jsx(Zs,{minW:"220px",children:n.map(r=>{const o=!!e[r.id];return f.jsx(Qs,{value:r.id,closeOnSelect:!1,children:f.jsxs(g.Checkbox.Root,{checked:o,onCheckedChange:()=>t(r.id),children:[f.jsx(ti,{}),f.jsx(ni,{}),f.jsx(ei,{children:r.label})]})},r.id)})})})})]})}function oi({id:e,children:t,onClick:n,cursor:r,borderRight:o,borderRightColor:s}){const{setNodeRef:i,attributes:a,listeners:l,transform:u,transition:h}=Qn({id:e});return f.jsx(g.Table.ColumnHeader,{ref:i,onClick:n,w:e==="id"?"80px":void 0,style:{transform:je.Transform.toString(u),transition:h,cursor:r,borderRight:o,borderRightColor:s},...a,children:f.jsxs(g.HStack,{justify:"space-between",children:[t,f.jsx("span",{...l,children:f.jsx(Fs,{size:12})})]})})}function si(){const{columnOrder:e,visibility:t,sortColumn:n,sortDirection:r,sortableColumns:o}=qe(Q),s=e.map(a=>o.find(l=>l.id===a.id)).filter(a=>a!==void 0).filter(a=>t[a.id]),i=a=>{const{active:l,over:u}=a;if(!u||l.id===u.id)return;const h=e.findIndex(d=>d.id===l.id),v=e.findIndex(d=>d.id===u.id),b=pt(e,h,v);Gs(b)};return f.jsx(g.Table.Header,{background:"gray.100",position:"sticky",top:0,p:"0",children:f.jsx(Gn,{collisionDetection:An,onDragEnd:i,children:f.jsx(Kn,{items:e.map(a=>a.id),strategy:ss,children:f.jsxs(g.Table.Row,{height:"28px",children:[s.map((a,l)=>{const u=n===a?.id;return f.jsx(oi,{id:a?.id,onClick:()=>a?.sortable&&Xs(a?.id),cursor:a?.sortable?"pointer":"default",borderRight:"2px solid #dcdcdc",children:f.jsxs("span",{style:{display:"flex",alignItems:"center",gap:6,userSelect:"none"},children:[a?.label,a?.sortable&&(u?r==="asc"?f.jsx(Ds,{size:14}):f.jsx(Ss,{size:14}):f.jsx(Rs,{size:14,opacity:.4}))]})},a?.id)}),f.jsx(g.Table.ColumnHeader,{borderRight:"2px solid #dcdcdc",children:"Actions"}),f.jsx(g.Table.ColumnHeader,{boxSize:"0.5",children:f.jsx(ri,{visibility:t,onToggle:qs})})]})})})})}const Dn=g.createListCollection({items:[{label:"10",value:"10"},{label:"20",value:"20"},{label:"50",value:"50"},{label:"100",value:"100"}]}),ii=_(g.Select.Positioner),ai=_(g.Select.Content),ci=_(g.Select.Item),li=_(g.Pagination.PrevTrigger),ui=_(g.Pagination.NextTrigger),di=_(g.Select.HiddenSelect),fi=_(g.Select.Control),hi=_(g.Select.Trigger),vi=_(g.Select.ValueText),gi=_(g.Select.IndicatorGroup),pi=_(g.Select.Indicator);function bi({totalCount:e,pageSize:t,currentPage:n,onPageChange:r,onPageSizeChange:o,siblingCount:s=2}){return f.jsx(g.Box,{width:"100%",children:f.jsxs(g.HStack,{justify:"space-between",mx:"auto",flexWrap:"wrap",children:[f.jsxs(g.HStack,{children:[f.jsx(g.Text,{fontSize:"sm",color:"gray.600",_dark:{color:"gray.400"},children:"Rows per page:"}),f.jsxs(g.Select.Root,{collection:Dn,size:"sm",width:"60px",onValueChange:i=>o&&o(Number(i.items[0].value)),value:[String(t)],children:[f.jsx(di,{}),f.jsxs(fi,{children:[f.jsx(hi,{children:f.jsx(vi,{placeholder:""})}),f.jsx(gi,{children:f.jsx(pi,{})})]}),f.jsx(g.Portal,{children:f.jsx(ii,{children:f.jsx(ai,{children:Dn.items.map(i=>f.jsxs(ci,{item:i.value,children:[i.label,f.jsx(g.Select.ItemIndicator,{})]},i.value))})})})]})]}),f.jsx(g.Pagination.Root,{count:e,pageSize:t,page:n,siblingCount:s,onPageChange:i=>r&&r(i.page),children:f.jsxs(g.ButtonGroup,{size:"sm",variant:"ghost",children:[f.jsx(li,{asChild:!0,children:f.jsx(g.IconButton,{"aria-label":"Previous page",children:f.jsx(js,{size:18})})}),f.jsx(g.Pagination.Items,{render:i=>f.jsx(g.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)}),f.jsx(ui,{asChild:!0,children:f.jsx(g.IconButton,{"aria-label":"Next page",children:f.jsx(Is,{size:18})})})]})})]})})}const mi=_(g.Menu.Item),xi=_(g.Menu.Content),yi=_(g.Menu.Positioner),wi=_(g.Menu.Trigger);function Si({data:e=[],actions:t=[]}){const{columnOrder:n,visibility:r}=qe(Q);return f.jsx(g.Table.Body,{children:e.map(o=>f.jsxs(g.Table.Row,{children:[n.filter(s=>r[s.id]).map(s=>f.jsx(g.Table.Cell,{children:o[s.id]},s.id)),f.jsx(g.Table.Cell,{textAlign:"center",display:"flex",gap:2,children:f.jsxs(g.Menu.Root,{children:[f.jsx(wi,{asChild:!0,children:f.jsx(g.IconButton,{"aria-label":"Open",variant:"ghost",size:"sm",children:f.jsx(zs,{size:16})})}),f.jsx(g.Portal,{children:f.jsx(yi,{children:f.jsx(xi,{children:t.map(s=>f.jsxs(mi,{onClick:()=>s.onClick(o),colorScheme:s.colorScheme,value:s.label,children:[s.icon,s.label]},s.label))})})})]})})]},o.id))})}function Ci({tableId:e,data:t=[],headers:n=[],loading:r=!1,emptyMessage:o="No data",actions:s,page:i=1,pageSize:a=10,onPageChange:l,onPageSizeChange:u,density:h="sm",totalCount:v=0,paginationMode:b="client"}){c.useEffect(()=>{rr(e)},[e]),c.useEffect(()=>{nr(t,n)},[t,n]);const{sortColumn:d,sortDirection:x,data:m}=qe(Q),y=c.useMemo(()=>{const w=[...m];if(d&&w.sort((S,E)=>x==="asc"?String(S[d]).localeCompare(String(E[d])):String(E[d]).localeCompare(String(S[d]))),b==="client"){const S=i*a;return w.slice(S,S+a)}return w},[m,d,x,i,a,b]);return f.jsxs(g.Box,{h:"100%",display:"flex",flexDirection:"column",p:2,pt:2,minHeight:0,children:[f.jsx(g.Box,{flex:"1",minHeight:0,overflow:"auto",children:r?f.jsx(g.Box,{display:"flex",alignItems:"center",justifyContent:"center",h:"100%",color:"gray.500",children:"Loading..."}):y.length===0?f.jsx(g.Box,{display:"flex",alignItems:"center",justifyContent:"center",h:"100%",color:"gray.500",children:o}):f.jsxs(g.Table.Root,{variant:"outline",w:"100%",size:h,children:[f.jsx(si,{}),f.jsx(Si,{data:y,actions:s})]})}),f.jsx(g.Box,{mt:.5,children:f.jsx(bi,{totalCount:v,pageSize:a,currentPage:i,onPageChange:l,onPageSizeChange:w=>{u&&u(w),i>1&&l&&l(1)}})})]})}const or=e=>`FILTER_PRESETS_${e??"default"}`;function Ri(e){try{return JSON.parse(localStorage.getItem(or(e))||"[]")}catch{return[]}}const Ge=new Tn({}),bt=e=>{const t=Ge.state[e];if(t)return t;const n=Ri(e);return Ge.setState(r=>({...r,[e]:n})),n},Yt=(e,t)=>{Ge.setState(n=>({...n,[e]:t})),localStorage.setItem(or(e),JSON.stringify(t))},sr=(e,t)=>{const n=bt(e).filter(r=>r.id!==t);Yt(e,n)},ir=(e,t)=>{const n=[t,...bt(e)];Yt(e,n)},Ei=_(g.Checkbox.Root),Di=_(g.Checkbox.HiddenInput),_i=_(g.Checkbox.Control),Oi=_(g.Slider.Root),Ti=_(g.Slider.Track),ji=_(g.Slider.Range),ki=_(g.Slider.Thumbs),Ii=_(g.Slider.Control),Ai=({filter:e,onVisibilityChange:t,onSizeChange:n})=>{const{attributes:r,listeners:o,setNodeRef:s,transform:i,transition:a}=Qn({id:e.id}),l={transform:je.Transform.toString(i),transition:a,cursor:"grab"};return f.jsxs(g.VStack,{ref:s,style:l,align:"stretch",border:"1px solid",borderColor:"gray.200",rounded:"md",p:3,mb:3,...r,...o,children:[f.jsx(g.Text,{fontWeight:"bold",children:e.label}),f.jsxs(g.HStack,{justify:"space-between",children:[f.jsx(g.Text,{fontSize:"sm",children:"Visible"}),f.jsxs(Ei,{checked:e.visible,onCheckedChange:u=>t&&t(e.id,!!u),size:"sm",children:[f.jsx(Di,{}),f.jsx(_i,{})]})]}),f.jsxs(g.VStack,{align:"stretch",gap:1,children:[f.jsx(g.Text,{fontSize:"sm",children:"Size"}),f.jsx(Oi,{width:"200px",min:1,max:5,step:.5,value:[e.size??1],onChange:u=>n&&n(e.id,u[0]),children:f.jsxs(Ii,{children:[f.jsx(Ti,{children:f.jsx(ji,{})}),f.jsx(ki,{})]})})]})]})},Mi=_(g.Drawer.Root),Ni=_(g.Drawer.Trigger),Li=_(g.Drawer.Backdrop),Pi=_(g.Drawer.Positioner),zi=_(g.Drawer.Content),$i=_(g.Drawer.Header),Vi=_(g.Drawer.Title),Bi=_(g.Drawer.Body),Fi=_(g.Drawer.Footer),Hi=_(g.Drawer.CloseTrigger),Wi=_(g.Tabs.Root),Ui=_(g.Tabs.List),jt=_(g.Tabs.Trigger),kt=_(g.Tabs.Content),Yi=({filterDrawerSize:e="sm",onVisibilityChange:t,onSizeChange:n,onClear:r,filters:o,pageKey:s="default",currentFilters:i={},onLoadPreset:a,activePresetName:l,onReorder:u})=>{const v=qe(Ge)[s]??bt(s),b=()=>{const d=prompt("Preset name?");d&&ir(s,{id:crypto.randomUUID(),name:d,date:new Date().toISOString(),filters:i})};return f.jsx(g.HStack,{wrap:"wrap",children:f.jsxs(Mi,{size:e,children:[f.jsx(Ni,{asChild:!0,children:f.jsxs(g.IconButton,{"aria-label":"Open filters",variant:"outline",size:"xs",ml:2,p:2,children:[f.jsx(Vs,{size:16}),"Filters"]})}),f.jsxs(g.Portal,{children:[f.jsx(Li,{}),f.jsx(Pi,{children:f.jsxs(zi,{children:[f.jsx($i,{children:f.jsx(Vi,{children:"Filters"})}),f.jsx(Bi,{overflowY:"auto",pt:1,children:f.jsxs(Wi,{defaultValue:"view",children:[f.jsxs(Ui,{mb:4,children:[f.jsxs(jt,{value:"view",children:[f.jsx(Ws,{size:16}),"Edit"]}),f.jsxs(jt,{value:"settings",children:[f.jsx(Ys,{size:16}),"Settings"]}),f.jsxs(jt,{value:"presets",children:[f.jsx(Os,{size:16}),"Presets"]})]}),f.jsx(kt,{value:"view",children:o.filter(d=>d.visible).map(d=>f.jsxs(g.VStack,{align:"stretch",border:"1px solid",borderColor:"gray.200",rounded:"md",p:3,mb:3,children:[f.jsx(g.Text,{fontWeight:"bold",children:d.label}),d.customComponent]},d.id))}),f.jsx(kt,{value:"settings",children:f.jsx(Gn,{sensors:Ur(Wr(Ut)),collisionDetection:An,onDragEnd:({active:d,over:x})=>{if(!x||d.id===x.id)return;const m=o.findIndex(S=>S.id===d.id),y=o.findIndex(S=>S.id===x.id),w=pt(o,m,y);console.log(w),u?.(w)},children:f.jsx(Kn,{items:o.map(d=>d.id),strategy:as,children:o.map(d=>f.jsx(Ai,{filter:d,onVisibilityChange:t,onSizeChange:n},d.id))})})}),f.jsx(kt,{value:"presets",children:f.jsxs(g.VStack,{align:"stretch",mb:3,children:[f.jsx(g.Button,{size:"sm",colorScheme:"blue",onClick:b,children:"Save Current Filters"}),v.length===0&&f.jsx(g.Text,{fontSize:"xs",color:"gray.500",children:"No presets saved yet."}),v.map(d=>f.jsxs(g.HStack,{justify:"space-between",border:"1px solid",borderColor:l===d.name?"blue.300":"gray.200",rounded:"md",p:2,children:[f.jsxs(g.VStack,{align:"start",gap:0,children:[f.jsx(g.Text,{fontWeight:"bold",fontSize:"sm",children:d.name}),f.jsx(g.Text,{fontSize:"xs",color:"gray.500",children:new Date(d.date).toLocaleDateString()})]}),f.jsxs(g.HStack,{children:[f.jsx(g.Button,{size:"xs",variant:"ghost",onClick:()=>a?.(d.filters,d.name),children:"Load"}),f.jsx(g.IconButton,{size:"xs","aria-label":"Delete preset",variant:"ghost",onClick:()=>sr(s,d.id),children:f.jsx(Ls,{size:14})})]})]},d.id))]})})]})}),f.jsxs(Fi,{justify:"space-between",children:[f.jsx(g.Button,{size:"sm",variant:"ghost",colorScheme:"red",onClick:()=>r&&r(),children:"Clear All"}),f.jsx(Hi,{asChild:!0,children:f.jsx(g.CloseButton,{})})]})]})})]})]})})},Gi=({title:e,filters:t,onVisibilityChange:n,onReorder:r,onSizeChange:o,onClear:s,maxToolbarUnits:i,pageKey:a,currentFilters:l,onLoadPreset:u,activePresetName:h,filterDrawerSize:v="sm"})=>f.jsxs(g.HStack,{wrap:"wrap",pl:2,pr:2,width:"100%",justify:"space-between",children:[e,f.jsxs(g.HStack,{children:[t.length>0&&t.filter(b=>b.visible).map(b=>f.jsx(g.HStack,{children:b.customComponent},b.id)),f.jsx(Yi,{filterDrawerSize:v,onVisibilityChange:n?(b,d)=>n(b,d):void 0,onReorder:r,onSizeChange:o?(b,d)=>o(b,d):void 0,onClear:s,maxToolbarUnits:i,pageKey:a,filters:t,currentFilters:l,onLoadPreset:u,activePresetName:h})]})]}),qi=(e,t)=>{localStorage.setItem(`FILTER_ORDER_${e}`,JSON.stringify(t))},Xi=e=>{try{return JSON.parse(localStorage.getItem(`FILTER_ORDER_${e}`)||"[]")}catch{return[]}};exports.DataTable=Ci;exports.Filters=Gi;exports.addPreset=ir;exports.deletePreset=sr;exports.getPresets=bt;exports.loadOrder=Xi;exports.presetStore=Ge;exports.saveOrder=qi;exports.savePresets=Yt;exports.setData=nr;exports.setTableId=rr;exports.tableStore=Q;exports.withChildren=_;
|
|
10
|
+
`},cs={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 us(e){let{announcements:t=cs,container:n,hiddenTextDescribedById:r,screenReaderInstructions:o=ls}=e;const{announce:s,announcement:i}=ss(),l=tt("DndLiveRegion"),[u,f]=d.useState(!1);if(d.useEffect(()=>{f(!0)},[]),is(d.useMemo(()=>({onDragStart(g){let{active:m}=g;s(t.onDragStart({active:m}))},onDragMove(g){let{active:m,over:h}=g;t.onDragMove&&s(t.onDragMove({active:m,over:h}))},onDragOver(g){let{active:m,over:h}=g;s(t.onDragOver({active:m,over:h}))},onDragEnd(g){let{active:m,over:h}=g;s(t.onDragEnd({active:m,over:h}))},onDragCancel(g){let{active:m,over:h}=g;s(t.onDragCancel({active:m,over:h}))}}),[s,t])),!u)return null;const p=d.createElement(d.Fragment,null,d.createElement(rs,{id:r,value:o.draggable}),d.createElement(os,{id:l,announcement:i}));return n?Ue.createPortal(p,n):p}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 pt(){}function ds(e,t){return d.useMemo(()=>({sensor:e,options:{}}),[e,t])}function fs(){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 hs(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function gs(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function ps(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function vs(e,t){if(!e||e.length===0)return null;const[n]=e;return n[t]}function Rn(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=Rn(t,t.left,t.top),s=[];for(const i of r){const{id:l}=i,u=n.get(l);if(u){const f=hs(Rn(u),o);s.push({id:l,data:{droppableContainer:i,value:f}})}}return s.sort(gs)};function bs(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,p=i*l,g=p/(u+f-p);return Number(g.toFixed(4))}return 0}const ms=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=bs(l,t);u>0&&o.push({id:i,data:{droppableContainer:s,value:u}})}}return o.sort(ps)};function xs(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 ys(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 Ss=ys(1);function ws(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 Cs(e,t,n){const r=ws(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)),p=o?e.width/o:e.width,g=s?e.height/s:e.height;return{width:p,height:g,top:f,right:u+p,bottom:f+g,left:u}}const Rs={ignoreTransform:!1};function Le(e,t){t===void 0&&(t=Rs);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:f,transformOrigin:p}=K(e).getComputedStyle(e);f&&(n=Cs(n,f,p))}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 En(e){return Le(e,{ignoreTransform:!0})}function Es(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function Ds(e,t){return t===void 0&&(t=K(e).getComputedStyle(e)),t.position==="fixed"}function Ts(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 Gt(e,t){const n=[];function r(o){if(t!=null&&n.length>=t||!o)return n;if(Yt(o)&&o.scrollingElement!=null&&!n.includes(o.scrollingElement))return n.push(o.scrollingElement),n;if(!Qe(o)||Fn(o)||n.includes(o))return n;const s=K(e).getComputedStyle(o);return o!==e&&Ts(o,s)&&n.push(o),Ds(o,s)?n:r(o.parentNode)}return e?r(e):n}function Wn(e){const[t]=Gt(e,1);return t??null}function It(e){return!mt||!e?null:Ae(e)?e:Ht(e)?Yt(e)||e===Ne(e).scrollingElement?window:Qe(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 zt(e){return{x:Un(e),y:Gn(e)}}var V;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(V||(V={}));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 js={x:.2,y:.2};function _s(e,t,n,r,o){let{top:s,left:i,right:l,bottom:u}=n;r===void 0&&(r=10),o===void 0&&(o=js);const{isTop:f,isBottom:p,isLeft:g,isRight:m}=qn(e),h={x:0,y:0},x={x:0,y:0},v={height:t.height*o.y,width:t.width*o.x};return!f&&s<=t.top+v.height?(h.y=V.Backward,x.y=r*Math.abs((t.top+v.height-s)/v.height)):!p&&u>=t.bottom-v.height&&(h.y=V.Forward,x.y=r*Math.abs((t.bottom-v.height-u)/v.height)),!m&&l>=t.right-v.width?(h.x=V.Forward,x.x=r*Math.abs((t.right-v.width-l)/v.width)):!g&&i<=t.left+v.width&&(h.x=V.Backward,x.x=r*Math.abs((t.left+v.width-i)/v.width)),{direction:h,speed:x}}function Os(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,zt(n)),ae)}function Is(e){return e.reduce((t,n)=>t+Un(n),0)}function ks(e){return e.reduce((t,n)=>t+Gn(n),0)}function Ms(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 As=[["x",["left","right"],Is],["y",["top","bottom"],ks]];class Xt{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=Gt(n),o=Kn(r);this.rect={...t},this.width=t.width,this.height=t.height;for(const[s,i,l]of As)for(const u of i)Object.defineProperty(this,u,{get:()=>{const f=l(r),p=o[s]-f;return this.rect[u]+p},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 Ns(e){const{EventTarget:t}=K(e);return e instanceof t?e:Ne(e)}function kt(e,t){const n=Math.abs(e.x),r=Math.abs(e.y);return typeof t=="number"?Math.sqrt(n**2+r**2)>t:"x"in t&&"y"in t?n>t.x&&r>t.y:"x"in t?n>t.x:"y"in t?r>t.y:!1}var oe;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(oe||(oe={}));function Dn(e){e.preventDefault()}function Ls(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]},$s=(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(oe.Resize,this.handleCancel),this.windowListeners.add(oe.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(oe.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props,r=t.node.current;r&&Ms(r),n(ae)}handleKeyDown(t){if(Ut(t)){const{active:n,context:r,options:o}=this.props,{keyboardCodes:s=Jn,coordinateGetter:i=$s,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,p=f?{x:f.left,y:f.top}:ae;this.referenceCoordinates||(this.referenceCoordinates=p);const g=i(t,{active:n,context:r.current,currentCoordinates:p});if(g){const m=gt(g,p),h={x:0,y:0},{scrollableAncestors:x}=r.current;for(const v of x){const y=t.code,{isTop:S,isRight:C,isLeft:R,isBottom:T,maxScroll:_,minScroll:D}=qn(v),j=Os(v),O={x:Math.min(y===k.Right?j.right-j.width/2:j.right,Math.max(y===k.Right?j.left:j.left+j.width/2,g.x)),y:Math.min(y===k.Down?j.bottom-j.height/2:j.bottom,Math.max(y===k.Down?j.top:j.top+j.height/2,g.y))},L=y===k.Right&&!C||y===k.Left&&!R,P=y===k.Down&&!T||y===k.Up&&!S;if(L&&O.x!==g.x){const N=v.scrollLeft+m.x,U=y===k.Right&&N<=_.x||y===k.Left&&N>=D.x;if(U&&!m.y){v.scrollTo({left:N,behavior:l});return}U?h.x=v.scrollLeft-N:h.x=y===k.Right?v.scrollLeft-_.x:v.scrollLeft-D.x,h.x&&v.scrollBy({left:-h.x,behavior:l});break}else if(P&&O.y!==g.y){const N=v.scrollTop+m.y,U=y===k.Down&&N<=_.y||y===k.Up&&N>=D.y;if(U&&!m.x){v.scrollTo({top:N,behavior:l});return}U?h.y=v.scrollTop-N:h.y=y===k.Down?v.scrollTop-_.y:v.scrollTop-D.y,h.y&&v.scrollBy({top:-h.y,behavior:l});break}}this.handleMove(t,ke(gt(g,this.referenceCoordinates),h))}}}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 Tn(e){return!!(e&&"distance"in e)}function jn(e){return!!(e&&"delay"in e)}class qt{constructor(t,n,r){var o;r===void 0&&(r=Ns(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=Pt(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(oe.Resize,this.handleCancel),this.windowListeners.add(oe.DragStart,Dn),this.windowListeners.add(oe.VisibilityChange,this.handleCancel),this.windowListeners.add(oe.ContextMenu,Dn),this.documentListeners.add(oe.Keydown,this.handleKeydown),n){if(r!=null&&r({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(jn(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(Tn(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(oe.Click,Ls,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(oe.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=Pt(t))!=null?n:ae,f=gt(o,u);if(!r&&l){if(Tn(l)){if(l.tolerance!=null&&kt(f,l.tolerance))return this.handleCancel();if(kt(f,l.distance))return this.handleStart()}if(jn(l)&&kt(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 Ps={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class Kt extends qt{constructor(t){const{event:n}=t,r=Ne(n.target);super(t,Ps,r)}}Kt.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 zs={move:{name:"mousemove"},end:{name:"mouseup"}};var Ft;(function(e){e[e.RightClick=2]="RightClick"})(Ft||(Ft={}));class Fs extends qt{constructor(t){super(t,zs,Ne(t.event.target))}}Fs.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===Ft.RightClick?!1:(r?.({event:n}),!0)}}];const Mt={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class Vs extends qt{constructor(t){super(t,Mt)}static setup(){return window.addEventListener(Mt.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(Mt.move.name,t)};function t(){}}}Vs.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 vt;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(vt||(vt={}));function Bs(e){let{acceleration:t,activator:n=Xe.Pointer,canScroll:r,draggingRect:o,enabled:s,interval:i=5,order:l=vt.TreeOrder,pointerCoordinates:u,scrollableAncestors:f,scrollableAncestorRects:p,delta:g,threshold:m}=e;const h=Ys({delta:g,disabled:!s}),[x,v]=Zo(),y=d.useRef({x:0,y:0}),S=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),T=d.useCallback(()=>{const D=R.current;if(!D)return;const j=y.current.x*S.current.x,O=y.current.y*S.current.y;D.scrollBy(j,O)},[]),_=d.useMemo(()=>l===vt.TreeOrder?[...f].reverse():f,[l,f]);d.useEffect(()=>{if(!s||!f.length||!C){v();return}for(const D of _){if(r?.(D)===!1)continue;const j=f.indexOf(D),O=p[j];if(!O)continue;const{direction:L,speed:P}=_s(D,O,C,t,m);for(const N of["x","y"])h[N][L[N]]||(P[N]=0,L[N]=0);if(P.x>0||P.y>0){v(),R.current=D,x(T,i),y.current=P,S.current=L;return}}y.current={x:0,y:0},S.current={x:0,y:0},v()},[t,T,r,v,s,i,JSON.stringify(C),JSON.stringify(h),x,f,_,p,JSON.stringify(m)])}const Hs={x:{[V.Backward]:!1,[V.Forward]:!1},y:{[V.Backward]:!1,[V.Forward]:!1}};function Ys(e){let{delta:t,disabled:n}=e;const r=$t(t);return et(o=>{if(n||!r||!o)return Hs;const s={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[V.Backward]:o.x[V.Backward]||s.x===-1,[V.Forward]:o.x[V.Forward]||s.x===1},y:{[V.Backward]:o.y[V.Backward]||s.y===-1,[V.Forward]:o.y[V.Forward]||s.y===1}}},[n,t,r])}function Ws(e,t){const n=t!=null?e.get(t):void 0,r=n?n.node.current:null;return et(o=>{var s;return t==null?null:(s=r??o)!=null?s:null},[r,t])}function Us(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 _n=new Map;function Gs(e,t){let{dragging:n,dependencies:r,config:o}=t;const[s,i]=d.useState(null),{frequency:l,measure:u,strategy:f}=o,p=d.useRef(e),g=y(),m=Ke(g),h=d.useCallback(function(S){S===void 0&&(S=[]),!m.current&&i(C=>C===null?S:C.concat(S.filter(R=>!C.includes(R))))},[m]),x=d.useRef(null),v=et(S=>{if(g&&!n)return _n;if(!S||S===_n||p.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 T=R.node.current,_=T?new Xt(u(T),T):null;R.rect.current=_,_&&C.set(R.id,_)}return C}return S},[e,s,n,g,u]);return d.useEffect(()=>{p.current=e},[e]),d.useEffect(()=>{g||h()},[n,g]),d.useEffect(()=>{s&&s.length>0&&i(null)},[JSON.stringify(s)]),d.useEffect(()=>{g||typeof l!="number"||x.current!==null||(x.current=setTimeout(()=>{h(),x.current=null},l))},[l,g,h,...r]),{droppableRects:v,measureDroppableContainers:h,measuringScheduled:s!=null};function y(){switch(f){case Je.Always:return!1;case Je.BeforeDragging:return n;default:return!n}}}function Qn(e,t){return et(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function Xs(e,t){return Qn(e,t)}function qs(e){let{callback:t,disabled:n}=e;const r=Wt(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=Wt(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 Ks(e){return new Xt(Le(e),e)}function On(e,t,n){t===void 0&&(t=Ks);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 p=t(e);return JSON.stringify(u)===JSON.stringify(p)?u:p})}const i=qs({callback(u){if(e)for(const f of u){const{type:p,target:g}=f;if(p==="childList"&&g instanceof HTMLElement&&g.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 Js(e){const t=Qn(e);return Yn(e,t)}const In=[];function Zs(e){const t=d.useRef(e),n=et(r=>e?r&&r!==In&&e&&t.current&&e.parentNode===t.current.parentNode?r:Gt(e):In,[e]);return d.useEffect(()=>{t.current=e},[e]),n}function Qs(e){const[t,n]=d.useState(null),r=d.useRef(e),o=d.useCallback(s=>{const i=It(s.target);i&&n(l=>l?(l.set(i,zt(i)),new Map(l)):null)},[]);return d.useEffect(()=>{const s=r.current;if(e!==s){i(s);const l=e.map(u=>{const f=It(u);return f?(f.addEventListener("scroll",o,{passive:!0}),[f,zt(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=It(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 kn(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?gt(e,n.current):ae}function ei(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 ti(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?Es(e):null,[e])}const Mn=[];function ni(e,t){t===void 0&&(t=Le);const[n]=e,r=er(n?K(n):null),[o,s]=d.useState(Mn);function i(){s(()=>e.length?e.map(u=>Xn(u)?r:new Xt(t(u),u)):Mn)}const l=xt({callback:i});return fe(()=>{l?.disconnect(),i(),e.forEach(u=>l?.observe(u))},[e]),o}function ri(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return Qe(t)?t:e}function oi(e){let{measure:t}=e;const[n,r]=d.useState(null),o=d.useCallback(f=>{for(const{target:p}of f)if(Qe(p)){r(g=>{const m=t(p);return g?{...g,width:m.width,height:m.height}:m});break}},[t]),s=xt({callback:o}),i=d.useCallback(f=>{const p=ri(f);s?.disconnect(),p&&s?.observe(p),r(p?t(p):null)},[t,s]),[l,u]=ht(i);return d.useMemo(()=>({nodeRef:l,rect:n,setRef:u}),[n,l,u])}const si=[{sensor:Kt,options:{}},{sensor:Zn,options:{}}],ii={current:{}},dt={draggable:{measure:En},droppable:{measure:En,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 ai={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:pt},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:dt,measureDroppableContainers:pt,windowRect:null,measuringScheduled:!1},li={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:pt,draggableNodes:new Map,over:null,measureDroppableContainers:pt},yt=d.createContext(li),tr=d.createContext(ai);function ci(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new qe}}}function ui(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 di(e){let{disabled:t}=e;const{active:n,activatorEvent:r,draggableNodes:o}=d.useContext(yt),s=$t(r),i=$t(n?.id);return d.useEffect(()=>{if(!t&&!r&&s&&i!=null){if(!Ut(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 p of[u.current,f.current]){if(!p)continue;const g=ts(p);if(g){g.focus();break}}})}},[r,t,o,i,s]),null}function fi(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((o,s)=>s({transform:o,...r}),n):n}function hi(e){return d.useMemo(()=>({draggable:{...dt.draggable,...e?.draggable},droppable:{...dt.droppable,...e?.droppable},dragOverlay:{...dt.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function gi(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 p=n(f),g=Yn(p,r);if(i||(g.x=0),l||(g.y=0),s.current=!0,Math.abs(g.x)>0||Math.abs(g.y)>0){const m=Wn(f);m&&m.scrollBy({top:g.y,left:g.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:p=si,collisionDetection:g=ms,measuring:m,modifiers:h,...x}=t;const v=d.useReducer(ui,void 0,ci),[y,S]=v,[C,R]=as(),[T,_]=d.useState(we.Uninitialized),D=T===we.Initialized,{draggable:{active:j,nodes:O,translate:L},droppable:{containers:P}}=y,N=j!=null?O.get(j):null,U=d.useRef({initial:null,translated:null}),X=d.useMemo(()=>{var W;return j!=null?{id:j,data:(W=N?.data)!=null?W:ii,rect:U}:null},[j,N]),te=d.useRef(null),[he,Re]=d.useState(null),[H,Ee]=d.useState(null),ne=Ke(x,Object.values(x)),ve=tt("DndDescribedBy",i),b=d.useMemo(()=>P.getEnabled(),[P]),E=hi(m),{droppableRects:I,measureDroppableContainers:A,measuringScheduled:le}=Gs(b,{dragging:D,dependencies:[L.x,L.y],config:E.droppable}),Y=Ws(O,j),$=d.useMemo(()=>H?Pt(H):null,[H]),G=Sr(),J=Xs(Y,E.draggable.measure);gi({activeNode:j!=null?O.get(j):null,config:G.layoutShiftCompensation,initialRect:J,measure:E.draggable.measure});const M=On(Y,E.draggable.measure,J),$e=On(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=oi({measure:E.dragOverlay.measure}),Te=(r=ge.nodeRef.current)!=null?r:Y,je=D?(o=ge.rect)!=null?o:M:null,Zt=!!(ge.nodeRef.current&&ge.rect),Qt=Js(Zt?null:M),wt=er(Te?K(Te):null),be=Zs(D?De??Y:null),nt=ni(be),rt=fi(h,{transform:{x:L.x-Qt.x,y:L.y-Qt.y,scaleX:1,scaleY:1},activatorEvent:H,active:X,activeNodeRect:M,containerNodeRect:$e,draggingNodeRect:je,over:ce.current.over,overlayNodeRect:ge.rect,scrollableAncestors:be,scrollableAncestorRects:nt,windowRect:wt}),en=$?ke($,L):null,tn=Qs(be),gr=kn(tn),pr=kn(tn,[M]),_e=ke(rt,gr),Oe=je?Ss(je,rt):null,Pe=X&&Oe?g({active:X,collisionRect:Oe,droppableRects:I,droppableContainers:b,pointerCoordinates:en}):null,nn=vs(Pe,"id"),[me,rn]=d.useState(null),vr=Zt?rt:ke(rt,pr),br=xs(vr,(s=me?.rect)!=null?s:null,M),Ct=d.useRef(null),on=d.useCallback((W,Z)=>{let{sensor:Q,options:xe}=Z;if(te.current==null)return;const re=O.get(te.current);if(!re)return;const ee=W.nativeEvent,ue=new Q({active:te.current,activeNode:re,event:ee,options:xe,context:ce,onAbort(B){if(!O.get(B))return;const{onDragAbort:de}=ne.current,pe={id:B};de?.(pe),C({type:"onDragAbort",event:pe})},onPending(B,ye,de,pe){if(!O.get(B))return;const{onDragPending:Fe}=ne.current,Se={id:B,constraint:ye,initialCoordinates:de,offset:pe};Fe?.(Se),C({type:"onDragPending",event:Se})},onStart(B){const ye=te.current;if(ye==null)return;const de=O.get(ye);if(!de)return;const{onDragStart:pe}=ne.current,ze={activatorEvent:ee,active:{id:ye,data:de.data,rect:U}};Ue.unstable_batchedUpdates(()=>{pe?.(ze),_(we.Initializing),S({type:F.DragStart,initialCoordinates:B,active:ye}),C({type:"onDragStart",event:ze}),Re(Ct.current),Ee(ee)})},onMove(B){S({type:F.DragMove,coordinates:B})},onEnd:Ie(F.DragEnd),onCancel:Ie(F.DragCancel)});Ct.current=ue;function Ie(B){return async function(){const{active:de,collisions:pe,over:ze,scrollAdjustedTranslate:Fe}=ce.current;let Se=null;if(de&&Fe){const{cancelDrop:Ve}=ne.current;Se={activatorEvent:ee,active:de,collisions:pe,delta:Fe,over:ze},B===F.DragEnd&&typeof Ve=="function"&&await Promise.resolve(Ve(Se))&&(B=F.DragCancel)}te.current=null,Ue.unstable_batchedUpdates(()=>{S({type:B}),_(we.Uninitialized),rn(null),Re(null),Ee(null),Ct.current=null;const Ve=B===F.DragEnd?"onDragEnd":"onDragCancel";if(Se){const Rt=ne.current[Ve];Rt?.(Se),C({type:Ve,event:Se})}})}}},[O]),mr=d.useCallback((W,Z)=>(Q,xe)=>{const re=Q.nativeEvent,ee=O.get(xe);if(te.current!==null||!ee||re.dndKit||re.defaultPrevented)return;const ue={active:ee};W(Q,Z.options,ue)===!0&&(re.dndKit={capturedBy:Z.sensor},te.current=xe,on(Q,Z))},[O,on]),sn=Us(p,mr);ei(p),fe(()=>{M&&T===we.Initializing&&_(we.Initialized)},[M,T]),d.useEffect(()=>{const{onDragMove:W}=ne.current,{active:Z,activatorEvent:Q,collisions:xe,over:re}=ce.current;if(!Z||!Q)return;const ee={active:Z,activatorEvent:Q,collisions:xe,delta:{x:_e.x,y:_e.y},over:re};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:re}=ce.current;if(!W||te.current==null||!Z||!re)return;const{onDragOver:ee}=ne.current,ue=xe.get(nn),Ie=ue&&ue.rect.current?{id:ue.id,rect:ue.rect.current,data:ue.data,disabled:ue.disabled}:null,B={active:W,activatorEvent:Z,collisions:Q,delta:{x:re.x,y:re.y},over:Ie};Ue.unstable_batchedUpdates(()=>{rn(Ie),ee?.(B),C({type:"onDragOver",event:B})})},[nn]),fe(()=>{ce.current={activatorEvent:H,active:X,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}},[X,Y,Pe,Oe,O,Te,je,I,P,me,be,_e]),Bs({...G,delta:L,draggingRect:Oe,pointerCoordinates:en,scrollableAncestors:be,scrollableAncestorRects:nt});const xr=d.useMemo(()=>({active:X,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:nt,measuringConfiguration:E,measuringScheduled:le,windowRect:wt}),[X,Y,M,H,Pe,$e,ge,O,P,I,me,A,be,nt,E,le,wt]),yr=d.useMemo(()=>({activatorEvent:H,activators:sn,active:X,activeNodeRect:M,ariaDescribedById:{draggable:ve},dispatch:S,draggableNodes:O,over:me,measureDroppableContainers:A}),[H,sn,X,M,S,ve,O,me,A]);return d.createElement(Bn.Provider,{value:R},d.createElement(yt.Provider,{value:yr},d.createElement(tr.Provider,{value:xr},d.createElement(nr.Provider,{value:br},f)),d.createElement(di,{disabled:l?.restoreFocus===!1})),d.createElement(us,{...l,hiddenTextDescribedById:ve}));function Sr(){const W=he?.autoScrollEnabled===!1,Z=typeof u=="object"?u.enabled===!1:u===!1,Q=D&&!W&&!Z;return typeof u=="object"?{...u,enabled:Q}:{enabled:Q}}}),pi=d.createContext(null),An="button",vi="Draggable";function bi(e){let{id:t,data:n,disabled:r=!1,attributes:o}=e;const s=tt(vi),{activators:i,activatorEvent:l,active:u,activeNodeRect:f,ariaDescribedById:p,draggableNodes:g,over:m}=d.useContext(yt),{role:h=An,roleDescription:x="draggable",tabIndex:v=0}=o??{},y=u?.id===t,S=d.useContext(y?nr:pi),[C,R]=ht(),[T,_]=ht(),D=ti(i,t),j=Ke(n);fe(()=>(g.set(t,{id:t,key:s,node:C,activatorNode:T,data:j}),()=>{const L=g.get(t);L&&L.key===s&&g.delete(t)}),[g,t]);const O=d.useMemo(()=>({role:h,tabIndex:v,"aria-disabled":r,"aria-pressed":y&&h===An?!0:void 0,"aria-roledescription":x,"aria-describedby":p.draggable}),[r,h,v,y,x,p.draggable]);return{active:u,activatorEvent:l,activeNodeRect:f,attributes:O,isDragging:y,listeners:r?void 0:D,node:C,over:m,setNodeRef:R,setActivatorNodeRef:_,transform:S}}function mi(){return d.useContext(tr)}const xi="Droppable",yi={timeout:25};function Si(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:o}=e;const s=tt(xi),{active:i,dispatch:l,over:u,measureDroppableContainers:f}=d.useContext(yt),p=d.useRef({disabled:n}),g=d.useRef(!1),m=d.useRef(null),h=d.useRef(null),{disabled:x,updateMeasurementsFor:v,timeout:y}={...yi,...o},S=Ke(v??r),C=d.useCallback(()=>{if(!g.current){g.current=!0;return}h.current!=null&&clearTimeout(h.current),h.current=setTimeout(()=>{f(Array.isArray(S.current)?S.current:[S.current]),h.current=null},y)},[y]),R=xt({callback:C,disabled:x||!i}),T=d.useCallback((O,L)=>{R&&(L&&(R.unobserve(L),g.current=!1),O&&R.observe(O))},[R]),[_,D]=ht(T),j=Ke(t);return d.useEffect(()=>{!R||!_.current||(R.disconnect(),g.current=!1,R.observe(_.current))},[_,R]),d.useEffect(()=>(l({type:F.RegisterDroppable,element:{id:r,key:s,disabled:n,node:_,rect:m,data:j}}),()=>l({type:F.UnregisterDroppable,key:s,id:r})),[r]),d.useEffect(()=>{n!==p.current.disabled&&(l({type:F.SetDroppableDisabled,id:r,key:s,disabled:n}),p.current.disabled=n)},[r,s,n,l]),{active:i,rect:m,isOver:u?.id===r,node:_,over:u,setNodeRef:D}}function St(e,t,n){const r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function wi(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 Ci(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 Ri(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const ct={scaleX:1,scaleY:1},Ei=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=Di(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,...ct}:null}return i>o&&i<=s?{x:-l.width-u,y:0,...ct}:i<o&&i>=s?{x:l.width+u,y:0,...ct}:{x:0,y:0,...ct}};function Di(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=St(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}},ut={scaleX:1,scaleY:1},Ti=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,...ut}:null}const u=ji(s,o,n);return o>n&&o<=i?{x:0,y:-l.height-u,...ut}:o<n&&o>=i?{x:0,y:l.height+u,...ut}:{x:0,y:0,...ut}};function ji(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:p}=mi(),g=tt(sr,n),m=l.rect!==null,h=d.useMemo(()=>r.map(D=>typeof D=="object"&&"id"in D?D.id:D),[r]),x=i!=null,v=i?h.indexOf(i.id):-1,y=f?h.indexOf(f.id):-1,S=d.useRef(h),C=!Ci(h,S.current),R=y!==-1&&v===-1||C,T=Ri(s);fe(()=>{C&&x&&p(h)},[C,h,x,p]),d.useEffect(()=>{S.current=h},[h]);const _=d.useMemo(()=>({activeIndex:v,containerId:g,disabled:T,disableTransforms:R,items:h,overIndex:y,useDragOverlay:m,sortedRects:wi(h,u),strategy:o}),[v,g,T.draggable,T.droppable,R,h,y,u,m,o]);return d.createElement(ir.Provider,{value:_},t)}const _i=e=>{let{id:t,items:n,activeIndex:r,overIndex:o}=e;return St(n,r,o).indexOf(t)},Oi=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},Ii={duration:200,easing:"ease"},lr="transform",ki=Me.Transition.toString({property:lr,duration:0,easing:"linear"}),Mi={roleDescription:"sortable"};function Ai(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}),p={x:u.left-f.left,y:u.top-f.top,scaleX:u.width/f.width,scaleY:u.height/f.height};(p.x||p.y)&&i(p)}}n!==l.current&&(l.current=n)},[t,n,r,o]),d.useEffect(()=>{s&&i(null)},[s]),s}function cr(e){let{animateLayoutChanges:t=Oi,attributes:n,disabled:r,data:o,getNewIndex:s=_i,id:i,strategy:l,resizeObserverConfig:u,transition:f=Ii}=e;const{items:p,containerId:g,activeIndex:m,disabled:h,disableTransforms:x,sortedRects:v,overIndex:y,useDragOverlay:S,strategy:C}=d.useContext(ir),R=Ni(r,h),T=p.indexOf(i),_=d.useMemo(()=>({sortable:{containerId:g,index:T,items:p},...o}),[g,o,T,p]),D=d.useMemo(()=>p.slice(p.indexOf(i)),[p,i]),{rect:j,node:O,isOver:L,setNodeRef:P}=Si({id:i,data:_,disabled:R.droppable,resizeObserverConfig:{updateMeasurementsFor:D,...u}}),{active:N,activatorEvent:U,activeNodeRect:X,attributes:te,setNodeRef:he,listeners:Re,isDragging:H,over:Ee,setActivatorNodeRef:ne,transform:ve}=bi({id:i,data:_,attributes:{...Mi,...n},disabled:R.draggable}),b=Jo(P,he),E=!!N,I=E&&!x&<(m)&<(y),A=!S&&H,le=A&&I?ve:null,$=I?le??(l??C)({rects:v,activeNodeRect:X,activeIndex:m,overIndex:y,index:T}):null,G=lt(m)&<(y)?s({id:i,items:p,activeIndex:m,overIndex:y}):T,J=N?.id,M=d.useRef({activeId:J,items:p,newIndex:G,containerId:g}),$e=p!==M.current.items,ce=t({active:N,containerId:g,isDragging:H,isSorting:E,id:i,index:T,items:p,newIndex:M.current.newIndex,previousItems:M.current.items,previousContainerId:M.current.containerId,transition:f,wasDragging:M.current.activeId!=null}),De=Ai({disabled:!ce,index:T,node:O,rect:j});return d.useEffect(()=>{E&&M.current.newIndex!==G&&(M.current.newIndex=G),g!==M.current.containerId&&(M.current.containerId=g),p!==M.current.items&&(M.current.items=p)},[E,G,g,p]),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:m,attributes:te,data:_,rect:j,index:T,newIndex:G,items:p,isOver:L,isSorting:E,isDragging:H,listeners:Re,node:O,overIndex:y,over:Ee,setNodeRef:b,setActivatorNodeRef:ne,setDroppableNodeRef:P,setDraggableNodeRef:he,transform:De??$,transition:ge()};function ge(){if(De||$e&&M.current.newIndex===T)return ki;if(!(A&&!Ut(U)||!f)&&(E||ce))return Me.Transition.toString({...f,property:lr})}}function Ni(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 ur=e=>`table_column_order_v1:${e}`,Li=e=>{const{tableId:t}=se.state;localStorage.setItem(ur(t),JSON.stringify(e.map(n=>n.id))),se.setState(n=>({...n,columnOrder:e})),se.setState(n=>({...n,columnOrder:e}))},$i=e=>{se.setState(t=>({...t,visibility:{...t.visibility,[e]:!t.visibility[e]}}))};function Pi(e){se.setState(t=>t.sortColumn===e?{...t,sortDirection:t.sortDirection==="asc"?"desc":"asc"}:{...t,sortColumn:e,sortDirection:"asc"})}const se=new zn({tableId:"",sortColumn:null,sortDirection:"asc",visibility:{},columnOrder:[],data:[],sortableColumns:[]});function zi(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}=se.state,i=JSON.parse(localStorage.getItem(ur(s))||"[]"),l=[...i.map(u=>o.find(f=>f.id===u)).filter(Boolean),...o.filter(u=>!i.includes(u.id))];se.setState(u=>({...u,data:e,columnOrder:l,visibility:l.reduce((f,p)=>(f[p.id]=!0,f),{}),sortableColumns:l.map(f=>({id:f.id,label:f.label,sortable:!0}))}))}function Fi(e){se.setState(t=>({...t,tableId:e}))}const Vi=w(c.Menu.Trigger),Bi=w(c.Menu.Positioner),Hi=w(c.Menu.Content),Yi=w(c.Menu.Item),Wi=w(c.Checkbox.Label),Ui=w(c.Checkbox.HiddenInput),Gi=w(c.Checkbox.Control);function Xi({visibility:e,onToggle:t}){const{sortableColumns:n}=Ze(se);return a.jsxs(c.Menu.Root,{closeOnSelect:!1,children:[a.jsx(Vi,{asChild:!0,children:a.jsx(c.IconButton,{"aria-label":"Toggle columns",variant:"outline",size:"sm",ml:"1",children:a.jsx(Kr,{size:18})})}),a.jsx(c.Portal,{children:a.jsx(Bi,{children:a.jsx(Hi,{minW:"220px",children:n.map(r=>{const o=!!e[r.id];return a.jsx(Yi,{value:r.id,closeOnSelect:!1,children:a.jsxs(c.Checkbox.Root,{checked:o,onCheckedChange:()=>t(r.id),children:[a.jsx(Ui,{}),a.jsx(Gi,{}),a.jsx(Wi,{children:r.label})]})},r.id)})})})})]})}function qi({id:e,children:t,onClick:n,cursor:r,borderRight:o,borderRightColor:s}){const{setNodeRef:i,attributes:l,listeners:u,transform:f,transition:p}=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:p,cursor:r,borderRight:o,borderRightColor:s},...l,children:a.jsxs(c.HStack,{justify:"space-between",children:[t,a.jsx("span",{...u,children:a.jsx(oo,{size:12})})]})})}function Ki(){const{columnOrder:e,visibility:t,sortColumn:n,sortDirection:r,sortableColumns:o}=Ze(se),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 p=e.findIndex(h=>h.id===u.id),g=e.findIndex(h=>h.id===f.id),m=St(e,p,g);Li(m)};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:Ei,children:a.jsxs(c.Table.Row,{height:"28px",children:[s.map((l,u)=>{const f=n===l?.id;return a.jsx(qi,{id:l?.id,onClick:()=>l?.sortable&&Pi(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(Vr,{size:14}):a.jsx($r,{size:14}):a.jsx(zr,{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(Xi,{visibility:t,onToggle:$i})})]})})})})}const Nn=c.createListCollection({items:[{label:"10",value:"10"},{label:"20",value:"20"},{label:"50",value:"50"},{label:"100",value:"100"}]}),Ji=w(c.Select.Positioner),Zi=w(c.Select.Content),Qi=w(c.Select.Item),ea=w(c.Pagination.PrevTrigger),ta=w(c.Pagination.NextTrigger),na=w(c.Select.HiddenSelect),ra=w(c.Select.Control),oa=w(c.Select.Trigger),sa=w(c.Select.ValueText),ia=w(c.Select.IndicatorGroup),aa=w(c.Select.Indicator);function la({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:Nn,size:"sm",width:"60px",onValueChange:i=>o&&o(Number(i.items[0].value)),value:[String(t)],children:[a.jsx(na,{}),a.jsxs(ra,{children:[a.jsx(oa,{children:a.jsx(sa,{placeholder:""})}),a.jsx(ia,{children:a.jsx(aa,{})})]}),a.jsx(c.Portal,{children:a.jsx(Ji,{children:a.jsx(Zi,{children:Nn.items.map(i=>a.jsxs(Qi,{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(ea,{asChild:!0,children:a.jsx(c.IconButton,{"aria-label":"Previous page",children:a.jsx(Ur,{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(ta,{asChild:!0,children:a.jsx(c.IconButton,{"aria-label":"Next page",children:a.jsx(Xr,{size:18})})})]})})]})})}const ca=w(c.Menu.Item),ua=w(c.Menu.Content),da=w(c.Menu.Positioner),fa=w(c.Menu.Trigger);function ha({data:e=[],actions:t=[]}){const{columnOrder:n,visibility:r}=Ze(se);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(fa,{asChild:!0,children:a.jsx(c.IconButton,{"aria-label":"Open",variant:"ghost",size:"sm",children:a.jsx(eo,{size:16})})}),a.jsx(c.Portal,{children:a.jsx(da,{children:a.jsx(ua,{children:t.map(s=>a.jsxs(ca,{onClick:()=>s.onClick(o),colorScheme:s.colorScheme,value:s.label,children:[s.icon,s.label]},s.label))})})})]})})]},o.id))})}function ga({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:p="sm",totalCount:g=0,paginationMode:m="client"}){d.useEffect(()=>{Fi(e)},[e]),d.useEffect(()=>{zi(t,n)},[t,n]);const{sortColumn:h,sortDirection:x,data:v}=Ze(se),y=d.useMemo(()=>{const S=[...v];if(h&&S.sort((C,R)=>x==="asc"?String(C[h]).localeCompare(String(R[h])):String(R[h]).localeCompare(String(C[h]))),m==="client"){const C=i*l;return S.slice(C,C+l)}return S},[v,h,x,i,l,m]);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..."}):y.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:p,children:[a.jsx(Ki,{}),a.jsx(ha,{data:y,actions:s})]})}),a.jsx(c.Box,{mt:.5,children:a.jsx(la,{totalCount:g,pageSize:l,currentPage:i,onPageChange:u,onPageSizeChange:S=>{f&&f(S),i>1&&u&&u(1)}})})]})}const pa=Object.freeze(Object.defineProperty({__proto__:null,default:ga},Symbol.toStringTag,{value:"Module"})),dr=e=>`FILTER_PRESETS_${e??"default"}`;function va(e){try{return JSON.parse(localStorage.getItem(dr(e))||"[]")}catch{return[]}}const bt=new zn({}),Jt=e=>{const t=bt.state[e];if(t)return t;const n=va(e);return bt.setState(r=>({...r,[e]:n})),n},fr=(e,t)=>{bt.setState(n=>({...n,[e]:t})),localStorage.setItem(dr(e),JSON.stringify(t))},ba=(e,t)=>{const n=Jt(e).filter(r=>r.id!==t);fr(e,n)},ma=(e,t)=>{const n=[t,...Jt(e)];fr(e,n)},xa=w(c.Checkbox.Root),ya=w(c.Checkbox.HiddenInput),Sa=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,cursor:"grab"};return a.jsxs(c.VStack,{ref:s,style:u,align:"stretch",border:"1px solid",borderColor:"gray.200",rounded:"md",p:3,mb:3,...r,...o,children:[a.jsx(c.Text,{fontWeight:"bold",children:e.label}),a.jsxs(c.HStack,{justify:"space-between",children:[a.jsx(c.Text,{fontSize:"sm",children:"Visible"}),a.jsxs(xa,{checked:e.visible,onCheckedChange:f=>t&&t(e.id,!!f),size:"sm",children:[a.jsx(ya,{}),a.jsx(Sa,{})]})]}),a.jsxs(c.VStack,{align:"stretch",gap:1,children:[a.jsx(c.Text,{fontSize:"sm",children:"Size"}),a.jsx(wa,{width:"200px",min:1,max:5,step:.5,value:[e.size??1],onChange:f=>n&&n(e.id,f[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),At=w(c.Tabs.Trigger),Nt=w(c.Tabs.Content),hr=e=>{if(console.log(e),e.customComponent)return e.customComponent;switch(e.type){case"text":return a.jsx(gn,{placeholder:e.label,value:e.value,onChange:e.onChange,label:""});case"number":return a.jsx(gn,{label:e.label,value:e.value,onChange:e.onChange});case"checkbox":return a.jsx(Or,{label:e.label,value:e.value,onChange:e.onChange});case"select":return a.jsx($o,{label:e.label,value:e.value,onChange:e.onChange,options:e.options??[]});case"date":return a.jsx(bo,{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})=>{const g=Ze(bt)[s]??Jt(s),m=()=>{const h=prompt("Preset name?");h&&ma(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,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(no,{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(At,{value:"view",children:[a.jsx(io,{size:16}),"Edit"]}),a.jsxs(At,{value:"settings",children:[a.jsx(lo,{size:16}),"Settings"]}),a.jsxs(At,{value:"presets",children:[a.jsx(Hr,{size:16}),"Presets"]})]}),a.jsx(Nt,{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:hr(h)},h.id))}),a.jsx(Nt,{value:"settings",children:a.jsx(rr,{sensors:fs(ds(Kt)),collisionDetection:Hn,onDragEnd:({active:h,over:x})=>{if(!x||h.id===x.id)return;const v=o.findIndex(C=>C.id===h.id),y=o.findIndex(C=>C.id===x.id),S=St(o,v,y);f?.(S)},children:a.jsx(ar,{items:o.map(h=>h.id),strategy:Ti,children:o.map(h=>a.jsx(Ta,{filter:h,onVisibilityChange:t,onSizeChange:n},h.id))})})}),a.jsx(Nt,{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"}),g.length===0&&a.jsx(c.Text,{fontSize:"xs",color:"gray.500",children:"No presets saved yet."}),g.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:()=>ba(s,h.id),children:a.jsx(Zr,{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,{})})]})]})})]})]})})},Va=({title:e,filters:t,onVisibilityChange:n,onReorder:r,onSizeChange:o,onClear:s,maxToolbarUnits:i,pageKey:l,currentFilters:u,onLoadPreset:f,activePresetName:p,filterDrawerSize:g="sm"})=>a.jsxs(c.HStack,{wrap:"wrap",pl:2,pr:2,width:"100%",justify:"space-between",children:[e,a.jsxs(c.HStack,{gap:2,children:[t.filter(m=>m.visible!==!1).map(m=>a.jsx(c.HStack,{flex:m.size??1,minW:`${(m.size??1)*100}px`,children:hr(m)},m.id)),a.jsx(Fa,{filterDrawerSize:g,onVisibilityChange:n,onReorder:r,onSizeChange:o,onClear:s,maxToolbarUnits:i,pageKey:l,filters:t,currentFilters:u,onLoadPreset:f,activePresetName:p})]})]}),Ba=Object.freeze(Object.defineProperty({__proto__:null,FilterToolBar:Va},Symbol.toStringTag,{value:"Module"}));exports.ChakraSlot=Er;exports.DataTable=pa;exports.Filters=Ba;exports.MdsSharedUi=Po;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
import { ConditionalValue } from '@chakra-ui/react';
|
|
2
|
+
import { ForwardRefExoticComponent } from 'react';
|
|
2
3
|
import { JSX } from 'react';
|
|
3
4
|
import { JSX as JSX_2 } from 'react/jsx-runtime';
|
|
4
|
-
import
|
|
5
|
-
import { Store } from '@tanstack/store';
|
|
5
|
+
import { RefAttributes } from 'react';
|
|
6
6
|
|
|
7
|
-
export declare
|
|
7
|
+
export declare namespace ChakraSlot {
|
|
8
|
+
export {
|
|
9
|
+
withChildren
|
|
10
|
+
}
|
|
11
|
+
}
|
|
8
12
|
|
|
9
13
|
declare interface Column<T = unknown> {
|
|
10
14
|
id: string;
|
|
@@ -15,7 +19,13 @@ declare interface Column<T = unknown> {
|
|
|
15
19
|
format?: (value: unknown, row: T) => React.ReactNode;
|
|
16
20
|
}
|
|
17
21
|
|
|
18
|
-
export declare
|
|
22
|
+
export declare namespace DataTable {
|
|
23
|
+
export {
|
|
24
|
+
DataTable_2 as default
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
declare function DataTable_2<T extends Record<string, unknown>>({ tableId, data: rowData, headers, loading, emptyMessage, actions, page, pageSize, onPageChange, onPageSizeChange, density, totalCount, paginationMode, }: DataTableProps<T>): JSX_2.Element;
|
|
19
29
|
|
|
20
30
|
declare interface DataTableAction<T = unknown> {
|
|
21
31
|
icon: JSX.Element;
|
|
@@ -40,15 +50,20 @@ declare interface DataTableProps<T = unknown> {
|
|
|
40
50
|
paginationMode?: 'server' | 'client';
|
|
41
51
|
}
|
|
42
52
|
|
|
43
|
-
export declare const deletePreset: (pageKey: string, id: string) => void;
|
|
44
|
-
|
|
45
53
|
declare type DensityType = 'sm' | 'md' | 'lg';
|
|
46
54
|
|
|
47
|
-
export declare
|
|
55
|
+
export declare namespace Filters {
|
|
56
|
+
export {
|
|
57
|
+
FiltersToolBar as FilterToolBar,
|
|
58
|
+
IFilterConfig,
|
|
59
|
+
IFilterDrawerProps,
|
|
60
|
+
IMainFilterType
|
|
61
|
+
}
|
|
62
|
+
}
|
|
48
63
|
|
|
49
|
-
|
|
64
|
+
declare const FiltersToolBar: ({ title, filters, onVisibilityChange, onReorder, onSizeChange, onClear, maxToolbarUnits, pageKey, currentFilters, onLoadPreset, activePresetName, filterDrawerSize, }: IMainFilterType) => JSX_2.Element;
|
|
50
65
|
|
|
51
|
-
|
|
66
|
+
declare interface IFilterConfig {
|
|
52
67
|
id: string;
|
|
53
68
|
label: string;
|
|
54
69
|
type?: 'date' | 'text' | 'select' | 'checkbox' | 'radio' | 'number';
|
|
@@ -58,12 +73,12 @@ export declare interface IFilterConfig {
|
|
|
58
73
|
value: string;
|
|
59
74
|
}[];
|
|
60
75
|
onChange?: (value: string | number | boolean | undefined) => void;
|
|
61
|
-
visible
|
|
76
|
+
visible: boolean;
|
|
62
77
|
size?: 0.5 | 1 | 1.5 | 2 | 2.5 | 3 | 3.5 | 4 | 4.5 | 5;
|
|
63
78
|
customComponent?: JSX.Element;
|
|
64
79
|
}
|
|
65
80
|
|
|
66
|
-
|
|
81
|
+
declare interface IFilterDrawerProps {
|
|
67
82
|
filters: IFilterConfig[];
|
|
68
83
|
onVisibilityChange?: (id: string, visible: boolean) => void;
|
|
69
84
|
onReorder?: (newOrder: IFilterConfig[]) => void;
|
|
@@ -77,7 +92,7 @@ export declare interface IFilterDrawerProps {
|
|
|
77
92
|
activePresetName?: string | null;
|
|
78
93
|
}
|
|
79
94
|
|
|
80
|
-
|
|
95
|
+
declare interface IMainFilterType {
|
|
81
96
|
title: JSX.Element;
|
|
82
97
|
filters: IFilterConfig[];
|
|
83
98
|
onVisibilityChange?: (id: string, visible: boolean) => void;
|
|
@@ -92,7 +107,7 @@ export declare interface IMainFilterType {
|
|
|
92
107
|
activePresetName?: string | null;
|
|
93
108
|
}
|
|
94
109
|
|
|
95
|
-
|
|
110
|
+
declare interface IMDSCheckboxTypes {
|
|
96
111
|
value?: boolean;
|
|
97
112
|
onChange?: (value: boolean) => void;
|
|
98
113
|
size?: 'sm' | 'md' | 'lg';
|
|
@@ -103,9 +118,9 @@ export declare interface IMDSCheckboxTypes {
|
|
|
103
118
|
errorText?: string;
|
|
104
119
|
}
|
|
105
120
|
|
|
106
|
-
|
|
121
|
+
declare interface IMDSInputTypes {
|
|
107
122
|
icon?: React.ReactNode;
|
|
108
|
-
value?: string;
|
|
123
|
+
value?: string | number;
|
|
109
124
|
onChange?: (value: string) => void;
|
|
110
125
|
placeholder?: string;
|
|
111
126
|
size?: 'sm' | 'md' | 'lg';
|
|
@@ -118,7 +133,7 @@ export declare interface IMDSInputTypes {
|
|
|
118
133
|
errorText?: string;
|
|
119
134
|
}
|
|
120
135
|
|
|
121
|
-
|
|
136
|
+
declare interface IMDSSelectBoxTypes {
|
|
122
137
|
options: {
|
|
123
138
|
label: string;
|
|
124
139
|
value: string;
|
|
@@ -136,45 +151,18 @@ export declare interface IMDSSelectBoxTypes {
|
|
|
136
151
|
errorText?: string;
|
|
137
152
|
}
|
|
138
153
|
|
|
139
|
-
export declare
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
filters: any;
|
|
154
|
+
export declare namespace MdsSharedUi {
|
|
155
|
+
export {
|
|
156
|
+
IMDSCheckboxTypes,
|
|
157
|
+
IMDSInputTypes,
|
|
158
|
+
IMDSSelectBoxTypes
|
|
159
|
+
}
|
|
146
160
|
}
|
|
147
161
|
|
|
148
|
-
export declare const presetStore: Store<Record<string, PresetItem[]>, (cb: Record<string, PresetItem[]>) => Record<string, PresetItem[]>>;
|
|
149
|
-
|
|
150
|
-
export declare const saveOrder: (pageKey: string, filters: string[]) => void;
|
|
151
|
-
|
|
152
|
-
export declare const savePresets: (pageKey: string, items: PresetItem[]) => void;
|
|
153
|
-
|
|
154
|
-
export declare function setData(newData: any[], headers?: Column<any>[]): void;
|
|
155
|
-
|
|
156
|
-
export declare function setTableId(tableId: string): void;
|
|
157
|
-
|
|
158
|
-
declare interface TableState {
|
|
159
|
-
tableId: string;
|
|
160
|
-
sortColumn: string | null;
|
|
161
|
-
sortDirection: 'asc' | 'desc';
|
|
162
|
-
visibility: Record<string, boolean>;
|
|
163
|
-
columnOrder: Column<any>[];
|
|
164
|
-
data: any[];
|
|
165
|
-
sortableColumns: {
|
|
166
|
-
id: string;
|
|
167
|
-
label: string;
|
|
168
|
-
sortable: boolean;
|
|
169
|
-
}[];
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
export declare const tableStore: Store<TableState, (cb: TableState) => TableState>;
|
|
173
|
-
|
|
174
162
|
/**
|
|
175
163
|
* Chakra v3 / Ark UI slot components do NOT expose `children` in their typings.
|
|
176
164
|
* This wrapper intentionally loosens typing to make them library-safe.
|
|
177
165
|
*/
|
|
178
|
-
|
|
166
|
+
declare function withChildren(Component: any): ForwardRefExoticComponent<Omit<any, "ref"> & RefAttributes<any>>;
|
|
179
167
|
|
|
180
168
|
export { }
|