@mdspl/mds-shared-ui 1.3.3 → 1.3.6
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 +4 -4
- package/dist/index.d.ts +3 -3
- package/dist/index.js +1662 -1666
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("react"),u=require("@chakra-ui/react"),ze=require("react-dom");function ao(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const vt=ao(f);function Ct(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var st={exports:{}},Ge={};var wn;function lo(){if(wn)return Ge;wn=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(r,o,s){var
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("react"),u=require("@chakra-ui/react"),ze=require("react-dom");function ao(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const vt=ao(f);function Ct(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var st={exports:{}},Ge={};var wn;function lo(){if(wn)return Ge;wn=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(r,o,s){var a=null;if(s!==void 0&&(a=""+s),o.key!==void 0&&(a=""+o.key),"key"in o){s={};for(var i in o)i!=="key"&&(s[i]=o[i])}else s=o;return o=s.ref,{$$typeof:e,type:r,key:a,ref:o!==void 0?o:null,props:s}}return Ge.Fragment=t,Ge.jsx=n,Ge.jsxs=n,Ge}var qe={};var Cn;function co(){return Cn||(Cn=1,process.env.NODE_ENV!=="production"&&(function(){function e(b){if(b==null)return null;if(typeof b=="function")return b.$$typeof===z?null:b.displayName||b.name||null;if(typeof b=="string")return b;switch(b){case y:return"Fragment";case R:return"Profiler";case M:return"StrictMode";case k:return"Suspense";case L:return"SuspenseList";case W:return"Activity"}if(typeof b=="object")switch(typeof b.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),b.$$typeof){case x:return"Portal";case I:return b.displayName||"Context";case j:return(b._context.displayName||"Context")+".Consumer";case $:var _=b.render;return b=b.displayName,b||(b=_.displayName||_.name||"",b=b!==""?"ForwardRef("+b+")":"ForwardRef"),b;case A:return _=b.displayName||null,_!==null?_:e(b.type)||"Memo";case V:_=b._payload,b=b._init;try{return e(b(_))}catch{}}return null}function t(b){return""+b}function n(b){try{t(b);var _=!1}catch{_=!0}if(_){_=console;var P=_.error,F=typeof Symbol=="function"&&Symbol.toStringTag&&b[Symbol.toStringTag]||b.constructor.name||"Object";return P.call(_,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",F),t(b)}}function r(b){if(b===y)return"<>";if(typeof b=="object"&&b!==null&&b.$$typeof===V)return"<...>";try{var _=e(b);return _?"<"+_+">":"<...>"}catch{return"<...>"}}function o(){var b=q.A;return b===null?null:b.getOwner()}function s(){return Error("react-stack-top-frame")}function a(b){if(K.call(b,"key")){var _=Object.getOwnPropertyDescriptor(b,"key").get;if(_&&_.isReactWarning)return!1}return b.key!==void 0}function i(b,_){function P(){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)",_))}P.isReactWarning=!0,Object.defineProperty(b,"key",{get:P,configurable:!0})}function c(){var b=e(this.type);return E[b]||(E[b]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),b=this.props.ref,b!==void 0?b:null}function d(b,_,P,F,G,U){var Y=P.ref;return b={$$typeof:p,type:b,key:_,props:P,_owner:F},(Y!==void 0?Y:null)!==null?Object.defineProperty(b,"ref",{enumerable:!1,get:c}):Object.defineProperty(b,"ref",{enumerable:!1,value:null}),b._store={},Object.defineProperty(b._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(b,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(b,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:G}),Object.defineProperty(b,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:U}),Object.freeze&&(Object.freeze(b.props),Object.freeze(b)),b}function g(b,_,P,F,G,U){var Y=_.children;if(Y!==void 0)if(F)if(T(Y)){for(F=0;F<Y.length;F++)h(Y[F]);Object.freeze&&Object.freeze(Y)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else h(Y);if(K.call(_,"key")){Y=e(b);var X=Object.keys(_).filter(function(B){return B!=="key"});F=0<X.length?"{key: someKey, "+X.join(": ..., ")+": ...}":"{key: someKey}",N[Y+F]||(X=0<X.length?"{"+X.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
|
|
2
2
|
let props = %s;
|
|
3
3
|
<%s {...props} />
|
|
4
4
|
React keys must be passed directly to JSX without using spread:
|
|
5
5
|
let props = %s;
|
|
6
|
-
<%s key={someKey} {...props} />`,F,
|
|
6
|
+
<%s key={someKey} {...props} />`,F,Y,X,Y),N[Y+F]=!0)}if(Y=null,P!==void 0&&(n(P),Y=""+P),a(_)&&(n(_.key),Y=""+_.key),"key"in _){P={};for(var J in _)J!=="key"&&(P[J]=_[J])}else P=_;return Y&&i(P,typeof b=="function"?b.displayName||b.name||"Unknown":b),d(b,Y,P,o(),G,U)}function h(b){v(b)?b._store&&(b._store.validated=1):typeof b=="object"&&b!==null&&b.$$typeof===V&&(b._payload.status==="fulfilled"?v(b._payload.value)&&b._payload.value._store&&(b._payload.value._store.validated=1):b._store&&(b._store.validated=1))}function v(b){return typeof b=="object"&&b!==null&&b.$$typeof===p}var m=f,p=Symbol.for("react.transitional.element"),x=Symbol.for("react.portal"),y=Symbol.for("react.fragment"),M=Symbol.for("react.strict_mode"),R=Symbol.for("react.profiler"),j=Symbol.for("react.consumer"),I=Symbol.for("react.context"),$=Symbol.for("react.forward_ref"),k=Symbol.for("react.suspense"),L=Symbol.for("react.suspense_list"),A=Symbol.for("react.memo"),V=Symbol.for("react.lazy"),W=Symbol.for("react.activity"),z=Symbol.for("react.client.reference"),q=m.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,K=Object.prototype.hasOwnProperty,T=Array.isArray,w=console.createTask?console.createTask:function(){return null};m={react_stack_bottom_frame:function(b){return b()}};var C,E={},D=m.react_stack_bottom_frame.bind(m,s)(),O=w(r(s)),N={};qe.Fragment=y,qe.jsx=function(b,_,P){var F=1e4>q.recentlyCreatedOwnerStacks++;return g(b,_,P,!1,F?Error("react-stack-top-frame"):D,F?w(r(b)):O)},qe.jsxs=function(b,_,P){var F=1e4>q.recentlyCreatedOwnerStacks++;return g(b,_,P,!0,F?Error("react-stack-top-frame"):D,F?w(r(b)):O)}})()),qe}var Dn;function uo(){return Dn||(Dn=1,process.env.NODE_ENV==="production"?st.exports=lo():st.exports=co()),st.exports}var l=uo();function fo(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return f.useMemo(()=>r=>{t.forEach(o=>o(r))},t)}const Dt=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Pe(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function rn(e){return"nodeType"in e}function ie(e){var t,n;return e?Pe(e)?e:rn(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function on(e){const{Document:t}=ie(e);return e instanceof t}function et(e){return Pe(e)?!1:e instanceof ie(e).HTMLElement}function or(e){return e instanceof ie(e).SVGElement}function Fe(e){return e?Pe(e)?e.document:rn(e)?on(e)?e:et(e)||or(e)?e.ownerDocument:document:document:document}const xe=Dt?f.useLayoutEffect:f.useEffect;function sn(e){const t=f.useRef(e);return xe(()=>{t.current=e}),f.useCallback(function(){for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return t.current==null?void 0:t.current(...r)},[])}function ho(){const e=f.useRef(null),t=f.useCallback((r,o)=>{e.current=setInterval(r,o)},[]),n=f.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,n]}function Ze(e,t){t===void 0&&(t=[e]);const n=f.useRef(e);return xe(()=>{n.current!==e&&(n.current=e)},t),n}function tt(e,t){const n=f.useRef();return f.useMemo(()=>{const r=e(n.current);return n.current=r,r},[...t])}function xt(e){const t=sn(e),n=f.useRef(null),r=f.useCallback(o=>{o!==n.current&&t?.(o,n.current),n.current=o},[]);return[n,r]}function Ut(e){const t=f.useRef();return f.useEffect(()=>{t.current=e},[e]),t.current}let $t={};function nt(e,t){return f.useMemo(()=>{if(t)return t;const n=$t[e]==null?0:$t[e]+1;return $t[e]=n,e+"-"+n},[e,t])}function sr(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return r.reduce((s,a)=>{const i=Object.entries(a);for(const[c,d]of i){const g=s[c];g!=null&&(s[c]=g+e*d)}return s},{...t})}}const Le=sr(1),bt=sr(-1);function go(e){return"clientX"in e&&"clientY"in e}function an(e){if(!e)return!1;const{KeyboardEvent:t}=ie(e.target);return t&&e instanceof t}function po(e){if(!e)return!1;const{TouchEvent:t}=ie(e.target);return t&&e instanceof t}function Gt(e){if(po(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 go(e)?{x:e.clientX,y:e.clientY}:null}const Ne=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[Ne.Translate.toString(e),Ne.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+" "+n+"ms "+r}}}),En="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function mo(e){return e.matches(En)?e:e.querySelector(En)}const vo={display:"none"};function xo(e){let{id:t,value:n}=e;return f.createElement("div",{id:t,style:vo},n)}function bo(e){let{id:t,announcement:n,ariaLiveType:r="assertive"}=e;const o={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return f.createElement("div",{id:t,style:o,role:"status","aria-live":r,"aria-atomic":!0},n)}function yo(){const[e,t]=f.useState("");return{announce:f.useCallback(r=>{r!=null&&t(r)},[]),announcement:e}}const ir=f.createContext(null);function So(e){const t=f.useContext(ir);f.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function wo(){const[e]=f.useState(()=>new Set),t=f.useCallback(r=>(e.add(r),()=>e.delete(r)),[e]);return[f.useCallback(r=>{let{type:o,event:s}=r;e.forEach(a=>{var i;return(i=a[o])==null?void 0:i.call(a,s)})},[e]),t]}const Co={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
|
-
`},Do={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 Eo(e){let{announcements:t=Do,container:n,hiddenTextDescribedById:r,screenReaderInstructions:o=Co}=e;const{announce:s,announcement:i}=yo(),a=nt("DndLiveRegion"),[c,d]=f.useState(!1);if(f.useEffect(()=>{d(!0)},[]),So(f.useMemo(()=>({onDragStart(h){let{active:v}=h;s(t.onDragStart({active:v}))},onDragMove(h){let{active:v,over:m}=h;t.onDragMove&&s(t.onDragMove({active:v,over:m}))},onDragOver(h){let{active:v,over:m}=h;s(t.onDragOver({active:v,over:m}))},onDragEnd(h){let{active:v,over:m}=h;s(t.onDragEnd({active:v,over:m}))},onDragCancel(h){let{active:v,over:m}=h;s(t.onDragCancel({active:v,over:m}))}}),[s,t])),!c)return null;const g=f.createElement(f.Fragment,null,f.createElement(xo,{id:r,value:o.draggable}),f.createElement(bo,{id:a,announcement:i}));return n?ze.createPortal(g,n):g}var Z;(function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"})(Z||(Z={}));function yt(){}function Mo(e,t){return f.useMemo(()=>({sensor:e,options:{}}),[e,t])}function jo(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return f.useMemo(()=>[...t].filter(r=>r!=null),[...t])}const pe=Object.freeze({x:0,y:0});function Ro(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function To(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function Oo(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function _o(e,t){if(!e||e.length===0)return null;const[n]=e;return n[t]}function Mn(e,t,n){return t===void 0&&(t=e.left),n===void 0&&(n=e.top),{x:t+e.width*.5,y:n+e.height*.5}}const ar=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=Mn(t,t.left,t.top),s=[];for(const i of r){const{id:a}=i,c=n.get(a);if(c){const d=Ro(Mn(c),o);s.push({id:a,data:{droppableContainer:i,value:d}})}}return s.sort(To)};function Io(e,t){const n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),o=Math.min(t.left+t.width,e.left+e.width),s=Math.min(t.top+t.height,e.top+e.height),i=o-r,a=s-n;if(r<o&&n<s){const c=t.width*t.height,d=e.width*e.height,g=i*a,h=g/(c+d-g);return Number(h.toFixed(4))}return 0}const ko=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=[];for(const s of r){const{id:i}=s,a=n.get(i);if(a){const c=Io(a,t);c>0&&o.push({id:i,data:{droppableContainer:s,value:c}})}}return o.sort(Oo)};function $o(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function lr(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:pe}function Ao(e){return function(n){for(var r=arguments.length,o=new Array(r>1?r-1:0),s=1;s<r;s++)o[s-1]=arguments[s];return o.reduce((i,a)=>({...i,top:i.top+e*a.y,bottom:i.bottom+e*a.y,left:i.left+e*a.x,right:i.right+e*a.x}),{...n})}}const zo=Ao(1);function Lo(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function No(e,t,n){const r=Lo(t);if(!r)return e;const{scaleX:o,scaleY:s,x:i,y:a}=r,c=e.left-i-(1-o)*parseFloat(n),d=e.top-a-(1-s)*parseFloat(n.slice(n.indexOf(" ")+1)),g=o?e.width/o:e.width,h=s?e.height/s:e.height;return{width:g,height:h,top:d,right:c+g,bottom:d+h,left:c}}const Po={ignoreTransform:!1};function We(e,t){t===void 0&&(t=Po);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:d,transformOrigin:g}=ie(e).getComputedStyle(e);d&&(n=No(n,d,g))}const{top:r,left:o,width:s,height:i,bottom:a,right:c}=n;return{top:r,left:o,width:s,height:i,bottom:a,right:c}}function jn(e){return We(e,{ignoreTransform:!0})}function Fo(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function Wo(e,t){return t===void 0&&(t=ie(e).getComputedStyle(e)),t.position==="fixed"}function Bo(e,t){t===void 0&&(t=ie(e).getComputedStyle(e));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(o=>{const s=t[o];return typeof s=="string"?n.test(s):!1})}function ln(e,t){const n=[];function r(o){if(t!=null&&n.length>=t||!o)return n;if(on(o)&&o.scrollingElement!=null&&!n.includes(o.scrollingElement))return n.push(o.scrollingElement),n;if(!et(o)||or(o)||n.includes(o))return n;const s=ie(e).getComputedStyle(o);return o!==e&&Bo(o,s)&&n.push(o),Wo(o,s)?n:r(o.parentNode)}return e?r(e):n}function cr(e){const[t]=ln(e,1);return t??null}function At(e){return!Dt||!e?null:Pe(e)?e:rn(e)?on(e)||e===Fe(e).scrollingElement?window:et(e)?e:null:null}function ur(e){return Pe(e)?e.scrollX:e.scrollLeft}function dr(e){return Pe(e)?e.scrollY:e.scrollTop}function qt(e){return{x:ur(e),y:dr(e)}}var Q;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(Q||(Q={}));function fr(e){return!Dt||!e?!1:e===document.scrollingElement}function hr(e){const t={x:0,y:0},n=fr(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height},o=e.scrollTop<=t.y,s=e.scrollLeft<=t.x,i=e.scrollTop>=r.y,a=e.scrollLeft>=r.x;return{isTop:o,isLeft:s,isBottom:i,isRight:a,maxScroll:r,minScroll:t}}const Vo={x:.2,y:.2};function Yo(e,t,n,r,o){let{top:s,left:i,right:a,bottom:c}=n;r===void 0&&(r=10),o===void 0&&(o=Vo);const{isTop:d,isBottom:g,isLeft:h,isRight:v}=hr(e),m={x:0,y:0},p={x:0,y:0},x={height:t.height*o.y,width:t.width*o.x};return!d&&s<=t.top+x.height?(m.y=Q.Backward,p.y=r*Math.abs((t.top+x.height-s)/x.height)):!g&&c>=t.bottom-x.height&&(m.y=Q.Forward,p.y=r*Math.abs((t.bottom-x.height-c)/x.height)),!v&&a>=t.right-x.width?(m.x=Q.Forward,p.x=r*Math.abs((t.right-x.width-a)/x.width)):!h&&i<=t.left+x.width&&(m.x=Q.Backward,p.x=r*Math.abs((t.left+x.width-i)/x.width)),{direction:m,speed:p}}function Ho(e){if(e===document.scrollingElement){const{innerWidth:s,innerHeight:i}=window;return{top:0,left:0,right:s,bottom:i,width:s,height:i}}const{top:t,left:n,right:r,bottom:o}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:o,width:e.clientWidth,height:e.clientHeight}}function gr(e){return e.reduce((t,n)=>Le(t,qt(n)),pe)}function Uo(e){return e.reduce((t,n)=>t+ur(n),0)}function Go(e){return e.reduce((t,n)=>t+dr(n),0)}function qo(e,t){if(t===void 0&&(t=We),!e)return;const{top:n,left:r,bottom:o,right:s}=t(e);cr(e)&&(o<=0||s<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const Ko=[["x",["left","right"],Uo],["y",["top","bottom"],Go]];class cn{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=ln(n),o=gr(r);this.rect={...t},this.width=t.width,this.height=t.height;for(const[s,i,a]of Ko)for(const c of i)Object.defineProperty(this,c,{get:()=>{const d=a(r),g=o[s]-d;return this.rect[c]+g},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class Ke{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 Xo(e){const{EventTarget:t}=ie(e);return e instanceof t?e:Fe(e)}function zt(e,t){const n=Math.abs(e.x),r=Math.abs(e.y);return typeof t=="number"?Math.sqrt(n**2+r**2)>t:"x"in t&&"y"in t?n>t.x&&r>t.y:"x"in t?n>t.x:"y"in t?r>t.y:!1}var fe;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(fe||(fe={}));function Rn(e){e.preventDefault()}function Jo(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 pr={start:[U.Space,U.Enter],cancel:[U.Esc],end:[U.Space,U.Enter,U.Tab]},Zo=(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 mr{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 Ke(Fe(n)),this.windowListeners=new Ke(ie(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(fe.Resize,this.handleCancel),this.windowListeners.add(fe.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(fe.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props,r=t.node.current;r&&qo(r),n(pe)}handleKeyDown(t){if(an(t)){const{active:n,context:r,options:o}=this.props,{keyboardCodes:s=pr,coordinateGetter:i=Zo,scrollBehavior:a="smooth"}=o,{code:c}=t;if(s.end.includes(c)){this.handleEnd(t);return}if(s.cancel.includes(c)){this.handleCancel(t);return}const{collisionRect:d}=r.current,g=d?{x:d.left,y:d.top}:pe;this.referenceCoordinates||(this.referenceCoordinates=g);const h=i(t,{active:n,context:r.current,currentCoordinates:g});if(h){const v=bt(h,g),m={x:0,y:0},{scrollableAncestors:p}=r.current;for(const x of p){const y=t.code,{isTop:T,isRight:R,isLeft:j,isBottom:k,maxScroll:$,minScroll:I}=hr(x),L=Ho(x),A={x:Math.min(y===U.Right?L.right-L.width/2:L.right,Math.max(y===U.Right?L.left:L.left+L.width/2,h.x)),y:Math.min(y===U.Down?L.bottom-L.height/2:L.bottom,Math.max(y===U.Down?L.top:L.top+L.height/2,h.y))},B=y===U.Right&&!R||y===U.Left&&!j,W=y===U.Down&&!k||y===U.Up&&!T;if(B&&A.x!==h.x){const z=x.scrollLeft+v.x,Y=y===U.Right&&z<=$.x||y===U.Left&&z>=I.x;if(Y&&!v.y){x.scrollTo({left:z,behavior:a});return}Y?m.x=x.scrollLeft-z:m.x=y===U.Right?x.scrollLeft-$.x:x.scrollLeft-I.x,m.x&&x.scrollBy({left:-m.x,behavior:a});break}else if(W&&A.y!==h.y){const z=x.scrollTop+v.y,Y=y===U.Down&&z<=$.y||y===U.Up&&z>=I.y;if(Y&&!v.x){x.scrollTo({top:z,behavior:a});return}Y?m.y=x.scrollTop-z:m.y=y===U.Down?x.scrollTop-$.y:x.scrollTop-I.y,m.y&&x.scrollBy({top:-m.y,behavior:a});break}}this.handleMove(t,Le(bt(h,this.referenceCoordinates),m))}}}handleMove(t,n){const{onMove:r}=this.props;t.preventDefault(),r(n)}handleEnd(t){const{onEnd:n}=this.props;t.preventDefault(),this.detach(),n()}handleCancel(t){const{onCancel:n}=this.props;t.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}mr.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:r=pr,onActivation:o}=t,{active:s}=n;const{code:i}=e.nativeEvent;if(r.start.includes(i)){const a=s.activatorNode.current;return a&&e.target!==a?!1:(e.preventDefault(),o?.({event:e.nativeEvent}),!0)}return!1}}];function Tn(e){return!!(e&&"distance"in e)}function On(e){return!!(e&&"delay"in e)}class un{constructor(t,n,r){var o;r===void 0&&(r=Xo(t.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=t,this.events=n;const{event:s}=t,{target:i}=s;this.props=t,this.events=n,this.document=Fe(i),this.documentListeners=new Ke(this.document),this.listeners=new Ke(r),this.windowListeners=new Ke(ie(i)),this.initialCoordinates=(o=Gt(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(On(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(Tn(n)){this.handlePending(n);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(t,n){const{active:r,onPending:o}=this.props;o(r,t,this.initialCoordinates,n)}handleStart(){const{initialCoordinates:t}=this,{onStart:n}=this.props;t&&(this.activated=!0,this.documentListeners.add(fe.Click,Jo,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(fe.SelectionChange,this.removeTextSelection),n(t))}handleMove(t){var n;const{activated:r,initialCoordinates:o,props:s}=this,{onMove:i,options:{activationConstraint:a}}=s;if(!o)return;const c=(n=Gt(t))!=null?n:pe,d=bt(o,c);if(!r&&a){if(Tn(a)){if(a.tolerance!=null&&zt(d,a.tolerance))return this.handleCancel();if(zt(d,a.distance))return this.handleStart()}if(On(a)&&zt(d,a.tolerance))return this.handleCancel();this.handlePending(a,d);return}t.cancelable&&t.preventDefault(),i(c)}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 Qo={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class dn extends un{constructor(t){const{event:n}=t,r=Fe(n.target);super(t,Qo,r)}}dn.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 es={move:{name:"mousemove"},end:{name:"mouseup"}};var Kt;(function(e){e[e.RightClick=2]="RightClick"})(Kt||(Kt={}));class ts extends un{constructor(t){super(t,es,Fe(t.event.target))}}ts.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===Kt.RightClick?!1:(r?.({event:n}),!0)}}];const Lt={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class ns extends un{constructor(t){super(t,Lt)}static setup(){return window.addEventListener(Lt.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(Lt.move.name,t)};function t(){}}}ns.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;const{touches:o}=n;return o.length>1?!1:(r?.({event:n}),!0)}}];var Xe;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(Xe||(Xe={}));var St;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(St||(St={}));function rs(e){let{acceleration:t,activator:n=Xe.Pointer,canScroll:r,draggingRect:o,enabled:s,interval:i=5,order:a=St.TreeOrder,pointerCoordinates:c,scrollableAncestors:d,scrollableAncestorRects:g,delta:h,threshold:v}=e;const m=ss({delta:h,disabled:!s}),[p,x]=ho(),y=f.useRef({x:0,y:0}),T=f.useRef({x:0,y:0}),R=f.useMemo(()=>{switch(n){case Xe.Pointer:return c?{top:c.y,bottom:c.y,left:c.x,right:c.x}:null;case Xe.DraggableRect:return o}},[n,o,c]),j=f.useRef(null),k=f.useCallback(()=>{const I=j.current;if(!I)return;const L=y.current.x*T.current.x,A=y.current.y*T.current.y;I.scrollBy(L,A)},[]),$=f.useMemo(()=>a===St.TreeOrder?[...d].reverse():d,[a,d]);f.useEffect(()=>{if(!s||!d.length||!R){x();return}for(const I of $){if(r?.(I)===!1)continue;const L=d.indexOf(I),A=g[L];if(!A)continue;const{direction:B,speed:W}=Yo(I,A,R,t,v);for(const z of["x","y"])m[z][B[z]]||(W[z]=0,B[z]=0);if(W.x>0||W.y>0){x(),j.current=I,p(k,i),y.current=W,T.current=B;return}}y.current={x:0,y:0},T.current={x:0,y:0},x()},[t,k,r,x,s,i,JSON.stringify(R),JSON.stringify(m),p,d,$,g,JSON.stringify(v)])}const os={x:{[Q.Backward]:!1,[Q.Forward]:!1},y:{[Q.Backward]:!1,[Q.Forward]:!1}};function ss(e){let{delta:t,disabled:n}=e;const r=Ut(t);return tt(o=>{if(n||!r||!o)return os;const s={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[Q.Backward]:o.x[Q.Backward]||s.x===-1,[Q.Forward]:o.x[Q.Forward]||s.x===1},y:{[Q.Backward]:o.y[Q.Backward]||s.y===-1,[Q.Forward]:o.y[Q.Forward]||s.y===1}}},[n,t,r])}function is(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 as(e,t){return f.useMemo(()=>e.reduce((n,r)=>{const{sensor:o}=r,s=o.activators.map(i=>({eventName:i.eventName,handler:t(i.handler,r)}));return[...n,...s]},[]),[e,t])}var Qe;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(Qe||(Qe={}));var Xt;(function(e){e.Optimized="optimized"})(Xt||(Xt={}));const _n=new Map;function ls(e,t){let{dragging:n,dependencies:r,config:o}=t;const[s,i]=f.useState(null),{frequency:a,measure:c,strategy:d}=o,g=f.useRef(e),h=y(),v=Ze(h),m=f.useCallback(function(T){T===void 0&&(T=[]),!v.current&&i(R=>R===null?T:R.concat(T.filter(j=>!R.includes(j))))},[v]),p=f.useRef(null),x=tt(T=>{if(h&&!n)return _n;if(!T||T===_n||g.current!==e||s!=null){const R=new Map;for(let j of e){if(!j)continue;if(s&&s.length>0&&!s.includes(j.id)&&j.rect.current){R.set(j.id,j.rect.current);continue}const k=j.node.current,$=k?new cn(c(k),k):null;j.rect.current=$,$&&R.set(j.id,$)}return R}return T},[e,s,n,h,c]);return f.useEffect(()=>{g.current=e},[e]),f.useEffect(()=>{h||m()},[n,h]),f.useEffect(()=>{s&&s.length>0&&i(null)},[JSON.stringify(s)]),f.useEffect(()=>{h||typeof a!="number"||p.current!==null||(p.current=setTimeout(()=>{m(),p.current=null},a))},[a,h,m,...r]),{droppableRects:x,measureDroppableContainers:m,measuringScheduled:s!=null};function y(){switch(d){case Qe.Always:return!1;case Qe.BeforeDragging:return n;default:return!n}}}function vr(e,t){return tt(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function cs(e,t){return vr(e,t)}function us(e){let{callback:t,disabled:n}=e;const r=sn(t),o=f.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:s}=window;return new s(r)},[r,n]);return f.useEffect(()=>()=>o?.disconnect(),[o]),o}function Et(e){let{callback:t,disabled:n}=e;const r=sn(t),o=f.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:s}=window;return new s(r)},[n]);return f.useEffect(()=>()=>o?.disconnect(),[o]),o}function ds(e){return new cn(We(e),e)}function In(e,t,n){t===void 0&&(t=ds);const[r,o]=f.useState(null);function s(){o(c=>{if(!e)return null;if(e.isConnected===!1){var d;return(d=c??n)!=null?d:null}const g=t(e);return JSON.stringify(c)===JSON.stringify(g)?c:g})}const i=us({callback(c){if(e)for(const d of c){const{type:g,target:h}=d;if(g==="childList"&&h instanceof HTMLElement&&h.contains(e)){s();break}}}}),a=Et({callback:s});return xe(()=>{s(),e?(a?.observe(e),i?.observe(document.body,{childList:!0,subtree:!0})):(a?.disconnect(),i?.disconnect())},[e]),r}function fs(e){const t=vr(e);return lr(e,t)}const kn=[];function hs(e){const t=f.useRef(e),n=tt(r=>e?r&&r!==kn&&e&&t.current&&e.parentNode===t.current.parentNode?r:ln(e):kn,[e]);return f.useEffect(()=>{t.current=e},[e]),n}function gs(e){const[t,n]=f.useState(null),r=f.useRef(e),o=f.useCallback(s=>{const i=At(s.target);i&&n(a=>a?(a.set(i,qt(i)),new Map(a)):null)},[]);return f.useEffect(()=>{const s=r.current;if(e!==s){i(s);const a=e.map(c=>{const d=At(c);return d?(d.addEventListener("scroll",o,{passive:!0}),[d,qt(d)]):null}).filter(c=>c!=null);n(a.length?new Map(a):null),r.current=e}return()=>{i(e),i(s)};function i(a){a.forEach(c=>{const d=At(c);d?.removeEventListener("scroll",o)})}},[o,e]),f.useMemo(()=>e.length?t?Array.from(t.values()).reduce((s,i)=>Le(s,i),pe):gr(e):pe,[e,t])}function $n(e,t){t===void 0&&(t=[]);const n=f.useRef(null);return f.useEffect(()=>{n.current=null},t),f.useEffect(()=>{const r=e!==pe;r&&!n.current&&(n.current=e),!r&&n.current&&(n.current=null)},[e]),n.current?bt(e,n.current):pe}function ps(e){f.useEffect(()=>{if(!Dt)return;const t=e.map(n=>{let{sensor:r}=n;return r.setup==null?void 0:r.setup()});return()=>{for(const n of t)n?.()}},e.map(t=>{let{sensor:n}=t;return n}))}function ms(e,t){return f.useMemo(()=>e.reduce((n,r)=>{let{eventName:o,handler:s}=r;return n[o]=i=>{s(i,t)},n},{}),[e,t])}function xr(e){return f.useMemo(()=>e?Fo(e):null,[e])}const An=[];function vs(e,t){t===void 0&&(t=We);const[n]=e,r=xr(n?ie(n):null),[o,s]=f.useState(An);function i(){s(()=>e.length?e.map(c=>fr(c)?r:new cn(t(c),c)):An)}const a=Et({callback:i});return xe(()=>{a?.disconnect(),i(),e.forEach(c=>a?.observe(c))},[e]),o}function xs(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return et(t)?t:e}function bs(e){let{measure:t}=e;const[n,r]=f.useState(null),o=f.useCallback(d=>{for(const{target:g}of d)if(et(g)){r(h=>{const v=t(g);return h?{...h,width:v.width,height:v.height}:v});break}},[t]),s=Et({callback:o}),i=f.useCallback(d=>{const g=xs(d);s?.disconnect(),g&&s?.observe(g),r(g?t(g):null)},[t,s]),[a,c]=xt(i);return f.useMemo(()=>({nodeRef:a,rect:n,setRef:c}),[n,a,c])}const ys=[{sensor:dn,options:{}},{sensor:mr,options:{}}],Ss={current:{}},ft={draggable:{measure:jn},droppable:{measure:jn,strategy:Qe.WhileDragging,frequency:Xt.Optimized},dragOverlay:{measure:We}};class Je 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 ws={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Je,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:yt},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:ft,measureDroppableContainers:yt,windowRect:null,measuringScheduled:!1},Cs={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:yt,draggableNodes:new Map,over:null,measureDroppableContainers:yt},Mt=f.createContext(Cs),br=f.createContext(ws);function Ds(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Je}}}function Es(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 Je(e.droppable.containers);return o.set(r,n),{...e,droppable:{...e.droppable,containers:o}}}case Z.SetDroppableDisabled:{const{id:n,key:r,disabled:o}=t,s=e.droppable.containers.get(n);if(!s||r!==s.key)return e;const i=new Je(e.droppable.containers);return i.set(n,{...s,disabled:o}),{...e,droppable:{...e.droppable,containers:i}}}case Z.UnregisterDroppable:{const{id:n,key:r}=t,o=e.droppable.containers.get(n);if(!o||r!==o.key)return e;const s=new Je(e.droppable.containers);return s.delete(n),{...e,droppable:{...e.droppable,containers:s}}}default:return e}}function Ms(e){let{disabled:t}=e;const{active:n,activatorEvent:r,draggableNodes:o}=f.useContext(Mt),s=Ut(r),i=Ut(n?.id);return f.useEffect(()=>{if(!t&&!r&&s&&i!=null){if(!an(s)||document.activeElement===s.target)return;const a=o.get(i);if(!a)return;const{activatorNode:c,node:d}=a;if(!c.current&&!d.current)return;requestAnimationFrame(()=>{for(const g of[c.current,d.current]){if(!g)continue;const h=mo(g);if(h){h.focus();break}}})}},[r,t,o,i,s]),null}function js(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((o,s)=>s({transform:o,...r}),n):n}function Rs(e){return f.useMemo(()=>({draggable:{...ft.draggable,...e?.draggable},droppable:{...ft.droppable,...e?.droppable},dragOverlay:{...ft.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function Ts(e){let{activeNode:t,measure:n,initialRect:r,config:o=!0}=e;const s=f.useRef(!1),{x:i,y:a}=typeof o=="boolean"?{x:o,y:o}:o;xe(()=>{if(!i&&!a||!t){s.current=!1;return}if(s.current||!r)return;const d=t?.node.current;if(!d||d.isConnected===!1)return;const g=n(d),h=lr(g,r);if(i||(h.x=0),a||(h.y=0),s.current=!0,Math.abs(h.x)>0||Math.abs(h.y)>0){const v=cr(d);v&&v.scrollBy({top:h.y,left:h.x})}},[t,i,a,r,n])}const yr=f.createContext({...pe,scaleX:1,scaleY:1});var Me;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(Me||(Me={}));const Sr=f.memo(function(t){var n,r,o,s;let{id:i,accessibility:a,autoScroll:c=!0,children:d,sensors:g=ys,collisionDetection:h=ko,measuring:v,modifiers:m,...p}=t;const x=f.useReducer(Es,void 0,Ds),[y,T]=x,[R,j]=wo(),[k,$]=f.useState(Me.Uninitialized),I=k===Me.Initialized,{draggable:{active:L,nodes:A,translate:B},droppable:{containers:W}}=y,z=L!=null?A.get(L):null,Y=f.useRef({initial:null,translated:null}),q=f.useMemo(()=>{var oe;return L!=null?{id:L,data:(oe=z?.data)!=null?oe:Ss,rect:Y}:null},[L,z]),M=f.useRef(null),[w,C]=f.useState(null),[E,D]=f.useState(null),O=Ze(p,Object.values(p)),N=nt("DndDescribedBy",i),b=f.useMemo(()=>W.getEnabled(),[W]),_=Rs(v),{droppableRects:P,measureDroppableContainers:F,measuringScheduled:K}=ls(b,{dragging:I,dependencies:[B.x,B.y],config:_.droppable}),G=is(A,L),H=f.useMemo(()=>E?Gt(E):null,[E]),X=io(),J=cs(G,_.draggable.measure);Ts({activeNode:L!=null?A.get(L):null,config:X.layoutShiftCompensation,initialRect:J,measure:_.draggable.measure});const V=In(G,_.draggable.measure,J),se=In(G?G.parentElement:null),re=f.useRef({activatorEvent:null,active:null,activeNode:G,collisionRect:null,collisions:null,droppableRects:P,draggableNodes:A,draggingNode:null,draggingNodeRect:null,droppableContainers:W,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),ge=W.getNodeFor((n=re.current.over)==null?void 0:n.id),be=bs({measure:_.dragOverlay.measure}),Oe=(r=be.nodeRef.current)!=null?r:G,_e=I?(o=be.rect)!=null?o:V:null,gn=!!(be.nodeRef.current&&be.rect),pn=fs(gn?null:V),_t=xr(Oe?ie(Oe):null),Se=hs(I?ge??G:null),rt=vs(Se),ot=js(m,{transform:{x:B.x-pn.x,y:B.y-pn.y,scaleX:1,scaleY:1},activatorEvent:E,active:q,activeNodeRect:V,containerNodeRect:se,draggingNodeRect:_e,over:re.current.over,overlayNodeRect:be.rect,scrollableAncestors:Se,scrollableAncestorRects:rt,windowRect:_t}),mn=H?Le(H,B):null,vn=gs(Se),Qr=$n(vn),eo=$n(vn,[V]),Ie=Le(ot,Qr),ke=_e?zo(_e,ot):null,Ve=q&&ke?h({active:q,collisionRect:ke,droppableRects:P,droppableContainers:b,pointerCoordinates:mn}):null,xn=_o(Ve,"id"),[we,bn]=f.useState(null),to=gn?ot:Le(ot,eo),no=$o(to,(s=we?.rect)!=null?s:null,V),It=f.useRef(null),yn=f.useCallback((oe,le)=>{let{sensor:ce,options:Ce}=le;if(M.current==null)return;const de=A.get(M.current);if(!de)return;const ue=oe.nativeEvent,me=new ce({active:M.current,activeNode:de,event:ue,options:Ce,context:re,onAbort(ee){if(!A.get(ee))return;const{onDragAbort:ve}=O.current,ye={id:ee};ve?.(ye),R({type:"onDragAbort",event:ye})},onPending(ee,De,ve,ye){if(!A.get(ee))return;const{onDragPending:He}=O.current,Ee={id:ee,constraint:De,initialCoordinates:ve,offset:ye};He?.(Ee),R({type:"onDragPending",event:Ee})},onStart(ee){const De=M.current;if(De==null)return;const ve=A.get(De);if(!ve)return;const{onDragStart:ye}=O.current,Ye={activatorEvent:ue,active:{id:De,data:ve.data,rect:Y}};ze.unstable_batchedUpdates(()=>{ye?.(Ye),$(Me.Initializing),T({type:Z.DragStart,initialCoordinates:ee,active:De}),R({type:"onDragStart",event:Ye}),C(It.current),D(ue)})},onMove(ee){T({type:Z.DragMove,coordinates:ee})},onEnd:$e(Z.DragEnd),onCancel:$e(Z.DragCancel)});It.current=me;function $e(ee){return async function(){const{active:ve,collisions:ye,over:Ye,scrollAdjustedTranslate:He}=re.current;let Ee=null;if(ve&&He){const{cancelDrop:Ue}=O.current;Ee={activatorEvent:ue,active:ve,collisions:ye,delta:He,over:Ye},ee===Z.DragEnd&&typeof Ue=="function"&&await Promise.resolve(Ue(Ee))&&(ee=Z.DragCancel)}M.current=null,ze.unstable_batchedUpdates(()=>{T({type:ee}),$(Me.Uninitialized),bn(null),C(null),D(null),It.current=null;const Ue=ee===Z.DragEnd?"onDragEnd":"onDragCancel";if(Ee){const kt=O.current[Ue];kt?.(Ee),R({type:Ue,event:Ee})}})}}},[A]),ro=f.useCallback((oe,le)=>(ce,Ce)=>{const de=ce.nativeEvent,ue=A.get(Ce);if(M.current!==null||!ue||de.dndKit||de.defaultPrevented)return;const me={active:ue};oe(ce,le.options,me)===!0&&(de.dndKit={capturedBy:le.sensor},M.current=Ce,yn(ce,le))},[A,yn]),Sn=as(g,ro);ps(g),xe(()=>{V&&k===Me.Initializing&&$(Me.Initialized)},[V,k]),f.useEffect(()=>{const{onDragMove:oe}=O.current,{active:le,activatorEvent:ce,collisions:Ce,over:de}=re.current;if(!le||!ce)return;const ue={active:le,activatorEvent:ce,collisions:Ce,delta:{x:Ie.x,y:Ie.y},over:de};ze.unstable_batchedUpdates(()=>{oe?.(ue),R({type:"onDragMove",event:ue})})},[Ie.x,Ie.y]),f.useEffect(()=>{const{active:oe,activatorEvent:le,collisions:ce,droppableContainers:Ce,scrollAdjustedTranslate:de}=re.current;if(!oe||M.current==null||!le||!de)return;const{onDragOver:ue}=O.current,me=Ce.get(xn),$e=me&&me.rect.current?{id:me.id,rect:me.rect.current,data:me.data,disabled:me.disabled}:null,ee={active:oe,activatorEvent:le,collisions:ce,delta:{x:de.x,y:de.y},over:$e};ze.unstable_batchedUpdates(()=>{bn($e),ue?.(ee),R({type:"onDragOver",event:ee})})},[xn]),xe(()=>{re.current={activatorEvent:E,active:q,activeNode:G,collisionRect:ke,collisions:Ve,droppableRects:P,draggableNodes:A,draggingNode:Oe,draggingNodeRect:_e,droppableContainers:W,over:we,scrollableAncestors:Se,scrollAdjustedTranslate:Ie},Y.current={initial:_e,translated:ke}},[q,G,Ve,ke,A,Oe,_e,P,W,we,Se,Ie]),rs({...X,delta:B,draggingRect:ke,pointerCoordinates:mn,scrollableAncestors:Se,scrollableAncestorRects:rt});const oo=f.useMemo(()=>({active:q,activeNode:G,activeNodeRect:V,activatorEvent:E,collisions:Ve,containerNodeRect:se,dragOverlay:be,draggableNodes:A,droppableContainers:W,droppableRects:P,over:we,measureDroppableContainers:F,scrollableAncestors:Se,scrollableAncestorRects:rt,measuringConfiguration:_,measuringScheduled:K,windowRect:_t}),[q,G,V,E,Ve,se,be,A,W,P,we,F,Se,rt,_,K,_t]),so=f.useMemo(()=>({activatorEvent:E,activators:Sn,active:q,activeNodeRect:V,ariaDescribedById:{draggable:N},dispatch:T,draggableNodes:A,over:we,measureDroppableContainers:F}),[E,Sn,q,V,T,N,A,we,F]);return f.createElement(ir.Provider,{value:j},f.createElement(Mt.Provider,{value:so},f.createElement(br.Provider,{value:oo},f.createElement(yr.Provider,{value:no},d)),f.createElement(Ms,{disabled:a?.restoreFocus===!1})),f.createElement(Eo,{...a,hiddenTextDescribedById:N}));function io(){const oe=w?.autoScrollEnabled===!1,le=typeof c=="object"?c.enabled===!1:c===!1,ce=I&&!oe&&!le;return typeof c=="object"?{...c,enabled:ce}:{enabled:ce}}}),Os=f.createContext(null),zn="button",_s="Draggable";function Is(e){let{id:t,data:n,disabled:r=!1,attributes:o}=e;const s=nt(_s),{activators:i,activatorEvent:a,active:c,activeNodeRect:d,ariaDescribedById:g,draggableNodes:h,over:v}=f.useContext(Mt),{role:m=zn,roleDescription:p="draggable",tabIndex:x=0}=o??{},y=c?.id===t,T=f.useContext(y?yr:Os),[R,j]=xt(),[k,$]=xt(),I=ms(i,t),L=Ze(n);xe(()=>(h.set(t,{id:t,key:s,node:R,activatorNode:k,data:L}),()=>{const B=h.get(t);B&&B.key===s&&h.delete(t)}),[h,t]);const A=f.useMemo(()=>({role:m,tabIndex:x,"aria-disabled":r,"aria-pressed":y&&m===zn?!0:void 0,"aria-roledescription":p,"aria-describedby":g.draggable}),[r,m,x,y,p,g.draggable]);return{active:c,activatorEvent:a,activeNodeRect:d,attributes:A,isDragging:y,listeners:r?void 0:I,node:R,over:v,setNodeRef:j,setActivatorNodeRef:$,transform:T}}function ks(){return f.useContext(br)}const $s="Droppable",As={timeout:25};function zs(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:o}=e;const s=nt($s),{active:i,dispatch:a,over:c,measureDroppableContainers:d}=f.useContext(Mt),g=f.useRef({disabled:n}),h=f.useRef(!1),v=f.useRef(null),m=f.useRef(null),{disabled:p,updateMeasurementsFor:x,timeout:y}={...As,...o},T=Ze(x??r),R=f.useCallback(()=>{if(!h.current){h.current=!0;return}m.current!=null&&clearTimeout(m.current),m.current=setTimeout(()=>{d(Array.isArray(T.current)?T.current:[T.current]),m.current=null},y)},[y]),j=Et({callback:R,disabled:p||!i}),k=f.useCallback((A,B)=>{j&&(B&&(j.unobserve(B),h.current=!1),A&&j.observe(A))},[j]),[$,I]=xt(k),L=Ze(t);return f.useEffect(()=>{!j||!$.current||(j.disconnect(),h.current=!1,j.observe($.current))},[$,j]),f.useEffect(()=>(a({type:Z.RegisterDroppable,element:{id:r,key:s,disabled:n,node:$,rect:v,data:L}}),()=>a({type:Z.UnregisterDroppable,key:s,id:r})),[r]),f.useEffect(()=>{n!==g.current.disabled&&(a({type:Z.SetDroppableDisabled,id:r,key:s,disabled:n}),g.current.disabled=n)},[r,s,n,a]),{active:i,rect:v,isOver:c?.id===r,node:$,over:c,setNodeRef:I}}function jt(e,t,n){const r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function Ls(e,t){return e.reduce((n,r,o)=>{const s=t.get(r);return s&&(n[o]=s),n},Array(e.length))}function it(e){return e!==null&&e>=0}function Ns(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 Ps(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const at={scaleX:1,scaleY:1},Fs=e=>{var t;let{rects:n,activeNodeRect:r,activeIndex:o,overIndex:s,index:i}=e;const a=(t=n[o])!=null?t:r;if(!a)return null;const c=Ws(n,i,o);if(i===o){const d=n[s];return d?{x:o<s?d.left+d.width-(a.left+a.width):d.left-a.left,y:0,...at}:null}return i>o&&i<=s?{x:-a.width-c,y:0,...at}:i<o&&i>=s?{x:a.width+c,y:0,...at}:{x:0,y:0,...at}};function Ws(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 wr=e=>{let{rects:t,activeIndex:n,overIndex:r,index:o}=e;const s=jt(t,r,n),i=t[o],a=s[o];return!a||!i?null:{x:a.left-i.left,y:a.top-i.top,scaleX:a.width/i.width,scaleY:a.height/i.height}},lt={scaleX:1,scaleY:1},Bs=e=>{var t;let{activeIndex:n,activeNodeRect:r,index:o,rects:s,overIndex:i}=e;const a=(t=s[n])!=null?t:r;if(!a)return null;if(o===n){const d=s[i];return d?{x:0,y:n<i?d.top+d.height-(a.top+a.height):d.top-a.top,...lt}:null}const c=Vs(s,o,n);return o>n&&o<=i?{x:0,y:-a.height-c,...lt}:o<n&&o>=i?{x:0,y:a.height+c,...lt}:{x:0,y:0,...lt}};function Vs(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 Cr="Sortable",Dr=f.createContext({activeIndex:-1,containerId:Cr,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:wr,disabled:{draggable:!1,droppable:!1}});function Er(e){let{children:t,id:n,items:r,strategy:o=wr,disabled:s=!1}=e;const{active:i,dragOverlay:a,droppableRects:c,over:d,measureDroppableContainers:g}=ks(),h=nt(Cr,n),v=a.rect!==null,m=f.useMemo(()=>r.map(I=>typeof I=="object"&&"id"in I?I.id:I),[r]),p=i!=null,x=i?m.indexOf(i.id):-1,y=d?m.indexOf(d.id):-1,T=f.useRef(m),R=!Ns(m,T.current),j=y!==-1&&x===-1||R,k=Ps(s);xe(()=>{R&&p&&g(m)},[R,m,p,g]),f.useEffect(()=>{T.current=m},[m]);const $=f.useMemo(()=>({activeIndex:x,containerId:h,disabled:k,disableTransforms:j,items:m,overIndex:y,useDragOverlay:v,sortedRects:Ls(m,c),strategy:o}),[x,h,k.draggable,k.droppable,j,m,y,c,v,o]);return f.createElement(Dr.Provider,{value:$},t)}const Ys=e=>{let{id:t,items:n,activeIndex:r,overIndex:o}=e;return jt(n,r,o).indexOf(t)},Hs=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:o,items:s,newIndex:i,previousItems:a,previousContainerId:c,transition:d}=e;return!d||!r||a!==s&&o===i?!1:n?!0:i!==o&&t===c},Us={duration:200,easing:"ease"},Mr="transform",Gs=Ne.Transition.toString({property:Mr,duration:0,easing:"linear"}),qs={roleDescription:"sortable"};function Ks(e){let{disabled:t,index:n,node:r,rect:o}=e;const[s,i]=f.useState(null),a=f.useRef(n);return xe(()=>{if(!t&&n!==a.current&&r.current){const c=o.current;if(c){const d=We(r.current,{ignoreTransform:!0}),g={x:c.left-d.left,y:c.top-d.top,scaleX:c.width/d.width,scaleY:c.height/d.height};(g.x||g.y)&&i(g)}}n!==a.current&&(a.current=n)},[t,n,r,o]),f.useEffect(()=>{s&&i(null)},[s]),s}function jr(e){let{animateLayoutChanges:t=Hs,attributes:n,disabled:r,data:o,getNewIndex:s=Ys,id:i,strategy:a,resizeObserverConfig:c,transition:d=Us}=e;const{items:g,containerId:h,activeIndex:v,disabled:m,disableTransforms:p,sortedRects:x,overIndex:y,useDragOverlay:T,strategy:R}=f.useContext(Dr),j=Xs(r,m),k=g.indexOf(i),$=f.useMemo(()=>({sortable:{containerId:h,index:k,items:g},...o}),[h,o,k,g]),I=f.useMemo(()=>g.slice(g.indexOf(i)),[g,i]),{rect:L,node:A,isOver:B,setNodeRef:W}=zs({id:i,data:$,disabled:j.droppable,resizeObserverConfig:{updateMeasurementsFor:I,...c}}),{active:z,activatorEvent:Y,activeNodeRect:q,attributes:M,setNodeRef:w,listeners:C,isDragging:E,over:D,setActivatorNodeRef:O,transform:N}=Is({id:i,data:$,attributes:{...qs,...n},disabled:j.draggable}),b=fo(W,w),_=!!z,P=_&&!p&&it(v)&&it(y),F=!T&&E,K=F&&P?N:null,H=P?K??(a??R)({rects:x,activeNodeRect:q,activeIndex:v,overIndex:y,index:k}):null,X=it(v)&&it(y)?s({id:i,items:g,activeIndex:v,overIndex:y}):k,J=z?.id,V=f.useRef({activeId:J,items:g,newIndex:X,containerId:h}),se=g!==V.current.items,re=t({active:z,containerId:h,isDragging:E,isSorting:_,id:i,index:k,items:g,newIndex:V.current.newIndex,previousItems:V.current.items,previousContainerId:V.current.containerId,transition:d,wasDragging:V.current.activeId!=null}),ge=Ks({disabled:!re,index:k,node:A,rect:L});return f.useEffect(()=>{_&&V.current.newIndex!==X&&(V.current.newIndex=X),h!==V.current.containerId&&(V.current.containerId=h),g!==V.current.items&&(V.current.items=g)},[_,X,h,g]),f.useEffect(()=>{if(J===V.current.activeId)return;if(J!=null&&V.current.activeId==null){V.current.activeId=J;return}const Oe=setTimeout(()=>{V.current.activeId=J},50);return()=>clearTimeout(Oe)},[J]),{active:z,activeIndex:v,attributes:M,data:$,rect:L,index:k,newIndex:X,items:g,isOver:B,isSorting:_,isDragging:E,listeners:C,node:A,overIndex:y,over:D,setNodeRef:b,setActivatorNodeRef:O,setDroppableNodeRef:W,setDraggableNodeRef:w,transform:ge??H,transition:be()};function be(){if(ge||se&&V.current.newIndex===k)return Gs;if(!(F&&!an(Y)||!d)&&(_||re))return Ne.Transition.toString({...d,property:Mr})}}function Xs(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 ct={exports:{}},Nt={},ut={exports:{}},Pt={};var Ln;function Js(){if(Ln)return Pt;Ln=1;var e=f;function t(h,v){return h===v&&(h!==0||1/h===1/v)||h!==h&&v!==v}var n=typeof Object.is=="function"?Object.is:t,r=e.useState,o=e.useEffect,s=e.useLayoutEffect,i=e.useDebugValue;function a(h,v){var m=v(),p=r({inst:{value:m,getSnapshot:v}}),x=p[0].inst,y=p[1];return s(function(){x.value=m,x.getSnapshot=v,c(x)&&y({inst:x})},[h,m,v]),o(function(){return c(x)&&y({inst:x}),h(function(){c(x)&&y({inst:x})})},[h]),i(m),m}function c(h){var v=h.getSnapshot;h=h.value;try{var m=v();return!n(h,m)}catch{return!0}}function d(h,v){return v()}var g=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?d:a;return Pt.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:g,Pt}var Ft={};var Nn;function Zs(){return Nn||(Nn=1,process.env.NODE_ENV!=="production"&&(function(){function e(m,p){return m===p&&(m!==0||1/m===1/p)||m!==m&&p!==p}function t(m,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 x=p();if(!h){var y=p();s(x,y)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),h=!0)}y=i({inst:{value:x,getSnapshot:p}});var T=y[0].inst,R=y[1];return c(function(){T.value=x,T.getSnapshot=p,n(T)&&R({inst:T})},[m,x,p]),a(function(){return n(T)&&R({inst:T}),m(function(){n(T)&&R({inst:T})})},[m]),d(x),x}function n(m){var p=m.getSnapshot;m=m.value;try{var x=p();return!s(m,x)}catch{return!0}}function r(m,p){return p()}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var o=f,s=typeof Object.is=="function"?Object.is:e,i=o.useState,a=o.useEffect,c=o.useLayoutEffect,d=o.useDebugValue,g=!1,h=!1,v=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?r:t;Ft.useSyncExternalStore=o.useSyncExternalStore!==void 0?o.useSyncExternalStore:v,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()),Ft}var Pn;function Rr(){return Pn||(Pn=1,process.env.NODE_ENV==="production"?ut.exports=Js():ut.exports=Zs()),ut.exports}var Fn;function Qs(){if(Fn)return Nt;Fn=1;var e=f,t=Rr();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,i=e.useEffect,a=e.useMemo,c=e.useDebugValue;return Nt.useSyncExternalStoreWithSelector=function(d,g,h,v,m){var p=s(null);if(p.current===null){var x={hasValue:!1,value:null};p.current=x}else x=p.current;p=a(function(){function T(I){if(!R){if(R=!0,j=I,I=v(I),m!==void 0&&x.hasValue){var L=x.value;if(m(L,I))return k=L}return k=I}if(L=k,r(j,I))return L;var A=v(I);return m!==void 0&&m(L,A)?(j=I,L):(j=I,k=A)}var R=!1,j,k,$=h===void 0?null:h;return[function(){return T(g())},$===null?void 0:function(){return T($())}]},[g,h,v,m]);var y=o(d,p[0],p[1]);return i(function(){x.hasValue=!0,x.value=y},[y]),c(y),y},Nt}var Wt={};var Wn;function ei(){return Wn||(Wn=1,process.env.NODE_ENV!=="production"&&(function(){function e(d,g){return d===g&&(d!==0||1/d===1/g)||d!==d&&g!==g}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var t=f,n=Rr(),r=typeof Object.is=="function"?Object.is:e,o=n.useSyncExternalStore,s=t.useRef,i=t.useEffect,a=t.useMemo,c=t.useDebugValue;Wt.useSyncExternalStoreWithSelector=function(d,g,h,v,m){var p=s(null);if(p.current===null){var x={hasValue:!1,value:null};p.current=x}else x=p.current;p=a(function(){function T(I){if(!R){if(R=!0,j=I,I=v(I),m!==void 0&&x.hasValue){var L=x.value;if(m(L,I))return k=L}return k=I}if(L=k,r(j,I))return L;var A=v(I);return m!==void 0&&m(L,A)?(j=I,L):(j=I,k=A)}var R=!1,j,k,$=h===void 0?null:h;return[function(){return T(g())},$===null?void 0:function(){return T($())}]},[g,h,v,m]);var y=o(d,p[0],p[1]);return i(function(){x.hasValue=!0,x.value=y},[y]),c(y),y},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()),Wt}var Bn;function ti(){return Bn||(Bn=1,process.env.NODE_ENV==="production"?ct.exports=Qs():ct.exports=ei()),ct.exports}var ni=ti();const Jt=new WeakMap,ri=new WeakMap,wt={current:[]};let Bt=!1;const dt=new Set,Vn=new Map;function Tr(e){for(const t of e){if(wt.current.includes(t))continue;wt.current.push(t),t.recompute();const n=ri.get(t);if(n)for(const r of n){const o=Jt.get(r);o?.length&&Tr(o)}}}function oi(e){const t={prevVal:e.prevState,currentVal:e.state};for(const n of e.listeners)n(t)}function si(e){const t={prevVal:e.prevState,currentVal:e.state};for(const n of e.listeners)n(t)}function ii(e){if(dt.add(e),!Bt)try{for(Bt=!0;dt.size>0;){const t=Array.from(dt);dt.clear();for(const n of t){const r=Vn.get(n)??n.prevState;n.prevState=r,oi(n)}for(const n of t){const r=Jt.get(n);r&&(wt.current.push(n),Tr(r))}for(const n of t){const r=Jt.get(n);if(r)for(const o of r)si(o)}}}finally{Bt=!1,wt.current=[],Vn.clear()}}function ai(e){return typeof e=="function"}class li{constructor(t,n){this.listeners=new Set,this.subscribe=r=>{var o,s;this.listeners.add(r);const i=(s=(o=this.options)==null?void 0:o.onSubscribe)==null?void 0:s.call(o,r,this);return()=>{this.listeners.delete(r),i?.()}},this.prevState=t,this.state=t,this.options=n}setState(t){var n,r,o;this.prevState=this.state,(n=this.options)!=null&&n.updateFn?this.state=this.options.updateFn(this.prevState)(t):ai(t)?this.state=t(this.prevState):this.state=t,(o=(r=this.options)==null?void 0:r.onUpdate)==null||o.call(r),ii(this)}}function Be(e,t=r=>r,n={}){const r=n.equal??ci;return ni.useSyncExternalStoreWithSelector(e.subscribe,()=>e.state,()=>e.state,t,r)}function ci(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))}function Ae(e,t,n){let r=n.initialDeps??[],o,s=!0;function i(){var a,c,d;let g;n.key&&((a=n.debug)!=null&&a.call(n))&&(g=Date.now());const h=e();if(!(h.length!==r.length||h.some((p,x)=>r[x]!==p)))return o;r=h;let m;if(n.key&&((c=n.debug)!=null&&c.call(n))&&(m=Date.now()),o=t(...h),n.key&&((d=n.debug)!=null&&d.call(n))){const p=Math.round((Date.now()-g)*100)/100,x=Math.round((Date.now()-m)*100)/100,y=x/16,T=(R,j)=>{for(R=String(R);R.length<j;)R=" "+R;return R};console.info(`%c⏱ ${T(x,5)} /${T(p,5)} ms`,`
|
|
10
|
+
`},Do={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 Eo(e){let{announcements:t=Do,container:n,hiddenTextDescribedById:r,screenReaderInstructions:o=Co}=e;const{announce:s,announcement:a}=yo(),i=nt("DndLiveRegion"),[c,d]=f.useState(!1);if(f.useEffect(()=>{d(!0)},[]),So(f.useMemo(()=>({onDragStart(h){let{active:v}=h;s(t.onDragStart({active:v}))},onDragMove(h){let{active:v,over:m}=h;t.onDragMove&&s(t.onDragMove({active:v,over:m}))},onDragOver(h){let{active:v,over:m}=h;s(t.onDragOver({active:v,over:m}))},onDragEnd(h){let{active:v,over:m}=h;s(t.onDragEnd({active:v,over:m}))},onDragCancel(h){let{active:v,over:m}=h;s(t.onDragCancel({active:v,over:m}))}}),[s,t])),!c)return null;const g=f.createElement(f.Fragment,null,f.createElement(xo,{id:r,value:o.draggable}),f.createElement(bo,{id:i,announcement:a}));return n?ze.createPortal(g,n):g}var Z;(function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"})(Z||(Z={}));function yt(){}function Mo(e,t){return f.useMemo(()=>({sensor:e,options:{}}),[e,t])}function jo(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return f.useMemo(()=>[...t].filter(r=>r!=null),[...t])}const pe=Object.freeze({x:0,y:0});function Ro(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function To(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function Oo(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function _o(e,t){if(!e||e.length===0)return null;const[n]=e;return n[t]}function Mn(e,t,n){return t===void 0&&(t=e.left),n===void 0&&(n=e.top),{x:t+e.width*.5,y:n+e.height*.5}}const ar=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=Mn(t,t.left,t.top),s=[];for(const a of r){const{id:i}=a,c=n.get(i);if(c){const d=Ro(Mn(c),o);s.push({id:i,data:{droppableContainer:a,value:d}})}}return s.sort(To)};function Io(e,t){const n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),o=Math.min(t.left+t.width,e.left+e.width),s=Math.min(t.top+t.height,e.top+e.height),a=o-r,i=s-n;if(r<o&&n<s){const c=t.width*t.height,d=e.width*e.height,g=a*i,h=g/(c+d-g);return Number(h.toFixed(4))}return 0}const ko=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=[];for(const s of r){const{id:a}=s,i=n.get(a);if(i){const c=Io(i,t);c>0&&o.push({id:a,data:{droppableContainer:s,value:c}})}}return o.sort(Oo)};function $o(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function lr(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:pe}function Ao(e){return function(n){for(var r=arguments.length,o=new Array(r>1?r-1:0),s=1;s<r;s++)o[s-1]=arguments[s];return o.reduce((a,i)=>({...a,top:a.top+e*i.y,bottom:a.bottom+e*i.y,left:a.left+e*i.x,right:a.right+e*i.x}),{...n})}}const zo=Ao(1);function Lo(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function No(e,t,n){const r=Lo(t);if(!r)return e;const{scaleX:o,scaleY:s,x:a,y:i}=r,c=e.left-a-(1-o)*parseFloat(n),d=e.top-i-(1-s)*parseFloat(n.slice(n.indexOf(" ")+1)),g=o?e.width/o:e.width,h=s?e.height/s:e.height;return{width:g,height:h,top:d,right:c+g,bottom:d+h,left:c}}const Po={ignoreTransform:!1};function We(e,t){t===void 0&&(t=Po);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:d,transformOrigin:g}=ie(e).getComputedStyle(e);d&&(n=No(n,d,g))}const{top:r,left:o,width:s,height:a,bottom:i,right:c}=n;return{top:r,left:o,width:s,height:a,bottom:i,right:c}}function jn(e){return We(e,{ignoreTransform:!0})}function Fo(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function Wo(e,t){return t===void 0&&(t=ie(e).getComputedStyle(e)),t.position==="fixed"}function Bo(e,t){t===void 0&&(t=ie(e).getComputedStyle(e));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(o=>{const s=t[o];return typeof s=="string"?n.test(s):!1})}function ln(e,t){const n=[];function r(o){if(t!=null&&n.length>=t||!o)return n;if(on(o)&&o.scrollingElement!=null&&!n.includes(o.scrollingElement))return n.push(o.scrollingElement),n;if(!et(o)||or(o)||n.includes(o))return n;const s=ie(e).getComputedStyle(o);return o!==e&&Bo(o,s)&&n.push(o),Wo(o,s)?n:r(o.parentNode)}return e?r(e):n}function cr(e){const[t]=ln(e,1);return t??null}function At(e){return!Dt||!e?null:Pe(e)?e:rn(e)?on(e)||e===Fe(e).scrollingElement?window:et(e)?e:null:null}function ur(e){return Pe(e)?e.scrollX:e.scrollLeft}function dr(e){return Pe(e)?e.scrollY:e.scrollTop}function qt(e){return{x:ur(e),y:dr(e)}}var Q;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(Q||(Q={}));function fr(e){return!Dt||!e?!1:e===document.scrollingElement}function hr(e){const t={x:0,y:0},n=fr(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height},o=e.scrollTop<=t.y,s=e.scrollLeft<=t.x,a=e.scrollTop>=r.y,i=e.scrollLeft>=r.x;return{isTop:o,isLeft:s,isBottom:a,isRight:i,maxScroll:r,minScroll:t}}const Vo={x:.2,y:.2};function Yo(e,t,n,r,o){let{top:s,left:a,right:i,bottom:c}=n;r===void 0&&(r=10),o===void 0&&(o=Vo);const{isTop:d,isBottom:g,isLeft:h,isRight:v}=hr(e),m={x:0,y:0},p={x:0,y:0},x={height:t.height*o.y,width:t.width*o.x};return!d&&s<=t.top+x.height?(m.y=Q.Backward,p.y=r*Math.abs((t.top+x.height-s)/x.height)):!g&&c>=t.bottom-x.height&&(m.y=Q.Forward,p.y=r*Math.abs((t.bottom-x.height-c)/x.height)),!v&&i>=t.right-x.width?(m.x=Q.Forward,p.x=r*Math.abs((t.right-x.width-i)/x.width)):!h&&a<=t.left+x.width&&(m.x=Q.Backward,p.x=r*Math.abs((t.left+x.width-a)/x.width)),{direction:m,speed:p}}function Ho(e){if(e===document.scrollingElement){const{innerWidth:s,innerHeight:a}=window;return{top:0,left:0,right:s,bottom:a,width:s,height:a}}const{top:t,left:n,right:r,bottom:o}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:o,width:e.clientWidth,height:e.clientHeight}}function gr(e){return e.reduce((t,n)=>Le(t,qt(n)),pe)}function Uo(e){return e.reduce((t,n)=>t+ur(n),0)}function Go(e){return e.reduce((t,n)=>t+dr(n),0)}function qo(e,t){if(t===void 0&&(t=We),!e)return;const{top:n,left:r,bottom:o,right:s}=t(e);cr(e)&&(o<=0||s<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const Ko=[["x",["left","right"],Uo],["y",["top","bottom"],Go]];class cn{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=ln(n),o=gr(r);this.rect={...t},this.width=t.width,this.height=t.height;for(const[s,a,i]of Ko)for(const c of a)Object.defineProperty(this,c,{get:()=>{const d=i(r),g=o[s]-d;return this.rect[c]+g},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class Ke{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 Xo(e){const{EventTarget:t}=ie(e);return e instanceof t?e:Fe(e)}function zt(e,t){const n=Math.abs(e.x),r=Math.abs(e.y);return typeof t=="number"?Math.sqrt(n**2+r**2)>t:"x"in t&&"y"in t?n>t.x&&r>t.y:"x"in t?n>t.x:"y"in t?r>t.y:!1}var fe;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(fe||(fe={}));function Rn(e){e.preventDefault()}function Jo(e){e.stopPropagation()}var H;(function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter",e.Tab="Tab"})(H||(H={}));const pr={start:[H.Space,H.Enter],cancel:[H.Esc],end:[H.Space,H.Enter,H.Tab]},Zo=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case H.Right:return{...n,x:n.x+25};case H.Left:return{...n,x:n.x-25};case H.Down:return{...n,y:n.y+25};case H.Up:return{...n,y:n.y-25}}};class mr{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 Ke(Fe(n)),this.windowListeners=new Ke(ie(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(fe.Resize,this.handleCancel),this.windowListeners.add(fe.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(fe.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props,r=t.node.current;r&&qo(r),n(pe)}handleKeyDown(t){if(an(t)){const{active:n,context:r,options:o}=this.props,{keyboardCodes:s=pr,coordinateGetter:a=Zo,scrollBehavior:i="smooth"}=o,{code:c}=t;if(s.end.includes(c)){this.handleEnd(t);return}if(s.cancel.includes(c)){this.handleCancel(t);return}const{collisionRect:d}=r.current,g=d?{x:d.left,y:d.top}:pe;this.referenceCoordinates||(this.referenceCoordinates=g);const h=a(t,{active:n,context:r.current,currentCoordinates:g});if(h){const v=bt(h,g),m={x:0,y:0},{scrollableAncestors:p}=r.current;for(const x of p){const y=t.code,{isTop:M,isRight:R,isLeft:j,isBottom:I,maxScroll:$,minScroll:k}=hr(x),L=Ho(x),A={x:Math.min(y===H.Right?L.right-L.width/2:L.right,Math.max(y===H.Right?L.left:L.left+L.width/2,h.x)),y:Math.min(y===H.Down?L.bottom-L.height/2:L.bottom,Math.max(y===H.Down?L.top:L.top+L.height/2,h.y))},V=y===H.Right&&!R||y===H.Left&&!j,W=y===H.Down&&!I||y===H.Up&&!M;if(V&&A.x!==h.x){const z=x.scrollLeft+v.x,q=y===H.Right&&z<=$.x||y===H.Left&&z>=k.x;if(q&&!v.y){x.scrollTo({left:z,behavior:i});return}q?m.x=x.scrollLeft-z:m.x=y===H.Right?x.scrollLeft-$.x:x.scrollLeft-k.x,m.x&&x.scrollBy({left:-m.x,behavior:i});break}else if(W&&A.y!==h.y){const z=x.scrollTop+v.y,q=y===H.Down&&z<=$.y||y===H.Up&&z>=k.y;if(q&&!v.x){x.scrollTo({top:z,behavior:i});return}q?m.y=x.scrollTop-z:m.y=y===H.Down?x.scrollTop-$.y:x.scrollTop-k.y,m.y&&x.scrollBy({top:-m.y,behavior:i});break}}this.handleMove(t,Le(bt(h,this.referenceCoordinates),m))}}}handleMove(t,n){const{onMove:r}=this.props;t.preventDefault(),r(n)}handleEnd(t){const{onEnd:n}=this.props;t.preventDefault(),this.detach(),n()}handleCancel(t){const{onCancel:n}=this.props;t.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}mr.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:r=pr,onActivation:o}=t,{active:s}=n;const{code:a}=e.nativeEvent;if(r.start.includes(a)){const i=s.activatorNode.current;return i&&e.target!==i?!1:(e.preventDefault(),o?.({event:e.nativeEvent}),!0)}return!1}}];function Tn(e){return!!(e&&"distance"in e)}function On(e){return!!(e&&"delay"in e)}class un{constructor(t,n,r){var o;r===void 0&&(r=Xo(t.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=t,this.events=n;const{event:s}=t,{target:a}=s;this.props=t,this.events=n,this.document=Fe(a),this.documentListeners=new Ke(this.document),this.listeners=new Ke(r),this.windowListeners=new Ke(ie(a)),this.initialCoordinates=(o=Gt(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(On(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(Tn(n)){this.handlePending(n);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(t,n){const{active:r,onPending:o}=this.props;o(r,t,this.initialCoordinates,n)}handleStart(){const{initialCoordinates:t}=this,{onStart:n}=this.props;t&&(this.activated=!0,this.documentListeners.add(fe.Click,Jo,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(fe.SelectionChange,this.removeTextSelection),n(t))}handleMove(t){var n;const{activated:r,initialCoordinates:o,props:s}=this,{onMove:a,options:{activationConstraint:i}}=s;if(!o)return;const c=(n=Gt(t))!=null?n:pe,d=bt(o,c);if(!r&&i){if(Tn(i)){if(i.tolerance!=null&&zt(d,i.tolerance))return this.handleCancel();if(zt(d,i.distance))return this.handleStart()}if(On(i)&&zt(d,i.tolerance))return this.handleCancel();this.handlePending(i,d);return}t.cancelable&&t.preventDefault(),a(c)}handleEnd(){const{onAbort:t,onEnd:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleCancel(){const{onAbort:t,onCancel:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleKeydown(t){t.code===H.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const Qo={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class dn extends un{constructor(t){const{event:n}=t,r=Fe(n.target);super(t,Qo,r)}}dn.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 es={move:{name:"mousemove"},end:{name:"mouseup"}};var Kt;(function(e){e[e.RightClick=2]="RightClick"})(Kt||(Kt={}));class ts extends un{constructor(t){super(t,es,Fe(t.event.target))}}ts.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===Kt.RightClick?!1:(r?.({event:n}),!0)}}];const Lt={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class ns extends un{constructor(t){super(t,Lt)}static setup(){return window.addEventListener(Lt.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(Lt.move.name,t)};function t(){}}}ns.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;const{touches:o}=n;return o.length>1?!1:(r?.({event:n}),!0)}}];var Xe;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(Xe||(Xe={}));var St;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(St||(St={}));function rs(e){let{acceleration:t,activator:n=Xe.Pointer,canScroll:r,draggingRect:o,enabled:s,interval:a=5,order:i=St.TreeOrder,pointerCoordinates:c,scrollableAncestors:d,scrollableAncestorRects:g,delta:h,threshold:v}=e;const m=ss({delta:h,disabled:!s}),[p,x]=ho(),y=f.useRef({x:0,y:0}),M=f.useRef({x:0,y:0}),R=f.useMemo(()=>{switch(n){case Xe.Pointer:return c?{top:c.y,bottom:c.y,left:c.x,right:c.x}:null;case Xe.DraggableRect:return o}},[n,o,c]),j=f.useRef(null),I=f.useCallback(()=>{const k=j.current;if(!k)return;const L=y.current.x*M.current.x,A=y.current.y*M.current.y;k.scrollBy(L,A)},[]),$=f.useMemo(()=>i===St.TreeOrder?[...d].reverse():d,[i,d]);f.useEffect(()=>{if(!s||!d.length||!R){x();return}for(const k of $){if(r?.(k)===!1)continue;const L=d.indexOf(k),A=g[L];if(!A)continue;const{direction:V,speed:W}=Yo(k,A,R,t,v);for(const z of["x","y"])m[z][V[z]]||(W[z]=0,V[z]=0);if(W.x>0||W.y>0){x(),j.current=k,p(I,a),y.current=W,M.current=V;return}}y.current={x:0,y:0},M.current={x:0,y:0},x()},[t,I,r,x,s,a,JSON.stringify(R),JSON.stringify(m),p,d,$,g,JSON.stringify(v)])}const os={x:{[Q.Backward]:!1,[Q.Forward]:!1},y:{[Q.Backward]:!1,[Q.Forward]:!1}};function ss(e){let{delta:t,disabled:n}=e;const r=Ut(t);return tt(o=>{if(n||!r||!o)return os;const s={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[Q.Backward]:o.x[Q.Backward]||s.x===-1,[Q.Forward]:o.x[Q.Forward]||s.x===1},y:{[Q.Backward]:o.y[Q.Backward]||s.y===-1,[Q.Forward]:o.y[Q.Forward]||s.y===1}}},[n,t,r])}function is(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 as(e,t){return f.useMemo(()=>e.reduce((n,r)=>{const{sensor:o}=r,s=o.activators.map(a=>({eventName:a.eventName,handler:t(a.handler,r)}));return[...n,...s]},[]),[e,t])}var Qe;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(Qe||(Qe={}));var Xt;(function(e){e.Optimized="optimized"})(Xt||(Xt={}));const _n=new Map;function ls(e,t){let{dragging:n,dependencies:r,config:o}=t;const[s,a]=f.useState(null),{frequency:i,measure:c,strategy:d}=o,g=f.useRef(e),h=y(),v=Ze(h),m=f.useCallback(function(M){M===void 0&&(M=[]),!v.current&&a(R=>R===null?M:R.concat(M.filter(j=>!R.includes(j))))},[v]),p=f.useRef(null),x=tt(M=>{if(h&&!n)return _n;if(!M||M===_n||g.current!==e||s!=null){const R=new Map;for(let j of e){if(!j)continue;if(s&&s.length>0&&!s.includes(j.id)&&j.rect.current){R.set(j.id,j.rect.current);continue}const I=j.node.current,$=I?new cn(c(I),I):null;j.rect.current=$,$&&R.set(j.id,$)}return R}return M},[e,s,n,h,c]);return f.useEffect(()=>{g.current=e},[e]),f.useEffect(()=>{h||m()},[n,h]),f.useEffect(()=>{s&&s.length>0&&a(null)},[JSON.stringify(s)]),f.useEffect(()=>{h||typeof i!="number"||p.current!==null||(p.current=setTimeout(()=>{m(),p.current=null},i))},[i,h,m,...r]),{droppableRects:x,measureDroppableContainers:m,measuringScheduled:s!=null};function y(){switch(d){case Qe.Always:return!1;case Qe.BeforeDragging:return n;default:return!n}}}function vr(e,t){return tt(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function cs(e,t){return vr(e,t)}function us(e){let{callback:t,disabled:n}=e;const r=sn(t),o=f.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:s}=window;return new s(r)},[r,n]);return f.useEffect(()=>()=>o?.disconnect(),[o]),o}function Et(e){let{callback:t,disabled:n}=e;const r=sn(t),o=f.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:s}=window;return new s(r)},[n]);return f.useEffect(()=>()=>o?.disconnect(),[o]),o}function ds(e){return new cn(We(e),e)}function In(e,t,n){t===void 0&&(t=ds);const[r,o]=f.useState(null);function s(){o(c=>{if(!e)return null;if(e.isConnected===!1){var d;return(d=c??n)!=null?d:null}const g=t(e);return JSON.stringify(c)===JSON.stringify(g)?c:g})}const a=us({callback(c){if(e)for(const d of c){const{type:g,target:h}=d;if(g==="childList"&&h instanceof HTMLElement&&h.contains(e)){s();break}}}}),i=Et({callback:s});return xe(()=>{s(),e?(i?.observe(e),a?.observe(document.body,{childList:!0,subtree:!0})):(i?.disconnect(),a?.disconnect())},[e]),r}function fs(e){const t=vr(e);return lr(e,t)}const kn=[];function hs(e){const t=f.useRef(e),n=tt(r=>e?r&&r!==kn&&e&&t.current&&e.parentNode===t.current.parentNode?r:ln(e):kn,[e]);return f.useEffect(()=>{t.current=e},[e]),n}function gs(e){const[t,n]=f.useState(null),r=f.useRef(e),o=f.useCallback(s=>{const a=At(s.target);a&&n(i=>i?(i.set(a,qt(a)),new Map(i)):null)},[]);return f.useEffect(()=>{const s=r.current;if(e!==s){a(s);const i=e.map(c=>{const d=At(c);return d?(d.addEventListener("scroll",o,{passive:!0}),[d,qt(d)]):null}).filter(c=>c!=null);n(i.length?new Map(i):null),r.current=e}return()=>{a(e),a(s)};function a(i){i.forEach(c=>{const d=At(c);d?.removeEventListener("scroll",o)})}},[o,e]),f.useMemo(()=>e.length?t?Array.from(t.values()).reduce((s,a)=>Le(s,a),pe):gr(e):pe,[e,t])}function $n(e,t){t===void 0&&(t=[]);const n=f.useRef(null);return f.useEffect(()=>{n.current=null},t),f.useEffect(()=>{const r=e!==pe;r&&!n.current&&(n.current=e),!r&&n.current&&(n.current=null)},[e]),n.current?bt(e,n.current):pe}function ps(e){f.useEffect(()=>{if(!Dt)return;const t=e.map(n=>{let{sensor:r}=n;return r.setup==null?void 0:r.setup()});return()=>{for(const n of t)n?.()}},e.map(t=>{let{sensor:n}=t;return n}))}function ms(e,t){return f.useMemo(()=>e.reduce((n,r)=>{let{eventName:o,handler:s}=r;return n[o]=a=>{s(a,t)},n},{}),[e,t])}function xr(e){return f.useMemo(()=>e?Fo(e):null,[e])}const An=[];function vs(e,t){t===void 0&&(t=We);const[n]=e,r=xr(n?ie(n):null),[o,s]=f.useState(An);function a(){s(()=>e.length?e.map(c=>fr(c)?r:new cn(t(c),c)):An)}const i=Et({callback:a});return xe(()=>{i?.disconnect(),a(),e.forEach(c=>i?.observe(c))},[e]),o}function xs(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return et(t)?t:e}function bs(e){let{measure:t}=e;const[n,r]=f.useState(null),o=f.useCallback(d=>{for(const{target:g}of d)if(et(g)){r(h=>{const v=t(g);return h?{...h,width:v.width,height:v.height}:v});break}},[t]),s=Et({callback:o}),a=f.useCallback(d=>{const g=xs(d);s?.disconnect(),g&&s?.observe(g),r(g?t(g):null)},[t,s]),[i,c]=xt(a);return f.useMemo(()=>({nodeRef:i,rect:n,setRef:c}),[n,i,c])}const ys=[{sensor:dn,options:{}},{sensor:mr,options:{}}],Ss={current:{}},ft={draggable:{measure:jn},droppable:{measure:jn,strategy:Qe.WhileDragging,frequency:Xt.Optimized},dragOverlay:{measure:We}};class Je 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 ws={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Je,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:yt},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:ft,measureDroppableContainers:yt,windowRect:null,measuringScheduled:!1},Cs={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:yt,draggableNodes:new Map,over:null,measureDroppableContainers:yt},Mt=f.createContext(Cs),br=f.createContext(ws);function Ds(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Je}}}function Es(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 Je(e.droppable.containers);return o.set(r,n),{...e,droppable:{...e.droppable,containers:o}}}case Z.SetDroppableDisabled:{const{id:n,key:r,disabled:o}=t,s=e.droppable.containers.get(n);if(!s||r!==s.key)return e;const a=new Je(e.droppable.containers);return a.set(n,{...s,disabled:o}),{...e,droppable:{...e.droppable,containers:a}}}case Z.UnregisterDroppable:{const{id:n,key:r}=t,o=e.droppable.containers.get(n);if(!o||r!==o.key)return e;const s=new Je(e.droppable.containers);return s.delete(n),{...e,droppable:{...e.droppable,containers:s}}}default:return e}}function Ms(e){let{disabled:t}=e;const{active:n,activatorEvent:r,draggableNodes:o}=f.useContext(Mt),s=Ut(r),a=Ut(n?.id);return f.useEffect(()=>{if(!t&&!r&&s&&a!=null){if(!an(s)||document.activeElement===s.target)return;const i=o.get(a);if(!i)return;const{activatorNode:c,node:d}=i;if(!c.current&&!d.current)return;requestAnimationFrame(()=>{for(const g of[c.current,d.current]){if(!g)continue;const h=mo(g);if(h){h.focus();break}}})}},[r,t,o,a,s]),null}function js(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((o,s)=>s({transform:o,...r}),n):n}function Rs(e){return f.useMemo(()=>({draggable:{...ft.draggable,...e?.draggable},droppable:{...ft.droppable,...e?.droppable},dragOverlay:{...ft.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function Ts(e){let{activeNode:t,measure:n,initialRect:r,config:o=!0}=e;const s=f.useRef(!1),{x:a,y:i}=typeof o=="boolean"?{x:o,y:o}:o;xe(()=>{if(!a&&!i||!t){s.current=!1;return}if(s.current||!r)return;const d=t?.node.current;if(!d||d.isConnected===!1)return;const g=n(d),h=lr(g,r);if(a||(h.x=0),i||(h.y=0),s.current=!0,Math.abs(h.x)>0||Math.abs(h.y)>0){const v=cr(d);v&&v.scrollBy({top:h.y,left:h.x})}},[t,a,i,r,n])}const yr=f.createContext({...pe,scaleX:1,scaleY:1});var Me;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(Me||(Me={}));const Sr=f.memo(function(t){var n,r,o,s;let{id:a,accessibility:i,autoScroll:c=!0,children:d,sensors:g=ys,collisionDetection:h=ko,measuring:v,modifiers:m,...p}=t;const x=f.useReducer(Es,void 0,Ds),[y,M]=x,[R,j]=wo(),[I,$]=f.useState(Me.Uninitialized),k=I===Me.Initialized,{draggable:{active:L,nodes:A,translate:V},droppable:{containers:W}}=y,z=L!=null?A.get(L):null,q=f.useRef({initial:null,translated:null}),K=f.useMemo(()=>{var oe;return L!=null?{id:L,data:(oe=z?.data)!=null?oe:Ss,rect:q}:null},[L,z]),T=f.useRef(null),[w,C]=f.useState(null),[E,D]=f.useState(null),O=Ze(p,Object.values(p)),N=nt("DndDescribedBy",a),b=f.useMemo(()=>W.getEnabled(),[W]),_=Rs(v),{droppableRects:P,measureDroppableContainers:F,measuringScheduled:G}=ls(b,{dragging:k,dependencies:[V.x,V.y],config:_.droppable}),U=is(A,L),Y=f.useMemo(()=>E?Gt(E):null,[E]),X=io(),J=cs(U,_.draggable.measure);Ts({activeNode:L!=null?A.get(L):null,config:X.layoutShiftCompensation,initialRect:J,measure:_.draggable.measure});const B=In(U,_.draggable.measure,J),se=In(U?U.parentElement:null),re=f.useRef({activatorEvent:null,active:null,activeNode:U,collisionRect:null,collisions:null,droppableRects:P,draggableNodes:A,draggingNode:null,draggingNodeRect:null,droppableContainers:W,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),ge=W.getNodeFor((n=re.current.over)==null?void 0:n.id),be=bs({measure:_.dragOverlay.measure}),Oe=(r=be.nodeRef.current)!=null?r:U,_e=k?(o=be.rect)!=null?o:B:null,gn=!!(be.nodeRef.current&&be.rect),pn=fs(gn?null:B),_t=xr(Oe?ie(Oe):null),Se=hs(k?ge??U:null),rt=vs(Se),ot=js(m,{transform:{x:V.x-pn.x,y:V.y-pn.y,scaleX:1,scaleY:1},activatorEvent:E,active:K,activeNodeRect:B,containerNodeRect:se,draggingNodeRect:_e,over:re.current.over,overlayNodeRect:be.rect,scrollableAncestors:Se,scrollableAncestorRects:rt,windowRect:_t}),mn=Y?Le(Y,V):null,vn=gs(Se),Qr=$n(vn),eo=$n(vn,[B]),Ie=Le(ot,Qr),ke=_e?zo(_e,ot):null,Ve=K&&ke?h({active:K,collisionRect:ke,droppableRects:P,droppableContainers:b,pointerCoordinates:mn}):null,xn=_o(Ve,"id"),[we,bn]=f.useState(null),to=gn?ot:Le(ot,eo),no=$o(to,(s=we?.rect)!=null?s:null,B),It=f.useRef(null),yn=f.useCallback((oe,le)=>{let{sensor:ce,options:Ce}=le;if(T.current==null)return;const de=A.get(T.current);if(!de)return;const ue=oe.nativeEvent,me=new ce({active:T.current,activeNode:de,event:ue,options:Ce,context:re,onAbort(ee){if(!A.get(ee))return;const{onDragAbort:ve}=O.current,ye={id:ee};ve?.(ye),R({type:"onDragAbort",event:ye})},onPending(ee,De,ve,ye){if(!A.get(ee))return;const{onDragPending:He}=O.current,Ee={id:ee,constraint:De,initialCoordinates:ve,offset:ye};He?.(Ee),R({type:"onDragPending",event:Ee})},onStart(ee){const De=T.current;if(De==null)return;const ve=A.get(De);if(!ve)return;const{onDragStart:ye}=O.current,Ye={activatorEvent:ue,active:{id:De,data:ve.data,rect:q}};ze.unstable_batchedUpdates(()=>{ye?.(Ye),$(Me.Initializing),M({type:Z.DragStart,initialCoordinates:ee,active:De}),R({type:"onDragStart",event:Ye}),C(It.current),D(ue)})},onMove(ee){M({type:Z.DragMove,coordinates:ee})},onEnd:$e(Z.DragEnd),onCancel:$e(Z.DragCancel)});It.current=me;function $e(ee){return async function(){const{active:ve,collisions:ye,over:Ye,scrollAdjustedTranslate:He}=re.current;let Ee=null;if(ve&&He){const{cancelDrop:Ue}=O.current;Ee={activatorEvent:ue,active:ve,collisions:ye,delta:He,over:Ye},ee===Z.DragEnd&&typeof Ue=="function"&&await Promise.resolve(Ue(Ee))&&(ee=Z.DragCancel)}T.current=null,ze.unstable_batchedUpdates(()=>{M({type:ee}),$(Me.Uninitialized),bn(null),C(null),D(null),It.current=null;const Ue=ee===Z.DragEnd?"onDragEnd":"onDragCancel";if(Ee){const kt=O.current[Ue];kt?.(Ee),R({type:Ue,event:Ee})}})}}},[A]),ro=f.useCallback((oe,le)=>(ce,Ce)=>{const de=ce.nativeEvent,ue=A.get(Ce);if(T.current!==null||!ue||de.dndKit||de.defaultPrevented)return;const me={active:ue};oe(ce,le.options,me)===!0&&(de.dndKit={capturedBy:le.sensor},T.current=Ce,yn(ce,le))},[A,yn]),Sn=as(g,ro);ps(g),xe(()=>{B&&I===Me.Initializing&&$(Me.Initialized)},[B,I]),f.useEffect(()=>{const{onDragMove:oe}=O.current,{active:le,activatorEvent:ce,collisions:Ce,over:de}=re.current;if(!le||!ce)return;const ue={active:le,activatorEvent:ce,collisions:Ce,delta:{x:Ie.x,y:Ie.y},over:de};ze.unstable_batchedUpdates(()=>{oe?.(ue),R({type:"onDragMove",event:ue})})},[Ie.x,Ie.y]),f.useEffect(()=>{const{active:oe,activatorEvent:le,collisions:ce,droppableContainers:Ce,scrollAdjustedTranslate:de}=re.current;if(!oe||T.current==null||!le||!de)return;const{onDragOver:ue}=O.current,me=Ce.get(xn),$e=me&&me.rect.current?{id:me.id,rect:me.rect.current,data:me.data,disabled:me.disabled}:null,ee={active:oe,activatorEvent:le,collisions:ce,delta:{x:de.x,y:de.y},over:$e};ze.unstable_batchedUpdates(()=>{bn($e),ue?.(ee),R({type:"onDragOver",event:ee})})},[xn]),xe(()=>{re.current={activatorEvent:E,active:K,activeNode:U,collisionRect:ke,collisions:Ve,droppableRects:P,draggableNodes:A,draggingNode:Oe,draggingNodeRect:_e,droppableContainers:W,over:we,scrollableAncestors:Se,scrollAdjustedTranslate:Ie},q.current={initial:_e,translated:ke}},[K,U,Ve,ke,A,Oe,_e,P,W,we,Se,Ie]),rs({...X,delta:V,draggingRect:ke,pointerCoordinates:mn,scrollableAncestors:Se,scrollableAncestorRects:rt});const oo=f.useMemo(()=>({active:K,activeNode:U,activeNodeRect:B,activatorEvent:E,collisions:Ve,containerNodeRect:se,dragOverlay:be,draggableNodes:A,droppableContainers:W,droppableRects:P,over:we,measureDroppableContainers:F,scrollableAncestors:Se,scrollableAncestorRects:rt,measuringConfiguration:_,measuringScheduled:G,windowRect:_t}),[K,U,B,E,Ve,se,be,A,W,P,we,F,Se,rt,_,G,_t]),so=f.useMemo(()=>({activatorEvent:E,activators:Sn,active:K,activeNodeRect:B,ariaDescribedById:{draggable:N},dispatch:M,draggableNodes:A,over:we,measureDroppableContainers:F}),[E,Sn,K,B,M,N,A,we,F]);return f.createElement(ir.Provider,{value:j},f.createElement(Mt.Provider,{value:so},f.createElement(br.Provider,{value:oo},f.createElement(yr.Provider,{value:no},d)),f.createElement(Ms,{disabled:i?.restoreFocus===!1})),f.createElement(Eo,{...i,hiddenTextDescribedById:N}));function io(){const oe=w?.autoScrollEnabled===!1,le=typeof c=="object"?c.enabled===!1:c===!1,ce=k&&!oe&&!le;return typeof c=="object"?{...c,enabled:ce}:{enabled:ce}}}),Os=f.createContext(null),zn="button",_s="Draggable";function Is(e){let{id:t,data:n,disabled:r=!1,attributes:o}=e;const s=nt(_s),{activators:a,activatorEvent:i,active:c,activeNodeRect:d,ariaDescribedById:g,draggableNodes:h,over:v}=f.useContext(Mt),{role:m=zn,roleDescription:p="draggable",tabIndex:x=0}=o??{},y=c?.id===t,M=f.useContext(y?yr:Os),[R,j]=xt(),[I,$]=xt(),k=ms(a,t),L=Ze(n);xe(()=>(h.set(t,{id:t,key:s,node:R,activatorNode:I,data:L}),()=>{const V=h.get(t);V&&V.key===s&&h.delete(t)}),[h,t]);const A=f.useMemo(()=>({role:m,tabIndex:x,"aria-disabled":r,"aria-pressed":y&&m===zn?!0:void 0,"aria-roledescription":p,"aria-describedby":g.draggable}),[r,m,x,y,p,g.draggable]);return{active:c,activatorEvent:i,activeNodeRect:d,attributes:A,isDragging:y,listeners:r?void 0:k,node:R,over:v,setNodeRef:j,setActivatorNodeRef:$,transform:M}}function ks(){return f.useContext(br)}const $s="Droppable",As={timeout:25};function zs(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:o}=e;const s=nt($s),{active:a,dispatch:i,over:c,measureDroppableContainers:d}=f.useContext(Mt),g=f.useRef({disabled:n}),h=f.useRef(!1),v=f.useRef(null),m=f.useRef(null),{disabled:p,updateMeasurementsFor:x,timeout:y}={...As,...o},M=Ze(x??r),R=f.useCallback(()=>{if(!h.current){h.current=!0;return}m.current!=null&&clearTimeout(m.current),m.current=setTimeout(()=>{d(Array.isArray(M.current)?M.current:[M.current]),m.current=null},y)},[y]),j=Et({callback:R,disabled:p||!a}),I=f.useCallback((A,V)=>{j&&(V&&(j.unobserve(V),h.current=!1),A&&j.observe(A))},[j]),[$,k]=xt(I),L=Ze(t);return f.useEffect(()=>{!j||!$.current||(j.disconnect(),h.current=!1,j.observe($.current))},[$,j]),f.useEffect(()=>(i({type:Z.RegisterDroppable,element:{id:r,key:s,disabled:n,node:$,rect:v,data:L}}),()=>i({type:Z.UnregisterDroppable,key:s,id:r})),[r]),f.useEffect(()=>{n!==g.current.disabled&&(i({type:Z.SetDroppableDisabled,id:r,key:s,disabled:n}),g.current.disabled=n)},[r,s,n,i]),{active:a,rect:v,isOver:c?.id===r,node:$,over:c,setNodeRef:k}}function jt(e,t,n){const r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function Ls(e,t){return e.reduce((n,r,o)=>{const s=t.get(r);return s&&(n[o]=s),n},Array(e.length))}function it(e){return e!==null&&e>=0}function Ns(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 Ps(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const at={scaleX:1,scaleY:1},Fs=e=>{var t;let{rects:n,activeNodeRect:r,activeIndex:o,overIndex:s,index:a}=e;const i=(t=n[o])!=null?t:r;if(!i)return null;const c=Ws(n,a,o);if(a===o){const d=n[s];return d?{x:o<s?d.left+d.width-(i.left+i.width):d.left-i.left,y:0,...at}:null}return a>o&&a<=s?{x:-i.width-c,y:0,...at}:a<o&&a>=s?{x:i.width+c,y:0,...at}:{x:0,y:0,...at}};function Ws(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 wr=e=>{let{rects:t,activeIndex:n,overIndex:r,index:o}=e;const s=jt(t,r,n),a=t[o],i=s[o];return!i||!a?null:{x:i.left-a.left,y:i.top-a.top,scaleX:i.width/a.width,scaleY:i.height/a.height}},lt={scaleX:1,scaleY:1},Bs=e=>{var t;let{activeIndex:n,activeNodeRect:r,index:o,rects:s,overIndex:a}=e;const i=(t=s[n])!=null?t:r;if(!i)return null;if(o===n){const d=s[a];return d?{x:0,y:n<a?d.top+d.height-(i.top+i.height):d.top-i.top,...lt}:null}const c=Vs(s,o,n);return o>n&&o<=a?{x:0,y:-i.height-c,...lt}:o<n&&o>=a?{x:0,y:i.height+c,...lt}:{x:0,y:0,...lt}};function Vs(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 Cr="Sortable",Dr=f.createContext({activeIndex:-1,containerId:Cr,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:wr,disabled:{draggable:!1,droppable:!1}});function Er(e){let{children:t,id:n,items:r,strategy:o=wr,disabled:s=!1}=e;const{active:a,dragOverlay:i,droppableRects:c,over:d,measureDroppableContainers:g}=ks(),h=nt(Cr,n),v=i.rect!==null,m=f.useMemo(()=>r.map(k=>typeof k=="object"&&"id"in k?k.id:k),[r]),p=a!=null,x=a?m.indexOf(a.id):-1,y=d?m.indexOf(d.id):-1,M=f.useRef(m),R=!Ns(m,M.current),j=y!==-1&&x===-1||R,I=Ps(s);xe(()=>{R&&p&&g(m)},[R,m,p,g]),f.useEffect(()=>{M.current=m},[m]);const $=f.useMemo(()=>({activeIndex:x,containerId:h,disabled:I,disableTransforms:j,items:m,overIndex:y,useDragOverlay:v,sortedRects:Ls(m,c),strategy:o}),[x,h,I.draggable,I.droppable,j,m,y,c,v,o]);return f.createElement(Dr.Provider,{value:$},t)}const Ys=e=>{let{id:t,items:n,activeIndex:r,overIndex:o}=e;return jt(n,r,o).indexOf(t)},Hs=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:o,items:s,newIndex:a,previousItems:i,previousContainerId:c,transition:d}=e;return!d||!r||i!==s&&o===a?!1:n?!0:a!==o&&t===c},Us={duration:200,easing:"ease"},Mr="transform",Gs=Ne.Transition.toString({property:Mr,duration:0,easing:"linear"}),qs={roleDescription:"sortable"};function Ks(e){let{disabled:t,index:n,node:r,rect:o}=e;const[s,a]=f.useState(null),i=f.useRef(n);return xe(()=>{if(!t&&n!==i.current&&r.current){const c=o.current;if(c){const d=We(r.current,{ignoreTransform:!0}),g={x:c.left-d.left,y:c.top-d.top,scaleX:c.width/d.width,scaleY:c.height/d.height};(g.x||g.y)&&a(g)}}n!==i.current&&(i.current=n)},[t,n,r,o]),f.useEffect(()=>{s&&a(null)},[s]),s}function jr(e){let{animateLayoutChanges:t=Hs,attributes:n,disabled:r,data:o,getNewIndex:s=Ys,id:a,strategy:i,resizeObserverConfig:c,transition:d=Us}=e;const{items:g,containerId:h,activeIndex:v,disabled:m,disableTransforms:p,sortedRects:x,overIndex:y,useDragOverlay:M,strategy:R}=f.useContext(Dr),j=Xs(r,m),I=g.indexOf(a),$=f.useMemo(()=>({sortable:{containerId:h,index:I,items:g},...o}),[h,o,I,g]),k=f.useMemo(()=>g.slice(g.indexOf(a)),[g,a]),{rect:L,node:A,isOver:V,setNodeRef:W}=zs({id:a,data:$,disabled:j.droppable,resizeObserverConfig:{updateMeasurementsFor:k,...c}}),{active:z,activatorEvent:q,activeNodeRect:K,attributes:T,setNodeRef:w,listeners:C,isDragging:E,over:D,setActivatorNodeRef:O,transform:N}=Is({id:a,data:$,attributes:{...qs,...n},disabled:j.draggable}),b=fo(W,w),_=!!z,P=_&&!p&&it(v)&&it(y),F=!M&&E,G=F&&P?N:null,Y=P?G??(i??R)({rects:x,activeNodeRect:K,activeIndex:v,overIndex:y,index:I}):null,X=it(v)&&it(y)?s({id:a,items:g,activeIndex:v,overIndex:y}):I,J=z?.id,B=f.useRef({activeId:J,items:g,newIndex:X,containerId:h}),se=g!==B.current.items,re=t({active:z,containerId:h,isDragging:E,isSorting:_,id:a,index:I,items:g,newIndex:B.current.newIndex,previousItems:B.current.items,previousContainerId:B.current.containerId,transition:d,wasDragging:B.current.activeId!=null}),ge=Ks({disabled:!re,index:I,node:A,rect:L});return f.useEffect(()=>{_&&B.current.newIndex!==X&&(B.current.newIndex=X),h!==B.current.containerId&&(B.current.containerId=h),g!==B.current.items&&(B.current.items=g)},[_,X,h,g]),f.useEffect(()=>{if(J===B.current.activeId)return;if(J!=null&&B.current.activeId==null){B.current.activeId=J;return}const Oe=setTimeout(()=>{B.current.activeId=J},50);return()=>clearTimeout(Oe)},[J]),{active:z,activeIndex:v,attributes:T,data:$,rect:L,index:I,newIndex:X,items:g,isOver:V,isSorting:_,isDragging:E,listeners:C,node:A,overIndex:y,over:D,setNodeRef:b,setActivatorNodeRef:O,setDroppableNodeRef:W,setDraggableNodeRef:w,transform:ge??Y,transition:be()};function be(){if(ge||se&&B.current.newIndex===I)return Gs;if(!(F&&!an(q)||!d)&&(_||re))return Ne.Transition.toString({...d,property:Mr})}}function Xs(e,t){var n,r;return typeof e=="boolean"?{draggable:e,droppable:!1}:{draggable:(n=e?.draggable)!=null?n:t.draggable,droppable:(r=e?.droppable)!=null?r:t.droppable}}H.Down,H.Right,H.Up,H.Left;var ct={exports:{}},Nt={},ut={exports:{}},Pt={};var Ln;function Js(){if(Ln)return Pt;Ln=1;var e=f;function t(h,v){return h===v&&(h!==0||1/h===1/v)||h!==h&&v!==v}var n=typeof Object.is=="function"?Object.is:t,r=e.useState,o=e.useEffect,s=e.useLayoutEffect,a=e.useDebugValue;function i(h,v){var m=v(),p=r({inst:{value:m,getSnapshot:v}}),x=p[0].inst,y=p[1];return s(function(){x.value=m,x.getSnapshot=v,c(x)&&y({inst:x})},[h,m,v]),o(function(){return c(x)&&y({inst:x}),h(function(){c(x)&&y({inst:x})})},[h]),a(m),m}function c(h){var v=h.getSnapshot;h=h.value;try{var m=v();return!n(h,m)}catch{return!0}}function d(h,v){return v()}var g=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?d:i;return Pt.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:g,Pt}var Ft={};var Nn;function Zs(){return Nn||(Nn=1,process.env.NODE_ENV!=="production"&&(function(){function e(m,p){return m===p&&(m!==0||1/m===1/p)||m!==m&&p!==p}function t(m,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 x=p();if(!h){var y=p();s(x,y)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),h=!0)}y=a({inst:{value:x,getSnapshot:p}});var M=y[0].inst,R=y[1];return c(function(){M.value=x,M.getSnapshot=p,n(M)&&R({inst:M})},[m,x,p]),i(function(){return n(M)&&R({inst:M}),m(function(){n(M)&&R({inst:M})})},[m]),d(x),x}function n(m){var p=m.getSnapshot;m=m.value;try{var x=p();return!s(m,x)}catch{return!0}}function r(m,p){return p()}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var o=f,s=typeof Object.is=="function"?Object.is:e,a=o.useState,i=o.useEffect,c=o.useLayoutEffect,d=o.useDebugValue,g=!1,h=!1,v=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?r:t;Ft.useSyncExternalStore=o.useSyncExternalStore!==void 0?o.useSyncExternalStore:v,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()),Ft}var Pn;function Rr(){return Pn||(Pn=1,process.env.NODE_ENV==="production"?ut.exports=Js():ut.exports=Zs()),ut.exports}var Fn;function Qs(){if(Fn)return Nt;Fn=1;var e=f,t=Rr();function n(d,g){return d===g&&(d!==0||1/d===1/g)||d!==d&&g!==g}var r=typeof Object.is=="function"?Object.is:n,o=t.useSyncExternalStore,s=e.useRef,a=e.useEffect,i=e.useMemo,c=e.useDebugValue;return Nt.useSyncExternalStoreWithSelector=function(d,g,h,v,m){var p=s(null);if(p.current===null){var x={hasValue:!1,value:null};p.current=x}else x=p.current;p=i(function(){function M(k){if(!R){if(R=!0,j=k,k=v(k),m!==void 0&&x.hasValue){var L=x.value;if(m(L,k))return I=L}return I=k}if(L=I,r(j,k))return L;var A=v(k);return m!==void 0&&m(L,A)?(j=k,L):(j=k,I=A)}var R=!1,j,I,$=h===void 0?null:h;return[function(){return M(g())},$===null?void 0:function(){return M($())}]},[g,h,v,m]);var y=o(d,p[0],p[1]);return a(function(){x.hasValue=!0,x.value=y},[y]),c(y),y},Nt}var Wt={};var Wn;function ei(){return Wn||(Wn=1,process.env.NODE_ENV!=="production"&&(function(){function e(d,g){return d===g&&(d!==0||1/d===1/g)||d!==d&&g!==g}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var t=f,n=Rr(),r=typeof Object.is=="function"?Object.is:e,o=n.useSyncExternalStore,s=t.useRef,a=t.useEffect,i=t.useMemo,c=t.useDebugValue;Wt.useSyncExternalStoreWithSelector=function(d,g,h,v,m){var p=s(null);if(p.current===null){var x={hasValue:!1,value:null};p.current=x}else x=p.current;p=i(function(){function M(k){if(!R){if(R=!0,j=k,k=v(k),m!==void 0&&x.hasValue){var L=x.value;if(m(L,k))return I=L}return I=k}if(L=I,r(j,k))return L;var A=v(k);return m!==void 0&&m(L,A)?(j=k,L):(j=k,I=A)}var R=!1,j,I,$=h===void 0?null:h;return[function(){return M(g())},$===null?void 0:function(){return M($())}]},[g,h,v,m]);var y=o(d,p[0],p[1]);return a(function(){x.hasValue=!0,x.value=y},[y]),c(y),y},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()),Wt}var Bn;function ti(){return Bn||(Bn=1,process.env.NODE_ENV==="production"?ct.exports=Qs():ct.exports=ei()),ct.exports}var ni=ti();const Jt=new WeakMap,ri=new WeakMap,wt={current:[]};let Bt=!1;const dt=new Set,Vn=new Map;function Tr(e){for(const t of e){if(wt.current.includes(t))continue;wt.current.push(t),t.recompute();const n=ri.get(t);if(n)for(const r of n){const o=Jt.get(r);o?.length&&Tr(o)}}}function oi(e){const t={prevVal:e.prevState,currentVal:e.state};for(const n of e.listeners)n(t)}function si(e){const t={prevVal:e.prevState,currentVal:e.state};for(const n of e.listeners)n(t)}function ii(e){if(dt.add(e),!Bt)try{for(Bt=!0;dt.size>0;){const t=Array.from(dt);dt.clear();for(const n of t){const r=Vn.get(n)??n.prevState;n.prevState=r,oi(n)}for(const n of t){const r=Jt.get(n);r&&(wt.current.push(n),Tr(r))}for(const n of t){const r=Jt.get(n);if(r)for(const o of r)si(o)}}}finally{Bt=!1,wt.current=[],Vn.clear()}}function ai(e){return typeof e=="function"}class li{constructor(t,n){this.listeners=new Set,this.subscribe=r=>{var o,s;this.listeners.add(r);const a=(s=(o=this.options)==null?void 0:o.onSubscribe)==null?void 0:s.call(o,r,this);return()=>{this.listeners.delete(r),a?.()}},this.prevState=t,this.state=t,this.options=n}setState(t){var n,r,o;this.prevState=this.state,(n=this.options)!=null&&n.updateFn?this.state=this.options.updateFn(this.prevState)(t):ai(t)?this.state=t(this.prevState):this.state=t,(o=(r=this.options)==null?void 0:r.onUpdate)==null||o.call(r),ii(this)}}function Be(e,t=r=>r,n={}){const r=n.equal??ci;return ni.useSyncExternalStoreWithSelector(e.subscribe,()=>e.state,()=>e.state,t,r)}function ci(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))}function Ae(e,t,n){let r=n.initialDeps??[],o,s=!0;function a(){var i,c,d;let g;n.key&&((i=n.debug)!=null&&i.call(n))&&(g=Date.now());const h=e();if(!(h.length!==r.length||h.some((p,x)=>r[x]!==p)))return o;r=h;let m;if(n.key&&((c=n.debug)!=null&&c.call(n))&&(m=Date.now()),o=t(...h),n.key&&((d=n.debug)!=null&&d.call(n))){const p=Math.round((Date.now()-g)*100)/100,x=Math.round((Date.now()-m)*100)/100,y=x/16,M=(R,j)=>{for(R=String(R);R.length<j;)R=" "+R;return R};console.info(`%c⏱ ${M(x,5)} /${M(p,5)} ms`,`
|
|
11
11
|
font-size: .6rem;
|
|
12
12
|
font-weight: bold;
|
|
13
|
-
color: hsl(${Math.max(0,Math.min(120-120*y,120))}deg 100% 31%);`,n?.key)}return n?.onChange&&!(s&&n.skipInitialOnChange)&&n.onChange(o),s=!1,o}return i.updateDeps=a=>{r=a},i}function Hn(e,t){if(e===void 0)throw new Error("Unexpected undefined");return e}const ui=(e,t)=>Math.abs(e-t)<1.01,di=(e,t,n)=>{let r;return function(...o){e.clearTimeout(r),r=e.setTimeout(()=>t.apply(this,o),n)}},Un=e=>{const{offsetWidth:t,offsetHeight:n}=e;return{width:t,height:n}},fi=e=>e,hi=e=>{const t=Math.max(e.startIndex-e.overscan,0),n=Math.min(e.endIndex+e.overscan,e.count-1),r=[];for(let o=t;o<=n;o++)r.push(o);return r},gi=(e,t)=>{const n=e.scrollElement;if(!n)return;const r=e.targetWindow;if(!r)return;const o=i=>{const{width:a,height:c}=i;t({width:Math.round(a),height:Math.round(c)})};if(o(Un(n)),!r.ResizeObserver)return()=>{};const s=new r.ResizeObserver(i=>{const a=()=>{const c=i[0];if(c?.borderBoxSize){const d=c.borderBoxSize[0];if(d){o({width:d.inlineSize,height:d.blockSize});return}}o(Un(n))};e.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(a):a()});return s.observe(n,{box:"border-box"}),()=>{s.unobserve(n)}},Gn={passive:!0},qn=typeof window>"u"?!0:"onscrollend"in window,pi=(e,t)=>{const n=e.scrollElement;if(!n)return;const r=e.targetWindow;if(!r)return;let o=0;const s=e.options.useScrollendEvent&&qn?()=>{}:di(r,()=>{t(o,!1)},e.options.isScrollingResetDelay),i=g=>()=>{const{horizontal:h,isRtl:v}=e.options;o=h?n.scrollLeft*(v&&-1||1):n.scrollTop,s(),t(o,g)},a=i(!0),c=i(!1);n.addEventListener("scroll",a,Gn);const d=e.options.useScrollendEvent&&qn;return d&&n.addEventListener("scrollend",c,Gn),()=>{n.removeEventListener("scroll",a),d&&n.removeEventListener("scrollend",c)}},mi=(e,t,n)=>{if(t?.borderBoxSize){const r=t.borderBoxSize[0];if(r)return Math.round(r[n.options.horizontal?"inlineSize":"blockSize"])}return e[n.options.horizontal?"offsetWidth":"offsetHeight"]},vi=(e,{adjustments:t=0,behavior:n},r)=>{var o,s;const i=e+t;(s=(o=r.scrollElement)==null?void 0:o.scrollTo)==null||s.call(o,{[r.options.horizontal?"left":"top"]:i,behavior:n})};class xi{constructor(t){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.currentScrollToIndex=null,this.measurementsCache=[],this.itemSizeCache=new Map,this.laneAssignments=new Map,this.pendingMeasuredCacheIndexes=[],this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this.elementsCache=new Map,this.observer=(()=>{let n=null;const r=()=>n||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:n=new this.targetWindow.ResizeObserver(o=>{o.forEach(s=>{const i=()=>{this._measureElement(s.target,s)};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(i):i()})}));return{disconnect:()=>{var o;(o=r())==null||o.disconnect(),n=null},observe:o=>{var s;return(s=r())==null?void 0:s.observe(o,{box:"border-box"})},unobserve:o=>{var s;return(s=r())==null?void 0:s.unobserve(o)}}})(),this.range=null,this.setOptions=n=>{Object.entries(n).forEach(([r,o])=>{typeof o>"u"&&delete n[r]}),this.options={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:fi,rangeExtractor:hi,onChange:()=>{},measureElement:mi,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,...n}},this.notify=n=>{var r,o;(o=(r=this.options).onChange)==null||o.call(r,this,n)},this.maybeNotify=Ae(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),n=>{this.notify(n)},{key:process.env.NODE_ENV!=="production"&&"maybeNotify",debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(n=>n()),this.unsubs=[],this.observer.disconnect(),this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var n;const r=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==r){if(this.cleanup(),!r){this.maybeNotify();return}this.scrollElement=r,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((n=this.scrollElement)==null?void 0:n.window)??null,this.elementsCache.forEach(o=>{this.observer.observe(o)}),this.unsubs.push(this.options.observeElementRect(this,o=>{this.scrollRect=o,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(o,s)=>{this.scrollAdjustments=0,this.scrollDirection=s?this.getScrollOffset()<o?"forward":"backward":null,this.scrollOffset=o,this.isScrolling=s,this.maybeNotify()})),this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})}},this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset=="function"?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getFurthestMeasurement=(n,r)=>{const o=new Map,s=new Map;for(let i=r-1;i>=0;i--){const a=n[i];if(o.has(a.lane))continue;const c=s.get(a.lane);if(c==null||a.end>c.end?s.set(a.lane,a):a.end<c.end&&o.set(a.lane,!0),o.size===this.options.lanes)break}return s.size===this.options.lanes?Array.from(s.values()).sort((i,a)=>i.end===a.end?i.index-a.index:i.end-a.end)[0]:void 0},this.getMeasurementOptions=Ae(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes],(n,r,o,s,i,a)=>(this.prevLanes!==void 0&&this.prevLanes!==a&&(this.lanesChangedFlag=!0),this.prevLanes=a,this.pendingMeasuredCacheIndexes=[],{count:n,paddingStart:r,scrollMargin:o,getItemKey:s,enabled:i,lanes:a}),{key:!1}),this.getMeasurements=Ae(()=>[this.getMeasurementOptions(),this.itemSizeCache],({count:n,paddingStart:r,scrollMargin:o,getItemKey:s,enabled:i,lanes:a},c)=>{if(!i)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>n)for(const v of this.laneAssignments.keys())v>=n&&this.laneAssignments.delete(v);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMeasuredCacheIndexes=[]),this.measurementsCache.length===0&&!this.lanesSettling&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(v=>{this.itemSizeCache.set(v.key,v.size)}));const d=this.lanesSettling?0:this.pendingMeasuredCacheIndexes.length>0?Math.min(...this.pendingMeasuredCacheIndexes):0;this.pendingMeasuredCacheIndexes=[],this.lanesSettling&&this.measurementsCache.length===n&&(this.lanesSettling=!1);const g=this.measurementsCache.slice(0,d),h=new Array(a).fill(void 0);for(let v=0;v<d;v++){const m=g[v];m&&(h[m.lane]=v)}for(let v=d;v<n;v++){const m=s(v),p=this.laneAssignments.get(v);let x,y;if(p!==void 0&&this.options.lanes>1){x=p;const k=h[x],$=k!==void 0?g[k]:void 0;y=$?$.end+this.options.gap:r+o}else{const k=this.options.lanes===1?g[v-1]:this.getFurthestMeasurement(g,v);y=k?k.end+this.options.gap:r+o,x=k?k.lane:v%this.options.lanes,this.options.lanes>1&&this.laneAssignments.set(v,x)}const T=c.get(m),R=typeof T=="number"?T:this.options.estimateSize(v),j=y+R;g[v]={index:v,start:y,size:R,end:j,key:m,lane:x},h[x]=v}return this.measurementsCache=g,g},{key:process.env.NODE_ENV!=="production"&&"getMeasurements",debug:()=>this.options.debug}),this.calculateRange=Ae(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(n,r,o,s)=>this.range=n.length>0&&r>0?bi({measurements:n,outerSize:r,scrollOffset:o,lanes:s}):null,{key:process.env.NODE_ENV!=="production"&&"calculateRange",debug:()=>this.options.debug}),this.getVirtualIndexes=Ae(()=>{let n=null,r=null;const o=this.calculateRange();return o&&(n=o.startIndex,r=o.endIndex),this.maybeNotify.updateDeps([this.isScrolling,n,r]),[this.options.rangeExtractor,this.options.overscan,this.options.count,n,r]},(n,r,o,s,i)=>s===null||i===null?[]:n({startIndex:s,endIndex:i,overscan:r,count:o}),{key:process.env.NODE_ENV!=="production"&&"getVirtualIndexes",debug:()=>this.options.debug}),this.indexFromElement=n=>{const r=this.options.indexAttribute,o=n.getAttribute(r);return o?parseInt(o,10):(console.warn(`Missing attribute name '${r}={index}' on measured element.`),-1)},this._measureElement=(n,r)=>{const o=this.indexFromElement(n),s=this.measurementsCache[o];if(!s)return;const i=s.key,a=this.elementsCache.get(i);a!==n&&(a&&this.observer.unobserve(a),this.observer.observe(n),this.elementsCache.set(i,n)),n.isConnected&&this.resizeItem(o,this.options.measureElement(n,r,this))},this.resizeItem=(n,r)=>{const o=this.measurementsCache[n];if(!o)return;const s=this.itemSizeCache.get(o.key)??o.size,i=r-s;i!==0&&((this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(o,i,this):o.start<this.getScrollOffset()+this.scrollAdjustments)&&(process.env.NODE_ENV!=="production"&&this.options.debug&&console.info("correction",i),this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=i,behavior:void 0})),this.pendingMeasuredCacheIndexes.push(o.index),this.itemSizeCache=new Map(this.itemSizeCache.set(o.key,r)),this.notify(!1))},this.measureElement=n=>{if(!n){this.elementsCache.forEach((r,o)=>{r.isConnected||(this.observer.unobserve(r),this.elementsCache.delete(o))});return}this._measureElement(n,void 0)},this.getVirtualItems=Ae(()=>[this.getVirtualIndexes(),this.getMeasurements()],(n,r)=>{const o=[];for(let s=0,i=n.length;s<i;s++){const a=n[s],c=r[a];o.push(c)}return o},{key:process.env.NODE_ENV!=="production"&&"getVirtualItems",debug:()=>this.options.debug}),this.getVirtualItemForOffset=n=>{const r=this.getMeasurements();if(r.length!==0)return Hn(r[Or(0,r.length-1,o=>Hn(r[o]).start,n)])},this.getMaxScrollOffset=()=>{if(!this.scrollElement)return 0;if("scrollHeight"in this.scrollElement)return this.options.horizontal?this.scrollElement.scrollWidth-this.scrollElement.clientWidth:this.scrollElement.scrollHeight-this.scrollElement.clientHeight;{const n=this.scrollElement.document.documentElement;return this.options.horizontal?n.scrollWidth-this.scrollElement.innerWidth:n.scrollHeight-this.scrollElement.innerHeight}},this.getOffsetForAlignment=(n,r,o=0)=>{if(!this.scrollElement)return 0;const s=this.getSize(),i=this.getScrollOffset();r==="auto"&&(r=n>=i+s?"end":"start"),r==="center"?n+=(o-s)/2:r==="end"&&(n-=s);const a=this.getMaxScrollOffset();return Math.max(Math.min(a,n),0)},this.getOffsetForIndex=(n,r="auto")=>{n=Math.max(0,Math.min(n,this.options.count-1));const o=this.measurementsCache[n];if(!o)return;const s=this.getSize(),i=this.getScrollOffset();if(r==="auto")if(o.end>=i+s-this.options.scrollPaddingEnd)r="end";else if(o.start<=i+this.options.scrollPaddingStart)r="start";else return[i,r];if(r==="end"&&n===this.options.count-1)return[this.getMaxScrollOffset(),r];const a=r==="end"?o.end+this.options.scrollPaddingEnd:o.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(a,r,o.size),r]},this.isDynamicMode=()=>this.elementsCache.size>0,this.scrollToOffset=(n,{align:r="start",behavior:o}={})=>{o==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),this._scrollToOffset(this.getOffsetForAlignment(n,r),{adjustments:void 0,behavior:o})},this.scrollToIndex=(n,{align:r="auto",behavior:o}={})=>{o==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),n=Math.max(0,Math.min(n,this.options.count-1)),this.currentScrollToIndex=n;let s=0;const i=10,a=d=>{if(!this.targetWindow)return;const g=this.getOffsetForIndex(n,d);if(!g){console.warn("Failed to get offset for index:",n);return}const[h,v]=g;this._scrollToOffset(h,{adjustments:void 0,behavior:o}),this.targetWindow.requestAnimationFrame(()=>{const m=()=>{if(this.currentScrollToIndex!==n)return;const p=this.getScrollOffset(),x=this.getOffsetForIndex(n,v);if(!x){console.warn("Failed to get offset for index:",n);return}ui(x[0],p)||c(v)};this.isDynamicMode()?this.targetWindow.requestAnimationFrame(m):m()})},c=d=>{this.targetWindow&&this.currentScrollToIndex===n&&(s++,s<i?(process.env.NODE_ENV!=="production"&&this.options.debug&&console.info("Schedule retry",s,i),this.targetWindow.requestAnimationFrame(()=>a(d))):console.warn(`Failed to scroll to index ${n} after ${i} attempts.`))};a(r)},this.scrollBy=(n,{behavior:r}={})=>{r==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),this._scrollToOffset(this.getScrollOffset()+n,{adjustments:void 0,behavior:r})},this.getTotalSize=()=>{var n;const r=this.getMeasurements();let o;if(r.length===0)o=this.options.paddingStart;else if(this.options.lanes===1)o=((n=r[r.length-1])==null?void 0:n.end)??0;else{const s=Array(this.options.lanes).fill(null);let i=r.length-1;for(;i>=0&&s.some(a=>a===null);){const a=r[i];s[a.lane]===null&&(s[a.lane]=a.end),i--}o=Math.max(...s.filter(a=>a!==null))}return Math.max(o-this.options.scrollMargin+this.options.paddingEnd,0)},this._scrollToOffset=(n,{adjustments:r,behavior:o})=>{this.options.scrollToFn(n,{behavior:o,adjustments:r},this)},this.measure=()=>{this.itemSizeCache=new Map,this.laneAssignments=new Map,this.notify(!1)},this.setOptions(t)}}const Or=(e,t,n,r)=>{for(;e<=t;){const o=(e+t)/2|0,s=n(o);if(s<r)e=o+1;else if(s>r)t=o-1;else return o}return e>0?e-1:0};function bi({measurements:e,outerSize:t,scrollOffset:n,lanes:r}){const o=e.length-1,s=c=>e[c].start;if(e.length<=r)return{startIndex:0,endIndex:o};let i=Or(0,o,s,n),a=i;if(r===1)for(;a<o&&e[a].end<n+t;)a++;else if(r>1){const c=Array(r).fill(0);for(;a<o&&c.some(g=>g<n+t);){const g=e[a];c[g.lane]=g.end,a++}const d=Array(r).fill(n+t);for(;i>=0&&d.some(g=>g>=n);){const g=e[i];d[g.lane]=g.start,i--}i=Math.max(0,i-i%r),a=Math.min(o,a+(r-1-a%r))}return{startIndex:i,endIndex:a}}const Kn=typeof document<"u"?vt.useLayoutEffect:vt.useEffect;function yi({useFlushSync:e=!0,...t}){const n=vt.useReducer(()=>({}),{})[1],r={...t,onChange:(s,i)=>{var a;e&&i?ze.flushSync(n):n(),(a=t.onChange)==null||a.call(t,s,i)}},[o]=vt.useState(()=>new xi(r));return o.setOptions(r),Kn(()=>o._didMount(),[]),Kn(()=>o._willUpdate()),o}function Si(e){return yi({observeElementRect:gi,observeElementOffset:pi,scrollToFn:vi,...e})}const Te="__actions__",he="__visibility__",wi="__serial_number__",ne=new li({tableId:"",sortColumn:null,sortDirection:null,visibility:{},columnOrder:[],columnWidths:{},data:[],sortableColumns:[],enableColumnVisibility:!0}),Rt=e=>`datatable:${e}:column-widths`;function _r(e,t,n=!0){const r=e[0]??{},o=180,i=(t&&t.length?t:Object.keys(r).map(p=>({id:p,label:p}))).filter(p=>p.id===Te||Object.prototype.hasOwnProperty.call(r,p.id)),{tableId:a}=ne.state,c=JSON.parse(localStorage.getItem(kr(a))||"[]");let d=[...c.map(p=>i.find(x=>x.id===p)).filter(Boolean),...i.filter(p=>!c.includes(p.id))];n?d.some(x=>x.id===he)||(d=[...d,{type:"visibility",id:he,label:"",minWidth:20}]):d=d.filter(p=>p.id!==he);const g=JSON.parse(localStorage.getItem(Zt(a))||"{}"),h={};if(n){for(const p of d)p.id===he||p.id===Te?h[p.id]=!0:h[p.id]=g[p.id]??!0;localStorage.setItem(Zt(a),JSON.stringify(h))}const v=JSON.parse(localStorage.getItem(Rt(a))||"{}"),m={...v};d.forEach(p=>{p.id!==he&&p.id!==Te&&!(p.id in v)&&(m[p.id]=typeof p.minWidth=="number"?p.minWidth:o)}),ne.setState(p=>({...p,data:e,columnOrder:d,visibility:h,columnWidths:m,enableColumnVisibility:n,sortableColumns:d.filter(x=>x.id!==he).map(x=>({id:x.id,label:x.label,sortable:x.id!==Te,minWidth:x.minWidth}))}))}function Ir(e){ne.setState(t=>({...t,tableId:e,sortColumn:null,sortDirection:"asc"}))}function Ci(e,t){ne.setState(n=>{const r=typeof n.columnOrder.find(s=>s.id===e)?.minWidth=="number"?n.columnOrder.find(s=>s.id===e)?.minWidth:50,o={...n.columnWidths,[e]:Math.max(r,t)};return localStorage.setItem(Rt(n.tableId),JSON.stringify(o)),{...n,columnWidths:o}})}const kr=e=>`table_column_order_v1:${e}`,Zt=e=>`table_column_visibility_v1:${e}`,Di=e=>{const{tableId:t}=ne.state;localStorage.setItem(kr(t),JSON.stringify(e.map(n=>n.id))),ne.setState(n=>({...n,columnOrder:e})),ne.setState(n=>({...n,columnOrder:e}))};function Ei(e){ne.setState(t=>{if(t.sortColumn===e){if(t.sortDirection==="asc")return{...t,sortDirection:"desc"};if(t.sortDirection==="desc")return{...t,sortColumn:null,sortDirection:null}}return{...t,sortColumn:e,sortDirection:"asc"}})}const Mi=e=>{ne.setState(t=>{const n={...t.visibility,[e]:!t.visibility[e]};return t.tableId&&localStorage.setItem(Zt(t.tableId),JSON.stringify(n)),{...t,visibility:n}})};function ji(e,t){ne.setState(n=>{const r=n.columnOrder.find(i=>i.id===e),o=typeof r?.minWidth=="number"?r.minWidth:120,s={...n.columnWidths,[e]:Math.max(o,t)};return localStorage.setItem(Rt(n.tableId),JSON.stringify(s)),{...n,columnWidths:s}})}const Ri=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Ti=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,r)=>r?r.toUpperCase():n.toLowerCase()),Xn=e=>{const t=Ti(e);return t.charAt(0).toUpperCase()+t.slice(1)},$r=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim(),Oi=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0};var _i={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 Ii=f.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:o="",children:s,iconNode:i,...a},c)=>f.createElement("svg",{ref:c,..._i,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:$r("lucide",o),...!s&&!Oi(a)&&{"aria-hidden":"true"},...a},[...i.map(([d,g])=>f.createElement(d,g)),...Array.isArray(s)?s:[s]]));const ae=(e,t)=>{const n=f.forwardRef(({className:r,...o},s)=>f.createElement(Ii,{ref:s,iconNode:t,className:$r(`lucide-${Ri(Xn(e))}`,`lucide-${e}`,r),...o}));return n.displayName=Xn(e),n};const ki=[["path",{d:"M8 3 4 7l4 4",key:"9rb6wj"}],["path",{d:"M4 7h16",key:"6tx8e3"}],["path",{d:"m16 21 4-4-4-4",key:"siv7j2"}],["path",{d:"M20 17H4",key:"h6l3hr"}]],$i=ae("arrow-left-right",ki);const Ai=[["path",{d:"m19 21-7-4-7 4V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v16z",key:"1fy3hk"}]],zi=ae("bookmark",Ai);const Li=[["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"}]],Ar=ae("calendar",Li);const Ni=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],Pi=ae("chevron-left",Ni);const Fi=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Wi=ae("chevron-right",Fi);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"}]],Vi=ae("delete",Bi);const Yi=[["path",{d:"M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z",key:"sc7q7i"}]],Hi=ae("funnel",Yi);const Ui=[["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"}]],zr=ae("grip-vertical",Ui);const Gi=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]],qi=ae("pen",Gi);const Ki=[["path",{d:"M21 12a9 9 0 0 0-9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"14sxne"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M3 12a9 9 0 0 0 9 9 9.75 9.75 0 0 0 6.74-2.74L21 16",key:"1hlbsb"}],["path",{d:"M16 16h5v5",key:"ccwih5"}]],Xi=ae("refresh-ccw",Ki);const Ji=[["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"}]],Zi=ae("settings",Ji);const Qi=[["rect",{width:"20",height:"6",x:"2",y:"4",rx:"2",key:"qdearl"}],["rect",{width:"20",height:"6",x:"2",y:"14",rx:"2",key:"1xrn6j"}]],ea=ae("stretch-horizontal",Qi);const ta=[["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"}]],Lr=ae("triangle-alert",ta);const na=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Nr=ae("x",na);function S(e){return f.forwardRef((t,n)=>{const{children:r,...o}=t;return l.jsx(e,{ref:n,...o,children:r})})}const ra=S(u.Menu.Trigger),oa=S(u.Menu.Positioner),sa=S(u.Menu.Content),ia=S(u.Menu.Item),aa=S(u.Checkbox.Label),la=S(u.Checkbox.HiddenInput),ca=S(u.Checkbox.Control);function ua({visibility:e}){const{sortableColumns:t}=Be(ne);return l.jsxs(u.Menu.Root,{closeOnSelect:!1,children:[l.jsx(ra,{asChild:!0,children:l.jsx(u.IconButton,{"aria-label":"Toggle columns",variant:"ghost",ml:"1",size:"xs",children:l.jsx(ea,{size:18})})}),l.jsx(u.Portal,{children:l.jsx(oa,{children:l.jsx(sa,{minW:"220px",children:t.map(n=>{const r=!!e[n.id];return l.jsx(ia,{value:n.id,closeOnSelect:!1,children:l.jsxs(u.Checkbox.Root,{checked:r,onCheckedChange:()=>Mi(n.id),children:[l.jsx(la,{}),l.jsx(ca,{}),l.jsx(aa,{children:n.label})]})},n.id)})})})})]})}function da({id:e,children:t,onClick:n,cursor:r,borderRight:o,backgroundColor:s,minW:i}){const{columnWidths:a}=Be(ne),h=`${a[e]??100}px`,v=f.useRef(0),m=f.useRef(0),{setNodeRef:p,attributes:x,listeners:y,transform:T,transition:R}=jr({id:e}),j=I=>{I.stopPropagation(),v.current=I.clientX;const L=I.currentTarget.closest("th");m.current=L?.getBoundingClientRect().width||a[e]||180;const A=W=>{let z=m.current+(W.clientX-v.current);ji(e,z)},B=()=>{document.removeEventListener("mousemove",A),document.removeEventListener("mouseup",B)};document.addEventListener("mousemove",A),document.addEventListener("mouseup",B)},[k,$]=f.useState(!1);return l.jsx(u.Table.ColumnHeader,{ref:p,onClick:n,backgroundColor:s,width:h,minWidth:i||"20px",style:{transform:Ne.Transform.toString(T),transition:R,cursor:r,borderRight:o,boxSizing:"border-box"},bg:"gray.100",...x,children:l.jsxs(u.HStack,{position:"relative",width:"100%",children:[l.jsx("span",{...y,children:l.jsx(zr,{size:12,style:{cursor:"grab"}})}),t,l.jsx(u.Box,{position:"absolute",right:0,top:0,h:"100%",w:"10px",cursor:"col-resize",onMouseDown:j,onMouseEnter:()=>$(!0),onMouseLeave:()=>$(!1),display:"flex",alignItems:"center",justifyContent:"center",zIndex:2,children:k&&l.jsx($i,{size:14,style:{pointerEvents:"none",opacity:.8}})})]})})}function fa(){const{columnOrder:e,visibility:t,enableColumnVisibility:n,sortColumn:r,sortDirection:o}=Be(ne),s=e.filter(i=>!n&&i.id===he?!1:i.id===he||i.id===Te?!0:t[i.id]!==!1).sort((i,a)=>i.id===he?1:a.id===he?-1:0);return l.jsx(u.Table.Header,{position:"sticky",top:0,zIndex:1,css:{contain:"layout style paint",backgroundColor:"white"},children:l.jsx(u.Table.Row,{height:"28px",children:s.map(i=>{if(i.id===he)return l.jsx(u.Table.ColumnHeader,{bg:"gray.100",w:100,children:l.jsx(ua,{visibility:t})},i.id);const a=i.type!=="actions"&&i.type!=="visibility",c=r===i.id;return l.jsx(da,{id:i.id,minW:i.minWidth,onClick:a?()=>Ei(i.id):void 0,cursor:a?"pointer":"default",borderRight:"2px solid #dcdcdc",children:l.jsxs("span",{style:{display:"flex",alignItems:"center",gap:6,userSelect:"none"},children:[i.label,a&&(c?o==="asc"?" ▲":" ▼":l.jsx("span",{style:{opacity:.4},children:" ⇅"}))]})},i.id)})})})}const ha=[10,20,50,100],ga=S(u.Select.Positioner),pa=S(u.Select.Content),ma=S(u.Select.Item),va=S(u.Pagination.PrevTrigger),xa=S(u.Pagination.NextTrigger),ba=S(u.Select.HiddenSelect),ya=S(u.Select.Control),Sa=S(u.Select.Trigger),wa=S(u.Select.ValueText),Ca=S(u.Select.IndicatorGroup),Da=S(u.Select.Indicator);function Ea({totalCount:e,pageSize:t,currentPage:n,onPageChange:r,onPageSizeChange:o,siblingCount:s=2,pageSizeOptions:i=ha}){const a=u.createListCollection({items:i.map(c=>({label:String(c),value:String(c)}))});return l.jsx(u.Box,{width:"100%",children:l.jsxs(u.HStack,{justify:"space-between",mx:"auto",flexWrap:"wrap",children:[l.jsxs(u.HStack,{children:[l.jsx(u.Text,{fontSize:"sm",color:"gray.600",_dark:{color:"gray.400"},children:"Rows per page:"}),l.jsxs(u.Select.Root,{collection:a,size:"sm",width:"60px",onValueChange:c=>o?.(Number(c.items[0].value)),value:[String(t)],children:[l.jsx(ba,{}),l.jsxs(ya,{children:[l.jsx(Sa,{children:l.jsx(wa,{placeholder:""})}),l.jsx(Ca,{children:l.jsx(Da,{})})]}),l.jsx(u.Portal,{children:l.jsx(ga,{children:l.jsx(pa,{children:a.items.map(c=>l.jsxs(ma,{item:c.value,children:[c.label,l.jsx(u.Select.ItemIndicator,{})]},c.value))})})})]}),l.jsxs(u.Text,{fontSize:"sm",color:"gray.600",_dark:{color:"gray.400"},children:["of ",e]})]}),l.jsx(u.Pagination.Root,{count:e,pageSize:t,page:n,siblingCount:s,onPageChange:c=>r&&r(c.page),children:l.jsxs(u.ButtonGroup,{size:"sm",variant:"ghost",children:[l.jsx(va,{asChild:!0,children:l.jsx(u.IconButton,{"aria-label":"Previous page",children:l.jsx(Pi,{size:18})})}),l.jsx(u.Pagination.Items,{render:c=>l.jsx(u.IconButton,{variant:c.type==="page"&&c.value===n?"outline":"ghost","aria-current":c.type==="page"&&c.value===n?"page":void 0,children:c.type==="page"?c.value:"…"},c.value??c.type)}),l.jsx(xa,{asChild:!0,children:l.jsx(u.IconButton,{"aria-label":"Next page",children:l.jsx(Wi,{size:18})})})]})})]})})}function Ma({row:e,columns:t,visibility:n,onRowSelect:r,onRowSelectEvent:o,index:s,height:i}){const{columnWidths:a}=Be(ne);return l.jsx(u.Table.Row,{"data-index":s,onClick:c=>o==="left"&&r?.(e,c),cursor:r?"pointer":"default",h:`${i}px`,_hover:{bg:"gray.50"},onContextMenu:o==="right"?c=>{c.preventDefault(),r?.(e,c)}:void 0,children:t.map(c=>c.id!==Te&&n[c.id]===!1?null:l.jsx(u.Table.Cell,{py:0,height:`${i}px`,width:`${a[c.id]??30}px`,minWidth:c.minWidth||"40px",maxWidth:`${a[c.id]??180}px`,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",children:"render"in c&&c.render?c.render(e):l.jsx("div",{children:String(e[c.id]??"")})},c.id))})}const ja=f.memo(Ma);function Ra({data:e,columns:t,rowVirtualizer:n,onRowSelect:r,onRowSelectEvent:o="left",rowHeight:s}){const{visibility:i}=Be(ne),a=n.getVirtualItems(),c=a.length>0?a[0].start:0,d=a.length>0?n.getTotalSize()-a[a.length-1].end:0;return l.jsxs(u.Table.Body,{children:[c>0&&l.jsx(u.Table.Row,{h:`${c}px`,children:l.jsx(u.Table.Cell,{colSpan:t.length,p:0,border:"none",h:`${c}px`})}),a.map(g=>{const h=e[g.index];return h?l.jsx(ja,{index:g.index,row:h,columns:t,visibility:i,onRowSelect:r,onRowSelectEvent:o,height:s},h.id):null}),d>0&&l.jsx(u.Table.Row,{h:`${d}px`,children:l.jsx(u.Table.Cell,{colSpan:t.length,p:0,border:"none",h:`${d}px`})})]})}function Ta({rows:e=6,columns:t}){return l.jsx(u.Table.Body,{children:Array.from({length:e}).map((n,r)=>l.jsx(u.Table.Row,{children:Array.from({length:t}).map((o,s)=>l.jsx(u.Table.Cell,{children:l.jsx(u.Skeleton,{height:"25px"})},s))},r))})}function Oa(e,t,n){if(!t||!n||t.type==="actions"||t.type==="visibility")return e;const r="sortAccessor"in t&&t.sortAccessor?t.sortAccessor:s=>s[t.id],o="sortComparator"in t&&t.sortComparator?t.sortComparator:(s,i,a)=>{const c=r(s),d=r(i);return c==null&&d==null?0:c==null?1:d==null?-1:typeof c=="number"&&typeof d=="number"?a==="asc"?c-d:d-c:c instanceof Date&&d instanceof Date?a==="asc"?c.getTime()-d.getTime():d.getTime()-c.getTime():a==="asc"?String(c).localeCompare(String(d)):String(d).localeCompare(String(c))};return[...e].sort((s,i)=>o(s,i,n))}function _a({tableId:e,data:t=[],headers:n=[],loading:r=!1,loadingChildren:o,skeletonLoading:s=!1,emptyMessage:i="No data",page:a=1,pageSize:c=10,onPageChange:d,onPageSizeChange:g,density:h="sm",totalCount:v=0,pageSizeOptions:m,onRowSelect:p,onRowSelectEvent:x="left",enableColumnVisibility:y=!0,dataType:T="pagination",manualPagination:R=!1}){const j=f.useRef(null);f.useEffect(()=>{Ir(e)},[e]),f.useEffect(()=>{_r(t,n,y)},[t,n,y]);const{sortColumn:k,sortDirection:$,data:I,columnOrder:L}=Be(ne),A=f.useMemo(()=>L.length?L:n,[L,n]),B=f.useMemo(()=>{if(!k||!$)return I;const O=A.find(N=>N.id===k);return Oa(I,O,$)},[I,k,$,A]),W=(Math.max(1,a)-1)*c,z=f.useMemo(()=>T==="infinite"||R||v>B.length||a>1&&B.length>0&&B.length<=c?B:B.slice(W,W+c),[B,W,c,T,a,v,R]),q=h==="sm"?45:h==="md"?56:64,M=Si({count:z.length,getScrollElement:()=>j.current,estimateSize:()=>q,overscan:25}),w=O=>{const{active:N,over:b}=O;if(!b||N.id===b.id)return;const _=A.findIndex(F=>F.id===N.id),P=A.findIndex(F=>F.id===b.id);Di(jt(A,_,P))},C=r&&!s,E=s&&!r,D=!r&&!s&&z.length===0;return l.jsx(Sr,{collisionDetection:ar,onDragEnd:w,children:l.jsx(Er,{items:A.map(O=>O.id),strategy:Fs,children:l.jsxs(u.Box,{flex:"1",minH:0,display:"flex",flexDirection:"column",p:2,children:[l.jsxs(u.Box,{ref:j,flex:"1",minH:0,position:"relative",overflowX:"auto",css:{"&::-webkit-scrollbar":{width:"8px",height:"8px"},willChange:"transform"},children:[C&&l.jsx(u.Box,{position:"absolute",inset:0,display:"flex",alignItems:"center",justifyContent:"center",zIndex:10,bg:"whiteAlpha.600",children:o??l.jsx(u.Spinner,{})}),l.jsxs(u.Table.Root,{variant:"outline",w:"max-content",minW:"100%",size:h,tableLayout:"fixed",css:{borderCollapse:"collapse","& th, & td":{boxSizing:"border-box"}},children:[l.jsx(fa,{}),E?l.jsx(Ta,{rows:c,columns:A.length}):D?l.jsx(u.Table.Body,{children:l.jsx(u.Table.Row,{children:l.jsx(u.Table.Cell,{colSpan:A.length,textAlign:"center",h:"200px",color:"gray.500",children:i})})}):l.jsx(Ra,{data:z,columns:A,rowVirtualizer:M,onRowSelect:p,onRowSelectEvent:x,rowHeight:q})]})]}),T==="pagination"&&l.jsx(u.Box,{mt:.5,children:l.jsx(Ea,{totalCount:v,pageSize:c,currentPage:a,onPageChange:O=>{j.current&&(j.current.scrollTop=0),d?.(O)},onPageSizeChange:O=>{g?.(O),a>1&&d?.(1)},pageSizeOptions:m})}),T==="infinite"&&l.jsxs(u.Box,{mt:2,px:2,fontSize:"sm",color:"gray.500",children:["Showing ",z.length," rows"]})]})})})}const te=[];for(let e=0;e<256;++e)te.push((e+256).toString(16).slice(1));function Ia(e,t=0){return(te[e[t+0]]+te[e[t+1]]+te[e[t+2]]+te[e[t+3]]+"-"+te[e[t+4]]+te[e[t+5]]+"-"+te[e[t+6]]+te[e[t+7]]+"-"+te[e[t+8]]+te[e[t+9]]+"-"+te[e[t+10]]+te[e[t+11]]+te[e[t+12]]+te[e[t+13]]+te[e[t+14]]+te[e[t+15]]).toLowerCase()}let Vt;const ka=new Uint8Array(16);function $a(){if(!Vt){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");Vt=crypto.getRandomValues.bind(crypto)}return Vt(ka)}const Aa=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Jn={randomUUID:Aa};function za(e,t,n){e=e||{};const r=e.random??e.rng?.()??$a();if(r.length<16)throw new Error("Random bytes length must be >= 16");return r[6]=r[6]&15|64,r[8]=r[8]&63|128,Ia(r)}function La(e,t,n){return Jn.randomUUID&&!e?Jn.randomUUID():za(e)}const Na=S(u.Checkbox.Root),Pa=S(u.Checkbox.HiddenInput),Fa=S(u.Checkbox.Control),Wa=S(u.Checkbox.Label),Pr=({value:e,onChange:t,size:n="sm",label:r,helperText:o,isDisabled:s,required:i,errorText:a})=>l.jsxs(Na,{value:e,onChange:t,size:n,children:[l.jsx(Pa,{}),l.jsx(Fa,{disabled:s,required:i,errorText:a,helperText:o}),r&&l.jsx(Wa,{children:r})]}),Ba=S(u.Combobox.Root),Va=S(u.Combobox.Control),Ya=S(u.Combobox.Input),Ha=S(u.Combobox.IndicatorGroup),Ua=S(u.Combobox.ClearTrigger),Ga=S(u.Combobox.Trigger),qa=S(u.Combobox.Positioner),Ka=S(u.Combobox.Content);function Fr({label:e,size:t="sm",width:n="100%",variant:r="outline",items:o=[],itemToString:s,itemToValue:i,renderItem:a,value:c,loading:d,error:g,errorMessage:h,placeholder:v,helpText:m,onInputChange:p,onSelect:x,visible:y=!0,rootProps:T,inputProps:R,controlProps:j,contentProps:k,itemProps:$}){const[I,L]=f.useState(""),A=f.useMemo(()=>Array.isArray(o)?o:[],[o]),{collection:B,set:W}=u.useListCollection({initialItems:A,itemToString:s,itemToValue:i}),z=f.useMemo(()=>{if(!I)return A;const Y=I.toLowerCase();return A.filter(q=>s(q).toLowerCase().includes(Y))},[o,I,s]);return f.useEffect(()=>{W(z)},[z,W]),f.useEffect(()=>{c&&L(s(c))},[c,s]),l.jsxs(Ba,{width:n,size:t,variant:r,collection:B,placeholder:v,onInputValueChange:Y=>{p?.(Y.inputValue),L(Y.inputValue)},value:c?[i(c)]:[],onValueChange:Y=>{const q=Y.value?.[0];if(!q)return;const M=B.items.find(w=>i(w)===q);M&&x?.(M)},positioning:{sameWidth:!1,placement:"bottom-start"},...T,children:[y&&e&&l.jsx(u.Text,{fontSize:"sm",children:e}),l.jsxs(Va,{...j,children:[l.jsx(Ya,{placeholder:v??"Type to search",...R}),l.jsxs(Ha,{children:[l.jsx(Ua,{}),l.jsx(Ga,{})]})]}),l.jsx(qa,{children:l.jsxs(Ka,{minW:"sm",...k,children:[d?l.jsxs(u.HStack,{p:"2",children:[l.jsx(u.Spinner,{size:"xs",borderWidth:"1px"}),l.jsx(u.Span,{children:"Loading..."})]}):g?l.jsx(u.Text,{p:"2",color:"red.500",fontSize:"sm",children:h||"Something went wrong"}):B.items.map(Y=>l.jsxs(u.Combobox.Item,{item:Y,...$,children:[a(Y),l.jsx(u.Combobox.ItemIndicator,{})]},i(Y))),m&&!g&&!d&&l.jsx(u.Text,{p:"2",color:"fg.muted",fontSize:"sm",children:m})]})})]})}const Xa=S(u.Popover.Root),Ja=S(u.Popover.Content),Za=S(u.Popover.Arrow),Qa=S(u.Popover.Trigger),el=S(u.Popover.Positioner),je=e=>e?new Date(e.getFullYear(),e.getMonth(),e.getDate()):null;function Re(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 Zn(e){const t=e.split(/\s+to\s+/i),n=t[0],r=t[1],o=a=>{if(!a)return null;const c=a.trim().split("-");if(c.length!==3)return null;const[d,g,h]=c,v=parseInt(d),m=parseInt(g)-1,p=parseInt(h);if(isNaN(v)||isNaN(m)||isNaN(p)||h.length!==4)return null;const x=new Date(p,m,v);return x.getDate()===v&&x.getMonth()===m?x:null},s=o(n),i=o(r);return{start:s,end:i}}function Wr({startDate:e,endDate:t,onChange:n,width:r="100%",showLabel:o=!0,label:s="Select date range",visible:i=!0}){const[a,c]=f.useState(!1),[d,g]=f.useState(e||new Date),[h,v]=f.useState(null),[m,p]=f.useState(je(e)),[x,y]=f.useState(je(t)),T=(M,w)=>M&&w?`${Re(M)} to ${Re(w)}`:M?`${Re(M)}`:"",[R,j]=f.useState(T(je(e),je(t))),k=e?.getTime(),$=t?.getTime();f.useEffect(()=>{const M=je(e),w=je(t);p(M),y(w),j(T(M,w)),M&&g(new Date(M.getFullYear(),M.getMonth(),1))},[k,$]);const I=new Date(d.getFullYear(),d.getMonth()+1,0).getDate(),L=new Date(d.getFullYear(),d.getMonth(),1).getDay(),A=()=>g(new Date(d.getFullYear(),d.getMonth()-1,1)),B=()=>g(new Date(d.getFullYear(),d.getMonth()+1,1)),W=M=>{const w=new Date(d.getFullYear(),d.getMonth(),M);if(!m||m&&x){p(w),y(null),n(w,null),j(Re(w));return}if(m&&!x){const C=w<m?w:m,E=w<m?m:w;p(C),y(E),n(C,E),j(`${Re(C)} to ${Re(E)}`),c(!1)}},z=M=>{const w=M.target.value;j(w);const{start:C,end:E}=Zn(w);if(C&&E){const D=C<E?C:E,O=C<E?E:C;p(D),y(O),n(D,O),g(D)}else C&&!w.toLowerCase().includes("to")?(p(C),y(null),n(C,null)):w.trim()||(p(null),y(null),n(null,null))},Y=M=>{if(M.key!=="Enter")return;const{start:w,end:C}=Zn(R);if(w&&!C&&!R.toLowerCase().includes("to")){const E=`${Re(w)} to `;j(E),p(w),y(null),n(w,null),requestAnimationFrame(()=>{M.target.setSelectionRange(E.length,E.length)});return}if(w&&C){const E=w<C?w:C,D=w<C?C:w;p(E),y(D),n(E,D),c(!1)}},q=M=>{M&&(M.preventDefault(),M.stopPropagation()),p(null),y(null),j(""),n(null,null)};return l.jsxs(u.Box,{width:r,onKeyDown:Y,children:[o&&!i&&l.jsx(u.Text,{fontSize:"xs",color:"fg.muted",mb:1,fontWeight:"medium",children:s}),l.jsxs(Xa,{open:a,onOpenChange:M=>c(M.open),positioning:{placement:"bottom-start",gutter:4},children:[l.jsxs(u.Group,{attached:!0,w:"full",position:"relative",children:[l.jsx(u.Input,{placeholder:"DD-MM-YYYY to DD-MM-YYYY",value:R,onChange:z,size:"sm",autoComplete:"off"}),R&&l.jsx(u.IconButton,{size:"xs",variant:"ghost","aria-label":"Clear date",type:"button",onClick:q,position:"absolute",right:"32px",top:"50%",transform:"translateY(-50%)",zIndex:2,children:l.jsx(Nr,{size:14})}),l.jsx(Qa,{asChild:!0,children:l.jsx(u.InputAddon,{cursor:"pointer",px:2,_hover:{bg:"gray.100"},transition:"background 0.2s",children:l.jsx(Ar,{size:16})})})]}),l.jsx(el,{children:l.jsxs(Ja,{width:"300px",p:4,boxShadow:"xl",zIndex:1e3,borderRadius:"md",outline:"none",children:[l.jsx(Za,{}),l.jsxs(u.HStack,{justify:"space-between",mb:4,children:[l.jsx(u.IconButton,{size:"xs",variant:"ghost",type:"button",onClick:A,"aria-label":"Previous month",children:"‹"}),l.jsx(u.Text,{fontWeight:"bold",fontSize:"sm",children:d.toLocaleString("default",{month:"long",year:"numeric"})}),l.jsx(u.IconButton,{size:"xs",variant:"ghost",type:"button",onClick:B,"aria-label":"Next month",children:"›"})]}),l.jsxs(u.Grid,{templateColumns:"repeat(7, 1fr)",gap:1,textAlign:"center",children:[["S","M","T","W","T","F","S"].map((M,w)=>l.jsx(u.Text,{fontSize:"xs",fontWeight:"bold",color:"fg.subtle",py:1,children:M},`${M}-${w}`)),Array(L).fill(null).map((M,w)=>l.jsx(u.Box,{},`empty-${w}`)),Array.from({length:I},(M,w)=>{const C=w+1,E=new Date(d.getFullYear(),d.getMonth(),C);let D=m,O=x;const N=je(h);if(N){if(D&&!O)N<D?(O=D,D=N):O=N;else if(D&&O){const H=D.getTime()+(O.getTime()-D.getTime())/2;N.getTime()<=H?D=N:O=N,D>O&&([D,O]=[O,D])}}const b=D&&E.getTime()===D.getTime(),_=O&&E.getTime()===O.getTime(),P=D&&O&&E>D&&E<O;let F="gray",K="ghost";(b||_)&&(K="solid",F="blue");let G="md";return P&&(G="0"),b&&O&&(G=_?"md":"md 0 0 md"),_&&D&&(G=b?"md":"0 md md 0"),l.jsx(u.Button,{size:"xs",variant:K,colorPalette:F,onClick:()=>W(C),onMouseEnter:()=>v(E),onMouseLeave:()=>v(null),minW:"32px",h:"32px",fontSize:"xs",borderRadius:G,_hover:{bg:b||_?void 0:"gray.100"},children:C},C)})]}),l.jsx(u.Text,{fontSize:"10px",color:"fg.muted",mt:3,textAlign:"center",children:"Select Start Date then End Date"})]})})]})]})}const tl=S(u.Popover.Root),nl=S(u.Popover.Content),rl=S(u.Popover.Arrow),ol=S(u.Popover.Trigger),sl=S(u.Popover.Positioner);function Qn(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 il(e){const t=e.split("-");if(t.length!==3)return null;const[n,r,o]=t,s=parseInt(n),i=parseInt(r)-1,a=parseInt(o);if(isNaN(s)||isNaN(i)||isNaN(a)||o.length!==4)return null;const c=new Date(a,i,s);return c.getDate()===s&&c.getMonth()===i?c:null}function Br({value:e,onChange:t,width:n="220px",visible:r=!0,label:o="Select date"}){const[s,i]=f.useState(!1),[a,c]=f.useState(e||new Date),[d,g]=f.useState(Qn(e));f.useEffect(()=>{g(Qn(e))},[e]);const h=new Date(a.getFullYear(),a.getMonth()+1,0).getDate(),v=new Date(a.getFullYear(),a.getMonth(),1).getDay(),m=()=>{c(new Date(a.getFullYear(),a.getMonth()-1,1))},p=()=>{c(new Date(a.getFullYear(),a.getMonth()+1,1))},x=R=>{const j=new Date(a.getFullYear(),a.getMonth(),R);t(j),i(!1)},y=R=>{if(s)switch(R.key){case"ArrowLeft":m();break;case"ArrowRight":p();break;case"Escape":i(!1);break}},T=()=>{g(""),t(null)};return l.jsxs(u.Box,{width:n,onKeyDown:y,children:[!r&&l.jsx(u.Text,{fontSize:"xs",color:"fg.muted",mb:1,fontWeight:"medium",children:o}),l.jsxs(tl,{open:s,onOpenChange:R=>i(R.open),positioning:{placement:"bottom-start",gutter:4},children:[l.jsxs(u.Group,{attached:!0,w:"full",position:"relative",children:[d&&l.jsx(u.IconButton,{size:"xs",variant:"ghost","aria-label":"Clear date",onClick:T,position:"absolute",right:"32px",top:"50%",transform:"translateY(-50%)",zIndex:1,children:l.jsx(Nr,{size:14})}),l.jsx(u.Input,{placeholder:"DD-MM-YYYY",value:d,onChange:R=>{const j=R.target.value;g(j);const k=il(j);k&&(t(k),c(k))},size:"sm",autoComplete:"off"}),l.jsx(ol,{asChild:!0,children:l.jsx(u.InputAddon,{cursor:"pointer",px:2,_hover:{bg:"gray.100"},transition:"background 0.2s",children:l.jsx(Ar,{size:16})})})]}),l.jsx(sl,{children:l.jsxs(nl,{width:"300px",p:4,boxShadow:"xl",zIndex:1e3,borderRadius:"md",outline:"none",children:[l.jsx(rl,{}),l.jsxs(u.HStack,{justify:"space-between",mb:4,children:[l.jsx(u.IconButton,{size:"xs",variant:"ghost",onClick:m,"aria-label":"Previous month",children:"‹"}),l.jsx(u.Text,{fontWeight:"bold",fontSize:"sm",children:a.toLocaleString("default",{month:"long",year:"numeric"})}),l.jsx(u.IconButton,{size:"xs",variant:"ghost",onClick:p,"aria-label":"Next month",children:"›"})]}),l.jsxs(u.Grid,{templateColumns:"repeat(7, 1fr)",gap:1,textAlign:"center",children:[["S","M","T","W","T","F","S"].map((R,j)=>l.jsx(u.Text,{fontSize:"xs",fontWeight:"bold",color:"fg.subtle",py:1,children:R},`${R}-${j}`)),Array(v).fill(null).map((R,j)=>l.jsx(u.Box,{},`empty-${j}`)),Array.from({length:h},(R,j)=>{const k=j+1,$=e&&e.getDate()===k&&e.getMonth()===a.getMonth()&&e.getFullYear()===a.getFullYear();return l.jsx(u.Button,{size:"xs",variant:$?"solid":"ghost",colorPalette:$?"blue":"gray",onClick:()=>x(k),minW:"32px",h:"32px",fontSize:"xs",borderRadius:"md",children:k},k)})]}),l.jsx(u.Text,{fontSize:"10px",color:"fg.muted",mt:3,textAlign:"center",children:"Use Arrow Keys to change months • Esc to close"})]})})]})]})}const al=S(u.Field.Root),ll=S(u.Field.Label),cl=S(u.Field.HelperText),ul=S(u.Field.ErrorText),Qt=({icon:e,value:t,onChange:n,placeholder:r,size:o="xs",variant:s="outline",width:i="100%",label:a,helperText:c,isDisabled:d=!1,required:g=!1,errorText:h,visible:v,type:m="text",min:p=0,max:x=100,step:y=1})=>l.jsxs(al,{width:i,children:[v&&l.jsx(ll,{children:a}),l.jsx(u.InputGroup,{startElement:e,children:l.jsx(u.Input,{value:t,onChange:T=>n?.(T.target.value),placeholder:r,size:o,type:m,variant:s,disabled:d,required:g,min:p,max:x,step:y})}),h&&l.jsx(ul,{fontSize:"xs",children:h}),c&&l.jsx(cl,{fontSize:"xs",children:c})]}),dl=S(u.Field.Root),fl=S(u.Field.HelperText),hl=S(u.Field.ErrorText),gl=S(u.Select.Root),pl=S(u.Select.Label),ml=S(u.Select.Control),vl=S(u.Select.Trigger),xl=S(u.Select.ValueText),bl=S(u.Select.IndicatorGroup),yl=S(u.Select.Indicator),Sl=S(u.Select.Content),wl=S(u.Select.Item),Cl=S(u.Select.ItemIndicator),Dl=S(u.Select.HiddenSelect),El=S(u.Select.Positioner),Vr=({options:e=[],label:t,value:n,onChange:r,placeholder:o,size:s="xs",width:i="100%",variant:a="outline",helperText:c,isDisabled:d,required:g,errorText:h,visible:v})=>{const m=f.useMemo(()=>u.createListCollection({items:e}),[e]),p=e.find(y=>y.value===n),x=y=>{y.preventDefault(),y.stopPropagation(),r?.(void 0)};return l.jsxs(dl,{disabled:d,required:g,children:[l.jsxs(gl,{collection:m,variant:a,size:s,width:i,value:n?[n]:[],onValueChange:y=>{r?.(y.value[0])},children:[l.jsx(Dl,{}),v&&l.jsx(pl,{children:t}),l.jsxs(ml,{children:[l.jsx(vl,{children:l.jsx(xl,{placeholder:o,children:p?.displayValue??p?.label})}),l.jsxs(bl,{children:[n&&!d&&l.jsx("div",{style:{pointerEvents:"auto",display:"flex",alignItems:"center"},onPointerDown:y=>y.stopPropagation(),onClick:y=>y.stopPropagation(),children:l.jsx(u.CloseButton,{size:"sm",variant:"ghost",onPointerDown:x,onClick:x,position:"relative",zIndex:10})}),l.jsx(yl,{})]})]}),l.jsx(El,{children:l.jsx(Sl,{children:m.items.map((y,T)=>l.jsxs(wl,{item:y,children:[y.label,l.jsx(Cl,{})]},T))})})]}),c&&l.jsx(fl,{children:c}),h&&l.jsx(hl,{children:h})]})},Ml="FILTER_PRESETS_",Yr=e=>`${Ml}${e}`,Tt=e=>{if(typeof window>"u")return[];const t=localStorage.getItem(Yr(e));try{return t?JSON.parse(t):[]}catch(n){return console.error("Failed to parse presets",n),[]}},fn=(e,t)=>{typeof window>"u"||(localStorage.setItem(Yr(e),JSON.stringify(t)),window.dispatchEvent(new Event("storage_updated")))},Hr=(e,t)=>{const n=Tt(e);fn(e,[t,...n])},Ur=(e,t)=>{const n=Tt(e).filter(r=>r.id!==t);fn(e,n)},jl=S(u.Checkbox.Root),Rl=S(u.Checkbox.HiddenInput),Tl=S(u.Checkbox.Control),Ol=S(u.Slider.Root),_l=S(u.Slider.Track),Il=S(u.Slider.Range),kl=S(u.Slider.Thumbs),$l=S(u.Slider.Control),Al=({filter:e,onVisibilityChange:t,onSizeChange:n})=>{const{attributes:r,listeners:o,setNodeRef:s,transform:i,transition:a}=jr({id:e.id}),c={transform:Ne.Transform.toString(i),transition:a};return l.jsxs(u.VStack,{ref:s,style:c,align:"stretch",border:"1px solid",borderColor:"gray.200",rounded:"md",p:3,mb:3,bg:"white",children:[l.jsxs(u.HStack,{...r,...o,cursor:"grab",userSelect:"none",gap:2,children:[l.jsx(zr,{size:16}),l.jsx(u.Text,{fontWeight:"bold",fontSize:"sm",children:e.label||e.id})]}),l.jsxs(u.HStack,{justify:"space-between",children:[l.jsx(u.Text,{fontSize:"sm",children:"Visible"}),l.jsxs(jl,{checked:e.visible,size:"sm",onCheckedChange:d=>t?.(e.id,!!d.checked),children:[l.jsx(Rl,{}),l.jsx(Tl,{})]})]}),l.jsxs(u.VStack,{align:"stretch",gap:1,children:[l.jsx(u.Text,{fontSize:"sm",children:"Size"}),l.jsx(Ol,{min:1,max:5,step:.5,value:[e.size??1],onValueChange:d=>n?.(e.id,d.value[0]),children:l.jsxs($l,{children:[l.jsx(_l,{children:l.jsx(Il,{})}),l.jsx(kl,{})]})})]})]})},zl=S(u.Drawer.Root),Ll=S(u.Drawer.Trigger),Nl=S(u.Drawer.Backdrop),Pl=S(u.Drawer.Positioner),Fl=S(u.Drawer.Content),Wl=S(u.Drawer.Header),Bl=S(u.Drawer.Title),Vl=S(u.Drawer.Body),Yl=S(u.Drawer.Footer),Hl=S(u.Drawer.CloseTrigger),Ul=S(u.Tabs.Root),Gl=S(u.Tabs.List),Yt=S(u.Tabs.Trigger),Ht=S(u.Tabs.Content),Gr=(e,t)=>{if(e.customComponent)return e.customComponent;switch(e.type){case"text":return l.jsx(Qt,{placeholder:e.label,value:e.value,onChange:e.onChange,label:e.label,visible:t});case"number":return l.jsx(Qt,{label:e.label,value:e.value,onChange:e.onChange});case"checkbox":return l.jsx(Pr,{label:e.label,value:e.value,onChange:e.onChange});case"select":return l.jsx(Vr,{label:e.label,value:e.value,onChange:e.onChange,options:e.options??[],visible:t,placeholder:e.placeholder});case"date":return l.jsx(Br,{value:e.value,onChange:e.onChange,visible:t,label:e.label});case"date-range":const n=e.value,r=n?.startDate||e.startDate,o=n?.endDate||e.endDate;return l.jsx(Wr,{startDate:r?new Date(r):void 0,endDate:o?new Date(o):void 0,onChange:(s,i)=>{e.onChange&&e.onChange({startDate:s,endDate:i})},visible:t,label:e.label});case"combobox":return l.jsx(Fr,{visible:!0,label:e.label,itemToString:s=>String(s.label),itemToValue:s=>s.value,renderItem:s=>l.jsx("span",{children:s.label})});default:return null}},ql=({filterDrawerSize:e="sm",onVisibilityChange:t,onSizeChange:n,onClear:r,filters:o,pageKey:s="default",onLoadPreset:i,activePresetName:a,onReorder:c,open:d,onOpenChange:g})=>{const[h,v]=f.useState([]);f.useEffect(()=>{const p=()=>{v(Tt(s))};return p(),window.addEventListener("storage",p),window.addEventListener("storage_updated",p),()=>{window.removeEventListener("storage",p),window.removeEventListener("storage_updated",p)}},[s]);const m=()=>{const p=prompt("Preset name?");if(!p)return;const x=o.reduce((y,T)=>(y[T.id]=T.value,y),{});Hr(s,{id:La(),name:p,date:new Date().toISOString(),values:x})};return l.jsx(u.HStack,{wrap:"wrap",children:l.jsxs(zl,{size:e,open:d,onOpenChange:g,children:[l.jsx(Ll,{asChild:!0,children:l.jsxs(u.IconButton,{"aria-label":"Open filters",variant:"outline",size:"xs",ml:2,p:2,children:[l.jsx(Hi,{size:16}),"Filters"]})}),l.jsxs(u.Portal,{children:[l.jsx(Nl,{}),l.jsx(Pl,{children:l.jsxs(Fl,{children:[l.jsx(Wl,{children:l.jsx(Bl,{children:"Filters"})}),l.jsx(Vl,{overflowY:"auto",pt:1,children:l.jsxs(Ul,{defaultValue:"view",children:[l.jsxs(Gl,{mb:4,children:[l.jsxs(Yt,{value:"view",children:[l.jsx(qi,{size:16}),"Edit"]}),l.jsxs(Yt,{value:"settings",children:[l.jsx(Zi,{size:16}),"Settings"]}),l.jsxs(Yt,{value:"presets",children:[l.jsx(zi,{size:16}),"Presets"]})]}),l.jsx(Ht,{value:"view",children:o.filter(p=>p.visible).map(p=>l.jsx(u.VStack,{align:"stretch",border:"1px solid",borderColor:"gray.200",flex:p.size??1,minW:`${(p.size??1)*100}px`,rounded:"md",p:3,mb:3,children:Gr(p,d)},p.id))}),l.jsx(Ht,{value:"settings",children:l.jsx(Sr,{sensors:jo(Mo(dn)),collisionDetection:ar,onDragEnd:({active:p,over:x})=>{if(!x||p.id===x.id)return;const y=o.findIndex(j=>j.id===p.id),T=o.findIndex(j=>j.id===x.id),R=jt(o,y,T);c?.(R)},children:l.jsx(Er,{items:o.map(p=>p.id),strategy:Bs,children:o.map(p=>l.jsx(Al,{filter:p,onVisibilityChange:t,onSizeChange:n},p.id))})})}),l.jsx(Ht,{value:"presets",children:l.jsxs(u.VStack,{align:"stretch",mb:3,children:[h.length===0&&l.jsx(u.Text,{fontSize:"xs",color:"gray.500",children:"No presets saved yet."}),h.map(p=>l.jsxs(u.HStack,{justify:"space-between",border:"1px solid",borderColor:a===p.name?"blue.300":"gray.200",rounded:"md",p:2,children:[l.jsxs(u.VStack,{align:"start",gap:0,children:[l.jsx(u.Text,{fontWeight:"bold",fontSize:"sm",children:p.name}),l.jsx(u.Text,{fontSize:"xs",color:"gray.500",children:new Date(p.date).toLocaleDateString()})]}),l.jsxs(u.HStack,{children:[l.jsx(u.Button,{size:"xs",variant:"ghost",onClick:()=>{const x=o.map(y=>({...y,value:p.values[y.id]??y.value}));i?.(x,p.name)},children:"Load"}),l.jsx(u.IconButton,{size:"xs","aria-label":"Delete preset",variant:"ghost",onClick:()=>Ur(s,p.id),children:l.jsx(Vi,{size:14})})]})]},p.id)),l.jsx(u.Button,{size:"sm",colorScheme:"blue",onClick:m,children:"Save Current Filters"})]})})]})}),l.jsx(Yl,{justify:"space-between",children:l.jsx(Hl,{asChild:!0,children:l.jsx(u.CloseButton,{})})})]})})]})]})})},Kl=({title:e,filters:t,onVisibilityChange:n,onReorder:r,onSizeChange:o,onClear:s,maxToolbarUnits:i,pageKey:a,onLoadPreset:c,activePresetName:d,filterDrawerSize:g="sm"})=>{const[h,v]=f.useState(!1);return l.jsxs(u.HStack,{wrap:"wrap",pl:2,pr:2,width:"100%",justify:"space-between",children:[e,l.jsxs(u.HStack,{gapX:1,children:[t.filter(m=>m.visible!==!1).map(m=>l.jsx(u.HStack,{flex:m.size??1,minW:`${(m.size??1)*100}px`,alignItems:"center",children:Gr(m)},m.id)),l.jsx(ql,{filterDrawerSize:g,onVisibilityChange:n,onReorder:r,onSizeChange:o,onClear:s,maxToolbarUnits:i,pageKey:a,filters:t,onLoadPreset:c,activePresetName:d,open:h,onOpenChange:m=>{v(m.open)}})]})]})},Xl=(e,t)=>{localStorage.setItem(`FILTER_ORDER_${e}`,JSON.stringify(t))},Jl=e=>{try{return JSON.parse(localStorage.getItem(`FILTER_ORDER_${e}`)||"[]")}catch{return[]}},Zl=({onClick:e,size:t="xs",variant:n="solid",label:r,leftIcon:o,rightIcon:s,isDisabled:i,colorScheme:a,loading:c,loadingText:d,rounded:g,type:h="button",textColor:v="white",borderColor:m})=>l.jsx(u.Button,{onClick:e,size:t,variant:n,disabled:i,loading:c,loadingText:d,rounded:g,type:h,background:a,color:v,border:m,children:l.jsxs(u.HStack,{gap:1,children:[o,r,s]})}),Ql=S(u.Dialog.Root),ec=S(u.Dialog.Backdrop),tc=S(u.Dialog.Positioner),nc=S(u.Dialog.Content),rc=S(u.Dialog.Header),oc=S(u.Dialog.Body),sc=S(u.Dialog.Footer),ic=S(u.Dialog.Title),ac=S(u.Dialog.CloseTrigger);function lc({open:e,onClose:t,onConfirm:n,title:r="Confirm Action",description:o="Are you sure you want to continue?",confirmLabel:s="Confirm",cancelLabel:i="Cancel",icon:a,isLoading:c=!1,confirmButtonColorScheme:d="#4169e1"}){return l.jsx(Ql,{open:e,placement:"center",onOpenChange:g=>!g.open&&t(),children:l.jsxs(u.Portal,{children:[l.jsx(ec,{}),l.jsx(tc,{children:l.jsxs(nc,{maxW:"480px",children:[l.jsx(rc,{borderBottom:"1px solid",borderColor:"gray.200",children:l.jsx(ic,{children:r})}),l.jsx(oc,{p:6,children:l.jsxs(u.Stack,{gap:4,align:"center",textAlign:"center",children:[l.jsx(u.Box,{color:"orange.500",children:a??l.jsx(Lr,{size:40})}),l.jsx(u.Text,{fontSize:"sm",color:"gray.600",children:o})]})}),l.jsxs(sc,{justifyContent:"flex-end",gap:2,borderTop:"1px solid",borderColor:"gray.200",children:[l.jsx(u.Button,{variant:"outline",size:"sm",onClick:t,children:i}),l.jsx(u.Button,{size:"sm",style:{backgroundColor:d},loading:c,onClick:n,children:s})]}),l.jsx(ac,{asChild:!0,children:l.jsx(u.CloseButton,{size:"sm"})})]})})]})})}const cc=S(u.Dialog.Root),uc=S(u.Dialog.Backdrop),dc=S(u.Dialog.Positioner),fc=S(u.Dialog.Content),hc=S(u.Dialog.Header),gc=S(u.Dialog.Body),pc=S(u.Dialog.Footer),mc=S(u.Dialog.Title),vc=S(u.Dialog.CloseTrigger);function xc({open:e,onClose:t,onConfirm:n,title:r="Delete Company",entityName:o,confirmText:s="DELETE",confirmLabel:i="Delete",isLoading:a=!1}){const[c,d]=f.useState(""),g=c===s;return l.jsx(cc,{open:e,placement:"center",onOpenChange:h=>{!h.open&&t(),d("")},children:l.jsxs(u.Portal,{children:[l.jsx(uc,{}),l.jsx(dc,{children:l.jsxs(fc,{maxW:"550px",children:[l.jsx(hc,{borderBottom:"1px solid",borderColor:"#d3d3d3",children:l.jsx(mc,{color:"red.600",children:r})}),l.jsx(gc,{p:2,style:{padding:"16px"},children:l.jsxs(u.Stack,{gap:4,borderRadius:"md",p:4,bg:"white",children:[l.jsx(u.Box,{border:"1px solid",borderColor:"red.200",bg:"red.50",borderRadius:"md",p:4,children:l.jsxs(u.Stack,{direction:"row",gap:3,align:"flex-start",children:[l.jsx(u.Box,{color:"red.600",mt:"2px",children:l.jsx(Lr,{size:20})}),l.jsxs(u.Box,{children:[l.jsx(u.Text,{fontWeight:"semibold",color:"red.700",children:"Are you sure?"}),l.jsxs(u.Text,{fontSize:"sm",color:"red.600",children:["All the data of ",l.jsx("b",{children:o})," will permanently be deleted."]})]})]})}),l.jsx(u.Text,{fontSize:"sm",color:"gray.600",children:"You can’t undo this action afterwards."}),l.jsxs(u.Box,{children:[l.jsxs(u.Text,{fontSize:"sm",mb:2,children:["Type ",l.jsx("b",{children:s})," to continue"]}),l.jsx(u.Input,{placeholder:`Type ${s} here`,value:c,onChange:h=>d(h.target.value),size:"xs"})]})]})}),l.jsxs(pc,{justifyContent:"flex-end",gap:2,borderTop:"1px solid",borderColor:"#d3d3d3",children:[l.jsx(u.Button,{variant:"outline",size:"sm",onClick:()=>{t(),d("")},children:"Cancel"}),l.jsx(u.Button,{size:"sm",disabled:!g,style:{backgroundColor:"#FF0000"},loading:a,onClick:n,children:i})]}),l.jsx(vc,{asChild:!0,children:l.jsx(u.CloseButton,{size:"sm"})})]})})]})})}const qr=({children:e})=>l.jsx(l.Fragment,{children:e}),Kr=({children:e})=>l.jsx(l.Fragment,{children:e}),bc=u.Button,yc=S(u.Dialog.Root),Sc=S(u.Dialog.Backdrop),wc=S(u.Dialog.Positioner),Cc=S(u.Dialog.Content),Dc=S(u.Dialog.Header),Ec=S(u.Dialog.Body),Mc=S(u.Dialog.Footer),jc=S(u.Dialog.Title),Rc=S(u.Dialog.CloseTrigger);function Tc(e){let t=null,n=null;return f.Children.forEach(e,r=>{f.isValidElement(r)&&(r.type===qr&&(t=r.props.children),r.type===Kr&&(n=r.props.children))}),{body:t,actions:n}}const Oc=({open:e,onClose:t,title:n,children:r,width:o,position:s,refetch:i,loading:a=!1})=>{const{body:c,actions:d}=Tc(r);return l.jsx(yc,{open:e,onOpenChange:g=>!g.open&&t(),placement:s??"center",children:l.jsxs(u.Portal,{children:[l.jsx(Sc,{bg:"blackAlpha.400"}),l.jsx(wc,{children:l.jsxs(Cc,{w:o??"560px",maxW:o??"560px",borderRadius:"6px",overflow:"hidden",boxShadow:"lg",children:[l.jsx(Dc,{px:"20px",py:"16px",bg:"white",borderBottom:"1px solid",borderColor:"gray.200",children:l.jsxs(u.Flex,{align:"center",justify:"space-between",children:[l.jsx(jc,{fontSize:"16px",fontWeight:"600",children:n}),l.jsx(Rc,{asChild:!0,children:l.jsx(u.CloseButton,{size:"sm"})}),i&&l.jsx(hn,{label:"Refresh",refetch:i,isLoading:a})]})}),c&&l.jsx(Ec,{px:"20px",py:"16px",bg:"#F8FAFC",type:"submit",children:l.jsx(u.Flex,{direction:"column",gap:"16px",children:c})}),d&&l.jsx(Mc,{px:"20px",py:"16px",bg:"white",borderTop:"1px solid",borderColor:"gray.200",children:l.jsx(u.Flex,{ml:"auto",gap:"12px",children:d})})]})})]})})},_c=S(u.Field.Root),Ic=S(u.Field.Label),kc=S(u.Field.HelperText),$c=S(u.Field.ErrorText),Ac=S(u.PinInput.Input),zc=S(u.PinInput.Control),Lc=S(u.PinInput.HiddenInput),Nc=S(u.PinInput.Root),Pc=({value:e,onChange:t,length:n=4,size:r="xs",isDisabled:o=!1,label:s,helperText:i,errorText:a,required:c=!1,visible:d=!0})=>{const g=Array.from({length:n}).map((h,v)=>e?.[v]??"");return l.jsxs(_c,{children:[d&&s&&l.jsxs(Ic,{children:[s,c&&" *"]}),l.jsxs(Nc,{value:g,onValueChange:h=>t?.(h.value.join("")),disabled:o,size:r,children:[l.jsx(Lc,{}),l.jsx(zc,{children:l.jsx(u.HStack,{children:Array.from({length:n}).map((h,v)=>l.jsx(Ac,{index:v},v))})})]}),a&&l.jsx($c,{fontSize:"xs",children:a}),i&&!a&&l.jsx(kc,{fontSize:"xs",children:i})]})};function hn({refetch:e,isLoading:t=!1,label:n="Refresh"}){const[r,o]=f.useState(!1),s=async()=>{o(!0);try{await e()}finally{setTimeout(()=>o(!1),300)}};return l.jsx(u.IconButton,{"aria-label":n,size:"xs",variant:"outline",disabled:t||r,onClick:s,ml:2,children:l.jsx(Xi,{size:14,style:{animation:r?"spin 0.6s linear infinite":void 0}})})}var ht={exports:{}},Fc=ht.exports,er;function Wc(){return er||(er=1,(function(e,t){(function(n,r){e.exports=r()})(Fc,(function(){var n=1e3,r=6e4,o=36e5,s="millisecond",i="second",a="minute",c="hour",d="day",g="week",h="month",v="quarter",m="year",p="date",x="Invalid Date",y=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,T=/\[([^\]]+)]|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(M){var w=["th","st","nd","rd"],C=M%100;return"["+M+(w[(C-20)%10]||w[C]||w[0])+"]"}},j=function(M,w,C){var E=String(M);return!E||E.length>=w?M:""+Array(w+1-E.length).join(C)+M},k={s:j,z:function(M){var w=-M.utcOffset(),C=Math.abs(w),E=Math.floor(C/60),D=C%60;return(w<=0?"+":"-")+j(E,2,"0")+":"+j(D,2,"0")},m:function M(w,C){if(w.date()<C.date())return-M(C,w);var E=12*(C.year()-w.year())+(C.month()-w.month()),D=w.clone().add(E,h),O=C-D<0,N=w.clone().add(E+(O?-1:1),h);return+(-(E+(C-D)/(O?D-N:N-D))||0)},a:function(M){return M<0?Math.ceil(M)||0:Math.floor(M)},p:function(M){return{M:h,y:m,w:g,d,D:p,h:c,m:a,s:i,ms:s,Q:v}[M]||String(M||"").toLowerCase().replace(/s$/,"")},u:function(M){return M===void 0}},$="en",I={};I[$]=R;var L="$isDayjsObject",A=function(M){return M instanceof Y||!(!M||!M[L])},B=function M(w,C,E){var D;if(!w)return $;if(typeof w=="string"){var O=w.toLowerCase();I[O]&&(D=O),C&&(I[O]=C,D=O);var N=w.split("-");if(!D&&N.length>1)return M(N[0])}else{var b=w.name;I[b]=w,D=b}return!E&&D&&($=D),D||!E&&$},W=function(M,w){if(A(M))return M.clone();var C=typeof w=="object"?w:{};return C.date=M,C.args=arguments,new Y(C)},z=k;z.l=B,z.i=A,z.w=function(M,w){return W(M,{locale:w.$L,utc:w.$u,x:w.$x,$offset:w.$offset})};var Y=(function(){function M(C){this.$L=B(C.locale,null,!0),this.parse(C),this.$x=this.$x||C.x||{},this[L]=!0}var w=M.prototype;return w.parse=function(C){this.$d=(function(E){var D=E.date,O=E.utc;if(D===null)return new Date(NaN);if(z.u(D))return new Date;if(D instanceof Date)return new Date(D);if(typeof D=="string"&&!/Z$/i.test(D)){var N=D.match(y);if(N){var b=N[2]-1||0,_=(N[7]||"0").substring(0,3);return O?new Date(Date.UTC(N[1],b,N[3]||1,N[4]||0,N[5]||0,N[6]||0,_)):new Date(N[1],b,N[3]||1,N[4]||0,N[5]||0,N[6]||0,_)}}return new Date(D)})(C),this.init()},w.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()},w.$utils=function(){return z},w.isValid=function(){return this.$d.toString()!==x},w.isSame=function(C,E){var D=W(C);return this.startOf(E)<=D&&D<=this.endOf(E)},w.isAfter=function(C,E){return W(C)<this.startOf(E)},w.isBefore=function(C,E){return this.endOf(E)<W(C)},w.$g=function(C,E,D){return z.u(C)?this[E]:this.set(D,C)},w.unix=function(){return Math.floor(this.valueOf()/1e3)},w.valueOf=function(){return this.$d.getTime()},w.startOf=function(C,E){var D=this,O=!!z.u(E)||E,N=z.p(C),b=function(J,V){var se=z.w(D.$u?Date.UTC(D.$y,V,J):new Date(D.$y,V,J),D);return O?se:se.endOf(d)},_=function(J,V){return z.w(D.toDate()[J].apply(D.toDate("s"),(O?[0,0,0,0]:[23,59,59,999]).slice(V)),D)},P=this.$W,F=this.$M,K=this.$D,G="set"+(this.$u?"UTC":"");switch(N){case m:return O?b(1,0):b(31,11);case h:return O?b(1,F):b(0,F+1);case g:var H=this.$locale().weekStart||0,X=(P<H?P+7:P)-H;return b(O?K-X:K+(6-X),F);case d:case p:return _(G+"Hours",0);case c:return _(G+"Minutes",1);case a:return _(G+"Seconds",2);case i:return _(G+"Milliseconds",3);default:return this.clone()}},w.endOf=function(C){return this.startOf(C,!1)},w.$set=function(C,E){var D,O=z.p(C),N="set"+(this.$u?"UTC":""),b=(D={},D[d]=N+"Date",D[p]=N+"Date",D[h]=N+"Month",D[m]=N+"FullYear",D[c]=N+"Hours",D[a]=N+"Minutes",D[i]=N+"Seconds",D[s]=N+"Milliseconds",D)[O],_=O===d?this.$D+(E-this.$W):E;if(O===h||O===m){var P=this.clone().set(p,1);P.$d[b](_),P.init(),this.$d=P.set(p,Math.min(this.$D,P.daysInMonth())).$d}else b&&this.$d[b](_);return this.init(),this},w.set=function(C,E){return this.clone().$set(C,E)},w.get=function(C){return this[z.p(C)]()},w.add=function(C,E){var D,O=this;C=Number(C);var N=z.p(E),b=function(F){var K=W(O);return z.w(K.date(K.date()+Math.round(F*C)),O)};if(N===h)return this.set(h,this.$M+C);if(N===m)return this.set(m,this.$y+C);if(N===d)return b(1);if(N===g)return b(7);var _=(D={},D[a]=r,D[c]=o,D[i]=n,D)[N]||1,P=this.$d.getTime()+C*_;return z.w(P,this)},w.subtract=function(C,E){return this.add(-1*C,E)},w.format=function(C){var E=this,D=this.$locale();if(!this.isValid())return D.invalidDate||x;var O=C||"YYYY-MM-DDTHH:mm:ssZ",N=z.z(this),b=this.$H,_=this.$m,P=this.$M,F=D.weekdays,K=D.months,G=D.meridiem,H=function(V,se,re,ge){return V&&(V[se]||V(E,O))||re[se].slice(0,ge)},X=function(V){return z.s(b%12||12,V,"0")},J=G||function(V,se,re){var ge=V<12?"AM":"PM";return re?ge.toLowerCase():ge};return O.replace(T,(function(V,se){return se||(function(re){switch(re){case"YY":return String(E.$y).slice(-2);case"YYYY":return z.s(E.$y,4,"0");case"M":return P+1;case"MM":return z.s(P+1,2,"0");case"MMM":return H(D.monthsShort,P,K,3);case"MMMM":return H(K,P);case"D":return E.$D;case"DD":return z.s(E.$D,2,"0");case"d":return String(E.$W);case"dd":return H(D.weekdaysMin,E.$W,F,2);case"ddd":return H(D.weekdaysShort,E.$W,F,3);case"dddd":return F[E.$W];case"H":return String(b);case"HH":return z.s(b,2,"0");case"h":return X(1);case"hh":return X(2);case"a":return J(b,_,!0);case"A":return J(b,_,!1);case"m":return String(_);case"mm":return z.s(_,2,"0");case"s":return String(E.$s);case"ss":return z.s(E.$s,2,"0");case"SSS":return z.s(E.$ms,3,"0");case"Z":return N}return null})(V)||N.replace(":","")}))},w.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},w.diff=function(C,E,D){var O,N=this,b=z.p(E),_=W(C),P=(_.utcOffset()-this.utcOffset())*r,F=this-_,K=function(){return z.m(N,_)};switch(b){case m:O=K()/12;break;case h:O=K();break;case v:O=K()/3;break;case g:O=(F-P)/6048e5;break;case d:O=(F-P)/864e5;break;case c:O=F/o;break;case a:O=F/r;break;case i:O=F/n;break;default:O=F}return D?O:z.a(O)},w.daysInMonth=function(){return this.endOf(h).$D},w.$locale=function(){return I[this.$L]},w.locale=function(C,E){if(!C)return this.$L;var D=this.clone(),O=B(C,E,!0);return O&&(D.$L=O),D},w.clone=function(){return z.w(this.$d,this)},w.toDate=function(){return new Date(this.valueOf())},w.toJSON=function(){return this.isValid()?this.toISOString():null},w.toISOString=function(){return this.$d.toISOString()},w.toString=function(){return this.$d.toUTCString()},M})(),q=Y.prototype;return W.prototype=q,[["$ms",s],["$s",i],["$m",a],["$H",c],["$W",d],["$M",h],["$y",m],["$D",p]].forEach((function(M){q[M[1]]=function(w){return this.$g(w,M[0],M[1])}})),W.extend=function(M,w){return M.$i||(M(w,Y,W),M.$i=!0),W},W.locale=B,W.isDayjs=A,W.unix=function(M){return W(1e3*M)},W.en=I[$],W.Ls=I,W.p={},W}))})(ht)),ht.exports}var Bc=Wc();const Ot=Ct(Bc);var gt={exports:{}},Vc=gt.exports,tr;function Yc(){return tr||(tr=1,(function(e,t){(function(n,r){e.exports=r()})(Vc,(function(){return function(n,r,o){n=n||{};var s=r.prototype,i={future:"in %s",past:"%s ago",s:"a few seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"};function a(d,g,h,v){return s.fromToBase(d,g,h,v)}o.en.relativeTime=i,s.fromToBase=function(d,g,h,v,m){for(var p,x,y,T=h.$locale().relativeTime||i,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"}],j=R.length,k=0;k<j;k+=1){var $=R[k];$.d&&(p=v?o(d).diff(h,$.d,!0):h.diff(d,$.d,!0));var I=(n.rounding||Math.round)(Math.abs(p));if(y=p>0,I<=$.r||!$.r){I<=1&&k>0&&($=R[k-1]);var L=T[$.l];m&&(I=m(""+I)),x=typeof L=="string"?L.replace("%d",I):L(I,g,$.l,y);break}}if(g)return x;var A=y?T.future:T.past;return typeof A=="function"?A(x):A.replace("%s",x)},s.to=function(d,g){return a(d,g,this,!0)},s.from=function(d,g){return a(d,g,this)};var c=function(d){return d.$u?o.utc():o()};s.toNow=function(d){return this.to(c(this),d)},s.fromNow=function(d){return this.from(c(this),d)}}}))})(gt)),gt.exports}var Hc=Yc();const Uc=Ct(Hc);var pt={exports:{}},Gc=pt.exports,nr;function qc(){return nr||(nr=1,(function(e,t){(function(n,r){e.exports=r()})(Gc,(function(){var n={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"};return function(r,o,s){var i=o.prototype,a=i.format;s.en.formats=n,i.format=function(c){c===void 0&&(c="YYYY-MM-DDTHH:mm:ssZ");var d=this.$locale().formats,g=(function(h,v){return h.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,(function(m,p,x){var y=x&&x.toUpperCase();return p||v[x]||n[x]||v[y].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,(function(T,R,j){return R||j.slice(1)}))}))})(c,d===void 0?{}:d);return a.call(this,g)}}}))})(pt)),pt.exports}var Kc=qc();const Xc=Ct(Kc);var mt={exports:{}},Jc=mt.exports,rr;function Zc(){return rr||(rr=1,(function(e,t){(function(n,r){e.exports=r()})(Jc,(function(){return function(n,r){var o=r.prototype,s=o.format;o.format=function(i){var a=this,c=this.$locale();if(!this.isValid())return s.bind(this)(i);var d=this.$utils(),g=(i||"YYYY-MM-DDTHH:mm:ssZ").replace(/\[([^\]]+)]|Q|wo|ww|w|WW|W|zzz|z|gggg|GGGG|Do|X|x|k{1,2}|S/g,(function(h){switch(h){case"Q":return Math.ceil((a.$M+1)/3);case"Do":return c.ordinal(a.$D);case"gggg":return a.weekYear();case"GGGG":return a.isoWeekYear();case"wo":return c.ordinal(a.week(),"W");case"w":case"ww":return d.s(a.week(),h==="w"?1:2,"0");case"W":case"WW":return d.s(a.isoWeek(),h==="W"?1:2,"0");case"k":case"kk":return d.s(String(a.$H===0?24:a.$H),h==="k"?1:2,"0");case"X":return Math.floor(a.$d.getTime()/1e3);case"x":return a.$d.getTime();case"z":return"["+a.offsetName()+"]";case"zzz":return"["+a.offsetName("long")+"]";default:return h}}));return s.bind(this)(g)}}}))})(mt)),mt.exports}var Qc=Zc();const eu=Ct(Qc);Ot.extend(Uc);Ot.extend(Xc);Ot.extend(eu);const tu={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 en({value:e,variant:t="dateTime",format:n,fallback:r="--"}){if(!e)return r;const o=Ot(e);return o.isValid()?t==="relative"?o.fromNow():o.format(n??tu[t]):r}function nu({value:e,dateVariant:t="date",timeVariant:n="time",dateFormat:r,timeFormat:o,align:s="start",dateColor:i="gray.700",dateFontSize:a="16px",dateFontWeight:c="500",timeColor:d="gray.500",timeFontSize:g="12px",timeFontWeight:h="400",showTime:v=!0}){return l.jsxs(u.Stack,{gap:.5,align:s,children:[l.jsx(u.Text,{fontSize:a,fontWeight:c,color:i,children:en({value:e,variant:t,format:r})}),v&&l.jsx(u.Text,{fontSize:g,fontWeight:h,color:d,children:en({value:e,variant:n,format:o})})]})}class Xr{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 tn{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 nn{constructor(t){this.api=t}store=new Xr;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 Jr=f.createContext(null);function Zr(){const e=f.useContext(Jr);if(!e)throw new Error("OptionsProvider is missing. Wrap your app with <OptionsProvider />");return e}function ru({client:{apiUrl:e},children:t}){const n=f.useRef(new nn(new tn(e)));return n.current||(n.current=new nn(new tn(e))),l.jsx(Jr.Provider,{value:n.current,children:t})}function ou(e){const t=Zr(),[n,r]=f.useState(t.getRaw(e)?.value);return f.useEffect(()=>{let o=!0;t.getKey(e).then(i=>{o&&r(i)});const s=t.subscribe(e,i=>{r(i?.value)});return()=>{o=!1,s()}},[e,t]),n}function su(e){const t=Zr(),[n,r]=f.useState({});return f.useEffect(()=>{let o=!0;t.getMultiKey(e).then(i=>{o&&r(i)});const s=e.map(i=>t.subscribe(i,a=>{r(c=>({...c,[i]:a?.value}))}));return()=>{o=!1,s.forEach(i=>i())}},[e.join("|"),t]),n}async function iu(e,t){return e.getKey(t)}async function au(e,t){await e.getMultiKey(t)}function lu(e={}){const{initialPage:t=1,initialLimit:n=20}=e,[r,o]=f.useState(t),[s,i]=f.useState(n),a=f.useCallback(v=>{o(Math.max(1,v))},[]),c=f.useCallback(v=>{i(Math.max(1,v)),o(1)},[]),d=f.useCallback(()=>{o(v=>v+1)},[]),g=f.useCallback(()=>{o(v=>Math.max(1,v-1))},[]),h=f.useCallback(()=>{o(t),i(n)},[t,n]);return{page:r,limit:s,setPage:a,setLimit:c,nextPage:d,prevPage:g,reset:h}}function cu(e={}){const{initialValue:t="",delay:n=300,len:r=3}=e,[o,s]=f.useState(t),a=o.length===0||o.length>=r?o:"",c=uu(a,n),d=f.useCallback(h=>{s(h)},[]),g=f.useCallback(()=>{s(t)},[t]);return{search:o,debouncedSearch:c,onSearchChange:d,reset:g,len:r}}function uu(e,t=300){const[n,r]=f.useState(e);return f.useEffect(()=>{const o=setTimeout(()=>{r(e)},t);return()=>clearTimeout(o)},[e,t]),n}exports.ACTIONS_COLUMN_ID=Te;exports.DataTable=_a;exports.Filters=Kl;exports.HttpOptionsApi=tn;exports.MDSButton=Zl;exports.MDSCheckbox=Pr;exports.MDSCombobox=Fr;exports.MDSConfirmActionDialog=lc;exports.MDSConfirmDeleteDialog=xc;exports.MDSDatePicker=Br;exports.MDSDateRangePicker=Wr;exports.MDSDialogAction=bc;exports.MDSDialogActions=Kr;exports.MDSDialogBody=qr;exports.MDSDialogWrapper=Oc;exports.MDSInput=Qt;exports.MDSPinInput=Pc;exports.MDSRefreshButton=hn;exports.MDSSelectBox=Vr;exports.OptionsClientImpl=nn;exports.OptionsProvider=ru;exports.OptionsStore=Xr;exports.RefreshButton=hn;exports.SERIAL_NUMBER_COLUMN_ID=wi;exports.StackedDateTime=nu;exports.VISIBILITY_COLUMN_ID=he;exports.addPreset=Hr;exports.deletePreset=Ur;exports.formatDateTime=en;exports.getColumnWidthKey=Rt;exports.getOption=iu;exports.getPresets=Tt;exports.loadOrder=Jl;exports.prefetchOptions=au;exports.saveOrder=Xl;exports.savePresets=fn;exports.setColumnWidth=Ci;exports.setData=_r;exports.setTableId=Ir;exports.tableStore=ne;exports.useDebouncedSearch=cu;exports.useOption=ou;exports.useOptions=su;exports.usePagination=lu;exports.withChildren=S;
|
|
13
|
+
color: hsl(${Math.max(0,Math.min(120-120*y,120))}deg 100% 31%);`,n?.key)}return n?.onChange&&!(s&&n.skipInitialOnChange)&&n.onChange(o),s=!1,o}return a.updateDeps=i=>{r=i},a}function Hn(e,t){if(e===void 0)throw new Error("Unexpected undefined");return e}const ui=(e,t)=>Math.abs(e-t)<1.01,di=(e,t,n)=>{let r;return function(...o){e.clearTimeout(r),r=e.setTimeout(()=>t.apply(this,o),n)}},Un=e=>{const{offsetWidth:t,offsetHeight:n}=e;return{width:t,height:n}},fi=e=>e,hi=e=>{const t=Math.max(e.startIndex-e.overscan,0),n=Math.min(e.endIndex+e.overscan,e.count-1),r=[];for(let o=t;o<=n;o++)r.push(o);return r},gi=(e,t)=>{const n=e.scrollElement;if(!n)return;const r=e.targetWindow;if(!r)return;const o=a=>{const{width:i,height:c}=a;t({width:Math.round(i),height:Math.round(c)})};if(o(Un(n)),!r.ResizeObserver)return()=>{};const s=new r.ResizeObserver(a=>{const i=()=>{const c=a[0];if(c?.borderBoxSize){const d=c.borderBoxSize[0];if(d){o({width:d.inlineSize,height:d.blockSize});return}}o(Un(n))};e.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(i):i()});return s.observe(n,{box:"border-box"}),()=>{s.unobserve(n)}},Gn={passive:!0},qn=typeof window>"u"?!0:"onscrollend"in window,pi=(e,t)=>{const n=e.scrollElement;if(!n)return;const r=e.targetWindow;if(!r)return;let o=0;const s=e.options.useScrollendEvent&&qn?()=>{}:di(r,()=>{t(o,!1)},e.options.isScrollingResetDelay),a=g=>()=>{const{horizontal:h,isRtl:v}=e.options;o=h?n.scrollLeft*(v&&-1||1):n.scrollTop,s(),t(o,g)},i=a(!0),c=a(!1);n.addEventListener("scroll",i,Gn);const d=e.options.useScrollendEvent&&qn;return d&&n.addEventListener("scrollend",c,Gn),()=>{n.removeEventListener("scroll",i),d&&n.removeEventListener("scrollend",c)}},mi=(e,t,n)=>{if(t?.borderBoxSize){const r=t.borderBoxSize[0];if(r)return Math.round(r[n.options.horizontal?"inlineSize":"blockSize"])}return e[n.options.horizontal?"offsetWidth":"offsetHeight"]},vi=(e,{adjustments:t=0,behavior:n},r)=>{var o,s;const a=e+t;(s=(o=r.scrollElement)==null?void 0:o.scrollTo)==null||s.call(o,{[r.options.horizontal?"left":"top"]:a,behavior:n})};class xi{constructor(t){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.currentScrollToIndex=null,this.measurementsCache=[],this.itemSizeCache=new Map,this.laneAssignments=new Map,this.pendingMeasuredCacheIndexes=[],this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this.elementsCache=new Map,this.observer=(()=>{let n=null;const r=()=>n||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:n=new this.targetWindow.ResizeObserver(o=>{o.forEach(s=>{const a=()=>{this._measureElement(s.target,s)};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(a):a()})}));return{disconnect:()=>{var o;(o=r())==null||o.disconnect(),n=null},observe:o=>{var s;return(s=r())==null?void 0:s.observe(o,{box:"border-box"})},unobserve:o=>{var s;return(s=r())==null?void 0:s.unobserve(o)}}})(),this.range=null,this.setOptions=n=>{Object.entries(n).forEach(([r,o])=>{typeof o>"u"&&delete n[r]}),this.options={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:fi,rangeExtractor:hi,onChange:()=>{},measureElement:mi,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,...n}},this.notify=n=>{var r,o;(o=(r=this.options).onChange)==null||o.call(r,this,n)},this.maybeNotify=Ae(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),n=>{this.notify(n)},{key:process.env.NODE_ENV!=="production"&&"maybeNotify",debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(n=>n()),this.unsubs=[],this.observer.disconnect(),this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var n;const r=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==r){if(this.cleanup(),!r){this.maybeNotify();return}this.scrollElement=r,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((n=this.scrollElement)==null?void 0:n.window)??null,this.elementsCache.forEach(o=>{this.observer.observe(o)}),this.unsubs.push(this.options.observeElementRect(this,o=>{this.scrollRect=o,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(o,s)=>{this.scrollAdjustments=0,this.scrollDirection=s?this.getScrollOffset()<o?"forward":"backward":null,this.scrollOffset=o,this.isScrolling=s,this.maybeNotify()})),this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})}},this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset=="function"?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getFurthestMeasurement=(n,r)=>{const o=new Map,s=new Map;for(let a=r-1;a>=0;a--){const i=n[a];if(o.has(i.lane))continue;const c=s.get(i.lane);if(c==null||i.end>c.end?s.set(i.lane,i):i.end<c.end&&o.set(i.lane,!0),o.size===this.options.lanes)break}return s.size===this.options.lanes?Array.from(s.values()).sort((a,i)=>a.end===i.end?a.index-i.index:a.end-i.end)[0]:void 0},this.getMeasurementOptions=Ae(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes],(n,r,o,s,a,i)=>(this.prevLanes!==void 0&&this.prevLanes!==i&&(this.lanesChangedFlag=!0),this.prevLanes=i,this.pendingMeasuredCacheIndexes=[],{count:n,paddingStart:r,scrollMargin:o,getItemKey:s,enabled:a,lanes:i}),{key:!1}),this.getMeasurements=Ae(()=>[this.getMeasurementOptions(),this.itemSizeCache],({count:n,paddingStart:r,scrollMargin:o,getItemKey:s,enabled:a,lanes:i},c)=>{if(!a)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>n)for(const v of this.laneAssignments.keys())v>=n&&this.laneAssignments.delete(v);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMeasuredCacheIndexes=[]),this.measurementsCache.length===0&&!this.lanesSettling&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(v=>{this.itemSizeCache.set(v.key,v.size)}));const d=this.lanesSettling?0:this.pendingMeasuredCacheIndexes.length>0?Math.min(...this.pendingMeasuredCacheIndexes):0;this.pendingMeasuredCacheIndexes=[],this.lanesSettling&&this.measurementsCache.length===n&&(this.lanesSettling=!1);const g=this.measurementsCache.slice(0,d),h=new Array(i).fill(void 0);for(let v=0;v<d;v++){const m=g[v];m&&(h[m.lane]=v)}for(let v=d;v<n;v++){const m=s(v),p=this.laneAssignments.get(v);let x,y;if(p!==void 0&&this.options.lanes>1){x=p;const I=h[x],$=I!==void 0?g[I]:void 0;y=$?$.end+this.options.gap:r+o}else{const I=this.options.lanes===1?g[v-1]:this.getFurthestMeasurement(g,v);y=I?I.end+this.options.gap:r+o,x=I?I.lane:v%this.options.lanes,this.options.lanes>1&&this.laneAssignments.set(v,x)}const M=c.get(m),R=typeof M=="number"?M:this.options.estimateSize(v),j=y+R;g[v]={index:v,start:y,size:R,end:j,key:m,lane:x},h[x]=v}return this.measurementsCache=g,g},{key:process.env.NODE_ENV!=="production"&&"getMeasurements",debug:()=>this.options.debug}),this.calculateRange=Ae(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(n,r,o,s)=>this.range=n.length>0&&r>0?bi({measurements:n,outerSize:r,scrollOffset:o,lanes:s}):null,{key:process.env.NODE_ENV!=="production"&&"calculateRange",debug:()=>this.options.debug}),this.getVirtualIndexes=Ae(()=>{let n=null,r=null;const o=this.calculateRange();return o&&(n=o.startIndex,r=o.endIndex),this.maybeNotify.updateDeps([this.isScrolling,n,r]),[this.options.rangeExtractor,this.options.overscan,this.options.count,n,r]},(n,r,o,s,a)=>s===null||a===null?[]:n({startIndex:s,endIndex:a,overscan:r,count:o}),{key:process.env.NODE_ENV!=="production"&&"getVirtualIndexes",debug:()=>this.options.debug}),this.indexFromElement=n=>{const r=this.options.indexAttribute,o=n.getAttribute(r);return o?parseInt(o,10):(console.warn(`Missing attribute name '${r}={index}' on measured element.`),-1)},this._measureElement=(n,r)=>{const o=this.indexFromElement(n),s=this.measurementsCache[o];if(!s)return;const a=s.key,i=this.elementsCache.get(a);i!==n&&(i&&this.observer.unobserve(i),this.observer.observe(n),this.elementsCache.set(a,n)),n.isConnected&&this.resizeItem(o,this.options.measureElement(n,r,this))},this.resizeItem=(n,r)=>{const o=this.measurementsCache[n];if(!o)return;const s=this.itemSizeCache.get(o.key)??o.size,a=r-s;a!==0&&((this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(o,a,this):o.start<this.getScrollOffset()+this.scrollAdjustments)&&(process.env.NODE_ENV!=="production"&&this.options.debug&&console.info("correction",a),this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=a,behavior:void 0})),this.pendingMeasuredCacheIndexes.push(o.index),this.itemSizeCache=new Map(this.itemSizeCache.set(o.key,r)),this.notify(!1))},this.measureElement=n=>{if(!n){this.elementsCache.forEach((r,o)=>{r.isConnected||(this.observer.unobserve(r),this.elementsCache.delete(o))});return}this._measureElement(n,void 0)},this.getVirtualItems=Ae(()=>[this.getVirtualIndexes(),this.getMeasurements()],(n,r)=>{const o=[];for(let s=0,a=n.length;s<a;s++){const i=n[s],c=r[i];o.push(c)}return o},{key:process.env.NODE_ENV!=="production"&&"getVirtualItems",debug:()=>this.options.debug}),this.getVirtualItemForOffset=n=>{const r=this.getMeasurements();if(r.length!==0)return Hn(r[Or(0,r.length-1,o=>Hn(r[o]).start,n)])},this.getMaxScrollOffset=()=>{if(!this.scrollElement)return 0;if("scrollHeight"in this.scrollElement)return this.options.horizontal?this.scrollElement.scrollWidth-this.scrollElement.clientWidth:this.scrollElement.scrollHeight-this.scrollElement.clientHeight;{const n=this.scrollElement.document.documentElement;return this.options.horizontal?n.scrollWidth-this.scrollElement.innerWidth:n.scrollHeight-this.scrollElement.innerHeight}},this.getOffsetForAlignment=(n,r,o=0)=>{if(!this.scrollElement)return 0;const s=this.getSize(),a=this.getScrollOffset();r==="auto"&&(r=n>=a+s?"end":"start"),r==="center"?n+=(o-s)/2:r==="end"&&(n-=s);const i=this.getMaxScrollOffset();return Math.max(Math.min(i,n),0)},this.getOffsetForIndex=(n,r="auto")=>{n=Math.max(0,Math.min(n,this.options.count-1));const o=this.measurementsCache[n];if(!o)return;const s=this.getSize(),a=this.getScrollOffset();if(r==="auto")if(o.end>=a+s-this.options.scrollPaddingEnd)r="end";else if(o.start<=a+this.options.scrollPaddingStart)r="start";else return[a,r];if(r==="end"&&n===this.options.count-1)return[this.getMaxScrollOffset(),r];const i=r==="end"?o.end+this.options.scrollPaddingEnd:o.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(i,r,o.size),r]},this.isDynamicMode=()=>this.elementsCache.size>0,this.scrollToOffset=(n,{align:r="start",behavior:o}={})=>{o==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),this._scrollToOffset(this.getOffsetForAlignment(n,r),{adjustments:void 0,behavior:o})},this.scrollToIndex=(n,{align:r="auto",behavior:o}={})=>{o==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),n=Math.max(0,Math.min(n,this.options.count-1)),this.currentScrollToIndex=n;let s=0;const a=10,i=d=>{if(!this.targetWindow)return;const g=this.getOffsetForIndex(n,d);if(!g){console.warn("Failed to get offset for index:",n);return}const[h,v]=g;this._scrollToOffset(h,{adjustments:void 0,behavior:o}),this.targetWindow.requestAnimationFrame(()=>{const m=()=>{if(this.currentScrollToIndex!==n)return;const p=this.getScrollOffset(),x=this.getOffsetForIndex(n,v);if(!x){console.warn("Failed to get offset for index:",n);return}ui(x[0],p)||c(v)};this.isDynamicMode()?this.targetWindow.requestAnimationFrame(m):m()})},c=d=>{this.targetWindow&&this.currentScrollToIndex===n&&(s++,s<a?(process.env.NODE_ENV!=="production"&&this.options.debug&&console.info("Schedule retry",s,a),this.targetWindow.requestAnimationFrame(()=>i(d))):console.warn(`Failed to scroll to index ${n} after ${a} attempts.`))};i(r)},this.scrollBy=(n,{behavior:r}={})=>{r==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),this._scrollToOffset(this.getScrollOffset()+n,{adjustments:void 0,behavior:r})},this.getTotalSize=()=>{var n;const r=this.getMeasurements();let o;if(r.length===0)o=this.options.paddingStart;else if(this.options.lanes===1)o=((n=r[r.length-1])==null?void 0:n.end)??0;else{const s=Array(this.options.lanes).fill(null);let a=r.length-1;for(;a>=0&&s.some(i=>i===null);){const i=r[a];s[i.lane]===null&&(s[i.lane]=i.end),a--}o=Math.max(...s.filter(i=>i!==null))}return Math.max(o-this.options.scrollMargin+this.options.paddingEnd,0)},this._scrollToOffset=(n,{adjustments:r,behavior:o})=>{this.options.scrollToFn(n,{behavior:o,adjustments:r},this)},this.measure=()=>{this.itemSizeCache=new Map,this.laneAssignments=new Map,this.notify(!1)},this.setOptions(t)}}const Or=(e,t,n,r)=>{for(;e<=t;){const o=(e+t)/2|0,s=n(o);if(s<r)e=o+1;else if(s>r)t=o-1;else return o}return e>0?e-1:0};function bi({measurements:e,outerSize:t,scrollOffset:n,lanes:r}){const o=e.length-1,s=c=>e[c].start;if(e.length<=r)return{startIndex:0,endIndex:o};let a=Or(0,o,s,n),i=a;if(r===1)for(;i<o&&e[i].end<n+t;)i++;else if(r>1){const c=Array(r).fill(0);for(;i<o&&c.some(g=>g<n+t);){const g=e[i];c[g.lane]=g.end,i++}const d=Array(r).fill(n+t);for(;a>=0&&d.some(g=>g>=n);){const g=e[a];d[g.lane]=g.start,a--}a=Math.max(0,a-a%r),i=Math.min(o,i+(r-1-i%r))}return{startIndex:a,endIndex:i}}const Kn=typeof document<"u"?vt.useLayoutEffect:vt.useEffect;function yi({useFlushSync:e=!0,...t}){const n=vt.useReducer(()=>({}),{})[1],r={...t,onChange:(s,a)=>{var i;e&&a?ze.flushSync(n):n(),(i=t.onChange)==null||i.call(t,s,a)}},[o]=vt.useState(()=>new xi(r));return o.setOptions(r),Kn(()=>o._didMount(),[]),Kn(()=>o._willUpdate()),o}function Si(e){return yi({observeElementRect:gi,observeElementOffset:pi,scrollToFn:vi,...e})}const Te="__actions__",he="__visibility__",wi="__serial_number__",ne=new li({tableId:"",sortColumn:null,sortDirection:null,visibility:{},columnOrder:[],columnWidths:{},data:[],sortableColumns:[],enableColumnVisibility:!0}),Rt=e=>`datatable:${e}:column-widths`;function _r(e,t,n=!0){const r=e[0]??{},o=180,a=(t&&t.length?t:Object.keys(r).map(p=>({id:p,label:p}))).filter(p=>p.id===Te||Object.prototype.hasOwnProperty.call(r,p.id)),{tableId:i}=ne.state,c=JSON.parse(localStorage.getItem(kr(i))||"[]");let d=[...c.map(p=>a.find(x=>x.id===p)).filter(Boolean),...a.filter(p=>!c.includes(p.id))];n?d.some(x=>x.id===he)||(d=[...d,{type:"visibility",id:he,label:"",minWidth:20}]):d=d.filter(p=>p.id!==he);const g=JSON.parse(localStorage.getItem(Zt(i))||"{}"),h={};if(n){for(const p of d)p.id===he||p.id===Te?h[p.id]=!0:h[p.id]=g[p.id]??!0;localStorage.setItem(Zt(i),JSON.stringify(h))}const v=JSON.parse(localStorage.getItem(Rt(i))||"{}"),m={...v};d.forEach(p=>{p.id!==he&&p.id!==Te&&!(p.id in v)&&(m[p.id]=typeof p.minWidth=="number"?p.minWidth:o)}),ne.setState(p=>({...p,data:e,columnOrder:d,visibility:h,columnWidths:m,enableColumnVisibility:n,sortableColumns:d.filter(x=>x.id!==he).map(x=>({id:x.id,label:x.label,sortable:x.id!==Te,minWidth:x.minWidth}))}))}function Ir(e){ne.setState(t=>({...t,tableId:e,sortColumn:null,sortDirection:"asc"}))}function Ci(e,t){ne.setState(n=>{const r=typeof n.columnOrder.find(s=>s.id===e)?.minWidth=="number"?n.columnOrder.find(s=>s.id===e)?.minWidth:50,o={...n.columnWidths,[e]:Math.max(r,t)};return localStorage.setItem(Rt(n.tableId),JSON.stringify(o)),{...n,columnWidths:o}})}const kr=e=>`table_column_order_v1:${e}`,Zt=e=>`table_column_visibility_v1:${e}`,Di=e=>{const{tableId:t}=ne.state;localStorage.setItem(kr(t),JSON.stringify(e.map(n=>n.id))),ne.setState(n=>({...n,columnOrder:e})),ne.setState(n=>({...n,columnOrder:e}))};function Ei(e){ne.setState(t=>{if(t.sortColumn===e){if(t.sortDirection==="asc")return{...t,sortDirection:"desc"};if(t.sortDirection==="desc")return{...t,sortColumn:null,sortDirection:null}}return{...t,sortColumn:e,sortDirection:"asc"}})}const Mi=e=>{ne.setState(t=>{const n={...t.visibility,[e]:!t.visibility[e]};return t.tableId&&localStorage.setItem(Zt(t.tableId),JSON.stringify(n)),{...t,visibility:n}})};function ji(e,t){ne.setState(n=>{const r=n.columnOrder.find(a=>a.id===e),o=typeof r?.minWidth=="number"?r.minWidth:120,s={...n.columnWidths,[e]:Math.max(o,t)};return localStorage.setItem(Rt(n.tableId),JSON.stringify(s)),{...n,columnWidths:s}})}const Ri=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Ti=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,r)=>r?r.toUpperCase():n.toLowerCase()),Xn=e=>{const t=Ti(e);return t.charAt(0).toUpperCase()+t.slice(1)},$r=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim(),Oi=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0};var _i={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 Ii=f.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:o="",children:s,iconNode:a,...i},c)=>f.createElement("svg",{ref:c,..._i,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:$r("lucide",o),...!s&&!Oi(i)&&{"aria-hidden":"true"},...i},[...a.map(([d,g])=>f.createElement(d,g)),...Array.isArray(s)?s:[s]]));const ae=(e,t)=>{const n=f.forwardRef(({className:r,...o},s)=>f.createElement(Ii,{ref:s,iconNode:t,className:$r(`lucide-${Ri(Xn(e))}`,`lucide-${e}`,r),...o}));return n.displayName=Xn(e),n};const ki=[["path",{d:"M8 3 4 7l4 4",key:"9rb6wj"}],["path",{d:"M4 7h16",key:"6tx8e3"}],["path",{d:"m16 21 4-4-4-4",key:"siv7j2"}],["path",{d:"M20 17H4",key:"h6l3hr"}]],$i=ae("arrow-left-right",ki);const Ai=[["path",{d:"m19 21-7-4-7 4V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v16z",key:"1fy3hk"}]],zi=ae("bookmark",Ai);const Li=[["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"}]],Ar=ae("calendar",Li);const Ni=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],Pi=ae("chevron-left",Ni);const Fi=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Wi=ae("chevron-right",Fi);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"}]],Vi=ae("delete",Bi);const Yi=[["path",{d:"M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z",key:"sc7q7i"}]],Hi=ae("funnel",Yi);const Ui=[["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"}]],zr=ae("grip-vertical",Ui);const Gi=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]],qi=ae("pen",Gi);const Ki=[["path",{d:"M21 12a9 9 0 0 0-9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"14sxne"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M3 12a9 9 0 0 0 9 9 9.75 9.75 0 0 0 6.74-2.74L21 16",key:"1hlbsb"}],["path",{d:"M16 16h5v5",key:"ccwih5"}]],Xi=ae("refresh-ccw",Ki);const Ji=[["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"}]],Zi=ae("settings",Ji);const Qi=[["rect",{width:"20",height:"6",x:"2",y:"4",rx:"2",key:"qdearl"}],["rect",{width:"20",height:"6",x:"2",y:"14",rx:"2",key:"1xrn6j"}]],ea=ae("stretch-horizontal",Qi);const ta=[["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"}]],Lr=ae("triangle-alert",ta);const na=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Nr=ae("x",na);function S(e){return f.forwardRef((t,n)=>{const{children:r,...o}=t;return l.jsx(e,{ref:n,...o,children:r})})}const ra=S(u.Menu.Trigger),oa=S(u.Menu.Positioner),sa=S(u.Menu.Content),ia=S(u.Menu.Item),aa=S(u.Checkbox.Label),la=S(u.Checkbox.HiddenInput),ca=S(u.Checkbox.Control);function ua({visibility:e}){const{sortableColumns:t}=Be(ne);return l.jsxs(u.Menu.Root,{closeOnSelect:!1,children:[l.jsx(ra,{asChild:!0,children:l.jsx(u.IconButton,{"aria-label":"Toggle columns",variant:"ghost",ml:"1",size:"xs",children:l.jsx(ea,{size:18})})}),l.jsx(u.Portal,{children:l.jsx(oa,{children:l.jsx(sa,{minW:"220px",children:t.map(n=>{const r=!!e[n.id];return l.jsx(ia,{value:n.id,closeOnSelect:!1,children:l.jsxs(u.Checkbox.Root,{checked:r,onCheckedChange:()=>Mi(n.id),children:[l.jsx(la,{}),l.jsx(ca,{}),l.jsx(aa,{children:n.label})]})},n.id)})})})})]})}function da({id:e,children:t,onClick:n,cursor:r,borderRight:o,backgroundColor:s,minW:a}){const{columnWidths:i}=Be(ne),h=`${i[e]??100}px`,v=f.useRef(0),m=f.useRef(0),{setNodeRef:p,attributes:x,listeners:y,transform:M,transition:R}=jr({id:e}),j=k=>{k.stopPropagation(),v.current=k.clientX;const L=k.currentTarget.closest("th");m.current=L?.getBoundingClientRect().width||i[e]||180;const A=W=>{let z=m.current+(W.clientX-v.current);ji(e,z)},V=()=>{document.removeEventListener("mousemove",A),document.removeEventListener("mouseup",V)};document.addEventListener("mousemove",A),document.addEventListener("mouseup",V)},[I,$]=f.useState(!1);return l.jsx(u.Table.ColumnHeader,{ref:p,onClick:n,backgroundColor:s,width:h,minWidth:a||"20px",style:{transform:Ne.Transform.toString(M),transition:R,cursor:r,borderRight:o,boxSizing:"border-box"},bg:"gray.100",...x,children:l.jsxs(u.HStack,{position:"relative",width:"100%",children:[l.jsx("span",{...y,children:l.jsx(zr,{size:12,style:{cursor:"grab"}})}),t,l.jsx(u.Box,{position:"absolute",right:0,top:0,h:"100%",w:"10px",cursor:"col-resize",onMouseDown:j,onMouseEnter:()=>$(!0),onMouseLeave:()=>$(!1),display:"flex",alignItems:"center",justifyContent:"center",zIndex:2,children:I&&l.jsx($i,{size:14,style:{pointerEvents:"none",opacity:.8}})})]})})}function fa(){const{columnOrder:e,visibility:t,enableColumnVisibility:n,sortColumn:r,sortDirection:o}=Be(ne),s=e.filter(a=>!n&&a.id===he?!1:a.id===he||a.id===Te?!0:t[a.id]!==!1).sort((a,i)=>a.id===he?1:i.id===he?-1:0);return l.jsx(u.Table.Header,{position:"sticky",top:0,zIndex:1,css:{contain:"layout style paint",backgroundColor:"white"},children:l.jsx(u.Table.Row,{height:"28px",children:s.map(a=>{if(a.id===he)return l.jsx(u.Table.ColumnHeader,{bg:"gray.100",w:100,children:l.jsx(ua,{visibility:t})},a.id);const i=a.type!=="actions"&&a.type!=="visibility",c=r===a.id;return l.jsx(da,{id:a.id,minW:a.minWidth,onClick:i?()=>Ei(a.id):void 0,cursor:i?"pointer":"default",borderRight:"2px solid #dcdcdc",children:l.jsxs("span",{style:{display:"flex",alignItems:"center",gap:6,userSelect:"none"},children:[a.label,i&&(c?o==="asc"?" ▲":" ▼":l.jsx("span",{style:{opacity:.4},children:" ⇅"}))]})},a.id)})})})}const ha=[10,20,50,100],ga=S(u.Select.Positioner),pa=S(u.Select.Content),ma=S(u.Select.Item),va=S(u.Pagination.PrevTrigger),xa=S(u.Pagination.NextTrigger),ba=S(u.Select.HiddenSelect),ya=S(u.Select.Control),Sa=S(u.Select.Trigger),wa=S(u.Select.ValueText),Ca=S(u.Select.IndicatorGroup),Da=S(u.Select.Indicator);function Ea({totalCount:e,pageSize:t,currentPage:n,onPageChange:r,onPageSizeChange:o,siblingCount:s=2,pageSizeOptions:a=ha}){const i=u.createListCollection({items:a.map(c=>({label:String(c),value:String(c)}))});return l.jsx(u.Box,{width:"100%",children:l.jsxs(u.HStack,{justify:"space-between",mx:"auto",flexWrap:"wrap",children:[l.jsxs(u.HStack,{children:[l.jsx(u.Text,{fontSize:"sm",color:"gray.600",_dark:{color:"gray.400"},children:"Rows per page:"}),l.jsxs(u.Select.Root,{collection:i,size:"sm",width:"60px",onValueChange:c=>o?.(Number(c.items[0].value)),value:[String(t)],children:[l.jsx(ba,{}),l.jsxs(ya,{children:[l.jsx(Sa,{children:l.jsx(wa,{placeholder:""})}),l.jsx(Ca,{children:l.jsx(Da,{})})]}),l.jsx(u.Portal,{children:l.jsx(ga,{children:l.jsx(pa,{children:i.items.map(c=>l.jsxs(ma,{item:c.value,children:[c.label,l.jsx(u.Select.ItemIndicator,{})]},c.value))})})})]}),l.jsxs(u.Text,{fontSize:"sm",color:"gray.600",_dark:{color:"gray.400"},children:["of ",e]})]}),l.jsx(u.Pagination.Root,{count:e,pageSize:t,page:n,siblingCount:s,onPageChange:c=>r&&r(c.page),children:l.jsxs(u.ButtonGroup,{size:"sm",variant:"ghost",children:[l.jsx(va,{asChild:!0,children:l.jsx(u.IconButton,{"aria-label":"Previous page",children:l.jsx(Pi,{size:18})})}),l.jsx(u.Pagination.Items,{render:c=>l.jsx(u.IconButton,{variant:c.type==="page"&&c.value===n?"outline":"ghost","aria-current":c.type==="page"&&c.value===n?"page":void 0,children:c.type==="page"?c.value:"…"},c.value??c.type)}),l.jsx(xa,{asChild:!0,children:l.jsx(u.IconButton,{"aria-label":"Next page",children:l.jsx(Wi,{size:18})})})]})})]})})}function Ma({row:e,columns:t,visibility:n,onRowSelect:r,onRowSelectEvent:o,index:s,height:a}){const{columnWidths:i}=Be(ne);return l.jsx(u.Table.Row,{"data-index":s,onClick:c=>o==="left"&&r?.(e,c),cursor:r?"pointer":"default",h:`${a}px`,_hover:{bg:"gray.50"},onContextMenu:o==="right"?c=>{c.preventDefault(),r?.(e,c)}:void 0,children:t.map(c=>c.id!==Te&&n[c.id]===!1?null:l.jsx(u.Table.Cell,{py:0,height:`${a}px`,width:`${i[c.id]??30}px`,minWidth:c.minWidth||"40px",maxWidth:`${i[c.id]??180}px`,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",children:"render"in c&&c.render?c.render(e):l.jsx("div",{children:String(e[c.id]??"")})},c.id))})}const ja=f.memo(Ma);function Ra({data:e,columns:t,rowVirtualizer:n,onRowSelect:r,onRowSelectEvent:o="left",rowHeight:s}){const{visibility:a}=Be(ne),i=n.getVirtualItems(),c=i.length>0?i[0].start:0,d=i.length>0?n.getTotalSize()-i[i.length-1].end:0;return l.jsxs(u.Table.Body,{children:[c>0&&l.jsx(u.Table.Row,{h:`${c}px`,children:l.jsx(u.Table.Cell,{colSpan:t.length,p:0,border:"none",h:`${c}px`})}),i.map(g=>{const h=e[g.index];return h?l.jsx(ja,{index:g.index,row:h,columns:t,visibility:a,onRowSelect:r,onRowSelectEvent:o,height:s},h.id):null}),d>0&&l.jsx(u.Table.Row,{h:`${d}px`,children:l.jsx(u.Table.Cell,{colSpan:t.length,p:0,border:"none",h:`${d}px`})})]})}function Ta({rows:e=6,columns:t}){return l.jsx(u.Table.Body,{children:Array.from({length:e}).map((n,r)=>l.jsx(u.Table.Row,{children:Array.from({length:t}).map((o,s)=>l.jsx(u.Table.Cell,{children:l.jsx(u.Skeleton,{height:"25px"})},s))},r))})}function Oa(e,t,n){if(!t||!n||t.type==="actions"||t.type==="visibility")return e;const r="sortAccessor"in t&&t.sortAccessor?t.sortAccessor:s=>s[t.id],o="sortComparator"in t&&t.sortComparator?t.sortComparator:(s,a,i)=>{const c=r(s),d=r(a);return c==null&&d==null?0:c==null?1:d==null?-1:typeof c=="number"&&typeof d=="number"?i==="asc"?c-d:d-c:c instanceof Date&&d instanceof Date?i==="asc"?c.getTime()-d.getTime():d.getTime()-c.getTime():i==="asc"?String(c).localeCompare(String(d)):String(d).localeCompare(String(c))};return[...e].sort((s,a)=>o(s,a,n))}function _a({tableId:e,data:t=[],headers:n=[],loading:r=!1,loadingChildren:o,skeletonLoading:s=!1,emptyMessage:a="No data",page:i=1,pageSize:c=10,onPageChange:d,onPageSizeChange:g,density:h="sm",totalCount:v=0,pageSizeOptions:m,onRowSelect:p,onRowSelectEvent:x="left",enableColumnVisibility:y=!0,dataType:M="pagination",manualPagination:R=!1}){const j=f.useRef(null);f.useEffect(()=>{Ir(e)},[e]),f.useEffect(()=>{_r(t,n,y)},[t,n,y]);const{sortColumn:I,sortDirection:$,data:k,columnOrder:L}=Be(ne),A=f.useMemo(()=>L.length?L:n,[L,n]),V=f.useMemo(()=>{if(!I||!$)return k;const O=A.find(N=>N.id===I);return Oa(k,O,$)},[k,I,$,A]),W=(Math.max(1,i)-1)*c,z=f.useMemo(()=>M==="infinite"||R||v>V.length||i>1&&V.length>0&&V.length<=c?V:V.slice(W,W+c),[V,W,c,M,i,v,R]),K=h==="sm"?45:h==="md"?56:64,T=Si({count:z.length,getScrollElement:()=>j.current,estimateSize:()=>K,overscan:25}),w=O=>{const{active:N,over:b}=O;if(!b||N.id===b.id)return;const _=A.findIndex(F=>F.id===N.id),P=A.findIndex(F=>F.id===b.id);Di(jt(A,_,P))},C=r&&!s,E=s&&!r,D=!r&&!s&&z.length===0;return l.jsx(Sr,{collisionDetection:ar,onDragEnd:w,children:l.jsx(Er,{items:A.map(O=>O.id),strategy:Fs,children:l.jsxs(u.Box,{flex:"1",minH:0,display:"flex",flexDirection:"column",p:2,children:[l.jsxs(u.Box,{ref:j,flex:"1",minH:0,position:"relative",overflowX:"auto",css:{"&::-webkit-scrollbar":{width:"8px",height:"8px"},willChange:"transform"},children:[C&&l.jsx(u.Box,{position:"absolute",inset:0,display:"flex",alignItems:"center",justifyContent:"center",zIndex:10,bg:"whiteAlpha.600",children:o??l.jsx(u.Spinner,{})}),l.jsxs(u.Table.Root,{variant:"outline",w:"max-content",minW:"100%",size:h,tableLayout:"fixed",css:{borderCollapse:"collapse","& th, & td":{boxSizing:"border-box"}},children:[l.jsx(fa,{}),E?l.jsx(Ta,{rows:c,columns:A.length}):D?l.jsx(u.Table.Body,{children:l.jsx(u.Table.Row,{children:l.jsx(u.Table.Cell,{colSpan:A.length,textAlign:"center",h:"200px",color:"gray.500",children:a})})}):l.jsx(Ra,{data:z,columns:A,rowVirtualizer:T,onRowSelect:p,onRowSelectEvent:x,rowHeight:K})]})]}),M==="pagination"&&l.jsx(u.Box,{mt:.5,children:l.jsx(Ea,{totalCount:v,pageSize:c,currentPage:i,onPageChange:O=>{j.current&&(j.current.scrollTop=0),d?.(O)},onPageSizeChange:O=>{g?.(O),i>1&&d?.(1)},pageSizeOptions:m})}),M==="infinite"&&l.jsxs(u.Box,{mt:2,px:2,fontSize:"sm",color:"gray.500",children:["Showing ",z.length," rows"]})]})})})}const te=[];for(let e=0;e<256;++e)te.push((e+256).toString(16).slice(1));function Ia(e,t=0){return(te[e[t+0]]+te[e[t+1]]+te[e[t+2]]+te[e[t+3]]+"-"+te[e[t+4]]+te[e[t+5]]+"-"+te[e[t+6]]+te[e[t+7]]+"-"+te[e[t+8]]+te[e[t+9]]+"-"+te[e[t+10]]+te[e[t+11]]+te[e[t+12]]+te[e[t+13]]+te[e[t+14]]+te[e[t+15]]).toLowerCase()}let Vt;const ka=new Uint8Array(16);function $a(){if(!Vt){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");Vt=crypto.getRandomValues.bind(crypto)}return Vt(ka)}const Aa=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Jn={randomUUID:Aa};function za(e,t,n){e=e||{};const r=e.random??e.rng?.()??$a();if(r.length<16)throw new Error("Random bytes length must be >= 16");return r[6]=r[6]&15|64,r[8]=r[8]&63|128,Ia(r)}function La(e,t,n){return Jn.randomUUID&&!e?Jn.randomUUID():za(e)}const Na=S(u.Checkbox.Root),Pa=S(u.Checkbox.HiddenInput),Fa=S(u.Checkbox.Control),Wa=S(u.Checkbox.Label),Pr=({value:e,onChange:t,size:n="sm",label:r,helperText:o,isDisabled:s,required:a,errorText:i})=>l.jsxs(Na,{value:e,onChange:t,size:n,children:[l.jsx(Pa,{}),l.jsx(Fa,{disabled:s,required:a,errorText:i,helperText:o}),r&&l.jsx(Wa,{children:r})]}),Ba=S(u.Combobox.Root),Va=S(u.Combobox.Input),Ya=S(u.Combobox.Trigger),Ha=S(u.Combobox.Control),Ua=S(u.Combobox.Content),Ga=S(u.Combobox.Positioner),qa=S(u.Combobox.Item),Ka=S(u.Combobox.ItemText);function Fr({label:e="Select Option",size:t="sm",width:n="200px",items:r=[],itemToString:o=v=>v?.label||"",itemToValue:s=v=>v?.value||"",renderItem:a=v=>v?.label||"",value:i,loading:c,placeholder:d="Search...",onSelect:g,visible:h=!0}){const[v,m]=f.useState(""),p=f.useMemo(()=>[{label:"Option 1",value:"1"},{label:"Option 2",value:"2"},{label:"Option 3",value:"3"}],[]),x=r&&r.length>0?r:p;f.useEffect(()=>{m(i?o(i):"")},[i,o]);const y=f.useMemo(()=>u.createListCollection({items:x,itemToString:o,itemToValue:s}),[x,o,s]);return h?l.jsx(u.Box,{minW:n,children:l.jsxs(Ba,{width:"100%",size:t,collection:y,inputValue:v,onInputValueChange:M=>m(M.inputValue),value:i?[s(i)]:[],onValueChange:M=>{const R=M.value[0],j=x.find(I=>s(I)===R);j&&g?.(j)},children:[e&&l.jsx(u.Text,{fontSize:"xs",fontWeight:"medium",mb:"1",color:"gray.600",children:e}),l.jsxs(Ha,{children:[l.jsx(Va,{placeholder:d,bg:"white",px:2}),l.jsx(Ya,{})]}),l.jsx(u.Portal,{children:l.jsx(Ga,{zIndex:"max",children:l.jsx(Ua,{bg:"white",boxShadow:"md",py:1,borderRadius:"md",minW:"200px",children:c?l.jsxs(u.HStack,{p:"3",justify:"center",children:[l.jsx(u.Spinner,{size:"xs"}),l.jsx(u.Text,{fontSize:"sm",children:"Loading..."})]}):x.length===0?l.jsx(u.Text,{p:"3",fontSize:"sm",color:"gray.500",children:"No results found"}):y.items.map(M=>l.jsx(qa,{item:M,px:2,py:1.5,_hover:{bg:"blue.50",cursor:"pointer"},children:l.jsx(Ka,{children:a(M)})},s(M)))})})})]})}):null}const Xa=S(u.Popover.Root),Ja=S(u.Popover.Content),Za=S(u.Popover.Arrow),Qa=S(u.Popover.Trigger),el=S(u.Popover.Positioner),je=e=>e?new Date(e.getFullYear(),e.getMonth(),e.getDate()):null;function Re(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 Zn(e){const t=e.split(/\s+to\s+/i),n=t[0],r=t[1],o=i=>{if(!i)return null;const c=i.trim().split("-");if(c.length!==3)return null;const[d,g,h]=c,v=parseInt(d),m=parseInt(g)-1,p=parseInt(h);if(isNaN(v)||isNaN(m)||isNaN(p)||h.length!==4)return null;const x=new Date(p,m,v);return x.getDate()===v&&x.getMonth()===m?x:null},s=o(n),a=o(r);return{start:s,end:a}}function Wr({startDate:e,endDate:t,onChange:n,width:r="100%",showLabel:o=!0,label:s="Select date range",visible:a=!0}){const[i,c]=f.useState(!1),[d,g]=f.useState(e||new Date),[h,v]=f.useState(null),[m,p]=f.useState(je(e)),[x,y]=f.useState(je(t)),M=(T,w)=>T&&w?`${Re(T)} to ${Re(w)}`:T?`${Re(T)}`:"",[R,j]=f.useState(M(je(e),je(t))),I=e?.getTime(),$=t?.getTime();f.useEffect(()=>{const T=je(e),w=je(t);p(T),y(w),j(M(T,w)),T&&g(new Date(T.getFullYear(),T.getMonth(),1))},[I,$]);const k=new Date(d.getFullYear(),d.getMonth()+1,0).getDate(),L=new Date(d.getFullYear(),d.getMonth(),1).getDay(),A=()=>g(new Date(d.getFullYear(),d.getMonth()-1,1)),V=()=>g(new Date(d.getFullYear(),d.getMonth()+1,1)),W=T=>{const w=new Date(d.getFullYear(),d.getMonth(),T);if(!m||m&&x){p(w),y(null),n(w,null),j(Re(w));return}if(m&&!x){const C=w<m?w:m,E=w<m?m:w;p(C),y(E),n(C,E),j(`${Re(C)} to ${Re(E)}`),c(!1)}},z=T=>{const w=T.target.value;j(w);const{start:C,end:E}=Zn(w);if(C&&E){const D=C<E?C:E,O=C<E?E:C;p(D),y(O),n(D,O),g(D)}else C&&!w.toLowerCase().includes("to")?(p(C),y(null),n(C,null)):w.trim()||(p(null),y(null),n(null,null))},q=T=>{if(T.key!=="Enter")return;const{start:w,end:C}=Zn(R);if(w&&!C&&!R.toLowerCase().includes("to")){const E=`${Re(w)} to `;j(E),p(w),y(null),n(w,null),requestAnimationFrame(()=>{T.target.setSelectionRange(E.length,E.length)});return}if(w&&C){const E=w<C?w:C,D=w<C?C:w;p(E),y(D),n(E,D),c(!1)}},K=T=>{T&&(T.preventDefault(),T.stopPropagation()),p(null),y(null),j(""),n(null,null)};return l.jsxs(u.Box,{width:r,onKeyDown:q,children:[o&&!a&&l.jsx(u.Text,{fontSize:"xs",color:"fg.muted",mb:1,fontWeight:"medium",children:s}),l.jsxs(Xa,{open:i,onOpenChange:T=>c(T.open),positioning:{placement:"bottom-start",gutter:4},children:[l.jsxs(u.Group,{attached:!0,w:"full",position:"relative",children:[l.jsx(u.Input,{placeholder:"DD-MM-YYYY to DD-MM-YYYY",value:R,onChange:z,size:"sm",autoComplete:"off"}),R&&l.jsx(u.IconButton,{size:"xs",variant:"ghost","aria-label":"Clear date",type:"button",onClick:K,position:"absolute",right:"32px",top:"50%",transform:"translateY(-50%)",zIndex:2,children:l.jsx(Nr,{size:14})}),l.jsx(Qa,{asChild:!0,children:l.jsx(u.InputAddon,{cursor:"pointer",px:2,_hover:{bg:"gray.100"},transition:"background 0.2s",children:l.jsx(Ar,{size:16})})})]}),l.jsx(el,{children:l.jsxs(Ja,{width:"300px",p:4,boxShadow:"xl",zIndex:1e3,borderRadius:"md",outline:"none",children:[l.jsx(Za,{}),l.jsxs(u.HStack,{justify:"space-between",mb:4,children:[l.jsx(u.IconButton,{size:"xs",variant:"ghost",type:"button",onClick:A,"aria-label":"Previous month",children:"‹"}),l.jsx(u.Text,{fontWeight:"bold",fontSize:"sm",children:d.toLocaleString("default",{month:"long",year:"numeric"})}),l.jsx(u.IconButton,{size:"xs",variant:"ghost",type:"button",onClick:V,"aria-label":"Next month",children:"›"})]}),l.jsxs(u.Grid,{templateColumns:"repeat(7, 1fr)",gap:1,textAlign:"center",children:[["S","M","T","W","T","F","S"].map((T,w)=>l.jsx(u.Text,{fontSize:"xs",fontWeight:"bold",color:"fg.subtle",py:1,children:T},`${T}-${w}`)),Array(L).fill(null).map((T,w)=>l.jsx(u.Box,{},`empty-${w}`)),Array.from({length:k},(T,w)=>{const C=w+1,E=new Date(d.getFullYear(),d.getMonth(),C);let D=m,O=x;const N=je(h);if(N){if(D&&!O)N<D?(O=D,D=N):O=N;else if(D&&O){const Y=D.getTime()+(O.getTime()-D.getTime())/2;N.getTime()<=Y?D=N:O=N,D>O&&([D,O]=[O,D])}}const b=D&&E.getTime()===D.getTime(),_=O&&E.getTime()===O.getTime(),P=D&&O&&E>D&&E<O;let F="gray",G="ghost";(b||_)&&(G="solid",F="blue");let U="md";return P&&(U="0"),b&&O&&(U=_?"md":"md 0 0 md"),_&&D&&(U=b?"md":"0 md md 0"),l.jsx(u.Button,{size:"xs",variant:G,colorPalette:F,onClick:()=>W(C),onMouseEnter:()=>v(E),onMouseLeave:()=>v(null),minW:"32px",h:"32px",fontSize:"xs",borderRadius:U,_hover:{bg:b||_?void 0:"gray.100"},children:C},C)})]}),l.jsx(u.Text,{fontSize:"10px",color:"fg.muted",mt:3,textAlign:"center",children:"Select Start Date then End Date"})]})})]})]})}const tl=S(u.Popover.Root),nl=S(u.Popover.Content),rl=S(u.Popover.Arrow),ol=S(u.Popover.Trigger),sl=S(u.Popover.Positioner);function Qn(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 il(e){const t=e.split("-");if(t.length!==3)return null;const[n,r,o]=t,s=parseInt(n),a=parseInt(r)-1,i=parseInt(o);if(isNaN(s)||isNaN(a)||isNaN(i)||o.length!==4)return null;const c=new Date(i,a,s);return c.getDate()===s&&c.getMonth()===a?c:null}function Br({value:e,onChange:t,width:n="220px",visible:r=!0,label:o="Select date"}){const[s,a]=f.useState(!1),[i,c]=f.useState(e||new Date),[d,g]=f.useState(Qn(e));f.useEffect(()=>{g(Qn(e))},[e]);const h=new Date(i.getFullYear(),i.getMonth()+1,0).getDate(),v=new Date(i.getFullYear(),i.getMonth(),1).getDay(),m=()=>{c(new Date(i.getFullYear(),i.getMonth()-1,1))},p=()=>{c(new Date(i.getFullYear(),i.getMonth()+1,1))},x=R=>{const j=new Date(i.getFullYear(),i.getMonth(),R);t(j),a(!1)},y=R=>{if(s)switch(R.key){case"ArrowLeft":m();break;case"ArrowRight":p();break;case"Escape":a(!1);break}},M=()=>{g(""),t(null)};return l.jsxs(u.Box,{width:n,onKeyDown:y,children:[!r&&l.jsx(u.Text,{fontSize:"xs",color:"fg.muted",mb:1,fontWeight:"medium",children:o}),l.jsxs(tl,{open:s,onOpenChange:R=>a(R.open),positioning:{placement:"bottom-start",gutter:4},children:[l.jsxs(u.Group,{attached:!0,w:"full",position:"relative",children:[d&&l.jsx(u.IconButton,{size:"xs",variant:"ghost","aria-label":"Clear date",onClick:M,position:"absolute",right:"32px",top:"50%",transform:"translateY(-50%)",zIndex:1,children:l.jsx(Nr,{size:14})}),l.jsx(u.Input,{placeholder:"DD-MM-YYYY",value:d,onChange:R=>{const j=R.target.value;g(j);const I=il(j);I&&(t(I),c(I))},size:"sm",autoComplete:"off"}),l.jsx(ol,{asChild:!0,children:l.jsx(u.InputAddon,{cursor:"pointer",px:2,_hover:{bg:"gray.100"},transition:"background 0.2s",children:l.jsx(Ar,{size:16})})})]}),l.jsx(sl,{children:l.jsxs(nl,{width:"300px",p:4,boxShadow:"xl",zIndex:1e3,borderRadius:"md",outline:"none",children:[l.jsx(rl,{}),l.jsxs(u.HStack,{justify:"space-between",mb:4,children:[l.jsx(u.IconButton,{size:"xs",variant:"ghost",onClick:m,"aria-label":"Previous month",children:"‹"}),l.jsx(u.Text,{fontWeight:"bold",fontSize:"sm",children:i.toLocaleString("default",{month:"long",year:"numeric"})}),l.jsx(u.IconButton,{size:"xs",variant:"ghost",onClick:p,"aria-label":"Next month",children:"›"})]}),l.jsxs(u.Grid,{templateColumns:"repeat(7, 1fr)",gap:1,textAlign:"center",children:[["S","M","T","W","T","F","S"].map((R,j)=>l.jsx(u.Text,{fontSize:"xs",fontWeight:"bold",color:"fg.subtle",py:1,children:R},`${R}-${j}`)),Array(v).fill(null).map((R,j)=>l.jsx(u.Box,{},`empty-${j}`)),Array.from({length:h},(R,j)=>{const I=j+1,$=e&&e.getDate()===I&&e.getMonth()===i.getMonth()&&e.getFullYear()===i.getFullYear();return l.jsx(u.Button,{size:"xs",variant:$?"solid":"ghost",colorPalette:$?"blue":"gray",onClick:()=>x(I),minW:"32px",h:"32px",fontSize:"xs",borderRadius:"md",children:I},I)})]}),l.jsx(u.Text,{fontSize:"10px",color:"fg.muted",mt:3,textAlign:"center",children:"Use Arrow Keys to change months • Esc to close"})]})})]})]})}const al=S(u.Field.Root),ll=S(u.Field.Label),cl=S(u.Field.HelperText),ul=S(u.Field.ErrorText),Qt=({icon:e,value:t,onChange:n,placeholder:r,size:o="xs",variant:s="outline",width:a="100%",label:i,helperText:c,isDisabled:d=!1,required:g=!1,errorText:h,visible:v,type:m="text",min:p=0,max:x=100,step:y=1})=>l.jsxs(al,{width:a,children:[v&&l.jsx(ll,{children:i}),l.jsx(u.InputGroup,{startElement:e,children:l.jsx(u.Input,{value:t,onChange:M=>n?.(M.target.value),placeholder:r,size:o,type:m,variant:s,disabled:d,required:g,min:p,max:x,step:y})}),h&&l.jsx(ul,{fontSize:"xs",children:h}),c&&l.jsx(cl,{fontSize:"xs",children:c})]}),dl=S(u.Field.Root),fl=S(u.Field.HelperText),hl=S(u.Field.ErrorText),gl=S(u.Select.Root),pl=S(u.Select.Label),ml=S(u.Select.Control),vl=S(u.Select.Trigger),xl=S(u.Select.ValueText),bl=S(u.Select.IndicatorGroup),yl=S(u.Select.Indicator),Sl=S(u.Select.Content),wl=S(u.Select.Item),Cl=S(u.Select.ItemIndicator),Dl=S(u.Select.HiddenSelect),El=S(u.Select.Positioner),Vr=({options:e=[],label:t,value:n,onChange:r,placeholder:o,size:s="xs",width:a="100%",variant:i="outline",helperText:c,isDisabled:d,required:g,errorText:h,visible:v})=>{const m=f.useMemo(()=>u.createListCollection({items:e}),[e]),p=e.find(y=>y.value===n),x=y=>{y.preventDefault(),y.stopPropagation(),r?.(void 0)};return l.jsxs(dl,{disabled:d,required:g,children:[l.jsxs(gl,{collection:m,variant:i,size:s,width:a,value:n?[n]:[],onValueChange:y=>{r?.(y.value[0])},children:[l.jsx(Dl,{}),v&&l.jsx(pl,{children:t}),l.jsxs(ml,{children:[l.jsx(vl,{children:l.jsx(xl,{placeholder:o,children:p?.displayValue??p?.label})}),l.jsxs(bl,{children:[n&&!d&&l.jsx("div",{style:{pointerEvents:"auto",display:"flex",alignItems:"center"},onPointerDown:y=>y.stopPropagation(),onClick:y=>y.stopPropagation(),children:l.jsx(u.CloseButton,{size:"sm",variant:"ghost",onPointerDown:x,onClick:x,position:"relative",zIndex:10})}),l.jsx(yl,{})]})]}),l.jsx(El,{children:l.jsx(Sl,{children:m.items.map((y,M)=>l.jsxs(wl,{item:y,children:[y.label,l.jsx(Cl,{})]},M))})})]}),c&&l.jsx(fl,{children:c}),h&&l.jsx(hl,{children:h})]})},Ml="FILTER_PRESETS_",Yr=e=>`${Ml}${e}`,Tt=e=>{if(typeof window>"u")return[];const t=localStorage.getItem(Yr(e));try{return t?JSON.parse(t):[]}catch(n){return console.error("Failed to parse presets",n),[]}},fn=(e,t)=>{typeof window>"u"||(localStorage.setItem(Yr(e),JSON.stringify(t)),window.dispatchEvent(new Event("storage_updated")))},Hr=(e,t)=>{const n=Tt(e);fn(e,[t,...n])},Ur=(e,t)=>{const n=Tt(e).filter(r=>r.id!==t);fn(e,n)},jl=S(u.Checkbox.Root),Rl=S(u.Checkbox.HiddenInput),Tl=S(u.Checkbox.Control),Ol=S(u.Slider.Root),_l=S(u.Slider.Track),Il=S(u.Slider.Range),kl=S(u.Slider.Thumbs),$l=S(u.Slider.Control),Al=({filter:e,onVisibilityChange:t,onSizeChange:n})=>{const{attributes:r,listeners:o,setNodeRef:s,transform:a,transition:i}=jr({id:e.id}),c={transform:Ne.Transform.toString(a),transition:i};return l.jsxs(u.VStack,{ref:s,style:c,align:"stretch",border:"1px solid",borderColor:"gray.200",rounded:"md",p:3,mb:3,bg:"white",children:[l.jsxs(u.HStack,{...r,...o,cursor:"grab",userSelect:"none",gap:2,children:[l.jsx(zr,{size:16}),l.jsx(u.Text,{fontWeight:"bold",fontSize:"sm",children:e.label||e.id})]}),l.jsxs(u.HStack,{justify:"space-between",children:[l.jsx(u.Text,{fontSize:"sm",children:"Visible"}),l.jsxs(jl,{checked:e.visible,size:"sm",onCheckedChange:d=>t?.(e.id,!!d.checked),children:[l.jsx(Rl,{}),l.jsx(Tl,{})]})]}),l.jsxs(u.VStack,{align:"stretch",gap:1,children:[l.jsx(u.Text,{fontSize:"sm",children:"Size"}),l.jsx(Ol,{min:1,max:5,step:.5,value:[e.size??1],onValueChange:d=>n?.(e.id,d.value[0]),children:l.jsxs($l,{children:[l.jsx(_l,{children:l.jsx(Il,{})}),l.jsx(kl,{})]})})]})]})},zl=S(u.Drawer.Root),Ll=S(u.Drawer.Trigger),Nl=S(u.Drawer.Backdrop),Pl=S(u.Drawer.Positioner),Fl=S(u.Drawer.Content),Wl=S(u.Drawer.Header),Bl=S(u.Drawer.Title),Vl=S(u.Drawer.Body),Yl=S(u.Drawer.Footer),Hl=S(u.Drawer.CloseTrigger),Ul=S(u.Tabs.Root),Gl=S(u.Tabs.List),Yt=S(u.Tabs.Trigger),Ht=S(u.Tabs.Content),Gr=(e,t)=>{if(e.customComponent)return e.customComponent;switch(e.type){case"text":return l.jsx(Qt,{placeholder:e.label,value:e.value,onChange:e.onChange,label:e.label,visible:t});case"number":return l.jsx(Qt,{label:e.label,value:e.value,onChange:e.onChange});case"checkbox":return l.jsx(Pr,{label:e.label,value:e.value,onChange:e.onChange});case"select":return l.jsx(Vr,{label:e.label,value:e.value,onChange:e.onChange,options:e.options??[],visible:t,placeholder:e.placeholder});case"date":return l.jsx(Br,{value:e.value,onChange:e.onChange,visible:t,label:e.label});case"date-range":const n=e.value,r=n?.startDate||e.startDate,o=n?.endDate||e.endDate;return l.jsx(Wr,{startDate:r?new Date(r):void 0,endDate:o?new Date(o):void 0,onChange:(s,a)=>{e.onChange&&e.onChange({startDate:s,endDate:a})},visible:t,label:e.label});case"combobox":return l.jsx(Fr,{label:e.label,value:e.value,items:e.options||[],itemToString:s=>s?.label||"",itemToValue:s=>s?.value||"",onSelect:s=>{e.onChange?.(s)},renderItem:s=>l.jsx(u.Text,{fontSize:"sm",children:s.label}),placeholder:e.placeholder||"Search...",visible:t});default:return null}},ql=({filterDrawerSize:e="sm",onVisibilityChange:t,onSizeChange:n,onClear:r,filters:o,pageKey:s="default",onLoadPreset:a,activePresetName:i,onReorder:c,open:d,onOpenChange:g})=>{const[h,v]=f.useState([]);f.useEffect(()=>{const p=()=>{v(Tt(s))};return p(),window.addEventListener("storage",p),window.addEventListener("storage_updated",p),()=>{window.removeEventListener("storage",p),window.removeEventListener("storage_updated",p)}},[s]);const m=()=>{const p=prompt("Preset name?");if(!p)return;const x=o.reduce((y,M)=>(y[M.id]=M.value,y),{});Hr(s,{id:La(),name:p,date:new Date().toISOString(),values:x})};return l.jsx(u.HStack,{wrap:"wrap",children:l.jsxs(zl,{size:e,open:d,onOpenChange:g,children:[l.jsx(Ll,{asChild:!0,children:l.jsxs(u.IconButton,{"aria-label":"Open filters",variant:"outline",size:"xs",ml:2,p:2,children:[l.jsx(Hi,{size:16}),"Filters"]})}),l.jsxs(u.Portal,{children:[l.jsx(Nl,{}),l.jsx(Pl,{children:l.jsxs(Fl,{children:[l.jsx(Wl,{children:l.jsx(Bl,{children:"Filters"})}),l.jsx(Vl,{overflowY:"auto",pt:1,children:l.jsxs(Ul,{defaultValue:"view",children:[l.jsxs(Gl,{mb:4,children:[l.jsxs(Yt,{value:"view",children:[l.jsx(qi,{size:16}),"Edit"]}),l.jsxs(Yt,{value:"settings",children:[l.jsx(Zi,{size:16}),"Settings"]}),l.jsxs(Yt,{value:"presets",children:[l.jsx(zi,{size:16}),"Presets"]})]}),l.jsx(Ht,{value:"view",children:o.map(p=>l.jsx(u.VStack,{align:"stretch",border:"1px solid",borderColor:"gray.200",flex:p.size??1,minW:`${(p.size??1)*100}px`,rounded:"md",p:3,mb:3,children:Gr(p,d)},p.id))}),l.jsx(Ht,{value:"settings",children:l.jsx(Sr,{sensors:jo(Mo(dn)),collisionDetection:ar,onDragEnd:({active:p,over:x})=>{if(!x||p.id===x.id)return;const y=o.findIndex(j=>j.id===p.id),M=o.findIndex(j=>j.id===x.id),R=jt(o,y,M);c?.(R)},children:l.jsx(Er,{items:o.map(p=>p.id),strategy:Bs,children:o.map(p=>l.jsx(Al,{filter:p,onVisibilityChange:t,onSizeChange:n},p.id))})})}),l.jsx(Ht,{value:"presets",children:l.jsxs(u.VStack,{align:"stretch",mb:3,children:[h.length===0&&l.jsx(u.Text,{fontSize:"xs",color:"gray.500",children:"No presets saved yet."}),h.map(p=>l.jsxs(u.HStack,{justify:"space-between",border:"1px solid",borderColor:i===p.name?"blue.300":"gray.200",rounded:"md",p:2,children:[l.jsxs(u.VStack,{align:"start",gap:0,children:[l.jsx(u.Text,{fontWeight:"bold",fontSize:"sm",children:p.name}),l.jsx(u.Text,{fontSize:"xs",color:"gray.500",children:new Date(p.date).toLocaleDateString()})]}),l.jsxs(u.HStack,{children:[l.jsx(u.Button,{size:"xs",variant:"ghost",onClick:()=>{const x=o.map(y=>({...y,value:p.values[y.id]??y.value}));a?.(x,p.name)},children:"Load"}),l.jsx(u.IconButton,{size:"xs","aria-label":"Delete preset",variant:"ghost",onClick:()=>Ur(s,p.id),children:l.jsx(Vi,{size:14})})]})]},p.id)),l.jsx(u.Button,{size:"sm",colorScheme:"blue",onClick:m,children:"Save Current Filters"})]})})]})}),l.jsx(Yl,{justify:"space-between",children:l.jsx(Hl,{asChild:!0,children:l.jsx(u.CloseButton,{})})})]})})]})]})})},Kl=({title:e,filters:t,onVisibilityChange:n,onReorder:r,onSizeChange:o,onClear:s,maxToolbarUnits:a,pageKey:i,onLoadPreset:c,activePresetName:d,filterDrawerSize:g="sm"})=>{const[h,v]=f.useState(!1);return l.jsxs(u.HStack,{wrap:"wrap",pl:2,pr:2,width:"100%",justify:"space-between",children:[e,l.jsxs(u.HStack,{gapX:1,children:[t.filter(m=>m.visible!==!1).map(m=>l.jsx(u.HStack,{minW:`${(m.size??1)*100}px`,alignItems:"center",children:Gr(m)},m.id)),l.jsx(ql,{filterDrawerSize:g,onVisibilityChange:n,onReorder:r,onSizeChange:o,onClear:s,maxToolbarUnits:a,pageKey:i,filters:t,onLoadPreset:c,activePresetName:d,open:h,onOpenChange:m=>{v(m.open)}})]})]})},Xl=(e,t)=>{localStorage.setItem(`FILTER_ORDER_${e}`,JSON.stringify(t))},Jl=e=>{try{return JSON.parse(localStorage.getItem(`FILTER_ORDER_${e}`)||"[]")}catch{return[]}},Zl=({onClick:e,size:t="xs",variant:n="solid",label:r,leftIcon:o,rightIcon:s,isDisabled:a,colorScheme:i,loading:c,loadingText:d,rounded:g,type:h="button",textColor:v="white",borderColor:m})=>l.jsx(u.Button,{onClick:e,size:t,variant:n,disabled:a,loading:c,loadingText:d,rounded:g,type:h,background:i,color:v,border:m,children:l.jsxs(u.HStack,{gap:1,children:[o,r,s]})}),Ql=S(u.Dialog.Root),ec=S(u.Dialog.Backdrop),tc=S(u.Dialog.Positioner),nc=S(u.Dialog.Content),rc=S(u.Dialog.Header),oc=S(u.Dialog.Body),sc=S(u.Dialog.Footer),ic=S(u.Dialog.Title),ac=S(u.Dialog.CloseTrigger);function lc({open:e,onClose:t,onConfirm:n,title:r="Confirm Action",description:o="Are you sure you want to continue?",confirmLabel:s="Confirm",cancelLabel:a="Cancel",icon:i,isLoading:c=!1,confirmButtonColorScheme:d="#4169e1"}){return l.jsx(Ql,{open:e,placement:"center",onOpenChange:g=>!g.open&&t(),children:l.jsxs(u.Portal,{children:[l.jsx(ec,{}),l.jsx(tc,{children:l.jsxs(nc,{maxW:"480px",children:[l.jsx(rc,{borderBottom:"1px solid",borderColor:"gray.200",children:l.jsx(ic,{children:r})}),l.jsx(oc,{p:6,children:l.jsxs(u.Stack,{gap:4,align:"center",textAlign:"center",children:[l.jsx(u.Box,{color:"orange.500",children:i??l.jsx(Lr,{size:40})}),l.jsx(u.Text,{fontSize:"sm",color:"gray.600",children:o})]})}),l.jsxs(sc,{justifyContent:"flex-end",gap:2,borderTop:"1px solid",borderColor:"gray.200",children:[l.jsx(u.Button,{variant:"outline",size:"sm",onClick:t,children:a}),l.jsx(u.Button,{size:"sm",style:{backgroundColor:d},loading:c,onClick:n,children:s})]}),l.jsx(ac,{asChild:!0,children:l.jsx(u.CloseButton,{size:"sm"})})]})})]})})}const cc=S(u.Dialog.Root),uc=S(u.Dialog.Backdrop),dc=S(u.Dialog.Positioner),fc=S(u.Dialog.Content),hc=S(u.Dialog.Header),gc=S(u.Dialog.Body),pc=S(u.Dialog.Footer),mc=S(u.Dialog.Title),vc=S(u.Dialog.CloseTrigger);function xc({open:e,onClose:t,onConfirm:n,title:r="Delete Company",entityName:o,confirmText:s="DELETE",confirmLabel:a="Delete",isLoading:i=!1}){const[c,d]=f.useState(""),g=c===s;return l.jsx(cc,{open:e,placement:"center",onOpenChange:h=>{!h.open&&t(),d("")},children:l.jsxs(u.Portal,{children:[l.jsx(uc,{}),l.jsx(dc,{children:l.jsxs(fc,{maxW:"550px",children:[l.jsx(hc,{borderBottom:"1px solid",borderColor:"#d3d3d3",children:l.jsx(mc,{color:"red.600",children:r})}),l.jsx(gc,{p:2,style:{padding:"16px"},children:l.jsxs(u.Stack,{gap:4,borderRadius:"md",p:4,bg:"white",children:[l.jsx(u.Box,{border:"1px solid",borderColor:"red.200",bg:"red.50",borderRadius:"md",p:4,children:l.jsxs(u.Stack,{direction:"row",gap:3,align:"flex-start",children:[l.jsx(u.Box,{color:"red.600",mt:"2px",children:l.jsx(Lr,{size:20})}),l.jsxs(u.Box,{children:[l.jsx(u.Text,{fontWeight:"semibold",color:"red.700",children:"Are you sure?"}),l.jsxs(u.Text,{fontSize:"sm",color:"red.600",children:["All the data of ",l.jsx("b",{children:o})," will permanently be deleted."]})]})]})}),l.jsx(u.Text,{fontSize:"sm",color:"gray.600",children:"You can’t undo this action afterwards."}),l.jsxs(u.Box,{children:[l.jsxs(u.Text,{fontSize:"sm",mb:2,children:["Type ",l.jsx("b",{children:s})," to continue"]}),l.jsx(u.Input,{placeholder:`Type ${s} here`,value:c,onChange:h=>d(h.target.value),size:"xs"})]})]})}),l.jsxs(pc,{justifyContent:"flex-end",gap:2,borderTop:"1px solid",borderColor:"#d3d3d3",children:[l.jsx(u.Button,{variant:"outline",size:"sm",onClick:()=>{t(),d("")},children:"Cancel"}),l.jsx(u.Button,{size:"sm",disabled:!g,style:{backgroundColor:"#FF0000"},loading:i,onClick:n,children:a})]}),l.jsx(vc,{asChild:!0,children:l.jsx(u.CloseButton,{size:"sm"})})]})})]})})}const qr=({children:e})=>l.jsx(l.Fragment,{children:e}),Kr=({children:e})=>l.jsx(l.Fragment,{children:e}),bc=u.Button,yc=S(u.Dialog.Root),Sc=S(u.Dialog.Backdrop),wc=S(u.Dialog.Positioner),Cc=S(u.Dialog.Content),Dc=S(u.Dialog.Header),Ec=S(u.Dialog.Body),Mc=S(u.Dialog.Footer),jc=S(u.Dialog.Title),Rc=S(u.Dialog.CloseTrigger);function Tc(e){let t=null,n=null;return f.Children.forEach(e,r=>{f.isValidElement(r)&&(r.type===qr&&(t=r.props.children),r.type===Kr&&(n=r.props.children))}),{body:t,actions:n}}const Oc=({open:e,onClose:t,title:n,children:r,width:o,position:s,refetch:a,loading:i=!1})=>{const{body:c,actions:d}=Tc(r);return l.jsx(yc,{open:e,onOpenChange:g=>!g.open&&t(),placement:s??"center",children:l.jsxs(u.Portal,{children:[l.jsx(Sc,{bg:"blackAlpha.400"}),l.jsx(wc,{children:l.jsxs(Cc,{w:o??"560px",maxW:o??"560px",borderRadius:"6px",overflow:"hidden",boxShadow:"lg",children:[l.jsx(Dc,{px:"20px",py:"16px",bg:"white",borderBottom:"1px solid",borderColor:"gray.200",children:l.jsxs(u.Flex,{align:"center",justify:"space-between",children:[l.jsx(jc,{fontSize:"16px",fontWeight:"600",children:n}),l.jsx(Rc,{asChild:!0,children:l.jsx(u.CloseButton,{size:"sm"})}),a&&l.jsx(hn,{label:"Refresh",refetch:a,isLoading:i})]})}),c&&l.jsx(Ec,{px:"20px",py:"16px",bg:"#F8FAFC",type:"submit",children:l.jsx(u.Flex,{direction:"column",gap:"16px",children:c})}),d&&l.jsx(Mc,{px:"20px",py:"16px",bg:"white",borderTop:"1px solid",borderColor:"gray.200",children:l.jsx(u.Flex,{ml:"auto",gap:"12px",children:d})})]})})]})})},_c=S(u.Field.Root),Ic=S(u.Field.Label),kc=S(u.Field.HelperText),$c=S(u.Field.ErrorText),Ac=S(u.PinInput.Input),zc=S(u.PinInput.Control),Lc=S(u.PinInput.HiddenInput),Nc=S(u.PinInput.Root),Pc=({value:e,onChange:t,length:n=4,size:r="xs",isDisabled:o=!1,label:s,helperText:a,errorText:i,required:c=!1,visible:d=!0})=>{const g=Array.from({length:n}).map((h,v)=>e?.[v]??"");return l.jsxs(_c,{children:[d&&s&&l.jsxs(Ic,{children:[s,c&&" *"]}),l.jsxs(Nc,{value:g,onValueChange:h=>t?.(h.value.join("")),disabled:o,size:r,children:[l.jsx(Lc,{}),l.jsx(zc,{children:l.jsx(u.HStack,{children:Array.from({length:n}).map((h,v)=>l.jsx(Ac,{index:v},v))})})]}),i&&l.jsx($c,{fontSize:"xs",children:i}),a&&!i&&l.jsx(kc,{fontSize:"xs",children:a})]})};function hn({refetch:e,isLoading:t=!1,label:n="Refresh"}){const[r,o]=f.useState(!1),s=async()=>{o(!0);try{await e()}finally{setTimeout(()=>o(!1),300)}};return l.jsx(u.IconButton,{"aria-label":n,size:"xs",variant:"outline",disabled:t||r,onClick:s,ml:2,children:l.jsx(Xi,{size:14,style:{animation:r?"spin 0.6s linear infinite":void 0}})})}var ht={exports:{}},Fc=ht.exports,er;function Wc(){return er||(er=1,(function(e,t){(function(n,r){e.exports=r()})(Fc,(function(){var n=1e3,r=6e4,o=36e5,s="millisecond",a="second",i="minute",c="hour",d="day",g="week",h="month",v="quarter",m="year",p="date",x="Invalid Date",y=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,M=/\[([^\]]+)]|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(T){var w=["th","st","nd","rd"],C=T%100;return"["+T+(w[(C-20)%10]||w[C]||w[0])+"]"}},j=function(T,w,C){var E=String(T);return!E||E.length>=w?T:""+Array(w+1-E.length).join(C)+T},I={s:j,z:function(T){var w=-T.utcOffset(),C=Math.abs(w),E=Math.floor(C/60),D=C%60;return(w<=0?"+":"-")+j(E,2,"0")+":"+j(D,2,"0")},m:function T(w,C){if(w.date()<C.date())return-T(C,w);var E=12*(C.year()-w.year())+(C.month()-w.month()),D=w.clone().add(E,h),O=C-D<0,N=w.clone().add(E+(O?-1:1),h);return+(-(E+(C-D)/(O?D-N:N-D))||0)},a:function(T){return T<0?Math.ceil(T)||0:Math.floor(T)},p:function(T){return{M:h,y:m,w:g,d,D:p,h:c,m:i,s:a,ms:s,Q:v}[T]||String(T||"").toLowerCase().replace(/s$/,"")},u:function(T){return T===void 0}},$="en",k={};k[$]=R;var L="$isDayjsObject",A=function(T){return T instanceof q||!(!T||!T[L])},V=function T(w,C,E){var D;if(!w)return $;if(typeof w=="string"){var O=w.toLowerCase();k[O]&&(D=O),C&&(k[O]=C,D=O);var N=w.split("-");if(!D&&N.length>1)return T(N[0])}else{var b=w.name;k[b]=w,D=b}return!E&&D&&($=D),D||!E&&$},W=function(T,w){if(A(T))return T.clone();var C=typeof w=="object"?w:{};return C.date=T,C.args=arguments,new q(C)},z=I;z.l=V,z.i=A,z.w=function(T,w){return W(T,{locale:w.$L,utc:w.$u,x:w.$x,$offset:w.$offset})};var q=(function(){function T(C){this.$L=V(C.locale,null,!0),this.parse(C),this.$x=this.$x||C.x||{},this[L]=!0}var w=T.prototype;return w.parse=function(C){this.$d=(function(E){var D=E.date,O=E.utc;if(D===null)return new Date(NaN);if(z.u(D))return new Date;if(D instanceof Date)return new Date(D);if(typeof D=="string"&&!/Z$/i.test(D)){var N=D.match(y);if(N){var b=N[2]-1||0,_=(N[7]||"0").substring(0,3);return O?new Date(Date.UTC(N[1],b,N[3]||1,N[4]||0,N[5]||0,N[6]||0,_)):new Date(N[1],b,N[3]||1,N[4]||0,N[5]||0,N[6]||0,_)}}return new Date(D)})(C),this.init()},w.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()},w.$utils=function(){return z},w.isValid=function(){return this.$d.toString()!==x},w.isSame=function(C,E){var D=W(C);return this.startOf(E)<=D&&D<=this.endOf(E)},w.isAfter=function(C,E){return W(C)<this.startOf(E)},w.isBefore=function(C,E){return this.endOf(E)<W(C)},w.$g=function(C,E,D){return z.u(C)?this[E]:this.set(D,C)},w.unix=function(){return Math.floor(this.valueOf()/1e3)},w.valueOf=function(){return this.$d.getTime()},w.startOf=function(C,E){var D=this,O=!!z.u(E)||E,N=z.p(C),b=function(J,B){var se=z.w(D.$u?Date.UTC(D.$y,B,J):new Date(D.$y,B,J),D);return O?se:se.endOf(d)},_=function(J,B){return z.w(D.toDate()[J].apply(D.toDate("s"),(O?[0,0,0,0]:[23,59,59,999]).slice(B)),D)},P=this.$W,F=this.$M,G=this.$D,U="set"+(this.$u?"UTC":"");switch(N){case m:return O?b(1,0):b(31,11);case h:return O?b(1,F):b(0,F+1);case g:var Y=this.$locale().weekStart||0,X=(P<Y?P+7:P)-Y;return b(O?G-X:G+(6-X),F);case d:case p:return _(U+"Hours",0);case c:return _(U+"Minutes",1);case i:return _(U+"Seconds",2);case a:return _(U+"Milliseconds",3);default:return this.clone()}},w.endOf=function(C){return this.startOf(C,!1)},w.$set=function(C,E){var D,O=z.p(C),N="set"+(this.$u?"UTC":""),b=(D={},D[d]=N+"Date",D[p]=N+"Date",D[h]=N+"Month",D[m]=N+"FullYear",D[c]=N+"Hours",D[i]=N+"Minutes",D[a]=N+"Seconds",D[s]=N+"Milliseconds",D)[O],_=O===d?this.$D+(E-this.$W):E;if(O===h||O===m){var P=this.clone().set(p,1);P.$d[b](_),P.init(),this.$d=P.set(p,Math.min(this.$D,P.daysInMonth())).$d}else b&&this.$d[b](_);return this.init(),this},w.set=function(C,E){return this.clone().$set(C,E)},w.get=function(C){return this[z.p(C)]()},w.add=function(C,E){var D,O=this;C=Number(C);var N=z.p(E),b=function(F){var G=W(O);return z.w(G.date(G.date()+Math.round(F*C)),O)};if(N===h)return this.set(h,this.$M+C);if(N===m)return this.set(m,this.$y+C);if(N===d)return b(1);if(N===g)return b(7);var _=(D={},D[i]=r,D[c]=o,D[a]=n,D)[N]||1,P=this.$d.getTime()+C*_;return z.w(P,this)},w.subtract=function(C,E){return this.add(-1*C,E)},w.format=function(C){var E=this,D=this.$locale();if(!this.isValid())return D.invalidDate||x;var O=C||"YYYY-MM-DDTHH:mm:ssZ",N=z.z(this),b=this.$H,_=this.$m,P=this.$M,F=D.weekdays,G=D.months,U=D.meridiem,Y=function(B,se,re,ge){return B&&(B[se]||B(E,O))||re[se].slice(0,ge)},X=function(B){return z.s(b%12||12,B,"0")},J=U||function(B,se,re){var ge=B<12?"AM":"PM";return re?ge.toLowerCase():ge};return O.replace(M,(function(B,se){return se||(function(re){switch(re){case"YY":return String(E.$y).slice(-2);case"YYYY":return z.s(E.$y,4,"0");case"M":return P+1;case"MM":return z.s(P+1,2,"0");case"MMM":return Y(D.monthsShort,P,G,3);case"MMMM":return Y(G,P);case"D":return E.$D;case"DD":return z.s(E.$D,2,"0");case"d":return String(E.$W);case"dd":return Y(D.weekdaysMin,E.$W,F,2);case"ddd":return Y(D.weekdaysShort,E.$W,F,3);case"dddd":return F[E.$W];case"H":return String(b);case"HH":return z.s(b,2,"0");case"h":return X(1);case"hh":return X(2);case"a":return J(b,_,!0);case"A":return J(b,_,!1);case"m":return String(_);case"mm":return z.s(_,2,"0");case"s":return String(E.$s);case"ss":return z.s(E.$s,2,"0");case"SSS":return z.s(E.$ms,3,"0");case"Z":return N}return null})(B)||N.replace(":","")}))},w.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},w.diff=function(C,E,D){var O,N=this,b=z.p(E),_=W(C),P=(_.utcOffset()-this.utcOffset())*r,F=this-_,G=function(){return z.m(N,_)};switch(b){case m:O=G()/12;break;case h:O=G();break;case v:O=G()/3;break;case g:O=(F-P)/6048e5;break;case d:O=(F-P)/864e5;break;case c:O=F/o;break;case i:O=F/r;break;case a:O=F/n;break;default:O=F}return D?O:z.a(O)},w.daysInMonth=function(){return this.endOf(h).$D},w.$locale=function(){return k[this.$L]},w.locale=function(C,E){if(!C)return this.$L;var D=this.clone(),O=V(C,E,!0);return O&&(D.$L=O),D},w.clone=function(){return z.w(this.$d,this)},w.toDate=function(){return new Date(this.valueOf())},w.toJSON=function(){return this.isValid()?this.toISOString():null},w.toISOString=function(){return this.$d.toISOString()},w.toString=function(){return this.$d.toUTCString()},T})(),K=q.prototype;return W.prototype=K,[["$ms",s],["$s",a],["$m",i],["$H",c],["$W",d],["$M",h],["$y",m],["$D",p]].forEach((function(T){K[T[1]]=function(w){return this.$g(w,T[0],T[1])}})),W.extend=function(T,w){return T.$i||(T(w,q,W),T.$i=!0),W},W.locale=V,W.isDayjs=A,W.unix=function(T){return W(1e3*T)},W.en=k[$],W.Ls=k,W.p={},W}))})(ht)),ht.exports}var Bc=Wc();const Ot=Ct(Bc);var gt={exports:{}},Vc=gt.exports,tr;function Yc(){return tr||(tr=1,(function(e,t){(function(n,r){e.exports=r()})(Vc,(function(){return function(n,r,o){n=n||{};var s=r.prototype,a={future:"in %s",past:"%s ago",s:"a few seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"};function i(d,g,h,v){return s.fromToBase(d,g,h,v)}o.en.relativeTime=a,s.fromToBase=function(d,g,h,v,m){for(var p,x,y,M=h.$locale().relativeTime||a,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"}],j=R.length,I=0;I<j;I+=1){var $=R[I];$.d&&(p=v?o(d).diff(h,$.d,!0):h.diff(d,$.d,!0));var k=(n.rounding||Math.round)(Math.abs(p));if(y=p>0,k<=$.r||!$.r){k<=1&&I>0&&($=R[I-1]);var L=M[$.l];m&&(k=m(""+k)),x=typeof L=="string"?L.replace("%d",k):L(k,g,$.l,y);break}}if(g)return x;var A=y?M.future:M.past;return typeof A=="function"?A(x):A.replace("%s",x)},s.to=function(d,g){return i(d,g,this,!0)},s.from=function(d,g){return i(d,g,this)};var c=function(d){return d.$u?o.utc():o()};s.toNow=function(d){return this.to(c(this),d)},s.fromNow=function(d){return this.from(c(this),d)}}}))})(gt)),gt.exports}var Hc=Yc();const Uc=Ct(Hc);var pt={exports:{}},Gc=pt.exports,nr;function qc(){return nr||(nr=1,(function(e,t){(function(n,r){e.exports=r()})(Gc,(function(){var n={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"};return function(r,o,s){var a=o.prototype,i=a.format;s.en.formats=n,a.format=function(c){c===void 0&&(c="YYYY-MM-DDTHH:mm:ssZ");var d=this.$locale().formats,g=(function(h,v){return h.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,(function(m,p,x){var y=x&&x.toUpperCase();return p||v[x]||n[x]||v[y].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,(function(M,R,j){return R||j.slice(1)}))}))})(c,d===void 0?{}:d);return i.call(this,g)}}}))})(pt)),pt.exports}var Kc=qc();const Xc=Ct(Kc);var mt={exports:{}},Jc=mt.exports,rr;function Zc(){return rr||(rr=1,(function(e,t){(function(n,r){e.exports=r()})(Jc,(function(){return function(n,r){var o=r.prototype,s=o.format;o.format=function(a){var i=this,c=this.$locale();if(!this.isValid())return s.bind(this)(a);var d=this.$utils(),g=(a||"YYYY-MM-DDTHH:mm:ssZ").replace(/\[([^\]]+)]|Q|wo|ww|w|WW|W|zzz|z|gggg|GGGG|Do|X|x|k{1,2}|S/g,(function(h){switch(h){case"Q":return Math.ceil((i.$M+1)/3);case"Do":return c.ordinal(i.$D);case"gggg":return i.weekYear();case"GGGG":return i.isoWeekYear();case"wo":return c.ordinal(i.week(),"W");case"w":case"ww":return d.s(i.week(),h==="w"?1:2,"0");case"W":case"WW":return d.s(i.isoWeek(),h==="W"?1:2,"0");case"k":case"kk":return d.s(String(i.$H===0?24:i.$H),h==="k"?1:2,"0");case"X":return Math.floor(i.$d.getTime()/1e3);case"x":return i.$d.getTime();case"z":return"["+i.offsetName()+"]";case"zzz":return"["+i.offsetName("long")+"]";default:return h}}));return s.bind(this)(g)}}}))})(mt)),mt.exports}var Qc=Zc();const eu=Ct(Qc);Ot.extend(Uc);Ot.extend(Xc);Ot.extend(eu);const tu={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 en({value:e,variant:t="dateTime",format:n,fallback:r="--"}){if(!e)return r;const o=Ot(e);return o.isValid()?t==="relative"?o.fromNow():o.format(n??tu[t]):r}function nu({value:e,dateVariant:t="date",timeVariant:n="time",dateFormat:r,timeFormat:o,align:s="start",dateColor:a="gray.700",dateFontSize:i="16px",dateFontWeight:c="500",timeColor:d="gray.500",timeFontSize:g="12px",timeFontWeight:h="400",showTime:v=!0}){return l.jsxs(u.Stack,{gap:.5,align:s,children:[l.jsx(u.Text,{fontSize:i,fontWeight:c,color:a,children:en({value:e,variant:t,format:r})}),v&&l.jsx(u.Text,{fontSize:g,fontWeight:h,color:d,children:en({value:e,variant:n,format:o})})]})}class Xr{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 tn{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 nn{constructor(t){this.api=t}store=new Xr;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 Jr=f.createContext(null);function Zr(){const e=f.useContext(Jr);if(!e)throw new Error("OptionsProvider is missing. Wrap your app with <OptionsProvider />");return e}function ru({client:{apiUrl:e},children:t}){const n=f.useRef(new nn(new tn(e)));return n.current||(n.current=new nn(new tn(e))),l.jsx(Jr.Provider,{value:n.current,children:t})}function ou(e){const t=Zr(),[n,r]=f.useState(t.getRaw(e)?.value);return f.useEffect(()=>{let o=!0;t.getKey(e).then(a=>{o&&r(a)});const s=t.subscribe(e,a=>{r(a?.value)});return()=>{o=!1,s()}},[e,t]),n}function su(e){const t=Zr(),[n,r]=f.useState({});return f.useEffect(()=>{let o=!0;t.getMultiKey(e).then(a=>{o&&r(a)});const s=e.map(a=>t.subscribe(a,i=>{r(c=>({...c,[a]:i?.value}))}));return()=>{o=!1,s.forEach(a=>a())}},[e.join("|"),t]),n}async function iu(e,t){return e.getKey(t)}async function au(e,t){await e.getMultiKey(t)}function lu(e={}){const{initialPage:t=1,initialLimit:n=20}=e,[r,o]=f.useState(t),[s,a]=f.useState(n),i=f.useCallback(v=>{o(Math.max(1,v))},[]),c=f.useCallback(v=>{a(Math.max(1,v)),o(1)},[]),d=f.useCallback(()=>{o(v=>v+1)},[]),g=f.useCallback(()=>{o(v=>Math.max(1,v-1))},[]),h=f.useCallback(()=>{o(t),a(n)},[t,n]);return{page:r,limit:s,setPage:i,setLimit:c,nextPage:d,prevPage:g,reset:h}}function cu(e={}){const{initialValue:t="",delay:n=300,len:r=3}=e,[o,s]=f.useState(t),i=o.length===0||o.length>=r?o:"",c=uu(i,n),d=f.useCallback(h=>{s(h)},[]),g=f.useCallback(()=>{s(t)},[t]);return{search:o,debouncedSearch:c,onSearchChange:d,reset:g,len:r}}function uu(e,t=300){const[n,r]=f.useState(e);return f.useEffect(()=>{const o=setTimeout(()=>{r(e)},t);return()=>clearTimeout(o)},[e,t]),n}exports.ACTIONS_COLUMN_ID=Te;exports.DataTable=_a;exports.Filters=Kl;exports.HttpOptionsApi=tn;exports.MDSButton=Zl;exports.MDSCheckbox=Pr;exports.MDSCombobox=Fr;exports.MDSConfirmActionDialog=lc;exports.MDSConfirmDeleteDialog=xc;exports.MDSDatePicker=Br;exports.MDSDateRangePicker=Wr;exports.MDSDialogAction=bc;exports.MDSDialogActions=Kr;exports.MDSDialogBody=qr;exports.MDSDialogWrapper=Oc;exports.MDSInput=Qt;exports.MDSPinInput=Pc;exports.MDSRefreshButton=hn;exports.MDSSelectBox=Vr;exports.OptionsClientImpl=nn;exports.OptionsProvider=ru;exports.OptionsStore=Xr;exports.RefreshButton=hn;exports.SERIAL_NUMBER_COLUMN_ID=wi;exports.StackedDateTime=nu;exports.VISIBILITY_COLUMN_ID=he;exports.addPreset=Hr;exports.deletePreset=Ur;exports.formatDateTime=en;exports.getColumnWidthKey=Rt;exports.getOption=iu;exports.getPresets=Tt;exports.loadOrder=Jl;exports.prefetchOptions=au;exports.saveOrder=Xl;exports.savePresets=fn;exports.setColumnWidth=Ci;exports.setData=_r;exports.setTableId=Ir;exports.tableStore=ne;exports.useDebouncedSearch=cu;exports.useOption=ou;exports.useOptions=su;exports.usePagination=lu;exports.withChildren=S;
|