@mdspl/mds-shared-ui 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +73 -0
- package/dist/index.cjs +10 -0
- package/dist/index.d.ts +166 -0
- package/dist/index.js +4221 -0
- package/dist/vite.svg +1 -0
- package/package.json +56 -0
package/README.md
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
# React + TypeScript + Vite
|
|
2
|
+
|
|
3
|
+
This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
|
|
4
|
+
|
|
5
|
+
Currently, two official plugins are available:
|
|
6
|
+
|
|
7
|
+
- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react) uses [Babel](https://babeljs.io/) (or [oxc](https://oxc.rs) when used in [rolldown-vite](https://vite.dev/guide/rolldown)) for Fast Refresh
|
|
8
|
+
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh
|
|
9
|
+
|
|
10
|
+
## React Compiler
|
|
11
|
+
|
|
12
|
+
The React Compiler is not enabled on this template because of its impact on dev & build performances. To add it, see [this documentation](https://react.dev/learn/react-compiler/installation).
|
|
13
|
+
|
|
14
|
+
## Expanding the ESLint configuration
|
|
15
|
+
|
|
16
|
+
If you are developing a production application, we recommend updating the configuration to enable type-aware lint rules:
|
|
17
|
+
|
|
18
|
+
```js
|
|
19
|
+
export default defineConfig([
|
|
20
|
+
globalIgnores(['dist']),
|
|
21
|
+
{
|
|
22
|
+
files: ['**/*.{ts,tsx}'],
|
|
23
|
+
extends: [
|
|
24
|
+
// Other configs...
|
|
25
|
+
|
|
26
|
+
// Remove tseslint.configs.recommended and replace with this
|
|
27
|
+
tseslint.configs.recommendedTypeChecked,
|
|
28
|
+
// Alternatively, use this for stricter rules
|
|
29
|
+
tseslint.configs.strictTypeChecked,
|
|
30
|
+
// Optionally, add this for stylistic rules
|
|
31
|
+
tseslint.configs.stylisticTypeChecked,
|
|
32
|
+
|
|
33
|
+
// Other configs...
|
|
34
|
+
],
|
|
35
|
+
languageOptions: {
|
|
36
|
+
parserOptions: {
|
|
37
|
+
project: ['./tsconfig.node.json', './tsconfig.app.json'],
|
|
38
|
+
tsconfigRootDir: import.meta.dirname,
|
|
39
|
+
},
|
|
40
|
+
// other options...
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
])
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
You can also install [eslint-plugin-react-x](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-x) and [eslint-plugin-react-dom](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-dom) for React-specific lint rules:
|
|
47
|
+
|
|
48
|
+
```js
|
|
49
|
+
// eslint.config.js
|
|
50
|
+
import reactX from 'eslint-plugin-react-x'
|
|
51
|
+
import reactDom from 'eslint-plugin-react-dom'
|
|
52
|
+
|
|
53
|
+
export default defineConfig([
|
|
54
|
+
globalIgnores(['dist']),
|
|
55
|
+
{
|
|
56
|
+
files: ['**/*.{ts,tsx}'],
|
|
57
|
+
extends: [
|
|
58
|
+
// Other configs...
|
|
59
|
+
// Enable lint rules for React
|
|
60
|
+
reactX.configs['recommended-typescript'],
|
|
61
|
+
// Enable lint rules for React DOM
|
|
62
|
+
reactDom.configs.recommended,
|
|
63
|
+
],
|
|
64
|
+
languageOptions: {
|
|
65
|
+
parserOptions: {
|
|
66
|
+
project: ['./tsconfig.node.json', './tsconfig.app.json'],
|
|
67
|
+
tsconfigRootDir: import.meta.dirname,
|
|
68
|
+
},
|
|
69
|
+
// other options...
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
])
|
|
73
|
+
```
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("react"),p=require("@chakra-ui/react"),Be=require("react-dom");var et={exports:{}},$e={};var tn;function hr(){if(tn)return $e;tn=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(r,o,s){var i=null;if(s!==void 0&&(i=""+s),o.key!==void 0&&(i=""+o.key),"key"in o){s={};for(var a in o)a!=="key"&&(s[a]=o[a])}else s=o;return o=s.ref,{$$typeof:e,type:r,key:i,ref:o!==void 0?o:null,props:s}}return $e.Fragment=t,$e.jsx=n,$e.jsxs=n,$e}var Ve={};var nn;function vr(){return nn||(nn=1,process.env.NODE_ENV!=="production"&&(function(){function e(g){if(g==null)return null;if(typeof g=="function")return g.$$typeof===N?null:g.displayName||g.name||null;if(typeof g=="string")return g;switch(g){case x:return"Fragment";case R:return"Profiler";case w:return"StrictMode";case C:return"Suspense";case E:return"SuspenseList";case z:return"Activity"}if(typeof g=="object")switch(typeof g.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),g.$$typeof){case b:return"Portal";case _:return g.displayName||"Context";case D:return(g._context.displayName||"Context")+".Consumer";case j:var S=g.render;return g=g.displayName,g||(g=S.displayName||S.name||"",g=g!==""?"ForwardRef("+g+")":"ForwardRef"),g;case T:return S=g.displayName||null,S!==null?S:e(g.type)||"Memo";case L:S=g._payload,g=g._init;try{return e(g(S))}catch{}}return null}function t(g){return""+g}function n(g){try{t(g);var S=!1}catch{S=!0}if(S){S=console;var k=S.error,M=typeof Symbol=="function"&&Symbol.toStringTag&&g[Symbol.toStringTag]||g.constructor.name||"Object";return k.call(S,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",M),t(g)}}function r(g){if(g===x)return"<>";if(typeof g=="object"&&g!==null&&g.$$typeof===L)return"<...>";try{var S=e(g);return S?"<"+S+">":"<...>"}catch{return"<...>"}}function o(){var g=U.A;return g===null?null:g.getOwner()}function s(){return Error("react-stack-top-frame")}function i(g){if(G.call(g,"key")){var S=Object.getOwnPropertyDescriptor(g,"key").get;if(S&&S.isReactWarning)return!1}return g.key!==void 0}function a(g,S){function k(){we||(we=!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)",S))}k.isReactWarning=!0,Object.defineProperty(g,"key",{get:k,configurable:!0})}function u(){var g=e(this.type);return F[g]||(F[g]=!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.")),g=this.props.ref,g!==void 0?g:null}function l(g,S,k,M,se,H){var P=k.ref;return g={$$typeof:y,type:g,key:S,props:k,_owner:M},(P!==void 0?P:null)!==null?Object.defineProperty(g,"ref",{enumerable:!1,get:u}):Object.defineProperty(g,"ref",{enumerable:!1,value:null}),g._store={},Object.defineProperty(g._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(g,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(g,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:se}),Object.defineProperty(g,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:H}),Object.freeze&&(Object.freeze(g.props),Object.freeze(g)),g}function v(g,S,k,M,se,H){var P=S.children;if(P!==void 0)if(M)if(ee(P)){for(M=0;M<P.length;M++)h(P[M]);Object.freeze&&Object.freeze(P)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else h(P);if(G.call(S,"key")){P=e(g);var Y=Object.keys(S).filter(function(A){return A!=="key"});M=0<Y.length?"{key: someKey, "+Y.join(": ..., ")+": ...}":"{key: someKey}",ve[P+M]||(Y=0<Y.length?"{"+Y.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
|
|
2
|
+
let props = %s;
|
|
3
|
+
<%s {...props} />
|
|
4
|
+
React keys must be passed directly to JSX without using spread:
|
|
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(S)&&(n(S.key),P=""+S.key),"key"in S){k={};for(var J in S)J!=="key"&&(k[J]=S[J])}else k=S;return P&&a(k,typeof g=="function"?g.displayName||g.name||"Unknown":g),l(g,P,k,o(),se,H)}function h(g){m(g)?g._store&&(g._store.validated=1):typeof g=="object"&&g!==null&&g.$$typeof===L&&(g._payload.status==="fulfilled"?m(g._payload.value)&&g._payload.value._store&&(g._payload.value._store.validated=1):g._store&&(g._store.validated=1))}function m(g){return typeof g=="object"&&g!==null&&g.$$typeof===y}var f=c,y=Symbol.for("react.transitional.element"),b=Symbol.for("react.portal"),x=Symbol.for("react.fragment"),w=Symbol.for("react.strict_mode"),R=Symbol.for("react.profiler"),D=Symbol.for("react.consumer"),_=Symbol.for("react.context"),j=Symbol.for("react.forward_ref"),C=Symbol.for("react.suspense"),E=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=f.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,G=Object.prototype.hasOwnProperty,ee=Array.isArray,ue=console.createTask?console.createTask:function(){return null};f={react_stack_bottom_frame:function(g){return g()}};var we,F={},Se=f.react_stack_bottom_frame.bind(f,s)(),te=ue(r(s)),ve={};Ve.Fragment=x,Ve.jsx=function(g,S,k){var M=1e4>U.recentlyCreatedOwnerStacks++;return v(g,S,k,!1,M?Error("react-stack-top-frame"):Se,M?ue(r(g)):te)},Ve.jsxs=function(g,S,k){var M=1e4>U.recentlyCreatedOwnerStacks++;return v(g,S,k,!0,M?Error("react-stack-top-frame"):Se,M?ue(r(g)):te)}})()),Ve}var rn;function gr(){return rn||(rn=1,process.env.NODE_ENV==="production"?et.exports=hr():et.exports=vr()),et.exports}var d=gr(),tt={exports:{}},wt={},nt={exports:{}},St={};var on;function pr(){if(on)return St;on=1;var e=c;function t(h,m){return h===m&&(h!==0||1/h===1/m)||h!==h&&m!==m}var n=typeof Object.is=="function"?Object.is:t,r=e.useState,o=e.useEffect,s=e.useLayoutEffect,i=e.useDebugValue;function a(h,m){var f=m(),y=r({inst:{value:f,getSnapshot:m}}),b=y[0].inst,x=y[1];return s(function(){b.value=f,b.getSnapshot=m,u(b)&&x({inst:b})},[h,f,m]),o(function(){return u(b)&&x({inst:b}),h(function(){u(b)&&x({inst:b})})},[h]),i(f),f}function u(h){var m=h.getSnapshot;h=h.value;try{var f=m();return!n(h,f)}catch{return!0}}function l(h,m){return m()}var v=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?l:a;return St.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:v,St}var Rt={};var sn;function br(){return sn||(sn=1,process.env.NODE_ENV!=="production"&&(function(){function e(f,y){return f===y&&(f!==0||1/f===1/y)||f!==f&&y!==y}function t(f,y){v||o.startTransition===void 0||(v=!0,console.error("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));var b=y();if(!h){var x=y();s(b,x)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),h=!0)}x=i({inst:{value:b,getSnapshot:y}});var w=x[0].inst,R=x[1];return u(function(){w.value=b,w.getSnapshot=y,n(w)&&R({inst:w})},[f,b,y]),a(function(){return n(w)&&R({inst:w}),f(function(){n(w)&&R({inst:w})})},[f]),l(b),b}function n(f){var y=f.getSnapshot;f=f.value;try{var b=y();return!s(f,b)}catch{return!0}}function r(f,y){return y()}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,u=o.useLayoutEffect,l=o.useDebugValue,v=!1,h=!1,m=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?r:t;Rt.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())})()),Rt}var an;function _n(){return an||(an=1,process.env.NODE_ENV==="production"?nt.exports=pr():nt.exports=br()),nt.exports}var cn;function mr(){if(cn)return wt;cn=1;var e=c,t=_n();function n(l,v){return l===v&&(l!==0||1/l===1/v)||l!==l&&v!==v}var r=typeof Object.is=="function"?Object.is:n,o=t.useSyncExternalStore,s=e.useRef,i=e.useEffect,a=e.useMemo,u=e.useDebugValue;return wt.useSyncExternalStoreWithSelector=function(l,v,h,m,f){var y=s(null);if(y.current===null){var b={hasValue:!1,value:null};y.current=b}else b=y.current;y=a(function(){function w(C){if(!R){if(R=!0,D=C,C=m(C),f!==void 0&&b.hasValue){var E=b.value;if(f(E,C))return _=E}return _=C}if(E=_,r(D,C))return E;var T=m(C);return f!==void 0&&f(E,T)?(D=C,E):(D=C,_=T)}var R=!1,D,_,j=h===void 0?null:h;return[function(){return w(v())},j===null?void 0:function(){return w(j())}]},[v,h,m,f]);var x=o(l,y[0],y[1]);return i(function(){b.hasValue=!0,b.value=x},[x]),u(x),x},wt}var Ct={};var ln;function xr(){return ln||(ln=1,process.env.NODE_ENV!=="production"&&(function(){function e(l,v){return l===v&&(l!==0||1/l===1/v)||l!==l&&v!==v}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,u=t.useDebugValue;Ct.useSyncExternalStoreWithSelector=function(l,v,h,m,f){var y=s(null);if(y.current===null){var b={hasValue:!1,value:null};y.current=b}else b=y.current;y=a(function(){function w(C){if(!R){if(R=!0,D=C,C=m(C),f!==void 0&&b.hasValue){var E=b.value;if(f(E,C))return _=E}return _=C}if(E=_,r(D,C))return E;var T=m(C);return f!==void 0&&f(E,T)?(D=C,E):(D=C,_=T)}var R=!1,D,_,j=h===void 0?null:h;return[function(){return w(v())},j===null?void 0:function(){return w(j())}]},[v,h,m,f]);var x=o(l,y[0],y[1]);return i(function(){b.hasValue=!0,b.value=x},[x]),u(x),x},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()),Ct}var un;function yr(){return un||(un=1,process.env.NODE_ENV==="production"?tt.exports=mr():tt.exports=xr()),tt.exports}var wr=yr();const It=new WeakMap,Sr=new WeakMap,ct={current:[]};let Et=!1;const rt=new Set,dn=new Map;function Tn(e){for(const t of e){if(ct.current.includes(t))continue;ct.current.push(t),t.recompute();const n=Sr.get(t);if(n)for(const r of n){const o=It.get(r);o?.length&&Tn(o)}}}function Rr(e){const t={prevVal:e.prevState,currentVal:e.state};for(const n of e.listeners)n(t)}function Cr(e){const t={prevVal:e.prevState,currentVal:e.state};for(const n of e.listeners)n(t)}function Er(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,Rr(n)}for(const n of t){const r=It.get(n);r&&(ct.current.push(n),Tn(r))}for(const n of t){const r=It.get(n);if(r)for(const o of r)Cr(o)}}}finally{Et=!1,ct.current=[],dn.clear()}}function Dr(e){return typeof e=="function"}class On{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):Dr(t)?this.state=t(this.prevState):this.state=t,(o=(r=this.options)==null?void 0:r.onUpdate)==null||o.call(r),Er(this)}}function qe(e,t=r=>r,n={}){const r=n.equal??_r;return wr.useSyncExternalStoreWithSelector(e.subscribe,()=>e.state,()=>e.state,t,r)}function _r(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 Tr(){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 le=ht?c.useLayoutEffect:c.useEffect;function Vt(e){const t=c.useRef(e);return le(()=>{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 Or(){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 le(()=>{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[u,l]of a){const v=s[u];v!=null&&(s[u]=v+e*l)}return s},{...t})}}const Oe=kn(1),ut=kn(-1);function jr(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 kr(e){if(!e)return!1;const{TouchEvent:t}=q(e.target);return t&&e instanceof t}function Mt(e){if(kr(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 jr(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 Ir(e){return e.matches(hn)?e:e.querySelector(hn)}const Ar={display:"none"};function Mr(e){let{id:t,value:n}=e;return c.createElement("div",{id:t,style:Ar},n)}function Nr(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 Lr(){const[e,t]=c.useState("");return{announce:c.useCallback(r=>{r!=null&&t(r)},[]),announcement:e}}const In=c.createContext(null);function Pr(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 zr(){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 $r={draggable:`
|
|
7
|
+
To pick up a draggable item, press the space bar.
|
|
8
|
+
While dragging, use the arrow keys to move the item.
|
|
9
|
+
Press space again to drop the item in its new position, or press escape to cancel.
|
|
10
|
+
`},Vr={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 Br(e){let{announcements:t=Vr,container:n,hiddenTextDescribedById:r,screenReaderInstructions:o=$r}=e;const{announce:s,announcement:i}=Lr(),a=Ke("DndLiveRegion"),[u,l]=c.useState(!1);if(c.useEffect(()=>{l(!0)},[]),Pr(c.useMemo(()=>({onDragStart(h){let{active:m}=h;s(t.onDragStart({active:m}))},onDragMove(h){let{active:m,over:f}=h;t.onDragMove&&s(t.onDragMove({active:m,over:f}))},onDragOver(h){let{active:m,over:f}=h;s(t.onDragOver({active:m,over:f}))},onDragEnd(h){let{active:m,over:f}=h;s(t.onDragEnd({active:m,over:f}))},onDragCancel(h){let{active:m,over:f}=h;s(t.onDragCancel({active:m,over:f}))}}),[s,t])),!u)return null;const v=c.createElement(c.Fragment,null,c.createElement(Mr,{id:r,value:o.draggable}),c.createElement(Nr,{id:a,announcement:i}));return n?Be.createPortal(v,n):v}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 Fr(e,t){return c.useMemo(()=>({sensor:e,options:{}}),[e,t])}function Hr(){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 oe=Object.freeze({x:0,y:0});function Wr(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Ur(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function Yr(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function Gr(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,u=n.get(a);if(u){const l=Wr(vn(u),o);s.push({id:a,data:{droppableContainer:i,value:l}})}}return s.sort(Ur)};function qr(e,t){const n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),o=Math.min(t.left+t.width,e.left+e.width),s=Math.min(t.top+t.height,e.top+e.height),i=o-r,a=s-n;if(r<o&&n<s){const u=t.width*t.height,l=e.width*e.height,v=i*a,h=v/(u+l-v);return Number(h.toFixed(4))}return 0}const Xr=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=[];for(const s of r){const{id:i}=s,a=n.get(i);if(a){const u=qr(a,t);u>0&&o.push({id:i,data:{droppableContainer:s,value:u}})}}return o.sort(Yr)};function Jr(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}:oe}function Kr(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 Zr=Kr(1);function Qr(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 eo(e,t,n){const r=Qr(t);if(!r)return e;const{scaleX:o,scaleY:s,x:i,y:a}=r,u=e.left-i-(1-o)*parseFloat(n),l=e.top-a-(1-s)*parseFloat(n.slice(n.indexOf(" ")+1)),v=o?e.width/o:e.width,h=s?e.height/s:e.height;return{width:v,height:h,top:l,right:u+v,bottom:l+h,left:u}}const to={ignoreTransform:!1};function Ae(e,t){t===void 0&&(t=to);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:l,transformOrigin:v}=q(e).getComputedStyle(e);l&&(n=eo(n,l,v))}const{top:r,left:o,width:s,height:i,bottom:a,right:u}=n;return{top:r,left:o,width:s,height:i,bottom:a,right:u}}function gn(e){return Ae(e,{ignoreTransform:!0})}function no(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function ro(e,t){return t===void 0&&(t=q(e).getComputedStyle(e)),t.position==="fixed"}function oo(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&&oo(o,s)&&n.push(o),ro(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 so={x:.2,y:.2};function io(e,t,n,r,o){let{top:s,left:i,right:a,bottom:u}=n;r===void 0&&(r=10),o===void 0&&(o=so);const{isTop:l,isBottom:v,isLeft:h,isRight:m}=$n(e),f={x:0,y:0},y={x:0,y:0},b={height:t.height*o.y,width:t.width*o.x};return!l&&s<=t.top+b.height?(f.y=V.Backward,y.y=r*Math.abs((t.top+b.height-s)/b.height)):!v&&u>=t.bottom-b.height&&(f.y=V.Forward,y.y=r*Math.abs((t.bottom-b.height-u)/b.height)),!m&&a>=t.right-b.width?(f.x=V.Forward,y.x=r*Math.abs((t.right-b.width-a)/b.width)):!h&&i<=t.left+b.width&&(f.x=V.Backward,y.x=r*Math.abs((t.left+b.width-i)/b.width)),{direction:f,speed:y}}function ao(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)=>Oe(t,Nt(n)),oe)}function co(e){return e.reduce((t,n)=>t+Ln(n),0)}function lo(e){return e.reduce((t,n)=>t+Pn(n),0)}function uo(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 fo=[["x",["left","right"],co],["y",["top","bottom"],lo]];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 fo)for(const u of i)Object.defineProperty(this,u,{get:()=>{const l=a(r),v=o[s]-l;return this.rect[u]+v},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 ho(e){const{EventTarget:t}=q(e);return e instanceof t?e:Ie(e)}function Tt(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 re;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(re||(re={}));function pn(e){e.preventDefault()}function vo(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]},go=(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(re.Resize,this.handleCancel),this.windowListeners.add(re.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(re.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props,r=t.node.current;r&&uo(r),n(oe)}handleKeyDown(t){if(Bt(t)){const{active:n,context:r,options:o}=this.props,{keyboardCodes:s=Bn,coordinateGetter:i=go,scrollBehavior:a="smooth"}=o,{code:u}=t;if(s.end.includes(u)){this.handleEnd(t);return}if(s.cancel.includes(u)){this.handleCancel(t);return}const{collisionRect:l}=r.current,v=l?{x:l.left,y:l.top}:oe;this.referenceCoordinates||(this.referenceCoordinates=v);const h=i(t,{active:n,context:r.current,currentCoordinates:v});if(h){const m=ut(h,v),f={x:0,y:0},{scrollableAncestors:y}=r.current;for(const b of y){const x=t.code,{isTop:w,isRight:R,isLeft:D,isBottom:_,maxScroll:j,minScroll:C}=$n(b),E=ao(b),T={x:Math.min(x===I.Right?E.right-E.width/2:E.right,Math.max(x===I.Right?E.left:E.left+E.width/2,h.x)),y:Math.min(x===I.Down?E.bottom-E.height/2:E.bottom,Math.max(x===I.Down?E.top:E.top+E.height/2,h.y))},L=x===I.Right&&!R||x===I.Left&&!D,z=x===I.Down&&!_||x===I.Up&&!w;if(L&&T.x!==h.x){const N=b.scrollLeft+m.x,U=x===I.Right&&N<=j.x||x===I.Left&&N>=C.x;if(U&&!m.y){b.scrollTo({left:N,behavior:a});return}U?f.x=b.scrollLeft-N:f.x=x===I.Right?b.scrollLeft-j.x:b.scrollLeft-C.x,f.x&&b.scrollBy({left:-f.x,behavior:a});break}else if(z&&T.y!==h.y){const N=b.scrollTop+m.y,U=x===I.Down&&N<=j.y||x===I.Up&&N>=C.y;if(U&&!m.x){b.scrollTo({top:N,behavior:a});return}U?f.y=b.scrollTop-N:f.y=x===I.Down?b.scrollTop-j.y:b.scrollTop-C.y,f.y&&b.scrollBy({top:-f.y,behavior:a});break}}this.handleMove(t,Oe(ut(h,this.referenceCoordinates),f))}}}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=ho(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:oe,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(re.Resize,this.handleCancel),this.windowListeners.add(re.DragStart,pn),this.windowListeners.add(re.VisibilityChange,this.handleCancel),this.windowListeners.add(re.ContextMenu,pn),this.documentListeners.add(re.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(re.Click,vo,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(re.SelectionChange,this.removeTextSelection),n(t))}handleMove(t){var n;const{activated:r,initialCoordinates:o,props:s}=this,{onMove:i,options:{activationConstraint:a}}=s;if(!o)return;const u=(n=Mt(t))!=null?n:oe,l=ut(o,u);if(!r&&a){if(bn(a)){if(a.tolerance!=null&&Tt(l,a.tolerance))return this.handleCancel();if(Tt(l,a.distance))return this.handleStart()}if(mn(a)&&Tt(l,a.tolerance))return this.handleCancel();this.handlePending(a,l);return}t.cancelable&&t.preventDefault(),i(u)}handleEnd(){const{onAbort:t,onEnd:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleCancel(){const{onAbort:t,onCancel:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleKeydown(t){t.code===I.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const po={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,po,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 bo={move:{name:"mousemove"},end:{name:"mouseup"}};var Lt;(function(e){e[e.RightClick=2]="RightClick"})(Lt||(Lt={}));class mo extends Wt{constructor(t){super(t,bo,Ie(t.event.target))}}mo.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===Lt.RightClick?!1:(r?.({event:n}),!0)}}];const Ot={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class xo extends Wt{constructor(t){super(t,Ot)}static setup(){return window.addEventListener(Ot.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(Ot.move.name,t)};function t(){}}}xo.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;const{touches:o}=n;return o.length>1?!1:(r?.({event:n}),!0)}}];var 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 yo(e){let{acceleration:t,activator:n=He.Pointer,canScroll:r,draggingRect:o,enabled:s,interval:i=5,order:a=ft.TreeOrder,pointerCoordinates:u,scrollableAncestors:l,scrollableAncestorRects:v,delta:h,threshold:m}=e;const f=So({delta:h,disabled:!s}),[y,b]=Or(),x=c.useRef({x:0,y:0}),w=c.useRef({x:0,y:0}),R=c.useMemo(()=>{switch(n){case He.Pointer:return u?{top:u.y,bottom:u.y,left:u.x,right:u.x}:null;case He.DraggableRect:return o}},[n,o,u]),D=c.useRef(null),_=c.useCallback(()=>{const C=D.current;if(!C)return;const E=x.current.x*w.current.x,T=x.current.y*w.current.y;C.scrollBy(E,T)},[]),j=c.useMemo(()=>a===ft.TreeOrder?[...l].reverse():l,[a,l]);c.useEffect(()=>{if(!s||!l.length||!R){b();return}for(const C of j){if(r?.(C)===!1)continue;const E=l.indexOf(C),T=v[E];if(!T)continue;const{direction:L,speed:z}=io(C,T,R,t,m);for(const N of["x","y"])f[N][L[N]]||(z[N]=0,L[N]=0);if(z.x>0||z.y>0){b(),D.current=C,y(_,i),x.current=z,w.current=L;return}}x.current={x:0,y:0},w.current={x:0,y:0},b()},[t,_,r,b,s,i,JSON.stringify(R),JSON.stringify(f),y,l,j,v,JSON.stringify(m)])}const wo={x:{[V.Backward]:!1,[V.Forward]:!1},y:{[V.Backward]:!1,[V.Forward]:!1}};function So(e){let{delta:t,disabled:n}=e;const r=At(t);return Je(o=>{if(n||!r||!o)return wo;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 Ro(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 Co(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 Eo(e,t){let{dragging:n,dependencies:r,config:o}=t;const[s,i]=c.useState(null),{frequency:a,measure:u,strategy:l}=o,v=c.useRef(e),h=x(),m=Ue(h),f=c.useCallback(function(w){w===void 0&&(w=[]),!m.current&&i(R=>R===null?w:R.concat(w.filter(D=>!R.includes(D))))},[m]),y=c.useRef(null),b=Je(w=>{if(h&&!n)return xn;if(!w||w===xn||v.current!==e||s!=null){const R=new Map;for(let D of e){if(!D)continue;if(s&&s.length>0&&!s.includes(D.id)&&D.rect.current){R.set(D.id,D.rect.current);continue}const _=D.node.current,j=_?new Ht(u(_),_):null;D.rect.current=j,j&&R.set(D.id,j)}return R}return w},[e,s,n,h,u]);return c.useEffect(()=>{v.current=e},[e]),c.useEffect(()=>{h||f()},[n,h]),c.useEffect(()=>{s&&s.length>0&&i(null)},[JSON.stringify(s)]),c.useEffect(()=>{h||typeof a!="number"||y.current!==null||(y.current=setTimeout(()=>{f(),y.current=null},a))},[a,h,f,...r]),{droppableRects:b,measureDroppableContainers:f,measuringScheduled:s!=null};function x(){switch(l){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 Do(e,t){return Hn(e,t)}function _o(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 To(e){return new Ht(Ae(e),e)}function yn(e,t,n){t===void 0&&(t=To);const[r,o]=c.useState(null);function s(){o(u=>{if(!e)return null;if(e.isConnected===!1){var l;return(l=u??n)!=null?l:null}const v=t(e);return JSON.stringify(u)===JSON.stringify(v)?u:v})}const i=_o({callback(u){if(e)for(const l of u){const{type:v,target:h}=l;if(v==="childList"&&h instanceof HTMLElement&&h.contains(e)){s();break}}}}),a=vt({callback:s});return le(()=>{s(),e?(a?.observe(e),i?.observe(document.body,{childList:!0,subtree:!0})):(a?.disconnect(),i?.disconnect())},[e]),r}function Oo(e){const t=Hn(e);return Mn(e,t)}const wn=[];function jo(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 ko(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(u=>{const l=_t(u);return l?(l.addEventListener("scroll",o,{passive:!0}),[l,Nt(l)]):null}).filter(u=>u!=null);n(a.length?new Map(a):null),r.current=e}return()=>{i(e),i(s)};function i(a){a.forEach(u=>{const l=_t(u);l?.removeEventListener("scroll",o)})}},[o,e]),c.useMemo(()=>e.length?t?Array.from(t.values()).reduce((s,i)=>Oe(s,i),oe):Vn(e):oe,[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!==oe;r&&!n.current&&(n.current=e),!r&&n.current&&(n.current=null)},[e]),n.current?ut(e,n.current):oe}function Io(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 Ao(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?no(e):null,[e])}const Rn=[];function Mo(e,t){t===void 0&&(t=Ae);const[n]=e,r=Wn(n?q(n):null),[o,s]=c.useState(Rn);function i(){s(()=>e.length?e.map(u=>zn(u)?r:new Ht(t(u),u)):Rn)}const a=vt({callback:i});return le(()=>{a?.disconnect(),i(),e.forEach(u=>a?.observe(u))},[e]),o}function No(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return Xe(t)?t:e}function Lo(e){let{measure:t}=e;const[n,r]=c.useState(null),o=c.useCallback(l=>{for(const{target:v}of l)if(Xe(v)){r(h=>{const m=t(v);return h?{...h,width:m.width,height:m.height}:m});break}},[t]),s=vt({callback:o}),i=c.useCallback(l=>{const v=No(l);s?.disconnect(),v&&s?.observe(v),r(v?t(v):null)},[t,s]),[a,u]=lt(i);return c.useMemo(()=>({nodeRef:a,rect:n,setRef:u}),[n,a,u])}const Po=[{sensor:Ut,options:{}},{sensor:Fn,options:{}}],zo={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 $o={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},Vo={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:dt,draggableNodes:new Map,over:null,measureDroppableContainers:dt},gt=c.createContext(Vo),Un=c.createContext($o);function Bo(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new We}}}function Fo(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 Ho(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:u,node:l}=a;if(!u.current&&!l.current)return;requestAnimationFrame(()=>{for(const v of[u.current,l.current]){if(!v)continue;const h=Ir(v);if(h){h.focus();break}}})}},[r,t,o,i,s]),null}function Wo(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((o,s)=>s({transform:o,...r}),n):n}function Uo(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 Yo(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;le(()=>{if(!i&&!a||!t){s.current=!1;return}if(s.current||!r)return;const l=t?.node.current;if(!l||l.isConnected===!1)return;const v=n(l),h=Mn(v,r);if(i||(h.x=0),a||(h.y=0),s.current=!0,Math.abs(h.x)>0||Math.abs(h.y)>0){const m=Nn(l);m&&m.scrollBy({top:h.y,left:h.x})}},[t,i,a,r,n])}const Yn=c.createContext({...oe,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:u=!0,children:l,sensors:v=Po,collisionDetection:h=Xr,measuring:m,modifiers:f,...y}=t;const b=c.useReducer(Fo,void 0,Bo),[x,w]=b,[R,D]=zr(),[_,j]=c.useState(ye.Uninitialized),C=_===ye.Initialized,{draggable:{active:E,nodes:T,translate:L},droppable:{containers:z}}=x,N=E!=null?T.get(E):null,U=c.useRef({initial:null,translated:null}),G=c.useMemo(()=>{var W;return E!=null?{id:E,data:(W=N?.data)!=null?W:zo,rect:U}:null},[E,N]),ee=c.useRef(null),[ue,we]=c.useState(null),[F,Se]=c.useState(null),te=Ue(y,Object.values(y)),ve=Ke("DndDescribedBy",i),g=c.useMemo(()=>z.getEnabled(),[z]),S=Uo(m),{droppableRects:k,measureDroppableContainers:M,measuringScheduled:se}=Eo(g,{dragging:C,dependencies:[L.x,L.y],config:S.droppable}),H=Ro(T,E),P=c.useMemo(()=>F?Mt(F):null,[F]),Y=fr(),J=Do(H,S.draggable.measure);Yo({activeNode:E!=null?T.get(E):null,config:Y.layoutShiftCompensation,initialRect:J,measure:S.draggable.measure});const A=yn(H,S.draggable.measure,J),Me=yn(H?H.parentElement:null),ie=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}),Re=z.getNodeFor((n=ie.current.over)==null?void 0:n.id),de=Lo({measure:S.dragOverlay.measure}),Ce=(r=de.nodeRef.current)!=null?r:H,Ee=C?(o=de.rect)!=null?o:A:null,Gt=!!(de.nodeRef.current&&de.rect),qt=Oo(Gt?null:A),mt=Wn(Ce?q(Ce):null),ge=jo(C?Re??H:null),Ze=Mo(ge),Qe=Wo(f,{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:ie.current.over,overlayNodeRect:de.rect,scrollableAncestors:ge,scrollableAncestorRects:Ze,windowRect:mt}),Xt=P?Oe(P,L):null,Jt=ko(ge),sr=Sn(Jt),ir=Sn(Jt,[A]),De=Oe(Qe,sr),_e=Ee?Zr(Ee,Qe):null,Ne=G&&_e?h({active:G,collisionRect:_e,droppableRects:k,droppableContainers:g,pointerCoordinates:Xt}):null,Kt=Gr(Ne,"id"),[pe,Zt]=c.useState(null),ar=Gt?Qe:Oe(Qe,ir),cr=Jr(ar,(s=pe?.rect)!=null?s:null,A),xt=c.useRef(null),Qt=c.useCallback((W,K)=>{let{sensor:Z,options:be}=K;if(ee.current==null)return;const ne=T.get(ee.current);if(!ne)return;const Q=W.nativeEvent,ae=new Z({active:ee.current,activeNode:ne,event:Q,options:be,context:ie,onAbort(B){if(!T.get(B))return;const{onDragAbort:ce}=te.current,fe={id:B};ce?.(fe),R({type:"onDragAbort",event:fe})},onPending(B,me,ce,fe){if(!T.get(B))return;const{onDragPending:Pe}=te.current,xe={id:B,constraint:me,initialCoordinates:ce,offset:fe};Pe?.(xe),R({type:"onDragPending",event:xe})},onStart(B){const me=ee.current;if(me==null)return;const ce=T.get(me);if(!ce)return;const{onDragStart:fe}=te.current,Le={activatorEvent:Q,active:{id:me,data:ce.data,rect:U}};Be.unstable_batchedUpdates(()=>{fe?.(Le),j(ye.Initializing),w({type:$.DragStart,initialCoordinates:B,active:me}),R({type:"onDragStart",event:Le}),we(xt.current),Se(Q)})},onMove(B){w({type:$.DragMove,coordinates:B})},onEnd:Te($.DragEnd),onCancel:Te($.DragCancel)});xt.current=ae;function Te(B){return async function(){const{active:ce,collisions:fe,over:Le,scrollAdjustedTranslate:Pe}=ie.current;let xe=null;if(ce&&Pe){const{cancelDrop:ze}=te.current;xe={activatorEvent:Q,active:ce,collisions:fe,delta:Pe,over:Le},B===$.DragEnd&&typeof ze=="function"&&await Promise.resolve(ze(xe))&&(B=$.DragCancel)}ee.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=te.current[ze];yt?.(xe),R({type:ze,event:xe})}})}}},[T]),lr=c.useCallback((W,K)=>(Z,be)=>{const ne=Z.nativeEvent,Q=T.get(be);if(ee.current!==null||!Q||ne.dndKit||ne.defaultPrevented)return;const ae={active:Q};W(Z,K.options,ae)===!0&&(ne.dndKit={capturedBy:K.sensor},ee.current=be,Qt(Z,K))},[T,Qt]),en=Co(v,lr);Io(v),le(()=>{A&&_===ye.Initializing&&j(ye.Initialized)},[A,_]),c.useEffect(()=>{const{onDragMove:W}=te.current,{active:K,activatorEvent:Z,collisions:be,over:ne}=ie.current;if(!K||!Z)return;const Q={active:K,activatorEvent:Z,collisions:be,delta:{x:De.x,y:De.y},over:ne};Be.unstable_batchedUpdates(()=>{W?.(Q),R({type:"onDragMove",event:Q})})},[De.x,De.y]),c.useEffect(()=>{const{active:W,activatorEvent:K,collisions:Z,droppableContainers:be,scrollAdjustedTranslate:ne}=ie.current;if(!W||ee.current==null||!K||!ne)return;const{onDragOver:Q}=te.current,ae=be.get(Kt),Te=ae&&ae.rect.current?{id:ae.id,rect:ae.rect.current,data:ae.data,disabled:ae.disabled}:null,B={active:W,activatorEvent:K,collisions:Z,delta:{x:ne.x,y:ne.y},over:Te};Be.unstable_batchedUpdates(()=>{Zt(Te),Q?.(B),R({type:"onDragOver",event:B})})},[Kt]),le(()=>{ie.current={activatorEvent:F,active:G,activeNode:H,collisionRect:_e,collisions:Ne,droppableRects:k,draggableNodes:T,draggingNode:Ce,draggingNodeRect:Ee,droppableContainers:z,over:pe,scrollableAncestors:ge,scrollAdjustedTranslate:De},U.current={initial:Ee,translated:_e}},[G,H,Ne,_e,T,Ce,Ee,k,z,pe,ge,De]),yo({...Y,delta:L,draggingRect:_e,pointerCoordinates:Xt,scrollableAncestors:ge,scrollableAncestorRects:Ze});const ur=c.useMemo(()=>({active:G,activeNode:H,activeNodeRect:A,activatorEvent:F,collisions:Ne,containerNodeRect:Me,dragOverlay:de,draggableNodes:T,droppableContainers:z,droppableRects:k,over:pe,measureDroppableContainers:M,scrollableAncestors:ge,scrollableAncestorRects:Ze,measuringConfiguration:S,measuringScheduled:se,windowRect:mt}),[G,H,A,F,Ne,Me,de,T,z,k,pe,M,ge,Ze,S,se,mt]),dr=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:D},c.createElement(gt.Provider,{value:dr},c.createElement(Un.Provider,{value:ur},c.createElement(Yn.Provider,{value:cr},l)),c.createElement(Ho,{disabled:a?.restoreFocus===!1})),c.createElement(Br,{...a,hiddenTextDescribedById:ve}));function fr(){const W=ue?.autoScrollEnabled===!1,K=typeof u=="object"?u.enabled===!1:u===!1,Z=C&&!W&&!K;return typeof u=="object"?{...u,enabled:Z}:{enabled:Z}}}),Go=c.createContext(null),Cn="button",qo="Draggable";function Xo(e){let{id:t,data:n,disabled:r=!1,attributes:o}=e;const s=Ke(qo),{activators:i,activatorEvent:a,active:u,activeNodeRect:l,ariaDescribedById:v,draggableNodes:h,over:m}=c.useContext(gt),{role:f=Cn,roleDescription:y="draggable",tabIndex:b=0}=o??{},x=u?.id===t,w=c.useContext(x?Yn:Go),[R,D]=lt(),[_,j]=lt(),C=Ao(i,t),E=Ue(n);le(()=>(h.set(t,{id:t,key:s,node:R,activatorNode:_,data:E}),()=>{const L=h.get(t);L&&L.key===s&&h.delete(t)}),[h,t]);const T=c.useMemo(()=>({role:f,tabIndex:b,"aria-disabled":r,"aria-pressed":x&&f===Cn?!0:void 0,"aria-roledescription":y,"aria-describedby":v.draggable}),[r,f,b,x,y,v.draggable]);return{active:u,activatorEvent:a,activeNodeRect:l,attributes:T,isDragging:x,listeners:r?void 0:C,node:R,over:m,setNodeRef:D,setActivatorNodeRef:j,transform:w}}function Jo(){return c.useContext(Un)}const Ko="Droppable",Zo={timeout:25};function Qo(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:o}=e;const s=Ke(Ko),{active:i,dispatch:a,over:u,measureDroppableContainers:l}=c.useContext(gt),v=c.useRef({disabled:n}),h=c.useRef(!1),m=c.useRef(null),f=c.useRef(null),{disabled:y,updateMeasurementsFor:b,timeout:x}={...Zo,...o},w=Ue(b??r),R=c.useCallback(()=>{if(!h.current){h.current=!0;return}f.current!=null&&clearTimeout(f.current),f.current=setTimeout(()=>{l(Array.isArray(w.current)?w.current:[w.current]),f.current=null},x)},[x]),D=vt({callback:R,disabled:y||!i}),_=c.useCallback((T,L)=>{D&&(L&&(D.unobserve(L),h.current=!1),T&&D.observe(T))},[D]),[j,C]=lt(_),E=Ue(t);return c.useEffect(()=>{!D||!j.current||(D.disconnect(),h.current=!1,D.observe(j.current))},[j,D]),c.useEffect(()=>(a({type:$.RegisterDroppable,element:{id:r,key:s,disabled:n,node:j,rect:m,data:E}}),()=>a({type:$.UnregisterDroppable,key:s,id:r})),[r]),c.useEffect(()=>{n!==v.current.disabled&&(a({type:$.SetDroppableDisabled,id:r,key:s,disabled:n}),v.current.disabled=n)},[r,s,n,a]),{active:i,rect:m,isOver:u?.id===r,node:j,over:u,setNodeRef:C}}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 es(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 ts(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 ns(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const st={scaleX:1,scaleY:1},rs=e=>{var t;let{rects:n,activeNodeRect:r,activeIndex:o,overIndex:s,index:i}=e;const a=(t=n[o])!=null?t:r;if(!a)return null;const u=os(n,i,o);if(i===o){const l=n[s];return l?{x:o<s?l.left+l.width-(a.left+a.width):l.left-a.left,y:0,...st}:null}return i>o&&i<=s?{x:-a.width-u,y:0,...st}:i<o&&i>=s?{x:a.width+u,y:0,...st}:{x:0,y:0,...st}};function os(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},ss=e=>{var t;let{activeIndex:n,activeNodeRect:r,index:o,rects:s,overIndex:i}=e;const a=(t=s[n])!=null?t:r;if(!a)return null;if(o===n){const l=s[i];return l?{x:0,y:n<i?l.top+l.height-(a.top+a.height):l.top-a.top,...it}:null}const u=is(s,o,n);return o>n&&o<=i?{x:0,y:-a.height-u,...it}:o<n&&o>=i?{x:0,y:a.height+u,...it}:{x:0,y:0,...it}};function is(e,t,n){const r=e[t],o=e[t-1],s=e[t+1];return r?n<t?o?r.top-(o.top+o.height):s?s.top-(r.top+r.height):0:s?s.top-(r.top+r.height):o?r.top-(o.top+o.height):0:0}const 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:u,over:l,measureDroppableContainers:v}=Jo(),h=Ke(Xn,n),m=a.rect!==null,f=c.useMemo(()=>r.map(C=>typeof C=="object"&&"id"in C?C.id:C),[r]),y=i!=null,b=i?f.indexOf(i.id):-1,x=l?f.indexOf(l.id):-1,w=c.useRef(f),R=!ts(f,w.current),D=x!==-1&&b===-1||R,_=ns(s);le(()=>{R&&y&&v(f)},[R,f,y,v]),c.useEffect(()=>{w.current=f},[f]);const j=c.useMemo(()=>({activeIndex:b,containerId:h,disabled:_,disableTransforms:D,items:f,overIndex:x,useDragOverlay:m,sortedRects:es(f,u),strategy:o}),[b,h,_.draggable,_.droppable,D,f,x,u,m,o]);return c.createElement(Jn.Provider,{value:j},t)}const as=e=>{let{id:t,items:n,activeIndex:r,overIndex:o}=e;return pt(n,r,o).indexOf(t)},cs=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:o,items:s,newIndex:i,previousItems:a,previousContainerId:u,transition:l}=e;return!l||!r||a!==s&&o===i?!1:n?!0:i!==o&&t===u},ls={duration:200,easing:"ease"},Zn="transform",us=je.Transition.toString({property:Zn,duration:0,easing:"linear"}),ds={roleDescription:"sortable"};function fs(e){let{disabled:t,index:n,node:r,rect:o}=e;const[s,i]=c.useState(null),a=c.useRef(n);return le(()=>{if(!t&&n!==a.current&&r.current){const u=o.current;if(u){const l=Ae(r.current,{ignoreTransform:!0}),v={x:u.left-l.left,y:u.top-l.top,scaleX:u.width/l.width,scaleY:u.height/l.height};(v.x||v.y)&&i(v)}}n!==a.current&&(a.current=n)},[t,n,r,o]),c.useEffect(()=>{s&&i(null)},[s]),s}function Qn(e){let{animateLayoutChanges:t=cs,attributes:n,disabled:r,data:o,getNewIndex:s=as,id:i,strategy:a,resizeObserverConfig:u,transition:l=ls}=e;const{items:v,containerId:h,activeIndex:m,disabled:f,disableTransforms:y,sortedRects:b,overIndex:x,useDragOverlay:w,strategy:R}=c.useContext(Jn),D=hs(r,f),_=v.indexOf(i),j=c.useMemo(()=>({sortable:{containerId:h,index:_,items:v},...o}),[h,o,_,v]),C=c.useMemo(()=>v.slice(v.indexOf(i)),[v,i]),{rect:E,node:T,isOver:L,setNodeRef:z}=Qo({id:i,data:j,disabled:D.droppable,resizeObserverConfig:{updateMeasurementsFor:C,...u}}),{active:N,activatorEvent:U,activeNodeRect:G,attributes:ee,setNodeRef:ue,listeners:we,isDragging:F,over:Se,setActivatorNodeRef:te,transform:ve}=Xo({id:i,data:j,attributes:{...ds,...n},disabled:D.draggable}),g=Tr(z,ue),S=!!N,k=S&&!y&&ot(m)&&ot(x),M=!w&&F,se=M&&k?ve:null,P=k?se??(a??R)({rects:b,activeNodeRect:G,activeIndex:m,overIndex:x,index:_}):null,Y=ot(m)&&ot(x)?s({id:i,items:v,activeIndex:m,overIndex:x}):_,J=N?.id,A=c.useRef({activeId:J,items:v,newIndex:Y,containerId:h}),Me=v!==A.current.items,ie=t({active:N,containerId:h,isDragging:F,isSorting:S,id:i,index:_,items:v,newIndex:A.current.newIndex,previousItems:A.current.items,previousContainerId:A.current.containerId,transition:l,wasDragging:A.current.activeId!=null}),Re=fs({disabled:!ie,index:_,node:T,rect:E});return c.useEffect(()=>{S&&A.current.newIndex!==Y&&(A.current.newIndex=Y),h!==A.current.containerId&&(A.current.containerId=h),v!==A.current.items&&(A.current.items=v)},[S,Y,h,v]),c.useEffect(()=>{if(J===A.current.activeId)return;if(J!=null&&A.current.activeId==null){A.current.activeId=J;return}const Ce=setTimeout(()=>{A.current.activeId=J},50);return()=>clearTimeout(Ce)},[J]),{active:N,activeIndex:m,attributes:ee,data:j,rect:E,index:_,newIndex:Y,items:v,isOver:L,isSorting:S,isDragging:F,listeners:we,node:T,overIndex:x,over:Se,setNodeRef:g,setActivatorNodeRef:te,setDroppableNodeRef:z,setDraggableNodeRef:ue,transform:Re??P,transition:de()};function de(){if(Re||Me&&A.current.newIndex===_)return us;if(!(M&&!Bt(U)||!l)&&(S||ie))return je.Transition.toString({...l,property:Zn})}}function hs(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 vs=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),gs=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,r)=>r?r.toUpperCase():n.toLowerCase()),En=e=>{const t=gs(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(),ps=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0};var bs={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 ms=c.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:o="",children:s,iconNode:i,...a},u)=>c.createElement("svg",{ref:u,...bs,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:er("lucide",o),...!s&&!ps(a)&&{"aria-hidden":"true"},...a},[...i.map(([l,v])=>c.createElement(l,v)),...Array.isArray(s)?s:[s]]));const X=(e,t)=>{const n=c.forwardRef(({className:r,...o},s)=>c.createElement(ms,{ref:s,iconNode:t,className:er(`lucide-${vs(En(e))}`,`lucide-${e}`,r),...o}));return n.displayName=En(e),n};const xs=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],ys=X("arrow-down",xs);const ws=[["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"}]],Ss=X("arrow-up-down",ws);const Rs=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],Cs=X("arrow-up",Rs);const Es=[["path",{d:"m19 21-7-4-7 4V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v16z",key:"1fy3hk"}]],Ds=X("bookmark",Es);const _s=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],Ts=X("chevron-left",_s);const Os=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],js=X("chevron-right",Os);const ks=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 3v18",key:"108xh3"}]],Is=X("columns-2",ks);const As=[["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"}]],Ms=X("delete",As);const Ns=[["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"}]],Ls=X("funnel",Ns);const Ps=[["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"}]],zs=X("grip-vertical",Ps);const $s=[["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"}]],Vs=X("pen",$s);const Bs=[["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"}]],Fs=X("settings",Bs);const Hs=[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]],Ws=X("square-pen",Hs);const Us=[["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],Ys=X("trash",Us);function O(e){return c.forwardRef((t,n)=>{const{children:r,...o}=t;return d.jsx(e,{ref:n,...o,children:r})})}const he=new On({sortColumn:null,sortDirection:"asc",visibility:{},columnOrder:[],data:[],sortebleColumns:[]});function tr(e){he.setState(t=>{const n=e[0]??{},r=Object.keys(n);return{...t,data:e,columnOrder:r,visibility:r.reduce((o,s)=>({...o,[s]:!0}),{}),sortebleColumns:r.map(o=>({id:o,label:o,sortable:!0}))}})}const Gs=O(p.Menu.Trigger),qs=O(p.Menu.Positioner),Xs=O(p.Menu.Content),Js=O(p.Menu.Item),Ks=O(p.Checkbox.Label),Zs=O(p.Checkbox.HiddenInput),Qs=O(p.Checkbox.Control);function ei({visibility:e,onToggle:t}){const{sortebleColumns:n}=qe(he);return d.jsxs(p.Menu.Root,{closeOnSelect:!1,children:[d.jsx(Gs,{asChild:!0,children:d.jsx(p.IconButton,{"aria-label":"Toggle columns",variant:"outline",size:"sm",ml:"1",children:d.jsx(Is,{size:18})})}),d.jsx(p.Portal,{children:d.jsx(qs,{children:d.jsx(Xs,{minW:"220px",children:n.map(r=>{const o=!!e[r.id];return d.jsx(Js,{value:r.id,closeOnSelect:!1,children:d.jsxs(p.Checkbox.Root,{checked:o,onCheckedChange:()=>t(r.id),children:[d.jsx(Zs,{}),d.jsx(Qs,{}),d.jsx(Ks,{children:r.label})]})},r.id)})})})})]})}const ti=e=>{he.setState(t=>({...t,columnOrder:e}))},ni=e=>{he.setState(t=>({...t,visibility:{...t.visibility,[e]:!t.visibility[e]}}))};function ri(e){he.setState(t=>t.sortColumn===e?{...t,sortDirection:t.sortDirection==="asc"?"desc":"asc"}:{...t,sortColumn:e,sortDirection:"asc"})}function oi({id:e,children:t,onClick:n,cursor:r,borderRight:o,borderRightColor:s}){const{setNodeRef:i,attributes:a,listeners:u,transform:l,transition:v}=Qn({id:e});return d.jsx(p.Table.ColumnHeader,{ref:i,onClick:n,w:e==="id"?"80px":void 0,style:{transform:je.Transform.toString(l),transition:v,cursor:r,borderRight:o,borderRightColor:s},...a,children:d.jsxs(p.HStack,{justify:"space-between",children:[t,d.jsx("span",{...u,children:d.jsx(zs,{size:12})})]})})}function si(){const{columnOrder:e,visibility:t,sortColumn:n,sortDirection:r,sortebleColumns:o}=qe(he);console.log(e,"fomr header");const s=e.map(a=>o.find(u=>u.id===a)).filter(a=>t[a.id]),i=a=>{const{active:u,over:l}=a;if(!l||u.id===l.id)return;const v=e.indexOf(u.id),h=e.indexOf(l.id);ti(pt(e,v,h))};return d.jsx(p.Table.Header,{background:"gray.100",position:"sticky",top:0,p:"0",children:d.jsx(Gn,{collisionDetection:An,onDragEnd:i,children:d.jsx(Kn,{items:e,strategy:rs,children:d.jsxs(p.Table.Row,{children:[s.map((a,u)=>{const l=n===a?.id,v=u===s.length-1;return d.jsx(oi,{id:a?.id,onClick:()=>a?.sortable&&ri(a?.id),cursor:a?.sortable?"pointer":"default",borderRight:v?void 0:"2px solid",children:d.jsxs("span",{style:{display:"flex",alignItems:"center",gap:6,userSelect:"none"},children:[a?.label,a?.sortable&&(l?r==="asc"?d.jsx(Cs,{size:14}):d.jsx(ys,{size:14}):d.jsx(Ss,{size:14,opacity:.4}))]})},a?.id)}),d.jsx(p.Table.ColumnHeader,{borderRight:"2px solid",borderRightColor:"gray.300",children:"Actions"}),d.jsx(p.Table.ColumnHeader,{boxSize:"0.5",children:d.jsx(ei,{visibility:t,onToggle:ni})})]})})})})}const Dn=p.createListCollection({items:[{label:"10",value:"10"},{label:"20",value:"20"},{label:"50",value:"50"},{label:"100",value:"100"}]}),ii=O(p.Select.Positioner),ai=O(p.Select.Content),ci=O(p.Select.Item),li=O(p.Pagination.PrevTrigger),ui=O(p.Pagination.NextTrigger),di=O(p.Select.HiddenSelect),fi=O(p.Select.Control),hi=O(p.Select.Trigger),vi=O(p.Select.ValueText),gi=O(p.Select.IndicatorGroup),pi=O(p.Select.Indicator);function bi({totalCount:e,pageSize:t,currentPage:n,onPageChange:r,onPageSizeChange:o,siblingCount:s=2}){return d.jsx(p.Box,{mt:6,width:"100%",children:d.jsxs(p.HStack,{justify:"space-between",mx:"auto",flexWrap:"wrap",children:[d.jsxs(p.HStack,{children:[d.jsx(p.Text,{fontSize:"sm",color:"gray.600",_dark:{color:"gray.400"},children:"Rows per page:"}),d.jsxs(p.Select.Root,{collection:Dn,size:"sm",width:"60px",onValueChange:i=>o&&o(Number(i.items[0].value)),value:[String(t)],children:[d.jsx(di,{}),d.jsxs(fi,{children:[d.jsx(hi,{children:d.jsx(vi,{placeholder:""})}),d.jsx(gi,{children:d.jsx(pi,{})})]}),d.jsx(p.Portal,{children:d.jsx(ii,{children:d.jsx(ai,{children:Dn.items.map(i=>d.jsxs(ci,{item:i.value,children:[i.label,d.jsx(p.Select.ItemIndicator,{})]},i.value))})})})]})]}),d.jsx(p.Pagination.Root,{count:e,pageSize:t,page:n,siblingCount:s,onPageChange:i=>r&&r(i.page),children:d.jsxs(p.ButtonGroup,{size:"sm",variant:"ghost",children:[d.jsx(li,{asChild:!0,children:d.jsx(p.IconButton,{"aria-label":"Previous page",children:d.jsx(Ts,{size:18})})}),d.jsx(p.Pagination.Items,{render:i=>d.jsx(p.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)}),d.jsx(ui,{asChild:!0,children:d.jsx(p.IconButton,{"aria-label":"Next page",children:d.jsx(js,{size:18})})})]})})]})})}function mi({data:e=[]}){const{columnOrder:t,visibility:n}=qe(he);return d.jsx(p.Table.Body,{children:e.map(r=>d.jsxs(p.Table.Row,{children:[t.filter(o=>n[o]).map(o=>d.jsx(p.Table.Cell,{children:r[o]},o)),d.jsxs(p.Table.Cell,{textAlign:"center",display:"flex",gap:2,children:[d.jsx(Ws,{size:16}),d.jsx(Ys,{size:16})]})]},r.id))})}function xi({data:e=[],loading:t=!1,emptyMessage:n="No data",actions:r,showIndex:o=!0,page:s=0,pageSize:i=10,hideHeaderList:a={},onPageChange:u,onPageSizeChange:l,density:v="sm"}){c.useMemo(()=>{tr(e)},[e]);const{sortColumn:h,sortDirection:m,data:f}=qe(he),y=c.useMemo(()=>{const b=[...f];h&&b.sort((w,R)=>m==="asc"?String(w[h]).localeCompare(String(R[h])):String(R[h]).localeCompare(String(w[h])));const x=(s-1)*i;return b.slice(x,x+i)},[s,i,h,m]);return d.jsxs(p.Box,{h:"100vh",display:"flex",flexDirection:"column",p:2,pt:2,children:[d.jsx(p.Box,{flex:"1",overflow:"hidden",children:d.jsx(p.Box,{h:"100%",overflowY:"auto",border:"1px solid",borderColor:"gray.200",borderRadius:"md",children:d.jsxs(p.Table.Root,{variant:"outline",w:"100%",size:v,children:[d.jsx(si,{}),d.jsx(mi,{data:y})]})})}),d.jsx(p.Box,{mt:.5,children:d.jsx(bi,{totalCount:e.length,pageSize:i,currentPage:s,onPageChange:u,onPageSizeChange:b=>{l&&l(b),s>1&&u&&u(1)}})})]})}const nr=e=>`FILTER_PRESETS_${e??"default"}`;function yi(e){try{return JSON.parse(localStorage.getItem(nr(e))||"[]")}catch{return[]}}const Ge=new On({}),bt=e=>{const t=Ge.state[e];if(t)return t;const n=yi(e);return Ge.setState(r=>({...r,[e]:n})),n},Yt=(e,t)=>{Ge.setState(n=>({...n,[e]:t})),localStorage.setItem(nr(e),JSON.stringify(t))},rr=(e,t)=>{const n=bt(e).filter(r=>r.id!==t);Yt(e,n)},or=(e,t)=>{const n=[t,...bt(e)];Yt(e,n)},wi=O(p.Checkbox.Root),Si=O(p.Checkbox.HiddenInput),Ri=O(p.Checkbox.Control),Ci=O(p.Slider.Root),Ei=O(p.Slider.Track),Di=O(p.Slider.Range),_i=O(p.Slider.Thumbs),Ti=O(p.Slider.Control),Oi=({filter:e,onVisibilityChange:t,onSizeChange:n})=>{const{attributes:r,listeners:o,setNodeRef:s,transform:i,transition:a}=Qn({id:e.id}),u={transform:je.Transform.toString(i),transition:a,cursor:"grab"};return d.jsxs(p.VStack,{ref:s,style:u,align:"stretch",border:"1px solid",borderColor:"gray.200",rounded:"md",p:3,mb:3,...r,...o,children:[d.jsx(p.Text,{fontWeight:"bold",children:e.label}),d.jsxs(p.HStack,{justify:"space-between",children:[d.jsx(p.Text,{fontSize:"sm",children:"Visible"}),d.jsxs(wi,{checked:e.visible,onCheckedChange:l=>t&&t(e.id,!!l),size:"sm",children:[d.jsx(Si,{}),d.jsx(Ri,{})]})]}),d.jsxs(p.VStack,{align:"stretch",gap:1,children:[d.jsx(p.Text,{fontSize:"sm",children:"Size"}),d.jsx(Ci,{width:"200px",min:1,max:5,step:.5,value:[e.size??1],onChange:l=>n&&n(e.id,l[0]),children:d.jsxs(Ti,{children:[d.jsx(Ei,{children:d.jsx(Di,{})}),d.jsx(_i,{})]})})]})]})},ji=O(p.Drawer.Root),ki=O(p.Drawer.Trigger),Ii=O(p.Drawer.Backdrop),Ai=O(p.Drawer.Positioner),Mi=O(p.Drawer.Content),Ni=O(p.Drawer.Header),Li=O(p.Drawer.Title),Pi=O(p.Drawer.Body),zi=O(p.Drawer.Footer),$i=O(p.Drawer.CloseTrigger),Vi=O(p.Tabs.Root),Bi=O(p.Tabs.List),jt=O(p.Tabs.Trigger),kt=O(p.Tabs.Content),Fi=({filterDrawerSize:e="sm",onVisibilityChange:t,onSizeChange:n,onClear:r,filters:o,pageKey:s="default",currentFilters:i={},onLoadPreset:a,activePresetName:u,onReorder:l})=>{const h=qe(Ge)[s]??bt(s),m=()=>{const f=prompt("Preset name?");f&&or(s,{id:crypto.randomUUID(),name:f,date:new Date().toISOString(),filters:i})};return d.jsx(p.HStack,{wrap:"wrap",children:d.jsxs(ji,{size:e,children:[d.jsx(ki,{asChild:!0,children:d.jsxs(p.IconButton,{"aria-label":"Open filters",variant:"outline",size:"xs",ml:2,p:2,children:[d.jsx(Ls,{size:16}),"Filters"]})}),d.jsxs(p.Portal,{children:[d.jsx(Ii,{}),d.jsx(Ai,{children:d.jsxs(Mi,{children:[d.jsx(Ni,{children:d.jsx(Li,{children:"Filters"})}),d.jsx(Pi,{overflowY:"auto",pt:1,children:d.jsxs(Vi,{defaultValue:"view",children:[d.jsxs(Bi,{mb:4,children:[d.jsxs(jt,{value:"view",children:[d.jsx(Vs,{size:16}),"Edit"]}),d.jsxs(jt,{value:"settings",children:[d.jsx(Fs,{size:16}),"Settings"]}),d.jsxs(jt,{value:"presets",children:[d.jsx(Ds,{size:16}),"Presets"]})]}),d.jsx(kt,{value:"view",children:o.filter(f=>f.visible).map(f=>d.jsxs(p.VStack,{align:"stretch",border:"1px solid",borderColor:"gray.200",rounded:"md",p:3,mb:3,children:[d.jsx(p.Text,{fontWeight:"bold",children:f.label}),f.customComponent]},f.id))}),d.jsx(kt,{value:"settings",children:d.jsx(Gn,{sensors:Hr(Fr(Ut)),collisionDetection:An,onDragEnd:({active:f,over:y})=>{if(!y||f.id===y.id)return;const b=o.findIndex(R=>R.id===f.id),x=o.findIndex(R=>R.id===y.id),w=pt(o,b,x);console.log(w),l?.(w)},children:d.jsx(Kn,{items:o.map(f=>f.id),strategy:ss,children:o.map(f=>d.jsx(Oi,{filter:f,onVisibilityChange:t,onSizeChange:n},f.id))})})}),d.jsx(kt,{value:"presets",children:d.jsxs(p.VStack,{align:"stretch",mb:3,children:[d.jsx(p.Button,{size:"sm",colorScheme:"blue",onClick:m,children:"Save Current Filters"}),h.length===0&&d.jsx(p.Text,{fontSize:"xs",color:"gray.500",children:"No presets saved yet."}),h.map(f=>d.jsxs(p.HStack,{justify:"space-between",border:"1px solid",borderColor:u===f.name?"blue.300":"gray.200",rounded:"md",p:2,children:[d.jsxs(p.VStack,{align:"start",gap:0,children:[d.jsx(p.Text,{fontWeight:"bold",fontSize:"sm",children:f.name}),d.jsx(p.Text,{fontSize:"xs",color:"gray.500",children:new Date(f.date).toLocaleDateString()})]}),d.jsxs(p.HStack,{children:[d.jsx(p.Button,{size:"xs",variant:"ghost",onClick:()=>a?.(f.filters,f.name),children:"Load"}),d.jsx(p.IconButton,{size:"xs","aria-label":"Delete preset",variant:"ghost",onClick:()=>rr(s,f.id),children:d.jsx(Ms,{size:14})})]})]},f.id))]})})]})}),d.jsxs(zi,{justify:"space-between",children:[d.jsx(p.Button,{size:"sm",variant:"ghost",colorScheme:"red",onClick:()=>r&&r(),children:"Clear All"}),d.jsx($i,{asChild:!0,children:d.jsx(p.CloseButton,{})})]})]})})]})]})})},Hi=({title:e,filters:t,onVisibilityChange:n,onReorder:r,onSizeChange:o,onClear:s,maxToolbarUnits:i,pageKey:a,currentFilters:u,onLoadPreset:l,activePresetName:v,filterDrawerSize:h="sm"})=>d.jsxs(p.HStack,{wrap:"wrap",pl:2,pr:2,width:"100%",justify:"space-between",children:[d.jsx(p.Text,{children:e}),d.jsxs(p.HStack,{children:[t.length>0&&t.filter(m=>m.visible).map(m=>d.jsx(p.HStack,{children:m.customComponent},m.id)),d.jsx(Fi,{filterDrawerSize:h,onVisibilityChange:n?(m,f)=>n(m,f):void 0,onReorder:r,onSizeChange:o?(m,f)=>o(m,f):void 0,onClear:s,maxToolbarUnits:i,pageKey:a,filters:t,currentFilters:u,onLoadPreset:l,activePresetName:v})]})]}),Wi=(e,t)=>{localStorage.setItem(`FILTER_ORDER_${e}`,JSON.stringify(t))},Ui=e=>{try{return JSON.parse(localStorage.getItem(`FILTER_ORDER_${e}`)||"[]")}catch{return[]}};exports.DataTable=xi;exports.Filters=Hi;exports.addPreset=or;exports.deletePreset=rr;exports.getPresets=bt;exports.loadOrder=Ui;exports.presetStore=Ge;exports.saveOrder=Wi;exports.savePresets=Yt;exports.setData=tr;exports.tableStore=he;exports.withChildren=O;
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
import { ConditionalValue } from '@chakra-ui/react';
|
|
2
|
+
import { JSX } from 'react/jsx-runtime';
|
|
3
|
+
import { JSX as JSX_2 } from 'react';
|
|
4
|
+
import * as React_2 from 'react';
|
|
5
|
+
import { Store } from '@tanstack/store';
|
|
6
|
+
|
|
7
|
+
export declare const addPreset: (pageKey: string, item: PresetItem) => void;
|
|
8
|
+
|
|
9
|
+
export declare function DataTable<T extends Record<string, unknown>>({ data: rowData, loading, emptyMessage, actions, showIndex, page, pageSize, hideHeaderList, onPageChange, onPageSizeChange, density, }: DataTableProps<T>): JSX.Element;
|
|
10
|
+
|
|
11
|
+
declare interface DataTableAction<T = unknown> {
|
|
12
|
+
icon: React.ReactNode;
|
|
13
|
+
label: string;
|
|
14
|
+
onClick: (row: T) => void;
|
|
15
|
+
colorScheme?: 'gray' | 'red' | 'orange' | 'yellow' | 'green' | 'teal' | 'blue' | 'cyan' | 'purple' | 'pink';
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
declare interface DataTableProps<T = unknown> {
|
|
19
|
+
data?: T[];
|
|
20
|
+
loading?: boolean;
|
|
21
|
+
emptyMessage?: string;
|
|
22
|
+
actions?: DataTableAction<T>[];
|
|
23
|
+
showIndex?: boolean;
|
|
24
|
+
page?: number;
|
|
25
|
+
pageSize?: number;
|
|
26
|
+
hideHeaderList?: Record<string, boolean>;
|
|
27
|
+
onPageChange?: (page: number) => void | undefined;
|
|
28
|
+
onPageSizeChange?: (size: number) => void | undefined;
|
|
29
|
+
density?: DensityType;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export declare const deletePreset: (pageKey: string, id: string) => void;
|
|
33
|
+
|
|
34
|
+
declare type DensityType = 'sm' | 'md' | 'lg';
|
|
35
|
+
|
|
36
|
+
export declare const Filters: ({ title, filters, onVisibilityChange, onReorder, onSizeChange, onClear, maxToolbarUnits, pageKey, currentFilters, onLoadPreset, activePresetName, filterDrawerSize, }: IMainFilterType) => JSX.Element;
|
|
37
|
+
|
|
38
|
+
export declare const getPresets: (pageKey: string) => PresetItem[];
|
|
39
|
+
|
|
40
|
+
export declare interface IFilterConfig {
|
|
41
|
+
id: string;
|
|
42
|
+
label: string;
|
|
43
|
+
type?: 'date' | 'text' | 'select' | 'checkbox' | 'radio' | 'number';
|
|
44
|
+
value: string | number | undefined | boolean;
|
|
45
|
+
options?: {
|
|
46
|
+
label: string;
|
|
47
|
+
value: string;
|
|
48
|
+
}[];
|
|
49
|
+
onChange?: (value: string | number | boolean | undefined) => void;
|
|
50
|
+
visible?: boolean;
|
|
51
|
+
size?: 0.5 | 1 | 1.5 | 2 | 2.5 | 3 | 3.5 | 4 | 4.5 | 5;
|
|
52
|
+
customComponent?: JSX_2.Element;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export declare interface IFilterDrawerProps {
|
|
56
|
+
filters: IFilterConfig[];
|
|
57
|
+
onVisibilityChange?: (id: string, visible: boolean) => void;
|
|
58
|
+
onReorder?: (newOrder: IFilterConfig[]) => void;
|
|
59
|
+
onSizeChange?: (id: string, size: number) => void;
|
|
60
|
+
onClear?: () => void;
|
|
61
|
+
maxToolbarUnits?: number;
|
|
62
|
+
filterDrawerSize?: 'md' | 'lg' | 'sm';
|
|
63
|
+
pageKey?: string;
|
|
64
|
+
currentFilters?: Record<string, unknown>;
|
|
65
|
+
onLoadPreset?: (filters: Record<string, unknown>, name: string) => void;
|
|
66
|
+
activePresetName?: string | null;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export declare interface IMainFilterType {
|
|
70
|
+
title: React.ReactNode;
|
|
71
|
+
filters: IFilterConfig[];
|
|
72
|
+
onVisibilityChange?: (id: string, visible: boolean) => void;
|
|
73
|
+
onReorder?: (newOrder: IFilterConfig[]) => void;
|
|
74
|
+
onSizeChange?: (id: string, size: number) => void;
|
|
75
|
+
onClear?: () => void;
|
|
76
|
+
maxToolbarUnits?: number;
|
|
77
|
+
filterDrawerSize?: 'md' | 'lg' | 'sm';
|
|
78
|
+
pageKey?: string;
|
|
79
|
+
currentFilters?: Record<string, unknown>;
|
|
80
|
+
onLoadPreset?: (filters: Record<string, unknown>, name: string) => void;
|
|
81
|
+
activePresetName?: string | null;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export declare interface IMDSCheckboxTypes {
|
|
85
|
+
value?: boolean;
|
|
86
|
+
onChange?: (value: boolean) => void;
|
|
87
|
+
size?: 'sm' | 'md' | 'lg';
|
|
88
|
+
label?: string;
|
|
89
|
+
helperText?: string;
|
|
90
|
+
isDisabled?: boolean;
|
|
91
|
+
required?: boolean;
|
|
92
|
+
errorText?: string;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export declare interface IMDSInputTypes {
|
|
96
|
+
icon?: React.ReactNode;
|
|
97
|
+
value?: string;
|
|
98
|
+
onChange?: (value: string) => void;
|
|
99
|
+
placeholder?: string;
|
|
100
|
+
size?: 'sm' | 'md' | 'lg';
|
|
101
|
+
width?: string;
|
|
102
|
+
variant?: ConditionalValue<'subtle' | 'outline' | 'flushed' | undefined>;
|
|
103
|
+
label?: string;
|
|
104
|
+
helperText?: string;
|
|
105
|
+
isDisabled?: boolean;
|
|
106
|
+
required?: boolean;
|
|
107
|
+
errorText?: string;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
export declare interface IMDSSelectBoxTypes {
|
|
111
|
+
options: {
|
|
112
|
+
label: string;
|
|
113
|
+
value: string;
|
|
114
|
+
}[];
|
|
115
|
+
value?: string;
|
|
116
|
+
onChange?: (value: string) => void;
|
|
117
|
+
placeholder?: string;
|
|
118
|
+
size?: 'sm' | 'md' | 'lg';
|
|
119
|
+
width?: string;
|
|
120
|
+
variant?: ConditionalValue<'subtle' | 'outline' | undefined>;
|
|
121
|
+
label?: string;
|
|
122
|
+
helperText?: string;
|
|
123
|
+
isDisabled?: boolean;
|
|
124
|
+
required?: boolean;
|
|
125
|
+
errorText?: string;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
export declare const loadOrder: (pageKey: string) => string[];
|
|
129
|
+
|
|
130
|
+
export declare interface PresetItem {
|
|
131
|
+
id: string;
|
|
132
|
+
name: string;
|
|
133
|
+
date: string;
|
|
134
|
+
filters: any;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
export declare const presetStore: Store<Record<string, PresetItem[]>, (cb: Record<string, PresetItem[]>) => Record<string, PresetItem[]>>;
|
|
138
|
+
|
|
139
|
+
export declare const saveOrder: (pageKey: string, filters: string[]) => void;
|
|
140
|
+
|
|
141
|
+
export declare const savePresets: (pageKey: string, items: PresetItem[]) => void;
|
|
142
|
+
|
|
143
|
+
export declare function setData(newData: any[]): void;
|
|
144
|
+
|
|
145
|
+
declare interface TableState {
|
|
146
|
+
sortColumn: string | null;
|
|
147
|
+
sortDirection: 'asc' | 'desc';
|
|
148
|
+
visibility: Record<string, boolean>;
|
|
149
|
+
columnOrder: string[];
|
|
150
|
+
data: any[];
|
|
151
|
+
sortebleColumns: {
|
|
152
|
+
id: string;
|
|
153
|
+
label: string;
|
|
154
|
+
sortable: boolean;
|
|
155
|
+
}[];
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
export declare const tableStore: Store<TableState, (cb: TableState) => TableState>;
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* Chakra v3 / Ark UI slot components do NOT expose `children` in their typings.
|
|
162
|
+
* This wrapper intentionally loosens typing to make them library-safe.
|
|
163
|
+
*/
|
|
164
|
+
export declare function withChildren(Component: any): React_2.ForwardRefExoticComponent<Omit<any, "ref"> & React_2.RefAttributes<any>>;
|
|
165
|
+
|
|
166
|
+
export { }
|