@mdspl/mds-shared-ui 1.0.2 → 1.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -1,10 +1,10 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const h=require("react"),a=require("@chakra-ui/react"),Ge=require("react-dom");function Ct(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var it={exports:{}},He={};var yn;function Zr(){if(yn)return He;yn=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(r,o,s){var c=null;if(s!==void 0&&(c=""+s),o.key!==void 0&&(c=""+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:c,ref:o!==void 0?o:null,props:s}}return He.Fragment=t,He.jsx=n,He.jsxs=n,He}var Ve={};var Sn;function Qr(){return Sn||(Sn=1,process.env.NODE_ENV!=="production"&&(function(){function e(x){if(x==null)return null;if(typeof x=="function")return x.$$typeof===O?null:x.displayName||x.name||null;if(typeof x=="string")return x;switch(x){case S:return"Fragment";case j:return"Profiler";case w:return"StrictMode";case M:return"Suspense";case A:return"SuspenseList";case B:return"Activity"}if(typeof x=="object")switch(typeof x.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),x.$$typeof){case m:return"Portal";case I:return x.displayName||"Context";case R:return(x._context.displayName||"Context")+".Consumer";case $:var T=x.render;return x=x.displayName,x||(x=T.displayName||T.name||"",x=x!==""?"ForwardRef("+x+")":"ForwardRef"),x;case L:return T=x.displayName||null,T!==null?T:e(x.type)||"Memo";case V:T=x._payload,x=x._init;try{return e(x(T))}catch{}}return null}function t(x){return""+x}function n(x){try{t(x);var T=!1}catch{T=!0}if(T){T=console;var N=T.error,Y=typeof Symbol=="function"&&Symbol.toStringTag&&x[Symbol.toStringTag]||x.constructor.name||"Object";return N.call(T,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",Y),t(x)}}function r(x){if(x===S)return"<>";if(typeof x=="object"&&x!==null&&x.$$typeof===V)return"<...>";try{var T=e(x);return T?"<"+T+">":"<...>"}catch{return"<...>"}}function o(){var x=H.A;return x===null?null:x.getOwner()}function s(){return Error("react-stack-top-frame")}function c(x){if(G.call(x,"key")){var T=Object.getOwnPropertyDescriptor(x,"key").get;if(T&&T.isReactWarning)return!1}return x.key!==void 0}function l(x,T){function N(){C||(C=!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)",T))}N.isReactWarning=!0,Object.defineProperty(x,"key",{get:N,configurable:!0})}function u(){var x=e(this.type);return _[x]||(_[x]=!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.")),x=this.props.ref,x!==void 0?x:null}function d(x,T,N,Y,X,q){var W=N.ref;return x={$$typeof:p,type:x,key:T,props:N,_owner:Y},(W!==void 0?W:null)!==null?Object.defineProperty(x,"ref",{enumerable:!1,get:u}):Object.defineProperty(x,"ref",{enumerable:!1,value:null}),x._store={},Object.defineProperty(x._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(x,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(x,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:X}),Object.defineProperty(x,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:q}),Object.freeze&&(Object.freeze(x.props),Object.freeze(x)),x}function g(x,T,N,Y,X,q){var W=T.children;if(W!==void 0)if(Y)if(k(W)){for(Y=0;Y<W.length;Y++)f(W[Y]);Object.freeze&&Object.freeze(W)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else f(W);if(G.call(T,"key")){W=e(x);var K=Object.keys(T).filter(function(F){return F!=="key"});Y=0<K.length?"{key: someKey, "+K.join(": ..., ")+": ...}":"{key: someKey}",z[W+Y]||(K=0<K.length?"{"+K.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const h=require("react"),a=require("@chakra-ui/react"),Be=require("react-dom");function bt(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var tt={exports:{}},Fe={};var pn;function Gr(){if(pn)return Fe;pn=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(r,o,i){var c=null;if(i!==void 0&&(c=""+i),o.key!==void 0&&(c=""+o.key),"key"in o){i={};for(var l in o)l!=="key"&&(i[l]=o[l])}else i=o;return o=i.ref,{$$typeof:e,type:r,key:c,ref:o!==void 0?o:null,props:i}}return Fe.Fragment=t,Fe.jsx=n,Fe.jsxs=n,Fe}var Ye={};var vn;function qr(){return vn||(vn=1,process.env.NODE_ENV!=="production"&&(function(){function e(v){if(v==null)return null;if(typeof v=="function")return v.$$typeof===S?null:v.displayName||v.name||null;if(typeof v=="string")return v;switch(v){case w:return"Fragment";case R:return"Profiler";case C:return"StrictMode";case _:return"Suspense";case $:return"SuspenseList";case k:return"Activity"}if(typeof v=="object")switch(typeof v.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),v.$$typeof){case y:return"Portal";case L:return v.displayName||"Context";case T:return(v._context.displayName||"Context")+".Consumer";case A:var O=v.render;return v=v.displayName,v||(v=O.displayName||O.name||"",v=v!==""?"ForwardRef("+v+")":"ForwardRef"),v;case N:return O=v.displayName||null,O!==null?O:e(v.type)||"Memo";case H:O=v._payload,v=v._init;try{return e(v(O))}catch{}}return null}function t(v){return""+v}function n(v){try{t(v);var O=!1}catch{O=!0}if(O){O=console;var z=O.error,B=typeof Symbol=="function"&&Symbol.toStringTag&&v[Symbol.toStringTag]||v.constructor.name||"Object";return z.call(O,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",B),t(v)}}function r(v){if(v===w)return"<>";if(typeof v=="object"&&v!==null&&v.$$typeof===H)return"<...>";try{var O=e(v);return O?"<"+O+">":"<...>"}catch{return"<...>"}}function o(){var v=W.A;return v===null?null:v.getOwner()}function i(){return Error("react-stack-top-frame")}function c(v){if(V.call(v,"key")){var O=Object.getOwnPropertyDescriptor(v,"key").get;if(O&&O.isReactWarning)return!1}return v.key!==void 0}function l(v,O){function z(){D||(D=!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)",O))}z.isReactWarning=!0,Object.defineProperty(v,"key",{get:z,configurable:!0})}function u(){var v=e(this.type);return E[v]||(E[v]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),v=this.props.ref,v!==void 0?v:null}function d(v,O,z,B,q,X){var U=z.ref;return v={$$typeof:m,type:v,key:O,props:z,_owner:B},(U!==void 0?U:null)!==null?Object.defineProperty(v,"ref",{enumerable:!1,get:u}):Object.defineProperty(v,"ref",{enumerable:!1,value:null}),v._store={},Object.defineProperty(v._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(v,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(v,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:q}),Object.defineProperty(v,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:X}),Object.freeze&&(Object.freeze(v.props),Object.freeze(v)),v}function g(v,O,z,B,q,X){var U=O.children;if(U!==void 0)if(B)if(I(U)){for(B=0;B<U.length;B++)f(U[B]);Object.freeze&&Object.freeze(U)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else f(U);if(V.call(O,"key")){U=e(v);var K=Object.keys(O).filter(function(Y){return Y!=="key"});B=0<K.length?"{key: someKey, "+K.join(": ..., ")+": ...}":"{key: someKey}",F[U+B]||(K=0<K.length?"{"+K.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
2
2
  let props = %s;
3
3
  <%s {...props} />
4
4
  React keys must be passed directly to JSX without using spread:
5
5
  let props = %s;
6
- <%s key={someKey} {...props} />`,Y,W,K,W),z[W+Y]=!0)}if(W=null,N!==void 0&&(n(N),W=""+N),c(T)&&(n(T.key),W=""+T.key),"key"in T){N={};for(var J in T)J!=="key"&&(N[J]=T[J])}else N=T;return W&&l(N,typeof x=="function"?x.displayName||x.name||"Unknown":x),d(x,W,N,o(),X,q)}function f(x){b(x)?x._store&&(x._store.validated=1):typeof x=="object"&&x!==null&&x.$$typeof===V&&(x._payload.status==="fulfilled"?b(x._payload.value)&&x._payload.value._store&&(x._payload.value._store.validated=1):x._store&&(x._store.validated=1))}function b(x){return typeof x=="object"&&x!==null&&x.$$typeof===p}var v=h,p=Symbol.for("react.transitional.element"),m=Symbol.for("react.portal"),S=Symbol.for("react.fragment"),w=Symbol.for("react.strict_mode"),j=Symbol.for("react.profiler"),R=Symbol.for("react.consumer"),I=Symbol.for("react.context"),$=Symbol.for("react.forward_ref"),M=Symbol.for("react.suspense"),A=Symbol.for("react.suspense_list"),L=Symbol.for("react.memo"),V=Symbol.for("react.lazy"),B=Symbol.for("react.activity"),O=Symbol.for("react.client.reference"),H=v.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,G=Object.prototype.hasOwnProperty,k=Array.isArray,E=console.createTask?console.createTask:function(){return null};v={react_stack_bottom_frame:function(x){return x()}};var C,_={},D=v.react_stack_bottom_frame.bind(v,s)(),P=E(r(s)),z={};Ve.Fragment=S,Ve.jsx=function(x,T,N){var Y=1e4>H.recentlyCreatedOwnerStacks++;return g(x,T,N,!1,Y?Error("react-stack-top-frame"):D,Y?E(r(x)):P)},Ve.jsxs=function(x,T,N){var Y=1e4>H.recentlyCreatedOwnerStacks++;return g(x,T,N,!0,Y?Error("react-stack-top-frame"):D,Y?E(r(x)):P)}})()),Ve}var wn;function eo(){return wn||(wn=1,process.env.NODE_ENV==="production"?it.exports=Zr():it.exports=Qr()),it.exports}var i=eo();function to(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return h.useMemo(()=>r=>{t.forEach(o=>o(r))},t)}const Dt=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Ae(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function tn(e){return"nodeType"in e}function ae(e){var t,n;return e?Ae(e)?e:tn(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function nn(e){const{Document:t}=ae(e);return e instanceof t}function et(e){return Ae(e)?!1:e instanceof ae(e).HTMLElement}function Jn(e){return e instanceof ae(e).SVGElement}function Le(e){return e?Ae(e)?e.document:tn(e)?nn(e)?e:et(e)||Jn(e)?e.ownerDocument:document:document:document}const xe=Dt?h.useLayoutEffect:h.useEffect;function rn(e){const t=h.useRef(e);return xe(()=>{t.current=e}),h.useCallback(function(){for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return t.current==null?void 0:t.current(...r)},[])}function no(){const e=h.useRef(null),t=h.useCallback((r,o)=>{e.current=setInterval(r,o)},[]),n=h.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,n]}function Je(e,t){t===void 0&&(t=[e]);const n=h.useRef(e);return xe(()=>{n.current!==e&&(n.current=e)},t),n}function tt(e,t){const n=h.useRef();return h.useMemo(()=>{const r=e(n.current);return n.current=r,r},[...t])}function xt(e){const t=rn(e),n=h.useRef(null),r=h.useCallback(o=>{o!==n.current&&t?.(o,n.current),n.current=o},[]);return[n,r]}function Wt(e){const t=h.useRef();return h.useEffect(()=>{t.current=e},[e]),t.current}let It={};function nt(e,t){return h.useMemo(()=>{if(t)return t;const n=It[e]==null?0:It[e]+1;return It[e]=n,e+"-"+n},[e,t])}function Zn(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return r.reduce((s,c)=>{const l=Object.entries(c);for(const[u,d]of l){const g=s[u];g!=null&&(s[u]=g+e*d)}return s},{...t})}}const $e=Zn(1),bt=Zn(-1);function ro(e){return"clientX"in e&&"clientY"in e}function on(e){if(!e)return!1;const{KeyboardEvent:t}=ae(e.target);return t&&e instanceof t}function oo(e){if(!e)return!1;const{TouchEvent:t}=ae(e.target);return t&&e instanceof t}function Ut(e){if(oo(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 ro(e)?{x:e.clientX,y:e.clientY}:null}const Ie=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:n}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:n}=e;return"scaleX("+t+") scaleY("+n+")"}},Transform:{toString(e){if(e)return[Ie.Translate.toString(e),Ie.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+" "+n+"ms "+r}}}),Cn="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function so(e){return e.matches(Cn)?e:e.querySelector(Cn)}const io={display:"none"};function ao(e){let{id:t,value:n}=e;return h.createElement("div",{id:t,style:io},n)}function co(e){let{id:t,announcement:n,ariaLiveType:r="assertive"}=e;const o={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return h.createElement("div",{id:t,style:o,role:"status","aria-live":r,"aria-atomic":!0},n)}function lo(){const[e,t]=h.useState("");return{announce:h.useCallback(r=>{r!=null&&t(r)},[]),announcement:e}}const Qn=h.createContext(null);function uo(e){const t=h.useContext(Qn);h.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function fo(){const[e]=h.useState(()=>new Set),t=h.useCallback(r=>(e.add(r),()=>e.delete(r)),[e]);return[h.useCallback(r=>{let{type:o,event:s}=r;e.forEach(c=>{var l;return(l=c[o])==null?void 0:l.call(c,s)})},[e]),t]}const ho={draggable:`
6
+ <%s key={someKey} {...props} />`,B,U,K,U),F[U+B]=!0)}if(U=null,z!==void 0&&(n(z),U=""+z),c(O)&&(n(O.key),U=""+O.key),"key"in O){z={};for(var J in O)J!=="key"&&(z[J]=O[J])}else z=O;return U&&l(z,typeof v=="function"?v.displayName||v.name||"Unknown":v),d(v,U,z,o(),q,X)}function f(v){x(v)?v._store&&(v._store.validated=1):typeof v=="object"&&v!==null&&v.$$typeof===H&&(v._payload.status==="fulfilled"?x(v._payload.value)&&v._payload.value._store&&(v._payload.value._store.validated=1):v._store&&(v._store.validated=1))}function x(v){return typeof v=="object"&&v!==null&&v.$$typeof===m}var p=h,m=Symbol.for("react.transitional.element"),y=Symbol.for("react.portal"),w=Symbol.for("react.fragment"),C=Symbol.for("react.strict_mode"),R=Symbol.for("react.profiler"),T=Symbol.for("react.consumer"),L=Symbol.for("react.context"),A=Symbol.for("react.forward_ref"),_=Symbol.for("react.suspense"),$=Symbol.for("react.suspense_list"),N=Symbol.for("react.memo"),H=Symbol.for("react.lazy"),k=Symbol.for("react.activity"),S=Symbol.for("react.client.reference"),W=p.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,V=Object.prototype.hasOwnProperty,I=Array.isArray,M=console.createTask?console.createTask:function(){return null};p={react_stack_bottom_frame:function(v){return v()}};var D,E={},j=p.react_stack_bottom_frame.bind(p,i)(),P=M(r(i)),F={};Ye.Fragment=w,Ye.jsx=function(v,O,z){var B=1e4>W.recentlyCreatedOwnerStacks++;return g(v,O,z,!1,B?Error("react-stack-top-frame"):j,B?M(r(v)):P)},Ye.jsxs=function(v,O,z){var B=1e4>W.recentlyCreatedOwnerStacks++;return g(v,O,z,!0,B?Error("react-stack-top-frame"):j,B?M(r(v)):P)}})()),Ye}var mn;function Xr(){return mn||(mn=1,process.env.NODE_ENV==="production"?tt.exports=Gr():tt.exports=qr()),tt.exports}var s=Xr();function Kr(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return h.useMemo(()=>r=>{t.forEach(o=>o(r))},t)}const yt=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function ke(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function Jt(e){return"nodeType"in e}function ie(e){var t,n;return e?ke(e)?e:Jt(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function Zt(e){const{Document:t}=ie(e);return e instanceof t}function Xe(e){return ke(e)?!1:e instanceof ie(e).HTMLElement}function Vn(e){return e instanceof ie(e).SVGElement}function Ie(e){return e?ke(e)?e.document:Jt(e)?Zt(e)?e:Xe(e)||Vn(e)?e.ownerDocument:document:document:document}const ve=yt?h.useLayoutEffect:h.useEffect;function Qt(e){const t=h.useRef(e);return ve(()=>{t.current=e}),h.useCallback(function(){for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return t.current==null?void 0:t.current(...r)},[])}function Jr(){const e=h.useRef(null),t=h.useCallback((r,o)=>{e.current=setInterval(r,o)},[]),n=h.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,n]}function Ue(e,t){t===void 0&&(t=[e]);const n=h.useRef(e);return ve(()=>{n.current!==e&&(n.current=e)},t),n}function Ke(e,t){const n=h.useRef();return h.useMemo(()=>{const r=e(n.current);return n.current=r,r},[...t])}function gt(e){const t=Qt(e),n=h.useRef(null),r=h.useCallback(o=>{o!==n.current&&t?.(o,n.current),n.current=o},[]);return[n,r]}function Yt(e){const t=h.useRef();return h.useEffect(()=>{t.current=e},[e]),t.current}let Ot={};function Je(e,t){return h.useMemo(()=>{if(t)return t;const n=Ot[e]==null?0:Ot[e]+1;return Ot[e]=n,e+"-"+n},[e,t])}function Un(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return r.reduce((i,c)=>{const l=Object.entries(c);for(const[u,d]of l){const g=i[u];g!=null&&(i[u]=g+e*d)}return i},{...t})}}const Oe=Un(1),pt=Un(-1);function Zr(e){return"clientX"in e&&"clientY"in e}function en(e){if(!e)return!1;const{KeyboardEvent:t}=ie(e.target);return t&&e instanceof t}function Qr(e){if(!e)return!1;const{TouchEvent:t}=ie(e.target);return t&&e instanceof t}function Bt(e){if(Qr(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 Zr(e)?{x:e.clientX,y:e.clientY}:null}const _e=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[_e.Translate.toString(e),_e.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+" "+n+"ms "+r}}}),xn="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function eo(e){return e.matches(xn)?e:e.querySelector(xn)}const to={display:"none"};function no(e){let{id:t,value:n}=e;return h.createElement("div",{id:t,style:to},n)}function ro(e){let{id:t,announcement:n,ariaLiveType:r="assertive"}=e;const o={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return h.createElement("div",{id:t,style:o,role:"status","aria-live":r,"aria-atomic":!0},n)}function oo(){const[e,t]=h.useState("");return{announce:h.useCallback(r=>{r!=null&&t(r)},[]),announcement:e}}const Gn=h.createContext(null);function so(e){const t=h.useContext(Gn);h.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function io(){const[e]=h.useState(()=>new Set),t=h.useCallback(r=>(e.add(r),()=>e.delete(r)),[e]);return[h.useCallback(r=>{let{type:o,event:i}=r;e.forEach(c=>{var l;return(l=c[o])==null?void 0:l.call(c,i)})},[e]),t]}const ao={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
- `},go={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was moved over droppable area "+n.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was dropped over droppable area "+n.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function po(e){let{announcements:t=go,container:n,hiddenTextDescribedById:r,screenReaderInstructions:o=ho}=e;const{announce:s,announcement:c}=lo(),l=nt("DndLiveRegion"),[u,d]=h.useState(!1);if(h.useEffect(()=>{d(!0)},[]),uo(h.useMemo(()=>({onDragStart(f){let{active:b}=f;s(t.onDragStart({active:b}))},onDragMove(f){let{active:b,over:v}=f;t.onDragMove&&s(t.onDragMove({active:b,over:v}))},onDragOver(f){let{active:b,over:v}=f;s(t.onDragOver({active:b,over:v}))},onDragEnd(f){let{active:b,over:v}=f;s(t.onDragEnd({active:b,over:v}))},onDragCancel(f){let{active:b,over:v}=f;s(t.onDragCancel({active:b,over:v}))}}),[s,t])),!u)return null;const g=h.createElement(h.Fragment,null,h.createElement(ao,{id:r,value:o.draggable}),h.createElement(co,{id:l,announcement:c}));return n?Ge.createPortal(g,n):g}var Q;(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"})(Q||(Q={}));function yt(){}function vo(e,t){return h.useMemo(()=>({sensor:e,options:{}}),[e,t])}function mo(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return h.useMemo(()=>[...t].filter(r=>r!=null),[...t])}const pe=Object.freeze({x:0,y:0});function xo(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function bo(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function yo(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function So(e,t){if(!e||e.length===0)return null;const[n]=e;return n[t]}function Dn(e,t,n){return t===void 0&&(t=e.left),n===void 0&&(n=e.top),{x:t+e.width*.5,y:n+e.height*.5}}const er=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=Dn(t,t.left,t.top),s=[];for(const c of r){const{id:l}=c,u=n.get(l);if(u){const d=xo(Dn(u),o);s.push({id:l,data:{droppableContainer:c,value:d}})}}return s.sort(bo)};function wo(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),c=o-r,l=s-n;if(r<o&&n<s){const u=t.width*t.height,d=e.width*e.height,g=c*l,f=g/(u+d-g);return Number(f.toFixed(4))}return 0}const Co=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=[];for(const s of r){const{id:c}=s,l=n.get(c);if(l){const u=wo(l,t);u>0&&o.push({id:c,data:{droppableContainer:s,value:u}})}}return o.sort(yo)};function Do(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function tr(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:pe}function jo(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((c,l)=>({...c,top:c.top+e*l.y,bottom:c.bottom+e*l.y,left:c.left+e*l.x,right:c.right+e*l.x}),{...n})}}const Ro=jo(1);function Eo(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 To(e,t,n){const r=Eo(t);if(!r)return e;const{scaleX:o,scaleY:s,x:c,y:l}=r,u=e.left-c-(1-o)*parseFloat(n),d=e.top-l-(1-s)*parseFloat(n.slice(n.indexOf(" ")+1)),g=o?e.width/o:e.width,f=s?e.height/s:e.height;return{width:g,height:f,top:d,right:u+g,bottom:d+f,left:u}}const Mo={ignoreTransform:!1};function Pe(e,t){t===void 0&&(t=Mo);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:d,transformOrigin:g}=ae(e).getComputedStyle(e);d&&(n=To(n,d,g))}const{top:r,left:o,width:s,height:c,bottom:l,right:u}=n;return{top:r,left:o,width:s,height:c,bottom:l,right:u}}function jn(e){return Pe(e,{ignoreTransform:!0})}function _o(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function Oo(e,t){return t===void 0&&(t=ae(e).getComputedStyle(e)),t.position==="fixed"}function ko(e,t){t===void 0&&(t=ae(e).getComputedStyle(e));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(o=>{const s=t[o];return typeof s=="string"?n.test(s):!1})}function sn(e,t){const n=[];function r(o){if(t!=null&&n.length>=t||!o)return n;if(nn(o)&&o.scrollingElement!=null&&!n.includes(o.scrollingElement))return n.push(o.scrollingElement),n;if(!et(o)||Jn(o)||n.includes(o))return n;const s=ae(e).getComputedStyle(o);return o!==e&&ko(o,s)&&n.push(o),Oo(o,s)?n:r(o.parentNode)}return e?r(e):n}function nr(e){const[t]=sn(e,1);return t??null}function At(e){return!Dt||!e?null:Ae(e)?e:tn(e)?nn(e)||e===Le(e).scrollingElement?window:et(e)?e:null:null}function rr(e){return Ae(e)?e.scrollX:e.scrollLeft}function or(e){return Ae(e)?e.scrollY:e.scrollTop}function Gt(e){return{x:rr(e),y:or(e)}}var ee;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(ee||(ee={}));function sr(e){return!Dt||!e?!1:e===document.scrollingElement}function ir(e){const t={x:0,y:0},n=sr(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height},o=e.scrollTop<=t.y,s=e.scrollLeft<=t.x,c=e.scrollTop>=r.y,l=e.scrollLeft>=r.x;return{isTop:o,isLeft:s,isBottom:c,isRight:l,maxScroll:r,minScroll:t}}const $o={x:.2,y:.2};function Io(e,t,n,r,o){let{top:s,left:c,right:l,bottom:u}=n;r===void 0&&(r=10),o===void 0&&(o=$o);const{isTop:d,isBottom:g,isLeft:f,isRight:b}=ir(e),v={x:0,y:0},p={x:0,y:0},m={height:t.height*o.y,width:t.width*o.x};return!d&&s<=t.top+m.height?(v.y=ee.Backward,p.y=r*Math.abs((t.top+m.height-s)/m.height)):!g&&u>=t.bottom-m.height&&(v.y=ee.Forward,p.y=r*Math.abs((t.bottom-m.height-u)/m.height)),!b&&l>=t.right-m.width?(v.x=ee.Forward,p.x=r*Math.abs((t.right-m.width-l)/m.width)):!f&&c<=t.left+m.width&&(v.x=ee.Backward,p.x=r*Math.abs((t.left+m.width-c)/m.width)),{direction:v,speed:p}}function Ao(e){if(e===document.scrollingElement){const{innerWidth:s,innerHeight:c}=window;return{top:0,left:0,right:s,bottom:c,width:s,height:c}}const{top:t,left:n,right:r,bottom:o}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:o,width:e.clientWidth,height:e.clientHeight}}function ar(e){return e.reduce((t,n)=>$e(t,Gt(n)),pe)}function Lo(e){return e.reduce((t,n)=>t+rr(n),0)}function Po(e){return e.reduce((t,n)=>t+or(n),0)}function No(e,t){if(t===void 0&&(t=Pe),!e)return;const{top:n,left:r,bottom:o,right:s}=t(e);nr(e)&&(o<=0||s<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const zo=[["x",["left","right"],Lo],["y",["top","bottom"],Po]];class an{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=sn(n),o=ar(r);this.rect={...t},this.width=t.width,this.height=t.height;for(const[s,c,l]of zo)for(const u of c)Object.defineProperty(this,u,{get:()=>{const d=l(r),g=o[s]-d;return this.rect[u]+g},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class Xe{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var r;return(r=this.target)==null?void 0:r.removeEventListener(...n)})},this.target=t}add(t,n,r){var o;(o=this.target)==null||o.addEventListener(t,n,r),this.listeners.push([t,n,r])}}function Fo(e){const{EventTarget:t}=ae(e);return e instanceof t?e:Le(e)}function Lt(e,t){const n=Math.abs(e.x),r=Math.abs(e.y);return typeof t=="number"?Math.sqrt(n**2+r**2)>t:"x"in t&&"y"in t?n>t.x&&r>t.y:"x"in t?n>t.x:"y"in t?r>t.y:!1}var fe;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(fe||(fe={}));function Rn(e){e.preventDefault()}function Bo(e){e.stopPropagation()}var U;(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"})(U||(U={}));const cr={start:[U.Space,U.Enter],cancel:[U.Esc],end:[U.Space,U.Enter,U.Tab]},Yo=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case U.Right:return{...n,x:n.x+25};case U.Left:return{...n,x:n.x-25};case U.Down:return{...n,y:n.y+25};case U.Up:return{...n,y:n.y-25}}};class lr{constructor(t){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=t;const{event:{target:n}}=t;this.props=t,this.listeners=new Xe(Le(n)),this.windowListeners=new Xe(ae(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(fe.Resize,this.handleCancel),this.windowListeners.add(fe.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(fe.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props,r=t.node.current;r&&No(r),n(pe)}handleKeyDown(t){if(on(t)){const{active:n,context:r,options:o}=this.props,{keyboardCodes:s=cr,coordinateGetter:c=Yo,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:d}=r.current,g=d?{x:d.left,y:d.top}:pe;this.referenceCoordinates||(this.referenceCoordinates=g);const f=c(t,{active:n,context:r.current,currentCoordinates:g});if(f){const b=bt(f,g),v={x:0,y:0},{scrollableAncestors:p}=r.current;for(const m of p){const S=t.code,{isTop:w,isRight:j,isLeft:R,isBottom:I,maxScroll:$,minScroll:M}=ir(m),A=Ao(m),L={x:Math.min(S===U.Right?A.right-A.width/2:A.right,Math.max(S===U.Right?A.left:A.left+A.width/2,f.x)),y:Math.min(S===U.Down?A.bottom-A.height/2:A.bottom,Math.max(S===U.Down?A.top:A.top+A.height/2,f.y))},V=S===U.Right&&!j||S===U.Left&&!R,B=S===U.Down&&!I||S===U.Up&&!w;if(V&&L.x!==f.x){const O=m.scrollLeft+b.x,H=S===U.Right&&O<=$.x||S===U.Left&&O>=M.x;if(H&&!b.y){m.scrollTo({left:O,behavior:l});return}H?v.x=m.scrollLeft-O:v.x=S===U.Right?m.scrollLeft-$.x:m.scrollLeft-M.x,v.x&&m.scrollBy({left:-v.x,behavior:l});break}else if(B&&L.y!==f.y){const O=m.scrollTop+b.y,H=S===U.Down&&O<=$.y||S===U.Up&&O>=M.y;if(H&&!b.x){m.scrollTo({top:O,behavior:l});return}H?v.y=m.scrollTop-O:v.y=S===U.Down?m.scrollTop-$.y:m.scrollTop-M.y,v.y&&m.scrollBy({top:-v.y,behavior:l});break}}this.handleMove(t,$e(bt(f,this.referenceCoordinates),v))}}}handleMove(t,n){const{onMove:r}=this.props;t.preventDefault(),r(n)}handleEnd(t){const{onEnd:n}=this.props;t.preventDefault(),this.detach(),n()}handleCancel(t){const{onCancel:n}=this.props;t.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}lr.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:r=cr,onActivation:o}=t,{active:s}=n;const{code:c}=e.nativeEvent;if(r.start.includes(c)){const l=s.activatorNode.current;return l&&e.target!==l?!1:(e.preventDefault(),o?.({event:e.nativeEvent}),!0)}return!1}}];function En(e){return!!(e&&"distance"in e)}function Tn(e){return!!(e&&"delay"in e)}class cn{constructor(t,n,r){var o;r===void 0&&(r=Fo(t.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=t,this.events=n;const{event:s}=t,{target:c}=s;this.props=t,this.events=n,this.document=Le(c),this.documentListeners=new Xe(this.document),this.listeners=new Xe(r),this.windowListeners=new Xe(ae(c)),this.initialCoordinates=(o=Ut(s))!=null?o:pe,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:t,props:{options:{activationConstraint:n,bypassActivationConstraint:r}}}=this;if(this.listeners.add(t.move.name,this.handleMove,{passive:!1}),this.listeners.add(t.end.name,this.handleEnd),t.cancel&&this.listeners.add(t.cancel.name,this.handleCancel),this.windowListeners.add(fe.Resize,this.handleCancel),this.windowListeners.add(fe.DragStart,Rn),this.windowListeners.add(fe.VisibilityChange,this.handleCancel),this.windowListeners.add(fe.ContextMenu,Rn),this.documentListeners.add(fe.Keydown,this.handleKeydown),n){if(r!=null&&r({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(Tn(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(En(n)){this.handlePending(n);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(t,n){const{active:r,onPending:o}=this.props;o(r,t,this.initialCoordinates,n)}handleStart(){const{initialCoordinates:t}=this,{onStart:n}=this.props;t&&(this.activated=!0,this.documentListeners.add(fe.Click,Bo,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(fe.SelectionChange,this.removeTextSelection),n(t))}handleMove(t){var n;const{activated:r,initialCoordinates:o,props:s}=this,{onMove:c,options:{activationConstraint:l}}=s;if(!o)return;const u=(n=Ut(t))!=null?n:pe,d=bt(o,u);if(!r&&l){if(En(l)){if(l.tolerance!=null&&Lt(d,l.tolerance))return this.handleCancel();if(Lt(d,l.distance))return this.handleStart()}if(Tn(l)&&Lt(d,l.tolerance))return this.handleCancel();this.handlePending(l,d);return}t.cancelable&&t.preventDefault(),c(u)}handleEnd(){const{onAbort:t,onEnd:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleCancel(){const{onAbort:t,onCancel:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleKeydown(t){t.code===U.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const Ho={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class ln extends cn{constructor(t){const{event:n}=t,r=Le(n.target);super(t,Ho,r)}}ln.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 Vo={move:{name:"mousemove"},end:{name:"mouseup"}};var Xt;(function(e){e[e.RightClick=2]="RightClick"})(Xt||(Xt={}));class Wo extends cn{constructor(t){super(t,Vo,Le(t.event.target))}}Wo.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===Xt.RightClick?!1:(r?.({event:n}),!0)}}];const Pt={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class Uo extends cn{constructor(t){super(t,Pt)}static setup(){return window.addEventListener(Pt.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(Pt.move.name,t)};function t(){}}}Uo.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 qe;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(qe||(qe={}));var St;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(St||(St={}));function Go(e){let{acceleration:t,activator:n=qe.Pointer,canScroll:r,draggingRect:o,enabled:s,interval:c=5,order:l=St.TreeOrder,pointerCoordinates:u,scrollableAncestors:d,scrollableAncestorRects:g,delta:f,threshold:b}=e;const v=qo({delta:f,disabled:!s}),[p,m]=no(),S=h.useRef({x:0,y:0}),w=h.useRef({x:0,y:0}),j=h.useMemo(()=>{switch(n){case qe.Pointer:return u?{top:u.y,bottom:u.y,left:u.x,right:u.x}:null;case qe.DraggableRect:return o}},[n,o,u]),R=h.useRef(null),I=h.useCallback(()=>{const M=R.current;if(!M)return;const A=S.current.x*w.current.x,L=S.current.y*w.current.y;M.scrollBy(A,L)},[]),$=h.useMemo(()=>l===St.TreeOrder?[...d].reverse():d,[l,d]);h.useEffect(()=>{if(!s||!d.length||!j){m();return}for(const M of $){if(r?.(M)===!1)continue;const A=d.indexOf(M),L=g[A];if(!L)continue;const{direction:V,speed:B}=Io(M,L,j,t,b);for(const O of["x","y"])v[O][V[O]]||(B[O]=0,V[O]=0);if(B.x>0||B.y>0){m(),R.current=M,p(I,c),S.current=B,w.current=V;return}}S.current={x:0,y:0},w.current={x:0,y:0},m()},[t,I,r,m,s,c,JSON.stringify(j),JSON.stringify(v),p,d,$,g,JSON.stringify(b)])}const Xo={x:{[ee.Backward]:!1,[ee.Forward]:!1},y:{[ee.Backward]:!1,[ee.Forward]:!1}};function qo(e){let{delta:t,disabled:n}=e;const r=Wt(t);return tt(o=>{if(n||!r||!o)return Xo;const s={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[ee.Backward]:o.x[ee.Backward]||s.x===-1,[ee.Forward]:o.x[ee.Forward]||s.x===1},y:{[ee.Backward]:o.y[ee.Backward]||s.y===-1,[ee.Forward]:o.y[ee.Forward]||s.y===1}}},[n,t,r])}function Ko(e,t){const n=t!=null?e.get(t):void 0,r=n?n.node.current:null;return tt(o=>{var s;return t==null?null:(s=r??o)!=null?s:null},[r,t])}function Jo(e,t){return h.useMemo(()=>e.reduce((n,r)=>{const{sensor:o}=r,s=o.activators.map(c=>({eventName:c.eventName,handler:t(c.handler,r)}));return[...n,...s]},[]),[e,t])}var Ze;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(Ze||(Ze={}));var qt;(function(e){e.Optimized="optimized"})(qt||(qt={}));const Mn=new Map;function Zo(e,t){let{dragging:n,dependencies:r,config:o}=t;const[s,c]=h.useState(null),{frequency:l,measure:u,strategy:d}=o,g=h.useRef(e),f=S(),b=Je(f),v=h.useCallback(function(w){w===void 0&&(w=[]),!b.current&&c(j=>j===null?w:j.concat(w.filter(R=>!j.includes(R))))},[b]),p=h.useRef(null),m=tt(w=>{if(f&&!n)return Mn;if(!w||w===Mn||g.current!==e||s!=null){const j=new Map;for(let R of e){if(!R)continue;if(s&&s.length>0&&!s.includes(R.id)&&R.rect.current){j.set(R.id,R.rect.current);continue}const I=R.node.current,$=I?new an(u(I),I):null;R.rect.current=$,$&&j.set(R.id,$)}return j}return w},[e,s,n,f,u]);return h.useEffect(()=>{g.current=e},[e]),h.useEffect(()=>{f||v()},[n,f]),h.useEffect(()=>{s&&s.length>0&&c(null)},[JSON.stringify(s)]),h.useEffect(()=>{f||typeof l!="number"||p.current!==null||(p.current=setTimeout(()=>{v(),p.current=null},l))},[l,f,v,...r]),{droppableRects:m,measureDroppableContainers:v,measuringScheduled:s!=null};function S(){switch(d){case Ze.Always:return!1;case Ze.BeforeDragging:return n;default:return!n}}}function ur(e,t){return tt(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function Qo(e,t){return ur(e,t)}function es(e){let{callback:t,disabled:n}=e;const r=rn(t),o=h.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:s}=window;return new s(r)},[r,n]);return h.useEffect(()=>()=>o?.disconnect(),[o]),o}function jt(e){let{callback:t,disabled:n}=e;const r=rn(t),o=h.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:s}=window;return new s(r)},[n]);return h.useEffect(()=>()=>o?.disconnect(),[o]),o}function ts(e){return new an(Pe(e),e)}function _n(e,t,n){t===void 0&&(t=ts);const[r,o]=h.useState(null);function s(){o(u=>{if(!e)return null;if(e.isConnected===!1){var d;return(d=u??n)!=null?d:null}const g=t(e);return JSON.stringify(u)===JSON.stringify(g)?u:g})}const c=es({callback(u){if(e)for(const d of u){const{type:g,target:f}=d;if(g==="childList"&&f instanceof HTMLElement&&f.contains(e)){s();break}}}}),l=jt({callback:s});return xe(()=>{s(),e?(l?.observe(e),c?.observe(document.body,{childList:!0,subtree:!0})):(l?.disconnect(),c?.disconnect())},[e]),r}function ns(e){const t=ur(e);return tr(e,t)}const On=[];function rs(e){const t=h.useRef(e),n=tt(r=>e?r&&r!==On&&e&&t.current&&e.parentNode===t.current.parentNode?r:sn(e):On,[e]);return h.useEffect(()=>{t.current=e},[e]),n}function os(e){const[t,n]=h.useState(null),r=h.useRef(e),o=h.useCallback(s=>{const c=At(s.target);c&&n(l=>l?(l.set(c,Gt(c)),new Map(l)):null)},[]);return h.useEffect(()=>{const s=r.current;if(e!==s){c(s);const l=e.map(u=>{const d=At(u);return d?(d.addEventListener("scroll",o,{passive:!0}),[d,Gt(d)]):null}).filter(u=>u!=null);n(l.length?new Map(l):null),r.current=e}return()=>{c(e),c(s)};function c(l){l.forEach(u=>{const d=At(u);d?.removeEventListener("scroll",o)})}},[o,e]),h.useMemo(()=>e.length?t?Array.from(t.values()).reduce((s,c)=>$e(s,c),pe):ar(e):pe,[e,t])}function kn(e,t){t===void 0&&(t=[]);const n=h.useRef(null);return h.useEffect(()=>{n.current=null},t),h.useEffect(()=>{const r=e!==pe;r&&!n.current&&(n.current=e),!r&&n.current&&(n.current=null)},[e]),n.current?bt(e,n.current):pe}function ss(e){h.useEffect(()=>{if(!Dt)return;const t=e.map(n=>{let{sensor:r}=n;return r.setup==null?void 0:r.setup()});return()=>{for(const n of t)n?.()}},e.map(t=>{let{sensor:n}=t;return n}))}function is(e,t){return h.useMemo(()=>e.reduce((n,r)=>{let{eventName:o,handler:s}=r;return n[o]=c=>{s(c,t)},n},{}),[e,t])}function dr(e){return h.useMemo(()=>e?_o(e):null,[e])}const $n=[];function as(e,t){t===void 0&&(t=Pe);const[n]=e,r=dr(n?ae(n):null),[o,s]=h.useState($n);function c(){s(()=>e.length?e.map(u=>sr(u)?r:new an(t(u),u)):$n)}const l=jt({callback:c});return xe(()=>{l?.disconnect(),c(),e.forEach(u=>l?.observe(u))},[e]),o}function cs(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return et(t)?t:e}function ls(e){let{measure:t}=e;const[n,r]=h.useState(null),o=h.useCallback(d=>{for(const{target:g}of d)if(et(g)){r(f=>{const b=t(g);return f?{...f,width:b.width,height:b.height}:b});break}},[t]),s=jt({callback:o}),c=h.useCallback(d=>{const g=cs(d);s?.disconnect(),g&&s?.observe(g),r(g?t(g):null)},[t,s]),[l,u]=xt(c);return h.useMemo(()=>({nodeRef:l,rect:n,setRef:u}),[n,l,u])}const us=[{sensor:ln,options:{}},{sensor:lr,options:{}}],ds={current:{}},ht={draggable:{measure:jn},droppable:{measure:jn,strategy:Ze.WhileDragging,frequency:qt.Optimized},dragOverlay:{measure:Pe}};class Ke 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 fs={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Ke,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:yt},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:ht,measureDroppableContainers:yt,windowRect:null,measuringScheduled:!1},hs={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:yt,draggableNodes:new Map,over:null,measureDroppableContainers:yt},Rt=h.createContext(hs),fr=h.createContext(fs);function gs(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Ke}}}function ps(e,t){switch(t.type){case Q.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case Q.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 Q.DragEnd:case Q.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case Q.RegisterDroppable:{const{element:n}=t,{id:r}=n,o=new Ke(e.droppable.containers);return o.set(r,n),{...e,droppable:{...e.droppable,containers:o}}}case Q.SetDroppableDisabled:{const{id:n,key:r,disabled:o}=t,s=e.droppable.containers.get(n);if(!s||r!==s.key)return e;const c=new Ke(e.droppable.containers);return c.set(n,{...s,disabled:o}),{...e,droppable:{...e.droppable,containers:c}}}case Q.UnregisterDroppable:{const{id:n,key:r}=t,o=e.droppable.containers.get(n);if(!o||r!==o.key)return e;const s=new Ke(e.droppable.containers);return s.delete(n),{...e,droppable:{...e.droppable,containers:s}}}default:return e}}function vs(e){let{disabled:t}=e;const{active:n,activatorEvent:r,draggableNodes:o}=h.useContext(Rt),s=Wt(r),c=Wt(n?.id);return h.useEffect(()=>{if(!t&&!r&&s&&c!=null){if(!on(s)||document.activeElement===s.target)return;const l=o.get(c);if(!l)return;const{activatorNode:u,node:d}=l;if(!u.current&&!d.current)return;requestAnimationFrame(()=>{for(const g of[u.current,d.current]){if(!g)continue;const f=so(g);if(f){f.focus();break}}})}},[r,t,o,c,s]),null}function ms(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((o,s)=>s({transform:o,...r}),n):n}function xs(e){return h.useMemo(()=>({draggable:{...ht.draggable,...e?.draggable},droppable:{...ht.droppable,...e?.droppable},dragOverlay:{...ht.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function bs(e){let{activeNode:t,measure:n,initialRect:r,config:o=!0}=e;const s=h.useRef(!1),{x:c,y:l}=typeof o=="boolean"?{x:o,y:o}:o;xe(()=>{if(!c&&!l||!t){s.current=!1;return}if(s.current||!r)return;const d=t?.node.current;if(!d||d.isConnected===!1)return;const g=n(d),f=tr(g,r);if(c||(f.x=0),l||(f.y=0),s.current=!0,Math.abs(f.x)>0||Math.abs(f.y)>0){const b=nr(d);b&&b.scrollBy({top:f.y,left:f.x})}},[t,c,l,r,n])}const hr=h.createContext({...pe,scaleX:1,scaleY:1});var Re;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(Re||(Re={}));const gr=h.memo(function(t){var n,r,o,s;let{id:c,accessibility:l,autoScroll:u=!0,children:d,sensors:g=us,collisionDetection:f=Co,measuring:b,modifiers:v,...p}=t;const m=h.useReducer(ps,void 0,gs),[S,w]=m,[j,R]=fo(),[I,$]=h.useState(Re.Uninitialized),M=I===Re.Initialized,{draggable:{active:A,nodes:L,translate:V},droppable:{containers:B}}=S,O=A!=null?L.get(A):null,H=h.useRef({initial:null,translated:null}),G=h.useMemo(()=>{var oe;return A!=null?{id:A,data:(oe=O?.data)!=null?oe:ds,rect:H}:null},[A,O]),k=h.useRef(null),[E,C]=h.useState(null),[_,D]=h.useState(null),P=Je(p,Object.values(p)),z=nt("DndDescribedBy",c),x=h.useMemo(()=>B.getEnabled(),[B]),T=xs(b),{droppableRects:N,measureDroppableContainers:Y,measuringScheduled:X}=Zo(x,{dragging:M,dependencies:[V.x,V.y],config:T.droppable}),q=Ko(L,A),W=h.useMemo(()=>_?Ut(_):null,[_]),K=Jr(),J=Qo(q,T.draggable.measure);bs({activeNode:A!=null?L.get(A):null,config:K.layoutShiftCompensation,initialRect:J,measure:T.draggable.measure});const F=_n(q,T.draggable.measure,J),ie=_n(q?q.parentElement:null),re=h.useRef({activatorEvent:null,active:null,activeNode:q,collisionRect:null,collisions:null,droppableRects:N,draggableNodes:L,draggingNode:null,draggingNodeRect:null,droppableContainers:B,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),he=B.getNodeFor((n=re.current.over)==null?void 0:n.id),be=ls({measure:T.dragOverlay.measure}),Te=(r=be.nodeRef.current)!=null?r:q,Me=M?(o=be.rect)!=null?o:F:null,fn=!!(be.nodeRef.current&&be.rect),hn=ns(fn?null:F),Ot=dr(Te?ae(Te):null),Se=rs(M?he??q:null),ot=as(Se),st=ms(v,{transform:{x:V.x-hn.x,y:V.y-hn.y,scaleX:1,scaleY:1},activatorEvent:_,active:G,activeNodeRect:F,containerNodeRect:ie,draggingNodeRect:Me,over:re.current.over,overlayNodeRect:be.rect,scrollableAncestors:Se,scrollableAncestorRects:ot,windowRect:Ot}),gn=W?$e(W,V):null,pn=os(Se),Vr=kn(pn),Wr=kn(pn,[F]),_e=$e(st,Vr),Oe=Me?Ro(Me,st):null,ze=G&&Oe?f({active:G,collisionRect:Oe,droppableRects:N,droppableContainers:x,pointerCoordinates:gn}):null,vn=So(ze,"id"),[we,mn]=h.useState(null),Ur=fn?st:$e(st,Wr),Gr=Do(Ur,(s=we?.rect)!=null?s:null,F),kt=h.useRef(null),xn=h.useCallback((oe,ce)=>{let{sensor:le,options:Ce}=ce;if(k.current==null)return;const de=L.get(k.current);if(!de)return;const ue=oe.nativeEvent,ve=new le({active:k.current,activeNode:de,event:ue,options:Ce,context:re,onAbort(te){if(!L.get(te))return;const{onDragAbort:me}=P.current,ye={id:te};me?.(ye),j({type:"onDragAbort",event:ye})},onPending(te,De,me,ye){if(!L.get(te))return;const{onDragPending:Be}=P.current,je={id:te,constraint:De,initialCoordinates:me,offset:ye};Be?.(je),j({type:"onDragPending",event:je})},onStart(te){const De=k.current;if(De==null)return;const me=L.get(De);if(!me)return;const{onDragStart:ye}=P.current,Fe={activatorEvent:ue,active:{id:De,data:me.data,rect:H}};Ge.unstable_batchedUpdates(()=>{ye?.(Fe),$(Re.Initializing),w({type:Q.DragStart,initialCoordinates:te,active:De}),j({type:"onDragStart",event:Fe}),C(kt.current),D(ue)})},onMove(te){w({type:Q.DragMove,coordinates:te})},onEnd:ke(Q.DragEnd),onCancel:ke(Q.DragCancel)});kt.current=ve;function ke(te){return async function(){const{active:me,collisions:ye,over:Fe,scrollAdjustedTranslate:Be}=re.current;let je=null;if(me&&Be){const{cancelDrop:Ye}=P.current;je={activatorEvent:ue,active:me,collisions:ye,delta:Be,over:Fe},te===Q.DragEnd&&typeof Ye=="function"&&await Promise.resolve(Ye(je))&&(te=Q.DragCancel)}k.current=null,Ge.unstable_batchedUpdates(()=>{w({type:te}),$(Re.Uninitialized),mn(null),C(null),D(null),kt.current=null;const Ye=te===Q.DragEnd?"onDragEnd":"onDragCancel";if(je){const $t=P.current[Ye];$t?.(je),j({type:Ye,event:je})}})}}},[L]),Xr=h.useCallback((oe,ce)=>(le,Ce)=>{const de=le.nativeEvent,ue=L.get(Ce);if(k.current!==null||!ue||de.dndKit||de.defaultPrevented)return;const ve={active:ue};oe(le,ce.options,ve)===!0&&(de.dndKit={capturedBy:ce.sensor},k.current=Ce,xn(le,ce))},[L,xn]),bn=Jo(g,Xr);ss(g),xe(()=>{F&&I===Re.Initializing&&$(Re.Initialized)},[F,I]),h.useEffect(()=>{const{onDragMove:oe}=P.current,{active:ce,activatorEvent:le,collisions:Ce,over:de}=re.current;if(!ce||!le)return;const ue={active:ce,activatorEvent:le,collisions:Ce,delta:{x:_e.x,y:_e.y},over:de};Ge.unstable_batchedUpdates(()=>{oe?.(ue),j({type:"onDragMove",event:ue})})},[_e.x,_e.y]),h.useEffect(()=>{const{active:oe,activatorEvent:ce,collisions:le,droppableContainers:Ce,scrollAdjustedTranslate:de}=re.current;if(!oe||k.current==null||!ce||!de)return;const{onDragOver:ue}=P.current,ve=Ce.get(vn),ke=ve&&ve.rect.current?{id:ve.id,rect:ve.rect.current,data:ve.data,disabled:ve.disabled}:null,te={active:oe,activatorEvent:ce,collisions:le,delta:{x:de.x,y:de.y},over:ke};Ge.unstable_batchedUpdates(()=>{mn(ke),ue?.(te),j({type:"onDragOver",event:te})})},[vn]),xe(()=>{re.current={activatorEvent:_,active:G,activeNode:q,collisionRect:Oe,collisions:ze,droppableRects:N,draggableNodes:L,draggingNode:Te,draggingNodeRect:Me,droppableContainers:B,over:we,scrollableAncestors:Se,scrollAdjustedTranslate:_e},H.current={initial:Me,translated:Oe}},[G,q,ze,Oe,L,Te,Me,N,B,we,Se,_e]),Go({...K,delta:V,draggingRect:Oe,pointerCoordinates:gn,scrollableAncestors:Se,scrollableAncestorRects:ot});const qr=h.useMemo(()=>({active:G,activeNode:q,activeNodeRect:F,activatorEvent:_,collisions:ze,containerNodeRect:ie,dragOverlay:be,draggableNodes:L,droppableContainers:B,droppableRects:N,over:we,measureDroppableContainers:Y,scrollableAncestors:Se,scrollableAncestorRects:ot,measuringConfiguration:T,measuringScheduled:X,windowRect:Ot}),[G,q,F,_,ze,ie,be,L,B,N,we,Y,Se,ot,T,X,Ot]),Kr=h.useMemo(()=>({activatorEvent:_,activators:bn,active:G,activeNodeRect:F,ariaDescribedById:{draggable:z},dispatch:w,draggableNodes:L,over:we,measureDroppableContainers:Y}),[_,bn,G,F,w,z,L,we,Y]);return h.createElement(Qn.Provider,{value:R},h.createElement(Rt.Provider,{value:Kr},h.createElement(fr.Provider,{value:qr},h.createElement(hr.Provider,{value:Gr},d)),h.createElement(vs,{disabled:l?.restoreFocus===!1})),h.createElement(po,{...l,hiddenTextDescribedById:z}));function Jr(){const oe=E?.autoScrollEnabled===!1,ce=typeof u=="object"?u.enabled===!1:u===!1,le=M&&!oe&&!ce;return typeof u=="object"?{...u,enabled:le}:{enabled:le}}}),ys=h.createContext(null),In="button",Ss="Draggable";function ws(e){let{id:t,data:n,disabled:r=!1,attributes:o}=e;const s=nt(Ss),{activators:c,activatorEvent:l,active:u,activeNodeRect:d,ariaDescribedById:g,draggableNodes:f,over:b}=h.useContext(Rt),{role:v=In,roleDescription:p="draggable",tabIndex:m=0}=o??{},S=u?.id===t,w=h.useContext(S?hr:ys),[j,R]=xt(),[I,$]=xt(),M=is(c,t),A=Je(n);xe(()=>(f.set(t,{id:t,key:s,node:j,activatorNode:I,data:A}),()=>{const V=f.get(t);V&&V.key===s&&f.delete(t)}),[f,t]);const L=h.useMemo(()=>({role:v,tabIndex:m,"aria-disabled":r,"aria-pressed":S&&v===In?!0:void 0,"aria-roledescription":p,"aria-describedby":g.draggable}),[r,v,m,S,p,g.draggable]);return{active:u,activatorEvent:l,activeNodeRect:d,attributes:L,isDragging:S,listeners:r?void 0:M,node:j,over:b,setNodeRef:R,setActivatorNodeRef:$,transform:w}}function Cs(){return h.useContext(fr)}const Ds="Droppable",js={timeout:25};function Rs(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:o}=e;const s=nt(Ds),{active:c,dispatch:l,over:u,measureDroppableContainers:d}=h.useContext(Rt),g=h.useRef({disabled:n}),f=h.useRef(!1),b=h.useRef(null),v=h.useRef(null),{disabled:p,updateMeasurementsFor:m,timeout:S}={...js,...o},w=Je(m??r),j=h.useCallback(()=>{if(!f.current){f.current=!0;return}v.current!=null&&clearTimeout(v.current),v.current=setTimeout(()=>{d(Array.isArray(w.current)?w.current:[w.current]),v.current=null},S)},[S]),R=jt({callback:j,disabled:p||!c}),I=h.useCallback((L,V)=>{R&&(V&&(R.unobserve(V),f.current=!1),L&&R.observe(L))},[R]),[$,M]=xt(I),A=Je(t);return h.useEffect(()=>{!R||!$.current||(R.disconnect(),f.current=!1,R.observe($.current))},[$,R]),h.useEffect(()=>(l({type:Q.RegisterDroppable,element:{id:r,key:s,disabled:n,node:$,rect:b,data:A}}),()=>l({type:Q.UnregisterDroppable,key:s,id:r})),[r]),h.useEffect(()=>{n!==g.current.disabled&&(l({type:Q.SetDroppableDisabled,id:r,key:s,disabled:n}),g.current.disabled=n)},[r,s,n,l]),{active:c,rect:b,isOver:u?.id===r,node:$,over:u,setNodeRef:M}}function Et(e,t,n){const r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function Es(e,t){return e.reduce((n,r,o)=>{const s=t.get(r);return s&&(n[o]=s),n},Array(e.length))}function at(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 Ms(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const ct={scaleX:1,scaleY:1},_s=e=>{var t;let{rects:n,activeNodeRect:r,activeIndex:o,overIndex:s,index:c}=e;const l=(t=n[o])!=null?t:r;if(!l)return null;const u=Os(n,c,o);if(c===o){const d=n[s];return d?{x:o<s?d.left+d.width-(l.left+l.width):d.left-l.left,y:0,...ct}:null}return c>o&&c<=s?{x:-l.width-u,y:0,...ct}:c<o&&c>=s?{x:l.width+u,y:0,...ct}:{x:0,y:0,...ct}};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 pr=e=>{let{rects:t,activeIndex:n,overIndex:r,index:o}=e;const s=Et(t,r,n),c=t[o],l=s[o];return!l||!c?null:{x:l.left-c.left,y:l.top-c.top,scaleX:l.width/c.width,scaleY:l.height/c.height}},lt={scaleX:1,scaleY:1},ks=e=>{var t;let{activeIndex:n,activeNodeRect:r,index:o,rects:s,overIndex:c}=e;const l=(t=s[n])!=null?t:r;if(!l)return null;if(o===n){const d=s[c];return d?{x:0,y:n<c?d.top+d.height-(l.top+l.height):d.top-l.top,...lt}:null}const u=$s(s,o,n);return o>n&&o<=c?{x:0,y:-l.height-u,...lt}:o<n&&o>=c?{x:0,y:l.height+u,...lt}:{x:0,y:0,...lt}};function $s(e,t,n){const r=e[t],o=e[t-1],s=e[t+1];return r?n<t?o?r.top-(o.top+o.height):s?s.top-(r.top+r.height):0:s?s.top-(r.top+r.height):o?r.top-(o.top+o.height):0:0}const vr="Sortable",mr=h.createContext({activeIndex:-1,containerId:vr,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:pr,disabled:{draggable:!1,droppable:!1}});function xr(e){let{children:t,id:n,items:r,strategy:o=pr,disabled:s=!1}=e;const{active:c,dragOverlay:l,droppableRects:u,over:d,measureDroppableContainers:g}=Cs(),f=nt(vr,n),b=l.rect!==null,v=h.useMemo(()=>r.map(M=>typeof M=="object"&&"id"in M?M.id:M),[r]),p=c!=null,m=c?v.indexOf(c.id):-1,S=d?v.indexOf(d.id):-1,w=h.useRef(v),j=!Ts(v,w.current),R=S!==-1&&m===-1||j,I=Ms(s);xe(()=>{j&&p&&g(v)},[j,v,p,g]),h.useEffect(()=>{w.current=v},[v]);const $=h.useMemo(()=>({activeIndex:m,containerId:f,disabled:I,disableTransforms:R,items:v,overIndex:S,useDragOverlay:b,sortedRects:Es(v,u),strategy:o}),[m,f,I.draggable,I.droppable,R,v,S,u,b,o]);return h.createElement(mr.Provider,{value:$},t)}const Is=e=>{let{id:t,items:n,activeIndex:r,overIndex:o}=e;return Et(n,r,o).indexOf(t)},As=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:o,items:s,newIndex:c,previousItems:l,previousContainerId:u,transition:d}=e;return!d||!r||l!==s&&o===c?!1:n?!0:c!==o&&t===u},Ls={duration:200,easing:"ease"},br="transform",Ps=Ie.Transition.toString({property:br,duration:0,easing:"linear"}),Ns={roleDescription:"sortable"};function zs(e){let{disabled:t,index:n,node:r,rect:o}=e;const[s,c]=h.useState(null),l=h.useRef(n);return xe(()=>{if(!t&&n!==l.current&&r.current){const u=o.current;if(u){const d=Pe(r.current,{ignoreTransform:!0}),g={x:u.left-d.left,y:u.top-d.top,scaleX:u.width/d.width,scaleY:u.height/d.height};(g.x||g.y)&&c(g)}}n!==l.current&&(l.current=n)},[t,n,r,o]),h.useEffect(()=>{s&&c(null)},[s]),s}function yr(e){let{animateLayoutChanges:t=As,attributes:n,disabled:r,data:o,getNewIndex:s=Is,id:c,strategy:l,resizeObserverConfig:u,transition:d=Ls}=e;const{items:g,containerId:f,activeIndex:b,disabled:v,disableTransforms:p,sortedRects:m,overIndex:S,useDragOverlay:w,strategy:j}=h.useContext(mr),R=Fs(r,v),I=g.indexOf(c),$=h.useMemo(()=>({sortable:{containerId:f,index:I,items:g},...o}),[f,o,I,g]),M=h.useMemo(()=>g.slice(g.indexOf(c)),[g,c]),{rect:A,node:L,isOver:V,setNodeRef:B}=Rs({id:c,data:$,disabled:R.droppable,resizeObserverConfig:{updateMeasurementsFor:M,...u}}),{active:O,activatorEvent:H,activeNodeRect:G,attributes:k,setNodeRef:E,listeners:C,isDragging:_,over:D,setActivatorNodeRef:P,transform:z}=ws({id:c,data:$,attributes:{...Ns,...n},disabled:R.draggable}),x=to(B,E),T=!!O,N=T&&!p&&at(b)&&at(S),Y=!w&&_,X=Y&&N?z:null,W=N?X??(l??j)({rects:m,activeNodeRect:G,activeIndex:b,overIndex:S,index:I}):null,K=at(b)&&at(S)?s({id:c,items:g,activeIndex:b,overIndex:S}):I,J=O?.id,F=h.useRef({activeId:J,items:g,newIndex:K,containerId:f}),ie=g!==F.current.items,re=t({active:O,containerId:f,isDragging:_,isSorting:T,id:c,index:I,items:g,newIndex:F.current.newIndex,previousItems:F.current.items,previousContainerId:F.current.containerId,transition:d,wasDragging:F.current.activeId!=null}),he=zs({disabled:!re,index:I,node:L,rect:A});return h.useEffect(()=>{T&&F.current.newIndex!==K&&(F.current.newIndex=K),f!==F.current.containerId&&(F.current.containerId=f),g!==F.current.items&&(F.current.items=g)},[T,K,f,g]),h.useEffect(()=>{if(J===F.current.activeId)return;if(J!=null&&F.current.activeId==null){F.current.activeId=J;return}const Te=setTimeout(()=>{F.current.activeId=J},50);return()=>clearTimeout(Te)},[J]),{active:O,activeIndex:b,attributes:k,data:$,rect:A,index:I,newIndex:K,items:g,isOver:V,isSorting:T,isDragging:_,listeners:C,node:L,overIndex:S,over:D,setNodeRef:x,setActivatorNodeRef:P,setDroppableNodeRef:B,setDraggableNodeRef:E,transform:he??W,transition:be()};function be(){if(he||ie&&F.current.newIndex===I)return Ps;if(!(Y&&!on(H)||!d)&&(T||re))return Ie.Transition.toString({...d,property:br})}}function Fs(e,t){var n,r;return typeof e=="boolean"?{draggable:e,droppable:!1}:{draggable:(n=e?.draggable)!=null?n:t.draggable,droppable:(r=e?.droppable)!=null?r:t.droppable}}U.Down,U.Right,U.Up,U.Left;var ut={exports:{}},Nt={},dt={exports:{}},zt={};var An;function Bs(){if(An)return zt;An=1;var e=h;function t(f,b){return f===b&&(f!==0||1/f===1/b)||f!==f&&b!==b}var n=typeof Object.is=="function"?Object.is:t,r=e.useState,o=e.useEffect,s=e.useLayoutEffect,c=e.useDebugValue;function l(f,b){var v=b(),p=r({inst:{value:v,getSnapshot:b}}),m=p[0].inst,S=p[1];return s(function(){m.value=v,m.getSnapshot=b,u(m)&&S({inst:m})},[f,v,b]),o(function(){return u(m)&&S({inst:m}),f(function(){u(m)&&S({inst:m})})},[f]),c(v),v}function u(f){var b=f.getSnapshot;f=f.value;try{var v=b();return!n(f,v)}catch{return!0}}function d(f,b){return b()}var g=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?d:l;return zt.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:g,zt}var Ft={};var Ln;function Ys(){return Ln||(Ln=1,process.env.NODE_ENV!=="production"&&(function(){function e(v,p){return v===p&&(v!==0||1/v===1/p)||v!==v&&p!==p}function t(v,p){g||o.startTransition===void 0||(g=!0,console.error("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));var m=p();if(!f){var S=p();s(m,S)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),f=!0)}S=c({inst:{value:m,getSnapshot:p}});var w=S[0].inst,j=S[1];return u(function(){w.value=m,w.getSnapshot=p,n(w)&&j({inst:w})},[v,m,p]),l(function(){return n(w)&&j({inst:w}),v(function(){n(w)&&j({inst:w})})},[v]),d(m),m}function n(v){var p=v.getSnapshot;v=v.value;try{var m=p();return!s(v,m)}catch{return!0}}function r(v,p){return p()}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var o=h,s=typeof Object.is=="function"?Object.is:e,c=o.useState,l=o.useEffect,u=o.useLayoutEffect,d=o.useDebugValue,g=!1,f=!1,b=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?r:t;Ft.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())})()),Ft}var Pn;function Sr(){return Pn||(Pn=1,process.env.NODE_ENV==="production"?dt.exports=Bs():dt.exports=Ys()),dt.exports}var Nn;function Hs(){if(Nn)return Nt;Nn=1;var e=h,t=Sr();function n(d,g){return d===g&&(d!==0||1/d===1/g)||d!==d&&g!==g}var r=typeof Object.is=="function"?Object.is:n,o=t.useSyncExternalStore,s=e.useRef,c=e.useEffect,l=e.useMemo,u=e.useDebugValue;return Nt.useSyncExternalStoreWithSelector=function(d,g,f,b,v){var p=s(null);if(p.current===null){var m={hasValue:!1,value:null};p.current=m}else m=p.current;p=l(function(){function w(M){if(!j){if(j=!0,R=M,M=b(M),v!==void 0&&m.hasValue){var A=m.value;if(v(A,M))return I=A}return I=M}if(A=I,r(R,M))return A;var L=b(M);return v!==void 0&&v(A,L)?(R=M,A):(R=M,I=L)}var j=!1,R,I,$=f===void 0?null:f;return[function(){return w(g())},$===null?void 0:function(){return w($())}]},[g,f,b,v]);var S=o(d,p[0],p[1]);return c(function(){m.hasValue=!0,m.value=S},[S]),u(S),S},Nt}var Bt={};var zn;function Vs(){return zn||(zn=1,process.env.NODE_ENV!=="production"&&(function(){function e(d,g){return d===g&&(d!==0||1/d===1/g)||d!==d&&g!==g}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var t=h,n=Sr(),r=typeof Object.is=="function"?Object.is:e,o=n.useSyncExternalStore,s=t.useRef,c=t.useEffect,l=t.useMemo,u=t.useDebugValue;Bt.useSyncExternalStoreWithSelector=function(d,g,f,b,v){var p=s(null);if(p.current===null){var m={hasValue:!1,value:null};p.current=m}else m=p.current;p=l(function(){function w(M){if(!j){if(j=!0,R=M,M=b(M),v!==void 0&&m.hasValue){var A=m.value;if(v(A,M))return I=A}return I=M}if(A=I,r(R,M))return A;var L=b(M);return v!==void 0&&v(A,L)?(R=M,A):(R=M,I=L)}var j=!1,R,I,$=f===void 0?null:f;return[function(){return w(g())},$===null?void 0:function(){return w($())}]},[g,f,b,v]);var S=o(d,p[0],p[1]);return c(function(){m.hasValue=!0,m.value=S},[S]),u(S),S},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()),Bt}var Fn;function Ws(){return Fn||(Fn=1,process.env.NODE_ENV==="production"?ut.exports=Hs():ut.exports=Vs()),ut.exports}var Us=Ws();const Kt=new WeakMap,Gs=new WeakMap,wt={current:[]};let Yt=!1;const ft=new Set,Bn=new Map;function wr(e){for(const t of e){if(wt.current.includes(t))continue;wt.current.push(t),t.recompute();const n=Gs.get(t);if(n)for(const r of n){const o=Kt.get(r);o?.length&&wr(o)}}}function Xs(e){const t={prevVal:e.prevState,currentVal:e.state};for(const n of e.listeners)n(t)}function qs(e){const t={prevVal:e.prevState,currentVal:e.state};for(const n of e.listeners)n(t)}function Ks(e){if(ft.add(e),!Yt)try{for(Yt=!0;ft.size>0;){const t=Array.from(ft);ft.clear();for(const n of t){const r=Bn.get(n)??n.prevState;n.prevState=r,Xs(n)}for(const n of t){const r=Kt.get(n);r&&(wt.current.push(n),wr(r))}for(const n of t){const r=Kt.get(n);if(r)for(const o of r)qs(o)}}}finally{Yt=!1,wt.current=[],Bn.clear()}}function Js(e){return typeof e=="function"}class Cr{constructor(t,n){this.listeners=new Set,this.subscribe=r=>{var o,s;this.listeners.add(r);const c=(s=(o=this.options)==null?void 0:o.onSubscribe)==null?void 0:s.call(o,r,this);return()=>{this.listeners.delete(r),c?.()}},this.prevState=t,this.state=t,this.options=n}setState(t){var n,r,o;this.prevState=this.state,(n=this.options)!=null&&n.updateFn?this.state=this.options.updateFn(this.prevState)(t):Js(t)?this.state=t(this.prevState):this.state=t,(o=(r=this.options)==null?void 0:r.onUpdate)==null||o.call(r),Ks(this)}}function Ne(e,t=r=>r,n={}){const r=n.equal??Zs;return Us.useSyncExternalStoreWithSelector(e.subscribe,()=>e.state,()=>e.state,t,r)}function Zs(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=Yn(e);if(n.length!==Yn(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 Yn(e){return Object.keys(e).concat(Object.getOwnPropertySymbols(e))}const ne=new Cr({tableId:"",sortColumn:null,sortDirection:"asc",visibility:{},columnOrder:[],columnWidths:{},data:[],sortableColumns:[],actionsConfig:{showActionColumn:!0,showColumnVisibilityMenu:!0,children:"Actions",width:"100px"}}),Tt=e=>`datatable:${e}:column-widths`;function Dr(e,t){const n=e[0]??{},o=(t&&t.length?t:Object.keys(n).map(f=>({id:f,label:f}))).filter(f=>Object.prototype.hasOwnProperty.call(n,f.id)),{tableId:s}=ne.state,c=JSON.parse(localStorage.getItem(Er(s))||"[]"),l=[...c.map(f=>o.find(b=>b.id===f)).filter(Boolean),...o.filter(f=>!c.includes(f.id))],u=JSON.parse(localStorage.getItem(Tr(s))||"{}"),d=l.reduce((f,b)=>(f[b.id]=u[b.id]??!0,f),{}),g=JSON.parse(localStorage.getItem(Tt(s))||"{}");ne.setState(f=>({...f,data:e,columnOrder:l,visibility:d,columnWidths:g,sortableColumns:l.map(b=>({id:b.id,label:b.label,sortable:!0,backgroundColor:b.backgroundColor}))}))}function jr(e){ne.setState(t=>({...t,tableId:e,sortColumn:null,sortDirection:"asc",columnOrder:[],visibility:{}}))}const Rr=e=>{ne.setState(t=>({...t,actionsConfig:e}))};function Qs(e,t){ne.setState(n=>{const r={...n.columnWidths,[e]:Math.max(60,t)};return localStorage.setItem(Tt(n.tableId),JSON.stringify(r)),{...n,columnWidths:r}})}const Er=e=>`table_column_order_v1:${e}`,Tr=e=>`table_column_visibility_v1:${e}`,ei=e=>{const{tableId:t}=ne.state;localStorage.setItem(Er(t),JSON.stringify(e.map(n=>n.id))),ne.setState(n=>({...n,columnOrder:e})),ne.setState(n=>({...n,columnOrder:e}))};function ti(e){ne.setState(t=>t.sortColumn===e?{...t,sortDirection:t.sortDirection==="asc"?"desc":"asc"}:{...t,sortColumn:e,sortDirection:"asc"})}const ni=e=>{ne.setState(t=>{const n={...t.visibility,[e]:!t.visibility[e]};return t.tableId&&localStorage.setItem(Tr(t.tableId),JSON.stringify(n)),{...t,visibility:n}})};function ri(e,t){ne.setState(n=>{const r={...n.columnWidths,[e]:Math.max(60,t)};return localStorage.setItem(Tt(n.tableId),JSON.stringify(r)),{...n,columnWidths:r}})}const oi=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),si=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,r)=>r?r.toUpperCase():n.toLowerCase()),Hn=e=>{const t=si(e);return t.charAt(0).toUpperCase()+t.slice(1)},Mr=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim(),ii=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0};var ai={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 ci=h.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:o="",children:s,iconNode:c,...l},u)=>h.createElement("svg",{ref:u,...ai,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:Mr("lucide",o),...!s&&!ii(l)&&{"aria-hidden":"true"},...l},[...c.map(([d,g])=>h.createElement(d,g)),...Array.isArray(s)?s:[s]]));const se=(e,t)=>{const n=h.forwardRef(({className:r,...o},s)=>h.createElement(ci,{ref:s,iconNode:t,className:Mr(`lucide-${oi(Hn(e))}`,`lucide-${e}`,r),...o}));return n.displayName=Hn(e),n};const li=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],ui=se("arrow-down",li);const di=[["path",{d:"m21 16-4 4-4-4",key:"f6ql7i"}],["path",{d:"M17 20V4",key:"1ejh1v"}],["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}]],fi=se("arrow-up-down",di);const hi=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],gi=se("arrow-up",hi);const pi=[["path",{d:"m19 21-7-4-7 4V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v16z",key:"1fy3hk"}]],vi=se("bookmark",pi);const mi=[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]],Vn=se("calendar",mi);const xi=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],bi=se("chevron-left",xi);const yi=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Si=se("chevron-right",yi);const wi=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 3v18",key:"108xh3"}]],Ci=se("columns-2",wi);const Di=[["path",{d:"M10 5a2 2 0 0 0-1.344.519l-6.328 5.74a1 1 0 0 0 0 1.481l6.328 5.741A2 2 0 0 0 10 19h10a2 2 0 0 0 2-2V7a2 2 0 0 0-2-2z",key:"1yo7s0"}],["path",{d:"m12 9 6 6",key:"anjzzh"}],["path",{d:"m18 9-6 6",key:"1fp51s"}]],ji=se("delete",Di);const Ri=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]],Ei=se("ellipsis",Ri);const Ti=[["path",{d:"M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z",key:"sc7q7i"}]],Mi=se("funnel",Ti);const _i=[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]],_r=se("grip-vertical",_i);const Oi=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]],ki=se("pen",Oi);const $i=[["path",{d:"M21 12a9 9 0 0 0-9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"14sxne"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M3 12a9 9 0 0 0 9 9 9.75 9.75 0 0 0 6.74-2.74L21 16",key:"1hlbsb"}],["path",{d:"M16 16h5v5",key:"ccwih5"}]],Ii=se("refresh-ccw",$i);const Ai=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],Li=se("settings",Ai);const Pi=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],Or=se("triangle-alert",Pi);function y(e){return h.forwardRef((t,n)=>{const{children:r,...o}=t;return i.jsx(e,{ref:n,...o,children:r})})}const Ni=y(a.Menu.Trigger),zi=y(a.Menu.Positioner),Fi=y(a.Menu.Content),Bi=y(a.Menu.Item),Yi=y(a.Checkbox.Label),Hi=y(a.Checkbox.HiddenInput),Vi=y(a.Checkbox.Control);function Wi({visibility:e,onToggle:t}){const{sortableColumns:n}=Ne(ne);return i.jsxs(a.Menu.Root,{closeOnSelect:!1,children:[i.jsx(Ni,{asChild:!0,children:i.jsx(a.IconButton,{"aria-label":"Toggle columns",variant:"ghost",ml:"1",size:"xs",children:i.jsx(Ci,{size:18})})}),i.jsx(a.Portal,{children:i.jsx(zi,{children:i.jsx(Fi,{minW:"220px",children:n.map(r=>{const o=!!e[r.id];return i.jsx(Bi,{value:r.id,closeOnSelect:!1,children:i.jsxs(a.Checkbox.Root,{checked:o,onCheckedChange:()=>t(r.id),children:[i.jsx(Hi,{}),i.jsx(Vi,{}),i.jsx(Yi,{children:r.label})]})},r.id)})})})})]})}function Ui({id:e,children:t,onClick:n,cursor:r,borderRight:o,backgroundColor:s}){const{columnWidths:c}=Ne(ne),l=c[e],u=h.useRef(0),d=h.useRef(0),{setNodeRef:g,attributes:f,listeners:b,transform:v,transition:p}=yr({id:e}),m=S=>{S.stopPropagation(),u.current=S.clientX,d.current=l??150;const w=R=>{ri(e,d.current+(R.clientX-u.current))},j=()=>{document.removeEventListener("mousemove",w),document.removeEventListener("mouseup",j)};document.addEventListener("mousemove",w),document.addEventListener("mouseup",j)};return i.jsx(a.Table.ColumnHeader,{ref:g,onClick:n,backgroundColor:s,w:l?`${l}px`:void 0,minW:"60px",style:{transform:Ie.Transform.toString(v),transition:p,cursor:r,borderRight:o},...f,children:i.jsxs(a.HStack,{position:"relative",children:[i.jsx("span",{...b,children:i.jsx(_r,{size:12})}),t,i.jsx(a.Box,{position:"absolute",right:0,top:0,h:"100%",w:"5px",cursor:"col-resize",background:"gray.200",onMouseDown:m,_hover:{bg:"gray.600"}})]})})}function Gi(){const{columnOrder:e,visibility:t,sortColumn:n,sortDirection:r,sortableColumns:o,actionsConfig:s}=Ne(ne),c=e.map(l=>o.find(u=>u.id===l.id)).filter(l=>l!==void 0).filter(l=>t[l.id]);return i.jsx(a.Table.Header,{background:"blue.200",position:"sticky",top:0,p:"0",zIndex:1,children:i.jsxs(a.Table.Row,{height:"28px",children:[s?.showSNo&&i.jsx(a.Table.ColumnHeader,{width:"60px",textAlign:"center",backgroundColor:s.backgroundColor,borderRight:"2px solid #dcdcdc",children:s.indexChildren||"S.No"}),c.map(l=>{const u=n===l?.id;return i.jsx(Ui,{id:l?.id,onClick:()=>l?.sortable&&ti(l?.id),cursor:l?.sortable?"pointer":"default",borderRight:"2px solid #dcdcdc",backgroundColor:l?.backgroundColor,children:i.jsxs("span",{style:{display:"flex",alignItems:"center",gap:6,userSelect:"none"},children:[l?.label,l?.sortable&&(u?r==="asc"?i.jsx(gi,{size:14}):i.jsx(ui,{size:14}):i.jsx(fi,{size:14,opacity:.4}))]})},l?.id)}),s?.showActionColumn&&i.jsx(a.Table.ColumnHeader,{width:s.width,backgroundColor:s.backgroundColor,borderRight:"2px solid #dcdcdc",children:s.children||"Actions"}),s?.showColumnVisibilityMenu&&i.jsx(a.Table.ColumnHeader,{boxSize:"0.5",backgroundColor:s.backgroundColorColumnVisibilityMenu,children:i.jsx(Wi,{visibility:t,onToggle:ni})})]})})}const Xi=[10,20,50,100],qi=y(a.Select.Positioner),Ki=y(a.Select.Content),Ji=y(a.Select.Item),Zi=y(a.Pagination.PrevTrigger),Qi=y(a.Pagination.NextTrigger),ea=y(a.Select.HiddenSelect),ta=y(a.Select.Control),na=y(a.Select.Trigger),ra=y(a.Select.ValueText),oa=y(a.Select.IndicatorGroup),sa=y(a.Select.Indicator);function ia({totalCount:e,pageSize:t,currentPage:n,onPageChange:r,onPageSizeChange:o,siblingCount:s=2,pageSizeOptions:c=Xi}){const l=a.createListCollection({items:c.map(u=>({label:String(u),value:String(u)}))});return i.jsx(a.Box,{width:"100%",children:i.jsxs(a.HStack,{justify:"space-between",mx:"auto",flexWrap:"wrap",children:[i.jsxs(a.HStack,{children:[i.jsx(a.Text,{fontSize:"sm",color:"gray.600",_dark:{color:"gray.400"},children:"Rows per page:"}),i.jsxs(a.Select.Root,{collection:l,size:"sm",width:"60px",onValueChange:u=>o?.(Number(u.items[0].value)),value:[String(t)],children:[i.jsx(ea,{}),i.jsxs(ta,{children:[i.jsx(na,{children:i.jsx(ra,{placeholder:""})}),i.jsx(oa,{children:i.jsx(sa,{})})]}),i.jsx(a.Portal,{children:i.jsx(qi,{children:i.jsx(Ki,{children:l.items.map(u=>i.jsxs(Ji,{item:u.value,children:[u.label,i.jsx(a.Select.ItemIndicator,{})]},u.value))})})})]}),i.jsxs(a.Text,{fontSize:"sm",color:"gray.600",_dark:{color:"gray.400"},children:["of ",e]})]}),i.jsx(a.Pagination.Root,{count:e,pageSize:t,page:n,siblingCount:s,onPageChange:u=>r&&r(u.page),children:i.jsxs(a.ButtonGroup,{size:"sm",variant:"ghost",children:[i.jsx(Zi,{asChild:!0,children:i.jsx(a.IconButton,{"aria-label":"Previous page",children:i.jsx(bi,{size:18})})}),i.jsx(a.Pagination.Items,{render:u=>i.jsx(a.IconButton,{variant:u.type==="page"&&u.value===n?"outline":"ghost","aria-current":u.type==="page"&&u.value===n?"page":void 0,children:u.type==="page"?u.value:"…"},u.value??u.type)}),i.jsx(Qi,{asChild:!0,children:i.jsx(a.IconButton,{"aria-label":"Next page",children:i.jsx(Si,{size:18})})})]})})]})})}const aa=y(a.Menu.Item),ca=y(a.Menu.Content),la=y(a.Menu.Positioner),ua=y(a.Menu.Trigger);function da({data:e=[],actions:t=[],actionConfig:n,onRowSelect:r,onRowSelectEvent:o="left",startIndex:s=0}){const{columnOrder:c,visibility:l,columnWidths:u}=Ne(ne);return i.jsx(a.Table.Body,{children:e.map((d,g)=>i.jsxs(a.Table.Row,{onClick:()=>o==="left"&&r?.(d.__raw),_hover:{bg:"blue.50"},onContextMenu:o==="right"?f=>{f.preventDefault(),r?.(d.__raw,f)}:void 0,children:[n?.showSNo&&i.jsx(a.Table.Cell,{textAlign:"center",fontWeight:"medium",children:s+g+1}),c.filter(f=>l[f.id]).map(f=>i.jsx(a.Table.Cell,{w:u[f.id]?u[f.id]+"px":void 0,children:d[f.id]},f.id)),n?.showActionColumn&&i.jsx(a.Table.Cell,{textAlign:"center",display:"flex",gap:2,children:i.jsxs(a.Menu.Root,{children:[i.jsx(ua,{asChild:!0,children:i.jsx(a.IconButton,{"aria-label":"Open",variant:"ghost",size:"sm",children:i.jsx(Ei,{size:16})})}),i.jsx(a.Portal,{children:i.jsx(la,{children:i.jsx(ca,{children:t.filter(f=>typeof f.visible=="function"?f.visible(d.__raw):f.visible!==!1).map(f=>i.jsxs(aa,{onClick:()=>f.onClick(d.__raw),colorScheme:f.colorScheme,value:f.label,children:[f.icon,f.label]},f.label))})})})]})}),n?.showColumnVisibilityMenu&&i.jsx(a.Table.Cell,{})]},d.__key||d.id))})}function fa({rows:e=6,columns:t}){return i.jsx(a.Table.Body,{children:Array.from({length:e}).map((n,r)=>i.jsx(a.Table.Row,{children:Array.from({length:t}).map((o,s)=>i.jsx(a.Table.Cell,{children:i.jsx(a.Skeleton,{height:"25px"})},s))},r))})}function ha({tableId:e,data:t=[],headers:n=[],loading:r=!1,loadingChildren:o,skeletonLoading:s=!1,emptyMessage:c="No data",actions:l,page:u=1,pageSize:d=10,onPageChange:g,onPageSizeChange:f,density:b="sm",totalCount:v=0,actionConfig:p,pageSizeOptions:m,onRowSelect:S,onRowSelectEvent:w="left"}){h.useEffect(()=>{jr(e)},[e]),h.useEffect(()=>{Dr(t,n)},[t,n]),h.useEffect(()=>{p&&Rr(p)},[p]);const{sortColumn:j,sortDirection:R,data:I,columnOrder:$}=Ne(ne),M=h.useMemo(()=>{const H=[...I];return j&&H.sort((G,k)=>R==="asc"?String(G[j]).localeCompare(String(k[j])):String(k[j]).localeCompare(String(G[j]))),H},[I,j,R,u,d]),A=h.useMemo(()=>(Math.max(1,u||1)-1)*d,[u,d]);h.useEffect(()=>{u<1&&g&&g(1)},[u,g]);const L=H=>{const{active:G,over:k}=H;if(!k||G.id===k.id)return;const E=$.findIndex(D=>D.id===G.id),C=$.findIndex(D=>D.id===k.id),_=Et($,E,C);ei(_)},V=r&&!s,B=s&&!r,O=!r&&!s&&M.length===0;return i.jsx(gr,{collisionDetection:er,onDragEnd:L,children:i.jsx(xr,{items:$.map(H=>H.id),strategy:_s,children:i.jsxs(a.Box,{flex:"1",minH:0,display:"flex",flexDirection:"column",p:2,children:[i.jsxs(a.Box,{flex:"1",minH:0,position:"relative",overflow:"auto",children:[V&&i.jsx(a.Box,{position:"absolute",inset:0,display:"flex",alignItems:"center",justifyContent:"center",zIndex:10,bg:"whiteAlpha.600",children:o??i.jsx(a.Spinner,{})}),i.jsxs(a.Table.Root,{variant:"outline",w:"100%",size:b,children:[i.jsx(Gi,{}),B?i.jsx(fa,{rows:d,columns:n.length+(l?2:0)}):O?i.jsx(a.Table.Body,{children:i.jsx(a.Table.Row,{children:i.jsx(a.Table.Cell,{colSpan:n.length+(l?1:0),children:i.jsx(a.Box,{display:"flex",alignItems:"center",justifyContent:"center",minH:"200px",color:"gray.500",children:c})})})}):i.jsx(da,{data:M,actions:l,actionConfig:p,onRowSelect:S,startIndex:A,onRowSelectEvent:w})]})]}),i.jsx(a.Box,{mt:.5,children:i.jsx(ia,{totalCount:v,pageSize:d,currentPage:u,onPageChange:g,onPageSizeChange:H=>{f?.(H),u>1&&g?.(1)},pageSizeOptions:m})})]})})})}const ga=y(a.Checkbox.Root),pa=y(a.Checkbox.HiddenInput),va=y(a.Checkbox.Control),ma=y(a.Checkbox.Label),kr=({value:e,onChange:t,size:n="sm",label:r,helperText:o,isDisabled:s,required:c,errorText:l})=>i.jsxs(ga,{value:e,onChange:t,size:n,children:[i.jsx(pa,{}),i.jsx(va,{disabled:s,required:c,errorText:l,helperText:o}),r&&i.jsx(ma,{children:r})]}),xa=y(a.Combobox.Root),ba=y(a.Combobox.Control),ya=y(a.Combobox.Input),Sa=y(a.Combobox.IndicatorGroup),wa=y(a.Combobox.ClearTrigger),Ca=y(a.Combobox.Trigger),Da=y(a.Combobox.Positioner),ja=y(a.Combobox.Content);function $r({label:e,size:t="sm",width:n="100%",variant:r="outline",items:o=[],itemToString:s,itemToValue:c,renderItem:l,value:u,loading:d,error:g,errorMessage:f,placeholder:b,helpText:v,onInputChange:p,onSelect:m,visible:S=!0,rootProps:w,inputProps:j,controlProps:R,contentProps:I,itemProps:$}){const[M,A]=h.useState(""),{collection:L,set:V}=a.useListCollection({initialItems:o,itemToString:s,itemToValue:c}),B=h.useMemo(()=>{if(!M)return o;const O=M.toLowerCase();return o.filter(H=>s(H).toLowerCase().includes(O))},[o,M,s]);return h.useEffect(()=>{V(B)},[B,V]),h.useEffect(()=>{u&&A(s(u))},[u,s]),i.jsxs(xa,{width:n,size:t,variant:r,collection:L,placeholder:b,onInputValueChange:O=>{p?.(O.inputValue),A(O.inputValue)},value:u?[c(u)]:[],onValueChange:O=>{const H=O.value?.[0];if(!H)return;const G=L.items.find(k=>c(k)===H);G&&m?.(G)},positioning:{sameWidth:!1,placement:"bottom-start"},...w,children:[S&&e&&i.jsx(a.Text,{fontSize:"sm",children:e}),i.jsxs(ba,{...R,children:[i.jsx(ya,{placeholder:b??"Type to search",...j}),i.jsxs(Sa,{children:[i.jsx(wa,{}),i.jsx(Ca,{})]})]}),i.jsx(Da,{children:i.jsxs(ja,{minW:"sm",...I,children:[d?i.jsxs(a.HStack,{p:"2",children:[i.jsx(a.Spinner,{size:"xs",borderWidth:"1px"}),i.jsx(a.Span,{children:"Loading..."})]}):g?i.jsx(a.Text,{p:"2",color:"red.500",fontSize:"sm",children:f||"Something went wrong"}):L.items.map(O=>i.jsxs(a.Combobox.Item,{item:O,...$,children:[l(O),i.jsx(a.Combobox.ItemIndicator,{})]},c(O))),v&&!g&&!d&&i.jsx(a.Text,{p:"2",color:"fg.muted",fontSize:"sm",children:v})]})})]})}const Z=" to ",Wn=10,Ee={DAY_MAX:31,MONTH_MAX:12,YEAR_MIN:1900,YEAR_MAX:2100},un=()=>{const e=new Date;return{year:e.getFullYear(),month:e.getMonth()+1,day:e.getDate()}},Un=()=>{const{year:e,month:t,day:n}=un();return`${String(n).padStart(2,"0")}-${String(t).padStart(2,"0")}-${e}`},Ra=()=>{const{year:e,month:t,day:n}=un();return`${e}-${String(t).padStart(2,"0")}-${String(n).padStart(2,"0")}`},Ea=(e,t)=>{const n=e.length,r=parseInt(e);if(!e||isNaN(r))return t;if(n===4)return r>=Ee.YEAR_MIN&&r<=Ee.YEAR_MAX?r:t;if(n>0&&n<4){const o=t.toString(),s=4-n,c=o.substring(0,s);return parseInt(c+e)}return t},We=e=>{if(!e?.trim())return null;const n=e.replace(/[^\d-]/g,"").split("-").filter(d=>d!=="");if(n.length===0)return null;const{year:r,month:o,day:s}=un();let c,l,u;return n.length===1?(c=parseInt(n[0])||s,l=o,u=r):n.length===2?(c=parseInt(n[0])||s,l=parseInt(n[1])||o,u=r):(c=parseInt(n[0])||s,l=parseInt(n[1])||o,u=Ea(n[2],r)),l=Math.max(1,Math.min(Ee.MONTH_MAX,l)),c=Math.max(1,Math.min(Ee.DAY_MAX,c)),`${u}-${String(l).padStart(2,"0")}-${String(c).padStart(2,"0")}`},ge=e=>{if(!e)return"";const[t,n,r]=e.split("-");return`${r}-${n}-${t}`},Ta=(e,t)=>{if(e[0]?.length>0){const n=parseInt(e[0]);if(isNaN(n)||n===0||e[0].length===2&&n>Ee.DAY_MAX)return t}if(e[1]?.length>0){const n=parseInt(e[1]);if(isNaN(n)||n===0||e[1].length===2&&n>Ee.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<Ee.YEAR_MIN||n>Ee.YEAR_MAX))return t}return null},Ue=e=>{let t=e.replace(/[^\d-]/g,"").substring(0,Wn);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,Wn),Ta(n,e)||t},Ma=y(a.Popover.Root),_a=y(a.Popover.Trigger),Oa=y(a.Popover.Content),ka=y(a.Popover.Positioner);function $a({value:e,onChange:t,disabled:n=!1}){const[r="",o=""]=e?e.split("|"):[],[s,c]=h.useState(()=>r&&o?`${ge(r)}${Z}${ge(o)}`:r?ge(r):""),[l,u]=h.useState(!1),d=h.useRef(null);h.useEffect(()=>{const p=m=>{m.ctrlKey&&m.key==="d"&&!m.shiftKey&&!m.metaKey&&(m.preventDefault(),d.current?.focus())};return window.addEventListener("keydown",p),()=>window.removeEventListener("keydown",p)},[]);const g=p=>{let m=p;if(m.includes(Z)){const[S,w=""]=m.split(Z);m=`${Ue(S.trim())}${Z}${Ue(w.trim())}`}else if(m.toLowerCase().includes(" to ")){const[S,w=""]=m.split(/\s+to\s+/i);m=`${Ue(S.trim())} to ${Ue(w.trim())}`}else m=Ue(m);c(m)},f=()=>{const p=s.trim();if(!p){t(void 0);return}if(p.includes(Z)){const[m,S=""]=p.split(Z).map(R=>R.trim()),w=We(m),j=S?We(S):null;if(w&&j){const[R,I]=j<w?[j,w]:[w,j],$=`${ge(R)}${Z}${ge(I)}`;c($),t(`${R}|${I}`)}else if(w&&!S)c(`${ge(w)}${Z}`),t(void 0);else if(w&&S){const R=Ra(),[I,$]=R<w?[R,w]:[w,R],M=`${ge(I)}${Z}${ge($)}`;c(M),t(`${I}|${$}`)}else c(""),t(void 0)}else{const m=We(p);m?(c(`${ge(m)}${Z}`),t(void 0)):(c(""),t(void 0))}},b=p=>{if(p.key!=="Enter")return;p.preventDefault();const m=d.current?.selectionStart||0,S=s.indexOf(Z);if(!s.trim()){c(`${Un()}${Z}`);return}if(S===-1){const j=We(s.trim());j&&c(`${ge(j)}${Z}`);return}if(m<=S+Z.length){const j=s.substring(0,S).trim(),R=s.substring(S+Z.length),I=We(j);I&&c(`${ge(I)}${Z}${R}`);return}if(s.substring(S+Z.length).trim())f(),d.current?.blur();else{const j=s.substring(0,S+Z.length)+Un();c(j),setTimeout(()=>{f(),d.current?.blur()},0)}},v=()=>{c(""),t(void 0)};return i.jsx(a.InputGroup,{children:i.jsx(i.Fragment,{children:i.jsxs(a.InputElement,{position:"revert",children:[i.jsxs(Ma,{open:l,onEscapeKeyDown:()=>{u(!1)},children:[i.jsx(_a,{asChild:!0,children:i.jsx(a.IconButton,{size:"sm",variant:"ghost","aria-label":"Date range help",onClick:()=>u(p=>!p),children:i.jsx(Vn,{size:16})})}),i.jsx(a.Portal,{children:i.jsx(ka,{children:i.jsxs(Oa,{p:4,children:[i.jsx(a.PopoverArrow,{}),i.jsxs(a.VStack,{align:"start",gap:4,children:[i.jsxs(a.HStack,{children:[i.jsx(Vn,{size:16}),i.jsx(a.Text,{fontWeight:"semibold",fontSize:"sm",children:"Date Range Filter"})]}),i.jsxs(a.VStack,{align:"start",gap:1,children:[i.jsx(a.Text,{fontSize:"sm",fontWeight:"medium",children:"Format:"}),i.jsxs(a.Text,{fontSize:"xs",color:"gray.600",children:["DD-MM-YYYY",Z,"DD-MM-YYYY"]})]}),i.jsxs(a.VStack,{align:"start",gap:1,children:[i.jsx(a.Text,{fontSize:"sm",fontWeight:"medium",children:"Tips:"}),i.jsx(a.Text,{fontSize:"xs",children:'• "15 to 20" → assumes current month/year'}),i.jsx(a.Text,{fontSize:"xs",children:"• Leave end blank → up to today"}),i.jsx(a.Text,{fontSize:"xs",children:"• Dates auto-swapped if reversed"}),i.jsx(a.Text,{fontSize:"xs",children:"• Press Enter on empty end → fills today"})]}),i.jsxs(a.VStack,{align:"start",gap:1,children:[i.jsx(a.Text,{fontSize:"sm",fontWeight:"medium",children:"Shortcut:"}),i.jsxs(a.HStack,{children:[i.jsx(a.Kbd,{children:"Ctrl"}),i.jsx(a.Text,{children:"+"}),i.jsx(a.Kbd,{children:"D"})]})]})]})]})})})]}),i.jsx(a.Input,{ref:d,placeholder:"15-06-2025 to 20-06-2025",value:s,size:"sm",disabled:n,onChange:p=>g(p.target.value),onBlur:f,onKeyDown:b,pr:s?"10":void 0,w:"100%"}),s&&i.jsx(a.InputElement,{children:i.jsx(a.IconButton,{size:"sm",variant:"ghost","aria-label":"Clear date range",onClick:v,w:"100%"})})]})})})}const Ia=y(a.Field.Root),Aa=y(a.Field.Label),La=y(a.Field.HelperText),Pa=y(a.Field.ErrorText),Jt=({icon:e,value:t,onChange:n,placeholder:r,size:o="xs",variant:s="outline",width:c="100%",label:l,helperText:u,isDisabled:d=!1,required:g=!1,errorText:f,visible:b,type:v="text",min:p=0,max:m=100,step:S=1})=>i.jsxs(Ia,{width:c,children:[b&&i.jsx(Aa,{children:l}),i.jsx(a.InputGroup,{startElement:e,children:i.jsx(a.Input,{value:t,onChange:w=>n?.(w.target.value),placeholder:r,size:o,type:v,variant:s,disabled:d,required:g,min:p,max:m,step:S})}),f&&i.jsx(Pa,{fontSize:"xs",children:f}),u&&i.jsx(La,{fontSize:"xs",children:u})]}),Na=y(a.Field.Root),za=y(a.Field.HelperText),Fa=y(a.Field.ErrorText),Ba=y(a.Select.Root),Ya=y(a.Select.Label),Ha=y(a.Select.Control),Va=y(a.Select.Trigger),Wa=y(a.Select.ValueText),Ua=y(a.Select.IndicatorGroup),Ga=y(a.Select.Indicator),Xa=y(a.Select.Content),qa=y(a.Select.Item),Ka=y(a.Select.ItemIndicator),Ja=y(a.Select.HiddenSelect),Za=y(a.Select.Positioner),Ir=({options:e=[],label:t,value:n,onChange:r,placeholder:o,size:s="xs",width:c="100%",variant:l="outline",helperText:u,isDisabled:d,required:g,errorText:f,visible:b})=>{const v=a.createListCollection({items:e});return i.jsxs(Na,{disabled:d,required:g,children:[i.jsxs(Ba,{collection:v,variant:l,size:s,width:c,value:n?[n]:[],onValueChange:p=>r?.(p.value[0]),children:[i.jsx(Ja,{}),b&&i.jsx(Ya,{children:t}),i.jsxs(Ha,{children:[i.jsx(Va,{children:i.jsx(Wa,{placeholder:o})}),i.jsx(Ua,{children:i.jsx(Ga,{})})]}),i.jsx(Za,{children:i.jsx(Xa,{children:v.items.map(p=>i.jsxs(qa,{item:p,children:[p.label,i.jsx(Ka,{})]},p.value))})})]}),u&&i.jsx(za,{children:u}),f&&i.jsx(Fa,{children:f})]})},Ar=(e="default")=>`FILTER_PRESETS_${e}`,Qa=e=>{if(!e)return[];try{return JSON.parse(e)}catch{return[]}},ec=e=>typeof window>"u"?[]:Qa(localStorage.getItem(Ar(e))),Qe=new Cr({}),rt=e=>{const t=Qe.state;if(e in t)return t[e];const n=ec(e);return Qe.setState(r=>({...r,[e]:n})),n},Mt=(e,t)=>{Qe.setState(n=>({...n,[e]:t})),typeof window<"u"&&localStorage.setItem(Ar(e),JSON.stringify(t))},Lr=(e,t)=>{const n=[t,...rt(e)];Mt(e,n)},Pr=(e,t)=>{const n=rt(e).filter(r=>r.id!==t);Mt(e,n)},tc=(e,t,n)=>{const r=rt(e).map(o=>o.id===t?n(o):o);Mt(e,r)},nc=y(a.Checkbox.Root),rc=y(a.Checkbox.HiddenInput),oc=y(a.Checkbox.Control),sc=y(a.Slider.Root),ic=y(a.Slider.Track),ac=y(a.Slider.Range),cc=y(a.Slider.Thumbs),lc=y(a.Slider.Control),uc=({filter:e,onVisibilityChange:t,onSizeChange:n})=>{const{attributes:r,listeners:o,setNodeRef:s,transform:c,transition:l}=yr({id:e.id}),u={transform:Ie.Transform.toString(c),transition:l};return i.jsxs(a.VStack,{ref:s,style:u,align:"stretch",border:"1px solid",borderColor:"gray.200",rounded:"md",p:3,mb:3,bg:"white",children:[i.jsxs(a.HStack,{...r,...o,cursor:"grab",userSelect:"none",gap:2,children:[i.jsx(_r,{size:16}),i.jsx(a.Text,{fontWeight:"bold",fontSize:"sm",children:e.label||e.id})]}),i.jsxs(a.HStack,{justify:"space-between",children:[i.jsx(a.Text,{fontSize:"sm",children:"Visible"}),i.jsxs(nc,{checked:e.visible,size:"sm",onCheckedChange:d=>t?.(e.id,!!d.checked),children:[i.jsx(rc,{}),i.jsx(oc,{})]})]}),i.jsxs(a.VStack,{align:"stretch",gap:1,children:[i.jsx(a.Text,{fontSize:"sm",children:"Size"}),i.jsx(sc,{min:1,max:5,step:.5,value:[e.size??1],onValueChange:d=>n?.(e.id,d.value[0]),children:i.jsxs(lc,{children:[i.jsx(ic,{children:i.jsx(ac,{})}),i.jsx(cc,{})]})})]})]})},dc=y(a.Drawer.Root),fc=y(a.Drawer.Trigger),hc=y(a.Drawer.Backdrop),gc=y(a.Drawer.Positioner),pc=y(a.Drawer.Content),vc=y(a.Drawer.Header),mc=y(a.Drawer.Title),xc=y(a.Drawer.Body),bc=y(a.Drawer.Footer),yc=y(a.Drawer.CloseTrigger),Sc=y(a.Tabs.Root),wc=y(a.Tabs.List),Ht=y(a.Tabs.Trigger),Vt=y(a.Tabs.Content),Nr=(e,t)=>{if(e.customComponent)return e.customComponent;switch(e.type){case"text":return i.jsx(Jt,{placeholder:e.label,value:e.value,onChange:e.onChange,label:e.label,visible:t});case"number":return i.jsx(Jt,{label:e.label,value:e.value,onChange:e.onChange});case"checkbox":return i.jsx(kr,{label:e.label,value:e.value,onChange:e.onChange});case"select":return i.jsx(Ir,{label:e.label,value:e.value,onChange:e.onChange,options:e.options??[],visible:t,placeholder:e.placeholder});case"date":return i.jsx($a,{value:e.value,onChange:e.onChange});case"combobox":return i.jsx($r,{visible:!0,label:e.label,items:e.options,itemToString:n=>n.label,itemToValue:n=>n.value,renderItem:n=>i.jsx("span",{children:n.label})});default:return null}},Cc=({filterDrawerSize:e="sm",onVisibilityChange:t,onSizeChange:n,onClear:r,filters:o,pageKey:s="default",onLoadPreset:c,activePresetName:l,onReorder:u,open:d,onOpenChange:g})=>{const b=Ne(Qe)[s]??rt(s),v=()=>{const p=prompt("Preset name?");if(!p)return;const m=o.reduce((S,w)=>(S[w.id]=w.value,S),{});Lr(s,{id:crypto.randomUUID(),name:p,date:new Date().toISOString(),values:m})};return i.jsx(a.HStack,{wrap:"wrap",children:i.jsxs(dc,{size:e,open:d,onOpenChange:g,children:[i.jsx(fc,{asChild:!0,children:i.jsxs(a.IconButton,{"aria-label":"Open filters",variant:"outline",size:"xs",ml:2,p:2,children:[i.jsx(Mi,{size:16}),"Filters"]})}),i.jsxs(a.Portal,{children:[i.jsx(hc,{}),i.jsx(gc,{children:i.jsxs(pc,{children:[i.jsx(vc,{children:i.jsx(mc,{children:"Filters"})}),i.jsx(xc,{overflowY:"auto",pt:1,children:i.jsxs(Sc,{defaultValue:"view",children:[i.jsxs(wc,{mb:4,children:[i.jsxs(Ht,{value:"view",children:[i.jsx(ki,{size:16}),"Edit"]}),i.jsxs(Ht,{value:"settings",children:[i.jsx(Li,{size:16}),"Settings"]}),i.jsxs(Ht,{value:"presets",children:[i.jsx(vi,{size:16}),"Presets"]})]}),i.jsx(Vt,{value:"view",children:o.filter(p=>p.visible).map(p=>i.jsx(a.VStack,{align:"stretch",border:"1px solid",borderColor:"gray.200",flex:p.size??1,minW:`${(p.size??1)*100}px`,rounded:"md",p:3,mb:3,children:Nr(p,d)},p.id))}),i.jsx(Vt,{value:"settings",children:i.jsx(gr,{sensors:mo(vo(ln)),collisionDetection:er,onDragEnd:({active:p,over:m})=>{if(!m||p.id===m.id)return;const S=o.findIndex(R=>R.id===p.id),w=o.findIndex(R=>R.id===m.id),j=Et(o,S,w);u?.(j)},children:i.jsx(xr,{items:o.map(p=>p.id),strategy:ks,children:o.map(p=>i.jsx(uc,{filter:p,onVisibilityChange:t,onSizeChange:n},p.id))})})}),i.jsx(Vt,{value:"presets",children:i.jsxs(a.VStack,{align:"stretch",mb:3,children:[b.length===0&&i.jsx(a.Text,{fontSize:"xs",color:"gray.500",children:"No presets saved yet."}),b.map(p=>i.jsxs(a.HStack,{justify:"space-between",border:"1px solid",borderColor:l===p.name?"blue.300":"gray.200",rounded:"md",p:2,children:[i.jsxs(a.VStack,{align:"start",gap:0,children:[i.jsx(a.Text,{fontWeight:"bold",fontSize:"sm",children:p.name}),i.jsx(a.Text,{fontSize:"xs",color:"gray.500",children:new Date(p.date).toLocaleDateString()})]}),i.jsxs(a.HStack,{children:[i.jsx(a.Button,{size:"xs",variant:"ghost",onClick:()=>{const m=o.map(S=>({...S,value:p.values[S.id]??S.value}));c?.(m,p.name)},children:"Load"}),i.jsx(a.IconButton,{size:"xs","aria-label":"Delete preset",variant:"ghost",onClick:()=>Pr(s,p.id),children:i.jsx(ji,{size:14})})]})]},p.id)),i.jsx(a.Button,{size:"sm",colorScheme:"blue",onClick:v,children:"Save Current Filters"})]})})]})}),i.jsx(bc,{justify:"space-between",children:i.jsx(yc,{asChild:!0,children:i.jsx(a.CloseButton,{})})})]})})]})]})})},Dc=({title:e,filters:t,onVisibilityChange:n,onReorder:r,onSizeChange:o,onClear:s,maxToolbarUnits:c,pageKey:l,onLoadPreset:u,activePresetName:d,filterDrawerSize:g="sm"})=>{const[f,b]=h.useState(!1);return i.jsxs(a.HStack,{wrap:"wrap",pl:2,pr:2,width:"100%",justify:"space-between",children:[e,i.jsxs(a.HStack,{gapX:1,children:[t.filter(v=>v.visible!==!1).map(v=>i.jsx(a.HStack,{flex:v.size??1,minW:`${(v.size??1)*100}px`,alignItems:"center",children:Nr(v)},v.id)),i.jsx(Cc,{filterDrawerSize:g,onVisibilityChange:n,onReorder:r,onSizeChange:o,onClear:s,maxToolbarUnits:c,pageKey:l,filters:t,onLoadPreset:u,activePresetName:d,open:f,onOpenChange:v=>{b(v.open)}})]})]})},jc=(e,t)=>{localStorage.setItem(`FILTER_ORDER_${e}`,JSON.stringify(t))},Rc=e=>{try{return JSON.parse(localStorage.getItem(`FILTER_ORDER_${e}`)||"[]")}catch{return[]}},Ec=({onClick:e,size:t="xs",variant:n="solid",label:r,leftIcon:o,rightIcon:s,isDisabled:c,colorScheme:l,loading:u,loadingText:d,rounded:g,type:f="button"})=>i.jsx(a.Button,{onClick:e,size:t,variant:n,disabled:c,colorPalette:l,loading:u,loadingText:d,rounded:g,type:f,children:i.jsxs(a.HStack,{gap:1,children:[o,r,s]})}),Tc=y(a.Dialog.Root),Mc=y(a.Dialog.Backdrop),_c=y(a.Dialog.Positioner),Oc=y(a.Dialog.Content),kc=y(a.Dialog.Header),$c=y(a.Dialog.Body),Ic=y(a.Dialog.Footer),Ac=y(a.Dialog.Title),Lc=y(a.Dialog.CloseTrigger);function Pc({open:e,onClose:t,onConfirm:n,title:r="Confirm Action",description:o="Are you sure you want to continue?",confirmLabel:s="Confirm",cancelLabel:c="Cancel",icon:l,isLoading:u=!1,confirmButtonColorScheme:d="#4169e1"}){return i.jsx(Tc,{open:e,placement:"center",onOpenChange:g=>!g.open&&t(),children:i.jsxs(a.Portal,{children:[i.jsx(Mc,{}),i.jsx(_c,{children:i.jsxs(Oc,{maxW:"480px",children:[i.jsx(kc,{borderBottom:"1px solid",borderColor:"gray.200",children:i.jsx(Ac,{children:r})}),i.jsx($c,{p:6,children:i.jsxs(a.Stack,{gap:4,align:"center",textAlign:"center",children:[i.jsx(a.Box,{color:"orange.500",children:l??i.jsx(Or,{size:40})}),i.jsx(a.Text,{fontSize:"sm",color:"gray.600",children:o})]})}),i.jsxs(Ic,{justifyContent:"flex-end",gap:2,borderTop:"1px solid",borderColor:"gray.200",children:[i.jsx(a.Button,{variant:"outline",size:"sm",onClick:t,children:c}),i.jsx(a.Button,{size:"sm",style:{backgroundColor:d},loading:u,onClick:n,children:s})]}),i.jsx(Lc,{asChild:!0,children:i.jsx(a.CloseButton,{size:"sm"})})]})})]})})}const Nc=y(a.Dialog.Root),zc=y(a.Dialog.Backdrop),Fc=y(a.Dialog.Positioner),Bc=y(a.Dialog.Content),Yc=y(a.Dialog.Header),Hc=y(a.Dialog.Body),Vc=y(a.Dialog.Footer),Wc=y(a.Dialog.Title),Uc=y(a.Dialog.CloseTrigger);function Gc({open:e,onClose:t,onConfirm:n,title:r="Delete Company",entityName:o,confirmText:s="DELETE",confirmLabel:c="Delete",isLoading:l=!1}){const[u,d]=h.useState(""),g=u===s;return i.jsx(Nc,{open:e,placement:"center",onOpenChange:f=>{!f.open&&t(),d("")},children:i.jsxs(a.Portal,{children:[i.jsx(zc,{}),i.jsx(Fc,{children:i.jsxs(Bc,{maxW:"550px",children:[i.jsx(Yc,{borderBottom:"1px solid",borderColor:"#d3d3d3",children:i.jsx(Wc,{color:"red.600",children:r})}),i.jsx(Hc,{p:2,style:{padding:"16px"},children:i.jsxs(a.Stack,{gap:4,borderRadius:"md",p:4,bg:"white",children:[i.jsx(a.Box,{border:"1px solid",borderColor:"red.200",bg:"red.50",borderRadius:"md",p:4,children:i.jsxs(a.Stack,{direction:"row",gap:3,align:"flex-start",children:[i.jsx(a.Box,{color:"red.600",mt:"2px",children:i.jsx(Or,{size:20})}),i.jsxs(a.Box,{children:[i.jsx(a.Text,{fontWeight:"semibold",color:"red.700",children:"Are you sure?"}),i.jsxs(a.Text,{fontSize:"sm",color:"red.600",children:["All the data of ",i.jsx("b",{children:o})," will permanently be deleted."]})]})]})}),i.jsx(a.Text,{fontSize:"sm",color:"gray.600",children:"You can’t undo this action afterwards."}),i.jsxs(a.Box,{children:[i.jsxs(a.Text,{fontSize:"sm",mb:2,children:["Type ",i.jsx("b",{children:s})," to continue"]}),i.jsx(a.Input,{placeholder:`Type ${s} here`,value:u,onChange:f=>d(f.target.value),size:"xs"})]})]})}),i.jsxs(Vc,{justifyContent:"flex-end",gap:2,borderTop:"1px solid",borderColor:"#d3d3d3",children:[i.jsx(a.Button,{variant:"outline",size:"sm",onClick:()=>{t(),d("")},children:"Cancel"}),i.jsx(a.Button,{size:"sm",disabled:!g,style:{backgroundColor:"#FF0000"},loading:l,onClick:n,children:c})]}),i.jsx(Uc,{asChild:!0,children:i.jsx(a.CloseButton,{size:"sm"})})]})})]})})}const zr=({children:e})=>i.jsx(i.Fragment,{children:e}),Fr=({children:e})=>i.jsx(i.Fragment,{children:e}),Xc=a.Button,qc=y(a.Dialog.Root),Kc=y(a.Dialog.Backdrop),Jc=y(a.Dialog.Positioner),Zc=y(a.Dialog.Content),Qc=y(a.Dialog.Header),el=y(a.Dialog.Body),tl=y(a.Dialog.Footer),nl=y(a.Dialog.Title),rl=y(a.Dialog.CloseTrigger);function ol(e){let t=null,n=null;return h.Children.forEach(e,r=>{h.isValidElement(r)&&(r.type===zr&&(t=r.props.children),r.type===Fr&&(n=r.props.children))}),{body:t,actions:n}}const sl=({open:e,onClose:t,title:n,children:r,width:o,position:s,refetch:c,loading:l=!1})=>{const{body:u,actions:d}=ol(r);return i.jsx(qc,{open:e,onOpenChange:g=>!g.open&&t(),placement:s??"center",children:i.jsxs(a.Portal,{children:[i.jsx(Kc,{bg:"blackAlpha.400"}),i.jsx(Jc,{children:i.jsxs(Zc,{w:o??"560px",maxW:o??"560px",borderRadius:"6px",overflow:"hidden",boxShadow:"lg",children:[i.jsx(Qc,{px:"20px",py:"16px",bg:"white",borderBottom:"1px solid",borderColor:"gray.200",children:i.jsxs(a.Flex,{align:"center",justify:"space-between",children:[i.jsx(nl,{fontSize:"16px",fontWeight:"600",children:n}),i.jsx(rl,{asChild:!0,children:i.jsx(a.CloseButton,{size:"sm"})}),c&&i.jsx(dn,{label:"Refresh",refetch:c,isLoading:l})]})}),u&&i.jsx(el,{px:"20px",py:"16px",bg:"#F8FAFC",type:"submit",children:i.jsx(a.Flex,{direction:"column",gap:"16px",children:u})}),d&&i.jsx(tl,{px:"20px",py:"16px",bg:"white",borderTop:"1px solid",borderColor:"gray.200",children:i.jsx(a.Flex,{ml:"auto",gap:"12px",children:d})})]})})]})})},il=y(a.Field.Root),al=y(a.Field.Label),cl=y(a.Field.HelperText),ll=y(a.Field.ErrorText),ul=y(a.PinInput.Input),dl=y(a.PinInput.Control),fl=y(a.PinInput.HiddenInput),hl=y(a.PinInput.Root),gl=({value:e,onChange:t,length:n=4,size:r="xs",isDisabled:o=!1,label:s,helperText:c,errorText:l,required:u=!1,visible:d=!0})=>{const g=Array.from({length:n}).map((f,b)=>e?.[b]??"");return i.jsxs(il,{children:[d&&s&&i.jsxs(al,{children:[s,u&&" *"]}),i.jsxs(hl,{value:g,onValueChange:f=>t?.(f.value.join("")),disabled:o,size:r,children:[i.jsx(fl,{}),i.jsx(dl,{children:i.jsx(a.HStack,{children:Array.from({length:n}).map((f,b)=>i.jsx(ul,{index:b},b))})})]}),l&&i.jsx(ll,{fontSize:"xs",children:l}),c&&!l&&i.jsx(cl,{fontSize:"xs",children:c})]})};function dn({refetch:e,isLoading:t=!1,label:n="Refresh"}){const[r,o]=h.useState(!1),s=async()=>{o(!0);try{await e()}finally{setTimeout(()=>o(!1),300)}};return i.jsx(a.IconButton,{"aria-label":n,size:"xs",variant:"outline",disabled:t||r,onClick:s,ml:2,children:i.jsx(Ii,{size:14,style:{animation:r?"spin 0.6s linear infinite":void 0}})})}var gt={exports:{}},pl=gt.exports,Gn;function vl(){return Gn||(Gn=1,(function(e,t){(function(n,r){e.exports=r()})(pl,(function(){var n=1e3,r=6e4,o=36e5,s="millisecond",c="second",l="minute",u="hour",d="day",g="week",f="month",b="quarter",v="year",p="date",m="Invalid Date",S=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,w=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,j={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(k){var E=["th","st","nd","rd"],C=k%100;return"["+k+(E[(C-20)%10]||E[C]||E[0])+"]"}},R=function(k,E,C){var _=String(k);return!_||_.length>=E?k:""+Array(E+1-_.length).join(C)+k},I={s:R,z:function(k){var E=-k.utcOffset(),C=Math.abs(E),_=Math.floor(C/60),D=C%60;return(E<=0?"+":"-")+R(_,2,"0")+":"+R(D,2,"0")},m:function k(E,C){if(E.date()<C.date())return-k(C,E);var _=12*(C.year()-E.year())+(C.month()-E.month()),D=E.clone().add(_,f),P=C-D<0,z=E.clone().add(_+(P?-1:1),f);return+(-(_+(C-D)/(P?D-z:z-D))||0)},a:function(k){return k<0?Math.ceil(k)||0:Math.floor(k)},p:function(k){return{M:f,y:v,w:g,d,D:p,h:u,m:l,s:c,ms:s,Q:b}[k]||String(k||"").toLowerCase().replace(/s$/,"")},u:function(k){return k===void 0}},$="en",M={};M[$]=j;var A="$isDayjsObject",L=function(k){return k instanceof H||!(!k||!k[A])},V=function k(E,C,_){var D;if(!E)return $;if(typeof E=="string"){var P=E.toLowerCase();M[P]&&(D=P),C&&(M[P]=C,D=P);var z=E.split("-");if(!D&&z.length>1)return k(z[0])}else{var x=E.name;M[x]=E,D=x}return!_&&D&&($=D),D||!_&&$},B=function(k,E){if(L(k))return k.clone();var C=typeof E=="object"?E:{};return C.date=k,C.args=arguments,new H(C)},O=I;O.l=V,O.i=L,O.w=function(k,E){return B(k,{locale:E.$L,utc:E.$u,x:E.$x,$offset:E.$offset})};var H=(function(){function k(C){this.$L=V(C.locale,null,!0),this.parse(C),this.$x=this.$x||C.x||{},this[A]=!0}var E=k.prototype;return E.parse=function(C){this.$d=(function(_){var D=_.date,P=_.utc;if(D===null)return new Date(NaN);if(O.u(D))return new Date;if(D instanceof Date)return new Date(D);if(typeof D=="string"&&!/Z$/i.test(D)){var z=D.match(S);if(z){var x=z[2]-1||0,T=(z[7]||"0").substring(0,3);return P?new Date(Date.UTC(z[1],x,z[3]||1,z[4]||0,z[5]||0,z[6]||0,T)):new Date(z[1],x,z[3]||1,z[4]||0,z[5]||0,z[6]||0,T)}}return new Date(D)})(C),this.init()},E.init=function(){var C=this.$d;this.$y=C.getFullYear(),this.$M=C.getMonth(),this.$D=C.getDate(),this.$W=C.getDay(),this.$H=C.getHours(),this.$m=C.getMinutes(),this.$s=C.getSeconds(),this.$ms=C.getMilliseconds()},E.$utils=function(){return O},E.isValid=function(){return this.$d.toString()!==m},E.isSame=function(C,_){var D=B(C);return this.startOf(_)<=D&&D<=this.endOf(_)},E.isAfter=function(C,_){return B(C)<this.startOf(_)},E.isBefore=function(C,_){return this.endOf(_)<B(C)},E.$g=function(C,_,D){return O.u(C)?this[_]:this.set(D,C)},E.unix=function(){return Math.floor(this.valueOf()/1e3)},E.valueOf=function(){return this.$d.getTime()},E.startOf=function(C,_){var D=this,P=!!O.u(_)||_,z=O.p(C),x=function(J,F){var ie=O.w(D.$u?Date.UTC(D.$y,F,J):new Date(D.$y,F,J),D);return P?ie:ie.endOf(d)},T=function(J,F){return O.w(D.toDate()[J].apply(D.toDate("s"),(P?[0,0,0,0]:[23,59,59,999]).slice(F)),D)},N=this.$W,Y=this.$M,X=this.$D,q="set"+(this.$u?"UTC":"");switch(z){case v:return P?x(1,0):x(31,11);case f:return P?x(1,Y):x(0,Y+1);case g:var W=this.$locale().weekStart||0,K=(N<W?N+7:N)-W;return x(P?X-K:X+(6-K),Y);case d:case p:return T(q+"Hours",0);case u:return T(q+"Minutes",1);case l:return T(q+"Seconds",2);case c:return T(q+"Milliseconds",3);default:return this.clone()}},E.endOf=function(C){return this.startOf(C,!1)},E.$set=function(C,_){var D,P=O.p(C),z="set"+(this.$u?"UTC":""),x=(D={},D[d]=z+"Date",D[p]=z+"Date",D[f]=z+"Month",D[v]=z+"FullYear",D[u]=z+"Hours",D[l]=z+"Minutes",D[c]=z+"Seconds",D[s]=z+"Milliseconds",D)[P],T=P===d?this.$D+(_-this.$W):_;if(P===f||P===v){var N=this.clone().set(p,1);N.$d[x](T),N.init(),this.$d=N.set(p,Math.min(this.$D,N.daysInMonth())).$d}else x&&this.$d[x](T);return this.init(),this},E.set=function(C,_){return this.clone().$set(C,_)},E.get=function(C){return this[O.p(C)]()},E.add=function(C,_){var D,P=this;C=Number(C);var z=O.p(_),x=function(Y){var X=B(P);return O.w(X.date(X.date()+Math.round(Y*C)),P)};if(z===f)return this.set(f,this.$M+C);if(z===v)return this.set(v,this.$y+C);if(z===d)return x(1);if(z===g)return x(7);var T=(D={},D[l]=r,D[u]=o,D[c]=n,D)[z]||1,N=this.$d.getTime()+C*T;return O.w(N,this)},E.subtract=function(C,_){return this.add(-1*C,_)},E.format=function(C){var _=this,D=this.$locale();if(!this.isValid())return D.invalidDate||m;var P=C||"YYYY-MM-DDTHH:mm:ssZ",z=O.z(this),x=this.$H,T=this.$m,N=this.$M,Y=D.weekdays,X=D.months,q=D.meridiem,W=function(F,ie,re,he){return F&&(F[ie]||F(_,P))||re[ie].slice(0,he)},K=function(F){return O.s(x%12||12,F,"0")},J=q||function(F,ie,re){var he=F<12?"AM":"PM";return re?he.toLowerCase():he};return P.replace(w,(function(F,ie){return ie||(function(re){switch(re){case"YY":return String(_.$y).slice(-2);case"YYYY":return O.s(_.$y,4,"0");case"M":return N+1;case"MM":return O.s(N+1,2,"0");case"MMM":return W(D.monthsShort,N,X,3);case"MMMM":return W(X,N);case"D":return _.$D;case"DD":return O.s(_.$D,2,"0");case"d":return String(_.$W);case"dd":return W(D.weekdaysMin,_.$W,Y,2);case"ddd":return W(D.weekdaysShort,_.$W,Y,3);case"dddd":return Y[_.$W];case"H":return String(x);case"HH":return O.s(x,2,"0");case"h":return K(1);case"hh":return K(2);case"a":return J(x,T,!0);case"A":return J(x,T,!1);case"m":return String(T);case"mm":return O.s(T,2,"0");case"s":return String(_.$s);case"ss":return O.s(_.$s,2,"0");case"SSS":return O.s(_.$ms,3,"0");case"Z":return z}return null})(F)||z.replace(":","")}))},E.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},E.diff=function(C,_,D){var P,z=this,x=O.p(_),T=B(C),N=(T.utcOffset()-this.utcOffset())*r,Y=this-T,X=function(){return O.m(z,T)};switch(x){case v:P=X()/12;break;case f:P=X();break;case b:P=X()/3;break;case g:P=(Y-N)/6048e5;break;case d:P=(Y-N)/864e5;break;case u:P=Y/o;break;case l:P=Y/r;break;case c:P=Y/n;break;default:P=Y}return D?P:O.a(P)},E.daysInMonth=function(){return this.endOf(f).$D},E.$locale=function(){return M[this.$L]},E.locale=function(C,_){if(!C)return this.$L;var D=this.clone(),P=V(C,_,!0);return P&&(D.$L=P),D},E.clone=function(){return O.w(this.$d,this)},E.toDate=function(){return new Date(this.valueOf())},E.toJSON=function(){return this.isValid()?this.toISOString():null},E.toISOString=function(){return this.$d.toISOString()},E.toString=function(){return this.$d.toUTCString()},k})(),G=H.prototype;return B.prototype=G,[["$ms",s],["$s",c],["$m",l],["$H",u],["$W",d],["$M",f],["$y",v],["$D",p]].forEach((function(k){G[k[1]]=function(E){return this.$g(E,k[0],k[1])}})),B.extend=function(k,E){return k.$i||(k(E,H,B),k.$i=!0),B},B.locale=V,B.isDayjs=L,B.unix=function(k){return B(1e3*k)},B.en=M[$],B.Ls=M,B.p={},B}))})(gt)),gt.exports}var ml=vl();const _t=Ct(ml);var pt={exports:{}},xl=pt.exports,Xn;function bl(){return Xn||(Xn=1,(function(e,t){(function(n,r){e.exports=r()})(xl,(function(){return function(n,r,o){n=n||{};var s=r.prototype,c={future:"in %s",past:"%s ago",s:"a few seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"};function l(d,g,f,b){return s.fromToBase(d,g,f,b)}o.en.relativeTime=c,s.fromToBase=function(d,g,f,b,v){for(var p,m,S,w=f.$locale().relativeTime||c,j=n.thresholds||[{l:"s",r:44,d:"second"},{l:"m",r:89},{l:"mm",r:44,d:"minute"},{l:"h",r:89},{l:"hh",r:21,d:"hour"},{l:"d",r:35},{l:"dd",r:25,d:"day"},{l:"M",r:45},{l:"MM",r:10,d:"month"},{l:"y",r:17},{l:"yy",d:"year"}],R=j.length,I=0;I<R;I+=1){var $=j[I];$.d&&(p=b?o(d).diff(f,$.d,!0):f.diff(d,$.d,!0));var M=(n.rounding||Math.round)(Math.abs(p));if(S=p>0,M<=$.r||!$.r){M<=1&&I>0&&($=j[I-1]);var A=w[$.l];v&&(M=v(""+M)),m=typeof A=="string"?A.replace("%d",M):A(M,g,$.l,S);break}}if(g)return m;var L=S?w.future:w.past;return typeof L=="function"?L(m):L.replace("%s",m)},s.to=function(d,g){return l(d,g,this,!0)},s.from=function(d,g){return l(d,g,this)};var u=function(d){return d.$u?o.utc():o()};s.toNow=function(d){return this.to(u(this),d)},s.fromNow=function(d){return this.from(u(this),d)}}}))})(pt)),pt.exports}var yl=bl();const Sl=Ct(yl);var vt={exports:{}},wl=vt.exports,qn;function Cl(){return qn||(qn=1,(function(e,t){(function(n,r){e.exports=r()})(wl,(function(){var n={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"};return function(r,o,s){var c=o.prototype,l=c.format;s.en.formats=n,c.format=function(u){u===void 0&&(u="YYYY-MM-DDTHH:mm:ssZ");var d=this.$locale().formats,g=(function(f,b){return f.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,(function(v,p,m){var S=m&&m.toUpperCase();return p||b[m]||n[m]||b[S].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,(function(w,j,R){return j||R.slice(1)}))}))})(u,d===void 0?{}:d);return l.call(this,g)}}}))})(vt)),vt.exports}var Dl=Cl();const jl=Ct(Dl);var mt={exports:{}},Rl=mt.exports,Kn;function El(){return Kn||(Kn=1,(function(e,t){(function(n,r){e.exports=r()})(Rl,(function(){return function(n,r){var o=r.prototype,s=o.format;o.format=function(c){var l=this,u=this.$locale();if(!this.isValid())return s.bind(this)(c);var d=this.$utils(),g=(c||"YYYY-MM-DDTHH:mm:ssZ").replace(/\[([^\]]+)]|Q|wo|ww|w|WW|W|zzz|z|gggg|GGGG|Do|X|x|k{1,2}|S/g,(function(f){switch(f){case"Q":return Math.ceil((l.$M+1)/3);case"Do":return u.ordinal(l.$D);case"gggg":return l.weekYear();case"GGGG":return l.isoWeekYear();case"wo":return u.ordinal(l.week(),"W");case"w":case"ww":return d.s(l.week(),f==="w"?1:2,"0");case"W":case"WW":return d.s(l.isoWeek(),f==="W"?1:2,"0");case"k":case"kk":return d.s(String(l.$H===0?24:l.$H),f==="k"?1:2,"0");case"X":return Math.floor(l.$d.getTime()/1e3);case"x":return l.$d.getTime();case"z":return"["+l.offsetName()+"]";case"zzz":return"["+l.offsetName("long")+"]";default:return f}}));return s.bind(this)(g)}}}))})(mt)),mt.exports}var Tl=El();const Ml=Ct(Tl);_t.extend(Sl);_t.extend(jl);_t.extend(Ml);const _l={date:"DD MMM YYYY",time:"hh:mm A",dateTime:"DD MMM YYYY, hh:mm A",full:"dddd, DD MMM YYYY, hh:mm A",short:"DD/MM/YY",relative:""};function Zt({value:e,variant:t="dateTime",format:n,fallback:r="--"}){if(!e)return r;const o=_t(e);return o.isValid()?t==="relative"?o.fromNow():o.format(n??_l[t]):r}function Ol({value:e,dateVariant:t="date",timeVariant:n="time",dateFormat:r,timeFormat:o,align:s="start",dateColor:c="gray.700",dateFontSize:l="16px",dateFontWeight:u="500",timeColor:d="gray.500",timeFontSize:g="12px",timeFontWeight:f="400"}){return i.jsxs(a.Stack,{gap:.5,align:s,children:[i.jsx(a.Text,{fontSize:l,fontWeight:u,color:c,children:Zt({value:e,variant:t,format:r})}),i.jsx(a.Text,{fontSize:g,fontWeight:f,color:d,children:Zt({value:e,variant:n,format:o})})]})}class Br{state=new Map;listeners=new Map;get(t){return this.state.get(t)}set(t){this.state.set(t.key,t),this.notify(t.key)}setMany(t){t.forEach(n=>this.set(n))}subscribe(t,n){return this.listeners.has(t)||this.listeners.set(t,new Set),this.listeners.get(t).add(n),n(this.state.get(t)),()=>{this.listeners.get(t)?.delete(n)}}notify(t){this.listeners.get(t)?.forEach(n=>n(this.state.get(t)))}clear(){this.state.clear()}}class Qt{constructor(t){this.baseUrl=t}async fetchLatest(t){const n=new URLSearchParams;return n.set("keys",t.join(",")),(await(await fetch(`${this.baseUrl}/options?${n}`)).json()).data}}class en{constructor(t){this.api=t}store=new Br;inflight=new Map;getRaw(t){return this.store.get(t)}async getKey(t){const n=this.store.get(t);return n?n.value:(await this.fetchMissing([t]),this.store.get(t)?.value)}async getMultiKey(t){const n={},r=[];for(const o of t){const s=this.store.get(o);s?n[o]=s.value:r.push(o)}return r.length&&(await this.fetchMissing(r),r.forEach(o=>{const s=this.store.get(o);s&&(n[o]=s.value)})),n}subscribe(t,n){return this.store.subscribe(t,n)}hydrate(t){this.store.setMany(t)}clear(){this.store.clear()}async fetchMissing(t){const n=t.filter(o=>!this.inflight.has(o));if(!n.length)return;const r=this.api.fetchLatest(n).then(o=>{this.store.setMany(o),n.forEach(s=>this.inflight.delete(s))});n.forEach(o=>this.inflight.set(o,r)),await r}}const Yr=h.createContext(null);function Hr(){const e=h.useContext(Yr);if(!e)throw new Error("OptionsProvider is missing. Wrap your app with <OptionsProvider />");return e}function kl({client:{apiUrl:e},children:t}){const n=h.useRef(new en(new Qt(e)));return n.current||(n.current=new en(new Qt(e))),i.jsx(Yr.Provider,{value:n.current,children:t})}function $l(e){const t=Hr(),[n,r]=h.useState(t.getRaw(e)?.value);return h.useEffect(()=>{let o=!0;t.getKey(e).then(c=>{o&&r(c)});const s=t.subscribe(e,c=>{r(c?.value)});return()=>{o=!1,s()}},[e,t]),n}function Il(e){const t=Hr(),[n,r]=h.useState({});return h.useEffect(()=>{let o=!0;t.getMultiKey(e).then(c=>{o&&r(c)});const s=e.map(c=>t.subscribe(c,l=>{r(u=>({...u,[c]:l?.value}))}));return()=>{o=!1,s.forEach(c=>c())}},[e.join("|"),t]),n}async function Al(e,t){return e.getKey(t)}async function Ll(e,t){await e.getMultiKey(t)}function Pl(e={}){const{initialPage:t=1,initialLimit:n=20}=e,[r,o]=h.useState(t),[s,c]=h.useState(n),l=h.useCallback(b=>{o(Math.max(1,b))},[]),u=h.useCallback(b=>{c(Math.max(1,b)),o(1)},[]),d=h.useCallback(()=>{o(b=>b+1)},[]),g=h.useCallback(()=>{o(b=>Math.max(1,b-1))},[]),f=h.useCallback(()=>{o(t),c(n)},[t,n]);return{page:r,limit:s,setPage:l,setLimit:u,nextPage:d,prevPage:g,reset:f}}function Nl(e={}){const{initialValue:t="",delay:n=300}=e,[r,o]=h.useState(t),s=zl(r,n),c=h.useCallback(u=>{o(u)},[]),l=h.useCallback(()=>{o(t)},[t]);return{search:r,debouncedSearch:s,onSearchChange:c,reset:l}}function zl(e,t=300){const[n,r]=h.useState(e);return h.useEffect(()=>{const o=setTimeout(()=>{r(e)},t);return()=>clearTimeout(o)},[e,t]),n}exports.DataTable=ha;exports.Filters=Dc;exports.HttpOptionsApi=Qt;exports.MDSButton=Ec;exports.MDSCheckbox=kr;exports.MDSCombobox=$r;exports.MDSConfirmActionDialog=Pc;exports.MDSConfirmDeleteDialog=Gc;exports.MDSDialogAction=Xc;exports.MDSDialogActions=Fr;exports.MDSDialogBody=zr;exports.MDSDialogWrapper=sl;exports.MDSInput=Jt;exports.MDSPinInput=gl;exports.MDSRefreshButton=dn;exports.MDSSelectBox=Ir;exports.OptionsClientImpl=en;exports.OptionsProvider=kl;exports.OptionsStore=Br;exports.RefreshButton=dn;exports.StackedDateTime=Ol;exports.addPreset=Lr;exports.deletePreset=Pr;exports.formatDateTime=Zt;exports.getColumnWidthKey=Tt;exports.getOption=Al;exports.getPresets=rt;exports.loadOrder=Rc;exports.prefetchOptions=Ll;exports.presetStore=Qe;exports.saveOrder=jc;exports.savePresets=Mt;exports.setActionsConfig=Rr;exports.setColumnWidth=Qs;exports.setData=Dr;exports.setTableId=jr;exports.tableStore=ne;exports.updatePreset=tc;exports.useDebouncedSearch=Nl;exports.useOption=$l;exports.useOptions=Il;exports.usePagination=Pl;exports.withChildren=y;
10
+ `},lo={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 co(e){let{announcements:t=lo,container:n,hiddenTextDescribedById:r,screenReaderInstructions:o=ao}=e;const{announce:i,announcement:c}=oo(),l=Je("DndLiveRegion"),[u,d]=h.useState(!1);if(h.useEffect(()=>{d(!0)},[]),so(h.useMemo(()=>({onDragStart(f){let{active:x}=f;i(t.onDragStart({active:x}))},onDragMove(f){let{active:x,over:p}=f;t.onDragMove&&i(t.onDragMove({active:x,over:p}))},onDragOver(f){let{active:x,over:p}=f;i(t.onDragOver({active:x,over:p}))},onDragEnd(f){let{active:x,over:p}=f;i(t.onDragEnd({active:x,over:p}))},onDragCancel(f){let{active:x,over:p}=f;i(t.onDragCancel({active:x,over:p}))}}),[i,t])),!u)return null;const g=h.createElement(h.Fragment,null,h.createElement(no,{id:r,value:o.draggable}),h.createElement(ro,{id:l,announcement:c}));return n?Be.createPortal(g,n):g}var Z;(function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"})(Z||(Z={}));function vt(){}function uo(e,t){return h.useMemo(()=>({sensor:e,options:{}}),[e,t])}function fo(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return h.useMemo(()=>[...t].filter(r=>r!=null),[...t])}const he=Object.freeze({x:0,y:0});function ho(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function go(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function po(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function vo(e,t){if(!e||e.length===0)return null;const[n]=e;return n[t]}function bn(e,t,n){return t===void 0&&(t=e.left),n===void 0&&(n=e.top),{x:t+e.width*.5,y:n+e.height*.5}}const qn=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=bn(t,t.left,t.top),i=[];for(const c of r){const{id:l}=c,u=n.get(l);if(u){const d=ho(bn(u),o);i.push({id:l,data:{droppableContainer:c,value:d}})}}return i.sort(go)};function mo(e,t){const n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),o=Math.min(t.left+t.width,e.left+e.width),i=Math.min(t.top+t.height,e.top+e.height),c=o-r,l=i-n;if(r<o&&n<i){const u=t.width*t.height,d=e.width*e.height,g=c*l,f=g/(u+d-g);return Number(f.toFixed(4))}return 0}const xo=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=[];for(const i of r){const{id:c}=i,l=n.get(c);if(l){const u=mo(l,t);u>0&&o.push({id:c,data:{droppableContainer:i,value:u}})}}return o.sort(po)};function bo(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function Xn(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:he}function yo(e){return function(n){for(var r=arguments.length,o=new Array(r>1?r-1:0),i=1;i<r;i++)o[i-1]=arguments[i];return o.reduce((c,l)=>({...c,top:c.top+e*l.y,bottom:c.bottom+e*l.y,left:c.left+e*l.x,right:c.right+e*l.x}),{...n})}}const So=yo(1);function wo(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 Co(e,t,n){const r=wo(t);if(!r)return e;const{scaleX:o,scaleY:i,x:c,y:l}=r,u=e.left-c-(1-o)*parseFloat(n),d=e.top-l-(1-i)*parseFloat(n.slice(n.indexOf(" ")+1)),g=o?e.width/o:e.width,f=i?e.height/i:e.height;return{width:g,height:f,top:d,right:u+g,bottom:d+f,left:u}}const Do={ignoreTransform:!1};function $e(e,t){t===void 0&&(t=Do);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:d,transformOrigin:g}=ie(e).getComputedStyle(e);d&&(n=Co(n,d,g))}const{top:r,left:o,width:i,height:c,bottom:l,right:u}=n;return{top:r,left:o,width:i,height:c,bottom:l,right:u}}function yn(e){return $e(e,{ignoreTransform:!0})}function jo(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=ie(e).getComputedStyle(e)),t.position==="fixed"}function Mo(e,t){t===void 0&&(t=ie(e).getComputedStyle(e));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(o=>{const i=t[o];return typeof i=="string"?n.test(i):!1})}function tn(e,t){const n=[];function r(o){if(t!=null&&n.length>=t||!o)return n;if(Zt(o)&&o.scrollingElement!=null&&!n.includes(o.scrollingElement))return n.push(o.scrollingElement),n;if(!Xe(o)||Vn(o)||n.includes(o))return n;const i=ie(e).getComputedStyle(o);return o!==e&&Mo(o,i)&&n.push(o),Ro(o,i)?n:r(o.parentNode)}return e?r(e):n}function Kn(e){const[t]=tn(e,1);return t??null}function _t(e){return!yt||!e?null:ke(e)?e:Jt(e)?Zt(e)||e===Ie(e).scrollingElement?window:Xe(e)?e:null:null}function Jn(e){return ke(e)?e.scrollX:e.scrollLeft}function Zn(e){return ke(e)?e.scrollY:e.scrollTop}function Wt(e){return{x:Jn(e),y:Zn(e)}}var Q;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(Q||(Q={}));function Qn(e){return!yt||!e?!1:e===document.scrollingElement}function er(e){const t={x:0,y:0},n=Qn(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height},o=e.scrollTop<=t.y,i=e.scrollLeft<=t.x,c=e.scrollTop>=r.y,l=e.scrollLeft>=r.x;return{isTop:o,isLeft:i,isBottom:c,isRight:l,maxScroll:r,minScroll:t}}const To={x:.2,y:.2};function Eo(e,t,n,r,o){let{top:i,left:c,right:l,bottom:u}=n;r===void 0&&(r=10),o===void 0&&(o=To);const{isTop:d,isBottom:g,isLeft:f,isRight:x}=er(e),p={x:0,y:0},m={x:0,y:0},y={height:t.height*o.y,width:t.width*o.x};return!d&&i<=t.top+y.height?(p.y=Q.Backward,m.y=r*Math.abs((t.top+y.height-i)/y.height)):!g&&u>=t.bottom-y.height&&(p.y=Q.Forward,m.y=r*Math.abs((t.bottom-y.height-u)/y.height)),!x&&l>=t.right-y.width?(p.x=Q.Forward,m.x=r*Math.abs((t.right-y.width-l)/y.width)):!f&&c<=t.left+y.width&&(p.x=Q.Backward,m.x=r*Math.abs((t.left+y.width-c)/y.width)),{direction:p,speed:m}}function Oo(e){if(e===document.scrollingElement){const{innerWidth:i,innerHeight:c}=window;return{top:0,left:0,right:i,bottom:c,width:i,height:c}}const{top:t,left:n,right:r,bottom:o}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:o,width:e.clientWidth,height:e.clientHeight}}function tr(e){return e.reduce((t,n)=>Oe(t,Wt(n)),he)}function _o(e){return e.reduce((t,n)=>t+Jn(n),0)}function ko(e){return e.reduce((t,n)=>t+Zn(n),0)}function Io(e,t){if(t===void 0&&(t=$e),!e)return;const{top:n,left:r,bottom:o,right:i}=t(e);Kn(e)&&(o<=0||i<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const $o=[["x",["left","right"],_o],["y",["top","bottom"],ko]];class nn{constructor(t,n){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const r=tn(n),o=tr(r);this.rect={...t},this.width=t.width,this.height=t.height;for(const[i,c,l]of $o)for(const u of c)Object.defineProperty(this,u,{get:()=>{const d=l(r),g=o[i]-d;return this.rect[u]+g},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class We{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 Ao(e){const{EventTarget:t}=ie(e);return e instanceof t?e:Ie(e)}function kt(e,t){const n=Math.abs(e.x),r=Math.abs(e.y);return typeof t=="number"?Math.sqrt(n**2+r**2)>t:"x"in t&&"y"in t?n>t.x&&r>t.y:"x"in t?n>t.x:"y"in t?r>t.y:!1}var de;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(de||(de={}));function Sn(e){e.preventDefault()}function Lo(e){e.stopPropagation()}var G;(function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter",e.Tab="Tab"})(G||(G={}));const nr={start:[G.Space,G.Enter],cancel:[G.Esc],end:[G.Space,G.Enter,G.Tab]},Po=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case G.Right:return{...n,x:n.x+25};case G.Left:return{...n,x:n.x-25};case G.Down:return{...n,y:n.y+25};case G.Up:return{...n,y:n.y-25}}};class rr{constructor(t){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=t;const{event:{target:n}}=t;this.props=t,this.listeners=new We(Ie(n)),this.windowListeners=new We(ie(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(de.Resize,this.handleCancel),this.windowListeners.add(de.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(de.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props,r=t.node.current;r&&Io(r),n(he)}handleKeyDown(t){if(en(t)){const{active:n,context:r,options:o}=this.props,{keyboardCodes:i=nr,coordinateGetter:c=Po,scrollBehavior:l="smooth"}=o,{code:u}=t;if(i.end.includes(u)){this.handleEnd(t);return}if(i.cancel.includes(u)){this.handleCancel(t);return}const{collisionRect:d}=r.current,g=d?{x:d.left,y:d.top}:he;this.referenceCoordinates||(this.referenceCoordinates=g);const f=c(t,{active:n,context:r.current,currentCoordinates:g});if(f){const x=pt(f,g),p={x:0,y:0},{scrollableAncestors:m}=r.current;for(const y of m){const w=t.code,{isTop:C,isRight:R,isLeft:T,isBottom:L,maxScroll:A,minScroll:_}=er(y),$=Oo(y),N={x:Math.min(w===G.Right?$.right-$.width/2:$.right,Math.max(w===G.Right?$.left:$.left+$.width/2,f.x)),y:Math.min(w===G.Down?$.bottom-$.height/2:$.bottom,Math.max(w===G.Down?$.top:$.top+$.height/2,f.y))},H=w===G.Right&&!R||w===G.Left&&!T,k=w===G.Down&&!L||w===G.Up&&!C;if(H&&N.x!==f.x){const S=y.scrollLeft+x.x,W=w===G.Right&&S<=A.x||w===G.Left&&S>=_.x;if(W&&!x.y){y.scrollTo({left:S,behavior:l});return}W?p.x=y.scrollLeft-S:p.x=w===G.Right?y.scrollLeft-A.x:y.scrollLeft-_.x,p.x&&y.scrollBy({left:-p.x,behavior:l});break}else if(k&&N.y!==f.y){const S=y.scrollTop+x.y,W=w===G.Down&&S<=A.y||w===G.Up&&S>=_.y;if(W&&!x.x){y.scrollTo({top:S,behavior:l});return}W?p.y=y.scrollTop-S:p.y=w===G.Down?y.scrollTop-A.y:y.scrollTop-_.y,p.y&&y.scrollBy({top:-p.y,behavior:l});break}}this.handleMove(t,Oe(pt(f,this.referenceCoordinates),p))}}}handleMove(t,n){const{onMove:r}=this.props;t.preventDefault(),r(n)}handleEnd(t){const{onEnd:n}=this.props;t.preventDefault(),this.detach(),n()}handleCancel(t){const{onCancel:n}=this.props;t.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}rr.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:r=nr,onActivation:o}=t,{active:i}=n;const{code:c}=e.nativeEvent;if(r.start.includes(c)){const l=i.activatorNode.current;return l&&e.target!==l?!1:(e.preventDefault(),o?.({event:e.nativeEvent}),!0)}return!1}}];function wn(e){return!!(e&&"distance"in e)}function Cn(e){return!!(e&&"delay"in e)}class rn{constructor(t,n,r){var o;r===void 0&&(r=Ao(t.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=t,this.events=n;const{event:i}=t,{target:c}=i;this.props=t,this.events=n,this.document=Ie(c),this.documentListeners=new We(this.document),this.listeners=new We(r),this.windowListeners=new We(ie(c)),this.initialCoordinates=(o=Bt(i))!=null?o:he,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:t,props:{options:{activationConstraint:n,bypassActivationConstraint:r}}}=this;if(this.listeners.add(t.move.name,this.handleMove,{passive:!1}),this.listeners.add(t.end.name,this.handleEnd),t.cancel&&this.listeners.add(t.cancel.name,this.handleCancel),this.windowListeners.add(de.Resize,this.handleCancel),this.windowListeners.add(de.DragStart,Sn),this.windowListeners.add(de.VisibilityChange,this.handleCancel),this.windowListeners.add(de.ContextMenu,Sn),this.documentListeners.add(de.Keydown,this.handleKeydown),n){if(r!=null&&r({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(Cn(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(wn(n)){this.handlePending(n);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(t,n){const{active:r,onPending:o}=this.props;o(r,t,this.initialCoordinates,n)}handleStart(){const{initialCoordinates:t}=this,{onStart:n}=this.props;t&&(this.activated=!0,this.documentListeners.add(de.Click,Lo,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(de.SelectionChange,this.removeTextSelection),n(t))}handleMove(t){var n;const{activated:r,initialCoordinates:o,props:i}=this,{onMove:c,options:{activationConstraint:l}}=i;if(!o)return;const u=(n=Bt(t))!=null?n:he,d=pt(o,u);if(!r&&l){if(wn(l)){if(l.tolerance!=null&&kt(d,l.tolerance))return this.handleCancel();if(kt(d,l.distance))return this.handleStart()}if(Cn(l)&&kt(d,l.tolerance))return this.handleCancel();this.handlePending(l,d);return}t.cancelable&&t.preventDefault(),c(u)}handleEnd(){const{onAbort:t,onEnd:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleCancel(){const{onAbort:t,onCancel:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleKeydown(t){t.code===G.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const No={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class on extends rn{constructor(t){const{event:n}=t,r=Ie(n.target);super(t,No,r)}}on.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!n.isPrimary||n.button!==0?!1:(r?.({event:n}),!0)}}];const zo={move:{name:"mousemove"},end:{name:"mouseup"}};var Ht;(function(e){e[e.RightClick=2]="RightClick"})(Ht||(Ht={}));class Fo extends rn{constructor(t){super(t,zo,Ie(t.event.target))}}Fo.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===Ht.RightClick?!1:(r?.({event:n}),!0)}}];const It={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class Yo extends rn{constructor(t){super(t,It)}static setup(){return window.addEventListener(It.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(It.move.name,t)};function t(){}}}Yo.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;const{touches:o}=n;return o.length>1?!1:(r?.({event:n}),!0)}}];var He;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(He||(He={}));var mt;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(mt||(mt={}));function Bo(e){let{acceleration:t,activator:n=He.Pointer,canScroll:r,draggingRect:o,enabled:i,interval:c=5,order:l=mt.TreeOrder,pointerCoordinates:u,scrollableAncestors:d,scrollableAncestorRects:g,delta:f,threshold:x}=e;const p=Ho({delta:f,disabled:!i}),[m,y]=Jr(),w=h.useRef({x:0,y:0}),C=h.useRef({x:0,y:0}),R=h.useMemo(()=>{switch(n){case He.Pointer:return u?{top:u.y,bottom:u.y,left:u.x,right:u.x}:null;case He.DraggableRect:return o}},[n,o,u]),T=h.useRef(null),L=h.useCallback(()=>{const _=T.current;if(!_)return;const $=w.current.x*C.current.x,N=w.current.y*C.current.y;_.scrollBy($,N)},[]),A=h.useMemo(()=>l===mt.TreeOrder?[...d].reverse():d,[l,d]);h.useEffect(()=>{if(!i||!d.length||!R){y();return}for(const _ of A){if(r?.(_)===!1)continue;const $=d.indexOf(_),N=g[$];if(!N)continue;const{direction:H,speed:k}=Eo(_,N,R,t,x);for(const S of["x","y"])p[S][H[S]]||(k[S]=0,H[S]=0);if(k.x>0||k.y>0){y(),T.current=_,m(L,c),w.current=k,C.current=H;return}}w.current={x:0,y:0},C.current={x:0,y:0},y()},[t,L,r,y,i,c,JSON.stringify(R),JSON.stringify(p),m,d,A,g,JSON.stringify(x)])}const Wo={x:{[Q.Backward]:!1,[Q.Forward]:!1},y:{[Q.Backward]:!1,[Q.Forward]:!1}};function Ho(e){let{delta:t,disabled:n}=e;const r=Yt(t);return Ke(o=>{if(n||!r||!o)return Wo;const i={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[Q.Backward]:o.x[Q.Backward]||i.x===-1,[Q.Forward]:o.x[Q.Forward]||i.x===1},y:{[Q.Backward]:o.y[Q.Backward]||i.y===-1,[Q.Forward]:o.y[Q.Forward]||i.y===1}}},[n,t,r])}function Vo(e,t){const n=t!=null?e.get(t):void 0,r=n?n.node.current:null;return Ke(o=>{var i;return t==null?null:(i=r??o)!=null?i:null},[r,t])}function Uo(e,t){return h.useMemo(()=>e.reduce((n,r)=>{const{sensor:o}=r,i=o.activators.map(c=>({eventName:c.eventName,handler:t(c.handler,r)}));return[...n,...i]},[]),[e,t])}var Ge;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(Ge||(Ge={}));var Vt;(function(e){e.Optimized="optimized"})(Vt||(Vt={}));const Dn=new Map;function Go(e,t){let{dragging:n,dependencies:r,config:o}=t;const[i,c]=h.useState(null),{frequency:l,measure:u,strategy:d}=o,g=h.useRef(e),f=w(),x=Ue(f),p=h.useCallback(function(C){C===void 0&&(C=[]),!x.current&&c(R=>R===null?C:R.concat(C.filter(T=>!R.includes(T))))},[x]),m=h.useRef(null),y=Ke(C=>{if(f&&!n)return Dn;if(!C||C===Dn||g.current!==e||i!=null){const R=new Map;for(let T of e){if(!T)continue;if(i&&i.length>0&&!i.includes(T.id)&&T.rect.current){R.set(T.id,T.rect.current);continue}const L=T.node.current,A=L?new nn(u(L),L):null;T.rect.current=A,A&&R.set(T.id,A)}return R}return C},[e,i,n,f,u]);return h.useEffect(()=>{g.current=e},[e]),h.useEffect(()=>{f||p()},[n,f]),h.useEffect(()=>{i&&i.length>0&&c(null)},[JSON.stringify(i)]),h.useEffect(()=>{f||typeof l!="number"||m.current!==null||(m.current=setTimeout(()=>{p(),m.current=null},l))},[l,f,p,...r]),{droppableRects:y,measureDroppableContainers:p,measuringScheduled:i!=null};function w(){switch(d){case Ge.Always:return!1;case Ge.BeforeDragging:return n;default:return!n}}}function or(e,t){return Ke(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function qo(e,t){return or(e,t)}function Xo(e){let{callback:t,disabled:n}=e;const r=Qt(t),o=h.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:i}=window;return new i(r)},[r,n]);return h.useEffect(()=>()=>o?.disconnect(),[o]),o}function St(e){let{callback:t,disabled:n}=e;const r=Qt(t),o=h.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:i}=window;return new i(r)},[n]);return h.useEffect(()=>()=>o?.disconnect(),[o]),o}function Ko(e){return new nn($e(e),e)}function jn(e,t,n){t===void 0&&(t=Ko);const[r,o]=h.useState(null);function i(){o(u=>{if(!e)return null;if(e.isConnected===!1){var d;return(d=u??n)!=null?d:null}const g=t(e);return JSON.stringify(u)===JSON.stringify(g)?u:g})}const c=Xo({callback(u){if(e)for(const d of u){const{type:g,target:f}=d;if(g==="childList"&&f instanceof HTMLElement&&f.contains(e)){i();break}}}}),l=St({callback:i});return ve(()=>{i(),e?(l?.observe(e),c?.observe(document.body,{childList:!0,subtree:!0})):(l?.disconnect(),c?.disconnect())},[e]),r}function Jo(e){const t=or(e);return Xn(e,t)}const Rn=[];function Zo(e){const t=h.useRef(e),n=Ke(r=>e?r&&r!==Rn&&e&&t.current&&e.parentNode===t.current.parentNode?r:tn(e):Rn,[e]);return h.useEffect(()=>{t.current=e},[e]),n}function Qo(e){const[t,n]=h.useState(null),r=h.useRef(e),o=h.useCallback(i=>{const c=_t(i.target);c&&n(l=>l?(l.set(c,Wt(c)),new Map(l)):null)},[]);return h.useEffect(()=>{const i=r.current;if(e!==i){c(i);const l=e.map(u=>{const d=_t(u);return d?(d.addEventListener("scroll",o,{passive:!0}),[d,Wt(d)]):null}).filter(u=>u!=null);n(l.length?new Map(l):null),r.current=e}return()=>{c(e),c(i)};function c(l){l.forEach(u=>{const d=_t(u);d?.removeEventListener("scroll",o)})}},[o,e]),h.useMemo(()=>e.length?t?Array.from(t.values()).reduce((i,c)=>Oe(i,c),he):tr(e):he,[e,t])}function Mn(e,t){t===void 0&&(t=[]);const n=h.useRef(null);return h.useEffect(()=>{n.current=null},t),h.useEffect(()=>{const r=e!==he;r&&!n.current&&(n.current=e),!r&&n.current&&(n.current=null)},[e]),n.current?pt(e,n.current):he}function es(e){h.useEffect(()=>{if(!yt)return;const t=e.map(n=>{let{sensor:r}=n;return r.setup==null?void 0:r.setup()});return()=>{for(const n of t)n?.()}},e.map(t=>{let{sensor:n}=t;return n}))}function ts(e,t){return h.useMemo(()=>e.reduce((n,r)=>{let{eventName:o,handler:i}=r;return n[o]=c=>{i(c,t)},n},{}),[e,t])}function sr(e){return h.useMemo(()=>e?jo(e):null,[e])}const Tn=[];function ns(e,t){t===void 0&&(t=$e);const[n]=e,r=sr(n?ie(n):null),[o,i]=h.useState(Tn);function c(){i(()=>e.length?e.map(u=>Qn(u)?r:new nn(t(u),u)):Tn)}const l=St({callback:c});return ve(()=>{l?.disconnect(),c(),e.forEach(u=>l?.observe(u))},[e]),o}function rs(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return Xe(t)?t:e}function os(e){let{measure:t}=e;const[n,r]=h.useState(null),o=h.useCallback(d=>{for(const{target:g}of d)if(Xe(g)){r(f=>{const x=t(g);return f?{...f,width:x.width,height:x.height}:x});break}},[t]),i=St({callback:o}),c=h.useCallback(d=>{const g=rs(d);i?.disconnect(),g&&i?.observe(g),r(g?t(g):null)},[t,i]),[l,u]=gt(c);return h.useMemo(()=>({nodeRef:l,rect:n,setRef:u}),[n,l,u])}const ss=[{sensor:on,options:{}},{sensor:rr,options:{}}],is={current:{}},ct={draggable:{measure:yn},droppable:{measure:yn,strategy:Ge.WhileDragging,frequency:Vt.Optimized},dragOverlay:{measure:$e}};class Ve 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 as={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Ve,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:vt},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:ct,measureDroppableContainers:vt,windowRect:null,measuringScheduled:!1},ls={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:vt,draggableNodes:new Map,over:null,measureDroppableContainers:vt},wt=h.createContext(ls),ir=h.createContext(as);function cs(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Ve}}}function us(e,t){switch(t.type){case Z.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case Z.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case Z.DragEnd:case Z.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case Z.RegisterDroppable:{const{element:n}=t,{id:r}=n,o=new Ve(e.droppable.containers);return o.set(r,n),{...e,droppable:{...e.droppable,containers:o}}}case Z.SetDroppableDisabled:{const{id:n,key:r,disabled:o}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;const c=new Ve(e.droppable.containers);return c.set(n,{...i,disabled:o}),{...e,droppable:{...e.droppable,containers:c}}}case Z.UnregisterDroppable:{const{id:n,key:r}=t,o=e.droppable.containers.get(n);if(!o||r!==o.key)return e;const i=new Ve(e.droppable.containers);return i.delete(n),{...e,droppable:{...e.droppable,containers:i}}}default:return e}}function ds(e){let{disabled:t}=e;const{active:n,activatorEvent:r,draggableNodes:o}=h.useContext(wt),i=Yt(r),c=Yt(n?.id);return h.useEffect(()=>{if(!t&&!r&&i&&c!=null){if(!en(i)||document.activeElement===i.target)return;const l=o.get(c);if(!l)return;const{activatorNode:u,node:d}=l;if(!u.current&&!d.current)return;requestAnimationFrame(()=>{for(const g of[u.current,d.current]){if(!g)continue;const f=eo(g);if(f){f.focus();break}}})}},[r,t,o,c,i]),null}function fs(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((o,i)=>i({transform:o,...r}),n):n}function hs(e){return h.useMemo(()=>({draggable:{...ct.draggable,...e?.draggable},droppable:{...ct.droppable,...e?.droppable},dragOverlay:{...ct.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function gs(e){let{activeNode:t,measure:n,initialRect:r,config:o=!0}=e;const i=h.useRef(!1),{x:c,y:l}=typeof o=="boolean"?{x:o,y:o}:o;ve(()=>{if(!c&&!l||!t){i.current=!1;return}if(i.current||!r)return;const d=t?.node.current;if(!d||d.isConnected===!1)return;const g=n(d),f=Xn(g,r);if(c||(f.x=0),l||(f.y=0),i.current=!0,Math.abs(f.x)>0||Math.abs(f.y)>0){const x=Kn(d);x&&x.scrollBy({top:f.y,left:f.x})}},[t,c,l,r,n])}const ar=h.createContext({...he,scaleX:1,scaleY:1});var De;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(De||(De={}));const lr=h.memo(function(t){var n,r,o,i;let{id:c,accessibility:l,autoScroll:u=!0,children:d,sensors:g=ss,collisionDetection:f=xo,measuring:x,modifiers:p,...m}=t;const y=h.useReducer(us,void 0,cs),[w,C]=y,[R,T]=io(),[L,A]=h.useState(De.Uninitialized),_=L===De.Initialized,{draggable:{active:$,nodes:N,translate:H},droppable:{containers:k}}=w,S=$!=null?N.get($):null,W=h.useRef({initial:null,translated:null}),V=h.useMemo(()=>{var re;return $!=null?{id:$,data:(re=S?.data)!=null?re:is,rect:W}:null},[$,S]),I=h.useRef(null),[M,D]=h.useState(null),[E,j]=h.useState(null),P=Ue(m,Object.values(m)),F=Je("DndDescribedBy",c),v=h.useMemo(()=>k.getEnabled(),[k]),O=hs(x),{droppableRects:z,measureDroppableContainers:B,measuringScheduled:q}=Go(v,{dragging:_,dependencies:[H.x,H.y],config:O.droppable}),X=Vo(N,$),U=h.useMemo(()=>E?Bt(E):null,[E]),K=Ur(),J=qo(X,O.draggable.measure);gs({activeNode:$!=null?N.get($):null,config:K.layoutShiftCompensation,initialRect:J,measure:O.draggable.measure});const Y=jn(X,O.draggable.measure,J),se=jn(X?X.parentElement:null),ne=h.useRef({activatorEvent:null,active:null,activeNode:X,collisionRect:null,collisions:null,droppableRects:z,draggableNodes:N,draggingNode:null,draggingNodeRect:null,droppableContainers:k,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),fe=k.getNodeFor((n=ne.current.over)==null?void 0:n.id),me=os({measure:O.dragOverlay.measure}),je=(r=me.nodeRef.current)!=null?r:X,Re=_?(o=me.rect)!=null?o:Y:null,an=!!(me.nodeRef.current&&me.rect),ln=Jo(an?null:Y),Mt=sr(je?ie(je):null),be=Zo(_?fe??X:null),Qe=ns(be),et=fs(p,{transform:{x:H.x-ln.x,y:H.y-ln.y,scaleX:1,scaleY:1},activatorEvent:E,active:V,activeNodeRect:Y,containerNodeRect:se,draggingNodeRect:Re,over:ne.current.over,overlayNodeRect:me.rect,scrollableAncestors:be,scrollableAncestorRects:Qe,windowRect:Mt}),cn=U?Oe(U,H):null,un=Qo(be),zr=Mn(un),Fr=Mn(un,[Y]),Me=Oe(et,zr),Te=Re?So(Re,et):null,Le=V&&Te?f({active:V,collisionRect:Te,droppableRects:z,droppableContainers:v,pointerCoordinates:cn}):null,dn=vo(Le,"id"),[ye,fn]=h.useState(null),Yr=an?et:Oe(et,Fr),Br=bo(Yr,(i=ye?.rect)!=null?i:null,Y),Tt=h.useRef(null),hn=h.useCallback((re,ae)=>{let{sensor:le,options:Se}=ae;if(I.current==null)return;const ue=N.get(I.current);if(!ue)return;const ce=re.nativeEvent,ge=new le({active:I.current,activeNode:ue,event:ce,options:Se,context:ne,onAbort(ee){if(!N.get(ee))return;const{onDragAbort:pe}=P.current,xe={id:ee};pe?.(xe),R({type:"onDragAbort",event:xe})},onPending(ee,we,pe,xe){if(!N.get(ee))return;const{onDragPending:Ne}=P.current,Ce={id:ee,constraint:we,initialCoordinates:pe,offset:xe};Ne?.(Ce),R({type:"onDragPending",event:Ce})},onStart(ee){const we=I.current;if(we==null)return;const pe=N.get(we);if(!pe)return;const{onDragStart:xe}=P.current,Pe={activatorEvent:ce,active:{id:we,data:pe.data,rect:W}};Be.unstable_batchedUpdates(()=>{xe?.(Pe),A(De.Initializing),C({type:Z.DragStart,initialCoordinates:ee,active:we}),R({type:"onDragStart",event:Pe}),D(Tt.current),j(ce)})},onMove(ee){C({type:Z.DragMove,coordinates:ee})},onEnd:Ee(Z.DragEnd),onCancel:Ee(Z.DragCancel)});Tt.current=ge;function Ee(ee){return async function(){const{active:pe,collisions:xe,over:Pe,scrollAdjustedTranslate:Ne}=ne.current;let Ce=null;if(pe&&Ne){const{cancelDrop:ze}=P.current;Ce={activatorEvent:ce,active:pe,collisions:xe,delta:Ne,over:Pe},ee===Z.DragEnd&&typeof ze=="function"&&await Promise.resolve(ze(Ce))&&(ee=Z.DragCancel)}I.current=null,Be.unstable_batchedUpdates(()=>{C({type:ee}),A(De.Uninitialized),fn(null),D(null),j(null),Tt.current=null;const ze=ee===Z.DragEnd?"onDragEnd":"onDragCancel";if(Ce){const Et=P.current[ze];Et?.(Ce),R({type:ze,event:Ce})}})}}},[N]),Wr=h.useCallback((re,ae)=>(le,Se)=>{const ue=le.nativeEvent,ce=N.get(Se);if(I.current!==null||!ce||ue.dndKit||ue.defaultPrevented)return;const ge={active:ce};re(le,ae.options,ge)===!0&&(ue.dndKit={capturedBy:ae.sensor},I.current=Se,hn(le,ae))},[N,hn]),gn=Uo(g,Wr);es(g),ve(()=>{Y&&L===De.Initializing&&A(De.Initialized)},[Y,L]),h.useEffect(()=>{const{onDragMove:re}=P.current,{active:ae,activatorEvent:le,collisions:Se,over:ue}=ne.current;if(!ae||!le)return;const ce={active:ae,activatorEvent:le,collisions:Se,delta:{x:Me.x,y:Me.y},over:ue};Be.unstable_batchedUpdates(()=>{re?.(ce),R({type:"onDragMove",event:ce})})},[Me.x,Me.y]),h.useEffect(()=>{const{active:re,activatorEvent:ae,collisions:le,droppableContainers:Se,scrollAdjustedTranslate:ue}=ne.current;if(!re||I.current==null||!ae||!ue)return;const{onDragOver:ce}=P.current,ge=Se.get(dn),Ee=ge&&ge.rect.current?{id:ge.id,rect:ge.rect.current,data:ge.data,disabled:ge.disabled}:null,ee={active:re,activatorEvent:ae,collisions:le,delta:{x:ue.x,y:ue.y},over:Ee};Be.unstable_batchedUpdates(()=>{fn(Ee),ce?.(ee),R({type:"onDragOver",event:ee})})},[dn]),ve(()=>{ne.current={activatorEvent:E,active:V,activeNode:X,collisionRect:Te,collisions:Le,droppableRects:z,draggableNodes:N,draggingNode:je,draggingNodeRect:Re,droppableContainers:k,over:ye,scrollableAncestors:be,scrollAdjustedTranslate:Me},W.current={initial:Re,translated:Te}},[V,X,Le,Te,N,je,Re,z,k,ye,be,Me]),Bo({...K,delta:H,draggingRect:Te,pointerCoordinates:cn,scrollableAncestors:be,scrollableAncestorRects:Qe});const Hr=h.useMemo(()=>({active:V,activeNode:X,activeNodeRect:Y,activatorEvent:E,collisions:Le,containerNodeRect:se,dragOverlay:me,draggableNodes:N,droppableContainers:k,droppableRects:z,over:ye,measureDroppableContainers:B,scrollableAncestors:be,scrollableAncestorRects:Qe,measuringConfiguration:O,measuringScheduled:q,windowRect:Mt}),[V,X,Y,E,Le,se,me,N,k,z,ye,B,be,Qe,O,q,Mt]),Vr=h.useMemo(()=>({activatorEvent:E,activators:gn,active:V,activeNodeRect:Y,ariaDescribedById:{draggable:F},dispatch:C,draggableNodes:N,over:ye,measureDroppableContainers:B}),[E,gn,V,Y,C,F,N,ye,B]);return h.createElement(Gn.Provider,{value:T},h.createElement(wt.Provider,{value:Vr},h.createElement(ir.Provider,{value:Hr},h.createElement(ar.Provider,{value:Br},d)),h.createElement(ds,{disabled:l?.restoreFocus===!1})),h.createElement(co,{...l,hiddenTextDescribedById:F}));function Ur(){const re=M?.autoScrollEnabled===!1,ae=typeof u=="object"?u.enabled===!1:u===!1,le=_&&!re&&!ae;return typeof u=="object"?{...u,enabled:le}:{enabled:le}}}),ps=h.createContext(null),En="button",vs="Draggable";function ms(e){let{id:t,data:n,disabled:r=!1,attributes:o}=e;const i=Je(vs),{activators:c,activatorEvent:l,active:u,activeNodeRect:d,ariaDescribedById:g,draggableNodes:f,over:x}=h.useContext(wt),{role:p=En,roleDescription:m="draggable",tabIndex:y=0}=o??{},w=u?.id===t,C=h.useContext(w?ar:ps),[R,T]=gt(),[L,A]=gt(),_=ts(c,t),$=Ue(n);ve(()=>(f.set(t,{id:t,key:i,node:R,activatorNode:L,data:$}),()=>{const H=f.get(t);H&&H.key===i&&f.delete(t)}),[f,t]);const N=h.useMemo(()=>({role:p,tabIndex:y,"aria-disabled":r,"aria-pressed":w&&p===En?!0:void 0,"aria-roledescription":m,"aria-describedby":g.draggable}),[r,p,y,w,m,g.draggable]);return{active:u,activatorEvent:l,activeNodeRect:d,attributes:N,isDragging:w,listeners:r?void 0:_,node:R,over:x,setNodeRef:T,setActivatorNodeRef:A,transform:C}}function xs(){return h.useContext(ir)}const bs="Droppable",ys={timeout:25};function Ss(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:o}=e;const i=Je(bs),{active:c,dispatch:l,over:u,measureDroppableContainers:d}=h.useContext(wt),g=h.useRef({disabled:n}),f=h.useRef(!1),x=h.useRef(null),p=h.useRef(null),{disabled:m,updateMeasurementsFor:y,timeout:w}={...ys,...o},C=Ue(y??r),R=h.useCallback(()=>{if(!f.current){f.current=!0;return}p.current!=null&&clearTimeout(p.current),p.current=setTimeout(()=>{d(Array.isArray(C.current)?C.current:[C.current]),p.current=null},w)},[w]),T=St({callback:R,disabled:m||!c}),L=h.useCallback((N,H)=>{T&&(H&&(T.unobserve(H),f.current=!1),N&&T.observe(N))},[T]),[A,_]=gt(L),$=Ue(t);return h.useEffect(()=>{!T||!A.current||(T.disconnect(),f.current=!1,T.observe(A.current))},[A,T]),h.useEffect(()=>(l({type:Z.RegisterDroppable,element:{id:r,key:i,disabled:n,node:A,rect:x,data:$}}),()=>l({type:Z.UnregisterDroppable,key:i,id:r})),[r]),h.useEffect(()=>{n!==g.current.disabled&&(l({type:Z.SetDroppableDisabled,id:r,key:i,disabled:n}),g.current.disabled=n)},[r,i,n,l]),{active:c,rect:x,isOver:u?.id===r,node:A,over:u,setNodeRef:_}}function Ct(e,t,n){const r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function ws(e,t){return e.reduce((n,r,o)=>{const i=t.get(r);return i&&(n[o]=i),n},Array(e.length))}function nt(e){return e!==null&&e>=0}function Cs(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 Ds(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const rt={scaleX:1,scaleY:1},js=e=>{var t;let{rects:n,activeNodeRect:r,activeIndex:o,overIndex:i,index:c}=e;const l=(t=n[o])!=null?t:r;if(!l)return null;const u=Rs(n,c,o);if(c===o){const d=n[i];return d?{x:o<i?d.left+d.width-(l.left+l.width):d.left-l.left,y:0,...rt}:null}return c>o&&c<=i?{x:-l.width-u,y:0,...rt}:c<o&&c>=i?{x:l.width+u,y:0,...rt}:{x:0,y:0,...rt}};function Rs(e,t,n){const r=e[t],o=e[t-1],i=e[t+1];return!r||!o&&!i?0:n<t?o?r.left-(o.left+o.width):i.left-(r.left+r.width):i?i.left-(r.left+r.width):r.left-(o.left+o.width)}const cr=e=>{let{rects:t,activeIndex:n,overIndex:r,index:o}=e;const i=Ct(t,r,n),c=t[o],l=i[o];return!l||!c?null:{x:l.left-c.left,y:l.top-c.top,scaleX:l.width/c.width,scaleY:l.height/c.height}},ot={scaleX:1,scaleY:1},Ms=e=>{var t;let{activeIndex:n,activeNodeRect:r,index:o,rects:i,overIndex:c}=e;const l=(t=i[n])!=null?t:r;if(!l)return null;if(o===n){const d=i[c];return d?{x:0,y:n<c?d.top+d.height-(l.top+l.height):d.top-l.top,...ot}:null}const u=Ts(i,o,n);return o>n&&o<=c?{x:0,y:-l.height-u,...ot}:o<n&&o>=c?{x:0,y:l.height+u,...ot}:{x:0,y:0,...ot}};function Ts(e,t,n){const r=e[t],o=e[t-1],i=e[t+1];return r?n<t?o?r.top-(o.top+o.height):i?i.top-(r.top+r.height):0:i?i.top-(r.top+r.height):o?r.top-(o.top+o.height):0:0}const ur="Sortable",dr=h.createContext({activeIndex:-1,containerId:ur,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:cr,disabled:{draggable:!1,droppable:!1}});function fr(e){let{children:t,id:n,items:r,strategy:o=cr,disabled:i=!1}=e;const{active:c,dragOverlay:l,droppableRects:u,over:d,measureDroppableContainers:g}=xs(),f=Je(ur,n),x=l.rect!==null,p=h.useMemo(()=>r.map(_=>typeof _=="object"&&"id"in _?_.id:_),[r]),m=c!=null,y=c?p.indexOf(c.id):-1,w=d?p.indexOf(d.id):-1,C=h.useRef(p),R=!Cs(p,C.current),T=w!==-1&&y===-1||R,L=Ds(i);ve(()=>{R&&m&&g(p)},[R,p,m,g]),h.useEffect(()=>{C.current=p},[p]);const A=h.useMemo(()=>({activeIndex:y,containerId:f,disabled:L,disableTransforms:T,items:p,overIndex:w,useDragOverlay:x,sortedRects:ws(p,u),strategy:o}),[y,f,L.draggable,L.droppable,T,p,w,u,x,o]);return h.createElement(dr.Provider,{value:A},t)}const Es=e=>{let{id:t,items:n,activeIndex:r,overIndex:o}=e;return Ct(n,r,o).indexOf(t)},Os=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:o,items:i,newIndex:c,previousItems:l,previousContainerId:u,transition:d}=e;return!d||!r||l!==i&&o===c?!1:n?!0:c!==o&&t===u},_s={duration:200,easing:"ease"},hr="transform",ks=_e.Transition.toString({property:hr,duration:0,easing:"linear"}),Is={roleDescription:"sortable"};function $s(e){let{disabled:t,index:n,node:r,rect:o}=e;const[i,c]=h.useState(null),l=h.useRef(n);return ve(()=>{if(!t&&n!==l.current&&r.current){const u=o.current;if(u){const d=$e(r.current,{ignoreTransform:!0}),g={x:u.left-d.left,y:u.top-d.top,scaleX:u.width/d.width,scaleY:u.height/d.height};(g.x||g.y)&&c(g)}}n!==l.current&&(l.current=n)},[t,n,r,o]),h.useEffect(()=>{i&&c(null)},[i]),i}function gr(e){let{animateLayoutChanges:t=Os,attributes:n,disabled:r,data:o,getNewIndex:i=Es,id:c,strategy:l,resizeObserverConfig:u,transition:d=_s}=e;const{items:g,containerId:f,activeIndex:x,disabled:p,disableTransforms:m,sortedRects:y,overIndex:w,useDragOverlay:C,strategy:R}=h.useContext(dr),T=As(r,p),L=g.indexOf(c),A=h.useMemo(()=>({sortable:{containerId:f,index:L,items:g},...o}),[f,o,L,g]),_=h.useMemo(()=>g.slice(g.indexOf(c)),[g,c]),{rect:$,node:N,isOver:H,setNodeRef:k}=Ss({id:c,data:A,disabled:T.droppable,resizeObserverConfig:{updateMeasurementsFor:_,...u}}),{active:S,activatorEvent:W,activeNodeRect:V,attributes:I,setNodeRef:M,listeners:D,isDragging:E,over:j,setActivatorNodeRef:P,transform:F}=ms({id:c,data:A,attributes:{...Is,...n},disabled:T.draggable}),v=Kr(k,M),O=!!S,z=O&&!m&&nt(x)&&nt(w),B=!C&&E,q=B&&z?F:null,U=z?q??(l??R)({rects:y,activeNodeRect:V,activeIndex:x,overIndex:w,index:L}):null,K=nt(x)&&nt(w)?i({id:c,items:g,activeIndex:x,overIndex:w}):L,J=S?.id,Y=h.useRef({activeId:J,items:g,newIndex:K,containerId:f}),se=g!==Y.current.items,ne=t({active:S,containerId:f,isDragging:E,isSorting:O,id:c,index:L,items:g,newIndex:Y.current.newIndex,previousItems:Y.current.items,previousContainerId:Y.current.containerId,transition:d,wasDragging:Y.current.activeId!=null}),fe=$s({disabled:!ne,index:L,node:N,rect:$});return h.useEffect(()=>{O&&Y.current.newIndex!==K&&(Y.current.newIndex=K),f!==Y.current.containerId&&(Y.current.containerId=f),g!==Y.current.items&&(Y.current.items=g)},[O,K,f,g]),h.useEffect(()=>{if(J===Y.current.activeId)return;if(J!=null&&Y.current.activeId==null){Y.current.activeId=J;return}const je=setTimeout(()=>{Y.current.activeId=J},50);return()=>clearTimeout(je)},[J]),{active:S,activeIndex:x,attributes:I,data:A,rect:$,index:L,newIndex:K,items:g,isOver:H,isSorting:O,isDragging:E,listeners:D,node:N,overIndex:w,over:j,setNodeRef:v,setActivatorNodeRef:P,setDroppableNodeRef:k,setDraggableNodeRef:M,transform:fe??U,transition:me()};function me(){if(fe||se&&Y.current.newIndex===L)return ks;if(!(B&&!en(W)||!d)&&(O||ne))return _e.Transition.toString({...d,property:hr})}}function As(e,t){var n,r;return typeof e=="boolean"?{draggable:e,droppable:!1}:{draggable:(n=e?.draggable)!=null?n:t.draggable,droppable:(r=e?.droppable)!=null?r:t.droppable}}G.Down,G.Right,G.Up,G.Left;var st={exports:{}},$t={},it={exports:{}},At={};var On;function Ls(){if(On)return At;On=1;var e=h;function t(f,x){return f===x&&(f!==0||1/f===1/x)||f!==f&&x!==x}var n=typeof Object.is=="function"?Object.is:t,r=e.useState,o=e.useEffect,i=e.useLayoutEffect,c=e.useDebugValue;function l(f,x){var p=x(),m=r({inst:{value:p,getSnapshot:x}}),y=m[0].inst,w=m[1];return i(function(){y.value=p,y.getSnapshot=x,u(y)&&w({inst:y})},[f,p,x]),o(function(){return u(y)&&w({inst:y}),f(function(){u(y)&&w({inst:y})})},[f]),c(p),p}function u(f){var x=f.getSnapshot;f=f.value;try{var p=x();return!n(f,p)}catch{return!0}}function d(f,x){return x()}var g=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?d:l;return At.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:g,At}var Lt={};var _n;function Ps(){return _n||(_n=1,process.env.NODE_ENV!=="production"&&(function(){function e(p,m){return p===m&&(p!==0||1/p===1/m)||p!==p&&m!==m}function t(p,m){g||o.startTransition===void 0||(g=!0,console.error("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));var y=m();if(!f){var w=m();i(y,w)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),f=!0)}w=c({inst:{value:y,getSnapshot:m}});var C=w[0].inst,R=w[1];return u(function(){C.value=y,C.getSnapshot=m,n(C)&&R({inst:C})},[p,y,m]),l(function(){return n(C)&&R({inst:C}),p(function(){n(C)&&R({inst:C})})},[p]),d(y),y}function n(p){var m=p.getSnapshot;p=p.value;try{var y=m();return!i(p,y)}catch{return!0}}function r(p,m){return m()}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var o=h,i=typeof Object.is=="function"?Object.is:e,c=o.useState,l=o.useEffect,u=o.useLayoutEffect,d=o.useDebugValue,g=!1,f=!1,x=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?r:t;Lt.useSyncExternalStore=o.useSyncExternalStore!==void 0?o.useSyncExternalStore:x,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()),Lt}var kn;function pr(){return kn||(kn=1,process.env.NODE_ENV==="production"?it.exports=Ls():it.exports=Ps()),it.exports}var In;function Ns(){if(In)return $t;In=1;var e=h,t=pr();function n(d,g){return d===g&&(d!==0||1/d===1/g)||d!==d&&g!==g}var r=typeof Object.is=="function"?Object.is:n,o=t.useSyncExternalStore,i=e.useRef,c=e.useEffect,l=e.useMemo,u=e.useDebugValue;return $t.useSyncExternalStoreWithSelector=function(d,g,f,x,p){var m=i(null);if(m.current===null){var y={hasValue:!1,value:null};m.current=y}else y=m.current;m=l(function(){function C(_){if(!R){if(R=!0,T=_,_=x(_),p!==void 0&&y.hasValue){var $=y.value;if(p($,_))return L=$}return L=_}if($=L,r(T,_))return $;var N=x(_);return p!==void 0&&p($,N)?(T=_,$):(T=_,L=N)}var R=!1,T,L,A=f===void 0?null:f;return[function(){return C(g())},A===null?void 0:function(){return C(A())}]},[g,f,x,p]);var w=o(d,m[0],m[1]);return c(function(){y.hasValue=!0,y.value=w},[w]),u(w),w},$t}var Pt={};var $n;function zs(){return $n||($n=1,process.env.NODE_ENV!=="production"&&(function(){function e(d,g){return d===g&&(d!==0||1/d===1/g)||d!==d&&g!==g}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var t=h,n=pr(),r=typeof Object.is=="function"?Object.is:e,o=n.useSyncExternalStore,i=t.useRef,c=t.useEffect,l=t.useMemo,u=t.useDebugValue;Pt.useSyncExternalStoreWithSelector=function(d,g,f,x,p){var m=i(null);if(m.current===null){var y={hasValue:!1,value:null};m.current=y}else y=m.current;m=l(function(){function C(_){if(!R){if(R=!0,T=_,_=x(_),p!==void 0&&y.hasValue){var $=y.value;if(p($,_))return L=$}return L=_}if($=L,r(T,_))return $;var N=x(_);return p!==void 0&&p($,N)?(T=_,$):(T=_,L=N)}var R=!1,T,L,A=f===void 0?null:f;return[function(){return C(g())},A===null?void 0:function(){return C(A())}]},[g,f,x,p]);var w=o(d,m[0],m[1]);return c(function(){y.hasValue=!0,y.value=w},[w]),u(w),w},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()),Pt}var An;function Fs(){return An||(An=1,process.env.NODE_ENV==="production"?st.exports=Ns():st.exports=zs()),st.exports}var Ys=Fs();const Ut=new WeakMap,Bs=new WeakMap,xt={current:[]};let Nt=!1;const at=new Set,Ln=new Map;function vr(e){for(const t of e){if(xt.current.includes(t))continue;xt.current.push(t),t.recompute();const n=Bs.get(t);if(n)for(const r of n){const o=Ut.get(r);o?.length&&vr(o)}}}function Ws(e){const t={prevVal:e.prevState,currentVal:e.state};for(const n of e.listeners)n(t)}function Hs(e){const t={prevVal:e.prevState,currentVal:e.state};for(const n of e.listeners)n(t)}function Vs(e){if(at.add(e),!Nt)try{for(Nt=!0;at.size>0;){const t=Array.from(at);at.clear();for(const n of t){const r=Ln.get(n)??n.prevState;n.prevState=r,Ws(n)}for(const n of t){const r=Ut.get(n);r&&(xt.current.push(n),vr(r))}for(const n of t){const r=Ut.get(n);if(r)for(const o of r)Hs(o)}}}finally{Nt=!1,xt.current=[],Ln.clear()}}function Us(e){return typeof e=="function"}class mr{constructor(t,n){this.listeners=new Set,this.subscribe=r=>{var o,i;this.listeners.add(r);const c=(i=(o=this.options)==null?void 0:o.onSubscribe)==null?void 0:i.call(o,r,this);return()=>{this.listeners.delete(r),c?.()}},this.prevState=t,this.state=t,this.options=n}setState(t){var n,r,o;this.prevState=this.state,(n=this.options)!=null&&n.updateFn?this.state=this.options.updateFn(this.prevState)(t):Us(t)?this.state=t(this.prevState):this.state=t,(o=(r=this.options)==null?void 0:r.onUpdate)==null||o.call(r),Vs(this)}}function Ae(e,t=r=>r,n={}){const r=n.equal??Gs;return Ys.useSyncExternalStoreWithSelector(e.subscribe,()=>e.state,()=>e.state,t,r)}function Gs(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[r,o]of e)if(!t.has(r)||!Object.is(o,t.get(r)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const r of e)if(!t.has(r))return!1;return!0}if(e instanceof Date&&t instanceof Date)return e.getTime()===t.getTime();const n=Pn(e);if(n.length!==Pn(t).length)return!1;for(let r=0;r<n.length;r++)if(!Object.prototype.hasOwnProperty.call(t,n[r])||!Object.is(e[n[r]],t[n[r]]))return!1;return!0}function Pn(e){return Object.keys(e).concat(Object.getOwnPropertySymbols(e))}const te=new mr({tableId:"",sortColumn:null,sortDirection:"asc",visibility:{},columnOrder:[],columnWidths:{},data:[],sortableColumns:[],actionsConfig:{showActionColumn:!0,showColumnVisibilityMenu:!0,children:"Actions",width:"100px"}}),Dt=e=>`datatable:${e}:column-widths`;function xr(e,t){const n=e[0]??{},o=(t&&t.length?t:Object.keys(n).map(f=>({id:f,label:f}))).filter(f=>Object.prototype.hasOwnProperty.call(n,f.id)),{tableId:i}=te.state,c=JSON.parse(localStorage.getItem(Sr(i))||"[]"),l=[...c.map(f=>o.find(x=>x.id===f)).filter(Boolean),...o.filter(f=>!c.includes(f.id))],u=JSON.parse(localStorage.getItem(wr(i))||"{}"),d=l.reduce((f,x)=>(f[x.id]=u[x.id]??!0,f),{}),g=JSON.parse(localStorage.getItem(Dt(i))||"{}");te.setState(f=>({...f,data:e,columnOrder:l,visibility:d,columnWidths:g,sortableColumns:l.map(x=>({id:x.id,label:x.label,sortable:!0,backgroundColor:x.backgroundColor}))}))}function br(e){te.setState(t=>({...t,tableId:e,sortColumn:null,sortDirection:"asc",columnOrder:[],visibility:{}}))}const yr=e=>{te.setState(t=>({...t,actionsConfig:e}))};function qs(e,t){te.setState(n=>{const r={...n.columnWidths,[e]:Math.max(60,t)};return localStorage.setItem(Dt(n.tableId),JSON.stringify(r)),{...n,columnWidths:r}})}const Sr=e=>`table_column_order_v1:${e}`,wr=e=>`table_column_visibility_v1:${e}`,Xs=e=>{const{tableId:t}=te.state;localStorage.setItem(Sr(t),JSON.stringify(e.map(n=>n.id))),te.setState(n=>({...n,columnOrder:e})),te.setState(n=>({...n,columnOrder:e}))};function Ks(e){te.setState(t=>t.sortColumn===e?{...t,sortDirection:t.sortDirection==="asc"?"desc":"asc"}:{...t,sortColumn:e,sortDirection:"asc"})}const Js=e=>{te.setState(t=>{const n={...t.visibility,[e]:!t.visibility[e]};return t.tableId&&localStorage.setItem(wr(t.tableId),JSON.stringify(n)),{...t,visibility:n}})};function Zs(e,t){te.setState(n=>{const r={...n.columnWidths,[e]:Math.max(60,t)};return localStorage.setItem(Dt(n.tableId),JSON.stringify(r)),{...n,columnWidths:r}})}const Qs=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),ei=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,r)=>r?r.toUpperCase():n.toLowerCase()),Nn=e=>{const t=ei(e);return t.charAt(0).toUpperCase()+t.slice(1)},Cr=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim(),ti=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0};var ni={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 ri=h.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:o="",children:i,iconNode:c,...l},u)=>h.createElement("svg",{ref:u,...ni,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:Cr("lucide",o),...!i&&!ti(l)&&{"aria-hidden":"true"},...l},[...c.map(([d,g])=>h.createElement(d,g)),...Array.isArray(i)?i:[i]]));const oe=(e,t)=>{const n=h.forwardRef(({className:r,...o},i)=>h.createElement(ri,{ref:i,iconNode:t,className:Cr(`lucide-${Qs(Nn(e))}`,`lucide-${e}`,r),...o}));return n.displayName=Nn(e),n};const oi=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],si=oe("arrow-down",oi);const ii=[["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"}]],ai=oe("arrow-up-down",ii);const li=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],ci=oe("arrow-up",li);const ui=[["path",{d:"m19 21-7-4-7 4V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v16z",key:"1fy3hk"}]],di=oe("bookmark",ui);const fi=[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]],Dr=oe("calendar",fi);const hi=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],gi=oe("chevron-left",hi);const pi=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],vi=oe("chevron-right",pi);const mi=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 3v18",key:"108xh3"}]],xi=oe("columns-2",mi);const bi=[["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"}]],yi=oe("delete",bi);const Si=[["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"}]],wi=oe("ellipsis",Si);const Ci=[["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"}]],Di=oe("funnel",Ci);const ji=[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]],jr=oe("grip-vertical",ji);const Ri=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]],Mi=oe("pen",Ri);const Ti=[["path",{d:"M21 12a9 9 0 0 0-9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"14sxne"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M3 12a9 9 0 0 0 9 9 9.75 9.75 0 0 0 6.74-2.74L21 16",key:"1hlbsb"}],["path",{d:"M16 16h5v5",key:"ccwih5"}]],Ei=oe("refresh-ccw",Ti);const Oi=[["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"}]],_i=oe("settings",Oi);const ki=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],Rr=oe("triangle-alert",ki);function b(e){return h.forwardRef((t,n)=>{const{children:r,...o}=t;return s.jsx(e,{ref:n,...o,children:r})})}const Ii=b(a.Menu.Trigger),$i=b(a.Menu.Positioner),Ai=b(a.Menu.Content),Li=b(a.Menu.Item),Pi=b(a.Checkbox.Label),Ni=b(a.Checkbox.HiddenInput),zi=b(a.Checkbox.Control);function Fi({visibility:e,onToggle:t}){const{sortableColumns:n}=Ae(te);return s.jsxs(a.Menu.Root,{closeOnSelect:!1,children:[s.jsx(Ii,{asChild:!0,children:s.jsx(a.IconButton,{"aria-label":"Toggle columns",variant:"ghost",ml:"1",size:"xs",children:s.jsx(xi,{size:18})})}),s.jsx(a.Portal,{children:s.jsx($i,{children:s.jsx(Ai,{minW:"220px",children:n.map(r=>{const o=!!e[r.id];return s.jsx(Li,{value:r.id,closeOnSelect:!1,children:s.jsxs(a.Checkbox.Root,{checked:o,onCheckedChange:()=>t(r.id),children:[s.jsx(Ni,{}),s.jsx(zi,{}),s.jsx(Pi,{children:r.label})]})},r.id)})})})})]})}function Yi({id:e,children:t,onClick:n,cursor:r,borderRight:o,backgroundColor:i}){const{columnWidths:c}=Ae(te),l=c[e],u=h.useRef(0),d=h.useRef(0),{setNodeRef:g,attributes:f,listeners:x,transform:p,transition:m}=gr({id:e}),y=w=>{w.stopPropagation(),u.current=w.clientX,d.current=l??150;const C=T=>{Zs(e,d.current+(T.clientX-u.current))},R=()=>{document.removeEventListener("mousemove",C),document.removeEventListener("mouseup",R)};document.addEventListener("mousemove",C),document.addEventListener("mouseup",R)};return s.jsx(a.Table.ColumnHeader,{ref:g,onClick:n,backgroundColor:i,w:l?`${l}px`:void 0,minW:"60px",style:{transform:_e.Transform.toString(p),transition:m,cursor:r,borderRight:o},...f,children:s.jsxs(a.HStack,{position:"relative",children:[s.jsx("span",{...x,children:s.jsx(jr,{size:12,style:{cursor:"grab"}})}),t,s.jsx(a.Box,{position:"absolute",right:0,top:0,h:"100%",w:"5px",cursor:"col-resize",background:"gray.400",onMouseDown:y,_hover:{bg:"gray.600"}})]})})}function Bi(){const{columnOrder:e,visibility:t,sortColumn:n,sortDirection:r,sortableColumns:o,actionsConfig:i}=Ae(te),c=e.map(l=>o.find(u=>u.id===l.id)).filter(l=>l!==void 0).filter(l=>t[l.id]);return s.jsx(a.Table.Header,{background:"blue.200",position:"sticky",top:0,p:"0",zIndex:1,children:s.jsxs(a.Table.Row,{height:"28px",children:[i?.showSNo&&s.jsx(a.Table.ColumnHeader,{width:"20px",textAlign:"center",backgroundColor:i.backgroundColor,borderRight:"2px solid #dcdcdc",children:i.indexChildren||"S.No"}),c.map(l=>{const u=n===l?.id;return s.jsx(Yi,{id:l?.id,onClick:()=>l?.sortable&&Ks(l?.id),borderRight:"2px solid #dcdcdc",backgroundColor:l?.backgroundColor,children:s.jsxs("span",{style:{display:"flex",alignItems:"center",gap:6,userSelect:"none"},children:[l?.label,l?.sortable&&(u?r==="asc"?s.jsx(ci,{size:14}):s.jsx(si,{size:14}):s.jsx(ai,{size:14,opacity:.4}))]})},l?.id)}),i?.showActionColumn&&s.jsx(a.Table.ColumnHeader,{width:i.width,backgroundColor:i.backgroundColor,borderRight:"2px solid #dcdcdc",children:i.children||"Actions"}),i?.showColumnVisibilityMenu&&s.jsx(a.Table.ColumnHeader,{boxSize:"0.5",backgroundColor:i.backgroundColorColumnVisibilityMenu,children:s.jsx(Fi,{visibility:t,onToggle:Js})})]})})}const Wi=[10,20,50,100],Hi=b(a.Select.Positioner),Vi=b(a.Select.Content),Ui=b(a.Select.Item),Gi=b(a.Pagination.PrevTrigger),qi=b(a.Pagination.NextTrigger),Xi=b(a.Select.HiddenSelect),Ki=b(a.Select.Control),Ji=b(a.Select.Trigger),Zi=b(a.Select.ValueText),Qi=b(a.Select.IndicatorGroup),ea=b(a.Select.Indicator);function ta({totalCount:e,pageSize:t,currentPage:n,onPageChange:r,onPageSizeChange:o,siblingCount:i=2,pageSizeOptions:c=Wi}){const l=a.createListCollection({items:c.map(u=>({label:String(u),value:String(u)}))});return s.jsx(a.Box,{width:"100%",children:s.jsxs(a.HStack,{justify:"space-between",mx:"auto",flexWrap:"wrap",children:[s.jsxs(a.HStack,{children:[s.jsx(a.Text,{fontSize:"sm",color:"gray.600",_dark:{color:"gray.400"},children:"Rows per page:"}),s.jsxs(a.Select.Root,{collection:l,size:"sm",width:"60px",onValueChange:u=>o?.(Number(u.items[0].value)),value:[String(t)],children:[s.jsx(Xi,{}),s.jsxs(Ki,{children:[s.jsx(Ji,{children:s.jsx(Zi,{placeholder:""})}),s.jsx(Qi,{children:s.jsx(ea,{})})]}),s.jsx(a.Portal,{children:s.jsx(Hi,{children:s.jsx(Vi,{children:l.items.map(u=>s.jsxs(Ui,{item:u.value,children:[u.label,s.jsx(a.Select.ItemIndicator,{})]},u.value))})})})]}),s.jsxs(a.Text,{fontSize:"sm",color:"gray.600",_dark:{color:"gray.400"},children:["of ",e]})]}),s.jsx(a.Pagination.Root,{count:e,pageSize:t,page:n,siblingCount:i,onPageChange:u=>r&&r(u.page),children:s.jsxs(a.ButtonGroup,{size:"sm",variant:"ghost",children:[s.jsx(Gi,{asChild:!0,children:s.jsx(a.IconButton,{"aria-label":"Previous page",children:s.jsx(gi,{size:18})})}),s.jsx(a.Pagination.Items,{render:u=>s.jsx(a.IconButton,{variant:u.type==="page"&&u.value===n?"outline":"ghost","aria-current":u.type==="page"&&u.value===n?"page":void 0,children:u.type==="page"?u.value:"…"},u.value??u.type)}),s.jsx(qi,{asChild:!0,children:s.jsx(a.IconButton,{"aria-label":"Next page",children:s.jsx(vi,{size:18})})})]})})]})})}const na=b(a.Menu.Item),ra=b(a.Menu.Content),oa=b(a.Menu.Positioner),sa=b(a.Menu.Trigger);function ia({data:e=[],actions:t=[],actionConfig:n,onRowSelect:r,onRowSelectEvent:o="left",startIndex:i=0}){const{columnOrder:c,visibility:l,columnWidths:u}=Ae(te);return s.jsx(a.Table.Body,{children:e.map((d,g)=>s.jsxs(a.Table.Row,{onClick:()=>o==="left"&&r?.(d.__raw),_hover:{bg:"blue.50"},onContextMenu:o==="right"?f=>{f.preventDefault(),r?.(d.__raw,f)}:void 0,children:[n?.showSNo&&s.jsx(a.Table.Cell,{textAlign:"center",fontWeight:"medium",children:i+g+1}),c.filter(f=>l[f.id]).map(f=>s.jsx(a.Table.Cell,{w:u[f.id]?u[f.id]+"px":void 0,children:d[f.id]},f.id)),n?.showActionColumn&&s.jsx(a.Table.Cell,{textAlign:"center",display:"flex",gap:2,children:s.jsxs(a.Menu.Root,{children:[s.jsx(sa,{asChild:!0,children:s.jsx(a.IconButton,{"aria-label":"Open",variant:"ghost",size:"sm",children:s.jsx(wi,{size:16})})}),s.jsx(a.Portal,{children:s.jsx(oa,{children:s.jsx(ra,{children:t.filter(f=>typeof f.visible=="function"?f.visible(d.__raw):f.visible!==!1).map(f=>s.jsxs(na,{onClick:()=>f.onClick(d.__raw),colorScheme:f.colorScheme,value:f.label,children:[f.icon,f.label]},f.label))})})})]})}),n?.showColumnVisibilityMenu&&s.jsx(a.Table.Cell,{})]},d.__key||d.id))})}function aa({rows:e=6,columns:t}){return s.jsx(a.Table.Body,{children:Array.from({length:e}).map((n,r)=>s.jsx(a.Table.Row,{children:Array.from({length:t}).map((o,i)=>s.jsx(a.Table.Cell,{children:s.jsx(a.Skeleton,{height:"25px"})},i))},r))})}function la({tableId:e,data:t=[],headers:n=[],loading:r=!1,loadingChildren:o,skeletonLoading:i=!1,emptyMessage:c="No data",actions:l,page:u=1,pageSize:d=10,onPageChange:g,onPageSizeChange:f,density:x="sm",totalCount:p=0,actionConfig:m,pageSizeOptions:y,onRowSelect:w,onRowSelectEvent:C="left"}){h.useEffect(()=>{br(e)},[e]),h.useEffect(()=>{xr(t,n)},[t,n]),h.useEffect(()=>{m&&yr(m)},[m]);const{sortColumn:R,sortDirection:T,data:L,columnOrder:A}=Ae(te),_=h.useMemo(()=>{const W=[...L];return R&&W.sort((V,I)=>T==="asc"?String(V[R]).localeCompare(String(I[R])):String(I[R]).localeCompare(String(V[R]))),W},[L,R,T,u,d]),$=h.useMemo(()=>(Math.max(1,u||1)-1)*d,[u,d]);h.useEffect(()=>{u<1&&g&&g(1)},[u,g]);const N=W=>{const{active:V,over:I}=W;if(!I||V.id===I.id)return;const M=A.findIndex(j=>j.id===V.id),D=A.findIndex(j=>j.id===I.id),E=Ct(A,M,D);Xs(E)},H=r&&!i,k=i&&!r,S=!r&&!i&&_.length===0;return s.jsx(lr,{collisionDetection:qn,onDragEnd:N,children:s.jsx(fr,{items:A.map(W=>W.id),strategy:js,children:s.jsxs(a.Box,{flex:"1",minH:0,display:"flex",flexDirection:"column",p:2,children:[s.jsxs(a.Box,{flex:"1",minH:0,position:"relative",overflow:"auto",children:[H&&s.jsx(a.Box,{position:"absolute",inset:0,display:"flex",alignItems:"center",justifyContent:"center",zIndex:10,bg:"whiteAlpha.600",children:o??s.jsx(a.Spinner,{})}),s.jsxs(a.Table.Root,{variant:"outline",w:"100%",size:x,children:[s.jsx(Bi,{}),k?s.jsx(aa,{rows:d,columns:n.length+(l?2:0)}):S?s.jsx(a.Table.Body,{children:s.jsx(a.Table.Row,{children:s.jsx(a.Table.Cell,{colSpan:n.length+(l?1:0),children:s.jsx(a.Box,{display:"flex",alignItems:"center",justifyContent:"center",minH:"200px",color:"gray.500",children:c})})})}):s.jsx(ia,{data:_,actions:l,actionConfig:m,onRowSelect:w,startIndex:$,onRowSelectEvent:C})]})]}),s.jsx(a.Box,{mt:.5,children:s.jsx(ta,{totalCount:p,pageSize:d,currentPage:u,onPageChange:g,onPageSizeChange:W=>{f?.(W),u>1&&g?.(1)},pageSizeOptions:y})})]})})})}const ca=b(a.Checkbox.Root),ua=b(a.Checkbox.HiddenInput),da=b(a.Checkbox.Control),fa=b(a.Checkbox.Label),Mr=({value:e,onChange:t,size:n="sm",label:r,helperText:o,isDisabled:i,required:c,errorText:l})=>s.jsxs(ca,{value:e,onChange:t,size:n,children:[s.jsx(ua,{}),s.jsx(da,{disabled:i,required:c,errorText:l,helperText:o}),r&&s.jsx(fa,{children:r})]}),ha=b(a.Combobox.Root),ga=b(a.Combobox.Control),pa=b(a.Combobox.Input),va=b(a.Combobox.IndicatorGroup),ma=b(a.Combobox.ClearTrigger),xa=b(a.Combobox.Trigger),ba=b(a.Combobox.Positioner),ya=b(a.Combobox.Content);function Tr({label:e,size:t="sm",width:n="100%",variant:r="outline",items:o=[],itemToString:i,itemToValue:c,renderItem:l,value:u,loading:d,error:g,errorMessage:f,placeholder:x,helpText:p,onInputChange:m,onSelect:y,visible:w=!0,rootProps:C,inputProps:R,controlProps:T,contentProps:L,itemProps:A}){const[_,$]=h.useState(""),{collection:N,set:H}=a.useListCollection({initialItems:o,itemToString:i,itemToValue:c}),k=h.useMemo(()=>{if(!_)return o;const S=_.toLowerCase();return o.filter(W=>i(W).toLowerCase().includes(S))},[o,_,i]);return h.useEffect(()=>{H(k)},[k,H]),h.useEffect(()=>{u&&$(i(u))},[u,i]),s.jsxs(ha,{width:n,size:t,variant:r,collection:N,placeholder:x,onInputValueChange:S=>{m?.(S.inputValue),$(S.inputValue)},value:u?[c(u)]:[],onValueChange:S=>{const W=S.value?.[0];if(!W)return;const V=N.items.find(I=>c(I)===W);V&&y?.(V)},positioning:{sameWidth:!1,placement:"bottom-start"},...C,children:[w&&e&&s.jsx(a.Text,{fontSize:"sm",children:e}),s.jsxs(ga,{...T,children:[s.jsx(pa,{placeholder:x??"Type to search",...R}),s.jsxs(va,{children:[s.jsx(ma,{}),s.jsx(xa,{})]})]}),s.jsx(ba,{children:s.jsxs(ya,{minW:"sm",...L,children:[d?s.jsxs(a.HStack,{p:"2",children:[s.jsx(a.Spinner,{size:"xs",borderWidth:"1px"}),s.jsx(a.Span,{children:"Loading..."})]}):g?s.jsx(a.Text,{p:"2",color:"red.500",fontSize:"sm",children:f||"Something went wrong"}):N.items.map(S=>s.jsxs(a.Combobox.Item,{item:S,...A,children:[l(S),s.jsx(a.Combobox.ItemIndicator,{})]},c(S))),p&&!g&&!d&&s.jsx(a.Text,{p:"2",color:"fg.muted",fontSize:"sm",children:p})]})})]})}const Sa=b(a.Popover.Root),wa=b(a.Popover.Content),Ca=b(a.Popover.Arrow),Da=b(a.Popover.Trigger),ja=b(a.Popover.Positioner);function zn(e){if(!e)return"";const t=String(e.getDate()).padStart(2,"0"),n=String(e.getMonth()+1).padStart(2,"0"),r=e.getFullYear();return`${t}-${n}-${r}`}function Ra(e){const t=e.split("-");if(t.length!==3)return null;const[n,r,o]=t,i=parseInt(n),c=parseInt(r)-1,l=parseInt(o);if(isNaN(i)||isNaN(c)||isNaN(l)||o.length!==4)return null;const u=new Date(l,c,i);return u.getDate()===i&&u.getMonth()===c?u:null}function Ma({value:e,onChange:t,width:n="220px",showLabel:r=!0,label:o="Select date"}){const[i,c]=h.useState(!1),[l,u]=h.useState(e||new Date),[d,g]=h.useState(zn(e));h.useEffect(()=>{g(zn(e))},[e]);const f=new Date(l.getFullYear(),l.getMonth()+1,0).getDate(),x=new Date(l.getFullYear(),l.getMonth(),1).getDay(),p=()=>{u(new Date(l.getFullYear(),l.getMonth()-1,1))},m=()=>{u(new Date(l.getFullYear(),l.getMonth()+1,1))},y=C=>{const R=new Date(l.getFullYear(),l.getMonth(),C);t(R),c(!1)},w=C=>{if(i)switch(C.key){case"ArrowLeft":p();break;case"ArrowRight":m();break;case"Escape":c(!1);break}};return s.jsxs(a.Box,{width:n,onKeyDown:w,children:[r&&s.jsx(a.Text,{fontSize:"xs",color:"fg.muted",mb:1,fontWeight:"medium",children:o}),s.jsxs(Sa,{open:i,onOpenChange:C=>c(C.open),positioning:{placement:"bottom-start",gutter:4},children:[s.jsxs(a.Group,{attached:!0,w:"full",children:[s.jsx(a.Input,{placeholder:"DD-MM-YYYY",value:d,onChange:C=>{const R=C.target.value;g(R);const T=Ra(R);T&&(t(T),u(T))},size:"sm",autoComplete:"off"}),s.jsx(Da,{asChild:!0,children:s.jsx(a.InputAddon,{cursor:"pointer",px:2,_hover:{bg:"gray.100"},transition:"background 0.2s",children:s.jsx(Dr,{size:16})})})]}),s.jsx(ja,{children:s.jsxs(wa,{width:"300px",p:4,boxShadow:"xl",zIndex:1e3,borderRadius:"md",outline:"none",children:[s.jsx(Ca,{}),s.jsxs(a.HStack,{justify:"space-between",mb:4,children:[s.jsx(a.IconButton,{size:"xs",variant:"ghost",onClick:p,"aria-label":"Previous month",children:"‹"}),s.jsx(a.Text,{fontWeight:"bold",fontSize:"sm",children:l.toLocaleString("default",{month:"long",year:"numeric"})}),s.jsx(a.IconButton,{size:"xs",variant:"ghost",onClick:m,"aria-label":"Next month",children:"›"})]}),s.jsxs(a.Grid,{templateColumns:"repeat(7, 1fr)",gap:1,textAlign:"center",children:[["S","M","T","W","T","F","S"].map((C,R)=>s.jsx(a.Text,{fontSize:"xs",fontWeight:"bold",color:"fg.subtle",py:1,children:C},`${C}-${R}`)),Array(x).fill(null).map((C,R)=>s.jsx(a.Box,{},`empty-${R}`)),Array.from({length:f},(C,R)=>{const T=R+1,L=e&&e.getDate()===T&&e.getMonth()===l.getMonth()&&e.getFullYear()===l.getFullYear();return s.jsx(a.Button,{size:"xs",variant:L?"solid":"ghost",colorPalette:L?"blue":"gray",onClick:()=>y(T),minW:"32px",h:"32px",fontSize:"xs",borderRadius:"md",children:T},T)})]}),s.jsx(a.Text,{fontSize:"10px",color:"fg.muted",mt:3,textAlign:"center",children:"Use Arrow Keys to change months • Esc to close"})]})})]})]})}const Ta=b(a.Field.Root),Ea=b(a.Field.Label),Oa=b(a.Field.HelperText),_a=b(a.Field.ErrorText),Gt=({icon:e,value:t,onChange:n,placeholder:r,size:o="xs",variant:i="outline",width:c="100%",label:l,helperText:u,isDisabled:d=!1,required:g=!1,errorText:f,visible:x,type:p="text",min:m=0,max:y=100,step:w=1})=>s.jsxs(Ta,{width:c,children:[x&&s.jsx(Ea,{children:l}),s.jsx(a.InputGroup,{startElement:e,children:s.jsx(a.Input,{value:t,onChange:C=>n?.(C.target.value),placeholder:r,size:o,type:p,variant:i,disabled:d,required:g,min:m,max:y,step:w})}),f&&s.jsx(_a,{fontSize:"xs",children:f}),u&&s.jsx(Oa,{fontSize:"xs",children:u})]}),ka=b(a.Field.Root),Ia=b(a.Field.HelperText),$a=b(a.Field.ErrorText),Aa=b(a.Select.Root),La=b(a.Select.Label),Pa=b(a.Select.Control),Na=b(a.Select.Trigger),za=b(a.Select.ValueText),Fa=b(a.Select.IndicatorGroup),Ya=b(a.Select.Indicator),Ba=b(a.Select.Content),Wa=b(a.Select.Item),Ha=b(a.Select.ItemIndicator),Va=b(a.Select.HiddenSelect),Ua=b(a.Select.Positioner),Er=({options:e=[],label:t,value:n,onChange:r,placeholder:o,size:i="xs",width:c="100%",variant:l="outline",helperText:u,isDisabled:d,required:g,errorText:f,visible:x})=>{const p=a.createListCollection({items:e});return s.jsxs(ka,{disabled:d,required:g,children:[s.jsxs(Aa,{collection:p,variant:l,size:i,width:c,value:n?[n]:[],onValueChange:m=>r?.(m.value[0]),children:[s.jsx(Va,{}),x&&s.jsx(La,{children:t}),s.jsxs(Pa,{children:[s.jsx(Na,{children:s.jsx(za,{placeholder:o})}),s.jsx(Fa,{children:s.jsx(Ya,{})})]}),s.jsx(Ua,{children:s.jsx(Ba,{children:p.items.map(m=>s.jsxs(Wa,{item:m,children:[m.label,s.jsx(Ha,{})]},m.value))})})]}),u&&s.jsx(Ia,{children:u}),f&&s.jsx($a,{children:f})]})},Or=(e="default")=>`FILTER_PRESETS_${e}`,Ga=e=>{if(!e)return[];try{return JSON.parse(e)}catch{return[]}},qa=e=>typeof window>"u"?[]:Ga(localStorage.getItem(Or(e))),qe=new mr({}),Ze=e=>{const t=qe.state;if(e in t)return t[e];const n=qa(e);return qe.setState(r=>({...r,[e]:n})),n},jt=(e,t)=>{qe.setState(n=>({...n,[e]:t})),typeof window<"u"&&localStorage.setItem(Or(e),JSON.stringify(t))},_r=(e,t)=>{const n=[t,...Ze(e)];jt(e,n)},kr=(e,t)=>{const n=Ze(e).filter(r=>r.id!==t);jt(e,n)},Xa=(e,t,n)=>{const r=Ze(e).map(o=>o.id===t?n(o):o);jt(e,r)},Ka=b(a.Checkbox.Root),Ja=b(a.Checkbox.HiddenInput),Za=b(a.Checkbox.Control),Qa=b(a.Slider.Root),el=b(a.Slider.Track),tl=b(a.Slider.Range),nl=b(a.Slider.Thumbs),rl=b(a.Slider.Control),ol=({filter:e,onVisibilityChange:t,onSizeChange:n})=>{const{attributes:r,listeners:o,setNodeRef:i,transform:c,transition:l}=gr({id:e.id}),u={transform:_e.Transform.toString(c),transition:l};return s.jsxs(a.VStack,{ref:i,style:u,align:"stretch",border:"1px solid",borderColor:"gray.200",rounded:"md",p:3,mb:3,bg:"white",children:[s.jsxs(a.HStack,{...r,...o,cursor:"grab",userSelect:"none",gap:2,children:[s.jsx(jr,{size:16}),s.jsx(a.Text,{fontWeight:"bold",fontSize:"sm",children:e.label||e.id})]}),s.jsxs(a.HStack,{justify:"space-between",children:[s.jsx(a.Text,{fontSize:"sm",children:"Visible"}),s.jsxs(Ka,{checked:e.visible,size:"sm",onCheckedChange:d=>t?.(e.id,!!d.checked),children:[s.jsx(Ja,{}),s.jsx(Za,{})]})]}),s.jsxs(a.VStack,{align:"stretch",gap:1,children:[s.jsx(a.Text,{fontSize:"sm",children:"Size"}),s.jsx(Qa,{min:1,max:5,step:.5,value:[e.size??1],onValueChange:d=>n?.(e.id,d.value[0]),children:s.jsxs(rl,{children:[s.jsx(el,{children:s.jsx(tl,{})}),s.jsx(nl,{})]})})]})]})},sl=b(a.Popover.Root),il=b(a.Popover.Content),al=b(a.Popover.Arrow),ll=b(a.Popover.Trigger),cl=b(a.Popover.Positioner);function lt(e){if(!e)return"";const t=String(e.getDate()).padStart(2,"0"),n=String(e.getMonth()+1).padStart(2,"0"),r=e.getFullYear();return`${t}-${n}-${r}`}function Fn(e){const t=e.split("-");if(t.length!==3)return null;const[n,r,o]=t,i=parseInt(n),c=parseInt(r)-1,l=parseInt(o);if(isNaN(i)||isNaN(c)||isNaN(l)||o.length!==4)return null;const u=new Date(l,c,i);return u.getDate()===i&&u.getMonth()===c?u:null}function ul({startDate:e,endDate:t,onChange:n,width:r="300px",showLabel:o=!0,label:i="Select date range"}){const[c,l]=h.useState(!1),[u,d]=h.useState(e||t||new Date),[g,f]=h.useState(lt(e)),[x,p]=h.useState(lt(t)),[m,y]=h.useState(null);h.useEffect(()=>{f(lt(e)),p(lt(t))},[e,t]);const w=new Date(u.getFullYear(),u.getMonth()+1,0).getDate(),C=new Date(u.getFullYear(),u.getMonth(),1).getDay(),R=()=>{d(new Date(u.getFullYear(),u.getMonth()-1,1))},T=()=>{d(new Date(u.getFullYear(),u.getMonth()+1,1))},L=k=>{const S=new Date(u.getFullYear(),u.getMonth(),k);!e||e&&t?(n(S,null),d(S)):e&&!t&&(S<e?n(S,e):n(e,S),l(!1))},A=k=>{const S=new Date(u.getFullYear(),u.getMonth(),k);S<e||S>t||y(S)},_=()=>{y(null)},$=k=>{f(k);const S=Fn(k);S?(t&&S>t?n(t,S):n(S,t),d(S)):k===""&&n(null,t)},N=k=>{p(k);const S=Fn(k);S?(e&&S<e?n(S,e):n(e,S),d(S)):k===""&&n(e,null)},H=k=>{if(c)switch(k.key){case"ArrowLeft":R();break;case"ArrowRight":T();break;case"Escape":l(!1);break}};return s.jsxs(a.Box,{width:r,onKeyDown:H,children:[o&&s.jsx(a.Text,{fontSize:"xs",color:"fg.muted",mb:1,fontWeight:"medium",children:i}),s.jsxs(sl,{open:c,onOpenChange:k=>l(k.open),positioning:{placement:"bottom-start",gutter:4},children:[s.jsxs(a.Group,{attached:!0,w:"full",children:[s.jsx(a.Input,{placeholder:"DD-MM-YYYY",value:g,onChange:k=>$(k.target.value),size:"sm",autoComplete:"off"}),s.jsx(a.Box,{px:2,bg:"gray.50",display:"flex",alignItems:"center",fontSize:"sm",children:"to"}),s.jsx(a.Input,{placeholder:"DD-MM-YYYY",value:x,onChange:k=>N(k.target.value),size:"sm",autoComplete:"off"}),s.jsx(ll,{asChild:!0,children:s.jsx(a.InputAddon,{cursor:"pointer",px:2,_hover:{bg:"gray.100"},transition:"background 0.2s",children:s.jsx(Dr,{size:16})})})]}),s.jsx(cl,{children:s.jsxs(il,{width:"300px",p:4,boxShadow:"xl",zIndex:1e3,borderRadius:"md",outline:"none",children:[s.jsx(al,{}),s.jsxs(a.HStack,{justify:"space-between",mb:4,children:[s.jsx(a.IconButton,{size:"xs",variant:"ghost",onClick:R,"aria-label":"Previous month",children:"‹"}),s.jsx(a.Text,{fontWeight:"bold",fontSize:"sm",children:u.toLocaleString("default",{month:"long",year:"numeric"})}),s.jsx(a.IconButton,{size:"xs",variant:"ghost",onClick:T,"aria-label":"Next month",children:"›"})]}),s.jsxs(a.Grid,{templateColumns:"repeat(7, 1fr)",gap:1,textAlign:"center",children:[["S","M","T","W","T","F","S"].map((k,S)=>s.jsx(a.Text,{fontSize:"xs",fontWeight:"bold",color:"fg.subtle",py:1,children:k},`${k}-${S}`)),Array(C).fill(null).map((k,S)=>s.jsx(a.Box,{},`empty-${S}`)),Array.from({length:w},(k,S)=>{const W=S+1,V=new Date(u.getFullYear(),u.getMonth(),W),I=e&&V.getTime()===e.getTime(),M=t&&V.getTime()===t.getTime(),D=e&&t&&V>e&&V<t;let E=!1;e&&!t&&m&&m>e&&(E=V>e&&V<m);let j="gray",P=null;return I||M?j="blue":D?P="blue.50":E&&(P="blue.100"),s.jsx(a.Button,{size:"xs",variant:I||M?"solid":"ghost",colorPalette:j,bg:P||"blue.100",onClick:()=>L(W),onMouseEnter:()=>A(W),onMouseLeave:_,minW:"32px",h:"32px",fontSize:"xs",borderRadius:"md",children:W},W)})]}),s.jsx(a.Text,{fontSize:"10px",color:"fg.muted",mt:3,textAlign:"center",children:"Use Arrow Keys to change months • Esc to close"})]})})]})]})}const dl=b(a.Drawer.Root),fl=b(a.Drawer.Trigger),hl=b(a.Drawer.Backdrop),gl=b(a.Drawer.Positioner),pl=b(a.Drawer.Content),vl=b(a.Drawer.Header),ml=b(a.Drawer.Title),xl=b(a.Drawer.Body),bl=b(a.Drawer.Footer),yl=b(a.Drawer.CloseTrigger),Sl=b(a.Tabs.Root),wl=b(a.Tabs.List),zt=b(a.Tabs.Trigger),Ft=b(a.Tabs.Content),Ir=(e,t)=>{if(e.customComponent)return e.customComponent;switch(console.log(e.type),e.type){case"text":return s.jsx(Gt,{placeholder:e.label,value:e.value,onChange:e.onChange,label:e.label,visible:t});case"number":return s.jsx(Gt,{label:e.label,value:e.value,onChange:e.onChange});case"checkbox":return s.jsx(Mr,{label:e.label,value:e.value,onChange:e.onChange});case"select":return s.jsx(Er,{label:e.label,value:e.value,onChange:e.onChange,options:e.options??[],visible:t,placeholder:e.placeholder});case"date":return s.jsx(Ma,{value:e.value,onChange:e.onChange});case"date-range":return s.jsx(ul,{startDate:e.startDate,endDate:e.endDate,onChange:e.onChange});case"combobox":return s.jsx(Tr,{visible:!0,label:e.label,items:e.options,itemToString:n=>n.label,itemToValue:n=>n.value,renderItem:n=>s.jsx("span",{children:n.label})});default:return null}},Cl=({filterDrawerSize:e="sm",onVisibilityChange:t,onSizeChange:n,onClear:r,filters:o,pageKey:i="default",onLoadPreset:c,activePresetName:l,onReorder:u,open:d,onOpenChange:g})=>{const x=Ae(qe)[i]??Ze(i),p=()=>{const m=prompt("Preset name?");if(!m)return;const y=o.reduce((w,C)=>(w[C.id]=C.value,w),{});_r(i,{id:crypto.randomUUID(),name:m,date:new Date().toISOString(),values:y})};return s.jsx(a.HStack,{wrap:"wrap",children:s.jsxs(dl,{size:e,open:d,onOpenChange:g,children:[s.jsx(fl,{asChild:!0,children:s.jsxs(a.IconButton,{"aria-label":"Open filters",variant:"outline",size:"xs",ml:2,p:2,children:[s.jsx(Di,{size:16}),"Filters"]})}),s.jsxs(a.Portal,{children:[s.jsx(hl,{}),s.jsx(gl,{children:s.jsxs(pl,{children:[s.jsx(vl,{children:s.jsx(ml,{children:"Filters"})}),s.jsx(xl,{overflowY:"auto",pt:1,children:s.jsxs(Sl,{defaultValue:"view",children:[s.jsxs(wl,{mb:4,children:[s.jsxs(zt,{value:"view",children:[s.jsx(Mi,{size:16}),"Edit"]}),s.jsxs(zt,{value:"settings",children:[s.jsx(_i,{size:16}),"Settings"]}),s.jsxs(zt,{value:"presets",children:[s.jsx(di,{size:16}),"Presets"]})]}),s.jsx(Ft,{value:"view",children:o.filter(m=>m.visible).map(m=>s.jsx(a.VStack,{align:"stretch",border:"1px solid",borderColor:"gray.200",flex:m.size??1,minW:`${(m.size??1)*100}px`,rounded:"md",p:3,mb:3,children:Ir(m,d)},m.id))}),s.jsx(Ft,{value:"settings",children:s.jsx(lr,{sensors:fo(uo(on)),collisionDetection:qn,onDragEnd:({active:m,over:y})=>{if(!y||m.id===y.id)return;const w=o.findIndex(T=>T.id===m.id),C=o.findIndex(T=>T.id===y.id),R=Ct(o,w,C);u?.(R)},children:s.jsx(fr,{items:o.map(m=>m.id),strategy:Ms,children:o.map(m=>s.jsx(ol,{filter:m,onVisibilityChange:t,onSizeChange:n},m.id))})})}),s.jsx(Ft,{value:"presets",children:s.jsxs(a.VStack,{align:"stretch",mb:3,children:[x.length===0&&s.jsx(a.Text,{fontSize:"xs",color:"gray.500",children:"No presets saved yet."}),x.map(m=>s.jsxs(a.HStack,{justify:"space-between",border:"1px solid",borderColor:l===m.name?"blue.300":"gray.200",rounded:"md",p:2,children:[s.jsxs(a.VStack,{align:"start",gap:0,children:[s.jsx(a.Text,{fontWeight:"bold",fontSize:"sm",children:m.name}),s.jsx(a.Text,{fontSize:"xs",color:"gray.500",children:new Date(m.date).toLocaleDateString()})]}),s.jsxs(a.HStack,{children:[s.jsx(a.Button,{size:"xs",variant:"ghost",onClick:()=>{const y=o.map(w=>({...w,value:m.values[w.id]??w.value}));c?.(y,m.name)},children:"Load"}),s.jsx(a.IconButton,{size:"xs","aria-label":"Delete preset",variant:"ghost",onClick:()=>kr(i,m.id),children:s.jsx(yi,{size:14})})]})]},m.id)),s.jsx(a.Button,{size:"sm",colorScheme:"blue",onClick:p,children:"Save Current Filters"})]})})]})}),s.jsx(bl,{justify:"space-between",children:s.jsx(yl,{asChild:!0,children:s.jsx(a.CloseButton,{})})})]})})]})]})})},Dl=({title:e,filters:t,onVisibilityChange:n,onReorder:r,onSizeChange:o,onClear:i,maxToolbarUnits:c,pageKey:l,onLoadPreset:u,activePresetName:d,filterDrawerSize:g="sm"})=>{const[f,x]=h.useState(!1);return s.jsxs(a.HStack,{wrap:"wrap",pl:2,pr:2,width:"100%",justify:"space-between",children:[e,s.jsxs(a.HStack,{gapX:1,children:[t.filter(p=>p.visible!==!1).map(p=>s.jsx(a.HStack,{flex:p.size??1,minW:`${(p.size??1)*100}px`,alignItems:"center",children:Ir(p)},p.id)),s.jsx(Cl,{filterDrawerSize:g,onVisibilityChange:n,onReorder:r,onSizeChange:o,onClear:i,maxToolbarUnits:c,pageKey:l,filters:t,onLoadPreset:u,activePresetName:d,open:f,onOpenChange:p=>{x(p.open)}})]})]})},jl=(e,t)=>{localStorage.setItem(`FILTER_ORDER_${e}`,JSON.stringify(t))},Rl=e=>{try{return JSON.parse(localStorage.getItem(`FILTER_ORDER_${e}`)||"[]")}catch{return[]}},Ml=({onClick:e,size:t="xs",variant:n="solid",label:r,leftIcon:o,rightIcon:i,isDisabled:c,colorScheme:l,loading:u,loadingText:d,rounded:g,type:f="button"})=>s.jsx(a.Button,{onClick:e,size:t,variant:n,disabled:c,colorPalette:l,loading:u,loadingText:d,rounded:g,type:f,children:s.jsxs(a.HStack,{gap:1,children:[o,r,i]})}),Tl=b(a.Dialog.Root),El=b(a.Dialog.Backdrop),Ol=b(a.Dialog.Positioner),_l=b(a.Dialog.Content),kl=b(a.Dialog.Header),Il=b(a.Dialog.Body),$l=b(a.Dialog.Footer),Al=b(a.Dialog.Title),Ll=b(a.Dialog.CloseTrigger);function Pl({open:e,onClose:t,onConfirm:n,title:r="Confirm Action",description:o="Are you sure you want to continue?",confirmLabel:i="Confirm",cancelLabel:c="Cancel",icon:l,isLoading:u=!1,confirmButtonColorScheme:d="#4169e1"}){return s.jsx(Tl,{open:e,placement:"center",onOpenChange:g=>!g.open&&t(),children:s.jsxs(a.Portal,{children:[s.jsx(El,{}),s.jsx(Ol,{children:s.jsxs(_l,{maxW:"480px",children:[s.jsx(kl,{borderBottom:"1px solid",borderColor:"gray.200",children:s.jsx(Al,{children:r})}),s.jsx(Il,{p:6,children:s.jsxs(a.Stack,{gap:4,align:"center",textAlign:"center",children:[s.jsx(a.Box,{color:"orange.500",children:l??s.jsx(Rr,{size:40})}),s.jsx(a.Text,{fontSize:"sm",color:"gray.600",children:o})]})}),s.jsxs($l,{justifyContent:"flex-end",gap:2,borderTop:"1px solid",borderColor:"gray.200",children:[s.jsx(a.Button,{variant:"outline",size:"sm",onClick:t,children:c}),s.jsx(a.Button,{size:"sm",style:{backgroundColor:d},loading:u,onClick:n,children:i})]}),s.jsx(Ll,{asChild:!0,children:s.jsx(a.CloseButton,{size:"sm"})})]})})]})})}const Nl=b(a.Dialog.Root),zl=b(a.Dialog.Backdrop),Fl=b(a.Dialog.Positioner),Yl=b(a.Dialog.Content),Bl=b(a.Dialog.Header),Wl=b(a.Dialog.Body),Hl=b(a.Dialog.Footer),Vl=b(a.Dialog.Title),Ul=b(a.Dialog.CloseTrigger);function Gl({open:e,onClose:t,onConfirm:n,title:r="Delete Company",entityName:o,confirmText:i="DELETE",confirmLabel:c="Delete",isLoading:l=!1}){const[u,d]=h.useState(""),g=u===i;return s.jsx(Nl,{open:e,placement:"center",onOpenChange:f=>{!f.open&&t(),d("")},children:s.jsxs(a.Portal,{children:[s.jsx(zl,{}),s.jsx(Fl,{children:s.jsxs(Yl,{maxW:"550px",children:[s.jsx(Bl,{borderBottom:"1px solid",borderColor:"#d3d3d3",children:s.jsx(Vl,{color:"red.600",children:r})}),s.jsx(Wl,{p:2,style:{padding:"16px"},children:s.jsxs(a.Stack,{gap:4,borderRadius:"md",p:4,bg:"white",children:[s.jsx(a.Box,{border:"1px solid",borderColor:"red.200",bg:"red.50",borderRadius:"md",p:4,children:s.jsxs(a.Stack,{direction:"row",gap:3,align:"flex-start",children:[s.jsx(a.Box,{color:"red.600",mt:"2px",children:s.jsx(Rr,{size:20})}),s.jsxs(a.Box,{children:[s.jsx(a.Text,{fontWeight:"semibold",color:"red.700",children:"Are you sure?"}),s.jsxs(a.Text,{fontSize:"sm",color:"red.600",children:["All the data of ",s.jsx("b",{children:o})," will permanently be deleted."]})]})]})}),s.jsx(a.Text,{fontSize:"sm",color:"gray.600",children:"You can’t undo this action afterwards."}),s.jsxs(a.Box,{children:[s.jsxs(a.Text,{fontSize:"sm",mb:2,children:["Type ",s.jsx("b",{children:i})," to continue"]}),s.jsx(a.Input,{placeholder:`Type ${i} here`,value:u,onChange:f=>d(f.target.value),size:"xs"})]})]})}),s.jsxs(Hl,{justifyContent:"flex-end",gap:2,borderTop:"1px solid",borderColor:"#d3d3d3",children:[s.jsx(a.Button,{variant:"outline",size:"sm",onClick:()=>{t(),d("")},children:"Cancel"}),s.jsx(a.Button,{size:"sm",disabled:!g,style:{backgroundColor:"#FF0000"},loading:l,onClick:n,children:c})]}),s.jsx(Ul,{asChild:!0,children:s.jsx(a.CloseButton,{size:"sm"})})]})})]})})}const $r=({children:e})=>s.jsx(s.Fragment,{children:e}),Ar=({children:e})=>s.jsx(s.Fragment,{children:e}),ql=a.Button,Xl=b(a.Dialog.Root),Kl=b(a.Dialog.Backdrop),Jl=b(a.Dialog.Positioner),Zl=b(a.Dialog.Content),Ql=b(a.Dialog.Header),ec=b(a.Dialog.Body),tc=b(a.Dialog.Footer),nc=b(a.Dialog.Title),rc=b(a.Dialog.CloseTrigger);function oc(e){let t=null,n=null;return h.Children.forEach(e,r=>{h.isValidElement(r)&&(r.type===$r&&(t=r.props.children),r.type===Ar&&(n=r.props.children))}),{body:t,actions:n}}const sc=({open:e,onClose:t,title:n,children:r,width:o,position:i,refetch:c,loading:l=!1})=>{const{body:u,actions:d}=oc(r);return s.jsx(Xl,{open:e,onOpenChange:g=>!g.open&&t(),placement:i??"center",children:s.jsxs(a.Portal,{children:[s.jsx(Kl,{bg:"blackAlpha.400"}),s.jsx(Jl,{children:s.jsxs(Zl,{w:o??"560px",maxW:o??"560px",borderRadius:"6px",overflow:"hidden",boxShadow:"lg",children:[s.jsx(Ql,{px:"20px",py:"16px",bg:"white",borderBottom:"1px solid",borderColor:"gray.200",children:s.jsxs(a.Flex,{align:"center",justify:"space-between",children:[s.jsx(nc,{fontSize:"16px",fontWeight:"600",children:n}),s.jsx(rc,{asChild:!0,children:s.jsx(a.CloseButton,{size:"sm"})}),c&&s.jsx(sn,{label:"Refresh",refetch:c,isLoading:l})]})}),u&&s.jsx(ec,{px:"20px",py:"16px",bg:"#F8FAFC",type:"submit",children:s.jsx(a.Flex,{direction:"column",gap:"16px",children:u})}),d&&s.jsx(tc,{px:"20px",py:"16px",bg:"white",borderTop:"1px solid",borderColor:"gray.200",children:s.jsx(a.Flex,{ml:"auto",gap:"12px",children:d})})]})})]})})},ic=b(a.Field.Root),ac=b(a.Field.Label),lc=b(a.Field.HelperText),cc=b(a.Field.ErrorText),uc=b(a.PinInput.Input),dc=b(a.PinInput.Control),fc=b(a.PinInput.HiddenInput),hc=b(a.PinInput.Root),gc=({value:e,onChange:t,length:n=4,size:r="xs",isDisabled:o=!1,label:i,helperText:c,errorText:l,required:u=!1,visible:d=!0})=>{const g=Array.from({length:n}).map((f,x)=>e?.[x]??"");return s.jsxs(ic,{children:[d&&i&&s.jsxs(ac,{children:[i,u&&" *"]}),s.jsxs(hc,{value:g,onValueChange:f=>t?.(f.value.join("")),disabled:o,size:r,children:[s.jsx(fc,{}),s.jsx(dc,{children:s.jsx(a.HStack,{children:Array.from({length:n}).map((f,x)=>s.jsx(uc,{index:x},x))})})]}),l&&s.jsx(cc,{fontSize:"xs",children:l}),c&&!l&&s.jsx(lc,{fontSize:"xs",children:c})]})};function sn({refetch:e,isLoading:t=!1,label:n="Refresh"}){const[r,o]=h.useState(!1),i=async()=>{o(!0);try{await e()}finally{setTimeout(()=>o(!1),300)}};return s.jsx(a.IconButton,{"aria-label":n,size:"xs",variant:"outline",disabled:t||r,onClick:i,ml:2,children:s.jsx(Ei,{size:14,style:{animation:r?"spin 0.6s linear infinite":void 0}})})}var ut={exports:{}},pc=ut.exports,Yn;function vc(){return Yn||(Yn=1,(function(e,t){(function(n,r){e.exports=r()})(pc,(function(){var n=1e3,r=6e4,o=36e5,i="millisecond",c="second",l="minute",u="hour",d="day",g="week",f="month",x="quarter",p="year",m="date",y="Invalid Date",w=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,C=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,R={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(I){var M=["th","st","nd","rd"],D=I%100;return"["+I+(M[(D-20)%10]||M[D]||M[0])+"]"}},T=function(I,M,D){var E=String(I);return!E||E.length>=M?I:""+Array(M+1-E.length).join(D)+I},L={s:T,z:function(I){var M=-I.utcOffset(),D=Math.abs(M),E=Math.floor(D/60),j=D%60;return(M<=0?"+":"-")+T(E,2,"0")+":"+T(j,2,"0")},m:function I(M,D){if(M.date()<D.date())return-I(D,M);var E=12*(D.year()-M.year())+(D.month()-M.month()),j=M.clone().add(E,f),P=D-j<0,F=M.clone().add(E+(P?-1:1),f);return+(-(E+(D-j)/(P?j-F:F-j))||0)},a:function(I){return I<0?Math.ceil(I)||0:Math.floor(I)},p:function(I){return{M:f,y:p,w:g,d,D:m,h:u,m:l,s:c,ms:i,Q:x}[I]||String(I||"").toLowerCase().replace(/s$/,"")},u:function(I){return I===void 0}},A="en",_={};_[A]=R;var $="$isDayjsObject",N=function(I){return I instanceof W||!(!I||!I[$])},H=function I(M,D,E){var j;if(!M)return A;if(typeof M=="string"){var P=M.toLowerCase();_[P]&&(j=P),D&&(_[P]=D,j=P);var F=M.split("-");if(!j&&F.length>1)return I(F[0])}else{var v=M.name;_[v]=M,j=v}return!E&&j&&(A=j),j||!E&&A},k=function(I,M){if(N(I))return I.clone();var D=typeof M=="object"?M:{};return D.date=I,D.args=arguments,new W(D)},S=L;S.l=H,S.i=N,S.w=function(I,M){return k(I,{locale:M.$L,utc:M.$u,x:M.$x,$offset:M.$offset})};var W=(function(){function I(D){this.$L=H(D.locale,null,!0),this.parse(D),this.$x=this.$x||D.x||{},this[$]=!0}var M=I.prototype;return M.parse=function(D){this.$d=(function(E){var j=E.date,P=E.utc;if(j===null)return new Date(NaN);if(S.u(j))return new Date;if(j instanceof Date)return new Date(j);if(typeof j=="string"&&!/Z$/i.test(j)){var F=j.match(w);if(F){var v=F[2]-1||0,O=(F[7]||"0").substring(0,3);return P?new Date(Date.UTC(F[1],v,F[3]||1,F[4]||0,F[5]||0,F[6]||0,O)):new Date(F[1],v,F[3]||1,F[4]||0,F[5]||0,F[6]||0,O)}}return new Date(j)})(D),this.init()},M.init=function(){var D=this.$d;this.$y=D.getFullYear(),this.$M=D.getMonth(),this.$D=D.getDate(),this.$W=D.getDay(),this.$H=D.getHours(),this.$m=D.getMinutes(),this.$s=D.getSeconds(),this.$ms=D.getMilliseconds()},M.$utils=function(){return S},M.isValid=function(){return this.$d.toString()!==y},M.isSame=function(D,E){var j=k(D);return this.startOf(E)<=j&&j<=this.endOf(E)},M.isAfter=function(D,E){return k(D)<this.startOf(E)},M.isBefore=function(D,E){return this.endOf(E)<k(D)},M.$g=function(D,E,j){return S.u(D)?this[E]:this.set(j,D)},M.unix=function(){return Math.floor(this.valueOf()/1e3)},M.valueOf=function(){return this.$d.getTime()},M.startOf=function(D,E){var j=this,P=!!S.u(E)||E,F=S.p(D),v=function(J,Y){var se=S.w(j.$u?Date.UTC(j.$y,Y,J):new Date(j.$y,Y,J),j);return P?se:se.endOf(d)},O=function(J,Y){return S.w(j.toDate()[J].apply(j.toDate("s"),(P?[0,0,0,0]:[23,59,59,999]).slice(Y)),j)},z=this.$W,B=this.$M,q=this.$D,X="set"+(this.$u?"UTC":"");switch(F){case p:return P?v(1,0):v(31,11);case f:return P?v(1,B):v(0,B+1);case g:var U=this.$locale().weekStart||0,K=(z<U?z+7:z)-U;return v(P?q-K:q+(6-K),B);case d:case m:return O(X+"Hours",0);case u:return O(X+"Minutes",1);case l:return O(X+"Seconds",2);case c:return O(X+"Milliseconds",3);default:return this.clone()}},M.endOf=function(D){return this.startOf(D,!1)},M.$set=function(D,E){var j,P=S.p(D),F="set"+(this.$u?"UTC":""),v=(j={},j[d]=F+"Date",j[m]=F+"Date",j[f]=F+"Month",j[p]=F+"FullYear",j[u]=F+"Hours",j[l]=F+"Minutes",j[c]=F+"Seconds",j[i]=F+"Milliseconds",j)[P],O=P===d?this.$D+(E-this.$W):E;if(P===f||P===p){var z=this.clone().set(m,1);z.$d[v](O),z.init(),this.$d=z.set(m,Math.min(this.$D,z.daysInMonth())).$d}else v&&this.$d[v](O);return this.init(),this},M.set=function(D,E){return this.clone().$set(D,E)},M.get=function(D){return this[S.p(D)]()},M.add=function(D,E){var j,P=this;D=Number(D);var F=S.p(E),v=function(B){var q=k(P);return S.w(q.date(q.date()+Math.round(B*D)),P)};if(F===f)return this.set(f,this.$M+D);if(F===p)return this.set(p,this.$y+D);if(F===d)return v(1);if(F===g)return v(7);var O=(j={},j[l]=r,j[u]=o,j[c]=n,j)[F]||1,z=this.$d.getTime()+D*O;return S.w(z,this)},M.subtract=function(D,E){return this.add(-1*D,E)},M.format=function(D){var E=this,j=this.$locale();if(!this.isValid())return j.invalidDate||y;var P=D||"YYYY-MM-DDTHH:mm:ssZ",F=S.z(this),v=this.$H,O=this.$m,z=this.$M,B=j.weekdays,q=j.months,X=j.meridiem,U=function(Y,se,ne,fe){return Y&&(Y[se]||Y(E,P))||ne[se].slice(0,fe)},K=function(Y){return S.s(v%12||12,Y,"0")},J=X||function(Y,se,ne){var fe=Y<12?"AM":"PM";return ne?fe.toLowerCase():fe};return P.replace(C,(function(Y,se){return se||(function(ne){switch(ne){case"YY":return String(E.$y).slice(-2);case"YYYY":return S.s(E.$y,4,"0");case"M":return z+1;case"MM":return S.s(z+1,2,"0");case"MMM":return U(j.monthsShort,z,q,3);case"MMMM":return U(q,z);case"D":return E.$D;case"DD":return S.s(E.$D,2,"0");case"d":return String(E.$W);case"dd":return U(j.weekdaysMin,E.$W,B,2);case"ddd":return U(j.weekdaysShort,E.$W,B,3);case"dddd":return B[E.$W];case"H":return String(v);case"HH":return S.s(v,2,"0");case"h":return K(1);case"hh":return K(2);case"a":return J(v,O,!0);case"A":return J(v,O,!1);case"m":return String(O);case"mm":return S.s(O,2,"0");case"s":return String(E.$s);case"ss":return S.s(E.$s,2,"0");case"SSS":return S.s(E.$ms,3,"0");case"Z":return F}return null})(Y)||F.replace(":","")}))},M.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},M.diff=function(D,E,j){var P,F=this,v=S.p(E),O=k(D),z=(O.utcOffset()-this.utcOffset())*r,B=this-O,q=function(){return S.m(F,O)};switch(v){case p:P=q()/12;break;case f:P=q();break;case x:P=q()/3;break;case g:P=(B-z)/6048e5;break;case d:P=(B-z)/864e5;break;case u:P=B/o;break;case l:P=B/r;break;case c:P=B/n;break;default:P=B}return j?P:S.a(P)},M.daysInMonth=function(){return this.endOf(f).$D},M.$locale=function(){return _[this.$L]},M.locale=function(D,E){if(!D)return this.$L;var j=this.clone(),P=H(D,E,!0);return P&&(j.$L=P),j},M.clone=function(){return S.w(this.$d,this)},M.toDate=function(){return new Date(this.valueOf())},M.toJSON=function(){return this.isValid()?this.toISOString():null},M.toISOString=function(){return this.$d.toISOString()},M.toString=function(){return this.$d.toUTCString()},I})(),V=W.prototype;return k.prototype=V,[["$ms",i],["$s",c],["$m",l],["$H",u],["$W",d],["$M",f],["$y",p],["$D",m]].forEach((function(I){V[I[1]]=function(M){return this.$g(M,I[0],I[1])}})),k.extend=function(I,M){return I.$i||(I(M,W,k),I.$i=!0),k},k.locale=H,k.isDayjs=N,k.unix=function(I){return k(1e3*I)},k.en=_[A],k.Ls=_,k.p={},k}))})(ut)),ut.exports}var mc=vc();const Rt=bt(mc);var dt={exports:{}},xc=dt.exports,Bn;function bc(){return Bn||(Bn=1,(function(e,t){(function(n,r){e.exports=r()})(xc,(function(){return function(n,r,o){n=n||{};var i=r.prototype,c={future:"in %s",past:"%s ago",s:"a few seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"};function l(d,g,f,x){return i.fromToBase(d,g,f,x)}o.en.relativeTime=c,i.fromToBase=function(d,g,f,x,p){for(var m,y,w,C=f.$locale().relativeTime||c,R=n.thresholds||[{l:"s",r:44,d:"second"},{l:"m",r:89},{l:"mm",r:44,d:"minute"},{l:"h",r:89},{l:"hh",r:21,d:"hour"},{l:"d",r:35},{l:"dd",r:25,d:"day"},{l:"M",r:45},{l:"MM",r:10,d:"month"},{l:"y",r:17},{l:"yy",d:"year"}],T=R.length,L=0;L<T;L+=1){var A=R[L];A.d&&(m=x?o(d).diff(f,A.d,!0):f.diff(d,A.d,!0));var _=(n.rounding||Math.round)(Math.abs(m));if(w=m>0,_<=A.r||!A.r){_<=1&&L>0&&(A=R[L-1]);var $=C[A.l];p&&(_=p(""+_)),y=typeof $=="string"?$.replace("%d",_):$(_,g,A.l,w);break}}if(g)return y;var N=w?C.future:C.past;return typeof N=="function"?N(y):N.replace("%s",y)},i.to=function(d,g){return l(d,g,this,!0)},i.from=function(d,g){return l(d,g,this)};var u=function(d){return d.$u?o.utc():o()};i.toNow=function(d){return this.to(u(this),d)},i.fromNow=function(d){return this.from(u(this),d)}}}))})(dt)),dt.exports}var yc=bc();const Sc=bt(yc);var ft={exports:{}},wc=ft.exports,Wn;function Cc(){return Wn||(Wn=1,(function(e,t){(function(n,r){e.exports=r()})(wc,(function(){var n={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"};return function(r,o,i){var c=o.prototype,l=c.format;i.en.formats=n,c.format=function(u){u===void 0&&(u="YYYY-MM-DDTHH:mm:ssZ");var d=this.$locale().formats,g=(function(f,x){return f.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,(function(p,m,y){var w=y&&y.toUpperCase();return m||x[y]||n[y]||x[w].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,(function(C,R,T){return R||T.slice(1)}))}))})(u,d===void 0?{}:d);return l.call(this,g)}}}))})(ft)),ft.exports}var Dc=Cc();const jc=bt(Dc);var ht={exports:{}},Rc=ht.exports,Hn;function Mc(){return Hn||(Hn=1,(function(e,t){(function(n,r){e.exports=r()})(Rc,(function(){return function(n,r){var o=r.prototype,i=o.format;o.format=function(c){var l=this,u=this.$locale();if(!this.isValid())return i.bind(this)(c);var d=this.$utils(),g=(c||"YYYY-MM-DDTHH:mm:ssZ").replace(/\[([^\]]+)]|Q|wo|ww|w|WW|W|zzz|z|gggg|GGGG|Do|X|x|k{1,2}|S/g,(function(f){switch(f){case"Q":return Math.ceil((l.$M+1)/3);case"Do":return u.ordinal(l.$D);case"gggg":return l.weekYear();case"GGGG":return l.isoWeekYear();case"wo":return u.ordinal(l.week(),"W");case"w":case"ww":return d.s(l.week(),f==="w"?1:2,"0");case"W":case"WW":return d.s(l.isoWeek(),f==="W"?1:2,"0");case"k":case"kk":return d.s(String(l.$H===0?24:l.$H),f==="k"?1:2,"0");case"X":return Math.floor(l.$d.getTime()/1e3);case"x":return l.$d.getTime();case"z":return"["+l.offsetName()+"]";case"zzz":return"["+l.offsetName("long")+"]";default:return f}}));return i.bind(this)(g)}}}))})(ht)),ht.exports}var Tc=Mc();const Ec=bt(Tc);Rt.extend(Sc);Rt.extend(jc);Rt.extend(Ec);const Oc={date:"DD MMM YYYY",time:"hh:mm A",dateTime:"DD MMM YYYY, hh:mm A",full:"dddd, DD MMM YYYY, hh:mm A",short:"DD/MM/YY",relative:""};function qt({value:e,variant:t="dateTime",format:n,fallback:r="--"}){if(!e)return r;const o=Rt(e);return o.isValid()?t==="relative"?o.fromNow():o.format(n??Oc[t]):r}function _c({value:e,dateVariant:t="date",timeVariant:n="time",dateFormat:r,timeFormat:o,align:i="start",dateColor:c="gray.700",dateFontSize:l="16px",dateFontWeight:u="500",timeColor:d="gray.500",timeFontSize:g="12px",timeFontWeight:f="400"}){return s.jsxs(a.Stack,{gap:.5,align:i,children:[s.jsx(a.Text,{fontSize:l,fontWeight:u,color:c,children:qt({value:e,variant:t,format:r})}),s.jsx(a.Text,{fontSize:g,fontWeight:f,color:d,children:qt({value:e,variant:n,format:o})})]})}class Lr{state=new Map;listeners=new Map;get(t){return this.state.get(t)}set(t){this.state.set(t.key,t),this.notify(t.key)}setMany(t){t.forEach(n=>this.set(n))}subscribe(t,n){return this.listeners.has(t)||this.listeners.set(t,new Set),this.listeners.get(t).add(n),n(this.state.get(t)),()=>{this.listeners.get(t)?.delete(n)}}notify(t){this.listeners.get(t)?.forEach(n=>n(this.state.get(t)))}clear(){this.state.clear()}}class Xt{constructor(t){this.baseUrl=t}async fetchLatest(t){const n=new URLSearchParams;return n.set("keys",t.join(",")),(await(await fetch(`${this.baseUrl}/options?${n}`)).json()).data}}class Kt{constructor(t){this.api=t}store=new Lr;inflight=new Map;getRaw(t){return this.store.get(t)}async getKey(t){const n=this.store.get(t);return n?n.value:(await this.fetchMissing([t]),this.store.get(t)?.value)}async getMultiKey(t){const n={},r=[];for(const o of t){const i=this.store.get(o);i?n[o]=i.value:r.push(o)}return r.length&&(await this.fetchMissing(r),r.forEach(o=>{const i=this.store.get(o);i&&(n[o]=i.value)})),n}subscribe(t,n){return this.store.subscribe(t,n)}hydrate(t){this.store.setMany(t)}clear(){this.store.clear()}async fetchMissing(t){const n=t.filter(o=>!this.inflight.has(o));if(!n.length)return;const r=this.api.fetchLatest(n).then(o=>{this.store.setMany(o),n.forEach(i=>this.inflight.delete(i))});n.forEach(o=>this.inflight.set(o,r)),await r}}const Pr=h.createContext(null);function Nr(){const e=h.useContext(Pr);if(!e)throw new Error("OptionsProvider is missing. Wrap your app with <OptionsProvider />");return e}function kc({client:{apiUrl:e},children:t}){const n=h.useRef(new Kt(new Xt(e)));return n.current||(n.current=new Kt(new Xt(e))),s.jsx(Pr.Provider,{value:n.current,children:t})}function Ic(e){const t=Nr(),[n,r]=h.useState(t.getRaw(e)?.value);return h.useEffect(()=>{let o=!0;t.getKey(e).then(c=>{o&&r(c)});const i=t.subscribe(e,c=>{r(c?.value)});return()=>{o=!1,i()}},[e,t]),n}function $c(e){const t=Nr(),[n,r]=h.useState({});return h.useEffect(()=>{let o=!0;t.getMultiKey(e).then(c=>{o&&r(c)});const i=e.map(c=>t.subscribe(c,l=>{r(u=>({...u,[c]:l?.value}))}));return()=>{o=!1,i.forEach(c=>c())}},[e.join("|"),t]),n}async function Ac(e,t){return e.getKey(t)}async function Lc(e,t){await e.getMultiKey(t)}function Pc(e={}){const{initialPage:t=1,initialLimit:n=20}=e,[r,o]=h.useState(t),[i,c]=h.useState(n),l=h.useCallback(x=>{o(Math.max(1,x))},[]),u=h.useCallback(x=>{c(Math.max(1,x)),o(1)},[]),d=h.useCallback(()=>{o(x=>x+1)},[]),g=h.useCallback(()=>{o(x=>Math.max(1,x-1))},[]),f=h.useCallback(()=>{o(t),c(n)},[t,n]);return{page:r,limit:i,setPage:l,setLimit:u,nextPage:d,prevPage:g,reset:f}}function Nc(e={}){const{initialValue:t="",delay:n=300}=e,[r,o]=h.useState(t),i=zc(r,n),c=h.useCallback(u=>{o(u)},[]),l=h.useCallback(()=>{o(t)},[t]);return{search:r,debouncedSearch:i,onSearchChange:c,reset:l}}function zc(e,t=300){const[n,r]=h.useState(e);return h.useEffect(()=>{const o=setTimeout(()=>{r(e)},t);return()=>clearTimeout(o)},[e,t]),n}exports.DataTable=la;exports.Filters=Dl;exports.HttpOptionsApi=Xt;exports.MDSButton=Ml;exports.MDSCheckbox=Mr;exports.MDSCombobox=Tr;exports.MDSConfirmActionDialog=Pl;exports.MDSConfirmDeleteDialog=Gl;exports.MDSDialogAction=ql;exports.MDSDialogActions=Ar;exports.MDSDialogBody=$r;exports.MDSDialogWrapper=sc;exports.MDSInput=Gt;exports.MDSPinInput=gc;exports.MDSRefreshButton=sn;exports.MDSSelectBox=Er;exports.OptionsClientImpl=Kt;exports.OptionsProvider=kc;exports.OptionsStore=Lr;exports.RefreshButton=sn;exports.StackedDateTime=_c;exports.addPreset=_r;exports.deletePreset=kr;exports.formatDateTime=qt;exports.getColumnWidthKey=Dt;exports.getOption=Ac;exports.getPresets=Ze;exports.loadOrder=Rl;exports.prefetchOptions=Lc;exports.presetStore=qe;exports.saveOrder=jl;exports.savePresets=jt;exports.setActionsConfig=yr;exports.setColumnWidth=qs;exports.setData=xr;exports.setTableId=br;exports.tableStore=te;exports.updatePreset=Xa;exports.useDebouncedSearch=Nc;exports.useOption=Ic;exports.useOptions=$c;exports.usePagination=Pc;exports.withChildren=b;